From: support Date: Mon, 23 Jan 2023 13:40:43 +0000 (+0000) Subject: Built motion from commit ce97982f.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=35d6335614e52c48a1125d71514ec678a0de4393;p=motion2.git Built motion from commit ce97982f.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1cf67e6..461c2e4 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-23T09:45:23.151Z", + "time": "2023-01-23T13:32:23.496Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9765f7a..818dada 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-23T09:45:23.151Z", + "time": "2023-01-23T13:32:23.496Z", "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 988621c..9a7ef3e 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 _0xc315=['TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar','jscripty','urlForward','browser','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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x1c567e,_0x5a135a){var _0x5569c0=function(_0x3e0a19){while(--_0x3e0a19){_0x1c567e['push'](_0x1c567e['shift']());}};_0x5569c0(++_0x5a135a);}(_0xc315,0x192));var _0x5c31=function(_0x3497cb,_0x18ddf7){_0x3497cb=_0x3497cb-0x0;var _0x18540f=_0xc315[_0x3497cb];return _0x18540f;};'use strict';var Sequelize=require('sequelize');module[_0x5c31('0x0')]={'name':{'type':Sequelize[_0x5c31('0x1')],'get':function(_0x11b14c){return this[_0x5c31('0x2')]('action');}},'action':{'type':Sequelize[_0x5c31('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5c31('0x4'),'integration',_0x5c31('0x5'),_0x5c31('0x6'),_0x5c31('0x7'),_0x5c31('0x8'),'bot','script']],'msg':_0x5c31('0x9')}},'comment':_0x5c31('0x9')},'data1':{'type':Sequelize[_0x5c31('0x3')](0x1000),'comment':_0x5c31('0xa')},'data2':{'type':Sequelize[_0x5c31('0x3')](0x1000),'comment':_0x5c31('0xb')},'data3':{'type':Sequelize[_0x5c31('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x5c31('0xc')},'data5':{'type':Sequelize[_0x5c31('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x5c31('0x3')],'comments':_0x5c31('0xd')},'data7':{'type':Sequelize[_0x5c31('0xe')],'comments':_0x5c31('0xf')}}; \ No newline at end of file +var _0x1e93=['motionbar','jscripty','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x1e93,0x14b));var _0x31e9=function(_0x5673f1,_0x3cc273){_0x5673f1=_0x5673f1-0x0;var _0x5bd0ee=_0x1e93[_0x5673f1];return _0x5bd0ee;};'use strict';var Sequelize=require(_0x31e9('0x0'));module[_0x31e9('0x1')]={'name':{'type':Sequelize[_0x31e9('0x2')],'get':function(_0x404393){return this['getDataValue'](_0x31e9('0x3'));}},'action':{'type':Sequelize[_0x31e9('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x31e9('0x5'),_0x31e9('0x6'),'urlForward','browser','bot',_0x31e9('0x7')]],'msg':_0x31e9('0x8')}},'comment':_0x31e9('0x8')},'data1':{'type':Sequelize['STRING'](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[_0x31e9('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x31e9('0x4')](0x1000),'comment':_0x31e9('0x9')},'data4':{'type':Sequelize[_0x31e9('0x4')](0x1000),'comments':_0x31e9('0xa')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x31e9('0xb')},'data6':{'type':Sequelize[_0x31e9('0x4')],'comments':_0x31e9('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x31e9('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1fbe2af..484e5ac 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 _0x30da=['bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','body','find','params','catch','Action','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x110a6c,_0x30f010){var _0x5c35de=function(_0x1f1962){while(--_0x1f1962){_0x110a6c['push'](_0x110a6c['shift']());}};_0x5c35de(++_0x30f010);}(_0x30da,0xb7));var _0xa30d=function(_0x27477d,_0x2b6960){_0x27477d=_0x27477d-0x0;var _0x7c110e=_0x30da[_0x27477d];return _0x7c110e;};'use strict';var emlformat=require(_0xa30d('0x0'));var rimraf=require(_0xa30d('0x1'));var zipdir=require(_0xa30d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa30d('0x3'));var moment=require(_0xa30d('0x4'));var BPromise=require(_0xa30d('0x5'));var Mustache=require(_0xa30d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa30d('0x7'));var csv=require(_0xa30d('0x8'));var ejs=require(_0xa30d('0x9'));var fs=require('fs');var fs_extra=require(_0xa30d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa30d('0xb'));var jsforce=require(_0xa30d('0xc'));var deskjs=require(_0xa30d('0xd'));var toCsv=require(_0xa30d('0x8'));var querystring=require('querystring');var Papa=require(_0xa30d('0xe'));var Redis=require(_0xa30d('0xf'));var authService=require(_0xa30d('0x10'));var qs=require(_0xa30d('0x11'));var as=require(_0xa30d('0x12'));var hardwareService=require(_0xa30d('0x13'));var logger=require(_0xa30d('0x14'))('api');var utils=require(_0xa30d('0x15'));var config=require(_0xa30d('0x16'));var licenseUtil=require(_0xa30d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14d379,_0x89d941){_0x89d941=_0x89d941||0xcc;return function(_0x26815c){if(_0x26815c){return _0x14d379[_0xa30d('0x18')](_0x89d941);}return _0x14d379['status'](_0x89d941)[_0xa30d('0x19')]();};}function respondWithResult(_0x389e98,_0x39ab25){_0x39ab25=_0x39ab25||0xc8;return function(_0x13c485){if(_0x13c485){return _0x389e98[_0xa30d('0x1a')](_0x39ab25)['json'](_0x13c485);}};}function respondWithFilteredResult(_0x216cf2,_0x28b720){return function(_0x3c4e29){if(_0x3c4e29){var _0x168311=typeof _0x28b720[_0xa30d('0x1b')]===_0xa30d('0x1c')&&typeof _0x28b720[_0xa30d('0x1d')]==='undefined';var _0x56e4fd=_0x3c4e29[_0xa30d('0x1e')];var _0x46c72c=_0x168311?0x0:_0x28b720[_0xa30d('0x1b')];var _0x95ed85=_0x168311?_0x3c4e29[_0xa30d('0x1e')]:_0x28b720[_0xa30d('0x1b')]+_0x28b720[_0xa30d('0x1d')];var _0x3ae73;if(_0x95ed85>=_0x56e4fd){_0x95ed85=_0x56e4fd;_0x3ae73=0xc8;}else{_0x3ae73=0xce;}_0x216cf2[_0xa30d('0x1a')](_0x3ae73);return _0x216cf2[_0xa30d('0x1f')](_0xa30d('0x20'),_0x46c72c+'-'+_0x95ed85+'/'+_0x56e4fd)[_0xa30d('0x21')](_0x3c4e29);}return null;};}function patchUpdates(_0x361db1){return function(_0x366f4e){try{jsonpatch[_0xa30d('0x22')](_0x366f4e,_0x361db1,!![]);}catch(_0x5995f6){return BPromise[_0xa30d('0x23')](_0x5995f6);}return _0x366f4e[_0xa30d('0x24')]();};}function saveUpdates(_0x5b5ea9,_0x181c8d){return function(_0x39e25b){if(_0x39e25b){return _0x39e25b[_0xa30d('0x25')](_0x5b5ea9)[_0xa30d('0x26')](function(_0x1dee24){return _0x1dee24;});}return null;};}function removeEntity(_0x3103ac,_0x218196){return function(_0x784823){if(_0x784823){return _0x784823[_0xa30d('0x27')]()[_0xa30d('0x26')](function(){_0x3103ac['status'](0xcc)[_0xa30d('0x19')]();});}};}function handleEntityNotFound(_0x172638,_0x418cf5){return function(_0xaac6a7){if(!_0xaac6a7){_0x172638[_0xa30d('0x18')](0x194);}return _0xaac6a7;};}function handleError(_0x2e6109,_0x3f5d73){_0x3f5d73=_0x3f5d73||0x1f4;return function(_0x3650d8){logger['error'](_0x3650d8[_0xa30d('0x28')]);if(_0x3650d8[_0xa30d('0x29')]){delete _0x3650d8[_0xa30d('0x29')];}_0x2e6109['status'](_0x3f5d73)['send'](_0x3650d8);};}exports[_0xa30d('0x25')]=function(_0x206698,_0x162d23){if(_0x206698['body']['id']){delete _0x206698[_0xa30d('0x2a')]['id'];}return db['Action'][_0xa30d('0x2b')]({'where':{'id':_0x206698[_0xa30d('0x2c')]['id']}})[_0xa30d('0x26')](handleEntityNotFound(_0x162d23,null))[_0xa30d('0x26')](saveUpdates(_0x206698[_0xa30d('0x2a')],null))['then'](respondWithResult(_0x162d23,null))[_0xa30d('0x2d')](handleError(_0x162d23,null));};exports[_0xa30d('0x27')]=function(_0x68ffe3,_0x559daf){return db[_0xa30d('0x2e')][_0xa30d('0x2b')]({'where':{'id':_0x68ffe3[_0xa30d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x559daf,null))[_0xa30d('0x26')](removeEntity(_0x559daf,null))[_0xa30d('0x2d')](handleError(_0x559daf,null));}; \ No newline at end of file +var _0xfe07=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','update','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3f32d9,_0x3807f3){var _0x44375b=function(_0x2776b2){while(--_0x2776b2){_0x3f32d9['push'](_0x3f32d9['shift']());}};_0x44375b(++_0x3807f3);}(_0xfe07,0x161));var _0x7fe0=function(_0x1bf4f9,_0x48a7b2){_0x1bf4f9=_0x1bf4f9-0x0;var _0x2f0a77=_0xfe07[_0x1bf4f9];return _0x2f0a77;};'use strict';var emlformat=require(_0x7fe0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fe0('0x1'));var jsonpatch=require(_0x7fe0('0x2'));var rp=require(_0x7fe0('0x3'));var moment=require(_0x7fe0('0x4'));var BPromise=require(_0x7fe0('0x5'));var Mustache=require(_0x7fe0('0x6'));var util=require('util');var path=require(_0x7fe0('0x7'));var sox=require('sox');var csv=require(_0x7fe0('0x8'));var ejs=require(_0x7fe0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7fe0('0xa'));var crypto=require(_0x7fe0('0xb'));var jsforce=require(_0x7fe0('0xc'));var deskjs=require(_0x7fe0('0xd'));var toCsv=require(_0x7fe0('0x8'));var querystring=require(_0x7fe0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fe0('0xf'));var qs=require(_0x7fe0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fe0('0x11'));var logger=require(_0x7fe0('0x12'))('api');var utils=require(_0x7fe0('0x13'));var config=require(_0x7fe0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fe0('0x15'))['db'];function respondWithStatusCode(_0x2d8754,_0x26ba6f){_0x26ba6f=_0x26ba6f||0xcc;return function(_0x2dad86){if(_0x2dad86){return _0x2d8754[_0x7fe0('0x16')](_0x26ba6f);}return _0x2d8754[_0x7fe0('0x17')](_0x26ba6f)[_0x7fe0('0x18')]();};}function respondWithResult(_0x556edc,_0x3eee3f){_0x3eee3f=_0x3eee3f||0xc8;return function(_0x430059){if(_0x430059){return _0x556edc[_0x7fe0('0x17')](_0x3eee3f)[_0x7fe0('0x19')](_0x430059);}};}function respondWithFilteredResult(_0x2f03e7,_0x5616be){return function(_0x239088){if(_0x239088){var _0x485ad1=typeof _0x5616be['offset']===_0x7fe0('0x1a')&&typeof _0x5616be[_0x7fe0('0x1b')]===_0x7fe0('0x1a');var _0x7cc12=_0x239088[_0x7fe0('0x1c')];var _0x5d8f8f=_0x485ad1?0x0:_0x5616be[_0x7fe0('0x1d')];var _0x280fe6=_0x485ad1?_0x239088[_0x7fe0('0x1c')]:_0x5616be[_0x7fe0('0x1d')]+_0x5616be[_0x7fe0('0x1b')];var _0x94d2cb;if(_0x280fe6>=_0x7cc12){_0x280fe6=_0x7cc12;_0x94d2cb=0xc8;}else{_0x94d2cb=0xce;}_0x2f03e7[_0x7fe0('0x17')](_0x94d2cb);return _0x2f03e7[_0x7fe0('0x1e')](_0x7fe0('0x1f'),_0x5d8f8f+'-'+_0x280fe6+'/'+_0x7cc12)[_0x7fe0('0x19')](_0x239088);}return null;};}function patchUpdates(_0x29ade5){return function(_0x1bbe40){try{jsonpatch[_0x7fe0('0x20')](_0x1bbe40,_0x29ade5,!![]);}catch(_0x2787ce){return BPromise[_0x7fe0('0x21')](_0x2787ce);}return _0x1bbe40['save']();};}function saveUpdates(_0x2e1c73,_0x1788da){return function(_0x479cd1){if(_0x479cd1){return _0x479cd1['update'](_0x2e1c73)[_0x7fe0('0x22')](function(_0x3dd5d8){return _0x3dd5d8;});}return null;};}function removeEntity(_0x155286,_0x850f8a){return function(_0x1fdb6a){if(_0x1fdb6a){return _0x1fdb6a[_0x7fe0('0x23')]()[_0x7fe0('0x22')](function(){_0x155286[_0x7fe0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2194c8,_0x3c84cf){return function(_0x38cf1e){if(!_0x38cf1e){_0x2194c8[_0x7fe0('0x16')](0x194);}return _0x38cf1e;};}function handleError(_0x3a882d,_0x40f335){_0x40f335=_0x40f335||0x1f4;return function(_0x1075d9){logger[_0x7fe0('0x24')](_0x1075d9[_0x7fe0('0x25')]);if(_0x1075d9['name']){delete _0x1075d9[_0x7fe0('0x26')];}_0x3a882d['status'](_0x40f335)[_0x7fe0('0x27')](_0x1075d9);};}exports[_0x7fe0('0x28')]=function(_0x5ba08b,_0x4cd937){if(_0x5ba08b['body']['id']){delete _0x5ba08b[_0x7fe0('0x29')]['id'];}return db[_0x7fe0('0x2a')][_0x7fe0('0x2b')]({'where':{'id':_0x5ba08b[_0x7fe0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4cd937,null))[_0x7fe0('0x22')](saveUpdates(_0x5ba08b['body'],null))[_0x7fe0('0x22')](respondWithResult(_0x4cd937,null))[_0x7fe0('0x2d')](handleError(_0x4cd937,null));};exports['destroy']=function(_0x4b2fb4,_0x3568ac){return db[_0x7fe0('0x2a')][_0x7fe0('0x2b')]({'where':{'id':_0x4b2fb4[_0x7fe0('0x2c')]['id']}})[_0x7fe0('0x22')](handleEntityNotFound(_0x3568ac,null))[_0x7fe0('0x22')](removeEntity(_0x3568ac,null))[_0x7fe0('0x2d')](handleError(_0x3568ac,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 73aabc5..302cd1b 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 _0x3407=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ac32b,_0x134b81){var _0x298c2e=function(_0x40703a){while(--_0x40703a){_0x2ac32b['push'](_0x2ac32b['shift']());}};_0x298c2e(++_0x134b81);}(_0x3407,0x1c8));var _0x7340=function(_0x4b5daf,_0x519e25){_0x4b5daf=_0x4b5daf-0x0;var _0x371b52=_0x3407[_0x4b5daf];return _0x371b52;};'use strict';var _=require(_0x7340('0x0'));var util=require(_0x7340('0x1'));var logger=require(_0x7340('0x2'))(_0x7340('0x3'));var moment=require(_0x7340('0x4'));var BPromise=require(_0x7340('0x5'));var rp=require(_0x7340('0x6'));var fs=require('fs');var path=require(_0x7340('0x7'));var rimraf=require(_0x7340('0x8'));var config=require(_0x7340('0x9'));var attributes=require(_0x7340('0xa'));module[_0x7340('0xb')]=function(_0x1ab8a4,_0x45f099){return _0x1ab8a4[_0x7340('0xc')](_0x7340('0xd'),attributes,{'tableName':_0x7340('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31a3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger'];(function(_0x23f659,_0x33bfcb){var _0x1edce0=function(_0x48ca3f){while(--_0x48ca3f){_0x23f659['push'](_0x23f659['shift']());}};_0x1edce0(++_0x33bfcb);}(_0x31a3,0x183));var _0x331a=function(_0x97ab47,_0x5cdab2){_0x97ab47=_0x97ab47-0x0;var _0x2d291f=_0x31a3[_0x97ab47];return _0x2d291f;};'use strict';var _=require(_0x331a('0x0'));var util=require(_0x331a('0x1'));var logger=require(_0x331a('0x2'))(_0x331a('0x3'));var moment=require(_0x331a('0x4'));var BPromise=require(_0x331a('0x5'));var rp=require(_0x331a('0x6'));var fs=require('fs');var path=require(_0x331a('0x7'));var rimraf=require(_0x331a('0x8'));var config=require(_0x331a('0x9'));var attributes=require(_0x331a('0xa'));module[_0x331a('0xb')]=function(_0x7665a9,_0x221b58){return _0x7665a9[_0x331a('0xc')](_0x331a('0xd'),attributes,{'tableName':_0x331a('0xe'),'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 2244e3b..d706ba0 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x10394a,_0xf24fbd){var _0xf1b851=function(_0x5c3a9f){while(--_0x5c3a9f){_0x10394a['push'](_0x10394a['shift']());}};_0xf1b851(++_0xf24fbd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e7088,_0x53f329){var _0x569c18=function(_0x3c09b9){while(--_0x3c09b9){_0x3e7088['push'](_0x3e7088['shift']());}};_0x569c18(++_0x53f329);}(_0x8ef6,0xf2));var _0x68ef=function(_0x333981,_0x344c4e){_0x333981=_0x333981-0x0;var _0xfcb54d=_0x8ef6[_0x333981];return _0xfcb54d;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index a606b45..b354062 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 _0xceb7=['../../components/interaction/service','../../config/environment','/:id','delete','isAuthenticated','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0xcebc1,_0x368a1d){var _0x1395da=function(_0x3d0b77){while(--_0x3d0b77){_0xcebc1['push'](_0xcebc1['shift']());}};_0x1395da(++_0x368a1d);}(_0xceb7,0x19e));var _0x7ceb=function(_0x4778b1,_0x4b5ac8){_0x4778b1=_0x4778b1-0x0;var _0x3b7e3e=_0xceb7[_0x4778b1];return _0x3b7e3e;};'use strict';var multer=require(_0x7ceb('0x0'));var util=require(_0x7ceb('0x1'));var path=require(_0x7ceb('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ceb('0x3'));var router=express['Router']();var fs_extra=require(_0x7ceb('0x4'));var auth=require(_0x7ceb('0x5'));var interaction=require(_0x7ceb('0x6'));var config=require(_0x7ceb('0x7'));var controller=require('./action.controller');router['put'](_0x7ceb('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7ceb('0x9')](_0x7ceb('0x8'),auth[_0x7ceb('0xa')](),controller['destroy']);module[_0x7ceb('0xb')]=router; \ No newline at end of file +var _0xb9e1=['../../components/auth/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','connect-timeout','express','fs-extra'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xb9e1,0x126));var _0x1b9e=function(_0xab3157,_0x28ef0c){_0xab3157=_0xab3157-0x0;var _0x4045dc=_0xb9e1[_0xab3157];return _0x4045dc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1b9e('0x0'));var express=require(_0x1b9e('0x1'));var router=express['Router']();var fs_extra=require(_0x1b9e('0x2'));var auth=require(_0x1b9e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b9e('0x4'));router[_0x1b9e('0x5')](_0x1b9e('0x6'),auth[_0x1b9e('0x7')](),controller[_0x1b9e('0x8')]);router[_0x1b9e('0x9')]('/:id',auth[_0x1b9e('0x7')](),controller[_0x1b9e('0xa')]);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 a8f7745..20f2ac2 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['sequelize','STRING','TEXT'];(function(_0x49add8,_0x4c079d){var _0x9186f7=function(_0x412e7a){while(--_0x412e7a){_0x49add8['push'](_0x49add8['shift']());}};_0x9186f7(++_0x4c079d);}(_0x7217,0x19e));var _0x7721=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7217[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x33548b,_0x2887b2){var _0x1530ec=function(_0x2bcc62){while(--_0x2bcc62){_0x33548b['push'](_0x33548b['shift']());}};_0x1530ec(++_0x2887b2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x5fc3[_0x219d87];return _0x22823d;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2a92891..c1fd5a7 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 _0xbaf4=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','offset','undefined','count','set','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','right_join','MAX(%s)','condition','getFields','Sequelize','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','DESC','eml-format','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv'];(function(_0x4715c4,_0x178c7f){var _0x345655=function(_0x56d0a5){while(--_0x56d0a5){_0x4715c4['push'](_0x4715c4['shift']());}};_0x345655(++_0x178c7f);}(_0xbaf4,0x13f));var _0x4baf=function(_0x389a91,_0x28bec1){_0x389a91=_0x389a91-0x0;var _0x1f9c8a=_0xbaf4[_0x389a91];return _0x1f9c8a;};'use strict';var emlformat=require(_0x4baf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4baf('0x1'));var Mustache=require(_0x4baf('0x2'));var util=require(_0x4baf('0x3'));var path=require('path');var sox=require(_0x4baf('0x4'));var csv=require('to-csv');var ejs=require(_0x4baf('0x5'));var fs=require('fs');var fs_extra=require(_0x4baf('0x6'));var _=require(_0x4baf('0x7'));var squel=require('squel');var crypto=require(_0x4baf('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x4baf('0x9'));var toCsv=require(_0x4baf('0xa'));var querystring=require(_0x4baf('0xb'));var Papa=require(_0x4baf('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4baf('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4baf('0xe'));var logger=require(_0x4baf('0xf'))(_0x4baf('0x10'));var utils=require(_0x4baf('0x11'));var config=require(_0x4baf('0x12'));var licenseUtil=require(_0x4baf('0x13'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4baf('0x14'))[_0x4baf('0x15')];function respondWithStatusCode(_0x12a1ad,_0x24248e){_0x24248e=_0x24248e||0xcc;return function(_0x48358b){if(_0x48358b){return _0x12a1ad['sendStatus'](_0x24248e);}return _0x12a1ad['status'](_0x24248e)['end']();};}function respondWithResult(_0x950b09,_0x3449a0){_0x3449a0=_0x3449a0||0xc8;return function(_0x18861c){if(_0x18861c){return _0x950b09[_0x4baf('0x16')](_0x3449a0)[_0x4baf('0x17')](_0x18861c);}};}function respondWithFilteredResult(_0x3083b8,_0x4c44c2){return function(_0x50d430){if(_0x50d430){var _0xe6925e=typeof _0x4c44c2[_0x4baf('0x18')]===_0x4baf('0x19')&&typeof _0x4c44c2['limit']==='undefined';var _0x416d83=_0x50d430['count'];var _0x478324=_0xe6925e?0x0:_0x4c44c2[_0x4baf('0x18')];var _0x126b93=_0xe6925e?_0x50d430[_0x4baf('0x1a')]:_0x4c44c2['offset']+_0x4c44c2['limit'];var _0x110090;if(_0x126b93>=_0x416d83){_0x126b93=_0x416d83;_0x110090=0xc8;}else{_0x110090=0xce;}_0x3083b8['status'](_0x110090);return _0x3083b8[_0x4baf('0x1b')]('Content-Range',_0x478324+'-'+_0x126b93+'/'+_0x416d83)[_0x4baf('0x17')](_0x50d430);}return null;};}function patchUpdates(_0x1e3590){return function(_0x1d11fb){try{jsonpatch[_0x4baf('0x1c')](_0x1d11fb,_0x1e3590,!![]);}catch(_0xe7addf){return BPromise[_0x4baf('0x1d')](_0xe7addf);}return _0x1d11fb[_0x4baf('0x1e')]();};}function saveUpdates(_0x5a4a81,_0x369378){return function(_0x43b61e){if(_0x43b61e){return _0x43b61e['update'](_0x5a4a81)['then'](function(_0x31fcc4){return _0x31fcc4;});}return null;};}function removeEntity(_0xf67a7,_0x551d14){return function(_0x15c45f){if(_0x15c45f){return _0x15c45f[_0x4baf('0x1f')]()[_0x4baf('0x20')](function(){var _0x41dbaa=_0x15c45f[_0x4baf('0x21')]({'plain':!![]});var _0x36d653=_0x4baf('0x22');return db[_0x4baf('0x23')][_0x4baf('0x1f')]({'where':{'type':_0x36d653,'resourceId':_0x41dbaa['id']}})[_0x4baf('0x20')](function(){return _0x15c45f;});})[_0x4baf('0x20')](function(){_0xf67a7[_0x4baf('0x16')](0xcc)[_0x4baf('0x24')]();});}};}function handleEntityNotFound(_0x10b482,_0x5d5d49){return function(_0x43f170){if(!_0x43f170){_0x10b482['sendStatus'](0x194);}return _0x43f170;};}function handleError(_0x4bfe5d,_0xd9b84e){_0xd9b84e=_0xd9b84e||0x1f4;return function(_0x12b4f3){logger[_0x4baf('0x25')](_0x12b4f3[_0x4baf('0x26')]);if(_0x12b4f3[_0x4baf('0x27')]){delete _0x12b4f3[_0x4baf('0x27')];}_0x4bfe5d['status'](_0xd9b84e)['send'](_0x12b4f3);};}exports[_0x4baf('0x28')]=function(_0x130c99,_0x67a596){var _0x4c927f={},_0x2ce858={},_0x1816bf={'count':0x0,'rows':[]};var _0x3e5cb1=_['map'](db['AnalyticCustomReport'][_0x4baf('0x29')],function(_0x182798){return{'name':_0x182798[_0x4baf('0x2a')],'type':_0x182798['type'][_0x4baf('0x2b')]};});_0x2ce858['model']=_[_0x4baf('0x2c')](_0x3e5cb1,_0x4baf('0x27'));_0x2ce858[_0x4baf('0x2d')]=_['keys'](_0x130c99[_0x4baf('0x2d')]);_0x2ce858[_0x4baf('0x2e')]=_[_0x4baf('0x2f')](_0x2ce858[_0x4baf('0x30')],_0x2ce858['query']);_0x4c927f[_0x4baf('0x31')]=_[_0x4baf('0x2f')](_0x2ce858[_0x4baf('0x30')],qs[_0x4baf('0x32')](_0x130c99['query'][_0x4baf('0x32')]));_0x4c927f[_0x4baf('0x31')]=_0x4c927f[_0x4baf('0x31')][_0x4baf('0x33')]?_0x4c927f['attributes']:_0x2ce858[_0x4baf('0x30')];if(!_0x130c99['query'][_0x4baf('0x34')](_0x4baf('0x35'))){_0x4c927f['limit']=qs[_0x4baf('0x36')](_0x130c99['query'][_0x4baf('0x36')]);_0x4c927f[_0x4baf('0x18')]=qs[_0x4baf('0x18')](_0x130c99[_0x4baf('0x2d')][_0x4baf('0x18')]);}_0x4c927f[_0x4baf('0x37')]=qs['sort'](_0x130c99[_0x4baf('0x2d')][_0x4baf('0x38')]);_0x4c927f[_0x4baf('0x39')]=qs[_0x4baf('0x2e')](_[_0x4baf('0x3a')](_0x130c99[_0x4baf('0x2d')],_0x2ce858[_0x4baf('0x2e')]),_0x3e5cb1);if(_0x130c99[_0x4baf('0x2d')][_0x4baf('0x3b')]){_0x4c927f[_0x4baf('0x39')]=_[_0x4baf('0x3c')](_0x4c927f[_0x4baf('0x39')],{'$or':_[_0x4baf('0x2c')](_0x3e5cb1,function(_0x56f28a){if(_0x56f28a[_0x4baf('0x3d')]!==_0x4baf('0x3e')){var _0x5a0fc9={};_0x5a0fc9[_0x56f28a['name']]={'$like':'%'+_0x130c99['query'][_0x4baf('0x3b')]+'%'};return _0x5a0fc9;}})});}_0x4c927f=_[_0x4baf('0x3c')]({},_0x4c927f,_0x130c99[_0x4baf('0x3f')]);var _0x5d10b2={'where':_0x4c927f[_0x4baf('0x39')]};return db[_0x4baf('0x40')]['count'](_0x5d10b2)['then'](function(_0x58e84d){_0x1816bf[_0x4baf('0x1a')]=_0x58e84d;if(_0x130c99[_0x4baf('0x2d')][_0x4baf('0x41')]){_0x4c927f[_0x4baf('0x42')]=[{'all':!![]}];}return db[_0x4baf('0x40')][_0x4baf('0x43')](_0x4c927f);})[_0x4baf('0x20')](function(_0x11f5eb){_0x1816bf[_0x4baf('0x44')]=_0x11f5eb;return _0x1816bf;})[_0x4baf('0x20')](respondWithFilteredResult(_0x67a596,_0x4c927f))[_0x4baf('0x45')](handleError(_0x67a596,null));};exports['show']=function(_0x5d7586,_0x13b919){var _0x594efc={'raw':![],'where':{'id':_0x5d7586[_0x4baf('0x46')]['id']}},_0x1b4836={};_0x1b4836[_0x4baf('0x30')]=_[_0x4baf('0x47')](db['AnalyticCustomReport'][_0x4baf('0x29')]);_0x1b4836['query']=_['keys'](_0x5d7586[_0x4baf('0x2d')]);_0x1b4836[_0x4baf('0x2e')]=_['intersection'](_0x1b4836['model'],_0x1b4836[_0x4baf('0x2d')]);_0x594efc['attributes']=_['intersection'](_0x1b4836['model'],qs['fields'](_0x5d7586['query'][_0x4baf('0x32')]));_0x594efc[_0x4baf('0x31')]=_0x594efc[_0x4baf('0x31')]['length']?_0x594efc['attributes']:_0x1b4836[_0x4baf('0x30')];if(_0x5d7586[_0x4baf('0x2d')][_0x4baf('0x41')]){_0x594efc[_0x4baf('0x42')]=[{'all':!![]}];}_0x594efc=_[_0x4baf('0x3c')]({},_0x594efc,_0x5d7586['options']);return db[_0x4baf('0x40')][_0x4baf('0x48')](_0x594efc)[_0x4baf('0x20')](handleEntityNotFound(_0x13b919,null))[_0x4baf('0x20')](respondWithResult(_0x13b919,null))['catch'](handleError(_0x13b919,null));};exports[_0x4baf('0x49')]=function(_0xeda2f5,_0x5d01a6){return db['AnalyticCustomReport'][_0x4baf('0x49')](_0xeda2f5[_0x4baf('0x4a')],{})[_0x4baf('0x20')](function(_0x3e1086){var _0x293896=_0xeda2f5['user'][_0x4baf('0x21')]({'plain':!![]});if(!_0x293896)throw new Error(_0x4baf('0x4b'));if(_0x293896[_0x4baf('0x4c')]===_0x4baf('0x4d')){var _0xfe6a8f=_0x3e1086['get']({'plain':!![]});var _0x9055ee=_0x4baf('0x4e');return db['UserProfileSection'][_0x4baf('0x48')]({'where':{'name':_0x9055ee,'userProfileId':_0x293896[_0x4baf('0x4f')]},'raw':!![]})['then'](function(_0x51e779){if(_0x51e779&&_0x51e779[_0x4baf('0x50')]===0x0){return db['UserProfileResource'][_0x4baf('0x49')]({'name':_0xfe6a8f['name'],'resourceId':_0xfe6a8f['id'],'type':_0x4baf('0x22'),'sectionId':_0x51e779['id']},{})['then'](function(){return _0x3e1086;});}else{return _0x3e1086;}})['catch'](function(_0x308497){logger['error'](_0x4baf('0x51'),_0x308497);throw _0x308497;});}return _0x3e1086;})['then'](respondWithResult(_0x5d01a6,0xc9))[_0x4baf('0x45')](handleError(_0x5d01a6,null));};exports['update']=function(_0x492b21,_0x3f7990){if(_0x492b21[_0x4baf('0x4a')]['id']){delete _0x492b21[_0x4baf('0x4a')]['id'];}return db[_0x4baf('0x40')][_0x4baf('0x48')]({'where':{'id':_0x492b21[_0x4baf('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f7990,null))['then'](saveUpdates(_0x492b21[_0x4baf('0x4a')],null))[_0x4baf('0x20')](respondWithResult(_0x3f7990,null))[_0x4baf('0x45')](handleError(_0x3f7990,null));};exports[_0x4baf('0x1f')]=function(_0x42a2a5,_0x5e45d5){return db[_0x4baf('0x40')]['find']({'where':{'id':_0x42a2a5[_0x4baf('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e45d5,null))[_0x4baf('0x20')](removeEntity(_0x5e45d5,null))['catch'](handleError(_0x5e45d5,null));};exports[_0x4baf('0x52')]=function(_0xac536b,_0x571d88){var _0x38896f=0xa;var _0x444333=[_0x4baf('0x53'),_0x4baf('0x54'),'right_join',_0x4baf('0x55')];var _0x4d3cc4={'SUM':_0x4baf('0x56'),'COUNT':_0x4baf('0x57'),'COUNT DISTINCT':_0x4baf('0x58'),'MAX':'MAX(%s)','MIN':_0x4baf('0x59'),'AVG':_0x4baf('0x5a'),'GROUP_CONCAT':_0x4baf('0x5b'),'GROUP_CONCAT ASC':_0x4baf('0x5c'),'GROUP_CONCAT DESC':_0x4baf('0x5d')};var _0x7a9cdf={'SEC_TO_TIME':_0x4baf('0x5e'),'DATE':_0x4baf('0x5f'),'HOUR':_0x4baf('0x60'),'ROUND':_0x4baf('0x61'),'UNIX_TIMESTAMP':_0x4baf('0x62')};var _0x189d0a=function(_0x4ddeac){return!_[_0x4baf('0x63')]([_0x4baf('0x64'),_0x4baf('0x65'),_0x4baf('0x66'),_0x4baf('0x67')],_0x4ddeac);};var _0x26f6f6=function(_0x5f4e3c){if(!_0x5f4e3c||!_0x5f4e3c[_0x4baf('0x68')]['length']){return'';}for(var _0xc3ec72='(',_0x3cfbc7=0x0;_0x3cfbc7<_0x5f4e3c[_0x4baf('0x68')]['length'];_0x3cfbc7+=0x1){_0x3cfbc7>0x0&&(_0xc3ec72+='\x20'+_0x5f4e3c[_0x4baf('0x69')]+'\x20');_0xc3ec72+=_0x5f4e3c[_0x4baf('0x68')][_0x3cfbc7][_0x4baf('0x6a')]?_0x26f6f6(_0x5f4e3c[_0x4baf('0x68')][_0x3cfbc7][_0x4baf('0x6a')]):_0x5f4e3c[_0x4baf('0x68')][_0x3cfbc7]['field']+'\x20'+_0x5f4e3c[_0x4baf('0x68')][_0x3cfbc7]['condition']+(_0x189d0a(_0x5f4e3c[_0x4baf('0x68')][_0x3cfbc7]['condition'])?'\x20'+_0x5f4e3c['rules'][_0x3cfbc7][_0x4baf('0x6b')]:'');}return _0xc3ec72+')';};var _0x26a6dd={'where':{'id':_0xac536b[_0x4baf('0x46')]['id']}},_0x59c217,_0x13f8c5,_0x5a5788,_0x5d7318,_0x44db0e;_0x26a6dd=_['merge']({},_0x26a6dd,_0xac536b[_0x4baf('0x3f')]);return db[_0x4baf('0x40')][_0x4baf('0x48')](_0x26a6dd)[_0x4baf('0x20')](function(_0x320bee){if(_0x320bee){_0x59c217=_0x320bee;return _0x320bee['getFields']();}return null;})[_0x4baf('0x20')](function(_0x5903f0){if(_0x5903f0){if(!_0x5903f0['length']){throw new db['Sequelize'][(_0x4baf('0x6c'))](_0x4baf('0x6d'),0x193);}_0x13f8c5=_0x5903f0;return db[_0x4baf('0x6e')][_0x4baf('0x43')]({'raw':!![]});}return null;})[_0x4baf('0x20')](function(_0x5d2ca1){if(_0x5d2ca1){_0x5a5788=_[_0x4baf('0x6f')](_0x5d2ca1,'id');var _0x4514b9;var _0x5b4147=squel[_0x4baf('0x70')]();_0x5b4147[_0x4baf('0x71')](_0x59c217[_0x4baf('0x72')]);for(var _0xcd8835=0x0;_0xcd8835<_0x13f8c5[_0x4baf('0x33')];_0xcd8835+=0x1){_0x4514b9=_0x13f8c5[_0xcd8835][_0x4baf('0x73')]?_0x5a5788[_0x13f8c5[_0xcd8835]['MetricId']][_0x4baf('0x74')]:_0x13f8c5[_0xcd8835][_0x4baf('0x75')];_0x4514b9=_0x13f8c5[_0xcd8835][_0x4baf('0x76')]?_[_0x4baf('0x77')](_0x4d3cc4[_0x13f8c5[_0xcd8835][_0x4baf('0x76')]],'%s',_0x4514b9):_0x4514b9;_0x4514b9=_0x13f8c5[_0xcd8835][_0x4baf('0x78')]?_[_0x4baf('0x77')](_0x7a9cdf[_0x13f8c5[_0xcd8835][_0x4baf('0x78')]],'%s',_0x4514b9):_0x4514b9;if(_0x13f8c5[_0xcd8835][_0x4baf('0x79')]){_0x5b4147[_0x4baf('0x6a')](_0x4514b9);}_0x13f8c5[_0xcd8835][_0x4baf('0x7a')]&&_0x5b4147[_0x4baf('0x37')](_0x4514b9,_0x13f8c5[_0xcd8835][_0x4baf('0x7a')]==='DESC'?![]:!![]);_0x5b4147[_0x4baf('0x75')](_0x4514b9,_0x13f8c5[_0xcd8835][_0x4baf('0x7b')]||_0x4514b9);}if(_0x59c217[_0x4baf('0x7c')]){_0x59c217[_0x4baf('0x7c')]=JSON[_0x4baf('0x7d')](_0x59c217[_0x4baf('0x7c')]);for(var _0x1708ef=0x0;_0x1708ef<_0x59c217[_0x4baf('0x7c')][_0x4baf('0x33')];_0x1708ef+=0x1){if(_0x59c217[_0x4baf('0x7c')][_0x1708ef]['type']&&_['includes'](_0x444333,_0x59c217[_0x4baf('0x7c')][_0x1708ef][_0x4baf('0x3d')])&&_0x59c217[_0x4baf('0x7c')][_0x1708ef]['parentKey']&&_0x59c217[_0x4baf('0x7c')][_0x1708ef][_0x4baf('0x7e')]&&_0x59c217['joins'][_0x1708ef][_0x4baf('0x7f')]){_0x5b4147[_0x59c217[_0x4baf('0x7c')][_0x1708ef][_0x4baf('0x3d')]](_0x59c217['joins'][_0x1708ef][_0x4baf('0x7e')],null,util[_0x4baf('0x78')]('%s.%s\x20=\x20%s.%s',_0x59c217[_0x4baf('0x72')],_0x59c217[_0x4baf('0x7c')][_0x1708ef][_0x4baf('0x80')],_0x59c217['joins'][_0x1708ef][_0x4baf('0x7e')],_0x59c217[_0x4baf('0x7c')][_0x1708ef]['foreignKey']));}}}if(_0x59c217['conditions']){_0x59c217[_0x4baf('0x81')]=JSON[_0x4baf('0x7d')](_0x59c217[_0x4baf('0x81')]);_0x5b4147[_0x4baf('0x39')](_0x26f6f6(_0x59c217['conditions'][_0x4baf('0x6a')]));}_0x44db0e=_0x5b4147[_0x4baf('0x82')]();_0x5b4147['limit'](_0x38896f);_0x5b4147['offset'](0x0);logger[_0x4baf('0x83')](_0x4baf('0x84'),_0x5b4147['toString']());return dbH[_0x4baf('0x85')][_0x4baf('0x2d')](_0x5b4147['toString'](),{'type':dbH['sequelize'][_0x4baf('0x86')]['SELECT']});}})[_0x4baf('0x20')](respondWithResult(_0x571d88,null))[_0x4baf('0x45')](handleError(_0x571d88,null));};function runReport(_0x1a996c,_0x58546a,_0x1e114d){var _0x4d04e9=_0x58546a[_0x4baf('0x27')];var _0x181651=0xa;var _0x8e4c9=[_0x4baf('0x53'),_0x4baf('0x54'),_0x4baf('0x87'),'cross_join'];var _0x47ac3f={'SUM':_0x4baf('0x56'),'COUNT':_0x4baf('0x57'),'COUNT DISTINCT':_0x4baf('0x58'),'MAX':_0x4baf('0x88'),'MIN':_0x4baf('0x59'),'AVG':_0x4baf('0x5a'),'GROUP_CONCAT':_0x4baf('0x5b'),'GROUP_CONCAT ASC':_0x4baf('0x5c'),'GROUP_CONCAT DESC':_0x4baf('0x5d')};var _0x40e2ef={'SEC_TO_TIME':_0x4baf('0x5e'),'DATE':_0x4baf('0x5f'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4baf('0x62')};var _0x4b3e84=function(_0x30932a){return!_['includes']([_0x4baf('0x64'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x30932a);};var _0x21dc92=function(_0x5788e6){if(!_0x5788e6||!_0x5788e6[_0x4baf('0x68')][_0x4baf('0x33')]){return'';}for(var _0x19a145='(',_0x5099b7=0x0;_0x5099b7<_0x5788e6[_0x4baf('0x68')][_0x4baf('0x33')];_0x5099b7+=0x1){_0x5099b7>0x0&&(_0x19a145+='\x20'+_0x5788e6[_0x4baf('0x69')]+'\x20');_0x19a145+=_0x5788e6[_0x4baf('0x68')][_0x5099b7][_0x4baf('0x6a')]?_0x21dc92(_0x5788e6[_0x4baf('0x68')][_0x5099b7]['group']):_0x5788e6['rules'][_0x5099b7]['field']+'\x20'+_0x5788e6[_0x4baf('0x68')][_0x5099b7][_0x4baf('0x89')]+(_0x4b3e84(_0x5788e6['rules'][_0x5099b7][_0x4baf('0x89')])?'\x20'+_0x5788e6[_0x4baf('0x68')][_0x5099b7][_0x4baf('0x6b')]:'');}return _0x19a145+')';};var _0x1f8f3a={'where':{'id':_0x1a996c['id']}},_0x4d119d,_0x1467a1,_0x463802,_0x3ba9a0,_0x566308;_0x1f8f3a=_[_0x4baf('0x3c')]({},_0x1f8f3a,_0x1e114d);return db[_0x4baf('0x40')][_0x4baf('0x48')](_0x1f8f3a)[_0x4baf('0x20')](function(_0x5576ec){if(_0x5576ec){_0x4d119d=_0x5576ec;return _0x5576ec[_0x4baf('0x8a')]();}return null;})[_0x4baf('0x20')](function(_0x41c9e4){if(_0x41c9e4){if(!_0x41c9e4[_0x4baf('0x33')]){throw new db[(_0x4baf('0x8b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1467a1=_0x41c9e4;return db[_0x4baf('0x6e')][_0x4baf('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5dd9e9){if(_0x5dd9e9){_0x463802=_[_0x4baf('0x6f')](_0x5dd9e9,'id');var _0x4f9fc6;var _0x3f0b98=squel[_0x4baf('0x70')]();_0x3f0b98[_0x4baf('0x71')](_0x4d119d['table']);for(var _0x43ffad=0x0;_0x43ffad<_0x1467a1[_0x4baf('0x33')];_0x43ffad+=0x1){_0x4f9fc6=_0x1467a1[_0x43ffad][_0x4baf('0x73')]?_0x463802[_0x1467a1[_0x43ffad][_0x4baf('0x73')]][_0x4baf('0x74')]:_0x1467a1[_0x43ffad][_0x4baf('0x75')];_0x4f9fc6=_0x1467a1[_0x43ffad][_0x4baf('0x76')]?_[_0x4baf('0x77')](_0x47ac3f[_0x1467a1[_0x43ffad][_0x4baf('0x76')]],'%s',_0x4f9fc6):_0x4f9fc6;_0x4f9fc6=_0x1467a1[_0x43ffad][_0x4baf('0x78')]?_[_0x4baf('0x77')](_0x40e2ef[_0x1467a1[_0x43ffad][_0x4baf('0x78')]],'%s',_0x4f9fc6):_0x4f9fc6;if(_0x1467a1[_0x43ffad][_0x4baf('0x79')]){_0x3f0b98[_0x4baf('0x6a')](_0x4f9fc6);}_0x1467a1[_0x43ffad]['orderBy']&&_0x3f0b98['order'](_0x4f9fc6,_0x1467a1[_0x43ffad][_0x4baf('0x7a')]==='DESC'?![]:!![]);_0x3f0b98[_0x4baf('0x75')](_0x4f9fc6,_0x1467a1[_0x43ffad][_0x4baf('0x7b')]||_0x4f9fc6);}if(_0x4d119d[_0x4baf('0x7c')]){_0x4d119d[_0x4baf('0x7c')]=JSON[_0x4baf('0x7d')](_0x4d119d['joins']);for(var _0x451645=0x0;_0x451645<_0x4d119d[_0x4baf('0x7c')][_0x4baf('0x33')];_0x451645+=0x1){if(_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x3d')]&&_[_0x4baf('0x63')](_0x8e4c9,_0x4d119d['joins'][_0x451645][_0x4baf('0x3d')])&&_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x80')]&&_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x7e')]&&_0x4d119d[_0x4baf('0x7c')][_0x451645]['foreignKey']){_0x3f0b98[_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x3d')]](_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x7e')],null,util[_0x4baf('0x78')](_0x4baf('0x8c'),_0x4d119d[_0x4baf('0x72')],_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x80')],_0x4d119d[_0x4baf('0x7c')][_0x451645][_0x4baf('0x7e')],_0x4d119d[_0x4baf('0x7c')][_0x451645]['foreignKey']));}}}if(_0x4d119d[_0x4baf('0x81')]){_0x4d119d[_0x4baf('0x81')]=JSON[_0x4baf('0x7d')](_0x4d119d['conditions']);_0x3f0b98[_0x4baf('0x39')](_0x21dc92(_0x4d119d[_0x4baf('0x81')][_0x4baf('0x6a')]));}_0x566308=_0x3f0b98[_0x4baf('0x82')]();_0x3f0b98[_0x4baf('0x36')](_0x181651);_0x3f0b98['offset'](0x0);return;}})[_0x4baf('0x20')](function(){if(_0x58546a[_0x4baf('0x8d')]===_0x4baf('0x8e')){return null;}var _0x51f3f3=_[_0x4baf('0x3c')](_0x58546a,{'name':_0x58546a[_0x4baf('0x8f')]||_0x58546a[_0x4baf('0x27')]||_0x4d119d[_0x4baf('0x27')],'basename':_0x4d04e9,'savename':util[_0x4baf('0x78')]('%s-%s.%s',_0x58546a[_0x4baf('0x27')]||_0x4d119d[_0x4baf('0x27')],require(_0x4baf('0x90'))[_0x4baf('0x91')](0x4),_0x58546a[_0x4baf('0x8d')]||'csv'),'reportId':_0x4d119d['id'],'reportType':'custom'});return db[_0x4baf('0x92')][_0x4baf('0x49')](_0x51f3f3,{'raw':!![]});})[_0x4baf('0x20')](function(_0x11532b){if(_0x4d119d[_0x4baf('0x72')]===_0x4baf('0x93')){_0x566308[_0x4baf('0x39')](_0x4d119d['table']+_0x4baf('0x94'),_0x58546a[_0x4baf('0x95')],_0x58546a[_0x4baf('0x96')]);}else{_0x566308[_0x4baf('0x39')](_0x4d119d[_0x4baf('0x72')]+_0x4baf('0x97'),_0x58546a[_0x4baf('0x95')],_0x58546a[_0x4baf('0x96')]);}if(_0x11532b){logger[_0x4baf('0x98')](_0x4baf('0x99'),_0x566308[_0x4baf('0x9a')]());require(_0x4baf('0x9b'))['fork'](path[_0x4baf('0x53')](__dirname,_0x4baf('0x9c'),_0x11532b[_0x4baf('0x8d')]),[_0x11532b['id'],_0x566308[_0x4baf('0x9a')](),path[_0x4baf('0x53')](__dirname,_0x4baf('0x9d'),_0x11532b[_0x4baf('0x9e')]),_0x4d04e9]);return _0x11532b;}else{var _0x3e4575=squel[_0x4baf('0x70')]();_0x3e4575[_0x4baf('0x71')]('('+_0x566308[_0x4baf('0x9a')]()+')',_0x4baf('0x9f'));_0x3e4575[_0x4baf('0x75')](_0x4baf('0xa0'),_0x4baf('0x1a'));_0x566308[_0x4baf('0x36')](_0x58546a[_0x4baf('0x36')]||_0x181651);_0x566308[_0x4baf('0x18')](_0x58546a[_0x4baf('0x18')]||0x0);return dbH[_0x4baf('0x85')][_0x4baf('0x2d')](_0x3e4575[_0x4baf('0x9a')](),{'type':dbH[_0x4baf('0x85')][_0x4baf('0x86')]['SELECT']})[_0x4baf('0x20')](function(_0x5882e3){if(!_0x5882e3['length']){_0x3ba9a0=0x0;}else{_0x3ba9a0=_0x5882e3[0x0][_0x4baf('0x1a')]||0x0;}return dbH[_0x4baf('0x85')][_0x4baf('0x2d')](_0x566308['toString'](),{'type':dbH[_0x4baf('0x85')][_0x4baf('0x86')][_0x4baf('0xa1')]});})[_0x4baf('0x20')](function(_0x14b701){return{'rows':_0x14b701||[],'count':_0x3ba9a0};});}});}exports[_0x4baf('0xa2')]=function(_0x45ece4,_0x24dbbb){return runReport(_0x45ece4[_0x4baf('0x46')],_0x45ece4[_0x4baf('0x2d')],_0x45ece4['options'])['then'](respondWithResult(_0x24dbbb,null))[_0x4baf('0x45')](handleError(_0x24dbbb,null));};exports[_0x4baf('0xa3')]=runReport;exports['query']=function(_0x1ab2c2,_0x1abc4c){var _0x51346a=0xa;var _0x4fa09d=['join','left_join',_0x4baf('0x87'),_0x4baf('0x55')];var _0x99cc58={'SUM':'SUM(%s)','COUNT':_0x4baf('0x57'),'COUNT DISTINCT':_0x4baf('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4baf('0x5a'),'GROUP_CONCAT':_0x4baf('0x5b'),'GROUP_CONCAT ASC':_0x4baf('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x139bcc={'SEC_TO_TIME':_0x4baf('0x5e'),'DATE':_0x4baf('0x5f'),'HOUR':_0x4baf('0x60'),'ROUND':_0x4baf('0x61'),'UNIX_TIMESTAMP':_0x4baf('0x62')};var _0x2d3410=function(_0x3e4075){return!_[_0x4baf('0x63')]([_0x4baf('0x64'),_0x4baf('0x65'),_0x4baf('0x66'),'IS\x20NOT\x20EMPTY'],_0x3e4075);};var _0x104853=function(_0x4a3304){if(!_0x4a3304||!_0x4a3304[_0x4baf('0x68')][_0x4baf('0x33')]){return'';}for(var _0x50ffc5='(',_0x1ddb16=0x0;_0x1ddb16<_0x4a3304[_0x4baf('0x68')][_0x4baf('0x33')];_0x1ddb16+=0x1){_0x1ddb16>0x0&&(_0x50ffc5+='\x20'+_0x4a3304[_0x4baf('0x69')]+'\x20');_0x50ffc5+=_0x4a3304[_0x4baf('0x68')][_0x1ddb16][_0x4baf('0x6a')]?_0x104853(_0x4a3304[_0x4baf('0x68')][_0x1ddb16][_0x4baf('0x6a')]):_0x4a3304['rules'][_0x1ddb16]['field']+'\x20'+_0x4a3304[_0x4baf('0x68')][_0x1ddb16]['condition']+(_0x2d3410(_0x4a3304[_0x4baf('0x68')][_0x1ddb16]['condition'])?'\x20'+_0x4a3304['rules'][_0x1ddb16]['value']:'');}return _0x50ffc5+')';};var _0xc13304={'where':{'id':_0x1ab2c2[_0x4baf('0x46')]['id']}},_0x566f0d,_0x20733a,_0x4687ac,_0xdd371b,_0x26b113;_0xc13304=_[_0x4baf('0x3c')]({},_0xc13304,_0x1ab2c2[_0x4baf('0x3f')]);return db['AnalyticCustomReport'][_0x4baf('0x48')](_0xc13304)[_0x4baf('0x20')](function(_0x1e431e){if(_0x1e431e){_0x566f0d=_0x1e431e;return _0x1e431e[_0x4baf('0x8a')]();}return null;})[_0x4baf('0x20')](function(_0x1d73fd){if(_0x1d73fd){if(!_0x1d73fd['length']){throw new db[(_0x4baf('0x8b'))]['ValidationErrorItem'](_0x4baf('0x6d'),0x193);}_0x20733a=_0x1d73fd;return db[_0x4baf('0x6e')][_0x4baf('0x43')]({'raw':!![]});}return null;})[_0x4baf('0x20')](function(_0x1821b5){if(_0x1821b5){_0x4687ac=_['keyBy'](_0x1821b5,'id');var _0x2de1b6;var _0x1cee46=squel[_0x4baf('0x70')]();_0x1cee46[_0x4baf('0x71')](_0x566f0d[_0x4baf('0x72')]);for(var _0x3cad1d=0x0;_0x3cad1d<_0x20733a[_0x4baf('0x33')];_0x3cad1d+=0x1){_0x2de1b6=_0x20733a[_0x3cad1d][_0x4baf('0x73')]?_0x4687ac[_0x20733a[_0x3cad1d]['MetricId']][_0x4baf('0x74')]:_0x20733a[_0x3cad1d][_0x4baf('0x75')];_0x2de1b6=_0x20733a[_0x3cad1d][_0x4baf('0x76')]?_['replace'](_0x99cc58[_0x20733a[_0x3cad1d][_0x4baf('0x76')]],'%s',_0x2de1b6):_0x2de1b6;_0x2de1b6=_0x20733a[_0x3cad1d][_0x4baf('0x78')]?_[_0x4baf('0x77')](_0x139bcc[_0x20733a[_0x3cad1d][_0x4baf('0x78')]],'%s',_0x2de1b6):_0x2de1b6;if(_0x20733a[_0x3cad1d][_0x4baf('0x79')]){_0x1cee46[_0x4baf('0x6a')](_0x2de1b6);}_0x20733a[_0x3cad1d][_0x4baf('0x7a')]&&_0x1cee46['order'](_0x2de1b6,_0x20733a[_0x3cad1d]['orderBy']===_0x4baf('0xa4')?![]:!![]);_0x1cee46['field'](_0x2de1b6,_0x20733a[_0x3cad1d]['alias']||_0x2de1b6);}if(_0x566f0d[_0x4baf('0x7c')]){_0x566f0d[_0x4baf('0x7c')]=JSON[_0x4baf('0x7d')](_0x566f0d[_0x4baf('0x7c')]);for(var _0xe94e82=0x0;_0xe94e82<_0x566f0d[_0x4baf('0x7c')][_0x4baf('0x33')];_0xe94e82+=0x1){if(_0x566f0d[_0x4baf('0x7c')][_0xe94e82]['type']&&_['includes'](_0x4fa09d,_0x566f0d[_0x4baf('0x7c')][_0xe94e82]['type'])&&_0x566f0d[_0x4baf('0x7c')][_0xe94e82][_0x4baf('0x80')]&&_0x566f0d[_0x4baf('0x7c')][_0xe94e82]['foreignTable']&&_0x566f0d[_0x4baf('0x7c')][_0xe94e82]['foreignKey']){_0x1cee46[_0x566f0d[_0x4baf('0x7c')][_0xe94e82]['type']](_0x566f0d[_0x4baf('0x7c')][_0xe94e82][_0x4baf('0x7e')],null,util[_0x4baf('0x78')](_0x4baf('0x8c'),_0x566f0d['table'],_0x566f0d[_0x4baf('0x7c')][_0xe94e82][_0x4baf('0x80')],_0x566f0d[_0x4baf('0x7c')][_0xe94e82][_0x4baf('0x7e')],_0x566f0d[_0x4baf('0x7c')][_0xe94e82][_0x4baf('0x7f')]));}}}if(_0x566f0d['conditions']){_0x566f0d['conditions']=JSON['parse'](_0x566f0d[_0x4baf('0x81')]);_0x1cee46[_0x4baf('0x39')](_0x104853(_0x566f0d['conditions'][_0x4baf('0x6a')]));}_0x26b113=_0x1cee46['clone']();_0x1cee46[_0x4baf('0x36')](_0x51346a);_0x1cee46['offset'](0x0);logger['debug'](_0x4baf('0x84'),_0x1cee46['toString']());return dbH[_0x4baf('0x85')][_0x4baf('0x2d')](_0x1cee46[_0x4baf('0x9a')](),{'type':dbH[_0x4baf('0x85')][_0x4baf('0x86')][_0x4baf('0xa1')]});}})[_0x4baf('0x20')](function(){return{'sql':_0x26b113[_0x4baf('0x9a')]()};})['then'](respondWithResult(_0x1abc4c,null))[_0x4baf('0x45')](handleError(_0x1abc4c,null));}; \ No newline at end of file +var _0x9f9d=['UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','include','findAll','rows','catch','intersection','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%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)','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','value','getFields','keyBy','select','function','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','cross_join','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','Limited\x20Query:','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','offset','limit','undefined','count','set','json','apply','save','update','then','CustomReports'];(function(_0x50659e,_0x33de0d){var _0x55bd68=function(_0x413701){while(--_0x413701){_0x50659e['push'](_0x50659e['shift']());}};_0x55bd68(++_0x33de0d);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x19f670,_0x36d23f){_0x19f670=_0x19f670-0x0;var _0x3ffd49=_0x9f9d[_0x19f670];return _0x3ffd49;};'use strict';var emlformat=require(_0xd9f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9f9('0x3'));var util=require(_0xd9f9('0x4'));var path=require(_0xd9f9('0x5'));var sox=require(_0xd9f9('0x6'));var csv=require(_0xd9f9('0x7'));var ejs=require(_0xd9f9('0x8'));var fs=require('fs');var fs_extra=require(_0xd9f9('0x9'));var _=require(_0xd9f9('0xa'));var squel=require(_0xd9f9('0xb'));var crypto=require(_0xd9f9('0xc'));var jsforce=require(_0xd9f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd9f9('0x7'));var querystring=require(_0xd9f9('0xe'));var Papa=require('papaparse');var Redis=require(_0xd9f9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9f9('0x10'));var hardwareService=require(_0xd9f9('0x11'));var logger=require(_0xd9f9('0x12'))(_0xd9f9('0x13'));var utils=require(_0xd9f9('0x14'));var config=require(_0xd9f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9f9('0x16'))['db'];var dbH=require(_0xd9f9('0x16'))[_0xd9f9('0x17')];function respondWithStatusCode(_0x1e6031,_0x542f12){_0x542f12=_0x542f12||0xcc;return function(_0x3bfebb){if(_0x3bfebb){return _0x1e6031['sendStatus'](_0x542f12);}return _0x1e6031[_0xd9f9('0x18')](_0x542f12)['end']();};}function respondWithResult(_0x41c423,_0x3e9191){_0x3e9191=_0x3e9191||0xc8;return function(_0x3bc627){if(_0x3bc627){return _0x41c423[_0xd9f9('0x18')](_0x3e9191)['json'](_0x3bc627);}};}function respondWithFilteredResult(_0x298e37,_0x2f066e){return function(_0x5168c9){if(_0x5168c9){var _0x19b738=typeof _0x2f066e[_0xd9f9('0x19')]==='undefined'&&typeof _0x2f066e[_0xd9f9('0x1a')]===_0xd9f9('0x1b');var _0x2b5257=_0x5168c9[_0xd9f9('0x1c')];var _0x13471f=_0x19b738?0x0:_0x2f066e[_0xd9f9('0x19')];var _0x3f0c43=_0x19b738?_0x5168c9['count']:_0x2f066e[_0xd9f9('0x19')]+_0x2f066e['limit'];var _0x1b3877;if(_0x3f0c43>=_0x2b5257){_0x3f0c43=_0x2b5257;_0x1b3877=0xc8;}else{_0x1b3877=0xce;}_0x298e37[_0xd9f9('0x18')](_0x1b3877);return _0x298e37[_0xd9f9('0x1d')]('Content-Range',_0x13471f+'-'+_0x3f0c43+'/'+_0x2b5257)[_0xd9f9('0x1e')](_0x5168c9);}return null;};}function patchUpdates(_0x1fa4fb){return function(_0x527dfa){try{jsonpatch[_0xd9f9('0x1f')](_0x527dfa,_0x1fa4fb,!![]);}catch(_0xf3c75b){return BPromise['reject'](_0xf3c75b);}return _0x527dfa[_0xd9f9('0x20')]();};}function saveUpdates(_0x26799c,_0x50efc1){return function(_0x1e554e){if(_0x1e554e){return _0x1e554e[_0xd9f9('0x21')](_0x26799c)['then'](function(_0x29cda8){return _0x29cda8;});}return null;};}function removeEntity(_0x5eb98b,_0x31dd51){return function(_0x49e10a){if(_0x49e10a){return _0x49e10a['destroy']()[_0xd9f9('0x22')](function(){var _0x6d4999=_0x49e10a['get']({'plain':!![]});var _0x144fb3=_0xd9f9('0x23');return db[_0xd9f9('0x24')][_0xd9f9('0x25')]({'where':{'type':_0x144fb3,'resourceId':_0x6d4999['id']}})[_0xd9f9('0x22')](function(){return _0x49e10a;});})[_0xd9f9('0x22')](function(){_0x5eb98b[_0xd9f9('0x18')](0xcc)[_0xd9f9('0x26')]();});}};}function handleEntityNotFound(_0x497631,_0x360a33){return function(_0x391d13){if(!_0x391d13){_0x497631[_0xd9f9('0x27')](0x194);}return _0x391d13;};}function handleError(_0x43b1ff,_0x5b7f0f){_0x5b7f0f=_0x5b7f0f||0x1f4;return function(_0x34e4b5){logger[_0xd9f9('0x28')](_0x34e4b5[_0xd9f9('0x29')]);if(_0x34e4b5[_0xd9f9('0x2a')]){delete _0x34e4b5[_0xd9f9('0x2a')];}_0x43b1ff[_0xd9f9('0x18')](_0x5b7f0f)[_0xd9f9('0x2b')](_0x34e4b5);};}exports['index']=function(_0x204c64,_0x21ccac){var _0x4e9aee={},_0x457c66={},_0x42ce37={'count':0x0,'rows':[]};var _0x436663=_[_0xd9f9('0x2c')](db[_0xd9f9('0x2d')][_0xd9f9('0x2e')],function(_0x2d96d5){return{'name':_0x2d96d5['fieldName'],'type':_0x2d96d5[_0xd9f9('0x2f')][_0xd9f9('0x30')]};});_0x457c66[_0xd9f9('0x31')]=_['map'](_0x436663,'name');_0x457c66[_0xd9f9('0x32')]=_[_0xd9f9('0x33')](_0x204c64[_0xd9f9('0x32')]);_0x457c66[_0xd9f9('0x34')]=_['intersection'](_0x457c66[_0xd9f9('0x31')],_0x457c66[_0xd9f9('0x32')]);_0x4e9aee[_0xd9f9('0x35')]=_['intersection'](_0x457c66[_0xd9f9('0x31')],qs['fields'](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x36')]));_0x4e9aee[_0xd9f9('0x35')]=_0x4e9aee[_0xd9f9('0x35')][_0xd9f9('0x37')]?_0x4e9aee['attributes']:_0x457c66['model'];if(!_0x204c64[_0xd9f9('0x32')]['hasOwnProperty'](_0xd9f9('0x38'))){_0x4e9aee[_0xd9f9('0x1a')]=qs['limit'](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x1a')]);_0x4e9aee[_0xd9f9('0x19')]=qs[_0xd9f9('0x19')](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x19')]);}_0x4e9aee[_0xd9f9('0x39')]=qs[_0xd9f9('0x3a')](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x3a')]);_0x4e9aee['where']=qs[_0xd9f9('0x34')](_[_0xd9f9('0x3b')](_0x204c64[_0xd9f9('0x32')],_0x457c66[_0xd9f9('0x34')]),_0x436663);if(_0x204c64['query'][_0xd9f9('0x3c')]){_0x4e9aee[_0xd9f9('0x3d')]=_['merge'](_0x4e9aee[_0xd9f9('0x3d')],{'$or':_[_0xd9f9('0x2c')](_0x436663,function(_0x1abb2c){if(_0x1abb2c['type']!=='VIRTUAL'){var _0x1a2975={};_0x1a2975[_0x1abb2c[_0xd9f9('0x2a')]]={'$like':'%'+_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x3c')]+'%'};return _0x1a2975;}})});}_0x4e9aee=_['merge']({},_0x4e9aee,_0x204c64['options']);var _0x25b797={'where':_0x4e9aee[_0xd9f9('0x3d')]};return db['AnalyticCustomReport'][_0xd9f9('0x1c')](_0x25b797)[_0xd9f9('0x22')](function(_0x19826d){_0x42ce37[_0xd9f9('0x1c')]=_0x19826d;if(_0x204c64[_0xd9f9('0x32')]['includeAll']){_0x4e9aee[_0xd9f9('0x3e')]=[{'all':!![]}];}return db[_0xd9f9('0x2d')][_0xd9f9('0x3f')](_0x4e9aee);})[_0xd9f9('0x22')](function(_0x1e4314){_0x42ce37[_0xd9f9('0x40')]=_0x1e4314;return _0x42ce37;})[_0xd9f9('0x22')](respondWithFilteredResult(_0x21ccac,_0x4e9aee))[_0xd9f9('0x41')](handleError(_0x21ccac,null));};exports['show']=function(_0x4d7ad9,_0x54ef38){var _0x1301ec={'raw':![],'where':{'id':_0x4d7ad9['params']['id']}},_0x463bc1={};_0x463bc1[_0xd9f9('0x31')]=_['keys'](db[_0xd9f9('0x2d')]['rawAttributes']);_0x463bc1['query']=_[_0xd9f9('0x33')](_0x4d7ad9[_0xd9f9('0x32')]);_0x463bc1['filters']=_[_0xd9f9('0x42')](_0x463bc1['model'],_0x463bc1['query']);_0x1301ec[_0xd9f9('0x35')]=_[_0xd9f9('0x42')](_0x463bc1[_0xd9f9('0x31')],qs[_0xd9f9('0x36')](_0x4d7ad9[_0xd9f9('0x32')][_0xd9f9('0x36')]));_0x1301ec[_0xd9f9('0x35')]=_0x1301ec[_0xd9f9('0x35')][_0xd9f9('0x37')]?_0x1301ec[_0xd9f9('0x35')]:_0x463bc1['model'];if(_0x4d7ad9[_0xd9f9('0x32')][_0xd9f9('0x43')]){_0x1301ec[_0xd9f9('0x3e')]=[{'all':!![]}];}_0x1301ec=_[_0xd9f9('0x44')]({},_0x1301ec,_0x4d7ad9[_0xd9f9('0x45')]);return db['AnalyticCustomReport']['find'](_0x1301ec)['then'](handleEntityNotFound(_0x54ef38,null))[_0xd9f9('0x22')](respondWithResult(_0x54ef38,null))[_0xd9f9('0x41')](handleError(_0x54ef38,null));};exports[_0xd9f9('0x46')]=function(_0x57262c,_0x56cef4){return db[_0xd9f9('0x2d')][_0xd9f9('0x46')](_0x57262c[_0xd9f9('0x47')],{})[_0xd9f9('0x22')](function(_0x525a3d){var _0x320ee0=_0x57262c['user'][_0xd9f9('0x48')]({'plain':!![]});if(!_0x320ee0)throw new Error(_0xd9f9('0x49'));if(_0x320ee0['role']===_0xd9f9('0x4a')){var _0x490f10=_0x525a3d[_0xd9f9('0x48')]({'plain':!![]});var _0x1efd72=_0xd9f9('0x4b');return db[_0xd9f9('0x4c')][_0xd9f9('0x4d')]({'where':{'name':_0x1efd72,'userProfileId':_0x320ee0[_0xd9f9('0x4e')]},'raw':!![]})[_0xd9f9('0x22')](function(_0x26dc16){if(_0x26dc16&&_0x26dc16[_0xd9f9('0x4f')]===0x0){return db[_0xd9f9('0x24')][_0xd9f9('0x46')]({'name':_0x490f10['name'],'resourceId':_0x490f10['id'],'type':'CustomReports','sectionId':_0x26dc16['id']},{})[_0xd9f9('0x22')](function(){return _0x525a3d;});}else{return _0x525a3d;}})[_0xd9f9('0x41')](function(_0x467804){logger[_0xd9f9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x467804);throw _0x467804;});}return _0x525a3d;})['then'](respondWithResult(_0x56cef4,0xc9))[_0xd9f9('0x41')](handleError(_0x56cef4,null));};exports[_0xd9f9('0x21')]=function(_0x885132,_0x36e6a6){if(_0x885132['body']['id']){delete _0x885132['body']['id'];}return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')]({'where':{'id':_0x885132[_0xd9f9('0x50')]['id']}})[_0xd9f9('0x22')](handleEntityNotFound(_0x36e6a6,null))[_0xd9f9('0x22')](saveUpdates(_0x885132['body'],null))[_0xd9f9('0x22')](respondWithResult(_0x36e6a6,null))[_0xd9f9('0x41')](handleError(_0x36e6a6,null));};exports['destroy']=function(_0x18bba0,_0x68ec4){return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')]({'where':{'id':_0x18bba0[_0xd9f9('0x50')]['id']}})[_0xd9f9('0x22')](handleEntityNotFound(_0x68ec4,null))['then'](removeEntity(_0x68ec4,null))[_0xd9f9('0x41')](handleError(_0x68ec4,null));};exports[_0xd9f9('0x51')]=function(_0x367501,_0x329e03){var _0x3018bc=0xa;var _0x22ad0d=[_0xd9f9('0x52'),_0xd9f9('0x53'),_0xd9f9('0x54'),'cross_join'];var _0x2eacbe={'SUM':_0xd9f9('0x55'),'COUNT':_0xd9f9('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd9f9('0x57'),'MIN':_0xd9f9('0x58'),'AVG':_0xd9f9('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd9f9('0x5a'),'GROUP_CONCAT DESC':_0xd9f9('0x5b')};var _0x309b3e={'SEC_TO_TIME':_0xd9f9('0x5c'),'DATE':_0xd9f9('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xd9f9('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x194f8e=function(_0x86b4db){return!_['includes']([_0xd9f9('0x5f'),_0xd9f9('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x86b4db);};var _0x479ad3=function(_0x2bfc9){if(!_0x2bfc9||!_0x2bfc9[_0xd9f9('0x61')][_0xd9f9('0x37')]){return'';}for(var _0x7acda0='(',_0x26639f=0x0;_0x26639f<_0x2bfc9['rules']['length'];_0x26639f+=0x1){_0x26639f>0x0&&(_0x7acda0+='\x20'+_0x2bfc9['operator']+'\x20');_0x7acda0+=_0x2bfc9['rules'][_0x26639f][_0xd9f9('0x62')]?_0x479ad3(_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x62')]):_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x63')]+'\x20'+_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x64')]+(_0x194f8e(_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x64')])?'\x20'+_0x2bfc9[_0xd9f9('0x61')][_0x26639f]['value']:'');}return _0x7acda0+')';};var _0x5d8eb2={'where':{'id':_0x367501[_0xd9f9('0x50')]['id']}},_0x23ea88,_0x56fab0,_0x1c4481,_0x5afd30,_0x27d21a;_0x5d8eb2=_[_0xd9f9('0x44')]({},_0x5d8eb2,_0x367501['options']);return db['AnalyticCustomReport'][_0xd9f9('0x4d')](_0x5d8eb2)[_0xd9f9('0x22')](function(_0x3b994b){if(_0x3b994b){_0x23ea88=_0x3b994b;return _0x3b994b['getFields']();}return null;})['then'](function(_0xf4c3cb){if(_0xf4c3cb){if(!_0xf4c3cb[_0xd9f9('0x37')]){throw new db[(_0xd9f9('0x65'))][(_0xd9f9('0x66'))](_0xd9f9('0x67'),0x193);}_0x56fab0=_0xf4c3cb;return db[_0xd9f9('0x68')][_0xd9f9('0x3f')]({'raw':!![]});}return null;})[_0xd9f9('0x22')](function(_0x49e131){if(_0x49e131){_0x1c4481=_['keyBy'](_0x49e131,'id');var _0x49f86e;var _0x56e93d=squel['select']();_0x56e93d[_0xd9f9('0x69')](_0x23ea88[_0xd9f9('0x6a')]);for(var _0x5c49e1=0x0;_0x5c49e1<_0x56fab0[_0xd9f9('0x37')];_0x5c49e1+=0x1){_0x49f86e=_0x56fab0[_0x5c49e1][_0xd9f9('0x6b')]?_0x1c4481[_0x56fab0[_0x5c49e1][_0xd9f9('0x6b')]][_0xd9f9('0x6c')]:_0x56fab0[_0x5c49e1][_0xd9f9('0x63')];_0x49f86e=_0x56fab0[_0x5c49e1]['function']?_[_0xd9f9('0x6d')](_0x2eacbe[_0x56fab0[_0x5c49e1]['function']],'%s',_0x49f86e):_0x49f86e;_0x49f86e=_0x56fab0[_0x5c49e1][_0xd9f9('0x6e')]?_[_0xd9f9('0x6d')](_0x309b3e[_0x56fab0[_0x5c49e1][_0xd9f9('0x6e')]],'%s',_0x49f86e):_0x49f86e;if(_0x56fab0[_0x5c49e1][_0xd9f9('0x6f')]){_0x56e93d[_0xd9f9('0x62')](_0x49f86e);}_0x56fab0[_0x5c49e1][_0xd9f9('0x70')]&&_0x56e93d[_0xd9f9('0x39')](_0x49f86e,_0x56fab0[_0x5c49e1][_0xd9f9('0x70')]===_0xd9f9('0x71')?![]:!![]);_0x56e93d[_0xd9f9('0x63')](_0x49f86e,_0x56fab0[_0x5c49e1][_0xd9f9('0x72')]||_0x49f86e);}if(_0x23ea88[_0xd9f9('0x73')]){_0x23ea88[_0xd9f9('0x73')]=JSON[_0xd9f9('0x74')](_0x23ea88[_0xd9f9('0x73')]);for(var _0x3fffc2=0x0;_0x3fffc2<_0x23ea88['joins']['length'];_0x3fffc2+=0x1){if(_0x23ea88['joins'][_0x3fffc2][_0xd9f9('0x2f')]&&_[_0xd9f9('0x75')](_0x22ad0d,_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x2f')])&&_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x76')]&&_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x77')]&&_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x78')]){_0x56e93d[_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x2f')]](_0x23ea88['joins'][_0x3fffc2][_0xd9f9('0x77')],null,util[_0xd9f9('0x6e')](_0xd9f9('0x79'),_0x23ea88[_0xd9f9('0x6a')],_0x23ea88['joins'][_0x3fffc2]['parentKey'],_0x23ea88['joins'][_0x3fffc2][_0xd9f9('0x77')],_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x78')]));}}}if(_0x23ea88['conditions']){_0x23ea88['conditions']=JSON[_0xd9f9('0x74')](_0x23ea88[_0xd9f9('0x7a')]);_0x56e93d[_0xd9f9('0x3d')](_0x479ad3(_0x23ea88[_0xd9f9('0x7a')][_0xd9f9('0x62')]));}_0x27d21a=_0x56e93d[_0xd9f9('0x7b')]();_0x56e93d[_0xd9f9('0x1a')](_0x3018bc);_0x56e93d[_0xd9f9('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x56e93d[_0xd9f9('0x7c')]());return dbH[_0xd9f9('0x7d')][_0xd9f9('0x32')](_0x56e93d[_0xd9f9('0x7c')](),{'type':dbH['sequelize'][_0xd9f9('0x7e')][_0xd9f9('0x7f')]});}})['then'](respondWithResult(_0x329e03,null))[_0xd9f9('0x41')](handleError(_0x329e03,null));};function runReport(_0x1399cf,_0x52bc86,_0x10260f){var _0xe764df=_0x52bc86[_0xd9f9('0x2a')];var _0x539672=0xa;var _0x41bcdf=[_0xd9f9('0x52'),_0xd9f9('0x53'),_0xd9f9('0x54'),'cross_join'];var _0x57dc01={'SUM':_0xd9f9('0x55'),'COUNT':_0xd9f9('0x56'),'COUNT DISTINCT':_0xd9f9('0x80'),'MAX':_0xd9f9('0x57'),'MIN':_0xd9f9('0x58'),'AVG':_0xd9f9('0x59'),'GROUP_CONCAT':_0xd9f9('0x81'),'GROUP_CONCAT ASC':_0xd9f9('0x5a'),'GROUP_CONCAT DESC':_0xd9f9('0x5b')};var _0x41990f={'SEC_TO_TIME':_0xd9f9('0x5c'),'DATE':'DATE(%s)','HOUR':_0xd9f9('0x82'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd9f9('0x83')};var _0xe78925=function(_0x4b679f){return!_['includes']([_0xd9f9('0x5f'),_0xd9f9('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4b679f);};var _0x347605=function(_0x309cb2){if(!_0x309cb2||!_0x309cb2[_0xd9f9('0x61')][_0xd9f9('0x37')]){return'';}for(var _0x251938='(',_0x753c69=0x0;_0x753c69<_0x309cb2[_0xd9f9('0x61')][_0xd9f9('0x37')];_0x753c69+=0x1){_0x753c69>0x0&&(_0x251938+='\x20'+_0x309cb2['operator']+'\x20');_0x251938+=_0x309cb2['rules'][_0x753c69][_0xd9f9('0x62')]?_0x347605(_0x309cb2[_0xd9f9('0x61')][_0x753c69][_0xd9f9('0x62')]):_0x309cb2[_0xd9f9('0x61')][_0x753c69]['field']+'\x20'+_0x309cb2[_0xd9f9('0x61')][_0x753c69][_0xd9f9('0x64')]+(_0xe78925(_0x309cb2['rules'][_0x753c69][_0xd9f9('0x64')])?'\x20'+_0x309cb2['rules'][_0x753c69][_0xd9f9('0x84')]:'');}return _0x251938+')';};var _0x4973a4={'where':{'id':_0x1399cf['id']}},_0x46d944,_0x388a8f,_0x128469,_0x49678c,_0x4bf675;_0x4973a4=_[_0xd9f9('0x44')]({},_0x4973a4,_0x10260f);return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')](_0x4973a4)[_0xd9f9('0x22')](function(_0x30dc06){if(_0x30dc06){_0x46d944=_0x30dc06;return _0x30dc06[_0xd9f9('0x85')]();}return null;})[_0xd9f9('0x22')](function(_0x35963f){if(_0x35963f){if(!_0x35963f[_0xd9f9('0x37')]){throw new db[(_0xd9f9('0x65'))][(_0xd9f9('0x66'))](_0xd9f9('0x67'),0x193);}_0x388a8f=_0x35963f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x4d4229){if(_0x4d4229){_0x128469=_[_0xd9f9('0x86')](_0x4d4229,'id');var _0x5307a8;var _0x3d70bb=squel[_0xd9f9('0x87')]();_0x3d70bb[_0xd9f9('0x69')](_0x46d944[_0xd9f9('0x6a')]);for(var _0x22064b=0x0;_0x22064b<_0x388a8f[_0xd9f9('0x37')];_0x22064b+=0x1){_0x5307a8=_0x388a8f[_0x22064b][_0xd9f9('0x6b')]?_0x128469[_0x388a8f[_0x22064b][_0xd9f9('0x6b')]]['metric']:_0x388a8f[_0x22064b][_0xd9f9('0x63')];_0x5307a8=_0x388a8f[_0x22064b][_0xd9f9('0x88')]?_[_0xd9f9('0x6d')](_0x57dc01[_0x388a8f[_0x22064b]['function']],'%s',_0x5307a8):_0x5307a8;_0x5307a8=_0x388a8f[_0x22064b][_0xd9f9('0x6e')]?_[_0xd9f9('0x6d')](_0x41990f[_0x388a8f[_0x22064b][_0xd9f9('0x6e')]],'%s',_0x5307a8):_0x5307a8;if(_0x388a8f[_0x22064b]['groupBy']){_0x3d70bb[_0xd9f9('0x62')](_0x5307a8);}_0x388a8f[_0x22064b][_0xd9f9('0x70')]&&_0x3d70bb[_0xd9f9('0x39')](_0x5307a8,_0x388a8f[_0x22064b][_0xd9f9('0x70')]==='DESC'?![]:!![]);_0x3d70bb[_0xd9f9('0x63')](_0x5307a8,_0x388a8f[_0x22064b]['alias']||_0x5307a8);}if(_0x46d944[_0xd9f9('0x73')]){_0x46d944[_0xd9f9('0x73')]=JSON[_0xd9f9('0x74')](_0x46d944['joins']);for(var _0x354f2a=0x0;_0x354f2a<_0x46d944[_0xd9f9('0x73')]['length'];_0x354f2a+=0x1){if(_0x46d944['joins'][_0x354f2a][_0xd9f9('0x2f')]&&_[_0xd9f9('0x75')](_0x41bcdf,_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x2f')])&&_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x76')]&&_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x77')]&&_0x46d944[_0xd9f9('0x73')][_0x354f2a]['foreignKey']){_0x3d70bb[_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x2f')]](_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x77')],null,util[_0xd9f9('0x6e')](_0xd9f9('0x79'),_0x46d944[_0xd9f9('0x6a')],_0x46d944['joins'][_0x354f2a][_0xd9f9('0x76')],_0x46d944['joins'][_0x354f2a][_0xd9f9('0x77')],_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x78')]));}}}if(_0x46d944[_0xd9f9('0x7a')]){_0x46d944[_0xd9f9('0x7a')]=JSON['parse'](_0x46d944[_0xd9f9('0x7a')]);_0x3d70bb[_0xd9f9('0x3d')](_0x347605(_0x46d944['conditions'][_0xd9f9('0x62')]));}_0x4bf675=_0x3d70bb[_0xd9f9('0x7b')]();_0x3d70bb[_0xd9f9('0x1a')](_0x539672);_0x3d70bb[_0xd9f9('0x19')](0x0);return;}})[_0xd9f9('0x22')](function(){if(_0x52bc86[_0xd9f9('0x89')]===_0xd9f9('0x8a')){return null;}var _0x7cbb1b=_[_0xd9f9('0x44')](_0x52bc86,{'name':_0x52bc86[_0xd9f9('0x8b')]||_0x52bc86[_0xd9f9('0x2a')]||_0x46d944[_0xd9f9('0x2a')],'basename':_0xe764df,'savename':util[_0xd9f9('0x6e')](_0xd9f9('0x8c'),_0x52bc86[_0xd9f9('0x2a')]||_0x46d944[_0xd9f9('0x2a')],require(_0xd9f9('0x8d'))[_0xd9f9('0x8e')](0x4),_0x52bc86[_0xd9f9('0x89')]||_0xd9f9('0x8f')),'reportId':_0x46d944['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xd9f9('0x46')](_0x7cbb1b,{'raw':!![]});})[_0xd9f9('0x22')](function(_0x2f08ef){if(_0x46d944[_0xd9f9('0x6a')]===_0xd9f9('0x90')){_0x4bf675[_0xd9f9('0x3d')](_0x46d944[_0xd9f9('0x6a')]+_0xd9f9('0x91'),_0x52bc86[_0xd9f9('0x92')],_0x52bc86[_0xd9f9('0x93')]);}else{_0x4bf675['where'](_0x46d944['table']+_0xd9f9('0x94'),_0x52bc86[_0xd9f9('0x92')],_0x52bc86['endDate']);}if(_0x2f08ef){logger[_0xd9f9('0x95')]('Run\x20Query:',_0x4bf675[_0xd9f9('0x7c')]());require(_0xd9f9('0x96'))['fork'](path[_0xd9f9('0x52')](__dirname,_0xd9f9('0x97'),_0x2f08ef[_0xd9f9('0x89')]),[_0x2f08ef['id'],_0x4bf675[_0xd9f9('0x7c')](),path[_0xd9f9('0x52')](__dirname,_0xd9f9('0x98'),_0x2f08ef[_0xd9f9('0x99')]),_0xe764df]);return _0x2f08ef;}else{var _0x4eace6=squel[_0xd9f9('0x87')]();_0x4eace6['from']('('+_0x4bf675[_0xd9f9('0x7c')]()+')',_0xd9f9('0x9a'));_0x4eace6[_0xd9f9('0x63')](_0xd9f9('0x9b'),_0xd9f9('0x1c'));_0x4bf675[_0xd9f9('0x1a')](_0x52bc86[_0xd9f9('0x1a')]||_0x539672);_0x4bf675[_0xd9f9('0x19')](_0x52bc86[_0xd9f9('0x19')]||0x0);return dbH['sequelize']['query'](_0x4eace6[_0xd9f9('0x7c')](),{'type':dbH[_0xd9f9('0x7d')]['QueryTypes']['SELECT']})[_0xd9f9('0x22')](function(_0x1b13ed){if(!_0x1b13ed[_0xd9f9('0x37')]){_0x49678c=0x0;}else{_0x49678c=_0x1b13ed[0x0][_0xd9f9('0x1c')]||0x0;}return dbH[_0xd9f9('0x7d')]['query'](_0x4bf675[_0xd9f9('0x7c')](),{'type':dbH[_0xd9f9('0x7d')][_0xd9f9('0x7e')]['SELECT']});})[_0xd9f9('0x22')](function(_0x144eca){return{'rows':_0x144eca||[],'count':_0x49678c};});}});}exports['run']=function(_0x369a,_0x306062){return runReport(_0x369a[_0xd9f9('0x50')],_0x369a['query'],_0x369a[_0xd9f9('0x45')])[_0xd9f9('0x22')](respondWithResult(_0x306062,null))[_0xd9f9('0x41')](handleError(_0x306062,null));};exports[_0xd9f9('0x9c')]=runReport;exports[_0xd9f9('0x32')]=function(_0x46df74,_0x4e73a3){var _0x2b5985=0xa;var _0x1df17e=['join',_0xd9f9('0x53'),_0xd9f9('0x54'),_0xd9f9('0x9d')];var _0x452aa2={'SUM':_0xd9f9('0x55'),'COUNT':_0xd9f9('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xd9f9('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd9f9('0x5a'),'GROUP_CONCAT DESC':_0xd9f9('0x5b')};var _0x525c40={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xd9f9('0x82'),'ROUND':_0xd9f9('0x5e'),'UNIX_TIMESTAMP':_0xd9f9('0x83')};var _0x5f3c63=function(_0x34b547){return!_[_0xd9f9('0x75')](['IS\x20NULL',_0xd9f9('0x60'),_0xd9f9('0x9e'),_0xd9f9('0x9f')],_0x34b547);};var _0x60289a=function(_0x505e5e){if(!_0x505e5e||!_0x505e5e[_0xd9f9('0x61')]['length']){return'';}for(var _0x16a2d6='(',_0x129e19=0x0;_0x129e19<_0x505e5e['rules'][_0xd9f9('0x37')];_0x129e19+=0x1){_0x129e19>0x0&&(_0x16a2d6+='\x20'+_0x505e5e[_0xd9f9('0xa0')]+'\x20');_0x16a2d6+=_0x505e5e[_0xd9f9('0x61')][_0x129e19][_0xd9f9('0x62')]?_0x60289a(_0x505e5e[_0xd9f9('0x61')][_0x129e19][_0xd9f9('0x62')]):_0x505e5e['rules'][_0x129e19]['field']+'\x20'+_0x505e5e['rules'][_0x129e19][_0xd9f9('0x64')]+(_0x5f3c63(_0x505e5e[_0xd9f9('0x61')][_0x129e19][_0xd9f9('0x64')])?'\x20'+_0x505e5e['rules'][_0x129e19]['value']:'');}return _0x16a2d6+')';};var _0x1bd85c={'where':{'id':_0x46df74['params']['id']}},_0x1b2ce1,_0x42bb52,_0x538721,_0x3709be,_0x556a30;_0x1bd85c=_[_0xd9f9('0x44')]({},_0x1bd85c,_0x46df74['options']);return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')](_0x1bd85c)[_0xd9f9('0x22')](function(_0x75860a){if(_0x75860a){_0x1b2ce1=_0x75860a;return _0x75860a[_0xd9f9('0x85')]();}return null;})['then'](function(_0x4f9d39){if(_0x4f9d39){if(!_0x4f9d39[_0xd9f9('0x37')]){throw new db['Sequelize'][(_0xd9f9('0x66'))](_0xd9f9('0x67'),0x193);}_0x42bb52=_0x4f9d39;return db['AnalyticMetric'][_0xd9f9('0x3f')]({'raw':!![]});}return null;})[_0xd9f9('0x22')](function(_0x442a2f){if(_0x442a2f){_0x538721=_[_0xd9f9('0x86')](_0x442a2f,'id');var _0x11dacb;var _0x2e546a=squel[_0xd9f9('0x87')]();_0x2e546a[_0xd9f9('0x69')](_0x1b2ce1[_0xd9f9('0x6a')]);for(var _0x266734=0x0;_0x266734<_0x42bb52[_0xd9f9('0x37')];_0x266734+=0x1){_0x11dacb=_0x42bb52[_0x266734][_0xd9f9('0x6b')]?_0x538721[_0x42bb52[_0x266734][_0xd9f9('0x6b')]][_0xd9f9('0x6c')]:_0x42bb52[_0x266734][_0xd9f9('0x63')];_0x11dacb=_0x42bb52[_0x266734][_0xd9f9('0x88')]?_[_0xd9f9('0x6d')](_0x452aa2[_0x42bb52[_0x266734][_0xd9f9('0x88')]],'%s',_0x11dacb):_0x11dacb;_0x11dacb=_0x42bb52[_0x266734][_0xd9f9('0x6e')]?_[_0xd9f9('0x6d')](_0x525c40[_0x42bb52[_0x266734][_0xd9f9('0x6e')]],'%s',_0x11dacb):_0x11dacb;if(_0x42bb52[_0x266734][_0xd9f9('0x6f')]){_0x2e546a['group'](_0x11dacb);}_0x42bb52[_0x266734]['orderBy']&&_0x2e546a[_0xd9f9('0x39')](_0x11dacb,_0x42bb52[_0x266734][_0xd9f9('0x70')]==='DESC'?![]:!![]);_0x2e546a[_0xd9f9('0x63')](_0x11dacb,_0x42bb52[_0x266734]['alias']||_0x11dacb);}if(_0x1b2ce1['joins']){_0x1b2ce1[_0xd9f9('0x73')]=JSON[_0xd9f9('0x74')](_0x1b2ce1[_0xd9f9('0x73')]);for(var _0x32ee52=0x0;_0x32ee52<_0x1b2ce1[_0xd9f9('0x73')][_0xd9f9('0x37')];_0x32ee52+=0x1){if(_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x2f')]&&_[_0xd9f9('0x75')](_0x1df17e,_0x1b2ce1['joins'][_0x32ee52][_0xd9f9('0x2f')])&&_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x76')]&&_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52]['foreignTable']&&_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x78')]){_0x2e546a[_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x2f')]](_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x77')],null,util['format'](_0xd9f9('0x79'),_0x1b2ce1['table'],_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x76')],_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x77')],_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x78')]));}}}if(_0x1b2ce1[_0xd9f9('0x7a')]){_0x1b2ce1[_0xd9f9('0x7a')]=JSON[_0xd9f9('0x74')](_0x1b2ce1['conditions']);_0x2e546a['where'](_0x60289a(_0x1b2ce1[_0xd9f9('0x7a')][_0xd9f9('0x62')]));}_0x556a30=_0x2e546a[_0xd9f9('0x7b')]();_0x2e546a[_0xd9f9('0x1a')](_0x2b5985);_0x2e546a[_0xd9f9('0x19')](0x0);logger['debug'](_0xd9f9('0xa1'),_0x2e546a[_0xd9f9('0x7c')]());return dbH[_0xd9f9('0x7d')][_0xd9f9('0x32')](_0x2e546a['toString'](),{'type':dbH[_0xd9f9('0x7d')][_0xd9f9('0x7e')]['SELECT']});}})['then'](function(){return{'sql':_0x556a30[_0xd9f9('0x7c')]()};})[_0xd9f9('0x22')](respondWithResult(_0x4e73a3,null))['catch'](handleError(_0x4e73a3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 82047ec..52d3271 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 _0xc5a8=['bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc5a8,0xf7));var _0x8c5a=function(_0x46d345,_0x61059b){_0x46d345=_0x46d345-0x0;var _0x2d8246=_0xc5a8[_0x46d345];return _0x2d8246;};'use strict';var _=require(_0x8c5a('0x0'));var util=require(_0x8c5a('0x1'));var logger=require(_0x8c5a('0x2'))(_0x8c5a('0x3'));var moment=require(_0x8c5a('0x4'));var BPromise=require(_0x8c5a('0x5'));var rp=require(_0x8c5a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c5a('0x7'));var config=require(_0x8c5a('0x8'));var attributes=require(_0x8c5a('0x9'));module[_0x8c5a('0xa')]=function(_0x2c9eb7,_0x42463a){return _0x2c9eb7[_0x8c5a('0xb')](_0x8c5a('0xc'),attributes,{'tableName':_0x8c5a('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4222=['bluebird','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment'];(function(_0x272f3c,_0x29817c){var _0x472053=function(_0xf7fbe9){while(--_0xf7fbe9){_0x272f3c['push'](_0x272f3c['shift']());}};_0x472053(++_0x29817c);}(_0x4222,0xd9));var _0x2422=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4222[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x2422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2422('0x1'));var moment=require(_0x2422('0x2'));var BPromise=require(_0x2422('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2422('0x4'));var rimraf=require(_0x2422('0x5'));var config=require('../../config/environment');var attributes=require(_0x2422('0x6'));module[_0x2422('0x7')]=function(_0x2a014c,_0x199a5d){return _0x2a014c[_0x2422('0x8')](_0x2422('0x9'),attributes,{'tableName':_0x2422('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 42caa96..1174544 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 _0xfbd0=['../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x389165,_0x358cec){var _0x25aef2=function(_0x2a9bc7){while(--_0x2a9bc7){_0x389165['push'](_0x389165['shift']());}};_0x25aef2(++_0x358cec);}(_0xfbd0,0x69));var _0x0fbd=function(_0x4631eb,_0x55649e){_0x4631eb=_0x4631eb-0x0;var _0x562eca=_0xfbd0[_0x4631eb];return _0x562eca;};'use strict';var _=require(_0x0fbd('0x0'));var util=require(_0x0fbd('0x1'));var moment=require(_0x0fbd('0x2'));var BPromise=require(_0x0fbd('0x3'));var rs=require(_0x0fbd('0x4'));var fs=require('fs');var Redis=require(_0x0fbd('0x5'));var db=require(_0x0fbd('0x6'))['db'];var utils=require(_0x0fbd('0x7'));var logger=require(_0x0fbd('0x8'))(_0x0fbd('0x9'));var config=require(_0x0fbd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0fbd('0xb')][_0x0fbd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3890cc,_0x323126,_0x8b764){return new BPromise(function(_0x3c7ab3,_0x8da871){return client[_0x0fbd('0xd')](_0x3890cc,_0x8b764)[_0x0fbd('0xe')](function(_0x5d420d){logger[_0x0fbd('0xf')](_0x0fbd('0x10'),_0x323126,_0x0fbd('0x11'));logger['debug'](_0x0fbd('0x12'),_0x323126,_0x0fbd('0x11'),JSON[_0x0fbd('0x13')](_0x5d420d));if(_0x5d420d[_0x0fbd('0x14')]){if(_0x5d420d[_0x0fbd('0x14')]['code']===0x1f4){logger[_0x0fbd('0x14')](_0x0fbd('0x10'),_0x323126,_0x5d420d['error']['message']);return _0x8da871(_0x5d420d[_0x0fbd('0x14')][_0x0fbd('0x15')]);}logger[_0x0fbd('0x14')](_0x0fbd('0x10'),_0x323126,_0x5d420d[_0x0fbd('0x14')]['message']);return _0x3c7ab3(_0x5d420d['error'][_0x0fbd('0x15')]);}else{logger[_0x0fbd('0xf')](_0x0fbd('0x10'),_0x323126,_0x0fbd('0x11'));_0x3c7ab3(_0x5d420d['result'][_0x0fbd('0x15')]);}})[_0x0fbd('0x16')](function(_0x18d9e0){logger[_0x0fbd('0x14')](_0x0fbd('0x10'),_0x323126,_0x18d9e0);_0x8da871(_0x18d9e0);});});} \ No newline at end of file +var _0xf955=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xf955,0x106));var _0x5f95=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xf955[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x5f95('0x0'));var util=require('util');var moment=require(_0x5f95('0x1'));var BPromise=require(_0x5f95('0x2'));var rs=require(_0x5f95('0x3'));var fs=require('fs');var Redis=require(_0x5f95('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f95('0x5'));var logger=require(_0x5f95('0x6'))(_0x5f95('0x7'));var config=require(_0x5f95('0x8'));var jayson=require(_0x5f95('0x9'));var client=jayson[_0x5f95('0xa')][_0x5f95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1980c0,_0x6c66b7,_0x15d043){return new BPromise(function(_0x463981,_0x2ae040){return client[_0x5f95('0xc')](_0x1980c0,_0x15d043)['then'](function(_0x37755d){logger[_0x5f95('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6c66b7,_0x5f95('0xe'));logger[_0x5f95('0xf')](_0x5f95('0x10'),_0x6c66b7,'request\x20sent',JSON['stringify'](_0x37755d));if(_0x37755d[_0x5f95('0x11')]){if(_0x37755d[_0x5f95('0x11')][_0x5f95('0x12')]===0x1f4){logger[_0x5f95('0x11')](_0x5f95('0x13'),_0x6c66b7,_0x37755d['error']['message']);return _0x2ae040(_0x37755d['error'][_0x5f95('0x14')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x6c66b7,_0x37755d[_0x5f95('0x11')][_0x5f95('0x14')]);return _0x463981(_0x37755d[_0x5f95('0x11')][_0x5f95('0x14')]);}else{logger[_0x5f95('0xd')](_0x5f95('0x13'),_0x6c66b7,'request\x20sent');_0x463981(_0x37755d[_0x5f95('0x15')]['message']);}})['catch'](function(_0x4255d7){logger[_0x5f95('0x11')](_0x5f95('0x13'),_0x6c66b7,_0x4255d7);_0x2ae040(_0x4255d7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 88f3439..a36a570 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 _0x79bd=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','query','post','create','put','delete','/:id','destroy','exports','multer','util','path'];(function(_0x3e17e3,_0x3d6998){var _0x301609=function(_0x5451f8){while(--_0x5451f8){_0x3e17e3['push'](_0x3e17e3['shift']());}};_0x301609(++_0x3d6998);}(_0x79bd,0x1b2));var _0xd79b=function(_0x5b489e,_0x15699b){_0x5b489e=_0x5b489e-0x0;var _0x2aa451=_0x79bd[_0x5b489e];return _0x2aa451;};'use strict';var multer=require(_0xd79b('0x0'));var util=require(_0xd79b('0x1'));var path=require(_0xd79b('0x2'));var timeout=require(_0xd79b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd79b('0x4'));var auth=require(_0xd79b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd79b('0x6'));var controller=require(_0xd79b('0x7'));router[_0xd79b('0x8')]('/',auth[_0xd79b('0x9')](),controller[_0xd79b('0xa')]);router[_0xd79b('0x8')]('/:id',auth[_0xd79b('0x9')](),controller['show']);router[_0xd79b('0x8')](_0xd79b('0xb'),auth[_0xd79b('0x9')](),controller[_0xd79b('0xc')]);router[_0xd79b('0x8')](_0xd79b('0xd'),auth[_0xd79b('0x9')](),controller[_0xd79b('0xe')]);router['get']('/:id/query',auth[_0xd79b('0x9')](),controller[_0xd79b('0xf')]);router[_0xd79b('0x10')]('/',auth[_0xd79b('0x9')](),controller[_0xd79b('0x11')]);router[_0xd79b('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd79b('0x13')](_0xd79b('0x14'),auth['isAuthenticated'](),controller[_0xd79b('0x15')]);module[_0xd79b('0x16')]=router; \ No newline at end of file +var _0x3b01=['preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview'];(function(_0x4e2148,_0x382a2c){var _0x323345=function(_0x426339){while(--_0x426339){_0x4e2148['push'](_0x4e2148['shift']());}};_0x323345(++_0x382a2c);}(_0x3b01,0x8e));var _0x13b0=function(_0x51a5fc,_0x4a1f5a){_0x51a5fc=_0x51a5fc-0x0;var _0x1afbfd=_0x3b01[_0x51a5fc];return _0x1afbfd;};'use strict';var multer=require('multer');var util=require(_0x13b0('0x0'));var path=require(_0x13b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x13b0('0x2'));var router=express[_0x13b0('0x3')]();var fs_extra=require(_0x13b0('0x4'));var auth=require(_0x13b0('0x5'));var interaction=require(_0x13b0('0x6'));var config=require('../../config/environment');var controller=require(_0x13b0('0x7'));router[_0x13b0('0x8')]('/',auth['isAuthenticated'](),controller[_0x13b0('0x9')]);router[_0x13b0('0x8')](_0x13b0('0xa'),auth[_0x13b0('0xb')](),controller[_0x13b0('0xc')]);router[_0x13b0('0x8')](_0x13b0('0xd'),auth[_0x13b0('0xb')](),controller[_0x13b0('0xe')]);router[_0x13b0('0x8')](_0x13b0('0xf'),auth[_0x13b0('0xb')](),controller[_0x13b0('0x10')]);router[_0x13b0('0x8')](_0x13b0('0x11'),auth['isAuthenticated'](),controller[_0x13b0('0x12')]);router[_0x13b0('0x13')]('/',auth[_0x13b0('0xb')](),controller[_0x13b0('0x14')]);router[_0x13b0('0x15')](_0x13b0('0xa'),auth[_0x13b0('0xb')](),controller[_0x13b0('0x16')]);router[_0x13b0('0x17')](_0x13b0('0xa'),auth['isAuthenticated'](),controller[_0x13b0('0x18')]);module[_0x13b0('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 a360752..22c3c04 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 _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3d4a53,_0x36a936){_0x3d4a53=_0x3d4a53-0x0;var _0x1a791c=_0x8ef6[_0x3d4a53];return _0x1a791c;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7fbe=['STRING','TEXT'];(function(_0x4589fd,_0x4c6f26){var _0x44084b=function(_0x1eeabd){while(--_0x1eeabd){_0x4589fd['push'](_0x4589fd['shift']());}};_0x44084b(++_0x4c6f26);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x52bbc9,_0xb342e0){_0x52bbc9=_0x52bbc9-0x0;var _0x5909d0=_0x7fbe[_0x52bbc9];return _0x5909d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9b16cad..370e13e 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 _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x10d4ad,_0x53993e){_0x10d4ad=_0x10d4ad-0x0;var _0x5dfa22=_0xdbf5[_0x10d4ad];return _0x5dfa22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2ad56d0..ef4d693 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 _0x45cc=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x530230,_0x1078f0){var _0x5053cf=function(_0x596f72){while(--_0x596f72){_0x530230['push'](_0x530230['shift']());}};_0x5053cf(++_0x1078f0);}(_0x45cc,0x16f));var _0xc45c=function(_0x57aa39,_0x5b7dd9){_0x57aa39=_0x57aa39-0x0;var _0x1d9f2e=_0x45cc[_0x57aa39];return _0x1d9f2e;};'use strict';var _=require(_0xc45c('0x0'));var util=require(_0xc45c('0x1'));var logger=require(_0xc45c('0x2'))('api');var moment=require(_0xc45c('0x3'));var BPromise=require(_0xc45c('0x4'));var rp=require(_0xc45c('0x5'));var fs=require('fs');var path=require(_0xc45c('0x6'));var rimraf=require(_0xc45c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc45c('0x8'));module[_0xc45c('0x9')]=function(_0x491980,_0x469710){return _0x491980[_0xc45c('0xa')](_0xc45c('0xb'),attributes,{'tableName':_0xc45c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb243=['../../config/logger','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util'];(function(_0x201304,_0x13e171){var _0x2396d1=function(_0x28f3a5){while(--_0x28f3a5){_0x201304['push'](_0x201304['shift']());}};_0x2396d1(++_0x13e171);}(_0xb243,0x8a));var _0x3b24=function(_0x5bf6c0,_0x5704d7){_0x5bf6c0=_0x5bf6c0-0x0;var _0x112107=_0xb243[_0x5bf6c0];return _0x112107;};'use strict';var _=require(_0x3b24('0x0'));var util=require(_0x3b24('0x1'));var logger=require(_0x3b24('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3b24('0x3'));var rp=require(_0x3b24('0x4'));var fs=require('fs');var path=require(_0x3b24('0x5'));var rimraf=require('rimraf');var config=require(_0x3b24('0x6'));var attributes=require(_0x3b24('0x7'));module[_0x3b24('0x8')]=function(_0x4d3ed0,_0x5ecffe){return _0x4d3ed0['define']('AnalyticDefaultReport',attributes,{'tableName':_0x3b24('0x9'),'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 286e27e..6e4c860 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 _0x0770=['rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x0770,0xbf));var _0x0077=function(_0x1f951b,_0x654997){_0x1f951b=_0x1f951b-0x0;var _0x503af0=_0x0770[_0x1f951b];return _0x503af0;};'use strict';var _=require(_0x0077('0x0'));var util=require(_0x0077('0x1'));var moment=require(_0x0077('0x2'));var BPromise=require(_0x0077('0x3'));var rs=require(_0x0077('0x4'));var fs=require('fs');var Redis=require(_0x0077('0x5'));var db=require(_0x0077('0x6'))['db'];var utils=require(_0x0077('0x7'));var logger=require(_0x0077('0x8'))(_0x0077('0x9'));var config=require(_0x0077('0xa'));var jayson=require(_0x0077('0xb'));var client=jayson['client'][_0x0077('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x532c0a,_0x2565dd,_0x2f1441){return new BPromise(function(_0x2b3c09,_0x38fb58){return client[_0x0077('0xd')](_0x532c0a,_0x2f1441)[_0x0077('0xe')](function(_0x5d5752){logger[_0x0077('0xf')](_0x0077('0x10'),_0x2565dd,_0x0077('0x11'));logger['debug'](_0x0077('0x12'),_0x2565dd,_0x0077('0x11'),JSON[_0x0077('0x13')](_0x5d5752));if(_0x5d5752[_0x0077('0x14')]){if(_0x5d5752[_0x0077('0x14')][_0x0077('0x15')]===0x1f4){logger[_0x0077('0x14')](_0x0077('0x10'),_0x2565dd,_0x5d5752[_0x0077('0x14')][_0x0077('0x16')]);return _0x38fb58(_0x5d5752[_0x0077('0x14')][_0x0077('0x16')]);}logger[_0x0077('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2565dd,_0x5d5752[_0x0077('0x14')][_0x0077('0x16')]);return _0x2b3c09(_0x5d5752[_0x0077('0x14')]['message']);}else{logger[_0x0077('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2565dd,_0x0077('0x11'));_0x2b3c09(_0x5d5752[_0x0077('0x17')][_0x0077('0x16')]);}})[_0x0077('0x18')](function(_0x585a55){logger[_0x0077('0x14')](_0x0077('0x10'),_0x2565dd,_0x585a55);_0x38fb58(_0x585a55);});});} \ No newline at end of file +var _0xb87d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3284b8,_0x7058d7){var _0x3221de=function(_0x8e9bd9){while(--_0x8e9bd9){_0x3284b8['push'](_0x3284b8['shift']());}};_0x3221de(++_0x7058d7);}(_0xb87d,0x198));var _0xdb87=function(_0x2cb1d3,_0x4c2e55){_0x2cb1d3=_0x2cb1d3-0x0;var _0x223a9d=_0xb87d[_0x2cb1d3];return _0x223a9d;};'use strict';var _=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var moment=require(_0xdb87('0x2'));var BPromise=require(_0xdb87('0x3'));var rs=require(_0xdb87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb87('0x5'))['db'];var utils=require(_0xdb87('0x6'));var logger=require('../../config/logger')(_0xdb87('0x7'));var config=require(_0xdb87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb87('0x9')][_0xdb87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7f5469,_0x300790,_0x3c2d23){return new BPromise(function(_0x1e81a3,_0x1214e2){return client[_0xdb87('0xb')](_0x7f5469,_0x3c2d23)[_0xdb87('0xc')](function(_0x19a1ee){logger[_0xdb87('0xd')](_0xdb87('0xe'),_0x300790,_0xdb87('0xf'));logger[_0xdb87('0x10')](_0xdb87('0x11'),_0x300790,_0xdb87('0xf'),JSON[_0xdb87('0x12')](_0x19a1ee));if(_0x19a1ee['error']){if(_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x14')]===0x1f4){logger[_0xdb87('0x13')](_0xdb87('0xe'),_0x300790,_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x15')]);return _0x1214e2(_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x15')]);}logger['error'](_0xdb87('0xe'),_0x300790,_0x19a1ee['error'][_0xdb87('0x15')]);return _0x1e81a3(_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x15')]);}else{logger[_0xdb87('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x300790,'request\x20sent');_0x1e81a3(_0x19a1ee[_0xdb87('0x16')][_0xdb87('0x15')]);}})[_0xdb87('0x17')](function(_0x1be16c){logger[_0xdb87('0x13')](_0xdb87('0xe'),_0x300790,_0x1be16c);_0x1214e2(_0x1be16c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 86b023f..6d364d7 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 _0x7e8e=['get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','index'];(function(_0x180237,_0xfd4959){var _0x56fa74=function(_0x520793){while(--_0x520793){_0x180237['push'](_0x180237['shift']());}};_0x56fa74(++_0xfd4959);}(_0x7e8e,0x161));var _0xe7e8=function(_0x2b1fa9,_0x2e6a4b){_0x2b1fa9=_0x2b1fa9-0x0;var _0x405640=_0x7e8e[_0x2b1fa9];return _0x405640;};'use strict';var multer=require(_0xe7e8('0x0'));var util=require(_0xe7e8('0x1'));var path=require(_0xe7e8('0x2'));var timeout=require(_0xe7e8('0x3'));var express=require(_0xe7e8('0x4'));var router=express[_0xe7e8('0x5')]();var fs_extra=require(_0xe7e8('0x6'));var auth=require(_0xe7e8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe7e8('0x8'));var controller=require(_0xe7e8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe7e8('0xa')]);router[_0xe7e8('0xb')](_0xe7e8('0xc'),auth[_0xe7e8('0xd')](),controller[_0xe7e8('0xe')]);router['get'](_0xe7e8('0xf'),auth[_0xe7e8('0xd')](),controller[_0xe7e8('0x10')]);router[_0xe7e8('0xb')](_0xe7e8('0x11'),auth[_0xe7e8('0xd')](),controller[_0xe7e8('0x12')]);router[_0xe7e8('0xb')](_0xe7e8('0x13'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xe7e8('0xd')](),controller[_0xe7e8('0x14')]);router[_0xe7e8('0x15')](_0xe7e8('0xc'),auth[_0xe7e8('0xd')](),controller[_0xe7e8('0x16')]);router[_0xe7e8('0x17')](_0xe7e8('0xc'),auth['isAuthenticated'](),controller[_0xe7e8('0x18')]);module[_0xe7e8('0x19')]=router; \ No newline at end of file +var _0x6f7f=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','multer','util'];(function(_0x4da21e,_0x302796){var _0x35d4cd=function(_0x14227e){while(--_0x14227e){_0x4da21e['push'](_0x4da21e['shift']());}};_0x35d4cd(++_0x302796);}(_0x6f7f,0x106));var _0xf6f7=function(_0x1be9d1,_0x1a1603){_0x1be9d1=_0x1be9d1-0x0;var _0x48629d=_0x6f7f[_0x1be9d1];return _0x48629d;};'use strict';var multer=require(_0xf6f7('0x0'));var util=require(_0xf6f7('0x1'));var path=require(_0xf6f7('0x2'));var timeout=require(_0xf6f7('0x3'));var express=require('express');var router=express[_0xf6f7('0x4')]();var fs_extra=require(_0xf6f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf6f7('0x6'));var config=require('../../config/environment');var controller=require(_0xf6f7('0x7'));router[_0xf6f7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf6f7('0x8')](_0xf6f7('0x9'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0xb')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xf6f7('0xc')]);router[_0xf6f7('0x8')](_0xf6f7('0xd'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0xe')]);router[_0xf6f7('0x8')](_0xf6f7('0xf'),auth[_0xf6f7('0xa')](),controller['query']);router[_0xf6f7('0x10')]('/',auth[_0xf6f7('0xa')](),controller[_0xf6f7('0x11')]);router[_0xf6f7('0x12')](_0xf6f7('0x9'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0x13')]);router[_0xf6f7('0x14')](_0xf6f7('0x9'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4b0ed2a..c0cb115 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 _0xd487=['csv','pdf','xlsx','INTEGER','sequelize','moment','exports','STRING','ENUM'];(function(_0x258690,_0x227ed1){var _0x261526=function(_0x5cb6d2){while(--_0x5cb6d2){_0x258690['push'](_0x258690['shift']());}};_0x261526(++_0x227ed1);}(_0xd487,0x1c6));var _0x7d48=function(_0xf15be4,_0x2c2591){_0xf15be4=_0xf15be4-0x0;var _0x2b6849=_0xd487[_0xf15be4];return _0x2b6849;};'use strict';var Sequelize=require(_0x7d48('0x0'));var moment=require(_0x7d48('0x1'));module[_0x7d48('0x2')]={'name':{'type':Sequelize[_0x7d48('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x7d48('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x7d48('0x4')](_0x7d48('0x5'),_0x7d48('0x6'),_0x7d48('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x7d48('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x7d48('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7d48('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7d48('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7d48('0x3')]}}; \ No newline at end of file +var _0x1639=['DATE','Loading','manual','scheduled','INTEGER','sequelize','exports','STRING','ENUM','csv','pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1639,0xaa));var _0x9163=function(_0x598b67,_0x478935){_0x598b67=_0x598b67-0x0;var _0x5ebe2e=_0x1639[_0x598b67];return _0x5ebe2e;};'use strict';var Sequelize=require(_0x9163('0x0'));var moment=require('moment');module[_0x9163('0x1')]={'name':{'type':Sequelize[_0x9163('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x9163('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x9163('0x3')](_0x9163('0x4'),_0x9163('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x9163('0x4')},'savename':{'type':Sequelize[_0x9163('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9163('0x6')]},'endDate':{'type':Sequelize[_0x9163('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9163('0x7')},'type':{'type':Sequelize['ENUM'](_0x9163('0x8'),_0x9163('0x9')),'allowNull':![],'defaultValue':_0x9163('0x8')},'reportId':{'type':Sequelize[_0x9163('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x9163('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index cdf5d6d..7a67012 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 _0x2706=['destroy','then','UserProfileResource','sendStatus','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update'];(function(_0x2e8dd0,_0xff397a){var _0x183dd4=function(_0x2fbe3d){while(--_0x2fbe3d){_0x2e8dd0['push'](_0x2e8dd0['shift']());}};_0x183dd4(++_0xff397a);}(_0x2706,0x15e));var _0x6270=function(_0x45c62c,_0x8f43e6){_0x45c62c=_0x45c62c-0x0;var _0xc41286=_0x2706[_0x45c62c];return _0xc41286;};'use strict';var emlformat=require(_0x6270('0x0'));var rimraf=require(_0x6270('0x1'));var zipdir=require(_0x6270('0x2'));var jsonpatch=require(_0x6270('0x3'));var rp=require(_0x6270('0x4'));var moment=require(_0x6270('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6270('0x6'));var util=require(_0x6270('0x7'));var path=require(_0x6270('0x8'));var sox=require('sox');var csv=require(_0x6270('0x9'));var ejs=require(_0x6270('0xa'));var fs=require('fs');var fs_extra=require(_0x6270('0xb'));var _=require('lodash');var squel=require(_0x6270('0xc'));var crypto=require(_0x6270('0xd'));var jsforce=require(_0x6270('0xe'));var deskjs=require(_0x6270('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6270('0x10'));var Papa=require(_0x6270('0x11'));var Redis=require(_0x6270('0x12'));var authService=require(_0x6270('0x13'));var qs=require(_0x6270('0x14'));var as=require(_0x6270('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6270('0x16'))(_0x6270('0x17'));var utils=require(_0x6270('0x18'));var config=require(_0x6270('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6270('0x1a'))['db'];function respondWithStatusCode(_0x24ad3c,_0x47e923){_0x47e923=_0x47e923||0xcc;return function(_0x441161){if(_0x441161){return _0x24ad3c['sendStatus'](_0x47e923);}return _0x24ad3c[_0x6270('0x1b')](_0x47e923)[_0x6270('0x1c')]();};}function respondWithResult(_0x5ed37f,_0x27c615){_0x27c615=_0x27c615||0xc8;return function(_0xe6aa45){if(_0xe6aa45){return _0x5ed37f[_0x6270('0x1b')](_0x27c615)[_0x6270('0x1d')](_0xe6aa45);}};}function respondWithFilteredResult(_0xd1ebc3,_0x2a1cc7){return function(_0x1f85b5){if(_0x1f85b5){var _0xd4bc53=typeof _0x2a1cc7[_0x6270('0x1e')]===_0x6270('0x1f')&&typeof _0x2a1cc7[_0x6270('0x20')]===_0x6270('0x1f');var _0x59dcbf=_0x1f85b5[_0x6270('0x21')];var _0x35f685=_0xd4bc53?0x0:_0x2a1cc7[_0x6270('0x1e')];var _0x24f5dd=_0xd4bc53?_0x1f85b5[_0x6270('0x21')]:_0x2a1cc7[_0x6270('0x1e')]+_0x2a1cc7['limit'];var _0x5dca01;if(_0x24f5dd>=_0x59dcbf){_0x24f5dd=_0x59dcbf;_0x5dca01=0xc8;}else{_0x5dca01=0xce;}_0xd1ebc3[_0x6270('0x1b')](_0x5dca01);return _0xd1ebc3['set'](_0x6270('0x22'),_0x35f685+'-'+_0x24f5dd+'/'+_0x59dcbf)['json'](_0x1f85b5);}return null;};}function patchUpdates(_0x39d592){return function(_0x3cc74b){try{jsonpatch[_0x6270('0x23')](_0x3cc74b,_0x39d592,!![]);}catch(_0x550f16){return BPromise[_0x6270('0x24')](_0x550f16);}return _0x3cc74b['save']();};}function saveUpdates(_0x5e7fcd,_0x20752f){return function(_0x503e29){if(_0x503e29){return _0x503e29[_0x6270('0x25')](_0x5e7fcd)['then'](function(_0x2619df){return _0x2619df;});}return null;};}function removeEntity(_0x5919b2,_0x4d82b8){return function(_0x304364){if(_0x304364){return _0x304364[_0x6270('0x26')]()[_0x6270('0x27')](function(){var _0x4a545a=_0x304364['get']({'plain':!![]});var _0x17188e='ExtractedReports';return db[_0x6270('0x28')][_0x6270('0x26')]({'where':{'type':_0x17188e,'resourceId':_0x4a545a['id']}})[_0x6270('0x27')](function(){return _0x304364;});})[_0x6270('0x27')](function(){_0x5919b2[_0x6270('0x1b')](0xcc)[_0x6270('0x1c')]();});}};}function handleEntityNotFound(_0x18fb81,_0x106e77){return function(_0x28e4a2){if(!_0x28e4a2){_0x18fb81[_0x6270('0x29')](0x194);}return _0x28e4a2;};}function handleError(_0x22a5ba,_0x413254){_0x413254=_0x413254||0x1f4;return function(_0x251981){logger['error'](_0x251981[_0x6270('0x2a')]);if(_0x251981[_0x6270('0x2b')]){delete _0x251981[_0x6270('0x2b')];}_0x22a5ba[_0x6270('0x1b')](_0x413254)['send'](_0x251981);};}exports[_0x6270('0x2c')]=function(_0x40ebf6,_0x1cf137){var _0x200eda={},_0x1ff30e={},_0x3e0b6f={'count':0x0,'rows':[]};var _0x5994b4=_[_0x6270('0x2d')](db[_0x6270('0x2e')][_0x6270('0x2f')],function(_0x372230){return{'name':_0x372230[_0x6270('0x30')],'type':_0x372230[_0x6270('0x31')][_0x6270('0x32')]};});_0x1ff30e[_0x6270('0x33')]=_[_0x6270('0x2d')](_0x5994b4,'name');_0x1ff30e[_0x6270('0x34')]=_['keys'](_0x40ebf6[_0x6270('0x34')]);_0x1ff30e[_0x6270('0x35')]=_[_0x6270('0x36')](_0x1ff30e[_0x6270('0x33')],_0x1ff30e['query']);_0x200eda[_0x6270('0x37')]=_[_0x6270('0x36')](_0x1ff30e[_0x6270('0x33')],qs[_0x6270('0x38')](_0x40ebf6['query'][_0x6270('0x38')]));_0x200eda[_0x6270('0x37')]=_0x200eda[_0x6270('0x37')][_0x6270('0x39')]?_0x200eda[_0x6270('0x37')]:_0x1ff30e[_0x6270('0x33')];if(!_0x40ebf6[_0x6270('0x34')][_0x6270('0x3a')](_0x6270('0x3b'))){_0x200eda['limit']=qs[_0x6270('0x20')](_0x40ebf6[_0x6270('0x34')][_0x6270('0x20')]);_0x200eda['offset']=qs[_0x6270('0x1e')](_0x40ebf6['query'][_0x6270('0x1e')]);}_0x200eda['order']=qs[_0x6270('0x3c')](_0x40ebf6['query'][_0x6270('0x3c')]);_0x200eda[_0x6270('0x3d')]=qs[_0x6270('0x35')](_['pick'](_0x40ebf6[_0x6270('0x34')],_0x1ff30e[_0x6270('0x35')]),_0x5994b4);if(_0x40ebf6[_0x6270('0x34')][_0x6270('0x3e')]){_0x200eda['where']=_[_0x6270('0x3f')](_0x200eda['where'],{'$or':_['map'](_0x5994b4,function(_0x5b1cf9){if(_0x5b1cf9[_0x6270('0x31')]!==_0x6270('0x40')){var _0x19ac28={};_0x19ac28[_0x5b1cf9[_0x6270('0x2b')]]={'$like':'%'+_0x40ebf6[_0x6270('0x34')][_0x6270('0x3e')]+'%'};return _0x19ac28;}})});}_0x200eda=_[_0x6270('0x3f')]({},_0x200eda,_0x40ebf6['options']);var _0x520ffb={'where':_0x200eda['where']};return db[_0x6270('0x2e')]['count'](_0x520ffb)[_0x6270('0x27')](function(_0x2b94d2){_0x3e0b6f[_0x6270('0x21')]=_0x2b94d2;if(_0x40ebf6['query'][_0x6270('0x41')]){_0x200eda[_0x6270('0x42')]=[{'all':!![]}];}return db[_0x6270('0x2e')]['findAll'](_0x200eda);})['then'](function(_0x48d250){_0x3e0b6f['rows']=_0x48d250;return _0x3e0b6f;})[_0x6270('0x27')](respondWithFilteredResult(_0x1cf137,_0x200eda))[_0x6270('0x43')](handleError(_0x1cf137,null));};exports[_0x6270('0x44')]=function(_0x582c96,_0x1a5bd0){var _0x4b2a66={'raw':!![],'where':{'id':_0x582c96[_0x6270('0x45')]['id']}},_0x33580b={};_0x33580b['model']=_[_0x6270('0x46')](db['AnalyticExtractedReport'][_0x6270('0x2f')]);_0x33580b[_0x6270('0x34')]=_['keys'](_0x582c96[_0x6270('0x34')]);_0x33580b[_0x6270('0x35')]=_[_0x6270('0x36')](_0x33580b[_0x6270('0x33')],_0x33580b[_0x6270('0x34')]);_0x4b2a66['attributes']=_['intersection'](_0x33580b[_0x6270('0x33')],qs[_0x6270('0x38')](_0x582c96['query']['fields']));_0x4b2a66[_0x6270('0x37')]=_0x4b2a66[_0x6270('0x37')]['length']?_0x4b2a66[_0x6270('0x37')]:_0x33580b[_0x6270('0x33')];if(_0x582c96[_0x6270('0x34')][_0x6270('0x41')]){_0x4b2a66[_0x6270('0x42')]=[{'all':!![]}];}_0x4b2a66=_['merge']({},_0x4b2a66,_0x582c96[_0x6270('0x47')]);return db[_0x6270('0x2e')][_0x6270('0x48')](_0x4b2a66)[_0x6270('0x27')](handleEntityNotFound(_0x1a5bd0,null))[_0x6270('0x27')](respondWithResult(_0x1a5bd0,null))[_0x6270('0x43')](handleError(_0x1a5bd0,null));};exports[_0x6270('0x49')]=function(_0xca1a05,_0x5df378){return db['AnalyticExtractedReport'][_0x6270('0x49')](_0xca1a05[_0x6270('0x4a')],{})[_0x6270('0x27')](function(_0x761141){var _0x53bba3=_0xca1a05[_0x6270('0x4b')]['get']({'plain':!![]});if(!_0x53bba3)throw new Error(_0x6270('0x4c'));if(_0x53bba3['role']===_0x6270('0x4b')){var _0x571fcc=_0x761141[_0x6270('0x4d')]({'plain':!![]});var _0x3a6483=_0x6270('0x4e');return db[_0x6270('0x4f')]['find']({'where':{'name':_0x3a6483,'userProfileId':_0x53bba3[_0x6270('0x50')]},'raw':!![]})['then'](function(_0x3f69f1){if(_0x3f69f1&&_0x3f69f1[_0x6270('0x51')]===0x0){return db[_0x6270('0x28')][_0x6270('0x49')]({'name':_0x571fcc[_0x6270('0x2b')],'resourceId':_0x571fcc['id'],'type':_0x3f69f1['name'],'sectionId':_0x3f69f1['id']},{})[_0x6270('0x27')](function(){return _0x761141;});}else{return _0x761141;}})[_0x6270('0x43')](function(_0x3ff6a4){logger[_0x6270('0x52')](_0x6270('0x53'),_0x3ff6a4);throw _0x3ff6a4;});}return _0x761141;})['then'](respondWithResult(_0x5df378,0xc9))[_0x6270('0x43')](handleError(_0x5df378,null));};exports[_0x6270('0x25')]=function(_0x1a94b9,_0x326a5c){if(_0x1a94b9['body']['id']){delete _0x1a94b9['body']['id'];}return db[_0x6270('0x2e')]['find']({'where':{'id':_0x1a94b9[_0x6270('0x45')]['id']}})[_0x6270('0x27')](handleEntityNotFound(_0x326a5c,null))[_0x6270('0x27')](saveUpdates(_0x1a94b9[_0x6270('0x4a')],null))[_0x6270('0x27')](respondWithResult(_0x326a5c,null))[_0x6270('0x43')](handleError(_0x326a5c,null));};exports['destroy']=function(_0x7f5cbf,_0x1b32b8){return db['AnalyticExtractedReport'][_0x6270('0x48')]({'where':{'id':_0x7f5cbf[_0x6270('0x45')]['id']}})[_0x6270('0x27')](handleEntityNotFound(_0x1b32b8,null))['then'](removeEntity(_0x1b32b8,null))['catch'](handleError(_0x1b32b8,null));};exports['download']=function(_0x45b2a5,_0x262f97,_0x51c6cf){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x45b2a5[_0x6270('0x45')]['id']},'attributes':[_0x6270('0x2b'),_0x6270('0x54'),_0x6270('0x55'),_0x6270('0x56')],'raw':!![]})[_0x6270('0x27')](handleEntityNotFound(_0x262f97,null))[_0x6270('0x27')](function(_0x99eece){if(_0x99eece){if(!fs['existsSync'](path[_0x6270('0x57')](config[_0x6270('0x58')],_0x6270('0x59'),_0x99eece['savename']))){throw new db[(_0x6270('0x5a'))][(_0x6270('0x5b'))](_0x6270('0x5c'));}if(_0x45b2a5['query'][_0x6270('0x5d')]){return _0x262f97['sendStatus'](0xc8);}return _0x262f97[_0x6270('0x5e')](path[_0x6270('0x57')](config[_0x6270('0x58')],_0x6270('0x59'),_0x99eece[_0x6270('0x55')]),util[_0x6270('0x5f')](_0x6270('0x60'),_0x99eece[_0x6270('0x54')]||_0x99eece['name'],_0x99eece[_0x6270('0x56')]['toLowerCase']()));}})[_0x6270('0x43')](handleError(_0x262f97,null));}; \ No newline at end of file +var _0xd6c2=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','rows','show','params','keys','find','catch','create','body','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4c4920,_0x276b99){var _0x53d293=function(_0x29b8ec){while(--_0x29b8ec){_0x4c4920['push'](_0x4c4920['shift']());}};_0x53d293(++_0x276b99);}(_0xd6c2,0xc2));var _0x2d6c=function(_0x545af4,_0x1e9a7e){_0x545af4=_0x545af4-0x0;var _0x1768d4=_0xd6c2[_0x545af4];return _0x1768d4;};'use strict';var emlformat=require(_0x2d6c('0x0'));var rimraf=require(_0x2d6c('0x1'));var zipdir=require(_0x2d6c('0x2'));var jsonpatch=require(_0x2d6c('0x3'));var rp=require(_0x2d6c('0x4'));var moment=require(_0x2d6c('0x5'));var BPromise=require(_0x2d6c('0x6'));var Mustache=require(_0x2d6c('0x7'));var util=require(_0x2d6c('0x8'));var path=require(_0x2d6c('0x9'));var sox=require(_0x2d6c('0xa'));var csv=require(_0x2d6c('0xb'));var ejs=require(_0x2d6c('0xc'));var fs=require('fs');var fs_extra=require(_0x2d6c('0xd'));var _=require(_0x2d6c('0xe'));var squel=require(_0x2d6c('0xf'));var crypto=require(_0x2d6c('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x2d6c('0x11'));var toCsv=require(_0x2d6c('0xb'));var querystring=require(_0x2d6c('0x12'));var Papa=require(_0x2d6c('0x13'));var Redis=require(_0x2d6c('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2d6c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d6c('0x16'))(_0x2d6c('0x17'));var utils=require(_0x2d6c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2d6c('0x19'));var db=require(_0x2d6c('0x1a'))['db'];function respondWithStatusCode(_0xea4b70,_0x475523){_0x475523=_0x475523||0xcc;return function(_0x4740c0){if(_0x4740c0){return _0xea4b70[_0x2d6c('0x1b')](_0x475523);}return _0xea4b70[_0x2d6c('0x1c')](_0x475523)[_0x2d6c('0x1d')]();};}function respondWithResult(_0x1feb9f,_0x559f44){_0x559f44=_0x559f44||0xc8;return function(_0x4208fe){if(_0x4208fe){return _0x1feb9f[_0x2d6c('0x1c')](_0x559f44)['json'](_0x4208fe);}};}function respondWithFilteredResult(_0x3b869f,_0x42faae){return function(_0x4456f2){if(_0x4456f2){var _0x86d15=typeof _0x42faae[_0x2d6c('0x1e')]===_0x2d6c('0x1f')&&typeof _0x42faae[_0x2d6c('0x20')]===_0x2d6c('0x1f');var _0x2dc303=_0x4456f2[_0x2d6c('0x21')];var _0x2c06ef=_0x86d15?0x0:_0x42faae[_0x2d6c('0x1e')];var _0x4f897f=_0x86d15?_0x4456f2[_0x2d6c('0x21')]:_0x42faae[_0x2d6c('0x1e')]+_0x42faae[_0x2d6c('0x20')];var _0x5cbd47;if(_0x4f897f>=_0x2dc303){_0x4f897f=_0x2dc303;_0x5cbd47=0xc8;}else{_0x5cbd47=0xce;}_0x3b869f['status'](_0x5cbd47);return _0x3b869f[_0x2d6c('0x22')](_0x2d6c('0x23'),_0x2c06ef+'-'+_0x4f897f+'/'+_0x2dc303)['json'](_0x4456f2);}return null;};}function patchUpdates(_0x1c1d07){return function(_0x4e2ee0){try{jsonpatch[_0x2d6c('0x24')](_0x4e2ee0,_0x1c1d07,!![]);}catch(_0x1ca2bd){return BPromise[_0x2d6c('0x25')](_0x1ca2bd);}return _0x4e2ee0['save']();};}function saveUpdates(_0x18f60,_0x89e215){return function(_0x42f4af){if(_0x42f4af){return _0x42f4af[_0x2d6c('0x26')](_0x18f60)[_0x2d6c('0x27')](function(_0x45b774){return _0x45b774;});}return null;};}function removeEntity(_0x1b6098,_0x52ec34){return function(_0x30fbd1){if(_0x30fbd1){return _0x30fbd1[_0x2d6c('0x28')]()[_0x2d6c('0x27')](function(){var _0x427a8d=_0x30fbd1[_0x2d6c('0x29')]({'plain':!![]});var _0x371e98=_0x2d6c('0x2a');return db['UserProfileResource'][_0x2d6c('0x28')]({'where':{'type':_0x371e98,'resourceId':_0x427a8d['id']}})['then'](function(){return _0x30fbd1;});})['then'](function(){_0x1b6098[_0x2d6c('0x1c')](0xcc)[_0x2d6c('0x1d')]();});}};}function handleEntityNotFound(_0x10cd08,_0x292122){return function(_0x291813){if(!_0x291813){_0x10cd08[_0x2d6c('0x1b')](0x194);}return _0x291813;};}function handleError(_0x4a0f0e,_0x210175){_0x210175=_0x210175||0x1f4;return function(_0x119a3a){logger[_0x2d6c('0x2b')](_0x119a3a[_0x2d6c('0x2c')]);if(_0x119a3a['name']){delete _0x119a3a[_0x2d6c('0x2d')];}_0x4a0f0e['status'](_0x210175)[_0x2d6c('0x2e')](_0x119a3a);};}exports[_0x2d6c('0x2f')]=function(_0x167026,_0x5c6612){var _0x407ed1={},_0x57d102={},_0x2b4dad={'count':0x0,'rows':[]};var _0x17addd=_[_0x2d6c('0x30')](db['AnalyticExtractedReport'][_0x2d6c('0x31')],function(_0x8f49f8){return{'name':_0x8f49f8[_0x2d6c('0x32')],'type':_0x8f49f8['type'][_0x2d6c('0x33')]};});_0x57d102[_0x2d6c('0x34')]=_[_0x2d6c('0x30')](_0x17addd,_0x2d6c('0x2d'));_0x57d102[_0x2d6c('0x35')]=_['keys'](_0x167026[_0x2d6c('0x35')]);_0x57d102[_0x2d6c('0x36')]=_[_0x2d6c('0x37')](_0x57d102[_0x2d6c('0x34')],_0x57d102['query']);_0x407ed1[_0x2d6c('0x38')]=_['intersection'](_0x57d102['model'],qs['fields'](_0x167026[_0x2d6c('0x35')][_0x2d6c('0x39')]));_0x407ed1['attributes']=_0x407ed1[_0x2d6c('0x38')][_0x2d6c('0x3a')]?_0x407ed1[_0x2d6c('0x38')]:_0x57d102[_0x2d6c('0x34')];if(!_0x167026[_0x2d6c('0x35')][_0x2d6c('0x3b')](_0x2d6c('0x3c'))){_0x407ed1[_0x2d6c('0x20')]=qs['limit'](_0x167026[_0x2d6c('0x35')][_0x2d6c('0x20')]);_0x407ed1[_0x2d6c('0x1e')]=qs[_0x2d6c('0x1e')](_0x167026['query'][_0x2d6c('0x1e')]);}_0x407ed1['order']=qs[_0x2d6c('0x3d')](_0x167026[_0x2d6c('0x35')][_0x2d6c('0x3d')]);_0x407ed1[_0x2d6c('0x3e')]=qs[_0x2d6c('0x36')](_[_0x2d6c('0x3f')](_0x167026[_0x2d6c('0x35')],_0x57d102['filters']),_0x17addd);if(_0x167026[_0x2d6c('0x35')]['filter']){_0x407ed1[_0x2d6c('0x3e')]=_[_0x2d6c('0x40')](_0x407ed1[_0x2d6c('0x3e')],{'$or':_[_0x2d6c('0x30')](_0x17addd,function(_0xe1e3c9){if(_0xe1e3c9[_0x2d6c('0x41')]!==_0x2d6c('0x42')){var _0x326936={};_0x326936[_0xe1e3c9['name']]={'$like':'%'+_0x167026[_0x2d6c('0x35')][_0x2d6c('0x43')]+'%'};return _0x326936;}})});}_0x407ed1=_[_0x2d6c('0x40')]({},_0x407ed1,_0x167026[_0x2d6c('0x44')]);var _0x2a169a={'where':_0x407ed1['where']};return db[_0x2d6c('0x45')][_0x2d6c('0x21')](_0x2a169a)[_0x2d6c('0x27')](function(_0xa1126d){_0x2b4dad[_0x2d6c('0x21')]=_0xa1126d;if(_0x167026['query'][_0x2d6c('0x46')]){_0x407ed1[_0x2d6c('0x47')]=[{'all':!![]}];}return db[_0x2d6c('0x45')]['findAll'](_0x407ed1);})['then'](function(_0x29f059){_0x2b4dad[_0x2d6c('0x48')]=_0x29f059;return _0x2b4dad;})[_0x2d6c('0x27')](respondWithFilteredResult(_0x5c6612,_0x407ed1))['catch'](handleError(_0x5c6612,null));};exports[_0x2d6c('0x49')]=function(_0x381583,_0x192ed2){var _0x5f3597={'raw':!![],'where':{'id':_0x381583[_0x2d6c('0x4a')]['id']}},_0x79ce11={};_0x79ce11[_0x2d6c('0x34')]=_[_0x2d6c('0x4b')](db['AnalyticExtractedReport'][_0x2d6c('0x31')]);_0x79ce11[_0x2d6c('0x35')]=_[_0x2d6c('0x4b')](_0x381583[_0x2d6c('0x35')]);_0x79ce11[_0x2d6c('0x36')]=_['intersection'](_0x79ce11[_0x2d6c('0x34')],_0x79ce11['query']);_0x5f3597['attributes']=_[_0x2d6c('0x37')](_0x79ce11['model'],qs['fields'](_0x381583[_0x2d6c('0x35')][_0x2d6c('0x39')]));_0x5f3597['attributes']=_0x5f3597['attributes'][_0x2d6c('0x3a')]?_0x5f3597[_0x2d6c('0x38')]:_0x79ce11['model'];if(_0x381583[_0x2d6c('0x35')][_0x2d6c('0x46')]){_0x5f3597[_0x2d6c('0x47')]=[{'all':!![]}];}_0x5f3597=_['merge']({},_0x5f3597,_0x381583[_0x2d6c('0x44')]);return db['AnalyticExtractedReport'][_0x2d6c('0x4c')](_0x5f3597)[_0x2d6c('0x27')](handleEntityNotFound(_0x192ed2,null))['then'](respondWithResult(_0x192ed2,null))[_0x2d6c('0x4d')](handleError(_0x192ed2,null));};exports[_0x2d6c('0x4e')]=function(_0x42e8bc,_0x172f3f){return db['AnalyticExtractedReport'][_0x2d6c('0x4e')](_0x42e8bc[_0x2d6c('0x4f')],{})[_0x2d6c('0x27')](function(_0x574e8f){var _0x51c543=_0x42e8bc['user'][_0x2d6c('0x29')]({'plain':!![]});if(!_0x51c543)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51c543['role']==='user'){var _0x32fd2a=_0x574e8f[_0x2d6c('0x29')]({'plain':!![]});var _0x33edbe=_0x2d6c('0x2a');return db[_0x2d6c('0x50')][_0x2d6c('0x4c')]({'where':{'name':_0x33edbe,'userProfileId':_0x51c543[_0x2d6c('0x51')]},'raw':!![]})[_0x2d6c('0x27')](function(_0x1a4716){if(_0x1a4716&&_0x1a4716[_0x2d6c('0x52')]===0x0){return db[_0x2d6c('0x53')][_0x2d6c('0x4e')]({'name':_0x32fd2a[_0x2d6c('0x2d')],'resourceId':_0x32fd2a['id'],'type':_0x1a4716[_0x2d6c('0x2d')],'sectionId':_0x1a4716['id']},{})[_0x2d6c('0x27')](function(){return _0x574e8f;});}else{return _0x574e8f;}})[_0x2d6c('0x4d')](function(_0x40caf0){logger[_0x2d6c('0x2b')](_0x2d6c('0x54'),_0x40caf0);throw _0x40caf0;});}return _0x574e8f;})['then'](respondWithResult(_0x172f3f,0xc9))[_0x2d6c('0x4d')](handleError(_0x172f3f,null));};exports['update']=function(_0x4631c1,_0x4cc862){if(_0x4631c1['body']['id']){delete _0x4631c1['body']['id'];}return db[_0x2d6c('0x45')][_0x2d6c('0x4c')]({'where':{'id':_0x4631c1['params']['id']}})['then'](handleEntityNotFound(_0x4cc862,null))[_0x2d6c('0x27')](saveUpdates(_0x4631c1[_0x2d6c('0x4f')],null))[_0x2d6c('0x27')](respondWithResult(_0x4cc862,null))[_0x2d6c('0x4d')](handleError(_0x4cc862,null));};exports[_0x2d6c('0x28')]=function(_0x1c11e2,_0x518621){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1c11e2[_0x2d6c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x518621,null))['then'](removeEntity(_0x518621,null))[_0x2d6c('0x4d')](handleError(_0x518621,null));};exports[_0x2d6c('0x55')]=function(_0x5ca7b0,_0x41d3a4,_0x59be14){return db[_0x2d6c('0x45')][_0x2d6c('0x4c')]({'where':{'id':_0x5ca7b0[_0x2d6c('0x4a')]['id']},'attributes':['name',_0x2d6c('0x56'),_0x2d6c('0x57'),_0x2d6c('0x58')],'raw':!![]})[_0x2d6c('0x27')](handleEntityNotFound(_0x41d3a4,null))[_0x2d6c('0x27')](function(_0x3f6a0b){if(_0x3f6a0b){if(!fs[_0x2d6c('0x59')](path[_0x2d6c('0x5a')](config['root'],_0x2d6c('0x5b'),_0x3f6a0b['savename']))){throw new db[(_0x2d6c('0x5c'))][(_0x2d6c('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5ca7b0[_0x2d6c('0x35')][_0x2d6c('0x5e')]){return _0x41d3a4[_0x2d6c('0x1b')](0xc8);}return _0x41d3a4[_0x2d6c('0x55')](path['join'](config[_0x2d6c('0x5f')],_0x2d6c('0x5b'),_0x3f6a0b['savename']),util[_0x2d6c('0x60')](_0x2d6c('0x61'),_0x3f6a0b[_0x2d6c('0x56')]||_0x3f6a0b[_0x2d6c('0x2d')],_0x3f6a0b['output'][_0x2d6c('0x62')]()));}})[_0x2d6c('0x4d')](handleError(_0x41d3a4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3553d53..30deecd 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 _0x00c4=['request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment'];(function(_0x2f2585,_0x31cfae){var _0x259499=function(_0x47f254){while(--_0x47f254){_0x2f2585['push'](_0x2f2585['shift']());}};_0x259499(++_0x31cfae);}(_0x00c4,0xee));var _0x400c=function(_0x45b0d8,_0x4bb477){_0x45b0d8=_0x45b0d8-0x0;var _0x8cb514=_0x00c4[_0x45b0d8];return _0x8cb514;};'use strict';var _=require(_0x400c('0x0'));var util=require(_0x400c('0x1'));var logger=require('../../config/logger')(_0x400c('0x2'));var moment=require(_0x400c('0x3'));var BPromise=require('bluebird');var rp=require(_0x400c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x400c('0x5'));var config=require(_0x400c('0x6'));var attributes=require(_0x400c('0x7'));module[_0x400c('0x8')]=function(_0x5f0975,_0xfc784d){return _0x5f0975['define'](_0x400c('0x9'),attributes,{'tableName':_0x400c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7197=['define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x2bca5d,_0xc1727f){var _0x4dbca0=function(_0x2b1913){while(--_0x2b1913){_0x2bca5d['push'](_0x2bca5d['shift']());}};_0x4dbca0(++_0xc1727f);}(_0x7197,0x6b));var _0x7719=function(_0x43e414,_0x5deb2a){_0x43e414=_0x43e414-0x0;var _0x38805b=_0x7197[_0x43e414];return _0x38805b;};'use strict';var _=require('lodash');var util=require(_0x7719('0x0'));var logger=require(_0x7719('0x1'))(_0x7719('0x2'));var moment=require('moment');var BPromise=require(_0x7719('0x3'));var rp=require(_0x7719('0x4'));var fs=require('fs');var path=require(_0x7719('0x5'));var rimraf=require(_0x7719('0x6'));var config=require(_0x7719('0x7'));var attributes=require(_0x7719('0x8'));module[_0x7719('0x9')]=function(_0x5baf73,_0x4611af){return _0x5baf73[_0x7719('0xa')](_0x7719('0xb'),attributes,{'tableName':_0x7719('0xc'),'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 8ef8b71..3b661fe 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 _0xb36c=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb36c,0x1bb));var _0xcb36=function(_0x3372da,_0x5d6e70){_0x3372da=_0x3372da-0x0;var _0x1975f1=_0xb36c[_0x3372da];return _0x1975f1;};'use strict';var _=require(_0xcb36('0x0'));var util=require('util');var moment=require(_0xcb36('0x1'));var BPromise=require(_0xcb36('0x2'));var rs=require(_0xcb36('0x3'));var fs=require('fs');var Redis=require(_0xcb36('0x4'));var db=require(_0xcb36('0x5'))['db'];var utils=require(_0xcb36('0x6'));var logger=require(_0xcb36('0x7'))('rpc');var config=require(_0xcb36('0x8'));var jayson=require(_0xcb36('0x9'));var client=jayson[_0xcb36('0xa')][_0xcb36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b114d,_0x363579,_0x4a2055){return new BPromise(function(_0x4adfd4,_0x5d984e){return client['request'](_0x1b114d,_0x4a2055)[_0xcb36('0xc')](function(_0x3688ab){logger[_0xcb36('0xd')](_0xcb36('0xe'),_0x363579,_0xcb36('0xf'));logger[_0xcb36('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x363579,'request\x20sent',JSON[_0xcb36('0x11')](_0x3688ab));if(_0x3688ab['error']){if(_0x3688ab['error']['code']===0x1f4){logger[_0xcb36('0x12')](_0xcb36('0xe'),_0x363579,_0x3688ab[_0xcb36('0x12')][_0xcb36('0x13')]);return _0x5d984e(_0x3688ab[_0xcb36('0x12')]['message']);}logger[_0xcb36('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x363579,_0x3688ab[_0xcb36('0x12')][_0xcb36('0x13')]);return _0x4adfd4(_0x3688ab['error'][_0xcb36('0x13')]);}else{logger[_0xcb36('0xd')](_0xcb36('0xe'),_0x363579,'request\x20sent');_0x4adfd4(_0x3688ab[_0xcb36('0x14')][_0xcb36('0x13')]);}})[_0xcb36('0x15')](function(_0x4002de){logger['error'](_0xcb36('0xe'),_0x363579,_0x4002de);_0x5d984e(_0x4002de);});});} \ No newline at end of file +var _0xbdff=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x1e997e,_0x319443){var _0x4f9955=function(_0x328735){while(--_0x328735){_0x1e997e['push'](_0x1e997e['shift']());}};_0x4f9955(++_0x319443);}(_0xbdff,0x19b));var _0xfbdf=function(_0x3098b6,_0x4cf9ed){_0x3098b6=_0x3098b6-0x0;var _0x5ce8f9=_0xbdff[_0x3098b6];return _0x5ce8f9;};'use strict';var _=require('lodash');var util=require(_0xfbdf('0x0'));var moment=require(_0xfbdf('0x1'));var BPromise=require(_0xfbdf('0x2'));var rs=require(_0xfbdf('0x3'));var fs=require('fs');var Redis=require(_0xfbdf('0x4'));var db=require(_0xfbdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbdf('0x6'))(_0xfbdf('0x7'));var config=require(_0xfbdf('0x8'));var jayson=require(_0xfbdf('0x9'));var client=jayson['client'][_0xfbdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf742,_0x207459,_0x1b3bc3){return new BPromise(function(_0xb2ce4,_0x5bf2f1){return client[_0xfbdf('0xb')](_0x4bf742,_0x1b3bc3)[_0xfbdf('0xc')](function(_0x5707ad){logger[_0xfbdf('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x207459,_0xfbdf('0xe'));logger[_0xfbdf('0xf')](_0xfbdf('0x10'),_0x207459,'request\x20sent',JSON[_0xfbdf('0x11')](_0x5707ad));if(_0x5707ad['error']){if(_0x5707ad['error'][_0xfbdf('0x12')]===0x1f4){logger[_0xfbdf('0x13')](_0xfbdf('0x14'),_0x207459,_0x5707ad[_0xfbdf('0x13')][_0xfbdf('0x15')]);return _0x5bf2f1(_0x5707ad[_0xfbdf('0x13')][_0xfbdf('0x15')]);}logger[_0xfbdf('0x13')](_0xfbdf('0x14'),_0x207459,_0x5707ad[_0xfbdf('0x13')][_0xfbdf('0x15')]);return _0xb2ce4(_0x5707ad['error'][_0xfbdf('0x15')]);}else{logger[_0xfbdf('0xd')](_0xfbdf('0x14'),_0x207459,_0xfbdf('0xe'));_0xb2ce4(_0x5707ad[_0xfbdf('0x16')][_0xfbdf('0x15')]);}})[_0xfbdf('0x17')](function(_0x4a8133){logger[_0xfbdf('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x207459,_0x4a8133);_0x5bf2f1(_0x4a8133);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1b0eab6..9e1aed3 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 _0x4dab=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x175bfd,_0x4d47b5){var _0x2753f2=function(_0x4b0a71){while(--_0x4b0a71){_0x175bfd['push'](_0x175bfd['shift']());}};_0x2753f2(++_0x4d47b5);}(_0x4dab,0x75));var _0xb4da=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x4dab[_0x1c208e];return _0x5104ff;};'use strict';var multer=require(_0xb4da('0x0'));var util=require(_0xb4da('0x1'));var path=require(_0xb4da('0x2'));var timeout=require(_0xb4da('0x3'));var express=require(_0xb4da('0x4'));var router=express[_0xb4da('0x5')]();var fs_extra=require(_0xb4da('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb4da('0x7'));var controller=require(_0xb4da('0x8'));router[_0xb4da('0x9')]('/',auth[_0xb4da('0xa')](),controller[_0xb4da('0xb')]);router[_0xb4da('0x9')](_0xb4da('0xc'),auth[_0xb4da('0xa')](),controller[_0xb4da('0xd')]);router[_0xb4da('0x9')](_0xb4da('0xe'),auth[_0xb4da('0xa')](),controller[_0xb4da('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb4da('0x10')]('/:id',auth[_0xb4da('0xa')](),controller[_0xb4da('0x11')]);router[_0xb4da('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3f80=['isAuthenticated','/:id','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x595b06,_0x103c7c){var _0x9688da=function(_0xe8250b){while(--_0xe8250b){_0x595b06['push'](_0x595b06['shift']());}};_0x9688da(++_0x103c7c);}(_0x3f80,0x1ea));var _0x03f8=function(_0x5f096e,_0x5cd76e){_0x5f096e=_0x5f096e-0x0;var _0x3c2cda=_0x3f80[_0x5f096e];return _0x3c2cda;};'use strict';var multer=require(_0x03f8('0x0'));var util=require(_0x03f8('0x1'));var path=require(_0x03f8('0x2'));var timeout=require(_0x03f8('0x3'));var express=require('express');var router=express[_0x03f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x03f8('0x5'));var interaction=require(_0x03f8('0x6'));var config=require(_0x03f8('0x7'));var controller=require(_0x03f8('0x8'));router[_0x03f8('0x9')]('/',auth[_0x03f8('0xa')](),controller['index']);router['get'](_0x03f8('0xb'),auth[_0x03f8('0xa')](),controller['show']);router['get'](_0x03f8('0xc'),auth[_0x03f8('0xa')](),controller[_0x03f8('0xd')]);router[_0x03f8('0xe')]('/',auth['isAuthenticated'](),controller[_0x03f8('0xf')]);router['put'](_0x03f8('0xb'),auth[_0x03f8('0xa')](),controller[_0x03f8('0x10')]);router[_0x03f8('0x11')](_0x03f8('0xb'),auth[_0x03f8('0xa')](),controller[_0x03f8('0x12')]);module[_0x03f8('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 5434485..bd1c192 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 _0x8b2c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2ae6a6,_0xd095fa){var _0x4d1834=function(_0x3a730a){while(--_0x3a730a){_0x2ae6a6['push'](_0x2ae6a6['shift']());}};_0x4d1834(++_0xd095fa);}(_0x8b2c,0x169));var _0xc8b2=function(_0x2814ee,_0x3051fc){_0x2814ee=_0x2814ee-0x0;var _0x3e4aa9=_0x8b2c[_0x2814ee];return _0x3e4aa9;};'use strict';var Sequelize=require(_0xc8b2('0x0'));module[_0xc8b2('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xc8b2('0x2')]},'function':{'type':Sequelize[_0xc8b2('0x2')]},'format':{'type':Sequelize[_0xc8b2('0x2')]},'groupBy':{'type':Sequelize[_0xc8b2('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc8b2('0x2')]},'custom':{'type':Sequelize[_0xc8b2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8fe5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8fe5,0x12c));var _0x58fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8fe5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x58fe('0x0'));module[_0x58fe('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x58fe('0x2')]},'function':{'type':Sequelize[_0x58fe('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x58fe('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x58fe('0x2')]},'custom':{'type':Sequelize[_0x58fe('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index de27c1a..4a13efb 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 _0x1403=['sort','where','pick','merge','filter','options','then','includeAll','include','rows','find','catch','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','params','transaction','CustomReportId','findAll','eml-format','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5618c4,_0x4e8f57){var _0xdf390f=function(_0x1406cb){while(--_0x1406cb){_0x5618c4['push'](_0x5618c4['shift']());}};_0xdf390f(++_0x4e8f57);}(_0x1403,0xb5));var _0x3140=function(_0x42c423,_0x7f2d37){_0x42c423=_0x42c423-0x0;var _0x358d9c=_0x1403[_0x42c423];return _0x358d9c;};'use strict';var emlformat=require(_0x3140('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3140('0x1'));var moment=require(_0x3140('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3140('0x3'));var util=require('util');var path=require(_0x3140('0x4'));var sox=require(_0x3140('0x5'));var csv=require('to-csv');var ejs=require(_0x3140('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3140('0x7'));var squel=require(_0x3140('0x8'));var crypto=require('crypto');var jsforce=require(_0x3140('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3140('0xa'));var Papa=require(_0x3140('0xb'));var Redis=require(_0x3140('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3140('0xd'));var as=require(_0x3140('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3140('0xf'))(_0x3140('0x10'));var utils=require(_0x3140('0x11'));var config=require(_0x3140('0x12'));var licenseUtil=require(_0x3140('0x13'));var db=require(_0x3140('0x14'))['db'];function respondWithStatusCode(_0x58af9e,_0x52f029){_0x52f029=_0x52f029||0xcc;return function(_0x5a0bdb){if(_0x5a0bdb){return _0x58af9e[_0x3140('0x15')](_0x52f029);}return _0x58af9e['status'](_0x52f029)[_0x3140('0x16')]();};}function respondWithResult(_0x490721,_0x16def7){_0x16def7=_0x16def7||0xc8;return function(_0x48ccf2){if(_0x48ccf2){return _0x490721['status'](_0x16def7)[_0x3140('0x17')](_0x48ccf2);}};}function respondWithFilteredResult(_0x5dcdf3,_0x375b63){return function(_0x5e503a){if(_0x5e503a){var _0x54fa87=typeof _0x375b63[_0x3140('0x18')]===_0x3140('0x19')&&typeof _0x375b63[_0x3140('0x1a')]===_0x3140('0x19');var _0x262103=_0x5e503a['count'];var _0x2da12b=_0x54fa87?0x0:_0x375b63['offset'];var _0x401f4e=_0x54fa87?_0x5e503a[_0x3140('0x1b')]:_0x375b63[_0x3140('0x18')]+_0x375b63[_0x3140('0x1a')];var _0x212626;if(_0x401f4e>=_0x262103){_0x401f4e=_0x262103;_0x212626=0xc8;}else{_0x212626=0xce;}_0x5dcdf3[_0x3140('0x1c')](_0x212626);return _0x5dcdf3[_0x3140('0x1d')](_0x3140('0x1e'),_0x2da12b+'-'+_0x401f4e+'/'+_0x262103)[_0x3140('0x17')](_0x5e503a);}return null;};}function patchUpdates(_0x1a989d){return function(_0x4deb1c){try{jsonpatch['apply'](_0x4deb1c,_0x1a989d,!![]);}catch(_0x191cc7){return BPromise[_0x3140('0x1f')](_0x191cc7);}return _0x4deb1c[_0x3140('0x20')]();};}function saveUpdates(_0x274280,_0x221488){return function(_0x365666){if(_0x365666){return _0x365666[_0x3140('0x21')](_0x274280)['then'](function(_0x3675f7){return _0x3675f7;});}return null;};}function removeEntity(_0x35f236,_0x4f0da9){return function(_0x129e2e){if(_0x129e2e){return _0x129e2e[_0x3140('0x22')]()['then'](function(){_0x35f236[_0x3140('0x1c')](0xcc)[_0x3140('0x16')]();});}};}function handleEntityNotFound(_0x45acbb,_0x4a0043){return function(_0x47579a){if(!_0x47579a){_0x45acbb[_0x3140('0x15')](0x194);}return _0x47579a;};}function handleError(_0x230299,_0x65a7f8){_0x65a7f8=_0x65a7f8||0x1f4;return function(_0x55957b){logger['error'](_0x55957b[_0x3140('0x23')]);if(_0x55957b[_0x3140('0x24')]){delete _0x55957b[_0x3140('0x24')];}_0x230299[_0x3140('0x1c')](_0x65a7f8)[_0x3140('0x25')](_0x55957b);};}exports[_0x3140('0x26')]=function(_0x36b770,_0x20ce7d){var _0xea1adc={},_0x4f64de={},_0x2e5013={'count':0x0,'rows':[]};var _0x586e87=_[_0x3140('0x27')](db[_0x3140('0x28')][_0x3140('0x29')],function(_0x41b411){return{'name':_0x41b411[_0x3140('0x2a')],'type':_0x41b411[_0x3140('0x2b')][_0x3140('0x2c')]};});_0x4f64de[_0x3140('0x2d')]=_['map'](_0x586e87,_0x3140('0x24'));_0x4f64de['query']=_[_0x3140('0x2e')](_0x36b770[_0x3140('0x2f')]);_0x4f64de[_0x3140('0x30')]=_[_0x3140('0x31')](_0x4f64de[_0x3140('0x2d')],_0x4f64de[_0x3140('0x2f')]);_0xea1adc[_0x3140('0x32')]=_[_0x3140('0x31')](_0x4f64de[_0x3140('0x2d')],qs[_0x3140('0x33')](_0x36b770[_0x3140('0x2f')][_0x3140('0x33')]));_0xea1adc[_0x3140('0x32')]=_0xea1adc[_0x3140('0x32')][_0x3140('0x34')]?_0xea1adc[_0x3140('0x32')]:_0x4f64de[_0x3140('0x2d')];if(!_0x36b770[_0x3140('0x2f')][_0x3140('0x35')](_0x3140('0x36'))){_0xea1adc[_0x3140('0x1a')]=qs[_0x3140('0x1a')](_0x36b770[_0x3140('0x2f')][_0x3140('0x1a')]);_0xea1adc['offset']=qs[_0x3140('0x18')](_0x36b770['query'][_0x3140('0x18')]);}_0xea1adc[_0x3140('0x37')]=qs[_0x3140('0x38')](_0x36b770['query'][_0x3140('0x38')]);_0xea1adc[_0x3140('0x39')]=qs[_0x3140('0x30')](_[_0x3140('0x3a')](_0x36b770['query'],_0x4f64de[_0x3140('0x30')]),_0x586e87);if(_0x36b770[_0x3140('0x2f')]['filter']){_0xea1adc[_0x3140('0x39')]=_[_0x3140('0x3b')](_0xea1adc['where'],{'$or':_[_0x3140('0x27')](_0x586e87,function(_0x243232){if(_0x243232[_0x3140('0x2b')]!=='VIRTUAL'){var _0x497f27={};_0x497f27[_0x243232[_0x3140('0x24')]]={'$like':'%'+_0x36b770['query'][_0x3140('0x3c')]+'%'};return _0x497f27;}})});}_0xea1adc=_[_0x3140('0x3b')]({},_0xea1adc,_0x36b770[_0x3140('0x3d')]);var _0x5049e7={'where':_0xea1adc['where']};return db[_0x3140('0x28')]['count'](_0x5049e7)[_0x3140('0x3e')](function(_0x10dcf9){_0x2e5013[_0x3140('0x1b')]=_0x10dcf9;if(_0x36b770[_0x3140('0x2f')][_0x3140('0x3f')]){_0xea1adc[_0x3140('0x40')]=[{'all':!![]}];}return db[_0x3140('0x28')]['findAll'](_0xea1adc);})[_0x3140('0x3e')](function(_0x3d4ea9){_0x2e5013[_0x3140('0x41')]=_0x3d4ea9;return _0x2e5013;})['then'](respondWithFilteredResult(_0x20ce7d,_0xea1adc))['catch'](handleError(_0x20ce7d,null));};exports['show']=function(_0xd50744,_0x57efa0){var _0x1d7560={'raw':![],'where':{'id':_0xd50744['params']['id']}},_0x54979e={};_0x54979e['model']=_[_0x3140('0x2e')](db[_0x3140('0x28')][_0x3140('0x29')]);_0x54979e['query']=_[_0x3140('0x2e')](_0xd50744['query']);_0x54979e[_0x3140('0x30')]=_[_0x3140('0x31')](_0x54979e[_0x3140('0x2d')],_0x54979e[_0x3140('0x2f')]);_0x1d7560['attributes']=_[_0x3140('0x31')](_0x54979e[_0x3140('0x2d')],qs['fields'](_0xd50744['query']['fields']));_0x1d7560['attributes']=_0x1d7560[_0x3140('0x32')]['length']?_0x1d7560[_0x3140('0x32')]:_0x54979e['model'];if(_0xd50744[_0x3140('0x2f')]['includeAll']){_0x1d7560[_0x3140('0x40')]=[{'all':!![]}];}_0x1d7560=_[_0x3140('0x3b')]({},_0x1d7560,_0xd50744[_0x3140('0x3d')]);return db['AnalyticFieldReport'][_0x3140('0x42')](_0x1d7560)['then'](handleEntityNotFound(_0x57efa0,null))[_0x3140('0x3e')](respondWithResult(_0x57efa0,null))[_0x3140('0x43')](handleError(_0x57efa0,null));};exports[_0x3140('0x44')]=function(_0x3a26c3,_0x1acb93){return db['AnalyticFieldReport']['create'](_0x3a26c3[_0x3140('0x45')],{})['then'](respondWithResult(_0x1acb93,0xc9))[_0x3140('0x43')](handleError(_0x1acb93,null));};exports['bulkCreate']=function(_0x3567fc,_0x263a41){return db[_0x3140('0x28')][_0x3140('0x46')](_0x3567fc[_0x3140('0x45')],{'raw':![],'individualHooks':!![]})[_0x3140('0x3e')](respondWithResult(_0x263a41,0xc9))['catch'](handleError(_0x263a41,null));};exports[_0x3140('0x21')]=function(_0x45b9ee,_0x1b46d7){if(_0x45b9ee[_0x3140('0x45')]['id']){delete _0x45b9ee[_0x3140('0x45')]['id'];}return db[_0x3140('0x28')][_0x3140('0x42')]({'where':{'id':_0x45b9ee['params']['id']}})[_0x3140('0x3e')](handleEntityNotFound(_0x1b46d7,null))[_0x3140('0x3e')](saveUpdates(_0x45b9ee['body'],null))[_0x3140('0x3e')](respondWithResult(_0x1b46d7,null))[_0x3140('0x43')](handleError(_0x1b46d7,null));};exports[_0x3140('0x22')]=function(_0x42c62b,_0x1ce2a9){return db['AnalyticFieldReport'][_0x3140('0x42')]({'where':{'id':_0x42c62b['params']['id']}})[_0x3140('0x3e')](handleEntityNotFound(_0x1ce2a9,null))[_0x3140('0x3e')](removeEntity(_0x1ce2a9,null))[_0x3140('0x43')](handleError(_0x1ce2a9,null));};exports['bulkDestroy']=function(_0x40f9be,_0x5eee2a){return db[_0x3140('0x28')][_0x3140('0x22')]({'where':{'id':_0x40f9be[_0x3140('0x2f')][_0x3140('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x3140('0x3e')](respondWithResult(_0x5eee2a,0xcc))[_0x3140('0x43')](handleError(_0x5eee2a,null));};exports[_0x3140('0x48')]=function(_0x503e68,_0x215de2,_0x3de534){return db[_0x3140('0x49')][_0x3140('0x4a')]({'where':{'id':_0x503e68[_0x3140('0x4b')]['id']}})[_0x3140('0x3e')](handleEntityNotFound(_0x215de2,null))[_0x3140('0x3e')](function(_0xe09344){if(_0xe09344){return db['sequelize'][_0x3140('0x4c')](function(_0x33f3a9){return db[_0x3140('0x28')][_0x3140('0x22')]({'where':{'CustomReportId':_0x503e68[_0x3140('0x4b')]['id']},'transaction':_0x33f3a9})[_0x3140('0x3e')](function(_0x384828){var _0x3a2672=_[_0x3140('0x27')](_0x503e68[_0x3140('0x45')],function(_0x28157c){delete _0x28157c['id'];_0x28157c[_0x3140('0x4d')]=_0x503e68[_0x3140('0x4b')]['id'];return _0x28157c;});return db[_0x3140('0x28')][_0x3140('0x46')](_0x3a2672,{'transaction':_0x33f3a9});});})[_0x3140('0x3e')](function(){return db[_0x3140('0x28')][_0x3140('0x4e')]({'where':{'CustomReportId':_0x503e68[_0x3140('0x4b')]['id']}});});}})['then'](respondWithResult(_0x215de2,null))[_0x3140('0x43')](handleError(_0x215de2,null));}; \ No newline at end of file +var _0x8118=['key','model','keys','filters','intersection','query','fields','attributes','length','sort','where','pick','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','options','find','catch','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x4ddbc5,_0x7f4e8b){var _0x18b5de=function(_0x342296){while(--_0x342296){_0x4ddbc5['push'](_0x4ddbc5['shift']());}};_0x18b5de(++_0x7f4e8b);}(_0x8118,0x148));var _0x8811=function(_0x1b81ae,_0x1941f7){_0x1b81ae=_0x1b81ae-0x0;var _0x33ba48=_0x8118[_0x1b81ae];return _0x33ba48;};'use strict';var emlformat=require(_0x8811('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8811('0x1'));var moment=require(_0x8811('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8811('0x3'));var util=require(_0x8811('0x4'));var path=require(_0x8811('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8811('0x6'));var fs=require('fs');var fs_extra=require(_0x8811('0x7'));var _=require(_0x8811('0x8'));var squel=require('squel');var crypto=require(_0x8811('0x9'));var jsforce=require(_0x8811('0xa'));var deskjs=require(_0x8811('0xb'));var toCsv=require(_0x8811('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8811('0xd'));var authService=require(_0x8811('0xe'));var qs=require(_0x8811('0xf'));var as=require(_0x8811('0x10'));var hardwareService=require(_0x8811('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8811('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8811('0x13'));var db=require(_0x8811('0x14'))['db'];function respondWithStatusCode(_0x43279c,_0x445cd2){_0x445cd2=_0x445cd2||0xcc;return function(_0x44260f){if(_0x44260f){return _0x43279c['sendStatus'](_0x445cd2);}return _0x43279c[_0x8811('0x15')](_0x445cd2)[_0x8811('0x16')]();};}function respondWithResult(_0x767ce0,_0x52ebba){_0x52ebba=_0x52ebba||0xc8;return function(_0x44128d){if(_0x44128d){return _0x767ce0[_0x8811('0x15')](_0x52ebba)[_0x8811('0x17')](_0x44128d);}};}function respondWithFilteredResult(_0x2413e7,_0x206d3d){return function(_0x4ee4bc){if(_0x4ee4bc){var _0x194ae8=typeof _0x206d3d[_0x8811('0x18')]===_0x8811('0x19')&&typeof _0x206d3d[_0x8811('0x1a')]===_0x8811('0x19');var _0x1db676=_0x4ee4bc[_0x8811('0x1b')];var _0x546320=_0x194ae8?0x0:_0x206d3d['offset'];var _0x56f560=_0x194ae8?_0x4ee4bc[_0x8811('0x1b')]:_0x206d3d[_0x8811('0x18')]+_0x206d3d['limit'];var _0x39300c;if(_0x56f560>=_0x1db676){_0x56f560=_0x1db676;_0x39300c=0xc8;}else{_0x39300c=0xce;}_0x2413e7[_0x8811('0x15')](_0x39300c);return _0x2413e7['set']('Content-Range',_0x546320+'-'+_0x56f560+'/'+_0x1db676)[_0x8811('0x17')](_0x4ee4bc);}return null;};}function patchUpdates(_0x353a5c){return function(_0x318d71){try{jsonpatch[_0x8811('0x1c')](_0x318d71,_0x353a5c,!![]);}catch(_0x56b7e6){return BPromise[_0x8811('0x1d')](_0x56b7e6);}return _0x318d71[_0x8811('0x1e')]();};}function saveUpdates(_0x576dfe,_0xaaad36){return function(_0x882ea5){if(_0x882ea5){return _0x882ea5[_0x8811('0x1f')](_0x576dfe)[_0x8811('0x20')](function(_0x23f04e){return _0x23f04e;});}return null;};}function removeEntity(_0x1e7d89,_0x4dc7a0){return function(_0x44cd79){if(_0x44cd79){return _0x44cd79[_0x8811('0x21')]()[_0x8811('0x20')](function(){_0x1e7d89[_0x8811('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3c10,_0x3cc5dd){return function(_0x5c80c0){if(!_0x5c80c0){_0x4a3c10['sendStatus'](0x194);}return _0x5c80c0;};}function handleError(_0x28fcae,_0x280c7){_0x280c7=_0x280c7||0x1f4;return function(_0x2e2254){logger['error'](_0x2e2254[_0x8811('0x22')]);if(_0x2e2254[_0x8811('0x23')]){delete _0x2e2254[_0x8811('0x23')];}_0x28fcae[_0x8811('0x15')](_0x280c7)['send'](_0x2e2254);};}exports[_0x8811('0x24')]=function(_0x142523,_0x34f841){var _0x2d2b88={},_0x317ba3={},_0xaba7ae={'count':0x0,'rows':[]};var _0x39bbc2=_[_0x8811('0x25')](db[_0x8811('0x26')][_0x8811('0x27')],function(_0x3c8e9b){return{'name':_0x3c8e9b[_0x8811('0x28')],'type':_0x3c8e9b[_0x8811('0x29')][_0x8811('0x2a')]};});_0x317ba3[_0x8811('0x2b')]=_[_0x8811('0x25')](_0x39bbc2,_0x8811('0x23'));_0x317ba3['query']=_[_0x8811('0x2c')](_0x142523['query']);_0x317ba3[_0x8811('0x2d')]=_[_0x8811('0x2e')](_0x317ba3['model'],_0x317ba3[_0x8811('0x2f')]);_0x2d2b88['attributes']=_[_0x8811('0x2e')](_0x317ba3[_0x8811('0x2b')],qs[_0x8811('0x30')](_0x142523[_0x8811('0x2f')][_0x8811('0x30')]));_0x2d2b88[_0x8811('0x31')]=_0x2d2b88[_0x8811('0x31')][_0x8811('0x32')]?_0x2d2b88['attributes']:_0x317ba3['model'];if(!_0x142523[_0x8811('0x2f')]['hasOwnProperty']('nolimit')){_0x2d2b88[_0x8811('0x1a')]=qs[_0x8811('0x1a')](_0x142523[_0x8811('0x2f')][_0x8811('0x1a')]);_0x2d2b88['offset']=qs['offset'](_0x142523[_0x8811('0x2f')]['offset']);}_0x2d2b88['order']=qs[_0x8811('0x33')](_0x142523['query']['sort']);_0x2d2b88[_0x8811('0x34')]=qs[_0x8811('0x2d')](_[_0x8811('0x35')](_0x142523[_0x8811('0x2f')],_0x317ba3[_0x8811('0x2d')]),_0x39bbc2);if(_0x142523[_0x8811('0x2f')]['filter']){_0x2d2b88[_0x8811('0x34')]=_['merge'](_0x2d2b88['where'],{'$or':_[_0x8811('0x25')](_0x39bbc2,function(_0x5d3cb0){if(_0x5d3cb0['type']!==_0x8811('0x36')){var _0x5339df={};_0x5339df[_0x5d3cb0['name']]={'$like':'%'+_0x142523['query']['filter']+'%'};return _0x5339df;}})});}_0x2d2b88=_['merge']({},_0x2d2b88,_0x142523['options']);var _0x2471c8={'where':_0x2d2b88['where']};return db[_0x8811('0x26')][_0x8811('0x1b')](_0x2471c8)['then'](function(_0x1ec322){_0xaba7ae['count']=_0x1ec322;if(_0x142523[_0x8811('0x2f')][_0x8811('0x37')]){_0x2d2b88[_0x8811('0x38')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8811('0x39')](_0x2d2b88);})[_0x8811('0x20')](function(_0x5b155f){_0xaba7ae[_0x8811('0x3a')]=_0x5b155f;return _0xaba7ae;})[_0x8811('0x20')](respondWithFilteredResult(_0x34f841,_0x2d2b88))['catch'](handleError(_0x34f841,null));};exports[_0x8811('0x3b')]=function(_0x5bbfa3,_0x39c18c){var _0x27d3d4={'raw':![],'where':{'id':_0x5bbfa3[_0x8811('0x3c')]['id']}},_0x362dbd={};_0x362dbd[_0x8811('0x2b')]=_[_0x8811('0x2c')](db[_0x8811('0x26')][_0x8811('0x27')]);_0x362dbd[_0x8811('0x2f')]=_[_0x8811('0x2c')](_0x5bbfa3[_0x8811('0x2f')]);_0x362dbd[_0x8811('0x2d')]=_[_0x8811('0x2e')](_0x362dbd[_0x8811('0x2b')],_0x362dbd[_0x8811('0x2f')]);_0x27d3d4[_0x8811('0x31')]=_[_0x8811('0x2e')](_0x362dbd[_0x8811('0x2b')],qs[_0x8811('0x30')](_0x5bbfa3['query'][_0x8811('0x30')]));_0x27d3d4[_0x8811('0x31')]=_0x27d3d4['attributes'][_0x8811('0x32')]?_0x27d3d4[_0x8811('0x31')]:_0x362dbd[_0x8811('0x2b')];if(_0x5bbfa3[_0x8811('0x2f')][_0x8811('0x37')]){_0x27d3d4[_0x8811('0x38')]=[{'all':!![]}];}_0x27d3d4=_[_0x8811('0x3d')]({},_0x27d3d4,_0x5bbfa3[_0x8811('0x3e')]);return db[_0x8811('0x26')][_0x8811('0x3f')](_0x27d3d4)[_0x8811('0x20')](handleEntityNotFound(_0x39c18c,null))[_0x8811('0x20')](respondWithResult(_0x39c18c,null))[_0x8811('0x40')](handleError(_0x39c18c,null));};exports[_0x8811('0x41')]=function(_0x22a186,_0x26ce44){return db['AnalyticFieldReport']['create'](_0x22a186[_0x8811('0x42')],{})[_0x8811('0x20')](respondWithResult(_0x26ce44,0xc9))[_0x8811('0x40')](handleError(_0x26ce44,null));};exports[_0x8811('0x43')]=function(_0x1891e3,_0x160ca4){return db[_0x8811('0x26')][_0x8811('0x43')](_0x1891e3['body'],{'raw':![],'individualHooks':!![]})[_0x8811('0x20')](respondWithResult(_0x160ca4,0xc9))['catch'](handleError(_0x160ca4,null));};exports[_0x8811('0x1f')]=function(_0x461a07,_0x55798e){if(_0x461a07[_0x8811('0x42')]['id']){delete _0x461a07[_0x8811('0x42')]['id'];}return db[_0x8811('0x26')][_0x8811('0x3f')]({'where':{'id':_0x461a07['params']['id']}})[_0x8811('0x20')](handleEntityNotFound(_0x55798e,null))[_0x8811('0x20')](saveUpdates(_0x461a07[_0x8811('0x42')],null))[_0x8811('0x20')](respondWithResult(_0x55798e,null))[_0x8811('0x40')](handleError(_0x55798e,null));};exports[_0x8811('0x21')]=function(_0xdf0f37,_0x42d6bb){return db[_0x8811('0x26')][_0x8811('0x3f')]({'where':{'id':_0xdf0f37[_0x8811('0x3c')]['id']}})[_0x8811('0x20')](handleEntityNotFound(_0x42d6bb,null))[_0x8811('0x20')](removeEntity(_0x42d6bb,null))[_0x8811('0x40')](handleError(_0x42d6bb,null));};exports[_0x8811('0x44')]=function(_0x33cc36,_0x327024){return db[_0x8811('0x26')]['destroy']({'where':{'id':_0x33cc36['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x327024,0xcc))[_0x8811('0x40')](handleError(_0x327024,null));};exports[_0x8811('0x45')]=function(_0x478f77,_0x5db529,_0x102431){return db[_0x8811('0x46')]['findOne']({'where':{'id':_0x478f77[_0x8811('0x3c')]['id']}})[_0x8811('0x20')](handleEntityNotFound(_0x5db529,null))['then'](function(_0x33f767){if(_0x33f767){return db[_0x8811('0x47')][_0x8811('0x48')](function(_0x5e45d9){return db[_0x8811('0x26')][_0x8811('0x21')]({'where':{'CustomReportId':_0x478f77[_0x8811('0x3c')]['id']},'transaction':_0x5e45d9})[_0x8811('0x20')](function(_0x32b1b1){var _0x305359=_[_0x8811('0x25')](_0x478f77['body'],function(_0x4546e5){delete _0x4546e5['id'];_0x4546e5[_0x8811('0x49')]=_0x478f77[_0x8811('0x3c')]['id'];return _0x4546e5;});return db[_0x8811('0x26')][_0x8811('0x43')](_0x305359,{'transaction':_0x5e45d9});});})[_0x8811('0x20')](function(){return db['AnalyticFieldReport'][_0x8811('0x39')]({'where':{'CustomReportId':_0x478f77[_0x8811('0x3c')]['id']}});});}})['then'](respondWithResult(_0x5db529,null))[_0x8811('0x40')](handleError(_0x5db529,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8991ffa..595aa20 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 _0x2184=['util','../../config/logger','moment','bluebird','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash'];(function(_0x26b258,_0xa31302){var _0x2fd565=function(_0x5f1ff4){while(--_0x5f1ff4){_0x26b258['push'](_0x26b258['shift']());}};_0x2fd565(++_0xa31302);}(_0x2184,0x128));var _0x4218=function(_0x56a6ba,_0x3308f6){_0x56a6ba=_0x56a6ba-0x0;var _0x5c63ce=_0x2184[_0x56a6ba];return _0x5c63ce;};'use strict';var _=require(_0x4218('0x0'));var util=require(_0x4218('0x1'));var logger=require(_0x4218('0x2'))('api');var moment=require(_0x4218('0x3'));var BPromise=require(_0x4218('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4218('0x5'));var rimraf=require('rimraf');var config=require(_0x4218('0x6'));var attributes=require(_0x4218('0x7'));module[_0x4218('0x8')]=function(_0x1a6705,_0x2bb565){return _0x1a6705[_0x4218('0x9')](_0x4218('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e95=['bluebird','exports','define','analytics_report_fields','moment'];(function(_0x23ba5f,_0x48e0d4){var _0x280358=function(_0x4cac5a){while(--_0x4cac5a){_0x23ba5f['push'](_0x23ba5f['shift']());}};_0x280358(++_0x48e0d4);}(_0x6e95,0x158));var _0x56e9=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x6e95[_0x967959];return _0x5c4489;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56e9('0x0'));var BPromise=require(_0x56e9('0x1'));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('./analyticFieldReport.attributes');module[_0x56e9('0x2')]=function(_0x3099c3,_0x1a3d55){return _0x3099c3[_0x56e9('0x3')]('AnalyticFieldReport',attributes,{'tableName':_0x56e9('0x4'),'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 75dcb82..c1d11c0 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 _0x501d=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','message','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x501d,0x94));var _0xd501=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x501d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd501('0x0'));var util=require(_0xd501('0x1'));var moment=require(_0xd501('0x2'));var BPromise=require('bluebird');var rs=require(_0xd501('0x3'));var fs=require('fs');var Redis=require(_0xd501('0x4'));var db=require(_0xd501('0x5'))['db'];var utils=require(_0xd501('0x6'));var logger=require('../../config/logger')(_0xd501('0x7'));var config=require(_0xd501('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29b410,_0x232a40,_0x1de1d0){return new BPromise(function(_0x5a96c8,_0x12b8a2){return client[_0xd501('0xa')](_0x29b410,_0x1de1d0)[_0xd501('0xb')](function(_0x2606eb){logger[_0xd501('0xc')](_0xd501('0xd'),_0x232a40,_0xd501('0xe'));logger[_0xd501('0xf')](_0xd501('0x10'),_0x232a40,_0xd501('0xe'),JSON[_0xd501('0x11')](_0x2606eb));if(_0x2606eb['error']){if(_0x2606eb['error']['code']===0x1f4){logger['error'](_0xd501('0xd'),_0x232a40,_0x2606eb['error'][_0xd501('0x12')]);return _0x12b8a2(_0x2606eb[_0xd501('0x13')][_0xd501('0x12')]);}logger[_0xd501('0x13')](_0xd501('0xd'),_0x232a40,_0x2606eb[_0xd501('0x13')][_0xd501('0x12')]);return _0x5a96c8(_0x2606eb['error'][_0xd501('0x12')]);}else{logger['info'](_0xd501('0xd'),_0x232a40,_0xd501('0xe'));_0x5a96c8(_0x2606eb['result'][_0xd501('0x12')]);}})[_0xd501('0x14')](function(_0x17f9bc){logger['error'](_0xd501('0xd'),_0x232a40,_0x17f9bc);_0x12b8a2(_0x17f9bc);});});} \ No newline at end of file +var _0xcfa0=['ioredis','../../config/logger','rpc','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4cb7b1,_0x42bc9f){var _0x3b5fce=function(_0x3cab27){while(--_0x3cab27){_0x4cb7b1['push'](_0x4cb7b1['shift']());}};_0x3b5fce(++_0x42bc9f);}(_0xcfa0,0x150));var _0x0cfa=function(_0x53f1ee,_0x29cff6){_0x53f1ee=_0x53f1ee-0x0;var _0x3638da=_0xcfa0[_0x53f1ee];return _0x3638da;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cfa('0x0'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cfa('0x1'))(_0x0cfa('0x2'));var config=require('../../config/environment');var jayson=require(_0x0cfa('0x3'));var client=jayson[_0x0cfa('0x4')][_0x0cfa('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x36cf54,_0xd60f26,_0x4ff849){return new BPromise(function(_0x46673c,_0x2ce43a){return client['request'](_0x36cf54,_0x4ff849)['then'](function(_0x6ad738){logger[_0x0cfa('0x6')](_0x0cfa('0x7'),_0xd60f26,'request\x20sent');logger[_0x0cfa('0x8')](_0x0cfa('0x9'),_0xd60f26,_0x0cfa('0xa'),JSON[_0x0cfa('0xb')](_0x6ad738));if(_0x6ad738[_0x0cfa('0xc')]){if(_0x6ad738[_0x0cfa('0xc')][_0x0cfa('0xd')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xd60f26,_0x6ad738[_0x0cfa('0xc')][_0x0cfa('0xe')]);return _0x2ce43a(_0x6ad738[_0x0cfa('0xc')][_0x0cfa('0xe')]);}logger[_0x0cfa('0xc')](_0x0cfa('0x7'),_0xd60f26,_0x6ad738[_0x0cfa('0xc')]['message']);return _0x46673c(_0x6ad738['error'][_0x0cfa('0xe')]);}else{logger[_0x0cfa('0x6')](_0x0cfa('0x7'),_0xd60f26,_0x0cfa('0xa'));_0x46673c(_0x6ad738[_0x0cfa('0xf')][_0x0cfa('0xe')]);}})['catch'](function(_0x3f3b9b){logger[_0x0cfa('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd60f26,_0x3f3b9b);_0x2ce43a(_0x3f3b9b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0fe21bd..8ea43ad 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(_0x2b4a60,_0x3b5ac3){var _0x539618=function(_0x157855){while(--_0x157855){_0x2b4a60['push'](_0x2b4a60['shift']());}};_0x539618(++_0x3b5ac3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x3d57dd,_0x263837){var _0x1719e7=function(_0x3271f2){while(--_0x3271f2){_0x3d57dd['push'](_0x3d57dd['shift']());}};_0x1719e7(++_0x263837);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 732a4c5..841269f 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 _0xb11e=['name','sequelize','exports','STRING'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xb11e,0x7d));var _0xeb11=function(_0x5cd461,_0x50750d){_0x5cd461=_0x5cd461-0x0;var _0x9277a4=_0xb11e[_0x5cd461];return _0x9277a4;};'use strict';var Sequelize=require(_0xeb11('0x0'));module[_0xeb11('0x1')]={'name':{'type':Sequelize[_0xeb11('0x2')],'allowNull':![],'unique':_0xeb11('0x3')},'table':{'type':Sequelize[_0xeb11('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x122a=['STRING','name','sequelize','exports'];(function(_0x5b0df2,_0x30877c){var _0x3ec6ae=function(_0x106234){while(--_0x106234){_0x5b0df2['push'](_0x5b0df2['shift']());}};_0x3ec6ae(++_0x30877c);}(_0x122a,0xba));var _0xa122=function(_0xce1a3,_0x3bc785){_0xce1a3=_0xce1a3-0x0;var _0x487cca=_0x122a[_0xce1a3];return _0x487cca;};'use strict';var Sequelize=require(_0xa122('0x0'));module[_0xa122('0x1')]={'name':{'type':Sequelize[_0xa122('0x2')],'allowNull':![],'unique':_0xa122('0x3')},'table':{'type':Sequelize[_0xa122('0x2')]},'metric':{'type':Sequelize['TEXT']},'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 50a039e..9622883 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4bb0ff,_0x2ef123){var _0x432de7=function(_0x525fe1){while(--_0x525fe1){_0x4bb0ff['push'](_0x4bb0ff['shift']());}};_0x432de7(++_0x2ef123);}(_0x8ef6,0xf2));var _0x68ef=function(_0x41d417,_0x18c0a9){_0x41d417=_0x41d417-0x0;var _0x1121f6=_0x8ef6[_0x41d417];return _0x1121f6;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x54aa8f,_0xa74c2a){var _0x14d0c8=function(_0x184152){while(--_0x184152){_0x54aa8f['push'](_0x54aa8f['shift']());}};_0x14d0c8(++_0xa74c2a);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8b08170..593286e 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 _0x553a=['bluebird','rimraf','exports','define','AnalyticMetric','analytics_metrics','util','api','moment'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x553a,0x192));var _0xa553=function(_0x4b2a5c,_0x29b5eb){_0x4b2a5c=_0x4b2a5c-0x0;var _0xed6e3c=_0x553a[_0x4b2a5c];return _0xed6e3c;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var logger=require('../../config/logger')(_0xa553('0x1'));var moment=require(_0xa553('0x2'));var BPromise=require(_0xa553('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa553('0x4'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xa553('0x5')]=function(_0x53190d,_0x5ddf5e){return _0x53190d[_0xa553('0x6')](_0xa553('0x7'),attributes,{'tableName':_0xa553('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa13d=['lodash','../../config/logger','api','bluebird','path','rimraf','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x1b01f6,_0x57d583){var _0x1f67af=function(_0x1838e2){while(--_0x1838e2){_0x1b01f6['push'](_0x1b01f6['shift']());}};_0x1f67af(++_0x57d583);}(_0xa13d,0x154));var _0xda13=function(_0x27a03c,_0x193b87){_0x27a03c=_0x27a03c-0x0;var _0x180b3d=_0xa13d[_0x27a03c];return _0x180b3d;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var logger=require(_0xda13('0x1'))(_0xda13('0x2'));var moment=require('moment');var BPromise=require(_0xda13('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda13('0x4'));var rimraf=require(_0xda13('0x5'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xda13('0x6')]=function(_0x3d5a0e,_0x4df317){return _0x3d5a0e[_0xda13('0x7')](_0xda13('0x8'),attributes,{'tableName':_0xda13('0x9'),'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 8b2ccc8..2e69f7b 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 _0x68c8=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring'];(function(_0x35c2a0,_0x2a2650){var _0x215ce4=function(_0xb3b909){while(--_0xb3b909){_0x35c2a0['push'](_0x35c2a0['shift']());}};_0x215ce4(++_0x2a2650);}(_0x68c8,0x1f1));var _0x868c=function(_0x303fff,_0x5f4c82){_0x303fff=_0x303fff-0x0;var _0x1c6801=_0x68c8[_0x303fff];return _0x1c6801;};'use strict';var _=require(_0x868c('0x0'));var util=require(_0x868c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x868c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x868c('0x3'))['db'];var utils=require(_0x868c('0x4'));var logger=require('../../config/logger')(_0x868c('0x5'));var config=require(_0x868c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x868c('0x7')][_0x868c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19fc22,_0x347a5d,_0xbb52e){return new BPromise(function(_0x5e270a,_0x338e41){return client[_0x868c('0x9')](_0x19fc22,_0xbb52e)['then'](function(_0x4dba29){logger[_0x868c('0xa')](_0x868c('0xb'),_0x347a5d,_0x868c('0xc'));logger[_0x868c('0xd')](_0x868c('0xe'),_0x347a5d,_0x868c('0xc'),JSON[_0x868c('0xf')](_0x4dba29));if(_0x4dba29['error']){if(_0x4dba29[_0x868c('0x10')][_0x868c('0x11')]===0x1f4){logger[_0x868c('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x347a5d,_0x4dba29[_0x868c('0x10')][_0x868c('0x12')]);return _0x338e41(_0x4dba29[_0x868c('0x10')]['message']);}logger[_0x868c('0x10')](_0x868c('0xb'),_0x347a5d,_0x4dba29[_0x868c('0x10')]['message']);return _0x5e270a(_0x4dba29[_0x868c('0x10')][_0x868c('0x12')]);}else{logger[_0x868c('0xa')](_0x868c('0xb'),_0x347a5d,'request\x20sent');_0x5e270a(_0x4dba29['result']['message']);}})[_0x868c('0x13')](function(_0x142b3b){logger['error'](_0x868c('0xb'),_0x347a5d,_0x142b3b);_0x338e41(_0x142b3b);});});} \ No newline at end of file +var _0x994c=['../../config/logger','jayson/promise','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','../../mysqldb','../../config/utils'];(function(_0x21a173,_0x1f6b9a){var _0x244d96=function(_0x2aea9f){while(--_0x2aea9f){_0x21a173['push'](_0x21a173['shift']());}};_0x244d96(++_0x1f6b9a);}(_0x994c,0x1a6));var _0xc994=function(_0x46867e,_0x90e3a2){_0x46867e=_0x46867e-0x0;var _0x19ff44=_0x994c[_0x46867e];return _0x19ff44;};'use strict';var _=require(_0xc994('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc994('0x1'))['db'];var utils=require(_0xc994('0x2'));var logger=require(_0xc994('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc994('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43ee1c,_0x187ff1,_0xc826a6){return new BPromise(function(_0x33fdae,_0xfa7652){return client['request'](_0x43ee1c,_0xc826a6)[_0xc994('0x5')](function(_0x546f25){logger[_0xc994('0x6')]('AnalyticMetric,\x20%s,\x20%s',_0x187ff1,_0xc994('0x7'));logger[_0xc994('0x8')](_0xc994('0x9'),_0x187ff1,_0xc994('0x7'),JSON[_0xc994('0xa')](_0x546f25));if(_0x546f25['error']){if(_0x546f25[_0xc994('0xb')][_0xc994('0xc')]===0x1f4){logger[_0xc994('0xb')](_0xc994('0xd'),_0x187ff1,_0x546f25[_0xc994('0xb')]['message']);return _0xfa7652(_0x546f25[_0xc994('0xb')][_0xc994('0xe')]);}logger[_0xc994('0xb')](_0xc994('0xd'),_0x187ff1,_0x546f25[_0xc994('0xb')][_0xc994('0xe')]);return _0x33fdae(_0x546f25['error'][_0xc994('0xe')]);}else{logger[_0xc994('0x6')]('AnalyticMetric,\x20%s,\x20%s',_0x187ff1,_0xc994('0x7'));_0x33fdae(_0x546f25[_0xc994('0xf')]['message']);}})[_0xc994('0x10')](function(_0x4aca44){logger[_0xc994('0xb')](_0xc994('0xd'),_0x187ff1,_0x4aca44);_0xfa7652(_0x4aca44);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3fd2843..b916082 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 _0xce1a=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','get','/:id','put','update','exports','multer','express','Router','fs-extra'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xce1a,0xbf));var _0xace1=function(_0x2b1fad,_0x307f8b){_0x2b1fad=_0x2b1fad-0x0;var _0x7249fa=_0xce1a[_0x2b1fad];return _0x7249fa;};'use strict';var multer=require(_0xace1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace1('0x1'));var router=express[_0xace1('0x2')]();var fs_extra=require(_0xace1('0x3'));var auth=require(_0xace1('0x4'));var interaction=require(_0xace1('0x5'));var config=require('../../config/environment');var controller=require(_0xace1('0x6'));router['get']('/',auth[_0xace1('0x7')](),controller['index']);router[_0xace1('0x8')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['show']);router['post']('/',auth[_0xace1('0x7')](),controller['create']);router[_0xace1('0xa')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller[_0xace1('0xb')]);router['delete'](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['destroy']);module[_0xace1('0xc')]=router; \ No newline at end of file +var _0xcd59=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x381332,_0x5a8b6c){var _0x4846e1=function(_0x4c31f8){while(--_0x4c31f8){_0x381332['push'](_0x381332['shift']());}};_0x4846e1(++_0x5a8b6c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xcd59[_0x214266];return _0x568f75;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0xa')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller['show']);router[_0x9cd5('0xe')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0x10')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x11')]);router[_0x9cd5('0x12')]('/:id',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x13')]);module[_0x9cd5('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6112757..170a90f 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 _0x79be=['sequelize','exports'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x79be,0x190));var _0xe79b=function(_0x15f77d,_0x3a2826){_0x15f77d=_0x15f77d-0x0;var _0x4e3c38=_0x79be[_0x15f77d];return _0x4e3c38;};'use strict';var Sequelize=require(_0xe79b('0x0'));module[_0xe79b('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x6f93=['sequelize','exports','TEXT'];(function(_0x32bf8b,_0x2ac32b){var _0x1e5ef5=function(_0x36acec){while(--_0x36acec){_0x32bf8b['push'](_0x32bf8b['shift']());}};_0x1e5ef5(++_0x2ac32b);}(_0x6f93,0x1ef));var _0x36f9=function(_0x52be16,_0x4be7bf){_0x52be16=_0x52be16-0x0;var _0x56e3ac=_0x6f93[_0x52be16];return _0x56e3ac;};'use strict';var Sequelize=require(_0x36f9('0x0'));module[_0x36f9('0x1')]={'tree':{'type':Sequelize[_0x36f9('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 a9b5ce2..ab3e1d6 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 _0xc955=['set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','AnalyticTreeReport','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','rawAttributes','length','includeAll','find','catch','create','body','moment','bluebird','mustache','util','path','ejs','squel','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'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xc955,0x14c));var _0x5c95=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xc955[_0x40bffc];return _0x3007e9;};'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(_0x5c95('0x0'));var BPromise=require(_0x5c95('0x1'));var Mustache=require(_0x5c95('0x2'));var util=require(_0x5c95('0x3'));var path=require(_0x5c95('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c95('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5c95('0x6'));var crypto=require('crypto');var jsforce=require(_0x5c95('0x7'));var deskjs=require(_0x5c95('0x8'));var toCsv=require(_0x5c95('0x9'));var querystring=require('querystring');var Papa=require(_0x5c95('0xa'));var Redis=require(_0x5c95('0xb'));var authService=require(_0x5c95('0xc'));var qs=require(_0x5c95('0xd'));var as=require(_0x5c95('0xe'));var hardwareService=require(_0x5c95('0xf'));var logger=require('../../config/logger')(_0x5c95('0x10'));var utils=require(_0x5c95('0x11'));var config=require(_0x5c95('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c95('0x13'))['db'];function respondWithStatusCode(_0x53dbb3,_0x2e20b6){_0x2e20b6=_0x2e20b6||0xcc;return function(_0x14eda9){if(_0x14eda9){return _0x53dbb3[_0x5c95('0x14')](_0x2e20b6);}return _0x53dbb3[_0x5c95('0x15')](_0x2e20b6)[_0x5c95('0x16')]();};}function respondWithResult(_0x553d2e,_0x5e0423){_0x5e0423=_0x5e0423||0xc8;return function(_0x346911){if(_0x346911){return _0x553d2e[_0x5c95('0x15')](_0x5e0423)[_0x5c95('0x17')](_0x346911);}};}function respondWithFilteredResult(_0x4a541e,_0x901798){return function(_0x3e035a){if(_0x3e035a){var _0x27a0ea=typeof _0x901798['offset']===_0x5c95('0x18')&&typeof _0x901798['limit']===_0x5c95('0x18');var _0x4be7e0=_0x3e035a[_0x5c95('0x19')];var _0x5104ac=_0x27a0ea?0x0:_0x901798[_0x5c95('0x1a')];var _0x1d6e63=_0x27a0ea?_0x3e035a['count']:_0x901798[_0x5c95('0x1a')]+_0x901798[_0x5c95('0x1b')];var _0x5d1899;if(_0x1d6e63>=_0x4be7e0){_0x1d6e63=_0x4be7e0;_0x5d1899=0xc8;}else{_0x5d1899=0xce;}_0x4a541e['status'](_0x5d1899);return _0x4a541e[_0x5c95('0x1c')](_0x5c95('0x1d'),_0x5104ac+'-'+_0x1d6e63+'/'+_0x4be7e0)[_0x5c95('0x17')](_0x3e035a);}return null;};}function patchUpdates(_0x308bab){return function(_0x23923f){try{jsonpatch[_0x5c95('0x1e')](_0x23923f,_0x308bab,!![]);}catch(_0x1753bf){return BPromise['reject'](_0x1753bf);}return _0x23923f['save']();};}function saveUpdates(_0x5c4882,_0x1b9e02){return function(_0x117b3d){if(_0x117b3d){return _0x117b3d[_0x5c95('0x1f')](_0x5c4882)[_0x5c95('0x20')](function(_0x40c830){return _0x40c830;});}return null;};}function removeEntity(_0x3831c5,_0x4a6206){return function(_0x54d768){if(_0x54d768){return _0x54d768[_0x5c95('0x21')]()['then'](function(){_0x3831c5['status'](0xcc)[_0x5c95('0x16')]();});}};}function handleEntityNotFound(_0x561e8d,_0x3cf24c){return function(_0x5bd750){if(!_0x5bd750){_0x561e8d[_0x5c95('0x14')](0x194);}return _0x5bd750;};}function handleError(_0xb4575,_0x193654){_0x193654=_0x193654||0x1f4;return function(_0xe88943){logger[_0x5c95('0x22')](_0xe88943[_0x5c95('0x23')]);if(_0xe88943['name']){delete _0xe88943[_0x5c95('0x24')];}_0xb4575[_0x5c95('0x15')](_0x193654)[_0x5c95('0x25')](_0xe88943);};}exports['index']=function(_0x192a1e,_0x30c410){var _0x36fcb4={},_0x439bfe={},_0x2ac31d={'count':0x0,'rows':[]};var _0x203305=_[_0x5c95('0x26')](db[_0x5c95('0x27')]['rawAttributes'],function(_0x1a92aa){return{'name':_0x1a92aa[_0x5c95('0x28')],'type':_0x1a92aa[_0x5c95('0x29')][_0x5c95('0x2a')]};});_0x439bfe[_0x5c95('0x2b')]=_['map'](_0x203305,_0x5c95('0x24'));_0x439bfe[_0x5c95('0x2c')]=_['keys'](_0x192a1e[_0x5c95('0x2c')]);_0x439bfe['filters']=_[_0x5c95('0x2d')](_0x439bfe[_0x5c95('0x2b')],_0x439bfe[_0x5c95('0x2c')]);_0x36fcb4[_0x5c95('0x2e')]=_[_0x5c95('0x2d')](_0x439bfe[_0x5c95('0x2b')],qs[_0x5c95('0x2f')](_0x192a1e[_0x5c95('0x2c')][_0x5c95('0x2f')]));_0x36fcb4[_0x5c95('0x2e')]=_0x36fcb4['attributes']['length']?_0x36fcb4['attributes']:_0x439bfe[_0x5c95('0x2b')];if(!_0x192a1e['query'][_0x5c95('0x30')](_0x5c95('0x31'))){_0x36fcb4['limit']=qs[_0x5c95('0x1b')](_0x192a1e[_0x5c95('0x2c')][_0x5c95('0x1b')]);_0x36fcb4[_0x5c95('0x1a')]=qs[_0x5c95('0x1a')](_0x192a1e[_0x5c95('0x2c')][_0x5c95('0x1a')]);}_0x36fcb4[_0x5c95('0x32')]=qs[_0x5c95('0x33')](_0x192a1e['query']['sort']);_0x36fcb4[_0x5c95('0x34')]=qs[_0x5c95('0x35')](_[_0x5c95('0x36')](_0x192a1e[_0x5c95('0x2c')],_0x439bfe[_0x5c95('0x35')]),_0x203305);if(_0x192a1e[_0x5c95('0x2c')][_0x5c95('0x37')]){_0x36fcb4[_0x5c95('0x34')]=_[_0x5c95('0x38')](_0x36fcb4[_0x5c95('0x34')],{'$or':_['map'](_0x203305,function(_0x4f0af8){if(_0x4f0af8[_0x5c95('0x29')]!==_0x5c95('0x39')){var _0x3fd330={};_0x3fd330[_0x4f0af8[_0x5c95('0x24')]]={'$like':'%'+_0x192a1e[_0x5c95('0x2c')][_0x5c95('0x37')]+'%'};return _0x3fd330;}})});}_0x36fcb4=_['merge']({},_0x36fcb4,_0x192a1e[_0x5c95('0x3a')]);var _0x210ec8={'where':_0x36fcb4[_0x5c95('0x34')]};return db[_0x5c95('0x27')][_0x5c95('0x19')](_0x210ec8)[_0x5c95('0x20')](function(_0x53d9a2){_0x2ac31d[_0x5c95('0x19')]=_0x53d9a2;if(_0x192a1e[_0x5c95('0x2c')]['includeAll']){_0x36fcb4[_0x5c95('0x3b')]=[{'all':!![]}];}return db[_0x5c95('0x27')][_0x5c95('0x3c')](_0x36fcb4);})[_0x5c95('0x20')](function(_0x479051){_0x2ac31d[_0x5c95('0x3d')]=_0x479051;return _0x2ac31d;})['then'](respondWithFilteredResult(_0x30c410,_0x36fcb4))['catch'](handleError(_0x30c410,null));};exports[_0x5c95('0x3e')]=function(_0x45351b,_0x32e348){var _0x354421={'raw':!![],'where':{'id':_0x45351b[_0x5c95('0x3f')]['id']}},_0x6fe09f={};_0x6fe09f[_0x5c95('0x2b')]=_[_0x5c95('0x40')](db['AnalyticTreeReport'][_0x5c95('0x41')]);_0x6fe09f[_0x5c95('0x2c')]=_[_0x5c95('0x40')](_0x45351b['query']);_0x6fe09f['filters']=_[_0x5c95('0x2d')](_0x6fe09f['model'],_0x6fe09f[_0x5c95('0x2c')]);_0x354421[_0x5c95('0x2e')]=_['intersection'](_0x6fe09f[_0x5c95('0x2b')],qs[_0x5c95('0x2f')](_0x45351b['query']['fields']));_0x354421[_0x5c95('0x2e')]=_0x354421[_0x5c95('0x2e')][_0x5c95('0x42')]?_0x354421['attributes']:_0x6fe09f[_0x5c95('0x2b')];if(_0x45351b[_0x5c95('0x2c')][_0x5c95('0x43')]){_0x354421['include']=[{'all':!![]}];}_0x354421=_[_0x5c95('0x38')]({},_0x354421,_0x45351b[_0x5c95('0x3a')]);return db[_0x5c95('0x27')][_0x5c95('0x44')](_0x354421)[_0x5c95('0x20')](handleEntityNotFound(_0x32e348,null))[_0x5c95('0x20')](respondWithResult(_0x32e348,null))[_0x5c95('0x45')](handleError(_0x32e348,null));};exports[_0x5c95('0x46')]=function(_0x4b2580,_0xea80e2){return db[_0x5c95('0x27')][_0x5c95('0x46')](_0x4b2580[_0x5c95('0x47')],{})[_0x5c95('0x20')](respondWithResult(_0xea80e2,0xc9))[_0x5c95('0x45')](handleError(_0xea80e2,null));};exports[_0x5c95('0x1f')]=function(_0x49ab79,_0x2adb74){if(_0x49ab79[_0x5c95('0x47')]['id']){delete _0x49ab79['body']['id'];}return db[_0x5c95('0x27')][_0x5c95('0x44')]({'where':{'id':_0x49ab79[_0x5c95('0x3f')]['id']}})[_0x5c95('0x20')](handleEntityNotFound(_0x2adb74,null))[_0x5c95('0x20')](saveUpdates(_0x49ab79['body'],null))[_0x5c95('0x20')](respondWithResult(_0x2adb74,null))[_0x5c95('0x45')](handleError(_0x2adb74,null));};exports[_0x5c95('0x21')]=function(_0x5e4086,_0x4871e6){return db[_0x5c95('0x27')][_0x5c95('0x44')]({'where':{'id':_0x5e4086['params']['id']}})[_0x5c95('0x20')](handleEntityNotFound(_0x4871e6,null))[_0x5c95('0x20')](removeEntity(_0x4871e6,null))[_0x5c95('0x45')](handleError(_0x4871e6,null));}; \ No newline at end of file +var _0x193d=['findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x481e02,_0x3c99bb){var _0x10445d=function(_0x218071){while(--_0x218071){_0x481e02['push'](_0x481e02['shift']());}};_0x10445d(++_0x3c99bb);}(_0x193d,0xed));var _0xd193=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x193d[_0x55821d];return _0x58ea8a;};'use strict';var emlformat=require(_0xd193('0x0'));var rimraf=require(_0xd193('0x1'));var zipdir=require(_0xd193('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd193('0x3'));var moment=require(_0xd193('0x4'));var BPromise=require(_0xd193('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd193('0x6'));var sox=require(_0xd193('0x7'));var csv=require(_0xd193('0x8'));var ejs=require(_0xd193('0x9'));var fs=require('fs');var fs_extra=require(_0xd193('0xa'));var _=require(_0xd193('0xb'));var squel=require('squel');var crypto=require(_0xd193('0xc'));var jsforce=require(_0xd193('0xd'));var deskjs=require(_0xd193('0xe'));var toCsv=require(_0xd193('0x8'));var querystring=require('querystring');var Papa=require(_0xd193('0xf'));var Redis=require(_0xd193('0x10'));var authService=require(_0xd193('0x11'));var qs=require(_0xd193('0x12'));var as=require(_0xd193('0x13'));var hardwareService=require(_0xd193('0x14'));var logger=require(_0xd193('0x15'))(_0xd193('0x16'));var utils=require('../../config/utils');var config=require(_0xd193('0x17'));var licenseUtil=require(_0xd193('0x18'));var db=require(_0xd193('0x19'))['db'];function respondWithStatusCode(_0x39cee1,_0x297a7a){_0x297a7a=_0x297a7a||0xcc;return function(_0x1708a7){if(_0x1708a7){return _0x39cee1['sendStatus'](_0x297a7a);}return _0x39cee1[_0xd193('0x1a')](_0x297a7a)[_0xd193('0x1b')]();};}function respondWithResult(_0x33b518,_0x5c9135){_0x5c9135=_0x5c9135||0xc8;return function(_0x5970e6){if(_0x5970e6){return _0x33b518[_0xd193('0x1a')](_0x5c9135)[_0xd193('0x1c')](_0x5970e6);}};}function respondWithFilteredResult(_0x58d385,_0x2efe22){return function(_0x2cf664){if(_0x2cf664){var _0x3eecdd=typeof _0x2efe22[_0xd193('0x1d')]===_0xd193('0x1e')&&typeof _0x2efe22[_0xd193('0x1f')]===_0xd193('0x1e');var _0xb2311d=_0x2cf664[_0xd193('0x20')];var _0x5a4ce4=_0x3eecdd?0x0:_0x2efe22[_0xd193('0x1d')];var _0x4cfc0a=_0x3eecdd?_0x2cf664[_0xd193('0x20')]:_0x2efe22[_0xd193('0x1d')]+_0x2efe22['limit'];var _0x276155;if(_0x4cfc0a>=_0xb2311d){_0x4cfc0a=_0xb2311d;_0x276155=0xc8;}else{_0x276155=0xce;}_0x58d385[_0xd193('0x1a')](_0x276155);return _0x58d385[_0xd193('0x21')]('Content-Range',_0x5a4ce4+'-'+_0x4cfc0a+'/'+_0xb2311d)['json'](_0x2cf664);}return null;};}function patchUpdates(_0x3856e7){return function(_0x724308){try{jsonpatch[_0xd193('0x22')](_0x724308,_0x3856e7,!![]);}catch(_0x16071a){return BPromise[_0xd193('0x23')](_0x16071a);}return _0x724308[_0xd193('0x24')]();};}function saveUpdates(_0x528a13,_0x16070c){return function(_0x65a887){if(_0x65a887){return _0x65a887[_0xd193('0x25')](_0x528a13)[_0xd193('0x26')](function(_0x560376){return _0x560376;});}return null;};}function removeEntity(_0x17b746,_0x3b90a4){return function(_0x4ff4de){if(_0x4ff4de){return _0x4ff4de[_0xd193('0x27')]()[_0xd193('0x26')](function(){_0x17b746[_0xd193('0x1a')](0xcc)[_0xd193('0x1b')]();});}};}function handleEntityNotFound(_0x5ac428,_0x121985){return function(_0x530f12){if(!_0x530f12){_0x5ac428['sendStatus'](0x194);}return _0x530f12;};}function handleError(_0x4c7166,_0x42c096){_0x42c096=_0x42c096||0x1f4;return function(_0x5ed7c3){logger[_0xd193('0x28')](_0x5ed7c3['stack']);if(_0x5ed7c3[_0xd193('0x29')]){delete _0x5ed7c3[_0xd193('0x29')];}_0x4c7166[_0xd193('0x1a')](_0x42c096)[_0xd193('0x2a')](_0x5ed7c3);};}exports['index']=function(_0x4d344a,_0x308e84){var _0x4cc4af={},_0x55f16a={},_0x1e0769={'count':0x0,'rows':[]};var _0x46eead=_[_0xd193('0x2b')](db[_0xd193('0x2c')][_0xd193('0x2d')],function(_0xd81afe){return{'name':_0xd81afe[_0xd193('0x2e')],'type':_0xd81afe[_0xd193('0x2f')][_0xd193('0x30')]};});_0x55f16a[_0xd193('0x31')]=_[_0xd193('0x2b')](_0x46eead,_0xd193('0x29'));_0x55f16a[_0xd193('0x32')]=_[_0xd193('0x33')](_0x4d344a[_0xd193('0x32')]);_0x55f16a[_0xd193('0x34')]=_[_0xd193('0x35')](_0x55f16a[_0xd193('0x31')],_0x55f16a[_0xd193('0x32')]);_0x4cc4af[_0xd193('0x36')]=_[_0xd193('0x35')](_0x55f16a[_0xd193('0x31')],qs['fields'](_0x4d344a[_0xd193('0x32')][_0xd193('0x37')]));_0x4cc4af['attributes']=_0x4cc4af[_0xd193('0x36')][_0xd193('0x38')]?_0x4cc4af[_0xd193('0x36')]:_0x55f16a[_0xd193('0x31')];if(!_0x4d344a[_0xd193('0x32')][_0xd193('0x39')](_0xd193('0x3a'))){_0x4cc4af[_0xd193('0x1f')]=qs['limit'](_0x4d344a['query'][_0xd193('0x1f')]);_0x4cc4af['offset']=qs['offset'](_0x4d344a['query'][_0xd193('0x1d')]);}_0x4cc4af[_0xd193('0x3b')]=qs[_0xd193('0x3c')](_0x4d344a[_0xd193('0x32')]['sort']);_0x4cc4af[_0xd193('0x3d')]=qs['filters'](_['pick'](_0x4d344a[_0xd193('0x32')],_0x55f16a[_0xd193('0x34')]),_0x46eead);if(_0x4d344a[_0xd193('0x32')]['filter']){_0x4cc4af[_0xd193('0x3d')]=_[_0xd193('0x3e')](_0x4cc4af['where'],{'$or':_['map'](_0x46eead,function(_0x37fcf0){if(_0x37fcf0['type']!==_0xd193('0x3f')){var _0x1c8f54={};_0x1c8f54[_0x37fcf0[_0xd193('0x29')]]={'$like':'%'+_0x4d344a[_0xd193('0x32')][_0xd193('0x40')]+'%'};return _0x1c8f54;}})});}_0x4cc4af=_[_0xd193('0x3e')]({},_0x4cc4af,_0x4d344a[_0xd193('0x41')]);var _0x2fca26={'where':_0x4cc4af[_0xd193('0x3d')]};return db['AnalyticTreeReport'][_0xd193('0x20')](_0x2fca26)['then'](function(_0x23c6b9){_0x1e0769[_0xd193('0x20')]=_0x23c6b9;if(_0x4d344a['query'][_0xd193('0x42')]){_0x4cc4af['include']=[{'all':!![]}];}return db[_0xd193('0x2c')][_0xd193('0x43')](_0x4cc4af);})[_0xd193('0x26')](function(_0x1773d9){_0x1e0769[_0xd193('0x44')]=_0x1773d9;return _0x1e0769;})[_0xd193('0x26')](respondWithFilteredResult(_0x308e84,_0x4cc4af))[_0xd193('0x45')](handleError(_0x308e84,null));};exports[_0xd193('0x46')]=function(_0x4914df,_0x3b13ab){var _0x110c48={'raw':!![],'where':{'id':_0x4914df[_0xd193('0x47')]['id']}},_0x5cda81={};_0x5cda81[_0xd193('0x31')]=_[_0xd193('0x33')](db['AnalyticTreeReport'][_0xd193('0x2d')]);_0x5cda81['query']=_['keys'](_0x4914df[_0xd193('0x32')]);_0x5cda81[_0xd193('0x34')]=_[_0xd193('0x35')](_0x5cda81['model'],_0x5cda81[_0xd193('0x32')]);_0x110c48[_0xd193('0x36')]=_[_0xd193('0x35')](_0x5cda81[_0xd193('0x31')],qs[_0xd193('0x37')](_0x4914df[_0xd193('0x32')][_0xd193('0x37')]));_0x110c48[_0xd193('0x36')]=_0x110c48['attributes'][_0xd193('0x38')]?_0x110c48['attributes']:_0x5cda81[_0xd193('0x31')];if(_0x4914df[_0xd193('0x32')]['includeAll']){_0x110c48[_0xd193('0x48')]=[{'all':!![]}];}_0x110c48=_['merge']({},_0x110c48,_0x4914df[_0xd193('0x41')]);return db['AnalyticTreeReport'][_0xd193('0x49')](_0x110c48)[_0xd193('0x26')](handleEntityNotFound(_0x3b13ab,null))['then'](respondWithResult(_0x3b13ab,null))[_0xd193('0x45')](handleError(_0x3b13ab,null));};exports[_0xd193('0x4a')]=function(_0x1a46b1,_0xdc9c2f){return db['AnalyticTreeReport'][_0xd193('0x4a')](_0x1a46b1[_0xd193('0x4b')],{})[_0xd193('0x26')](respondWithResult(_0xdc9c2f,0xc9))[_0xd193('0x45')](handleError(_0xdc9c2f,null));};exports[_0xd193('0x25')]=function(_0x20bd64,_0x4c7766){if(_0x20bd64['body']['id']){delete _0x20bd64[_0xd193('0x4b')]['id'];}return db[_0xd193('0x2c')][_0xd193('0x49')]({'where':{'id':_0x20bd64[_0xd193('0x47')]['id']}})[_0xd193('0x26')](handleEntityNotFound(_0x4c7766,null))[_0xd193('0x26')](saveUpdates(_0x20bd64[_0xd193('0x4b')],null))[_0xd193('0x26')](respondWithResult(_0x4c7766,null))['catch'](handleError(_0x4c7766,null));};exports[_0xd193('0x27')]=function(_0x2b4a62,_0x5ade38){return db[_0xd193('0x2c')]['find']({'where':{'id':_0x2b4a62[_0xd193('0x47')]['id']}})[_0xd193('0x26')](handleEntityNotFound(_0x5ade38,null))['then'](removeEntity(_0x5ade38,null))[_0xd193('0x45')](handleError(_0x5ade38,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 46d417b..8a7bff4 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 _0x4d26=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc4e62c,_0x5b226e){var _0x44c950=function(_0x3c1298){while(--_0x3c1298){_0xc4e62c['push'](_0xc4e62c['shift']());}};_0x44c950(++_0x5b226e);}(_0x4d26,0xf4));var _0x64d2=function(_0xd49063,_0x592fcd){_0xd49063=_0xd49063-0x0;var _0x1fdde2=_0x4d26[_0xd49063];return _0x1fdde2;};'use strict';var _=require(_0x64d2('0x0'));var util=require(_0x64d2('0x1'));var logger=require('../../config/logger')(_0x64d2('0x2'));var moment=require(_0x64d2('0x3'));var BPromise=require(_0x64d2('0x4'));var rp=require(_0x64d2('0x5'));var fs=require('fs');var path=require(_0x64d2('0x6'));var rimraf=require(_0x64d2('0x7'));var config=require(_0x64d2('0x8'));var attributes=require(_0x64d2('0x9'));module[_0x64d2('0xa')]=function(_0x542fa9,_0x212ac9){return _0x542fa9[_0x64d2('0xb')](_0x64d2('0xc'),attributes,{'tableName':_0x64d2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0933=['exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./analyticTreeReport.attributes'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x0933,0x1b0));var _0x3093=function(_0x5f4c21,_0x38ac14){_0x5f4c21=_0x5f4c21-0x0;var _0x4fc10a=_0x0933[_0x5f4c21];return _0x4fc10a;};'use strict';var _=require(_0x3093('0x0'));var util=require('util');var logger=require(_0x3093('0x1'))(_0x3093('0x2'));var moment=require(_0x3093('0x3'));var BPromise=require(_0x3093('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3093('0x5'));var rimraf=require(_0x3093('0x6'));var config=require('../../config/environment');var attributes=require(_0x3093('0x7'));module[_0x3093('0x8')]=function(_0x406415,_0x2051ab){return _0x406415['define'](_0x3093('0x9'),attributes,{'tableName':_0x3093('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 417d8ac..962f64a 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1aca11,_0x20bb17){var _0x4af3d7=function(_0x32b350){while(--_0x32b350){_0x1aca11['push'](_0x1aca11['shift']());}};_0x4af3d7(++_0x20bb17);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1ea520,_0x1a98e9){var _0x58455c=function(_0x48d933){while(--_0x48d933){_0x1ea520['push'](_0x1ea520['shift']());}};_0x58455c(++_0x1a98e9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'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')]('AnalyticTreeReport,\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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 18e578c..6921870 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 _0x5427=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','put','destroy'];(function(_0x447ee6,_0x177277){var _0x4d8645=function(_0x510de5){while(--_0x510de5){_0x447ee6['push'](_0x447ee6['shift']());}};_0x4d8645(++_0x177277);}(_0x5427,0x140));var _0x7542=function(_0x2dcf78,_0x166ee4){_0x2dcf78=_0x2dcf78-0x0;var _0xa84d8=_0x5427[_0x2dcf78];return _0xa84d8;};'use strict';var multer=require('multer');var util=require(_0x7542('0x0'));var path=require(_0x7542('0x1'));var timeout=require(_0x7542('0x2'));var express=require(_0x7542('0x3'));var router=express[_0x7542('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7542('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7542('0x6'));var controller=require(_0x7542('0x7'));router[_0x7542('0x8')]('/',auth[_0x7542('0x9')](),controller[_0x7542('0xa')]);router['get'](_0x7542('0xb'),auth[_0x7542('0x9')](),controller[_0x7542('0xc')]);router[_0x7542('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7542('0xe')](_0x7542('0xb'),auth[_0x7542('0x9')](),controller['update']);router['delete'](_0x7542('0xb'),auth[_0x7542('0x9')](),controller[_0x7542('0xf')]);module['exports']=router; \ No newline at end of file +var _0x885d=['isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x885d,0xd9));var _0xd885=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x885d[_0x2ca616];return _0x53155f;};'use strict';var multer=require(_0xd885('0x0'));var util=require(_0xd885('0x1'));var path=require(_0xd885('0x2'));var timeout=require(_0xd885('0x3'));var express=require(_0xd885('0x4'));var router=express[_0xd885('0x5')]();var fs_extra=require(_0xd885('0x6'));var auth=require(_0xd885('0x7'));var interaction=require(_0xd885('0x8'));var config=require(_0xd885('0x9'));var controller=require('./analyticTreeReport.controller');router[_0xd885('0xa')]('/',auth[_0xd885('0xb')](),controller[_0xd885('0xc')]);router[_0xd885('0xa')](_0xd885('0xd'),auth['isAuthenticated'](),controller[_0xd885('0xe')]);router['post']('/',auth[_0xd885('0xb')](),controller['create']);router['put'](_0xd885('0xd'),auth[_0xd885('0xb')](),controller[_0xd885('0xf')]);router[_0xd885('0x10')](_0xd885('0xd'),auth[_0xd885('0xb')](),controller[_0xd885('0x11')]);module[_0xd885('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 195ff2e..f648c62 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 _0xf53f=['sequelize','exports','STRING'];(function(_0x206bea,_0x8c86c4){var _0x57e4e7=function(_0x4b6ff1){while(--_0x4b6ff1){_0x206bea['push'](_0x206bea['shift']());}};_0x57e4e7(++_0x8c86c4);}(_0xf53f,0x8d));var _0xff53=function(_0x57113b,_0x52d6ff){_0x57113b=_0x57113b-0x0;var _0x1ed012=_0xf53f[_0x57113b];return _0x1ed012;};'use strict';var Sequelize=require(_0xff53('0x0'));module[_0xff53('0x1')]={'name':{'type':Sequelize[_0xff53('0x2')]},'basename':{'type':Sequelize[_0xff53('0x2')]},'type':{'type':Sequelize[_0xff53('0x2')]}}; \ No newline at end of file +var _0x03bc=['sequelize','STRING'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x03bc,0xb8));var _0xc03b=function(_0x29cdb8,_0x33a9d6){_0x29cdb8=_0x29cdb8-0x0;var _0x42f164=_0x03bc[_0x29cdb8];return _0x42f164;};'use strict';var Sequelize=require(_0xc03b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc03b('0x1')]},'basename':{'type':Sequelize[_0xc03b('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 7ebb27f..544a618 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 _0x33c1=['stack','name','send','index','map','Attachment','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','rawAttributes','find','clone','get','omit','createdAt','body','updatedAt','create','originalname','basename','file','filename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','sendStatus','error'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x33c1,0x142));var _0x133c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33c1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x133c('0x0'));var rimraf=require(_0x133c('0x1'));var zipdir=require(_0x133c('0x2'));var jsonpatch=require(_0x133c('0x3'));var rp=require(_0x133c('0x4'));var moment=require(_0x133c('0x5'));var BPromise=require(_0x133c('0x6'));var Mustache=require(_0x133c('0x7'));var util=require('util');var path=require(_0x133c('0x8'));var sox=require(_0x133c('0x9'));var csv=require(_0x133c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x133c('0xb'));var crypto=require(_0x133c('0xc'));var jsforce=require(_0x133c('0xd'));var deskjs=require(_0x133c('0xe'));var toCsv=require(_0x133c('0xa'));var querystring=require('querystring');var Papa=require(_0x133c('0xf'));var Redis=require('ioredis');var authService=require(_0x133c('0x10'));var qs=require(_0x133c('0x11'));var as=require(_0x133c('0x12'));var hardwareService=require(_0x133c('0x13'));var logger=require(_0x133c('0x14'))(_0x133c('0x15'));var utils=require(_0x133c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x133c('0x17'))['db'];function respondWithStatusCode(_0x3ec965,_0x47d43c){_0x47d43c=_0x47d43c||0xcc;return function(_0xb8044a){if(_0xb8044a){return _0x3ec965['sendStatus'](_0x47d43c);}return _0x3ec965[_0x133c('0x18')](_0x47d43c)[_0x133c('0x19')]();};}function respondWithResult(_0x33d05d,_0x111bcd){_0x111bcd=_0x111bcd||0xc8;return function(_0x2fc934){if(_0x2fc934){return _0x33d05d['status'](_0x111bcd)[_0x133c('0x1a')](_0x2fc934);}};}function respondWithFilteredResult(_0x5bbeda,_0xaae702){return function(_0x7d2b9d){if(_0x7d2b9d){var _0x2a7b5a=typeof _0xaae702[_0x133c('0x1b')]===_0x133c('0x1c')&&typeof _0xaae702['limit']===_0x133c('0x1c');var _0x5236bb=_0x7d2b9d['count'];var _0x412217=_0x2a7b5a?0x0:_0xaae702[_0x133c('0x1b')];var _0x15b629=_0x2a7b5a?_0x7d2b9d[_0x133c('0x1d')]:_0xaae702[_0x133c('0x1b')]+_0xaae702['limit'];var _0x31c251;if(_0x15b629>=_0x5236bb){_0x15b629=_0x5236bb;_0x31c251=0xc8;}else{_0x31c251=0xce;}_0x5bbeda['status'](_0x31c251);return _0x5bbeda['set'](_0x133c('0x1e'),_0x412217+'-'+_0x15b629+'/'+_0x5236bb)['json'](_0x7d2b9d);}return null;};}function patchUpdates(_0x36ee7e){return function(_0x419dac){try{jsonpatch[_0x133c('0x1f')](_0x419dac,_0x36ee7e,!![]);}catch(_0x823720){return BPromise['reject'](_0x823720);}return _0x419dac[_0x133c('0x20')]();};}function saveUpdates(_0x3c57ac,_0x4084be){return function(_0x5c3400){if(_0x5c3400){return _0x5c3400[_0x133c('0x21')](_0x3c57ac)[_0x133c('0x22')](function(_0x416562){return _0x416562;});}return null;};}function removeEntity(_0x1dae9e,_0x350c58){return function(_0x5c4542){if(_0x5c4542){return _0x5c4542[_0x133c('0x23')]()[_0x133c('0x22')](function(){_0x1dae9e[_0x133c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c8c0,_0x431bb3){return function(_0x298fdb){if(!_0x298fdb){_0x43c8c0[_0x133c('0x24')](0x194);}return _0x298fdb;};}function handleError(_0x4e3dce,_0x1ec69){_0x1ec69=_0x1ec69||0x1f4;return function(_0x235b10){logger[_0x133c('0x25')](_0x235b10[_0x133c('0x26')]);if(_0x235b10[_0x133c('0x27')]){delete _0x235b10[_0x133c('0x27')];}_0x4e3dce[_0x133c('0x18')](_0x1ec69)[_0x133c('0x28')](_0x235b10);};}exports[_0x133c('0x29')]=function(_0xfcb5de,_0x49799e){var _0x23117e={},_0x1c082e={},_0x56feb9={'count':0x0,'rows':[]};var _0x4433fd=_[_0x133c('0x2a')](db[_0x133c('0x2b')]['rawAttributes'],function(_0x1aa26a){return{'name':_0x1aa26a[_0x133c('0x2c')],'type':_0x1aa26a[_0x133c('0x2d')][_0x133c('0x2e')]};});_0x1c082e[_0x133c('0x2f')]=_[_0x133c('0x2a')](_0x4433fd,_0x133c('0x27'));_0x1c082e[_0x133c('0x30')]=_[_0x133c('0x31')](_0xfcb5de['query']);_0x1c082e[_0x133c('0x32')]=_[_0x133c('0x33')](_0x1c082e[_0x133c('0x2f')],_0x1c082e[_0x133c('0x30')]);_0x23117e[_0x133c('0x34')]=_[_0x133c('0x33')](_0x1c082e['model'],qs[_0x133c('0x35')](_0xfcb5de[_0x133c('0x30')][_0x133c('0x35')]));_0x23117e['attributes']=_0x23117e['attributes'][_0x133c('0x36')]?_0x23117e[_0x133c('0x34')]:_0x1c082e[_0x133c('0x2f')];if(!_0xfcb5de[_0x133c('0x30')][_0x133c('0x37')](_0x133c('0x38'))){_0x23117e[_0x133c('0x39')]=qs[_0x133c('0x39')](_0xfcb5de['query'][_0x133c('0x39')]);_0x23117e['offset']=qs[_0x133c('0x1b')](_0xfcb5de['query'][_0x133c('0x1b')]);}_0x23117e[_0x133c('0x3a')]=qs[_0x133c('0x3b')](_0xfcb5de['query'][_0x133c('0x3b')]);_0x23117e[_0x133c('0x3c')]=qs[_0x133c('0x32')](_[_0x133c('0x3d')](_0xfcb5de[_0x133c('0x30')],_0x1c082e[_0x133c('0x32')]),_0x4433fd);if(_0xfcb5de[_0x133c('0x30')]['filter']){_0x23117e[_0x133c('0x3c')]=_[_0x133c('0x3e')](_0x23117e[_0x133c('0x3c')],{'$or':_[_0x133c('0x2a')](_0x4433fd,function(_0x2c5768){if(_0x2c5768['type']!=='VIRTUAL'){var _0x474224={};_0x474224[_0x2c5768[_0x133c('0x27')]]={'$like':'%'+_0xfcb5de[_0x133c('0x30')][_0x133c('0x3f')]+'%'};return _0x474224;}})});}_0x23117e=_[_0x133c('0x3e')]({},_0x23117e,_0xfcb5de[_0x133c('0x40')]);var _0x37e9cc={'where':_0x23117e[_0x133c('0x3c')]};return db[_0x133c('0x2b')][_0x133c('0x1d')](_0x37e9cc)[_0x133c('0x22')](function(_0x22fc6d){_0x56feb9[_0x133c('0x1d')]=_0x22fc6d;if(_0xfcb5de[_0x133c('0x30')][_0x133c('0x41')]){_0x23117e[_0x133c('0x42')]=[{'all':!![]}];}return db[_0x133c('0x2b')][_0x133c('0x43')](_0x23117e);})[_0x133c('0x22')](function(_0x4d2485){_0x56feb9['rows']=_0x4d2485;return _0x56feb9;})[_0x133c('0x22')](respondWithFilteredResult(_0x49799e,_0x23117e))[_0x133c('0x44')](handleError(_0x49799e,null));};exports['show']=function(_0x9d3048,_0x47c7eb){var _0x58d44c={'raw':!![],'where':{'id':_0x9d3048[_0x133c('0x45')]['id']}},_0x130609={};_0x130609[_0x133c('0x2f')]=_[_0x133c('0x31')](db['Attachment'][_0x133c('0x46')]);_0x130609[_0x133c('0x30')]=_['keys'](_0x9d3048[_0x133c('0x30')]);_0x130609['filters']=_[_0x133c('0x33')](_0x130609[_0x133c('0x2f')],_0x130609['query']);_0x58d44c[_0x133c('0x34')]=_[_0x133c('0x33')](_0x130609[_0x133c('0x2f')],qs['fields'](_0x9d3048[_0x133c('0x30')][_0x133c('0x35')]));_0x58d44c[_0x133c('0x34')]=_0x58d44c['attributes'][_0x133c('0x36')]?_0x58d44c[_0x133c('0x34')]:_0x130609[_0x133c('0x2f')];if(_0x9d3048[_0x133c('0x30')][_0x133c('0x41')]){_0x58d44c[_0x133c('0x42')]=[{'all':!![]}];}_0x58d44c=_[_0x133c('0x3e')]({},_0x58d44c,_0x9d3048[_0x133c('0x40')]);return db[_0x133c('0x2b')][_0x133c('0x47')](_0x58d44c)[_0x133c('0x22')](handleEntityNotFound(_0x47c7eb,null))['then'](respondWithResult(_0x47c7eb,null))[_0x133c('0x44')](handleError(_0x47c7eb,null));};exports[_0x133c('0x48')]=function(_0x288dfe,_0x7ffbe5){var _0x21eb69={'where':{'id':_0x288dfe[_0x133c('0x45')]['id']}},_0x181f54={};_0x181f54[_0x133c('0x2f')]=_[_0x133c('0x31')](db['Attachment'][_0x133c('0x46')]);_0x21eb69[_0x133c('0x34')]=_[_0x133c('0x33')](_0x181f54[_0x133c('0x2f')],qs[_0x133c('0x35')](_0x288dfe[_0x133c('0x30')][_0x133c('0x35')]));_0x21eb69['attributes']=_0x21eb69['attributes']['length']?_0x21eb69[_0x133c('0x34')]:_0x181f54['model'];if(_0x288dfe[_0x133c('0x30')][_0x133c('0x41')]){_0x21eb69['include']=[{'all':!![]}];}_0x21eb69=_[_0x133c('0x3e')]({},_0x21eb69,_0x288dfe[_0x133c('0x40')]);return db[_0x133c('0x2b')][_0x133c('0x47')](_0x21eb69)[_0x133c('0x22')](handleEntityNotFound(_0x7ffbe5,null))[_0x133c('0x22')](function(_0x356646){if(_0x356646){var _0x271680=_0x356646[_0x133c('0x49')]({'plain':!![]});_0x271680=qs[_0x133c('0x4a')](_0x271680,['id',_0x133c('0x4b'),'updatedAt']);_0x288dfe[_0x133c('0x4c')]=_[_0x133c('0x4a')](_0x288dfe[_0x133c('0x4c')],['id',_0x133c('0x4b'),_0x133c('0x4d')]);return db[_0x133c('0x2b')][_0x133c('0x4e')](_['merge'](_0x271680,_0x288dfe[_0x133c('0x4c')]),{'include':_0x288dfe[_0x133c('0x30')][_0x133c('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x7ffbe5,0xc9))[_0x133c('0x44')](handleError(_0x7ffbe5,null));};exports['update']=function(_0x4ecbb6,_0x14f442){if(_0x4ecbb6[_0x133c('0x4c')]['id']){delete _0x4ecbb6[_0x133c('0x4c')]['id'];}return db['Attachment'][_0x133c('0x47')]({'where':{'id':_0x4ecbb6[_0x133c('0x45')]['id']}})[_0x133c('0x22')](handleEntityNotFound(_0x14f442,null))[_0x133c('0x22')](saveUpdates(_0x4ecbb6[_0x133c('0x4c')],null))[_0x133c('0x22')](respondWithResult(_0x14f442,null))['catch'](handleError(_0x14f442,null));};exports[_0x133c('0x23')]=function(_0x265fc5,_0x32c5c3){return db['Attachment'][_0x133c('0x47')]({'where':{'id':_0x265fc5[_0x133c('0x45')]['id']}})[_0x133c('0x22')](handleEntityNotFound(_0x32c5c3,null))['then'](removeEntity(_0x32c5c3,null))['catch'](handleError(_0x32c5c3,null));};exports[_0x133c('0x4e')]=function(_0x5af92b,_0x4c8ea7,_0x401dc6){_0x5af92b[_0x133c('0x4c')][_0x133c('0x27')]=_0x5af92b['file'][_0x133c('0x4f')];_0x5af92b[_0x133c('0x4c')][_0x133c('0x50')]=_0x5af92b[_0x133c('0x51')][_0x133c('0x52')];_0x5af92b['body'][_0x133c('0x2d')]=_0x5af92b[_0x133c('0x51')][_0x133c('0x53')];return db['Attachment'][_0x133c('0x4e')](_0x5af92b['body'])[_0x133c('0x22')](respondWithResult(_0x4c8ea7,0xc9))[_0x133c('0x44')](handleError(_0x4c8ea7,null));};exports['download']=function(_0x6cbbc1,_0x2b11ad,_0x4430af){return db[_0x133c('0x2b')]['findOne']({'where':{'id':_0x6cbbc1[_0x133c('0x45')]['id']},'raw':!![]})[_0x133c('0x22')](handleEntityNotFound(_0x2b11ad,null))[_0x133c('0x22')](function(_0x5bcc0b){if(_0x5bcc0b){var _0x353d94=_0x5bcc0b[_0x133c('0x54')]!==null;var _0x3e3ef8=path[_0x133c('0x55')](config[_0x133c('0x56')],_0x133c('0x57'));if(_0x353d94){_0x3e3ef8=path['join'](_0x3e3ef8,_0x133c('0x58'));}var _0x1e1360=path[_0x133c('0x55')](_0x3e3ef8,_0x5bcc0b[_0x133c('0x50')]);return _0x2b11ad[_0x133c('0x59')](_0x1e1360);}})[_0x133c('0x44')](handleError(_0x2b11ad,null));}; \ No newline at end of file +var _0x47c5=['findAll','rows','catch','show','params','rawAttributes','find','clone','get','omit','createdAt','updatedAt','body','create','originalname','basename','filename','download','findOne','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','Attachment','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include'];(function(_0x5a0a76,_0x22e7c0){var _0x24affc=function(_0x10335e){while(--_0x10335e){_0x5a0a76['push'](_0x5a0a76['shift']());}};_0x24affc(++_0x22e7c0);}(_0x47c5,0x71));var _0x547c=function(_0x5d6105,_0x1f5ca9){_0x5d6105=_0x5d6105-0x0;var _0x15f36e=_0x47c5[_0x5d6105];return _0x15f36e;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require(_0x547c('0x8'));var sox=require(_0x547c('0x9'));var csv=require(_0x547c('0xa'));var ejs=require(_0x547c('0xb'));var fs=require('fs');var fs_extra=require(_0x547c('0xc'));var _=require(_0x547c('0xd'));var squel=require(_0x547c('0xe'));var crypto=require(_0x547c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x547c('0x10'));var toCsv=require(_0x547c('0xa'));var querystring=require(_0x547c('0x11'));var Papa=require(_0x547c('0x12'));var Redis=require(_0x547c('0x13'));var authService=require(_0x547c('0x14'));var qs=require(_0x547c('0x15'));var as=require(_0x547c('0x16'));var hardwareService=require(_0x547c('0x17'));var logger=require(_0x547c('0x18'))(_0x547c('0x19'));var utils=require('../../config/utils');var config=require(_0x547c('0x1a'));var licenseUtil=require(_0x547c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27160c,_0x3b38fb){_0x3b38fb=_0x3b38fb||0xcc;return function(_0xa97d74){if(_0xa97d74){return _0x27160c[_0x547c('0x1c')](_0x3b38fb);}return _0x27160c[_0x547c('0x1d')](_0x3b38fb)[_0x547c('0x1e')]();};}function respondWithResult(_0x39c9cf,_0x50a4d8){_0x50a4d8=_0x50a4d8||0xc8;return function(_0x1c7480){if(_0x1c7480){return _0x39c9cf[_0x547c('0x1d')](_0x50a4d8)[_0x547c('0x1f')](_0x1c7480);}};}function respondWithFilteredResult(_0x5f4249,_0x49ef03){return function(_0x40f7da){if(_0x40f7da){var _0x5ef3db=typeof _0x49ef03[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x49ef03[_0x547c('0x22')]==='undefined';var _0x27301e=_0x40f7da[_0x547c('0x23')];var _0x3a47d4=_0x5ef3db?0x0:_0x49ef03[_0x547c('0x20')];var _0x3bd5f8=_0x5ef3db?_0x40f7da[_0x547c('0x23')]:_0x49ef03[_0x547c('0x20')]+_0x49ef03[_0x547c('0x22')];var _0x5c744c;if(_0x3bd5f8>=_0x27301e){_0x3bd5f8=_0x27301e;_0x5c744c=0xc8;}else{_0x5c744c=0xce;}_0x5f4249['status'](_0x5c744c);return _0x5f4249['set'](_0x547c('0x24'),_0x3a47d4+'-'+_0x3bd5f8+'/'+_0x27301e)[_0x547c('0x1f')](_0x40f7da);}return null;};}function patchUpdates(_0x745903){return function(_0x1d951b){try{jsonpatch[_0x547c('0x25')](_0x1d951b,_0x745903,!![]);}catch(_0x423370){return BPromise[_0x547c('0x26')](_0x423370);}return _0x1d951b[_0x547c('0x27')]();};}function saveUpdates(_0x42c422,_0x168897){return function(_0xfe3d31){if(_0xfe3d31){return _0xfe3d31[_0x547c('0x28')](_0x42c422)['then'](function(_0x46ae17){return _0x46ae17;});}return null;};}function removeEntity(_0x34c3da,_0x25ee1f){return function(_0xd7f740){if(_0xd7f740){return _0xd7f740[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x34c3da['status'](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x3a1f53,_0x536c9a){return function(_0x2f9331){if(!_0x2f9331){_0x3a1f53[_0x547c('0x1c')](0x194);}return _0x2f9331;};}function handleError(_0x15c1e6,_0x5edc6f){_0x5edc6f=_0x5edc6f||0x1f4;return function(_0x42ce16){logger[_0x547c('0x2b')](_0x42ce16[_0x547c('0x2c')]);if(_0x42ce16[_0x547c('0x2d')]){delete _0x42ce16[_0x547c('0x2d')];}_0x15c1e6['status'](_0x5edc6f)[_0x547c('0x2e')](_0x42ce16);};}exports[_0x547c('0x2f')]=function(_0x325b6a,_0xdcd61){var _0x19e589={},_0x19c883={},_0x10a188={'count':0x0,'rows':[]};var _0x117947=_['map'](db[_0x547c('0x30')]['rawAttributes'],function(_0x1d086a){return{'name':_0x1d086a['fieldName'],'type':_0x1d086a['type']['key']};});_0x19c883[_0x547c('0x31')]=_['map'](_0x117947,_0x547c('0x2d'));_0x19c883['query']=_[_0x547c('0x32')](_0x325b6a[_0x547c('0x33')]);_0x19c883['filters']=_[_0x547c('0x34')](_0x19c883[_0x547c('0x31')],_0x19c883[_0x547c('0x33')]);_0x19e589[_0x547c('0x35')]=_[_0x547c('0x34')](_0x19c883[_0x547c('0x31')],qs[_0x547c('0x36')](_0x325b6a[_0x547c('0x33')][_0x547c('0x36')]));_0x19e589[_0x547c('0x35')]=_0x19e589[_0x547c('0x35')][_0x547c('0x37')]?_0x19e589[_0x547c('0x35')]:_0x19c883[_0x547c('0x31')];if(!_0x325b6a[_0x547c('0x33')]['hasOwnProperty'](_0x547c('0x38'))){_0x19e589[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x325b6a[_0x547c('0x33')][_0x547c('0x22')]);_0x19e589['offset']=qs[_0x547c('0x20')](_0x325b6a[_0x547c('0x33')][_0x547c('0x20')]);}_0x19e589[_0x547c('0x39')]=qs[_0x547c('0x3a')](_0x325b6a[_0x547c('0x33')]['sort']);_0x19e589['where']=qs['filters'](_[_0x547c('0x3b')](_0x325b6a['query'],_0x19c883['filters']),_0x117947);if(_0x325b6a[_0x547c('0x33')][_0x547c('0x3c')]){_0x19e589[_0x547c('0x3d')]=_[_0x547c('0x3e')](_0x19e589[_0x547c('0x3d')],{'$or':_[_0x547c('0x3f')](_0x117947,function(_0x4f323){if(_0x4f323[_0x547c('0x40')]!==_0x547c('0x41')){var _0x37e3cb={};_0x37e3cb[_0x4f323[_0x547c('0x2d')]]={'$like':'%'+_0x325b6a[_0x547c('0x33')][_0x547c('0x3c')]+'%'};return _0x37e3cb;}})});}_0x19e589=_[_0x547c('0x3e')]({},_0x19e589,_0x325b6a[_0x547c('0x42')]);var _0xde4749={'where':_0x19e589[_0x547c('0x3d')]};return db[_0x547c('0x30')][_0x547c('0x23')](_0xde4749)['then'](function(_0x3059b1){_0x10a188[_0x547c('0x23')]=_0x3059b1;if(_0x325b6a[_0x547c('0x33')][_0x547c('0x43')]){_0x19e589[_0x547c('0x44')]=[{'all':!![]}];}return db[_0x547c('0x30')][_0x547c('0x45')](_0x19e589);})[_0x547c('0x2a')](function(_0x85e4e0){_0x10a188[_0x547c('0x46')]=_0x85e4e0;return _0x10a188;})[_0x547c('0x2a')](respondWithFilteredResult(_0xdcd61,_0x19e589))[_0x547c('0x47')](handleError(_0xdcd61,null));};exports[_0x547c('0x48')]=function(_0x515f6c,_0xdd15e4){var _0x42268f={'raw':!![],'where':{'id':_0x515f6c[_0x547c('0x49')]['id']}},_0x327572={};_0x327572[_0x547c('0x31')]=_[_0x547c('0x32')](db[_0x547c('0x30')][_0x547c('0x4a')]);_0x327572[_0x547c('0x33')]=_['keys'](_0x515f6c[_0x547c('0x33')]);_0x327572['filters']=_['intersection'](_0x327572[_0x547c('0x31')],_0x327572['query']);_0x42268f[_0x547c('0x35')]=_['intersection'](_0x327572[_0x547c('0x31')],qs[_0x547c('0x36')](_0x515f6c[_0x547c('0x33')][_0x547c('0x36')]));_0x42268f[_0x547c('0x35')]=_0x42268f['attributes'][_0x547c('0x37')]?_0x42268f[_0x547c('0x35')]:_0x327572[_0x547c('0x31')];if(_0x515f6c[_0x547c('0x33')][_0x547c('0x43')]){_0x42268f[_0x547c('0x44')]=[{'all':!![]}];}_0x42268f=_[_0x547c('0x3e')]({},_0x42268f,_0x515f6c[_0x547c('0x42')]);return db[_0x547c('0x30')][_0x547c('0x4b')](_0x42268f)[_0x547c('0x2a')](handleEntityNotFound(_0xdd15e4,null))[_0x547c('0x2a')](respondWithResult(_0xdd15e4,null))[_0x547c('0x47')](handleError(_0xdd15e4,null));};exports[_0x547c('0x4c')]=function(_0x371cc7,_0x16871c){var _0x77476e={'where':{'id':_0x371cc7[_0x547c('0x49')]['id']}},_0x582342={};_0x582342[_0x547c('0x31')]=_['keys'](db[_0x547c('0x30')]['rawAttributes']);_0x77476e[_0x547c('0x35')]=_[_0x547c('0x34')](_0x582342[_0x547c('0x31')],qs[_0x547c('0x36')](_0x371cc7['query']['fields']));_0x77476e[_0x547c('0x35')]=_0x77476e[_0x547c('0x35')][_0x547c('0x37')]?_0x77476e[_0x547c('0x35')]:_0x582342[_0x547c('0x31')];if(_0x371cc7[_0x547c('0x33')]['includeAll']){_0x77476e[_0x547c('0x44')]=[{'all':!![]}];}_0x77476e=_['merge']({},_0x77476e,_0x371cc7[_0x547c('0x42')]);return db[_0x547c('0x30')][_0x547c('0x4b')](_0x77476e)[_0x547c('0x2a')](handleEntityNotFound(_0x16871c,null))[_0x547c('0x2a')](function(_0x89bda1){if(_0x89bda1){var _0x530adc=_0x89bda1[_0x547c('0x4d')]({'plain':!![]});_0x530adc=qs[_0x547c('0x4e')](_0x530adc,['id',_0x547c('0x4f'),_0x547c('0x50')]);_0x371cc7[_0x547c('0x51')]=_[_0x547c('0x4e')](_0x371cc7[_0x547c('0x51')],['id',_0x547c('0x4f'),_0x547c('0x50')]);return db[_0x547c('0x30')][_0x547c('0x52')](_[_0x547c('0x3e')](_0x530adc,_0x371cc7[_0x547c('0x51')]),{'include':_0x371cc7[_0x547c('0x33')][_0x547c('0x43')]?[{'all':!![]}]:undefined});}})[_0x547c('0x2a')](respondWithResult(_0x16871c,0xc9))[_0x547c('0x47')](handleError(_0x16871c,null));};exports[_0x547c('0x28')]=function(_0x58d68d,_0x490cc9){if(_0x58d68d[_0x547c('0x51')]['id']){delete _0x58d68d[_0x547c('0x51')]['id'];}return db['Attachment'][_0x547c('0x4b')]({'where':{'id':_0x58d68d[_0x547c('0x49')]['id']}})['then'](handleEntityNotFound(_0x490cc9,null))['then'](saveUpdates(_0x58d68d[_0x547c('0x51')],null))[_0x547c('0x2a')](respondWithResult(_0x490cc9,null))[_0x547c('0x47')](handleError(_0x490cc9,null));};exports['destroy']=function(_0x20bf1a,_0x20e0b3){return db[_0x547c('0x30')][_0x547c('0x4b')]({'where':{'id':_0x20bf1a['params']['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x20e0b3,null))['then'](removeEntity(_0x20e0b3,null))[_0x547c('0x47')](handleError(_0x20e0b3,null));};exports[_0x547c('0x52')]=function(_0x45c5d7,_0x3ee9a3,_0xe0453b){_0x45c5d7[_0x547c('0x51')][_0x547c('0x2d')]=_0x45c5d7['file'][_0x547c('0x53')];_0x45c5d7[_0x547c('0x51')][_0x547c('0x54')]=_0x45c5d7['file'][_0x547c('0x55')];_0x45c5d7[_0x547c('0x51')][_0x547c('0x40')]=_0x45c5d7['file']['mimetype'];return db['Attachment'][_0x547c('0x52')](_0x45c5d7[_0x547c('0x51')])[_0x547c('0x2a')](respondWithResult(_0x3ee9a3,0xc9))['catch'](handleError(_0x3ee9a3,null));};exports[_0x547c('0x56')]=function(_0xb671a1,_0x5aa0e5,_0xc768f){return db[_0x547c('0x30')][_0x547c('0x57')]({'where':{'id':_0xb671a1['params']['id']},'raw':!![]})[_0x547c('0x2a')](handleEntityNotFound(_0x5aa0e5,null))[_0x547c('0x2a')](function(_0x48d0c2){if(_0x48d0c2){var _0x45583d=_0x48d0c2['ChatOfflineMessageId']!==null;var _0x4a9aff=path[_0x547c('0x58')](config[_0x547c('0x59')],_0x547c('0x5a'));if(_0x45583d){_0x4a9aff=path[_0x547c('0x58')](_0x4a9aff,'offline-chat/');}var _0x7681ef=path['join'](_0x4a9aff,_0x48d0c2['basename']);return _0x5aa0e5[_0x547c('0x56')](_0x7681ef);}})[_0x547c('0x47')](handleError(_0x5aa0e5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 87f60c7..441a4c3 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 _0x54c8=['define','Attachment','attachments','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0x54c8,0x1cb));var _0x854c=function(_0x442f09,_0x11f728){_0x442f09=_0x442f09-0x0;var _0x29263d=_0x54c8[_0x442f09];return _0x29263d;};'use strict';var _=require(_0x854c('0x0'));var util=require(_0x854c('0x1'));var logger=require('../../config/logger')(_0x854c('0x2'));var moment=require(_0x854c('0x3'));var BPromise=require('bluebird');var rp=require(_0x854c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x854c('0x5'));var config=require(_0x854c('0x6'));var attributes=require(_0x854c('0x7'));module[_0x854c('0x8')]=function(_0x117ed2,_0x4dad4c){return _0x117ed2[_0x854c('0x9')](_0x854c('0xa'),attributes,{'tableName':_0x854c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f37=['attachments','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','Attachment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f37,0x85));var _0x77f3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7f37[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x77f3('0x0'));var util=require('util');var logger=require(_0x77f3('0x1'))('api');var moment=require(_0x77f3('0x2'));var BPromise=require(_0x77f3('0x3'));var rp=require(_0x77f3('0x4'));var fs=require('fs');var path=require(_0x77f3('0x5'));var rimraf=require(_0x77f3('0x6'));var config=require(_0x77f3('0x7'));var attributes=require(_0x77f3('0x8'));module['exports']=function(_0x5909b0,_0x3dd55a){return _0x5909b0['define'](_0x77f3('0x9'),attributes,{'tableName':_0x77f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 0e8fb34..78e86b0 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 _0x073e=['rpc','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateAttachment','Attachment','create','options','raw','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x073e,0x181));var _0xe073=function(_0x435989,_0x1d3a5b){_0x435989=_0x435989-0x0;var _0x43db8c=_0x073e[_0x435989];return _0x43db8c;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var moment=require(_0xe073('0x2'));var BPromise=require(_0xe073('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe073('0x4'));var logger=require(_0xe073('0x5'))(_0xe073('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe073('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44092d,_0x1bcaae,_0x3b4fc7){return new BPromise(function(_0x373bf6,_0x1a93da){return client['request'](_0x44092d,_0x3b4fc7)[_0xe073('0x8')](function(_0x7a1f21){logger[_0xe073('0x9')](_0xe073('0xa'),_0x1bcaae,'request\x20sent');logger[_0xe073('0xb')](_0xe073('0xc'),_0x1bcaae,_0xe073('0xd'),JSON[_0xe073('0xe')](_0x7a1f21));if(_0x7a1f21[_0xe073('0xf')]){if(_0x7a1f21[_0xe073('0xf')]['code']===0x1f4){logger[_0xe073('0xf')]('Attachment,\x20%s,\x20%s',_0x1bcaae,_0x7a1f21[_0xe073('0xf')]['message']);return _0x1a93da(_0x7a1f21[_0xe073('0xf')]['message']);}logger[_0xe073('0xf')](_0xe073('0xa'),_0x1bcaae,_0x7a1f21[_0xe073('0xf')][_0xe073('0x10')]);return _0x373bf6(_0x7a1f21[_0xe073('0xf')][_0xe073('0x10')]);}else{logger[_0xe073('0x9')](_0xe073('0xa'),_0x1bcaae,_0xe073('0xd'));_0x373bf6(_0x7a1f21[_0xe073('0x11')][_0xe073('0x10')]);}})['catch'](function(_0x511ab2){logger['error'](_0xe073('0xa'),_0x1bcaae,_0x511ab2);_0x1a93da(_0x511ab2);});});}exports[_0xe073('0x12')]=function(_0x10486c){var _0x16eaa6=this;return new Promise(function(_0x4f9c8e,_0x4fdd2c){return db[_0xe073('0x13')][_0xe073('0x14')](_0x10486c['body'],{'raw':_0x10486c[_0xe073('0x15')]?_0x10486c[_0xe073('0x15')][_0xe073('0x16')]===undefined?!![]:![]:!![]})[_0xe073('0x8')](function(_0x43668e){logger[_0xe073('0x9')](_0xe073('0x12'),_0x10486c);logger[_0xe073('0xb')](_0xe073('0x12'),_0x10486c,JSON[_0xe073('0xe')](_0x43668e));_0x4f9c8e(_0x43668e);})['catch'](function(_0x4405fd){logger[_0xe073('0xf')](_0xe073('0x12'),_0x4405fd[_0xe073('0x10')],_0x10486c);_0x4fdd2c(_0x16eaa6[_0xe073('0xf')](0x1f4,_0x4405fd[_0xe073('0x10')]));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','Attachment','create','body','options','raw','then','CreateAttachment','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x17c419,_0xf103b6){var _0x3cc17d=function(_0x21b5d3){while(--_0x21b5d3){_0x17c419['push'](_0x17c419['shift']());}};_0x3cc17d(++_0xf103b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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['CreateAttachment']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateAttachment',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 733202c..6639a49 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x413cca,_0x4fd042){var _0x4aee05=function(_0x4b1f6f){while(--_0x4b1f6f){_0x413cca['push'](_0x413cca['shift']());}};_0x4aee05(++_0x4fd042);}(_0x757a,0xde));var _0xa757=function(_0x3aecf3,_0x16af59){_0x3aecf3=_0x3aecf3-0x0;var _0x433351=_0x757a[_0x3aecf3];return _0x433351;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x1e29d6,_0x45fb62){var _0x54beeb=function(_0x35c068){while(--_0x35c068){_0x1e29d6['push'](_0x1e29d6['shift']());}};_0x54beeb(++_0x45fb62);}(_0xb10b,0x12a));var _0xbb10=function(_0x23d0a1,_0x5011a){_0x23d0a1=_0x23d0a1-0x0;var _0x1ef866=_0xb10b[_0x23d0a1];return _0x1ef866;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 22a7443..7655bb6 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1766=['Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','findOne','password','role','disabled','online','admin','user','agent','name','then','blocked','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','json','use','passport','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','error'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1766,0x17d));var _0x6176=function(_0x31a95a,_0x180319){_0x31a95a=_0x31a95a-0x0;var _0x5270f3=_0x1766[_0x31a95a];return _0x5270f3;};'use strict';var passport=require(_0x6176('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0x6176('0x1'));var ActiveDirectory=require(_0x6176('0x2'));var BPromise=require(_0x6176('0x3'));var util=require(_0x6176('0x4'));var db=require(_0x6176('0x5'))['db'];var authService=require(_0x6176('0x6'));var utils=require('../../config/utils');var config=require(_0x6176('0x7'));var logger=require(_0x6176('0x8'))('api');function isActiveDirectoryConfigured(_0xc12c66){var _0x222f99=![];if(typeof _0xc12c66[_0x6176('0x9')]!==_0x6176('0xa')){_0x222f99=_0xc12c66['activedirectory'][_0x6176('0xb')]&&_0xc12c66[_0x6176('0x9')][_0x6176('0xc')]&&_0xc12c66[_0x6176('0x9')][_0x6176('0xd')];}return _0x222f99;}function adAuthenticate(_0x4eb9e0,_0x29570a,_0x18a20b){return new BPromise(function(_0x3da3c8,_0x564892){try{var _0x2a1c4c=new ActiveDirectory(_0x4eb9e0);_0x2a1c4c['authenticate'](_0x29570a,_0x18a20b,function(_0x3a6fca,_0x14fa40){if(_0x3a6fca){logger[_0x6176('0xe')](_0x6176('0xf'),_0x29570a,util[_0x6176('0x10')](_0x3a6fca,{'showHidden':![],'depth':null}));_0x564892('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x14fa40){logger[_0x6176('0xe')](_0x6176('0x11'),_0x29570a);_0x564892(_0x6176('0x12'));}else{_0x3da3c8(_0x14fa40);}});}catch(_0x18a2bb){_0x564892(_0x18a2bb);}});}function ActiveDirectoryAuthenticate(_0x39c8e9,_0x10c04c,_0x3d8fc2,_0x56b77e){var _0x276c4f,_0x202604;if(!isActiveDirectoryConfigured(config)){logger[_0x6176('0xe')](_0x6176('0x13'),_0x10c04c);return _0x56b77e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x6176('0x14'),_0x6176('0x15')],'raw':!![]})['then'](function(_0x548fd1){_0x276c4f=_0x548fd1;if(!_0x276c4f[_0x6176('0x14')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x10c04c);throw new Error(_0x6176('0x12'));}return _0x39c8e9[_0x6176('0x16')]({'attributes':['id','name',_0x6176('0x17'),'salt',_0x6176('0x18'),_0x6176('0x19'),'blocked','blockedAt',_0x6176('0x1a')],'where':{'name':_0x10c04c,'role':{'$or':[_0x6176('0x1b'),_0x6176('0x1c'),_0x6176('0x1d')]},'adSsoEnabled':!![]}});})['then'](function(_0x12a892){if(!_0x12a892||_0x12a892&&_0x12a892['name']!==_0x10c04c){throw new Error(_0x6176('0x12'));}_0x202604=_0x12a892;var _0x242a96=_0x202604[_0x6176('0x1e')]+'@'+config[_0x6176('0x9')][_0x6176('0xd')];return adAuthenticate(config[_0x6176('0x9')],_0x242a96,_0x3d8fc2);})[_0x6176('0x1f')](function(_0x2bd712){if(_0x202604[_0x6176('0x19')]){throw new Error(_0x6176('0x12'));}if(_0x276c4f[_0x6176('0x15')]>0x0){if(_0x202604[_0x6176('0x20')]){if(moment(_0x202604['blockedAt'])[_0x6176('0x21')](_0x276c4f[_0x6176('0x15')],_0x6176('0x22'))>moment()){throw new Error(_0x6176('0x12'));}return utils[_0x6176('0x23')](_0x202604,0x0,![],null)[_0x6176('0x1f')](function(){return utils[_0x6176('0x24')](_0x202604);})[_0x6176('0x1f')](function(){return _0x56b77e(null,_0x202604);});}else{return utils[_0x6176('0x24')](_0x202604)[_0x6176('0x1f')](function(){return _0x56b77e(null,_0x202604);});}}else{return utils[_0x6176('0x24')](_0x202604)[_0x6176('0x1f')](function(){return _0x56b77e(null,_0x202604);});}})[_0x6176('0x25')](function(_0x531f2b){return _0x56b77e(null,![],_0x531f2b);});}function handleError(_0x2d86da,_0x256583,_0x3033fa){return _0x2d86da[_0x6176('0x26')](_0x256583||0x1f4)['send']({'message':_0x3033fa?_0x3033fa[_0x6176('0x27')]||_0x3033fa:''});}exports[_0x6176('0x28')]=function(_0x3f5a90,_0x53618c,_0x44bf89){passport['authenticate'](_0x6176('0x29'),function(_0x4fe5a0,_0x2cd05c,_0x504891){var _0x15c009=_0x4fe5a0||_0x504891;if(_0x15c009){return handleError(_0x53618c,0x191,_0x15c009);}if(!_0x2cd05c){return handleError(_0x53618c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x95c34a={'payload':{'id':_0x2cd05c['id'],'role':_0x2cd05c[_0x6176('0x18')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x95c34a)['then'](function(_0x2cdc3b){_0x53618c[_0x6176('0x2a')]({'id':_0x2cd05c['id'],'token':_0x2cdc3b,'statusCall':'','isAlreadyLogged':_0x2cd05c[_0x6176('0x1a')]});});}})(_0x3f5a90,_0x53618c,_0x44bf89);};passport[_0x6176('0x2b')]('ad-login',new LocalStrategy({'usernameField':_0x6176('0x1e'),'passwordField':_0x6176('0x17')},function(_0x56c1ed,_0xb0a78e,_0x180bda){return ActiveDirectoryAuthenticate(db['User'],_0x56c1ed,_0xb0a78e,_0x180bda);})); \ No newline at end of file +var _0xb9ba=['blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','user','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xb9ba,0x136));var _0xab9b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb9ba[_0x122ef9];return _0x42fba0;};'use strict';var passport=require(_0xab9b('0x0'));var LocalStrategy=require(_0xab9b('0x1'))[_0xab9b('0x2')];var moment=require(_0xab9b('0x3'));var ActiveDirectory=require(_0xab9b('0x4'));var BPromise=require(_0xab9b('0x5'));var util=require(_0xab9b('0x6'));var db=require(_0xab9b('0x7'))['db'];var authService=require(_0xab9b('0x8'));var utils=require('../../config/utils');var config=require(_0xab9b('0x9'));var logger=require(_0xab9b('0xa'))(_0xab9b('0xb'));function isActiveDirectoryConfigured(_0x1c6fdc){var _0x4f219b=![];if(typeof _0x1c6fdc[_0xab9b('0xc')]!==_0xab9b('0xd')){_0x4f219b=_0x1c6fdc['activedirectory'][_0xab9b('0xe')]&&_0x1c6fdc[_0xab9b('0xc')][_0xab9b('0xf')]&&_0x1c6fdc[_0xab9b('0xc')][_0xab9b('0x10')];}return _0x4f219b;}function adAuthenticate(_0x581556,_0x18ae69,_0x43c443){return new BPromise(function(_0x193a08,_0x547a8b){try{var _0x230bd3=new ActiveDirectory(_0x581556);_0x230bd3[_0xab9b('0x11')](_0x18ae69,_0x43c443,function(_0x18b4d1,_0x503a48){if(_0x18b4d1){logger[_0xab9b('0x12')](_0xab9b('0x13'),_0x18ae69,util[_0xab9b('0x14')](_0x18b4d1,{'showHidden':![],'depth':null}));_0x547a8b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x503a48){logger['error'](_0xab9b('0x15'),_0x18ae69);_0x547a8b(_0xab9b('0x16'));}else{_0x193a08(_0x503a48);}});}catch(_0x509ffe){_0x547a8b(_0x509ffe);}});}function ActiveDirectoryAuthenticate(_0x4e5792,_0x5129f3,_0x50d95c,_0x13157a){var _0x5b53d9,_0x5d5dad;if(!isActiveDirectoryConfigured(config)){logger[_0xab9b('0x12')](_0xab9b('0x17'),_0x5129f3);return _0x13157a(null,![],{'message':_0xab9b('0x16')});}return db[_0xab9b('0x18')]['findOne']({'where':{'id':0x1},'attributes':[_0xab9b('0x19'),_0xab9b('0x1a')],'raw':!![]})[_0xab9b('0x1b')](function(_0x3aa2ed){_0x5b53d9=_0x3aa2ed;if(!_0x5b53d9['adSsoEnabled']){logger[_0xab9b('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x5129f3);throw new Error(_0xab9b('0x16'));}return _0x4e5792['findOne']({'attributes':['id',_0xab9b('0x1c'),_0xab9b('0x1d'),_0xab9b('0x1e'),_0xab9b('0x1f'),_0xab9b('0x20'),_0xab9b('0x21'),_0xab9b('0x22'),_0xab9b('0x23')],'where':{'name':_0x5129f3,'role':{'$or':['admin',_0xab9b('0x24'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x166630){if(!_0x166630||_0x166630&&_0x166630[_0xab9b('0x1c')]!==_0x5129f3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5d5dad=_0x166630;var _0x24b0d7=_0x5d5dad['name']+'@'+config[_0xab9b('0xc')][_0xab9b('0x10')];return adAuthenticate(config[_0xab9b('0xc')],_0x24b0d7,_0x50d95c);})[_0xab9b('0x1b')](function(_0x35b27a){if(_0x5d5dad[_0xab9b('0x20')]){throw new Error(_0xab9b('0x16'));}if(_0x5b53d9[_0xab9b('0x1a')]>0x0){if(_0x5d5dad['blocked']){if(moment(_0x5d5dad[_0xab9b('0x22')])[_0xab9b('0x25')](_0x5b53d9['blockDuration'],_0xab9b('0x26'))>moment()){throw new Error(_0xab9b('0x16'));}return utils[_0xab9b('0x27')](_0x5d5dad,0x0,![],null)['then'](function(){return utils[_0xab9b('0x28')](_0x5d5dad);})[_0xab9b('0x1b')](function(){return _0x13157a(null,_0x5d5dad);});}else{return utils['getLicense'](_0x5d5dad)['then'](function(){return _0x13157a(null,_0x5d5dad);});}}else{return utils['getLicense'](_0x5d5dad)[_0xab9b('0x1b')](function(){return _0x13157a(null,_0x5d5dad);});}})['catch'](function(_0x23e614){return _0x13157a(null,![],_0x23e614);});}function handleError(_0x19e158,_0x2a0f7e,_0x1ea9af){return _0x19e158[_0xab9b('0x29')](_0x2a0f7e||0x1f4)[_0xab9b('0x2a')]({'message':_0x1ea9af?_0x1ea9af[_0xab9b('0x2b')]||_0x1ea9af:''});}exports[_0xab9b('0x2c')]=function(_0x5dd440,_0x2a72ef,_0x4d5db0){passport['authenticate'](_0xab9b('0x2d'),function(_0x497c7b,_0x37d560,_0x45147e){var _0x43c87e=_0x497c7b||_0x45147e;if(_0x43c87e){return handleError(_0x2a72ef,0x191,_0x43c87e);}if(!_0x37d560){return handleError(_0x2a72ef,0x194,{'message':_0xab9b('0x2e')});}else{var _0x416bf4={'payload':{'id':_0x37d560['id'],'role':_0x37d560[_0xab9b('0x1f')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x416bf4)['then'](function(_0x4de8ea){_0x2a72ef['json']({'id':_0x37d560['id'],'token':_0x4de8ea,'statusCall':'','isAlreadyLogged':_0x37d560['online']});});}})(_0x5dd440,_0x2a72ef,_0x4d5db0);};passport['use'](_0xab9b('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0xab9b('0x1d')},function(_0x588c32,_0x5b01c4,_0x3afd4b){return ActiveDirectoryAuthenticate(db[_0xab9b('0x2f')],_0x588c32,_0x5b01c4,_0x3afd4b);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ad955cf..b8c6626 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe99d=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x2c3162,_0x6cc003){var _0x238002=function(_0x7de85d){while(--_0x7de85d){_0x2c3162['push'](_0x2c3162['shift']());}};_0x238002(++_0x6cc003);}(_0xe99d,0x1bf));var _0xde99=function(_0x375b71,_0x3b169c){_0x375b71=_0x375b71-0x0;var _0x59dca6=_0xe99d[_0x375b71];return _0x59dca6;};'use strict';var express=require(_0xde99('0x0'));var router=express[_0xde99('0x1')]();var controller=require(_0xde99('0x2'));router[_0xde99('0x3')]('/',controller[_0xde99('0x4')]);module['exports']=router; \ No newline at end of file +var _0x8a2f=['exports','express','Router','./authActiveDirectory.controller'];(function(_0x46503b,_0x46b001){var _0x1c0789=function(_0x3ed085){while(--_0x3ed085){_0x46503b['push'](_0x46503b['shift']());}};_0x1c0789(++_0x46b001);}(_0x8a2f,0x195));var _0xf8a2=function(_0x3c389f,_0x217b16){_0x3c389f=_0x3c389f-0x0;var _0xff815=_0x8a2f[_0x3c389f];return _0xff815;};'use strict';var express=require(_0xf8a2('0x0'));var router=express[_0xf8a2('0x1')]();var controller=require(_0xf8a2('0x2'));router['post']('/',controller['login']);module[_0xf8a2('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b881189..51090ce 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x492c2e,_0x38a481){var _0x353426=function(_0x5ec986){while(--_0x5ec986){_0x492c2e['push'](_0x492c2e['shift']());}};_0x353426(++_0x38a481);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7a54,0x106));var _0x47a5=function(_0xe773d3,_0x27bfc7){_0xe773d3=_0xe773d3-0x0;var _0x52a74f=_0x7a54[_0xe773d3];return _0x52a74f;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7c15811..5e05e4a 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 _0x43e7=['login','exports','express','Router','get','/callback'];(function(_0x354154,_0x56e3fe){var _0x571132=function(_0x5a98d0){while(--_0x5a98d0){_0x354154['push'](_0x354154['shift']());}};_0x571132(++_0x56e3fe);}(_0x43e7,0xda));var _0x743e=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x43e7[_0x967959];return _0x5c4489;};'use strict';var express=require(_0x743e('0x0'));var passport=require('passport');var router=express[_0x743e('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x743e('0x2')]('/',controller['login']);router[_0x743e('0x2')](_0x743e('0x3'),controller['callback'],authService['isMiddleware'],userController[_0x743e('0x4')],authService['setTokenCookie']);module[_0x743e('0x5')]=router; \ No newline at end of file +var _0x09eb=['callback','isMiddleware','login','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x5996c8,_0x32e9a3){var _0x420c87=function(_0x463b92){while(--_0x463b92){_0x5996c8['push'](_0x5996c8['shift']());}};_0x420c87(++_0x32e9a3);}(_0x09eb,0x1d9));var _0xb09e=function(_0x4e9f29,_0x1bbcbf){_0x4e9f29=_0x4e9f29-0x0;var _0x8e1ab3=_0x09eb[_0x4e9f29];return _0x8e1ab3;};'use strict';var express=require(_0xb09e('0x0'));var passport=require(_0xb09e('0x1'));var router=express['Router']();var controller=require(_0xb09e('0x2'));var userController=require(_0xb09e('0x3'));var authService=require(_0xb09e('0x4'));router[_0xb09e('0x5')]('/',controller['login']);router[_0xb09e('0x5')](_0xb09e('0x6'),controller[_0xb09e('0x7')],authService[_0xb09e('0x8')],userController[_0xb09e('0x9')],authService[_0xb09e('0xa')]);module[_0xb09e('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 702eba7..08cb945 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 _0x28b6=['email','Email\x20parameter\x20is\x20missing','generate','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','then','name','salt','role','disabled','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blockDuration','blockedAt','add','minutes','clearBlockUser','blocked','getLicense','MailAccount','find','MailServerOut','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body'];(function(_0x3eef60,_0x9eb279){var _0x569efe=function(_0xe79c0c){while(--_0xe79c0c){_0x3eef60['push'](_0x3eef60['shift']());}};_0x569efe(++_0x9eb279);}(_0x28b6,0x18e));var _0x628b=function(_0x479370,_0x2006b3){_0x479370=_0x479370-0x0;var _0x8721f2=_0x28b6[_0x479370];return _0x8721f2;};'use strict';var util=require(_0x628b('0x0'));var passport=require(_0x628b('0x1'));var LocalStrategy=require(_0x628b('0x2'))[_0x628b('0x3')];var jayson=require(_0x628b('0x4'));var _=require(_0x628b('0x5'));var rs=require('randomstring');var moment=require(_0x628b('0x6'));var db=require(_0x628b('0x7'))['db'];var authService=require(_0x628b('0x8'));var utils=require(_0x628b('0x9'));var client=jayson['client'][_0x628b('0xa')]({'port':0x232b});function localAuthenticate(_0x54046b,_0x35d0f4,_0x1b3c2a,_0x5ce2ce){var _0x43937e,_0x41bf0d;return db[_0x628b('0xb')][_0x628b('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x628b('0xd')](function(_0x22866a){_0x43937e=_0x22866a;return _0x54046b['findOne']({'attributes':['id',_0x628b('0xe'),'password',_0x628b('0xf'),_0x628b('0x10'),_0x628b('0x11'),'blocked','blockedAt',_0x628b('0x12')],'where':{'name':_0x35d0f4,'role':{'$or':[_0x628b('0x13'),_0x628b('0x14'),_0x628b('0x15')]}}});})[_0x628b('0xd')](function(_0x3a42a6){if(!_0x3a42a6||_0x3a42a6&&_0x3a42a6[_0x628b('0xe')]!==_0x35d0f4){throw new Error(_0x628b('0x16'));}else{_0x41bf0d=_0x3a42a6;return _0x41bf0d;}})['then'](function(){_0x41bf0d[_0x628b('0x17')](_0x1b3c2a,function(_0x2af2ab,_0x4023b9){var _0x590d74=_0x41bf0d['loginAttempts']+0x1;if(_0x2af2ab){return _0x5ce2ce(_0x2af2ab);}else if(!_0x4023b9){if(_0x41bf0d['disabled']){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});}else if(_0x43937e[_0x628b('0x18')]>0x0){if(_0x41bf0d['blocked']){if(_0x43937e[_0x628b('0x19')]>0x0){if(moment(_0x41bf0d[_0x628b('0x1a')])[_0x628b('0x1b')](_0x43937e[_0x628b('0x19')],_0x628b('0x1c'))>moment()){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});}else{return utils[_0x628b('0x1d')](_0x41bf0d,_0x590d74,![],null)['then'](function(){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});});}}else{return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});}}else{if(_0x590d74>=_0x43937e[_0x628b('0x18')]){return utils[_0x628b('0x1d')](_0x41bf0d,0x0,!![],moment())[_0x628b('0xd')](function(){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});});}else{return utils[_0x628b('0x1d')](_0x41bf0d,_0x590d74,![],null)[_0x628b('0xd')](function(){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});});}}}else{return _0x5ce2ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x41bf0d[_0x628b('0x11')]){return _0x5ce2ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x43937e[_0x628b('0x18')]>0x0){if(_0x41bf0d[_0x628b('0x1e')]){if(_0x43937e[_0x628b('0x19')]>0x0){if(moment(_0x41bf0d[_0x628b('0x1a')])[_0x628b('0x1b')](_0x43937e[_0x628b('0x19')],_0x628b('0x1c'))>moment()){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});}else{return utils[_0x628b('0x1d')](_0x41bf0d,0x0,![],null)[_0x628b('0xd')](function(){return utils[_0x628b('0x1f')](_0x41bf0d);})['then'](function(){return _0x5ce2ce(null,_0x41bf0d);});}}else{return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});}}else{return utils[_0x628b('0x1d')](_0x41bf0d,0x0,![],null)[_0x628b('0xd')](function(){return utils[_0x628b('0x1f')](_0x41bf0d);})[_0x628b('0xd')](function(){return _0x5ce2ce(null,_0x41bf0d);})['catch'](function(_0x42820a){return _0x5ce2ce(null,![],_0x42820a);});}}else{if(_0x41bf0d['blocked']){return _0x5ce2ce(null,![],{'message':_0x628b('0x16')});}else{return utils[_0x628b('0x1f')](_0x41bf0d)['then'](function(){return _0x5ce2ce(null,_0x41bf0d);});}}}});})['catch'](function(_0x3e2d46){return _0x5ce2ce(null,![],_0x3e2d46);});}function sendServiceMail(_0x2d1e12){return db[_0x628b('0x20')][_0x628b('0x21')]({'where':{'service':!![]},'attributes':['id',_0x628b('0xe'),'email'],'include':[{'model':db[_0x628b('0x22')],'as':'Smtp','include':[{'model':db[_0x628b('0x23')],'as':_0x628b('0x23')}]}]})[_0x628b('0xd')](function(_0x30b2f2){if(!_0x30b2f2){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x21e5de=_0x30b2f2[_0x628b('0x24')]();var _0x3d97ac={'account':_0x21e5de,'message':_[_0x628b('0x25')]({'from':util[_0x628b('0x26')](_0x628b('0x27'),_0x30b2f2[_0x628b('0xe')],_0x30b2f2['email']||_0x30b2f2[_0x628b('0x28')][_0x628b('0x14')])},_0x2d1e12)};return client[_0x628b('0x29')](_0x628b('0x2a'),_0x3d97ac);})['then'](function(_0x5751aa){if(_0x5751aa[_0x628b('0x2b')]){throw new Error(util[_0x628b('0x26')](_0x628b('0x2c'),_0x5751aa['error'][_0x628b('0x2d')]||JSON[_0x628b('0x2e')](_0x5751aa['error'])));}return!![];});}function handleError(_0x51b5e4,_0x94b503,_0x30f8bf){return _0x51b5e4[_0x628b('0x2f')](_0x94b503||0x1f4)[_0x628b('0x30')]({'message':_0x30f8bf?_0x30f8bf[_0x628b('0x2d')]||_0x30f8bf:''});}exports[_0x628b('0x31')]=function(_0xdabb86,_0x20f1c8,_0x3d427b){passport[_0x628b('0x17')](_0x628b('0x32'),function(_0x452f5f,_0x1f0b25,_0x5a9fad){var _0x45bc87=_0x452f5f||_0x5a9fad;if(_0x45bc87){return handleError(_0x20f1c8,0x191,_0x45bc87);}if(!_0x1f0b25){return handleError(_0x20f1c8,0x194,{'message':_0x628b('0x33')});}else{var _0x5a96ab={'payload':{'id':_0x1f0b25['id'],'role':_0x1f0b25['role']},'options':{'expiresIn':0x15180}};return authService[_0x628b('0x34')](_0x5a96ab)[_0x628b('0xd')](function(_0x3d0019){_0x20f1c8[_0x628b('0x35')]({'id':_0x1f0b25['id'],'token':_0x3d0019,'statusCall':'','isAlreadyLogged':_0x1f0b25[_0x628b('0x36')]});});}})(_0xdabb86,_0x20f1c8,_0x3d427b);};exports[_0x628b('0x37')]=function(_0x178f9a,_0x4a2e72){if(!_0x178f9a[_0x628b('0x38')][_0x628b('0x39')]){return handleError(_0x4a2e72,0x1f4,{'message':_0x628b('0x3a')});}var _0x5a942d=rs[_0x628b('0x3b')]();_0x178f9a['body'][_0x628b('0x39')]=_0x178f9a[_0x628b('0x38')][_0x628b('0x39')][_0x628b('0x3c')]()['toLowerCase']();var _0x3963ca;return db[_0x628b('0xb')][_0x628b('0xc')]({'where':{'id':0x1},'attributes':[_0x628b('0x18'),'blockDuration'],'raw':!![]})[_0x628b('0xd')](function(_0x3c1f19){_0x3963ca=_0x3c1f19;return db[_0x628b('0x3d')]['find']({'where':{'email':_0x178f9a[_0x628b('0x38')][_0x628b('0x39')]}});})[_0x628b('0xd')](function(_0x1979cb){if(!_0x1979cb){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x1979cb['disabled']){throw new Error(_0x628b('0x3e'));}if(_0x1979cb[_0x628b('0x1e')]){if(moment(_0x1979cb[_0x628b('0x1a')])[_0x628b('0x1b')](_0x3963ca['blockDuration'],_0x628b('0x1c'))>moment()){throw new Error(_0x628b('0x3f'));}else{_0x1979cb[_0x628b('0x1e')]=![];_0x1979cb[_0x628b('0x1a')]=null;}}_0x1979cb[_0x628b('0x40')]=_0x5a942d;_0x1979cb[_0x628b('0x41')]=Date[_0x628b('0x42')]()+0x36ee80;return _0x1979cb[_0x628b('0x43')]();})[_0x628b('0xd')](function(){return sendServiceMail({'to':_0x178f9a[_0x628b('0x38')]['email'],'subject':_0x628b('0x44'),'text':_0x628b('0x45')+_0x628b('0x46')+_0x628b('0x47')+_0x178f9a[_0x628b('0x48')][_0x628b('0x49')]+_0x628b('0x4a')+_0x5a942d+'\x0a\x0a'+_0x628b('0x4b')});})[_0x628b('0xd')](function(){_0x4a2e72[_0x628b('0x2f')](0xc8)[_0x628b('0x30')]({'message':_0x628b('0x4c')});})[_0x628b('0x4d')](function(_0x2cc00d){return handleError(_0x4a2e72,0x1f4,_0x2cc00d);});};exports[_0x628b('0x4e')]=function(_0xa2a58,_0x7633f){return db[_0x628b('0x3d')][_0x628b('0x21')]({'where':{'resetPasswordToken':_0xa2a58[_0x628b('0x4f')][_0x628b('0x50')],'resetPasswordExpires':{'$gt':Date[_0x628b('0x42')]()}}})['then'](function(_0x5706f3){if(!_0x5706f3){throw new Error(_0x628b('0x51'));}return db['Setting']['findOne']({'attributes':['id',_0x628b('0x52'),_0x628b('0x53'),'passwordHistoryLimit']})[_0x628b('0xd')](function(_0x3754fc){if(_0x3754fc[_0x628b('0x52')])authService[_0x628b('0x54')](_0xa2a58['body'][_0x628b('0x55')]);if(!_0x3754fc[_0x628b('0x53')]||!_0x5706f3['previousPasswords'])return _0x5706f3;authService[_0x628b('0x56')](_0xa2a58[_0x628b('0x38')][_0x628b('0x55')],_0x5706f3[_0x628b('0x57')],_0x3754fc[_0x628b('0x58')]);return _0x5706f3;})[_0x628b('0xd')](function(){_0x5706f3[_0x628b('0x55')]=_0xa2a58['body'][_0x628b('0x55')];_0x5706f3[_0x628b('0x40')]=null;_0x5706f3[_0x628b('0x41')]=null;return _0x5706f3[_0x628b('0x43')]();});})[_0x628b('0xd')](function(){_0x7633f[_0x628b('0x2f')](0xc8)[_0x628b('0x30')]({'message':_0x628b('0x59')});})[_0x628b('0x4d')](function(_0x267426){return handleError(_0x7633f,0x1f4,_0x267426);});};passport[_0x628b('0x5a')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x628b('0x55')},function(_0x354508,_0x49809d,_0x5288f1){return localAuthenticate(db[_0x628b('0x3d')],_0x354508,_0x49809d,_0x5288f1);})); \ No newline at end of file +var _0xa137=['Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','token','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','blocked','blockedAt','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online'];(function(_0xbaae28,_0x5657f5){var _0x542e54=function(_0x24e247){while(--_0x24e247){_0xbaae28['push'](_0xbaae28['shift']());}};_0x542e54(++_0x5657f5);}(_0xa137,0x111));var _0x7a13=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xa137[_0x34843e];return _0x598f7f;};'use strict';var util=require(_0x7a13('0x0'));var passport=require(_0x7a13('0x1'));var LocalStrategy=require(_0x7a13('0x2'))[_0x7a13('0x3')];var jayson=require(_0x7a13('0x4'));var _=require(_0x7a13('0x5'));var rs=require(_0x7a13('0x6'));var moment=require(_0x7a13('0x7'));var db=require(_0x7a13('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7a13('0x9'));var client=jayson[_0x7a13('0xa')][_0x7a13('0xb')]({'port':0x232b});function localAuthenticate(_0x273027,_0x4ea075,_0x2031ca,_0x50ce51){var _0x5c2453,_0x2aaa00;return db[_0x7a13('0xc')][_0x7a13('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7a13('0xe')],'raw':!![]})[_0x7a13('0xf')](function(_0x221ca7){_0x5c2453=_0x221ca7;return _0x273027[_0x7a13('0xd')]({'attributes':['id',_0x7a13('0x10'),_0x7a13('0x11'),_0x7a13('0x12'),_0x7a13('0x13'),'disabled',_0x7a13('0x14'),_0x7a13('0x15'),'loginAttempts'],'where':{'name':_0x4ea075,'role':{'$or':[_0x7a13('0x16'),_0x7a13('0x17'),'agent']}}});})[_0x7a13('0xf')](function(_0x1e86cb){if(!_0x1e86cb||_0x1e86cb&&_0x1e86cb[_0x7a13('0x10')]!==_0x4ea075){throw new Error(_0x7a13('0x18'));}else{_0x2aaa00=_0x1e86cb;return _0x2aaa00;}})['then'](function(){_0x2aaa00[_0x7a13('0x19')](_0x2031ca,function(_0x499bfb,_0x98974d){var _0x295be2=_0x2aaa00[_0x7a13('0x1a')]+0x1;if(_0x499bfb){return _0x50ce51(_0x499bfb);}else if(!_0x98974d){if(_0x2aaa00[_0x7a13('0x1b')]){return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5c2453[_0x7a13('0x1c')]>0x0){if(_0x2aaa00[_0x7a13('0x14')]){if(_0x5c2453[_0x7a13('0xe')]>0x0){if(moment(_0x2aaa00[_0x7a13('0x15')])[_0x7a13('0x1d')](_0x5c2453['blockDuration'],_0x7a13('0x1e'))>moment()){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else{return utils['clearBlockUser'](_0x2aaa00,_0x295be2,![],null)[_0x7a13('0xf')](function(){return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x295be2>=_0x5c2453[_0x7a13('0x1c')]){return utils[_0x7a13('0x1f')](_0x2aaa00,0x0,!![],moment())['then'](function(){return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x2aaa00,_0x295be2,![],null)[_0x7a13('0xf')](function(){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});});}}}else{return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}}else{if(_0x2aaa00[_0x7a13('0x1b')]){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else if(_0x5c2453[_0x7a13('0x1c')]>0x0){if(_0x2aaa00[_0x7a13('0x14')]){if(_0x5c2453['blockDuration']>0x0){if(moment(_0x2aaa00[_0x7a13('0x15')])[_0x7a13('0x1d')](_0x5c2453[_0x7a13('0xe')],'minutes')>moment()){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else{return utils[_0x7a13('0x1f')](_0x2aaa00,0x0,![],null)[_0x7a13('0xf')](function(){return utils['getLicense'](_0x2aaa00);})[_0x7a13('0xf')](function(){return _0x50ce51(null,_0x2aaa00);});}}else{return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x2aaa00,0x0,![],null)[_0x7a13('0xf')](function(){return utils[_0x7a13('0x20')](_0x2aaa00);})[_0x7a13('0xf')](function(){return _0x50ce51(null,_0x2aaa00);})[_0x7a13('0x21')](function(_0x58d730){return _0x50ce51(null,![],_0x58d730);});}}else{if(_0x2aaa00[_0x7a13('0x14')]){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else{return utils['getLicense'](_0x2aaa00)[_0x7a13('0xf')](function(){return _0x50ce51(null,_0x2aaa00);});}}}});})[_0x7a13('0x21')](function(_0x241704){return _0x50ce51(null,![],_0x241704);});}function sendServiceMail(_0x145662){return db['MailAccount'][_0x7a13('0x22')]({'where':{'service':!![]},'attributes':['id','name',_0x7a13('0x23')],'include':[{'model':db[_0x7a13('0x24')],'as':'Smtp','include':[{'model':db[_0x7a13('0x25')],'as':_0x7a13('0x25')}]}]})[_0x7a13('0xf')](function(_0x2e94fe){if(!_0x2e94fe){throw new Error(_0x7a13('0x26'));}var _0x166e6f=_0x2e94fe[_0x7a13('0x27')]();var _0x8bebf8={'account':_0x166e6f,'message':_[_0x7a13('0x28')]({'from':util[_0x7a13('0x29')](_0x7a13('0x2a'),_0x2e94fe[_0x7a13('0x10')],_0x2e94fe['email']||_0x2e94fe[_0x7a13('0x2b')]['user'])},_0x145662)};return client[_0x7a13('0x2c')](_0x7a13('0x2d'),_0x8bebf8);})[_0x7a13('0xf')](function(_0x214386){if(_0x214386[_0x7a13('0x2e')]){throw new Error(util[_0x7a13('0x29')](_0x7a13('0x2f'),_0x214386[_0x7a13('0x2e')]['message']||JSON['stringify'](_0x214386['error'])));}return!![];});}function handleError(_0x5046c6,_0x27a7d5,_0x426ea6){return _0x5046c6[_0x7a13('0x30')](_0x27a7d5||0x1f4)[_0x7a13('0x31')]({'message':_0x426ea6?_0x426ea6[_0x7a13('0x32')]||_0x426ea6:''});}exports['login']=function(_0x2bd3fd,_0xb6db5d,_0x4c777d){passport[_0x7a13('0x19')](_0x7a13('0x33'),function(_0x4ca40d,_0x350915,_0x566d93){var _0xdb289d=_0x4ca40d||_0x566d93;if(_0xdb289d){return handleError(_0xb6db5d,0x191,_0xdb289d);}if(!_0x350915){return handleError(_0xb6db5d,0x194,{'message':_0x7a13('0x34')});}else{var _0x1ca61f={'payload':{'id':_0x350915['id'],'role':_0x350915[_0x7a13('0x13')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1ca61f)[_0x7a13('0xf')](function(_0x2e7998){_0xb6db5d[_0x7a13('0x35')]({'id':_0x350915['id'],'token':_0x2e7998,'statusCall':'','isAlreadyLogged':_0x350915[_0x7a13('0x36')]});});}})(_0x2bd3fd,_0xb6db5d,_0x4c777d);};exports['forgot']=function(_0xe4e16f,_0x5b6a78){if(!_0xe4e16f['body'][_0x7a13('0x23')]){return handleError(_0x5b6a78,0x1f4,{'message':_0x7a13('0x37')});}var _0x567f78=rs[_0x7a13('0x38')]();_0xe4e16f['body']['email']=_0xe4e16f[_0x7a13('0x39')]['email']['trim']()[_0x7a13('0x3a')]();var _0x12a3d6;return db[_0x7a13('0xc')][_0x7a13('0xd')]({'where':{'id':0x1},'attributes':[_0x7a13('0x1c'),'blockDuration'],'raw':!![]})[_0x7a13('0xf')](function(_0x3f2db3){_0x12a3d6=_0x3f2db3;return db['User'][_0x7a13('0x22')]({'where':{'email':_0xe4e16f[_0x7a13('0x39')][_0x7a13('0x23')]}});})[_0x7a13('0xf')](function(_0x568e70){if(!_0x568e70){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x568e70[_0x7a13('0x1b')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x568e70[_0x7a13('0x14')]){if(moment(_0x568e70[_0x7a13('0x15')])['add'](_0x12a3d6[_0x7a13('0xe')],_0x7a13('0x1e'))>moment()){throw new Error(_0x7a13('0x3b'));}else{_0x568e70[_0x7a13('0x14')]=![];_0x568e70['blockedAt']=null;}}_0x568e70[_0x7a13('0x3c')]=_0x567f78;_0x568e70[_0x7a13('0x3d')]=Date[_0x7a13('0x3e')]()+0x36ee80;return _0x568e70[_0x7a13('0x3f')]();})[_0x7a13('0xf')](function(){return sendServiceMail({'to':_0xe4e16f['body']['email'],'subject':_0x7a13('0x40'),'text':_0x7a13('0x41')+_0x7a13('0x42')+'https://'+_0xe4e16f[_0x7a13('0x43')][_0x7a13('0x44')]+_0x7a13('0x45')+_0x567f78+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x7a13('0xf')](function(){_0x5b6a78[_0x7a13('0x30')](0xc8)['send']({'message':_0x7a13('0x46')});})[_0x7a13('0x21')](function(_0x11c88e){return handleError(_0x5b6a78,0x1f4,_0x11c88e);});};exports[_0x7a13('0x47')]=function(_0x44e62b,_0x33e00e){return db[_0x7a13('0x48')]['find']({'where':{'resetPasswordToken':_0x44e62b[_0x7a13('0x49')][_0x7a13('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x7a13('0xf')](function(_0x5184df){if(!_0x5184df){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x7a13('0xc')][_0x7a13('0xd')]({'attributes':['id',_0x7a13('0x4b'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x7a13('0xf')](function(_0x57ea33){if(_0x57ea33[_0x7a13('0x4b')])authService['validatePasswordPattern'](_0x44e62b['body']['password']);if(!_0x57ea33[_0x7a13('0x4c')]||!_0x5184df[_0x7a13('0x4d')])return _0x5184df;authService[_0x7a13('0x4e')](_0x44e62b[_0x7a13('0x39')]['password'],_0x5184df[_0x7a13('0x4d')],_0x57ea33[_0x7a13('0x4f')]);return _0x5184df;})[_0x7a13('0xf')](function(){_0x5184df[_0x7a13('0x11')]=_0x44e62b[_0x7a13('0x39')][_0x7a13('0x11')];_0x5184df[_0x7a13('0x3c')]=null;_0x5184df['resetPasswordExpires']=null;return _0x5184df[_0x7a13('0x3f')]();});})[_0x7a13('0xf')](function(){_0x33e00e['status'](0xc8)[_0x7a13('0x31')]({'message':_0x7a13('0x50')});})[_0x7a13('0x21')](function(_0x5ed891){return handleError(_0x33e00e,0x1f4,_0x5ed891);});};passport[_0x7a13('0x51')]('local-login',new LocalStrategy({'usernameField':_0x7a13('0x10'),'passwordField':'password'},function(_0x52845c,_0x57fed5,_0x36d1d1){return localAuthenticate(db[_0x7a13('0x48')],_0x52845c,_0x57fed5,_0x36d1d1);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d1a351a..1dc05a4 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 _0xc099=['post','/forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x4ee9dc,_0x1ab550){var _0x580990=function(_0x1fa5e6){while(--_0x1fa5e6){_0x4ee9dc['push'](_0x4ee9dc['shift']());}};_0x580990(++_0x1ab550);}(_0xc099,0x17f));var _0x9c09=function(_0x308ba1,_0xf4c8d9){_0x308ba1=_0x308ba1-0x0;var _0x540e33=_0xc099[_0x308ba1];return _0x540e33;};'use strict';var express=require(_0x9c09('0x0'));var router=express['Router']();var controller=require(_0x9c09('0x1'));router[_0x9c09('0x2')]('/',controller['login']);router[_0x9c09('0x2')](_0x9c09('0x3'),controller['forgot']);router['post'](_0x9c09('0x4'),controller[_0x9c09('0x5')]);module[_0x9c09('0x6')]=router; \ No newline at end of file +var _0x49ad=['express','Router','post','login','/reset/:token','reset','exports'];(function(_0x4dce4f,_0x2e433f){var _0x7d8bcf=function(_0x1c03d9){while(--_0x1c03d9){_0x4dce4f['push'](_0x4dce4f['shift']());}};_0x7d8bcf(++_0x2e433f);}(_0x49ad,0xe0));var _0xd49a=function(_0x2f5297,_0x2b93fc){_0x2f5297=_0x2f5297-0x0;var _0x446f62=_0x49ad[_0x2f5297];return _0x446f62;};'use strict';var express=require(_0xd49a('0x0'));var router=express[_0xd49a('0x1')]();var controller=require('./authLocal.controller');router[_0xd49a('0x2')]('/',controller[_0xd49a('0x3')]);router[_0xd49a('0x2')]('/forgot',controller['forgot']);router[_0xd49a('0x2')](_0xd49a('0x4'),controller[_0xd49a('0x5')]);module[_0xd49a('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c6de01b..bf19fef 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 _0x5ab2=['INTEGER','sequelize','exports','STRING'];(function(_0x2e4f06,_0x8f95b6){var _0x38d6ee=function(_0x2d61c3){while(--_0x2d61c3){_0x2e4f06['push'](_0x2e4f06['shift']());}};_0x38d6ee(++_0x8f95b6);}(_0x5ab2,0xd5));var _0x25ab=function(_0x5dfee7,_0x4b0629){_0x5dfee7=_0x5dfee7-0x0;var _0x2cc264=_0x5ab2[_0x5dfee7];return _0x2cc264;};'use strict';var Sequelize=require(_0x25ab('0x0'));module[_0x25ab('0x1')]={'name':{'type':Sequelize[_0x25ab('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x25ab('0x2')]},'description':{'type':Sequelize[_0x25ab('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x25ab('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xd2f7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1343e0,_0x293029){var _0x59789a=function(_0x5dc8a3){while(--_0x5dc8a3){_0x1343e0['push'](_0x1343e0['shift']());}};_0x59789a(++_0x293029);}(_0xd2f7,0x172));var _0x7d2f=function(_0x26f230,_0x205a58){_0x26f230=_0x26f230-0x0;var _0x2c49a5=_0xd2f7[_0x26f230];return _0x2c49a5;};'use strict';var Sequelize=require(_0x7d2f('0x0'));module[_0x7d2f('0x1')]={'name':{'type':Sequelize[_0x7d2f('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7d2f('0x2')]},'status':{'type':Sequelize[_0x7d2f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index ec6d539..0821c2b 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 _0x59ab=['util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','then','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','catch','show','params','find','create','body','update','destroy','Condition','addConditions','ids','omit','findOne','getConditions','nolimit','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x321e76,_0x5466dc){var _0x1600e3=function(_0x311447){while(--_0x311447){_0x321e76['push'](_0x321e76['shift']());}};_0x1600e3(++_0x5466dc);}(_0x59ab,0x14f));var _0xb59a=function(_0xf78cda,_0x521260){_0xf78cda=_0xf78cda-0x0;var _0x1379f8=_0x59ab[_0xf78cda];return _0x1379f8;};'use strict';var emlformat=require(_0xb59a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb59a('0x1'));var jsonpatch=require(_0xb59a('0x2'));var rp=require(_0xb59a('0x3'));var moment=require('moment');var BPromise=require(_0xb59a('0x4'));var Mustache=require('mustache');var util=require(_0xb59a('0x5'));var path=require('path');var sox=require(_0xb59a('0x6'));var csv=require(_0xb59a('0x7'));var ejs=require(_0xb59a('0x8'));var fs=require('fs');var fs_extra=require(_0xb59a('0x9'));var _=require(_0xb59a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb59a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb59a('0xc'));var Papa=require(_0xb59a('0xd'));var Redis=require(_0xb59a('0xe'));var authService=require(_0xb59a('0xf'));var qs=require(_0xb59a('0x10'));var as=require(_0xb59a('0x11'));var hardwareService=require(_0xb59a('0x12'));var logger=require(_0xb59a('0x13'))(_0xb59a('0x14'));var utils=require(_0xb59a('0x15'));var config=require(_0xb59a('0x16'));var licenseUtil=require(_0xb59a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38bdfc,_0xa6592){_0xa6592=_0xa6592||0xcc;return function(_0x24279c){if(_0x24279c){return _0x38bdfc[_0xb59a('0x18')](_0xa6592);}return _0x38bdfc[_0xb59a('0x19')](_0xa6592)[_0xb59a('0x1a')]();};}function respondWithResult(_0xbe038f,_0x329375){_0x329375=_0x329375||0xc8;return function(_0x2f24a3){if(_0x2f24a3){return _0xbe038f[_0xb59a('0x19')](_0x329375)[_0xb59a('0x1b')](_0x2f24a3);}};}function respondWithFilteredResult(_0x268ba8,_0xca213){return function(_0x491a47){if(_0x491a47){var _0x16d66e=typeof _0xca213[_0xb59a('0x1c')]==='undefined'&&typeof _0xca213['limit']===_0xb59a('0x1d');var _0x427e31=_0x491a47['count'];var _0x401be4=_0x16d66e?0x0:_0xca213[_0xb59a('0x1c')];var _0xd9ec50=_0x16d66e?_0x491a47[_0xb59a('0x1e')]:_0xca213['offset']+_0xca213['limit'];var _0x3bf28c;if(_0xd9ec50>=_0x427e31){_0xd9ec50=_0x427e31;_0x3bf28c=0xc8;}else{_0x3bf28c=0xce;}_0x268ba8[_0xb59a('0x19')](_0x3bf28c);return _0x268ba8[_0xb59a('0x1f')](_0xb59a('0x20'),_0x401be4+'-'+_0xd9ec50+'/'+_0x427e31)['json'](_0x491a47);}return null;};}function patchUpdates(_0x1f0d95){return function(_0x3c3d9e){try{jsonpatch[_0xb59a('0x21')](_0x3c3d9e,_0x1f0d95,!![]);}catch(_0x213885){return BPromise['reject'](_0x213885);}return _0x3c3d9e[_0xb59a('0x22')]();};}function saveUpdates(_0x379c93,_0x5cdef9){return function(_0x153bd1){if(_0x153bd1){return _0x153bd1['update'](_0x379c93)[_0xb59a('0x23')](function(_0x54b5e2){return _0x54b5e2;});}return null;};}function removeEntity(_0x298f04,_0x1c7f8e){return function(_0x5a8464){if(_0x5a8464){return _0x5a8464['destroy']()[_0xb59a('0x23')](function(){_0x298f04[_0xb59a('0x19')](0xcc)[_0xb59a('0x1a')]();});}};}function handleEntityNotFound(_0x16b6bc,_0x41c144){return function(_0x4de720){if(!_0x4de720){_0x16b6bc[_0xb59a('0x18')](0x194);}return _0x4de720;};}function handleError(_0x70635a,_0x44c178){_0x44c178=_0x44c178||0x1f4;return function(_0x1752c8){logger[_0xb59a('0x24')](_0x1752c8['stack']);if(_0x1752c8[_0xb59a('0x25')]){delete _0x1752c8['name'];}_0x70635a[_0xb59a('0x19')](_0x44c178)[_0xb59a('0x26')](_0x1752c8);};}exports[_0xb59a('0x27')]=function(_0x45c72f,_0x7b2488){var _0x4390d0={},_0x197e79={},_0x519292={'count':0x0,'rows':[]};var _0x1fe45d=_['map'](db['Automation'][_0xb59a('0x28')],function(_0x236917){return{'name':_0x236917[_0xb59a('0x29')],'type':_0x236917[_0xb59a('0x2a')][_0xb59a('0x2b')]};});_0x197e79['model']=_[_0xb59a('0x2c')](_0x1fe45d,_0xb59a('0x25'));_0x197e79[_0xb59a('0x2d')]=_[_0xb59a('0x2e')](_0x45c72f['query']);_0x197e79[_0xb59a('0x2f')]=_['intersection'](_0x197e79['model'],_0x197e79[_0xb59a('0x2d')]);_0x4390d0['attributes']=_[_0xb59a('0x30')](_0x197e79['model'],qs['fields'](_0x45c72f[_0xb59a('0x2d')][_0xb59a('0x31')]));_0x4390d0['attributes']=_0x4390d0[_0xb59a('0x32')][_0xb59a('0x33')]?_0x4390d0[_0xb59a('0x32')]:_0x197e79[_0xb59a('0x34')];if(!_0x45c72f[_0xb59a('0x2d')][_0xb59a('0x35')]('nolimit')){_0x4390d0[_0xb59a('0x36')]=qs['limit'](_0x45c72f[_0xb59a('0x2d')][_0xb59a('0x36')]);_0x4390d0['offset']=qs[_0xb59a('0x1c')](_0x45c72f[_0xb59a('0x2d')][_0xb59a('0x1c')]);}_0x4390d0[_0xb59a('0x37')]=qs[_0xb59a('0x38')](_0x45c72f[_0xb59a('0x2d')][_0xb59a('0x38')]);_0x4390d0[_0xb59a('0x39')]=qs[_0xb59a('0x2f')](_[_0xb59a('0x3a')](_0x45c72f[_0xb59a('0x2d')],_0x197e79['filters']),_0x1fe45d);if(_0x45c72f[_0xb59a('0x2d')][_0xb59a('0x3b')]){_0x4390d0[_0xb59a('0x39')]=_[_0xb59a('0x3c')](_0x4390d0['where'],{'$or':_[_0xb59a('0x2c')](_0x1fe45d,function(_0x349aaa){if(_0x349aaa[_0xb59a('0x2a')]!==_0xb59a('0x3d')){var _0x13dcd1={};_0x13dcd1[_0x349aaa['name']]={'$like':'%'+_0x45c72f[_0xb59a('0x2d')]['filter']+'%'};return _0x13dcd1;}})});}_0x4390d0=_[_0xb59a('0x3c')]({},_0x4390d0,_0x45c72f[_0xb59a('0x3e')]);var _0x375b99={'where':_0x4390d0[_0xb59a('0x39')]};return db[_0xb59a('0x3f')][_0xb59a('0x1e')](_0x375b99)['then'](function(_0x1bd052){_0x519292[_0xb59a('0x1e')]=_0x1bd052;if(_0x45c72f['query'][_0xb59a('0x40')]){_0x4390d0[_0xb59a('0x41')]=[{'all':!![]}];}return db[_0xb59a('0x3f')][_0xb59a('0x42')](_0x4390d0);})[_0xb59a('0x23')](function(_0x3c7cf2){_0x519292['rows']=_0x3c7cf2;return _0x519292;})[_0xb59a('0x23')](respondWithFilteredResult(_0x7b2488,_0x4390d0))[_0xb59a('0x43')](handleError(_0x7b2488,null));};exports[_0xb59a('0x44')]=function(_0x5127e3,_0x2637df){var _0x3b97ef={'raw':![],'where':{'id':_0x5127e3[_0xb59a('0x45')]['id']}},_0x24d1d0={};_0x24d1d0['model']=_['keys'](db[_0xb59a('0x3f')]['rawAttributes']);_0x24d1d0[_0xb59a('0x2d')]=_[_0xb59a('0x2e')](_0x5127e3[_0xb59a('0x2d')]);_0x24d1d0[_0xb59a('0x2f')]=_[_0xb59a('0x30')](_0x24d1d0[_0xb59a('0x34')],_0x24d1d0['query']);_0x3b97ef[_0xb59a('0x32')]=_[_0xb59a('0x30')](_0x24d1d0[_0xb59a('0x34')],qs[_0xb59a('0x31')](_0x5127e3[_0xb59a('0x2d')][_0xb59a('0x31')]));_0x3b97ef[_0xb59a('0x32')]=_0x3b97ef[_0xb59a('0x32')][_0xb59a('0x33')]?_0x3b97ef[_0xb59a('0x32')]:_0x24d1d0['model'];if(_0x5127e3['query']['includeAll']){_0x3b97ef[_0xb59a('0x41')]=[{'all':!![]}];}_0x3b97ef=_[_0xb59a('0x3c')]({},_0x3b97ef,_0x5127e3['options']);return db[_0xb59a('0x3f')][_0xb59a('0x46')](_0x3b97ef)[_0xb59a('0x23')](handleEntityNotFound(_0x2637df,null))[_0xb59a('0x23')](respondWithResult(_0x2637df,null))[_0xb59a('0x43')](handleError(_0x2637df,null));};exports[_0xb59a('0x47')]=function(_0xf39b18,_0x1c5a51){return db['Automation'][_0xb59a('0x47')](_0xf39b18[_0xb59a('0x48')],{})[_0xb59a('0x23')](respondWithResult(_0x1c5a51,0xc9))[_0xb59a('0x43')](handleError(_0x1c5a51,null));};exports[_0xb59a('0x49')]=function(_0x45803f,_0x45d14e){if(_0x45803f['body']['id']){delete _0x45803f[_0xb59a('0x48')]['id'];}return db[_0xb59a('0x3f')][_0xb59a('0x46')]({'where':{'id':_0x45803f[_0xb59a('0x45')]['id']}})[_0xb59a('0x23')](handleEntityNotFound(_0x45d14e,null))['then'](saveUpdates(_0x45803f[_0xb59a('0x48')],null))['then'](respondWithResult(_0x45d14e,null))[_0xb59a('0x43')](handleError(_0x45d14e,null));};exports[_0xb59a('0x4a')]=function(_0x20f7e8,_0x826174){return db[_0xb59a('0x3f')]['find']({'where':{'id':_0x20f7e8[_0xb59a('0x45')]['id']}})[_0xb59a('0x23')](handleEntityNotFound(_0x826174,null))[_0xb59a('0x23')](removeEntity(_0x826174,null))[_0xb59a('0x43')](handleError(_0x826174,null));};exports['addConditions']=function(_0x841dd2,_0x3e95a4,_0x4d8279){return db[_0xb59a('0x4b')][_0xb59a('0x46')]({'where':{'id':_0x841dd2[_0xb59a('0x45')]['id']}})[_0xb59a('0x23')](handleEntityNotFound(_0x3e95a4,null))[_0xb59a('0x23')](function(_0x47279c){if(_0x47279c){return _0x47279c[_0xb59a('0x4c')](_0x841dd2[_0xb59a('0x48')][_0xb59a('0x4d')],_[_0xb59a('0x4e')](_0x841dd2['body'],[_0xb59a('0x4d'),'id'])||{});}})[_0xb59a('0x23')](respondWithResult(_0x3e95a4,null))[_0xb59a('0x43')](handleError(_0x3e95a4,null));};exports['getConditions']=function(_0x1e258c,_0x41d0e0,_0x37ab5d){var _0x1db2d9={};var _0x35e339={};var _0x26fdec;var _0x16e298;return db['Automation'][_0xb59a('0x4f')]({'where':{'id':_0x1e258c[_0xb59a('0x45')]['id']}})[_0xb59a('0x23')](handleEntityNotFound(_0x41d0e0,null))[_0xb59a('0x23')](function(_0xffc4be){if(_0xffc4be){_0x26fdec=_0xffc4be;_0x35e339['model']=_[_0xb59a('0x2e')](db['Condition'][_0xb59a('0x28')]);_0x35e339[_0xb59a('0x2d')]=_[_0xb59a('0x2e')](_0x1e258c[_0xb59a('0x2d')]);_0x35e339[_0xb59a('0x2f')]=_[_0xb59a('0x30')](_0x35e339[_0xb59a('0x34')],_0x35e339[_0xb59a('0x2d')]);_0x1db2d9['attributes']=_[_0xb59a('0x30')](_0x35e339[_0xb59a('0x34')],qs[_0xb59a('0x31')](_0x1e258c['query'][_0xb59a('0x31')]));_0x1db2d9[_0xb59a('0x32')]=_0x1db2d9['attributes']['length']?_0x1db2d9[_0xb59a('0x32')]:_0x35e339[_0xb59a('0x34')];_0x1db2d9[_0xb59a('0x37')]=qs['sort'](_0x1e258c[_0xb59a('0x2d')][_0xb59a('0x38')]);_0x1db2d9[_0xb59a('0x39')]=qs[_0xb59a('0x2f')](_['pick'](_0x1e258c[_0xb59a('0x2d')],_0x35e339[_0xb59a('0x2f')]));if(_0x1e258c[_0xb59a('0x2d')]['filter']){_0x1db2d9['where']=_[_0xb59a('0x3c')](_0x1db2d9[_0xb59a('0x39')],{'$or':_[_0xb59a('0x2c')](_0x1db2d9[_0xb59a('0x32')],function(_0x236815){var _0x34c7cc={};_0x34c7cc[_0x236815]={'$like':'%'+_0x1e258c[_0xb59a('0x2d')][_0xb59a('0x3b')]+'%'};return _0x34c7cc;})});}_0x1db2d9=_[_0xb59a('0x3c')]({},_0x1db2d9,_0x1e258c[_0xb59a('0x3e')]);return _0x26fdec[_0xb59a('0x50')](_0x1db2d9);}})[_0xb59a('0x23')](function(_0x545836){if(_0x545836){_0x16e298=_0x545836[_0xb59a('0x33')];if(!_0x1e258c['query'][_0xb59a('0x35')](_0xb59a('0x51'))){_0x1db2d9[_0xb59a('0x36')]=qs[_0xb59a('0x36')](_0x1e258c[_0xb59a('0x2d')][_0xb59a('0x36')]);_0x1db2d9[_0xb59a('0x1c')]=qs[_0xb59a('0x1c')](_0x1e258c[_0xb59a('0x2d')][_0xb59a('0x1c')]);}return _0x26fdec[_0xb59a('0x50')](_0x1db2d9);}})['then'](function(_0xb752f4){if(_0xb752f4){return _0xb752f4?{'count':_0x16e298,'rows':_0xb752f4}:null;}})['then'](respondWithResult(_0x41d0e0,null))[_0xb59a('0x43')](handleError(_0x41d0e0,null));};exports[_0xb59a('0x52')]=function(_0x39b6c6,_0x4249a9,_0x5ef6ad){return db[_0xb59a('0x53')][_0xb59a('0x46')]({'where':{'id':_0x39b6c6[_0xb59a('0x45')]['id']}})[_0xb59a('0x23')](handleEntityNotFound(_0x4249a9,null))[_0xb59a('0x23')](function(_0x353877){if(_0x353877){return _0x353877['addActions'](_0x39b6c6[_0xb59a('0x48')][_0xb59a('0x4d')],_[_0xb59a('0x4e')](_0x39b6c6[_0xb59a('0x48')],[_0xb59a('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x4249a9,null))[_0xb59a('0x43')](handleError(_0x4249a9,null));};exports[_0xb59a('0x54')]=function(_0x418d00,_0x8bfe21,_0x30cb42){var _0x5472a3={};var _0xca3dad={};var _0xb9a2ed;var _0x4f62b8;return db[_0xb59a('0x3f')][_0xb59a('0x4f')]({'where':{'id':_0x418d00['params']['id']}})[_0xb59a('0x23')](handleEntityNotFound(_0x8bfe21,null))[_0xb59a('0x23')](function(_0x38081e){if(_0x38081e){_0xb9a2ed=_0x38081e;_0xca3dad[_0xb59a('0x34')]=_[_0xb59a('0x2e')](db['Action'][_0xb59a('0x28')]);_0xca3dad[_0xb59a('0x2d')]=_[_0xb59a('0x2e')](_0x418d00[_0xb59a('0x2d')]);_0xca3dad[_0xb59a('0x2f')]=_['intersection'](_0xca3dad[_0xb59a('0x34')],_0xca3dad[_0xb59a('0x2d')]);_0x5472a3['attributes']=_[_0xb59a('0x30')](_0xca3dad[_0xb59a('0x34')],qs['fields'](_0x418d00[_0xb59a('0x2d')][_0xb59a('0x31')]));_0x5472a3['attributes']=_0x5472a3['attributes'][_0xb59a('0x33')]?_0x5472a3['attributes']:_0xca3dad['model'];_0x5472a3['order']=qs[_0xb59a('0x38')](_0x418d00[_0xb59a('0x2d')][_0xb59a('0x38')]);_0x5472a3[_0xb59a('0x39')]=qs['filters'](_[_0xb59a('0x3a')](_0x418d00[_0xb59a('0x2d')],_0xca3dad[_0xb59a('0x2f')]));if(_0x418d00['query']['filter']){_0x5472a3[_0xb59a('0x39')]=_[_0xb59a('0x3c')](_0x5472a3['where'],{'$or':_[_0xb59a('0x2c')](_0x5472a3['attributes'],function(_0x10a87d){var _0x268dcf={};_0x268dcf[_0x10a87d]={'$like':'%'+_0x418d00[_0xb59a('0x2d')][_0xb59a('0x3b')]+'%'};return _0x268dcf;})});}_0x5472a3=_[_0xb59a('0x3c')]({},_0x5472a3,_0x418d00[_0xb59a('0x3e')]);return _0xb9a2ed[_0xb59a('0x54')](_0x5472a3);}})['then'](function(_0x5a79c2){if(_0x5a79c2){_0x4f62b8=_0x5a79c2[_0xb59a('0x33')];if(!_0x418d00[_0xb59a('0x2d')]['hasOwnProperty'](_0xb59a('0x51'))){_0x5472a3['limit']=qs[_0xb59a('0x36')](_0x418d00[_0xb59a('0x2d')]['limit']);_0x5472a3[_0xb59a('0x1c')]=qs[_0xb59a('0x1c')](_0x418d00[_0xb59a('0x2d')][_0xb59a('0x1c')]);}return _0xb9a2ed[_0xb59a('0x54')](_0x5472a3);}})[_0xb59a('0x23')](function(_0x9d7f7c){if(_0x9d7f7c){return _0x9d7f7c?{'count':_0x4f62b8,'rows':_0x9d7f7c}:null;}})[_0xb59a('0x23')](respondWithResult(_0x8bfe21,null))[_0xb59a('0x43')](handleError(_0x8bfe21,null));}; \ No newline at end of file +var _0xf1a8=['squel','crypto','jsforce','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','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','error','name','index','map','Automation','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','Condition','find','addConditions','omit','ids','findOne','filters','pick','getConditions','addActions','getActions','Action','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1a11e2,_0x15e913){var _0x100e0c=function(_0x3fabcc){while(--_0x3fabcc){_0x1a11e2['push'](_0x1a11e2['shift']());}};_0x100e0c(++_0x15e913);}(_0xf1a8,0x99));var _0x8f1a=function(_0x17742e,_0x384a1f){_0x17742e=_0x17742e-0x0;var _0x35e5ce=_0xf1a8[_0x17742e];return _0x35e5ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f1a('0x0'));var zipdir=require(_0x8f1a('0x1'));var jsonpatch=require(_0x8f1a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8f1a('0x3'));var Mustache=require(_0x8f1a('0x4'));var util=require(_0x8f1a('0x5'));var path=require('path');var sox=require(_0x8f1a('0x6'));var csv=require(_0x8f1a('0x7'));var ejs=require(_0x8f1a('0x8'));var fs=require('fs');var fs_extra=require(_0x8f1a('0x9'));var _=require(_0x8f1a('0xa'));var squel=require(_0x8f1a('0xb'));var crypto=require(_0x8f1a('0xc'));var jsforce=require(_0x8f1a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8f1a('0x7'));var querystring=require('querystring');var Papa=require(_0x8f1a('0xe'));var Redis=require('ioredis');var authService=require(_0x8f1a('0xf'));var qs=require(_0x8f1a('0x10'));var as=require(_0x8f1a('0x11'));var hardwareService=require(_0x8f1a('0x12'));var logger=require(_0x8f1a('0x13'))('api');var utils=require(_0x8f1a('0x14'));var config=require(_0x8f1a('0x15'));var licenseUtil=require(_0x8f1a('0x16'));var db=require(_0x8f1a('0x17'))['db'];function respondWithStatusCode(_0x5292d7,_0x11dfdc){_0x11dfdc=_0x11dfdc||0xcc;return function(_0x46abcc){if(_0x46abcc){return _0x5292d7[_0x8f1a('0x18')](_0x11dfdc);}return _0x5292d7[_0x8f1a('0x19')](_0x11dfdc)[_0x8f1a('0x1a')]();};}function respondWithResult(_0x379b99,_0x368f29){_0x368f29=_0x368f29||0xc8;return function(_0x1785b4){if(_0x1785b4){return _0x379b99[_0x8f1a('0x19')](_0x368f29)['json'](_0x1785b4);}};}function respondWithFilteredResult(_0x57eb29,_0x5ea785){return function(_0x8f20a2){if(_0x8f20a2){var _0xa20341=typeof _0x5ea785[_0x8f1a('0x1b')]===_0x8f1a('0x1c')&&typeof _0x5ea785[_0x8f1a('0x1d')]===_0x8f1a('0x1c');var _0x2ab10b=_0x8f20a2[_0x8f1a('0x1e')];var _0x3ac5ae=_0xa20341?0x0:_0x5ea785['offset'];var _0xf74199=_0xa20341?_0x8f20a2['count']:_0x5ea785[_0x8f1a('0x1b')]+_0x5ea785['limit'];var _0x545d53;if(_0xf74199>=_0x2ab10b){_0xf74199=_0x2ab10b;_0x545d53=0xc8;}else{_0x545d53=0xce;}_0x57eb29[_0x8f1a('0x19')](_0x545d53);return _0x57eb29[_0x8f1a('0x1f')]('Content-Range',_0x3ac5ae+'-'+_0xf74199+'/'+_0x2ab10b)[_0x8f1a('0x20')](_0x8f20a2);}return null;};}function patchUpdates(_0x2048e9){return function(_0x23557b){try{jsonpatch[_0x8f1a('0x21')](_0x23557b,_0x2048e9,!![]);}catch(_0x31c871){return BPromise[_0x8f1a('0x22')](_0x31c871);}return _0x23557b[_0x8f1a('0x23')]();};}function saveUpdates(_0x578459,_0x2c5ef0){return function(_0x3e3540){if(_0x3e3540){return _0x3e3540[_0x8f1a('0x24')](_0x578459)['then'](function(_0x4d2ac2){return _0x4d2ac2;});}return null;};}function removeEntity(_0x4088ec,_0x5191a3){return function(_0x1aa105){if(_0x1aa105){return _0x1aa105[_0x8f1a('0x25')]()[_0x8f1a('0x26')](function(){_0x4088ec[_0x8f1a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e44aa,_0x48328a){return function(_0x7870cc){if(!_0x7870cc){_0x1e44aa[_0x8f1a('0x18')](0x194);}return _0x7870cc;};}function handleError(_0x1e33bb,_0x3e0f79){_0x3e0f79=_0x3e0f79||0x1f4;return function(_0x5dcfe0){logger[_0x8f1a('0x27')](_0x5dcfe0['stack']);if(_0x5dcfe0[_0x8f1a('0x28')]){delete _0x5dcfe0[_0x8f1a('0x28')];}_0x1e33bb[_0x8f1a('0x19')](_0x3e0f79)['send'](_0x5dcfe0);};}exports[_0x8f1a('0x29')]=function(_0xf3aed2,_0x425aac){var _0x117c5c={},_0x31d93a={},_0x473fed={'count':0x0,'rows':[]};var _0x11ea8e=_[_0x8f1a('0x2a')](db[_0x8f1a('0x2b')]['rawAttributes'],function(_0x54e71d){return{'name':_0x54e71d[_0x8f1a('0x2c')],'type':_0x54e71d[_0x8f1a('0x2d')]['key']};});_0x31d93a[_0x8f1a('0x2e')]=_[_0x8f1a('0x2a')](_0x11ea8e,_0x8f1a('0x28'));_0x31d93a['query']=_[_0x8f1a('0x2f')](_0xf3aed2[_0x8f1a('0x30')]);_0x31d93a['filters']=_[_0x8f1a('0x31')](_0x31d93a['model'],_0x31d93a[_0x8f1a('0x30')]);_0x117c5c[_0x8f1a('0x32')]=_[_0x8f1a('0x31')](_0x31d93a['model'],qs[_0x8f1a('0x33')](_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x117c5c[_0x8f1a('0x32')]=_0x117c5c['attributes'][_0x8f1a('0x34')]?_0x117c5c[_0x8f1a('0x32')]:_0x31d93a['model'];if(!_0xf3aed2['query']['hasOwnProperty'](_0x8f1a('0x35'))){_0x117c5c[_0x8f1a('0x1d')]=qs[_0x8f1a('0x1d')](_0xf3aed2['query']['limit']);_0x117c5c[_0x8f1a('0x1b')]=qs['offset'](_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x1b')]);}_0x117c5c[_0x8f1a('0x36')]=qs[_0x8f1a('0x37')](_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x37')]);_0x117c5c['where']=qs['filters'](_['pick'](_0xf3aed2[_0x8f1a('0x30')],_0x31d93a['filters']),_0x11ea8e);if(_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x38')]){_0x117c5c[_0x8f1a('0x39')]=_[_0x8f1a('0x3a')](_0x117c5c[_0x8f1a('0x39')],{'$or':_[_0x8f1a('0x2a')](_0x11ea8e,function(_0x571b6b){if(_0x571b6b['type']!==_0x8f1a('0x3b')){var _0x370691={};_0x370691[_0x571b6b['name']]={'$like':'%'+_0xf3aed2['query'][_0x8f1a('0x38')]+'%'};return _0x370691;}})});}_0x117c5c=_[_0x8f1a('0x3a')]({},_0x117c5c,_0xf3aed2[_0x8f1a('0x3c')]);var _0x7a4aed={'where':_0x117c5c['where']};return db[_0x8f1a('0x2b')][_0x8f1a('0x1e')](_0x7a4aed)['then'](function(_0x53d1a3){_0x473fed[_0x8f1a('0x1e')]=_0x53d1a3;if(_0xf3aed2['query'][_0x8f1a('0x3d')]){_0x117c5c['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x117c5c);})['then'](function(_0x912fde){_0x473fed[_0x8f1a('0x3e')]=_0x912fde;return _0x473fed;})[_0x8f1a('0x26')](respondWithFilteredResult(_0x425aac,_0x117c5c))[_0x8f1a('0x3f')](handleError(_0x425aac,null));};exports[_0x8f1a('0x40')]=function(_0x9dc320,_0x56bd1f){var _0x938901={'raw':![],'where':{'id':_0x9dc320[_0x8f1a('0x41')]['id']}},_0x2db1a2={};_0x2db1a2['model']=_[_0x8f1a('0x2f')](db[_0x8f1a('0x2b')][_0x8f1a('0x42')]);_0x2db1a2['query']=_[_0x8f1a('0x2f')](_0x9dc320[_0x8f1a('0x30')]);_0x2db1a2['filters']=_[_0x8f1a('0x31')](_0x2db1a2[_0x8f1a('0x2e')],_0x2db1a2['query']);_0x938901['attributes']=_[_0x8f1a('0x31')](_0x2db1a2[_0x8f1a('0x2e')],qs[_0x8f1a('0x33')](_0x9dc320[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x938901[_0x8f1a('0x32')]=_0x938901[_0x8f1a('0x32')][_0x8f1a('0x34')]?_0x938901[_0x8f1a('0x32')]:_0x2db1a2[_0x8f1a('0x2e')];if(_0x9dc320[_0x8f1a('0x30')][_0x8f1a('0x3d')]){_0x938901[_0x8f1a('0x43')]=[{'all':!![]}];}_0x938901=_['merge']({},_0x938901,_0x9dc320[_0x8f1a('0x3c')]);return db['Automation']['find'](_0x938901)['then'](handleEntityNotFound(_0x56bd1f,null))[_0x8f1a('0x26')](respondWithResult(_0x56bd1f,null))['catch'](handleError(_0x56bd1f,null));};exports['create']=function(_0x447b1f,_0x3008c2){return db[_0x8f1a('0x2b')][_0x8f1a('0x44')](_0x447b1f['body'],{})['then'](respondWithResult(_0x3008c2,0xc9))[_0x8f1a('0x3f')](handleError(_0x3008c2,null));};exports[_0x8f1a('0x24')]=function(_0x1c2cc7,_0x50df9f){if(_0x1c2cc7[_0x8f1a('0x45')]['id']){delete _0x1c2cc7[_0x8f1a('0x45')]['id'];}return db[_0x8f1a('0x2b')]['find']({'where':{'id':_0x1c2cc7['params']['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x50df9f,null))['then'](saveUpdates(_0x1c2cc7['body'],null))[_0x8f1a('0x26')](respondWithResult(_0x50df9f,null))['catch'](handleError(_0x50df9f,null));};exports[_0x8f1a('0x25')]=function(_0x50dd7a,_0x2e9800){return db[_0x8f1a('0x2b')]['find']({'where':{'id':_0x50dd7a[_0x8f1a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e9800,null))[_0x8f1a('0x26')](removeEntity(_0x2e9800,null))['catch'](handleError(_0x2e9800,null));};exports['addConditions']=function(_0x55bc69,_0x161730,_0x586d2b){return db[_0x8f1a('0x46')][_0x8f1a('0x47')]({'where':{'id':_0x55bc69[_0x8f1a('0x41')]['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x161730,null))[_0x8f1a('0x26')](function(_0x3fced0){if(_0x3fced0){return _0x3fced0[_0x8f1a('0x48')](_0x55bc69[_0x8f1a('0x45')]['ids'],_[_0x8f1a('0x49')](_0x55bc69[_0x8f1a('0x45')],[_0x8f1a('0x4a'),'id'])||{});}})[_0x8f1a('0x26')](respondWithResult(_0x161730,null))[_0x8f1a('0x3f')](handleError(_0x161730,null));};exports['getConditions']=function(_0x525690,_0x32856f,_0x7cf24d){var _0x28f8ab={};var _0x33813f={};var _0x392b64;var _0x55ef50;return db[_0x8f1a('0x2b')][_0x8f1a('0x4b')]({'where':{'id':_0x525690[_0x8f1a('0x41')]['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x32856f,null))['then'](function(_0x55b7af){if(_0x55b7af){_0x392b64=_0x55b7af;_0x33813f[_0x8f1a('0x2e')]=_['keys'](db[_0x8f1a('0x46')]['rawAttributes']);_0x33813f[_0x8f1a('0x30')]=_[_0x8f1a('0x2f')](_0x525690[_0x8f1a('0x30')]);_0x33813f[_0x8f1a('0x4c')]=_[_0x8f1a('0x31')](_0x33813f[_0x8f1a('0x2e')],_0x33813f[_0x8f1a('0x30')]);_0x28f8ab[_0x8f1a('0x32')]=_['intersection'](_0x33813f[_0x8f1a('0x2e')],qs[_0x8f1a('0x33')](_0x525690[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x28f8ab[_0x8f1a('0x32')]=_0x28f8ab['attributes'][_0x8f1a('0x34')]?_0x28f8ab[_0x8f1a('0x32')]:_0x33813f[_0x8f1a('0x2e')];_0x28f8ab['order']=qs[_0x8f1a('0x37')](_0x525690['query'][_0x8f1a('0x37')]);_0x28f8ab[_0x8f1a('0x39')]=qs[_0x8f1a('0x4c')](_[_0x8f1a('0x4d')](_0x525690[_0x8f1a('0x30')],_0x33813f[_0x8f1a('0x4c')]));if(_0x525690[_0x8f1a('0x30')][_0x8f1a('0x38')]){_0x28f8ab[_0x8f1a('0x39')]=_['merge'](_0x28f8ab['where'],{'$or':_[_0x8f1a('0x2a')](_0x28f8ab[_0x8f1a('0x32')],function(_0x36c8b4){var _0x126a27={};_0x126a27[_0x36c8b4]={'$like':'%'+_0x525690[_0x8f1a('0x30')][_0x8f1a('0x38')]+'%'};return _0x126a27;})});}_0x28f8ab=_[_0x8f1a('0x3a')]({},_0x28f8ab,_0x525690['options']);return _0x392b64[_0x8f1a('0x4e')](_0x28f8ab);}})[_0x8f1a('0x26')](function(_0x9ea851){if(_0x9ea851){_0x55ef50=_0x9ea851[_0x8f1a('0x34')];if(!_0x525690[_0x8f1a('0x30')]['hasOwnProperty']('nolimit')){_0x28f8ab['limit']=qs['limit'](_0x525690[_0x8f1a('0x30')][_0x8f1a('0x1d')]);_0x28f8ab[_0x8f1a('0x1b')]=qs['offset'](_0x525690['query'][_0x8f1a('0x1b')]);}return _0x392b64[_0x8f1a('0x4e')](_0x28f8ab);}})['then'](function(_0x549bf4){if(_0x549bf4){return _0x549bf4?{'count':_0x55ef50,'rows':_0x549bf4}:null;}})[_0x8f1a('0x26')](respondWithResult(_0x32856f,null))[_0x8f1a('0x3f')](handleError(_0x32856f,null));};exports[_0x8f1a('0x4f')]=function(_0xaf4127,_0x7a675c,_0x16a7d7){return db['Action'][_0x8f1a('0x47')]({'where':{'id':_0xaf4127['params']['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x7a675c,null))[_0x8f1a('0x26')](function(_0x14d74c){if(_0x14d74c){return _0x14d74c[_0x8f1a('0x4f')](_0xaf4127[_0x8f1a('0x45')][_0x8f1a('0x4a')],_[_0x8f1a('0x49')](_0xaf4127[_0x8f1a('0x45')],['ids','id'])||{});}})[_0x8f1a('0x26')](respondWithResult(_0x7a675c,null))[_0x8f1a('0x3f')](handleError(_0x7a675c,null));};exports[_0x8f1a('0x50')]=function(_0x2e5c3a,_0x9a7a35,_0x35f4f6){var _0x50c4c9={};var _0x5d1ce2={};var _0x4b388f;var _0x128085;return db['Automation'][_0x8f1a('0x4b')]({'where':{'id':_0x2e5c3a[_0x8f1a('0x41')]['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x9a7a35,null))['then'](function(_0x12a124){if(_0x12a124){_0x4b388f=_0x12a124;_0x5d1ce2[_0x8f1a('0x2e')]=_[_0x8f1a('0x2f')](db[_0x8f1a('0x51')][_0x8f1a('0x42')]);_0x5d1ce2[_0x8f1a('0x30')]=_[_0x8f1a('0x2f')](_0x2e5c3a[_0x8f1a('0x30')]);_0x5d1ce2['filters']=_[_0x8f1a('0x31')](_0x5d1ce2[_0x8f1a('0x2e')],_0x5d1ce2[_0x8f1a('0x30')]);_0x50c4c9[_0x8f1a('0x32')]=_[_0x8f1a('0x31')](_0x5d1ce2[_0x8f1a('0x2e')],qs[_0x8f1a('0x33')](_0x2e5c3a[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x50c4c9[_0x8f1a('0x32')]=_0x50c4c9[_0x8f1a('0x32')][_0x8f1a('0x34')]?_0x50c4c9['attributes']:_0x5d1ce2[_0x8f1a('0x2e')];_0x50c4c9[_0x8f1a('0x36')]=qs[_0x8f1a('0x37')](_0x2e5c3a['query']['sort']);_0x50c4c9[_0x8f1a('0x39')]=qs[_0x8f1a('0x4c')](_['pick'](_0x2e5c3a[_0x8f1a('0x30')],_0x5d1ce2[_0x8f1a('0x4c')]));if(_0x2e5c3a['query'][_0x8f1a('0x38')]){_0x50c4c9[_0x8f1a('0x39')]=_['merge'](_0x50c4c9[_0x8f1a('0x39')],{'$or':_['map'](_0x50c4c9[_0x8f1a('0x32')],function(_0x177194){var _0x3374ec={};_0x3374ec[_0x177194]={'$like':'%'+_0x2e5c3a[_0x8f1a('0x30')][_0x8f1a('0x38')]+'%'};return _0x3374ec;})});}_0x50c4c9=_[_0x8f1a('0x3a')]({},_0x50c4c9,_0x2e5c3a[_0x8f1a('0x3c')]);return _0x4b388f[_0x8f1a('0x50')](_0x50c4c9);}})[_0x8f1a('0x26')](function(_0x23bc96){if(_0x23bc96){_0x128085=_0x23bc96[_0x8f1a('0x34')];if(!_0x2e5c3a[_0x8f1a('0x30')]['hasOwnProperty'](_0x8f1a('0x35'))){_0x50c4c9['limit']=qs[_0x8f1a('0x1d')](_0x2e5c3a['query'][_0x8f1a('0x1d')]);_0x50c4c9[_0x8f1a('0x1b')]=qs['offset'](_0x2e5c3a['query'][_0x8f1a('0x1b')]);}return _0x4b388f[_0x8f1a('0x50')](_0x50c4c9);}})['then'](function(_0x54de99){if(_0x54de99){return _0x54de99?{'count':_0x128085,'rows':_0x54de99}:null;}})[_0x8f1a('0x26')](respondWithResult(_0x9a7a35,null))[_0x8f1a('0x3f')](handleError(_0x9a7a35,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8fd3d5b..24e6204 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 _0x7de4=['exports','Automation','tools_automations','util','../../config/logger','api','rimraf','../../config/environment'];(function(_0x315250,_0x47ea02){var _0x3bf38d=function(_0x4b469c){while(--_0x4b469c){_0x315250['push'](_0x315250['shift']());}};_0x3bf38d(++_0x47ea02);}(_0x7de4,0x103));var _0x47de=function(_0x2b8a1b,_0x3e025a){_0x2b8a1b=_0x2b8a1b-0x0;var _0x2ca87c=_0x7de4[_0x2b8a1b];return _0x2ca87c;};'use strict';var _=require('lodash');var util=require(_0x47de('0x0'));var logger=require(_0x47de('0x1'))(_0x47de('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(_0x47de('0x3'));var config=require(_0x47de('0x4'));var attributes=require('./automation.attributes');module[_0x47de('0x5')]=function(_0x503835,_0x4afc22){return _0x503835['define'](_0x47de('0x6'),attributes,{'tableName':_0x47de('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb8d=['define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports'];(function(_0x5f39ba,_0x319415){var _0x22b87b=function(_0x33afcd){while(--_0x33afcd){_0x5f39ba['push'](_0x5f39ba['shift']());}};_0x22b87b(++_0x319415);}(_0xdb8d,0x1af));var _0xddb8=function(_0x3d61b1,_0x2c749d){_0x3d61b1=_0x3d61b1-0x0;var _0x1309cb=_0xdb8d[_0x3d61b1];return _0x1309cb;};'use strict';var _=require(_0xddb8('0x0'));var util=require(_0xddb8('0x1'));var logger=require(_0xddb8('0x2'))(_0xddb8('0x3'));var moment=require(_0xddb8('0x4'));var BPromise=require(_0xddb8('0x5'));var rp=require(_0xddb8('0x6'));var fs=require('fs');var path=require(_0xddb8('0x7'));var rimraf=require('rimraf');var config=require(_0xddb8('0x8'));var attributes=require(_0xddb8('0x9'));module[_0xddb8('0xa')]=function(_0x81c7fe,_0xd95b90){return _0x81c7fe[_0xddb8('0xb')](_0xddb8('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 30fe012..6e6a391 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 _0x758a=['bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment'];(function(_0x1308eb,_0x1a9e8){var _0x267813=function(_0x108873){while(--_0x108873){_0x1308eb['push'](_0x1308eb['shift']());}};_0x267813(++_0x1a9e8);}(_0x758a,0x1d1));var _0xa758=function(_0x339abf,_0x34b740){_0x339abf=_0x339abf-0x0;var _0x2e0e53=_0x758a[_0x339abf];return _0x2e0e53;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var moment=require(_0xa758('0x2'));var BPromise=require(_0xa758('0x3'));var rs=require(_0xa758('0x4'));var fs=require('fs');var Redis=require(_0xa758('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa758('0x6'));var config=require('../../config/environment');var jayson=require(_0xa758('0x7'));var client=jayson[_0xa758('0x8')][_0xa758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57bdd1,_0x4b0de4,_0x6c8d0c){return new BPromise(function(_0x377e5e,_0x7bfa2c){return client[_0xa758('0xa')](_0x57bdd1,_0x6c8d0c)[_0xa758('0xb')](function(_0x44098b){logger['info'](_0xa758('0xc'),_0x4b0de4,'request\x20sent');logger['debug'](_0xa758('0xd'),_0x4b0de4,_0xa758('0xe'),JSON['stringify'](_0x44098b));if(_0x44098b[_0xa758('0xf')]){if(_0x44098b[_0xa758('0xf')][_0xa758('0x10')]===0x1f4){logger[_0xa758('0xf')](_0xa758('0xc'),_0x4b0de4,_0x44098b[_0xa758('0xf')][_0xa758('0x11')]);return _0x7bfa2c(_0x44098b['error']['message']);}logger[_0xa758('0xf')]('Automation,\x20%s,\x20%s',_0x4b0de4,_0x44098b['error'][_0xa758('0x11')]);return _0x377e5e(_0x44098b[_0xa758('0xf')][_0xa758('0x11')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x4b0de4,_0xa758('0xe'));_0x377e5e(_0x44098b['result'][_0xa758('0x11')]);}})['catch'](function(_0x1da460){logger['error'](_0xa758('0xc'),_0x4b0de4,_0x1da460);_0x7bfa2c(_0x1da460);});});} \ No newline at end of file +var _0x0ac0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0ac0,0x130));var _0x00ac=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0x0ac0[_0x1bb812];return _0x372adb;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var moment=require(_0x00ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x00ac('0x3'));var fs=require('fs');var Redis=require(_0x00ac('0x4'));var db=require(_0x00ac('0x5'))['db'];var utils=require(_0x00ac('0x6'));var logger=require(_0x00ac('0x7'))(_0x00ac('0x8'));var config=require(_0x00ac('0x9'));var jayson=require(_0x00ac('0xa'));var client=jayson['client'][_0x00ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2a17e,_0x3546f0,_0x282faa){return new BPromise(function(_0x4427de,_0x121a9e){return client[_0x00ac('0xc')](_0xa2a17e,_0x282faa)['then'](function(_0x48c47e){logger[_0x00ac('0xd')](_0x00ac('0xe'),_0x3546f0,_0x00ac('0xf'));logger[_0x00ac('0x10')](_0x00ac('0x11'),_0x3546f0,'request\x20sent',JSON[_0x00ac('0x12')](_0x48c47e));if(_0x48c47e['error']){if(_0x48c47e[_0x00ac('0x13')]['code']===0x1f4){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x48c47e[_0x00ac('0x13')][_0x00ac('0x14')]);return _0x121a9e(_0x48c47e['error']['message']);}logger[_0x00ac('0x13')]('Automation,\x20%s,\x20%s',_0x3546f0,_0x48c47e['error'][_0x00ac('0x14')]);return _0x4427de(_0x48c47e[_0x00ac('0x13')]['message']);}else{logger[_0x00ac('0xd')]('Automation,\x20%s,\x20%s',_0x3546f0,'request\x20sent');_0x4427de(_0x48c47e[_0x00ac('0x15')][_0x00ac('0x14')]);}})['catch'](function(_0x66e4ba){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x66e4ba);_0x121a9e(_0x66e4ba);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e0ac5cb..fcd5a4f 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 _0x5826=['post','create','addConditions','addActions','put','delete','destroy','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x5826,0x1ea));var _0x6582=function(_0x17a294,_0x32aed9){_0x17a294=_0x17a294-0x0;var _0x21ea8e=_0x5826[_0x17a294];return _0x21ea8e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6582('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6582('0x1')]();var fs_extra=require(_0x6582('0x2'));var auth=require(_0x6582('0x3'));var interaction=require(_0x6582('0x4'));var config=require(_0x6582('0x5'));var controller=require(_0x6582('0x6'));router[_0x6582('0x7')]('/',auth[_0x6582('0x8')](),controller[_0x6582('0x9')]);router[_0x6582('0x7')](_0x6582('0xa'),auth[_0x6582('0x8')](),controller[_0x6582('0xb')]);router['get'](_0x6582('0xc'),auth[_0x6582('0x8')](),controller[_0x6582('0xd')]);router[_0x6582('0x7')](_0x6582('0xe'),auth[_0x6582('0x8')](),controller[_0x6582('0xf')]);router[_0x6582('0x10')]('/',auth[_0x6582('0x8')](),controller[_0x6582('0x11')]);router[_0x6582('0x10')](_0x6582('0xc'),auth[_0x6582('0x8')](),controller[_0x6582('0x12')]);router[_0x6582('0x10')]('/:id/actions',auth['isAuthenticated'](),controller[_0x6582('0x13')]);router[_0x6582('0x14')](_0x6582('0xa'),auth[_0x6582('0x8')](),controller['update']);router[_0x6582('0x15')](_0x6582('0xa'),auth['isAuthenticated'](),controller[_0x6582('0x16')]);module['exports']=router; \ No newline at end of file +var _0xcc19=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','multer','util','connect-timeout'];(function(_0x1fe63a,_0x2dc8dd){var _0x3fb1ac=function(_0x234755){while(--_0x234755){_0x1fe63a['push'](_0x1fe63a['shift']());}};_0x3fb1ac(++_0x2dc8dd);}(_0xcc19,0xbd));var _0x9cc1=function(_0x585723,_0x25250e){_0x585723=_0x585723-0x0;var _0x54edcf=_0xcc19[_0x585723];return _0x54edcf;};'use strict';var multer=require(_0x9cc1('0x0'));var util=require(_0x9cc1('0x1'));var path=require('path');var timeout=require(_0x9cc1('0x2'));var express=require(_0x9cc1('0x3'));var router=express[_0x9cc1('0x4')]();var fs_extra=require(_0x9cc1('0x5'));var auth=require(_0x9cc1('0x6'));var interaction=require(_0x9cc1('0x7'));var config=require(_0x9cc1('0x8'));var controller=require(_0x9cc1('0x9'));router[_0x9cc1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9cc1('0xa')](_0x9cc1('0xb'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0xd')]);router[_0x9cc1('0xa')](_0x9cc1('0xe'),auth['isAuthenticated'](),controller[_0x9cc1('0xf')]);router[_0x9cc1('0xa')](_0x9cc1('0x10'),auth[_0x9cc1('0xc')](),controller['getActions']);router[_0x9cc1('0x11')]('/',auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x12')]);router[_0x9cc1('0x11')](_0x9cc1('0xe'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x13')]);router['post'](_0x9cc1('0x10'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x14')]);router[_0x9cc1('0x15')](_0x9cc1('0xb'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x16')]);router[_0x9cc1('0x17')](_0x9cc1('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 800a607..3a33eef 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 _0x16ba=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x49ed79,_0x3db40c){var _0x2174ae=function(_0x1c5498){while(--_0x1c5498){_0x49ed79['push'](_0x49ed79['shift']());}};_0x2174ae(++_0x3db40c);}(_0x16ba,0xd9));var _0xa16b=function(_0x3e5a93,_0x432dc0){_0x3e5a93=_0x3e5a93-0x0;var _0xcd255a=_0x16ba[_0x3e5a93];return _0xcd255a;};'use strict';var Sequelize=require(_0xa16b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa16b('0x1')],'unique':_0xa16b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa16b('0x3')),'allowNull':![],'defaultValue':_0xa16b('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa16b('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xa16b('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa16b('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa16b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa16b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa16b('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa16b('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa16b('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa16b('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'comment':_0xa16b('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xa16b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa16b('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xa16b('0xe')]('always',_0xa16b('0xf'),'onlyIfOpen'),'defaultValue':_0xa16b('0x10')},'dialAMDActive':{'type':Sequelize[_0xa16b('0x4')],'defaultValue':0x0,'comment':_0xa16b('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xa16b('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa16b('0x12')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa16b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa16b('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa16b('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa16b('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa16b('0x5')](0x9)[_0xa16b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa16b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xa16b('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa16b('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa16b('0x5')](0x9)[_0xa16b('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa16b('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa16b('0x5')](0x9)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa16b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa16b('0x5')](0x5)[_0xa16b('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa16b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa16b('0x5')](0x9)[_0xa16b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa16b('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa16b('0xe')](_0xa16b('0x1b'),_0xa16b('0x1c')),'defaultValue':_0xa16b('0x1b')},'dialPrefix':{'type':Sequelize[_0xa16b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa16b('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa16b('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa16b('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa16b('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa16b('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa16b('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa16b('0x5')](0x5)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa16b('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa16b('0x5')](0x5)[_0xa16b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa16b('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa16b('0x5')](0x3)[_0xa16b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa16b('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa16b('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa16b('0x25')}}; \ No newline at end of file +var _0x0320=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x9745b5,_0x44c501){var _0x129f18=function(_0x3db002){while(--_0x3db002){_0x9745b5['push'](_0x9745b5['shift']());}};_0x129f18(++_0x44c501);}(_0x0320,0x104));var _0x0032=function(_0x745e7b,_0x2d6861){_0x745e7b=_0x745e7b-0x0;var _0x28ae75=_0x0320[_0x745e7b];return _0x28ae75;};'use strict';var Sequelize=require('sequelize');module[_0x0032('0x0')]={'name':{'type':Sequelize[_0x0032('0x1')],'unique':_0x0032('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0032('0x3')](_0x0032('0x4')),'allowNull':![],'defaultValue':_0x0032('0x4')},'description':{'type':Sequelize[_0x0032('0x1')]},'active':{'type':Sequelize[_0x0032('0x5')],'defaultValue':0x0,'comment':_0x0032('0x6')},'limitCalls':{'type':Sequelize[_0x0032('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0032('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0032('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0032('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0032('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0032('0x1')],'defaultValue':_0x0032('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x0032('0x3')]('always',_0x0032('0x12'),_0x0032('0x13')),'defaultValue':_0x0032('0x14')},'dialAMDActive':{'type':Sequelize[_0x0032('0x5')],'defaultValue':0x0,'comment':_0x0032('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x0032('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0032('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0032('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0032('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0032('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0032('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0032('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0032('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0032('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0032('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0032('0x3')](_0x0032('0x1c'),'ASC'),'defaultValue':_0x0032('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0032('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0032('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0032('0xa')],'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 cb9eb8f..9ecad9c 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 _0x5276=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','create','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','fromQuery','cmHopperId','OrderBy','h.id','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','error','stack','name','send','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','merge','find'];(function(_0x4200d0,_0xa02562){var _0x56828a=function(_0x169799){while(--_0x169799){_0x4200d0['push'](_0x4200d0['shift']());}};_0x56828a(++_0xa02562);}(_0x5276,0x163));var _0x6527=function(_0x522859,_0x17e7aa){_0x522859=_0x522859-0x0;var _0x37a018=_0x5276[_0x522859];return _0x37a018;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6527('0x0'));var jsonpatch=require(_0x6527('0x1'));var rp=require(_0x6527('0x2'));var moment=require(_0x6527('0x3'));var BPromise=require(_0x6527('0x4'));var Mustache=require(_0x6527('0x5'));var util=require(_0x6527('0x6'));var path=require(_0x6527('0x7'));var sox=require(_0x6527('0x8'));var csv=require(_0x6527('0x9'));var ejs=require(_0x6527('0xa'));var fs=require('fs');var fs_extra=require(_0x6527('0xb'));var _=require(_0x6527('0xc'));var squel=require('squel');var crypto=require(_0x6527('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6527('0xe'));var toCsv=require(_0x6527('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6527('0xf'));var as=require(_0x6527('0x10'));var hardwareService=require(_0x6527('0x11'));var logger=require(_0x6527('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6527('0x13'));var licenseUtil=require(_0x6527('0x14'));var db=require(_0x6527('0x15'))['db'];function respondWithStatusCode(_0x577337,_0x5c3bee){_0x5c3bee=_0x5c3bee||0xcc;return function(_0x5f2990){if(_0x5f2990){return _0x577337[_0x6527('0x16')](_0x5c3bee);}return _0x577337[_0x6527('0x17')](_0x5c3bee)['end']();};}function respondWithResult(_0x23e61a,_0x5287dc){_0x5287dc=_0x5287dc||0xc8;return function(_0x3b56ee){if(_0x3b56ee){return _0x23e61a[_0x6527('0x17')](_0x5287dc)[_0x6527('0x18')](_0x3b56ee);}};}function respondWithFilteredResult(_0x1b7f18,_0x64f951){return function(_0x2fbcef){if(_0x2fbcef){var _0x495c14=typeof _0x64f951[_0x6527('0x19')]==='undefined'&&typeof _0x64f951[_0x6527('0x1a')]===_0x6527('0x1b');var _0x2cb6e9=_0x2fbcef[_0x6527('0x1c')];var _0x508f67=_0x495c14?0x0:_0x64f951[_0x6527('0x19')];var _0x7a2c89=_0x495c14?_0x2fbcef[_0x6527('0x1c')]:_0x64f951[_0x6527('0x19')]+_0x64f951[_0x6527('0x1a')];var _0x5014b2;if(_0x7a2c89>=_0x2cb6e9){_0x7a2c89=_0x2cb6e9;_0x5014b2=0xc8;}else{_0x5014b2=0xce;}_0x1b7f18['status'](_0x5014b2);return _0x1b7f18[_0x6527('0x1d')](_0x6527('0x1e'),_0x508f67+'-'+_0x7a2c89+'/'+_0x2cb6e9)[_0x6527('0x18')](_0x2fbcef);}return null;};}function patchUpdates(_0x20ef21){return function(_0x3352e4){try{jsonpatch[_0x6527('0x1f')](_0x3352e4,_0x20ef21,!![]);}catch(_0x3ba0e0){return BPromise[_0x6527('0x20')](_0x3ba0e0);}return _0x3352e4[_0x6527('0x21')]();};}function saveUpdates(_0x1a569a,_0xa731f8){return function(_0x2e7450){if(_0x2e7450){return _0x2e7450['update'](_0x1a569a)[_0x6527('0x22')](function(_0x7ce319){return _0x7ce319;});}return null;};}function removeEntity(_0x5d81c2,_0xc6d06b){return function(_0x188c3a){if(_0x188c3a){return _0x188c3a[_0x6527('0x23')]()[_0x6527('0x22')](function(){var _0x2b1294=_0x188c3a[_0x6527('0x24')]({'plain':!![]});var _0x8341b=_0x6527('0x25');return db['UserProfileResource'][_0x6527('0x23')]({'where':{'type':_0x8341b,'resourceId':_0x2b1294['id']}})[_0x6527('0x22')](function(){return _0x188c3a;});})[_0x6527('0x22')](function(){_0x5d81c2[_0x6527('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc7305,_0x4b2cde){return function(_0x5c69d4){if(!_0x5c69d4){_0xcc7305[_0x6527('0x16')](0x194);}return _0x5c69d4;};}function handleError(_0x38b8be,_0x3130e6){_0x3130e6=_0x3130e6||0x1f4;return function(_0x4e3616){logger[_0x6527('0x26')](_0x4e3616[_0x6527('0x27')]);if(_0x4e3616[_0x6527('0x28')]){delete _0x4e3616[_0x6527('0x28')];}_0x38b8be[_0x6527('0x17')](_0x3130e6)[_0x6527('0x29')](_0x4e3616);};}exports['index']=function(_0x25b08b,_0x19f894){var _0x1ad33c={},_0x22e2dd={},_0x99997a={'count':0x0,'rows':[]};var _0x54ec7d=_[_0x6527('0x2a')](db[_0x6527('0x2b')]['rawAttributes'],function(_0x41016f){return{'name':_0x41016f[_0x6527('0x2c')],'type':_0x41016f[_0x6527('0x2d')][_0x6527('0x2e')]};});_0x22e2dd[_0x6527('0x2f')]=_[_0x6527('0x2a')](_0x54ec7d,_0x6527('0x28'));_0x22e2dd[_0x6527('0x30')]=_[_0x6527('0x31')](_0x25b08b['query']);_0x22e2dd[_0x6527('0x32')]=_[_0x6527('0x33')](_0x22e2dd[_0x6527('0x2f')],_0x22e2dd[_0x6527('0x30')]);_0x1ad33c['attributes']=_['intersection'](_0x22e2dd[_0x6527('0x2f')],qs['fields'](_0x25b08b[_0x6527('0x30')]['fields']));_0x1ad33c['attributes']=_0x1ad33c[_0x6527('0x34')][_0x6527('0x35')]?_0x1ad33c['attributes']:_0x22e2dd[_0x6527('0x2f')];if(!_0x25b08b[_0x6527('0x30')][_0x6527('0x36')](_0x6527('0x37'))){_0x1ad33c[_0x6527('0x1a')]=qs[_0x6527('0x1a')](_0x25b08b[_0x6527('0x30')][_0x6527('0x1a')]);_0x1ad33c[_0x6527('0x19')]=qs[_0x6527('0x19')](_0x25b08b['query'][_0x6527('0x19')]);}_0x1ad33c[_0x6527('0x38')]=qs['sort'](_0x25b08b[_0x6527('0x30')][_0x6527('0x39')]);_0x1ad33c[_0x6527('0x3a')]=qs['filters'](_[_0x6527('0x3b')](_0x25b08b[_0x6527('0x30')],_0x22e2dd[_0x6527('0x32')]),_0x54ec7d);if(_0x25b08b[_0x6527('0x30')]['filter']){_0x1ad33c['where']=_['merge'](_0x1ad33c[_0x6527('0x3a')],{'$or':_[_0x6527('0x2a')](_0x54ec7d,function(_0x49f82f){if(_0x49f82f[_0x6527('0x2d')]!==_0x6527('0x3c')){var _0xfe3517={};_0xfe3517[_0x49f82f[_0x6527('0x28')]]={'$like':'%'+_0x25b08b['query'][_0x6527('0x3d')]+'%'};return _0xfe3517;}})});}_0x1ad33c=_['merge']({},_0x1ad33c,_0x25b08b[_0x6527('0x3e')]);var _0x1e0e7c={'where':_0x1ad33c[_0x6527('0x3a')]};return db[_0x6527('0x2b')][_0x6527('0x1c')](_0x1e0e7c)[_0x6527('0x22')](function(_0x280dde){_0x99997a[_0x6527('0x1c')]=_0x280dde;if(_0x25b08b[_0x6527('0x30')][_0x6527('0x3f')]){_0x1ad33c[_0x6527('0x40')]=[{'all':!![]}];}return db[_0x6527('0x2b')][_0x6527('0x41')](_0x1ad33c);})[_0x6527('0x22')](function(_0xa904a0){_0x99997a[_0x6527('0x42')]=_0xa904a0;return _0x99997a;})[_0x6527('0x22')](respondWithFilteredResult(_0x19f894,_0x1ad33c))[_0x6527('0x43')](handleError(_0x19f894,null));};exports[_0x6527('0x44')]=function(_0xacffe3,_0x53b432){var _0x3af50f={'raw':![],'where':{'id':_0xacffe3[_0x6527('0x45')]['id']}},_0x11b103={};_0x11b103[_0x6527('0x2f')]=_[_0x6527('0x31')](db[_0x6527('0x2b')][_0x6527('0x46')]);_0x11b103[_0x6527('0x30')]=_[_0x6527('0x31')](_0xacffe3[_0x6527('0x30')]);_0x11b103[_0x6527('0x32')]=_[_0x6527('0x33')](_0x11b103[_0x6527('0x2f')],_0x11b103[_0x6527('0x30')]);_0x3af50f['attributes']=_['intersection'](_0x11b103[_0x6527('0x2f')],qs[_0x6527('0x47')](_0xacffe3[_0x6527('0x30')][_0x6527('0x47')]));_0x3af50f['attributes']=_0x3af50f[_0x6527('0x34')]['length']?_0x3af50f[_0x6527('0x34')]:_0x11b103[_0x6527('0x2f')];if(_0xacffe3[_0x6527('0x30')]['includeAll']){_0x3af50f['include']=[{'all':!![]}];}_0x3af50f=_[_0x6527('0x48')]({},_0x3af50f,_0xacffe3[_0x6527('0x3e')]);return db[_0x6527('0x2b')][_0x6527('0x49')](_0x3af50f)[_0x6527('0x22')](handleEntityNotFound(_0x53b432,null))['then'](respondWithResult(_0x53b432,null))['catch'](handleError(_0x53b432,null));};exports['create']=function(_0x51a105,_0x42752e){return db['Campaign']['create'](_0x51a105[_0x6527('0x4a')],{})[_0x6527('0x22')](function(_0x576bac){var _0x529f9e=_0x51a105[_0x6527('0x4b')]['get']({'plain':!![]});if(!_0x529f9e)throw new Error(_0x6527('0x4c'));if(_0x529f9e[_0x6527('0x4d')]===_0x6527('0x4b')){var _0x3a10db=_0x576bac[_0x6527('0x24')]({'plain':!![]});var _0x227dcf=_0x6527('0x25');return db[_0x6527('0x4e')][_0x6527('0x49')]({'where':{'name':_0x227dcf,'userProfileId':_0x529f9e[_0x6527('0x4f')]},'raw':!![]})['then'](function(_0x5cb561){if(_0x5cb561&&_0x5cb561[_0x6527('0x50')]===0x0){return db[_0x6527('0x51')]['create']({'name':_0x3a10db[_0x6527('0x28')],'resourceId':_0x3a10db['id'],'type':_0x5cb561[_0x6527('0x28')],'sectionId':_0x5cb561['id']},{})[_0x6527('0x22')](function(){return _0x576bac;});}else{return _0x576bac;}})[_0x6527('0x43')](function(_0x113d33){logger['error'](_0x6527('0x52'),_0x113d33);throw _0x113d33;});}return _0x576bac;})[_0x6527('0x22')](respondWithResult(_0x42752e,0xc9))['catch'](handleError(_0x42752e,null));};exports['clone']=function(_0x4b6977,_0x2f6f54){var _0x4859c6={'where':{'id':_0x4b6977[_0x6527('0x45')]['id']}},_0x303a4b={};_0x303a4b['model']=_[_0x6527('0x31')](db[_0x6527('0x2b')][_0x6527('0x46')]);_0x4859c6['attributes']=_['intersection'](_0x303a4b[_0x6527('0x2f')],qs[_0x6527('0x47')](_0x4b6977[_0x6527('0x30')][_0x6527('0x47')]));_0x4859c6['attributes']=_0x4859c6['attributes'][_0x6527('0x35')]?_0x4859c6[_0x6527('0x34')]:_0x303a4b[_0x6527('0x2f')];if(_0x4b6977[_0x6527('0x30')][_0x6527('0x3f')]){_0x4859c6[_0x6527('0x40')]=[{'all':!![]}];}_0x4859c6=_[_0x6527('0x48')]({},_0x4859c6,_0x4b6977['options']);return db[_0x6527('0x2b')][_0x6527('0x49')](_0x4859c6)[_0x6527('0x22')](handleEntityNotFound(_0x2f6f54,null))[_0x6527('0x22')](function(_0x5c85e4){if(_0x5c85e4){var _0x1243e9=_0x5c85e4[_0x6527('0x24')]({'plain':!![]});_0x1243e9=qs['omit'](_0x1243e9,['id',_0x6527('0x53'),_0x6527('0x54')]);_0x4b6977[_0x6527('0x4a')]=_[_0x6527('0x55')](_0x4b6977[_0x6527('0x4a')],['id',_0x6527('0x53'),_0x6527('0x54')]);return db[_0x6527('0x2b')][_0x6527('0x56')](_['merge'](_0x1243e9,_0x4b6977[_0x6527('0x4a')]),{'include':_0x4b6977[_0x6527('0x30')][_0x6527('0x3f')]?[{'all':!![]}]:undefined})[_0x6527('0x22')](function(_0x1b9d82){var _0x82ade1=_0x4b6977['user'][_0x6527('0x24')]({'plain':!![]});if(!_0x82ade1)throw new Error(_0x6527('0x4c'));if(_0x82ade1[_0x6527('0x4d')]===_0x6527('0x4b')){var _0x2ac14e=_0x1b9d82[_0x6527('0x24')]({'plain':!![]});var _0x5d8206=_0x6527('0x25');return db[_0x6527('0x4e')]['find']({'where':{'name':_0x5d8206,'userProfileId':_0x82ade1[_0x6527('0x4f')]},'raw':!![]})[_0x6527('0x22')](function(_0x130a8b){if(_0x130a8b&&_0x130a8b['autoAssociation']===0x0){return db['UserProfileResource'][_0x6527('0x56')]({'name':_0x2ac14e['name'],'resourceId':_0x2ac14e['id'],'type':_0x130a8b[_0x6527('0x28')],'sectionId':_0x130a8b['id']},{})[_0x6527('0x22')](function(){return _0x1b9d82;});}else{return _0x1b9d82;}})['catch'](function(_0x4c6272){logger[_0x6527('0x26')](_0x6527('0x52'),_0x4c6272);throw _0x4c6272;});}return _0x1b9d82;});}})[_0x6527('0x22')](respondWithResult(_0x2f6f54,0xc9))[_0x6527('0x43')](handleError(_0x2f6f54,null));};exports['update']=function(_0x5864a8,_0x180104){if(_0x5864a8[_0x6527('0x4a')]['id']){delete _0x5864a8[_0x6527('0x4a')]['id'];}return db['Campaign'][_0x6527('0x49')]({'where':{'id':_0x5864a8[_0x6527('0x45')]['id']}})['then'](handleEntityNotFound(_0x180104,null))[_0x6527('0x22')](saveUpdates(_0x5864a8[_0x6527('0x4a')],null))[_0x6527('0x22')](respondWithResult(_0x180104,null))[_0x6527('0x43')](handleError(_0x180104,null));};exports[_0x6527('0x23')]=function(_0x446e5e,_0x5bc4c6){return db[_0x6527('0x2b')][_0x6527('0x49')]({'where':{'id':_0x446e5e[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x5bc4c6,null))[_0x6527('0x22')](removeEntity(_0x5bc4c6,null))['catch'](handleError(_0x5bc4c6,null));};exports['getHoppers']=function(_0x367b08,_0x1f1f1e,_0x5e7bc5){var _0x2a5613={'raw':!![],'where':{}};var _0x346cb7={};var _0x17b4e4={'count':0x0,'rows':[]};return db[_0x6527('0x2b')][_0x6527('0x57')]({'where':{'id':_0x367b08[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x1f1f1e,null))[_0x6527('0x22')](function(_0x26b784){if(_0x26b784){_0x346cb7[_0x6527('0x2f')]=_[_0x6527('0x31')](db['CmHopper']['rawAttributes']);_0x346cb7['query']=_['keys'](_0x367b08[_0x6527('0x30')]);_0x346cb7[_0x6527('0x32')]=_['intersection'](_0x346cb7[_0x6527('0x2f')],_0x346cb7[_0x6527('0x30')]);_0x2a5613[_0x6527('0x34')]=_[_0x6527('0x33')](_0x346cb7[_0x6527('0x2f')],qs[_0x6527('0x47')](_0x367b08[_0x6527('0x30')][_0x6527('0x47')]));_0x2a5613[_0x6527('0x34')]=_0x2a5613[_0x6527('0x34')][_0x6527('0x35')]?_0x2a5613[_0x6527('0x34')]:_0x346cb7[_0x6527('0x2f')];if(!_0x367b08[_0x6527('0x30')]['hasOwnProperty'](_0x6527('0x37'))){_0x2a5613[_0x6527('0x1a')]=qs[_0x6527('0x1a')](_0x367b08[_0x6527('0x30')][_0x6527('0x1a')]);_0x2a5613[_0x6527('0x19')]=qs['offset'](_0x367b08[_0x6527('0x30')]['offset']);}_0x2a5613[_0x6527('0x38')]=qs[_0x6527('0x39')](_0x367b08['query'][_0x6527('0x39')]);_0x2a5613[_0x6527('0x3a')]=qs[_0x6527('0x32')](_[_0x6527('0x3b')](_0x367b08[_0x6527('0x30')],_0x346cb7[_0x6527('0x32')]));_0x2a5613[_0x6527('0x3a')][_0x6527('0x58')]=_0x26b784['id'];if(_0x367b08[_0x6527('0x30')][_0x6527('0x3d')]){_0x2a5613[_0x6527('0x3a')]=_[_0x6527('0x48')](_0x2a5613[_0x6527('0x3a')],{'$or':_[_0x6527('0x2a')](_0x2a5613[_0x6527('0x34')],function(_0x5458c9){var _0x17de3c={};_0x17de3c[_0x5458c9]={'$like':'%'+_0x367b08['query']['filter']+'%'};return _0x17de3c;})});}_0x2a5613=_['merge']({},_0x2a5613,_0x367b08[_0x6527('0x3e')]);return db[_0x6527('0x59')][_0x6527('0x1c')]({'where':_0x2a5613[_0x6527('0x3a')]})[_0x6527('0x22')](function(_0x6c131){_0x17b4e4['count']=_0x6c131;if(_0x367b08[_0x6527('0x30')][_0x6527('0x3f')]){_0x2a5613[_0x6527('0x40')]=[{'all':!![]}];}return db[_0x6527('0x59')][_0x6527('0x41')](_0x2a5613);})['then'](function(_0x50fe07){_0x17b4e4[_0x6527('0x42')]=_0x50fe07;return _0x17b4e4;});}})['then'](respondWithFilteredResult(_0x1f1f1e,_0x2a5613))[_0x6527('0x43')](handleError(_0x1f1f1e,null));};exports[_0x6527('0x5a')]=function(_0x36a431,_0x5c0387,_0x3ce872){var _0x41f31f={'raw':!![],'where':{}};var _0x43e672={};var _0x511800={'count':0x0,'rows':[]};return db[_0x6527('0x2b')][_0x6527('0x57')]({'where':{'id':_0x36a431[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x5c0387,null))[_0x6527('0x22')](function(_0x4cfdbf){if(_0x4cfdbf){_0x43e672[_0x6527('0x2f')]=_[_0x6527('0x31')](db[_0x6527('0x5b')][_0x6527('0x46')]);_0x43e672[_0x6527('0x30')]=_[_0x6527('0x31')](_0x36a431[_0x6527('0x30')]);_0x43e672['filters']=_[_0x6527('0x33')](_0x43e672['model'],_0x43e672[_0x6527('0x30')]);_0x41f31f[_0x6527('0x34')]=_[_0x6527('0x33')](_0x43e672['model'],qs[_0x6527('0x47')](_0x36a431[_0x6527('0x30')][_0x6527('0x47')]));_0x41f31f[_0x6527('0x34')]=_0x41f31f[_0x6527('0x34')][_0x6527('0x35')]?_0x41f31f[_0x6527('0x34')]:_0x43e672[_0x6527('0x2f')];if(!_0x36a431[_0x6527('0x30')][_0x6527('0x36')](_0x6527('0x37'))){_0x41f31f[_0x6527('0x1a')]=qs[_0x6527('0x1a')](_0x36a431[_0x6527('0x30')][_0x6527('0x1a')]);_0x41f31f[_0x6527('0x19')]=qs['offset'](_0x36a431['query'][_0x6527('0x19')]);}_0x41f31f[_0x6527('0x38')]=qs[_0x6527('0x39')](_0x36a431[_0x6527('0x30')]['sort']);_0x41f31f[_0x6527('0x3a')]=qs[_0x6527('0x32')](_[_0x6527('0x3b')](_0x36a431[_0x6527('0x30')],_0x43e672[_0x6527('0x32')]));_0x41f31f[_0x6527('0x3a')]['CampaignId']=_0x4cfdbf['id'];if(_0x36a431[_0x6527('0x30')][_0x6527('0x3d')]){_0x41f31f[_0x6527('0x3a')]=_[_0x6527('0x48')](_0x41f31f['where'],{'$or':_[_0x6527('0x2a')](_0x41f31f[_0x6527('0x34')],function(_0x344832){var _0x5e2eb9={};_0x5e2eb9[_0x344832]={'$like':'%'+_0x36a431['query']['filter']+'%'};return _0x5e2eb9;})});}_0x41f31f=_[_0x6527('0x48')]({},_0x41f31f,_0x36a431['options']);return db[_0x6527('0x5b')]['count']({'where':_0x41f31f[_0x6527('0x3a')]})['then'](function(_0x4548d7){_0x511800['count']=_0x4548d7;if(_0x36a431[_0x6527('0x30')]['includeAll']){_0x41f31f[_0x6527('0x40')]=[{'all':!![]}];}return db[_0x6527('0x5b')][_0x6527('0x41')](_0x41f31f);})[_0x6527('0x22')](function(_0x13572b){_0x511800[_0x6527('0x42')]=_0x13572b;return _0x511800;});}})['then'](respondWithFilteredResult(_0x5c0387,_0x41f31f))[_0x6527('0x43')](handleError(_0x5c0387,null));};exports[_0x6527('0x5c')]=function(_0x5b0f4f,_0x4e387a,_0x45a745){var _0x5a8626={'raw':!![],'where':{}};var _0x11749c={};var _0xfb8663={'count':0x0,'rows':[]};return db[_0x6527('0x2b')][_0x6527('0x57')]({'where':{'id':_0x5b0f4f[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x4e387a,null))[_0x6527('0x22')](function(_0x1b6b47){if(_0x1b6b47){_0x11749c[_0x6527('0x2f')]=_[_0x6527('0x31')](db['CmHopperFinal'][_0x6527('0x46')]);_0x11749c[_0x6527('0x30')]=_[_0x6527('0x31')](_0x5b0f4f[_0x6527('0x30')]);_0x11749c[_0x6527('0x32')]=_[_0x6527('0x33')](_0x11749c[_0x6527('0x2f')],_0x11749c[_0x6527('0x30')]);_0x5a8626[_0x6527('0x34')]=_['intersection'](_0x11749c[_0x6527('0x2f')],qs[_0x6527('0x47')](_0x5b0f4f[_0x6527('0x30')][_0x6527('0x47')]));_0x5a8626['attributes']=_0x5a8626['attributes']['length']?_0x5a8626[_0x6527('0x34')]:_0x11749c[_0x6527('0x2f')];if(!_0x5b0f4f[_0x6527('0x30')][_0x6527('0x36')](_0x6527('0x37'))){_0x5a8626[_0x6527('0x1a')]=qs[_0x6527('0x1a')](_0x5b0f4f[_0x6527('0x30')][_0x6527('0x1a')]);_0x5a8626[_0x6527('0x19')]=qs[_0x6527('0x19')](_0x5b0f4f[_0x6527('0x30')]['offset']);}_0x5a8626[_0x6527('0x38')]=qs[_0x6527('0x39')](_0x5b0f4f['query'][_0x6527('0x39')]);_0x5a8626['where']=qs[_0x6527('0x32')](_['pick'](_0x5b0f4f[_0x6527('0x30')],_0x11749c['filters']));_0x5a8626[_0x6527('0x3a')]['CampaignId']=_0x1b6b47['id'];if(_0x5b0f4f['query'][_0x6527('0x3d')]){_0x5a8626[_0x6527('0x3a')]=_[_0x6527('0x48')](_0x5a8626[_0x6527('0x3a')],{'$or':_['map'](_0x5a8626[_0x6527('0x34')],function(_0x12ce90){var _0x491714={};_0x491714[_0x12ce90]={'$like':'%'+_0x5b0f4f[_0x6527('0x30')][_0x6527('0x3d')]+'%'};return _0x491714;})});}_0x5a8626=_['merge']({},_0x5a8626,_0x5b0f4f['options']);return db['CmHopperFinal']['count']({'where':_0x5a8626[_0x6527('0x3a')]})[_0x6527('0x22')](function(_0x344d3a){_0xfb8663['count']=_0x344d3a;if(_0x5b0f4f[_0x6527('0x30')][_0x6527('0x3f')]){_0x5a8626['include']=[{'all':!![]}];}return db[_0x6527('0x5d')][_0x6527('0x41')](_0x5a8626);})[_0x6527('0x22')](function(_0x17ece6){_0xfb8663[_0x6527('0x42')]=_0x17ece6;return _0xfb8663;});}})['then'](respondWithFilteredResult(_0x4e387a,_0x5a8626))[_0x6527('0x43')](handleError(_0x4e387a,null));};exports[_0x6527('0x5e')]=function(_0x3065a4,_0x342ada,_0x2c48e6){var _0x386fb8={'raw':!![],'where':{}};var _0x2c0f92={};var _0x2e57d5={'count':0x0,'rows':[]};return db[_0x6527('0x2b')][_0x6527('0x57')]({'where':{'id':_0x3065a4['params']['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x342ada,null))['then'](function(_0x4d6b39){if(_0x4d6b39){_0x2c0f92[_0x6527('0x2f')]=_[_0x6527('0x31')](db[_0x6527('0x5f')][_0x6527('0x46')]);_0x2c0f92[_0x6527('0x30')]=_[_0x6527('0x31')](_0x3065a4[_0x6527('0x30')]);_0x2c0f92['filters']=_[_0x6527('0x33')](_0x2c0f92[_0x6527('0x2f')],_0x2c0f92[_0x6527('0x30')]);_0x386fb8[_0x6527('0x34')]=_[_0x6527('0x33')](_0x2c0f92['model'],qs[_0x6527('0x47')](_0x3065a4[_0x6527('0x30')][_0x6527('0x47')]));_0x386fb8[_0x6527('0x34')]=_0x386fb8[_0x6527('0x34')]['length']?_0x386fb8[_0x6527('0x34')]:_0x2c0f92[_0x6527('0x2f')];if(!_0x3065a4[_0x6527('0x30')][_0x6527('0x36')](_0x6527('0x37'))){_0x386fb8[_0x6527('0x1a')]=qs[_0x6527('0x1a')](_0x3065a4['query']['limit']);_0x386fb8[_0x6527('0x19')]=qs[_0x6527('0x19')](_0x3065a4[_0x6527('0x30')][_0x6527('0x19')]);}_0x386fb8[_0x6527('0x38')]=qs[_0x6527('0x39')](_0x3065a4['query'][_0x6527('0x39')]);_0x386fb8[_0x6527('0x3a')]=qs[_0x6527('0x32')](_[_0x6527('0x3b')](_0x3065a4[_0x6527('0x30')],_0x2c0f92[_0x6527('0x32')]));_0x386fb8[_0x6527('0x3a')][_0x6527('0x58')]=_0x4d6b39['id'];if(_0x3065a4[_0x6527('0x30')]['filter']){_0x386fb8[_0x6527('0x3a')]=_[_0x6527('0x48')](_0x386fb8[_0x6527('0x3a')],{'$or':_[_0x6527('0x2a')](_0x386fb8[_0x6527('0x34')],function(_0x753407){var _0x5498e1={};_0x5498e1[_0x753407]={'$like':'%'+_0x3065a4['query'][_0x6527('0x3d')]+'%'};return _0x5498e1;})});}_0x386fb8=_['merge']({},_0x386fb8,_0x3065a4[_0x6527('0x3e')]);return db[_0x6527('0x5f')][_0x6527('0x1c')]({'where':_0x386fb8['where']})[_0x6527('0x22')](function(_0x47e21b){_0x2e57d5['count']=_0x47e21b;if(_0x3065a4[_0x6527('0x30')][_0x6527('0x3f')]){_0x386fb8['include']=[{'all':!![]}];}return db[_0x6527('0x5f')]['findAll'](_0x386fb8);})['then'](function(_0x3f0d5b){_0x2e57d5[_0x6527('0x42')]=_0x3f0d5b;return _0x2e57d5;});}})[_0x6527('0x22')](respondWithFilteredResult(_0x342ada,_0x386fb8))[_0x6527('0x43')](handleError(_0x342ada,null));};exports[_0x6527('0x60')]=function(_0x3637fc,_0x47416f,_0xc2b66){var _0x4e8b64={};var _0xb704aa={};var _0x1dbb51;var _0x47f479;return db[_0x6527('0x2b')][_0x6527('0x57')]({'where':{'id':_0x3637fc[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x47416f,null))[_0x6527('0x22')](function(_0x2271d8){if(_0x2271d8){_0x1dbb51=_0x2271d8;_0xb704aa[_0x6527('0x2f')]=_[_0x6527('0x31')](db[_0x6527('0x61')][_0x6527('0x46')]);_0xb704aa[_0x6527('0x30')]=_[_0x6527('0x31')](_0x3637fc[_0x6527('0x30')]);_0xb704aa[_0x6527('0x32')]=_['intersection'](_0xb704aa[_0x6527('0x2f')],_0xb704aa['query']);_0x4e8b64[_0x6527('0x34')]=_[_0x6527('0x33')](_0xb704aa[_0x6527('0x2f')],qs[_0x6527('0x47')](_0x3637fc[_0x6527('0x30')][_0x6527('0x47')]));_0x4e8b64[_0x6527('0x34')]=_0x4e8b64[_0x6527('0x34')][_0x6527('0x35')]?_0x4e8b64[_0x6527('0x34')]:_0xb704aa[_0x6527('0x2f')];_0x4e8b64[_0x6527('0x38')]=qs[_0x6527('0x39')](_0x3637fc[_0x6527('0x30')][_0x6527('0x39')]);_0x4e8b64[_0x6527('0x3a')]=qs[_0x6527('0x32')](_[_0x6527('0x3b')](_0x3637fc[_0x6527('0x30')],_0xb704aa[_0x6527('0x32')]));if(_0x3637fc[_0x6527('0x30')][_0x6527('0x3d')]){_0x4e8b64[_0x6527('0x3a')]=_[_0x6527('0x48')](_0x4e8b64[_0x6527('0x3a')],{'$or':_[_0x6527('0x2a')](_0x4e8b64['attributes'],function(_0x287bd6){var _0x5b99f3={};_0x5b99f3[_0x287bd6]={'$like':'%'+_0x3637fc[_0x6527('0x30')][_0x6527('0x3d')]+'%'};return _0x5b99f3;})});}_0x4e8b64=_[_0x6527('0x48')]({},_0x4e8b64,_0x3637fc[_0x6527('0x3e')]);return _0x1dbb51[_0x6527('0x60')](_0x4e8b64);}})['then'](function(_0x467627){if(_0x467627){_0x47f479=_0x467627[_0x6527('0x35')];if(!_0x3637fc[_0x6527('0x30')][_0x6527('0x36')](_0x6527('0x37'))){_0x4e8b64[_0x6527('0x1a')]=qs[_0x6527('0x1a')](_0x3637fc[_0x6527('0x30')][_0x6527('0x1a')]);_0x4e8b64[_0x6527('0x19')]=qs[_0x6527('0x19')](_0x3637fc['query'][_0x6527('0x19')]);}return _0x1dbb51['getLists'](_0x4e8b64);}})[_0x6527('0x22')](function(_0x1a4980){if(_0x1a4980){return _0x1a4980?{'count':_0x47f479,'rows':_0x1a4980}:null;}})[_0x6527('0x22')](respondWithResult(_0x47416f,null))[_0x6527('0x43')](handleError(_0x47416f,null));};exports[_0x6527('0x62')]=function(_0x1cb48b,_0x5b40de,_0x1e9dcc){var _0x2a97e2,_0x50847a;var _0x3f2e3b=[];var _0x1010ec=moment()[_0x6527('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6527('0x2b')]['find']({'where':{'id':_0x1cb48b[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x5b40de,null))[_0x6527('0x22')](function(_0x110deb){if(_0x110deb){_0x50847a=_0x110deb;return _0x110deb[_0x6527('0x62')](_0x1cb48b['body'][_0x6527('0x64')],_[_0x6527('0x55')](_0x1cb48b[_0x6527('0x4a')],[_0x6527('0x64'),'id'])||{});}return null;})[_0x6527('0x65')](function(_0x5a3b6e){var _0xcb0cb3;var _0x5d3319;_0x2a97e2=_0x5a3b6e||[];var _0x2c4fb1=[];if(_0x5a3b6e){for(var _0x5249bd=0x0;_0x5249bd<_0x5a3b6e[_0x6527('0x35')];_0x5249bd+=0x1){var _0x5bbcc0=_0x5a3b6e[_0x5249bd][_0x6527('0x24')]({'plain':!![]});_0x50847a['dialCheckDuplicateType']=_0x1cb48b[_0x6527('0x4a')]['dialCheckDuplicateType']?_0x1cb48b[_0x6527('0x4a')][_0x6527('0x66')]:_0x50847a[_0x6527('0x66')];switch(_0x50847a[_0x6527('0x66')]){case'always':_0xcb0cb3=squel[_0x6527('0x67')]()[_0x6527('0x68')](_0x6527('0x69'))['fromQuery']([_0x6527('0x6a'),_0x6527('0x6b'),_0x6527('0x6c'),_0x6527('0x6d'),_0x6527('0x58'),_0x6527('0x53'),_0x6527('0x54')],squel[_0x6527('0x6e')]()[_0x6527('0x6f')](_0x6527('0x6a'),_0x6527('0x6a'))[_0x6527('0x6f')](_0x6527('0x70'),'scheduledAt')['field']('id',_0x6527('0x6c'))[_0x6527('0x6f')](_0x5bbcc0[_0x6527('0x71')][_0x6527('0x72')](),'ListId')[_0x6527('0x6f')](_0x1cb48b['params']['id'][_0x6527('0x72')](),_0x6527('0x58'))['field']('\x27'+_0x1010ec+'\x27','createdAt')[_0x6527('0x6f')]('\x27'+_0x1010ec+'\x27','updatedAt')[_0x6527('0x73')](_0x6527('0x74'))[_0x6527('0x3a')](_0x6527('0x75'))[_0x6527('0x3a')](_0x6527('0x76'),_0x5bbcc0[_0x6527('0x71')][_0x6527('0x72')]())['where'](_0x6527('0x77'))[_0x6527('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6527('0x6e')]()[_0x6527('0x6f')](_0x6527('0x78'))[_0x6527('0x73')](_0x6527('0x79'))[_0x6527('0x3a')](_0x6527('0x7a'),_0x1cb48b['params']['id'][_0x6527('0x72')]()))[_0x6527('0x3a')](_0x6527('0x7b'),squel[_0x6527('0x6e')]()[_0x6527('0x6f')]('COALESCE(phone,\x27\x27)')[_0x6527('0x73')](_0x6527('0x69'))['where'](_0x6527('0x7a'),_0x1cb48b[_0x6527('0x45')]['id'][_0x6527('0x72')]())))[_0x6527('0x72')]();break;case _0x6527('0x7c'):_0xcb0cb3=squel[_0x6527('0x67')]()[_0x6527('0x68')]('cm_hopper')[_0x6527('0x7d')](['phone',_0x6527('0x6b'),_0x6527('0x6c'),_0x6527('0x6d'),_0x6527('0x58'),_0x6527('0x53'),_0x6527('0x54')],squel[_0x6527('0x6e')]()['field']('phone',_0x6527('0x6a'))[_0x6527('0x6f')](_0x6527('0x70'),'scheduledAt')['field']('id','ContactId')[_0x6527('0x6f')](_0x5bbcc0[_0x6527('0x71')][_0x6527('0x72')](),_0x6527('0x6d'))[_0x6527('0x6f')](_0x1cb48b['params']['id']['toString'](),_0x6527('0x58'))['field']('\x27'+_0x1010ec+'\x27',_0x6527('0x53'))['field']('\x27'+_0x1010ec+'\x27',_0x6527('0x54'))[_0x6527('0x73')](_0x6527('0x74'))[_0x6527('0x3a')](_0x6527('0x75'))[_0x6527('0x3a')](_0x6527('0x76'),_0x5bbcc0[_0x6527('0x71')]['toString']())[_0x6527('0x3a')](_0x6527('0x77'))[_0x6527('0x3a')](_0x6527('0x7b'),squel[_0x6527('0x6e')]()['field']('COALESCE(phone,\x27\x27)')[_0x6527('0x73')](_0x6527('0x69'))[_0x6527('0x3a')]('CampaignId\x20=\x20?',_0x1cb48b[_0x6527('0x45')]['id'][_0x6527('0x72')]())))[_0x6527('0x72')]();break;default:_0xcb0cb3=squel['insert']()['into'](_0x6527('0x69'))[_0x6527('0x7d')](['phone',_0x6527('0x6b'),'ContactId',_0x6527('0x6d'),_0x6527('0x58'),_0x6527('0x53'),'updatedAt'],squel[_0x6527('0x6e')]()[_0x6527('0x6f')](_0x6527('0x6a'),_0x6527('0x6a'))[_0x6527('0x6f')](_0x6527('0x70'),_0x6527('0x6b'))['field']('id','ContactId')['field'](_0x5bbcc0[_0x6527('0x71')][_0x6527('0x72')](),_0x6527('0x6d'))['field'](_0x1cb48b[_0x6527('0x45')]['id'][_0x6527('0x72')](),'CampaignId')[_0x6527('0x6f')]('\x27'+_0x1010ec+'\x27',_0x6527('0x53'))[_0x6527('0x6f')]('\x27'+_0x1010ec+'\x27','updatedAt')['from'](_0x6527('0x74'))[_0x6527('0x3a')](_0x6527('0x75'))[_0x6527('0x3a')](_0x6527('0x76'),_0x5bbcc0[_0x6527('0x71')]['toString']())[_0x6527('0x3a')](_0x6527('0x77')))[_0x6527('0x72')]();}_0x5d3319=squel[_0x6527('0x67')]()[_0x6527('0x68')]('cm_hopper_additional_phones')['fromQuery']([_0x6527('0x7e'),_0x6527('0x6b'),'phone',_0x6527('0x7f'),'createdAt','updatedAt'],squel[_0x6527('0x6e')]()[_0x6527('0x6f')](_0x6527('0x80'),'id')[_0x6527('0x6f')]('NOW()',_0x6527('0x6b'))[_0x6527('0x6f')]('ci.item',_0x6527('0x6a'))[_0x6527('0x6f')]('ci.OrderBY',_0x6527('0x7f'))[_0x6527('0x6f')]('\x27'+_0x1010ec+'\x27',_0x6527('0x53'))[_0x6527('0x6f')]('\x27'+_0x1010ec+'\x27','updatedAt')['from'](_0x6527('0x81'),'ci')[_0x6527('0x82')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x6527('0x83'),_0x5bbcc0[_0x6527('0x71')][_0x6527('0x72')]())[_0x6527('0x3a')](_0x6527('0x84'),_0x1cb48b['params']['id'][_0x6527('0x72')]())['where'](_0x6527('0x85'),_0x1010ec))[_0x6527('0x72')]();_0x2c4fb1[_0x6527('0x86')](db[_0x6527('0x87')][_0x6527('0x30')](_0xcb0cb3));_0x3f2e3b[_0x6527('0x86')](db['sequelize']['query'](_0x5d3319));}return BPromise['all'](_0x2c4fb1);}})[_0x6527('0x22')](function(){return BPromise[_0x6527('0x88')](_0x3f2e3b);})[_0x6527('0x22')](function(){return _0x2a97e2;})[_0x6527('0x22')](respondWithResult(_0x5b40de,null))[_0x6527('0x43')](handleError(_0x5b40de,null));};exports[_0x6527('0x89')]=function(_0x349b73,_0x2f1131,_0x3c0436){return db[_0x6527('0x2b')][_0x6527('0x49')]({'where':{'id':_0x349b73[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x2f1131,null))['then'](function(_0x467717){if(_0x467717){return _0x467717[_0x6527('0x89')](_0x349b73[_0x6527('0x30')][_0x6527('0x64')]);}})[_0x6527('0x22')](function(_0x3da65d){if(_0x3da65d){return db[_0x6527('0x59')]['destroy']({'where':{'ListId':_0x349b73['query'][_0x6527('0x64')],'CampaignId':_0x349b73[_0x6527('0x45')]['id']}})[_0x6527('0x22')](function(){return _0x3da65d;});}})[_0x6527('0x22')](respondWithStatusCode(_0x2f1131,null))['catch'](handleError(_0x2f1131,null));};exports[_0x6527('0x8a')]=function(_0xd54919,_0x39a174,_0x12b2a7){var _0x3d044c={};var _0xd49ae6={};var _0x359fcc;var _0x1b7e78;return db[_0x6527('0x2b')]['findOne']({'where':{'id':_0xd54919[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x39a174,null))[_0x6527('0x22')](function(_0x4287fa){if(_0x4287fa){_0x359fcc=_0x4287fa;_0xd49ae6[_0x6527('0x2f')]=_[_0x6527('0x31')](db[_0x6527('0x61')]['rawAttributes']);_0xd49ae6[_0x6527('0x30')]=_[_0x6527('0x31')](_0xd54919['query']);_0xd49ae6['filters']=_[_0x6527('0x33')](_0xd49ae6[_0x6527('0x2f')],_0xd49ae6[_0x6527('0x30')]);_0x3d044c[_0x6527('0x34')]=_[_0x6527('0x33')](_0xd49ae6[_0x6527('0x2f')],qs[_0x6527('0x47')](_0xd54919[_0x6527('0x30')][_0x6527('0x47')]));_0x3d044c['attributes']=_0x3d044c[_0x6527('0x34')][_0x6527('0x35')]?_0x3d044c[_0x6527('0x34')]:_0xd49ae6[_0x6527('0x2f')];_0x3d044c[_0x6527('0x38')]=qs[_0x6527('0x39')](_0xd54919[_0x6527('0x30')][_0x6527('0x39')]);_0x3d044c[_0x6527('0x3a')]=qs[_0x6527('0x32')](_[_0x6527('0x3b')](_0xd54919[_0x6527('0x30')],_0xd49ae6[_0x6527('0x32')]));if(_0xd54919[_0x6527('0x30')]['filter']){_0x3d044c[_0x6527('0x3a')]=_['merge'](_0x3d044c[_0x6527('0x3a')],{'$or':_['map'](_0x3d044c[_0x6527('0x34')],function(_0x221365){var _0x2c9b93={};_0x2c9b93[_0x221365]={'$like':'%'+_0xd54919[_0x6527('0x30')]['filter']+'%'};return _0x2c9b93;})});}_0x3d044c=_[_0x6527('0x48')]({},_0x3d044c,_0xd54919[_0x6527('0x3e')]);return _0x359fcc[_0x6527('0x8a')](_0x3d044c);}})[_0x6527('0x22')](function(_0x51c9a1){if(_0x51c9a1){_0x1b7e78=_0x51c9a1[_0x6527('0x35')];if(!_0xd54919[_0x6527('0x30')]['hasOwnProperty']('nolimit')){_0x3d044c['limit']=qs[_0x6527('0x1a')](_0xd54919[_0x6527('0x30')][_0x6527('0x1a')]);_0x3d044c[_0x6527('0x19')]=qs['offset'](_0xd54919[_0x6527('0x30')]['offset']);}return _0x359fcc['getBlackLists'](_0x3d044c);}})[_0x6527('0x22')](function(_0x4a88ab){if(_0x4a88ab){return _0x4a88ab?{'count':_0x1b7e78,'rows':_0x4a88ab}:null;}})[_0x6527('0x22')](respondWithResult(_0x39a174,null))['catch'](handleError(_0x39a174,null));};exports[_0x6527('0x8b')]=function(_0x4f361e,_0x9803b7,_0x1447e9){var _0x8bdeb6,_0x50814c;var _0x5dc99e=[];var _0x4ff32d=moment()[_0x6527('0x63')](_0x6527('0x8c'));return db[_0x6527('0x2b')][_0x6527('0x49')]({'where':{'id':_0x4f361e[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x9803b7,null))[_0x6527('0x22')](function(_0x191052){if(_0x191052){_0x50814c=_0x191052;return _0x191052[_0x6527('0x8b')](_0x4f361e[_0x6527('0x4a')]['ids'],_[_0x6527('0x55')](_0x4f361e[_0x6527('0x4a')],['ids','id'])||{});}return null;})['spread'](function(_0x57cd09){var _0x481b58;var _0x333d93;_0x8bdeb6=_0x57cd09||[];var _0x381838=[];if(_0x57cd09){for(var _0x286484=0x0;_0x286484<_0x57cd09[_0x6527('0x35')];_0x286484+=0x1){var _0x4a16d4=_0x57cd09[_0x286484][_0x6527('0x24')]({'plain':!![]});_0x481b58=squel[_0x6527('0x67')]()['into'](_0x6527('0x8d'))[_0x6527('0x7d')](['phone',_0x6527('0x6c'),_0x6527('0x6d'),_0x6527('0x58'),_0x6527('0x53'),_0x6527('0x54')],squel[_0x6527('0x6e')]()[_0x6527('0x6f')](_0x6527('0x6a'),_0x6527('0x6a'))[_0x6527('0x6f')]('id',_0x6527('0x6c'))['field'](_0x4a16d4['CmListId']['toString'](),'ListId')[_0x6527('0x6f')](_0x4f361e[_0x6527('0x45')]['id']['toString'](),'CampaignId')[_0x6527('0x6f')](_0x6527('0x70'),_0x6527('0x53'))[_0x6527('0x6f')](_0x6527('0x70'),_0x6527('0x54'))['from'](_0x6527('0x74'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6527('0x76'),_0x4a16d4[_0x6527('0x71')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6527('0x72')]();_0x381838[_0x6527('0x86')](db[_0x6527('0x87')][_0x6527('0x30')](_0x481b58));}return BPromise[_0x6527('0x88')](_0x381838);}})[_0x6527('0x22')](function(){return _0x8bdeb6;})[_0x6527('0x22')](respondWithResult(_0x9803b7,null))[_0x6527('0x43')](handleError(_0x9803b7,null));};exports[_0x6527('0x8e')]=function(_0x447c63,_0x8c2bee,_0x40be3a){return db[_0x6527('0x2b')][_0x6527('0x49')]({'where':{'id':_0x447c63[_0x6527('0x45')]['id']}})[_0x6527('0x22')](handleEntityNotFound(_0x8c2bee,null))[_0x6527('0x22')](function(_0x326dbe){if(_0x326dbe){return _0x326dbe[_0x6527('0x8e')](_0x447c63['query']['ids']);}})[_0x6527('0x22')](function(_0x29238f){if(_0x29238f){return db[_0x6527('0x5f')][_0x6527('0x23')]({'where':{'ListId':_0x447c63[_0x6527('0x30')][_0x6527('0x64')],'CampaignId':_0x447c63[_0x6527('0x45')]['id']}})['then'](function(){return _0x29238f;});}})[_0x6527('0x22')](respondWithStatusCode(_0x8c2bee,null))[_0x6527('0x43')](handleError(_0x8c2bee,null));}; \ No newline at end of file +var _0x28f2=['stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','Campaign','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filter','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','findOne','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','CmListId','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x28f2,0x193));var _0x228f=function(_0x40b3ee,_0x334d5a){_0x40b3ee=_0x40b3ee-0x0;var _0x2012fa=_0x28f2[_0x40b3ee];return _0x2012fa;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['Campaign'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x53')]=function(_0x561144,_0x3e9f76){var _0x3da11f={'where':{'id':_0x561144[_0x228f('0x54')]['id']}},_0x671142={};_0x671142['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x3da11f[_0x228f('0x38')]=_['intersection'](_0x671142[_0x228f('0x34')],qs[_0x228f('0x39')](_0x561144['query'][_0x228f('0x39')]));_0x3da11f[_0x228f('0x38')]=_0x3da11f[_0x228f('0x38')][_0x228f('0x3a')]?_0x3da11f[_0x228f('0x38')]:_0x671142[_0x228f('0x34')];if(_0x561144[_0x228f('0x35')][_0x228f('0x4a')]){_0x3da11f[_0x228f('0x44')]=[{'all':!![]}];}_0x3da11f=_[_0x228f('0x41')]({},_0x3da11f,_0x561144['options']);return db[_0x228f('0x42')]['find'](_0x3da11f)[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](function(_0x159713){if(_0x159713){var _0x18e97b=_0x159713[_0x228f('0x28')]({'plain':!![]});_0x18e97b=qs[_0x228f('0x55')](_0x18e97b,['id',_0x228f('0x56'),_0x228f('0x57')]);_0x561144['body']=_[_0x228f('0x55')](_0x561144[_0x228f('0x4e')],['id',_0x228f('0x56'),'updatedAt']);return db[_0x228f('0x42')]['create'](_[_0x228f('0x41')](_0x18e97b,_0x561144[_0x228f('0x4e')]),{'include':_0x561144['query'][_0x228f('0x4a')]?[{'all':!![]}]:undefined})[_0x228f('0x26')](function(_0x16318d){var _0xb8200d=_0x561144[_0x228f('0x58')][_0x228f('0x28')]({'plain':!![]});if(!_0xb8200d)throw new Error(_0x228f('0x4f'));if(_0xb8200d[_0x228f('0x50')]===_0x228f('0x58')){var _0x45c9ed=_0x16318d[_0x228f('0x28')]({'plain':!![]});var _0x551133=_0x228f('0x29');return db[_0x228f('0x59')][_0x228f('0x4c')]({'where':{'name':_0x551133,'userProfileId':_0xb8200d[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x506191){if(_0x506191&&_0x506191['autoAssociation']===0x0){return db[_0x228f('0x2a')]['create']({'name':_0x45c9ed[_0x228f('0x2d')],'resourceId':_0x45c9ed['id'],'type':_0x506191['name'],'sectionId':_0x506191['id']},{})[_0x228f('0x26')](function(){return _0x16318d;});}else{return _0x16318d;}})[_0x228f('0x47')](function(_0x53a6a5){logger[_0x228f('0x2b')](_0x228f('0x5a'),_0x53a6a5);throw _0x53a6a5;});}return _0x16318d;});}})[_0x228f('0x26')](respondWithResult(_0x3e9f76,0xc9))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports['update']=function(_0x42dd54,_0x21f860){if(_0x42dd54[_0x228f('0x4e')]['id']){delete _0x42dd54[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x42dd54[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x21f860,null))['then'](saveUpdates(_0x42dd54[_0x228f('0x4e')],null))[_0x228f('0x26')](respondWithResult(_0x21f860,null))[_0x228f('0x47')](handleError(_0x21f860,null));};exports[_0x228f('0x27')]=function(_0x2844d2,_0x4ebf7a){return db[_0x228f('0x42')]['find']({'where':{'id':_0x2844d2[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x4ebf7a,null))['then'](removeEntity(_0x4ebf7a,null))[_0x228f('0x47')](handleError(_0x4ebf7a,null));};exports[_0x228f('0x5b')]=function(_0x260e70,_0x5eb9ed,_0x3e7b01){var _0x2d5d67={'raw':!![],'where':{}};var _0x3d5769={};var _0x58a73f={'count':0x0,'rows':[]};return db[_0x228f('0x42')]['findOne']({'where':{'id':_0x260e70[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x5eb9ed,null))['then'](function(_0x57e896){if(_0x57e896){_0x3d5769[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x5c')][_0x228f('0x31')]);_0x3d5769[_0x228f('0x35')]=_[_0x228f('0x49')](_0x260e70[_0x228f('0x35')]);_0x3d5769[_0x228f('0x36')]=_['intersection'](_0x3d5769[_0x228f('0x34')],_0x3d5769['query']);_0x2d5d67[_0x228f('0x38')]=_[_0x228f('0x37')](_0x3d5769[_0x228f('0x34')],qs[_0x228f('0x39')](_0x260e70[_0x228f('0x35')][_0x228f('0x39')]));_0x2d5d67[_0x228f('0x38')]=_0x2d5d67['attributes']['length']?_0x2d5d67[_0x228f('0x38')]:_0x3d5769[_0x228f('0x34')];if(!_0x260e70[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2d5d67[_0x228f('0x1f')]=qs['limit'](_0x260e70[_0x228f('0x35')][_0x228f('0x1f')]);_0x2d5d67[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0x260e70[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2d5d67[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0x260e70[_0x228f('0x35')]['sort']);_0x2d5d67[_0x228f('0x40')]=qs[_0x228f('0x36')](_['pick'](_0x260e70[_0x228f('0x35')],_0x3d5769[_0x228f('0x36')]));_0x2d5d67['where']['CampaignId']=_0x57e896['id'];if(_0x260e70['query'][_0x228f('0x5d')]){_0x2d5d67['where']=_[_0x228f('0x41')](_0x2d5d67['where'],{'$or':_[_0x228f('0x30')](_0x2d5d67[_0x228f('0x38')],function(_0x5c1a7e){var _0x27ffdd={};_0x27ffdd[_0x5c1a7e]={'$like':'%'+_0x260e70[_0x228f('0x35')][_0x228f('0x5d')]+'%'};return _0x27ffdd;})});}_0x2d5d67=_[_0x228f('0x41')]({},_0x2d5d67,_0x260e70[_0x228f('0x4b')]);return db['CmHopper'][_0x228f('0x43')]({'where':_0x2d5d67[_0x228f('0x40')]})[_0x228f('0x26')](function(_0x265b11){_0x58a73f[_0x228f('0x43')]=_0x265b11;if(_0x260e70[_0x228f('0x35')][_0x228f('0x4a')]){_0x2d5d67[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x5c')]['findAll'](_0x2d5d67);})[_0x228f('0x26')](function(_0x6be7c4){_0x58a73f[_0x228f('0x46')]=_0x6be7c4;return _0x58a73f;});}})['then'](respondWithFilteredResult(_0x5eb9ed,_0x2d5d67))['catch'](handleError(_0x5eb9ed,null));};exports['getHopperHistories']=function(_0x2b9d40,_0x5e3a6e,_0x2d8e23){var _0x304001={'raw':!![],'where':{}};var _0x4b07c4={};var _0x1e24fd={'count':0x0,'rows':[]};return db[_0x228f('0x42')]['findOne']({'where':{'id':_0x2b9d40[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x5e3a6e,null))[_0x228f('0x26')](function(_0x32ea8d){if(_0x32ea8d){_0x4b07c4['model']=_[_0x228f('0x49')](db[_0x228f('0x5e')][_0x228f('0x31')]);_0x4b07c4[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2b9d40[_0x228f('0x35')]);_0x4b07c4[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4b07c4[_0x228f('0x34')],_0x4b07c4['query']);_0x304001[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4b07c4[_0x228f('0x34')],qs[_0x228f('0x39')](_0x2b9d40[_0x228f('0x35')]['fields']));_0x304001['attributes']=_0x304001[_0x228f('0x38')]['length']?_0x304001[_0x228f('0x38')]:_0x4b07c4['model'];if(!_0x2b9d40[_0x228f('0x35')]['hasOwnProperty'](_0x228f('0x3c'))){_0x304001[_0x228f('0x1f')]=qs[_0x228f('0x1f')](_0x2b9d40[_0x228f('0x35')][_0x228f('0x1f')]);_0x304001[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0x2b9d40[_0x228f('0x35')][_0x228f('0x1e')]);}_0x304001[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0x2b9d40[_0x228f('0x35')][_0x228f('0x3e')]);_0x304001[_0x228f('0x40')]=qs[_0x228f('0x36')](_[_0x228f('0x3f')](_0x2b9d40['query'],_0x4b07c4[_0x228f('0x36')]));_0x304001[_0x228f('0x40')][_0x228f('0x5f')]=_0x32ea8d['id'];if(_0x2b9d40['query'][_0x228f('0x5d')]){_0x304001['where']=_['merge'](_0x304001['where'],{'$or':_[_0x228f('0x30')](_0x304001['attributes'],function(_0x22448b){var _0x11dd76={};_0x11dd76[_0x22448b]={'$like':'%'+_0x2b9d40['query'][_0x228f('0x5d')]+'%'};return _0x11dd76;})});}_0x304001=_[_0x228f('0x41')]({},_0x304001,_0x2b9d40['options']);return db[_0x228f('0x5e')][_0x228f('0x43')]({'where':_0x304001['where']})['then'](function(_0x2dfcee){_0x1e24fd[_0x228f('0x43')]=_0x2dfcee;if(_0x2b9d40[_0x228f('0x35')][_0x228f('0x4a')]){_0x304001['include']=[{'all':!![]}];}return db[_0x228f('0x5e')][_0x228f('0x45')](_0x304001);})['then'](function(_0x191bd5){_0x1e24fd[_0x228f('0x46')]=_0x191bd5;return _0x1e24fd;});}})[_0x228f('0x26')](respondWithFilteredResult(_0x5e3a6e,_0x304001))[_0x228f('0x47')](handleError(_0x5e3a6e,null));};exports[_0x228f('0x60')]=function(_0x30157c,_0x2dfaec,_0x25809c){var _0x5a1a8c={'raw':!![],'where':{}};var _0x5a7f73={};var _0x597271={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x30157c['params']['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x2dfaec,null))[_0x228f('0x26')](function(_0x30e525){if(_0x30e525){_0x5a7f73[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x61')][_0x228f('0x31')]);_0x5a7f73['query']=_[_0x228f('0x49')](_0x30157c['query']);_0x5a7f73['filters']=_['intersection'](_0x5a7f73['model'],_0x5a7f73[_0x228f('0x35')]);_0x5a1a8c['attributes']=_[_0x228f('0x37')](_0x5a7f73[_0x228f('0x34')],qs[_0x228f('0x39')](_0x30157c[_0x228f('0x35')]['fields']));_0x5a1a8c[_0x228f('0x38')]=_0x5a1a8c[_0x228f('0x38')][_0x228f('0x3a')]?_0x5a1a8c[_0x228f('0x38')]:_0x5a7f73[_0x228f('0x34')];if(!_0x30157c[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x5a1a8c[_0x228f('0x1f')]=qs[_0x228f('0x1f')](_0x30157c[_0x228f('0x35')]['limit']);_0x5a1a8c['offset']=qs['offset'](_0x30157c[_0x228f('0x35')][_0x228f('0x1e')]);}_0x5a1a8c[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0x30157c[_0x228f('0x35')][_0x228f('0x3e')]);_0x5a1a8c[_0x228f('0x40')]=qs[_0x228f('0x36')](_['pick'](_0x30157c[_0x228f('0x35')],_0x5a7f73[_0x228f('0x36')]));_0x5a1a8c[_0x228f('0x40')][_0x228f('0x5f')]=_0x30e525['id'];if(_0x30157c[_0x228f('0x35')][_0x228f('0x5d')]){_0x5a1a8c[_0x228f('0x40')]=_[_0x228f('0x41')](_0x5a1a8c[_0x228f('0x40')],{'$or':_['map'](_0x5a1a8c[_0x228f('0x38')],function(_0xd9a90f){var _0xecea94={};_0xecea94[_0xd9a90f]={'$like':'%'+_0x30157c['query']['filter']+'%'};return _0xecea94;})});}_0x5a1a8c=_[_0x228f('0x41')]({},_0x5a1a8c,_0x30157c['options']);return db[_0x228f('0x61')][_0x228f('0x43')]({'where':_0x5a1a8c[_0x228f('0x40')]})[_0x228f('0x26')](function(_0x590b79){_0x597271[_0x228f('0x43')]=_0x590b79;if(_0x30157c[_0x228f('0x35')][_0x228f('0x4a')]){_0x5a1a8c[_0x228f('0x44')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5a1a8c);})[_0x228f('0x26')](function(_0x578762){_0x597271[_0x228f('0x46')]=_0x578762;return _0x597271;});}})['then'](respondWithFilteredResult(_0x2dfaec,_0x5a1a8c))['catch'](handleError(_0x2dfaec,null));};exports['getHopperBlacks']=function(_0x2b1172,_0x4865e5,_0x3d20c9){var _0x3067d3={'raw':!![],'where':{}};var _0x21b11f={};var _0x45e5a0={'count':0x0,'rows':[]};return db[_0x228f('0x42')][_0x228f('0x62')]({'where':{'id':_0x2b1172[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x4865e5,null))[_0x228f('0x26')](function(_0x1e8511){if(_0x1e8511){_0x21b11f[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x63')][_0x228f('0x31')]);_0x21b11f[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2b1172[_0x228f('0x35')]);_0x21b11f['filters']=_[_0x228f('0x37')](_0x21b11f[_0x228f('0x34')],_0x21b11f['query']);_0x3067d3[_0x228f('0x38')]=_[_0x228f('0x37')](_0x21b11f[_0x228f('0x34')],qs[_0x228f('0x39')](_0x2b1172['query'][_0x228f('0x39')]));_0x3067d3[_0x228f('0x38')]=_0x3067d3[_0x228f('0x38')][_0x228f('0x3a')]?_0x3067d3[_0x228f('0x38')]:_0x21b11f['model'];if(!_0x2b1172['query'][_0x228f('0x3b')](_0x228f('0x3c'))){_0x3067d3['limit']=qs[_0x228f('0x1f')](_0x2b1172[_0x228f('0x35')][_0x228f('0x1f')]);_0x3067d3['offset']=qs[_0x228f('0x1e')](_0x2b1172[_0x228f('0x35')]['offset']);}_0x3067d3[_0x228f('0x3d')]=qs['sort'](_0x2b1172[_0x228f('0x35')][_0x228f('0x3e')]);_0x3067d3[_0x228f('0x40')]=qs[_0x228f('0x36')](_['pick'](_0x2b1172['query'],_0x21b11f[_0x228f('0x36')]));_0x3067d3['where'][_0x228f('0x5f')]=_0x1e8511['id'];if(_0x2b1172[_0x228f('0x35')][_0x228f('0x5d')]){_0x3067d3[_0x228f('0x40')]=_[_0x228f('0x41')](_0x3067d3['where'],{'$or':_[_0x228f('0x30')](_0x3067d3[_0x228f('0x38')],function(_0x69a9a5){var _0x5e4782={};_0x5e4782[_0x69a9a5]={'$like':'%'+_0x2b1172[_0x228f('0x35')]['filter']+'%'};return _0x5e4782;})});}_0x3067d3=_[_0x228f('0x41')]({},_0x3067d3,_0x2b1172[_0x228f('0x4b')]);return db['CmHopperBlack'][_0x228f('0x43')]({'where':_0x3067d3[_0x228f('0x40')]})[_0x228f('0x26')](function(_0xfbf021){_0x45e5a0['count']=_0xfbf021;if(_0x2b1172[_0x228f('0x35')][_0x228f('0x4a')]){_0x3067d3[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x63')][_0x228f('0x45')](_0x3067d3);})[_0x228f('0x26')](function(_0x57b1d6){_0x45e5a0[_0x228f('0x46')]=_0x57b1d6;return _0x45e5a0;});}})[_0x228f('0x26')](respondWithFilteredResult(_0x4865e5,_0x3067d3))[_0x228f('0x47')](handleError(_0x4865e5,null));};exports[_0x228f('0x64')]=function(_0x43e23d,_0x12c7c1,_0x36c9f7){var _0x543a66={};var _0x4b2196={};var _0x17b3ee;var _0x3a7546;return db[_0x228f('0x42')]['findOne']({'where':{'id':_0x43e23d[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x12c7c1,null))[_0x228f('0x26')](function(_0x46eac4){if(_0x46eac4){_0x17b3ee=_0x46eac4;_0x4b2196[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x65')][_0x228f('0x31')]);_0x4b2196['query']=_[_0x228f('0x49')](_0x43e23d['query']);_0x4b2196[_0x228f('0x36')]=_['intersection'](_0x4b2196['model'],_0x4b2196['query']);_0x543a66['attributes']=_['intersection'](_0x4b2196[_0x228f('0x34')],qs[_0x228f('0x39')](_0x43e23d[_0x228f('0x35')][_0x228f('0x39')]));_0x543a66[_0x228f('0x38')]=_0x543a66[_0x228f('0x38')][_0x228f('0x3a')]?_0x543a66[_0x228f('0x38')]:_0x4b2196[_0x228f('0x34')];_0x543a66['order']=qs[_0x228f('0x3e')](_0x43e23d['query'][_0x228f('0x3e')]);_0x543a66['where']=qs['filters'](_[_0x228f('0x3f')](_0x43e23d[_0x228f('0x35')],_0x4b2196[_0x228f('0x36')]));if(_0x43e23d['query'][_0x228f('0x5d')]){_0x543a66['where']=_[_0x228f('0x41')](_0x543a66[_0x228f('0x40')],{'$or':_[_0x228f('0x30')](_0x543a66[_0x228f('0x38')],function(_0x29e0d7){var _0x13731f={};_0x13731f[_0x29e0d7]={'$like':'%'+_0x43e23d[_0x228f('0x35')]['filter']+'%'};return _0x13731f;})});}_0x543a66=_[_0x228f('0x41')]({},_0x543a66,_0x43e23d[_0x228f('0x4b')]);return _0x17b3ee['getLists'](_0x543a66);}})[_0x228f('0x26')](function(_0x7908b){if(_0x7908b){_0x3a7546=_0x7908b[_0x228f('0x3a')];if(!_0x43e23d[_0x228f('0x35')][_0x228f('0x3b')]('nolimit')){_0x543a66['limit']=qs[_0x228f('0x1f')](_0x43e23d[_0x228f('0x35')]['limit']);_0x543a66[_0x228f('0x1e')]=qs['offset'](_0x43e23d[_0x228f('0x35')][_0x228f('0x1e')]);}return _0x17b3ee['getLists'](_0x543a66);}})[_0x228f('0x26')](function(_0x234a90){if(_0x234a90){return _0x234a90?{'count':_0x3a7546,'rows':_0x234a90}:null;}})['then'](respondWithResult(_0x12c7c1,null))[_0x228f('0x47')](handleError(_0x12c7c1,null));};exports[_0x228f('0x66')]=function(_0x5d4958,_0x1d821a,_0x1a144e){var _0x39c19d,_0x140e7e;var _0x1cda20=[];var _0x21b396=moment()[_0x228f('0x67')](_0x228f('0x68'));return db['Campaign'][_0x228f('0x4c')]({'where':{'id':_0x5d4958[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x1d821a,null))['then'](function(_0x4ee418){if(_0x4ee418){_0x140e7e=_0x4ee418;return _0x4ee418[_0x228f('0x66')](_0x5d4958[_0x228f('0x4e')]['ids'],_['omit'](_0x5d4958['body'],['ids','id'])||{});}return null;})[_0x228f('0x69')](function(_0x3d2266){var _0x4fde48;var _0xb37c02;_0x39c19d=_0x3d2266||[];var _0x3733e5=[];if(_0x3d2266){for(var _0x3eff08=0x0;_0x3eff08<_0x3d2266[_0x228f('0x3a')];_0x3eff08+=0x1){var _0x58ac49=_0x3d2266[_0x3eff08][_0x228f('0x28')]({'plain':!![]});_0x140e7e['dialCheckDuplicateType']=_0x5d4958[_0x228f('0x4e')][_0x228f('0x6a')]?_0x5d4958['body'][_0x228f('0x6a')]:_0x140e7e[_0x228f('0x6a')];switch(_0x140e7e[_0x228f('0x6a')]){case _0x228f('0x6b'):_0x4fde48=squel[_0x228f('0x6c')]()[_0x228f('0x6d')](_0x228f('0x6e'))['fromQuery'](['phone',_0x228f('0x6f'),_0x228f('0x70'),_0x228f('0x71'),_0x228f('0x5f'),_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')](_0x228f('0x75'),'scheduledAt')[_0x228f('0x73')]('id',_0x228f('0x70'))[_0x228f('0x73')](_0x58ac49['CmListId'][_0x228f('0x76')](),_0x228f('0x71'))[_0x228f('0x73')](_0x5d4958[_0x228f('0x54')]['id']['toString'](),_0x228f('0x5f'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x56'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x57'))['from'](_0x228f('0x77'))[_0x228f('0x40')](_0x228f('0x78'))[_0x228f('0x40')]('ListId\x20=\x20?',_0x58ac49['CmListId']['toString']())[_0x228f('0x40')](_0x228f('0x79'))[_0x228f('0x40')](_0x228f('0x7a'),squel[_0x228f('0x72')]()['field'](_0x228f('0x7b'))[_0x228f('0x7c')](_0x228f('0x7d'))['where'](_0x228f('0x7e'),_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')]()))['where'](_0x228f('0x7a'),squel[_0x228f('0x72')]()[_0x228f('0x73')]('COALESCE(phone,\x27\x27)')[_0x228f('0x7c')](_0x228f('0x6e'))['where'](_0x228f('0x7e'),_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')]())))[_0x228f('0x76')]();break;case _0x228f('0x7f'):_0x4fde48=squel[_0x228f('0x6c')]()[_0x228f('0x6d')]('cm_hopper')[_0x228f('0x80')]([_0x228f('0x74'),'scheduledAt','ContactId',_0x228f('0x71'),'CampaignId',_0x228f('0x56'),_0x228f('0x57')],squel['select']()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')](_0x228f('0x75'),_0x228f('0x6f'))[_0x228f('0x73')]('id','ContactId')[_0x228f('0x73')](_0x58ac49[_0x228f('0x81')][_0x228f('0x76')](),_0x228f('0x71'))[_0x228f('0x73')](_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')](),'CampaignId')[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x56'))['field']('\x27'+_0x21b396+'\x27','updatedAt')[_0x228f('0x7c')](_0x228f('0x77'))[_0x228f('0x40')](_0x228f('0x78'))[_0x228f('0x40')](_0x228f('0x82'),_0x58ac49['CmListId'][_0x228f('0x76')]())[_0x228f('0x40')](_0x228f('0x79'))[_0x228f('0x40')](_0x228f('0x7a'),squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x83'))[_0x228f('0x7c')](_0x228f('0x6e'))[_0x228f('0x40')](_0x228f('0x7e'),_0x5d4958['params']['id'][_0x228f('0x76')]())))[_0x228f('0x76')]();break;default:_0x4fde48=squel[_0x228f('0x6c')]()[_0x228f('0x6d')](_0x228f('0x6e'))['fromQuery']([_0x228f('0x74'),'scheduledAt',_0x228f('0x70'),'ListId',_0x228f('0x5f'),_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')](_0x228f('0x75'),_0x228f('0x6f'))[_0x228f('0x73')]('id',_0x228f('0x70'))[_0x228f('0x73')](_0x58ac49[_0x228f('0x81')][_0x228f('0x76')](),'ListId')[_0x228f('0x73')](_0x5d4958['params']['id'][_0x228f('0x76')](),_0x228f('0x5f'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x56'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27','updatedAt')[_0x228f('0x7c')](_0x228f('0x77'))['where'](_0x228f('0x78'))[_0x228f('0x40')](_0x228f('0x82'),_0x58ac49[_0x228f('0x81')][_0x228f('0x76')]())['where'](_0x228f('0x79')))[_0x228f('0x76')]();}_0xb37c02=squel['insert']()[_0x228f('0x6d')]('cm_hopper_additional_phones')[_0x228f('0x80')](['cmHopperId',_0x228f('0x6f'),_0x228f('0x74'),_0x228f('0x84'),_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()['field'](_0x228f('0x85'),'id')[_0x228f('0x73')]('NOW()',_0x228f('0x6f'))[_0x228f('0x73')](_0x228f('0x86'),_0x228f('0x74'))['field']('ci.OrderBY','OrderBy')['field']('\x27'+_0x21b396+'\x27',_0x228f('0x56'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x57'))[_0x228f('0x7c')](_0x228f('0x87'),'ci')['join'](_0x228f('0x6e'),'h',_0x228f('0x88'))[_0x228f('0x40')](_0x228f('0x89'),_0x58ac49[_0x228f('0x81')][_0x228f('0x76')]())[_0x228f('0x40')](_0x228f('0x8a'),_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')]())[_0x228f('0x40')](_0x228f('0x8b'),_0x21b396))[_0x228f('0x76')]();_0x3733e5['push'](db[_0x228f('0x8c')][_0x228f('0x35')](_0x4fde48));_0x1cda20[_0x228f('0x8d')](db[_0x228f('0x8c')]['query'](_0xb37c02));}return BPromise['all'](_0x3733e5);}})[_0x228f('0x26')](function(){return BPromise[_0x228f('0x8e')](_0x1cda20);})[_0x228f('0x26')](function(){return _0x39c19d;})[_0x228f('0x26')](respondWithResult(_0x1d821a,null))[_0x228f('0x47')](handleError(_0x1d821a,null));};exports[_0x228f('0x8f')]=function(_0x3c73ee,_0x57582d,_0x47e033){return db[_0x228f('0x42')]['find']({'where':{'id':_0x3c73ee[_0x228f('0x54')]['id']}})['then'](handleEntityNotFound(_0x57582d,null))['then'](function(_0x28abec){if(_0x28abec){return _0x28abec[_0x228f('0x8f')](_0x3c73ee[_0x228f('0x35')]['ids']);}})[_0x228f('0x26')](function(_0x48d339){if(_0x48d339){return db[_0x228f('0x5c')][_0x228f('0x27')]({'where':{'ListId':_0x3c73ee[_0x228f('0x35')][_0x228f('0x90')],'CampaignId':_0x3c73ee[_0x228f('0x54')]['id']}})['then'](function(){return _0x48d339;});}})[_0x228f('0x26')](respondWithStatusCode(_0x57582d,null))[_0x228f('0x47')](handleError(_0x57582d,null));};exports[_0x228f('0x91')]=function(_0x3267f4,_0x19ff0a,_0x5ea3a4){var _0x293723={};var _0x568259={};var _0x471f8e;var _0x57d2b5;return db[_0x228f('0x42')][_0x228f('0x62')]({'where':{'id':_0x3267f4[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x19ff0a,null))[_0x228f('0x26')](function(_0x51a0e0){if(_0x51a0e0){_0x471f8e=_0x51a0e0;_0x568259[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x65')][_0x228f('0x31')]);_0x568259[_0x228f('0x35')]=_[_0x228f('0x49')](_0x3267f4[_0x228f('0x35')]);_0x568259['filters']=_['intersection'](_0x568259['model'],_0x568259[_0x228f('0x35')]);_0x293723[_0x228f('0x38')]=_[_0x228f('0x37')](_0x568259[_0x228f('0x34')],qs[_0x228f('0x39')](_0x3267f4[_0x228f('0x35')][_0x228f('0x39')]));_0x293723[_0x228f('0x38')]=_0x293723['attributes'][_0x228f('0x3a')]?_0x293723[_0x228f('0x38')]:_0x568259['model'];_0x293723['order']=qs['sort'](_0x3267f4[_0x228f('0x35')][_0x228f('0x3e')]);_0x293723[_0x228f('0x40')]=qs[_0x228f('0x36')](_[_0x228f('0x3f')](_0x3267f4[_0x228f('0x35')],_0x568259['filters']));if(_0x3267f4['query'][_0x228f('0x5d')]){_0x293723[_0x228f('0x40')]=_['merge'](_0x293723[_0x228f('0x40')],{'$or':_[_0x228f('0x30')](_0x293723['attributes'],function(_0x205438){var _0x2eaeec={};_0x2eaeec[_0x205438]={'$like':'%'+_0x3267f4[_0x228f('0x35')][_0x228f('0x5d')]+'%'};return _0x2eaeec;})});}_0x293723=_[_0x228f('0x41')]({},_0x293723,_0x3267f4[_0x228f('0x4b')]);return _0x471f8e[_0x228f('0x91')](_0x293723);}})[_0x228f('0x26')](function(_0xe9476a){if(_0xe9476a){_0x57d2b5=_0xe9476a['length'];if(!_0x3267f4[_0x228f('0x35')][_0x228f('0x3b')]('nolimit')){_0x293723[_0x228f('0x1f')]=qs['limit'](_0x3267f4['query']['limit']);_0x293723[_0x228f('0x1e')]=qs['offset'](_0x3267f4[_0x228f('0x35')][_0x228f('0x1e')]);}return _0x471f8e[_0x228f('0x91')](_0x293723);}})[_0x228f('0x26')](function(_0x2bdcee){if(_0x2bdcee){return _0x2bdcee?{'count':_0x57d2b5,'rows':_0x2bdcee}:null;}})[_0x228f('0x26')](respondWithResult(_0x19ff0a,null))['catch'](handleError(_0x19ff0a,null));};exports[_0x228f('0x92')]=function(_0x5aaa0f,_0x305f7d,_0x43e0b0){var _0x5907b6,_0x1a7398;var _0x3bc62b=[];var _0x6278ff=moment()[_0x228f('0x67')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x228f('0x42')]['find']({'where':{'id':_0x5aaa0f[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x305f7d,null))[_0x228f('0x26')](function(_0x272bc7){if(_0x272bc7){_0x1a7398=_0x272bc7;return _0x272bc7[_0x228f('0x92')](_0x5aaa0f[_0x228f('0x4e')][_0x228f('0x90')],_[_0x228f('0x55')](_0x5aaa0f['body'],[_0x228f('0x90'),'id'])||{});}return null;})[_0x228f('0x69')](function(_0x5cdd98){var _0x5ec163;var _0x435dd6;_0x5907b6=_0x5cdd98||[];var _0x2f6e93=[];if(_0x5cdd98){for(var _0x26dcbe=0x0;_0x26dcbe<_0x5cdd98['length'];_0x26dcbe+=0x1){var _0x318dcf=_0x5cdd98[_0x26dcbe][_0x228f('0x28')]({'plain':!![]});_0x5ec163=squel[_0x228f('0x6c')]()[_0x228f('0x6d')](_0x228f('0x93'))[_0x228f('0x80')]([_0x228f('0x74'),'ContactId',_0x228f('0x71'),'CampaignId',_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')]('id',_0x228f('0x70'))[_0x228f('0x73')](_0x318dcf[_0x228f('0x81')][_0x228f('0x76')](),_0x228f('0x71'))['field'](_0x5aaa0f[_0x228f('0x54')]['id'][_0x228f('0x76')](),_0x228f('0x5f'))[_0x228f('0x73')]('NOW()',_0x228f('0x56'))[_0x228f('0x73')]('NOW()',_0x228f('0x57'))[_0x228f('0x7c')](_0x228f('0x77'))[_0x228f('0x40')](_0x228f('0x78'))['where'](_0x228f('0x82'),_0x318dcf[_0x228f('0x81')]['toString']())[_0x228f('0x40')](_0x228f('0x79')))[_0x228f('0x76')]();_0x2f6e93[_0x228f('0x8d')](db[_0x228f('0x8c')][_0x228f('0x35')](_0x5ec163));}return BPromise[_0x228f('0x8e')](_0x2f6e93);}})['then'](function(){return _0x5907b6;})['then'](respondWithResult(_0x305f7d,null))[_0x228f('0x47')](handleError(_0x305f7d,null));};exports[_0x228f('0x94')]=function(_0x1cd805,_0x3510ad,_0x44f9ec){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x1cd805['params']['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3510ad,null))[_0x228f('0x26')](function(_0x3e1261){if(_0x3e1261){return _0x3e1261['removeBlackLists'](_0x1cd805['query'][_0x228f('0x90')]);}})[_0x228f('0x26')](function(_0x3a1136){if(_0x3a1136){return db[_0x228f('0x63')][_0x228f('0x27')]({'where':{'ListId':_0x1cd805[_0x228f('0x35')]['ids'],'CampaignId':_0x1cd805[_0x228f('0x54')]['id']}})['then'](function(){return _0x3a1136;});}})['then'](respondWithStatusCode(_0x3510ad,null))[_0x228f('0x47')](handleError(_0x3510ad,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 66210c5..7384866 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4c2bc5,_0x4984e2){var _0x487209=function(_0x3cabbf){while(--_0x3cabbf){_0x4c2bc5['push'](_0x4c2bc5['shift']());}};_0x487209(++_0x4984e2);}(_0x7a54,0x106));var _0x47a5=function(_0x3cf7c0,_0x4ad985){_0x3cf7c0=_0x3cf7c0-0x0;var _0x15c2df=_0x7a54[_0x3cf7c0];return _0x15c2df;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5d7a36e..cfd89ec 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 _0xae79=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','findAll','options','raw','where','map','include','attributes','model','GetCampaign','lodash'];(function(_0x525b22,_0x2ea10a){var _0x11ca2b=function(_0x4265ad){while(--_0x4265ad){_0x525b22['push'](_0x525b22['shift']());}};_0x11ca2b(++_0x2ea10a);}(_0xae79,0x1d3));var _0x9ae7=function(_0xfbeb93,_0x284929){_0xfbeb93=_0xfbeb93-0x0;var _0x52734b=_0xae79[_0xfbeb93];return _0x52734b;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var moment=require(_0x9ae7('0x2'));var BPromise=require(_0x9ae7('0x3'));var rs=require(_0x9ae7('0x4'));var fs=require('fs');var Redis=require(_0x9ae7('0x5'));var db=require(_0x9ae7('0x6'))['db'];var utils=require(_0x9ae7('0x7'));var logger=require(_0x9ae7('0x8'))(_0x9ae7('0x9'));var config=require(_0x9ae7('0xa'));var jayson=require(_0x9ae7('0xb'));var client=jayson[_0x9ae7('0xc')][_0x9ae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x57114d,_0x2761c2){return new BPromise(function(_0x47774e,_0x3c7738){return client[_0x9ae7('0xe')](_0x409d34,_0x2761c2)[_0x9ae7('0xf')](function(_0xc023d2){logger['info'](_0x9ae7('0x10'),_0x57114d,'request\x20sent');logger[_0x9ae7('0x11')](_0x9ae7('0x12'),_0x57114d,_0x9ae7('0x13'),JSON[_0x9ae7('0x14')](_0xc023d2));if(_0xc023d2[_0x9ae7('0x15')]){if(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x16')]===0x1f4){logger['error'](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')]['message']);return _0x3c7738(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);}logger[_0x9ae7('0x15')](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);return _0x47774e(_0xc023d2[_0x9ae7('0x15')]['message']);}else{logger[_0x9ae7('0x18')](_0x9ae7('0x10'),_0x57114d,_0x9ae7('0x13'));_0x47774e(_0xc023d2[_0x9ae7('0x19')]['message']);}})[_0x9ae7('0x1a')](function(_0xe1a2d1){logger[_0x9ae7('0x15')]('Campaign,\x20%s,\x20%s',_0x57114d,_0xe1a2d1);_0x3c7738(_0xe1a2d1);});});}exports['GetCampaign']=function(_0x2c7643){var _0x5e69c2=this;return new Promise(function(_0x5d6ad1,_0x5d0635){return db['Campaign'][_0x9ae7('0x1b')]({'raw':_0x2c7643[_0x9ae7('0x1c')]?_0x2c7643[_0x9ae7('0x1c')][_0x9ae7('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c7643['options']?_0x2c7643[_0x9ae7('0x1c')][_0x9ae7('0x1e')]||null:null,'attributes':_0x2c7643['options']?_0x2c7643[_0x9ae7('0x1c')]['attributes']||null:null,'limit':_0x2c7643[_0x9ae7('0x1c')]?_0x2c7643[_0x9ae7('0x1c')]['limit']||null:null,'include':_0x2c7643[_0x9ae7('0x1c')]?_0x2c7643['options']['include']?_[_0x9ae7('0x1f')](_0x2c7643[_0x9ae7('0x1c')][_0x9ae7('0x20')],function(_0x1159a0){return{'model':db[_0x1159a0['model']],'as':_0x1159a0['as'],'attributes':_0x1159a0[_0x9ae7('0x21')],'include':_0x1159a0[_0x9ae7('0x20')]?_[_0x9ae7('0x1f')](_0x1159a0[_0x9ae7('0x20')],function(_0x5da136){return{'model':db[_0x5da136[_0x9ae7('0x22')]],'as':_0x5da136['as'],'attributes':_0x5da136['attributes'],'include':_0x5da136[_0x9ae7('0x20')]?_[_0x9ae7('0x1f')](_0x5da136['include'],function(_0x49da63){return{'model':db[_0x49da63['model']],'as':_0x49da63['as'],'attributes':_0x49da63['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae7('0xf')](function(_0x26680c){logger['info'](_0x9ae7('0x23'),_0x2c7643);logger[_0x9ae7('0x11')](_0x9ae7('0x23'),_0x2c7643,JSON[_0x9ae7('0x14')](_0x26680c));_0x5d6ad1(_0x26680c);})[_0x9ae7('0x1a')](function(_0x51527d){logger['error'](_0x9ae7('0x23'),_0x51527d['message'],_0x2c7643);_0x5d0635(_0x5e69c2[_0x9ae7('0x15')](0x1f4,_0x51527d[_0x9ae7('0x17')]));});});}; \ No newline at end of file +var _0xb2b3=['error','code','message','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb2b3,0x71));var _0x3b2b=function(_0x1d91a5,_0x41741c){_0x1d91a5=_0x1d91a5-0x0;var _0x1604e1=_0xb2b3[_0x1d91a5];return _0x1604e1;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var moment=require(_0x3b2b('0x2'));var BPromise=require(_0x3b2b('0x3'));var rs=require(_0x3b2b('0x4'));var fs=require('fs');var Redis=require(_0x3b2b('0x5'));var db=require(_0x3b2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2b('0x7'))(_0x3b2b('0x8'));var config=require(_0x3b2b('0x9'));var jayson=require(_0x3b2b('0xa'));var client=jayson[_0x3b2b('0xb')][_0x3b2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83e7ef,_0x24b585,_0x1a9054){return new BPromise(function(_0x3ec416,_0x33b807){return client[_0x3b2b('0xd')](_0x83e7ef,_0x1a9054)['then'](function(_0x430be0){logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));logger[_0x3b2b('0x11')](_0x3b2b('0x12'),_0x24b585,'request\x20sent',JSON['stringify'](_0x430be0));if(_0x430be0[_0x3b2b('0x13')]){if(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x14')]===0x1f4){logger[_0x3b2b('0x13')]('Campaign,\x20%s,\x20%s',_0x24b585,_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);return _0x33b807(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);}logger[_0x3b2b('0x13')](_0x3b2b('0xf'),_0x24b585,_0x430be0['error'][_0x3b2b('0x15')]);return _0x3ec416(_0x430be0[_0x3b2b('0x13')]['message']);}else{logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));_0x3ec416(_0x430be0['result'][_0x3b2b('0x15')]);}})['catch'](function(_0x21743d){logger[_0x3b2b('0x13')]('Campaign,\x20%s,\x20%s',_0x24b585,_0x21743d);_0x33b807(_0x21743d);});});}exports['GetCampaign']=function(_0x1a3bfb){var _0x52bba5=this;return new Promise(function(_0x157155,_0x30e4c2){return db['Campaign'][_0x3b2b('0x16')]({'raw':_0x1a3bfb['options']?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3bfb['options']?_0x1a3bfb['options'][_0x3b2b('0x19')]||null:null,'attributes':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x1a')]||null:null,'limit':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x1b')]||null:null,'include':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x1c')]?_[_0x3b2b('0x1d')](_0x1a3bfb['options'][_0x3b2b('0x1c')],function(_0x35387c){return{'model':db[_0x35387c[_0x3b2b('0x1e')]],'as':_0x35387c['as'],'attributes':_0x35387c['attributes'],'include':_0x35387c[_0x3b2b('0x1c')]?_['map'](_0x35387c[_0x3b2b('0x1c')],function(_0x50d2e5){return{'model':db[_0x50d2e5[_0x3b2b('0x1e')]],'as':_0x50d2e5['as'],'attributes':_0x50d2e5['attributes'],'include':_0x50d2e5['include']?_[_0x3b2b('0x1d')](_0x50d2e5[_0x3b2b('0x1c')],function(_0x11313d){return{'model':db[_0x11313d[_0x3b2b('0x1e')]],'as':_0x11313d['as'],'attributes':_0x11313d[_0x3b2b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b2b('0x1f')](function(_0x30574a){logger[_0x3b2b('0xe')](_0x3b2b('0x20'),_0x1a3bfb);logger['debug']('GetCampaign',_0x1a3bfb,JSON['stringify'](_0x30574a));_0x157155(_0x30574a);})['catch'](function(_0x3e2177){logger[_0x3b2b('0x13')](_0x3b2b('0x20'),_0x3e2177[_0x3b2b('0x15')],_0x1a3bfb);_0x30e4c2(_0x52bba5[_0x3b2b('0x13')](0x1f4,_0x3e2177[_0x3b2b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7a8ba50..1bad427 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 _0xf25f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update','/:id','removeLists','delete','removeBlackLists','exports','multer'];(function(_0x6cd1bf,_0xf6e522){var _0x403acf=function(_0x27fabc){while(--_0x27fabc){_0x6cd1bf['push'](_0x6cd1bf['shift']());}};_0x403acf(++_0xf6e522);}(_0xf25f,0x6e));var _0xff25=function(_0x31bc14,_0x280066){_0x31bc14=_0x31bc14-0x0;var _0x252f5f=_0xf25f[_0x31bc14];return _0x252f5f;};'use strict';var multer=require(_0xff25('0x0'));var util=require(_0xff25('0x1'));var path=require(_0xff25('0x2'));var timeout=require(_0xff25('0x3'));var express=require(_0xff25('0x4'));var router=express[_0xff25('0x5')]();var fs_extra=require(_0xff25('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xff25('0x7'));var config=require('../../config/environment');var controller=require(_0xff25('0x8'));router['get']('/',auth[_0xff25('0x9')](),controller[_0xff25('0xa')]);router[_0xff25('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xff25('0xc')]);router['get'](_0xff25('0xd'),auth[_0xff25('0x9')](),controller[_0xff25('0xe')]);router[_0xff25('0xb')](_0xff25('0xf'),auth[_0xff25('0x9')](),controller[_0xff25('0x10')]);router['get'](_0xff25('0x11'),auth['isAuthenticated'](),controller[_0xff25('0x12')]);router['get'](_0xff25('0x13'),auth[_0xff25('0x9')](),controller[_0xff25('0x14')]);router['get'](_0xff25('0x15'),auth[_0xff25('0x9')](),controller[_0xff25('0x16')]);router[_0xff25('0xb')](_0xff25('0x17'),auth[_0xff25('0x9')](),controller[_0xff25('0x18')]);router[_0xff25('0x19')]('/',auth[_0xff25('0x9')](),controller['create']);router[_0xff25('0x19')](_0xff25('0x1a'),auth[_0xff25('0x9')](),controller[_0xff25('0x1b')]);router[_0xff25('0x19')](_0xff25('0x15'),auth[_0xff25('0x9')](),controller[_0xff25('0x1c')]);router[_0xff25('0x19')](_0xff25('0x17'),auth[_0xff25('0x9')](),controller[_0xff25('0x1d')]);router[_0xff25('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xff25('0x1f')]);router['delete'](_0xff25('0x20'),auth[_0xff25('0x9')](),controller['destroy']);router['delete']('/:id/lists',auth[_0xff25('0x9')](),controller[_0xff25('0x21')]);router[_0xff25('0x22')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xff25('0x23')]);module[_0xff25('0x24')]=router; \ No newline at end of file +var _0x0d8d=['update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','post','/:id/clone','addLists','addBlackLists','put'];(function(_0xd7acd8,_0xcdd9e6){var _0x4738de=function(_0x102739){while(--_0x102739){_0xd7acd8['push'](_0xd7acd8['shift']());}};_0x4738de(++_0xcdd9e6);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x51c529,_0x29e1b9){_0x51c529=_0x51c529-0x0;var _0x568d73=_0x0d8d[_0x51c529];return _0x568d73;};'use strict';var multer=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var path=require(_0xd0d8('0x2'));var timeout=require(_0xd0d8('0x3'));var express=require(_0xd0d8('0x4'));var router=express[_0xd0d8('0x5')]();var fs_extra=require(_0xd0d8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd0d8('0x7'));var config=require(_0xd0d8('0x8'));var controller=require('./campaign.controller');router[_0xd0d8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd0d8('0xa'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0xc')]);router[_0xd0d8('0x9')]('/:id/hoppers',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0xd')]);router[_0xd0d8('0x9')](_0xd0d8('0xe'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0xf')]);router[_0xd0d8('0x9')]('/:id/hopper_finals',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x10')]);router[_0xd0d8('0x9')](_0xd0d8('0x11'),auth['isAuthenticated'](),controller[_0xd0d8('0x12')]);router[_0xd0d8('0x9')](_0xd0d8('0x13'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x14')]);router['get'](_0xd0d8('0x15'),auth[_0xd0d8('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x16')]);router[_0xd0d8('0x17')](_0xd0d8('0x18'),auth[_0xd0d8('0xb')](),controller['clone']);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0xd0d8('0x19')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd0d8('0x1a')]);router[_0xd0d8('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xd0d8('0x1c')]);router[_0xd0d8('0x1d')](_0xd0d8('0xa'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x1e')]);router[_0xd0d8('0x1d')]('/:id/lists',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x1f')]);router[_0xd0d8('0x1d')]('/:id/blacklists',auth[_0xd0d8('0xb')](),controller['removeBlackLists']);module[_0xd0d8('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3bf8dfd..f303716 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 _0x1af2=['STRING','getDataValue','sequelize','exports'];(function(_0xe06448,_0x589f63){var _0xd91f7e=function(_0x24b449){while(--_0x24b449){_0xe06448['push'](_0xe06448['shift']());}};_0xd91f7e(++_0x589f63);}(_0x1af2,0x17a));var _0x21af=function(_0x3f8e20,_0x1daf92){_0x3f8e20=_0x3f8e20-0x0;var _0x54b65e=_0x1af2[_0x3f8e20];return _0x54b65e;};'use strict';var Sequelize=require(_0x21af('0x0'));module[_0x21af('0x1')]={'key':{'type':Sequelize[_0x21af('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x21af('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x21af('0x3')]('key');}}}; \ No newline at end of file +var _0x08fd=['key','sequelize','exports','STRING','medium','getDataValue'];(function(_0x35351e,_0x47acc1){var _0x3eb15b=function(_0xd674b7){while(--_0xd674b7){_0x35351e['push'](_0x35351e['shift']());}};_0x3eb15b(++_0x47acc1);}(_0x08fd,0x19f));var _0xd08f=function(_0x79b328,_0x269454){_0x79b328=_0x79b328-0x0;var _0x1ac1de=_0x08fd[_0x79b328];return _0x1ac1de;};'use strict';var Sequelize=require(_0xd08f('0x0'));module[_0xd08f('0x1')]={'key':{'type':Sequelize[_0xd08f('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xd08f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd08f('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd08f('0x4')](_0xd08f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 90adf9c..c18f2f8 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 _0x3084=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','CannedAnswer','rawAttributes','fieldName','type','key','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/license/util','sendStatus','end','status'];(function(_0x1f4e91,_0x163886){var _0x40579f=function(_0x3257c0){while(--_0x3257c0){_0x1f4e91['push'](_0x1f4e91['shift']());}};_0x40579f(++_0x163886);}(_0x3084,0x14b));var _0x4308=function(_0x21aa9a,_0x46b9f1){_0x21aa9a=_0x21aa9a-0x0;var _0x399e13=_0x3084[_0x21aa9a];return _0x399e13;};'use strict';var emlformat=require(_0x4308('0x0'));var rimraf=require(_0x4308('0x1'));var zipdir=require(_0x4308('0x2'));var jsonpatch=require(_0x4308('0x3'));var rp=require('request-promise');var moment=require(_0x4308('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4308('0x5'));var util=require(_0x4308('0x6'));var path=require('path');var sox=require(_0x4308('0x7'));var csv=require(_0x4308('0x8'));var ejs=require(_0x4308('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4308('0xa'));var squel=require(_0x4308('0xb'));var crypto=require(_0x4308('0xc'));var jsforce=require(_0x4308('0xd'));var deskjs=require(_0x4308('0xe'));var toCsv=require(_0x4308('0x8'));var querystring=require(_0x4308('0xf'));var Papa=require(_0x4308('0x10'));var Redis=require(_0x4308('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4308('0x12'));var as=require(_0x4308('0x13'));var hardwareService=require(_0x4308('0x14'));var logger=require(_0x4308('0x15'))(_0x4308('0x16'));var utils=require(_0x4308('0x17'));var config=require(_0x4308('0x18'));var licenseUtil=require(_0x4308('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c19a,_0x409c61){_0x409c61=_0x409c61||0xcc;return function(_0x33c923){if(_0x33c923){return _0x36c19a[_0x4308('0x1a')](_0x409c61);}return _0x36c19a['status'](_0x409c61)[_0x4308('0x1b')]();};}function respondWithResult(_0x1c9329,_0x1c8cf4){_0x1c8cf4=_0x1c8cf4||0xc8;return function(_0x44deed){if(_0x44deed){return _0x1c9329[_0x4308('0x1c')](_0x1c8cf4)[_0x4308('0x1d')](_0x44deed);}};}function respondWithFilteredResult(_0x23a08a,_0x1ec999){return function(_0x43f6d4){if(_0x43f6d4){var _0x3f0d75=typeof _0x1ec999[_0x4308('0x1e')]===_0x4308('0x1f')&&typeof _0x1ec999[_0x4308('0x20')]==='undefined';var _0xd83922=_0x43f6d4[_0x4308('0x21')];var _0x107a44=_0x3f0d75?0x0:_0x1ec999[_0x4308('0x1e')];var _0xd5b73a=_0x3f0d75?_0x43f6d4[_0x4308('0x21')]:_0x1ec999['offset']+_0x1ec999['limit'];var _0x374d56;if(_0xd5b73a>=_0xd83922){_0xd5b73a=_0xd83922;_0x374d56=0xc8;}else{_0x374d56=0xce;}_0x23a08a[_0x4308('0x1c')](_0x374d56);return _0x23a08a[_0x4308('0x22')](_0x4308('0x23'),_0x107a44+'-'+_0xd5b73a+'/'+_0xd83922)[_0x4308('0x1d')](_0x43f6d4);}return null;};}function patchUpdates(_0x41b4f7){return function(_0x4ac6da){try{jsonpatch[_0x4308('0x24')](_0x4ac6da,_0x41b4f7,!![]);}catch(_0x281047){return BPromise[_0x4308('0x25')](_0x281047);}return _0x4ac6da[_0x4308('0x26')]();};}function saveUpdates(_0x2960a7,_0xa9127d){return function(_0x2e9066){if(_0x2e9066){return _0x2e9066[_0x4308('0x27')](_0x2960a7)[_0x4308('0x28')](function(_0x2566ab){return _0x2566ab;});}return null;};}function removeEntity(_0x5e261f,_0x26191e){return function(_0x2881ce){if(_0x2881ce){return _0x2881ce[_0x4308('0x29')]()['then'](function(){var _0x4942ec=_0x2881ce[_0x4308('0x2a')]({'plain':!![]});var _0x3b4343='CannedAnswers';return db['UserProfileResource'][_0x4308('0x29')]({'where':{'type':_0x3b4343,'resourceId':_0x4942ec['id']}})[_0x4308('0x28')](function(){return _0x2881ce;});})[_0x4308('0x28')](function(){_0x5e261f[_0x4308('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfbab6a,_0x5ab055){return function(_0x1a5841){if(!_0x1a5841){_0xfbab6a['sendStatus'](0x194);}return _0x1a5841;};}function handleError(_0x52d004,_0x5ae21c){_0x5ae21c=_0x5ae21c||0x1f4;return function(_0x1d7e33){logger[_0x4308('0x2b')](_0x1d7e33[_0x4308('0x2c')]);if(_0x1d7e33[_0x4308('0x2d')]){delete _0x1d7e33[_0x4308('0x2d')];}_0x52d004['status'](_0x5ae21c)['send'](_0x1d7e33);};}exports['index']=function(_0x233e6a,_0x2382f4){var _0x3e1db0={},_0x2b36ee={},_0x2c2d33={'count':0x0,'rows':[]};var _0x260653=_['map'](db[_0x4308('0x2e')][_0x4308('0x2f')],function(_0x547794){return{'name':_0x547794[_0x4308('0x30')],'type':_0x547794[_0x4308('0x31')][_0x4308('0x32')]};});_0x2b36ee['model']=_[_0x4308('0x33')](_0x260653,_0x4308('0x2d'));_0x2b36ee[_0x4308('0x34')]=_['keys'](_0x233e6a[_0x4308('0x34')]);_0x2b36ee[_0x4308('0x35')]=_['intersection'](_0x2b36ee[_0x4308('0x36')],_0x2b36ee['query']);_0x3e1db0['attributes']=_[_0x4308('0x37')](_0x2b36ee[_0x4308('0x36')],qs[_0x4308('0x38')](_0x233e6a['query'][_0x4308('0x38')]));_0x3e1db0[_0x4308('0x39')]=_0x3e1db0[_0x4308('0x39')][_0x4308('0x3a')]?_0x3e1db0[_0x4308('0x39')]:_0x2b36ee['model'];if(!_0x233e6a['query'][_0x4308('0x3b')](_0x4308('0x3c'))){_0x3e1db0[_0x4308('0x20')]=qs[_0x4308('0x20')](_0x233e6a[_0x4308('0x34')]['limit']);_0x3e1db0['offset']=qs['offset'](_0x233e6a[_0x4308('0x34')][_0x4308('0x1e')]);}_0x3e1db0['order']=qs[_0x4308('0x3d')](_0x233e6a[_0x4308('0x34')]['sort']);_0x3e1db0[_0x4308('0x3e')]=qs[_0x4308('0x35')](_[_0x4308('0x3f')](_0x233e6a[_0x4308('0x34')],_0x2b36ee[_0x4308('0x35')]),_0x260653);if(_0x233e6a['query'][_0x4308('0x40')]){_0x3e1db0[_0x4308('0x3e')]=_[_0x4308('0x41')](_0x3e1db0[_0x4308('0x3e')],{'$or':[{'key':{'$like':'%'+_0x233e6a[_0x4308('0x34')][_0x4308('0x40')]+'%'}},{'value':{'$like':'%'+_0x233e6a[_0x4308('0x34')][_0x4308('0x40')]+'%'}}]});}_0x3e1db0=_['merge']({},_0x3e1db0,_0x233e6a[_0x4308('0x42')]);var _0x2020d5={'where':_0x3e1db0['where']};return db[_0x4308('0x2e')]['count'](_0x2020d5)[_0x4308('0x28')](function(_0x3a305f){_0x2c2d33[_0x4308('0x21')]=_0x3a305f;if(_0x233e6a[_0x4308('0x34')][_0x4308('0x43')]){_0x3e1db0['include']=[{'all':!![]}];}return db[_0x4308('0x2e')][_0x4308('0x44')](_0x3e1db0);})[_0x4308('0x28')](function(_0x4f6f7b){_0x2c2d33[_0x4308('0x45')]=_0x4f6f7b;return _0x2c2d33;})['then'](respondWithFilteredResult(_0x2382f4,_0x3e1db0))[_0x4308('0x46')](handleError(_0x2382f4,null));};exports[_0x4308('0x47')]=function(_0x483c60,_0xed5348){var _0x5b7171={'raw':!![],'where':{'id':_0x483c60[_0x4308('0x48')]['id']}},_0x172a17={};_0x172a17[_0x4308('0x36')]=_[_0x4308('0x49')](db[_0x4308('0x2e')]['rawAttributes']);_0x172a17[_0x4308('0x34')]=_[_0x4308('0x49')](_0x483c60['query']);_0x172a17['filters']=_[_0x4308('0x37')](_0x172a17['model'],_0x172a17[_0x4308('0x34')]);_0x5b7171[_0x4308('0x39')]=_[_0x4308('0x37')](_0x172a17[_0x4308('0x36')],qs[_0x4308('0x38')](_0x483c60[_0x4308('0x34')][_0x4308('0x38')]));_0x5b7171['attributes']=_0x5b7171[_0x4308('0x39')]['length']?_0x5b7171['attributes']:_0x172a17[_0x4308('0x36')];if(_0x483c60[_0x4308('0x34')][_0x4308('0x43')]){_0x5b7171[_0x4308('0x4a')]=[{'all':!![]}];}_0x5b7171=_[_0x4308('0x41')]({},_0x5b7171,_0x483c60[_0x4308('0x42')]);return db['CannedAnswer'][_0x4308('0x4b')](_0x5b7171)[_0x4308('0x28')](handleEntityNotFound(_0xed5348,null))[_0x4308('0x28')](respondWithResult(_0xed5348,null))[_0x4308('0x46')](handleError(_0xed5348,null));};exports[_0x4308('0x27')]=function(_0x4784eb,_0x3d9aea){if(_0x4784eb[_0x4308('0x4c')]['id']){delete _0x4784eb['body']['id'];}return db[_0x4308('0x2e')][_0x4308('0x4b')]({'where':{'id':_0x4784eb[_0x4308('0x48')]['id']}})[_0x4308('0x28')](handleEntityNotFound(_0x3d9aea,null))[_0x4308('0x28')](saveUpdates(_0x4784eb[_0x4308('0x4c')],null))[_0x4308('0x28')](respondWithResult(_0x3d9aea,null))[_0x4308('0x46')](handleError(_0x3d9aea,null));};exports[_0x4308('0x29')]=function(_0x28aeb2,_0x3d65c4){return db[_0x4308('0x2e')]['find']({'where':{'id':_0x28aeb2[_0x4308('0x48')]['id']}})[_0x4308('0x28')](handleEntityNotFound(_0x3d65c4,null))[_0x4308('0x28')](removeEntity(_0x3d65c4,null))[_0x4308('0x46')](handleError(_0x3d65c4,null));};exports[_0x4308('0x4d')]=function(_0x9a0985,_0xfec0e9){var _0xbc7b21={'key':_0x9a0985['body']['key']};if(_0x9a0985['body'][_0x4308('0x4e')]){_0xbc7b21[_0x4308('0x4e')]=_0x9a0985[_0x4308('0x4c')][_0x4308('0x4e')];}else if(_0x9a0985['body'][_0x4308('0x4f')]){_0xbc7b21[_0x4308('0x4f')]=_0x9a0985[_0x4308('0x4c')][_0x4308('0x4f')];}else if(_0x9a0985[_0x4308('0x4c')][_0x4308('0x50')]){_0xbc7b21[_0x4308('0x50')]=_0x9a0985[_0x4308('0x4c')][_0x4308('0x50')];}else if(_0x9a0985[_0x4308('0x4c')][_0x4308('0x51')]){_0xbc7b21['ChatWebsiteId']=_0x9a0985[_0x4308('0x4c')]['ChatWebsiteId'];}return db[_0x4308('0x2e')][_0x4308('0x4b')]({'where':_0xbc7b21})[_0x4308('0x28')](function(_0x11b7f3){if(_0x11b7f3){throw new db['Sequelize'][(_0x4308('0x52'))](_0x4308('0x53'));}return db['CannedAnswer']['create'](_0x9a0985[_0x4308('0x4c')]);})[_0x4308('0x28')](function(_0x5bc408){var _0x30dedb=_0x9a0985[_0x4308('0x54')][_0x4308('0x2a')]({'plain':!![]});if(!_0x30dedb)throw new Error(_0x4308('0x55'));if(_0x30dedb[_0x4308('0x56')]===_0x4308('0x54')){var _0x576b69=_0x5bc408[_0x4308('0x2a')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4308('0x57'),'userProfileId':_0x30dedb['userProfileId']},'raw':!![]})[_0x4308('0x28')](function(_0x2af77e){if(_0x2af77e&&_0x2af77e['autoAssociation']===0x0){return db[_0x4308('0x58')][_0x4308('0x4d')]({'name':_0x576b69[_0x4308('0x2d')],'resourceId':_0x576b69['id'],'type':_0x2af77e['name'],'sectionId':_0x2af77e['id']},{})[_0x4308('0x28')](function(){return _0x5bc408;});}else{return _0x5bc408;}})['catch'](function(_0xd1ec98){logger['error'](_0x4308('0x59'),_0xd1ec98);throw _0xd1ec98;});}return _0x5bc408;})[_0x4308('0x28')](respondWithResult(_0xfec0e9,0xc9))[_0x4308('0x46')](handleError(_0xfec0e9,null));}; \ No newline at end of file +var _0x3a99=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','map','rawAttributes','fieldName','type','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','CannedAnswer','includeAll','include','findAll','rows','catch','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash'];(function(_0x2ca60d,_0x211489){var _0x5e3384=function(_0x532735){while(--_0x532735){_0x2ca60d['push'](_0x2ca60d['shift']());}};_0x5e3384(++_0x211489);}(_0x3a99,0x1a3));var _0x93a9=function(_0x550f2d,_0x42e613){_0x550f2d=_0x550f2d-0x0;var _0x38e658=_0x3a99[_0x550f2d];return _0x38e658;};'use strict';var emlformat=require(_0x93a9('0x0'));var rimraf=require(_0x93a9('0x1'));var zipdir=require(_0x93a9('0x2'));var jsonpatch=require(_0x93a9('0x3'));var rp=require(_0x93a9('0x4'));var moment=require(_0x93a9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x93a9('0x6'));var sox=require(_0x93a9('0x7'));var csv=require(_0x93a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93a9('0x9'));var _=require(_0x93a9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x93a9('0x8'));var querystring=require('querystring');var Papa=require(_0x93a9('0xb'));var Redis=require(_0x93a9('0xc'));var authService=require(_0x93a9('0xd'));var qs=require(_0x93a9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93a9('0xf'));var logger=require(_0x93a9('0x10'))(_0x93a9('0x11'));var utils=require('../../config/utils');var config=require(_0x93a9('0x12'));var licenseUtil=require(_0x93a9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x81a2d8,_0x9b6fb4){_0x9b6fb4=_0x9b6fb4||0xcc;return function(_0x263d4d){if(_0x263d4d){return _0x81a2d8[_0x93a9('0x14')](_0x9b6fb4);}return _0x81a2d8[_0x93a9('0x15')](_0x9b6fb4)['end']();};}function respondWithResult(_0x42acc6,_0x33db1d){_0x33db1d=_0x33db1d||0xc8;return function(_0xff6b93){if(_0xff6b93){return _0x42acc6[_0x93a9('0x15')](_0x33db1d)[_0x93a9('0x16')](_0xff6b93);}};}function respondWithFilteredResult(_0x1a29e0,_0x3ea2ae){return function(_0x3bbfda){if(_0x3bbfda){var _0x38ad14=typeof _0x3ea2ae[_0x93a9('0x17')]===_0x93a9('0x18')&&typeof _0x3ea2ae[_0x93a9('0x19')]==='undefined';var _0xa0efbc=_0x3bbfda[_0x93a9('0x1a')];var _0x6fa007=_0x38ad14?0x0:_0x3ea2ae[_0x93a9('0x17')];var _0x21e614=_0x38ad14?_0x3bbfda[_0x93a9('0x1a')]:_0x3ea2ae[_0x93a9('0x17')]+_0x3ea2ae[_0x93a9('0x19')];var _0xc5673;if(_0x21e614>=_0xa0efbc){_0x21e614=_0xa0efbc;_0xc5673=0xc8;}else{_0xc5673=0xce;}_0x1a29e0['status'](_0xc5673);return _0x1a29e0[_0x93a9('0x1b')](_0x93a9('0x1c'),_0x6fa007+'-'+_0x21e614+'/'+_0xa0efbc)[_0x93a9('0x16')](_0x3bbfda);}return null;};}function patchUpdates(_0x2919ab){return function(_0x3c2556){try{jsonpatch['apply'](_0x3c2556,_0x2919ab,!![]);}catch(_0x304567){return BPromise[_0x93a9('0x1d')](_0x304567);}return _0x3c2556[_0x93a9('0x1e')]();};}function saveUpdates(_0x18ab87,_0x48e345){return function(_0x582231){if(_0x582231){return _0x582231[_0x93a9('0x1f')](_0x18ab87)[_0x93a9('0x20')](function(_0x1637b2){return _0x1637b2;});}return null;};}function removeEntity(_0x16bbbf,_0x55abc9){return function(_0x3d2b6a){if(_0x3d2b6a){return _0x3d2b6a[_0x93a9('0x21')]()[_0x93a9('0x20')](function(){var _0x27a0ba=_0x3d2b6a[_0x93a9('0x22')]({'plain':!![]});var _0xbdc2c5='CannedAnswers';return db[_0x93a9('0x23')][_0x93a9('0x21')]({'where':{'type':_0xbdc2c5,'resourceId':_0x27a0ba['id']}})[_0x93a9('0x20')](function(){return _0x3d2b6a;});})[_0x93a9('0x20')](function(){_0x16bbbf[_0x93a9('0x15')](0xcc)[_0x93a9('0x24')]();});}};}function handleEntityNotFound(_0x59f513,_0x345d56){return function(_0x99dbf9){if(!_0x99dbf9){_0x59f513['sendStatus'](0x194);}return _0x99dbf9;};}function handleError(_0x53f216,_0x39715f){_0x39715f=_0x39715f||0x1f4;return function(_0x2f1899){logger[_0x93a9('0x25')](_0x2f1899[_0x93a9('0x26')]);if(_0x2f1899['name']){delete _0x2f1899['name'];}_0x53f216[_0x93a9('0x15')](_0x39715f)[_0x93a9('0x27')](_0x2f1899);};}exports[_0x93a9('0x28')]=function(_0x35dd0f,_0x35d2b8){var _0x264ae5={},_0x141dfd={},_0x4b9e70={'count':0x0,'rows':[]};var _0x2e57f3=_[_0x93a9('0x29')](db['CannedAnswer'][_0x93a9('0x2a')],function(_0x131a87){return{'name':_0x131a87[_0x93a9('0x2b')],'type':_0x131a87[_0x93a9('0x2c')]['key']};});_0x141dfd['model']=_['map'](_0x2e57f3,_0x93a9('0x2d'));_0x141dfd[_0x93a9('0x2e')]=_[_0x93a9('0x2f')](_0x35dd0f['query']);_0x141dfd[_0x93a9('0x30')]=_['intersection'](_0x141dfd[_0x93a9('0x31')],_0x141dfd[_0x93a9('0x2e')]);_0x264ae5[_0x93a9('0x32')]=_[_0x93a9('0x33')](_0x141dfd['model'],qs[_0x93a9('0x34')](_0x35dd0f['query'][_0x93a9('0x34')]));_0x264ae5[_0x93a9('0x32')]=_0x264ae5['attributes'][_0x93a9('0x35')]?_0x264ae5[_0x93a9('0x32')]:_0x141dfd[_0x93a9('0x31')];if(!_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x36')]('nolimit')){_0x264ae5[_0x93a9('0x19')]=qs[_0x93a9('0x19')](_0x35dd0f['query']['limit']);_0x264ae5[_0x93a9('0x17')]=qs[_0x93a9('0x17')](_0x35dd0f['query']['offset']);}_0x264ae5[_0x93a9('0x37')]=qs[_0x93a9('0x38')](_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x38')]);_0x264ae5['where']=qs['filters'](_[_0x93a9('0x39')](_0x35dd0f[_0x93a9('0x2e')],_0x141dfd[_0x93a9('0x30')]),_0x2e57f3);if(_0x35dd0f[_0x93a9('0x2e')]['filter']){_0x264ae5[_0x93a9('0x3a')]=_[_0x93a9('0x3b')](_0x264ae5['where'],{'$or':[{'key':{'$like':'%'+_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x3c')]+'%'}},{'value':{'$like':'%'+_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x3c')]+'%'}}]});}_0x264ae5=_['merge']({},_0x264ae5,_0x35dd0f[_0x93a9('0x3d')]);var _0x46ef20={'where':_0x264ae5[_0x93a9('0x3a')]};return db[_0x93a9('0x3e')][_0x93a9('0x1a')](_0x46ef20)[_0x93a9('0x20')](function(_0x517050){_0x4b9e70[_0x93a9('0x1a')]=_0x517050;if(_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x3f')]){_0x264ae5[_0x93a9('0x40')]=[{'all':!![]}];}return db[_0x93a9('0x3e')][_0x93a9('0x41')](_0x264ae5);})[_0x93a9('0x20')](function(_0x30892b){_0x4b9e70[_0x93a9('0x42')]=_0x30892b;return _0x4b9e70;})[_0x93a9('0x20')](respondWithFilteredResult(_0x35d2b8,_0x264ae5))[_0x93a9('0x43')](handleError(_0x35d2b8,null));};exports['show']=function(_0x30b7da,_0x502049){var _0x21dba8={'raw':!![],'where':{'id':_0x30b7da['params']['id']}},_0x2b6b42={};_0x2b6b42[_0x93a9('0x31')]=_['keys'](db[_0x93a9('0x3e')]['rawAttributes']);_0x2b6b42[_0x93a9('0x2e')]=_[_0x93a9('0x2f')](_0x30b7da['query']);_0x2b6b42[_0x93a9('0x30')]=_[_0x93a9('0x33')](_0x2b6b42['model'],_0x2b6b42['query']);_0x21dba8[_0x93a9('0x32')]=_[_0x93a9('0x33')](_0x2b6b42[_0x93a9('0x31')],qs[_0x93a9('0x34')](_0x30b7da['query'][_0x93a9('0x34')]));_0x21dba8['attributes']=_0x21dba8['attributes']['length']?_0x21dba8[_0x93a9('0x32')]:_0x2b6b42[_0x93a9('0x31')];if(_0x30b7da[_0x93a9('0x2e')][_0x93a9('0x3f')]){_0x21dba8[_0x93a9('0x40')]=[{'all':!![]}];}_0x21dba8=_[_0x93a9('0x3b')]({},_0x21dba8,_0x30b7da['options']);return db['CannedAnswer'][_0x93a9('0x44')](_0x21dba8)[_0x93a9('0x20')](handleEntityNotFound(_0x502049,null))[_0x93a9('0x20')](respondWithResult(_0x502049,null))[_0x93a9('0x43')](handleError(_0x502049,null));};exports[_0x93a9('0x1f')]=function(_0x5a5b4b,_0x38e989){if(_0x5a5b4b[_0x93a9('0x45')]['id']){delete _0x5a5b4b[_0x93a9('0x45')]['id'];}return db[_0x93a9('0x3e')][_0x93a9('0x44')]({'where':{'id':_0x5a5b4b[_0x93a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x38e989,null))['then'](saveUpdates(_0x5a5b4b['body'],null))[_0x93a9('0x20')](respondWithResult(_0x38e989,null))[_0x93a9('0x43')](handleError(_0x38e989,null));};exports[_0x93a9('0x21')]=function(_0x17ef7c,_0x2a248f){return db[_0x93a9('0x3e')][_0x93a9('0x44')]({'where':{'id':_0x17ef7c[_0x93a9('0x46')]['id']}})[_0x93a9('0x20')](handleEntityNotFound(_0x2a248f,null))[_0x93a9('0x20')](removeEntity(_0x2a248f,null))['catch'](handleError(_0x2a248f,null));};exports[_0x93a9('0x47')]=function(_0xea3460,_0x20cedd){var _0x2abde3={'key':_0xea3460[_0x93a9('0x45')][_0x93a9('0x48')]};if(_0xea3460[_0x93a9('0x45')][_0x93a9('0x49')]){_0x2abde3[_0x93a9('0x49')]=_0xea3460[_0x93a9('0x45')]['MailAccountId'];}else if(_0xea3460[_0x93a9('0x45')][_0x93a9('0x4a')]){_0x2abde3['SmsAccountId']=_0xea3460[_0x93a9('0x45')][_0x93a9('0x4a')];}else if(_0xea3460[_0x93a9('0x45')][_0x93a9('0x4b')]){_0x2abde3[_0x93a9('0x4b')]=_0xea3460[_0x93a9('0x45')][_0x93a9('0x4b')];}else if(_0xea3460['body']['ChatWebsiteId']){_0x2abde3[_0x93a9('0x4c')]=_0xea3460[_0x93a9('0x45')]['ChatWebsiteId'];}return db[_0x93a9('0x3e')][_0x93a9('0x44')]({'where':_0x2abde3})['then'](function(_0x4c1be0){if(_0x4c1be0){throw new db['Sequelize'][(_0x93a9('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x93a9('0x3e')][_0x93a9('0x47')](_0xea3460['body']);})['then'](function(_0x52c57d){var _0x2d90d1=_0xea3460[_0x93a9('0x4e')][_0x93a9('0x22')]({'plain':!![]});if(!_0x2d90d1)throw new Error(_0x93a9('0x4f'));if(_0x2d90d1[_0x93a9('0x50')]===_0x93a9('0x4e')){var _0x5d0c64=_0x52c57d[_0x93a9('0x22')]({'plain':!![]});return db[_0x93a9('0x51')][_0x93a9('0x44')]({'where':{'name':_0x93a9('0x52'),'userProfileId':_0x2d90d1[_0x93a9('0x53')]},'raw':!![]})['then'](function(_0x127d38){if(_0x127d38&&_0x127d38[_0x93a9('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d0c64[_0x93a9('0x2d')],'resourceId':_0x5d0c64['id'],'type':_0x127d38[_0x93a9('0x2d')],'sectionId':_0x127d38['id']},{})[_0x93a9('0x20')](function(){return _0x52c57d;});}else{return _0x52c57d;}})['catch'](function(_0x3b343b){logger[_0x93a9('0x25')](_0x93a9('0x55'),_0x3b343b);throw _0x3b343b;});}return _0x52c57d;})['then'](respondWithResult(_0x20cedd,0xc9))[_0x93a9('0x43')](handleError(_0x20cedd,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d75f6e2..4f7fa4f 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 _0x1cc3=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1cc3,0x11b));var _0x31cc=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1cc3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x31cc('0x0'));var util=require(_0x31cc('0x1'));var logger=require('../../config/logger')(_0x31cc('0x2'));var moment=require('moment');var BPromise=require(_0x31cc('0x3'));var rp=require(_0x31cc('0x4'));var fs=require('fs');var path=require(_0x31cc('0x5'));var rimraf=require('rimraf');var config=require(_0x31cc('0x6'));var attributes=require(_0x31cc('0x7'));module[_0x31cc('0x8')]=function(_0x541da0,_0xc7ae44){return _0x541da0[_0x31cc('0x9')](_0x31cc('0xa'),attributes,{'tableName':_0x31cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31cc('0xc'),'collate':_0x31cc('0xd')});}; \ No newline at end of file +var _0x38c3=['request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x1977c4,_0x4bdcff){var _0x3a2a22=function(_0x3a6342){while(--_0x3a6342){_0x1977c4['push'](_0x1977c4['shift']());}};_0x3a2a22(++_0x4bdcff);}(_0x38c3,0x1cc));var _0x338c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x38c3[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var logger=require(_0x338c('0x2'))(_0x338c('0x3'));var moment=require('moment');var BPromise=require(_0x338c('0x4'));var rp=require(_0x338c('0x5'));var fs=require('fs');var path=require(_0x338c('0x6'));var rimraf=require(_0x338c('0x7'));var config=require(_0x338c('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x338c('0x9')]=function(_0x14d313,_0xed4adc){return _0x14d313[_0x338c('0xa')](_0x338c('0xb'),attributes,{'tableName':_0x338c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x338c('0xd'),'collate':_0x338c('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 0922d77..a48c97a 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(_0x1e24a8,_0x215f94){var _0x274925=function(_0x49cb6b){while(--_0x49cb6b){_0x1e24a8['push'](_0x1e24a8['shift']());}};_0x274925(++_0x215f94);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x5293a8,_0x1ddfb2){var _0x42b121=function(_0x4502a9){while(--_0x4502a9){_0x5293a8['push'](_0x5293a8['shift']());}};_0x42b121(++_0x1ddfb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 444131a..1c83a9e 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 _0x0cfa=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0cfa,0xe1));var _0xa0cf=function(_0x21b9e1,_0x135774){_0x21b9e1=_0x21b9e1-0x0;var _0x3c5675=_0x0cfa[_0x21b9e1];return _0x3c5675;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require(_0xa0cf('0x4'));var router=express[_0xa0cf('0x5')]();var fs_extra=require(_0xa0cf('0x6'));var auth=require(_0xa0cf('0x7'));var interaction=require(_0xa0cf('0x8'));var config=require(_0xa0cf('0x9'));var controller=require(_0xa0cf('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa0cf('0xb')](_0xa0cf('0xc'),auth[_0xa0cf('0xd')](),controller[_0xa0cf('0xe')]);router[_0xa0cf('0xf')]('/',auth[_0xa0cf('0xd')](),controller[_0xa0cf('0x10')]);router[_0xa0cf('0x11')](_0xa0cf('0xc'),auth['isAuthenticated'](),controller[_0xa0cf('0x12')]);router['delete'](_0xa0cf('0xc'),auth[_0xa0cf('0xd')](),controller[_0xa0cf('0x13')]);module[_0xa0cf('0x14')]=router; \ No newline at end of file +var _0x8d90=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','get','/:id','show','post','create','put','exports'];(function(_0xf94f9d,_0x55f715){var _0x1dc51c=function(_0x4ca302){while(--_0x4ca302){_0xf94f9d['push'](_0xf94f9d['shift']());}};_0x1dc51c(++_0x55f715);}(_0x8d90,0x66));var _0x08d9=function(_0x5f4963,_0x246a3d){_0x5f4963=_0x5f4963-0x0;var _0x20ac87=_0x8d90[_0x5f4963];return _0x20ac87;};'use strict';var multer=require(_0x08d9('0x0'));var util=require(_0x08d9('0x1'));var path=require(_0x08d9('0x2'));var timeout=require(_0x08d9('0x3'));var express=require('express');var router=express[_0x08d9('0x4')]();var fs_extra=require(_0x08d9('0x5'));var auth=require(_0x08d9('0x6'));var interaction=require(_0x08d9('0x7'));var config=require('../../config/environment');var controller=require(_0x08d9('0x8'));router['get']('/',auth[_0x08d9('0x9')](),controller['index']);router[_0x08d9('0xa')](_0x08d9('0xb'),auth[_0x08d9('0x9')](),controller[_0x08d9('0xc')]);router[_0x08d9('0xd')]('/',auth[_0x08d9('0x9')](),controller[_0x08d9('0xe')]);router[_0x08d9('0xf')](_0x08d9('0xb'),auth[_0x08d9('0x9')](),controller['update']);router['delete'](_0x08d9('0xb'),auth[_0x08d9('0x9')](),controller['destroy']);module[_0x08d9('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 690ddb7..0dad7cd 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 _0x180f=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x180f,0xf3));var _0xf180=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x180f[_0x4bf96c];return _0x281d09;};'use strict';var Sequelize=require(_0xf180('0x0'));module[_0xf180('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xf180('0x2')},'clid':{'type':Sequelize[_0xf180('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf180('0x3')]},'dcontext':{'type':Sequelize[_0xf180('0x3')]},'channel':{'type':Sequelize[_0xf180('0x3')]},'dstchannel':{'type':Sequelize[_0xf180('0x3')]},'lastapp':{'type':Sequelize[_0xf180('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf180('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf180('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf180('0x3')]},'userfield':{'type':Sequelize[_0xf180('0x3')]},'uniqueid':{'type':Sequelize[_0xf180('0x3')]},'linkedid':{'type':Sequelize[_0xf180('0x3')]},'sequence':{'type':Sequelize[_0xf180('0x3')]},'peeraccount':{'type':Sequelize[_0xf180('0x3')]},'type':{'type':Sequelize[_0xf180('0x3')]},'tag':{'type':Sequelize[_0xf180('0x3')]}}; \ No newline at end of file +var _0x5374=['STRING','INTEGER','exports','DATE'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x5374,0xd6));var _0x4537=function(_0x212a59,_0x113a9b){_0x212a59=_0x212a59-0x0;var _0x4f871d=_0x5374[_0x212a59];return _0x4f871d;};'use strict';var Sequelize=require('sequelize');module[_0x4537('0x0')]={'calldate':{'type':Sequelize[_0x4537('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x4537('0x2')]},'src':{'type':Sequelize[_0x4537('0x2')]},'dst':{'type':Sequelize[_0x4537('0x2')]},'dcontext':{'type':Sequelize[_0x4537('0x2')]},'channel':{'type':Sequelize[_0x4537('0x2')]},'dstchannel':{'type':Sequelize[_0x4537('0x2')]},'lastapp':{'type':Sequelize[_0x4537('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x4537('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4537('0x2')]},'amaflags':{'type':Sequelize[_0x4537('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4537('0x2')]},'userfield':{'type':Sequelize[_0x4537('0x2')]},'uniqueid':{'type':Sequelize[_0x4537('0x2')]},'linkedid':{'type':Sequelize[_0x4537('0x2')]},'sequence':{'type':Sequelize[_0x4537('0x2')]},'peeraccount':{'type':Sequelize[_0x4537('0x2')]},'type':{'type':Sequelize[_0x4537('0x2')]},'tag':{'type':Sequelize[_0x4537('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index abefdb9..43aed66 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 _0x81bd=['offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','describe','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'];(function(_0x2c3fe3,_0x3f0d43){var _0x293a41=function(_0x1b9c79){while(--_0x1b9c79){_0x2c3fe3['push'](_0x2c3fe3['shift']());}};_0x293a41(++_0x3f0d43);}(_0x81bd,0x7c));var _0xd81b=function(_0x10778c,_0x461571){_0x10778c=_0x10778c-0x0;var _0x38d5f2=_0x81bd[_0x10778c];return _0x38d5f2;};'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(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2ccedf,_0x1bf351){return function(_0x596389){if(!_0x596389){_0x2ccedf[_0xd81b('0x1b')](0x194);}return _0x596389;};}function handleError(_0x99dbc9,_0xe3637a){_0xe3637a=_0xe3637a||0x1f4;return function(_0x31b9fd){logger[_0xd81b('0x2a')](_0x31b9fd[_0xd81b('0x2b')]);if(_0x31b9fd[_0xd81b('0x2c')]){delete _0x31b9fd[_0xd81b('0x2c')];}_0x99dbc9[_0xd81b('0x1d')](_0xe3637a)['send'](_0x31b9fd);};}exports[_0xd81b('0x2d')]=function(_0x4e2eff,_0x5c8aee){var _0xb9ff9f={},_0x260310={},_0x5141e6={'count':0x0,'rows':[]};var _0x481454=_[_0xd81b('0x2e')](db[_0xd81b('0x2f')][_0xd81b('0x30')],function(_0x289f54){return{'name':_0x289f54[_0xd81b('0x31')],'type':_0x289f54[_0xd81b('0x32')]['key']};});_0x260310[_0xd81b('0x33')]=_[_0xd81b('0x2e')](_0x481454,'name');_0x260310['query']=_[_0xd81b('0x34')](_0x4e2eff[_0xd81b('0x35')]);_0x260310['filters']=_['intersection'](_0x260310['model'],_0x260310[_0xd81b('0x35')]);_0xb9ff9f[_0xd81b('0x36')]=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],qs[_0xd81b('0x38')](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x38')]));_0xb9ff9f['attributes']=_0xb9ff9f[_0xd81b('0x36')]['length']?_0xb9ff9f[_0xd81b('0x36')]:_0x260310[_0xd81b('0x33')];if(!_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x39')](_0xd81b('0x3a'))){_0xb9ff9f[_0xd81b('0x20')]=qs[_0xd81b('0x20')](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x20')]);_0xb9ff9f[_0xd81b('0x22')]=qs[_0xd81b('0x22')](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x22')]);}_0xb9ff9f['order']=qs['sort'](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x3b')]);_0xb9ff9f[_0xd81b('0x3c')]=qs['filters'](_[_0xd81b('0x3d')](_0x4e2eff[_0xd81b('0x35')],_0x260310['filters']),_0x481454);if(_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x3e')]){_0xb9ff9f['where']=_[_0xd81b('0x3f')](_0xb9ff9f['where'],{'$or':_[_0xd81b('0x2e')](_0x481454,function(_0x2502d1){if(_0x2502d1[_0xd81b('0x32')]!==_0xd81b('0x40')){var _0x573da5={};_0x573da5[_0x2502d1[_0xd81b('0x2c')]]={'$like':'%'+_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x3e')]+'%'};return _0x573da5;}})});}_0xb9ff9f=_[_0xd81b('0x3f')]({},_0xb9ff9f,_0x4e2eff[_0xd81b('0x41')]);var _0x466e98={'where':_0xb9ff9f[_0xd81b('0x3c')]};return db['Cdr'][_0xd81b('0x21')](_0x466e98)[_0xd81b('0x28')](function(_0x5185fe){_0x5141e6['count']=_0x5185fe;if(_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x42')]){_0xb9ff9f[_0xd81b('0x43')]=[{'all':!![]}];}return db[_0xd81b('0x2f')][_0xd81b('0x44')](_0xb9ff9f);})['then'](function(_0x3dfba7){_0x5141e6[_0xd81b('0x45')]=_0x3dfba7;return _0x5141e6;})[_0xd81b('0x28')](respondWithFilteredResult(_0x5c8aee,_0xb9ff9f))[_0xd81b('0x46')](handleError(_0x5c8aee,null));};exports[_0xd81b('0x47')]=function(_0x235f4b,_0x1c13d2){var _0x486f0d={'raw':!![],'where':{'id':_0x235f4b[_0xd81b('0x48')]['id']}},_0x4405a8={};_0x4405a8[_0xd81b('0x33')]=_['keys'](db[_0xd81b('0x2f')][_0xd81b('0x30')]);_0x4405a8[_0xd81b('0x35')]=_[_0xd81b('0x34')](_0x235f4b[_0xd81b('0x35')]);_0x4405a8[_0xd81b('0x49')]=_[_0xd81b('0x37')](_0x4405a8[_0xd81b('0x33')],_0x4405a8['query']);_0x486f0d['attributes']=_[_0xd81b('0x37')](_0x4405a8[_0xd81b('0x33')],qs[_0xd81b('0x38')](_0x235f4b[_0xd81b('0x35')][_0xd81b('0x38')]));_0x486f0d[_0xd81b('0x36')]=_0x486f0d[_0xd81b('0x36')][_0xd81b('0x4a')]?_0x486f0d[_0xd81b('0x36')]:_0x4405a8[_0xd81b('0x33')];if(_0x235f4b[_0xd81b('0x35')][_0xd81b('0x42')]){_0x486f0d['include']=[{'all':!![]}];}_0x486f0d=_[_0xd81b('0x3f')]({},_0x486f0d,_0x235f4b[_0xd81b('0x41')]);return db[_0xd81b('0x2f')][_0xd81b('0x4b')](_0x486f0d)[_0xd81b('0x28')](handleEntityNotFound(_0x1c13d2,null))[_0xd81b('0x28')](respondWithResult(_0x1c13d2,null))[_0xd81b('0x46')](handleError(_0x1c13d2,null));};exports[_0xd81b('0x4c')]=function(_0x183bd6,_0x53ea36){return db[_0xd81b('0x2f')][_0xd81b('0x4c')](_0x183bd6[_0xd81b('0x4d')],{})[_0xd81b('0x28')](respondWithResult(_0x53ea36,0xc9))['catch'](handleError(_0x53ea36,null));};exports[_0xd81b('0x27')]=function(_0x151127,_0x15030b){if(_0x151127[_0xd81b('0x4d')]['id']){delete _0x151127[_0xd81b('0x4d')]['id'];}return db[_0xd81b('0x2f')][_0xd81b('0x4b')]({'where':{'id':_0x151127[_0xd81b('0x48')]['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x15030b,null))['then'](saveUpdates(_0x151127['body'],null))[_0xd81b('0x28')](respondWithResult(_0x15030b,null))[_0xd81b('0x46')](handleError(_0x15030b,null));};exports[_0xd81b('0x29')]=function(_0x4da281,_0x1df998){return db[_0xd81b('0x2f')][_0xd81b('0x4b')]({'where':{'id':_0x4da281[_0xd81b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1df998,null))[_0xd81b('0x28')](removeEntity(_0x1df998,null))[_0xd81b('0x46')](handleError(_0x1df998,null));};exports[_0xd81b('0x4e')]=function(_0x3d171a,_0x4651d3){return db['Cdr'][_0xd81b('0x4e')]()[_0xd81b('0x28')](respondWithResult(_0x4651d3,null))['catch'](handleError(_0x4651d3,null));}; \ No newline at end of file +var _0x826a=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','Cdr','fieldName','type'];(function(_0xfdf7a4,_0x37da46){var _0x59ec89=function(_0x5a4094){while(--_0x5a4094){_0xfdf7a4['push'](_0xfdf7a4['shift']());}};_0x59ec89(++_0x37da46);}(_0x826a,0x1aa));var _0xa826=function(_0x577c48,_0xda52e1){_0x577c48=_0x577c48-0x0;var _0xe5ccb6=_0x826a[_0x577c48];return _0xe5ccb6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa826('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa826('0x1'));var rp=require('request-promise');var moment=require(_0xa826('0x2'));var BPromise=require(_0xa826('0x3'));var Mustache=require(_0xa826('0x4'));var util=require(_0xa826('0x5'));var path=require('path');var sox=require(_0xa826('0x6'));var csv=require(_0xa826('0x7'));var ejs=require(_0xa826('0x8'));var fs=require('fs');var fs_extra=require(_0xa826('0x9'));var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x7'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var as=require(_0xa826('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa826('0x15'))('api');var utils=require(_0xa826('0x16'));var config=require(_0xa826('0x17'));var licenseUtil=require(_0xa826('0x18'));var db=require(_0xa826('0x19'))['db'];function respondWithStatusCode(_0x212fac,_0x40838f){_0x40838f=_0x40838f||0xcc;return function(_0x2f1d39){if(_0x2f1d39){return _0x212fac['sendStatus'](_0x40838f);}return _0x212fac[_0xa826('0x1a')](_0x40838f)['end']();};}function respondWithResult(_0x3e99b0,_0x41c0c2){_0x41c0c2=_0x41c0c2||0xc8;return function(_0x5dc0c7){if(_0x5dc0c7){return _0x3e99b0['status'](_0x41c0c2)['json'](_0x5dc0c7);}};}function respondWithFilteredResult(_0x1b6d16,_0x4f25bd){return function(_0x4c546b){if(_0x4c546b){var _0x9a3788=typeof _0x4f25bd[_0xa826('0x1b')]===_0xa826('0x1c')&&typeof _0x4f25bd['limit']===_0xa826('0x1c');var _0x312e14=_0x4c546b[_0xa826('0x1d')];var _0x453c5d=_0x9a3788?0x0:_0x4f25bd[_0xa826('0x1b')];var _0x48930f=_0x9a3788?_0x4c546b[_0xa826('0x1d')]:_0x4f25bd[_0xa826('0x1b')]+_0x4f25bd[_0xa826('0x1e')];var _0x57e96e;if(_0x48930f>=_0x312e14){_0x48930f=_0x312e14;_0x57e96e=0xc8;}else{_0x57e96e=0xce;}_0x1b6d16['status'](_0x57e96e);return _0x1b6d16[_0xa826('0x1f')](_0xa826('0x20'),_0x453c5d+'-'+_0x48930f+'/'+_0x312e14)[_0xa826('0x21')](_0x4c546b);}return null;};}function patchUpdates(_0x8d1650){return function(_0x124564){try{jsonpatch['apply'](_0x124564,_0x8d1650,!![]);}catch(_0x3171ff){return BPromise[_0xa826('0x22')](_0x3171ff);}return _0x124564[_0xa826('0x23')]();};}function saveUpdates(_0x5d410f,_0x5ddeef){return function(_0x361ca5){if(_0x361ca5){return _0x361ca5[_0xa826('0x24')](_0x5d410f)[_0xa826('0x25')](function(_0x4eb4f3){return _0x4eb4f3;});}return null;};}function removeEntity(_0x1d7adf,_0x26ef25){return function(_0x1d4ade){if(_0x1d4ade){return _0x1d4ade[_0xa826('0x26')]()[_0xa826('0x25')](function(){_0x1d7adf['status'](0xcc)[_0xa826('0x27')]();});}};}function handleEntityNotFound(_0x4fa5db,_0x17ef2d){return function(_0x174f16){if(!_0x174f16){_0x4fa5db['sendStatus'](0x194);}return _0x174f16;};}function handleError(_0xfc0448,_0xfa4d94){_0xfa4d94=_0xfa4d94||0x1f4;return function(_0x38c919){logger[_0xa826('0x28')](_0x38c919[_0xa826('0x29')]);if(_0x38c919[_0xa826('0x2a')]){delete _0x38c919[_0xa826('0x2a')];}_0xfc0448[_0xa826('0x1a')](_0xfa4d94)[_0xa826('0x2b')](_0x38c919);};}exports[_0xa826('0x2c')]=function(_0x1e35de,_0x473d8d){var _0x1f2749={},_0x2cb586={},_0x2253c7={'count':0x0,'rows':[]};var _0x27f8f9=_['map'](db[_0xa826('0x2d')]['rawAttributes'],function(_0x2dd810){return{'name':_0x2dd810[_0xa826('0x2e')],'type':_0x2dd810[_0xa826('0x2f')][_0xa826('0x30')]};});_0x2cb586[_0xa826('0x31')]=_['map'](_0x27f8f9,'name');_0x2cb586[_0xa826('0x32')]=_[_0xa826('0x33')](_0x1e35de[_0xa826('0x32')]);_0x2cb586[_0xa826('0x34')]=_['intersection'](_0x2cb586[_0xa826('0x31')],_0x2cb586[_0xa826('0x32')]);_0x1f2749['attributes']=_[_0xa826('0x35')](_0x2cb586['model'],qs[_0xa826('0x36')](_0x1e35de[_0xa826('0x32')][_0xa826('0x36')]));_0x1f2749[_0xa826('0x37')]=_0x1f2749[_0xa826('0x37')]['length']?_0x1f2749[_0xa826('0x37')]:_0x2cb586[_0xa826('0x31')];if(!_0x1e35de[_0xa826('0x32')][_0xa826('0x38')](_0xa826('0x39'))){_0x1f2749[_0xa826('0x1e')]=qs[_0xa826('0x1e')](_0x1e35de[_0xa826('0x32')][_0xa826('0x1e')]);_0x1f2749[_0xa826('0x1b')]=qs[_0xa826('0x1b')](_0x1e35de['query'][_0xa826('0x1b')]);}_0x1f2749['order']=qs[_0xa826('0x3a')](_0x1e35de['query'][_0xa826('0x3a')]);_0x1f2749[_0xa826('0x3b')]=qs[_0xa826('0x34')](_[_0xa826('0x3c')](_0x1e35de[_0xa826('0x32')],_0x2cb586[_0xa826('0x34')]),_0x27f8f9);if(_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]){_0x1f2749[_0xa826('0x3b')]=_[_0xa826('0x3e')](_0x1f2749[_0xa826('0x3b')],{'$or':_[_0xa826('0x3f')](_0x27f8f9,function(_0x5911d3){if(_0x5911d3[_0xa826('0x2f')]!==_0xa826('0x40')){var _0x251208={};_0x251208[_0x5911d3['name']]={'$like':'%'+_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]+'%'};return _0x251208;}})});}_0x1f2749=_['merge']({},_0x1f2749,_0x1e35de[_0xa826('0x41')]);var _0x47d9f1={'where':_0x1f2749['where']};return db[_0xa826('0x2d')][_0xa826('0x1d')](_0x47d9f1)[_0xa826('0x25')](function(_0x308d4){_0x2253c7[_0xa826('0x1d')]=_0x308d4;if(_0x1e35de[_0xa826('0x32')]['includeAll']){_0x1f2749[_0xa826('0x42')]=[{'all':!![]}];}return db[_0xa826('0x2d')][_0xa826('0x43')](_0x1f2749);})[_0xa826('0x25')](function(_0x244fd3){_0x2253c7[_0xa826('0x44')]=_0x244fd3;return _0x2253c7;})['then'](respondWithFilteredResult(_0x473d8d,_0x1f2749))[_0xa826('0x45')](handleError(_0x473d8d,null));};exports[_0xa826('0x46')]=function(_0x405ee1,_0x162be1){var _0x258e57={'raw':!![],'where':{'id':_0x405ee1[_0xa826('0x47')]['id']}},_0x53b70e={};_0x53b70e[_0xa826('0x31')]=_[_0xa826('0x33')](db[_0xa826('0x2d')][_0xa826('0x48')]);_0x53b70e[_0xa826('0x32')]=_[_0xa826('0x33')](_0x405ee1[_0xa826('0x32')]);_0x53b70e[_0xa826('0x34')]=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],_0x53b70e[_0xa826('0x32')]);_0x258e57['attributes']=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],qs[_0xa826('0x36')](_0x405ee1['query'][_0xa826('0x36')]));_0x258e57[_0xa826('0x37')]=_0x258e57[_0xa826('0x37')][_0xa826('0x49')]?_0x258e57[_0xa826('0x37')]:_0x53b70e['model'];if(_0x405ee1[_0xa826('0x32')][_0xa826('0x4a')]){_0x258e57[_0xa826('0x42')]=[{'all':!![]}];}_0x258e57=_[_0xa826('0x3e')]({},_0x258e57,_0x405ee1[_0xa826('0x41')]);return db[_0xa826('0x2d')][_0xa826('0x4b')](_0x258e57)['then'](handleEntityNotFound(_0x162be1,null))[_0xa826('0x25')](respondWithResult(_0x162be1,null))['catch'](handleError(_0x162be1,null));};exports['create']=function(_0x4b4352,_0x26a858){return db[_0xa826('0x2d')][_0xa826('0x4c')](_0x4b4352[_0xa826('0x4d')],{})['then'](respondWithResult(_0x26a858,0xc9))[_0xa826('0x45')](handleError(_0x26a858,null));};exports['update']=function(_0x5e0947,_0xedcbc2){if(_0x5e0947[_0xa826('0x4d')]['id']){delete _0x5e0947['body']['id'];}return db[_0xa826('0x2d')][_0xa826('0x4b')]({'where':{'id':_0x5e0947['params']['id']}})['then'](handleEntityNotFound(_0xedcbc2,null))['then'](saveUpdates(_0x5e0947['body'],null))['then'](respondWithResult(_0xedcbc2,null))['catch'](handleError(_0xedcbc2,null));};exports['destroy']=function(_0xb3fae0,_0x5d5269){return db[_0xa826('0x2d')]['find']({'where':{'id':_0xb3fae0[_0xa826('0x47')]['id']}})[_0xa826('0x25')](handleEntityNotFound(_0x5d5269,null))[_0xa826('0x25')](removeEntity(_0x5d5269,null))[_0xa826('0x45')](handleError(_0x5d5269,null));};exports[_0xa826('0x4e')]=function(_0x52cf5e,_0x209704){return db['Cdr']['describe']()[_0xa826('0x25')](respondWithResult(_0x209704,null))[_0xa826('0x45')](handleError(_0x209704,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1fdef06..4085fe4 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1f1e73,_0x15dc2c){var _0x4ebdec=function(_0x54af53){while(--_0x54af53){_0x1f1e73['push'](_0x1f1e73['shift']());}};_0x4ebdec(++_0x15dc2c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xa4c049,_0xc51262){var _0x1fd90a=function(_0xeebae){while(--_0xeebae){_0xa4c049['push'](_0xa4c049['shift']());}};_0x1fd90a(++_0xc51262);}(_0x7a54,0x106));var _0x47a5=function(_0x4be0b5,_0x4f225e){_0x4be0b5=_0x4be0b5-0x0;var _0x2cf5bd=_0x7a54[_0x4be0b5];return _0x2cf5bd;};'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 d48bfde..8a6e8a6 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 _0x42d7=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x42d7,0x123));var _0x742d=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x42d7[_0x2c9b79];return _0x265032;};'use strict';var _=require('lodash');var util=require(_0x742d('0x0'));var moment=require(_0x742d('0x1'));var BPromise=require('bluebird');var rs=require(_0x742d('0x2'));var fs=require('fs');var Redis=require(_0x742d('0x3'));var db=require(_0x742d('0x4'))['db'];var utils=require(_0x742d('0x5'));var logger=require(_0x742d('0x6'))(_0x742d('0x7'));var config=require(_0x742d('0x8'));var jayson=require(_0x742d('0x9'));var client=jayson[_0x742d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db34c,_0x1eb113,_0x33dab0){return new BPromise(function(_0x4d3657,_0x36b90d){return client[_0x742d('0xb')](_0x1db34c,_0x33dab0)[_0x742d('0xc')](function(_0x42feed){logger[_0x742d('0xd')](_0x742d('0xe'),_0x1eb113,_0x742d('0xf'));logger[_0x742d('0x10')](_0x742d('0x11'),_0x1eb113,_0x742d('0xf'),JSON[_0x742d('0x12')](_0x42feed));if(_0x42feed[_0x742d('0x13')]){if(_0x42feed[_0x742d('0x13')][_0x742d('0x14')]===0x1f4){logger[_0x742d('0x13')](_0x742d('0xe'),_0x1eb113,_0x42feed['error'][_0x742d('0x15')]);return _0x36b90d(_0x42feed['error'][_0x742d('0x15')]);}logger[_0x742d('0x13')](_0x742d('0xe'),_0x1eb113,_0x42feed['error'][_0x742d('0x15')]);return _0x4d3657(_0x42feed[_0x742d('0x13')][_0x742d('0x15')]);}else{logger[_0x742d('0xd')](_0x742d('0xe'),_0x1eb113,'request\x20sent');_0x4d3657(_0x42feed[_0x742d('0x16')]['message']);}})[_0x742d('0x17')](function(_0x2e1078){logger[_0x742d('0x13')](_0x742d('0xe'),_0x1eb113,_0x2e1078);_0x36b90d(_0x2e1078);});});} \ No newline at end of file +var _0xf11a=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xd60c25,_0x45de3c){var _0x13e0cf=function(_0x27cda9){while(--_0x27cda9){_0xd60c25['push'](_0xd60c25['shift']());}};_0x13e0cf(++_0x45de3c);}(_0xf11a,0xf3));var _0xaf11=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xf11a[_0x4017b0];return _0x5ed4f7;};'use strict';var _=require(_0xaf11('0x0'));var util=require(_0xaf11('0x1'));var moment=require('moment');var BPromise=require(_0xaf11('0x2'));var rs=require(_0xaf11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf11('0x4'))['db'];var utils=require(_0xaf11('0x5'));var logger=require(_0xaf11('0x6'))('rpc');var config=require(_0xaf11('0x7'));var jayson=require(_0xaf11('0x8'));var client=jayson[_0xaf11('0x9')][_0xaf11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3815c1,_0x4e3bbb,_0x4736bb){return new BPromise(function(_0x33994f,_0x28149d){return client[_0xaf11('0xb')](_0x3815c1,_0x4736bb)[_0xaf11('0xc')](function(_0x37b97d){logger[_0xaf11('0xd')](_0xaf11('0xe'),_0x4e3bbb,_0xaf11('0xf'));logger[_0xaf11('0x10')](_0xaf11('0x11'),_0x4e3bbb,_0xaf11('0xf'),JSON[_0xaf11('0x12')](_0x37b97d));if(_0x37b97d[_0xaf11('0x13')]){if(_0x37b97d[_0xaf11('0x13')]['code']===0x1f4){logger[_0xaf11('0x13')](_0xaf11('0xe'),_0x4e3bbb,_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);return _0x28149d(_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);}logger[_0xaf11('0x13')](_0xaf11('0xe'),_0x4e3bbb,_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);return _0x33994f(_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);}else{logger[_0xaf11('0xd')]('Cdr,\x20%s,\x20%s',_0x4e3bbb,'request\x20sent');_0x33994f(_0x37b97d['result'][_0xaf11('0x14')]);}})[_0xaf11('0x15')](function(_0x387998){logger['error']('Cdr,\x20%s,\x20%s',_0x4e3bbb,_0x387998);_0x28149d(_0x387998);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c0c42ae..1594bfa 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xaa7629,_0x219723){var _0x487c07=function(_0x36959c){while(--_0x36959c){_0xaa7629['push'](_0xaa7629['shift']());}};_0x487c07(++_0x219723);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x59bd6a,_0x540db8){var _0x54ffd0=function(_0x2549d0){while(--_0x2549d0){_0x59bd6a['push'](_0x59bd6a['shift']());}};_0x54ffd0(++_0x540db8);}(_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 ecd0a3c..4af5504 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 _0x3e20=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x3e20,0x190));var _0x03e2=function(_0x53c31f,_0x31c63a){_0x53c31f=_0x53c31f-0x0;var _0x489b8b=_0x3e20[_0x53c31f];return _0x489b8b;};'use strict';var Sequelize=require(_0x03e2('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x03e2('0x1')],'allowNull':![],'defaultValue':_0x03e2('0x2')},'appdata':{'type':Sequelize[_0x03e2('0x3')]()},'description':{'type':Sequelize[_0x03e2('0x1')]},'interval':{'type':Sequelize[_0x03e2('0x1')],'defaultValue':_0x03e2('0x4')}}; \ No newline at end of file +var _0x58b6=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x4a0ca6,_0xff283e){var _0x2dcf8a=function(_0x47ca9c){while(--_0x47ca9c){_0x4a0ca6['push'](_0x4a0ca6['shift']());}};_0x2dcf8a(++_0xff283e);}(_0x58b6,0x128));var _0x658b=function(_0x5c8be4,_0x5c2266){_0x5c8be4=_0x5c8be4-0x0;var _0x3b6e26=_0x58b6[_0x5c8be4];return _0x3b6e26;};'use strict';var Sequelize=require(_0x658b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x658b('0x1')],'allowNull':![],'defaultValue':_0x658b('0x2')},'appdata':{'type':Sequelize[_0x658b('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x658b('0x1')],'defaultValue':_0x658b('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8aaa882..91c8284 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 _0x9532=['end','error','stack','name','send','show','params','rawAttributes','query','keys','intersection','model','attributes','fields','includeAll','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x363050,_0x412681){var _0x3c196b=function(_0x53affb){while(--_0x53affb){_0x363050['push'](_0x363050['shift']());}};_0x3c196b(++_0x412681);}(_0x9532,0x8c));var _0x2953=function(_0x44a62c,_0x4c35af){_0x44a62c=_0x44a62c-0x0;var _0x66fe93=_0x9532[_0x44a62c];return _0x66fe93;};'use strict';var emlformat=require(_0x2953('0x0'));var rimraf=require(_0x2953('0x1'));var zipdir=require(_0x2953('0x2'));var jsonpatch=require(_0x2953('0x3'));var rp=require(_0x2953('0x4'));var moment=require(_0x2953('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2953('0x6'));var util=require(_0x2953('0x7'));var path=require('path');var sox=require(_0x2953('0x8'));var csv=require('to-csv');var ejs=require(_0x2953('0x9'));var fs=require('fs');var fs_extra=require(_0x2953('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2953('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2953('0xc'));var querystring=require('querystring');var Papa=require(_0x2953('0xd'));var Redis=require(_0x2953('0xe'));var authService=require(_0x2953('0xf'));var qs=require(_0x2953('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2953('0x11'));var logger=require(_0x2953('0x12'))(_0x2953('0x13'));var utils=require(_0x2953('0x14'));var config=require(_0x2953('0x15'));var licenseUtil=require(_0x2953('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480cae,_0x41f2be){_0x41f2be=_0x41f2be||0xcc;return function(_0x13c8a8){if(_0x13c8a8){return _0x480cae['sendStatus'](_0x41f2be);}return _0x480cae[_0x2953('0x17')](_0x41f2be)['end']();};}function respondWithResult(_0x4f15fc,_0x58f5ca){_0x58f5ca=_0x58f5ca||0xc8;return function(_0x4e1e86){if(_0x4e1e86){return _0x4f15fc[_0x2953('0x17')](_0x58f5ca)[_0x2953('0x18')](_0x4e1e86);}};}function respondWithFilteredResult(_0x2ca196,_0x16dbf5){return function(_0x1305c8){if(_0x1305c8){var _0x4b9da7=typeof _0x16dbf5[_0x2953('0x19')]===_0x2953('0x1a')&&typeof _0x16dbf5[_0x2953('0x1b')]===_0x2953('0x1a');var _0x25dad2=_0x1305c8[_0x2953('0x1c')];var _0x359e81=_0x4b9da7?0x0:_0x16dbf5[_0x2953('0x19')];var _0x52e292=_0x4b9da7?_0x1305c8[_0x2953('0x1c')]:_0x16dbf5[_0x2953('0x19')]+_0x16dbf5[_0x2953('0x1b')];var _0x288d6c;if(_0x52e292>=_0x25dad2){_0x52e292=_0x25dad2;_0x288d6c=0xc8;}else{_0x288d6c=0xce;}_0x2ca196[_0x2953('0x17')](_0x288d6c);return _0x2ca196[_0x2953('0x1d')](_0x2953('0x1e'),_0x359e81+'-'+_0x52e292+'/'+_0x25dad2)[_0x2953('0x18')](_0x1305c8);}return null;};}function patchUpdates(_0x435d94){return function(_0x68d656){try{jsonpatch[_0x2953('0x1f')](_0x68d656,_0x435d94,!![]);}catch(_0x236a10){return BPromise[_0x2953('0x20')](_0x236a10);}return _0x68d656[_0x2953('0x21')]();};}function saveUpdates(_0x142beb,_0x563d81){return function(_0x1a1240){if(_0x1a1240){return _0x1a1240[_0x2953('0x22')](_0x142beb)['then'](function(_0x4f3118){return _0x4f3118;});}return null;};}function removeEntity(_0x301c35,_0x236694){return function(_0x25857e){if(_0x25857e){return _0x25857e[_0x2953('0x23')]()[_0x2953('0x24')](function(){_0x301c35[_0x2953('0x17')](0xcc)[_0x2953('0x25')]();});}};}function handleEntityNotFound(_0x3a7ae5,_0x419192){return function(_0x234b78){if(!_0x234b78){_0x3a7ae5['sendStatus'](0x194);}return _0x234b78;};}function handleError(_0x25223e,_0x550ad8){_0x550ad8=_0x550ad8||0x1f4;return function(_0x21e221){logger[_0x2953('0x26')](_0x21e221[_0x2953('0x27')]);if(_0x21e221[_0x2953('0x28')]){delete _0x21e221['name'];}_0x25223e['status'](_0x550ad8)[_0x2953('0x29')](_0x21e221);};}exports[_0x2953('0x2a')]=function(_0x2309c6,_0x12c7ea){var _0x35040d={'raw':!![],'where':{'id':_0x2309c6[_0x2953('0x2b')]['id']}},_0xbbcead={};_0xbbcead['model']=_['keys'](db['ChatApplication'][_0x2953('0x2c')]);_0xbbcead[_0x2953('0x2d')]=_[_0x2953('0x2e')](_0x2309c6[_0x2953('0x2d')]);_0xbbcead['filters']=_[_0x2953('0x2f')](_0xbbcead[_0x2953('0x30')],_0xbbcead[_0x2953('0x2d')]);_0x35040d[_0x2953('0x31')]=_['intersection'](_0xbbcead[_0x2953('0x30')],qs[_0x2953('0x32')](_0x2309c6[_0x2953('0x2d')][_0x2953('0x32')]));_0x35040d[_0x2953('0x31')]=_0x35040d[_0x2953('0x31')]['length']?_0x35040d[_0x2953('0x31')]:_0xbbcead[_0x2953('0x30')];if(_0x2309c6[_0x2953('0x2d')][_0x2953('0x33')]){_0x35040d[_0x2953('0x34')]=[{'all':!![]}];}_0x35040d=_[_0x2953('0x35')]({},_0x35040d,_0x2309c6[_0x2953('0x36')]);return db[_0x2953('0x37')][_0x2953('0x38')](_0x35040d)['then'](handleEntityNotFound(_0x12c7ea,null))[_0x2953('0x24')](respondWithResult(_0x12c7ea,null))[_0x2953('0x39')](handleError(_0x12c7ea,null));};exports['update']=function(_0xdfc17f,_0x388227){if(_0xdfc17f[_0x2953('0x3a')]['id']){delete _0xdfc17f['body']['id'];}return db[_0x2953('0x37')][_0x2953('0x38')]({'where':{'id':_0xdfc17f[_0x2953('0x2b')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x388227,null))['then'](saveUpdates(_0xdfc17f[_0x2953('0x3a')],null))[_0x2953('0x24')](respondWithResult(_0x388227,null))[_0x2953('0x39')](handleError(_0x388227,null));};exports[_0x2953('0x23')]=function(_0x1985a2,_0x266745){return db[_0x2953('0x37')][_0x2953('0x38')]({'where':{'id':_0x1985a2[_0x2953('0x2b')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x266745,null))[_0x2953('0x24')](removeEntity(_0x266745,null))['catch'](handleError(_0x266745,null));}; \ No newline at end of file +var _0x0cee=['zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','body','find','catch','destroy','eml-format','rimraf'];(function(_0xbc0d7,_0x59a5b3){var _0x47578d=function(_0x5dff57){while(--_0x5dff57){_0xbc0d7['push'](_0xbc0d7['shift']());}};_0x47578d(++_0x59a5b3);}(_0x0cee,0x12f));var _0xe0ce=function(_0x56e51a,_0x3db67a){_0x56e51a=_0x56e51a-0x0;var _0x11d5e2=_0x0cee[_0x56e51a];return _0x11d5e2;};'use strict';var emlformat=require(_0xe0ce('0x0'));var rimraf=require(_0xe0ce('0x1'));var zipdir=require(_0xe0ce('0x2'));var jsonpatch=require(_0xe0ce('0x3'));var rp=require(_0xe0ce('0x4'));var moment=require(_0xe0ce('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe0ce('0x6'));var path=require(_0xe0ce('0x7'));var sox=require(_0xe0ce('0x8'));var csv=require(_0xe0ce('0x9'));var ejs=require(_0xe0ce('0xa'));var fs=require('fs');var fs_extra=require(_0xe0ce('0xb'));var _=require(_0xe0ce('0xc'));var squel=require(_0xe0ce('0xd'));var crypto=require('crypto');var jsforce=require(_0xe0ce('0xe'));var deskjs=require(_0xe0ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe0ce('0x10'));var Papa=require(_0xe0ce('0x11'));var Redis=require(_0xe0ce('0x12'));var authService=require(_0xe0ce('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0ce('0x14'))(_0xe0ce('0x15'));var utils=require(_0xe0ce('0x16'));var config=require(_0xe0ce('0x17'));var licenseUtil=require(_0xe0ce('0x18'));var db=require(_0xe0ce('0x19'))['db'];function respondWithStatusCode(_0x17164a,_0x4598e1){_0x4598e1=_0x4598e1||0xcc;return function(_0x46152e){if(_0x46152e){return _0x17164a[_0xe0ce('0x1a')](_0x4598e1);}return _0x17164a[_0xe0ce('0x1b')](_0x4598e1)[_0xe0ce('0x1c')]();};}function respondWithResult(_0x4b4c80,_0x4c8662){_0x4c8662=_0x4c8662||0xc8;return function(_0x166f42){if(_0x166f42){return _0x4b4c80[_0xe0ce('0x1b')](_0x4c8662)['json'](_0x166f42);}};}function respondWithFilteredResult(_0x556cff,_0x81269b){return function(_0x220456){if(_0x220456){var _0x49e9d1=typeof _0x81269b[_0xe0ce('0x1d')]===_0xe0ce('0x1e')&&typeof _0x81269b['limit']===_0xe0ce('0x1e');var _0x4e4e19=_0x220456[_0xe0ce('0x1f')];var _0x2b5ec6=_0x49e9d1?0x0:_0x81269b[_0xe0ce('0x1d')];var _0x412b52=_0x49e9d1?_0x220456[_0xe0ce('0x1f')]:_0x81269b['offset']+_0x81269b['limit'];var _0xadcb66;if(_0x412b52>=_0x4e4e19){_0x412b52=_0x4e4e19;_0xadcb66=0xc8;}else{_0xadcb66=0xce;}_0x556cff['status'](_0xadcb66);return _0x556cff['set'](_0xe0ce('0x20'),_0x2b5ec6+'-'+_0x412b52+'/'+_0x4e4e19)[_0xe0ce('0x21')](_0x220456);}return null;};}function patchUpdates(_0x494c2a){return function(_0x408369){try{jsonpatch[_0xe0ce('0x22')](_0x408369,_0x494c2a,!![]);}catch(_0x196cee){return BPromise[_0xe0ce('0x23')](_0x196cee);}return _0x408369[_0xe0ce('0x24')]();};}function saveUpdates(_0x4ce716,_0xfcb09){return function(_0x5d31b2){if(_0x5d31b2){return _0x5d31b2[_0xe0ce('0x25')](_0x4ce716)['then'](function(_0x5916c9){return _0x5916c9;});}return null;};}function removeEntity(_0x51fe9f,_0x5b8c86){return function(_0xf04ba3){if(_0xf04ba3){return _0xf04ba3['destroy']()[_0xe0ce('0x26')](function(){_0x51fe9f[_0xe0ce('0x1b')](0xcc)[_0xe0ce('0x1c')]();});}};}function handleEntityNotFound(_0x19ad73,_0x3a8c3e){return function(_0x1a4bc0){if(!_0x1a4bc0){_0x19ad73[_0xe0ce('0x1a')](0x194);}return _0x1a4bc0;};}function handleError(_0x2b2dfc,_0x417fe3){_0x417fe3=_0x417fe3||0x1f4;return function(_0x188c56){logger[_0xe0ce('0x27')](_0x188c56[_0xe0ce('0x28')]);if(_0x188c56['name']){delete _0x188c56[_0xe0ce('0x29')];}_0x2b2dfc[_0xe0ce('0x1b')](_0x417fe3)[_0xe0ce('0x2a')](_0x188c56);};}exports[_0xe0ce('0x2b')]=function(_0x4cb733,_0x45e293){var _0x2ae22d={'raw':!![],'where':{'id':_0x4cb733[_0xe0ce('0x2c')]['id']}},_0x5ea327={};_0x5ea327[_0xe0ce('0x2d')]=_[_0xe0ce('0x2e')](db[_0xe0ce('0x2f')][_0xe0ce('0x30')]);_0x5ea327[_0xe0ce('0x31')]=_[_0xe0ce('0x2e')](_0x4cb733['query']);_0x5ea327[_0xe0ce('0x32')]=_[_0xe0ce('0x33')](_0x5ea327[_0xe0ce('0x2d')],_0x5ea327[_0xe0ce('0x31')]);_0x2ae22d[_0xe0ce('0x34')]=_[_0xe0ce('0x33')](_0x5ea327[_0xe0ce('0x2d')],qs['fields'](_0x4cb733['query'][_0xe0ce('0x35')]));_0x2ae22d['attributes']=_0x2ae22d[_0xe0ce('0x34')][_0xe0ce('0x36')]?_0x2ae22d[_0xe0ce('0x34')]:_0x5ea327[_0xe0ce('0x2d')];if(_0x4cb733[_0xe0ce('0x31')]['includeAll']){_0x2ae22d[_0xe0ce('0x37')]=[{'all':!![]}];}_0x2ae22d=_[_0xe0ce('0x38')]({},_0x2ae22d,_0x4cb733['options']);return db['ChatApplication']['find'](_0x2ae22d)[_0xe0ce('0x26')](handleEntityNotFound(_0x45e293,null))[_0xe0ce('0x26')](respondWithResult(_0x45e293,null))['catch'](handleError(_0x45e293,null));};exports[_0xe0ce('0x25')]=function(_0x269079,_0x1bf5f0){if(_0x269079[_0xe0ce('0x39')]['id']){delete _0x269079['body']['id'];}return db[_0xe0ce('0x2f')][_0xe0ce('0x3a')]({'where':{'id':_0x269079[_0xe0ce('0x2c')]['id']}})[_0xe0ce('0x26')](handleEntityNotFound(_0x1bf5f0,null))[_0xe0ce('0x26')](saveUpdates(_0x269079['body'],null))['then'](respondWithResult(_0x1bf5f0,null))[_0xe0ce('0x3b')](handleError(_0x1bf5f0,null));};exports[_0xe0ce('0x3c')]=function(_0x470a3f,_0x26df1b){return db['ChatApplication'][_0xe0ce('0x3a')]({'where':{'id':_0x470a3f[_0xe0ce('0x2c')]['id']}})['then'](handleEntityNotFound(_0x26df1b,null))[_0xe0ce('0x26')](removeEntity(_0x26df1b,null))[_0xe0ce('0x3b')](handleError(_0x26df1b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index faf421a..d95644a 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 _0x25ac=['rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','moment','bluebird','request-promise'];(function(_0x21ab42,_0x8ab09a){var _0x4f6351=function(_0x50a316){while(--_0x50a316){_0x21ab42['push'](_0x21ab42['shift']());}};_0x4f6351(++_0x8ab09a);}(_0x25ac,0x1d3));var _0xc25a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc25a('0x0'));var BPromise=require(_0xc25a('0x1'));var rp=require(_0xc25a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc25a('0x3'));var config=require(_0xc25a('0x4'));var attributes=require(_0xc25a('0x5'));module[_0xc25a('0x6')]=function(_0x220308,_0x309367){return _0x220308['define'](_0xc25a('0x7'),attributes,{'tableName':_0xc25a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc25a('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7cca=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2a04bc,_0x19e6d7){var _0x2c8821=function(_0x378607){while(--_0x378607){_0x2a04bc['push'](_0x2a04bc['shift']());}};_0x2c8821(++_0x19e6d7);}(_0x7cca,0xff));var _0xa7cc=function(_0x312f92,_0x82db49){_0x312f92=_0x312f92-0x0;var _0x301bf2=_0x7cca[_0x312f92];return _0x301bf2;};'use strict';var _=require(_0xa7cc('0x0'));var util=require(_0xa7cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa7cc('0x2'));var BPromise=require(_0xa7cc('0x3'));var rp=require(_0xa7cc('0x4'));var fs=require('fs');var path=require(_0xa7cc('0x5'));var rimraf=require(_0xa7cc('0x6'));var config=require(_0xa7cc('0x7'));var attributes=require(_0xa7cc('0x8'));module[_0xa7cc('0x9')]=function(_0x16d9a6,_0xb0f7a7){return _0x16d9a6[_0xa7cc('0xa')](_0xa7cc('0xb'),attributes,{'tableName':_0xa7cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7cc('0xd'),'collate':_0xa7cc('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 53ea14d..cb69826 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 _0x88b0=['result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x133f05,_0x279edf){var _0x51b8a3=function(_0x332138){while(--_0x332138){_0x133f05['push'](_0x133f05['shift']());}};_0x51b8a3(++_0x279edf);}(_0x88b0,0x18d));var _0x088b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x88b0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x088b('0x0'));var moment=require(_0x088b('0x1'));var BPromise=require(_0x088b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x088b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x088b('0x4'));var logger=require(_0x088b('0x5'))(_0x088b('0x6'));var config=require(_0x088b('0x7'));var jayson=require(_0x088b('0x8'));var client=jayson[_0x088b('0x9')][_0x088b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564b23,_0x4a3599,_0x3c2020){return new BPromise(function(_0x181e31,_0xd65e0f){return client[_0x088b('0xb')](_0x564b23,_0x3c2020)[_0x088b('0xc')](function(_0x2901df){logger[_0x088b('0xd')](_0x088b('0xe'),_0x4a3599,_0x088b('0xf'));logger[_0x088b('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4a3599,_0x088b('0xf'),JSON[_0x088b('0x11')](_0x2901df));if(_0x2901df['error']){if(_0x2901df[_0x088b('0x12')][_0x088b('0x13')]===0x1f4){logger[_0x088b('0x12')](_0x088b('0xe'),_0x4a3599,_0x2901df['error'][_0x088b('0x14')]);return _0xd65e0f(_0x2901df[_0x088b('0x12')][_0x088b('0x14')]);}logger['error'](_0x088b('0xe'),_0x4a3599,_0x2901df['error'][_0x088b('0x14')]);return _0x181e31(_0x2901df['error'][_0x088b('0x14')]);}else{logger[_0x088b('0xd')](_0x088b('0xe'),_0x4a3599,_0x088b('0xf'));_0x181e31(_0x2901df[_0x088b('0x15')]['message']);}})['catch'](function(_0x2d2c58){logger['error'](_0x088b('0xe'),_0x4a3599,_0x2d2c58);_0xd65e0f(_0x2d2c58);});});} \ No newline at end of file +var _0xf8bf=['request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x563d41,_0xab55e9){var _0x5bb15f=function(_0x290ba8){while(--_0x290ba8){_0x563d41['push'](_0x563d41['shift']());}};_0x5bb15f(++_0xab55e9);}(_0xf8bf,0x1aa));var _0xff8b=function(_0x4e3253,_0x49f2cf){_0x4e3253=_0x4e3253-0x0;var _0x3702a8=_0xf8bf[_0x4e3253];return _0x3702a8;};'use strict';var _=require('lodash');var util=require(_0xff8b('0x0'));var moment=require(_0xff8b('0x1'));var BPromise=require('bluebird');var rs=require(_0xff8b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff8b('0x3'))['db'];var utils=require(_0xff8b('0x4'));var logger=require(_0xff8b('0x5'))(_0xff8b('0x6'));var config=require('../../config/environment');var jayson=require(_0xff8b('0x7'));var client=jayson[_0xff8b('0x8')][_0xff8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be14a,_0x2ec4ce,_0x41261a){return new BPromise(function(_0x26e64d,_0x240c9f){return client[_0xff8b('0xa')](_0x1be14a,_0x41261a)[_0xff8b('0xb')](function(_0x26eedd){logger[_0xff8b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x2ec4ce,'request\x20sent');logger['debug'](_0xff8b('0xd'),_0x2ec4ce,_0xff8b('0xe'),JSON[_0xff8b('0xf')](_0x26eedd));if(_0x26eedd[_0xff8b('0x10')]){if(_0x26eedd[_0xff8b('0x10')][_0xff8b('0x11')]===0x1f4){logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x26eedd[_0xff8b('0x10')][_0xff8b('0x13')]);return _0x240c9f(_0x26eedd[_0xff8b('0x10')][_0xff8b('0x13')]);}logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x26eedd[_0xff8b('0x10')]['message']);return _0x26e64d(_0x26eedd[_0xff8b('0x10')]['message']);}else{logger['info'](_0xff8b('0x12'),_0x2ec4ce,'request\x20sent');_0x26e64d(_0x26eedd[_0xff8b('0x14')][_0xff8b('0x13')]);}})[_0xff8b('0x15')](function(_0x28ceba){logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x28ceba);_0x240c9f(_0x28ceba);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a248f2b..90b02f6 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 _0x9118=['/:id','isAuthenticated','show','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get'];(function(_0x7560e,_0x594062){var _0x4975a1=function(_0x4fdfb2){while(--_0x4fdfb2){_0x7560e['push'](_0x7560e['shift']());}};_0x4975a1(++_0x594062);}(_0x9118,0xa6));var _0x8911=function(_0x23fc59,_0x1968dc){_0x23fc59=_0x23fc59-0x0;var _0x2bed9f=_0x9118[_0x23fc59];return _0x2bed9f;};'use strict';var multer=require('multer');var util=require(_0x8911('0x0'));var path=require(_0x8911('0x1'));var timeout=require(_0x8911('0x2'));var express=require(_0x8911('0x3'));var router=express[_0x8911('0x4')]();var fs_extra=require(_0x8911('0x5'));var auth=require(_0x8911('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8911('0x7'));var controller=require(_0x8911('0x8'));router[_0x8911('0x9')](_0x8911('0xa'),auth[_0x8911('0xb')](),controller[_0x8911('0xc')]);router['put']('/:id',auth[_0x8911('0xb')](),controller['update']);router[_0x8911('0xd')](_0x8911('0xa'),auth[_0x8911('0xb')](),controller[_0x8911('0xe')]);module[_0x8911('0xf')]=router; \ No newline at end of file +var _0x455e=['./chatApplication.controller','get','/:id','isAuthenticated','put','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57356a,_0x58a92b){var _0x3e5d73=function(_0x149928){while(--_0x149928){_0x57356a['push'](_0x57356a['shift']());}};_0x3e5d73(++_0x58a92b);}(_0x455e,0x133));var _0xe455=function(_0x5c0624,_0x4f4e34){_0x5c0624=_0x5c0624-0x0;var _0x1e5533=_0x455e[_0x5c0624];return _0x1e5533;};'use strict';var multer=require(_0xe455('0x0'));var util=require(_0xe455('0x1'));var path=require(_0xe455('0x2'));var timeout=require(_0xe455('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe455('0x4'));var auth=require(_0xe455('0x5'));var interaction=require(_0xe455('0x6'));var config=require(_0xe455('0x7'));var controller=require(_0xe455('0x8'));router[_0xe455('0x9')](_0xe455('0xa'),auth[_0xe455('0xb')](),controller['show']);router[_0xe455('0xc')](_0xe455('0xa'),auth[_0xe455('0xb')](),controller['update']);router['delete']('/:id',auth[_0xe455('0xb')](),controller[_0xe455('0xd')]);module[_0xe455('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 59cec93..2920d9e 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 _0xc0f9=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5025f4,_0x266841){var _0x241fa4=function(_0x5891c9){while(--_0x5891c9){_0x5025f4['push'](_0x5025f4['shift']());}};_0x241fa4(++_0x266841);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xc0f9[_0x52e363];return _0x3fc2b5;};'use strict';var Sequelize=require(_0x9c0f('0x0'));module[_0x9c0f('0x1')]={'name':{'type':Sequelize[_0x9c0f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9c0f('0x2')]},'write':{'type':Sequelize[_0x9c0f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3c0c=['BOOLEAN','sequelize','STRING'];(function(_0x13f1c8,_0x49a872){var _0x1e716a=function(_0x1166ae){while(--_0x1166ae){_0x13f1c8['push'](_0x13f1c8['shift']());}};_0x1e716a(++_0x49a872);}(_0x3c0c,0x94));var _0xc3c0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3c0c[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xc3c0('0x0'));module['exports']={'name':{'type':Sequelize[_0xc3c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xc3c0('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b7c0294..c380430 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 _0x2e99=['ChatGroupId','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','request-promise','moment','bluebird','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','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','body','update','describe','getUnread','ChatInternalMessage','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage'];(function(_0x2a9814,_0x49bac2){var _0x576cf0=function(_0x552ad5){while(--_0x552ad5){_0x2a9814['push'](_0x2a9814['shift']());}};_0x576cf0(++_0x49bac2);}(_0x2e99,0xbc));var _0x92e9=function(_0x21b2ef,_0x474c87){_0x21b2ef=_0x21b2ef-0x0;var _0x45fa39=_0x2e99[_0x21b2ef];return _0x45fa39;};'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(_0x92e9('0x0'));var moment=require(_0x92e9('0x1'));var BPromise=require(_0x92e9('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x92e9('0x3'));var ejs=require(_0x92e9('0x4'));var fs=require('fs');var fs_extra=require(_0x92e9('0x5'));var _=require(_0x92e9('0x6'));var squel=require(_0x92e9('0x7'));var crypto=require('crypto');var jsforce=require(_0x92e9('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x92e9('0x9'));var Papa=require(_0x92e9('0xa'));var Redis=require(_0x92e9('0xb'));var authService=require(_0x92e9('0xc'));var qs=require(_0x92e9('0xd'));var as=require(_0x92e9('0xe'));var hardwareService=require(_0x92e9('0xf'));var logger=require(_0x92e9('0x10'))(_0x92e9('0x11'));var utils=require(_0x92e9('0x12'));var config=require(_0x92e9('0x13'));var licenseUtil=require(_0x92e9('0x14'));var db=require(_0x92e9('0x15'))['db'];config[_0x92e9('0x16')]=_['defaults'](config[_0x92e9('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x92e9('0x17'))(new Redis(config[_0x92e9('0x16')]));require('./chatGroup.socket')[_0x92e9('0x18')](socket);function respondWithStatusCode(_0x29aa57,_0x12f06e){_0x12f06e=_0x12f06e||0xcc;return function(_0x103805){if(_0x103805){return _0x29aa57[_0x92e9('0x19')](_0x12f06e);}return _0x29aa57[_0x92e9('0x1a')](_0x12f06e)[_0x92e9('0x1b')]();};}function respondWithResult(_0x35733f,_0x1616a8){_0x1616a8=_0x1616a8||0xc8;return function(_0x38ec04){if(_0x38ec04){return _0x35733f[_0x92e9('0x1a')](_0x1616a8)[_0x92e9('0x1c')](_0x38ec04);}};}function respondWithFilteredResult(_0x2f1b18,_0x43970f){return function(_0xc151be){if(_0xc151be){var _0x446d26=typeof _0x43970f[_0x92e9('0x1d')]===_0x92e9('0x1e')&&typeof _0x43970f[_0x92e9('0x1f')]===_0x92e9('0x1e');var _0x5ac34c=_0xc151be[_0x92e9('0x20')];var _0x1791da=_0x446d26?0x0:_0x43970f['offset'];var _0x546a01=_0x446d26?_0xc151be['count']:_0x43970f[_0x92e9('0x1d')]+_0x43970f[_0x92e9('0x1f')];var _0x5d88e2;if(_0x546a01>=_0x5ac34c){_0x546a01=_0x5ac34c;_0x5d88e2=0xc8;}else{_0x5d88e2=0xce;}_0x2f1b18['status'](_0x5d88e2);return _0x2f1b18[_0x92e9('0x21')](_0x92e9('0x22'),_0x1791da+'-'+_0x546a01+'/'+_0x5ac34c)[_0x92e9('0x1c')](_0xc151be);}return null;};}function patchUpdates(_0x4c1df3){return function(_0xb5f599){try{jsonpatch[_0x92e9('0x23')](_0xb5f599,_0x4c1df3,!![]);}catch(_0x205e81){return BPromise[_0x92e9('0x24')](_0x205e81);}return _0xb5f599[_0x92e9('0x25')]();};}function saveUpdates(_0x46edbb,_0x1160cc){return function(_0x456126){if(_0x456126){return _0x456126['update'](_0x46edbb)[_0x92e9('0x26')](function(_0x147e7f){return _0x147e7f;});}return null;};}function removeEntity(_0x3e079d,_0x4f7936){return function(_0x3d889c){if(_0x3d889c){return _0x3d889c[_0x92e9('0x27')]()['then'](function(){_0x3e079d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bef0b,_0x3acb7b){return function(_0x411d5b){if(!_0x411d5b){_0x3bef0b[_0x92e9('0x19')](0x194);}return _0x411d5b;};}function handleError(_0x464bb6,_0x30485b){_0x30485b=_0x30485b||0x1f4;return function(_0x452904){logger['error'](_0x452904[_0x92e9('0x28')]);if(_0x452904['name']){delete _0x452904[_0x92e9('0x29')];}_0x464bb6[_0x92e9('0x1a')](_0x30485b)['send'](_0x452904);};}exports[_0x92e9('0x2a')]=function(_0x2ab4e5,_0x21966e){var _0x2b72c0={},_0x4efd61={},_0xa06475={'count':0x0,'rows':[]};var _0x5d8731=_[_0x92e9('0x2b')](db[_0x92e9('0x2c')][_0x92e9('0x2d')],function(_0x27a6f4){return{'name':_0x27a6f4[_0x92e9('0x2e')],'type':_0x27a6f4[_0x92e9('0x2f')][_0x92e9('0x30')]};});_0x4efd61['model']=_[_0x92e9('0x2b')](_0x5d8731,'name');_0x4efd61[_0x92e9('0x31')]=_[_0x92e9('0x32')](_0x2ab4e5[_0x92e9('0x31')]);_0x4efd61['filters']=_[_0x92e9('0x33')](_0x4efd61['model'],_0x4efd61[_0x92e9('0x31')]);_0x2b72c0[_0x92e9('0x34')]=_[_0x92e9('0x33')](_0x4efd61['model'],qs[_0x92e9('0x35')](_0x2ab4e5[_0x92e9('0x31')][_0x92e9('0x35')]));_0x2b72c0[_0x92e9('0x34')]=_0x2b72c0['attributes'][_0x92e9('0x36')]?_0x2b72c0[_0x92e9('0x34')]:_0x4efd61[_0x92e9('0x37')];if(!_0x2ab4e5['query'][_0x92e9('0x38')](_0x92e9('0x39'))){_0x2b72c0[_0x92e9('0x1f')]=qs[_0x92e9('0x1f')](_0x2ab4e5[_0x92e9('0x31')]['limit']);_0x2b72c0['offset']=qs['offset'](_0x2ab4e5['query'][_0x92e9('0x1d')]);}_0x2b72c0[_0x92e9('0x3a')]=qs[_0x92e9('0x3b')](_0x2ab4e5[_0x92e9('0x31')][_0x92e9('0x3b')]);_0x2b72c0[_0x92e9('0x3c')]=qs[_0x92e9('0x3d')](_[_0x92e9('0x3e')](_0x2ab4e5['query'],_0x4efd61[_0x92e9('0x3d')]),_0x5d8731);if(_0x2ab4e5[_0x92e9('0x31')][_0x92e9('0x3f')]){_0x2b72c0['where']=_[_0x92e9('0x40')](_0x2b72c0[_0x92e9('0x3c')],{'$or':_[_0x92e9('0x2b')](_0x5d8731,function(_0x458ca7){if(_0x458ca7[_0x92e9('0x2f')]!==_0x92e9('0x41')){var _0x4c895a={};_0x4c895a[_0x458ca7[_0x92e9('0x29')]]={'$like':'%'+_0x2ab4e5[_0x92e9('0x31')][_0x92e9('0x3f')]+'%'};return _0x4c895a;}})});}_0x2b72c0=_[_0x92e9('0x40')]({},_0x2b72c0,_0x2ab4e5[_0x92e9('0x42')]);var _0x16020d={'where':_0x2b72c0[_0x92e9('0x3c')]};return db[_0x92e9('0x2c')][_0x92e9('0x20')](_0x16020d)[_0x92e9('0x26')](function(_0x3384b8){_0xa06475[_0x92e9('0x20')]=_0x3384b8;if(_0x2ab4e5[_0x92e9('0x31')]['includeAll']){_0x2b72c0[_0x92e9('0x43')]=[{'all':!![]}];}return db['ChatGroup'][_0x92e9('0x44')](_0x2b72c0);})[_0x92e9('0x26')](function(_0x397348){_0xa06475['rows']=_0x397348;return _0xa06475;})[_0x92e9('0x26')](respondWithFilteredResult(_0x21966e,_0x2b72c0))['catch'](handleError(_0x21966e,null));};exports[_0x92e9('0x45')]=function(_0x509c40,_0x175287){var _0x1993ca={'raw':!![],'where':{'id':_0x509c40[_0x92e9('0x46')]['id']}},_0x5bebe1={};_0x5bebe1[_0x92e9('0x37')]=_['keys'](db[_0x92e9('0x2c')][_0x92e9('0x2d')]);_0x5bebe1[_0x92e9('0x31')]=_[_0x92e9('0x32')](_0x509c40['query']);_0x5bebe1[_0x92e9('0x3d')]=_[_0x92e9('0x33')](_0x5bebe1[_0x92e9('0x37')],_0x5bebe1[_0x92e9('0x31')]);_0x1993ca['attributes']=_[_0x92e9('0x33')](_0x5bebe1[_0x92e9('0x37')],qs['fields'](_0x509c40[_0x92e9('0x31')][_0x92e9('0x35')]));_0x1993ca[_0x92e9('0x34')]=_0x1993ca[_0x92e9('0x34')][_0x92e9('0x36')]?_0x1993ca['attributes']:_0x5bebe1[_0x92e9('0x37')];if(_0x509c40['query'][_0x92e9('0x47')]){_0x1993ca[_0x92e9('0x43')]=[{'all':!![]}];}_0x1993ca=_[_0x92e9('0x40')]({},_0x1993ca,_0x509c40[_0x92e9('0x42')]);return db['ChatGroup'][_0x92e9('0x48')](_0x1993ca)[_0x92e9('0x26')](handleEntityNotFound(_0x175287,null))['then'](respondWithResult(_0x175287,null))[_0x92e9('0x49')](handleError(_0x175287,null));};exports['create']=function(_0xb41989,_0x6a850e){return db[_0x92e9('0x2c')][_0x92e9('0x4a')](_0xb41989[_0x92e9('0x4b')],{})['then'](respondWithResult(_0x6a850e,0xc9))[_0x92e9('0x49')](handleError(_0x6a850e,null));};exports[_0x92e9('0x4c')]=function(_0x468ae3,_0x523679){if(_0x468ae3['body']['id']){delete _0x468ae3[_0x92e9('0x4b')]['id'];}return db['ChatGroup'][_0x92e9('0x48')]({'where':{'id':_0x468ae3['params']['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0x523679,null))[_0x92e9('0x26')](saveUpdates(_0x468ae3[_0x92e9('0x4b')],null))[_0x92e9('0x26')](respondWithResult(_0x523679,null))[_0x92e9('0x49')](handleError(_0x523679,null));};exports[_0x92e9('0x27')]=function(_0x6d71d6,_0x458a3f){return db[_0x92e9('0x2c')]['find']({'where':{'id':_0x6d71d6['params']['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0x458a3f,null))[_0x92e9('0x26')](removeEntity(_0x458a3f,null))[_0x92e9('0x49')](handleError(_0x458a3f,null));};exports[_0x92e9('0x4d')]=function(_0x5606a4,_0x10286f){return db[_0x92e9('0x2c')][_0x92e9('0x4d')]()[_0x92e9('0x26')](respondWithResult(_0x10286f,null))[_0x92e9('0x49')](handleError(_0x10286f,null));};exports[_0x92e9('0x4e')]=function(_0x800359,_0x48ece5,_0x322199){return db[_0x92e9('0x4f')][_0x92e9('0x20')]({'where':{'ChatGroupId':_0x800359[_0x92e9('0x46')]['id'],'ToId':_0x800359['user']['id'],'read':![]}})[_0x92e9('0x26')](function(_0xee99f9){return{'id':_['toInteger'](_0x800359[_0x92e9('0x46')]['id']),'count':_0xee99f9};})[_0x92e9('0x26')](respondWithResult(_0x48ece5,null))[_0x92e9('0x49')](handleError(_0x48ece5,null));};exports[_0x92e9('0x50')]=function(_0x215471,_0x1e5cbb,_0x3e7740){return db['ChatGroup'][_0x92e9('0x48')]({'where':{'id':_0x215471[_0x92e9('0x46')]['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0x1e5cbb,null))[_0x92e9('0x26')](function(_0x30d985){if(_0x30d985){return _0x30d985[_0x92e9('0x50')](_0x215471[_0x92e9('0x4b')][_0x92e9('0x51')],_[_0x92e9('0x52')](_0x215471[_0x92e9('0x4b')],[_0x92e9('0x51'),'id'])||{});}})[_0x92e9('0x26')](respondWithResult(_0x1e5cbb,null))[_0x92e9('0x49')](handleError(_0x1e5cbb,null));};exports[_0x92e9('0x53')]=function(_0x2d5c1f,_0x2d6b24,_0x528931){var _0x55aea1={};var _0x1328c8={};var _0x577fe7;var _0x50371d;return db[_0x92e9('0x2c')][_0x92e9('0x54')]({'where':{'id':_0x2d5c1f[_0x92e9('0x46')]['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0x2d6b24,null))[_0x92e9('0x26')](function(_0xb5328d){if(_0xb5328d){_0x577fe7=_0xb5328d;_0x1328c8[_0x92e9('0x37')]=_['keys'](db[_0x92e9('0x55')][_0x92e9('0x2d')]);_0x1328c8['query']=_[_0x92e9('0x32')](_0x2d5c1f[_0x92e9('0x31')]);_0x1328c8[_0x92e9('0x3d')]=_[_0x92e9('0x33')](_0x1328c8['model'],_0x1328c8[_0x92e9('0x31')]);_0x55aea1[_0x92e9('0x34')]=_[_0x92e9('0x33')](_0x1328c8[_0x92e9('0x37')],qs[_0x92e9('0x35')](_0x2d5c1f['query'][_0x92e9('0x35')]));_0x55aea1[_0x92e9('0x34')]=_0x55aea1[_0x92e9('0x34')]['length']?_0x55aea1[_0x92e9('0x34')]:_0x1328c8['model'];_0x55aea1[_0x92e9('0x3a')]=qs[_0x92e9('0x3b')](_0x2d5c1f[_0x92e9('0x31')][_0x92e9('0x3b')]);_0x55aea1[_0x92e9('0x3c')]=qs[_0x92e9('0x3d')](_[_0x92e9('0x3e')](_0x2d5c1f[_0x92e9('0x31')],_0x1328c8[_0x92e9('0x3d')]));if(_0x2d5c1f['query']['filter']){_0x55aea1[_0x92e9('0x3c')]=_[_0x92e9('0x40')](_0x55aea1[_0x92e9('0x3c')],{'$or':_[_0x92e9('0x2b')](_0x55aea1[_0x92e9('0x34')],function(_0x9e2b94){var _0x24a6bc={};_0x24a6bc[_0x9e2b94]={'$like':'%'+_0x2d5c1f['query'][_0x92e9('0x3f')]+'%'};return _0x24a6bc;})});}_0x55aea1=_[_0x92e9('0x40')]({},_0x55aea1,_0x2d5c1f[_0x92e9('0x42')]);return _0x577fe7[_0x92e9('0x53')](_0x55aea1);}})[_0x92e9('0x26')](function(_0x15d63e){if(_0x15d63e){_0x50371d=_0x15d63e[_0x92e9('0x36')];if(!_0x2d5c1f[_0x92e9('0x31')][_0x92e9('0x38')](_0x92e9('0x39'))){_0x55aea1[_0x92e9('0x1f')]=qs[_0x92e9('0x1f')](_0x2d5c1f[_0x92e9('0x31')][_0x92e9('0x1f')]);_0x55aea1[_0x92e9('0x1d')]=qs[_0x92e9('0x1d')](_0x2d5c1f[_0x92e9('0x31')][_0x92e9('0x1d')]);}return _0x577fe7[_0x92e9('0x53')](_0x55aea1);}})[_0x92e9('0x26')](function(_0x50c4b0){if(_0x50c4b0){return _0x50c4b0?{'count':_0x50371d,'rows':_0x50c4b0}:null;}})[_0x92e9('0x26')](respondWithResult(_0x2d6b24,null))[_0x92e9('0x49')](handleError(_0x2d6b24,null));};exports[_0x92e9('0x56')]=function(_0x29f300,_0xac87b3,_0x2de54b){return db[_0x92e9('0x2c')][_0x92e9('0x48')]({'where':{'id':_0x29f300[_0x92e9('0x46')]['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0xac87b3,null))['then'](function(_0x5aaf00){if(_0x5aaf00){return _0x5aaf00[_0x92e9('0x56')](_0x29f300[_0x92e9('0x31')]['ids']);}})[_0x92e9('0x26')](respondWithStatusCode(_0xac87b3,null))[_0x92e9('0x49')](handleError(_0xac87b3,null));};exports[_0x92e9('0x57')]=function(_0xf13527,_0x13302e,_0xb7e5f9){if(_0xf13527[_0x92e9('0x4b')]['id']){delete _0xf13527['body']['id'];}return db['ChatGroup'][_0x92e9('0x48')]({'where':{'id':_0xf13527[_0x92e9('0x46')]['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0x13302e,null))['then'](function(_0x425db6){if(_0x425db6){_0xf13527['body'][_0x92e9('0x58')]=_0x425db6['id'];return db[_0x92e9('0x4f')][_0x92e9('0x4a')](_0xf13527[_0x92e9('0x4b')]);}})[_0x92e9('0x26')](respondWithResult(_0x13302e,null))[_0x92e9('0x49')](handleError(_0x13302e,null));};exports[_0x92e9('0x59')]=function(_0x539a50,_0x3e4991,_0xdc88c6){var _0x24183b={};var _0x20fabe={};var _0x5d640b;var _0xc9c508;return db[_0x92e9('0x2c')][_0x92e9('0x54')]({'where':{'id':_0x539a50['params']['id']}})[_0x92e9('0x26')](handleEntityNotFound(_0x3e4991,null))['then'](function(_0x25f06b){if(_0x25f06b){_0x5d640b=_0x25f06b;_0x20fabe[_0x92e9('0x37')]=_[_0x92e9('0x32')](db[_0x92e9('0x4f')][_0x92e9('0x2d')]);_0x20fabe[_0x92e9('0x31')]=_[_0x92e9('0x32')](_0x539a50['query']);_0x20fabe['filters']=_[_0x92e9('0x33')](_0x20fabe[_0x92e9('0x37')],_0x20fabe[_0x92e9('0x31')]);_0x24183b[_0x92e9('0x34')]=_[_0x92e9('0x33')](_0x20fabe[_0x92e9('0x37')],qs[_0x92e9('0x35')](_0x539a50[_0x92e9('0x31')][_0x92e9('0x35')]));_0x24183b['attributes']=_0x24183b['attributes'][_0x92e9('0x36')]?_0x24183b[_0x92e9('0x34')]:_0x20fabe[_0x92e9('0x37')];_0x24183b[_0x92e9('0x3a')]=qs[_0x92e9('0x3b')](_0x539a50[_0x92e9('0x31')][_0x92e9('0x3b')]);_0x24183b[_0x92e9('0x3c')]=qs[_0x92e9('0x3d')](_[_0x92e9('0x3e')](_0x539a50[_0x92e9('0x31')],_0x20fabe[_0x92e9('0x3d')]));if(_0x539a50['query'][_0x92e9('0x3f')]){_0x24183b[_0x92e9('0x3c')]=_[_0x92e9('0x40')](_0x24183b[_0x92e9('0x3c')],{'$or':_[_0x92e9('0x2b')](_0x24183b[_0x92e9('0x34')],function(_0x183c46){var _0x2bcc0e={};_0x2bcc0e[_0x183c46]={'$like':'%'+_0x539a50[_0x92e9('0x31')][_0x92e9('0x3f')]+'%'};return _0x2bcc0e;})});}if(_0x539a50[_0x92e9('0x31')]['$gte']){var _0x46bfff=_0x539a50[_0x92e9('0x31')]['$gte'][_0x92e9('0x5a')](',');var _0xeb2c4e={};_0xeb2c4e[_0x46bfff[0x0]]={'$gte':moment(_0x46bfff[0x1])['format'](_0x92e9('0x5b'))};_0x24183b[_0x92e9('0x3c')]=_[_0x92e9('0x40')](_0x24183b[_0x92e9('0x3c')],_0xeb2c4e);}_0x24183b=_['merge']({},_0x24183b,_0x539a50[_0x92e9('0x42')]);return _0x5d640b[_0x92e9('0x59')](_0x24183b);}})[_0x92e9('0x26')](function(_0x4f3440){if(_0x4f3440){_0xc9c508=_0x4f3440[_0x92e9('0x36')];if(!_0x539a50[_0x92e9('0x31')][_0x92e9('0x38')](_0x92e9('0x39'))){_0x24183b[_0x92e9('0x1f')]=qs[_0x92e9('0x1f')](_0x539a50[_0x92e9('0x31')]['limit']);_0x24183b[_0x92e9('0x1d')]=qs[_0x92e9('0x1d')](_0x539a50[_0x92e9('0x31')][_0x92e9('0x1d')]);}return _0x5d640b['getMessages'](_0x24183b);}})[_0x92e9('0x26')](function(_0x886465){if(_0x886465){return _0x886465?{'count':_0xc9c508,'rows':_0x886465}:null;}})[_0x92e9('0x26')](respondWithResult(_0x3e4991,null))[_0x92e9('0x49')](handleError(_0x3e4991,null));}; \ No newline at end of file +var _0xb798=['findOne','keys','User','removeMembers','addMessage','getMessages','$gte','format','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb798,0xcc));var _0x8b79=function(_0x23648d,_0x593c56){_0x23648d=_0x23648d-0x0;var _0x1f7500=_0xb798[_0x23648d];return _0x1f7500;};'use strict';var emlformat=require(_0x8b79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b79('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b79('0x2'));var moment=require('moment');var BPromise=require(_0x8b79('0x3'));var Mustache=require(_0x8b79('0x4'));var util=require(_0x8b79('0x5'));var path=require(_0x8b79('0x6'));var sox=require(_0x8b79('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b79('0x8'));var _=require(_0x8b79('0x9'));var squel=require(_0x8b79('0xa'));var crypto=require(_0x8b79('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b79('0xc'));var toCsv=require(_0x8b79('0xd'));var querystring=require(_0x8b79('0xe'));var Papa=require(_0x8b79('0xf'));var Redis=require(_0x8b79('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b79('0x11'));var hardwareService=require(_0x8b79('0x12'));var logger=require(_0x8b79('0x13'))(_0x8b79('0x14'));var utils=require(_0x8b79('0x15'));var config=require(_0x8b79('0x16'));var licenseUtil=require(_0x8b79('0x17'));var db=require(_0x8b79('0x18'))['db'];config[_0x8b79('0x19')]=_['defaults'](config[_0x8b79('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b79('0x1a'))(new Redis(config['redis']));require(_0x8b79('0x1b'))[_0x8b79('0x1c')](socket);function respondWithStatusCode(_0x4218b1,_0x377369){_0x377369=_0x377369||0xcc;return function(_0x20bcef){if(_0x20bcef){return _0x4218b1[_0x8b79('0x1d')](_0x377369);}return _0x4218b1[_0x8b79('0x1e')](_0x377369)['end']();};}function respondWithResult(_0x49fe46,_0x194559){_0x194559=_0x194559||0xc8;return function(_0xefc887){if(_0xefc887){return _0x49fe46[_0x8b79('0x1e')](_0x194559)[_0x8b79('0x1f')](_0xefc887);}};}function respondWithFilteredResult(_0x55331f,_0x346acf){return function(_0x450dab){if(_0x450dab){var _0x49e097=typeof _0x346acf[_0x8b79('0x20')]===_0x8b79('0x21')&&typeof _0x346acf['limit']===_0x8b79('0x21');var _0x19387f=_0x450dab[_0x8b79('0x22')];var _0x3bcd78=_0x49e097?0x0:_0x346acf['offset'];var _0x1ae3ab=_0x49e097?_0x450dab[_0x8b79('0x22')]:_0x346acf['offset']+_0x346acf[_0x8b79('0x23')];var _0x5b6b03;if(_0x1ae3ab>=_0x19387f){_0x1ae3ab=_0x19387f;_0x5b6b03=0xc8;}else{_0x5b6b03=0xce;}_0x55331f[_0x8b79('0x1e')](_0x5b6b03);return _0x55331f[_0x8b79('0x24')](_0x8b79('0x25'),_0x3bcd78+'-'+_0x1ae3ab+'/'+_0x19387f)[_0x8b79('0x1f')](_0x450dab);}return null;};}function patchUpdates(_0xe983eb){return function(_0x30a39f){try{jsonpatch[_0x8b79('0x26')](_0x30a39f,_0xe983eb,!![]);}catch(_0x5c8ada){return BPromise[_0x8b79('0x27')](_0x5c8ada);}return _0x30a39f['save']();};}function saveUpdates(_0x5e9a68,_0x178715){return function(_0x59eb9b){if(_0x59eb9b){return _0x59eb9b[_0x8b79('0x28')](_0x5e9a68)['then'](function(_0x116bf5){return _0x116bf5;});}return null;};}function removeEntity(_0x172534,_0x30b3cc){return function(_0x13575d){if(_0x13575d){return _0x13575d[_0x8b79('0x29')]()['then'](function(){_0x172534[_0x8b79('0x1e')](0xcc)[_0x8b79('0x2a')]();});}};}function handleEntityNotFound(_0x57955b,_0x1000f6){return function(_0x32322c){if(!_0x32322c){_0x57955b['sendStatus'](0x194);}return _0x32322c;};}function handleError(_0x177b45,_0x49bd97){_0x49bd97=_0x49bd97||0x1f4;return function(_0x2688b4){logger[_0x8b79('0x2b')](_0x2688b4[_0x8b79('0x2c')]);if(_0x2688b4[_0x8b79('0x2d')]){delete _0x2688b4[_0x8b79('0x2d')];}_0x177b45['status'](_0x49bd97)[_0x8b79('0x2e')](_0x2688b4);};}exports[_0x8b79('0x2f')]=function(_0x414abd,_0x58eb6e){var _0x58ce15={},_0x459500={},_0x541665={'count':0x0,'rows':[]};var _0x5bec69=_[_0x8b79('0x30')](db[_0x8b79('0x31')][_0x8b79('0x32')],function(_0x110361){return{'name':_0x110361[_0x8b79('0x33')],'type':_0x110361['type'][_0x8b79('0x34')]};});_0x459500[_0x8b79('0x35')]=_[_0x8b79('0x30')](_0x5bec69,_0x8b79('0x2d'));_0x459500[_0x8b79('0x36')]=_['keys'](_0x414abd['query']);_0x459500['filters']=_[_0x8b79('0x37')](_0x459500[_0x8b79('0x35')],_0x459500[_0x8b79('0x36')]);_0x58ce15[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x459500['model'],qs[_0x8b79('0x39')](_0x414abd[_0x8b79('0x36')]['fields']));_0x58ce15[_0x8b79('0x38')]=_0x58ce15[_0x8b79('0x38')]['length']?_0x58ce15[_0x8b79('0x38')]:_0x459500['model'];if(!_0x414abd[_0x8b79('0x36')][_0x8b79('0x3a')](_0x8b79('0x3b'))){_0x58ce15[_0x8b79('0x23')]=qs[_0x8b79('0x23')](_0x414abd[_0x8b79('0x36')][_0x8b79('0x23')]);_0x58ce15[_0x8b79('0x20')]=qs['offset'](_0x414abd[_0x8b79('0x36')][_0x8b79('0x20')]);}_0x58ce15[_0x8b79('0x3c')]=qs[_0x8b79('0x3d')](_0x414abd[_0x8b79('0x36')][_0x8b79('0x3d')]);_0x58ce15[_0x8b79('0x3e')]=qs[_0x8b79('0x3f')](_[_0x8b79('0x40')](_0x414abd[_0x8b79('0x36')],_0x459500[_0x8b79('0x3f')]),_0x5bec69);if(_0x414abd[_0x8b79('0x36')][_0x8b79('0x41')]){_0x58ce15[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x58ce15[_0x8b79('0x3e')],{'$or':_['map'](_0x5bec69,function(_0x40bcd5){if(_0x40bcd5[_0x8b79('0x43')]!==_0x8b79('0x44')){var _0x1bd943={};_0x1bd943[_0x40bcd5[_0x8b79('0x2d')]]={'$like':'%'+_0x414abd[_0x8b79('0x36')][_0x8b79('0x41')]+'%'};return _0x1bd943;}})});}_0x58ce15=_[_0x8b79('0x42')]({},_0x58ce15,_0x414abd[_0x8b79('0x45')]);var _0x481c7c={'where':_0x58ce15['where']};return db[_0x8b79('0x31')][_0x8b79('0x22')](_0x481c7c)[_0x8b79('0x46')](function(_0x5419f3){_0x541665[_0x8b79('0x22')]=_0x5419f3;if(_0x414abd[_0x8b79('0x36')][_0x8b79('0x47')]){_0x58ce15[_0x8b79('0x48')]=[{'all':!![]}];}return db[_0x8b79('0x31')][_0x8b79('0x49')](_0x58ce15);})[_0x8b79('0x46')](function(_0x5deee3){_0x541665[_0x8b79('0x4a')]=_0x5deee3;return _0x541665;})[_0x8b79('0x46')](respondWithFilteredResult(_0x58eb6e,_0x58ce15))[_0x8b79('0x4b')](handleError(_0x58eb6e,null));};exports[_0x8b79('0x4c')]=function(_0x5d4bad,_0x161f8c){var _0x23c609={'raw':!![],'where':{'id':_0x5d4bad[_0x8b79('0x4d')]['id']}},_0x21ebd4={};_0x21ebd4[_0x8b79('0x35')]=_['keys'](db[_0x8b79('0x31')][_0x8b79('0x32')]);_0x21ebd4[_0x8b79('0x36')]=_['keys'](_0x5d4bad[_0x8b79('0x36')]);_0x21ebd4[_0x8b79('0x3f')]=_[_0x8b79('0x37')](_0x21ebd4['model'],_0x21ebd4[_0x8b79('0x36')]);_0x23c609[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x21ebd4[_0x8b79('0x35')],qs[_0x8b79('0x39')](_0x5d4bad[_0x8b79('0x36')][_0x8b79('0x39')]));_0x23c609['attributes']=_0x23c609[_0x8b79('0x38')][_0x8b79('0x4e')]?_0x23c609[_0x8b79('0x38')]:_0x21ebd4[_0x8b79('0x35')];if(_0x5d4bad[_0x8b79('0x36')]['includeAll']){_0x23c609[_0x8b79('0x48')]=[{'all':!![]}];}_0x23c609=_[_0x8b79('0x42')]({},_0x23c609,_0x5d4bad[_0x8b79('0x45')]);return db[_0x8b79('0x31')][_0x8b79('0x4f')](_0x23c609)['then'](handleEntityNotFound(_0x161f8c,null))[_0x8b79('0x46')](respondWithResult(_0x161f8c,null))[_0x8b79('0x4b')](handleError(_0x161f8c,null));};exports[_0x8b79('0x50')]=function(_0x55472f,_0x3ce74e){return db[_0x8b79('0x31')][_0x8b79('0x50')](_0x55472f[_0x8b79('0x51')],{})['then'](respondWithResult(_0x3ce74e,0xc9))['catch'](handleError(_0x3ce74e,null));};exports[_0x8b79('0x28')]=function(_0x1b2ec0,_0x21def){if(_0x1b2ec0[_0x8b79('0x51')]['id']){delete _0x1b2ec0['body']['id'];}return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x1b2ec0[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x21def,null))['then'](saveUpdates(_0x1b2ec0[_0x8b79('0x51')],null))[_0x8b79('0x46')](respondWithResult(_0x21def,null))[_0x8b79('0x4b')](handleError(_0x21def,null));};exports['destroy']=function(_0x2cdc05,_0x3ce29e){return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x2cdc05[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x3ce29e,null))['then'](removeEntity(_0x3ce29e,null))[_0x8b79('0x4b')](handleError(_0x3ce29e,null));};exports['describe']=function(_0x46bfef,_0x278939){return db[_0x8b79('0x31')][_0x8b79('0x52')]()['then'](respondWithResult(_0x278939,null))[_0x8b79('0x4b')](handleError(_0x278939,null));};exports[_0x8b79('0x53')]=function(_0x21df45,_0x3e35e6,_0x1dc777){return db[_0x8b79('0x54')][_0x8b79('0x22')]({'where':{'ChatGroupId':_0x21df45['params']['id'],'ToId':_0x21df45[_0x8b79('0x55')]['id'],'read':![]}})['then'](function(_0x6031ec){return{'id':_[_0x8b79('0x56')](_0x21df45[_0x8b79('0x4d')]['id']),'count':_0x6031ec};})[_0x8b79('0x46')](respondWithResult(_0x3e35e6,null))[_0x8b79('0x4b')](handleError(_0x3e35e6,null));};exports['addMembers']=function(_0x21a9ef,_0x493b35,_0x13b774){return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x21a9ef[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x493b35,null))[_0x8b79('0x46')](function(_0x204710){if(_0x204710){return _0x204710['addMembers'](_0x21a9ef[_0x8b79('0x51')][_0x8b79('0x57')],_[_0x8b79('0x58')](_0x21a9ef['body'],['ids','id'])||{});}})[_0x8b79('0x46')](respondWithResult(_0x493b35,null))['catch'](handleError(_0x493b35,null));};exports[_0x8b79('0x59')]=function(_0x5d493e,_0x515319,_0x3d2c8a){var _0x4cc60b={};var _0x503d3f={};var _0xb07e5a;var _0x33a469;return db[_0x8b79('0x31')][_0x8b79('0x5a')]({'where':{'id':_0x5d493e[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x515319,null))[_0x8b79('0x46')](function(_0x390bda){if(_0x390bda){_0xb07e5a=_0x390bda;_0x503d3f['model']=_[_0x8b79('0x5b')](db[_0x8b79('0x5c')][_0x8b79('0x32')]);_0x503d3f[_0x8b79('0x36')]=_[_0x8b79('0x5b')](_0x5d493e['query']);_0x503d3f['filters']=_[_0x8b79('0x37')](_0x503d3f[_0x8b79('0x35')],_0x503d3f[_0x8b79('0x36')]);_0x4cc60b[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x503d3f['model'],qs['fields'](_0x5d493e[_0x8b79('0x36')][_0x8b79('0x39')]));_0x4cc60b[_0x8b79('0x38')]=_0x4cc60b[_0x8b79('0x38')][_0x8b79('0x4e')]?_0x4cc60b[_0x8b79('0x38')]:_0x503d3f[_0x8b79('0x35')];_0x4cc60b['order']=qs[_0x8b79('0x3d')](_0x5d493e[_0x8b79('0x36')]['sort']);_0x4cc60b[_0x8b79('0x3e')]=qs[_0x8b79('0x3f')](_[_0x8b79('0x40')](_0x5d493e['query'],_0x503d3f[_0x8b79('0x3f')]));if(_0x5d493e[_0x8b79('0x36')][_0x8b79('0x41')]){_0x4cc60b[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x4cc60b[_0x8b79('0x3e')],{'$or':_[_0x8b79('0x30')](_0x4cc60b[_0x8b79('0x38')],function(_0x12f65b){var _0x377ae1={};_0x377ae1[_0x12f65b]={'$like':'%'+_0x5d493e['query']['filter']+'%'};return _0x377ae1;})});}_0x4cc60b=_[_0x8b79('0x42')]({},_0x4cc60b,_0x5d493e[_0x8b79('0x45')]);return _0xb07e5a[_0x8b79('0x59')](_0x4cc60b);}})[_0x8b79('0x46')](function(_0x1c7a85){if(_0x1c7a85){_0x33a469=_0x1c7a85['length'];if(!_0x5d493e[_0x8b79('0x36')][_0x8b79('0x3a')](_0x8b79('0x3b'))){_0x4cc60b[_0x8b79('0x23')]=qs[_0x8b79('0x23')](_0x5d493e[_0x8b79('0x36')]['limit']);_0x4cc60b[_0x8b79('0x20')]=qs[_0x8b79('0x20')](_0x5d493e['query']['offset']);}return _0xb07e5a[_0x8b79('0x59')](_0x4cc60b);}})[_0x8b79('0x46')](function(_0x5775f1){if(_0x5775f1){return _0x5775f1?{'count':_0x33a469,'rows':_0x5775f1}:null;}})[_0x8b79('0x46')](respondWithResult(_0x515319,null))[_0x8b79('0x4b')](handleError(_0x515319,null));};exports[_0x8b79('0x5d')]=function(_0x4be273,_0xde1e74,_0x542c01){return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x4be273[_0x8b79('0x4d')]['id']}})['then'](handleEntityNotFound(_0xde1e74,null))[_0x8b79('0x46')](function(_0xbcb892){if(_0xbcb892){return _0xbcb892[_0x8b79('0x5d')](_0x4be273[_0x8b79('0x36')][_0x8b79('0x57')]);}})['then'](respondWithStatusCode(_0xde1e74,null))[_0x8b79('0x4b')](handleError(_0xde1e74,null));};exports[_0x8b79('0x5e')]=function(_0x3d730b,_0x2d51ce,_0x1742af){if(_0x3d730b[_0x8b79('0x51')]['id']){delete _0x3d730b['body']['id'];}return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x3d730b[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x2d51ce,null))[_0x8b79('0x46')](function(_0x4ee762){if(_0x4ee762){_0x3d730b[_0x8b79('0x51')]['ChatGroupId']=_0x4ee762['id'];return db[_0x8b79('0x54')][_0x8b79('0x50')](_0x3d730b[_0x8b79('0x51')]);}})[_0x8b79('0x46')](respondWithResult(_0x2d51ce,null))[_0x8b79('0x4b')](handleError(_0x2d51ce,null));};exports[_0x8b79('0x5f')]=function(_0x1035d1,_0x26e4e1,_0x46930c){var _0x56507c={};var _0x8ee065={};var _0x5b53b5;var _0x4158ce;return db['ChatGroup'][_0x8b79('0x5a')]({'where':{'id':_0x1035d1[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x26e4e1,null))[_0x8b79('0x46')](function(_0x261779){if(_0x261779){_0x5b53b5=_0x261779;_0x8ee065[_0x8b79('0x35')]=_[_0x8b79('0x5b')](db['ChatInternalMessage'][_0x8b79('0x32')]);_0x8ee065[_0x8b79('0x36')]=_['keys'](_0x1035d1['query']);_0x8ee065['filters']=_[_0x8b79('0x37')](_0x8ee065['model'],_0x8ee065[_0x8b79('0x36')]);_0x56507c[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x8ee065[_0x8b79('0x35')],qs[_0x8b79('0x39')](_0x1035d1[_0x8b79('0x36')][_0x8b79('0x39')]));_0x56507c['attributes']=_0x56507c[_0x8b79('0x38')][_0x8b79('0x4e')]?_0x56507c[_0x8b79('0x38')]:_0x8ee065[_0x8b79('0x35')];_0x56507c[_0x8b79('0x3c')]=qs['sort'](_0x1035d1['query'][_0x8b79('0x3d')]);_0x56507c['where']=qs[_0x8b79('0x3f')](_['pick'](_0x1035d1['query'],_0x8ee065['filters']));if(_0x1035d1[_0x8b79('0x36')]['filter']){_0x56507c[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x56507c[_0x8b79('0x3e')],{'$or':_['map'](_0x56507c[_0x8b79('0x38')],function(_0x4adbd7){var _0x5e4fc5={};_0x5e4fc5[_0x4adbd7]={'$like':'%'+_0x1035d1[_0x8b79('0x36')][_0x8b79('0x41')]+'%'};return _0x5e4fc5;})});}if(_0x1035d1[_0x8b79('0x36')][_0x8b79('0x60')]){var _0x520603=_0x1035d1[_0x8b79('0x36')][_0x8b79('0x60')]['split'](',');var _0x2e6764={};_0x2e6764[_0x520603[0x0]]={'$gte':moment(_0x520603[0x1])[_0x8b79('0x61')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56507c[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x56507c[_0x8b79('0x3e')],_0x2e6764);}_0x56507c=_[_0x8b79('0x42')]({},_0x56507c,_0x1035d1[_0x8b79('0x45')]);return _0x5b53b5[_0x8b79('0x5f')](_0x56507c);}})['then'](function(_0x257c9d){if(_0x257c9d){_0x4158ce=_0x257c9d[_0x8b79('0x4e')];if(!_0x1035d1[_0x8b79('0x36')][_0x8b79('0x3a')](_0x8b79('0x3b'))){_0x56507c[_0x8b79('0x23')]=qs[_0x8b79('0x23')](_0x1035d1[_0x8b79('0x36')][_0x8b79('0x23')]);_0x56507c[_0x8b79('0x20')]=qs['offset'](_0x1035d1[_0x8b79('0x36')][_0x8b79('0x20')]);}return _0x5b53b5['getMessages'](_0x56507c);}})[_0x8b79('0x46')](function(_0x3f3b09){if(_0x3f3b09){return _0x3f3b09?{'count':_0x4158ce,'rows':_0x3f3b09}:null;}})[_0x8b79('0x46')](respondWithResult(_0x26e4e1,null))[_0x8b79('0x4b')](handleError(_0x26e4e1,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1da0fda..b4d2699 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 _0xe225=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup','remove'];(function(_0x5934f9,_0x26f4fd){var _0x74647c=function(_0x2bfe66){while(--_0x2bfe66){_0x5934f9['push'](_0x5934f9['shift']());}};_0x74647c(++_0x26f4fd);}(_0xe225,0x1bd));var _0x5e22=function(_0x4cb9aa,_0x58b44f){_0x4cb9aa=_0x4cb9aa-0x0;var _0x2eff51=_0xe225[_0x4cb9aa];return _0x2eff51;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5e22('0x0'))['db'][_0x5e22('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5e22('0x2')};function emitEvent(_0x5ca6b5){return function(_0x45790b,_0x4e0d42,_0x50df23){ChatGroupEvents['emit'](_0x5ca6b5+':'+_0x45790b['id'],_0x45790b);ChatGroupEvents[_0x5e22('0x3')](_0x5ca6b5,_0x45790b);_0x50df23(null);};}for(var e in events){if(events[_0x5e22('0x4')](e)){var event=events[e];ChatGroup[_0x5e22('0x5')](e,emitEvent(event));}}module[_0x5e22('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xf23c=['emit','hasOwnProperty','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0xf23c,0x77));var _0xcf23=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xf23c[_0x529296];return _0x1796bf;};'use strict';var EventEmitter=require(_0xcf23('0x0'));var ChatGroup=require(_0xcf23('0x1'))['db'][_0xcf23('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xcf23('0x3')](0x0);var events={'afterCreate':_0xcf23('0x4'),'afterUpdate':_0xcf23('0x5'),'afterDestroy':_0xcf23('0x6')};function emitEvent(_0x1b327e){return function(_0xa91945,_0x33f3de,_0x224af1){ChatGroupEvents[_0xcf23('0x7')](_0x1b327e+':'+_0xa91945['id'],_0xa91945);ChatGroupEvents[_0xcf23('0x7')](_0x1b327e,_0xa91945);_0x224af1(null);};}for(var e in events){if(events[_0xcf23('0x8')](e)){var event=events[e];ChatGroup['hook'](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 d29cd20..2bafd2e 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 _0xf55f=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_groups','util'];(function(_0x2e5a8c,_0x35f4bf){var _0x5816ec=function(_0x27cf55){while(--_0x27cf55){_0x2e5a8c['push'](_0x2e5a8c['shift']());}};_0x5816ec(++_0x35f4bf);}(_0xf55f,0xa9));var _0xff55=function(_0x3ca29d,_0x5a8d31){_0x3ca29d=_0x3ca29d-0x0;var _0x5c5d2e=_0xf55f[_0x3ca29d];return _0x5c5d2e;};'use strict';var _=require('lodash');var util=require(_0xff55('0x0'));var logger=require('../../config/logger')(_0xff55('0x1'));var moment=require('moment');var BPromise=require(_0xff55('0x2'));var rp=require(_0xff55('0x3'));var fs=require('fs');var path=require(_0xff55('0x4'));var rimraf=require(_0xff55('0x5'));var config=require(_0xff55('0x6'));var attributes=require('./chatGroup.attributes');module[_0xff55('0x7')]=function(_0x144792,_0x5e85fc){return _0x144792[_0xff55('0x8')]('ChatGroup',attributes,{'tableName':_0xff55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad60=['request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','api','moment','bluebird'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0xad60,0x1a0));var _0x0ad6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xad60[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x0ad6('0x0'));var logger=require('../../config/logger')(_0x0ad6('0x1'));var moment=require(_0x0ad6('0x2'));var BPromise=require(_0x0ad6('0x3'));var rp=require(_0x0ad6('0x4'));var fs=require('fs');var path=require(_0x0ad6('0x5'));var rimraf=require(_0x0ad6('0x6'));var config=require('../../config/environment');var attributes=require(_0x0ad6('0x7'));module[_0x0ad6('0x8')]=function(_0x4b0e32,_0x214e01){return _0x4b0e32[_0x0ad6('0x9')](_0x0ad6('0xa'),attributes,{'tableName':_0x0ad6('0xb'),'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 4556a2d..b159606 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 _0x55e2=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0xe2876e,_0x5d30a2){var _0x75102b=function(_0x2c055d){while(--_0x2c055d){_0xe2876e['push'](_0xe2876e['shift']());}};_0x75102b(++_0x5d30a2);}(_0x55e2,0xd8));var _0x255e=function(_0x42af0a,_0x22da6b){_0x42af0a=_0x42af0a-0x0;var _0x351b71=_0x55e2[_0x42af0a];return _0x351b71;};'use strict';var _=require(_0x255e('0x0'));var util=require(_0x255e('0x1'));var moment=require(_0x255e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x255e('0x3'));var db=require(_0x255e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x255e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x255e('0x6'));var client=jayson[_0x255e('0x7')][_0x255e('0x8')]({'port':0x232a});config['redis']=_[_0x255e('0x9')](config[_0x255e('0xa')],{'host':_0x255e('0xb'),'port':0x18eb});var socket=require(_0x255e('0xc'))(new Redis(config[_0x255e('0xa')]));require(_0x255e('0xd'))[_0x255e('0xe')](socket);function respondWithRpcPromise(_0x19f75e,_0x296f3a,_0x16312f){return new BPromise(function(_0x272d26,_0x4827b9){return client[_0x255e('0xf')](_0x19f75e,_0x16312f)[_0x255e('0x10')](function(_0x2b9874){logger[_0x255e('0x11')](_0x255e('0x12'),_0x296f3a,'request\x20sent');logger['debug'](_0x255e('0x13'),_0x296f3a,_0x255e('0x14'),JSON[_0x255e('0x15')](_0x2b9874));if(_0x2b9874[_0x255e('0x16')]){if(_0x2b9874[_0x255e('0x16')]['code']===0x1f4){logger[_0x255e('0x16')](_0x255e('0x12'),_0x296f3a,_0x2b9874[_0x255e('0x16')][_0x255e('0x17')]);return _0x4827b9(_0x2b9874['error'][_0x255e('0x17')]);}logger[_0x255e('0x16')](_0x255e('0x12'),_0x296f3a,_0x2b9874['error']['message']);return _0x272d26(_0x2b9874[_0x255e('0x16')][_0x255e('0x17')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x296f3a,_0x255e('0x14'));_0x272d26(_0x2b9874['result'][_0x255e('0x17')]);}})['catch'](function(_0xf1d296){logger[_0x255e('0x16')](_0x255e('0x12'),_0x296f3a,_0xf1d296);_0x4827b9(_0xf1d296);});});} \ No newline at end of file +var _0xc923=['redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1a5f94,_0x19b888){var _0x352348=function(_0x16c899){while(--_0x16c899){_0x1a5f94['push'](_0x1a5f94['shift']());}};_0x352348(++_0x19b888);}(_0xc923,0x1ef));var _0x3c92=function(_0x513e90,_0x186a7c){_0x513e90=_0x513e90-0x0;var _0x5401be=_0xc923[_0x513e90];return _0x5401be;};'use strict';var _=require(_0x3c92('0x0'));var util=require(_0x3c92('0x1'));var moment=require(_0x3c92('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c92('0x3'))(_0x3c92('0x4'));var config=require(_0x3c92('0x5'));var jayson=require(_0x3c92('0x6'));var client=jayson[_0x3c92('0x7')][_0x3c92('0x8')]({'port':0x232a});config[_0x3c92('0x9')]=_[_0x3c92('0xa')](config[_0x3c92('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c92('0xb'))(new Redis(config[_0x3c92('0x9')]));require(_0x3c92('0xc'))[_0x3c92('0xd')](socket);function respondWithRpcPromise(_0x5dcd73,_0x2e1eeb,_0x59300c){return new BPromise(function(_0x31addc,_0x4c3628){return client[_0x3c92('0xe')](_0x5dcd73,_0x59300c)[_0x3c92('0xf')](function(_0x1be3a3){logger[_0x3c92('0x10')](_0x3c92('0x11'),_0x2e1eeb,_0x3c92('0x12'));logger['debug'](_0x3c92('0x13'),_0x2e1eeb,_0x3c92('0x12'),JSON['stringify'](_0x1be3a3));if(_0x1be3a3[_0x3c92('0x14')]){if(_0x1be3a3[_0x3c92('0x14')]['code']===0x1f4){logger['error'](_0x3c92('0x11'),_0x2e1eeb,_0x1be3a3[_0x3c92('0x14')][_0x3c92('0x15')]);return _0x4c3628(_0x1be3a3[_0x3c92('0x14')][_0x3c92('0x15')]);}logger[_0x3c92('0x14')](_0x3c92('0x11'),_0x2e1eeb,_0x1be3a3['error'][_0x3c92('0x15')]);return _0x31addc(_0x1be3a3[_0x3c92('0x14')]['message']);}else{logger[_0x3c92('0x10')](_0x3c92('0x11'),_0x2e1eeb,_0x3c92('0x12'));_0x31addc(_0x1be3a3[_0x3c92('0x16')]['message']);}})[_0x3c92('0x17')](function(_0x6a6264){logger['error'](_0x3c92('0x11'),_0x2e1eeb,_0x6a6264);_0x4c3628(_0x6a6264);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0c2179f..098b865 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 _0xfc95=['save','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0xfc95,0xf8));var _0x5fc9=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xfc95[_0x476bf4];return _0x788ffe;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x5fc9('0x0'),_0x5fc9('0x1'),_0x5fc9('0x2')];function createListener(_0x369de2,_0x5e35a3){return function(_0x410b07){_0x5e35a3[_0x5fc9('0x3')](_0x369de2,_0x410b07);};}function removeListener(_0x282f3f,_0x31c7eb){return function(){ChatGroupEvents[_0x5fc9('0x4')](_0x282f3f,_0x31c7eb);};}exports[_0x5fc9('0x5')]=function(_0x425741){for(var _0x2179b7=0x0,_0x1770ca=events[_0x5fc9('0x6')];_0x2179b7<_0x1770ca;_0x2179b7++){var _0x452762=events[_0x2179b7];var _0x77f95d=createListener(_0x5fc9('0x7')+_0x452762,_0x425741);ChatGroupEvents['on'](_0x452762,_0x77f95d);}}; \ No newline at end of file +var _0xb3f8=['./chatGroup.events','save','remove','update','removeListener','register','length','chatGroup:'];(function(_0x540479,_0x340e8e){var _0x532937=function(_0x5e6a3e){while(--_0x5e6a3e){_0x540479['push'](_0x540479['shift']());}};_0x532937(++_0x340e8e);}(_0xb3f8,0xd8));var _0x8b3f=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xb3f8[_0x1305e3];return _0x1068e9;};'use strict';var ChatGroupEvents=require(_0x8b3f('0x0'));var events=[_0x8b3f('0x1'),_0x8b3f('0x2'),_0x8b3f('0x3')];function createListener(_0xfa619e,_0x219282){return function(_0x4f19df){_0x219282['emit'](_0xfa619e,_0x4f19df);};}function removeListener(_0x28a818,_0x10855d){return function(){ChatGroupEvents[_0x8b3f('0x4')](_0x28a818,_0x10855d);};}exports[_0x8b3f('0x5')]=function(_0x3f0a75){for(var _0x306214=0x0,_0x218b7a=events[_0x8b3f('0x6')];_0x306214<_0x218b7a;_0x306214++){var _0x7c3f89=events[_0x306214];var _0x3c47d8=createListener(_0x8b3f('0x7')+_0x7c3f89,_0x3f0a75);ChatGroupEvents['on'](_0x7c3f89,_0x3c47d8);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 98d95b7..e278a11 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 _0xe7fb=['/:id','show','/:id/unread','getUnread','getMembers','post','create','/:id/members','addMembers','/:id/messages','addMessage','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe'];(function(_0x25467a,_0x3d7dce){var _0x288591=function(_0x16e567){while(--_0x16e567){_0x25467a['push'](_0x25467a['shift']());}};_0x288591(++_0x3d7dce);}(_0xe7fb,0x1c8));var _0xbe7f=function(_0x59c096,_0x34a37c){_0x59c096=_0x59c096-0x0;var _0x2e9c2b=_0xe7fb[_0x59c096];return _0x2e9c2b;};'use strict';var multer=require(_0xbe7f('0x0'));var util=require(_0xbe7f('0x1'));var path=require(_0xbe7f('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe7f('0x3'));var router=express[_0xbe7f('0x4')]();var fs_extra=require(_0xbe7f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe7f('0x6'));var config=require(_0xbe7f('0x7'));var controller=require(_0xbe7f('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbe7f('0x9')]('/describe',auth[_0xbe7f('0xa')](),controller[_0xbe7f('0xb')]);router[_0xbe7f('0x9')](_0xbe7f('0xc'),auth[_0xbe7f('0xa')](),controller[_0xbe7f('0xd')]);router[_0xbe7f('0x9')](_0xbe7f('0xe'),auth['isAuthenticated'](),controller[_0xbe7f('0xf')]);router[_0xbe7f('0x9')]('/:id/members',auth[_0xbe7f('0xa')](),controller[_0xbe7f('0x10')]);router[_0xbe7f('0x9')]('/:id/messages',auth[_0xbe7f('0xa')](),controller['getMessages']);router[_0xbe7f('0x11')]('/',auth[_0xbe7f('0xa')](),controller[_0xbe7f('0x12')]);router['post'](_0xbe7f('0x13'),auth[_0xbe7f('0xa')](),controller[_0xbe7f('0x14')]);router[_0xbe7f('0x11')](_0xbe7f('0x15'),auth[_0xbe7f('0xa')](),controller[_0xbe7f('0x16')]);router['put'](_0xbe7f('0xc'),auth['isAuthenticated'](),controller[_0xbe7f('0x17')]);router[_0xbe7f('0x18')](_0xbe7f('0xc'),auth[_0xbe7f('0xa')](),controller['destroy']);router['delete'](_0xbe7f('0x13'),auth[_0xbe7f('0xa')](),controller['removeMembers']);module[_0xbe7f('0x19')]=router; \ No newline at end of file +var _0x8322=['getUnread','/:id/members','/:id/messages','getMessages','create','post','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread'];(function(_0x39dd6f,_0x28cfe1){var _0x1d0a8a=function(_0x40b4cd){while(--_0x40b4cd){_0x39dd6f['push'](_0x39dd6f['shift']());}};_0x1d0a8a(++_0x28cfe1);}(_0x8322,0x109));var _0x2832=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x8322[_0x55ff3e];return _0x2709eb;};'use strict';var multer=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var path=require(_0x2832('0x2'));var timeout=require(_0x2832('0x3'));var express=require(_0x2832('0x4'));var router=express[_0x2832('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2832('0x6'));var interaction=require(_0x2832('0x7'));var config=require('../../config/environment');var controller=require(_0x2832('0x8'));router[_0x2832('0x9')]('/',auth[_0x2832('0xa')](),controller[_0x2832('0xb')]);router['get']('/describe',auth[_0x2832('0xa')](),controller[_0x2832('0xc')]);router[_0x2832('0x9')](_0x2832('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2832('0x9')](_0x2832('0xe'),auth[_0x2832('0xa')](),controller[_0x2832('0xf')]);router['get'](_0x2832('0x10'),auth[_0x2832('0xa')](),controller['getMembers']);router[_0x2832('0x9')](_0x2832('0x11'),auth['isAuthenticated'](),controller[_0x2832('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2832('0x13')]);router[_0x2832('0x14')](_0x2832('0x10'),auth[_0x2832('0xa')](),controller[_0x2832('0x15')]);router[_0x2832('0x14')](_0x2832('0x11'),auth['isAuthenticated'](),controller[_0x2832('0x16')]);router[_0x2832('0x17')](_0x2832('0xd'),auth[_0x2832('0xa')](),controller[_0x2832('0x18')]);router[_0x2832('0x19')](_0x2832('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x2832('0x19')](_0x2832('0x10'),auth[_0x2832('0xa')](),controller[_0x2832('0x1a')]);module[_0x2832('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3997c80..b41d884 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 _0x91f1=['BOOLEAN','INTEGER','star','TEXT','STRING','DATE','long','ENUM','out','sequelize','exports'];(function(_0x5a92fc,_0x45dd94){var _0x48dd57=function(_0x516cc1){while(--_0x516cc1){_0x5a92fc['push'](_0x5a92fc['shift']());}};_0x48dd57(++_0x45dd94);}(_0x91f1,0xcf));var _0x191f=function(_0x4bc373,_0x1723ba){_0x4bc373=_0x4bc373-0x0;var _0x543459=_0x91f1[_0x4bc373];return _0x543459;};'use strict';var Sequelize=require(_0x191f('0x0'));module[_0x191f('0x1')]={'closed':{'type':Sequelize[_0x191f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x191f('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x191f('0x4'),'thumb'),'defaultValue':_0x191f('0x4')},'ratingMessage':{'type':Sequelize[_0x191f('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x191f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x191f('0x7')]},'disposition':{'type':Sequelize[_0x191f('0x6')]},'secondDisposition':{'type':Sequelize[_0x191f('0x6')]},'thirdDisposition':{'type':Sequelize[_0x191f('0x6')]},'note':{'type':Sequelize[_0x191f('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x191f('0x6')]},'osName':{'type':Sequelize[_0x191f('0x6')]},'osVersion':{'type':Sequelize[_0x191f('0x6')]},'deviceModel':{'type':Sequelize[_0x191f('0x6')]},'deviceVendor':{'type':Sequelize[_0x191f('0x6')]},'deviceType':{'type':Sequelize[_0x191f('0x6')]},'referer':{'type':Sequelize[_0x191f('0x5')]},'customerIp':{'type':Sequelize[_0x191f('0x6')]},'formData':{'type':Sequelize[_0x191f('0x5')](_0x191f('0x8'))},'read1stAt':{'type':Sequelize[_0x191f('0x7')]},'lastMsgAt':{'type':Sequelize[_0x191f('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x191f('0x9')]('in',_0x191f('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x191f('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x191f('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x191f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x191f('0x3')]}}; \ No newline at end of file +var _0x5eb6=['INTEGER','ENUM','star','TEXT','STRING','long','DATE','out','sequelize','exports','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5eb6,0x81));var _0x65eb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5eb6[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x65eb('0x0'));module[_0x65eb('0x1')]={'closed':{'type':Sequelize[_0x65eb('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x65eb('0x3')]},'ratingType':{'type':Sequelize[_0x65eb('0x4')](_0x65eb('0x5'),'thumb'),'defaultValue':_0x65eb('0x5')},'ratingMessage':{'type':Sequelize[_0x65eb('0x6')]},'pathTranscript':{'type':Sequelize[_0x65eb('0x6')]},'mailTranscript':{'type':Sequelize[_0x65eb('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x65eb('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x65eb('0x7')]},'note':{'type':Sequelize[_0x65eb('0x7')]},'browserName':{'type':Sequelize[_0x65eb('0x7')]},'browserVersion':{'type':Sequelize[_0x65eb('0x7')]},'osName':{'type':Sequelize[_0x65eb('0x7')]},'osVersion':{'type':Sequelize[_0x65eb('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x65eb('0x7')]},'deviceType':{'type':Sequelize[_0x65eb('0x7')]},'referer':{'type':Sequelize[_0x65eb('0x6')]},'customerIp':{'type':Sequelize[_0x65eb('0x7')]},'formData':{'type':Sequelize[_0x65eb('0x6')](_0x65eb('0x8'))},'read1stAt':{'type':Sequelize[_0x65eb('0x9')]},'lastMsgAt':{'type':Sequelize[_0x65eb('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x65eb('0x4')]('in',_0x65eb('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x65eb('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x65eb('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x65eb('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x65eb('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7a03597..52640e2 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 _0xcef0=['interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','params','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','find','catch','create','body','destroy','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','vidaooMetadata','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','length','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','options','getMyMessages','ChatInteractionId','secret','push','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','disposition','browserName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','debug','request\x20sent','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','name','send','render','contact'];(function(_0x118439,_0x1907d9){var _0x209b67=function(_0x51e946){while(--_0x51e946){_0x118439['push'](_0x118439['shift']());}};_0x209b67(++_0x1907d9);}(_0xcef0,0xa6));var _0x0cef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcef0[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x0cef('0x0'));var zipdir=require(_0x0cef('0x1'));var rp=require(_0x0cef('0x2'));var moment=require('moment');var BPromise=require(_0x0cef('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require(_0x0cef('0x4'));var fs=require('fs');var _=require(_0x0cef('0x5'));var Redis=require(_0x0cef('0x6'));var interaction=require(_0x0cef('0x7'));var qs=require(_0x0cef('0x8'));var pdf=require(_0x0cef('0x9'));var logger=require('../../config/logger')(_0x0cef('0xa'));var config=require(_0x0cef('0xb'));var db=require(_0x0cef('0xc'))['db'];config[_0x0cef('0xd')]=_[_0x0cef('0xe')](config[_0x0cef('0xd')],{'host':_0x0cef('0xf'),'port':0x18eb});var socket=require(_0x0cef('0x10'))(new Redis(config[_0x0cef('0xd')]));require('./chatInteraction.socket')[_0x0cef('0x11')](socket);var jayson=require(_0x0cef('0x12'));var client=jayson['client'][_0x0cef('0x13')]({'port':0x232b});var client9004=jayson[_0x0cef('0x14')][_0x0cef('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x1a741e,_0x38fb70,_0x1523e4,_0x4d8b7d){return new BPromise(function(_0x248771,_0x25ffd1){var _0x30344c=_0x4d8b7d||client;return _0x30344c[_0x0cef('0x15')](_0x1a741e,_0x1523e4)['then'](function(_0x4fe500){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x38fb70,'request\x20sent');logger[_0x0cef('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x38fb70,_0x0cef('0x17'),JSON[_0x0cef('0x18')](_0x4fe500));if(_0x4fe500[_0x0cef('0x19')]){if(_0x4fe500[_0x0cef('0x19')][_0x0cef('0x1a')]===0x1f4){logger[_0x0cef('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x38fb70,_0x4fe500[_0x0cef('0x19')][_0x0cef('0x1b')]);return _0x25ffd1(_0x4fe500[_0x0cef('0x19')][_0x0cef('0x1b')]);}logger[_0x0cef('0x19')](_0x0cef('0x1c'),_0x38fb70,_0x4fe500['error'][_0x0cef('0x1b')]);return _0x248771(_0x4fe500[_0x0cef('0x19')][_0x0cef('0x1b')]);}else{logger['info'](_0x0cef('0x1c'),_0x38fb70,'request\x20sent');_0x248771(_0x4fe500[_0x0cef('0x1d')][_0x0cef('0x1b')]);}})['catch'](function(_0x176911){logger[_0x0cef('0x19')](_0x0cef('0x1c'),_0x38fb70,_0x176911);_0x25ffd1(_0x176911);});});}function respondWithStatusCode(_0x222b4b,_0x3a3bd3){_0x3a3bd3=_0x3a3bd3||0xcc;return function(_0x4f305a){if(_0x4f305a){return _0x222b4b[_0x0cef('0x1e')](_0x3a3bd3);}return _0x222b4b[_0x0cef('0x1f')](_0x3a3bd3)[_0x0cef('0x20')]();};}function respondWithResult(_0x411d75,_0x3b81e5){_0x3b81e5=_0x3b81e5||0xc8;return function(_0x1d4473){if(_0x1d4473){return _0x411d75[_0x0cef('0x1f')](_0x3b81e5)[_0x0cef('0x21')](_0x1d4473);}};}function respondWithFilteredResult(_0x3995a0,_0x7812ce){return function(_0x1df3e5){if(_0x1df3e5){var _0x467cf4=typeof _0x7812ce[_0x0cef('0x22')]===_0x0cef('0x23')&&typeof _0x7812ce[_0x0cef('0x24')]===_0x0cef('0x23');var _0x459c42=_0x1df3e5['count'];var _0x5444a1=_0x467cf4?0x0:_0x7812ce[_0x0cef('0x22')];var _0x7deede=_0x467cf4?_0x1df3e5[_0x0cef('0x25')]:_0x7812ce[_0x0cef('0x22')]+_0x7812ce[_0x0cef('0x24')];var _0x4109ca;if(_0x7deede>=_0x459c42){_0x7deede=_0x459c42;_0x4109ca=0xc8;}else{_0x4109ca=0xce;}_0x3995a0[_0x0cef('0x1f')](_0x4109ca);return _0x3995a0[_0x0cef('0x26')](_0x0cef('0x27'),_0x5444a1+'-'+_0x7deede+'/'+_0x459c42)['json'](_0x1df3e5);}return null;};}function saveUpdates(_0x3d6ed1){return function(_0x303066){if(_0x303066){return _0x303066[_0x0cef('0x28')](_0x3d6ed1)[_0x0cef('0x29')](function(_0x30e15c){return _0x30e15c;});}return null;};}function removeEntity(_0x51bb16){return function(_0x132c47){if(_0x132c47){return _0x132c47['destroy']()[_0x0cef('0x29')](function(){_0x51bb16[_0x0cef('0x1f')](0xcc)[_0x0cef('0x20')]();});}};}function handleEntityNotFound(_0xdb8178){return function(_0x46dfc4){if(!_0x46dfc4){_0xdb8178[_0x0cef('0x1e')](0x194);}return _0x46dfc4;};}function handleError(_0x4270fd,_0x387617){_0x387617=_0x387617||0x1f4;return function(_0x4d72c4){logger[_0x0cef('0x19')](_0x4d72c4['stack']);if(_0x4d72c4['name']){delete _0x4d72c4[_0x0cef('0x2a')];}_0x4270fd['status'](_0x387617)[_0x0cef('0x2b')](_0x4d72c4);};}function getMustacheRender(_0x27e2fb,_0x5cf7c4){return Mustache[_0x0cef('0x2c')](_0x27e2fb,_['merge'](_0x5cf7c4['body'],{'contact':_0x5cf7c4[_0x0cef('0x2d')],'message':_0x5cf7c4[_0x0cef('0x1b')],'agent':_0x5cf7c4['agent'],'interaction':_0x5cf7c4[_0x0cef('0x2e')],'account':_0x5cf7c4[_0x0cef('0x2f')]}))||'';}exports[_0x0cef('0x30')]=function(_0x5a8fd3,_0x5f54aa){var _0x8a0303={};var _0x593964=_[_0x0cef('0x31')](db[_0x0cef('0x32')][_0x0cef('0x33')],function(_0x12da79){return{'name':_0x12da79[_0x0cef('0x34')],'type':_0x12da79[_0x0cef('0x35')][_0x0cef('0x36')]};});_0x8a0303=qs[_0x0cef('0x37')](_0x593964,_0x5a8fd3);return interaction[_0x0cef('0x38')](_0x0cef('0x39'),_0x5a8fd3[_0x0cef('0x3a')],_0x5a8fd3[_0x0cef('0x3b')],_0x8a0303,_0x593964)[_0x0cef('0x29')](respondWithFilteredResult(_0x5f54aa,_0x8a0303))['catch'](handleError(_0x5f54aa,null));};exports['show']=function(_0x1b9d67,_0x53e0aa){var _0x4c6a40={'raw':![],'where':{'id':_0x1b9d67[_0x0cef('0x3c')]['id']}},_0x166792={};_0x166792['model']=_[_0x0cef('0x3d')](db[_0x0cef('0x32')][_0x0cef('0x33')]);_0x166792[_0x0cef('0x3a')]=_['keys'](_0x1b9d67[_0x0cef('0x3a')]);_0x166792[_0x0cef('0x3e')]=_[_0x0cef('0x3f')](_0x166792[_0x0cef('0x40')],_0x166792['query']);_0x4c6a40[_0x0cef('0x41')]=_[_0x0cef('0x3f')](_0x166792[_0x0cef('0x40')],qs[_0x0cef('0x42')](_0x1b9d67['query'][_0x0cef('0x42')]));_0x4c6a40[_0x0cef('0x41')]=_0x4c6a40[_0x0cef('0x41')]['length']?_0x4c6a40['attributes']:_0x166792[_0x0cef('0x40')];if(_0x1b9d67[_0x0cef('0x3a')][_0x0cef('0x43')]){_0x4c6a40[_0x0cef('0x44')]=[{'all':!![]}];}_0x4c6a40=_[_0x0cef('0x45')]({},_0x4c6a40,_0x1b9d67['options']);return db[_0x0cef('0x32')][_0x0cef('0x46')](_0x4c6a40)['then'](handleEntityNotFound(_0x53e0aa,null))[_0x0cef('0x29')](respondWithResult(_0x53e0aa,null))[_0x0cef('0x47')](handleError(_0x53e0aa,null));};exports[_0x0cef('0x48')]=function(_0x50cd2a,_0x4e755f){return db['ChatInteraction'][_0x0cef('0x48')](_0x50cd2a[_0x0cef('0x49')],{})[_0x0cef('0x29')](respondWithResult(_0x4e755f,0xc9))[_0x0cef('0x47')](handleError(_0x4e755f,null));};exports[_0x0cef('0x28')]=function(_0x215fb7,_0x52663d){if(_0x215fb7['body']['id']){delete _0x215fb7['body']['id'];}return db[_0x0cef('0x32')][_0x0cef('0x46')]({'where':{'id':_0x215fb7['params']['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x52663d,null))['then'](saveUpdates(_0x215fb7['body'],null))[_0x0cef('0x29')](respondWithResult(_0x52663d,null))['catch'](handleError(_0x52663d,null));};exports[_0x0cef('0x4a')]=function(_0xc98437,_0x542a3c){return db[_0x0cef('0x32')][_0x0cef('0x46')]({'where':{'id':_0xc98437['params']['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x542a3c,null))[_0x0cef('0x29')](removeEntity(_0x542a3c,null))[_0x0cef('0x47')](handleError(_0x542a3c,null));};exports['describe']=function(_0x21eceb,_0x4b3b50){return db['ChatInteraction']['describe']()[_0x0cef('0x29')](respondWithResult(_0x4b3b50,null))['catch'](handleError(_0x4b3b50,null));};exports['createVidaooSession']=function(_0x2c0687,_0x4efc8c){var _0x125d8a=_0x2c0687[_0x0cef('0x3c')]['id'];var _0x5003b3;var _0x2384dd;var _0x533b31;return db[_0x0cef('0x32')]['findOne']({'where':{'id':_0x125d8a}})[_0x0cef('0x29')](function(_0x57c961){_0x5003b3=_0x57c961;return db[_0x0cef('0x4b')][_0x0cef('0x4c')]({'where':{'id':_0x57c961[_0x0cef('0x4d')]},'attributes':['id',_0x0cef('0x4e'),_0x0cef('0x4f'),_0x0cef('0x50'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x0cef('0x29')](function(_0x1cda8a){if(_0x1cda8a&&_0x1cda8a[_0x0cef('0x4e')]&&_0x1cda8a[_0x0cef('0x4f')]){_0x2384dd=_0x1cda8a;var _0x256e1f={'interaction':{'id':_0x125d8a},'agent':{'id':_0x2c0687[_0x0cef('0x3b')]['id'],'name':_0x2c0687['user'][_0x0cef('0x2a')],'fullname':_0x2c0687[_0x0cef('0x3b')][_0x0cef('0x51')],'email':_0x2c0687[_0x0cef('0x3b')][_0x0cef('0x52')]},'contact':_0x2c0687[_0x0cef('0x49')][_0x0cef('0x2d')],'account':_0x2c0687[_0x0cef('0x49')][_0x0cef('0x2f')]};var _0x2c503c={'rejectUnauthorized':![],'method':_0x0cef('0x53'),'url':_0x0cef('0x54'),'headers':{'X-APIKEY':_0x1cda8a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2c0687['user'][_0x0cef('0x52')]],'buttons':null,'topic':_0x2384dd['vidaooTopic'],'note':_['isNull'](_0x2384dd[_0x0cef('0x55')])?null:getMustacheRender(_0x2384dd[_0x0cef('0x55')],_0x256e1f),'metadata':null},'redirect':_0x0cef('0x56'),'json':!![]};try{if(!_[_0x0cef('0x57')](_0x2384dd[_0x0cef('0x58')])){var _0x2ccefb=getMustacheRender(_0x2384dd[_0x0cef('0x58')],_0x256e1f);var _0x16c801=JSON[_0x0cef('0x59')](_0x2ccefb);_0x2c503c[_0x0cef('0x49')][_0x0cef('0x5a')]=_0x16c801;}}catch(_0x3524c3){throw new db[(_0x0cef('0x5b'))]['ValidationError'](_0x0cef('0x5c'));}return rp(_0x2c503c);}else{throw new db[(_0x0cef('0x5b'))][(_0x0cef('0x5d'))](_0x0cef('0x5e'));}})[_0x0cef('0x29')](function(_0x3b7c18){_0x533b31=_0x3b7c18;if(_0x533b31['id']){var _0xaf551d={'body':_0x533b31[_0x0cef('0x5f')],'ChatWebsiteId':_0x2384dd['id'],'ChatInteractionId':_0x5003b3['id'],'direction':_0x0cef('0x60'),'UserId':_0x2c0687[_0x0cef('0x3b')]['id']};return db[_0x0cef('0x61')][_0x0cef('0x48')](_0xaf551d,{});}else{throw new db['Sequelize'][(_0x0cef('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x5003b3[_0x0cef('0x62')]({'vidaooSessionId':_0x533b31['id']});})[_0x0cef('0x29')](respondWithResult(_0x4efc8c,null))[_0x0cef('0x47')](handleError(_0x4efc8c,null));};exports[_0x0cef('0x63')]=function(_0x444d04,_0x264890){if(_0x444d04[_0x0cef('0x49')]['id']){delete _0x444d04[_0x0cef('0x49')]['id'];}return db[_0x0cef('0x32')]['find']({'where':{'id':_0x444d04[_0x0cef('0x3c')]['id']},'include':[{'model':db[_0x0cef('0x64')],'as':_0x0cef('0x65')}]})[_0x0cef('0x29')](handleEntityNotFound(_0x264890,null))[_0x0cef('0x29')](saveUpdates(_0x444d04['body'],null))[_0x0cef('0x29')](respondWithResult(_0x264890,null))[_0x0cef('0x47')](handleError(_0x264890,null));};exports[_0x0cef('0x66')]=function(_0x333d68,_0x33f04c){if(_0x333d68[_0x0cef('0x49')]['id']){delete _0x333d68[_0x0cef('0x49')]['id'];}return db[_0x0cef('0x32')][_0x0cef('0x46')]({'where':{'id':_0x333d68[_0x0cef('0x3c')]['id']}})[_0x0cef('0x29')](function(_0x23a9ae){if(!_0x23a9ae){logger[_0x0cef('0x19')](_0x0cef('0x67'),_0x0cef('0x66'),0x194,_0x0cef('0x68'));_0x33f04c[_0x0cef('0x1e')](0x194);}else{if(_0x23a9ae[_0x0cef('0x69')]){throw new db['Sequelize'][(_0x0cef('0x5d'))](_0x0cef('0x6a'));}}return _0x23a9ae;})['then'](function(_0x4dac0f){if(_0x4dac0f){return _0x4dac0f[_0x0cef('0x28')]({'closed':_0x333d68[_0x0cef('0x49')][_0x0cef('0x6b')],'disposition':_0x333d68[_0x0cef('0x49')]['disposition']})['then'](function(_0x38bbd1){return _0x38bbd1;});}})[_0x0cef('0x29')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x333d68['body'],client9004);})[_0x0cef('0x29')](respondWithResult(_0x33f04c,null))['catch'](handleError(_0x33f04c,null));};exports[_0x0cef('0x6c')]=function(_0x45add2,_0x2d6986){_0x45add2[_0x0cef('0x49')][_0x0cef('0x2a')]=_0x45add2[_0x0cef('0x6d')][_0x0cef('0x6e')];_0x45add2[_0x0cef('0x49')][_0x0cef('0x6f')]=_0x45add2[_0x0cef('0x6d')][_0x0cef('0x70')];_0x45add2[_0x0cef('0x49')][_0x0cef('0x35')]=_0x45add2['file']['mimetype'];return db[_0x0cef('0x71')][_0x0cef('0x48')](_0x45add2[_0x0cef('0x49')])[_0x0cef('0x29')](respondWithResult(_0x2d6986,0xc9))[_0x0cef('0x47')](handleError(_0x2d6986,null));};exports[_0x0cef('0x72')]=function(_0x11bacd,_0xf4c8a1){return db[_0x0cef('0x32')][_0x0cef('0x4c')]({'where':{'id':_0x11bacd[_0x0cef('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xf4c8a1,null))[_0x0cef('0x29')](function(_0x1b0ac8){if(_0x1b0ac8){if(_0x1b0ac8[_0x0cef('0x6b')]){return _0xf4c8a1[_0x0cef('0x1f')](0x193)[_0x0cef('0x21')]({'status':0x193,'message':_0x0cef('0x73')});}return db['Attachment'][_0x0cef('0x4c')]({'where':{'id':_0x11bacd[_0x0cef('0x3a')][_0x0cef('0x74')]},'raw':!![]})[_0x0cef('0x29')](handleEntityNotFound(_0xf4c8a1,null));}})['then'](function(_0x10f793){if(_0x10f793){var _0x5acaa5=_0x10f793[_0x0cef('0x75')]!==null;var _0x31c5a5=path[_0x0cef('0x76')](config[_0x0cef('0x77')],'server/files/attachments/');if(_0x5acaa5){_0x31c5a5=path['join'](_0x31c5a5,'offline-chat/');}var _0x12d807=path[_0x0cef('0x76')](_0x31c5a5,_0x10f793[_0x0cef('0x6f')]);return _0xf4c8a1[_0x0cef('0x78')](_0x12d807);}})['catch'](handleError(_0xf4c8a1,null));};exports[_0x0cef('0x79')]=function(_0x2fc627,_0x39ff30){var _0x25a88f=null;var _0x2280d3=null;var _0x29eb06=null;if(_0x2fc627['body']['id']){delete _0x2fc627[_0x0cef('0x49')]['id'];}if(_0x2fc627[_0x0cef('0x49')][_0x0cef('0x7a')]){_0x29eb06=path[_0x0cef('0x76')](config[_0x0cef('0x77')],_0x0cef('0x7b'),util[_0x0cef('0x7c')](_0x0cef('0x7d'),Date[_0x0cef('0x7e')]()));_0x2fc627[_0x0cef('0x49')][_0x0cef('0x7f')]=_0x29eb06;}return db['ChatInteraction']['find']({'where':{'id':_0x2fc627['params']['id']},'include':[{'model':db[_0x0cef('0x61')],'as':_0x0cef('0x80'),'include':[{'model':db[_0x0cef('0x81')],'as':_0x0cef('0x81')}]}]})[_0x0cef('0x29')](handleEntityNotFound(_0x39ff30,null))[_0x0cef('0x29')](saveUpdates(_0x2fc627[_0x0cef('0x49')],null))[_0x0cef('0x29')](function(_0x2c9554){if(_0x2c9554){_0x25a88f=_0x2c9554;return db[_0x0cef('0x4b')][_0x0cef('0x46')]({'where':{'id':_0x25a88f[_0x0cef('0x4d')]}});}})[_0x0cef('0x29')](function(_0x3152ff){if(_0x3152ff){_0x2280d3=_0x3152ff;return db[_0x0cef('0x64')][_0x0cef('0x46')]({'where':{'id':_0x25a88f[_0x0cef('0x82')]}});}})[_0x0cef('0x29')](function(_0x4e0761){if(_0x4e0761){if(_0x29eb06){var _0x3b9826=null;for(var _0xb08311=0x1;_0xb08311<_0x25a88f['Messages'][_0x0cef('0x83')];++_0xb08311){_0x3b9826=_0x25a88f[_0x0cef('0x80')][_0xb08311];var _0x1e5b3e=_0x3b9826[_0x0cef('0x69')]?util[_0x0cef('0x7c')](_0x0cef('0x84'),_0x2280d3[_0x0cef('0x85')],_0x3b9826['UserId']):_0x0cef('0x86');var _0x1bfb53=_0x2fc627['body'][_0x0cef('0x87')]||util['format'](_0x0cef('0x84'),_0x0cef('0x88'),_0x3b9826[_0x0cef('0x82')]);switch(_0x2280d3['agentIdentifier']){case _0x0cef('0x89'):_0x1e5b3e=_0x3b9826[_0x0cef('0x69')]?util['format'](_0x0cef('0x84'),_0x2280d3[_0x0cef('0x85')],_0x3b9826['UserId']):_0x0cef('0x86');break;case _0x0cef('0x8a'):_0x1e5b3e=_0x3b9826['UserId']?_0x3b9826[_0x0cef('0x81')][_0x0cef('0x8b')]||_0x3b9826[_0x0cef('0x81')]['fullname']:_0x0cef('0x86');break;case _0x0cef('0x8c'):_0x1e5b3e=_0x3b9826[_0x0cef('0x69')]?_0x3b9826[_0x0cef('0x81')][_0x0cef('0x51')]:_0x0cef('0x86');break;default:_0x1e5b3e=_0x3b9826[_0x0cef('0x69')]?util[_0x0cef('0x7c')](_0x0cef('0x84'),_0x2280d3[_0x0cef('0x85')],_0x3b9826[_0x0cef('0x69')]):_0x0cef('0x86');}var _0x94fbf3=util[_0x0cef('0x7c')](_0x0cef('0x8d'),moment(_0x3b9826[_0x0cef('0x8e')])[_0x0cef('0x7c')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3b9826[_0x0cef('0x8f')]==='in'?_0x1bfb53:_0x1e5b3e,_0x3b9826[_0x0cef('0x49')]);if(!_0x3b9826['secret']){fs['appendFileSync'](_0x29eb06,_0x94fbf3);}}return db[_0x0cef('0x90')][_0x0cef('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0x0cef('0x91')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0cef('0x92')],'as':_0x0cef('0x92'),'raw':!![]}]}]});}}})[_0x0cef('0x29')](function(_0xe62306){if(!_0xe62306||!_0xe62306[_0x0cef('0x93')]||!_0x2fc627[_0x0cef('0x49')])return _0x25a88f;var _0x2f60ce=_0xe62306[_0x0cef('0x94')]();return respondWithRpcPromise(_0x0cef('0x95'),_0x0cef('0x96'),{'account':_0x2f60ce,'message':{'from':util[_0x0cef('0x7c')](_0x0cef('0x97'),_0xe62306[_0x0cef('0x2a')],_0xe62306['email']||_0xe62306[_0x0cef('0x93')][_0x0cef('0x3b')]),'to':_0x2fc627[_0x0cef('0x49')][_0x0cef('0x7a')],'subject':'Mail\x20Transcript','text':util[_0x0cef('0x7c')](_0x0cef('0x98'),_0x2fc627['body'][_0x0cef('0x7a')]),'attachments':[{'path':_0x29eb06}]}})[_0x0cef('0x29')](function(){return _0x25a88f;})[_0x0cef('0x47')](function(_0x105f4c){logger[_0x0cef('0x19')](_0x105f4c);});})[_0x0cef('0x29')](respondWithStatusCode(_0x39ff30,0xc8))[_0x0cef('0x47')](handleError(_0x39ff30,null));};exports['addMessage']=function(_0x33c95c,_0x3e24d8){return db[_0x0cef('0x61')][_0x0cef('0x46')]({'where':{'id':_0x33c95c[_0x0cef('0x3c')]['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x3e24d8,null))[_0x0cef('0x29')](function(_0xe16b29){if(_0xe16b29){return _0xe16b29[_0x0cef('0x99')](_0x33c95c[_0x0cef('0x49')]['ids'],_[_0x0cef('0x9a')](_0x33c95c[_0x0cef('0x49')],[_0x0cef('0x9b'),'id'])||{});}})[_0x0cef('0x29')](respondWithResult(_0x3e24d8,null))[_0x0cef('0x47')](handleError(_0x3e24d8,null));};exports['getMessages']=function(_0x392759,_0x4169bb){var _0x5411be={'raw':![],'where':{}};var _0x5ac591={};var _0x1972c4={'count':0x0,'rows':[]};return db[_0x0cef('0x32')][_0x0cef('0x4c')]({'where':{'id':_0x392759[_0x0cef('0x3c')]['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x4169bb,null))[_0x0cef('0x29')](function(_0x46f088){if(_0x46f088){_0x5ac591['model']=_[_0x0cef('0x3d')](db[_0x0cef('0x61')][_0x0cef('0x33')]);_0x5ac591[_0x0cef('0x3a')]=_[_0x0cef('0x3d')](_0x392759[_0x0cef('0x3a')]);_0x5ac591[_0x0cef('0x3e')]=_[_0x0cef('0x3f')](_0x5ac591[_0x0cef('0x40')],_0x5ac591[_0x0cef('0x3a')]);_0x5411be[_0x0cef('0x41')]=_[_0x0cef('0x3f')](_0x5ac591[_0x0cef('0x40')],qs[_0x0cef('0x42')](_0x392759[_0x0cef('0x3a')][_0x0cef('0x42')]));_0x5411be[_0x0cef('0x41')]=_0x5411be['attributes']['length']?_0x5411be['attributes']:_0x5ac591[_0x0cef('0x40')];if(!_0x392759[_0x0cef('0x3a')][_0x0cef('0x9c')](_0x0cef('0x9d'))){_0x5411be[_0x0cef('0x24')]=qs['limit'](_0x392759['query'][_0x0cef('0x24')]);_0x5411be[_0x0cef('0x22')]=qs[_0x0cef('0x22')](_0x392759[_0x0cef('0x3a')]['offset']);}_0x5411be[_0x0cef('0x9e')]=qs[_0x0cef('0x9f')](_0x392759[_0x0cef('0x3a')][_0x0cef('0x9f')]);_0x5411be[_0x0cef('0xa0')]=qs[_0x0cef('0x3e')](_[_0x0cef('0xa1')](_0x392759[_0x0cef('0x3a')],_0x5ac591[_0x0cef('0x3e')]));_0x5411be[_0x0cef('0xa0')]['ChatInteractionId']=_0x46f088['id'];if(_0x392759[_0x0cef('0x3a')][_0x0cef('0xa2')]){_0x5411be[_0x0cef('0xa0')]=_[_0x0cef('0x45')](_0x5411be[_0x0cef('0xa0')],{'$or':_[_0x0cef('0x31')](_0x5411be['attributes'],function(_0x2447b3){var _0x33b49e={};_0x33b49e[_0x2447b3]={'$like':'%'+_0x392759[_0x0cef('0x3a')][_0x0cef('0xa2')]+'%'};return _0x33b49e;})});}if(_0x392759[_0x0cef('0x3a')]['$gte']){var _0x150cdb=_0x392759[_0x0cef('0x3a')][_0x0cef('0xa3')]['split'](',');var _0x1b6f81={};_0x1b6f81[_0x150cdb[0x0]]={'$gte':moment(_0x150cdb[0x1])[_0x0cef('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5411be[_0x0cef('0xa0')]=_[_0x0cef('0x45')](_0x5411be[_0x0cef('0xa0')],_0x1b6f81);}_0x5411be=_[_0x0cef('0x45')]({},_0x5411be,_0x392759[_0x0cef('0xa4')]);return db[_0x0cef('0x61')][_0x0cef('0x25')]({'where':_0x5411be['where']})[_0x0cef('0x29')](function(_0x27308d){_0x1972c4['count']=_0x27308d;if(_0x392759['query'][_0x0cef('0x43')]){_0x5411be[_0x0cef('0x44')]=[{'all':!![]}];}return db[_0x0cef('0x61')][_0x0cef('0x38')](_0x5411be);})[_0x0cef('0x29')](function(_0x166782){_0x1972c4['rows']=_0x166782;return _0x1972c4;});}})[_0x0cef('0x29')](respondWithFilteredResult(_0x4169bb,_0x5411be))[_0x0cef('0x47')](handleError(_0x4169bb,null));};exports[_0x0cef('0xa5')]=function(_0x4fd6aa,_0x36abff){var _0x38d800={'where':{}},_0x356a52={},_0x2ba455={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x0cef('0x4c')]({'where':{'id':_0x4fd6aa[_0x0cef('0x3c')]['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x36abff,null))[_0x0cef('0x29')](function(_0x5db216){if(_0x5db216){_0x356a52[_0x0cef('0x40')]=_['keys'](db[_0x0cef('0x61')]['rawAttributes']);_0x356a52[_0x0cef('0x3a')]=_['keys'](_0x4fd6aa['query']);_0x356a52[_0x0cef('0x3e')]=_[_0x0cef('0x3f')](_0x356a52[_0x0cef('0x40')],_0x356a52['query']);_0x38d800[_0x0cef('0x41')]=_[_0x0cef('0x3f')](_0x356a52['model'],qs[_0x0cef('0x42')](_0x4fd6aa[_0x0cef('0x3a')][_0x0cef('0x42')]));_0x38d800[_0x0cef('0x41')]=_0x38d800[_0x0cef('0x41')][_0x0cef('0x83')]?_0x38d800[_0x0cef('0x41')]:_0x356a52[_0x0cef('0x40')];if(!_0x4fd6aa['query'][_0x0cef('0x9c')](_0x0cef('0x9d'))){_0x38d800[_0x0cef('0x24')]=qs[_0x0cef('0x24')](_0x4fd6aa[_0x0cef('0x3a')][_0x0cef('0x24')]);_0x38d800[_0x0cef('0x22')]=qs[_0x0cef('0x22')](_0x4fd6aa[_0x0cef('0x3a')][_0x0cef('0x22')]);}_0x38d800[_0x0cef('0x9e')]=qs[_0x0cef('0x9f')](_0x4fd6aa[_0x0cef('0x3a')][_0x0cef('0x9f')]);_0x38d800[_0x0cef('0xa0')]=qs['filters'](_[_0x0cef('0xa1')](_0x4fd6aa[_0x0cef('0x3a')],_0x356a52['filters']));_0x38d800['where'][_0x0cef('0xa6')]=_0x5db216['id'];if(_0x4fd6aa['query']['filter']){_0x38d800[_0x0cef('0xa0')]=_['merge'](_0x38d800[_0x0cef('0xa0')],{'$or':_['map'](_0x38d800[_0x0cef('0x41')],function(_0x5ba75c){var _0x153080={};_0x153080[_0x5ba75c]={'$like':'%'+_0x4fd6aa[_0x0cef('0x3a')]['filter']+'%'};return _0x153080;})});}_0x38d800[_0x0cef('0xa0')][_0x0cef('0xa7')]=![];if(_0x4fd6aa[_0x0cef('0x3a')]['id']){_0x38d800[_0x0cef('0xa0')]['id']={'$gt':_0x4fd6aa[_0x0cef('0x3a')]['id']};}_0x38d800=_[_0x0cef('0x45')]({},_0x38d800,_0x4fd6aa['options']);return db[_0x0cef('0x61')][_0x0cef('0x25')]({'where':_0x38d800[_0x0cef('0xa0')]})['then'](function(_0x47eb27){_0x2ba455[_0x0cef('0x25')]=_0x47eb27;_0x38d800[_0x0cef('0x44')]=[];if(_0x4fd6aa[_0x0cef('0x3a')]['includeAgent']){_0x38d800[_0x0cef('0x44')][_0x0cef('0xa8')]({'model':db[_0x0cef('0x81')],'as':_0x0cef('0x81'),'attributes':['id',_0x0cef('0x51'),'alias']});}if(_0x4fd6aa[_0x0cef('0x3a')][_0x0cef('0x43')]){_0x38d800[_0x0cef('0x44')]=[{'all':!![]}];}return db[_0x0cef('0x61')][_0x0cef('0x38')](_0x38d800);})[_0x0cef('0x29')](function(_0x2871e4){_0x2ba455['rows']=_0x2871e4;return _0x2ba455;});}})['then'](respondWithFilteredResult(_0x36abff,_0x38d800))[_0x0cef('0x47')](handleError(_0x36abff,null));};exports[_0x0cef('0xa9')]=function(_0x385077,_0x45d3d5){return db[_0x0cef('0x32')][_0x0cef('0x46')]({'where':{'id':_0x385077['params']['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x45d3d5,null))[_0x0cef('0x29')](function(_0x2116bc){if(_0x2116bc){return _0x2116bc['setTags'](_0x385077[_0x0cef('0x49')][_0x0cef('0x9b')],_[_0x0cef('0x9a')](_0x385077[_0x0cef('0x49')],[_0x0cef('0x9b'),'id'])||{})[_0x0cef('0xaa')](function(){return db[_0x0cef('0xab')][_0x0cef('0x38')]({'attributes':['id',_0x0cef('0x2a'),_0x0cef('0xac')],'where':{'id':_0x385077[_0x0cef('0x49')][_0x0cef('0x9b')]}});})['then'](function(_0x2a7f1e){socket[_0x0cef('0xad')](_0x0cef('0xae'),{'id':Number(_0x385077[_0x0cef('0x3c')]['id']),'tags':_0x2a7f1e||[]});return{'id':Number(_0x385077[_0x0cef('0x3c')]['id']),'tags':_0x2a7f1e||[]};});}})['then'](respondWithResult(_0x45d3d5,null))[_0x0cef('0x47')](handleError(_0x45d3d5,null));};exports[_0x0cef('0xaf')]=function(_0x3ed886,_0x1aa0a0){return db[_0x0cef('0x32')][_0x0cef('0x46')]({'where':{'id':_0x3ed886[_0x0cef('0x3c')]['id']}})[_0x0cef('0x29')](handleEntityNotFound(_0x1aa0a0,null))[_0x0cef('0x29')](function(_0x3060ea){if(_0x3060ea){return _0x3060ea[_0x0cef('0xaf')](_0x3ed886[_0x0cef('0x3a')][_0x0cef('0x9b')]);}})[_0x0cef('0x29')](respondWithStatusCode(_0x1aa0a0,null))['catch'](handleError(_0x1aa0a0,null));};exports['download']=function(_0x36b111,_0xbacfe6){var _0x193bb9=moment()[_0x0cef('0xb0')]()['toString']();var _0x427dbb=path['join'](config[_0x0cef('0x77')],'server',_0x0cef('0xb1'),_0x0cef('0xb2'));var _0x425ffa=path['join'](config[_0x0cef('0x77')],_0x0cef('0xb3'),'files',_0x0cef('0xb4'));var _0x19b7f6=path['join'](_0x427dbb,_0x193bb9);var _0x21a79b=util['format'](_0x0cef('0xb5'),_0x36b111['params']['id'],_0x193bb9);var _0x984c70=path[_0x0cef('0x76')](_0x427dbb,_0x21a79b);var _0x2361d0=[];_0x2361d0[_0x0cef('0xa8')]({'model':db[_0x0cef('0x81')],'as':_0x0cef('0x81'),'attributes':['id',_0x0cef('0x51')],'raw':!![]});_0x2361d0['push']({'model':db[_0x0cef('0x64')],'as':_0x0cef('0x65'),'attributes':['id',_0x0cef('0xb6'),_0x0cef('0xb7')],'raw':!![]});if(_0x36b111['query'][_0x0cef('0xb4')]){_0x2361d0[_0x0cef('0xa8')]({'model':db['Attachment'],'as':_0x0cef('0x71'),'raw':!![]});}var _0x59a130=[{'model':db[_0x0cef('0x61')],'as':_0x0cef('0x80'),'attributes':['id','body',_0x0cef('0x8e'),_0x0cef('0x8f'),_0x0cef('0xa7'),_0x0cef('0xb8')],'include':_0x2361d0}];_0x59a130[_0x0cef('0xa8')]({'model':db[_0x0cef('0x4b')],'as':_0x0cef('0xb9'),'attributes':['id',_0x0cef('0x2a')]});_0x59a130[_0x0cef('0xa8')]({'model':db[_0x0cef('0x81')],'as':_0x0cef('0xba'),'attributes':['id',_0x0cef('0x51')]});return db['ChatInteraction']['find']({'where':{'id':_0x36b111[_0x0cef('0x3c')]['id']},'include':_0x59a130})['then'](handleEntityNotFound(_0xbacfe6,null))['then'](function(_0x160b66){if(_0x160b66){var _0x523ef8=_0x160b66[_0x0cef('0xbb')]({'plain':!![]});fs[_0x0cef('0xbc')](_0x19b7f6);var _0x4dc6e9={'channel':_0x0cef('0xbd'),'account':_0x523ef8[_0x0cef('0xb9')]['name'],'agent':_0x523ef8['Owner']?_0x523ef8[_0x0cef('0xba')][_0x0cef('0x51')]:_0x0cef('0xbe'),'createdAt':moment(_0x523ef8[_0x0cef('0x8e')])[_0x0cef('0x7c')](_0x0cef('0xbf'))[_0x0cef('0xc0')](),'closedAt':_0x523ef8[_0x0cef('0x6b')]?moment(_0x523ef8[_0x0cef('0xc1')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x523ef8[_0x0cef('0xc2')],'chatInfo':{'browser':_0x523ef8[_0x0cef('0xc3')],'os':_0x523ef8['osName'],'referer':_0x523ef8[_0x0cef('0xc4')],'customerIp':_0x523ef8[_0x0cef('0xc5')],'customerPort':_0x523ef8['customerPort']?_0x523ef8[_0x0cef('0xc6')]:_0x0cef('0xbe')},'messages':_(_0x523ef8[_0x0cef('0x80')])[_0x0cef('0xc7')]()['filter']({'secret':![]})[_0x0cef('0x31')](function(_0x24296a){if(_0x24296a[_0x0cef('0x71')]){var _0x5ea444=path[_0x0cef('0x76')](_0x425ffa,_0x24296a[_0x0cef('0x71')][_0x0cef('0x6f')]);if(fs['existsSync'](_0x5ea444)){fs[_0x0cef('0xc8')](_0x5ea444)[_0x0cef('0xc9')](fs[_0x0cef('0xca')](path[_0x0cef('0x76')](_0x19b7f6,_0x24296a[_0x0cef('0x71')][_0x0cef('0x6f')])));}}return{'date':moment(_0x24296a[_0x0cef('0x8e')])['format'](_0x0cef('0xbf'))['toString'](),'sender':_0x24296a[_0x0cef('0x8f')]==='out'?_0x24296a[_0x0cef('0x81')]?_0x24296a[_0x0cef('0x81')]['fullname']:_0x0cef('0x86'):_0x24296a[_0x0cef('0x65')]['firstName']+(_0x24296a[_0x0cef('0x65')]['lastName']?'\x20'+_0x24296a['Contact']['lastName']:''),'body':_0x24296a[_0x0cef('0x71')]?_0x24296a[_0x0cef('0x71')][_0x0cef('0x6f')]:_0x24296a[_0x0cef('0x49')],'direction':_0x24296a[_0x0cef('0x8f')]===_0x0cef('0x60')?'A':'C','secret':_0x24296a[_0x0cef('0xa7')],'read':_0x24296a[_0x0cef('0xb8')],'attachment':_0x24296a[_0x0cef('0x71')]};})[_0x0cef('0xcb')]()};return ejs[_0x0cef('0xcc')](path['join'](config[_0x0cef('0x77')],_0x0cef('0xb3'),_0x0cef('0xcd'),_0x0cef('0xce')),{'interaction':_0x4dc6e9})[_0x0cef('0x29')](function(_0x5eace9){var _0x4b4598=path[_0x0cef('0x76')](_0x19b7f6,_0x0cef('0xcf')+_0x523ef8['id']+'-'+_0x193bb9+_0x0cef('0xd0'));var _0x51af19={'path':_0x4b4598,'channel':'Chat','interactionId':_0x523ef8['id']};return pdf[_0x0cef('0xd1')](_0x5eace9,_0x51af19);})['then'](function(){return new Promise(function(_0x1e375e,_0x1ccb4c){zipdir(_0x19b7f6,{'saveTo':_0x984c70},function(_0x367f2c,_0x1c98c1){if(_0x367f2c)return _0x1ccb4c(_0x367f2c);return _0x1e375e(_0x1c98c1);});})[_0x0cef('0x29')](function(){return new BPromise(function(_0x2947b5,_0x2ac9ef){rimraf(_0x19b7f6,function(_0x17a6d8){if(_0x17a6d8)_0x2ac9ef(_0x17a6d8);return _0x2947b5();});});})[_0x0cef('0x29')](function(){return _0xbacfe6['download'](_0x984c70,_0x21a79b,function(_0x17d712){if(_0x17d712){logger[_0x0cef('0x19')](_0x0cef('0xd2'),_0x17d712);}else{fs[_0x0cef('0xd3')](_0x984c70);}});});});}else{return _0xbacfe6[_0x0cef('0x1e')](0xc8);}})['catch'](handleError(_0xbacfe6,null));}; \ No newline at end of file +var _0xfd1c=['result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','index','map','rawAttributes','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','ChatInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','UserId','%s%d','System','customer','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','sort','includeAgent','push','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x28e32c,_0x33fe75){var _0x17d631=function(_0xc41bb4){while(--_0xc41bb4){_0x28e32c['push'](_0x28e32c['shift']());}};_0x17d631(++_0x33fe75);}(_0xfd1c,0xb4));var _0xcfd1=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xfd1c[_0x39a04c];return _0x580cb0;};'use strict';var rimraf=require(_0xcfd1('0x0'));var zipdir=require(_0xcfd1('0x1'));var rp=require(_0xcfd1('0x2'));var moment=require(_0xcfd1('0x3'));var BPromise=require(_0xcfd1('0x4'));var Mustache=require('mustache');var util=require(_0xcfd1('0x5'));var path=require('path');var ejs=require(_0xcfd1('0x6'));var fs=require('fs');var _=require(_0xcfd1('0x7'));var Redis=require(_0xcfd1('0x8'));var interaction=require(_0xcfd1('0x9'));var qs=require(_0xcfd1('0xa'));var pdf=require(_0xcfd1('0xb'));var logger=require(_0xcfd1('0xc'))('api');var config=require(_0xcfd1('0xd'));var db=require(_0xcfd1('0xe'))['db'];config[_0xcfd1('0xf')]=_[_0xcfd1('0x10')](config[_0xcfd1('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfd1('0xf')]));require(_0xcfd1('0x11'))[_0xcfd1('0x12')](socket);var jayson=require(_0xcfd1('0x13'));var client=jayson[_0xcfd1('0x14')][_0xcfd1('0x15')]({'port':0x232b});var client9004=jayson[_0xcfd1('0x14')][_0xcfd1('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x18b57f,_0x2374ff,_0x49bf54,_0x45ca98){return new BPromise(function(_0x26e097,_0x581c5a){var _0x44ab9e=_0x45ca98||client;return _0x44ab9e[_0xcfd1('0x16')](_0x18b57f,_0x49bf54)[_0xcfd1('0x17')](function(_0x265b91){logger[_0xcfd1('0x18')](_0xcfd1('0x19'),_0x2374ff,_0xcfd1('0x1a'));logger[_0xcfd1('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2374ff,_0xcfd1('0x1a'),JSON['stringify'](_0x265b91));if(_0x265b91[_0xcfd1('0x1c')]){if(_0x265b91['error'][_0xcfd1('0x1d')]===0x1f4){logger[_0xcfd1('0x1c')](_0xcfd1('0x19'),_0x2374ff,_0x265b91[_0xcfd1('0x1c')][_0xcfd1('0x1e')]);return _0x581c5a(_0x265b91['error'][_0xcfd1('0x1e')]);}logger[_0xcfd1('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x2374ff,_0x265b91[_0xcfd1('0x1c')][_0xcfd1('0x1e')]);return _0x26e097(_0x265b91[_0xcfd1('0x1c')][_0xcfd1('0x1e')]);}else{logger['info'](_0xcfd1('0x19'),_0x2374ff,_0xcfd1('0x1a'));_0x26e097(_0x265b91[_0xcfd1('0x1f')]['message']);}})[_0xcfd1('0x20')](function(_0x5df472){logger[_0xcfd1('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x2374ff,_0x5df472);_0x581c5a(_0x5df472);});});}function respondWithStatusCode(_0x43f734,_0x14738e){_0x14738e=_0x14738e||0xcc;return function(_0xc57912){if(_0xc57912){return _0x43f734[_0xcfd1('0x21')](_0x14738e);}return _0x43f734['status'](_0x14738e)[_0xcfd1('0x22')]();};}function respondWithResult(_0xec2e61,_0x2a8852){_0x2a8852=_0x2a8852||0xc8;return function(_0x4463dc){if(_0x4463dc){return _0xec2e61[_0xcfd1('0x23')](_0x2a8852)[_0xcfd1('0x24')](_0x4463dc);}};}function respondWithFilteredResult(_0x189860,_0xb049d2){return function(_0x1fea49){if(_0x1fea49){var _0x3a43eb=typeof _0xb049d2[_0xcfd1('0x25')]===_0xcfd1('0x26')&&typeof _0xb049d2[_0xcfd1('0x27')]===_0xcfd1('0x26');var _0x2de5c0=_0x1fea49[_0xcfd1('0x28')];var _0x1c0b21=_0x3a43eb?0x0:_0xb049d2[_0xcfd1('0x25')];var _0x159c7d=_0x3a43eb?_0x1fea49[_0xcfd1('0x28')]:_0xb049d2[_0xcfd1('0x25')]+_0xb049d2[_0xcfd1('0x27')];var _0x4964ff;if(_0x159c7d>=_0x2de5c0){_0x159c7d=_0x2de5c0;_0x4964ff=0xc8;}else{_0x4964ff=0xce;}_0x189860[_0xcfd1('0x23')](_0x4964ff);return _0x189860[_0xcfd1('0x29')](_0xcfd1('0x2a'),_0x1c0b21+'-'+_0x159c7d+'/'+_0x2de5c0)[_0xcfd1('0x24')](_0x1fea49);}return null;};}function saveUpdates(_0x154534){return function(_0x45107d){if(_0x45107d){return _0x45107d[_0xcfd1('0x2b')](_0x154534)[_0xcfd1('0x17')](function(_0x355b77){return _0x355b77;});}return null;};}function removeEntity(_0x21dd45){return function(_0x13740){if(_0x13740){return _0x13740[_0xcfd1('0x2c')]()[_0xcfd1('0x17')](function(){_0x21dd45['status'](0xcc)[_0xcfd1('0x22')]();});}};}function handleEntityNotFound(_0x1c6e37){return function(_0x34d7c1){if(!_0x34d7c1){_0x1c6e37['sendStatus'](0x194);}return _0x34d7c1;};}function handleError(_0x3fc990,_0x24a8b8){_0x24a8b8=_0x24a8b8||0x1f4;return function(_0x859981){logger[_0xcfd1('0x1c')](_0x859981[_0xcfd1('0x2d')]);if(_0x859981[_0xcfd1('0x2e')]){delete _0x859981[_0xcfd1('0x2e')];}_0x3fc990[_0xcfd1('0x23')](_0x24a8b8)['send'](_0x859981);};}function getMustacheRender(_0x511344,_0x432122){return Mustache[_0xcfd1('0x2f')](_0x511344,_[_0xcfd1('0x30')](_0x432122[_0xcfd1('0x31')],{'contact':_0x432122[_0xcfd1('0x32')],'message':_0x432122[_0xcfd1('0x1e')],'agent':_0x432122[_0xcfd1('0x33')],'interaction':_0x432122['interaction'],'account':_0x432122['account']}))||'';}exports[_0xcfd1('0x34')]=function(_0x2f4ba1,_0x490898){var _0x28efd4={};var _0x365e74=_[_0xcfd1('0x35')](db['ChatInteraction'][_0xcfd1('0x36')],function(_0x15e7ce){return{'name':_0x15e7ce['fieldName'],'type':_0x15e7ce[_0xcfd1('0x37')][_0xcfd1('0x38')]};});_0x28efd4=qs[_0xcfd1('0x39')](_0x365e74,_0x2f4ba1);return interaction[_0xcfd1('0x3a')](_0xcfd1('0x3b'),_0x2f4ba1[_0xcfd1('0x3c')],_0x2f4ba1[_0xcfd1('0x3d')],_0x28efd4,_0x365e74)[_0xcfd1('0x17')](respondWithFilteredResult(_0x490898,_0x28efd4))['catch'](handleError(_0x490898,null));};exports[_0xcfd1('0x3e')]=function(_0x2c35ae,_0x4508e4){var _0x3c2d00={'raw':![],'where':{'id':_0x2c35ae[_0xcfd1('0x3f')]['id']}},_0x665a3e={};_0x665a3e[_0xcfd1('0x40')]=_[_0xcfd1('0x41')](db[_0xcfd1('0x42')][_0xcfd1('0x36')]);_0x665a3e[_0xcfd1('0x3c')]=_[_0xcfd1('0x41')](_0x2c35ae[_0xcfd1('0x3c')]);_0x665a3e[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x665a3e['model'],_0x665a3e[_0xcfd1('0x3c')]);_0x3c2d00[_0xcfd1('0x45')]=_['intersection'](_0x665a3e['model'],qs[_0xcfd1('0x46')](_0x2c35ae[_0xcfd1('0x3c')]['fields']));_0x3c2d00['attributes']=_0x3c2d00['attributes'][_0xcfd1('0x47')]?_0x3c2d00[_0xcfd1('0x45')]:_0x665a3e[_0xcfd1('0x40')];if(_0x2c35ae[_0xcfd1('0x3c')][_0xcfd1('0x48')]){_0x3c2d00[_0xcfd1('0x49')]=[{'all':!![]}];}_0x3c2d00=_[_0xcfd1('0x30')]({},_0x3c2d00,_0x2c35ae[_0xcfd1('0x4a')]);return db[_0xcfd1('0x42')]['find'](_0x3c2d00)['then'](handleEntityNotFound(_0x4508e4,null))[_0xcfd1('0x17')](respondWithResult(_0x4508e4,null))[_0xcfd1('0x20')](handleError(_0x4508e4,null));};exports[_0xcfd1('0x4b')]=function(_0x11b4f6,_0x30274c){return db[_0xcfd1('0x42')][_0xcfd1('0x4b')](_0x11b4f6[_0xcfd1('0x31')],{})[_0xcfd1('0x17')](respondWithResult(_0x30274c,0xc9))[_0xcfd1('0x20')](handleError(_0x30274c,null));};exports[_0xcfd1('0x2b')]=function(_0x33b961,_0x3a59a7){if(_0x33b961[_0xcfd1('0x31')]['id']){delete _0x33b961[_0xcfd1('0x31')]['id'];}return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x33b961[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x3a59a7,null))[_0xcfd1('0x17')](saveUpdates(_0x33b961['body'],null))[_0xcfd1('0x17')](respondWithResult(_0x3a59a7,null))[_0xcfd1('0x20')](handleError(_0x3a59a7,null));};exports['destroy']=function(_0x4c7af9,_0x54aebb){return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x4c7af9[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x54aebb,null))[_0xcfd1('0x17')](removeEntity(_0x54aebb,null))['catch'](handleError(_0x54aebb,null));};exports[_0xcfd1('0x4d')]=function(_0x58d248,_0x377646){return db[_0xcfd1('0x42')][_0xcfd1('0x4d')]()['then'](respondWithResult(_0x377646,null))[_0xcfd1('0x20')](handleError(_0x377646,null));};exports[_0xcfd1('0x4e')]=function(_0x3a2110,_0x39869d){var _0x2d571e=_0x3a2110[_0xcfd1('0x3f')]['id'];var _0x1d2afc;var _0x57123c;var _0x532c3d;return db[_0xcfd1('0x42')][_0xcfd1('0x4f')]({'where':{'id':_0x2d571e}})[_0xcfd1('0x17')](function(_0x40e929){_0x1d2afc=_0x40e929;return db[_0xcfd1('0x50')][_0xcfd1('0x4f')]({'where':{'id':_0x40e929[_0xcfd1('0x51')]},'attributes':['id','vidaooApiKey',_0xcfd1('0x52'),_0xcfd1('0x53'),_0xcfd1('0x54'),_0xcfd1('0x55')],'raw':!![]});})[_0xcfd1('0x17')](function(_0x2dbe9d){if(_0x2dbe9d&&_0x2dbe9d[_0xcfd1('0x56')]&&_0x2dbe9d['vidaooEscalation']){_0x57123c=_0x2dbe9d;var _0x2098b7={'interaction':{'id':_0x2d571e},'agent':{'id':_0x3a2110[_0xcfd1('0x3d')]['id'],'name':_0x3a2110[_0xcfd1('0x3d')][_0xcfd1('0x2e')],'fullname':_0x3a2110[_0xcfd1('0x3d')][_0xcfd1('0x57')],'email':_0x3a2110[_0xcfd1('0x3d')]['email']},'contact':_0x3a2110[_0xcfd1('0x31')][_0xcfd1('0x32')],'account':_0x3a2110[_0xcfd1('0x31')]['account']};var _0x3e41d7={'rejectUnauthorized':![],'method':_0xcfd1('0x58'),'url':_0xcfd1('0x59'),'headers':{'X-APIKEY':_0x2dbe9d[_0xcfd1('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3a2110[_0xcfd1('0x3d')]['email']],'buttons':null,'topic':_0x57123c[_0xcfd1('0x53')],'note':_['isNull'](_0x57123c[_0xcfd1('0x54')])?null:getMustacheRender(_0x57123c[_0xcfd1('0x54')],_0x2098b7),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xcfd1('0x5a')](_0x57123c[_0xcfd1('0x55')])){var _0x54d513=getMustacheRender(_0x57123c[_0xcfd1('0x55')],_0x2098b7);var _0x2cd245=JSON[_0xcfd1('0x5b')](_0x54d513);_0x3e41d7['body'][_0xcfd1('0x5c')]=_0x2cd245;}}catch(_0x21f3d2){throw new db[(_0xcfd1('0x5d'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3e41d7);}else{throw new db[(_0xcfd1('0x5d'))]['ValidationError'](_0xcfd1('0x5e'));}})[_0xcfd1('0x17')](function(_0x3c9f23){_0x532c3d=_0x3c9f23;if(_0x532c3d['id']){var _0x33b0d0={'body':_0x532c3d[_0xcfd1('0x5f')],'ChatWebsiteId':_0x57123c['id'],'ChatInteractionId':_0x1d2afc['id'],'direction':_0xcfd1('0x60'),'UserId':_0x3a2110[_0xcfd1('0x3d')]['id']};return db[_0xcfd1('0x61')][_0xcfd1('0x4b')](_0x33b0d0,{});}else{throw new db[(_0xcfd1('0x5d'))][(_0xcfd1('0x62'))](_0xcfd1('0x63'));}})['then'](function(){return _0x1d2afc[_0xcfd1('0x64')]({'vidaooSessionId':_0x532c3d['id']});})['then'](respondWithResult(_0x39869d,null))[_0xcfd1('0x20')](handleError(_0x39869d,null));};exports['customUpdate']=function(_0x430d5d,_0x39f857){if(_0x430d5d[_0xcfd1('0x31')]['id']){delete _0x430d5d['body']['id'];}return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x430d5d[_0xcfd1('0x3f')]['id']},'include':[{'model':db[_0xcfd1('0x65')],'as':_0xcfd1('0x66')}]})[_0xcfd1('0x17')](handleEntityNotFound(_0x39f857,null))[_0xcfd1('0x17')](saveUpdates(_0x430d5d[_0xcfd1('0x31')],null))[_0xcfd1('0x17')](respondWithResult(_0x39f857,null))['catch'](handleError(_0x39f857,null));};exports[_0xcfd1('0x67')]=function(_0x5ac6d3,_0x46eb82){if(_0x5ac6d3[_0xcfd1('0x31')]['id']){delete _0x5ac6d3['body']['id'];}return db['ChatInteraction'][_0xcfd1('0x4c')]({'where':{'id':_0x5ac6d3[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](function(_0x3c392c){if(!_0x3c392c){logger['error'](_0xcfd1('0x68'),'abandon',0x194,_0xcfd1('0x69'));_0x46eb82[_0xcfd1('0x21')](0x194);}else{if(_0x3c392c['UserId']){throw new db[(_0xcfd1('0x5d'))][(_0xcfd1('0x62'))](_0xcfd1('0x6a'));}}return _0x3c392c;})[_0xcfd1('0x17')](function(_0x32738f){if(_0x32738f){return _0x32738f[_0xcfd1('0x2b')]({'closed':_0x5ac6d3[_0xcfd1('0x31')]['closed'],'disposition':_0x5ac6d3[_0xcfd1('0x31')][_0xcfd1('0x6b')]})[_0xcfd1('0x17')](function(_0x1f467c){return _0x1f467c;});}})[_0xcfd1('0x17')](function(){return respondWithRpcPromise(_0xcfd1('0x6c'),_0xcfd1('0x67'),_0x5ac6d3['body'],client9004);})[_0xcfd1('0x17')](respondWithResult(_0x46eb82,null))[_0xcfd1('0x20')](handleError(_0x46eb82,null));};exports[_0xcfd1('0x6d')]=function(_0xa6960b,_0x21da91){_0xa6960b[_0xcfd1('0x31')]['name']=_0xa6960b[_0xcfd1('0x6e')][_0xcfd1('0x6f')];_0xa6960b[_0xcfd1('0x31')][_0xcfd1('0x70')]=_0xa6960b['file'][_0xcfd1('0x71')];_0xa6960b[_0xcfd1('0x31')][_0xcfd1('0x37')]=_0xa6960b[_0xcfd1('0x6e')][_0xcfd1('0x72')];return db[_0xcfd1('0x73')][_0xcfd1('0x4b')](_0xa6960b[_0xcfd1('0x31')])[_0xcfd1('0x17')](respondWithResult(_0x21da91,0xc9))['catch'](handleError(_0x21da91,null));};exports[_0xcfd1('0x74')]=function(_0x511568,_0x157382){return db[_0xcfd1('0x42')]['findOne']({'where':{'id':_0x511568[_0xcfd1('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x157382,null))['then'](function(_0x22be54){if(_0x22be54){if(_0x22be54[_0xcfd1('0x75')]){return _0x157382[_0xcfd1('0x23')](0x193)[_0xcfd1('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xcfd1('0x73')]['findOne']({'where':{'id':_0x511568['query'][_0xcfd1('0x76')]},'raw':!![]})['then'](handleEntityNotFound(_0x157382,null));}})['then'](function(_0x3dde84){if(_0x3dde84){var _0x40b7b5=_0x3dde84['ChatOfflineMessageId']!==null;var _0x45f045=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0x79'));if(_0x40b7b5){_0x45f045=path['join'](_0x45f045,_0xcfd1('0x7a'));}var _0x134eca=path[_0xcfd1('0x77')](_0x45f045,_0x3dde84[_0xcfd1('0x70')]);return _0x157382[_0xcfd1('0x7b')](_0x134eca);}})[_0xcfd1('0x20')](handleError(_0x157382,null));};exports[_0xcfd1('0x7c')]=function(_0x9ac1e1,_0x2a5fec){var _0x45badc=null;var _0x45f656=null;var _0x348145=null;if(_0x9ac1e1['body']['id']){delete _0x9ac1e1['body']['id'];}if(_0x9ac1e1[_0xcfd1('0x31')][_0xcfd1('0x7d')]){_0x348145=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0x7e'),util[_0xcfd1('0x7f')](_0xcfd1('0x80'),Date[_0xcfd1('0x81')]()));_0x9ac1e1['body'][_0xcfd1('0x82')]=_0x348145;}return db['ChatInteraction'][_0xcfd1('0x4c')]({'where':{'id':_0x9ac1e1[_0xcfd1('0x3f')]['id']},'include':[{'model':db[_0xcfd1('0x61')],'as':'Messages','include':[{'model':db[_0xcfd1('0x83')],'as':_0xcfd1('0x83')}]}]})[_0xcfd1('0x17')](handleEntityNotFound(_0x2a5fec,null))[_0xcfd1('0x17')](saveUpdates(_0x9ac1e1[_0xcfd1('0x31')],null))['then'](function(_0x45cb24){if(_0x45cb24){_0x45badc=_0x45cb24;return db['ChatWebsite']['find']({'where':{'id':_0x45badc[_0xcfd1('0x51')]}});}})[_0xcfd1('0x17')](function(_0xc6b764){if(_0xc6b764){_0x45f656=_0xc6b764;return db['CmContact'][_0xcfd1('0x4c')]({'where':{'id':_0x45badc[_0xcfd1('0x84')]}});}})[_0xcfd1('0x17')](function(_0x43351f){if(_0x43351f){if(_0x348145){var _0x3e44cd=null;for(var _0x1f07c3=0x1;_0x1f07c3<_0x45badc['Messages']['length'];++_0x1f07c3){_0x3e44cd=_0x45badc[_0xcfd1('0x85')][_0x1f07c3];var _0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?util[_0xcfd1('0x7f')](_0xcfd1('0x87'),_0x45f656['agentAlias'],_0x3e44cd['UserId']):_0xcfd1('0x88');var _0x543d14=_0x9ac1e1[_0xcfd1('0x31')][_0xcfd1('0x89')]||util['format']('%s%d','Visitor',_0x3e44cd['ContactId']);switch(_0x45f656['agentIdentifier']){case _0xcfd1('0x8a'):_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?util[_0xcfd1('0x7f')](_0xcfd1('0x87'),_0x45f656[_0xcfd1('0x8b')],_0x3e44cd[_0xcfd1('0x86')]):_0xcfd1('0x88');break;case _0xcfd1('0x8c'):_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?_0x3e44cd[_0xcfd1('0x83')][_0xcfd1('0x8d')]||_0x3e44cd[_0xcfd1('0x83')]['fullname']:_0xcfd1('0x88');break;case _0xcfd1('0x8e'):_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?_0x3e44cd[_0xcfd1('0x83')][_0xcfd1('0x57')]:_0xcfd1('0x88');break;default:_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?util['format']('%s%d',_0x45f656[_0xcfd1('0x8b')],_0x3e44cd[_0xcfd1('0x86')]):_0xcfd1('0x88');}var _0x59bebd=util[_0xcfd1('0x7f')](_0xcfd1('0x8f'),moment(_0x3e44cd[_0xcfd1('0x90')])[_0xcfd1('0x7f')](_0xcfd1('0x91')),_0x3e44cd[_0xcfd1('0x92')]==='in'?_0x543d14:_0x12c2c0,_0x3e44cd['body']);if(!_0x3e44cd[_0xcfd1('0x93')]){fs[_0xcfd1('0x94')](_0x348145,_0x59bebd);}}return db[_0xcfd1('0x95')][_0xcfd1('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0xcfd1('0x96')],'as':_0xcfd1('0x97'),'raw':!![],'include':[{'model':db[_0xcfd1('0x98')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x41240b){if(!_0x41240b||!_0x41240b[_0xcfd1('0x97')]||!_0x9ac1e1['body'])return _0x45badc;var _0x457d03=_0x41240b[_0xcfd1('0x99')]();return respondWithRpcPromise(_0xcfd1('0x9a'),_0xcfd1('0x9b'),{'account':_0x457d03,'message':{'from':util[_0xcfd1('0x7f')](_0xcfd1('0x9c'),_0x41240b[_0xcfd1('0x2e')],_0x41240b[_0xcfd1('0x9d')]||_0x41240b[_0xcfd1('0x97')][_0xcfd1('0x3d')]),'to':_0x9ac1e1[_0xcfd1('0x31')][_0xcfd1('0x7d')],'subject':_0xcfd1('0x9e'),'text':util['format'](_0xcfd1('0x9f'),_0x9ac1e1[_0xcfd1('0x31')]['mailTranscript']),'attachments':[{'path':_0x348145}]}})['then'](function(){return _0x45badc;})[_0xcfd1('0x20')](function(_0x2214f9){logger['error'](_0x2214f9);});})[_0xcfd1('0x17')](respondWithStatusCode(_0x2a5fec,0xc8))[_0xcfd1('0x20')](handleError(_0x2a5fec,null));};exports[_0xcfd1('0xa0')]=function(_0x36bea8,_0x44cb76){return db[_0xcfd1('0x61')]['find']({'where':{'id':_0x36bea8[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x44cb76,null))['then'](function(_0x18318f){if(_0x18318f){return _0x18318f['addMessage'](_0x36bea8[_0xcfd1('0x31')][_0xcfd1('0xa1')],_[_0xcfd1('0xa2')](_0x36bea8[_0xcfd1('0x31')],[_0xcfd1('0xa1'),'id'])||{});}})[_0xcfd1('0x17')](respondWithResult(_0x44cb76,null))[_0xcfd1('0x20')](handleError(_0x44cb76,null));};exports[_0xcfd1('0xa3')]=function(_0x58a2b0,_0x3df92e){var _0x310a90={'raw':![],'where':{}};var _0x14a192={};var _0x761217={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xcfd1('0x4f')]({'where':{'id':_0x58a2b0[_0xcfd1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3df92e,null))[_0xcfd1('0x17')](function(_0x14c1a6){if(_0x14c1a6){_0x14a192[_0xcfd1('0x40')]=_[_0xcfd1('0x41')](db['ChatMessage'][_0xcfd1('0x36')]);_0x14a192[_0xcfd1('0x3c')]=_[_0xcfd1('0x41')](_0x58a2b0[_0xcfd1('0x3c')]);_0x14a192[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x14a192[_0xcfd1('0x40')],_0x14a192[_0xcfd1('0x3c')]);_0x310a90[_0xcfd1('0x45')]=_['intersection'](_0x14a192[_0xcfd1('0x40')],qs[_0xcfd1('0x46')](_0x58a2b0['query'][_0xcfd1('0x46')]));_0x310a90['attributes']=_0x310a90[_0xcfd1('0x45')]['length']?_0x310a90[_0xcfd1('0x45')]:_0x14a192[_0xcfd1('0x40')];if(!_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0xa4')](_0xcfd1('0xa5'))){_0x310a90[_0xcfd1('0x27')]=qs[_0xcfd1('0x27')](_0x58a2b0['query'][_0xcfd1('0x27')]);_0x310a90['offset']=qs[_0xcfd1('0x25')](_0x58a2b0[_0xcfd1('0x3c')]['offset']);}_0x310a90[_0xcfd1('0xa6')]=qs['sort'](_0x58a2b0['query']['sort']);_0x310a90[_0xcfd1('0xa7')]=qs[_0xcfd1('0x43')](_[_0xcfd1('0xa8')](_0x58a2b0[_0xcfd1('0x3c')],_0x14a192['filters']));_0x310a90[_0xcfd1('0xa7')][_0xcfd1('0xa9')]=_0x14c1a6['id'];if(_0x58a2b0['query'][_0xcfd1('0xaa')]){_0x310a90[_0xcfd1('0xa7')]=_['merge'](_0x310a90[_0xcfd1('0xa7')],{'$or':_[_0xcfd1('0x35')](_0x310a90[_0xcfd1('0x45')],function(_0x14fefe){var _0x3df1ff={};_0x3df1ff[_0x14fefe]={'$like':'%'+_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0xaa')]+'%'};return _0x3df1ff;})});}if(_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0xab')]){var _0x55ba18=_0x58a2b0['query'][_0xcfd1('0xab')]['split'](',');var _0x1b5b90={};_0x1b5b90[_0x55ba18[0x0]]={'$gte':moment(_0x55ba18[0x1])['format'](_0xcfd1('0xac'))};_0x310a90[_0xcfd1('0xa7')]=_[_0xcfd1('0x30')](_0x310a90['where'],_0x1b5b90);}_0x310a90=_[_0xcfd1('0x30')]({},_0x310a90,_0x58a2b0['options']);return db[_0xcfd1('0x61')][_0xcfd1('0x28')]({'where':_0x310a90[_0xcfd1('0xa7')]})['then'](function(_0x574aa8){_0x761217[_0xcfd1('0x28')]=_0x574aa8;if(_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0x48')]){_0x310a90[_0xcfd1('0x49')]=[{'all':!![]}];}return db[_0xcfd1('0x61')][_0xcfd1('0x3a')](_0x310a90);})[_0xcfd1('0x17')](function(_0x265115){_0x761217[_0xcfd1('0xad')]=_0x265115;return _0x761217;});}})['then'](respondWithFilteredResult(_0x3df92e,_0x310a90))[_0xcfd1('0x20')](handleError(_0x3df92e,null));};exports['getMyMessages']=function(_0x3beedb,_0x5258d7){var _0x141c67={'where':{}},_0x188d3f={},_0x4abd00={'count':0x0,'rows':[]};return db[_0xcfd1('0x42')][_0xcfd1('0x4f')]({'where':{'id':_0x3beedb['params']['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x5258d7,null))[_0xcfd1('0x17')](function(_0x355ddb){if(_0x355ddb){_0x188d3f[_0xcfd1('0x40')]=_[_0xcfd1('0x41')](db['ChatMessage'][_0xcfd1('0x36')]);_0x188d3f[_0xcfd1('0x3c')]=_[_0xcfd1('0x41')](_0x3beedb[_0xcfd1('0x3c')]);_0x188d3f[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x188d3f[_0xcfd1('0x40')],_0x188d3f[_0xcfd1('0x3c')]);_0x141c67[_0xcfd1('0x45')]=_[_0xcfd1('0x44')](_0x188d3f[_0xcfd1('0x40')],qs[_0xcfd1('0x46')](_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x46')]));_0x141c67['attributes']=_0x141c67[_0xcfd1('0x45')][_0xcfd1('0x47')]?_0x141c67['attributes']:_0x188d3f[_0xcfd1('0x40')];if(!_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0xa4')]('nolimit')){_0x141c67[_0xcfd1('0x27')]=qs['limit'](_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x27')]);_0x141c67[_0xcfd1('0x25')]=qs[_0xcfd1('0x25')](_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x25')]);}_0x141c67['order']=qs[_0xcfd1('0xae')](_0x3beedb[_0xcfd1('0x3c')]['sort']);_0x141c67[_0xcfd1('0xa7')]=qs[_0xcfd1('0x43')](_[_0xcfd1('0xa8')](_0x3beedb['query'],_0x188d3f[_0xcfd1('0x43')]));_0x141c67[_0xcfd1('0xa7')][_0xcfd1('0xa9')]=_0x355ddb['id'];if(_0x3beedb[_0xcfd1('0x3c')]['filter']){_0x141c67[_0xcfd1('0xa7')]=_[_0xcfd1('0x30')](_0x141c67[_0xcfd1('0xa7')],{'$or':_[_0xcfd1('0x35')](_0x141c67[_0xcfd1('0x45')],function(_0x408118){var _0x31f07d={};_0x31f07d[_0x408118]={'$like':'%'+_0x3beedb['query'][_0xcfd1('0xaa')]+'%'};return _0x31f07d;})});}_0x141c67[_0xcfd1('0xa7')][_0xcfd1('0x93')]=![];if(_0x3beedb[_0xcfd1('0x3c')]['id']){_0x141c67[_0xcfd1('0xa7')]['id']={'$gt':_0x3beedb['query']['id']};}_0x141c67=_[_0xcfd1('0x30')]({},_0x141c67,_0x3beedb['options']);return db[_0xcfd1('0x61')][_0xcfd1('0x28')]({'where':_0x141c67[_0xcfd1('0xa7')]})[_0xcfd1('0x17')](function(_0xfd70fa){_0x4abd00[_0xcfd1('0x28')]=_0xfd70fa;_0x141c67['include']=[];if(_0x3beedb['query'][_0xcfd1('0xaf')]){_0x141c67[_0xcfd1('0x49')][_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x83')],'as':_0xcfd1('0x83'),'attributes':['id',_0xcfd1('0x57'),_0xcfd1('0x8d')]});}if(_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x48')]){_0x141c67[_0xcfd1('0x49')]=[{'all':!![]}];}return db[_0xcfd1('0x61')][_0xcfd1('0x3a')](_0x141c67);})[_0xcfd1('0x17')](function(_0x44a7b0){_0x4abd00[_0xcfd1('0xad')]=_0x44a7b0;return _0x4abd00;});}})[_0xcfd1('0x17')](respondWithFilteredResult(_0x5258d7,_0x141c67))[_0xcfd1('0x20')](handleError(_0x5258d7,null));};exports['addTags']=function(_0xc653fd,_0x89d1c1){return db[_0xcfd1('0x42')]['find']({'where':{'id':_0xc653fd[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x89d1c1,null))[_0xcfd1('0x17')](function(_0x52aa1f){if(_0x52aa1f){return _0x52aa1f[_0xcfd1('0xb1')](_0xc653fd[_0xcfd1('0x31')][_0xcfd1('0xa1')],_[_0xcfd1('0xa2')](_0xc653fd[_0xcfd1('0x31')],[_0xcfd1('0xa1'),'id'])||{})[_0xcfd1('0xb2')](function(){return db[_0xcfd1('0xb3')][_0xcfd1('0x3a')]({'attributes':['id','name','color'],'where':{'id':_0xc653fd['body'][_0xcfd1('0xa1')]}});})['then'](function(_0x3aa651){socket['emit'](_0xcfd1('0xb4'),{'id':Number(_0xc653fd[_0xcfd1('0x3f')]['id']),'tags':_0x3aa651||[]});return{'id':Number(_0xc653fd[_0xcfd1('0x3f')]['id']),'tags':_0x3aa651||[]};});}})['then'](respondWithResult(_0x89d1c1,null))['catch'](handleError(_0x89d1c1,null));};exports[_0xcfd1('0xb5')]=function(_0x82e6a3,_0x4d105){return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x82e6a3[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x4d105,null))[_0xcfd1('0x17')](function(_0x52751b){if(_0x52751b){return _0x52751b[_0xcfd1('0xb5')](_0x82e6a3['query'][_0xcfd1('0xa1')]);}})['then'](respondWithStatusCode(_0x4d105,null))[_0xcfd1('0x20')](handleError(_0x4d105,null));};exports[_0xcfd1('0x7b')]=function(_0x3e6f82,_0x25a460){var _0x3fef40=moment()[_0xcfd1('0xb6')]()[_0xcfd1('0xb7')]();var _0x376f0f=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0xb8'),_0xcfd1('0xb9'),_0xcfd1('0xba'));var _0xdd4612=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0xb8'),'files',_0xcfd1('0xbb'));var _0x5d7518=path[_0xcfd1('0x77')](_0x376f0f,_0x3fef40);var _0x524729=util[_0xcfd1('0x7f')](_0xcfd1('0xbc'),_0x3e6f82[_0xcfd1('0x3f')]['id'],_0x3fef40);var _0x5ae5b9=path[_0xcfd1('0x77')](_0x376f0f,_0x524729);var _0x464184=[];_0x464184['push']({'model':db[_0xcfd1('0x83')],'as':_0xcfd1('0x83'),'attributes':['id',_0xcfd1('0x57')],'raw':!![]});_0x464184[_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x65')],'as':_0xcfd1('0x66'),'attributes':['id',_0xcfd1('0xbd'),_0xcfd1('0xbe')],'raw':!![]});if(_0x3e6f82['query'][_0xcfd1('0xbb')]){_0x464184[_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x73')],'as':_0xcfd1('0x73'),'raw':!![]});}var _0x5542f4=[{'model':db[_0xcfd1('0x61')],'as':'Messages','attributes':['id',_0xcfd1('0x31'),_0xcfd1('0x90'),_0xcfd1('0x92'),'secret',_0xcfd1('0xbf')],'include':_0x464184}];_0x5542f4[_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x50')],'as':_0xcfd1('0xc0'),'attributes':['id',_0xcfd1('0x2e')]});_0x5542f4[_0xcfd1('0xb0')]({'model':db['User'],'as':_0xcfd1('0xc1'),'attributes':['id',_0xcfd1('0x57')]});return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x3e6f82['params']['id']},'include':_0x5542f4})[_0xcfd1('0x17')](handleEntityNotFound(_0x25a460,null))[_0xcfd1('0x17')](function(_0x15d30f){if(_0x15d30f){var _0x4fa0b0=_0x15d30f[_0xcfd1('0xc2')]({'plain':!![]});fs['mkdirSync'](_0x5d7518);var _0x4e8b24={'channel':_0xcfd1('0xc3'),'account':_0x4fa0b0[_0xcfd1('0xc0')]['name'],'agent':_0x4fa0b0['Owner']?_0x4fa0b0[_0xcfd1('0xc1')][_0xcfd1('0x57')]:_0xcfd1('0xc4'),'createdAt':moment(_0x4fa0b0[_0xcfd1('0x90')])[_0xcfd1('0x7f')](_0xcfd1('0xac'))[_0xcfd1('0xb7')](),'closedAt':_0x4fa0b0[_0xcfd1('0x75')]?moment(_0x4fa0b0[_0xcfd1('0xc5')])[_0xcfd1('0x7f')](_0xcfd1('0xac'))[_0xcfd1('0xb7')]():'','disposition':_0x4fa0b0[_0xcfd1('0x6b')],'chatInfo':{'browser':_0x4fa0b0[_0xcfd1('0xc6')],'os':_0x4fa0b0[_0xcfd1('0xc7')],'referer':_0x4fa0b0[_0xcfd1('0xc8')],'customerIp':_0x4fa0b0[_0xcfd1('0xc9')],'customerPort':_0x4fa0b0['customerPort']?_0x4fa0b0['customerPort']:_0xcfd1('0xc4')},'messages':_(_0x4fa0b0[_0xcfd1('0x85')])[_0xcfd1('0xca')]()[_0xcfd1('0xaa')]({'secret':![]})[_0xcfd1('0x35')](function(_0x4585a){if(_0x4585a['Attachment']){var _0x75edb0=path['join'](_0xdd4612,_0x4585a[_0xcfd1('0x73')][_0xcfd1('0x70')]);if(fs[_0xcfd1('0xcb')](_0x75edb0)){fs[_0xcfd1('0xcc')](_0x75edb0)[_0xcfd1('0xcd')](fs[_0xcfd1('0xce')](path[_0xcfd1('0x77')](_0x5d7518,_0x4585a[_0xcfd1('0x73')][_0xcfd1('0x70')])));}}return{'date':moment(_0x4585a[_0xcfd1('0x90')])[_0xcfd1('0x7f')](_0xcfd1('0xac'))[_0xcfd1('0xb7')](),'sender':_0x4585a[_0xcfd1('0x92')]===_0xcfd1('0x60')?_0x4585a['User']?_0x4585a['User'][_0xcfd1('0x57')]:_0xcfd1('0x88'):_0x4585a[_0xcfd1('0x66')]['firstName']+(_0x4585a[_0xcfd1('0x66')][_0xcfd1('0xbe')]?'\x20'+_0x4585a['Contact'][_0xcfd1('0xbe')]:''),'body':_0x4585a[_0xcfd1('0x73')]?_0x4585a['Attachment'][_0xcfd1('0x70')]:_0x4585a[_0xcfd1('0x31')],'direction':_0x4585a['direction']===_0xcfd1('0x60')?'A':'C','secret':_0x4585a[_0xcfd1('0x93')],'read':_0x4585a['read'],'attachment':_0x4585a['Attachment']};})[_0xcfd1('0xcf')]()};return ejs[_0xcfd1('0xd0')](path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0xb8'),'views','downloadInteraction.ejs'),{'interaction':_0x4e8b24})[_0xcfd1('0x17')](function(_0x3e3ba6){var _0x3500a8=path[_0xcfd1('0x77')](_0x5d7518,'transcript-'+_0x4fa0b0['id']+'-'+_0x3fef40+'.pdf');var _0x2e7c72={'path':_0x3500a8,'channel':_0xcfd1('0xc3'),'interactionId':_0x4fa0b0['id']};return pdf[_0xcfd1('0xd1')](_0x3e3ba6,_0x2e7c72);})[_0xcfd1('0x17')](function(){return new Promise(function(_0x112608,_0x2c4446){zipdir(_0x5d7518,{'saveTo':_0x5ae5b9},function(_0x254981,_0x18ed24){if(_0x254981)return _0x2c4446(_0x254981);return _0x112608(_0x18ed24);});})[_0xcfd1('0x17')](function(){return new BPromise(function(_0x4d46f2,_0x4745ad){rimraf(_0x5d7518,function(_0x16cc3a){if(_0x16cc3a)_0x4745ad(_0x16cc3a);return _0x4d46f2();});});})[_0xcfd1('0x17')](function(){return _0x25a460[_0xcfd1('0x7b')](_0x5ae5b9,_0x524729,function(_0x57c799){if(_0x57c799){logger[_0xcfd1('0x1c')](_0xcfd1('0xd2'),_0x57c799);}else{fs['unlinkSync'](_0x5ae5b9);}});});});}else{return _0x25a460[_0xcfd1('0x21')](0xc8);}})['catch'](handleError(_0x25a460,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0b935de..d4e7c3e 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 _0x9714=['emit','catch','hasOwnProperty','hook','../../mysqldb','ChatMessage','save','update','remove','getUsers','setDataValue','map','findAll','then','length'];(function(_0x216f7b,_0x5b5021){var _0x5a0324=function(_0x587747){while(--_0x587747){_0x216f7b['push'](_0x216f7b['shift']());}};_0x5a0324(++_0x5b5021);}(_0x9714,0x14e));var _0x4971=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x9714[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x4971('0x0'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x4971('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4971('0x2'),'afterUpdate':_0x4971('0x3'),'afterDestroy':_0x4971('0x4')};function emitEvent(_0x533f54){return function(_0x36da33,_0x53a60b,_0x5a4635){_0x36da33[_0x4971('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xcff29d){_0x36da33[_0x4971('0x6')]('Users',_0xcff29d[_0x4971('0x7')](function(_0x61b29b){return{'id':_0x61b29b['id']};}));return ChatMessage[_0x4971('0x8')]({'where':{'ChatInteractionId':_0x36da33['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4971('0x9')](function(_0x43236e){_0x36da33[_0x4971('0x6')]('unreadMessages',_0x43236e[_0x4971('0xa')]);ChatInteractionEvents[_0x4971('0xb')](_0x533f54+':'+_0x36da33['id'],_0x36da33);ChatInteractionEvents[_0x4971('0xb')](_0x533f54,_0x36da33);_0x5a4635(null);})[_0x4971('0xc')](_0x5a4635(null));};}for(var e in events){if(events[_0x4971('0xd')](e)){var event=events[e];ChatInteraction[_0x4971('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x8be0=['exports','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x8be0,0x1bb));var _0x08be=function(_0x28c90d,_0x8b6881){_0x28c90d=_0x28c90d-0x0;var _0x11192c=_0x8be0[_0x28c90d];return _0x11192c;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x08be('0x0'))['db'][_0x08be('0x1')];var ChatMessage=require(_0x08be('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x08be('0x2')](0x0);var events={'afterCreate':_0x08be('0x3'),'afterUpdate':_0x08be('0x4'),'afterDestroy':'remove'};function emitEvent(_0x531916){return function(_0x551966,_0x4e79e1,_0xfcd226){_0x551966[_0x08be('0x5')]({'attributes':['id'],'raw':!![]})[_0x08be('0x6')](function(_0x581453){_0x551966[_0x08be('0x7')](_0x08be('0x8'),_0x581453[_0x08be('0x9')](function(_0x29c9f0){return{'id':_0x29c9f0['id']};}));return ChatMessage[_0x08be('0xa')]({'where':{'ChatInteractionId':_0x551966['id'],'direction':'in','read':![]},'raw':!![]});})[_0x08be('0x6')](function(_0x5e940a){_0x551966[_0x08be('0x7')]('unreadMessages',_0x5e940a[_0x08be('0xb')]);ChatInteractionEvents['emit'](_0x531916+':'+_0x551966['id'],_0x551966);ChatInteractionEvents[_0x08be('0xc')](_0x531916,_0x551966);_0xfcd226(null);})[_0x08be('0xd')](_0xfcd226(null));};}for(var e in events){if(events[_0x08be('0xe')](e)){var event=events[e];ChatInteraction[_0x08be('0xf')](e,emitEvent(event));}}module[_0x08be('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 398bf65..1a3ab7e 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 _0x5d60=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x5d60,0x17f));var _0x05d6=function(_0x547ef2,_0xefc067){_0x547ef2=_0x547ef2-0x0;var _0x99f200=_0x5d60[_0x547ef2];return _0x99f200;};'use strict';var _=require(_0x05d6('0x0'));var util=require('util');var logger=require(_0x05d6('0x1'))(_0x05d6('0x2'));var moment=require(_0x05d6('0x3'));var BPromise=require(_0x05d6('0x4'));var rp=require(_0x05d6('0x5'));var fs=require('fs');var path=require(_0x05d6('0x6'));var rimraf=require('rimraf');var config=require(_0x05d6('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x05d6('0x8')]=function(_0xccedfd,_0x5ea8f2){return _0xccedfd[_0x05d6('0x9')](_0x05d6('0xa'),attributes,{'tableName':_0x05d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13e345,_0x5e4852,_0x838ac1){if(_0x13e345[_0x05d6('0xc')](_0x05d6('0xd'))){_0x13e345[_0x05d6('0xe')]=moment()[_0x05d6('0xf')](_0x05d6('0x10'));}_0x838ac1(null,_0x13e345);}},'charset':'utf8mb4','collate':_0x05d6('0x11')});}; \ No newline at end of file +var _0x44b0=['path','rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x261739,_0x105b65){var _0xac23e2=function(_0x28167c){while(--_0x28167c){_0x261739['push'](_0x261739['shift']());}};_0xac23e2(++_0x105b65);}(_0x44b0,0xe4));var _0x044b=function(_0x3b7606,_0x1ec1fd){_0x3b7606=_0x3b7606-0x0;var _0x1c6a0c=_0x44b0[_0x3b7606];return _0x1c6a0c;};'use strict';var _=require(_0x044b('0x0'));var util=require(_0x044b('0x1'));var logger=require('../../config/logger')(_0x044b('0x2'));var moment=require(_0x044b('0x3'));var BPromise=require(_0x044b('0x4'));var rp=require(_0x044b('0x5'));var fs=require('fs');var path=require(_0x044b('0x6'));var rimraf=require(_0x044b('0x7'));var config=require(_0x044b('0x8'));var attributes=require(_0x044b('0x9'));module['exports']=function(_0x580771,_0x1871a8){return _0x580771['define'](_0x044b('0xa'),attributes,{'tableName':_0x044b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51d9a5,_0x24ce5b,_0x1be1e5){if(_0x51d9a5[_0x044b('0xc')]('closed')){_0x51d9a5[_0x044b('0xd')]=moment()[_0x044b('0xe')](_0x044b('0xf'));}_0x1be1e5(null,_0x51d9a5);}},'charset':_0x044b('0x10'),'collate':_0x044b('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ad4ce5f..b854d0b 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 _0xdf00=['where','attributes','limit','ChatInteraction','find','addTags','ids','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','update','body','options','raw'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xdf00,0x1b8));var _0x0df0=function(_0x4379fc,_0x5e3330){_0x4379fc=_0x4379fc-0x0;var _0x1dce06=_0xdf00[_0x4379fc];return _0x1dce06;};'use strict';var _=require(_0x0df0('0x0'));var util=require(_0x0df0('0x1'));var moment=require(_0x0df0('0x2'));var BPromise=require(_0x0df0('0x3'));var rs=require(_0x0df0('0x4'));var fs=require('fs');var Redis=require(_0x0df0('0x5'));var db=require(_0x0df0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0df0('0x7'))(_0x0df0('0x8'));var config=require(_0x0df0('0x9'));var jayson=require(_0x0df0('0xa'));var client=jayson['client'][_0x0df0('0xb')]({'port':0x232a});config[_0x0df0('0xc')]=_[_0x0df0('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0df0('0xe'))(new Redis(config[_0x0df0('0xc')]));require(_0x0df0('0xf'))[_0x0df0('0x10')](socket);function respondWithRpcPromise(_0x4121d8,_0x4fb4cc,_0x492a93){return new BPromise(function(_0xbec0d6,_0x4453e8){return client[_0x0df0('0x11')](_0x4121d8,_0x492a93)[_0x0df0('0x12')](function(_0x286cec){logger[_0x0df0('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x4fb4cc,'request\x20sent');logger['debug'](_0x0df0('0x14'),_0x4fb4cc,'request\x20sent',JSON[_0x0df0('0x15')](_0x286cec));if(_0x286cec[_0x0df0('0x16')]){if(_0x286cec[_0x0df0('0x16')][_0x0df0('0x17')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4fb4cc,_0x286cec[_0x0df0('0x16')][_0x0df0('0x18')]);return _0x4453e8(_0x286cec[_0x0df0('0x16')][_0x0df0('0x18')]);}logger[_0x0df0('0x16')](_0x0df0('0x19'),_0x4fb4cc,_0x286cec['error'][_0x0df0('0x18')]);return _0xbec0d6(_0x286cec[_0x0df0('0x16')]['message']);}else{logger[_0x0df0('0x13')](_0x0df0('0x19'),_0x4fb4cc,'request\x20sent');_0xbec0d6(_0x286cec[_0x0df0('0x1a')]['message']);}})[_0x0df0('0x1b')](function(_0x214cc4){logger['error'](_0x0df0('0x19'),_0x4fb4cc,_0x214cc4);_0x4453e8(_0x214cc4);});});}exports[_0x0df0('0x1c')]=function(_0x264e46){var _0x5f1a9e=this;return new Promise(function(_0x30f8f9,_0x5cbb20){return db['ChatInteraction'][_0x0df0('0x1d')](_0x264e46[_0x0df0('0x1e')],{'raw':_0x264e46[_0x0df0('0x1f')]?_0x264e46[_0x0df0('0x1f')][_0x0df0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x264e46['options']?_0x264e46[_0x0df0('0x1f')][_0x0df0('0x21')]||null:null,'attributes':_0x264e46[_0x0df0('0x1f')]?_0x264e46[_0x0df0('0x1f')][_0x0df0('0x22')]||null:null,'limit':_0x264e46[_0x0df0('0x1f')]?_0x264e46[_0x0df0('0x1f')][_0x0df0('0x23')]||null:null})[_0x0df0('0x12')](function(_0xea9c3c){logger[_0x0df0('0x13')](_0x0df0('0x1c'),_0x264e46);logger['debug'](_0x0df0('0x1c'),_0x264e46,JSON[_0x0df0('0x15')](_0xea9c3c));_0x30f8f9(_0xea9c3c);})[_0x0df0('0x1b')](function(_0xd13611){logger[_0x0df0('0x16')](_0x0df0('0x1c'),_0xd13611['message'],_0x264e46);_0x5cbb20(_0x5f1a9e[_0x0df0('0x16')](0x1f4,_0xd13611['message']));});});};exports['AddTagsToChatInteraction']=function(_0x3a08aa){return new Promise(function(_0x3f15e4,_0x12043f){return db[_0x0df0('0x24')][_0x0df0('0x25')]({'where':_0x3a08aa[_0x0df0('0x1f')]?_0x3a08aa['options'][_0x0df0('0x21')]||null:null})[_0x0df0('0x12')](function(_0x13b04f){if(_0x13b04f){return _0x13b04f[_0x0df0('0x26')](_0x3a08aa[_0x0df0('0x1e')][_0x0df0('0x27')],_['omit'](_0x3a08aa[_0x0df0('0x1e')],[_0x0df0('0x27'),'id'])||{});}})[_0x0df0('0x28')](function(_0x3c69e1){logger['info'](_0x0df0('0x29'),_0x3a08aa);logger[_0x0df0('0x2a')]('AddTags',_0x3a08aa,JSON['stringify'](_0x3c69e1));_0x3f15e4(_0x3c69e1);})[_0x0df0('0x1b')](function(_0x3cd391){logger[_0x0df0('0x16')]('AddTags',_0x3cd391[_0x0df0('0x18')],_0x3a08aa);_0x12043f(_this[_0x0df0('0x16')](0x1f4,_0x3cd391[_0x0df0('0x18')]));});});}; \ No newline at end of file +var _0x4590=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','ChatInteraction','addTags','ids','omit','AddTags','lodash','util'];(function(_0x3c929e,_0x55dea5){var _0x42adbb=function(_0x4d97ca){while(--_0x4d97ca){_0x3c929e['push'](_0x3c929e['shift']());}};_0x42adbb(++_0x55dea5);}(_0x4590,0x198));var _0x0459=function(_0x4d36a4,_0x303dd0){_0x4d36a4=_0x4d36a4-0x0;var _0x8d4548=_0x4590[_0x4d36a4];return _0x8d4548;};'use strict';var _=require(_0x0459('0x0'));var util=require(_0x0459('0x1'));var moment=require(_0x0459('0x2'));var BPromise=require(_0x0459('0x3'));var rs=require(_0x0459('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0459('0x5'))['db'];var utils=require(_0x0459('0x6'));var logger=require(_0x0459('0x7'))('rpc');var config=require(_0x0459('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0459('0x9')]['http']({'port':0x232a});config[_0x0459('0xa')]=_[_0x0459('0xb')](config[_0x0459('0xa')],{'host':_0x0459('0xc'),'port':0x18eb});var socket=require(_0x0459('0xd'))(new Redis(config[_0x0459('0xa')]));require('./chatInteraction.socket')[_0x0459('0xe')](socket);function respondWithRpcPromise(_0x39f3fa,_0x28dc30,_0x1eb4bb){return new BPromise(function(_0x44f20e,_0x197faf){return client[_0x0459('0xf')](_0x39f3fa,_0x1eb4bb)[_0x0459('0x10')](function(_0x3dc0cd){logger['info'](_0x0459('0x11'),_0x28dc30,'request\x20sent');logger[_0x0459('0x12')](_0x0459('0x13'),_0x28dc30,_0x0459('0x14'),JSON['stringify'](_0x3dc0cd));if(_0x3dc0cd['error']){if(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x16')]===0x1f4){logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);return _0x197faf(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);}logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);return _0x44f20e(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);}else{logger[_0x0459('0x18')](_0x0459('0x11'),_0x28dc30,_0x0459('0x14'));_0x44f20e(_0x3dc0cd[_0x0459('0x19')]['message']);}})['catch'](function(_0x4a20f2){logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x4a20f2);_0x197faf(_0x4a20f2);});});}exports['UpdateChatInteraction']=function(_0x24a7d2){var _0x18db53=this;return new Promise(function(_0x1cc1da,_0x217392){return db['ChatInteraction']['update'](_0x24a7d2[_0x0459('0x1a')],{'raw':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2[_0x0459('0x1b')][_0x0459('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a7d2['options']?_0x24a7d2['options'][_0x0459('0x1d')]||null:null,'attributes':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2['options'][_0x0459('0x1e')]||null:null,'limit':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2[_0x0459('0x1b')][_0x0459('0x1f')]||null:null})['then'](function(_0x6d59f8){logger['info'](_0x0459('0x20'),_0x24a7d2);logger[_0x0459('0x12')](_0x0459('0x20'),_0x24a7d2,JSON[_0x0459('0x21')](_0x6d59f8));_0x1cc1da(_0x6d59f8);})[_0x0459('0x22')](function(_0x4aba61){logger['error'](_0x0459('0x20'),_0x4aba61['message'],_0x24a7d2);_0x217392(_0x18db53[_0x0459('0x15')](0x1f4,_0x4aba61[_0x0459('0x17')]));});});};exports[_0x0459('0x23')]=function(_0xc21bd5){return new Promise(function(_0x1ebf5c,_0x49e6e4){return db[_0x0459('0x24')]['find']({'where':_0xc21bd5[_0x0459('0x1b')]?_0xc21bd5[_0x0459('0x1b')][_0x0459('0x1d')]||null:null})[_0x0459('0x10')](function(_0x4843b4){if(_0x4843b4){return _0x4843b4[_0x0459('0x25')](_0xc21bd5['body'][_0x0459('0x26')],_[_0x0459('0x27')](_0xc21bd5[_0x0459('0x1a')],['ids','id'])||{});}})['spread'](function(_0x58690d){logger[_0x0459('0x18')](_0x0459('0x28'),_0xc21bd5);logger[_0x0459('0x12')](_0x0459('0x28'),_0xc21bd5,JSON[_0x0459('0x21')](_0x58690d));_0x1ebf5c(_0x58690d);})[_0x0459('0x22')](function(_0x52de7d){logger[_0x0459('0x15')](_0x0459('0x28'),_0x52de7d['message'],_0xc21bd5);_0x49e6e4(_this[_0x0459('0x15')](0x1f4,_0x52de7d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 263fc0e..076b964 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 _0xa039=['save','remove','update','removeListener','register','length','./chatInteraction.events'];(function(_0x567fdf,_0x3b1183){var _0x8755a6=function(_0x25a725){while(--_0x25a725){_0x567fdf['push'](_0x567fdf['shift']());}};_0x8755a6(++_0x3b1183);}(_0xa039,0x133));var _0x9a03=function(_0xf0dca8,_0x431c7c){_0xf0dca8=_0xf0dca8-0x0;var _0x4b0b57=_0xa039[_0xf0dca8];return _0x4b0b57;};'use strict';var ChatInteractionEvents=require(_0x9a03('0x0'));var events=[_0x9a03('0x1'),_0x9a03('0x2'),_0x9a03('0x3')];function createListener(_0x5789eb,_0x13aafc){return function(_0x3b11a6){_0x13aafc['emit'](_0x5789eb,_0x3b11a6);};}function removeListener(_0x1f8f35,_0x4b4830){return function(){ChatInteractionEvents[_0x9a03('0x4')](_0x1f8f35,_0x4b4830);};}exports[_0x9a03('0x5')]=function(_0x53b9a0){for(var _0x3a609f=0x0,_0x17e23a=events[_0x9a03('0x6')];_0x3a609f<_0x17e23a;_0x3a609f++){var _0x15bf9a=events[_0x3a609f];var _0x56e867=createListener('chatInteraction:'+_0x15bf9a,_0x53b9a0);ChatInteractionEvents['on'](_0x15bf9a,_0x56e867);}}; \ No newline at end of file +var _0xe168=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x27fc19,_0x4d0f5a){var _0x475511=function(_0x4e91b3){while(--_0x4e91b3){_0x27fc19['push'](_0x27fc19['shift']());}};_0x475511(++_0x4d0f5a);}(_0xe168,0x159));var _0x8e16=function(_0x4890cb,_0x58b6ec){_0x4890cb=_0x4890cb-0x0;var _0x40b461=_0xe168[_0x4890cb];return _0x40b461;};'use strict';var ChatInteractionEvents=require(_0x8e16('0x0'));var events=[_0x8e16('0x1'),_0x8e16('0x2'),_0x8e16('0x3')];function createListener(_0x2b4f30,_0x3bcd25){return function(_0x3120ab){_0x3bcd25[_0x8e16('0x4')](_0x2b4f30,_0x3120ab);};}function removeListener(_0x2f2e59,_0x5fddf9){return function(){ChatInteractionEvents[_0x8e16('0x5')](_0x2f2e59,_0x5fddf9);};}exports[_0x8e16('0x6')]=function(_0x1da151){for(var _0x5e01ef=0x0,_0x122315=events[_0x8e16('0x7')];_0x5e01ef<_0x122315;_0x5e01ef++){var _0xbab5e4=events[_0x5e01ef];var _0xb901dc=createListener('chatInteraction:'+_0xbab5e4,_0x1da151);ChatInteractionEvents['on'](_0xbab5e4,_0xb901dc);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d775b0e..f96b8e9 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 _0x4527=['put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','file','attachmentUpload','tracked','chat','chatinteraction:addtags','addTags'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x4527,0x75));var _0x7452=function(_0x2b1db0,_0x2b5f09){_0x2b1db0=_0x2b1db0-0x0;var _0x5e0cd3=_0x4527[_0x2b1db0];return _0x5e0cd3;};'use strict';var multer=require(_0x7452('0x0'));var util=require('util');var path=require(_0x7452('0x1'));var timeout=require(_0x7452('0x2'));var express=require(_0x7452('0x3'));var router=express[_0x7452('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7452('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7452('0x6'));var controller=require(_0x7452('0x7'));router['get']('/',auth[_0x7452('0x8')](),controller[_0x7452('0x9')]);router[_0x7452('0xa')](_0x7452('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7452('0xa')](_0x7452('0xc'),auth[_0x7452('0xd')](),controller['show']);router[_0x7452('0xa')](_0x7452('0xe'),auth[_0x7452('0xd')](),controller[_0x7452('0xf')]);router[_0x7452('0xa')](_0x7452('0x10'),auth[_0x7452('0x8')](),controller[_0x7452('0x11')]);router['get']('/:id/my_messages',auth[_0x7452('0xd')](),controller[_0x7452('0x12')]);router['get'](_0x7452('0x13'),auth[_0x7452('0x8')](),controller[_0x7452('0x14')]);router[_0x7452('0x15')]('/',auth[_0x7452('0x8')](),controller['create']);router[_0x7452('0x15')](_0x7452('0x16'),auth[_0x7452('0x8')](),controller[_0x7452('0x17')]);var upload=multer({'storage':multer[_0x7452('0x18')]({'destination':function(_0x2f1ebc,_0x4aa871,_0x264eba){_0x264eba(null,path[_0x7452('0x19')](config[_0x7452('0x1a')],_0x7452('0x1b')));},'filename':function(_0x461f94,_0x35ea89,_0x434071){_0x434071(null,util[_0x7452('0x1c')](_0x7452('0x1d'),Date[_0x7452('0x1e')](),_0x35ea89[_0x7452('0x1f')][_0x7452('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7452('0x15')]('/:id/attachment_upload',upload['single'](_0x7452('0x21')),controller[_0x7452('0x22')]);router[_0x7452('0x15')](_0x7452('0x10'),auth[_0x7452('0xd')](),controller['addMessage']);router[_0x7452('0x15')]('/:id/tags',auth[_0x7452('0x8')](),interaction[_0x7452('0x23')](_0x7452('0x24'),_0x7452('0x25')),controller[_0x7452('0x26')]);router[_0x7452('0x27')](_0x7452('0xc'),auth[_0x7452('0x8')](),interaction[_0x7452('0x23')](_0x7452('0x24'),_0x7452('0x28')),controller[_0x7452('0x29')]);router[_0x7452('0x27')](_0x7452('0x2a'),controller['customUpdate']);router[_0x7452('0x27')](_0x7452('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x7452('0x2c')]);router[_0x7452('0x27')](_0x7452('0x2d'),controller[_0x7452('0x2e')]);router[_0x7452('0x2f')](_0x7452('0xc'),auth[_0x7452('0x8')](),interaction[_0x7452('0x23')](_0x7452('0x24'),'chatinteraction:destroy'),controller[_0x7452('0x30')]);router[_0x7452('0x2f')](_0x7452('0x31'),auth['isAuthenticated'](),controller[_0x7452('0x32')]);module[_0x7452('0x33')]=router; \ No newline at end of file +var _0xaa6c=['join','format','%s-%s','originalname','replace','post','/:id/attachment_upload','file','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','download','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xaa6c,0x1c9));var _0xcaa6=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xaa6c[_0x504df1];return _0x1063b5;};'use strict';var multer=require(_0xcaa6('0x0'));var util=require(_0xcaa6('0x1'));var path=require('path');var timeout=require(_0xcaa6('0x2'));var express=require(_0xcaa6('0x3'));var router=express['Router']();var fs_extra=require(_0xcaa6('0x4'));var auth=require(_0xcaa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcaa6('0x6'));var controller=require(_0xcaa6('0x7'));router[_0xcaa6('0x8')]('/',auth[_0xcaa6('0x9')](),controller[_0xcaa6('0xa')]);router[_0xcaa6('0x8')](_0xcaa6('0xb'),auth[_0xcaa6('0x9')](),controller[_0xcaa6('0xc')]);router[_0xcaa6('0x8')](_0xcaa6('0xd'),auth[_0xcaa6('0xe')](),controller['show']);router[_0xcaa6('0x8')](_0xcaa6('0xf'),auth[_0xcaa6('0xe')](),controller[_0xcaa6('0x10')]);router[_0xcaa6('0x8')](_0xcaa6('0x11'),auth[_0xcaa6('0x9')](),controller['getMessages']);router[_0xcaa6('0x8')](_0xcaa6('0x12'),auth[_0xcaa6('0xe')](),controller['getMyMessages']);router[_0xcaa6('0x8')]('/:id/download',auth[_0xcaa6('0x9')](),controller[_0xcaa6('0x13')]);router['post']('/',auth[_0xcaa6('0x9')](),controller['create']);router['post'](_0xcaa6('0x14'),auth[_0xcaa6('0x9')](),controller[_0xcaa6('0x15')]);var upload=multer({'storage':multer[_0xcaa6('0x16')]({'destination':function(_0x1a7f96,_0x202d45,_0x562b75){_0x562b75(null,path[_0xcaa6('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x5c746b,_0x4766b3,_0x4e2bf9){_0x4e2bf9(null,util[_0xcaa6('0x18')](_0xcaa6('0x19'),Date['now'](),_0x4766b3[_0xcaa6('0x1a')][_0xcaa6('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xcaa6('0x1c')](_0xcaa6('0x1d'),upload['single'](_0xcaa6('0x1e')),controller[_0xcaa6('0x1f')]);router[_0xcaa6('0x1c')]('/:id/messages',auth[_0xcaa6('0xe')](),controller['addMessage']);router[_0xcaa6('0x1c')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xcaa6('0x20')]('chat',_0xcaa6('0x21')),controller[_0xcaa6('0x22')]);router[_0xcaa6('0x23')]('/:id',auth[_0xcaa6('0x9')](),interaction[_0xcaa6('0x20')](_0xcaa6('0x24'),_0xcaa6('0x25')),controller[_0xcaa6('0x26')]);router[_0xcaa6('0x23')](_0xcaa6('0x27'),controller[_0xcaa6('0x28')]);router[_0xcaa6('0x23')]('/:id/abandon',auth[_0xcaa6('0xe')](),controller[_0xcaa6('0x29')]);router[_0xcaa6('0x23')](_0xcaa6('0x2a'),controller['close']);router[_0xcaa6('0x2b')]('/:id',auth[_0xcaa6('0x9')](),interaction['tracked'](_0xcaa6('0x24'),_0xcaa6('0x2c')),controller[_0xcaa6('0x2d')]);router[_0xcaa6('0x2b')]('/:id/tags',auth[_0xcaa6('0x9')](),controller[_0xcaa6('0x2e')]);module[_0xcaa6('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f87f2ad..24d934e 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 _0xfa45=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xfa45,0xf1));var _0x5fa4=function(_0x596499,_0x49e351){_0x596499=_0x596499-0x0;var _0x52a771=_0xfa45[_0x596499];return _0x52a771;};'use strict';var Sequelize=require(_0x5fa4('0x0'));module[_0x5fa4('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5fa4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5fa4('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5fa4('0x4')]}}; \ No newline at end of file +var _0x1fa4=['sequelize','exports','medium','INTEGER'];(function(_0x33016a,_0xf0fba8){var _0x7c659b=function(_0x3f82cf){while(--_0x3f82cf){_0x33016a['push'](_0x33016a['shift']());}};_0x7c659b(++_0xf0fba8);}(_0x1fa4,0xf0));var _0x41fa=function(_0x109407,_0x2d87fb){_0x109407=_0x109407-0x0;var _0x3ec159=_0x1fa4[_0x109407];return _0x3ec159;};'use strict';var Sequelize=require(_0x41fa('0x0'));module[_0x41fa('0x1')]={'body':{'type':Sequelize['TEXT'](_0x41fa('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x41fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3965fd9..1557927 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 _0x4a4d=['read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','./chatInternalMessage.socket','register','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','fullname','role','userpic','internal','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','isEmpty','resourceId','push'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a4d,0xd9));var _0xd4a4=function(_0x2c85c0,_0x1dac4f){_0x2c85c0=_0x2c85c0-0x0;var _0xf4d4c9=_0x4a4d[_0x2c85c0];return _0xf4d4c9;};'use strict';var emlformat=require(_0xd4a4('0x0'));var rimraf=require(_0xd4a4('0x1'));var zipdir=require(_0xd4a4('0x2'));var jsonpatch=require(_0xd4a4('0x3'));var rp=require('request-promise');var moment=require(_0xd4a4('0x4'));var BPromise=require(_0xd4a4('0x5'));var Mustache=require(_0xd4a4('0x6'));var util=require(_0xd4a4('0x7'));var path=require('path');var sox=require(_0xd4a4('0x8'));var csv=require(_0xd4a4('0x9'));var ejs=require(_0xd4a4('0xa'));var fs=require('fs');var fs_extra=require(_0xd4a4('0xb'));var _=require(_0xd4a4('0xc'));var squel=require(_0xd4a4('0xd'));var crypto=require(_0xd4a4('0xe'));var jsforce=require(_0xd4a4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd4a4('0x9'));var querystring=require(_0xd4a4('0x10'));var Papa=require('papaparse');var Redis=require(_0xd4a4('0x11'));var authService=require(_0xd4a4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4a4('0x13'));var logger=require(_0xd4a4('0x14'))(_0xd4a4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4a4('0x16'));var db=require('../../mysqldb')['db'];config[_0xd4a4('0x17')]=_[_0xd4a4('0x18')](config[_0xd4a4('0x17')],{'host':_0xd4a4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4a4('0x17')]));require(_0xd4a4('0x1a'))[_0xd4a4('0x1b')](socket);function respondWithStatusCode(_0x113de8,_0x4bb8e1){_0x4bb8e1=_0x4bb8e1||0xcc;return function(_0x507419){if(_0x507419){return _0x113de8['sendStatus'](_0x4bb8e1);}return _0x113de8[_0xd4a4('0x1c')](_0x4bb8e1)['end']();};}function respondWithResult(_0x509324,_0x35618b){_0x35618b=_0x35618b||0xc8;return function(_0x445ff2){if(_0x445ff2){return _0x509324[_0xd4a4('0x1c')](_0x35618b)[_0xd4a4('0x1d')](_0x445ff2);}};}function respondWithFilteredResult(_0xf96cbc,_0x2ecb37){return function(_0x1a640e){if(_0x1a640e){var _0x1b38cb=typeof _0x2ecb37[_0xd4a4('0x1e')]==='undefined'&&typeof _0x2ecb37[_0xd4a4('0x1f')]===_0xd4a4('0x20');var _0x1de3e3=_0x1a640e[_0xd4a4('0x21')];var _0x535221=_0x1b38cb?0x0:_0x2ecb37[_0xd4a4('0x1e')];var _0x22de56=_0x1b38cb?_0x1a640e[_0xd4a4('0x21')]:_0x2ecb37['offset']+_0x2ecb37[_0xd4a4('0x1f')];var _0x4c8de3;if(_0x22de56>=_0x1de3e3){_0x22de56=_0x1de3e3;_0x4c8de3=0xc8;}else{_0x4c8de3=0xce;}_0xf96cbc[_0xd4a4('0x1c')](_0x4c8de3);return _0xf96cbc['set'](_0xd4a4('0x22'),_0x535221+'-'+_0x22de56+'/'+_0x1de3e3)[_0xd4a4('0x1d')](_0x1a640e);}return null;};}function patchUpdates(_0x42f505){return function(_0x333d3d){try{jsonpatch['apply'](_0x333d3d,_0x42f505,!![]);}catch(_0x4769f8){return BPromise[_0xd4a4('0x23')](_0x4769f8);}return _0x333d3d[_0xd4a4('0x24')]();};}function saveUpdates(_0x4855e9,_0x2e3c84){return function(_0x4f7d22){if(_0x4f7d22){return _0x4f7d22[_0xd4a4('0x25')](_0x4855e9)[_0xd4a4('0x26')](function(_0x12bdc4){return _0x12bdc4;});}return null;};}function removeEntity(_0xe7f31e,_0x3ee0df){return function(_0x13f5d2){if(_0x13f5d2){return _0x13f5d2[_0xd4a4('0x27')]()['then'](function(){_0xe7f31e[_0xd4a4('0x1c')](0xcc)[_0xd4a4('0x28')]();});}};}function handleEntityNotFound(_0x236db1,_0x52a87d){return function(_0x1ce91a){if(!_0x1ce91a){_0x236db1[_0xd4a4('0x29')](0x194);}return _0x1ce91a;};}function handleError(_0x539b98,_0x524ce3){_0x524ce3=_0x524ce3||0x1f4;return function(_0x4a45a7){logger[_0xd4a4('0x2a')](_0x4a45a7[_0xd4a4('0x2b')]);if(_0x4a45a7[_0xd4a4('0x2c')]){delete _0x4a45a7['name'];}_0x539b98[_0xd4a4('0x1c')](_0x524ce3)['send'](_0x4a45a7);};}exports[_0xd4a4('0x2d')]=function(_0x51b67a,_0x192c6b){var _0xd59307={},_0x14e0a4={},_0x118e31={'count':0x0,'rows':[]};var _0x4962e9=_[_0xd4a4('0x2e')](db[_0xd4a4('0x2f')][_0xd4a4('0x30')],function(_0x4115f9){return{'name':_0x4115f9[_0xd4a4('0x31')],'type':_0x4115f9[_0xd4a4('0x32')][_0xd4a4('0x33')]};});_0x14e0a4['model']=_[_0xd4a4('0x2e')](_0x4962e9,_0xd4a4('0x2c'));_0x14e0a4['query']=_[_0xd4a4('0x34')](_0x51b67a[_0xd4a4('0x35')]);_0x14e0a4[_0xd4a4('0x36')]=_[_0xd4a4('0x37')](_0x14e0a4['model'],_0x14e0a4[_0xd4a4('0x35')]);_0xd59307[_0xd4a4('0x38')]=_['intersection'](_0x14e0a4[_0xd4a4('0x39')],qs[_0xd4a4('0x3a')](_0x51b67a['query']['fields']));_0xd59307[_0xd4a4('0x38')]=_0xd59307[_0xd4a4('0x38')][_0xd4a4('0x3b')]?_0xd59307[_0xd4a4('0x38')]:_0x14e0a4[_0xd4a4('0x39')];if(!_0x51b67a[_0xd4a4('0x35')][_0xd4a4('0x3c')](_0xd4a4('0x3d'))){_0xd59307['limit']=qs[_0xd4a4('0x1f')](_0x51b67a[_0xd4a4('0x35')][_0xd4a4('0x1f')]);_0xd59307[_0xd4a4('0x1e')]=qs['offset'](_0x51b67a[_0xd4a4('0x35')][_0xd4a4('0x1e')]);}_0xd59307[_0xd4a4('0x3e')]=qs[_0xd4a4('0x3f')](_0x51b67a[_0xd4a4('0x35')][_0xd4a4('0x3f')]);_0xd59307[_0xd4a4('0x40')]=qs[_0xd4a4('0x36')](_[_0xd4a4('0x41')](_0x51b67a[_0xd4a4('0x35')],_0x14e0a4['filters']),_0x4962e9);if(_0x51b67a['query']['filter']){_0xd59307[_0xd4a4('0x40')]=_[_0xd4a4('0x42')](_0xd59307['where'],{'$or':_['map'](_0x4962e9,function(_0x3d68a2){if(_0x3d68a2['type']!==_0xd4a4('0x43')){var _0x407f23={};_0x407f23[_0x3d68a2[_0xd4a4('0x2c')]]={'$like':'%'+_0x51b67a['query']['filter']+'%'};return _0x407f23;}})});}_0xd59307=_[_0xd4a4('0x42')]({},_0xd59307,_0x51b67a[_0xd4a4('0x44')]);var _0x376d82={'where':_0xd59307[_0xd4a4('0x40')]};return db[_0xd4a4('0x2f')][_0xd4a4('0x21')](_0x376d82)['then'](function(_0x3855cb){_0x118e31['count']=_0x3855cb;if(_0x51b67a['query'][_0xd4a4('0x45')]){_0xd59307[_0xd4a4('0x46')]=[{'all':!![]}];}return db[_0xd4a4('0x2f')]['findAll'](_0xd59307);})['then'](function(_0x5b4095){_0x118e31[_0xd4a4('0x47')]=_0x5b4095;return _0x118e31;})[_0xd4a4('0x26')](respondWithFilteredResult(_0x192c6b,_0xd59307))[_0xd4a4('0x48')](handleError(_0x192c6b,null));};exports['show']=function(_0x411e96,_0x55a4f0){var _0x180e01={'raw':!![],'where':{'id':_0x411e96[_0xd4a4('0x49')]['id']}},_0x421b7c={};_0x421b7c[_0xd4a4('0x39')]=_['keys'](db[_0xd4a4('0x2f')][_0xd4a4('0x30')]);_0x421b7c[_0xd4a4('0x35')]=_[_0xd4a4('0x34')](_0x411e96[_0xd4a4('0x35')]);_0x421b7c[_0xd4a4('0x36')]=_['intersection'](_0x421b7c[_0xd4a4('0x39')],_0x421b7c[_0xd4a4('0x35')]);_0x180e01['attributes']=_[_0xd4a4('0x37')](_0x421b7c[_0xd4a4('0x39')],qs['fields'](_0x411e96['query'][_0xd4a4('0x3a')]));_0x180e01[_0xd4a4('0x38')]=_0x180e01[_0xd4a4('0x38')][_0xd4a4('0x3b')]?_0x180e01[_0xd4a4('0x38')]:_0x421b7c[_0xd4a4('0x39')];if(_0x411e96[_0xd4a4('0x35')]['includeAll']){_0x180e01[_0xd4a4('0x46')]=[{'all':!![]}];}_0x180e01=_[_0xd4a4('0x42')]({},_0x180e01,_0x411e96[_0xd4a4('0x44')]);return db[_0xd4a4('0x2f')][_0xd4a4('0x4a')](_0x180e01)['then'](handleEntityNotFound(_0x55a4f0,null))[_0xd4a4('0x26')](respondWithResult(_0x55a4f0,null))[_0xd4a4('0x48')](handleError(_0x55a4f0,null));};exports['create']=function(_0x6398b4,_0x2b4cb8){return db[_0xd4a4('0x2f')][_0xd4a4('0x4b')](_0x6398b4[_0xd4a4('0x4c')],{})['then'](respondWithResult(_0x2b4cb8,0xc9))['catch'](handleError(_0x2b4cb8,null));};exports[_0xd4a4('0x25')]=function(_0x10898a,_0x2ff56d){if(_0x10898a['body']['id']){delete _0x10898a['body']['id'];}return db['ChatInternalMessage'][_0xd4a4('0x4a')]({'where':{'id':_0x10898a[_0xd4a4('0x49')]['id']}})[_0xd4a4('0x26')](handleEntityNotFound(_0x2ff56d,null))['then'](saveUpdates(_0x10898a[_0xd4a4('0x4c')],null))[_0xd4a4('0x26')](respondWithResult(_0x2ff56d,null))['catch'](handleError(_0x2ff56d,null));};exports[_0xd4a4('0x27')]=function(_0x27132c,_0x1a723f){return db[_0xd4a4('0x2f')]['find']({'where':{'id':_0x27132c[_0xd4a4('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a723f,null))['then'](removeEntity(_0x1a723f,null))[_0xd4a4('0x48')](handleError(_0x1a723f,null));};exports[_0xd4a4('0x4d')]=function(_0xd6136b,_0x59929e){return db[_0xd4a4('0x2f')][_0xd4a4('0x4d')]()[_0xd4a4('0x26')](respondWithResult(_0x59929e,null))['catch'](handleError(_0x59929e,null));};function wrapUser(_0x27c42e){return function(_0x5c50c0){var _0x58cf64=_0x27c42e[_0xd4a4('0x4e')]({'plain':!![]});_0x58cf64['messages']=[];if(_0x5c50c0){_0x58cf64[_0xd4a4('0x4f')]=_0x5c50c0[_0xd4a4('0x50')];_0x58cf64[_0xd4a4('0x51')]=_0x5c50c0;}else{_0x58cf64[_0xd4a4('0x4f')]=moment(0x0)[_0xd4a4('0x52')](_0xd4a4('0x53'));_0x58cf64[_0xd4a4('0x51')]={};}return _0x58cf64;};}exports[_0xd4a4('0x54')]=function(_0x587c23,_0x4f108b,_0x55f06f){var _0x32fe77=[];return db[_0xd4a4('0x55')][_0xd4a4('0x56')]({'where':{'role':[_0xd4a4('0x57'),_0xd4a4('0x58'),'user']},'attributes':['id',_0xd4a4('0x59'),_0xd4a4('0x2c'),_0xd4a4('0x5a'),_0xd4a4('0x5b'),_0xd4a4('0x5c'),'online',_0xd4a4('0x5d'),'allowmessenger',_0xd4a4('0x5e')],'order':qs[_0xd4a4('0x3f')](_0xd4a4('0x5f')),'include':[{'model':db[_0xd4a4('0x60')],'as':_0xd4a4('0x61'),'attributes':['id',_0xd4a4('0x2c'),_0xd4a4('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x1a9b2f){if(_0x1a9b2f){var _0x2a390d=_0x587c23[_0xd4a4('0x62')][_0xd4a4('0x4e')]({'plain':!![]});if(!_0x2a390d)throw new Error(_0xd4a4('0x63'));if(_0x2a390d[_0xd4a4('0x5a')]===_0xd4a4('0x62')){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x2a390d['userProfileId']},'raw':!![]})[_0xd4a4('0x26')](function(_0x3b2fdb){if(_0x3b2fdb){if(_0x3b2fdb['autoAssociation']===0x0){return db[_0xd4a4('0x64')][_0xd4a4('0x56')]({'where':{'sectionId':_0x3b2fdb['id']},'raw':!![]})[_0xd4a4('0x26')](function(_0x2bfbf1){var _0x419001=[];if(_[_0xd4a4('0x65')](_0x2bfbf1)){_0x419001=_['filter'](_0x1a9b2f,function(_0x57eaaa){if(_0x57eaaa[_0xd4a4('0x5a')]!=='agent'){return _0x57eaaa;}});return _0x419001;}else{for(var _0xc0343b=0x0;_0xc0343b<_0x1a9b2f[_0xd4a4('0x3b')];_0xc0343b++){var _0x2f53d5=_0x1a9b2f[_0xc0343b];if(_0x2f53d5[_0xd4a4('0x5a')]===_0xd4a4('0x57')){var _0x3588d1=_[_0xd4a4('0x4a')](_0x2bfbf1,function(_0x4f826b){return _0x4f826b[_0xd4a4('0x66')]===_0x2f53d5['id'];});if(_0x3588d1)_0x419001[_0xd4a4('0x67')](_0x2f53d5);}else{_0x419001[_0xd4a4('0x67')](_0x2f53d5);}}return _0x419001;}});}else{return _0x1a9b2f;}}else{var _0x1ac557=_['filter'](_0x1a9b2f,function(_0xa92e27){if(_0xa92e27['role']!==_0xd4a4('0x57')){return _0xa92e27;}});return _0x1ac557;}});}else{return _0x1a9b2f;}}})['then'](function(_0x300bfc){var _0xc25ce=[];if(_0x300bfc){_0x32fe77=_0x300bfc;for(var _0x48e6c7=0x0;_0x48e6c7<_0x300bfc['length'];_0x48e6c7+=0x1){_0x32fe77[_0x48e6c7]['messages']=[];_0xc25ce[_0xd4a4('0x67')](db['ChatInternalMessage'][_0xd4a4('0x4a')]({'where':{'FromId':[_0x587c23[_0xd4a4('0x62')]['id'],_0x300bfc[_0x48e6c7]['id']],'ToId':[_0x587c23[_0xd4a4('0x62')]['id'],_0x300bfc[_0x48e6c7]['id']],'ChatGroupId':null},'attributes':['id',_0xd4a4('0x50'),'FromId','ToId',_0xd4a4('0x68'),_0xd4a4('0x4c')],'order':qs[_0xd4a4('0x3f')](_0xd4a4('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x300bfc[_0x48e6c7])));}return BPromise[_0xd4a4('0x6a')](_0xc25ce);}return[];})[_0xd4a4('0x26')](function(_0x579a80){return{'rows':_0x579a80,'count':_0x579a80[_0xd4a4('0x3b')]};})['then'](respondWithResult(_0x4f108b,null))[_0xd4a4('0x48')](handleError(_0x4f108b,null));}; \ No newline at end of file +var _0x5192=['zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ChatInternalMessage','includeAll','include','catch','show','params','keys','options','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','user','userpic','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','findAll','isEmpty','agent','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf'];(function(_0x1886c8,_0x1179d3){var _0x3e26e5=function(_0x557191){while(--_0x557191){_0x1886c8['push'](_0x1886c8['shift']());}};_0x3e26e5(++_0x1179d3);}(_0x5192,0xce));var _0x2519=function(_0x572dc4,_0x48dec4){_0x572dc4=_0x572dc4-0x0;var _0x18a792=_0x5192[_0x572dc4];return _0x18a792;};'use strict';var emlformat=require(_0x2519('0x0'));var rimraf=require(_0x2519('0x1'));var zipdir=require(_0x2519('0x2'));var jsonpatch=require(_0x2519('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2519('0x4'));var Mustache=require('mustache');var util=require(_0x2519('0x5'));var path=require(_0x2519('0x6'));var sox=require(_0x2519('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2519('0x8'));var _=require(_0x2519('0x9'));var squel=require('squel');var crypto=require(_0x2519('0xa'));var jsforce=require(_0x2519('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2519('0xc'));var Papa=require(_0x2519('0xd'));var Redis=require(_0x2519('0xe'));var authService=require(_0x2519('0xf'));var qs=require(_0x2519('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2519('0x11'))('api');var utils=require(_0x2519('0x12'));var config=require(_0x2519('0x13'));var licenseUtil=require(_0x2519('0x14'));var db=require(_0x2519('0x15'))['db'];config['redis']=_['defaults'](config[_0x2519('0x16')],{'host':_0x2519('0x17'),'port':0x18eb});var socket=require(_0x2519('0x18'))(new Redis(config[_0x2519('0x16')]));require(_0x2519('0x19'))[_0x2519('0x1a')](socket);function respondWithStatusCode(_0x3c4dbc,_0x364930){_0x364930=_0x364930||0xcc;return function(_0x21d97d){if(_0x21d97d){return _0x3c4dbc['sendStatus'](_0x364930);}return _0x3c4dbc[_0x2519('0x1b')](_0x364930)['end']();};}function respondWithResult(_0x451e63,_0x58f555){_0x58f555=_0x58f555||0xc8;return function(_0x56ce38){if(_0x56ce38){return _0x451e63['status'](_0x58f555)[_0x2519('0x1c')](_0x56ce38);}};}function respondWithFilteredResult(_0x1949bd,_0x59f649){return function(_0x37df53){if(_0x37df53){var _0x424c26=typeof _0x59f649[_0x2519('0x1d')]===_0x2519('0x1e')&&typeof _0x59f649[_0x2519('0x1f')]===_0x2519('0x1e');var _0x2a8691=_0x37df53['count'];var _0x3a5223=_0x424c26?0x0:_0x59f649[_0x2519('0x1d')];var _0x42f68a=_0x424c26?_0x37df53[_0x2519('0x20')]:_0x59f649[_0x2519('0x1d')]+_0x59f649['limit'];var _0x43c474;if(_0x42f68a>=_0x2a8691){_0x42f68a=_0x2a8691;_0x43c474=0xc8;}else{_0x43c474=0xce;}_0x1949bd[_0x2519('0x1b')](_0x43c474);return _0x1949bd[_0x2519('0x21')]('Content-Range',_0x3a5223+'-'+_0x42f68a+'/'+_0x2a8691)[_0x2519('0x1c')](_0x37df53);}return null;};}function patchUpdates(_0x1779db){return function(_0x16a3c6){try{jsonpatch[_0x2519('0x22')](_0x16a3c6,_0x1779db,!![]);}catch(_0x563de7){return BPromise[_0x2519('0x23')](_0x563de7);}return _0x16a3c6[_0x2519('0x24')]();};}function saveUpdates(_0x382a19,_0x1b03a1){return function(_0x22061d){if(_0x22061d){return _0x22061d[_0x2519('0x25')](_0x382a19)[_0x2519('0x26')](function(_0x4b507c){return _0x4b507c;});}return null;};}function removeEntity(_0x52a908,_0x8512d5){return function(_0xbc1147){if(_0xbc1147){return _0xbc1147[_0x2519('0x27')]()[_0x2519('0x26')](function(){_0x52a908['status'](0xcc)[_0x2519('0x28')]();});}};}function handleEntityNotFound(_0x340a58,_0x3f05fa){return function(_0xf62d14){if(!_0xf62d14){_0x340a58['sendStatus'](0x194);}return _0xf62d14;};}function handleError(_0x536c48,_0x292b65){_0x292b65=_0x292b65||0x1f4;return function(_0x38dbdf){logger['error'](_0x38dbdf[_0x2519('0x29')]);if(_0x38dbdf[_0x2519('0x2a')]){delete _0x38dbdf[_0x2519('0x2a')];}_0x536c48[_0x2519('0x1b')](_0x292b65)['send'](_0x38dbdf);};}exports[_0x2519('0x2b')]=function(_0x429ca5,_0x5f0a4c){var _0x556c64={},_0x393bad={},_0x33ddff={'count':0x0,'rows':[]};var _0x3a37e8=_[_0x2519('0x2c')](db['ChatInternalMessage'][_0x2519('0x2d')],function(_0x20ba66){return{'name':_0x20ba66[_0x2519('0x2e')],'type':_0x20ba66[_0x2519('0x2f')][_0x2519('0x30')]};});_0x393bad['model']=_[_0x2519('0x2c')](_0x3a37e8,_0x2519('0x2a'));_0x393bad[_0x2519('0x31')]=_['keys'](_0x429ca5[_0x2519('0x31')]);_0x393bad[_0x2519('0x32')]=_[_0x2519('0x33')](_0x393bad[_0x2519('0x34')],_0x393bad[_0x2519('0x31')]);_0x556c64[_0x2519('0x35')]=_[_0x2519('0x33')](_0x393bad[_0x2519('0x34')],qs[_0x2519('0x36')](_0x429ca5[_0x2519('0x31')][_0x2519('0x36')]));_0x556c64[_0x2519('0x35')]=_0x556c64[_0x2519('0x35')][_0x2519('0x37')]?_0x556c64[_0x2519('0x35')]:_0x393bad['model'];if(!_0x429ca5['query']['hasOwnProperty'](_0x2519('0x38'))){_0x556c64[_0x2519('0x1f')]=qs[_0x2519('0x1f')](_0x429ca5['query'][_0x2519('0x1f')]);_0x556c64[_0x2519('0x1d')]=qs[_0x2519('0x1d')](_0x429ca5['query'][_0x2519('0x1d')]);}_0x556c64[_0x2519('0x39')]=qs[_0x2519('0x3a')](_0x429ca5[_0x2519('0x31')][_0x2519('0x3a')]);_0x556c64[_0x2519('0x3b')]=qs['filters'](_[_0x2519('0x3c')](_0x429ca5[_0x2519('0x31')],_0x393bad[_0x2519('0x32')]),_0x3a37e8);if(_0x429ca5[_0x2519('0x31')]['filter']){_0x556c64[_0x2519('0x3b')]=_[_0x2519('0x3d')](_0x556c64['where'],{'$or':_[_0x2519('0x2c')](_0x3a37e8,function(_0x1bc9a6){if(_0x1bc9a6['type']!==_0x2519('0x3e')){var _0x520bde={};_0x520bde[_0x1bc9a6['name']]={'$like':'%'+_0x429ca5['query'][_0x2519('0x3f')]+'%'};return _0x520bde;}})});}_0x556c64=_['merge']({},_0x556c64,_0x429ca5['options']);var _0x5c0d9b={'where':_0x556c64['where']};return db[_0x2519('0x40')][_0x2519('0x20')](_0x5c0d9b)[_0x2519('0x26')](function(_0x552933){_0x33ddff['count']=_0x552933;if(_0x429ca5[_0x2519('0x31')][_0x2519('0x41')]){_0x556c64[_0x2519('0x42')]=[{'all':!![]}];}return db[_0x2519('0x40')]['findAll'](_0x556c64);})[_0x2519('0x26')](function(_0x2376d6){_0x33ddff['rows']=_0x2376d6;return _0x33ddff;})[_0x2519('0x26')](respondWithFilteredResult(_0x5f0a4c,_0x556c64))[_0x2519('0x43')](handleError(_0x5f0a4c,null));};exports[_0x2519('0x44')]=function(_0x1599b1,_0x189064){var _0x55fa3d={'raw':!![],'where':{'id':_0x1599b1[_0x2519('0x45')]['id']}},_0x3e7bc9={};_0x3e7bc9[_0x2519('0x34')]=_['keys'](db[_0x2519('0x40')][_0x2519('0x2d')]);_0x3e7bc9[_0x2519('0x31')]=_[_0x2519('0x46')](_0x1599b1[_0x2519('0x31')]);_0x3e7bc9[_0x2519('0x32')]=_[_0x2519('0x33')](_0x3e7bc9[_0x2519('0x34')],_0x3e7bc9['query']);_0x55fa3d['attributes']=_['intersection'](_0x3e7bc9['model'],qs[_0x2519('0x36')](_0x1599b1['query'][_0x2519('0x36')]));_0x55fa3d[_0x2519('0x35')]=_0x55fa3d[_0x2519('0x35')]['length']?_0x55fa3d[_0x2519('0x35')]:_0x3e7bc9['model'];if(_0x1599b1['query'][_0x2519('0x41')]){_0x55fa3d['include']=[{'all':!![]}];}_0x55fa3d=_[_0x2519('0x3d')]({},_0x55fa3d,_0x1599b1[_0x2519('0x47')]);return db['ChatInternalMessage'][_0x2519('0x48')](_0x55fa3d)[_0x2519('0x26')](handleEntityNotFound(_0x189064,null))['then'](respondWithResult(_0x189064,null))[_0x2519('0x43')](handleError(_0x189064,null));};exports[_0x2519('0x49')]=function(_0x11fc7d,_0x3dccec){return db['ChatInternalMessage']['create'](_0x11fc7d[_0x2519('0x4a')],{})[_0x2519('0x26')](respondWithResult(_0x3dccec,0xc9))['catch'](handleError(_0x3dccec,null));};exports[_0x2519('0x25')]=function(_0x5255f9,_0x44dcf7){if(_0x5255f9[_0x2519('0x4a')]['id']){delete _0x5255f9[_0x2519('0x4a')]['id'];}return db[_0x2519('0x40')]['find']({'where':{'id':_0x5255f9[_0x2519('0x45')]['id']}})[_0x2519('0x26')](handleEntityNotFound(_0x44dcf7,null))[_0x2519('0x26')](saveUpdates(_0x5255f9[_0x2519('0x4a')],null))[_0x2519('0x26')](respondWithResult(_0x44dcf7,null))[_0x2519('0x43')](handleError(_0x44dcf7,null));};exports[_0x2519('0x27')]=function(_0x556b88,_0xbcb7aa){return db[_0x2519('0x40')][_0x2519('0x48')]({'where':{'id':_0x556b88[_0x2519('0x45')]['id']}})[_0x2519('0x26')](handleEntityNotFound(_0xbcb7aa,null))[_0x2519('0x26')](removeEntity(_0xbcb7aa,null))[_0x2519('0x43')](handleError(_0xbcb7aa,null));};exports[_0x2519('0x4b')]=function(_0x1bfd04,_0x23ab4a){return db['ChatInternalMessage'][_0x2519('0x4b')]()[_0x2519('0x26')](respondWithResult(_0x23ab4a,null))[_0x2519('0x43')](handleError(_0x23ab4a,null));};function wrapUser(_0x27718f){return function(_0x2fe6b3){var _0x1745cf=_0x27718f[_0x2519('0x4c')]({'plain':!![]});_0x1745cf[_0x2519('0x4d')]=[];if(_0x2fe6b3){_0x1745cf[_0x2519('0x4e')]=_0x2fe6b3[_0x2519('0x4f')];_0x1745cf[_0x2519('0x50')]=_0x2fe6b3;}else{_0x1745cf[_0x2519('0x4e')]=moment(0x0)['format'](_0x2519('0x51'));_0x1745cf['lastMessage']={};}return _0x1745cf;};}exports['getUsers']=function(_0x43e5f4,_0x3fb717,_0x172b89){var _0x18cb49=[];return db['User']['findAll']({'where':{'role':['agent','admin',_0x2519('0x52')]},'attributes':['id','fullname',_0x2519('0x2a'),'role',_0x2519('0x53'),'internal','online',_0x2519('0x54'),_0x2519('0x55'),_0x2519('0x56')],'order':qs[_0x2519('0x3a')]('-online'),'include':[{'model':db[_0x2519('0x57')],'as':_0x2519('0x58'),'attributes':['id',_0x2519('0x2a'),_0x2519('0x2f')],'through':{'attributes':[]}}]})[_0x2519('0x26')](function(_0x474788){if(_0x474788){var _0x3bdfbf=_0x43e5f4['user'][_0x2519('0x4c')]({'plain':!![]});if(!_0x3bdfbf)throw new Error(_0x2519('0x59'));if(_0x3bdfbf[_0x2519('0x5a')]===_0x2519('0x52')){return db[_0x2519('0x5b')]['find']({'where':{'name':_0x2519('0x5c'),'userProfileId':_0x3bdfbf['userProfileId']},'raw':!![]})[_0x2519('0x26')](function(_0x8e8259){if(_0x8e8259){if(_0x8e8259[_0x2519('0x5d')]===0x0){return db[_0x2519('0x5e')][_0x2519('0x5f')]({'where':{'sectionId':_0x8e8259['id']},'raw':!![]})['then'](function(_0x384ac6){var _0x46a9bd=[];if(_[_0x2519('0x60')](_0x384ac6)){_0x46a9bd=_[_0x2519('0x3f')](_0x474788,function(_0x6c04a9){if(_0x6c04a9['role']!=='agent'){return _0x6c04a9;}});return _0x46a9bd;}else{for(var _0x388461=0x0;_0x388461<_0x474788[_0x2519('0x37')];_0x388461++){var _0x347f49=_0x474788[_0x388461];if(_0x347f49[_0x2519('0x5a')]===_0x2519('0x61')){var _0x4de8d5=_['find'](_0x384ac6,function(_0x2adcfe){return _0x2adcfe['resourceId']===_0x347f49['id'];});if(_0x4de8d5)_0x46a9bd[_0x2519('0x62')](_0x347f49);}else{_0x46a9bd[_0x2519('0x62')](_0x347f49);}}return _0x46a9bd;}});}else{return _0x474788;}}else{var _0x293ec9=_[_0x2519('0x3f')](_0x474788,function(_0x3dfbc8){if(_0x3dfbc8['role']!==_0x2519('0x61')){return _0x3dfbc8;}});return _0x293ec9;}});}else{return _0x474788;}}})[_0x2519('0x26')](function(_0x283d28){var _0xff57a9=[];if(_0x283d28){_0x18cb49=_0x283d28;for(var _0x356b0a=0x0;_0x356b0a<_0x283d28[_0x2519('0x37')];_0x356b0a+=0x1){_0x18cb49[_0x356b0a][_0x2519('0x4d')]=[];_0xff57a9['push'](db[_0x2519('0x40')][_0x2519('0x48')]({'where':{'FromId':[_0x43e5f4[_0x2519('0x52')]['id'],_0x283d28[_0x356b0a]['id']],'ToId':[_0x43e5f4[_0x2519('0x52')]['id'],_0x283d28[_0x356b0a]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2519('0x63'),_0x2519('0x64'),_0x2519('0x65'),_0x2519('0x4a')],'order':qs[_0x2519('0x3a')](_0x2519('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2519('0x26')](wrapUser(_0x283d28[_0x356b0a])));}return BPromise[_0x2519('0x67')](_0xff57a9);}return[];})[_0x2519('0x26')](function(_0x286889){return{'rows':_0x286889,'count':_0x286889['length']};})['then'](respondWithResult(_0x3fb717,null))[_0x2519('0x43')](handleError(_0x3fb717,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d843a40..44a8393 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 _0x8e7a=['exports','../../mysqldb','ChatInternalMessage','save','update','emit','hook'];(function(_0x2dd9b3,_0x1a705a){var _0x16db12=function(_0x5a6c64){while(--_0x5a6c64){_0x2dd9b3['push'](_0x2dd9b3['shift']());}};_0x16db12(++_0x1a705a);}(_0x8e7a,0x1ac));var _0xa8e7=function(_0x4096cb,_0x425a92){_0x4096cb=_0x4096cb-0x0;var _0x1b28ea=_0x8e7a[_0x4096cb];return _0x1b28ea;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xa8e7('0x0'))['db'][_0xa8e7('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8e7('0x2'),'afterUpdate':_0xa8e7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d400c){return function(_0x1f27f1,_0x3cb7ca,_0x16c2cb){ChatInternalMessageEvents[_0xa8e7('0x4')](_0x4d400c+':'+_0x1f27f1['id'],_0x1f27f1);ChatInternalMessageEvents['emit'](_0x4d400c,_0x1f27f1);_0x16c2cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xa8e7('0x5')](e,emitEvent(event));}}module[_0xa8e7('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xfaec=['ChatInternalMessage','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x599901,_0x414dff){var _0x212569=function(_0x13b83d){while(--_0x13b83d){_0x599901['push'](_0x599901['shift']());}};_0x212569(++_0x414dff);}(_0xfaec,0x139));var _0xcfae=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfaec[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xcfae('0x0'));var ChatInternalMessage=require(_0xcfae('0x1'))['db'][_0xcfae('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcfae('0x3'),'afterUpdate':_0xcfae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52b878){return function(_0x142688,_0x44cad5,_0xeaeb70){ChatInternalMessageEvents[_0xcfae('0x5')](_0x52b878+':'+_0x142688['id'],_0x142688);ChatInternalMessageEvents[_0xcfae('0x5')](_0x52b878,_0x142688);_0xeaeb70(null);};}for(var e in events){if(events[_0xcfae('0x6')](e)){var event=events[e];ChatInternalMessage[_0xcfae('0x7')](e,emitEvent(event));}}module[_0xcfae('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 22cd1d6..6e4000f 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 _0x08cd=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x519c18,_0x211e2b){var _0x565d8=function(_0x2d0811){while(--_0x2d0811){_0x519c18['push'](_0x519c18['shift']());}};_0x565d8(++_0x211e2b);}(_0x08cd,0xe0));var _0xd08c=function(_0x1d4909,_0x1030a9){_0x1d4909=_0x1d4909-0x0;var _0x480608=_0x08cd[_0x1d4909];return _0x480608;};'use strict';var _=require(_0xd08c('0x0'));var util=require(_0xd08c('0x1'));var logger=require(_0xd08c('0x2'))(_0xd08c('0x3'));var moment=require('moment');var BPromise=require(_0xd08c('0x4'));var rp=require(_0xd08c('0x5'));var fs=require('fs');var path=require(_0xd08c('0x6'));var rimraf=require('rimraf');var config=require(_0xd08c('0x7'));var attributes=require(_0xd08c('0x8'));module['exports']=function(_0x40c62c,_0x36961e){return _0x40c62c[_0xd08c('0x9')](_0xd08c('0xa'),attributes,{'tableName':_0xd08c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd08c('0xc'),'collate':_0xd08c('0xd')});}; \ No newline at end of file +var _0x79ec=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','exports','define'];(function(_0x2aff86,_0x213964){var _0xb63464=function(_0x3e024b){while(--_0x3e024b){_0x2aff86['push'](_0x2aff86['shift']());}};_0xb63464(++_0x213964);}(_0x79ec,0x1bf));var _0xc79e=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0x79ec[_0x458edc];return _0x44af29;};'use strict';var _=require('lodash');var util=require(_0xc79e('0x0'));var logger=require('../../config/logger')(_0xc79e('0x1'));var moment=require(_0xc79e('0x2'));var BPromise=require(_0xc79e('0x3'));var rp=require(_0xc79e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc79e('0x5'));var config=require('../../config/environment');var attributes=require(_0xc79e('0x6'));module[_0xc79e('0x7')]=function(_0x27da3c,_0x5a5610){return _0x27da3c[_0xc79e('0x8')](_0xc79e('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc79e('0xa'),'collate':_0xc79e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 57620db..770b2b0 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 _0xaf59=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf59,0xdc));var _0x9af5=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xaf59[_0x3fe6df];return _0x372a0e;};'use strict';var _=require(_0x9af5('0x0'));var util=require(_0x9af5('0x1'));var moment=require(_0x9af5('0x2'));var BPromise=require(_0x9af5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9af5('0x4'));var db=require(_0x9af5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9af5('0x6'))(_0x9af5('0x7'));var config=require(_0x9af5('0x8'));var jayson=require(_0x9af5('0x9'));var client=jayson[_0x9af5('0xa')]['http']({'port':0x232a});config[_0x9af5('0xb')]=_[_0x9af5('0xc')](config[_0x9af5('0xb')],{'host':_0x9af5('0xd'),'port':0x18eb});var socket=require(_0x9af5('0xe'))(new Redis(config[_0x9af5('0xb')]));require('./chatInternalMessage.socket')[_0x9af5('0xf')](socket);function respondWithRpcPromise(_0x5604f3,_0x49fc28,_0xac60fd){return new BPromise(function(_0x34da03,_0x2ab97f){return client[_0x9af5('0x10')](_0x5604f3,_0xac60fd)[_0x9af5('0x11')](function(_0x57056a){logger[_0x9af5('0x12')](_0x9af5('0x13'),_0x49fc28,_0x9af5('0x14'));logger[_0x9af5('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x49fc28,'request\x20sent',JSON[_0x9af5('0x16')](_0x57056a));if(_0x57056a['error']){if(_0x57056a[_0x9af5('0x17')][_0x9af5('0x18')]===0x1f4){logger[_0x9af5('0x17')](_0x9af5('0x13'),_0x49fc28,_0x57056a[_0x9af5('0x17')]['message']);return _0x2ab97f(_0x57056a[_0x9af5('0x17')][_0x9af5('0x19')]);}logger[_0x9af5('0x17')](_0x9af5('0x13'),_0x49fc28,_0x57056a['error'][_0x9af5('0x19')]);return _0x34da03(_0x57056a[_0x9af5('0x17')][_0x9af5('0x19')]);}else{logger[_0x9af5('0x12')](_0x9af5('0x13'),_0x49fc28,'request\x20sent');_0x34da03(_0x57056a[_0x9af5('0x1a')][_0x9af5('0x19')]);}})[_0x9af5('0x1b')](function(_0x20bd6c){logger['error'](_0x9af5('0x13'),_0x49fc28,_0x20bd6c);_0x2ab97f(_0x20bd6c);});});} \ No newline at end of file +var _0xf4e5=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x314565,_0x233ee6){_0x314565=_0x314565-0x0;var _0x54acc1=_0xf4e5[_0x314565];return _0x54acc1;};'use strict';var _=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var moment=require(_0x5f4e('0x2'));var BPromise=require(_0x5f4e('0x3'));var rs=require(_0x5f4e('0x4'));var fs=require('fs');var Redis=require(_0x5f4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f4e('0x6'))(_0x5f4e('0x7'));var config=require(_0x5f4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f4e('0x9')][_0x5f4e('0xa')]({'port':0x232a});config[_0x5f4e('0xb')]=_[_0x5f4e('0xc')](config[_0x5f4e('0xb')],{'host':_0x5f4e('0xd'),'port':0x18eb});var socket=require(_0x5f4e('0xe'))(new Redis(config[_0x5f4e('0xb')]));require(_0x5f4e('0xf'))['register'](socket);function respondWithRpcPromise(_0x553d3e,_0x1f27b7,_0xa89bfe){return new BPromise(function(_0x434957,_0x4e227a){return client[_0x5f4e('0x10')](_0x553d3e,_0xa89bfe)[_0x5f4e('0x11')](function(_0x1d0060){logger[_0x5f4e('0x12')](_0x5f4e('0x13'),_0x1f27b7,_0x5f4e('0x14'));logger[_0x5f4e('0x15')](_0x5f4e('0x16'),_0x1f27b7,_0x5f4e('0x14'),JSON[_0x5f4e('0x17')](_0x1d0060));if(_0x1d0060[_0x5f4e('0x18')]){if(_0x1d0060['error'][_0x5f4e('0x19')]===0x1f4){logger[_0x5f4e('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1f27b7,_0x1d0060[_0x5f4e('0x18')][_0x5f4e('0x1a')]);return _0x4e227a(_0x1d0060[_0x5f4e('0x18')]['message']);}logger[_0x5f4e('0x18')](_0x5f4e('0x13'),_0x1f27b7,_0x1d0060[_0x5f4e('0x18')]['message']);return _0x434957(_0x1d0060[_0x5f4e('0x18')][_0x5f4e('0x1a')]);}else{logger['info'](_0x5f4e('0x13'),_0x1f27b7,_0x5f4e('0x14'));_0x434957(_0x1d0060[_0x5f4e('0x1b')][_0x5f4e('0x1a')]);}})[_0x5f4e('0x1c')](function(_0x540920){logger[_0x5f4e('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1f27b7,_0x540920);_0x4e227a(_0x540920);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 119391f..ff60cbc 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 _0x1496=['remove','update','emit','removeListener','register'];(function(_0x254672,_0x20c7c1){var _0x586f40=function(_0x44a8a6){while(--_0x44a8a6){_0x254672['push'](_0x254672['shift']());}};_0x586f40(++_0x20c7c1);}(_0x1496,0x82));var _0x6149=function(_0x1356fc,_0x113d2e){_0x1356fc=_0x1356fc-0x0;var _0x388376=_0x1496[_0x1356fc];return _0x388376;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x6149('0x0'),_0x6149('0x1')];function createListener(_0x5e1ef6,_0x122cc3){return function(_0x21c34a){_0x122cc3[_0x6149('0x2')](_0x5e1ef6,_0x21c34a);};}function removeListener(_0x33105c,_0x5efd3d){return function(){ChatInternalMessageEvents[_0x6149('0x3')](_0x33105c,_0x5efd3d);};}exports[_0x6149('0x4')]=function(_0x39d0e0){for(var _0x28d330=0x0,_0x2512fd=events['length'];_0x28d330<_0x2512fd;_0x28d330++){var _0xcf53ec=events[_0x28d330];var _0x3d1e54=createListener('chatInternalMessage:'+_0xcf53ec,_0x39d0e0);ChatInternalMessageEvents['on'](_0xcf53ec,_0x3d1e54);}}; \ No newline at end of file +var _0x10ec=['./chatInternalMessage.events','save','remove','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x10ec,0x110));var _0xc10e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x10ec[_0x5d6456];return _0x4d66c1;};'use strict';var ChatInternalMessageEvents=require(_0xc10e('0x0'));var events=[_0xc10e('0x1'),_0xc10e('0x2'),'update'];function createListener(_0xac748b,_0x21e1d8){return function(_0xcae70b){_0x21e1d8[_0xc10e('0x3')](_0xac748b,_0xcae70b);};}function removeListener(_0xc778c9,_0x570598){return function(){ChatInternalMessageEvents[_0xc10e('0x4')](_0xc778c9,_0x570598);};}exports[_0xc10e('0x5')]=function(_0x58917a){for(var _0x3f82a8=0x0,_0x2894b0=events[_0xc10e('0x6')];_0x3f82a8<_0x2894b0;_0x3f82a8++){var _0x373be8=events[_0x3f82a8];var _0x522c04=createListener(_0xc10e('0x7')+_0x373be8,_0x58917a);ChatInternalMessageEvents['on'](_0x373be8,_0x522c04);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 95207b4..0f8416e 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 _0xa58d=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','isAuthenticated','index','/describe','describe','/users','getUsers','get','show','post','put','/:id','update','delete'];(function(_0x3fc9a3,_0x223b97){var _0x1670cc=function(_0x48f555){while(--_0x48f555){_0x3fc9a3['push'](_0x3fc9a3['shift']());}};_0x1670cc(++_0x223b97);}(_0xa58d,0x182));var _0xda58=function(_0x526ca4,_0x19244f){_0x526ca4=_0x526ca4-0x0;var _0x357e7d=_0xa58d[_0x526ca4];return _0x357e7d;};'use strict';var multer=require(_0xda58('0x0'));var util=require(_0xda58('0x1'));var path=require(_0xda58('0x2'));var timeout=require(_0xda58('0x3'));var express=require(_0xda58('0x4'));var router=express[_0xda58('0x5')]();var fs_extra=require(_0xda58('0x6'));var auth=require(_0xda58('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xda58('0x8'));router['get']('/',auth[_0xda58('0x9')](),controller[_0xda58('0xa')]);router['get'](_0xda58('0xb'),auth['isAuthenticated'](),controller[_0xda58('0xc')]);router['get'](_0xda58('0xd'),auth[_0xda58('0x9')](),controller[_0xda58('0xe')]);router[_0xda58('0xf')]('/:id',auth[_0xda58('0x9')](),controller[_0xda58('0x10')]);router[_0xda58('0x11')]('/',auth[_0xda58('0x9')](),controller['create']);router[_0xda58('0x12')](_0xda58('0x13'),controller[_0xda58('0x14')]);router[_0xda58('0x15')](_0xda58('0x13'),auth['isAuthenticated'](),controller[_0xda58('0x16')]);module[_0xda58('0x17')]=router; \ No newline at end of file +var _0xbe3e=['./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x48f801,_0x1cc751){var _0x1e5ecb=function(_0x55587d){while(--_0x55587d){_0x48f801['push'](_0x48f801['shift']());}};_0x1e5ecb(++_0x1cc751);}(_0xbe3e,0x1b0));var _0xebe3=function(_0x4f6eb2,_0x4f3253){_0x4f6eb2=_0x4f6eb2-0x0;var _0x128bab=_0xbe3e[_0x4f6eb2];return _0x128bab;};'use strict';var multer=require(_0xebe3('0x0'));var util=require(_0xebe3('0x1'));var path=require(_0xebe3('0x2'));var timeout=require(_0xebe3('0x3'));var express=require(_0xebe3('0x4'));var router=express[_0xebe3('0x5')]();var fs_extra=require(_0xebe3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xebe3('0x7'));var config=require('../../config/environment');var controller=require(_0xebe3('0x8'));router[_0xebe3('0x9')]('/',auth[_0xebe3('0xa')](),controller['index']);router[_0xebe3('0x9')](_0xebe3('0xb'),auth[_0xebe3('0xa')](),controller[_0xebe3('0xc')]);router[_0xebe3('0x9')](_0xebe3('0xd'),auth[_0xebe3('0xa')](),controller[_0xebe3('0xe')]);router[_0xebe3('0x9')](_0xebe3('0xf'),auth[_0xebe3('0xa')](),controller['show']);router['post']('/',auth[_0xebe3('0xa')](),controller['create']);router[_0xebe3('0x10')](_0xebe3('0xf'),controller[_0xebe3('0x11')]);router[_0xebe3('0x12')](_0xebe3('0xf'),auth[_0xebe3('0xa')](),controller['destroy']);module[_0xebe3('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2758897..8935263 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 _0x58a4=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5f3682,_0x4b7615){var _0x341dd7=function(_0x5b5c9d){while(--_0x5b5c9d){_0x5f3682['push'](_0x5f3682['shift']());}};_0x341dd7(++_0x4b7615);}(_0x58a4,0xbf));var _0x458a=function(_0x54cd0b,_0x182ab9){_0x54cd0b=_0x54cd0b-0x0;var _0x2dbfb7=_0x58a4[_0x54cd0b];return _0x2dbfb7;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'body':{'type':Sequelize[_0x458a('0x2')](_0x458a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x458a('0x5')]('in',_0x458a('0x6')),'defaultValue':_0x458a('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x458a('0x7')]},'providerName':{'type':Sequelize[_0x458a('0x8')]},'providerResponse':{'type':Sequelize[_0x458a('0x2')]}}; \ No newline at end of file +var _0xf45e=['ENUM','out','DATE','STRING','sequelize','TEXT','BOOLEAN'];(function(_0xd2eaac,_0x331cff){var _0x30495a=function(_0x5c582f){while(--_0x5c582f){_0xd2eaac['push'](_0xd2eaac['shift']());}};_0x30495a(++_0x331cff);}(_0xf45e,0x115));var _0xef45=function(_0x325aa2,_0x29bd7f){_0x325aa2=_0x325aa2-0x0;var _0x451a67=_0xf45e[_0x325aa2];return _0x451a67;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'body':{'type':Sequelize[_0xef45('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xef45('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xef45('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xef45('0x3')]('in',_0xef45('0x4')),'defaultValue':_0xef45('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xef45('0x5')]},'providerName':{'type':Sequelize[_0xef45('0x6')]},'providerResponse':{'type':Sequelize[_0xef45('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 26478ef..4111777 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 _0xf0e2=['options','includeAll','include','show','params','rawAttributes','keys','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','name','send','index','ChatMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf0e2,0xb7));var _0x2f0e=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xf0e2[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0x2f0e('0x0'));var rimraf=require(_0x2f0e('0x1'));var zipdir=require(_0x2f0e('0x2'));var jsonpatch=require(_0x2f0e('0x3'));var rp=require(_0x2f0e('0x4'));var moment=require('moment');var BPromise=require(_0x2f0e('0x5'));var Mustache=require('mustache');var util=require(_0x2f0e('0x6'));var path=require(_0x2f0e('0x7'));var sox=require(_0x2f0e('0x8'));var csv=require(_0x2f0e('0x9'));var ejs=require(_0x2f0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f0e('0xb'));var squel=require('squel');var crypto=require(_0x2f0e('0xc'));var jsforce=require(_0x2f0e('0xd'));var deskjs=require(_0x2f0e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2f0e('0xf'));var Papa=require(_0x2f0e('0x10'));var Redis=require('ioredis');var authService=require(_0x2f0e('0x11'));var qs=require(_0x2f0e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f0e('0x13'))(_0x2f0e('0x14'));var utils=require('../../config/utils');var config=require(_0x2f0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f0e('0x16'))['db'];config[_0x2f0e('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2f0e('0x18'))(new Redis(config[_0x2f0e('0x17')]));require(_0x2f0e('0x19'))['register'](socket);var jayson=require(_0x2f0e('0x1a'));var client=jayson['client'][_0x2f0e('0x1b')]({'port':0x232c});var client9002=jayson[_0x2f0e('0x1c')][_0x2f0e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x17f3af,_0x259385,_0x350b62,_0x2acdbe){return new BPromise(function(_0x168af5,_0x290b01){var _0x2ca6ce=_0x2acdbe||client;return _0x2ca6ce['request'](_0x17f3af,_0x350b62)[_0x2f0e('0x1d')](function(_0x522672){logger[_0x2f0e('0x1e')](_0x2f0e('0x1f'),_0x259385,_0x2f0e('0x20'));logger[_0x2f0e('0x21')](_0x2f0e('0x22'),_0x259385,_0x2f0e('0x20'),JSON['stringify'](_0x522672));if(_0x522672[_0x2f0e('0x23')]){if(_0x522672['error'][_0x2f0e('0x24')]===0x1f4){logger[_0x2f0e('0x23')](_0x2f0e('0x1f'),_0x259385,_0x522672[_0x2f0e('0x23')][_0x2f0e('0x25')]);return _0x290b01(_0x522672[_0x2f0e('0x23')][_0x2f0e('0x25')]);}logger[_0x2f0e('0x23')](_0x2f0e('0x1f'),_0x259385,_0x522672[_0x2f0e('0x23')][_0x2f0e('0x25')]);return _0x168af5(_0x522672['error'][_0x2f0e('0x25')]);}else{logger[_0x2f0e('0x1e')](_0x2f0e('0x1f'),_0x259385,'request\x20sent');_0x168af5(_0x522672[_0x2f0e('0x26')][_0x2f0e('0x25')]);}})[_0x2f0e('0x27')](function(_0x4ccfb4){logger[_0x2f0e('0x23')](_0x2f0e('0x1f'),_0x259385,_0x4ccfb4);_0x290b01(_0x4ccfb4);});});}function respondWithStatusCode(_0x532913,_0x53a700){_0x53a700=_0x53a700||0xcc;return function(_0x46720){if(_0x46720){return _0x532913[_0x2f0e('0x28')](_0x53a700);}return _0x532913[_0x2f0e('0x29')](_0x53a700)['end']();};}function respondWithResult(_0x16b242,_0x2f8997){_0x2f8997=_0x2f8997||0xc8;return function(_0x2a981c){if(_0x2a981c){return _0x16b242[_0x2f0e('0x29')](_0x2f8997)[_0x2f0e('0x2a')](_0x2a981c);}};}function respondWithFilteredResult(_0x397d1a,_0x56ea59){return function(_0x31a0ac){if(_0x31a0ac){var _0x5200da=typeof _0x56ea59[_0x2f0e('0x2b')]===_0x2f0e('0x2c')&&typeof _0x56ea59[_0x2f0e('0x2d')]==='undefined';var _0x545a2e=_0x31a0ac['count'];var _0x4212d2=_0x5200da?0x0:_0x56ea59[_0x2f0e('0x2b')];var _0xccea18=_0x5200da?_0x31a0ac[_0x2f0e('0x2e')]:_0x56ea59[_0x2f0e('0x2b')]+_0x56ea59['limit'];var _0x453814;if(_0xccea18>=_0x545a2e){_0xccea18=_0x545a2e;_0x453814=0xc8;}else{_0x453814=0xce;}_0x397d1a[_0x2f0e('0x29')](_0x453814);return _0x397d1a[_0x2f0e('0x2f')](_0x2f0e('0x30'),_0x4212d2+'-'+_0xccea18+'/'+_0x545a2e)[_0x2f0e('0x2a')](_0x31a0ac);}return null;};}function patchUpdates(_0x1b9448){return function(_0x103d17){try{jsonpatch[_0x2f0e('0x31')](_0x103d17,_0x1b9448,!![]);}catch(_0x54bf3b){return BPromise[_0x2f0e('0x32')](_0x54bf3b);}return _0x103d17[_0x2f0e('0x33')]();};}function saveUpdates(_0x42d9d3,_0x1c3969){return function(_0x26df7d){if(_0x26df7d){return _0x26df7d[_0x2f0e('0x34')](_0x42d9d3)[_0x2f0e('0x1d')](function(_0x25f83c){return _0x25f83c;});}return null;};}function removeEntity(_0x3fcc20,_0x46b5d9){return function(_0x1124b6){if(_0x1124b6){return _0x1124b6[_0x2f0e('0x35')]()[_0x2f0e('0x1d')](function(){_0x3fcc20[_0x2f0e('0x29')](0xcc)[_0x2f0e('0x36')]();});}};}function handleEntityNotFound(_0x114950,_0x3928c5){return function(_0x71bc5){if(!_0x71bc5){_0x114950['sendStatus'](0x194);}return _0x71bc5;};}function handleError(_0x116679,_0x41c98b){_0x41c98b=_0x41c98b||0x1f4;return function(_0x13abb9){logger['error'](_0x13abb9['stack']);if(_0x13abb9['name']){delete _0x13abb9[_0x2f0e('0x37')];}_0x116679[_0x2f0e('0x29')](_0x41c98b)[_0x2f0e('0x38')](_0x13abb9);};}exports[_0x2f0e('0x39')]=function(_0x1979f5,_0x2e04d7){var _0xb8bcdf={},_0xdd71b9={},_0x3d7fa2={'count':0x0,'rows':[]};var _0x9b7f2a=_['map'](db[_0x2f0e('0x3a')]['rawAttributes'],function(_0x4d76d9){return{'name':_0x4d76d9[_0x2f0e('0x3b')],'type':_0x4d76d9[_0x2f0e('0x3c')][_0x2f0e('0x3d')]};});_0xdd71b9[_0x2f0e('0x3e')]=_['map'](_0x9b7f2a,_0x2f0e('0x37'));_0xdd71b9[_0x2f0e('0x3f')]=_['keys'](_0x1979f5[_0x2f0e('0x3f')]);_0xdd71b9[_0x2f0e('0x40')]=_[_0x2f0e('0x41')](_0xdd71b9[_0x2f0e('0x3e')],_0xdd71b9[_0x2f0e('0x3f')]);_0xb8bcdf['attributes']=_['intersection'](_0xdd71b9[_0x2f0e('0x3e')],qs[_0x2f0e('0x42')](_0x1979f5[_0x2f0e('0x3f')][_0x2f0e('0x42')]));_0xb8bcdf[_0x2f0e('0x43')]=_0xb8bcdf[_0x2f0e('0x43')][_0x2f0e('0x44')]?_0xb8bcdf[_0x2f0e('0x43')]:_0xdd71b9[_0x2f0e('0x3e')];if(!_0x1979f5['query'][_0x2f0e('0x45')](_0x2f0e('0x46'))){_0xb8bcdf[_0x2f0e('0x2d')]=qs['limit'](_0x1979f5[_0x2f0e('0x3f')][_0x2f0e('0x2d')]);_0xb8bcdf[_0x2f0e('0x2b')]=qs[_0x2f0e('0x2b')](_0x1979f5['query']['offset']);}_0xb8bcdf[_0x2f0e('0x47')]=qs[_0x2f0e('0x48')](_0x1979f5[_0x2f0e('0x3f')]['sort']);_0xb8bcdf['where']=qs['filters'](_[_0x2f0e('0x49')](_0x1979f5[_0x2f0e('0x3f')],_0xdd71b9['filters']),_0x9b7f2a);if(_0x1979f5[_0x2f0e('0x3f')][_0x2f0e('0x4a')]){_0xb8bcdf[_0x2f0e('0x4b')]=_[_0x2f0e('0x4c')](_0xb8bcdf[_0x2f0e('0x4b')],{'$or':_[_0x2f0e('0x4d')](_0x9b7f2a,function(_0x468668){if(_0x468668['type']!==_0x2f0e('0x4e')){var _0x3aae86={};_0x3aae86[_0x468668['name']]={'$like':'%'+_0x1979f5['query'][_0x2f0e('0x4a')]+'%'};return _0x3aae86;}})});}_0xb8bcdf=_[_0x2f0e('0x4c')]({},_0xb8bcdf,_0x1979f5[_0x2f0e('0x4f')]);var _0x148dea={'where':_0xb8bcdf[_0x2f0e('0x4b')]};return db[_0x2f0e('0x3a')][_0x2f0e('0x2e')](_0x148dea)[_0x2f0e('0x1d')](function(_0x361468){_0x3d7fa2[_0x2f0e('0x2e')]=_0x361468;if(_0x1979f5[_0x2f0e('0x3f')][_0x2f0e('0x50')]){_0xb8bcdf[_0x2f0e('0x51')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xb8bcdf);})['then'](function(_0x3665d3){_0x3d7fa2['rows']=_0x3665d3;return _0x3d7fa2;})[_0x2f0e('0x1d')](respondWithFilteredResult(_0x2e04d7,_0xb8bcdf))[_0x2f0e('0x27')](handleError(_0x2e04d7,null));};exports[_0x2f0e('0x52')]=function(_0x4f9c4a,_0x256fab){var _0x4b353d={'raw':!![],'where':{'id':_0x4f9c4a[_0x2f0e('0x53')]['id']}},_0x2bfb2e={};_0x2bfb2e[_0x2f0e('0x3e')]=_['keys'](db['ChatMessage'][_0x2f0e('0x54')]);_0x2bfb2e[_0x2f0e('0x3f')]=_[_0x2f0e('0x55')](_0x4f9c4a[_0x2f0e('0x3f')]);_0x2bfb2e[_0x2f0e('0x40')]=_['intersection'](_0x2bfb2e[_0x2f0e('0x3e')],_0x2bfb2e[_0x2f0e('0x3f')]);_0x4b353d['attributes']=_[_0x2f0e('0x41')](_0x2bfb2e[_0x2f0e('0x3e')],qs[_0x2f0e('0x42')](_0x4f9c4a[_0x2f0e('0x3f')]['fields']));_0x4b353d['attributes']=_0x4b353d[_0x2f0e('0x43')]['length']?_0x4b353d[_0x2f0e('0x43')]:_0x2bfb2e[_0x2f0e('0x3e')];if(_0x4f9c4a[_0x2f0e('0x3f')][_0x2f0e('0x50')]){_0x4b353d[_0x2f0e('0x51')]=[{'all':!![]}];}_0x4b353d=_[_0x2f0e('0x4c')]({},_0x4b353d,_0x4f9c4a['options']);return db['ChatMessage'][_0x2f0e('0x56')](_0x4b353d)['then'](handleEntityNotFound(_0x256fab,null))['then'](respondWithResult(_0x256fab,null))['catch'](handleError(_0x256fab,null));};exports['create']=function(_0x371a30,_0x3a3522){return db[_0x2f0e('0x3a')][_0x2f0e('0x57')](_0x371a30[_0x2f0e('0x58')],{})['then'](respondWithResult(_0x3a3522,0xc9))[_0x2f0e('0x27')](handleError(_0x3a3522,null));};exports['update']=function(_0x3b389d,_0x855732){if(_0x3b389d[_0x2f0e('0x58')]['id']){delete _0x3b389d['body']['id'];}return db[_0x2f0e('0x3a')]['find']({'where':{'id':_0x3b389d[_0x2f0e('0x53')]['id']}})[_0x2f0e('0x1d')](handleEntityNotFound(_0x855732,null))['then'](saveUpdates(_0x3b389d[_0x2f0e('0x58')],null))[_0x2f0e('0x1d')](respondWithResult(_0x855732,null))['catch'](handleError(_0x855732,null));};exports['destroy']=function(_0x53488b,_0xe7ca70){return db[_0x2f0e('0x3a')]['find']({'where':{'id':_0x53488b[_0x2f0e('0x53')]['id']}})[_0x2f0e('0x1d')](handleEntityNotFound(_0xe7ca70,null))[_0x2f0e('0x1d')](removeEntity(_0xe7ca70,null))[_0x2f0e('0x27')](handleError(_0xe7ca70,null));};exports[_0x2f0e('0x59')]=function(_0x13d6ee,_0x4f8df2){return db[_0x2f0e('0x3a')][_0x2f0e('0x59')]()[_0x2f0e('0x1d')](respondWithResult(_0x4f8df2,null))[_0x2f0e('0x27')](handleError(_0x4f8df2,null));};var interaction_log=require(_0x2f0e('0x13'))('chat-interactions');exports[_0x2f0e('0x5a')]=function(_0x37e962,_0x1738d5,_0x10548b){var _0x1ccc93={'agent':{},'channel':'chat'};if(_0x37e962[_0x2f0e('0x58')]['id']){delete _0x37e962[_0x2f0e('0x58')]['id'];}_0x37e962['body'][_0x2f0e('0x5b')]=!![];_0x37e962[_0x2f0e('0x58')][_0x2f0e('0x5c')]=moment()['format'](_0x2f0e('0x5d'));_0x37e962['body'][_0x2f0e('0x5e')]=_0x37e962[_0x2f0e('0x58')]['UserId']||_0x37e962[_0x2f0e('0x5f')]['id'];_0x1ccc93[_0x2f0e('0x60')]['id']=_0x37e962[_0x2f0e('0x58')][_0x2f0e('0x5e')];return db[_0x2f0e('0x3a')][_0x2f0e('0x56')]({'where':{'id':_0x37e962[_0x2f0e('0x53')]['id'],'UserId':null}})[_0x2f0e('0x1d')](handleEntityNotFound(_0x1738d5,null))[_0x2f0e('0x1d')](saveUpdates(_0x37e962[_0x2f0e('0x58')],null))[_0x2f0e('0x1d')](function(_0x4c60c8){if(_0x4c60c8){_0x1ccc93['message']=_0x4c60c8[_0x2f0e('0x61')]({'plain':!![]});return db[_0x2f0e('0x62')]['find']({'where':{'id':_0x4c60c8[_0x2f0e('0x63')]}});}return null;})[_0x2f0e('0x1d')](handleEntityNotFound(_0x1738d5,null))[_0x2f0e('0x1d')](function(_0x5aa3a0){if(_0x5aa3a0){return _0x5aa3a0[_0x2f0e('0x34')]({'UserId':_0x37e962['body'][_0x2f0e('0x5e')],'read1stAt':_[_0x2f0e('0x64')](_0x5aa3a0['read1stAt'])?moment()[_0x2f0e('0x65')](_0x2f0e('0x5d')):undefined});}return null;})[_0x2f0e('0x1d')](function(_0x3773e7){if(_0x3773e7){_0x1ccc93[_0x2f0e('0x66')]=_0x3773e7[_0x2f0e('0x61')]({'plain':!![]});interaction_log['info'](_0x2f0e('0x67'),_0x37e962['user']['id'],_0x37e962[_0x2f0e('0x5f')][_0x2f0e('0x37')],_0x37e962['user'][_0x2f0e('0x68')],_0x1ccc93[_0x2f0e('0x66')]['id'],_0x37e962['body']?JSON[_0x2f0e('0x69')](_0x37e962[_0x2f0e('0x58')]):'null');return respondWithRpcPromise(_0x2f0e('0x6a'),'acceptMessage',_0x1ccc93);}return null;})[_0x2f0e('0x1d')](function(_0x4b6a0c){var _0x3087e2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b6a0c['message'][_0x2f0e('0x6b')];return db[_0x2f0e('0x6c')][_0x2f0e('0x3f')](_0x3087e2,{'type':db['Sequelize'][_0x2f0e('0x6d')][_0x2f0e('0x6e')],'raw':!![]})[_0x2f0e('0x1d')](function(_0x1fb4ad){return _0x1fb4ad;});})['then'](function(_0x1a719e){if(_0x1a719e){_0x1ccc93['message'][_0x2f0e('0x6f')]=_0x1a719e[0x0];if(!_0x37e962[_0x2f0e('0x58')][_0x2f0e('0x5e')])return;return db[_0x2f0e('0x70')]['find']({'where':{'id':_0x37e962[_0x2f0e('0x58')]['UserId'],'role':_0x2f0e('0x60')},'attributes':['id','name',_0x2f0e('0x71'),_0x2f0e('0x72'),_0x2f0e('0x73')],'raw':!![]});}return null;})['then'](function(_0x597ad8){if(!_0x597ad8)return null;_0x1ccc93[_0x2f0e('0x25')]['agent']=_0x597ad8;return _0x1ccc93;})[_0x2f0e('0x1d')](function(_0x47d1c4){if(_0x47d1c4){if(_0x37e962[_0x2f0e('0x58')][_0x2f0e('0x74')]){_0x1ccc93[_0x2f0e('0x25')][_0x2f0e('0x75')]=util[_0x2f0e('0x65')](_0x2f0e('0x76'),_0x37e962[_0x2f0e('0x5f')][_0x2f0e('0x37')]);_0x1ccc93[_0x2f0e('0x25')][_0x2f0e('0x77')]=_0x1ccc93[_0x2f0e('0x77')];_0x1ccc93['message'][_0x2f0e('0x78')]=_0x1ccc93[_0x2f0e('0x77')];_0x1ccc93[_0x2f0e('0x25')][_0x2f0e('0x79')]=_0x2f0e('0x5a');return respondWithRpcPromise(_0x2f0e('0x7a'),'EventManager',{'event':_0x2f0e('0x7b'),'message':_['merge'](_0x1ccc93[_0x2f0e('0x25')],JSON[_0x2f0e('0x7c')](_0x1ccc93[_0x2f0e('0x66')][_0x2f0e('0x7d')]))},client9002)[_0x2f0e('0x1d')](function(){return _0x1ccc93;});}return _0x1ccc93;}return null;})[_0x2f0e('0x1d')](respondWithResult(_0x1738d5,null))[_0x2f0e('0x27')](handleError(_0x1738d5,null));};var interaction_log=require(_0x2f0e('0x13'))(_0x2f0e('0x7e'));exports[_0x2f0e('0x32')]=function(_0x4ba9a0,_0x2d9420,_0x5ea199){var _0x43a35e={'agent':{},'channel':'chat'};if(_0x4ba9a0['body']['id']){delete _0x4ba9a0[_0x2f0e('0x58')]['id'];}_0x4ba9a0[_0x2f0e('0x58')][_0x2f0e('0x5e')]=_0x4ba9a0[_0x2f0e('0x58')][_0x2f0e('0x5e')]||_0x4ba9a0[_0x2f0e('0x5f')]['id'];_0x43a35e['agent']['id']=_0x4ba9a0['body'][_0x2f0e('0x5e')];return db[_0x2f0e('0x3a')][_0x2f0e('0x56')]({'where':{'id':_0x4ba9a0[_0x2f0e('0x53')]['id'],'UserId':null}})[_0x2f0e('0x1d')](handleEntityNotFound(_0x2d9420,null))[_0x2f0e('0x1d')](function(_0x3463b5){if(_0x3463b5){_0x43a35e['message']=_0x3463b5[_0x2f0e('0x61')]({'plain':!![]});return db[_0x2f0e('0x62')]['find']({'where':{'id':_0x3463b5['ChatInteractionId']}});}return null;})[_0x2f0e('0x1d')](handleEntityNotFound(_0x2d9420,null))[_0x2f0e('0x1d')](function(_0x8d3c50){if(_0x8d3c50){_0x43a35e[_0x2f0e('0x66')]=_0x8d3c50['get']({'plain':!![]});interaction_log[_0x2f0e('0x1e')](_0x2f0e('0x7f'),_0x4ba9a0['user']['id'],_0x4ba9a0[_0x2f0e('0x5f')][_0x2f0e('0x37')],_0x4ba9a0[_0x2f0e('0x5f')][_0x2f0e('0x68')],_0x43a35e[_0x2f0e('0x66')]['id'],_0x4ba9a0[_0x2f0e('0x58')]?JSON['stringify'](_0x4ba9a0['body']):_0x2f0e('0x80'));return respondWithRpcPromise(_0x2f0e('0x81'),_0x2f0e('0x82'),_0x43a35e);}return null;})[_0x2f0e('0x1d')](function(_0x5ef789){var _0x2fe898='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ef789['message'][_0x2f0e('0x6b')];return db[_0x2f0e('0x6c')][_0x2f0e('0x3f')](_0x2fe898,{'type':db['Sequelize']['QueryTypes'][_0x2f0e('0x6e')],'raw':!![]})[_0x2f0e('0x1d')](function(_0x45d21e){return _0x45d21e;});})[_0x2f0e('0x1d')](function(_0x3be6ca){if(_0x3be6ca){_0x43a35e[_0x2f0e('0x25')][_0x2f0e('0x6f')]=_0x3be6ca[0x0];if(!_0x4ba9a0['body'][_0x2f0e('0x5e')])return;return db[_0x2f0e('0x70')][_0x2f0e('0x56')]({'where':{'id':_0x4ba9a0[_0x2f0e('0x58')]['UserId'],'role':_0x2f0e('0x60')},'attributes':['id',_0x2f0e('0x37'),_0x2f0e('0x71'),_0x2f0e('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x152ea0){if(!_0x152ea0)return null;_0x43a35e[_0x2f0e('0x25')]['agent']=_0x152ea0;return _0x43a35e;})[_0x2f0e('0x1d')](function(_0x228bed){if(_0x228bed){_0x228bed['message'][_0x2f0e('0x75')]=util[_0x2f0e('0x65')]('SIP/%s',_0x4ba9a0['user'][_0x2f0e('0x37')]);_0x228bed[_0x2f0e('0x25')][_0x2f0e('0x77')]=_0x43a35e[_0x2f0e('0x77')];_0x228bed[_0x2f0e('0x25')][_0x2f0e('0x78')]=_0x43a35e[_0x2f0e('0x77')];_0x228bed['message']['event']=_0x2f0e('0x32');respondWithRpcPromise('EventManager',_0x2f0e('0x7a'),{'event':'rejectmessage','message':_[_0x2f0e('0x4c')](_0x43a35e[_0x2f0e('0x25')],JSON['parse'](_0x43a35e[_0x2f0e('0x66')][_0x2f0e('0x7d')]))},client9002);return _0x43a35e;}return null;})[_0x2f0e('0x1d')](respondWithResult(_0x2d9420,null))[_0x2f0e('0x27')](handleError(_0x2d9420,null));}; \ No newline at end of file +var _0x3e90=['../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','findAll','rows','params','includeAll','find','create','body','describe','chat-interactions','accept','read','readAt','format','UserId','user','agent','ChatInteractionId','isNil','read1stAt','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','event','EventManager','acceptmessage','parse','formData','chat','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','sequelize','interface','SIP/%s','motionChannel','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2d7345,_0x131853){var _0x4c6ec9=function(_0x3df5c3){while(--_0x3df5c3){_0x2d7345['push'](_0x2d7345['shift']());}};_0x4c6ec9(++_0x131853);}(_0x3e90,0xf0));var _0x03e9=function(_0x499caf,_0x34744f){_0x499caf=_0x499caf-0x0;var _0x47b9bb=_0x3e90[_0x499caf];return _0x47b9bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03e9('0x1'));var rp=require(_0x03e9('0x2'));var moment=require(_0x03e9('0x3'));var BPromise=require(_0x03e9('0x4'));var Mustache=require(_0x03e9('0x5'));var util=require(_0x03e9('0x6'));var path=require(_0x03e9('0x7'));var sox=require(_0x03e9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03e9('0x9'));var squel=require(_0x03e9('0xa'));var crypto=require('crypto');var jsforce=require(_0x03e9('0xb'));var deskjs=require(_0x03e9('0xc'));var toCsv=require(_0x03e9('0xd'));var querystring=require('querystring');var Papa=require(_0x03e9('0xe'));var Redis=require(_0x03e9('0xf'));var authService=require(_0x03e9('0x10'));var qs=require(_0x03e9('0x11'));var as=require(_0x03e9('0x12'));var hardwareService=require(_0x03e9('0x13'));var logger=require(_0x03e9('0x14'))(_0x03e9('0x15'));var utils=require(_0x03e9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x03e9('0x17'));var db=require(_0x03e9('0x18'))['db'];config['redis']=_[_0x03e9('0x19')](config[_0x03e9('0x1a')],{'host':_0x03e9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03e9('0x1a')]));require(_0x03e9('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x03e9('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x03e9('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7fb436,_0x1602bf,_0x315fa5,_0x588185){return new BPromise(function(_0xda4569,_0x5ed953){var _0x3c5737=_0x588185||client;return _0x3c5737[_0x03e9('0x1e')](_0x7fb436,_0x315fa5)[_0x03e9('0x1f')](function(_0x15053a){logger[_0x03e9('0x20')](_0x03e9('0x21'),_0x1602bf,_0x03e9('0x22'));logger[_0x03e9('0x23')](_0x03e9('0x24'),_0x1602bf,_0x03e9('0x22'),JSON['stringify'](_0x15053a));if(_0x15053a[_0x03e9('0x25')]){if(_0x15053a[_0x03e9('0x25')]['code']===0x1f4){logger[_0x03e9('0x25')](_0x03e9('0x21'),_0x1602bf,_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);return _0x5ed953(_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);}logger[_0x03e9('0x25')](_0x03e9('0x21'),_0x1602bf,_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);return _0xda4569(_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);}else{logger[_0x03e9('0x20')](_0x03e9('0x21'),_0x1602bf,_0x03e9('0x22'));_0xda4569(_0x15053a['result'][_0x03e9('0x26')]);}})[_0x03e9('0x27')](function(_0x16996e){logger[_0x03e9('0x25')](_0x03e9('0x21'),_0x1602bf,_0x16996e);_0x5ed953(_0x16996e);});});}function respondWithStatusCode(_0x16558a,_0x1ed055){_0x1ed055=_0x1ed055||0xcc;return function(_0xfc6f66){if(_0xfc6f66){return _0x16558a[_0x03e9('0x28')](_0x1ed055);}return _0x16558a[_0x03e9('0x29')](_0x1ed055)[_0x03e9('0x2a')]();};}function respondWithResult(_0x555b02,_0x4e8ed8){_0x4e8ed8=_0x4e8ed8||0xc8;return function(_0x299ed9){if(_0x299ed9){return _0x555b02['status'](_0x4e8ed8)[_0x03e9('0x2b')](_0x299ed9);}};}function respondWithFilteredResult(_0x24e6bb,_0x3ea37a){return function(_0x13150d){if(_0x13150d){var _0x1d172a=typeof _0x3ea37a[_0x03e9('0x2c')]===_0x03e9('0x2d')&&typeof _0x3ea37a[_0x03e9('0x2e')]===_0x03e9('0x2d');var _0x1fadbe=_0x13150d[_0x03e9('0x2f')];var _0x1a441d=_0x1d172a?0x0:_0x3ea37a[_0x03e9('0x2c')];var _0x50a2bf=_0x1d172a?_0x13150d[_0x03e9('0x2f')]:_0x3ea37a[_0x03e9('0x2c')]+_0x3ea37a['limit'];var _0xd62754;if(_0x50a2bf>=_0x1fadbe){_0x50a2bf=_0x1fadbe;_0xd62754=0xc8;}else{_0xd62754=0xce;}_0x24e6bb[_0x03e9('0x29')](_0xd62754);return _0x24e6bb['set'](_0x03e9('0x30'),_0x1a441d+'-'+_0x50a2bf+'/'+_0x1fadbe)[_0x03e9('0x2b')](_0x13150d);}return null;};}function patchUpdates(_0x139ad0){return function(_0xc11e66){try{jsonpatch[_0x03e9('0x31')](_0xc11e66,_0x139ad0,!![]);}catch(_0x20fa63){return BPromise[_0x03e9('0x32')](_0x20fa63);}return _0xc11e66[_0x03e9('0x33')]();};}function saveUpdates(_0x5e3ce6,_0x47b0c3){return function(_0x2f36ec){if(_0x2f36ec){return _0x2f36ec[_0x03e9('0x34')](_0x5e3ce6)[_0x03e9('0x1f')](function(_0x2bb373){return _0x2bb373;});}return null;};}function removeEntity(_0x5cde5c,_0x62c9fb){return function(_0x4f0aca){if(_0x4f0aca){return _0x4f0aca[_0x03e9('0x35')]()[_0x03e9('0x1f')](function(){_0x5cde5c['status'](0xcc)[_0x03e9('0x2a')]();});}};}function handleEntityNotFound(_0x3273d5,_0x120af8){return function(_0x115ba1){if(!_0x115ba1){_0x3273d5[_0x03e9('0x28')](0x194);}return _0x115ba1;};}function handleError(_0x597165,_0x4afc46){_0x4afc46=_0x4afc46||0x1f4;return function(_0x3a02fb){logger[_0x03e9('0x25')](_0x3a02fb[_0x03e9('0x36')]);if(_0x3a02fb['name']){delete _0x3a02fb[_0x03e9('0x37')];}_0x597165[_0x03e9('0x29')](_0x4afc46)[_0x03e9('0x38')](_0x3a02fb);};}exports[_0x03e9('0x39')]=function(_0x3520cc,_0x2cdf6b){var _0x2137e1={},_0x25bdba={},_0x12f094={'count':0x0,'rows':[]};var _0x162ac3=_[_0x03e9('0x3a')](db['ChatMessage'][_0x03e9('0x3b')],function(_0xce94fb){return{'name':_0xce94fb[_0x03e9('0x3c')],'type':_0xce94fb[_0x03e9('0x3d')][_0x03e9('0x3e')]};});_0x25bdba[_0x03e9('0x3f')]=_[_0x03e9('0x3a')](_0x162ac3,_0x03e9('0x37'));_0x25bdba['query']=_[_0x03e9('0x40')](_0x3520cc['query']);_0x25bdba[_0x03e9('0x41')]=_[_0x03e9('0x42')](_0x25bdba[_0x03e9('0x3f')],_0x25bdba[_0x03e9('0x43')]);_0x2137e1[_0x03e9('0x44')]=_['intersection'](_0x25bdba[_0x03e9('0x3f')],qs[_0x03e9('0x45')](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x45')]));_0x2137e1[_0x03e9('0x44')]=_0x2137e1['attributes'][_0x03e9('0x46')]?_0x2137e1[_0x03e9('0x44')]:_0x25bdba[_0x03e9('0x3f')];if(!_0x3520cc[_0x03e9('0x43')][_0x03e9('0x47')](_0x03e9('0x48'))){_0x2137e1['limit']=qs[_0x03e9('0x2e')](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x2e')]);_0x2137e1[_0x03e9('0x2c')]=qs[_0x03e9('0x2c')](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x2c')]);}_0x2137e1['order']=qs['sort'](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x49')]);_0x2137e1[_0x03e9('0x4a')]=qs[_0x03e9('0x41')](_[_0x03e9('0x4b')](_0x3520cc[_0x03e9('0x43')],_0x25bdba[_0x03e9('0x41')]),_0x162ac3);if(_0x3520cc[_0x03e9('0x43')][_0x03e9('0x4c')]){_0x2137e1[_0x03e9('0x4a')]=_[_0x03e9('0x4d')](_0x2137e1[_0x03e9('0x4a')],{'$or':_[_0x03e9('0x3a')](_0x162ac3,function(_0x38d3b7){if(_0x38d3b7[_0x03e9('0x3d')]!==_0x03e9('0x4e')){var _0x4f5a0f={};_0x4f5a0f[_0x38d3b7['name']]={'$like':'%'+_0x3520cc[_0x03e9('0x43')][_0x03e9('0x4c')]+'%'};return _0x4f5a0f;}})});}_0x2137e1=_['merge']({},_0x2137e1,_0x3520cc[_0x03e9('0x4f')]);var _0x118af2={'where':_0x2137e1['where']};return db[_0x03e9('0x50')]['count'](_0x118af2)[_0x03e9('0x1f')](function(_0x18071a){_0x12f094['count']=_0x18071a;if(_0x3520cc[_0x03e9('0x43')]['includeAll']){_0x2137e1['include']=[{'all':!![]}];}return db[_0x03e9('0x50')][_0x03e9('0x51')](_0x2137e1);})[_0x03e9('0x1f')](function(_0x352755){_0x12f094[_0x03e9('0x52')]=_0x352755;return _0x12f094;})[_0x03e9('0x1f')](respondWithFilteredResult(_0x2cdf6b,_0x2137e1))[_0x03e9('0x27')](handleError(_0x2cdf6b,null));};exports['show']=function(_0x497372,_0x157295){var _0x49c815={'raw':!![],'where':{'id':_0x497372[_0x03e9('0x53')]['id']}},_0x219b7a={};_0x219b7a[_0x03e9('0x3f')]=_[_0x03e9('0x40')](db[_0x03e9('0x50')][_0x03e9('0x3b')]);_0x219b7a[_0x03e9('0x43')]=_[_0x03e9('0x40')](_0x497372[_0x03e9('0x43')]);_0x219b7a['filters']=_['intersection'](_0x219b7a['model'],_0x219b7a[_0x03e9('0x43')]);_0x49c815['attributes']=_[_0x03e9('0x42')](_0x219b7a[_0x03e9('0x3f')],qs[_0x03e9('0x45')](_0x497372[_0x03e9('0x43')]['fields']));_0x49c815[_0x03e9('0x44')]=_0x49c815['attributes'][_0x03e9('0x46')]?_0x49c815[_0x03e9('0x44')]:_0x219b7a['model'];if(_0x497372[_0x03e9('0x43')][_0x03e9('0x54')]){_0x49c815['include']=[{'all':!![]}];}_0x49c815=_['merge']({},_0x49c815,_0x497372[_0x03e9('0x4f')]);return db['ChatMessage'][_0x03e9('0x55')](_0x49c815)[_0x03e9('0x1f')](handleEntityNotFound(_0x157295,null))[_0x03e9('0x1f')](respondWithResult(_0x157295,null))[_0x03e9('0x27')](handleError(_0x157295,null));};exports[_0x03e9('0x56')]=function(_0x5eb138,_0x4f9506){return db['ChatMessage'][_0x03e9('0x56')](_0x5eb138[_0x03e9('0x57')],{})[_0x03e9('0x1f')](respondWithResult(_0x4f9506,0xc9))[_0x03e9('0x27')](handleError(_0x4f9506,null));};exports[_0x03e9('0x34')]=function(_0x318d33,_0x458ae8){if(_0x318d33[_0x03e9('0x57')]['id']){delete _0x318d33[_0x03e9('0x57')]['id'];}return db[_0x03e9('0x50')][_0x03e9('0x55')]({'where':{'id':_0x318d33['params']['id']}})[_0x03e9('0x1f')](handleEntityNotFound(_0x458ae8,null))[_0x03e9('0x1f')](saveUpdates(_0x318d33[_0x03e9('0x57')],null))[_0x03e9('0x1f')](respondWithResult(_0x458ae8,null))[_0x03e9('0x27')](handleError(_0x458ae8,null));};exports[_0x03e9('0x35')]=function(_0xad2d81,_0x3eac88){return db[_0x03e9('0x50')][_0x03e9('0x55')]({'where':{'id':_0xad2d81['params']['id']}})[_0x03e9('0x1f')](handleEntityNotFound(_0x3eac88,null))[_0x03e9('0x1f')](removeEntity(_0x3eac88,null))[_0x03e9('0x27')](handleError(_0x3eac88,null));};exports[_0x03e9('0x58')]=function(_0x124c8e,_0x31cd95){return db[_0x03e9('0x50')][_0x03e9('0x58')]()['then'](respondWithResult(_0x31cd95,null))[_0x03e9('0x27')](handleError(_0x31cd95,null));};var interaction_log=require(_0x03e9('0x14'))(_0x03e9('0x59'));exports[_0x03e9('0x5a')]=function(_0x476316,_0x27709c,_0x40c3e8){var _0x2403f0={'agent':{},'channel':'chat'};if(_0x476316[_0x03e9('0x57')]['id']){delete _0x476316[_0x03e9('0x57')]['id'];}_0x476316[_0x03e9('0x57')][_0x03e9('0x5b')]=!![];_0x476316[_0x03e9('0x57')][_0x03e9('0x5c')]=moment()[_0x03e9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')]=_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')]||_0x476316[_0x03e9('0x5f')]['id'];_0x2403f0[_0x03e9('0x60')]['id']=_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')];return db[_0x03e9('0x50')][_0x03e9('0x55')]({'where':{'id':_0x476316[_0x03e9('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27709c,null))['then'](saveUpdates(_0x476316['body'],null))[_0x03e9('0x1f')](function(_0x361ed1){if(_0x361ed1){_0x2403f0[_0x03e9('0x26')]=_0x361ed1['get']({'plain':!![]});return db['ChatInteraction'][_0x03e9('0x55')]({'where':{'id':_0x361ed1[_0x03e9('0x61')]}});}return null;})[_0x03e9('0x1f')](handleEntityNotFound(_0x27709c,null))[_0x03e9('0x1f')](function(_0x425027){if(_0x425027){return _0x425027['update']({'UserId':_0x476316['body'][_0x03e9('0x5e')],'read1stAt':_[_0x03e9('0x62')](_0x425027[_0x03e9('0x63')])?moment()[_0x03e9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x03e9('0x1f')](function(_0x3d36d3){if(_0x3d36d3){_0x2403f0[_0x03e9('0x64')]=_0x3d36d3['get']({'plain':!![]});interaction_log[_0x03e9('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x476316[_0x03e9('0x5f')]['id'],_0x476316[_0x03e9('0x5f')]['name'],_0x476316[_0x03e9('0x5f')]['role'],_0x2403f0[_0x03e9('0x64')]['id'],_0x476316['body']?JSON[_0x03e9('0x65')](_0x476316[_0x03e9('0x57')]):_0x03e9('0x66'));return respondWithRpcPromise(_0x03e9('0x67'),_0x03e9('0x68'),_0x2403f0);}return null;})[_0x03e9('0x1f')](function(_0x42d07f){var _0x447d54=_0x03e9('0x69')+_0x42d07f[_0x03e9('0x26')][_0x03e9('0x6a')];return db['sequelize'][_0x03e9('0x43')](_0x447d54,{'type':db[_0x03e9('0x6b')][_0x03e9('0x6c')][_0x03e9('0x6d')],'raw':!![]})[_0x03e9('0x1f')](function(_0x58d27a){return _0x58d27a;});})['then'](function(_0x603f02){if(_0x603f02){_0x2403f0[_0x03e9('0x26')][_0x03e9('0x6e')]=_0x603f02[0x0];if(!_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')])return;return db['User'][_0x03e9('0x55')]({'where':{'id':_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')],'role':_0x03e9('0x60')},'attributes':['id',_0x03e9('0x37'),_0x03e9('0x6f'),_0x03e9('0x70'),_0x03e9('0x71')],'raw':!![]});}return null;})[_0x03e9('0x1f')](function(_0x5add66){if(!_0x5add66)return null;_0x2403f0[_0x03e9('0x26')][_0x03e9('0x60')]=_0x5add66;return _0x2403f0;})[_0x03e9('0x1f')](function(_0x1ca915){if(_0x1ca915){if(_0x476316[_0x03e9('0x57')][_0x03e9('0x72')]){_0x2403f0[_0x03e9('0x26')]['interface']=util[_0x03e9('0x5d')]('SIP/%s',_0x476316['user'][_0x03e9('0x37')]);_0x2403f0[_0x03e9('0x26')][_0x03e9('0x73')]=_0x2403f0[_0x03e9('0x73')];_0x2403f0[_0x03e9('0x26')]['motionChannel']=_0x2403f0[_0x03e9('0x73')];_0x2403f0[_0x03e9('0x26')][_0x03e9('0x74')]=_0x03e9('0x5a');return respondWithRpcPromise('EventManager',_0x03e9('0x75'),{'event':_0x03e9('0x76'),'message':_['merge'](_0x2403f0['message'],JSON[_0x03e9('0x77')](_0x2403f0[_0x03e9('0x64')][_0x03e9('0x78')]))},client9002)[_0x03e9('0x1f')](function(){return _0x2403f0;});}return _0x2403f0;}return null;})[_0x03e9('0x1f')](respondWithResult(_0x27709c,null))[_0x03e9('0x27')](handleError(_0x27709c,null));};var interaction_log=require(_0x03e9('0x14'))(_0x03e9('0x59'));exports[_0x03e9('0x32')]=function(_0x22502a,_0x28f453,_0xe8e12b){var _0x4bac9a={'agent':{},'channel':_0x03e9('0x79')};if(_0x22502a[_0x03e9('0x57')]['id']){delete _0x22502a[_0x03e9('0x57')]['id'];}_0x22502a['body'][_0x03e9('0x5e')]=_0x22502a['body'][_0x03e9('0x5e')]||_0x22502a[_0x03e9('0x5f')]['id'];_0x4bac9a['agent']['id']=_0x22502a[_0x03e9('0x57')]['UserId'];return db['ChatMessage'][_0x03e9('0x55')]({'where':{'id':_0x22502a['params']['id'],'UserId':null}})[_0x03e9('0x1f')](handleEntityNotFound(_0x28f453,null))['then'](function(_0xcea1e3){if(_0xcea1e3){_0x4bac9a['message']=_0xcea1e3['get']({'plain':!![]});return db['ChatInteraction'][_0x03e9('0x55')]({'where':{'id':_0xcea1e3[_0x03e9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x28f453,null))[_0x03e9('0x1f')](function(_0x1c5e2f){if(_0x1c5e2f){_0x4bac9a['interaction']=_0x1c5e2f[_0x03e9('0x7a')]({'plain':!![]});interaction_log[_0x03e9('0x20')](_0x03e9('0x7b'),_0x22502a[_0x03e9('0x5f')]['id'],_0x22502a[_0x03e9('0x5f')]['name'],_0x22502a[_0x03e9('0x5f')][_0x03e9('0x7c')],_0x4bac9a['interaction']['id'],_0x22502a[_0x03e9('0x57')]?JSON[_0x03e9('0x65')](_0x22502a[_0x03e9('0x57')]):_0x03e9('0x66'));return respondWithRpcPromise('RejectMessage',_0x03e9('0x7d'),_0x4bac9a);}return null;})[_0x03e9('0x1f')](function(_0x565552){var _0x47c5ec='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x565552[_0x03e9('0x26')]['ContactId'];return db[_0x03e9('0x7e')][_0x03e9('0x43')](_0x47c5ec,{'type':db[_0x03e9('0x6b')]['QueryTypes'][_0x03e9('0x6d')],'raw':!![]})[_0x03e9('0x1f')](function(_0x1835ef){return _0x1835ef;});})['then'](function(_0x44042f){if(_0x44042f){_0x4bac9a[_0x03e9('0x26')][_0x03e9('0x6e')]=_0x44042f[0x0];if(!_0x22502a[_0x03e9('0x57')][_0x03e9('0x5e')])return;return db['User'][_0x03e9('0x55')]({'where':{'id':_0x22502a[_0x03e9('0x57')]['UserId'],'role':_0x03e9('0x60')},'attributes':['id','name',_0x03e9('0x6f'),_0x03e9('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x6f1b0b){if(!_0x6f1b0b)return null;_0x4bac9a[_0x03e9('0x26')]['agent']=_0x6f1b0b;return _0x4bac9a;})[_0x03e9('0x1f')](function(_0x563066){if(_0x563066){_0x563066[_0x03e9('0x26')][_0x03e9('0x7f')]=util[_0x03e9('0x5d')](_0x03e9('0x80'),_0x22502a[_0x03e9('0x5f')][_0x03e9('0x37')]);_0x563066[_0x03e9('0x26')][_0x03e9('0x73')]=_0x4bac9a[_0x03e9('0x73')];_0x563066[_0x03e9('0x26')][_0x03e9('0x81')]=_0x4bac9a[_0x03e9('0x73')];_0x563066[_0x03e9('0x26')][_0x03e9('0x74')]=_0x03e9('0x32');respondWithRpcPromise(_0x03e9('0x75'),_0x03e9('0x75'),{'event':_0x03e9('0x82'),'message':_[_0x03e9('0x4d')](_0x4bac9a['message'],JSON[_0x03e9('0x77')](_0x4bac9a[_0x03e9('0x64')][_0x03e9('0x78')]))},client9002);return _0x4bac9a;}return null;})[_0x03e9('0x1f')](respondWithResult(_0x28f453,null))['catch'](handleError(_0x28f453,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cbca3b5..67d27bd 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 _0xb55c=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','update'];(function(_0x23440a,_0x32b6de){var _0x288a39=function(_0x662632){while(--_0x662632){_0x23440a['push'](_0x23440a['shift']());}};_0x288a39(++_0x32b6de);}(_0xb55c,0x14c));var _0xcb55=function(_0x1caf4f,_0xd0b32d){_0x1caf4f=_0x1caf4f-0x0;var _0x11b9e2=_0xb55c[_0x1caf4f];return _0x11b9e2;};'use strict';var EventEmitter=require(_0xcb55('0x0'));var ChatMessage=require(_0xcb55('0x1'))['db'][_0xcb55('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb55('0x3'),'afterDestroy':_0xcb55('0x4')};function emitEvent(_0x4df1d7){return function(_0x1fc77b,_0x1384c6,_0x5f1b8e){ChatMessageEvents['emit'](_0x4df1d7+':'+_0x1fc77b['id'],_0x1fc77b);ChatMessageEvents[_0xcb55('0x5')](_0x4df1d7,_0x1fc77b);_0x5f1b8e(null);};}for(var e in events){if(events[_0xcb55('0x6')](e)){var event=events[e];ChatMessage[_0xcb55('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xfe8d=['save','update','remove','emit','hook','exports','events','ChatMessage','setMaxListeners'];(function(_0x45b28e,_0x2f0198){var _0x4e5c9f=function(_0x54de6f){while(--_0x54de6f){_0x45b28e['push'](_0x45b28e['shift']());}};_0x4e5c9f(++_0x2f0198);}(_0xfe8d,0x9f));var _0xdfe8=function(_0x283ec6,_0x219a59){_0x283ec6=_0x283ec6-0x0;var _0x312d15=_0xfe8d[_0x283ec6];return _0x312d15;};'use strict';var EventEmitter=require(_0xdfe8('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xdfe8('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xdfe8('0x2')](0x0);var events={'afterCreate':_0xdfe8('0x3'),'afterUpdate':_0xdfe8('0x4'),'afterDestroy':_0xdfe8('0x5')};function emitEvent(_0x1d4c42){return function(_0x968f1f,_0x18010b,_0x2ff5b1){ChatMessageEvents[_0xdfe8('0x6')](_0x1d4c42+':'+_0x968f1f['id'],_0x968f1f);ChatMessageEvents[_0xdfe8('0x6')](_0x1d4c42,_0x968f1f);_0x2ff5b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xdfe8('0x7')](e,emitEvent(event));}}module[_0xdfe8('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 74a3e72..81adfc8 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 _0x8645=['catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','body','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then'];(function(_0x34350d,_0x1f242e){var _0x3dd678=function(_0x1bb6a2){while(--_0x1bb6a2){_0x34350d['push'](_0x34350d['shift']());}};_0x3dd678(++_0x1f242e);}(_0x8645,0x145));var _0x5864=function(_0x4b0f0c,_0xbefa2b){_0x4b0f0c=_0x4b0f0c-0x0;var _0x283926=_0x8645[_0x4b0f0c];return _0x283926;};'use strict';var _=require(_0x5864('0x0'));var util=require('util');var logger=require(_0x5864('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5864('0x2'));var rp=require(_0x5864('0x3'));var fs=require('fs');var path=require(_0x5864('0x4'));var rimraf=require(_0x5864('0x5'));var config=require(_0x5864('0x6'));var attributes=require('./chatMessage.attributes');module[_0x5864('0x7')]=function(_0x256778,_0x2798de){return _0x256778[_0x5864('0x8')](_0x5864('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x5864('0xa')],'type':_0x5864('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2652df,_0x4f8e3d,_0x48430e){var _0x1f6152=_0x256778['models'];var _0x32edd5=_0x2652df['get']({'plain':!![]});if(_0x32edd5[_0x5864('0xc')]['toLowerCase']()==='in'||_0x32edd5[_0x5864('0xc')][_0x5864('0xd')]()==='out'&&!_0x32edd5[_0x5864('0xe')]&&!_[_0x5864('0xf')](_0x32edd5[_0x5864('0x10')])){_0x1f6152[_0x5864('0x11')][_0x5864('0x12')]({'where':{'id':_0x32edd5['ChatInteractionId']}})[_0x5864('0x13')](function(_0x251479){if(_0x251479){_0x251479['update']({'lastMsgAt':_0x32edd5['createdAt'],'lastMsgDirection':_0x32edd5[_0x5864('0xc')]['toLowerCase']()});}})[_0x5864('0x14')](function(_0x3d01e3){console[_0x5864('0x15')](_0x3d01e3);});}_0x48430e();}},'charset':'utf8mb4','collate':_0x5864('0x16')});}; \ No newline at end of file +var _0xe141=['then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x350119,_0x3db5eb){var _0x297b6e=function(_0x515def){while(--_0x515def){_0x350119['push'](_0x350119['shift']());}};_0x297b6e(++_0x3db5eb);}(_0xe141,0x17f));var _0x1e14=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xe141[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x1e14('0x0'));var util=require(_0x1e14('0x1'));var logger=require(_0x1e14('0x2'))(_0x1e14('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e14('0x4'));var fs=require('fs');var path=require(_0x1e14('0x5'));var rimraf=require(_0x1e14('0x6'));var config=require(_0x1e14('0x7'));var attributes=require(_0x1e14('0x8'));module['exports']=function(_0x3ae6d4,_0x3d6b87){return _0x3ae6d4[_0x1e14('0x9')](_0x1e14('0xa'),attributes,{'tableName':_0x1e14('0xb'),'paranoid':![],'indexes':[{'name':_0x1e14('0xc'),'fields':[_0x1e14('0xd')],'type':_0x1e14('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x593cd8,_0x1e9346,_0x199eee){var _0x161be1=_0x3ae6d4[_0x1e14('0xf')];var _0x5d3fb9=_0x593cd8['get']({'plain':!![]});if(_0x5d3fb9[_0x1e14('0x10')][_0x1e14('0x11')]()==='in'||_0x5d3fb9[_0x1e14('0x10')][_0x1e14('0x11')]()==='out'&&!_0x5d3fb9['secret']&&!_[_0x1e14('0x12')](_0x5d3fb9[_0x1e14('0x13')])){_0x161be1[_0x1e14('0x14')][_0x1e14('0x15')]({'where':{'id':_0x5d3fb9[_0x1e14('0x16')]}})[_0x1e14('0x17')](function(_0x5840df){if(_0x5840df){_0x5840df[_0x1e14('0x18')]({'lastMsgAt':_0x5d3fb9[_0x1e14('0x19')],'lastMsgDirection':_0x5d3fb9['direction'][_0x1e14('0x11')]()});}})['catch'](function(_0x323a4b){console[_0x1e14('0x1a')](_0x323a4b);});}_0x199eee();}},'charset':_0x1e14('0x1b'),'collate':_0x1e14('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 23c25ab..e5e50f5 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 _0xac6b=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateChatMessage','ChatMessage','create','body','raw','util','moment'];(function(_0x539505,_0x570ec5){var _0x3ac150=function(_0x15d353){while(--_0x15d353){_0x539505['push'](_0x539505['shift']());}};_0x3ac150(++_0x570ec5);}(_0xac6b,0x115));var _0xbac6=function(_0x3a6d3e,_0x5d3d5f){_0x3a6d3e=_0x3a6d3e-0x0;var _0x96ac00=_0xac6b[_0x3a6d3e];return _0x96ac00;};'use strict';var _=require('lodash');var util=require(_0xbac6('0x0'));var moment=require(_0xbac6('0x1'));var BPromise=require('bluebird');var rs=require(_0xbac6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbac6('0x3'))['db'];var utils=require(_0xbac6('0x4'));var logger=require(_0xbac6('0x5'))(_0xbac6('0x6'));var config=require(_0xbac6('0x7'));var jayson=require(_0xbac6('0x8'));var client=jayson[_0xbac6('0x9')][_0xbac6('0xa')]({'port':0x232a});config[_0xbac6('0xb')]=_['defaults'](config[_0xbac6('0xb')],{'host':_0xbac6('0xc'),'port':0x18eb});var socket=require(_0xbac6('0xd'))(new Redis(config[_0xbac6('0xb')]));require('./chatMessage.socket')[_0xbac6('0xe')](socket);function respondWithRpcPromise(_0x52670d,_0x14ded9,_0x18479f){return new BPromise(function(_0x4e68d2,_0x14a31d){return client[_0xbac6('0xf')](_0x52670d,_0x18479f)['then'](function(_0x4184f3){logger[_0xbac6('0x10')](_0xbac6('0x11'),_0x14ded9,_0xbac6('0x12'));logger[_0xbac6('0x13')](_0xbac6('0x14'),_0x14ded9,_0xbac6('0x12'),JSON[_0xbac6('0x15')](_0x4184f3));if(_0x4184f3['error']){if(_0x4184f3['error'][_0xbac6('0x16')]===0x1f4){logger[_0xbac6('0x17')](_0xbac6('0x11'),_0x14ded9,_0x4184f3[_0xbac6('0x17')][_0xbac6('0x18')]);return _0x14a31d(_0x4184f3[_0xbac6('0x17')]['message']);}logger['error'](_0xbac6('0x11'),_0x14ded9,_0x4184f3['error'][_0xbac6('0x18')]);return _0x4e68d2(_0x4184f3[_0xbac6('0x17')]['message']);}else{logger[_0xbac6('0x10')](_0xbac6('0x11'),_0x14ded9,_0xbac6('0x12'));_0x4e68d2(_0x4184f3['result'][_0xbac6('0x18')]);}})[_0xbac6('0x19')](function(_0x46a559){logger['error'](_0xbac6('0x11'),_0x14ded9,_0x46a559);_0x14a31d(_0x46a559);});});}exports[_0xbac6('0x1a')]=function(_0x316319){var _0x43430d=this;return new Promise(function(_0x2bb447,_0x494cd5){return db[_0xbac6('0x1b')][_0xbac6('0x1c')](_0x316319[_0xbac6('0x1d')],{'raw':_0x316319['options']?_0x316319['options'][_0xbac6('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5715b9){logger['info'](_0xbac6('0x1a'),_0x316319);logger[_0xbac6('0x13')](_0xbac6('0x1a'),_0x316319,JSON[_0xbac6('0x15')](_0x5715b9));_0x2bb447(_0x5715b9);})[_0xbac6('0x19')](function(_0x14d9e5){logger[_0xbac6('0x17')]('CreateChatMessage',_0x14d9e5[_0xbac6('0x18')],_0x316319);_0x494cd5(_0x43430d[_0xbac6('0x17')](0x1f4,_0x14d9e5[_0xbac6('0x18')]));});});}; \ No newline at end of file +var _0xfc51=['info','result','catch','CreateChatMessage','create','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./chatMessage.socket','register','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message'];(function(_0x3f4750,_0x5ee1c7){var _0xea4b0c=function(_0xb64051){while(--_0xb64051){_0x3f4750['push'](_0x3f4750['shift']());}};_0xea4b0c(++_0x5ee1c7);}(_0xfc51,0xbb));var _0x1fc5=function(_0x1a6655,_0x2e7d78){_0x1a6655=_0x1a6655-0x0;var _0x4af9ca=_0xfc51[_0x1a6655];return _0x4af9ca;};'use strict';var _=require('lodash');var util=require(_0x1fc5('0x0'));var moment=require(_0x1fc5('0x1'));var BPromise=require(_0x1fc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fc5('0x3'));var db=require(_0x1fc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fc5('0x5'))(_0x1fc5('0x6'));var config=require(_0x1fc5('0x7'));var jayson=require(_0x1fc5('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1fc5('0x9')](config[_0x1fc5('0xa')],{'host':_0x1fc5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fc5('0xa')]));require(_0x1fc5('0xc'))[_0x1fc5('0xd')](socket);function respondWithRpcPromise(_0x146708,_0x2db19c,_0xb75fa){return new BPromise(function(_0x34a96b,_0x5a0578){return client[_0x1fc5('0xe')](_0x146708,_0xb75fa)[_0x1fc5('0xf')](function(_0x3c3cf9){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2db19c,_0x1fc5('0x10'));logger[_0x1fc5('0x11')](_0x1fc5('0x12'),_0x2db19c,'request\x20sent',JSON[_0x1fc5('0x13')](_0x3c3cf9));if(_0x3c3cf9[_0x1fc5('0x14')]){if(_0x3c3cf9[_0x1fc5('0x14')]['code']===0x1f4){logger[_0x1fc5('0x14')](_0x1fc5('0x15'),_0x2db19c,_0x3c3cf9[_0x1fc5('0x14')][_0x1fc5('0x16')]);return _0x5a0578(_0x3c3cf9[_0x1fc5('0x14')]['message']);}logger[_0x1fc5('0x14')](_0x1fc5('0x15'),_0x2db19c,_0x3c3cf9[_0x1fc5('0x14')]['message']);return _0x34a96b(_0x3c3cf9['error'][_0x1fc5('0x16')]);}else{logger[_0x1fc5('0x17')](_0x1fc5('0x15'),_0x2db19c,_0x1fc5('0x10'));_0x34a96b(_0x3c3cf9[_0x1fc5('0x18')]['message']);}})[_0x1fc5('0x19')](function(_0x2f80d6){logger[_0x1fc5('0x14')](_0x1fc5('0x15'),_0x2db19c,_0x2f80d6);_0x5a0578(_0x2f80d6);});});}exports[_0x1fc5('0x1a')]=function(_0xedf040){var _0x44ca83=this;return new Promise(function(_0x2d9fff,_0x517e0f){return db['ChatMessage'][_0x1fc5('0x1b')](_0xedf040['body'],{'raw':_0xedf040[_0x1fc5('0x1c')]?_0xedf040[_0x1fc5('0x1c')][_0x1fc5('0x1d')]===undefined?!![]:![]:!![]})[_0x1fc5('0xf')](function(_0x554f38){logger[_0x1fc5('0x17')](_0x1fc5('0x1a'),_0xedf040);logger[_0x1fc5('0x11')](_0x1fc5('0x1a'),_0xedf040,JSON['stringify'](_0x554f38));_0x2d9fff(_0x554f38);})[_0x1fc5('0x19')](function(_0x5915e7){logger[_0x1fc5('0x14')](_0x1fc5('0x1a'),_0x5915e7[_0x1fc5('0x16')],_0xedf040);_0x517e0f(_0x44ca83['error'](0x1f4,_0x5915e7[_0x1fc5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index bcda7d6..f40bc29 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 _0x5fc3=['./chatMessage.events','save','update','emit','removeListener','register','chatMessage:'];(function(_0xc42044,_0x38ab59){var _0x497235=function(_0x55cf7b){while(--_0x55cf7b){_0xc42044['push'](_0xc42044['shift']());}};_0x497235(++_0x38ab59);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5fc3[_0x58afd5];return _0x3e503b;};'use strict';var ChatMessageEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){ChatMessageEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);ChatMessageEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0xa23f=['save','emit','register','chatMessage:','./chatMessage.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa23f,0x7c));var _0xfa23=function(_0x583cab,_0x57c9ee){_0x583cab=_0x583cab-0x0;var _0x5178ed=_0xa23f[_0x583cab];return _0x5178ed;};'use strict';var ChatMessageEvents=require(_0xfa23('0x0'));var events=[_0xfa23('0x1'),'remove','update'];function createListener(_0xb81edf,_0x3f714c){return function(_0x1c85a9){_0x3f714c[_0xfa23('0x2')](_0xb81edf,_0x1c85a9);};}function removeListener(_0x5643b1,_0x86778e){return function(){ChatMessageEvents['removeListener'](_0x5643b1,_0x86778e);};}exports[_0xfa23('0x3')]=function(_0x2df2f5){for(var _0x4c3f4=0x0,_0x3696ef=events['length'];_0x4c3f4<_0x3696ef;_0x4c3f4++){var _0x5a7882=events[_0x4c3f4];var _0x59d53e=createListener(_0xfa23('0x4')+_0x5a7882,_0x2df2f5);ChatMessageEvents['on'](_0x5a7882,_0x59d53e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5ebef5a..0130d30 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 _0xfdf7=['accept','/:id/reject','reject','destroy','exports','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','chat','chatmessage:create','create','put','/:id/accept'];(function(_0x27273d,_0x3cb1cb){var _0xebb492=function(_0x590e57){while(--_0x590e57){_0x27273d['push'](_0x27273d['shift']());}};_0xebb492(++_0x3cb1cb);}(_0xfdf7,0xb5));var _0x7fdf=function(_0x5856af,_0x6a158d){_0x5856af=_0x5856af-0x0;var _0x22a93a=_0xfdf7[_0x5856af];return _0x22a93a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7fdf('0x0'));var timeout=require('connect-timeout');var express=require(_0x7fdf('0x1'));var router=express[_0x7fdf('0x2')]();var fs_extra=require(_0x7fdf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7fdf('0x4'));var controller=require('./chatMessage.controller');router[_0x7fdf('0x5')]('/',auth[_0x7fdf('0x6')](),controller[_0x7fdf('0x7')]);router[_0x7fdf('0x5')](_0x7fdf('0x8'),auth[_0x7fdf('0x6')](),controller[_0x7fdf('0x9')]);router['get'](_0x7fdf('0xa'),auth[_0x7fdf('0x6')](),controller['show']);router['post']('/',auth[_0x7fdf('0x6')](),interaction[_0x7fdf('0xb')](_0x7fdf('0xc'),_0x7fdf('0xd')),controller[_0x7fdf('0xe')]);router[_0x7fdf('0xf')](_0x7fdf('0xa'),controller['update']);router[_0x7fdf('0xf')](_0x7fdf('0x10'),auth['isAuthenticated'](),controller[_0x7fdf('0x11')]);router[_0x7fdf('0xf')](_0x7fdf('0x12'),auth['isAuthenticated'](),controller[_0x7fdf('0x13')]);router['delete']('/:id',auth[_0x7fdf('0x6')](),controller[_0x7fdf('0x14')]);module[_0x7fdf('0x15')]=router; \ No newline at end of file +var _0x7409=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x18c907,_0x5ec1d5){var _0xef1d9c=function(_0x5e989b){while(--_0x5e989b){_0x18c907['push'](_0x18c907['shift']());}};_0xef1d9c(++_0x5ec1d5);}(_0x7409,0x1a7));var _0x9740=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x7409[_0x1bfe2b];return _0x1477d4;};'use strict';var multer=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var path=require(_0x9740('0x2'));var timeout=require(_0x9740('0x3'));var express=require(_0x9740('0x4'));var router=express[_0x9740('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9740('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9740('0x7'));var controller=require('./chatMessage.controller');router[_0x9740('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9740('0x8')](_0x9740('0x9'),auth[_0x9740('0xa')](),controller[_0x9740('0xb')]);router[_0x9740('0x8')](_0x9740('0xc'),auth[_0x9740('0xa')](),controller[_0x9740('0xd')]);router['post']('/',auth[_0x9740('0xa')](),interaction[_0x9740('0xe')](_0x9740('0xf'),_0x9740('0x10')),controller[_0x9740('0x11')]);router[_0x9740('0x12')]('/:id',controller[_0x9740('0x13')]);router[_0x9740('0x12')](_0x9740('0x14'),auth[_0x9740('0xa')](),controller['accept']);router[_0x9740('0x12')](_0x9740('0x15'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x9740('0xc'),auth[_0x9740('0xa')](),controller['destroy']);module[_0x9740('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index a94afb1..afad223 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['medium','sequelize','TEXT'];(function(_0x5e1678,_0x5ec316){var _0x77a056=function(_0x183ff6){while(--_0x183ff6){_0x5e1678['push'](_0x5e1678['shift']());}};_0x77a056(++_0x5ec316);}(_0xb10b,0x12a));var _0xbb10=function(_0x27a997,_0x85f149){_0x27a997=_0x27a997-0x0;var _0x5aa288=_0xb10b[_0x27a997];return _0x5aa288;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x3f4157,_0x1d0ac5){var _0x4d5d1d=function(_0x4d857c){while(--_0x4d857c){_0x3f4157['push'](_0x3f4157['shift']());}};_0x4d5d1d(++_0x1d0ac5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x515df6,_0x4286cf){_0x515df6=_0x515df6-0x0;var _0x442370=_0x5f2f[_0x515df6];return _0x442370;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 0af9a2e..90824f9 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x55e8ec,_0x5ba1c6){var _0x5c380d=function(_0x29a029){while(--_0x29a029){_0x55e8ec['push'](_0x55e8ec['shift']());}};_0x5c380d(++_0x5ba1c6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x7a54,0x106));var _0x47a5=function(_0x316041,_0x5daa29){_0x316041=_0x316041-0x0;var _0x38640f=_0x7a54[_0x316041];return _0x38640f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 1578d07..a200767 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c3=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x181ead,_0x49d550){var _0x1613d9=function(_0x277e7d){while(--_0x277e7d){_0x181ead['push'](_0x181ead['shift']());}};_0x1613d9(++_0x49d550);}(_0x80c3,0x18f));var _0x380c=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x80c3[_0x102ff9];return _0x24fa97;};'use strict';var EventEmitter=require(_0x380c('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x380c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x2'),'afterDestroy':_0x380c('0x3')};function emitEvent(_0x24728a){return function(_0x52fd7e,_0x565a08,_0x553158){ChatOfflineMessageEvents[_0x380c('0x4')](_0x24728a+':'+_0x52fd7e['id'],_0x52fd7e);ChatOfflineMessageEvents['emit'](_0x24728a,_0x52fd7e);_0x553158(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x380c('0x5')](e,emitEvent(event));}}module[_0x380c('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc8ca=['emit','hasOwnProperty','hook','events','../../mysqldb','remove'];(function(_0x2a8907,_0x5df696){var _0x435f90=function(_0xe2c907){while(--_0xe2c907){_0x2a8907['push'](_0x2a8907['shift']());}};_0x435f90(++_0x5df696);}(_0xc8ca,0x1b3));var _0xac8c=function(_0x348db0,_0x103906){_0x348db0=_0x348db0-0x0;var _0x405e55=_0xc8ca[_0x348db0];return _0x405e55;};'use strict';var EventEmitter=require(_0xac8c('0x0'));var ChatOfflineMessage=require(_0xac8c('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xac8c('0x2')};function emitEvent(_0x30b008){return function(_0x5d2752,_0x393ea5,_0x22417b){ChatOfflineMessageEvents[_0xac8c('0x3')](_0x30b008+':'+_0x5d2752['id'],_0x5d2752);ChatOfflineMessageEvents['emit'](_0x30b008,_0x5d2752);_0x22417b(null);};}for(var e in events){if(events[_0xac8c('0x4')](e)){var event=events[e];ChatOfflineMessage[_0xac8c('0x5')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ca5925c..f47b4f0 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 _0x05e1=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x5d2749,_0x58cdfa){var _0x5c255c=function(_0x1ae36b){while(--_0x1ae36b){_0x5d2749['push'](_0x5d2749['shift']());}};_0x5c255c(++_0x58cdfa);}(_0x05e1,0xdf));var _0x105e=function(_0xd6b08,_0x3e8d0f){_0xd6b08=_0xd6b08-0x0;var _0xcbcc98=_0x05e1[_0xd6b08];return _0xcbcc98;};'use strict';var attributes=require(_0x105e('0x0'));module['exports']=function(_0x5076c1){return _0x5076c1[_0x105e('0x1')](_0x105e('0x2'),attributes,{'tableName':_0x105e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x105e('0x4'),'collate':_0x105e('0x5')});}; \ No newline at end of file +var _0xf68d=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x394b23,_0x36d244){var _0xccfc8b=function(_0x2609f6){while(--_0x2609f6){_0x394b23['push'](_0x394b23['shift']());}};_0xccfc8b(++_0x36d244);}(_0xf68d,0x133));var _0xdf68=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf68d[_0x53ccf2];return _0x5a2964;};'use strict';var attributes=require(_0xdf68('0x0'));module[_0xdf68('0x1')]=function(_0x3dec34){return _0x3dec34['define'](_0xdf68('0x2'),attributes,{'tableName':_0xdf68('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf68('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 91f9341..7082479 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 _0x24f5=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x33dc05,_0xa01811){var _0x8c14e5=function(_0x76e450){while(--_0x76e450){_0x33dc05['push'](_0x33dc05['shift']());}};_0x8c14e5(++_0xa01811);}(_0x24f5,0x1ee));var _0x524f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24f5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x524f('0x0'));var util=require(_0x524f('0x1'));var moment=require(_0x524f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x524f('0x3'));var db=require(_0x524f('0x4'))['db'];var utils=require(_0x524f('0x5'));var logger=require(_0x524f('0x6'))(_0x524f('0x7'));var config=require(_0x524f('0x8'));var jayson=require(_0x524f('0x9'));var client=jayson['client'][_0x524f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35acad,_0x511cbc,_0x51eaa7){return new BPromise(function(_0xf012a3,_0x2e3cd4){return client[_0x524f('0xb')](_0x35acad,_0x51eaa7)[_0x524f('0xc')](function(_0x50110a){logger[_0x524f('0xd')](_0x524f('0xe'),_0x511cbc,_0x524f('0xf'));logger['debug'](_0x524f('0x10'),_0x511cbc,_0x524f('0xf'),JSON[_0x524f('0x11')](_0x50110a));if(_0x50110a['error']){if(_0x50110a[_0x524f('0x12')]['code']===0x1f4){logger[_0x524f('0x12')](_0x524f('0xe'),_0x511cbc,_0x50110a[_0x524f('0x12')][_0x524f('0x13')]);return _0x2e3cd4(_0x50110a[_0x524f('0x12')][_0x524f('0x13')]);}logger['error'](_0x524f('0xe'),_0x511cbc,_0x50110a[_0x524f('0x12')][_0x524f('0x13')]);return _0xf012a3(_0x50110a[_0x524f('0x12')][_0x524f('0x13')]);}else{logger[_0x524f('0xd')](_0x524f('0xe'),_0x511cbc,_0x524f('0xf'));_0xf012a3(_0x50110a[_0x524f('0x14')][_0x524f('0x13')]);}})[_0x524f('0x15')](function(_0x1e824e){logger['error'](_0x524f('0xe'),_0x511cbc,_0x1e824e);_0x2e3cd4(_0x1e824e);});});} \ No newline at end of file +var _0xec25=['catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2e6dd3,_0x8426ec){var _0x86721e=function(_0xae1509){while(--_0xae1509){_0x2e6dd3['push'](_0x2e6dd3['shift']());}};_0x86721e(++_0x8426ec);}(_0xec25,0x1b9));var _0x5ec2=function(_0x3eb3b9,_0x5b04ba){_0x3eb3b9=_0x3eb3b9-0x0;var _0x1b56f7=_0xec25[_0x3eb3b9];return _0x1b56f7;};'use strict';var _=require('lodash');var util=require(_0x5ec2('0x0'));var moment=require('moment');var BPromise=require(_0x5ec2('0x1'));var rs=require(_0x5ec2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ec2('0x3'))['db'];var utils=require(_0x5ec2('0x4'));var logger=require(_0x5ec2('0x5'))(_0x5ec2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ec2('0x7'));var client=jayson[_0x5ec2('0x8')][_0x5ec2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10cc1d,_0x2e4bae,_0x48d0a1){return new BPromise(function(_0x5c7158,_0x1a8e63){return client[_0x5ec2('0xa')](_0x10cc1d,_0x48d0a1)['then'](function(_0x53193e){logger['info'](_0x5ec2('0xb'),_0x2e4bae,_0x5ec2('0xc'));logger[_0x5ec2('0xd')](_0x5ec2('0xe'),_0x2e4bae,'request\x20sent',JSON[_0x5ec2('0xf')](_0x53193e));if(_0x53193e[_0x5ec2('0x10')]){if(_0x53193e[_0x5ec2('0x10')][_0x5ec2('0x11')]===0x1f4){logger[_0x5ec2('0x10')](_0x5ec2('0xb'),_0x2e4bae,_0x53193e[_0x5ec2('0x10')][_0x5ec2('0x12')]);return _0x1a8e63(_0x53193e['error']['message']);}logger[_0x5ec2('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2e4bae,_0x53193e[_0x5ec2('0x10')][_0x5ec2('0x12')]);return _0x5c7158(_0x53193e[_0x5ec2('0x10')]['message']);}else{logger[_0x5ec2('0x13')](_0x5ec2('0xb'),_0x2e4bae,'request\x20sent');_0x5c7158(_0x53193e[_0x5ec2('0x14')][_0x5ec2('0x12')]);}})[_0x5ec2('0x15')](function(_0x24c496){logger['error'](_0x5ec2('0xb'),_0x2e4bae,_0x24c496);_0x1a8e63(_0x24c496);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 25941e2..3387c10 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 _0xac27=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x2e756,_0xe50894){var _0x161470=function(_0x1d4084){while(--_0x1d4084){_0x2e756['push'](_0x2e756['shift']());}};_0x161470(++_0xe50894);}(_0xac27,0xdd));var _0x7ac2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xac27[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x7ac2('0x0'));var path=require('path');var timeout=require(_0x7ac2('0x1'));var express=require(_0x7ac2('0x2'));var router=express[_0x7ac2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7ac2('0x4'));var interaction=require(_0x7ac2('0x5'));var config=require(_0x7ac2('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x7ac2('0x7')](),controller[_0x7ac2('0x8')]);router['get'](_0x7ac2('0x9'),auth[_0x7ac2('0x7')](),controller[_0x7ac2('0xa')]);router[_0x7ac2('0xb')]('/',auth[_0x7ac2('0x7')](),controller[_0x7ac2('0xc')]);router[_0x7ac2('0xd')](_0x7ac2('0x9'),auth[_0x7ac2('0x7')](),controller[_0x7ac2('0xe')]);router['delete']('/:id',auth[_0x7ac2('0x7')](),controller[_0x7ac2('0xf')]);module[_0x7ac2('0x10')]=router; \ No newline at end of file +var _0xf27a=['../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','show','post','update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf27a,0x187));var _0xaf27=function(_0x5a40f2,_0x3616a0){_0x5a40f2=_0x5a40f2-0x0;var _0x2de00c=_0xf27a[_0x5a40f2];return _0x2de00c;};'use strict';var multer=require(_0xaf27('0x0'));var util=require(_0xaf27('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf27('0x2')]();var fs_extra=require(_0xaf27('0x3'));var auth=require(_0xaf27('0x4'));var interaction=require(_0xaf27('0x5'));var config=require('../../config/environment');var controller=require(_0xaf27('0x6'));router['get']('/',auth[_0xaf27('0x7')](),controller['index']);router[_0xaf27('0x8')](_0xaf27('0x9'),auth[_0xaf27('0x7')](),controller[_0xaf27('0xa')]);router[_0xaf27('0x8')]('/:id',auth[_0xaf27('0x7')](),controller[_0xaf27('0xb')]);router[_0xaf27('0xc')]('/',auth[_0xaf27('0x7')](),controller['create']);router['put']('/:id',auth[_0xaf27('0x7')](),controller[_0xaf27('0xd')]);router[_0xaf27('0xe')](_0xaf27('0xf'),auth[_0xaf27('0x7')](),controller[_0xaf27('0x10')]);module[_0xaf27('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ee90c7d..950eea1 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 _0xfb0a=['ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xfb0a,0x149));var _0xafb0=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xfb0a[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0xafb0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xafb0('0x1')](_0xafb0('0x2'),_0xafb0('0x3')),'defaultValue':_0xafb0('0x2')},'selector':{'type':Sequelize[_0xafb0('0x4')]},'timeout':{'type':Sequelize[_0xafb0('0x5')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0xa41a,0x1a3));var _0xaa41=function(_0x2b47fc,_0x213ead){_0x2b47fc=_0x2b47fc-0x0;var _0x220b85=_0xa41a[_0x2b47fc];return _0x220b85;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'name':{'type':Sequelize[_0xaa41('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaa41('0x3')](_0xaa41('0x4'),_0xaa41('0x5')),'defaultValue':_0xaa41('0x4')},'selector':{'type':Sequelize[_0xaa41('0x2')]},'timeout':{'type':Sequelize[_0xaa41('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 84a1a2a..de1cea5 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 _0x0f3c=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','show','keys','ChatProactiveAction','query','filters','intersection','model','attributes','fields','length','includeAll','catch','create','body','find','params','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x363dee,_0x4d1a44){var _0x31ae44=function(_0x1a3727){while(--_0x1a3727){_0x363dee['push'](_0x363dee['shift']());}};_0x31ae44(++_0x4d1a44);}(_0x0f3c,0x189));var _0xc0f3=function(_0x3e1647,_0x136dfd){_0x3e1647=_0x3e1647-0x0;var _0x1864ce=_0x0f3c[_0x3e1647];return _0x1864ce;};'use strict';var emlformat=require(_0xc0f3('0x0'));var rimraf=require(_0xc0f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0f3('0x2'));var BPromise=require(_0xc0f3('0x3'));var Mustache=require(_0xc0f3('0x4'));var util=require(_0xc0f3('0x5'));var path=require(_0xc0f3('0x6'));var sox=require(_0xc0f3('0x7'));var csv=require(_0xc0f3('0x8'));var ejs=require(_0xc0f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0f3('0xa'));var squel=require(_0xc0f3('0xb'));var crypto=require('crypto');var jsforce=require(_0xc0f3('0xc'));var deskjs=require(_0xc0f3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc0f3('0xe'));var Papa=require(_0xc0f3('0xf'));var Redis=require(_0xc0f3('0x10'));var authService=require(_0xc0f3('0x11'));var qs=require(_0xc0f3('0x12'));var as=require(_0xc0f3('0x13'));var hardwareService=require(_0xc0f3('0x14'));var logger=require('../../config/logger')(_0xc0f3('0x15'));var utils=require(_0xc0f3('0x16'));var config=require(_0xc0f3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0f3('0x18'))['db'];function respondWithStatusCode(_0x2391fd,_0x2fcea0){_0x2fcea0=_0x2fcea0||0xcc;return function(_0x125e58){if(_0x125e58){return _0x2391fd['sendStatus'](_0x2fcea0);}return _0x2391fd[_0xc0f3('0x19')](_0x2fcea0)[_0xc0f3('0x1a')]();};}function respondWithResult(_0x2e7998,_0x597ebf){_0x597ebf=_0x597ebf||0xc8;return function(_0x37cad7){if(_0x37cad7){return _0x2e7998[_0xc0f3('0x19')](_0x597ebf)[_0xc0f3('0x1b')](_0x37cad7);}};}function respondWithFilteredResult(_0x135685,_0x63efe4){return function(_0x215aed){if(_0x215aed){var _0x4640ec=typeof _0x63efe4[_0xc0f3('0x1c')]===_0xc0f3('0x1d')&&typeof _0x63efe4['limit']===_0xc0f3('0x1d');var _0x1490c0=_0x215aed[_0xc0f3('0x1e')];var _0x2b2e84=_0x4640ec?0x0:_0x63efe4[_0xc0f3('0x1c')];var _0x504133=_0x4640ec?_0x215aed[_0xc0f3('0x1e')]:_0x63efe4[_0xc0f3('0x1c')]+_0x63efe4[_0xc0f3('0x1f')];var _0x2ecdde;if(_0x504133>=_0x1490c0){_0x504133=_0x1490c0;_0x2ecdde=0xc8;}else{_0x2ecdde=0xce;}_0x135685[_0xc0f3('0x19')](_0x2ecdde);return _0x135685[_0xc0f3('0x20')]('Content-Range',_0x2b2e84+'-'+_0x504133+'/'+_0x1490c0)[_0xc0f3('0x1b')](_0x215aed);}return null;};}function patchUpdates(_0x4c0550){return function(_0x345571){try{jsonpatch[_0xc0f3('0x21')](_0x345571,_0x4c0550,!![]);}catch(_0x3799c7){return BPromise['reject'](_0x3799c7);}return _0x345571[_0xc0f3('0x22')]();};}function saveUpdates(_0x9fdc14,_0x4a0757){return function(_0x3bea3e){if(_0x3bea3e){return _0x3bea3e[_0xc0f3('0x23')](_0x9fdc14)[_0xc0f3('0x24')](function(_0x4f36eb){return _0x4f36eb;});}return null;};}function removeEntity(_0x58f2b2,_0xf5e0ac){return function(_0x53ffff){if(_0x53ffff){return _0x53ffff[_0xc0f3('0x25')]()[_0xc0f3('0x24')](function(){_0x58f2b2[_0xc0f3('0x19')](0xcc)[_0xc0f3('0x1a')]();});}};}function handleEntityNotFound(_0x1f1ad3,_0x2484e7){return function(_0x22beeb){if(!_0x22beeb){_0x1f1ad3[_0xc0f3('0x26')](0x194);}return _0x22beeb;};}function handleError(_0x3391b1,_0x16c8e5){_0x16c8e5=_0x16c8e5||0x1f4;return function(_0x5436b){logger[_0xc0f3('0x27')](_0x5436b[_0xc0f3('0x28')]);if(_0x5436b[_0xc0f3('0x29')]){delete _0x5436b[_0xc0f3('0x29')];}_0x3391b1['status'](_0x16c8e5)[_0xc0f3('0x2a')](_0x5436b);};}exports[_0xc0f3('0x2b')]=function(_0x1a6f94,_0x4f2e88){var _0x358eca={'raw':!![],'where':{'id':_0x1a6f94['params']['id']}},_0x493eb7={};_0x493eb7['model']=_[_0xc0f3('0x2c')](db[_0xc0f3('0x2d')]['rawAttributes']);_0x493eb7['query']=_[_0xc0f3('0x2c')](_0x1a6f94[_0xc0f3('0x2e')]);_0x493eb7[_0xc0f3('0x2f')]=_[_0xc0f3('0x30')](_0x493eb7[_0xc0f3('0x31')],_0x493eb7['query']);_0x358eca[_0xc0f3('0x32')]=_[_0xc0f3('0x30')](_0x493eb7['model'],qs[_0xc0f3('0x33')](_0x1a6f94[_0xc0f3('0x2e')]['fields']));_0x358eca[_0xc0f3('0x32')]=_0x358eca[_0xc0f3('0x32')][_0xc0f3('0x34')]?_0x358eca[_0xc0f3('0x32')]:_0x493eb7[_0xc0f3('0x31')];if(_0x1a6f94[_0xc0f3('0x2e')][_0xc0f3('0x35')]){_0x358eca['include']=[{'all':!![]}];}_0x358eca=_['merge']({},_0x358eca,_0x1a6f94['options']);return db[_0xc0f3('0x2d')]['find'](_0x358eca)[_0xc0f3('0x24')](handleEntityNotFound(_0x4f2e88,null))[_0xc0f3('0x24')](respondWithResult(_0x4f2e88,null))[_0xc0f3('0x36')](handleError(_0x4f2e88,null));};exports[_0xc0f3('0x37')]=function(_0x1d0bae,_0x1ee1d3){return db['ChatProactiveAction'][_0xc0f3('0x37')](_0x1d0bae[_0xc0f3('0x38')],{})[_0xc0f3('0x24')](respondWithResult(_0x1ee1d3,0xc9))['catch'](handleError(_0x1ee1d3,null));};exports[_0xc0f3('0x23')]=function(_0x523974,_0x155f55){if(_0x523974[_0xc0f3('0x38')]['id']){delete _0x523974['body']['id'];}return db[_0xc0f3('0x2d')][_0xc0f3('0x39')]({'where':{'id':_0x523974[_0xc0f3('0x3a')]['id']}})[_0xc0f3('0x24')](handleEntityNotFound(_0x155f55,null))[_0xc0f3('0x24')](saveUpdates(_0x523974[_0xc0f3('0x38')],null))[_0xc0f3('0x24')](respondWithResult(_0x155f55,null))[_0xc0f3('0x36')](handleError(_0x155f55,null));};exports[_0xc0f3('0x25')]=function(_0x2fbbac,_0x46bb46){return db[_0xc0f3('0x2d')][_0xc0f3('0x39')]({'where':{'id':_0x2fbbac['params']['id']}})[_0xc0f3('0x24')](handleEntityNotFound(_0x46bb46,null))['then'](removeEntity(_0x46bb46,null))[_0xc0f3('0x36')](handleError(_0x46bb46,null));}; \ No newline at end of file +var _0x3a32=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x16e8fa,_0x2fad34){var _0x7f1bcc=function(_0x352efb){while(--_0x352efb){_0x16e8fa['push'](_0x16e8fa['shift']());}};_0x7f1bcc(++_0x2fad34);}(_0x3a32,0x9b));var _0x23a3=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3a32[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require(_0x23a3('0x0'));var rimraf=require(_0x23a3('0x1'));var zipdir=require(_0x23a3('0x2'));var jsonpatch=require(_0x23a3('0x3'));var rp=require(_0x23a3('0x4'));var moment=require(_0x23a3('0x5'));var BPromise=require(_0x23a3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23a3('0x7'));var sox=require(_0x23a3('0x8'));var csv=require('to-csv');var ejs=require(_0x23a3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23a3('0xa'));var squel=require(_0x23a3('0xb'));var crypto=require(_0x23a3('0xc'));var jsforce=require(_0x23a3('0xd'));var deskjs=require(_0x23a3('0xe'));var toCsv=require(_0x23a3('0xf'));var querystring=require('querystring');var Papa=require(_0x23a3('0x10'));var Redis=require(_0x23a3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23a3('0x12'));var hardwareService=require(_0x23a3('0x13'));var logger=require(_0x23a3('0x14'))('api');var utils=require(_0x23a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x23a3('0x16'));var db=require(_0x23a3('0x17'))['db'];function respondWithStatusCode(_0x1ebeae,_0x4b65d9){_0x4b65d9=_0x4b65d9||0xcc;return function(_0x5f31f2){if(_0x5f31f2){return _0x1ebeae[_0x23a3('0x18')](_0x4b65d9);}return _0x1ebeae[_0x23a3('0x19')](_0x4b65d9)[_0x23a3('0x1a')]();};}function respondWithResult(_0x2af741,_0x52243b){_0x52243b=_0x52243b||0xc8;return function(_0x3c0e0e){if(_0x3c0e0e){return _0x2af741[_0x23a3('0x19')](_0x52243b)['json'](_0x3c0e0e);}};}function respondWithFilteredResult(_0x73759f,_0xcd0167){return function(_0x480bcd){if(_0x480bcd){var _0x2e9730=typeof _0xcd0167[_0x23a3('0x1b')]===_0x23a3('0x1c')&&typeof _0xcd0167[_0x23a3('0x1d')]===_0x23a3('0x1c');var _0x16fb78=_0x480bcd[_0x23a3('0x1e')];var _0xc33cbd=_0x2e9730?0x0:_0xcd0167['offset'];var _0x3961e9=_0x2e9730?_0x480bcd[_0x23a3('0x1e')]:_0xcd0167['offset']+_0xcd0167['limit'];var _0x289eb7;if(_0x3961e9>=_0x16fb78){_0x3961e9=_0x16fb78;_0x289eb7=0xc8;}else{_0x289eb7=0xce;}_0x73759f[_0x23a3('0x19')](_0x289eb7);return _0x73759f[_0x23a3('0x1f')](_0x23a3('0x20'),_0xc33cbd+'-'+_0x3961e9+'/'+_0x16fb78)[_0x23a3('0x21')](_0x480bcd);}return null;};}function patchUpdates(_0x1dd837){return function(_0x1a4cfc){try{jsonpatch[_0x23a3('0x22')](_0x1a4cfc,_0x1dd837,!![]);}catch(_0x1a9d86){return BPromise[_0x23a3('0x23')](_0x1a9d86);}return _0x1a4cfc[_0x23a3('0x24')]();};}function saveUpdates(_0x53ccdf,_0x51885){return function(_0x2bfe31){if(_0x2bfe31){return _0x2bfe31[_0x23a3('0x25')](_0x53ccdf)[_0x23a3('0x26')](function(_0x239e4b){return _0x239e4b;});}return null;};}function removeEntity(_0x264d1a,_0x509aa3){return function(_0x48a73c){if(_0x48a73c){return _0x48a73c['destroy']()[_0x23a3('0x26')](function(){_0x264d1a['status'](0xcc)[_0x23a3('0x1a')]();});}};}function handleEntityNotFound(_0x525b5f,_0x47539d){return function(_0x4f5583){if(!_0x4f5583){_0x525b5f[_0x23a3('0x18')](0x194);}return _0x4f5583;};}function handleError(_0x307493,_0x5d7cbc){_0x5d7cbc=_0x5d7cbc||0x1f4;return function(_0x333998){logger[_0x23a3('0x27')](_0x333998[_0x23a3('0x28')]);if(_0x333998[_0x23a3('0x29')]){delete _0x333998[_0x23a3('0x29')];}_0x307493['status'](_0x5d7cbc)[_0x23a3('0x2a')](_0x333998);};}exports[_0x23a3('0x2b')]=function(_0x3be09c,_0x6ab5f1){var _0x6bdfa8={'raw':!![],'where':{'id':_0x3be09c[_0x23a3('0x2c')]['id']}},_0x35519f={};_0x35519f[_0x23a3('0x2d')]=_['keys'](db[_0x23a3('0x2e')][_0x23a3('0x2f')]);_0x35519f[_0x23a3('0x30')]=_[_0x23a3('0x31')](_0x3be09c[_0x23a3('0x30')]);_0x35519f['filters']=_[_0x23a3('0x32')](_0x35519f[_0x23a3('0x2d')],_0x35519f[_0x23a3('0x30')]);_0x6bdfa8[_0x23a3('0x33')]=_[_0x23a3('0x32')](_0x35519f[_0x23a3('0x2d')],qs[_0x23a3('0x34')](_0x3be09c[_0x23a3('0x30')][_0x23a3('0x34')]));_0x6bdfa8[_0x23a3('0x33')]=_0x6bdfa8[_0x23a3('0x33')][_0x23a3('0x35')]?_0x6bdfa8['attributes']:_0x35519f[_0x23a3('0x2d')];if(_0x3be09c[_0x23a3('0x30')][_0x23a3('0x36')]){_0x6bdfa8[_0x23a3('0x37')]=[{'all':!![]}];}_0x6bdfa8=_['merge']({},_0x6bdfa8,_0x3be09c[_0x23a3('0x38')]);return db[_0x23a3('0x2e')]['find'](_0x6bdfa8)['then'](handleEntityNotFound(_0x6ab5f1,null))[_0x23a3('0x26')](respondWithResult(_0x6ab5f1,null))[_0x23a3('0x39')](handleError(_0x6ab5f1,null));};exports[_0x23a3('0x3a')]=function(_0x1596a2,_0x45bfca){return db['ChatProactiveAction'][_0x23a3('0x3a')](_0x1596a2[_0x23a3('0x3b')],{})[_0x23a3('0x26')](respondWithResult(_0x45bfca,0xc9))['catch'](handleError(_0x45bfca,null));};exports[_0x23a3('0x25')]=function(_0x542274,_0xd57d5d){if(_0x542274['body']['id']){delete _0x542274[_0x23a3('0x3b')]['id'];}return db[_0x23a3('0x2e')][_0x23a3('0x3c')]({'where':{'id':_0x542274[_0x23a3('0x2c')]['id']}})[_0x23a3('0x26')](handleEntityNotFound(_0xd57d5d,null))[_0x23a3('0x26')](saveUpdates(_0x542274[_0x23a3('0x3b')],null))[_0x23a3('0x26')](respondWithResult(_0xd57d5d,null))[_0x23a3('0x39')](handleError(_0xd57d5d,null));};exports['destroy']=function(_0x43a02a,_0x39b1c1){return db[_0x23a3('0x2e')][_0x23a3('0x3c')]({'where':{'id':_0x43a02a[_0x23a3('0x2c')]['id']}})[_0x23a3('0x26')](handleEntityNotFound(_0x39b1c1,null))[_0x23a3('0x26')](removeEntity(_0x39b1c1,null))[_0x23a3('0x39')](handleError(_0x39b1c1,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3db464b..0085cf9 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 _0x4bd9=['request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','../../config/logger','moment'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x4bd9,0xb1));var _0x94bd=function(_0x2d978b,_0x3411c6){_0x2d978b=_0x2d978b-0x0;var _0x2ed310=_0x4bd9[_0x2d978b];return _0x2ed310;};'use strict';var _=require('lodash');var util=require(_0x94bd('0x0'));var logger=require(_0x94bd('0x1'))('api');var moment=require(_0x94bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x94bd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94bd('0x4'));var config=require(_0x94bd('0x5'));var attributes=require(_0x94bd('0x6'));module[_0x94bd('0x7')]=function(_0x5161bf,_0x44917e){return _0x5161bf[_0x94bd('0x8')](_0x94bd('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x313a=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment'];(function(_0x11d291,_0x36072a){var _0x3253dc=function(_0x34c889){while(--_0x34c889){_0x11d291['push'](_0x11d291['shift']());}};_0x3253dc(++_0x36072a);}(_0x313a,0xb0));var _0xa313=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x313a[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0xa313('0x0'));var util=require(_0xa313('0x1'));var logger=require('../../config/logger')(_0xa313('0x2'));var moment=require(_0xa313('0x3'));var BPromise=require('bluebird');var rp=require(_0xa313('0x4'));var fs=require('fs');var path=require(_0xa313('0x5'));var rimraf=require(_0xa313('0x6'));var config=require('../../config/environment');var attributes=require(_0xa313('0x7'));module[_0xa313('0x8')]=function(_0x138a50,_0x36c3ad){return _0x138a50[_0xa313('0x9')](_0xa313('0xa'),attributes,{'tableName':_0xa313('0xb'),'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 932f9d9..1a91829 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 _0xf180=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x26ce1e,_0x13f248){var _0x1aef62=function(_0x31e573){while(--_0x31e573){_0x26ce1e['push'](_0x26ce1e['shift']());}};_0x1aef62(++_0x13f248);}(_0xf180,0xfe));var _0x0f18=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xf180[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0f18('0x0'));var util=require(_0x0f18('0x1'));var moment=require(_0x0f18('0x2'));var BPromise=require(_0x0f18('0x3'));var rs=require(_0x0f18('0x4'));var fs=require('fs');var Redis=require(_0x0f18('0x5'));var db=require(_0x0f18('0x6'))['db'];var utils=require(_0x0f18('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f18('0x8'));var jayson=require(_0x0f18('0x9'));var client=jayson[_0x0f18('0xa')][_0x0f18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b39b,_0x5ae503,_0x147be6){return new BPromise(function(_0x4c076d,_0x2fbfcd){return client['request'](_0x18b39b,_0x147be6)[_0x0f18('0xc')](function(_0x32d8ce){logger[_0x0f18('0xd')](_0x0f18('0xe'),_0x5ae503,_0x0f18('0xf'));logger[_0x0f18('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5ae503,'request\x20sent',JSON[_0x0f18('0x11')](_0x32d8ce));if(_0x32d8ce['error']){if(_0x32d8ce['error']['code']===0x1f4){logger[_0x0f18('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae503,_0x32d8ce['error'][_0x0f18('0x13')]);return _0x2fbfcd(_0x32d8ce['error'][_0x0f18('0x13')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x5ae503,_0x32d8ce[_0x0f18('0x12')][_0x0f18('0x13')]);return _0x4c076d(_0x32d8ce[_0x0f18('0x12')][_0x0f18('0x13')]);}else{logger[_0x0f18('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae503,_0x0f18('0xf'));_0x4c076d(_0x32d8ce['result']['message']);}})[_0x0f18('0x14')](function(_0x270673){logger[_0x0f18('0x12')](_0x0f18('0xe'),_0x5ae503,_0x270673);_0x2fbfcd(_0x270673);});});} \ No newline at end of file +var _0x91bd=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch'];(function(_0x9fd078,_0x742637){var _0x64e139=function(_0x28b39b){while(--_0x28b39b){_0x9fd078['push'](_0x9fd078['shift']());}};_0x64e139(++_0x742637);}(_0x91bd,0x150));var _0xd91b=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x91bd[_0xf73c09];return _0xa8923c;};'use strict';var _=require(_0xd91b('0x0'));var util=require(_0xd91b('0x1'));var moment=require(_0xd91b('0x2'));var BPromise=require(_0xd91b('0x3'));var rs=require(_0xd91b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd91b('0x5'))['db'];var utils=require(_0xd91b('0x6'));var logger=require(_0xd91b('0x7'))(_0xd91b('0x8'));var config=require(_0xd91b('0x9'));var jayson=require(_0xd91b('0xa'));var client=jayson[_0xd91b('0xb')][_0xd91b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa9422f,_0x2c208c,_0xe4d1cc){return new BPromise(function(_0x29791b,_0x529308){return client[_0xd91b('0xd')](_0xa9422f,_0xe4d1cc)[_0xd91b('0xe')](function(_0x18d90c){logger[_0xd91b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c208c,_0xd91b('0x10'));logger[_0xd91b('0x11')](_0xd91b('0x12'),_0x2c208c,'request\x20sent',JSON['stringify'](_0x18d90c));if(_0x18d90c[_0xd91b('0x13')]){if(_0x18d90c[_0xd91b('0x13')][_0xd91b('0x14')]===0x1f4){logger[_0xd91b('0x13')](_0xd91b('0x15'),_0x2c208c,_0x18d90c[_0xd91b('0x13')][_0xd91b('0x16')]);return _0x529308(_0x18d90c[_0xd91b('0x13')][_0xd91b('0x16')]);}logger[_0xd91b('0x13')](_0xd91b('0x15'),_0x2c208c,_0x18d90c['error'][_0xd91b('0x16')]);return _0x29791b(_0x18d90c[_0xd91b('0x13')]['message']);}else{logger[_0xd91b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c208c,_0xd91b('0x10'));_0x29791b(_0x18d90c['result']['message']);}})[_0xd91b('0x17')](function(_0x1d0f9d){logger[_0xd91b('0x13')](_0xd91b('0x15'),_0x2c208c,_0x1d0f9d);_0x529308(_0x1d0f9d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 714cce8..f7af320 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 _0x5fd1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x2c27b0,_0xdc5e35){var _0x41fd8d=function(_0x1e5368){while(--_0x1e5368){_0x2c27b0['push'](_0x2c27b0['shift']());}};_0x41fd8d(++_0xdc5e35);}(_0x5fd1,0x155));var _0x15fd=function(_0x27d5e9,_0x181117){_0x27d5e9=_0x27d5e9-0x0;var _0x1781ea=_0x5fd1[_0x27d5e9];return _0x1781ea;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x15fd('0x7')](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller[_0x15fd('0xa')]);router[_0x15fd('0xb')]('/',auth['isAuthenticated'](),controller[_0x15fd('0xc')]);router[_0x15fd('0xd')](_0x15fd('0x8'),auth['isAuthenticated'](),controller[_0x15fd('0xe')]);router['delete'](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller['destroy']);module['exports']=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(_0x4256aa,_0x16af5c){var _0x15ca3b=function(_0x5b161b){while(--_0x5b161b){_0x4256aa['push'](_0x4256aa['shift']());}};_0x15ca3b(++_0x16af5c);}(_0x032e,0x124));var _0xe032=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x032e[_0x2f5ac5];return _0x37c9a8;};'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 6b7eff2..0c6370c 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 _0x4f82=['roundrobin','exports','STRING','name','INTEGER','beepall'];(function(_0x3576c1,_0x2e48ec){var _0x4ca868=function(_0x1ce54e){while(--_0x1ce54e){_0x3576c1['push'](_0x3576c1['shift']());}};_0x4ca868(++_0x2e48ec);}(_0x4f82,0x13f));var _0x24f8=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4f82[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0x24f8('0x0')]={'name':{'type':Sequelize[_0x24f8('0x1')],'unique':_0x24f8('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x24f8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x24f8('0x4'),_0x24f8('0x5'))}}; \ No newline at end of file +var _0xc2cc=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x24d982,_0x1d638b){var _0x2441c4=function(_0x290e43){while(--_0x290e43){_0x24d982['push'](_0x24d982['shift']());}};_0x2441c4(++_0x1d638b);}(_0xc2cc,0x92));var _0xcc2c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2cc[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xcc2c('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc2c('0x1')],'unique':_0xcc2c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc2c('0x1')]},'timeout':{'type':Sequelize[_0xcc2c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc2c('0x4')](_0xcc2c('0x5'),_0xcc2c('0x6'),_0xcc2c('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d112640..60482f8 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 _0xe81b=['name','send','map','rawAttributes','fieldName','key','getOptions','ChatQueue','include','query','findAll','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','sort','where','ChatQueueId','filter','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','pick','hasOwnProperty','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','field','from','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','nolimit','lodash','squel','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack'];(function(_0x587bd8,_0x598772){var _0x57cf30=function(_0x544d42){while(--_0x544d42){_0x587bd8['push'](_0x587bd8['shift']());}};_0x57cf30(++_0x598772);}(_0xe81b,0xd2));var _0xbe81=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xe81b[_0x42bdad];return _0x122626;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xbe81('0x0'));var squel=require(_0xbe81('0x1'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe81('0x2'))(_0xbe81('0x3'));var config=require('../../config/environment');var db=require(_0xbe81('0x4'))['db'];config[_0xbe81('0x5')]=_[_0xbe81('0x6')](config[_0xbe81('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe81('0x7'))(new Redis(config[_0xbe81('0x5')]));require(_0xbe81('0x8'))['register'](socket);function respondWithStatusCode(_0x11bbf7,_0x2ae964){_0x2ae964=_0x2ae964||0xcc;return function(_0xee8605){if(_0xee8605){return _0x11bbf7[_0xbe81('0x9')](_0x2ae964);}return _0x11bbf7[_0xbe81('0xa')](_0x2ae964)[_0xbe81('0xb')]();};}function respondWithResult(_0x3bacf1,_0x2d0939){_0x2d0939=_0x2d0939||0xc8;return function(_0x2533c9){if(_0x2533c9){return _0x3bacf1[_0xbe81('0xa')](_0x2d0939)['json'](_0x2533c9);}};}function respondWithFilteredResult(_0x532609,_0x595cdb){return function(_0x45e187){if(_0x45e187){var _0x5c987e=typeof _0x595cdb[_0xbe81('0xc')]===_0xbe81('0xd')&&typeof _0x595cdb[_0xbe81('0xe')]===_0xbe81('0xd');var _0x28e9d1=_0x45e187[_0xbe81('0xf')];var _0x531131=_0x5c987e?0x0:_0x595cdb[_0xbe81('0xc')];var _0x505dbc=_0x5c987e?_0x45e187[_0xbe81('0xf')]:_0x595cdb['offset']+_0x595cdb[_0xbe81('0xe')];var _0x43ffb7;if(_0x505dbc>=_0x28e9d1){_0x505dbc=_0x28e9d1;_0x43ffb7=0xc8;}else{_0x43ffb7=0xce;}_0x532609[_0xbe81('0xa')](_0x43ffb7);return _0x532609[_0xbe81('0x10')]('Content-Range',_0x531131+'-'+_0x505dbc+'/'+_0x28e9d1)[_0xbe81('0x11')](_0x45e187);}return null;};}function saveUpdates(_0x418709){return function(_0x197f10){if(_0x197f10){return _0x197f10[_0xbe81('0x12')](_0x418709)[_0xbe81('0x13')](function(_0x297115){return _0x297115;});}return null;};}function removeEntity(_0x2f7dcc){return function(_0xaa1db2){if(_0xaa1db2){return _0xaa1db2[_0xbe81('0x14')]()[_0xbe81('0x13')](function(){var _0x53e84e=_0xaa1db2[_0xbe81('0x15')]({'plain':!![]});var _0x4c3d39=_0xbe81('0x16');return db[_0xbe81('0x17')][_0xbe81('0x14')]({'where':{'type':_0x4c3d39,'resourceId':_0x53e84e['id']}})[_0xbe81('0x13')](function(){return _0xaa1db2;});})[_0xbe81('0x13')](function(){_0x2f7dcc[_0xbe81('0xa')](0xcc)[_0xbe81('0xb')]();});}};}function handleEntityNotFound(_0x53ecc8){return function(_0x372df4){if(!_0x372df4){_0x53ecc8['sendStatus'](0x194);}return _0x372df4;};}function handleError(_0x5b3da6,_0x5eff54){_0x5eff54=_0x5eff54||0x1f4;return function(_0x26ae7a){logger[_0xbe81('0x18')](_0x26ae7a[_0xbe81('0x19')]);if(_0x26ae7a[_0xbe81('0x1a')]){delete _0x26ae7a[_0xbe81('0x1a')];}_0x5b3da6[_0xbe81('0xa')](_0x5eff54)[_0xbe81('0x1b')](_0x26ae7a);};}exports['index']=function(_0x23a62f,_0x55bae1){var _0x3ea815={};var _0x219dce={'count':0x0,'rows':[]};var _0x576f24=_[_0xbe81('0x1c')](db['ChatQueue'][_0xbe81('0x1d')],function(_0x121f4d){return{'name':_0x121f4d[_0xbe81('0x1e')],'type':_0x121f4d['type'][_0xbe81('0x1f')]};});_0x3ea815=qs[_0xbe81('0x20')](_0x576f24,_0x23a62f);var _0x5de6a7={'where':_0x3ea815['where']};return db[_0xbe81('0x21')][_0xbe81('0xf')](_0x5de6a7)[_0xbe81('0x13')](function(_0xea1e1b){_0x219dce['count']=_0xea1e1b;_0x3ea815[_0xbe81('0x22')]=qs[_0xbe81('0x22')](_0x23a62f[_0xbe81('0x23')]);return db['ChatQueue'][_0xbe81('0x24')](_0x3ea815);})[_0xbe81('0x13')](function(_0x2e56d4){_0x219dce['rows']=_0x2e56d4;return _0x219dce;})[_0xbe81('0x13')](respondWithFilteredResult(_0x55bae1,_0x3ea815))['catch'](handleError(_0x55bae1,null));};exports[_0xbe81('0x25')]=function(_0x1c50db,_0x401291){var _0x5bf694={'raw':!![],'where':{'id':_0x1c50db[_0xbe81('0x26')]['id']}},_0x3012e1={};_0x3012e1[_0xbe81('0x27')]=_[_0xbe81('0x28')](db[_0xbe81('0x21')][_0xbe81('0x1d')]);_0x3012e1[_0xbe81('0x23')]=_[_0xbe81('0x28')](_0x1c50db[_0xbe81('0x23')]);_0x3012e1[_0xbe81('0x29')]=_[_0xbe81('0x2a')](_0x3012e1['model'],_0x3012e1[_0xbe81('0x23')]);_0x5bf694[_0xbe81('0x2b')]=_[_0xbe81('0x2a')](_0x3012e1['model'],qs[_0xbe81('0x2c')](_0x1c50db[_0xbe81('0x23')]['fields']));_0x5bf694[_0xbe81('0x2b')]=_0x5bf694[_0xbe81('0x2b')][_0xbe81('0x2d')]?_0x5bf694[_0xbe81('0x2b')]:_0x3012e1['model'];if(_0x1c50db['query'][_0xbe81('0x2e')]){_0x5bf694[_0xbe81('0x22')]=[{'all':!![]}];}_0x5bf694=_[_0xbe81('0x2f')]({},_0x5bf694,_0x1c50db[_0xbe81('0x30')]);return db['ChatQueue'][_0xbe81('0x31')](_0x5bf694)[_0xbe81('0x13')](handleEntityNotFound(_0x401291,null))['then'](respondWithResult(_0x401291,null))[_0xbe81('0x32')](handleError(_0x401291,null));};exports[_0xbe81('0x33')]=function(_0x35e519,_0x1d2122){return db['ChatQueue'][_0xbe81('0x33')](_0x35e519['body'],{})[_0xbe81('0x13')](function(_0x513fc6){var _0x5b2a11=_0x35e519[_0xbe81('0x34')][_0xbe81('0x15')]({'plain':!![]});if(!_0x5b2a11)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b2a11[_0xbe81('0x35')]==='user'){var _0x57cefb=_0x513fc6[_0xbe81('0x15')]({'plain':!![]});var _0x19632f=_0xbe81('0x16');return db[_0xbe81('0x36')][_0xbe81('0x31')]({'where':{'name':_0x19632f,'userProfileId':_0x5b2a11[_0xbe81('0x37')]},'raw':!![]})['then'](function(_0x58dea7){if(_0x58dea7&&_0x58dea7['autoAssociation']===0x0){return db[_0xbe81('0x17')][_0xbe81('0x33')]({'name':_0x57cefb[_0xbe81('0x1a')],'resourceId':_0x57cefb['id'],'type':_0x58dea7[_0xbe81('0x1a')],'sectionId':_0x58dea7['id']},{})[_0xbe81('0x13')](function(){return _0x513fc6;});}else{return _0x513fc6;}})[_0xbe81('0x32')](function(_0x119c78){logger['error'](_0xbe81('0x38'),_0x119c78);throw _0x119c78;});}return _0x513fc6;})['then'](respondWithResult(_0x1d2122,0xc9))[_0xbe81('0x32')](handleError(_0x1d2122,null));};exports[_0xbe81('0x12')]=function(_0x47f2f0,_0x5d5488){if(_0x47f2f0['body']['id']){delete _0x47f2f0[_0xbe81('0x39')]['id'];}return db[_0xbe81('0x21')][_0xbe81('0x31')]({'where':{'id':_0x47f2f0[_0xbe81('0x26')]['id']}})[_0xbe81('0x13')](handleEntityNotFound(_0x5d5488,null))[_0xbe81('0x13')](saveUpdates(_0x47f2f0[_0xbe81('0x39')],null))[_0xbe81('0x13')](respondWithResult(_0x5d5488,null))[_0xbe81('0x32')](handleError(_0x5d5488,null));};exports[_0xbe81('0x14')]=function(_0x46bcdb,_0x4052f6){return db[_0xbe81('0x21')][_0xbe81('0x31')]({'where':{'id':_0x46bcdb[_0xbe81('0x26')]['id']}})[_0xbe81('0x13')](handleEntityNotFound(_0x4052f6,null))[_0xbe81('0x13')](removeEntity(_0x4052f6,null))[_0xbe81('0x32')](handleError(_0x4052f6,null));};exports[_0xbe81('0x3a')]=function(_0x27ddcc,_0x2824f9){return db['ChatQueue'][_0xbe81('0x3a')]()['then'](respondWithResult(_0x2824f9,null))[_0xbe81('0x32')](handleError(_0x2824f9,null));};exports[_0xbe81('0x3b')]=function(_0x1158b2,_0x154ad5){var _0x25a24e={'raw':!![],'where':{}},_0x210060={},_0x4053a9;return db[_0xbe81('0x21')][_0xbe81('0x3c')]({'where':{'id':_0x1158b2[_0xbe81('0x26')]['id']}})['then'](handleEntityNotFound(_0x154ad5,null))[_0xbe81('0x13')](function(_0x5e67b1){if(_0x5e67b1){_0x4053a9=_0x5e67b1[_0xbe81('0x15')]({'plain':!![]});_0x210060['model']=_['keys'](db['UserChatQueue'][_0xbe81('0x1d')]);_0x210060[_0xbe81('0x23')]=_['keys'](_0x1158b2['query']);_0x210060['filters']=_['intersection'](_0x210060['model'],_0x210060[_0xbe81('0x23')]);_0x25a24e[_0xbe81('0x2b')]=_[_0xbe81('0x2a')](_0x210060[_0xbe81('0x27')],qs[_0xbe81('0x2c')](_0x1158b2[_0xbe81('0x23')][_0xbe81('0x2c')]));_0x25a24e[_0xbe81('0x2b')]=_0x25a24e['attributes']['length']?_0x25a24e[_0xbe81('0x2b')]:_0x210060[_0xbe81('0x27')];if(!_0x1158b2['query']['hasOwnProperty']('nolimit')){_0x25a24e['limit']=qs[_0xbe81('0xe')](_0x1158b2[_0xbe81('0x23')][_0xbe81('0xe')]);_0x25a24e[_0xbe81('0xc')]=qs[_0xbe81('0xc')](_0x1158b2[_0xbe81('0x23')][_0xbe81('0xc')]);}_0x25a24e['order']=qs[_0xbe81('0x3d')](_0x1158b2[_0xbe81('0x23')][_0xbe81('0x3d')]);_0x25a24e[_0xbe81('0x3e')]=qs['filters'](_['pick'](_0x1158b2[_0xbe81('0x23')],_0x210060[_0xbe81('0x29')]));_0x25a24e['where'][_0xbe81('0x3f')]=_0x5e67b1['id'];if(_0x1158b2[_0xbe81('0x23')]['filter']){_0x25a24e[_0xbe81('0x3e')]=_[_0xbe81('0x2f')](_0x25a24e[_0xbe81('0x3e')],{'$or':_[_0xbe81('0x1c')](_0x25a24e[_0xbe81('0x2b')],function(_0x524fd1){var _0x1c0820={};_0x1c0820[_0x524fd1]={'$like':'%'+_0x1158b2[_0xbe81('0x23')][_0xbe81('0x40')]+'%'};return _0x1c0820;})});}_0x25a24e=_['merge']({},_0x25a24e,_0x1158b2[_0xbe81('0x30')]);return db[_0xbe81('0x41')][_0xbe81('0x24')](_0x25a24e);}})['then'](function(_0x50475a){if(_0x50475a){return db[_0xbe81('0x42')][_0xbe81('0x43')]({'where':{'id':_['map'](_0x50475a,_0xbe81('0x44')),'role':_0xbe81('0x45')},'attributes':['id',_0xbe81('0x1a'),_0xbe81('0x46'),_0xbe81('0x47'),_0xbe81('0x48')]});}})[_0xbe81('0x13')](function(_0x103ada){if(_0x103ada){return{'count':_0x103ada[_0xbe81('0xf')],'rows':_[_0xbe81('0x1c')](_0x103ada['rows'],function(_0x42438e){return{'membername':_0x42438e[_0xbe81('0x1a')],'UserId':_0x42438e['id'],'queue_name':_0x4053a9[_0xbe81('0x1a')],'ChatQueueId':_0x4053a9['id'],'interface':util[_0xbe81('0x49')](_0xbe81('0x4a'),_0xbe81('0x4b'),_0x42438e[_0xbe81('0x1a')]),'penalty':0x0,'paused':_0x42438e[_0xbe81('0x46')],'createdAt':_0x42438e[_0xbe81('0x48')],'updatedAt':_0x42438e[_0xbe81('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbe81('0x13')](respondWithFilteredResult(_0x154ad5,_0x25a24e))[_0xbe81('0x32')](handleError(_0x154ad5,null));};exports[_0xbe81('0x4c')]=function(_0x53072c,_0x5f2783){var _0x1f68dd={};var _0x287d6d={};var _0x41120e;var _0x34dd1f;return db[_0xbe81('0x21')][_0xbe81('0x3c')]({'where':{'id':_0x53072c[_0xbe81('0x26')]['id']}})[_0xbe81('0x13')](handleEntityNotFound(_0x5f2783,null))[_0xbe81('0x13')](function(_0x5135a8){if(_0x5135a8){_0x41120e=_0x5135a8;_0x287d6d[_0xbe81('0x27')]=_[_0xbe81('0x28')](db[_0xbe81('0x4d')][_0xbe81('0x1d')]);_0x287d6d['query']=_['keys'](_0x53072c[_0xbe81('0x23')]);_0x287d6d[_0xbe81('0x29')]=_['intersection'](_0x287d6d[_0xbe81('0x27')],_0x287d6d[_0xbe81('0x23')]);_0x1f68dd['attributes']=_[_0xbe81('0x2a')](_0x287d6d[_0xbe81('0x27')],qs[_0xbe81('0x2c')](_0x53072c['query'][_0xbe81('0x2c')]));_0x1f68dd[_0xbe81('0x2b')]=_0x1f68dd[_0xbe81('0x2b')][_0xbe81('0x2d')]?_0x1f68dd[_0xbe81('0x2b')]:_0x287d6d[_0xbe81('0x27')];_0x1f68dd[_0xbe81('0x4e')]=qs[_0xbe81('0x3d')](_0x53072c['query'][_0xbe81('0x3d')]);_0x1f68dd[_0xbe81('0x3e')]=qs['filters'](_[_0xbe81('0x4f')](_0x53072c['query'],_0x287d6d[_0xbe81('0x29')]));if(_0x53072c[_0xbe81('0x23')][_0xbe81('0x40')]){_0x1f68dd['where']=_[_0xbe81('0x2f')](_0x1f68dd[_0xbe81('0x3e')],{'$or':_[_0xbe81('0x1c')](_0x1f68dd[_0xbe81('0x2b')],function(_0x2f5891){var _0x536e5a={};_0x536e5a[_0x2f5891]={'$like':'%'+_0x53072c[_0xbe81('0x23')][_0xbe81('0x40')]+'%'};return _0x536e5a;})});}_0x1f68dd=_[_0xbe81('0x2f')]({},_0x1f68dd,_0x53072c[_0xbe81('0x30')]);return _0x41120e['getTeams'](_0x1f68dd);}})['then'](function(_0xfb04d7){if(_0xfb04d7){_0x34dd1f=_0xfb04d7[_0xbe81('0x2d')];if(!_0x53072c[_0xbe81('0x23')][_0xbe81('0x50')]('nolimit')){_0x1f68dd[_0xbe81('0xe')]=qs['limit'](_0x53072c[_0xbe81('0x23')][_0xbe81('0xe')]);_0x1f68dd[_0xbe81('0xc')]=qs[_0xbe81('0xc')](_0x53072c[_0xbe81('0x23')][_0xbe81('0xc')]);}return _0x41120e[_0xbe81('0x4c')](_0x1f68dd);}})[_0xbe81('0x13')](function(_0x47f948){if(_0x47f948){return _0x47f948?{'count':_0x34dd1f,'rows':_0x47f948}:null;}})[_0xbe81('0x13')](respondWithResult(_0x5f2783,null))[_0xbe81('0x32')](handleError(_0x5f2783,null));};exports[_0xbe81('0x51')]=function(_0x2f1554,_0xb6361a){var _0x3bc3e9=_0x2f1554[_0xbe81('0x39')][_0xbe81('0x52')];return db[_0xbe81('0x4d')][_0xbe81('0x24')]({'where':{'id':_0x3bc3e9},'attributes':['id'],'include':[{'model':db[_0xbe81('0x42')],'as':_0xbe81('0x53'),'attributes':['id','name',_0xbe81('0x54'),_0xbe81('0x55'),'interface'],'raw':!![]}]})[_0xbe81('0x13')](function(_0x15e855){if(_0x15e855){var _0x3e4f4d=_[_0xbe81('0x56')](_0x15e855,function(_0x26c117){var _0x3393c6=_0x26c117[_0xbe81('0x15')]({'plain':!![]});return _0x3393c6[_0xbe81('0x53')];});return db[_0xbe81('0x21')]['find']({'where':{'id':_0x2f1554[_0xbe81('0x26')]['id']}})['then'](function(_0x31be90){return db[_0xbe81('0x57')][_0xbe81('0x58')](function(_0x23d744){return _0x31be90[_0xbe81('0x51')](_0x3bc3e9,{'transaction':_0x23d744})[_0xbe81('0x13')](function(){return BPromise[_0xbe81('0x59')](_0x3e4f4d,function(_0xf7f42d){return db['UserChatQueue'][_0xbe81('0x5a')]({'where':{'UserId':_0xf7f42d['id'],'ChatQueueId':_0x2f1554['params']['id']},'transaction':_0x23d744});});})[_0xbe81('0x13')](function(){_0x3e4f4d[_0xbe81('0x5b')](function(_0x512a5e){socket[_0xbe81('0x5c')](_0xbe81('0x5d'),{'UserId':_0x512a5e['id'],'ChatQueueId':_0x31be90['id']});});});});});}})[_0xbe81('0x13')](respondWithStatusCode(_0xb6361a,null))[_0xbe81('0x32')](handleError(_0xb6361a,null));};exports['removeTeams']=function(_0x1fd4d8,_0x25ff51){return db[_0xbe81('0x4d')]['findAll']({'where':{'id':_0x1fd4d8['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xbe81('0x42')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe81('0x13')](handleEntityNotFound(_0x25ff51,null))[_0xbe81('0x13')](function(_0x169b83){var _0x2eabf9=_[_0xbe81('0x1c')](_0x169b83,'id');var _0x50a314=[];var _0x4ab07f=[];var _0x303087=squel['select']();_0x303087[_0xbe81('0x5e')]('tq.TeamId')[_0xbe81('0x5f')]('team_has_chat_queues','tq')['join']('user_has_teams','ut',_0xbe81('0x60'))['where']('ChatQueueId\x20=\x20?',_0x1fd4d8[_0xbe81('0x26')]['id']);for(var _0x4a1fa5=0x0;_0x4a1fa5<_0x169b83[_0xbe81('0x2d')];_0x4a1fa5+=0x1){let _0x3f8af0=_0x169b83[_0x4a1fa5];for(var _0x572d1b=0x0;_0x572d1b<_0x3f8af0['Agents'][_0xbe81('0x2d')];_0x572d1b+=0x1){let _0x54623c=_0x3f8af0['Agents'][_0x572d1b];var _0x53fba3=_0x303087[_0xbe81('0x61')]();_0x53fba3[_0xbe81('0x3e')](_0xbe81('0x62'),_0x54623c['id']);_0x4ab07f[_0xbe81('0x63')](db[_0xbe81('0x57')]['query'](_0x53fba3[_0xbe81('0x64')](),{'type':db[_0xbe81('0x57')]['QueryTypes'][_0xbe81('0x65')]})[_0xbe81('0x13')](function(_0x1fe0ec){if(_0x1fe0ec['length']===0x1){return _0x54623c['id'];}else{var _0x3eed5b=_[_0xbe81('0x66')](_[_0xbe81('0x1c')](_0x1fe0ec,_0xbe81('0x67')),function(_0x30b27f){return _[_0xbe81('0x68')](_0x2eabf9,_0x30b27f);});if(_0x3eed5b){return _0x54623c['id'];}}}));}}return BPromise[_0xbe81('0x69')](_0x4ab07f)[_0xbe81('0x13')](function(_0x8dfc47){_0x50a314=_(_0x50a314)[_0xbe81('0x6a')](_0x8dfc47)[_0xbe81('0x6b')]()[_0xbe81('0x6c')]();return db[_0xbe81('0x21')]['find']({'where':{'id':_0x1fd4d8['params']['id']}})['then'](function(_0xbbc1d1){return db[_0xbe81('0x57')][_0xbe81('0x58')](function(_0x3a6e5f){return _0xbbc1d1[_0xbe81('0x6d')](_0x1fd4d8[_0xbe81('0x23')][_0xbe81('0x52')],{'transaction':_0x3a6e5f})['then'](function(){if(!_[_0xbe81('0x6e')](_0x50a314)){return _0xbbc1d1[_0xbe81('0x6f')](_0x50a314,{'transaction':_0x3a6e5f});}})[_0xbe81('0x13')](function(){_0x50a314['forEach'](function(_0x21de3e){socket[_0xbe81('0x5c')](_0xbe81('0x70'),{'UserId':_0x21de3e,'ChatQueueId':_0xbbc1d1['id']});});});});});});})[_0xbe81('0x13')](respondWithStatusCode(_0x25ff51,null))['catch'](handleError(_0x25ff51,null));};exports['addAgents']=function(_0x3b71ce,_0x2653e3){return db['ChatQueue'][_0xbe81('0x31')]({'where':{'id':_0x3b71ce[_0xbe81('0x26')]['id']}})[_0xbe81('0x13')](handleEntityNotFound(_0x2653e3,null))[_0xbe81('0x13')](function(_0x193afd){if(_0x193afd){return _0x193afd[_0xbe81('0x71')](_0x3b71ce[_0xbe81('0x39')][_0xbe81('0x52')],_[_0xbe81('0x72')](_0x3b71ce[_0xbe81('0x39')],[_0xbe81('0x52'),'id'])||{})[_0xbe81('0x73')](function(_0x5bfbe1){for(var _0x3d100c=0x0;_0x3d100c<_0x3b71ce['body'][_0xbe81('0x52')][_0xbe81('0x2d')];_0x3d100c+=0x1){socket[_0xbe81('0x5c')](_0xbe81('0x5d'),{'UserId':Number(_0x3b71ce[_0xbe81('0x39')][_0xbe81('0x52')][_0x3d100c]),'ChatQueueId':Number(_0x3b71ce[_0xbe81('0x26')]['id'])});}return _0x5bfbe1;});}})[_0xbe81('0x13')](respondWithResult(_0x2653e3,null))[_0xbe81('0x32')](handleError(_0x2653e3,null));};exports['removeAgents']=function(_0x1c6e7d,_0x544249){return db['ChatQueue'][_0xbe81('0x31')]({'where':{'id':_0x1c6e7d[_0xbe81('0x26')]['id']}})[_0xbe81('0x13')](handleEntityNotFound(_0x544249,null))[_0xbe81('0x13')](function(_0x458916){if(_0x458916){return _0x458916[_0xbe81('0x6f')](_0x1c6e7d[_0xbe81('0x23')][_0xbe81('0x52')])[_0xbe81('0x13')](function(){if(_['isArray'](_0x1c6e7d[_0xbe81('0x23')][_0xbe81('0x52')])){for(var _0x24b2e4=0x0;_0x24b2e4<_0x1c6e7d[_0xbe81('0x23')][_0xbe81('0x52')][_0xbe81('0x2d')];_0x24b2e4+=0x1){socket[_0xbe81('0x5c')]('userChatQueue:remove',{'UserId':Number(_0x1c6e7d[_0xbe81('0x23')][_0xbe81('0x52')][_0x24b2e4]),'ChatQueueId':Number(_0x1c6e7d[_0xbe81('0x26')]['id'])});}}else{socket['emit'](_0xbe81('0x70'),{'UserId':Number(_0x1c6e7d[_0xbe81('0x23')][_0xbe81('0x52')]),'ChatQueueId':Number(_0x1c6e7d[_0xbe81('0x26')]['id'])});}});}})[_0xbe81('0x13')](respondWithStatusCode(_0x544249,null))[_0xbe81('0x32')](handleError(_0x544249,null));};exports[_0xbe81('0x74')]=function(_0x15d9a0,_0x42c787){var _0x3b5682={};var _0xccfbc7={};var _0x4b8809;var _0x3589be;return db[_0xbe81('0x21')][_0xbe81('0x3c')]({'where':{'id':_0x15d9a0['params']['id']}})[_0xbe81('0x13')](handleEntityNotFound(_0x42c787,null))['then'](function(_0x49e420){if(_0x49e420){_0x4b8809=_0x49e420;_0xccfbc7[_0xbe81('0x27')]=_['keys'](db[_0xbe81('0x42')]['rawAttributes']);_0xccfbc7[_0xbe81('0x23')]=_[_0xbe81('0x28')](_0x15d9a0[_0xbe81('0x23')]);_0xccfbc7[_0xbe81('0x29')]=_[_0xbe81('0x2a')](_0xccfbc7[_0xbe81('0x27')],_0xccfbc7['query']);_0x3b5682[_0xbe81('0x2b')]=_['intersection'](_0xccfbc7[_0xbe81('0x27')],qs[_0xbe81('0x2c')](_0x15d9a0[_0xbe81('0x23')][_0xbe81('0x2c')]));_0x3b5682[_0xbe81('0x2b')]=_0x3b5682['attributes']['length']?_0x3b5682[_0xbe81('0x2b')]:_0xccfbc7[_0xbe81('0x27')];_0x3b5682['order']=qs['sort'](_0x15d9a0[_0xbe81('0x23')][_0xbe81('0x3d')]);_0x3b5682[_0xbe81('0x3e')]=qs[_0xbe81('0x29')](_[_0xbe81('0x4f')](_0x15d9a0[_0xbe81('0x23')],_0xccfbc7['filters']));if(_0x15d9a0[_0xbe81('0x23')][_0xbe81('0x40')]){_0x3b5682[_0xbe81('0x3e')]=_[_0xbe81('0x2f')](_0x3b5682['where'],{'$or':_[_0xbe81('0x1c')](_0x3b5682[_0xbe81('0x2b')],function(_0x324da1){var _0x3bf935={};_0x3bf935[_0x324da1]={'$like':'%'+_0x15d9a0['query'][_0xbe81('0x40')]+'%'};return _0x3bf935;})});}_0x3b5682=_[_0xbe81('0x2f')]({},_0x3b5682,_0x15d9a0[_0xbe81('0x30')]);return _0x4b8809['getAgents'](_0x3b5682);}})[_0xbe81('0x13')](function(_0x426f1c){if(_0x426f1c){_0x3589be=_0x426f1c[_0xbe81('0x2d')];if(!_0x15d9a0[_0xbe81('0x23')][_0xbe81('0x50')](_0xbe81('0x75'))){_0x3b5682[_0xbe81('0xe')]=qs[_0xbe81('0xe')](_0x15d9a0['query'][_0xbe81('0xe')]);_0x3b5682[_0xbe81('0xc')]=qs['offset'](_0x15d9a0[_0xbe81('0x23')][_0xbe81('0xc')]);}return _0x4b8809['getAgents'](_0x3b5682);}})[_0xbe81('0x13')](function(_0xf64a9c){if(_0xf64a9c){return _0xf64a9c?{'count':_0x3589be,'rows':_0xf64a9c}:null;}})[_0xbe81('0x13')](respondWithResult(_0x42c787,null))[_0xbe81('0x32')](handleError(_0x42c787,null));}; \ No newline at end of file +var _0xa2c2=['Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','all','compact','forEach','emit','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','ChatQueues','error','stack','name','send','index','map','fieldName','type','where','ChatQueue','include','query','findAll','catch','model','rawAttributes','keys','filters','intersection','attributes','length','merge','options','find','create','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','fields','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','UserChatQueue','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','chatPause','updatedAt','getTeams'];(function(_0x495f22,_0x392ea1){var _0x593b86=function(_0x18c8a9){while(--_0x18c8a9){_0x495f22['push'](_0x495f22['shift']());}};_0x593b86(++_0x392ea1);}(_0xa2c2,0x10c));var _0x2a2c=function(_0x3051e2,_0x33ca33){_0x3051e2=_0x3051e2-0x0;var _0x593aa1=_0xa2c2[_0x3051e2];return _0x593aa1;};'use strict';var BPromise=require(_0x2a2c('0x0'));var util=require(_0x2a2c('0x1'));var _=require(_0x2a2c('0x2'));var squel=require(_0x2a2c('0x3'));var Redis=require(_0x2a2c('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x2a2c('0x5'));var db=require(_0x2a2c('0x6'))['db'];config[_0x2a2c('0x7')]=_['defaults'](config[_0x2a2c('0x7')],{'host':_0x2a2c('0x8'),'port':0x18eb});var socket=require(_0x2a2c('0x9'))(new Redis(config[_0x2a2c('0x7')]));require(_0x2a2c('0xa'))[_0x2a2c('0xb')](socket);function respondWithStatusCode(_0xa6ae15,_0x544934){_0x544934=_0x544934||0xcc;return function(_0x1052d8){if(_0x1052d8){return _0xa6ae15[_0x2a2c('0xc')](_0x544934);}return _0xa6ae15[_0x2a2c('0xd')](_0x544934)[_0x2a2c('0xe')]();};}function respondWithResult(_0x53aab0,_0x5bca2a){_0x5bca2a=_0x5bca2a||0xc8;return function(_0x30b47a){if(_0x30b47a){return _0x53aab0[_0x2a2c('0xd')](_0x5bca2a)[_0x2a2c('0xf')](_0x30b47a);}};}function respondWithFilteredResult(_0x57b3b6,_0x4d1ca1){return function(_0x152120){if(_0x152120){var _0x2f887c=typeof _0x4d1ca1[_0x2a2c('0x10')]===_0x2a2c('0x11')&&typeof _0x4d1ca1[_0x2a2c('0x12')]===_0x2a2c('0x11');var _0x2e0a47=_0x152120['count'];var _0x9947e9=_0x2f887c?0x0:_0x4d1ca1[_0x2a2c('0x10')];var _0x1e8fcf=_0x2f887c?_0x152120[_0x2a2c('0x13')]:_0x4d1ca1[_0x2a2c('0x10')]+_0x4d1ca1[_0x2a2c('0x12')];var _0x2b2f36;if(_0x1e8fcf>=_0x2e0a47){_0x1e8fcf=_0x2e0a47;_0x2b2f36=0xc8;}else{_0x2b2f36=0xce;}_0x57b3b6[_0x2a2c('0xd')](_0x2b2f36);return _0x57b3b6['set'](_0x2a2c('0x14'),_0x9947e9+'-'+_0x1e8fcf+'/'+_0x2e0a47)[_0x2a2c('0xf')](_0x152120);}return null;};}function saveUpdates(_0x2274ff){return function(_0x54694d){if(_0x54694d){return _0x54694d[_0x2a2c('0x15')](_0x2274ff)[_0x2a2c('0x16')](function(_0xb453d8){return _0xb453d8;});}return null;};}function removeEntity(_0xc3121a){return function(_0x2e980e){if(_0x2e980e){return _0x2e980e[_0x2a2c('0x17')]()[_0x2a2c('0x16')](function(){var _0x27c9ae=_0x2e980e[_0x2a2c('0x18')]({'plain':!![]});var _0x104dda=_0x2a2c('0x19');return db['UserProfileResource'][_0x2a2c('0x17')]({'where':{'type':_0x104dda,'resourceId':_0x27c9ae['id']}})[_0x2a2c('0x16')](function(){return _0x2e980e;});})[_0x2a2c('0x16')](function(){_0xc3121a[_0x2a2c('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6287){return function(_0x27d2f5){if(!_0x27d2f5){_0x1a6287[_0x2a2c('0xc')](0x194);}return _0x27d2f5;};}function handleError(_0x43e9e5,_0x117f3e){_0x117f3e=_0x117f3e||0x1f4;return function(_0x2aa877){logger[_0x2a2c('0x1a')](_0x2aa877[_0x2a2c('0x1b')]);if(_0x2aa877[_0x2a2c('0x1c')]){delete _0x2aa877[_0x2a2c('0x1c')];}_0x43e9e5[_0x2a2c('0xd')](_0x117f3e)[_0x2a2c('0x1d')](_0x2aa877);};}exports[_0x2a2c('0x1e')]=function(_0x5181d9,_0x339986){var _0x520b24={};var _0x2574c8={'count':0x0,'rows':[]};var _0x1e09e9=_[_0x2a2c('0x1f')](db['ChatQueue']['rawAttributes'],function(_0x3fceb5){return{'name':_0x3fceb5[_0x2a2c('0x20')],'type':_0x3fceb5[_0x2a2c('0x21')]['key']};});_0x520b24=qs['getOptions'](_0x1e09e9,_0x5181d9);var _0x373892={'where':_0x520b24[_0x2a2c('0x22')]};return db[_0x2a2c('0x23')]['count'](_0x373892)[_0x2a2c('0x16')](function(_0x162596){_0x2574c8[_0x2a2c('0x13')]=_0x162596;_0x520b24[_0x2a2c('0x24')]=qs[_0x2a2c('0x24')](_0x5181d9[_0x2a2c('0x25')]);return db['ChatQueue'][_0x2a2c('0x26')](_0x520b24);})['then'](function(_0x3c793a){_0x2574c8['rows']=_0x3c793a;return _0x2574c8;})[_0x2a2c('0x16')](respondWithFilteredResult(_0x339986,_0x520b24))[_0x2a2c('0x27')](handleError(_0x339986,null));};exports['show']=function(_0x51871f,_0x45e943){var _0x5e47b1={'raw':!![],'where':{'id':_0x51871f['params']['id']}},_0x235aed={};_0x235aed[_0x2a2c('0x28')]=_['keys'](db[_0x2a2c('0x23')][_0x2a2c('0x29')]);_0x235aed['query']=_[_0x2a2c('0x2a')](_0x51871f['query']);_0x235aed[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x235aed[_0x2a2c('0x28')],_0x235aed[_0x2a2c('0x25')]);_0x5e47b1['attributes']=_[_0x2a2c('0x2c')](_0x235aed[_0x2a2c('0x28')],qs['fields'](_0x51871f[_0x2a2c('0x25')]['fields']));_0x5e47b1[_0x2a2c('0x2d')]=_0x5e47b1[_0x2a2c('0x2d')][_0x2a2c('0x2e')]?_0x5e47b1[_0x2a2c('0x2d')]:_0x235aed[_0x2a2c('0x28')];if(_0x51871f[_0x2a2c('0x25')]['includeAll']){_0x5e47b1['include']=[{'all':!![]}];}_0x5e47b1=_[_0x2a2c('0x2f')]({},_0x5e47b1,_0x51871f[_0x2a2c('0x30')]);return db[_0x2a2c('0x23')][_0x2a2c('0x31')](_0x5e47b1)[_0x2a2c('0x16')](handleEntityNotFound(_0x45e943,null))[_0x2a2c('0x16')](respondWithResult(_0x45e943,null))['catch'](handleError(_0x45e943,null));};exports[_0x2a2c('0x32')]=function(_0x54273d,_0x14c9d8){return db[_0x2a2c('0x23')][_0x2a2c('0x32')](_0x54273d['body'],{})[_0x2a2c('0x16')](function(_0x2534d9){var _0x431fe6=_0x54273d['user'][_0x2a2c('0x18')]({'plain':!![]});if(!_0x431fe6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x431fe6['role']===_0x2a2c('0x33')){var _0x23c3a4=_0x2534d9[_0x2a2c('0x18')]({'plain':!![]});var _0x33f96e='ChatQueues';return db[_0x2a2c('0x34')][_0x2a2c('0x31')]({'where':{'name':_0x33f96e,'userProfileId':_0x431fe6['userProfileId']},'raw':!![]})['then'](function(_0x2529f0){if(_0x2529f0&&_0x2529f0['autoAssociation']===0x0){return db[_0x2a2c('0x35')][_0x2a2c('0x32')]({'name':_0x23c3a4[_0x2a2c('0x1c')],'resourceId':_0x23c3a4['id'],'type':_0x2529f0[_0x2a2c('0x1c')],'sectionId':_0x2529f0['id']},{})['then'](function(){return _0x2534d9;});}else{return _0x2534d9;}})[_0x2a2c('0x27')](function(_0x54e9ed){logger[_0x2a2c('0x1a')](_0x2a2c('0x36'),_0x54e9ed);throw _0x54e9ed;});}return _0x2534d9;})[_0x2a2c('0x16')](respondWithResult(_0x14c9d8,0xc9))[_0x2a2c('0x27')](handleError(_0x14c9d8,null));};exports['update']=function(_0x3229e8,_0x1ee563){if(_0x3229e8[_0x2a2c('0x37')]['id']){delete _0x3229e8[_0x2a2c('0x37')]['id'];}return db['ChatQueue'][_0x2a2c('0x31')]({'where':{'id':_0x3229e8['params']['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x1ee563,null))[_0x2a2c('0x16')](saveUpdates(_0x3229e8['body'],null))[_0x2a2c('0x16')](respondWithResult(_0x1ee563,null))[_0x2a2c('0x27')](handleError(_0x1ee563,null));};exports['destroy']=function(_0x3cd050,_0x391fcb){return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x3cd050[_0x2a2c('0x38')]['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x391fcb,null))[_0x2a2c('0x16')](removeEntity(_0x391fcb,null))[_0x2a2c('0x27')](handleError(_0x391fcb,null));};exports[_0x2a2c('0x39')]=function(_0x3512be,_0x5405aa){return db[_0x2a2c('0x23')][_0x2a2c('0x39')]()['then'](respondWithResult(_0x5405aa,null))['catch'](handleError(_0x5405aa,null));};exports[_0x2a2c('0x3a')]=function(_0x2fd083,_0x36e534){var _0x34d52b={'raw':!![],'where':{}},_0x4e4bd9={},_0x84d351;return db[_0x2a2c('0x23')][_0x2a2c('0x3b')]({'where':{'id':_0x2fd083['params']['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x36e534,null))[_0x2a2c('0x16')](function(_0xaa32bf){if(_0xaa32bf){_0x84d351=_0xaa32bf['get']({'plain':!![]});_0x4e4bd9[_0x2a2c('0x28')]=_[_0x2a2c('0x2a')](db['UserChatQueue'][_0x2a2c('0x29')]);_0x4e4bd9[_0x2a2c('0x25')]=_[_0x2a2c('0x2a')](_0x2fd083[_0x2a2c('0x25')]);_0x4e4bd9[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x4e4bd9[_0x2a2c('0x28')],_0x4e4bd9[_0x2a2c('0x25')]);_0x34d52b[_0x2a2c('0x2d')]=_['intersection'](_0x4e4bd9[_0x2a2c('0x28')],qs[_0x2a2c('0x3c')](_0x2fd083[_0x2a2c('0x25')][_0x2a2c('0x3c')]));_0x34d52b['attributes']=_0x34d52b[_0x2a2c('0x2d')][_0x2a2c('0x2e')]?_0x34d52b[_0x2a2c('0x2d')]:_0x4e4bd9[_0x2a2c('0x28')];if(!_0x2fd083[_0x2a2c('0x25')][_0x2a2c('0x3d')](_0x2a2c('0x3e'))){_0x34d52b[_0x2a2c('0x12')]=qs[_0x2a2c('0x12')](_0x2fd083[_0x2a2c('0x25')]['limit']);_0x34d52b[_0x2a2c('0x10')]=qs[_0x2a2c('0x10')](_0x2fd083[_0x2a2c('0x25')]['offset']);}_0x34d52b[_0x2a2c('0x3f')]=qs[_0x2a2c('0x40')](_0x2fd083[_0x2a2c('0x25')][_0x2a2c('0x40')]);_0x34d52b[_0x2a2c('0x22')]=qs[_0x2a2c('0x2b')](_[_0x2a2c('0x41')](_0x2fd083['query'],_0x4e4bd9[_0x2a2c('0x2b')]));_0x34d52b[_0x2a2c('0x22')][_0x2a2c('0x42')]=_0xaa32bf['id'];if(_0x2fd083['query'][_0x2a2c('0x43')]){_0x34d52b[_0x2a2c('0x22')]=_[_0x2a2c('0x2f')](_0x34d52b[_0x2a2c('0x22')],{'$or':_[_0x2a2c('0x1f')](_0x34d52b[_0x2a2c('0x2d')],function(_0x53ffee){var _0x1f9afc={};_0x1f9afc[_0x53ffee]={'$like':'%'+_0x2fd083[_0x2a2c('0x25')]['filter']+'%'};return _0x1f9afc;})});}_0x34d52b=_[_0x2a2c('0x2f')]({},_0x34d52b,_0x2fd083[_0x2a2c('0x30')]);return db[_0x2a2c('0x44')][_0x2a2c('0x26')](_0x34d52b);}})[_0x2a2c('0x16')](function(_0x3c1b1c){if(_0x3c1b1c){return db[_0x2a2c('0x45')][_0x2a2c('0x46')]({'where':{'id':_['map'](_0x3c1b1c,_0x2a2c('0x47')),'role':_0x2a2c('0x48')},'attributes':['id',_0x2a2c('0x1c'),'chatPause','updatedAt',_0x2a2c('0x49')]});}})[_0x2a2c('0x16')](function(_0x15d5ae){if(_0x15d5ae){return{'count':_0x15d5ae[_0x2a2c('0x13')],'rows':_[_0x2a2c('0x1f')](_0x15d5ae['rows'],function(_0x5de732){return{'membername':_0x5de732[_0x2a2c('0x1c')],'UserId':_0x5de732['id'],'queue_name':_0x84d351[_0x2a2c('0x1c')],'ChatQueueId':_0x84d351['id'],'interface':util[_0x2a2c('0x4a')](_0x2a2c('0x4b'),_0x2a2c('0x4c'),_0x5de732[_0x2a2c('0x1c')]),'penalty':0x0,'paused':_0x5de732[_0x2a2c('0x4d')],'createdAt':_0x5de732['createdAt'],'updatedAt':_0x5de732[_0x2a2c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36e534,_0x34d52b))[_0x2a2c('0x27')](handleError(_0x36e534,null));};exports[_0x2a2c('0x4f')]=function(_0x248a54,_0x53e483){var _0x406108={};var _0x403878={};var _0x118df9;var _0x1cdaf9;return db[_0x2a2c('0x23')][_0x2a2c('0x3b')]({'where':{'id':_0x248a54[_0x2a2c('0x38')]['id']}})['then'](handleEntityNotFound(_0x53e483,null))[_0x2a2c('0x16')](function(_0x38675c){if(_0x38675c){_0x118df9=_0x38675c;_0x403878[_0x2a2c('0x28')]=_['keys'](db[_0x2a2c('0x50')][_0x2a2c('0x29')]);_0x403878[_0x2a2c('0x25')]=_[_0x2a2c('0x2a')](_0x248a54[_0x2a2c('0x25')]);_0x403878[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x403878['model'],_0x403878['query']);_0x406108['attributes']=_[_0x2a2c('0x2c')](_0x403878['model'],qs[_0x2a2c('0x3c')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x3c')]));_0x406108[_0x2a2c('0x2d')]=_0x406108[_0x2a2c('0x2d')]['length']?_0x406108[_0x2a2c('0x2d')]:_0x403878[_0x2a2c('0x28')];_0x406108[_0x2a2c('0x3f')]=qs[_0x2a2c('0x40')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x40')]);_0x406108[_0x2a2c('0x22')]=qs['filters'](_[_0x2a2c('0x41')](_0x248a54['query'],_0x403878[_0x2a2c('0x2b')]));if(_0x248a54['query'][_0x2a2c('0x43')]){_0x406108[_0x2a2c('0x22')]=_[_0x2a2c('0x2f')](_0x406108[_0x2a2c('0x22')],{'$or':_[_0x2a2c('0x1f')](_0x406108[_0x2a2c('0x2d')],function(_0x417d00){var _0xedd2eb={};_0xedd2eb[_0x417d00]={'$like':'%'+_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x43')]+'%'};return _0xedd2eb;})});}_0x406108=_[_0x2a2c('0x2f')]({},_0x406108,_0x248a54[_0x2a2c('0x30')]);return _0x118df9[_0x2a2c('0x4f')](_0x406108);}})[_0x2a2c('0x16')](function(_0x69a71b){if(_0x69a71b){_0x1cdaf9=_0x69a71b['length'];if(!_0x248a54[_0x2a2c('0x25')]['hasOwnProperty'](_0x2a2c('0x3e'))){_0x406108[_0x2a2c('0x12')]=qs[_0x2a2c('0x12')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x12')]);_0x406108[_0x2a2c('0x10')]=qs[_0x2a2c('0x10')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x10')]);}return _0x118df9[_0x2a2c('0x4f')](_0x406108);}})[_0x2a2c('0x16')](function(_0x2d8f67){if(_0x2d8f67){return _0x2d8f67?{'count':_0x1cdaf9,'rows':_0x2d8f67}:null;}})[_0x2a2c('0x16')](respondWithResult(_0x53e483,null))[_0x2a2c('0x27')](handleError(_0x53e483,null));};exports[_0x2a2c('0x51')]=function(_0x51bc88,_0x349caf){var _0x422cf0=_0x51bc88[_0x2a2c('0x37')][_0x2a2c('0x52')];return db['Team'][_0x2a2c('0x26')]({'where':{'id':_0x422cf0},'attributes':['id'],'include':[{'model':db[_0x2a2c('0x45')],'as':_0x2a2c('0x53'),'attributes':['id','name',_0x2a2c('0x54'),_0x2a2c('0x55'),_0x2a2c('0x56')],'raw':!![]}]})['then'](function(_0xd76206){if(_0xd76206){var _0x58511f=_[_0x2a2c('0x57')](_0xd76206,function(_0x4dda22){var _0xf26432=_0x4dda22['get']({'plain':!![]});return _0xf26432['Agents'];});return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x51bc88['params']['id']}})[_0x2a2c('0x16')](function(_0x405745){return db[_0x2a2c('0x58')][_0x2a2c('0x59')](function(_0x3a81fd){return _0x405745[_0x2a2c('0x51')](_0x422cf0,{'transaction':_0x3a81fd})[_0x2a2c('0x16')](function(){return BPromise[_0x2a2c('0x5a')](_0x58511f,function(_0xafcbac){return db[_0x2a2c('0x44')][_0x2a2c('0x5b')]({'where':{'UserId':_0xafcbac['id'],'ChatQueueId':_0x51bc88[_0x2a2c('0x38')]['id']},'transaction':_0x3a81fd});});})[_0x2a2c('0x16')](function(){_0x58511f['forEach'](function(_0x13c657){socket['emit'](_0x2a2c('0x5c'),{'UserId':_0x13c657['id'],'ChatQueueId':_0x405745['id']});});});});});}})[_0x2a2c('0x16')](respondWithStatusCode(_0x349caf,null))[_0x2a2c('0x27')](handleError(_0x349caf,null));};exports[_0x2a2c('0x5d')]=function(_0x224594,_0x31c368){return db['Team']['findAll']({'where':{'id':_0x224594['query'][_0x2a2c('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a2c('0x53'),'attributes':['id'],'raw':!![]}]})[_0x2a2c('0x16')](handleEntityNotFound(_0x31c368,null))[_0x2a2c('0x16')](function(_0x5e961f){var _0x55e1b=_[_0x2a2c('0x1f')](_0x5e961f,'id');var _0x27e858=[];var _0x481f63=[];var _0x21fab6=squel['select']();_0x21fab6[_0x2a2c('0x5e')](_0x2a2c('0x5f'))[_0x2a2c('0x60')]('team_has_chat_queues','tq')[_0x2a2c('0x61')]('user_has_teams','ut',_0x2a2c('0x62'))[_0x2a2c('0x22')](_0x2a2c('0x63'),_0x224594[_0x2a2c('0x38')]['id']);for(var _0x282efe=0x0;_0x282efe<_0x5e961f[_0x2a2c('0x2e')];_0x282efe+=0x1){let _0x2790b1=_0x5e961f[_0x282efe];for(var _0x34d8ff=0x0;_0x34d8ff<_0x2790b1[_0x2a2c('0x53')][_0x2a2c('0x2e')];_0x34d8ff+=0x1){let _0x4211e5=_0x2790b1[_0x2a2c('0x53')][_0x34d8ff];var _0x3b96e2=_0x21fab6[_0x2a2c('0x64')]();_0x3b96e2[_0x2a2c('0x22')]('ut.UserId\x20=\x20?',_0x4211e5['id']);_0x481f63['push'](db['sequelize']['query'](_0x3b96e2['toString'](),{'type':db[_0x2a2c('0x58')][_0x2a2c('0x65')][_0x2a2c('0x66')]})[_0x2a2c('0x16')](function(_0x5622b0){if(_0x5622b0[_0x2a2c('0x2e')]===0x1){return _0x4211e5['id'];}else{var _0x1c5c44=_[_0x2a2c('0x67')](_[_0x2a2c('0x1f')](_0x5622b0,_0x2a2c('0x68')),function(_0x36a46f){return _['includes'](_0x55e1b,_0x36a46f);});if(_0x1c5c44){return _0x4211e5['id'];}}}));}}return BPromise[_0x2a2c('0x69')](_0x481f63)[_0x2a2c('0x16')](function(_0x2896ee){_0x27e858=_(_0x27e858)['union'](_0x2896ee)[_0x2a2c('0x6a')]()['value']();return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x224594[_0x2a2c('0x38')]['id']}})['then'](function(_0x16797d){return db[_0x2a2c('0x58')]['transaction'](function(_0x3ee0b4){return _0x16797d['removeTeams'](_0x224594['query']['ids'],{'transaction':_0x3ee0b4})['then'](function(){if(!_['isEmpty'](_0x27e858)){return _0x16797d['removeAgents'](_0x27e858,{'transaction':_0x3ee0b4});}})['then'](function(){_0x27e858[_0x2a2c('0x6b')](function(_0x111424){socket[_0x2a2c('0x6c')]('userChatQueue:remove',{'UserId':_0x111424,'ChatQueueId':_0x16797d['id']});});});});});});})[_0x2a2c('0x16')](respondWithStatusCode(_0x31c368,null))[_0x2a2c('0x27')](handleError(_0x31c368,null));};exports[_0x2a2c('0x6d')]=function(_0x4f7269,_0x23de46){return db[_0x2a2c('0x23')]['find']({'where':{'id':_0x4f7269['params']['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x23de46,null))[_0x2a2c('0x16')](function(_0x522843){if(_0x522843){return _0x522843['addAgents'](_0x4f7269[_0x2a2c('0x37')][_0x2a2c('0x52')],_[_0x2a2c('0x6e')](_0x4f7269[_0x2a2c('0x37')],[_0x2a2c('0x52'),'id'])||{})[_0x2a2c('0x6f')](function(_0x173ec1){for(var _0x149e57=0x0;_0x149e57<_0x4f7269[_0x2a2c('0x37')][_0x2a2c('0x52')][_0x2a2c('0x2e')];_0x149e57+=0x1){socket[_0x2a2c('0x6c')]('userChatQueue:save',{'UserId':Number(_0x4f7269[_0x2a2c('0x37')]['ids'][_0x149e57]),'ChatQueueId':Number(_0x4f7269[_0x2a2c('0x38')]['id'])});}return _0x173ec1;});}})['then'](respondWithResult(_0x23de46,null))[_0x2a2c('0x27')](handleError(_0x23de46,null));};exports[_0x2a2c('0x70')]=function(_0x362945,_0x105a42){return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x362945[_0x2a2c('0x38')]['id']}})['then'](handleEntityNotFound(_0x105a42,null))[_0x2a2c('0x16')](function(_0x1fa4c4){if(_0x1fa4c4){return _0x1fa4c4[_0x2a2c('0x70')](_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')])[_0x2a2c('0x16')](function(){if(_[_0x2a2c('0x71')](_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')])){for(var _0x4c3f9a=0x0;_0x4c3f9a<_0x362945['query']['ids'][_0x2a2c('0x2e')];_0x4c3f9a+=0x1){socket[_0x2a2c('0x6c')](_0x2a2c('0x72'),{'UserId':Number(_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')][_0x4c3f9a]),'ChatQueueId':Number(_0x362945[_0x2a2c('0x38')]['id'])});}}else{socket[_0x2a2c('0x6c')](_0x2a2c('0x72'),{'UserId':Number(_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')]),'ChatQueueId':Number(_0x362945['params']['id'])});}});}})[_0x2a2c('0x16')](respondWithStatusCode(_0x105a42,null))['catch'](handleError(_0x105a42,null));};exports[_0x2a2c('0x73')]=function(_0x55237a,_0x56ed26){var _0x1476fd={};var _0x32cc41={};var _0x1cb1fa;var _0x2f7605;return db[_0x2a2c('0x23')][_0x2a2c('0x3b')]({'where':{'id':_0x55237a['params']['id']}})['then'](handleEntityNotFound(_0x56ed26,null))[_0x2a2c('0x16')](function(_0x452047){if(_0x452047){_0x1cb1fa=_0x452047;_0x32cc41[_0x2a2c('0x28')]=_['keys'](db[_0x2a2c('0x45')][_0x2a2c('0x29')]);_0x32cc41[_0x2a2c('0x25')]=_['keys'](_0x55237a[_0x2a2c('0x25')]);_0x32cc41[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x32cc41[_0x2a2c('0x28')],_0x32cc41[_0x2a2c('0x25')]);_0x1476fd[_0x2a2c('0x2d')]=_[_0x2a2c('0x2c')](_0x32cc41[_0x2a2c('0x28')],qs['fields'](_0x55237a[_0x2a2c('0x25')][_0x2a2c('0x3c')]));_0x1476fd['attributes']=_0x1476fd[_0x2a2c('0x2d')][_0x2a2c('0x2e')]?_0x1476fd[_0x2a2c('0x2d')]:_0x32cc41[_0x2a2c('0x28')];_0x1476fd['order']=qs[_0x2a2c('0x40')](_0x55237a[_0x2a2c('0x25')]['sort']);_0x1476fd[_0x2a2c('0x22')]=qs[_0x2a2c('0x2b')](_[_0x2a2c('0x41')](_0x55237a[_0x2a2c('0x25')],_0x32cc41['filters']));if(_0x55237a[_0x2a2c('0x25')]['filter']){_0x1476fd[_0x2a2c('0x22')]=_[_0x2a2c('0x2f')](_0x1476fd[_0x2a2c('0x22')],{'$or':_[_0x2a2c('0x1f')](_0x1476fd[_0x2a2c('0x2d')],function(_0x2a4a67){var _0x20c19e={};_0x20c19e[_0x2a4a67]={'$like':'%'+_0x55237a['query'][_0x2a2c('0x43')]+'%'};return _0x20c19e;})});}_0x1476fd=_['merge']({},_0x1476fd,_0x55237a[_0x2a2c('0x30')]);return _0x1cb1fa[_0x2a2c('0x73')](_0x1476fd);}})[_0x2a2c('0x16')](function(_0x4d633a){if(_0x4d633a){_0x2f7605=_0x4d633a[_0x2a2c('0x2e')];if(!_0x55237a[_0x2a2c('0x25')][_0x2a2c('0x3d')](_0x2a2c('0x3e'))){_0x1476fd[_0x2a2c('0x12')]=qs[_0x2a2c('0x12')](_0x55237a[_0x2a2c('0x25')][_0x2a2c('0x12')]);_0x1476fd[_0x2a2c('0x10')]=qs[_0x2a2c('0x10')](_0x55237a[_0x2a2c('0x25')]['offset']);}return _0x1cb1fa['getAgents'](_0x1476fd);}})[_0x2a2c('0x16')](function(_0x142dc9){if(_0x142dc9){return _0x142dc9?{'count':_0x2f7605,'rows':_0x142dc9}:null;}})[_0x2a2c('0x16')](respondWithResult(_0x56ed26,null))[_0x2a2c('0x27')](handleError(_0x56ed26,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c166973..5245041 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 _0x59ce=['../../mysqldb','ChatQueue','save','update','remove','emit','events'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0x59ce,0x92));var _0xe59c=function(_0x321e7e,_0x2a10a0){_0x321e7e=_0x321e7e-0x0;var _0x162ed5=_0x59ce[_0x321e7e];return _0x162ed5;};'use strict';var EventEmitter=require(_0xe59c('0x0'));var ChatQueue=require(_0xe59c('0x1'))['db'][_0xe59c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe59c('0x3'),'afterUpdate':_0xe59c('0x4'),'afterDestroy':_0xe59c('0x5')};function emitEvent(_0x4178c1){return function(_0x2ea56e,_0x42a856,_0x20fc88){ChatQueueEvents['emit'](_0x4178c1+':'+_0x2ea56e['id'],_0x2ea56e);ChatQueueEvents[_0xe59c('0x6')](_0x4178c1,_0x2ea56e);_0x20fc88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x3c17=['exports','events','ChatQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3c17,0xe1));var _0x73c1=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3c17[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x73c1('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x73c1('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x73c1('0x2')](0x0);var events={'afterCreate':_0x73c1('0x3'),'afterUpdate':'update','afterDestroy':_0x73c1('0x4')};function emitEvent(_0x534a6d){return function(_0x4802c2,_0x283ff3,_0x3d477b){ChatQueueEvents[_0x73c1('0x5')](_0x534a6d+':'+_0x4802c2['id'],_0x4802c2);ChatQueueEvents['emit'](_0x534a6d,_0x4802c2);_0x3d477b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x73c1('0x6')](e,emitEvent(event));}}module[_0x73c1('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 8d8ebba..7938f6e 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 _0xa333=['../../config/environment','./chatQueue.attributes','exports','define','chat_queues','util','api','moment','bluebird','path','rimraf'];(function(_0x851947,_0x50e0a8){var _0x1e9c84=function(_0x4aa661){while(--_0x4aa661){_0x851947['push'](_0x851947['shift']());}};_0x1e9c84(++_0x50e0a8);}(_0xa333,0x1e9));var _0x3a33=function(_0x2e534a,_0x4c3956){_0x2e534a=_0x2e534a-0x0;var _0x4541e7=_0xa333[_0x2e534a];return _0x4541e7;};'use strict';var _=require('lodash');var util=require(_0x3a33('0x0'));var logger=require('../../config/logger')(_0x3a33('0x1'));var moment=require(_0x3a33('0x2'));var BPromise=require(_0x3a33('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a33('0x4'));var rimraf=require(_0x3a33('0x5'));var config=require(_0x3a33('0x6'));var attributes=require(_0x3a33('0x7'));module[_0x3a33('0x8')]=function(_0x43a983,_0x253b25){return _0x43a983[_0x3a33('0x9')]('ChatQueue',attributes,{'tableName':_0x3a33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f6c=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x37c767,_0x4f2a84){var _0x3f711f=function(_0x566246){while(--_0x566246){_0x37c767['push'](_0x37c767['shift']());}};_0x3f711f(++_0x4f2a84);}(_0x9f6c,0x74));var _0xc9f6=function(_0x26299e,_0x394ad1){_0x26299e=_0x26299e-0x0;var _0x6c4f4a=_0x9f6c[_0x26299e];return _0x6c4f4a;};'use strict';var _=require(_0xc9f6('0x0'));var util=require(_0xc9f6('0x1'));var logger=require(_0xc9f6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc9f6('0x3'));var rp=require(_0xc9f6('0x4'));var fs=require('fs');var path=require(_0xc9f6('0x5'));var rimraf=require(_0xc9f6('0x6'));var config=require(_0xc9f6('0x7'));var attributes=require(_0xc9f6('0x8'));module[_0xc9f6('0x9')]=function(_0x5828bc,_0x7b3049){return _0x5828bc['define'](_0xc9f6('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index d8d0615..e77570f 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 _0x2fe5=['options','raw','where','attributes','include','map','model','debug','ShowChatQueue','ChatQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2fe5,0x14b));var _0x52fe=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2fe5[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52fe('0x2'));var fs=require('fs');var Redis=require(_0x52fe('0x3'));var db=require(_0x52fe('0x4'))['db'];var utils=require(_0x52fe('0x5'));var logger=require(_0x52fe('0x6'))('rpc');var config=require(_0x52fe('0x7'));var jayson=require(_0x52fe('0x8'));var client=jayson['client'][_0x52fe('0x9')]({'port':0x232a});config[_0x52fe('0xa')]=_[_0x52fe('0xb')](config[_0x52fe('0xa')],{'host':_0x52fe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52fe('0xa')]));require(_0x52fe('0xd'))[_0x52fe('0xe')](socket);function respondWithRpcPromise(_0x50d9d6,_0x47e0ea,_0x79a9a7){return new BPromise(function(_0x443b2c,_0x498848){return client[_0x52fe('0xf')](_0x50d9d6,_0x79a9a7)[_0x52fe('0x10')](function(_0x3b9cb2){logger[_0x52fe('0x11')]('ChatQueue,\x20%s,\x20%s',_0x47e0ea,_0x52fe('0x12'));logger['debug'](_0x52fe('0x13'),_0x47e0ea,'request\x20sent',JSON[_0x52fe('0x14')](_0x3b9cb2));if(_0x3b9cb2[_0x52fe('0x15')]){if(_0x3b9cb2[_0x52fe('0x15')][_0x52fe('0x16')]===0x1f4){logger['error'](_0x52fe('0x17'),_0x47e0ea,_0x3b9cb2[_0x52fe('0x15')][_0x52fe('0x18')]);return _0x498848(_0x3b9cb2[_0x52fe('0x15')][_0x52fe('0x18')]);}logger[_0x52fe('0x15')](_0x52fe('0x17'),_0x47e0ea,_0x3b9cb2[_0x52fe('0x15')][_0x52fe('0x18')]);return _0x443b2c(_0x3b9cb2[_0x52fe('0x15')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x47e0ea,_0x52fe('0x12'));_0x443b2c(_0x3b9cb2[_0x52fe('0x19')][_0x52fe('0x18')]);}})[_0x52fe('0x1a')](function(_0x407c3f){logger[_0x52fe('0x15')](_0x52fe('0x17'),_0x47e0ea,_0x407c3f);_0x498848(_0x407c3f);});});}exports[_0x52fe('0x1b')]=function(_0x5a47e1){var _0x3d285c=this;return new Promise(function(_0x4585ad,_0x4e34ec){return db['ChatQueue'][_0x52fe('0x1c')]({'raw':_0x5a47e1[_0x52fe('0x1d')]?_0x5a47e1['options'][_0x52fe('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a47e1[_0x52fe('0x1d')]?_0x5a47e1[_0x52fe('0x1d')][_0x52fe('0x1f')]||null:null,'attributes':_0x5a47e1['options']?_0x5a47e1['options'][_0x52fe('0x20')]||null:null,'limit':_0x5a47e1[_0x52fe('0x1d')]?_0x5a47e1[_0x52fe('0x1d')]['limit']||null:null,'include':_0x5a47e1[_0x52fe('0x1d')]?_0x5a47e1[_0x52fe('0x1d')][_0x52fe('0x21')]?_[_0x52fe('0x22')](_0x5a47e1[_0x52fe('0x1d')][_0x52fe('0x21')],function(_0x591a21){return{'model':db[_0x591a21[_0x52fe('0x23')]],'as':_0x591a21['as'],'attributes':_0x591a21['attributes'],'include':_0x591a21['include']?_[_0x52fe('0x22')](_0x591a21[_0x52fe('0x21')],function(_0xd9e423){return{'model':db[_0xd9e423[_0x52fe('0x23')]],'as':_0xd9e423['as'],'attributes':_0xd9e423['attributes'],'include':_0xd9e423[_0x52fe('0x21')]?_[_0x52fe('0x22')](_0xd9e423['include'],function(_0x2d4bef){return{'model':db[_0x2d4bef[_0x52fe('0x23')]],'as':_0x2d4bef['as'],'attributes':_0x2d4bef[_0x52fe('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc2c937){logger[_0x52fe('0x11')](_0x52fe('0x1b'),_0x5a47e1);logger[_0x52fe('0x24')]('GetChatQueue',_0x5a47e1,JSON[_0x52fe('0x14')](_0xc2c937));_0x4585ad(_0xc2c937);})[_0x52fe('0x1a')](function(_0x326118){logger[_0x52fe('0x15')](_0x52fe('0x1b'),_0x326118[_0x52fe('0x18')],_0x5a47e1);_0x4e34ec(_0x3d285c[_0x52fe('0x15')](0x1f4,_0x326118[_0x52fe('0x18')]));});});};exports[_0x52fe('0x25')]=function(_0x4022a5){var _0x1c1ce8=this;return new Promise(function(_0x2a4e36,_0x3b0eb5){return db[_0x52fe('0x26')][_0x52fe('0x27')]({'raw':_0x4022a5[_0x52fe('0x1d')]?_0x4022a5['options']['raw']===undefined?!![]:![]:!![],'where':_0x4022a5[_0x52fe('0x1d')]?_0x4022a5['options'][_0x52fe('0x1f')]||null:null,'attributes':_0x4022a5[_0x52fe('0x1d')]?_0x4022a5[_0x52fe('0x1d')][_0x52fe('0x20')]||null:null,'include':_0x4022a5[_0x52fe('0x1d')]?_0x4022a5[_0x52fe('0x1d')][_0x52fe('0x21')]?_['map'](_0x4022a5[_0x52fe('0x1d')]['include'],function(_0x4470ed){return{'model':db[_0x4470ed[_0x52fe('0x23')]],'as':_0x4470ed['as'],'attributes':_0x4470ed['attributes'],'include':_0x4470ed[_0x52fe('0x21')]?_['map'](_0x4470ed[_0x52fe('0x21')],function(_0x4944d8){return{'model':db[_0x4944d8[_0x52fe('0x23')]],'as':_0x4944d8['as'],'attributes':_0x4944d8[_0x52fe('0x20')],'include':_0x4944d8[_0x52fe('0x21')]?_[_0x52fe('0x22')](_0x4944d8[_0x52fe('0x21')],function(_0x4a0c77){return{'model':db[_0x4a0c77['model']],'as':_0x4a0c77['as'],'attributes':_0x4a0c77[_0x52fe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52fe('0x10')](function(_0x215913){logger[_0x52fe('0x11')]('ShowChatQueue',_0x4022a5);logger['debug'](_0x52fe('0x25'),_0x4022a5,JSON[_0x52fe('0x14')](_0x215913));_0x2a4e36(_0x215913);})[_0x52fe('0x1a')](function(_0x2ac418){logger[_0x52fe('0x15')](_0x52fe('0x25'),_0x2ac418[_0x52fe('0x18')],_0x4022a5);_0x3b0eb5(_0x1c1ce8['error'](0x1f4,_0x2ac418[_0x52fe('0x18')]));});});}; \ No newline at end of file +var _0x3eae=['http','redis','defaults','localhost','./chatQueue.socket','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x100257,_0x4ab625){var _0x39abbc=function(_0x30c635){while(--_0x30c635){_0x100257['push'](_0x100257['shift']());}};_0x39abbc(++_0x4ab625);}(_0x3eae,0x126));var _0xe3ea=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x3eae[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var moment=require(_0xe3ea('0x2'));var BPromise=require(_0xe3ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3ea('0x4'));var db=require(_0xe3ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ea('0x6'))(_0xe3ea('0x7'));var config=require(_0xe3ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3ea('0x9')][_0xe3ea('0xa')]({'port':0x232a});config[_0xe3ea('0xb')]=_[_0xe3ea('0xc')](config[_0xe3ea('0xb')],{'host':_0xe3ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3ea('0xb')]));require(_0xe3ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x32a059,_0x23ca3e,_0x23134e){return new BPromise(function(_0x2afd60,_0x1db54c){return client['request'](_0x32a059,_0x23134e)[_0xe3ea('0xf')](function(_0x3236c0){logger[_0xe3ea('0x10')]('ChatQueue,\x20%s,\x20%s',_0x23ca3e,_0xe3ea('0x11'));logger[_0xe3ea('0x12')](_0xe3ea('0x13'),_0x23ca3e,_0xe3ea('0x11'),JSON[_0xe3ea('0x14')](_0x3236c0));if(_0x3236c0[_0xe3ea('0x15')]){if(_0x3236c0['error']['code']===0x1f4){logger[_0xe3ea('0x15')](_0xe3ea('0x16'),_0x23ca3e,_0x3236c0[_0xe3ea('0x15')][_0xe3ea('0x17')]);return _0x1db54c(_0x3236c0[_0xe3ea('0x15')]['message']);}logger['error'](_0xe3ea('0x16'),_0x23ca3e,_0x3236c0[_0xe3ea('0x15')]['message']);return _0x2afd60(_0x3236c0[_0xe3ea('0x15')][_0xe3ea('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x23ca3e,_0xe3ea('0x11'));_0x2afd60(_0x3236c0[_0xe3ea('0x18')][_0xe3ea('0x17')]);}})[_0xe3ea('0x19')](function(_0x12de73){logger[_0xe3ea('0x15')]('ChatQueue,\x20%s,\x20%s',_0x23ca3e,_0x12de73);_0x1db54c(_0x12de73);});});}exports['GetChatQueue']=function(_0x165f53){var _0x5d0ca4=this;return new Promise(function(_0x52df79,_0xcbb4db){return db[_0xe3ea('0x1a')][_0xe3ea('0x1b')]({'raw':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x1d')]===undefined?!![]:![]:!![],'where':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x1e')]||null:null,'attributes':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x1f')]||null:null,'limit':_0x165f53[_0xe3ea('0x1c')]?_0x165f53['options'][_0xe3ea('0x20')]||null:null,'include':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x21')],function(_0x5305e1){return{'model':db[_0x5305e1[_0xe3ea('0x23')]],'as':_0x5305e1['as'],'attributes':_0x5305e1[_0xe3ea('0x1f')],'include':_0x5305e1['include']?_[_0xe3ea('0x22')](_0x5305e1[_0xe3ea('0x21')],function(_0x218dcb){return{'model':db[_0x218dcb[_0xe3ea('0x23')]],'as':_0x218dcb['as'],'attributes':_0x218dcb['attributes'],'include':_0x218dcb['include']?_[_0xe3ea('0x22')](_0x218dcb['include'],function(_0x3032b1){return{'model':db[_0x3032b1[_0xe3ea('0x23')]],'as':_0x3032b1['as'],'attributes':_0x3032b1[_0xe3ea('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x115a78){logger['info'](_0xe3ea('0x24'),_0x165f53);logger[_0xe3ea('0x12')](_0xe3ea('0x24'),_0x165f53,JSON[_0xe3ea('0x14')](_0x115a78));_0x52df79(_0x115a78);})[_0xe3ea('0x19')](function(_0x56be4a){logger[_0xe3ea('0x15')](_0xe3ea('0x24'),_0x56be4a[_0xe3ea('0x17')],_0x165f53);_0xcbb4db(_0x5d0ca4[_0xe3ea('0x15')](0x1f4,_0x56be4a['message']));});});};exports['ShowChatQueue']=function(_0x2ab595){var _0x42be18=this;return new Promise(function(_0x723a3a,_0xcbfea2){return db[_0xe3ea('0x1a')]['find']({'raw':_0x2ab595[_0xe3ea('0x1c')]?_0x2ab595['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ab595[_0xe3ea('0x1c')]?_0x2ab595[_0xe3ea('0x1c')]['where']||null:null,'attributes':_0x2ab595['options']?_0x2ab595[_0xe3ea('0x1c')][_0xe3ea('0x1f')]||null:null,'include':_0x2ab595[_0xe3ea('0x1c')]?_0x2ab595[_0xe3ea('0x1c')][_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0x2ab595['options'][_0xe3ea('0x21')],function(_0x419b5f){return{'model':db[_0x419b5f[_0xe3ea('0x23')]],'as':_0x419b5f['as'],'attributes':_0x419b5f[_0xe3ea('0x1f')],'include':_0x419b5f[_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0x419b5f[_0xe3ea('0x21')],function(_0xbfc054){return{'model':db[_0xbfc054[_0xe3ea('0x23')]],'as':_0xbfc054['as'],'attributes':_0xbfc054[_0xe3ea('0x1f')],'include':_0xbfc054[_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0xbfc054[_0xe3ea('0x21')],function(_0x3f6f3a){return{'model':db[_0x3f6f3a['model']],'as':_0x3f6f3a['as'],'attributes':_0x3f6f3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3ea('0xf')](function(_0x28d670){logger[_0xe3ea('0x10')]('ShowChatQueue',_0x2ab595);logger[_0xe3ea('0x12')](_0xe3ea('0x25'),_0x2ab595,JSON[_0xe3ea('0x14')](_0x28d670));_0x723a3a(_0x28d670);})[_0xe3ea('0x19')](function(_0x369818){logger['error'](_0xe3ea('0x25'),_0x369818['message'],_0x2ab595);_0xcbfea2(_0x42be18['error'](0x1f4,_0x369818[_0xe3ea('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c282df7..6ce3932 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 _0xaba6=['emit','removeListener','./chatQueue.events','save'];(function(_0x1db200,_0x5e0b81){var _0x61628c=function(_0x4405d2){while(--_0x4405d2){_0x1db200['push'](_0x1db200['shift']());}};_0x61628c(++_0x5e0b81);}(_0xaba6,0xe2));var _0x6aba=function(_0x2b60bd,_0x49418d){_0x2b60bd=_0x2b60bd-0x0;var _0x3d9523=_0xaba6[_0x2b60bd];return _0x3d9523;};'use strict';var ChatQueueEvents=require(_0x6aba('0x0'));var events=[_0x6aba('0x1'),'remove','update'];function createListener(_0x5140ee,_0x596c18){return function(_0x42fd1f){_0x596c18[_0x6aba('0x2')](_0x5140ee,_0x42fd1f);};}function removeListener(_0x58d8a8,_0x1e32a1){return function(){ChatQueueEvents[_0x6aba('0x3')](_0x58d8a8,_0x1e32a1);};}exports['register']=function(_0x4e929a){for(var _0x5ae14c=0x0,_0x39c32a=events['length'];_0x5ae14c<_0x39c32a;_0x5ae14c++){var _0x3766d4=events[_0x5ae14c];var _0x1a4fbc=createListener('chatQueue:'+_0x3766d4,_0x4e929a);ChatQueueEvents['on'](_0x3766d4,_0x1a4fbc);}}; \ No newline at end of file +var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x72b1,0x16e));var _0x172b=function(_0x4fe957,_0x490d45){_0x4fe957=_0x4fe957-0x0;var _0x3419a0=_0x72b1[_0x4fe957];return _0x3419a0;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index dbbea31..910bb41 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x1af2ef,_0x292578){var _0x55fbc2=function(_0x59d10e){while(--_0x59d10e){_0x1af2ef['push'](_0x1af2ef['shift']());}};_0x55fbc2(++_0x292578);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23b83e,_0x372f4b){var _0x19e3bd=function(_0x6b7c5b){while(--_0x6b7c5b){_0x23b83e['push'](_0x23b83e['shift']());}};_0x19e3bd(++_0x372f4b);}(_0x008c,0x188));var _0xc008=function(_0x2b6854,_0xf09496){_0x2b6854=_0x2b6854-0x0;var _0x3a17df=_0x008c[_0x2b6854];return _0x3a17df;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 9401cf0..cc9551f 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 _0x8d14=['exports','STRING','DATE','moment'];(function(_0x3d8a39,_0x47819c){var _0xfacb12=function(_0xea3e9a){while(--_0xea3e9a){_0x3d8a39['push'](_0x3d8a39['shift']());}};_0xfacb12(++_0x47819c);}(_0x8d14,0x1a7));var _0x48d1=function(_0x548135,_0x30a80a){_0x548135=_0x548135-0x0;var _0xb4290c=_0x8d14[_0x548135];return _0xb4290c;};'use strict';var moment=require(_0x48d1('0x0'));var Sequelize=require('sequelize');module[_0x48d1('0x1')]={'uniqueid':{'type':Sequelize[_0x48d1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x48d1('0x2')]},'joinAt':{'type':Sequelize[_0x48d1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x48d1('0x2')]}}; \ No newline at end of file +var _0xd1c5=['sequelize','STRING','DATE','moment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xd1c5,0x18f));var _0x5d1c=function(_0x37ab60,_0x172f30){_0x37ab60=_0x37ab60-0x0;var _0x332e35=_0xd1c5[_0x37ab60];return _0x332e35;};'use strict';var moment=require(_0x5d1c('0x0'));var Sequelize=require(_0x5d1c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5d1c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5d1c('0x2')]},'joinAt':{'type':Sequelize[_0x5d1c('0x3')]},'leaveAt':{'type':Sequelize[_0x5d1c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5d1c('0x3')]},'reason':{'type':Sequelize[_0x5d1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 52559ce..292b8cb 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 _0xf417=['params','intersection','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','util','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','stack','send','map','rawAttributes','fieldName','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show'];(function(_0x5760dc,_0x3828c3){var _0x446ae0=function(_0x122a96){while(--_0x122a96){_0x5760dc['push'](_0x5760dc['shift']());}};_0x446ae0(++_0x3828c3);}(_0xf417,0x8f));var _0x7f41=function(_0x21a5ff,_0x571074){_0x21a5ff=_0x21a5ff-0x0;var _0x1f9af8=_0xf417[_0x21a5ff];return _0x1f9af8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f41('0x0'));var zipdir=require(_0x7f41('0x1'));var jsonpatch=require(_0x7f41('0x2'));var rp=require('request-promise');var moment=require(_0x7f41('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f41('0x4'));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(_0x7f41('0x5'));var _=require('lodash');var squel=require(_0x7f41('0x6'));var crypto=require(_0x7f41('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x7f41('0x8'));var toCsv=require('to-csv');var querystring=require(_0x7f41('0x9'));var Papa=require('papaparse');var Redis=require(_0x7f41('0xa'));var authService=require(_0x7f41('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f41('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x7f41('0xd'));var config=require(_0x7f41('0xe'));var licenseUtil=require(_0x7f41('0xf'));var db=require(_0x7f41('0x10'))['db'];function respondWithStatusCode(_0x637b2d,_0x46dcfe){_0x46dcfe=_0x46dcfe||0xcc;return function(_0xf2f383){if(_0xf2f383){return _0x637b2d['sendStatus'](_0x46dcfe);}return _0x637b2d['status'](_0x46dcfe)[_0x7f41('0x11')]();};}function respondWithResult(_0x4f5b74,_0x568eea){_0x568eea=_0x568eea||0xc8;return function(_0x466907){if(_0x466907){return _0x4f5b74[_0x7f41('0x12')](_0x568eea)[_0x7f41('0x13')](_0x466907);}};}function respondWithFilteredResult(_0x5a517f,_0x212b28){return function(_0x5ef6a7){if(_0x5ef6a7){var _0x27c0f6=typeof _0x212b28[_0x7f41('0x14')]===_0x7f41('0x15')&&typeof _0x212b28['limit']===_0x7f41('0x15');var _0x1ae462=_0x5ef6a7[_0x7f41('0x16')];var _0x5434d2=_0x27c0f6?0x0:_0x212b28[_0x7f41('0x14')];var _0x26580c=_0x27c0f6?_0x5ef6a7['count']:_0x212b28[_0x7f41('0x14')]+_0x212b28[_0x7f41('0x17')];var _0x1f4af0;if(_0x26580c>=_0x1ae462){_0x26580c=_0x1ae462;_0x1f4af0=0xc8;}else{_0x1f4af0=0xce;}_0x5a517f['status'](_0x1f4af0);return _0x5a517f[_0x7f41('0x18')]('Content-Range',_0x5434d2+'-'+_0x26580c+'/'+_0x1ae462)['json'](_0x5ef6a7);}return null;};}function patchUpdates(_0x3fe620){return function(_0x7de9c2){try{jsonpatch[_0x7f41('0x19')](_0x7de9c2,_0x3fe620,!![]);}catch(_0x21660b){return BPromise[_0x7f41('0x1a')](_0x21660b);}return _0x7de9c2[_0x7f41('0x1b')]();};}function saveUpdates(_0x5e0f8b,_0x5e568d){return function(_0x3e8000){if(_0x3e8000){return _0x3e8000['update'](_0x5e0f8b)['then'](function(_0xb27d9c){return _0xb27d9c;});}return null;};}function removeEntity(_0x388946,_0x4fdd78){return function(_0x3f3ee0){if(_0x3f3ee0){return _0x3f3ee0[_0x7f41('0x1c')]()[_0x7f41('0x1d')](function(){_0x388946[_0x7f41('0x12')](0xcc)[_0x7f41('0x11')]();});}};}function handleEntityNotFound(_0x4cbee7,_0x57a302){return function(_0x4dbed0){if(!_0x4dbed0){_0x4cbee7['sendStatus'](0x194);}return _0x4dbed0;};}function handleError(_0x16b410,_0x183ac7){_0x183ac7=_0x183ac7||0x1f4;return function(_0x55a32a){logger[_0x7f41('0x1e')](_0x55a32a[_0x7f41('0x1f')]);if(_0x55a32a['name']){delete _0x55a32a['name'];}_0x16b410['status'](_0x183ac7)[_0x7f41('0x20')](_0x55a32a);};}exports['index']=function(_0x4ee09e,_0x501076){var _0x3889b1={},_0x379dbe={},_0x4fa7e8={'count':0x0,'rows':[]};var _0x2b93e4=_[_0x7f41('0x21')](db['ChatQueueReport'][_0x7f41('0x22')],function(_0x1c33fb){return{'name':_0x1c33fb[_0x7f41('0x23')],'type':_0x1c33fb['type']['key']};});_0x379dbe['model']=_[_0x7f41('0x21')](_0x2b93e4,_0x7f41('0x24'));_0x379dbe[_0x7f41('0x25')]=_[_0x7f41('0x26')](_0x4ee09e[_0x7f41('0x25')]);_0x379dbe[_0x7f41('0x27')]=_['intersection'](_0x379dbe[_0x7f41('0x28')],_0x379dbe[_0x7f41('0x25')]);_0x3889b1[_0x7f41('0x29')]=_['intersection'](_0x379dbe[_0x7f41('0x28')],qs['fields'](_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x2a')]));_0x3889b1[_0x7f41('0x29')]=_0x3889b1['attributes'][_0x7f41('0x2b')]?_0x3889b1[_0x7f41('0x29')]:_0x379dbe[_0x7f41('0x28')];if(!_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x2c')](_0x7f41('0x2d'))){_0x3889b1[_0x7f41('0x17')]=qs[_0x7f41('0x17')](_0x4ee09e['query'][_0x7f41('0x17')]);_0x3889b1[_0x7f41('0x14')]=qs[_0x7f41('0x14')](_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x14')]);}_0x3889b1[_0x7f41('0x2e')]=qs[_0x7f41('0x2f')](_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x2f')]);_0x3889b1[_0x7f41('0x30')]=qs[_0x7f41('0x27')](_[_0x7f41('0x31')](_0x4ee09e['query'],_0x379dbe[_0x7f41('0x27')]),_0x2b93e4);if(_0x4ee09e[_0x7f41('0x25')]['filter']){_0x3889b1[_0x7f41('0x30')]=_['merge'](_0x3889b1[_0x7f41('0x30')],{'$or':_[_0x7f41('0x21')](_0x2b93e4,function(_0x2d2c62){if(_0x2d2c62['type']!==_0x7f41('0x32')){var _0x18ed9a={};_0x18ed9a[_0x2d2c62['name']]={'$like':'%'+_0x4ee09e['query'][_0x7f41('0x33')]+'%'};return _0x18ed9a;}})});}_0x3889b1=_[_0x7f41('0x34')]({},_0x3889b1,_0x4ee09e[_0x7f41('0x35')]);var _0x33f9d5={'where':_0x3889b1[_0x7f41('0x30')]};return db[_0x7f41('0x36')][_0x7f41('0x16')](_0x33f9d5)[_0x7f41('0x1d')](function(_0x2ea20d){_0x4fa7e8['count']=_0x2ea20d;if(_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x37')]){_0x3889b1[_0x7f41('0x38')]=[{'all':!![]}];}return db[_0x7f41('0x36')][_0x7f41('0x39')](_0x3889b1);})[_0x7f41('0x1d')](function(_0x5a2d93){_0x4fa7e8[_0x7f41('0x3a')]=_0x5a2d93;return _0x4fa7e8;})[_0x7f41('0x1d')](respondWithFilteredResult(_0x501076,_0x3889b1))[_0x7f41('0x3b')](handleError(_0x501076,null));};exports[_0x7f41('0x3c')]=function(_0x58235e,_0x51067c){var _0xd4d821={'raw':!![],'where':{'id':_0x58235e[_0x7f41('0x3d')]['id']}},_0x3a87a0={};_0x3a87a0['model']=_[_0x7f41('0x26')](db[_0x7f41('0x36')]['rawAttributes']);_0x3a87a0[_0x7f41('0x25')]=_[_0x7f41('0x26')](_0x58235e[_0x7f41('0x25')]);_0x3a87a0[_0x7f41('0x27')]=_['intersection'](_0x3a87a0[_0x7f41('0x28')],_0x3a87a0['query']);_0xd4d821[_0x7f41('0x29')]=_[_0x7f41('0x3e')](_0x3a87a0[_0x7f41('0x28')],qs[_0x7f41('0x2a')](_0x58235e['query'][_0x7f41('0x2a')]));_0xd4d821[_0x7f41('0x29')]=_0xd4d821[_0x7f41('0x29')]['length']?_0xd4d821[_0x7f41('0x29')]:_0x3a87a0['model'];if(_0x58235e['query'][_0x7f41('0x37')]){_0xd4d821[_0x7f41('0x38')]=[{'all':!![]}];}_0xd4d821=_[_0x7f41('0x34')]({},_0xd4d821,_0x58235e[_0x7f41('0x35')]);return db[_0x7f41('0x36')][_0x7f41('0x3f')](_0xd4d821)[_0x7f41('0x1d')](handleEntityNotFound(_0x51067c,null))[_0x7f41('0x1d')](respondWithResult(_0x51067c,null))[_0x7f41('0x3b')](handleError(_0x51067c,null));};exports[_0x7f41('0x40')]=function(_0x319a90,_0x12d73f){return db['ChatQueueReport'][_0x7f41('0x40')](_0x319a90[_0x7f41('0x41')],{})[_0x7f41('0x1d')](respondWithResult(_0x12d73f,0xc9))[_0x7f41('0x3b')](handleError(_0x12d73f,null));};exports[_0x7f41('0x42')]=function(_0x3a0b0a,_0x12ac2d){if(_0x3a0b0a[_0x7f41('0x41')]['id']){delete _0x3a0b0a[_0x7f41('0x41')]['id'];}return db['ChatQueueReport'][_0x7f41('0x3f')]({'where':{'id':_0x3a0b0a['params']['id']}})['then'](handleEntityNotFound(_0x12ac2d,null))[_0x7f41('0x1d')](saveUpdates(_0x3a0b0a[_0x7f41('0x41')],null))[_0x7f41('0x1d')](respondWithResult(_0x12ac2d,null))['catch'](handleError(_0x12ac2d,null));};exports[_0x7f41('0x1c')]=function(_0x2d20b2,_0x398e57){return db[_0x7f41('0x36')]['find']({'where':{'id':_0x2d20b2[_0x7f41('0x3d')]['id']}})['then'](handleEntityNotFound(_0x398e57,null))[_0x7f41('0x1d')](removeEntity(_0x398e57,null))[_0x7f41('0x3b')](handleError(_0x398e57,null));};exports['describe']=function(_0x2ced2f,_0x1f885b){return db[_0x7f41('0x36')][_0x7f41('0x43')]()['then'](respondWithResult(_0x1f885b,null))['catch'](handleError(_0x1f885b,null));}; \ No newline at end of file +var _0x7a12=['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','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','apply','save','update','destroy','then','end','error','name','send','ChatQueueReport','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filters','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','keys','find'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a12,0xe8));var _0x27a1=function(_0x1e8bd0,_0x30bfde){_0x1e8bd0=_0x1e8bd0-0x0;var _0x315809=_0x7a12[_0x1e8bd0];return _0x315809;};'use strict';var emlformat=require(_0x27a1('0x0'));var rimraf=require(_0x27a1('0x1'));var zipdir=require(_0x27a1('0x2'));var jsonpatch=require(_0x27a1('0x3'));var rp=require(_0x27a1('0x4'));var moment=require(_0x27a1('0x5'));var BPromise=require(_0x27a1('0x6'));var Mustache=require(_0x27a1('0x7'));var util=require('util');var path=require(_0x27a1('0x8'));var sox=require(_0x27a1('0x9'));var csv=require(_0x27a1('0xa'));var ejs=require(_0x27a1('0xb'));var fs=require('fs');var fs_extra=require(_0x27a1('0xc'));var _=require(_0x27a1('0xd'));var squel=require('squel');var crypto=require(_0x27a1('0xe'));var jsforce=require(_0x27a1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x27a1('0xa'));var querystring=require(_0x27a1('0x10'));var Papa=require('papaparse');var Redis=require(_0x27a1('0x11'));var authService=require(_0x27a1('0x12'));var qs=require(_0x27a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27a1('0x14'));var logger=require(_0x27a1('0x15'))(_0x27a1('0x16'));var utils=require(_0x27a1('0x17'));var config=require(_0x27a1('0x18'));var licenseUtil=require(_0x27a1('0x19'));var db=require(_0x27a1('0x1a'))['db'];function respondWithStatusCode(_0x52cf92,_0x11d503){_0x11d503=_0x11d503||0xcc;return function(_0x37aec2){if(_0x37aec2){return _0x52cf92[_0x27a1('0x1b')](_0x11d503);}return _0x52cf92[_0x27a1('0x1c')](_0x11d503)['end']();};}function respondWithResult(_0x303b65,_0x11d840){_0x11d840=_0x11d840||0xc8;return function(_0x4e5cdd){if(_0x4e5cdd){return _0x303b65['status'](_0x11d840)[_0x27a1('0x1d')](_0x4e5cdd);}};}function respondWithFilteredResult(_0x3fc406,_0x4f6871){return function(_0x443cff){if(_0x443cff){var _0x17ebb1=typeof _0x4f6871['offset']===_0x27a1('0x1e')&&typeof _0x4f6871[_0x27a1('0x1f')]===_0x27a1('0x1e');var _0xbd87d1=_0x443cff['count'];var _0x18512a=_0x17ebb1?0x0:_0x4f6871['offset'];var _0x8c969=_0x17ebb1?_0x443cff[_0x27a1('0x20')]:_0x4f6871['offset']+_0x4f6871[_0x27a1('0x1f')];var _0x28a621;if(_0x8c969>=_0xbd87d1){_0x8c969=_0xbd87d1;_0x28a621=0xc8;}else{_0x28a621=0xce;}_0x3fc406[_0x27a1('0x1c')](_0x28a621);return _0x3fc406[_0x27a1('0x21')]('Content-Range',_0x18512a+'-'+_0x8c969+'/'+_0xbd87d1)[_0x27a1('0x1d')](_0x443cff);}return null;};}function patchUpdates(_0x4271e7){return function(_0x38c9ca){try{jsonpatch[_0x27a1('0x22')](_0x38c9ca,_0x4271e7,!![]);}catch(_0x1b6531){return BPromise['reject'](_0x1b6531);}return _0x38c9ca[_0x27a1('0x23')]();};}function saveUpdates(_0xd6cc72,_0x4f11d3){return function(_0x4c02f8){if(_0x4c02f8){return _0x4c02f8[_0x27a1('0x24')](_0xd6cc72)['then'](function(_0x17e881){return _0x17e881;});}return null;};}function removeEntity(_0x2a3b02,_0x21c37e){return function(_0x2a1f12){if(_0x2a1f12){return _0x2a1f12[_0x27a1('0x25')]()[_0x27a1('0x26')](function(){_0x2a3b02['status'](0xcc)[_0x27a1('0x27')]();});}};}function handleEntityNotFound(_0x25307a,_0x5b58a2){return function(_0x348605){if(!_0x348605){_0x25307a['sendStatus'](0x194);}return _0x348605;};}function handleError(_0x1ef90c,_0x5d4b36){_0x5d4b36=_0x5d4b36||0x1f4;return function(_0x19d9b5){logger[_0x27a1('0x28')](_0x19d9b5['stack']);if(_0x19d9b5[_0x27a1('0x29')]){delete _0x19d9b5[_0x27a1('0x29')];}_0x1ef90c[_0x27a1('0x1c')](_0x5d4b36)[_0x27a1('0x2a')](_0x19d9b5);};}exports['index']=function(_0x353b18,_0x4ecc83){var _0x2089aa={},_0x23e8b2={},_0x3f0194={'count':0x0,'rows':[]};var _0x376f32=_['map'](db[_0x27a1('0x2b')][_0x27a1('0x2c')],function(_0x36c597){return{'name':_0x36c597[_0x27a1('0x2d')],'type':_0x36c597[_0x27a1('0x2e')]['key']};});_0x23e8b2[_0x27a1('0x2f')]=_['map'](_0x376f32,_0x27a1('0x29'));_0x23e8b2[_0x27a1('0x30')]=_['keys'](_0x353b18[_0x27a1('0x30')]);_0x23e8b2['filters']=_[_0x27a1('0x31')](_0x23e8b2[_0x27a1('0x2f')],_0x23e8b2[_0x27a1('0x30')]);_0x2089aa['attributes']=_['intersection'](_0x23e8b2[_0x27a1('0x2f')],qs['fields'](_0x353b18['query'][_0x27a1('0x32')]));_0x2089aa[_0x27a1('0x33')]=_0x2089aa[_0x27a1('0x33')][_0x27a1('0x34')]?_0x2089aa[_0x27a1('0x33')]:_0x23e8b2[_0x27a1('0x2f')];if(!_0x353b18[_0x27a1('0x30')][_0x27a1('0x35')]('nolimit')){_0x2089aa['limit']=qs['limit'](_0x353b18[_0x27a1('0x30')][_0x27a1('0x1f')]);_0x2089aa[_0x27a1('0x36')]=qs[_0x27a1('0x36')](_0x353b18['query']['offset']);}_0x2089aa[_0x27a1('0x37')]=qs[_0x27a1('0x38')](_0x353b18[_0x27a1('0x30')][_0x27a1('0x38')]);_0x2089aa[_0x27a1('0x39')]=qs[_0x27a1('0x3a')](_[_0x27a1('0x3b')](_0x353b18['query'],_0x23e8b2['filters']),_0x376f32);if(_0x353b18[_0x27a1('0x30')][_0x27a1('0x3c')]){_0x2089aa[_0x27a1('0x39')]=_['merge'](_0x2089aa[_0x27a1('0x39')],{'$or':_[_0x27a1('0x3d')](_0x376f32,function(_0x1193a6){if(_0x1193a6[_0x27a1('0x2e')]!=='VIRTUAL'){var _0x146352={};_0x146352[_0x1193a6[_0x27a1('0x29')]]={'$like':'%'+_0x353b18[_0x27a1('0x30')][_0x27a1('0x3c')]+'%'};return _0x146352;}})});}_0x2089aa=_[_0x27a1('0x3e')]({},_0x2089aa,_0x353b18[_0x27a1('0x3f')]);var _0x2a5bd1={'where':_0x2089aa[_0x27a1('0x39')]};return db[_0x27a1('0x2b')][_0x27a1('0x20')](_0x2a5bd1)[_0x27a1('0x26')](function(_0x1b9e37){_0x3f0194['count']=_0x1b9e37;if(_0x353b18[_0x27a1('0x30')][_0x27a1('0x40')]){_0x2089aa[_0x27a1('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x27a1('0x42')](_0x2089aa);})['then'](function(_0x1e3922){_0x3f0194[_0x27a1('0x43')]=_0x1e3922;return _0x3f0194;})['then'](respondWithFilteredResult(_0x4ecc83,_0x2089aa))[_0x27a1('0x44')](handleError(_0x4ecc83,null));};exports[_0x27a1('0x45')]=function(_0x496edf,_0x4ccc9c){var _0xe4e38d={'raw':!![],'where':{'id':_0x496edf['params']['id']}},_0x56553b={};_0x56553b[_0x27a1('0x2f')]=_[_0x27a1('0x46')](db[_0x27a1('0x2b')][_0x27a1('0x2c')]);_0x56553b[_0x27a1('0x30')]=_['keys'](_0x496edf['query']);_0x56553b[_0x27a1('0x3a')]=_[_0x27a1('0x31')](_0x56553b[_0x27a1('0x2f')],_0x56553b[_0x27a1('0x30')]);_0xe4e38d[_0x27a1('0x33')]=_[_0x27a1('0x31')](_0x56553b[_0x27a1('0x2f')],qs[_0x27a1('0x32')](_0x496edf[_0x27a1('0x30')][_0x27a1('0x32')]));_0xe4e38d[_0x27a1('0x33')]=_0xe4e38d[_0x27a1('0x33')]['length']?_0xe4e38d['attributes']:_0x56553b[_0x27a1('0x2f')];if(_0x496edf[_0x27a1('0x30')]['includeAll']){_0xe4e38d[_0x27a1('0x41')]=[{'all':!![]}];}_0xe4e38d=_[_0x27a1('0x3e')]({},_0xe4e38d,_0x496edf['options']);return db[_0x27a1('0x2b')][_0x27a1('0x47')](_0xe4e38d)[_0x27a1('0x26')](handleEntityNotFound(_0x4ccc9c,null))['then'](respondWithResult(_0x4ccc9c,null))[_0x27a1('0x44')](handleError(_0x4ccc9c,null));};exports[_0x27a1('0x48')]=function(_0x2fac06,_0x269c33){return db[_0x27a1('0x2b')]['create'](_0x2fac06[_0x27a1('0x49')],{})[_0x27a1('0x26')](respondWithResult(_0x269c33,0xc9))['catch'](handleError(_0x269c33,null));};exports[_0x27a1('0x24')]=function(_0x287250,_0x52c916){if(_0x287250[_0x27a1('0x49')]['id']){delete _0x287250[_0x27a1('0x49')]['id'];}return db[_0x27a1('0x2b')][_0x27a1('0x47')]({'where':{'id':_0x287250[_0x27a1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52c916,null))[_0x27a1('0x26')](saveUpdates(_0x287250['body'],null))[_0x27a1('0x26')](respondWithResult(_0x52c916,null))[_0x27a1('0x44')](handleError(_0x52c916,null));};exports['destroy']=function(_0x22eab2,_0x288bd0){return db[_0x27a1('0x2b')]['find']({'where':{'id':_0x22eab2[_0x27a1('0x4a')]['id']}})[_0x27a1('0x26')](handleEntityNotFound(_0x288bd0,null))[_0x27a1('0x26')](removeEntity(_0x288bd0,null))[_0x27a1('0x44')](handleError(_0x288bd0,null));};exports[_0x27a1('0x4b')]=function(_0x46a12d,_0x5a832a){return db[_0x27a1('0x2b')][_0x27a1('0x4b')]()['then'](respondWithResult(_0x5a832a,null))[_0x27a1('0x44')](handleError(_0x5a832a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9a19a73..c2ecf23 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x50c572,_0x12eaf0){var _0x2b9d83=function(_0x11cd6f){while(--_0x11cd6f){_0x50c572['push'](_0x50c572['shift']());}};_0x2b9d83(++_0x12eaf0);}(_0x757a,0xde));var _0xa757=function(_0x48dd1c,_0x6301cf){_0x48dd1c=_0x48dd1c-0x0;var _0x4e5e0f=_0x757a[_0x48dd1c];return _0x4e5e0f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2d2bcb,_0x3051fc){var _0x303f0f=function(_0x3fd68f){while(--_0x3fd68f){_0x2d2bcb['push'](_0x2d2bcb['shift']());}};_0x303f0f(++_0x3051fc);}(_0xe706,0xa3));var _0x6e70=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0xe706[_0x5dc927];return _0x416440;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e96010b..c32f6bd 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 _0x0dfd=['stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','then','debug','UpdateChatQueueReport','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4c0d15,_0x2392cf){var _0x290033=function(_0x3405d8){while(--_0x3405d8){_0x4c0d15['push'](_0x4c0d15['shift']());}};_0x290033(++_0x2392cf);}(_0x0dfd,0x6e));var _0xd0df=function(_0x3304af,_0x30a2be){_0x3304af=_0x3304af-0x0;var _0x4d1814=_0x0dfd[_0x3304af];return _0x4d1814;};'use strict';var _=require(_0xd0df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd0df('0x1'));var rs=require(_0xd0df('0x2'));var fs=require('fs');var Redis=require(_0xd0df('0x3'));var db=require(_0xd0df('0x4'))['db'];var utils=require(_0xd0df('0x5'));var logger=require('../../config/logger')(_0xd0df('0x6'));var config=require(_0xd0df('0x7'));var jayson=require(_0xd0df('0x8'));var client=jayson[_0xd0df('0x9')][_0xd0df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ff7ab,_0x17bc36,_0x544625){return new BPromise(function(_0x23cab1,_0x151a5f){return client['request'](_0x4ff7ab,_0x544625)['then'](function(_0x45bb80){logger['info'](_0xd0df('0xb'),_0x17bc36,'request\x20sent');logger['debug'](_0xd0df('0xc'),_0x17bc36,_0xd0df('0xd'),JSON[_0xd0df('0xe')](_0x45bb80));if(_0x45bb80[_0xd0df('0xf')]){if(_0x45bb80[_0xd0df('0xf')][_0xd0df('0x10')]===0x1f4){logger['error'](_0xd0df('0xb'),_0x17bc36,_0x45bb80[_0xd0df('0xf')][_0xd0df('0x11')]);return _0x151a5f(_0x45bb80[_0xd0df('0xf')][_0xd0df('0x11')]);}logger[_0xd0df('0xf')](_0xd0df('0xb'),_0x17bc36,_0x45bb80[_0xd0df('0xf')][_0xd0df('0x11')]);return _0x23cab1(_0x45bb80[_0xd0df('0xf')]['message']);}else{logger[_0xd0df('0x12')](_0xd0df('0xb'),_0x17bc36,_0xd0df('0xd'));_0x23cab1(_0x45bb80[_0xd0df('0x13')][_0xd0df('0x11')]);}})[_0xd0df('0x14')](function(_0x467a26){logger['error'](_0xd0df('0xb'),_0x17bc36,_0x467a26);_0x151a5f(_0x467a26);});});}exports[_0xd0df('0x15')]=function(_0x5f4e2d){var _0x13c9df=this;return new Promise(function(_0xb5bc54,_0x916188){return db[_0xd0df('0x16')]['create'](_0x5f4e2d[_0xd0df('0x17')],{'raw':_0x5f4e2d[_0xd0df('0x18')]?_0x5f4e2d[_0xd0df('0x18')][_0xd0df('0x19')]===undefined?!![]:![]:!![]})[_0xd0df('0x1a')](function(_0x33c803){logger[_0xd0df('0x12')](_0xd0df('0x15'),_0x5f4e2d);logger[_0xd0df('0x1b')](_0xd0df('0x15'),_0x5f4e2d,JSON[_0xd0df('0xe')](_0x33c803));_0xb5bc54(_0x33c803);})['catch'](function(_0x5937ee){logger['error'](_0xd0df('0x15'),_0x5937ee['message'],_0x5f4e2d);_0x916188(_0x13c9df[_0xd0df('0xf')](0x1f4,_0x5937ee[_0xd0df('0x11')]));});});};exports[_0xd0df('0x1c')]=function(_0x2e7508){var _0x230cdb=this;return new Promise(function(_0x334a60,_0x5515f5){return db[_0xd0df('0x16')]['update'](_0x2e7508[_0xd0df('0x17')],{'raw':_0x2e7508[_0xd0df('0x18')]?_0x2e7508[_0xd0df('0x18')][_0xd0df('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7508[_0xd0df('0x18')]?_0x2e7508[_0xd0df('0x18')]['where']||null:null,'attributes':_0x2e7508[_0xd0df('0x18')]?_0x2e7508[_0xd0df('0x18')][_0xd0df('0x1d')]||null:null,'limit':_0x2e7508[_0xd0df('0x18')]?_0x2e7508[_0xd0df('0x18')][_0xd0df('0x1e')]||null:null})[_0xd0df('0x1a')](function(_0x410cf8){logger[_0xd0df('0x12')]('UpdateChatQueueReport',_0x2e7508);logger[_0xd0df('0x1b')](_0xd0df('0x1c'),_0x2e7508,JSON[_0xd0df('0xe')](_0x410cf8));_0x334a60(_0x410cf8);})[_0xd0df('0x14')](function(_0x2b623c){logger[_0xd0df('0xf')]('UpdateChatQueueReport',_0x2b623c['message'],_0x2e7508);_0x5515f5(_0x230cdb[_0xd0df('0xf')](0x1f4,_0x2b623c['message']));});});}; \ No newline at end of file +var _0x6b20=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','stringify','catch','UpdateChatQueueReport','update','body','where','attributes','limit','debug','lodash'];(function(_0x1b49e3,_0x4a46a4){var _0x13d36f=function(_0x3b0ae7){while(--_0x3b0ae7){_0x1b49e3['push'](_0x1b49e3['shift']());}};_0x13d36f(++_0x4a46a4);}(_0x6b20,0xd1));var _0x06b2=function(_0x156550,_0xade448){_0x156550=_0x156550-0x0;var _0x185c40=_0x6b20[_0x156550];return _0x185c40;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')](_0x594b48['body'],{'raw':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![]})[_0x06b2('0x19')](function(_0xe28985){logger[_0x06b2('0x12')](_0x06b2('0x14'),_0x594b48);logger['debug'](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x1a')](_0xe28985));_0x192270(_0xe28985);})[_0x06b2('0x1b')](function(_0x208384){logger['error']('CreateChatQueueReport',_0x208384[_0x06b2('0x11')],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x208384['message']));});});};exports[_0x06b2('0x1c')]=function(_0x5e40f2){var _0x3d58c6=this;return new Promise(function(_0x38987b,_0x2a0645){return db['ChatQueueReport'][_0x06b2('0x1d')](_0x5e40f2[_0x06b2('0x1e')],{'raw':_0x5e40f2[_0x06b2('0x17')]?_0x5e40f2[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e40f2['options']?_0x5e40f2[_0x06b2('0x17')][_0x06b2('0x1f')]||null:null,'attributes':_0x5e40f2[_0x06b2('0x17')]?_0x5e40f2[_0x06b2('0x17')][_0x06b2('0x20')]||null:null,'limit':_0x5e40f2[_0x06b2('0x17')]?_0x5e40f2['options'][_0x06b2('0x21')]||null:null})[_0x06b2('0x19')](function(_0x2720fa){logger[_0x06b2('0x12')](_0x06b2('0x1c'),_0x5e40f2);logger[_0x06b2('0x22')](_0x06b2('0x1c'),_0x5e40f2,JSON['stringify'](_0x2720fa));_0x38987b(_0x2720fa);})[_0x06b2('0x1b')](function(_0x32eeea){logger[_0x06b2('0xf')](_0x06b2('0x1c'),_0x32eeea[_0x06b2('0x11')],_0x5e40f2);_0x2a0645(_0x3d58c6[_0x06b2('0xf')](0x1f4,_0x32eeea[_0x06b2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2b3f7fa..700fe3d 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 _0x24dc=['describe','/:id','show','post','create','put','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x59c63d,_0x1b923f){var _0x148287=function(_0x3e456c){while(--_0x3e456c){_0x59c63d['push'](_0x59c63d['shift']());}};_0x148287(++_0x1b923f);}(_0x24dc,0x181));var _0xc24d=function(_0x314923,_0x220967){_0x314923=_0x314923-0x0;var _0x1bbb4e=_0x24dc[_0x314923];return _0x1bbb4e;};'use strict';var multer=require('multer');var util=require(_0xc24d('0x0'));var path=require('path');var timeout=require(_0xc24d('0x1'));var express=require(_0xc24d('0x2'));var router=express[_0xc24d('0x3')]();var fs_extra=require(_0xc24d('0x4'));var auth=require(_0xc24d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc24d('0x6'));var controller=require(_0xc24d('0x7'));router[_0xc24d('0x8')]('/',auth[_0xc24d('0x9')](),controller['index']);router[_0xc24d('0x8')](_0xc24d('0xa'),auth[_0xc24d('0x9')](),controller[_0xc24d('0xb')]);router[_0xc24d('0x8')](_0xc24d('0xc'),auth[_0xc24d('0x9')](),controller[_0xc24d('0xd')]);router[_0xc24d('0xe')]('/',auth[_0xc24d('0x9')](),controller[_0xc24d('0xf')]);router[_0xc24d('0x10')](_0xc24d('0xc'),auth[_0xc24d('0x9')](),controller['update']);router[_0xc24d('0x11')](_0xc24d('0xc'),auth[_0xc24d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5b29=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5b29,0x74));var _0x95b2=function(_0x398ade,_0x16dab1){_0x398ade=_0x398ade-0x0;var _0x3cba29=_0x5b29[_0x398ade];return _0x3cba29;};'use strict';var multer=require(_0x95b2('0x0'));var util=require(_0x95b2('0x1'));var path=require(_0x95b2('0x2'));var timeout=require(_0x95b2('0x3'));var express=require('express');var router=express[_0x95b2('0x4')]();var fs_extra=require(_0x95b2('0x5'));var auth=require(_0x95b2('0x6'));var interaction=require(_0x95b2('0x7'));var config=require(_0x95b2('0x8'));var controller=require(_0x95b2('0x9'));router[_0x95b2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x95b2('0xa')](_0x95b2('0xb'),auth[_0x95b2('0xc')](),controller[_0x95b2('0xd')]);router[_0x95b2('0xa')](_0x95b2('0xe'),auth['isAuthenticated'](),controller[_0x95b2('0xf')]);router[_0x95b2('0x10')]('/',auth[_0x95b2('0xc')](),controller[_0x95b2('0x11')]);router[_0x95b2('0x12')]('/:id',auth[_0x95b2('0xc')](),controller['update']);router[_0x95b2('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x95b2('0x14')]);module[_0x95b2('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b80cbe3..94d5140 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x76691c,_0x1eee44){var _0x2aa32c=function(_0x3bb806){while(--_0x3bb806){_0x76691c['push'](_0x76691c['shift']());}};_0x2aa32c(++_0x1eee44);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xcb91[_0x5de1bc];return _0x19f4b8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index aac6cdd..8f062d1 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 _0x8898=['findAll','rows','catch','rawAttributes','includeAll','include','find','create','update','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','ChatTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x8898,0x135));var _0x8889=function(_0x4874f3,_0x1d1777){_0x4874f3=_0x4874f3-0x0;var _0x499a0c=_0x8898[_0x4874f3];return _0x499a0c;};'use strict';var emlformat=require(_0x8889('0x0'));var rimraf=require(_0x8889('0x1'));var zipdir=require(_0x8889('0x2'));var jsonpatch=require(_0x8889('0x3'));var rp=require('request-promise');var moment=require(_0x8889('0x4'));var BPromise=require(_0x8889('0x5'));var Mustache=require(_0x8889('0x6'));var util=require(_0x8889('0x7'));var path=require(_0x8889('0x8'));var sox=require(_0x8889('0x9'));var csv=require(_0x8889('0xa'));var ejs=require(_0x8889('0xb'));var fs=require('fs');var fs_extra=require(_0x8889('0xc'));var _=require(_0x8889('0xd'));var squel=require(_0x8889('0xe'));var crypto=require('crypto');var jsforce=require(_0x8889('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8889('0xa'));var querystring=require('querystring');var Papa=require(_0x8889('0x10'));var Redis=require(_0x8889('0x11'));var authService=require(_0x8889('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8889('0x13'));var logger=require('../../config/logger')(_0x8889('0x14'));var utils=require(_0x8889('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8889('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d3e65,_0x5d5f0b){_0x5d5f0b=_0x5d5f0b||0xcc;return function(_0x4dc01a){if(_0x4dc01a){return _0x1d3e65[_0x8889('0x17')](_0x5d5f0b);}return _0x1d3e65[_0x8889('0x18')](_0x5d5f0b)[_0x8889('0x19')]();};}function respondWithResult(_0x56626b,_0x5c7200){_0x5c7200=_0x5c7200||0xc8;return function(_0x21e7bb){if(_0x21e7bb){return _0x56626b[_0x8889('0x18')](_0x5c7200)[_0x8889('0x1a')](_0x21e7bb);}};}function respondWithFilteredResult(_0x25a3fb,_0x284179){return function(_0x5f5a0d){if(_0x5f5a0d){var _0x39d255=typeof _0x284179['offset']===_0x8889('0x1b')&&typeof _0x284179['limit']===_0x8889('0x1b');var _0x3db797=_0x5f5a0d['count'];var _0x586e1b=_0x39d255?0x0:_0x284179['offset'];var _0x420b68=_0x39d255?_0x5f5a0d[_0x8889('0x1c')]:_0x284179[_0x8889('0x1d')]+_0x284179[_0x8889('0x1e')];var _0x318f3d;if(_0x420b68>=_0x3db797){_0x420b68=_0x3db797;_0x318f3d=0xc8;}else{_0x318f3d=0xce;}_0x25a3fb[_0x8889('0x18')](_0x318f3d);return _0x25a3fb[_0x8889('0x1f')](_0x8889('0x20'),_0x586e1b+'-'+_0x420b68+'/'+_0x3db797)[_0x8889('0x1a')](_0x5f5a0d);}return null;};}function patchUpdates(_0x48708e){return function(_0x508b95){try{jsonpatch[_0x8889('0x21')](_0x508b95,_0x48708e,!![]);}catch(_0x58d4e3){return BPromise[_0x8889('0x22')](_0x58d4e3);}return _0x508b95['save']();};}function saveUpdates(_0x5d1efa,_0x5431b3){return function(_0x54d2e5){if(_0x54d2e5){return _0x54d2e5['update'](_0x5d1efa)[_0x8889('0x23')](function(_0x16a569){return _0x16a569;});}return null;};}function removeEntity(_0x211896,_0x496eb2){return function(_0xba1433){if(_0xba1433){return _0xba1433['destroy']()[_0x8889('0x23')](function(){_0x211896[_0x8889('0x18')](0xcc)[_0x8889('0x19')]();});}};}function handleEntityNotFound(_0x19e85d,_0x2a9c8b){return function(_0x456c60){if(!_0x456c60){_0x19e85d[_0x8889('0x17')](0x194);}return _0x456c60;};}function handleError(_0x419631,_0x4fb867){_0x4fb867=_0x4fb867||0x1f4;return function(_0x211dae){logger[_0x8889('0x24')](_0x211dae[_0x8889('0x25')]);if(_0x211dae[_0x8889('0x26')]){delete _0x211dae[_0x8889('0x26')];}_0x419631['status'](_0x4fb867)[_0x8889('0x27')](_0x211dae);};}exports['index']=function(_0xe7fd79,_0x365da0){var _0x4e8bfc={},_0x26015b={},_0x13fcd9={'count':0x0,'rows':[]};var _0x323e6b=_['map'](db[_0x8889('0x28')]['rawAttributes'],function(_0x403e02){return{'name':_0x403e02[_0x8889('0x29')],'type':_0x403e02[_0x8889('0x2a')][_0x8889('0x2b')]};});_0x26015b[_0x8889('0x2c')]=_[_0x8889('0x2d')](_0x323e6b,'name');_0x26015b[_0x8889('0x2e')]=_[_0x8889('0x2f')](_0xe7fd79[_0x8889('0x2e')]);_0x26015b[_0x8889('0x30')]=_[_0x8889('0x31')](_0x26015b[_0x8889('0x2c')],_0x26015b[_0x8889('0x2e')]);_0x4e8bfc['attributes']=_[_0x8889('0x31')](_0x26015b[_0x8889('0x2c')],qs[_0x8889('0x32')](_0xe7fd79[_0x8889('0x2e')][_0x8889('0x32')]));_0x4e8bfc['attributes']=_0x4e8bfc[_0x8889('0x33')][_0x8889('0x34')]?_0x4e8bfc[_0x8889('0x33')]:_0x26015b[_0x8889('0x2c')];if(!_0xe7fd79['query'][_0x8889('0x35')]('nolimit')){_0x4e8bfc['limit']=qs['limit'](_0xe7fd79[_0x8889('0x2e')][_0x8889('0x1e')]);_0x4e8bfc['offset']=qs[_0x8889('0x1d')](_0xe7fd79[_0x8889('0x2e')]['offset']);}_0x4e8bfc[_0x8889('0x36')]=qs['sort'](_0xe7fd79[_0x8889('0x2e')][_0x8889('0x37')]);_0x4e8bfc[_0x8889('0x38')]=qs[_0x8889('0x30')](_['pick'](_0xe7fd79[_0x8889('0x2e')],_0x26015b[_0x8889('0x30')]),_0x323e6b);if(_0xe7fd79['query'][_0x8889('0x39')]){_0x4e8bfc['where']=_[_0x8889('0x3a')](_0x4e8bfc['where'],{'$or':_[_0x8889('0x2d')](_0x323e6b,function(_0x427be4){if(_0x427be4[_0x8889('0x2a')]!==_0x8889('0x3b')){var _0x53acfa={};_0x53acfa[_0x427be4[_0x8889('0x26')]]={'$like':'%'+_0xe7fd79['query'][_0x8889('0x39')]+'%'};return _0x53acfa;}})});}_0x4e8bfc=_[_0x8889('0x3a')]({},_0x4e8bfc,_0xe7fd79[_0x8889('0x3c')]);var _0x3d2b75={'where':_0x4e8bfc['where']};return db[_0x8889('0x28')][_0x8889('0x1c')](_0x3d2b75)['then'](function(_0xc09d9b){_0x13fcd9['count']=_0xc09d9b;if(_0xe7fd79['query']['includeAll']){_0x4e8bfc['include']=[{'all':!![]}];}return db[_0x8889('0x28')][_0x8889('0x3d')](_0x4e8bfc);})[_0x8889('0x23')](function(_0x4cf49c){_0x13fcd9[_0x8889('0x3e')]=_0x4cf49c;return _0x13fcd9;})[_0x8889('0x23')](respondWithFilteredResult(_0x365da0,_0x4e8bfc))[_0x8889('0x3f')](handleError(_0x365da0,null));};exports['show']=function(_0x31dd46,_0x59f71e){var _0x2e7c82={'raw':!![],'where':{'id':_0x31dd46['params']['id']}},_0x3a9f3c={};_0x3a9f3c[_0x8889('0x2c')]=_[_0x8889('0x2f')](db['ChatTransferReport'][_0x8889('0x40')]);_0x3a9f3c['query']=_[_0x8889('0x2f')](_0x31dd46[_0x8889('0x2e')]);_0x3a9f3c[_0x8889('0x30')]=_['intersection'](_0x3a9f3c[_0x8889('0x2c')],_0x3a9f3c[_0x8889('0x2e')]);_0x2e7c82[_0x8889('0x33')]=_[_0x8889('0x31')](_0x3a9f3c['model'],qs[_0x8889('0x32')](_0x31dd46[_0x8889('0x2e')][_0x8889('0x32')]));_0x2e7c82[_0x8889('0x33')]=_0x2e7c82[_0x8889('0x33')]['length']?_0x2e7c82[_0x8889('0x33')]:_0x3a9f3c[_0x8889('0x2c')];if(_0x31dd46[_0x8889('0x2e')][_0x8889('0x41')]){_0x2e7c82[_0x8889('0x42')]=[{'all':!![]}];}_0x2e7c82=_['merge']({},_0x2e7c82,_0x31dd46[_0x8889('0x3c')]);return db[_0x8889('0x28')][_0x8889('0x43')](_0x2e7c82)['then'](handleEntityNotFound(_0x59f71e,null))['then'](respondWithResult(_0x59f71e,null))[_0x8889('0x3f')](handleError(_0x59f71e,null));};exports[_0x8889('0x44')]=function(_0x41bf2a,_0x31d524){return db[_0x8889('0x28')][_0x8889('0x44')](_0x41bf2a['body'],{})[_0x8889('0x23')](respondWithResult(_0x31d524,0xc9))[_0x8889('0x3f')](handleError(_0x31d524,null));};exports[_0x8889('0x45')]=function(_0x532e37,_0x598b6e){if(_0x532e37['body']['id']){delete _0x532e37[_0x8889('0x46')]['id'];}return db[_0x8889('0x28')]['find']({'where':{'id':_0x532e37[_0x8889('0x47')]['id']}})[_0x8889('0x23')](handleEntityNotFound(_0x598b6e,null))['then'](saveUpdates(_0x532e37[_0x8889('0x46')],null))['then'](respondWithResult(_0x598b6e,null))['catch'](handleError(_0x598b6e,null));};exports[_0x8889('0x48')]=function(_0x5061d9,_0x205b6e){return db['ChatTransferReport'][_0x8889('0x43')]({'where':{'id':_0x5061d9['params']['id']}})[_0x8889('0x23')](handleEntityNotFound(_0x205b6e,null))[_0x8889('0x23')](removeEntity(_0x205b6e,null))['catch'](handleError(_0x205b6e,null));};exports[_0x8889('0x49')]=function(_0x5c91b5,_0x5b626a){return db[_0x8889('0x28')]['describe']()[_0x8889('0x23')](respondWithResult(_0x5b626a,null))[_0x8889('0x3f')](handleError(_0x5b626a,null));}; \ No newline at end of file +var _0x33a2=['name','send','ChatTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','filters','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','update','then','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x33a2,0xff));var _0x233a=function(_0x2d3d91,_0x58b9bc){_0x2d3d91=_0x2d3d91-0x0;var _0x3624d8=_0x33a2[_0x2d3d91];return _0x3624d8;};'use strict';var emlformat=require(_0x233a('0x0'));var rimraf=require(_0x233a('0x1'));var zipdir=require(_0x233a('0x2'));var jsonpatch=require(_0x233a('0x3'));var rp=require(_0x233a('0x4'));var moment=require(_0x233a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x233a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x233a('0x7'));var csv=require(_0x233a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x233a('0x9'));var _=require(_0x233a('0xa'));var squel=require('squel');var crypto=require(_0x233a('0xb'));var jsforce=require(_0x233a('0xc'));var deskjs=require(_0x233a('0xd'));var toCsv=require(_0x233a('0x8'));var querystring=require('querystring');var Papa=require(_0x233a('0xe'));var Redis=require('ioredis');var authService=require(_0x233a('0xf'));var qs=require(_0x233a('0x10'));var as=require(_0x233a('0x11'));var hardwareService=require(_0x233a('0x12'));var logger=require(_0x233a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x233a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x233a('0x15'))['db'];function respondWithStatusCode(_0x3c562f,_0x26084c){_0x26084c=_0x26084c||0xcc;return function(_0x1bfa7b){if(_0x1bfa7b){return _0x3c562f[_0x233a('0x16')](_0x26084c);}return _0x3c562f['status'](_0x26084c)[_0x233a('0x17')]();};}function respondWithResult(_0x11f433,_0x151252){_0x151252=_0x151252||0xc8;return function(_0x4e4b1c){if(_0x4e4b1c){return _0x11f433['status'](_0x151252)[_0x233a('0x18')](_0x4e4b1c);}};}function respondWithFilteredResult(_0x324657,_0x1fa280){return function(_0x1baea8){if(_0x1baea8){var _0x277118=typeof _0x1fa280[_0x233a('0x19')]==='undefined'&&typeof _0x1fa280[_0x233a('0x1a')]===_0x233a('0x1b');var _0xaf8cbd=_0x1baea8[_0x233a('0x1c')];var _0x53492d=_0x277118?0x0:_0x1fa280['offset'];var _0x29e54e=_0x277118?_0x1baea8['count']:_0x1fa280[_0x233a('0x19')]+_0x1fa280[_0x233a('0x1a')];var _0x51ccac;if(_0x29e54e>=_0xaf8cbd){_0x29e54e=_0xaf8cbd;_0x51ccac=0xc8;}else{_0x51ccac=0xce;}_0x324657[_0x233a('0x1d')](_0x51ccac);return _0x324657[_0x233a('0x1e')](_0x233a('0x1f'),_0x53492d+'-'+_0x29e54e+'/'+_0xaf8cbd)[_0x233a('0x18')](_0x1baea8);}return null;};}function patchUpdates(_0x200954){return function(_0x2d1e06){try{jsonpatch['apply'](_0x2d1e06,_0x200954,!![]);}catch(_0x19c43c){return BPromise[_0x233a('0x20')](_0x19c43c);}return _0x2d1e06['save']();};}function saveUpdates(_0x149b3b,_0x1303f2){return function(_0x197844){if(_0x197844){return _0x197844[_0x233a('0x21')](_0x149b3b)[_0x233a('0x22')](function(_0x27e3d6){return _0x27e3d6;});}return null;};}function removeEntity(_0x2b9403,_0x5f59bd){return function(_0x29448f){if(_0x29448f){return _0x29448f['destroy']()['then'](function(){_0x2b9403[_0x233a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e76bf,_0x16ffd5){return function(_0x57541d){if(!_0x57541d){_0x4e76bf[_0x233a('0x16')](0x194);}return _0x57541d;};}function handleError(_0x37aeb3,_0xc571b6){_0xc571b6=_0xc571b6||0x1f4;return function(_0x5eb6a6){logger[_0x233a('0x23')](_0x5eb6a6[_0x233a('0x24')]);if(_0x5eb6a6['name']){delete _0x5eb6a6[_0x233a('0x25')];}_0x37aeb3['status'](_0xc571b6)[_0x233a('0x26')](_0x5eb6a6);};}exports['index']=function(_0x3856fd,_0x291769){var _0x5ebb10={},_0x33130a={},_0x311047={'count':0x0,'rows':[]};var _0x330829=_['map'](db[_0x233a('0x27')][_0x233a('0x28')],function(_0x201fc1){return{'name':_0x201fc1['fieldName'],'type':_0x201fc1[_0x233a('0x29')][_0x233a('0x2a')]};});_0x33130a[_0x233a('0x2b')]=_['map'](_0x330829,_0x233a('0x25'));_0x33130a['query']=_['keys'](_0x3856fd[_0x233a('0x2c')]);_0x33130a['filters']=_[_0x233a('0x2d')](_0x33130a[_0x233a('0x2b')],_0x33130a[_0x233a('0x2c')]);_0x5ebb10[_0x233a('0x2e')]=_[_0x233a('0x2d')](_0x33130a[_0x233a('0x2b')],qs[_0x233a('0x2f')](_0x3856fd[_0x233a('0x2c')][_0x233a('0x2f')]));_0x5ebb10[_0x233a('0x2e')]=_0x5ebb10[_0x233a('0x2e')][_0x233a('0x30')]?_0x5ebb10[_0x233a('0x2e')]:_0x33130a[_0x233a('0x2b')];if(!_0x3856fd[_0x233a('0x2c')]['hasOwnProperty'](_0x233a('0x31'))){_0x5ebb10[_0x233a('0x1a')]=qs[_0x233a('0x1a')](_0x3856fd[_0x233a('0x2c')][_0x233a('0x1a')]);_0x5ebb10[_0x233a('0x19')]=qs['offset'](_0x3856fd[_0x233a('0x2c')][_0x233a('0x19')]);}_0x5ebb10[_0x233a('0x32')]=qs['sort'](_0x3856fd[_0x233a('0x2c')][_0x233a('0x33')]);_0x5ebb10[_0x233a('0x34')]=qs['filters'](_[_0x233a('0x35')](_0x3856fd[_0x233a('0x2c')],_0x33130a['filters']),_0x330829);if(_0x3856fd[_0x233a('0x2c')][_0x233a('0x36')]){_0x5ebb10['where']=_[_0x233a('0x37')](_0x5ebb10[_0x233a('0x34')],{'$or':_[_0x233a('0x38')](_0x330829,function(_0x2aa550){if(_0x2aa550[_0x233a('0x29')]!==_0x233a('0x39')){var _0x197be2={};_0x197be2[_0x2aa550['name']]={'$like':'%'+_0x3856fd[_0x233a('0x2c')][_0x233a('0x36')]+'%'};return _0x197be2;}})});}_0x5ebb10=_[_0x233a('0x37')]({},_0x5ebb10,_0x3856fd[_0x233a('0x3a')]);var _0x4cd2af={'where':_0x5ebb10[_0x233a('0x34')]};return db['ChatTransferReport'][_0x233a('0x1c')](_0x4cd2af)[_0x233a('0x22')](function(_0x826ca5){_0x311047[_0x233a('0x1c')]=_0x826ca5;if(_0x3856fd['query'][_0x233a('0x3b')]){_0x5ebb10[_0x233a('0x3c')]=[{'all':!![]}];}return db[_0x233a('0x27')][_0x233a('0x3d')](_0x5ebb10);})[_0x233a('0x22')](function(_0x5801d1){_0x311047[_0x233a('0x3e')]=_0x5801d1;return _0x311047;})[_0x233a('0x22')](respondWithFilteredResult(_0x291769,_0x5ebb10))[_0x233a('0x3f')](handleError(_0x291769,null));};exports[_0x233a('0x40')]=function(_0x2810e2,_0x58412d){var _0x1c22a9={'raw':!![],'where':{'id':_0x2810e2[_0x233a('0x41')]['id']}},_0x50a5cd={};_0x50a5cd['model']=_[_0x233a('0x42')](db[_0x233a('0x27')][_0x233a('0x28')]);_0x50a5cd[_0x233a('0x2c')]=_[_0x233a('0x42')](_0x2810e2['query']);_0x50a5cd[_0x233a('0x43')]=_[_0x233a('0x2d')](_0x50a5cd[_0x233a('0x2b')],_0x50a5cd['query']);_0x1c22a9[_0x233a('0x2e')]=_[_0x233a('0x2d')](_0x50a5cd[_0x233a('0x2b')],qs['fields'](_0x2810e2[_0x233a('0x2c')]['fields']));_0x1c22a9['attributes']=_0x1c22a9['attributes'][_0x233a('0x30')]?_0x1c22a9[_0x233a('0x2e')]:_0x50a5cd['model'];if(_0x2810e2[_0x233a('0x2c')][_0x233a('0x3b')]){_0x1c22a9[_0x233a('0x3c')]=[{'all':!![]}];}_0x1c22a9=_[_0x233a('0x37')]({},_0x1c22a9,_0x2810e2[_0x233a('0x3a')]);return db[_0x233a('0x27')]['find'](_0x1c22a9)[_0x233a('0x22')](handleEntityNotFound(_0x58412d,null))['then'](respondWithResult(_0x58412d,null))[_0x233a('0x3f')](handleError(_0x58412d,null));};exports['create']=function(_0x547fbb,_0x2b9ef6){return db[_0x233a('0x27')][_0x233a('0x44')](_0x547fbb[_0x233a('0x45')],{})[_0x233a('0x22')](respondWithResult(_0x2b9ef6,0xc9))[_0x233a('0x3f')](handleError(_0x2b9ef6,null));};exports['update']=function(_0x3d4f32,_0x461c90){if(_0x3d4f32[_0x233a('0x45')]['id']){delete _0x3d4f32[_0x233a('0x45')]['id'];}return db[_0x233a('0x27')][_0x233a('0x46')]({'where':{'id':_0x3d4f32[_0x233a('0x41')]['id']}})['then'](handleEntityNotFound(_0x461c90,null))['then'](saveUpdates(_0x3d4f32['body'],null))[_0x233a('0x22')](respondWithResult(_0x461c90,null))[_0x233a('0x3f')](handleError(_0x461c90,null));};exports[_0x233a('0x47')]=function(_0x1f1a68,_0x249d95){return db[_0x233a('0x27')]['find']({'where':{'id':_0x1f1a68['params']['id']}})[_0x233a('0x22')](handleEntityNotFound(_0x249d95,null))[_0x233a('0x22')](removeEntity(_0x249d95,null))['catch'](handleError(_0x249d95,null));};exports[_0x233a('0x48')]=function(_0x4181f5,_0x160652){return db[_0x233a('0x27')][_0x233a('0x48')]()[_0x233a('0x22')](respondWithResult(_0x160652,null))[_0x233a('0x3f')](handleError(_0x160652,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f9afa87..a873a4e 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 _0xb5ec=['path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45799c,_0x5c7060){var _0x3af710=function(_0x3a7e29){while(--_0x3a7e29){_0x45799c['push'](_0x45799c['shift']());}};_0x3af710(++_0x5c7060);}(_0xb5ec,0x11f));var _0xcb5e=function(_0x395489,_0x52177b){_0x395489=_0x395489-0x0;var _0x5346a0=_0xb5ec[_0x395489];return _0x5346a0;};'use strict';var _=require(_0xcb5e('0x0'));var util=require(_0xcb5e('0x1'));var logger=require(_0xcb5e('0x2'))(_0xcb5e('0x3'));var moment=require(_0xcb5e('0x4'));var BPromise=require(_0xcb5e('0x5'));var rp=require(_0xcb5e('0x6'));var fs=require('fs');var path=require(_0xcb5e('0x7'));var rimraf=require('rimraf');var config=require(_0xcb5e('0x8'));var attributes=require(_0xcb5e('0x9'));module[_0xcb5e('0xa')]=function(_0x10dac4,_0xf8ded2){return _0x10dac4['define'](_0xcb5e('0xb'),attributes,{'tableName':_0xcb5e('0xc'),'paranoid':![],'indexes':[{'name':_0xcb5e('0xd'),'fields':[_0xcb5e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9901=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','../../config/logger'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x9901,0xe3));var _0x1990=function(_0x41ee64,_0x206c94){_0x41ee64=_0x41ee64-0x0;var _0x468e47=_0x9901[_0x41ee64];return _0x468e47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1990('0x0'))(_0x1990('0x1'));var moment=require(_0x1990('0x2'));var BPromise=require(_0x1990('0x3'));var rp=require(_0x1990('0x4'));var fs=require('fs');var path=require(_0x1990('0x5'));var rimraf=require(_0x1990('0x6'));var config=require(_0x1990('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x1990('0x8')]=function(_0x2d09f3,_0x25cb10){return _0x2d09f3[_0x1990('0x9')](_0x1990('0xa'),attributes,{'tableName':_0x1990('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e2bd4d5..6271417 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 _0xd25c=['client','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x37a9e3,_0x5e09a0){var _0x44bf26=function(_0x38b450){while(--_0x38b450){_0x37a9e3['push'](_0x37a9e3['shift']());}};_0x44bf26(++_0x5e09a0);}(_0xd25c,0x104));var _0xcd25=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xd25c[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd25('0x0'));var BPromise=require('bluebird');var rs=require(_0xcd25('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcd25('0x2'));var logger=require(_0xcd25('0x3'))('rpc');var config=require(_0xcd25('0x4'));var jayson=require(_0xcd25('0x5'));var client=jayson[_0xcd25('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e3a9,_0x4ed1c4,_0x512108){return new BPromise(function(_0x7a53f8,_0x3ec4d0){return client['request'](_0x5e3a9,_0x512108)['then'](function(_0x5bdfa3){logger['info'](_0xcd25('0x7'),_0x4ed1c4,_0xcd25('0x8'));logger[_0xcd25('0x9')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4ed1c4,_0xcd25('0x8'),JSON[_0xcd25('0xa')](_0x5bdfa3));if(_0x5bdfa3[_0xcd25('0xb')]){if(_0x5bdfa3[_0xcd25('0xb')]['code']===0x1f4){logger[_0xcd25('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x4ed1c4,_0x5bdfa3['error'][_0xcd25('0xc')]);return _0x3ec4d0(_0x5bdfa3[_0xcd25('0xb')][_0xcd25('0xc')]);}logger['error'](_0xcd25('0x7'),_0x4ed1c4,_0x5bdfa3[_0xcd25('0xb')][_0xcd25('0xc')]);return _0x7a53f8(_0x5bdfa3['error']['message']);}else{logger['info'](_0xcd25('0x7'),_0x4ed1c4,'request\x20sent');_0x7a53f8(_0x5bdfa3['result'][_0xcd25('0xc')]);}})[_0xcd25('0xd')](function(_0x582ee4){logger['error'](_0xcd25('0x7'),_0x4ed1c4,_0x582ee4);_0x3ec4d0(_0x582ee4);});});} \ No newline at end of file +var _0x86f4=['then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x13f3af,_0x2ac326){var _0xda3c9f=function(_0x5d96e9){while(--_0x5d96e9){_0x13f3af['push'](_0x13f3af['shift']());}};_0xda3c9f(++_0x2ac326);}(_0x86f4,0x16a));var _0x486f=function(_0x3bebac,_0x371dab){_0x3bebac=_0x3bebac-0x0;var _0x33f955=_0x86f4[_0x3bebac];return _0x33f955;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var moment=require(_0x486f('0x2'));var BPromise=require(_0x486f('0x3'));var rs=require(_0x486f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x486f('0x5'))['db'];var utils=require(_0x486f('0x6'));var logger=require(_0x486f('0x7'))(_0x486f('0x8'));var config=require(_0x486f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x486f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f394d,_0x1a8152,_0x1248f4){return new BPromise(function(_0x2565eb,_0x39ca7b){return client[_0x486f('0xb')](_0x1f394d,_0x1248f4)[_0x486f('0xc')](function(_0xacae2b){logger['info'](_0x486f('0xd'),_0x1a8152,_0x486f('0xe'));logger['debug'](_0x486f('0xf'),_0x1a8152,_0x486f('0xe'),JSON[_0x486f('0x10')](_0xacae2b));if(_0xacae2b[_0x486f('0x11')]){if(_0xacae2b['error'][_0x486f('0x12')]===0x1f4){logger[_0x486f('0x11')](_0x486f('0xd'),_0x1a8152,_0xacae2b['error'][_0x486f('0x13')]);return _0x39ca7b(_0xacae2b[_0x486f('0x11')]['message']);}logger[_0x486f('0x11')](_0x486f('0xd'),_0x1a8152,_0xacae2b['error'][_0x486f('0x13')]);return _0x2565eb(_0xacae2b[_0x486f('0x11')][_0x486f('0x13')]);}else{logger[_0x486f('0x14')](_0x486f('0xd'),_0x1a8152,'request\x20sent');_0x2565eb(_0xacae2b['result'][_0x486f('0x13')]);}})[_0x486f('0x15')](function(_0x5e8e0e){logger[_0x486f('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x1a8152,_0x5e8e0e);_0x39ca7b(_0x5e8e0e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4a9c2fb..98de0ee 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 _0x582d=['get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0x582d,0x14a));var _0xd582=function(_0x52218a,_0x587646){_0x52218a=_0x52218a-0x0;var _0x280950=_0x582d[_0x52218a];return _0x280950;};'use strict';var multer=require(_0xd582('0x0'));var util=require(_0xd582('0x1'));var path=require(_0xd582('0x2'));var timeout=require(_0xd582('0x3'));var express=require(_0xd582('0x4'));var router=express[_0xd582('0x5')]();var fs_extra=require(_0xd582('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd582('0x7'));var config=require(_0xd582('0x8'));var controller=require(_0xd582('0x9'));router[_0xd582('0xa')]('/',auth[_0xd582('0xb')](),controller[_0xd582('0xc')]);router[_0xd582('0xa')](_0xd582('0xd'),auth[_0xd582('0xb')](),controller[_0xd582('0xe')]);router[_0xd582('0xa')](_0xd582('0xf'),auth[_0xd582('0xb')](),controller[_0xd582('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd582('0x11')](_0xd582('0xf'),auth[_0xd582('0xb')](),controller['update']);router[_0xd582('0x12')](_0xd582('0xf'),auth[_0xd582('0xb')](),controller['destroy']);module[_0xd582('0x13')]=router; \ No newline at end of file +var _0x24c7=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy'];(function(_0x3d0012,_0x84ac9f){var _0x21339f=function(_0x3448a4){while(--_0x3448a4){_0x3d0012['push'](_0x3d0012['shift']());}};_0x21339f(++_0x84ac9f);}(_0x24c7,0x17b));var _0x724c=function(_0x4e672c,_0x250417){_0x4e672c=_0x4e672c-0x0;var _0x4fc013=_0x24c7[_0x4e672c];return _0x4fc013;};'use strict';var multer=require(_0x724c('0x0'));var util=require('util');var path=require(_0x724c('0x1'));var timeout=require('connect-timeout');var express=require(_0x724c('0x2'));var router=express['Router']();var fs_extra=require(_0x724c('0x3'));var auth=require(_0x724c('0x4'));var interaction=require(_0x724c('0x5'));var config=require('../../config/environment');var controller=require(_0x724c('0x6'));router[_0x724c('0x7')]('/',auth[_0x724c('0x8')](),controller[_0x724c('0x9')]);router[_0x724c('0x7')](_0x724c('0xa'),auth[_0x724c('0x8')](),controller[_0x724c('0xb')]);router[_0x724c('0x7')](_0x724c('0xc'),auth[_0x724c('0x8')](),controller[_0x724c('0xd')]);router['post']('/',auth[_0x724c('0x8')](),controller['create']);router[_0x724c('0xe')](_0x724c('0xc'),auth[_0x724c('0x8')](),controller[_0x724c('0xf')]);router['delete'](_0x724c('0xc'),auth[_0x724c('0x8')](),controller[_0x724c('0x10')]);module[_0x724c('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 f1a8a8c..5f705ed 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 _0xfb8e=['#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','squared','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb8e,0x132));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xefb8('0x0'));module['exports']={'name':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xefb8('0x1')]},'mapKey':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x2')},'mapKeyOffline':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x2')},'key':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x3')},'customerAlias':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xefb8('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xefb8('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xefb8('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xefb8('0x1')]},'animation':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xefb8('0x7')]('rounded',_0xefb8('0x8')),'defaultValue':_0xefb8('0x9')},'header_online':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0xa')},'offline_chat_button':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0xb')},'header_offline':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0xc')},'download_transcript':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xefb8('0xe')]},'closingQuestion':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0x13')},'closingMessage':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0xb')},'skipMessageButton':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x14')},'conditionAgreement':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0x15')},'ratingType':{'type':Sequelize[_0xefb8('0x7')](_0xefb8('0x16'),_0xefb8('0x17')),'defaultValue':_0xefb8('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xefb8('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xefb8('0xe')],'defaultValue':function(){return JSON[_0xefb8('0x18')]({'items':[{'type':_0xefb8('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xefb8('0x1a'),'required':!![]},'props':{'title':_0xefb8('0x1b'),'helpText':''}},{'type':_0xefb8('0x19'),'props':{'title':_0xefb8('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xefb8('0x2'),'type':_0xefb8('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xefb8('0x1c')]('onlineForm')?JSON[_0xefb8('0x1d')](this['getDataValue'](_0xefb8('0x1e'))):{};},'set':function(_0x4c6a69){return this[_0xefb8('0x1f')](_0xefb8('0x1e'),JSON[_0xefb8('0x18')](_0x4c6a69));}},'offlineForm':{'type':Sequelize[_0xefb8('0xe')],'defaultValue':function(){return JSON[_0xefb8('0x18')]({'items':[{'type':'input','props':{'title':_0xefb8('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xefb8('0x2')},'variable':null},{'type':_0xefb8('0x20'),'config':{'placeholder':_0xefb8('0x21')},'props':{'title':_0xefb8('0x21'),'helpText':_0xefb8('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xefb8('0x1c')]('offlineForm')?JSON[_0xefb8('0x1d')](this[_0xefb8('0x1c')]('offlineForm')):{};},'set':function(_0x18ee87){return this[_0xefb8('0x1f')](_0xefb8('0x23'),JSON[_0xefb8('0x18')](_0x18ee87));}},'token':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x24')},'waitingMessage':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0x26')},'offlineMessageBody':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x27')},'skipUnmanaged':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x14')},'sendUnmanaged':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xefb8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xefb8('0xe')],'defaultValue':function(){return _0xefb8('0x28');}},'notificationSound':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xefb8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xefb8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xefb8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x2a')},'verticalAlignment':{'type':Sequelize[_0xefb8('0x5')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x2b')},'messagesAlignment':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xefb8('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xefb8('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![],'defaultValue':_0xefb8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xefb8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xefb8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':_0xefb8('0x2d')},'systemAvatar':{'type':Sequelize[_0xefb8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xefb8('0x5')],'comment':_0xefb8('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![],'comment':_0xefb8('0x2f'),'set':function(_0xb8a571){if(!_0xb8a571)this[_0xefb8('0x1f')](_0xefb8('0x30'),null);this[_0xefb8('0x1f')](_0xefb8('0x31'),_0xb8a571);}},'vidaooEscalation':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xefb8('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xefb8('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xefb8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xefb8('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xefb8('0xe')]}}; \ No newline at end of file +var _0x3c33=['Note','Type\x20a\x20message','Skip','star','thumb','TEXT','input','name','text','email','getDataValue','onlineForm','setDataValue','stringify','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','We\x20are\x20here!','Chat','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error'];(function(_0x4c4b99,_0x3a290f){var _0x150415=function(_0x4b9e37){while(--_0x4b9e37){_0x4c4b99['push'](_0x4c4b99['shift']());}};_0x150415(++_0x3a290f);}(_0x3c33,0xb7));var _0x33c3=function(_0x35228c,_0x1e6824){_0x35228c=_0x35228c-0x0;var _0x56b5c0=_0x3c33[_0x35228c];return _0x56b5c0;};'use strict';var Sequelize=require(_0x33c3('0x0'));var rs=require(_0x33c3('0x1'));module[_0x33c3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![],'unique':_0x33c3('0x4')},'description':{'type':Sequelize[_0x33c3('0x3')]},'mapKey':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x5')},'customerAlias':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c3('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![],'defaultValue':_0x33c3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![],'defaultValue':_0x33c3('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x33c3('0x3')]},'animation':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x33c3('0xa')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0xb')},'start_chat_button':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0xc')},'offline_chat_button':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x10')},'noteTitle':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x11')},'placeholderMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x12')},'closingMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x13')},'conditionAgreement':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x33c3('0xa')](_0x33c3('0x14'),_0x33c3('0x15')),'defaultValue':_0x33c3('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x33c3('0x17'),'variable':null,'config':{'placeholder':_0x33c3('0x18'),'type':_0x33c3('0x19'),'required':!![]},'props':{'title':_0x33c3('0x18'),'helpText':''}},{'type':_0x33c3('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x33c3('0x1a'),'type':_0x33c3('0x1a')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x33c3('0x1b')](_0x33c3('0x1c'))?JSON['parse'](this[_0x33c3('0x1b')](_0x33c3('0x1c'))):{};},'set':function(_0x22a37a){return this[_0x33c3('0x1d')]('onlineForm',JSON[_0x33c3('0x1e')](_0x22a37a));}},'offlineForm':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':function(){return JSON[_0x33c3('0x1e')]({'items':[{'type':_0x33c3('0x17'),'props':{'title':_0x33c3('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x33c3('0x1a')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x33c3('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x33c3('0x1b')](_0x33c3('0x20'))?JSON[_0x33c3('0x21')](this[_0x33c3('0x1b')]('offlineForm')):{};},'set':function(_0x1cb183){return this[_0x33c3('0x1d')](_0x33c3('0x20'),JSON[_0x33c3('0x1e')](_0x1cb183));}},'token':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':function(){return rs[_0x33c3('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x33c3('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x33c3('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x26')},'skipUnmanaged':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x13')},'sendUnmanaged':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x33c3('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x33c3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':function(){return _0x33c3('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x29')},'verticalAlignment':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x2a')},'messagesAlignment':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x2b')},'defaultTitle':{'type':Sequelize[_0x33c3('0x3')]},'customerAvatar':{'type':Sequelize[_0x33c3('0x16')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c3('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x33c3('0x8')],'comment':_0x33c3('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![],'comment':_0x33c3('0x2e'),'set':function(_0x2f2009){if(!_0x2f2009)this[_0x33c3('0x1d')](_0x33c3('0x2f'),null);this['setDataValue']('mandatoryDisposition',_0x2f2009);}},'vidaooEscalation':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x33c3('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c3('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x33c3('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index be998a3..1888971 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 _0x1643=['filter','merge','VIRTUAL','options','includeAll','include','ChatWebsite','findAll','show','params','Pause','length','find','create','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','addAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','agentAvatar','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','resolve','timezone','chat','from','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','updatedAt','includes','ListId','mapKey','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Interval','Intervals','interval','account','applications','orderBy','Applications','priority','asc','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queue','EventManager','notify','offline','files','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','tag','getSnippet','getProactiveActions','virtual','increment','readFileSync','server/files/chat/iframe.ejs','utf8','3.9.0','origin','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','stack','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../errors/api','APIBadRequestError','APINotFoundError','APIConflictError','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','update','get','ChatWebsites','UserProfileResource','destroy','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','vendor','%s\x20%s\x20%s','model','type','index','mandatoryDispositionPause','map','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x1643,0xe0));var _0x3164=function(_0x861978,_0x3a4a7a){_0x861978=_0x861978-0x0;var _0x3626d6=_0x1643[_0x861978];return _0x3626d6;};'use strict';var Mustache=require(_0x3164('0x0'));var util=require(_0x3164('0x1'));var path=require(_0x3164('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3164('0x3'));var _=require('lodash');var querystring=require(_0x3164('0x4'));var htmlToText=require(_0x3164('0x5'));var Redis=require(_0x3164('0x6'));var jayson=require('jayson/promise');var qs=require(_0x3164('0x7'));var logger=require('../../config/logger')(_0x3164('0x8'));var config=require('../../config/environment');var APIBadRequestError=require(_0x3164('0x9'))[_0x3164('0xa')];var APINotFoundError=require(_0x3164('0x9'))[_0x3164('0xb')];var APIOutOfIntervalError=require(_0x3164('0x9'))['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0x3164('0x9'))[_0x3164('0xc')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0x3164('0xd')];var db=require(_0x3164('0xe'))['db'];config['redis']=_[_0x3164('0xf')](config[_0x3164('0x10')],{'host':_0x3164('0x11'),'port':0x18eb});var socket=require(_0x3164('0x12'))(new Redis(config['redis']));require(_0x3164('0x13'))[_0x3164('0x14')](socket);var client=jayson[_0x3164('0x15')][_0x3164('0x16')]({'port':0x232c});var client9002=jayson[_0x3164('0x15')][_0x3164('0x16')]({'port':0x232a});var client9003=jayson[_0x3164('0x15')][_0x3164('0x16')]({'port':0x232b});var client9001=jayson['client'][_0x3164('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x249915,_0x14c112,_0x1d82bd,_0x36bcb3){return new Promise(function(_0x58c049,_0x12084d){var _0x2f569f=_0x36bcb3||client;return _0x2f569f[_0x3164('0x17')](_0x249915,_0x1d82bd)[_0x3164('0x18')](function(_0x2b8025){logger[_0x3164('0x19')](_0x3164('0x1a'),_0x14c112,_0x3164('0x1b'));logger['debug'](_0x3164('0x1c'),_0x14c112,_0x3164('0x1b'),JSON[_0x3164('0x1d')](_0x2b8025));if(_0x2b8025[_0x3164('0x1e')]){if(_0x2b8025[_0x3164('0x1e')][_0x3164('0x1f')]===0x1f4){logger[_0x3164('0x1e')](_0x3164('0x1a'),_0x14c112,_0x2b8025[_0x3164('0x1e')][_0x3164('0x20')]);return _0x12084d(_0x2b8025[_0x3164('0x1e')]['message']);}logger['error'](_0x3164('0x1a'),_0x14c112,_0x2b8025[_0x3164('0x1e')][_0x3164('0x20')]);return _0x58c049(_0x2b8025[_0x3164('0x1e')]['message']);}else{logger[_0x3164('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x14c112,_0x3164('0x1b'));_0x58c049(_0x2b8025['result']['message']);}})[_0x3164('0x21')](function(_0x2bd25c){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x14c112,_0x2bd25c);_0x12084d(_0x2bd25c);});});}function respondWithStatusCode(_0x443dc1,_0x41077e){_0x41077e=_0x41077e||0xcc;return function(_0xb6c56f){if(_0xb6c56f){return _0x443dc1[_0x3164('0x22')](_0x41077e);}return _0x443dc1[_0x3164('0x23')](_0x41077e)[_0x3164('0x24')]();};}function respondWithResult(_0x308cfa,_0x79256e){_0x79256e=_0x79256e||0xc8;return function(_0x511057){if(_0x511057){return _0x308cfa[_0x3164('0x23')](_0x79256e)['json'](_0x511057);}};}function respondWithFilteredResult(_0x54651d,_0x309096){return function(_0xadc3e5){if(_0xadc3e5){var _0x7a408e=typeof _0x309096[_0x3164('0x25')]===_0x3164('0x26')&&typeof _0x309096['limit']===_0x3164('0x26');var _0x182c68=_0xadc3e5[_0x3164('0x27')];var _0x38725f=_0x7a408e?0x0:_0x309096[_0x3164('0x25')];var _0x3556ac=_0x7a408e?_0xadc3e5[_0x3164('0x27')]:_0x309096['offset']+_0x309096[_0x3164('0x28')];var _0x402c64;if(_0x3556ac>=_0x182c68){_0x3556ac=_0x182c68;_0x402c64=0xc8;}else{_0x402c64=0xce;}_0x54651d['status'](_0x402c64);return _0x54651d[_0x3164('0x29')]('Content-Range',_0x38725f+'-'+_0x3556ac+'/'+_0x182c68)[_0x3164('0x2a')](_0xadc3e5);}return null;};}function saveUpdates(_0x3b6aca){return function(_0x4c6b7c){if(_0x4c6b7c){return _0x4c6b7c[_0x3164('0x2b')](_0x3b6aca)[_0x3164('0x18')](function(_0x169411){return _0x169411;});}return null;};}function removeEntity(_0x57f922){return function(_0x5845b9){if(_0x5845b9){return _0x5845b9['destroy']()[_0x3164('0x18')](function(){var _0x4d0809=_0x5845b9[_0x3164('0x2c')]({'plain':!![]});var _0x1673e2=_0x3164('0x2d');return db[_0x3164('0x2e')][_0x3164('0x2f')]({'where':{'type':_0x1673e2,'resourceId':_0x4d0809['id']}})[_0x3164('0x18')](function(){return _0x5845b9;});})['then'](function(){_0x57f922[_0x3164('0x23')](0xcc)[_0x3164('0x24')]();});}};}function handleEntityNotFound(_0x24cf48){return function(_0xddb0c1){if(!_0xddb0c1){_0x24cf48[_0x3164('0x22')](0x194);}return _0xddb0c1;};}function handleError(_0x3a6c82,_0x56d916){_0x56d916=_0x56d916||0x1f4;return function(_0x354074){logger[_0x3164('0x1e')](_0x354074['stack']);if(_0x354074[_0x3164('0x30')]){delete _0x354074[_0x3164('0x30')];}_0x3a6c82[_0x3164('0x23')](_0x56d916)[_0x3164('0x31')](_0x354074);};}function createInteractionObject(_0x33dfd4,_0x176b46,_0x2b8e63,_0x1bfbd0){var _0x4a1e6e=require(_0x3164('0x32'));var _0x235d89=new _0x4a1e6e();var _0xba82a=_0x235d89[_0x3164('0x33')](_0x2b8e63[_0x3164('0x34')])[_0x3164('0x35')]();var _0x4f3e50=_0x176b46[_0x3164('0x36')];if(_0x2b8e63[_0x3164('0x37')]){_0x4f3e50=_0x2b8e63[_0x3164('0x37')];}else if(_0x2b8e63[_0x3164('0x38')]){_0x4f3e50=_[_0x3164('0x39')](_0x2b8e63[_0x3164('0x38')][_0x3164('0x3a')](','));}return{'ContactId':_0x1bfbd0['id'],'ChatWebsiteId':_0x33dfd4,'from':(_0x1bfbd0[_0x3164('0x3b')]||'')+'\x20'+(_0x1bfbd0[_0x3164('0x3c')]||''),'customerIp':_0x4f3e50,'customerPort':_0x2b8e63[_0x3164('0x3d')]?_0x2b8e63[_0x3164('0x3d')]:null,'referer':_0x176b46[_0x3164('0x3e')],'browserName':_0xba82a['browser']['name']&&_0xba82a['browser'][_0x3164('0x3f')]?util[_0x3164('0x40')](_0x3164('0x41'),_0xba82a[_0x3164('0x42')]['name'],_0xba82a['browser'][_0x3164('0x3f')]):_0x3164('0x43'),'browserVersion':_0xba82a[_0x3164('0x42')][_0x3164('0x3f')]||_0x3164('0x43'),'osName':util[_0x3164('0x40')](_0x3164('0x41'),_0xba82a['os'][_0x3164('0x30')],_0xba82a['os']['version']),'osVersion':_0xba82a['os'][_0x3164('0x3f')],'deviceModel':_0xba82a[_0x3164('0x44')]['model']&&_0xba82a[_0x3164('0x44')][_0x3164('0x45')]?util[_0x3164('0x40')](_0x3164('0x46'),_0xba82a[_0x3164('0x44')][_0x3164('0x47')],_0xba82a[_0x3164('0x44')][_0x3164('0x45')],_0xba82a[_0x3164('0x44')]['type']):null,'deviceVendor':_0xba82a[_0x3164('0x44')][_0x3164('0x45')],'deviceType':_0xba82a[_0x3164('0x44')][_0x3164('0x48')],'formData':JSON['stringify'](_0x176b46)};}exports[_0x3164('0x49')]=function(_0x1615d2,_0x303c50){var _0xef46d4={'include':[{'model':db['Pause'],'as':_0x3164('0x4a')}]},_0x1e6792={},_0x8c8b0e={'count':0x0,'rows':[]};var _0x252c0a=_[_0x3164('0x4b')](db['ChatWebsite'][_0x3164('0x4c')],function(_0xb9c888){return{'name':_0xb9c888[_0x3164('0x4d')],'type':_0xb9c888[_0x3164('0x48')]['key']};});_0x1e6792[_0x3164('0x47')]=_['map'](_0x252c0a,'name');_0x1e6792[_0x3164('0x4e')]=_[_0x3164('0x4f')](_0x1615d2[_0x3164('0x4e')]);_0x1e6792[_0x3164('0x50')]=_[_0x3164('0x51')](_0x1e6792[_0x3164('0x47')],_0x1e6792['query']);_0xef46d4['attributes']=_[_0x3164('0x51')](_0x1e6792[_0x3164('0x47')],qs[_0x3164('0x52')](_0x1615d2[_0x3164('0x4e')][_0x3164('0x52')]));_0xef46d4[_0x3164('0x53')]=_0xef46d4[_0x3164('0x53')]['length']?_0xef46d4[_0x3164('0x53')]:_0x1e6792[_0x3164('0x47')];if(!_0x1615d2[_0x3164('0x4e')][_0x3164('0x54')](_0x3164('0x55'))){_0xef46d4['limit']=qs[_0x3164('0x28')](_0x1615d2['query'][_0x3164('0x28')]);_0xef46d4[_0x3164('0x25')]=qs['offset'](_0x1615d2[_0x3164('0x4e')]['offset']);}_0xef46d4[_0x3164('0x56')]=qs[_0x3164('0x57')](_0x1615d2[_0x3164('0x4e')][_0x3164('0x57')]);_0xef46d4[_0x3164('0x58')]=qs[_0x3164('0x50')](_['pick'](_0x1615d2[_0x3164('0x4e')],_0x1e6792['filters']),_0x252c0a);if(_0x1615d2[_0x3164('0x4e')][_0x3164('0x59')]){_0xef46d4[_0x3164('0x58')]=_[_0x3164('0x5a')](_0xef46d4[_0x3164('0x58')],{'$or':_['map'](_0x252c0a,function(_0x41e4db){if(_0x41e4db[_0x3164('0x48')]!==_0x3164('0x5b')){var _0x2b678f={};_0x2b678f[_0x41e4db[_0x3164('0x30')]]={'$like':'%'+_0x1615d2['query'][_0x3164('0x59')]+'%'};return _0x2b678f;}})});}_0xef46d4=_[_0x3164('0x5a')]({},_0xef46d4,_0x1615d2[_0x3164('0x5c')]);var _0x37aa7f={'where':_0xef46d4[_0x3164('0x58')]};return db['ChatWebsite']['count'](_0x37aa7f)['then'](function(_0x306b86){_0x8c8b0e[_0x3164('0x27')]=_0x306b86;if(_0x1615d2[_0x3164('0x4e')][_0x3164('0x5d')]){_0xef46d4[_0x3164('0x5e')]=[{'all':!![]}];}return db[_0x3164('0x5f')][_0x3164('0x60')](_0xef46d4);})[_0x3164('0x18')](function(_0x3d2724){_0x8c8b0e['rows']=_0x3d2724;return _0x8c8b0e;})[_0x3164('0x18')](respondWithFilteredResult(_0x303c50,_0xef46d4))['catch'](handleError(_0x303c50,null));};exports[_0x3164('0x61')]=function(_0x13ce9b,_0x1a2967){var _0x4c70da={'raw':![],'where':{'id':_0x13ce9b[_0x3164('0x62')]['id']},'include':[{'model':db[_0x3164('0x63')],'as':_0x3164('0x4a')}]},_0x2e39e1={};_0x2e39e1[_0x3164('0x47')]=_[_0x3164('0x4f')](db[_0x3164('0x5f')][_0x3164('0x4c')]);_0x2e39e1[_0x3164('0x4e')]=_[_0x3164('0x4f')](_0x13ce9b[_0x3164('0x4e')]);_0x2e39e1['filters']=_['intersection'](_0x2e39e1[_0x3164('0x47')],_0x2e39e1['query']);_0x4c70da[_0x3164('0x53')]=_['intersection'](_0x2e39e1[_0x3164('0x47')],qs[_0x3164('0x52')](_0x13ce9b[_0x3164('0x4e')]['fields']));_0x4c70da[_0x3164('0x53')]=_0x4c70da[_0x3164('0x53')][_0x3164('0x64')]?_0x4c70da[_0x3164('0x53')]:_0x2e39e1[_0x3164('0x47')];if(_0x13ce9b[_0x3164('0x4e')][_0x3164('0x5d')]){_0x4c70da[_0x3164('0x5e')]=[{'all':!![]}];}_0x4c70da=_[_0x3164('0x5a')]({},_0x4c70da,_0x13ce9b[_0x3164('0x5c')]);return db[_0x3164('0x5f')][_0x3164('0x65')](_0x4c70da)[_0x3164('0x18')](handleEntityNotFound(_0x1a2967,null))[_0x3164('0x18')](respondWithResult(_0x1a2967,null))['catch'](handleError(_0x1a2967,null));};exports[_0x3164('0x66')]=function(_0x183ea4,_0x30300b){var _0x3e5db9=null;_0x183ea4['body'][_0x3164('0x67')][_0x3164('0x3a')](',')[_0x3164('0x68')](_0x45f8e5=>{if(_0x45f8e5[_0x3164('0x69')]()!==''&&!wildcardUtils[_0x3164('0x6a')](_0x45f8e5['trim']())){_0x3e5db9=new APIBadRequestError('\x22'+_0x45f8e5+_0x3164('0x6b'));}});if(_0x3e5db9){return handleError(_0x30300b,null)(_0x3e5db9);}return db[_0x3164('0x5f')][_0x3164('0x66')](_0x183ea4['body'],{})[_0x3164('0x18')](function(_0x16cc59){var _0x1454a7=_0x183ea4[_0x3164('0x6c')]['get']({'plain':!![]});if(!_0x1454a7)throw new Error(_0x3164('0x6d'));if(_0x1454a7['role']===_0x3164('0x6c')){var _0xaf3dca=_0x16cc59['get']({'plain':!![]});var _0x2eb993=_0x3164('0x2d');return db[_0x3164('0x6e')][_0x3164('0x65')]({'where':{'name':_0x2eb993,'userProfileId':_0x1454a7[_0x3164('0x6f')]},'raw':!![]})[_0x3164('0x18')](function(_0x3ffca){if(_0x3ffca&&_0x3ffca[_0x3164('0x70')]===0x0){return db[_0x3164('0x2e')][_0x3164('0x66')]({'name':_0xaf3dca['name'],'resourceId':_0xaf3dca['id'],'type':_0x3ffca[_0x3164('0x30')],'sectionId':_0x3ffca['id']},{})['then'](function(){return _0x16cc59;});}else{return _0x16cc59;}})[_0x3164('0x21')](function(_0x4c1c20){logger[_0x3164('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c1c20);throw _0x4c1c20;});}return _0x16cc59;})['then'](respondWithResult(_0x30300b,0xc9))[_0x3164('0x21')](handleError(_0x30300b,null));};exports['update']=function(_0x55570a,_0x3e481a){var _0x229ea4=null;_0x55570a[_0x3164('0x71')][_0x3164('0x67')][_0x3164('0x3a')](',')['forEach'](_0x1574a1=>{if(_0x1574a1[_0x3164('0x69')]()!==''&&!wildcardUtils[_0x3164('0x6a')](_0x1574a1[_0x3164('0x69')]())){_0x229ea4=new APIBadRequestError('\x22'+_0x1574a1+_0x3164('0x6b'));}});if(_0x229ea4){return handleError(_0x3e481a,null)(_0x229ea4);}if(_0x55570a['body']['id']){delete _0x55570a[_0x3164('0x71')]['id'];}return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x55570a[_0x3164('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x3164('0x4a')}]})[_0x3164('0x18')](handleEntityNotFound(_0x3e481a,null))[_0x3164('0x18')](saveUpdates(_0x55570a[_0x3164('0x71')],null))['then'](respondWithResult(_0x3e481a,null))[_0x3164('0x21')](handleError(_0x3e481a,null));};exports[_0x3164('0x2f')]=function(_0x38d577,_0x59e7ab){return db['ChatWebsite'][_0x3164('0x65')]({'where':{'id':_0x38d577[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x59e7ab,null))[_0x3164('0x18')](removeEntity(_0x59e7ab,null))[_0x3164('0x21')](handleError(_0x59e7ab,null));};exports[_0x3164('0x72')]=function(_0x3c2aed,_0x690bfc){return db[_0x3164('0x5f')]['describe']()[_0x3164('0x18')](respondWithResult(_0x690bfc,null))[_0x3164('0x21')](handleError(_0x690bfc,null));};exports[_0x3164('0x73')]=function(_0x51fdf1,_0x41e32a){if(_0x51fdf1[_0x3164('0x71')]['id']){delete _0x51fdf1[_0x3164('0x71')]['id'];}return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x51fdf1[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x41e32a,null))[_0x3164('0x18')](function(_0x2d72f3){if(_0x2d72f3){_0x51fdf1[_0x3164('0x71')][_0x3164('0x74')]=_0x2d72f3['id'];return db[_0x3164('0x75')]['create'](_0x51fdf1[_0x3164('0x71')]);}})['then'](respondWithResult(_0x41e32a,null))[_0x3164('0x21')](handleError(_0x41e32a,null));};exports[_0x3164('0x76')]=function(_0x5631d6,_0x497e4c){var _0x201461={'raw':![],'where':{}};var _0x37ef42={};var _0xd0f948={'count':0x0,'rows':[]};return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0x5631d6[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x497e4c,null))[_0x3164('0x18')](function(_0xf11399){if(_0xf11399){_0x37ef42[_0x3164('0x47')]=_[_0x3164('0x4f')](db[_0x3164('0x75')][_0x3164('0x4c')]);_0x37ef42['query']=_[_0x3164('0x4f')](_0x5631d6[_0x3164('0x4e')]);_0x37ef42[_0x3164('0x50')]=_['intersection'](_0x37ef42[_0x3164('0x47')],_0x37ef42['query']);_0x201461[_0x3164('0x53')]=_[_0x3164('0x51')](_0x37ef42[_0x3164('0x47')],qs[_0x3164('0x52')](_0x5631d6[_0x3164('0x4e')][_0x3164('0x52')]));_0x201461[_0x3164('0x53')]=_0x201461[_0x3164('0x53')]['length']?_0x201461[_0x3164('0x53')]:_0x37ef42[_0x3164('0x47')];if(!_0x5631d6[_0x3164('0x4e')][_0x3164('0x54')](_0x3164('0x55'))){_0x201461[_0x3164('0x28')]=qs[_0x3164('0x28')](_0x5631d6['query'][_0x3164('0x28')]);_0x201461[_0x3164('0x25')]=qs[_0x3164('0x25')](_0x5631d6['query'][_0x3164('0x25')]);}_0x201461['order']=qs[_0x3164('0x57')](_0x5631d6[_0x3164('0x4e')][_0x3164('0x57')]);_0x201461['where']=qs[_0x3164('0x50')](_[_0x3164('0x78')](_0x5631d6[_0x3164('0x4e')],_0x37ef42[_0x3164('0x50')]));_0x201461[_0x3164('0x58')]['ChatWebsiteId']=_0xf11399['id'];if(_0x5631d6[_0x3164('0x4e')][_0x3164('0x59')]){_0x201461['where']=_[_0x3164('0x5a')](_0x201461[_0x3164('0x58')],{'$or':_[_0x3164('0x4b')](_0x201461[_0x3164('0x53')],function(_0x10e7bb){var _0x7720f0={};_0x7720f0[_0x10e7bb]={'$like':'%'+_0x5631d6['query'][_0x3164('0x59')]+'%'};return _0x7720f0;})});}_0x201461=_['merge']({},_0x201461,_0x5631d6[_0x3164('0x5c')]);return db['Disposition'][_0x3164('0x27')]({'where':_0x201461[_0x3164('0x58')]})[_0x3164('0x18')](function(_0x155174){_0xd0f948['count']=_0x155174;if(_0x5631d6[_0x3164('0x4e')]['includeAll']){_0x201461[_0x3164('0x5e')]=[{'all':!![]}];}return db[_0x3164('0x75')][_0x3164('0x60')](_0x201461);})[_0x3164('0x18')](function(_0x3e74bc){_0xd0f948[_0x3164('0x79')]=_0x3e74bc;return _0xd0f948;});}})[_0x3164('0x18')](respondWithFilteredResult(_0x497e4c,_0x201461))[_0x3164('0x21')](handleError(_0x497e4c,null));};exports[_0x3164('0x7a')]=function(_0x276190,_0x573a98){return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x276190[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x573a98,null))[_0x3164('0x18')](function(_0x130f40){if(_0x130f40){return _0x130f40[_0x3164('0x7a')](_0x276190[_0x3164('0x4e')][_0x3164('0x7b')]);}})['then'](respondWithStatusCode(_0x573a98,null))[_0x3164('0x21')](handleError(_0x573a98,null));};exports['addAnswer']=function(_0x86340a,_0x14174d){if(_0x86340a[_0x3164('0x71')]['id']){delete _0x86340a['body']['id'];}return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x86340a[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x14174d,null))[_0x3164('0x18')](function(_0x4f2a38){if(_0x4f2a38){_0x86340a['body'][_0x3164('0x74')]=_0x4f2a38['id'];return db[_0x3164('0x7c')][_0x3164('0x66')](_0x86340a[_0x3164('0x71')]);}})['then'](respondWithResult(_0x14174d,null))[_0x3164('0x21')](handleError(_0x14174d,null));};exports[_0x3164('0x7d')]=function(_0x1a5f6b,_0x359db8){var _0x7e1687={'raw':![],'where':{}};var _0x4b2ced={};var _0x374972={'count':0x0,'rows':[]};return db[_0x3164('0x5f')]['findOne']({'where':{'id':_0x1a5f6b[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x359db8,null))[_0x3164('0x18')](function(_0x502318){if(_0x502318){_0x4b2ced[_0x3164('0x47')]=_[_0x3164('0x4f')](db['CannedAnswer'][_0x3164('0x4c')]);_0x4b2ced[_0x3164('0x4e')]=_[_0x3164('0x4f')](_0x1a5f6b[_0x3164('0x4e')]);_0x4b2ced['filters']=_[_0x3164('0x51')](_0x4b2ced[_0x3164('0x47')],_0x4b2ced[_0x3164('0x4e')]);_0x7e1687[_0x3164('0x53')]=_[_0x3164('0x51')](_0x4b2ced[_0x3164('0x47')],qs['fields'](_0x1a5f6b[_0x3164('0x4e')][_0x3164('0x52')]));_0x7e1687[_0x3164('0x53')]=_0x7e1687['attributes']['length']?_0x7e1687[_0x3164('0x53')]:_0x4b2ced[_0x3164('0x47')];if(!_0x1a5f6b['query']['hasOwnProperty']('nolimit')){_0x7e1687[_0x3164('0x28')]=qs['limit'](_0x1a5f6b[_0x3164('0x4e')]['limit']);_0x7e1687[_0x3164('0x25')]=qs[_0x3164('0x25')](_0x1a5f6b[_0x3164('0x4e')][_0x3164('0x25')]);}_0x7e1687[_0x3164('0x56')]=qs['sort'](_0x1a5f6b[_0x3164('0x4e')]['sort']);_0x7e1687['where']=qs[_0x3164('0x50')](_[_0x3164('0x78')](_0x1a5f6b[_0x3164('0x4e')],_0x4b2ced[_0x3164('0x50')]));_0x7e1687[_0x3164('0x58')]['ChatWebsiteId']=_0x502318['id'];if(_0x1a5f6b[_0x3164('0x4e')][_0x3164('0x59')]){_0x7e1687[_0x3164('0x58')]=_['merge'](_0x7e1687[_0x3164('0x58')],{'$or':_[_0x3164('0x4b')](_0x7e1687[_0x3164('0x53')],function(_0x7aaef5){var _0x50d06a={};_0x50d06a[_0x7aaef5]={'$like':'%'+_0x1a5f6b[_0x3164('0x4e')][_0x3164('0x59')]+'%'};return _0x50d06a;})});}_0x7e1687=_[_0x3164('0x5a')]({},_0x7e1687,_0x1a5f6b['options']);return db[_0x3164('0x7c')][_0x3164('0x27')]({'where':_0x7e1687[_0x3164('0x58')]})[_0x3164('0x18')](function(_0x26ce45){_0x374972[_0x3164('0x27')]=_0x26ce45;if(_0x1a5f6b[_0x3164('0x4e')][_0x3164('0x5d')]){_0x7e1687[_0x3164('0x5e')]=[{'all':!![]}];}return db[_0x3164('0x7c')][_0x3164('0x60')](_0x7e1687);})['then'](function(_0x53eb25){_0x374972['rows']=_0x53eb25;return _0x374972;});}})[_0x3164('0x18')](respondWithFilteredResult(_0x359db8,_0x7e1687))['catch'](handleError(_0x359db8,null));};exports[_0x3164('0x7e')]=function(_0x462e17,_0x470aa0){return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x462e17[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x470aa0,null))[_0x3164('0x18')](function(_0x1b0407){if(_0x1b0407){return _0x1b0407['removeAnswers'](_0x462e17['query'][_0x3164('0x7b')]);}})[_0x3164('0x18')](respondWithStatusCode(_0x470aa0,null))[_0x3164('0x21')](handleError(_0x470aa0,null));};exports[_0x3164('0x7f')]=function(_0xce8aa2,_0x5505e9){_0xce8aa2[_0x3164('0x71')][_0x3164('0x80')]=_0xce8aa2['file']['filename'];return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0xce8aa2[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x5505e9,null))[_0x3164('0x18')](saveUpdates(_0xce8aa2[_0x3164('0x71')],null))[_0x3164('0x18')](respondWithResult(_0x5505e9,null))[_0x3164('0x21')](handleError(_0x5505e9,null));};exports[_0x3164('0x81')]=function(_0x35d820,_0x5f4427){_0x35d820[_0x3164('0x71')]['agentAvatar']=_0x35d820[_0x3164('0x82')][_0x3164('0x83')];return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x35d820['params']['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x5f4427,null))[_0x3164('0x18')](saveUpdates(_0x35d820['body'],null))[_0x3164('0x18')](respondWithResult(_0x5f4427,null))['catch'](handleError(_0x5f4427,null));};exports[_0x3164('0x84')]=function(_0x3a101e,_0x46ce56){_0x3a101e[_0x3164('0x71')][_0x3164('0x85')]=_0x3a101e[_0x3164('0x82')]['filename'];return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x3a101e[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x46ce56,null))[_0x3164('0x18')](saveUpdates(_0x3a101e['body'],null))[_0x3164('0x18')](respondWithResult(_0x46ce56,null))[_0x3164('0x21')](handleError(_0x46ce56,null));};exports[_0x3164('0x86')]=function(_0x15b12c,_0x481ee0){_0x15b12c[_0x3164('0x71')]['systemAvatar']=_0x15b12c[_0x3164('0x82')][_0x3164('0x83')];return db['ChatWebsite'][_0x3164('0x65')]({'where':{'id':_0x15b12c[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x481ee0,null))[_0x3164('0x18')](saveUpdates(_0x15b12c[_0x3164('0x71')],null))[_0x3164('0x18')](respondWithResult(_0x481ee0,null))[_0x3164('0x21')](handleError(_0x481ee0,null));};exports[_0x3164('0x87')]=function(_0x58ff76,_0x3c58f4){var _0x363b75=path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0x8a'));var _0x181ec2={'where':{'id':_0x58ff76[_0x3164('0x62')]['id']},'attributes':['id',_0x3164('0x80')],'raw':!![]};var _0x13e406=![];return require(_0x3164('0x8b'))[_0x3164('0x8c')]()[_0x3164('0x18')](function(_0x80b8cf){if(_0x80b8cf){_0x13e406=_0x80b8cf[_0x3164('0x8d')];}})[_0x3164('0x18')](function(){return db[_0x3164('0x5f')]['find'](_0x181ec2);})[_0x3164('0x18')](handleEntityNotFound(_0x3c58f4,null))[_0x3164('0x18')](function(_0x43ac59){if(_0x43ac59){if(!_[_0x3164('0x8e')](_0x43ac59[_0x3164('0x80')])){if(fs[_0x3164('0x8f')](path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0x90'),_0x43ac59[_0x3164('0x80')]))&&_0x13e406){_0x363b75=path['join'](config[_0x3164('0x89')],_0x3164('0x90'),_0x43ac59[_0x3164('0x80')]);}}return _0x3c58f4['download'](_0x363b75);}})[_0x3164('0x21')](handleError(_0x3c58f4,null));};exports[_0x3164('0x91')]=function(_0x30fa51,_0x5127d3){var _0xbe293b=path['join'](config[_0x3164('0x89')],'server/files/images/avatars/default_avatar.png');var _0x4d6669={'where':{'id':_0x30fa51['params']['id']},'attributes':['id',_0x3164('0x92')],'raw':!![]};return db[_0x3164('0x5f')][_0x3164('0x65')](_0x4d6669)[_0x3164('0x18')](handleEntityNotFound(_0x5127d3,null))['then'](function(_0x19b487){if(_0x19b487){if(!_['isNil'](_0x19b487[_0x3164('0x92')])){if(fs[_0x3164('0x8f')](path['join'](config[_0x3164('0x89')],_0x3164('0x93'),_0x19b487[_0x3164('0x92')]))){_0xbe293b=path[_0x3164('0x88')](config['root'],_0x3164('0x93'),_0x19b487['agentAvatar']);}}return _0x5127d3[_0x3164('0x94')](_0xbe293b);}})[_0x3164('0x21')](handleError(_0x5127d3,null));};exports['getCustomerAvatar']=function(_0xdaf975,_0x2f1b54){var _0x3c7810=path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0x95'));var _0x290468={'where':{'id':_0xdaf975[_0x3164('0x62')]['id']},'attributes':['id','customerAvatar',_0x3164('0x96')],'raw':!![]};return db[_0x3164('0x5f')][_0x3164('0x65')](_0x290468)[_0x3164('0x18')](handleEntityNotFound(_0x2f1b54,null))['then'](function(_0x7cfcea){if(_0x7cfcea){if(!_['isNil'](_0x7cfcea[_0x3164('0x85')])){if(fs[_0x3164('0x8f')](path['join'](config[_0x3164('0x89')],_0x3164('0x93'),_0x7cfcea[_0x3164('0x85')]))&&_0x7cfcea[_0x3164('0x96')]){_0x3c7810=path['join'](config['root'],'server/files/images/avatars/',_0x7cfcea[_0x3164('0x85')]);}}return _0x2f1b54[_0x3164('0x94')](_0x3c7810);}})['catch'](handleError(_0x2f1b54,null));};exports[_0x3164('0x97')]=function(_0x366865,_0xef7e06){var _0x74db2f=path['join'](config['root'],_0x3164('0x98'));var _0x5356d2={'where':{'id':_0x366865[_0x3164('0x62')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x3164('0x5f')][_0x3164('0x65')](_0x5356d2)[_0x3164('0x18')](handleEntityNotFound(_0xef7e06,null))[_0x3164('0x18')](function(_0x408f77){if(_0x408f77){if(!_['isNil'](_0x408f77[_0x3164('0x99')])){if(fs[_0x3164('0x8f')](path[_0x3164('0x88')](config['root'],_0x3164('0x93'),_0x408f77['systemAvatar']))){_0x74db2f=path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0x93'),_0x408f77[_0x3164('0x99')]);}}return _0xef7e06[_0x3164('0x94')](_0x74db2f);}})['catch'](handleError(_0xef7e06,null));};function checkWebsiteInterval(_0x28ac5e){var _0x4a2a73=_0x28ac5e['Interval'];if(!_0x4a2a73){return Promise[_0x3164('0x9a')](_0x28ac5e);}var _0x3b0bb7=_0x28ac5e[_0x3164('0x9b')]||undefined;return _0x4a2a73['ifTime'](_0x3b0bb7)[_0x3164('0x18')](function(_0x5bfcfd){if(!_0x5bfcfd){throw new APIOutOfIntervalError();}return _0x28ac5e;});}exports['notify']=function(_0xb4538a,_0x2524bb){var _0x466d38={'body':_0xb4538a['body'],'channel':_0x3164('0x9c')};var _0x5cfbdb=[];var _0x37b038=[];var _0xbf746b={};var _0x4604b3=![];if(_0xb4538a[_0x3164('0x71')]['id']){delete _0xb4538a['body']['id'];}if(_[_0x3164('0x8e')](_0xb4538a['body'][_0x3164('0x9d')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x3164('0x8e')](_0xb4538a[_0x3164('0x71')]['mapKey'])){throw new APIBadRequestError(_0x3164('0x9e'));}if(_['isEmpty'](_0xb4538a[_0x3164('0x71')][_0x3164('0x71')])){throw new APIBadRequestError(_0x3164('0x9f'));}var _0x291ae6=_0xb4538a[_0x3164('0x71')][_0x3164('0x36')]&&_0xb4538a['body'][_0x3164('0x3e')];return db[_0x3164('0xa0')][_0x3164('0x72')]()[_0x3164('0x18')](function(_0x14a406){if(!_0x14a406){throw new Error(_0x3164('0xa1'));}_0x5cfbdb=Object[_0x3164('0x4f')](_0x14a406)[_0x3164('0x59')](function(_0xfea2bc){return!['createdAt',_0x3164('0xa2')][_0x3164('0xa3')](_0xfea2bc);});_0x37b038=Object[_0x3164('0x4f')](_0x14a406)[_0x3164('0x59')](function(_0x45b0de){return!['createdAt',_0x3164('0xa2'),'CompanyId',_0x3164('0xa4')]['includes'](_0x45b0de);});if(!_[_0x3164('0xa3')](_0x37b038,_0xb4538a[_0x3164('0x71')][_0x3164('0xa5')])){throw new APIBadRequestError(_0x3164('0xa6')+_0x37b038['join'](',\x20'));}_0xbf746b[_0xb4538a[_0x3164('0x71')]['mapKey']]=_0xb4538a[_0x3164('0x71')][_0x3164('0x9d')];})[_0x3164('0x18')](function(){return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0xb4538a[_0x3164('0x62')]['id']},'include':[{'model':db[_0x3164('0xa7')],'as':_0x3164('0xa8'),'include':[{'model':db[_0x3164('0xa0')],'as':_0x3164('0xa9'),'where':_0xbf746b,'limit':0x1,'order':[['updatedAt',_0x3164('0xaa')]]}]},{'model':db[_0x3164('0xab')],'as':'Applications'},{'model':db[_0x3164('0xac')],'as':'Interval','include':[{'model':db[_0x3164('0xac')],'as':_0x3164('0xad'),'attributes':['id',_0x3164('0xae')],'raw':!![]}]}]});})['then'](function(_0x59f5c1){if(!_0x59f5c1){throw new APINotFoundError(util[_0x3164('0x40')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0xb4538a[_0x3164('0x62')]['id']));}if(_0x291ae6){return checkWebsiteInterval(_0x59f5c1);}return _0x59f5c1;})['then'](function(_0x5353cb){_0x466d38[_0x3164('0xaf')]=_0x5353cb;_0x466d38[_0x3164('0xb0')]=_[_0x3164('0xb1')](_0x5353cb[_0x3164('0xb2')],[_0x3164('0xb3')],[_0x3164('0xb4')]);if(_0x466d38[_0x3164('0xaf')][_0x3164('0xb2')]){delete _0x466d38[_0x3164('0xaf')][_0x3164('0xb2')];}_0x466d38[_0x3164('0xb5')]=_0x5353cb[_0x3164('0xa8')]||{'id':_0x5353cb[_0x3164('0xa4')]};if(_0x466d38[_0x3164('0xb5')]&&_0x466d38['list'][_0x3164('0xa9')][_0x3164('0x64')]){return _0x466d38['list'][_0x3164('0xa9')][0x0];}var _0x493e1c=_[_0x3164('0xf')](_0xb4538a[_0x3164('0x71')],{'firstName':_0xb4538a[_0x3164('0x71')][_0x3164('0x9d')],'ListId':_0x5353cb['ListId']});_0x493e1c[_0xb4538a['body'][_0x3164('0xa5')]]=_0xb4538a[_0x3164('0x71')][_0x3164('0x9d')];return db[_0x3164('0xa0')][_0x3164('0x66')](_0x493e1c,{'fields':_0x5cfbdb,'raw':!![]});})[_0x3164('0x18')](function(_0x200c8d){_0x466d38[_0x3164('0xb6')]=_0x200c8d;var _0x4fc861=createInteractionObject(_0xb4538a['params']['id'],_0xb4538a[_0x3164('0x71')],_0xb4538a[_0x3164('0xb7')],_0x200c8d);var _0x215a27={'ChatWebsiteId':_0xb4538a[_0x3164('0x62')]['id']};if(_0xb4538a[_0x3164('0x71')][_0x3164('0xb8')]){_0x215a27[_0x3164('0xb8')]=_0xb4538a[_0x3164('0x71')][_0x3164('0xb8')];_0x215a27[_0x3164('0xb9')]=![];return db[_0x3164('0xba')][_0x3164('0x65')]({'where':_0x215a27})[_0x3164('0x18')](function(_0x44c1df){var _0xcb4abd=_0xb4538a[_0x3164('0x71')][_0x3164('0x36')]&&_0xb4538a[_0x3164('0x71')][_0x3164('0x3e')];if(_0x44c1df){_0x4604b3=!![];return _0x44c1df;}else if(!_0xcb4abd&&_0x44c1df&&_0x44c1df[_0x3164('0xb9')]){throw new APIConflictError(_0x3164('0xbb'));}_0x4fc861[_0x3164('0xb8')]=_0xb4538a[_0x3164('0x71')][_0x3164('0xb8')];_0x4fc861[_0x3164('0xbc')]=_0xb4538a[_0x3164('0x71')][_0x3164('0xbc')];return db[_0x3164('0xba')][_0x3164('0x66')](_0x4fc861);});}_0x215a27[_0x3164('0xbd')]=_0x200c8d['id'];if(_0xb4538a['body'][_0x3164('0xbe')]&&_0xb4538a[_0x3164('0x71')][_0x3164('0xbe')]['id']){_0x215a27['id']=_0xb4538a['body']['interaction']['id'];return db[_0x3164('0xba')][_0x3164('0x65')]({'where':_0x215a27})[_0x3164('0x18')](function(_0x4c1d2f){var _0x1c1c40=_0xb4538a['body'][_0x3164('0x36')]&&_0xb4538a['body']['referer'];if(!_0x1c1c40&&_0x4c1d2f&&_0x4c1d2f[_0x3164('0xb9')]){throw new APIConflictError(_0x3164('0xbb'));}else if(_0x4c1d2f){_0x4604b3=!![];return _0x4c1d2f;}else{return db[_0x3164('0xba')]['create'](_0x4fc861);}});}return db[_0x3164('0xba')][_0x3164('0x66')](_0x4fc861);})[_0x3164('0x18')](function(_0x3c1f48){if(!_0x4604b3){return _0x3c1f48;}var _0x282788={'from':(_0x466d38['contact'][_0x3164('0x3b')]||'')+'\x20'+(_0x466d38[_0x3164('0xb6')][_0x3164('0x3c')]||'')};if(_0xb4538a['body'][_0x3164('0xb8')]&&_0xb4538a[_0x3164('0x71')]['messageId']&&_0xb4538a[_0x3164('0x71')][_0x3164('0xb8')]!=_0xb4538a[_0x3164('0x71')][_0x3164('0xbf')]){_0x282788[_0x3164('0xb8')]=_0xb4538a['body'][_0x3164('0xbf')];}return _0x3c1f48[_0x3164('0x2b')](_0x282788);})[_0x3164('0x18')](function(_0x434b80){_0x466d38[_0x3164('0xbe')]=_0x434b80[_0x3164('0x2c')]({'plain':!![]});_0x466d38[_0x3164('0xbe')][_0x3164('0xc0')]=!_0x4604b3;if(_0x466d38[_0x3164('0xbe')][_0x3164('0xc0')]){if(_0x466d38['account']['autoclose']){_0x466d38[_0x3164('0xb0')][_0x3164('0xc1')]({'id':0x0,'priority':_0x466d38['applications'][_0x3164('0x64')]+0x1,'app':'close','appdata':_0x3164('0xc2'),'interval':_0x3164('0xc3')});}}return db[_0x3164('0xc4')]['create']({'body':_0xb4538a[_0x3164('0x71')][_0x3164('0x71')],'ChatWebsiteId':_0xb4538a[_0x3164('0x62')]['id'],'ChatInteractionId':_0x434b80['id'],'direction':'in','ContactId':_0x466d38[_0x3164('0xb6')]['id'],'AttachmentId':_0xb4538a['body'][_0x3164('0xc5')]});})['then'](function(_0x54804d){_0x466d38['message']=_0x54804d;if(!_0x466d38['interaction'][_0x3164('0xc6')]){return;}return db[_0x3164('0xc7')][_0x3164('0x65')]({'attributes':['id','name'],'where':{'id':_0x466d38[_0x3164('0xbe')][_0x3164('0xc6')]}});})['then'](function(_0x554cc6){if(_0x554cc6){_0x466d38[_0x3164('0xb0')][_0x3164('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x554cc6['name']+','+(_0x466d38[_0x3164('0xaf')][_0x3164('0xc9')]||0xa),'interval':'*,*,*,*'});_0x466d38[_0x3164('0xca')]=!![];}if(!_0x466d38[_0x3164('0xbe')]['queueId']){return;}return db[_0x3164('0xcb')]['find']({'attributes':['id',_0x3164('0x30')],'where':{'id':_0x466d38['interaction']['queueId']}});})[_0x3164('0x18')](function(_0x598a6b){if(_0x598a6b){_0x466d38['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x3164('0xcc'),'appdata':_0x598a6b[_0x3164('0x30')]+','+(_0x466d38['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x466d38);})['then'](function(_0xf01b68){respondWithRpcPromise(_0x3164('0xcd'),_0x3164('0xcd'),{'event':_0x3164('0xce'),'message':_0xf01b68},client9002);return _0xf01b68;})['then'](respondWithResult(_0x2524bb,null))[_0x3164('0x21')](APIHandleError(_0x2524bb));};exports[_0x3164('0xcf')]=function(_0x48841c,_0x53f735){var _0x55f5e5,_0x1b30bc,_0x52ec1f;var _0x1a61a1=[];var _0x5cae3d={};var _0x2e2944=_0x48841c[_0x3164('0xd0')]||[];var _0x5f13b9=[];var _0x3ec636;return db[_0x3164('0xa0')][_0x3164('0x72')]()[_0x3164('0x18')](function(_0x599bcc){if(!_0x599bcc){throw new db['Sequelize'][(_0x3164('0xd1'))](_0x3164('0xd2'));}_0x1a61a1=_[_0x3164('0xd3')](_['keys'](_0x599bcc),[_0x3164('0xd4'),_0x3164('0xa2'),_0x3164('0xd5'),_0x3164('0xa4')]);if(_0x48841c['body']['id']){delete _0x48841c[_0x3164('0x71')]['id'];}if(_['isNil'](_0x48841c[_0x3164('0x71')][_0x3164('0x9d')])){throw _0x53f735[_0x3164('0x23')](0x1f4)['send'](new db['Sequelize'][(_0x3164('0xd1'))](_0x3164('0xd6')));}if(_[_0x3164('0x8e')](_0x48841c[_0x3164('0x71')][_0x3164('0x71')])||_0x48841c[_0x3164('0x71')][_0x3164('0x71')]===''){throw _0x53f735['status'](0x1f4)['send'](new db[(_0x3164('0xd7'))][(_0x3164('0xd1'))](_0x3164('0xd8')));}if(_['isNil'](_0x48841c[_0x3164('0x71')]['mapKeyOffline'])){throw _0x53f735[_0x3164('0x23')](0x1f4)[_0x3164('0x31')](new db['Sequelize'][(_0x3164('0xd1'))](_0x3164('0xd9')+_0x1a61a1));}if(!_[_0x3164('0xa3')](_0x1a61a1,_0x48841c[_0x3164('0x71')]['mapKeyOffline'])){throw _0x53f735[_0x3164('0x23')](0x1f4)[_0x3164('0x31')](new db['Sequelize'][(_0x3164('0xd1'))](_0x3164('0xda')+_0x1a61a1));}_0x5cae3d[_0x48841c[_0x3164('0x71')][_0x3164('0xdb')]]=_0x48841c[_0x3164('0x71')][_0x3164('0x9d')];})[_0x3164('0x18')](function(){return db[_0x3164('0x5f')]['find']({'where':{'id':_0x48841c['params']['id']},'include':[{'model':db[_0x3164('0xa7')],'as':'List'},{'model':db[_0x3164('0xdc')],'as':'MailAccount'}]});})[_0x3164('0x18')](handleEntityNotFound(_0x53f735,null))['then'](function(_0x3d6966){if(_0x3d6966&&_0x3d6966[_0x3164('0xa8')]){_0x1b30bc=_0x3d6966;var _0x37d3c2=_[_0x3164('0xf')](_0x48841c['body'],{'firstName':_0x48841c['body'][_0x3164('0x9d')],'phone':_0x48841c['body'][_0x3164('0x9d')],'ListId':_0x3d6966[_0x3164('0xa4')]});_0x37d3c2[_0x48841c[_0x3164('0x71')]['mapKeyOffline']]=_0x48841c['body'][_0x3164('0x9d')];return db[_0x3164('0xa0')][_0x3164('0xdd')]({'where':_0x5cae3d,'defaults':_0x37d3c2});}})[_0x3164('0xde')](function(_0x1e269f){if(_0x1e269f){_0x52ec1f=_0x1e269f;var _0x212de4=fs['readFileSync'](path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0xdf')),'utf8');var _0x1a17ad=ejs[_0x3164('0xe0')](_0x212de4,{'body':_[_0x3164('0xe1')](_0x48841c['body'][_0x3164('0x71')]),'bodyTitle':_0x1b30bc[_0x3164('0xe2')]});return db[_0x3164('0xe3')][_0x3164('0x66')]({'body':_0x1a17ad,'plainBody':htmlToText[_0x3164('0xe4')](_0x1a17ad),'ContactId':_0x1e269f['id'],'ChatWebsiteId':_0x1b30bc['id']});}})[_0x3164('0x18')](function(_0x198e0c){_0x3ec636=_0x198e0c;if(_0x2e2944[_0x3164('0x64')]){var _0x1efb70=_0x2e2944[_0x3164('0x4b')](function(_0x2e3a32){return{'name':_0x2e3a32[_0x3164('0xe5')],'basename':_0x2e3a32[_0x3164('0x83')],'type':_0x2e3a32[_0x3164('0xe6')],'ChatOfflineMessageId':_0x198e0c['id']};});_0x5f13b9=_0x1efb70[_0x3164('0x4b')](_0x1feeb2=>{var _0x2dfd4d={'filename':_0x1feeb2[_0x3164('0x30')],'path':path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0xe7'),_0x3164('0xd0'),_0x3164('0xe8'),'offline-chat',_0x1feeb2[_0x3164('0xe9')])};return _0x2dfd4d;});if(!_0x1b30bc[_0x3164('0xea')]){return db[_0x3164('0xeb')][_0x3164('0xec')](function(_0x2fafff){return db[_0x3164('0xed')][_0x3164('0xee')](_0x1efb70,{'transaction':_0x2fafff});});}}})[_0x3164('0x18')](function(){if(_0x3ec636){_0x55f5e5=_0x3ec636;return db['MailAccount'][_0x3164('0x77')]({'where':{'service':!![]},'include':[{'model':db[_0x3164('0xef')],'as':_0x3164('0xf0'),'raw':!![],'include':[{'model':db[_0x3164('0xf1')],'as':_0x3164('0xf1'),'raw':!![]}]}]});}})[_0x3164('0x18')](function(_0x343d05){if(_0x343d05&&_0x343d05[_0x3164('0xf0')]&&_0x1b30bc[_0x3164('0xf2')]&&_0x1b30bc['forwardOfflineAddress']){var _0x2197cc=_0x343d05['getSmtpOptions']();return respondWithRpcPromise(_0x3164('0xf3'),'sendMail',{'account':_0x2197cc,'message':{'from':util[_0x3164('0x40')](_0x3164('0xf4'),_0x343d05[_0x3164('0x30')],_0x343d05['email']||_0x343d05[_0x3164('0xf0')]['user']),'to':_0x1b30bc[_0x3164('0xf5')],'subject':_0x1b30bc['offlineMessageSubject'],'html':_0x55f5e5['body'],'attachments':_0x5f13b9}},client9003)[_0x3164('0x18')](function(){return _0x55f5e5;})[_0x3164('0x21')](function(_0x11110a){logger[_0x3164('0x1e')](_0x11110a);});}})[_0x3164('0x18')](function(){if(_0x1b30bc&&_0x1b30bc[_0x3164('0xea')]&&_0x1b30bc[_0x3164('0xf6')]){var _0x5ad3a0=[];if(_0x2e2944['length']){_0x5ad3a0=_0x2e2944['map'](function(_0x148d51){return{'name':_0x148d51[_0x3164('0xe5')],'basename':_0x148d51['filename'],'type':_0x148d51['mimetype'],'ChatOfflineMessageId':_0x3ec636['id']};});}var _0x255ce4;if(!_[_0x3164('0x8e')](_0x1b30bc[_0x3164('0xf7')])){var _0x2e95a4=_[_0x3164('0x4b')](_0x48841c[_0x3164('0x71')],function(_0x3da269){return _0x3da269;});var _0x29ee17=_[_0x3164('0xf8')](_0x2e95a4)[0x0];var _0x44586d=_[_0x3164('0xf9')](_0x29ee17,function(_0x5e14f2){return _0x5e14f2;});_0x255ce4=_0x44586d[0x1][_0x1b30bc[_0x3164('0xf7')]];}var _0x22166f={'from':_0x52ec1f[_0x3164('0xfa')],'firstName':_0x52ec1f[_0x3164('0x3b')],'lastName':_0x52ec1f[_0x3164('0x3c')],'mapKey':_0x3164('0xfa'),'message':{'from':_0x52ec1f[_0x3164('0xfa')],'to':_0x1b30bc['MailAccount'][_0x3164('0xfa')],'cc':'','subject':_[_0x3164('0x8e')](_0x255ce4)?_0x1b30bc[_0x3164('0xfb')]:_0x255ce4,'messageId':'','sentAt':new Date(),'attach':_0x5ad3a0['length'],'attachments':_0x5ad3a0,'originChannel':_0x3164('0xfc'),'ChatWebsiteId':_0x1b30bc['id'],'ChatOfflineMessageId':_0x55f5e5['id'],'originTo':_0x1b30bc[_0x3164('0xdc')][_0x3164('0xfa')]},'body':_0x55f5e5[_0x3164('0x71')]};var _0x18fc9a={'account':{'id':_0x1b30bc['MailAccountId']},'body':_0x22166f,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x3164('0xfd'),_0x3164('0xfe'),_0x18fc9a,client9001)[_0x3164('0x18')](function(){return _0x55f5e5;})[_0x3164('0x21')](function(_0x2e0e5a){logger[_0x3164('0x1e')](_0x2e0e5a);});}return;})[_0x3164('0x18')](function(){if(_0x55f5e5){return _0x55f5e5;}})['then'](respondWithResult(_0x53f735,null))[_0x3164('0x21')](function(){for(var _0x7472d7 of _0x2e2944){var _0x11330b=path[_0x3164('0x88')](config['root'],_0x3164('0xe7'),_0x3164('0xd0'),_0x3164('0xe8'),_0x3164('0xff'),_0x7472d7[_0x3164('0x83')]);fs_extra[_0x3164('0x100')](_0x11330b)[_0x3164('0x21')](function(_0x2ca032){logger['error'](_0x3164('0x101'),_0x11330b,_0x2ca032);});}});};exports[_0x3164('0x102')]=function(_0x454d25,_0x39f7b8){return db[_0x3164('0xba')][_0x3164('0x65')]({'where':{'id':_0x454d25['params']['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x39f7b8,null))['then'](function(_0xb8e75a){if(_0xb8e75a){return _0xb8e75a['addInteraction'](_0x454d25['body'][_0x3164('0x7b')],_[_0x3164('0x103')](_0x454d25['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x39f7b8,null))[_0x3164('0x21')](handleError(_0x39f7b8,null));};exports[_0x3164('0x104')]=function(_0xfa4df4,_0x58ff34){var _0x177ccc={'raw':![],'where':{}};var _0x4ad9cd={};var _0x5e1274={'count':0x0,'rows':[]};return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0xfa4df4['params']['id']}})['then'](handleEntityNotFound(_0x58ff34,null))['then'](function(_0x104b55){if(_0x104b55){_0x4ad9cd[_0x3164('0x47')]=_[_0x3164('0x4f')](db[_0x3164('0xba')]['rawAttributes']);_0x4ad9cd[_0x3164('0x4e')]=_['keys'](_0xfa4df4['query']);_0x4ad9cd[_0x3164('0x50')]=_[_0x3164('0x51')](_0x4ad9cd[_0x3164('0x47')],_0x4ad9cd[_0x3164('0x4e')]);_0x177ccc[_0x3164('0x53')]=_[_0x3164('0x51')](_0x4ad9cd['model'],qs[_0x3164('0x52')](_0xfa4df4[_0x3164('0x4e')][_0x3164('0x52')]));_0x177ccc[_0x3164('0x53')]=_0x177ccc['attributes'][_0x3164('0x64')]?_0x177ccc[_0x3164('0x53')]:_0x4ad9cd[_0x3164('0x47')];if(!_0xfa4df4[_0x3164('0x4e')][_0x3164('0x54')](_0x3164('0x55'))){_0x177ccc['limit']=qs[_0x3164('0x28')](_0xfa4df4[_0x3164('0x4e')][_0x3164('0x28')]);_0x177ccc[_0x3164('0x25')]=qs[_0x3164('0x25')](_0xfa4df4[_0x3164('0x4e')]['offset']);}_0x177ccc['order']=qs[_0x3164('0x57')](_0xfa4df4[_0x3164('0x4e')][_0x3164('0x57')]);_0x177ccc['where']=qs['filters'](_[_0x3164('0x78')](_0xfa4df4[_0x3164('0x4e')],_0x4ad9cd[_0x3164('0x50')]));_0x177ccc[_0x3164('0x58')]['ChatWebsiteId']=_0x104b55['id'];if(_0xfa4df4[_0x3164('0x4e')][_0x3164('0x59')]){_0x177ccc['where']=_[_0x3164('0x5a')](_0x177ccc[_0x3164('0x58')],{'$or':_['map'](_0x177ccc[_0x3164('0x53')],function(_0x30cf64){var _0x50396f={};_0x50396f[_0x30cf64]={'$like':'%'+_0xfa4df4[_0x3164('0x4e')][_0x3164('0x59')]+'%'};return _0x50396f;})});}_0x177ccc=_['merge']({},_0x177ccc,_0xfa4df4[_0x3164('0x5c')]);return db[_0x3164('0xba')][_0x3164('0x27')]({'where':_0x177ccc[_0x3164('0x58')]})[_0x3164('0x18')](function(_0xecfb43){_0x5e1274[_0x3164('0x27')]=_0xecfb43;if(_0xfa4df4[_0x3164('0x4e')][_0x3164('0x5d')]){_0x177ccc['include']=[{'model':db[_0x3164('0xa0')],'as':_0x3164('0x105'),'required':![]},{'model':db[_0x3164('0xc7')],'as':_0x3164('0x106'),'attributes':[_0x3164('0x30'),_0x3164('0x107'),'internal'],'required':![]},{'model':db[_0x3164('0x108')],'as':'Tags','attributes':['id',_0x3164('0x30'),'color'],'where':_0xfa4df4['query'][_0x3164('0x109')]?{'id':_0xfa4df4['query'][_0x3164('0x109')]}:undefined,'required':_0xfa4df4['query']['tag']?!![]:![]}];}return db[_0x3164('0xba')][_0x3164('0x60')](_0x177ccc);})[_0x3164('0x18')](function(_0x4727de){_0x5e1274['rows']=_0x4727de;return _0x5e1274;});}})[_0x3164('0x18')](respondWithFilteredResult(_0x58ff34,_0x177ccc))[_0x3164('0x21')](handleError(_0x58ff34,null));};exports[_0x3164('0x10a')]=function(_0x42df5b,_0xa8eb5c){var _0x47db74=0x0;var _0x42b6f6=0x0;var _0x171afd=![];var _0x288ddd;var _0x498034;return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x42df5b[_0x3164('0x62')]['id']},'include':[{'model':db[_0x3164('0xac')],'as':'Interval','include':[{'model':db[_0x3164('0xac')],'as':_0x3164('0xad'),'attributes':['id',_0x3164('0xae')]}]}]})['then'](handleEntityNotFound(_0xa8eb5c,null))[_0x3164('0x18')](function(_0x3be1f8){if(_0x3be1f8){_0x288ddd=_0x3be1f8;return _0x3be1f8[_0x3164('0x10b')]({'raw':!![]});}})['then'](function(_0x3b44d2){if(_0x288ddd){if(_0x3b44d2){_0x498034=_0x3b44d2;}}return require(_0x3164('0x8b'))['getLicense']();})[_0x3164('0x18')](function(_0x4ef319){if(_0x4ef319){_0x42b6f6=_0x4ef319[_0x3164('0x10c')];_0x171afd=_0x4ef319[_0x3164('0x8d')];}})[_0x3164('0x18')](function(){return db[_0x3164('0xba')][_0x3164('0x27')]({'where':{'closed':![]}});})[_0x3164('0x18')](function(_0x4ec648){_0x47db74=_0x4ec648;if(_0x42b6f6&&_0x4ec648>_0x42b6f6){return db['License']['findOne']({'where':{'id':0x1}})[_0x3164('0x18')](function(_0x4ddda3){if(_0x4ddda3){_0x4ddda3[_0x3164('0x10d')]('chatLicenseExceeded');}});}})[_0x3164('0x18')](function(){var _0x964039=_0x288ddd[_0x3164('0xac')];var _0x3617c5=_0x288ddd['timezone']||undefined;return _0x964039?_0x964039['ifTime'](_0x3617c5):!![];})[_0x3164('0x18')](function(_0x38c4df){var _0x5a3dc3=fs[_0x3164('0x10e')](path[_0x3164('0x88')](config[_0x3164('0x89')],_0x3164('0x10f')),_0x3164('0x110'));var _0x43095b=_0x3164('0x111');var _0x3eca98=![];var _0x5ecb1e,_0x49e9f1;if(_0x42df5b['headers'][_0x3164('0x3e')]){_0x5ecb1e=new URL(_0x42df5b['headers'][_0x3164('0x3e')])['origin'];}else if(_0x42df5b['headers'][_0x3164('0x112')]){_0x5ecb1e=new URL(_0x42df5b[_0x3164('0xb7')][_0x3164('0x112')])[_0x3164('0x112')];}else{_0x5ecb1e='http://localhost:9000';}_0x49e9f1=typeof _0x288ddd[_0x3164('0x67')][_0x3164('0x3a')](',')[_0x3164('0x65')](function(_0x5deddd){return wildcardUtils[_0x3164('0x113')](_0x5deddd,_0x5ecb1e);})!=='undefined';var _0x1ebaf5={'chatVersion':_0x43095b,'chatWebsiteAddressOrigin':_0x49e9f1?_0x42df5b[_0x3164('0xb7')]['referer']:_0x288ddd[_0x3164('0x67')],'remote':_0x288ddd[_0x3164('0x114')],'query':querystring[_0x3164('0x1d')](_[_0x3164('0x5a')](_0x288ddd[_0x3164('0x2c')]({'plain':!![]}),{'customerIp':_0x42df5b['headers'][_0x3164('0x38')]||_0x42df5b[_0x3164('0xb7')][_0x3164('0x115')]||_0x42df5b[_0x3164('0x116')][_0x3164('0x117')]||_0x42df5b['ip'],'referer':_0x42df5b['headers'][_0x3164('0x3e')],'openedInteractions':_0x47db74,'maxInteractions':_0x42b6f6,'virtual':_0x171afd[_0x3164('0x10c')],'online':_0x38c4df,'custom':_0x171afd,'address':_0x49e9f1?_0x42df5b['headers'][_0x3164('0x3e')]:null}))[_0x3164('0x118')](/'/g,'\x5c\x27')};_0xa8eb5c['send'](ejs['render'](Mustache[_0x3164('0xe0')](_0x5a3dc3,_0x1ebaf5),{'proactiveActions':_0x498034,'alignment':_0x288ddd[_0x3164('0x119')],'verticalAlignment':_0x288ddd['verticalAlignment'],'div_color':_0x288ddd[_0x3164('0x11a')],'labelText':_0x288ddd[_0x3164('0x11b')],'text_color':_0x288ddd[_0x3164('0x11c')],'text_button_color':_0x288ddd[_0x3164('0x11d')],'button_color':_0x288ddd[_0x3164('0x11e')],'background_color':_0x288ddd[_0x3164('0x11f')],'hideWhenOffline':_0x288ddd[_0x3164('0x120')],'intervalId':_0x288ddd['IntervalId'],'isDevelopment':_0x3eca98,'chatVersion':_0x43095b}));})[_0x3164('0x21')](handleError(_0xa8eb5c,null));};exports[_0x3164('0x121')]=function(_0x58523c,_0x3bd7ab){var _0x228c24=_0x58523c['params']['id'];var _0x743161=_0x58523c[_0x3164('0x71')];var _0x1260f4=0xc8;var _0x4b27be=null;return db[_0x3164('0xeb')]['transaction']({'isolationLevel':db[_0x3164('0xeb')][_0x3164('0x122')][_0x3164('0x123')]['READ_COMMITTED']},function(_0x5ccd08){return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0x228c24},'transaction':_0x5ccd08})[_0x3164('0x18')](function(_0x200a76){if(_0x200a76){return db[_0x3164('0xab')]['destroy']({'where':{'ChatWebsiteId':_0x228c24},'transaction':_0x5ccd08})[_0x3164('0x18')](function(){var _0xd7eb26=_[_0x3164('0x4b')](_0x743161,function(_0x21ff65){_0x21ff65[_0x3164('0x74')]=_0x228c24;return _0x21ff65;});return db[_0x3164('0xab')][_0x3164('0xee')](_0xd7eb26,{'transaction':_0x5ccd08});});}else{_0x1260f4=0x194;_0x4b27be=[];}});})[_0x3164('0x18')](function(){if(_0x1260f4!==0x194){return db[_0x3164('0xab')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x228c24},'order':_0x3164('0xb3')})[_0x3164('0x18')](function(_0x4e89f0){_0x4b27be=_0x4e89f0;});}})[_0x3164('0x21')](function(_0x48e49e){_0x1260f4=0x1f4;logger[_0x3164('0x1e')](_0x48e49e[_0x3164('0x124')]);if(_0x48e49e[_0x3164('0x30')]){delete _0x48e49e['name'];}_0x4b27be=_0x48e49e;})[_0x3164('0x125')](function(){if(_0x4b27be===null){_0x3bd7ab['sendStatus'](_0x1260f4);}else{if(_0x1260f4===0x1f4){_0x3bd7ab[_0x3164('0x23')](_0x1260f4)['send'](_0x4b27be);}else{_0x3bd7ab[_0x3164('0x23')](_0x1260f4)[_0x3164('0x2a')](_0x4b27be);}}});};exports[_0x3164('0x126')]=function(_0x346988,_0x1e3b39){var _0x233e5a={};var _0x2f88eb={};var _0x2e8ad0;var _0x3c0350;return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0x346988[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x1e3b39,null))[_0x3164('0x18')](function(_0x51ad22){if(_0x51ad22){_0x2e8ad0=_0x51ad22;_0x2f88eb['model']=_[_0x3164('0x4f')](db[_0x3164('0xab')]['rawAttributes']);_0x2f88eb[_0x3164('0x4e')]=_[_0x3164('0x4f')](_0x346988[_0x3164('0x4e')]);_0x2f88eb[_0x3164('0x50')]=_[_0x3164('0x51')](_0x2f88eb['model'],_0x2f88eb[_0x3164('0x4e')]);_0x233e5a[_0x3164('0x53')]=_[_0x3164('0x51')](_0x2f88eb[_0x3164('0x47')],qs[_0x3164('0x52')](_0x346988[_0x3164('0x4e')]['fields']));_0x233e5a[_0x3164('0x53')]=_0x233e5a[_0x3164('0x53')][_0x3164('0x64')]?_0x233e5a[_0x3164('0x53')]:_0x2f88eb[_0x3164('0x47')];_0x233e5a[_0x3164('0x56')]=qs[_0x3164('0x57')](_0x346988[_0x3164('0x4e')][_0x3164('0x57')]);_0x233e5a['where']=qs[_0x3164('0x50')](_[_0x3164('0x78')](_0x346988[_0x3164('0x4e')],_0x2f88eb[_0x3164('0x50')]));if(_0x346988[_0x3164('0x4e')]['filter']){_0x233e5a[_0x3164('0x58')]=_[_0x3164('0x5a')](_0x233e5a[_0x3164('0x58')],{'$or':_[_0x3164('0x4b')](_0x233e5a[_0x3164('0x53')],function(_0x1bdf5d){var _0x25e61b={};_0x25e61b[_0x1bdf5d]={'$like':'%'+_0x346988[_0x3164('0x4e')][_0x3164('0x59')]+'%'};return _0x25e61b;})});}_0x233e5a=_[_0x3164('0x5a')]({},_0x233e5a,_0x346988[_0x3164('0x5c')]);return _0x2e8ad0[_0x3164('0x126')](_0x233e5a);}})['then'](function(_0x170fdd){if(_0x170fdd){_0x3c0350=_0x170fdd[_0x3164('0x64')];if(!_0x346988[_0x3164('0x4e')]['hasOwnProperty']('nolimit')){_0x233e5a[_0x3164('0x28')]=qs['limit'](_0x346988[_0x3164('0x4e')][_0x3164('0x28')]);_0x233e5a[_0x3164('0x25')]=qs[_0x3164('0x25')](_0x346988[_0x3164('0x4e')][_0x3164('0x25')]);}return _0x2e8ad0[_0x3164('0x126')](_0x233e5a);}})[_0x3164('0x18')](function(_0x442278){if(_0x442278){return _0x442278?{'count':_0x3c0350,'rows':_0x442278}:null;}})[_0x3164('0x18')](respondWithResult(_0x1e3b39,null))[_0x3164('0x21')](handleError(_0x1e3b39,null));};exports['addProactiveActions']=function(_0x1fab19,_0xc3d44){return db[_0x3164('0x127')][_0x3164('0x65')]({'where':{'id':_0x1fab19[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0xc3d44,null))[_0x3164('0x18')](function(_0x5ed752){if(_0x5ed752){return _0x5ed752[_0x3164('0x128')](_0x1fab19[_0x3164('0x71')][_0x3164('0x7b')],_[_0x3164('0x103')](_0x1fab19[_0x3164('0x71')],[_0x3164('0x7b'),'id'])||{});}})['then'](respondWithResult(_0xc3d44,null))[_0x3164('0x21')](handleError(_0xc3d44,null));};exports[_0x3164('0x10b')]=function(_0x322ae5,_0x3ef840){var _0x4c7d01={};var _0x3e27e9={};var _0x111bf5;var _0x2bdd02;return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0x322ae5[_0x3164('0x62')]['id']}})['then'](handleEntityNotFound(_0x3ef840,null))[_0x3164('0x18')](function(_0x55360a){if(_0x55360a){_0x111bf5=_0x55360a;_0x3e27e9['model']=_[_0x3164('0x4f')](db[_0x3164('0x129')][_0x3164('0x4c')]);_0x3e27e9[_0x3164('0x4e')]=_[_0x3164('0x4f')](_0x322ae5['query']);_0x3e27e9[_0x3164('0x50')]=_[_0x3164('0x51')](_0x3e27e9[_0x3164('0x47')],_0x3e27e9[_0x3164('0x4e')]);_0x4c7d01[_0x3164('0x53')]=_[_0x3164('0x51')](_0x3e27e9[_0x3164('0x47')],qs['fields'](_0x322ae5[_0x3164('0x4e')][_0x3164('0x52')]));_0x4c7d01['attributes']=_0x4c7d01[_0x3164('0x53')][_0x3164('0x64')]?_0x4c7d01['attributes']:_0x3e27e9['model'];_0x4c7d01[_0x3164('0x56')]=qs[_0x3164('0x57')](_0x322ae5[_0x3164('0x4e')]['sort']);_0x4c7d01[_0x3164('0x58')]=qs[_0x3164('0x50')](_[_0x3164('0x78')](_0x322ae5[_0x3164('0x4e')],_0x3e27e9[_0x3164('0x50')]));if(_0x322ae5[_0x3164('0x4e')][_0x3164('0x59')]){_0x4c7d01[_0x3164('0x58')]=_[_0x3164('0x5a')](_0x4c7d01[_0x3164('0x58')],{'$or':_[_0x3164('0x4b')](_0x4c7d01['attributes'],function(_0x1c3b88){var _0x2d56a7={};_0x2d56a7[_0x1c3b88]={'$like':'%'+_0x322ae5[_0x3164('0x4e')][_0x3164('0x59')]+'%'};return _0x2d56a7;})});}_0x4c7d01=_['merge']({},_0x4c7d01,_0x322ae5[_0x3164('0x5c')]);return _0x111bf5[_0x3164('0x10b')](_0x4c7d01);}})[_0x3164('0x18')](function(_0x3db2f9){if(_0x3db2f9){_0x2bdd02=_0x3db2f9[_0x3164('0x64')];if(!_0x322ae5[_0x3164('0x4e')][_0x3164('0x54')](_0x3164('0x55'))){_0x4c7d01['limit']=qs[_0x3164('0x28')](_0x322ae5[_0x3164('0x4e')][_0x3164('0x28')]);_0x4c7d01[_0x3164('0x25')]=qs[_0x3164('0x25')](_0x322ae5[_0x3164('0x4e')][_0x3164('0x25')]);}return _0x111bf5[_0x3164('0x10b')](_0x4c7d01);}})[_0x3164('0x18')](function(_0x2caf5b){if(_0x2caf5b){return _0x2caf5b?{'count':_0x2bdd02,'rows':_0x2caf5b}:null;}})[_0x3164('0x18')](respondWithResult(_0x3ef840,null))[_0x3164('0x21')](handleError(_0x3ef840,null));};exports['getFields']=function(_0x328ccf,_0x550815){var _0x4066e8=_0x328ccf[_0x3164('0x4e')][_0x3164('0x12a')]===_0x3164('0x12b')?_0x3164('0x12c'):_0x3164('0x12d');return db[_0x3164('0x5f')][_0x3164('0x65')]({'attributes':['id',_0x4066e8],'where':{'id':_0x328ccf['params']['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x550815,null))[_0x3164('0x18')](function(_0x1490c2){if(_0x1490c2){var _0x14a59f=_0x1490c2[_0x4066e8];var _0x4ff2d0=_0x14a59f&&_0x14a59f[_0x3164('0x12e')]?_0x14a59f['items']:[];_0x550815[_0x3164('0x31')]({'fromKey':_[_0x3164('0x8e')](_0x14a59f[_0x3164('0x12f')])?undefined:_0x14a59f['fromKey'],'count':_0x4ff2d0[_0x3164('0x64')],'rows':_0x4ff2d0});}})[_0x3164('0x21')](handleError(_0x550815,null));};exports[_0x3164('0x130')]=function(_0x3463bc,_0x3f437b){var _0x198c6b={'raw':![],'where':{}};var _0x22e61a={};var _0x527005={'count':0x0,'rows':[]};return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0x3463bc[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x3f437b,null))[_0x3164('0x18')](function(_0xcf20a7){if(_0xcf20a7){_0x22e61a[_0x3164('0x47')]=_[_0x3164('0x4f')](db[_0x3164('0xe3')][_0x3164('0x4c')]);_0x22e61a[_0x3164('0x4e')]=_['keys'](_0x3463bc[_0x3164('0x4e')]);_0x22e61a[_0x3164('0x50')]=_['intersection'](_0x22e61a[_0x3164('0x47')],_0x22e61a['query']);_0x198c6b[_0x3164('0x53')]=_[_0x3164('0x51')](_0x22e61a[_0x3164('0x47')],qs['fields'](_0x3463bc[_0x3164('0x4e')]['fields']));_0x198c6b[_0x3164('0x53')]=_0x198c6b[_0x3164('0x53')][_0x3164('0x64')]?_0x198c6b['attributes']:_0x22e61a['model'];if(!_0x3463bc[_0x3164('0x4e')][_0x3164('0x54')](_0x3164('0x55'))){_0x198c6b[_0x3164('0x28')]=qs[_0x3164('0x28')](_0x3463bc[_0x3164('0x4e')][_0x3164('0x28')]);_0x198c6b[_0x3164('0x25')]=qs[_0x3164('0x25')](_0x3463bc[_0x3164('0x4e')]['offset']);}_0x198c6b['order']=qs[_0x3164('0x57')](_0x3463bc[_0x3164('0x4e')][_0x3164('0x57')]);_0x198c6b[_0x3164('0x58')]=qs[_0x3164('0x50')](_['pick'](_0x3463bc[_0x3164('0x4e')],_0x22e61a['filters']));_0x198c6b[_0x3164('0x58')][_0x3164('0x74')]=_0xcf20a7['id'];if(_0x3463bc[_0x3164('0x4e')][_0x3164('0x59')]){_0x198c6b['where']=_[_0x3164('0x5a')](_0x198c6b['where'],{'$or':_[_0x3164('0x4b')](_0x198c6b[_0x3164('0x53')],function(_0x1130c5){var _0x36a669={};_0x36a669[_0x1130c5]={'$like':'%'+_0x3463bc[_0x3164('0x4e')][_0x3164('0x59')]+'%'};return _0x36a669;})});}_0x198c6b=_[_0x3164('0x5a')]({},_0x198c6b,_0x3463bc[_0x3164('0x5c')]);return db['ChatOfflineMessage'][_0x3164('0x27')]({'where':_0x198c6b[_0x3164('0x58')]})[_0x3164('0x18')](function(_0x53185b){_0x527005[_0x3164('0x27')]=_0x53185b;if(_0x3463bc[_0x3164('0x4e')][_0x3164('0x5d')]){_0x198c6b[_0x3164('0x5e')]=[{'all':!![]}];}else{_0x198c6b[_0x3164('0x5e')]=[{'model':db[_0x3164('0xa0')],'as':_0x3164('0x105'),'required':![]},{'model':db['Attachment'],'as':_0x3164('0x131'),'required':![]}];}return db[_0x3164('0xe3')][_0x3164('0x60')](_0x198c6b);})['then'](function(_0x2df08a){_0x527005[_0x3164('0x79')]=_0x2df08a;return _0x527005;});}})[_0x3164('0x18')](respondWithFilteredResult(_0x3f437b,_0x198c6b))['catch'](handleError(_0x3f437b,null));};exports[_0x3164('0x132')]=function(_0x5ec7f7,_0x461f50){return db[_0x3164('0x5f')][_0x3164('0x65')]({'where':{'id':_0x5ec7f7[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x461f50,null))['then'](function(_0x1ee515){if(_0x1ee515){return _0x1ee515[_0x3164('0x132')](_0x5ec7f7[_0x3164('0x71')][_0x3164('0x7b')],_[_0x3164('0x103')](_0x5ec7f7[_0x3164('0x71')],[_0x3164('0x7b'),'id'])||{})[_0x3164('0xde')](function(_0x22188d){for(var _0x10d5a4=0x0;_0x10d5a4<_0x5ec7f7['body'][_0x3164('0x7b')][_0x3164('0x64')];_0x10d5a4+=0x1){socket['emit'](_0x3164('0x133'),{'UserId':Number(_0x5ec7f7[_0x3164('0x71')][_0x3164('0x7b')][_0x10d5a4]),'ChatWebsiteId':Number(_0x5ec7f7[_0x3164('0x62')]['id'])});}return _0x22188d;});}})[_0x3164('0x18')](respondWithResult(_0x461f50,null))['catch'](handleError(_0x461f50,null));};exports[_0x3164('0x134')]=function(_0x115dda,_0x320f97){return db['ChatWebsite']['find']({'where':{'id':_0x115dda[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x320f97,null))[_0x3164('0x18')](function(_0x51d4be){if(_0x51d4be){return _0x51d4be[_0x3164('0x134')](_0x115dda[_0x3164('0x4e')][_0x3164('0x7b')])[_0x3164('0x18')](function(){if(_[_0x3164('0x135')](_0x115dda[_0x3164('0x4e')][_0x3164('0x7b')])){for(var _0x3bb677=0x0;_0x3bb677<_0x115dda['query'][_0x3164('0x7b')][_0x3164('0x64')];_0x3bb677+=0x1){socket[_0x3164('0x136')](_0x3164('0x137'),{'UserId':Number(_0x115dda[_0x3164('0x4e')]['ids'][_0x3bb677]),'ChatWebsiteId':Number(_0x115dda['params']['id'])});}}else{socket['emit'](_0x3164('0x137'),{'UserId':Number(_0x115dda[_0x3164('0x4e')]['ids']),'ChatWebsiteId':Number(_0x115dda[_0x3164('0x62')]['id'])});}});}})[_0x3164('0x18')](respondWithStatusCode(_0x320f97,null))[_0x3164('0x21')](handleError(_0x320f97,null));};exports[_0x3164('0x138')]=function(_0x356c5a,_0x5569ab){var _0x3a1f1a={};var _0x3cc884={};var _0x5cdc0c;var _0x3a3cad;return db[_0x3164('0x5f')][_0x3164('0x77')]({'where':{'id':_0x356c5a[_0x3164('0x62')]['id']}})[_0x3164('0x18')](handleEntityNotFound(_0x5569ab,null))[_0x3164('0x18')](function(_0xc761ec){if(_0xc761ec){_0x5cdc0c=_0xc761ec;_0x3cc884['model']=_[_0x3164('0x4f')](db[_0x3164('0xc7')][_0x3164('0x4c')]);_0x3cc884[_0x3164('0x4e')]=_[_0x3164('0x4f')](_0x356c5a['query']);_0x3cc884['filters']=_['intersection'](_0x3cc884['model'],_0x3cc884[_0x3164('0x4e')]);_0x3a1f1a[_0x3164('0x53')]=_[_0x3164('0x51')](_0x3cc884[_0x3164('0x47')],qs[_0x3164('0x52')](_0x356c5a[_0x3164('0x4e')][_0x3164('0x52')]));_0x3a1f1a[_0x3164('0x53')]=_0x3a1f1a[_0x3164('0x53')]['length']?_0x3a1f1a[_0x3164('0x53')]:_0x3cc884[_0x3164('0x47')];_0x3a1f1a['order']=qs['sort'](_0x356c5a[_0x3164('0x4e')][_0x3164('0x57')]);_0x3a1f1a[_0x3164('0x58')]=qs[_0x3164('0x50')](_[_0x3164('0x78')](_0x356c5a[_0x3164('0x4e')],_0x3cc884[_0x3164('0x50')]));if(_0x356c5a[_0x3164('0x4e')][_0x3164('0x59')]){_0x3a1f1a[_0x3164('0x58')]=_[_0x3164('0x5a')](_0x3a1f1a['where'],{'$or':_[_0x3164('0x4b')](_0x3a1f1a[_0x3164('0x53')],function(_0x56101b){var _0x3eabdd={};_0x3eabdd[_0x56101b]={'$like':'%'+_0x356c5a[_0x3164('0x4e')]['filter']+'%'};return _0x3eabdd;})});}_0x3a1f1a=_[_0x3164('0x5a')]({},_0x3a1f1a,_0x356c5a[_0x3164('0x5c')]);return _0x5cdc0c[_0x3164('0x138')](_0x3a1f1a);}})[_0x3164('0x18')](function(_0x252055){if(_0x252055){_0x3a3cad=_0x252055[_0x3164('0x64')];if(!_0x356c5a[_0x3164('0x4e')][_0x3164('0x54')](_0x3164('0x55'))){_0x3a1f1a['limit']=qs[_0x3164('0x28')](_0x356c5a[_0x3164('0x4e')][_0x3164('0x28')]);_0x3a1f1a[_0x3164('0x25')]=qs['offset'](_0x356c5a[_0x3164('0x4e')][_0x3164('0x25')]);}return _0x5cdc0c['getAgents'](_0x3a1f1a);}})[_0x3164('0x18')](function(_0x3c7355){if(_0x3c7355){return _0x3c7355?{'count':_0x3a3cad,'rows':_0x3c7355}:null;}})['then'](respondWithResult(_0x5569ab,null))[_0x3164('0x21')](handleError(_0x5569ab,null));}; \ No newline at end of file +var _0x5b8f=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','model','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','rawAttributes','length','includeAll','body','address','forEach','trim','testWildcardValidity','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','params','describe','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','createdAt','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','priority','asc','List','list','Contacts','defaults','CmContact','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','waitForTheAssignedQueue','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','spread','readFileSync','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Owner','fullname','Tag','color','tag','getSnippet','getProactiveActions','virtual','License','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','utf8','3.9.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','APIBadRequestError','../../errors/api','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x5b8f,0x115));var _0xf5b8=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x5b8f[_0x190681];return _0x4f2ada;};'use strict';var Mustache=require(_0xf5b8('0x0'));var util=require(_0xf5b8('0x1'));var path=require(_0xf5b8('0x2'));var ejs=require(_0xf5b8('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xf5b8('0x4'));var htmlToText=require(_0xf5b8('0x5'));var Redis=require(_0xf5b8('0x6'));var jayson=require(_0xf5b8('0x7'));var qs=require(_0xf5b8('0x8'));var logger=require(_0xf5b8('0x9'))('api');var config=require('../../config/environment');var APIBadRequestError=require('../../errors/api')[_0xf5b8('0xa')];var APINotFoundError=require(_0xf5b8('0xb'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xf5b8('0xb'))['APIOutOfIntervalError'];var APIHandleError=require(_0xf5b8('0xb'))[_0xf5b8('0xc')];var APIConflictError=require(_0xf5b8('0xb'))[_0xf5b8('0xd')];var wildcardUtils=require(_0xf5b8('0xe'));var URL=require('url')[_0xf5b8('0xf')];var db=require(_0xf5b8('0x10'))['db'];config[_0xf5b8('0x11')]=_['defaults'](config['redis'],{'host':_0xf5b8('0x12'),'port':0x18eb});var socket=require(_0xf5b8('0x13'))(new Redis(config[_0xf5b8('0x11')]));require(_0xf5b8('0x14'))[_0xf5b8('0x15')](socket);var client=jayson['client'][_0xf5b8('0x16')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xf5b8('0x17')]['http']({'port':0x232b});var client9001=jayson[_0xf5b8('0x17')][_0xf5b8('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x181827,_0x6d2f2d,_0x40b924,_0x613cb1){return new Promise(function(_0x16abd6,_0x3f6574){var _0x1618c6=_0x613cb1||client;return _0x1618c6['request'](_0x181827,_0x40b924)[_0xf5b8('0x18')](function(_0x9ca0f){logger[_0xf5b8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x6d2f2d,_0xf5b8('0x1a'));logger[_0xf5b8('0x1b')](_0xf5b8('0x1c'),_0x6d2f2d,'request\x20sent',JSON[_0xf5b8('0x1d')](_0x9ca0f));if(_0x9ca0f[_0xf5b8('0x1e')]){if(_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x1f')]===0x1f4){logger['error'](_0xf5b8('0x20'),_0x6d2f2d,_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);return _0x3f6574(_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);}logger['error'](_0xf5b8('0x20'),_0x6d2f2d,_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);return _0x16abd6(_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);}else{logger[_0xf5b8('0x19')](_0xf5b8('0x20'),_0x6d2f2d,_0xf5b8('0x1a'));_0x16abd6(_0x9ca0f[_0xf5b8('0x22')][_0xf5b8('0x21')]);}})[_0xf5b8('0x23')](function(_0x50510e){logger[_0xf5b8('0x1e')](_0xf5b8('0x20'),_0x6d2f2d,_0x50510e);_0x3f6574(_0x50510e);});});}function respondWithStatusCode(_0x18ca29,_0x3a3ca4){_0x3a3ca4=_0x3a3ca4||0xcc;return function(_0xce19a6){if(_0xce19a6){return _0x18ca29[_0xf5b8('0x24')](_0x3a3ca4);}return _0x18ca29[_0xf5b8('0x25')](_0x3a3ca4)['end']();};}function respondWithResult(_0x28dda7,_0x598b44){_0x598b44=_0x598b44||0xc8;return function(_0x379334){if(_0x379334){return _0x28dda7[_0xf5b8('0x25')](_0x598b44)[_0xf5b8('0x26')](_0x379334);}};}function respondWithFilteredResult(_0x1fa029,_0x5a04af){return function(_0x351d37){if(_0x351d37){var _0x41010e=typeof _0x5a04af[_0xf5b8('0x27')]===_0xf5b8('0x28')&&typeof _0x5a04af['limit']==='undefined';var _0x196102=_0x351d37[_0xf5b8('0x29')];var _0x100fdf=_0x41010e?0x0:_0x5a04af[_0xf5b8('0x27')];var _0x2db2ea=_0x41010e?_0x351d37['count']:_0x5a04af[_0xf5b8('0x27')]+_0x5a04af[_0xf5b8('0x2a')];var _0x4e7d6b;if(_0x2db2ea>=_0x196102){_0x2db2ea=_0x196102;_0x4e7d6b=0xc8;}else{_0x4e7d6b=0xce;}_0x1fa029['status'](_0x4e7d6b);return _0x1fa029[_0xf5b8('0x2b')](_0xf5b8('0x2c'),_0x100fdf+'-'+_0x2db2ea+'/'+_0x196102)[_0xf5b8('0x26')](_0x351d37);}return null;};}function saveUpdates(_0x2958e1){return function(_0x163f2d){if(_0x163f2d){return _0x163f2d['update'](_0x2958e1)[_0xf5b8('0x18')](function(_0x25ffaf){return _0x25ffaf;});}return null;};}function removeEntity(_0x2f8b1a){return function(_0x593543){if(_0x593543){return _0x593543[_0xf5b8('0x2d')]()[_0xf5b8('0x18')](function(){var _0x2f9f20=_0x593543[_0xf5b8('0x2e')]({'plain':!![]});var _0x12754f=_0xf5b8('0x2f');return db[_0xf5b8('0x30')]['destroy']({'where':{'type':_0x12754f,'resourceId':_0x2f9f20['id']}})[_0xf5b8('0x18')](function(){return _0x593543;});})['then'](function(){_0x2f8b1a[_0xf5b8('0x25')](0xcc)[_0xf5b8('0x31')]();});}};}function handleEntityNotFound(_0x256317){return function(_0x53ba09){if(!_0x53ba09){_0x256317[_0xf5b8('0x24')](0x194);}return _0x53ba09;};}function handleError(_0x277af4,_0x43fdb8){_0x43fdb8=_0x43fdb8||0x1f4;return function(_0x9f7f98){logger['error'](_0x9f7f98[_0xf5b8('0x32')]);if(_0x9f7f98['name']){delete _0x9f7f98[_0xf5b8('0x33')];}_0x277af4[_0xf5b8('0x25')](_0x43fdb8)[_0xf5b8('0x34')](_0x9f7f98);};}function createInteractionObject(_0x75c4f,_0x169c1a,_0x2f6205,_0x266b01){var _0x13ae2a=require(_0xf5b8('0x35'));var _0x51c5dd=new _0x13ae2a();var _0x1461bf=_0x51c5dd[_0xf5b8('0x36')](_0x2f6205[_0xf5b8('0x37')])['getResult']();var _0x350bf8=_0x169c1a[_0xf5b8('0x38')];if(_0x2f6205['cf-connecting-ip']){_0x350bf8=_0x2f6205[_0xf5b8('0x39')];}else if(_0x2f6205['x-forwarded-for']){_0x350bf8=_[_0xf5b8('0x3a')](_0x2f6205[_0xf5b8('0x3b')][_0xf5b8('0x3c')](','));}return{'ContactId':_0x266b01['id'],'ChatWebsiteId':_0x75c4f,'from':(_0x266b01[_0xf5b8('0x3d')]||'')+'\x20'+(_0x266b01[_0xf5b8('0x3e')]||''),'customerIp':_0x350bf8,'customerPort':_0x2f6205[_0xf5b8('0x3f')]?_0x2f6205[_0xf5b8('0x3f')]:null,'referer':_0x169c1a[_0xf5b8('0x40')],'browserName':_0x1461bf[_0xf5b8('0x41')][_0xf5b8('0x33')]&&_0x1461bf[_0xf5b8('0x41')][_0xf5b8('0x42')]?util['format'](_0xf5b8('0x43'),_0x1461bf['browser']['name'],_0x1461bf['browser'][_0xf5b8('0x42')]):'unknown','browserVersion':_0x1461bf[_0xf5b8('0x41')][_0xf5b8('0x42')]||_0xf5b8('0x44'),'osName':util[_0xf5b8('0x45')](_0xf5b8('0x43'),_0x1461bf['os'][_0xf5b8('0x33')],_0x1461bf['os'][_0xf5b8('0x42')]),'osVersion':_0x1461bf['os'][_0xf5b8('0x42')],'deviceModel':_0x1461bf[_0xf5b8('0x46')]['model']&&_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x47')]?util['format']('%s\x20%s\x20%s',_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x48')],_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x47')],_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x49')]):null,'deviceVendor':_0x1461bf['device'][_0xf5b8('0x47')],'deviceType':_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x49')],'formData':JSON['stringify'](_0x169c1a)};}exports[_0xf5b8('0x4a')]=function(_0x14a30d,_0x40ae5c){var _0x421cb3={'include':[{'model':db[_0xf5b8('0x4b')],'as':_0xf5b8('0x4c')}]},_0x28f310={},_0x14628c={'count':0x0,'rows':[]};var _0x2f7165=_[_0xf5b8('0x4d')](db[_0xf5b8('0x4e')]['rawAttributes'],function(_0x48a7fb){return{'name':_0x48a7fb['fieldName'],'type':_0x48a7fb['type']['key']};});_0x28f310[_0xf5b8('0x48')]=_[_0xf5b8('0x4d')](_0x2f7165,_0xf5b8('0x33'));_0x28f310[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x14a30d[_0xf5b8('0x4f')]);_0x28f310[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x28f310[_0xf5b8('0x48')],_0x28f310[_0xf5b8('0x4f')]);_0x421cb3[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x28f310[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x14a30d['query'][_0xf5b8('0x54')]));_0x421cb3[_0xf5b8('0x53')]=_0x421cb3[_0xf5b8('0x53')]['length']?_0x421cb3[_0xf5b8('0x53')]:_0x28f310[_0xf5b8('0x48')];if(!_0x14a30d['query'][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x421cb3[_0xf5b8('0x2a')]=qs['limit'](_0x14a30d[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x421cb3['offset']=qs['offset'](_0x14a30d[_0xf5b8('0x4f')]['offset']);}_0x421cb3[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x14a30d['query']['sort']);_0x421cb3[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x14a30d[_0xf5b8('0x4f')],_0x28f310[_0xf5b8('0x51')]),_0x2f7165);if(_0x14a30d[_0xf5b8('0x4f')][_0xf5b8('0x5b')]){_0x421cb3[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x421cb3[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x2f7165,function(_0x33eeb7){if(_0x33eeb7[_0xf5b8('0x49')]!==_0xf5b8('0x5d')){var _0x2f5c55={};_0x2f5c55[_0x33eeb7[_0xf5b8('0x33')]]={'$like':'%'+_0x14a30d[_0xf5b8('0x4f')]['filter']+'%'};return _0x2f5c55;}})});}_0x421cb3=_[_0xf5b8('0x5c')]({},_0x421cb3,_0x14a30d[_0xf5b8('0x5e')]);var _0x5cfcd4={'where':_0x421cb3[_0xf5b8('0x59')]};return db['ChatWebsite'][_0xf5b8('0x29')](_0x5cfcd4)['then'](function(_0x456140){_0x14628c[_0xf5b8('0x29')]=_0x456140;if(_0x14a30d[_0xf5b8('0x4f')]['includeAll']){_0x421cb3[_0xf5b8('0x5f')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x421cb3);})['then'](function(_0x344c2c){_0x14628c[_0xf5b8('0x60')]=_0x344c2c;return _0x14628c;})[_0xf5b8('0x18')](respondWithFilteredResult(_0x40ae5c,_0x421cb3))[_0xf5b8('0x23')](handleError(_0x40ae5c,null));};exports[_0xf5b8('0x61')]=function(_0x521585,_0x21445b){var _0x1678ca={'raw':![],'where':{'id':_0x521585['params']['id']},'include':[{'model':db['Pause'],'as':_0xf5b8('0x4c')}]},_0x576923={};_0x576923[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0x4e')][_0xf5b8('0x62')]);_0x576923[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x521585['query']);_0x576923['filters']=_['intersection'](_0x576923[_0xf5b8('0x48')],_0x576923['query']);_0x1678ca[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x576923['model'],qs['fields'](_0x521585[_0xf5b8('0x4f')][_0xf5b8('0x54')]));_0x1678ca[_0xf5b8('0x53')]=_0x1678ca['attributes'][_0xf5b8('0x63')]?_0x1678ca[_0xf5b8('0x53')]:_0x576923[_0xf5b8('0x48')];if(_0x521585['query'][_0xf5b8('0x64')]){_0x1678ca[_0xf5b8('0x5f')]=[{'all':!![]}];}_0x1678ca=_['merge']({},_0x1678ca,_0x521585['options']);return db[_0xf5b8('0x4e')]['find'](_0x1678ca)['then'](handleEntityNotFound(_0x21445b,null))[_0xf5b8('0x18')](respondWithResult(_0x21445b,null))['catch'](handleError(_0x21445b,null));};exports['create']=function(_0x4c08df,_0x3e8e70){var _0x419dc8=null;_0x4c08df[_0xf5b8('0x65')][_0xf5b8('0x66')]['split'](',')[_0xf5b8('0x67')](_0x5c8901=>{if(_0x5c8901[_0xf5b8('0x68')]()!==''&&!wildcardUtils[_0xf5b8('0x69')](_0x5c8901[_0xf5b8('0x68')]())){_0x419dc8=new APIBadRequestError('\x22'+_0x5c8901+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x419dc8){return handleError(_0x3e8e70,null)(_0x419dc8);}return db[_0xf5b8('0x4e')][_0xf5b8('0x6a')](_0x4c08df['body'],{})['then'](function(_0x249f1e){var _0x2903dc=_0x4c08df['user'][_0xf5b8('0x2e')]({'plain':!![]});if(!_0x2903dc)throw new Error(_0xf5b8('0x6b'));if(_0x2903dc[_0xf5b8('0x6c')]===_0xf5b8('0x6d')){var _0x3a9ecd=_0x249f1e[_0xf5b8('0x2e')]({'plain':!![]});var _0x45870c=_0xf5b8('0x2f');return db[_0xf5b8('0x6e')][_0xf5b8('0x6f')]({'where':{'name':_0x45870c,'userProfileId':_0x2903dc['userProfileId']},'raw':!![]})[_0xf5b8('0x18')](function(_0xd27aa9){if(_0xd27aa9&&_0xd27aa9[_0xf5b8('0x70')]===0x0){return db[_0xf5b8('0x30')][_0xf5b8('0x6a')]({'name':_0x3a9ecd[_0xf5b8('0x33')],'resourceId':_0x3a9ecd['id'],'type':_0xd27aa9['name'],'sectionId':_0xd27aa9['id']},{})[_0xf5b8('0x18')](function(){return _0x249f1e;});}else{return _0x249f1e;}})[_0xf5b8('0x23')](function(_0x7d106c){logger[_0xf5b8('0x1e')](_0xf5b8('0x71'),_0x7d106c);throw _0x7d106c;});}return _0x249f1e;})[_0xf5b8('0x18')](respondWithResult(_0x3e8e70,0xc9))[_0xf5b8('0x23')](handleError(_0x3e8e70,null));};exports['update']=function(_0x317d59,_0x3c65b4){var _0xa4458d=null;_0x317d59[_0xf5b8('0x65')][_0xf5b8('0x66')][_0xf5b8('0x3c')](',')[_0xf5b8('0x67')](_0x2f3912=>{if(_0x2f3912[_0xf5b8('0x68')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x2f3912[_0xf5b8('0x68')]())){_0xa4458d=new APIBadRequestError('\x22'+_0x2f3912+_0xf5b8('0x72'));}});if(_0xa4458d){return handleError(_0x3c65b4,null)(_0xa4458d);}if(_0x317d59[_0xf5b8('0x65')]['id']){delete _0x317d59['body']['id'];}return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x317d59[_0xf5b8('0x73')]['id']},'include':[{'model':db[_0xf5b8('0x4b')],'as':_0xf5b8('0x4c')}]})['then'](handleEntityNotFound(_0x3c65b4,null))[_0xf5b8('0x18')](saveUpdates(_0x317d59[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x3c65b4,null))[_0xf5b8('0x23')](handleError(_0x3c65b4,null));};exports[_0xf5b8('0x2d')]=function(_0x138280,_0x515aaa){return db['ChatWebsite'][_0xf5b8('0x6f')]({'where':{'id':_0x138280[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x515aaa,null))['then'](removeEntity(_0x515aaa,null))[_0xf5b8('0x23')](handleError(_0x515aaa,null));};exports['describe']=function(_0x40be06,_0x4eb070){return db[_0xf5b8('0x4e')][_0xf5b8('0x74')]()[_0xf5b8('0x18')](respondWithResult(_0x4eb070,null))[_0xf5b8('0x23')](handleError(_0x4eb070,null));};exports['addDisposition']=function(_0xa73b6f,_0x4f4004){if(_0xa73b6f[_0xf5b8('0x65')]['id']){delete _0xa73b6f[_0xf5b8('0x65')]['id'];}return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0xa73b6f['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4f4004,null))[_0xf5b8('0x18')](function(_0x18f7c4){if(_0x18f7c4){_0xa73b6f['body'][_0xf5b8('0x75')]=_0x18f7c4['id'];return db[_0xf5b8('0x76')][_0xf5b8('0x6a')](_0xa73b6f[_0xf5b8('0x65')]);}})[_0xf5b8('0x18')](respondWithResult(_0x4f4004,null))[_0xf5b8('0x23')](handleError(_0x4f4004,null));};exports[_0xf5b8('0x77')]=function(_0x95206,_0x2ce202){var _0x36456c={'raw':![],'where':{}};var _0x42b2a1={};var _0x382790={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')]['findOne']({'where':{'id':_0x95206['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x2ce202,null))['then'](function(_0x547749){if(_0x547749){_0x42b2a1[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0x76')]['rawAttributes']);_0x42b2a1['query']=_[_0xf5b8('0x50')](_0x95206[_0xf5b8('0x4f')]);_0x42b2a1[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x42b2a1['model'],_0x42b2a1[_0xf5b8('0x4f')]);_0x36456c[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x42b2a1[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x95206['query'][_0xf5b8('0x54')]));_0x36456c['attributes']=_0x36456c['attributes'][_0xf5b8('0x63')]?_0x36456c[_0xf5b8('0x53')]:_0x42b2a1[_0xf5b8('0x48')];if(!_0x95206[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x36456c[_0xf5b8('0x2a')]=qs['limit'](_0x95206[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x36456c[_0xf5b8('0x27')]=qs[_0xf5b8('0x27')](_0x95206['query'][_0xf5b8('0x27')]);}_0x36456c['order']=qs[_0xf5b8('0x58')](_0x95206[_0xf5b8('0x4f')]['sort']);_0x36456c[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_['pick'](_0x95206['query'],_0x42b2a1['filters']));_0x36456c['where'][_0xf5b8('0x75')]=_0x547749['id'];if(_0x95206['query'][_0xf5b8('0x5b')]){_0x36456c[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x36456c[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x36456c[_0xf5b8('0x53')],function(_0x3a5f0a){var _0x4c0131={};_0x4c0131[_0x3a5f0a]={'$like':'%'+_0x95206[_0xf5b8('0x4f')]['filter']+'%'};return _0x4c0131;})});}_0x36456c=_[_0xf5b8('0x5c')]({},_0x36456c,_0x95206['options']);return db['Disposition'][_0xf5b8('0x29')]({'where':_0x36456c[_0xf5b8('0x59')]})[_0xf5b8('0x18')](function(_0x48794e){_0x382790[_0xf5b8('0x29')]=_0x48794e;if(_0x95206[_0xf5b8('0x4f')][_0xf5b8('0x64')]){_0x36456c[_0xf5b8('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0xf5b8('0x78')](_0x36456c);})[_0xf5b8('0x18')](function(_0x2d7951){_0x382790[_0xf5b8('0x60')]=_0x2d7951;return _0x382790;});}})['then'](respondWithFilteredResult(_0x2ce202,_0x36456c))[_0xf5b8('0x23')](handleError(_0x2ce202,null));};exports[_0xf5b8('0x79')]=function(_0x2aaf11,_0x34966f){return db['ChatWebsite']['find']({'where':{'id':_0x2aaf11[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x34966f,null))[_0xf5b8('0x18')](function(_0x284c80){if(_0x284c80){return _0x284c80[_0xf5b8('0x79')](_0x2aaf11[_0xf5b8('0x4f')]['ids']);}})['then'](respondWithStatusCode(_0x34966f,null))['catch'](handleError(_0x34966f,null));};exports[_0xf5b8('0x7a')]=function(_0x576bda,_0xd86aa1){if(_0x576bda[_0xf5b8('0x65')]['id']){delete _0x576bda[_0xf5b8('0x65')]['id'];}return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x576bda[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0xd86aa1,null))[_0xf5b8('0x18')](function(_0x2a12b9){if(_0x2a12b9){_0x576bda[_0xf5b8('0x65')][_0xf5b8('0x75')]=_0x2a12b9['id'];return db['CannedAnswer'][_0xf5b8('0x6a')](_0x576bda[_0xf5b8('0x65')]);}})[_0xf5b8('0x18')](respondWithResult(_0xd86aa1,null))[_0xf5b8('0x23')](handleError(_0xd86aa1,null));};exports[_0xf5b8('0x7b')]=function(_0x34a19a,_0x497851){var _0x4d589b={'raw':![],'where':{}};var _0x3c7afe={};var _0x5175fd={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0x34a19a[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x497851,null))[_0xf5b8('0x18')](function(_0x404a90){if(_0x404a90){_0x3c7afe[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0x7d')][_0xf5b8('0x62')]);_0x3c7afe['query']=_[_0xf5b8('0x50')](_0x34a19a[_0xf5b8('0x4f')]);_0x3c7afe[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x3c7afe[_0xf5b8('0x48')],_0x3c7afe['query']);_0x4d589b[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x3c7afe[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x34a19a['query'][_0xf5b8('0x54')]));_0x4d589b[_0xf5b8('0x53')]=_0x4d589b[_0xf5b8('0x53')][_0xf5b8('0x63')]?_0x4d589b[_0xf5b8('0x53')]:_0x3c7afe['model'];if(!_0x34a19a['query'][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x4d589b['limit']=qs['limit'](_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x4d589b[_0xf5b8('0x27')]=qs['offset'](_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x27')]);}_0x4d589b[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x4d589b['where']=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x34a19a[_0xf5b8('0x4f')],_0x3c7afe[_0xf5b8('0x51')]));_0x4d589b[_0xf5b8('0x59')][_0xf5b8('0x75')]=_0x404a90['id'];if(_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x5b')]){_0x4d589b[_0xf5b8('0x59')]=_['merge'](_0x4d589b[_0xf5b8('0x59')],{'$or':_['map'](_0x4d589b['attributes'],function(_0x9957f6){var _0x4d160={};_0x4d160[_0x9957f6]={'$like':'%'+_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x4d160;})});}_0x4d589b=_[_0xf5b8('0x5c')]({},_0x4d589b,_0x34a19a[_0xf5b8('0x5e')]);return db[_0xf5b8('0x7d')]['count']({'where':_0x4d589b['where']})[_0xf5b8('0x18')](function(_0x30e65b){_0x5175fd[_0xf5b8('0x29')]=_0x30e65b;if(_0x34a19a[_0xf5b8('0x4f')]['includeAll']){_0x4d589b[_0xf5b8('0x5f')]=[{'all':!![]}];}return db[_0xf5b8('0x7d')][_0xf5b8('0x78')](_0x4d589b);})[_0xf5b8('0x18')](function(_0xffbece){_0x5175fd['rows']=_0xffbece;return _0x5175fd;});}})['then'](respondWithFilteredResult(_0x497851,_0x4d589b))['catch'](handleError(_0x497851,null));};exports[_0xf5b8('0x7e')]=function(_0x35133d,_0x17a949){return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x35133d[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x17a949,null))[_0xf5b8('0x18')](function(_0x3369b4){if(_0x3369b4){return _0x3369b4[_0xf5b8('0x7e')](_0x35133d[_0xf5b8('0x4f')][_0xf5b8('0x7f')]);}})[_0xf5b8('0x18')](respondWithStatusCode(_0x17a949,null))['catch'](handleError(_0x17a949,null));};exports['addLogo']=function(_0x1bccf0,_0x288cf3){_0x1bccf0['body'][_0xf5b8('0x80')]=_0x1bccf0[_0xf5b8('0x81')][_0xf5b8('0x82')];return db[_0xf5b8('0x4e')]['find']({'where':{'id':_0x1bccf0[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x288cf3,null))[_0xf5b8('0x18')](saveUpdates(_0x1bccf0[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x288cf3,null))[_0xf5b8('0x23')](handleError(_0x288cf3,null));};exports[_0xf5b8('0x83')]=function(_0x119ed1,_0x183c64){_0x119ed1[_0xf5b8('0x65')][_0xf5b8('0x84')]=_0x119ed1[_0xf5b8('0x81')][_0xf5b8('0x82')];return db['ChatWebsite'][_0xf5b8('0x6f')]({'where':{'id':_0x119ed1[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x183c64,null))['then'](saveUpdates(_0x119ed1[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x183c64,null))['catch'](handleError(_0x183c64,null));};exports[_0xf5b8('0x85')]=function(_0x1bfdde,_0x5d4d9c){_0x1bfdde[_0xf5b8('0x65')][_0xf5b8('0x86')]=_0x1bfdde[_0xf5b8('0x81')][_0xf5b8('0x82')];return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x1bfdde[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x5d4d9c,null))[_0xf5b8('0x18')](saveUpdates(_0x1bfdde[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x5d4d9c,null))['catch'](handleError(_0x5d4d9c,null));};exports[_0xf5b8('0x87')]=function(_0x375e3e,_0xc16a21){_0x375e3e[_0xf5b8('0x65')][_0xf5b8('0x88')]=_0x375e3e['file'][_0xf5b8('0x82')];return db['ChatWebsite'][_0xf5b8('0x6f')]({'where':{'id':_0x375e3e[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0xc16a21,null))['then'](saveUpdates(_0x375e3e[_0xf5b8('0x65')],null))['then'](respondWithResult(_0xc16a21,null))[_0xf5b8('0x23')](handleError(_0xc16a21,null));};exports[_0xf5b8('0x89')]=function(_0x29560d,_0x267f70){var _0x565aa7=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],'server/files/images/logos/default_logo.svg');var _0x978db3={'where':{'id':_0x29560d['params']['id']},'attributes':['id',_0xf5b8('0x80')],'raw':!![]};var _0x3c70ca=![];return require(_0xf5b8('0x8c'))[_0xf5b8('0x8d')]()[_0xf5b8('0x18')](function(_0x2dda92){if(_0x2dda92){_0x3c70ca=_0x2dda92[_0xf5b8('0x8e')];}})['then'](function(){return db[_0xf5b8('0x4e')]['find'](_0x978db3);})[_0xf5b8('0x18')](handleEntityNotFound(_0x267f70,null))[_0xf5b8('0x18')](function(_0x303e54){if(_0x303e54){if(!_[_0xf5b8('0x8f')](_0x303e54[_0xf5b8('0x80')])){if(fs[_0xf5b8('0x90')](path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x91'),_0x303e54[_0xf5b8('0x80')]))&&_0x3c70ca){_0x565aa7=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],'server/files/images/logos/',_0x303e54['sitepic']);}}return _0x267f70['download'](_0x565aa7);}})[_0xf5b8('0x23')](handleError(_0x267f70,null));};exports[_0xf5b8('0x92')]=function(_0x2e81e6,_0x2e3788){var _0x2cc48a=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x93'));var _0x1f3d7c={'where':{'id':_0x2e81e6[_0xf5b8('0x73')]['id']},'attributes':['id',_0xf5b8('0x84')],'raw':!![]};return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')](_0x1f3d7c)['then'](handleEntityNotFound(_0x2e3788,null))[_0xf5b8('0x18')](function(_0x30617e){if(_0x30617e){if(!_[_0xf5b8('0x8f')](_0x30617e[_0xf5b8('0x84')])){if(fs['existsSync'](path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x94'),_0x30617e[_0xf5b8('0x84')]))){_0x2cc48a=path['join'](config['root'],_0xf5b8('0x94'),_0x30617e[_0xf5b8('0x84')]);}}return _0x2e3788[_0xf5b8('0x95')](_0x2cc48a);}})['catch'](handleError(_0x2e3788,null));};exports[_0xf5b8('0x96')]=function(_0x1bc8e4,_0x2131dc){var _0x36c777=path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x97'));var _0x4fa447={'where':{'id':_0x1bc8e4[_0xf5b8('0x73')]['id']},'attributes':['id',_0xf5b8('0x86'),_0xf5b8('0x98')],'raw':!![]};return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')](_0x4fa447)[_0xf5b8('0x18')](handleEntityNotFound(_0x2131dc,null))[_0xf5b8('0x18')](function(_0x1c7be7){if(_0x1c7be7){if(!_['isNil'](_0x1c7be7[_0xf5b8('0x86')])){if(fs[_0xf5b8('0x90')](path['join'](config[_0xf5b8('0x8b')],'server/files/images/avatars/',_0x1c7be7[_0xf5b8('0x86')]))&&_0x1c7be7[_0xf5b8('0x98')]){_0x36c777=path['join'](config[_0xf5b8('0x8b')],_0xf5b8('0x94'),_0x1c7be7['customerAvatar']);}}return _0x2131dc[_0xf5b8('0x95')](_0x36c777);}})[_0xf5b8('0x23')](handleError(_0x2131dc,null));};exports[_0xf5b8('0x99')]=function(_0xd38b80,_0x5129bd){var _0x5387ea=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x9a'));var _0x5cfdab={'where':{'id':_0xd38b80[_0xf5b8('0x73')]['id']},'attributes':['id',_0xf5b8('0x88')],'raw':!![]};return db['ChatWebsite']['find'](_0x5cfdab)[_0xf5b8('0x18')](handleEntityNotFound(_0x5129bd,null))['then'](function(_0x4d072d){if(_0x4d072d){if(!_[_0xf5b8('0x8f')](_0x4d072d[_0xf5b8('0x88')])){if(fs['existsSync'](path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x94'),_0x4d072d[_0xf5b8('0x88')]))){_0x5387ea=path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x94'),_0x4d072d[_0xf5b8('0x88')]);}}return _0x5129bd[_0xf5b8('0x95')](_0x5387ea);}})[_0xf5b8('0x23')](handleError(_0x5129bd,null));};function checkWebsiteInterval(_0x4fed03){var _0x44480b=_0x4fed03[_0xf5b8('0x9b')];if(!_0x44480b){return Promise['resolve'](_0x4fed03);}var _0x2aedd1=_0x4fed03['timezone']||undefined;return _0x44480b[_0xf5b8('0x9c')](_0x2aedd1)[_0xf5b8('0x18')](function(_0x569fb6){if(!_0x569fb6){throw new APIOutOfIntervalError();}return _0x4fed03;});}exports[_0xf5b8('0x9d')]=function(_0x39e1c5,_0x1a728f){var _0x1081a5={'body':_0x39e1c5[_0xf5b8('0x65')],'channel':_0xf5b8('0x9e')};var _0x45112b=[];var _0x561421=[];var _0x4d5687={};var _0x2f7370=![];if(_0x39e1c5['body']['id']){delete _0x39e1c5[_0xf5b8('0x65')]['id'];}if(_[_0xf5b8('0x8f')](_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x9f')])){throw new APIBadRequestError(_0xf5b8('0xa0'));}if(_['isNil'](_0x39e1c5['body'][_0xf5b8('0xa1')])){throw new APIBadRequestError(_0xf5b8('0xa2'));}if(_['isEmpty'](_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x65')])){throw new APIBadRequestError(_0xf5b8('0xa3'));}var _0x271355=_0x39e1c5[_0xf5b8('0x65')]['customerIp']&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x40')];return db['CmContact'][_0xf5b8('0x74')]()['then'](function(_0x2ca6fc){if(!_0x2ca6fc){throw new Error('No\x20available\x20attributes');}_0x45112b=Object['keys'](_0x2ca6fc)[_0xf5b8('0x5b')](function(_0xed9c7e){return![_0xf5b8('0xa4'),_0xf5b8('0xa5')]['includes'](_0xed9c7e);});_0x561421=Object['keys'](_0x2ca6fc)[_0xf5b8('0x5b')](function(_0x41bcf2){return![_0xf5b8('0xa4'),'updatedAt',_0xf5b8('0xa6'),_0xf5b8('0xa7')]['includes'](_0x41bcf2);});if(!_['includes'](_0x561421,_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xa1')])){throw new APIBadRequestError(_0xf5b8('0xa8')+_0x561421[_0xf5b8('0x8a')](',\x20'));}_0x4d5687[_0x39e1c5[_0xf5b8('0x65')]['mapKey']]=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x9f')];})['then'](function(){return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x39e1c5['params']['id']},'include':[{'model':db[_0xf5b8('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4d5687,'limit':0x1,'order':[[_0xf5b8('0xa5'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xf5b8('0xaa')},{'model':db[_0xf5b8('0x9b')],'as':_0xf5b8('0x9b'),'include':[{'model':db[_0xf5b8('0x9b')],'as':_0xf5b8('0xab'),'attributes':['id',_0xf5b8('0xac')],'raw':!![]}]}]});})[_0xf5b8('0x18')](function(_0x9da925){if(!_0x9da925){throw new APINotFoundError(util[_0xf5b8('0x45')](_0xf5b8('0xad'),_0x39e1c5[_0xf5b8('0x73')]['id']));}if(_0x271355){return checkWebsiteInterval(_0x9da925);}return _0x9da925;})[_0xf5b8('0x18')](function(_0x186f21){_0x1081a5['account']=_0x186f21;_0x1081a5[_0xf5b8('0xae')]=_['orderBy'](_0x186f21[_0xf5b8('0xaa')],[_0xf5b8('0xaf')],[_0xf5b8('0xb0')]);if(_0x1081a5['account'][_0xf5b8('0xaa')]){delete _0x1081a5['account']['Applications'];}_0x1081a5['list']=_0x186f21[_0xf5b8('0xb1')]||{'id':_0x186f21[_0xf5b8('0xa7')]};if(_0x1081a5[_0xf5b8('0xb2')]&&_0x1081a5[_0xf5b8('0xb2')][_0xf5b8('0xb3')]['length']){return _0x1081a5[_0xf5b8('0xb2')][_0xf5b8('0xb3')][0x0];}var _0x5df38c=_[_0xf5b8('0xb4')](_0x39e1c5[_0xf5b8('0x65')],{'firstName':_0x39e1c5[_0xf5b8('0x65')]['from'],'ListId':_0x186f21[_0xf5b8('0xa7')]});_0x5df38c[_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xa1')]]=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x9f')];return db[_0xf5b8('0xb5')][_0xf5b8('0x6a')](_0x5df38c,{'fields':_0x45112b,'raw':!![]});})['then'](function(_0x131052){_0x1081a5[_0xf5b8('0xb6')]=_0x131052;var _0x55a7a1=createInteractionObject(_0x39e1c5['params']['id'],_0x39e1c5[_0xf5b8('0x65')],_0x39e1c5[_0xf5b8('0xb7')],_0x131052);var _0x213550={'ChatWebsiteId':_0x39e1c5[_0xf5b8('0x73')]['id']};if(_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')]){_0x213550[_0xf5b8('0xb8')]=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')];_0x213550[_0xf5b8('0xb9')]=![];return db[_0xf5b8('0xba')][_0xf5b8('0x6f')]({'where':_0x213550})[_0xf5b8('0x18')](function(_0x2e4e92){var _0x39370f=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x38')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x40')];if(_0x2e4e92){_0x2f7370=!![];return _0x2e4e92;}else if(!_0x39370f&&_0x2e4e92&&_0x2e4e92['closed']){throw new APIConflictError(_0xf5b8('0xbb'));}_0x55a7a1[_0xf5b8('0xb8')]=_0x39e1c5[_0xf5b8('0x65')]['threadId'];_0x55a7a1['externalUrl']=_0x39e1c5['body'][_0xf5b8('0xbc')];return db['ChatInteraction'][_0xf5b8('0x6a')](_0x55a7a1);});}_0x213550[_0xf5b8('0xbd')]=_0x131052['id'];if(_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbe')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbe')]['id']){_0x213550['id']=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbe')]['id'];return db[_0xf5b8('0xba')][_0xf5b8('0x6f')]({'where':_0x213550})[_0xf5b8('0x18')](function(_0x38ad78){var _0x1f6e87=_0x39e1c5['body'][_0xf5b8('0x38')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x40')];if(!_0x1f6e87&&_0x38ad78&&_0x38ad78[_0xf5b8('0xb9')]){throw new APIConflictError(_0xf5b8('0xbb'));}else if(_0x38ad78){_0x2f7370=!![];return _0x38ad78;}else{return db[_0xf5b8('0xba')][_0xf5b8('0x6a')](_0x55a7a1);}});}return db[_0xf5b8('0xba')]['create'](_0x55a7a1);})['then'](function(_0x460139){if(!_0x2f7370){return _0x460139;}var _0x278d07={'from':(_0x1081a5[_0xf5b8('0xb6')]['firstName']||'')+'\x20'+(_0x1081a5[_0xf5b8('0xb6')][_0xf5b8('0x3e')]||'')};if(_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbf')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')]!=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbf')]){_0x278d07['threadId']=_0x39e1c5[_0xf5b8('0x65')]['messageId'];}return _0x460139['update'](_0x278d07);})[_0xf5b8('0x18')](function(_0xfeb07c){_0x1081a5[_0xf5b8('0xbe')]=_0xfeb07c[_0xf5b8('0x2e')]({'plain':!![]});_0x1081a5['interaction'][_0xf5b8('0xc0')]=!_0x2f7370;if(_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xc0')]){if(_0x1081a5['account'][_0xf5b8('0xc1')]){_0x1081a5[_0xf5b8('0xae')][_0xf5b8('0xc2')]({'id':0x0,'priority':_0x1081a5['applications'][_0xf5b8('0x63')]+0x1,'app':_0xf5b8('0xc3'),'appdata':'unmanaged','interval':_0xf5b8('0xc4')});}}return db[_0xf5b8('0xc5')][_0xf5b8('0x6a')]({'body':_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x65')],'ChatWebsiteId':_0x39e1c5[_0xf5b8('0x73')]['id'],'ChatInteractionId':_0xfeb07c['id'],'direction':'in','ContactId':_0x1081a5[_0xf5b8('0xb6')]['id'],'AttachmentId':_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xc6')]});})[_0xf5b8('0x18')](function(_0x282dfe){_0x1081a5[_0xf5b8('0x21')]=_0x282dfe;if(!_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xc7')]){return;}return db[_0xf5b8('0xc8')]['find']({'attributes':['id',_0xf5b8('0x33')],'where':{'id':_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xc7')]}});})[_0xf5b8('0x18')](function(_0x238ff4){if(_0x238ff4){_0x1081a5[_0xf5b8('0xae')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf5b8('0xc9'),'appdata':_0x238ff4[_0xf5b8('0x33')]+','+(_0x1081a5['account'][_0xf5b8('0xca')]||0xa),'interval':_0xf5b8('0xc4')});_0x1081a5[_0xf5b8('0xcb')]=!![];}if(!_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xcc')]){return;}return db[_0xf5b8('0xcd')][_0xf5b8('0x6f')]({'attributes':['id',_0xf5b8('0x33')],'where':{'id':_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xcc')]}});})['then'](function(_0x4b78ef){if(_0x4b78ef){_0x1081a5['applications'][_0xf5b8('0xce')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4b78ef[_0xf5b8('0x33')]+','+(_0x1081a5['account'][_0xf5b8('0xcf')]||0x12c),'interval':_0xf5b8('0xc4')});}return respondWithRpcPromise('Start','startRouting',_0x1081a5);})[_0xf5b8('0x18')](function(_0x36b4c5){respondWithRpcPromise(_0xf5b8('0xd0'),_0xf5b8('0xd0'),{'event':_0xf5b8('0x9d'),'message':_0x36b4c5},client9002);return _0x36b4c5;})[_0xf5b8('0x18')](respondWithResult(_0x1a728f,null))[_0xf5b8('0x23')](APIHandleError(_0x1a728f));};exports[_0xf5b8('0xd1')]=function(_0x26aaa3,_0x3a0bfe){var _0x47772a,_0x43f722,_0x1f786d;var _0x152d92=[];var _0x3183c8={};var _0x186787=_0x26aaa3[_0xf5b8('0xd2')]||[];var _0x24e741=[];var _0xb7a643;return db['CmContact'][_0xf5b8('0x74')]()[_0xf5b8('0x18')](function(_0x1b4cc9){if(!_0x1b4cc9){throw new db[(_0xf5b8('0xd3'))][(_0xf5b8('0xd4'))](_0xf5b8('0xd5'));}_0x152d92=_[_0xf5b8('0xd6')](_[_0xf5b8('0x50')](_0x1b4cc9),[_0xf5b8('0xa4'),_0xf5b8('0xa5'),_0xf5b8('0xa6'),_0xf5b8('0xa7')]);if(_0x26aaa3['body']['id']){delete _0x26aaa3['body']['id'];}if(_[_0xf5b8('0x8f')](_0x26aaa3['body'][_0xf5b8('0x9f')])){throw _0x3a0bfe[_0xf5b8('0x25')](0x1f4)['send'](new db[(_0xf5b8('0xd3'))][(_0xf5b8('0xd4'))](_0xf5b8('0xd7')));}if(_[_0xf5b8('0x8f')](_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x65')])||_0x26aaa3['body']['body']===''){throw _0x3a0bfe[_0xf5b8('0x25')](0x1f4)[_0xf5b8('0x34')](new db['Sequelize']['ValidationError'](_0xf5b8('0xd8')));}if(_[_0xf5b8('0x8f')](_0x26aaa3['body']['mapKeyOffline'])){throw _0x3a0bfe['status'](0x1f4)[_0xf5b8('0x34')](new db[(_0xf5b8('0xd3'))][(_0xf5b8('0xd4'))](_0xf5b8('0xd9')+_0x152d92));}if(!_[_0xf5b8('0xda')](_0x152d92,_0x26aaa3[_0xf5b8('0x65')]['mapKeyOffline'])){throw _0x3a0bfe[_0xf5b8('0x25')](0x1f4)[_0xf5b8('0x34')](new db[(_0xf5b8('0xd3'))]['ValidationError'](_0xf5b8('0xdb')+_0x152d92));}_0x3183c8[_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0xdc')]]=_0x26aaa3[_0xf5b8('0x65')]['from'];})[_0xf5b8('0x18')](function(){return db[_0xf5b8('0x4e')]['find']({'where':{'id':_0x26aaa3[_0xf5b8('0x73')]['id']},'include':[{'model':db[_0xf5b8('0xa9')],'as':_0xf5b8('0xb1')},{'model':db[_0xf5b8('0xdd')],'as':_0xf5b8('0xdd')}]});})[_0xf5b8('0x18')](handleEntityNotFound(_0x3a0bfe,null))[_0xf5b8('0x18')](function(_0x5cfa21){if(_0x5cfa21&&_0x5cfa21[_0xf5b8('0xb1')]){_0x43f722=_0x5cfa21;var _0x241e93=_[_0xf5b8('0xb4')](_0x26aaa3['body'],{'firstName':_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x9f')],'phone':_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x9f')],'ListId':_0x5cfa21[_0xf5b8('0xa7')]});_0x241e93[_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0xdc')]]=_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x9f')];return db[_0xf5b8('0xb5')]['findOrCreate']({'where':_0x3183c8,'defaults':_0x241e93});}})[_0xf5b8('0xde')](function(_0x53b8d7){if(_0x53b8d7){_0x1f786d=_0x53b8d7;var _0x3277ef=fs[_0xf5b8('0xdf')](path[_0xf5b8('0x8a')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x597be9=ejs[_0xf5b8('0xe0')](_0x3277ef,{'body':_['toPairs'](_0x26aaa3[_0xf5b8('0x65')]['body']),'bodyTitle':_0x43f722[_0xf5b8('0xe1')]});return db[_0xf5b8('0xe2')][_0xf5b8('0x6a')]({'body':_0x597be9,'plainBody':htmlToText[_0xf5b8('0xe3')](_0x597be9),'ContactId':_0x53b8d7['id'],'ChatWebsiteId':_0x43f722['id']});}})[_0xf5b8('0x18')](function(_0x1bd931){_0xb7a643=_0x1bd931;if(_0x186787[_0xf5b8('0x63')]){var _0x57ff00=_0x186787[_0xf5b8('0x4d')](function(_0x24ce4d){return{'name':_0x24ce4d[_0xf5b8('0xe4')],'basename':_0x24ce4d[_0xf5b8('0x82')],'type':_0x24ce4d[_0xf5b8('0xe5')],'ChatOfflineMessageId':_0x1bd931['id']};});_0x24e741=_0x57ff00['map'](_0x41044c=>{var _0x4d3b24={'filename':_0x41044c[_0xf5b8('0x33')],'path':path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0xe6'),'files','attachments',_0xf5b8('0xe7'),_0x41044c[_0xf5b8('0xe8')])};return _0x4d3b24;});if(!_0x43f722[_0xf5b8('0xe9')]){return db[_0xf5b8('0xea')]['transaction'](function(_0x4dbc1b){return db[_0xf5b8('0xeb')][_0xf5b8('0xec')](_0x57ff00,{'transaction':_0x4dbc1b});});}}})['then'](function(){if(_0xb7a643){_0x47772a=_0xb7a643;return db[_0xf5b8('0xdd')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf5b8('0xed')],'as':_0xf5b8('0xee'),'raw':!![],'include':[{'model':db[_0xf5b8('0xef')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xf5b8('0x18')](function(_0x2352e7){if(_0x2352e7&&_0x2352e7[_0xf5b8('0xee')]&&_0x43f722[_0xf5b8('0xf0')]&&_0x43f722[_0xf5b8('0xf1')]){var _0x40557f=_0x2352e7['getSmtpOptions']();return respondWithRpcPromise(_0xf5b8('0xf2'),'sendMail',{'account':_0x40557f,'message':{'from':util[_0xf5b8('0x45')]('\x22%s\x22\x20<%s>',_0x2352e7[_0xf5b8('0x33')],_0x2352e7[_0xf5b8('0xf3')]||_0x2352e7[_0xf5b8('0xee')][_0xf5b8('0x6d')]),'to':_0x43f722[_0xf5b8('0xf1')],'subject':_0x43f722['offlineMessageSubject'],'html':_0x47772a[_0xf5b8('0x65')],'attachments':_0x24e741}},client9003)[_0xf5b8('0x18')](function(){return _0x47772a;})['catch'](function(_0x19bf82){logger[_0xf5b8('0x1e')](_0x19bf82);});}})[_0xf5b8('0x18')](function(){if(_0x43f722&&_0x43f722[_0xf5b8('0xe9')]&&_0x43f722[_0xf5b8('0xf4')]){var _0x2de543=[];if(_0x186787[_0xf5b8('0x63')]){_0x2de543=_0x186787[_0xf5b8('0x4d')](function(_0x1b5bbc){return{'name':_0x1b5bbc[_0xf5b8('0xe4')],'basename':_0x1b5bbc['filename'],'type':_0x1b5bbc[_0xf5b8('0xe5')],'ChatOfflineMessageId':_0xb7a643['id']};});}var _0x5d7b6f;if(!_[_0xf5b8('0x8f')](_0x43f722[_0xf5b8('0xf5')])){var _0x3a133c=_['map'](_0x26aaa3[_0xf5b8('0x65')],function(_0x489f34){return _0x489f34;});var _0x23de58=_[_0xf5b8('0xf6')](_0x3a133c)[0x0];var _0x17c449=_[_0xf5b8('0xf7')](_0x23de58,function(_0x2cbcb2){return _0x2cbcb2;});_0x5d7b6f=_0x17c449[0x1][_0x43f722[_0xf5b8('0xf5')]];}var _0x123206={'from':_0x1f786d[_0xf5b8('0xf3')],'firstName':_0x1f786d[_0xf5b8('0x3d')],'lastName':_0x1f786d[_0xf5b8('0x3e')],'mapKey':_0xf5b8('0xf3'),'message':{'from':_0x1f786d[_0xf5b8('0xf3')],'to':_0x43f722['MailAccount']['email'],'cc':'','subject':_[_0xf5b8('0x8f')](_0x5d7b6f)?_0x43f722['offlineMessageSubject']:_0x5d7b6f,'messageId':'','sentAt':new Date(),'attach':_0x2de543['length'],'attachments':_0x2de543,'originChannel':_0xf5b8('0xf8'),'ChatWebsiteId':_0x43f722['id'],'ChatOfflineMessageId':_0x47772a['id'],'originTo':_0x43f722[_0xf5b8('0xdd')][_0xf5b8('0xf3')]},'body':_0x47772a[_0xf5b8('0x65')]};var _0x41a88b={'account':{'id':_0x43f722[_0xf5b8('0xf4')]},'body':_0x123206,'log':_0xf5b8('0xf9')};return respondWithRpcPromise('NotifyMailAccount',_0xf5b8('0xfa'),_0x41a88b,client9001)[_0xf5b8('0x18')](function(){return _0x47772a;})['catch'](function(_0xf12104){logger['error'](_0xf12104);});}return;})[_0xf5b8('0x18')](function(){if(_0x47772a){return _0x47772a;}})[_0xf5b8('0x18')](respondWithResult(_0x3a0bfe,null))[_0xf5b8('0x23')](function(){for(var _0x71c0a8 of _0x186787){var _0x4cfdfd=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0xe6'),'files','attachments',_0xf5b8('0xe7'),_0x71c0a8['filename']);fs_extra[_0xf5b8('0xfb')](_0x4cfdfd)[_0xf5b8('0x23')](function(_0xa5ce09){logger[_0xf5b8('0x1e')](_0xf5b8('0xfc'),_0x4cfdfd,_0xa5ce09);});}});};exports[_0xf5b8('0xfd')]=function(_0x4938d2,_0x3a60a3){return db[_0xf5b8('0xba')][_0xf5b8('0x6f')]({'where':{'id':_0x4938d2[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x3a60a3,null))[_0xf5b8('0x18')](function(_0x573ef9){if(_0x573ef9){return _0x573ef9[_0xf5b8('0xfd')](_0x4938d2[_0xf5b8('0x65')][_0xf5b8('0x7f')],_[_0xf5b8('0xfe')](_0x4938d2['body'],[_0xf5b8('0x7f'),'id'])||{});}})[_0xf5b8('0x18')](respondWithResult(_0x3a60a3,null))[_0xf5b8('0x23')](handleError(_0x3a60a3,null));};exports['getInteractions']=function(_0xed9e3f,_0x1b6188){var _0x1c04af={'raw':![],'where':{}};var _0x2f91c9={};var _0x142055={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0xed9e3f['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x1b6188,null))[_0xf5b8('0x18')](function(_0x3fa075){if(_0x3fa075){_0x2f91c9[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0xba')][_0xf5b8('0x62')]);_0x2f91c9[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0xed9e3f['query']);_0x2f91c9[_0xf5b8('0x51')]=_['intersection'](_0x2f91c9[_0xf5b8('0x48')],_0x2f91c9[_0xf5b8('0x4f')]);_0x1c04af[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x2f91c9[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x54')]));_0x1c04af['attributes']=_0x1c04af[_0xf5b8('0x53')]['length']?_0x1c04af['attributes']:_0x2f91c9[_0xf5b8('0x48')];if(!_0xed9e3f[_0xf5b8('0x4f')]['hasOwnProperty'](_0xf5b8('0x56'))){_0x1c04af[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x1c04af['offset']=qs[_0xf5b8('0x27')](_0xed9e3f['query'][_0xf5b8('0x27')]);}_0x1c04af[_0xf5b8('0x57')]=qs['sort'](_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x1c04af['where']=qs['filters'](_[_0xf5b8('0x5a')](_0xed9e3f[_0xf5b8('0x4f')],_0x2f91c9[_0xf5b8('0x51')]));_0x1c04af[_0xf5b8('0x59')][_0xf5b8('0x75')]=_0x3fa075['id'];if(_0xed9e3f['query'][_0xf5b8('0x5b')]){_0x1c04af[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x1c04af[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x1c04af[_0xf5b8('0x53')],function(_0x5840a6){var _0x52fb3d={};_0x52fb3d[_0x5840a6]={'$like':'%'+_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x52fb3d;})});}_0x1c04af=_['merge']({},_0x1c04af,_0xed9e3f[_0xf5b8('0x5e')]);return db[_0xf5b8('0xba')][_0xf5b8('0x29')]({'where':_0x1c04af['where']})['then'](function(_0x57903c){_0x142055[_0xf5b8('0x29')]=_0x57903c;if(_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x64')]){_0x1c04af[_0xf5b8('0x5f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xf5b8('0xc8')],'as':_0xf5b8('0xff'),'attributes':[_0xf5b8('0x33'),_0xf5b8('0x100'),'internal'],'required':![]},{'model':db[_0xf5b8('0x101')],'as':'Tags','attributes':['id','name',_0xf5b8('0x102')],'where':_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x103')]?{'id':_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x103')]}:undefined,'required':_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x103')]?!![]:![]}];}return db[_0xf5b8('0xba')][_0xf5b8('0x78')](_0x1c04af);})[_0xf5b8('0x18')](function(_0x36d403){_0x142055[_0xf5b8('0x60')]=_0x36d403;return _0x142055;});}})[_0xf5b8('0x18')](respondWithFilteredResult(_0x1b6188,_0x1c04af))[_0xf5b8('0x23')](handleError(_0x1b6188,null));};exports[_0xf5b8('0x104')]=function(_0xc3ce98,_0x16a3d4){var _0x28f996=0x0;var _0x30e09b=0x0;var _0x2f815b=![];var _0x2ad683;var _0x478fe2;return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0xc3ce98[_0xf5b8('0x73')]['id']},'include':[{'model':db[_0xf5b8('0x9b')],'as':_0xf5b8('0x9b'),'include':[{'model':db[_0xf5b8('0x9b')],'as':'Intervals','attributes':['id',_0xf5b8('0xac')]}]}]})[_0xf5b8('0x18')](handleEntityNotFound(_0x16a3d4,null))[_0xf5b8('0x18')](function(_0x3b73e4){if(_0x3b73e4){_0x2ad683=_0x3b73e4;return _0x3b73e4[_0xf5b8('0x105')]({'raw':!![]});}})[_0xf5b8('0x18')](function(_0x13b138){if(_0x2ad683){if(_0x13b138){_0x478fe2=_0x13b138;}}return require(_0xf5b8('0x8c'))[_0xf5b8('0x8d')]();})[_0xf5b8('0x18')](function(_0x511b5e){if(_0x511b5e){_0x30e09b=_0x511b5e[_0xf5b8('0x106')];_0x2f815b=_0x511b5e[_0xf5b8('0x8e')];}})[_0xf5b8('0x18')](function(){return db[_0xf5b8('0xba')][_0xf5b8('0x29')]({'where':{'closed':![]}});})[_0xf5b8('0x18')](function(_0x4bce1e){_0x28f996=_0x4bce1e;if(_0x30e09b&&_0x4bce1e>_0x30e09b){return db[_0xf5b8('0x107')]['findOne']({'where':{'id':0x1}})[_0xf5b8('0x18')](function(_0x1b587a){if(_0x1b587a){_0x1b587a['increment'](_0xf5b8('0x108'));}});}})['then'](function(){var _0x39ccf1=_0x2ad683['Interval'];var _0x54e76=_0x2ad683[_0xf5b8('0x109')]||undefined;return _0x39ccf1?_0x39ccf1[_0xf5b8('0x9c')](_0x54e76):!![];})[_0xf5b8('0x18')](function(_0x1ca2d6){var _0x2da0ba=fs[_0xf5b8('0xdf')](path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x10a')),_0xf5b8('0x10b'));var _0x5654a4=_0xf5b8('0x10c');var _0xb3acd4=![];var _0x1a4861,_0x1fcd89;if(_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x40')]){_0x1a4861=new URL(_0xc3ce98['headers'][_0xf5b8('0x40')])['origin'];}else if(_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x10d')]){_0x1a4861=new URL(_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x10d')])[_0xf5b8('0x10d')];}else{_0x1a4861=_0xf5b8('0x10e');}_0x1fcd89=typeof _0x2ad683[_0xf5b8('0x66')][_0xf5b8('0x3c')](',')[_0xf5b8('0x6f')](function(_0x101faa){return wildcardUtils[_0xf5b8('0x10f')](_0x101faa,_0x1a4861);})!==_0xf5b8('0x28');var _0x206e47={'chatVersion':_0x5654a4,'chatWebsiteAddressOrigin':_0x1fcd89?_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x40')]:_0x2ad683[_0xf5b8('0x66')],'remote':_0x2ad683[_0xf5b8('0x110')],'query':querystring['stringify'](_[_0xf5b8('0x5c')](_0x2ad683[_0xf5b8('0x2e')]({'plain':!![]}),{'customerIp':_0xc3ce98[_0xf5b8('0xb7')]['x-forwarded-for']||_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x111')]||_0xc3ce98[_0xf5b8('0x112')][_0xf5b8('0x113')]||_0xc3ce98['ip'],'referer':_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x40')],'openedInteractions':_0x28f996,'maxInteractions':_0x30e09b,'virtual':_0x2f815b[_0xf5b8('0x106')],'online':_0x1ca2d6,'custom':_0x2f815b,'address':_0x1fcd89?_0xc3ce98[_0xf5b8('0xb7')]['referer']:null}))['replace'](/'/g,'\x5c\x27')};_0x16a3d4[_0xf5b8('0x34')](ejs[_0xf5b8('0xe0')](Mustache[_0xf5b8('0xe0')](_0x2da0ba,_0x206e47),{'proactiveActions':_0x478fe2,'alignment':_0x2ad683[_0xf5b8('0x114')],'verticalAlignment':_0x2ad683[_0xf5b8('0x115')],'div_color':_0x2ad683[_0xf5b8('0x102')],'labelText':_0x2ad683[_0xf5b8('0x116')],'text_color':_0x2ad683[_0xf5b8('0x117')],'text_button_color':_0x2ad683['textButtonColor'],'button_color':_0x2ad683['color_button'],'background_color':_0x2ad683[_0xf5b8('0x118')],'hideWhenOffline':_0x2ad683[_0xf5b8('0x119')],'intervalId':_0x2ad683[_0xf5b8('0x11a')],'isDevelopment':_0xb3acd4,'chatVersion':_0x5654a4}));})[_0xf5b8('0x23')](handleError(_0x16a3d4,null));};exports['addApplications']=function(_0x1c984d,_0x446ed5){var _0xeed1f1=_0x1c984d['params']['id'];var _0x5ea232=_0x1c984d['body'];var _0x2706a0=0xc8;var _0x301622=null;return db[_0xf5b8('0xea')]['transaction']({'isolationLevel':db[_0xf5b8('0xea')]['Transaction'][_0xf5b8('0x11b')][_0xf5b8('0x11c')]},function(_0xaaf983){return db['ChatWebsite'][_0xf5b8('0x7c')]({'where':{'id':_0xeed1f1},'transaction':_0xaaf983})[_0xf5b8('0x18')](function(_0x5e5b3a){if(_0x5e5b3a){return db[_0xf5b8('0x11d')][_0xf5b8('0x2d')]({'where':{'ChatWebsiteId':_0xeed1f1},'transaction':_0xaaf983})[_0xf5b8('0x18')](function(){var _0x54234c=_['map'](_0x5ea232,function(_0x53794c){_0x53794c[_0xf5b8('0x75')]=_0xeed1f1;return _0x53794c;});return db[_0xf5b8('0x11d')][_0xf5b8('0xec')](_0x54234c,{'transaction':_0xaaf983});});}else{_0x2706a0=0x194;_0x301622=[];}});})[_0xf5b8('0x18')](function(){if(_0x2706a0!==0x194){return db['ChatApplication'][_0xf5b8('0x11e')]({'where':{'ChatWebsiteId':_0xeed1f1},'order':_0xf5b8('0xaf')})[_0xf5b8('0x18')](function(_0x1c1c55){_0x301622=_0x1c1c55;});}})[_0xf5b8('0x23')](function(_0x535a9c){_0x2706a0=0x1f4;logger[_0xf5b8('0x1e')](_0x535a9c[_0xf5b8('0x32')]);if(_0x535a9c['name']){delete _0x535a9c[_0xf5b8('0x33')];}_0x301622=_0x535a9c;})['finally'](function(){if(_0x301622===null){_0x446ed5['sendStatus'](_0x2706a0);}else{if(_0x2706a0===0x1f4){_0x446ed5['status'](_0x2706a0)[_0xf5b8('0x34')](_0x301622);}else{_0x446ed5[_0xf5b8('0x25')](_0x2706a0)[_0xf5b8('0x26')](_0x301622);}}});};exports[_0xf5b8('0x11f')]=function(_0x5a1575,_0x13e040){var _0x59c45f={};var _0x36caec={};var _0x4934cb;var _0x31bebc;return db[_0xf5b8('0x4e')]['findOne']({'where':{'id':_0x5a1575[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x13e040,null))[_0xf5b8('0x18')](function(_0xddf334){if(_0xddf334){_0x4934cb=_0xddf334;_0x36caec['model']=_[_0xf5b8('0x50')](db[_0xf5b8('0x11d')][_0xf5b8('0x62')]);_0x36caec['query']=_[_0xf5b8('0x50')](_0x5a1575[_0xf5b8('0x4f')]);_0x36caec[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x36caec['model'],_0x36caec['query']);_0x59c45f[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x36caec[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x5a1575['query'][_0xf5b8('0x54')]));_0x59c45f['attributes']=_0x59c45f['attributes'][_0xf5b8('0x63')]?_0x59c45f[_0xf5b8('0x53')]:_0x36caec[_0xf5b8('0x48')];_0x59c45f['order']=qs['sort'](_0x5a1575[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x59c45f[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x5a1575[_0xf5b8('0x4f')],_0x36caec[_0xf5b8('0x51')]));if(_0x5a1575['query']['filter']){_0x59c45f[_0xf5b8('0x59')]=_['merge'](_0x59c45f[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x59c45f[_0xf5b8('0x53')],function(_0x45e3ec){var _0x305cab={};_0x305cab[_0x45e3ec]={'$like':'%'+_0x5a1575['query'][_0xf5b8('0x5b')]+'%'};return _0x305cab;})});}_0x59c45f=_[_0xf5b8('0x5c')]({},_0x59c45f,_0x5a1575[_0xf5b8('0x5e')]);return _0x4934cb['getApplications'](_0x59c45f);}})[_0xf5b8('0x18')](function(_0x388bd2){if(_0x388bd2){_0x31bebc=_0x388bd2[_0xf5b8('0x63')];if(!_0x5a1575[_0xf5b8('0x4f')][_0xf5b8('0x55')]('nolimit')){_0x59c45f[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0x5a1575[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x59c45f[_0xf5b8('0x27')]=qs['offset'](_0x5a1575[_0xf5b8('0x4f')]['offset']);}return _0x4934cb['getApplications'](_0x59c45f);}})[_0xf5b8('0x18')](function(_0x5d485a){if(_0x5d485a){return _0x5d485a?{'count':_0x31bebc,'rows':_0x5d485a}:null;}})[_0xf5b8('0x18')](respondWithResult(_0x13e040,null))['catch'](handleError(_0x13e040,null));};exports[_0xf5b8('0x120')]=function(_0x5a1422,_0x415397){return db[_0xf5b8('0x121')]['find']({'where':{'id':_0x5a1422[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x415397,null))[_0xf5b8('0x18')](function(_0x420ab1){if(_0x420ab1){return _0x420ab1['addProactiveActions'](_0x5a1422[_0xf5b8('0x65')][_0xf5b8('0x7f')],_[_0xf5b8('0xfe')](_0x5a1422[_0xf5b8('0x65')],[_0xf5b8('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x415397,null))[_0xf5b8('0x23')](handleError(_0x415397,null));};exports[_0xf5b8('0x105')]=function(_0x48083c,_0x4b5353){var _0x4b6dd1={};var _0x532f9d={};var _0x564ff1;var _0x164da9;return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0x48083c[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4b5353,null))[_0xf5b8('0x18')](function(_0x1aa8b0){if(_0x1aa8b0){_0x564ff1=_0x1aa8b0;_0x532f9d['model']=_[_0xf5b8('0x50')](db[_0xf5b8('0x122')][_0xf5b8('0x62')]);_0x532f9d[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x48083c[_0xf5b8('0x4f')]);_0x532f9d[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x532f9d[_0xf5b8('0x48')],_0x532f9d[_0xf5b8('0x4f')]);_0x4b6dd1[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x532f9d[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x48083c[_0xf5b8('0x4f')]['fields']));_0x4b6dd1[_0xf5b8('0x53')]=_0x4b6dd1[_0xf5b8('0x53')][_0xf5b8('0x63')]?_0x4b6dd1[_0xf5b8('0x53')]:_0x532f9d['model'];_0x4b6dd1[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x48083c['query']['sort']);_0x4b6dd1['where']=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x48083c[_0xf5b8('0x4f')],_0x532f9d[_0xf5b8('0x51')]));if(_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x5b')]){_0x4b6dd1[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x4b6dd1['where'],{'$or':_[_0xf5b8('0x4d')](_0x4b6dd1['attributes'],function(_0x472e58){var _0x3e9fd3={};_0x3e9fd3[_0x472e58]={'$like':'%'+_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x3e9fd3;})});}_0x4b6dd1=_[_0xf5b8('0x5c')]({},_0x4b6dd1,_0x48083c[_0xf5b8('0x5e')]);return _0x564ff1[_0xf5b8('0x105')](_0x4b6dd1);}})['then'](function(_0x30ba73){if(_0x30ba73){_0x164da9=_0x30ba73[_0xf5b8('0x63')];if(!_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x4b6dd1[_0xf5b8('0x2a')]=qs['limit'](_0x48083c['query'][_0xf5b8('0x2a')]);_0x4b6dd1[_0xf5b8('0x27')]=qs['offset'](_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x27')]);}return _0x564ff1[_0xf5b8('0x105')](_0x4b6dd1);}})[_0xf5b8('0x18')](function(_0x276df8){if(_0x276df8){return _0x276df8?{'count':_0x164da9,'rows':_0x276df8}:null;}})[_0xf5b8('0x18')](respondWithResult(_0x4b5353,null))[_0xf5b8('0x23')](handleError(_0x4b5353,null));};exports[_0xf5b8('0x123')]=function(_0x230794,_0x73d8b4){var _0x59eaf5=_0x230794['query'][_0xf5b8('0x124')]===_0xf5b8('0x125')?'offlineForm':_0xf5b8('0x126');return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'attributes':['id',_0x59eaf5],'where':{'id':_0x230794[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x73d8b4,null))[_0xf5b8('0x18')](function(_0x1648d8){if(_0x1648d8){var _0x7cb0c5=_0x1648d8[_0x59eaf5];var _0x3689f1=_0x7cb0c5&&_0x7cb0c5['items']?_0x7cb0c5[_0xf5b8('0x127')]:[];_0x73d8b4[_0xf5b8('0x34')]({'fromKey':_[_0xf5b8('0x8f')](_0x7cb0c5[_0xf5b8('0x128')])?undefined:_0x7cb0c5[_0xf5b8('0x128')],'count':_0x3689f1[_0xf5b8('0x63')],'rows':_0x3689f1});}})[_0xf5b8('0x23')](handleError(_0x73d8b4,null));};exports[_0xf5b8('0x129')]=function(_0x48b1f6,_0x4a2d32){var _0x51ff7d={'raw':![],'where':{}};var _0x58d110={};var _0x10d940={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0x48b1f6['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4a2d32,null))[_0xf5b8('0x18')](function(_0x236ed6){if(_0x236ed6){_0x58d110[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0xe2')]['rawAttributes']);_0x58d110[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x48b1f6[_0xf5b8('0x4f')]);_0x58d110[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x58d110[_0xf5b8('0x48')],_0x58d110[_0xf5b8('0x4f')]);_0x51ff7d[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x58d110[_0xf5b8('0x48')],qs['fields'](_0x48b1f6[_0xf5b8('0x4f')]['fields']));_0x51ff7d[_0xf5b8('0x53')]=_0x51ff7d[_0xf5b8('0x53')]['length']?_0x51ff7d[_0xf5b8('0x53')]:_0x58d110[_0xf5b8('0x48')];if(!_0x48b1f6[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x51ff7d[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0x48b1f6[_0xf5b8('0x4f')]['limit']);_0x51ff7d[_0xf5b8('0x27')]=qs['offset'](_0x48b1f6[_0xf5b8('0x4f')][_0xf5b8('0x27')]);}_0x51ff7d[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x48b1f6[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x51ff7d[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x48b1f6['query'],_0x58d110[_0xf5b8('0x51')]));_0x51ff7d['where'][_0xf5b8('0x75')]=_0x236ed6['id'];if(_0x48b1f6[_0xf5b8('0x4f')]['filter']){_0x51ff7d[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x51ff7d[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x51ff7d[_0xf5b8('0x53')],function(_0x3e6925){var _0x13c9e8={};_0x13c9e8[_0x3e6925]={'$like':'%'+_0x48b1f6[_0xf5b8('0x4f')]['filter']+'%'};return _0x13c9e8;})});}_0x51ff7d=_[_0xf5b8('0x5c')]({},_0x51ff7d,_0x48b1f6['options']);return db['ChatOfflineMessage'][_0xf5b8('0x29')]({'where':_0x51ff7d[_0xf5b8('0x59')]})[_0xf5b8('0x18')](function(_0x45c3e8){_0x10d940[_0xf5b8('0x29')]=_0x45c3e8;if(_0x48b1f6['query'][_0xf5b8('0x64')]){_0x51ff7d['include']=[{'all':!![]}];}else{_0x51ff7d[_0xf5b8('0x5f')]=[{'model':db[_0xf5b8('0xb5')],'as':_0xf5b8('0x12a'),'required':![]},{'model':db[_0xf5b8('0xeb')],'as':_0xf5b8('0x12b'),'required':![]}];}return db[_0xf5b8('0xe2')][_0xf5b8('0x78')](_0x51ff7d);})[_0xf5b8('0x18')](function(_0xf70ada){_0x10d940[_0xf5b8('0x60')]=_0xf70ada;return _0x10d940;});}})[_0xf5b8('0x18')](respondWithFilteredResult(_0x4a2d32,_0x51ff7d))[_0xf5b8('0x23')](handleError(_0x4a2d32,null));};exports[_0xf5b8('0x12c')]=function(_0x4361b3,_0x4ccefc){return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x4361b3[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4ccefc,null))[_0xf5b8('0x18')](function(_0x5b7b93){if(_0x5b7b93){return _0x5b7b93[_0xf5b8('0x12c')](_0x4361b3[_0xf5b8('0x65')][_0xf5b8('0x7f')],_[_0xf5b8('0xfe')](_0x4361b3[_0xf5b8('0x65')],[_0xf5b8('0x7f'),'id'])||{})[_0xf5b8('0xde')](function(_0x53b36e){for(var _0xf1b184=0x0;_0xf1b184<_0x4361b3[_0xf5b8('0x65')][_0xf5b8('0x7f')][_0xf5b8('0x63')];_0xf1b184+=0x1){socket[_0xf5b8('0x12d')](_0xf5b8('0x12e'),{'UserId':Number(_0x4361b3[_0xf5b8('0x65')][_0xf5b8('0x7f')][_0xf1b184]),'ChatWebsiteId':Number(_0x4361b3[_0xf5b8('0x73')]['id'])});}return _0x53b36e;});}})['then'](respondWithResult(_0x4ccefc,null))[_0xf5b8('0x23')](handleError(_0x4ccefc,null));};exports[_0xf5b8('0x12f')]=function(_0x254bf7,_0x274a96){return db[_0xf5b8('0x4e')]['find']({'where':{'id':_0x254bf7['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x274a96,null))['then'](function(_0x4d134c){if(_0x4d134c){return _0x4d134c[_0xf5b8('0x12f')](_0x254bf7[_0xf5b8('0x4f')][_0xf5b8('0x7f')])[_0xf5b8('0x18')](function(){if(_['isArray'](_0x254bf7[_0xf5b8('0x4f')][_0xf5b8('0x7f')])){for(var _0x1f6fac=0x0;_0x1f6fac<_0x254bf7[_0xf5b8('0x4f')]['ids'][_0xf5b8('0x63')];_0x1f6fac+=0x1){socket[_0xf5b8('0x12d')](_0xf5b8('0x130'),{'UserId':Number(_0x254bf7['query'][_0xf5b8('0x7f')][_0x1f6fac]),'ChatWebsiteId':Number(_0x254bf7[_0xf5b8('0x73')]['id'])});}}else{socket[_0xf5b8('0x12d')](_0xf5b8('0x130'),{'UserId':Number(_0x254bf7[_0xf5b8('0x4f')][_0xf5b8('0x7f')]),'ChatWebsiteId':Number(_0x254bf7[_0xf5b8('0x73')]['id'])});}});}})[_0xf5b8('0x18')](respondWithStatusCode(_0x274a96,null))['catch'](handleError(_0x274a96,null));};exports[_0xf5b8('0x131')]=function(_0x3cd565,_0x441036){var _0x4790bc={};var _0x24415d={};var _0xf9110c;var _0x3eab19;return db[_0xf5b8('0x4e')]['findOne']({'where':{'id':_0x3cd565['params']['id']}})['then'](handleEntityNotFound(_0x441036,null))[_0xf5b8('0x18')](function(_0x574040){if(_0x574040){_0xf9110c=_0x574040;_0x24415d[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db['User']['rawAttributes']);_0x24415d['query']=_[_0xf5b8('0x50')](_0x3cd565['query']);_0x24415d[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x24415d['model'],_0x24415d[_0xf5b8('0x4f')]);_0x4790bc[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x24415d[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x54')]));_0x4790bc[_0xf5b8('0x53')]=_0x4790bc[_0xf5b8('0x53')][_0xf5b8('0x63')]?_0x4790bc['attributes']:_0x24415d[_0xf5b8('0x48')];_0x4790bc[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x4790bc[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_['pick'](_0x3cd565['query'],_0x24415d[_0xf5b8('0x51')]));if(_0x3cd565['query'][_0xf5b8('0x5b')]){_0x4790bc[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x4790bc[_0xf5b8('0x59')],{'$or':_['map'](_0x4790bc[_0xf5b8('0x53')],function(_0x17081b){var _0x1b978d={};_0x1b978d[_0x17081b]={'$like':'%'+_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x1b978d;})});}_0x4790bc=_['merge']({},_0x4790bc,_0x3cd565[_0xf5b8('0x5e')]);return _0xf9110c['getAgents'](_0x4790bc);}})[_0xf5b8('0x18')](function(_0x1a6480){if(_0x1a6480){_0x3eab19=_0x1a6480[_0xf5b8('0x63')];if(!_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x4790bc[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x4790bc[_0xf5b8('0x27')]=qs[_0xf5b8('0x27')](_0x3cd565[_0xf5b8('0x4f')]['offset']);}return _0xf9110c['getAgents'](_0x4790bc);}})[_0xf5b8('0x18')](function(_0x55e783){if(_0x55e783){return _0x55e783?{'count':_0x3eab19,'rows':_0x55e783}:null;}})['then'](respondWithResult(_0x441036,null))[_0xf5b8('0x23')](handleError(_0x441036,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 708bfbd..56c327d 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 _0x7266=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x57a634,_0x266a81){var _0x4c47cb=function(_0x4ddfda){while(--_0x4ddfda){_0x57a634['push'](_0x57a634['shift']());}};_0x4c47cb(++_0x266a81);}(_0x7266,0xec));var _0x6726=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7266[_0x4243a3];return _0x1b2a33;};'use strict';var EventEmitter=require(_0x6726('0x0'));var ChatWebsite=require(_0x6726('0x1'))['db'][_0x6726('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6726('0x3')](0x0);var events={'afterCreate':_0x6726('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47093e){return function(_0x4e215d,_0x5939ff,_0x562250){ChatWebsiteEvents[_0x6726('0x5')](_0x47093e+':'+_0x4e215d['id'],_0x4e215d);ChatWebsiteEvents[_0x6726('0x5')](_0x47093e,_0x4e215d);_0x562250(null);};}for(var e in events){if(events[_0x6726('0x6')](e)){var event=events[e];ChatWebsite[_0x6726('0x7')](e,emitEvent(event));}}module[_0x6726('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x291c=['save','update','remove','emit','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x3d0dc3,_0x1e5e5a){var _0x3435c7=function(_0x30b7a9){while(--_0x30b7a9){_0x3d0dc3['push'](_0x3d0dc3['shift']());}};_0x3435c7(++_0x1e5e5a);}(_0x291c,0x137));var _0xc291=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x291c[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xc291('0x0'));var ChatWebsite=require(_0xc291('0x1'))['db'][_0xc291('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc291('0x3')](0x0);var events={'afterCreate':_0xc291('0x4'),'afterUpdate':_0xc291('0x5'),'afterDestroy':_0xc291('0x6')};function emitEvent(_0x7b34d6){return function(_0xafdfee,_0x118ddf,_0x187a34){ChatWebsiteEvents['emit'](_0x7b34d6+':'+_0xafdfee['id'],_0xafdfee);ChatWebsiteEvents[_0xc291('0x7')](_0x7b34d6,_0xafdfee);_0x187a34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xc291('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2cf4144..c9120a2 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 _0x21ab=['request-promise','path','rimraf','./chatWebsite.attributes','exports','define','chat_websites','util','api'];(function(_0x13dbf3,_0x39527e){var _0x5920b9=function(_0x266348){while(--_0x266348){_0x13dbf3['push'](_0x13dbf3['shift']());}};_0x5920b9(++_0x39527e);}(_0x21ab,0xdf));var _0xb21a=function(_0x4d0d85,_0x1d2bdb){_0x4d0d85=_0x4d0d85-0x0;var _0xf8b08e=_0x21ab[_0x4d0d85];return _0xf8b08e;};'use strict';var _=require('lodash');var util=require(_0xb21a('0x0'));var logger=require('../../config/logger')(_0xb21a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb21a('0x2'));var fs=require('fs');var path=require(_0xb21a('0x3'));var rimraf=require(_0xb21a('0x4'));var config=require('../../config/environment');var attributes=require(_0xb21a('0x5'));module[_0xb21a('0x6')]=function(_0x107770,_0x2c753d){return _0x107770[_0xb21a('0x7')]('ChatWebsite',attributes,{'tableName':_0xb21a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9d9=['path','rimraf','../../config/environment','define','ChatWebsite','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x17dbdd,_0x8a27d5){var _0x15ed0c=function(_0x41c2ca){while(--_0x41c2ca){_0x17dbdd['push'](_0x17dbdd['shift']());}};_0x15ed0c(++_0x8a27d5);}(_0xe9d9,0x87));var _0x9e9d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9e9d('0x0'));var util=require('util');var logger=require(_0x9e9d('0x1'))(_0x9e9d('0x2'));var moment=require('moment');var BPromise=require(_0x9e9d('0x3'));var rp=require(_0x9e9d('0x4'));var fs=require('fs');var path=require(_0x9e9d('0x5'));var rimraf=require(_0x9e9d('0x6'));var config=require(_0x9e9d('0x7'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x3a08be,_0x55bcdf){return _0x3a08be[_0x9e9d('0x8')](_0x9e9d('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 8690542..4f359c6 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 _0x82b8=['localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','rpc','client','http','defaults','redis'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x82b8,0xdd));var _0x882b=function(_0x5d881a,_0x40d91f){_0x5d881a=_0x5d881a-0x0;var _0x150a54=_0x82b8[_0x5d881a];return _0x150a54;};'use strict';var _=require(_0x882b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x882b('0x1'));var rs=require(_0x882b('0x2'));var fs=require('fs');var Redis=require(_0x882b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x882b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x882b('0x5')][_0x882b('0x6')]({'port':0x232a});config['redis']=_[_0x882b('0x7')](config[_0x882b('0x8')],{'host':_0x882b('0x9'),'port':0x18eb});var socket=require(_0x882b('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x882b('0xb')](socket);function respondWithRpcPromise(_0xd27c70,_0x6a567e,_0x4e226b){return new BPromise(function(_0x1ad0eb,_0x21e90b){return client[_0x882b('0xc')](_0xd27c70,_0x4e226b)[_0x882b('0xd')](function(_0x281699){logger[_0x882b('0xe')](_0x882b('0xf'),_0x6a567e,_0x882b('0x10'));logger[_0x882b('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x6a567e,_0x882b('0x10'),JSON[_0x882b('0x12')](_0x281699));if(_0x281699[_0x882b('0x13')]){if(_0x281699['error'][_0x882b('0x14')]===0x1f4){logger[_0x882b('0x13')](_0x882b('0xf'),_0x6a567e,_0x281699['error'][_0x882b('0x15')]);return _0x21e90b(_0x281699['error'][_0x882b('0x15')]);}logger['error'](_0x882b('0xf'),_0x6a567e,_0x281699[_0x882b('0x13')]['message']);return _0x1ad0eb(_0x281699[_0x882b('0x13')][_0x882b('0x15')]);}else{logger[_0x882b('0xe')](_0x882b('0xf'),_0x6a567e,_0x882b('0x10'));_0x1ad0eb(_0x281699['result'][_0x882b('0x15')]);}})[_0x882b('0x16')](function(_0x23039a){logger[_0x882b('0x13')](_0x882b('0xf'),_0x6a567e,_0x23039a);_0x21e90b(_0x23039a);});});} \ No newline at end of file +var _0xae70=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x58d4ce,_0x154425){var _0x3c5170=function(_0x235a0a){while(--_0x235a0a){_0x58d4ce['push'](_0x58d4ce['shift']());}};_0x3c5170(++_0x154425);}(_0xae70,0x17c));var _0x0ae7=function(_0x1ee80c,_0x1e99ad){_0x1ee80c=_0x1ee80c-0x0;var _0x1185b3=_0xae70[_0x1ee80c];return _0x1185b3;};'use strict';var _=require(_0x0ae7('0x0'));var util=require(_0x0ae7('0x1'));var moment=require('moment');var BPromise=require(_0x0ae7('0x2'));var rs=require(_0x0ae7('0x3'));var fs=require('fs');var Redis=require(_0x0ae7('0x4'));var db=require(_0x0ae7('0x5'))['db'];var utils=require(_0x0ae7('0x6'));var logger=require(_0x0ae7('0x7'))('rpc');var config=require(_0x0ae7('0x8'));var jayson=require(_0x0ae7('0x9'));var client=jayson[_0x0ae7('0xa')][_0x0ae7('0xb')]({'port':0x232a});config[_0x0ae7('0xc')]=_['defaults'](config[_0x0ae7('0xc')],{'host':_0x0ae7('0xd'),'port':0x18eb});var socket=require(_0x0ae7('0xe'))(new Redis(config[_0x0ae7('0xc')]));require(_0x0ae7('0xf'))['register'](socket);function respondWithRpcPromise(_0x490178,_0xa92f6b,_0x3b4b52){return new BPromise(function(_0x23d9ef,_0x55367a){return client[_0x0ae7('0x10')](_0x490178,_0x3b4b52)[_0x0ae7('0x11')](function(_0x126851){logger['info'](_0x0ae7('0x12'),_0xa92f6b,_0x0ae7('0x13'));logger[_0x0ae7('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xa92f6b,_0x0ae7('0x13'),JSON[_0x0ae7('0x15')](_0x126851));if(_0x126851[_0x0ae7('0x16')]){if(_0x126851[_0x0ae7('0x16')]['code']===0x1f4){logger[_0x0ae7('0x16')](_0x0ae7('0x12'),_0xa92f6b,_0x126851[_0x0ae7('0x16')][_0x0ae7('0x17')]);return _0x55367a(_0x126851['error'][_0x0ae7('0x17')]);}logger[_0x0ae7('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xa92f6b,_0x126851[_0x0ae7('0x16')][_0x0ae7('0x17')]);return _0x23d9ef(_0x126851[_0x0ae7('0x16')][_0x0ae7('0x17')]);}else{logger[_0x0ae7('0x18')](_0x0ae7('0x12'),_0xa92f6b,_0x0ae7('0x13'));_0x23d9ef(_0x126851[_0x0ae7('0x19')][_0x0ae7('0x17')]);}})[_0x0ae7('0x1a')](function(_0xa3615c){logger['error'](_0x0ae7('0x12'),_0xa92f6b,_0xa3615c);_0x55367a(_0xa3615c);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 52dabc1..65c4298 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 _0xc380=['length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x3b85a4,_0x385447){var _0x195ebe=function(_0x1cbd47){while(--_0x1cbd47){_0x3b85a4['push'](_0x3b85a4['shift']());}};_0x195ebe(++_0x385447);}(_0xc380,0x197));var _0x0c38=function(_0x3411d4,_0x20d096){_0x3411d4=_0x3411d4-0x0;var _0x1bf2a7=_0xc380[_0x3411d4];return _0x1bf2a7;};'use strict';var ChatWebsiteEvents=require(_0x0c38('0x0'));var events=[_0x0c38('0x1'),_0x0c38('0x2'),_0x0c38('0x3')];function createListener(_0x9cebe9,_0x1d0b84){return function(_0x1cda30){_0x1d0b84[_0x0c38('0x4')](_0x9cebe9,_0x1cda30);};}function removeListener(_0x127d0e,_0x39b42f){return function(){ChatWebsiteEvents[_0x0c38('0x5')](_0x127d0e,_0x39b42f);};}exports[_0x0c38('0x6')]=function(_0x48b065){for(var _0x4a8609=0x0,_0x1512d4=events[_0x0c38('0x7')];_0x4a8609<_0x1512d4;_0x4a8609++){var _0x1563f9=events[_0x4a8609];var _0x217d57=createListener(_0x0c38('0x8')+_0x1563f9,_0x48b065);ChatWebsiteEvents['on'](_0x1563f9,_0x217d57);}}; \ No newline at end of file +var _0xdc92=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc92,0xc8));var _0x2dc9=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xdc92[_0x4ea413];return _0x51cf25;};'use strict';var ChatWebsiteEvents=require(_0x2dc9('0x0'));var events=[_0x2dc9('0x1'),'remove',_0x2dc9('0x2')];function createListener(_0x109d6a,_0x2c0a07){return function(_0x2d4b40){_0x2c0a07['emit'](_0x109d6a,_0x2d4b40);};}function removeListener(_0x2157b0,_0x395c98){return function(){ChatWebsiteEvents[_0x2dc9('0x3')](_0x2157b0,_0x395c98);};}exports[_0x2dc9('0x4')]=function(_0x524a32){for(var _0x43377a=0x0,_0x161494=events[_0x2dc9('0x5')];_0x43377a<_0x161494;_0x43377a++){var _0xbd7aa5=events[_0x43377a];var _0x53851d=createListener(_0x2dc9('0x6')+_0xbd7aa5,_0x524a32);ChatWebsiteEvents['on'](_0xbd7aa5,_0x53851d);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 920306c..b7d3fe2 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x508a=['([\x5cw]+)','localhost','exports','../../../utils/misc','url','URL','replace','test','trim'];(function(_0x180319,_0x12efe6){var _0x3b99ff=function(_0x292cad){while(--_0x292cad){_0x180319['push'](_0x180319['shift']());}};_0x3b99ff(++_0x12efe6);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};var escapeRegExp=require(_0xa508('0x0'))['escapeRegExp'];var URL=require(_0xa508('0x1'))[_0xa508('0x2')];function testWildcardValidity(_0x356958){var _0x384f7c=!![];try{new URL(_0x356958[_0xa508('0x3')]('*','localhost'));}catch(_0x8f1c7a){_0x384f7c=![];}return _0x384f7c&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xa508('0x4')](_0x356958);}function testWebsiteWithWildcard(_0x2e26ae,_0x4edcdf){var _0x89d08e;var _0x11c154=escapeRegExp(_0x2e26ae[_0xa508('0x5')]()['replace'](/\/$/,''))[_0xa508('0x3')]('\x5c*',_0xa508('0x6'));try{new URL(_0x2e26ae['replace']('\x5c*',_0xa508('0x7')));_0x89d08e=new RegExp(_0x11c154)[_0xa508('0x4')](_0x4edcdf);}catch(_0x577617){_0x89d08e=![];}return _0x89d08e;}module[_0xa508('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xe77c=['url','replace','localhost','test','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xe77c,0x176));var _0xce77=function(_0x1c72ac,_0x380a0e){_0x1c72ac=_0x1c72ac-0x0;var _0x274e46=_0xe77c[_0x1c72ac];return _0x274e46;};var escapeRegExp=require(_0xce77('0x0'))[_0xce77('0x1')];var URL=require(_0xce77('0x2'))['URL'];function testWildcardValidity(_0x2b8db3){var _0x1e3ae4=!![];try{new URL(_0x2b8db3[_0xce77('0x3')]('*',_0xce77('0x4')));}catch(_0x3da792){_0x1e3ae4=![];}return _0x1e3ae4&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xce77('0x5')](_0x2b8db3);}function testWebsiteWithWildcard(_0x9fc8f0,_0x5adf97){var _0x5aea39;var _0xed47c5=escapeRegExp(_0x9fc8f0['trim']()[_0xce77('0x3')](/\/$/,''))[_0xce77('0x3')]('\x5c*',_0xce77('0x6'));try{new URL(_0x9fc8f0['replace']('\x5c*',_0xce77('0x4')));_0x5aea39=new RegExp(_0xed47c5)[_0xce77('0x5')](_0x5adf97);}catch(_0x82cc7e){_0x5aea39=![];}return _0x5aea39;}module[_0xce77('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 53429e8..c532b82 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 _0x05bd=['offline-chat','ensureDir','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','root','addSystemAvatar','/:id/notify','notify','server/files','attachments'];(function(_0x1022dc,_0x198863){var _0xce6bd0=function(_0x5e6fe1){while(--_0x5e6fe1){_0x1022dc['push'](_0x1022dc['shift']());}};_0xce6bd0(++_0x198863);}(_0x05bd,0x130));var _0xd05b=function(_0x184486,_0x36669d){_0x184486=_0x184486-0x0;var _0x55c949=_0x05bd[_0x184486];return _0x55c949;};'use strict';var multer=require('multer');var util=require(_0xd05b('0x0'));var path=require(_0xd05b('0x1'));var timeout=require(_0xd05b('0x2'));var express=require(_0xd05b('0x3'));var router=express[_0xd05b('0x4')]();var fs_extra=require(_0xd05b('0x5'));var auth=require(_0xd05b('0x6'));var interaction=require(_0xd05b('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xd05b('0x8')]('/',auth[_0xd05b('0x9')](),controller['index']);router[_0xd05b('0x8')](_0xd05b('0xa'),auth[_0xd05b('0x9')](),controller[_0xd05b('0xb')]);router[_0xd05b('0x8')](_0xd05b('0xc'),auth[_0xd05b('0x9')](),controller['show']);router['get'](_0xd05b('0xd'),auth[_0xd05b('0x9')](),controller[_0xd05b('0xe')]);router['get'](_0xd05b('0xf'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x10')]);router['get'](_0xd05b('0x11'),controller[_0xd05b('0x12')]);router[_0xd05b('0x8')](_0xd05b('0x13'),controller[_0xd05b('0x14')]);router[_0xd05b('0x8')](_0xd05b('0x15'),controller['getCustomerAvatar']);router[_0xd05b('0x8')](_0xd05b('0x16'),controller[_0xd05b('0x17')]);router['get'](_0xd05b('0x18'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x19')]);router[_0xd05b('0x8')](_0xd05b('0x1a'),controller['getSnippet']);router[_0xd05b('0x8')](_0xd05b('0x1b'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x1c')]);router['get'](_0xd05b('0x1d'),auth['isAuthenticated'](),controller[_0xd05b('0x1e')]);router[_0xd05b('0x8')](_0xd05b('0x1f'),controller[_0xd05b('0x20')]);router['get']('/:id/offline_messages',auth[_0xd05b('0x9')](),controller[_0xd05b('0x21')]);router[_0xd05b('0x8')](_0xd05b('0x22'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x23')]);router[_0xd05b('0x24')]('/',auth['isAuthenticated'](),controller[_0xd05b('0x25')]);router['post'](_0xd05b('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xd05b('0xf'),auth['isAuthenticated'](),controller[_0xd05b('0x26')]);var upload=multer({'storage':multer[_0xd05b('0x27')]({'destination':function(_0x3fb2de,_0x18cade,_0x3c3814){_0x3c3814(null,path[_0xd05b('0x28')](config['root'],_0xd05b('0x29')));},'filename':function(_0x3d6ff7,_0x277f65,_0x57175c){_0x57175c(null,util[_0xd05b('0x2a')](_0xd05b('0x2b'),Date[_0xd05b('0x2c')](),_0x277f65[_0xd05b('0x2d')]));}})});router[_0xd05b('0x24')](_0xd05b('0x11'),upload[_0xd05b('0x2e')](_0xd05b('0x2f')),controller[_0xd05b('0x30')]);var upload=multer({'storage':multer[_0xd05b('0x27')]({'destination':function(_0x2332b6,_0x1f8668,_0x263020){_0x263020(null,path[_0xd05b('0x28')](config['root'],_0xd05b('0x31')));},'filename':function(_0x15256d,_0xd5b99a,_0x34f2e3){_0x34f2e3(null,util[_0xd05b('0x2a')](_0xd05b('0x2b'),Date[_0xd05b('0x2c')](),_0xd5b99a['originalname']));}})});router[_0xd05b('0x24')]('/:id/avatar',upload[_0xd05b('0x2e')](_0xd05b('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4833cc,_0x50fb94,_0xf53669){_0xf53669(null,path[_0xd05b('0x28')](config[_0xd05b('0x32')],_0xd05b('0x31')));},'filename':function(_0x59aab5,_0x47791d,_0x4a9f5a){_0x4a9f5a(null,util['format']('%s-%s',Date[_0xd05b('0x2c')](),_0x47791d[_0xd05b('0x2d')]));}})});router['post'](_0xd05b('0x15'),upload[_0xd05b('0x2e')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xd05b('0x27')]({'destination':function(_0x40e885,_0x8b80b2,_0x18e490){_0x18e490(null,path[_0xd05b('0x28')](config[_0xd05b('0x32')],_0xd05b('0x31')));},'filename':function(_0x40cd5f,_0x1a173e,_0x5c5c1f){_0x5c5c1f(null,util[_0xd05b('0x2a')]('%s-%s',Date[_0xd05b('0x2c')](),_0x1a173e[_0xd05b('0x2d')]));}})});router[_0xd05b('0x24')](_0xd05b('0x16'),upload[_0xd05b('0x2e')]('file'),controller[_0xd05b('0x33')]);router[_0xd05b('0x24')](_0xd05b('0x34'),controller[_0xd05b('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x4ae64b,_0x2fbaf8,_0xefcaaf){const _0x53fea1=path[_0xd05b('0x28')](config[_0xd05b('0x32')],_0xd05b('0x36'),_0xd05b('0x37'),_0xd05b('0x38'));fs_extra[_0xd05b('0x39')](_0x53fea1,function(){_0xefcaaf(null,_0x53fea1);});},'filename':function(_0x265b31,_0x13fe24,_0x1ad3ed){const _0x3ff13e=_0x13fe24['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x306057=path[_0xd05b('0x3a')](_0x3ff13e);const _0x359044=Date[_0xd05b('0x2c')]()+'-'+_0x3ff13e['replace'](_0x306057,'')+_0x306057;_0x1ad3ed(null,_0x359044);}})});router[_0xd05b('0x24')](_0xd05b('0x3b'),offlineUploadMulter[_0xd05b('0x3c')](),controller['offline']);router[_0xd05b('0x24')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xd05b('0x3d')]);router[_0xd05b('0x24')](_0xd05b('0x1b'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x3e')]);router[_0xd05b('0x24')]('/:id/proactive_actions',auth[_0xd05b('0x9')](),controller[_0xd05b('0x3f')]);router[_0xd05b('0x24')](_0xd05b('0x22'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x40')]);router[_0xd05b('0x41')](_0xd05b('0xc'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x42')]);router[_0xd05b('0x43')](_0xd05b('0xc'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x44')]);router[_0xd05b('0x43')](_0xd05b('0xd'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x45')]);router[_0xd05b('0x43')](_0xd05b('0xf'),auth[_0xd05b('0x9')](),controller[_0xd05b('0x46')]);router[_0xd05b('0x43')](_0xd05b('0x22'),auth[_0xd05b('0x9')](),controller['removeAgents']);module[_0xd05b('0x47')]=router; \ No newline at end of file +var _0x9d3a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','originalname','/:id/logo','single','file','server/files/images/avatars/','now','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','delete','/:id','destroy','removeDispositions','removeAgents','exports'];(function(_0x5746a1,_0x45b96f){var _0x105a24=function(_0x53cf64){while(--_0x53cf64){_0x5746a1['push'](_0x5746a1['shift']());}};_0x105a24(++_0x45b96f);}(_0x9d3a,0x114));var _0xa9d3=function(_0x215f9e,_0x438b14){_0x215f9e=_0x215f9e-0x0;var _0x217ce4=_0x9d3a[_0x215f9e];return _0x217ce4;};'use strict';var multer=require('multer');var util=require(_0xa9d3('0x0'));var path=require('path');var timeout=require(_0xa9d3('0x1'));var express=require(_0xa9d3('0x2'));var router=express[_0xa9d3('0x3')]();var fs_extra=require(_0xa9d3('0x4'));var auth=require(_0xa9d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9d3('0x6'));var controller=require('./chatWebsite.controller');router[_0xa9d3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa9d3('0x8')]);router[_0xa9d3('0x7')](_0xa9d3('0x9'),auth[_0xa9d3('0xa')](),controller['describe']);router[_0xa9d3('0x7')]('/:id',auth[_0xa9d3('0xa')](),controller[_0xa9d3('0xb')]);router['get'](_0xa9d3('0xc'),auth['isAuthenticated'](),controller[_0xa9d3('0xd')]);router[_0xa9d3('0x7')](_0xa9d3('0xe'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0xf')]);router[_0xa9d3('0x7')]('/:id/logo',controller[_0xa9d3('0x10')]);router['get'](_0xa9d3('0x11'),controller[_0xa9d3('0x12')]);router[_0xa9d3('0x7')]('/:id/customer_avatar',controller[_0xa9d3('0x13')]);router[_0xa9d3('0x7')](_0xa9d3('0x14'),controller[_0xa9d3('0x15')]);router[_0xa9d3('0x7')](_0xa9d3('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa9d3('0x7')](_0xa9d3('0x17'),controller[_0xa9d3('0x18')]);router[_0xa9d3('0x7')](_0xa9d3('0x19'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x1a')]);router[_0xa9d3('0x7')](_0xa9d3('0x1b'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x1c')]);router[_0xa9d3('0x7')](_0xa9d3('0x1d'),controller[_0xa9d3('0x1e')]);router[_0xa9d3('0x7')](_0xa9d3('0x1f'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x20')]);router[_0xa9d3('0x7')]('/:id/users',auth[_0xa9d3('0xa')](),controller['getAgents']);router[_0xa9d3('0x21')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9d3('0x21')](_0xa9d3('0xc'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x22')]);router[_0xa9d3('0x21')]('/:id/canned_answers',auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x23')]);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x85d4dc,_0x1ca97e,_0x1c64d0){_0x1c64d0(null,path[_0xa9d3('0x25')](config[_0xa9d3('0x26')],'server/files/images/logos/'));},'filename':function(_0x4e5aa1,_0x3f5648,_0x401924){_0x401924(null,util[_0xa9d3('0x27')](_0xa9d3('0x28'),Date['now'](),_0x3f5648[_0xa9d3('0x29')]));}})});router[_0xa9d3('0x21')](_0xa9d3('0x2a'),upload[_0xa9d3('0x2b')](_0xa9d3('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x5e5bca,_0x4e7c17,_0x27ba82){_0x27ba82(null,path[_0xa9d3('0x25')](config['root'],_0xa9d3('0x2d')));},'filename':function(_0x41f019,_0xa9a149,_0x35ec88){_0x35ec88(null,util['format']('%s-%s',Date[_0xa9d3('0x2e')](),_0xa9a149['originalname']));}})});router['post'](_0xa9d3('0x11'),upload[_0xa9d3('0x2b')](_0xa9d3('0x2c')),controller[_0xa9d3('0x2f')]);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x187d2e,_0x12f415,_0x50479c){_0x50479c(null,path['join'](config[_0xa9d3('0x26')],_0xa9d3('0x2d')));},'filename':function(_0x37238d,_0xca13fd,_0x297a3c){_0x297a3c(null,util[_0xa9d3('0x27')](_0xa9d3('0x28'),Date['now'](),_0xca13fd['originalname']));}})});router[_0xa9d3('0x21')](_0xa9d3('0x30'),upload[_0xa9d3('0x2b')]('file'),controller[_0xa9d3('0x31')]);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x29253a,_0x12d88a,_0x2ce1e5){_0x2ce1e5(null,path['join'](config['root'],_0xa9d3('0x2d')));},'filename':function(_0x3cdefb,_0x230440,_0x5a8c68){_0x5a8c68(null,util[_0xa9d3('0x27')]('%s-%s',Date[_0xa9d3('0x2e')](),_0x230440[_0xa9d3('0x29')]));}})});router[_0xa9d3('0x21')](_0xa9d3('0x14'),upload[_0xa9d3('0x2b')](_0xa9d3('0x2c')),controller[_0xa9d3('0x32')]);router['post'](_0xa9d3('0x33'),controller[_0xa9d3('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x1b4e72,_0x5b743e,_0x4fb459){const _0x79244e=path[_0xa9d3('0x25')](config[_0xa9d3('0x26')],'server/files','attachments','offline-chat');fs_extra['ensureDir'](_0x79244e,function(){_0x4fb459(null,_0x79244e);});},'filename':function(_0x3e61fd,_0x24d420,_0xfbdead){const _0xdb33c0=_0x24d420[_0xa9d3('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x208169=path[_0xa9d3('0x35')](_0xdb33c0);const _0x19c3bd=Date[_0xa9d3('0x2e')]()+'-'+_0xdb33c0[_0xa9d3('0x36')](_0x208169,'')+_0x208169;_0xfbdead(null,_0x19c3bd);}})});router[_0xa9d3('0x21')]('/:id/offline',offlineUploadMulter[_0xa9d3('0x37')](),controller[_0xa9d3('0x38')]);router[_0xa9d3('0x21')](_0xa9d3('0x16'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x39')]);router[_0xa9d3('0x21')](_0xa9d3('0x19'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x3a')]);router[_0xa9d3('0x21')]('/:id/proactive_actions',auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x3b')]);router[_0xa9d3('0x21')](_0xa9d3('0x3c'),auth['isAuthenticated'](),controller[_0xa9d3('0x3d')]);router[_0xa9d3('0x3e')]('/:id',auth[_0xa9d3('0xa')](),controller['update']);router[_0xa9d3('0x3f')](_0xa9d3('0x40'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x41')]);router[_0xa9d3('0x3f')](_0xa9d3('0xc'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x42')]);router[_0xa9d3('0x3f')](_0xa9d3('0xe'),auth[_0xa9d3('0xa')](),controller['removeAnswers']);router[_0xa9d3('0x3f')](_0xa9d3('0x3c'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x43')]);module[_0xa9d3('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 90814db..d1e057c 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x259e=['express','../components/auth/service','../config/environment','Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','exports','beaver-logger/server'];(function(_0x135a3a,_0x5a7441){var _0x4bac99=function(_0x4a99e7){while(--_0x4a99e7){_0x135a3a['push'](_0x135a3a['shift']());}};_0x4bac99(++_0x5a7441);}(_0x259e,0x14f));var _0xe259=function(_0x211760,_0x255c9e){_0x211760=_0x211760-0x0;var _0x66e8a=_0x259e[_0x211760];return _0x66e8a;};var beaverLogger=require(_0xe259('0x0'));var express=require(_0xe259('0x1'));var auth=require(_0xe259('0x2'));var config=require(_0xe259('0x3'));var router=express[_0xe259('0x4')]();var isProduction=config[_0xe259('0x5')]===_0xe259('0x6')||![];function clientSideLogs(_0x3dc9ea,_0xed127f,_0x5a402b){var _0x5dd41c=_0x3dc9ea['app']['get'](_0xe259('0x7'));if(!_0x5dd41c){throw new Error(_0xe259('0x8'));}return beaverLogger[_0xe259('0x9')]({'uri':_0xe259('0xa'),'logger':_0x5dd41c,'enableCors':!isProduction})(_0x3dc9ea,_0xed127f,_0x5a402b);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xe259('0xb')]=router; \ No newline at end of file +var _0xd0de=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd0de,0xfb));var _0xed0d=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xd0de[_0x5e9876];return _0x576c48;};var beaverLogger=require(_0xed0d('0x0'));var express=require('express');var auth=require(_0xed0d('0x1'));var config=require(_0xed0d('0x2'));var router=express[_0xed0d('0x3')]();var isProduction=config[_0xed0d('0x4')]===_0xed0d('0x5')||![];function clientSideLogs(_0x403782,_0x5baca6,_0x5605e8){var _0x111490=_0x403782[_0xed0d('0x6')]['get']('client-side-logger');if(!_0x111490){throw new Error(_0xed0d('0x7'));}return beaverLogger[_0xed0d('0x8')]({'uri':_0xed0d('0x9'),'logger':_0x111490,'enableCors':!isProduction})(_0x403782,_0x5baca6,_0x5605e8);}router[_0xed0d('0xa')](auth[_0xed0d('0xb')](),clientSideLogs);module[_0xed0d('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7db6fd3..9b84d39 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 _0x88d5=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x88d5,0x12f));var _0x588d=function(_0x1e05d1,_0x146a44){_0x1e05d1=_0x1e05d1-0x0;var _0x468192=_0x88d5[_0x1e05d1];return _0x468192;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x588d('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x588d('0x1')](_0x588d('0x2'),_0x588d('0x3'),_0x588d('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x588d('0x1')](_0x588d('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x588d('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x588d('0x0')],'comment':_0x588d('0x6')},'data3':{'type':Sequelize[_0x588d('0x0')],'comment':_0x588d('0x7')},'data4':{'type':Sequelize['STRING'],'comment':_0x588d('0x8')},'data5':{'type':Sequelize[_0x588d('0x9')],'comment':_0x588d('0xa')},'data6':{'type':Sequelize[_0x588d('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0x588d('0xb')}}; \ No newline at end of file +var _0x97a5=['MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0xf87945,_0x4e43b0){var _0x3c9881=function(_0x5eb0a7){while(--_0x5eb0a7){_0xf87945['push'](_0xf87945['shift']());}};_0x3c9881(++_0x4e43b0);}(_0x97a5,0x18b));var _0x597a=function(_0x450075,_0x1003c3){_0x450075=_0x450075-0x0;var _0x31598d=_0x97a5[_0x450075];return _0x31598d;};'use strict';var Sequelize=require(_0x597a('0x0'));module[_0x597a('0x1')]={'name':{'type':Sequelize[_0x597a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x597a('0x3'),_0x597a('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x597a('0x5'),_0x597a('0x6'))},'data1':{'type':Sequelize[_0x597a('0x2')],'comment':_0x597a('0x7')},'data2':{'type':Sequelize[_0x597a('0x2')],'comment':_0x597a('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x597a('0x9')},'data4':{'type':Sequelize[_0x597a('0x2')],'comment':_0x597a('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x597a('0xb')},'data6':{'type':Sequelize[_0x597a('0xc')],'comment':_0x597a('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0x597a('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index bb73b28..ffa8129 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 _0x228d=['access_token','data6','startRefreshInterval','microsoftAuthorization:success','emit','Invalid\x20authentication\x20state\x20parameter','message','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','error','stack','name','send','slice','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','CloudProvider','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','show','params','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','destroy','findOne','get','parse','from','state','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5'];(function(_0x21f5ef,_0x515d8f){var _0x2532ce=function(_0x500f5a){while(--_0x500f5a){_0x21f5ef['push'](_0x21f5ef['shift']());}};_0x2532ce(++_0x515d8f);}(_0x228d,0x118));var _0xd228=function(_0x52a01f,_0x476c6a){_0x52a01f=_0x52a01f-0x0;var _0x37748f=_0x228d[_0x52a01f];return _0x37748f;};'use strict';var _=require(_0xd228('0x0'));var Redis=require(_0xd228('0x1'));var qs=require(_0xd228('0x2'));var encryptor=require(_0xd228('0x3'));var config=require(_0xd228('0x4'));var logger=require(_0xd228('0x5'))(_0xd228('0x6'));var db=require(_0xd228('0x7'))['db'];var oauth=require(_0xd228('0x8'));config[_0xd228('0x9')]=_[_0xd228('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd228('0xb'))(new Redis(config[_0xd228('0x9')]));var redis=new Redis(config[_0xd228('0x9')]);function respondWithStatusCode(_0x2b0252,_0x271bef){_0x271bef=_0x271bef||0xcc;return function(_0x44038e){if(_0x44038e){return _0x2b0252[_0xd228('0xc')](_0x271bef);}return _0x2b0252[_0xd228('0xd')](_0x271bef)[_0xd228('0xe')]();};}function respondWithResult(_0x38eac8,_0x46b1f4){_0x46b1f4=_0x46b1f4||0xc8;return function(_0x456dce){if(_0x456dce){return _0x38eac8[_0xd228('0xd')](_0x46b1f4)[_0xd228('0xf')](_0x456dce);}};}function respondWithFilteredResult(_0x1d4d44,_0x391e3e){return function(_0x586de1){if(_0x586de1){var _0x46f689=typeof _0x391e3e[_0xd228('0x10')]===_0xd228('0x11')&&typeof _0x391e3e['limit']===_0xd228('0x11');var _0x2ea6a3=_0x586de1[_0xd228('0x12')];var _0xc497f3=_0x46f689?0x0:_0x391e3e[_0xd228('0x10')];var _0x1dcb9a=_0x46f689?_0x586de1[_0xd228('0x12')]:_0x391e3e[_0xd228('0x10')]+_0x391e3e[_0xd228('0x13')];var _0x17082c;if(_0x1dcb9a>=_0x2ea6a3){_0x1dcb9a=_0x2ea6a3;_0x17082c=0xc8;}else{_0x17082c=0xce;}_0x1d4d44[_0xd228('0xd')](_0x17082c);return _0x1d4d44[_0xd228('0x14')]('Content-Range',_0xc497f3+'-'+_0x1dcb9a+'/'+_0x2ea6a3)['json'](_0x586de1);}return null;};}function saveUpdates(_0x76dbe4){return function(_0x288046){if(_0x288046){return _0x288046[_0xd228('0x15')](_0x76dbe4)['then'](function(_0x37d687){return _0x37d687;});}return null;};}function removeEntity(_0x294d0e){return function(_0x159781){if(_0x159781){return _0x159781['destroy']()[_0xd228('0x16')](function(){_0x294d0e[_0xd228('0xd')](0xcc)[_0xd228('0xe')]();});}};}function handleEntityNotFound(_0x3a2fdb){return function(_0x383bdc){if(!_0x383bdc){_0x3a2fdb[_0xd228('0xc')](0x194);}return _0x383bdc;};}function handleError(_0x36aa38,_0x5ef3d9){_0x5ef3d9=_0x5ef3d9||0x1f4;return function(_0x44487c){logger[_0xd228('0x17')](_0x44487c[_0xd228('0x18')]);if(_0x44487c[_0xd228('0x19')]){delete _0x44487c[_0xd228('0x19')];}_0x36aa38[_0xd228('0xd')](_0x5ef3d9)[_0xd228('0x1a')](_0x44487c);};}function maskClientSecret(_0x5ef78c){return _['padEnd'](_0x5ef78c[_0xd228('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3228b5,_0xbca461){var _0x3e7ec1={},_0x11dc68={},_0x60cad4={'count':0x0,'rows':[]};var _0x3ba3bd=_['map'](db['CloudProvider'][_0xd228('0x1c')],function(_0x5a1e39){return{'name':_0x5a1e39[_0xd228('0x1d')],'type':_0x5a1e39['type'][_0xd228('0x1e')]};});_0x11dc68[_0xd228('0x1f')]=_[_0xd228('0x20')](_0x3ba3bd,_0xd228('0x19'));_0x11dc68[_0xd228('0x21')]=_[_0xd228('0x22')](_0x3228b5['query']);_0x11dc68[_0xd228('0x23')]=_[_0xd228('0x24')](_0x11dc68[_0xd228('0x1f')],_0x11dc68[_0xd228('0x21')]);_0x3e7ec1['attributes']=_['intersection'](_0x11dc68['model'],qs[_0xd228('0x25')](_0x3228b5[_0xd228('0x21')][_0xd228('0x25')]));_0x3e7ec1[_0xd228('0x26')]=_0x3e7ec1['attributes'][_0xd228('0x27')]?_0x3e7ec1['attributes']:_0x11dc68[_0xd228('0x1f')];if(!_0x3228b5['query'][_0xd228('0x28')](_0xd228('0x29'))){_0x3e7ec1['limit']=qs['limit'](_0x3228b5[_0xd228('0x21')][_0xd228('0x13')]);_0x3e7ec1[_0xd228('0x10')]=qs[_0xd228('0x10')](_0x3228b5['query']['offset']);}_0x3e7ec1['order']=qs[_0xd228('0x2a')](_0x3228b5['query'][_0xd228('0x2a')]);_0x3e7ec1['where']=qs['filters'](_[_0xd228('0x2b')](_0x3228b5['query'],_0x11dc68[_0xd228('0x23')]),_0x3ba3bd);if(_0x3228b5['query'][_0xd228('0x2c')]){_0x3e7ec1[_0xd228('0x2d')]=_[_0xd228('0x2e')](_0x3e7ec1[_0xd228('0x2d')],{'$or':_[_0xd228('0x20')](_0x3ba3bd,function(_0xdc0c65){if(_0xdc0c65[_0xd228('0x2f')]!==_0xd228('0x30')){var _0x50bcb1={};_0x50bcb1[_0xdc0c65[_0xd228('0x19')]]={'$like':'%'+_0x3228b5[_0xd228('0x21')]['filter']+'%'};return _0x50bcb1;}})});}_0x3e7ec1=_[_0xd228('0x2e')]({},_0x3e7ec1,_0x3228b5[_0xd228('0x31')]);var _0x49a12a={'where':_0x3e7ec1[_0xd228('0x2d')]};return db[_0xd228('0x32')]['count'](_0x49a12a)[_0xd228('0x16')](function(_0x54b4c2){_0x60cad4[_0xd228('0x12')]=_0x54b4c2;if(_0x3228b5[_0xd228('0x21')][_0xd228('0x33')]){_0x3e7ec1[_0xd228('0x34')]=[{'all':!![]}];}return db[_0xd228('0x32')][_0xd228('0x35')](_0x3e7ec1);})[_0xd228('0x16')](function(_0x329d6d){_0x60cad4['rows']=_[_0xd228('0x20')](_0x329d6d,function(_0x29cf29){if(_0x29cf29[_0xd228('0x36')]===_0xd228('0x37')){var _0x247ca7=encryptor['decryptString'](_0x29cf29[_0xd228('0x38')]);_0x29cf29[_0xd228('0x38')]=maskClientSecret(_0x247ca7);}return _0x29cf29;});return _0x60cad4;})['then'](respondWithFilteredResult(_0xbca461,_0x3e7ec1))[_0xd228('0x39')](handleError(_0xbca461,null));};exports[_0xd228('0x3a')]=function(_0x351f6e,_0x16d95c){var _0x2a43a4={'raw':!![],'where':{'id':_0x351f6e[_0xd228('0x3b')]['id']}},_0x5e067a={};_0x5e067a[_0xd228('0x1f')]=_[_0xd228('0x22')](db['CloudProvider']['rawAttributes']);_0x5e067a['query']=_[_0xd228('0x22')](_0x351f6e[_0xd228('0x21')]);_0x5e067a[_0xd228('0x23')]=_[_0xd228('0x24')](_0x5e067a[_0xd228('0x1f')],_0x5e067a[_0xd228('0x21')]);_0x2a43a4[_0xd228('0x26')]=_['intersection'](_0x5e067a[_0xd228('0x1f')],qs[_0xd228('0x25')](_0x351f6e[_0xd228('0x21')]['fields']));_0x2a43a4[_0xd228('0x26')]=_0x2a43a4['attributes'][_0xd228('0x27')]?_0x2a43a4[_0xd228('0x26')]:_0x5e067a[_0xd228('0x1f')];if(_0x351f6e[_0xd228('0x21')][_0xd228('0x33')]){_0x2a43a4['include']=[{'all':!![]}];}_0x2a43a4=_[_0xd228('0x2e')]({},_0x2a43a4,_0x351f6e[_0xd228('0x31')]);return db[_0xd228('0x32')]['find'](_0x2a43a4)[_0xd228('0x16')](handleEntityNotFound(_0x16d95c,null))[_0xd228('0x16')](function(_0x3a27f7){if(_0x3a27f7[_0xd228('0x36')]==='MicrosoftAzure'){var _0x2b4a7c=encryptor[_0xd228('0x3c')](_0x3a27f7[_0xd228('0x38')]);_0x3a27f7[_0xd228('0x38')]=maskClientSecret(_0x2b4a7c);}return _0x3a27f7;})[_0xd228('0x16')](respondWithResult(_0x16d95c,null))[_0xd228('0x39')](handleError(_0x16d95c,null));};exports[_0xd228('0x3d')]=function(_0x594ce6,_0x29acc7){if(!_0x594ce6[_0xd228('0x3e')]['name'])throw new Error(_0xd228('0x3f'));if(!_0x594ce6['body'][_0xd228('0x36')])throw new Error(_0xd228('0x40'));var _0x9c4a27=db[_0xd228('0x32')][_0xd228('0x1c')][_0xd228('0x36')][_0xd228('0x41')];if(!_0x9c4a27[_0xd228('0x42')](_0x594ce6[_0xd228('0x3e')][_0xd228('0x36')]))throw new Error(_0xd228('0x43')+_0x9c4a27['join'](',\x20'));if(_0x594ce6['body']['service']===_0xd228('0x37')&&_0x594ce6[_0xd228('0x3e')][_0xd228('0x38')]){_0x594ce6[_0xd228('0x3e')][_0xd228('0x38')]=encryptor[_0xd228('0x44')](_0x594ce6['body'][_0xd228('0x38')]);}return db[_0xd228('0x32')][_0xd228('0x3d')](_0x594ce6[_0xd228('0x3e')],{})[_0xd228('0x16')](respondWithResult(_0x29acc7,0xc9))['catch'](handleError(_0x29acc7,null));};exports[_0xd228('0x15')]=function(_0x2e7a22,_0x187408){if(_0x2e7a22[_0xd228('0x3e')]['id']){delete _0x2e7a22[_0xd228('0x3e')]['id'];}return db[_0xd228('0x32')][_0xd228('0x45')]({'where':{'id':_0x2e7a22[_0xd228('0x3b')]['id']}})[_0xd228('0x16')](handleEntityNotFound(_0x187408,null))[_0xd228('0x16')](function(_0x225688){if(_0x225688[_0xd228('0x36')]===_0xd228('0x37')&&_0x2e7a22[_0xd228('0x3e')]['data3']){_0x2e7a22[_0xd228('0x3e')][_0xd228('0x38')]=encryptor[_0xd228('0x44')](_0x2e7a22[_0xd228('0x3e')][_0xd228('0x38')]);}return _0x225688;})[_0xd228('0x16')](saveUpdates(_0x2e7a22[_0xd228('0x3e')],null))[_0xd228('0x16')](respondWithResult(_0x187408,null))[_0xd228('0x39')](handleError(_0x187408,null));};exports[_0xd228('0x46')]=function(_0x4617a5,_0x345def){return db[_0xd228('0x32')]['find']({'where':{'id':_0x4617a5['params']['id']}})[_0xd228('0x16')](handleEntityNotFound(_0x345def,null))[_0xd228('0x16')](removeEntity(_0x345def,null))[_0xd228('0x39')](handleError(_0x345def,null));};exports['oauth2MicrosoftAuthorize']=function(_0x241df7,_0xeb7814){return db[_0xd228('0x32')][_0xd228('0x47')]({'where':{'id':_0x241df7[_0xd228('0x3b')]['id']},'raw':!![]})[_0xd228('0x16')](function(_0xadf002){if(!_0xadf002)return _0xeb7814[_0xd228('0xc')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0xadf002,_0x241df7['user']['id'])};})[_0xd228('0x16')](respondWithResult(_0xeb7814,null))[_0xd228('0x39')](handleError(_0xeb7814,null));};exports['oauth2MicrosoftCallback']=function(_0x264a57,_0x36784e){var _0x401197=_0x264a57['body'];var _0x3cc7e8;var _0x4a2924;if(_0x401197['error'])throw _0x401197;redis[_0xd228('0x48')](_0x401197['state'])['then'](function(_0x3d1340){if(!_0x3d1340)throw new Error('Invalid\x20state\x20parameter');_0x3cc7e8=JSON[_0xd228('0x49')](_0x3d1340);var _0x464735=Buffer[_0xd228('0x4a')](_0x401197[_0xd228('0x4b')],'base64')[_0xd228('0x4c')](_0xd228('0x4d'));_0x4a2924=JSON['parse'](_0x464735);if(!oauth[_0xd228('0x4e')](_0x401197[_0xd228('0x4f')],_0x3cc7e8[_0xd228('0x50')]))throw new Error(_0xd228('0x51'));redis['del'](_0x401197['state']);return oauth[_0xd228('0x52')](_0x401197['code'],_0x3cc7e8);})[_0xd228('0x16')](function(_0x14a004){_0x3cc7e8[_0xd228('0x53')]=_0x14a004[_0xd228('0x54')];_0x3cc7e8['data6']=_0x14a004['refresh_token'];return db[_0xd228('0x32')][_0xd228('0x15')]({'data5':_0x3cc7e8[_0xd228('0x53')],'data6':_0x3cc7e8[_0xd228('0x55')]},{'where':{'id':_0x3cc7e8['id']}});})[_0xd228('0x16')](function(){oauth[_0xd228('0x56')](_0x3cc7e8);socket['emit'](_0xd228('0x57'),{'id':_0x4a2924['id']});return;})[_0xd228('0x16')](respondWithStatusCode(_0x36784e,null))['catch'](function(_0x32d8e7){if(_0x4a2924){socket[_0xd228('0x58')]('microsoftAuthorization:error',{'id':_0x4a2924['id']});}if(!_0x3cc7e8){logger[_0xd228('0x17')](_0xd228('0x59'),_0x32d8e7);return _0x36784e['status'](0x1f4)[_0xd228('0x1a')](_0x32d8e7[_0xd228('0x5a')]);}logger[_0xd228('0x17')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x3cc7e8['id'],JSON['stringify'](_0x32d8e7));});}; \ No newline at end of file +var _0x4aa7=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','name','padEnd','index','map','CloudProvider','fieldName','type','key','model','query','keys','attributes','nolimit','order','sort','where','filters','merge','options','includeAll','findAll','service','data3','catch','show','params','intersection','fields','length','include','find','MicrosoftAzure','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb'];(function(_0x46e371,_0x54a672){var _0x5ca433=function(_0x34c74f){while(--_0x34c74f){_0x46e371['push'](_0x46e371['shift']());}};_0x5ca433(++_0x54a672);}(_0x4aa7,0x111));var _0x74aa=function(_0x18a276,_0x48c9d5){_0x18a276=_0x18a276-0x0;var _0x3c3cb8=_0x4aa7[_0x18a276];return _0x3c3cb8;};'use strict';var _=require(_0x74aa('0x0'));var Redis=require(_0x74aa('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x74aa('0x2'));var config=require(_0x74aa('0x3'));var logger=require(_0x74aa('0x4'))('api');var db=require(_0x74aa('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x74aa('0x6')]=_[_0x74aa('0x7')](config[_0x74aa('0x6')],{'host':_0x74aa('0x8'),'port':0x18eb});var socket=require(_0x74aa('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x74aa('0x6')]);function respondWithStatusCode(_0x2374ba,_0x4803b1){_0x4803b1=_0x4803b1||0xcc;return function(_0x425fc5){if(_0x425fc5){return _0x2374ba[_0x74aa('0xa')](_0x4803b1);}return _0x2374ba[_0x74aa('0xb')](_0x4803b1)['end']();};}function respondWithResult(_0x5e1c4b,_0x6e14ff){_0x6e14ff=_0x6e14ff||0xc8;return function(_0x2c03dc){if(_0x2c03dc){return _0x5e1c4b[_0x74aa('0xb')](_0x6e14ff)[_0x74aa('0xc')](_0x2c03dc);}};}function respondWithFilteredResult(_0x4cf7ed,_0x6a601){return function(_0x2bab01){if(_0x2bab01){var _0x44f9dd=typeof _0x6a601[_0x74aa('0xd')]===_0x74aa('0xe')&&typeof _0x6a601[_0x74aa('0xf')]===_0x74aa('0xe');var _0x8383c=_0x2bab01[_0x74aa('0x10')];var _0x250f2a=_0x44f9dd?0x0:_0x6a601['offset'];var _0x3b494c=_0x44f9dd?_0x2bab01['count']:_0x6a601[_0x74aa('0xd')]+_0x6a601[_0x74aa('0xf')];var _0x529caf;if(_0x3b494c>=_0x8383c){_0x3b494c=_0x8383c;_0x529caf=0xc8;}else{_0x529caf=0xce;}_0x4cf7ed['status'](_0x529caf);return _0x4cf7ed[_0x74aa('0x11')](_0x74aa('0x12'),_0x250f2a+'-'+_0x3b494c+'/'+_0x8383c)[_0x74aa('0xc')](_0x2bab01);}return null;};}function saveUpdates(_0x289e2d){return function(_0x18cb75){if(_0x18cb75){return _0x18cb75[_0x74aa('0x13')](_0x289e2d)['then'](function(_0x5824a7){return _0x5824a7;});}return null;};}function removeEntity(_0x372bb5){return function(_0x33f093){if(_0x33f093){return _0x33f093[_0x74aa('0x14')]()[_0x74aa('0x15')](function(){_0x372bb5[_0x74aa('0xb')](0xcc)[_0x74aa('0x16')]();});}};}function handleEntityNotFound(_0x2397be){return function(_0x5a843b){if(!_0x5a843b){_0x2397be['sendStatus'](0x194);}return _0x5a843b;};}function handleError(_0x53f4f9,_0x2d482b){_0x2d482b=_0x2d482b||0x1f4;return function(_0x279de4){logger[_0x74aa('0x17')](_0x279de4['stack']);if(_0x279de4[_0x74aa('0x18')]){delete _0x279de4[_0x74aa('0x18')];}_0x53f4f9[_0x74aa('0xb')](_0x2d482b)['send'](_0x279de4);};}function maskClientSecret(_0x48531d){return _[_0x74aa('0x19')](_0x48531d['slice'](0x0,0x3),0x14,'*');}exports[_0x74aa('0x1a')]=function(_0x2fd866,_0x4fdcdc){var _0x3b85d4={},_0x474b5f={},_0xadc2c6={'count':0x0,'rows':[]};var _0x156036=_[_0x74aa('0x1b')](db[_0x74aa('0x1c')]['rawAttributes'],function(_0x451b97){return{'name':_0x451b97[_0x74aa('0x1d')],'type':_0x451b97[_0x74aa('0x1e')][_0x74aa('0x1f')]};});_0x474b5f[_0x74aa('0x20')]=_[_0x74aa('0x1b')](_0x156036,'name');_0x474b5f[_0x74aa('0x21')]=_[_0x74aa('0x22')](_0x2fd866['query']);_0x474b5f['filters']=_['intersection'](_0x474b5f[_0x74aa('0x20')],_0x474b5f[_0x74aa('0x21')]);_0x3b85d4['attributes']=_['intersection'](_0x474b5f[_0x74aa('0x20')],qs['fields'](_0x2fd866[_0x74aa('0x21')]['fields']));_0x3b85d4[_0x74aa('0x23')]=_0x3b85d4['attributes']['length']?_0x3b85d4[_0x74aa('0x23')]:_0x474b5f['model'];if(!_0x2fd866['query']['hasOwnProperty'](_0x74aa('0x24'))){_0x3b85d4[_0x74aa('0xf')]=qs[_0x74aa('0xf')](_0x2fd866[_0x74aa('0x21')][_0x74aa('0xf')]);_0x3b85d4[_0x74aa('0xd')]=qs[_0x74aa('0xd')](_0x2fd866[_0x74aa('0x21')]['offset']);}_0x3b85d4[_0x74aa('0x25')]=qs[_0x74aa('0x26')](_0x2fd866[_0x74aa('0x21')]['sort']);_0x3b85d4[_0x74aa('0x27')]=qs['filters'](_['pick'](_0x2fd866[_0x74aa('0x21')],_0x474b5f[_0x74aa('0x28')]),_0x156036);if(_0x2fd866[_0x74aa('0x21')]['filter']){_0x3b85d4[_0x74aa('0x27')]=_[_0x74aa('0x29')](_0x3b85d4[_0x74aa('0x27')],{'$or':_[_0x74aa('0x1b')](_0x156036,function(_0x40917b){if(_0x40917b[_0x74aa('0x1e')]!=='VIRTUAL'){var _0x44d1ab={};_0x44d1ab[_0x40917b['name']]={'$like':'%'+_0x2fd866[_0x74aa('0x21')]['filter']+'%'};return _0x44d1ab;}})});}_0x3b85d4=_[_0x74aa('0x29')]({},_0x3b85d4,_0x2fd866[_0x74aa('0x2a')]);var _0x10827f={'where':_0x3b85d4[_0x74aa('0x27')]};return db['CloudProvider']['count'](_0x10827f)[_0x74aa('0x15')](function(_0x24bd3f){_0xadc2c6[_0x74aa('0x10')]=_0x24bd3f;if(_0x2fd866[_0x74aa('0x21')][_0x74aa('0x2b')]){_0x3b85d4['include']=[{'all':!![]}];}return db['CloudProvider'][_0x74aa('0x2c')](_0x3b85d4);})[_0x74aa('0x15')](function(_0x44380d){_0xadc2c6['rows']=_['map'](_0x44380d,function(_0xf4d756){if(_0xf4d756[_0x74aa('0x2d')]==='MicrosoftAzure'){var _0x554fcc=encryptor['decryptString'](_0xf4d756['data3']);_0xf4d756[_0x74aa('0x2e')]=maskClientSecret(_0x554fcc);}return _0xf4d756;});return _0xadc2c6;})[_0x74aa('0x15')](respondWithFilteredResult(_0x4fdcdc,_0x3b85d4))[_0x74aa('0x2f')](handleError(_0x4fdcdc,null));};exports[_0x74aa('0x30')]=function(_0x54a63b,_0x2e5aa8){var _0x3acada={'raw':!![],'where':{'id':_0x54a63b[_0x74aa('0x31')]['id']}},_0x53f249={};_0x53f249[_0x74aa('0x20')]=_[_0x74aa('0x22')](db[_0x74aa('0x1c')]['rawAttributes']);_0x53f249[_0x74aa('0x21')]=_[_0x74aa('0x22')](_0x54a63b[_0x74aa('0x21')]);_0x53f249['filters']=_[_0x74aa('0x32')](_0x53f249[_0x74aa('0x20')],_0x53f249[_0x74aa('0x21')]);_0x3acada[_0x74aa('0x23')]=_[_0x74aa('0x32')](_0x53f249['model'],qs[_0x74aa('0x33')](_0x54a63b['query'][_0x74aa('0x33')]));_0x3acada['attributes']=_0x3acada[_0x74aa('0x23')][_0x74aa('0x34')]?_0x3acada[_0x74aa('0x23')]:_0x53f249['model'];if(_0x54a63b[_0x74aa('0x21')][_0x74aa('0x2b')]){_0x3acada[_0x74aa('0x35')]=[{'all':!![]}];}_0x3acada=_[_0x74aa('0x29')]({},_0x3acada,_0x54a63b[_0x74aa('0x2a')]);return db[_0x74aa('0x1c')][_0x74aa('0x36')](_0x3acada)[_0x74aa('0x15')](handleEntityNotFound(_0x2e5aa8,null))['then'](function(_0xe3d5b3){if(_0xe3d5b3[_0x74aa('0x2d')]===_0x74aa('0x37')){var _0x1cbcc8=encryptor['decryptString'](_0xe3d5b3['data3']);_0xe3d5b3[_0x74aa('0x2e')]=maskClientSecret(_0x1cbcc8);}return _0xe3d5b3;})[_0x74aa('0x15')](respondWithResult(_0x2e5aa8,null))[_0x74aa('0x2f')](handleError(_0x2e5aa8,null));};exports[_0x74aa('0x38')]=function(_0x5b6223,_0x3a48a0){if(!_0x5b6223['body'][_0x74aa('0x18')])throw new Error(_0x74aa('0x39'));if(!_0x5b6223['body'][_0x74aa('0x2d')])throw new Error(_0x74aa('0x3a'));var _0x5c9661=db[_0x74aa('0x1c')][_0x74aa('0x3b')][_0x74aa('0x2d')][_0x74aa('0x3c')];if(!_0x5c9661[_0x74aa('0x3d')](_0x5b6223[_0x74aa('0x3e')][_0x74aa('0x2d')]))throw new Error(_0x74aa('0x3f')+_0x5c9661[_0x74aa('0x40')](',\x20'));if(_0x5b6223[_0x74aa('0x3e')][_0x74aa('0x2d')]==='MicrosoftAzure'&&_0x5b6223[_0x74aa('0x3e')][_0x74aa('0x2e')]){_0x5b6223[_0x74aa('0x3e')]['data3']=encryptor[_0x74aa('0x41')](_0x5b6223[_0x74aa('0x3e')]['data3']);}return db['CloudProvider'][_0x74aa('0x38')](_0x5b6223['body'],{})[_0x74aa('0x15')](respondWithResult(_0x3a48a0,0xc9))[_0x74aa('0x2f')](handleError(_0x3a48a0,null));};exports[_0x74aa('0x13')]=function(_0x19ba21,_0x1323c9){if(_0x19ba21[_0x74aa('0x3e')]['id']){delete _0x19ba21['body']['id'];}return db['CloudProvider'][_0x74aa('0x36')]({'where':{'id':_0x19ba21[_0x74aa('0x31')]['id']}})[_0x74aa('0x15')](handleEntityNotFound(_0x1323c9,null))[_0x74aa('0x15')](function(_0x1142fd){if(_0x1142fd[_0x74aa('0x2d')]===_0x74aa('0x37')&&_0x19ba21[_0x74aa('0x3e')]['data3']){_0x19ba21[_0x74aa('0x3e')][_0x74aa('0x2e')]=encryptor['encryptString'](_0x19ba21[_0x74aa('0x3e')][_0x74aa('0x2e')]);}return _0x1142fd;})[_0x74aa('0x15')](saveUpdates(_0x19ba21[_0x74aa('0x3e')],null))[_0x74aa('0x15')](respondWithResult(_0x1323c9,null))[_0x74aa('0x2f')](handleError(_0x1323c9,null));};exports['destroy']=function(_0x26a9d2,_0x566c0e){return db['CloudProvider'][_0x74aa('0x36')]({'where':{'id':_0x26a9d2[_0x74aa('0x31')]['id']}})[_0x74aa('0x15')](handleEntityNotFound(_0x566c0e,null))[_0x74aa('0x15')](removeEntity(_0x566c0e,null))[_0x74aa('0x2f')](handleError(_0x566c0e,null));};exports[_0x74aa('0x42')]=function(_0x17338b,_0x1f665c){return db[_0x74aa('0x1c')]['findOne']({'where':{'id':_0x17338b[_0x74aa('0x31')]['id']},'raw':!![]})[_0x74aa('0x15')](function(_0x1cdaf7){if(!_0x1cdaf7)return _0x1f665c[_0x74aa('0xa')](0x194);return{'url':oauth[_0x74aa('0x43')](_0x1cdaf7,_0x17338b[_0x74aa('0x44')]['id'])};})['then'](respondWithResult(_0x1f665c,null))[_0x74aa('0x2f')](handleError(_0x1f665c,null));};exports[_0x74aa('0x45')]=function(_0x26599d,_0x206c09){var _0x3c453d=_0x26599d['body'];var _0x4cc8ef;var _0x2c08be;if(_0x3c453d[_0x74aa('0x17')])throw _0x3c453d;redis[_0x74aa('0x46')](_0x3c453d[_0x74aa('0x47')])[_0x74aa('0x15')](function(_0x22b26b){if(!_0x22b26b)throw new Error('Invalid\x20state\x20parameter');_0x4cc8ef=JSON[_0x74aa('0x48')](_0x22b26b);var _0x338ff3=Buffer['from'](_0x3c453d[_0x74aa('0x47')],_0x74aa('0x49'))[_0x74aa('0x4a')](_0x74aa('0x4b'));_0x2c08be=JSON[_0x74aa('0x48')](_0x338ff3);if(!oauth[_0x74aa('0x4c')](_0x3c453d[_0x74aa('0x4d')],_0x4cc8ef[_0x74aa('0x4e')]))throw new Error(_0x74aa('0x4f'));redis[_0x74aa('0x50')](_0x3c453d[_0x74aa('0x47')]);return oauth['getOauth2MicrosoftAccessToken'](_0x3c453d[_0x74aa('0x51')],_0x4cc8ef);})[_0x74aa('0x15')](function(_0x13a630){_0x4cc8ef[_0x74aa('0x52')]=_0x13a630[_0x74aa('0x53')];_0x4cc8ef[_0x74aa('0x54')]=_0x13a630[_0x74aa('0x55')];return db[_0x74aa('0x1c')]['update']({'data5':_0x4cc8ef['data5'],'data6':_0x4cc8ef[_0x74aa('0x54')]},{'where':{'id':_0x4cc8ef['id']}});})[_0x74aa('0x15')](function(){oauth[_0x74aa('0x56')](_0x4cc8ef);socket['emit']('microsoftAuthorization:success',{'id':_0x2c08be['id']});return;})['then'](respondWithStatusCode(_0x206c09,null))['catch'](function(_0x30d628){if(_0x2c08be){socket[_0x74aa('0x57')](_0x74aa('0x58'),{'id':_0x2c08be['id']});}if(!_0x4cc8ef){logger[_0x74aa('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x30d628);return _0x206c09[_0x74aa('0xb')](0x1f4)[_0x74aa('0x59')](_0x30d628[_0x74aa('0x5a')]);}logger['error'](_0x74aa('0x5b'),_0x4cc8ef['id'],JSON[_0x74aa('0x5c')](_0x30d628));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ee0a215..e9f9299 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 _0x7b4d=['cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x391c58,_0x384957){var _0xce59da=function(_0x1966da){while(--_0x1966da){_0x391c58['push'](_0x391c58['shift']());}};_0xce59da(++_0x384957);}(_0x7b4d,0x1c8));var _0xd7b4=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x7b4d[_0x340380];return _0x49ce1c;};'use strict';var _=require(_0xd7b4('0x0'));var util=require(_0xd7b4('0x1'));var logger=require(_0xd7b4('0x2'))(_0xd7b4('0x3'));var moment=require(_0xd7b4('0x4'));var BPromise=require(_0xd7b4('0x5'));var rp=require(_0xd7b4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7b4('0x7'));var config=require(_0xd7b4('0x8'));var attributes=require(_0xd7b4('0x9'));module[_0xd7b4('0xa')]=function(_0x16d0b6,_0x447f03){return _0x16d0b6[_0xd7b4('0xb')]('CloudProvider',attributes,{'tableName':_0xd7b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72c5=['cloud_providers','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x3890b5,_0x2092ef){var _0x5836cd=function(_0xcef6c1){while(--_0xcef6c1){_0x3890b5['push'](_0x3890b5['shift']());}};_0x5836cd(++_0x2092ef);}(_0x72c5,0xde));var _0x572c=function(_0x2d69a4,_0x32935e){_0x2d69a4=_0x2d69a4-0x0;var _0xe0705b=_0x72c5[_0x2d69a4];return _0xe0705b;};'use strict';var _=require(_0x572c('0x0'));var util=require('util');var logger=require(_0x572c('0x1'))(_0x572c('0x2'));var moment=require(_0x572c('0x3'));var BPromise=require('bluebird');var rp=require(_0x572c('0x4'));var fs=require('fs');var path=require(_0x572c('0x5'));var rimraf=require(_0x572c('0x6'));var config=require(_0x572c('0x7'));var attributes=require(_0x572c('0x8'));module[_0x572c('0x9')]=function(_0x1b0b7f,_0x4287cd){return _0x1b0b7f[_0x572c('0xa')](_0x572c('0xb'),attributes,{'tableName':_0x572c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 0592bfa..cab8a85 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6945=['../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','type','Dynamics365','push','data7','/.default','Outlook365','replace','data2','code','id_token','stringify','toString','randomBytes','client_id','response_type','join','data4','response_mode','form_post','state','prompt','login','map','value','oauth2/','data1','set','decode','payload','iss','issuer','aud','nonce','isAfter','exp','then','refresh_token','decryptString','data3','POST','{TENANT_ID}','data5','update','data6','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','CloudProvider','findAll','all','error','exports','moment','ioredis','request-promise','util','../../components/encryptor'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6945,0x123));var _0x5694=function(_0x5a01be,_0x45c41d){_0x5a01be=_0x5a01be-0x0;var _0x1f3e49=_0x6945[_0x5a01be];return _0x1f3e49;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0x5694('0x0'));var Redis=require(_0x5694('0x1'));var rp=require(_0x5694('0x2'));var util=require(_0x5694('0x3'));var encryptor=require(_0x5694('0x4'));var config=require(_0x5694('0x5'));var logger=require('../../config/logger')(_0x5694('0x6'));var schedule=require(_0x5694('0x7'));var db=require(_0x5694('0x8'))['db'];config[_0x5694('0x9')]=_[_0x5694('0xa')](config[_0x5694('0x9')],{'host':_0x5694('0xb'),'port':0x18eb});var redis=new Redis(config[_0x5694('0x9')]);var MICROSOFT_AUTH_URL=_0x5694('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x5694('0xd'),_0x5694('0xe'),_0x5694('0xf'),_0x5694('0x10'),_0x5694('0x11'),_0x5694('0x12'),_0x5694('0x13')],'Dynamics365':[_0x5694('0xd'),_0x5694('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x5694('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x39b7a8){var _0x4ca0b9=_['map'](AZURE_AUTH_SCOPES[_0x39b7a8[_0x5694('0x15')]]);if(_0x39b7a8[_0x5694('0x15')]===_0x5694('0x16'))_0x4ca0b9[_0x5694('0x17')](_0x39b7a8[_0x5694('0x18')]+_0x5694('0x19'));return _0x4ca0b9['join']('\x20');}function getAccessTokenScope(_0x3a97ce){if(_0x3a97ce[_0x5694('0x15')]===_0x5694('0x1a'))return _0x5694('0x11');if(_0x3a97ce[_0x5694('0x15')]===_0x5694('0x16'))return _0x3a97ce[_0x5694('0x18')]+_0x5694('0x19');}function generateMicrosoftAuthorizationUrl(_0x15b846,_0x299ff9){var _0x2c5ac8=MICROSOFT_AUTH_URL[_0x5694('0x1b')]('{TENANT_ID}',_0x15b846[_0x5694('0x1c')]);var _0x46dc12=[_0x5694('0x1d'),_0x5694('0x1e')];var _0x10abbf=Buffer['from'](JSON[_0x5694('0x1f')]({'id':_0x299ff9}))[_0x5694('0x20')]('base64');var _0x410975=crypto[_0x5694('0x21')](0x10)[_0x5694('0x20')]('hex');var _0x1723d7=getAuthorizationScopes(_0x15b846);var _0x24f8d1=[{'key':_0x5694('0x22'),'value':_0x15b846['data1']},{'key':_0x5694('0x23'),'value':encodeURIComponent(_0x46dc12[_0x5694('0x24')]('\x20'))},{'key':'redirect_uri','value':_0x15b846[_0x5694('0x25')]},{'key':_0x5694('0x26'),'value':_0x5694('0x27')},{'key':'scope','value':encodeURIComponent(_0x1723d7)},{'key':_0x5694('0x28'),'value':_0x10abbf},{'key':'nonce','value':_0x410975},{'key':_0x5694('0x29'),'value':_0x5694('0x2a')}];var _0xf3ddc5=_0x2c5ac8+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5694('0x2b')](_0x24f8d1,function(_0x5a6828){return _0x5a6828['key']+'='+_0x5a6828[_0x5694('0x2c')];})['join']('&');_0x15b846['oauth2Claims']={'issuer':_0x2c5ac8['replace'](_0x5694('0x2d'),''),'audience':_0x15b846[_0x5694('0x2e')],'state':_0x10abbf,'nonce':_0x410975};redis[_0x5694('0x2f')](_0x10abbf,JSON['stringify'](_0x15b846));return _0xf3ddc5;}function isValidIdToken(_0x594dd2,_0x3343b5){try{var _0x1d2039=jwt[_0x5694('0x30')](_0x594dd2,{'complete':!![]});var _0x59b96d=_0x1d2039[_0x5694('0x31')];if(_0x59b96d[_0x5694('0x32')]!==_0x3343b5[_0x5694('0x33')])return![];if(_0x59b96d[_0x5694('0x34')]!==_0x3343b5['audience'])return![];if(_0x59b96d[_0x5694('0x35')]!==_0x3343b5[_0x5694('0x35')])return![];if(moment()[_0x5694('0x36')](moment['unix'](_0x59b96d[_0x5694('0x37')])))return![];return!![];}catch(_0x5514ea){throw _0x5514ea;}}function refreshOauth2MicrosoftAccessToken(_0xa2d60f){return Promise['resolve']()[_0x5694('0x38')](function(){if(_0xa2d60f['data3'])return _0xa2d60f;return db['CloudProvider']['findOne']({'where':{'id':_0xa2d60f['id']},'raw':!![]});})[_0x5694('0x38')](function(_0x39c97f){var _0x3b2b4d={'grant_type':_0x5694('0x39'),'refresh_token':_0x39c97f['data6'],'scope':getAccessTokenScope(_0x39c97f),'redirect_uri':_0x39c97f['data4'],'client_id':_0x39c97f[_0x5694('0x2e')],'client_secret':encryptor[_0x5694('0x3a')](_0x39c97f[_0x5694('0x3b')])};var _0x566f04={'method':_0x5694('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0x5694('0x3d'),_0x39c97f['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3b2b4d,'json':!![]};return rp(_0x566f04);})[_0x5694('0x38')](function(_0x3b616f){_0xa2d60f[_0x5694('0x3e')]=_0x3b616f['access_token'];_0xa2d60f['data6']=_0x3b616f[_0x5694('0x39')];return db['CloudProvider'][_0x5694('0x3f')]({'data5':_0xa2d60f[_0x5694('0x3e')],'data6':_0xa2d60f[_0x5694('0x40')]},{'where':{'id':_0xa2d60f['id']}});})[_0x5694('0x38')](function(){return _0xa2d60f;})[_0x5694('0x41')](function(_0x1eb70e){logger['error'](_0x5694('0x42'),_0xa2d60f['id'],_0x1eb70e);});}function getOauth2MicrosoftAccessToken(_0x25eae1,_0x4bf65a){var _0x140eb5={'grant_type':_0x5694('0x43'),'code':_0x25eae1,'scope':getAccessTokenScope(_0x4bf65a),'redirect_uri':_0x4bf65a[_0x5694('0x25')],'client_id':_0x4bf65a[_0x5694('0x2e')],'client_secret':encryptor[_0x5694('0x3a')](_0x4bf65a['data3'])};var _0x771a0b={'method':_0x5694('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x5694('0x1b')](_0x5694('0x3d'),_0x4bf65a[_0x5694('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x140eb5,'json':!![]};return rp(_0x771a0b);}function startRefreshInterval(_0x59f4db){var _0x50153b=schedule['intervals'];if(_0x50153b[_0x59f4db['id']])clearInterval(_0x50153b[_0x59f4db['id']]);_0x50153b[_0x59f4db['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5694('0x44')](this,{'id':_0x59f4db['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x50153b;}function startAllRefreshIntervals(){return db[_0x5694('0x45')][_0x5694('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5694('0x38')](function(_0x43b762){var _0x46bd86=_0x43b762[_0x5694('0x2b')](function(_0x34959d){return refreshOauth2MicrosoftAccessToken(_0x34959d)['then'](function(_0x54a0fe){startRefreshInterval(_0x54a0fe);});});return Promise[_0x5694('0x47')](_0x46bd86);})[_0x5694('0x41')](function(_0x11b50f){var _0x471024=_0x11b50f?util['inspect'](_0x11b50f,{'showHidden':![],'depth':null}):'';logger[_0x5694('0x48')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x471024);});}module[_0x5694('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x1071=['payload','iss','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','Dynamics365','push','data7','join','type','Outlook365','/.default','replace','{TENANT_ID}','data2','code','id_token','from','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','nonce','login','map','key','value','oauth2Claims','oauth2/','set','stringify','decode'];(function(_0x4066d1,_0xddaabe){var _0x4d38cd=function(_0x41f589){while(--_0x41f589){_0x4066d1['push'](_0x4066d1['shift']());}};_0x4d38cd(++_0xddaabe);}(_0x1071,0x1bf));var _0x1107=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1071[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1107('0x0'));var crypto=require(_0x1107('0x1'));var jwt=require(_0x1107('0x2'));var moment=require(_0x1107('0x3'));var Redis=require(_0x1107('0x4'));var rp=require(_0x1107('0x5'));var util=require('util');var encryptor=require(_0x1107('0x6'));var config=require(_0x1107('0x7'));var logger=require(_0x1107('0x8'))('api');var schedule=require(_0x1107('0x9'));var db=require(_0x1107('0xa'))['db'];config[_0x1107('0xb')]=_[_0x1107('0xc')](config[_0x1107('0xb')],{'host':_0x1107('0xd'),'port':0x18eb});var redis=new Redis(config[_0x1107('0xb')]);var MICROSOFT_AUTH_URL=_0x1107('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0x1107('0xf'),_0x1107('0x10'),_0x1107('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x1107('0x12')],'Dynamics365':[_0x1107('0x13'),_0x1107('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x1107('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x1107('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x270111){var _0xe79d24=_['map'](AZURE_AUTH_SCOPES[_0x270111['type']]);if(_0x270111['type']===_0x1107('0x16'))_0xe79d24[_0x1107('0x17')](_0x270111[_0x1107('0x18')]+'/.default');return _0xe79d24[_0x1107('0x19')]('\x20');}function getAccessTokenScope(_0x505aab){if(_0x505aab[_0x1107('0x1a')]===_0x1107('0x1b'))return _0x1107('0x11');if(_0x505aab[_0x1107('0x1a')]===_0x1107('0x16'))return _0x505aab[_0x1107('0x18')]+_0x1107('0x1c');}function generateMicrosoftAuthorizationUrl(_0xb681a,_0x39556a){var _0x2003cd=MICROSOFT_AUTH_URL[_0x1107('0x1d')](_0x1107('0x1e'),_0xb681a[_0x1107('0x1f')]);var _0x5db5ed=[_0x1107('0x20'),_0x1107('0x21')];var _0x1cc553=Buffer[_0x1107('0x22')](JSON['stringify']({'id':_0x39556a}))['toString'](_0x1107('0x23'));var _0x3d2e20=crypto[_0x1107('0x24')](0x10)[_0x1107('0x25')](_0x1107('0x26'));var _0x387a54=getAuthorizationScopes(_0xb681a);var _0x4aa4bf=[{'key':_0x1107('0x27'),'value':_0xb681a[_0x1107('0x28')]},{'key':_0x1107('0x29'),'value':encodeURIComponent(_0x5db5ed[_0x1107('0x19')]('\x20'))},{'key':_0x1107('0x2a'),'value':_0xb681a['data4']},{'key':_0x1107('0x2b'),'value':_0x1107('0x2c')},{'key':_0x1107('0x2d'),'value':encodeURIComponent(_0x387a54)},{'key':_0x1107('0x2e'),'value':_0x1cc553},{'key':_0x1107('0x2f'),'value':_0x3d2e20},{'key':'prompt','value':_0x1107('0x30')}];var _0x175eab=_0x2003cd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1107('0x31')](_0x4aa4bf,function(_0x2166e5){return _0x2166e5[_0x1107('0x32')]+'='+_0x2166e5[_0x1107('0x33')];})[_0x1107('0x19')]('&');_0xb681a[_0x1107('0x34')]={'issuer':_0x2003cd[_0x1107('0x1d')](_0x1107('0x35'),''),'audience':_0xb681a['data1'],'state':_0x1cc553,'nonce':_0x3d2e20};redis[_0x1107('0x36')](_0x1cc553,JSON[_0x1107('0x37')](_0xb681a));return _0x175eab;}function isValidIdToken(_0x4d0db0,_0x226d7d){try{var _0x365bd1=jwt[_0x1107('0x38')](_0x4d0db0,{'complete':!![]});var _0x1efe62=_0x365bd1[_0x1107('0x39')];if(_0x1efe62[_0x1107('0x3a')]!==_0x226d7d['issuer'])return![];if(_0x1efe62['aud']!==_0x226d7d[_0x1107('0x3b')])return![];if(_0x1efe62[_0x1107('0x2f')]!==_0x226d7d[_0x1107('0x2f')])return![];if(moment()[_0x1107('0x3c')](moment[_0x1107('0x3d')](_0x1efe62['exp'])))return![];return!![];}catch(_0x29f355){throw _0x29f355;}}function refreshOauth2MicrosoftAccessToken(_0x200f7c){return Promise[_0x1107('0x3e')]()[_0x1107('0x3f')](function(){if(_0x200f7c[_0x1107('0x40')])return _0x200f7c;return db[_0x1107('0x41')][_0x1107('0x42')]({'where':{'id':_0x200f7c['id']},'raw':!![]});})[_0x1107('0x3f')](function(_0xdbb40e){var _0x3955af={'grant_type':_0x1107('0x43'),'refresh_token':_0xdbb40e[_0x1107('0x44')],'scope':getAccessTokenScope(_0xdbb40e),'redirect_uri':_0xdbb40e['data4'],'client_id':_0xdbb40e[_0x1107('0x28')],'client_secret':encryptor[_0x1107('0x45')](_0xdbb40e[_0x1107('0x40')])};var _0x511fe4={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x1107('0x1e'),_0xdbb40e[_0x1107('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3955af,'json':!![]};return rp(_0x511fe4);})[_0x1107('0x3f')](function(_0x32f163){_0x200f7c['data5']=_0x32f163[_0x1107('0x46')];_0x200f7c[_0x1107('0x44')]=_0x32f163[_0x1107('0x43')];return db['CloudProvider'][_0x1107('0x47')]({'data5':_0x200f7c['data5'],'data6':_0x200f7c[_0x1107('0x44')]},{'where':{'id':_0x200f7c['id']}});})[_0x1107('0x3f')](function(){return _0x200f7c;})[_0x1107('0x48')](function(_0x14c12e){logger[_0x1107('0x49')](_0x1107('0x4a'),_0x200f7c['id'],_0x14c12e);});}function getOauth2MicrosoftAccessToken(_0x4f42be,_0x32fd90){var _0xf74519={'grant_type':_0x1107('0x4b'),'code':_0x4f42be,'scope':getAccessTokenScope(_0x32fd90),'redirect_uri':_0x32fd90['data4'],'client_id':_0x32fd90[_0x1107('0x28')],'client_secret':encryptor[_0x1107('0x45')](_0x32fd90[_0x1107('0x40')])};var _0x2dfe10={'method':_0x1107('0x4c'),'uri':MICROSOFT_AUTH_URL[_0x1107('0x1d')](_0x1107('0x1e'),_0x32fd90[_0x1107('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf74519,'json':!![]};return rp(_0x2dfe10);}function startRefreshInterval(_0xb9c36d){var _0x485e25=schedule[_0x1107('0x4d')];if(_0x485e25[_0xb9c36d['id']])clearInterval(_0x485e25[_0xb9c36d['id']]);_0x485e25[_0xb9c36d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1107('0x4e')](this,{'id':_0xb9c36d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x485e25;}function startAllRefreshIntervals(){return db[_0x1107('0x41')][_0x1107('0x4f')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1107('0x3f')](function(_0x67ec11){var _0x5d1834=_0x67ec11[_0x1107('0x31')](function(_0xdc5a60){return refreshOauth2MicrosoftAccessToken(_0xdc5a60)['then'](function(_0x28a157){startRefreshInterval(_0x28a157);});});return Promise[_0x1107('0x50')](_0x5d1834);})[_0x1107('0x48')](function(_0x22d80a){var _0x3e6a64=_0x22d80a?util[_0x1107('0x51')](_0x22d80a,{'showHidden':![],'depth':null}):'';logger[_0x1107('0x49')](_0x1107('0x52'),_0x3e6a64);});}module[_0x1107('0x53')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 62c64c0..792e5c0 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 _0xf2e3=['then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5c7f2f,_0xeae2ec){var _0x508ec0=function(_0x1469ec){while(--_0x1469ec){_0x5c7f2f['push'](_0x5c7f2f['shift']());}};_0x508ec0(++_0xeae2ec);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xf2e3[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});} \ No newline at end of file +var _0x28f2=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x2c2954,_0x3cadf4){var _0x1e834e=function(_0x9f157e){while(--_0x9f157e){_0x2c2954['push'](_0x2c2954['shift']());}};_0x1e834e(++_0x3cadf4);}(_0x28f2,0x193));var _0x228f=function(_0x4672d4,_0x6c9725){_0x4672d4=_0x4672d4-0x0;var _0x1a2f2d=_0x28f2[_0x4672d4];return _0x1a2f2d;};'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')]('CloudProvider,\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);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c84150a..dd08dfb 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x281e38,_0x26c038){var _0x4d3209=function(_0x386624){while(--_0x386624){_0x281e38['push'](_0x281e38['shift']());}};_0x4d3209(++_0x26c038);}(_0xdb28,0x106));var _0x8db2=function(_0x3f6128,_0x182dee){_0x3f6128=_0x3f6128-0x0;var _0x5e6a5e=_0xdb28[_0x3f6128];return _0x5e6a5e;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x1261,0x144));var _0x1126=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0x1261[_0x35a779];return _0xca723b;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cdc4396..ea3263c 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 _0x0532=['sequelize','exports','STRING','name'];(function(_0x3e2ea3,_0x26ebe3){var _0x203aa6=function(_0x196d8d){while(--_0x196d8d){_0x3e2ea3['push'](_0x3e2ea3['shift']());}};_0x203aa6(++_0x26ebe3);}(_0x0532,0x16c));var _0x2053=function(_0x106f4c,_0x38a39b){_0x106f4c=_0x106f4c-0x0;var _0x4208d5=_0x0532[_0x106f4c];return _0x4208d5;};'use strict';var Sequelize=require(_0x2053('0x0'));module[_0x2053('0x1')]={'name':{'type':Sequelize[_0x2053('0x2')],'unique':_0x2053('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2053('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x2053('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x2053('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x2053('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2053('0x2')]},'email':{'type':Sequelize[_0x2053('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2053('0x2')]},'sStreet':{'type':Sequelize[_0x2053('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x2053('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4703=['name','STRING','sequelize','exports'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4703,0xd2));var _0x3470=function(_0x1da655,_0x2285e9){_0x1da655=_0x1da655-0x0;var _0x27b05e=_0x4703[_0x1da655];return _0x27b05e;};'use strict';var Sequelize=require(_0x3470('0x0'));module[_0x3470('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3470('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3470('0x3')]},'companyId':{'type':Sequelize[_0x3470('0x3')]},'website':{'type':Sequelize[_0x3470('0x3')]},'phone':{'type':Sequelize[_0x3470('0x3')]},'fax':{'type':Sequelize[_0x3470('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3470('0x3')]},'postalCode':{'type':Sequelize[_0x3470('0x3')]},'city':{'type':Sequelize[_0x3470('0x3')]},'country':{'type':Sequelize[_0x3470('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3470('0x3')]},'sStreet':{'type':Sequelize[_0x3470('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x3470('0x3')]},'sCountry':{'type':Sequelize[_0x3470('0x3')]},'description':{'type':Sequelize[_0x3470('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e392018..b57b40c 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 _0xe399=['save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','send','index','describe','keys','query','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','model','fields','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','map','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0xe1b3c7,_0x484713){var _0x5aa656=function(_0x409efe){while(--_0x409efe){_0xe1b3c7['push'](_0xe1b3c7['shift']());}};_0x5aa656(++_0x484713);}(_0xe399,0x140));var _0x9e39=function(_0x39284f,_0x43c009){_0x39284f=_0x39284f-0x0;var _0x235447=_0xe399[_0x39284f];return _0x235447;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e39('0x0'));var zipdir=require(_0x9e39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e39('0x2'));var moment=require(_0x9e39('0x3'));var BPromise=require(_0x9e39('0x4'));var Mustache=require(_0x9e39('0x5'));var util=require(_0x9e39('0x6'));var path=require(_0x9e39('0x7'));var sox=require('sox');var csv=require(_0x9e39('0x8'));var ejs=require(_0x9e39('0x9'));var fs=require('fs');var fs_extra=require(_0x9e39('0xa'));var _=require(_0x9e39('0xb'));var squel=require('squel');var crypto=require(_0x9e39('0xc'));var jsforce=require(_0x9e39('0xd'));var deskjs=require(_0x9e39('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e39('0xf'));var Redis=require(_0x9e39('0x10'));var authService=require(_0x9e39('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9e39('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e39('0x13'))(_0x9e39('0x14'));var utils=require(_0x9e39('0x15'));var config=require(_0x9e39('0x16'));var licenseUtil=require(_0x9e39('0x17'));var db=require(_0x9e39('0x18'))['db'];function respondWithStatusCode(_0x1e2d47,_0x4c9260){_0x4c9260=_0x4c9260||0xcc;return function(_0x580bbe){if(_0x580bbe){return _0x1e2d47['sendStatus'](_0x4c9260);}return _0x1e2d47[_0x9e39('0x19')](_0x4c9260)[_0x9e39('0x1a')]();};}function respondWithResult(_0x3c0a91,_0x21f421){_0x21f421=_0x21f421||0xc8;return function(_0x45a57f){if(_0x45a57f){return _0x3c0a91[_0x9e39('0x19')](_0x21f421)[_0x9e39('0x1b')](_0x45a57f);}};}function respondWithFilteredResult(_0x5533be,_0x5c9e69){return function(_0x418969){if(_0x418969){var _0x45af98=typeof _0x5c9e69[_0x9e39('0x1c')]===_0x9e39('0x1d')&&typeof _0x5c9e69[_0x9e39('0x1e')]==='undefined';var _0x5688b9=_0x418969[_0x9e39('0x1f')];var _0x31f7a9=_0x45af98?0x0:_0x5c9e69['offset'];var _0x232cfb=_0x45af98?_0x418969[_0x9e39('0x1f')]:_0x5c9e69[_0x9e39('0x1c')]+_0x5c9e69[_0x9e39('0x1e')];var _0x1c2f2d;if(_0x232cfb>=_0x5688b9){_0x232cfb=_0x5688b9;_0x1c2f2d=0xc8;}else{_0x1c2f2d=0xce;}_0x5533be[_0x9e39('0x19')](_0x1c2f2d);return _0x5533be[_0x9e39('0x20')](_0x9e39('0x21'),_0x31f7a9+'-'+_0x232cfb+'/'+_0x5688b9)[_0x9e39('0x1b')](_0x418969);}return null;};}function patchUpdates(_0x4102bb){return function(_0x3b632e){try{jsonpatch[_0x9e39('0x22')](_0x3b632e,_0x4102bb,!![]);}catch(_0x347fbd){return BPromise[_0x9e39('0x23')](_0x347fbd);}return _0x3b632e[_0x9e39('0x24')]();};}function saveUpdates(_0x255394,_0x2cce29){return function(_0x550977){if(_0x550977){return _0x550977[_0x9e39('0x25')](_0x255394)['then'](function(_0x315b37){return _0x315b37;});}return null;};}function removeEntity(_0x559279,_0x19d1d1){return function(_0xf1714c){if(_0xf1714c){return _0xf1714c[_0x9e39('0x26')]()[_0x9e39('0x27')](function(){var _0x3b92b9=_0xf1714c[_0x9e39('0x28')]({'plain':!![]});var _0x235a9f='Companies';return db[_0x9e39('0x29')][_0x9e39('0x26')]({'where':{'type':_0x235a9f,'resourceId':_0x3b92b9['id']}})[_0x9e39('0x27')](function(){return _0xf1714c;});})[_0x9e39('0x27')](function(){_0x559279[_0x9e39('0x19')](0xcc)[_0x9e39('0x1a')]();});}};}function handleEntityNotFound(_0xf1bb4b,_0x745f53){return function(_0x1ef6f6){if(!_0x1ef6f6){_0xf1bb4b[_0x9e39('0x2a')](0x194);}return _0x1ef6f6;};}function handleError(_0x113bf2,_0x4cbe05){_0x4cbe05=_0x4cbe05||0x1f4;return function(_0xc53c98){logger[_0x9e39('0x2b')](_0xc53c98[_0x9e39('0x2c')]);if(_0xc53c98['name']){delete _0xc53c98['name'];}_0x113bf2[_0x9e39('0x19')](_0x4cbe05)[_0x9e39('0x2d')](_0xc53c98);};}exports[_0x9e39('0x2e')]=function(_0x341502,_0x1d87f3){var _0x2ac69c={},_0x1be571={},_0x46338d={'count':0x0,'rows':[]};return db['CmCompany'][_0x9e39('0x2f')]()['then'](function(_0x1b600e){_0x1be571['model']=_[_0x9e39('0x30')](_0x1b600e);_0x1be571['query']=_[_0x9e39('0x30')](_0x341502[_0x9e39('0x31')]);_0x1be571[_0x9e39('0x32')]=_[_0x9e39('0x33')](_0x1be571['model'],_0x1be571[_0x9e39('0x31')]);_0x2ac69c[_0x9e39('0x34')]=_[_0x9e39('0x33')](_0x1be571['model'],qs['fields'](_0x341502['query']['fields']));_0x2ac69c[_0x9e39('0x34')]=_0x2ac69c[_0x9e39('0x34')][_0x9e39('0x35')]?_0x2ac69c[_0x9e39('0x34')]:_0x1be571['model'];if(!_0x341502['query']['hasOwnProperty']('nolimit')){_0x2ac69c['limit']=qs[_0x9e39('0x1e')](_0x341502[_0x9e39('0x31')][_0x9e39('0x1e')]);_0x2ac69c['offset']=qs[_0x9e39('0x1c')](_0x341502[_0x9e39('0x31')]['offset']);}_0x2ac69c[_0x9e39('0x36')]=qs['sort'](_0x341502['query'][_0x9e39('0x37')]);_0x2ac69c[_0x9e39('0x38')]=qs['filters'](_[_0x9e39('0x39')](_0x341502['query'],_0x1be571[_0x9e39('0x32')]),_0x1b600e);if(_0x341502['query'][_0x9e39('0x3a')]){_0x2ac69c['where']=_[_0x9e39('0x3b')](_0x2ac69c[_0x9e39('0x38')],{'$or':_['map'](_0x2ac69c['attributes'],function(_0x370592){var _0x1ee377={};_0x1ee377[_0x370592]={'$like':'%'+_0x341502[_0x9e39('0x31')][_0x9e39('0x3a')]+'%'};return _0x1ee377;})});}_0x2ac69c=_[_0x9e39('0x3b')]({},_0x2ac69c,_0x341502[_0x9e39('0x3c')]);var _0x116617={'where':_0x2ac69c[_0x9e39('0x38')]};return db[_0x9e39('0x3d')][_0x9e39('0x1f')](_0x116617)['then'](function(_0x1c27af){_0x46338d[_0x9e39('0x1f')]=_0x1c27af;if(_0x341502[_0x9e39('0x31')][_0x9e39('0x3e')]){_0x2ac69c[_0x9e39('0x3f')]=[{'all':!![]}];}return db[_0x9e39('0x3d')][_0x9e39('0x40')](_0x2ac69c);})['then'](function(_0x39cf92){_0x46338d[_0x9e39('0x41')]=_0x39cf92;return _0x46338d;})[_0x9e39('0x27')](respondWithFilteredResult(_0x1d87f3,_0x2ac69c))[_0x9e39('0x42')](handleError(_0x1d87f3,null));})[_0x9e39('0x42')](handleError(_0x1d87f3,null));};exports[_0x9e39('0x43')]=function(_0x3ab2c0,_0x3d44b7){var _0x243524={'raw':![],'where':{'id':_0x3ab2c0[_0x9e39('0x44')]['id']}},_0x2e846f={};_0x2e846f['model']=_[_0x9e39('0x30')](db[_0x9e39('0x3d')]['rawAttributes']);_0x2e846f[_0x9e39('0x31')]=_[_0x9e39('0x30')](_0x3ab2c0[_0x9e39('0x31')]);_0x2e846f[_0x9e39('0x32')]=_[_0x9e39('0x33')](_0x2e846f[_0x9e39('0x45')],_0x2e846f['query']);_0x243524[_0x9e39('0x34')]=_[_0x9e39('0x33')](_0x2e846f[_0x9e39('0x45')],qs[_0x9e39('0x46')](_0x3ab2c0['query'][_0x9e39('0x46')]));_0x243524[_0x9e39('0x34')]=_0x243524['attributes'][_0x9e39('0x35')]?_0x243524[_0x9e39('0x34')]:_0x2e846f[_0x9e39('0x45')];if(_0x3ab2c0[_0x9e39('0x31')][_0x9e39('0x3e')]){_0x243524[_0x9e39('0x3f')]=[{'all':!![]}];}_0x243524=_[_0x9e39('0x3b')]({},_0x243524,_0x3ab2c0['options']);return db['CmCompany']['find'](_0x243524)[_0x9e39('0x27')](handleEntityNotFound(_0x3d44b7,null))[_0x9e39('0x27')](respondWithResult(_0x3d44b7,null))[_0x9e39('0x42')](handleError(_0x3d44b7,null));};exports[_0x9e39('0x47')]=function(_0x5b2429,_0x6853af){return db['CmCompany']['create'](_0x5b2429[_0x9e39('0x48')],{})['then'](function(_0x80b8b3){var _0x5d3e05=_0x5b2429['user'][_0x9e39('0x28')]({'plain':!![]});if(!_0x5d3e05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d3e05['role']===_0x9e39('0x49')){var _0xf4c2e=_0x80b8b3[_0x9e39('0x28')]({'plain':!![]});var _0x501ff7='Companies';return db[_0x9e39('0x4a')][_0x9e39('0x4b')]({'where':{'name':_0x501ff7,'userProfileId':_0x5d3e05[_0x9e39('0x4c')]},'raw':!![]})[_0x9e39('0x27')](function(_0x347a5f){if(_0x347a5f&&_0x347a5f[_0x9e39('0x4d')]===0x0){return db['UserProfileResource'][_0x9e39('0x47')]({'name':_0xf4c2e[_0x9e39('0x4e')],'resourceId':_0xf4c2e['id'],'type':_0x347a5f['name'],'sectionId':_0x347a5f['id']},{})[_0x9e39('0x27')](function(){return _0x80b8b3;});}else{return _0x80b8b3;}})[_0x9e39('0x42')](function(_0x1708e2){logger['error'](_0x9e39('0x4f'),_0x1708e2);throw _0x1708e2;});}return _0x80b8b3;})['then'](respondWithResult(_0x6853af,0xc9))['catch'](handleError(_0x6853af,null));};exports['update']=function(_0xec272e,_0x7f9c59){if(_0xec272e[_0x9e39('0x48')]['id']){delete _0xec272e['body']['id'];}return db['CmCompany'][_0x9e39('0x4b')]({'where':{'id':_0xec272e['params']['id']}})[_0x9e39('0x27')](handleEntityNotFound(_0x7f9c59,null))[_0x9e39('0x27')](saveUpdates(_0xec272e[_0x9e39('0x48')],null))[_0x9e39('0x27')](respondWithResult(_0x7f9c59,null))[_0x9e39('0x42')](handleError(_0x7f9c59,null));};exports['destroy']=function(_0x4c8637,_0x209172){return db[_0x9e39('0x3d')][_0x9e39('0x4b')]({'where':{'id':_0x4c8637[_0x9e39('0x44')]['id']}})[_0x9e39('0x27')](handleEntityNotFound(_0x209172,null))[_0x9e39('0x27')](removeEntity(_0x209172,null))[_0x9e39('0x42')](handleError(_0x209172,null));};exports[_0x9e39('0x2f')]=function(_0x1bcb44,_0x6290e4){return db[_0x9e39('0x3d')][_0x9e39('0x2f')]()['then'](respondWithResult(_0x6290e4,null))[_0x9e39('0x42')](handleError(_0x6290e4,null));};exports[_0x9e39('0x50')]=function(_0x5a37d4,_0x29700e,_0x12e548){return db[_0x9e39('0x51')][_0x9e39('0x4b')]({'where':{'id':_0x5a37d4[_0x9e39('0x44')]['id']}})[_0x9e39('0x27')](handleEntityNotFound(_0x29700e,null))[_0x9e39('0x27')](function(_0x5a49b0){if(_0x5a49b0){return _0x5a49b0[_0x9e39('0x50')](_0x5a37d4['body'][_0x9e39('0x52')],_[_0x9e39('0x53')](_0x5a37d4[_0x9e39('0x48')],[_0x9e39('0x52'),'id'])||{});}})[_0x9e39('0x27')](respondWithResult(_0x29700e,null))[_0x9e39('0x42')](handleError(_0x29700e,null));};exports[_0x9e39('0x54')]=function(_0x16fc8f,_0x3ad325,_0x1639fd){var _0x5e74b4={};var _0xaefb25={};var _0x3214d0;var _0x2842bb;return db['CmCompany'][_0x9e39('0x55')]({'where':{'id':_0x16fc8f[_0x9e39('0x44')]['id']}})[_0x9e39('0x27')](handleEntityNotFound(_0x3ad325,null))[_0x9e39('0x27')](function(_0x300e48){if(_0x300e48){_0x3214d0=_0x300e48;_0xaefb25[_0x9e39('0x45')]=_[_0x9e39('0x30')](db[_0x9e39('0x51')][_0x9e39('0x56')]);_0xaefb25['query']=_[_0x9e39('0x30')](_0x16fc8f[_0x9e39('0x31')]);_0xaefb25[_0x9e39('0x32')]=_[_0x9e39('0x33')](_0xaefb25['model'],_0xaefb25[_0x9e39('0x31')]);_0x5e74b4[_0x9e39('0x34')]=_[_0x9e39('0x33')](_0xaefb25['model'],qs[_0x9e39('0x46')](_0x16fc8f[_0x9e39('0x31')][_0x9e39('0x46')]));_0x5e74b4[_0x9e39('0x34')]=_0x5e74b4[_0x9e39('0x34')][_0x9e39('0x35')]?_0x5e74b4[_0x9e39('0x34')]:_0xaefb25['model'];_0x5e74b4['order']=qs['sort'](_0x16fc8f[_0x9e39('0x31')][_0x9e39('0x37')]);_0x5e74b4[_0x9e39('0x38')]=qs[_0x9e39('0x32')](_[_0x9e39('0x39')](_0x16fc8f[_0x9e39('0x31')],_0xaefb25[_0x9e39('0x32')]));if(_0x16fc8f[_0x9e39('0x31')][_0x9e39('0x3a')]){_0x5e74b4['where']=_[_0x9e39('0x3b')](_0x5e74b4['where'],{'$or':_[_0x9e39('0x57')](_0x5e74b4[_0x9e39('0x34')],function(_0x28b74a){var _0x1732d2={};_0x1732d2[_0x28b74a]={'$like':'%'+_0x16fc8f[_0x9e39('0x31')][_0x9e39('0x3a')]+'%'};return _0x1732d2;})});}_0x5e74b4=_[_0x9e39('0x3b')]({},_0x5e74b4,_0x16fc8f[_0x9e39('0x3c')]);return _0x3214d0[_0x9e39('0x54')](_0x5e74b4);}})[_0x9e39('0x27')](function(_0x3f0093){if(_0x3f0093){_0x2842bb=_0x3f0093['length'];if(!_0x16fc8f[_0x9e39('0x31')]['hasOwnProperty'](_0x9e39('0x58'))){_0x5e74b4[_0x9e39('0x1e')]=qs[_0x9e39('0x1e')](_0x16fc8f[_0x9e39('0x31')][_0x9e39('0x1e')]);_0x5e74b4[_0x9e39('0x1c')]=qs['offset'](_0x16fc8f[_0x9e39('0x31')][_0x9e39('0x1c')]);}return _0x3214d0[_0x9e39('0x54')](_0x5e74b4);}})[_0x9e39('0x27')](function(_0x32768b){if(_0x32768b){return _0x32768b?{'count':_0x2842bb,'rows':_0x32768b}:null;}})['then'](respondWithResult(_0x3ad325,null))[_0x9e39('0x42')](handleError(_0x3ad325,null));}; \ No newline at end of file +var _0xb59b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContact','addContacts','omit','ids','getContacts','findOne','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','include','rows','catch','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error'];(function(_0x2dc1a0,_0x29cf94){var _0x3d7e3d=function(_0x25b5d9){while(--_0x25b5d9){_0x2dc1a0['push'](_0x2dc1a0['shift']());}};_0x3d7e3d(++_0x29cf94);}(_0xb59b,0xb9));var _0xbb59=function(_0x54fab4,_0x1fb905){_0x54fab4=_0x54fab4-0x0;var _0x221350=_0xb59b[_0x54fab4];return _0x221350;};'use strict';var emlformat=require(_0xbb59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb59('0x1'));var moment=require(_0xbb59('0x2'));var BPromise=require(_0xbb59('0x3'));var Mustache=require(_0xbb59('0x4'));var util=require('util');var path=require(_0xbb59('0x5'));var sox=require(_0xbb59('0x6'));var csv=require(_0xbb59('0x7'));var ejs=require(_0xbb59('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb59('0x9'));var squel=require(_0xbb59('0xa'));var crypto=require('crypto');var jsforce=require(_0xbb59('0xb'));var deskjs=require(_0xbb59('0xc'));var toCsv=require(_0xbb59('0x7'));var querystring=require(_0xbb59('0xd'));var Papa=require(_0xbb59('0xe'));var Redis=require(_0xbb59('0xf'));var authService=require(_0xbb59('0x10'));var qs=require(_0xbb59('0x11'));var as=require(_0xbb59('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbb59('0x13'));var utils=require(_0xbb59('0x14'));var config=require(_0xbb59('0x15'));var licenseUtil=require(_0xbb59('0x16'));var db=require(_0xbb59('0x17'))['db'];function respondWithStatusCode(_0x536338,_0x43e60a){_0x43e60a=_0x43e60a||0xcc;return function(_0x3729ef){if(_0x3729ef){return _0x536338['sendStatus'](_0x43e60a);}return _0x536338[_0xbb59('0x18')](_0x43e60a)[_0xbb59('0x19')]();};}function respondWithResult(_0x1401a4,_0xcd98fc){_0xcd98fc=_0xcd98fc||0xc8;return function(_0x5aa28b){if(_0x5aa28b){return _0x1401a4[_0xbb59('0x18')](_0xcd98fc)[_0xbb59('0x1a')](_0x5aa28b);}};}function respondWithFilteredResult(_0x25b6b2,_0x4a20ac){return function(_0x34bc47){if(_0x34bc47){var _0x2eddcc=typeof _0x4a20ac[_0xbb59('0x1b')]===_0xbb59('0x1c')&&typeof _0x4a20ac[_0xbb59('0x1d')]===_0xbb59('0x1c');var _0x1cc2a2=_0x34bc47[_0xbb59('0x1e')];var _0x558a1d=_0x2eddcc?0x0:_0x4a20ac['offset'];var _0x2c0bd6=_0x2eddcc?_0x34bc47[_0xbb59('0x1e')]:_0x4a20ac[_0xbb59('0x1b')]+_0x4a20ac[_0xbb59('0x1d')];var _0x9f51e9;if(_0x2c0bd6>=_0x1cc2a2){_0x2c0bd6=_0x1cc2a2;_0x9f51e9=0xc8;}else{_0x9f51e9=0xce;}_0x25b6b2[_0xbb59('0x18')](_0x9f51e9);return _0x25b6b2[_0xbb59('0x1f')](_0xbb59('0x20'),_0x558a1d+'-'+_0x2c0bd6+'/'+_0x1cc2a2)[_0xbb59('0x1a')](_0x34bc47);}return null;};}function patchUpdates(_0x54af2f){return function(_0x3b73af){try{jsonpatch[_0xbb59('0x21')](_0x3b73af,_0x54af2f,!![]);}catch(_0x1af15a){return BPromise[_0xbb59('0x22')](_0x1af15a);}return _0x3b73af[_0xbb59('0x23')]();};}function saveUpdates(_0x3d2557,_0x4ab04f){return function(_0x5707a3){if(_0x5707a3){return _0x5707a3[_0xbb59('0x24')](_0x3d2557)[_0xbb59('0x25')](function(_0x4392de){return _0x4392de;});}return null;};}function removeEntity(_0x428c80,_0x26830c){return function(_0x1e2c21){if(_0x1e2c21){return _0x1e2c21[_0xbb59('0x26')]()[_0xbb59('0x25')](function(){var _0x154d90=_0x1e2c21[_0xbb59('0x27')]({'plain':!![]});var _0x27148b=_0xbb59('0x28');return db[_0xbb59('0x29')][_0xbb59('0x26')]({'where':{'type':_0x27148b,'resourceId':_0x154d90['id']}})[_0xbb59('0x25')](function(){return _0x1e2c21;});})[_0xbb59('0x25')](function(){_0x428c80[_0xbb59('0x18')](0xcc)[_0xbb59('0x19')]();});}};}function handleEntityNotFound(_0x3e9c86,_0x362888){return function(_0x19718f){if(!_0x19718f){_0x3e9c86[_0xbb59('0x2a')](0x194);}return _0x19718f;};}function handleError(_0xafe6ac,_0x2dca91){_0x2dca91=_0x2dca91||0x1f4;return function(_0x3df290){logger['error'](_0x3df290[_0xbb59('0x2b')]);if(_0x3df290[_0xbb59('0x2c')]){delete _0x3df290['name'];}_0xafe6ac[_0xbb59('0x18')](_0x2dca91)[_0xbb59('0x2d')](_0x3df290);};}exports[_0xbb59('0x2e')]=function(_0x1ba77f,_0x5c5271){var _0xf06c99={},_0x54ffc8={},_0x46d193={'count':0x0,'rows':[]};return db[_0xbb59('0x2f')][_0xbb59('0x30')]()[_0xbb59('0x25')](function(_0x3227df){_0x54ffc8['model']=_[_0xbb59('0x31')](_0x3227df);_0x54ffc8[_0xbb59('0x32')]=_[_0xbb59('0x31')](_0x1ba77f[_0xbb59('0x32')]);_0x54ffc8[_0xbb59('0x33')]=_[_0xbb59('0x34')](_0x54ffc8[_0xbb59('0x35')],_0x54ffc8[_0xbb59('0x32')]);_0xf06c99[_0xbb59('0x36')]=_['intersection'](_0x54ffc8['model'],qs[_0xbb59('0x37')](_0x1ba77f[_0xbb59('0x32')]['fields']));_0xf06c99[_0xbb59('0x36')]=_0xf06c99[_0xbb59('0x36')][_0xbb59('0x38')]?_0xf06c99[_0xbb59('0x36')]:_0x54ffc8[_0xbb59('0x35')];if(!_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x39')](_0xbb59('0x3a'))){_0xf06c99[_0xbb59('0x1d')]=qs['limit'](_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x1d')]);_0xf06c99[_0xbb59('0x1b')]=qs[_0xbb59('0x1b')](_0x1ba77f['query'][_0xbb59('0x1b')]);}_0xf06c99[_0xbb59('0x3b')]=qs[_0xbb59('0x3c')](_0x1ba77f[_0xbb59('0x32')]['sort']);_0xf06c99[_0xbb59('0x3d')]=qs[_0xbb59('0x33')](_[_0xbb59('0x3e')](_0x1ba77f[_0xbb59('0x32')],_0x54ffc8[_0xbb59('0x33')]),_0x3227df);if(_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x3f')]){_0xf06c99['where']=_[_0xbb59('0x40')](_0xf06c99['where'],{'$or':_[_0xbb59('0x41')](_0xf06c99[_0xbb59('0x36')],function(_0x38bcf9){var _0x14fc15={};_0x14fc15[_0x38bcf9]={'$like':'%'+_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x3f')]+'%'};return _0x14fc15;})});}_0xf06c99=_[_0xbb59('0x40')]({},_0xf06c99,_0x1ba77f['options']);var _0x424a71={'where':_0xf06c99[_0xbb59('0x3d')]};return db[_0xbb59('0x2f')][_0xbb59('0x1e')](_0x424a71)[_0xbb59('0x25')](function(_0x41eb13){_0x46d193[_0xbb59('0x1e')]=_0x41eb13;if(_0x1ba77f[_0xbb59('0x32')]['includeAll']){_0xf06c99[_0xbb59('0x42')]=[{'all':!![]}];}return db[_0xbb59('0x2f')]['findAll'](_0xf06c99);})[_0xbb59('0x25')](function(_0x3faae1){_0x46d193[_0xbb59('0x43')]=_0x3faae1;return _0x46d193;})[_0xbb59('0x25')](respondWithFilteredResult(_0x5c5271,_0xf06c99))[_0xbb59('0x44')](handleError(_0x5c5271,null));})['catch'](handleError(_0x5c5271,null));};exports['show']=function(_0x3b8fb9,_0x47e168){var _0x5ea783={'raw':![],'where':{'id':_0x3b8fb9['params']['id']}},_0x1fe0f4={};_0x1fe0f4[_0xbb59('0x35')]=_['keys'](db[_0xbb59('0x2f')][_0xbb59('0x45')]);_0x1fe0f4['query']=_['keys'](_0x3b8fb9[_0xbb59('0x32')]);_0x1fe0f4[_0xbb59('0x33')]=_[_0xbb59('0x34')](_0x1fe0f4[_0xbb59('0x35')],_0x1fe0f4[_0xbb59('0x32')]);_0x5ea783[_0xbb59('0x36')]=_['intersection'](_0x1fe0f4[_0xbb59('0x35')],qs[_0xbb59('0x37')](_0x3b8fb9[_0xbb59('0x32')][_0xbb59('0x37')]));_0x5ea783[_0xbb59('0x36')]=_0x5ea783[_0xbb59('0x36')]['length']?_0x5ea783[_0xbb59('0x36')]:_0x1fe0f4['model'];if(_0x3b8fb9[_0xbb59('0x32')][_0xbb59('0x46')]){_0x5ea783['include']=[{'all':!![]}];}_0x5ea783=_['merge']({},_0x5ea783,_0x3b8fb9[_0xbb59('0x47')]);return db[_0xbb59('0x2f')][_0xbb59('0x48')](_0x5ea783)['then'](handleEntityNotFound(_0x47e168,null))[_0xbb59('0x25')](respondWithResult(_0x47e168,null))[_0xbb59('0x44')](handleError(_0x47e168,null));};exports[_0xbb59('0x49')]=function(_0x108a29,_0x11cff4){return db['CmCompany']['create'](_0x108a29['body'],{})[_0xbb59('0x25')](function(_0x4b9ee0){var _0x4fd5cf=_0x108a29[_0xbb59('0x4a')][_0xbb59('0x27')]({'plain':!![]});if(!_0x4fd5cf)throw new Error(_0xbb59('0x4b'));if(_0x4fd5cf['role']==='user'){var _0x5d2217=_0x4b9ee0[_0xbb59('0x27')]({'plain':!![]});var _0x31df6a=_0xbb59('0x28');return db[_0xbb59('0x4c')][_0xbb59('0x48')]({'where':{'name':_0x31df6a,'userProfileId':_0x4fd5cf['userProfileId']},'raw':!![]})['then'](function(_0x28643c){if(_0x28643c&&_0x28643c[_0xbb59('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d2217[_0xbb59('0x2c')],'resourceId':_0x5d2217['id'],'type':_0x28643c['name'],'sectionId':_0x28643c['id']},{})[_0xbb59('0x25')](function(){return _0x4b9ee0;});}else{return _0x4b9ee0;}})[_0xbb59('0x44')](function(_0x42f35e){logger[_0xbb59('0x4e')](_0xbb59('0x4f'),_0x42f35e);throw _0x42f35e;});}return _0x4b9ee0;})[_0xbb59('0x25')](respondWithResult(_0x11cff4,0xc9))[_0xbb59('0x44')](handleError(_0x11cff4,null));};exports['update']=function(_0x19f9c8,_0xf7682f){if(_0x19f9c8['body']['id']){delete _0x19f9c8[_0xbb59('0x50')]['id'];}return db[_0xbb59('0x2f')][_0xbb59('0x48')]({'where':{'id':_0x19f9c8[_0xbb59('0x51')]['id']}})['then'](handleEntityNotFound(_0xf7682f,null))['then'](saveUpdates(_0x19f9c8[_0xbb59('0x50')],null))[_0xbb59('0x25')](respondWithResult(_0xf7682f,null))[_0xbb59('0x44')](handleError(_0xf7682f,null));};exports[_0xbb59('0x26')]=function(_0x5ca638,_0x42957f){return db[_0xbb59('0x2f')][_0xbb59('0x48')]({'where':{'id':_0x5ca638[_0xbb59('0x51')]['id']}})[_0xbb59('0x25')](handleEntityNotFound(_0x42957f,null))[_0xbb59('0x25')](removeEntity(_0x42957f,null))[_0xbb59('0x44')](handleError(_0x42957f,null));};exports[_0xbb59('0x30')]=function(_0x147f08,_0x5c2b1e){return db[_0xbb59('0x2f')][_0xbb59('0x30')]()[_0xbb59('0x25')](respondWithResult(_0x5c2b1e,null))['catch'](handleError(_0x5c2b1e,null));};exports['addContacts']=function(_0x554108,_0x2226a3,_0x21d902){return db[_0xbb59('0x52')][_0xbb59('0x48')]({'where':{'id':_0x554108['params']['id']}})[_0xbb59('0x25')](handleEntityNotFound(_0x2226a3,null))[_0xbb59('0x25')](function(_0xc277d6){if(_0xc277d6){return _0xc277d6[_0xbb59('0x53')](_0x554108['body']['ids'],_[_0xbb59('0x54')](_0x554108['body'],[_0xbb59('0x55'),'id'])||{});}})[_0xbb59('0x25')](respondWithResult(_0x2226a3,null))[_0xbb59('0x44')](handleError(_0x2226a3,null));};exports[_0xbb59('0x56')]=function(_0x358cd3,_0x2a4e9d,_0x37688a){var _0x3bd7ac={};var _0x5d03b8={};var _0x46f6cd;var _0x36a6fd;return db[_0xbb59('0x2f')][_0xbb59('0x57')]({'where':{'id':_0x358cd3[_0xbb59('0x51')]['id']}})[_0xbb59('0x25')](handleEntityNotFound(_0x2a4e9d,null))['then'](function(_0x4d20c2){if(_0x4d20c2){_0x46f6cd=_0x4d20c2;_0x5d03b8['model']=_[_0xbb59('0x31')](db['CmContact']['rawAttributes']);_0x5d03b8[_0xbb59('0x32')]=_[_0xbb59('0x31')](_0x358cd3[_0xbb59('0x32')]);_0x5d03b8[_0xbb59('0x33')]=_['intersection'](_0x5d03b8[_0xbb59('0x35')],_0x5d03b8[_0xbb59('0x32')]);_0x3bd7ac[_0xbb59('0x36')]=_[_0xbb59('0x34')](_0x5d03b8[_0xbb59('0x35')],qs['fields'](_0x358cd3['query']['fields']));_0x3bd7ac[_0xbb59('0x36')]=_0x3bd7ac[_0xbb59('0x36')][_0xbb59('0x38')]?_0x3bd7ac['attributes']:_0x5d03b8[_0xbb59('0x35')];_0x3bd7ac[_0xbb59('0x3b')]=qs[_0xbb59('0x3c')](_0x358cd3['query']['sort']);_0x3bd7ac[_0xbb59('0x3d')]=qs[_0xbb59('0x33')](_['pick'](_0x358cd3[_0xbb59('0x32')],_0x5d03b8[_0xbb59('0x33')]));if(_0x358cd3[_0xbb59('0x32')]['filter']){_0x3bd7ac[_0xbb59('0x3d')]=_['merge'](_0x3bd7ac[_0xbb59('0x3d')],{'$or':_['map'](_0x3bd7ac[_0xbb59('0x36')],function(_0x34f3ca){var _0x195bca={};_0x195bca[_0x34f3ca]={'$like':'%'+_0x358cd3[_0xbb59('0x32')][_0xbb59('0x3f')]+'%'};return _0x195bca;})});}_0x3bd7ac=_['merge']({},_0x3bd7ac,_0x358cd3['options']);return _0x46f6cd[_0xbb59('0x56')](_0x3bd7ac);}})['then'](function(_0x118f15){if(_0x118f15){_0x36a6fd=_0x118f15[_0xbb59('0x38')];if(!_0x358cd3['query']['hasOwnProperty'](_0xbb59('0x3a'))){_0x3bd7ac[_0xbb59('0x1d')]=qs['limit'](_0x358cd3[_0xbb59('0x32')]['limit']);_0x3bd7ac[_0xbb59('0x1b')]=qs[_0xbb59('0x1b')](_0x358cd3[_0xbb59('0x32')][_0xbb59('0x1b')]);}return _0x46f6cd['getContacts'](_0x3bd7ac);}})[_0xbb59('0x25')](function(_0x346445){if(_0x346445){return _0x346445?{'count':_0x36a6fd,'rows':_0x346445}:null;}})['then'](respondWithResult(_0x2a4e9d,null))['catch'](handleError(_0x2a4e9d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 53e971c..1572675 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 _0x6356=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany','cm_companies'];(function(_0x34ca5a,_0x2f14b1){var _0x38c2be=function(_0x239f61){while(--_0x239f61){_0x34ca5a['push'](_0x34ca5a['shift']());}};_0x38c2be(++_0x2f14b1);}(_0x6356,0x15c));var _0x6635=function(_0x2a91f8,_0x449a8b){_0x2a91f8=_0x2a91f8-0x0;var _0x8e0541=_0x6356[_0x2a91f8];return _0x8e0541;};'use strict';var _=require(_0x6635('0x0'));var util=require(_0x6635('0x1'));var logger=require(_0x6635('0x2'))(_0x6635('0x3'));var moment=require('moment');var BPromise=require(_0x6635('0x4'));var rp=require(_0x6635('0x5'));var fs=require('fs');var path=require(_0x6635('0x6'));var rimraf=require(_0x6635('0x7'));var config=require(_0x6635('0x8'));var attributes=require(_0x6635('0x9'));module['exports']=function(_0x84e99b,_0x1b37e1){return _0x84e99b['define'](_0x6635('0xa'),attributes,{'tableName':_0x6635('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6932=['api','moment','bluebird','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','../../config/logger'];(function(_0x4c3fa1,_0x13f193){var _0x6f73be=function(_0x3802be){while(--_0x3802be){_0x4c3fa1['push'](_0x4c3fa1['shift']());}};_0x6f73be(++_0x13f193);}(_0x6932,0x132));var _0x2693=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6932[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x2693('0x0'));var util=require('util');var logger=require(_0x2693('0x1'))(_0x2693('0x2'));var moment=require(_0x2693('0x3'));var BPromise=require(_0x2693('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2693('0x5'));var rimraf=require('rimraf');var config=require(_0x2693('0x6'));var attributes=require(_0x2693('0x7'));module['exports']=function(_0x2ca330,_0x4f45ba){return _0x2ca330[_0x2693('0x8')](_0x2693('0x9'),attributes,{'tableName':_0x2693('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 d2b2832..9fcb3cc 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 _0xcaf2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xcaf2,0xe2));var _0x2caf=function(_0x5e3665,_0x369ac8){_0x5e3665=_0x5e3665-0x0;var _0x187299=_0xcaf2[_0x5e3665];return _0x187299;};'use strict';var _=require(_0x2caf('0x0'));var util=require(_0x2caf('0x1'));var moment=require(_0x2caf('0x2'));var BPromise=require('bluebird');var rs=require(_0x2caf('0x3'));var fs=require('fs');var Redis=require(_0x2caf('0x4'));var db=require(_0x2caf('0x5'))['db'];var utils=require(_0x2caf('0x6'));var logger=require(_0x2caf('0x7'))('rpc');var config=require(_0x2caf('0x8'));var jayson=require(_0x2caf('0x9'));var client=jayson[_0x2caf('0xa')][_0x2caf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b59ac,_0x3142eb,_0x2cf0c6){return new BPromise(function(_0x4d5732,_0x598e46){return client[_0x2caf('0xc')](_0x2b59ac,_0x2cf0c6)[_0x2caf('0xd')](function(_0x536c47){logger['info'](_0x2caf('0xe'),_0x3142eb,_0x2caf('0xf'));logger[_0x2caf('0x10')](_0x2caf('0x11'),_0x3142eb,_0x2caf('0xf'),JSON[_0x2caf('0x12')](_0x536c47));if(_0x536c47['error']){if(_0x536c47[_0x2caf('0x13')]['code']===0x1f4){logger['error'](_0x2caf('0xe'),_0x3142eb,_0x536c47[_0x2caf('0x13')][_0x2caf('0x14')]);return _0x598e46(_0x536c47[_0x2caf('0x13')][_0x2caf('0x14')]);}logger['error'](_0x2caf('0xe'),_0x3142eb,_0x536c47['error'][_0x2caf('0x14')]);return _0x4d5732(_0x536c47[_0x2caf('0x13')]['message']);}else{logger['info'](_0x2caf('0xe'),_0x3142eb,_0x2caf('0xf'));_0x4d5732(_0x536c47[_0x2caf('0x15')][_0x2caf('0x14')]);}})[_0x2caf('0x16')](function(_0x18366c){logger[_0x2caf('0x13')](_0x2caf('0xe'),_0x3142eb,_0x18366c);_0x598e46(_0x18366c);});});} \ No newline at end of file +var _0xc063=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x34f7bb,_0x547eb3){var _0x2efee3=function(_0x1fc766){while(--_0x1fc766){_0x34f7bb['push'](_0x34f7bb['shift']());}};_0x2efee3(++_0x547eb3);}(_0xc063,0x172));var _0x3c06=function(_0x539eb6,_0x3843f8){_0x539eb6=_0x539eb6-0x0;var _0x2e3478=_0xc063[_0x539eb6];return _0x2e3478;};'use strict';var _=require(_0x3c06('0x0'));var util=require(_0x3c06('0x1'));var moment=require(_0x3c06('0x2'));var BPromise=require(_0x3c06('0x3'));var rs=require(_0x3c06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c06('0x5'))['db'];var utils=require(_0x3c06('0x6'));var logger=require(_0x3c06('0x7'))(_0x3c06('0x8'));var config=require(_0x3c06('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c06('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0d8a,_0x24c46b,_0x5ee827){return new BPromise(function(_0x545cdd,_0x1f7abc){return client['request'](_0x5a0d8a,_0x5ee827)[_0x3c06('0xb')](function(_0x572a62){logger[_0x3c06('0xc')](_0x3c06('0xd'),_0x24c46b,_0x3c06('0xe'));logger[_0x3c06('0xf')](_0x3c06('0x10'),_0x24c46b,_0x3c06('0xe'),JSON[_0x3c06('0x11')](_0x572a62));if(_0x572a62[_0x3c06('0x12')]){if(_0x572a62[_0x3c06('0x12')][_0x3c06('0x13')]===0x1f4){logger[_0x3c06('0x12')](_0x3c06('0xd'),_0x24c46b,_0x572a62['error']['message']);return _0x1f7abc(_0x572a62[_0x3c06('0x12')]['message']);}logger['error'](_0x3c06('0xd'),_0x24c46b,_0x572a62[_0x3c06('0x12')][_0x3c06('0x14')]);return _0x545cdd(_0x572a62['error'][_0x3c06('0x14')]);}else{logger[_0x3c06('0xc')]('CmCompany,\x20%s,\x20%s',_0x24c46b,'request\x20sent');_0x545cdd(_0x572a62[_0x3c06('0x15')][_0x3c06('0x14')]);}})['catch'](function(_0x123575){logger[_0x3c06('0x12')](_0x3c06('0xd'),_0x24c46b,_0x123575);_0x1f7abc(_0x123575);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index c79f4af..a06c4da 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 _0xdfde=['express','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','post','/:id/contacts','addContacts','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xdfde,0x16c));var _0xedfd=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xdfde[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0xedfd('0x0'));var util=require(_0xedfd('0x1'));var path=require(_0xedfd('0x2'));var timeout=require(_0xedfd('0x3'));var express=require(_0xedfd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xedfd('0x5'));var interaction=require(_0xedfd('0x6'));var config=require('../../config/environment');var controller=require(_0xedfd('0x7'));router[_0xedfd('0x8')]('/',auth['isAuthenticated'](),controller[_0xedfd('0x9')]);router['get'](_0xedfd('0xa'),auth[_0xedfd('0xb')](),controller[_0xedfd('0xc')]);router['get'](_0xedfd('0xd'),auth[_0xedfd('0xb')](),controller[_0xedfd('0xe')]);router['get']('/:id/contacts',auth[_0xedfd('0xb')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0xedfd('0xf')]);router[_0xedfd('0x10')](_0xedfd('0x11'),auth[_0xedfd('0xb')](),controller[_0xedfd('0x12')]);router['put'](_0xedfd('0xd'),auth[_0xedfd('0xb')](),controller[_0xedfd('0x13')]);router[_0xedfd('0x14')](_0xedfd('0xd'),auth['isAuthenticated'](),controller[_0xedfd('0x15')]);module[_0xedfd('0x16')]=router; \ No newline at end of file +var _0xaf8d=['getContacts','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts'];(function(_0x2002a6,_0x2b870f){var _0x5e605e=function(_0x270382){while(--_0x270382){_0x2002a6['push'](_0x2002a6['shift']());}};_0x5e605e(++_0x2b870f);}(_0xaf8d,0x1d4));var _0xdaf8=function(_0x50248c,_0x1f7c71){_0x50248c=_0x50248c-0x0;var _0x20094f=_0xaf8d[_0x50248c];return _0x20094f;};'use strict';var multer=require(_0xdaf8('0x0'));var util=require(_0xdaf8('0x1'));var path=require(_0xdaf8('0x2'));var timeout=require(_0xdaf8('0x3'));var express=require(_0xdaf8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdaf8('0x5'));var interaction=require(_0xdaf8('0x6'));var config=require(_0xdaf8('0x7'));var controller=require('./cmCompany.controller');router[_0xdaf8('0x8')]('/',auth[_0xdaf8('0x9')](),controller[_0xdaf8('0xa')]);router[_0xdaf8('0x8')](_0xdaf8('0xb'),auth[_0xdaf8('0x9')](),controller[_0xdaf8('0xc')]);router['get'](_0xdaf8('0xd'),auth[_0xdaf8('0x9')](),controller[_0xdaf8('0xe')]);router['get'](_0xdaf8('0xf'),auth[_0xdaf8('0x9')](),controller[_0xdaf8('0x10')]);router[_0xdaf8('0x11')]('/',auth[_0xdaf8('0x9')](),controller[_0xdaf8('0x12')]);router['post']('/:id/contacts',auth[_0xdaf8('0x9')](),controller['addContacts']);router[_0xdaf8('0x13')](_0xdaf8('0xd'),auth[_0xdaf8('0x9')](),controller['update']);router['delete'](_0xdaf8('0xd'),auth['isAuthenticated'](),controller[_0xdaf8('0x14')]);module[_0xdaf8('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 428b9a6..81e89f8 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 _0xda96=['TEXT','INTEGER','UNSIGNED','NOW','lodash','exports','STRING'];(function(_0xdf4fca,_0x218397){var _0x541791=function(_0x23db73){while(--_0x23db73){_0xdf4fca['push'](_0xdf4fca['shift']());}};_0x541791(++_0x218397);}(_0xda96,0x115));var _0x6da9=function(_0x9c8d66,_0x1651a1){_0x9c8d66=_0x9c8d66-0x0;var _0x2b1cf7=_0xda96[_0x9c8d66];return _0x2b1cf7;};'use strict';var _=require(_0x6da9('0x0'));var Sequelize=require('sequelize');module[_0x6da9('0x1')]={'firstName':{'type':Sequelize[_0x6da9('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6da9('0x2')]},'street':{'type':Sequelize[_0x6da9('0x2')]},'postalCode':{'type':Sequelize[_0x6da9('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6da9('0x2')]},'description':{'type':Sequelize[_0x6da9('0x3')]},'phone':{'type':Sequelize[_0x6da9('0x2')]},'mobile':{'type':Sequelize[_0x6da9('0x2')]},'fax':{'type':Sequelize[_0x6da9('0x2')]},'email':{'type':Sequelize[_0x6da9('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x6da9('0x2')]},'fb_data':{'type':Sequelize[_0x6da9('0x2')]},'twitter':{'type':Sequelize[_0x6da9('0x2')]},'skype':{'type':Sequelize[_0x6da9('0x2')]},'teams':{'type':Sequelize[_0x6da9('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6da9('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x6da9('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6da9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x6da9('0x6')]},'dialTimezone':{'type':Sequelize[_0x6da9('0x2')]},'utcOffset':{'type':Sequelize[_0x6da9('0x4')]}}; \ No newline at end of file +var _0xb690=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb690,0x1af));var _0x0b69=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0xb690[_0x183256];return _0x5394a2;};'use strict';var _=require(_0x0b69('0x0'));var Sequelize=require(_0x0b69('0x1'));module[_0x0b69('0x2')]={'firstName':{'type':Sequelize[_0x0b69('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0b69('0x3')]},'street':{'type':Sequelize[_0x0b69('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0b69('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0b69('0x3')]},'description':{'type':Sequelize[_0x0b69('0x4')]},'phone':{'type':Sequelize[_0x0b69('0x3')]},'mobile':{'type':Sequelize[_0x0b69('0x3')]},'fax':{'type':Sequelize[_0x0b69('0x3')]},'email':{'type':Sequelize[_0x0b69('0x3')]},'url':{'type':Sequelize[_0x0b69('0x3')]},'facebook':{'type':Sequelize[_0x0b69('0x3')]},'fb_data':{'type':Sequelize[_0x0b69('0x3')]},'twitter':{'type':Sequelize[_0x0b69('0x3')]},'skype':{'type':Sequelize[_0x0b69('0x3')]},'teams':{'type':Sequelize[_0x0b69('0x3')]},'viber':{'type':Sequelize[_0x0b69('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x0b69('0x3')]},'telegram':{'type':Sequelize[_0x0b69('0x3')]},'UserId':{'type':Sequelize[_0x0b69('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x0b69('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0b69('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0b69('0x7')],'defaultValue':Sequelize[_0x0b69('0x8')]},'dialTimezone':{'type':Sequelize[_0x0b69('0x3')]},'utcOffset':{'type':Sequelize[_0x0b69('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4531d7d..ffdf8ed 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 _0x8a33=['options','nolimit','limit','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','order','ContactId','includeAll','include','getHopperHistories','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','binding_keys','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','agent','message','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','uniqueid','callerid','starttime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','DESC','browserName','customerIp','deviceModel','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','startCase','Interaction','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','redis','defaults','localhost','register','status','json','offset','undefined','count','set','then','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','catch','destroy','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','alias','custom','type','values','forEach','merge','body','get','mergeWith','isArray','join','info','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','update','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','spread','hasOwnProperty','all','show','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','CmHopper','getTags','findOne','model','rawAttributes','filters','intersection','fields','attributes','sort','pick','filter'];(function(_0x128eb7,_0x12dea3){var _0x5bdd2f=function(_0x457395){while(--_0x457395){_0x128eb7['push'](_0x128eb7['shift']());}};_0x5bdd2f(++_0x12dea3);}(_0x8a33,0x7b));var _0x38a3=function(_0x1ce3cc,_0x4f0bfa){_0x1ce3cc=_0x1ce3cc-0x0;var _0x1de825=_0x8a33[_0x1ce3cc];return _0x1de825;};'use strict';var moment=require(_0x38a3('0x0'));var BPromise=require(_0x38a3('0x1'));var util=require(_0x38a3('0x2'));var path=require(_0x38a3('0x3'));var fs=require('fs');var _=require(_0x38a3('0x4'));var squel=require(_0x38a3('0x5'));var Papa=require(_0x38a3('0x6'));var Redis=require(_0x38a3('0x7'));var contacts=require('../../components/contacts');var qs=require(_0x38a3('0x8'));var logger=require(_0x38a3('0x9'))('api');var config=require(_0x38a3('0xa'));var shared=require(_0x38a3('0xb'));var db=require('../../mysqldb')['db'];config[_0x38a3('0xc')]=_[_0x38a3('0xd')](config[_0x38a3('0xc')],{'host':_0x38a3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38a3('0xc')]));require('./cmContact.socket')[_0x38a3('0xf')](socket);function respondWithResult(_0x349602,_0x37fe89){_0x37fe89=_0x37fe89||0xc8;return function(_0x410ffa){if(_0x410ffa){return _0x349602[_0x38a3('0x10')](_0x37fe89)[_0x38a3('0x11')](_0x410ffa);}};}function respondWithFilteredResult(_0x197924,_0xfe2ebe){return function(_0x2a2a45){if(_0x2a2a45){var _0x2ef24a=typeof _0xfe2ebe[_0x38a3('0x12')]===_0x38a3('0x13')&&typeof _0xfe2ebe['limit']===_0x38a3('0x13');var _0xa008e4=_0x2a2a45['count'];var _0x182cc0=_0x2ef24a?0x0:_0xfe2ebe[_0x38a3('0x12')];var _0x383421=_0x2ef24a?_0x2a2a45[_0x38a3('0x14')]:_0xfe2ebe[_0x38a3('0x12')]+_0xfe2ebe['limit'];var _0x32caa0;if(_0x383421>=_0xa008e4){_0x383421=_0xa008e4;_0x32caa0=0xc8;}else{_0x32caa0=0xce;}_0x197924['status'](_0x32caa0);return _0x197924[_0x38a3('0x15')]('Content-Range',_0x182cc0+'-'+_0x383421+'/'+_0xa008e4)['json'](_0x2a2a45);}return null;};}function saveUpdates(_0x25fa75){return function(_0x12ebe5){if(_0x12ebe5){return _0x12ebe5['update'](_0x25fa75)[_0x38a3('0x16')](function(_0x3496cb){return _0x3496cb;});}return null;};}function removeEntity(_0x50e797){return function(_0x3b8b6d){if(_0x3b8b6d){return _0x3b8b6d['destroy']()[_0x38a3('0x16')](function(){_0x50e797[_0x38a3('0x10')](0xcc)[_0x38a3('0x17')]();});}};}function handleEntityNotFound(_0x4c7727){return function(_0x4144f7){if(!_0x4144f7){_0x4c7727[_0x38a3('0x18')](0x194);}return _0x4144f7;};}function handleError(_0x537131,_0x5d9c71){_0x5d9c71=_0x5d9c71||0x1f4;return function(_0x25db81){logger['error'](_0x25db81[_0x38a3('0x19')]);if(_0x25db81[_0x38a3('0x1a')]){delete _0x25db81['name'];}_0x537131['status'](_0x5d9c71)[_0x38a3('0x1b')](_0x25db81);};}exports[_0x38a3('0x1c')]=function(_0x4edf04,_0x1112c4){var _0x143acd={};return contacts[_0x38a3('0x1d')]()[_0x38a3('0x16')](function(_0x348755){_0x143acd=qs[_0x38a3('0x1e')](_0x348755,_0x4edf04);return contacts[_0x38a3('0x1f')](_0x4edf04[_0x38a3('0x20')],_0x4edf04[_0x38a3('0x21')],_0x143acd,_0x348755);})[_0x38a3('0x16')](respondWithFilteredResult(_0x1112c4,_0x143acd))[_0x38a3('0x22')](handleError(_0x1112c4,null));};exports[_0x38a3('0x23')]=function(_0x252262,_0x64cdda){return db[_0x38a3('0x24')][_0x38a3('0x25')]({'where':{'id':_0x252262[_0x38a3('0x26')]['id']}})[_0x38a3('0x16')](handleEntityNotFound(_0x64cdda,null))['then'](removeEntity(_0x64cdda,null))[_0x38a3('0x22')](handleError(_0x64cdda,null));};exports[_0x38a3('0x1d')]=function(_0x33d7cf,_0x2870a3){return db[_0x38a3('0x24')][_0x38a3('0x1d')]()[_0x38a3('0x16')](function(_0x21bd94){delete _0x21bd94[_0x38a3('0x27')];for(var _0x299e74=0x0;_0x299e740x0){return new Promise(function(_0x450dec){var _0x13d68d=[];for(var _0x5dcf5a=0x0;_0x5dcf5a<_0x36d548[_0x38a3('0x29')];_0x5dcf5a++){_0x13d68d[_0x38a3('0x61')](insertAdditionalPhones(_0x36d548[_0x5dcf5a]['contact'],_0x36d548[_0x5dcf5a][_0x38a3('0x5c')]));}Promise[_0x38a3('0x67')](_0x13d68d)['then'](function(){_0x450dec(0x1);});})[_0x38a3('0x16')](function(){return{'success':_0x3b409,'failure':_0x435f4e,'duplicates':_0x1f785a};});}else{return{'success':_0x3b409,'failure':_0x435f4e,'duplicates':_0x1f785a};}}})['then'](respondWithResult(_0x3f1159,0xc9))['catch'](handleError(_0x3f1159,null));};exports[_0x38a3('0x68')]=function(_0x33a094,_0x16d60b){var _0x142aac;return db['CmContact'][_0x38a3('0x1d')]()['then'](function(_0xef3552){return db[_0x38a3('0x24')][_0x38a3('0x25')]({'where':{'id':_0x33a094[_0x38a3('0x26')]['id']},'include':[{'model':db[_0x38a3('0x69')],'as':_0x38a3('0x6a'),'attributes':['id',_0x38a3('0x1a'),_0x38a3('0x6b')],'required':_0x33a094[_0x38a3('0x20')][_0x38a3('0x6c')]?!![]:![]},{'model':db[_0x38a3('0x4b')],'as':_0x38a3('0x6d'),'where':{'CmContactId':_0x33a094[_0x38a3('0x26')]['id']},'required':![],'include':[{'model':db[_0x38a3('0x6e')],'as':_0x38a3('0x6f')}]}],'order':[db[_0x38a3('0x70')][_0x38a3('0x71')](_0x38a3('0x72'))],'attributes':_[_0x38a3('0x28')](_0xef3552)});})[_0x38a3('0x16')](function(_0xec3cb7){if(!_[_0x38a3('0x59')](_0xec3cb7)){_0x142aac=_0xec3cb7[_0x38a3('0x37')]({'plain':!![]});var _0x2bb422={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xec3cb7&&_0xec3cb7['ListId']){if(_0xec3cb7[_0x38a3('0x63')]){_0x2bb422[_0x38a3('0x62')][_0x38a3('0x73')][_0x38a3('0x61')]({'ListId':{'$ne':_0xec3cb7[_0x38a3('0x63')]}});}}return db[_0x38a3('0x2f')]['findAll'](_0x2bb422);}})[_0x38a3('0x16')](function(_0x3364d2){if(!_['isNil'](_0x3364d2)){return _[_0x38a3('0x74')](_0x142aac,_[_0x38a3('0x75')](_0x3364d2,function(_0x5f2680){return util[_0x38a3('0x76')](_0x38a3('0x77'),_0x5f2680['id']);}));}})[_0x38a3('0x16')](handleEntityNotFound(_0x16d60b,null))['then'](respondWithResult(_0x16d60b,null))['catch'](handleError(_0x16d60b,null));};exports['update']=function(_0x3c4c76,_0x4f2bec){var _0x2157ab;if(_0x3c4c76[_0x38a3('0x36')]['id']){delete _0x3c4c76[_0x38a3('0x36')]['id'];}if(!_['isNil'](_0x3c4c76[_0x38a3('0x36')][_0x38a3('0x58')])){var _0x5c7208=_0x3c4c76[_0x38a3('0x36')][_0x38a3('0x58')];if(!_[_0x38a3('0x59')](shared['timezones'][_0x5c7208]))_0x3c4c76[_0x38a3('0x36')]['utcOffset']=shared[_0x38a3('0x5a')][_0x5c7208][_0x38a3('0x5b')];}return db[_0x38a3('0x24')]['find']({'where':{'id':_0x3c4c76[_0x38a3('0x26')]['id']}})[_0x38a3('0x16')](handleEntityNotFound(_0x4f2bec,null))['then'](saveUpdates(_0x3c4c76[_0x38a3('0x36')],null))[_0x38a3('0x16')](function(_0x295b46){_0x2157ab=_0x295b46;var _0x1d71a9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x295b46&&_0x295b46['ListId']){if(_0x295b46[_0x38a3('0x63')]){_0x1d71a9[_0x38a3('0x62')][_0x38a3('0x73')][_0x38a3('0x61')]({'ListId':{'$ne':_0x295b46['ListId']}});}}return db[_0x38a3('0x2f')][_0x38a3('0x1f')](_0x1d71a9);})[_0x38a3('0x16')](function(_0x1857a1){if(_0x1857a1){return _['omit'](_[_0x38a3('0x78')](_0x3c4c76[_0x38a3('0x36')],function(_0x4ee47d,_0x576cb4){return _[_0x38a3('0x2a')](_0x576cb4,'cf_');}),_[_0x38a3('0x75')](_0x1857a1,function(_0x44b06e){return util[_0x38a3('0x76')](_0x38a3('0x77'),_0x44b06e['id']);}));}})[_0x38a3('0x16')](function(_0x5b1234){if(_0x5b1234&&!_[_0x38a3('0x79')](_0x5b1234)){var _0x386008=squel[_0x38a3('0x41')]()[_0x38a3('0x7a')](_0x38a3('0x7b'))[_0x38a3('0x7c')](_0x5b1234)[_0x38a3('0x62')](_0x38a3('0x7d'),_0x3c4c76['params']['id'])[_0x38a3('0x7e')]();return db[_0x38a3('0x70')][_0x38a3('0x20')](_0x386008[_0x38a3('0x7f')],{'replacements':_0x386008[_0x38a3('0x33')]});}})[_0x38a3('0x16')](function(){if(_0x3c4c76[_0x38a3('0x36')][_0x38a3('0x80')]&&_0x2157ab){return db[_0x38a3('0x81')][_0x38a3('0x41')]({'phone':_0x3c4c76[_0x38a3('0x36')][_0x38a3('0x80')],'OrderBy':0x0},{'where':{'ContactId':_0x2157ab['id']}});}})[_0x38a3('0x16')](function(){return _0x2157ab;})[_0x38a3('0x16')](respondWithResult(_0x4f2bec,null))[_0x38a3('0x22')](handleError(_0x4f2bec,null));};exports[_0x38a3('0x82')]=function(_0x3e6306,_0x2ab403){var _0x543bf7={};var _0x481386={};var _0x198339;var _0x48a835;return db['CmContact'][_0x38a3('0x83')]({'where':{'id':_0x3e6306['params']['id']}})['then'](handleEntityNotFound(_0x2ab403,null))[_0x38a3('0x16')](function(_0x3b89b6){if(_0x3b89b6){_0x198339=_0x3b89b6;_0x481386[_0x38a3('0x84')]=_[_0x38a3('0x28')](db[_0x38a3('0x69')][_0x38a3('0x85')]);_0x481386[_0x38a3('0x20')]=_[_0x38a3('0x28')](_0x3e6306[_0x38a3('0x20')]);_0x481386[_0x38a3('0x86')]=_[_0x38a3('0x87')](_0x481386[_0x38a3('0x84')],_0x481386[_0x38a3('0x20')]);_0x543bf7['attributes']=_['intersection'](_0x481386['model'],qs[_0x38a3('0x88')](_0x3e6306['query'][_0x38a3('0x88')]));_0x543bf7[_0x38a3('0x89')]=_0x543bf7['attributes'][_0x38a3('0x29')]?_0x543bf7[_0x38a3('0x89')]:_0x481386[_0x38a3('0x84')];_0x543bf7['order']=qs[_0x38a3('0x8a')](_0x3e6306['query'][_0x38a3('0x8a')]);_0x543bf7[_0x38a3('0x62')]=qs['filters'](_[_0x38a3('0x8b')](_0x3e6306[_0x38a3('0x20')],_0x481386[_0x38a3('0x86')]));if(_0x3e6306[_0x38a3('0x20')][_0x38a3('0x8c')]){_0x543bf7[_0x38a3('0x62')]=_[_0x38a3('0x35')](_0x543bf7['where'],{'$or':_[_0x38a3('0x75')](_0x543bf7[_0x38a3('0x89')],function(_0x790c2a){var _0x3b6d74={};_0x3b6d74[_0x790c2a]={'$like':'%'+_0x3e6306[_0x38a3('0x20')][_0x38a3('0x8c')]+'%'};return _0x3b6d74;})});}_0x543bf7=_[_0x38a3('0x35')]({},_0x543bf7,_0x3e6306[_0x38a3('0x8d')]);return _0x198339[_0x38a3('0x82')](_0x543bf7);}})[_0x38a3('0x16')](function(_0x47d9c3){if(_0x47d9c3){_0x48a835=_0x47d9c3[_0x38a3('0x29')];if(!_0x3e6306[_0x38a3('0x20')][_0x38a3('0x66')](_0x38a3('0x8e'))){_0x543bf7[_0x38a3('0x8f')]=qs['limit'](_0x3e6306[_0x38a3('0x20')]['limit']);_0x543bf7[_0x38a3('0x12')]=qs['offset'](_0x3e6306[_0x38a3('0x20')][_0x38a3('0x12')]);}return _0x198339['getTags'](_0x543bf7);}})[_0x38a3('0x16')](function(_0x504a4e){if(_0x504a4e){return _0x504a4e?{'count':_0x48a835,'rows':_0x504a4e}:null;}})[_0x38a3('0x16')](respondWithResult(_0x2ab403,null))['catch'](handleError(_0x2ab403,null));};exports[_0x38a3('0x90')]=function(_0x1c3704,_0x51ccf3){if(_0x1c3704[_0x38a3('0x36')]['id']){delete _0x1c3704[_0x38a3('0x36')]['id'];}return db['CmContact'][_0x38a3('0x83')]({'where':{'id':_0x1c3704['params']['id']}})[_0x38a3('0x16')](handleEntityNotFound(_0x51ccf3,null))['then'](function(_0x52877c){if(_0x52877c){return _0x52877c[_0x38a3('0x90')](_0x1c3704[_0x38a3('0x36')][_0x38a3('0x91')]||[]);}return null;})['then'](respondWithResult(_0x51ccf3,null))[_0x38a3('0x22')](handleError(_0x51ccf3,null));};exports[_0x38a3('0x92')]=function(_0x2aa9d3,_0x44d15e){var _0xb739c7=[];_0xb739c7[_0x38a3('0x61')](addAdditionalPhones(_0x2aa9d3[_0x38a3('0x36')]));Promise[_0x38a3('0x67')](_0xb739c7)['then'](function(){_0xb739c7=[];_0xb739c7[_0x38a3('0x61')](deleteCmHopperPhones(_0x2aa9d3['body']['id']));_0xb739c7[_0x38a3('0x61')](addCmHopperPhones(_0x2aa9d3[_0x38a3('0x36')]['id']));Promise['all'](_0xb739c7)[_0x38a3('0x16')](function(){return[0x1];})[_0x38a3('0x16')](respondWithResult(_0x44d15e,null));});};function addAdditionalPhones(_0x29c602){var _0x12c52d;return new Promise(function(_0x56d65e){return db['CmContactHasItem'][_0x38a3('0x23')]({'where':{'CmContactId':_0x29c602['id']}})['then'](function(){db[_0x38a3('0x6e')][_0x38a3('0x1f')]({'raw':!![],'attributes':['id','OrderBy']})[_0x38a3('0x16')](function(_0xfc5e0d){var _0x7e05dd=[];for(var _0xd4da5a=0x0;_0xd4da5a<_0x29c602[_0x38a3('0x93')]['length'];_0xd4da5a++){var _0x445816=_0x29c602[_0x38a3('0x94')]?_[_0x38a3('0x59')](_0x29c602['item_types'][_0xd4da5a])?'':_0x29c602[_0x38a3('0x94')][_0xd4da5a]:_0x29c602['items'][_0xd4da5a][_0x38a3('0x95')]?_0x29c602[_0x38a3('0x93')][_0xd4da5a]['ItemTypeId']:'';var _0x28e247=_['isNil'](_0x29c602[_0x38a3('0x93')][_0xd4da5a]['description'])?'':_0x29c602[_0x38a3('0x93')][_0xd4da5a][_0x38a3('0x96')];var _0x57d9ee=_0x445816+':'+_0x29c602[_0x38a3('0x93')][_0xd4da5a][_0x38a3('0x80')]+'§'+_0x28e247;if(_[_0x38a3('0x59')](_0x12c52d))_0x12c52d=_0x57d9ee;else _0x12c52d+=';'+_0x57d9ee;var _0x38a3e0=null;var _0x5d6d1e=null;if(_0x29c602['item_types']){if(!_[_0x38a3('0x59')](_0x29c602['item_types'][_0xd4da5a])){_0x5d6d1e=_[_0x38a3('0x25')](_0xfc5e0d,function(_0x202754){return _0x202754['id']===_0x29c602['item_types'][_0xd4da5a];});if(!_[_0x38a3('0x59')](_0x5d6d1e)){_0x38a3e0=_0x5d6d1e[_0x38a3('0x97')];}}}else{if(!_[_0x38a3('0x59')](_0x29c602[_0x38a3('0x93')][_0xd4da5a])){_0x5d6d1e=_['find'](_0xfc5e0d,function(_0x542983){return _0x542983['id']===_0x29c602['items'][_0xd4da5a]['ItemTypeId'];});if(!_[_0x38a3('0x59')](_0x5d6d1e)){_0x38a3e0=_0xd4da5a;}}}if(_[_0x38a3('0x59')](_0x38a3e0)){_0x38a3e0=0x64;}_0x7e05dd[_0x38a3('0x61')](addAdditionalPhone(_0x29c602['id'],_0x29c602[_0x38a3('0x93')][_0xd4da5a][_0x38a3('0x80')],_0x29c602[_0x38a3('0x94')]?_['isNil'](_0x29c602[_0x38a3('0x94')][_0xd4da5a])?null:_0x29c602['item_types'][_0xd4da5a]:_0x29c602[_0x38a3('0x93')][_0xd4da5a][_0x38a3('0x95')]?_0x29c602[_0x38a3('0x93')][_0xd4da5a][_0x38a3('0x95')]:null,_0x38a3e0,_0x28e247));}Promise[_0x38a3('0x67')](_0x7e05dd)[_0x38a3('0x16')](function(){db[_0x38a3('0x24')]['update']({'AdditionalPhones':_0x12c52d},{'where':{'id':_0x29c602['id']}})[_0x38a3('0x16')](function(){_0x56d65e(0x1);});});});});});}function addAdditionalPhone(_0x1870a8,_0x38d0c5,_0x15abbe,_0xf9c7,_0x2bcc0a){return db['CmContactHasItem'][_0x38a3('0x25')]({'where':{'CmContactId':_0x1870a8,'item':_0x38d0c5}})['then'](function(_0x3d8495){if(_0x3d8495)logger[_0x38a3('0x3b')](_0x38a3('0x98'),_0x3d8495);else{db[_0x38a3('0x4b')][_0x38a3('0x3f')]({'CmContactId':_0x1870a8,'item':_0x38d0c5,'ItemTypeId':_0x15abbe,'OrderBy':_0xf9c7,'ItemClass':'PHONE','description':_0x2bcc0a});}});}function deleteCmHopperPhones(_0x4e108b){return new Promise(function(_0xc6b69a){return db[_0x38a3('0x81')][_0x38a3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4e108b}})[_0x38a3('0x16')](function(_0x1476e1){db[_0x38a3('0x99')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x38a3('0x75')](_0x1476e1,'id')}}});})[_0x38a3('0x16')](function(){_0xc6b69a(0x1);});});}function addCmHopperPhones(_0x8984d3){return new Promise(function(_0x2fb43d){return db[_0x38a3('0x81')][_0x38a3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x8984d3}})[_0x38a3('0x16')](function(_0x478a12){var _0x106f28=[];_[_0x38a3('0x75')](_0x478a12,function(_0x4d843f){_0x106f28[_0x38a3('0x61')](createCmHopperPhone(_0x8984d3,_0x4d843f['id']));});Promise[_0x38a3('0x67')](_0x106f28)[_0x38a3('0x16')](function(){_0x2fb43d(0x1);});});});}function createCmHopperPhone(_0x483bd7,_0x3c0502){return new Promise(function(_0x4c5d8a){db[_0x38a3('0x4b')][_0x38a3('0x1f')]({'raw':!![],'attributes':['item',_0x38a3('0x97')],'where':{'CmContactId':_0x483bd7,'ItemClass':'PHONE'},'include':[{'model':db[_0x38a3('0x6e')],'attributes':[_0x38a3('0x97')],'as':_0x38a3('0x6f')}],'order':[_0x38a3('0x97'),db[_0x38a3('0x70')]['literal'](_0x38a3('0x9a'))]})[_0x38a3('0x16')](function(_0x36d67f){var _0x3c60cd=0x1;var _0x5a4532=_[_0x38a3('0x75')](_0x36d67f,function(_0x183ade){_0x183ade['CmHopperId']=_0x3c0502;_0x183ade[_0x38a3('0x80')]=_0x183ade['item'];_0x183ade[_0x38a3('0x97')]=_0x3c60cd;delete _0x183ade[_0x38a3('0x9b')];_0x3c60cd=_0x3c60cd+0x1;return _0x183ade;});return db[_0x38a3('0x99')][_0x38a3('0x5d')](_0x5a4532,{});})[_0x38a3('0x16')](function(){_0x4c5d8a(0x1);});});}function insertAdditionalPhones(_0x205e19,_0x1fcb27){return new Promise(function(_0x32e973){var _0x5c4055=[];for(var _0x1d2bc2=0x0;_0x1d2bc2<_0x1fcb27[_0x38a3('0x29')];_0x1d2bc2++){var _0x23fe0c=_0x1fcb27[_0x1d2bc2];_0x5c4055[_0x38a3('0x61')](parseContactItemType(_0x23fe0c));}Promise[_0x38a3('0x67')](_0x5c4055)[_0x38a3('0x16')](function(){var _0x2e36d0={'id':_0x205e19['id'],'items':_0x1fcb27};return addAdditionalPhones(_0x2e36d0)['then'](function(){return addCmHopperPhones(_0x205e19['id']);});})[_0x38a3('0x16')](function(){_0x32e973(_0x205e19);});});}function parseContactItemType(_0x15ae0b){return new Promise(function(_0x23e420){if(_0x15ae0b[_0x38a3('0x66')](_0x38a3('0x95'))){_0x23e420(_0x15ae0b);}else{return db[_0x38a3('0x6e')][_0x38a3('0x25')]({'where':{'name':_0x15ae0b['ItemType']}})[_0x38a3('0x16')](function(_0x599395){if(_[_0x38a3('0x59')](_0x599395))_0x15ae0b[_0x38a3('0x95')]=null;else _0x15ae0b[_0x38a3('0x95')]=_0x599395['id'];_0x23e420(_0x15ae0b);});}});}exports[_0x38a3('0x9c')]=function(_0x8d660a,_0x5a83e8){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x8d660a[_0x38a3('0x26')]['id'],'ItemClass':_0x38a3('0x9d')},'include':[{'model':db[_0x38a3('0x6e')],'as':_0x38a3('0x6f')}],'order':[[_0x38a3('0x97')],[db[_0x38a3('0x70')]['literal'](_0x38a3('0x9a'))]]})[_0x38a3('0x16')](function(_0x156369){return _0x156369;})[_0x38a3('0x16')](respondWithResult(_0x5a83e8,null))['catch'](handleError(_0x5a83e8,null));};exports[_0x38a3('0x9e')]=function(_0x4ee910,_0x2a1ba8){return db[_0x38a3('0x4b')][_0x38a3('0x1f')]({'raw':!![],'where':{'CmContactId':_0x4ee910[_0x38a3('0x36')][_0x38a3('0x9f')]}})[_0x38a3('0x16')](function(_0x264a28){var _0x2d35f3=_[_0x38a3('0x75')](_0x264a28,function(_0x448282){_0x448282[_0x38a3('0xa0')]=_0x4ee910[_0x38a3('0x36')][_0x38a3('0xa1')];return _0x448282;});return db['CmContactHasItem'][_0x38a3('0x5d')](_0x2d35f3,{});})[_0x38a3('0x16')](function(){return addCmHopperPhones(_0x4ee910[_0x38a3('0x36')][_0x38a3('0xa1')]);})[_0x38a3('0x16')](function(){return['ok'];})[_0x38a3('0x16')](respondWithResult(_0x2a1ba8,null))[_0x38a3('0x22')](handleError(_0x2a1ba8,null));};exports[_0x38a3('0xa2')]=function(_0x1bd08f,_0x22628d){var _0x28bfb7=[];_0x28bfb7[_0x38a3('0x61')](createCmHopperPhone(_0x1bd08f[_0x38a3('0x36')]['id'],_0x1bd08f[_0x38a3('0x36')]['hopperId']));Promise['all'](_0x28bfb7)[_0x38a3('0x16')](function(){return[0x1];})['then'](respondWithResult(_0x22628d,null));};exports[_0x38a3('0xa3')]=function(_0xd04cfb,_0x676ef0){var _0x342c63={'raw':![],'where':{}};var _0x34988f={};var _0x11873f={'count':0x0,'rows':[]};return db[_0x38a3('0x24')]['findOne']({'where':{'id':_0xd04cfb[_0x38a3('0x26')]['id']}})[_0x38a3('0x16')](handleEntityNotFound(_0x676ef0,null))['then'](function(_0x572b80){if(_0x572b80){_0x34988f[_0x38a3('0x84')]=_[_0x38a3('0x28')](db['CmHopper'][_0x38a3('0x85')]);_0x34988f[_0x38a3('0x20')]=_['keys'](_0xd04cfb[_0x38a3('0x20')]);_0x34988f[_0x38a3('0x86')]=_[_0x38a3('0x87')](_0x34988f[_0x38a3('0x84')],_0x34988f[_0x38a3('0x20')]);_0x342c63['attributes']=_['intersection'](_0x34988f[_0x38a3('0x84')],qs['fields'](_0xd04cfb[_0x38a3('0x20')][_0x38a3('0x88')]));_0x342c63[_0x38a3('0x89')]=_0x342c63[_0x38a3('0x89')][_0x38a3('0x29')]?_0x342c63['attributes']:_0x34988f[_0x38a3('0x84')];if(!_0xd04cfb[_0x38a3('0x20')][_0x38a3('0x66')](_0x38a3('0x8e'))){_0x342c63['limit']=qs[_0x38a3('0x8f')](_0xd04cfb[_0x38a3('0x20')]['limit']);_0x342c63[_0x38a3('0x12')]=qs[_0x38a3('0x12')](_0xd04cfb[_0x38a3('0x20')]['offset']);}_0x342c63[_0x38a3('0xa4')]=qs['sort'](_0xd04cfb[_0x38a3('0x20')][_0x38a3('0x8a')]);_0x342c63[_0x38a3('0x62')]=qs[_0x38a3('0x86')](_[_0x38a3('0x8b')](_0xd04cfb['query'],_0x34988f[_0x38a3('0x86')]));_0x342c63[_0x38a3('0x62')][_0x38a3('0xa5')]=_0x572b80['id'];if(_0xd04cfb['query']['filter']){_0x342c63[_0x38a3('0x62')]=_[_0x38a3('0x35')](_0x342c63['where'],{'$or':_[_0x38a3('0x75')](_0x342c63['attributes'],function(_0x150696){var _0x5f17f5={};_0x5f17f5[_0x150696]={'$like':'%'+_0xd04cfb[_0x38a3('0x20')][_0x38a3('0x8c')]+'%'};return _0x5f17f5;})});}_0x342c63=_[_0x38a3('0x35')]({},_0x342c63,_0xd04cfb[_0x38a3('0x8d')]);return db[_0x38a3('0x81')][_0x38a3('0x14')]({'where':_0x342c63[_0x38a3('0x62')]})[_0x38a3('0x16')](function(_0x3c0d06){_0x11873f[_0x38a3('0x14')]=_0x3c0d06;if(_0xd04cfb[_0x38a3('0x20')][_0x38a3('0xa6')]){_0x342c63[_0x38a3('0xa7')]=[{'all':!![]}];}return db['CmHopper'][_0x38a3('0x1f')](_0x342c63);})[_0x38a3('0x16')](function(_0xdee709){_0x11873f['rows']=_0xdee709;return _0x11873f;});}})[_0x38a3('0x16')](respondWithFilteredResult(_0x676ef0,_0x342c63))[_0x38a3('0x22')](handleError(_0x676ef0,null));};exports[_0x38a3('0xa8')]=function(_0x11feec,_0x174d5f){var _0x2a0de9={'raw':!![],'where':{}};var _0x4004f8={};var _0x3223f4={'count':0x0,'rows':[]};return db[_0x38a3('0x24')][_0x38a3('0x83')]({'where':{'id':_0x11feec['params']['id']}})[_0x38a3('0x16')](handleEntityNotFound(_0x174d5f,null))[_0x38a3('0x16')](function(_0x64e3f9){if(_0x64e3f9){_0x4004f8[_0x38a3('0x84')]=_['keys'](db[_0x38a3('0x4d')][_0x38a3('0x85')]);_0x4004f8['query']=_[_0x38a3('0x28')](_0x11feec[_0x38a3('0x20')]);_0x4004f8[_0x38a3('0x86')]=_[_0x38a3('0x87')](_0x4004f8['model'],_0x4004f8[_0x38a3('0x20')]);_0x2a0de9[_0x38a3('0x89')]=_['intersection'](_0x4004f8[_0x38a3('0x84')],qs[_0x38a3('0x88')](_0x11feec[_0x38a3('0x20')]['fields']));_0x2a0de9['attributes']=_0x2a0de9[_0x38a3('0x89')][_0x38a3('0x29')]?_0x2a0de9[_0x38a3('0x89')]:_0x4004f8['model'];if(!_0x11feec[_0x38a3('0x20')][_0x38a3('0x66')](_0x38a3('0x8e'))){_0x2a0de9[_0x38a3('0x8f')]=qs[_0x38a3('0x8f')](_0x11feec[_0x38a3('0x20')][_0x38a3('0x8f')]);_0x2a0de9[_0x38a3('0x12')]=qs['offset'](_0x11feec['query'][_0x38a3('0x12')]);}_0x2a0de9[_0x38a3('0xa4')]=qs['sort'](_0x11feec[_0x38a3('0x20')][_0x38a3('0x8a')]);_0x2a0de9['where']=qs['filters'](_[_0x38a3('0x8b')](_0x11feec[_0x38a3('0x20')],_0x4004f8[_0x38a3('0x86')]));_0x2a0de9[_0x38a3('0x62')][_0x38a3('0xa5')]=_0x64e3f9['id'];if(_0x11feec[_0x38a3('0x20')]['filter']){_0x2a0de9[_0x38a3('0x62')]=_[_0x38a3('0x35')](_0x2a0de9[_0x38a3('0x62')],{'$or':_[_0x38a3('0x75')](_0x2a0de9['attributes'],function(_0x454b22){var _0x49fc09={};_0x49fc09[_0x454b22]={'$like':'%'+_0x11feec[_0x38a3('0x20')][_0x38a3('0x8c')]+'%'};return _0x49fc09;})});}_0x2a0de9=_[_0x38a3('0x35')]({},_0x2a0de9,_0x11feec[_0x38a3('0x8d')]);return db['CmHopperHistory'][_0x38a3('0x14')]({'where':_0x2a0de9[_0x38a3('0x62')]})[_0x38a3('0x16')](function(_0x4410c0){_0x3223f4[_0x38a3('0x14')]=_0x4410c0;if(_0x11feec[_0x38a3('0x20')][_0x38a3('0xa6')]){_0x2a0de9['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x38a3('0x1f')](_0x2a0de9);})[_0x38a3('0x16')](function(_0x5dfdc1){_0x3223f4[_0x38a3('0xa9')]=_0x5dfdc1;return _0x3223f4;});}})[_0x38a3('0x16')](respondWithFilteredResult(_0x174d5f,_0x2a0de9))[_0x38a3('0x22')](handleError(_0x174d5f,null));};exports[_0x38a3('0xaa')]=function(_0x5864ba,_0x177dc8){var _0x35d399={'raw':!![],'where':{}};var _0xa2406={};var _0x4ea976={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x5864ba['params']['id']}})[_0x38a3('0x16')](handleEntityNotFound(_0x177dc8,null))[_0x38a3('0x16')](function(_0x2ff522){if(_0x2ff522){_0xa2406[_0x38a3('0x84')]=_[_0x38a3('0x28')](db[_0x38a3('0x4c')][_0x38a3('0x85')]);_0xa2406[_0x38a3('0x20')]=_[_0x38a3('0x28')](_0x5864ba[_0x38a3('0x20')]);_0xa2406[_0x38a3('0x86')]=_[_0x38a3('0x87')](_0xa2406['model'],_0xa2406[_0x38a3('0x20')]);_0x35d399['attributes']=_['intersection'](_0xa2406[_0x38a3('0x84')],qs[_0x38a3('0x88')](_0x5864ba[_0x38a3('0x20')][_0x38a3('0x88')]));_0x35d399[_0x38a3('0x89')]=_0x35d399[_0x38a3('0x89')]['length']?_0x35d399[_0x38a3('0x89')]:_0xa2406[_0x38a3('0x84')];if(!_0x5864ba[_0x38a3('0x20')][_0x38a3('0x66')]('nolimit')){_0x35d399[_0x38a3('0x8f')]=qs[_0x38a3('0x8f')](_0x5864ba[_0x38a3('0x20')][_0x38a3('0x8f')]);_0x35d399[_0x38a3('0x12')]=qs[_0x38a3('0x12')](_0x5864ba[_0x38a3('0x20')][_0x38a3('0x12')]);}_0x35d399[_0x38a3('0xa4')]=qs[_0x38a3('0x8a')](_0x5864ba[_0x38a3('0x20')][_0x38a3('0x8a')]);_0x35d399[_0x38a3('0x62')]=qs[_0x38a3('0x86')](_[_0x38a3('0x8b')](_0x5864ba[_0x38a3('0x20')],_0xa2406[_0x38a3('0x86')]));_0x35d399[_0x38a3('0x62')][_0x38a3('0xa5')]=_0x2ff522['id'];if(_0x5864ba['query']['filter']){_0x35d399[_0x38a3('0x62')]=_[_0x38a3('0x35')](_0x35d399['where'],{'$or':_[_0x38a3('0x75')](_0x35d399[_0x38a3('0x89')],function(_0x840dbd){var _0x42a7d1={};_0x42a7d1[_0x840dbd]={'$like':'%'+_0x5864ba[_0x38a3('0x20')][_0x38a3('0x8c')]+'%'};return _0x42a7d1;})});}_0x35d399=_[_0x38a3('0x35')]({},_0x35d399,_0x5864ba[_0x38a3('0x8d')]);return db[_0x38a3('0x4c')]['count']({'where':_0x35d399[_0x38a3('0x62')]})[_0x38a3('0x16')](function(_0x484fde){_0x4ea976[_0x38a3('0x14')]=_0x484fde;if(_0x5864ba[_0x38a3('0x20')][_0x38a3('0xa6')]){_0x35d399[_0x38a3('0xa7')]=[{'all':!![]}];}return db[_0x38a3('0x4c')][_0x38a3('0x1f')](_0x35d399);})[_0x38a3('0x16')](function(_0x208377){_0x4ea976[_0x38a3('0xa9')]=_0x208377;return _0x4ea976;});}})['then'](respondWithFilteredResult(_0x177dc8,_0x35d399))['catch'](handleError(_0x177dc8,null));};exports[_0x38a3('0xab')]=function(_0x2dfe5f,_0x55e70a){var _0x53cd94={'raw':!![],'where':{}};var _0x441c7e={};var _0x3fc77a={'count':0x0,'rows':[]};return db[_0x38a3('0x24')][_0x38a3('0x83')]({'where':{'id':_0x2dfe5f[_0x38a3('0x26')]['id']}})['then'](handleEntityNotFound(_0x55e70a,null))[_0x38a3('0x16')](function(_0x2c3953){if(_0x2c3953){_0x441c7e[_0x38a3('0x84')]=_[_0x38a3('0x28')](db['JscriptySessionReport']['rawAttributes']);_0x441c7e['query']=_[_0x38a3('0x28')](_0x2dfe5f['query']);_0x441c7e[_0x38a3('0x86')]=_[_0x38a3('0x87')](_0x441c7e[_0x38a3('0x84')],_0x441c7e['query']);_0x53cd94[_0x38a3('0x89')]=_[_0x38a3('0x87')](_0x441c7e[_0x38a3('0x84')],qs['fields'](_0x2dfe5f[_0x38a3('0x20')][_0x38a3('0x88')]));_0x53cd94[_0x38a3('0x89')]=_0x53cd94[_0x38a3('0x89')]['length']?_0x53cd94['attributes']:_0x441c7e[_0x38a3('0x84')];if(!_0x2dfe5f[_0x38a3('0x20')][_0x38a3('0x66')](_0x38a3('0x8e'))){_0x53cd94[_0x38a3('0x8f')]=qs[_0x38a3('0x8f')](_0x2dfe5f[_0x38a3('0x20')]['limit']);_0x53cd94[_0x38a3('0x12')]=qs['offset'](_0x2dfe5f[_0x38a3('0x20')][_0x38a3('0x12')]);}_0x53cd94[_0x38a3('0xa4')]=qs[_0x38a3('0x8a')](_0x2dfe5f[_0x38a3('0x20')][_0x38a3('0x8a')]);_0x53cd94[_0x38a3('0x62')]=qs[_0x38a3('0x86')](_[_0x38a3('0x8b')](_0x2dfe5f[_0x38a3('0x20')],_0x441c7e[_0x38a3('0x86')]));_0x53cd94[_0x38a3('0x62')][_0x38a3('0xa5')]=_0x2c3953['id'];if(_0x2dfe5f['query'][_0x38a3('0x8c')]){_0x53cd94[_0x38a3('0x62')]=_['merge'](_0x53cd94['where'],{'$or':_[_0x38a3('0x75')](_0x53cd94['attributes'],function(_0x342985){var _0x3a06ec={};_0x3a06ec[_0x342985]={'$like':'%'+_0x2dfe5f['query'][_0x38a3('0x8c')]+'%'};return _0x3a06ec;})});}_0x53cd94=_[_0x38a3('0x35')]({},_0x53cd94,_0x2dfe5f[_0x38a3('0x8d')]);return db['JscriptySessionReport'][_0x38a3('0x14')]({'where':_0x53cd94[_0x38a3('0x62')]})[_0x38a3('0x16')](function(_0x31dce9){_0x3fc77a[_0x38a3('0x14')]=_0x31dce9;if(_0x2dfe5f['query']['includeAll']){_0x53cd94[_0x38a3('0xa7')]=[{'all':!![]}];}return db[_0x38a3('0xac')]['findAll'](_0x53cd94);})[_0x38a3('0x16')](function(_0xbc153d){_0x3fc77a[_0x38a3('0xa9')]=_0xbc153d;return _0x3fc77a;});}})[_0x38a3('0x16')](respondWithFilteredResult(_0x55e70a,_0x53cd94))[_0x38a3('0x22')](handleError(_0x55e70a,null));};exports[_0x38a3('0xad')]=function(_0x557d6f,_0xd54b3c){try{if(!_0x557d6f[_0x38a3('0x36')]['ListId']){throw new Error(_0x38a3('0xae'));}if(!_0x557d6f[_0x38a3('0x36')]['binding_keys']){throw new Error(_0x38a3('0xaf'));}if(!_0x557d6f[_0x38a3('0x36')][_0x38a3('0xb0')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x557d6f[_0x38a3('0x36')]['socket_timestamp']){throw new Error(_0x38a3('0xb1'));}var _0x3f5948=_0x557d6f[_0x38a3('0x36')]['binding_keys']['split'](',');var _0x289e63=_0x557d6f[_0x38a3('0x36')][_0x38a3('0xb0')][_0x38a3('0xb2')](',');if(!_0x3f5948[_0x38a3('0x29')]||!_0x289e63['length']||_0x3f5948[_0x38a3('0x29')]!==_0x289e63['length']){throw new Error(_0x38a3('0xb3'));}_0x557d6f[_0x38a3('0x36')][_0x38a3('0x88')]=_[_0x38a3('0xb4')](_0x3f5948,_0x289e63);if(!_0x557d6f[_0x38a3('0x36')]['fields'][_0x38a3('0x80')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x557d6f[_0x38a3('0x36')][_0x38a3('0x88')][_0x38a3('0xb5')]){throw new Error(_0x38a3('0xb6'));}var _0x5d4fbd=path[_0x38a3('0x3a')](config['root'],_0x38a3('0xb7'),_0x557d6f[_0x38a3('0xb8')][_0x38a3('0xb9')]);fs[_0x38a3('0xba')](_0x5d4fbd,parseInt(_0x38a3('0xbb'),0x8));var _0xeb74a8=require(_0x38a3('0xbc'))[_0x38a3('0xbd')](path[_0x38a3('0x3a')](__dirname,_0x38a3('0xbe')),[_0x5d4fbd,_0x557d6f['body'][_0x38a3('0xbf')],_0x557d6f[_0x38a3('0x36')][_0x38a3('0xb0')],_0x557d6f[_0x38a3('0x36')][_0x38a3('0x63')],_0x557d6f[_0x38a3('0x36')]['CompanyId'],_0x557d6f[_0x38a3('0x36')][_0x38a3('0x5f')],_0x557d6f[_0x38a3('0x36')][_0x38a3('0xc0')]]);return _0xd54b3c[_0x38a3('0x10')](0xc8)[_0x38a3('0x11')]({'message':_0x38a3('0xc1'),'pid':_0xeb74a8[_0x38a3('0xc2')]});}catch(_0x55c790){return _0xd54b3c[_0x38a3('0x10')](0x1f4)['send'](_0x55c790);}};exports[_0x38a3('0xc3')]=function(_0x123c88,_0x15a6cf){var _0xb14af2=fs[_0x38a3('0xc4')](_0x123c88[_0x38a3('0xb8')][_0x38a3('0x3')]);Papa[_0x38a3('0xc5')](_0xb14af2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x492882){return _0x15a6cf['status'](0xc8)['json']({'file':_0x123c88[_0x38a3('0xb8')],'fields':_0x492882['meta'][_0x38a3('0x88')]});}});};exports[_0x38a3('0xc6')]=function(_0x5e4c21,_0x28bfe7){return db[_0x38a3('0xc7')][_0x38a3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x38a3('0x16')](function(_0x5b2976){var _0x5762ce=![];if(!_0x5e4c21[_0x38a3('0x36')][_0x38a3('0x63')]){throw new Error(_0x38a3('0xae'));}if(!_0x5e4c21[_0x38a3('0x36')][_0x38a3('0xc8')][_0x38a3('0x80')]){throw new Error(_0x38a3('0xc9'));}if(!_0x5e4c21[_0x38a3('0x36')][_0x38a3('0xc8')][_0x38a3('0xb5')]){throw new Error(_0x38a3('0xb6'));}if(!_0x5e4c21[_0x38a3('0x36')][_0x38a3('0xc0')]){throw new Error(_0x38a3('0xb1'));}var _0x524079=require('child_process')[_0x38a3('0xbd')](path[_0x38a3('0x3a')](__dirname,_0x38a3('0xca')),[_0x5e4c21['params']['id'],JSON[_0x38a3('0xcb')](_0x5e4c21[_0x38a3('0x36')]),JSON[_0x38a3('0xcb')](_0x5b2976)]);_0x524079['on']('message',function(){_0x5762ce=!![];return _0x28bfe7[_0x38a3('0x10')](0xc8)['json']({'message':_0x38a3('0xcc'),'pid':_0x524079[_0x38a3('0xc2')]});});_0x524079['on'](_0x38a3('0xcd'),function(_0x10b0a9){if(_0x10b0a9&&!_0x5762ce){return _0x28bfe7[_0x38a3('0x10')](0x1f4)[_0x38a3('0x11')]({'message':_0x38a3('0xce'),'pid':_0x524079['pid']});}});})[_0x38a3('0x22')](handleError(_0x28bfe7,null));};exports[_0x38a3('0xcf')]=function(_0xc8a241,_0x5c1411){return db[_0x38a3('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x38a3('0xd0')}})[_0x38a3('0x16')](function(_0xb5192e){var _0x217b61=![];if(!_0xc8a241[_0x38a3('0x36')]['ListId']){throw new Error(_0x38a3('0xae'));}if(!_0xc8a241[_0x38a3('0x36')]['binding']['phone']){throw new Error(_0x38a3('0xc9'));}if(!_0xc8a241[_0x38a3('0x36')][_0x38a3('0xc8')][_0x38a3('0xb5')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xc8a241['body']['socket_timestamp']){throw new Error(_0x38a3('0xb1'));}var _0x3622ca=require('child_process')[_0x38a3('0xbd')](path[_0x38a3('0x3a')](__dirname,'../../components/import/cm/csvUpdates'),[_0xc8a241[_0x38a3('0x26')]['id'],JSON[_0x38a3('0xcb')](_0xc8a241[_0x38a3('0x36')]),JSON[_0x38a3('0xcb')](_0xb5192e)]);_0x3622ca['on'](_0x38a3('0xd1'),function(){_0x217b61=!![];return _0x5c1411[_0x38a3('0x10')](0xc8)[_0x38a3('0x11')]({'message':_0x38a3('0xcc'),'pid':_0x3622ca['pid']});});_0x3622ca['on'](_0x38a3('0xcd'),function(_0x54151f){if(_0x54151f&&!_0x217b61){return _0x5c1411['status'](0x1f4)[_0x38a3('0x11')]({'message':_0x38a3('0xce'),'pid':_0x3622ca['pid']});}});})['catch'](handleError(_0x5c1411,null));};exports[_0x38a3('0xd2')]=function(_0x46c588,_0x22991e){var _0x535cb5=[_0x38a3('0xd3'),_0x38a3('0xd4'),_0x38a3('0xd5'),_0x38a3('0xd6'),_0x38a3('0xd7'),_0x38a3('0xd8'),'voice'];var _0xf5dc21={'offset':0x0,'order':qs[_0x38a3('0x8a')](_0x38a3('0xd9'))},_0x308dee={'count':0x0,'rows':[]};Promise[_0x38a3('0xda')]()[_0x38a3('0x16')](function(){if(_0x46c588['query'][_0x38a3('0xdb')]){if(!_['includes'](_0x535cb5,_0x46c588[_0x38a3('0x20')]['channel'][_0x38a3('0xdc')]())){throw new Error(_0x38a3('0xdd'));}_0x535cb5=[_0x46c588[_0x38a3('0x20')][_0x38a3('0xdb')][_0x38a3('0xdc')]()];}if(_0x46c588[_0x38a3('0x20')][_0x38a3('0xde')]){try{var _0x3fca64=JSON['parse'](_0x46c588['query'][_0x38a3('0xde')]);if(!moment(_0x3fca64['from'])[_0x38a3('0xdf')]()){throw new Error(_0x38a3('0xe0'));}if(!moment(_0x3fca64['to'])[_0x38a3('0xdf')]()){throw new Error(_0x38a3('0xe1'));}}catch(_0xb7776a){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x46c588[_0x38a3('0x20')][_0x38a3('0x66')](_0x38a3('0x8e'))){_0xf5dc21[_0x38a3('0x8f')]=qs[_0x38a3('0x8f')](_0x46c588[_0x38a3('0x20')][_0x38a3('0x8f')]||0xa);_0xf5dc21[_0x38a3('0x12')]=qs['offset'](_0x46c588[_0x38a3('0x20')][_0x38a3('0x12')]);}var _0x29cfb9=_0x535cb5[_0x38a3('0x75')](function(_0x4cc67b){if(_0x4cc67b===_0x38a3('0xe2')){var _0xf6b0b5={'attributes':['id',_0x38a3('0xe3'),_0x38a3('0x32'),'source','destination',_0x38a3('0xe4'),_0x38a3('0xe5'),'endtime',_0x38a3('0xe6'),_0x38a3('0xe7'),_0x38a3('0xe8'),'userDisposition',_0x38a3('0xe9'),_0x38a3('0xea'),_0x38a3('0xeb')],'where':{'ContactId':_0x46c588[_0x38a3('0x26')]['id']},'include':[{'model':db['User'],'as':_0x38a3('0xc7'),'attributes':['id',_0x38a3('0x1a'),_0x38a3('0xec'),_0x38a3('0x30')]}],'order':[['createdAt','DESC']]};if(_0x46c588[_0x38a3('0x20')][_0x38a3('0xde')]){_0xf6b0b5[_0x38a3('0x62')][_0x38a3('0xe8')]={'$gte':_0x3fca64[_0x38a3('0x3c')],'$lte':_0x3fca64['to']};}return db[_0x38a3('0x4f')][_0x38a3('0xed')](_0xf6b0b5)[_0x38a3('0x16')](function(_0x429e97){_0x308dee[_0x38a3('0x14')]+=_0x429e97[_0x38a3('0x14')];return _[_0x38a3('0x75')](_0x429e97[_0x38a3('0xa9')],function(_0x97a614){var _0x587bd2=_0x97a614[_0x38a3('0x37')]({'plain':!![]});_0x587bd2[_0x38a3('0xdb')]=_0x4cc67b;if(_0x587bd2[_0x38a3('0xc7')]){_0x587bd2[_0x38a3('0xc7')]={'id':_0x587bd2[_0x38a3('0xc7')]['id'],'name':_0x587bd2[_0x38a3('0xc7')]['name'],'fullname':_0x587bd2[_0x38a3('0xc7')][_0x38a3('0xec')],'alias':_0x587bd2[_0x38a3('0xc7')][_0x38a3('0x30')]};}return _0x587bd2;});});}else{var _0x28c354=_['startCase'](_0x4cc67b)+(_0x4cc67b===_0x38a3('0xd4')?_0x38a3('0xee'):_0x38a3('0xef'));var _0x1bba0d={'attributes':['id',_0x38a3('0xf0'),_0x38a3('0xf1'),'createdAt',_0x38a3('0xe7'),_0x38a3('0xf2'),_0x38a3('0xf3'),_0x38a3('0xf4'),_0x38a3('0xeb'),_0x28c354+'Id'],'where':{'ContactId':_0x46c588['params']['id']},'include':[{'model':db[_0x28c354],'as':_0x38a3('0xef'),'attributes':['id',_0x38a3('0x1a'),_0x38a3('0xf5')]},{'model':db[_0x38a3('0xc7')],'as':_0x38a3('0xf6'),'attributes':['id',_0x38a3('0x1a'),'fullname']},{'model':db[_0x38a3('0x69')],'as':_0x38a3('0x6a'),'attributes':['id','name',_0x38a3('0x6b')],'through':{'attributes':[]}}],'order':[[_0x38a3('0xe8'),_0x38a3('0xf7')]]};if(_0x46c588[_0x38a3('0x20')][_0x38a3('0xde')]){_0x1bba0d[_0x38a3('0x62')][_0x38a3('0xe8')]={'$gte':_0x3fca64[_0x38a3('0x3c')],'$lte':_0x3fca64['to']};}switch(_0x4cc67b){case _0x38a3('0xd4'):_0x1bba0d['attributes'][_0x38a3('0x61')](_0x38a3('0xf8'),_0x38a3('0xf9'),'customerPort',_0x38a3('0xfa'),'osName',_0x38a3('0xfb'),'ratingType',_0x38a3('0xfc'),_0x38a3('0xfd'));break;case'mail':_0x1bba0d[_0x38a3('0x89')][_0x38a3('0x61')](_0x38a3('0xfe'),_0x38a3('0xff'));break;case _0x38a3('0xd6'):_0x1bba0d['attributes'][_0x38a3('0x61')](_0x38a3('0x100'),_0x38a3('0x101'));break;}return db[_[_0x38a3('0x102')](_0x4cc67b)+_0x38a3('0x103')]['findAndCountAll'](_0x1bba0d)['then'](function(_0x37c90d){_0x308dee[_0x38a3('0x14')]+=_0x37c90d[_0x38a3('0x14')];return _[_0x38a3('0x75')](_0x37c90d['rows'],function(_0x4a3e60){var _0xf11fa=_0x4a3e60[_0x38a3('0x37')]({'plain':!![]});_0xf11fa[_0x38a3('0xdb')]=_0x4cc67b;if(_0xf11fa[_0x38a3('0xf6')]){_0xf11fa['Owner']={'id':_0xf11fa['Owner']['id'],'name':_0xf11fa[_0x38a3('0xf6')][_0x38a3('0x1a')],'fullname':_0xf11fa['Owner'][_0x38a3('0xec')]};}return _0xf11fa;});});}});return Promise[_0x38a3('0x67')](_0x29cfb9);})[_0x38a3('0x16')](function(_0x4ad092){return _(_0x4ad092)[_0x38a3('0x104')]()[_0x38a3('0x105')](_0x38a3('0xe8'))[_0x38a3('0x106')]()['value']();})[_0x38a3('0x16')](function(_0x9521b9){_0x308dee[_0x38a3('0xa9')]=_0xf5dc21[_0x38a3('0x8f')]?_0x9521b9[_0x38a3('0x107')](_0xf5dc21[_0x38a3('0x12')],_0xf5dc21[_0x38a3('0x12')]+_0xf5dc21[_0x38a3('0x8f')]):_0x9521b9;return _0x308dee;})['then'](respondWithFilteredResult(_0x22991e,_0xf5dc21))[_0x38a3('0x22')](handleError(_0x22991e,null));}; \ No newline at end of file +var _0xc9ac=['sms','openchannel','whatsapp','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','starttime','userSecondDisposition','userThirdDisposition','UserId','alias','createdAt','DESC','findAndCountAll','fullname','startCase','chat','Website','Account','closed','closedAt','note','secondDisposition','key','Owner','color','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','status','offset','undefined','count','set','json','update','then','end','sendStatus','error','stack','name','send','getOptions','findAll','query','user','CmContact','describe','tags','keys','cf_','columnName','CmCustomField','length','displayName','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','catch','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','spread','contact','all','show','find','params','Tags','CmContactHasItem','ItemType','sequelize','Phones.OrderBy','cf_%d','$and','omit','pickBy','startsWith','map','format','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','values','phone','getTags','findOne','model','Tag','rawAttributes','filters','intersection','fields','attributes','order','sort','pick','filter','options','limit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','item','literal','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','createReadStream','parse','import','User','agent','No\x20ListId\x20specified','binding','fork','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xc9ac,0x129));var _0xcc9a=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xc9ac[_0x499210];return _0x2e153d;};'use strict';var moment=require(_0xcc9a('0x0'));var BPromise=require(_0xcc9a('0x1'));var util=require(_0xcc9a('0x2'));var path=require(_0xcc9a('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xcc9a('0x4'));var Redis=require(_0xcc9a('0x5'));var contacts=require(_0xcc9a('0x6'));var qs=require(_0xcc9a('0x7'));var logger=require(_0xcc9a('0x8'))('api');var config=require('../../config/environment');var shared=require(_0xcc9a('0x9'));var db=require(_0xcc9a('0xa'))['db'];config[_0xcc9a('0xb')]=_[_0xcc9a('0xc')](config[_0xcc9a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc9a('0xd'))['register'](socket);function respondWithResult(_0x2fa5e8,_0x22ce6c){_0x22ce6c=_0x22ce6c||0xc8;return function(_0x37a2b5){if(_0x37a2b5){return _0x2fa5e8[_0xcc9a('0xe')](_0x22ce6c)['json'](_0x37a2b5);}};}function respondWithFilteredResult(_0x8d133f,_0x46927b){return function(_0x595258){if(_0x595258){var _0x3a22f8=typeof _0x46927b[_0xcc9a('0xf')]===_0xcc9a('0x10')&&typeof _0x46927b['limit']===_0xcc9a('0x10');var _0x2d0ab1=_0x595258[_0xcc9a('0x11')];var _0x234c92=_0x3a22f8?0x0:_0x46927b[_0xcc9a('0xf')];var _0xcc13e4=_0x3a22f8?_0x595258['count']:_0x46927b[_0xcc9a('0xf')]+_0x46927b['limit'];var _0x129f17;if(_0xcc13e4>=_0x2d0ab1){_0xcc13e4=_0x2d0ab1;_0x129f17=0xc8;}else{_0x129f17=0xce;}_0x8d133f[_0xcc9a('0xe')](_0x129f17);return _0x8d133f[_0xcc9a('0x12')]('Content-Range',_0x234c92+'-'+_0xcc13e4+'/'+_0x2d0ab1)[_0xcc9a('0x13')](_0x595258);}return null;};}function saveUpdates(_0x38c374){return function(_0x3bce33){if(_0x3bce33){return _0x3bce33[_0xcc9a('0x14')](_0x38c374)[_0xcc9a('0x15')](function(_0x52961a){return _0x52961a;});}return null;};}function removeEntity(_0x3a92b6){return function(_0x1277e9){if(_0x1277e9){return _0x1277e9['destroy']()['then'](function(){_0x3a92b6[_0xcc9a('0xe')](0xcc)[_0xcc9a('0x16')]();});}};}function handleEntityNotFound(_0x29ccbf){return function(_0x5efd87){if(!_0x5efd87){_0x29ccbf[_0xcc9a('0x17')](0x194);}return _0x5efd87;};}function handleError(_0x35ce5e,_0x4d8e91){_0x4d8e91=_0x4d8e91||0x1f4;return function(_0x142f85){logger[_0xcc9a('0x18')](_0x142f85[_0xcc9a('0x19')]);if(_0x142f85[_0xcc9a('0x1a')]){delete _0x142f85[_0xcc9a('0x1a')];}_0x35ce5e[_0xcc9a('0xe')](_0x4d8e91)[_0xcc9a('0x1b')](_0x142f85);};}exports['index']=function(_0x3aa33d,_0x20916b){var _0x34768b={};return contacts['describe']()[_0xcc9a('0x15')](function(_0x5ec790){_0x34768b=qs[_0xcc9a('0x1c')](_0x5ec790,_0x3aa33d);return contacts[_0xcc9a('0x1d')](_0x3aa33d[_0xcc9a('0x1e')],_0x3aa33d[_0xcc9a('0x1f')],_0x34768b,_0x5ec790);})[_0xcc9a('0x15')](respondWithFilteredResult(_0x20916b,_0x34768b))['catch'](handleError(_0x20916b,null));};exports['destroy']=function(_0x248402,_0x4a216d){return db[_0xcc9a('0x20')]['find']({'where':{'id':_0x248402['params']['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x4a216d,null))[_0xcc9a('0x15')](removeEntity(_0x4a216d,null))['catch'](handleError(_0x4a216d,null));};exports['describe']=function(_0x513021,_0x3defba){return db['CmContact'][_0xcc9a('0x21')]()[_0xcc9a('0x15')](function(_0xcde81e){delete _0xcde81e[_0xcc9a('0x22')];for(var _0x5e5287=0x0;_0x5e52870x0){return new Promise(function(_0x53fafe){var _0xd2508e=[];for(var _0x3ed251=0x0;_0x3ed251<_0x5eb148[_0xcc9a('0x27')];_0x3ed251++){_0xd2508e[_0xcc9a('0x54')](insertAdditionalPhones(_0x5eb148[_0x3ed251][_0xcc9a('0x57')],_0x5eb148[_0x3ed251][_0xcc9a('0x4f')]));}Promise[_0xcc9a('0x58')](_0xd2508e)['then'](function(){_0x53fafe(0x1);});})['then'](function(){return{'success':_0x292077,'failure':_0x18a403,'duplicates':_0x28569d};});}else{return{'success':_0x292077,'failure':_0x18a403,'duplicates':_0x28569d};}}})['then'](respondWithResult(_0x146740,0xc9))[_0xcc9a('0x2f')](handleError(_0x146740,null));};exports[_0xcc9a('0x59')]=function(_0x2aa88b,_0x1b1b0c){var _0x16ecca;return db['CmContact'][_0xcc9a('0x21')]()[_0xcc9a('0x15')](function(_0x2dc808){return db[_0xcc9a('0x20')][_0xcc9a('0x5a')]({'where':{'id':_0x2aa88b[_0xcc9a('0x5b')]['id']},'include':[{'model':db['Tag'],'as':_0xcc9a('0x5c'),'attributes':['id',_0xcc9a('0x1a'),'color'],'required':_0x2aa88b[_0xcc9a('0x1e')]['tag']?!![]:![]},{'model':db[_0xcc9a('0x5d')],'as':'Phones','where':{'CmContactId':_0x2aa88b[_0xcc9a('0x5b')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xcc9a('0x5e')}]}],'order':[db[_0xcc9a('0x5f')]['literal'](_0xcc9a('0x60'))],'attributes':_[_0xcc9a('0x23')](_0x2dc808)});})[_0xcc9a('0x15')](function(_0x38a72a){if(!_['isNil'](_0x38a72a)){_0x16ecca=_0x38a72a[_0xcc9a('0x33')]({'plain':!![]});var _0x3f1d70={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x38a72a&&_0x38a72a[_0xcc9a('0x55')]){if(_0x38a72a[_0xcc9a('0x55')]){_0x3f1d70[_0xcc9a('0x52')]['$and']['push']({'ListId':{'$ne':_0x38a72a[_0xcc9a('0x55')]}});}}return db['CmCustomField'][_0xcc9a('0x1d')](_0x3f1d70);}})[_0xcc9a('0x15')](function(_0x2c19d2){if(!_[_0xcc9a('0x4b')](_0x2c19d2)){return _['omit'](_0x16ecca,_['map'](_0x2c19d2,function(_0x16ea2f){return util['format'](_0xcc9a('0x61'),_0x16ea2f['id']);}));}})[_0xcc9a('0x15')](handleEntityNotFound(_0x1b1b0c,null))[_0xcc9a('0x15')](respondWithResult(_0x1b1b0c,null))['catch'](handleError(_0x1b1b0c,null));};exports['update']=function(_0x2a5c03,_0x5b343d){var _0x13ba10;if(_0x2a5c03[_0xcc9a('0x31')]['id']){delete _0x2a5c03[_0xcc9a('0x31')]['id'];}if(!_['isNil'](_0x2a5c03[_0xcc9a('0x31')][_0xcc9a('0x4c')])){var _0x309a28=_0x2a5c03['body'][_0xcc9a('0x4c')];if(!_['isNil'](shared[_0xcc9a('0x4d')][_0x309a28]))_0x2a5c03['body']['utcOffset']=shared[_0xcc9a('0x4d')][_0x309a28][_0xcc9a('0x4e')];}return db['CmContact'][_0xcc9a('0x5a')]({'where':{'id':_0x2a5c03[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x5b343d,null))[_0xcc9a('0x15')](saveUpdates(_0x2a5c03[_0xcc9a('0x31')],null))[_0xcc9a('0x15')](function(_0x2f746d){_0x13ba10=_0x2f746d;var _0x128f83={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f746d&&_0x2f746d['ListId']){if(_0x2f746d[_0xcc9a('0x55')]){_0x128f83['where'][_0xcc9a('0x62')][_0xcc9a('0x54')]({'ListId':{'$ne':_0x2f746d[_0xcc9a('0x55')]}});}}return db[_0xcc9a('0x26')][_0xcc9a('0x1d')](_0x128f83);})[_0xcc9a('0x15')](function(_0x1cc95d){if(_0x1cc95d){return _[_0xcc9a('0x63')](_[_0xcc9a('0x64')](_0x2a5c03[_0xcc9a('0x31')],function(_0x1638e9,_0x6b3df2){return _[_0xcc9a('0x65')](_0x6b3df2,_0xcc9a('0x24'));}),_[_0xcc9a('0x66')](_0x1cc95d,function(_0x315ef2){return util[_0xcc9a('0x67')](_0xcc9a('0x61'),_0x315ef2['id']);}));}})[_0xcc9a('0x15')](function(_0x3a3fe9){if(_0x3a3fe9&&!_[_0xcc9a('0x68')](_0x3a3fe9)){var _0x4e8128=squel['update']()[_0xcc9a('0x69')](_0xcc9a('0x6a'))['setFields'](_0x3a3fe9)['where'](_0xcc9a('0x6b'),_0x2a5c03[_0xcc9a('0x5b')]['id'])[_0xcc9a('0x6c')]();return db[_0xcc9a('0x5f')][_0xcc9a('0x1e')](_0x4e8128['text'],{'replacements':_0x4e8128[_0xcc9a('0x6d')]});}})[_0xcc9a('0x15')](function(){if(_0x2a5c03[_0xcc9a('0x31')][_0xcc9a('0x6e')]&&_0x13ba10){return db[_0xcc9a('0x37')][_0xcc9a('0x14')]({'phone':_0x2a5c03[_0xcc9a('0x31')][_0xcc9a('0x6e')],'OrderBy':0x0},{'where':{'ContactId':_0x13ba10['id']}});}})[_0xcc9a('0x15')](function(){return _0x13ba10;})[_0xcc9a('0x15')](respondWithResult(_0x5b343d,null))[_0xcc9a('0x2f')](handleError(_0x5b343d,null));};exports[_0xcc9a('0x6f')]=function(_0x476b5e,_0x1d0b6f){var _0x5180e6={};var _0x527aa0={};var _0x10ae68;var _0x5bfbaf;return db[_0xcc9a('0x20')][_0xcc9a('0x70')]({'where':{'id':_0x476b5e[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x1d0b6f,null))[_0xcc9a('0x15')](function(_0x1b1903){if(_0x1b1903){_0x10ae68=_0x1b1903;_0x527aa0[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x72')][_0xcc9a('0x73')]);_0x527aa0['query']=_[_0xcc9a('0x23')](_0x476b5e[_0xcc9a('0x1e')]);_0x527aa0[_0xcc9a('0x74')]=_[_0xcc9a('0x75')](_0x527aa0['model'],_0x527aa0['query']);_0x5180e6['attributes']=_[_0xcc9a('0x75')](_0x527aa0[_0xcc9a('0x71')],qs[_0xcc9a('0x76')](_0x476b5e['query'][_0xcc9a('0x76')]));_0x5180e6[_0xcc9a('0x77')]=_0x5180e6[_0xcc9a('0x77')][_0xcc9a('0x27')]?_0x5180e6['attributes']:_0x527aa0[_0xcc9a('0x71')];_0x5180e6[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0x79')]);_0x5180e6[_0xcc9a('0x52')]=qs[_0xcc9a('0x74')](_[_0xcc9a('0x7a')](_0x476b5e[_0xcc9a('0x1e')],_0x527aa0[_0xcc9a('0x74')]));if(_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0x7b')]){_0x5180e6[_0xcc9a('0x52')]=_[_0xcc9a('0x30')](_0x5180e6['where'],{'$or':_[_0xcc9a('0x66')](_0x5180e6[_0xcc9a('0x77')],function(_0x34edb5){var _0x48a4bc={};_0x48a4bc[_0x34edb5]={'$like':'%'+_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x48a4bc;})});}_0x5180e6=_[_0xcc9a('0x30')]({},_0x5180e6,_0x476b5e[_0xcc9a('0x7c')]);return _0x10ae68[_0xcc9a('0x6f')](_0x5180e6);}})[_0xcc9a('0x15')](function(_0x34cd20){if(_0x34cd20){_0x5bfbaf=_0x34cd20[_0xcc9a('0x27')];if(!_0x476b5e[_0xcc9a('0x1e')]['hasOwnProperty']('nolimit')){_0x5180e6[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x476b5e[_0xcc9a('0x1e')]['limit']);_0x5180e6[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0xf')]);}return _0x10ae68[_0xcc9a('0x6f')](_0x5180e6);}})['then'](function(_0x20eac2){if(_0x20eac2){return _0x20eac2?{'count':_0x5bfbaf,'rows':_0x20eac2}:null;}})[_0xcc9a('0x15')](respondWithResult(_0x1d0b6f,null))['catch'](handleError(_0x1d0b6f,null));};exports[_0xcc9a('0x7e')]=function(_0xbc0891,_0x570d22){if(_0xbc0891[_0xcc9a('0x31')]['id']){delete _0xbc0891[_0xcc9a('0x31')]['id'];}return db['CmContact'][_0xcc9a('0x70')]({'where':{'id':_0xbc0891[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x570d22,null))[_0xcc9a('0x15')](function(_0x35dd1c){if(_0x35dd1c){return _0x35dd1c[_0xcc9a('0x7e')](_0xbc0891[_0xcc9a('0x31')][_0xcc9a('0x7f')]||[]);}return null;})['then'](respondWithResult(_0x570d22,null))['catch'](handleError(_0x570d22,null));};exports[_0xcc9a('0x80')]=function(_0x3650cc,_0x2931f4){var _0x1a986b=[];_0x1a986b[_0xcc9a('0x54')](addAdditionalPhones(_0x3650cc[_0xcc9a('0x31')]));Promise[_0xcc9a('0x58')](_0x1a986b)[_0xcc9a('0x15')](function(){_0x1a986b=[];_0x1a986b[_0xcc9a('0x54')](deleteCmHopperPhones(_0x3650cc['body']['id']));_0x1a986b[_0xcc9a('0x54')](addCmHopperPhones(_0x3650cc[_0xcc9a('0x31')]['id']));Promise[_0xcc9a('0x58')](_0x1a986b)[_0xcc9a('0x15')](function(){return[0x1];})['then'](respondWithResult(_0x2931f4,null));});};function addAdditionalPhones(_0x9dcbf6){var _0x35123b;return new Promise(function(_0x1e81bf){return db[_0xcc9a('0x5d')][_0xcc9a('0x38')]({'where':{'CmContactId':_0x9dcbf6['id']}})[_0xcc9a('0x15')](function(){db[_0xcc9a('0x81')][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id',_0xcc9a('0x82')]})['then'](function(_0x7713e0){var _0x4a941b=[];for(var _0x1b39e8=0x0;_0x1b39e8<_0x9dcbf6[_0xcc9a('0x83')][_0xcc9a('0x27')];_0x1b39e8++){var _0x3917d6=_0x9dcbf6[_0xcc9a('0x84')]?_[_0xcc9a('0x4b')](_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8])?'':_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8]:_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8][_0xcc9a('0x85')]?_0x9dcbf6['items'][_0x1b39e8][_0xcc9a('0x85')]:'';var _0x4abd7c=_[_0xcc9a('0x4b')](_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['description'])?'':_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['description'];var _0x277d06=_0x3917d6+':'+_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8][_0xcc9a('0x6e')]+'§'+_0x4abd7c;if(_[_0xcc9a('0x4b')](_0x35123b))_0x35123b=_0x277d06;else _0x35123b+=';'+_0x277d06;var _0x86db=null;var _0x16ed7d=null;if(_0x9dcbf6[_0xcc9a('0x84')]){if(!_[_0xcc9a('0x4b')](_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8])){_0x16ed7d=_[_0xcc9a('0x5a')](_0x7713e0,function(_0x5dca2a){return _0x5dca2a['id']===_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8];});if(!_[_0xcc9a('0x4b')](_0x16ed7d)){_0x86db=_0x16ed7d[_0xcc9a('0x82')];}}}else{if(!_[_0xcc9a('0x4b')](_0x9dcbf6['items'][_0x1b39e8])){_0x16ed7d=_[_0xcc9a('0x5a')](_0x7713e0,function(_0xd8895c){return _0xd8895c['id']===_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['ItemTypeId'];});if(!_[_0xcc9a('0x4b')](_0x16ed7d)){_0x86db=_0x1b39e8;}}}if(_[_0xcc9a('0x4b')](_0x86db)){_0x86db=0x64;}_0x4a941b[_0xcc9a('0x54')](addAdditionalPhone(_0x9dcbf6['id'],_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8][_0xcc9a('0x6e')],_0x9dcbf6[_0xcc9a('0x84')]?_['isNil'](_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8])?null:_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8]:_0x9dcbf6['items'][_0x1b39e8][_0xcc9a('0x85')]?_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['ItemTypeId']:null,_0x86db,_0x4abd7c));}Promise[_0xcc9a('0x58')](_0x4a941b)['then'](function(){db[_0xcc9a('0x20')]['update']({'AdditionalPhones':_0x35123b},{'where':{'id':_0x9dcbf6['id']}})['then'](function(){_0x1e81bf(0x1);});});});});});}function addAdditionalPhone(_0x3e2acd,_0x313e9e,_0x368fbd,_0xf3889a,_0x227fe2){return db[_0xcc9a('0x5d')][_0xcc9a('0x5a')]({'where':{'CmContactId':_0x3e2acd,'item':_0x313e9e}})[_0xcc9a('0x15')](function(_0x44b3e0){if(_0x44b3e0)logger[_0xcc9a('0x2b')](_0xcc9a('0x86'),_0x44b3e0);else{db[_0xcc9a('0x5d')][_0xcc9a('0x3b')]({'CmContactId':_0x3e2acd,'item':_0x313e9e,'ItemTypeId':_0x368fbd,'OrderBy':_0xf3889a,'ItemClass':'PHONE','description':_0x227fe2});}});}function deleteCmHopperPhones(_0x566f81){return new Promise(function(_0x2d0ab2){return db[_0xcc9a('0x37')][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x566f81}})['then'](function(_0x43c756){db['CmHopperAdditionalPhone'][_0xcc9a('0x38')]({'where':{'CmHopperId':{'$in':_['map'](_0x43c756,'id')}}});})[_0xcc9a('0x15')](function(){_0x2d0ab2(0x1);});});}function addCmHopperPhones(_0x1404b2){return new Promise(function(_0x275925){return db['CmHopper'][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1404b2}})[_0xcc9a('0x15')](function(_0x1dee35){var _0x1eb391=[];_[_0xcc9a('0x66')](_0x1dee35,function(_0x2fa694){_0x1eb391[_0xcc9a('0x54')](createCmHopperPhone(_0x1404b2,_0x2fa694['id']));});Promise['all'](_0x1eb391)[_0xcc9a('0x15')](function(){_0x275925(0x1);});});});}function createCmHopperPhone(_0x3b3bb5,_0x183703){return new Promise(function(_0x5ed337){db['CmContactHasItem'][_0xcc9a('0x1d')]({'raw':!![],'attributes':[_0xcc9a('0x87'),_0xcc9a('0x82')],'where':{'CmContactId':_0x3b3bb5,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0xcc9a('0x82')],'as':'ItemType'}],'order':[_0xcc9a('0x82'),db[_0xcc9a('0x5f')][_0xcc9a('0x88')](_0xcc9a('0x89'))]})[_0xcc9a('0x15')](function(_0x33d75b){var _0xccfe1a=0x1;var _0x2e0e98=_[_0xcc9a('0x66')](_0x33d75b,function(_0x5fc9a){_0x5fc9a[_0xcc9a('0x8a')]=_0x183703;_0x5fc9a['phone']=_0x5fc9a[_0xcc9a('0x87')];_0x5fc9a['OrderBy']=_0xccfe1a;delete _0x5fc9a['ItemType.OrderBy'];_0xccfe1a=_0xccfe1a+0x1;return _0x5fc9a;});return db[_0xcc9a('0x8b')][_0xcc9a('0x8c')](_0x2e0e98,{});})[_0xcc9a('0x15')](function(){_0x5ed337(0x1);});});}function insertAdditionalPhones(_0x101b64,_0xc7803b){return new Promise(function(_0x3265da){var _0x29b78f=[];for(var _0x145288=0x0;_0x145288<_0xc7803b[_0xcc9a('0x27')];_0x145288++){var _0x2f9e31=_0xc7803b[_0x145288];_0x29b78f['push'](parseContactItemType(_0x2f9e31));}Promise['all'](_0x29b78f)[_0xcc9a('0x15')](function(){var _0x473dd2={'id':_0x101b64['id'],'items':_0xc7803b};return addAdditionalPhones(_0x473dd2)[_0xcc9a('0x15')](function(){return addCmHopperPhones(_0x101b64['id']);});})['then'](function(){_0x3265da(_0x101b64);});});}function parseContactItemType(_0x3f269f){return new Promise(function(_0x31e9d7){if(_0x3f269f[_0xcc9a('0x2e')]('ItemTypeId')){_0x31e9d7(_0x3f269f);}else{return db['ContactItemType'][_0xcc9a('0x5a')]({'where':{'name':_0x3f269f['ItemType']}})[_0xcc9a('0x15')](function(_0x86435d){if(_[_0xcc9a('0x4b')](_0x86435d))_0x3f269f['ItemTypeId']=null;else _0x3f269f[_0xcc9a('0x85')]=_0x86435d['id'];_0x31e9d7(_0x3f269f);});}});}exports[_0xcc9a('0x8d')]=function(_0x2a4bd6,_0x23a087){return db[_0xcc9a('0x5d')][_0xcc9a('0x1d')]({'raw':!![],'where':{'CmContactId':_0x2a4bd6[_0xcc9a('0x5b')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xcc9a('0x81')],'as':'ItemType'}],'order':[[_0xcc9a('0x82')],[db[_0xcc9a('0x5f')][_0xcc9a('0x88')](_0xcc9a('0x89'))]]})[_0xcc9a('0x15')](function(_0x586fa7){return _0x586fa7;})['then'](respondWithResult(_0x23a087,null))[_0xcc9a('0x2f')](handleError(_0x23a087,null));};exports[_0xcc9a('0x8e')]=function(_0x46e613,_0x22fddc){return db[_0xcc9a('0x5d')]['findAll']({'raw':!![],'where':{'CmContactId':_0x46e613['body'][_0xcc9a('0x8f')]}})['then'](function(_0x2d510a){var _0x3f6819=_[_0xcc9a('0x66')](_0x2d510a,function(_0x4a3a31){_0x4a3a31['CmContactId']=_0x46e613[_0xcc9a('0x31')][_0xcc9a('0x90')];return _0x4a3a31;});return db[_0xcc9a('0x5d')]['bulkCreate'](_0x3f6819,{});})[_0xcc9a('0x15')](function(){return addCmHopperPhones(_0x46e613[_0xcc9a('0x31')][_0xcc9a('0x90')]);})['then'](function(){return['ok'];})[_0xcc9a('0x15')](respondWithResult(_0x22fddc,null))[_0xcc9a('0x2f')](handleError(_0x22fddc,null));};exports[_0xcc9a('0x91')]=function(_0x7bd2ee,_0x295152){var _0x475e0b=[];_0x475e0b[_0xcc9a('0x54')](createCmHopperPhone(_0x7bd2ee[_0xcc9a('0x31')]['id'],_0x7bd2ee[_0xcc9a('0x31')][_0xcc9a('0x92')]));Promise['all'](_0x475e0b)[_0xcc9a('0x15')](function(){return[0x1];})[_0xcc9a('0x15')](respondWithResult(_0x295152,null));};exports['getHoppers']=function(_0x274bf3,_0x336a8a){var _0x5f529a={'raw':![],'where':{}};var _0x1e512b={};var _0x1bae14={'count':0x0,'rows':[]};return db['CmContact'][_0xcc9a('0x70')]({'where':{'id':_0x274bf3['params']['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x336a8a,null))[_0xcc9a('0x15')](function(_0x148e38){if(_0x148e38){_0x1e512b[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x37')][_0xcc9a('0x73')]);_0x1e512b[_0xcc9a('0x1e')]=_[_0xcc9a('0x23')](_0x274bf3[_0xcc9a('0x1e')]);_0x1e512b[_0xcc9a('0x74')]=_[_0xcc9a('0x75')](_0x1e512b[_0xcc9a('0x71')],_0x1e512b[_0xcc9a('0x1e')]);_0x5f529a['attributes']=_[_0xcc9a('0x75')](_0x1e512b[_0xcc9a('0x71')],qs[_0xcc9a('0x76')](_0x274bf3[_0xcc9a('0x1e')][_0xcc9a('0x76')]));_0x5f529a[_0xcc9a('0x77')]=_0x5f529a[_0xcc9a('0x77')]['length']?_0x5f529a[_0xcc9a('0x77')]:_0x1e512b['model'];if(!_0x274bf3[_0xcc9a('0x1e')]['hasOwnProperty'](_0xcc9a('0x93'))){_0x5f529a[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x274bf3[_0xcc9a('0x1e')][_0xcc9a('0x7d')]);_0x5f529a[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x274bf3['query'][_0xcc9a('0xf')]);}_0x5f529a[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x274bf3['query'][_0xcc9a('0x79')]);_0x5f529a['where']=qs['filters'](_[_0xcc9a('0x7a')](_0x274bf3[_0xcc9a('0x1e')],_0x1e512b[_0xcc9a('0x74')]));_0x5f529a[_0xcc9a('0x52')][_0xcc9a('0x94')]=_0x148e38['id'];if(_0x274bf3['query']['filter']){_0x5f529a[_0xcc9a('0x52')]=_[_0xcc9a('0x30')](_0x5f529a[_0xcc9a('0x52')],{'$or':_[_0xcc9a('0x66')](_0x5f529a[_0xcc9a('0x77')],function(_0x3a242a){var _0x42ba47={};_0x42ba47[_0x3a242a]={'$like':'%'+_0x274bf3[_0xcc9a('0x1e')]['filter']+'%'};return _0x42ba47;})});}_0x5f529a=_[_0xcc9a('0x30')]({},_0x5f529a,_0x274bf3[_0xcc9a('0x7c')]);return db['CmHopper'][_0xcc9a('0x11')]({'where':_0x5f529a[_0xcc9a('0x52')]})[_0xcc9a('0x15')](function(_0x5b0aa2){_0x1bae14['count']=_0x5b0aa2;if(_0x274bf3[_0xcc9a('0x1e')][_0xcc9a('0x95')]){_0x5f529a[_0xcc9a('0x96')]=[{'all':!![]}];}return db[_0xcc9a('0x37')][_0xcc9a('0x1d')](_0x5f529a);})[_0xcc9a('0x15')](function(_0x52f26c){_0x1bae14[_0xcc9a('0x97')]=_0x52f26c;return _0x1bae14;});}})[_0xcc9a('0x15')](respondWithFilteredResult(_0x336a8a,_0x5f529a))[_0xcc9a('0x2f')](handleError(_0x336a8a,null));};exports[_0xcc9a('0x98')]=function(_0x2dabce,_0x57f167){var _0x3d25b5={'raw':!![],'where':{}};var _0x137092={};var _0x4f82c3={'count':0x0,'rows':[]};return db[_0xcc9a('0x20')]['findOne']({'where':{'id':_0x2dabce[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x57f167,null))[_0xcc9a('0x15')](function(_0x55ff07){if(_0x55ff07){_0x137092[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db['CmHopperHistory'][_0xcc9a('0x73')]);_0x137092[_0xcc9a('0x1e')]=_[_0xcc9a('0x23')](_0x2dabce['query']);_0x137092[_0xcc9a('0x74')]=_[_0xcc9a('0x75')](_0x137092[_0xcc9a('0x71')],_0x137092[_0xcc9a('0x1e')]);_0x3d25b5[_0xcc9a('0x77')]=_[_0xcc9a('0x75')](_0x137092['model'],qs[_0xcc9a('0x76')](_0x2dabce[_0xcc9a('0x1e')]['fields']));_0x3d25b5[_0xcc9a('0x77')]=_0x3d25b5[_0xcc9a('0x77')]['length']?_0x3d25b5[_0xcc9a('0x77')]:_0x137092['model'];if(!_0x2dabce[_0xcc9a('0x1e')]['hasOwnProperty'](_0xcc9a('0x93'))){_0x3d25b5[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0x7d')]);_0x3d25b5['offset']=qs['offset'](_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0xf')]);}_0x3d25b5['order']=qs[_0xcc9a('0x79')](_0x2dabce[_0xcc9a('0x1e')]['sort']);_0x3d25b5[_0xcc9a('0x52')]=qs[_0xcc9a('0x74')](_[_0xcc9a('0x7a')](_0x2dabce['query'],_0x137092['filters']));_0x3d25b5[_0xcc9a('0x52')]['ContactId']=_0x55ff07['id'];if(_0x2dabce['query'][_0xcc9a('0x7b')]){_0x3d25b5['where']=_[_0xcc9a('0x30')](_0x3d25b5[_0xcc9a('0x52')],{'$or':_[_0xcc9a('0x66')](_0x3d25b5[_0xcc9a('0x77')],function(_0x204aa8){var _0x39df45={};_0x39df45[_0x204aa8]={'$like':'%'+_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x39df45;})});}_0x3d25b5=_[_0xcc9a('0x30')]({},_0x3d25b5,_0x2dabce[_0xcc9a('0x7c')]);return db[_0xcc9a('0x44')][_0xcc9a('0x11')]({'where':_0x3d25b5['where']})['then'](function(_0x995ef3){_0x4f82c3[_0xcc9a('0x11')]=_0x995ef3;if(_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0x95')]){_0x3d25b5['include']=[{'all':!![]}];}return db[_0xcc9a('0x44')][_0xcc9a('0x1d')](_0x3d25b5);})[_0xcc9a('0x15')](function(_0x2e98b7){_0x4f82c3[_0xcc9a('0x97')]=_0x2e98b7;return _0x4f82c3;});}})['then'](respondWithFilteredResult(_0x57f167,_0x3d25b5))[_0xcc9a('0x2f')](handleError(_0x57f167,null));};exports['getHopperFinals']=function(_0x37503f,_0x431658){var _0x11cead={'raw':!![],'where':{}};var _0x5de718={};var _0x143a8b={'count':0x0,'rows':[]};return db[_0xcc9a('0x20')][_0xcc9a('0x70')]({'where':{'id':_0x37503f['params']['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x431658,null))['then'](function(_0x30667b){if(_0x30667b){_0x5de718[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x43')][_0xcc9a('0x73')]);_0x5de718[_0xcc9a('0x1e')]=_['keys'](_0x37503f[_0xcc9a('0x1e')]);_0x5de718['filters']=_['intersection'](_0x5de718['model'],_0x5de718[_0xcc9a('0x1e')]);_0x11cead[_0xcc9a('0x77')]=_['intersection'](_0x5de718['model'],qs['fields'](_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x76')]));_0x11cead[_0xcc9a('0x77')]=_0x11cead[_0xcc9a('0x77')]['length']?_0x11cead[_0xcc9a('0x77')]:_0x5de718[_0xcc9a('0x71')];if(!_0x37503f['query'][_0xcc9a('0x2e')]('nolimit')){_0x11cead[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x37503f[_0xcc9a('0x1e')]['limit']);_0x11cead[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x37503f['query']['offset']);}_0x11cead[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x37503f[_0xcc9a('0x1e')]['sort']);_0x11cead[_0xcc9a('0x52')]=qs[_0xcc9a('0x74')](_[_0xcc9a('0x7a')](_0x37503f['query'],_0x5de718[_0xcc9a('0x74')]));_0x11cead[_0xcc9a('0x52')]['ContactId']=_0x30667b['id'];if(_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x7b')]){_0x11cead['where']=_['merge'](_0x11cead[_0xcc9a('0x52')],{'$or':_[_0xcc9a('0x66')](_0x11cead['attributes'],function(_0x3e7383){var _0x19bb47={};_0x19bb47[_0x3e7383]={'$like':'%'+_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x19bb47;})});}_0x11cead=_[_0xcc9a('0x30')]({},_0x11cead,_0x37503f[_0xcc9a('0x7c')]);return db[_0xcc9a('0x43')][_0xcc9a('0x11')]({'where':_0x11cead[_0xcc9a('0x52')]})[_0xcc9a('0x15')](function(_0x37ef51){_0x143a8b['count']=_0x37ef51;if(_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x95')]){_0x11cead[_0xcc9a('0x96')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc9a('0x1d')](_0x11cead);})[_0xcc9a('0x15')](function(_0x4a1827){_0x143a8b[_0xcc9a('0x97')]=_0x4a1827;return _0x143a8b;});}})[_0xcc9a('0x15')](respondWithFilteredResult(_0x431658,_0x11cead))[_0xcc9a('0x2f')](handleError(_0x431658,null));};exports[_0xcc9a('0x99')]=function(_0x386899,_0x4382bb){var _0xa32e94={'raw':!![],'where':{}};var _0x36c872={};var _0x35cbf8={'count':0x0,'rows':[]};return db[_0xcc9a('0x20')][_0xcc9a('0x70')]({'where':{'id':_0x386899[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x4382bb,null))[_0xcc9a('0x15')](function(_0x31f275){if(_0x31f275){_0x36c872[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x9a')]['rawAttributes']);_0x36c872[_0xcc9a('0x1e')]=_['keys'](_0x386899[_0xcc9a('0x1e')]);_0x36c872['filters']=_[_0xcc9a('0x75')](_0x36c872[_0xcc9a('0x71')],_0x36c872[_0xcc9a('0x1e')]);_0xa32e94['attributes']=_[_0xcc9a('0x75')](_0x36c872['model'],qs[_0xcc9a('0x76')](_0x386899['query'][_0xcc9a('0x76')]));_0xa32e94[_0xcc9a('0x77')]=_0xa32e94[_0xcc9a('0x77')][_0xcc9a('0x27')]?_0xa32e94[_0xcc9a('0x77')]:_0x36c872[_0xcc9a('0x71')];if(!_0x386899[_0xcc9a('0x1e')]['hasOwnProperty'](_0xcc9a('0x93'))){_0xa32e94[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x386899[_0xcc9a('0x1e')]['limit']);_0xa32e94['offset']=qs[_0xcc9a('0xf')](_0x386899[_0xcc9a('0x1e')][_0xcc9a('0xf')]);}_0xa32e94[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x386899[_0xcc9a('0x1e')][_0xcc9a('0x79')]);_0xa32e94[_0xcc9a('0x52')]=qs['filters'](_[_0xcc9a('0x7a')](_0x386899['query'],_0x36c872[_0xcc9a('0x74')]));_0xa32e94[_0xcc9a('0x52')][_0xcc9a('0x94')]=_0x31f275['id'];if(_0x386899[_0xcc9a('0x1e')][_0xcc9a('0x7b')]){_0xa32e94[_0xcc9a('0x52')]=_[_0xcc9a('0x30')](_0xa32e94[_0xcc9a('0x52')],{'$or':_['map'](_0xa32e94[_0xcc9a('0x77')],function(_0x507557){var _0x36f13d={};_0x36f13d[_0x507557]={'$like':'%'+_0x386899[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x36f13d;})});}_0xa32e94=_[_0xcc9a('0x30')]({},_0xa32e94,_0x386899[_0xcc9a('0x7c')]);return db[_0xcc9a('0x9a')][_0xcc9a('0x11')]({'where':_0xa32e94[_0xcc9a('0x52')]})['then'](function(_0x9e46ce){_0x35cbf8['count']=_0x9e46ce;if(_0x386899['query'][_0xcc9a('0x95')]){_0xa32e94[_0xcc9a('0x96')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcc9a('0x1d')](_0xa32e94);})[_0xcc9a('0x15')](function(_0x47c2c6){_0x35cbf8[_0xcc9a('0x97')]=_0x47c2c6;return _0x35cbf8;});}})[_0xcc9a('0x15')](respondWithFilteredResult(_0x4382bb,_0xa32e94))['catch'](handleError(_0x4382bb,null));};exports[_0xcc9a('0x9b')]=function(_0x550804,_0x568d69){try{if(!_0x550804[_0xcc9a('0x31')][_0xcc9a('0x55')]){throw new Error('No\x20ListId\x20specified');}if(!_0x550804['body'][_0xcc9a('0x9c')]){throw new Error(_0xcc9a('0x9d'));}if(!_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9e')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x550804[_0xcc9a('0x31')]['socket_timestamp']){throw new Error(_0xcc9a('0x9f'));}var _0x523024=_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9c')][_0xcc9a('0xa0')](',');var _0xa122c5=_0x550804['body'][_0xcc9a('0x9e')][_0xcc9a('0xa0')](',');if(!_0x523024['length']||!_0xa122c5[_0xcc9a('0x27')]||_0x523024[_0xcc9a('0x27')]!==_0xa122c5['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x550804[_0xcc9a('0x31')]['fields']=_[_0xcc9a('0xa1')](_0x523024,_0xa122c5);if(!_0x550804['body']['fields']['phone']){throw new Error(_0xcc9a('0xa2'));}if(!_0x550804[_0xcc9a('0x31')][_0xcc9a('0x76')][_0xcc9a('0xa3')]){throw new Error(_0xcc9a('0xa4'));}var _0xfed53f=path['join'](config['root'],_0xcc9a('0xa5'),_0x550804[_0xcc9a('0xa6')][_0xcc9a('0xa7')]);fs['chmodSync'](_0xfed53f,parseInt(_0xcc9a('0xa8'),0x8));var _0x21c677=require(_0xcc9a('0xa9'))['fork'](path[_0xcc9a('0x35')](__dirname,_0xcc9a('0xaa')),[_0xfed53f,_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9c')],_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9e')],_0x550804[_0xcc9a('0x31')]['ListId'],_0x550804[_0xcc9a('0x31')][_0xcc9a('0xab')],_0x550804[_0xcc9a('0x31')]['duplicates'],_0x550804[_0xcc9a('0x31')][_0xcc9a('0xac')]]);return _0x568d69[_0xcc9a('0xe')](0xc8)['json']({'message':_0xcc9a('0xad'),'pid':_0x21c677['pid']});}catch(_0x195321){return _0x568d69[_0xcc9a('0xe')](0x1f4)[_0xcc9a('0x1b')](_0x195321);}};exports['upload']=function(_0xc374eb,_0x373a51){var _0x3fff27=fs[_0xcc9a('0xae')](_0xc374eb[_0xcc9a('0xa6')][_0xcc9a('0x3')]);Papa[_0xcc9a('0xaf')](_0x3fff27,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x27c9fb){return _0x373a51['status'](0xc8)[_0xcc9a('0x13')]({'file':_0xc374eb[_0xcc9a('0xa6')],'fields':_0x27c9fb['meta'][_0xcc9a('0x76')]});}});};exports[_0xcc9a('0xb0')]=function(_0x45e940,_0x4ee52e){return db[_0xcc9a('0xb1')][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xcc9a('0xb2')}})[_0xcc9a('0x15')](function(_0x3f5921){var _0x27a648=![];if(!_0x45e940[_0xcc9a('0x31')]['ListId']){throw new Error(_0xcc9a('0xb3'));}if(!_0x45e940[_0xcc9a('0x31')][_0xcc9a('0xb4')][_0xcc9a('0x6e')]){throw new Error(_0xcc9a('0xa2'));}if(!_0x45e940['body'][_0xcc9a('0xb4')]['firstName']){throw new Error(_0xcc9a('0xa4'));}if(!_0x45e940[_0xcc9a('0x31')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x139eb6=require(_0xcc9a('0xa9'))[_0xcc9a('0xb5')](path[_0xcc9a('0x35')](__dirname,'../../components/import/cm/csv2'),[_0x45e940[_0xcc9a('0x5b')]['id'],JSON[_0xcc9a('0xb6')](_0x45e940[_0xcc9a('0x31')]),JSON['stringify'](_0x3f5921)]);_0x139eb6['on'](_0xcc9a('0xb7'),function(){_0x27a648=!![];return _0x4ee52e[_0xcc9a('0xe')](0xc8)['json']({'message':_0xcc9a('0xb8'),'pid':_0x139eb6[_0xcc9a('0xb9')]});});_0x139eb6['on'](_0xcc9a('0xba'),function(_0x4911ae){if(_0x4911ae&&!_0x27a648){return _0x4ee52e[_0xcc9a('0xe')](0x1f4)[_0xcc9a('0x13')]({'message':_0xcc9a('0xbb'),'pid':_0x139eb6['pid']});}});})[_0xcc9a('0x2f')](handleError(_0x4ee52e,null));};exports[_0xcc9a('0xbc')]=function(_0x2252d8,_0x29e056){return db['User'][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xcc9a('0xb2')}})[_0xcc9a('0x15')](function(_0x53d2e7){var _0x2845c2=![];if(!_0x2252d8[_0xcc9a('0x31')][_0xcc9a('0x55')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2252d8[_0xcc9a('0x31')][_0xcc9a('0xb4')][_0xcc9a('0x6e')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2252d8[_0xcc9a('0x31')]['binding'][_0xcc9a('0xa3')]){throw new Error(_0xcc9a('0xa4'));}if(!_0x2252d8['body'][_0xcc9a('0xac')]){throw new Error(_0xcc9a('0x9f'));}var _0x24d0f2=require(_0xcc9a('0xa9'))[_0xcc9a('0xb5')](path['join'](__dirname,_0xcc9a('0xbd')),[_0x2252d8[_0xcc9a('0x5b')]['id'],JSON[_0xcc9a('0xb6')](_0x2252d8[_0xcc9a('0x31')]),JSON['stringify'](_0x53d2e7)]);_0x24d0f2['on'](_0xcc9a('0xb7'),function(){_0x2845c2=!![];return _0x29e056['status'](0xc8)[_0xcc9a('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x24d0f2['pid']});});_0x24d0f2['on'](_0xcc9a('0xba'),function(_0x16af58){if(_0x16af58&&!_0x2845c2){return _0x29e056['status'](0x1f4)[_0xcc9a('0x13')]({'message':'error\x20child\x20process','pid':_0x24d0f2[_0xcc9a('0xb9')]});}});})['catch'](handleError(_0x29e056,null));};exports[_0xcc9a('0xbe')]=function(_0x55045e,_0xc9336){var _0x202c31=['mail','chat',_0xcc9a('0xbf'),_0xcc9a('0xc0'),'fax',_0xcc9a('0xc1'),'voice'];var _0x5813c1={'offset':0x0,'order':qs[_0xcc9a('0x79')](_0xcc9a('0xc2'))},_0x425315={'count':0x0,'rows':[]};Promise[_0xcc9a('0xc3')]()['then'](function(){if(_0x55045e['query'][_0xcc9a('0xc4')]){if(!_[_0xcc9a('0xc5')](_0x202c31,_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc4')][_0xcc9a('0xc6')]())){throw new Error('Invalid\x20channel');}_0x202c31=[_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc4')][_0xcc9a('0xc6')]()];}if(_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]){try{var _0x4be9b5=JSON[_0xcc9a('0xaf')](_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]);if(!moment(_0x4be9b5[_0xcc9a('0x32')])[_0xcc9a('0xc8')]()){throw new Error(_0xcc9a('0xc9'));}if(!moment(_0x4be9b5['to'])[_0xcc9a('0xc8')]()){throw new Error(_0xcc9a('0xca'));}}catch(_0x36326e){throw new Error(_0xcc9a('0xcb'));}}if(!_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0x2e')](_0xcc9a('0x93'))){_0x5813c1['limit']=qs['limit'](_0x55045e[_0xcc9a('0x1e')]['limit']||0xa);_0x5813c1[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x55045e['query'][_0xcc9a('0xf')]);}var _0x37cb4b=_0x202c31[_0xcc9a('0x66')](function(_0x193812){if(_0x193812===_0xcc9a('0xcc')){var _0x2a566a={'attributes':['id',_0xcc9a('0xcd'),'type',_0xcc9a('0xce'),_0xcc9a('0xcf'),_0xcc9a('0xd0'),_0xcc9a('0xd1'),'endtime','duration','note','createdAt','userDisposition',_0xcc9a('0xd2'),_0xcc9a('0xd3'),_0xcc9a('0xd4')],'where':{'ContactId':_0x55045e[_0xcc9a('0x5b')]['id']},'include':[{'model':db[_0xcc9a('0xb1')],'as':_0xcc9a('0xb1'),'attributes':['id','name','fullname',_0xcc9a('0xd5')]}],'order':[[_0xcc9a('0xd6'),_0xcc9a('0xd7')]]};if(_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]){_0x2a566a[_0xcc9a('0x52')]['createdAt']={'$gte':_0x4be9b5[_0xcc9a('0x32')],'$lte':_0x4be9b5['to']};}return db[_0xcc9a('0x46')][_0xcc9a('0xd8')](_0x2a566a)[_0xcc9a('0x15')](function(_0x29d7b9){_0x425315[_0xcc9a('0x11')]+=_0x29d7b9[_0xcc9a('0x11')];return _[_0xcc9a('0x66')](_0x29d7b9[_0xcc9a('0x97')],function(_0x434a2f){var _0x3bde43=_0x434a2f['get']({'plain':!![]});_0x3bde43[_0xcc9a('0xc4')]=_0x193812;if(_0x3bde43[_0xcc9a('0xb1')]){_0x3bde43[_0xcc9a('0xb1')]={'id':_0x3bde43[_0xcc9a('0xb1')]['id'],'name':_0x3bde43['User'][_0xcc9a('0x1a')],'fullname':_0x3bde43[_0xcc9a('0xb1')][_0xcc9a('0xd9')],'alias':_0x3bde43[_0xcc9a('0xb1')][_0xcc9a('0xd5')]};}return _0x3bde43;});});}else{var _0x2b0eb1=_[_0xcc9a('0xda')](_0x193812)+(_0x193812===_0xcc9a('0xdb')?_0xcc9a('0xdc'):_0xcc9a('0xdd'));var _0x29ff69={'attributes':['id',_0xcc9a('0xde'),_0xcc9a('0xdf'),_0xcc9a('0xd6'),_0xcc9a('0xe0'),'disposition',_0xcc9a('0xe1'),'thirdDisposition','UserId',_0x2b0eb1+'Id'],'where':{'ContactId':_0x55045e[_0xcc9a('0x5b')]['id']},'include':[{'model':db[_0x2b0eb1],'as':_0xcc9a('0xdd'),'attributes':['id','name',_0xcc9a('0xe2')]},{'model':db[_0xcc9a('0xb1')],'as':_0xcc9a('0xe3'),'attributes':['id','name',_0xcc9a('0xd9')]},{'model':db['Tag'],'as':_0xcc9a('0x5c'),'attributes':['id',_0xcc9a('0x1a'),_0xcc9a('0xe4')],'through':{'attributes':[]}}],'order':[[_0xcc9a('0xd6'),_0xcc9a('0xd7')]]};if(_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]){_0x29ff69['where'][_0xcc9a('0xd6')]={'$gte':_0x4be9b5[_0xcc9a('0x32')],'$lte':_0x4be9b5['to']};}switch(_0x193812){case _0xcc9a('0xdb'):_0x29ff69[_0xcc9a('0x77')][_0xcc9a('0x54')](_0xcc9a('0xe5'),_0xcc9a('0xe6'),_0xcc9a('0xe7'),_0xcc9a('0xe8'),'osName',_0xcc9a('0xe9'),_0xcc9a('0xea'),_0xcc9a('0xeb'),_0xcc9a('0xec'));break;case'mail':_0x29ff69[_0xcc9a('0x77')][_0xcc9a('0x54')](_0xcc9a('0xed'),'substatus');break;case'openchannel':_0x29ff69['attributes'][_0xcc9a('0x54')]('externalUrl','threadId');break;}return db[_['startCase'](_0x193812)+_0xcc9a('0xee')]['findAndCountAll'](_0x29ff69)[_0xcc9a('0x15')](function(_0x155a5e){_0x425315[_0xcc9a('0x11')]+=_0x155a5e[_0xcc9a('0x11')];return _[_0xcc9a('0x66')](_0x155a5e[_0xcc9a('0x97')],function(_0x1e6f76){var _0x1bd33c=_0x1e6f76[_0xcc9a('0x33')]({'plain':!![]});_0x1bd33c[_0xcc9a('0xc4')]=_0x193812;if(_0x1bd33c[_0xcc9a('0xe3')]){_0x1bd33c['Owner']={'id':_0x1bd33c['Owner']['id'],'name':_0x1bd33c[_0xcc9a('0xe3')][_0xcc9a('0x1a')],'fullname':_0x1bd33c[_0xcc9a('0xe3')][_0xcc9a('0xd9')]};}return _0x1bd33c;});});}});return Promise[_0xcc9a('0x58')](_0x37cb4b);})[_0xcc9a('0x15')](function(_0x21878a){return _(_0x21878a)[_0xcc9a('0xef')]()[_0xcc9a('0xf0')](_0xcc9a('0xd6'))[_0xcc9a('0xf1')]()[_0xcc9a('0xf2')]();})[_0xcc9a('0x15')](function(_0x5da051){_0x425315[_0xcc9a('0x97')]=_0x5813c1[_0xcc9a('0x7d')]?_0x5da051[_0xcc9a('0xf3')](_0x5813c1[_0xcc9a('0xf')],_0x5813c1[_0xcc9a('0xf')]+_0x5813c1[_0xcc9a('0x7d')]):_0x5da051;return _0x425315;})[_0xcc9a('0x15')](respondWithFilteredResult(_0xc9336,_0x5813c1))['catch'](handleError(_0xc9336,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 9543d5e..1f8ee59 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc70=['setMaxListeners','save','update','remove','emit','hook','exports','events','CmContact'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xbc70,0xb2));var _0x0bc7=function(_0x56cfb4,_0x4ff0ae){_0x56cfb4=_0x56cfb4-0x0;var _0x1cb498=_0xbc70[_0x56cfb4];return _0x1cb498;};'use strict';var EventEmitter=require(_0x0bc7('0x0'));var CmContact=require('../../mysqldb')['db'][_0x0bc7('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0bc7('0x2')](0x0);var events={'afterCreate':_0x0bc7('0x3'),'afterUpdate':_0x0bc7('0x4'),'afterDestroy':_0x0bc7('0x5')};function emitEvent(_0x1868af){return function(_0xfad47e,_0x5d912d,_0x546e95){CmContactEvents[_0x0bc7('0x6')](_0x1868af+':'+_0xfad47e['id'],_0xfad47e);CmContactEvents[_0x0bc7('0x6')](_0x1868af,_0xfad47e);_0x546e95(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x0bc7('0x7')](e,emitEvent(event));}}module[_0x0bc7('0x8')]=CmContactEvents; \ No newline at end of file +var _0x1c52=['exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x409425,_0x3da267){var _0x5d46bf=function(_0x4b98af){while(--_0x4b98af){_0x409425['push'](_0x409425['shift']());}};_0x5d46bf(++_0x3da267);}(_0x1c52,0xa9));var _0x21c5=function(_0x2bebd4,_0x2f5ce7){_0x2bebd4=_0x2bebd4-0x0;var _0x8a9731=_0x1c52[_0x2bebd4];return _0x8a9731;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x21c5('0x0')](0x0);var events={'afterCreate':_0x21c5('0x1'),'afterUpdate':_0x21c5('0x2'),'afterDestroy':_0x21c5('0x3')};function emitEvent(_0x40db6b){return function(_0x31db26,_0x1795ee,_0x10995a){CmContactEvents[_0x21c5('0x4')](_0x40db6b+':'+_0x31db26['id'],_0x31db26);CmContactEvents['emit'](_0x40db6b,_0x31db26);_0x10995a(null);};}for(var e in events){if(events[_0x21c5('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x21c5('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index f62067b..f14f9cf 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ca=['then','utcOffset','add','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType','onlyIfOpen','VoiceQueue','findAll','outbound','CmList','Lists','all','map','BlackLists','CmHopperBlack','define','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','length','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','Campaign','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne'];(function(_0x339a46,_0x3bfc29){var _0x2514b9=function(_0x21345c){while(--_0x21345c){_0x339a46['push'](_0x339a46['shift']());}};_0x2514b9(++_0x3bfc29);}(_0x94ca,0xea));var _0xa94c=function(_0x2c2596,_0x26f279){_0x2c2596=_0x2c2596-0x0;var _0x269abc=_0x94ca[_0x2c2596];return _0x269abc;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var logger=require(_0xa94c('0x2'))(_0xa94c('0x3'));var moment=require('moment');var shared=require(_0xa94c('0x4'));var attributes=require(_0xa94c('0x5'));function getTimezoneCallbackAt(_0x27a010,_0x500a4d,_0x33a5b0,_0x175dba){var _0x49cf3e=_0x175dba?_0xa94c('0x6'):'VoiceQueue';var _0x275633=_0x33a5b0[_0xa94c('0x7')]?_0x33a5b0[_0xa94c('0x7')]:moment()[_0xa94c('0x8')](_0xa94c('0x9'));if(_[_0xa94c('0xa')](_0x33a5b0[_0xa94c('0xb')])){return Promise[_0xa94c('0xc')](_0x275633);}return _0x27a010[_0x49cf3e][_0xa94c('0xd')]({'where':{'id':_0x500a4d}})[_0xa94c('0xe')](function(_0x37e048){if(_[_0xa94c('0xa')](_0x37e048)||_[_0xa94c('0xa')](_0x37e048[_0xa94c('0xb')])){return Promise[_0xa94c('0xc')](_0x275633);}var _0x5be2bc=shared['timezones'];var _0x45556a=_0x5be2bc[_0x37e048['dialTimezone']];var _0x249d1e=_0x5be2bc[_0x33a5b0['dialTimezone']];if(_[_0xa94c('0xa')](_0x45556a)&&_[_0xa94c('0xa')](_0x249d1e)){return Promise[_0xa94c('0xc')](_0x275633);}var _0x4cfae6=_0x45556a[_0xa94c('0xf')]-_0x249d1e[_0xa94c('0xf')];var _0x4af9df=_0x33a5b0[_0xa94c('0x7')]?_0x33a5b0[_0xa94c('0x7')]:moment();_0x275633=moment(_0x4af9df)[_0xa94c('0x10')](_0x4cfae6,_0xa94c('0x11'))[_0xa94c('0x8')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0xa94c('0xc')](_0x275633);});}function getNewHopperPayload(_0x247346){return{'phone':_0x247346['phone'],'ContactId':_0x247346['id'],'ListId':_0x247346[_0xa94c('0x12')],'scheduledat':_0x247346['scheduledat']?_0x247346[_0xa94c('0x7')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x247346[_0xa94c('0x13')]?_0x247346[_0xa94c('0x13')]:0x2,'callback':_0x247346[_0xa94c('0x14')]?!![]:![],'callbackuniqueid':_0x247346[_0xa94c('0x14')]?_0x247346[_0xa94c('0x14')]:undefined,'callbackat':_0x247346[_0xa94c('0x14')]?moment()[_0xa94c('0x8')](_0xa94c('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x247343,_0x2d401b,_0x1a2935,_0x24d999){var _0x4ba275={'phone':_0x1a2935['phone']};var _0x26dff={'calleridnum':_0x1a2935[_0xa94c('0x15')]};if(_0x24d999){Object['assign'](_0x4ba275,{'CampaignId':_0x2d401b['id']});Object['assign'](_0x26dff,{'CampaignId':_0x2d401b['id']});}else{Object[_0xa94c('0x16')](_0x4ba275,{'VoiceQueueId':_0x2d401b['id']});Object[_0xa94c('0x16')](_0x26dff,{'VoiceQueueId':_0x2d401b['id']});}return _0x247343[_0xa94c('0x17')]['findOne']({'where':_0x4ba275})[_0xa94c('0xe')](function(_0x4e17a8){if(_0x4e17a8){throw new Error(_0xa94c('0x18')+_0x1a2935[_0xa94c('0x15')]+_0xa94c('0x19')+_0x2d401b['id']);}return _0x247343['CmHopperFinal'][_0xa94c('0xd')]({'where':_0x26dff});})[_0xa94c('0xe')](function(_0xd91639){if(_0xd91639){throw new Error(_0xa94c('0x1a')+_0x1a2935[_0xa94c('0x15')]+_0xa94c('0x19')+_0x2d401b['id']);}var _0x1d279e=getNewHopperPayload(_0x1a2935);if(_0x24d999){_0x1d279e['CampaignId']=_0x2d401b['id'];}else{_0x1d279e[_0xa94c('0x1b')]=_0x2d401b['id'];}return _0x247343['CmHopper']['create'](_0x1d279e);});}function handleOnlyIfOpenCheckDuplicate(_0x37623f,_0x2680cf,_0x21b597,_0x4befa9){var _0x402eb5={'phone':_0x21b597['phone']};if(_0x4befa9){Object[_0xa94c('0x16')](_0x402eb5,{'CampaignId':_0x2680cf['id']});}else{Object[_0xa94c('0x16')](_0x402eb5,{'VoiceQueueId':_0x2680cf['id']});}return _0x37623f[_0xa94c('0x17')][_0xa94c('0xd')]({'where':_0x402eb5})['then'](function(_0x4c15b1){if(_0x4c15b1){throw new Error(_0xa94c('0x1c')+_0x21b597[_0xa94c('0x15')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x2680cf['id']);}var _0x512467=getNewHopperPayload(_0x21b597);if(_0x4befa9){_0x512467['CampaignId']=_0x2680cf['id'];}else{_0x512467[_0xa94c('0x1b')]=_0x2680cf['id'];}return _0x37623f[_0xa94c('0x17')][_0xa94c('0x1d')](_0x512467);});}function handleNeverCheckDuplicate(_0x2fe799,_0x930d9c,_0x258fe9){var _0x19225a=getNewHopperPayload(_0x258fe9);_0x19225a['VoiceQueueId']=_0x930d9c['id'];return _0x2fe799[_0xa94c('0x17')][_0xa94c('0x1d')](_0x19225a);}function handleCheckDuplicate(_0x55df44,_0x1f3d22,_0x573900,_0xc56575){return getTimezoneCallbackAt(_0x55df44,_0x1f3d22,_0x573900,_0xc56575)['then'](function(_0x2745b6){_0x573900['scheduledat']=_0x2745b6;switch(_0x1f3d22[_0xa94c('0x1e')]){case'always':return handleAlwaysCheckDuplicate(_0x55df44,_0x1f3d22,_0x573900,_0xc56575);case _0xa94c('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x55df44,_0x1f3d22,_0x573900,_0xc56575);default:return handleNeverCheckDuplicate(_0x55df44,_0x1f3d22,_0x573900);}});}function createHopperForVoiceQueues(_0x3fc4fe,_0x4511e8){return _0x3fc4fe[_0xa94c('0x20')][_0xa94c('0x21')]({'where':{'type':_0xa94c('0x22')},'attributes':['id',_0xa94c('0x1e'),_0xa94c('0xb')],'include':[{'model':_0x3fc4fe[_0xa94c('0x23')],'as':_0xa94c('0x24'),'where':{'id':_0x4511e8[_0xa94c('0x12')]}}],'raw':!![]})[_0xa94c('0xe')](function(_0x162c5e){var _0x49d018=_0x162c5e['map'](function(_0x10ea00){return handleCheckDuplicate(_0x3fc4fe,_0x10ea00,_0x4511e8,![]);});return Promise[_0xa94c('0x25')](_0x49d018);});}function createHopperForCampaigns(_0x54a871,_0xdbc593){return _0x54a871[_0xa94c('0x6')]['findAll']({'attributes':['id',_0xa94c('0x1e'),'dialTimezone'],'include':[{'model':_0x54a871[_0xa94c('0x23')],'as':_0xa94c('0x24'),'where':{'id':_0xdbc593['ListId']}}],'raw':!![]})['then'](function(_0x54d7cb){var _0x215f6c=_0x54d7cb[_0xa94c('0x26')](function(_0x386832){return handleCheckDuplicate(_0x54a871,_0x386832,_0xdbc593,!![]);});return Promise[_0xa94c('0x25')](_0x215f6c);});}function createHopperBlackForVoiceQueues(_0x6fcad8,_0x565ca6){return _0x6fcad8[_0xa94c('0x20')][_0xa94c('0x21')]({'where':{'type':_0xa94c('0x22')},'attributes':['id'],'include':[{'model':_0x6fcad8['CmList'],'as':_0xa94c('0x27'),'where':{'id':_0x565ca6[_0xa94c('0x12')]}}],'raw':!![]})[_0xa94c('0xe')](function(_0x3b85aa){var _0x3b0a94=_0x3b85aa[_0xa94c('0x26')](function(_0x422c7b){return _0x6fcad8[_0xa94c('0x28')][_0xa94c('0x1d')]({'phone':_0x565ca6[_0xa94c('0x15')],'ContactId':_0x565ca6['id'],'ListId':_0x565ca6[_0xa94c('0x12')],'VoiceQueueId':_0x422c7b['id']});});return Promise['all'](_0x3b0a94);});}function createHopperBlackForCampaigns(_0x1d33d7,_0x1264a8){return _0x1d33d7['Campaign'][_0xa94c('0x21')]({'attributes':['id'],'include':[{'model':_0x1d33d7[_0xa94c('0x23')],'as':_0xa94c('0x27'),'where':{'id':_0x1264a8['ListId']}}],'raw':!![]})[_0xa94c('0xe')](function(_0x3c9584){var _0x52866f=_0x3c9584[_0xa94c('0x26')](function(_0x5469ad){return _0x1d33d7['CmHopperBlack'][_0xa94c('0x1d')]({'phone':_0x1264a8[_0xa94c('0x15')],'ContactId':_0x1264a8['id'],'ListId':_0x1264a8['ListId'],'CampaignId':_0x5469ad['id']});});return Promise[_0xa94c('0x25')](_0x52866f);});}module['exports']=function(_0x505a89){return _0x505a89[_0xa94c('0x29')](_0xa94c('0x2a'),attributes,{'tableName':_0xa94c('0x2b'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xa94c('0x15')]},{'name':_0xa94c('0x2c'),'fields':[_0xa94c('0x2d'),'lastName','phone',_0xa94c('0x2e'),_0xa94c('0x2f'),_0xa94c('0x30')],'type':_0xa94c('0x31')}],'timestamps':!![],'charset':_0xa94c('0x32'),'collate':_0xa94c('0x33'),'hooks':{'afterCreate':function(_0x17b1d1,_0x43e166,_0x208413){var _0x1b344b=_0x505a89['models'];var _0x3f85ec=_0x17b1d1[_0xa94c('0x34')]({'plain':!![]});if(!_0x3f85ec['ListId']){logger[_0xa94c('0x35')](_0xa94c('0x36')+_0x3f85ec['id']);return _0x208413();}if(!_0x3f85ec[_0xa94c('0x15')]){return _0x208413();}return createHopperForVoiceQueues(_0x1b344b,_0x3f85ec)['then'](function(){return createHopperBlackForVoiceQueues(_0x1b344b,_0x3f85ec);})[_0xa94c('0xe')](function(){return createHopperForCampaigns(_0x1b344b,_0x3f85ec);})['then'](function(){return createHopperBlackForCampaigns(_0x1b344b,_0x3f85ec);})[_0xa94c('0xe')](function(){return _0x208413();})[_0xa94c('0x37')](function(_0xdfdd3f){logger[_0xa94c('0x35')]('[cmContact][afterCreate]',_0xdfdd3f['message']);_0x208413();});},'afterDestroy':function(_0x5d6178,_0x206672,_0x23c940){var _0x4d2844=_0x505a89['models'];var _0x1ccd5f=_0x5d6178[_0xa94c('0x34')]({'plain':!![]});return _0x4d2844['CmHopper'][_0xa94c('0x21')]({'raw':!![],'where':{'ListId':_0x1ccd5f['ListId'],'ContactId':_0x1ccd5f['id']}})[_0xa94c('0xe')](function(_0x2b8738){if(!_['isEmpty'](_0x2b8738)){var _0x3cd6a5=[];for(var _0x3c118f=0x0;_0x3c118f<_0x2b8738[_0xa94c('0x38')];_0x3c118f+=0x1){var _0x3714d3=_0x4d2844[_0xa94c('0x17')]['destroy']({'where':{'ListId':_0x2b8738[_0x3c118f][_0xa94c('0x12')],'ContactId':_0x2b8738[_0x3c118f]['ContactId'],'VoiceQueueId':_0x2b8738[_0x3c118f]['VoiceQueueId'],'CampaignId':_0x2b8738[_0x3c118f]['CampaignId']}});_0x3cd6a5[_0xa94c('0x39')](_0x3714d3);}return Promise[_0xa94c('0x25')](_0x3cd6a5);}})[_0xa94c('0xe')](function(_0x4803df){logger[_0xa94c('0x3a')](_0xa94c('0x3b'),util['inspect'](_0x4803df,{'showHidden':![],'depth':null}));_0x23c940();})[_0xa94c('0x37')](function(_0x591a11){logger[_0xa94c('0x35')](_0xa94c('0x3c'),util[_0xa94c('0x3d')](_0x591a11,{'showHidden':![],'depth':null}));_0x23c940(_0x591a11);});}}});}; \ No newline at end of file +var _0x3b9c=['utf8mb4','utf8mb4_unicode_ci','models','get','catch','error','message','destroy','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','dialTimezone','resolve','then','isNil','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','priority','callbackUniqueid','phone','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','onlyIfOpen','findAll','outbound','dialCheckDuplicateType','CmList','Lists','map','all','BlackLists','CmHopperBlack','define','CmContact','cm_contacts','fti_cm_contacts','firstName','fax','email'];(function(_0x563182,_0xc17861){var _0x2003ce=function(_0x2495a6){while(--_0x2495a6){_0x563182['push'](_0x563182['shift']());}};_0x2003ce(++_0xc17861);}(_0x3b9c,0x1bf));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3b9('0x0'));var util=require('util');var logger=require(_0xc3b9('0x1'))(_0xc3b9('0x2'));var moment=require(_0xc3b9('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0xc3b9('0x4'));function getTimezoneCallbackAt(_0x4a87e6,_0x58add4,_0x3dea01,_0x57f3ca){var _0x33d027=_0x57f3ca?_0xc3b9('0x5'):_0xc3b9('0x6');var _0x2877b6=_0x3dea01[_0xc3b9('0x7')]?_0x3dea01[_0xc3b9('0x7')]:moment()[_0xc3b9('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_['isNil'](_0x3dea01[_0xc3b9('0x9')])){return Promise[_0xc3b9('0xa')](_0x2877b6);}return _0x4a87e6[_0x33d027]['findOne']({'where':{'id':_0x58add4}})[_0xc3b9('0xb')](function(_0x3a76be){if(_['isNil'](_0x3a76be)||_[_0xc3b9('0xc')](_0x3a76be[_0xc3b9('0x9')])){return Promise['resolve'](_0x2877b6);}var _0x3ae9c4=shared[_0xc3b9('0xd')];var _0x302599=_0x3ae9c4[_0x3a76be[_0xc3b9('0x9')]];var _0x267c9f=_0x3ae9c4[_0x3dea01[_0xc3b9('0x9')]];if(_['isNil'](_0x302599)&&_[_0xc3b9('0xc')](_0x267c9f)){return Promise[_0xc3b9('0xa')](_0x2877b6);}var _0x29e130=_0x302599['utcOffset']-_0x267c9f[_0xc3b9('0xe')];var _0x2ec551=_0x3dea01[_0xc3b9('0x7')]?_0x3dea01[_0xc3b9('0x7')]:moment();_0x2877b6=moment(_0x2ec551)['add'](_0x29e130,_0xc3b9('0xf'))[_0xc3b9('0x8')](_0xc3b9('0x10'));return Promise[_0xc3b9('0xa')](_0x2877b6);});}function getNewHopperPayload(_0x36899d){return{'phone':_0x36899d['phone'],'ContactId':_0x36899d['id'],'ListId':_0x36899d[_0xc3b9('0x11')],'scheduledat':_0x36899d[_0xc3b9('0x7')]?_0x36899d[_0xc3b9('0x7')]:moment()[_0xc3b9('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x36899d['priority']?_0x36899d[_0xc3b9('0x12')]:0x2,'callback':_0x36899d[_0xc3b9('0x13')]?!![]:![],'callbackuniqueid':_0x36899d[_0xc3b9('0x13')]?_0x36899d[_0xc3b9('0x13')]:undefined,'callbackat':_0x36899d[_0xc3b9('0x13')]?moment()[_0xc3b9('0x8')](_0xc3b9('0x10')):undefined};}function handleAlwaysCheckDuplicate(_0xbbaf59,_0x4f650c,_0xead53f,_0x10e605){var _0x219384={'phone':_0xead53f[_0xc3b9('0x14')]};var _0x54aed6={'calleridnum':_0xead53f[_0xc3b9('0x14')]};if(_0x10e605){Object[_0xc3b9('0x15')](_0x219384,{'CampaignId':_0x4f650c['id']});Object['assign'](_0x54aed6,{'CampaignId':_0x4f650c['id']});}else{Object['assign'](_0x219384,{'VoiceQueueId':_0x4f650c['id']});Object['assign'](_0x54aed6,{'VoiceQueueId':_0x4f650c['id']});}return _0xbbaf59[_0xc3b9('0x16')][_0xc3b9('0x17')]({'where':_0x219384})['then'](function(_0x22e470){if(_0x22e470){throw new Error(_0xc3b9('0x18')+_0xead53f['phone']+_0xc3b9('0x19')+_0x4f650c['id']);}return _0xbbaf59[_0xc3b9('0x1a')][_0xc3b9('0x17')]({'where':_0x54aed6});})[_0xc3b9('0xb')](function(_0x3e7f78){if(_0x3e7f78){throw new Error(_0xc3b9('0x1b')+_0xead53f[_0xc3b9('0x14')]+_0xc3b9('0x19')+_0x4f650c['id']);}var _0x17ba35=getNewHopperPayload(_0xead53f);if(_0x10e605){_0x17ba35[_0xc3b9('0x1c')]=_0x4f650c['id'];}else{_0x17ba35['VoiceQueueId']=_0x4f650c['id'];}return _0xbbaf59['CmHopper'][_0xc3b9('0x1d')](_0x17ba35);});}function handleOnlyIfOpenCheckDuplicate(_0x31735b,_0x5cf4ef,_0x1d93d6,_0x58e573){var _0x55d7d8={'phone':_0x1d93d6[_0xc3b9('0x14')]};if(_0x58e573){Object[_0xc3b9('0x15')](_0x55d7d8,{'CampaignId':_0x5cf4ef['id']});}else{Object[_0xc3b9('0x15')](_0x55d7d8,{'VoiceQueueId':_0x5cf4ef['id']});}return _0x31735b['CmHopper'][_0xc3b9('0x17')]({'where':_0x55d7d8})[_0xc3b9('0xb')](function(_0x37965e){if(_0x37965e){throw new Error(_0xc3b9('0x1e')+_0x1d93d6['phone']+_0xc3b9('0x19')+_0x5cf4ef['id']);}var _0x30833d=getNewHopperPayload(_0x1d93d6);if(_0x58e573){_0x30833d['CampaignId']=_0x5cf4ef['id'];}else{_0x30833d[_0xc3b9('0x1f')]=_0x5cf4ef['id'];}return _0x31735b[_0xc3b9('0x16')]['create'](_0x30833d);});}function handleNeverCheckDuplicate(_0x231ea1,_0x5db624,_0x320f6a){var _0x4b193f=getNewHopperPayload(_0x320f6a);_0x4b193f[_0xc3b9('0x1f')]=_0x5db624['id'];return _0x231ea1['CmHopper'][_0xc3b9('0x1d')](_0x4b193f);}function handleCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa){return getTimezoneCallbackAt(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa)[_0xc3b9('0xb')](function(_0x179503){_0x2e980f[_0xc3b9('0x7')]=_0x179503;switch(_0x231bc4['dialCheckDuplicateType']){case'always':return handleAlwaysCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa);case _0xc3b9('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa);default:return handleNeverCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f);}});}function createHopperForVoiceQueues(_0x87daff,_0x5885e9){return _0x87daff[_0xc3b9('0x6')][_0xc3b9('0x21')]({'where':{'type':_0xc3b9('0x22')},'attributes':['id',_0xc3b9('0x23'),_0xc3b9('0x9')],'include':[{'model':_0x87daff[_0xc3b9('0x24')],'as':_0xc3b9('0x25'),'where':{'id':_0x5885e9[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x5eb7ff){var _0x282cf8=_0x5eb7ff[_0xc3b9('0x26')](function(_0x5ea0a6){return handleCheckDuplicate(_0x87daff,_0x5ea0a6,_0x5885e9,![]);});return Promise[_0xc3b9('0x27')](_0x282cf8);});}function createHopperForCampaigns(_0x39f6a8,_0x3c5bb8){return _0x39f6a8['Campaign'][_0xc3b9('0x21')]({'attributes':['id',_0xc3b9('0x23'),_0xc3b9('0x9')],'include':[{'model':_0x39f6a8[_0xc3b9('0x24')],'as':_0xc3b9('0x25'),'where':{'id':_0x3c5bb8[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x27bd9){var _0x32aa9c=_0x27bd9[_0xc3b9('0x26')](function(_0x7b0a9){return handleCheckDuplicate(_0x39f6a8,_0x7b0a9,_0x3c5bb8,!![]);});return Promise['all'](_0x32aa9c);});}function createHopperBlackForVoiceQueues(_0x2ce3bb,_0x577439){return _0x2ce3bb[_0xc3b9('0x6')][_0xc3b9('0x21')]({'where':{'type':_0xc3b9('0x22')},'attributes':['id'],'include':[{'model':_0x2ce3bb['CmList'],'as':_0xc3b9('0x28'),'where':{'id':_0x577439[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x44ea43){var _0x38e312=_0x44ea43[_0xc3b9('0x26')](function(_0x37d7ab){return _0x2ce3bb[_0xc3b9('0x29')][_0xc3b9('0x1d')]({'phone':_0x577439[_0xc3b9('0x14')],'ContactId':_0x577439['id'],'ListId':_0x577439[_0xc3b9('0x11')],'VoiceQueueId':_0x37d7ab['id']});});return Promise['all'](_0x38e312);});}function createHopperBlackForCampaigns(_0x15c5cf,_0xa0de27){return _0x15c5cf[_0xc3b9('0x5')][_0xc3b9('0x21')]({'attributes':['id'],'include':[{'model':_0x15c5cf[_0xc3b9('0x24')],'as':'BlackLists','where':{'id':_0xa0de27[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x302b8f){var _0x3b2d6f=_0x302b8f['map'](function(_0x3b496f){return _0x15c5cf[_0xc3b9('0x29')][_0xc3b9('0x1d')]({'phone':_0xa0de27[_0xc3b9('0x14')],'ContactId':_0xa0de27['id'],'ListId':_0xa0de27[_0xc3b9('0x11')],'CampaignId':_0x3b496f['id']});});return Promise[_0xc3b9('0x27')](_0x3b2d6f);});}module['exports']=function(_0x21015f){return _0x21015f[_0xc3b9('0x2a')](_0xc3b9('0x2b'),attributes,{'tableName':_0xc3b9('0x2c'),'paranoid':!![],'indexes':[{'name':_0xc3b9('0x14'),'fields':[_0xc3b9('0x14')]},{'name':_0xc3b9('0x2d'),'fields':[_0xc3b9('0x2e'),'lastName','phone','mobile',_0xc3b9('0x2f'),_0xc3b9('0x30')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xc3b9('0x31'),'collate':_0xc3b9('0x32'),'hooks':{'afterCreate':function(_0x189eaa,_0xbd0074,_0x5ee428){var _0xf5056a=_0x21015f[_0xc3b9('0x33')];var _0x43d315=_0x189eaa[_0xc3b9('0x34')]({'plain':!![]});if(!_0x43d315[_0xc3b9('0x11')]){logger['error']('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x43d315['id']);return _0x5ee428();}if(!_0x43d315[_0xc3b9('0x14')]){return _0x5ee428();}return createHopperForVoiceQueues(_0xf5056a,_0x43d315)[_0xc3b9('0xb')](function(){return createHopperBlackForVoiceQueues(_0xf5056a,_0x43d315);})[_0xc3b9('0xb')](function(){return createHopperForCampaigns(_0xf5056a,_0x43d315);})[_0xc3b9('0xb')](function(){return createHopperBlackForCampaigns(_0xf5056a,_0x43d315);})[_0xc3b9('0xb')](function(){return _0x5ee428();})[_0xc3b9('0x35')](function(_0x187edb){logger[_0xc3b9('0x36')]('[cmContact][afterCreate]',_0x187edb[_0xc3b9('0x37')]);_0x5ee428();});},'afterDestroy':function(_0x54339a,_0xf9e012,_0x1e1bd8){var _0x2c19a2=_0x21015f[_0xc3b9('0x33')];var _0x2e350b=_0x54339a[_0xc3b9('0x34')]({'plain':!![]});return _0x2c19a2[_0xc3b9('0x16')][_0xc3b9('0x21')]({'raw':!![],'where':{'ListId':_0x2e350b['ListId'],'ContactId':_0x2e350b['id']}})['then'](function(_0x4f6689){if(!_['isEmpty'](_0x4f6689)){var _0x518051=[];for(var _0x2e0904=0x0;_0x2e0904<_0x4f6689['length'];_0x2e0904+=0x1){var _0x3fb3a1=_0x2c19a2['CmHopper'][_0xc3b9('0x38')]({'where':{'ListId':_0x4f6689[_0x2e0904]['ListId'],'ContactId':_0x4f6689[_0x2e0904]['ContactId'],'VoiceQueueId':_0x4f6689[_0x2e0904]['VoiceQueueId'],'CampaignId':_0x4f6689[_0x2e0904][_0xc3b9('0x1c')]}});_0x518051[_0xc3b9('0x39')](_0x3fb3a1);}return Promise[_0xc3b9('0x27')](_0x518051);}})['then'](function(_0x2fe7bd){logger[_0xc3b9('0x3a')](_0xc3b9('0x3b'),util[_0xc3b9('0x3c')](_0x2fe7bd,{'showHidden':![],'depth':null}));_0x1e1bd8();})[_0xc3b9('0x35')](function(_0x2708de){logger[_0xc3b9('0x36')](_0xc3b9('0x3d'),util['inspect'](_0x2708de,{'showHidden':![],'depth':null}));_0x1e1bd8(_0x2708de);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index de479ec..84b99a3 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x115356,_0x3b26dc){var _0x5672c1=function(_0x271d21){while(--_0x271d21){_0x115356['push'](_0x115356['shift']());}};_0x5672c1(++_0x3b26dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 52c5495..f03ce35 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae79=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x67fdbf,_0xc3c2f3){var _0x3e8004=function(_0x5ee7bb){while(--_0x5ee7bb){_0x67fdbf['push'](_0x67fdbf['shift']());}};_0x3e8004(++_0xc3c2f3);}(_0xae79,0x1d3));var _0x9ae7=function(_0x1db2d6,_0xde9cd9){_0x1db2d6=_0x1db2d6-0x0;var _0x3a771c=_0xae79[_0x1db2d6];return _0x3a771c;};'use strict';var Sequelize=require(_0x9ae7('0x0'));module[_0x9ae7('0x1')]={'CmContactId':{'type':Sequelize[_0x9ae7('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x9ae7('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9ae7('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9ae7('0x3')],'defaultValue':_0x9ae7('0x4')},'OrderBy':{'type':Sequelize[_0x9ae7('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x9ae7('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x68fc=['STRING','sequelize','exports','INTEGER'];(function(_0x5af464,_0x24b35f){var _0x58375a=function(_0x5e6324){while(--_0x5e6324){_0x5af464['push'](_0x5af464['shift']());}};_0x58375a(++_0x24b35f);}(_0x68fc,0xa5));var _0xc68f=function(_0x2b049b,_0x250f3a){_0x2b049b=_0x2b049b-0x0;var _0x29bbeb=_0x68fc[_0x2b049b];return _0x29bbeb;};'use strict';var Sequelize=require(_0xc68f('0x0'));module[_0xc68f('0x1')]={'CmContactId':{'type':Sequelize[_0xc68f('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc68f('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc68f('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 6d179be..e55ca40 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b51=['ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x4aa429,_0x509a5a){var _0x1046a1=function(_0x3037d2){while(--_0x3037d2){_0x4aa429['push'](_0x4aa429['shift']());}};_0x1046a1(++_0x509a5a);}(_0x9b51,0x1f3));var _0x19b5=function(_0x394be4,_0x56ca61){_0x394be4=_0x394be4-0x0;var _0x30218e=_0x9b51[_0x394be4];return _0x30218e;};'use strict';var emlformat=require(_0x19b5('0x0'));var rimraf=require(_0x19b5('0x1'));var zipdir=require(_0x19b5('0x2'));var jsonpatch=require(_0x19b5('0x3'));var rp=require(_0x19b5('0x4'));var moment=require(_0x19b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x19b5('0x6'));var util=require(_0x19b5('0x7'));var path=require(_0x19b5('0x8'));var sox=require(_0x19b5('0x9'));var csv=require(_0x19b5('0xa'));var ejs=require(_0x19b5('0xb'));var fs=require('fs');var fs_extra=require(_0x19b5('0xc'));var _=require(_0x19b5('0xd'));var squel=require('squel');var crypto=require(_0x19b5('0xe'));var jsforce=require(_0x19b5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x19b5('0xa'));var querystring=require('querystring');var Papa=require(_0x19b5('0x10'));var Redis=require(_0x19b5('0x11'));var authService=require(_0x19b5('0x12'));var qs=require(_0x19b5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19b5('0x14'));var logger=require(_0x19b5('0x15'))('api');var utils=require(_0x19b5('0x16'));var config=require(_0x19b5('0x17'));var licenseUtil=require(_0x19b5('0x18'));var db=require(_0x19b5('0x19'))['db'];function respondWithStatusCode(_0x565a74,_0x2788d5){_0x2788d5=_0x2788d5||0xcc;return function(_0x318696){if(_0x318696){return _0x565a74['sendStatus'](_0x2788d5);}return _0x565a74[_0x19b5('0x1a')](_0x2788d5)[_0x19b5('0x1b')]();};}function respondWithResult(_0x1a583d,_0x3633f0){_0x3633f0=_0x3633f0||0xc8;return function(_0x45fea5){if(_0x45fea5){return _0x1a583d[_0x19b5('0x1a')](_0x3633f0)[_0x19b5('0x1c')](_0x45fea5);}};}function respondWithFilteredResult(_0x22c88e,_0xfec855){return function(_0xb88f88){if(_0xb88f88){var _0x37a867=typeof _0xfec855[_0x19b5('0x1d')]==='undefined'&&typeof _0xfec855[_0x19b5('0x1e')]===_0x19b5('0x1f');var _0x38c06a=_0xb88f88[_0x19b5('0x20')];var _0x55f09d=_0x37a867?0x0:_0xfec855['offset'];var _0x3a8d2e=_0x37a867?_0xb88f88['count']:_0xfec855[_0x19b5('0x1d')]+_0xfec855['limit'];var _0x18f0a8;if(_0x3a8d2e>=_0x38c06a){_0x3a8d2e=_0x38c06a;_0x18f0a8=0xc8;}else{_0x18f0a8=0xce;}_0x22c88e[_0x19b5('0x1a')](_0x18f0a8);return _0x22c88e[_0x19b5('0x21')](_0x19b5('0x22'),_0x55f09d+'-'+_0x3a8d2e+'/'+_0x38c06a)[_0x19b5('0x1c')](_0xb88f88);}return null;};}function patchUpdates(_0xda9b51){return function(_0x4dd773){try{jsonpatch['apply'](_0x4dd773,_0xda9b51,!![]);}catch(_0x88edb1){return BPromise[_0x19b5('0x23')](_0x88edb1);}return _0x4dd773['save']();};}function saveUpdates(_0x8b537,_0x285e32){return function(_0x57f54a){if(_0x57f54a){return _0x57f54a[_0x19b5('0x24')](_0x8b537)[_0x19b5('0x25')](function(_0x3ea59e){return _0x3ea59e;});}return null;};}function removeEntity(_0x239b34,_0x1ae9fb){return function(_0x825e3f){if(_0x825e3f){return _0x825e3f[_0x19b5('0x26')]()[_0x19b5('0x25')](function(){var _0x27de8b=_0x825e3f[_0x19b5('0x27')]({'plain':!![]});var _0x304061='CmContactHasItems';return db[_0x19b5('0x28')][_0x19b5('0x26')]({'where':{'type':_0x304061,'resourceId':_0x27de8b['id']}})[_0x19b5('0x25')](function(){return _0x825e3f;});})['then'](function(){_0x239b34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56157b,_0x50272b){return function(_0x2cdfc5){if(!_0x2cdfc5){_0x56157b[_0x19b5('0x29')](0x194);}return _0x2cdfc5;};}function handleError(_0x4fe4d8,_0x1244ec){_0x1244ec=_0x1244ec||0x1f4;return function(_0x4e180b){logger[_0x19b5('0x2a')](_0x4e180b[_0x19b5('0x2b')]);if(_0x4e180b[_0x19b5('0x2c')]){delete _0x4e180b[_0x19b5('0x2c')];}_0x4fe4d8[_0x19b5('0x1a')](_0x1244ec)['send'](_0x4e180b);};}exports[_0x19b5('0x2d')]=function(_0x23471,_0x4aef15){var _0x1a6d77={},_0x3562ee={},_0x32e74b={'count':0x0,'rows':[]};var _0x4ecb62=_[_0x19b5('0x2e')](db[_0x19b5('0x2f')][_0x19b5('0x30')],function(_0x3e23b0){return{'name':_0x3e23b0[_0x19b5('0x31')],'type':_0x3e23b0[_0x19b5('0x32')][_0x19b5('0x33')]};});_0x3562ee[_0x19b5('0x34')]=_['map'](_0x4ecb62,'name');_0x3562ee[_0x19b5('0x35')]=_['keys'](_0x23471[_0x19b5('0x35')]);_0x3562ee[_0x19b5('0x36')]=_[_0x19b5('0x37')](_0x3562ee[_0x19b5('0x34')],_0x3562ee[_0x19b5('0x35')]);_0x1a6d77['attributes']=_[_0x19b5('0x37')](_0x3562ee[_0x19b5('0x34')],qs[_0x19b5('0x38')](_0x23471['query']['fields']));_0x1a6d77['attributes']=_0x1a6d77[_0x19b5('0x39')][_0x19b5('0x3a')]?_0x1a6d77['attributes']:_0x3562ee[_0x19b5('0x34')];if(!_0x23471[_0x19b5('0x35')][_0x19b5('0x3b')](_0x19b5('0x3c'))){_0x1a6d77[_0x19b5('0x1e')]=qs['limit'](_0x23471[_0x19b5('0x35')][_0x19b5('0x1e')]);_0x1a6d77['offset']=qs[_0x19b5('0x1d')](_0x23471[_0x19b5('0x35')]['offset']);}_0x1a6d77[_0x19b5('0x3d')]=qs[_0x19b5('0x3e')](_0x23471[_0x19b5('0x35')][_0x19b5('0x3e')]);_0x1a6d77[_0x19b5('0x3f')]=qs[_0x19b5('0x36')](_['pick'](_0x23471[_0x19b5('0x35')],_0x3562ee[_0x19b5('0x36')]),_0x4ecb62);if(_0x23471[_0x19b5('0x35')][_0x19b5('0x40')]){_0x1a6d77[_0x19b5('0x3f')]=_[_0x19b5('0x41')](_0x1a6d77[_0x19b5('0x3f')],{'$or':_[_0x19b5('0x2e')](_0x4ecb62,function(_0x31fb05){if(_0x31fb05[_0x19b5('0x32')]!==_0x19b5('0x42')){var _0x43538c={};_0x43538c[_0x31fb05[_0x19b5('0x2c')]]={'$like':'%'+_0x23471[_0x19b5('0x35')][_0x19b5('0x40')]+'%'};return _0x43538c;}})});}_0x1a6d77=_[_0x19b5('0x41')]({},_0x1a6d77,_0x23471[_0x19b5('0x43')]);var _0x1f11e0={'where':_0x1a6d77['where']};return db['CmContactHasItem'][_0x19b5('0x20')](_0x1f11e0)['then'](function(_0x106ba7){_0x32e74b[_0x19b5('0x20')]=_0x106ba7;if(_0x23471['query']['includeAll']){_0x1a6d77[_0x19b5('0x44')]=[{'all':!![]}];}return db[_0x19b5('0x2f')][_0x19b5('0x45')](_0x1a6d77);})['then'](function(_0x119e0f){_0x32e74b[_0x19b5('0x46')]=_0x119e0f;return _0x32e74b;})['then'](respondWithFilteredResult(_0x4aef15,_0x1a6d77))[_0x19b5('0x47')](handleError(_0x4aef15,null));};exports[_0x19b5('0x48')]=function(_0x1e53bc,_0x497718){var _0x2c22e3={'raw':!![],'where':{'id':_0x1e53bc[_0x19b5('0x49')]['id']}},_0x2bcbf0={};_0x2bcbf0[_0x19b5('0x34')]=_[_0x19b5('0x4a')](db[_0x19b5('0x2f')][_0x19b5('0x30')]);_0x2bcbf0[_0x19b5('0x35')]=_[_0x19b5('0x4a')](_0x1e53bc[_0x19b5('0x35')]);_0x2bcbf0[_0x19b5('0x36')]=_['intersection'](_0x2bcbf0[_0x19b5('0x34')],_0x2bcbf0['query']);_0x2c22e3[_0x19b5('0x39')]=_[_0x19b5('0x37')](_0x2bcbf0[_0x19b5('0x34')],qs[_0x19b5('0x38')](_0x1e53bc['query'][_0x19b5('0x38')]));_0x2c22e3[_0x19b5('0x39')]=_0x2c22e3[_0x19b5('0x39')][_0x19b5('0x3a')]?_0x2c22e3[_0x19b5('0x39')]:_0x2bcbf0['model'];if(_0x1e53bc['query'][_0x19b5('0x4b')]){_0x2c22e3[_0x19b5('0x44')]=[{'all':!![]}];}_0x2c22e3=_[_0x19b5('0x41')]({},_0x2c22e3,_0x1e53bc[_0x19b5('0x43')]);return db[_0x19b5('0x2f')][_0x19b5('0x4c')](_0x2c22e3)[_0x19b5('0x25')](handleEntityNotFound(_0x497718,null))[_0x19b5('0x25')](respondWithResult(_0x497718,null))[_0x19b5('0x47')](handleError(_0x497718,null));};exports[_0x19b5('0x4d')]=function(_0xcea1fe,_0x179707){return db[_0x19b5('0x2f')]['create'](_0xcea1fe[_0x19b5('0x4e')],{})[_0x19b5('0x25')](function(_0x2ee960){var _0x29ad07=_0xcea1fe[_0x19b5('0x4f')][_0x19b5('0x27')]({'plain':!![]});if(!_0x29ad07)throw new Error(_0x19b5('0x50'));if(_0x29ad07['role']==='user'){var _0x79f770=_0x2ee960[_0x19b5('0x27')]({'plain':!![]});var _0x263252=_0x19b5('0x51');return db[_0x19b5('0x52')][_0x19b5('0x4c')]({'where':{'name':_0x263252,'userProfileId':_0x29ad07[_0x19b5('0x53')]},'raw':!![]})[_0x19b5('0x25')](function(_0x4a3a6f){if(_0x4a3a6f&&_0x4a3a6f[_0x19b5('0x54')]===0x0){return db[_0x19b5('0x28')]['create']({'name':_0x79f770[_0x19b5('0x2c')],'resourceId':_0x79f770['id'],'type':_0x4a3a6f['name'],'sectionId':_0x4a3a6f['id']},{})['then'](function(){return _0x2ee960;});}else{return _0x2ee960;}})[_0x19b5('0x47')](function(_0x12883a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12883a);throw _0x12883a;});}return _0x2ee960;})[_0x19b5('0x25')](respondWithResult(_0x179707,0xc9))[_0x19b5('0x47')](handleError(_0x179707,null));};exports['update']=function(_0x15fa07,_0xeea68a){if(_0x15fa07[_0x19b5('0x4e')]['id']){delete _0x15fa07[_0x19b5('0x4e')]['id'];}return db['CmContactHasItem'][_0x19b5('0x4c')]({'where':{'id':_0x15fa07[_0x19b5('0x49')]['id']}})[_0x19b5('0x25')](handleEntityNotFound(_0xeea68a,null))[_0x19b5('0x25')](saveUpdates(_0x15fa07[_0x19b5('0x4e')],null))[_0x19b5('0x25')](respondWithResult(_0xeea68a,null))[_0x19b5('0x47')](handleError(_0xeea68a,null));};exports[_0x19b5('0x26')]=function(_0x5bb8f4,_0x1aaee1){return db[_0x19b5('0x2f')]['find']({'where':{'id':_0x5bb8f4[_0x19b5('0x49')]['id']}})[_0x19b5('0x25')](handleEntityNotFound(_0x1aaee1,null))['then'](removeEntity(_0x1aaee1,null))[_0x19b5('0x47')](handleError(_0x1aaee1,null));}; \ No newline at end of file +var _0x9df1=['json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','UserProfileResource','end','error','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','findAll','catch','show','keys','include','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1151fa,_0x2784a7){var _0x49da2b=function(_0x2d33ca){while(--_0x2d33ca){_0x1151fa['push'](_0x1151fa['shift']());}};_0x49da2b(++_0x2784a7);}(_0x9df1,0x17f));var _0x19df=function(_0x1bd9e5,_0x56a90c){_0x1bd9e5=_0x1bd9e5-0x0;var _0x931e59=_0x9df1[_0x1bd9e5];return _0x931e59;};'use strict';var emlformat=require(_0x19df('0x0'));var rimraf=require(_0x19df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19df('0x2'));var moment=require(_0x19df('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x19df('0x4'));var path=require(_0x19df('0x5'));var sox=require(_0x19df('0x6'));var csv=require(_0x19df('0x7'));var ejs=require(_0x19df('0x8'));var fs=require('fs');var fs_extra=require(_0x19df('0x9'));var _=require(_0x19df('0xa'));var squel=require('squel');var crypto=require(_0x19df('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x19df('0xc'));var toCsv=require(_0x19df('0x7'));var querystring=require(_0x19df('0xd'));var Papa=require(_0x19df('0xe'));var Redis=require(_0x19df('0xf'));var authService=require(_0x19df('0x10'));var qs=require(_0x19df('0x11'));var as=require(_0x19df('0x12'));var hardwareService=require(_0x19df('0x13'));var logger=require(_0x19df('0x14'))(_0x19df('0x15'));var utils=require(_0x19df('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x19df('0x17'));var db=require(_0x19df('0x18'))['db'];function respondWithStatusCode(_0x30499d,_0x4e268c){_0x4e268c=_0x4e268c||0xcc;return function(_0x1e944e){if(_0x1e944e){return _0x30499d[_0x19df('0x19')](_0x4e268c);}return _0x30499d[_0x19df('0x1a')](_0x4e268c)['end']();};}function respondWithResult(_0x35cd03,_0x2cbb1d){_0x2cbb1d=_0x2cbb1d||0xc8;return function(_0x1b300e){if(_0x1b300e){return _0x35cd03[_0x19df('0x1a')](_0x2cbb1d)[_0x19df('0x1b')](_0x1b300e);}};}function respondWithFilteredResult(_0x4efe9a,_0x4020f8){return function(_0x4b1aea){if(_0x4b1aea){var _0x55f758=typeof _0x4020f8[_0x19df('0x1c')]===_0x19df('0x1d')&&typeof _0x4020f8['limit']===_0x19df('0x1d');var _0x3729e0=_0x4b1aea[_0x19df('0x1e')];var _0x45c2ee=_0x55f758?0x0:_0x4020f8[_0x19df('0x1c')];var _0x4e8509=_0x55f758?_0x4b1aea[_0x19df('0x1e')]:_0x4020f8[_0x19df('0x1c')]+_0x4020f8[_0x19df('0x1f')];var _0x5d0fe8;if(_0x4e8509>=_0x3729e0){_0x4e8509=_0x3729e0;_0x5d0fe8=0xc8;}else{_0x5d0fe8=0xce;}_0x4efe9a[_0x19df('0x1a')](_0x5d0fe8);return _0x4efe9a[_0x19df('0x20')](_0x19df('0x21'),_0x45c2ee+'-'+_0x4e8509+'/'+_0x3729e0)[_0x19df('0x1b')](_0x4b1aea);}return null;};}function patchUpdates(_0xf7f4e3){return function(_0x5a12ae){try{jsonpatch['apply'](_0x5a12ae,_0xf7f4e3,!![]);}catch(_0x4dbb97){return BPromise[_0x19df('0x22')](_0x4dbb97);}return _0x5a12ae[_0x19df('0x23')]();};}function saveUpdates(_0x2b80ca,_0x215044){return function(_0x64f9b3){if(_0x64f9b3){return _0x64f9b3['update'](_0x2b80ca)[_0x19df('0x24')](function(_0x375451){return _0x375451;});}return null;};}function removeEntity(_0x2111fd,_0x3a3147){return function(_0x325757){if(_0x325757){return _0x325757[_0x19df('0x25')]()[_0x19df('0x24')](function(){var _0x3b6514=_0x325757['get']({'plain':!![]});var _0x3f0953='CmContactHasItems';return db[_0x19df('0x26')][_0x19df('0x25')]({'where':{'type':_0x3f0953,'resourceId':_0x3b6514['id']}})[_0x19df('0x24')](function(){return _0x325757;});})[_0x19df('0x24')](function(){_0x2111fd[_0x19df('0x1a')](0xcc)[_0x19df('0x27')]();});}};}function handleEntityNotFound(_0xd3e021,_0x26199c){return function(_0x355941){if(!_0x355941){_0xd3e021['sendStatus'](0x194);}return _0x355941;};}function handleError(_0x792b66,_0x48e668){_0x48e668=_0x48e668||0x1f4;return function(_0x439ba5){logger[_0x19df('0x28')](_0x439ba5['stack']);if(_0x439ba5[_0x19df('0x29')]){delete _0x439ba5[_0x19df('0x29')];}_0x792b66['status'](_0x48e668)['send'](_0x439ba5);};}exports[_0x19df('0x2a')]=function(_0x42f06a,_0x275bc7){var _0xfbc9c9={},_0x2681f8={},_0x3c38ce={'count':0x0,'rows':[]};var _0x15d728=_[_0x19df('0x2b')](db[_0x19df('0x2c')][_0x19df('0x2d')],function(_0x1896b4){return{'name':_0x1896b4[_0x19df('0x2e')],'type':_0x1896b4[_0x19df('0x2f')][_0x19df('0x30')]};});_0x2681f8[_0x19df('0x31')]=_[_0x19df('0x2b')](_0x15d728,_0x19df('0x29'));_0x2681f8[_0x19df('0x32')]=_['keys'](_0x42f06a[_0x19df('0x32')]);_0x2681f8[_0x19df('0x33')]=_[_0x19df('0x34')](_0x2681f8[_0x19df('0x31')],_0x2681f8[_0x19df('0x32')]);_0xfbc9c9[_0x19df('0x35')]=_['intersection'](_0x2681f8[_0x19df('0x31')],qs[_0x19df('0x36')](_0x42f06a[_0x19df('0x32')]['fields']));_0xfbc9c9[_0x19df('0x35')]=_0xfbc9c9[_0x19df('0x35')][_0x19df('0x37')]?_0xfbc9c9[_0x19df('0x35')]:_0x2681f8[_0x19df('0x31')];if(!_0x42f06a['query']['hasOwnProperty'](_0x19df('0x38'))){_0xfbc9c9[_0x19df('0x1f')]=qs[_0x19df('0x1f')](_0x42f06a[_0x19df('0x32')]['limit']);_0xfbc9c9[_0x19df('0x1c')]=qs['offset'](_0x42f06a[_0x19df('0x32')]['offset']);}_0xfbc9c9['order']=qs[_0x19df('0x39')](_0x42f06a[_0x19df('0x32')][_0x19df('0x39')]);_0xfbc9c9[_0x19df('0x3a')]=qs['filters'](_[_0x19df('0x3b')](_0x42f06a[_0x19df('0x32')],_0x2681f8[_0x19df('0x33')]),_0x15d728);if(_0x42f06a[_0x19df('0x32')]['filter']){_0xfbc9c9[_0x19df('0x3a')]=_['merge'](_0xfbc9c9[_0x19df('0x3a')],{'$or':_[_0x19df('0x2b')](_0x15d728,function(_0x48c559){if(_0x48c559[_0x19df('0x2f')]!==_0x19df('0x3c')){var _0x371142={};_0x371142[_0x48c559[_0x19df('0x29')]]={'$like':'%'+_0x42f06a['query'][_0x19df('0x3d')]+'%'};return _0x371142;}})});}_0xfbc9c9=_[_0x19df('0x3e')]({},_0xfbc9c9,_0x42f06a['options']);var _0x298071={'where':_0xfbc9c9[_0x19df('0x3a')]};return db['CmContactHasItem'][_0x19df('0x1e')](_0x298071)[_0x19df('0x24')](function(_0x56d611){_0x3c38ce[_0x19df('0x1e')]=_0x56d611;if(_0x42f06a[_0x19df('0x32')]['includeAll']){_0xfbc9c9['include']=[{'all':!![]}];}return db[_0x19df('0x2c')][_0x19df('0x3f')](_0xfbc9c9);})[_0x19df('0x24')](function(_0x274724){_0x3c38ce['rows']=_0x274724;return _0x3c38ce;})[_0x19df('0x24')](respondWithFilteredResult(_0x275bc7,_0xfbc9c9))[_0x19df('0x40')](handleError(_0x275bc7,null));};exports[_0x19df('0x41')]=function(_0x31e41c,_0xc2a368){var _0x2e4799={'raw':!![],'where':{'id':_0x31e41c['params']['id']}},_0x1ce085={};_0x1ce085[_0x19df('0x31')]=_['keys'](db[_0x19df('0x2c')][_0x19df('0x2d')]);_0x1ce085[_0x19df('0x32')]=_[_0x19df('0x42')](_0x31e41c[_0x19df('0x32')]);_0x1ce085[_0x19df('0x33')]=_['intersection'](_0x1ce085[_0x19df('0x31')],_0x1ce085['query']);_0x2e4799[_0x19df('0x35')]=_[_0x19df('0x34')](_0x1ce085[_0x19df('0x31')],qs[_0x19df('0x36')](_0x31e41c[_0x19df('0x32')][_0x19df('0x36')]));_0x2e4799[_0x19df('0x35')]=_0x2e4799[_0x19df('0x35')][_0x19df('0x37')]?_0x2e4799[_0x19df('0x35')]:_0x1ce085[_0x19df('0x31')];if(_0x31e41c['query']['includeAll']){_0x2e4799[_0x19df('0x43')]=[{'all':!![]}];}_0x2e4799=_['merge']({},_0x2e4799,_0x31e41c[_0x19df('0x44')]);return db['CmContactHasItem'][_0x19df('0x45')](_0x2e4799)[_0x19df('0x24')](handleEntityNotFound(_0xc2a368,null))[_0x19df('0x24')](respondWithResult(_0xc2a368,null))[_0x19df('0x40')](handleError(_0xc2a368,null));};exports[_0x19df('0x46')]=function(_0x460071,_0x2de23b){return db[_0x19df('0x2c')]['create'](_0x460071['body'],{})[_0x19df('0x24')](function(_0xefe96d){var _0x2eab9c=_0x460071['user'][_0x19df('0x47')]({'plain':!![]});if(!_0x2eab9c)throw new Error(_0x19df('0x48'));if(_0x2eab9c[_0x19df('0x49')]===_0x19df('0x4a')){var _0x3ee808=_0xefe96d[_0x19df('0x47')]({'plain':!![]});var _0xe368a5=_0x19df('0x4b');return db['UserProfileSection'][_0x19df('0x45')]({'where':{'name':_0xe368a5,'userProfileId':_0x2eab9c[_0x19df('0x4c')]},'raw':!![]})[_0x19df('0x24')](function(_0x4470e4){if(_0x4470e4&&_0x4470e4[_0x19df('0x4d')]===0x0){return db[_0x19df('0x26')][_0x19df('0x46')]({'name':_0x3ee808[_0x19df('0x29')],'resourceId':_0x3ee808['id'],'type':_0x4470e4[_0x19df('0x29')],'sectionId':_0x4470e4['id']},{})[_0x19df('0x24')](function(){return _0xefe96d;});}else{return _0xefe96d;}})[_0x19df('0x40')](function(_0x4007d2){logger[_0x19df('0x28')](_0x19df('0x4e'),_0x4007d2);throw _0x4007d2;});}return _0xefe96d;})[_0x19df('0x24')](respondWithResult(_0x2de23b,0xc9))[_0x19df('0x40')](handleError(_0x2de23b,null));};exports[_0x19df('0x4f')]=function(_0x1db1f0,_0xa30f81){if(_0x1db1f0[_0x19df('0x50')]['id']){delete _0x1db1f0[_0x19df('0x50')]['id'];}return db[_0x19df('0x2c')]['find']({'where':{'id':_0x1db1f0[_0x19df('0x51')]['id']}})[_0x19df('0x24')](handleEntityNotFound(_0xa30f81,null))[_0x19df('0x24')](saveUpdates(_0x1db1f0[_0x19df('0x50')],null))[_0x19df('0x24')](respondWithResult(_0xa30f81,null))[_0x19df('0x40')](handleError(_0xa30f81,null));};exports['destroy']=function(_0x48b063,_0x4dad0d){return db[_0x19df('0x2c')][_0x19df('0x45')]({'where':{'id':_0x48b063['params']['id']}})[_0x19df('0x24')](handleEntityNotFound(_0x4dad0d,null))['then'](removeEntity(_0x4dad0d,null))['catch'](handleError(_0x4dad0d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9b4d049..c81b862 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7289=['../../config/logger','api','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util'];(function(_0x3dba84,_0x1c0344){var _0x117916=function(_0x4b7bf2){while(--_0x4b7bf2){_0x3dba84['push'](_0x3dba84['shift']());}};_0x117916(++_0x1c0344);}(_0x7289,0x1c6));var _0x9728=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7289[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x9728('0x0'));var util=require(_0x9728('0x1'));var logger=require(_0x9728('0x2'))(_0x9728('0x3'));var moment=require(_0x9728('0x4'));var BPromise=require('bluebird');var rp=require(_0x9728('0x5'));var fs=require('fs');var path=require(_0x9728('0x6'));var rimraf=require('rimraf');var config=require(_0x9728('0x7'));var attributes=require(_0x9728('0x8'));module[_0x9728('0x9')]=function(_0x4b1498,_0x4eedbc){return _0x4b1498[_0x9728('0xa')]('CmContactHasItem',attributes,{'tableName':_0x9728('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecf2=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','api','request-promise','path'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xecf2,0x100));var _0x2ecf=function(_0x5d9dea,_0x484fbd){_0x5d9dea=_0x5d9dea-0x0;var _0x3d0a84=_0xecf2[_0x5d9dea];return _0x3d0a84;};'use strict';var _=require(_0x2ecf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ecf('0x2'));var fs=require('fs');var path=require(_0x2ecf('0x3'));var rimraf=require(_0x2ecf('0x4'));var config=require(_0x2ecf('0x5'));var attributes=require(_0x2ecf('0x6'));module['exports']=function(_0x4332fb,_0x5a6aa5){return _0x4332fb[_0x2ecf('0x7')](_0x2ecf('0x8'),attributes,{'tableName':_0x2ecf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 8fffe8f..12293a4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca29=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x225896,_0x2375e6){var _0xc9e16b=function(_0x4b9071){while(--_0x4b9071){_0x225896['push'](_0x225896['shift']());}};_0xc9e16b(++_0x2375e6);}(_0xca29,0x1ed));var _0x9ca2=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0xca29[_0x2fb87c];return _0x43038b;};'use strict';var _=require(_0x9ca2('0x0'));var util=require(_0x9ca2('0x1'));var moment=require('moment');var BPromise=require(_0x9ca2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ca2('0x3'));var db=require(_0x9ca2('0x4'))['db'];var utils=require(_0x9ca2('0x5'));var logger=require(_0x9ca2('0x6'))('rpc');var config=require(_0x9ca2('0x7'));var jayson=require(_0x9ca2('0x8'));var client=jayson[_0x9ca2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c493,_0x526f0c,_0x789e19){return new BPromise(function(_0x2184fc,_0x1e7048){return client[_0x9ca2('0xa')](_0x10c493,_0x789e19)[_0x9ca2('0xb')](function(_0x3df33c){logger[_0x9ca2('0xc')](_0x9ca2('0xd'),_0x526f0c,_0x9ca2('0xe'));logger[_0x9ca2('0xf')](_0x9ca2('0x10'),_0x526f0c,_0x9ca2('0xe'),JSON[_0x9ca2('0x11')](_0x3df33c));if(_0x3df33c[_0x9ca2('0x12')]){if(_0x3df33c[_0x9ca2('0x12')]['code']===0x1f4){logger[_0x9ca2('0x12')](_0x9ca2('0xd'),_0x526f0c,_0x3df33c[_0x9ca2('0x12')][_0x9ca2('0x13')]);return _0x1e7048(_0x3df33c[_0x9ca2('0x12')][_0x9ca2('0x13')]);}logger[_0x9ca2('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x526f0c,_0x3df33c[_0x9ca2('0x12')][_0x9ca2('0x13')]);return _0x2184fc(_0x3df33c[_0x9ca2('0x12')]['message']);}else{logger[_0x9ca2('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x526f0c,'request\x20sent');_0x2184fc(_0x3df33c[_0x9ca2('0x14')]['message']);}})[_0x9ca2('0x15')](function(_0x25ce35){logger[_0x9ca2('0x12')](_0x9ca2('0xd'),_0x526f0c,_0x25ce35);_0x1e7048(_0x25ce35);});});} \ No newline at end of file +var _0xbb04=['ioredis','../../mysqldb','../../config/logger','rpc','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x39747e,_0x26a69c){var _0x51d0cf=function(_0x1cf954){while(--_0x1cf954){_0x39747e['push'](_0x39747e['shift']());}};_0x51d0cf(++_0x26a69c);}(_0xbb04,0x89));var _0x4bb0=function(_0x3c6456,_0x3be8db){_0x3c6456=_0x3c6456-0x0;var _0x258853=_0xbb04[_0x3c6456];return _0x258853;};'use strict';var _=require(_0x4bb0('0x0'));var util=require('util');var moment=require(_0x4bb0('0x1'));var BPromise=require(_0x4bb0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bb0('0x3'));var db=require(_0x4bb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bb0('0x5'))(_0x4bb0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4bb0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190300,_0x19de21,_0x169056){return new BPromise(function(_0x1da0f5,_0x5f377a){return client[_0x4bb0('0x8')](_0x190300,_0x169056)['then'](function(_0x5aec0b){logger[_0x4bb0('0x9')](_0x4bb0('0xa'),_0x19de21,_0x4bb0('0xb'));logger[_0x4bb0('0xc')](_0x4bb0('0xd'),_0x19de21,'request\x20sent',JSON[_0x4bb0('0xe')](_0x5aec0b));if(_0x5aec0b[_0x4bb0('0xf')]){if(_0x5aec0b[_0x4bb0('0xf')][_0x4bb0('0x10')]===0x1f4){logger[_0x4bb0('0xf')](_0x4bb0('0xa'),_0x19de21,_0x5aec0b['error']['message']);return _0x5f377a(_0x5aec0b[_0x4bb0('0xf')][_0x4bb0('0x11')]);}logger[_0x4bb0('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x19de21,_0x5aec0b[_0x4bb0('0xf')][_0x4bb0('0x11')]);return _0x1da0f5(_0x5aec0b['error'][_0x4bb0('0x11')]);}else{logger[_0x4bb0('0x9')](_0x4bb0('0xa'),_0x19de21,_0x4bb0('0xb'));_0x1da0f5(_0x5aec0b[_0x4bb0('0x12')][_0x4bb0('0x11')]);}})[_0x4bb0('0x13')](function(_0x326dc2){logger[_0x4bb0('0xf')](_0x4bb0('0xa'),_0x19de21,_0x326dc2);_0x5f377a(_0x326dc2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index f8dd179..2e5f8d7 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a57=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','util'];(function(_0x2a8375,_0x372351){var _0x1b9d44=function(_0x3b8065){while(--_0x3b8065){_0x2a8375['push'](_0x2a8375['shift']());}};_0x1b9d44(++_0x372351);}(_0x1a57,0xf5));var _0x71a5=function(_0x56bdbf,_0x2e9ace){_0x56bdbf=_0x56bdbf-0x0;var _0x2dae26=_0x1a57[_0x56bdbf];return _0x2dae26;};'use strict';var multer=require(_0x71a5('0x0'));var util=require(_0x71a5('0x1'));var path=require(_0x71a5('0x2'));var timeout=require(_0x71a5('0x3'));var express=require('express');var router=express[_0x71a5('0x4')]();var fs_extra=require(_0x71a5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x71a5('0x6'));var config=require(_0x71a5('0x7'));var controller=require(_0x71a5('0x8'));router[_0x71a5('0x9')]('/',auth[_0x71a5('0xa')](),controller['index']);router[_0x71a5('0x9')]('/:id',auth[_0x71a5('0xa')](),controller[_0x71a5('0xb')]);router[_0x71a5('0xc')]('/',auth['isAuthenticated'](),controller[_0x71a5('0xd')]);router[_0x71a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x71a5('0xf')]);router[_0x71a5('0x10')](_0x71a5('0x11'),auth[_0x71a5('0xa')](),controller[_0x71a5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3e07=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','create'];(function(_0x4f17f6,_0x350c26){var _0x387c32=function(_0x2621fa){while(--_0x2621fa){_0x4f17f6['push'](_0x4f17f6['shift']());}};_0x387c32(++_0x350c26);}(_0x3e07,0x17a));var _0x73e0=function(_0x2026a2,_0x3ae5b2){_0x2026a2=_0x2026a2-0x0;var _0x526b04=_0x3e07[_0x2026a2];return _0x526b04;};'use strict';var multer=require(_0x73e0('0x0'));var util=require('util');var path=require(_0x73e0('0x1'));var timeout=require(_0x73e0('0x2'));var express=require(_0x73e0('0x3'));var router=express[_0x73e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73e0('0x5'));var interaction=require(_0x73e0('0x6'));var config=require(_0x73e0('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x73e0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x73e0('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x73e0('0xa')]('/',auth[_0x73e0('0xb')](),controller[_0x73e0('0xc')]);router['put'](_0x73e0('0x9'),auth['isAuthenticated'](),controller[_0x73e0('0xd')]);router[_0x73e0('0xe')]('/:id',auth[_0x73e0('0xb')](),controller[_0x73e0('0xf')]);module[_0x73e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index da39f95..476e36b 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 _0xb18c=['values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','select','parse'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xb18c,0xd2));var _0xcb18=function(_0x36fca9,_0x277053){_0x36fca9=_0x36fca9-0x0;var _0x12a56a=_0xb18c[_0x36fca9];return _0x12a56a;};'use strict';var Sequelize=require(_0xcb18('0x0'));var _=require(_0xcb18('0x1'));module['exports']={'name':{'type':Sequelize[_0xcb18('0x2')],'get':function(_0x3b18a8){return this[_0xcb18('0x3')](_0xcb18('0x4'));}},'alias':{'type':Sequelize[_0xcb18('0x5')],'allowNull':![],'set':function(_0x9351fd){this[_0xcb18('0x6')](_0xcb18('0x4'),_0x9351fd?_0x9351fd:this[_0xcb18('0x3')](_0xcb18('0x7')));}},'type':{'type':Sequelize[_0xcb18('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xcb18('0x8')]('long'),'get':function(){if(this['getDataValue']('type')===_0xcb18('0x9')){return JSON[_0xcb18('0xa')](this['getDataValue'](_0xcb18('0xb')));}else{return this['getDataValue'](_0xcb18('0xb'));}},'set':function(_0x411b6f){if(Array[_0xcb18('0xc')](_0x411b6f)){this[_0xcb18('0x6')](_0xcb18('0xb'),JSON[_0xcb18('0xd')](_0x411b6f));}else{this[_0xcb18('0x6')](_0xcb18('0xb'),_0x411b6f);}}},'required':{'type':Sequelize[_0xcb18('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xcb18('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xcb18('0xf')](_0xcb18('0x10'))}}; \ No newline at end of file +var _0x1f15=['STRING','setDataValue','name','TEXT','type','select','getDataValue','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1f15,0x14f));var _0x51f1=function(_0x55b478,_0x2f4080){_0x55b478=_0x55b478-0x0;var _0x52d9c9=_0x1f15[_0x55b478];return _0x52d9c9;};'use strict';var Sequelize=require(_0x51f1('0x0'));var _=require(_0x51f1('0x1'));module[_0x51f1('0x2')]={'name':{'type':Sequelize[_0x51f1('0x3')],'get':function(_0x383054){return this['getDataValue'](_0x51f1('0x4'));}},'alias':{'type':Sequelize[_0x51f1('0x5')],'allowNull':![],'set':function(_0x59ca98){this[_0x51f1('0x6')](_0x51f1('0x4'),_0x59ca98?_0x59ca98:this['getDataValue'](_0x51f1('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x51f1('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x51f1('0x9'))===_0x51f1('0xa')){return JSON['parse'](this['getDataValue']('values'));}else{return this[_0x51f1('0xb')](_0x51f1('0xc'));}},'set':function(_0x385335){if(Array[_0x51f1('0xd')](_0x385335)){this[_0x51f1('0x6')](_0x51f1('0xc'),JSON['stringify'](_0x385335));}else{this[_0x51f1('0x6')](_0x51f1('0xc'),_0x385335);}}},'required':{'type':Sequelize[_0x51f1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x51f1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x51f1('0xf')](_0x51f1('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4af0ca6..8e554f1 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 _0xc51d=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','fieldName','type','model','differenceBy','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','CmCustomField','includeAll','include','then','rows','catch','params','rawAttributes','find','update','body','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x57a944,_0x295bc2){var _0x5e8a08=function(_0x560fd3){while(--_0x560fd3){_0x57a944['push'](_0x57a944['shift']());}};_0x5e8a08(++_0x295bc2);}(_0xc51d,0x8f));var _0xdc51=function(_0x37386a,_0x2b2b36){_0x37386a=_0x37386a-0x0;var _0x1e067c=_0xc51d[_0x37386a];return _0x1e067c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdc51('0x0'));var jsonpatch=require(_0xdc51('0x1'));var rp=require(_0xdc51('0x2'));var moment=require('moment');var BPromise=require(_0xdc51('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc51('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc51('0x5'));var _=require(_0xdc51('0x6'));var squel=require(_0xdc51('0x7'));var crypto=require(_0xdc51('0x8'));var jsforce=require(_0xdc51('0x9'));var deskjs=require(_0xdc51('0xa'));var toCsv=require(_0xdc51('0x4'));var querystring=require(_0xdc51('0xb'));var Papa=require(_0xdc51('0xc'));var Redis=require(_0xdc51('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc51('0xe'));var logger=require(_0xdc51('0xf'))(_0xdc51('0x10'));var utils=require(_0xdc51('0x11'));var config=require(_0xdc51('0x12'));var licenseUtil=require(_0xdc51('0x13'));var db=require(_0xdc51('0x14'))['db'];function respondWithStatusCode(_0x53abb2,_0x1914ce){_0x1914ce=_0x1914ce||0xcc;return function(_0x35f739){if(_0x35f739){return _0x53abb2[_0xdc51('0x15')](_0x1914ce);}return _0x53abb2[_0xdc51('0x16')](_0x1914ce)[_0xdc51('0x17')]();};}function respondWithResult(_0x257fb1,_0x4f4019){_0x4f4019=_0x4f4019||0xc8;return function(_0x1f0d69){if(_0x1f0d69){return _0x257fb1['status'](_0x4f4019)[_0xdc51('0x18')](_0x1f0d69);}};}function respondWithFilteredResult(_0x1299a2,_0x3afc7e){return function(_0x426af4){if(_0x426af4){var _0x465ab5=typeof _0x3afc7e['offset']===_0xdc51('0x19')&&typeof _0x3afc7e[_0xdc51('0x1a')]==='undefined';var _0x39731d=_0x426af4[_0xdc51('0x1b')];var _0x3da9d0=_0x465ab5?0x0:_0x3afc7e[_0xdc51('0x1c')];var _0x1dba61=_0x465ab5?_0x426af4['count']:_0x3afc7e[_0xdc51('0x1c')]+_0x3afc7e[_0xdc51('0x1a')];var _0x548146;if(_0x1dba61>=_0x39731d){_0x1dba61=_0x39731d;_0x548146=0xc8;}else{_0x548146=0xce;}_0x1299a2[_0xdc51('0x16')](_0x548146);return _0x1299a2[_0xdc51('0x1d')](_0xdc51('0x1e'),_0x3da9d0+'-'+_0x1dba61+'/'+_0x39731d)[_0xdc51('0x18')](_0x426af4);}return null;};}function patchUpdates(_0x221c4c){return function(_0x4c477d){try{jsonpatch[_0xdc51('0x1f')](_0x4c477d,_0x221c4c,!![]);}catch(_0x3cca48){return BPromise[_0xdc51('0x20')](_0x3cca48);}return _0x4c477d['save']();};}function saveUpdates(_0x151ece,_0x282ae8){return function(_0x11c970){if(_0x11c970){return _0x11c970['update'](_0x151ece)['then'](function(_0x4145f9){return _0x4145f9;});}return null;};}function removeEntity(_0x379b0e,_0x1a5bfa){return function(_0x16d84a){if(_0x16d84a){return _0x16d84a[_0xdc51('0x21')]()['then'](function(){_0x379b0e[_0xdc51('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199a03,_0xbda4c8){return function(_0x27ed03){if(!_0x27ed03){_0x199a03['sendStatus'](0x194);}return _0x27ed03;};}function handleError(_0xe2e605,_0x36cf42){_0x36cf42=_0x36cf42||0x1f4;return function(_0x5f2369){logger[_0xdc51('0x22')](_0x5f2369[_0xdc51('0x23')]);if(_0x5f2369[_0xdc51('0x24')]){delete _0x5f2369['name'];}_0xe2e605['status'](_0x36cf42)[_0xdc51('0x25')](_0x5f2369);};}exports[_0xdc51('0x26')]=function(_0x119de4,_0x6df6d0){var _0x343bdd={},_0x277e39={},_0xf18654={'count':0x0,'rows':[]};var _0x43737=_['map'](db['CmCustomField']['rawAttributes'],function(_0x2ce1ef){return{'name':_0x2ce1ef[_0xdc51('0x27')],'type':_0x2ce1ef[_0xdc51('0x28')]['key']};});_0x277e39[_0xdc51('0x29')]=_[_0xdc51('0x2a')](_['map'](_0x43737,_0xdc51('0x24')),['name']);_0x277e39['query']=_[_0xdc51('0x2b')](_0x119de4[_0xdc51('0x2c')]);_0x277e39['filters']=_[_0xdc51('0x2d')](_0x277e39['model'],_0x277e39[_0xdc51('0x2c')]);_0x343bdd['attributes']=_[_0xdc51('0x2d')](_0x277e39[_0xdc51('0x29')],qs['fields'](_0x119de4['query'][_0xdc51('0x2e')]));_0x343bdd[_0xdc51('0x2f')]=_0x343bdd[_0xdc51('0x2f')][_0xdc51('0x30')]?_0x343bdd[_0xdc51('0x2f')]:_0x277e39[_0xdc51('0x29')];if(!_0x119de4[_0xdc51('0x2c')][_0xdc51('0x31')](_0xdc51('0x32'))){_0x343bdd[_0xdc51('0x1a')]=qs['limit'](_0x119de4[_0xdc51('0x2c')][_0xdc51('0x1a')]);_0x343bdd[_0xdc51('0x1c')]=qs[_0xdc51('0x1c')](_0x119de4[_0xdc51('0x2c')][_0xdc51('0x1c')]);}_0x343bdd[_0xdc51('0x33')]=qs['sort'](_0x119de4[_0xdc51('0x2c')]['sort']);_0x343bdd[_0xdc51('0x34')]=qs[_0xdc51('0x35')](_[_0xdc51('0x36')](_0x119de4[_0xdc51('0x2c')],_0x277e39[_0xdc51('0x35')]),_0x43737);if(_0x119de4[_0xdc51('0x2c')][_0xdc51('0x37')]){_0x343bdd['where']=_['merge'](_0x343bdd['where'],{'$or':_['map'](_0x43737,function(_0xaef9fa){if(_0xaef9fa[_0xdc51('0x28')]!==_0xdc51('0x38')){var _0x539ca9={};_0x539ca9[_0xaef9fa[_0xdc51('0x24')]]={'$like':'%'+_0x119de4[_0xdc51('0x2c')][_0xdc51('0x37')]+'%'};return _0x539ca9;}})});}_0x343bdd=_[_0xdc51('0x39')]({},_0x343bdd,_0x119de4[_0xdc51('0x3a')]);var _0x2af9fd={'where':_0x343bdd['where']};return db[_0xdc51('0x3b')][_0xdc51('0x1b')](_0x2af9fd)['then'](function(_0x131b35){_0xf18654[_0xdc51('0x1b')]=_0x131b35;if(_0x119de4[_0xdc51('0x2c')][_0xdc51('0x3c')]){_0x343bdd[_0xdc51('0x3d')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x343bdd);})[_0xdc51('0x3e')](function(_0x3ee41a){_0xf18654[_0xdc51('0x3f')]=_0x3ee41a;return _0xf18654;})[_0xdc51('0x3e')](respondWithFilteredResult(_0x6df6d0,_0x343bdd))[_0xdc51('0x40')](handleError(_0x6df6d0,null));};exports['show']=function(_0x5f2a9f,_0x4df0cf){var _0x389e58={'raw':!![],'where':{'id':_0x5f2a9f[_0xdc51('0x41')]['id']}},_0x474c4e={};_0x474c4e[_0xdc51('0x29')]=_[_0xdc51('0x2b')](db[_0xdc51('0x3b')][_0xdc51('0x42')]);_0x474c4e[_0xdc51('0x2c')]=_[_0xdc51('0x2b')](_0x5f2a9f[_0xdc51('0x2c')]);_0x474c4e['filters']=_[_0xdc51('0x2d')](_0x474c4e['model'],_0x474c4e[_0xdc51('0x2c')]);_0x389e58[_0xdc51('0x2f')]=_[_0xdc51('0x2d')](_0x474c4e[_0xdc51('0x29')],qs[_0xdc51('0x2e')](_0x5f2a9f[_0xdc51('0x2c')][_0xdc51('0x2e')]));_0x389e58[_0xdc51('0x2f')]=_0x389e58[_0xdc51('0x2f')][_0xdc51('0x30')]?_0x389e58['attributes']:_0x474c4e[_0xdc51('0x29')];if(_0x5f2a9f[_0xdc51('0x2c')][_0xdc51('0x3c')]){_0x389e58[_0xdc51('0x3d')]=[{'all':!![]}];}_0x389e58=_[_0xdc51('0x39')]({},_0x389e58,_0x5f2a9f['options']);return db[_0xdc51('0x3b')][_0xdc51('0x43')](_0x389e58)[_0xdc51('0x3e')](handleEntityNotFound(_0x4df0cf,null))['then'](respondWithResult(_0x4df0cf,null))[_0xdc51('0x40')](handleError(_0x4df0cf,null));};exports[_0xdc51('0x44')]=function(_0x9db34b,_0x1c8a5d){if(_0x9db34b[_0xdc51('0x45')]['id']){delete _0x9db34b['body']['id'];}return db[_0xdc51('0x3b')][_0xdc51('0x43')]({'where':{'id':_0x9db34b['params']['id']}})[_0xdc51('0x3e')](handleEntityNotFound(_0x1c8a5d,null))['then'](saveUpdates(_0x9db34b[_0xdc51('0x45')],null))['then'](respondWithResult(_0x1c8a5d,null))[_0xdc51('0x40')](handleError(_0x1c8a5d,null));};exports['destroy']=function(_0xfdae4b,_0x47ebb4){return db['CmCustomField'][_0xdc51('0x43')]({'where':{'id':_0xfdae4b[_0xdc51('0x41')]['id']}})['then'](handleEntityNotFound(_0x47ebb4,null))[_0xdc51('0x3e')](removeEntity(_0x47ebb4,null))[_0xdc51('0x40')](handleError(_0x47ebb4,null));};exports[_0xdc51('0x46')]=function(_0x313c4e,_0x44f6dd){var _0x3bbcdf;return db[_0xdc51('0x47')][_0xdc51('0x48')](function(_0x2d7e50){return db['CmCustomField'][_0xdc51('0x46')](_0x313c4e['body'],{'transaction':_0x2d7e50})[_0xdc51('0x3e')](function(_0x39034b){_0x3bbcdf=_0x39034b;var _0x122622={'type':db[_0xdc51('0x49')][_0xdc51('0x4a')],'transaction':_0x2d7e50};switch(_0x313c4e['body'][_0xdc51('0x28')]){case _0xdc51('0x4b'):_0x122622[_0xdc51('0x28')]=db[_0xdc51('0x49')]['TEXT'];break;case _0xdc51('0x4c'):_0x122622['type']=db[_0xdc51('0x49')]['INTEGER'];break;case _0xdc51('0x4d'):_0x122622[_0xdc51('0x28')]=db[_0xdc51('0x49')][_0xdc51('0x4e')];_0x122622[_0xdc51('0x4f')]=![];break;default:}return db[_0xdc51('0x47')][_0xdc51('0x50')]['addColumn'](_0xdc51('0x51'),util[_0xdc51('0x52')]('cf_%d',_0x3bbcdf['id']),_0x122622);})[_0xdc51('0x3e')](function(){return _0x3bbcdf;});})[_0xdc51('0x3e')](respondWithResult(_0x44f6dd,0xc9))[_0xdc51('0x40')](handleError(_0x44f6dd,null));}; \ No newline at end of file +var _0x0aed=['defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','index','CmCustomField','fieldName','type','differenceBy','map','query','keys','model','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','body','find','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','BOOLEAN'];(function(_0x30ac20,_0x553833){var _0x6149f6=function(_0x4e271e){while(--_0x4e271e){_0x30ac20['push'](_0x30ac20['shift']());}};_0x6149f6(++_0x553833);}(_0x0aed,0x19f));var _0xd0ae=function(_0x2052cc,_0x4f76dc){_0x2052cc=_0x2052cc-0x0;var _0x58609f=_0x0aed[_0x2052cc];return _0x58609f;};'use strict';var emlformat=require(_0xd0ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0ae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0ae('0x3'));var path=require(_0xd0ae('0x4'));var sox=require(_0xd0ae('0x5'));var csv=require(_0xd0ae('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0ae('0x7'));var squel=require(_0xd0ae('0x8'));var crypto=require('crypto');var jsforce=require(_0xd0ae('0x9'));var deskjs=require(_0xd0ae('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd0ae('0xb'));var Papa=require(_0xd0ae('0xc'));var Redis=require(_0xd0ae('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0ae('0xe'));var as=require(_0xd0ae('0xf'));var hardwareService=require(_0xd0ae('0x10'));var logger=require(_0xd0ae('0x11'))(_0xd0ae('0x12'));var utils=require(_0xd0ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd0ae('0x14'));var db=require(_0xd0ae('0x15'))['db'];function respondWithStatusCode(_0x58dcc5,_0x1e3dda){_0x1e3dda=_0x1e3dda||0xcc;return function(_0x5434e3){if(_0x5434e3){return _0x58dcc5[_0xd0ae('0x16')](_0x1e3dda);}return _0x58dcc5['status'](_0x1e3dda)[_0xd0ae('0x17')]();};}function respondWithResult(_0x379983,_0x2629d3){_0x2629d3=_0x2629d3||0xc8;return function(_0x45d7fd){if(_0x45d7fd){return _0x379983[_0xd0ae('0x18')](_0x2629d3)['json'](_0x45d7fd);}};}function respondWithFilteredResult(_0x525096,_0x5eb845){return function(_0x529a0e){if(_0x529a0e){var _0x4918df=typeof _0x5eb845[_0xd0ae('0x19')]==='undefined'&&typeof _0x5eb845['limit']==='undefined';var _0x4f9e73=_0x529a0e[_0xd0ae('0x1a')];var _0x307114=_0x4918df?0x0:_0x5eb845[_0xd0ae('0x19')];var _0x1bd0c4=_0x4918df?_0x529a0e[_0xd0ae('0x1a')]:_0x5eb845['offset']+_0x5eb845[_0xd0ae('0x1b')];var _0x56aa24;if(_0x1bd0c4>=_0x4f9e73){_0x1bd0c4=_0x4f9e73;_0x56aa24=0xc8;}else{_0x56aa24=0xce;}_0x525096[_0xd0ae('0x18')](_0x56aa24);return _0x525096['set'](_0xd0ae('0x1c'),_0x307114+'-'+_0x1bd0c4+'/'+_0x4f9e73)[_0xd0ae('0x1d')](_0x529a0e);}return null;};}function patchUpdates(_0x873fb6){return function(_0x2c568e){try{jsonpatch[_0xd0ae('0x1e')](_0x2c568e,_0x873fb6,!![]);}catch(_0x26a659){return BPromise[_0xd0ae('0x1f')](_0x26a659);}return _0x2c568e[_0xd0ae('0x20')]();};}function saveUpdates(_0x1a06dc,_0x2c4bce){return function(_0x19cd5a){if(_0x19cd5a){return _0x19cd5a[_0xd0ae('0x21')](_0x1a06dc)['then'](function(_0x41e96a){return _0x41e96a;});}return null;};}function removeEntity(_0x4ed310,_0x143b99){return function(_0x2ceedf){if(_0x2ceedf){return _0x2ceedf[_0xd0ae('0x22')]()[_0xd0ae('0x23')](function(){_0x4ed310[_0xd0ae('0x18')](0xcc)[_0xd0ae('0x17')]();});}};}function handleEntityNotFound(_0x550c6a,_0x225f06){return function(_0x167ce6){if(!_0x167ce6){_0x550c6a[_0xd0ae('0x16')](0x194);}return _0x167ce6;};}function handleError(_0x309fd5,_0x24acaa){_0x24acaa=_0x24acaa||0x1f4;return function(_0x4d1efe){logger['error'](_0x4d1efe[_0xd0ae('0x24')]);if(_0x4d1efe[_0xd0ae('0x25')]){delete _0x4d1efe[_0xd0ae('0x25')];}_0x309fd5[_0xd0ae('0x18')](_0x24acaa)['send'](_0x4d1efe);};}exports[_0xd0ae('0x26')]=function(_0x5db4d0,_0x257b8c){var _0xa9c7c8={},_0x180f71={},_0x17b404={'count':0x0,'rows':[]};var _0x498709=_['map'](db[_0xd0ae('0x27')]['rawAttributes'],function(_0x15234d){return{'name':_0x15234d[_0xd0ae('0x28')],'type':_0x15234d[_0xd0ae('0x29')]['key']};});_0x180f71['model']=_[_0xd0ae('0x2a')](_[_0xd0ae('0x2b')](_0x498709,_0xd0ae('0x25')),[_0xd0ae('0x25')]);_0x180f71[_0xd0ae('0x2c')]=_[_0xd0ae('0x2d')](_0x5db4d0[_0xd0ae('0x2c')]);_0x180f71['filters']=_['intersection'](_0x180f71[_0xd0ae('0x2e')],_0x180f71[_0xd0ae('0x2c')]);_0xa9c7c8[_0xd0ae('0x2f')]=_['intersection'](_0x180f71[_0xd0ae('0x2e')],qs[_0xd0ae('0x30')](_0x5db4d0['query'][_0xd0ae('0x30')]));_0xa9c7c8[_0xd0ae('0x2f')]=_0xa9c7c8[_0xd0ae('0x2f')]['length']?_0xa9c7c8['attributes']:_0x180f71[_0xd0ae('0x2e')];if(!_0x5db4d0['query']['hasOwnProperty'](_0xd0ae('0x31'))){_0xa9c7c8[_0xd0ae('0x1b')]=qs[_0xd0ae('0x1b')](_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x1b')]);_0xa9c7c8[_0xd0ae('0x19')]=qs['offset'](_0x5db4d0['query'][_0xd0ae('0x19')]);}_0xa9c7c8['order']=qs[_0xd0ae('0x32')](_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x32')]);_0xa9c7c8[_0xd0ae('0x33')]=qs[_0xd0ae('0x34')](_[_0xd0ae('0x35')](_0x5db4d0[_0xd0ae('0x2c')],_0x180f71[_0xd0ae('0x34')]),_0x498709);if(_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x36')]){_0xa9c7c8[_0xd0ae('0x33')]=_['merge'](_0xa9c7c8[_0xd0ae('0x33')],{'$or':_[_0xd0ae('0x2b')](_0x498709,function(_0xe826c6){if(_0xe826c6[_0xd0ae('0x29')]!==_0xd0ae('0x37')){var _0xb733af={};_0xb733af[_0xe826c6[_0xd0ae('0x25')]]={'$like':'%'+_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x36')]+'%'};return _0xb733af;}})});}_0xa9c7c8=_['merge']({},_0xa9c7c8,_0x5db4d0[_0xd0ae('0x38')]);var _0x400c36={'where':_0xa9c7c8[_0xd0ae('0x33')]};return db[_0xd0ae('0x27')][_0xd0ae('0x1a')](_0x400c36)['then'](function(_0x43b477){_0x17b404[_0xd0ae('0x1a')]=_0x43b477;if(_0x5db4d0['query'][_0xd0ae('0x39')]){_0xa9c7c8[_0xd0ae('0x3a')]=[{'all':!![]}];}return db['CmCustomField'][_0xd0ae('0x3b')](_0xa9c7c8);})[_0xd0ae('0x23')](function(_0x3441fd){_0x17b404[_0xd0ae('0x3c')]=_0x3441fd;return _0x17b404;})[_0xd0ae('0x23')](respondWithFilteredResult(_0x257b8c,_0xa9c7c8))[_0xd0ae('0x3d')](handleError(_0x257b8c,null));};exports[_0xd0ae('0x3e')]=function(_0x4dd4c5,_0x401201){var _0x3aabce={'raw':!![],'where':{'id':_0x4dd4c5[_0xd0ae('0x3f')]['id']}},_0x14cfaf={};_0x14cfaf[_0xd0ae('0x2e')]=_[_0xd0ae('0x2d')](db[_0xd0ae('0x27')]['rawAttributes']);_0x14cfaf[_0xd0ae('0x2c')]=_[_0xd0ae('0x2d')](_0x4dd4c5[_0xd0ae('0x2c')]);_0x14cfaf['filters']=_[_0xd0ae('0x40')](_0x14cfaf[_0xd0ae('0x2e')],_0x14cfaf['query']);_0x3aabce['attributes']=_['intersection'](_0x14cfaf[_0xd0ae('0x2e')],qs[_0xd0ae('0x30')](_0x4dd4c5[_0xd0ae('0x2c')][_0xd0ae('0x30')]));_0x3aabce['attributes']=_0x3aabce[_0xd0ae('0x2f')][_0xd0ae('0x41')]?_0x3aabce[_0xd0ae('0x2f')]:_0x14cfaf[_0xd0ae('0x2e')];if(_0x4dd4c5[_0xd0ae('0x2c')][_0xd0ae('0x39')]){_0x3aabce['include']=[{'all':!![]}];}_0x3aabce=_['merge']({},_0x3aabce,_0x4dd4c5[_0xd0ae('0x38')]);return db[_0xd0ae('0x27')]['find'](_0x3aabce)[_0xd0ae('0x23')](handleEntityNotFound(_0x401201,null))[_0xd0ae('0x23')](respondWithResult(_0x401201,null))[_0xd0ae('0x3d')](handleError(_0x401201,null));};exports['update']=function(_0x2d193e,_0x102af9){if(_0x2d193e[_0xd0ae('0x42')]['id']){delete _0x2d193e['body']['id'];}return db[_0xd0ae('0x27')][_0xd0ae('0x43')]({'where':{'id':_0x2d193e[_0xd0ae('0x3f')]['id']}})['then'](handleEntityNotFound(_0x102af9,null))['then'](saveUpdates(_0x2d193e[_0xd0ae('0x42')],null))[_0xd0ae('0x23')](respondWithResult(_0x102af9,null))[_0xd0ae('0x3d')](handleError(_0x102af9,null));};exports['destroy']=function(_0x593a78,_0x31908a){return db['CmCustomField'][_0xd0ae('0x43')]({'where':{'id':_0x593a78[_0xd0ae('0x3f')]['id']}})[_0xd0ae('0x23')](handleEntityNotFound(_0x31908a,null))[_0xd0ae('0x23')](removeEntity(_0x31908a,null))[_0xd0ae('0x3d')](handleError(_0x31908a,null));};exports['create']=function(_0x5709ee,_0x3db477){var _0x134820;return db[_0xd0ae('0x44')][_0xd0ae('0x45')](function(_0x5666c8){return db[_0xd0ae('0x27')][_0xd0ae('0x46')](_0x5709ee[_0xd0ae('0x42')],{'transaction':_0x5666c8})[_0xd0ae('0x23')](function(_0x1200b8){_0x134820=_0x1200b8;var _0x2065a8={'type':db[_0xd0ae('0x47')][_0xd0ae('0x48')],'transaction':_0x5666c8};switch(_0x5709ee['body'][_0xd0ae('0x29')]){case _0xd0ae('0x49'):_0x2065a8[_0xd0ae('0x29')]=db['Sequelize'][_0xd0ae('0x48')];break;case _0xd0ae('0x4a'):_0x2065a8[_0xd0ae('0x29')]=db[_0xd0ae('0x47')][_0xd0ae('0x4b')];break;case'switch':_0x2065a8[_0xd0ae('0x29')]=db[_0xd0ae('0x47')][_0xd0ae('0x4c')];_0x2065a8[_0xd0ae('0x4d')]=![];break;default:}return db['sequelize'][_0xd0ae('0x4e')]['addColumn'](_0xd0ae('0x4f'),util[_0xd0ae('0x50')](_0xd0ae('0x51'),_0x134820['id']),_0x2065a8);})[_0xd0ae('0x23')](function(){return _0x134820;});})[_0xd0ae('0x23')](respondWithResult(_0x3db477,0xc9))['catch'](handleError(_0x3db477,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f6b71a7..e29f20b 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 _0xaf6e=['request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','moment','bluebird'];(function(_0x4793f3,_0x3ccb42){var _0x578ef1=function(_0x23059a){while(--_0x23059a){_0x4793f3['push'](_0x4793f3['shift']());}};_0x578ef1(++_0x3ccb42);}(_0xaf6e,0x158));var _0xeaf6=function(_0x2bcb35,_0x102644){_0x2bcb35=_0x2bcb35-0x0;var _0x1aa5c2=_0xaf6e[_0x2bcb35];return _0x1aa5c2;};'use strict';var _=require(_0xeaf6('0x0'));var util=require(_0xeaf6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeaf6('0x2'));var BPromise=require(_0xeaf6('0x3'));var rp=require(_0xeaf6('0x4'));var fs=require('fs');var path=require(_0xeaf6('0x5'));var rimraf=require(_0xeaf6('0x6'));var config=require(_0xeaf6('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xeaf6('0x8')]=function(_0xc3bff5,_0x57ba7b){return _0xc3bff5[_0xeaf6('0x9')](_0xeaf6('0xa'),attributes,{'tableName':_0xeaf6('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae7d=['CmCustomField','cm_custom_fields','../../config/logger','api','request-promise','path','../../config/environment','./cmCustomField.attributes','define'];(function(_0x50c70a,_0x4fcd5c){var _0x1f388a=function(_0xfe9d58){while(--_0xfe9d58){_0x50c70a['push'](_0x50c70a['shift']());}};_0x1f388a(++_0x4fcd5c);}(_0xae7d,0x65));var _0xdae7=function(_0x34d556,_0x50743d){_0x34d556=_0x34d556-0x0;var _0x36be93=_0xae7d[_0x34d556];return _0x36be93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdae7('0x0'))(_0xdae7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdae7('0x2'));var fs=require('fs');var path=require(_0xdae7('0x3'));var rimraf=require('rimraf');var config=require(_0xdae7('0x4'));var attributes=require(_0xdae7('0x5'));module['exports']=function(_0x50a6a3,_0x15a0b4){return _0x50a6a3[_0xdae7('0x6')](_0xdae7('0x7'),attributes,{'tableName':_0xdae7('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 7fab89a..f3a7c3e 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 _0xc3c2=['then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x2f2ca3,_0x51b11d){var _0x4b7021=function(_0x34fe9c){while(--_0x34fe9c){_0x2f2ca3['push'](_0x2f2ca3['shift']());}};_0x4b7021(++_0x51b11d);}(_0xc3c2,0x186));var _0x2c3c=function(_0x48c3ac,_0xe7f6f0){_0x48c3ac=_0x48c3ac-0x0;var _0x2175cd=_0xc3c2[_0x48c3ac];return _0x2175cd;};'use strict';var _=require(_0x2c3c('0x0'));var util=require('util');var moment=require(_0x2c3c('0x1'));var BPromise=require(_0x2c3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c3c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c3c('0x4'));var logger=require(_0x2c3c('0x5'))('rpc');var config=require(_0x2c3c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2c3c('0x7')][_0x2c3c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3046ce,_0x47f316,_0x2ea6c7){return new BPromise(function(_0x4e2864,_0x53f320){return client[_0x2c3c('0x9')](_0x3046ce,_0x2ea6c7)[_0x2c3c('0xa')](function(_0x90b023){logger['info']('CmCustomField,\x20%s,\x20%s',_0x47f316,_0x2c3c('0xb'));logger[_0x2c3c('0xc')](_0x2c3c('0xd'),_0x47f316,'request\x20sent',JSON['stringify'](_0x90b023));if(_0x90b023[_0x2c3c('0xe')]){if(_0x90b023[_0x2c3c('0xe')][_0x2c3c('0xf')]===0x1f4){logger[_0x2c3c('0xe')](_0x2c3c('0x10'),_0x47f316,_0x90b023[_0x2c3c('0xe')][_0x2c3c('0x11')]);return _0x53f320(_0x90b023[_0x2c3c('0xe')]['message']);}logger['error'](_0x2c3c('0x10'),_0x47f316,_0x90b023[_0x2c3c('0xe')][_0x2c3c('0x11')]);return _0x4e2864(_0x90b023['error'][_0x2c3c('0x11')]);}else{logger[_0x2c3c('0x12')](_0x2c3c('0x10'),_0x47f316,_0x2c3c('0xb'));_0x4e2864(_0x90b023[_0x2c3c('0x13')][_0x2c3c('0x11')]);}})['catch'](function(_0x5bb0cf){logger[_0x2c3c('0xe')]('CmCustomField,\x20%s,\x20%s',_0x47f316,_0x5bb0cf);_0x53f320(_0x5bb0cf);});});} \ No newline at end of file +var _0x7926=['catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59d546,_0x107f05){var _0x41fbdb=function(_0x413e68){while(--_0x413e68){_0x59d546['push'](_0x59d546['shift']());}};_0x41fbdb(++_0x107f05);}(_0x7926,0x112));var _0x6792=function(_0x19c1a3,_0x5d2a8f){_0x19c1a3=_0x19c1a3-0x0;var _0x12f2e5=_0x7926[_0x19c1a3];return _0x12f2e5;};'use strict';var _=require(_0x6792('0x0'));var util=require(_0x6792('0x1'));var moment=require('moment');var BPromise=require(_0x6792('0x2'));var rs=require(_0x6792('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6792('0x4'));var logger=require(_0x6792('0x5'))('rpc');var config=require(_0x6792('0x6'));var jayson=require(_0x6792('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2746df,_0x43184e,_0xbda335){return new BPromise(function(_0x5b88c4,_0x3981fb){return client[_0x6792('0x8')](_0x2746df,_0xbda335)[_0x6792('0x9')](function(_0x1bd291){logger[_0x6792('0xa')](_0x6792('0xb'),_0x43184e,_0x6792('0xc'));logger[_0x6792('0xd')](_0x6792('0xe'),_0x43184e,'request\x20sent',JSON[_0x6792('0xf')](_0x1bd291));if(_0x1bd291[_0x6792('0x10')]){if(_0x1bd291['error'][_0x6792('0x11')]===0x1f4){logger['error'](_0x6792('0xb'),_0x43184e,_0x1bd291[_0x6792('0x10')][_0x6792('0x12')]);return _0x3981fb(_0x1bd291[_0x6792('0x10')]['message']);}logger[_0x6792('0x10')](_0x6792('0xb'),_0x43184e,_0x1bd291[_0x6792('0x10')][_0x6792('0x12')]);return _0x5b88c4(_0x1bd291['error'][_0x6792('0x12')]);}else{logger[_0x6792('0xa')](_0x6792('0xb'),_0x43184e,'request\x20sent');_0x5b88c4(_0x1bd291[_0x6792('0x13')][_0x6792('0x12')]);}})[_0x6792('0x14')](function(_0x125e74){logger[_0x6792('0x10')](_0x6792('0xb'),_0x43184e,_0x125e74);_0x3981fb(_0x125e74);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 281cc82..e60f03c 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 _0x0b9b=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0xf17d71,_0x3bbe72){var _0x2502f3=function(_0x2e7c34){while(--_0x2e7c34){_0xf17d71['push'](_0xf17d71['shift']());}};_0x2502f3(++_0x3bbe72);}(_0x0b9b,0x1b9));var _0xb0b9=function(_0x3ad7d1,_0x42fc75){_0x3ad7d1=_0x3ad7d1-0x0;var _0x187851=_0x0b9b[_0x3ad7d1];return _0x187851;};'use strict';var multer=require(_0xb0b9('0x0'));var util=require(_0xb0b9('0x1'));var path=require(_0xb0b9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0b9('0x3'));var router=express[_0xb0b9('0x4')]();var fs_extra=require(_0xb0b9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb0b9('0x6'));var config=require(_0xb0b9('0x7'));var controller=require(_0xb0b9('0x8'));router[_0xb0b9('0x9')]('/',auth[_0xb0b9('0xa')](),controller[_0xb0b9('0xb')]);router['get'](_0xb0b9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb0b9('0xd')]('/',auth[_0xb0b9('0xa')](),controller['create']);router[_0xb0b9('0xe')](_0xb0b9('0xc'),auth['isAuthenticated'](),controller[_0xb0b9('0xf')]);router[_0xb0b9('0x10')](_0xb0b9('0xc'),auth['isAuthenticated'](),controller[_0xb0b9('0x11')]);module[_0xb0b9('0x12')]=router; \ No newline at end of file +var _0xd101=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x250bbc,_0x3297f3){var _0x489e34=function(_0x67c2d3){while(--_0x67c2d3){_0x250bbc['push'](_0x250bbc['shift']());}};_0x489e34(++_0x3297f3);}(_0xd101,0xc1));var _0x1d10=function(_0x1cc3b3,_0xc12914){_0x1cc3b3=_0x1cc3b3-0x0;var _0x58e950=_0xd101[_0x1cc3b3];return _0x58e950;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmCustomField.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0xe')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller['destroy']);module[_0x1d10('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3b8507d..44797ce 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 _0x7202=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED'];(function(_0x51b1a5,_0x285a4f){var _0x15c738=function(_0x5c94d7){while(--_0x5c94d7){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x15c738(++_0x285a4f);}(_0x7202,0xeb));var _0x2720=function(_0x49a984,_0x584f1c){_0x49a984=_0x49a984-0x0;var _0xc29582=_0x7202[_0x49a984];return _0xc29582;};'use strict';var moment=require(_0x2720('0x0'));var Sequelize=require(_0x2720('0x1'));module[_0x2720('0x2')]={'phone':{'type':Sequelize[_0x2720('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x2720('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2720('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2720('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2720('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2720('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2720('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x2720('0x6')],'unique':_0x2720('0x8')},'UserId':{'type':Sequelize[_0x2720('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x2720('0x6')],'unique':_0x2720('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2720('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x2720('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x2720('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x83b8=['UNSIGNED','BOOLEAN','contactListQueue','moment','sequelize','exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x532f2a,_0x23560c){var _0x1b9649=function(_0x44b11c){while(--_0x44b11c){_0x532f2a['push'](_0x532f2a['shift']());}};_0x1b9649(++_0x23560c);}(_0x83b8,0x175));var _0x883b=function(_0x531ab0,_0x288b83){_0x531ab0=_0x531ab0-0x0;var _0x2de4dc=_0x83b8[_0x531ab0];return _0x2de4dc;};'use strict';var moment=require(_0x883b('0x0'));var Sequelize=require(_0x883b('0x1'));module[_0x883b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x883b('0x3')],'defaultValue':moment()[_0x883b('0x4')](_0x883b('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x883b('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x883b('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x883b('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x883b('0x9')},'ListId':{'type':Sequelize[_0x883b('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x883b('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x883b('0x9')},'CampaignId':{'type':Sequelize[_0x883b('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x883b('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x883b('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e5f3ac6..1f00852 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 _0xe5b3=['value','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','List','dialActive','getPreviewRecall','findOne','Queue','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','error','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','params','options','find','then','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','user','UserId','calleridnum','phone','campaigntype','queue','ContactId','firstName','lastName','calleridname','isNil','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1cf21e,_0x567c66){var _0x364948=function(_0x13cc4a){while(--_0x13cc4a){_0x1cf21e['push'](_0x1cf21e['shift']());}};_0x364948(++_0x567c66);}(_0xe5b3,0x133));var _0x3e5b=function(_0xda0bbd,_0x331bd4){_0xda0bbd=_0xda0bbd-0x0;var _0x28d4a5=_0xe5b3[_0xda0bbd];return _0x28d4a5;};'use strict';var moment=require('moment');var _=require(_0x3e5b('0x0'));var qs=require(_0x3e5b('0x1'));var logger=require(_0x3e5b('0x2'))(_0x3e5b('0x3'));var shared=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];function respondWithResult(_0x7f1cc0,_0x1e58ed){_0x1e58ed=_0x1e58ed||0xc8;return function(_0x320b1e){if(_0x320b1e){return _0x7f1cc0[_0x3e5b('0x6')](_0x1e58ed)[_0x3e5b('0x7')](_0x320b1e);}};}function respondWithFilteredResult(_0x54e1fb,_0x174923){return function(_0x5dcf55){if(_0x5dcf55){var _0x534e7d=typeof _0x174923[_0x3e5b('0x8')]===_0x3e5b('0x9')&&typeof _0x174923[_0x3e5b('0xa')]===_0x3e5b('0x9');var _0x5282fd=_0x5dcf55['count'];var _0x1fef54=_0x534e7d?0x0:_0x174923[_0x3e5b('0x8')];var _0x22fc1a=_0x534e7d?_0x5dcf55[_0x3e5b('0xb')]:_0x174923[_0x3e5b('0x8')]+_0x174923['limit'];var _0x3be027;if(_0x22fc1a>=_0x5282fd){_0x22fc1a=_0x5282fd;_0x3be027=0xc8;}else{_0x3be027=0xce;}_0x54e1fb['status'](_0x3be027);return _0x54e1fb[_0x3e5b('0xc')](_0x3e5b('0xd'),_0x1fef54+'-'+_0x22fc1a+'/'+_0x5282fd)[_0x3e5b('0x7')](_0x5dcf55);}return null;};}function saveUpdates(_0x374068,_0x20b97b){return function(_0x3c4eb1){if(_0x3c4eb1){return _0x3c4eb1[_0x3e5b('0xe')](_0x374068)['then'](function(_0x39a2a1){return _0x39a2a1;});}return null;};}function handleEntityNotFound(_0x5f2f9c,_0x51a188){return function(_0x4d71a3){if(!_0x4d71a3){_0x5f2f9c[_0x3e5b('0xf')](0x194);}return _0x4d71a3;};}function handleError(_0x3f5368,_0x17aaa3){_0x17aaa3=_0x17aaa3||0x1f4;return function(_0x4fb471){logger[_0x3e5b('0x10')](_0x4fb471['stack']);if(_0x4fb471['name']){delete _0x4fb471[_0x3e5b('0x11')];}_0x3f5368[_0x3e5b('0x6')](_0x17aaa3)['send'](_0x4fb471);};}exports[_0x3e5b('0x12')]=function(_0x143040,_0x555002){var _0xc56a2a={},_0x3365dd={},_0x52696c={'count':0x0,'rows':[]};var _0x4b189d=_[_0x3e5b('0x13')](db[_0x3e5b('0x14')][_0x3e5b('0x15')],function(_0xff4aba){return{'name':_0xff4aba[_0x3e5b('0x16')],'type':_0xff4aba[_0x3e5b('0x17')][_0x3e5b('0x18')]};});_0x3365dd[_0x3e5b('0x19')]=_[_0x3e5b('0x13')](_0x4b189d,_0x3e5b('0x11'));_0x3365dd[_0x3e5b('0x1a')]=_[_0x3e5b('0x1b')](_0x143040[_0x3e5b('0x1a')]);_0x3365dd[_0x3e5b('0x1c')]=_['intersection'](_0x3365dd[_0x3e5b('0x19')],_0x3365dd[_0x3e5b('0x1a')]);_0x3365dd[_0x3e5b('0x1c')]=_[_0x3e5b('0x1d')](_0x3365dd['filters'],[_0x3e5b('0x1e'),'$or',_0x3e5b('0x1f'),_0x3e5b('0x20'),'$lt',_0x3e5b('0x21'),_0x3e5b('0x22'),_0x3e5b('0x23'),_0x3e5b('0x24'),_0x3e5b('0x25'),_0x3e5b('0x26'),_0x3e5b('0x27'),_0x3e5b('0x28'),'$like',_0x3e5b('0x29'),'$iLike',_0x3e5b('0x2a'),'$like',_0x3e5b('0x2b'),_0x3e5b('0x2c'),_0x3e5b('0x2d'),_0x3e5b('0x2e')]);_0xc56a2a[_0x3e5b('0x2f')]=_[_0x3e5b('0x30')](_0x3365dd[_0x3e5b('0x19')],qs[_0x3e5b('0x31')](_0x143040[_0x3e5b('0x1a')][_0x3e5b('0x31')]));_0xc56a2a[_0x3e5b('0x2f')]=_0xc56a2a['attributes'][_0x3e5b('0x32')]?_0xc56a2a[_0x3e5b('0x2f')]:_0x3365dd[_0x3e5b('0x19')];if(!_0x143040[_0x3e5b('0x1a')][_0x3e5b('0x33')](_0x3e5b('0x34'))){_0xc56a2a[_0x3e5b('0xa')]=qs['limit'](_0x143040[_0x3e5b('0x1a')]['limit']);_0xc56a2a['offset']=qs[_0x3e5b('0x8')](_0x143040[_0x3e5b('0x1a')]['offset']);}_0xc56a2a[_0x3e5b('0x35')]=qs[_0x3e5b('0x36')](_0x143040[_0x3e5b('0x1a')][_0x3e5b('0x36')]);_0xc56a2a[_0x3e5b('0x37')]=qs[_0x3e5b('0x1c')](_[_0x3e5b('0x38')](_0x143040[_0x3e5b('0x1a')],_0x3365dd[_0x3e5b('0x1c')]),_0x4b189d);if(_0x143040[_0x3e5b('0x1a')][_0x3e5b('0x39')]){_0xc56a2a[_0x3e5b('0x37')]=_['merge'](_0xc56a2a[_0x3e5b('0x37')],{'$or':_[_0x3e5b('0x13')](_0x4b189d,function(_0x53caa2){if(_0x53caa2['type']!==_0x3e5b('0x3a')){var _0x56d7ef={};_0x56d7ef[_0x53caa2[_0x3e5b('0x11')]]={'$like':'%'+_0x143040[_0x3e5b('0x1a')][_0x3e5b('0x39')]+'%'};return _0x56d7ef;}})});}_0xc56a2a=_[_0x3e5b('0x3b')]({},_0xc56a2a,_0x143040['options']);var _0x18b07f={'where':_0xc56a2a['where']};return db[_0x3e5b('0x14')]['count'](_0x18b07f)['then'](function(_0x48f414){_0x52696c[_0x3e5b('0xb')]=_0x48f414;if(_0x143040[_0x3e5b('0x1a')][_0x3e5b('0x3c')]){_0xc56a2a[_0x3e5b('0x3d')]=[{'all':!![]}];}return db[_0x3e5b('0x14')][_0x3e5b('0x3e')](_0xc56a2a);})['then'](function(_0x5d0c59){_0x52696c['rows']=_0x5d0c59;return _0x52696c;})['then'](respondWithFilteredResult(_0x555002,_0xc56a2a))['catch'](handleError(_0x555002,null));};exports['show']=function(_0x5aad1d,_0x182bc4){var _0x349de0={'raw':!![],'where':{'id':_0x5aad1d[_0x3e5b('0x3f')]['id']}},_0x13a48d={};_0x13a48d[_0x3e5b('0x19')]=_[_0x3e5b('0x1b')](db[_0x3e5b('0x14')][_0x3e5b('0x15')]);_0x13a48d[_0x3e5b('0x1a')]=_[_0x3e5b('0x1b')](_0x5aad1d[_0x3e5b('0x1a')]);_0x13a48d['filters']=_[_0x3e5b('0x30')](_0x13a48d[_0x3e5b('0x19')],_0x13a48d[_0x3e5b('0x1a')]);_0x349de0[_0x3e5b('0x2f')]=_[_0x3e5b('0x30')](_0x13a48d[_0x3e5b('0x19')],qs[_0x3e5b('0x31')](_0x5aad1d[_0x3e5b('0x1a')][_0x3e5b('0x31')]));_0x349de0[_0x3e5b('0x2f')]=_0x349de0[_0x3e5b('0x2f')]['length']?_0x349de0['attributes']:_0x13a48d['model'];if(_0x5aad1d['query'][_0x3e5b('0x3c')]){_0x349de0[_0x3e5b('0x3d')]=[{'all':!![]}];}_0x349de0=_[_0x3e5b('0x3b')]({},_0x349de0,_0x5aad1d[_0x3e5b('0x40')]);return db[_0x3e5b('0x14')][_0x3e5b('0x41')](_0x349de0)[_0x3e5b('0x42')](handleEntityNotFound(_0x182bc4,null))[_0x3e5b('0x42')](respondWithResult(_0x182bc4,null))[_0x3e5b('0x43')](handleError(_0x182bc4,null));};exports[_0x3e5b('0x44')]=function(_0x5d318a,_0x1392f8){return db[_0x3e5b('0x14')][_0x3e5b('0x44')](_0x5d318a[_0x3e5b('0x45')],{})[_0x3e5b('0x42')](respondWithResult(_0x1392f8,0xc9))['catch'](handleError(_0x1392f8,null));};exports['update']=function(_0x495217,_0x1fbd87){if(_0x495217[_0x3e5b('0x45')]['id']){delete _0x495217[_0x3e5b('0x45')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x495217[_0x3e5b('0x3f')]['id']}})[_0x3e5b('0x42')](handleEntityNotFound(_0x1fbd87,null))[_0x3e5b('0x42')](saveUpdates(_0x495217['body'],null))['then'](respondWithResult(_0x1fbd87,null))[_0x3e5b('0x43')](handleError(_0x1fbd87,null));};exports['describe']=function(_0x14b62a,_0x3379a1){return db[_0x3e5b('0x14')][_0x3e5b('0x46')]()[_0x3e5b('0x42')](respondWithResult(_0x3379a1,null))[_0x3e5b('0x43')](handleError(_0x3379a1,null));};exports[_0x3e5b('0x47')]=function(_0x3ea5aa,_0x339852){var _0x4a2ae1;var _0x223185=_0x3ea5aa['params']['id'];return db[_0x3e5b('0x14')][_0x3e5b('0x41')]({'where':{'id':_0x3ea5aa[_0x3e5b('0x3f')]['id']}})[_0x3e5b('0x42')](handleEntityNotFound(_0x339852,null))[_0x3e5b('0x42')](function(_0x3a4f26){if(_0x3a4f26){return _0x3a4f26[_0x3e5b('0x47')]()[_0x3e5b('0x42')](function(_0x2b5d3d){return _0x2b5d3d;});}})[_0x3e5b('0x42')](function(_0xf6ca5b){_0x4a2ae1=_0xf6ca5b;if(_0xf6ca5b){if(_0xf6ca5b[_0x3e5b('0x48')]||_0xf6ca5b[_0x3e5b('0x49')]){return db[_0xf6ca5b['VoiceQueueId']?_0x3e5b('0x4a'):_0x3e5b('0x4b')][_0x3e5b('0x41')]({'where':{'id':_0xf6ca5b[_0x3e5b('0x48')]?_0xf6ca5b[_0x3e5b('0x48')]:_0xf6ca5b[_0x3e5b('0x49')]},'attributes':['id','name'],'raw':!![]});}}})[_0x3e5b('0x42')](function(_0x1cbdf7){var _0x25b166={};if(_0x1cbdf7){_[_0x3e5b('0x3b')](_0x25b166,_[_0x3e5b('0x4c')](_0x4a2ae1[_0x3e5b('0x4d')],[_0x3e5b('0x4e'),_0x3e5b('0x4f'),'id']));_0x25b166['state']=0x15;_0x25b166[_0x3e5b('0x50')]='deleted';_0x25b166['campaign']=_0x1cbdf7[_0x3e5b('0x11')];_0x25b166['membername']=_0x3ea5aa[_0x3e5b('0x51')][_0x3e5b('0x11')];_0x25b166[_0x3e5b('0x52')]=_0x3ea5aa[_0x3e5b('0x51')]['id'];_0x25b166['deleted']=!![];_0x25b166['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25b166[_0x3e5b('0x53')]=_0x4a2ae1[_0x3e5b('0x54')];_0x25b166[_0x3e5b('0x55')]=_0x4a2ae1[_0x3e5b('0x48')]?_0x3e5b('0x56'):'ivr';return db['CmContact'][_0x3e5b('0x41')]({'where':{'id':_0x25b166[_0x3e5b('0x57')]},'attributes':[_0x3e5b('0x58'),_0x3e5b('0x59')]})[_0x3e5b('0x42')](function(_0x51efbd){if(!_['isNil'](_0x339852)&&!_['isNil'](_0x51efbd['firstName'])){_0x25b166[_0x3e5b('0x5a')]=_0x51efbd[_0x3e5b('0x58')];if(!_[_0x3e5b('0x5b')](_0x51efbd[_0x3e5b('0x59')])){_0x25b166[_0x3e5b('0x5a')]+='\x20'+_0x51efbd[_0x3e5b('0x59')];}}})[_0x3e5b('0x5c')](function(){return db[_0x3e5b('0x5d')]['create'](_0x25b166);});}})[_0x3e5b('0x42')](function(_0x29897b){return db[_0x3e5b('0x5e')][_0x3e5b('0x47')]({'where':{'CmHopperId':_0x223185}});})[_0x3e5b('0x42')](function(){return _0x339852['status'](0xcc)[_0x3e5b('0x5f')]();})['catch'](handleError(_0x339852,null));};exports[_0x3e5b('0x60')]=function(_0x1fd40c,_0x58c41e){var _0x4a7d8e=[];return db['CmContact'][_0x3e5b('0x46')]()['then'](function(_0x1ab942){_0x4a7d8e=_[_0x3e5b('0x1b')](_0x1ab942);return _0x1fd40c[_0x3e5b('0x51')][_0x3e5b('0x61')]({'where':{'type':_0x3e5b('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x3e5b('0x63')],'raw':!![]});})[_0x3e5b('0x42')](function(_0x3f7f71){if(_0x3f7f71&&_0x3f7f71['length']){return db[_0x3e5b('0x64')][_0x3e5b('0x65')](function(_0x32a42f){var _0x1c9526={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3e5b('0x66')](_0x3e5b('0x67'))},'VoiceQueueId':{'$in':_[_0x3e5b('0x13')](_0x3f7f71,'id')},'$or':[{'UserId':null},{'UserId':_0x1fd40c[_0x3e5b('0x51')]['id']}]};var _0x3a11a8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3f7f71)[_0x3e5b('0x39')]([_0x3e5b('0x63'),0x0])[_0x3e5b('0x13')]('id')[_0x3e5b('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x1fd40c[_0x3e5b('0x51')]['id']}]};var _0x13204a={'$or':[_0x1c9526,_0x3a11a8]};var _0x2411c3=[];if(_0x1fd40c[_0x3e5b('0x45')][_0x3e5b('0x69')]&&_0x1fd40c['body'][_0x3e5b('0x69')]===_0x3e5b('0x6a')){if(!_['isEmpty'](_0x1fd40c[_0x3e5b('0x45')][_0x3e5b('0x6b')])){_0x13204a['id']={'$in':_0x1fd40c['body']['hopperIds']};}_0x2411c3=[['priority',_0x3e5b('0x6c')],[_0x3e5b('0x6d'),_0x3f7f71[0x0]['dialOrderByScheduledAt']===_0x3e5b('0x6c')?_0x3e5b('0x6e'):'ASC'],db[_0x3e5b('0x64')][_0x3e5b('0x6f')](_0x3e5b('0x70')),['id',_0x3e5b('0x6e')]];}else{if(!_[_0x3e5b('0x71')](_0x1fd40c[_0x3e5b('0x45')][_0x3e5b('0x6b')])){_0x13204a['id']={'$notIn':_0x1fd40c[_0x3e5b('0x45')][_0x3e5b('0x6b')]};}_0x2411c3=[['priority',_0x3e5b('0x6e')],[_0x3e5b('0x6d'),_0x3f7f71[0x0][_0x3e5b('0x72')]],db[_0x3e5b('0x64')][_0x3e5b('0x6f')](_0x3e5b('0x73')),['id',_0x3e5b('0x6c')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x3e5b('0x74'),_0x3e5b('0x54'),'recallme'],'where':_0x13204a,'order':_0x2411c3,'transaction':_0x32a42f,'lock':_0x32a42f[_0x3e5b('0x75')][_0x3e5b('0x76')],'include':[{'model':db[_0x3e5b('0x77')],'as':_0x3e5b('0x78'),'attributes':_0x4a7d8e,'include':[{'model':db[_0x3e5b('0x79')],'as':_0x3e5b('0x7a'),'attributes':['id',_0x3e5b('0x11')]}]},{'model':db['CmList'],'as':_0x3e5b('0x7b'),'attributes':['id',_0x3e5b('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x3e5b('0x7c')]}]})[_0x3e5b('0x42')](function(_0x144738){if(_0x144738){return _0x144738[_0x3e5b('0xe')]({'UserId':_0x1fd40c[_0x3e5b('0x51')]['id']},{'transaction':_0x32a42f});}});});}})[_0x3e5b('0x42')](handleEntityNotFound(_0x58c41e,null))['then'](respondWithResult(_0x58c41e,null))[_0x3e5b('0x43')](handleError(_0x58c41e,null));};exports[_0x3e5b('0x7d')]=function(_0x4ff747,_0x34098c,_0x4da39d){var _0x4f62fb=[];var _0x211e73=_0x4ff747[_0x3e5b('0x3f')]['id'];var _0x487caf=_0x4ff747[_0x3e5b('0x51')]['id'];return db[_0x3e5b('0x77')]['describe']()[_0x3e5b('0x42')](function(_0x185640){_0x4f62fb=_[_0x3e5b('0x1b')](_0x185640);return db[_0x3e5b('0x64')][_0x3e5b('0x65')](function(_0x1541ec){const _0x5df4b1={'id':_0x211e73};return db['CmHopper'][_0x3e5b('0x7e')]({'attributes':['id','scheduledat','recallme'],'where':_0x5df4b1,'transaction':_0x1541ec,'lock':_0x1541ec[_0x3e5b('0x75')][_0x3e5b('0x76')],'include':[{'model':db[_0x3e5b('0x77')],'as':'Contact','attributes':_0x4f62fb,'include':[{'model':db[_0x3e5b('0x79')],'as':'Company','attributes':['id',_0x3e5b('0x11')]}]},{'model':db['CmList'],'as':_0x3e5b('0x7b'),'attributes':['id',_0x3e5b('0x11')]},{'model':db[_0x3e5b('0x4a')],'as':_0x3e5b('0x7f'),'attributes':['id','name',_0x3e5b('0x7c')]}]})['then'](function(_0x2cbf55){if(_0x2cbf55){return _0x2cbf55[_0x3e5b('0xe')]({'UserId':_0x487caf},{'transaction':_0x1541ec});}});});})['then'](handleEntityNotFound(_0x34098c,null))[_0x3e5b('0x42')](respondWithResult(_0x34098c,null))[_0x3e5b('0x43')](handleError(_0x34098c,null));};exports[_0x3e5b('0x80')]=function(_0x5ad011,_0x2d55eb){return _0x5ad011[_0x3e5b('0x51')][_0x3e5b('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3e5b('0x81')},'attributes':['id'],'raw':!![]})[_0x3e5b('0x42')](function(_0x4b9774){if(_0x4b9774&&_0x4b9774[_0x3e5b('0x32')]){return db[_0x3e5b('0x14')][_0x3e5b('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x3e5b('0x67'))},'VoiceQueueId':{'$in':_[_0x3e5b('0x13')](_0x4b9774,'id')},'$or':[{'UserId':null},{'UserId':_0x5ad011[_0x3e5b('0x51')]['id']}]}});}return 0x0;})[_0x3e5b('0x42')](function(_0x4bf039){if(!_[_0x3e5b('0x5b')](_0x4bf039)&&_['isNumber'](_0x4bf039)){return _0x2d55eb[_0x3e5b('0x6')](0xc8)['json']({'contacts':_0x4bf039});}else{logger[_0x3e5b('0x10')](_0x3e5b('0x82'),'getOpenContacts',0x194,_0x3e5b('0x83'));_0x2d55eb[_0x3e5b('0xf')](0x194);}})['catch'](handleError(_0x2d55eb,null));};exports[_0x3e5b('0x84')]=function(_0x271930,_0x2907dd){var _0x46ce2b=shared['timezones'];var _0x53328b=[];_[_0x3e5b('0x13')](_0x46ce2b,function(_0x37c2ff){_0x53328b[_0x3e5b('0x85')]({'id':_0x37c2ff[_0x3e5b('0x11')],'name':_0x37c2ff[_0x3e5b('0x11')],'utcOffset':_0x37c2ff[_0x3e5b('0x86')]});});return _0x2907dd['status'](0xc8)['json']({'tz':_0x53328b});};exports[_0x3e5b('0x87')]=function(_0x203279,_0x902bb8){var _0x25dec7=shared[_0x3e5b('0x88')];var _0x3f1a82={};if(!_[_0x3e5b('0x5b')](_0x25dec7[_0x203279[_0x3e5b('0x45')]['id']]))_0x3f1a82=_0x25dec7[_0x203279['body']['id']];return _0x902bb8['status'](0xc8)[_0x3e5b('0x7')](_0x3f1a82);}; \ No newline at end of file +var _0x1b20=['$ne','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','then','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','ivr','CmContact','firstName','isNil','lastName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','keys','outbound','preview','dialOrderByScheduledAt','transaction','dialPreviewAutoRecallMe','direction','prev','priority','scheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','LOCK','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','recallme','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','status','json','offset','limit','count','Content-Range','update','sendStatus','error','stack','send','map','CmHopper','rawAttributes','fieldName','key','name','query','filters','intersection','model','concat','$or','$gt','$gte','$lt','$lte'];(function(_0x2fa022,_0x3052e8){var _0x1f0355=function(_0x46b15c){while(--_0x46b15c){_0x2fa022['push'](_0x2fa022['shift']());}};_0x1f0355(++_0x3052e8);}(_0x1b20,0x66));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require('moment');var _=require(_0x01b2('0x0'));var qs=require(_0x01b2('0x1'));var logger=require('../../config/logger')('api');var shared=require(_0x01b2('0x2'));var db=require(_0x01b2('0x3'))['db'];function respondWithResult(_0x2d6e99,_0x1150fc){_0x1150fc=_0x1150fc||0xc8;return function(_0x1cf757){if(_0x1cf757){return _0x2d6e99[_0x01b2('0x4')](_0x1150fc)[_0x01b2('0x5')](_0x1cf757);}};}function respondWithFilteredResult(_0x28de4a,_0x46e745){return function(_0xa64ad1){if(_0xa64ad1){var _0x43d561=typeof _0x46e745[_0x01b2('0x6')]==='undefined'&&typeof _0x46e745[_0x01b2('0x7')]==='undefined';var _0x2e975d=_0xa64ad1[_0x01b2('0x8')];var _0x3bad99=_0x43d561?0x0:_0x46e745[_0x01b2('0x6')];var _0x9c411f=_0x43d561?_0xa64ad1[_0x01b2('0x8')]:_0x46e745[_0x01b2('0x6')]+_0x46e745[_0x01b2('0x7')];var _0x55804c;if(_0x9c411f>=_0x2e975d){_0x9c411f=_0x2e975d;_0x55804c=0xc8;}else{_0x55804c=0xce;}_0x28de4a[_0x01b2('0x4')](_0x55804c);return _0x28de4a['set'](_0x01b2('0x9'),_0x3bad99+'-'+_0x9c411f+'/'+_0x2e975d)['json'](_0xa64ad1);}return null;};}function saveUpdates(_0x41a618,_0x8ac569){return function(_0x2c6d4d){if(_0x2c6d4d){return _0x2c6d4d[_0x01b2('0xa')](_0x41a618)['then'](function(_0x2f97d1){return _0x2f97d1;});}return null;};}function handleEntityNotFound(_0x2e7b31,_0x4f1c15){return function(_0x1626ba){if(!_0x1626ba){_0x2e7b31[_0x01b2('0xb')](0x194);}return _0x1626ba;};}function handleError(_0x5a36de,_0x299d0c){_0x299d0c=_0x299d0c||0x1f4;return function(_0x3d5833){logger[_0x01b2('0xc')](_0x3d5833[_0x01b2('0xd')]);if(_0x3d5833['name']){delete _0x3d5833['name'];}_0x5a36de[_0x01b2('0x4')](_0x299d0c)[_0x01b2('0xe')](_0x3d5833);};}exports['index']=function(_0x1eafc4,_0x444236){var _0x27a0bc={},_0x5986f5={},_0x25c55f={'count':0x0,'rows':[]};var _0x9f182b=_[_0x01b2('0xf')](db[_0x01b2('0x10')][_0x01b2('0x11')],function(_0x56ea3c){return{'name':_0x56ea3c[_0x01b2('0x12')],'type':_0x56ea3c['type'][_0x01b2('0x13')]};});_0x5986f5['model']=_[_0x01b2('0xf')](_0x9f182b,_0x01b2('0x14'));_0x5986f5[_0x01b2('0x15')]=_['keys'](_0x1eafc4[_0x01b2('0x15')]);_0x5986f5[_0x01b2('0x16')]=_[_0x01b2('0x17')](_0x5986f5[_0x01b2('0x18')],_0x5986f5[_0x01b2('0x15')]);_0x5986f5['filters']=_[_0x01b2('0x19')](_0x5986f5['filters'],['$and',_0x01b2('0x1a'),_0x01b2('0x1b'),_0x01b2('0x1c'),_0x01b2('0x1d'),_0x01b2('0x1e'),_0x01b2('0x1f'),'$eq',_0x01b2('0x20'),_0x01b2('0x21'),_0x01b2('0x22'),_0x01b2('0x23'),'$notIn',_0x01b2('0x24'),'$notLike',_0x01b2('0x25'),_0x01b2('0x26'),'$like',_0x01b2('0x27'),'$contains','$contained',_0x01b2('0x28')]);_0x27a0bc[_0x01b2('0x29')]=_['intersection'](_0x5986f5[_0x01b2('0x18')],qs[_0x01b2('0x2a')](_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x2a')]));_0x27a0bc[_0x01b2('0x29')]=_0x27a0bc[_0x01b2('0x29')][_0x01b2('0x2b')]?_0x27a0bc[_0x01b2('0x29')]:_0x5986f5[_0x01b2('0x18')];if(!_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x2c')]('nolimit')){_0x27a0bc[_0x01b2('0x7')]=qs[_0x01b2('0x7')](_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x7')]);_0x27a0bc[_0x01b2('0x6')]=qs[_0x01b2('0x6')](_0x1eafc4['query']['offset']);}_0x27a0bc[_0x01b2('0x2d')]=qs['sort'](_0x1eafc4['query'][_0x01b2('0x2e')]);_0x27a0bc[_0x01b2('0x2f')]=qs[_0x01b2('0x16')](_[_0x01b2('0x30')](_0x1eafc4['query'],_0x5986f5[_0x01b2('0x16')]),_0x9f182b);if(_0x1eafc4['query'][_0x01b2('0x31')]){_0x27a0bc['where']=_['merge'](_0x27a0bc['where'],{'$or':_[_0x01b2('0xf')](_0x9f182b,function(_0x29532e){if(_0x29532e[_0x01b2('0x32')]!==_0x01b2('0x33')){var _0x4d80d0={};_0x4d80d0[_0x29532e[_0x01b2('0x14')]]={'$like':'%'+_0x1eafc4[_0x01b2('0x15')]['filter']+'%'};return _0x4d80d0;}})});}_0x27a0bc=_[_0x01b2('0x34')]({},_0x27a0bc,_0x1eafc4[_0x01b2('0x35')]);var _0x13dbb4={'where':_0x27a0bc[_0x01b2('0x2f')]};return db[_0x01b2('0x10')][_0x01b2('0x8')](_0x13dbb4)['then'](function(_0x2fb530){_0x25c55f[_0x01b2('0x8')]=_0x2fb530;if(_0x1eafc4['query']['includeAll']){_0x27a0bc[_0x01b2('0x36')]=[{'all':!![]}];}return db[_0x01b2('0x10')][_0x01b2('0x37')](_0x27a0bc);})[_0x01b2('0x38')](function(_0x34fdb2){_0x25c55f[_0x01b2('0x39')]=_0x34fdb2;return _0x25c55f;})['then'](respondWithFilteredResult(_0x444236,_0x27a0bc))['catch'](handleError(_0x444236,null));};exports[_0x01b2('0x3a')]=function(_0x4ba89b,_0xbd7259){var _0x31878={'raw':!![],'where':{'id':_0x4ba89b[_0x01b2('0x3b')]['id']}},_0x1a1e3b={};_0x1a1e3b[_0x01b2('0x18')]=_['keys'](db[_0x01b2('0x10')][_0x01b2('0x11')]);_0x1a1e3b[_0x01b2('0x15')]=_['keys'](_0x4ba89b[_0x01b2('0x15')]);_0x1a1e3b[_0x01b2('0x16')]=_[_0x01b2('0x17')](_0x1a1e3b['model'],_0x1a1e3b[_0x01b2('0x15')]);_0x31878['attributes']=_[_0x01b2('0x17')](_0x1a1e3b[_0x01b2('0x18')],qs['fields'](_0x4ba89b[_0x01b2('0x15')][_0x01b2('0x2a')]));_0x31878['attributes']=_0x31878[_0x01b2('0x29')][_0x01b2('0x2b')]?_0x31878[_0x01b2('0x29')]:_0x1a1e3b[_0x01b2('0x18')];if(_0x4ba89b[_0x01b2('0x15')]['includeAll']){_0x31878[_0x01b2('0x36')]=[{'all':!![]}];}_0x31878=_[_0x01b2('0x34')]({},_0x31878,_0x4ba89b[_0x01b2('0x35')]);return db['CmHopper'][_0x01b2('0x3c')](_0x31878)[_0x01b2('0x38')](handleEntityNotFound(_0xbd7259,null))[_0x01b2('0x38')](respondWithResult(_0xbd7259,null))[_0x01b2('0x3d')](handleError(_0xbd7259,null));};exports[_0x01b2('0x3e')]=function(_0x3f9451,_0x3eda44){return db[_0x01b2('0x10')]['create'](_0x3f9451[_0x01b2('0x3f')],{})[_0x01b2('0x38')](respondWithResult(_0x3eda44,0xc9))[_0x01b2('0x3d')](handleError(_0x3eda44,null));};exports[_0x01b2('0xa')]=function(_0xf36d42,_0x3469b3){if(_0xf36d42[_0x01b2('0x3f')]['id']){delete _0xf36d42['body']['id'];}return db[_0x01b2('0x10')][_0x01b2('0x3c')]({'where':{'id':_0xf36d42[_0x01b2('0x3b')]['id']}})[_0x01b2('0x38')](handleEntityNotFound(_0x3469b3,null))['then'](saveUpdates(_0xf36d42['body'],null))[_0x01b2('0x38')](respondWithResult(_0x3469b3,null))[_0x01b2('0x3d')](handleError(_0x3469b3,null));};exports[_0x01b2('0x40')]=function(_0x49370d,_0x7a6cae){return db[_0x01b2('0x10')][_0x01b2('0x40')]()[_0x01b2('0x38')](respondWithResult(_0x7a6cae,null))[_0x01b2('0x3d')](handleError(_0x7a6cae,null));};exports[_0x01b2('0x41')]=function(_0x5b54c5,_0x2a8b8d){var _0x5e0e70;var _0x272d0d=_0x5b54c5['params']['id'];return db['CmHopper'][_0x01b2('0x3c')]({'where':{'id':_0x5b54c5[_0x01b2('0x3b')]['id']}})[_0x01b2('0x38')](handleEntityNotFound(_0x2a8b8d,null))[_0x01b2('0x38')](function(_0x20cc59){if(_0x20cc59){return _0x20cc59['destroy']()['then'](function(_0x387954){return _0x387954;});}})[_0x01b2('0x38')](function(_0x3ee05b){_0x5e0e70=_0x3ee05b;if(_0x3ee05b){if(_0x3ee05b[_0x01b2('0x42')]||_0x3ee05b[_0x01b2('0x43')]){return db[_0x3ee05b[_0x01b2('0x42')]?'VoiceQueue':_0x01b2('0x44')][_0x01b2('0x3c')]({'where':{'id':_0x3ee05b[_0x01b2('0x42')]?_0x3ee05b[_0x01b2('0x42')]:_0x3ee05b[_0x01b2('0x43')]},'attributes':['id',_0x01b2('0x14')],'raw':!![]});}}})[_0x01b2('0x38')](function(_0x5dcafc){var _0x445fb2={};if(_0x5dcafc){_[_0x01b2('0x34')](_0x445fb2,_[_0x01b2('0x45')](_0x5e0e70[_0x01b2('0x46')],[_0x01b2('0x47'),_0x01b2('0x48'),'id']));_0x445fb2['state']=0x15;_0x445fb2[_0x01b2('0x49')]=_0x01b2('0x4a');_0x445fb2[_0x01b2('0x4b')]=_0x5dcafc[_0x01b2('0x14')];_0x445fb2[_0x01b2('0x4c')]=_0x5b54c5[_0x01b2('0x4d')][_0x01b2('0x14')];_0x445fb2[_0x01b2('0x4e')]=_0x5b54c5[_0x01b2('0x4d')]['id'];_0x445fb2[_0x01b2('0x4a')]=!![];_0x445fb2[_0x01b2('0x4f')]=moment()[_0x01b2('0x50')](_0x01b2('0x51'));_0x445fb2[_0x01b2('0x52')]=_0x5e0e70['phone'];_0x445fb2['campaigntype']=_0x5e0e70['VoiceQueueId']?'queue':_0x01b2('0x53');return db[_0x01b2('0x54')][_0x01b2('0x3c')]({'where':{'id':_0x445fb2['ContactId']},'attributes':[_0x01b2('0x55'),'lastName']})[_0x01b2('0x38')](function(_0x32371b){if(!_[_0x01b2('0x56')](_0x2a8b8d)&&!_[_0x01b2('0x56')](_0x32371b[_0x01b2('0x55')])){_0x445fb2['calleridname']=_0x32371b[_0x01b2('0x55')];if(!_['isNil'](_0x32371b[_0x01b2('0x57')])){_0x445fb2[_0x01b2('0x58')]+='\x20'+_0x32371b['lastName'];}}})[_0x01b2('0x59')](function(){return db['CmHopperFinal'][_0x01b2('0x3e')](_0x445fb2);});}})[_0x01b2('0x38')](function(_0x42c5b8){return db[_0x01b2('0x5a')][_0x01b2('0x41')]({'where':{'CmHopperId':_0x272d0d}});})[_0x01b2('0x38')](function(){return _0x2a8b8d[_0x01b2('0x4')](0xcc)[_0x01b2('0x5b')]();})[_0x01b2('0x3d')](handleError(_0x2a8b8d,null));};exports[_0x01b2('0x5c')]=function(_0x5d7da3,_0x2eb448){var _0x5655b6=[];return db[_0x01b2('0x54')][_0x01b2('0x40')]()[_0x01b2('0x38')](function(_0x58c8de){_0x5655b6=_[_0x01b2('0x5d')](_0x58c8de);return _0x5d7da3['user']['getVoiceQueues']({'where':{'type':_0x01b2('0x5e'),'dialActive':!![],'dialMethod':_0x01b2('0x5f')},'attributes':['id',_0x01b2('0x60'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x01b2('0x38')](function(_0x330cb4){if(_0x330cb4&&_0x330cb4[_0x01b2('0x2b')]){return db['sequelize'][_0x01b2('0x61')](function(_0x429b89){var _0xcbef9c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x01b2('0x50')](_0x01b2('0x51'))},'VoiceQueueId':{'$in':_[_0x01b2('0xf')](_0x330cb4,'id')},'$or':[{'UserId':null},{'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']}]};var _0x56c794={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x330cb4)['filter']([_0x01b2('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']}]};var _0x4ca277={'$or':[_0xcbef9c,_0x56c794]};var _0xbe104b=[];if(_0x5d7da3['body'][_0x01b2('0x63')]&&_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x63')]===_0x01b2('0x64')){if(!_['isEmpty'](_0x5d7da3[_0x01b2('0x3f')]['hopperIds'])){_0x4ca277['id']={'$in':_0x5d7da3[_0x01b2('0x3f')]['hopperIds']};}_0xbe104b=[[_0x01b2('0x65'),'ASC'],[_0x01b2('0x66'),_0x330cb4[0x0][_0x01b2('0x60')]==='ASC'?_0x01b2('0x67'):_0x01b2('0x68')],db[_0x01b2('0x69')][_0x01b2('0x6a')](_0x01b2('0x6b')),['id',_0x01b2('0x67')]];}else{if(!_[_0x01b2('0x6c')](_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x6d')])){_0x4ca277['id']={'$notIn':_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x6d')]};}_0xbe104b=[[_0x01b2('0x65'),_0x01b2('0x67')],['scheduledAt',_0x330cb4[0x0]['dialOrderByScheduledAt']],db[_0x01b2('0x69')][_0x01b2('0x6a')](_0x01b2('0x6e')),['id',_0x01b2('0x68')]];}return db[_0x01b2('0x10')][_0x01b2('0x6f')]({'attributes':['id',_0x01b2('0x70'),_0x01b2('0x71'),'recallme'],'where':_0x4ca277,'order':_0xbe104b,'transaction':_0x429b89,'lock':_0x429b89[_0x01b2('0x72')][_0x01b2('0x73')],'include':[{'model':db[_0x01b2('0x54')],'as':_0x01b2('0x74'),'attributes':_0x5655b6,'include':[{'model':db[_0x01b2('0x75')],'as':_0x01b2('0x76'),'attributes':['id',_0x01b2('0x14')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x01b2('0x14')]},{'model':db[_0x01b2('0x77')],'as':_0x01b2('0x78'),'attributes':['id','name',_0x01b2('0x79')]}]})[_0x01b2('0x38')](function(_0x240558){if(_0x240558){return _0x240558['update']({'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']},{'transaction':_0x429b89});}});});}})[_0x01b2('0x38')](handleEntityNotFound(_0x2eb448,null))[_0x01b2('0x38')](respondWithResult(_0x2eb448,null))['catch'](handleError(_0x2eb448,null));};exports['getPreviewRecall']=function(_0x2a820d,_0x4f1d6a,_0x1e1155){var _0x10d19f=[];var _0x2f41b6=_0x2a820d[_0x01b2('0x3b')]['id'];var _0x19a417=_0x2a820d[_0x01b2('0x4d')]['id'];return db['CmContact'][_0x01b2('0x40')]()[_0x01b2('0x38')](function(_0x45caa2){_0x10d19f=_[_0x01b2('0x5d')](_0x45caa2);return db[_0x01b2('0x69')][_0x01b2('0x61')](function(_0x5038b2){const _0x12f5ed={'id':_0x2f41b6};return db[_0x01b2('0x10')][_0x01b2('0x6f')]({'attributes':['id',_0x01b2('0x70'),_0x01b2('0x7a')],'where':_0x12f5ed,'transaction':_0x5038b2,'lock':_0x5038b2[_0x01b2('0x72')]['UPDATE'],'include':[{'model':db[_0x01b2('0x54')],'as':'Contact','attributes':_0x10d19f,'include':[{'model':db[_0x01b2('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x01b2('0x7b')],'as':_0x01b2('0x7c'),'attributes':['id','name']},{'model':db[_0x01b2('0x77')],'as':_0x01b2('0x78'),'attributes':['id',_0x01b2('0x14'),_0x01b2('0x79')]}]})['then'](function(_0x4095c2){if(_0x4095c2){return _0x4095c2[_0x01b2('0xa')]({'UserId':_0x19a417},{'transaction':_0x5038b2});}});});})[_0x01b2('0x38')](handleEntityNotFound(_0x4f1d6a,null))[_0x01b2('0x38')](respondWithResult(_0x4f1d6a,null))[_0x01b2('0x3d')](handleError(_0x4f1d6a,null));};exports[_0x01b2('0x7d')]=function(_0x27de72,_0x44034b){return _0x27de72[_0x01b2('0x4d')][_0x01b2('0x7e')]({'where':{'type':_0x01b2('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x01b2('0x38')](function(_0x3e17c3){if(_0x3e17c3&&_0x3e17c3[_0x01b2('0x2b')]){return db[_0x01b2('0x10')][_0x01b2('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x01b2('0x50')](_0x01b2('0x51'))},'VoiceQueueId':{'$in':_[_0x01b2('0xf')](_0x3e17c3,'id')},'$or':[{'UserId':null},{'UserId':_0x27de72['user']['id']}]}});}return 0x0;})['then'](function(_0xd37088){if(!_[_0x01b2('0x56')](_0xd37088)&&_[_0x01b2('0x7f')](_0xd37088)){return _0x44034b[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')]({'contacts':_0xd37088});}else{logger[_0x01b2('0xc')](_0x01b2('0x80'),_0x01b2('0x7d'),0x194,'entity\x20not\x20found');_0x44034b[_0x01b2('0xb')](0x194);}})[_0x01b2('0x3d')](handleError(_0x44034b,null));};exports[_0x01b2('0x81')]=function(_0x54ccc5,_0x24f9d4){var _0x2dec32=shared[_0x01b2('0x82')];var _0x35aef9=[];_['map'](_0x2dec32,function(_0x5b8abf){_0x35aef9['push']({'id':_0x5b8abf[_0x01b2('0x14')],'name':_0x5b8abf['name'],'utcOffset':_0x5b8abf[_0x01b2('0x83')]});});return _0x24f9d4[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')]({'tz':_0x35aef9});};exports[_0x01b2('0x84')]=function(_0x176ef,_0x372585){var _0x46e1ef=shared[_0x01b2('0x82')];var _0x3fb15f={};if(!_[_0x01b2('0x56')](_0x46e1ef[_0x176ef['body']['id']]))_0x3fb15f=_0x46e1ef[_0x176ef[_0x01b2('0x3f')]['id']];return _0x372585[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')](_0x3fb15f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9b82233..4b8e373 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 _0x7a54=['bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','priority','lodash','util','../../config/logger','moment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7a54,0x106));var _0x47a5=function(_0x47f85e,_0x2c34b6){_0x47f85e=_0x47f85e-0x0;var _0x513ed9=_0x7a54[_0x47f85e];return _0x513ed9;};'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':'scheduledat','fields':[_0x47a5('0xc')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0x47a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d118d,_0x4e71e2){var _0x1730fb=function(_0x2bf0c8){while(--_0x2bf0c8){_0x3d118d['push'](_0x3d118d['shift']());}};_0x1730fb(++_0x4e71e2);}(_0x5fab,0x177));var _0xb5fa=function(_0x845fcc,_0x518cfb){_0x845fcc=_0x845fcc-0x0;var _0x3a0e79=_0x5fab[_0x845fcc];return _0x3a0e79;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'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 3eaeecf..52eeff6 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 _0x2e12=['`scheduledat`\x20>=\x20','format','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','User','Agent','CmList','List','lodash','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','limit','include','attributes','map','model','then','info','stringify','catch','error','message','ShowCmHopper','where','debug','CreateCmHopper','body','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','LOCK','UPDATE','CmContact','Contact','keys','name','voicePause','length','UserId','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','sequelize','literal'];(function(_0x484fb3,_0x2bfa13){var _0x342859=function(_0x4c2c73){while(--_0x4c2c73){_0x484fb3['push'](_0x484fb3['shift']());}};_0x342859(++_0x2bfa13);}(_0x2e12,0xb1));var _0x22e1=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x2e12[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x22e1('0x0'));var util=require('util');var moment=require(_0x22e1('0x1'));var BPromise=require(_0x22e1('0x2'));var db=require(_0x22e1('0x3'))['db'];var logger=require('../../config/logger')(_0x22e1('0x4'));exports[_0x22e1('0x5')]=function(_0x573eb7){var _0x44581e=this;return new Promise(function(_0x910de5,_0x5069d2){return db[_0x22e1('0x6')][_0x22e1('0x7')]({'raw':_0x573eb7['options']?_0x573eb7[_0x22e1('0x8')][_0x22e1('0x9')]===undefined?!![]:![]:!![],'where':_0x573eb7[_0x22e1('0x8')]?_0x573eb7[_0x22e1('0x8')]['where']||null:null,'attributes':_0x573eb7[_0x22e1('0x8')]?_0x573eb7[_0x22e1('0x8')]['attributes']||null:null,'limit':_0x573eb7[_0x22e1('0x8')]?_0x573eb7[_0x22e1('0x8')][_0x22e1('0xa')]||null:null,'include':_0x573eb7[_0x22e1('0x8')]?_0x573eb7['options'][_0x22e1('0xb')]?_['map'](_0x573eb7[_0x22e1('0x8')][_0x22e1('0xb')],function(_0x1fe95e){return{'model':db[_0x1fe95e['model']],'as':_0x1fe95e['as'],'attributes':_0x1fe95e[_0x22e1('0xc')],'include':_0x1fe95e['include']?_[_0x22e1('0xd')](_0x1fe95e['include'],function(_0x471f51){return{'model':db[_0x471f51['model']],'as':_0x471f51['as'],'attributes':_0x471f51[_0x22e1('0xc')],'include':_0x471f51[_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x471f51['include'],function(_0x2e2ffb){return{'model':db[_0x2e2ffb[_0x22e1('0xe')]],'as':_0x2e2ffb['as'],'attributes':_0x2e2ffb['attributes']};}):[]};}):[]};}):[]:[]})[_0x22e1('0xf')](function(_0x45697f){logger[_0x22e1('0x10')]('GetCmHopper',_0x573eb7);logger['debug'](_0x22e1('0x5'),_0x573eb7,JSON[_0x22e1('0x11')](_0x45697f));_0x910de5(_0x45697f);})[_0x22e1('0x12')](function(_0x28b137){logger[_0x22e1('0x13')]('GetCmHopper',_0x28b137[_0x22e1('0x14')],_0x573eb7);_0x5069d2(_0x44581e['error'](0x1f4,_0x28b137[_0x22e1('0x14')]));});});};exports[_0x22e1('0x15')]=function(_0x5d3abb){var _0x2b6e0a=this;return new Promise(function(_0x21812a,_0x2326a7){return db['CmHopper']['find']({'raw':_0x5d3abb[_0x22e1('0x8')]?_0x5d3abb[_0x22e1('0x8')][_0x22e1('0x9')]===undefined?!![]:![]:!![],'where':_0x5d3abb[_0x22e1('0x8')]?_0x5d3abb[_0x22e1('0x8')][_0x22e1('0x16')]||null:null,'attributes':_0x5d3abb[_0x22e1('0x8')]?_0x5d3abb[_0x22e1('0x8')][_0x22e1('0xc')]||null:null,'include':_0x5d3abb[_0x22e1('0x8')]?_0x5d3abb['options'][_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x5d3abb[_0x22e1('0x8')]['include'],function(_0x571151){return{'model':db[_0x571151['model']],'as':_0x571151['as'],'attributes':_0x571151['attributes'],'include':_0x571151[_0x22e1('0xb')]?_['map'](_0x571151[_0x22e1('0xb')],function(_0x3cf668){return{'model':db[_0x3cf668[_0x22e1('0xe')]],'as':_0x3cf668['as'],'attributes':_0x3cf668['attributes'],'include':_0x3cf668[_0x22e1('0xb')]?_['map'](_0x3cf668[_0x22e1('0xb')],function(_0x43bb4c){return{'model':db[_0x43bb4c[_0x22e1('0xe')]],'as':_0x43bb4c['as'],'attributes':_0x43bb4c[_0x22e1('0xc')]};}):[]};}):[]};}):[]:[]})[_0x22e1('0xf')](function(_0x473290){logger[_0x22e1('0x10')](_0x22e1('0x15'),_0x5d3abb);logger[_0x22e1('0x17')]('ShowCmHopper',_0x5d3abb,JSON[_0x22e1('0x11')](_0x473290));_0x21812a(_0x473290);})['catch'](function(_0x3271f4){logger[_0x22e1('0x13')]('ShowCmHopper',_0x3271f4['message'],_0x5d3abb);_0x2326a7(_0x2b6e0a['error'](0x1f4,_0x3271f4[_0x22e1('0x14')]));});});};exports[_0x22e1('0x18')]=function(_0x2bb33b){var _0x28f53b=this;return new Promise(function(_0x4f05ea,_0x4d59f7){return db[_0x22e1('0x6')]['create'](_0x2bb33b[_0x22e1('0x19')],{'raw':_0x2bb33b[_0x22e1('0x8')]?_0x2bb33b[_0x22e1('0x8')][_0x22e1('0x9')]===undefined?!![]:![]:!![]})[_0x22e1('0xf')](function(_0x2a12c2){logger[_0x22e1('0x10')](_0x22e1('0x18'),_0x2bb33b);logger[_0x22e1('0x17')]('CreateCmHopper',_0x2bb33b,JSON[_0x22e1('0x11')](_0x2a12c2));_0x4f05ea(_0x2a12c2);})[_0x22e1('0x12')](function(_0x2b9d4f){logger[_0x22e1('0x13')](_0x22e1('0x18'),_0x2b9d4f[_0x22e1('0x14')],_0x2bb33b);_0x4d59f7(_0x28f53b[_0x22e1('0x13')](0x1f4,_0x2b9d4f[_0x22e1('0x14')]));});});};exports[_0x22e1('0x1a')]=function(_0x1e7188){var _0x44a598=this;return new Promise(function(_0x33ded2,_0x4731c5){return db[_0x22e1('0x6')]['update'](_0x1e7188['body'],{'raw':_0x1e7188['options']?_0x1e7188[_0x22e1('0x8')][_0x22e1('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7188[_0x22e1('0x8')]?_0x1e7188[_0x22e1('0x8')][_0x22e1('0x16')]||null:null,'attributes':_0x1e7188[_0x22e1('0x8')]?_0x1e7188[_0x22e1('0x8')][_0x22e1('0xc')]||null:null,'limit':_0x1e7188[_0x22e1('0x8')]?_0x1e7188['options'][_0x22e1('0xa')]||null:null})[_0x22e1('0xf')](function(_0x488488){logger['info'](_0x22e1('0x1a'),_0x1e7188);logger[_0x22e1('0x10')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x22e1('0x11')](_0x1e7188[_0x22e1('0x8')][_0x22e1('0x16')]),_0x1e7188[_0x22e1('0x19')][_0x22e1('0x1b')]);logger['debug'](_0x22e1('0x1a'),_0x1e7188,JSON[_0x22e1('0x11')](_0x488488));_0x33ded2(_0x488488);})[_0x22e1('0x12')](function(_0x42b171){logger[_0x22e1('0x13')]('UpdateCmHopper',_0x42b171[_0x22e1('0x14')],_0x1e7188);_0x4731c5(_0x44a598[_0x22e1('0x13')](0x1f4,_0x42b171[_0x22e1('0x14')]));});});};exports[_0x22e1('0x1c')]=function(_0x1a7842){var _0x356413=this;return new Promise(function(_0x5c915b,_0x14b010){return db[_0x22e1('0x6')][_0x22e1('0x1d')]({'where':_0x1a7842[_0x22e1('0x8')]?_0x1a7842['options'][_0x22e1('0x16')]||null:null})['then'](function(_0x17d1e){logger['info'](_0x22e1('0x1c'),_0x1a7842);logger[_0x22e1('0x17')]('DestroyCmHopper',_0x1a7842,JSON[_0x22e1('0x11')](_0x17d1e));_0x5c915b(_0x17d1e);})[_0x22e1('0x12')](function(_0x3f406e){logger[_0x22e1('0x13')](_0x22e1('0x1c'),_0x3f406e[_0x22e1('0x14')],_0x1a7842);_0x14b010(_0x356413['error'](0x1f4,_0x3f406e[_0x22e1('0x14')]));});});};exports[_0x22e1('0x1e')]=function(_0x23fa01){var _0x20d1c9=this;return new Promise(function(_0x5860f8,_0x370e70){return db['CmContact'][_0x22e1('0x1f')]()[_0x22e1('0xf')](function(_0x2831b2){return db['sequelize'][_0x22e1('0x20')](function(_0x7e846f){return db[_0x22e1('0x6')][_0x22e1('0x7')]({'where':_0x23fa01[_0x22e1('0x8')]?_0x23fa01['options'][_0x22e1('0x16')]||null:null,'attributes':_0x23fa01[_0x22e1('0x8')]?_0x23fa01[_0x22e1('0x8')][_0x22e1('0xc')]||null:null,'limit':_0x23fa01[_0x22e1('0x8')]?_0x23fa01['options'][_0x22e1('0xa')]||null:null,'order':_0x23fa01[_0x22e1('0x8')]?_0x23fa01[_0x22e1('0x8')][_0x22e1('0x21')]||null:null,'transaction':_0x7e846f,'lock':_0x7e846f[_0x22e1('0x22')][_0x22e1('0x23')],'include':[{'model':db[_0x22e1('0x24')],'as':_0x22e1('0x25'),'attributes':_[_0x22e1('0x26')](_0x2831b2)},{'model':db['User'],'as':'Agent','attributes':['id',_0x22e1('0x27'),_0x22e1('0x28')]}]})[_0x22e1('0xf')](function(_0x13459d){var _0xe13a3c=[];var _0x33a758=[];for(var _0x32298e=0x0;_0x32298e<_0x13459d[_0x22e1('0x29')];_0x32298e+=0x1){var _0xf040d2=_0x13459d[_0x32298e][_0x22e1('0x2a')];if(_0xf040d2===null){_0xe13a3c['push'](_0x13459d[_0x32298e][_0x22e1('0x2b')](_0x23fa01[_0x22e1('0x19')],{'transaction':_0x7e846f}));}else if(!_0x33a758[_0x22e1('0x2c')](_0xf040d2)){_0x33a758[_0x22e1('0x2d')](_0xf040d2);_0xe13a3c[_0x22e1('0x2d')](_0x13459d[_0x32298e]['update'](_0x23fa01[_0x22e1('0x19')],{'transaction':_0x7e846f}));}}return BPromise[_0x22e1('0x2e')](_0xe13a3c);});})['then'](function(_0x2cbd9a){logger[_0x22e1('0x10')]('GetContactDialer',_0x23fa01);if(_0x2cbd9a['length']>0x0){logger['info'](_0x22e1('0x2f'),_0x2cbd9a[0x0][_0x22e1('0x30')]['id'],_0x2cbd9a[0x0][_0x22e1('0x30')][_0x22e1('0x31')],_0x2cbd9a[0x0]['dataValues'][_0x22e1('0x1b')]);}logger[_0x22e1('0x17')](_0x22e1('0x1e'),_0x23fa01,JSON[_0x22e1('0x11')](_0x2cbd9a));_0x5860f8(_0x2cbd9a);})['catch'](function(_0x5aaef1){logger['error'](_0x22e1('0x1e'),_0x5aaef1[_0x22e1('0x14')],_0x23fa01);_0x370e70(_0x20d1c9[_0x22e1('0x13')](0x1f4,_0x5aaef1[_0x22e1('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x50432a){var _0x4e4307=this;return new Promise(function(_0x2cc8bc,_0x326d10){return db['sequelize']['transaction'](function(_0x2279b7){return db[_0x22e1('0x32')][_0x22e1('0x33')](_0x50432a['body'],{'raw':_0x50432a[_0x22e1('0x8')]?_0x50432a['options'][_0x22e1('0x9')]===undefined?!![]:![]:!![],'transaction':_0x2279b7})[_0x22e1('0xf')](function(){logger[_0x22e1('0x10')](_0x22e1('0x34'),JSON[_0x22e1('0x11')](_0x50432a['options'][_0x22e1('0x16')]),_0x50432a[_0x22e1('0x8')][_0x22e1('0x16')][_0x22e1('0x1b')]);return db[_0x22e1('0x6')][_0x22e1('0x1d')]({'where':_0x50432a[_0x22e1('0x8')]?_0x50432a[_0x22e1('0x8')]['where']||null:null,'transaction':_0x2279b7});});})[_0x22e1('0xf')](function(_0x2c7fd4){logger[_0x22e1('0x10')]('MoveContactManagedDialer',_0x50432a);logger[_0x22e1('0x17')](_0x22e1('0x35'),_0x50432a,JSON['stringify'](_0x2c7fd4));_0x2cc8bc(_0x2c7fd4);})[_0x22e1('0x12')](function(_0x5d4981){logger[_0x22e1('0x13')](_0x22e1('0x35'),_0x5d4981[_0x22e1('0x14')],_0x50432a);_0x326d10(_0x4e4307['error'](0x1f4,_0x5d4981['message']));});});};exports[_0x22e1('0x36')]=function(_0x1855b4){var _0x375ece=this;return new Promise(function(_0x4d8892,_0xb5ff08){return db['CmHopper'][_0x22e1('0x7')]({'raw':_0x1855b4[_0x22e1('0x8')]?_0x1855b4[_0x22e1('0x8')][_0x22e1('0x9')]===undefined?!![]:![]:!![],'where':_0x1855b4[_0x22e1('0x8')]?_0x1855b4[_0x22e1('0x8')][_0x22e1('0x16')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x22e1('0x37')]['fn']('IF',db[_0x22e1('0x37')][_0x22e1('0x38')](_0x22e1('0x39')+util[_0x22e1('0x3a')]('\x22%s\x22',moment()[_0x22e1('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x22e1('0xf')](function(_0x3aff57){logger[_0x22e1('0x10')](_0x22e1('0x36'),_0x1855b4);logger[_0x22e1('0x17')](_0x22e1('0x36'),_0x1855b4,JSON[_0x22e1('0x11')](_0x3aff57));_0x4d8892(_0x3aff57);})[_0x22e1('0x12')](function(_0x375b87){logger[_0x22e1('0x13')](_0x22e1('0x36'),_0x375b87[_0x22e1('0x14')],_0x1855b4);_0xb5ff08(_0x375ece[_0x22e1('0x13')](0x1f4,_0x375b87[_0x22e1('0x14')]));});});};exports['GetContactRecallMe']=function(_0x442d4e){var _0x492ff5=this;return new Promise(function(_0x53e3ed,_0xb19502){return db[_0x22e1('0x24')][_0x22e1('0x1f')]()[_0x22e1('0xf')](function(){return db['sequelize'][_0x22e1('0x20')](function(_0x206bdc){return db['CmHopper'][_0x22e1('0x7')]({'where':_0x442d4e[_0x22e1('0x8')]?_0x442d4e[_0x22e1('0x8')][_0x22e1('0x16')]||null:null,'attributes':_0x442d4e[_0x22e1('0x8')]?_0x442d4e[_0x22e1('0x8')][_0x22e1('0xc')]||null:null,'limit':0x1,'order':_0x442d4e['options']?_0x442d4e[_0x22e1('0x8')][_0x22e1('0x21')]||null:null,'group':db[_0x22e1('0x6')][_0x22e1('0x2a')],'transaction':_0x206bdc,'lock':_0x206bdc[_0x22e1('0x22')]['UPDATE'],'include':_0x442d4e[_0x22e1('0x8')]?_0x442d4e[_0x22e1('0x8')][_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x442d4e[_0x22e1('0x8')][_0x22e1('0xb')],function(_0x33e2bb){return{'model':db[_0x33e2bb[_0x22e1('0xe')]],'as':_0x33e2bb['as'],'attributes':_0x33e2bb['attributes'],'include':_0x33e2bb[_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x33e2bb[_0x22e1('0xb')],function(_0x2ff097){return{'model':db[_0x2ff097[_0x22e1('0xe')]],'as':_0x2ff097['as'],'attributes':_0x2ff097[_0x22e1('0xc')],'include':_0x2ff097[_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x2ff097['include'],function(_0xdba770){return{'model':db[_0xdba770['model']],'as':_0xdba770['as'],'attributes':_0xdba770[_0x22e1('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e0668){var _0x2bbfab=[];for(var _0x2958fb=0x0;_0x2958fb<_0x3e0668[_0x22e1('0x29')];_0x2958fb+=0x1){_0x2bbfab['push'](_0x3e0668[_0x2958fb]['update'](_0x442d4e[_0x22e1('0x19')],{'transaction':_0x206bdc}));}return BPromise['all'](_0x2bbfab);});})[_0x22e1('0xf')](function(_0x4453b8){logger[_0x22e1('0x10')]('GetContactRecallMe',_0x442d4e);logger[_0x22e1('0x17')](_0x22e1('0x3b'),_0x442d4e,JSON[_0x22e1('0x11')](_0x4453b8));_0x53e3ed(_0x4453b8);})['catch'](function(_0x3b3d8f){logger[_0x22e1('0x13')](_0x22e1('0x3b'),_0x3b3d8f[_0x22e1('0x14')],_0x442d4e);_0xb19502(_0x492ff5[_0x22e1('0x13')](0x1f4,_0x3b3d8f[_0x22e1('0x14')]));});});});};exports[_0x22e1('0x3c')]=function(_0x2dfe94){var _0x14ccd7=this;return new Promise(function(_0xd157dd,_0x210f66){db[_0x22e1('0x24')][_0x22e1('0x1f')]()[_0x22e1('0xf')](function(_0x9b54f){return db[_0x22e1('0x6')][_0x22e1('0x7')]({'raw':_0x2dfe94[_0x22e1('0x8')]?_0x2dfe94[_0x22e1('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2dfe94[_0x22e1('0x8')]?_0x2dfe94[_0x22e1('0x8')][_0x22e1('0x16')]||null:null,'attributes':_0x2dfe94['options']?_0x2dfe94[_0x22e1('0x8')][_0x22e1('0xc')]||null:null,'limit':_0x2dfe94[_0x22e1('0x8')]?_0x2dfe94[_0x22e1('0x8')][_0x22e1('0xa')]||null:null,'include':_0x2dfe94[_0x22e1('0x8')]?_0x2dfe94[_0x22e1('0x8')][_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x2dfe94['options'][_0x22e1('0xb')],function(_0x48eb20){return{'model':db[_0x48eb20[_0x22e1('0xe')]],'as':_0x48eb20['as'],'attributes':_0x48eb20['as']===_0x22e1('0x25')?_['keys'](_0x9b54f):_0x48eb20[_0x22e1('0xc')],'include':_0x48eb20[_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x48eb20['include'],function(_0x5c1904){return{'model':db[_0x5c1904[_0x22e1('0xe')]],'as':_0x5c1904['as'],'attributes':_0x5c1904[_0x22e1('0xc')],'include':_0x5c1904[_0x22e1('0xb')]?_[_0x22e1('0xd')](_0x5c1904[_0x22e1('0xb')],function(_0x5b00cf){return{'model':db[_0x5b00cf[_0x22e1('0xe')]],'as':_0x5b00cf['as'],'attributes':_0x5b00cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x22e1('0xf')](function(_0x1a889){logger['info'](_0x22e1('0x5'),_0x2dfe94);logger[_0x22e1('0x17')](_0x22e1('0x5'),_0x2dfe94,JSON[_0x22e1('0x11')](_0x1a889));_0xd157dd(_0x1a889);})[_0x22e1('0x12')](function(_0x1deb91){logger[_0x22e1('0x13')]('GetCmHopper',_0x1deb91['message'],_0x2dfe94);_0x210f66(_0x14ccd7[_0x22e1('0x13')](0x1f4,_0x1deb91[_0x22e1('0x14')]));});});});};exports[_0x22e1('0x3d')]=function(_0x326725){var _0x13ccd9=this;return new Promise(function(_0x43dcfc,_0x169a01){return db[_0x22e1('0x24')][_0x22e1('0x3e')]({'raw':!![],'where':{'phone':_0x326725['options'][_0x22e1('0x16')][_0x22e1('0x3f')]},'attributes':['id',_0x22e1('0x40')],'order':[['id',_0x22e1('0x41')]]})[_0x22e1('0xf')](function(_0x59d2f8){logger['info'](_0x22e1('0x42'),_0x326725);logger[_0x22e1('0x17')](_0x22e1('0x42'),_0x326725,JSON[_0x22e1('0x11')](_0x59d2f8));_0x43dcfc(_0x59d2f8);})['catch'](function(_0x38e7ba){logger['error'](_0x22e1('0x42'),_0x38e7ba[_0x22e1('0x14')],_0x326725);_0x169a01(_0x13ccd9[_0x22e1('0x13')](0x1f4,_0x38e7ba[_0x22e1('0x14')]));});});};exports[_0x22e1('0x43')]=function(_0x56bbd6){var _0x5201cb=this;return new Promise(function(_0x4de2fc,_0x2339ed){return db[_0x22e1('0x37')][_0x22e1('0x20')](function(_0x327472){var _0x39bd08=_0x56bbd6[_0x22e1('0x8')]&&_0x56bbd6[_0x22e1('0x8')][_0x22e1('0x16')]?_0x56bbd6[_0x22e1('0x8')]['where']:{};return db['CmHopper']['update'](_0x56bbd6['body'],{'where':_0x39bd08,'transaction':_0x327472})[_0x22e1('0xf')](function(_0x4a6a5a){logger[_0x22e1('0x10')](_0x22e1('0x43'),_0x56bbd6);logger[_0x22e1('0x17')]('ResetActiveCalls',_0x56bbd6,JSON['stringify'](_0x4a6a5a));_0x4de2fc(_0x4a6a5a);})[_0x22e1('0x12')](function(_0x332065){logger[_0x22e1('0x13')]('ResetActiveCalls',_0x332065[_0x22e1('0x14')],_0x56bbd6);_0x2339ed(_0x5201cb['error'](0x1f4,_0x332065['message']));});});});};exports[_0x22e1('0x44')]=function(_0x52c237){var _0x3c2dcf=this;var _0x2ccaeb=_0x52c237[_0x22e1('0x19')]['where'][_0x22e1('0x45')];var _0x44fa6e=_0x52c237[_0x22e1('0x19')][_0x22e1('0x16')][_0x22e1('0x46')];var _0x593bba=_0x52c237[_0x22e1('0x19')][_0x22e1('0x16')][_0x22e1('0x47')];return new Promise(function(_0x2c6933,_0x2c1d4b){return db[_0x22e1('0x6')][_0x22e1('0x7')]({'where':{'voiceQueueId':{'$in':_0x2ccaeb},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x22e1('0x37')][_0x22e1('0x38')](_0x22e1('0x48')+_0x44fa6e+'\x20MINUTE'),'$gt':db['sequelize'][_0x22e1('0x38')](_0x22e1('0x49'))}},'UserId':{'$in':_0x593bba}},'include':[{'model':db[_0x22e1('0x24')],'as':'Contact'},{'model':db[_0x22e1('0x4a')],'as':_0x22e1('0x4b'),'attributes':['id',_0x22e1('0x27'),_0x22e1('0x28')]},{'model':db[_0x22e1('0x4c')],'as':_0x22e1('0x4d')}]})[_0x22e1('0xf')](function(_0x20dd9f){if(_0x20dd9f[_0x22e1('0x29')]>0x0){return db[_0x22e1('0x37')][_0x22e1('0x20')](function(_0x5f3d3b){return db[_0x22e1('0x6')][_0x22e1('0x2b')]({'recallmeNotifiedDate':db['sequelize'][_0x22e1('0x38')](_0x22e1('0x49'))},{'where':{'id':{'$in':_[_0x22e1('0xd')](_0x20dd9f,'id')}},'transaction':_0x5f3d3b})['then'](function(){_0x2c6933(_0x20dd9f);})[_0x22e1('0x12')](function(_0x459128){logger[_0x22e1('0x13')](_0x22e1('0x44'),_0x459128[_0x22e1('0x14')],_0x52c237);_0x2c1d4b(_0x3c2dcf[_0x22e1('0x13')](0x1f4,_0x459128[_0x22e1('0x14')]));});})['catch'](function(_0x3a1ff9){logger['error'](_0x22e1('0x44'),_0x3a1ff9['message'],_0x52c237);_0x2c1d4b(_0x3c2dcf['error'](0x1f4,_0x3a1ff9[_0x22e1('0x14')]));});}else{_0x2c6933(_0x20dd9f);}});});}; \ No newline at end of file +var _0x493c=['where','info','CreateCmHopper','create','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','GetContactDialer','describe','transaction','order','LOCK','CmContact','Contact','keys','Agent','name','voicePause','UserId','push','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','destroy','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','all','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','util','moment','bluebird','../../config/logger','CmHopper','findAll','options','raw','attributes','limit','include','model','map','then','debug','GetCmHopper','stringify','catch','error','message','ShowCmHopper'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x493c,0x123));var _0xc493=function(_0x40fade,_0x36cc38){_0x40fade=_0x40fade-0x0;var _0x4eec6d=_0x493c[_0x40fade];return _0x4eec6d;};'use strict';var _=require('lodash');var util=require(_0xc493('0x0'));var moment=require(_0xc493('0x1'));var BPromise=require(_0xc493('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc493('0x3'))('rpc');exports['GetCmHopper']=function(_0xe51de9){var _0x2b2630=this;return new Promise(function(_0x12bc9f,_0x56f87d){return db[_0xc493('0x4')][_0xc493('0x5')]({'raw':_0xe51de9[_0xc493('0x6')]?_0xe51de9[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![],'where':_0xe51de9[_0xc493('0x6')]?_0xe51de9[_0xc493('0x6')]['where']||null:null,'attributes':_0xe51de9['options']?_0xe51de9[_0xc493('0x6')][_0xc493('0x8')]||null:null,'limit':_0xe51de9['options']?_0xe51de9[_0xc493('0x6')][_0xc493('0x9')]||null:null,'include':_0xe51de9['options']?_0xe51de9['options'][_0xc493('0xa')]?_['map'](_0xe51de9[_0xc493('0x6')]['include'],function(_0x29931b){return{'model':db[_0x29931b[_0xc493('0xb')]],'as':_0x29931b['as'],'attributes':_0x29931b[_0xc493('0x8')],'include':_0x29931b[_0xc493('0xa')]?_[_0xc493('0xc')](_0x29931b[_0xc493('0xa')],function(_0x4bd447){return{'model':db[_0x4bd447[_0xc493('0xb')]],'as':_0x4bd447['as'],'attributes':_0x4bd447[_0xc493('0x8')],'include':_0x4bd447[_0xc493('0xa')]?_[_0xc493('0xc')](_0x4bd447[_0xc493('0xa')],function(_0x2ca881){return{'model':db[_0x2ca881[_0xc493('0xb')]],'as':_0x2ca881['as'],'attributes':_0x2ca881['attributes']};}):[]};}):[]};}):[]:[]})[_0xc493('0xd')](function(_0x1e6717){logger['info']('GetCmHopper',_0xe51de9);logger[_0xc493('0xe')](_0xc493('0xf'),_0xe51de9,JSON[_0xc493('0x10')](_0x1e6717));_0x12bc9f(_0x1e6717);})[_0xc493('0x11')](function(_0x49c68a){logger[_0xc493('0x12')](_0xc493('0xf'),_0x49c68a[_0xc493('0x13')],_0xe51de9);_0x56f87d(_0x2b2630[_0xc493('0x12')](0x1f4,_0x49c68a[_0xc493('0x13')]));});});};exports[_0xc493('0x14')]=function(_0x1758c5){var _0x2b1e05=this;return new Promise(function(_0x54a467,_0x2b3fed){return db[_0xc493('0x4')]['find']({'raw':_0x1758c5['options']?_0x1758c5[_0xc493('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x1758c5[_0xc493('0x6')]?_0x1758c5['options'][_0xc493('0x15')]||null:null,'attributes':_0x1758c5[_0xc493('0x6')]?_0x1758c5[_0xc493('0x6')][_0xc493('0x8')]||null:null,'include':_0x1758c5[_0xc493('0x6')]?_0x1758c5[_0xc493('0x6')][_0xc493('0xa')]?_['map'](_0x1758c5[_0xc493('0x6')][_0xc493('0xa')],function(_0x4d5ad5){return{'model':db[_0x4d5ad5['model']],'as':_0x4d5ad5['as'],'attributes':_0x4d5ad5[_0xc493('0x8')],'include':_0x4d5ad5['include']?_[_0xc493('0xc')](_0x4d5ad5['include'],function(_0x3283b7){return{'model':db[_0x3283b7[_0xc493('0xb')]],'as':_0x3283b7['as'],'attributes':_0x3283b7['attributes'],'include':_0x3283b7['include']?_['map'](_0x3283b7[_0xc493('0xa')],function(_0x41941a){return{'model':db[_0x41941a[_0xc493('0xb')]],'as':_0x41941a['as'],'attributes':_0x41941a[_0xc493('0x8')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xd')](function(_0x462c0a){logger[_0xc493('0x16')]('ShowCmHopper',_0x1758c5);logger['debug'](_0xc493('0x14'),_0x1758c5,JSON[_0xc493('0x10')](_0x462c0a));_0x54a467(_0x462c0a);})['catch'](function(_0x110d8f){logger['error'](_0xc493('0x14'),_0x110d8f[_0xc493('0x13')],_0x1758c5);_0x2b3fed(_0x2b1e05[_0xc493('0x12')](0x1f4,_0x110d8f[_0xc493('0x13')]));});});};exports[_0xc493('0x17')]=function(_0x1c3e51){var _0x26e69b=this;return new Promise(function(_0x5e2b18,_0x133648){return db[_0xc493('0x4')][_0xc493('0x18')](_0x1c3e51['body'],{'raw':_0x1c3e51[_0xc493('0x6')]?_0x1c3e51[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![]})[_0xc493('0xd')](function(_0xd928cd){logger['info']('CreateCmHopper',_0x1c3e51);logger['debug'](_0xc493('0x17'),_0x1c3e51,JSON[_0xc493('0x10')](_0xd928cd));_0x5e2b18(_0xd928cd);})['catch'](function(_0x10aa3e){logger[_0xc493('0x12')](_0xc493('0x17'),_0x10aa3e[_0xc493('0x13')],_0x1c3e51);_0x133648(_0x26e69b[_0xc493('0x12')](0x1f4,_0x10aa3e['message']));});});};exports[_0xc493('0x19')]=function(_0x1171db){var _0x2559fd=this;return new Promise(function(_0x1463d9,_0x4e4ad6){return db[_0xc493('0x4')][_0xc493('0x1a')](_0x1171db['body'],{'raw':_0x1171db[_0xc493('0x6')]?_0x1171db['options'][_0xc493('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1171db[_0xc493('0x6')]?_0x1171db[_0xc493('0x6')][_0xc493('0x15')]||null:null,'attributes':_0x1171db[_0xc493('0x6')]?_0x1171db[_0xc493('0x6')][_0xc493('0x8')]||null:null,'limit':_0x1171db[_0xc493('0x6')]?_0x1171db[_0xc493('0x6')][_0xc493('0x9')]||null:null})[_0xc493('0xd')](function(_0x4ffba7){logger[_0xc493('0x16')](_0xc493('0x19'),_0x1171db);logger[_0xc493('0x16')](_0xc493('0x1b'),JSON[_0xc493('0x10')](_0x1171db[_0xc493('0x6')][_0xc493('0x15')]),_0x1171db[_0xc493('0x1c')][_0xc493('0x1d')]);logger['debug']('UpdateCmHopper',_0x1171db,JSON[_0xc493('0x10')](_0x4ffba7));_0x1463d9(_0x4ffba7);})[_0xc493('0x11')](function(_0x42cb6c){logger[_0xc493('0x12')](_0xc493('0x19'),_0x42cb6c[_0xc493('0x13')],_0x1171db);_0x4e4ad6(_0x2559fd['error'](0x1f4,_0x42cb6c[_0xc493('0x13')]));});});};exports[_0xc493('0x1e')]=function(_0x1f4de8){var _0x7e3988=this;return new Promise(function(_0x52a024,_0x43443e){return db[_0xc493('0x4')]['destroy']({'where':_0x1f4de8[_0xc493('0x6')]?_0x1f4de8[_0xc493('0x6')][_0xc493('0x15')]||null:null})['then'](function(_0xf710e6){logger[_0xc493('0x16')]('DestroyCmHopper',_0x1f4de8);logger[_0xc493('0xe')](_0xc493('0x1e'),_0x1f4de8,JSON['stringify'](_0xf710e6));_0x52a024(_0xf710e6);})[_0xc493('0x11')](function(_0x35c9b5){logger[_0xc493('0x12')](_0xc493('0x1e'),_0x35c9b5['message'],_0x1f4de8);_0x43443e(_0x7e3988[_0xc493('0x12')](0x1f4,_0x35c9b5[_0xc493('0x13')]));});});};exports[_0xc493('0x1f')]=function(_0x17d939){var _0x372535=this;return new Promise(function(_0xf208c4,_0x594552){return db['CmContact'][_0xc493('0x20')]()[_0xc493('0xd')](function(_0x389cee){return db['sequelize'][_0xc493('0x21')](function(_0x149dc4){return db[_0xc493('0x4')][_0xc493('0x5')]({'where':_0x17d939[_0xc493('0x6')]?_0x17d939['options'][_0xc493('0x15')]||null:null,'attributes':_0x17d939[_0xc493('0x6')]?_0x17d939[_0xc493('0x6')][_0xc493('0x8')]||null:null,'limit':_0x17d939[_0xc493('0x6')]?_0x17d939['options']['limit']||null:null,'order':_0x17d939['options']?_0x17d939[_0xc493('0x6')][_0xc493('0x22')]||null:null,'transaction':_0x149dc4,'lock':_0x149dc4[_0xc493('0x23')]['UPDATE'],'include':[{'model':db[_0xc493('0x24')],'as':_0xc493('0x25'),'attributes':_[_0xc493('0x26')](_0x389cee)},{'model':db['User'],'as':_0xc493('0x27'),'attributes':['id',_0xc493('0x28'),_0xc493('0x29')]}]})[_0xc493('0xd')](function(_0x458004){var _0x426494=[];var _0x2c58a9=[];for(var _0xeb36d4=0x0;_0xeb36d4<_0x458004['length'];_0xeb36d4+=0x1){var _0x3c0209=_0x458004[_0xeb36d4][_0xc493('0x2a')];if(_0x3c0209===null){_0x426494[_0xc493('0x2b')](_0x458004[_0xeb36d4][_0xc493('0x1a')](_0x17d939[_0xc493('0x1c')],{'transaction':_0x149dc4}));}else if(!_0x2c58a9['includes'](_0x3c0209)){_0x2c58a9[_0xc493('0x2b')](_0x3c0209);_0x426494['push'](_0x458004[_0xeb36d4][_0xc493('0x1a')](_0x17d939[_0xc493('0x1c')],{'transaction':_0x149dc4}));}}return BPromise['all'](_0x426494);});})[_0xc493('0xd')](function(_0x44cc2d){logger[_0xc493('0x16')](_0xc493('0x1f'),_0x17d939);if(_0x44cc2d[_0xc493('0x2c')]>0x0){logger[_0xc493('0x16')](_0xc493('0x2d'),_0x44cc2d[0x0]['dataValues']['id'],_0x44cc2d[0x0][_0xc493('0x2e')]['ContactId'],_0x44cc2d[0x0]['dataValues'][_0xc493('0x1d')]);}logger[_0xc493('0xe')](_0xc493('0x1f'),_0x17d939,JSON[_0xc493('0x10')](_0x44cc2d));_0xf208c4(_0x44cc2d);})[_0xc493('0x11')](function(_0x4c5ecb){logger[_0xc493('0x12')](_0xc493('0x1f'),_0x4c5ecb[_0xc493('0x13')],_0x17d939);_0x594552(_0x372535[_0xc493('0x12')](0x1f4,_0x4c5ecb[_0xc493('0x13')]));});});});};exports[_0xc493('0x2f')]=function(_0x294ddd){var _0x216a37=this;return new Promise(function(_0x9a9f12,_0x5fdf5d){return db[_0xc493('0x30')][_0xc493('0x21')](function(_0x435821){return db['CmHopperFinal'][_0xc493('0x18')](_0x294ddd['body'],{'raw':_0x294ddd[_0xc493('0x6')]?_0x294ddd[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![],'transaction':_0x435821})[_0xc493('0xd')](function(){logger[_0xc493('0x16')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc493('0x10')](_0x294ddd[_0xc493('0x6')][_0xc493('0x15')]),_0x294ddd[_0xc493('0x6')][_0xc493('0x15')][_0xc493('0x1d')]);return db[_0xc493('0x4')][_0xc493('0x31')]({'where':_0x294ddd[_0xc493('0x6')]?_0x294ddd['options'][_0xc493('0x15')]||null:null,'transaction':_0x435821});});})[_0xc493('0xd')](function(_0x300cd0){logger[_0xc493('0x16')]('MoveContactManagedDialer',_0x294ddd);logger[_0xc493('0xe')]('MoveContactManagedDialer',_0x294ddd,JSON['stringify'](_0x300cd0));_0x9a9f12(_0x300cd0);})[_0xc493('0x11')](function(_0x38a633){logger['error'](_0xc493('0x2f'),_0x38a633[_0xc493('0x13')],_0x294ddd);_0x5fdf5d(_0x216a37['error'](0x1f4,_0x38a633['message']));});});};exports['CountReScheduled']=function(_0xbe3753){var _0x1fc32a=this;return new Promise(function(_0x1f64b8,_0x545385){return db['CmHopper'][_0xc493('0x5')]({'raw':_0xbe3753[_0xc493('0x6')]?_0xbe3753[_0xc493('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0xbe3753[_0xc493('0x6')]?_0xbe3753[_0xc493('0x6')]['where']||null:null,'attributes':[[db[_0xc493('0x30')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc493('0x30')][_0xc493('0x32')](_0xc493('0x33')+util[_0xc493('0x34')](_0xc493('0x35'),moment()[_0xc493('0x34')](_0xc493('0x36')))+_0xc493('0x37')))),_0xc493('0x38')]]})[_0xc493('0xd')](function(_0x5095e8){logger[_0xc493('0x16')]('CountReScheduled',_0xbe3753);logger[_0xc493('0xe')]('CountReScheduled',_0xbe3753,JSON[_0xc493('0x10')](_0x5095e8));_0x1f64b8(_0x5095e8);})[_0xc493('0x11')](function(_0x5d3e9b){logger[_0xc493('0x12')](_0xc493('0x39'),_0x5d3e9b['message'],_0xbe3753);_0x545385(_0x1fc32a[_0xc493('0x12')](0x1f4,_0x5d3e9b[_0xc493('0x13')]));});});};exports[_0xc493('0x3a')]=function(_0x27744f){var _0x1010d1=this;return new Promise(function(_0x4f79b6,_0x6e3610){return db[_0xc493('0x24')][_0xc493('0x20')]()[_0xc493('0xd')](function(){return db['sequelize'][_0xc493('0x21')](function(_0x579eda){return db['CmHopper'][_0xc493('0x5')]({'where':_0x27744f[_0xc493('0x6')]?_0x27744f['options'][_0xc493('0x15')]||null:null,'attributes':_0x27744f[_0xc493('0x6')]?_0x27744f['options'][_0xc493('0x8')]||null:null,'limit':0x1,'order':_0x27744f[_0xc493('0x6')]?_0x27744f[_0xc493('0x6')][_0xc493('0x22')]||null:null,'group':db['CmHopper'][_0xc493('0x2a')],'transaction':_0x579eda,'lock':_0x579eda[_0xc493('0x23')][_0xc493('0x3b')],'include':_0x27744f['options']?_0x27744f[_0xc493('0x6')]['include']?_[_0xc493('0xc')](_0x27744f[_0xc493('0x6')][_0xc493('0xa')],function(_0x420813){return{'model':db[_0x420813[_0xc493('0xb')]],'as':_0x420813['as'],'attributes':_0x420813[_0xc493('0x8')],'include':_0x420813[_0xc493('0xa')]?_[_0xc493('0xc')](_0x420813[_0xc493('0xa')],function(_0x4322a7){return{'model':db[_0x4322a7[_0xc493('0xb')]],'as':_0x4322a7['as'],'attributes':_0x4322a7[_0xc493('0x8')],'include':_0x4322a7[_0xc493('0xa')]?_[_0xc493('0xc')](_0x4322a7['include'],function(_0x5a19f1){return{'model':db[_0x5a19f1['model']],'as':_0x5a19f1['as'],'attributes':_0x5a19f1[_0xc493('0x8')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xd')](function(_0x48e205){var _0x5cdde7=[];for(var _0x400e0f=0x0;_0x400e0f<_0x48e205[_0xc493('0x2c')];_0x400e0f+=0x1){_0x5cdde7[_0xc493('0x2b')](_0x48e205[_0x400e0f][_0xc493('0x1a')](_0x27744f[_0xc493('0x1c')],{'transaction':_0x579eda}));}return BPromise[_0xc493('0x3c')](_0x5cdde7);});})[_0xc493('0xd')](function(_0x416333){logger['info'](_0xc493('0x3a'),_0x27744f);logger[_0xc493('0xe')](_0xc493('0x3a'),_0x27744f,JSON['stringify'](_0x416333));_0x4f79b6(_0x416333);})['catch'](function(_0x199642){logger[_0xc493('0x12')](_0xc493('0x3a'),_0x199642[_0xc493('0x13')],_0x27744f);_0x6e3610(_0x1010d1[_0xc493('0x12')](0x1f4,_0x199642[_0xc493('0x13')]));});});});};exports[_0xc493('0x3d')]=function(_0x329107){var _0x2d4aaa=this;return new Promise(function(_0x2b1dec,_0x42cafb){db['CmContact']['describe']()['then'](function(_0x4ced15){return db[_0xc493('0x4')][_0xc493('0x5')]({'raw':_0x329107[_0xc493('0x6')]?_0x329107[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![],'where':_0x329107['options']?_0x329107[_0xc493('0x6')][_0xc493('0x15')]||null:null,'attributes':_0x329107[_0xc493('0x6')]?_0x329107[_0xc493('0x6')]['attributes']||null:null,'limit':_0x329107['options']?_0x329107[_0xc493('0x6')]['limit']||null:null,'include':_0x329107['options']?_0x329107[_0xc493('0x6')][_0xc493('0xa')]?_[_0xc493('0xc')](_0x329107[_0xc493('0x6')][_0xc493('0xa')],function(_0x3fcc52){return{'model':db[_0x3fcc52['model']],'as':_0x3fcc52['as'],'attributes':_0x3fcc52['as']===_0xc493('0x25')?_[_0xc493('0x26')](_0x4ced15):_0x3fcc52[_0xc493('0x8')],'include':_0x3fcc52[_0xc493('0xa')]?_[_0xc493('0xc')](_0x3fcc52[_0xc493('0xa')],function(_0x2bf1d1){return{'model':db[_0x2bf1d1[_0xc493('0xb')]],'as':_0x2bf1d1['as'],'attributes':_0x2bf1d1['attributes'],'include':_0x2bf1d1[_0xc493('0xa')]?_[_0xc493('0xc')](_0x2bf1d1['include'],function(_0x314143){return{'model':db[_0x314143[_0xc493('0xb')]],'as':_0x314143['as'],'attributes':_0x314143[_0xc493('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27c41f){logger[_0xc493('0x16')]('GetCmHopper',_0x329107);logger[_0xc493('0xe')](_0xc493('0xf'),_0x329107,JSON[_0xc493('0x10')](_0x27c41f));_0x2b1dec(_0x27c41f);})[_0xc493('0x11')](function(_0x2159b5){logger[_0xc493('0x12')]('GetCmHopper',_0x2159b5[_0xc493('0x13')],_0x329107);_0x42cafb(_0x2d4aaa[_0xc493('0x12')](0x1f4,_0x2159b5[_0xc493('0x13')]));});});});};exports[_0xc493('0x3e')]=function(_0x4e85de){var _0x512b0f=this;return new Promise(function(_0x1171ae,_0xde0ad6){return db[_0xc493('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x4e85de[_0xc493('0x6')][_0xc493('0x15')][_0xc493('0x3f')]},'attributes':['id',_0xc493('0x40')],'order':[['id',_0xc493('0x41')]]})[_0xc493('0xd')](function(_0x34ebf8){logger[_0xc493('0x16')](_0xc493('0x42'),_0x4e85de);logger[_0xc493('0xe')](_0xc493('0x42'),_0x4e85de,JSON[_0xc493('0x10')](_0x34ebf8));_0x1171ae(_0x34ebf8);})[_0xc493('0x11')](function(_0x49aac5){logger[_0xc493('0x12')](_0xc493('0x42'),_0x49aac5[_0xc493('0x13')],_0x4e85de);_0xde0ad6(_0x512b0f[_0xc493('0x12')](0x1f4,_0x49aac5[_0xc493('0x13')]));});});};exports[_0xc493('0x43')]=function(_0x48f67e){var _0x558d92=this;return new Promise(function(_0x17c82d,_0x189d14){return db[_0xc493('0x30')][_0xc493('0x21')](function(_0x2f64d3){var _0x569422=_0x48f67e['options']&&_0x48f67e['options']['where']?_0x48f67e[_0xc493('0x6')][_0xc493('0x15')]:{};return db[_0xc493('0x4')][_0xc493('0x1a')](_0x48f67e[_0xc493('0x1c')],{'where':_0x569422,'transaction':_0x2f64d3})[_0xc493('0xd')](function(_0x3fa4ae){logger['info'](_0xc493('0x43'),_0x48f67e);logger[_0xc493('0xe')](_0xc493('0x43'),_0x48f67e,JSON[_0xc493('0x10')](_0x3fa4ae));_0x17c82d(_0x3fa4ae);})[_0xc493('0x11')](function(_0x416a90){logger[_0xc493('0x12')]('ResetActiveCalls',_0x416a90['message'],_0x48f67e);_0x189d14(_0x558d92['error'](0x1f4,_0x416a90[_0xc493('0x13')]));});});});};exports[_0xc493('0x44')]=function(_0x4c1c8b){var _0x3e61e8=this;var _0x3da32e=_0x4c1c8b['body'][_0xc493('0x15')][_0xc493('0x45')];var _0x426d91=_0x4c1c8b[_0xc493('0x1c')]['where'][_0xc493('0x46')];var _0x1adc01=_0x4c1c8b[_0xc493('0x1c')][_0xc493('0x15')][_0xc493('0x47')];return new Promise(function(_0x7c5963,_0x5a8dd7){return db['CmHopper'][_0xc493('0x5')]({'where':{'voiceQueueId':{'$in':_0x3da32e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc493('0x30')][_0xc493('0x32')](_0xc493('0x48')+_0x426d91+_0xc493('0x49')),'$gt':db[_0xc493('0x30')]['literal'](_0xc493('0x4a'))}},'UserId':{'$in':_0x1adc01}},'include':[{'model':db[_0xc493('0x24')],'as':_0xc493('0x25')},{'model':db[_0xc493('0x4b')],'as':_0xc493('0x27'),'attributes':['id',_0xc493('0x28'),_0xc493('0x29')]},{'model':db[_0xc493('0x4c')],'as':_0xc493('0x4d')}]})['then'](function(_0x44e05d){if(_0x44e05d[_0xc493('0x2c')]>0x0){return db[_0xc493('0x30')][_0xc493('0x21')](function(_0x1572df){return db['CmHopper'][_0xc493('0x1a')]({'recallmeNotifiedDate':db[_0xc493('0x30')][_0xc493('0x32')]('NOW()')},{'where':{'id':{'$in':_[_0xc493('0xc')](_0x44e05d,'id')}},'transaction':_0x1572df})['then'](function(){_0x7c5963(_0x44e05d);})[_0xc493('0x11')](function(_0x4ad435){logger[_0xc493('0x12')](_0xc493('0x44'),_0x4ad435['message'],_0x4c1c8b);_0x5a8dd7(_0x3e61e8['error'](0x1f4,_0x4ad435[_0xc493('0x13')]));});})[_0xc493('0x11')](function(_0x556b05){logger[_0xc493('0x12')](_0xc493('0x44'),_0x556b05[_0xc493('0x13')],_0x4c1c8b);_0x5a8dd7(_0x3e61e8[_0xc493('0x12')](0x1f4,_0x556b05[_0xc493('0x13')]));});}else{_0x7c5963(_0x44e05d);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b8b4ec9..22c111d 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 _0x2634=['delete','exports','../../components/auth/service','isAuthenticated','index','/describe','get','/opencontacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','getPreview','/timezone','getTimezone','put','update'];(function(_0x6a0134,_0x347cda){var _0x4c9012=function(_0x1c48b6){while(--_0x1c48b6){_0x6a0134['push'](_0x6a0134['shift']());}};_0x4c9012(++_0x347cda);}(_0x2634,0x156));var _0x4263=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2634[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4263('0x0'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x4263('0x1')](),controller[_0x4263('0x2')]);router['get'](_0x4263('0x3'),auth['isAuthenticated'](),controller['describe']);router[_0x4263('0x4')](_0x4263('0x5'),auth[_0x4263('0x1')](),controller['getOpenContacts']);router[_0x4263('0x4')](_0x4263('0x6'),auth[_0x4263('0x1')](),controller[_0x4263('0x7')]);router[_0x4263('0x4')](_0x4263('0x8'),auth[_0x4263('0x1')](),controller[_0x4263('0x9')]);router[_0x4263('0x4')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x4263('0xa')]);router[_0x4263('0xb')]('/',auth[_0x4263('0x1')](),controller[_0x4263('0xc')]);router[_0x4263('0xb')]('/preview',auth[_0x4263('0x1')](),controller[_0x4263('0xd')]);router[_0x4263('0xb')](_0x4263('0xe'),auth[_0x4263('0x1')](),controller[_0x4263('0xf')]);router[_0x4263('0x10')](_0x4263('0x8'),auth[_0x4263('0x1')](),controller[_0x4263('0x11')]);router[_0x4263('0x12')](_0x4263('0x8'),auth[_0x4263('0x1')](),controller['destroy']);module[_0x4263('0x13')]=router; \ No newline at end of file +var _0x14e4=['put','update','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview'];(function(_0x6cddd2,_0x519625){var _0x2a7212=function(_0x34a370){while(--_0x34a370){_0x6cddd2['push'](_0x6cddd2['shift']());}};_0x2a7212(++_0x519625);}(_0x14e4,0x15d));var _0x414e=function(_0xc3d3ec,_0x54cdb3){_0xc3d3ec=_0xc3d3ec-0x0;var _0x549649=_0x14e4[_0xc3d3ec];return _0x549649;};'use strict';var express=require(_0x414e('0x0'));var router=express[_0x414e('0x1')]();var auth=require(_0x414e('0x2'));var controller=require(_0x414e('0x3'));router[_0x414e('0x4')]('/',auth[_0x414e('0x5')](),controller[_0x414e('0x6')]);router[_0x414e('0x4')](_0x414e('0x7'),auth['isAuthenticated'](),controller[_0x414e('0x8')]);router[_0x414e('0x4')]('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x414e('0x9'),auth[_0x414e('0x5')](),controller[_0x414e('0xa')]);router[_0x414e('0x4')](_0x414e('0xb'),auth[_0x414e('0x5')](),controller[_0x414e('0xc')]);router[_0x414e('0x4')](_0x414e('0xd'),auth[_0x414e('0x5')](),controller[_0x414e('0xe')]);router[_0x414e('0xf')]('/',auth[_0x414e('0x5')](),controller[_0x414e('0x10')]);router[_0x414e('0xf')](_0x414e('0x11'),auth[_0x414e('0x5')](),controller[_0x414e('0x12')]);router[_0x414e('0xf')]('/timezone',auth[_0x414e('0x5')](),controller['getTimezone']);router[_0x414e('0x13')](_0x414e('0xb'),auth[_0x414e('0x5')](),controller[_0x414e('0x14')]);router['delete'](_0x414e('0xb'),auth[_0x414e('0x5')](),controller[_0x414e('0x15')]);module[_0x414e('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4ee2435..5bb8ee7 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf72=['DATE','format','sequelize','exports','INTEGER','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcf72,0x74));var _0x2cf7=function(_0x503af3,_0x581c9f){_0x503af3=_0x503af3-0x0;var _0x287b92=_0xcf72[_0x503af3];return _0x287b92;};'use strict';var moment=require('moment');var Sequelize=require(_0x2cf7('0x0'));module[_0x2cf7('0x1')]={'CmHopperId':{'type':Sequelize[_0x2cf7('0x2')]},'phone':{'type':Sequelize[_0x2cf7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2cf7('0x4')],'defaultValue':moment()[_0x2cf7('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x64bd=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x64bd,0x171));var _0xd64b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x64bd[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xd64b('0x0'));var Sequelize=require(_0xd64b('0x1'));module[_0xd64b('0x2')]={'CmHopperId':{'type':Sequelize[_0xd64b('0x3')]},'phone':{'type':Sequelize[_0xd64b('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd64b('0x5')](_0xd64b('0x6'))},'countbusyretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index e93a378..7c0d77f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3b5=['map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','find','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','name','send','index'];(function(_0x4da5a2,_0x49211b){var _0x5a2f74=function(_0x5b1ce1){while(--_0x5b1ce1){_0x4da5a2['push'](_0x4da5a2['shift']());}};_0x5a2f74(++_0x49211b);}(_0xe3b5,0x7d));var _0x5e3b=function(_0x19f721,_0x5c04fe){_0x19f721=_0x19f721-0x0;var _0x121a7c=_0xe3b5[_0x19f721];return _0x121a7c;};'use strict';var emlformat=require(_0x5e3b('0x0'));var rimraf=require(_0x5e3b('0x1'));var zipdir=require(_0x5e3b('0x2'));var jsonpatch=require(_0x5e3b('0x3'));var rp=require(_0x5e3b('0x4'));var moment=require(_0x5e3b('0x5'));var BPromise=require(_0x5e3b('0x6'));var Mustache=require(_0x5e3b('0x7'));var util=require(_0x5e3b('0x8'));var path=require(_0x5e3b('0x9'));var sox=require(_0x5e3b('0xa'));var csv=require(_0x5e3b('0xb'));var ejs=require(_0x5e3b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e3b('0xd'));var _=require(_0x5e3b('0xe'));var squel=require(_0x5e3b('0xf'));var crypto=require(_0x5e3b('0x10'));var jsforce=require(_0x5e3b('0x11'));var deskjs=require(_0x5e3b('0x12'));var toCsv=require('to-csv');var querystring=require(_0x5e3b('0x13'));var Papa=require(_0x5e3b('0x14'));var Redis=require(_0x5e3b('0x15'));var authService=require(_0x5e3b('0x16'));var qs=require(_0x5e3b('0x17'));var as=require(_0x5e3b('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e3b('0x19'))(_0x5e3b('0x1a'));var utils=require('../../config/utils');var config=require(_0x5e3b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e3b('0x1c'))['db'];function respondWithStatusCode(_0x991651,_0x14254f){_0x14254f=_0x14254f||0xcc;return function(_0x1ffae0){if(_0x1ffae0){return _0x991651[_0x5e3b('0x1d')](_0x14254f);}return _0x991651[_0x5e3b('0x1e')](_0x14254f)['end']();};}function respondWithResult(_0x2fddea,_0x520e08){_0x520e08=_0x520e08||0xc8;return function(_0x6e50ce){if(_0x6e50ce){return _0x2fddea[_0x5e3b('0x1e')](_0x520e08)['json'](_0x6e50ce);}};}function respondWithFilteredResult(_0x674c3c,_0x19fda3){return function(_0x4c70bb){if(_0x4c70bb){var _0x1e032d=typeof _0x19fda3[_0x5e3b('0x1f')]===_0x5e3b('0x20')&&typeof _0x19fda3[_0x5e3b('0x21')]===_0x5e3b('0x20');var _0x305347=_0x4c70bb[_0x5e3b('0x22')];var _0x5ce8d6=_0x1e032d?0x0:_0x19fda3['offset'];var _0x3b183f=_0x1e032d?_0x4c70bb[_0x5e3b('0x22')]:_0x19fda3['offset']+_0x19fda3[_0x5e3b('0x21')];var _0x3438e5;if(_0x3b183f>=_0x305347){_0x3b183f=_0x305347;_0x3438e5=0xc8;}else{_0x3438e5=0xce;}_0x674c3c[_0x5e3b('0x1e')](_0x3438e5);return _0x674c3c[_0x5e3b('0x23')](_0x5e3b('0x24'),_0x5ce8d6+'-'+_0x3b183f+'/'+_0x305347)[_0x5e3b('0x25')](_0x4c70bb);}return null;};}function patchUpdates(_0x438956){return function(_0x56fd8b){try{jsonpatch[_0x5e3b('0x26')](_0x56fd8b,_0x438956,!![]);}catch(_0x40b711){return BPromise[_0x5e3b('0x27')](_0x40b711);}return _0x56fd8b[_0x5e3b('0x28')]();};}function saveUpdates(_0x5a14dc,_0x46cdca){return function(_0x47fb21){if(_0x47fb21){return _0x47fb21[_0x5e3b('0x29')](_0x5a14dc)['then'](function(_0x3d86a5){return _0x3d86a5;});}return null;};}function removeEntity(_0x16e746,_0x25ea62){return function(_0x2e169f){if(_0x2e169f){return _0x2e169f[_0x5e3b('0x2a')]()[_0x5e3b('0x2b')](function(){var _0x3365bf=_0x2e169f[_0x5e3b('0x2c')]({'plain':!![]});var _0x6ace94=_0x5e3b('0x2d');return db[_0x5e3b('0x2e')][_0x5e3b('0x2a')]({'where':{'type':_0x6ace94,'resourceId':_0x3365bf['id']}})['then'](function(){return _0x2e169f;});})[_0x5e3b('0x2b')](function(){_0x16e746[_0x5e3b('0x1e')](0xcc)[_0x5e3b('0x2f')]();});}};}function handleEntityNotFound(_0xa674a7,_0xb3cb){return function(_0x16798d){if(!_0x16798d){_0xa674a7['sendStatus'](0x194);}return _0x16798d;};}function handleError(_0x596be0,_0x3df809){_0x3df809=_0x3df809||0x1f4;return function(_0x37cac6){logger['error'](_0x37cac6['stack']);if(_0x37cac6[_0x5e3b('0x30')]){delete _0x37cac6[_0x5e3b('0x30')];}_0x596be0[_0x5e3b('0x1e')](_0x3df809)[_0x5e3b('0x31')](_0x37cac6);};}exports[_0x5e3b('0x32')]=function(_0x563930,_0xf176cf){var _0x2c4fd0={},_0x39ae35={},_0x16ca69={'count':0x0,'rows':[]};var _0x1d04ec=_[_0x5e3b('0x33')](db[_0x5e3b('0x34')][_0x5e3b('0x35')],function(_0x37b79c){return{'name':_0x37b79c[_0x5e3b('0x36')],'type':_0x37b79c[_0x5e3b('0x37')][_0x5e3b('0x38')]};});_0x39ae35['model']=_[_0x5e3b('0x33')](_0x1d04ec,_0x5e3b('0x30'));_0x39ae35['query']=_[_0x5e3b('0x39')](_0x563930[_0x5e3b('0x3a')]);_0x39ae35['filters']=_['intersection'](_0x39ae35[_0x5e3b('0x3b')],_0x39ae35[_0x5e3b('0x3a')]);_0x2c4fd0[_0x5e3b('0x3c')]=_[_0x5e3b('0x3d')](_0x39ae35[_0x5e3b('0x3b')],qs['fields'](_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x3e')]));_0x2c4fd0[_0x5e3b('0x3c')]=_0x2c4fd0[_0x5e3b('0x3c')][_0x5e3b('0x3f')]?_0x2c4fd0[_0x5e3b('0x3c')]:_0x39ae35[_0x5e3b('0x3b')];if(!_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x40')]('nolimit')){_0x2c4fd0[_0x5e3b('0x21')]=qs[_0x5e3b('0x21')](_0x563930[_0x5e3b('0x3a')]['limit']);_0x2c4fd0[_0x5e3b('0x1f')]=qs['offset'](_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x1f')]);}_0x2c4fd0['order']=qs[_0x5e3b('0x41')](_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x41')]);_0x2c4fd0[_0x5e3b('0x42')]=qs[_0x5e3b('0x43')](_[_0x5e3b('0x44')](_0x563930[_0x5e3b('0x3a')],_0x39ae35[_0x5e3b('0x43')]),_0x1d04ec);if(_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x45')]){_0x2c4fd0[_0x5e3b('0x42')]=_['merge'](_0x2c4fd0[_0x5e3b('0x42')],{'$or':_['map'](_0x1d04ec,function(_0x48f776){if(_0x48f776[_0x5e3b('0x37')]!==_0x5e3b('0x46')){var _0x4c1334={};_0x4c1334[_0x48f776['name']]={'$like':'%'+_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x45')]+'%'};return _0x4c1334;}})});}_0x2c4fd0=_[_0x5e3b('0x47')]({},_0x2c4fd0,_0x563930['options']);var _0x38b376={'where':_0x2c4fd0[_0x5e3b('0x42')]};return db[_0x5e3b('0x34')][_0x5e3b('0x22')](_0x38b376)[_0x5e3b('0x2b')](function(_0x439d6f){_0x16ca69[_0x5e3b('0x22')]=_0x439d6f;if(_0x563930[_0x5e3b('0x3a')][_0x5e3b('0x48')]){_0x2c4fd0['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x5e3b('0x49')](_0x2c4fd0);})[_0x5e3b('0x2b')](function(_0x193c2f){_0x16ca69[_0x5e3b('0x4a')]=_0x193c2f;return _0x16ca69;})[_0x5e3b('0x2b')](respondWithFilteredResult(_0xf176cf,_0x2c4fd0))[_0x5e3b('0x4b')](handleError(_0xf176cf,null));};exports[_0x5e3b('0x4c')]=function(_0x4984bc,_0x543b3f){var _0x4ed71f={'raw':!![],'where':{'id':_0x4984bc[_0x5e3b('0x4d')]['id']}},_0x2a04b9={};_0x2a04b9['model']=_[_0x5e3b('0x39')](db[_0x5e3b('0x34')][_0x5e3b('0x35')]);_0x2a04b9[_0x5e3b('0x3a')]=_['keys'](_0x4984bc[_0x5e3b('0x3a')]);_0x2a04b9['filters']=_[_0x5e3b('0x3d')](_0x2a04b9[_0x5e3b('0x3b')],_0x2a04b9['query']);_0x4ed71f['attributes']=_[_0x5e3b('0x3d')](_0x2a04b9['model'],qs['fields'](_0x4984bc['query'][_0x5e3b('0x3e')]));_0x4ed71f[_0x5e3b('0x3c')]=_0x4ed71f['attributes'][_0x5e3b('0x3f')]?_0x4ed71f[_0x5e3b('0x3c')]:_0x2a04b9['model'];if(_0x4984bc['query'][_0x5e3b('0x48')]){_0x4ed71f[_0x5e3b('0x4e')]=[{'all':!![]}];}_0x4ed71f=_[_0x5e3b('0x47')]({},_0x4ed71f,_0x4984bc['options']);return db[_0x5e3b('0x34')][_0x5e3b('0x4f')](_0x4ed71f)[_0x5e3b('0x2b')](handleEntityNotFound(_0x543b3f,null))[_0x5e3b('0x2b')](respondWithResult(_0x543b3f,null))[_0x5e3b('0x4b')](handleError(_0x543b3f,null));};exports['create']=function(_0x51e38b,_0xeb9c3a){return db['CmHopperAdditionalPhone']['create'](_0x51e38b['body'],{})[_0x5e3b('0x2b')](function(_0x1b97f6){var _0x35422a=_0x51e38b[_0x5e3b('0x50')][_0x5e3b('0x2c')]({'plain':!![]});if(!_0x35422a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35422a[_0x5e3b('0x51')]===_0x5e3b('0x50')){var _0x202680=_0x1b97f6[_0x5e3b('0x2c')]({'plain':!![]});var _0x52923c=_0x5e3b('0x2d');return db[_0x5e3b('0x52')][_0x5e3b('0x4f')]({'where':{'name':_0x52923c,'userProfileId':_0x35422a[_0x5e3b('0x53')]},'raw':!![]})[_0x5e3b('0x2b')](function(_0x54bdd1){if(_0x54bdd1&&_0x54bdd1[_0x5e3b('0x54')]===0x0){return db[_0x5e3b('0x2e')]['create']({'name':_0x202680[_0x5e3b('0x30')],'resourceId':_0x202680['id'],'type':_0x54bdd1[_0x5e3b('0x30')],'sectionId':_0x54bdd1['id']},{})[_0x5e3b('0x2b')](function(){return _0x1b97f6;});}else{return _0x1b97f6;}})['catch'](function(_0xfadc16){logger[_0x5e3b('0x55')](_0x5e3b('0x56'),_0xfadc16);throw _0xfadc16;});}return _0x1b97f6;})[_0x5e3b('0x2b')](respondWithResult(_0xeb9c3a,0xc9))[_0x5e3b('0x4b')](handleError(_0xeb9c3a,null));};exports[_0x5e3b('0x29')]=function(_0x67bf77,_0x46f9f6){if(_0x67bf77[_0x5e3b('0x57')]['id']){delete _0x67bf77[_0x5e3b('0x57')]['id'];}return db[_0x5e3b('0x34')][_0x5e3b('0x4f')]({'where':{'id':_0x67bf77[_0x5e3b('0x4d')]['id']}})[_0x5e3b('0x2b')](handleEntityNotFound(_0x46f9f6,null))[_0x5e3b('0x2b')](saveUpdates(_0x67bf77['body'],null))['then'](respondWithResult(_0x46f9f6,null))[_0x5e3b('0x4b')](handleError(_0x46f9f6,null));};exports[_0x5e3b('0x2a')]=function(_0x361305,_0x4e1d1e){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x361305['params']['id']}})[_0x5e3b('0x2b')](handleEntityNotFound(_0x4e1d1e,null))[_0x5e3b('0x2b')](removeEntity(_0x4e1d1e,null))[_0x5e3b('0x4b')](handleError(_0x4e1d1e,null));}; \ No newline at end of file +var _0xb80d=['pick','filters','merge','VIRTUAL','filter','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','CmHopperAdditionalPhones','UserProfileResource','then','error','stack','name','index','map','CmHopperAdditionalPhone','type','key','query','keys','intersection','attributes','fields','length','model','nolimit','limit','order','sort','where'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xb80d,0x6f));var _0xdb80=function(_0x3bd7c5,_0x272ae9){_0x3bd7c5=_0x3bd7c5-0x0;var _0x423e00=_0xb80d[_0x3bd7c5];return _0x423e00;};'use strict';var emlformat=require(_0xdb80('0x0'));var rimraf=require(_0xdb80('0x1'));var zipdir=require(_0xdb80('0x2'));var jsonpatch=require(_0xdb80('0x3'));var rp=require(_0xdb80('0x4'));var moment=require(_0xdb80('0x5'));var BPromise=require(_0xdb80('0x6'));var Mustache=require(_0xdb80('0x7'));var util=require('util');var path=require(_0xdb80('0x8'));var sox=require(_0xdb80('0x9'));var csv=require(_0xdb80('0xa'));var ejs=require(_0xdb80('0xb'));var fs=require('fs');var fs_extra=require(_0xdb80('0xc'));var _=require(_0xdb80('0xd'));var squel=require(_0xdb80('0xe'));var crypto=require(_0xdb80('0xf'));var jsforce=require(_0xdb80('0x10'));var deskjs=require(_0xdb80('0x11'));var toCsv=require(_0xdb80('0xa'));var querystring=require(_0xdb80('0x12'));var Papa=require(_0xdb80('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb80('0x15'));var logger=require('../../config/logger')(_0xdb80('0x16'));var utils=require(_0xdb80('0x17'));var config=require(_0xdb80('0x18'));var licenseUtil=require(_0xdb80('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21bd3a,_0x13cff1){_0x13cff1=_0x13cff1||0xcc;return function(_0x5a44b7){if(_0x5a44b7){return _0x21bd3a[_0xdb80('0x1a')](_0x13cff1);}return _0x21bd3a[_0xdb80('0x1b')](_0x13cff1)[_0xdb80('0x1c')]();};}function respondWithResult(_0x17e4b6,_0x47a95a){_0x47a95a=_0x47a95a||0xc8;return function(_0x3a93b1){if(_0x3a93b1){return _0x17e4b6[_0xdb80('0x1b')](_0x47a95a)[_0xdb80('0x1d')](_0x3a93b1);}};}function respondWithFilteredResult(_0x235868,_0x13431c){return function(_0xc3d9d7){if(_0xc3d9d7){var _0x218c25=typeof _0x13431c[_0xdb80('0x1e')]===_0xdb80('0x1f')&&typeof _0x13431c['limit']===_0xdb80('0x1f');var _0x5bc241=_0xc3d9d7[_0xdb80('0x20')];var _0x3c45ac=_0x218c25?0x0:_0x13431c[_0xdb80('0x1e')];var _0x5c4d10=_0x218c25?_0xc3d9d7[_0xdb80('0x20')]:_0x13431c[_0xdb80('0x1e')]+_0x13431c['limit'];var _0x190a55;if(_0x5c4d10>=_0x5bc241){_0x5c4d10=_0x5bc241;_0x190a55=0xc8;}else{_0x190a55=0xce;}_0x235868['status'](_0x190a55);return _0x235868[_0xdb80('0x21')](_0xdb80('0x22'),_0x3c45ac+'-'+_0x5c4d10+'/'+_0x5bc241)[_0xdb80('0x1d')](_0xc3d9d7);}return null;};}function patchUpdates(_0x7e7af0){return function(_0x23d938){try{jsonpatch[_0xdb80('0x23')](_0x23d938,_0x7e7af0,!![]);}catch(_0x302873){return BPromise[_0xdb80('0x24')](_0x302873);}return _0x23d938[_0xdb80('0x25')]();};}function saveUpdates(_0x5c83a5,_0x169555){return function(_0x477732){if(_0x477732){return _0x477732[_0xdb80('0x26')](_0x5c83a5)['then'](function(_0x1d9348){return _0x1d9348;});}return null;};}function removeEntity(_0x3bd89c,_0x478dd1){return function(_0x4205e6){if(_0x4205e6){return _0x4205e6[_0xdb80('0x27')]()['then'](function(){var _0x460a2d=_0x4205e6['get']({'plain':!![]});var _0x16ca47=_0xdb80('0x28');return db[_0xdb80('0x29')][_0xdb80('0x27')]({'where':{'type':_0x16ca47,'resourceId':_0x460a2d['id']}})[_0xdb80('0x2a')](function(){return _0x4205e6;});})[_0xdb80('0x2a')](function(){_0x3bd89c[_0xdb80('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59787b,_0x32c01a){return function(_0x3b9c30){if(!_0x3b9c30){_0x59787b[_0xdb80('0x1a')](0x194);}return _0x3b9c30;};}function handleError(_0x5ede0d,_0x5a3fd6){_0x5a3fd6=_0x5a3fd6||0x1f4;return function(_0x3211fc){logger[_0xdb80('0x2b')](_0x3211fc[_0xdb80('0x2c')]);if(_0x3211fc['name']){delete _0x3211fc[_0xdb80('0x2d')];}_0x5ede0d['status'](_0x5a3fd6)['send'](_0x3211fc);};}exports[_0xdb80('0x2e')]=function(_0x1d2ca9,_0xf6c8b2){var _0x190725={},_0x4025ce={},_0x2ecab4={'count':0x0,'rows':[]};var _0x35a98e=_[_0xdb80('0x2f')](db[_0xdb80('0x30')]['rawAttributes'],function(_0xccca79){return{'name':_0xccca79['fieldName'],'type':_0xccca79[_0xdb80('0x31')][_0xdb80('0x32')]};});_0x4025ce['model']=_[_0xdb80('0x2f')](_0x35a98e,_0xdb80('0x2d'));_0x4025ce[_0xdb80('0x33')]=_[_0xdb80('0x34')](_0x1d2ca9[_0xdb80('0x33')]);_0x4025ce['filters']=_[_0xdb80('0x35')](_0x4025ce['model'],_0x4025ce[_0xdb80('0x33')]);_0x190725[_0xdb80('0x36')]=_[_0xdb80('0x35')](_0x4025ce['model'],qs[_0xdb80('0x37')](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x37')]));_0x190725[_0xdb80('0x36')]=_0x190725['attributes'][_0xdb80('0x38')]?_0x190725['attributes']:_0x4025ce[_0xdb80('0x39')];if(!_0x1d2ca9['query']['hasOwnProperty'](_0xdb80('0x3a'))){_0x190725['limit']=qs[_0xdb80('0x3b')](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x3b')]);_0x190725[_0xdb80('0x1e')]=qs['offset'](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x1e')]);}_0x190725[_0xdb80('0x3c')]=qs['sort'](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x3d')]);_0x190725[_0xdb80('0x3e')]=qs['filters'](_[_0xdb80('0x3f')](_0x1d2ca9[_0xdb80('0x33')],_0x4025ce[_0xdb80('0x40')]),_0x35a98e);if(_0x1d2ca9[_0xdb80('0x33')]['filter']){_0x190725[_0xdb80('0x3e')]=_[_0xdb80('0x41')](_0x190725[_0xdb80('0x3e')],{'$or':_[_0xdb80('0x2f')](_0x35a98e,function(_0x203db2){if(_0x203db2['type']!==_0xdb80('0x42')){var _0x236b8c={};_0x236b8c[_0x203db2[_0xdb80('0x2d')]]={'$like':'%'+_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x43')]+'%'};return _0x236b8c;}})});}_0x190725=_['merge']({},_0x190725,_0x1d2ca9['options']);var _0x1860e7={'where':_0x190725['where']};return db[_0xdb80('0x30')][_0xdb80('0x20')](_0x1860e7)[_0xdb80('0x2a')](function(_0x471674){_0x2ecab4['count']=_0x471674;if(_0x1d2ca9['query']['includeAll']){_0x190725[_0xdb80('0x44')]=[{'all':!![]}];}return db[_0xdb80('0x30')]['findAll'](_0x190725);})[_0xdb80('0x2a')](function(_0x1d98e5){_0x2ecab4[_0xdb80('0x45')]=_0x1d98e5;return _0x2ecab4;})[_0xdb80('0x2a')](respondWithFilteredResult(_0xf6c8b2,_0x190725))[_0xdb80('0x46')](handleError(_0xf6c8b2,null));};exports[_0xdb80('0x47')]=function(_0xc41ed5,_0x531ba5){var _0x13060c={'raw':!![],'where':{'id':_0xc41ed5[_0xdb80('0x48')]['id']}},_0x1c1fac={};_0x1c1fac[_0xdb80('0x39')]=_['keys'](db[_0xdb80('0x30')][_0xdb80('0x49')]);_0x1c1fac[_0xdb80('0x33')]=_[_0xdb80('0x34')](_0xc41ed5[_0xdb80('0x33')]);_0x1c1fac[_0xdb80('0x40')]=_['intersection'](_0x1c1fac[_0xdb80('0x39')],_0x1c1fac[_0xdb80('0x33')]);_0x13060c[_0xdb80('0x36')]=_['intersection'](_0x1c1fac[_0xdb80('0x39')],qs[_0xdb80('0x37')](_0xc41ed5[_0xdb80('0x33')][_0xdb80('0x37')]));_0x13060c[_0xdb80('0x36')]=_0x13060c['attributes']['length']?_0x13060c[_0xdb80('0x36')]:_0x1c1fac['model'];if(_0xc41ed5[_0xdb80('0x33')][_0xdb80('0x4a')]){_0x13060c[_0xdb80('0x44')]=[{'all':!![]}];}_0x13060c=_['merge']({},_0x13060c,_0xc41ed5[_0xdb80('0x4b')]);return db[_0xdb80('0x30')][_0xdb80('0x4c')](_0x13060c)['then'](handleEntityNotFound(_0x531ba5,null))['then'](respondWithResult(_0x531ba5,null))[_0xdb80('0x46')](handleError(_0x531ba5,null));};exports[_0xdb80('0x4d')]=function(_0x1eabf7,_0x2e96a8){return db[_0xdb80('0x30')][_0xdb80('0x4d')](_0x1eabf7['body'],{})[_0xdb80('0x2a')](function(_0x561ae6){var _0x5e602c=_0x1eabf7[_0xdb80('0x4e')][_0xdb80('0x4f')]({'plain':!![]});if(!_0x5e602c)throw new Error(_0xdb80('0x50'));if(_0x5e602c[_0xdb80('0x51')]===_0xdb80('0x4e')){var _0x39e168=_0x561ae6[_0xdb80('0x4f')]({'plain':!![]});var _0x29e0ba=_0xdb80('0x28');return db[_0xdb80('0x52')][_0xdb80('0x4c')]({'where':{'name':_0x29e0ba,'userProfileId':_0x5e602c[_0xdb80('0x53')]},'raw':!![]})['then'](function(_0x46ed66){if(_0x46ed66&&_0x46ed66[_0xdb80('0x54')]===0x0){return db['UserProfileResource'][_0xdb80('0x4d')]({'name':_0x39e168['name'],'resourceId':_0x39e168['id'],'type':_0x46ed66['name'],'sectionId':_0x46ed66['id']},{})['then'](function(){return _0x561ae6;});}else{return _0x561ae6;}})[_0xdb80('0x46')](function(_0x4b960f){logger['error'](_0xdb80('0x55'),_0x4b960f);throw _0x4b960f;});}return _0x561ae6;})[_0xdb80('0x2a')](respondWithResult(_0x2e96a8,0xc9))[_0xdb80('0x46')](handleError(_0x2e96a8,null));};exports[_0xdb80('0x26')]=function(_0x126ff2,_0x2ec71b){if(_0x126ff2[_0xdb80('0x56')]['id']){delete _0x126ff2['body']['id'];}return db['CmHopperAdditionalPhone'][_0xdb80('0x4c')]({'where':{'id':_0x126ff2[_0xdb80('0x48')]['id']}})[_0xdb80('0x2a')](handleEntityNotFound(_0x2ec71b,null))[_0xdb80('0x2a')](saveUpdates(_0x126ff2[_0xdb80('0x56')],null))[_0xdb80('0x2a')](respondWithResult(_0x2ec71b,null))[_0xdb80('0x46')](handleError(_0x2ec71b,null));};exports[_0xdb80('0x27')]=function(_0x105833,_0x5b0a6a){return db[_0xdb80('0x30')][_0xdb80('0x4c')]({'where':{'id':_0x105833[_0xdb80('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b0a6a,null))['then'](removeEntity(_0x5b0a6a,null))[_0xdb80('0x46')](handleError(_0x5b0a6a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 04ee57b..de1fb4f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7649=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x3f319e,_0x1b5a67){var _0xf98227=function(_0x14ce28){while(--_0x14ce28){_0x3f319e['push'](_0x3f319e['shift']());}};_0xf98227(++_0x1b5a67);}(_0x7649,0x1df));var _0x9764=function(_0x718b21,_0x165be5){_0x718b21=_0x718b21-0x0;var _0x3bf745=_0x7649[_0x718b21];return _0x3bf745;};'use strict';var _=require(_0x9764('0x0'));var util=require('util');var logger=require(_0x9764('0x1'))(_0x9764('0x2'));var moment=require('moment');var BPromise=require(_0x9764('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9764('0x4'));var rimraf=require(_0x9764('0x5'));var config=require(_0x9764('0x6'));var attributes=require(_0x9764('0x7'));module[_0x9764('0x8')]=function(_0x17d724,_0x40cb8e){return _0x17d724[_0x9764('0x9')](_0x9764('0xa'),attributes,{'tableName':_0x9764('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14b9=['request-promise','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird'];(function(_0x4688f3,_0x1d5a1a){var _0x470c84=function(_0x39e953){while(--_0x39e953){_0x4688f3['push'](_0x4688f3['shift']());}};_0x470c84(++_0x1d5a1a);}(_0x14b9,0x11b));var _0x914b=function(_0x25fc6c,_0x57b6cb){_0x25fc6c=_0x25fc6c-0x0;var _0x23b59f=_0x14b9[_0x25fc6c];return _0x23b59f;};'use strict';var _=require(_0x914b('0x0'));var util=require(_0x914b('0x1'));var logger=require(_0x914b('0x2'))(_0x914b('0x3'));var moment=require('moment');var BPromise=require(_0x914b('0x4'));var rp=require(_0x914b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x914b('0x6'));var config=require('../../config/environment');var attributes=require(_0x914b('0x7'));module[_0x914b('0x8')]=function(_0x434299,_0xb7441b){return _0x434299[_0x914b('0x9')](_0x914b('0xa'),attributes,{'tableName':_0x914b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index fa2fda5..32a93d4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7d7=['info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','then','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','ASC','countagentrejectretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','countnoanswerretry','sequelize','transaction','update','activateAdditionalPhone','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0xa7d7,0x149));var _0x7a7d=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xa7d7[_0x494d1f];return _0x457b6e;};'use strict';var _=require('lodash');var util=require(_0x7a7d('0x0'));var moment=require(_0x7a7d('0x1'));var BPromise=require(_0x7a7d('0x2'));var rs=require(_0x7a7d('0x3'));var fs=require('fs');var Redis=require(_0x7a7d('0x4'));var db=require(_0x7a7d('0x5'))['db'];var utils=require(_0x7a7d('0x6'));var logger=require(_0x7a7d('0x7'))(_0x7a7d('0x8'));var config=require(_0x7a7d('0x9'));var jayson=require(_0x7a7d('0xa'));var client=jayson['client'][_0x7a7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31e260,_0x5744d8,_0x54d28d){return new BPromise(function(_0x24a222,_0x54786c){return client[_0x7a7d('0xc')](_0x31e260,_0x54d28d)['then'](function(_0x3ccd0c){logger['info'](_0x7a7d('0xd'),_0x5744d8,'request\x20sent');logger['debug'](_0x7a7d('0xe'),_0x5744d8,_0x7a7d('0xf'),JSON['stringify'](_0x3ccd0c));if(_0x3ccd0c['error']){if(_0x3ccd0c[_0x7a7d('0x10')][_0x7a7d('0x11')]===0x1f4){logger['error'](_0x7a7d('0xd'),_0x5744d8,_0x3ccd0c[_0x7a7d('0x10')][_0x7a7d('0x12')]);return _0x54786c(_0x3ccd0c[_0x7a7d('0x10')]['message']);}logger['error'](_0x7a7d('0xd'),_0x5744d8,_0x3ccd0c[_0x7a7d('0x10')][_0x7a7d('0x12')]);return _0x24a222(_0x3ccd0c[_0x7a7d('0x10')][_0x7a7d('0x12')]);}else{logger[_0x7a7d('0x13')](_0x7a7d('0xd'),_0x5744d8,_0x7a7d('0xf'));_0x24a222(_0x3ccd0c[_0x7a7d('0x14')]['message']);}})[_0x7a7d('0x15')](function(_0x58d3e4){logger[_0x7a7d('0x10')](_0x7a7d('0xd'),_0x5744d8,_0x58d3e4);_0x54786c(_0x58d3e4);});});}exports[_0x7a7d('0x16')]=function(_0x164c9d){var _0x461c3d=this;return new Promise(function(_0x3845eb,_0x3db2e9){return db[_0x7a7d('0x17')][_0x7a7d('0x18')]({'raw':!![],'where':{'ContactId':_0x164c9d[_0x7a7d('0x19')]['ContactId'],'ListId':_0x164c9d[_0x7a7d('0x19')][_0x7a7d('0x1a')],'VoiceQueueId':_0x164c9d['body'][_0x7a7d('0x1b')]===undefined?null:_0x164c9d[_0x7a7d('0x19')][_0x7a7d('0x1b')],'CampaignId':_0x164c9d[_0x7a7d('0x19')][_0x7a7d('0x1c')]===undefined?null:_0x164c9d['body']['CampaignId']}})['then'](function(_0x3dbf0b){if(_0x3dbf0b!=null){return db[_0x7a7d('0x1d')][_0x7a7d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3dbf0b['id'],'OrderBy':{'$gt':_0x3dbf0b[_0x7a7d('0x1e')]}},'order':[[_0x7a7d('0x1e'),'ASC']]})[_0x7a7d('0x1f')](function(_0x5efd8e){var _0x62d3e5=0x0;if(_0x5efd8e){if(_0x5efd8e[_0x7a7d('0x20')]+_0x5efd8e[_0x7a7d('0x21')]+_0x5efd8e['countnoanswerretry']+_0x5efd8e[_0x7a7d('0x22')]+_0x5efd8e[_0x7a7d('0x23')]+_0x5efd8e[_0x7a7d('0x24')]+_0x5efd8e[_0x7a7d('0x25')]+_0x5efd8e['countagentrejectretry']<_0x164c9d[_0x7a7d('0x26')]['dialGlobalMaxRetry'])_0x62d3e5=0x1;_0x3845eb({'additional':_0x62d3e5});}else{return db[_0x7a7d('0x1d')][_0x7a7d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3dbf0b['id']},'order':[[_0x7a7d('0x1e'),_0x7a7d('0x27')]]})[_0x7a7d('0x1f')](function(_0x252ced){var _0x20b75b=0x0;if(_0x252ced){if(_0x252ced[_0x7a7d('0x20')]+_0x252ced[_0x7a7d('0x21')]+_0x252ced['countnoanswerretry']+_0x252ced[_0x7a7d('0x22')]+_0x252ced['countdropretry']+_0x252ced[_0x7a7d('0x24')]+_0x252ced[_0x7a7d('0x25')]+_0x252ced[_0x7a7d('0x28')]<_0x164c9d[_0x7a7d('0x26')][_0x7a7d('0x29')])_0x20b75b=0x1;_0x3845eb({'additional':_0x20b75b});}else{_0x3845eb({'additional':0x0});}})[_0x7a7d('0x15')](function(_0x42bb27){logger[_0x7a7d('0x10')](_0x7a7d('0x16'),_0x42bb27[_0x7a7d('0x12')]);_0x3db2e9(_0x461c3d[_0x7a7d('0x10')](0x1f4,_0x42bb27[_0x7a7d('0x12')]));});}})['catch'](function(_0x54131d){logger[_0x7a7d('0x10')](_0x7a7d('0x16'),_0x54131d[_0x7a7d('0x12')]);_0x3db2e9(_0x461c3d[_0x7a7d('0x10')](0x1f4,_0x54131d[_0x7a7d('0x12')]));});}else _0x3845eb({'additional':0x0});});});};exports[_0x7a7d('0x2a')]=function(_0x303b2c){var _0x24efbf=this;return new Promise(function(_0x3ba1d0,_0x4908c3){return db[_0x7a7d('0x17')][_0x7a7d('0x18')]({'raw':!![],'where':{'ContactId':_0x303b2c['body']['ContactId'],'ListId':_0x303b2c[_0x7a7d('0x19')][_0x7a7d('0x1a')],'VoiceQueueId':_0x303b2c[_0x7a7d('0x19')][_0x7a7d('0x1b')]===undefined?null:_0x303b2c[_0x7a7d('0x19')][_0x7a7d('0x1b')],'CampaignId':_0x303b2c[_0x7a7d('0x19')][_0x7a7d('0x1c')]===undefined?null:_0x303b2c[_0x7a7d('0x19')][_0x7a7d('0x1c')]}})[_0x7a7d('0x1f')](function(_0x50419c){if(_0x50419c!=null){return db['CmHopperAdditionalPhone'][_0x7a7d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x50419c['id'],'OrderBy':{'$gte':_0x50419c['OrderBy']}},'order':[['OrderBy',_0x7a7d('0x27')]]})[_0x7a7d('0x1f')](function(_0x114235){if(_0x114235)return activateAdditionalPhone(_0x50419c,_0x303b2c[_0x7a7d('0x19')],_0x114235,_0x303b2c[_0x7a7d('0x2b')],_0x303b2c[_0x7a7d('0x2c')])['then'](function(_0x4f2019){_0x3ba1d0(_0x4f2019);});else{return db[_0x7a7d('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x50419c['id']},'order':[[_0x7a7d('0x1e'),_0x7a7d('0x27')]]})[_0x7a7d('0x1f')](function(_0x54691c){if(_0x54691c)return activateAdditionalPhone(_0x50419c,_0x303b2c[_0x7a7d('0x19')],_0x54691c,_0x303b2c['duration'],_0x303b2c[_0x7a7d('0x2c')])[_0x7a7d('0x1f')](function(_0x238dac){_0x3ba1d0(_0x238dac);});else{_0x3ba1d0({'id':_0x50419c['id'],'phone':''});}})[_0x7a7d('0x15')](function(_0x111861){logger[_0x7a7d('0x10')]('VerifyAdditionalPhones',_0x111861[_0x7a7d('0x12')]);_0x4908c3(_0x24efbf[_0x7a7d('0x10')](0x1f4,_0x111861[_0x7a7d('0x12')]));});}})[_0x7a7d('0x15')](function(_0x435424){logger[_0x7a7d('0x10')]('VerifyAdditionalPhones',_0x435424['message']);_0x4908c3(_0x24efbf[_0x7a7d('0x10')](0x1f4,_0x435424['message']));});}else _0x3ba1d0(0x1);});});};function activateAdditionalPhone(_0x195c2c,_0x30cc83,_0x2e76ec,_0x5f0b1e,_0x5b8701){return new Promise(function(_0x46d0f5,_0x1afba8){var _0x1bf37d;if(_[_0x7a7d('0x2d')](_0x2e76ec[_0x7a7d('0x2e')])){_0x2e76ec[_0x7a7d('0x2e')]=moment();}if(moment()>moment(_0x2e76ec[_0x7a7d('0x2e')])){_0x1bf37d=moment()[_0x7a7d('0x2f')](_0x5b8701||0x3,'minutes');}else{if(_0x2e76ec[_0x7a7d('0x1e')]==0x0){_0x1bf37d=moment(_0x2e76ec[_0x7a7d('0x2e')]);}else{_0x1bf37d=moment()[_0x7a7d('0x2f')](_0x5b8701||0x3,_0x7a7d('0x30'));}}if(_[_0x7a7d('0x2d')](_0x1bf37d)){_0x1bf37d=moment()['add'](_0x5b8701||0x3,_0x7a7d('0x30'));}var _0x262f78={'phone':_0x195c2c['phone'],'active':0x0,'OrderBy':_[_0x7a7d('0x2d')](_0x195c2c['OrderBy'])?0x0:_0x195c2c[_0x7a7d('0x1e')],'scheduledat':moment()[_0x7a7d('0x2f')](_0x5f0b1e||0x1,'minutes'),'countbusyretry':_0x30cc83['countbusyretry'],'countcongestionretry':_0x30cc83[_0x7a7d('0x21')],'countnoanswerretry':_0x30cc83['countnoanswerretry'],'countnosuchnumberretry':_0x30cc83[_0x7a7d('0x22')],'countdropretry':_0x30cc83['countdropretry'],'countabandonedretry':_0x30cc83[_0x7a7d('0x24')],'countmachineretry':_0x30cc83[_0x7a7d('0x25')],'countagentrejectretry':_0x30cc83[_0x7a7d('0x28')],'createdAt':_0x30cc83[_0x7a7d('0x31')],'updatedAt':_0x30cc83[_0x7a7d('0x32')]};var _0x2f0fc3={'CmHopperId':_0x195c2c['id'],'phone':_0x2e76ec[_0x7a7d('0x33')],'active':0x0,'OrderBy':_[_0x7a7d('0x2d')](_0x2e76ec[_0x7a7d('0x1e')])?0x0:_0x2e76ec['OrderBy'],'scheduledat':_0x1bf37d,'countbusyretry':_0x2e76ec[_0x7a7d('0x20')],'countcongestionretry':_0x2e76ec['countcongestionretry'],'countnoanswerretry':_0x2e76ec[_0x7a7d('0x34')],'countnosuchnumberretry':_0x2e76ec[_0x7a7d('0x22')],'countdropretry':_0x2e76ec[_0x7a7d('0x23')],'countabandonedretry':_0x2e76ec[_0x7a7d('0x24')],'countmachineretry':_0x2e76ec[_0x7a7d('0x25')],'countagentrejectretry':_0x2e76ec['countagentrejectretry'],'createdAt':_0x2e76ec[_0x7a7d('0x31')],'updatedAt':_0x2e76ec[_0x7a7d('0x32')]};return db[_0x7a7d('0x35')][_0x7a7d('0x36')](function(_0x528be6){return db[_0x7a7d('0x1d')][_0x7a7d('0x37')](_0x262f78,{'where':{'id':_0x2e76ec['id']}},{'transaction':_0x528be6})[_0x7a7d('0x1f')](function(){return db[_0x7a7d('0x17')][_0x7a7d('0x37')](_0x2f0fc3,{'where':{'id':_0x195c2c['id']}},{'transaction':_0x528be6});});})[_0x7a7d('0x1f')](function(_0x5efe95){_0x46d0f5({'id':_0x195c2c['id'],'phone':_0x2e76ec['phone']});})['catch'](function(_0x294d23){logger[_0x7a7d('0x10')](_0x7a7d('0x38'),_0x294d23[_0x7a7d('0x12')]);_0x1afba8({'error':_0x294d23[_0x7a7d('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x19bc35){var _0x28f205=this;return new Promise(function(_0x2e3a06,_0x5e5ae1){return db[_0x7a7d('0x17')][_0x7a7d('0x37')](_0x19bc35['body'][_0x7a7d('0x39')],{'where':{'id':_0x19bc35['body']['id']}})[_0x7a7d('0x1f')](function(_0x21332f){_0x2e3a06(_0x21332f);})[_0x7a7d('0x15')](function(_0x2e7465){logger['error']('IncrementPreviewCounters',_0x2e7465[_0x7a7d('0x12')]);_0x5e5ae1(_0x28f205['error'](0x1f4,_0x2e7465['message']));});});}; \ No newline at end of file +var _0x9a2a=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countmachineretry','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','scheduledat','add','minutes','isNil','createdAt','updatedAt','phone','sequelize','transaction','update','field','lodash'];(function(_0x37d22f,_0x4cdf96){var _0x2f79b8=function(_0x4b9ec8){while(--_0x4b9ec8){_0x37d22f['push'](_0x37d22f['shift']());}};_0x2f79b8(++_0x4cdf96);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0x9a2a[_0x3b9570];return _0x28acdd;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a2('0x3'))['db'];var utils=require(_0xa9a2('0x4'));var logger=require(_0xa9a2('0x5'))(_0xa9a2('0x6'));var config=require(_0xa9a2('0x7'));var jayson=require(_0xa9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388689,_0xb51739,_0xedae90){return new BPromise(function(_0x287343,_0xcd2750){return client[_0xa9a2('0x9')](_0x388689,_0xedae90)[_0xa9a2('0xa')](function(_0x26f1ce){logger[_0xa9a2('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xb51739,_0xa9a2('0xc'));logger[_0xa9a2('0xd')](_0xa9a2('0xe'),_0xb51739,_0xa9a2('0xc'),JSON[_0xa9a2('0xf')](_0x26f1ce));if(_0x26f1ce[_0xa9a2('0x10')]){if(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x11')]===0x1f4){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce['error'][_0xa9a2('0x13')]);return _0xcd2750(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);return _0x287343(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}else{logger[_0xa9a2('0xb')](_0xa9a2('0x12'),_0xb51739,_0xa9a2('0xc'));_0x287343(_0x26f1ce[_0xa9a2('0x14')]['message']);}})[_0xa9a2('0x15')](function(_0xbb6546){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0xbb6546);_0xcd2750(_0xbb6546);});});}exports[_0xa9a2('0x16')]=function(_0x22993f){var _0x4e3f13=this;return new Promise(function(_0x677249,_0x11ca21){return db[_0xa9a2('0x17')][_0xa9a2('0x18')]({'raw':!![],'where':{'ContactId':_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1a')],'ListId':_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1b')],'VoiceQueueId':_0x22993f[_0xa9a2('0x19')]['VoiceQueueId']===undefined?null:_0x22993f['body']['VoiceQueueId'],'CampaignId':_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1c')]===undefined?null:_0x22993f[_0xa9a2('0x19')]['CampaignId']}})[_0xa9a2('0xa')](function(_0x4ca2c4){if(_0x4ca2c4!=null){return db['CmHopperAdditionalPhone'][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4ca2c4['id'],'OrderBy':{'$gt':_0x4ca2c4['OrderBy']}},'order':[[_0xa9a2('0x1d'),_0xa9a2('0x1e')]]})['then'](function(_0x377971){var _0x43a171=0x0;if(_0x377971){if(_0x377971[_0xa9a2('0x1f')]+_0x377971[_0xa9a2('0x20')]+_0x377971[_0xa9a2('0x21')]+_0x377971['countnosuchnumberretry']+_0x377971[_0xa9a2('0x22')]+_0x377971[_0xa9a2('0x23')]+_0x377971['countmachineretry']+_0x377971[_0xa9a2('0x24')]<_0x22993f[_0xa9a2('0x25')][_0xa9a2('0x26')])_0x43a171=0x1;_0x677249({'additional':_0x43a171});}else{return db[_0xa9a2('0x27')][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4ca2c4['id']},'order':[['OrderBy',_0xa9a2('0x1e')]]})['then'](function(_0x4670b8){var _0x56d01b=0x0;if(_0x4670b8){if(_0x4670b8['countbusyretry']+_0x4670b8['countcongestionretry']+_0x4670b8['countnoanswerretry']+_0x4670b8['countnosuchnumberretry']+_0x4670b8[_0xa9a2('0x22')]+_0x4670b8[_0xa9a2('0x23')]+_0x4670b8[_0xa9a2('0x28')]+_0x4670b8[_0xa9a2('0x24')]<_0x22993f[_0xa9a2('0x25')][_0xa9a2('0x26')])_0x56d01b=0x1;_0x677249({'additional':_0x56d01b});}else{_0x677249({'additional':0x0});}})[_0xa9a2('0x15')](function(_0x3c035c){logger['error'](_0xa9a2('0x16'),_0x3c035c[_0xa9a2('0x13')]);_0x11ca21(_0x4e3f13[_0xa9a2('0x10')](0x1f4,_0x3c035c[_0xa9a2('0x13')]));});}})[_0xa9a2('0x15')](function(_0x33971c){logger[_0xa9a2('0x10')]('VerifyAdditionalPhones',_0x33971c[_0xa9a2('0x13')]);_0x11ca21(_0x4e3f13[_0xa9a2('0x10')](0x1f4,_0x33971c[_0xa9a2('0x13')]));});}else _0x677249({'additional':0x0});});});};exports[_0xa9a2('0x29')]=function(_0x9ca2ca){var _0x55fe73=this;return new Promise(function(_0x33a9f7,_0x40e307){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x1a')],'ListId':_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x1b')],'VoiceQueueId':_0x9ca2ca[_0xa9a2('0x19')]['VoiceQueueId']===undefined?null:_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x2a')],'CampaignId':_0x9ca2ca[_0xa9a2('0x19')]['CampaignId']===undefined?null:_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x1c')]}})[_0xa9a2('0xa')](function(_0x539881){if(_0x539881!=null){return db[_0xa9a2('0x27')][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x539881['id'],'OrderBy':{'$gte':_0x539881[_0xa9a2('0x1d')]}},'order':[[_0xa9a2('0x1d'),_0xa9a2('0x1e')]]})[_0xa9a2('0xa')](function(_0x3e71e0){if(_0x3e71e0)return activateAdditionalPhone(_0x539881,_0x9ca2ca[_0xa9a2('0x19')],_0x3e71e0,_0x9ca2ca[_0xa9a2('0x2b')],_0x9ca2ca[_0xa9a2('0x2c')])[_0xa9a2('0xa')](function(_0x199469){_0x33a9f7(_0x199469);});else{return db[_0xa9a2('0x27')][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x539881['id']},'order':[['OrderBy','ASC']]})[_0xa9a2('0xa')](function(_0x13b6fc){if(_0x13b6fc)return activateAdditionalPhone(_0x539881,_0x9ca2ca[_0xa9a2('0x19')],_0x13b6fc,_0x9ca2ca[_0xa9a2('0x2b')],_0x9ca2ca['waitTime'])[_0xa9a2('0xa')](function(_0x107e75){_0x33a9f7(_0x107e75);});else{_0x33a9f7({'id':_0x539881['id'],'phone':''});}})[_0xa9a2('0x15')](function(_0x297be3){logger[_0xa9a2('0x10')]('VerifyAdditionalPhones',_0x297be3[_0xa9a2('0x13')]);_0x40e307(_0x55fe73[_0xa9a2('0x10')](0x1f4,_0x297be3[_0xa9a2('0x13')]));});}})['catch'](function(_0x4b515c){logger[_0xa9a2('0x10')]('VerifyAdditionalPhones',_0x4b515c[_0xa9a2('0x13')]);_0x40e307(_0x55fe73[_0xa9a2('0x10')](0x1f4,_0x4b515c[_0xa9a2('0x13')]));});}else _0x33a9f7(0x1);});});};function activateAdditionalPhone(_0xea3d02,_0xa716af,_0x12bc01,_0x455353,_0x66c4a0){return new Promise(function(_0x24b60e,_0x29f021){var _0x8ca9c7;if(_['isNil'](_0x12bc01[_0xa9a2('0x2d')])){_0x12bc01[_0xa9a2('0x2d')]=moment();}if(moment()>moment(_0x12bc01[_0xa9a2('0x2d')])){_0x8ca9c7=moment()[_0xa9a2('0x2e')](_0x66c4a0||0x3,_0xa9a2('0x2f'));}else{if(_0x12bc01[_0xa9a2('0x1d')]==0x0){_0x8ca9c7=moment(_0x12bc01[_0xa9a2('0x2d')]);}else{_0x8ca9c7=moment()[_0xa9a2('0x2e')](_0x66c4a0||0x3,_0xa9a2('0x2f'));}}if(_[_0xa9a2('0x30')](_0x8ca9c7)){_0x8ca9c7=moment()['add'](_0x66c4a0||0x3,_0xa9a2('0x2f'));}var _0x352255={'phone':_0xea3d02['phone'],'active':0x0,'OrderBy':_[_0xa9a2('0x30')](_0xea3d02[_0xa9a2('0x1d')])?0x0:_0xea3d02['OrderBy'],'scheduledat':moment()[_0xa9a2('0x2e')](_0x455353||0x1,_0xa9a2('0x2f')),'countbusyretry':_0xa716af['countbusyretry'],'countcongestionretry':_0xa716af[_0xa9a2('0x20')],'countnoanswerretry':_0xa716af['countnoanswerretry'],'countnosuchnumberretry':_0xa716af['countnosuchnumberretry'],'countdropretry':_0xa716af[_0xa9a2('0x22')],'countabandonedretry':_0xa716af[_0xa9a2('0x23')],'countmachineretry':_0xa716af[_0xa9a2('0x28')],'countagentrejectretry':_0xa716af[_0xa9a2('0x24')],'createdAt':_0xa716af[_0xa9a2('0x31')],'updatedAt':_0xa716af[_0xa9a2('0x32')]};var _0x826aa6={'CmHopperId':_0xea3d02['id'],'phone':_0x12bc01[_0xa9a2('0x33')],'active':0x0,'OrderBy':_[_0xa9a2('0x30')](_0x12bc01[_0xa9a2('0x1d')])?0x0:_0x12bc01['OrderBy'],'scheduledat':_0x8ca9c7,'countbusyretry':_0x12bc01[_0xa9a2('0x1f')],'countcongestionretry':_0x12bc01[_0xa9a2('0x20')],'countnoanswerretry':_0x12bc01['countnoanswerretry'],'countnosuchnumberretry':_0x12bc01['countnosuchnumberretry'],'countdropretry':_0x12bc01[_0xa9a2('0x22')],'countabandonedretry':_0x12bc01['countabandonedretry'],'countmachineretry':_0x12bc01['countmachineretry'],'countagentrejectretry':_0x12bc01[_0xa9a2('0x24')],'createdAt':_0x12bc01[_0xa9a2('0x31')],'updatedAt':_0x12bc01[_0xa9a2('0x32')]};return db[_0xa9a2('0x34')][_0xa9a2('0x35')](function(_0x10d7c1){return db[_0xa9a2('0x27')]['update'](_0x352255,{'where':{'id':_0x12bc01['id']}},{'transaction':_0x10d7c1})[_0xa9a2('0xa')](function(){return db[_0xa9a2('0x17')]['update'](_0x826aa6,{'where':{'id':_0xea3d02['id']}},{'transaction':_0x10d7c1});});})[_0xa9a2('0xa')](function(_0x27ec68){_0x24b60e({'id':_0xea3d02['id'],'phone':_0x12bc01['phone']});})[_0xa9a2('0x15')](function(_0x3a7fe3){logger[_0xa9a2('0x10')]('activateAdditionalPhone',_0x3a7fe3[_0xa9a2('0x13')]);_0x29f021({'error':_0x3a7fe3['message']});});});}exports['IncrementPreviewCounters']=function(_0x264368){var _0x1c3cec=this;return new Promise(function(_0x2308b7,_0x5c21df){return db[_0xa9a2('0x17')][_0xa9a2('0x36')](_0x264368[_0xa9a2('0x19')][_0xa9a2('0x37')],{'where':{'id':_0x264368['body']['id']}})[_0xa9a2('0xa')](function(_0x4c9569){_0x2308b7(_0x4c9569);})[_0xa9a2('0x15')](function(_0x134069){logger['error']('IncrementPreviewCounters',_0x134069['message']);_0x5c21df(_0x1c3cec[_0xa9a2('0x10')](0x1f4,_0x134069[_0xa9a2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1809a47..ff6a168 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe85c=['get','isAuthenticated','index','show','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var path=require(_0xce85('0x2'));var timeout=require(_0xce85('0x3'));var express=require(_0xce85('0x4'));var router=express[_0xce85('0x5')]();var fs_extra=require(_0xce85('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xce85('0x7'));var config=require('../../config/environment');var controller=require(_0xce85('0x8'));router[_0xce85('0x9')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0xb')]);router[_0xce85('0x9')]('/:id',auth[_0xce85('0xa')](),controller[_0xce85('0xc')]);router[_0xce85('0xd')]('/',auth[_0xce85('0xa')](),controller['create']);router['put'](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0xf')]);router['delete'](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0x10')]);module[_0xce85('0x11')]=router; \ No newline at end of file +var _0x570f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x196c6d,_0x43c2a){var _0x37c84a=function(_0x55ff89){while(--_0x55ff89){_0x196c6d['push'](_0x196c6d['shift']());}};_0x37c84a(++_0x43c2a);}(_0x570f,0x152));var _0xf570=function(_0x8f15dd,_0x1b132c){_0x8f15dd=_0x8f15dd-0x0;var _0x6a2868=_0x570f[_0x8f15dd];return _0x6a2868;};'use strict';var multer=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var path=require(_0xf570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf570('0x3')]();var fs_extra=require(_0xf570('0x4'));var auth=require(_0xf570('0x5'));var interaction=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));var controller=require(_0xf570('0x8'));router[_0xf570('0x9')]('/',auth['isAuthenticated'](),controller[_0xf570('0xa')]);router['get'](_0xf570('0xb'),auth['isAuthenticated'](),controller[_0xf570('0xc')]);router['post']('/',auth[_0xf570('0xd')](),controller['create']);router[_0xf570('0xe')](_0xf570('0xb'),auth[_0xf570('0xd')](),controller[_0xf570('0xf')]);router[_0xf570('0x10')]('/:id',auth[_0xf570('0xd')](),controller[_0xf570('0x11')]);module[_0xf570('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 48ce8a2..66131ac 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 _0x29b1=['STRING','INTEGER','contactListQueue','exports'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x29b1,0x13b));var _0x129b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x29b1[_0x9aada2];return _0x196dff;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x129b('0x0')]={'phone':{'type':Sequelize[_0x129b('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x129b('0x2')],'unique':_0x129b('0x3')},'ListId':{'type':Sequelize[_0x129b('0x2')],'unique':_0x129b('0x3')},'VoiceQueueId':{'type':Sequelize[_0x129b('0x2')],'unique':_0x129b('0x3')}}; \ No newline at end of file +var _0x0e5d=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x208cf0,_0x486665){var _0x372d0d=function(_0x293e01){while(--_0x293e01){_0x208cf0['push'](_0x208cf0['shift']());}};_0x372d0d(++_0x486665);}(_0x0e5d,0x152));var _0xd0e5=function(_0x4f8d25,_0x2ce718){_0x4f8d25=_0x4f8d25-0x0;var _0x5943e5=_0x0e5d[_0x4f8d25];return _0x5943e5;};'use strict';var moment=require(_0xd0e5('0x0'));var Sequelize=require(_0xd0e5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xd0e5('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd0e5('0x3')],'unique':_0xd0e5('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd0e5('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd0e5('0x3')],'unique':_0xd0e5('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index da2aa64..dfd4497 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 _0x8f08=['then','destroy','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','findAll','rows','params','include','find','update','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x8f08,0x187));var _0x88f0=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x8f08[_0x2fb87c];return _0x43038b;};'use strict';var emlformat=require(_0x88f0('0x0'));var rimraf=require(_0x88f0('0x1'));var zipdir=require(_0x88f0('0x2'));var jsonpatch=require(_0x88f0('0x3'));var rp=require(_0x88f0('0x4'));var moment=require(_0x88f0('0x5'));var BPromise=require(_0x88f0('0x6'));var Mustache=require(_0x88f0('0x7'));var util=require(_0x88f0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x88f0('0x9'));var ejs=require(_0x88f0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x88f0('0xb'));var crypto=require(_0x88f0('0xc'));var jsforce=require(_0x88f0('0xd'));var deskjs=require(_0x88f0('0xe'));var toCsv=require(_0x88f0('0x9'));var querystring=require(_0x88f0('0xf'));var Papa=require('papaparse');var Redis=require(_0x88f0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x88f0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88f0('0x12'));var logger=require(_0x88f0('0x13'))('api');var utils=require(_0x88f0('0x14'));var config=require(_0x88f0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x88f0('0x16'))['db'];function respondWithStatusCode(_0x3dff7e,_0x5b365c){_0x5b365c=_0x5b365c||0xcc;return function(_0x33269f){if(_0x33269f){return _0x3dff7e[_0x88f0('0x17')](_0x5b365c);}return _0x3dff7e['status'](_0x5b365c)[_0x88f0('0x18')]();};}function respondWithResult(_0x1dd667,_0x4be17c){_0x4be17c=_0x4be17c||0xc8;return function(_0x5f3b43){if(_0x5f3b43){return _0x1dd667[_0x88f0('0x19')](_0x4be17c)[_0x88f0('0x1a')](_0x5f3b43);}};}function respondWithFilteredResult(_0x138136,_0x569221){return function(_0x44731c){if(_0x44731c){var _0x304c36=typeof _0x569221[_0x88f0('0x1b')]===_0x88f0('0x1c')&&typeof _0x569221[_0x88f0('0x1d')]===_0x88f0('0x1c');var _0x335447=_0x44731c[_0x88f0('0x1e')];var _0x1305fa=_0x304c36?0x0:_0x569221['offset'];var _0x595c65=_0x304c36?_0x44731c['count']:_0x569221[_0x88f0('0x1b')]+_0x569221['limit'];var _0x493b32;if(_0x595c65>=_0x335447){_0x595c65=_0x335447;_0x493b32=0xc8;}else{_0x493b32=0xce;}_0x138136['status'](_0x493b32);return _0x138136['set'](_0x88f0('0x1f'),_0x1305fa+'-'+_0x595c65+'/'+_0x335447)['json'](_0x44731c);}return null;};}function patchUpdates(_0x3fc6c8){return function(_0x12707a){try{jsonpatch[_0x88f0('0x20')](_0x12707a,_0x3fc6c8,!![]);}catch(_0x7cd639){return BPromise[_0x88f0('0x21')](_0x7cd639);}return _0x12707a[_0x88f0('0x22')]();};}function saveUpdates(_0x495c8a,_0x21579c){return function(_0xebffdd){if(_0xebffdd){return _0xebffdd['update'](_0x495c8a)[_0x88f0('0x23')](function(_0x442000){return _0x442000;});}return null;};}function removeEntity(_0x39ad73,_0x38fa82){return function(_0x150e2a){if(_0x150e2a){return _0x150e2a[_0x88f0('0x24')]()[_0x88f0('0x23')](function(){_0x39ad73['status'](0xcc)[_0x88f0('0x18')]();});}};}function handleEntityNotFound(_0x2cda71,_0x3ed9d7){return function(_0x546b02){if(!_0x546b02){_0x2cda71[_0x88f0('0x17')](0x194);}return _0x546b02;};}function handleError(_0x208999,_0x2080a5){_0x2080a5=_0x2080a5||0x1f4;return function(_0xb7f10){logger['error'](_0xb7f10['stack']);if(_0xb7f10[_0x88f0('0x25')]){delete _0xb7f10['name'];}_0x208999[_0x88f0('0x19')](_0x2080a5)['send'](_0xb7f10);};}exports['index']=function(_0x1d4280,_0x3ccdc9){var _0xadfca={},_0x1005a1={},_0x1f0288={'count':0x0,'rows':[]};var _0x687958=_['map'](db['CmHopperBlack'][_0x88f0('0x26')],function(_0x474b54){return{'name':_0x474b54[_0x88f0('0x27')],'type':_0x474b54[_0x88f0('0x28')][_0x88f0('0x29')]};});_0x1005a1[_0x88f0('0x2a')]=_[_0x88f0('0x2b')](_0x687958,_0x88f0('0x25'));_0x1005a1[_0x88f0('0x2c')]=_[_0x88f0('0x2d')](_0x1d4280[_0x88f0('0x2c')]);_0x1005a1[_0x88f0('0x2e')]=_[_0x88f0('0x2f')](_0x1005a1[_0x88f0('0x2a')],_0x1005a1[_0x88f0('0x2c')]);_0xadfca[_0x88f0('0x30')]=_[_0x88f0('0x2f')](_0x1005a1['model'],qs[_0x88f0('0x31')](_0x1d4280[_0x88f0('0x2c')]['fields']));_0xadfca[_0x88f0('0x30')]=_0xadfca[_0x88f0('0x30')][_0x88f0('0x32')]?_0xadfca['attributes']:_0x1005a1['model'];if(!_0x1d4280['query'][_0x88f0('0x33')](_0x88f0('0x34'))){_0xadfca['limit']=qs['limit'](_0x1d4280[_0x88f0('0x2c')][_0x88f0('0x1d')]);_0xadfca[_0x88f0('0x1b')]=qs['offset'](_0x1d4280[_0x88f0('0x2c')][_0x88f0('0x1b')]);}_0xadfca['order']=qs[_0x88f0('0x35')](_0x1d4280['query'][_0x88f0('0x35')]);_0xadfca[_0x88f0('0x36')]=qs[_0x88f0('0x2e')](_[_0x88f0('0x37')](_0x1d4280[_0x88f0('0x2c')],_0x1005a1[_0x88f0('0x2e')]),_0x687958);if(_0x1d4280[_0x88f0('0x2c')][_0x88f0('0x38')]){_0xadfca[_0x88f0('0x36')]=_[_0x88f0('0x39')](_0xadfca['where'],{'$or':_['map'](_0x687958,function(_0x57ac07){if(_0x57ac07[_0x88f0('0x28')]!==_0x88f0('0x3a')){var _0x353de7={};_0x353de7[_0x57ac07[_0x88f0('0x25')]]={'$like':'%'+_0x1d4280['query']['filter']+'%'};return _0x353de7;}})});}_0xadfca=_[_0x88f0('0x39')]({},_0xadfca,_0x1d4280[_0x88f0('0x3b')]);var _0x81868f={'where':_0xadfca[_0x88f0('0x36')]};return db[_0x88f0('0x3c')][_0x88f0('0x1e')](_0x81868f)[_0x88f0('0x23')](function(_0x3fc4af){_0x1f0288[_0x88f0('0x1e')]=_0x3fc4af;if(_0x1d4280['query'][_0x88f0('0x3d')]){_0xadfca['include']=[{'all':!![]}];}return db[_0x88f0('0x3c')][_0x88f0('0x3e')](_0xadfca);})['then'](function(_0x275399){_0x1f0288[_0x88f0('0x3f')]=_0x275399;return _0x1f0288;})[_0x88f0('0x23')](respondWithFilteredResult(_0x3ccdc9,_0xadfca))['catch'](handleError(_0x3ccdc9,null));};exports['show']=function(_0x2b147d,_0x5573cf){var _0x24ec13={'raw':!![],'where':{'id':_0x2b147d[_0x88f0('0x40')]['id']}},_0x1ed0b5={};_0x1ed0b5['model']=_[_0x88f0('0x2d')](db[_0x88f0('0x3c')]['rawAttributes']);_0x1ed0b5[_0x88f0('0x2c')]=_[_0x88f0('0x2d')](_0x2b147d['query']);_0x1ed0b5['filters']=_[_0x88f0('0x2f')](_0x1ed0b5[_0x88f0('0x2a')],_0x1ed0b5[_0x88f0('0x2c')]);_0x24ec13[_0x88f0('0x30')]=_[_0x88f0('0x2f')](_0x1ed0b5[_0x88f0('0x2a')],qs[_0x88f0('0x31')](_0x2b147d['query'][_0x88f0('0x31')]));_0x24ec13[_0x88f0('0x30')]=_0x24ec13[_0x88f0('0x30')][_0x88f0('0x32')]?_0x24ec13[_0x88f0('0x30')]:_0x1ed0b5[_0x88f0('0x2a')];if(_0x2b147d['query'][_0x88f0('0x3d')]){_0x24ec13[_0x88f0('0x41')]=[{'all':!![]}];}_0x24ec13=_['merge']({},_0x24ec13,_0x2b147d['options']);return db[_0x88f0('0x3c')][_0x88f0('0x42')](_0x24ec13)[_0x88f0('0x23')](handleEntityNotFound(_0x5573cf,null))[_0x88f0('0x23')](respondWithResult(_0x5573cf,null))['catch'](handleError(_0x5573cf,null));};exports[_0x88f0('0x43')]=function(_0x2a94a2,_0x308c82){if(_0x2a94a2[_0x88f0('0x44')]['id']){delete _0x2a94a2[_0x88f0('0x44')]['id'];}return db[_0x88f0('0x3c')][_0x88f0('0x42')]({'where':{'id':_0x2a94a2[_0x88f0('0x40')]['id']}})[_0x88f0('0x23')](handleEntityNotFound(_0x308c82,null))['then'](saveUpdates(_0x2a94a2[_0x88f0('0x44')],null))['then'](respondWithResult(_0x308c82,null))[_0x88f0('0x45')](handleError(_0x308c82,null));};exports['destroy']=function(_0x48f66a,_0x51294e){return db['CmHopperBlack'][_0x88f0('0x42')]({'where':{'id':_0x48f66a[_0x88f0('0x40')]['id']}})[_0x88f0('0x23')](handleEntityNotFound(_0x51294e,null))[_0x88f0('0x23')](removeEntity(_0x51294e,null))[_0x88f0('0x45')](handleError(_0x51294e,null));};exports['describe']=function(_0x268763,_0x69135c){return db['CmHopperBlack'][_0x88f0('0x46')]()[_0x88f0('0x23')](respondWithResult(_0x69135c,null))['catch'](handleError(_0x69135c,null));}; \ No newline at end of file +var _0x96f2=['model','query','keys','filters','intersection','fields','attributes','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','params','length','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','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','limit','count','set','json','reject','save','update','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key'];(function(_0x4b407a,_0x51ff40){var _0x580a75=function(_0x2dfd65){while(--_0x2dfd65){_0x4b407a['push'](_0x4b407a['shift']());}};_0x580a75(++_0x51ff40);}(_0x96f2,0xb0));var _0x296f=function(_0xbd6edf,_0x2cc5ab){_0xbd6edf=_0xbd6edf-0x0;var _0x1f12d6=_0x96f2[_0xbd6edf];return _0x1f12d6;};'use strict';var emlformat=require(_0x296f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x296f('0x1'));var jsonpatch=require(_0x296f('0x2'));var rp=require(_0x296f('0x3'));var moment=require('moment');var BPromise=require(_0x296f('0x4'));var Mustache=require(_0x296f('0x5'));var util=require(_0x296f('0x6'));var path=require('path');var sox=require(_0x296f('0x7'));var csv=require(_0x296f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x296f('0x9'));var squel=require(_0x296f('0xa'));var crypto=require(_0x296f('0xb'));var jsforce=require(_0x296f('0xc'));var deskjs=require(_0x296f('0xd'));var toCsv=require(_0x296f('0x8'));var querystring=require(_0x296f('0xe'));var Papa=require(_0x296f('0xf'));var Redis=require(_0x296f('0x10'));var authService=require(_0x296f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x296f('0x12'));var hardwareService=require(_0x296f('0x13'));var logger=require(_0x296f('0x14'))('api');var utils=require(_0x296f('0x15'));var config=require(_0x296f('0x16'));var licenseUtil=require(_0x296f('0x17'));var db=require(_0x296f('0x18'))['db'];function respondWithStatusCode(_0x5710ac,_0x4ef1e3){_0x4ef1e3=_0x4ef1e3||0xcc;return function(_0x5b8a18){if(_0x5b8a18){return _0x5710ac[_0x296f('0x19')](_0x4ef1e3);}return _0x5710ac[_0x296f('0x1a')](_0x4ef1e3)[_0x296f('0x1b')]();};}function respondWithResult(_0xe843fc,_0x550b64){_0x550b64=_0x550b64||0xc8;return function(_0xac5d0){if(_0xac5d0){return _0xe843fc['status'](_0x550b64)['json'](_0xac5d0);}};}function respondWithFilteredResult(_0x367e03,_0x2ae0f4){return function(_0x33654c){if(_0x33654c){var _0xa3d57a=typeof _0x2ae0f4['offset']==='undefined'&&typeof _0x2ae0f4[_0x296f('0x1c')]==='undefined';var _0x29f29f=_0x33654c[_0x296f('0x1d')];var _0xfc0b87=_0xa3d57a?0x0:_0x2ae0f4['offset'];var _0xcc2b48=_0xa3d57a?_0x33654c[_0x296f('0x1d')]:_0x2ae0f4['offset']+_0x2ae0f4[_0x296f('0x1c')];var _0x321646;if(_0xcc2b48>=_0x29f29f){_0xcc2b48=_0x29f29f;_0x321646=0xc8;}else{_0x321646=0xce;}_0x367e03[_0x296f('0x1a')](_0x321646);return _0x367e03[_0x296f('0x1e')]('Content-Range',_0xfc0b87+'-'+_0xcc2b48+'/'+_0x29f29f)[_0x296f('0x1f')](_0x33654c);}return null;};}function patchUpdates(_0x474721){return function(_0x54f5d8){try{jsonpatch['apply'](_0x54f5d8,_0x474721,!![]);}catch(_0x54e0de){return BPromise[_0x296f('0x20')](_0x54e0de);}return _0x54f5d8[_0x296f('0x21')]();};}function saveUpdates(_0x56cb8a,_0x2a9a1c){return function(_0x108c9b){if(_0x108c9b){return _0x108c9b[_0x296f('0x22')](_0x56cb8a)['then'](function(_0x4a1912){return _0x4a1912;});}return null;};}function removeEntity(_0x12abfb,_0x58bddc){return function(_0x54a0af){if(_0x54a0af){return _0x54a0af[_0x296f('0x23')]()['then'](function(){_0x12abfb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4c8c,_0x11e3fe){return function(_0x120482){if(!_0x120482){_0x3e4c8c[_0x296f('0x19')](0x194);}return _0x120482;};}function handleError(_0x2b8078,_0xd0aa08){_0xd0aa08=_0xd0aa08||0x1f4;return function(_0x58d8a0){logger['error'](_0x58d8a0[_0x296f('0x24')]);if(_0x58d8a0['name']){delete _0x58d8a0[_0x296f('0x25')];}_0x2b8078[_0x296f('0x1a')](_0xd0aa08)[_0x296f('0x26')](_0x58d8a0);};}exports[_0x296f('0x27')]=function(_0x345485,_0x28d624){var _0x5918eb={},_0x3e66a5={},_0x4eeb0b={'count':0x0,'rows':[]};var _0x167607=_[_0x296f('0x28')](db[_0x296f('0x29')][_0x296f('0x2a')],function(_0x3b5091){return{'name':_0x3b5091[_0x296f('0x2b')],'type':_0x3b5091[_0x296f('0x2c')][_0x296f('0x2d')]};});_0x3e66a5[_0x296f('0x2e')]=_[_0x296f('0x28')](_0x167607,_0x296f('0x25'));_0x3e66a5[_0x296f('0x2f')]=_[_0x296f('0x30')](_0x345485['query']);_0x3e66a5[_0x296f('0x31')]=_[_0x296f('0x32')](_0x3e66a5[_0x296f('0x2e')],_0x3e66a5[_0x296f('0x2f')]);_0x5918eb['attributes']=_['intersection'](_0x3e66a5['model'],qs[_0x296f('0x33')](_0x345485[_0x296f('0x2f')]['fields']));_0x5918eb[_0x296f('0x34')]=_0x5918eb[_0x296f('0x34')]['length']?_0x5918eb['attributes']:_0x3e66a5[_0x296f('0x2e')];if(!_0x345485[_0x296f('0x2f')]['hasOwnProperty'](_0x296f('0x35'))){_0x5918eb[_0x296f('0x1c')]=qs[_0x296f('0x1c')](_0x345485[_0x296f('0x2f')][_0x296f('0x1c')]);_0x5918eb[_0x296f('0x36')]=qs['offset'](_0x345485['query']['offset']);}_0x5918eb[_0x296f('0x37')]=qs['sort'](_0x345485['query'][_0x296f('0x38')]);_0x5918eb[_0x296f('0x39')]=qs[_0x296f('0x31')](_[_0x296f('0x3a')](_0x345485[_0x296f('0x2f')],_0x3e66a5[_0x296f('0x31')]),_0x167607);if(_0x345485[_0x296f('0x2f')]['filter']){_0x5918eb[_0x296f('0x39')]=_[_0x296f('0x3b')](_0x5918eb[_0x296f('0x39')],{'$or':_[_0x296f('0x28')](_0x167607,function(_0x47153f){if(_0x47153f[_0x296f('0x2c')]!==_0x296f('0x3c')){var _0x17208d={};_0x17208d[_0x47153f['name']]={'$like':'%'+_0x345485[_0x296f('0x2f')][_0x296f('0x3d')]+'%'};return _0x17208d;}})});}_0x5918eb=_['merge']({},_0x5918eb,_0x345485[_0x296f('0x3e')]);var _0x134d5d={'where':_0x5918eb['where']};return db['CmHopperBlack'][_0x296f('0x1d')](_0x134d5d)[_0x296f('0x3f')](function(_0x440813){_0x4eeb0b[_0x296f('0x1d')]=_0x440813;if(_0x345485[_0x296f('0x2f')][_0x296f('0x40')]){_0x5918eb[_0x296f('0x41')]=[{'all':!![]}];}return db[_0x296f('0x29')][_0x296f('0x42')](_0x5918eb);})['then'](function(_0x3145a4){_0x4eeb0b['rows']=_0x3145a4;return _0x4eeb0b;})[_0x296f('0x3f')](respondWithFilteredResult(_0x28d624,_0x5918eb))[_0x296f('0x43')](handleError(_0x28d624,null));};exports[_0x296f('0x44')]=function(_0x225be8,_0x57b54c){var _0xccced4={'raw':!![],'where':{'id':_0x225be8[_0x296f('0x45')]['id']}},_0x580a42={};_0x580a42['model']=_['keys'](db['CmHopperBlack'][_0x296f('0x2a')]);_0x580a42[_0x296f('0x2f')]=_[_0x296f('0x30')](_0x225be8[_0x296f('0x2f')]);_0x580a42[_0x296f('0x31')]=_[_0x296f('0x32')](_0x580a42[_0x296f('0x2e')],_0x580a42['query']);_0xccced4['attributes']=_[_0x296f('0x32')](_0x580a42['model'],qs[_0x296f('0x33')](_0x225be8[_0x296f('0x2f')][_0x296f('0x33')]));_0xccced4[_0x296f('0x34')]=_0xccced4[_0x296f('0x34')][_0x296f('0x46')]?_0xccced4[_0x296f('0x34')]:_0x580a42[_0x296f('0x2e')];if(_0x225be8['query']['includeAll']){_0xccced4[_0x296f('0x41')]=[{'all':!![]}];}_0xccced4=_[_0x296f('0x3b')]({},_0xccced4,_0x225be8[_0x296f('0x3e')]);return db[_0x296f('0x29')][_0x296f('0x47')](_0xccced4)[_0x296f('0x3f')](handleEntityNotFound(_0x57b54c,null))['then'](respondWithResult(_0x57b54c,null))['catch'](handleError(_0x57b54c,null));};exports[_0x296f('0x22')]=function(_0x3641e0,_0x4cf2b0){if(_0x3641e0['body']['id']){delete _0x3641e0[_0x296f('0x48')]['id'];}return db[_0x296f('0x29')]['find']({'where':{'id':_0x3641e0[_0x296f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cf2b0,null))['then'](saveUpdates(_0x3641e0['body'],null))[_0x296f('0x3f')](respondWithResult(_0x4cf2b0,null))[_0x296f('0x43')](handleError(_0x4cf2b0,null));};exports[_0x296f('0x23')]=function(_0x5e7ecc,_0x476992){return db[_0x296f('0x29')][_0x296f('0x47')]({'where':{'id':_0x5e7ecc['params']['id']}})[_0x296f('0x3f')](handleEntityNotFound(_0x476992,null))[_0x296f('0x3f')](removeEntity(_0x476992,null))['catch'](handleError(_0x476992,null));};exports[_0x296f('0x49')]=function(_0xd34b21,_0x5c70cc){return db[_0x296f('0x29')]['describe']()['then'](respondWithResult(_0x5c70cc,null))['catch'](handleError(_0x5c70cc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 749e70b..5f2f741 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 _0x67dd=['util','../../config/logger','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x56e008,_0x4ad168){var _0x5ae9a7=function(_0x5eb67c){while(--_0x5eb67c){_0x56e008['push'](_0x56e008['shift']());}};_0x5ae9a7(++_0x4ad168);}(_0x67dd,0xf0));var _0xd67d=function(_0x2aed5d,_0x30b2fd){_0x2aed5d=_0x2aed5d-0x0;var _0x27d38a=_0x67dd[_0x2aed5d];return _0x27d38a;};'use strict';var _=require('lodash');var util=require(_0xd67d('0x0'));var logger=require(_0xd67d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd67d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd67d('0x3'));var config=require(_0xd67d('0x4'));var attributes=require(_0xd67d('0x5'));module[_0xd67d('0x6')]=function(_0x542144,_0x11fe4f){return _0x542144[_0xd67d('0x7')](_0xd67d('0x8'),attributes,{'tableName':_0xd67d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6990=['../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b6f60,_0x5c33b4){var _0xac0557=function(_0x44b2f2){while(--_0x44b2f2){_0x3b6f60['push'](_0x3b6f60['shift']());}};_0xac0557(++_0x5c33b4);}(_0x6990,0x1e6));var _0x0699=function(_0x521ee4,_0x111563){_0x521ee4=_0x521ee4-0x0;var _0x4aaea8=_0x6990[_0x521ee4];return _0x4aaea8;};'use strict';var _=require('lodash');var util=require(_0x0699('0x0'));var logger=require(_0x0699('0x1'))(_0x0699('0x2'));var moment=require(_0x0699('0x3'));var BPromise=require(_0x0699('0x4'));var rp=require(_0x0699('0x5'));var fs=require('fs');var path=require(_0x0699('0x6'));var rimraf=require(_0x0699('0x7'));var config=require(_0x0699('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x0699('0x9')]=function(_0x3d2717,_0x177e50){return _0x3d2717[_0x0699('0xa')](_0x0699('0xb'),attributes,{'tableName':_0x0699('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 1064a84..2985ad4 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 _0x5e71=['limit','map','include','model','CmHopperBlack','body','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes'];(function(_0x55f2c7,_0x3765cb){var _0x2723e0=function(_0x71d263){while(--_0x71d263){_0x55f2c7['push'](_0x55f2c7['shift']());}};_0x2723e0(++_0x3765cb);}(_0x5e71,0x1c4));var _0x15e7=function(_0x50606f,_0x1a937b){_0x50606f=_0x50606f-0x0;var _0x2d7c6b=_0x5e71[_0x50606f];return _0x2d7c6b;};'use strict';var _=require('lodash');var util=require(_0x15e7('0x0'));var moment=require(_0x15e7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15e7('0x2'));var db=require(_0x15e7('0x3'))['db'];var utils=require(_0x15e7('0x4'));var logger=require(_0x15e7('0x5'))(_0x15e7('0x6'));var config=require(_0x15e7('0x7'));var jayson=require(_0x15e7('0x8'));var client=jayson[_0x15e7('0x9')][_0x15e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x822c00,_0xc7aba,_0x51d46b){return new BPromise(function(_0x34b8a6,_0x209f01){return client[_0x15e7('0xb')](_0x822c00,_0x51d46b)[_0x15e7('0xc')](function(_0x46f9c6){logger[_0x15e7('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0xc7aba,_0x15e7('0xe'));logger[_0x15e7('0xf')](_0x15e7('0x10'),_0xc7aba,_0x15e7('0xe'),JSON[_0x15e7('0x11')](_0x46f9c6));if(_0x46f9c6[_0x15e7('0x12')]){if(_0x46f9c6[_0x15e7('0x12')]['code']===0x1f4){logger[_0x15e7('0x12')](_0x15e7('0x13'),_0xc7aba,_0x46f9c6[_0x15e7('0x12')]['message']);return _0x209f01(_0x46f9c6[_0x15e7('0x12')][_0x15e7('0x14')]);}logger[_0x15e7('0x12')](_0x15e7('0x13'),_0xc7aba,_0x46f9c6[_0x15e7('0x12')][_0x15e7('0x14')]);return _0x34b8a6(_0x46f9c6[_0x15e7('0x12')]['message']);}else{logger[_0x15e7('0xd')](_0x15e7('0x13'),_0xc7aba,_0x15e7('0xe'));_0x34b8a6(_0x46f9c6[_0x15e7('0x15')][_0x15e7('0x14')]);}})[_0x15e7('0x16')](function(_0x27f377){logger[_0x15e7('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0xc7aba,_0x27f377);_0x209f01(_0x27f377);});});}exports[_0x15e7('0x17')]=function(_0x19a291){var _0x1c0770=this;return new Promise(function(_0x276146,_0x49db26){return db['CmHopperBlack'][_0x15e7('0x18')]({'raw':_0x19a291['options']?_0x19a291[_0x15e7('0x19')][_0x15e7('0x1a')]===undefined?!![]:![]:!![],'where':_0x19a291['options']?_0x19a291['options'][_0x15e7('0x1b')]||null:null,'attributes':_0x19a291[_0x15e7('0x19')]?_0x19a291[_0x15e7('0x19')][_0x15e7('0x1c')]||null:null,'limit':_0x19a291[_0x15e7('0x19')]?_0x19a291[_0x15e7('0x19')][_0x15e7('0x1d')]||null:null,'include':_0x19a291['options']?_0x19a291['options']['include']?_[_0x15e7('0x1e')](_0x19a291['options'][_0x15e7('0x1f')],function(_0x32e661){return{'model':db[_0x32e661['model']],'as':_0x32e661['as'],'attributes':_0x32e661[_0x15e7('0x1c')],'include':_0x32e661['include']?_[_0x15e7('0x1e')](_0x32e661[_0x15e7('0x1f')],function(_0x15767e){return{'model':db[_0x15767e[_0x15e7('0x20')]],'as':_0x15767e['as'],'attributes':_0x15767e['attributes'],'include':_0x15767e[_0x15e7('0x1f')]?_[_0x15e7('0x1e')](_0x15767e[_0x15e7('0x1f')],function(_0x5b7c17){return{'model':db[_0x5b7c17[_0x15e7('0x20')]],'as':_0x5b7c17['as'],'attributes':_0x5b7c17['attributes']};}):[]};}):[]};}):[]:[]})[_0x15e7('0xc')](function(_0x4bc629){logger[_0x15e7('0xd')](_0x15e7('0x17'),_0x19a291);logger[_0x15e7('0xf')](_0x15e7('0x17'),_0x19a291,JSON[_0x15e7('0x11')](_0x4bc629));_0x276146(_0x4bc629);})['catch'](function(_0x201a44){logger[_0x15e7('0x12')](_0x15e7('0x17'),_0x201a44[_0x15e7('0x14')],_0x19a291);_0x49db26(_0x1c0770['error'](0x1f4,_0x201a44[_0x15e7('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x17231e){var _0xe79887=this;return new Promise(function(_0x564855,_0x1d38ed){return db[_0x15e7('0x21')]['update'](_0x17231e[_0x15e7('0x22')],{'raw':_0x17231e[_0x15e7('0x19')]?_0x17231e[_0x15e7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17231e['options']?_0x17231e['options'][_0x15e7('0x1b')]||null:null,'attributes':_0x17231e[_0x15e7('0x19')]?_0x17231e['options'][_0x15e7('0x1c')]||null:null,'limit':_0x17231e[_0x15e7('0x19')]?_0x17231e['options'][_0x15e7('0x1d')]||null:null})[_0x15e7('0xc')](function(_0x14082c){logger[_0x15e7('0xd')]('UpdateCmHopperBlack',_0x17231e);logger[_0x15e7('0xf')](_0x15e7('0x23'),_0x17231e,JSON['stringify'](_0x14082c));_0x564855(_0x14082c);})[_0x15e7('0x16')](function(_0x4ba940){logger[_0x15e7('0x12')](_0x15e7('0x23'),_0x4ba940[_0x15e7('0x14')],_0x17231e);_0x1d38ed(_0xe79887[_0x15e7('0x12')](0x1f4,_0x4ba940[_0x15e7('0x14')]));});});};exports[_0x15e7('0x24')]=function(_0x17d677){var _0x229dae=this;return new Promise(function(_0x5a3eea,_0x335332){return db[_0x15e7('0x21')]['destroy']({'where':_0x17d677[_0x15e7('0x19')]?_0x17d677[_0x15e7('0x19')][_0x15e7('0x1b')]||null:null})['then'](function(_0x1dbaf7){logger[_0x15e7('0xd')](_0x15e7('0x24'),_0x17d677);logger[_0x15e7('0xf')](_0x15e7('0x24'),_0x17d677,JSON[_0x15e7('0x11')](_0x1dbaf7));_0x5a3eea(_0x1dbaf7);})['catch'](function(_0x369267){logger[_0x15e7('0x12')](_0x15e7('0x24'),_0x369267[_0x15e7('0x14')],_0x17d677);_0x335332(_0x229dae[_0x15e7('0x12')](0x1f4,_0x369267[_0x15e7('0x14')]));});});}; \ No newline at end of file +var _0x353b=['options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','catch','DestroyCmHopperBlack','CmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetCmHopperBlack'];(function(_0x351b5c,_0x10b470){var _0x335606=function(_0x4528de){while(--_0x4528de){_0x351b5c['push'](_0x351b5c['shift']());}};_0x335606(++_0x10b470);}(_0x353b,0x1af));var _0xb353=function(_0x582e18,_0x4fd856){_0x582e18=_0x582e18-0x0;var _0x445d03=_0x353b[_0x582e18];return _0x445d03;};'use strict';var _=require(_0xb353('0x0'));var util=require(_0xb353('0x1'));var moment=require(_0xb353('0x2'));var BPromise=require(_0xb353('0x3'));var rs=require(_0xb353('0x4'));var fs=require('fs');var Redis=require(_0xb353('0x5'));var db=require(_0xb353('0x6'))['db'];var utils=require(_0xb353('0x7'));var logger=require(_0xb353('0x8'))(_0xb353('0x9'));var config=require(_0xb353('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb353('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4711e6,_0x4269bb,_0xf2fa87){return new BPromise(function(_0x10b068,_0x79281f){return client[_0xb353('0xc')](_0x4711e6,_0xf2fa87)[_0xb353('0xd')](function(_0x5048de){logger['info'](_0xb353('0xe'),_0x4269bb,_0xb353('0xf'));logger[_0xb353('0x10')](_0xb353('0x11'),_0x4269bb,_0xb353('0xf'),JSON[_0xb353('0x12')](_0x5048de));if(_0x5048de[_0xb353('0x13')]){if(_0x5048de[_0xb353('0x13')][_0xb353('0x14')]===0x1f4){logger['error'](_0xb353('0xe'),_0x4269bb,_0x5048de[_0xb353('0x13')][_0xb353('0x15')]);return _0x79281f(_0x5048de['error'][_0xb353('0x15')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4269bb,_0x5048de[_0xb353('0x13')]['message']);return _0x10b068(_0x5048de[_0xb353('0x13')][_0xb353('0x15')]);}else{logger[_0xb353('0x16')](_0xb353('0xe'),_0x4269bb,'request\x20sent');_0x10b068(_0x5048de[_0xb353('0x17')][_0xb353('0x15')]);}})['catch'](function(_0x110bfe){logger['error'](_0xb353('0xe'),_0x4269bb,_0x110bfe);_0x79281f(_0x110bfe);});});}exports[_0xb353('0x18')]=function(_0x2c1497){var _0x33a9be=this;return new Promise(function(_0x4b7f33,_0x2d578d){return db['CmHopperBlack']['findAll']({'raw':_0x2c1497[_0xb353('0x19')]?_0x2c1497[_0xb353('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c1497[_0xb353('0x19')]?_0x2c1497[_0xb353('0x19')][_0xb353('0x1a')]||null:null,'attributes':_0x2c1497[_0xb353('0x19')]?_0x2c1497[_0xb353('0x19')][_0xb353('0x1b')]||null:null,'limit':_0x2c1497['options']?_0x2c1497[_0xb353('0x19')][_0xb353('0x1c')]||null:null,'include':_0x2c1497['options']?_0x2c1497[_0xb353('0x19')][_0xb353('0x1d')]?_[_0xb353('0x1e')](_0x2c1497[_0xb353('0x19')][_0xb353('0x1d')],function(_0x47ab81){return{'model':db[_0x47ab81[_0xb353('0x1f')]],'as':_0x47ab81['as'],'attributes':_0x47ab81['attributes'],'include':_0x47ab81[_0xb353('0x1d')]?_[_0xb353('0x1e')](_0x47ab81[_0xb353('0x1d')],function(_0x25d900){return{'model':db[_0x25d900[_0xb353('0x1f')]],'as':_0x25d900['as'],'attributes':_0x25d900['attributes'],'include':_0x25d900[_0xb353('0x1d')]?_[_0xb353('0x1e')](_0x25d900['include'],function(_0x2aae0e){return{'model':db[_0x2aae0e[_0xb353('0x1f')]],'as':_0x2aae0e['as'],'attributes':_0x2aae0e[_0xb353('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb353('0xd')](function(_0x4eb40a){logger['info'](_0xb353('0x18'),_0x2c1497);logger['debug']('GetCmHopperBlack',_0x2c1497,JSON[_0xb353('0x12')](_0x4eb40a));_0x4b7f33(_0x4eb40a);})['catch'](function(_0x2b9d62){logger[_0xb353('0x13')](_0xb353('0x18'),_0x2b9d62['message'],_0x2c1497);_0x2d578d(_0x33a9be[_0xb353('0x13')](0x1f4,_0x2b9d62[_0xb353('0x15')]));});});};exports[_0xb353('0x20')]=function(_0x18bd30){var _0x230761=this;return new Promise(function(_0x45ac61,_0xbced01){return db['CmHopperBlack'][_0xb353('0x21')](_0x18bd30['body'],{'raw':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')][_0xb353('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')]['where']||null:null,'attributes':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')][_0xb353('0x1b')]||null:null,'limit':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')][_0xb353('0x1c')]||null:null})[_0xb353('0xd')](function(_0x45b4e9){logger[_0xb353('0x16')](_0xb353('0x20'),_0x18bd30);logger[_0xb353('0x10')](_0xb353('0x20'),_0x18bd30,JSON[_0xb353('0x12')](_0x45b4e9));_0x45ac61(_0x45b4e9);})[_0xb353('0x23')](function(_0x4224d9){logger[_0xb353('0x13')](_0xb353('0x20'),_0x4224d9['message'],_0x18bd30);_0xbced01(_0x230761['error'](0x1f4,_0x4224d9[_0xb353('0x15')]));});});};exports[_0xb353('0x24')]=function(_0x5bb660){var _0x370964=this;return new Promise(function(_0xf82637,_0x3aefb3){return db[_0xb353('0x25')]['destroy']({'where':_0x5bb660['options']?_0x5bb660[_0xb353('0x19')]['where']||null:null})[_0xb353('0xd')](function(_0x4d4822){logger['info']('DestroyCmHopperBlack',_0x5bb660);logger[_0xb353('0x10')](_0xb353('0x24'),_0x5bb660,JSON[_0xb353('0x12')](_0x4d4822));_0xf82637(_0x4d4822);})['catch'](function(_0x8ca34){logger[_0xb353('0x13')](_0xb353('0x24'),_0x8ca34[_0xb353('0x15')],_0x5bb660);_0x3aefb3(_0x370964[_0xb353('0x13')](0x1f4,_0x8ca34[_0xb353('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 78ddcd9..6be8e19 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 _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x14fad3,_0x21d0f6){var _0x291026=function(_0x113e3d){while(--_0x113e3d){_0x14fad3['push'](_0x14fad3['shift']());}};_0x291026(++_0x21d0f6);}(_0x11e5,0x8b));var _0x511e=function(_0x5f0c76,_0x44b266){_0x5f0c76=_0x5f0c76-0x0;var _0x308606=_0x11e5[_0x5f0c76];return _0x308606;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3831=['get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x3e5d3c,_0x3894e0){var _0x4e1c5e=function(_0x2f370d){while(--_0x2f370d){_0x3e5d3c['push'](_0x3e5d3c['shift']());}};_0x4e1c5e(++_0x3894e0);}(_0x3831,0x14c));var _0x1383=function(_0x3fbe46,_0x12a0d1){_0x3fbe46=_0x3fbe46-0x0;var _0x27c406=_0x3831[_0x3fbe46];return _0x27c406;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0xd')](_0x1383('0xb'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0xf')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d384ccb..a302a9e 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 _0xa20f=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x177ce1,_0x4d0a0f){var _0x3a50d6=function(_0x4d833c){while(--_0x4d833c){_0x177ce1['push'](_0x177ce1['shift']());}};_0x3a50d6(++_0x4d0a0f);}(_0xa20f,0x76));var _0xfa20=function(_0x597065,_0x5e231e){_0x597065=_0x597065-0x0;var _0x5ecbe9=_0xa20f[_0x597065];return _0x5ecbe9;};'use strict';var Sequelize=require(_0xfa20('0x0'));var moment=require(_0xfa20('0x1'));module[_0xfa20('0x2')]={'state':{'type':Sequelize[_0xfa20('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xfa20('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfa20('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfa20('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfa20('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xfa20('0x5')]},'responsetime':{'type':Sequelize[_0xfa20('0x5')]},'answertime':{'type':Sequelize[_0xfa20('0x5')]},'droptime':{'type':Sequelize[_0xfa20('0x5')]},'endtime':{'type':Sequelize[_0xfa20('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfa20('0x4')]},'campaign':{'type':Sequelize[_0xfa20('0x4')]},'campaigntype':{'type':Sequelize[_0xfa20('0x4')]},'membername':{'type':Sequelize[_0xfa20('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xfa20('0x4')]},'secondDisposition':{'type':Sequelize[_0xfa20('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfa20('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x573f67){var _0x24c7eb=this[_0xfa20('0x6')](_0xfa20('0x7'));if(_0x24c7eb&&_0x573f67){this[_0xfa20('0x8')]('followuptime',moment(_0x573f67)[_0xfa20('0x9')](moment(_0x24c7eb),_0xfa20('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfa20('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfa20('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xfa20('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfa20('0x5')]},'recallme':{'type':Sequelize[_0xfa20('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfa20('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfa20('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1516=['diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x1d4d56,_0x335121){var _0x292a68=function(_0xd002e6){while(--_0xd002e6){_0x1d4d56['push'](_0x1d4d56['shift']());}};_0x292a68(++_0x335121);}(_0x1516,0x18f));var _0x6151=function(_0x3272db,_0x4ee2a6){_0x3272db=_0x3272db-0x0;var _0x542e40=_0x1516[_0x3272db];return _0x542e40;};'use strict';var Sequelize=require(_0x6151('0x0'));var moment=require('moment');module[_0x6151('0x1')]={'state':{'type':Sequelize[_0x6151('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6151('0x3')]},'scheduledat':{'type':Sequelize[_0x6151('0x4')]},'countbusyretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6151('0x3')]},'calleridname':{'type':Sequelize[_0x6151('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6151('0x4')]},'answertime':{'type':Sequelize[_0x6151('0x4')]},'droptime':{'type':Sequelize[_0x6151('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6151('0x3')]},'campaign':{'type':Sequelize[_0x6151('0x3')]},'campaigntype':{'type':Sequelize[_0x6151('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6151('0x3')]},'disposition':{'type':Sequelize[_0x6151('0x3')]},'secondDisposition':{'type':Sequelize[_0x6151('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6151('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x29917d){var _0x5da5be=this[_0x6151('0x5')](_0x6151('0x6'));if(_0x5da5be&&_0x29917d){this[_0x6151('0x7')](_0x6151('0x8'),moment(_0x29917d)[_0x6151('0x9')](moment(_0x5da5be),_0x6151('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6151('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6151('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6151('0x4')]},'deleted':{'type':Sequelize[_0x6151('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6151('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 37fafca..4970032 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end'];(function(_0x48c09b,_0x12d95c){var _0x5a53c1=function(_0x2ceafb){while(--_0x2ceafb){_0x48c09b['push'](_0x48c09b['shift']());}};_0x5a53c1(++_0x12d95c);}(_0xb016,0x159));var _0x6b01=function(_0x283935,_0x3855b0){_0x283935=_0x283935-0x0;var _0x5e438d=_0xb016[_0x283935];return _0x5e438d;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file +var _0x781d=['length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['describe']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['describe']()[_0xd781('0x26')](respondWithResult(_0x16d16e,null))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x39ecdb,_0x336d30){if(_0x39ecdb[_0xd781('0x44')][_0xd781('0x45')]){delete _0x39ecdb['body'][_0xd781('0x45')];}return db[_0xd781('0x2c')][_0xd781('0x46')]({'where':{'uniqueid':_0x39ecdb['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x336d30,null))[_0xd781('0x26')](saveUpdates(_0x39ecdb['body'],null))[_0xd781('0x26')](respondWithResult(_0x336d30,null))[_0xd781('0x3f')](handleError(_0x336d30,null));};exports[_0xd781('0x47')]=function(_0x207546,_0x42a2f9,_0x599915){return db[_0xd781('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x207546[_0xd781('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xd781('0x4b')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xd781('0x4c')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal'](_0xd781('0x4f')))),_0xd781('0x50')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd781('0x53')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x54')))),_0xd781('0x55')]]})['then'](handleEntityNotFound(_0x42a2f9,null))[_0xd781('0x26')](respondWithResult(_0x42a2f9,null))[_0xd781('0x3f')](handleError(_0x42a2f9,null));};exports[_0xd781('0x56')]=function(_0x2c4874,_0x2e8bab,_0x38bd3e){return db[_0xd781('0x2c')][_0xd781('0x57')]({'raw':![],'where':{'CampaignId':_0x2c4874[_0xd781('0x41')]['id']},'attributes':[[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x58')))),_0xd781('0x59')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5a')))),_0xd781('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4f')))),_0xd781('0x50')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5b')))),_0xd781('0x53')],[db['sequelize']['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xd781('0x26')](handleEntityNotFound(_0x2e8bab,null))[_0xd781('0x26')](respondWithResult(_0x2e8bab,null))[_0xd781('0x3f')](handleError(_0x2e8bab,null));};exports[_0xd781('0x5c')]=function(_0x26a0a9,_0x172a05,_0x2e0401){return db[_0xd781('0x5d')][_0xd781('0x46')]({'where':{'id':_0x26a0a9['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x172a05,null))[_0xd781('0x26')](function(_0x4c712f){var _0x24e3f5;if(_0x4c712f){_0x24e3f5=squel['insert']()[_0xd781('0x5e')](_0xd781('0x5f'))['fromQuery'](['phone',_0xd781('0x60'),_0xd781('0x61'),_0xd781('0x62'),_0xd781('0x63'),_0xd781('0x64'),_0xd781('0x65')],squel['select']()[_0xd781('0x66')](_0xd781('0x67'),_0xd781('0x68'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),'ListId')[_0xd781('0x66')]('ANY_VALUE(VoiceQueueId)',_0xd781('0x63'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x65'))[_0xd781('0x6c')](_0xd781('0x6d'))[_0xd781('0x39')]('VoiceQueueId\x20=\x20?',_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]())['where'](_0xd781('0x6f'),_0x26a0a9[_0xd781('0x44')][_0xd781('0x70')]['toString']())['where'](_0xd781('0x71'))['where'](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x68'))[_0xd781('0x6c')]('cm_hopper')[_0xd781('0x39')](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))[_0xd781('0x6c')](_0xd781('0x6d'))['where'](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id']['toString']())[_0xd781('0x39')](_0xd781('0x76')))[_0xd781('0x77')]('ContactId'))[_0xd781('0x6e')]();return db[_0xd781('0x49')]['query'](_0x24e3f5);}return[];})[_0xd781('0x26')](respondWithResult(_0x172a05,null))['catch'](handleError(_0x172a05,null));};exports[_0xd781('0x78')]=function(_0x23dba5,_0x3e0749,_0x192c95){return db[_0xd781('0x79')]['find']({'where':{'id':_0x23dba5[_0xd781('0x41')]['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x3e0749,null))[_0xd781('0x26')](function(_0x3897bf){var _0xaa945b;if(_0x3897bf){_0xaa945b=squel[_0xd781('0x7a')]()['into'](_0xd781('0x5f'))[_0xd781('0x7b')](['phone',_0xd781('0x60'),_0xd781('0x61'),'ListId',_0xd781('0x7c'),_0xd781('0x64'),_0xd781('0x65')],squel[_0xd781('0x73')]()[_0xd781('0x66')]('ANY_VALUE(calleridnum)','phone')['field'](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),_0xd781('0x62'))[_0xd781('0x66')]('ANY_VALUE(CampaignId)',_0xd781('0x7c'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')]('NOW()','updatedAt')['from'](_0xd781('0x6d'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id']['toString']())['where'](_0xd781('0x6f'),_0x23dba5[_0xd781('0x44')][_0xd781('0x70')][_0xd781('0x6e')]())['where'](_0xd781('0x71'))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')]('phone')[_0xd781('0x6c')](_0xd781('0x5f'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))['from']('cm_hopper_final')[_0xd781('0x39')](_0xd781('0x7d'),_0x23dba5['params']['id'][_0xd781('0x6e')]())[_0xd781('0x39')]('state\x20=\x204'))[_0xd781('0x77')](_0xd781('0x61')))['toString']();return db[_0xd781('0x49')]['query'](_0xaa945b);}return[];})[_0xd781('0x26')](respondWithResult(_0x3e0749,null))[_0xd781('0x3f')](handleError(_0x3e0749,null));};exports[_0xd781('0x7e')]=function(_0x52b9c6,_0x5a2252,_0x356c56){return db[_0xd781('0x7f')]['findOne']({'where':{'VoiceQueueId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x63')],'CampaignId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x7c')],'ContactId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x61')]}})[_0xd781('0x26')](handleEntityNotFound(_0x5a2252,null))[_0xd781('0x26')](function(_0x532fd8){if(_0x532fd8){return _0x532fd8;}return null;})[_0xd781('0x26')](respondWithResult(_0x5a2252,null))[_0xd781('0x3f')](handleError(_0x5a2252,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 580943b..fbccb25 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 _0xc556=['bluebird','request-promise','path','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0xc556,0x64));var _0x6c55=function(_0x46a14f,_0x46ca40){_0x46a14f=_0x46a14f-0x0;var _0x4e26f9=_0xc556[_0x46a14f];return _0x4e26f9;};'use strict';var _=require(_0x6c55('0x0'));var util=require(_0x6c55('0x1'));var logger=require(_0x6c55('0x2'))('api');var moment=require(_0x6c55('0x3'));var BPromise=require(_0x6c55('0x4'));var rp=require(_0x6c55('0x5'));var fs=require('fs');var path=require(_0x6c55('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c55('0x7'));module[_0x6c55('0x8')]=function(_0x5b40f8,_0x5c73f7){return _0x5b40f8['define'](_0x6c55('0x9'),attributes,{'tableName':_0x6c55('0xa'),'paranoid':![],'indexes':[{'name':_0x6c55('0xb'),'fields':[_0x6c55('0xb')]},{'name':_0x6c55('0xc'),'fields':[_0x6c55('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72c6=['uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x1b0307,_0x4336b1){var _0x5c8d34=function(_0x5b1b61){while(--_0x5b1b61){_0x1b0307['push'](_0x1b0307['shift']());}};_0x5c8d34(++_0x4336b1);}(_0x72c6,0x12d));var _0x672c=function(_0x432b00,_0x2e042a){_0x432b00=_0x432b00-0x0;var _0x38863d=_0x72c6[_0x432b00];return _0x38863d;};'use strict';var _=require(_0x672c('0x0'));var util=require('util');var logger=require(_0x672c('0x1'))(_0x672c('0x2'));var moment=require(_0x672c('0x3'));var BPromise=require('bluebird');var rp=require(_0x672c('0x4'));var fs=require('fs');var path=require(_0x672c('0x5'));var rimraf=require(_0x672c('0x6'));var config=require(_0x672c('0x7'));var attributes=require(_0x672c('0x8'));module[_0x672c('0x9')]=function(_0x18917a,_0x4de097){return _0x18917a[_0x672c('0xa')](_0x672c('0xb'),attributes,{'tableName':_0x672c('0xc'),'paranoid':![],'indexes':[{'name':_0x672c('0xd'),'fields':[_0x672c('0xd')]},{'name':'uniqueid','fields':[_0x672c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b55bee4..fdbcb5e 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(_0x293f49,_0x5ed862){var _0x3f422b=function(_0x80faa6){while(--_0x80faa6){_0x293f49['push'](_0x293f49['shift']());}};_0x3f422b(++_0x5ed862);}(_0xb10b,0x12a));var _0xbb10=function(_0x7b717,_0x311539){_0x7b717=_0x7b717-0x0;var _0x50d254=_0xb10b[_0x7b717];return _0x50d254;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x45bbea,_0x57d616){var _0x13c113=function(_0x5cabcf){while(--_0x5cabcf){_0x45bbea['push'](_0x45bbea['shift']());}};_0x13c113(++_0x57d616);}(_0xb10b,0x12a));var _0xbb10=function(_0x22d7e6,_0xa620e7){_0x22d7e6=_0x22d7e6-0x0;var _0x72bc58=_0xb10b[_0x22d7e6];return _0x72bc58;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 991605b..289805d 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 _0xbd23=['/describe','describe','/:id','show','get','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xbd23,0x7b));var _0x3bd2=function(_0x586642,_0x3b2e5d){_0x586642=_0x586642-0x0;var _0xef997a=_0xbd23[_0x586642];return _0xef997a;};'use strict';var multer=require(_0x3bd2('0x0'));var util=require(_0x3bd2('0x1'));var path=require(_0x3bd2('0x2'));var timeout=require('connect-timeout');var express=require(_0x3bd2('0x3'));var router=express[_0x3bd2('0x4')]();var fs_extra=require(_0x3bd2('0x5'));var auth=require(_0x3bd2('0x6'));var interaction=require(_0x3bd2('0x7'));var config=require(_0x3bd2('0x8'));var controller=require(_0x3bd2('0x9'));router['get']('/',auth[_0x3bd2('0xa')](),controller[_0x3bd2('0xb')]);router['get'](_0x3bd2('0xc'),auth[_0x3bd2('0xa')](),controller[_0x3bd2('0xd')]);router['get'](_0x3bd2('0xe'),auth[_0x3bd2('0xa')](),controller[_0x3bd2('0xf')]);router[_0x3bd2('0x10')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x3bd2('0x11')]);router[_0x3bd2('0x10')](_0x3bd2('0x12'),auth[_0x3bd2('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x3bd2('0x13')](_0x3bd2('0x14'),auth[_0x3bd2('0xa')](),controller[_0x3bd2('0x15')]);router['post'](_0x3bd2('0x16'),auth['isAuthenticated'](),controller[_0x3bd2('0x17')]);router[_0x3bd2('0x13')]('/checkContactHopper',auth[_0x3bd2('0xa')](),controller[_0x3bd2('0x18')]);router[_0x3bd2('0x19')](_0x3bd2('0xe'),auth[_0x3bd2('0xa')](),controller['update']);module[_0x3bd2('0x1a')]=router; \ No newline at end of file +var _0xc5f1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x37870d,_0x356e02){var _0x1ae695=function(_0x508f6c){while(--_0x508f6c){_0x37870d['push'](_0x37870d['shift']());}};_0x1ae695(++_0x356e02);}(_0xc5f1,0xb1));var _0x1c5f=function(_0x4c819f,_0xa998a1){_0x4c819f=_0x4c819f-0x0;var _0x43320d=_0xc5f1[_0x4c819f];return _0x43320d;};'use strict';var multer=require(_0x1c5f('0x0'));var util=require('util');var path=require(_0x1c5f('0x1'));var timeout=require(_0x1c5f('0x2'));var express=require(_0x1c5f('0x3'));var router=express[_0x1c5f('0x4')]();var fs_extra=require(_0x1c5f('0x5'));var auth=require(_0x1c5f('0x6'));var interaction=require(_0x1c5f('0x7'));var config=require(_0x1c5f('0x8'));var controller=require(_0x1c5f('0x9'));router[_0x1c5f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c5f('0xa')]('/describe',auth[_0x1c5f('0xb')](),controller[_0x1c5f('0xc')]);router['get'](_0x1c5f('0xd'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0xe')]);router[_0x1c5f('0xa')](_0x1c5f('0xf'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0x10')]);router['get'](_0x1c5f('0x11'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0x12')]);router[_0x1c5f('0x13')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1c5f('0x13')](_0x1c5f('0x14'),auth['isAuthenticated'](),controller[_0x1c5f('0x15')]);router['post'](_0x1c5f('0x16'),auth[_0x1c5f('0xb')](),controller['checkContactHopper']);router[_0x1c5f('0x17')](_0x1c5f('0xd'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0x18')]);module[_0x1c5f('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0f92562..7c1395f 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 _0xcabf=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcabf,0x102));var _0xfcab=function(_0x5a86da,_0x24541a){_0x5a86da=_0x5a86da-0x0;var _0x231593=_0xcabf[_0x5a86da];return _0x231593;};'use strict';var Sequelize=require(_0xfcab('0x0'));module[_0xfcab('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfcab('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xfcab('0x3')]},'calleridnum':{'type':Sequelize[_0xfcab('0x3')]},'calleridname':{'type':Sequelize[_0xfcab('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xfcab('0x4')]},'answertime':{'type':Sequelize[_0xfcab('0x4')]},'droptime':{'type':Sequelize[_0xfcab('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xfcab('0x3')]},'campaigntype':{'type':Sequelize[_0xfcab('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xfcab('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xfcab('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xfcab('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfcab('0x4')]},'recallme':{'type':Sequelize[_0xfcab('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfcab('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcf8=['INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x10dfc9,_0x25b62c){var _0x154afc=function(_0x5099ac){while(--_0x5099ac){_0x10dfc9['push'](_0x10dfc9['shift']());}};_0x154afc(++_0x25b62c);}(_0xbcf8,0x15d));var _0x8bcf=function(_0x379340,_0x46b98f){_0x379340=_0x379340-0x0;var _0x4a0a1f=_0xbcf8[_0x379340];return _0x4a0a1f;};'use strict';var Sequelize=require(_0x8bcf('0x0'));module['exports']={'state':{'type':Sequelize[_0x8bcf('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8bcf('0x2')]},'countbusyretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8bcf('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8bcf('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8bcf('0x2')]},'responsetime':{'type':Sequelize[_0x8bcf('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8bcf('0x2')]},'ringtime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8bcf('0x3')]},'campaign':{'type':Sequelize[_0x8bcf('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8bcf('0x3')]},'amd':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8bcf('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8bcf('0x2')]},'edited':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8bcf('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d09cf02..157bf0c 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 _0xe0a5=['rows','catch','show','params','rawAttributes','length','find','create','body','describe','uniqueid','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe0a5,0xa1));var _0x5e0a=function(_0x4812c9,_0x154b76){_0x4812c9=_0x4812c9-0x0;var _0x4de61f=_0xe0a5[_0x4812c9];return _0x4de61f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e0a('0x0'));var zipdir=require(_0x5e0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e0a('0x2'));var moment=require(_0x5e0a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e0a('0x4'));var util=require('util');var path=require(_0x5e0a('0x5'));var sox=require(_0x5e0a('0x6'));var csv=require(_0x5e0a('0x7'));var ejs=require(_0x5e0a('0x8'));var fs=require('fs');var fs_extra=require(_0x5e0a('0x9'));var _=require(_0x5e0a('0xa'));var squel=require(_0x5e0a('0xb'));var crypto=require('crypto');var jsforce=require(_0x5e0a('0xc'));var deskjs=require(_0x5e0a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e0a('0xe'));var Papa=require(_0x5e0a('0xf'));var Redis=require(_0x5e0a('0x10'));var authService=require(_0x5e0a('0x11'));var qs=require(_0x5e0a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e0a('0x13'));var logger=require('../../config/logger')(_0x5e0a('0x14'));var utils=require(_0x5e0a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5e0a('0x16'))['db'];function respondWithStatusCode(_0x1fa768,_0x4e4416){_0x4e4416=_0x4e4416||0xcc;return function(_0xe12b45){if(_0xe12b45){return _0x1fa768[_0x5e0a('0x17')](_0x4e4416);}return _0x1fa768['status'](_0x4e4416)[_0x5e0a('0x18')]();};}function respondWithResult(_0x457573,_0x2b12a1){_0x2b12a1=_0x2b12a1||0xc8;return function(_0x2ceca6){if(_0x2ceca6){return _0x457573[_0x5e0a('0x19')](_0x2b12a1)[_0x5e0a('0x1a')](_0x2ceca6);}};}function respondWithFilteredResult(_0x35cdd4,_0x2dde51){return function(_0x2532fd){if(_0x2532fd){var _0x461bd1=typeof _0x2dde51[_0x5e0a('0x1b')]===_0x5e0a('0x1c')&&typeof _0x2dde51['limit']===_0x5e0a('0x1c');var _0xc35f6f=_0x2532fd[_0x5e0a('0x1d')];var _0x523502=_0x461bd1?0x0:_0x2dde51[_0x5e0a('0x1b')];var _0x209fb4=_0x461bd1?_0x2532fd[_0x5e0a('0x1d')]:_0x2dde51['offset']+_0x2dde51[_0x5e0a('0x1e')];var _0x19d5a;if(_0x209fb4>=_0xc35f6f){_0x209fb4=_0xc35f6f;_0x19d5a=0xc8;}else{_0x19d5a=0xce;}_0x35cdd4['status'](_0x19d5a);return _0x35cdd4['set'](_0x5e0a('0x1f'),_0x523502+'-'+_0x209fb4+'/'+_0xc35f6f)['json'](_0x2532fd);}return null;};}function patchUpdates(_0x109486){return function(_0x32782a){try{jsonpatch[_0x5e0a('0x20')](_0x32782a,_0x109486,!![]);}catch(_0x161a70){return BPromise[_0x5e0a('0x21')](_0x161a70);}return _0x32782a[_0x5e0a('0x22')]();};}function saveUpdates(_0x5e5b51,_0x370c5d){return function(_0x1fec08){if(_0x1fec08){return _0x1fec08[_0x5e0a('0x23')](_0x5e5b51)[_0x5e0a('0x24')](function(_0x373f02){return _0x373f02;});}return null;};}function removeEntity(_0x402d05,_0x506854){return function(_0x4e7a1f){if(_0x4e7a1f){return _0x4e7a1f[_0x5e0a('0x25')]()[_0x5e0a('0x24')](function(){_0x402d05[_0x5e0a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4494ef,_0x40242a){return function(_0x5d5795){if(!_0x5d5795){_0x4494ef['sendStatus'](0x194);}return _0x5d5795;};}function handleError(_0x3ab854,_0x5a118b){_0x5a118b=_0x5a118b||0x1f4;return function(_0x409bbc){logger['error'](_0x409bbc[_0x5e0a('0x26')]);if(_0x409bbc[_0x5e0a('0x27')]){delete _0x409bbc[_0x5e0a('0x27')];}_0x3ab854[_0x5e0a('0x19')](_0x5a118b)[_0x5e0a('0x28')](_0x409bbc);};}exports[_0x5e0a('0x29')]=function(_0x3a900c,_0x4f428a){var _0x2944e5={},_0x54adf5={},_0x18bdaf={'count':0x0,'rows':[]};var _0x21803d=_[_0x5e0a('0x2a')](db[_0x5e0a('0x2b')]['rawAttributes'],function(_0x10f30b){return{'name':_0x10f30b['fieldName'],'type':_0x10f30b[_0x5e0a('0x2c')][_0x5e0a('0x2d')]};});_0x54adf5['model']=_[_0x5e0a('0x2a')](_0x21803d,_0x5e0a('0x27'));_0x54adf5[_0x5e0a('0x2e')]=_[_0x5e0a('0x2f')](_0x3a900c[_0x5e0a('0x2e')]);_0x54adf5[_0x5e0a('0x30')]=_[_0x5e0a('0x31')](_0x54adf5[_0x5e0a('0x32')],_0x54adf5['query']);_0x2944e5['attributes']=_['intersection'](_0x54adf5[_0x5e0a('0x32')],qs['fields'](_0x3a900c[_0x5e0a('0x2e')][_0x5e0a('0x33')]));_0x2944e5[_0x5e0a('0x34')]=_0x2944e5[_0x5e0a('0x34')]['length']?_0x2944e5['attributes']:_0x54adf5[_0x5e0a('0x32')];if(!_0x3a900c[_0x5e0a('0x2e')]['hasOwnProperty']('nolimit')){_0x2944e5[_0x5e0a('0x1e')]=qs[_0x5e0a('0x1e')](_0x3a900c[_0x5e0a('0x2e')]['limit']);_0x2944e5[_0x5e0a('0x1b')]=qs[_0x5e0a('0x1b')](_0x3a900c[_0x5e0a('0x2e')][_0x5e0a('0x1b')]);}_0x2944e5[_0x5e0a('0x35')]=qs[_0x5e0a('0x36')](_0x3a900c[_0x5e0a('0x2e')][_0x5e0a('0x36')]);_0x2944e5['where']=qs[_0x5e0a('0x30')](_[_0x5e0a('0x37')](_0x3a900c[_0x5e0a('0x2e')],_0x54adf5[_0x5e0a('0x30')]),_0x21803d);if(_0x3a900c[_0x5e0a('0x2e')]['filter']){_0x2944e5[_0x5e0a('0x38')]=_['merge'](_0x2944e5[_0x5e0a('0x38')],{'$or':_[_0x5e0a('0x2a')](_0x21803d,function(_0x37c2c9){if(_0x37c2c9[_0x5e0a('0x2c')]!==_0x5e0a('0x39')){var _0x2dce51={};_0x2dce51[_0x37c2c9['name']]={'$like':'%'+_0x3a900c[_0x5e0a('0x2e')][_0x5e0a('0x3a')]+'%'};return _0x2dce51;}})});}_0x2944e5=_[_0x5e0a('0x3b')]({},_0x2944e5,_0x3a900c[_0x5e0a('0x3c')]);var _0x3f5d84={'where':_0x2944e5[_0x5e0a('0x38')]};return db[_0x5e0a('0x2b')][_0x5e0a('0x1d')](_0x3f5d84)[_0x5e0a('0x24')](function(_0x24e554){_0x18bdaf['count']=_0x24e554;if(_0x3a900c[_0x5e0a('0x2e')][_0x5e0a('0x3d')]){_0x2944e5[_0x5e0a('0x3e')]=[{'all':!![]}];}return db[_0x5e0a('0x2b')][_0x5e0a('0x3f')](_0x2944e5);})[_0x5e0a('0x24')](function(_0x11776e){_0x18bdaf[_0x5e0a('0x40')]=_0x11776e;return _0x18bdaf;})[_0x5e0a('0x24')](respondWithFilteredResult(_0x4f428a,_0x2944e5))[_0x5e0a('0x41')](handleError(_0x4f428a,null));};exports[_0x5e0a('0x42')]=function(_0x4db735,_0x114e85){var _0x2f0f75={'raw':!![],'where':{'id':_0x4db735[_0x5e0a('0x43')]['id']}},_0x3545d7={};_0x3545d7[_0x5e0a('0x32')]=_[_0x5e0a('0x2f')](db['CmHopperHistory'][_0x5e0a('0x44')]);_0x3545d7['query']=_[_0x5e0a('0x2f')](_0x4db735[_0x5e0a('0x2e')]);_0x3545d7['filters']=_['intersection'](_0x3545d7['model'],_0x3545d7['query']);_0x2f0f75[_0x5e0a('0x34')]=_[_0x5e0a('0x31')](_0x3545d7['model'],qs[_0x5e0a('0x33')](_0x4db735['query'][_0x5e0a('0x33')]));_0x2f0f75[_0x5e0a('0x34')]=_0x2f0f75[_0x5e0a('0x34')][_0x5e0a('0x45')]?_0x2f0f75[_0x5e0a('0x34')]:_0x3545d7[_0x5e0a('0x32')];if(_0x4db735[_0x5e0a('0x2e')][_0x5e0a('0x3d')]){_0x2f0f75[_0x5e0a('0x3e')]=[{'all':!![]}];}_0x2f0f75=_['merge']({},_0x2f0f75,_0x4db735['options']);return db[_0x5e0a('0x2b')][_0x5e0a('0x46')](_0x2f0f75)[_0x5e0a('0x24')](handleEntityNotFound(_0x114e85,null))['then'](respondWithResult(_0x114e85,null))[_0x5e0a('0x41')](handleError(_0x114e85,null));};exports['create']=function(_0x1ec92e,_0x38d808){return db['CmHopperHistory'][_0x5e0a('0x47')](_0x1ec92e[_0x5e0a('0x48')],{})[_0x5e0a('0x24')](respondWithResult(_0x38d808,0xc9))[_0x5e0a('0x41')](handleError(_0x38d808,null));};exports[_0x5e0a('0x49')]=function(_0x5241fd,_0x36b646){return db['CmHopperHistory'][_0x5e0a('0x49')]()[_0x5e0a('0x24')](respondWithResult(_0x36b646,null))['catch'](handleError(_0x36b646,null));};exports[_0x5e0a('0x23')]=function(_0xa86af9,_0x478132){if(_0xa86af9['body'][_0x5e0a('0x4a')]){delete _0xa86af9[_0x5e0a('0x48')][_0x5e0a('0x4a')];}return db[_0x5e0a('0x2b')]['find']({'where':{'uniqueid':_0xa86af9[_0x5e0a('0x43')]['id']}})[_0x5e0a('0x24')](handleEntityNotFound(_0x478132,null))[_0x5e0a('0x24')](saveUpdates(_0xa86af9['body'],null))[_0x5e0a('0x24')](respondWithResult(_0x478132,null))[_0x5e0a('0x41')](handleError(_0x478132,null));}; \ No newline at end of file +var _0x570d=['create','body','describe','update','uniqueid','find','params','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','query','attributes','fields','length','order','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','show','intersection'];(function(_0x2abeee,_0x1d7879){var _0x17929b=function(_0x3e54c9){while(--_0x3e54c9){_0x2abeee['push'](_0x2abeee['shift']());}};_0x17929b(++_0x1d7879);}(_0x570d,0xd3));var _0xd570=function(_0x35ccde,_0xbe027){_0x35ccde=_0x35ccde-0x0;var _0xbd6110=_0x570d[_0x35ccde];return _0xbd6110;};'use strict';var emlformat=require(_0xd570('0x0'));var rimraf=require(_0xd570('0x1'));var zipdir=require(_0xd570('0x2'));var jsonpatch=require(_0xd570('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd570('0x4'));var path=require(_0xd570('0x5'));var sox=require(_0xd570('0x6'));var csv=require(_0xd570('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd570('0x8'));var squel=require(_0xd570('0x9'));var crypto=require(_0xd570('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd570('0x7'));var querystring=require('querystring');var Papa=require(_0xd570('0xb'));var Redis=require(_0xd570('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd570('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd570('0xe'))('api');var utils=require(_0xd570('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd570('0x10'))['db'];function respondWithStatusCode(_0x179c5f,_0x53f81c){_0x53f81c=_0x53f81c||0xcc;return function(_0x5c37ed){if(_0x5c37ed){return _0x179c5f['sendStatus'](_0x53f81c);}return _0x179c5f[_0xd570('0x11')](_0x53f81c)[_0xd570('0x12')]();};}function respondWithResult(_0x1632ca,_0xaf2e6b){_0xaf2e6b=_0xaf2e6b||0xc8;return function(_0x48a1f9){if(_0x48a1f9){return _0x1632ca[_0xd570('0x11')](_0xaf2e6b)[_0xd570('0x13')](_0x48a1f9);}};}function respondWithFilteredResult(_0x349d70,_0x2753e3){return function(_0x5ded65){if(_0x5ded65){var _0x8d9763=typeof _0x2753e3[_0xd570('0x14')]===_0xd570('0x15')&&typeof _0x2753e3['limit']===_0xd570('0x15');var _0x3adbd6=_0x5ded65[_0xd570('0x16')];var _0x2473ba=_0x8d9763?0x0:_0x2753e3[_0xd570('0x14')];var _0xfbdf78=_0x8d9763?_0x5ded65['count']:_0x2753e3[_0xd570('0x14')]+_0x2753e3[_0xd570('0x17')];var _0x46cdb9;if(_0xfbdf78>=_0x3adbd6){_0xfbdf78=_0x3adbd6;_0x46cdb9=0xc8;}else{_0x46cdb9=0xce;}_0x349d70[_0xd570('0x11')](_0x46cdb9);return _0x349d70[_0xd570('0x18')](_0xd570('0x19'),_0x2473ba+'-'+_0xfbdf78+'/'+_0x3adbd6)[_0xd570('0x13')](_0x5ded65);}return null;};}function patchUpdates(_0x427cb0){return function(_0x4fcd86){try{jsonpatch[_0xd570('0x1a')](_0x4fcd86,_0x427cb0,!![]);}catch(_0x2d1996){return BPromise['reject'](_0x2d1996);}return _0x4fcd86[_0xd570('0x1b')]();};}function saveUpdates(_0xdeab9f,_0x2f6c0e){return function(_0x1e27d1){if(_0x1e27d1){return _0x1e27d1['update'](_0xdeab9f)[_0xd570('0x1c')](function(_0x195c8b){return _0x195c8b;});}return null;};}function removeEntity(_0x28700e,_0x51f15c){return function(_0x17bad7){if(_0x17bad7){return _0x17bad7[_0xd570('0x1d')]()['then'](function(){_0x28700e[_0xd570('0x11')](0xcc)[_0xd570('0x12')]();});}};}function handleEntityNotFound(_0x53eee5,_0x1ba420){return function(_0x475399){if(!_0x475399){_0x53eee5[_0xd570('0x1e')](0x194);}return _0x475399;};}function handleError(_0x52c8f7,_0xcb84e2){_0xcb84e2=_0xcb84e2||0x1f4;return function(_0x4410c5){logger['error'](_0x4410c5[_0xd570('0x1f')]);if(_0x4410c5['name']){delete _0x4410c5[_0xd570('0x20')];}_0x52c8f7[_0xd570('0x11')](_0xcb84e2)[_0xd570('0x21')](_0x4410c5);};}exports[_0xd570('0x22')]=function(_0x5bbc3d,_0x22a983){var _0x3436dc={},_0x385044={},_0x1c8c97={'count':0x0,'rows':[]};var _0x55523f=_[_0xd570('0x23')](db[_0xd570('0x24')][_0xd570('0x25')],function(_0x27aaf7){return{'name':_0x27aaf7['fieldName'],'type':_0x27aaf7[_0xd570('0x26')][_0xd570('0x27')]};});_0x385044[_0xd570('0x28')]=_['map'](_0x55523f,_0xd570('0x20'));_0x385044['query']=_[_0xd570('0x29')](_0x5bbc3d['query']);_0x385044['filters']=_['intersection'](_0x385044[_0xd570('0x28')],_0x385044[_0xd570('0x2a')]);_0x3436dc[_0xd570('0x2b')]=_['intersection'](_0x385044[_0xd570('0x28')],qs[_0xd570('0x2c')](_0x5bbc3d[_0xd570('0x2a')][_0xd570('0x2c')]));_0x3436dc['attributes']=_0x3436dc['attributes'][_0xd570('0x2d')]?_0x3436dc['attributes']:_0x385044[_0xd570('0x28')];if(!_0x5bbc3d['query']['hasOwnProperty']('nolimit')){_0x3436dc[_0xd570('0x17')]=qs[_0xd570('0x17')](_0x5bbc3d[_0xd570('0x2a')][_0xd570('0x17')]);_0x3436dc['offset']=qs[_0xd570('0x14')](_0x5bbc3d[_0xd570('0x2a')]['offset']);}_0x3436dc[_0xd570('0x2e')]=qs[_0xd570('0x2f')](_0x5bbc3d[_0xd570('0x2a')][_0xd570('0x2f')]);_0x3436dc[_0xd570('0x30')]=qs['filters'](_[_0xd570('0x31')](_0x5bbc3d[_0xd570('0x2a')],_0x385044[_0xd570('0x32')]),_0x55523f);if(_0x5bbc3d['query']['filter']){_0x3436dc[_0xd570('0x30')]=_[_0xd570('0x33')](_0x3436dc[_0xd570('0x30')],{'$or':_[_0xd570('0x23')](_0x55523f,function(_0x576ebb){if(_0x576ebb[_0xd570('0x26')]!=='VIRTUAL'){var _0x59c236={};_0x59c236[_0x576ebb[_0xd570('0x20')]]={'$like':'%'+_0x5bbc3d['query'][_0xd570('0x34')]+'%'};return _0x59c236;}})});}_0x3436dc=_[_0xd570('0x33')]({},_0x3436dc,_0x5bbc3d[_0xd570('0x35')]);var _0x347712={'where':_0x3436dc[_0xd570('0x30')]};return db['CmHopperHistory']['count'](_0x347712)[_0xd570('0x1c')](function(_0xb6f38d){_0x1c8c97[_0xd570('0x16')]=_0xb6f38d;if(_0x5bbc3d['query'][_0xd570('0x36')]){_0x3436dc[_0xd570('0x37')]=[{'all':!![]}];}return db[_0xd570('0x24')][_0xd570('0x38')](_0x3436dc);})['then'](function(_0x375297){_0x1c8c97[_0xd570('0x39')]=_0x375297;return _0x1c8c97;})[_0xd570('0x1c')](respondWithFilteredResult(_0x22a983,_0x3436dc))[_0xd570('0x3a')](handleError(_0x22a983,null));};exports[_0xd570('0x3b')]=function(_0x4e1f82,_0x1a88e9){var _0x29f616={'raw':!![],'where':{'id':_0x4e1f82['params']['id']}},_0x2e04bb={};_0x2e04bb[_0xd570('0x28')]=_['keys'](db[_0xd570('0x24')][_0xd570('0x25')]);_0x2e04bb['query']=_['keys'](_0x4e1f82['query']);_0x2e04bb[_0xd570('0x32')]=_['intersection'](_0x2e04bb[_0xd570('0x28')],_0x2e04bb[_0xd570('0x2a')]);_0x29f616[_0xd570('0x2b')]=_[_0xd570('0x3c')](_0x2e04bb[_0xd570('0x28')],qs[_0xd570('0x2c')](_0x4e1f82[_0xd570('0x2a')][_0xd570('0x2c')]));_0x29f616[_0xd570('0x2b')]=_0x29f616['attributes'][_0xd570('0x2d')]?_0x29f616[_0xd570('0x2b')]:_0x2e04bb[_0xd570('0x28')];if(_0x4e1f82[_0xd570('0x2a')]['includeAll']){_0x29f616[_0xd570('0x37')]=[{'all':!![]}];}_0x29f616=_[_0xd570('0x33')]({},_0x29f616,_0x4e1f82[_0xd570('0x35')]);return db[_0xd570('0x24')]['find'](_0x29f616)[_0xd570('0x1c')](handleEntityNotFound(_0x1a88e9,null))['then'](respondWithResult(_0x1a88e9,null))[_0xd570('0x3a')](handleError(_0x1a88e9,null));};exports['create']=function(_0x4fb013,_0xd933e8){return db[_0xd570('0x24')][_0xd570('0x3d')](_0x4fb013[_0xd570('0x3e')],{})[_0xd570('0x1c')](respondWithResult(_0xd933e8,0xc9))[_0xd570('0x3a')](handleError(_0xd933e8,null));};exports[_0xd570('0x3f')]=function(_0x9d1093,_0x24c16a){return db[_0xd570('0x24')][_0xd570('0x3f')]()[_0xd570('0x1c')](respondWithResult(_0x24c16a,null))['catch'](handleError(_0x24c16a,null));};exports[_0xd570('0x40')]=function(_0x30ebea,_0x4f3fb7){if(_0x30ebea[_0xd570('0x3e')][_0xd570('0x41')]){delete _0x30ebea[_0xd570('0x3e')][_0xd570('0x41')];}return db['CmHopperHistory'][_0xd570('0x42')]({'where':{'uniqueid':_0x30ebea[_0xd570('0x43')]['id']}})[_0xd570('0x1c')](handleEntityNotFound(_0x4f3fb7,null))[_0xd570('0x1c')](saveUpdates(_0x30ebea[_0xd570('0x3e')],null))[_0xd570('0x1c')](respondWithResult(_0x4f3fb7,null))['catch'](handleError(_0x4f3fb7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 74839c7..cd355c2 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 _0x7880=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x40388c,_0xd1439b){var _0x403883=function(_0x3687fe){while(--_0x3687fe){_0x40388c['push'](_0x40388c['shift']());}};_0x403883(++_0xd1439b);}(_0x7880,0x1f4));var _0x0788=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0x7880[_0x1da10a];return _0x5aea64;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[{'name':_0x0788('0xd'),'fields':['endtime']},{'name':_0x0788('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d04=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x82f869,_0x103e69){var _0x5cca39=function(_0x2bd79a){while(--_0x2bd79a){_0x82f869['push'](_0x82f869['shift']());}};_0x5cca39(++_0x103e69);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x43d0('0xb'),'fields':[_0x43d0('0xb')]},{'name':_0x43d0('0xc'),'fields':[_0x43d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 187997e..381c520 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 _0xc678=['`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','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','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','AvgHandleTime','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay'];(function(_0x16f856,_0x15f98f){var _0x3e4d9e=function(_0x1d7b47){while(--_0x1d7b47){_0x16f856['push'](_0x16f856['shift']());}};_0x3e4d9e(++_0x15f98f);}(_0xc678,0x1b4));var _0x8c67=function(_0x4bf878,_0x9b8efa){_0x4bf878=_0x4bf878-0x0;var _0xf4fa65=_0xc678[_0x4bf878];return _0xf4fa65;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c67('0x0'));var BPromise=require(_0x8c67('0x1'));var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c67('0x3'))['db'];var utils=require(_0x8c67('0x4'));var logger=require(_0x8c67('0x5'))(_0x8c67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c67('0x7'));var client=jayson['client'][_0x8c67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4ceb,_0x4c2ffe,_0x207de1){return new BPromise(function(_0x22d7e4,_0x41ac88){return client[_0x8c67('0x9')](_0x1b4ceb,_0x207de1)[_0x8c67('0xa')](function(_0x5bac97){logger[_0x8c67('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x8c67('0xc'));logger[_0x8c67('0xd')](_0x8c67('0xe'),_0x4c2ffe,'request\x20sent',JSON[_0x8c67('0xf')](_0x5bac97));if(_0x5bac97[_0x8c67('0x10')]){if(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x11')]===0x1f4){logger['error'](_0x8c67('0x12'),_0x4c2ffe,_0x5bac97['error']['message']);return _0x41ac88(_0x5bac97['error']['message']);}logger[_0x8c67('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x5bac97[_0x8c67('0x10')]['message']);return _0x22d7e4(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x13')]);}else{logger[_0x8c67('0xb')](_0x8c67('0x12'),_0x4c2ffe,'request\x20sent');_0x22d7e4(_0x5bac97[_0x8c67('0x14')][_0x8c67('0x13')]);}})[_0x8c67('0x15')](function(_0x1bae2f){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x1bae2f);_0x41ac88(_0x1bae2f);});});}exports[_0x8c67('0x16')]=function(_0x3e9ab8){var _0x215d52=this;return new Promise(function(_0x544717,_0xe7f0b6){return db[_0x8c67('0x17')]['create'](_0x3e9ab8[_0x8c67('0x18')],{'raw':_0x3e9ab8['options']?_0x3e9ab8[_0x8c67('0x19')][_0x8c67('0x1a')]===undefined?!![]:![]:!![]})[_0x8c67('0xa')](function(_0x2bd6b3){logger[_0x8c67('0xb')]('CreateCmHopperHistory',_0x3e9ab8);logger[_0x8c67('0xd')](_0x8c67('0x16'),_0x3e9ab8,JSON['stringify'](_0x2bd6b3));_0x544717(_0x2bd6b3);})[_0x8c67('0x15')](function(_0x5486e8){logger[_0x8c67('0x10')](_0x8c67('0x16'),_0x5486e8[_0x8c67('0x13')],_0x3e9ab8);_0xe7f0b6(_0x215d52[_0x8c67('0x10')](0x1f4,_0x5486e8[_0x8c67('0x13')]));});});};exports['AvgHandleTime']=function(_0x2658a1){var _0x26fb02=this;return new Promise(function(_0x94d19b,_0xbb787e){return db[_0x8c67('0x17')][_0x8c67('0x1b')]({'raw':_0x2658a1['options']?_0x2658a1['options'][_0x8c67('0x1a')]===undefined?!![]:![]:!![],'where':_0x2658a1['options']?_0x2658a1['options'][_0x8c67('0x1c')]||null:null,'attributes':[[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize'][_0x8c67('0x1f')]('id')),_0x8c67('0x20')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x22')))),_0x8c67('0x23')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x24')))),_0x8c67('0x25')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x26')))),_0x8c67('0x27')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x29')))),_0x8c67('0x2a')],[db['sequelize']['fn'](_0x8c67('0x28'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8c67('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x2a855a){logger[_0x8c67('0xb')](_0x8c67('0x2c'),_0x2658a1);logger[_0x8c67('0xd')](_0x8c67('0x2c'),_0x2658a1,JSON[_0x8c67('0xf')](_0x2a855a));_0x94d19b(_0x2a855a);})[_0x8c67('0x15')](function(_0x435ece){logger['error']('AvgHandleTime',_0x435ece[_0x8c67('0x13')],_0x2658a1);_0xbb787e(_0x26fb02['error'](0x1f4,_0x435ece[_0x8c67('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x34684a){var _0x3a956a=this;return new Promise(function(_0x2a37b4,_0x2145b4){return db['CmHopperHistory'][_0x8c67('0x1b')]({'raw':_0x34684a[_0x8c67('0x19')]?_0x34684a['options'][_0x8c67('0x1a')]===undefined?!![]:![]:!![],'where':_0x34684a[_0x8c67('0x19')]?_0x34684a[_0x8c67('0x19')]['where']||null:null,'attributes':[['campaign',_0x8c67('0x2d')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8c67('0x2f')))),_0x8c67('0x30')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x22')))),_0x8c67('0x31')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x8c67('0x32')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x33')))),'outboundCongestionCallsDay'],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')]['literal'](_0x8c67('0x34')))),_0x8c67('0x35')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x36')))),_0x8c67('0x37')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x38')))),_0x8c67('0x39')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x8c67('0x3a')],[db['sequelize']['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3b')))),_0x8c67('0x3c')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3d')))),_0x8c67('0x3e')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3f')))),_0x8c67('0x40')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x41')))),'outboundRejectCallsDay'],[db[_0x8c67('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x42')))),'outboundReCallsDay']],'group':[_0x8c67('0x43')]})['then'](function(_0x50fb02){logger[_0x8c67('0xb')](_0x8c67('0x44'),_0x34684a);logger[_0x8c67('0xd')](_0x8c67('0x44'),_0x34684a,JSON[_0x8c67('0xf')](_0x50fb02));_0x2a37b4(_0x50fb02);})['catch'](function(_0xc9ff67){logger[_0x8c67('0x10')]('GetVoiceQueueHopperHistory',_0xc9ff67[_0x8c67('0x13')],_0x34684a);_0x2145b4(_0x3a956a[_0x8c67('0x10')](0x1f4,_0xc9ff67[_0x8c67('0x13')]));});});};exports[_0x8c67('0x45')]=function(_0x4724c7){var _0x51555f=this;return new Promise(function(_0x31bd72,_0x3344ce){return db[_0x8c67('0x17')][_0x8c67('0x1b')]({'raw':_0x4724c7['options']?_0x4724c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x4724c7[_0x8c67('0x19')]?_0x4724c7[_0x8c67('0x19')][_0x8c67('0x1c')]||null:null,'attributes':[[_0x8c67('0x43'),'name'],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['col']('id')),_0x8c67('0x46')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x8c67('0x43')]})[_0x8c67('0xa')](function(_0x4465e2){logger['info']('GetCampaignHopperHistory',_0x4724c7);logger[_0x8c67('0xd')]('GetCampaignHopperHistory',_0x4724c7,JSON[_0x8c67('0xf')](_0x4465e2));_0x31bd72(_0x4465e2);})[_0x8c67('0x15')](function(_0x278377){logger['error'](_0x8c67('0x45'),_0x278377['message'],_0x4724c7);_0x3344ce(_0x51555f['error'](0x1f4,_0x278377['message']));});});}; \ No newline at end of file +var _0x3d0a=['`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','name','col','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','then','info','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','catch','AvgHandleTime','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls'];(function(_0x396a1b,_0xf3a702){var _0xc19797=function(_0xbfe87d){while(--_0xbfe87d){_0x396a1b['push'](_0x396a1b['shift']());}};_0xc19797(++_0xf3a702);}(_0x3d0a,0xa9));var _0xa3d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3d0a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xa3d0('0x0'));var util=require('util');var moment=require(_0xa3d0('0x1'));var BPromise=require(_0xa3d0('0x2'));var rs=require(_0xa3d0('0x3'));var fs=require('fs');var Redis=require(_0xa3d0('0x4'));var db=require(_0xa3d0('0x5'))['db'];var utils=require(_0xa3d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3d0('0x7')][_0xa3d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e7cd,_0x5d20be,_0x517f0e){return new BPromise(function(_0x2ab25b,_0x53884f){return client['request'](_0x42e7cd,_0x517f0e)[_0xa3d0('0x9')](function(_0x5c3472){logger[_0xa3d0('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x5d20be,_0xa3d0('0xb'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5d20be,'request\x20sent',JSON['stringify'](_0x5c3472));if(_0x5c3472['error']){if(_0x5c3472[_0xa3d0('0xc')][_0xa3d0('0xd')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5d20be,_0x5c3472[_0xa3d0('0xc')]['message']);return _0x53884f(_0x5c3472['error']['message']);}logger[_0xa3d0('0xc')](_0xa3d0('0xe'),_0x5d20be,_0x5c3472[_0xa3d0('0xc')][_0xa3d0('0xf')]);return _0x2ab25b(_0x5c3472[_0xa3d0('0xc')][_0xa3d0('0xf')]);}else{logger[_0xa3d0('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x5d20be,_0xa3d0('0xb'));_0x2ab25b(_0x5c3472[_0xa3d0('0x10')][_0xa3d0('0xf')]);}})['catch'](function(_0x26e231){logger[_0xa3d0('0xc')](_0xa3d0('0xe'),_0x5d20be,_0x26e231);_0x53884f(_0x26e231);});});}exports[_0xa3d0('0x11')]=function(_0x2e138f){var _0x2c16b4=this;return new Promise(function(_0x46ff69,_0xb54dab){return db[_0xa3d0('0x12')][_0xa3d0('0x13')](_0x2e138f[_0xa3d0('0x14')],{'raw':_0x2e138f[_0xa3d0('0x15')]?_0x2e138f['options'][_0xa3d0('0x16')]===undefined?!![]:![]:!![]})[_0xa3d0('0x9')](function(_0x466155){logger[_0xa3d0('0xa')]('CreateCmHopperHistory',_0x2e138f);logger[_0xa3d0('0x17')](_0xa3d0('0x11'),_0x2e138f,JSON['stringify'](_0x466155));_0x46ff69(_0x466155);})[_0xa3d0('0x18')](function(_0x16c7c2){logger[_0xa3d0('0xc')](_0xa3d0('0x11'),_0x16c7c2[_0xa3d0('0xf')],_0x2e138f);_0xb54dab(_0x2c16b4[_0xa3d0('0xc')](0x1f4,_0x16c7c2['message']));});});};exports[_0xa3d0('0x19')]=function(_0x457556){var _0x33e0da=this;return new Promise(function(_0x8a729e,_0x195fe2){return db[_0xa3d0('0x12')]['findAll']({'raw':_0x457556[_0xa3d0('0x15')]?_0x457556[_0xa3d0('0x15')][_0xa3d0('0x16')]===undefined?!![]:![]:!![],'where':_0x457556['options']?_0x457556['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['col']('id')),_0xa3d0('0x1c')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db['sequelize'][_0xa3d0('0x1d')](_0xa3d0('0x1e')))),_0xa3d0('0x1f')],[db['sequelize']['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal'](_0xa3d0('0x20')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa3d0('0x1b')]['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x21')))),_0xa3d0('0x22')],[db['sequelize']['fn'](_0xa3d0('0x23'),db['sequelize']['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x24')))),'predictiveIntervalAvgHoldtime'],[db[_0xa3d0('0x1b')]['fn']('AVG',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal'](_0xa3d0('0x25')))),_0xa3d0('0x26')]]})['then'](function(_0x2cffde){logger[_0xa3d0('0xa')](_0xa3d0('0x19'),_0x457556);logger[_0xa3d0('0x17')](_0xa3d0('0x19'),_0x457556,JSON[_0xa3d0('0x27')](_0x2cffde));_0x8a729e(_0x2cffde);})[_0xa3d0('0x18')](function(_0x55170d){logger['error'](_0xa3d0('0x19'),_0x55170d[_0xa3d0('0xf')],_0x457556);_0x195fe2(_0x33e0da[_0xa3d0('0xc')](0x1f4,_0x55170d[_0xa3d0('0xf')]));});});};exports[_0xa3d0('0x28')]=function(_0x148fe7){var _0x5cf5c6=this;return new Promise(function(_0x270ad4,_0x6673e7){return db[_0xa3d0('0x12')]['findAll']({'raw':_0x148fe7[_0xa3d0('0x15')]?_0x148fe7[_0xa3d0('0x15')][_0xa3d0('0x16')]===undefined?!![]:![]:!![],'where':_0x148fe7['options']?_0x148fe7[_0xa3d0('0x15')]['where']||null:null,'attributes':[[_0xa3d0('0x29'),'name'],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),_0xa3d0('0x2a')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db['sequelize']['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')]('`state`\x20=\x203,\x201,\x20null'))),_0xa3d0('0x2b')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x1e')))),_0xa3d0('0x2c')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x2d')))),_0xa3d0('0x2e')],[db[_0xa3d0('0x1b')]['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x2f')))),_0xa3d0('0x30')],[db['sequelize']['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa3d0('0x31')],[db[_0xa3d0('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa3d0('0x1d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa3d0('0x32')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal'](_0xa3d0('0x33')))),_0xa3d0('0x34')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x35')))),_0xa3d0('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x37')))),'outboundOriginateFailureCallsDay'],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x38')))),'outboundRejectCallsDay'],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa3d0('0x39')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db['sequelize'][_0xa3d0('0x1d')](_0xa3d0('0x3a')))),_0xa3d0('0x3b')],[db[_0xa3d0('0x1b')]['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x3c')))),_0xa3d0('0x3d')]],'group':[_0xa3d0('0x29')]})['then'](function(_0x22f566){logger['info'](_0xa3d0('0x28'),_0x148fe7);logger[_0xa3d0('0x17')](_0xa3d0('0x28'),_0x148fe7,JSON[_0xa3d0('0x27')](_0x22f566));_0x270ad4(_0x22f566);})[_0xa3d0('0x18')](function(_0x519831){logger[_0xa3d0('0xc')](_0xa3d0('0x28'),_0x519831['message'],_0x148fe7);_0x6673e7(_0x5cf5c6[_0xa3d0('0xc')](0x1f4,_0x519831[_0xa3d0('0xf')]));});});};exports[_0xa3d0('0x3e')]=function(_0x5356bb){var _0x4348d3=this;return new Promise(function(_0x3067bf,_0x12ddac){return db['CmHopperHistory'][_0xa3d0('0x3f')]({'raw':_0x5356bb['options']?_0x5356bb[_0xa3d0('0x15')][_0xa3d0('0x16')]===undefined?!![]:![]:!![],'where':_0x5356bb['options']?_0x5356bb[_0xa3d0('0x15')]['where']||null:null,'attributes':[['campaign',_0xa3d0('0x40')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')][_0xa3d0('0x41')]('id')),_0xa3d0('0x42')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xa3d0('0x29')]})['then'](function(_0x54a044){logger[_0xa3d0('0xa')]('GetCampaignHopperHistory',_0x5356bb);logger[_0xa3d0('0x17')]('GetCampaignHopperHistory',_0x5356bb,JSON[_0xa3d0('0x27')](_0x54a044));_0x3067bf(_0x54a044);})['catch'](function(_0x5e5c54){logger[_0xa3d0('0xc')](_0xa3d0('0x3e'),_0x5e5c54[_0xa3d0('0xf')],_0x5356bb);_0x12ddac(_0x4348d3[_0xa3d0('0xc')](0x1f4,_0x5e5c54['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0549c40..dca1691 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 _0x81f3=['get','index','isAuthenticated','show','post','put','/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x81f3,0x15f));var _0x381f=function(_0x2bb99a,_0x4ff527){_0x2bb99a=_0x2bb99a-0x0;var _0x57023b=_0x81f3[_0x2bb99a];return _0x57023b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x381f('0x0'));var timeout=require(_0x381f('0x1'));var express=require(_0x381f('0x2'));var router=express[_0x381f('0x3')]();var fs_extra=require(_0x381f('0x4'));var auth=require(_0x381f('0x5'));var interaction=require(_0x381f('0x6'));var config=require(_0x381f('0x7'));var controller=require(_0x381f('0x8'));router[_0x381f('0x9')]('/',auth['isAuthenticated'](),controller[_0x381f('0xa')]);router[_0x381f('0x9')]('/describe',auth[_0x381f('0xb')](),controller['describe']);router[_0x381f('0x9')]('/:id',auth[_0x381f('0xb')](),controller[_0x381f('0xc')]);router[_0x381f('0xd')]('/',auth[_0x381f('0xb')](),controller['create']);router[_0x381f('0xe')](_0x381f('0xf'),auth[_0x381f('0xb')](),controller[_0x381f('0x10')]);module[_0x381f('0x11')]=router; \ No newline at end of file +var _0xeacf=['../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42e051,_0x57e549){var _0x1d9a3b=function(_0x1f87cc){while(--_0x1f87cc){_0x42e051['push'](_0x42e051['shift']());}};_0x1d9a3b(++_0x57e549);}(_0xeacf,0xe9));var _0xfeac=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xeacf[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0xfeac('0x0'));var util=require(_0xfeac('0x1'));var path=require(_0xfeac('0x2'));var timeout=require(_0xfeac('0x3'));var express=require(_0xfeac('0x4'));var router=express[_0xfeac('0x5')]();var fs_extra=require(_0xfeac('0x6'));var auth=require(_0xfeac('0x7'));var interaction=require(_0xfeac('0x8'));var config=require('../../config/environment');var controller=require(_0xfeac('0x9'));router['get']('/',auth[_0xfeac('0xa')](),controller[_0xfeac('0xb')]);router[_0xfeac('0xc')](_0xfeac('0xd'),auth[_0xfeac('0xa')](),controller['describe']);router[_0xfeac('0xc')](_0xfeac('0xe'),auth['isAuthenticated'](),controller[_0xfeac('0xf')]);router['post']('/',auth[_0xfeac('0xa')](),controller[_0xfeac('0x10')]);router[_0xfeac('0x11')]('/:id',auth[_0xfeac('0xa')](),controller[_0xfeac('0x12')]);module[_0xfeac('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b685207..4e07abc 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 _0xb715=['name','STRING','exports'];(function(_0x5aaf93,_0x5c0001){var _0x17d307=function(_0x21d77a){while(--_0x21d77a){_0x5aaf93['push'](_0x5aaf93['shift']());}};_0x17d307(++_0x5c0001);}(_0xb715,0x16d));var _0x5b71=function(_0x2e5509,_0x3dbf8f){_0x2e5509=_0x2e5509-0x0;var _0x4cd69e=_0xb715[_0x2e5509];return _0x4cd69e;};'use strict';var Sequelize=require('sequelize');module[_0x5b71('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b71('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5b71('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50a6=['exports','STRING','sequelize'];(function(_0x11f769,_0x5d296a){var _0x59a6b8=function(_0x2358f3){while(--_0x2358f3){_0x11f769['push'](_0x11f769['shift']());}};_0x59a6b8(++_0x5d296a);}(_0x50a6,0xa4));var _0x650a=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x50a6[_0x2e9b5b];return _0x734c46;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x650a('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 86d3a1e..53e359a 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 _0x06dd=['cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','Lists','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','CmList','findAll','catch','show','params','include','create','body','user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','cf_%d','nolimit','raw','OrderBy','CmCustomField','alias','select','cm_contacts','c.ListId\x20=\x20?','distinct','field','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','from','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface'];(function(_0x183b21,_0x271b8e){var _0x4dbe1b=function(_0x32e3e2){while(--_0x32e3e2){_0x183b21['push'](_0x183b21['shift']());}};_0x4dbe1b(++_0x271b8e);}(_0x06dd,0x14d));var _0xd06d=function(_0x445d20,_0x39643f){_0x445d20=_0x445d20-0x0;var _0x26e5f2=_0x06dd[_0x445d20];return _0x26e5f2;};'use strict';var emlformat=require(_0xd06d('0x0'));var rimraf=require(_0xd06d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd06d('0x2'));var rp=require(_0xd06d('0x3'));var moment=require(_0xd06d('0x4'));var BPromise=require(_0xd06d('0x5'));var Mustache=require(_0xd06d('0x6'));var util=require('util');var path=require(_0xd06d('0x7'));var sox=require('sox');var csv=require(_0xd06d('0x8'));var ejs=require(_0xd06d('0x9'));var fs=require('fs');var fs_extra=require(_0xd06d('0xa'));var _=require('lodash');var squel=require(_0xd06d('0xb'));var crypto=require('crypto');var jsforce=require(_0xd06d('0xc'));var deskjs=require(_0xd06d('0xd'));var toCsv=require(_0xd06d('0x8'));var querystring=require(_0xd06d('0xe'));var Papa=require('papaparse');var Redis=require(_0xd06d('0xf'));var authService=require(_0xd06d('0x10'));var qs=require(_0xd06d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd06d('0x12'));var logger=require(_0xd06d('0x13'))(_0xd06d('0x14'));var utils=require('../../config/utils');var config=require(_0xd06d('0x15'));var licenseUtil=require(_0xd06d('0x16'));var db=require(_0xd06d('0x17'))['db'];var csv_results;config['redis']=_['defaults'](config[_0xd06d('0x18')],{'host':_0xd06d('0x19'),'port':0x18eb});var socket=require(_0xd06d('0x1a'))(new Redis(config['redis']));require(_0xd06d('0x1b'))[_0xd06d('0x1c')](socket);function respondWithStatusCode(_0x4c5a75,_0x395b83){_0x395b83=_0x395b83||0xcc;return function(_0x111de5){if(_0x111de5){return _0x4c5a75[_0xd06d('0x1d')](_0x395b83);}return _0x4c5a75['status'](_0x395b83)[_0xd06d('0x1e')]();};}function respondWithResult(_0x19f8a7,_0x19ec56){_0x19ec56=_0x19ec56||0xc8;return function(_0x1b757b){if(_0x1b757b){return _0x19f8a7[_0xd06d('0x1f')](_0x19ec56)[_0xd06d('0x20')](_0x1b757b);}};}function respondWithFilteredResult(_0x23069a,_0x4d6cfa){return function(_0x232011){if(_0x232011){var _0x5ef532=typeof _0x4d6cfa[_0xd06d('0x21')]===_0xd06d('0x22')&&typeof _0x4d6cfa['limit']==='undefined';var _0x52908e=_0x232011[_0xd06d('0x23')];var _0x169103=_0x5ef532?0x0:_0x4d6cfa[_0xd06d('0x21')];var _0x24482d=_0x5ef532?_0x232011[_0xd06d('0x23')]:_0x4d6cfa['offset']+_0x4d6cfa[_0xd06d('0x24')];var _0x1cc511;if(_0x24482d>=_0x52908e){_0x24482d=_0x52908e;_0x1cc511=0xc8;}else{_0x1cc511=0xce;}_0x23069a['status'](_0x1cc511);return _0x23069a['set'](_0xd06d('0x25'),_0x169103+'-'+_0x24482d+'/'+_0x52908e)[_0xd06d('0x20')](_0x232011);}return null;};}function patchUpdates(_0x1dbcfb){return function(_0x2cb220){try{jsonpatch['apply'](_0x2cb220,_0x1dbcfb,!![]);}catch(_0x1054a2){return BPromise[_0xd06d('0x26')](_0x1054a2);}return _0x2cb220[_0xd06d('0x27')]();};}function saveUpdates(_0x4473c7,_0x16464d){return function(_0x556b3b){if(_0x556b3b){return _0x556b3b['update'](_0x4473c7)[_0xd06d('0x28')](function(_0x50718a){return _0x50718a;});}return null;};}function removeEntity(_0x1877c8,_0x2dbe5e){return function(_0x186117){if(_0x186117){return _0x186117[_0xd06d('0x29')]()[_0xd06d('0x28')](function(){var _0x49f803=_0x186117['get']({'plain':!![]});var _0x271d20=_0xd06d('0x2a');return db[_0xd06d('0x2b')][_0xd06d('0x29')]({'where':{'type':_0x271d20,'resourceId':_0x49f803['id']}})[_0xd06d('0x28')](function(){return _0x186117;});})[_0xd06d('0x28')](function(){_0x1877c8[_0xd06d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf52c92,_0x22169f){return function(_0x27dd02){if(!_0x27dd02){_0xf52c92[_0xd06d('0x1d')](0x194);}return _0x27dd02;};}function handleError(_0x347e2d,_0x3eec89){_0x3eec89=_0x3eec89||0x1f4;return function(_0x5bb13c){logger[_0xd06d('0x2c')](_0x5bb13c['stack']);if(_0x5bb13c[_0xd06d('0x2d')]){delete _0x5bb13c['name'];}_0x347e2d[_0xd06d('0x1f')](_0x3eec89)[_0xd06d('0x2e')](_0x5bb13c);};}exports['index']=function(_0x3429f8,_0x1564f8){var _0x15bc50={},_0x115f6d={},_0x3bd4db={'count':0x0,'rows':[]};var _0xcf76ce=_[_0xd06d('0x2f')](db['CmList'][_0xd06d('0x30')],function(_0x324217){return{'name':_0x324217[_0xd06d('0x31')],'type':_0x324217[_0xd06d('0x32')][_0xd06d('0x33')]};});_0x115f6d[_0xd06d('0x34')]=_['map'](_0xcf76ce,_0xd06d('0x2d'));_0x115f6d['query']=_[_0xd06d('0x35')](_0x3429f8['query']);_0x115f6d[_0xd06d('0x36')]=_[_0xd06d('0x37')](_0x115f6d['model'],_0x115f6d[_0xd06d('0x38')]);_0x15bc50[_0xd06d('0x39')]=_[_0xd06d('0x37')](_0x115f6d[_0xd06d('0x34')],qs[_0xd06d('0x3a')](_0x3429f8[_0xd06d('0x38')][_0xd06d('0x3a')]));_0x15bc50['attributes']=_0x15bc50[_0xd06d('0x39')][_0xd06d('0x3b')]?_0x15bc50[_0xd06d('0x39')]:_0x115f6d['model'];if(!_0x3429f8[_0xd06d('0x38')][_0xd06d('0x3c')]('nolimit')){_0x15bc50[_0xd06d('0x24')]=qs[_0xd06d('0x24')](_0x3429f8[_0xd06d('0x38')][_0xd06d('0x24')]);_0x15bc50[_0xd06d('0x21')]=qs[_0xd06d('0x21')](_0x3429f8[_0xd06d('0x38')][_0xd06d('0x21')]);}_0x15bc50[_0xd06d('0x3d')]=qs[_0xd06d('0x3e')](_0x3429f8[_0xd06d('0x38')][_0xd06d('0x3e')]);_0x15bc50[_0xd06d('0x3f')]=qs['filters'](_[_0xd06d('0x40')](_0x3429f8[_0xd06d('0x38')],_0x115f6d['filters']),_0xcf76ce);if(_0x3429f8['query'][_0xd06d('0x41')]){_0x15bc50[_0xd06d('0x3f')]=_[_0xd06d('0x42')](_0x15bc50[_0xd06d('0x3f')],{'$or':_[_0xd06d('0x2f')](_0xcf76ce,function(_0x25bbde){if(_0x25bbde[_0xd06d('0x32')]!==_0xd06d('0x43')){var _0x389103={};_0x389103[_0x25bbde['name']]={'$like':'%'+_0x3429f8[_0xd06d('0x38')]['filter']+'%'};return _0x389103;}})});}_0x15bc50=_[_0xd06d('0x42')]({},_0x15bc50,_0x3429f8[_0xd06d('0x44')]);var _0x28ec38={'where':_0x15bc50[_0xd06d('0x3f')]};return db['CmList'][_0xd06d('0x23')](_0x28ec38)[_0xd06d('0x28')](function(_0x7e0054){_0x3bd4db['count']=_0x7e0054;if(_0x3429f8[_0xd06d('0x38')][_0xd06d('0x45')]){_0x15bc50['include']=[{'all':!![]}];}return db[_0xd06d('0x46')][_0xd06d('0x47')](_0x15bc50);})['then'](function(_0x35a07a){_0x3bd4db['rows']=_0x35a07a;return _0x3bd4db;})['then'](respondWithFilteredResult(_0x1564f8,_0x15bc50))[_0xd06d('0x48')](handleError(_0x1564f8,null));};exports[_0xd06d('0x49')]=function(_0x511561,_0x1a0d8a){var _0x316cc2={'raw':![],'where':{'id':_0x511561[_0xd06d('0x4a')]['id']}},_0x203f14={};_0x203f14[_0xd06d('0x34')]=_['keys'](db['CmList'][_0xd06d('0x30')]);_0x203f14[_0xd06d('0x38')]=_[_0xd06d('0x35')](_0x511561['query']);_0x203f14[_0xd06d('0x36')]=_[_0xd06d('0x37')](_0x203f14[_0xd06d('0x34')],_0x203f14['query']);_0x316cc2[_0xd06d('0x39')]=_[_0xd06d('0x37')](_0x203f14['model'],qs['fields'](_0x511561[_0xd06d('0x38')][_0xd06d('0x3a')]));_0x316cc2[_0xd06d('0x39')]=_0x316cc2[_0xd06d('0x39')][_0xd06d('0x3b')]?_0x316cc2['attributes']:_0x203f14['model'];if(_0x511561[_0xd06d('0x38')]['includeAll']){_0x316cc2[_0xd06d('0x4b')]=[{'all':!![]}];}_0x316cc2=_[_0xd06d('0x42')]({},_0x316cc2,_0x511561[_0xd06d('0x44')]);return db[_0xd06d('0x46')]['find'](_0x316cc2)[_0xd06d('0x28')](handleEntityNotFound(_0x1a0d8a,null))[_0xd06d('0x28')](respondWithResult(_0x1a0d8a,null))['catch'](handleError(_0x1a0d8a,null));};exports[_0xd06d('0x4c')]=function(_0x4847b6,_0x53ab05){return db[_0xd06d('0x46')][_0xd06d('0x4c')](_0x4847b6[_0xd06d('0x4d')],{})[_0xd06d('0x28')](function(_0x303bb2){var _0x2a6c46=_0x4847b6[_0xd06d('0x4e')]['get']({'plain':!![]});if(!_0x2a6c46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a6c46['role']===_0xd06d('0x4e')){var _0x56c4d0=_0x303bb2[_0xd06d('0x4f')]({'plain':!![]});var _0x130b5d='Lists';return db['UserProfileSection'][_0xd06d('0x50')]({'where':{'name':_0x130b5d,'userProfileId':_0x2a6c46[_0xd06d('0x51')]},'raw':!![]})[_0xd06d('0x28')](function(_0x245720){if(_0x245720&&_0x245720[_0xd06d('0x52')]===0x0){return db[_0xd06d('0x2b')][_0xd06d('0x4c')]({'name':_0x56c4d0['name'],'resourceId':_0x56c4d0['id'],'type':_0x245720[_0xd06d('0x2d')],'sectionId':_0x245720['id']},{})[_0xd06d('0x28')](function(){return _0x303bb2;});}else{return _0x303bb2;}})[_0xd06d('0x48')](function(_0x413857){logger['error'](_0xd06d('0x53'),_0x413857);throw _0x413857;});}return _0x303bb2;})[_0xd06d('0x28')](respondWithResult(_0x53ab05,0xc9))[_0xd06d('0x48')](handleError(_0x53ab05,null));};exports['update']=function(_0xe69eb0,_0x56f980){if(_0xe69eb0[_0xd06d('0x4d')]['id']){delete _0xe69eb0[_0xd06d('0x4d')]['id'];}return db[_0xd06d('0x46')][_0xd06d('0x50')]({'where':{'id':_0xe69eb0['params']['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x56f980,null))[_0xd06d('0x28')](saveUpdates(_0xe69eb0[_0xd06d('0x4d')],null))[_0xd06d('0x28')](respondWithResult(_0x56f980,null))[_0xd06d('0x48')](handleError(_0x56f980,null));};exports[_0xd06d('0x29')]=function(_0x1bf2cb,_0x431192){return db[_0xd06d('0x46')]['find']({'where':{'id':_0x1bf2cb[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x431192,null))[_0xd06d('0x28')](removeEntity(_0x431192,null))[_0xd06d('0x48')](handleError(_0x431192,null));};exports[_0xd06d('0x54')]=function(_0x575af4,_0xc9cafd){return db[_0xd06d('0x46')][_0xd06d('0x54')]()[_0xd06d('0x28')](respondWithResult(_0xc9cafd,null))[_0xd06d('0x48')](handleError(_0xc9cafd,null));};exports[_0xd06d('0x55')]=function(_0x51fa31,_0x438c39,_0x308cda){if(_0x51fa31[_0xd06d('0x4d')]['id']){delete _0x51fa31[_0xd06d('0x4d')]['id'];}return db[_0xd06d('0x46')][_0xd06d('0x50')]({'where':{'id':_0x51fa31['params']['id']}})['then'](handleEntityNotFound(_0x438c39,null))[_0xd06d('0x28')](function(_0x476ff7){if(_0x476ff7){_0x51fa31[_0xd06d('0x4d')][_0xd06d('0x56')]=_0x476ff7['id'];return db[_0xd06d('0x57')]['create'](_0x51fa31[_0xd06d('0x4d')]);}})[_0xd06d('0x28')](respondWithResult(_0x438c39,null))['catch'](handleError(_0x438c39,null));};exports[_0xd06d('0x58')]=function(_0x55c0d6,_0xd0d7f0,_0x441dfc){var _0x2dda26={'raw':![],'where':{}};var _0x13b350={};var _0x567910={'count':0x0,'rows':[]};return db['CmList'][_0xd06d('0x59')]({'where':{'id':_0x55c0d6[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0xd0d7f0,null))[_0xd06d('0x28')](function(_0x20bca6){if(_0x20bca6){_0x13b350['model']=_['keys'](db[_0xd06d('0x57')]['rawAttributes']);_0x13b350['query']=_[_0xd06d('0x35')](_0x55c0d6[_0xd06d('0x38')]);_0x13b350['filters']=_[_0xd06d('0x37')](_0x13b350[_0xd06d('0x34')],_0x13b350[_0xd06d('0x38')]);_0x2dda26[_0xd06d('0x39')]=_['intersection'](_0x13b350['model'],qs[_0xd06d('0x3a')](_0x55c0d6[_0xd06d('0x38')][_0xd06d('0x3a')]));_0x2dda26['attributes']=_0x2dda26[_0xd06d('0x39')][_0xd06d('0x3b')]?_0x2dda26[_0xd06d('0x39')]:_0x13b350[_0xd06d('0x34')];if(!_0x55c0d6['query'][_0xd06d('0x3c')]('nolimit')){_0x2dda26['limit']=qs[_0xd06d('0x24')](_0x55c0d6['query'][_0xd06d('0x24')]);_0x2dda26[_0xd06d('0x21')]=qs[_0xd06d('0x21')](_0x55c0d6['query'][_0xd06d('0x21')]);}_0x2dda26[_0xd06d('0x3d')]=qs['sort'](_0x55c0d6[_0xd06d('0x38')][_0xd06d('0x3e')]);_0x2dda26['where']=qs[_0xd06d('0x36')](_['pick'](_0x55c0d6[_0xd06d('0x38')],_0x13b350[_0xd06d('0x36')]));_0x2dda26[_0xd06d('0x3f')][_0xd06d('0x56')]=_0x20bca6['id'];if(_0x55c0d6[_0xd06d('0x38')][_0xd06d('0x41')]){_0x2dda26['where']=_[_0xd06d('0x42')](_0x2dda26[_0xd06d('0x3f')],{'$or':_[_0xd06d('0x2f')](_0x2dda26[_0xd06d('0x39')],function(_0x1c20fd){var _0x2a2a00={};_0x2a2a00[_0x1c20fd]={'$like':'%'+_0x55c0d6[_0xd06d('0x38')][_0xd06d('0x41')]+'%'};return _0x2a2a00;})});}_0x2dda26=_['merge']({},_0x2dda26,_0x55c0d6[_0xd06d('0x44')]);return db[_0xd06d('0x57')][_0xd06d('0x23')]({'where':_0x2dda26[_0xd06d('0x3f')]})[_0xd06d('0x28')](function(_0x2374aa){_0x567910['count']=_0x2374aa;if(_0x55c0d6[_0xd06d('0x38')]['includeAll']){_0x2dda26[_0xd06d('0x4b')]=[{'all':!![]}];}return db[_0xd06d('0x57')][_0xd06d('0x47')](_0x2dda26);})[_0xd06d('0x28')](function(_0x20efdf){_0x567910[_0xd06d('0x5a')]=_0x20efdf;return _0x567910;});}})[_0xd06d('0x28')](respondWithFilteredResult(_0xd0d7f0,_0x2dda26))[_0xd06d('0x48')](handleError(_0xd0d7f0,null));};exports[_0xd06d('0x5b')]=function(_0x38bf70,_0x1b8f00,_0x52f10f){return db[_0xd06d('0x46')]['find']({'where':{'id':_0x38bf70[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x1b8f00,null))['then'](function(_0x1cd1a5){if(_0x1cd1a5){return _0x1cd1a5['removeDispositions'](_0x38bf70[_0xd06d('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x1b8f00,null))['catch'](handleError(_0x1b8f00,null));};exports[_0xd06d('0x5c')]=function(_0x3144af,_0x5c5a51,_0x35823c){return db[_0xd06d('0x46')][_0xd06d('0x50')]({'where':{'id':_0x3144af[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x5c5a51,null))['then'](function(_0x42913e){if(_0x42913e){var _0x50a1c8=[];var _0x4ec895={'success':[],'errors':[]};return db[_0xd06d('0x5d')][_0xd06d('0x54')]()[_0xd06d('0x28')](function(_0x9cd120){if(_0x3144af[_0xd06d('0x4d')][_0xd06d('0x5e')]&&_[_0xd06d('0x5f')](_0x3144af['body'][_0xd06d('0x5e')])){if(_0x3144af[_0xd06d('0x4d')][_0xd06d('0x5e')][_0xd06d('0x3b')]){_0x3144af[_0xd06d('0x4d')][_0xd06d('0x5e')]=_0x3144af[_0xd06d('0x4d')][_0xd06d('0x5e')][_0xd06d('0x60')](';')+';';}else{_0x3144af[_0xd06d('0x4d')][_0xd06d('0x5e')]=null;}}else{_0x3144af[_0xd06d('0x4d')]['tags']=null;}if(_0x3144af[_0xd06d('0x4d')]&&_['isArray'](_0x3144af[_0xd06d('0x4d')])){for(var _0x67cca5=0x0;_0x67cca5<_0x3144af[_0xd06d('0x4d')][_0xd06d('0x3b')];_0x67cca5+=0x1){_0x3144af[_0xd06d('0x4d')][_0x67cca5][_0xd06d('0x56')]=_0x3144af['params']['id'];_0x50a1c8[_0xd06d('0x61')](_0x3144af[_0xd06d('0x4d')][_0x67cca5]);}return BPromise[_0xd06d('0x62')](_0x50a1c8,function(_0x2a93cc){return db[_0xd06d('0x5d')]['create'](_[_0xd06d('0x63')](_0x2a93cc,[_0xd06d('0x64'),'id'])||{},{'fields':_['keys'](_0x9cd120),'raw':!![]})[_0xd06d('0x28')](function(_0x48ec14){_0x4ec895[_0xd06d('0x65')][_0xd06d('0x61')](_0x48ec14[_0xd06d('0x66')]);})['catch'](function(_0x4ca6d9){_0x4ec895[_0xd06d('0x67')][_0xd06d('0x61')]({'data':_0x2a93cc,'error':_0x4ca6d9[_0xd06d('0x68')]});});})[_0xd06d('0x28')](function(_0x4d5c5a){return _0x4ec895;})[_0xd06d('0x48')](function(_0x174f88){return _0x174f88;});}else{_0x5c5a51['status'](0x190)[_0xd06d('0x20')]({'message':_0xd06d('0x69')});}});}})[_0xd06d('0x28')](respondWithResult(_0x5c5a51,null))[_0xd06d('0x48')](handleError(_0x5c5a51,null));};exports['getContacts']=function(_0x4d1d9b,_0x988a68,_0x244ca0){var _0x5c4a56;return db[_0xd06d('0x46')][_0xd06d('0x50')]({'where':{'id':_0x4d1d9b[_0xd06d('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xd06d('0x28')](handleEntityNotFound(_0x988a68,null))[_0xd06d('0x28')](function(_0x260257){if(_0x260257){_0x5c4a56=_0x260257;return db[_0xd06d('0x5d')]['rawAttributes'];}})[_0xd06d('0x28')](function(_0x5897bb){if(_0x5897bb){var _0x1a9e01={};var _0x4e8372={};_0x4e8372[_0xd06d('0x34')]=_['concat'](_[_0xd06d('0x35')](_0x5897bb),_[_0xd06d('0x2f')](_0x5c4a56[_0xd06d('0x6a')],function(_0x370a10){return util['format'](_0xd06d('0x6b'),_0x370a10['id']);}));_0x4e8372[_0xd06d('0x38')]=_[_0xd06d('0x35')](_0x4d1d9b['query']);_0x4e8372[_0xd06d('0x36')]=_[_0xd06d('0x37')](_0x4e8372[_0xd06d('0x34')],_0x4e8372['query']);_0x1a9e01[_0xd06d('0x39')]=_[_0xd06d('0x37')](_0x4e8372[_0xd06d('0x34')],qs[_0xd06d('0x3a')](_0x4d1d9b['query'][_0xd06d('0x3a')]));_0x1a9e01[_0xd06d('0x39')]=_0x1a9e01['attributes'][_0xd06d('0x3b')]?_0x1a9e01[_0xd06d('0x39')]:_0x4e8372['model'];if(!_0x4d1d9b[_0xd06d('0x38')]['hasOwnProperty'](_0xd06d('0x6c'))){_0x1a9e01[_0xd06d('0x24')]=qs[_0xd06d('0x24')](_0x4d1d9b[_0xd06d('0x38')][_0xd06d('0x24')]);_0x1a9e01['offset']=qs['offset'](_0x4d1d9b[_0xd06d('0x38')][_0xd06d('0x21')]);}_0x1a9e01[_0xd06d('0x3d')]=qs['sort'](_0x4d1d9b[_0xd06d('0x38')][_0xd06d('0x3e')]);_0x1a9e01[_0xd06d('0x3f')]=qs[_0xd06d('0x36')](_[_0xd06d('0x40')](_0x4d1d9b[_0xd06d('0x38')],_0x4e8372[_0xd06d('0x36')]));_0x1a9e01[_0xd06d('0x6d')]=!![];if(_0x4d1d9b[_0xd06d('0x38')][_0xd06d('0x41')]){_0x1a9e01[_0xd06d('0x3f')]=_[_0xd06d('0x42')](_0x1a9e01['where'],{'$or':_['map'](_0x1a9e01[_0xd06d('0x39')],function(_0x37fa53){var _0x52650e={};_0x52650e[_0x37fa53]={'$like':'%'+_0x4d1d9b[_0xd06d('0x38')][_0xd06d('0x41')]+'%'};return _0x52650e;})});}_0x1a9e01=_[_0xd06d('0x42')]({},_0x1a9e01,_0x4d1d9b[_0xd06d('0x44')]);return _0x5c4a56['getContacts'](_0x1a9e01);}})[_0xd06d('0x28')](respondWithResult(_0x988a68,null))[_0xd06d('0x48')](handleError(_0x988a68,null));};exports['getContactsCsv']=function(_0x4b433c,_0x3e4c9b,_0x2d0127){var _0x566cf;var _0x1b620b;var _0x4d1eb8;var _0x19b98e=_0x4b433c[_0xd06d('0x4a')]['id'];csv_results=[];return db['ContactItemType'][_0xd06d('0x47')]({'attributes':['id','name'],'raw':!![],'order':[_0xd06d('0x6e')]})[_0xd06d('0x28')](function(_0x354dee){_0x566cf=_0x354dee;var _0x204c26=_[_0xd06d('0x35')](db[_0xd06d('0x5d')]['rawAttributes']);return db[_0xd06d('0x6f')][_0xd06d('0x47')]({'raw':!![],'attributes':['id',_0xd06d('0x70')]})[_0xd06d('0x28')](function(_0x4e6d16){_0x1b620b=_0x4e6d16;var _0x54131a=squel[_0xd06d('0x71')]()[_0xd06d('0x3a')](_0x204c26)['from'](_0xd06d('0x72'),'c')[_0xd06d('0x3f')](_0xd06d('0x73'),_0x19b98e)[_0xd06d('0x3f')]('c.deletedAt\x20is\x20null')[_0xd06d('0x74')]();for(var _0x57c29f=0x0;_0x57c29f<_0x1b620b[_0xd06d('0x3b')];_0x57c29f++){_0x54131a[_0xd06d('0x75')]('c.cf_'+_0x1b620b[_0x57c29f]['id'],_0xd06d('0x76')+_0x1b620b[_0x57c29f]['alias']);}for(var _0x57c29f=0x0;_0x57c29f<_0x566cf['length'];_0x57c29f++){_0x54131a[_0xd06d('0x75')](squel[_0xd06d('0x71')]()['field'](_0xd06d('0x77'))['from']('cm_contact_has_items')[_0xd06d('0x3f')](_0xd06d('0x78'),_0x566cf[_0x57c29f]['id'])[_0xd06d('0x3f')](_0xd06d('0x79')),'additionalPhone_'+_0x566cf[_0x57c29f][_0xd06d('0x2d')]);_0x54131a['field'](squel[_0xd06d('0x71')]()[_0xd06d('0x75')](_0xd06d('0x7a'))[_0xd06d('0x7b')](_0xd06d('0x7c'))[_0xd06d('0x3f')](_0xd06d('0x78'),_0x566cf[_0x57c29f]['id'])['where'](_0xd06d('0x79')),_0xd06d('0x7d')+_0x566cf[_0x57c29f]['name']);}var _0x205b81=[];_0x205b81[_0xd06d('0x61')](_0x54131a[_0xd06d('0x7e')]());BPromise[_0xd06d('0x62')](_0x205b81,handleQuery)['then'](function(_0x3ba761){handleQuery(_0x54131a[_0xd06d('0x7e')]());var _0x501578=csv_results[0x0];if(!_[_0xd06d('0x7f')](_0x501578)){var _0x786ef0=toCsv(_0x501578);var _0x1f6517=Date[_0xd06d('0x80')]();fs[_0xd06d('0x81')](util[_0xd06d('0x82')](_0xd06d('0x83'),_0x19b98e,_0x1f6517),_0x786ef0);_0x3e4c9b[_0xd06d('0x84')](_0xd06d('0x85'),_0xd06d('0x86')+util['format']('list_%d_%s.csv',_0x19b98e,_0x1f6517));_0x3e4c9b[_0xd06d('0x84')](_0xd06d('0x87'),_0xd06d('0x88'));return _0x3e4c9b[_0xd06d('0x89')](util[_0xd06d('0x82')](_0xd06d('0x83'),_0x19b98e,_0x1f6517));}else{return _0x3e4c9b[_0xd06d('0x1d')](0xcc);}});});});};exports[_0xd06d('0x8a')]=function(_0x2695bd,_0x1792b7,_0x3598f8){var _0x20888d;delete _0x2695bd[_0xd06d('0x4d')]['id'];return db[_0xd06d('0x46')]['findOne']({'where':{'id':_0x2695bd[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x1792b7,null))[_0xd06d('0x28')](function(_0x352972){if(_0x352972){return db[_0xd06d('0x8b')][_0xd06d('0x8c')](function(_0x3cdaec){return db[_0xd06d('0x6f')][_0xd06d('0x4c')](_0x2695bd[_0xd06d('0x4d')],{'transaction':_0x3cdaec})[_0xd06d('0x28')](function(_0x4d2c3d){_0x20888d=_0x4d2c3d;return _0x352972[_0xd06d('0x8d')](_0x4d2c3d,{'transaction':_0x3cdaec});})[_0xd06d('0x28')](function(){var _0x541f31={'type':db[_0xd06d('0x8e')][_0xd06d('0x8f')],'transaction':_0x3cdaec};switch(_0x2695bd['body'][_0xd06d('0x32')]){case _0xd06d('0x90'):_0x541f31[_0xd06d('0x32')]=db[_0xd06d('0x8e')][_0xd06d('0x8f')];break;case _0xd06d('0x91'):_0x541f31[_0xd06d('0x32')]=db[_0xd06d('0x8e')]['INTEGER'];break;case _0xd06d('0x92'):_0x541f31[_0xd06d('0x32')]=db[_0xd06d('0x8e')][_0xd06d('0x93')];_0x541f31[_0xd06d('0x94')]=![];break;default:}return db[_0xd06d('0x8b')][_0xd06d('0x95')]['addColumn'](_0xd06d('0x72'),util[_0xd06d('0x82')](_0xd06d('0x96'),_0x20888d['id']),_0x541f31);})['then'](function(){return _0x20888d;});});}})[_0xd06d('0x28')](respondWithResult(_0x1792b7,null))[_0xd06d('0x48')](handleError(_0x1792b7,null));};exports[_0xd06d('0x97')]=function(_0x40655f,_0x4d658b,_0x5c9cd8){var _0x3762cd={};var _0x5e19b6={};var _0x5188f3;var _0x85a11a;return db[_0xd06d('0x46')][_0xd06d('0x59')]({'where':{'id':_0x40655f[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x4d658b,null))[_0xd06d('0x28')](function(_0x183ed6){if(_0x183ed6){_0x5188f3=_0x183ed6;_0x5e19b6[_0xd06d('0x34')]=_[_0xd06d('0x35')](db['CmCustomField']['rawAttributes']);_0x5e19b6[_0xd06d('0x38')]=_[_0xd06d('0x35')](_0x40655f[_0xd06d('0x38')]);_0x5e19b6[_0xd06d('0x36')]=_['intersection'](_0x5e19b6[_0xd06d('0x34')],_0x5e19b6[_0xd06d('0x38')]);_0x3762cd[_0xd06d('0x39')]=_[_0xd06d('0x37')](_0x5e19b6[_0xd06d('0x34')],qs['fields'](_0x40655f[_0xd06d('0x38')][_0xd06d('0x3a')]));_0x3762cd[_0xd06d('0x39')]=_0x3762cd[_0xd06d('0x39')]['length']?_0x3762cd[_0xd06d('0x39')]:_0x5e19b6[_0xd06d('0x34')];_0x3762cd[_0xd06d('0x3d')]=qs[_0xd06d('0x3e')](_0x40655f[_0xd06d('0x38')][_0xd06d('0x3e')]);_0x3762cd[_0xd06d('0x3f')]=qs[_0xd06d('0x36')](_[_0xd06d('0x40')](_0x40655f[_0xd06d('0x38')],_0x5e19b6[_0xd06d('0x36')]));_0x3762cd['where']=_[_0xd06d('0x42')](_0x3762cd[_0xd06d('0x3f')],{'$or':[{'ListId':_0x183ed6['id']},{'ListId':null}]});if(_0x40655f[_0xd06d('0x38')]['filter']){_0x3762cd[_0xd06d('0x3f')]=_['merge'](_0x3762cd[_0xd06d('0x3f')],{'$or':_[_0xd06d('0x2f')](_0x3762cd['attributes'],function(_0x4094d0){var _0x3ecea2={};_0x3ecea2[_0x4094d0]={'$like':'%'+_0x40655f['query'][_0xd06d('0x41')]+'%'};return _0x3ecea2;})});}_0x3762cd=_['merge']({},_0x3762cd,_0x40655f['options']);return db[_0xd06d('0x6f')]['findAndCountAll'](_0x3762cd);}})[_0xd06d('0x28')](respondWithResult(_0x4d658b,null))['catch'](handleError(_0x4d658b,null));};exports[_0xd06d('0x98')]=function(_0x214472,_0x136c44){return db[_0xd06d('0x6f')][_0xd06d('0x99')]({'where':{'ListId':null}})[_0xd06d('0x28')](handleEntityNotFound(_0x136c44,null))['then'](function(_0x113091){return _0x113091;})[_0xd06d('0x28')](respondWithResult(_0x136c44,null))[_0xd06d('0x48')](handleError(_0x136c44,null));};exports[_0xd06d('0x9a')]=function(_0x317a3a,_0x4bde5c,_0x40c56b){return db[_0xd06d('0x46')][_0xd06d('0x50')]({'where':{'id':_0x317a3a[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x4bde5c,null))[_0xd06d('0x28')](function(_0xaa759e){if(_0xaa759e){return _0xaa759e['addAgents'](_0x317a3a[_0xd06d('0x4d')][_0xd06d('0x64')],_[_0xd06d('0x63')](_0x317a3a[_0xd06d('0x4d')],[_0xd06d('0x64'),'id'])||{})['spread'](function(_0xde8bff){for(var _0x5686a3=0x0;_0x5686a3<_0x317a3a[_0xd06d('0x4d')][_0xd06d('0x64')]['length'];_0x5686a3+=0x1){socket[_0xd06d('0x9b')]('userCmList:save',{'UserId':Number(_0x317a3a['body'][_0xd06d('0x64')][_0x5686a3]),'CmListId':Number(_0x317a3a[_0xd06d('0x4a')]['id'])});}return _0xde8bff;});}})['then'](respondWithResult(_0x4bde5c,null))[_0xd06d('0x48')](handleError(_0x4bde5c,null));};exports[_0xd06d('0x9c')]=function(_0x104f38,_0x4305b3,_0x412dc3){return db[_0xd06d('0x46')]['find']({'where':{'id':_0x104f38[_0xd06d('0x4a')]['id']}})[_0xd06d('0x28')](handleEntityNotFound(_0x4305b3,null))[_0xd06d('0x28')](function(_0x329855){if(_0x329855){return _0x329855[_0xd06d('0x9c')](_0x104f38[_0xd06d('0x38')][_0xd06d('0x64')])[_0xd06d('0x28')](function(){if(_['isArray'](_0x104f38['query'][_0xd06d('0x64')])){for(var _0x58975d=0x0;_0x58975d<_0x104f38[_0xd06d('0x38')][_0xd06d('0x64')][_0xd06d('0x3b')];_0x58975d+=0x1){socket[_0xd06d('0x9b')]('userCmList:remove',{'UserId':Number(_0x104f38[_0xd06d('0x38')][_0xd06d('0x64')][_0x58975d]),'CmListId':Number(_0x104f38[_0xd06d('0x4a')]['id'])});}}else{socket[_0xd06d('0x9b')](_0xd06d('0x9d'),{'UserId':Number(_0x104f38['query'][_0xd06d('0x64')]),'CmListId':Number(_0x104f38[_0xd06d('0x4a')]['id'])});}});}})[_0xd06d('0x28')](respondWithStatusCode(_0x4305b3,null))['catch'](handleError(_0x4305b3,null));};exports[_0xd06d('0x9e')]=function(_0x2bae90,_0x35e3a6,_0x4f7026){var _0x221c97={};var _0x584566={};var _0x149662;var _0xd7396a;return db[_0xd06d('0x46')][_0xd06d('0x59')]({'where':{'id':_0x2bae90[_0xd06d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35e3a6,null))[_0xd06d('0x28')](function(_0x91eaae){if(_0x91eaae){_0x149662=_0x91eaae;_0x584566[_0xd06d('0x34')]=_[_0xd06d('0x35')](db[_0xd06d('0x9f')][_0xd06d('0x30')]);_0x584566['query']=_[_0xd06d('0x35')](_0x2bae90[_0xd06d('0x38')]);_0x584566['filters']=_[_0xd06d('0x37')](_0x584566[_0xd06d('0x34')],_0x584566['query']);_0x221c97[_0xd06d('0x39')]=_[_0xd06d('0x37')](_0x584566[_0xd06d('0x34')],qs[_0xd06d('0x3a')](_0x2bae90[_0xd06d('0x38')][_0xd06d('0x3a')]));_0x221c97['attributes']=_0x221c97[_0xd06d('0x39')][_0xd06d('0x3b')]?_0x221c97[_0xd06d('0x39')]:_0x584566[_0xd06d('0x34')];_0x221c97[_0xd06d('0x3d')]=qs[_0xd06d('0x3e')](_0x2bae90['query']['sort']);_0x221c97[_0xd06d('0x3f')]=qs[_0xd06d('0x36')](_['pick'](_0x2bae90[_0xd06d('0x38')],_0x584566['filters']));if(_0x2bae90[_0xd06d('0x38')]['filter']){_0x221c97[_0xd06d('0x3f')]=_['merge'](_0x221c97[_0xd06d('0x3f')],{'$or':_[_0xd06d('0x2f')](_0x221c97[_0xd06d('0x39')],function(_0x194460){var _0x264453={};_0x264453[_0x194460]={'$like':'%'+_0x2bae90['query'][_0xd06d('0x41')]+'%'};return _0x264453;})});}_0x221c97=_[_0xd06d('0x42')]({},_0x221c97,_0x2bae90['options']);return _0x149662['getAgents'](_0x221c97);}})[_0xd06d('0x28')](function(_0x397a51){if(_0x397a51){_0xd7396a=_0x397a51[_0xd06d('0x3b')];if(!_0x2bae90[_0xd06d('0x38')]['hasOwnProperty'](_0xd06d('0x6c'))){_0x221c97['limit']=qs[_0xd06d('0x24')](_0x2bae90[_0xd06d('0x38')][_0xd06d('0x24')]);_0x221c97[_0xd06d('0x21')]=qs[_0xd06d('0x21')](_0x2bae90['query']['offset']);}return _0x149662[_0xd06d('0x9e')](_0x221c97);}})[_0xd06d('0x28')](function(_0x2eda90){if(_0x2eda90){return _0x2eda90?{'count':_0xd7396a,'rows':_0x2eda90}:null;}})['then'](respondWithResult(_0x35e3a6,null))[_0xd06d('0x48')](handleError(_0x35e3a6,null));};function handleQuery(_0x2cc202){logger['info'](_0x2cc202);return db[_0xd06d('0x8b')][_0xd06d('0x38')](_0x2cc202)[_0xd06d('0xa0')](function(_0x284820){csv_results[_0xd06d('0x61')](_0x284820);})['catch'](function(_0x3df8f8){logger[_0xd06d('0x2c')](_0x3df8f8[_0xd06d('0x68')]);});} \ No newline at end of file +var _0x10d5=['defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','stack','send','index','map','CmList','fieldName','type','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','rows','catch','show','keys','rawAttributes','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','select','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','toString','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','BOOLEAN'];(function(_0x439cdf,_0x5df90f){var _0x545e6f=function(_0x296263){while(--_0x296263){_0x439cdf['push'](_0x439cdf['shift']());}};_0x545e6f(++_0x5df90f);}(_0x10d5,0xbc));var _0x510d=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x10d5[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x510d('0x0'));var rimraf=require(_0x510d('0x1'));var zipdir=require(_0x510d('0x2'));var jsonpatch=require(_0x510d('0x3'));var rp=require(_0x510d('0x4'));var moment=require(_0x510d('0x5'));var BPromise=require(_0x510d('0x6'));var Mustache=require(_0x510d('0x7'));var util=require(_0x510d('0x8'));var path=require(_0x510d('0x9'));var sox=require(_0x510d('0xa'));var csv=require(_0x510d('0xb'));var ejs=require(_0x510d('0xc'));var fs=require('fs');var fs_extra=require(_0x510d('0xd'));var _=require(_0x510d('0xe'));var squel=require(_0x510d('0xf'));var crypto=require(_0x510d('0x10'));var jsforce=require(_0x510d('0x11'));var deskjs=require(_0x510d('0x12'));var toCsv=require(_0x510d('0xb'));var querystring=require(_0x510d('0x13'));var Papa=require(_0x510d('0x14'));var Redis=require('ioredis');var authService=require(_0x510d('0x15'));var qs=require(_0x510d('0x16'));var as=require(_0x510d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x510d('0x18'))('api');var utils=require(_0x510d('0x19'));var config=require(_0x510d('0x1a'));var licenseUtil=require(_0x510d('0x1b'));var db=require(_0x510d('0x1c'))['db'];var csv_results;config[_0x510d('0x1d')]=_[_0x510d('0x1e')](config[_0x510d('0x1d')],{'host':_0x510d('0x1f'),'port':0x18eb});var socket=require(_0x510d('0x20'))(new Redis(config[_0x510d('0x1d')]));require(_0x510d('0x21'))[_0x510d('0x22')](socket);function respondWithStatusCode(_0x2df41f,_0x2aeaf2){_0x2aeaf2=_0x2aeaf2||0xcc;return function(_0x46bfa3){if(_0x46bfa3){return _0x2df41f[_0x510d('0x23')](_0x2aeaf2);}return _0x2df41f['status'](_0x2aeaf2)[_0x510d('0x24')]();};}function respondWithResult(_0x390b9b,_0x389687){_0x389687=_0x389687||0xc8;return function(_0x5f5754){if(_0x5f5754){return _0x390b9b[_0x510d('0x25')](_0x389687)[_0x510d('0x26')](_0x5f5754);}};}function respondWithFilteredResult(_0x184a3e,_0x5606ee){return function(_0x314776){if(_0x314776){var _0x44269d=typeof _0x5606ee[_0x510d('0x27')]===_0x510d('0x28')&&typeof _0x5606ee[_0x510d('0x29')]===_0x510d('0x28');var _0x23d119=_0x314776[_0x510d('0x2a')];var _0x19572b=_0x44269d?0x0:_0x5606ee[_0x510d('0x27')];var _0x23178c=_0x44269d?_0x314776[_0x510d('0x2a')]:_0x5606ee['offset']+_0x5606ee['limit'];var _0x18580e;if(_0x23178c>=_0x23d119){_0x23178c=_0x23d119;_0x18580e=0xc8;}else{_0x18580e=0xce;}_0x184a3e[_0x510d('0x25')](_0x18580e);return _0x184a3e[_0x510d('0x2b')](_0x510d('0x2c'),_0x19572b+'-'+_0x23178c+'/'+_0x23d119)[_0x510d('0x26')](_0x314776);}return null;};}function patchUpdates(_0x4abaaa){return function(_0x381f41){try{jsonpatch[_0x510d('0x2d')](_0x381f41,_0x4abaaa,!![]);}catch(_0x63df19){return BPromise[_0x510d('0x2e')](_0x63df19);}return _0x381f41[_0x510d('0x2f')]();};}function saveUpdates(_0xcb0d9b,_0x125e17){return function(_0x2ba597){if(_0x2ba597){return _0x2ba597[_0x510d('0x30')](_0xcb0d9b)['then'](function(_0x35875c){return _0x35875c;});}return null;};}function removeEntity(_0x1711d5,_0x574d4d){return function(_0x444c85){if(_0x444c85){return _0x444c85[_0x510d('0x31')]()[_0x510d('0x32')](function(){var _0x3b391f=_0x444c85[_0x510d('0x33')]({'plain':!![]});var _0x138f31=_0x510d('0x34');return db[_0x510d('0x35')][_0x510d('0x31')]({'where':{'type':_0x138f31,'resourceId':_0x3b391f['id']}})[_0x510d('0x32')](function(){return _0x444c85;});})[_0x510d('0x32')](function(){_0x1711d5[_0x510d('0x25')](0xcc)[_0x510d('0x24')]();});}};}function handleEntityNotFound(_0x57ff2b,_0x1f8d60){return function(_0xb467a8){if(!_0xb467a8){_0x57ff2b[_0x510d('0x23')](0x194);}return _0xb467a8;};}function handleError(_0x32e75e,_0x5f4d08){_0x5f4d08=_0x5f4d08||0x1f4;return function(_0x54f920){logger['error'](_0x54f920[_0x510d('0x36')]);if(_0x54f920['name']){delete _0x54f920['name'];}_0x32e75e[_0x510d('0x25')](_0x5f4d08)[_0x510d('0x37')](_0x54f920);};}exports[_0x510d('0x38')]=function(_0x239bb6,_0x31ea4b){var _0x1d0716={},_0x23acc1={},_0x6f30fc={'count':0x0,'rows':[]};var _0x229050=_[_0x510d('0x39')](db[_0x510d('0x3a')]['rawAttributes'],function(_0x3a1756){return{'name':_0x3a1756[_0x510d('0x3b')],'type':_0x3a1756[_0x510d('0x3c')]['key']};});_0x23acc1['model']=_[_0x510d('0x39')](_0x229050,_0x510d('0x3d'));_0x23acc1[_0x510d('0x3e')]=_['keys'](_0x239bb6[_0x510d('0x3e')]);_0x23acc1[_0x510d('0x3f')]=_[_0x510d('0x40')](_0x23acc1[_0x510d('0x41')],_0x23acc1['query']);_0x1d0716['attributes']=_[_0x510d('0x40')](_0x23acc1[_0x510d('0x41')],qs[_0x510d('0x42')](_0x239bb6[_0x510d('0x3e')][_0x510d('0x42')]));_0x1d0716[_0x510d('0x43')]=_0x1d0716[_0x510d('0x43')]['length']?_0x1d0716['attributes']:_0x23acc1[_0x510d('0x41')];if(!_0x239bb6[_0x510d('0x3e')][_0x510d('0x44')](_0x510d('0x45'))){_0x1d0716[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x239bb6['query'][_0x510d('0x29')]);_0x1d0716[_0x510d('0x27')]=qs['offset'](_0x239bb6[_0x510d('0x3e')]['offset']);}_0x1d0716[_0x510d('0x46')]=qs[_0x510d('0x47')](_0x239bb6[_0x510d('0x3e')]['sort']);_0x1d0716[_0x510d('0x48')]=qs[_0x510d('0x3f')](_['pick'](_0x239bb6[_0x510d('0x3e')],_0x23acc1[_0x510d('0x3f')]),_0x229050);if(_0x239bb6[_0x510d('0x3e')]['filter']){_0x1d0716[_0x510d('0x48')]=_[_0x510d('0x49')](_0x1d0716[_0x510d('0x48')],{'$or':_['map'](_0x229050,function(_0x34dc89){if(_0x34dc89[_0x510d('0x3c')]!=='VIRTUAL'){var _0x2ba1c6={};_0x2ba1c6[_0x34dc89[_0x510d('0x3d')]]={'$like':'%'+_0x239bb6[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x2ba1c6;}})});}_0x1d0716=_[_0x510d('0x49')]({},_0x1d0716,_0x239bb6['options']);var _0x5564a4={'where':_0x1d0716[_0x510d('0x48')]};return db[_0x510d('0x3a')][_0x510d('0x2a')](_0x5564a4)['then'](function(_0x13674b){_0x6f30fc[_0x510d('0x2a')]=_0x13674b;if(_0x239bb6[_0x510d('0x3e')]['includeAll']){_0x1d0716[_0x510d('0x4b')]=[{'all':!![]}];}return db[_0x510d('0x3a')]['findAll'](_0x1d0716);})[_0x510d('0x32')](function(_0x5144e0){_0x6f30fc[_0x510d('0x4c')]=_0x5144e0;return _0x6f30fc;})[_0x510d('0x32')](respondWithFilteredResult(_0x31ea4b,_0x1d0716))[_0x510d('0x4d')](handleError(_0x31ea4b,null));};exports[_0x510d('0x4e')]=function(_0x4dbe93,_0x23cf64){var _0x3ce79f={'raw':![],'where':{'id':_0x4dbe93['params']['id']}},_0x5b14bb={};_0x5b14bb[_0x510d('0x41')]=_[_0x510d('0x4f')](db[_0x510d('0x3a')][_0x510d('0x50')]);_0x5b14bb[_0x510d('0x3e')]=_[_0x510d('0x4f')](_0x4dbe93['query']);_0x5b14bb[_0x510d('0x3f')]=_['intersection'](_0x5b14bb[_0x510d('0x41')],_0x5b14bb['query']);_0x3ce79f[_0x510d('0x43')]=_[_0x510d('0x40')](_0x5b14bb[_0x510d('0x41')],qs[_0x510d('0x42')](_0x4dbe93['query'][_0x510d('0x42')]));_0x3ce79f[_0x510d('0x43')]=_0x3ce79f[_0x510d('0x43')][_0x510d('0x51')]?_0x3ce79f[_0x510d('0x43')]:_0x5b14bb['model'];if(_0x4dbe93['query']['includeAll']){_0x3ce79f[_0x510d('0x4b')]=[{'all':!![]}];}_0x3ce79f=_[_0x510d('0x49')]({},_0x3ce79f,_0x4dbe93[_0x510d('0x52')]);return db['CmList'][_0x510d('0x53')](_0x3ce79f)[_0x510d('0x32')](handleEntityNotFound(_0x23cf64,null))[_0x510d('0x32')](respondWithResult(_0x23cf64,null))[_0x510d('0x4d')](handleError(_0x23cf64,null));};exports['create']=function(_0x2895c8,_0x27e7c2){return db[_0x510d('0x3a')][_0x510d('0x54')](_0x2895c8['body'],{})[_0x510d('0x32')](function(_0x16ee79){var _0x3cad89=_0x2895c8[_0x510d('0x55')][_0x510d('0x33')]({'plain':!![]});if(!_0x3cad89)throw new Error(_0x510d('0x56'));if(_0x3cad89[_0x510d('0x57')]==='user'){var _0x5e2598=_0x16ee79['get']({'plain':!![]});var _0x1c3808=_0x510d('0x34');return db[_0x510d('0x58')]['find']({'where':{'name':_0x1c3808,'userProfileId':_0x3cad89[_0x510d('0x59')]},'raw':!![]})[_0x510d('0x32')](function(_0x1ba7e8){if(_0x1ba7e8&&_0x1ba7e8[_0x510d('0x5a')]===0x0){return db[_0x510d('0x35')][_0x510d('0x54')]({'name':_0x5e2598[_0x510d('0x3d')],'resourceId':_0x5e2598['id'],'type':_0x1ba7e8[_0x510d('0x3d')],'sectionId':_0x1ba7e8['id']},{})[_0x510d('0x32')](function(){return _0x16ee79;});}else{return _0x16ee79;}})[_0x510d('0x4d')](function(_0x33977d){logger[_0x510d('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33977d);throw _0x33977d;});}return _0x16ee79;})[_0x510d('0x32')](respondWithResult(_0x27e7c2,0xc9))[_0x510d('0x4d')](handleError(_0x27e7c2,null));};exports[_0x510d('0x30')]=function(_0xcd4987,_0x2936da){if(_0xcd4987[_0x510d('0x5c')]['id']){delete _0xcd4987[_0x510d('0x5c')]['id'];}return db[_0x510d('0x3a')][_0x510d('0x53')]({'where':{'id':_0xcd4987[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x2936da,null))[_0x510d('0x32')](saveUpdates(_0xcd4987['body'],null))['then'](respondWithResult(_0x2936da,null))['catch'](handleError(_0x2936da,null));};exports[_0x510d('0x31')]=function(_0x1da7eb,_0x43bb75){return db[_0x510d('0x3a')][_0x510d('0x53')]({'where':{'id':_0x1da7eb[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x43bb75,null))[_0x510d('0x32')](removeEntity(_0x43bb75,null))[_0x510d('0x4d')](handleError(_0x43bb75,null));};exports[_0x510d('0x5e')]=function(_0x13c52c,_0xf99957){return db[_0x510d('0x3a')][_0x510d('0x5e')]()[_0x510d('0x32')](respondWithResult(_0xf99957,null))[_0x510d('0x4d')](handleError(_0xf99957,null));};exports[_0x510d('0x5f')]=function(_0x43f370,_0x5f5a85,_0x37034b){if(_0x43f370[_0x510d('0x5c')]['id']){delete _0x43f370[_0x510d('0x5c')]['id'];}return db['CmList']['find']({'where':{'id':_0x43f370['params']['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x5f5a85,null))['then'](function(_0x446e27){if(_0x446e27){_0x43f370[_0x510d('0x5c')][_0x510d('0x60')]=_0x446e27['id'];return db[_0x510d('0x61')][_0x510d('0x54')](_0x43f370['body']);}})[_0x510d('0x32')](respondWithResult(_0x5f5a85,null))[_0x510d('0x4d')](handleError(_0x5f5a85,null));};exports[_0x510d('0x62')]=function(_0x2d3b1f,_0x5dbbeb,_0x1daa08){var _0x509a90={'raw':![],'where':{}};var _0x3f61e4={};var _0x40f27f={'count':0x0,'rows':[]};return db[_0x510d('0x3a')][_0x510d('0x63')]({'where':{'id':_0x2d3b1f[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5dbbeb,null))[_0x510d('0x32')](function(_0x892e0c){if(_0x892e0c){_0x3f61e4['model']=_[_0x510d('0x4f')](db[_0x510d('0x61')][_0x510d('0x50')]);_0x3f61e4[_0x510d('0x3e')]=_['keys'](_0x2d3b1f[_0x510d('0x3e')]);_0x3f61e4[_0x510d('0x3f')]=_[_0x510d('0x40')](_0x3f61e4['model'],_0x3f61e4[_0x510d('0x3e')]);_0x509a90[_0x510d('0x43')]=_[_0x510d('0x40')](_0x3f61e4[_0x510d('0x41')],qs['fields'](_0x2d3b1f[_0x510d('0x3e')][_0x510d('0x42')]));_0x509a90['attributes']=_0x509a90[_0x510d('0x43')]['length']?_0x509a90[_0x510d('0x43')]:_0x3f61e4[_0x510d('0x41')];if(!_0x2d3b1f['query'][_0x510d('0x44')](_0x510d('0x45'))){_0x509a90[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x2d3b1f['query'][_0x510d('0x29')]);_0x509a90[_0x510d('0x27')]=qs[_0x510d('0x27')](_0x2d3b1f['query'][_0x510d('0x27')]);}_0x509a90[_0x510d('0x46')]=qs['sort'](_0x2d3b1f[_0x510d('0x3e')][_0x510d('0x47')]);_0x509a90[_0x510d('0x48')]=qs[_0x510d('0x3f')](_[_0x510d('0x64')](_0x2d3b1f[_0x510d('0x3e')],_0x3f61e4[_0x510d('0x3f')]));_0x509a90['where'][_0x510d('0x60')]=_0x892e0c['id'];if(_0x2d3b1f['query'][_0x510d('0x4a')]){_0x509a90[_0x510d('0x48')]=_[_0x510d('0x49')](_0x509a90[_0x510d('0x48')],{'$or':_['map'](_0x509a90['attributes'],function(_0x35b501){var _0xfb1569={};_0xfb1569[_0x35b501]={'$like':'%'+_0x2d3b1f['query'][_0x510d('0x4a')]+'%'};return _0xfb1569;})});}_0x509a90=_[_0x510d('0x49')]({},_0x509a90,_0x2d3b1f['options']);return db[_0x510d('0x61')][_0x510d('0x2a')]({'where':_0x509a90[_0x510d('0x48')]})[_0x510d('0x32')](function(_0x12c67a){_0x40f27f[_0x510d('0x2a')]=_0x12c67a;if(_0x2d3b1f[_0x510d('0x3e')]['includeAll']){_0x509a90[_0x510d('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x510d('0x65')](_0x509a90);})[_0x510d('0x32')](function(_0x349eff){_0x40f27f[_0x510d('0x4c')]=_0x349eff;return _0x40f27f;});}})[_0x510d('0x32')](respondWithFilteredResult(_0x5dbbeb,_0x509a90))[_0x510d('0x4d')](handleError(_0x5dbbeb,null));};exports[_0x510d('0x66')]=function(_0x3a9983,_0x286f6b,_0x1d3f52){return db['CmList'][_0x510d('0x53')]({'where':{'id':_0x3a9983[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x286f6b,null))[_0x510d('0x32')](function(_0x347c72){if(_0x347c72){return _0x347c72[_0x510d('0x66')](_0x3a9983[_0x510d('0x3e')][_0x510d('0x67')]);}})['then'](respondWithStatusCode(_0x286f6b,null))[_0x510d('0x4d')](handleError(_0x286f6b,null));};exports[_0x510d('0x68')]=function(_0x2e26f5,_0x5893bd,_0x2c51e7){return db[_0x510d('0x3a')][_0x510d('0x53')]({'where':{'id':_0x2e26f5[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5893bd,null))[_0x510d('0x32')](function(_0x357e13){if(_0x357e13){var _0x29c599=[];var _0x298298={'success':[],'errors':[]};return db[_0x510d('0x69')][_0x510d('0x5e')]()['then'](function(_0x39bc64){if(_0x2e26f5['body'][_0x510d('0x6a')]&&_[_0x510d('0x6b')](_0x2e26f5['body'][_0x510d('0x6a')])){if(_0x2e26f5[_0x510d('0x5c')]['tags'][_0x510d('0x51')]){_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')]=_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')][_0x510d('0x6c')](';')+';';}else{_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')]=null;}}else{_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')]=null;}if(_0x2e26f5['body']&&_[_0x510d('0x6b')](_0x2e26f5[_0x510d('0x5c')])){for(var _0x5e2862=0x0;_0x5e2862<_0x2e26f5[_0x510d('0x5c')]['length'];_0x5e2862+=0x1){_0x2e26f5[_0x510d('0x5c')][_0x5e2862]['ListId']=_0x2e26f5['params']['id'];_0x29c599[_0x510d('0x6d')](_0x2e26f5[_0x510d('0x5c')][_0x5e2862]);}return BPromise[_0x510d('0x6e')](_0x29c599,function(_0x4733a5){return db[_0x510d('0x69')][_0x510d('0x54')](_['omit'](_0x4733a5,[_0x510d('0x67'),'id'])||{},{'fields':_[_0x510d('0x4f')](_0x39bc64),'raw':!![]})[_0x510d('0x32')](function(_0x2c03b9){_0x298298[_0x510d('0x6f')][_0x510d('0x6d')](_0x2c03b9[_0x510d('0x70')]);})['catch'](function(_0x13985c){_0x298298[_0x510d('0x71')][_0x510d('0x6d')]({'data':_0x4733a5,'error':_0x13985c[_0x510d('0x72')]});});})[_0x510d('0x32')](function(_0x4dcd3c){return _0x298298;})[_0x510d('0x4d')](function(_0x375c6f){return _0x375c6f;});}else{_0x5893bd[_0x510d('0x25')](0x190)[_0x510d('0x26')]({'message':_0x510d('0x73')});}});}})[_0x510d('0x32')](respondWithResult(_0x5893bd,null))[_0x510d('0x4d')](handleError(_0x5893bd,null));};exports[_0x510d('0x74')]=function(_0x136660,_0x1164de,_0x1d92f1){var _0x18ee60;return db[_0x510d('0x3a')]['find']({'where':{'id':_0x136660['params']['id']},'include':[{'model':db[_0x510d('0x75')],'as':_0x510d('0x76')}]})[_0x510d('0x32')](handleEntityNotFound(_0x1164de,null))[_0x510d('0x32')](function(_0x351485){if(_0x351485){_0x18ee60=_0x351485;return db[_0x510d('0x69')]['rawAttributes'];}})[_0x510d('0x32')](function(_0x52329b){if(_0x52329b){var _0x2af165={};var _0x1798bb={};_0x1798bb[_0x510d('0x41')]=_[_0x510d('0x77')](_[_0x510d('0x4f')](_0x52329b),_[_0x510d('0x39')](_0x18ee60['CustomFields'],function(_0x26e2cb){return util[_0x510d('0x78')]('cf_%d',_0x26e2cb['id']);}));_0x1798bb['query']=_[_0x510d('0x4f')](_0x136660[_0x510d('0x3e')]);_0x1798bb[_0x510d('0x3f')]=_[_0x510d('0x40')](_0x1798bb['model'],_0x1798bb[_0x510d('0x3e')]);_0x2af165[_0x510d('0x43')]=_['intersection'](_0x1798bb[_0x510d('0x41')],qs[_0x510d('0x42')](_0x136660[_0x510d('0x3e')][_0x510d('0x42')]));_0x2af165[_0x510d('0x43')]=_0x2af165[_0x510d('0x43')][_0x510d('0x51')]?_0x2af165['attributes']:_0x1798bb['model'];if(!_0x136660[_0x510d('0x3e')]['hasOwnProperty'](_0x510d('0x45'))){_0x2af165[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x136660['query'][_0x510d('0x29')]);_0x2af165['offset']=qs['offset'](_0x136660[_0x510d('0x3e')]['offset']);}_0x2af165['order']=qs['sort'](_0x136660[_0x510d('0x3e')][_0x510d('0x47')]);_0x2af165[_0x510d('0x48')]=qs[_0x510d('0x3f')](_[_0x510d('0x64')](_0x136660[_0x510d('0x3e')],_0x1798bb[_0x510d('0x3f')]));_0x2af165[_0x510d('0x79')]=!![];if(_0x136660[_0x510d('0x3e')][_0x510d('0x4a')]){_0x2af165[_0x510d('0x48')]=_[_0x510d('0x49')](_0x2af165[_0x510d('0x48')],{'$or':_['map'](_0x2af165[_0x510d('0x43')],function(_0x595a68){var _0x395b5d={};_0x395b5d[_0x595a68]={'$like':'%'+_0x136660[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x395b5d;})});}_0x2af165=_[_0x510d('0x49')]({},_0x2af165,_0x136660[_0x510d('0x52')]);return _0x18ee60[_0x510d('0x74')](_0x2af165);}})[_0x510d('0x32')](respondWithResult(_0x1164de,null))[_0x510d('0x4d')](handleError(_0x1164de,null));};exports['getContactsCsv']=function(_0x39cab1,_0x22379f,_0x4b5c9b){var _0x172250;var _0x2fd668;var _0x2f7b9b;var _0x5a57ac=_0x39cab1[_0x510d('0x5d')]['id'];csv_results=[];return db[_0x510d('0x7a')][_0x510d('0x65')]({'attributes':['id',_0x510d('0x3d')],'raw':!![],'order':[_0x510d('0x7b')]})[_0x510d('0x32')](function(_0x1d2f2d){_0x172250=_0x1d2f2d;var _0xcb3fcf=_[_0x510d('0x4f')](db[_0x510d('0x69')]['rawAttributes']);return db[_0x510d('0x75')][_0x510d('0x65')]({'raw':!![],'attributes':['id',_0x510d('0x7c')]})[_0x510d('0x32')](function(_0x2aa5fd){_0x2fd668=_0x2aa5fd;var _0x19b28e=squel['select']()[_0x510d('0x42')](_0xcb3fcf)[_0x510d('0x7d')](_0x510d('0x7e'),'c')[_0x510d('0x48')](_0x510d('0x7f'),_0x5a57ac)[_0x510d('0x48')](_0x510d('0x80'))['distinct']();for(var _0x1c1f12=0x0;_0x1c1f12<_0x2fd668[_0x510d('0x51')];_0x1c1f12++){_0x19b28e[_0x510d('0x81')](_0x510d('0x82')+_0x2fd668[_0x1c1f12]['id'],_0x510d('0x83')+_0x2fd668[_0x1c1f12][_0x510d('0x7c')]);}for(var _0x1c1f12=0x0;_0x1c1f12<_0x172250[_0x510d('0x51')];_0x1c1f12++){_0x19b28e[_0x510d('0x81')](squel[_0x510d('0x84')]()['field']('item')[_0x510d('0x7d')](_0x510d('0x85'))[_0x510d('0x48')]('ItemTypeId\x20=\x20?',_0x172250[_0x1c1f12]['id'])[_0x510d('0x48')]('CmContactId\x20=\x20c.id'),_0x510d('0x86')+_0x172250[_0x1c1f12][_0x510d('0x3d')]);_0x19b28e['field'](squel[_0x510d('0x84')]()['field'](_0x510d('0x87'))[_0x510d('0x7d')](_0x510d('0x85'))[_0x510d('0x48')](_0x510d('0x88'),_0x172250[_0x1c1f12]['id'])['where']('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x172250[_0x1c1f12][_0x510d('0x3d')]);}var _0x42ffd8=[];_0x42ffd8['push'](_0x19b28e[_0x510d('0x89')]());BPromise[_0x510d('0x6e')](_0x42ffd8,handleQuery)[_0x510d('0x32')](function(_0x1ca286){handleQuery(_0x19b28e[_0x510d('0x89')]());var _0x43899c=csv_results[0x0];if(!_[_0x510d('0x8a')](_0x43899c)){var _0x53d427=toCsv(_0x43899c);var _0x2e81cf=Date[_0x510d('0x8b')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x5a57ac,_0x2e81cf),_0x53d427);_0x22379f[_0x510d('0x8c')](_0x510d('0x8d'),_0x510d('0x8e')+util[_0x510d('0x78')](_0x510d('0x8f'),_0x5a57ac,_0x2e81cf));_0x22379f['setHeader'](_0x510d('0x90'),_0x510d('0x91'));return _0x22379f[_0x510d('0x92')](util['format']('/tmp/list_%d_%s.csv',_0x5a57ac,_0x2e81cf));}else{return _0x22379f['sendStatus'](0xcc);}});});});};exports[_0x510d('0x93')]=function(_0x4c2ade,_0x21c53d,_0x670eac){var _0x2a2a6b;delete _0x4c2ade[_0x510d('0x5c')]['id'];return db[_0x510d('0x3a')]['findOne']({'where':{'id':_0x4c2ade[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x21c53d,null))[_0x510d('0x32')](function(_0x1e895d){if(_0x1e895d){return db[_0x510d('0x94')][_0x510d('0x95')](function(_0x155bd5){return db[_0x510d('0x75')][_0x510d('0x54')](_0x4c2ade[_0x510d('0x5c')],{'transaction':_0x155bd5})['then'](function(_0x4e9d00){_0x2a2a6b=_0x4e9d00;return _0x1e895d['addCustomFields'](_0x4e9d00,{'transaction':_0x155bd5});})['then'](function(){var _0xa7cc1d={'type':db[_0x510d('0x96')]['TEXT'],'transaction':_0x155bd5};switch(_0x4c2ade[_0x510d('0x5c')][_0x510d('0x3c')]){case _0x510d('0x97'):_0xa7cc1d['type']=db['Sequelize'][_0x510d('0x98')];break;case _0x510d('0x99'):_0xa7cc1d[_0x510d('0x3c')]=db[_0x510d('0x96')][_0x510d('0x9a')];break;case'switch':_0xa7cc1d[_0x510d('0x3c')]=db['Sequelize'][_0x510d('0x9b')];_0xa7cc1d[_0x510d('0x9c')]=![];break;default:}return db['sequelize'][_0x510d('0x9d')]['addColumn'](_0x510d('0x7e'),util[_0x510d('0x78')](_0x510d('0x9e'),_0x2a2a6b['id']),_0xa7cc1d);})[_0x510d('0x32')](function(){return _0x2a2a6b;});});}})[_0x510d('0x32')](respondWithResult(_0x21c53d,null))[_0x510d('0x4d')](handleError(_0x21c53d,null));};exports[_0x510d('0x9f')]=function(_0x374fdc,_0x52cd4c,_0x25298a){var _0x2b2d38={};var _0x11c9f8={};var _0x249d04;var _0x300139;return db[_0x510d('0x3a')][_0x510d('0x63')]({'where':{'id':_0x374fdc[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52cd4c,null))['then'](function(_0x398e71){if(_0x398e71){_0x249d04=_0x398e71;_0x11c9f8[_0x510d('0x41')]=_[_0x510d('0x4f')](db[_0x510d('0x75')]['rawAttributes']);_0x11c9f8['query']=_[_0x510d('0x4f')](_0x374fdc[_0x510d('0x3e')]);_0x11c9f8['filters']=_[_0x510d('0x40')](_0x11c9f8[_0x510d('0x41')],_0x11c9f8['query']);_0x2b2d38[_0x510d('0x43')]=_[_0x510d('0x40')](_0x11c9f8[_0x510d('0x41')],qs[_0x510d('0x42')](_0x374fdc['query']['fields']));_0x2b2d38[_0x510d('0x43')]=_0x2b2d38['attributes']['length']?_0x2b2d38['attributes']:_0x11c9f8[_0x510d('0x41')];_0x2b2d38['order']=qs[_0x510d('0x47')](_0x374fdc['query'][_0x510d('0x47')]);_0x2b2d38[_0x510d('0x48')]=qs[_0x510d('0x3f')](_[_0x510d('0x64')](_0x374fdc['query'],_0x11c9f8[_0x510d('0x3f')]));_0x2b2d38[_0x510d('0x48')]=_['merge'](_0x2b2d38[_0x510d('0x48')],{'$or':[{'ListId':_0x398e71['id']},{'ListId':null}]});if(_0x374fdc[_0x510d('0x3e')][_0x510d('0x4a')]){_0x2b2d38['where']=_['merge'](_0x2b2d38['where'],{'$or':_['map'](_0x2b2d38[_0x510d('0x43')],function(_0x294ab4){var _0x1b0d2c={};_0x1b0d2c[_0x294ab4]={'$like':'%'+_0x374fdc[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x1b0d2c;})});}_0x2b2d38=_[_0x510d('0x49')]({},_0x2b2d38,_0x374fdc[_0x510d('0x52')]);return db[_0x510d('0x75')][_0x510d('0xa0')](_0x2b2d38);}})[_0x510d('0x32')](respondWithResult(_0x52cd4c,null))[_0x510d('0x4d')](handleError(_0x52cd4c,null));};exports[_0x510d('0xa1')]=function(_0x1b6abe,_0x2acd88){return db[_0x510d('0x75')]['findAndCountAll']({'where':{'ListId':null}})[_0x510d('0x32')](handleEntityNotFound(_0x2acd88,null))[_0x510d('0x32')](function(_0x461c23){return _0x461c23;})['then'](respondWithResult(_0x2acd88,null))['catch'](handleError(_0x2acd88,null));};exports['addAgents']=function(_0x76e43,_0x34d8d3,_0x463952){return db['CmList'][_0x510d('0x53')]({'where':{'id':_0x76e43[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x34d8d3,null))[_0x510d('0x32')](function(_0x1b91dc){if(_0x1b91dc){return _0x1b91dc[_0x510d('0xa2')](_0x76e43[_0x510d('0x5c')]['ids'],_[_0x510d('0xa3')](_0x76e43['body'],[_0x510d('0x67'),'id'])||{})[_0x510d('0xa4')](function(_0x582cf6){for(var _0xd5c1af=0x0;_0xd5c1af<_0x76e43['body'][_0x510d('0x67')][_0x510d('0x51')];_0xd5c1af+=0x1){socket[_0x510d('0xa5')](_0x510d('0xa6'),{'UserId':Number(_0x76e43[_0x510d('0x5c')][_0x510d('0x67')][_0xd5c1af]),'CmListId':Number(_0x76e43['params']['id'])});}return _0x582cf6;});}})[_0x510d('0x32')](respondWithResult(_0x34d8d3,null))[_0x510d('0x4d')](handleError(_0x34d8d3,null));};exports[_0x510d('0xa7')]=function(_0x122ed1,_0x1abb13,_0x178b69){return db[_0x510d('0x3a')]['find']({'where':{'id':_0x122ed1[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x1abb13,null))[_0x510d('0x32')](function(_0x4954cf){if(_0x4954cf){return _0x4954cf[_0x510d('0xa7')](_0x122ed1[_0x510d('0x3e')][_0x510d('0x67')])[_0x510d('0x32')](function(){if(_[_0x510d('0x6b')](_0x122ed1['query']['ids'])){for(var _0x294b0a=0x0;_0x294b0a<_0x122ed1[_0x510d('0x3e')][_0x510d('0x67')][_0x510d('0x51')];_0x294b0a+=0x1){socket[_0x510d('0xa5')](_0x510d('0xa8'),{'UserId':Number(_0x122ed1[_0x510d('0x3e')][_0x510d('0x67')][_0x294b0a]),'CmListId':Number(_0x122ed1[_0x510d('0x5d')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x122ed1[_0x510d('0x3e')]['ids']),'CmListId':Number(_0x122ed1[_0x510d('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1abb13,null))['catch'](handleError(_0x1abb13,null));};exports[_0x510d('0xa9')]=function(_0x40c5cd,_0x247aca,_0x289848){var _0x48c2aa={};var _0xa2a594={};var _0x3101c4;var _0x73ab59;return db['CmList']['findOne']({'where':{'id':_0x40c5cd['params']['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x247aca,null))[_0x510d('0x32')](function(_0x3761ec){if(_0x3761ec){_0x3101c4=_0x3761ec;_0xa2a594[_0x510d('0x41')]=_[_0x510d('0x4f')](db[_0x510d('0xaa')][_0x510d('0x50')]);_0xa2a594['query']=_['keys'](_0x40c5cd[_0x510d('0x3e')]);_0xa2a594[_0x510d('0x3f')]=_[_0x510d('0x40')](_0xa2a594[_0x510d('0x41')],_0xa2a594[_0x510d('0x3e')]);_0x48c2aa[_0x510d('0x43')]=_['intersection'](_0xa2a594[_0x510d('0x41')],qs['fields'](_0x40c5cd[_0x510d('0x3e')][_0x510d('0x42')]));_0x48c2aa[_0x510d('0x43')]=_0x48c2aa[_0x510d('0x43')][_0x510d('0x51')]?_0x48c2aa['attributes']:_0xa2a594['model'];_0x48c2aa[_0x510d('0x46')]=qs['sort'](_0x40c5cd['query'][_0x510d('0x47')]);_0x48c2aa[_0x510d('0x48')]=qs['filters'](_[_0x510d('0x64')](_0x40c5cd['query'],_0xa2a594[_0x510d('0x3f')]));if(_0x40c5cd[_0x510d('0x3e')][_0x510d('0x4a')]){_0x48c2aa[_0x510d('0x48')]=_[_0x510d('0x49')](_0x48c2aa[_0x510d('0x48')],{'$or':_['map'](_0x48c2aa[_0x510d('0x43')],function(_0x4bb482){var _0x5739ad={};_0x5739ad[_0x4bb482]={'$like':'%'+_0x40c5cd[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x5739ad;})});}_0x48c2aa=_[_0x510d('0x49')]({},_0x48c2aa,_0x40c5cd[_0x510d('0x52')]);return _0x3101c4[_0x510d('0xa9')](_0x48c2aa);}})[_0x510d('0x32')](function(_0x16a674){if(_0x16a674){_0x73ab59=_0x16a674['length'];if(!_0x40c5cd['query'][_0x510d('0x44')]('nolimit')){_0x48c2aa[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x40c5cd[_0x510d('0x3e')]['limit']);_0x48c2aa[_0x510d('0x27')]=qs[_0x510d('0x27')](_0x40c5cd[_0x510d('0x3e')][_0x510d('0x27')]);}return _0x3101c4['getAgents'](_0x48c2aa);}})[_0x510d('0x32')](function(_0x3f251d){if(_0x3f251d){return _0x3f251d?{'count':_0x73ab59,'rows':_0x3f251d}:null;}})[_0x510d('0x32')](respondWithResult(_0x247aca,null))[_0x510d('0x4d')](handleError(_0x247aca,null));};function handleQuery(_0x2b1173){logger[_0x510d('0xab')](_0x2b1173);return db['sequelize'][_0x510d('0x3e')](_0x2b1173)[_0x510d('0xa4')](function(_0x51961b){csv_results['push'](_0x51961b);})[_0x510d('0x4d')](function(_0x19a57c){logger[_0x510d('0x5b')](_0x19a57c[_0x510d('0x72')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 49eaeda..e8bd7c7 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2adb42,_0xed8b12){var _0x101363=function(_0x1a9d3d){while(--_0x1a9d3d){_0x2adb42['push'](_0x2adb42['shift']());}};_0x101363(++_0xed8b12);}(_0x814b,0x1a2));var _0xb814=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0x814b[_0x4ede04];return _0x49ccfc;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1bbec1,_0x7e86d3){var _0x10ab97=function(_0xd461ca){while(--_0xd461ca){_0x1bbec1['push'](_0x1bbec1['shift']());}};_0x10ab97(++_0x7e86d3);}(_0x814b,0x1a2));var _0xb814=function(_0x34ecea,_0x3d11ce){_0x34ecea=_0x34ecea-0x0;var _0x44b6a8=_0x814b[_0x34ecea];return _0x44b6a8;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f9b798f..c2e00e5 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 _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x1ddbfd,_0x54c91){var _0xe1de14=function(_0x1f9173){while(--_0x1f9173){_0x1ddbfd['push'](_0x1ddbfd['shift']());}};_0xe1de14(++_0x54c91);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xcb91[_0x1ee351];return _0x245aaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0xdfdbec,_0x2c1cac){var _0x48810d=function(_0x5ef49c){while(--_0x5ef49c){_0xdfdbec['push'](_0xdfdbec['shift']());}};_0x48810d(++_0x2c1cac);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xaa88[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'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 3e78a44..c941593 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 _0x0505=['debug','CmList,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x2e34d1,_0x4b5343){var _0x3b7e29=function(_0x268aac){while(--_0x268aac){_0x2e34d1['push'](_0x2e34d1['shift']());}};_0x3b7e29(++_0x4b5343);}(_0x0505,0x13e));var _0x5050=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0505[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5050('0x0'));var util=require('util');var moment=require(_0x5050('0x1'));var BPromise=require(_0x5050('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5050('0x3'));var logger=require(_0x5050('0x4'))('rpc');var config=require(_0x5050('0x5'));var jayson=require(_0x5050('0x6'));var client=jayson['client'][_0x5050('0x7')]({'port':0x232a});config[_0x5050('0x8')]=_[_0x5050('0x9')](config[_0x5050('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5050('0xa'))(new Redis(config['redis']));require(_0x5050('0xb'))[_0x5050('0xc')](socket);function respondWithRpcPromise(_0xc58c59,_0x324596,_0x365f70){return new BPromise(function(_0x5bd235,_0x24a983){return client[_0x5050('0xd')](_0xc58c59,_0x365f70)[_0x5050('0xe')](function(_0x4d570b){logger[_0x5050('0xf')](_0x5050('0x10'),_0x324596,_0x5050('0x11'));logger[_0x5050('0x12')](_0x5050('0x13'),_0x324596,_0x5050('0x11'),JSON['stringify'](_0x4d570b));if(_0x4d570b['error']){if(_0x4d570b['error'][_0x5050('0x14')]===0x1f4){logger[_0x5050('0x15')](_0x5050('0x10'),_0x324596,_0x4d570b[_0x5050('0x15')]['message']);return _0x24a983(_0x4d570b[_0x5050('0x15')][_0x5050('0x16')]);}logger['error']('CmList,\x20%s,\x20%s',_0x324596,_0x4d570b[_0x5050('0x15')][_0x5050('0x16')]);return _0x5bd235(_0x4d570b['error'][_0x5050('0x16')]);}else{logger[_0x5050('0xf')](_0x5050('0x10'),_0x324596,'request\x20sent');_0x5bd235(_0x4d570b[_0x5050('0x17')][_0x5050('0x16')]);}})['catch'](function(_0x369de8){logger['error'](_0x5050('0x10'),_0x324596,_0x369de8);_0x24a983(_0x369de8);});});} \ No newline at end of file +var _0x5bd1=['../../config/environment','http','redis','localhost','./cmList.socket','register','request','then','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bd1,0x8f));var _0x15bd=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x5bd1[_0x1a21ff];return _0x25afc1;};'use strict';var _=require('lodash');var util=require(_0x15bd('0x0'));var moment=require(_0x15bd('0x1'));var BPromise=require(_0x15bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15bd('0x3'));var db=require(_0x15bd('0x4'))['db'];var utils=require(_0x15bd('0x5'));var logger=require('../../config/logger')(_0x15bd('0x6'));var config=require(_0x15bd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x15bd('0x8')]({'port':0x232a});config[_0x15bd('0x9')]=_['defaults'](config[_0x15bd('0x9')],{'host':_0x15bd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15bd('0x9')]));require(_0x15bd('0xb'))[_0x15bd('0xc')](socket);function respondWithRpcPromise(_0x1aa9a1,_0x4a861,_0x4bb206){return new BPromise(function(_0x742c07,_0x59ace3){return client[_0x15bd('0xd')](_0x1aa9a1,_0x4bb206)[_0x15bd('0xe')](function(_0x97e529){logger['info']('CmList,\x20%s,\x20%s',_0x4a861,_0x15bd('0xf'));logger[_0x15bd('0x10')](_0x15bd('0x11'),_0x4a861,_0x15bd('0xf'),JSON[_0x15bd('0x12')](_0x97e529));if(_0x97e529[_0x15bd('0x13')]){if(_0x97e529[_0x15bd('0x13')][_0x15bd('0x14')]===0x1f4){logger[_0x15bd('0x13')](_0x15bd('0x15'),_0x4a861,_0x97e529['error'][_0x15bd('0x16')]);return _0x59ace3(_0x97e529['error'][_0x15bd('0x16')]);}logger[_0x15bd('0x13')]('CmList,\x20%s,\x20%s',_0x4a861,_0x97e529[_0x15bd('0x13')][_0x15bd('0x16')]);return _0x742c07(_0x97e529[_0x15bd('0x13')]['message']);}else{logger[_0x15bd('0x17')]('CmList,\x20%s,\x20%s',_0x4a861,_0x15bd('0xf'));_0x742c07(_0x97e529[_0x15bd('0x18')]['message']);}})['catch'](function(_0x5183bf){logger[_0x15bd('0x13')](_0x15bd('0x15'),_0x4a861,_0x5183bf);_0x59ace3(_0x5183bf);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ac64ba4..5ffab3e 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 _0x69e7=['cmList:','./cmList.events','save','remove','update','emit','removeListener','register','length'];(function(_0x47d43d,_0x4b8abb){var _0x4c073d=function(_0x21f51b){while(--_0x21f51b){_0x47d43d['push'](_0x47d43d['shift']());}};_0x4c073d(++_0x4b8abb);}(_0x69e7,0x1b1));var _0x769e=function(_0x544a27,_0x5914ab){_0x544a27=_0x544a27-0x0;var _0x1eed0b=_0x69e7[_0x544a27];return _0x1eed0b;};'use strict';var CmListEvents=require(_0x769e('0x0'));var events=[_0x769e('0x1'),_0x769e('0x2'),_0x769e('0x3')];function createListener(_0x54532f,_0x3dff3c){return function(_0xe389c9){_0x3dff3c[_0x769e('0x4')](_0x54532f,_0xe389c9);};}function removeListener(_0x106af7,_0x325126){return function(){CmListEvents[_0x769e('0x5')](_0x106af7,_0x325126);};}exports[_0x769e('0x6')]=function(_0x5ffe25){for(var _0x25c82b=0x0,_0x27d82c=events[_0x769e('0x7')];_0x25c82b<_0x27d82c;_0x25c82b++){var _0x2ca3ba=events[_0x25c82b];var _0x54123f=createListener(_0x769e('0x8')+_0x2ca3ba,_0x5ffe25);CmListEvents['on'](_0x2ca3ba,_0x54123f);}}; \ No newline at end of file +var _0xcc4a=['register','length','save','emit','removeListener'];(function(_0x5662e0,_0x1839e8){var _0x282539=function(_0x58c3c6){while(--_0x58c3c6){_0x5662e0['push'](_0x5662e0['shift']());}};_0x282539(++_0x1839e8);}(_0xcc4a,0x101));var _0xacc4=function(_0xe18b68,_0x27b0db){_0xe18b68=_0xe18b68-0x0;var _0x44cf93=_0xcc4a[_0xe18b68];return _0x44cf93;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xacc4('0x0'),'remove','update'];function createListener(_0x3f55dc,_0x35ecb4){return function(_0x2c3991){_0x35ecb4[_0xacc4('0x1')](_0x3f55dc,_0x2c3991);};}function removeListener(_0x557fd7,_0x306b9e){return function(){CmListEvents[_0xacc4('0x2')](_0x557fd7,_0x306b9e);};}exports[_0xacc4('0x3')]=function(_0xa8bf4b){for(var _0x3be5b0=0x0,_0x34bcb8=events[_0xacc4('0x4')];_0x3be5b0<_0x34bcb8;_0x3be5b0++){var _0x10567a=events[_0x3be5b0];var _0x1bd592=createListener('cmList:'+_0x10567a,_0xa8bf4b);CmListEvents['on'](_0x10567a,_0x1bd592);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c26e2ed..c952be5 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 _0xcc7f=['create','addDisposition','addContacts','/:id/users','addAgents','put','update','delete','/:id','destroy','multer','express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc7f,0x1cc));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfcc7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfcc7('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfcc7('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfcc7('0x3'));var controller=require('./cmList.controller');router[_0xfcc7('0x4')]('/',auth['isAuthenticated'](),controller[_0xfcc7('0x5')]);router[_0xfcc7('0x4')](_0xfcc7('0x6'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x8')]);router[_0xfcc7('0x4')]('/global_fields',auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfcc7('0xa')]);router[_0xfcc7('0x4')](_0xfcc7('0xb'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0xc')]);router[_0xfcc7('0x4')](_0xfcc7('0xd'),auth[_0xfcc7('0x7')](),controller['getContacts']);router['get'](_0xfcc7('0xe'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0xf')]);router['get'](_0xfcc7('0x10'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x11')]);router[_0xfcc7('0x4')]('/:id/users',auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x12')]);router[_0xfcc7('0x13')]('/',auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x14')]);router[_0xfcc7('0x13')](_0xfcc7('0xb'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x15')]);router[_0xfcc7('0x13')]('/:id/contacts',auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x16')]);router[_0xfcc7('0x13')](_0xfcc7('0x10'),auth['isAuthenticated'](),controller['addCustomField']);router['post'](_0xfcc7('0x17'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x18')]);router[_0xfcc7('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xfcc7('0x1a')]);router[_0xfcc7('0x1b')](_0xfcc7('0x1c'),auth[_0xfcc7('0x7')](),controller[_0xfcc7('0x1d')]);router[_0xfcc7('0x1b')](_0xfcc7('0xb'),auth[_0xfcc7('0x7')](),controller['removeDispositions']);router['delete'](_0xfcc7('0x17'),auth[_0xfcc7('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xc368=['getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x309be5,_0x5d1a05){var _0x342c84=function(_0x36479b){while(--_0x36479b){_0x309be5['push'](_0x309be5['shift']());}};_0x342c84(++_0x5d1a05);}(_0xc368,0x7b));var _0x8c36=function(_0x1732e5,_0x346730){_0x1732e5=_0x1732e5-0x0;var _0x4ae6fd=_0xc368[_0x1732e5];return _0x4ae6fd;};'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'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['get'](_0x8c36('0xe'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xf')]);router[_0x8c36('0x8')](_0x8c36('0x10'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x11')]);router[_0x8c36('0x8')](_0x8c36('0x12'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x8')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller['getCustomFields']);router[_0x8c36('0x8')]('/:id/users',auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x16')]('/',auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);router[_0x8c36('0x16')](_0x8c36('0xe'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x18')]);router['post'](_0x8c36('0x10'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x19')]);router[_0x8c36('0x16')](_0x8c36('0x14'),auth['isAuthenticated'](),controller[_0x8c36('0x1a')]);router[_0x8c36('0x16')](_0x8c36('0x1b'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1c')]);router[_0x8c36('0x1d')](_0x8c36('0x1e'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1f')]);router[_0x8c36('0x20')](_0x8c36('0x1e'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x21')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x8c36('0x20')](_0x8c36('0x1b'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x22')]);module[_0x8c36('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6876d89..c41160f 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 _0x7a1c=['STRING','sequelize','exports','getDataValue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a1c,0x1e1));var _0xc7a1=function(_0x1d519f,_0x350501){_0x1d519f=_0x1d519f-0x0;var _0x5e0ae4=_0x7a1c[_0x1d519f];return _0x5e0ae4;};'use strict';var Sequelize=require(_0xc7a1('0x0'));module[_0xc7a1('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3bb8c0){return this[_0xc7a1('0x2')]('field');}},'field':{'type':Sequelize[_0xc7a1('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xc7a1('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xae45=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x4d873f,_0x2474af){var _0x2d8787=function(_0x30dc9d){while(--_0x30dc9d){_0x4d873f['push'](_0x4d873f['shift']());}};_0x2d8787(++_0x2474af);}(_0xae45,0x114));var _0x5ae4=function(_0x2715ae,_0x37f781){_0x2715ae=_0x2715ae-0x0;var _0x418007=_0xae45[_0x2715ae];return _0x418007;};'use strict';var Sequelize=require(_0x5ae4('0x0'));module[_0x5ae4('0x1')]={'name':{'type':Sequelize[_0x5ae4('0x2')],'get':function(_0x1ef758){return this[_0x5ae4('0x3')](_0x5ae4('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x5ae4('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x5ae4('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 16261b5..6f65bbf 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(_0x1ec931,_0x1b6f05){var _0x52ad70=function(_0x4846d8){while(--_0x4846d8){_0x1ec931['push'](_0x1ec931['shift']());}};_0x52ad70(++_0x1b6f05);}(_0x7a54,0x106));var _0x47a5=function(_0x5c2536,_0x339a60){_0x5c2536=_0x5c2536-0x0;var _0x2c4920=_0x7a54[_0x5c2536];return _0x2c4920;};'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(_0x5be4d7,_0x2fb537){var _0x1c5062=function(_0xfedff){while(--_0xfedff){_0x5be4d7['push'](_0x5be4d7['shift']());}};_0x1c5062(++_0x2fb537);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 f6aed7b..e980675 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 _0xd78c=['Condition','tools_conditions','lodash','util','api','bluebird','path','../../config/environment','./condition.attributes','exports','define'];(function(_0x40bad6,_0x1a5dc8){var _0xdfd3f2=function(_0x20f7ee){while(--_0x20f7ee){_0x40bad6['push'](_0x40bad6['shift']());}};_0xdfd3f2(++_0x1a5dc8);}(_0xd78c,0x7b));var _0xcd78=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd78c[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xcd78('0x0'));var util=require(_0xcd78('0x1'));var logger=require('../../config/logger')(_0xcd78('0x2'));var moment=require('moment');var BPromise=require(_0xcd78('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd78('0x4'));var rimraf=require('rimraf');var config=require(_0xcd78('0x5'));var attributes=require(_0xcd78('0x6'));module[_0xcd78('0x7')]=function(_0x41422e,_0x3ba357){return _0x41422e[_0xcd78('0x8')](_0xcd78('0x9'),attributes,{'tableName':_0xcd78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc584=['define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xc584,0x1d7));var _0x4c58=function(_0x7cf8eb,_0x5a470e){_0x7cf8eb=_0x7cf8eb-0x0;var _0x24e417=_0xc584[_0x7cf8eb];return _0x24e417;};'use strict';var _=require('lodash');var util=require(_0x4c58('0x0'));var logger=require(_0x4c58('0x1'))(_0x4c58('0x2'));var moment=require(_0x4c58('0x3'));var BPromise=require(_0x4c58('0x4'));var rp=require(_0x4c58('0x5'));var fs=require('fs');var path=require(_0x4c58('0x6'));var rimraf=require('rimraf');var config=require(_0x4c58('0x7'));var attributes=require(_0x4c58('0x8'));module['exports']=function(_0x346ce3,_0x5b9fc3){return _0x346ce3[_0x4c58('0x9')](_0x4c58('0xa'),attributes,{'tableName':_0x4c58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 5657a59..bbcad89 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 _0x8791=['error','message','info','result','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x152973,_0xb117d){var _0x28f073=function(_0x59be03){while(--_0x59be03){_0x152973['push'](_0x152973['shift']());}};_0x28f073(++_0xb117d);}(_0x8791,0x108));var _0x1879=function(_0x5b7e4f,_0x18fed7){_0x5b7e4f=_0x5b7e4f-0x0;var _0x4ade93=_0x8791[_0x5b7e4f];return _0x4ade93;};'use strict';var _=require(_0x1879('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1879('0x1'));var rs=require(_0x1879('0x2'));var fs=require('fs');var Redis=require(_0x1879('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1879('0x4'))(_0x1879('0x5'));var config=require('../../config/environment');var jayson=require(_0x1879('0x6'));var client=jayson[_0x1879('0x7')][_0x1879('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e340e,_0x5eab36,_0x23ab96){return new BPromise(function(_0x447735,_0x303b2d){return client[_0x1879('0x9')](_0x2e340e,_0x23ab96)[_0x1879('0xa')](function(_0x4403f4){logger['info'](_0x1879('0xb'),_0x5eab36,_0x1879('0xc'));logger[_0x1879('0xd')](_0x1879('0xe'),_0x5eab36,_0x1879('0xc'),JSON[_0x1879('0xf')](_0x4403f4));if(_0x4403f4[_0x1879('0x10')]){if(_0x4403f4[_0x1879('0x10')]['code']===0x1f4){logger[_0x1879('0x10')](_0x1879('0xb'),_0x5eab36,_0x4403f4[_0x1879('0x10')][_0x1879('0x11')]);return _0x303b2d(_0x4403f4[_0x1879('0x10')][_0x1879('0x11')]);}logger['error'](_0x1879('0xb'),_0x5eab36,_0x4403f4[_0x1879('0x10')]['message']);return _0x447735(_0x4403f4[_0x1879('0x10')][_0x1879('0x11')]);}else{logger[_0x1879('0x12')](_0x1879('0xb'),_0x5eab36,_0x1879('0xc'));_0x447735(_0x4403f4[_0x1879('0x13')]['message']);}})['catch'](function(_0x524cad){logger[_0x1879('0x10')](_0x1879('0xb'),_0x5eab36,_0x524cad);_0x303b2d(_0x524cad);});});} \ No newline at end of file +var _0x5e3d=['rpc','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x5e3d,0x19d));var _0xd5e3=function(_0x47519b,_0x323f18){_0x47519b=_0x47519b-0x0;var _0x44a600=_0x5e3d[_0x47519b];return _0x44a600;};'use strict';var _=require(_0xd5e3('0x0'));var util=require(_0xd5e3('0x1'));var moment=require(_0xd5e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5e3('0x3'));var fs=require('fs');var Redis=require(_0xd5e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5e3('0x5'));var logger=require(_0xd5e3('0x6'))(_0xd5e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xd5e3('0x8'));var client=jayson[_0xd5e3('0x9')][_0xd5e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494614,_0x17f2d4,_0xaf6a73){return new BPromise(function(_0x458037,_0x369f3c){return client['request'](_0x494614,_0xaf6a73)[_0xd5e3('0xb')](function(_0x28adcf){logger['info']('Condition,\x20%s,\x20%s',_0x17f2d4,_0xd5e3('0xc'));logger[_0xd5e3('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x17f2d4,_0xd5e3('0xc'),JSON[_0xd5e3('0xe')](_0x28adcf));if(_0x28adcf['error']){if(_0x28adcf[_0xd5e3('0xf')]['code']===0x1f4){logger[_0xd5e3('0xf')](_0xd5e3('0x10'),_0x17f2d4,_0x28adcf[_0xd5e3('0xf')][_0xd5e3('0x11')]);return _0x369f3c(_0x28adcf[_0xd5e3('0xf')][_0xd5e3('0x11')]);}logger[_0xd5e3('0xf')](_0xd5e3('0x10'),_0x17f2d4,_0x28adcf[_0xd5e3('0xf')]['message']);return _0x458037(_0x28adcf[_0xd5e3('0xf')]['message']);}else{logger[_0xd5e3('0x12')](_0xd5e3('0x10'),_0x17f2d4,'request\x20sent');_0x458037(_0x28adcf[_0xd5e3('0x13')][_0xd5e3('0x11')]);}})[_0xd5e3('0x14')](function(_0x38efbe){logger[_0xd5e3('0xf')](_0xd5e3('0x10'),_0x17f2d4,_0x38efbe);_0x369f3c(_0x38efbe);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index db6bfff..db39b51 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 _0x04a8=['express','../../components/auth/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4fc750,_0x71833a){var _0x3ff490=function(_0x57e4c1){while(--_0x57e4c1){_0x4fc750['push'](_0x4fc750['shift']());}};_0x3ff490(++_0x71833a);}(_0x04a8,0x128));var _0x804a=function(_0x2fa6d3,_0x991d77){_0x2fa6d3=_0x2fa6d3-0x0;var _0x9c9ce8=_0x04a8[_0x2fa6d3];return _0x9c9ce8;};'use strict';var multer=require(_0x804a('0x0'));var util=require(_0x804a('0x1'));var path=require('path');var timeout=require(_0x804a('0x2'));var express=require(_0x804a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x804a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x804a('0x5'));var controller=require(_0x804a('0x6'));router['put'](_0x804a('0x7'),auth[_0x804a('0x8')](),controller[_0x804a('0x9')]);router[_0x804a('0xa')](_0x804a('0x7'),auth[_0x804a('0x8')](),controller[_0x804a('0xb')]);module[_0x804a('0xc')]=router; \ No newline at end of file +var _0xed8b=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd9e5,_0x397369){var _0x129312=function(_0x21ce6d){while(--_0x21ce6d){_0x3dd9e5['push'](_0x3dd9e5['shift']());}};_0x129312(++_0x397369);}(_0xed8b,0x158));var _0xbed8=function(_0x254bb2,_0x31e8d1){_0x254bb2=_0x254bb2-0x0;var _0x590992=_0xed8b[_0x254bb2];return _0x590992;};'use strict';var multer=require(_0xbed8('0x0'));var util=require(_0xbed8('0x1'));var path=require(_0xbed8('0x2'));var timeout=require(_0xbed8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbed8('0x4'));var auth=require(_0xbed8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbed8('0x6'));var controller=require(_0xbed8('0x7'));router[_0xbed8('0x8')](_0xbed8('0x9'),auth[_0xbed8('0xa')](),controller[_0xbed8('0xb')]);router[_0xbed8('0xc')](_0xbed8('0x9'),auth[_0xbed8('0xa')](),controller['destroy']);module[_0xbed8('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1703e7e..c0d4dab 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd5f=['exports','STRING','INTEGER'];(function(_0x243b62,_0x3c86a9){var _0x4c268d=function(_0xaa5b26){while(--_0xaa5b26){_0x243b62['push'](_0x243b62['shift']());}};_0x4c268d(++_0x3c86a9);}(_0xdd5f,0xd5));var _0xfdd5=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xdd5f[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require('sequelize');module[_0xfdd5('0x0')]={'name':{'type':Sequelize[_0xfdd5('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xfdd5('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf6e8=['INTEGER','exports','STRING','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x4a2315,_0x23ca80){_0x4a2315=_0x4a2315-0x0;var _0x44133a=_0xf6e8[_0x4a2315];return _0x44133a;};'use strict';var Sequelize=require('sequelize');module[_0x8f6e('0x0')]={'name':{'type':Sequelize[_0x8f6e('0x1')],'allowNull':![],'unique':_0x8f6e('0x2')},'OrderBy':{'type':Sequelize[_0x8f6e('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8f6e('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 7d7e960..6a52a8d 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f2=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','ContactItemType','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xfc2d2b,_0x3d6dd9){var _0x483807=function(_0x22a5a0){while(--_0x22a5a0){_0xfc2d2b['push'](_0xfc2d2b['shift']());}};_0x483807(++_0x3d6dd9);}(_0x28f2,0x193));var _0x228f=function(_0x1de01b,_0xacbbbe){_0x1de01b=_0x1de01b-0x0;var _0x4402c8=_0x28f2[_0x1de01b];return _0x4402c8;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['ContactItemType'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':!![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x25')]=function(_0x561144,_0x3e9f76){if(_0x561144[_0x228f('0x4e')]['id']){delete _0x561144[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')]['find']({'where':{'id':_0x561144[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](saveUpdates(_0x561144[_0x228f('0x4e')],null))['then'](respondWithResult(_0x3e9f76,null))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports[_0x228f('0x27')]=function(_0x4b516e,_0x32787c){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x4b516e[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x32787c,null))[_0x228f('0x26')](db[_0x228f('0x54')][_0x228f('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4b516e[_0x228f('0x53')]['id']}}))[_0x228f('0x26')](removeEntity(_0x32787c,null))['catch'](handleError(_0x32787c,null));}; \ No newline at end of file +var _0xf61e=['sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','UserProfileResource','status','error','stack','name','send','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ContactItemType','includeAll','include','findAll','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xf61e,0x191));var _0xef61=function(_0x44cb0c,_0xe8b392){_0x44cb0c=_0x44cb0c-0x0;var _0x45e898=_0xf61e[_0x44cb0c];return _0x45e898;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){var _0x111bac=_0xfbee94['get']({'plain':!![]});var _0x16b144='ContactItemTypes';return db[_0xef61('0x29')][_0xef61('0x27')]({'where':{'type':_0x16b144,'resourceId':_0x111bac['id']}})[_0xef61('0x28')](function(){return _0xfbee94;});})[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x2a')](0xcc)[_0xef61('0x1e')]();});}};}function handleEntityNotFound(_0x258b5a,_0x23837f){return function(_0x297df7){if(!_0x297df7){_0x258b5a[_0xef61('0x1d')](0x194);}return _0x297df7;};}function handleError(_0x3a16ba,_0x18426f){_0x18426f=_0x18426f||0x1f4;return function(_0xeb9a62){logger[_0xef61('0x2b')](_0xeb9a62[_0xef61('0x2c')]);if(_0xeb9a62[_0xef61('0x2d')]){delete _0xeb9a62[_0xef61('0x2d')];}_0x3a16ba[_0xef61('0x2a')](_0x18426f)[_0xef61('0x2e')](_0xeb9a62);};}exports[_0xef61('0x2f')]=function(_0x43bc47,_0x53fa3b){var _0x4f35ad={},_0x51d5d1={},_0x38b522={'count':0x0,'rows':[]};var _0x36713e=_[_0xef61('0x30')](db['ContactItemType'][_0xef61('0x31')],function(_0x21d6f0){return{'name':_0x21d6f0['fieldName'],'type':_0x21d6f0[_0xef61('0x32')]['key']};});_0x51d5d1['model']=_[_0xef61('0x30')](_0x36713e,'name');_0x51d5d1[_0xef61('0x33')]=_['keys'](_0x43bc47[_0xef61('0x33')]);_0x51d5d1[_0xef61('0x34')]=_[_0xef61('0x35')](_0x51d5d1[_0xef61('0x36')],_0x51d5d1[_0xef61('0x33')]);_0x4f35ad[_0xef61('0x37')]=_[_0xef61('0x35')](_0x51d5d1[_0xef61('0x36')],qs[_0xef61('0x38')](_0x43bc47[_0xef61('0x33')]['fields']));_0x4f35ad[_0xef61('0x37')]=_0x4f35ad[_0xef61('0x37')][_0xef61('0x39')]?_0x4f35ad[_0xef61('0x37')]:_0x51d5d1[_0xef61('0x36')];if(!_0x43bc47['query'][_0xef61('0x3a')](_0xef61('0x3b'))){_0x4f35ad[_0xef61('0x23')]=qs['limit'](_0x43bc47['query']['limit']);_0x4f35ad[_0xef61('0x20')]=qs['offset'](_0x43bc47['query']['offset']);}_0x4f35ad[_0xef61('0x3c')]=qs[_0xef61('0x3d')](_0x43bc47[_0xef61('0x33')]['sort']);_0x4f35ad['where']=qs['filters'](_[_0xef61('0x3e')](_0x43bc47[_0xef61('0x33')],_0x51d5d1['filters']),_0x36713e);if(_0x43bc47[_0xef61('0x33')][_0xef61('0x3f')]){_0x4f35ad[_0xef61('0x40')]=_[_0xef61('0x41')](_0x4f35ad['where'],{'$or':_[_0xef61('0x30')](_0x36713e,function(_0x184063){if(_0x184063[_0xef61('0x32')]!==_0xef61('0x42')){var _0x54410d={};_0x54410d[_0x184063['name']]={'$like':'%'+_0x43bc47[_0xef61('0x33')][_0xef61('0x3f')]+'%'};return _0x54410d;}})});}_0x4f35ad=_[_0xef61('0x41')]({},_0x4f35ad,_0x43bc47['options']);var _0x3eee46={'where':_0x4f35ad[_0xef61('0x40')]};return db[_0xef61('0x43')][_0xef61('0x22')](_0x3eee46)['then'](function(_0x545597){_0x38b522['count']=_0x545597;if(_0x43bc47[_0xef61('0x33')][_0xef61('0x44')]){_0x4f35ad[_0xef61('0x45')]=[{'all':!![]}];}return db[_0xef61('0x43')][_0xef61('0x46')](_0x4f35ad);})[_0xef61('0x28')](function(_0xc9b467){_0x38b522['rows']=_0xc9b467;return _0x38b522;})[_0xef61('0x28')](respondWithFilteredResult(_0x53fa3b,_0x4f35ad))[_0xef61('0x47')](handleError(_0x53fa3b,null));};exports[_0xef61('0x48')]=function(_0x898c74,_0x51fac1){var _0x17279b={'raw':!![],'where':{'id':_0x898c74[_0xef61('0x49')]['id']}},_0x4686df={};_0x4686df[_0xef61('0x36')]=_[_0xef61('0x4a')](db[_0xef61('0x43')]['rawAttributes']);_0x4686df[_0xef61('0x33')]=_[_0xef61('0x4a')](_0x898c74[_0xef61('0x33')]);_0x4686df['filters']=_[_0xef61('0x35')](_0x4686df[_0xef61('0x36')],_0x4686df[_0xef61('0x33')]);_0x17279b[_0xef61('0x37')]=_[_0xef61('0x35')](_0x4686df[_0xef61('0x36')],qs['fields'](_0x898c74[_0xef61('0x33')][_0xef61('0x38')]));_0x17279b['attributes']=_0x17279b[_0xef61('0x37')][_0xef61('0x39')]?_0x17279b[_0xef61('0x37')]:_0x4686df[_0xef61('0x36')];if(_0x898c74['query'][_0xef61('0x44')]){_0x17279b[_0xef61('0x45')]=[{'all':!![]}];}_0x17279b=_[_0xef61('0x41')]({},_0x17279b,_0x898c74['options']);return db[_0xef61('0x43')][_0xef61('0x4b')](_0x17279b)['then'](handleEntityNotFound(_0x51fac1,null))[_0xef61('0x28')](respondWithResult(_0x51fac1,null))[_0xef61('0x47')](handleError(_0x51fac1,null));};exports[_0xef61('0x4c')]=function(_0x2904e0,_0x13bb20){return db[_0xef61('0x43')][_0xef61('0x4c')](_0x2904e0['body'],{})[_0xef61('0x28')](function(_0x505631){var _0x89c04e=_0x2904e0[_0xef61('0x4d')][_0xef61('0x4e')]({'plain':!![]});if(!_0x89c04e)throw new Error(_0xef61('0x4f'));if(_0x89c04e[_0xef61('0x50')]===_0xef61('0x4d')){var _0x3e23eb=_0x505631[_0xef61('0x4e')]({'plain':!![]});var _0x264877='ContactItemTypes';return db[_0xef61('0x51')][_0xef61('0x4b')]({'where':{'name':_0x264877,'userProfileId':_0x89c04e['userProfileId']},'raw':!![]})['then'](function(_0x122251){if(_0x122251&&_0x122251[_0xef61('0x52')]===0x0){return db['UserProfileResource'][_0xef61('0x4c')]({'name':_0x3e23eb['name'],'resourceId':_0x3e23eb['id'],'type':_0x122251[_0xef61('0x2d')],'sectionId':_0x122251['id']},{})[_0xef61('0x28')](function(){return _0x505631;});}else{return _0x505631;}})[_0xef61('0x47')](function(_0x2533f2){logger[_0xef61('0x2b')](_0xef61('0x53'),_0x2533f2);throw _0x2533f2;});}return _0x505631;})['then'](respondWithResult(_0x13bb20,0xc9))[_0xef61('0x47')](handleError(_0x13bb20,null));};exports[_0xef61('0x54')]=function(_0x5373f5,_0x29863d){if(_0x5373f5[_0xef61('0x55')]['id']){delete _0x5373f5['body']['id'];}return db['ContactItemType'][_0xef61('0x4b')]({'where':{'id':_0x5373f5['params']['id']}})['then'](handleEntityNotFound(_0x29863d,null))['then'](saveUpdates(_0x5373f5[_0xef61('0x55')],null))[_0xef61('0x28')](respondWithResult(_0x29863d,null))['catch'](handleError(_0x29863d,null));};exports[_0xef61('0x27')]=function(_0x1928a5,_0x34ae9d){return db[_0xef61('0x43')][_0xef61('0x4b')]({'where':{'id':_0x1928a5[_0xef61('0x49')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x34ae9d,null))[_0xef61('0x28')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1928a5[_0xef61('0x49')]['id']}}))[_0xef61('0x28')](removeEntity(_0x34ae9d,null))[_0xef61('0x47')](handleError(_0x34ae9d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index b00c556..6f5ba1a 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5da=['tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ContactItemType'];(function(_0x17ca8d,_0x3eb435){var _0x3cf7b2=function(_0x2ff855){while(--_0x2ff855){_0x17ca8d['push'](_0x17ca8d['shift']());}};_0x3cf7b2(++_0x3eb435);}(_0xb5da,0x1a5));var _0xab5d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb5da[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xab5d('0x0'));var util=require(_0xab5d('0x1'));var logger=require(_0xab5d('0x2'))(_0xab5d('0x3'));var moment=require(_0xab5d('0x4'));var BPromise=require(_0xab5d('0x5'));var rp=require(_0xab5d('0x6'));var fs=require('fs');var path=require(_0xab5d('0x7'));var rimraf=require(_0xab5d('0x8'));var config=require(_0xab5d('0x9'));var attributes=require('./contactItemType.attributes');module[_0xab5d('0xa')]=function(_0x105af8,_0x551abd){return _0x105af8[_0xab5d('0xb')](_0xab5d('0xc'),attributes,{'tableName':_0xab5d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf600=['../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x59fb63,_0x5971bc){var _0x14b080=function(_0x4ec9fb){while(--_0x4ec9fb){_0x59fb63['push'](_0x59fb63['shift']());}};_0x14b080(++_0x5971bc);}(_0xf600,0x1a9));var _0x0f60=function(_0x34a8dd,_0x477c58){_0x34a8dd=_0x34a8dd-0x0;var _0x53da09=_0xf600[_0x34a8dd];return _0x53da09;};'use strict';var _=require(_0x0f60('0x0'));var util=require(_0x0f60('0x1'));var logger=require(_0x0f60('0x2'))(_0x0f60('0x3'));var moment=require('moment');var BPromise=require(_0x0f60('0x4'));var rp=require(_0x0f60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f60('0x6'));var config=require(_0x0f60('0x7'));var attributes=require(_0x0f60('0x8'));module[_0x0f60('0x9')]=function(_0x5ca1f2,_0x13a637){return _0x5ca1f2[_0x0f60('0xa')]('ContactItemType',attributes,{'tableName':_0x0f60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 2897983..2a809ef 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7497=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var moment=require(_0x7749('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7749('0x3'))['db'];var utils=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var jayson=require(_0x7749('0x7'));var client=jayson[_0x7749('0x8')][_0x7749('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29f84f,_0x37d7b9,_0x344fa8){return new BPromise(function(_0x38dd37,_0x3efd35){return client[_0x7749('0xa')](_0x29f84f,_0x344fa8)['then'](function(_0xb58b29){logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));logger[_0x7749('0xd')](_0x7749('0xe'),_0x37d7b9,_0x7749('0xc'),JSON[_0x7749('0xf')](_0xb58b29));if(_0xb58b29[_0x7749('0x10')]){if(_0xb58b29[_0x7749('0x10')][_0x7749('0x11')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x37d7b9,_0xb58b29[_0x7749('0x10')]['message']);return _0x3efd35(_0xb58b29['error'][_0x7749('0x12')]);}logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0xb58b29[_0x7749('0x10')][_0x7749('0x12')]);return _0x38dd37(_0xb58b29[_0x7749('0x10')]['message']);}else{logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));_0x38dd37(_0xb58b29['result'][_0x7749('0x12')]);}})[_0x7749('0x13')](function(_0x42c942){logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0x42c942);_0x3efd35(_0x42c942);});});} \ No newline at end of file +var _0x4e37=['ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4e37,0xd8));var _0x74e3=function(_0x360516,_0x4417e9){_0x360516=_0x360516-0x0;var _0x39df49=_0x4e37[_0x360516];return _0x39df49;};'use strict';var _=require(_0x74e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74e3('0x1'));var fs=require('fs');var Redis=require(_0x74e3('0x2'));var db=require(_0x74e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74e3('0x4'))(_0x74e3('0x5'));var config=require(_0x74e3('0x6'));var jayson=require(_0x74e3('0x7'));var client=jayson[_0x74e3('0x8')][_0x74e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ef4a5,_0x5df674,_0x24d08e){return new BPromise(function(_0x2f4e37,_0x5518a9){return client['request'](_0x4ef4a5,_0x24d08e)[_0x74e3('0xa')](function(_0x57453d){logger[_0x74e3('0xb')](_0x74e3('0xc'),_0x5df674,'request\x20sent');logger['debug'](_0x74e3('0xd'),_0x5df674,_0x74e3('0xe'),JSON[_0x74e3('0xf')](_0x57453d));if(_0x57453d['error']){if(_0x57453d['error']['code']===0x1f4){logger['error'](_0x74e3('0xc'),_0x5df674,_0x57453d[_0x74e3('0x10')][_0x74e3('0x11')]);return _0x5518a9(_0x57453d[_0x74e3('0x10')][_0x74e3('0x11')]);}logger['error'](_0x74e3('0xc'),_0x5df674,_0x57453d[_0x74e3('0x10')][_0x74e3('0x11')]);return _0x2f4e37(_0x57453d[_0x74e3('0x10')]['message']);}else{logger[_0x74e3('0xb')]('ContactItemType,\x20%s,\x20%s',_0x5df674,_0x74e3('0xe'));_0x2f4e37(_0x57453d[_0x74e3('0x12')][_0x74e3('0x11')]);}})['catch'](function(_0x1867b9){logger[_0x74e3('0x10')](_0x74e3('0xc'),_0x5df674,_0x1867b9);_0x5518a9(_0x1867b9);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 33a7cdd..a77a77c 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x495b=['show','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x495b,0xa9));var _0xb495=function(_0x383e42,_0x28d9df){_0x383e42=_0x383e42-0x0;var _0x17163c=_0x495b[_0x383e42];return _0x17163c;};'use strict';var multer=require(_0xb495('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb495('0x1'));var router=express[_0xb495('0x2')]();var fs_extra=require(_0xb495('0x3'));var auth=require(_0xb495('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb495('0x5'));var controller=require(_0xb495('0x6'));router[_0xb495('0x7')]('/',auth[_0xb495('0x8')](),controller[_0xb495('0x9')]);router[_0xb495('0x7')](_0xb495('0xa'),auth[_0xb495('0x8')](),controller[_0xb495('0xb')]);router['post']('/',auth[_0xb495('0x8')](),controller[_0xb495('0xc')]);router[_0xb495('0xd')](_0xb495('0xa'),auth[_0xb495('0x8')](),controller[_0xb495('0xe')]);router[_0xb495('0xf')](_0xb495('0xa'),auth[_0xb495('0x8')](),controller[_0xb495('0x10')]);module[_0xb495('0x11')]=router; \ No newline at end of file +var _0xa83f=['isAuthenticated','show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3ba16c,_0x3d0502){var _0x32c463=function(_0x52be69){while(--_0x52be69){_0x3ba16c['push'](_0x3ba16c['shift']());}};_0x32c463(++_0x3d0502);}(_0xa83f,0xf8));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfa83('0x0'));var util=require('util');var path=require(_0xfa83('0x1'));var timeout=require(_0xfa83('0x2'));var express=require(_0xfa83('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa83('0x4'));var interaction=require(_0xfa83('0x5'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xfa83('0x6')]('/',auth[_0xfa83('0x7')](),controller['index']);router[_0xfa83('0x6')]('/:id',auth[_0xfa83('0x7')](),controller[_0xfa83('0x8')]);router[_0xfa83('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa83('0xa')](_0xfa83('0xb'),auth['isAuthenticated'](),controller[_0xfa83('0xc')]);router[_0xfa83('0xd')]('/:id',auth[_0xfa83('0x7')](),controller['destroy']);module[_0xfa83('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 41b4c3b..fb03268 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x5e3606,_0x3a15e9){var _0x31bc08=function(_0x3264af){while(--_0x3264af){_0x5e3606['push'](_0x5e3606['shift']());}};_0x31bc08(++_0x3a15e9);}(_0x757a,0xde));var _0xa757=function(_0x321c68,_0x4459ea){_0x321c68=_0x321c68-0x0;var _0x36cd52=_0x757a[_0x321c68];return _0x36cd52;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index dba5781..d1a83ef 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 _0x166b=['attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie2','attrSerie3','attrChannel','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','then','destroy','CustomDashboards','UserProfileResource','sendStatus','error','name','send','map','Dashboard','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe'];(function(_0x544811,_0x53c220){var _0x2efbac=function(_0x612676){while(--_0x612676){_0x544811['push'](_0x544811['shift']());}};_0x2efbac(++_0x53c220);}(_0x166b,0x1ae));var _0xb166=function(_0x31377e,_0x4c41e7){_0x31377e=_0x31377e-0x0;var _0x3c2ae2=_0x166b[_0x31377e];return _0x3c2ae2;};'use strict';var emlformat=require(_0xb166('0x0'));var rimraf=require(_0xb166('0x1'));var zipdir=require(_0xb166('0x2'));var jsonpatch=require(_0xb166('0x3'));var rp=require(_0xb166('0x4'));var moment=require(_0xb166('0x5'));var BPromise=require(_0xb166('0x6'));var Mustache=require(_0xb166('0x7'));var util=require(_0xb166('0x8'));var path=require(_0xb166('0x9'));var sox=require(_0xb166('0xa'));var csv=require(_0xb166('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb166('0xc'));var _=require(_0xb166('0xd'));var squel=require('squel');var crypto=require(_0xb166('0xe'));var jsforce=require(_0xb166('0xf'));var deskjs=require(_0xb166('0x10'));var toCsv=require(_0xb166('0xb'));var querystring=require(_0xb166('0x11'));var Papa=require(_0xb166('0x12'));var Redis=require(_0xb166('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb166('0x14'));var as=require(_0xb166('0x15'));var hardwareService=require(_0xb166('0x16'));var logger=require(_0xb166('0x17'))('api');var utils=require(_0xb166('0x18'));var config=require(_0xb166('0x19'));var licenseUtil=require(_0xb166('0x1a'));var db=require(_0xb166('0x1b'))['db'];config['redis']=_[_0xb166('0x1c')](config['redis'],{'host':_0xb166('0x1d'),'port':0x18eb});var socket=require(_0xb166('0x1e'))(new Redis(config[_0xb166('0x1f')]));require(_0xb166('0x20'))['register'](socket);function respondWithStatusCode(_0x45cbec,_0x438e2c){_0x438e2c=_0x438e2c||0xcc;return function(_0x6b3c82){if(_0x6b3c82){return _0x45cbec['sendStatus'](_0x438e2c);}return _0x45cbec['status'](_0x438e2c)[_0xb166('0x21')]();};}function respondWithResult(_0x1ac114,_0x3d4ce6){_0x3d4ce6=_0x3d4ce6||0xc8;return function(_0x13d946){if(_0x13d946){return _0x1ac114['status'](_0x3d4ce6)[_0xb166('0x22')](_0x13d946);}};}function respondWithFilteredResult(_0x209c7b,_0x1bb445){return function(_0x55fabf){if(_0x55fabf){var _0x216d37=typeof _0x1bb445[_0xb166('0x23')]==='undefined'&&typeof _0x1bb445[_0xb166('0x24')]===_0xb166('0x25');var _0xf0271e=_0x55fabf[_0xb166('0x26')];var _0x4b9ea1=_0x216d37?0x0:_0x1bb445[_0xb166('0x23')];var _0x33ba01=_0x216d37?_0x55fabf[_0xb166('0x26')]:_0x1bb445['offset']+_0x1bb445['limit'];var _0x1ac7d5;if(_0x33ba01>=_0xf0271e){_0x33ba01=_0xf0271e;_0x1ac7d5=0xc8;}else{_0x1ac7d5=0xce;}_0x209c7b[_0xb166('0x27')](_0x1ac7d5);return _0x209c7b['set'](_0xb166('0x28'),_0x4b9ea1+'-'+_0x33ba01+'/'+_0xf0271e)[_0xb166('0x22')](_0x55fabf);}return null;};}function patchUpdates(_0x2abf21){return function(_0x246e33){try{jsonpatch[_0xb166('0x29')](_0x246e33,_0x2abf21,!![]);}catch(_0x396db1){return BPromise[_0xb166('0x2a')](_0x396db1);}return _0x246e33[_0xb166('0x2b')]();};}function saveUpdates(_0x3e016e,_0x215460){return function(_0x2f6291){if(_0x2f6291){return _0x2f6291['update'](_0x3e016e)[_0xb166('0x2c')](function(_0x1ddcb8){return _0x1ddcb8;});}return null;};}function removeEntity(_0xffbf13,_0x2598fc){return function(_0x17d413){if(_0x17d413){return _0x17d413[_0xb166('0x2d')]()['then'](function(){var _0x99036d=_0x17d413['get']({'plain':!![]});var _0xd61128=_0xb166('0x2e');return db[_0xb166('0x2f')]['destroy']({'where':{'type':_0xd61128,'resourceId':_0x99036d['id']}})[_0xb166('0x2c')](function(){return _0x17d413;});})[_0xb166('0x2c')](function(){_0xffbf13[_0xb166('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6afc,_0x32cb14){return function(_0x3b962a){if(!_0x3b962a){_0x1e6afc[_0xb166('0x30')](0x194);}return _0x3b962a;};}function handleError(_0x509a59,_0x195818){_0x195818=_0x195818||0x1f4;return function(_0x4a644f){logger[_0xb166('0x31')](_0x4a644f['stack']);if(_0x4a644f[_0xb166('0x32')]){delete _0x4a644f[_0xb166('0x32')];}_0x509a59[_0xb166('0x27')](_0x195818)[_0xb166('0x33')](_0x4a644f);};}exports['index']=function(_0x323cab,_0x27258b){var _0x1cf6f7={},_0x2279bf={},_0x30eb18={'count':0x0,'rows':[]};var _0x3bb2c7=_[_0xb166('0x34')](db[_0xb166('0x35')][_0xb166('0x36')],function(_0x4aaaa8){return{'name':_0x4aaaa8[_0xb166('0x37')],'type':_0x4aaaa8['type']['key']};});_0x2279bf['model']=_[_0xb166('0x34')](_0x3bb2c7,'name');_0x2279bf[_0xb166('0x38')]=_[_0xb166('0x39')](_0x323cab['query']);_0x2279bf['filters']=_[_0xb166('0x3a')](_0x2279bf[_0xb166('0x3b')],_0x2279bf[_0xb166('0x38')]);_0x1cf6f7[_0xb166('0x3c')]=_[_0xb166('0x3a')](_0x2279bf['model'],qs[_0xb166('0x3d')](_0x323cab['query']['fields']));_0x1cf6f7['attributes']=_0x1cf6f7[_0xb166('0x3c')][_0xb166('0x3e')]?_0x1cf6f7[_0xb166('0x3c')]:_0x2279bf[_0xb166('0x3b')];if(!_0x323cab['query'][_0xb166('0x3f')](_0xb166('0x40'))){_0x1cf6f7['limit']=qs[_0xb166('0x24')](_0x323cab[_0xb166('0x38')][_0xb166('0x24')]);_0x1cf6f7['offset']=qs[_0xb166('0x23')](_0x323cab[_0xb166('0x38')][_0xb166('0x23')]);}_0x1cf6f7[_0xb166('0x41')]=qs[_0xb166('0x42')](_0x323cab[_0xb166('0x38')][_0xb166('0x42')]);_0x1cf6f7[_0xb166('0x43')]=qs[_0xb166('0x44')](_[_0xb166('0x45')](_0x323cab[_0xb166('0x38')],_0x2279bf[_0xb166('0x44')]),_0x3bb2c7);if(_0x323cab[_0xb166('0x38')][_0xb166('0x46')]){_0x1cf6f7['where']=_[_0xb166('0x47')](_0x1cf6f7[_0xb166('0x43')],{'$or':_['map'](_0x3bb2c7,function(_0x412c76){if(_0x412c76[_0xb166('0x48')]!==_0xb166('0x49')){var _0x1bd60e={};_0x1bd60e[_0x412c76[_0xb166('0x32')]]={'$like':'%'+_0x323cab[_0xb166('0x38')][_0xb166('0x46')]+'%'};return _0x1bd60e;}})});}_0x1cf6f7=_[_0xb166('0x47')]({},_0x1cf6f7,_0x323cab[_0xb166('0x4a')]);var _0x4ff406={'where':_0x1cf6f7[_0xb166('0x43')]};return db[_0xb166('0x35')][_0xb166('0x26')](_0x4ff406)[_0xb166('0x2c')](function(_0x3a3bb1){_0x30eb18['count']=_0x3a3bb1;if(_0x323cab[_0xb166('0x38')][_0xb166('0x4b')]){_0x1cf6f7[_0xb166('0x4c')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x1cf6f7);})[_0xb166('0x2c')](function(_0x3e8472){_0x30eb18[_0xb166('0x4d')]=_0x3e8472;return _0x30eb18;})['then'](respondWithFilteredResult(_0x27258b,_0x1cf6f7))[_0xb166('0x4e')](handleError(_0x27258b,null));};exports[_0xb166('0x4f')]=function(_0xed0ee1,_0x393857){var _0x35fcdd={'raw':![],'where':{'id':_0xed0ee1[_0xb166('0x50')]['id']}},_0x31583c={};_0x31583c['model']=_[_0xb166('0x39')](db[_0xb166('0x35')][_0xb166('0x36')]);_0x31583c['query']=_[_0xb166('0x39')](_0xed0ee1[_0xb166('0x38')]);_0x31583c[_0xb166('0x44')]=_[_0xb166('0x3a')](_0x31583c[_0xb166('0x3b')],_0x31583c['query']);_0x35fcdd[_0xb166('0x3c')]=_['intersection'](_0x31583c[_0xb166('0x3b')],qs[_0xb166('0x3d')](_0xed0ee1[_0xb166('0x38')][_0xb166('0x3d')]));_0x35fcdd[_0xb166('0x3c')]=_0x35fcdd[_0xb166('0x3c')]['length']?_0x35fcdd[_0xb166('0x3c')]:_0x31583c[_0xb166('0x3b')];if(_0xed0ee1['query']['includeAll']){_0x35fcdd[_0xb166('0x4c')]=[{'all':!![]}];}_0x35fcdd=_['merge']({},_0x35fcdd,_0xed0ee1['options']);return db[_0xb166('0x35')][_0xb166('0x51')](_0x35fcdd)[_0xb166('0x2c')](handleEntityNotFound(_0x393857,null))['then'](respondWithResult(_0x393857,null))['catch'](handleError(_0x393857,null));};exports[_0xb166('0x52')]=function(_0x24ed8d,_0x31d1a7){return db['Dashboard'][_0xb166('0x52')](_0x24ed8d['body'],{})[_0xb166('0x2c')](function(_0x1d3c62){var _0x54afa1=_0x24ed8d[_0xb166('0x53')]['get']({'plain':!![]});if(!_0x54afa1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54afa1[_0xb166('0x54')]==='user'){var _0x84f624=_0x1d3c62[_0xb166('0x55')]({'plain':!![]});var _0x2ae052=_0xb166('0x2e');return db[_0xb166('0x56')][_0xb166('0x51')]({'where':{'name':_0x2ae052,'userProfileId':_0x54afa1[_0xb166('0x57')]},'raw':!![]})['then'](function(_0x4d4795){if(_0x4d4795&&_0x4d4795[_0xb166('0x58')]===0x0){return db[_0xb166('0x2f')][_0xb166('0x52')]({'name':_0x84f624['name'],'resourceId':_0x84f624['id'],'type':_0x4d4795[_0xb166('0x32')],'sectionId':_0x4d4795['id']},{})[_0xb166('0x2c')](function(){return _0x1d3c62;});}else{return _0x1d3c62;}})[_0xb166('0x4e')](function(_0x17884f){logger[_0xb166('0x31')](_0xb166('0x59'),_0x17884f);throw _0x17884f;});}return _0x1d3c62;})['then'](respondWithResult(_0x31d1a7,0xc9))[_0xb166('0x4e')](handleError(_0x31d1a7,null));};exports[_0xb166('0x5a')]=function(_0x52471f,_0x422c37){var _0x1aaa24={'where':{'id':_0x52471f[_0xb166('0x50')]['id']}},_0x354511={};_0x354511['model']=_['keys'](db[_0xb166('0x35')][_0xb166('0x36')]);_0x1aaa24[_0xb166('0x3c')]=_[_0xb166('0x3a')](_0x354511[_0xb166('0x3b')],qs[_0xb166('0x3d')](_0x52471f[_0xb166('0x38')][_0xb166('0x3d')]));_0x1aaa24[_0xb166('0x3c')]=_0x1aaa24[_0xb166('0x3c')][_0xb166('0x3e')]?_0x1aaa24['attributes']:_0x354511[_0xb166('0x3b')];if(_0x52471f['query'][_0xb166('0x4b')]){_0x1aaa24['include']=[{'all':!![]}];}_0x1aaa24=_[_0xb166('0x47')]({},_0x1aaa24,_0x52471f[_0xb166('0x4a')]);return db[_0xb166('0x35')][_0xb166('0x51')](_0x1aaa24)[_0xb166('0x2c')](handleEntityNotFound(_0x422c37,null))['then'](function(_0x3e8f1a){if(_0x3e8f1a){var _0x1e2f6e=_0x3e8f1a[_0xb166('0x55')]({'plain':!![]});_0x1e2f6e=qs[_0xb166('0x5b')](_0x1e2f6e,['id',_0xb166('0x5c'),_0xb166('0x5d')]);_0x52471f[_0xb166('0x5e')]=_[_0xb166('0x5b')](_0x52471f[_0xb166('0x5e')],['id','createdAt',_0xb166('0x5d')]);return db[_0xb166('0x35')][_0xb166('0x52')](_[_0xb166('0x47')](_0x1e2f6e,_0x52471f[_0xb166('0x5e')]),{'include':_0x52471f[_0xb166('0x38')][_0xb166('0x4b')]?[{'all':!![]}]:undefined})[_0xb166('0x2c')](function(_0x12fb23){var _0x2d4646=_0x52471f['user']['get']({'plain':!![]});if(!_0x2d4646)throw new Error(_0xb166('0x5f'));if(_0x2d4646[_0xb166('0x54')]===_0xb166('0x53')){var _0x34630b=_0x12fb23[_0xb166('0x55')]({'plain':!![]});var _0x5f0190=_0xb166('0x2e');return db['UserProfileSection'][_0xb166('0x51')]({'where':{'name':_0x5f0190,'userProfileId':_0x2d4646[_0xb166('0x57')]},'raw':!![]})[_0xb166('0x2c')](function(_0x32ec11){if(_0x32ec11&&_0x32ec11[_0xb166('0x58')]===0x0){return db[_0xb166('0x2f')][_0xb166('0x52')]({'name':_0x34630b[_0xb166('0x32')],'resourceId':_0x34630b['id'],'type':_0x32ec11['name'],'sectionId':_0x32ec11['id']},{})[_0xb166('0x2c')](function(){return _0x12fb23;});}else{return _0x12fb23;}})[_0xb166('0x4e')](function(_0x3308cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3308cf);throw _0x3308cf;});}return _0x12fb23;});}})[_0xb166('0x2c')](respondWithResult(_0x422c37,0xc9))[_0xb166('0x4e')](handleError(_0x422c37,null));};exports[_0xb166('0x60')]=function(_0x2352c8,_0x4a8a13){if(_0x2352c8[_0xb166('0x5e')]['id']){delete _0x2352c8['body']['id'];}return db[_0xb166('0x35')][_0xb166('0x51')]({'where':{'id':_0x2352c8[_0xb166('0x50')]['id']}})[_0xb166('0x2c')](handleEntityNotFound(_0x4a8a13,null))[_0xb166('0x2c')](saveUpdates(_0x2352c8[_0xb166('0x5e')],null))[_0xb166('0x2c')](respondWithResult(_0x4a8a13,null))[_0xb166('0x4e')](handleError(_0x4a8a13,null));};exports[_0xb166('0x2d')]=function(_0x29e77c,_0x403296){return db['Dashboard'][_0xb166('0x51')]({'where':{'id':_0x29e77c[_0xb166('0x50')]['id']}})['then'](handleEntityNotFound(_0x403296,null))[_0xb166('0x2c')](removeEntity(_0x403296,null))['catch'](handleError(_0x403296,null));};function widgetAttributes(_0x2ed987){try{switch(_0x2ed987[_0xb166('0x48')]){case _0xb166('0x61'):return[{'name':_0xb166('0x62'),'value':_0x2ed987[_0xb166('0x62')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x0]?_0x2ed987['attrs'][0x0][_0xb166('0x64')]:undefined)||_0xb166('0x65')}];case _0xb166('0x66'):return[{'name':_0xb166('0x67'),'value':_0x2ed987['attrPath']||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x0]?_0x2ed987[_0xb166('0x63')][0x0][_0xb166('0x64')]:undefined)||''}];case _0xb166('0x68'):return[{'name':_0xb166('0x69'),'value':_0x2ed987['attrHourFormat']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x0]?_0x2ed987[_0xb166('0x63')][0x0]['value']:undefined)||_0xb166('0x6a')},{'name':_0xb166('0x6b'),'value':_0x2ed987['attrTimezone']||(_0x2ed987['attrs']&&_0x2ed987['attrs'][0x1]?_0x2ed987[_0xb166('0x63')][0x1][_0xb166('0x64')]:undefined)||'0.00'},{'name':_0xb166('0x6c'),'value':_0x2ed987[_0xb166('0x6c')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x2]?_0x2ed987[_0xb166('0x63')][0x2][_0xb166('0x64')]:undefined)||0xc}];case _0xb166('0x6d'):return[{'name':'attrMetric','value':_0x2ed987[_0xb166('0x6e')]||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x0]?_0x2ed987['attrs'][0x0][_0xb166('0x64')]:undefined)||_0xb166('0x6f')},{'name':_0xb166('0x70'),'value':_0x2ed987[_0xb166('0x70')]||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x1]?_0x2ed987[_0xb166('0x63')][0x1][_0xb166('0x64')]:undefined)||[]},{'name':_0xb166('0x6c'),'value':_0x2ed987[_0xb166('0x6c')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x2]?_0x2ed987[_0xb166('0x63')][0x2][_0xb166('0x64')]:undefined)||0x14},{'name':'attrChannel','value':_0x2ed987['attrChannel']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x3]?_0x2ed987['attrs'][0x3][_0xb166('0x64')]:undefined)||_0xb166('0x71')},{'name':_0xb166('0x72'),'value':_0x2ed987[_0xb166('0x72')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x4]?_0x2ed987['attrs'][0x4][_0xb166('0x64')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2ed987[_0xb166('0x73')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x5]?_0x2ed987[_0xb166('0x63')][0x5][_0xb166('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2ed987[_0xb166('0x74')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x6]?_0x2ed987[_0xb166('0x63')][0x6][_0xb166('0x64')]:undefined)||''},{'name':_0xb166('0x75'),'value':_0x2ed987['attrOpenchannelAccounts']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x7]?_0x2ed987['attrs'][0x7][_0xb166('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ed987[_0xb166('0x76')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x8]?_0x2ed987[_0xb166('0x63')][0x8][_0xb166('0x64')]:undefined)||''},{'name':_0xb166('0x77'),'value':_0x2ed987['attrChatWebsites']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x9]?_0x2ed987[_0xb166('0x63')][0x9][_0xb166('0x64')]:undefined)||''}];case'multibar-chart':case _0xb166('0x78'):return[{'name':'attrSerie1','value':_0x2ed987['attrSerie1']||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x0]?_0x2ed987[_0xb166('0x63')][0x0][_0xb166('0x64')]:undefined)||_0xb166('0x6f')},{'name':_0xb166('0x79'),'value':_0x2ed987[_0xb166('0x79')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x1]?_0x2ed987[_0xb166('0x63')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2ed987[_0xb166('0x7a')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x2]?_0x2ed987[_0xb166('0x63')][0x2][_0xb166('0x64')]:undefined)||null},{'name':_0xb166('0x70'),'value':_0x2ed987['attrVoiceQueues']||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x3]?_0x2ed987[_0xb166('0x63')][0x3]['value']:undefined)||[]},{'name':_0xb166('0x7b'),'value':_0x2ed987[_0xb166('0x7b')]||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x4]?_0x2ed987[_0xb166('0x63')][0x4][_0xb166('0x64')]:undefined)||_0xb166('0x71')},{'name':_0xb166('0x72'),'value':_0x2ed987['attrEmailAccounts']||(_0x2ed987['attrs']&&_0x2ed987['attrs'][0x5]?_0x2ed987[_0xb166('0x63')][0x5][_0xb166('0x64')]:undefined)||''},{'name':_0xb166('0x73'),'value':_0x2ed987[_0xb166('0x73')]||(_0x2ed987['attrs']&&_0x2ed987[_0xb166('0x63')][0x6]?_0x2ed987[_0xb166('0x63')][0x6]['value']:undefined)||''},{'name':_0xb166('0x74'),'value':_0x2ed987['attrSmsAccounts']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x7]?_0x2ed987[_0xb166('0x63')][0x7][_0xb166('0x64')]:undefined)||''},{'name':_0xb166('0x75'),'value':_0x2ed987[_0xb166('0x75')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987['attrs'][0x8]?_0x2ed987['attrs'][0x8][_0xb166('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ed987['attrWhatsappAccounts']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x9]?_0x2ed987['attrs'][0x9]['value']:undefined)||''},{'name':_0xb166('0x77'),'value':_0x2ed987[_0xb166('0x77')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0xa]?_0x2ed987['attrs'][0xa][_0xb166('0x64')]:undefined)||''}];case'web-report':return[{'name':_0xb166('0x7c'),'type':_0x2ed987[_0xb166('0x7d')]||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x0]?_0x2ed987[_0xb166('0x63')][0x0]['type']:undefined)||null,'value':_0x2ed987['attrReport']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x0]?_0x2ed987[_0xb166('0x63')][0x0][_0xb166('0x64')]:undefined)||null},{'name':_0xb166('0x7e'),'value':_0x2ed987['attrRefresh']||(_0x2ed987[_0xb166('0x63')]&&_0x2ed987[_0xb166('0x63')][0x1]?_0x2ed987[_0xb166('0x63')][0x1][_0xb166('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x7c7c8e){logger['error'](_0xb166('0x7f'),JSON['stringify'](_0x7c7c8e));return[];}}exports['addItem']=function(_0x2a340f,_0x41a167,_0x51f485){if(_0x2a340f[_0xb166('0x5e')]['id']){delete _0x2a340f['body']['id'];}return db[_0xb166('0x35')][_0xb166('0x51')]({'where':{'id':_0x2a340f[_0xb166('0x50')]['id']}})[_0xb166('0x2c')](handleEntityNotFound(_0x41a167,null))[_0xb166('0x2c')](function(_0x55718a){if(_0x55718a){_0x2a340f[_0xb166('0x5e')][_0xb166('0x80')]=_0x55718a['id'];_0x2a340f[_0xb166('0x5e')][_0xb166('0x63')]=widgetAttributes(_0x2a340f[_0xb166('0x5e')]);return db[_0xb166('0x81')][_0xb166('0x52')](_0x2a340f['body']);}})[_0xb166('0x2c')](respondWithResult(_0x41a167,null))[_0xb166('0x4e')](handleError(_0x41a167,null));};exports['getItems']=function(_0x2697c9,_0x3addd1,_0x442b52){var _0x21458c={};var _0xb2a316={};var _0x3892c7;var _0x1b0164;return db[_0xb166('0x35')][_0xb166('0x82')]({'where':{'id':_0x2697c9[_0xb166('0x50')]['id']}})['then'](handleEntityNotFound(_0x3addd1,null))[_0xb166('0x2c')](function(_0x3f94e5){if(_0x3f94e5){_0x3892c7=_0x3f94e5;_0xb2a316['model']=_[_0xb166('0x39')](db['DashboardItem'][_0xb166('0x36')]);_0xb2a316[_0xb166('0x38')]=_['keys'](_0x2697c9['query']);_0xb2a316[_0xb166('0x44')]=_['intersection'](_0xb2a316[_0xb166('0x3b')],_0xb2a316[_0xb166('0x38')]);_0x21458c[_0xb166('0x3c')]=_['intersection'](_0xb2a316[_0xb166('0x3b')],qs[_0xb166('0x3d')](_0x2697c9['query'][_0xb166('0x3d')]));_0x21458c[_0xb166('0x3c')]=_0x21458c['attributes'][_0xb166('0x3e')]?_0x21458c[_0xb166('0x3c')]:_0xb2a316[_0xb166('0x3b')];_0x21458c[_0xb166('0x41')]=qs[_0xb166('0x42')](_0x2697c9[_0xb166('0x38')][_0xb166('0x42')]);_0x21458c[_0xb166('0x43')]=qs['filters'](_[_0xb166('0x45')](_0x2697c9[_0xb166('0x38')],_0xb2a316['filters']));if(_0x2697c9[_0xb166('0x38')][_0xb166('0x46')]){_0x21458c[_0xb166('0x43')]=_[_0xb166('0x47')](_0x21458c[_0xb166('0x43')],{'$or':_[_0xb166('0x34')](_0x21458c['attributes'],function(_0x21a25d){var _0x4eac73={};_0x4eac73[_0x21a25d]={'$like':'%'+_0x2697c9[_0xb166('0x38')][_0xb166('0x46')]+'%'};return _0x4eac73;})});}_0x21458c=_[_0xb166('0x47')]({},_0x21458c,_0x2697c9[_0xb166('0x4a')]);return _0x3892c7[_0xb166('0x83')](_0x21458c);}})[_0xb166('0x2c')](function(_0xd78c19){if(_0xd78c19){_0x1b0164=_0xd78c19[_0xb166('0x3e')];if(!_0x2697c9['query'][_0xb166('0x3f')](_0xb166('0x40'))){_0x21458c[_0xb166('0x24')]=qs[_0xb166('0x24')](_0x2697c9['query'][_0xb166('0x24')]);_0x21458c['offset']=qs[_0xb166('0x23')](_0x2697c9[_0xb166('0x38')][_0xb166('0x23')]);}return _0x3892c7[_0xb166('0x83')](_0x21458c);}})[_0xb166('0x2c')](function(_0x600ba3){if(_0x600ba3){return _0x600ba3?{'count':_0x1b0164,'rows':_0x600ba3}:null;}})['then'](respondWithResult(_0x3addd1,null))[_0xb166('0x4e')](handleError(_0x3addd1,null));}; \ No newline at end of file +var _0xbf5b=['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','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','clone','params','find','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce'];(function(_0x3d195e,_0x57b963){var _0xc02374=function(_0xb68459){while(--_0xb68459){_0x3d195e['push'](_0x3d195e['shift']());}};_0xc02374(++_0x57b963);}(_0xbf5b,0x79));var _0xbbf5=function(_0x1cd23d,_0xec4ea5){_0x1cd23d=_0x1cd23d-0x0;var _0x5e8ad5=_0xbf5b[_0x1cd23d];return _0x5e8ad5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbf5('0x0'));var zipdir=require(_0xbbf5('0x1'));var jsonpatch=require(_0xbbf5('0x2'));var rp=require(_0xbbf5('0x3'));var moment=require(_0xbbf5('0x4'));var BPromise=require(_0xbbf5('0x5'));var Mustache=require(_0xbbf5('0x6'));var util=require(_0xbbf5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbbf5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbf5('0x9'));var squel=require(_0xbbf5('0xa'));var crypto=require(_0xbbf5('0xb'));var jsforce=require(_0xbbf5('0xc'));var deskjs=require(_0xbbf5('0xd'));var toCsv=require(_0xbbf5('0xe'));var querystring=require(_0xbbf5('0xf'));var Papa=require(_0xbbf5('0x10'));var Redis=require('ioredis');var authService=require(_0xbbf5('0x11'));var qs=require(_0xbbf5('0x12'));var as=require(_0xbbf5('0x13'));var hardwareService=require(_0xbbf5('0x14'));var logger=require(_0xbbf5('0x15'))(_0xbbf5('0x16'));var utils=require('../../config/utils');var config=require(_0xbbf5('0x17'));var licenseUtil=require(_0xbbf5('0x18'));var db=require(_0xbbf5('0x19'))['db'];config[_0xbbf5('0x1a')]=_[_0xbbf5('0x1b')](config[_0xbbf5('0x1a')],{'host':_0xbbf5('0x1c'),'port':0x18eb});var socket=require(_0xbbf5('0x1d'))(new Redis(config['redis']));require(_0xbbf5('0x1e'))[_0xbbf5('0x1f')](socket);function respondWithStatusCode(_0x49562f,_0x53d09f){_0x53d09f=_0x53d09f||0xcc;return function(_0x13ebfa){if(_0x13ebfa){return _0x49562f[_0xbbf5('0x20')](_0x53d09f);}return _0x49562f['status'](_0x53d09f)[_0xbbf5('0x21')]();};}function respondWithResult(_0x5117d3,_0x53ab0d){_0x53ab0d=_0x53ab0d||0xc8;return function(_0x5b4ff2){if(_0x5b4ff2){return _0x5117d3[_0xbbf5('0x22')](_0x53ab0d)[_0xbbf5('0x23')](_0x5b4ff2);}};}function respondWithFilteredResult(_0x13d977,_0x3d0b58){return function(_0x4209e7){if(_0x4209e7){var _0x58e7d5=typeof _0x3d0b58[_0xbbf5('0x24')]===_0xbbf5('0x25')&&typeof _0x3d0b58['limit']===_0xbbf5('0x25');var _0x3ad401=_0x4209e7[_0xbbf5('0x26')];var _0x4f134f=_0x58e7d5?0x0:_0x3d0b58[_0xbbf5('0x24')];var _0x1d64e7=_0x58e7d5?_0x4209e7[_0xbbf5('0x26')]:_0x3d0b58[_0xbbf5('0x24')]+_0x3d0b58[_0xbbf5('0x27')];var _0x24da35;if(_0x1d64e7>=_0x3ad401){_0x1d64e7=_0x3ad401;_0x24da35=0xc8;}else{_0x24da35=0xce;}_0x13d977[_0xbbf5('0x22')](_0x24da35);return _0x13d977[_0xbbf5('0x28')](_0xbbf5('0x29'),_0x4f134f+'-'+_0x1d64e7+'/'+_0x3ad401)[_0xbbf5('0x23')](_0x4209e7);}return null;};}function patchUpdates(_0x40d3fd){return function(_0x328bb5){try{jsonpatch[_0xbbf5('0x2a')](_0x328bb5,_0x40d3fd,!![]);}catch(_0x410734){return BPromise['reject'](_0x410734);}return _0x328bb5[_0xbbf5('0x2b')]();};}function saveUpdates(_0x5e7024,_0x49e3b1){return function(_0x160085){if(_0x160085){return _0x160085['update'](_0x5e7024)[_0xbbf5('0x2c')](function(_0x45f87a){return _0x45f87a;});}return null;};}function removeEntity(_0x1179fd,_0xb9516f){return function(_0x2dd7c4){if(_0x2dd7c4){return _0x2dd7c4[_0xbbf5('0x2d')]()[_0xbbf5('0x2c')](function(){var _0x329295=_0x2dd7c4[_0xbbf5('0x2e')]({'plain':!![]});var _0x1d91bb=_0xbbf5('0x2f');return db[_0xbbf5('0x30')][_0xbbf5('0x2d')]({'where':{'type':_0x1d91bb,'resourceId':_0x329295['id']}})['then'](function(){return _0x2dd7c4;});})[_0xbbf5('0x2c')](function(){_0x1179fd[_0xbbf5('0x22')](0xcc)[_0xbbf5('0x21')]();});}};}function handleEntityNotFound(_0x27e114,_0x4ab838){return function(_0x44dcae){if(!_0x44dcae){_0x27e114['sendStatus'](0x194);}return _0x44dcae;};}function handleError(_0x47cf15,_0x6d10b8){_0x6d10b8=_0x6d10b8||0x1f4;return function(_0x213063){logger[_0xbbf5('0x31')](_0x213063[_0xbbf5('0x32')]);if(_0x213063['name']){delete _0x213063[_0xbbf5('0x33')];}_0x47cf15[_0xbbf5('0x22')](_0x6d10b8)[_0xbbf5('0x34')](_0x213063);};}exports[_0xbbf5('0x35')]=function(_0x37a6ed,_0x412aa1){var _0xb850fa={},_0x3ee820={},_0x322c12={'count':0x0,'rows':[]};var _0x568761=_['map'](db[_0xbbf5('0x36')][_0xbbf5('0x37')],function(_0x2cabef){return{'name':_0x2cabef[_0xbbf5('0x38')],'type':_0x2cabef[_0xbbf5('0x39')][_0xbbf5('0x3a')]};});_0x3ee820['model']=_[_0xbbf5('0x3b')](_0x568761,_0xbbf5('0x33'));_0x3ee820['query']=_[_0xbbf5('0x3c')](_0x37a6ed[_0xbbf5('0x3d')]);_0x3ee820[_0xbbf5('0x3e')]=_[_0xbbf5('0x3f')](_0x3ee820['model'],_0x3ee820[_0xbbf5('0x3d')]);_0xb850fa[_0xbbf5('0x40')]=_[_0xbbf5('0x3f')](_0x3ee820[_0xbbf5('0x41')],qs[_0xbbf5('0x42')](_0x37a6ed['query'][_0xbbf5('0x42')]));_0xb850fa[_0xbbf5('0x40')]=_0xb850fa['attributes'][_0xbbf5('0x43')]?_0xb850fa['attributes']:_0x3ee820['model'];if(!_0x37a6ed['query'][_0xbbf5('0x44')](_0xbbf5('0x45'))){_0xb850fa[_0xbbf5('0x27')]=qs['limit'](_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x27')]);_0xb850fa[_0xbbf5('0x24')]=qs['offset'](_0x37a6ed[_0xbbf5('0x3d')]['offset']);}_0xb850fa['order']=qs[_0xbbf5('0x46')](_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x46')]);_0xb850fa[_0xbbf5('0x47')]=qs[_0xbbf5('0x3e')](_[_0xbbf5('0x48')](_0x37a6ed[_0xbbf5('0x3d')],_0x3ee820[_0xbbf5('0x3e')]),_0x568761);if(_0x37a6ed['query'][_0xbbf5('0x49')]){_0xb850fa['where']=_[_0xbbf5('0x4a')](_0xb850fa[_0xbbf5('0x47')],{'$or':_[_0xbbf5('0x3b')](_0x568761,function(_0x51094e){if(_0x51094e[_0xbbf5('0x39')]!==_0xbbf5('0x4b')){var _0x1c77c0={};_0x1c77c0[_0x51094e['name']]={'$like':'%'+_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x49')]+'%'};return _0x1c77c0;}})});}_0xb850fa=_['merge']({},_0xb850fa,_0x37a6ed['options']);var _0x2beeef={'where':_0xb850fa[_0xbbf5('0x47')]};return db[_0xbbf5('0x36')][_0xbbf5('0x26')](_0x2beeef)[_0xbbf5('0x2c')](function(_0x45c05e){_0x322c12['count']=_0x45c05e;if(_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x4c')]){_0xb850fa[_0xbbf5('0x4d')]=[{'all':!![]}];}return db[_0xbbf5('0x36')][_0xbbf5('0x4e')](_0xb850fa);})[_0xbbf5('0x2c')](function(_0x194da9){_0x322c12[_0xbbf5('0x4f')]=_0x194da9;return _0x322c12;})[_0xbbf5('0x2c')](respondWithFilteredResult(_0x412aa1,_0xb850fa))['catch'](handleError(_0x412aa1,null));};exports[_0xbbf5('0x50')]=function(_0x20286d,_0x25b38c){var _0x578242={'raw':![],'where':{'id':_0x20286d['params']['id']}},_0x7807d0={};_0x7807d0[_0xbbf5('0x41')]=_[_0xbbf5('0x3c')](db[_0xbbf5('0x36')][_0xbbf5('0x37')]);_0x7807d0[_0xbbf5('0x3d')]=_[_0xbbf5('0x3c')](_0x20286d[_0xbbf5('0x3d')]);_0x7807d0[_0xbbf5('0x3e')]=_['intersection'](_0x7807d0[_0xbbf5('0x41')],_0x7807d0[_0xbbf5('0x3d')]);_0x578242[_0xbbf5('0x40')]=_[_0xbbf5('0x3f')](_0x7807d0[_0xbbf5('0x41')],qs[_0xbbf5('0x42')](_0x20286d['query'][_0xbbf5('0x42')]));_0x578242['attributes']=_0x578242['attributes'][_0xbbf5('0x43')]?_0x578242[_0xbbf5('0x40')]:_0x7807d0[_0xbbf5('0x41')];if(_0x20286d[_0xbbf5('0x3d')][_0xbbf5('0x4c')]){_0x578242['include']=[{'all':!![]}];}_0x578242=_[_0xbbf5('0x4a')]({},_0x578242,_0x20286d[_0xbbf5('0x51')]);return db[_0xbbf5('0x36')]['find'](_0x578242)[_0xbbf5('0x2c')](handleEntityNotFound(_0x25b38c,null))[_0xbbf5('0x2c')](respondWithResult(_0x25b38c,null))[_0xbbf5('0x52')](handleError(_0x25b38c,null));};exports['create']=function(_0x30657b,_0x4addab){return db[_0xbbf5('0x36')]['create'](_0x30657b[_0xbbf5('0x53')],{})['then'](function(_0x46f4b7){var _0x1b906a=_0x30657b[_0xbbf5('0x54')][_0xbbf5('0x2e')]({'plain':!![]});if(!_0x1b906a)throw new Error(_0xbbf5('0x55'));if(_0x1b906a[_0xbbf5('0x56')]===_0xbbf5('0x54')){var _0x589232=_0x46f4b7['get']({'plain':!![]});var _0x3564f6=_0xbbf5('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x3564f6,'userProfileId':_0x1b906a[_0xbbf5('0x57')]},'raw':!![]})[_0xbbf5('0x2c')](function(_0x54cf18){if(_0x54cf18&&_0x54cf18[_0xbbf5('0x58')]===0x0){return db[_0xbbf5('0x30')][_0xbbf5('0x59')]({'name':_0x589232[_0xbbf5('0x33')],'resourceId':_0x589232['id'],'type':_0x54cf18[_0xbbf5('0x33')],'sectionId':_0x54cf18['id']},{})[_0xbbf5('0x2c')](function(){return _0x46f4b7;});}else{return _0x46f4b7;}})[_0xbbf5('0x52')](function(_0x53ecd3){logger[_0xbbf5('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53ecd3);throw _0x53ecd3;});}return _0x46f4b7;})[_0xbbf5('0x2c')](respondWithResult(_0x4addab,0xc9))[_0xbbf5('0x52')](handleError(_0x4addab,null));};exports[_0xbbf5('0x5a')]=function(_0x7bcf84,_0x5c2acf){var _0xc86104={'where':{'id':_0x7bcf84[_0xbbf5('0x5b')]['id']}},_0x264934={};_0x264934[_0xbbf5('0x41')]=_[_0xbbf5('0x3c')](db['Dashboard'][_0xbbf5('0x37')]);_0xc86104['attributes']=_[_0xbbf5('0x3f')](_0x264934[_0xbbf5('0x41')],qs[_0xbbf5('0x42')](_0x7bcf84['query'][_0xbbf5('0x42')]));_0xc86104['attributes']=_0xc86104[_0xbbf5('0x40')][_0xbbf5('0x43')]?_0xc86104[_0xbbf5('0x40')]:_0x264934[_0xbbf5('0x41')];if(_0x7bcf84[_0xbbf5('0x3d')]['includeAll']){_0xc86104[_0xbbf5('0x4d')]=[{'all':!![]}];}_0xc86104=_[_0xbbf5('0x4a')]({},_0xc86104,_0x7bcf84[_0xbbf5('0x51')]);return db[_0xbbf5('0x36')][_0xbbf5('0x5c')](_0xc86104)[_0xbbf5('0x2c')](handleEntityNotFound(_0x5c2acf,null))['then'](function(_0x3344d3){if(_0x3344d3){var _0x5f00f3=_0x3344d3[_0xbbf5('0x2e')]({'plain':!![]});_0x5f00f3=qs[_0xbbf5('0x5d')](_0x5f00f3,['id',_0xbbf5('0x5e'),_0xbbf5('0x5f')]);_0x7bcf84[_0xbbf5('0x53')]=_[_0xbbf5('0x5d')](_0x7bcf84[_0xbbf5('0x53')],['id',_0xbbf5('0x5e'),_0xbbf5('0x5f')]);return db['Dashboard'][_0xbbf5('0x59')](_[_0xbbf5('0x4a')](_0x5f00f3,_0x7bcf84[_0xbbf5('0x53')]),{'include':_0x7bcf84[_0xbbf5('0x3d')][_0xbbf5('0x4c')]?[{'all':!![]}]:undefined})[_0xbbf5('0x2c')](function(_0x4e5cd7){var _0x5519ea=_0x7bcf84['user'][_0xbbf5('0x2e')]({'plain':!![]});if(!_0x5519ea)throw new Error(_0xbbf5('0x55'));if(_0x5519ea[_0xbbf5('0x56')]===_0xbbf5('0x54')){var _0x3a1e01=_0x4e5cd7[_0xbbf5('0x2e')]({'plain':!![]});var _0xd3f7c=_0xbbf5('0x2f');return db[_0xbbf5('0x60')]['find']({'where':{'name':_0xd3f7c,'userProfileId':_0x5519ea[_0xbbf5('0x57')]},'raw':!![]})['then'](function(_0x1e2656){if(_0x1e2656&&_0x1e2656['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3a1e01[_0xbbf5('0x33')],'resourceId':_0x3a1e01['id'],'type':_0x1e2656[_0xbbf5('0x33')],'sectionId':_0x1e2656['id']},{})[_0xbbf5('0x2c')](function(){return _0x4e5cd7;});}else{return _0x4e5cd7;}})['catch'](function(_0x4a0d3a){logger[_0xbbf5('0x31')](_0xbbf5('0x61'),_0x4a0d3a);throw _0x4a0d3a;});}return _0x4e5cd7;});}})[_0xbbf5('0x2c')](respondWithResult(_0x5c2acf,0xc9))[_0xbbf5('0x52')](handleError(_0x5c2acf,null));};exports[_0xbbf5('0x62')]=function(_0x29ade,_0x21f16c){if(_0x29ade[_0xbbf5('0x53')]['id']){delete _0x29ade[_0xbbf5('0x53')]['id'];}return db['Dashboard'][_0xbbf5('0x5c')]({'where':{'id':_0x29ade['params']['id']}})['then'](handleEntityNotFound(_0x21f16c,null))[_0xbbf5('0x2c')](saveUpdates(_0x29ade[_0xbbf5('0x53')],null))[_0xbbf5('0x2c')](respondWithResult(_0x21f16c,null))['catch'](handleError(_0x21f16c,null));};exports['destroy']=function(_0x3fe6f6,_0x1e87e6){return db[_0xbbf5('0x36')]['find']({'where':{'id':_0x3fe6f6[_0xbbf5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1e87e6,null))['then'](removeEntity(_0x1e87e6,null))[_0xbbf5('0x52')](handleError(_0x1e87e6,null));};function widgetAttributes(_0x4c6d62){try{switch(_0x4c6d62['type']){case _0xbbf5('0x63'):return[{'name':'attrUrl','value':_0x4c6d62[_0xbbf5('0x64')]||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||'https://'}];case'custom':return[{'name':_0xbbf5('0x67'),'value':_0x4c6d62['attrPath']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62['attrs'][0x0][_0xbbf5('0x66')]:undefined)||''}];case _0xbbf5('0x68'):return[{'name':'attrHourFormat','value':_0x4c6d62['attrHourFormat']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x69')},{'name':_0xbbf5('0x6a'),'value':_0x4c6d62[_0xbbf5('0x6a')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x1]?_0x4c6d62[_0xbbf5('0x65')][0x1][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x6b')},{'name':_0xbbf5('0x6c'),'value':_0x4c6d62[_0xbbf5('0x6c')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x2]?_0x4c6d62[_0xbbf5('0x65')][0x2]['value']:undefined)||0xc}];case _0xbbf5('0x6d'):return[{'name':_0xbbf5('0x6e'),'value':_0x4c6d62[_0xbbf5('0x6e')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x6f')},{'name':'attrVoiceQueues','value':_0x4c6d62[_0xbbf5('0x70')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x1]?_0x4c6d62[_0xbbf5('0x65')][0x1][_0xbbf5('0x66')]:undefined)||[]},{'name':_0xbbf5('0x6c'),'value':_0x4c6d62[_0xbbf5('0x6c')]||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x2]?_0x4c6d62[_0xbbf5('0x65')][0x2][_0xbbf5('0x66')]:undefined)||0x14},{'name':_0xbbf5('0x71'),'value':_0x4c6d62[_0xbbf5('0x71')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x3]?_0x4c6d62[_0xbbf5('0x65')][0x3]['value']:undefined)||_0xbbf5('0x72')},{'name':_0xbbf5('0x73'),'value':_0x4c6d62[_0xbbf5('0x73')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x4]?_0x4c6d62['attrs'][0x4][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x74'),'value':_0x4c6d62[_0xbbf5('0x74')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x5]?_0x4c6d62['attrs'][0x5][_0xbbf5('0x66')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4c6d62[_0xbbf5('0x75')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x6]?_0x4c6d62[_0xbbf5('0x65')][0x6][_0xbbf5('0x66')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4c6d62[_0xbbf5('0x76')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x7]?_0x4c6d62[_0xbbf5('0x65')][0x7]['value']:undefined)||''},{'name':_0xbbf5('0x77'),'value':_0x4c6d62['attrWhatsappAccounts']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x8]?_0x4c6d62[_0xbbf5('0x65')][0x8][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x78'),'value':_0x4c6d62[_0xbbf5('0x78')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x9]?_0x4c6d62[_0xbbf5('0x65')][0x9][_0xbbf5('0x66')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x4c6d62[_0xbbf5('0x79')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62['attrs'][0x0][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x6f')},{'name':_0xbbf5('0x7a'),'value':_0x4c6d62[_0xbbf5('0x7a')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x1]?_0x4c6d62['attrs'][0x1][_0xbbf5('0x66')]:undefined)||null},{'name':_0xbbf5('0x7b'),'value':_0x4c6d62[_0xbbf5('0x7b')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x2]?_0x4c6d62[_0xbbf5('0x65')][0x2][_0xbbf5('0x66')]:undefined)||null},{'name':_0xbbf5('0x70'),'value':_0x4c6d62['attrVoiceQueues']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x3]?_0x4c6d62[_0xbbf5('0x65')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x4c6d62[_0xbbf5('0x71')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x4]?_0x4c6d62['attrs'][0x4]['value']:undefined)||_0xbbf5('0x72')},{'name':_0xbbf5('0x73'),'value':_0x4c6d62[_0xbbf5('0x73')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x5]?_0x4c6d62[_0xbbf5('0x65')][0x5]['value']:undefined)||''},{'name':_0xbbf5('0x74'),'value':_0x4c6d62[_0xbbf5('0x74')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x6]?_0x4c6d62[_0xbbf5('0x65')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4c6d62['attrSmsAccounts']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x7]?_0x4c6d62[_0xbbf5('0x65')][0x7][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x76'),'value':_0x4c6d62['attrOpenchannelAccounts']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x8]?_0x4c6d62['attrs'][0x8][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x77'),'value':_0x4c6d62[_0xbbf5('0x77')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x9]?_0x4c6d62['attrs'][0x9][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x78'),'value':_0x4c6d62['attrChatWebsites']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0xa]?_0x4c6d62[_0xbbf5('0x65')][0xa][_0xbbf5('0x66')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x4c6d62[_0xbbf5('0x7c')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0]['type']:undefined)||null,'value':_0x4c6d62['attrReport']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||null},{'name':_0xbbf5('0x7d'),'value':_0x4c6d62['attrRefresh']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x1]?_0x4c6d62[_0xbbf5('0x65')][0x1][_0xbbf5('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x446d6b){logger[_0xbbf5('0x31')](_0xbbf5('0x7e'),JSON[_0xbbf5('0x7f')](_0x446d6b));return[];}}exports[_0xbbf5('0x80')]=function(_0x3ba5b0,_0x55f2d7,_0x3a9aed){if(_0x3ba5b0['body']['id']){delete _0x3ba5b0[_0xbbf5('0x53')]['id'];}return db['Dashboard'][_0xbbf5('0x5c')]({'where':{'id':_0x3ba5b0['params']['id']}})[_0xbbf5('0x2c')](handleEntityNotFound(_0x55f2d7,null))[_0xbbf5('0x2c')](function(_0x4e0a5c){if(_0x4e0a5c){_0x3ba5b0[_0xbbf5('0x53')][_0xbbf5('0x81')]=_0x4e0a5c['id'];_0x3ba5b0['body'][_0xbbf5('0x65')]=widgetAttributes(_0x3ba5b0[_0xbbf5('0x53')]);return db[_0xbbf5('0x82')][_0xbbf5('0x59')](_0x3ba5b0[_0xbbf5('0x53')]);}})[_0xbbf5('0x2c')](respondWithResult(_0x55f2d7,null))[_0xbbf5('0x52')](handleError(_0x55f2d7,null));};exports[_0xbbf5('0x83')]=function(_0x25da94,_0x5ab357,_0x16adef){var _0x38f1e1={};var _0x2e0f31={};var _0x5213c1;var _0x39d8b5;return db[_0xbbf5('0x36')][_0xbbf5('0x84')]({'where':{'id':_0x25da94[_0xbbf5('0x5b')]['id']}})[_0xbbf5('0x2c')](handleEntityNotFound(_0x5ab357,null))[_0xbbf5('0x2c')](function(_0x2e192e){if(_0x2e192e){_0x5213c1=_0x2e192e;_0x2e0f31[_0xbbf5('0x41')]=_[_0xbbf5('0x3c')](db[_0xbbf5('0x82')][_0xbbf5('0x37')]);_0x2e0f31[_0xbbf5('0x3d')]=_['keys'](_0x25da94[_0xbbf5('0x3d')]);_0x2e0f31[_0xbbf5('0x3e')]=_[_0xbbf5('0x3f')](_0x2e0f31[_0xbbf5('0x41')],_0x2e0f31[_0xbbf5('0x3d')]);_0x38f1e1[_0xbbf5('0x40')]=_['intersection'](_0x2e0f31['model'],qs[_0xbbf5('0x42')](_0x25da94[_0xbbf5('0x3d')][_0xbbf5('0x42')]));_0x38f1e1['attributes']=_0x38f1e1[_0xbbf5('0x40')][_0xbbf5('0x43')]?_0x38f1e1[_0xbbf5('0x40')]:_0x2e0f31['model'];_0x38f1e1[_0xbbf5('0x85')]=qs[_0xbbf5('0x46')](_0x25da94[_0xbbf5('0x3d')][_0xbbf5('0x46')]);_0x38f1e1[_0xbbf5('0x47')]=qs[_0xbbf5('0x3e')](_[_0xbbf5('0x48')](_0x25da94[_0xbbf5('0x3d')],_0x2e0f31['filters']));if(_0x25da94['query'][_0xbbf5('0x49')]){_0x38f1e1[_0xbbf5('0x47')]=_[_0xbbf5('0x4a')](_0x38f1e1[_0xbbf5('0x47')],{'$or':_[_0xbbf5('0x3b')](_0x38f1e1[_0xbbf5('0x40')],function(_0x224bc5){var _0x1ec145={};_0x1ec145[_0x224bc5]={'$like':'%'+_0x25da94[_0xbbf5('0x3d')]['filter']+'%'};return _0x1ec145;})});}_0x38f1e1=_[_0xbbf5('0x4a')]({},_0x38f1e1,_0x25da94[_0xbbf5('0x51')]);return _0x5213c1['getItems'](_0x38f1e1);}})[_0xbbf5('0x2c')](function(_0xe32909){if(_0xe32909){_0x39d8b5=_0xe32909[_0xbbf5('0x43')];if(!_0x25da94[_0xbbf5('0x3d')][_0xbbf5('0x44')]('nolimit')){_0x38f1e1['limit']=qs['limit'](_0x25da94['query']['limit']);_0x38f1e1[_0xbbf5('0x24')]=qs[_0xbbf5('0x24')](_0x25da94[_0xbbf5('0x3d')]['offset']);}return _0x5213c1[_0xbbf5('0x83')](_0x38f1e1);}})[_0xbbf5('0x2c')](function(_0x5b6a47){if(_0x5b6a47){return _0x5b6a47?{'count':_0x39d8b5,'rows':_0x5b6a47}:null;}})['then'](respondWithResult(_0x5ab357,null))['catch'](handleError(_0x5ab357,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6257e3e..97f3f7d 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 _0xd2f8=['setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd2f8,0x95));var _0x8d2f=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0xd2f8[_0x435b2f];return _0x181648;};'use strict';var EventEmitter=require(_0x8d2f('0x0'));var Dashboard=require(_0x8d2f('0x1'))['db'][_0x8d2f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8d2f('0x3')](0x0);var events={'afterCreate':_0x8d2f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7b30d7){return function(_0x2c46db,_0x2d7d41,_0x3fe8c7){DashboardEvents[_0x8d2f('0x5')](_0x7b30d7+':'+_0x2c46db['id'],_0x2c46db);DashboardEvents[_0x8d2f('0x5')](_0x7b30d7,_0x2c46db);_0x3fe8c7(null);};}for(var e in events){if(events[_0x8d2f('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x8d2f('0x7')]=DashboardEvents; \ No newline at end of file +var _0xdb1e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb1e,0x18b));var _0xedb1=function(_0x2c4384,_0x32231b){_0x2c4384=_0x2c4384-0x0;var _0x5ddb04=_0xdb1e[_0x2c4384];return _0x5ddb04;};'use strict';var EventEmitter=require(_0xedb1('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xedb1('0x1')](0x0);var events={'afterCreate':_0xedb1('0x2'),'afterUpdate':_0xedb1('0x3'),'afterDestroy':_0xedb1('0x4')};function emitEvent(_0x3c588b){return function(_0x3ad146,_0x4ca440,_0x35cecb){DashboardEvents[_0xedb1('0x5')](_0x3c588b+':'+_0x3ad146['id'],_0x3ad146);DashboardEvents[_0xedb1('0x5')](_0x3c588b,_0x3ad146);_0x35cecb(null);};}for(var e in events){if(events[_0xedb1('0x6')](e)){var event=events[e];Dashboard[_0xedb1('0x7')](e,emitEvent(event));}}module[_0xedb1('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 31c0838..c7ff05a 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 _0x4526=['api','request-promise','path','rimraf','../../config/environment','exports','Dashboard'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x4526,0x12d));var _0x6452=function(_0x1d067b,_0x4895b1){_0x1d067b=_0x1d067b-0x0;var _0x5c7f65=_0x4526[_0x1d067b];return _0x5c7f65;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6452('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6452('0x1'));var fs=require('fs');var path=require(_0x6452('0x2'));var rimraf=require(_0x6452('0x3'));var config=require(_0x6452('0x4'));var attributes=require('./dashboard.attributes');module[_0x6452('0x5')]=function(_0x3a11bf,_0x173ce5){return _0x3a11bf['define'](_0x6452('0x6'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf83=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','../../config/logger','api'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xaf83,0x159));var _0x3af8=function(_0x58f0db,_0x4e59e1){_0x58f0db=_0x58f0db-0x0;var _0x24a34e=_0xaf83[_0x58f0db];return _0x24a34e;};'use strict';var _=require(_0x3af8('0x0'));var util=require('util');var logger=require(_0x3af8('0x1'))(_0x3af8('0x2'));var moment=require(_0x3af8('0x3'));var BPromise=require(_0x3af8('0x4'));var rp=require(_0x3af8('0x5'));var fs=require('fs');var path=require(_0x3af8('0x6'));var rimraf=require('rimraf');var config=require(_0x3af8('0x7'));var attributes=require(_0x3af8('0x8'));module[_0x3af8('0x9')]=function(_0xa1942e,_0x2e8b4c){return _0xa1942e[_0x3af8('0xa')]('Dashboard',attributes,{'tableName':_0x3af8('0xb'),'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 ffca203..6b0697d 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 _0xd66e=['socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x4b6cc8,_0x355e5b){var _0x5c4743=function(_0x68d0f6){while(--_0x68d0f6){_0x4b6cc8['push'](_0x4b6cc8['shift']());}};_0x5c4743(++_0x355e5b);}(_0xd66e,0x1bf));var _0xed66=function(_0x141cdc,_0xa038e9){_0x141cdc=_0x141cdc-0x0;var _0x2d7d88=_0xd66e[_0x141cdc];return _0x2d7d88;};'use strict';var _=require('lodash');var util=require(_0xed66('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed66('0x1'));var fs=require('fs');var Redis=require(_0xed66('0x2'));var db=require(_0xed66('0x3'))['db'];var utils=require(_0xed66('0x4'));var logger=require(_0xed66('0x5'))(_0xed66('0x6'));var config=require(_0xed66('0x7'));var jayson=require(_0xed66('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xed66('0x9')]=_[_0xed66('0xa')](config[_0xed66('0x9')],{'host':_0xed66('0xb'),'port':0x18eb});var socket=require(_0xed66('0xc'))(new Redis(config[_0xed66('0x9')]));require(_0xed66('0xd'))[_0xed66('0xe')](socket);function respondWithRpcPromise(_0x49c5a0,_0x2aa6d3,_0x29ebc6){return new BPromise(function(_0xd526f1,_0x1d5132){return client[_0xed66('0xf')](_0x49c5a0,_0x29ebc6)[_0xed66('0x10')](function(_0x22d08b){logger[_0xed66('0x11')](_0xed66('0x12'),_0x2aa6d3,'request\x20sent');logger[_0xed66('0x13')](_0xed66('0x14'),_0x2aa6d3,'request\x20sent',JSON[_0xed66('0x15')](_0x22d08b));if(_0x22d08b[_0xed66('0x16')]){if(_0x22d08b[_0xed66('0x16')]['code']===0x1f4){logger[_0xed66('0x16')]('Dashboard,\x20%s,\x20%s',_0x2aa6d3,_0x22d08b['error'][_0xed66('0x17')]);return _0x1d5132(_0x22d08b['error'][_0xed66('0x17')]);}logger[_0xed66('0x16')]('Dashboard,\x20%s,\x20%s',_0x2aa6d3,_0x22d08b['error'][_0xed66('0x17')]);return _0xd526f1(_0x22d08b[_0xed66('0x16')]['message']);}else{logger[_0xed66('0x11')](_0xed66('0x12'),_0x2aa6d3,_0xed66('0x18'));_0xd526f1(_0x22d08b[_0xed66('0x19')][_0xed66('0x17')]);}})[_0xed66('0x1a')](function(_0x57d3a0){logger['error'](_0xed66('0x12'),_0x2aa6d3,_0x57d3a0);_0x1d5132(_0x57d3a0);});});} \ No newline at end of file +var _0x222a=['jayson/promise','client','http','redis','localhost','./dashboard.socket','register','request','then','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x11f661,_0xfacb67){var _0x502cf4=function(_0xc295c){while(--_0xc295c){_0x11f661['push'](_0x11f661['shift']());}};_0x502cf4(++_0xfacb67);}(_0x222a,0x1ec));var _0xa222=function(_0x46ca9d,_0x5a68fe){_0x46ca9d=_0x46ca9d-0x0;var _0x49527e=_0x222a[_0x46ca9d];return _0x49527e;};'use strict';var _=require(_0xa222('0x0'));var util=require('util');var moment=require(_0xa222('0x1'));var BPromise=require(_0xa222('0x2'));var rs=require(_0xa222('0x3'));var fs=require('fs');var Redis=require(_0xa222('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa222('0x5'));var logger=require(_0xa222('0x6'))(_0xa222('0x7'));var config=require('../../config/environment');var jayson=require(_0xa222('0x8'));var client=jayson[_0xa222('0x9')][_0xa222('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa222('0xb')],{'host':_0xa222('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa222('0xd'))[_0xa222('0xe')](socket);function respondWithRpcPromise(_0x47ea6f,_0x399f51,_0x58645f){return new BPromise(function(_0x5efab4,_0xa2424a){return client[_0xa222('0xf')](_0x47ea6f,_0x58645f)[_0xa222('0x10')](function(_0x680317){logger[_0xa222('0x11')]('Dashboard,\x20%s,\x20%s',_0x399f51,_0xa222('0x12'));logger['debug'](_0xa222('0x13'),_0x399f51,_0xa222('0x12'),JSON['stringify'](_0x680317));if(_0x680317['error']){if(_0x680317[_0xa222('0x14')][_0xa222('0x15')]===0x1f4){logger[_0xa222('0x14')](_0xa222('0x16'),_0x399f51,_0x680317[_0xa222('0x14')][_0xa222('0x17')]);return _0xa2424a(_0x680317[_0xa222('0x14')][_0xa222('0x17')]);}logger['error'](_0xa222('0x16'),_0x399f51,_0x680317['error'][_0xa222('0x17')]);return _0x5efab4(_0x680317[_0xa222('0x14')][_0xa222('0x17')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x399f51,_0xa222('0x12'));_0x5efab4(_0x680317['result'][_0xa222('0x17')]);}})[_0xa222('0x18')](function(_0x4b3811){logger[_0xa222('0x14')](_0xa222('0x16'),_0x399f51,_0x4b3811);_0xa2424a(_0x4b3811);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 14fb015..1f68678 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 _0x48e9=['emit','removeListener','register','length','save','remove'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x48e9,0xd6));var _0x948e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x48e9[_0x2641f9];return _0x585741;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x948e('0x0'),_0x948e('0x1'),'update'];function createListener(_0x2b82c2,_0x3239c3){return function(_0x256c99){_0x3239c3[_0x948e('0x2')](_0x2b82c2,_0x256c99);};}function removeListener(_0x5ce6e7,_0x56abb5){return function(){DashboardEvents[_0x948e('0x3')](_0x5ce6e7,_0x56abb5);};}exports[_0x948e('0x4')]=function(_0x283eca){for(var _0xe3084=0x0,_0x16121a=events[_0x948e('0x5')];_0xe3084<_0x16121a;_0xe3084++){var _0x2c1bd4=events[_0xe3084];var _0x22f284=createListener('dashboard:'+_0x2c1bd4,_0x283eca);DashboardEvents['on'](_0x2c1bd4,_0x22f284);}}; \ No newline at end of file +var _0x4678=['register','dashboard:','./dashboard.events','save','remove','update'];(function(_0x251120,_0x463ca4){var _0xef58d1=function(_0x56135f){while(--_0x56135f){_0x251120['push'](_0x251120['shift']());}};_0xef58d1(++_0x463ca4);}(_0x4678,0x164));var _0x8467=function(_0x44316e,_0x390748){_0x44316e=_0x44316e-0x0;var _0x5aef18=_0x4678[_0x44316e];return _0x5aef18;};'use strict';var DashboardEvents=require(_0x8467('0x0'));var events=[_0x8467('0x1'),_0x8467('0x2'),_0x8467('0x3')];function createListener(_0x3d1b05,_0x3d8cb7){return function(_0x4bd344){_0x3d8cb7['emit'](_0x3d1b05,_0x4bd344);};}function removeListener(_0xb6b062,_0x23300d){return function(){DashboardEvents['removeListener'](_0xb6b062,_0x23300d);};}exports[_0x8467('0x4')]=function(_0x4d8b1a){for(var _0x3ec9ac=0x0,_0x58b1a7=events['length'];_0x3ec9ac<_0x58b1a7;_0x3ec9ac++){var _0x4484ac=events[_0x3ec9ac];var _0x1e7390=createListener(_0x8467('0x5')+_0x4484ac,_0x4d8b1a);DashboardEvents['on'](_0x4484ac,_0x1e7390);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0b03d86..2c27f93 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 _0x9bd8=['fs-extra','isAuthenticated','index','get','/:id','show','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','util','path','Router'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x9bd8,0x18c));var _0x89bd=function(_0x5c88c8,_0x2c04cf){_0x5c88c8=_0x5c88c8-0x0;var _0x7b15d5=_0x9bd8[_0x5c88c8];return _0x7b15d5;};'use strict';var multer=require('multer');var util=require(_0x89bd('0x0'));var path=require(_0x89bd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x89bd('0x2')]();var fs_extra=require(_0x89bd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x89bd('0x4')](),controller[_0x89bd('0x5')]);router[_0x89bd('0x6')](_0x89bd('0x7'),auth['isAuthenticated'](),controller[_0x89bd('0x8')]);router[_0x89bd('0x6')]('/:id/items',auth[_0x89bd('0x4')](),controller[_0x89bd('0x9')]);router[_0x89bd('0xa')]('/',auth['isAuthenticated'](),controller[_0x89bd('0xb')]);router[_0x89bd('0xa')](_0x89bd('0xc'),auth['isAuthenticated'](),controller['clone']);router[_0x89bd('0xa')]('/:id/items',auth[_0x89bd('0x4')](),controller[_0x89bd('0xd')]);router[_0x89bd('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x89bd('0xf')]);router[_0x89bd('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x89bd('0x11')]);module[_0x89bd('0x12')]=router; \ No newline at end of file +var _0x9eca=['clone','put','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','post','/:id/clone'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0x9eca,0x1cf));var _0xa9ec=function(_0x40d339,_0xb726c3){_0x40d339=_0x40d339-0x0;var _0x5cbd0b=_0x9eca[_0x40d339];return _0x5cbd0b;};'use strict';var multer=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var path=require(_0xa9ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa9ec('0x3'));var router=express['Router']();var fs_extra=require(_0xa9ec('0x4'));var auth=require(_0xa9ec('0x5'));var interaction=require(_0xa9ec('0x6'));var config=require(_0xa9ec('0x7'));var controller=require(_0xa9ec('0x8'));router[_0xa9ec('0x9')]('/',auth['isAuthenticated'](),controller[_0xa9ec('0xa')]);router[_0xa9ec('0x9')](_0xa9ec('0xb'),auth[_0xa9ec('0xc')](),controller[_0xa9ec('0xd')]);router['get'](_0xa9ec('0xe'),auth[_0xa9ec('0xc')](),controller['getItems']);router[_0xa9ec('0xf')]('/',auth[_0xa9ec('0xc')](),controller['create']);router['post'](_0xa9ec('0x10'),auth[_0xa9ec('0xc')](),controller[_0xa9ec('0x11')]);router[_0xa9ec('0xf')](_0xa9ec('0xe'),auth['isAuthenticated'](),controller['addItem']);router[_0xa9ec('0x12')]('/:id',auth[_0xa9ec('0xc')](),controller['update']);router['delete'](_0xa9ec('0xb'),auth[_0xa9ec('0xc')](),controller['destroy']);module[_0xa9ec('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3cc4b5f..1c4f6d4 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 _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0xfdbd[_0x3233c3];return _0x36029b;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x486f1d,_0x90c2b5){_0x486f1d=_0x486f1d-0x0;var _0x5a2c2d=_0xfdbd[_0x486f1d];return _0x5a2c2d;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('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 d8e7b86..ba32215 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 _0xc4aa=['destroy','error','stack','send','show','params','model','keys','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','merge','options','catch','DashboardItem','type','iframe','attrUrl','attrs','value','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','update','then'];(function(_0x3095aa,_0x139af9){var _0x18737d=function(_0x5209f1){while(--_0x5209f1){_0x3095aa['push'](_0x3095aa['shift']());}};_0x18737d(++_0x139af9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];config[_0xac4a('0x17')]=_['defaults'](config[_0xac4a('0x17')],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x17')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xcc;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x1c')](_0x33c287);}return _0x34bc01[_0xac4a('0x1d')](_0x33c287)[_0xac4a('0x1e')]();};}function respondWithResult(_0x4a2119,_0x402fff){_0x402fff=_0x402fff||0xc8;return function(_0x34d797){if(_0x34d797){return _0x4a2119[_0xac4a('0x1d')](_0x402fff)[_0xac4a('0x1f')](_0x34d797);}};}function respondWithFilteredResult(_0x3e88e3,_0x387a54){return function(_0x28e304){if(_0x28e304){var _0x44ec59=typeof _0x387a54['offset']==='undefined'&&typeof _0x387a54[_0xac4a('0x20')]===_0xac4a('0x21');var _0x39b691=_0x28e304['count'];var _0x39e83e=_0x44ec59?0x0:_0x387a54[_0xac4a('0x22')];var _0x3752e4=_0x44ec59?_0x28e304[_0xac4a('0x23')]:_0x387a54[_0xac4a('0x22')]+_0x387a54[_0xac4a('0x20')];var _0xe38996;if(_0x3752e4>=_0x39b691){_0x3752e4=_0x39b691;_0xe38996=0xc8;}else{_0xe38996=0xce;}_0x3e88e3[_0xac4a('0x1d')](_0xe38996);return _0x3e88e3['set'](_0xac4a('0x24'),_0x39e83e+'-'+_0x3752e4+'/'+_0x39b691)[_0xac4a('0x1f')](_0x28e304);}return null;};}function patchUpdates(_0x599787){return function(_0x3d7ce0){try{jsonpatch[_0xac4a('0x25')](_0x3d7ce0,_0x599787,!![]);}catch(_0x3eacd3){return BPromise[_0xac4a('0x26')](_0x3eacd3);}return _0x3d7ce0['save']();};}function saveUpdates(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x27')](_0x1b7998)[_0xac4a('0x28')](function(_0x2b0dc2){return _0x2b0dc2;});}return null;};}function removeEntity(_0x222507,_0x36054a){return function(_0x3e2c69){if(_0x3e2c69){return _0x3e2c69[_0xac4a('0x29')]()[_0xac4a('0x28')](function(){_0x222507[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x472c57,_0x1c13dc){return function(_0x20202c){if(!_0x20202c){_0x472c57['sendStatus'](0x194);}return _0x20202c;};}function handleError(_0x23b061,_0x267a22){_0x267a22=_0x267a22||0x1f4;return function(_0x42a33c){logger[_0xac4a('0x2a')](_0x42a33c[_0xac4a('0x2b')]);if(_0x42a33c['name']){delete _0x42a33c['name'];}_0x23b061[_0xac4a('0x1d')](_0x267a22)[_0xac4a('0x2c')](_0x42a33c);};}exports[_0xac4a('0x2d')]=function(_0x546b65,_0x4bda1f){var _0x355755={'raw':![],'where':{'id':_0x546b65[_0xac4a('0x2e')]['id']}},_0x2896bc={};_0x2896bc[_0xac4a('0x2f')]=_[_0xac4a('0x30')](db['DashboardItem'][_0xac4a('0x31')]);_0x2896bc['query']=_[_0xac4a('0x30')](_0x546b65['query']);_0x2896bc[_0xac4a('0x32')]=_[_0xac4a('0x33')](_0x2896bc[_0xac4a('0x2f')],_0x2896bc[_0xac4a('0x34')]);_0x355755[_0xac4a('0x35')]=_[_0xac4a('0x33')](_0x2896bc[_0xac4a('0x2f')],qs[_0xac4a('0x36')](_0x546b65[_0xac4a('0x34')][_0xac4a('0x36')]));_0x355755[_0xac4a('0x35')]=_0x355755[_0xac4a('0x35')][_0xac4a('0x37')]?_0x355755[_0xac4a('0x35')]:_0x2896bc['model'];if(_0x546b65[_0xac4a('0x34')][_0xac4a('0x38')]){_0x355755['include']=[{'all':!![]}];}_0x355755=_[_0xac4a('0x39')]({},_0x355755,_0x546b65[_0xac4a('0x3a')]);return db['DashboardItem']['find'](_0x355755)[_0xac4a('0x28')](handleEntityNotFound(_0x4bda1f,null))[_0xac4a('0x28')](respondWithResult(_0x4bda1f,null))[_0xac4a('0x3b')](handleError(_0x4bda1f,null));};exports[_0xac4a('0x29')]=function(_0x4f5986,_0x453d02){return db[_0xac4a('0x3c')]['find']({'where':{'id':_0x4f5986[_0xac4a('0x2e')]['id']}})[_0xac4a('0x28')](handleEntityNotFound(_0x453d02,null))[_0xac4a('0x28')](removeEntity(_0x453d02,null))['catch'](handleError(_0x453d02,null));};function widgetAttributes(_0x121328){try{switch(_0x121328[_0xac4a('0x3d')]){case _0xac4a('0x3e'):return[{'name':'attrUrl','value':_0x121328[_0xac4a('0x3f')]||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x0]?_0x121328['attrs'][0x0][_0xac4a('0x41')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x121328['attrPath']||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x0]?_0x121328[_0xac4a('0x40')][0x0][_0xac4a('0x41')]:undefined)||''}];case _0xac4a('0x42'):return[{'name':_0xac4a('0x43'),'value':_0x121328[_0xac4a('0x43')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x0]?_0x121328[_0xac4a('0x40')][0x0][_0xac4a('0x41')]:undefined)||_0xac4a('0x44')},{'name':'attrTimezone','value':_0x121328['attrTimezone']||(_0x121328['attrs']&&_0x121328[_0xac4a('0x40')][0x1]?_0x121328[_0xac4a('0x40')][0x1][_0xac4a('0x41')]:undefined)||_0xac4a('0x45')},{'name':_0xac4a('0x46'),'value':_0x121328[_0xac4a('0x46')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x2]?_0x121328[_0xac4a('0x40')][0x2][_0xac4a('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0xac4a('0x47'),'value':_0x121328[_0xac4a('0x47')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x0]?_0x121328[_0xac4a('0x40')][0x0]['value']:undefined)||_0xac4a('0x48')},{'name':_0xac4a('0x49'),'value':_0x121328['attrVoiceQueues']||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x1]?_0x121328[_0xac4a('0x40')][0x1][_0xac4a('0x41')]:undefined)||[]},{'name':_0xac4a('0x46'),'value':_0x121328[_0xac4a('0x46')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x2]?_0x121328[_0xac4a('0x40')][0x2][_0xac4a('0x41')]:undefined)||0x14},{'name':_0xac4a('0x4a'),'value':_0x121328[_0xac4a('0x4a')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x3]?_0x121328['attrs'][0x3][_0xac4a('0x41')]:undefined)||_0xac4a('0x4b')},{'name':_0xac4a('0x4c'),'value':_0x121328['attrEmailAccounts']||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x4]?_0x121328['attrs'][0x4][_0xac4a('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x121328[_0xac4a('0x4d')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x5]?_0x121328['attrs'][0x5]['value']:undefined)||''},{'name':_0xac4a('0x4e'),'value':_0x121328['attrSmsAccounts']||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x6]?_0x121328[_0xac4a('0x40')][0x6]['value']:undefined)||''},{'name':_0xac4a('0x4f'),'value':_0x121328[_0xac4a('0x4f')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x7]?_0x121328['attrs'][0x7][_0xac4a('0x41')]:undefined)||''},{'name':_0xac4a('0x50'),'value':_0x121328[_0xac4a('0x50')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x8]?_0x121328[_0xac4a('0x40')][0x8][_0xac4a('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x121328[_0xac4a('0x51')]||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x9]?_0x121328[_0xac4a('0x40')][0x9][_0xac4a('0x41')]:undefined)||''}];case _0xac4a('0x52'):case _0xac4a('0x53'):return[{'name':'attrSerie1','value':_0x121328[_0xac4a('0x54')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x0]?_0x121328[_0xac4a('0x40')][0x0][_0xac4a('0x41')]:undefined)||'total'},{'name':_0xac4a('0x55'),'value':_0x121328['attrSerie2']||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x1]?_0x121328['attrs'][0x1]['value']:undefined)||null},{'name':_0xac4a('0x56'),'value':_0x121328[_0xac4a('0x56')]||(_0x121328['attrs']&&_0x121328[_0xac4a('0x40')][0x2]?_0x121328[_0xac4a('0x40')][0x2][_0xac4a('0x41')]:undefined)||null},{'name':_0xac4a('0x49'),'value':_0x121328['attrVoiceQueues']||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x3]?_0x121328[_0xac4a('0x40')][0x3][_0xac4a('0x41')]:undefined)||[]},{'name':_0xac4a('0x4a'),'value':_0x121328[_0xac4a('0x4a')]||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x4]?_0x121328[_0xac4a('0x40')][0x4][_0xac4a('0x41')]:undefined)||_0xac4a('0x4b')},{'name':_0xac4a('0x4c'),'value':_0x121328[_0xac4a('0x4c')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x5]?_0x121328[_0xac4a('0x40')][0x5][_0xac4a('0x41')]:undefined)||''},{'name':_0xac4a('0x4d'),'value':_0x121328[_0xac4a('0x4d')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x6]?_0x121328[_0xac4a('0x40')][0x6][_0xac4a('0x41')]:undefined)||''},{'name':_0xac4a('0x4e'),'value':_0x121328['attrSmsAccounts']||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x7]?_0x121328[_0xac4a('0x40')][0x7]['value']:undefined)||''},{'name':_0xac4a('0x4f'),'value':_0x121328['attrOpenchannelAccounts']||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x8]?_0x121328['attrs'][0x8][_0xac4a('0x41')]:undefined)||''},{'name':_0xac4a('0x50'),'value':_0x121328[_0xac4a('0x50')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x9]?_0x121328[_0xac4a('0x40')][0x9]['value']:undefined)||''},{'name':_0xac4a('0x51'),'value':_0x121328['attrChatWebsites']||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0xa]?_0x121328[_0xac4a('0x40')][0xa][_0xac4a('0x41')]:undefined)||''}];case _0xac4a('0x57'):return[{'name':_0xac4a('0x58'),'type':_0x121328[_0xac4a('0x59')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x0]?_0x121328[_0xac4a('0x40')][0x0][_0xac4a('0x3d')]:undefined)||null,'value':_0x121328[_0xac4a('0x58')]||(_0x121328[_0xac4a('0x40')]&&_0x121328[_0xac4a('0x40')][0x0]?_0x121328[_0xac4a('0x40')][0x0][_0xac4a('0x41')]:undefined)||null},{'name':_0xac4a('0x5a'),'value':_0x121328[_0xac4a('0x5a')]||(_0x121328[_0xac4a('0x40')]&&_0x121328['attrs'][0x1]?_0x121328[_0xac4a('0x40')][0x1][_0xac4a('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x4fb812){logger[_0xac4a('0x2a')](_0xac4a('0x5b'),JSON[_0xac4a('0x5c')](_0x4fb812));return[];}}exports[_0xac4a('0x5d')]=function(_0x357cac,_0x4d1440){if(_0x357cac['body']){_0x357cac[_0xac4a('0x5e')][_0xac4a('0x40')]=widgetAttributes(_0x357cac[_0xac4a('0x5e')]);}return db[_0xac4a('0x3c')][_0xac4a('0x5d')](_0x357cac[_0xac4a('0x5e')],{})[_0xac4a('0x28')](respondWithResult(_0x4d1440,0xc9))[_0xac4a('0x3b')](handleError(_0x4d1440,null));};exports[_0xac4a('0x27')]=function(_0x295f21,_0x278c09){if(_0x295f21['body']['id']){delete _0x295f21['body']['id'];}_0x295f21[_0xac4a('0x5e')][_0xac4a('0x40')]=widgetAttributes(_0x295f21[_0xac4a('0x5e')]);return db[_0xac4a('0x3c')][_0xac4a('0x5f')]({'where':{'id':_0x295f21[_0xac4a('0x2e')]['id']}})[_0xac4a('0x28')](handleEntityNotFound(_0x278c09,null))[_0xac4a('0x28')](saveUpdates(_0x295f21[_0xac4a('0x5e')],null))[_0xac4a('0x28')](respondWithResult(_0x278c09,null))[_0xac4a('0x3b')](handleError(_0x278c09,null));}; \ No newline at end of file +var _0x7919=['fields','attributes','length','includeAll','merge','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection'];(function(_0x3cc05a,_0x1a0c6c){var _0x301bae=function(_0x24c71e){while(--_0x24c71e){_0x3cc05a['push'](_0x3cc05a['shift']());}};_0x301bae(++_0x1a0c6c);}(_0x7919,0xeb));var _0x9791=function(_0x392e38,_0x25a564){_0x392e38=_0x392e38-0x0;var _0x44d727=_0x7919[_0x392e38];return _0x44d727;};'use strict';var emlformat=require(_0x9791('0x0'));var rimraf=require(_0x9791('0x1'));var zipdir=require(_0x9791('0x2'));var jsonpatch=require(_0x9791('0x3'));var rp=require(_0x9791('0x4'));var moment=require(_0x9791('0x5'));var BPromise=require(_0x9791('0x6'));var Mustache=require('mustache');var util=require(_0x9791('0x7'));var path=require(_0x9791('0x8'));var sox=require('sox');var csv=require(_0x9791('0x9'));var ejs=require(_0x9791('0xa'));var fs=require('fs');var fs_extra=require(_0x9791('0xb'));var _=require(_0x9791('0xc'));var squel=require(_0x9791('0xd'));var crypto=require('crypto');var jsforce=require(_0x9791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9791('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9791('0x10'));var as=require(_0x9791('0x11'));var hardwareService=require(_0x9791('0x12'));var logger=require(_0x9791('0x13'))(_0x9791('0x14'));var utils=require(_0x9791('0x15'));var config=require(_0x9791('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9791('0x17'))['db'];config['redis']=_[_0x9791('0x18')](config[_0x9791('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9791('0x1a'))(new Redis(config['redis']));require(_0x9791('0x1b'))[_0x9791('0x1c')](socket);function respondWithStatusCode(_0x1e05a2,_0x2d89d0){_0x2d89d0=_0x2d89d0||0xcc;return function(_0x11c83f){if(_0x11c83f){return _0x1e05a2[_0x9791('0x1d')](_0x2d89d0);}return _0x1e05a2[_0x9791('0x1e')](_0x2d89d0)[_0x9791('0x1f')]();};}function respondWithResult(_0x1b3626,_0x263bf4){_0x263bf4=_0x263bf4||0xc8;return function(_0x43a07e){if(_0x43a07e){return _0x1b3626[_0x9791('0x1e')](_0x263bf4)[_0x9791('0x20')](_0x43a07e);}};}function respondWithFilteredResult(_0x566a69,_0x2c6e99){return function(_0x402c83){if(_0x402c83){var _0x22b6fb=typeof _0x2c6e99[_0x9791('0x21')]===_0x9791('0x22')&&typeof _0x2c6e99['limit']===_0x9791('0x22');var _0x6d90c9=_0x402c83[_0x9791('0x23')];var _0x2cfaa2=_0x22b6fb?0x0:_0x2c6e99[_0x9791('0x21')];var _0xef3a83=_0x22b6fb?_0x402c83[_0x9791('0x23')]:_0x2c6e99[_0x9791('0x21')]+_0x2c6e99[_0x9791('0x24')];var _0x27a5e4;if(_0xef3a83>=_0x6d90c9){_0xef3a83=_0x6d90c9;_0x27a5e4=0xc8;}else{_0x27a5e4=0xce;}_0x566a69[_0x9791('0x1e')](_0x27a5e4);return _0x566a69['set'](_0x9791('0x25'),_0x2cfaa2+'-'+_0xef3a83+'/'+_0x6d90c9)['json'](_0x402c83);}return null;};}function patchUpdates(_0x4fe98f){return function(_0x571554){try{jsonpatch[_0x9791('0x26')](_0x571554,_0x4fe98f,!![]);}catch(_0x557e2b){return BPromise[_0x9791('0x27')](_0x557e2b);}return _0x571554[_0x9791('0x28')]();};}function saveUpdates(_0x7f08c8,_0x4ac5b5){return function(_0x620cb1){if(_0x620cb1){return _0x620cb1[_0x9791('0x29')](_0x7f08c8)[_0x9791('0x2a')](function(_0x4c3c00){return _0x4c3c00;});}return null;};}function removeEntity(_0x1c188b,_0x5264b6){return function(_0xc286ac){if(_0xc286ac){return _0xc286ac[_0x9791('0x2b')]()['then'](function(){_0x1c188b[_0x9791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2174d9,_0x545b9b){return function(_0x3baa79){if(!_0x3baa79){_0x2174d9[_0x9791('0x1d')](0x194);}return _0x3baa79;};}function handleError(_0x5d943f,_0x5f336c){_0x5f336c=_0x5f336c||0x1f4;return function(_0x55614a){logger[_0x9791('0x2c')](_0x55614a[_0x9791('0x2d')]);if(_0x55614a[_0x9791('0x2e')]){delete _0x55614a[_0x9791('0x2e')];}_0x5d943f['status'](_0x5f336c)[_0x9791('0x2f')](_0x55614a);};}exports[_0x9791('0x30')]=function(_0x52e9fd,_0x1814fa){var _0x309e58={'raw':![],'where':{'id':_0x52e9fd[_0x9791('0x31')]['id']}},_0x28522d={};_0x28522d[_0x9791('0x32')]=_[_0x9791('0x33')](db['DashboardItem'][_0x9791('0x34')]);_0x28522d[_0x9791('0x35')]=_[_0x9791('0x33')](_0x52e9fd['query']);_0x28522d[_0x9791('0x36')]=_['intersection'](_0x28522d[_0x9791('0x32')],_0x28522d['query']);_0x309e58['attributes']=_[_0x9791('0x37')](_0x28522d['model'],qs[_0x9791('0x38')](_0x52e9fd[_0x9791('0x35')]['fields']));_0x309e58[_0x9791('0x39')]=_0x309e58[_0x9791('0x39')][_0x9791('0x3a')]?_0x309e58['attributes']:_0x28522d[_0x9791('0x32')];if(_0x52e9fd[_0x9791('0x35')][_0x9791('0x3b')]){_0x309e58['include']=[{'all':!![]}];}_0x309e58=_[_0x9791('0x3c')]({},_0x309e58,_0x52e9fd['options']);return db[_0x9791('0x3d')]['find'](_0x309e58)[_0x9791('0x2a')](handleEntityNotFound(_0x1814fa,null))[_0x9791('0x2a')](respondWithResult(_0x1814fa,null))['catch'](handleError(_0x1814fa,null));};exports[_0x9791('0x2b')]=function(_0x34f7ff,_0x1ee18a){return db[_0x9791('0x3d')][_0x9791('0x3e')]({'where':{'id':_0x34f7ff['params']['id']}})[_0x9791('0x2a')](handleEntityNotFound(_0x1ee18a,null))[_0x9791('0x2a')](removeEntity(_0x1ee18a,null))[_0x9791('0x3f')](handleError(_0x1ee18a,null));};function widgetAttributes(_0xf3a1be){try{switch(_0xf3a1be[_0x9791('0x40')]){case _0x9791('0x41'):return[{'name':_0x9791('0x42'),'value':_0xf3a1be['attrUrl']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be['attrs'][0x0][_0x9791('0x44')]:undefined)||'https://'}];case _0x9791('0x45'):return[{'name':_0x9791('0x46'),'value':_0xf3a1be['attrPath']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be['attrs'][0x0]?_0xf3a1be[_0x9791('0x43')][0x0]['value']:undefined)||''}];case _0x9791('0x47'):return[{'name':'attrHourFormat','value':_0xf3a1be['attrHourFormat']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be['attrs'][0x0]['value']:undefined)||_0x9791('0x48')},{'name':_0x9791('0x49'),'value':_0xf3a1be['attrTimezone']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be['attrs'][0x1][_0x9791('0x44')]:undefined)||'0.00'},{'name':_0x9791('0x4a'),'value':_0xf3a1be[_0x9791('0x4a')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x2]?_0xf3a1be[_0x9791('0x43')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x9791('0x4b'),'value':_0xf3a1be[_0x9791('0x4b')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be[_0x9791('0x43')][0x0][_0x9791('0x44')]:undefined)||_0x9791('0x4c')},{'name':_0x9791('0x4d'),'value':_0xf3a1be[_0x9791('0x4d')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be[_0x9791('0x43')][0x1][_0x9791('0x44')]:undefined)||[]},{'name':_0x9791('0x4a'),'value':_0xf3a1be[_0x9791('0x4a')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x2]?_0xf3a1be['attrs'][0x2][_0x9791('0x44')]:undefined)||0x14},{'name':_0x9791('0x4e'),'value':_0xf3a1be[_0x9791('0x4e')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x3]?_0xf3a1be[_0x9791('0x43')][0x3][_0x9791('0x44')]:undefined)||_0x9791('0x4f')},{'name':'attrEmailAccounts','value':_0xf3a1be[_0x9791('0x50')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x4]?_0xf3a1be[_0x9791('0x43')][0x4]['value']:undefined)||''},{'name':_0x9791('0x51'),'value':_0xf3a1be[_0x9791('0x51')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x5]?_0xf3a1be[_0x9791('0x43')][0x5]['value']:undefined)||''},{'name':_0x9791('0x52'),'value':_0xf3a1be['attrSmsAccounts']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x6]?_0xf3a1be[_0x9791('0x43')][0x6][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x53'),'value':_0xf3a1be[_0x9791('0x53')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x7]?_0xf3a1be[_0x9791('0x43')][0x7]['value']:undefined)||''},{'name':_0x9791('0x54'),'value':_0xf3a1be['attrWhatsappAccounts']||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x8]?_0xf3a1be[_0x9791('0x43')][0x8][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x55'),'value':_0xf3a1be[_0x9791('0x55')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x9]?_0xf3a1be[_0x9791('0x43')][0x9][_0x9791('0x44')]:undefined)||''}];case _0x9791('0x56'):case _0x9791('0x57'):return[{'name':_0x9791('0x58'),'value':_0xf3a1be[_0x9791('0x58')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be['attrs'][0x0]['value']:undefined)||_0x9791('0x4c')},{'name':_0x9791('0x59'),'value':_0xf3a1be[_0x9791('0x59')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be[_0x9791('0x43')][0x1][_0x9791('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0xf3a1be[_0x9791('0x5a')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x2]?_0xf3a1be[_0x9791('0x43')][0x2][_0x9791('0x44')]:undefined)||null},{'name':_0x9791('0x4d'),'value':_0xf3a1be[_0x9791('0x4d')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be['attrs'][0x3]?_0xf3a1be[_0x9791('0x43')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0xf3a1be[_0x9791('0x4e')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x4]?_0xf3a1be[_0x9791('0x43')][0x4][_0x9791('0x44')]:undefined)||'voice'},{'name':_0x9791('0x50'),'value':_0xf3a1be['attrEmailAccounts']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x5]?_0xf3a1be[_0x9791('0x43')][0x5][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x51'),'value':_0xf3a1be[_0x9791('0x51')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be['attrs'][0x6]?_0xf3a1be['attrs'][0x6][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x52'),'value':_0xf3a1be['attrSmsAccounts']||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x7]?_0xf3a1be[_0x9791('0x43')][0x7][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x53'),'value':_0xf3a1be['attrOpenchannelAccounts']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x8]?_0xf3a1be[_0x9791('0x43')][0x8][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x54'),'value':_0xf3a1be[_0x9791('0x54')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x9]?_0xf3a1be[_0x9791('0x43')][0x9][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x55'),'value':_0xf3a1be['attrChatWebsites']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0xa]?_0xf3a1be[_0x9791('0x43')][0xa][_0x9791('0x44')]:undefined)||''}];case'web-report':return[{'name':_0x9791('0x5b'),'type':_0xf3a1be[_0x9791('0x5c')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be[_0x9791('0x43')][0x0][_0x9791('0x40')]:undefined)||null,'value':_0xf3a1be['attrReport']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be[_0x9791('0x43')][0x0]['value']:undefined)||null},{'name':_0x9791('0x5d'),'value':_0xf3a1be[_0x9791('0x5d')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be['attrs'][0x1][_0x9791('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x578783){logger[_0x9791('0x2c')]('widgetAttributes:\x20%s',JSON[_0x9791('0x5e')](_0x578783));return[];}}exports[_0x9791('0x5f')]=function(_0x5e2399,_0x1f0826){if(_0x5e2399[_0x9791('0x60')]){_0x5e2399[_0x9791('0x60')][_0x9791('0x43')]=widgetAttributes(_0x5e2399[_0x9791('0x60')]);}return db[_0x9791('0x3d')][_0x9791('0x5f')](_0x5e2399[_0x9791('0x60')],{})['then'](respondWithResult(_0x1f0826,0xc9))[_0x9791('0x3f')](handleError(_0x1f0826,null));};exports[_0x9791('0x29')]=function(_0x1f0d46,_0xbf59d){if(_0x1f0d46[_0x9791('0x60')]['id']){delete _0x1f0d46[_0x9791('0x60')]['id'];}_0x1f0d46[_0x9791('0x60')][_0x9791('0x43')]=widgetAttributes(_0x1f0d46[_0x9791('0x60')]);return db[_0x9791('0x3d')][_0x9791('0x3e')]({'where':{'id':_0x1f0d46[_0x9791('0x31')]['id']}})[_0x9791('0x2a')](handleEntityNotFound(_0xbf59d,null))[_0x9791('0x2a')](saveUpdates(_0x1f0d46[_0x9791('0x60')],null))[_0x9791('0x2a')](respondWithResult(_0xbf59d,null))[_0x9791('0x3f')](handleError(_0xbf59d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 325fdf8..65202ff 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 _0xef1a=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5053d0,_0x49fa5e){var _0x548d6a=function(_0xf9f9a){while(--_0xf9f9a){_0x5053d0['push'](_0x5053d0['shift']());}};_0x548d6a(++_0x49fa5e);}(_0xef1a,0x1c1));var _0xaef1=function(_0x3fcb63,_0x3a6d84){_0x3fcb63=_0x3fcb63-0x0;var _0x181d5f=_0xef1a[_0x3fcb63];return _0x181d5f;};'use strict';var EventEmitter=require(_0xaef1('0x0'));var DashboardItem=require(_0xaef1('0x1'))['db'][_0xaef1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xaef1('0x3')](0x0);var events={'afterCreate':_0xaef1('0x4'),'afterUpdate':_0xaef1('0x5'),'afterDestroy':_0xaef1('0x6')};function emitEvent(_0x18acc6){return function(_0x2e52a1,_0x467cc1,_0x14d0e3){DashboardItemEvents[_0xaef1('0x7')](_0x18acc6+':'+_0x2e52a1['id'],_0x2e52a1);DashboardItemEvents[_0xaef1('0x7')](_0x18acc6,_0x2e52a1);_0x14d0e3(null);};}for(var e in events){if(events[_0xaef1('0x8')](e)){var event=events[e];DashboardItem[_0xaef1('0x9')](e,emitEvent(event));}}module[_0xaef1('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x3496=['exports','events','setMaxListeners','save','emit','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3496,0x1a5));var _0x6349=function(_0x51f9ca,_0x3bb9db){_0x51f9ca=_0x51f9ca-0x0;var _0x4ea88a=_0x3496[_0x51f9ca];return _0x4ea88a;};'use strict';var EventEmitter=require(_0x6349('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6349('0x1')](0x0);var events={'afterCreate':_0x6349('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xa4ddf2){return function(_0x50fbf2,_0x18dfbf,_0x38bc12){DashboardItemEvents['emit'](_0xa4ddf2+':'+_0x50fbf2['id'],_0x50fbf2);DashboardItemEvents[_0x6349('0x3')](_0xa4ddf2,_0x50fbf2);_0x38bc12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x6349('0x4')](e,emitEvent(event));}}module[_0x6349('0x5')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index af35504..656e4d0 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 _0x406e=['exports','DashboardItem','dashboard_items','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./dashboardItem.attributes'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x406e,0x16b));var _0xe406=function(_0x3c0a24,_0x306f4b){_0x3c0a24=_0x3c0a24-0x0;var _0x30e766=_0x406e[_0x3c0a24];return _0x30e766;};'use strict';var _=require(_0xe406('0x0'));var util=require('util');var logger=require(_0xe406('0x1'))('api');var moment=require(_0xe406('0x2'));var BPromise=require(_0xe406('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe406('0x4'));var rimraf=require('rimraf');var config=require(_0xe406('0x5'));var attributes=require(_0xe406('0x6'));module[_0xe406('0x7')]=function(_0x186459,_0x47daf3){return _0x186459['define'](_0xe406('0x8'),attributes,{'tableName':_0xe406('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e7=['./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x20e7,0x178));var _0x720e=function(_0x58c462,_0x6fb9e1){_0x58c462=_0x58c462-0x0;var _0x580140=_0x20e7[_0x58c462];return _0x580140;};'use strict';var _=require(_0x720e('0x0'));var util=require(_0x720e('0x1'));var logger=require('../../config/logger')(_0x720e('0x2'));var moment=require(_0x720e('0x3'));var BPromise=require('bluebird');var rp=require(_0x720e('0x4'));var fs=require('fs');var path=require(_0x720e('0x5'));var rimraf=require(_0x720e('0x6'));var config=require(_0x720e('0x7'));var attributes=require(_0x720e('0x8'));module['exports']=function(_0x14ff38,_0x2b2c47){return _0x14ff38[_0x720e('0x9')](_0x720e('0xa'),attributes,{'tableName':_0x720e('0xb'),'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 25fdd87..bbaf15d 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 _0x7154=['../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','socket.io-emitter','redis','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7154,0xc4));var _0x4715=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x7154[_0x2f1114];return _0x2fe856;};'use strict';var _=require(_0x4715('0x0'));var util=require(_0x4715('0x1'));var moment=require('moment');var BPromise=require(_0x4715('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4715('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4715('0x4'));var logger=require(_0x4715('0x5'))(_0x4715('0x6'));var config=require('../../config/environment');var jayson=require(_0x4715('0x7'));var client=jayson['client'][_0x4715('0x8')]({'port':0x232a});config['redis']=_[_0x4715('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4715('0xa'))(new Redis(config[_0x4715('0xb')]));require('./dashboardItem.socket')[_0x4715('0xc')](socket);function respondWithRpcPromise(_0x85e214,_0x82d6d6,_0x301b70){return new BPromise(function(_0x55e658,_0x12ac6d){return client[_0x4715('0xd')](_0x85e214,_0x301b70)['then'](function(_0x4074ad){logger[_0x4715('0xe')](_0x4715('0xf'),_0x82d6d6,'request\x20sent');logger[_0x4715('0x10')](_0x4715('0x11'),_0x82d6d6,_0x4715('0x12'),JSON[_0x4715('0x13')](_0x4074ad));if(_0x4074ad[_0x4715('0x14')]){if(_0x4074ad[_0x4715('0x14')][_0x4715('0x15')]===0x1f4){logger['error'](_0x4715('0xf'),_0x82d6d6,_0x4074ad[_0x4715('0x14')][_0x4715('0x16')]);return _0x12ac6d(_0x4074ad['error'][_0x4715('0x16')]);}logger[_0x4715('0x14')](_0x4715('0xf'),_0x82d6d6,_0x4074ad['error'][_0x4715('0x16')]);return _0x55e658(_0x4074ad[_0x4715('0x14')]['message']);}else{logger['info'](_0x4715('0xf'),_0x82d6d6,_0x4715('0x12'));_0x55e658(_0x4074ad[_0x4715('0x17')][_0x4715('0x16')]);}})[_0x4715('0x18')](function(_0x3bc16a){logger[_0x4715('0x14')]('DashboardItem,\x20%s,\x20%s',_0x82d6d6,_0x3bc16a);_0x12ac6d(_0x3bc16a);});});} \ No newline at end of file +var _0x612b=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c3a92,_0x49a217){var _0x9d10ce=function(_0x187f8b){while(--_0x187f8b){_0x1c3a92['push'](_0x1c3a92['shift']());}};_0x9d10ce(++_0x49a217);}(_0x612b,0x147));var _0xb612=function(_0x166cbb,_0x4c692a){_0x166cbb=_0x166cbb-0x0;var _0x43a380=_0x612b[_0x166cbb];return _0x43a380;};'use strict';var _=require(_0xb612('0x0'));var util=require(_0xb612('0x1'));var moment=require('moment');var BPromise=require(_0xb612('0x2'));var rs=require(_0xb612('0x3'));var fs=require('fs');var Redis=require(_0xb612('0x4'));var db=require(_0xb612('0x5'))['db'];var utils=require(_0xb612('0x6'));var logger=require(_0xb612('0x7'))(_0xb612('0x8'));var config=require(_0xb612('0x9'));var jayson=require(_0xb612('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xb612('0xb')]=_[_0xb612('0xc')](config[_0xb612('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb612('0xd'))(new Redis(config[_0xb612('0xb')]));require('./dashboardItem.socket')[_0xb612('0xe')](socket);function respondWithRpcPromise(_0x14171a,_0x3fe9a4,_0x467935){return new BPromise(function(_0x1a74c5,_0x29ad94){return client[_0xb612('0xf')](_0x14171a,_0x467935)['then'](function(_0x116e77){logger[_0xb612('0x10')](_0xb612('0x11'),_0x3fe9a4,_0xb612('0x12'));logger[_0xb612('0x13')](_0xb612('0x14'),_0x3fe9a4,_0xb612('0x12'),JSON[_0xb612('0x15')](_0x116e77));if(_0x116e77['error']){if(_0x116e77[_0xb612('0x16')][_0xb612('0x17')]===0x1f4){logger[_0xb612('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3fe9a4,_0x116e77['error'][_0xb612('0x18')]);return _0x29ad94(_0x116e77[_0xb612('0x16')][_0xb612('0x18')]);}logger[_0xb612('0x16')](_0xb612('0x11'),_0x3fe9a4,_0x116e77['error'][_0xb612('0x18')]);return _0x1a74c5(_0x116e77[_0xb612('0x16')]['message']);}else{logger[_0xb612('0x10')](_0xb612('0x11'),_0x3fe9a4,'request\x20sent');_0x1a74c5(_0x116e77[_0xb612('0x19')][_0xb612('0x18')]);}})[_0xb612('0x1a')](function(_0xf6eb6d){logger[_0xb612('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3fe9a4,_0xf6eb6d);_0x29ad94(_0xf6eb6d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index e91b283..36102c8 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 _0x642e=['save','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x316ffa,_0xbb3481){var _0x19966a=function(_0x7013fa){while(--_0x7013fa){_0x316ffa['push'](_0x316ffa['shift']());}};_0x19966a(++_0xbb3481);}(_0x642e,0x148));var _0xe642=function(_0x4c3a5f,_0x205581){_0x4c3a5f=_0x4c3a5f-0x0;var _0x54bb2a=_0x642e[_0x4c3a5f];return _0x54bb2a;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xe642('0x0'),_0xe642('0x1'),_0xe642('0x2')];function createListener(_0x54679a,_0x418eec){return function(_0x3ed582){_0x418eec[_0xe642('0x3')](_0x54679a,_0x3ed582);};}function removeListener(_0x443c60,_0x5c1bda){return function(){DashboardItemEvents[_0xe642('0x4')](_0x443c60,_0x5c1bda);};}exports[_0xe642('0x5')]=function(_0x3d00db){for(var _0x274314=0x0,_0x9fea1a=events[_0xe642('0x6')];_0x274314<_0x9fea1a;_0x274314++){var _0x30d7ff=events[_0x274314];var _0x215145=createListener(_0xe642('0x7')+_0x30d7ff,_0x3d00db);DashboardItemEvents['on'](_0x30d7ff,_0x215145);}}; \ No newline at end of file +var _0xb881=['dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register','length'];(function(_0x1eee9a,_0x98444){var _0x267fbf=function(_0x2ac43f){while(--_0x2ac43f){_0x1eee9a['push'](_0x1eee9a['shift']());}};_0x267fbf(++_0x98444);}(_0xb881,0xe9));var _0x1b88=function(_0x51ba06,_0x4ed036){_0x51ba06=_0x51ba06-0x0;var _0x32a797=_0xb881[_0x51ba06];return _0x32a797;};'use strict';var DashboardItemEvents=require(_0x1b88('0x0'));var events=['save',_0x1b88('0x1'),_0x1b88('0x2')];function createListener(_0x13b341,_0x375219){return function(_0x5c7119){_0x375219[_0x1b88('0x3')](_0x13b341,_0x5c7119);};}function removeListener(_0x3d022e,_0x2dba8f){return function(){DashboardItemEvents[_0x1b88('0x4')](_0x3d022e,_0x2dba8f);};}exports[_0x1b88('0x5')]=function(_0x147e8c){for(var _0x3a1957=0x0,_0x36176c=events[_0x1b88('0x6')];_0x3a1957<_0x36176c;_0x3a1957++){var _0x44e2c8=events[_0x3a1957];var _0x4ff7aa=createListener(_0x1b88('0x7')+_0x44e2c8,_0x147e8c);DashboardItemEvents['on'](_0x44e2c8,_0x4ff7aa);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index eb891a3..d5ef2e7 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 _0x79a9=['exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x79a9,0xab));var _0x979a=function(_0x4e3b70,_0x120787){_0x4e3b70=_0x4e3b70-0x0;var _0x1355c9=_0x79a9[_0x4e3b70];return _0x1355c9;};'use strict';var multer=require(_0x979a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x979a('0x1'));var express=require(_0x979a('0x2'));var router=express['Router']();var fs_extra=require(_0x979a('0x3'));var auth=require(_0x979a('0x4'));var interaction=require(_0x979a('0x5'));var config=require('../../config/environment');var controller=require(_0x979a('0x6'));router[_0x979a('0x7')]('/:id',auth[_0x979a('0x8')](),controller['show']);router[_0x979a('0x9')]('/',auth['isAuthenticated'](),controller[_0x979a('0xa')]);router[_0x979a('0xb')](_0x979a('0xc'),auth[_0x979a('0x8')](),controller[_0x979a('0xd')]);router[_0x979a('0xe')](_0x979a('0xc'),auth['isAuthenticated'](),controller[_0x979a('0xf')]);module[_0x979a('0x10')]=router; \ No newline at end of file +var _0x9656=['/:id','show','post','isAuthenticated','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x9656,0xf6));var _0x6965=function(_0x3f92bb,_0x1fbe48){_0x3f92bb=_0x3f92bb-0x0;var _0x5e12e0=_0x9656[_0x3f92bb];return _0x5e12e0;};'use strict';var multer=require(_0x6965('0x0'));var util=require('util');var path=require(_0x6965('0x1'));var timeout=require('connect-timeout');var express=require(_0x6965('0x2'));var router=express[_0x6965('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6965('0x4'));var interaction=require(_0x6965('0x5'));var config=require(_0x6965('0x6'));var controller=require(_0x6965('0x7'));router[_0x6965('0x8')](_0x6965('0x9'),auth['isAuthenticated'](),controller[_0x6965('0xa')]);router[_0x6965('0xb')]('/',auth[_0x6965('0xc')](),controller['create']);router['put'](_0x6965('0x9'),auth[_0x6965('0xc')](),controller[_0x6965('0xd')]);router['delete'](_0x6965('0x9'),auth[_0x6965('0xc')](),controller[_0x6965('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 33e9eac..d2e63a9 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 _0x1b2c=['second','third','STRING','first'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x1b2c,0x152));var _0xc1b2=function(_0x3f67b4,_0xb0c4eb){_0x3f67b4=_0x3f67b4-0x0;var _0x4b10b4=_0x1b2c[_0x3f67b4];return _0x4b10b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc1b2('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xc1b2('0x1'),_0xc1b2('0x2'),_0xc1b2('0x3')),'allowNull':![],'defaultValue':_0xc1b2('0x1')},'description':{'type':Sequelize[_0xc1b2('0x0')]}}; \ No newline at end of file +var _0x37d2=['third','first','sequelize','exports','STRING','ENUM'];(function(_0x7f8ffa,_0x52e224){var _0x19ec7c=function(_0x59f0ae){while(--_0x59f0ae){_0x7f8ffa['push'](_0x7f8ffa['shift']());}};_0x19ec7c(++_0x52e224);}(_0x37d2,0xe6));var _0x237d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x37d2[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x237d('0x0'));module[_0x237d('0x1')]={'name':{'type':Sequelize[_0x237d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x237d('0x3')]('first','second',_0x237d('0x4')),'allowNull':![],'defaultValue':_0x237d('0x5')},'description':{'type':Sequelize[_0x237d('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ebeffe7..e9c55bf 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 _0xca61=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','Dispositions','UserProfileResource','then','end','error','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','Disposition','findAll','rows','catch','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x5c34a1,_0x598d2c){var _0x460503=function(_0x10de7b){while(--_0x10de7b){_0x5c34a1['push'](_0x5c34a1['shift']());}};_0x460503(++_0x598d2c);}(_0xca61,0x1be));var _0x1ca6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca61[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x1ca6('0x0'));var rimraf=require(_0x1ca6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ca6('0x2'));var rp=require(_0x1ca6('0x3'));var moment=require(_0x1ca6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1ca6('0x5'));var sox=require(_0x1ca6('0x6'));var csv=require('to-csv');var ejs=require(_0x1ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x1ca6('0x8'));var _=require('lodash');var squel=require(_0x1ca6('0x9'));var crypto=require(_0x1ca6('0xa'));var jsforce=require(_0x1ca6('0xb'));var deskjs=require(_0x1ca6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1ca6('0xd'));var Papa=require(_0x1ca6('0xe'));var Redis=require('ioredis');var authService=require(_0x1ca6('0xf'));var qs=require(_0x1ca6('0x10'));var as=require(_0x1ca6('0x11'));var hardwareService=require(_0x1ca6('0x12'));var logger=require('../../config/logger')(_0x1ca6('0x13'));var utils=require(_0x1ca6('0x14'));var config=require(_0x1ca6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238fa2,_0x30725f){_0x30725f=_0x30725f||0xcc;return function(_0x49d574){if(_0x49d574){return _0x238fa2['sendStatus'](_0x30725f);}return _0x238fa2[_0x1ca6('0x16')](_0x30725f)['end']();};}function respondWithResult(_0x27c1b5,_0x470518){_0x470518=_0x470518||0xc8;return function(_0x41b87e){if(_0x41b87e){return _0x27c1b5[_0x1ca6('0x16')](_0x470518)[_0x1ca6('0x17')](_0x41b87e);}};}function respondWithFilteredResult(_0x114972,_0x3a0250){return function(_0x38e9da){if(_0x38e9da){var _0x23adc6=typeof _0x3a0250[_0x1ca6('0x18')]===_0x1ca6('0x19')&&typeof _0x3a0250[_0x1ca6('0x1a')]==='undefined';var _0x4a73b3=_0x38e9da[_0x1ca6('0x1b')];var _0x20adde=_0x23adc6?0x0:_0x3a0250[_0x1ca6('0x18')];var _0x558ebf=_0x23adc6?_0x38e9da[_0x1ca6('0x1b')]:_0x3a0250[_0x1ca6('0x18')]+_0x3a0250[_0x1ca6('0x1a')];var _0x14cd3d;if(_0x558ebf>=_0x4a73b3){_0x558ebf=_0x4a73b3;_0x14cd3d=0xc8;}else{_0x14cd3d=0xce;}_0x114972[_0x1ca6('0x16')](_0x14cd3d);return _0x114972[_0x1ca6('0x1c')]('Content-Range',_0x20adde+'-'+_0x558ebf+'/'+_0x4a73b3)[_0x1ca6('0x17')](_0x38e9da);}return null;};}function patchUpdates(_0x3e6e07){return function(_0x3bee4d){try{jsonpatch['apply'](_0x3bee4d,_0x3e6e07,!![]);}catch(_0x355553){return BPromise[_0x1ca6('0x1d')](_0x355553);}return _0x3bee4d[_0x1ca6('0x1e')]();};}function saveUpdates(_0x113d53,_0x41fce6){return function(_0x522ac0){if(_0x522ac0){return _0x522ac0[_0x1ca6('0x1f')](_0x113d53)['then'](function(_0x26f107){return _0x26f107;});}return null;};}function removeEntity(_0x544dc2,_0x28b04a){return function(_0x40fe21){if(_0x40fe21){return _0x40fe21[_0x1ca6('0x20')]()['then'](function(){var _0x5686de=_0x40fe21['get']({'plain':!![]});var _0x300227=_0x1ca6('0x21');return db[_0x1ca6('0x22')][_0x1ca6('0x20')]({'where':{'type':_0x300227,'resourceId':_0x5686de['id']}})['then'](function(){return _0x40fe21;});})[_0x1ca6('0x23')](function(){_0x544dc2[_0x1ca6('0x16')](0xcc)[_0x1ca6('0x24')]();});}};}function handleEntityNotFound(_0x255ad6,_0x4cf13f){return function(_0x108b01){if(!_0x108b01){_0x255ad6['sendStatus'](0x194);}return _0x108b01;};}function handleError(_0x263bff,_0x4df6fb){_0x4df6fb=_0x4df6fb||0x1f4;return function(_0x481a55){logger[_0x1ca6('0x25')](_0x481a55['stack']);if(_0x481a55['name']){delete _0x481a55['name'];}_0x263bff[_0x1ca6('0x16')](_0x4df6fb)[_0x1ca6('0x26')](_0x481a55);};}exports[_0x1ca6('0x27')]=function(_0x3aef86,_0x359962){var _0x29b5ac={},_0x2a6d9b={},_0x3fa570={'count':0x0,'rows':[]};var _0x53ee5a=_[_0x1ca6('0x28')](db['Disposition'][_0x1ca6('0x29')],function(_0x50e051){return{'name':_0x50e051[_0x1ca6('0x2a')],'type':_0x50e051['type']['key']};});_0x2a6d9b[_0x1ca6('0x2b')]=_[_0x1ca6('0x28')](_0x53ee5a,'name');_0x2a6d9b[_0x1ca6('0x2c')]=_[_0x1ca6('0x2d')](_0x3aef86[_0x1ca6('0x2c')]);_0x2a6d9b[_0x1ca6('0x2e')]=_[_0x1ca6('0x2f')](_0x2a6d9b[_0x1ca6('0x2b')],_0x2a6d9b[_0x1ca6('0x2c')]);_0x29b5ac[_0x1ca6('0x30')]=_[_0x1ca6('0x2f')](_0x2a6d9b['model'],qs[_0x1ca6('0x31')](_0x3aef86['query'][_0x1ca6('0x31')]));_0x29b5ac[_0x1ca6('0x30')]=_0x29b5ac['attributes'][_0x1ca6('0x32')]?_0x29b5ac['attributes']:_0x2a6d9b[_0x1ca6('0x2b')];if(!_0x3aef86['query'][_0x1ca6('0x33')]('nolimit')){_0x29b5ac['limit']=qs[_0x1ca6('0x1a')](_0x3aef86[_0x1ca6('0x2c')]['limit']);_0x29b5ac[_0x1ca6('0x18')]=qs['offset'](_0x3aef86['query']['offset']);}_0x29b5ac['order']=qs[_0x1ca6('0x34')](_0x3aef86[_0x1ca6('0x2c')][_0x1ca6('0x34')]);_0x29b5ac[_0x1ca6('0x35')]=qs[_0x1ca6('0x2e')](_[_0x1ca6('0x36')](_0x3aef86[_0x1ca6('0x2c')],_0x2a6d9b[_0x1ca6('0x2e')]),_0x53ee5a);if(_0x3aef86[_0x1ca6('0x2c')]['filter']){_0x29b5ac[_0x1ca6('0x35')]=_['merge'](_0x29b5ac[_0x1ca6('0x35')],{'$or':_[_0x1ca6('0x28')](_0x53ee5a,function(_0x305846){if(_0x305846['type']!==_0x1ca6('0x37')){var _0x4d2ddf={};_0x4d2ddf[_0x305846[_0x1ca6('0x38')]]={'$like':'%'+_0x3aef86[_0x1ca6('0x2c')][_0x1ca6('0x39')]+'%'};return _0x4d2ddf;}})});}_0x29b5ac=_[_0x1ca6('0x3a')]({},_0x29b5ac,_0x3aef86[_0x1ca6('0x3b')]);var _0x553513={'where':_0x29b5ac[_0x1ca6('0x35')]};return db['Disposition']['count'](_0x553513)['then'](function(_0x1fef48){_0x3fa570[_0x1ca6('0x1b')]=_0x1fef48;if(_0x3aef86[_0x1ca6('0x2c')][_0x1ca6('0x3c')]){_0x29b5ac['include']=[{'all':!![]}];}return db[_0x1ca6('0x3d')][_0x1ca6('0x3e')](_0x29b5ac);})[_0x1ca6('0x23')](function(_0x645f5){_0x3fa570[_0x1ca6('0x3f')]=_0x645f5;return _0x3fa570;})[_0x1ca6('0x23')](respondWithFilteredResult(_0x359962,_0x29b5ac))[_0x1ca6('0x40')](handleError(_0x359962,null));};exports['show']=function(_0xedd219,_0x10b017){var _0x2091cb={'raw':!![],'where':{'id':_0xedd219['params']['id']}},_0x4be60a={};_0x4be60a[_0x1ca6('0x2b')]=_[_0x1ca6('0x2d')](db[_0x1ca6('0x3d')]['rawAttributes']);_0x4be60a[_0x1ca6('0x2c')]=_['keys'](_0xedd219['query']);_0x4be60a[_0x1ca6('0x2e')]=_[_0x1ca6('0x2f')](_0x4be60a['model'],_0x4be60a['query']);_0x2091cb[_0x1ca6('0x30')]=_[_0x1ca6('0x2f')](_0x4be60a['model'],qs[_0x1ca6('0x31')](_0xedd219[_0x1ca6('0x2c')][_0x1ca6('0x31')]));_0x2091cb[_0x1ca6('0x30')]=_0x2091cb[_0x1ca6('0x30')][_0x1ca6('0x32')]?_0x2091cb[_0x1ca6('0x30')]:_0x4be60a[_0x1ca6('0x2b')];if(_0xedd219[_0x1ca6('0x2c')][_0x1ca6('0x3c')]){_0x2091cb[_0x1ca6('0x41')]=[{'all':!![]}];}_0x2091cb=_[_0x1ca6('0x3a')]({},_0x2091cb,_0xedd219[_0x1ca6('0x3b')]);return db[_0x1ca6('0x3d')][_0x1ca6('0x42')](_0x2091cb)['then'](handleEntityNotFound(_0x10b017,null))[_0x1ca6('0x23')](respondWithResult(_0x10b017,null))[_0x1ca6('0x40')](handleError(_0x10b017,null));};exports[_0x1ca6('0x43')]=function(_0x11db33,_0x4ba6ff){return db[_0x1ca6('0x3d')]['create'](_0x11db33[_0x1ca6('0x44')],{})[_0x1ca6('0x23')](function(_0x5d5064){var _0x570599=_0x11db33['user']['get']({'plain':!![]});if(!_0x570599)throw new Error(_0x1ca6('0x45'));if(_0x570599['role']==='user'){var _0x1d73cd=_0x5d5064['get']({'plain':!![]});var _0x1b1339=_0x1ca6('0x21');return db[_0x1ca6('0x46')][_0x1ca6('0x42')]({'where':{'name':_0x1b1339,'userProfileId':_0x570599[_0x1ca6('0x47')]},'raw':!![]})[_0x1ca6('0x23')](function(_0xe63bcf){if(_0xe63bcf&&_0xe63bcf['autoAssociation']===0x0){return db[_0x1ca6('0x22')][_0x1ca6('0x43')]({'name':_0x1d73cd[_0x1ca6('0x38')],'resourceId':_0x1d73cd['id'],'type':_0xe63bcf[_0x1ca6('0x38')],'sectionId':_0xe63bcf['id']},{})[_0x1ca6('0x23')](function(){return _0x5d5064;});}else{return _0x5d5064;}})['catch'](function(_0x72a426){logger[_0x1ca6('0x25')](_0x1ca6('0x48'),_0x72a426);throw _0x72a426;});}return _0x5d5064;})[_0x1ca6('0x23')](respondWithResult(_0x4ba6ff,0xc9))[_0x1ca6('0x40')](handleError(_0x4ba6ff,null));};exports[_0x1ca6('0x1f')]=function(_0x2f8015,_0x457bf0){if(_0x2f8015[_0x1ca6('0x44')]['id']){delete _0x2f8015[_0x1ca6('0x44')]['id'];}return db[_0x1ca6('0x3d')][_0x1ca6('0x42')]({'where':{'id':_0x2f8015['params']['id']}})[_0x1ca6('0x23')](handleEntityNotFound(_0x457bf0,null))[_0x1ca6('0x23')](saveUpdates(_0x2f8015[_0x1ca6('0x44')],null))['then'](respondWithResult(_0x457bf0,null))['catch'](handleError(_0x457bf0,null));};exports['destroy']=function(_0xb6c150,_0x2155fb){return db[_0x1ca6('0x3d')][_0x1ca6('0x42')]({'where':{'id':_0xb6c150[_0x1ca6('0x49')]['id']}})[_0x1ca6('0x23')](handleEntityNotFound(_0x2155fb,null))[_0x1ca6('0x23')](removeEntity(_0x2155fb,null))[_0x1ca6('0x40')](handleError(_0x2155fb,null));}; \ No newline at end of file +var _0x6347=['bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','Dispositions','then','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x6347,0x1c9));var _0x7634=function(_0x4bbd75,_0x71df2c){_0x4bbd75=_0x4bbd75-0x0;var _0x1358e0=_0x6347[_0x4bbd75];return _0x1358e0;};'use strict';var emlformat=require(_0x7634('0x0'));var rimraf=require(_0x7634('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7634('0x2'));var rp=require(_0x7634('0x3'));var moment=require(_0x7634('0x4'));var BPromise=require(_0x7634('0x5'));var Mustache=require('mustache');var util=require(_0x7634('0x6'));var path=require('path');var sox=require(_0x7634('0x7'));var csv=require(_0x7634('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7634('0x9'));var squel=require(_0x7634('0xa'));var crypto=require(_0x7634('0xb'));var jsforce=require(_0x7634('0xc'));var deskjs=require(_0x7634('0xd'));var toCsv=require(_0x7634('0x8'));var querystring=require('querystring');var Papa=require(_0x7634('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7634('0xf'));var hardwareService=require(_0x7634('0x10'));var logger=require(_0x7634('0x11'))(_0x7634('0x12'));var utils=require(_0x7634('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7634('0x14'))['db'];function respondWithStatusCode(_0x1bde2c,_0x15c1bd){_0x15c1bd=_0x15c1bd||0xcc;return function(_0x22213f){if(_0x22213f){return _0x1bde2c[_0x7634('0x15')](_0x15c1bd);}return _0x1bde2c[_0x7634('0x16')](_0x15c1bd)[_0x7634('0x17')]();};}function respondWithResult(_0x2b505a,_0x54d77b){_0x54d77b=_0x54d77b||0xc8;return function(_0x3b0fd4){if(_0x3b0fd4){return _0x2b505a[_0x7634('0x16')](_0x54d77b)[_0x7634('0x18')](_0x3b0fd4);}};}function respondWithFilteredResult(_0x20dc07,_0x47b1b7){return function(_0x1f58f7){if(_0x1f58f7){var _0x4be9c7=typeof _0x47b1b7[_0x7634('0x19')]===_0x7634('0x1a')&&typeof _0x47b1b7[_0x7634('0x1b')]===_0x7634('0x1a');var _0x5cfed7=_0x1f58f7[_0x7634('0x1c')];var _0x4832e3=_0x4be9c7?0x0:_0x47b1b7[_0x7634('0x19')];var _0x3f8074=_0x4be9c7?_0x1f58f7['count']:_0x47b1b7[_0x7634('0x19')]+_0x47b1b7[_0x7634('0x1b')];var _0x5a95e2;if(_0x3f8074>=_0x5cfed7){_0x3f8074=_0x5cfed7;_0x5a95e2=0xc8;}else{_0x5a95e2=0xce;}_0x20dc07[_0x7634('0x16')](_0x5a95e2);return _0x20dc07['set'](_0x7634('0x1d'),_0x4832e3+'-'+_0x3f8074+'/'+_0x5cfed7)['json'](_0x1f58f7);}return null;};}function patchUpdates(_0x475635){return function(_0xbe6288){try{jsonpatch[_0x7634('0x1e')](_0xbe6288,_0x475635,!![]);}catch(_0x42b977){return BPromise['reject'](_0x42b977);}return _0xbe6288[_0x7634('0x1f')]();};}function saveUpdates(_0x347a56,_0x2a2538){return function(_0x462461){if(_0x462461){return _0x462461[_0x7634('0x20')](_0x347a56)['then'](function(_0xc68369){return _0xc68369;});}return null;};}function removeEntity(_0x5d3418,_0x40e3a8){return function(_0x2ab4fc){if(_0x2ab4fc){return _0x2ab4fc['destroy']()['then'](function(){var _0x59f821=_0x2ab4fc[_0x7634('0x21')]({'plain':!![]});var _0x512776=_0x7634('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x512776,'resourceId':_0x59f821['id']}})[_0x7634('0x23')](function(){return _0x2ab4fc;});})['then'](function(){_0x5d3418[_0x7634('0x16')](0xcc)[_0x7634('0x17')]();});}};}function handleEntityNotFound(_0x4cd8e5,_0x81ba23){return function(_0x40d5fc){if(!_0x40d5fc){_0x4cd8e5[_0x7634('0x15')](0x194);}return _0x40d5fc;};}function handleError(_0x352584,_0x3afa24){_0x3afa24=_0x3afa24||0x1f4;return function(_0x4df6d6){logger[_0x7634('0x24')](_0x4df6d6[_0x7634('0x25')]);if(_0x4df6d6['name']){delete _0x4df6d6[_0x7634('0x26')];}_0x352584[_0x7634('0x16')](_0x3afa24)[_0x7634('0x27')](_0x4df6d6);};}exports[_0x7634('0x28')]=function(_0x597455,_0x2016b0){var _0x2800e6={},_0x1fc451={},_0x48bf00={'count':0x0,'rows':[]};var _0x5df146=_[_0x7634('0x29')](db[_0x7634('0x2a')][_0x7634('0x2b')],function(_0x16123d){return{'name':_0x16123d[_0x7634('0x2c')],'type':_0x16123d[_0x7634('0x2d')]['key']};});_0x1fc451[_0x7634('0x2e')]=_[_0x7634('0x29')](_0x5df146,'name');_0x1fc451[_0x7634('0x2f')]=_['keys'](_0x597455[_0x7634('0x2f')]);_0x1fc451['filters']=_['intersection'](_0x1fc451[_0x7634('0x2e')],_0x1fc451[_0x7634('0x2f')]);_0x2800e6[_0x7634('0x30')]=_['intersection'](_0x1fc451['model'],qs[_0x7634('0x31')](_0x597455[_0x7634('0x2f')][_0x7634('0x31')]));_0x2800e6[_0x7634('0x30')]=_0x2800e6['attributes'][_0x7634('0x32')]?_0x2800e6[_0x7634('0x30')]:_0x1fc451[_0x7634('0x2e')];if(!_0x597455[_0x7634('0x2f')][_0x7634('0x33')](_0x7634('0x34'))){_0x2800e6[_0x7634('0x1b')]=qs[_0x7634('0x1b')](_0x597455[_0x7634('0x2f')][_0x7634('0x1b')]);_0x2800e6[_0x7634('0x19')]=qs['offset'](_0x597455[_0x7634('0x2f')][_0x7634('0x19')]);}_0x2800e6['order']=qs[_0x7634('0x35')](_0x597455['query'][_0x7634('0x35')]);_0x2800e6[_0x7634('0x36')]=qs[_0x7634('0x37')](_[_0x7634('0x38')](_0x597455[_0x7634('0x2f')],_0x1fc451['filters']),_0x5df146);if(_0x597455['query'][_0x7634('0x39')]){_0x2800e6[_0x7634('0x36')]=_[_0x7634('0x3a')](_0x2800e6[_0x7634('0x36')],{'$or':_[_0x7634('0x29')](_0x5df146,function(_0x38acfc){if(_0x38acfc[_0x7634('0x2d')]!==_0x7634('0x3b')){var _0x5ad900={};_0x5ad900[_0x38acfc[_0x7634('0x26')]]={'$like':'%'+_0x597455[_0x7634('0x2f')][_0x7634('0x39')]+'%'};return _0x5ad900;}})});}_0x2800e6=_['merge']({},_0x2800e6,_0x597455[_0x7634('0x3c')]);var _0x16e152={'where':_0x2800e6[_0x7634('0x36')]};return db[_0x7634('0x2a')][_0x7634('0x1c')](_0x16e152)[_0x7634('0x23')](function(_0x25152f){_0x48bf00[_0x7634('0x1c')]=_0x25152f;if(_0x597455['query'][_0x7634('0x3d')]){_0x2800e6['include']=[{'all':!![]}];}return db[_0x7634('0x2a')][_0x7634('0x3e')](_0x2800e6);})['then'](function(_0x5a7b65){_0x48bf00[_0x7634('0x3f')]=_0x5a7b65;return _0x48bf00;})['then'](respondWithFilteredResult(_0x2016b0,_0x2800e6))[_0x7634('0x40')](handleError(_0x2016b0,null));};exports[_0x7634('0x41')]=function(_0x3b822d,_0x56063c){var _0x4cf397={'raw':!![],'where':{'id':_0x3b822d[_0x7634('0x42')]['id']}},_0x391162={};_0x391162[_0x7634('0x2e')]=_[_0x7634('0x43')](db[_0x7634('0x2a')]['rawAttributes']);_0x391162[_0x7634('0x2f')]=_[_0x7634('0x43')](_0x3b822d['query']);_0x391162['filters']=_[_0x7634('0x44')](_0x391162[_0x7634('0x2e')],_0x391162[_0x7634('0x2f')]);_0x4cf397[_0x7634('0x30')]=_[_0x7634('0x44')](_0x391162[_0x7634('0x2e')],qs[_0x7634('0x31')](_0x3b822d[_0x7634('0x2f')][_0x7634('0x31')]));_0x4cf397[_0x7634('0x30')]=_0x4cf397['attributes'][_0x7634('0x32')]?_0x4cf397[_0x7634('0x30')]:_0x391162['model'];if(_0x3b822d[_0x7634('0x2f')][_0x7634('0x3d')]){_0x4cf397['include']=[{'all':!![]}];}_0x4cf397=_[_0x7634('0x3a')]({},_0x4cf397,_0x3b822d[_0x7634('0x3c')]);return db['Disposition']['find'](_0x4cf397)['then'](handleEntityNotFound(_0x56063c,null))[_0x7634('0x23')](respondWithResult(_0x56063c,null))[_0x7634('0x40')](handleError(_0x56063c,null));};exports[_0x7634('0x45')]=function(_0x122ccf,_0x438082){return db['Disposition'][_0x7634('0x45')](_0x122ccf[_0x7634('0x46')],{})[_0x7634('0x23')](function(_0x1126d3){var _0x58551f=_0x122ccf[_0x7634('0x47')][_0x7634('0x21')]({'plain':!![]});if(!_0x58551f)throw new Error(_0x7634('0x48'));if(_0x58551f['role']===_0x7634('0x47')){var _0x5c56c8=_0x1126d3[_0x7634('0x21')]({'plain':!![]});var _0x1288af='Dispositions';return db['UserProfileSection'][_0x7634('0x49')]({'where':{'name':_0x1288af,'userProfileId':_0x58551f[_0x7634('0x4a')]},'raw':!![]})[_0x7634('0x23')](function(_0x164f38){if(_0x164f38&&_0x164f38['autoAssociation']===0x0){return db['UserProfileResource'][_0x7634('0x45')]({'name':_0x5c56c8[_0x7634('0x26')],'resourceId':_0x5c56c8['id'],'type':_0x164f38[_0x7634('0x26')],'sectionId':_0x164f38['id']},{})['then'](function(){return _0x1126d3;});}else{return _0x1126d3;}})['catch'](function(_0x121e9b){logger[_0x7634('0x24')](_0x7634('0x4b'),_0x121e9b);throw _0x121e9b;});}return _0x1126d3;})['then'](respondWithResult(_0x438082,0xc9))[_0x7634('0x40')](handleError(_0x438082,null));};exports['update']=function(_0xb00f20,_0x34dfed){if(_0xb00f20[_0x7634('0x46')]['id']){delete _0xb00f20['body']['id'];}return db[_0x7634('0x2a')][_0x7634('0x49')]({'where':{'id':_0xb00f20['params']['id']}})['then'](handleEntityNotFound(_0x34dfed,null))[_0x7634('0x23')](saveUpdates(_0xb00f20[_0x7634('0x46')],null))[_0x7634('0x23')](respondWithResult(_0x34dfed,null))[_0x7634('0x40')](handleError(_0x34dfed,null));};exports[_0x7634('0x4c')]=function(_0x4f7d08,_0x51121a){return db[_0x7634('0x2a')][_0x7634('0x49')]({'where':{'id':_0x4f7d08[_0x7634('0x42')]['id']}})[_0x7634('0x23')](handleEntityNotFound(_0x51121a,null))[_0x7634('0x23')](removeEntity(_0x51121a,null))[_0x7634('0x40')](handleError(_0x51121a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1fe2dc7..ae74e3c 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 _0x0a3c=['name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','api','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ChatWebsiteId','name_sms','SmsAccountId'];(function(_0x2f64e8,_0x1449b9){var _0x2ef21f=function(_0x1da082){while(--_0x1da082){_0x2f64e8['push'](_0x2f64e8['shift']());}};_0x2ef21f(++_0x1449b9);}(_0x0a3c,0x15a));var _0xc0a3=function(_0x6c3293,_0x30b263){_0x6c3293=_0x6c3293-0x0;var _0x21c76f=_0x0a3c[_0x6c3293];return _0x21c76f;};'use strict';var _=require(_0xc0a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc0a3('0x2'));var fs=require('fs');var path=require(_0xc0a3('0x3'));var rimraf=require('rimraf');var config=require(_0xc0a3('0x4'));var attributes=require(_0xc0a3('0x5'));module[_0xc0a3('0x6')]=function(_0xb7f9d0,_0x398dc0){return _0xb7f9d0[_0xc0a3('0x7')](_0xc0a3('0x8'),attributes,{'tableName':_0xc0a3('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc0a3('0xa'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xc0a3('0xa'),_0xc0a3('0xb')]},{'unique':!![],'name':'name_mail','fields':[_0xc0a3('0xa'),'MailAccountId']},{'unique':!![],'name':_0xc0a3('0xc'),'fields':[_0xc0a3('0xa'),_0xc0a3('0xd')]},{'unique':!![],'name':_0xc0a3('0xe'),'fields':[_0xc0a3('0xa'),_0xc0a3('0xf')]},{'unique':!![],'name':'name_openchannel','fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xc0a3('0x10'),'fields':[_0xc0a3('0xa'),_0xc0a3('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9aa=['name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x227743,_0x3ae9b9){var _0x55df7a=function(_0xe1db87){while(--_0xe1db87){_0x227743['push'](_0x227743['shift']());}};_0x55df7a(++_0x3ae9b9);}(_0xf9aa,0x171));var _0xaf9a=function(_0x9a7d5b,_0x50327f){_0x9a7d5b=_0x9a7d5b-0x0;var _0xe2a5b3=_0xf9aa[_0x9a7d5b];return _0xe2a5b3;};'use strict';var _=require(_0xaf9a('0x0'));var util=require(_0xaf9a('0x1'));var logger=require(_0xaf9a('0x2'))(_0xaf9a('0x3'));var moment=require(_0xaf9a('0x4'));var BPromise=require(_0xaf9a('0x5'));var rp=require(_0xaf9a('0x6'));var fs=require('fs');var path=require(_0xaf9a('0x7'));var rimraf=require(_0xaf9a('0x8'));var config=require(_0xaf9a('0x9'));var attributes=require(_0xaf9a('0xa'));module[_0xaf9a('0xb')]=function(_0x174ec2,_0x13ab01){return _0x174ec2['define'](_0xaf9a('0xc'),attributes,{'tableName':_0xaf9a('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xaf9a('0xe'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x10')]},{'unique':!![],'name':_0xaf9a('0x11'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x12')]},{'unique':!![],'name':_0xaf9a('0x13'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x14')]},{'unique':!![],'name':_0xaf9a('0x15'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x16')]},{'unique':!![],'name':_0xaf9a('0x17'),'fields':['name',_0xaf9a('0x18')]},{'unique':!![],'name':_0xaf9a('0x19'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xaf9a('0x1a'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x1b')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4f28e30..e5aa5f5 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(_0x175de2,_0x598776){var _0x179817=function(_0x280f04){while(--_0x280f04){_0x175de2['push'](_0x175de2['shift']());}};_0x179817(++_0x598776);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x4bcf58,_0x1fab13){var _0x417292=function(_0x3c34f8){while(--_0x3c34f8){_0x4bcf58['push'](_0x4bcf58['shift']());}};_0x417292(++_0x1fab13);}(_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);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 9269275..de65701 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 _0x87df=['fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x23c330,_0x4d7dd3){var _0x3d8227=function(_0x356ed6){while(--_0x356ed6){_0x23c330['push'](_0x23c330['shift']());}};_0x3d8227(++_0x4d7dd3);}(_0x87df,0x1e9));var _0xf87d=function(_0x5b9692,_0x1e4e4c){_0x5b9692=_0x5b9692-0x0;var _0x4a32f0=_0x87df[_0x5b9692];return _0x4a32f0;};'use strict';var multer=require(_0xf87d('0x0'));var util=require(_0xf87d('0x1'));var path=require(_0xf87d('0x2'));var timeout=require(_0xf87d('0x3'));var express=require(_0xf87d('0x4'));var router=express['Router']();var fs_extra=require(_0xf87d('0x5'));var auth=require(_0xf87d('0x6'));var interaction=require(_0xf87d('0x7'));var config=require('../../config/environment');var controller=require(_0xf87d('0x8'));router[_0xf87d('0x9')]('/',auth['isAuthenticated'](),controller[_0xf87d('0xa')]);router[_0xf87d('0x9')](_0xf87d('0xb'),auth[_0xf87d('0xc')](),controller[_0xf87d('0xd')]);router['post']('/',auth[_0xf87d('0xc')](),controller[_0xf87d('0xe')]);router[_0xf87d('0xf')]('/:id',auth[_0xf87d('0xc')](),controller[_0xf87d('0x10')]);router[_0xf87d('0x11')](_0xf87d('0xb'),auth['isAuthenticated'](),controller[_0xf87d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7e7a=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x1e4134,_0x333db3){var _0x480df4=function(_0x7de484){while(--_0x7de484){_0x1e4134['push'](_0x1e4134['shift']());}};_0x480df4(++_0x333db3);}(_0x7e7a,0xf4));var _0xa7e7=function(_0x11170a,_0x18ecb8){_0x11170a=_0x11170a-0x0;var _0x5827e1=_0x7e7a[_0x11170a];return _0x5827e1;};'use strict';var multer=require(_0xa7e7('0x0'));var util=require(_0xa7e7('0x1'));var path=require('path');var timeout=require(_0xa7e7('0x2'));var express=require(_0xa7e7('0x3'));var router=express[_0xa7e7('0x4')]();var fs_extra=require(_0xa7e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7e7('0x6'));var config=require(_0xa7e7('0x7'));var controller=require(_0xa7e7('0x8'));router[_0xa7e7('0x9')]('/',auth[_0xa7e7('0xa')](),controller[_0xa7e7('0xb')]);router[_0xa7e7('0x9')]('/:id',auth[_0xa7e7('0xa')](),controller[_0xa7e7('0xc')]);router[_0xa7e7('0xd')]('/',auth[_0xa7e7('0xa')](),controller[_0xa7e7('0xe')]);router['put'](_0xa7e7('0xf'),auth['isAuthenticated'](),controller[_0xa7e7('0x10')]);router[_0xa7e7('0x11')](_0xa7e7('0xf'),auth['isAuthenticated'](),controller[_0xa7e7('0x12')]);module[_0xa7e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index be1aeb2..8ce64fe 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 _0xbff5=['v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400'];(function(_0x3f94ca,_0x57a945){var _0x1927d7=function(_0x31538b){while(--_0x31538b){_0x3f94ca['push'](_0x3f94ca['shift']());}};_0x1927d7(++_0x57a945);}(_0xbff5,0x1bc));var _0x5bff=function(_0x4dc6d2,_0x311ed4){_0x4dc6d2=_0x4dc6d2-0x0;var _0x2d95dd=_0xbff5[_0x4dc6d2];return _0x2d95dd;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'name':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5bff('0x2')]},'ecm':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x4'),'no'),'defaultValue':_0x5bff('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x6'),_0x5bff('0x7'),_0x5bff('0x8'),_0x5bff('0x9'),_0x5bff('0xa'),_0x5bff('0xb')),'defaultValue':_0x5bff('0x7')},'maxrate':{'type':Sequelize[_0x5bff('0x3')]('2400',_0x5bff('0x7'),'7200',_0x5bff('0x9'),_0x5bff('0xa'),'14400'),'defaultValue':_0x5bff('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5bff('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5bff('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5bff('0xe'),'IAX',_0x5bff('0xf'),_0x5bff('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5bff('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5bff('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![],'comment':_0x5bff('0x14'),'set':function(_0x546351){if(!_0x546351)this[_0x5bff('0x15')](_0x5bff('0x16'),null);this[_0x5bff('0x15')](_0x5bff('0x17'),_0x546351);}}}; \ No newline at end of file +var _0xdf55=['INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xdf55,0x83));var _0x5df5=function(_0x4c9cb5,_0xcf85d4){_0x4c9cb5=_0x4c9cb5-0x0;var _0x20310b=_0xdf55[_0x4c9cb5];return _0x20310b;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5df5('0x2')]},'ecm':{'type':Sequelize[_0x5df5('0x3')]('yes','no'),'defaultValue':_0x5df5('0x4')},'headerinfo':{'type':Sequelize[_0x5df5('0x2')],'defaultValue':_0x5df5('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x5df5('0x6')},'minrate':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0x7'),_0x5df5('0x8'),_0x5df5('0x9'),_0x5df5('0xa'),_0x5df5('0xb'),_0x5df5('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0x7'),_0x5df5('0x8'),'7200','9600',_0x5df5('0xb'),'14400'),'defaultValue':_0x5df5('0xc')},'modem':{'type':Sequelize[_0x5df5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5df5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5df5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0xe'),_0x5df5('0xf'),_0x5df5('0x10'),_0x5df5('0x11')),'defaultValue':_0x5df5('0xe')},'key':{'type':Sequelize[_0x5df5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5df5('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5df5('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5df5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5df5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5df5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5df5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5df5('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5df5('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x5df5('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5df5('0x15'),'set':function(_0x45813f){if(!_0x45813f)this[_0x5df5('0x16')](_0x5df5('0x17'),null);this[_0x5df5('0x16')]('mandatoryDisposition',_0x45813f);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c06b3f9..71a3d03 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 _0x2bbb=['filter','options','includeAll','include','findAll','rows','params','Pause','mandatoryDispositionPause','find','create','body','user','role','UserProfileSection','autoAssociation','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','pick','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','priority','appdata','Answer','push','gateway','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','findById','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','ListId','out','Contact\x20not\x20found','spread','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','count','limit','json','apply','save','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','FaxAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2bbb,0x131));var _0xb2bb=function(_0x16bd81,_0xccc0e5){_0x16bd81=_0x16bd81-0x0;var _0x3be706=_0x2bbb[_0x16bd81];return _0x3be706;};'use strict';var emlformat=require(_0xb2bb('0x0'));var rimraf=require(_0xb2bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2bb('0x2'));var rp=require(_0xb2bb('0x3'));var moment=require(_0xb2bb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb2bb('0x5'));var util=require(_0xb2bb('0x6'));var path=require('path');var sox=require(_0xb2bb('0x7'));var csv=require(_0xb2bb('0x8'));var ejs=require(_0xb2bb('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bb('0xa'));var _=require(_0xb2bb('0xb'));var squel=require(_0xb2bb('0xc'));var crypto=require(_0xb2bb('0xd'));var jsforce=require(_0xb2bb('0xe'));var deskjs=require(_0xb2bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb2bb('0x10'));var Papa=require(_0xb2bb('0x11'));var Redis=require(_0xb2bb('0x12'));var authService=require(_0xb2bb('0x13'));var qs=require(_0xb2bb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2bb('0x15'));var logger=require(_0xb2bb('0x16'))(_0xb2bb('0x17'));var utils=require(_0xb2bb('0x18'));var config=require(_0xb2bb('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb2bb('0x1a')]=_['defaults'](config['redis'],{'host':_0xb2bb('0x1b'),'port':0x18eb});var socket=require(_0xb2bb('0x1c'))(new Redis(config[_0xb2bb('0x1a')]));require(_0xb2bb('0x1d'))[_0xb2bb('0x1e')](socket);var jayson=require(_0xb2bb('0x1f'));var client=jayson[_0xb2bb('0x20')][_0xb2bb('0x21')]({'port':0x232c});var client9002=jayson[_0xb2bb('0x20')][_0xb2bb('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x54f804,_0x249659,_0x5410f1,_0x42b9cc){return new BPromise(function(_0x461e5d,_0x1ad18b){var _0x261c5f=_0x42b9cc||client;return _0x261c5f[_0xb2bb('0x22')](_0x54f804,_0x5410f1)[_0xb2bb('0x23')](function(_0x344bc7){logger[_0xb2bb('0x24')](_0xb2bb('0x25'),_0x249659,_0xb2bb('0x26'));logger[_0xb2bb('0x27')](_0xb2bb('0x28'),_0x249659,_0xb2bb('0x26'),JSON[_0xb2bb('0x29')](_0x344bc7));if(_0x344bc7[_0xb2bb('0x2a')]){if(_0x344bc7['error'][_0xb2bb('0x2b')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x249659,_0x344bc7['error'][_0xb2bb('0x2c')]);return _0x1ad18b(_0x344bc7['error'][_0xb2bb('0x2c')]);}logger[_0xb2bb('0x2a')](_0xb2bb('0x25'),_0x249659,_0x344bc7[_0xb2bb('0x2a')][_0xb2bb('0x2c')]);return _0x461e5d(_0x344bc7[_0xb2bb('0x2a')][_0xb2bb('0x2c')]);}else{logger[_0xb2bb('0x24')](_0xb2bb('0x25'),_0x249659,'request\x20sent');_0x461e5d(_0x344bc7[_0xb2bb('0x2d')]['message']);}})[_0xb2bb('0x2e')](function(_0x3702d5){logger[_0xb2bb('0x2a')](_0xb2bb('0x25'),_0x249659,_0x3702d5);_0x1ad18b(_0x3702d5);});});}function respondWithStatusCode(_0x479afe,_0x3fb535){_0x3fb535=_0x3fb535||0xcc;return function(_0xae94bd){if(_0xae94bd){return _0x479afe[_0xb2bb('0x2f')](_0x3fb535);}return _0x479afe[_0xb2bb('0x30')](_0x3fb535)['end']();};}function respondWithResult(_0x237cff,_0x15640f){_0x15640f=_0x15640f||0xc8;return function(_0x2e8d79){if(_0x2e8d79){return _0x237cff[_0xb2bb('0x30')](_0x15640f)['json'](_0x2e8d79);}};}function respondWithFilteredResult(_0x23abcc,_0x6a23fb){return function(_0x4599d4){if(_0x4599d4){var _0x28680c=typeof _0x6a23fb[_0xb2bb('0x31')]===_0xb2bb('0x32')&&typeof _0x6a23fb['limit']==='undefined';var _0x1b8f29=_0x4599d4[_0xb2bb('0x33')];var _0x1bbc61=_0x28680c?0x0:_0x6a23fb[_0xb2bb('0x31')];var _0x25cc65=_0x28680c?_0x4599d4['count']:_0x6a23fb[_0xb2bb('0x31')]+_0x6a23fb[_0xb2bb('0x34')];var _0x591f4f;if(_0x25cc65>=_0x1b8f29){_0x25cc65=_0x1b8f29;_0x591f4f=0xc8;}else{_0x591f4f=0xce;}_0x23abcc[_0xb2bb('0x30')](_0x591f4f);return _0x23abcc['set']('Content-Range',_0x1bbc61+'-'+_0x25cc65+'/'+_0x1b8f29)[_0xb2bb('0x35')](_0x4599d4);}return null;};}function patchUpdates(_0x12939b){return function(_0x11f40){try{jsonpatch[_0xb2bb('0x36')](_0x11f40,_0x12939b,!![]);}catch(_0x163e68){return BPromise['reject'](_0x163e68);}return _0x11f40[_0xb2bb('0x37')]();};}function saveUpdates(_0x351489,_0xcf10de){return function(_0x527b8b){if(_0x527b8b){return _0x527b8b['update'](_0x351489)[_0xb2bb('0x23')](function(_0x4f5be9){return _0x4f5be9;});}return null;};}function removeEntity(_0x48a8c8,_0x26360a){return function(_0x4b3cfd){if(_0x4b3cfd){return _0x4b3cfd['destroy']()[_0xb2bb('0x23')](function(){var _0x387e71=_0x4b3cfd[_0xb2bb('0x38')]({'plain':!![]});var _0x4632cf=_0xb2bb('0x39');return db[_0xb2bb('0x3a')][_0xb2bb('0x3b')]({'where':{'type':_0x4632cf,'resourceId':_0x387e71['id']}})[_0xb2bb('0x23')](function(){return _0x4b3cfd;});})[_0xb2bb('0x23')](function(){_0x48a8c8[_0xb2bb('0x30')](0xcc)[_0xb2bb('0x3c')]();});}};}function handleEntityNotFound(_0x3f5847,_0x333bcf){return function(_0x290783){if(!_0x290783){_0x3f5847[_0xb2bb('0x2f')](0x194);}return _0x290783;};}function handleError(_0x4a6ca0,_0x229500){_0x229500=_0x229500||0x1f4;return function(_0xb44fce){logger[_0xb2bb('0x2a')](_0xb44fce[_0xb2bb('0x3d')]);if(_0xb44fce[_0xb2bb('0x3e')]){delete _0xb44fce[_0xb2bb('0x3e')];}_0x4a6ca0[_0xb2bb('0x30')](_0x229500)[_0xb2bb('0x3f')](_0xb44fce);};}exports[_0xb2bb('0x40')]=function(_0x3ba6f0,_0x4aefcd){var _0x1b4066={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5a0fb1={},_0x411145={'count':0x0,'rows':[]};var _0x560e8a=_['map'](db[_0xb2bb('0x41')][_0xb2bb('0x42')],function(_0x58a53b){return{'name':_0x58a53b[_0xb2bb('0x43')],'type':_0x58a53b[_0xb2bb('0x44')]['key']};});_0x5a0fb1[_0xb2bb('0x45')]=_[_0xb2bb('0x46')](_0x560e8a,'name');_0x5a0fb1[_0xb2bb('0x47')]=_[_0xb2bb('0x48')](_0x3ba6f0[_0xb2bb('0x47')]);_0x5a0fb1[_0xb2bb('0x49')]=_[_0xb2bb('0x4a')](_0x5a0fb1[_0xb2bb('0x45')],_0x5a0fb1[_0xb2bb('0x47')]);_0x1b4066['attributes']=_[_0xb2bb('0x4a')](_0x5a0fb1[_0xb2bb('0x45')],qs[_0xb2bb('0x4b')](_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x4b')]));_0x1b4066['attributes']=_0x1b4066[_0xb2bb('0x4c')][_0xb2bb('0x4d')]?_0x1b4066[_0xb2bb('0x4c')]:_0x5a0fb1[_0xb2bb('0x45')];if(!_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x4e')](_0xb2bb('0x4f'))){_0x1b4066[_0xb2bb('0x34')]=qs[_0xb2bb('0x34')](_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x34')]);_0x1b4066[_0xb2bb('0x31')]=qs['offset'](_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x31')]);}_0x1b4066[_0xb2bb('0x50')]=qs[_0xb2bb('0x51')](_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x51')]);_0x1b4066[_0xb2bb('0x52')]=qs[_0xb2bb('0x49')](_['pick'](_0x3ba6f0[_0xb2bb('0x47')],_0x5a0fb1[_0xb2bb('0x49')]),_0x560e8a);if(_0x3ba6f0[_0xb2bb('0x47')]['filter']){_0x1b4066['where']=_[_0xb2bb('0x53')](_0x1b4066[_0xb2bb('0x52')],{'$or':_['map'](_0x560e8a,function(_0x214b16){if(_0x214b16[_0xb2bb('0x44')]!==_0xb2bb('0x54')){var _0x523d57={};_0x523d57[_0x214b16[_0xb2bb('0x3e')]]={'$like':'%'+_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x55')]+'%'};return _0x523d57;}})});}_0x1b4066=_[_0xb2bb('0x53')]({},_0x1b4066,_0x3ba6f0[_0xb2bb('0x56')]);var _0x438c9a={'where':_0x1b4066[_0xb2bb('0x52')]};return db['FaxAccount'][_0xb2bb('0x33')](_0x438c9a)[_0xb2bb('0x23')](function(_0x4133b8){_0x411145['count']=_0x4133b8;if(_0x3ba6f0[_0xb2bb('0x47')][_0xb2bb('0x57')]){_0x1b4066[_0xb2bb('0x58')]=[{'all':!![]}];}return db['FaxAccount'][_0xb2bb('0x59')](_0x1b4066);})[_0xb2bb('0x23')](function(_0x1b66cd){_0x411145[_0xb2bb('0x5a')]=_0x1b66cd;return _0x411145;})[_0xb2bb('0x23')](respondWithFilteredResult(_0x4aefcd,_0x1b4066))[_0xb2bb('0x2e')](handleError(_0x4aefcd,null));};exports['show']=function(_0x644313,_0x55e5ea){var _0x27e35e={'raw':![],'where':{'id':_0x644313[_0xb2bb('0x5b')]['id']},'include':[{'model':db[_0xb2bb('0x5c')],'as':_0xb2bb('0x5d')}]},_0x5cb528={};_0x5cb528[_0xb2bb('0x45')]=_[_0xb2bb('0x48')](db[_0xb2bb('0x41')][_0xb2bb('0x42')]);_0x5cb528[_0xb2bb('0x47')]=_[_0xb2bb('0x48')](_0x644313[_0xb2bb('0x47')]);_0x5cb528[_0xb2bb('0x49')]=_[_0xb2bb('0x4a')](_0x5cb528[_0xb2bb('0x45')],_0x5cb528[_0xb2bb('0x47')]);_0x27e35e[_0xb2bb('0x4c')]=_[_0xb2bb('0x4a')](_0x5cb528['model'],qs[_0xb2bb('0x4b')](_0x644313[_0xb2bb('0x47')][_0xb2bb('0x4b')]));_0x27e35e['attributes']=_0x27e35e['attributes'][_0xb2bb('0x4d')]?_0x27e35e[_0xb2bb('0x4c')]:_0x5cb528[_0xb2bb('0x45')];if(_0x644313[_0xb2bb('0x47')][_0xb2bb('0x57')]){_0x27e35e['include']=[{'all':!![]}];}_0x27e35e=_[_0xb2bb('0x53')]({},_0x27e35e,_0x644313[_0xb2bb('0x56')]);return db[_0xb2bb('0x41')][_0xb2bb('0x5e')](_0x27e35e)[_0xb2bb('0x23')](handleEntityNotFound(_0x55e5ea,null))['then'](respondWithResult(_0x55e5ea,null))[_0xb2bb('0x2e')](handleError(_0x55e5ea,null));};exports['create']=function(_0x44d42f,_0x978d7){return db[_0xb2bb('0x41')][_0xb2bb('0x5f')](_0x44d42f[_0xb2bb('0x60')],{})[_0xb2bb('0x23')](function(_0xab0f40){var _0x44788c=_0x44d42f[_0xb2bb('0x61')][_0xb2bb('0x38')]({'plain':!![]});if(!_0x44788c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44788c[_0xb2bb('0x62')]===_0xb2bb('0x61')){var _0xf2643d=_0xab0f40['get']({'plain':!![]});var _0x148312=_0xb2bb('0x39');return db[_0xb2bb('0x63')]['find']({'where':{'name':_0x148312,'userProfileId':_0x44788c['userProfileId']},'raw':!![]})[_0xb2bb('0x23')](function(_0x4a492f){if(_0x4a492f&&_0x4a492f[_0xb2bb('0x64')]===0x0){return db[_0xb2bb('0x3a')]['create']({'name':_0xf2643d['name'],'resourceId':_0xf2643d['id'],'type':_0x4a492f[_0xb2bb('0x3e')],'sectionId':_0x4a492f['id']},{})[_0xb2bb('0x23')](function(){return _0xab0f40;});}else{return _0xab0f40;}})['catch'](function(_0x5eb36c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eb36c);throw _0x5eb36c;});}return _0xab0f40;})['then'](respondWithResult(_0x978d7,0xc9))[_0xb2bb('0x2e')](handleError(_0x978d7,null));};exports[_0xb2bb('0x65')]=function(_0x24a498,_0x1b0f8e){if(_0x24a498[_0xb2bb('0x60')]['id']){delete _0x24a498['body']['id'];}return db[_0xb2bb('0x41')][_0xb2bb('0x5e')]({'where':{'id':_0x24a498['params']['id']},'include':[{'model':db[_0xb2bb('0x5c')],'as':_0xb2bb('0x5d')}]})[_0xb2bb('0x23')](handleEntityNotFound(_0x1b0f8e,null))[_0xb2bb('0x23')](saveUpdates(_0x24a498['body'],null))['then'](respondWithResult(_0x1b0f8e,null))[_0xb2bb('0x2e')](handleError(_0x1b0f8e,null));};exports[_0xb2bb('0x3b')]=function(_0x48f773,_0x478bbd){return db[_0xb2bb('0x41')][_0xb2bb('0x5e')]({'where':{'id':_0x48f773['params']['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x478bbd,null))['then'](removeEntity(_0x478bbd,null))[_0xb2bb('0x2e')](handleError(_0x478bbd,null));};exports[_0xb2bb('0x66')]=function(_0x243327,_0x594b19){return db[_0xb2bb('0x41')][_0xb2bb('0x66')]()['then'](respondWithResult(_0x594b19,null))[_0xb2bb('0x2e')](handleError(_0x594b19,null));};exports[_0xb2bb('0x67')]=function(_0x3d55a7,_0x4a7d6c,_0x421278){if(_0x3d55a7[_0xb2bb('0x60')]['id']){delete _0x3d55a7[_0xb2bb('0x60')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3d55a7[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x4a7d6c,null))[_0xb2bb('0x23')](function(_0x9946c5){if(_0x9946c5){_0x3d55a7[_0xb2bb('0x60')][_0xb2bb('0x68')]=_0x9946c5['id'];return db[_0xb2bb('0x69')][_0xb2bb('0x5f')](_0x3d55a7[_0xb2bb('0x60')]);}})[_0xb2bb('0x23')](respondWithResult(_0x4a7d6c,null))[_0xb2bb('0x2e')](handleError(_0x4a7d6c,null));};exports[_0xb2bb('0x6a')]=function(_0x2e89ac,_0x1cfa6a,_0x267b65){var _0x28c454={'raw':![],'where':{}};var _0x4bf8fe={};var _0x21bb85={'count':0x0,'rows':[]};return db[_0xb2bb('0x41')]['findOne']({'where':{'id':_0x2e89ac[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x1cfa6a,null))[_0xb2bb('0x23')](function(_0x155c37){if(_0x155c37){_0x4bf8fe[_0xb2bb('0x45')]=_[_0xb2bb('0x48')](db[_0xb2bb('0x69')][_0xb2bb('0x42')]);_0x4bf8fe['query']=_[_0xb2bb('0x48')](_0x2e89ac[_0xb2bb('0x47')]);_0x4bf8fe['filters']=_[_0xb2bb('0x4a')](_0x4bf8fe[_0xb2bb('0x45')],_0x4bf8fe['query']);_0x28c454[_0xb2bb('0x4c')]=_[_0xb2bb('0x4a')](_0x4bf8fe[_0xb2bb('0x45')],qs[_0xb2bb('0x4b')](_0x2e89ac['query']['fields']));_0x28c454['attributes']=_0x28c454[_0xb2bb('0x4c')][_0xb2bb('0x4d')]?_0x28c454['attributes']:_0x4bf8fe[_0xb2bb('0x45')];if(!_0x2e89ac[_0xb2bb('0x47')][_0xb2bb('0x4e')](_0xb2bb('0x4f'))){_0x28c454[_0xb2bb('0x34')]=qs[_0xb2bb('0x34')](_0x2e89ac[_0xb2bb('0x47')][_0xb2bb('0x34')]);_0x28c454[_0xb2bb('0x31')]=qs[_0xb2bb('0x31')](_0x2e89ac['query']['offset']);}_0x28c454[_0xb2bb('0x50')]=qs['sort'](_0x2e89ac[_0xb2bb('0x47')]['sort']);_0x28c454['where']=qs[_0xb2bb('0x49')](_[_0xb2bb('0x6b')](_0x2e89ac[_0xb2bb('0x47')],_0x4bf8fe[_0xb2bb('0x49')]));_0x28c454[_0xb2bb('0x52')][_0xb2bb('0x68')]=_0x155c37['id'];if(_0x2e89ac[_0xb2bb('0x47')][_0xb2bb('0x55')]){_0x28c454[_0xb2bb('0x52')]=_[_0xb2bb('0x53')](_0x28c454['where'],{'$or':_['map'](_0x28c454[_0xb2bb('0x4c')],function(_0x5562f9){var _0xd2ca76={};_0xd2ca76[_0x5562f9]={'$like':'%'+_0x2e89ac[_0xb2bb('0x47')]['filter']+'%'};return _0xd2ca76;})});}_0x28c454=_[_0xb2bb('0x53')]({},_0x28c454,_0x2e89ac[_0xb2bb('0x56')]);return db[_0xb2bb('0x69')][_0xb2bb('0x33')]({'where':_0x28c454[_0xb2bb('0x52')]})[_0xb2bb('0x23')](function(_0x12d12f){_0x21bb85[_0xb2bb('0x33')]=_0x12d12f;if(_0x2e89ac[_0xb2bb('0x47')][_0xb2bb('0x57')]){_0x28c454[_0xb2bb('0x58')]=[{'all':!![]}];}return db[_0xb2bb('0x69')][_0xb2bb('0x59')](_0x28c454);})[_0xb2bb('0x23')](function(_0x43eb61){_0x21bb85[_0xb2bb('0x5a')]=_0x43eb61;return _0x21bb85;});}})['then'](respondWithFilteredResult(_0x1cfa6a,_0x28c454))['catch'](handleError(_0x1cfa6a,null));};exports[_0xb2bb('0x6c')]=function(_0x29bdc9,_0x88bdf4,_0x44f936){return db[_0xb2bb('0x41')]['find']({'where':{'id':_0x29bdc9[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x88bdf4,null))[_0xb2bb('0x23')](function(_0x41bc44){if(_0x41bc44){return _0x41bc44[_0xb2bb('0x6c')](_0x29bdc9['query'][_0xb2bb('0x6d')]);}})[_0xb2bb('0x23')](respondWithStatusCode(_0x88bdf4,null))[_0xb2bb('0x2e')](handleError(_0x88bdf4,null));};exports[_0xb2bb('0x6e')]=function(_0x59e552,_0x3e9af5,_0x1bea8c){if(_0x59e552[_0xb2bb('0x60')]['id']){delete _0x59e552[_0xb2bb('0x60')]['id'];}return db[_0xb2bb('0x41')]['find']({'where':{'id':_0x59e552[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x3e9af5,null))[_0xb2bb('0x23')](function(_0x2fbd0e){if(_0x2fbd0e){_0x59e552[_0xb2bb('0x60')][_0xb2bb('0x68')]=_0x2fbd0e['id'];return db[_0xb2bb('0x6f')]['create'](_0x59e552[_0xb2bb('0x60')]);}})['then'](respondWithResult(_0x3e9af5,null))[_0xb2bb('0x2e')](handleError(_0x3e9af5,null));};exports['getAnswers']=function(_0x50c567,_0x2a7267,_0x51ef7b){var _0x398ef4={'raw':![],'where':{}};var _0xf9f429={};var _0x8fa599={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb2bb('0x70')]({'where':{'id':_0x50c567[_0xb2bb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2a7267,null))[_0xb2bb('0x23')](function(_0x9108d8){if(_0x9108d8){_0xf9f429[_0xb2bb('0x45')]=_[_0xb2bb('0x48')](db[_0xb2bb('0x6f')][_0xb2bb('0x42')]);_0xf9f429[_0xb2bb('0x47')]=_[_0xb2bb('0x48')](_0x50c567[_0xb2bb('0x47')]);_0xf9f429['filters']=_[_0xb2bb('0x4a')](_0xf9f429[_0xb2bb('0x45')],_0xf9f429[_0xb2bb('0x47')]);_0x398ef4[_0xb2bb('0x4c')]=_['intersection'](_0xf9f429[_0xb2bb('0x45')],qs[_0xb2bb('0x4b')](_0x50c567[_0xb2bb('0x47')]['fields']));_0x398ef4[_0xb2bb('0x4c')]=_0x398ef4[_0xb2bb('0x4c')]['length']?_0x398ef4[_0xb2bb('0x4c')]:_0xf9f429[_0xb2bb('0x45')];if(!_0x50c567[_0xb2bb('0x47')]['hasOwnProperty'](_0xb2bb('0x4f'))){_0x398ef4[_0xb2bb('0x34')]=qs['limit'](_0x50c567['query'][_0xb2bb('0x34')]);_0x398ef4[_0xb2bb('0x31')]=qs[_0xb2bb('0x31')](_0x50c567[_0xb2bb('0x47')][_0xb2bb('0x31')]);}_0x398ef4['order']=qs[_0xb2bb('0x51')](_0x50c567['query'][_0xb2bb('0x51')]);_0x398ef4[_0xb2bb('0x52')]=qs[_0xb2bb('0x49')](_['pick'](_0x50c567[_0xb2bb('0x47')],_0xf9f429['filters']));_0x398ef4[_0xb2bb('0x52')][_0xb2bb('0x68')]=_0x9108d8['id'];if(_0x50c567[_0xb2bb('0x47')][_0xb2bb('0x55')]){_0x398ef4[_0xb2bb('0x52')]=_[_0xb2bb('0x53')](_0x398ef4[_0xb2bb('0x52')],{'$or':_[_0xb2bb('0x46')](_0x398ef4[_0xb2bb('0x4c')],function(_0x3c8eb5){var _0x5eb874={};_0x5eb874[_0x3c8eb5]={'$like':'%'+_0x50c567[_0xb2bb('0x47')][_0xb2bb('0x55')]+'%'};return _0x5eb874;})});}_0x398ef4=_[_0xb2bb('0x53')]({},_0x398ef4,_0x50c567[_0xb2bb('0x56')]);return db[_0xb2bb('0x6f')]['count']({'where':_0x398ef4[_0xb2bb('0x52')]})['then'](function(_0x558432){_0x8fa599[_0xb2bb('0x33')]=_0x558432;if(_0x50c567[_0xb2bb('0x47')]['includeAll']){_0x398ef4[_0xb2bb('0x58')]=[{'all':!![]}];}return db[_0xb2bb('0x6f')][_0xb2bb('0x59')](_0x398ef4);})[_0xb2bb('0x23')](function(_0x2546b0){_0x8fa599[_0xb2bb('0x5a')]=_0x2546b0;return _0x8fa599;});}})[_0xb2bb('0x23')](respondWithFilteredResult(_0x2a7267,_0x398ef4))[_0xb2bb('0x2e')](handleError(_0x2a7267,null));};exports[_0xb2bb('0x71')]=function(_0x5bd21b,_0x115d10,_0x2b74aa){return db[_0xb2bb('0x41')][_0xb2bb('0x5e')]({'where':{'id':_0x5bd21b[_0xb2bb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x115d10,null))[_0xb2bb('0x23')](function(_0x1ae34d){if(_0x1ae34d){return _0x1ae34d['removeAnswers'](_0x5bd21b[_0xb2bb('0x47')][_0xb2bb('0x6d')]);}})[_0xb2bb('0x23')](respondWithStatusCode(_0x115d10,null))[_0xb2bb('0x2e')](handleError(_0x115d10,null));};exports['addInteraction']=function(_0x5cad97,_0x4209e6,_0x1ce8ee){return db[_0xb2bb('0x72')][_0xb2bb('0x5e')]({'where':{'id':_0x5cad97[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x4209e6,null))[_0xb2bb('0x23')](function(_0x2edec7){if(_0x2edec7){return _0x2edec7[_0xb2bb('0x73')](_0x5cad97[_0xb2bb('0x60')]['ids'],_[_0xb2bb('0x74')](_0x5cad97[_0xb2bb('0x60')],['ids','id'])||{});}})['then'](respondWithResult(_0x4209e6,null))[_0xb2bb('0x2e')](handleError(_0x4209e6,null));};exports[_0xb2bb('0x75')]=function(_0x35ce42,_0x51ebfc,_0x17b121){var _0x980af5={'raw':![],'where':{}};var _0x1c4916={};var _0x2dac9d={'count':0x0,'rows':[]};return db[_0xb2bb('0x41')]['findOne']({'where':{'id':_0x35ce42[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x51ebfc,null))['then'](function(_0xa73107){if(_0xa73107){_0x1c4916['model']=_['keys'](db[_0xb2bb('0x72')][_0xb2bb('0x42')]);_0x1c4916[_0xb2bb('0x47')]=_[_0xb2bb('0x48')](_0x35ce42[_0xb2bb('0x47')]);_0x1c4916[_0xb2bb('0x49')]=_['intersection'](_0x1c4916['model'],_0x1c4916[_0xb2bb('0x47')]);_0x980af5[_0xb2bb('0x4c')]=_[_0xb2bb('0x4a')](_0x1c4916[_0xb2bb('0x45')],qs[_0xb2bb('0x4b')](_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x4b')]));_0x980af5[_0xb2bb('0x4c')]=_0x980af5['attributes']['length']?_0x980af5[_0xb2bb('0x4c')]:_0x1c4916['model'];if(!_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x4e')](_0xb2bb('0x4f'))){_0x980af5['limit']=qs[_0xb2bb('0x34')](_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x34')]);_0x980af5['offset']=qs[_0xb2bb('0x31')](_0x35ce42['query'][_0xb2bb('0x31')]);}_0x980af5[_0xb2bb('0x50')]=qs[_0xb2bb('0x51')](_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x51')]);_0x980af5[_0xb2bb('0x52')]=qs[_0xb2bb('0x49')](_['pick'](_0x35ce42['query'],_0x1c4916[_0xb2bb('0x49')]));_0x980af5[_0xb2bb('0x52')]['FaxAccountId']=_0xa73107['id'];if(_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x55')]){_0x980af5['where']=_[_0xb2bb('0x53')](_0x980af5[_0xb2bb('0x52')],{'$or':_[_0xb2bb('0x46')](_0x980af5[_0xb2bb('0x4c')],function(_0x513150){var _0x1d3174={};_0x1d3174[_0x513150]={'$like':'%'+_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x55')]+'%'};return _0x1d3174;})});}_0x980af5=_['merge']({},_0x980af5,_0x35ce42[_0xb2bb('0x56')]);return db[_0xb2bb('0x72')][_0xb2bb('0x33')]({'where':_0x980af5['where']})[_0xb2bb('0x23')](function(_0x2334a1){_0x2dac9d['count']=_0x2334a1;if(_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x57')]){_0x980af5[_0xb2bb('0x58')]=[{'model':db[_0xb2bb('0x76')],'as':_0xb2bb('0x77'),'required':![]},{'model':db[_0xb2bb('0x78')],'as':_0xb2bb('0x79'),'attributes':[_0xb2bb('0x3e'),_0xb2bb('0x7a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xb2bb('0x7b'),'attributes':['id',_0xb2bb('0x3e'),_0xb2bb('0x7c')],'where':_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x7d')]?{'id':_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x7d')]}:undefined,'required':_0x35ce42[_0xb2bb('0x47')][_0xb2bb('0x7d')]?!![]:![]}];}return db[_0xb2bb('0x72')][_0xb2bb('0x59')](_0x980af5);})[_0xb2bb('0x23')](function(_0x505bfc){_0x2dac9d[_0xb2bb('0x5a')]=_0x505bfc;return _0x2dac9d;});}})['then'](respondWithFilteredResult(_0x51ebfc,_0x980af5))['catch'](handleError(_0x51ebfc,null));};exports[_0xb2bb('0x7e')]=function(_0x14551a,_0x3a9f0f){var _0x26f9ba=_0x14551a[_0xb2bb('0x5b')]['id'];var _0x9aae11=_0x14551a['body'];var _0x1c82d2=0xc8;var _0x35b37b=null;return db[_0xb2bb('0x7f')][_0xb2bb('0x80')]({'isolationLevel':db['sequelize'][_0xb2bb('0x81')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1782ba){return db[_0xb2bb('0x41')][_0xb2bb('0x70')]({'where':{'id':_0x26f9ba},'transaction':_0x1782ba})[_0xb2bb('0x23')](function(_0x11022b){if(_0x11022b){return db[_0xb2bb('0x82')][_0xb2bb('0x3b')]({'where':{'FaxAccountId':_0x26f9ba},'transaction':_0x1782ba})['then'](function(){var _0x2461fc=_[_0xb2bb('0x46')](_0x9aae11,function(_0x509453){_0x509453['FaxAccountId']=_0x26f9ba;return _0x509453;});return db[_0xb2bb('0x82')][_0xb2bb('0x83')](_0x2461fc,{'transaction':_0x1782ba});});}else{_0x1c82d2=0x194;_0x35b37b=[];}});})[_0xb2bb('0x23')](function(){if(_0x1c82d2!==0x194){return db['FaxApplication'][_0xb2bb('0x84')]({'where':{'FaxAccountId':_0x26f9ba},'order':'priority'})[_0xb2bb('0x23')](function(_0x13a7d0){_0x35b37b=_0x13a7d0;});}})[_0xb2bb('0x2e')](function(_0xf172e7){_0x1c82d2=0x1f4;logger[_0xb2bb('0x2a')](_0xf172e7[_0xb2bb('0x3d')]);if(_0xf172e7[_0xb2bb('0x3e')]){delete _0xf172e7[_0xb2bb('0x3e')];}_0x35b37b=_0xf172e7;})[_0xb2bb('0x85')](function(){if(_0x35b37b===null){_0x3a9f0f[_0xb2bb('0x2f')](_0x1c82d2);}else{if(_0x1c82d2===0x1f4){_0x3a9f0f[_0xb2bb('0x30')](_0x1c82d2)[_0xb2bb('0x3f')](_0x35b37b);}else{_0x3a9f0f[_0xb2bb('0x30')](_0x1c82d2)[_0xb2bb('0x35')](_0x35b37b);}}});};exports[_0xb2bb('0x86')]=function(_0x3bada9,_0x5708a0,_0x5dc2aa){var _0x86a276={};var _0x4e1ba6={};var _0x204a1e;var _0x53fecd;return db[_0xb2bb('0x41')][_0xb2bb('0x70')]({'where':{'id':_0x3bada9[_0xb2bb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5708a0,null))['then'](function(_0x5b2c8d){if(_0x5b2c8d){_0x204a1e=_0x5b2c8d;_0x4e1ba6['model']=_[_0xb2bb('0x48')](db['FaxApplication'][_0xb2bb('0x42')]);_0x4e1ba6[_0xb2bb('0x47')]=_[_0xb2bb('0x48')](_0x3bada9[_0xb2bb('0x47')]);_0x4e1ba6['filters']=_[_0xb2bb('0x4a')](_0x4e1ba6[_0xb2bb('0x45')],_0x4e1ba6['query']);_0x86a276[_0xb2bb('0x4c')]=_[_0xb2bb('0x4a')](_0x4e1ba6[_0xb2bb('0x45')],qs[_0xb2bb('0x4b')](_0x3bada9[_0xb2bb('0x47')][_0xb2bb('0x4b')]));_0x86a276[_0xb2bb('0x4c')]=_0x86a276['attributes']['length']?_0x86a276[_0xb2bb('0x4c')]:_0x4e1ba6['model'];_0x86a276['order']=qs[_0xb2bb('0x51')](_0x3bada9[_0xb2bb('0x47')]['sort']);_0x86a276[_0xb2bb('0x52')]=qs[_0xb2bb('0x49')](_[_0xb2bb('0x6b')](_0x3bada9['query'],_0x4e1ba6[_0xb2bb('0x49')]));if(_0x3bada9[_0xb2bb('0x47')][_0xb2bb('0x55')]){_0x86a276[_0xb2bb('0x52')]=_[_0xb2bb('0x53')](_0x86a276['where'],{'$or':_[_0xb2bb('0x46')](_0x86a276[_0xb2bb('0x4c')],function(_0x19fc97){var _0x302ec5={};_0x302ec5[_0x19fc97]={'$like':'%'+_0x3bada9['query']['filter']+'%'};return _0x302ec5;})});}_0x86a276=_[_0xb2bb('0x53')]({},_0x86a276,_0x3bada9[_0xb2bb('0x56')]);return _0x204a1e[_0xb2bb('0x86')](_0x86a276);}})[_0xb2bb('0x23')](function(_0xf8d4b4){if(_0xf8d4b4){_0x53fecd=_0xf8d4b4['length'];if(!_0x3bada9['query']['hasOwnProperty'](_0xb2bb('0x4f'))){_0x86a276[_0xb2bb('0x34')]=qs[_0xb2bb('0x34')](_0x3bada9['query'][_0xb2bb('0x34')]);_0x86a276['offset']=qs[_0xb2bb('0x31')](_0x3bada9[_0xb2bb('0x47')]['offset']);}return _0x204a1e[_0xb2bb('0x86')](_0x86a276);}})[_0xb2bb('0x23')](function(_0x3d1caf){if(_0x3d1caf){return _0x3d1caf?{'count':_0x53fecd,'rows':_0x3d1caf}:null;}})[_0xb2bb('0x23')](respondWithResult(_0x5708a0,null))[_0xb2bb('0x2e')](handleError(_0x5708a0,null));};function Extension(_0x37e88b,_0x159861,_0x1652e7,_0x13d703){this[_0xb2bb('0x87')]=_0xb2bb('0x88');this[_0xb2bb('0x89')]=_0x37e88b[_0xb2bb('0x8a')];this[_0xb2bb('0x8b')]=_0x13d703;this[_0xb2bb('0x44')]='system';this[_0xb2bb('0x8c')]=_0xb2bb('0x8d');this[_0xb2bb('0x68')]=_0x37e88b['id'];this[_0xb2bb('0x8e')]=_0x159861;this[_0xb2bb('0x8f')]=_0x1652e7;}function createExtensionsReciveFax(_0x4fa92d){var _0x43d465=0x1;var _0x12d959=[];_0x12d959['push'](new Extension(_0x4fa92d,_0x43d465,'',_0xb2bb('0x90')));_0x43d465+=0x1;_0x12d959[_0xb2bb('0x91')](new Extension(_0x4fa92d,_0x43d465,'CDR(type)=inbound-fax','Set'));_0x43d465+=0x1;for(var _0x58386d in _0x4fa92d){if(_0x4fa92d[_0xb2bb('0x4e')](_0x58386d)&&(_0x58386d==='ecm'||_0x58386d===_0xb2bb('0x8a')||_0x58386d===_0xb2bb('0x92')||_0x58386d==='faxdetect'||_0x58386d===_0xb2bb('0x93')||_0x58386d==='maxrate'||_0x58386d===_0xb2bb('0x94')||_0x58386d===_0xb2bb('0x95')||_0x58386d==='t38timeout')){_0x12d959[_0xb2bb('0x91')](new Extension(_0x4fa92d,_0x43d465,_0xb2bb('0x96')+_0x58386d+')='+_0x4fa92d[_0x58386d],'Set'));_0x43d465+=0x1;}}_0x12d959['push'](new Extension(_0x4fa92d,_0x43d465,'6',_0xb2bb('0x97')));_0x43d465+=0x1;_0x12d959[_0xb2bb('0x91')](new Extension(_0x4fa92d,_0x43d465,_0xb2bb('0x98'),_0xb2bb('0x99')));_0x43d465=0x0;return _0x12d959;}exports[_0xb2bb('0x9a')]=function(_0x57d5d8,_0x18c9ea,_0x35321b){var _0xbde91e;return db[_0xb2bb('0x7f')][_0xb2bb('0x80')](function(_0x520a2d){return db[_0xb2bb('0x41')][_0xb2bb('0x5f')](_0x57d5d8['body'],{'transaction':_0x520a2d})[_0xb2bb('0x23')](function(_0x1b398b){_0xbde91e=_0x1b398b[_0xb2bb('0x38')]({'plain':!![]});return db[_0xb2bb('0x9b')][_0xb2bb('0x83')](createExtensionsReciveFax(_0xbde91e),{'transaction':_0x520a2d});});})[_0xb2bb('0x23')](function(){return _0xbde91e;})[_0xb2bb('0x23')](respondWithResult(_0x18c9ea,null))[_0xb2bb('0x2e')](handleError(_0x18c9ea,null));};exports[_0xb2bb('0x9c')]=function(_0x17fd45,_0xbf57e3,_0x20242d){var _0x367b50;return db[_0xb2bb('0x7f')][_0xb2bb('0x80')](function(_0x22a08c){return db[_0xb2bb('0x41')][_0xb2bb('0x65')](_0x17fd45[_0xb2bb('0x60')],{'where':{'id':_0x17fd45['body']['id']},'transaction':_0x22a08c})[_0xb2bb('0x23')](function(_0xc2bc16){return db[_0xb2bb('0x9b')]['destroy']({'where':{'FaxAccountId':_0x17fd45[_0xb2bb('0x60')]['id']},'transaction':_0x22a08c})['then'](function(_0x4ef1f6){return db[_0xb2bb('0x9b')]['bulkCreate'](createExtensionsReciveFax(_[_0xb2bb('0x74')](_0x17fd45[_0xb2bb('0x60')],[_0xb2bb('0x9d'),_0xb2bb('0x9e'),_0xb2bb('0x9f'),_0xb2bb('0xa0'),'TrunkId','ListId'])),{'transaction':_0x22a08c});});});})[_0xb2bb('0x23')](function(){return db[_0xb2bb('0x41')][_0xb2bb('0xa1')](_0x17fd45[_0xb2bb('0x60')]['id']);})[_0xb2bb('0x23')](respondWithResult(_0xbf57e3,null))['catch'](handleError(_0xbf57e3,null));};exports['getMessages']=function(_0x205908,_0x49fa88,_0x598fbd){var _0x474121={'raw':!![],'where':{}};var _0xf0b49f={};var _0x5e0f86={'count':0x0,'rows':[]};return db[_0xb2bb('0x41')]['findOne']({'where':{'id':_0x205908['params']['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x49fa88,null))[_0xb2bb('0x23')](function(_0x3c461d){if(_0x3c461d){_0xf0b49f[_0xb2bb('0x45')]=_['keys'](db[_0xb2bb('0xa2')]['rawAttributes']);_0xf0b49f['query']=_[_0xb2bb('0x48')](_0x205908['query']);_0xf0b49f[_0xb2bb('0x49')]=_[_0xb2bb('0x4a')](_0xf0b49f[_0xb2bb('0x45')],_0xf0b49f[_0xb2bb('0x47')]);_0x474121[_0xb2bb('0x4c')]=_['intersection'](_0xf0b49f['model'],qs[_0xb2bb('0x4b')](_0x205908[_0xb2bb('0x47')][_0xb2bb('0x4b')]));_0x474121[_0xb2bb('0x4c')]=_0x474121[_0xb2bb('0x4c')][_0xb2bb('0x4d')]?_0x474121[_0xb2bb('0x4c')]:_0xf0b49f['model'];if(!_0x205908[_0xb2bb('0x47')][_0xb2bb('0x4e')](_0xb2bb('0x4f'))){_0x474121[_0xb2bb('0x34')]=qs[_0xb2bb('0x34')](_0x205908['query']['limit']);_0x474121[_0xb2bb('0x31')]=qs[_0xb2bb('0x31')](_0x205908[_0xb2bb('0x47')][_0xb2bb('0x31')]);}_0x474121[_0xb2bb('0x50')]=qs[_0xb2bb('0x51')](_0x205908['query'][_0xb2bb('0x51')]);_0x474121[_0xb2bb('0x52')]=qs['filters'](_[_0xb2bb('0x6b')](_0x205908[_0xb2bb('0x47')],_0xf0b49f['filters']));_0x474121[_0xb2bb('0x52')][_0xb2bb('0x68')]=_0x3c461d['id'];if(_0x205908[_0xb2bb('0x47')][_0xb2bb('0x55')]){_0x474121[_0xb2bb('0x52')]=_['merge'](_0x474121[_0xb2bb('0x52')],{'$or':_['map'](_0x474121['attributes'],function(_0xe15c7b){var _0xe49e4c={};_0xe49e4c[_0xe15c7b]={'$like':'%'+_0x205908[_0xb2bb('0x47')][_0xb2bb('0x55')]+'%'};return _0xe49e4c;})});}if(_0x205908[_0xb2bb('0x47')][_0xb2bb('0xa3')]){var _0x46c84f=_0x205908[_0xb2bb('0x47')]['$gte']['split'](',');var _0x1c6c68={};_0x1c6c68[_0x46c84f[0x0]]={'$gte':moment(_0x46c84f[0x1])['format'](_0xb2bb('0xa4'))};_0x474121[_0xb2bb('0x52')]=_[_0xb2bb('0x53')](_0x474121['where'],_0x1c6c68);}_0x474121=_['merge']({},_0x474121,_0x205908['options']);return db['FaxMessage'][_0xb2bb('0x33')]({'where':_0x474121['where']})[_0xb2bb('0x23')](function(_0x55a1ae){_0x5e0f86[_0xb2bb('0x33')]=_0x55a1ae;if(_0x205908[_0xb2bb('0x47')][_0xb2bb('0x57')]){_0x474121['include']=[{'all':!![]}];}return db[_0xb2bb('0xa2')]['findAll'](_0x474121);})[_0xb2bb('0x23')](function(_0x545d1c){_0x5e0f86[_0xb2bb('0x5a')]=_0x545d1c;return _0x5e0f86;});}})['then'](respondWithFilteredResult(_0x49fa88,_0x474121))[_0xb2bb('0x2e')](handleError(_0x49fa88,null));};exports[_0xb2bb('0x3f')]=function(_0x170099,_0x30abfa,_0x225933){var _0x16f79b,_0x48fd31={},_0x223032;if(_0x170099[_0xb2bb('0x60')]['to']){_0x223032=_0x170099[_0xb2bb('0x60')]['to'][0x0];}return db[_0xb2bb('0x41')]['find']({'where':{'id':_0x170099[_0xb2bb('0x5b')]['id']},'include':[{'model':db[_0xb2bb('0xa5')],'as':_0xb2bb('0xa6'),'include':[{'model':db[_0xb2bb('0x76')],'as':'Contacts','where':{'fax':_0x223032},'limit':0x1,'order':[[_0xb2bb('0xa0'),_0xb2bb('0xa7')]]}]}]})[_0xb2bb('0x23')](handleEntityNotFound(_0x30abfa,null))[_0xb2bb('0x23')](function(_0x3a9ca5){_0x16f79b=_0x3a9ca5;if(_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')]&&_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')][_0xb2bb('0x4d')]){for(var _0x3ae185=0x0;_0x3ae185<_0x170099['body'][_0xb2bb('0xa8')][_0xb2bb('0x4d')];_0x3ae185+=0x1){_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')][_0x3ae185]={'filename':_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')][_0x3ae185][_0xb2bb('0x3e')],'id':_0x170099['body'][_0xb2bb('0xa8')][_0x3ae185]['id'],'path':path[_0xb2bb('0xa9')](config[_0xb2bb('0xaa')],'server/files/attachments',_0x170099['body'][_0xb2bb('0xa8')][_0x3ae185][_0xb2bb('0xab')])};}}return respondWithRpcPromise(_0xb2bb('0xac'),_0xb2bb('0xac'),{'FaxAccountId':_[_0xb2bb('0xad')](_0x170099['params']['id'])?undefined:_0x170099[_0xb2bb('0x5b')]['id'],'path':_[_0xb2bb('0xad')](_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')][0x0][_0xb2bb('0xae')])?undefined:_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')][0x0][_0xb2bb('0xae')],'fax':_[_0xb2bb('0xad')](_0x170099[_0xb2bb('0x60')]['to'][0x0])?undefined:_0x170099[_0xb2bb('0x60')]['to'][0x0]},client9002);})[_0xb2bb('0x23')](function(){if(_0x16f79b){if(_[_0xb2bb('0xad')](_0x170099['body']['from'])){_0x170099[_0xb2bb('0x60')][_0xb2bb('0xaf')]=util['format'](_0xb2bb('0xb0'),_0x16f79b['name'],_0x16f79b[_0xb2bb('0xb1')]);}if(_0x16f79b['List']){if(_0x16f79b[_0xb2bb('0xa6')][_0xb2bb('0xb2')][_0xb2bb('0x4d')]){return _0x16f79b[_0xb2bb('0xa6')]['Contacts'][0x0];}else{return db['CmContact'][_0xb2bb('0x5f')](_[_0xb2bb('0xb3')](_0x170099[_0xb2bb('0x60')],{'firstName':_0x170099['body']['to'][0x0],'phone':_0x170099[_0xb2bb('0x60')]['to'][0x0],'fax':_0x170099[_0xb2bb('0x60')]['to'][0x0],'ListId':_0x16f79b[_0xb2bb('0xb4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb2bb('0x23')](function(_0x134674){if(_0x134674){return db['FaxInteraction'][_0xb2bb('0x5e')]({'where':{'ContactId':_0x134674['id'],'closed':![],'FaxAccountId':_0x16f79b['id']}})[_0xb2bb('0x23')](function(_0x9f1b06){if(_0x9f1b06){return[_0x9f1b06,![]];}return db['FaxInteraction'][_0xb2bb('0x5f')]({'UserId':_0x170099['user']['id'],'ContactId':_0x134674['id'],'FaxAccountId':_0x16f79b['id'],'fax':_0x170099[_0xb2bb('0x60')]['to'][0x0],'firstMsgDirection':_0xb2bb('0xb5'),'Messages':[_[_0xb2bb('0x53')](_0x170099[_0xb2bb('0x60')],{'read':![],'body':_0x170099['body'][_0xb2bb('0xa8')][0x0]['filename'],'FaxAccountId':_0x16f79b['id'],'UserId':_0x170099[_0xb2bb('0x61')]['id'],'ContactId':_0x134674['id'],'AttachmentId':_0x170099[_0xb2bb('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xb2bb('0xa2')],'as':'Messages'}]})[_0xb2bb('0x23')](function(_0x321cc1){return[_0x321cc1,!![]];});});}else{throw new Error(_0xb2bb('0xb6'));}})[_0xb2bb('0xb7')](function(_0x23e3c6,_0x129a8c){if(_0x129a8c){return _0x23e3c6;}return db[_0xb2bb('0xa2')][_0xb2bb('0x5f')]({'direction':_0xb2bb('0xb5'),'read':![],'body':_0x170099['body'][_0xb2bb('0xa8')][0x0][_0xb2bb('0xb8')],'FaxAccountId':_0x16f79b['id'],'FaxInteractionId':_0x23e3c6['id'],'UserId':_0x170099[_0xb2bb('0x61')]['id'],'ContactId':_0x23e3c6['ContactId'],'AttachmentId':_0x170099['body'][_0xb2bb('0xa8')][0x0]['id']})[_0xb2bb('0x23')](function(_0x4c52d7){_0x23e3c6[_0xb2bb('0xb9')]['Messages']=[];_0x23e3c6['dataValues'][_0xb2bb('0xba')][_0xb2bb('0x91')](_0x4c52d7[_0xb2bb('0xb9')]);return _0x23e3c6;});})[_0xb2bb('0x23')](function(_0x2b3339){respondWithRpcPromise(_0xb2bb('0xbb'),_0xb2bb('0xbb'),{'FaxAccountId':_[_0xb2bb('0xad')](_0x170099[_0xb2bb('0x5b')]['id'])?undefined:_0x170099[_0xb2bb('0x5b')]['id'],'path':_[_0xb2bb('0xad')](_0x170099[_0xb2bb('0x60')]['attachments'][0x0]['path'])?undefined:_0x170099[_0xb2bb('0x60')][_0xb2bb('0xa8')][0x0][_0xb2bb('0xae')],'fax':_[_0xb2bb('0xad')](_0x170099[_0xb2bb('0x60')]['to'][0x0])?undefined:_0x170099[_0xb2bb('0x60')]['to'][0x0],'AttachmentId':_0x170099['body'][_0xb2bb('0xa8')][0x0]['id']},client9002)['then'](function(_0x5a4c63){logger['info'](_0xb2bb('0xbc'),_0x5a4c63);})[_0xb2bb('0x2e')](function(_0x4f4629){logger['info'](_0xb2bb('0xbc'),_0x4f4629);});return _0x2b3339;})['then'](respondWithResult(_0x30abfa,null))[_0xb2bb('0x2e')](handleError(_0x30abfa,null));};exports[_0xb2bb('0xbd')]=function(_0x285cf4,_0x4b96c8,_0x96fb14){return db[_0xb2bb('0x41')][_0xb2bb('0x5e')]({'where':{'id':_0x285cf4[_0xb2bb('0x5b')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x4b96c8,null))['then'](function(_0x8d51e3){if(_0x8d51e3){return _0x8d51e3[_0xb2bb('0xbd')](_0x285cf4['body'][_0xb2bb('0x6d')],_['omit'](_0x285cf4['body'],[_0xb2bb('0x6d'),'id'])||{})[_0xb2bb('0xb7')](function(_0x25940f){for(var _0x3051d8=0x0;_0x3051d8<_0x285cf4[_0xb2bb('0x60')][_0xb2bb('0x6d')][_0xb2bb('0x4d')];_0x3051d8+=0x1){socket[_0xb2bb('0xbe')](_0xb2bb('0xbf'),{'UserId':Number(_0x285cf4[_0xb2bb('0x60')][_0xb2bb('0x6d')][_0x3051d8]),'FaxAccountId':Number(_0x285cf4['params']['id'])});}return _0x25940f;});}})[_0xb2bb('0x23')](respondWithResult(_0x4b96c8,null))['catch'](handleError(_0x4b96c8,null));};exports[_0xb2bb('0xc0')]=function(_0x404215,_0x40a5bb,_0x2ef207){return db[_0xb2bb('0x41')]['find']({'where':{'id':_0x404215[_0xb2bb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x40a5bb,null))['then'](function(_0x548674){if(_0x548674){return _0x548674[_0xb2bb('0xc0')](_0x404215[_0xb2bb('0x47')]['ids'])[_0xb2bb('0x23')](function(){if(_['isArray'](_0x404215['query'][_0xb2bb('0x6d')])){for(var _0xc95536=0x0;_0xc95536<_0x404215[_0xb2bb('0x47')][_0xb2bb('0x6d')][_0xb2bb('0x4d')];_0xc95536+=0x1){socket[_0xb2bb('0xbe')](_0xb2bb('0xc1'),{'UserId':Number(_0x404215[_0xb2bb('0x47')][_0xb2bb('0x6d')][_0xc95536]),'FaxAccountId':Number(_0x404215['params']['id'])});}}else{socket['emit'](_0xb2bb('0xc1'),{'UserId':Number(_0x404215[_0xb2bb('0x47')][_0xb2bb('0x6d')]),'FaxAccountId':Number(_0x404215[_0xb2bb('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x40a5bb,null))[_0xb2bb('0x2e')](handleError(_0x40a5bb,null));};exports['getAgents']=function(_0xe60ecf,_0x142f49,_0x12e356){var _0x487dfc={};var _0x36c9e2={};var _0x548cc5;var _0x436fd0;return db[_0xb2bb('0x41')]['findOne']({'where':{'id':_0xe60ecf['params']['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x142f49,null))[_0xb2bb('0x23')](function(_0x319c81){if(_0x319c81){_0x548cc5=_0x319c81;_0x36c9e2[_0xb2bb('0x45')]=_[_0xb2bb('0x48')](db[_0xb2bb('0x78')][_0xb2bb('0x42')]);_0x36c9e2['query']=_[_0xb2bb('0x48')](_0xe60ecf['query']);_0x36c9e2['filters']=_[_0xb2bb('0x4a')](_0x36c9e2[_0xb2bb('0x45')],_0x36c9e2['query']);_0x487dfc[_0xb2bb('0x4c')]=_[_0xb2bb('0x4a')](_0x36c9e2[_0xb2bb('0x45')],qs[_0xb2bb('0x4b')](_0xe60ecf['query']['fields']));_0x487dfc[_0xb2bb('0x4c')]=_0x487dfc['attributes']['length']?_0x487dfc[_0xb2bb('0x4c')]:_0x36c9e2['model'];_0x487dfc[_0xb2bb('0x50')]=qs[_0xb2bb('0x51')](_0xe60ecf[_0xb2bb('0x47')][_0xb2bb('0x51')]);_0x487dfc[_0xb2bb('0x52')]=qs[_0xb2bb('0x49')](_['pick'](_0xe60ecf[_0xb2bb('0x47')],_0x36c9e2[_0xb2bb('0x49')]));if(_0xe60ecf['query'][_0xb2bb('0x55')]){_0x487dfc['where']=_[_0xb2bb('0x53')](_0x487dfc[_0xb2bb('0x52')],{'$or':_[_0xb2bb('0x46')](_0x487dfc[_0xb2bb('0x4c')],function(_0x33be85){var _0x74c8ed={};_0x74c8ed[_0x33be85]={'$like':'%'+_0xe60ecf['query'][_0xb2bb('0x55')]+'%'};return _0x74c8ed;})});}_0x487dfc=_[_0xb2bb('0x53')]({},_0x487dfc,_0xe60ecf['options']);return _0x548cc5[_0xb2bb('0xc2')](_0x487dfc);}})[_0xb2bb('0x23')](function(_0xa2eb0c){if(_0xa2eb0c){_0x436fd0=_0xa2eb0c[_0xb2bb('0x4d')];if(!_0xe60ecf[_0xb2bb('0x47')][_0xb2bb('0x4e')]('nolimit')){_0x487dfc[_0xb2bb('0x34')]=qs[_0xb2bb('0x34')](_0xe60ecf['query'][_0xb2bb('0x34')]);_0x487dfc[_0xb2bb('0x31')]=qs[_0xb2bb('0x31')](_0xe60ecf[_0xb2bb('0x47')][_0xb2bb('0x31')]);}return _0x548cc5['getAgents'](_0x487dfc);}})[_0xb2bb('0x23')](function(_0x44b342){if(_0x44b342){return _0x44b342?{'count':_0x436fd0,'rows':_0x44b342}:null;}})[_0xb2bb('0x23')](respondWithResult(_0x142f49,null))[_0xb2bb('0x2e')](handleError(_0x142f49,null));}; \ No newline at end of file +var _0xe05f=['faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','updatedAt','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','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','FaxAccountId','findOne','keys','Disposition','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway'];(function(_0x51e79e,_0x1c30bc){var _0x34692f=function(_0x5ed597){while(--_0x5ed597){_0x51e79e['push'](_0x51e79e['shift']());}};_0x34692f(++_0x1c30bc);}(_0xe05f,0x1b3));var _0xfe05=function(_0x457969,_0x4bb527){_0x457969=_0x457969-0x0;var _0x3a5e62=_0xe05f[_0x457969];return _0x3a5e62;};'use strict';var emlformat=require(_0xfe05('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe05('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe05('0x2'));var util=require(_0xfe05('0x3'));var path=require('path');var sox=require(_0xfe05('0x4'));var csv=require(_0xfe05('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe05('0x6'));var _=require(_0xfe05('0x7'));var squel=require(_0xfe05('0x8'));var crypto=require(_0xfe05('0x9'));var jsforce=require(_0xfe05('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfe05('0x5'));var querystring=require(_0xfe05('0xb'));var Papa=require(_0xfe05('0xc'));var Redis=require(_0xfe05('0xd'));var authService=require(_0xfe05('0xe'));var qs=require(_0xfe05('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe05('0x10'));var logger=require(_0xfe05('0x11'))('api');var utils=require(_0xfe05('0x12'));var config=require(_0xfe05('0x13'));var licenseUtil=require(_0xfe05('0x14'));var db=require(_0xfe05('0x15'))['db'];config['redis']=_[_0xfe05('0x16')](config[_0xfe05('0x17')],{'host':_0xfe05('0x18'),'port':0x18eb});var socket=require(_0xfe05('0x19'))(new Redis(config[_0xfe05('0x17')]));require(_0xfe05('0x1a'))[_0xfe05('0x1b')](socket);var jayson=require(_0xfe05('0x1c'));var client=jayson[_0xfe05('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xfe05('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5030c9,_0x53d1ca,_0x19da1e,_0xb1d933){return new BPromise(function(_0x521593,_0x4fa4c7){var _0x22f5fa=_0xb1d933||client;return _0x22f5fa[_0xfe05('0x1e')](_0x5030c9,_0x19da1e)['then'](function(_0x1c35a9){logger[_0xfe05('0x1f')](_0xfe05('0x20'),_0x53d1ca,'request\x20sent');logger[_0xfe05('0x21')](_0xfe05('0x22'),_0x53d1ca,_0xfe05('0x23'),JSON[_0xfe05('0x24')](_0x1c35a9));if(_0x1c35a9[_0xfe05('0x25')]){if(_0x1c35a9[_0xfe05('0x25')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53d1ca,_0x1c35a9[_0xfe05('0x25')][_0xfe05('0x26')]);return _0x4fa4c7(_0x1c35a9[_0xfe05('0x25')][_0xfe05('0x26')]);}logger['error'](_0xfe05('0x20'),_0x53d1ca,_0x1c35a9[_0xfe05('0x25')]['message']);return _0x521593(_0x1c35a9[_0xfe05('0x25')][_0xfe05('0x26')]);}else{logger[_0xfe05('0x1f')](_0xfe05('0x20'),_0x53d1ca,_0xfe05('0x23'));_0x521593(_0x1c35a9[_0xfe05('0x27')]['message']);}})['catch'](function(_0x5d82af){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53d1ca,_0x5d82af);_0x4fa4c7(_0x5d82af);});});}function respondWithStatusCode(_0x5ee83f,_0x3571f2){_0x3571f2=_0x3571f2||0xcc;return function(_0x785544){if(_0x785544){return _0x5ee83f[_0xfe05('0x28')](_0x3571f2);}return _0x5ee83f['status'](_0x3571f2)[_0xfe05('0x29')]();};}function respondWithResult(_0x15616a,_0x4c307f){_0x4c307f=_0x4c307f||0xc8;return function(_0x4f747e){if(_0x4f747e){return _0x15616a[_0xfe05('0x2a')](_0x4c307f)[_0xfe05('0x2b')](_0x4f747e);}};}function respondWithFilteredResult(_0x2fa49e,_0x214829){return function(_0xe20837){if(_0xe20837){var _0x19d8c1=typeof _0x214829[_0xfe05('0x2c')]===_0xfe05('0x2d')&&typeof _0x214829[_0xfe05('0x2e')]==='undefined';var _0x484679=_0xe20837[_0xfe05('0x2f')];var _0x1b240d=_0x19d8c1?0x0:_0x214829[_0xfe05('0x2c')];var _0x4653ba=_0x19d8c1?_0xe20837[_0xfe05('0x2f')]:_0x214829[_0xfe05('0x2c')]+_0x214829[_0xfe05('0x2e')];var _0x47b81c;if(_0x4653ba>=_0x484679){_0x4653ba=_0x484679;_0x47b81c=0xc8;}else{_0x47b81c=0xce;}_0x2fa49e['status'](_0x47b81c);return _0x2fa49e[_0xfe05('0x30')](_0xfe05('0x31'),_0x1b240d+'-'+_0x4653ba+'/'+_0x484679)['json'](_0xe20837);}return null;};}function patchUpdates(_0x3e22db){return function(_0x2e6f1c){try{jsonpatch[_0xfe05('0x32')](_0x2e6f1c,_0x3e22db,!![]);}catch(_0x2fca67){return BPromise[_0xfe05('0x33')](_0x2fca67);}return _0x2e6f1c['save']();};}function saveUpdates(_0x26c584,_0x33b2a6){return function(_0x683136){if(_0x683136){return _0x683136[_0xfe05('0x34')](_0x26c584)[_0xfe05('0x35')](function(_0x5cc8f2){return _0x5cc8f2;});}return null;};}function removeEntity(_0x1ba102,_0x1ec0a8){return function(_0x203a91){if(_0x203a91){return _0x203a91[_0xfe05('0x36')]()[_0xfe05('0x35')](function(){var _0x3e17ca=_0x203a91[_0xfe05('0x37')]({'plain':!![]});var _0x399152=_0xfe05('0x38');return db[_0xfe05('0x39')][_0xfe05('0x36')]({'where':{'type':_0x399152,'resourceId':_0x3e17ca['id']}})[_0xfe05('0x35')](function(){return _0x203a91;});})['then'](function(){_0x1ba102[_0xfe05('0x2a')](0xcc)[_0xfe05('0x29')]();});}};}function handleEntityNotFound(_0xcdae32,_0xc9a5a6){return function(_0x28179f){if(!_0x28179f){_0xcdae32[_0xfe05('0x28')](0x194);}return _0x28179f;};}function handleError(_0x2545e1,_0x2f6dce){_0x2f6dce=_0x2f6dce||0x1f4;return function(_0x56c89e){logger[_0xfe05('0x25')](_0x56c89e[_0xfe05('0x3a')]);if(_0x56c89e[_0xfe05('0x3b')]){delete _0x56c89e['name'];}_0x2545e1[_0xfe05('0x2a')](_0x2f6dce)[_0xfe05('0x3c')](_0x56c89e);};}exports['index']=function(_0x10ff98,_0x4bbb97){var _0x4f9c36={'include':[{'model':db[_0xfe05('0x3d')],'as':_0xfe05('0x3e')}]},_0x11fff7={},_0x2f00af={'count':0x0,'rows':[]};var _0x482416=_[_0xfe05('0x3f')](db[_0xfe05('0x40')][_0xfe05('0x41')],function(_0xf2e649){return{'name':_0xf2e649[_0xfe05('0x42')],'type':_0xf2e649[_0xfe05('0x43')][_0xfe05('0x44')]};});_0x11fff7[_0xfe05('0x45')]=_[_0xfe05('0x3f')](_0x482416,_0xfe05('0x3b'));_0x11fff7[_0xfe05('0x46')]=_['keys'](_0x10ff98['query']);_0x11fff7[_0xfe05('0x47')]=_['intersection'](_0x11fff7['model'],_0x11fff7[_0xfe05('0x46')]);_0x4f9c36['attributes']=_['intersection'](_0x11fff7[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x10ff98[_0xfe05('0x46')][_0xfe05('0x48')]));_0x4f9c36[_0xfe05('0x49')]=_0x4f9c36[_0xfe05('0x49')][_0xfe05('0x4a')]?_0x4f9c36[_0xfe05('0x49')]:_0x11fff7[_0xfe05('0x45')];if(!_0x10ff98[_0xfe05('0x46')][_0xfe05('0x4b')](_0xfe05('0x4c'))){_0x4f9c36[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x10ff98[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x4f9c36[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x10ff98['query'][_0xfe05('0x2c')]);}_0x4f9c36[_0xfe05('0x4d')]=qs[_0xfe05('0x4e')](_0x10ff98[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x4f9c36[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x10ff98[_0xfe05('0x46')],_0x11fff7[_0xfe05('0x47')]),_0x482416);if(_0x10ff98[_0xfe05('0x46')][_0xfe05('0x51')]){_0x4f9c36[_0xfe05('0x4f')]=_[_0xfe05('0x52')](_0x4f9c36[_0xfe05('0x4f')],{'$or':_[_0xfe05('0x3f')](_0x482416,function(_0x436f11){if(_0x436f11[_0xfe05('0x43')]!==_0xfe05('0x53')){var _0x9caf6f={};_0x9caf6f[_0x436f11[_0xfe05('0x3b')]]={'$like':'%'+_0x10ff98[_0xfe05('0x46')]['filter']+'%'};return _0x9caf6f;}})});}_0x4f9c36=_[_0xfe05('0x52')]({},_0x4f9c36,_0x10ff98[_0xfe05('0x54')]);var _0x2ac949={'where':_0x4f9c36[_0xfe05('0x4f')]};return db[_0xfe05('0x40')][_0xfe05('0x2f')](_0x2ac949)[_0xfe05('0x35')](function(_0x36b6d6){_0x2f00af[_0xfe05('0x2f')]=_0x36b6d6;if(_0x10ff98['query']['includeAll']){_0x4f9c36[_0xfe05('0x55')]=[{'all':!![]}];}return db[_0xfe05('0x40')][_0xfe05('0x56')](_0x4f9c36);})[_0xfe05('0x35')](function(_0x5de7ef){_0x2f00af[_0xfe05('0x57')]=_0x5de7ef;return _0x2f00af;})[_0xfe05('0x35')](respondWithFilteredResult(_0x4bbb97,_0x4f9c36))['catch'](handleError(_0x4bbb97,null));};exports[_0xfe05('0x58')]=function(_0x289e43,_0x562edc){var _0x141064={'raw':![],'where':{'id':_0x289e43[_0xfe05('0x59')]['id']},'include':[{'model':db[_0xfe05('0x3d')],'as':_0xfe05('0x3e')}]},_0x3ed885={};_0x3ed885[_0xfe05('0x45')]=_['keys'](db[_0xfe05('0x40')]['rawAttributes']);_0x3ed885[_0xfe05('0x46')]=_['keys'](_0x289e43[_0xfe05('0x46')]);_0x3ed885[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x3ed885[_0xfe05('0x45')],_0x3ed885[_0xfe05('0x46')]);_0x141064[_0xfe05('0x49')]=_['intersection'](_0x3ed885[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x289e43[_0xfe05('0x46')]['fields']));_0x141064['attributes']=_0x141064['attributes'][_0xfe05('0x4a')]?_0x141064['attributes']:_0x3ed885[_0xfe05('0x45')];if(_0x289e43[_0xfe05('0x46')]['includeAll']){_0x141064[_0xfe05('0x55')]=[{'all':!![]}];}_0x141064=_['merge']({},_0x141064,_0x289e43[_0xfe05('0x54')]);return db[_0xfe05('0x40')][_0xfe05('0x5b')](_0x141064)[_0xfe05('0x35')](handleEntityNotFound(_0x562edc,null))[_0xfe05('0x35')](respondWithResult(_0x562edc,null))[_0xfe05('0x5c')](handleError(_0x562edc,null));};exports[_0xfe05('0x5d')]=function(_0x19cdbf,_0x5be3c7){return db[_0xfe05('0x40')]['create'](_0x19cdbf[_0xfe05('0x5e')],{})['then'](function(_0x16ab8e){var _0x426b42=_0x19cdbf[_0xfe05('0x5f')][_0xfe05('0x37')]({'plain':!![]});if(!_0x426b42)throw new Error(_0xfe05('0x60'));if(_0x426b42[_0xfe05('0x61')]===_0xfe05('0x5f')){var _0x1fa398=_0x16ab8e[_0xfe05('0x37')]({'plain':!![]});var _0x5e79dd=_0xfe05('0x38');return db[_0xfe05('0x62')]['find']({'where':{'name':_0x5e79dd,'userProfileId':_0x426b42[_0xfe05('0x63')]},'raw':!![]})['then'](function(_0x3aa1d1){if(_0x3aa1d1&&_0x3aa1d1['autoAssociation']===0x0){return db[_0xfe05('0x39')][_0xfe05('0x5d')]({'name':_0x1fa398['name'],'resourceId':_0x1fa398['id'],'type':_0x3aa1d1[_0xfe05('0x3b')],'sectionId':_0x3aa1d1['id']},{})[_0xfe05('0x35')](function(){return _0x16ab8e;});}else{return _0x16ab8e;}})['catch'](function(_0x1d062c){logger['error'](_0xfe05('0x64'),_0x1d062c);throw _0x1d062c;});}return _0x16ab8e;})['then'](respondWithResult(_0x5be3c7,0xc9))[_0xfe05('0x5c')](handleError(_0x5be3c7,null));};exports[_0xfe05('0x34')]=function(_0x202e07,_0x5591e9){if(_0x202e07['body']['id']){delete _0x202e07[_0xfe05('0x5e')]['id'];}return db[_0xfe05('0x40')]['find']({'where':{'id':_0x202e07['params']['id']},'include':[{'model':db[_0xfe05('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xfe05('0x35')](handleEntityNotFound(_0x5591e9,null))[_0xfe05('0x35')](saveUpdates(_0x202e07[_0xfe05('0x5e')],null))['then'](respondWithResult(_0x5591e9,null))[_0xfe05('0x5c')](handleError(_0x5591e9,null));};exports[_0xfe05('0x36')]=function(_0x8b07c,_0xbb29c7){return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x8b07c['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xbb29c7,null))[_0xfe05('0x35')](removeEntity(_0xbb29c7,null))[_0xfe05('0x5c')](handleError(_0xbb29c7,null));};exports[_0xfe05('0x65')]=function(_0x5154cf,_0x58f065){return db['FaxAccount'][_0xfe05('0x65')]()['then'](respondWithResult(_0x58f065,null))[_0xfe05('0x5c')](handleError(_0x58f065,null));};exports['addDisposition']=function(_0x34d2bf,_0x707321,_0x3574ed){if(_0x34d2bf[_0xfe05('0x5e')]['id']){delete _0x34d2bf[_0xfe05('0x5e')]['id'];}return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x34d2bf['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x707321,null))[_0xfe05('0x35')](function(_0x54aede){if(_0x54aede){_0x34d2bf[_0xfe05('0x5e')][_0xfe05('0x66')]=_0x54aede['id'];return db['Disposition'][_0xfe05('0x5d')](_0x34d2bf[_0xfe05('0x5e')]);}})['then'](respondWithResult(_0x707321,null))[_0xfe05('0x5c')](handleError(_0x707321,null));};exports['getDispositions']=function(_0x212756,_0xa681de,_0x539db6){var _0x5f465f={'raw':![],'where':{}};var _0x55bee7={};var _0x131f7e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfe05('0x67')]({'where':{'id':_0x212756['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xa681de,null))[_0xfe05('0x35')](function(_0x32a03f){if(_0x32a03f){_0x55bee7['model']=_['keys'](db['Disposition'][_0xfe05('0x41')]);_0x55bee7['query']=_[_0xfe05('0x68')](_0x212756[_0xfe05('0x46')]);_0x55bee7[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x55bee7[_0xfe05('0x45')],_0x55bee7[_0xfe05('0x46')]);_0x5f465f['attributes']=_['intersection'](_0x55bee7['model'],qs[_0xfe05('0x48')](_0x212756[_0xfe05('0x46')][_0xfe05('0x48')]));_0x5f465f[_0xfe05('0x49')]=_0x5f465f[_0xfe05('0x49')][_0xfe05('0x4a')]?_0x5f465f[_0xfe05('0x49')]:_0x55bee7['model'];if(!_0x212756['query']['hasOwnProperty'](_0xfe05('0x4c'))){_0x5f465f['limit']=qs[_0xfe05('0x2e')](_0x212756[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x5f465f['offset']=qs[_0xfe05('0x2c')](_0x212756['query'][_0xfe05('0x2c')]);}_0x5f465f['order']=qs[_0xfe05('0x4e')](_0x212756[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x5f465f[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x212756['query'],_0x55bee7[_0xfe05('0x47')]));_0x5f465f[_0xfe05('0x4f')]['FaxAccountId']=_0x32a03f['id'];if(_0x212756[_0xfe05('0x46')][_0xfe05('0x51')]){_0x5f465f[_0xfe05('0x4f')]=_['merge'](_0x5f465f['where'],{'$or':_[_0xfe05('0x3f')](_0x5f465f['attributes'],function(_0x13b657){var _0x4576fb={};_0x4576fb[_0x13b657]={'$like':'%'+_0x212756[_0xfe05('0x46')][_0xfe05('0x51')]+'%'};return _0x4576fb;})});}_0x5f465f=_[_0xfe05('0x52')]({},_0x5f465f,_0x212756[_0xfe05('0x54')]);return db[_0xfe05('0x69')][_0xfe05('0x2f')]({'where':_0x5f465f['where']})[_0xfe05('0x35')](function(_0x51e2eb){_0x131f7e[_0xfe05('0x2f')]=_0x51e2eb;if(_0x212756[_0xfe05('0x46')][_0xfe05('0x6a')]){_0x5f465f[_0xfe05('0x55')]=[{'all':!![]}];}return db[_0xfe05('0x69')][_0xfe05('0x56')](_0x5f465f);})[_0xfe05('0x35')](function(_0x5b2045){_0x131f7e[_0xfe05('0x57')]=_0x5b2045;return _0x131f7e;});}})[_0xfe05('0x35')](respondWithFilteredResult(_0xa681de,_0x5f465f))[_0xfe05('0x5c')](handleError(_0xa681de,null));};exports['removeDispositions']=function(_0x5668a7,_0x3dc60e,_0x5b048f){return db['FaxAccount'][_0xfe05('0x5b')]({'where':{'id':_0x5668a7[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x3dc60e,null))[_0xfe05('0x35')](function(_0x466bc7){if(_0x466bc7){return _0x466bc7[_0xfe05('0x6b')](_0x5668a7[_0xfe05('0x46')][_0xfe05('0x6c')]);}})[_0xfe05('0x35')](respondWithStatusCode(_0x3dc60e,null))[_0xfe05('0x5c')](handleError(_0x3dc60e,null));};exports[_0xfe05('0x6d')]=function(_0x47e1ac,_0x276bc4,_0x4ba851){if(_0x47e1ac[_0xfe05('0x5e')]['id']){delete _0x47e1ac[_0xfe05('0x5e')]['id'];}return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x47e1ac[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x276bc4,null))[_0xfe05('0x35')](function(_0x2be692){if(_0x2be692){_0x47e1ac['body'][_0xfe05('0x66')]=_0x2be692['id'];return db['CannedAnswer']['create'](_0x47e1ac[_0xfe05('0x5e')]);}})['then'](respondWithResult(_0x276bc4,null))[_0xfe05('0x5c')](handleError(_0x276bc4,null));};exports[_0xfe05('0x6e')]=function(_0x3e7c6a,_0xb9ea2a,_0x49996d){var _0x431ce5={'raw':![],'where':{}};var _0x153fd8={};var _0x481178={'count':0x0,'rows':[]};return db[_0xfe05('0x40')][_0xfe05('0x67')]({'where':{'id':_0x3e7c6a[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xb9ea2a,null))[_0xfe05('0x35')](function(_0x2dc3b1){if(_0x2dc3b1){_0x153fd8[_0xfe05('0x45')]=_[_0xfe05('0x68')](db[_0xfe05('0x6f')][_0xfe05('0x41')]);_0x153fd8[_0xfe05('0x46')]=_['keys'](_0x3e7c6a[_0xfe05('0x46')]);_0x153fd8[_0xfe05('0x47')]=_['intersection'](_0x153fd8[_0xfe05('0x45')],_0x153fd8[_0xfe05('0x46')]);_0x431ce5['attributes']=_[_0xfe05('0x5a')](_0x153fd8[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x48')]));_0x431ce5[_0xfe05('0x49')]=_0x431ce5['attributes'][_0xfe05('0x4a')]?_0x431ce5[_0xfe05('0x49')]:_0x153fd8['model'];if(!_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x4b')](_0xfe05('0x4c'))){_0x431ce5['limit']=qs[_0xfe05('0x2e')](_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x431ce5[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x3e7c6a['query'][_0xfe05('0x2c')]);}_0x431ce5[_0xfe05('0x4d')]=qs[_0xfe05('0x4e')](_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x431ce5[_0xfe05('0x4f')]=qs['filters'](_[_0xfe05('0x50')](_0x3e7c6a[_0xfe05('0x46')],_0x153fd8[_0xfe05('0x47')]));_0x431ce5[_0xfe05('0x4f')][_0xfe05('0x66')]=_0x2dc3b1['id'];if(_0x3e7c6a[_0xfe05('0x46')]['filter']){_0x431ce5[_0xfe05('0x4f')]=_['merge'](_0x431ce5[_0xfe05('0x4f')],{'$or':_[_0xfe05('0x3f')](_0x431ce5[_0xfe05('0x49')],function(_0x360bab){var _0x391a35={};_0x391a35[_0x360bab]={'$like':'%'+_0x3e7c6a[_0xfe05('0x46')]['filter']+'%'};return _0x391a35;})});}_0x431ce5=_[_0xfe05('0x52')]({},_0x431ce5,_0x3e7c6a['options']);return db[_0xfe05('0x6f')]['count']({'where':_0x431ce5['where']})[_0xfe05('0x35')](function(_0x440b79){_0x481178[_0xfe05('0x2f')]=_0x440b79;if(_0x3e7c6a['query'][_0xfe05('0x6a')]){_0x431ce5['include']=[{'all':!![]}];}return db[_0xfe05('0x6f')][_0xfe05('0x56')](_0x431ce5);})[_0xfe05('0x35')](function(_0x1c245b){_0x481178[_0xfe05('0x57')]=_0x1c245b;return _0x481178;});}})[_0xfe05('0x35')](respondWithFilteredResult(_0xb9ea2a,_0x431ce5))[_0xfe05('0x5c')](handleError(_0xb9ea2a,null));};exports['removeAnswers']=function(_0xfdb773,_0x14ab5b,_0x3497b5){return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0xfdb773[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x14ab5b,null))[_0xfe05('0x35')](function(_0x1c7aa1){if(_0x1c7aa1){return _0x1c7aa1[_0xfe05('0x70')](_0xfdb773[_0xfe05('0x46')][_0xfe05('0x6c')]);}})[_0xfe05('0x35')](respondWithStatusCode(_0x14ab5b,null))['catch'](handleError(_0x14ab5b,null));};exports[_0xfe05('0x71')]=function(_0x42fdc7,_0x3f100c,_0x1347ba){return db[_0xfe05('0x72')][_0xfe05('0x5b')]({'where':{'id':_0x42fdc7[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x3f100c,null))[_0xfe05('0x35')](function(_0x178b66){if(_0x178b66){return _0x178b66[_0xfe05('0x71')](_0x42fdc7[_0xfe05('0x5e')][_0xfe05('0x6c')],_[_0xfe05('0x73')](_0x42fdc7[_0xfe05('0x5e')],[_0xfe05('0x6c'),'id'])||{});}})[_0xfe05('0x35')](respondWithResult(_0x3f100c,null))[_0xfe05('0x5c')](handleError(_0x3f100c,null));};exports['getInteractions']=function(_0x173b53,_0xa263f9,_0x3d1a74){var _0x32a859={'raw':![],'where':{}};var _0x34c45b={};var _0x402cb5={'count':0x0,'rows':[]};return db[_0xfe05('0x40')][_0xfe05('0x67')]({'where':{'id':_0x173b53['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xa263f9,null))[_0xfe05('0x35')](function(_0x542bde){if(_0x542bde){_0x34c45b[_0xfe05('0x45')]=_['keys'](db[_0xfe05('0x72')]['rawAttributes']);_0x34c45b[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x173b53[_0xfe05('0x46')]);_0x34c45b[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x34c45b[_0xfe05('0x45')],_0x34c45b['query']);_0x32a859[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x34c45b[_0xfe05('0x45')],qs['fields'](_0x173b53[_0xfe05('0x46')][_0xfe05('0x48')]));_0x32a859[_0xfe05('0x49')]=_0x32a859['attributes'][_0xfe05('0x4a')]?_0x32a859[_0xfe05('0x49')]:_0x34c45b[_0xfe05('0x45')];if(!_0x173b53[_0xfe05('0x46')][_0xfe05('0x4b')](_0xfe05('0x4c'))){_0x32a859[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x173b53[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x32a859[_0xfe05('0x2c')]=qs['offset'](_0x173b53[_0xfe05('0x46')][_0xfe05('0x2c')]);}_0x32a859['order']=qs[_0xfe05('0x4e')](_0x173b53[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x32a859[_0xfe05('0x4f')]=qs['filters'](_[_0xfe05('0x50')](_0x173b53['query'],_0x34c45b[_0xfe05('0x47')]));_0x32a859[_0xfe05('0x4f')]['FaxAccountId']=_0x542bde['id'];if(_0x173b53['query']['filter']){_0x32a859[_0xfe05('0x4f')]=_['merge'](_0x32a859['where'],{'$or':_[_0xfe05('0x3f')](_0x32a859[_0xfe05('0x49')],function(_0x3dd00b){var _0x389931={};_0x389931[_0x3dd00b]={'$like':'%'+_0x173b53[_0xfe05('0x46')][_0xfe05('0x51')]+'%'};return _0x389931;})});}_0x32a859=_['merge']({},_0x32a859,_0x173b53[_0xfe05('0x54')]);return db[_0xfe05('0x72')][_0xfe05('0x2f')]({'where':_0x32a859['where']})[_0xfe05('0x35')](function(_0x12072c){_0x402cb5['count']=_0x12072c;if(_0x173b53['query'][_0xfe05('0x6a')]){_0x32a859[_0xfe05('0x55')]=[{'model':db[_0xfe05('0x74')],'as':_0xfe05('0x75'),'required':![]},{'model':db[_0xfe05('0x76')],'as':_0xfe05('0x77'),'attributes':[_0xfe05('0x3b'),_0xfe05('0x78'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xfe05('0x79'),'attributes':['id','name',_0xfe05('0x7a')],'where':_0x173b53[_0xfe05('0x46')]['tag']?{'id':_0x173b53[_0xfe05('0x46')][_0xfe05('0x7b')]}:undefined,'required':_0x173b53[_0xfe05('0x46')][_0xfe05('0x7b')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x32a859);})[_0xfe05('0x35')](function(_0x3308e3){_0x402cb5[_0xfe05('0x57')]=_0x3308e3;return _0x402cb5;});}})[_0xfe05('0x35')](respondWithFilteredResult(_0xa263f9,_0x32a859))[_0xfe05('0x5c')](handleError(_0xa263f9,null));};exports['addApplications']=function(_0x183191,_0x7b6d45){var _0x37661e=_0x183191[_0xfe05('0x59')]['id'];var _0x1b2e0a=_0x183191[_0xfe05('0x5e')];var _0xf303c3=0xc8;var _0x42b9b5=null;return db[_0xfe05('0x7c')][_0xfe05('0x7d')]({'isolationLevel':db[_0xfe05('0x7c')][_0xfe05('0x7e')][_0xfe05('0x7f')]['READ_COMMITTED']},function(_0x339b9c){return db[_0xfe05('0x40')][_0xfe05('0x67')]({'where':{'id':_0x37661e},'transaction':_0x339b9c})[_0xfe05('0x35')](function(_0x51cee9){if(_0x51cee9){return db[_0xfe05('0x80')][_0xfe05('0x36')]({'where':{'FaxAccountId':_0x37661e},'transaction':_0x339b9c})[_0xfe05('0x35')](function(){var _0x1ffa51=_[_0xfe05('0x3f')](_0x1b2e0a,function(_0xbb2d08){_0xbb2d08[_0xfe05('0x66')]=_0x37661e;return _0xbb2d08;});return db[_0xfe05('0x80')][_0xfe05('0x81')](_0x1ffa51,{'transaction':_0x339b9c});});}else{_0xf303c3=0x194;_0x42b9b5=[];}});})[_0xfe05('0x35')](function(){if(_0xf303c3!==0x194){return db['FaxApplication'][_0xfe05('0x82')]({'where':{'FaxAccountId':_0x37661e},'order':'priority'})[_0xfe05('0x35')](function(_0x2e0653){_0x42b9b5=_0x2e0653;});}})[_0xfe05('0x5c')](function(_0x580fe2){_0xf303c3=0x1f4;logger[_0xfe05('0x25')](_0x580fe2[_0xfe05('0x3a')]);if(_0x580fe2['name']){delete _0x580fe2[_0xfe05('0x3b')];}_0x42b9b5=_0x580fe2;})[_0xfe05('0x83')](function(){if(_0x42b9b5===null){_0x7b6d45[_0xfe05('0x28')](_0xf303c3);}else{if(_0xf303c3===0x1f4){_0x7b6d45[_0xfe05('0x2a')](_0xf303c3)[_0xfe05('0x3c')](_0x42b9b5);}else{_0x7b6d45['status'](_0xf303c3)['json'](_0x42b9b5);}}});};exports[_0xfe05('0x84')]=function(_0x2bfc89,_0xa2b339,_0x589e7a){var _0x566b08={};var _0x32a35c={};var _0x267758;var _0x351fe8;return db['FaxAccount'][_0xfe05('0x67')]({'where':{'id':_0x2bfc89['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xa2b339,null))[_0xfe05('0x35')](function(_0x3c49d5){if(_0x3c49d5){_0x267758=_0x3c49d5;_0x32a35c[_0xfe05('0x45')]=_['keys'](db[_0xfe05('0x80')][_0xfe05('0x41')]);_0x32a35c[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x2bfc89[_0xfe05('0x46')]);_0x32a35c[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x32a35c[_0xfe05('0x45')],_0x32a35c[_0xfe05('0x46')]);_0x566b08[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x32a35c[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x2bfc89['query'][_0xfe05('0x48')]));_0x566b08[_0xfe05('0x49')]=_0x566b08[_0xfe05('0x49')][_0xfe05('0x4a')]?_0x566b08[_0xfe05('0x49')]:_0x32a35c['model'];_0x566b08[_0xfe05('0x4d')]=qs['sort'](_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x566b08[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_['pick'](_0x2bfc89[_0xfe05('0x46')],_0x32a35c[_0xfe05('0x47')]));if(_0x2bfc89['query']['filter']){_0x566b08['where']=_[_0xfe05('0x52')](_0x566b08[_0xfe05('0x4f')],{'$or':_[_0xfe05('0x3f')](_0x566b08[_0xfe05('0x49')],function(_0x2d3692){var _0x5d24ca={};_0x5d24ca[_0x2d3692]={'$like':'%'+_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x51')]+'%'};return _0x5d24ca;})});}_0x566b08=_[_0xfe05('0x52')]({},_0x566b08,_0x2bfc89['options']);return _0x267758[_0xfe05('0x84')](_0x566b08);}})[_0xfe05('0x35')](function(_0x538201){if(_0x538201){_0x351fe8=_0x538201[_0xfe05('0x4a')];if(!_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x4b')]('nolimit')){_0x566b08[_0xfe05('0x2e')]=qs['limit'](_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x566b08[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x2c')]);}return _0x267758[_0xfe05('0x84')](_0x566b08);}})[_0xfe05('0x35')](function(_0x5b6dec){if(_0x5b6dec){return _0x5b6dec?{'count':_0x351fe8,'rows':_0x5b6dec}:null;}})[_0xfe05('0x35')](respondWithResult(_0xa2b339,null))[_0xfe05('0x5c')](handleError(_0xa2b339,null));};function Extension(_0x4bddc2,_0x2f97f4,_0x568ca3,_0x20323){this[_0xfe05('0x85')]=_0xfe05('0x86');this[_0xfe05('0x87')]=_0x4bddc2[_0xfe05('0x88')];this[_0xfe05('0x89')]=_0x20323;this[_0xfe05('0x43')]=_0xfe05('0x8a');this[_0xfe05('0x8b')]=_0xfe05('0x8c');this[_0xfe05('0x66')]=_0x4bddc2['id'];this['priority']=_0x2f97f4;this[_0xfe05('0x8d')]=_0x568ca3;}function createExtensionsReciveFax(_0x228130){var _0x57f10f=0x1;var _0x39cdc5=[];_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,'','Answer'));_0x57f10f+=0x1;_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,_0xfe05('0x8f'),_0xfe05('0x90')));_0x57f10f+=0x1;for(var _0x30c961 in _0x228130){if(_0x228130[_0xfe05('0x4b')](_0x30c961)&&(_0x30c961===_0xfe05('0x91')||_0x30c961==='localstationid'||_0x30c961===_0xfe05('0x92')||_0x30c961===_0xfe05('0x93')||_0x30c961===_0xfe05('0x94')||_0x30c961==='maxrate'||_0x30c961===_0xfe05('0x95')||_0x30c961===_0xfe05('0x96')||_0x30c961==='t38timeout')){_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,_0xfe05('0x97')+_0x30c961+')='+_0x228130[_0x30c961],_0xfe05('0x90')));_0x57f10f+=0x1;}}_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,'6',_0xfe05('0x98')));_0x57f10f+=0x1;_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,_0xfe05('0x99'),_0xfe05('0x9a')));_0x57f10f=0x0;return _0x39cdc5;}exports[_0xfe05('0x9b')]=function(_0x8c356b,_0x258624,_0x294a18){var _0x428504;return db[_0xfe05('0x7c')][_0xfe05('0x7d')](function(_0x1dd5ab){return db['FaxAccount'][_0xfe05('0x5d')](_0x8c356b['body'],{'transaction':_0x1dd5ab})[_0xfe05('0x35')](function(_0x59f79f){_0x428504=_0x59f79f[_0xfe05('0x37')]({'plain':!![]});return db[_0xfe05('0x9c')][_0xfe05('0x81')](createExtensionsReciveFax(_0x428504),{'transaction':_0x1dd5ab});});})[_0xfe05('0x35')](function(){return _0x428504;})[_0xfe05('0x35')](respondWithResult(_0x258624,null))[_0xfe05('0x5c')](handleError(_0x258624,null));};exports[_0xfe05('0x9d')]=function(_0x7f5b4a,_0x1d3020,_0x5a0913){var _0x4fc86f;return db[_0xfe05('0x7c')][_0xfe05('0x7d')](function(_0x3e601a){return db[_0xfe05('0x40')]['update'](_0x7f5b4a['body'],{'where':{'id':_0x7f5b4a[_0xfe05('0x5e')]['id']},'transaction':_0x3e601a})['then'](function(_0x59c7e0){return db['VoiceExtension'][_0xfe05('0x36')]({'where':{'FaxAccountId':_0x7f5b4a[_0xfe05('0x5e')]['id']},'transaction':_0x3e601a})['then'](function(_0x541da3){return db[_0xfe05('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0xfe05('0x73')](_0x7f5b4a[_0xfe05('0x5e')],[_0xfe05('0x9e'),_0xfe05('0x44'),_0xfe05('0x9f'),'updatedAt',_0xfe05('0xa0'),_0xfe05('0xa1')])),{'transaction':_0x3e601a});});});})[_0xfe05('0x35')](function(){return db[_0xfe05('0x40')][_0xfe05('0xa2')](_0x7f5b4a[_0xfe05('0x5e')]['id']);})[_0xfe05('0x35')](respondWithResult(_0x1d3020,null))[_0xfe05('0x5c')](handleError(_0x1d3020,null));};exports['getMessages']=function(_0x2acd4f,_0x4d5395,_0x3b57bb){var _0x9eb59c={'raw':!![],'where':{}};var _0x4ac31d={};var _0x1024a4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2acd4f['params']['id']}})['then'](handleEntityNotFound(_0x4d5395,null))[_0xfe05('0x35')](function(_0x2581a3){if(_0x2581a3){_0x4ac31d[_0xfe05('0x45')]=_[_0xfe05('0x68')](db['FaxMessage']['rawAttributes']);_0x4ac31d[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x2acd4f['query']);_0x4ac31d[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x4ac31d[_0xfe05('0x45')],_0x4ac31d['query']);_0x9eb59c[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x4ac31d[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x2acd4f[_0xfe05('0x46')][_0xfe05('0x48')]));_0x9eb59c['attributes']=_0x9eb59c['attributes'][_0xfe05('0x4a')]?_0x9eb59c[_0xfe05('0x49')]:_0x4ac31d['model'];if(!_0x2acd4f['query']['hasOwnProperty'](_0xfe05('0x4c'))){_0x9eb59c[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x2acd4f[_0xfe05('0x46')]['limit']);_0x9eb59c[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x2acd4f[_0xfe05('0x46')][_0xfe05('0x2c')]);}_0x9eb59c['order']=qs[_0xfe05('0x4e')](_0x2acd4f[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x9eb59c[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x2acd4f['query'],_0x4ac31d[_0xfe05('0x47')]));_0x9eb59c[_0xfe05('0x4f')][_0xfe05('0x66')]=_0x2581a3['id'];if(_0x2acd4f['query'][_0xfe05('0x51')]){_0x9eb59c[_0xfe05('0x4f')]=_[_0xfe05('0x52')](_0x9eb59c['where'],{'$or':_[_0xfe05('0x3f')](_0x9eb59c[_0xfe05('0x49')],function(_0x5681d0){var _0x497ac1={};_0x497ac1[_0x5681d0]={'$like':'%'+_0x2acd4f[_0xfe05('0x46')]['filter']+'%'};return _0x497ac1;})});}if(_0x2acd4f[_0xfe05('0x46')]['$gte']){var _0x1ee333=_0x2acd4f[_0xfe05('0x46')][_0xfe05('0xa3')]['split'](',');var _0x559963={};_0x559963[_0x1ee333[0x0]]={'$gte':moment(_0x1ee333[0x1])[_0xfe05('0xa4')](_0xfe05('0xa5'))};_0x9eb59c[_0xfe05('0x4f')]=_['merge'](_0x9eb59c[_0xfe05('0x4f')],_0x559963);}_0x9eb59c=_['merge']({},_0x9eb59c,_0x2acd4f[_0xfe05('0x54')]);return db['FaxMessage']['count']({'where':_0x9eb59c[_0xfe05('0x4f')]})[_0xfe05('0x35')](function(_0x2940cc){_0x1024a4[_0xfe05('0x2f')]=_0x2940cc;if(_0x2acd4f['query'][_0xfe05('0x6a')]){_0x9eb59c[_0xfe05('0x55')]=[{'all':!![]}];}return db[_0xfe05('0xa6')]['findAll'](_0x9eb59c);})[_0xfe05('0x35')](function(_0x52cd9d){_0x1024a4[_0xfe05('0x57')]=_0x52cd9d;return _0x1024a4;});}})['then'](respondWithFilteredResult(_0x4d5395,_0x9eb59c))[_0xfe05('0x5c')](handleError(_0x4d5395,null));};exports[_0xfe05('0x3c')]=function(_0x457d02,_0x3729a6,_0x16333f){var _0x3a9559,_0x1b7ea9={},_0x3f9036;if(_0x457d02['body']['to']){_0x3f9036=_0x457d02[_0xfe05('0x5e')]['to'][0x0];}return db[_0xfe05('0x40')]['find']({'where':{'id':_0x457d02['params']['id']},'include':[{'model':db['CmList'],'as':_0xfe05('0xa7'),'include':[{'model':db[_0xfe05('0x74')],'as':'Contacts','where':{'fax':_0x3f9036},'limit':0x1,'order':[[_0xfe05('0xa8'),_0xfe05('0xa9')]]}]}]})[_0xfe05('0x35')](handleEntityNotFound(_0x3729a6,null))[_0xfe05('0x35')](function(_0x4afa2e){_0x3a9559=_0x4afa2e;if(_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')]&&_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][_0xfe05('0x4a')]){for(var _0xe234b8=0x0;_0xe234b8<_0x457d02['body'][_0xfe05('0xaa')][_0xfe05('0x4a')];_0xe234b8+=0x1){_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][_0xe234b8]={'filename':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][_0xe234b8][_0xfe05('0x3b')],'id':_0x457d02['body'][_0xfe05('0xaa')][_0xe234b8]['id'],'path':path[_0xfe05('0xab')](config['root'],_0xfe05('0xac'),_0x457d02['body'][_0xfe05('0xaa')][_0xe234b8]['basename'])};}}return respondWithRpcPromise(_0xfe05('0xad'),_0xfe05('0xad'),{'FaxAccountId':_['isNil'](_0x457d02[_0xfe05('0x59')]['id'])?undefined:_0x457d02[_0xfe05('0x59')]['id'],'path':_[_0xfe05('0xae')](_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0][_0xfe05('0xaf')])?undefined:_0x457d02['body'][_0xfe05('0xaa')][0x0]['path'],'fax':_[_0xfe05('0xae')](_0x457d02['body']['to'][0x0])?undefined:_0x457d02[_0xfe05('0x5e')]['to'][0x0]},client9002);})[_0xfe05('0x35')](function(){if(_0x3a9559){if(_['isNil'](_0x457d02[_0xfe05('0x5e')][_0xfe05('0xb0')])){_0x457d02['body'][_0xfe05('0xb0')]=util[_0xfe05('0xa4')](_0xfe05('0xb1'),_0x3a9559[_0xfe05('0x3b')],_0x3a9559[_0xfe05('0xb2')]);}if(_0x3a9559[_0xfe05('0xa7')]){if(_0x3a9559[_0xfe05('0xa7')][_0xfe05('0xb3')][_0xfe05('0x4a')]){return _0x3a9559[_0xfe05('0xa7')][_0xfe05('0xb3')][0x0];}else{return db[_0xfe05('0x74')][_0xfe05('0x5d')](_['defaults'](_0x457d02[_0xfe05('0x5e')],{'firstName':_0x457d02[_0xfe05('0x5e')]['to'][0x0],'phone':_0x457d02[_0xfe05('0x5e')]['to'][0x0],'fax':_0x457d02[_0xfe05('0x5e')]['to'][0x0],'ListId':_0x3a9559['ListId']}));}}else{throw new Error(_0xfe05('0xb4'));}}else{throw new Error(_0xfe05('0xb5'));}})[_0xfe05('0x35')](function(_0xe6a7a1){if(_0xe6a7a1){return db[_0xfe05('0x72')][_0xfe05('0x5b')]({'where':{'ContactId':_0xe6a7a1['id'],'closed':![],'FaxAccountId':_0x3a9559['id']}})[_0xfe05('0x35')](function(_0x5152b2){if(_0x5152b2){return[_0x5152b2,![]];}return db['FaxInteraction'][_0xfe05('0x5d')]({'UserId':_0x457d02[_0xfe05('0x5f')]['id'],'ContactId':_0xe6a7a1['id'],'FaxAccountId':_0x3a9559['id'],'fax':_0x457d02['body']['to'][0x0],'firstMsgDirection':_0xfe05('0xb6'),'Messages':[_[_0xfe05('0x52')](_0x457d02[_0xfe05('0x5e')],{'read':![],'body':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0]['filename'],'FaxAccountId':_0x3a9559['id'],'UserId':_0x457d02['user']['id'],'ContactId':_0xe6a7a1['id'],'AttachmentId':_0x457d02[_0xfe05('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xfe05('0xa6')],'as':'Messages'}]})['then'](function(_0x12fa3a){return[_0x12fa3a,!![]];});});}else{throw new Error(_0xfe05('0xb7'));}})[_0xfe05('0xb8')](function(_0x269854,_0x505180){if(_0x505180){return _0x269854;}return db[_0xfe05('0xa6')][_0xfe05('0x5d')]({'direction':_0xfe05('0xb6'),'read':![],'body':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0]['filename'],'FaxAccountId':_0x3a9559['id'],'FaxInteractionId':_0x269854['id'],'UserId':_0x457d02[_0xfe05('0x5f')]['id'],'ContactId':_0x269854['ContactId'],'AttachmentId':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0]['id']})[_0xfe05('0x35')](function(_0x463872){_0x269854[_0xfe05('0xb9')]['Messages']=[];_0x269854['dataValues'][_0xfe05('0xba')][_0xfe05('0x8e')](_0x463872['dataValues']);return _0x269854;});})['then'](function(_0xe648a){respondWithRpcPromise(_0xfe05('0xbb'),'SendFax',{'FaxAccountId':_['isNil'](_0x457d02['params']['id'])?undefined:_0x457d02[_0xfe05('0x59')]['id'],'path':_['isNil'](_0x457d02['body'][_0xfe05('0xaa')][0x0]['path'])?undefined:_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0][_0xfe05('0xaf')],'fax':_[_0xfe05('0xae')](_0x457d02['body']['to'][0x0])?undefined:_0x457d02[_0xfe05('0x5e')]['to'][0x0],'AttachmentId':_0x457d02[_0xfe05('0x5e')]['attachments'][0x0]['id']},client9002)['then'](function(_0x1ad919){logger[_0xfe05('0x1f')]('SendFaxRpc,\x20%s',_0x1ad919);})[_0xfe05('0x5c')](function(_0x49e870){logger[_0xfe05('0x1f')]('SendFaxRpc,\x20%s',_0x49e870);});return _0xe648a;})[_0xfe05('0x35')](respondWithResult(_0x3729a6,null))[_0xfe05('0x5c')](handleError(_0x3729a6,null));};exports[_0xfe05('0xbc')]=function(_0x4710da,_0x51195c,_0x1ec0d7){return db[_0xfe05('0x40')]['find']({'where':{'id':_0x4710da[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x51195c,null))[_0xfe05('0x35')](function(_0x3ef44d){if(_0x3ef44d){return _0x3ef44d[_0xfe05('0xbc')](_0x4710da[_0xfe05('0x5e')]['ids'],_['omit'](_0x4710da[_0xfe05('0x5e')],[_0xfe05('0x6c'),'id'])||{})[_0xfe05('0xb8')](function(_0x478b49){for(var _0x3133b0=0x0;_0x3133b0<_0x4710da[_0xfe05('0x5e')][_0xfe05('0x6c')]['length'];_0x3133b0+=0x1){socket[_0xfe05('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x4710da['body'][_0xfe05('0x6c')][_0x3133b0]),'FaxAccountId':Number(_0x4710da[_0xfe05('0x59')]['id'])});}return _0x478b49;});}})[_0xfe05('0x35')](respondWithResult(_0x51195c,null))[_0xfe05('0x5c')](handleError(_0x51195c,null));};exports[_0xfe05('0xbe')]=function(_0x4f1043,_0x9732ef,_0x3a61ad){return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x4f1043[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x9732ef,null))[_0xfe05('0x35')](function(_0x5cb122){if(_0x5cb122){return _0x5cb122['removeAgents'](_0x4f1043['query'][_0xfe05('0x6c')])[_0xfe05('0x35')](function(){if(_[_0xfe05('0xbf')](_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')])){for(var _0x5786ad=0x0;_0x5786ad<_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')]['length'];_0x5786ad+=0x1){socket['emit'](_0xfe05('0xc0'),{'UserId':Number(_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')][_0x5786ad]),'FaxAccountId':Number(_0x4f1043[_0xfe05('0x59')]['id'])});}}else{socket['emit'](_0xfe05('0xc0'),{'UserId':Number(_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')]),'FaxAccountId':Number(_0x4f1043[_0xfe05('0x59')]['id'])});}});}})[_0xfe05('0x35')](respondWithStatusCode(_0x9732ef,null))[_0xfe05('0x5c')](handleError(_0x9732ef,null));};exports[_0xfe05('0xc1')]=function(_0x3465e8,_0x5ad939,_0x1502a1){var _0x280356={};var _0x561640={};var _0x9c9c4e;var _0x4afac7;return db[_0xfe05('0x40')]['findOne']({'where':{'id':_0x3465e8[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x5ad939,null))[_0xfe05('0x35')](function(_0x17af7d){if(_0x17af7d){_0x9c9c4e=_0x17af7d;_0x561640[_0xfe05('0x45')]=_[_0xfe05('0x68')](db[_0xfe05('0x76')][_0xfe05('0x41')]);_0x561640[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x3465e8[_0xfe05('0x46')]);_0x561640[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x561640[_0xfe05('0x45')],_0x561640[_0xfe05('0x46')]);_0x280356[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x561640[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x3465e8[_0xfe05('0x46')][_0xfe05('0x48')]));_0x280356[_0xfe05('0x49')]=_0x280356['attributes'][_0xfe05('0x4a')]?_0x280356[_0xfe05('0x49')]:_0x561640[_0xfe05('0x45')];_0x280356[_0xfe05('0x4d')]=qs[_0xfe05('0x4e')](_0x3465e8[_0xfe05('0x46')]['sort']);_0x280356[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x3465e8[_0xfe05('0x46')],_0x561640[_0xfe05('0x47')]));if(_0x3465e8[_0xfe05('0x46')][_0xfe05('0x51')]){_0x280356['where']=_[_0xfe05('0x52')](_0x280356[_0xfe05('0x4f')],{'$or':_['map'](_0x280356[_0xfe05('0x49')],function(_0x55b51a){var _0x1f5d0a={};_0x1f5d0a[_0x55b51a]={'$like':'%'+_0x3465e8[_0xfe05('0x46')]['filter']+'%'};return _0x1f5d0a;})});}_0x280356=_[_0xfe05('0x52')]({},_0x280356,_0x3465e8['options']);return _0x9c9c4e[_0xfe05('0xc1')](_0x280356);}})[_0xfe05('0x35')](function(_0x51fe77){if(_0x51fe77){_0x4afac7=_0x51fe77[_0xfe05('0x4a')];if(!_0x3465e8[_0xfe05('0x46')]['hasOwnProperty'](_0xfe05('0x4c'))){_0x280356[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x3465e8[_0xfe05('0x46')]['limit']);_0x280356[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x3465e8[_0xfe05('0x46')][_0xfe05('0x2c')]);}return _0x9c9c4e[_0xfe05('0xc1')](_0x280356);}})[_0xfe05('0x35')](function(_0x1a5164){if(_0x1a5164){return _0x1a5164?{'count':_0x4afac7,'rows':_0x1a5164}:null;}})[_0xfe05('0x35')](respondWithResult(_0x5ad939,null))[_0xfe05('0x5c')](handleError(_0x5ad939,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 53ca3e2..2b4dde3 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 _0xc2fd=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x558c38,_0x23d8ed){var _0x228dfa=function(_0x1a4832){while(--_0x1a4832){_0x558c38['push'](_0x558c38['shift']());}};_0x228dfa(++_0x23d8ed);}(_0xc2fd,0x12e));var _0xdc2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc2fd[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xdc2f('0x0'));var FaxAccount=require(_0xdc2f('0x1'))['db'][_0xdc2f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdc2f('0x3')](0x0);var events={'afterCreate':_0xdc2f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x571374){return function(_0x2a6e1a,_0xb45cb9,_0x38c17b){FaxAccountEvents['emit'](_0x571374+':'+_0x2a6e1a['id'],_0x2a6e1a);FaxAccountEvents[_0xdc2f('0x5')](_0x571374,_0x2a6e1a);_0x38c17b(null);};}for(var e in events){if(events[_0xdc2f('0x6')](e)){var event=events[e];FaxAccount[_0xdc2f('0x7')](e,emitEvent(event));}}module[_0xdc2f('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xaf85=['emit','hasOwnProperty','events','../../mysqldb','FaxAccount','remove'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xaf85,0xb0));var _0x5af8=function(_0x44f630,_0xcdd7f8){_0x44f630=_0x44f630-0x0;var _0x3633ef=_0xaf85[_0x44f630];return _0x3633ef;};'use strict';var EventEmitter=require(_0x5af8('0x0'));var FaxAccount=require(_0x5af8('0x1'))['db'][_0x5af8('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5af8('0x3')};function emitEvent(_0x23e6db){return function(_0x25aebf,_0x334e87,_0x15c50f){FaxAccountEvents[_0x5af8('0x4')](_0x23e6db+':'+_0x25aebf['id'],_0x25aebf);FaxAccountEvents[_0x5af8('0x4')](_0x23e6db,_0x25aebf);_0x15c50f(null);};}for(var e in events){if(events[_0x5af8('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c1d7e10..de61301 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 _0xf7f5=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxAccount.attributes','define','FaxAccount'];(function(_0x306822,_0x4bb65f){var _0x2025c5=function(_0x40a350){while(--_0x40a350){_0x306822['push'](_0x306822['shift']());}};_0x2025c5(++_0x4bb65f);}(_0xf7f5,0x1ae));var _0x5f7f=function(_0x16b7e9,_0x396d0c){_0x16b7e9=_0x16b7e9-0x0;var _0x506c11=_0xf7f5[_0x16b7e9];return _0x506c11;};'use strict';var _=require('lodash');var util=require(_0x5f7f('0x0'));var logger=require(_0x5f7f('0x1'))(_0x5f7f('0x2'));var moment=require(_0x5f7f('0x3'));var BPromise=require(_0x5f7f('0x4'));var rp=require(_0x5f7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f7f('0x6'));var attributes=require(_0x5f7f('0x7'));module['exports']=function(_0xe20202,_0x4ae180){return _0xe20202[_0x5f7f('0x8')](_0x5f7f('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6930=['fax_accounts','lodash','util','../../config/logger','api','./faxAccount.attributes','exports'];(function(_0x323303,_0x22c4fb){var _0x1bac97=function(_0x5baa41){while(--_0x5baa41){_0x323303['push'](_0x323303['shift']());}};_0x1bac97(++_0x22c4fb);}(_0x6930,0xf6));var _0x0693=function(_0x44438d,_0x54fcef){_0x44438d=_0x44438d-0x0;var _0x3b2f2f=_0x6930[_0x44438d];return _0x3b2f2f;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var logger=require(_0x0693('0x2'))(_0x0693('0x3'));var moment=require('moment');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(_0x0693('0x4'));module[_0x0693('0x5')]=function(_0x1e242b,_0x415ddf){return _0x1e242b['define']('FaxAccount',attributes,{'tableName':_0x0693('0x6'),'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 83a97fb..704abea 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 _0x36cb=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','FaxAccount,\x20%s,\x20%s','findAll','options','raw','where','attributes','limit','include','model','map','then','GetFaxAccount','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','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','FaxAccount','find','account','CmList','List','Contacts','DESC','Applications','applications','list','priority','asc','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x368ec1,_0x59ec55){var _0x179184=function(_0x21073d){while(--_0x21073d){_0x368ec1['push'](_0x368ec1['shift']());}};_0x179184(++_0x59ec55);}(_0x36cb,0x167));var _0xb36c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x36cb[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xb36c('0x0'));var util=require('util');var moment=require(_0xb36c('0x1'));var BPromise=require(_0xb36c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb36c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb36c('0x4'));var logger=require(_0xb36c('0x5'))('rpc');var config=require(_0xb36c('0x6'));var jayson=require(_0xb36c('0x7'));var client=jayson[_0xb36c('0x8')][_0xb36c('0x9')]({'port':0x232c});config[_0xb36c('0xa')]=_[_0xb36c('0xb')](config[_0xb36c('0xa')],{'host':_0xb36c('0xc'),'port':0x18eb});var socket=require(_0xb36c('0xd'))(new Redis(config['redis']));require(_0xb36c('0xe'))[_0xb36c('0xf')](socket);function respondWithRpcPromise(_0x50a698,_0x4686e9,_0x154e1c){return new BPromise(function(_0x228af1,_0x13daa5){return client['request'](_0x50a698,_0x154e1c)['then'](function(_0x4ce355){logger[_0xb36c('0x10')]('FaxAccount,\x20%s,\x20%s',_0x4686e9,'request\x20sent');logger[_0xb36c('0x11')](_0xb36c('0x12'),_0x4686e9,_0xb36c('0x13'),JSON[_0xb36c('0x14')](_0x4ce355));if(_0x4ce355[_0xb36c('0x15')]){if(_0x4ce355[_0xb36c('0x15')]['code']===0x1f4){logger[_0xb36c('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4686e9,_0x4ce355[_0xb36c('0x15')]['message']);return _0x13daa5(_0x4ce355[_0xb36c('0x15')][_0xb36c('0x16')]);}logger[_0xb36c('0x15')](_0xb36c('0x17'),_0x4686e9,_0x4ce355[_0xb36c('0x15')]['message']);return _0x228af1(_0x4ce355[_0xb36c('0x15')][_0xb36c('0x16')]);}else{logger[_0xb36c('0x10')](_0xb36c('0x17'),_0x4686e9,_0xb36c('0x13'));_0x228af1(_0x4ce355['result'][_0xb36c('0x16')]);}})['catch'](function(_0x241441){logger[_0xb36c('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4686e9,_0x241441);_0x13daa5(_0x241441);});});}exports['GetFaxAccount']=function(_0x3fe4e2){var _0x9d9265=this;return new Promise(function(_0x276ed7,_0x5467c2){return db['FaxAccount'][_0xb36c('0x18')]({'raw':_0x3fe4e2[_0xb36c('0x19')]?_0x3fe4e2[_0xb36c('0x19')][_0xb36c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fe4e2['options']?_0x3fe4e2[_0xb36c('0x19')][_0xb36c('0x1b')]||null:null,'attributes':_0x3fe4e2[_0xb36c('0x19')]?_0x3fe4e2['options'][_0xb36c('0x1c')]||null:null,'limit':_0x3fe4e2[_0xb36c('0x19')]?_0x3fe4e2[_0xb36c('0x19')][_0xb36c('0x1d')]||null:null,'include':_0x3fe4e2['options']?_0x3fe4e2[_0xb36c('0x19')]['include']?_['map'](_0x3fe4e2[_0xb36c('0x19')][_0xb36c('0x1e')],function(_0x5821bf){return{'model':db[_0x5821bf[_0xb36c('0x1f')]],'as':_0x5821bf['as'],'attributes':_0x5821bf[_0xb36c('0x1c')],'include':_0x5821bf['include']?_[_0xb36c('0x20')](_0x5821bf[_0xb36c('0x1e')],function(_0x347945){return{'model':db[_0x347945[_0xb36c('0x1f')]],'as':_0x347945['as'],'attributes':_0x347945[_0xb36c('0x1c')],'include':_0x347945['include']?_[_0xb36c('0x20')](_0x347945[_0xb36c('0x1e')],function(_0x32b8f7){return{'model':db[_0x32b8f7[_0xb36c('0x1f')]],'as':_0x32b8f7['as'],'attributes':_0x32b8f7[_0xb36c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb36c('0x21')](function(_0xb79a7a){logger[_0xb36c('0x10')](_0xb36c('0x22'),_0x3fe4e2);logger[_0xb36c('0x11')]('GetFaxAccount',_0x3fe4e2,JSON[_0xb36c('0x14')](_0xb79a7a));_0x276ed7(_0xb79a7a);})[_0xb36c('0x23')](function(_0x18f452){logger[_0xb36c('0x15')]('GetFaxAccount',_0x18f452['message'],_0x3fe4e2);_0x5467c2(_0x9d9265['error'](0x1f4,_0x18f452[_0xb36c('0x16')]));});});};exports[_0xb36c('0x24')]=function(_0x552075,_0x2e55ad,_0x195833){var _0x57081b=this;return new Promise(function(_0x2bd718,_0x1e2550){var _0x3f9d9a={'body':_0x552075[_0xb36c('0x25')],'channel':_0xb36c('0x26')};var _0x59ed0d=[];var _0x249723=[];var _0x567f0c={};return db[_0xb36c('0x27')][_0xb36c('0x28')]()['then'](function(_0xe8919e){if(!_0xe8919e){throw new db[(_0xb36c('0x29'))]['ValidationError'](_0xb36c('0x2a'));}_0x59ed0d=_[_0xb36c('0x2b')](_[_0xb36c('0x2c')](_0xe8919e),[_0xb36c('0x2d'),_0xb36c('0x2e')]);_0x249723=_[_0xb36c('0x2b')](_[_0xb36c('0x2c')](_0xe8919e),[_0xb36c('0x2d'),_0xb36c('0x2e'),_0xb36c('0x2f'),_0xb36c('0x30')]);if(_0x552075[_0xb36c('0x25')]['id']){delete _0x552075['body']['id'];}if(_[_0xb36c('0x31')](_0x552075[_0xb36c('0x25')][_0xb36c('0x32')])){throw new db[(_0xb36c('0x29'))][(_0xb36c('0x33'))](_0xb36c('0x34'));}if(_[_0xb36c('0x31')](_0x552075['body'][_0xb36c('0x25')])||_0x552075[_0xb36c('0x25')][_0xb36c('0x25')]===''){throw new db[(_0xb36c('0x29'))][(_0xb36c('0x33'))](_0xb36c('0x35'));}if(_[_0xb36c('0x31')](_0x552075[_0xb36c('0x25')][_0xb36c('0x36')])){throw new db[(_0xb36c('0x29'))][(_0xb36c('0x33'))](_0xb36c('0x37')+_0x249723);}if(!_['includes'](_0x249723,_0x552075[_0xb36c('0x25')][_0xb36c('0x36')])){throw new db[(_0xb36c('0x29'))][(_0xb36c('0x33'))](_0xb36c('0x38')+_0x249723);}_0x567f0c[_0x552075[_0xb36c('0x25')][_0xb36c('0x36')]]=_0x552075[_0xb36c('0x25')][_0xb36c('0x32')];})[_0xb36c('0x21')](function(){return db[_0xb36c('0x39')][_0xb36c('0x3a')]({'where':{'id':_0x552075[_0xb36c('0x3b')]['id']},'include':[{'model':db[_0xb36c('0x3c')],'as':_0xb36c('0x3d'),'include':[{'model':db[_0xb36c('0x27')],'as':_0xb36c('0x3e'),'where':_0x567f0c,'limit':0x1,'order':[[_0xb36c('0x2e'),_0xb36c('0x3f')]]}]},{'model':db['FaxApplication'],'as':_0xb36c('0x40')}]});})[_0xb36c('0x21')](function(_0x29287f){if(_0x29287f&&_0x29287f[_0xb36c('0x3d')]){var _0x57d3e8=_0x29287f['get']({'plain':!![]});_0x3f9d9a[_0xb36c('0x3b')]=_0x57d3e8;_0x3f9d9a[_0xb36c('0x41')]=_0x57d3e8['Applications'];_0x3f9d9a[_0xb36c('0x42')]=_0x57d3e8[_0xb36c('0x3d')];_0x3f9d9a[_0xb36c('0x41')]=_['orderBy'](_0x3f9d9a['applications'],[_0xb36c('0x43')],[_0xb36c('0x44')]);if(_0x3f9d9a[_0xb36c('0x3b')][_0xb36c('0x40')]){delete _0x3f9d9a[_0xb36c('0x3b')][_0xb36c('0x40')];}if(_0x3f9d9a['account'][_0xb36c('0x3d')]&&_0x3f9d9a[_0xb36c('0x3b')][_0xb36c('0x3d')][_0xb36c('0x3e')]['length']){return _0x3f9d9a[_0xb36c('0x3b')][_0xb36c('0x3d')][_0xb36c('0x3e')][0x0];}var _0x23cf50=_[_0xb36c('0xb')](_0x552075[_0xb36c('0x25')],{'firstName':_0x552075[_0xb36c('0x25')]['from'],'ListId':_0x57d3e8[_0xb36c('0x30')]});_0x23cf50[_0x552075[_0xb36c('0x25')]['mapKey']]=_0x552075[_0xb36c('0x25')][_0xb36c('0x32')];return db[_0xb36c('0x27')][_0xb36c('0x45')](_0x23cf50,{'fields':_0x59ed0d,'raw':!![]});}})[_0xb36c('0x21')](function(_0xb4d060){_0x3f9d9a['contact']=_0xb4d060;if(_0xb4d060){var _0x1443bc={'ContactId':_0xb4d060['id'],'FaxAccountId':_0x552075[_0xb36c('0x3b')]['id'],'fax':_0xb4d060[_0xb36c('0x26')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0xb4d060['id'],'closed':![],'FaxAccountId':_0x552075['account']['id']}})[_0xb36c('0x21')](function(_0xc030ec){if(_0xc030ec){return[_0xc030ec,![]];}return db[_0xb36c('0x46')][_0xb36c('0x45')](_0x1443bc)['then'](function(_0x1fc4c3){return[_0x1fc4c3,!![]];});});}else{throw new Error(_0xb36c('0x47'));}})[_0xb36c('0x48')](function(_0x2ade47,_0xdf061e){var _0x44bc45=_0x2ade47['get']({'plain':!![]});if(_0xdf061e){if(_0x3f9d9a['account'][_0xb36c('0x49')]){_0x3f9d9a[_0xb36c('0x41')][_0xb36c('0x4a')]({'id':0x0,'priority':_0x3f9d9a[_0xb36c('0x41')][_0xb36c('0x4b')]+0x1,'app':_0xb36c('0x4c'),'appdata':_0xb36c('0x4d'),'interval':_0xb36c('0x4e')});}_0x44bc45[_0xb36c('0x4f')]=!![];}else{_0x44bc45[_0xb36c('0x4f')]=![];}_0x3f9d9a[_0xb36c('0x50')]=_0x44bc45;return db['FaxMessage'][_0xb36c('0x45')]({'body':_0x552075[_0xb36c('0x25')]['body'],'FaxAccountId':_0x552075['account']['id'],'FaxInteractionId':_0x2ade47['id'],'direction':'in','ContactId':_0x2ade47[_0xb36c('0x51')],'AttachmentId':_0x552075[_0xb36c('0x25')][_0xb36c('0x52')]});})[_0xb36c('0x21')](function(_0x50f277){_0x3f9d9a[_0xb36c('0x16')]=_0x50f277;if(!_0x3f9d9a[_0xb36c('0x50')][_0xb36c('0x53')])return;return db['User'][_0xb36c('0x3a')]({'attributes':['id',_0xb36c('0x54')],'where':{'id':_0x3f9d9a['interaction'][_0xb36c('0x53')]}});})[_0xb36c('0x21')](function(_0x531ba7){if(_0x531ba7){_0x3f9d9a[_0xb36c('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x531ba7[_0xb36c('0x54')]+','+(_0x3f9d9a[_0xb36c('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xb36c('0x4e')});}if(!_0x3f9d9a['interaction'][_0xb36c('0x55')])return;return db[_0xb36c('0x56')][_0xb36c('0x3a')]({'attributes':['id',_0xb36c('0x54')],'where':{'id':_0x3f9d9a['interaction']['queueId']}});})[_0xb36c('0x21')](function(_0x13abde){if(_0x13abde){_0x3f9d9a['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xb36c('0x57'),'appdata':_0x13abde[_0xb36c('0x54')]+','+(_0x3f9d9a[_0xb36c('0x3b')][_0xb36c('0x58')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb36c('0x59'),_0xb36c('0x5a'),_0x3f9d9a);})['then'](function(_0x156e88){_0x2bd718(_0x156e88);})['catch'](function(_0x2fa82c){_0x1e2550(_0x57081b[_0xb36c('0x15')](0x1f4,_0x2fa82c['message']));});});}; \ No newline at end of file +var _0xabab=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','FaxAccount','findAll','options','where','limit','include','map','attributes','model','GetFaxAccount','fax','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','Contacts','FaxApplication','Applications','List','applications','list','orderBy','priority','asc','length','CmContact','create','contact','FaxInteraction','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created'];(function(_0x1398b1,_0x5e0318){var _0x3ee504=function(_0x163c9e){while(--_0x163c9e){_0x1398b1['push'](_0x1398b1['shift']());}};_0x3ee504(++_0x5e0318);}(_0xabab,0x124));var _0xbaba=function(_0x52bf5a,_0x47bb35){_0x52bf5a=_0x52bf5a-0x0;var _0xd5b6e8=_0xabab[_0x52bf5a];return _0xd5b6e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbaba('0x0'));var fs=require('fs');var Redis=require(_0xbaba('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xbaba('0x2'));var logger=require(_0xbaba('0x3'))(_0xbaba('0x4'));var config=require(_0xbaba('0x5'));var jayson=require(_0xbaba('0x6'));var client=jayson[_0xbaba('0x7')][_0xbaba('0x8')]({'port':0x232c});config[_0xbaba('0x9')]=_[_0xbaba('0xa')](config[_0xbaba('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbaba('0xb'))(new Redis(config[_0xbaba('0x9')]));require(_0xbaba('0xc'))[_0xbaba('0xd')](socket);function respondWithRpcPromise(_0xe4acf9,_0x3263c7,_0x194db5){return new BPromise(function(_0x548206,_0x2cd778){return client[_0xbaba('0xe')](_0xe4acf9,_0x194db5)[_0xbaba('0xf')](function(_0x3354d1){logger[_0xbaba('0x10')](_0xbaba('0x11'),_0x3263c7,'request\x20sent');logger[_0xbaba('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3263c7,_0xbaba('0x13'),JSON[_0xbaba('0x14')](_0x3354d1));if(_0x3354d1[_0xbaba('0x15')]){if(_0x3354d1[_0xbaba('0x15')][_0xbaba('0x16')]===0x1f4){logger[_0xbaba('0x15')](_0xbaba('0x11'),_0x3263c7,_0x3354d1[_0xbaba('0x15')][_0xbaba('0x17')]);return _0x2cd778(_0x3354d1[_0xbaba('0x15')][_0xbaba('0x17')]);}logger[_0xbaba('0x15')](_0xbaba('0x11'),_0x3263c7,_0x3354d1[_0xbaba('0x15')][_0xbaba('0x17')]);return _0x548206(_0x3354d1['error'][_0xbaba('0x17')]);}else{logger[_0xbaba('0x10')](_0xbaba('0x11'),_0x3263c7,_0xbaba('0x13'));_0x548206(_0x3354d1['result'][_0xbaba('0x17')]);}})[_0xbaba('0x18')](function(_0x3e7ccb){logger[_0xbaba('0x15')]('FaxAccount,\x20%s,\x20%s',_0x3263c7,_0x3e7ccb);_0x2cd778(_0x3e7ccb);});});}exports['GetFaxAccount']=function(_0x398149){var _0x214c5b=this;return new Promise(function(_0x26e50e,_0x28ac2e){return db[_0xbaba('0x19')][_0xbaba('0x1a')]({'raw':_0x398149[_0xbaba('0x1b')]?_0x398149['options']['raw']===undefined?!![]:![]:!![],'where':_0x398149[_0xbaba('0x1b')]?_0x398149[_0xbaba('0x1b')][_0xbaba('0x1c')]||null:null,'attributes':_0x398149['options']?_0x398149['options']['attributes']||null:null,'limit':_0x398149[_0xbaba('0x1b')]?_0x398149[_0xbaba('0x1b')][_0xbaba('0x1d')]||null:null,'include':_0x398149[_0xbaba('0x1b')]?_0x398149[_0xbaba('0x1b')][_0xbaba('0x1e')]?_[_0xbaba('0x1f')](_0x398149[_0xbaba('0x1b')][_0xbaba('0x1e')],function(_0xf1e157){return{'model':db[_0xf1e157['model']],'as':_0xf1e157['as'],'attributes':_0xf1e157[_0xbaba('0x20')],'include':_0xf1e157['include']?_[_0xbaba('0x1f')](_0xf1e157[_0xbaba('0x1e')],function(_0xcf40bd){return{'model':db[_0xcf40bd[_0xbaba('0x21')]],'as':_0xcf40bd['as'],'attributes':_0xcf40bd[_0xbaba('0x20')],'include':_0xcf40bd[_0xbaba('0x1e')]?_[_0xbaba('0x1f')](_0xcf40bd[_0xbaba('0x1e')],function(_0x45885e){return{'model':db[_0x45885e['model']],'as':_0x45885e['as'],'attributes':_0x45885e[_0xbaba('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbaba('0xf')](function(_0x525fc6){logger[_0xbaba('0x10')](_0xbaba('0x22'),_0x398149);logger['debug'](_0xbaba('0x22'),_0x398149,JSON[_0xbaba('0x14')](_0x525fc6));_0x26e50e(_0x525fc6);})[_0xbaba('0x18')](function(_0x432555){logger[_0xbaba('0x15')](_0xbaba('0x22'),_0x432555[_0xbaba('0x17')],_0x398149);_0x28ac2e(_0x214c5b['error'](0x1f4,_0x432555[_0xbaba('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x3ee15,_0x35ece2,_0x5a9764){var _0x2b3bf7=this;return new Promise(function(_0x552c84,_0x580c59){var _0x459002={'body':_0x3ee15['body'],'channel':_0xbaba('0x23')};var _0x1d39f2=[];var _0x1f3846=[];var _0x420523={};return db['CmContact'][_0xbaba('0x24')]()[_0xbaba('0xf')](function(_0x14c5e4){if(!_0x14c5e4){throw new db['Sequelize']['ValidationError'](_0xbaba('0x25'));}_0x1d39f2=_[_0xbaba('0x26')](_[_0xbaba('0x27')](_0x14c5e4),[_0xbaba('0x28'),_0xbaba('0x29')]);_0x1f3846=_['difference'](_['keys'](_0x14c5e4),[_0xbaba('0x28'),'updatedAt','CompanyId',_0xbaba('0x2a')]);if(_0x3ee15[_0xbaba('0x2b')]['id']){delete _0x3ee15[_0xbaba('0x2b')]['id'];}if(_[_0xbaba('0x2c')](_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x2d')])){throw new db[(_0xbaba('0x2e'))][(_0xbaba('0x2f'))](_0xbaba('0x30'));}if(_[_0xbaba('0x2c')](_0x3ee15['body'][_0xbaba('0x2b')])||_0x3ee15[_0xbaba('0x2b')]['body']===''){throw new db[(_0xbaba('0x2e'))][(_0xbaba('0x2f'))](_0xbaba('0x31'));}if(_['isNil'](_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f3846);}if(!_['includes'](_0x1f3846,_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')])){throw new db[(_0xbaba('0x2e'))]['ValidationError'](_0xbaba('0x33')+_0x1f3846);}_0x420523[_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')]]=_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x2d')];})[_0xbaba('0xf')](function(){return db[_0xbaba('0x19')][_0xbaba('0x34')]({'where':{'id':_0x3ee15[_0xbaba('0x35')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xbaba('0x36'),'where':_0x420523,'limit':0x1,'order':[[_0xbaba('0x29'),'DESC']]}]},{'model':db[_0xbaba('0x37')],'as':_0xbaba('0x38')}]});})[_0xbaba('0xf')](function(_0x2ccfa8){if(_0x2ccfa8&&_0x2ccfa8[_0xbaba('0x39')]){var _0x31abb6=_0x2ccfa8['get']({'plain':!![]});_0x459002['account']=_0x31abb6;_0x459002[_0xbaba('0x3a')]=_0x31abb6['Applications'];_0x459002[_0xbaba('0x3b')]=_0x31abb6[_0xbaba('0x39')];_0x459002[_0xbaba('0x3a')]=_[_0xbaba('0x3c')](_0x459002[_0xbaba('0x3a')],[_0xbaba('0x3d')],[_0xbaba('0x3e')]);if(_0x459002['account'][_0xbaba('0x38')]){delete _0x459002[_0xbaba('0x35')][_0xbaba('0x38')];}if(_0x459002[_0xbaba('0x35')]['List']&&_0x459002['account']['List'][_0xbaba('0x36')][_0xbaba('0x3f')]){return _0x459002[_0xbaba('0x35')][_0xbaba('0x39')]['Contacts'][0x0];}var _0x579b3a=_[_0xbaba('0xa')](_0x3ee15[_0xbaba('0x2b')],{'firstName':_0x3ee15[_0xbaba('0x2b')]['from'],'ListId':_0x31abb6['ListId']});_0x579b3a[_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')]]=_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x2d')];return db[_0xbaba('0x40')][_0xbaba('0x41')](_0x579b3a,{'fields':_0x1d39f2,'raw':!![]});}})[_0xbaba('0xf')](function(_0x27df22){_0x459002[_0xbaba('0x42')]=_0x27df22;if(_0x27df22){var _0x14c351={'ContactId':_0x27df22['id'],'FaxAccountId':_0x3ee15['account']['id'],'fax':_0x27df22[_0xbaba('0x23')]};return db[_0xbaba('0x43')][_0xbaba('0x34')]({'where':{'ContactId':_0x27df22['id'],'closed':![],'FaxAccountId':_0x3ee15[_0xbaba('0x35')]['id']}})[_0xbaba('0xf')](function(_0x1beab5){if(_0x1beab5){return[_0x1beab5,![]];}return db[_0xbaba('0x43')][_0xbaba('0x41')](_0x14c351)[_0xbaba('0xf')](function(_0x45a921){return[_0x45a921,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbaba('0x44')](function(_0x4d6e0b,_0x30363a){var _0x7860d5=_0x4d6e0b[_0xbaba('0x45')]({'plain':!![]});if(_0x30363a){if(_0x459002['account'][_0xbaba('0x46')]){_0x459002[_0xbaba('0x3a')][_0xbaba('0x47')]({'id':0x0,'priority':_0x459002[_0xbaba('0x3a')][_0xbaba('0x3f')]+0x1,'app':_0xbaba('0x48'),'appdata':_0xbaba('0x49'),'interval':_0xbaba('0x4a')});}_0x7860d5[_0xbaba('0x4b')]=!![];}else{_0x7860d5[_0xbaba('0x4b')]=![];}_0x459002[_0xbaba('0x4c')]=_0x7860d5;return db[_0xbaba('0x4d')][_0xbaba('0x41')]({'body':_0x3ee15['body'][_0xbaba('0x2b')],'FaxAccountId':_0x3ee15[_0xbaba('0x35')]['id'],'FaxInteractionId':_0x4d6e0b['id'],'direction':'in','ContactId':_0x4d6e0b[_0xbaba('0x4e')],'AttachmentId':_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x4f')]});})['then'](function(_0x2c7aa8){_0x459002[_0xbaba('0x17')]=_0x2c7aa8;if(!_0x459002[_0xbaba('0x4c')][_0xbaba('0x50')])return;return db[_0xbaba('0x51')][_0xbaba('0x34')]({'attributes':['id',_0xbaba('0x52')],'where':{'id':_0x459002[_0xbaba('0x4c')][_0xbaba('0x50')]}});})[_0xbaba('0xf')](function(_0x4e0702){if(_0x4e0702){_0x459002[_0xbaba('0x3a')][_0xbaba('0x53')]({'id':0x0,'priority':0x0,'app':_0xbaba('0x54'),'appdata':_0x4e0702['name']+','+(_0x459002['account'][_0xbaba('0x55')]||0xa),'interval':'*,*,*,*'});}if(!_0x459002[_0xbaba('0x4c')][_0xbaba('0x56')])return;return db[_0xbaba('0x57')]['find']({'attributes':['id',_0xbaba('0x52')],'where':{'id':_0x459002[_0xbaba('0x4c')]['queueId']}});})[_0xbaba('0xf')](function(_0x4900d0){if(_0x4900d0){_0x459002['applications'][_0xbaba('0x53')]({'id':0x0,'priority':0x1,'app':_0xbaba('0x58'),'appdata':_0x4900d0[_0xbaba('0x52')]+','+(_0x459002['account'][_0xbaba('0x59')]||0x12c),'interval':_0xbaba('0x4a')});}return respondWithRpcPromise(_0xbaba('0x5a'),_0xbaba('0x5b'),_0x459002);})['then'](function(_0x2bc5b3){_0x552c84(_0x2bc5b3);})[_0xbaba('0x18')](function(_0x38992e){_0x580c59(_0x2b3bf7[_0xbaba('0x15')](0x1f4,_0x38992e[_0xbaba('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e3a4c64..f165666 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 _0xbe17=['update','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbe17,0x95));var _0x7be1=function(_0x48436d,_0x1a1947){_0x48436d=_0x48436d-0x0;var _0x1211df=_0xbe17[_0x48436d];return _0x1211df;};'use strict';var FaxAccountEvents=require(_0x7be1('0x0'));var events=[_0x7be1('0x1'),_0x7be1('0x2'),_0x7be1('0x3')];function createListener(_0x557031,_0x57a15b){return function(_0x416556){_0x57a15b['emit'](_0x557031,_0x416556);};}function removeListener(_0x27bc41,_0xa7d613){return function(){FaxAccountEvents[_0x7be1('0x4')](_0x27bc41,_0xa7d613);};}exports[_0x7be1('0x5')]=function(_0x523af7){for(var _0x5f1d92=0x0,_0x524519=events[_0x7be1('0x6')];_0x5f1d92<_0x524519;_0x5f1d92++){var _0x127e7c=events[_0x5f1d92];var _0x2ca3df=createListener(_0x7be1('0x7')+_0x127e7c,_0x523af7);FaxAccountEvents['on'](_0x127e7c,_0x2ca3df);}}; \ No newline at end of file +var _0x0231=['./faxAccount.events','save','remove','update','removeListener','register','length','faxAccount:'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x0231,0x130));var _0x1023=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x0231[_0x49ca18];return _0x145d54;};'use strict';var FaxAccountEvents=require(_0x1023('0x0'));var events=[_0x1023('0x1'),_0x1023('0x2'),_0x1023('0x3')];function createListener(_0x2ec591,_0x3db879){return function(_0x184a3d){_0x3db879['emit'](_0x2ec591,_0x184a3d);};}function removeListener(_0x3ec16f,_0x46c749){return function(){FaxAccountEvents[_0x1023('0x4')](_0x3ec16f,_0x46c749);};}exports[_0x1023('0x5')]=function(_0x491f7f){for(var _0x1bd3bc=0x0,_0x8e6689=events[_0x1023('0x6')];_0x1bd3bc<_0x8e6689;_0x1bd3bc++){var _0x47eae7=events[_0x1bd3bc];var _0x4f1f77=createListener(_0x1023('0x7')+_0x47eae7,_0x491f7f);FaxAccountEvents['on'](_0x47eae7,_0x4f1f77);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c02ca84..d6ed70f 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 _0x81ef=['getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','send','addAgents','put','update','destroy','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0x81ef,0xf7));var _0xf81e=function(_0x5bfe8a,_0x4d1edf){_0x5bfe8a=_0x5bfe8a-0x0;var _0x3bdc52=_0x81ef[_0x5bfe8a];return _0x3bdc52;};'use strict';var multer=require(_0xf81e('0x0'));var util=require(_0xf81e('0x1'));var path=require(_0xf81e('0x2'));var timeout=require(_0xf81e('0x3'));var express=require(_0xf81e('0x4'));var router=express[_0xf81e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf81e('0x6'));var interaction=require(_0xf81e('0x7'));var config=require(_0xf81e('0x8'));var controller=require(_0xf81e('0x9'));router[_0xf81e('0xa')]('/',auth[_0xf81e('0xb')](),controller[_0xf81e('0xc')]);router[_0xf81e('0xa')](_0xf81e('0xd'),auth[_0xf81e('0xb')](),controller[_0xf81e('0xe')]);router[_0xf81e('0xa')](_0xf81e('0xf'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x10')]);router['get']('/:id/dispositions',auth[_0xf81e('0xb')](),controller['getDispositions']);router[_0xf81e('0xa')](_0xf81e('0x11'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x12')]);router['get'](_0xf81e('0x13'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x14')]);router[_0xf81e('0xa')](_0xf81e('0x15'),auth[_0xf81e('0xb')](),controller['getApplications']);router[_0xf81e('0xa')](_0xf81e('0x16'),auth['isAuthenticated'](),controller[_0xf81e('0x17')]);router['get'](_0xf81e('0x18'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x19')]);router[_0xf81e('0x1a')]('/',auth[_0xf81e('0xb')](),controller[_0xf81e('0x1b')]);router[_0xf81e('0x1a')]('/:id/dispositions',auth[_0xf81e('0xb')](),controller[_0xf81e('0x1c')]);router[_0xf81e('0x1a')](_0xf81e('0x11'),auth['isAuthenticated'](),controller[_0xf81e('0x1d')]);router[_0xf81e('0x1a')](_0xf81e('0x13'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x1e')]);router['post'](_0xf81e('0x15'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x1f')]);router['post']('/addaccountapplications',auth[_0xf81e('0xb')](),controller[_0xf81e('0x20')]);router[_0xf81e('0x1a')](_0xf81e('0x21'),auth[_0xf81e('0xb')](),controller['updateAccountApplications']);router[_0xf81e('0x1a')]('/:id/send',auth[_0xf81e('0xb')](),controller[_0xf81e('0x22')]);router[_0xf81e('0x1a')]('/:id/users',auth[_0xf81e('0xb')](),controller[_0xf81e('0x23')]);router[_0xf81e('0x24')]('/:id',auth[_0xf81e('0xb')](),controller[_0xf81e('0x25')]);router['delete'](_0xf81e('0xf'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x26')]);router[_0xf81e('0x27')](_0xf81e('0x28'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x29')]);router[_0xf81e('0x27')](_0xf81e('0x11'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x2a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xf81e('0x2b')]);module[_0xf81e('0x2c')]=router; \ No newline at end of file +var _0x1257=['getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x1b9db4,_0x3294c5){var _0x263b4f=function(_0x33d958){while(--_0x33d958){_0x1b9db4['push'](_0x1b9db4['shift']());}};_0x263b4f(++_0x3294c5);}(_0x1257,0xb9));var _0x7125=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x1257[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x7125('0x0'));var util=require(_0x7125('0x1'));var path=require(_0x7125('0x2'));var timeout=require(_0x7125('0x3'));var express=require('express');var router=express[_0x7125('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7125('0x5'));var config=require('../../config/environment');var controller=require(_0x7125('0x6'));router[_0x7125('0x7')]('/',auth[_0x7125('0x8')](),controller[_0x7125('0x9')]);router[_0x7125('0x7')](_0x7125('0xa'),auth['isAuthenticated'](),controller[_0x7125('0xb')]);router[_0x7125('0x7')](_0x7125('0xc'),auth['isAuthenticated'](),controller[_0x7125('0xd')]);router[_0x7125('0x7')](_0x7125('0xe'),auth[_0x7125('0x8')](),controller[_0x7125('0xf')]);router[_0x7125('0x7')](_0x7125('0x10'),auth[_0x7125('0x8')](),controller[_0x7125('0x11')]);router[_0x7125('0x7')]('/:id/interactions',auth[_0x7125('0x8')](),controller[_0x7125('0x12')]);router[_0x7125('0x7')](_0x7125('0x13'),auth[_0x7125('0x8')](),controller[_0x7125('0x14')]);router[_0x7125('0x7')](_0x7125('0x15'),auth[_0x7125('0x8')](),controller['getMessages']);router['get'](_0x7125('0x16'),auth['isAuthenticated'](),controller[_0x7125('0x17')]);router[_0x7125('0x18')]('/',auth[_0x7125('0x8')](),controller[_0x7125('0x19')]);router[_0x7125('0x18')](_0x7125('0xe'),auth[_0x7125('0x8')](),controller[_0x7125('0x1a')]);router[_0x7125('0x18')](_0x7125('0x10'),auth['isAuthenticated'](),controller[_0x7125('0x1b')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x7125('0x1c')]);router[_0x7125('0x18')]('/:id/applications',auth[_0x7125('0x8')](),controller[_0x7125('0x1d')]);router[_0x7125('0x18')]('/addaccountapplications',auth[_0x7125('0x8')](),controller[_0x7125('0x1e')]);router[_0x7125('0x18')](_0x7125('0x1f'),auth[_0x7125('0x8')](),controller['updateAccountApplications']);router[_0x7125('0x18')](_0x7125('0x20'),auth['isAuthenticated'](),controller['send']);router['post'](_0x7125('0x16'),auth[_0x7125('0x8')](),controller[_0x7125('0x21')]);router[_0x7125('0x22')](_0x7125('0xc'),auth[_0x7125('0x8')](),controller[_0x7125('0x23')]);router['delete']('/:id',auth[_0x7125('0x8')](),controller['destroy']);router[_0x7125('0x24')](_0x7125('0xe'),auth[_0x7125('0x8')](),controller[_0x7125('0x25')]);router['delete'](_0x7125('0x10'),auth[_0x7125('0x8')](),controller[_0x7125('0x26')]);router[_0x7125('0x24')]('/:id/users',auth[_0x7125('0x8')](),controller[_0x7125('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 66ae2b3..27cf510 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 _0x2e16=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3e2d11,_0x1d6b3e){var _0x39ef8b=function(_0xdb8faa){while(--_0xdb8faa){_0x3e2d11['push'](_0x3e2d11['shift']());}};_0x39ef8b(++_0x1d6b3e);}(_0x2e16,0xbc));var _0x62e1=function(_0x1f8c61,_0x530298){_0x1f8c61=_0x1f8c61-0x0;var _0x3a3c1c=_0x2e16[_0x1f8c61];return _0x3a3c1c;};'use strict';var Sequelize=require(_0x62e1('0x0'));module[_0x62e1('0x1')]={'priority':{'type':Sequelize[_0x62e1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x62e1('0x3')],'allowNull':![],'defaultValue':_0x62e1('0x4')},'appdata':{'type':Sequelize[_0x62e1('0x5')]()},'description':{'type':Sequelize[_0x62e1('0x3')]},'interval':{'type':Sequelize[_0x62e1('0x3')],'defaultValue':_0x62e1('0x6')}}; \ No newline at end of file +var _0xf649=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf649,0x19a));var _0x9f64=function(_0xdc331e,_0x4d9605){_0xdc331e=_0xdc331e-0x0;var _0x2df59e=_0xf649[_0xdc331e];return _0x2df59e;};'use strict';var Sequelize=require('sequelize');module[_0x9f64('0x0')]={'priority':{'type':Sequelize[_0x9f64('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f64('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9f64('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8d9e52c..9c96b03 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 _0xf79f=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','index','map','FaxApplication','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','eml-format','request-promise'];(function(_0x29dd53,_0x156e79){var _0x49906d=function(_0x5396c4){while(--_0x5396c4){_0x29dd53['push'](_0x29dd53['shift']());}};_0x49906d(++_0x156e79);}(_0xf79f,0x157));var _0xff79=function(_0x37c219,_0x16d29c){_0x37c219=_0x37c219-0x0;var _0x52b594=_0xf79f[_0x37c219];return _0x52b594;};'use strict';var emlformat=require(_0xff79('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xff79('0x1'));var moment=require(_0xff79('0x2'));var BPromise=require(_0xff79('0x3'));var Mustache=require(_0xff79('0x4'));var util=require(_0xff79('0x5'));var path=require(_0xff79('0x6'));var sox=require(_0xff79('0x7'));var csv=require(_0xff79('0x8'));var ejs=require(_0xff79('0x9'));var fs=require('fs');var fs_extra=require(_0xff79('0xa'));var _=require('lodash');var squel=require(_0xff79('0xb'));var crypto=require(_0xff79('0xc'));var jsforce=require(_0xff79('0xd'));var deskjs=require(_0xff79('0xe'));var toCsv=require(_0xff79('0x8'));var querystring=require(_0xff79('0xf'));var Papa=require(_0xff79('0x10'));var Redis=require(_0xff79('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff79('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff79('0x13'))('api');var utils=require(_0xff79('0x14'));var config=require(_0xff79('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xff79('0x16'))['db'];function respondWithStatusCode(_0x12729b,_0x4441bb){_0x4441bb=_0x4441bb||0xcc;return function(_0x4efb7f){if(_0x4efb7f){return _0x12729b[_0xff79('0x17')](_0x4441bb);}return _0x12729b[_0xff79('0x18')](_0x4441bb)[_0xff79('0x19')]();};}function respondWithResult(_0x2755f1,_0x4fb3f5){_0x4fb3f5=_0x4fb3f5||0xc8;return function(_0x17d598){if(_0x17d598){return _0x2755f1[_0xff79('0x18')](_0x4fb3f5)[_0xff79('0x1a')](_0x17d598);}};}function respondWithFilteredResult(_0x320621,_0x4e1b41){return function(_0x2ab543){if(_0x2ab543){var _0x1e1ce1=typeof _0x4e1b41[_0xff79('0x1b')]===_0xff79('0x1c')&&typeof _0x4e1b41[_0xff79('0x1d')]===_0xff79('0x1c');var _0x545ddc=_0x2ab543[_0xff79('0x1e')];var _0x3d1a99=_0x1e1ce1?0x0:_0x4e1b41['offset'];var _0x452578=_0x1e1ce1?_0x2ab543[_0xff79('0x1e')]:_0x4e1b41[_0xff79('0x1b')]+_0x4e1b41[_0xff79('0x1d')];var _0xbcb450;if(_0x452578>=_0x545ddc){_0x452578=_0x545ddc;_0xbcb450=0xc8;}else{_0xbcb450=0xce;}_0x320621['status'](_0xbcb450);return _0x320621[_0xff79('0x1f')](_0xff79('0x20'),_0x3d1a99+'-'+_0x452578+'/'+_0x545ddc)[_0xff79('0x1a')](_0x2ab543);}return null;};}function patchUpdates(_0x2ec94c){return function(_0xe6cb8b){try{jsonpatch['apply'](_0xe6cb8b,_0x2ec94c,!![]);}catch(_0x45b75e){return BPromise[_0xff79('0x21')](_0x45b75e);}return _0xe6cb8b[_0xff79('0x22')]();};}function saveUpdates(_0x3d831f,_0xa73f12){return function(_0x328244){if(_0x328244){return _0x328244[_0xff79('0x23')](_0x3d831f)[_0xff79('0x24')](function(_0x10b534){return _0x10b534;});}return null;};}function removeEntity(_0xe58dc,_0x33680a){return function(_0x11379c){if(_0x11379c){return _0x11379c['destroy']()[_0xff79('0x24')](function(){_0xe58dc['status'](0xcc)[_0xff79('0x19')]();});}};}function handleEntityNotFound(_0x39d3ec,_0x4d17a5){return function(_0x80842){if(!_0x80842){_0x39d3ec[_0xff79('0x17')](0x194);}return _0x80842;};}function handleError(_0x23e9a3,_0x13a1de){_0x13a1de=_0x13a1de||0x1f4;return function(_0x241252){logger[_0xff79('0x25')](_0x241252['stack']);if(_0x241252[_0xff79('0x26')]){delete _0x241252[_0xff79('0x26')];}_0x23e9a3[_0xff79('0x18')](_0x13a1de)['send'](_0x241252);};}exports[_0xff79('0x27')]=function(_0x5cd395,_0x3efd8d){var _0x519444={},_0x416a85={},_0xe84954={'count':0x0,'rows':[]};var _0x580706=_[_0xff79('0x28')](db[_0xff79('0x29')]['rawAttributes'],function(_0x5c5270){return{'name':_0x5c5270['fieldName'],'type':_0x5c5270[_0xff79('0x2a')]['key']};});_0x416a85[_0xff79('0x2b')]=_['map'](_0x580706,_0xff79('0x26'));_0x416a85[_0xff79('0x2c')]=_[_0xff79('0x2d')](_0x5cd395['query']);_0x416a85[_0xff79('0x2e')]=_['intersection'](_0x416a85[_0xff79('0x2b')],_0x416a85[_0xff79('0x2c')]);_0x519444[_0xff79('0x2f')]=_[_0xff79('0x30')](_0x416a85['model'],qs[_0xff79('0x31')](_0x5cd395[_0xff79('0x2c')]['fields']));_0x519444[_0xff79('0x2f')]=_0x519444['attributes']['length']?_0x519444[_0xff79('0x2f')]:_0x416a85['model'];if(!_0x5cd395[_0xff79('0x2c')][_0xff79('0x32')](_0xff79('0x33'))){_0x519444['limit']=qs['limit'](_0x5cd395[_0xff79('0x2c')][_0xff79('0x1d')]);_0x519444[_0xff79('0x1b')]=qs['offset'](_0x5cd395[_0xff79('0x2c')][_0xff79('0x1b')]);}_0x519444[_0xff79('0x34')]=qs[_0xff79('0x35')](_0x5cd395[_0xff79('0x2c')][_0xff79('0x35')]);_0x519444['where']=qs[_0xff79('0x2e')](_['pick'](_0x5cd395[_0xff79('0x2c')],_0x416a85[_0xff79('0x2e')]),_0x580706);if(_0x5cd395[_0xff79('0x2c')][_0xff79('0x36')]){_0x519444[_0xff79('0x37')]=_[_0xff79('0x38')](_0x519444[_0xff79('0x37')],{'$or':_[_0xff79('0x28')](_0x580706,function(_0x298fa1){if(_0x298fa1[_0xff79('0x2a')]!==_0xff79('0x39')){var _0x36e584={};_0x36e584[_0x298fa1['name']]={'$like':'%'+_0x5cd395[_0xff79('0x2c')][_0xff79('0x36')]+'%'};return _0x36e584;}})});}_0x519444=_[_0xff79('0x38')]({},_0x519444,_0x5cd395[_0xff79('0x3a')]);var _0x24d374={'where':_0x519444[_0xff79('0x37')]};return db['FaxApplication'][_0xff79('0x1e')](_0x24d374)[_0xff79('0x24')](function(_0x1bf7bb){_0xe84954[_0xff79('0x1e')]=_0x1bf7bb;if(_0x5cd395[_0xff79('0x2c')][_0xff79('0x3b')]){_0x519444[_0xff79('0x3c')]=[{'all':!![]}];}return db[_0xff79('0x29')]['findAll'](_0x519444);})[_0xff79('0x24')](function(_0x412320){_0xe84954[_0xff79('0x3d')]=_0x412320;return _0xe84954;})['then'](respondWithFilteredResult(_0x3efd8d,_0x519444))[_0xff79('0x3e')](handleError(_0x3efd8d,null));};exports[_0xff79('0x3f')]=function(_0x52e715,_0x2d285c){var _0x556646={'raw':!![],'where':{'id':_0x52e715[_0xff79('0x40')]['id']}},_0x48ee1d={};_0x48ee1d[_0xff79('0x2b')]=_[_0xff79('0x2d')](db['FaxApplication'][_0xff79('0x41')]);_0x48ee1d[_0xff79('0x2c')]=_['keys'](_0x52e715[_0xff79('0x2c')]);_0x48ee1d[_0xff79('0x2e')]=_[_0xff79('0x30')](_0x48ee1d[_0xff79('0x2b')],_0x48ee1d[_0xff79('0x2c')]);_0x556646[_0xff79('0x2f')]=_['intersection'](_0x48ee1d[_0xff79('0x2b')],qs['fields'](_0x52e715[_0xff79('0x2c')][_0xff79('0x31')]));_0x556646[_0xff79('0x2f')]=_0x556646['attributes']['length']?_0x556646[_0xff79('0x2f')]:_0x48ee1d[_0xff79('0x2b')];if(_0x52e715['query'][_0xff79('0x3b')]){_0x556646[_0xff79('0x3c')]=[{'all':!![]}];}_0x556646=_[_0xff79('0x38')]({},_0x556646,_0x52e715[_0xff79('0x3a')]);return db['FaxApplication']['find'](_0x556646)[_0xff79('0x24')](handleEntityNotFound(_0x2d285c,null))[_0xff79('0x24')](respondWithResult(_0x2d285c,null))[_0xff79('0x3e')](handleError(_0x2d285c,null));};exports[_0xff79('0x42')]=function(_0x53e15f,_0x225b0b){return db['FaxApplication'][_0xff79('0x42')](_0x53e15f[_0xff79('0x43')],{})[_0xff79('0x24')](respondWithResult(_0x225b0b,0xc9))['catch'](handleError(_0x225b0b,null));};exports[_0xff79('0x23')]=function(_0x59195d,_0x336e1a){if(_0x59195d[_0xff79('0x43')]['id']){delete _0x59195d[_0xff79('0x43')]['id'];}return db[_0xff79('0x29')]['find']({'where':{'id':_0x59195d['params']['id']}})[_0xff79('0x24')](handleEntityNotFound(_0x336e1a,null))['then'](saveUpdates(_0x59195d[_0xff79('0x43')],null))[_0xff79('0x24')](respondWithResult(_0x336e1a,null))[_0xff79('0x3e')](handleError(_0x336e1a,null));};exports['destroy']=function(_0x5a7b1a,_0x5e42ab){return db[_0xff79('0x29')][_0xff79('0x44')]({'where':{'id':_0x5a7b1a[_0xff79('0x40')]['id']}})[_0xff79('0x24')](handleEntityNotFound(_0x5e42ab,null))[_0xff79('0x24')](removeEntity(_0x5e42ab,null))[_0xff79('0x3e')](handleError(_0x5e42ab,null));}; \ No newline at end of file +var _0xb575=['stack','name','send','index','FaxApplication','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error'];(function(_0x1015fb,_0x2bd4d6){var _0x49abc3=function(_0x45b6f0){while(--_0x45b6f0){_0x1015fb['push'](_0x1015fb['shift']());}};_0x49abc3(++_0x2bd4d6);}(_0xb575,0x139));var _0x5b57=function(_0x1cb4c4,_0x234cb0){_0x1cb4c4=_0x1cb4c4-0x0;var _0x26b813=_0xb575[_0x1cb4c4];return _0x26b813;};'use strict';var emlformat=require(_0x5b57('0x0'));var rimraf=require(_0x5b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b57('0x2'));var rp=require(_0x5b57('0x3'));var moment=require(_0x5b57('0x4'));var BPromise=require(_0x5b57('0x5'));var Mustache=require('mustache');var util=require(_0x5b57('0x6'));var path=require(_0x5b57('0x7'));var sox=require(_0x5b57('0x8'));var csv=require(_0x5b57('0x9'));var ejs=require(_0x5b57('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b57('0xb'));var squel=require('squel');var crypto=require(_0x5b57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5b57('0xd'));var toCsv=require(_0x5b57('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b57('0xe'));var authService=require(_0x5b57('0xf'));var qs=require(_0x5b57('0x10'));var as=require(_0x5b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b57('0x12'))(_0x5b57('0x13'));var utils=require(_0x5b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5b57('0x15'))['db'];function respondWithStatusCode(_0x46a9b7,_0x5620db){_0x5620db=_0x5620db||0xcc;return function(_0x4f9ce7){if(_0x4f9ce7){return _0x46a9b7['sendStatus'](_0x5620db);}return _0x46a9b7[_0x5b57('0x16')](_0x5620db)[_0x5b57('0x17')]();};}function respondWithResult(_0x365b58,_0x477a12){_0x477a12=_0x477a12||0xc8;return function(_0x2a3a97){if(_0x2a3a97){return _0x365b58[_0x5b57('0x16')](_0x477a12)[_0x5b57('0x18')](_0x2a3a97);}};}function respondWithFilteredResult(_0x2d0685,_0x100bba){return function(_0x3eb0ff){if(_0x3eb0ff){var _0x2be551=typeof _0x100bba[_0x5b57('0x19')]===_0x5b57('0x1a')&&typeof _0x100bba['limit']===_0x5b57('0x1a');var _0x452c74=_0x3eb0ff[_0x5b57('0x1b')];var _0x233457=_0x2be551?0x0:_0x100bba[_0x5b57('0x19')];var _0x545719=_0x2be551?_0x3eb0ff[_0x5b57('0x1b')]:_0x100bba[_0x5b57('0x19')]+_0x100bba[_0x5b57('0x1c')];var _0x5e2597;if(_0x545719>=_0x452c74){_0x545719=_0x452c74;_0x5e2597=0xc8;}else{_0x5e2597=0xce;}_0x2d0685[_0x5b57('0x16')](_0x5e2597);return _0x2d0685['set'](_0x5b57('0x1d'),_0x233457+'-'+_0x545719+'/'+_0x452c74)[_0x5b57('0x18')](_0x3eb0ff);}return null;};}function patchUpdates(_0x4a11c4){return function(_0x3b4db5){try{jsonpatch[_0x5b57('0x1e')](_0x3b4db5,_0x4a11c4,!![]);}catch(_0x4b30ca){return BPromise['reject'](_0x4b30ca);}return _0x3b4db5[_0x5b57('0x1f')]();};}function saveUpdates(_0x3570d5,_0xebc022){return function(_0x2eea28){if(_0x2eea28){return _0x2eea28[_0x5b57('0x20')](_0x3570d5)[_0x5b57('0x21')](function(_0x3947a1){return _0x3947a1;});}return null;};}function removeEntity(_0x371135,_0xa9c138){return function(_0x18cb8d){if(_0x18cb8d){return _0x18cb8d[_0x5b57('0x22')]()['then'](function(){_0x371135[_0x5b57('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30dd58,_0x3a4afb){return function(_0xfc8378){if(!_0xfc8378){_0x30dd58[_0x5b57('0x23')](0x194);}return _0xfc8378;};}function handleError(_0x137743,_0x202225){_0x202225=_0x202225||0x1f4;return function(_0x276556){logger[_0x5b57('0x24')](_0x276556[_0x5b57('0x25')]);if(_0x276556[_0x5b57('0x26')]){delete _0x276556[_0x5b57('0x26')];}_0x137743[_0x5b57('0x16')](_0x202225)[_0x5b57('0x27')](_0x276556);};}exports[_0x5b57('0x28')]=function(_0x3d8ecc,_0x4f147a){var _0x2d8462={},_0x25fc20={},_0xfd4d2c={'count':0x0,'rows':[]};var _0x4d2ab4=_['map'](db[_0x5b57('0x29')]['rawAttributes'],function(_0x3dbda0){return{'name':_0x3dbda0['fieldName'],'type':_0x3dbda0[_0x5b57('0x2a')]['key']};});_0x25fc20[_0x5b57('0x2b')]=_[_0x5b57('0x2c')](_0x4d2ab4,_0x5b57('0x26'));_0x25fc20[_0x5b57('0x2d')]=_[_0x5b57('0x2e')](_0x3d8ecc[_0x5b57('0x2d')]);_0x25fc20[_0x5b57('0x2f')]=_[_0x5b57('0x30')](_0x25fc20['model'],_0x25fc20[_0x5b57('0x2d')]);_0x2d8462[_0x5b57('0x31')]=_[_0x5b57('0x30')](_0x25fc20[_0x5b57('0x2b')],qs['fields'](_0x3d8ecc['query']['fields']));_0x2d8462[_0x5b57('0x31')]=_0x2d8462['attributes']['length']?_0x2d8462[_0x5b57('0x31')]:_0x25fc20[_0x5b57('0x2b')];if(!_0x3d8ecc[_0x5b57('0x2d')][_0x5b57('0x32')](_0x5b57('0x33'))){_0x2d8462[_0x5b57('0x1c')]=qs[_0x5b57('0x1c')](_0x3d8ecc[_0x5b57('0x2d')]['limit']);_0x2d8462[_0x5b57('0x19')]=qs[_0x5b57('0x19')](_0x3d8ecc[_0x5b57('0x2d')]['offset']);}_0x2d8462[_0x5b57('0x34')]=qs[_0x5b57('0x35')](_0x3d8ecc[_0x5b57('0x2d')][_0x5b57('0x35')]);_0x2d8462['where']=qs[_0x5b57('0x2f')](_['pick'](_0x3d8ecc[_0x5b57('0x2d')],_0x25fc20[_0x5b57('0x2f')]),_0x4d2ab4);if(_0x3d8ecc[_0x5b57('0x2d')]['filter']){_0x2d8462[_0x5b57('0x36')]=_['merge'](_0x2d8462[_0x5b57('0x36')],{'$or':_[_0x5b57('0x2c')](_0x4d2ab4,function(_0x290c69){if(_0x290c69[_0x5b57('0x2a')]!==_0x5b57('0x37')){var _0x4fe06a={};_0x4fe06a[_0x290c69[_0x5b57('0x26')]]={'$like':'%'+_0x3d8ecc[_0x5b57('0x2d')][_0x5b57('0x38')]+'%'};return _0x4fe06a;}})});}_0x2d8462=_[_0x5b57('0x39')]({},_0x2d8462,_0x3d8ecc[_0x5b57('0x3a')]);var _0x53327a={'where':_0x2d8462[_0x5b57('0x36')]};return db[_0x5b57('0x29')][_0x5b57('0x1b')](_0x53327a)['then'](function(_0x3db1c5){_0xfd4d2c['count']=_0x3db1c5;if(_0x3d8ecc['query'][_0x5b57('0x3b')]){_0x2d8462[_0x5b57('0x3c')]=[{'all':!![]}];}return db[_0x5b57('0x29')]['findAll'](_0x2d8462);})[_0x5b57('0x21')](function(_0x44cb9e){_0xfd4d2c[_0x5b57('0x3d')]=_0x44cb9e;return _0xfd4d2c;})[_0x5b57('0x21')](respondWithFilteredResult(_0x4f147a,_0x2d8462))[_0x5b57('0x3e')](handleError(_0x4f147a,null));};exports[_0x5b57('0x3f')]=function(_0x4cc2ac,_0x4e9c0b){var _0x3a2437={'raw':!![],'where':{'id':_0x4cc2ac[_0x5b57('0x40')]['id']}},_0x54a692={};_0x54a692[_0x5b57('0x2b')]=_[_0x5b57('0x2e')](db[_0x5b57('0x29')][_0x5b57('0x41')]);_0x54a692['query']=_[_0x5b57('0x2e')](_0x4cc2ac['query']);_0x54a692[_0x5b57('0x2f')]=_['intersection'](_0x54a692[_0x5b57('0x2b')],_0x54a692[_0x5b57('0x2d')]);_0x3a2437['attributes']=_[_0x5b57('0x30')](_0x54a692[_0x5b57('0x2b')],qs[_0x5b57('0x42')](_0x4cc2ac[_0x5b57('0x2d')][_0x5b57('0x42')]));_0x3a2437[_0x5b57('0x31')]=_0x3a2437['attributes']['length']?_0x3a2437[_0x5b57('0x31')]:_0x54a692[_0x5b57('0x2b')];if(_0x4cc2ac[_0x5b57('0x2d')]['includeAll']){_0x3a2437[_0x5b57('0x3c')]=[{'all':!![]}];}_0x3a2437=_['merge']({},_0x3a2437,_0x4cc2ac[_0x5b57('0x3a')]);return db[_0x5b57('0x29')][_0x5b57('0x43')](_0x3a2437)['then'](handleEntityNotFound(_0x4e9c0b,null))[_0x5b57('0x21')](respondWithResult(_0x4e9c0b,null))[_0x5b57('0x3e')](handleError(_0x4e9c0b,null));};exports[_0x5b57('0x44')]=function(_0x49a510,_0x15cbaa){return db['FaxApplication'][_0x5b57('0x44')](_0x49a510[_0x5b57('0x45')],{})['then'](respondWithResult(_0x15cbaa,0xc9))[_0x5b57('0x3e')](handleError(_0x15cbaa,null));};exports[_0x5b57('0x20')]=function(_0x225cca,_0x209820){if(_0x225cca[_0x5b57('0x45')]['id']){delete _0x225cca['body']['id'];}return db[_0x5b57('0x29')][_0x5b57('0x43')]({'where':{'id':_0x225cca[_0x5b57('0x40')]['id']}})[_0x5b57('0x21')](handleEntityNotFound(_0x209820,null))[_0x5b57('0x21')](saveUpdates(_0x225cca[_0x5b57('0x45')],null))['then'](respondWithResult(_0x209820,null))[_0x5b57('0x3e')](handleError(_0x209820,null));};exports[_0x5b57('0x22')]=function(_0x1dd525,_0x21737c){return db[_0x5b57('0x29')][_0x5b57('0x43')]({'where':{'id':_0x1dd525['params']['id']}})[_0x5b57('0x21')](handleEntityNotFound(_0x21737c,null))[_0x5b57('0x21')](removeEntity(_0x21737c,null))['catch'](handleError(_0x21737c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 754b534..ae892f3 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 _0x3a91=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x57cdb5,_0x314f3a){var _0x5a3502=function(_0x80d23f){while(--_0x80d23f){_0x57cdb5['push'](_0x57cdb5['shift']());}};_0x5a3502(++_0x314f3a);}(_0x3a91,0x12c));var _0x13a9=function(_0x36132a,_0x496901){_0x36132a=_0x36132a-0x0;var _0x1d383f=_0x3a91[_0x36132a];return _0x1d383f;};'use strict';var _=require('lodash');var util=require(_0x13a9('0x0'));var logger=require(_0x13a9('0x1'))('api');var moment=require(_0x13a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x13a9('0x3'));var fs=require('fs');var path=require(_0x13a9('0x4'));var rimraf=require(_0x13a9('0x5'));var config=require(_0x13a9('0x6'));var attributes=require('./faxApplication.attributes');module[_0x13a9('0x7')]=function(_0x1fbdca,_0x577e3c){return _0x1fbdca['define'](_0x13a9('0x8'),attributes,{'tableName':_0x13a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13a9('0xa'),'collate':_0x13a9('0xb')});}; \ No newline at end of file +var _0xccd4=['../../config/environment','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x35ae51,_0x4e5118){var _0x3a00e0=function(_0x345ff2){while(--_0x345ff2){_0x35ae51['push'](_0x35ae51['shift']());}};_0x3a00e0(++_0x4e5118);}(_0xccd4,0xdd));var _0x4ccd=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xccd4[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x4ccd('0x0'));var util=require('util');var logger=require(_0x4ccd('0x1'))(_0x4ccd('0x2'));var moment=require(_0x4ccd('0x3'));var BPromise=require(_0x4ccd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ccd('0x5'));var rimraf=require(_0x4ccd('0x6'));var config=require(_0x4ccd('0x7'));var attributes=require('./faxApplication.attributes');module[_0x4ccd('0x8')]=function(_0x987ff0,_0x1079e9){return _0x987ff0['define'](_0x4ccd('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ccd('0xa'),'collate':_0x4ccd('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0f70d5c..a77dd76 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 _0x83ea=['ioredis','../../config/utils','rpc','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FaxApplication','update','body','options','raw','where','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x83ea,0x158));var _0xa83e=function(_0x48f294,_0x49609d){_0x48f294=_0x48f294-0x0;var _0x375d6c=_0x83ea[_0x48f294];return _0x375d6c;};'use strict';var _=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var moment=require('moment');var BPromise=require(_0xa83e('0x2'));var rs=require(_0xa83e('0x3'));var fs=require('fs');var Redis=require(_0xa83e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa83e('0x5'));var logger=require('../../config/logger')(_0xa83e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa83e('0x7')][_0xa83e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x553f89,_0x57c6bd,_0x323c2f){return new BPromise(function(_0x4bd987,_0x509c5a){return client[_0xa83e('0x9')](_0x553f89,_0x323c2f)[_0xa83e('0xa')](function(_0x14d624){logger[_0xa83e('0xb')](_0xa83e('0xc'),_0x57c6bd,'request\x20sent');logger[_0xa83e('0xd')](_0xa83e('0xe'),_0x57c6bd,_0xa83e('0xf'),JSON[_0xa83e('0x10')](_0x14d624));if(_0x14d624[_0xa83e('0x11')]){if(_0x14d624['error'][_0xa83e('0x12')]===0x1f4){logger[_0xa83e('0x11')](_0xa83e('0xc'),_0x57c6bd,_0x14d624[_0xa83e('0x11')]['message']);return _0x509c5a(_0x14d624[_0xa83e('0x11')][_0xa83e('0x13')]);}logger[_0xa83e('0x11')]('FaxApplication,\x20%s,\x20%s',_0x57c6bd,_0x14d624['error'][_0xa83e('0x13')]);return _0x4bd987(_0x14d624[_0xa83e('0x11')]['message']);}else{logger[_0xa83e('0xb')](_0xa83e('0xc'),_0x57c6bd,'request\x20sent');_0x4bd987(_0x14d624['result'][_0xa83e('0x13')]);}})[_0xa83e('0x14')](function(_0xe27143){logger[_0xa83e('0x11')]('FaxApplication,\x20%s,\x20%s',_0x57c6bd,_0xe27143);_0x509c5a(_0xe27143);});});}exports['UpdateFaxApplication']=function(_0x347fbd){var _0x54b2c6=this;return new Promise(function(_0x1f4154,_0x2c9566){return db[_0xa83e('0x15')][_0xa83e('0x16')](_0x347fbd[_0xa83e('0x17')],{'raw':_0x347fbd['options']?_0x347fbd[_0xa83e('0x18')][_0xa83e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x347fbd[_0xa83e('0x18')]?_0x347fbd[_0xa83e('0x18')][_0xa83e('0x1a')]||null:null,'attributes':_0x347fbd[_0xa83e('0x18')]?_0x347fbd[_0xa83e('0x18')]['attributes']||null:null,'limit':_0x347fbd['options']?_0x347fbd[_0xa83e('0x18')][_0xa83e('0x1b')]||null:null})['then'](function(_0x1738a4){logger[_0xa83e('0xb')]('UpdateFaxApplication',_0x347fbd);logger[_0xa83e('0xd')](_0xa83e('0x1c'),_0x347fbd,JSON['stringify'](_0x1738a4));_0x1f4154(_0x1738a4);})[_0xa83e('0x14')](function(_0x38eeeb){logger[_0xa83e('0x11')](_0xa83e('0x1c'),_0x38eeeb[_0xa83e('0x13')],_0x347fbd);_0x2c9566(_0x54b2c6[_0xa83e('0x11')](0x1f4,_0x38eeeb['message']));});});}; \ No newline at end of file +var _0xabc1=['request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info'];(function(_0x5c7ff5,_0x50506a){var _0x29824c=function(_0x28e05a){while(--_0x28e05a){_0x5c7ff5['push'](_0x5c7ff5['shift']());}};_0x29824c(++_0x50506a);}(_0xabc1,0x92));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1abc('0x0'));var util=require(_0x1abc('0x1'));var moment=require('moment');var BPromise=require(_0x1abc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1abc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1abc('0x4'));var logger=require(_0x1abc('0x5'))(_0x1abc('0x6'));var config=require('../../config/environment');var jayson=require(_0x1abc('0x7'));var client=jayson[_0x1abc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4edc0a,_0x36466b,_0x368773){return new BPromise(function(_0x188384,_0x4586d8){return client['request'](_0x4edc0a,_0x368773)['then'](function(_0x258b54){logger[_0x1abc('0x9')]('FaxApplication,\x20%s,\x20%s',_0x36466b,_0x1abc('0xa'));logger['debug'](_0x1abc('0xb'),_0x36466b,_0x1abc('0xa'),JSON[_0x1abc('0xc')](_0x258b54));if(_0x258b54[_0x1abc('0xd')]){if(_0x258b54[_0x1abc('0xd')][_0x1abc('0xe')]===0x1f4){logger[_0x1abc('0xd')](_0x1abc('0xf'),_0x36466b,_0x258b54['error'][_0x1abc('0x10')]);return _0x4586d8(_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);}logger[_0x1abc('0xd')](_0x1abc('0xf'),_0x36466b,_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);return _0x188384(_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);}else{logger['info'](_0x1abc('0xf'),_0x36466b,_0x1abc('0xa'));_0x188384(_0x258b54[_0x1abc('0x11')]['message']);}})[_0x1abc('0x12')](function(_0x5ae22f){logger['error'](_0x1abc('0xf'),_0x36466b,_0x5ae22f);_0x4586d8(_0x5ae22f);});});}exports['UpdateFaxApplication']=function(_0x13f268){var _0x2f3154=this;return new Promise(function(_0x4ef478,_0x1e2a2d){return db['FaxApplication']['update'](_0x13f268[_0x1abc('0x13')],{'raw':_0x13f268[_0x1abc('0x14')]?_0x13f268[_0x1abc('0x14')][_0x1abc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f268[_0x1abc('0x14')]?_0x13f268[_0x1abc('0x14')][_0x1abc('0x16')]||null:null,'attributes':_0x13f268['options']?_0x13f268[_0x1abc('0x14')][_0x1abc('0x17')]||null:null,'limit':_0x13f268['options']?_0x13f268[_0x1abc('0x14')][_0x1abc('0x18')]||null:null})['then'](function(_0x5f46d5){logger[_0x1abc('0x9')](_0x1abc('0x19'),_0x13f268);logger['debug'](_0x1abc('0x19'),_0x13f268,JSON[_0x1abc('0xc')](_0x5f46d5));_0x4ef478(_0x5f46d5);})['catch'](function(_0x269b1a){logger[_0x1abc('0xd')]('UpdateFaxApplication',_0x269b1a[_0x1abc('0x10')],_0x13f268);_0x1e2a2d(_0x2f3154['error'](0x1f4,_0x269b1a[_0x1abc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index dd5798b..67f0a2f 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 _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(_0x1e1a0b,_0x378fa9){var _0x1ffd07=function(_0x4395d9){while(--_0x4395d9){_0x1e1a0b['push'](_0x1e1a0b['shift']());}};_0x1ffd07(++_0x378fa9);}(_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 +var _0x7916=['/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index'];(function(_0x4591ee,_0x3a1daf){var _0x4cdb81=function(_0x22b5cf){while(--_0x22b5cf){_0x4591ee['push'](_0x4591ee['shift']());}};_0x4cdb81(++_0x3a1daf);}(_0x7916,0x128));var _0x6791=function(_0x2e27e9,_0x17e4c1){_0x2e27e9=_0x2e27e9-0x0;var _0x566cd1=_0x7916[_0x2e27e9];return _0x566cd1;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6791('0xc')]);router[_0x6791('0xd')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router[_0x6791('0xf')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);module[_0x6791('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a16a9cb..b4f50e7 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 _0xb03e=['INTEGER','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x1d4bdb,_0x58f77b){var _0x288bea=function(_0x4a1630){while(--_0x4a1630){_0x1d4bdb['push'](_0x1d4bdb['shift']());}};_0x288bea(++_0x58f77b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x285947,_0x4f0a78){_0x285947=_0x285947-0x0;var _0x440f32=_0xb03e[_0x285947];return _0x440f32;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'closed':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeb03('0x2')]},'disposition':{'type':Sequelize[_0xeb03('0x3')]},'secondDisposition':{'type':Sequelize[_0xeb03('0x3')]},'thirdDisposition':{'type':Sequelize[_0xeb03('0x3')]},'note':{'type':Sequelize[_0xeb03('0x3')]},'read1stAt':{'type':Sequelize[_0xeb03('0x2')]},'fax':{'type':Sequelize[_0xeb03('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xeb03('0x4')]('in',_0xeb03('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xeb03('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb03('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xeb03('0x6')]}}; \ No newline at end of file +var _0xfb11=['STRING','ENUM','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x4be009,_0x239bec){var _0x50b245=function(_0x15ce8a){while(--_0x15ce8a){_0x4be009['push'](_0x4be009['shift']());}};_0x50b245(++_0x239bec);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xfb11[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1fb1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1fb1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1fb1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1fb1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1fb1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1fb1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x1fb1('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ce9b1b5..8464667 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 _0xc2e7=['./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','error','name','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','order','sort','pick','where','FaxInteractionId','filter','$gte','format','merge','rows','addTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','tmp','server','files','attachments','push','Attachment','get','mkdirSync','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download','log','err','unlinkSync','rimraf','util','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x501b41,_0x7a3143){var _0x539c54=function(_0x53ba41){while(--_0x53ba41){_0x501b41['push'](_0x501b41['shift']());}};_0x539c54(++_0x7a3143);}(_0xc2e7,0x1e8));var _0x7c2e=function(_0x5b1d6d,_0x29c9f0){_0x5b1d6d=_0x5b1d6d-0x0;var _0xfcfcc4=_0xc2e7[_0x5b1d6d];return _0xfcfcc4;};'use strict';var rimraf=require(_0x7c2e('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x7c2e('0x1'));var path=require(_0x7c2e('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x7c2e('0x3'));var qs=require(_0x7c2e('0x4'));var logger=require(_0x7c2e('0x5'))('api');var config=require(_0x7c2e('0x6'));var db=require(_0x7c2e('0x7'))['db'];config[_0x7c2e('0x8')]=_[_0x7c2e('0x9')](config[_0x7c2e('0x8')],{'host':_0x7c2e('0xa'),'port':0x18eb});var socket=require(_0x7c2e('0xb'))(new Redis(config[_0x7c2e('0x8')]));require(_0x7c2e('0xc'))[_0x7c2e('0xd')](socket);function respondWithStatusCode(_0x475d9a,_0x8ea99f){_0x8ea99f=_0x8ea99f||0xcc;return function(_0xaa0592){if(_0xaa0592){return _0x475d9a[_0x7c2e('0xe')](_0x8ea99f);}return _0x475d9a['status'](_0x8ea99f)[_0x7c2e('0xf')]();};}function respondWithResult(_0x3ba7ef,_0x38a756){_0x38a756=_0x38a756||0xc8;return function(_0x1b2b46){if(_0x1b2b46){return _0x3ba7ef[_0x7c2e('0x10')](_0x38a756)[_0x7c2e('0x11')](_0x1b2b46);}};}function respondWithFilteredResult(_0x490e9f,_0x5c45d6){return function(_0x4a2366){if(_0x4a2366){var _0x53f348=typeof _0x5c45d6[_0x7c2e('0x12')]===_0x7c2e('0x13')&&typeof _0x5c45d6['limit']===_0x7c2e('0x13');var _0x4fa644=_0x4a2366[_0x7c2e('0x14')];var _0x30fbe3=_0x53f348?0x0:_0x5c45d6['offset'];var _0x44f0cc=_0x53f348?_0x4a2366['count']:_0x5c45d6['offset']+_0x5c45d6[_0x7c2e('0x15')];var _0x2b16cb;if(_0x44f0cc>=_0x4fa644){_0x44f0cc=_0x4fa644;_0x2b16cb=0xc8;}else{_0x2b16cb=0xce;}_0x490e9f['status'](_0x2b16cb);return _0x490e9f['set'](_0x7c2e('0x16'),_0x30fbe3+'-'+_0x44f0cc+'/'+_0x4fa644)[_0x7c2e('0x11')](_0x4a2366);}return null;};}function saveUpdates(_0x3d1e46){return function(_0x168156){if(_0x168156){return _0x168156[_0x7c2e('0x17')](_0x3d1e46)[_0x7c2e('0x18')](function(_0x3ed7b8){return _0x3ed7b8;});}return null;};}function removeEntity(_0x2f17f){return function(_0x392d96){if(_0x392d96){return _0x392d96['destroy']()[_0x7c2e('0x18')](function(){_0x2f17f[_0x7c2e('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc82d){return function(_0x3d2fb2){if(!_0x3d2fb2){_0x4dc82d[_0x7c2e('0xe')](0x194);}return _0x3d2fb2;};}function handleError(_0x2f2f81,_0x4f8679){_0x4f8679=_0x4f8679||0x1f4;return function(_0x58866b){logger[_0x7c2e('0x19')](_0x58866b['stack']);if(_0x58866b[_0x7c2e('0x1a')]){delete _0x58866b[_0x7c2e('0x1a')];}_0x2f2f81[_0x7c2e('0x10')](_0x4f8679)['send'](_0x58866b);};}exports[_0x7c2e('0x1b')]=function(_0x3d424d,_0xf3834c){var _0x4f50d5={};var _0x3c8fda=_[_0x7c2e('0x1c')](db[_0x7c2e('0x1d')][_0x7c2e('0x1e')],function(_0x45c7bf){return{'name':_0x45c7bf['fieldName'],'type':_0x45c7bf[_0x7c2e('0x1f')][_0x7c2e('0x20')]};});_0x4f50d5=qs[_0x7c2e('0x21')](_0x3c8fda,_0x3d424d);return interaction[_0x7c2e('0x22')](_0x7c2e('0x23'),_0x3d424d[_0x7c2e('0x24')],_0x3d424d[_0x7c2e('0x25')],_0x4f50d5,_0x3c8fda)[_0x7c2e('0x18')](respondWithFilteredResult(_0xf3834c,_0x4f50d5))[_0x7c2e('0x26')](handleError(_0xf3834c,null));};exports[_0x7c2e('0x27')]=function(_0x279c4a,_0x3c4319){var _0x19e013={'raw':![],'where':{'id':_0x279c4a[_0x7c2e('0x28')]['id']}},_0x557af5={};_0x557af5[_0x7c2e('0x29')]=_[_0x7c2e('0x2a')](db[_0x7c2e('0x1d')]['rawAttributes']);_0x557af5[_0x7c2e('0x24')]=_['keys'](_0x279c4a[_0x7c2e('0x24')]);_0x557af5[_0x7c2e('0x2b')]=_[_0x7c2e('0x2c')](_0x557af5[_0x7c2e('0x29')],_0x557af5[_0x7c2e('0x24')]);_0x19e013[_0x7c2e('0x2d')]=_[_0x7c2e('0x2c')](_0x557af5[_0x7c2e('0x29')],qs[_0x7c2e('0x2e')](_0x279c4a[_0x7c2e('0x24')][_0x7c2e('0x2e')]));_0x19e013['attributes']=_0x19e013['attributes'][_0x7c2e('0x2f')]?_0x19e013[_0x7c2e('0x2d')]:_0x557af5[_0x7c2e('0x29')];if(_0x279c4a[_0x7c2e('0x24')][_0x7c2e('0x30')]){_0x19e013[_0x7c2e('0x31')]=[{'all':!![]}];}_0x19e013=_['merge']({},_0x19e013,_0x279c4a['options']);return db[_0x7c2e('0x1d')][_0x7c2e('0x32')](_0x19e013)[_0x7c2e('0x18')](handleEntityNotFound(_0x3c4319,null))['then'](respondWithResult(_0x3c4319,null))['catch'](handleError(_0x3c4319,null));};exports[_0x7c2e('0x33')]=function(_0x57aa89,_0x2e2345){return db[_0x7c2e('0x1d')]['create'](_0x57aa89['body'],{})[_0x7c2e('0x18')](respondWithResult(_0x2e2345,0xc9))['catch'](handleError(_0x2e2345,null));};exports[_0x7c2e('0x17')]=function(_0x5a1b13,_0x545bda){if(_0x5a1b13['body']['id']){delete _0x5a1b13[_0x7c2e('0x34')]['id'];}return db['FaxInteraction'][_0x7c2e('0x32')]({'where':{'id':_0x5a1b13['params']['id']}})['then'](handleEntityNotFound(_0x545bda,null))[_0x7c2e('0x18')](saveUpdates(_0x5a1b13[_0x7c2e('0x34')],null))[_0x7c2e('0x18')](respondWithResult(_0x545bda,null))['catch'](handleError(_0x545bda,null));};exports['destroy']=function(_0x242331,_0x457151){return db[_0x7c2e('0x1d')][_0x7c2e('0x32')]({'where':{'id':_0x242331['params']['id']}})[_0x7c2e('0x18')](handleEntityNotFound(_0x457151,null))[_0x7c2e('0x18')](removeEntity(_0x457151,null))[_0x7c2e('0x26')](handleError(_0x457151,null));};exports['describe']=function(_0x4ed378,_0x17c18a){return db[_0x7c2e('0x1d')][_0x7c2e('0x35')]()[_0x7c2e('0x18')](respondWithResult(_0x17c18a,null))['catch'](handleError(_0x17c18a,null));};exports[_0x7c2e('0x36')]=function(_0x198e8e,_0x459aa2){return db[_0x7c2e('0x37')]['find']({'where':{'id':_0x198e8e['params']['id']}})['then'](handleEntityNotFound(_0x459aa2,null))[_0x7c2e('0x18')](function(_0x446211){if(_0x446211){return _0x446211[_0x7c2e('0x36')](_0x198e8e[_0x7c2e('0x34')][_0x7c2e('0x38')],_[_0x7c2e('0x39')](_0x198e8e[_0x7c2e('0x34')],['ids','id'])||{});}})[_0x7c2e('0x18')](respondWithResult(_0x459aa2,null))['catch'](handleError(_0x459aa2,null));};exports[_0x7c2e('0x3a')]=function(_0x1f25e5,_0x22fb8f){var _0x88cd2e={'raw':![],'where':{}};var _0x2a6f58={};var _0x111e86={'count':0x0,'rows':[]};return db[_0x7c2e('0x1d')][_0x7c2e('0x3b')]({'where':{'id':_0x1f25e5['params']['id']}})['then'](handleEntityNotFound(_0x22fb8f,null))[_0x7c2e('0x18')](function(_0x5a5603){if(_0x5a5603){_0x2a6f58[_0x7c2e('0x29')]=_['keys'](db[_0x7c2e('0x37')][_0x7c2e('0x1e')]);_0x2a6f58[_0x7c2e('0x24')]=_[_0x7c2e('0x2a')](_0x1f25e5['query']);_0x2a6f58['filters']=_['intersection'](_0x2a6f58[_0x7c2e('0x29')],_0x2a6f58[_0x7c2e('0x24')]);_0x88cd2e[_0x7c2e('0x2d')]=_['intersection'](_0x2a6f58[_0x7c2e('0x29')],qs[_0x7c2e('0x2e')](_0x1f25e5[_0x7c2e('0x24')]['fields']));_0x88cd2e[_0x7c2e('0x2d')]=_0x88cd2e[_0x7c2e('0x2d')][_0x7c2e('0x2f')]?_0x88cd2e['attributes']:_0x2a6f58['model'];if(!_0x1f25e5[_0x7c2e('0x24')]['hasOwnProperty']('nolimit')){_0x88cd2e[_0x7c2e('0x15')]=qs[_0x7c2e('0x15')](_0x1f25e5['query']['limit']);_0x88cd2e['offset']=qs[_0x7c2e('0x12')](_0x1f25e5[_0x7c2e('0x24')]['offset']);}_0x88cd2e[_0x7c2e('0x3c')]=qs['sort'](_0x1f25e5['query'][_0x7c2e('0x3d')]);_0x88cd2e['where']=qs[_0x7c2e('0x2b')](_[_0x7c2e('0x3e')](_0x1f25e5[_0x7c2e('0x24')],_0x2a6f58['filters']));_0x88cd2e[_0x7c2e('0x3f')][_0x7c2e('0x40')]=_0x5a5603['id'];if(_0x1f25e5[_0x7c2e('0x24')][_0x7c2e('0x41')]){_0x88cd2e['where']=_['merge'](_0x88cd2e[_0x7c2e('0x3f')],{'$or':_['map'](_0x88cd2e[_0x7c2e('0x2d')],function(_0x505912){var _0xf1d14f={};_0xf1d14f[_0x505912]={'$like':'%'+_0x1f25e5[_0x7c2e('0x24')]['filter']+'%'};return _0xf1d14f;})});}if(_0x1f25e5[_0x7c2e('0x24')]['$gte']){var _0x549326=_0x1f25e5[_0x7c2e('0x24')][_0x7c2e('0x42')]['split'](',');var _0x1ba942={};_0x1ba942[_0x549326[0x0]]={'$gte':moment(_0x549326[0x1])[_0x7c2e('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x88cd2e['where']=_[_0x7c2e('0x44')](_0x88cd2e[_0x7c2e('0x3f')],_0x1ba942);}_0x88cd2e=_[_0x7c2e('0x44')]({},_0x88cd2e,_0x1f25e5['options']);return db[_0x7c2e('0x37')]['count']({'where':_0x88cd2e[_0x7c2e('0x3f')]})[_0x7c2e('0x18')](function(_0x394d75){_0x111e86[_0x7c2e('0x14')]=_0x394d75;if(_0x1f25e5[_0x7c2e('0x24')][_0x7c2e('0x30')]){_0x88cd2e[_0x7c2e('0x31')]=[{'all':!![]}];}return db[_0x7c2e('0x37')][_0x7c2e('0x22')](_0x88cd2e);})[_0x7c2e('0x18')](function(_0x478942){_0x111e86[_0x7c2e('0x45')]=_0x478942;return _0x111e86;});}})[_0x7c2e('0x18')](respondWithFilteredResult(_0x22fb8f,_0x88cd2e))['catch'](handleError(_0x22fb8f,null));};exports[_0x7c2e('0x46')]=function(_0x5c4411,_0x36e517){return db['FaxInteraction']['find']({'where':{'id':_0x5c4411['params']['id']}})['then'](handleEntityNotFound(_0x36e517,null))[_0x7c2e('0x18')](function(_0x21c93a){if(_0x21c93a){return _0x21c93a['setTags'](_0x5c4411[_0x7c2e('0x34')][_0x7c2e('0x38')],_[_0x7c2e('0x39')](_0x5c4411[_0x7c2e('0x34')],[_0x7c2e('0x38'),'id'])||{})[_0x7c2e('0x47')](function(){return db[_0x7c2e('0x48')]['findAll']({'attributes':['id',_0x7c2e('0x1a'),_0x7c2e('0x49')],'where':{'id':_0x5c4411[_0x7c2e('0x34')][_0x7c2e('0x38')]}});})[_0x7c2e('0x18')](function(_0x1f4b41){socket[_0x7c2e('0x4a')](_0x7c2e('0x4b'),{'id':Number(_0x5c4411[_0x7c2e('0x28')]['id']),'tags':_0x1f4b41||[]});return{'id':Number(_0x5c4411['params']['id']),'tags':_0x1f4b41||[]};});}})[_0x7c2e('0x18')](respondWithResult(_0x36e517,null))[_0x7c2e('0x26')](handleError(_0x36e517,null));};exports[_0x7c2e('0x4c')]=function(_0x53c789,_0x2c8736){return db[_0x7c2e('0x1d')][_0x7c2e('0x32')]({'where':{'id':_0x53c789[_0x7c2e('0x28')]['id']}})['then'](handleEntityNotFound(_0x2c8736,null))['then'](function(_0x2691e4){if(_0x2691e4){return _0x2691e4[_0x7c2e('0x4c')](_0x53c789[_0x7c2e('0x24')][_0x7c2e('0x38')]);}})[_0x7c2e('0x18')](respondWithStatusCode(_0x2c8736,null))['catch'](handleError(_0x2c8736,null));};exports['download']=function(_0x4fee47,_0x5f10ef){var _0x4e228e=moment()[_0x7c2e('0x4d')]()[_0x7c2e('0x4e')]();var _0x5ef3ba=path[_0x7c2e('0x4f')](config[_0x7c2e('0x50')],'server','files',_0x7c2e('0x51'));var _0x32775e=path[_0x7c2e('0x4f')](config[_0x7c2e('0x50')],_0x7c2e('0x52'),_0x7c2e('0x53'),_0x7c2e('0x54'));var _0xe7b8d7=path[_0x7c2e('0x4f')](_0x5ef3ba,_0x4e228e);var _0x50df42=util['format']('transcript-%d-%s.zip',_0x4fee47['params']['id'],_0x4e228e);var _0x4f946a=path[_0x7c2e('0x4f')](_0x5ef3ba,_0x50df42);var _0x535705=[];_0x535705[_0x7c2e('0x55')]({'model':db[_0x7c2e('0x56')],'as':_0x7c2e('0x56'),'raw':!![]});var _0x593062=[{'model':db[_0x7c2e('0x37')],'as':'Messages','attributes':['id',_0x7c2e('0x34'),'createdAt'],'include':_0x535705}];return db[_0x7c2e('0x1d')]['find']({'where':{'id':_0x4fee47[_0x7c2e('0x28')]['id']},'include':_0x593062})['then'](handleEntityNotFound(_0x5f10ef,null))[_0x7c2e('0x18')](function(_0xdff8e1){if(_0xdff8e1&&_0xdff8e1['Messages']){var _0x38ae26=_0xdff8e1[_0x7c2e('0x57')]({'plain':!![]});fs[_0x7c2e('0x58')](_0xe7b8d7);for(var _0x5a0130=0x0;_0x5a0130<_0x38ae26[_0x7c2e('0x59')]['length'];_0x5a0130++){var _0x3e0dc5=_0x38ae26[_0x7c2e('0x59')][_0x5a0130][_0x7c2e('0x56')];if(_0x3e0dc5){var _0x548647=path['join'](_0x32775e,_0x3e0dc5['basename']);if(fs[_0x7c2e('0x5a')](_0x548647)){fs[_0x7c2e('0x5b')](_0x548647)[_0x7c2e('0x5c')](fs[_0x7c2e('0x5d')](path[_0x7c2e('0x4f')](_0xe7b8d7,_0x3e0dc5[_0x7c2e('0x5e')])));}}}return BPromise[_0x7c2e('0x5f')]()[_0x7c2e('0x18')](function(){return new BPromise(function(_0x726aa7,_0x86717a){zipdir(_0xe7b8d7,{'saveTo':_0x4f946a},function(_0x3bf37d,_0x199240){if(_0x3bf37d)return _0x86717a(_0x3bf37d);return _0x726aa7(_0x199240);});})['then'](function(){return new BPromise(function(_0x156bce,_0x5e3687){rimraf(_0xe7b8d7,function(_0xe064e7){if(_0xe064e7)_0x5e3687(_0xe064e7);return _0x156bce();});});})['then'](function(){return _0x5f10ef[_0x7c2e('0x60')](_0x4f946a,_0x50df42,function(_0x1fca82){if(_0x1fca82){console[_0x7c2e('0x61')](_0x7c2e('0x62'),_0x1fca82);}else{fs[_0x7c2e('0x63')](_0x4f946a);}});});});}else{return _0x5f10ef['sendStatus'](0xc8);}})['catch'](handleError(_0x5f10ef,null));}; \ No newline at end of file +var _0xde9f=['attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','log','unlinkSync','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','fieldName','type','getOptions','findAll','fax','user','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','body','find','describe','addMessage','FaxMessage','getMessages','findOne','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','ids','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','toString','join','root','files','tmp','server'];(function(_0x21c795,_0x4840d5){var _0x482def=function(_0x45e193){while(--_0x45e193){_0x21c795['push'](_0x21c795['shift']());}};_0x482def(++_0x4840d5);}(_0xde9f,0x73));var _0xfde9=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0xde9f[_0x4f4d19];return _0x27a258;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xfde9('0x0'));var util=require('util');var path=require(_0xfde9('0x1'));var fs=require('fs');var _=require(_0xfde9('0x2'));var Redis=require(_0xfde9('0x3'));var interaction=require(_0xfde9('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xfde9('0x5'))('api');var config=require(_0xfde9('0x6'));var db=require('../../mysqldb')['db'];config[_0xfde9('0x7')]=_[_0xfde9('0x8')](config['redis'],{'host':_0xfde9('0x9'),'port':0x18eb});var socket=require(_0xfde9('0xa'))(new Redis(config[_0xfde9('0x7')]));require(_0xfde9('0xb'))['register'](socket);function respondWithStatusCode(_0xc14656,_0x487558){_0x487558=_0x487558||0xcc;return function(_0x5af4d){if(_0x5af4d){return _0xc14656[_0xfde9('0xc')](_0x487558);}return _0xc14656[_0xfde9('0xd')](_0x487558)[_0xfde9('0xe')]();};}function respondWithResult(_0x52dcc6,_0x576b4d){_0x576b4d=_0x576b4d||0xc8;return function(_0x50c954){if(_0x50c954){return _0x52dcc6[_0xfde9('0xd')](_0x576b4d)[_0xfde9('0xf')](_0x50c954);}};}function respondWithFilteredResult(_0x4b9efe,_0x537d4e){return function(_0x34a678){if(_0x34a678){var _0x532aac=typeof _0x537d4e[_0xfde9('0x10')]===_0xfde9('0x11')&&typeof _0x537d4e[_0xfde9('0x12')]===_0xfde9('0x11');var _0x3f6e0c=_0x34a678[_0xfde9('0x13')];var _0x11f332=_0x532aac?0x0:_0x537d4e[_0xfde9('0x10')];var _0x1bad59=_0x532aac?_0x34a678['count']:_0x537d4e['offset']+_0x537d4e[_0xfde9('0x12')];var _0xbc7ad6;if(_0x1bad59>=_0x3f6e0c){_0x1bad59=_0x3f6e0c;_0xbc7ad6=0xc8;}else{_0xbc7ad6=0xce;}_0x4b9efe[_0xfde9('0xd')](_0xbc7ad6);return _0x4b9efe['set'](_0xfde9('0x14'),_0x11f332+'-'+_0x1bad59+'/'+_0x3f6e0c)[_0xfde9('0xf')](_0x34a678);}return null;};}function saveUpdates(_0x3d602c){return function(_0x1b916f){if(_0x1b916f){return _0x1b916f[_0xfde9('0x15')](_0x3d602c)[_0xfde9('0x16')](function(_0xb3459b){return _0xb3459b;});}return null;};}function removeEntity(_0x1207e6){return function(_0x1bbc9d){if(_0x1bbc9d){return _0x1bbc9d[_0xfde9('0x17')]()[_0xfde9('0x16')](function(){_0x1207e6['status'](0xcc)[_0xfde9('0xe')]();});}};}function handleEntityNotFound(_0x1d7cae){return function(_0x547da5){if(!_0x547da5){_0x1d7cae[_0xfde9('0xc')](0x194);}return _0x547da5;};}function handleError(_0x3b78a2,_0x13a9fa){_0x13a9fa=_0x13a9fa||0x1f4;return function(_0x33e911){logger[_0xfde9('0x18')](_0x33e911[_0xfde9('0x19')]);if(_0x33e911[_0xfde9('0x1a')]){delete _0x33e911[_0xfde9('0x1a')];}_0x3b78a2[_0xfde9('0xd')](_0x13a9fa)[_0xfde9('0x1b')](_0x33e911);};}exports[_0xfde9('0x1c')]=function(_0x202fc8,_0x29e597){var _0x258e36={};var _0x38e2bd=_[_0xfde9('0x1d')](db[_0xfde9('0x1e')]['rawAttributes'],function(_0x4f0566){return{'name':_0x4f0566[_0xfde9('0x1f')],'type':_0x4f0566[_0xfde9('0x20')]['key']};});_0x258e36=qs[_0xfde9('0x21')](_0x38e2bd,_0x202fc8);return interaction[_0xfde9('0x22')](_0xfde9('0x23'),_0x202fc8['query'],_0x202fc8[_0xfde9('0x24')],_0x258e36,_0x38e2bd)[_0xfde9('0x16')](respondWithFilteredResult(_0x29e597,_0x258e36))[_0xfde9('0x25')](handleError(_0x29e597,null));};exports[_0xfde9('0x26')]=function(_0x2d509e,_0x21c2be){var _0x6d10bc={'raw':![],'where':{'id':_0x2d509e[_0xfde9('0x27')]['id']}},_0x55337c={};_0x55337c[_0xfde9('0x28')]=_[_0xfde9('0x29')](db[_0xfde9('0x1e')][_0xfde9('0x2a')]);_0x55337c[_0xfde9('0x2b')]=_[_0xfde9('0x29')](_0x2d509e['query']);_0x55337c[_0xfde9('0x2c')]=_[_0xfde9('0x2d')](_0x55337c['model'],_0x55337c[_0xfde9('0x2b')]);_0x6d10bc[_0xfde9('0x2e')]=_[_0xfde9('0x2d')](_0x55337c['model'],qs[_0xfde9('0x2f')](_0x2d509e['query']['fields']));_0x6d10bc[_0xfde9('0x2e')]=_0x6d10bc[_0xfde9('0x2e')][_0xfde9('0x30')]?_0x6d10bc[_0xfde9('0x2e')]:_0x55337c[_0xfde9('0x28')];if(_0x2d509e[_0xfde9('0x2b')][_0xfde9('0x31')]){_0x6d10bc[_0xfde9('0x32')]=[{'all':!![]}];}_0x6d10bc=_[_0xfde9('0x33')]({},_0x6d10bc,_0x2d509e[_0xfde9('0x34')]);return db[_0xfde9('0x1e')]['find'](_0x6d10bc)[_0xfde9('0x16')](handleEntityNotFound(_0x21c2be,null))[_0xfde9('0x16')](respondWithResult(_0x21c2be,null))['catch'](handleError(_0x21c2be,null));};exports['create']=function(_0x397d14,_0x4b03d2){return db[_0xfde9('0x1e')]['create'](_0x397d14[_0xfde9('0x35')],{})[_0xfde9('0x16')](respondWithResult(_0x4b03d2,0xc9))[_0xfde9('0x25')](handleError(_0x4b03d2,null));};exports[_0xfde9('0x15')]=function(_0x8044ab,_0x271dad){if(_0x8044ab[_0xfde9('0x35')]['id']){delete _0x8044ab['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x8044ab[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x271dad,null))[_0xfde9('0x16')](saveUpdates(_0x8044ab[_0xfde9('0x35')],null))[_0xfde9('0x16')](respondWithResult(_0x271dad,null))[_0xfde9('0x25')](handleError(_0x271dad,null));};exports['destroy']=function(_0x2d051d,_0x285c21){return db[_0xfde9('0x1e')][_0xfde9('0x36')]({'where':{'id':_0x2d051d[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x285c21,null))[_0xfde9('0x16')](removeEntity(_0x285c21,null))[_0xfde9('0x25')](handleError(_0x285c21,null));};exports[_0xfde9('0x37')]=function(_0xebfac8,_0x2d0c52){return db['FaxInteraction'][_0xfde9('0x37')]()[_0xfde9('0x16')](respondWithResult(_0x2d0c52,null))[_0xfde9('0x25')](handleError(_0x2d0c52,null));};exports[_0xfde9('0x38')]=function(_0x21f5c7,_0x32861b){return db[_0xfde9('0x39')][_0xfde9('0x36')]({'where':{'id':_0x21f5c7[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x32861b,null))[_0xfde9('0x16')](function(_0x31ddca){if(_0x31ddca){return _0x31ddca[_0xfde9('0x38')](_0x21f5c7['body']['ids'],_['omit'](_0x21f5c7[_0xfde9('0x35')],['ids','id'])||{});}})[_0xfde9('0x16')](respondWithResult(_0x32861b,null))['catch'](handleError(_0x32861b,null));};exports[_0xfde9('0x3a')]=function(_0x7fd46e,_0x2a5367){var _0x5a2450={'raw':![],'where':{}};var _0x4dc4cb={};var _0x575ad1={'count':0x0,'rows':[]};return db[_0xfde9('0x1e')][_0xfde9('0x3b')]({'where':{'id':_0x7fd46e[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x2a5367,null))['then'](function(_0x4465e0){if(_0x4465e0){_0x4dc4cb[_0xfde9('0x28')]=_[_0xfde9('0x29')](db[_0xfde9('0x39')][_0xfde9('0x2a')]);_0x4dc4cb[_0xfde9('0x2b')]=_[_0xfde9('0x29')](_0x7fd46e[_0xfde9('0x2b')]);_0x4dc4cb['filters']=_[_0xfde9('0x2d')](_0x4dc4cb[_0xfde9('0x28')],_0x4dc4cb[_0xfde9('0x2b')]);_0x5a2450[_0xfde9('0x2e')]=_[_0xfde9('0x2d')](_0x4dc4cb[_0xfde9('0x28')],qs['fields'](_0x7fd46e['query'][_0xfde9('0x2f')]));_0x5a2450[_0xfde9('0x2e')]=_0x5a2450[_0xfde9('0x2e')][_0xfde9('0x30')]?_0x5a2450[_0xfde9('0x2e')]:_0x4dc4cb[_0xfde9('0x28')];if(!_0x7fd46e['query']['hasOwnProperty']('nolimit')){_0x5a2450['limit']=qs[_0xfde9('0x12')](_0x7fd46e[_0xfde9('0x2b')]['limit']);_0x5a2450[_0xfde9('0x10')]=qs[_0xfde9('0x10')](_0x7fd46e['query'][_0xfde9('0x10')]);}_0x5a2450[_0xfde9('0x3c')]=qs[_0xfde9('0x3d')](_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x3d')]);_0x5a2450[_0xfde9('0x3e')]=qs[_0xfde9('0x2c')](_['pick'](_0x7fd46e[_0xfde9('0x2b')],_0x4dc4cb[_0xfde9('0x2c')]));_0x5a2450['where']['FaxInteractionId']=_0x4465e0['id'];if(_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x3f')]){_0x5a2450['where']=_['merge'](_0x5a2450[_0xfde9('0x3e')],{'$or':_[_0xfde9('0x1d')](_0x5a2450[_0xfde9('0x2e')],function(_0x28bd17){var _0x54f361={};_0x54f361[_0x28bd17]={'$like':'%'+_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x3f')]+'%'};return _0x54f361;})});}if(_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x40')]){var _0x475606=_0x7fd46e[_0xfde9('0x2b')]['$gte'][_0xfde9('0x41')](',');var _0x376cc6={};_0x376cc6[_0x475606[0x0]]={'$gte':moment(_0x475606[0x1])[_0xfde9('0x42')](_0xfde9('0x43'))};_0x5a2450[_0xfde9('0x3e')]=_[_0xfde9('0x33')](_0x5a2450[_0xfde9('0x3e')],_0x376cc6);}_0x5a2450=_[_0xfde9('0x33')]({},_0x5a2450,_0x7fd46e['options']);return db[_0xfde9('0x39')]['count']({'where':_0x5a2450[_0xfde9('0x3e')]})[_0xfde9('0x16')](function(_0x26e2e8){_0x575ad1['count']=_0x26e2e8;if(_0x7fd46e[_0xfde9('0x2b')]['includeAll']){_0x5a2450['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x5a2450);})[_0xfde9('0x16')](function(_0x4ab33e){_0x575ad1['rows']=_0x4ab33e;return _0x575ad1;});}})[_0xfde9('0x16')](respondWithFilteredResult(_0x2a5367,_0x5a2450))['catch'](handleError(_0x2a5367,null));};exports['addTags']=function(_0x9472bf,_0x420719){return db['FaxInteraction']['find']({'where':{'id':_0x9472bf[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x420719,null))['then'](function(_0xb817fd){if(_0xb817fd){return _0xb817fd[_0xfde9('0x44')](_0x9472bf['body'][_0xfde9('0x45')],_[_0xfde9('0x46')](_0x9472bf[_0xfde9('0x35')],[_0xfde9('0x45'),'id'])||{})[_0xfde9('0x47')](function(){return db[_0xfde9('0x48')][_0xfde9('0x22')]({'attributes':['id',_0xfde9('0x1a'),_0xfde9('0x49')],'where':{'id':_0x9472bf['body'][_0xfde9('0x45')]}});})[_0xfde9('0x16')](function(_0x3d68d0){socket[_0xfde9('0x4a')](_0xfde9('0x4b'),{'id':Number(_0x9472bf['params']['id']),'tags':_0x3d68d0||[]});return{'id':Number(_0x9472bf[_0xfde9('0x27')]['id']),'tags':_0x3d68d0||[]};});}})['then'](respondWithResult(_0x420719,null))[_0xfde9('0x25')](handleError(_0x420719,null));};exports[_0xfde9('0x4c')]=function(_0x9a8f00,_0x5073d0){return db['FaxInteraction'][_0xfde9('0x36')]({'where':{'id':_0x9a8f00[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x5073d0,null))[_0xfde9('0x16')](function(_0x14a31c){if(_0x14a31c){return _0x14a31c[_0xfde9('0x4c')](_0x9a8f00[_0xfde9('0x2b')][_0xfde9('0x45')]);}})['then'](respondWithStatusCode(_0x5073d0,null))[_0xfde9('0x25')](handleError(_0x5073d0,null));};exports['download']=function(_0x3c3545,_0x43f397){var _0x28fd71=moment()['unix']()[_0xfde9('0x4d')]();var _0x187ac9=path[_0xfde9('0x4e')](config[_0xfde9('0x4f')],'server',_0xfde9('0x50'),_0xfde9('0x51'));var _0xad0008=path['join'](config[_0xfde9('0x4f')],_0xfde9('0x52'),'files',_0xfde9('0x53'));var _0x18936a=path[_0xfde9('0x4e')](_0x187ac9,_0x28fd71);var _0x18e5da=util[_0xfde9('0x42')]('transcript-%d-%s.zip',_0x3c3545[_0xfde9('0x27')]['id'],_0x28fd71);var _0x1d606b=path['join'](_0x187ac9,_0x18e5da);var _0x277bc7=[];_0x277bc7[_0xfde9('0x54')]({'model':db[_0xfde9('0x55')],'as':'Attachment','raw':!![]});var _0xa08803=[{'model':db['FaxMessage'],'as':_0xfde9('0x56'),'attributes':['id',_0xfde9('0x35'),_0xfde9('0x57')],'include':_0x277bc7}];return db[_0xfde9('0x1e')][_0xfde9('0x36')]({'where':{'id':_0x3c3545['params']['id']},'include':_0xa08803})[_0xfde9('0x16')](handleEntityNotFound(_0x43f397,null))['then'](function(_0x430c54){if(_0x430c54&&_0x430c54[_0xfde9('0x56')]){var _0x22d9ab=_0x430c54[_0xfde9('0x58')]({'plain':!![]});fs[_0xfde9('0x59')](_0x18936a);for(var _0x35c68d=0x0;_0x35c68d<_0x22d9ab['Messages']['length'];_0x35c68d++){var _0x350bf0=_0x22d9ab[_0xfde9('0x56')][_0x35c68d][_0xfde9('0x55')];if(_0x350bf0){var _0x50c721=path[_0xfde9('0x4e')](_0xad0008,_0x350bf0[_0xfde9('0x5a')]);if(fs[_0xfde9('0x5b')](_0x50c721)){fs[_0xfde9('0x5c')](_0x50c721)[_0xfde9('0x5d')](fs[_0xfde9('0x5e')](path[_0xfde9('0x4e')](_0x18936a,_0x350bf0['basename'])));}}}return BPromise[_0xfde9('0x5f')]()[_0xfde9('0x16')](function(){return new BPromise(function(_0x537af4,_0x514260){zipdir(_0x18936a,{'saveTo':_0x1d606b},function(_0x164971,_0x1fb230){if(_0x164971)return _0x514260(_0x164971);return _0x537af4(_0x1fb230);});})[_0xfde9('0x16')](function(){return new BPromise(function(_0x3470ec,_0x34eed5){rimraf(_0x18936a,function(_0x4e8d30){if(_0x4e8d30)_0x34eed5(_0x4e8d30);return _0x3470ec();});});})[_0xfde9('0x16')](function(){return _0x43f397[_0xfde9('0x60')](_0x1d606b,_0x18e5da,function(_0x4ec638){if(_0x4ec638){console[_0xfde9('0x61')]('err',_0x4ec638);}else{fs[_0xfde9('0x62')](_0x1d606b);}});});});}else{return _0x43f397[_0xfde9('0xc')](0xc8);}})[_0xfde9('0x25')](handleError(_0x43f397,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9b08aa0..92c141e 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 _0x0d2e=['setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','hook','events','../../mysqldb'];(function(_0x4f883c,_0x313de9){var _0x5e06f2=function(_0x598c6a){while(--_0x598c6a){_0x4f883c['push'](_0x4f883c['shift']());}};_0x5e06f2(++_0x313de9);}(_0x0d2e,0x191));var _0xe0d2=function(_0x4978dd,_0x12923b){_0x4978dd=_0x4978dd-0x0;var _0x1e9e7c=_0x0d2e[_0x4978dd];return _0x1e9e7c;};'use strict';var EventEmitter=require(_0xe0d2('0x0'));var FaxInteraction=require(_0xe0d2('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xe0d2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe0d2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0d2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45f850){return function(_0xe2e7e8,_0x2fb734,_0x2788ef){_0xe2e7e8[_0xe0d2('0x4')]({'attributes':['id'],'raw':!![]})[_0xe0d2('0x5')](function(_0x566b4c){_0xe2e7e8[_0xe0d2('0x6')](_0xe0d2('0x7'),_0x566b4c[_0xe0d2('0x8')](function(_0x2c9382){return{'id':_0x2c9382['id']};}));return FaxMessage[_0xe0d2('0x9')]({'where':{'FaxInteractionId':_0xe2e7e8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe0d2('0x5')](function(_0x3445dc){_0xe2e7e8[_0xe0d2('0x6')](_0xe0d2('0xa'),_0x3445dc[_0xe0d2('0xb')]);FaxInteractionEvents['emit'](_0x45f850+':'+_0xe2e7e8['id'],_0xe2e7e8);FaxInteractionEvents['emit'](_0x45f850,_0xe2e7e8);_0x2788ef(null);})['catch'](_0x2788ef(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xe0d2('0xc')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x833c=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update','getUsers','setDataValue','Users','map','then'];(function(_0x5bb90a,_0x5a16ad){var _0x5f267b=function(_0x4e6a09){while(--_0x4e6a09){_0x5bb90a['push'](_0x5bb90a['shift']());}};_0x5f267b(++_0x5a16ad);}(_0x833c,0x128));var _0xc833=function(_0x4b8b02,_0x314efc){_0x4b8b02=_0x4b8b02-0x0;var _0x404f9a=_0x833c[_0x4b8b02];return _0x404f9a;};'use strict';var EventEmitter=require(_0xc833('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xc833('0x1'))['db'][_0xc833('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc833('0x3'),'afterUpdate':_0xc833('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5338dc){return function(_0x34a87c,_0x26fd81,_0x2af1a8){_0x34a87c[_0xc833('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x192fc6){_0x34a87c[_0xc833('0x6')](_0xc833('0x7'),_0x192fc6[_0xc833('0x8')](function(_0x27e4c8){return{'id':_0x27e4c8['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x34a87c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc833('0x9')](function(_0x236600){_0x34a87c[_0xc833('0x6')](_0xc833('0xa'),_0x236600[_0xc833('0xb')]);FaxInteractionEvents[_0xc833('0xc')](_0x5338dc+':'+_0x34a87c['id'],_0x34a87c);FaxInteractionEvents[_0xc833('0xc')](_0x5338dc,_0x34a87c);_0x2af1a8(null);})[_0xc833('0xd')](_0x2af1a8(null));};}for(var e in events){if(events[_0xc833('0xe')](e)){var event=events[e];FaxInteraction[_0xc833('0xf')](e,emitEvent(event));}}module[_0xc833('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 34f0aa5..8c03c2f 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 _0x0799=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format'];(function(_0x348682,_0x289cbc){var _0x1abf3a=function(_0x7d05c0){while(--_0x7d05c0){_0x348682['push'](_0x348682['shift']());}};_0x1abf3a(++_0x289cbc);}(_0x0799,0x151));var _0x9079=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x0799[_0x1a37e3];return _0x4db78a;};'use strict';var _=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var logger=require(_0x9079('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9079('0x3'));var rp=require(_0x9079('0x4'));var fs=require('fs');var path=require(_0x9079('0x5'));var rimraf=require(_0x9079('0x6'));var config=require('../../config/environment');var attributes=require(_0x9079('0x7'));module[_0x9079('0x8')]=function(_0x8c4151,_0xd748b1){return _0x8c4151[_0x9079('0x9')](_0x9079('0xa'),attributes,{'tableName':_0x9079('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe40965,_0x3c7ff9,_0x4abd33){if(_0xe40965[_0x9079('0xc')](_0x9079('0xd'))){_0xe40965['closedAt']=moment()[_0x9079('0xe')](_0x9079('0xf'));}_0x4abd33(null,_0xe40965);}}});}; \ No newline at end of file +var _0x3713=['../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xe0f242,_0x2f4ecf){var _0x3b801a=function(_0x29d08c){while(--_0x29d08c){_0xe0f242['push'](_0xe0f242['shift']());}};_0x3b801a(++_0x2f4ecf);}(_0x3713,0xa2));var _0x3371=function(_0xc9e6d1,_0x24fc3d){_0xc9e6d1=_0xc9e6d1-0x0;var _0x56b3c0=_0x3713[_0xc9e6d1];return _0x56b3c0;};'use strict';var _=require(_0x3371('0x0'));var util=require(_0x3371('0x1'));var logger=require(_0x3371('0x2'))(_0x3371('0x3'));var moment=require(_0x3371('0x4'));var BPromise=require(_0x3371('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3371('0x6'));var rimraf=require(_0x3371('0x7'));var config=require(_0x3371('0x8'));var attributes=require(_0x3371('0x9'));module['exports']=function(_0xa8c99c,_0x3e28b2){return _0xa8c99c[_0x3371('0xa')](_0x3371('0xb'),attributes,{'tableName':_0x3371('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7a3228,_0x594c75,_0x5963e1){if(_0x7a3228[_0x3371('0xd')]('closed')){_0x7a3228[_0x3371('0xe')]=moment()[_0x3371('0xf')](_0x3371('0x10'));}_0x5963e1(null,_0x7a3228);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2a9fd3c..3683515 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 _0x72de=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','UpdateFaxInteraction','stringify','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x72de,0x1ac));var _0xe72d=function(_0x212ab4,_0x25da6c){_0x212ab4=_0x212ab4-0x0;var _0x5a7668=_0x72de[_0x212ab4];return _0x5a7668;};'use strict';var _=require(_0xe72d('0x0'));var util=require(_0xe72d('0x1'));var moment=require(_0xe72d('0x2'));var BPromise=require(_0xe72d('0x3'));var rs=require(_0xe72d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe72d('0x5'))['db'];var utils=require(_0xe72d('0x6'));var logger=require(_0xe72d('0x7'))(_0xe72d('0x8'));var config=require(_0xe72d('0x9'));var jayson=require(_0xe72d('0xa'));var client=jayson[_0xe72d('0xb')][_0xe72d('0xc')]({'port':0x232a});config[_0xe72d('0xd')]=_[_0xe72d('0xe')](config[_0xe72d('0xd')],{'host':_0xe72d('0xf'),'port':0x18eb});var socket=require(_0xe72d('0x10'))(new Redis(config[_0xe72d('0xd')]));require('./faxInteraction.socket')[_0xe72d('0x11')](socket);function respondWithRpcPromise(_0x3bd05f,_0x420ca0,_0x476bd6){return new BPromise(function(_0xe483d6,_0x3f6567){return client[_0xe72d('0x12')](_0x3bd05f,_0x476bd6)[_0xe72d('0x13')](function(_0x333919){logger[_0xe72d('0x14')](_0xe72d('0x15'),_0x420ca0,_0xe72d('0x16'));logger[_0xe72d('0x17')](_0xe72d('0x18'),_0x420ca0,_0xe72d('0x16'),JSON['stringify'](_0x333919));if(_0x333919[_0xe72d('0x19')]){if(_0x333919[_0xe72d('0x19')][_0xe72d('0x1a')]===0x1f4){logger[_0xe72d('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x420ca0,_0x333919[_0xe72d('0x19')][_0xe72d('0x1b')]);return _0x3f6567(_0x333919['error']['message']);}logger[_0xe72d('0x19')](_0xe72d('0x15'),_0x420ca0,_0x333919['error'][_0xe72d('0x1b')]);return _0xe483d6(_0x333919[_0xe72d('0x19')][_0xe72d('0x1b')]);}else{logger[_0xe72d('0x14')](_0xe72d('0x15'),_0x420ca0,_0xe72d('0x16'));_0xe483d6(_0x333919[_0xe72d('0x1c')][_0xe72d('0x1b')]);}})[_0xe72d('0x1d')](function(_0x4dcd7d){logger[_0xe72d('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x420ca0,_0x4dcd7d);_0x3f6567(_0x4dcd7d);});});}exports['UpdateFaxInteraction']=function(_0x3dc46e){var _0x5e53a7=this;return new Promise(function(_0x2153ea,_0x11e3aa){return db[_0xe72d('0x1e')][_0xe72d('0x1f')](_0x3dc46e[_0xe72d('0x20')],{'raw':_0x3dc46e['options']?_0x3dc46e[_0xe72d('0x21')][_0xe72d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc46e[_0xe72d('0x21')]?_0x3dc46e['options'][_0xe72d('0x23')]||null:null,'attributes':_0x3dc46e[_0xe72d('0x21')]?_0x3dc46e['options'][_0xe72d('0x24')]||null:null,'limit':_0x3dc46e[_0xe72d('0x21')]?_0x3dc46e['options']['limit']||null:null})[_0xe72d('0x13')](function(_0x36acb1){logger['info'](_0xe72d('0x25'),_0x3dc46e);logger[_0xe72d('0x17')]('UpdateFaxInteraction',_0x3dc46e,JSON[_0xe72d('0x26')](_0x36acb1));_0x2153ea(_0x36acb1);})['catch'](function(_0xa0111a){logger['error'](_0xe72d('0x25'),_0xa0111a[_0xe72d('0x1b')],_0x3dc46e);_0x11e3aa(_0x5e53a7[_0xe72d('0x19')](0x1f4,_0xa0111a[_0xe72d('0x1b')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5a9fc5){return new Promise(function(_0x198ca0,_0xce00e5){return db[_0xe72d('0x1e')][_0xe72d('0x27')]({'where':_0x5a9fc5[_0xe72d('0x21')]?_0x5a9fc5[_0xe72d('0x21')]['where']||null:null})['then'](function(_0x190f5b){if(_0x190f5b){return _0x190f5b['addTags'](_0x5a9fc5[_0xe72d('0x20')][_0xe72d('0x28')],_[_0xe72d('0x29')](_0x5a9fc5[_0xe72d('0x20')],['ids','id'])||{});}})[_0xe72d('0x2a')](function(_0xf1ddf1){logger[_0xe72d('0x14')](_0xe72d('0x2b'),_0x5a9fc5);logger[_0xe72d('0x17')](_0xe72d('0x2b'),_0x5a9fc5,JSON[_0xe72d('0x26')](_0xf1ddf1));_0x198ca0(_0xf1ddf1);})[_0xe72d('0x1d')](function(_0x406e5e){logger[_0xe72d('0x19')](_0xe72d('0x2b'),_0x406e5e[_0xe72d('0x1b')],_0x5a9fc5);_0xce00e5(_this[_0xe72d('0x19')](0x1f4,_0x406e5e[_0xe72d('0x1b')]));});});}; \ No newline at end of file +var _0xa4db=['redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','UpdateFaxInteraction','update','body','options','where','attributes','limit','then','debug','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x33a17b,_0x4e04ff){var _0x57e182=function(_0x5a62b7){while(--_0x5a62b7){_0x33a17b['push'](_0x33a17b['shift']());}};_0x57e182(++_0x4e04ff);}(_0xa4db,0x9b));var _0xba4d=function(_0x55bfbb,_0x3a8a07){_0x55bfbb=_0x55bfbb-0x0;var _0x5ecbe0=_0xa4db[_0x55bfbb];return _0x5ecbe0;};'use strict';var _=require('lodash');var util=require(_0xba4d('0x0'));var moment=require(_0xba4d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba4d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xba4d('0x3'));var logger=require('../../config/logger')(_0xba4d('0x4'));var config=require(_0xba4d('0x5'));var jayson=require(_0xba4d('0x6'));var client=jayson[_0xba4d('0x7')][_0xba4d('0x8')]({'port':0x232a});config[_0xba4d('0x9')]=_['defaults'](config[_0xba4d('0x9')],{'host':_0xba4d('0xa'),'port':0x18eb});var socket=require(_0xba4d('0xb'))(new Redis(config[_0xba4d('0x9')]));require(_0xba4d('0xc'))[_0xba4d('0xd')](socket);function respondWithRpcPromise(_0x341ec9,_0x63fde9,_0xae223d){return new BPromise(function(_0x55de1b,_0x47a7fb){return client[_0xba4d('0xe')](_0x341ec9,_0xae223d)['then'](function(_0x2ffa8a){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x63fde9,_0xba4d('0xf'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x63fde9,_0xba4d('0xf'),JSON[_0xba4d('0x10')](_0x2ffa8a));if(_0x2ffa8a['error']){if(_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x12')]===0x1f4){logger[_0xba4d('0x11')](_0xba4d('0x13'),_0x63fde9,_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);return _0x47a7fb(_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x63fde9,_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);return _0x55de1b(_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);}else{logger[_0xba4d('0x15')](_0xba4d('0x13'),_0x63fde9,'request\x20sent');_0x55de1b(_0x2ffa8a[_0xba4d('0x16')][_0xba4d('0x14')]);}})['catch'](function(_0x22b9c4){logger[_0xba4d('0x11')](_0xba4d('0x13'),_0x63fde9,_0x22b9c4);_0x47a7fb(_0x22b9c4);});});}exports[_0xba4d('0x17')]=function(_0x1fa775){var _0x24cd7c=this;return new Promise(function(_0x34b39c,_0x26475d){return db['FaxInteraction'][_0xba4d('0x18')](_0x1fa775[_0xba4d('0x19')],{'raw':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775[_0xba4d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775[_0xba4d('0x1a')][_0xba4d('0x1b')]||null:null,'attributes':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775['options'][_0xba4d('0x1c')]||null:null,'limit':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775[_0xba4d('0x1a')][_0xba4d('0x1d')]||null:null})[_0xba4d('0x1e')](function(_0x18bd8f){logger['info'](_0xba4d('0x17'),_0x1fa775);logger[_0xba4d('0x1f')](_0xba4d('0x17'),_0x1fa775,JSON[_0xba4d('0x10')](_0x18bd8f));_0x34b39c(_0x18bd8f);})[_0xba4d('0x20')](function(_0x479c3a){logger[_0xba4d('0x11')](_0xba4d('0x17'),_0x479c3a[_0xba4d('0x14')],_0x1fa775);_0x26475d(_0x24cd7c[_0xba4d('0x11')](0x1f4,_0x479c3a[_0xba4d('0x14')]));});});};exports[_0xba4d('0x21')]=function(_0x3511a3){return new Promise(function(_0x4ac1f7,_0x213abe){return db[_0xba4d('0x22')][_0xba4d('0x23')]({'where':_0x3511a3[_0xba4d('0x1a')]?_0x3511a3[_0xba4d('0x1a')][_0xba4d('0x1b')]||null:null})[_0xba4d('0x1e')](function(_0x3870b1){if(_0x3870b1){return _0x3870b1[_0xba4d('0x24')](_0x3511a3[_0xba4d('0x19')][_0xba4d('0x25')],_[_0xba4d('0x26')](_0x3511a3[_0xba4d('0x19')],[_0xba4d('0x25'),'id'])||{});}})[_0xba4d('0x27')](function(_0x59afa6){logger[_0xba4d('0x15')](_0xba4d('0x28'),_0x3511a3);logger[_0xba4d('0x1f')](_0xba4d('0x28'),_0x3511a3,JSON[_0xba4d('0x10')](_0x59afa6));_0x4ac1f7(_0x59afa6);})['catch'](function(_0x6cd528){logger[_0xba4d('0x11')](_0xba4d('0x28'),_0x6cd528['message'],_0x3511a3);_0x213abe(_this[_0xba4d('0x11')](0x1f4,_0x6cd528[_0xba4d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2dd8668..1f4d233 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 _0x5bbf=['faxInteraction:','save','emit','length'];(function(_0x1195bd,_0x5b3ec3){var _0x402427=function(_0x58759d){while(--_0x58759d){_0x1195bd['push'](_0x1195bd['shift']());}};_0x402427(++_0x5b3ec3);}(_0x5bbf,0x105));var _0xf5bb=function(_0x28b163,_0x329551){_0x28b163=_0x28b163-0x0;var _0x8736ed=_0x5bbf[_0x28b163];return _0x8736ed;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xf5bb('0x0'),'remove','update'];function createListener(_0x2f2f5b,_0x5e2468){return function(_0x444fa5){_0x5e2468[_0xf5bb('0x1')](_0x2f2f5b,_0x444fa5);};}function removeListener(_0x495589,_0x6cf95e){return function(){FaxInteractionEvents['removeListener'](_0x495589,_0x6cf95e);};}exports['register']=function(_0x57a58e){for(var _0x645368=0x0,_0x2a6c48=events[_0xf5bb('0x2')];_0x645368<_0x2a6c48;_0x645368++){var _0x4c439e=events[_0x645368];var _0x40342c=createListener(_0xf5bb('0x3')+_0x4c439e,_0x57a58e);FaxInteractionEvents['on'](_0x4c439e,_0x40342c);}}; \ No newline at end of file +var _0xd3b5=['emit','removeListener','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x53a4b4,_0xc9d9d8){var _0x349bab=function(_0x2e28c8){while(--_0x2e28c8){_0x53a4b4['push'](_0x53a4b4['shift']());}};_0x349bab(++_0xc9d9d8);}(_0xd3b5,0x1ca));var _0x5d3b=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xd3b5[_0x597484];return _0x218e64;};'use strict';var FaxInteractionEvents=require(_0x5d3b('0x0'));var events=[_0x5d3b('0x1'),_0x5d3b('0x2'),_0x5d3b('0x3')];function createListener(_0x3133d2,_0x25b9f1){return function(_0x295641){_0x25b9f1[_0x5d3b('0x4')](_0x3133d2,_0x295641);};}function removeListener(_0x3e9ee5,_0x17c5d6){return function(){FaxInteractionEvents[_0x5d3b('0x5')](_0x3e9ee5,_0x17c5d6);};}exports['register']=function(_0x125bd8){for(var _0x55c069=0x0,_0x47a0ac=events['length'];_0x55c069<_0x47a0ac;_0x55c069++){var _0x5938d1=events[_0x55c069];var _0x39f148=createListener(_0x5d3b('0x6')+_0x5938d1,_0x125bd8);FaxInteractionEvents['on'](_0x5938d1,_0x39f148);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b3a26d7..4e251c6 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 _0x3a0c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','faxinteraction:destroy','destroy','exports','multer','util'];(function(_0x3b5c2d,_0x294ff0){var _0x2104f1=function(_0x180c07){while(--_0x180c07){_0x3b5c2d['push'](_0x3b5c2d['shift']());}};_0x2104f1(++_0x294ff0);}(_0x3a0c,0x1cc));var _0xc3a0=function(_0x1e80bc,_0x312fe8){_0x1e80bc=_0x1e80bc-0x0;var _0x4c02ba=_0x3a0c[_0x1e80bc];return _0x4c02ba;};'use strict';var multer=require(_0xc3a0('0x0'));var util=require(_0xc3a0('0x1'));var path=require(_0xc3a0('0x2'));var timeout=require(_0xc3a0('0x3'));var express=require(_0xc3a0('0x4'));var router=express[_0xc3a0('0x5')]();var fs_extra=require(_0xc3a0('0x6'));var auth=require(_0xc3a0('0x7'));var interaction=require(_0xc3a0('0x8'));var config=require('../../config/environment');var controller=require(_0xc3a0('0x9'));router[_0xc3a0('0xa')]('/',auth[_0xc3a0('0xb')](),controller[_0xc3a0('0xc')]);router[_0xc3a0('0xa')](_0xc3a0('0xd'),auth[_0xc3a0('0xb')](),controller[_0xc3a0('0xe')]);router[_0xc3a0('0xa')](_0xc3a0('0xf'),auth['isAuthenticated'](),controller[_0xc3a0('0x10')]);router['get'](_0xc3a0('0x11'),auth[_0xc3a0('0xb')](),controller[_0xc3a0('0x12')]);router[_0xc3a0('0xa')]('/:id/download',auth[_0xc3a0('0xb')](),controller[_0xc3a0('0x13')]);router[_0xc3a0('0x14')]('/',auth[_0xc3a0('0xb')](),controller[_0xc3a0('0x15')]);router[_0xc3a0('0x14')](_0xc3a0('0x11'),auth[_0xc3a0('0xb')](),controller[_0xc3a0('0x16')]);router[_0xc3a0('0x14')](_0xc3a0('0x17'),auth[_0xc3a0('0xb')](),interaction['tracked'](_0xc3a0('0x18'),_0xc3a0('0x19')),controller[_0xc3a0('0x1a')]);router[_0xc3a0('0x1b')]('/:id',auth[_0xc3a0('0xb')](),interaction[_0xc3a0('0x1c')](_0xc3a0('0x18'),_0xc3a0('0x1d')),controller['update']);router['delete'](_0xc3a0('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xc3a0('0x18'),_0xc3a0('0x1e')),controller[_0xc3a0('0x1f')]);router['delete'](_0xc3a0('0x17'),auth[_0xc3a0('0xb')](),controller['removeTags']);module[_0xc3a0('0x20')]=router; \ No newline at end of file +var _0x999b=['./faxInteraction.controller','isAuthenticated','index','get','show','/:id/messages','download','post','create','addMessage','tracked','addTags','put','/:id','fax','faxinteraction:update','faxinteraction:destroy','destroy','delete','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x525068,_0x2c7eef){var _0x21fbb1=function(_0x298a97){while(--_0x298a97){_0x525068['push'](_0x525068['shift']());}};_0x21fbb1(++_0x2c7eef);}(_0x999b,0xe4));var _0xb999=function(_0x305e97,_0x49872b){_0x305e97=_0x305e97-0x0;var _0x4e9428=_0x999b[_0x305e97];return _0x4e9428;};'use strict';var multer=require('multer');var util=require(_0xb999('0x0'));var path=require('path');var timeout=require(_0xb999('0x1'));var express=require(_0xb999('0x2'));var router=express[_0xb999('0x3')]();var fs_extra=require(_0xb999('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb999('0x5'));var controller=require(_0xb999('0x6'));router['get']('/',auth[_0xb999('0x7')](),controller[_0xb999('0x8')]);router[_0xb999('0x9')]('/describe',auth[_0xb999('0x7')](),controller['describe']);router[_0xb999('0x9')]('/:id',auth[_0xb999('0x7')](),controller[_0xb999('0xa')]);router[_0xb999('0x9')](_0xb999('0xb'),auth[_0xb999('0x7')](),controller['getMessages']);router[_0xb999('0x9')]('/:id/download',auth[_0xb999('0x7')](),controller[_0xb999('0xc')]);router[_0xb999('0xd')]('/',auth[_0xb999('0x7')](),controller[_0xb999('0xe')]);router[_0xb999('0xd')](_0xb999('0xb'),auth['isAuthenticated'](),controller[_0xb999('0xf')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xb999('0x10')]('fax','faxinteraction:addtags'),controller[_0xb999('0x11')]);router[_0xb999('0x12')](_0xb999('0x13'),auth['isAuthenticated'](),interaction[_0xb999('0x10')](_0xb999('0x14'),_0xb999('0x15')),controller['update']);router['delete']('/:id',auth[_0xb999('0x7')](),interaction[_0xb999('0x10')](_0xb999('0x14'),_0xb999('0x16')),controller[_0xb999('0x17')]);router[_0xb999('0x18')]('/:id/tags',auth[_0xb999('0x7')](),controller['removeTags']);module[_0xb999('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a62aadb..ef91c3c 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 _0xf2cb=['medium','ENUM','out','TEXT','exports'];(function(_0x3ef124,_0x1f34f9){var _0x8aa83b=function(_0x4329d1){while(--_0x4329d1){_0x3ef124['push'](_0x3ef124['shift']());}};_0x8aa83b(++_0x1f34f9);}(_0xf2cb,0x130));var _0xbf2c=function(_0x1ca2f6,_0x5b7630){_0x1ca2f6=_0x1ca2f6-0x0;var _0x42ca5c=_0xf2cb[_0x1ca2f6];return _0x42ca5c;};'use strict';var Sequelize=require('sequelize');module[_0xbf2c('0x0')]={'body':{'type':Sequelize['TEXT'](_0xbf2c('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbf2c('0x2')]('in','out'),'defaultValue':_0xbf2c('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbf2c('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe739=['DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xe739,0x105));var _0x9e73=function(_0x424695,_0x187393){_0x424695=_0x424695-0x0;var _0x1d696a=_0xe739[_0x424695];return _0x1d696a;};'use strict';var Sequelize=require(_0x9e73('0x0'));module['exports']={'body':{'type':Sequelize[_0x9e73('0x1')](_0x9e73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9e73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9e73('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e73('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index cf34605..001b9bc 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 _0x321e=['fax','read','readAt','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','attachments','join','basename','eml-format','zip-dir','request-promise','moment','util','path','sox','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/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','name','send','index','map','FaxMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','rows','params','include','find','update','body','describe'];(function(_0x3d165a,_0xff2ce5){var _0x266774=function(_0x1990f5){while(--_0x1990f5){_0x3d165a['push'](_0x3d165a['shift']());}};_0x266774(++_0xff2ce5);}(_0x321e,0xbb));var _0xe321=function(_0x507ac3,_0xac00d7){_0x507ac3=_0x507ac3-0x0;var _0x36b6fa=_0x321e[_0x507ac3];return _0x36b6fa;};'use strict';var emlformat=require(_0xe321('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe321('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe321('0x2'));var moment=require(_0xe321('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe321('0x4'));var path=require(_0xe321('0x5'));var sox=require(_0xe321('0x6'));var csv=require('to-csv');var ejs=require(_0xe321('0x7'));var fs=require('fs');var fs_extra=require(_0xe321('0x8'));var _=require(_0xe321('0x9'));var squel=require(_0xe321('0xa'));var crypto=require(_0xe321('0xb'));var jsforce=require(_0xe321('0xc'));var deskjs=require(_0xe321('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe321('0xe'));var Papa=require(_0xe321('0xf'));var Redis=require(_0xe321('0x10'));var authService=require(_0xe321('0x11'));var qs=require(_0xe321('0x12'));var as=require(_0xe321('0x13'));var hardwareService=require(_0xe321('0x14'));var logger=require(_0xe321('0x15'))(_0xe321('0x16'));var utils=require(_0xe321('0x17'));var config=require(_0xe321('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe321('0x19'))['db'];config[_0xe321('0x1a')]=_[_0xe321('0x1b')](config[_0xe321('0x1a')],{'host':_0xe321('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe321('0x1a')]));require(_0xe321('0x1d'))['register'](socket);var jayson=require(_0xe321('0x1e'));var client=jayson[_0xe321('0x1f')][_0xe321('0x20')]({'port':0x232c});var client9002=jayson[_0xe321('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5642cf,_0x4a72c4,_0x417a23,_0x10a647){return new BPromise(function(_0x5c5b12,_0x147b00){var _0x2f6547=_0x10a647||client;return _0x2f6547[_0xe321('0x21')](_0x5642cf,_0x417a23)[_0xe321('0x22')](function(_0x5a936c){logger[_0xe321('0x23')](_0xe321('0x24'),_0x4a72c4,_0xe321('0x25'));logger[_0xe321('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4a72c4,_0xe321('0x25'),JSON['stringify'](_0x5a936c));if(_0x5a936c[_0xe321('0x27')]){if(_0x5a936c[_0xe321('0x27')][_0xe321('0x28')]===0x1f4){logger['error'](_0xe321('0x24'),_0x4a72c4,_0x5a936c[_0xe321('0x27')][_0xe321('0x29')]);return _0x147b00(_0x5a936c[_0xe321('0x27')][_0xe321('0x29')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4a72c4,_0x5a936c[_0xe321('0x27')][_0xe321('0x29')]);return _0x5c5b12(_0x5a936c[_0xe321('0x27')][_0xe321('0x29')]);}else{logger[_0xe321('0x23')](_0xe321('0x24'),_0x4a72c4,_0xe321('0x25'));_0x5c5b12(_0x5a936c['result']['message']);}})[_0xe321('0x2a')](function(_0x216ee2){logger[_0xe321('0x27')](_0xe321('0x24'),_0x4a72c4,_0x216ee2);_0x147b00(_0x216ee2);});});}function respondWithStatusCode(_0x31e579,_0x1b2086){_0x1b2086=_0x1b2086||0xcc;return function(_0x12b9a1){if(_0x12b9a1){return _0x31e579['sendStatus'](_0x1b2086);}return _0x31e579[_0xe321('0x2b')](_0x1b2086)[_0xe321('0x2c')]();};}function respondWithResult(_0x32e7cb,_0x4543fb){_0x4543fb=_0x4543fb||0xc8;return function(_0x562bed){if(_0x562bed){return _0x32e7cb[_0xe321('0x2b')](_0x4543fb)[_0xe321('0x2d')](_0x562bed);}};}function respondWithFilteredResult(_0x22d04f,_0x53fb1c){return function(_0x5e4e80){if(_0x5e4e80){var _0x5fd379=typeof _0x53fb1c[_0xe321('0x2e')]===_0xe321('0x2f')&&typeof _0x53fb1c[_0xe321('0x30')]===_0xe321('0x2f');var _0x2d076f=_0x5e4e80[_0xe321('0x31')];var _0x3655d1=_0x5fd379?0x0:_0x53fb1c[_0xe321('0x2e')];var _0x7c5e25=_0x5fd379?_0x5e4e80['count']:_0x53fb1c[_0xe321('0x2e')]+_0x53fb1c[_0xe321('0x30')];var _0x15d28d;if(_0x7c5e25>=_0x2d076f){_0x7c5e25=_0x2d076f;_0x15d28d=0xc8;}else{_0x15d28d=0xce;}_0x22d04f[_0xe321('0x2b')](_0x15d28d);return _0x22d04f[_0xe321('0x32')](_0xe321('0x33'),_0x3655d1+'-'+_0x7c5e25+'/'+_0x2d076f)[_0xe321('0x2d')](_0x5e4e80);}return null;};}function patchUpdates(_0x39ef79){return function(_0x8725e5){try{jsonpatch[_0xe321('0x34')](_0x8725e5,_0x39ef79,!![]);}catch(_0x327704){return BPromise[_0xe321('0x35')](_0x327704);}return _0x8725e5[_0xe321('0x36')]();};}function saveUpdates(_0x1cf18d,_0x2759bb){return function(_0x4ff182){if(_0x4ff182){return _0x4ff182['update'](_0x1cf18d)['then'](function(_0x433a3d){return _0x433a3d;});}return null;};}function removeEntity(_0x4dfc99,_0x330c01){return function(_0x1228dc){if(_0x1228dc){return _0x1228dc[_0xe321('0x37')]()[_0xe321('0x22')](function(){_0x4dfc99[_0xe321('0x2b')](0xcc)[_0xe321('0x2c')]();});}};}function handleEntityNotFound(_0x8a9f7d,_0x344a6d){return function(_0x45bd4a){if(!_0x45bd4a){_0x8a9f7d['sendStatus'](0x194);}return _0x45bd4a;};}function handleError(_0x5351e6,_0x243ef2){_0x243ef2=_0x243ef2||0x1f4;return function(_0x3513df){logger[_0xe321('0x27')](_0x3513df['stack']);if(_0x3513df[_0xe321('0x38')]){delete _0x3513df[_0xe321('0x38')];}_0x5351e6[_0xe321('0x2b')](_0x243ef2)[_0xe321('0x39')](_0x3513df);};}exports[_0xe321('0x3a')]=function(_0x506a32,_0x3fb1e4){var _0x39d65a={},_0x5dca1a={},_0x2d879c={'count':0x0,'rows':[]};var _0x41e9fb=_[_0xe321('0x3b')](db[_0xe321('0x3c')][_0xe321('0x3d')],function(_0x32439e){return{'name':_0x32439e['fieldName'],'type':_0x32439e[_0xe321('0x3e')]['key']};});_0x5dca1a[_0xe321('0x3f')]=_[_0xe321('0x3b')](_0x41e9fb,_0xe321('0x38'));_0x5dca1a[_0xe321('0x40')]=_[_0xe321('0x41')](_0x506a32['query']);_0x5dca1a[_0xe321('0x42')]=_[_0xe321('0x43')](_0x5dca1a[_0xe321('0x3f')],_0x5dca1a['query']);_0x39d65a[_0xe321('0x44')]=_['intersection'](_0x5dca1a[_0xe321('0x3f')],qs[_0xe321('0x45')](_0x506a32['query']['fields']));_0x39d65a[_0xe321('0x44')]=_0x39d65a[_0xe321('0x44')][_0xe321('0x46')]?_0x39d65a[_0xe321('0x44')]:_0x5dca1a[_0xe321('0x3f')];if(!_0x506a32[_0xe321('0x40')][_0xe321('0x47')]('nolimit')){_0x39d65a['limit']=qs['limit'](_0x506a32[_0xe321('0x40')][_0xe321('0x30')]);_0x39d65a['offset']=qs[_0xe321('0x2e')](_0x506a32['query'][_0xe321('0x2e')]);}_0x39d65a['order']=qs[_0xe321('0x48')](_0x506a32[_0xe321('0x40')][_0xe321('0x48')]);_0x39d65a[_0xe321('0x49')]=qs[_0xe321('0x42')](_['pick'](_0x506a32['query'],_0x5dca1a[_0xe321('0x42')]),_0x41e9fb);if(_0x506a32[_0xe321('0x40')][_0xe321('0x4a')]){_0x39d65a[_0xe321('0x49')]=_[_0xe321('0x4b')](_0x39d65a[_0xe321('0x49')],{'$or':_[_0xe321('0x3b')](_0x41e9fb,function(_0x4e8dcc){if(_0x4e8dcc[_0xe321('0x3e')]!=='VIRTUAL'){var _0x307a7a={};_0x307a7a[_0x4e8dcc['name']]={'$like':'%'+_0x506a32['query'][_0xe321('0x4a')]+'%'};return _0x307a7a;}})});}_0x39d65a=_['merge']({},_0x39d65a,_0x506a32[_0xe321('0x4c')]);var _0x3be907={'where':_0x39d65a[_0xe321('0x49')]};return db[_0xe321('0x3c')]['count'](_0x3be907)[_0xe321('0x22')](function(_0x426982){_0x2d879c[_0xe321('0x31')]=_0x426982;if(_0x506a32[_0xe321('0x40')][_0xe321('0x4d')]){_0x39d65a['include']=[{'all':!![]}];}return db[_0xe321('0x3c')]['findAll'](_0x39d65a);})[_0xe321('0x22')](function(_0x4a8dc0){_0x2d879c[_0xe321('0x4e')]=_0x4a8dc0;return _0x2d879c;})['then'](respondWithFilteredResult(_0x3fb1e4,_0x39d65a))['catch'](handleError(_0x3fb1e4,null));};exports['show']=function(_0x103c27,_0x389360){var _0x17c84e={'raw':!![],'where':{'id':_0x103c27[_0xe321('0x4f')]['id']}},_0x33a19f={};_0x33a19f[_0xe321('0x3f')]=_[_0xe321('0x41')](db[_0xe321('0x3c')][_0xe321('0x3d')]);_0x33a19f[_0xe321('0x40')]=_[_0xe321('0x41')](_0x103c27['query']);_0x33a19f[_0xe321('0x42')]=_['intersection'](_0x33a19f[_0xe321('0x3f')],_0x33a19f[_0xe321('0x40')]);_0x17c84e[_0xe321('0x44')]=_[_0xe321('0x43')](_0x33a19f[_0xe321('0x3f')],qs[_0xe321('0x45')](_0x103c27[_0xe321('0x40')]['fields']));_0x17c84e[_0xe321('0x44')]=_0x17c84e[_0xe321('0x44')][_0xe321('0x46')]?_0x17c84e[_0xe321('0x44')]:_0x33a19f['model'];if(_0x103c27[_0xe321('0x40')][_0xe321('0x4d')]){_0x17c84e[_0xe321('0x50')]=[{'all':!![]}];}_0x17c84e=_[_0xe321('0x4b')]({},_0x17c84e,_0x103c27[_0xe321('0x4c')]);return db[_0xe321('0x3c')][_0xe321('0x51')](_0x17c84e)[_0xe321('0x22')](handleEntityNotFound(_0x389360,null))[_0xe321('0x22')](respondWithResult(_0x389360,null))[_0xe321('0x2a')](handleError(_0x389360,null));};exports[_0xe321('0x52')]=function(_0x229c7f,_0x17eb24){if(_0x229c7f[_0xe321('0x53')]['id']){delete _0x229c7f[_0xe321('0x53')]['id'];}return db['FaxMessage'][_0xe321('0x51')]({'where':{'id':_0x229c7f[_0xe321('0x4f')]['id']}})[_0xe321('0x22')](handleEntityNotFound(_0x17eb24,null))['then'](saveUpdates(_0x229c7f[_0xe321('0x53')],null))['then'](respondWithResult(_0x17eb24,null))[_0xe321('0x2a')](handleError(_0x17eb24,null));};exports[_0xe321('0x37')]=function(_0x28e43b,_0x3aaaa6){return db[_0xe321('0x3c')][_0xe321('0x51')]({'where':{'id':_0x28e43b[_0xe321('0x4f')]['id']}})[_0xe321('0x22')](handleEntityNotFound(_0x3aaaa6,null))[_0xe321('0x22')](removeEntity(_0x3aaaa6,null))['catch'](handleError(_0x3aaaa6,null));};exports[_0xe321('0x54')]=function(_0x590e50,_0x88a25d){return db['FaxMessage'][_0xe321('0x54')]()[_0xe321('0x22')](respondWithResult(_0x88a25d,null))[_0xe321('0x2a')](handleError(_0x88a25d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x12d0d4,_0xafdc0e,_0x3996c5){var _0x15aedb={'agent':{},'channel':_0xe321('0x55')};if(_0x12d0d4['body']['id']){delete _0x12d0d4['body']['id'];}_0x12d0d4[_0xe321('0x53')][_0xe321('0x56')]=!![];_0x12d0d4['body'][_0xe321('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x12d0d4['body'][_0xe321('0x58')]=_0x12d0d4[_0xe321('0x53')]['UserId']||_0x12d0d4['user']['id'];_0x15aedb[_0xe321('0x59')]['id']=_0x12d0d4[_0xe321('0x53')][_0xe321('0x58')];return db[_0xe321('0x3c')][_0xe321('0x51')]({'where':{'id':_0x12d0d4['params']['id'],'UserId':null}})[_0xe321('0x22')](handleEntityNotFound(_0xafdc0e,null))['then'](saveUpdates(_0x12d0d4[_0xe321('0x53')],null))[_0xe321('0x22')](function(_0x5632e4){if(_0x5632e4){_0x15aedb[_0xe321('0x29')]=_0x5632e4[_0xe321('0x5a')]({'plain':!![]});return db[_0xe321('0x5b')][_0xe321('0x51')]({'where':{'id':_0x5632e4[_0xe321('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0xafdc0e,null))[_0xe321('0x22')](function(_0x1bb82c){if(_0x1bb82c){return _0x1bb82c[_0xe321('0x52')]({'UserId':_0x12d0d4[_0xe321('0x53')][_0xe321('0x58')],'read1stAt':_[_0xe321('0x5d')](_0x1bb82c[_0xe321('0x5e')])?moment()['format'](_0xe321('0x5f')):undefined});}return null;})[_0xe321('0x22')](function(_0x1483a5){if(_0x1483a5){_0x15aedb[_0xe321('0x60')]=_0x1483a5['get']({'plain':!![]});interaction_log[_0xe321('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12d0d4[_0xe321('0x61')]['id'],_0x12d0d4[_0xe321('0x61')]['name'],_0x12d0d4[_0xe321('0x61')][_0xe321('0x62')],_0x15aedb[_0xe321('0x60')]['id'],_0x12d0d4[_0xe321('0x53')]?JSON['stringify'](_0x12d0d4[_0xe321('0x53')]):_0xe321('0x63'));return respondWithRpcPromise(_0xe321('0x64'),_0xe321('0x65'),_0x15aedb);}return null;})[_0xe321('0x22')](function(_0x47e9c9){var _0x20aca5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47e9c9['message'][_0xe321('0x66')];return db[_0xe321('0x67')][_0xe321('0x40')](_0x20aca5,{'type':db[_0xe321('0x68')][_0xe321('0x69')][_0xe321('0x6a')],'raw':!![]})[_0xe321('0x22')](function(_0x54ca71){return _0x54ca71;});})[_0xe321('0x22')](function(_0xc41ef5){if(_0xc41ef5){_0x15aedb[_0xe321('0x29')][_0xe321('0x6b')]=_0xc41ef5[0x0];if(!_0x12d0d4[_0xe321('0x53')]['UserId'])return;return db[_0xe321('0x6c')][_0xe321('0x51')]({'where':{'id':_0x12d0d4[_0xe321('0x53')][_0xe321('0x58')],'role':_0xe321('0x59')},'attributes':['id',_0xe321('0x38'),_0xe321('0x6d'),_0xe321('0x6e'),_0xe321('0x6f')],'raw':!![]});}return null;})['then'](function(_0x193037){if(!_0x193037)return null;_0x15aedb['message'][_0xe321('0x59')]=_0x193037;return _0x15aedb;})[_0xe321('0x22')](function(_0x530a27){if(_0x530a27){if(_0x12d0d4[_0xe321('0x53')][_0xe321('0x70')]){_0x15aedb[_0xe321('0x29')][_0xe321('0x71')]=util[_0xe321('0x72')](_0xe321('0x73'),_0x12d0d4['user']['name']);_0x15aedb[_0xe321('0x29')][_0xe321('0x74')]=_0x15aedb[_0xe321('0x74')];_0x15aedb[_0xe321('0x29')][_0xe321('0x75')]=_0x15aedb[_0xe321('0x74')];_0x15aedb['message'][_0xe321('0x76')]='accept';return respondWithRpcPromise(_0xe321('0x77'),_0xe321('0x77'),{'event':'acceptmessage','message':_0x15aedb['message']},client9002)['then'](function(){return _0x15aedb;});}return _0x15aedb;}return null;})[_0xe321('0x22')](respondWithResult(_0xafdc0e,null))[_0xe321('0x2a')](handleError(_0xafdc0e,null));};var interaction_log=require(_0xe321('0x15'))('fax-interactions');exports['reject']=function(_0x1f65e5,_0x496d5c,_0x261e75){var _0x2bc678={'agent':{},'channel':'fax'};if(_0x1f65e5[_0xe321('0x53')]['id']){delete _0x1f65e5[_0xe321('0x53')]['id'];}_0x1f65e5[_0xe321('0x53')]['UserId']=_0x1f65e5[_0xe321('0x53')][_0xe321('0x58')]||_0x1f65e5[_0xe321('0x61')]['id'];_0x2bc678[_0xe321('0x59')]['id']=_0x1f65e5['body'][_0xe321('0x58')];return db[_0xe321('0x3c')][_0xe321('0x51')]({'where':{'id':_0x1f65e5[_0xe321('0x4f')]['id'],'UserId':null}})[_0xe321('0x22')](handleEntityNotFound(_0x496d5c,null))[_0xe321('0x22')](function(_0xa4cad5){if(_0xa4cad5){_0x2bc678[_0xe321('0x29')]=_0xa4cad5['get']({'plain':!![]});return db[_0xe321('0x5b')][_0xe321('0x51')]({'where':{'id':_0xa4cad5[_0xe321('0x5c')]}});}return null;})[_0xe321('0x22')](handleEntityNotFound(_0x496d5c,null))[_0xe321('0x22')](function(_0x3322f0){if(_0x3322f0){_0x2bc678[_0xe321('0x60')]=_0x3322f0['get']({'plain':!![]});interaction_log['info'](_0xe321('0x78'),_0x1f65e5['user']['id'],_0x1f65e5['user'][_0xe321('0x38')],_0x1f65e5[_0xe321('0x61')][_0xe321('0x62')],_0x2bc678[_0xe321('0x60')]['id'],_0x1f65e5[_0xe321('0x53')]?JSON[_0xe321('0x79')](_0x1f65e5[_0xe321('0x53')]):_0xe321('0x63'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2bc678);}return null;})['then'](function(_0x5ee10d){var _0x3b661b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ee10d[_0xe321('0x29')][_0xe321('0x66')];return db[_0xe321('0x67')]['query'](_0x3b661b,{'type':db[_0xe321('0x68')][_0xe321('0x69')][_0xe321('0x6a')],'raw':!![]})[_0xe321('0x22')](function(_0x1cc437){return _0x1cc437;});})['then'](function(_0x2c14c5){if(_0x2c14c5){_0x2bc678[_0xe321('0x29')]['contact']=_0x2c14c5[0x0];if(!_0x1f65e5['body'][_0xe321('0x58')])return;return db['User']['find']({'where':{'id':_0x1f65e5[_0xe321('0x53')][_0xe321('0x58')],'role':'agent'},'attributes':['id','name','fullname','email',_0xe321('0x6f')],'raw':!![]});}return null;})['then'](function(_0x1d07fa){if(!_0x1d07fa)return null;_0x2bc678[_0xe321('0x29')][_0xe321('0x59')]=_0x1d07fa;return _0x2bc678;})[_0xe321('0x22')](function(_0x29943b){if(_0x29943b){_0x29943b[_0xe321('0x29')][_0xe321('0x71')]=util[_0xe321('0x72')](_0xe321('0x73'),_0x1f65e5[_0xe321('0x61')][_0xe321('0x38')]);_0x29943b[_0xe321('0x29')][_0xe321('0x74')]=_0x2bc678['channel'];_0x29943b[_0xe321('0x29')][_0xe321('0x75')]=_0x2bc678[_0xe321('0x74')];_0x29943b['message'][_0xe321('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xe321('0x7a'),'message':_0x29943b[_0xe321('0x29')]},client9002);return _0x2bc678;}return null;})[_0xe321('0x22')](respondWithResult(_0x496d5c,null))[_0xe321('0x2a')](handleError(_0x496d5c,null));};exports[_0xe321('0x7b')]=function(_0x37d541,_0x174fe5){var _0x3f8ef8;return db[_0xe321('0x3c')][_0xe321('0x7b')](_0x37d541[_0xe321('0x53')],{})[_0xe321('0x22')](function(_0x2f4efc){_0x3f8ef8=_0x2f4efc;return db[_0xe321('0x7c')][_0xe321('0x7d')]({'where':{'id':_0x3f8ef8['ContactId']}});})[_0xe321('0x22')](function(_0x2f7e9a){if(_[_0xe321('0x5d')](_0x2f7e9a)){return;}else{_0x3f8ef8['fax']=_0x2f7e9a[_0xe321('0x55')];return db[_0xe321('0x7e')]['findOne']({'where':{'id':_0x3f8ef8['AttachmentId']}});}})['then'](function(_0x47c123){return respondWithRpcPromise(_0xe321('0x7f'),'SendFax',{'FaxAccountId':_[_0xe321('0x5d')](_0x37d541[_0xe321('0x53')])?undefined:_0x37d541[_0xe321('0x53')][_0xe321('0x80')],'path':_['isNil'](_0x47c123)?undefined:util[_0xe321('0x72')](_0xe321('0x81'),_0x47c123['basename']),'fax':_[_0xe321('0x5d')](_0x3f8ef8[_0xe321('0x55')])?undefined:_0x3f8ef8[_0xe321('0x55')],'AttachmentId':_0x3f8ef8['AttachmentId']},client9002);})['then'](respondWithResult(_0x174fe5,0xc9))['catch'](handleError(_0x174fe5,null));};exports[_0xe321('0x82')]=function(_0x3ccf8d,_0x297a49){var _0xaa5d6b=path['join'](config[_0xe321('0x83')],_0xe321('0x84'),'files',_0xe321('0x85'));return db[_0xe321('0x3c')]['find']({'where':{'id':_0x3ccf8d['params']['id']},'include':[{'model':db[_0xe321('0x7e')],'as':'Attachment'}]})[_0xe321('0x22')](handleEntityNotFound(_0x297a49,null))[_0xe321('0x22')](function(_0x39369c){if(_0x39369c){return _0x297a49[_0xe321('0x82')](path[_0xe321('0x86')](_0xaa5d6b,_0x39369c[_0xe321('0x7e')][_0xe321('0x87')]));}})['catch'](handleError(_0x297a49,null));}; \ No newline at end of file +var _0xd406=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','json','apply','reject','sendStatus','stack','name','send','index','fieldName','key','model','map','keys','filters','intersection','query','attributes','length','nolimit','order','where','pick','filter','type','VIRTUAL','merge','includeAll','FaxMessage','rows','show','rawAttributes','fields','options','update','body','find','params','destroy','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE: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','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','RejectMessage','rejectMessage','User','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x20ee39,_0x452829){var _0x154545=function(_0x1c3f56){while(--_0x1c3f56){_0x20ee39['push'](_0x20ee39['shift']());}};_0x154545(++_0x452829);}(_0xd406,0x10e));var _0x6d40=function(_0x2ce96d,_0x4e760a){_0x2ce96d=_0x2ce96d-0x0;var _0x502f2f=_0xd406[_0x2ce96d];return _0x502f2f;};'use strict';var emlformat=require(_0x6d40('0x0'));var rimraf=require(_0x6d40('0x1'));var zipdir=require(_0x6d40('0x2'));var jsonpatch=require(_0x6d40('0x3'));var rp=require(_0x6d40('0x4'));var moment=require(_0x6d40('0x5'));var BPromise=require(_0x6d40('0x6'));var Mustache=require(_0x6d40('0x7'));var util=require(_0x6d40('0x8'));var path=require(_0x6d40('0x9'));var sox=require(_0x6d40('0xa'));var csv=require(_0x6d40('0xb'));var ejs=require(_0x6d40('0xc'));var fs=require('fs');var fs_extra=require(_0x6d40('0xd'));var _=require(_0x6d40('0xe'));var squel=require(_0x6d40('0xf'));var crypto=require('crypto');var jsforce=require(_0x6d40('0x10'));var deskjs=require(_0x6d40('0x11'));var toCsv=require(_0x6d40('0xb'));var querystring=require(_0x6d40('0x12'));var Papa=require('papaparse');var Redis=require(_0x6d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6d40('0x14'));var as=require(_0x6d40('0x15'));var hardwareService=require(_0x6d40('0x16'));var logger=require('../../config/logger')(_0x6d40('0x17'));var utils=require('../../config/utils');var config=require(_0x6d40('0x18'));var licenseUtil=require(_0x6d40('0x19'));var db=require(_0x6d40('0x1a'))['db'];config[_0x6d40('0x1b')]=_[_0x6d40('0x1c')](config[_0x6d40('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d40('0x1d'))(new Redis(config[_0x6d40('0x1b')]));require(_0x6d40('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6d40('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x6d40('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe026a,_0x1fcc1d,_0x4790c6,_0x30865c){return new BPromise(function(_0x5f38c6,_0x12b5b3){var _0x25fc2c=_0x30865c||client;return _0x25fc2c[_0x6d40('0x20')](_0xe026a,_0x4790c6)[_0x6d40('0x21')](function(_0x134657){logger[_0x6d40('0x22')](_0x6d40('0x23'),_0x1fcc1d,_0x6d40('0x24'));logger['debug'](_0x6d40('0x25'),_0x1fcc1d,'request\x20sent',JSON[_0x6d40('0x26')](_0x134657));if(_0x134657[_0x6d40('0x27')]){if(_0x134657['error'][_0x6d40('0x28')]===0x1f4){logger[_0x6d40('0x27')]('FaxMessage,\x20%s,\x20%s',_0x1fcc1d,_0x134657[_0x6d40('0x27')]['message']);return _0x12b5b3(_0x134657[_0x6d40('0x27')]['message']);}logger['error'](_0x6d40('0x23'),_0x1fcc1d,_0x134657[_0x6d40('0x27')][_0x6d40('0x29')]);return _0x5f38c6(_0x134657[_0x6d40('0x27')]['message']);}else{logger['info'](_0x6d40('0x23'),_0x1fcc1d,_0x6d40('0x24'));_0x5f38c6(_0x134657[_0x6d40('0x2a')]['message']);}})[_0x6d40('0x2b')](function(_0x36f266){logger[_0x6d40('0x27')]('FaxMessage,\x20%s,\x20%s',_0x1fcc1d,_0x36f266);_0x12b5b3(_0x36f266);});});}function respondWithStatusCode(_0x9f269b,_0x1da94b){_0x1da94b=_0x1da94b||0xcc;return function(_0x5ea5dc){if(_0x5ea5dc){return _0x9f269b['sendStatus'](_0x1da94b);}return _0x9f269b[_0x6d40('0x2c')](_0x1da94b)[_0x6d40('0x2d')]();};}function respondWithResult(_0x43e056,_0xbd9698){_0xbd9698=_0xbd9698||0xc8;return function(_0x3c29d4){if(_0x3c29d4){return _0x43e056['status'](_0xbd9698)['json'](_0x3c29d4);}};}function respondWithFilteredResult(_0x28f999,_0xe8660e){return function(_0x10364c){if(_0x10364c){var _0x21035d=typeof _0xe8660e[_0x6d40('0x2e')]===_0x6d40('0x2f')&&typeof _0xe8660e['limit']===_0x6d40('0x2f');var _0x19f192=_0x10364c['count'];var _0x1dd490=_0x21035d?0x0:_0xe8660e['offset'];var _0x5f4e49=_0x21035d?_0x10364c[_0x6d40('0x30')]:_0xe8660e[_0x6d40('0x2e')]+_0xe8660e[_0x6d40('0x31')];var _0x1ff6ba;if(_0x5f4e49>=_0x19f192){_0x5f4e49=_0x19f192;_0x1ff6ba=0xc8;}else{_0x1ff6ba=0xce;}_0x28f999[_0x6d40('0x2c')](_0x1ff6ba);return _0x28f999[_0x6d40('0x32')]('Content-Range',_0x1dd490+'-'+_0x5f4e49+'/'+_0x19f192)[_0x6d40('0x33')](_0x10364c);}return null;};}function patchUpdates(_0x516fc3){return function(_0x5817e4){try{jsonpatch[_0x6d40('0x34')](_0x5817e4,_0x516fc3,!![]);}catch(_0x410a6c){return BPromise[_0x6d40('0x35')](_0x410a6c);}return _0x5817e4['save']();};}function saveUpdates(_0x4111b7,_0x5eed2f){return function(_0x1b7cd7){if(_0x1b7cd7){return _0x1b7cd7['update'](_0x4111b7)[_0x6d40('0x21')](function(_0x4347c4){return _0x4347c4;});}return null;};}function removeEntity(_0x458abf,_0x518bd5){return function(_0x525904){if(_0x525904){return _0x525904['destroy']()['then'](function(){_0x458abf[_0x6d40('0x2c')](0xcc)[_0x6d40('0x2d')]();});}};}function handleEntityNotFound(_0x1359a4,_0x3e7efe){return function(_0x55da76){if(!_0x55da76){_0x1359a4[_0x6d40('0x36')](0x194);}return _0x55da76;};}function handleError(_0x176f82,_0x38b8d4){_0x38b8d4=_0x38b8d4||0x1f4;return function(_0x5ea1d5){logger['error'](_0x5ea1d5[_0x6d40('0x37')]);if(_0x5ea1d5['name']){delete _0x5ea1d5[_0x6d40('0x38')];}_0x176f82[_0x6d40('0x2c')](_0x38b8d4)[_0x6d40('0x39')](_0x5ea1d5);};}exports[_0x6d40('0x3a')]=function(_0x227845,_0x53b13e){var _0x5787cd={},_0xd54213={},_0x101785={'count':0x0,'rows':[]};var _0xbc88a6=_['map'](db['FaxMessage']['rawAttributes'],function(_0x3e421b){return{'name':_0x3e421b[_0x6d40('0x3b')],'type':_0x3e421b['type'][_0x6d40('0x3c')]};});_0xd54213[_0x6d40('0x3d')]=_[_0x6d40('0x3e')](_0xbc88a6,_0x6d40('0x38'));_0xd54213['query']=_[_0x6d40('0x3f')](_0x227845['query']);_0xd54213[_0x6d40('0x40')]=_[_0x6d40('0x41')](_0xd54213[_0x6d40('0x3d')],_0xd54213[_0x6d40('0x42')]);_0x5787cd['attributes']=_[_0x6d40('0x41')](_0xd54213['model'],qs['fields'](_0x227845[_0x6d40('0x42')]['fields']));_0x5787cd[_0x6d40('0x43')]=_0x5787cd['attributes'][_0x6d40('0x44')]?_0x5787cd[_0x6d40('0x43')]:_0xd54213[_0x6d40('0x3d')];if(!_0x227845[_0x6d40('0x42')]['hasOwnProperty'](_0x6d40('0x45'))){_0x5787cd[_0x6d40('0x31')]=qs[_0x6d40('0x31')](_0x227845['query'][_0x6d40('0x31')]);_0x5787cd[_0x6d40('0x2e')]=qs[_0x6d40('0x2e')](_0x227845[_0x6d40('0x42')][_0x6d40('0x2e')]);}_0x5787cd[_0x6d40('0x46')]=qs['sort'](_0x227845[_0x6d40('0x42')]['sort']);_0x5787cd[_0x6d40('0x47')]=qs[_0x6d40('0x40')](_[_0x6d40('0x48')](_0x227845[_0x6d40('0x42')],_0xd54213[_0x6d40('0x40')]),_0xbc88a6);if(_0x227845['query'][_0x6d40('0x49')]){_0x5787cd[_0x6d40('0x47')]=_['merge'](_0x5787cd['where'],{'$or':_['map'](_0xbc88a6,function(_0x1954f7){if(_0x1954f7[_0x6d40('0x4a')]!==_0x6d40('0x4b')){var _0x52c7f0={};_0x52c7f0[_0x1954f7[_0x6d40('0x38')]]={'$like':'%'+_0x227845[_0x6d40('0x42')][_0x6d40('0x49')]+'%'};return _0x52c7f0;}})});}_0x5787cd=_[_0x6d40('0x4c')]({},_0x5787cd,_0x227845['options']);var _0x540dd0={'where':_0x5787cd[_0x6d40('0x47')]};return db['FaxMessage'][_0x6d40('0x30')](_0x540dd0)[_0x6d40('0x21')](function(_0x3b2e49){_0x101785[_0x6d40('0x30')]=_0x3b2e49;if(_0x227845[_0x6d40('0x42')][_0x6d40('0x4d')]){_0x5787cd['include']=[{'all':!![]}];}return db[_0x6d40('0x4e')]['findAll'](_0x5787cd);})['then'](function(_0x2d7c48){_0x101785[_0x6d40('0x4f')]=_0x2d7c48;return _0x101785;})[_0x6d40('0x21')](respondWithFilteredResult(_0x53b13e,_0x5787cd))[_0x6d40('0x2b')](handleError(_0x53b13e,null));};exports[_0x6d40('0x50')]=function(_0x27e886,_0x569966){var _0x52e34b={'raw':!![],'where':{'id':_0x27e886['params']['id']}},_0x8820ca={};_0x8820ca['model']=_[_0x6d40('0x3f')](db[_0x6d40('0x4e')][_0x6d40('0x51')]);_0x8820ca['query']=_[_0x6d40('0x3f')](_0x27e886[_0x6d40('0x42')]);_0x8820ca[_0x6d40('0x40')]=_[_0x6d40('0x41')](_0x8820ca[_0x6d40('0x3d')],_0x8820ca[_0x6d40('0x42')]);_0x52e34b['attributes']=_[_0x6d40('0x41')](_0x8820ca[_0x6d40('0x3d')],qs[_0x6d40('0x52')](_0x27e886[_0x6d40('0x42')][_0x6d40('0x52')]));_0x52e34b[_0x6d40('0x43')]=_0x52e34b[_0x6d40('0x43')][_0x6d40('0x44')]?_0x52e34b['attributes']:_0x8820ca[_0x6d40('0x3d')];if(_0x27e886[_0x6d40('0x42')][_0x6d40('0x4d')]){_0x52e34b['include']=[{'all':!![]}];}_0x52e34b=_[_0x6d40('0x4c')]({},_0x52e34b,_0x27e886[_0x6d40('0x53')]);return db[_0x6d40('0x4e')]['find'](_0x52e34b)[_0x6d40('0x21')](handleEntityNotFound(_0x569966,null))[_0x6d40('0x21')](respondWithResult(_0x569966,null))['catch'](handleError(_0x569966,null));};exports[_0x6d40('0x54')]=function(_0x146f8f,_0x496d17){if(_0x146f8f['body']['id']){delete _0x146f8f[_0x6d40('0x55')]['id'];}return db[_0x6d40('0x4e')][_0x6d40('0x56')]({'where':{'id':_0x146f8f[_0x6d40('0x57')]['id']}})[_0x6d40('0x21')](handleEntityNotFound(_0x496d17,null))[_0x6d40('0x21')](saveUpdates(_0x146f8f[_0x6d40('0x55')],null))[_0x6d40('0x21')](respondWithResult(_0x496d17,null))[_0x6d40('0x2b')](handleError(_0x496d17,null));};exports[_0x6d40('0x58')]=function(_0x1f342d,_0xeff2b9){return db['FaxMessage'][_0x6d40('0x56')]({'where':{'id':_0x1f342d['params']['id']}})[_0x6d40('0x21')](handleEntityNotFound(_0xeff2b9,null))[_0x6d40('0x21')](removeEntity(_0xeff2b9,null))['catch'](handleError(_0xeff2b9,null));};exports[_0x6d40('0x59')]=function(_0xb70fe8,_0x4e9af5){return db['FaxMessage'][_0x6d40('0x59')]()[_0x6d40('0x21')](respondWithResult(_0x4e9af5,null))['catch'](handleError(_0x4e9af5,null));};var interaction_log=require('../../config/logger')(_0x6d40('0x5a'));exports[_0x6d40('0x5b')]=function(_0x2b9c6c,_0x43194b,_0x7d73c1){var _0x3cb91e={'agent':{},'channel':_0x6d40('0x5c')};if(_0x2b9c6c[_0x6d40('0x55')]['id']){delete _0x2b9c6c['body']['id'];}_0x2b9c6c[_0x6d40('0x55')]['read']=!![];_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x5d')]=moment()[_0x6d40('0x5e')](_0x6d40('0x5f'));_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')]=_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')]||_0x2b9c6c[_0x6d40('0x61')]['id'];_0x3cb91e[_0x6d40('0x62')]['id']=_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')];return db['FaxMessage'][_0x6d40('0x56')]({'where':{'id':_0x2b9c6c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x43194b,null))['then'](saveUpdates(_0x2b9c6c[_0x6d40('0x55')],null))[_0x6d40('0x21')](function(_0x3bc866){if(_0x3bc866){_0x3cb91e[_0x6d40('0x29')]=_0x3bc866[_0x6d40('0x63')]({'plain':!![]});return db[_0x6d40('0x64')][_0x6d40('0x56')]({'where':{'id':_0x3bc866[_0x6d40('0x65')]}});}return null;})[_0x6d40('0x21')](handleEntityNotFound(_0x43194b,null))['then'](function(_0x344638){if(_0x344638){return _0x344638[_0x6d40('0x54')]({'UserId':_0x2b9c6c['body'][_0x6d40('0x60')],'read1stAt':_['isNil'](_0x344638[_0x6d40('0x66')])?moment()[_0x6d40('0x5e')](_0x6d40('0x5f')):undefined});}return null;})[_0x6d40('0x21')](function(_0x1280b1){if(_0x1280b1){_0x3cb91e[_0x6d40('0x67')]=_0x1280b1[_0x6d40('0x63')]({'plain':!![]});interaction_log[_0x6d40('0x22')](_0x6d40('0x68'),_0x2b9c6c[_0x6d40('0x61')]['id'],_0x2b9c6c[_0x6d40('0x61')][_0x6d40('0x38')],_0x2b9c6c[_0x6d40('0x61')][_0x6d40('0x69')],_0x3cb91e['interaction']['id'],_0x2b9c6c[_0x6d40('0x55')]?JSON['stringify'](_0x2b9c6c[_0x6d40('0x55')]):_0x6d40('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x6d40('0x6b'),_0x3cb91e);}return null;})[_0x6d40('0x21')](function(_0x32572d){var _0x326125=_0x6d40('0x6c')+_0x32572d[_0x6d40('0x29')][_0x6d40('0x6d')];return db['sequelize']['query'](_0x326125,{'type':db[_0x6d40('0x6e')][_0x6d40('0x6f')][_0x6d40('0x70')],'raw':!![]})[_0x6d40('0x21')](function(_0x25c866){return _0x25c866;});})[_0x6d40('0x21')](function(_0x2aa4a3){if(_0x2aa4a3){_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x71')]=_0x2aa4a3[0x0];if(!_0x2b9c6c[_0x6d40('0x55')]['UserId'])return;return db['User'][_0x6d40('0x56')]({'where':{'id':_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')],'role':_0x6d40('0x62')},'attributes':['id',_0x6d40('0x38'),_0x6d40('0x72'),_0x6d40('0x73'),_0x6d40('0x74')],'raw':!![]});}return null;})[_0x6d40('0x21')](function(_0x2f8edd){if(!_0x2f8edd)return null;_0x3cb91e[_0x6d40('0x29')]['agent']=_0x2f8edd;return _0x3cb91e;})[_0x6d40('0x21')](function(_0x3a657e){if(_0x3a657e){if(_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x75')]){_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x76')]=util[_0x6d40('0x5e')](_0x6d40('0x77'),_0x2b9c6c[_0x6d40('0x61')][_0x6d40('0x38')]);_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x78')]=_0x3cb91e[_0x6d40('0x78')];_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x79')]=_0x3cb91e['channel'];_0x3cb91e['message'][_0x6d40('0x7a')]=_0x6d40('0x5b');return respondWithRpcPromise('EventManager',_0x6d40('0x7b'),{'event':'acceptmessage','message':_0x3cb91e[_0x6d40('0x29')]},client9002)[_0x6d40('0x21')](function(){return _0x3cb91e;});}return _0x3cb91e;}return null;})[_0x6d40('0x21')](respondWithResult(_0x43194b,null))[_0x6d40('0x2b')](handleError(_0x43194b,null));};var interaction_log=require(_0x6d40('0x7c'))(_0x6d40('0x5a'));exports[_0x6d40('0x35')]=function(_0x17918c,_0x5b30e6,_0x18d9de){var _0x21c6b6={'agent':{},'channel':_0x6d40('0x5c')};if(_0x17918c['body']['id']){delete _0x17918c['body']['id'];}_0x17918c[_0x6d40('0x55')][_0x6d40('0x60')]=_0x17918c[_0x6d40('0x55')]['UserId']||_0x17918c[_0x6d40('0x61')]['id'];_0x21c6b6[_0x6d40('0x62')]['id']=_0x17918c[_0x6d40('0x55')][_0x6d40('0x60')];return db[_0x6d40('0x4e')][_0x6d40('0x56')]({'where':{'id':_0x17918c[_0x6d40('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b30e6,null))[_0x6d40('0x21')](function(_0x2a20bb){if(_0x2a20bb){_0x21c6b6['message']=_0x2a20bb[_0x6d40('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x6d40('0x56')]({'where':{'id':_0x2a20bb['FaxInteractionId']}});}return null;})[_0x6d40('0x21')](handleEntityNotFound(_0x5b30e6,null))['then'](function(_0x2def4d){if(_0x2def4d){_0x21c6b6[_0x6d40('0x67')]=_0x2def4d[_0x6d40('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17918c[_0x6d40('0x61')]['id'],_0x17918c[_0x6d40('0x61')][_0x6d40('0x38')],_0x17918c['user']['role'],_0x21c6b6[_0x6d40('0x67')]['id'],_0x17918c[_0x6d40('0x55')]?JSON[_0x6d40('0x26')](_0x17918c[_0x6d40('0x55')]):'null');return respondWithRpcPromise(_0x6d40('0x7d'),_0x6d40('0x7e'),_0x21c6b6);}return null;})[_0x6d40('0x21')](function(_0x92e9cd){var _0x420978='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x92e9cd[_0x6d40('0x29')][_0x6d40('0x6d')];return db['sequelize']['query'](_0x420978,{'type':db[_0x6d40('0x6e')][_0x6d40('0x6f')][_0x6d40('0x70')],'raw':!![]})['then'](function(_0x57ec86){return _0x57ec86;});})[_0x6d40('0x21')](function(_0x41d9ee){if(_0x41d9ee){_0x21c6b6['message'][_0x6d40('0x71')]=_0x41d9ee[0x0];if(!_0x17918c['body'][_0x6d40('0x60')])return;return db[_0x6d40('0x7f')][_0x6d40('0x56')]({'where':{'id':_0x17918c[_0x6d40('0x55')]['UserId'],'role':_0x6d40('0x62')},'attributes':['id','name',_0x6d40('0x72'),'email',_0x6d40('0x74')],'raw':!![]});}return null;})['then'](function(_0x1a0b2a){if(!_0x1a0b2a)return null;_0x21c6b6[_0x6d40('0x29')]['agent']=_0x1a0b2a;return _0x21c6b6;})[_0x6d40('0x21')](function(_0x27ef11){if(_0x27ef11){_0x27ef11[_0x6d40('0x29')][_0x6d40('0x76')]=util[_0x6d40('0x5e')](_0x6d40('0x77'),_0x17918c['user'][_0x6d40('0x38')]);_0x27ef11[_0x6d40('0x29')][_0x6d40('0x78')]=_0x21c6b6[_0x6d40('0x78')];_0x27ef11[_0x6d40('0x29')][_0x6d40('0x79')]=_0x21c6b6[_0x6d40('0x78')];_0x27ef11[_0x6d40('0x29')][_0x6d40('0x7a')]='reject';respondWithRpcPromise(_0x6d40('0x7b'),_0x6d40('0x7b'),{'event':_0x6d40('0x80'),'message':_0x27ef11[_0x6d40('0x29')]},client9002);return _0x21c6b6;}return null;})[_0x6d40('0x21')](respondWithResult(_0x5b30e6,null))[_0x6d40('0x2b')](handleError(_0x5b30e6,null));};exports[_0x6d40('0x81')]=function(_0x40f5b4,_0x5856b2){var _0x4a905c;return db[_0x6d40('0x4e')]['create'](_0x40f5b4[_0x6d40('0x55')],{})[_0x6d40('0x21')](function(_0x29e615){_0x4a905c=_0x29e615;return db[_0x6d40('0x82')][_0x6d40('0x83')]({'where':{'id':_0x4a905c[_0x6d40('0x6d')]}});})[_0x6d40('0x21')](function(_0x520ab5){if(_[_0x6d40('0x84')](_0x520ab5)){return;}else{_0x4a905c[_0x6d40('0x5c')]=_0x520ab5[_0x6d40('0x5c')];return db[_0x6d40('0x85')][_0x6d40('0x83')]({'where':{'id':_0x4a905c[_0x6d40('0x86')]}});}})[_0x6d40('0x21')](function(_0x3a64e6){return respondWithRpcPromise(_0x6d40('0x87'),'SendFax',{'FaxAccountId':_[_0x6d40('0x84')](_0x40f5b4['body'])?undefined:_0x40f5b4[_0x6d40('0x55')][_0x6d40('0x88')],'path':_[_0x6d40('0x84')](_0x3a64e6)?undefined:util[_0x6d40('0x5e')](_0x6d40('0x89'),_0x3a64e6[_0x6d40('0x8a')]),'fax':_[_0x6d40('0x84')](_0x4a905c['fax'])?undefined:_0x4a905c['fax'],'AttachmentId':_0x4a905c[_0x6d40('0x86')]},client9002);})['then'](respondWithResult(_0x5856b2,0xc9))['catch'](handleError(_0x5856b2,null));};exports[_0x6d40('0x8b')]=function(_0x202e90,_0x4b9c11){var _0x278ce1=path[_0x6d40('0x8c')](config['root'],'server','files','attachments');return db[_0x6d40('0x4e')][_0x6d40('0x56')]({'where':{'id':_0x202e90['params']['id']},'include':[{'model':db[_0x6d40('0x85')],'as':_0x6d40('0x85')}]})[_0x6d40('0x21')](handleEntityNotFound(_0x4b9c11,null))[_0x6d40('0x21')](function(_0x5af4ab){if(_0x5af4ab){return _0x4b9c11[_0x6d40('0x8b')](path[_0x6d40('0x8c')](_0x278ce1,_0x5af4ab[_0x6d40('0x85')][_0x6d40('0x8a')]));}})[_0x6d40('0x2b')](handleError(_0x4b9c11,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 48f3cb8..87d98eb 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xadb5,0xad));var _0x5adb=function(_0x54476a,_0x12f9c1){_0x54476a=_0x54476a-0x0;var _0x5bae23=_0xadb5[_0x54476a];return _0x5bae23;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x5adb('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){FaxMessageEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);FaxMessageEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];FaxMessage[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x3f35=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x3f35[_0x1e3c16];return _0x47a0c9;};'use strict';var EventEmitter=require(_0x53f3('0x0'));var FaxMessage=require(_0x53f3('0x1'))['db'][_0x53f3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x53f3('0x3')](0x0);var events={'afterCreate':_0x53f3('0x4'),'afterUpdate':_0x53f3('0x5'),'afterDestroy':_0x53f3('0x6')};function emitEvent(_0x58c9c6){return function(_0x118090,_0x5e8cc8,_0xc0bfc9){FaxMessageEvents['emit'](_0x58c9c6+':'+_0x118090['id'],_0x118090);FaxMessageEvents[_0x53f3('0x7')](_0x58c9c6,_0x118090);_0xc0bfc9(null);};}for(var e in events){if(events[_0x53f3('0x8')](e)){var event=events[e];FaxMessage[_0x53f3('0x9')](e,emitEvent(event));}}module[_0x53f3('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 62f3235..5262b89 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 _0x9761=['api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9761,0x1de));var _0x1976=function(_0x57a724,_0x5988a2){_0x57a724=_0x57a724-0x0;var _0x50c617=_0x9761[_0x57a724];return _0x50c617;};'use strict';var _=require(_0x1976('0x0'));var util=require('util');var logger=require(_0x1976('0x1'))(_0x1976('0x2'));var moment=require(_0x1976('0x3'));var BPromise=require('bluebird');var rp=require(_0x1976('0x4'));var fs=require('fs');var path=require(_0x1976('0x5'));var rimraf=require(_0x1976('0x6'));var config=require(_0x1976('0x7'));var attributes=require(_0x1976('0x8'));module[_0x1976('0x9')]=function(_0x2706ff,_0x2b5b3f){return _0x2706ff['define'](_0x1976('0xa'),attributes,{'tableName':_0x1976('0xb'),'paranoid':![],'indexes':[{'name':_0x1976('0xc'),'fields':[_0x1976('0xd')],'type':_0x1976('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c557c,_0xe8a93f,_0x5298dc){var _0x3b0aea=_0x2706ff['models'];var _0x2e61d7=_0x3c557c['get']({'plain':!![]});if(_0x2e61d7['direction'][_0x1976('0xf')]()==='in'||_0x2e61d7[_0x1976('0x10')][_0x1976('0xf')]()===_0x1976('0x11')&&!_0x2e61d7[_0x1976('0x12')]&&!_[_0x1976('0x13')](_0x2e61d7[_0x1976('0x14')])){_0x3b0aea[_0x1976('0x15')][_0x1976('0x16')]({'where':{'id':_0x2e61d7[_0x1976('0x17')]}})[_0x1976('0x18')](function(_0x3ec069){if(_0x3ec069){_0x3ec069[_0x1976('0x19')]({'lastMsgAt':_0x2e61d7['createdAt'],'lastMsgDirection':_0x2e61d7[_0x1976('0x10')]['toLowerCase']()});}})[_0x1976('0x1a')](function(_0x3bf211){console[_0x1976('0x1b')](_0x3bf211);});}_0x5298dc();}},'charset':_0x1976('0x1c'),'collate':_0x1976('0x1d')});}; \ No newline at end of file +var _0xa8cd=['out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x254f9d,_0x2a00c0){var _0x436dd3=function(_0x538a40){while(--_0x538a40){_0x254f9d['push'](_0x254f9d['shift']());}};_0x436dd3(++_0x2a00c0);}(_0xa8cd,0x142));var _0xda8c=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xa8cd[_0x2e58c7];return _0x26eb00;};'use strict';var _=require(_0xda8c('0x0'));var util=require(_0xda8c('0x1'));var logger=require(_0xda8c('0x2'))(_0xda8c('0x3'));var moment=require(_0xda8c('0x4'));var BPromise=require(_0xda8c('0x5'));var rp=require(_0xda8c('0x6'));var fs=require('fs');var path=require(_0xda8c('0x7'));var rimraf=require('rimraf');var config=require(_0xda8c('0x8'));var attributes=require(_0xda8c('0x9'));module[_0xda8c('0xa')]=function(_0x1c8693,_0x8f3fdb){return _0x1c8693[_0xda8c('0xb')](_0xda8c('0xc'),attributes,{'tableName':_0xda8c('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xda8c('0xe')],'type':_0xda8c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e611f,_0x2521a5,_0x383972){var _0x10a2ab=_0x1c8693['models'];var _0x42d410=_0x2e611f[_0xda8c('0x10')]({'plain':!![]});if(_0x42d410[_0xda8c('0x11')][_0xda8c('0x12')]()==='in'||_0x42d410[_0xda8c('0x11')][_0xda8c('0x12')]()===_0xda8c('0x13')&&!_0x42d410[_0xda8c('0x14')]&&!_['isNil'](_0x42d410[_0xda8c('0x15')])){_0x10a2ab[_0xda8c('0x16')][_0xda8c('0x17')]({'where':{'id':_0x42d410[_0xda8c('0x18')]}})[_0xda8c('0x19')](function(_0x388621){if(_0x388621){_0x388621[_0xda8c('0x1a')]({'lastMsgAt':_0x42d410[_0xda8c('0x1b')],'lastMsgDirection':_0x42d410[_0xda8c('0x11')][_0xda8c('0x12')]()});}})['catch'](function(_0x57d3e6){console[_0xda8c('0x1c')](_0x57d3e6);});}_0x383972();}},'charset':_0xda8c('0x1d'),'collate':_0xda8c('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e243cf6..e05556d 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 _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x98a8,0x12c));var _0x898a=function(_0x4bd37f,_0xf46b21){_0x4bd37f=_0x4bd37f-0x0;var _0x43a8ef=_0x98a8[_0x4bd37f];return _0x43a8ef;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file +var _0xa41a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','body','options','raw','then','FaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','bluebird','randomstring'];(function(_0x43dab2,_0x58a482){var _0x4c97e3=function(_0x3373d2){while(--_0x3373d2){_0x43dab2['push'](_0x43dab2['shift']());}};_0x4c97e3(++_0x58a482);}(_0xa41a,0x6b));var _0xaa41=function(_0x3f0b7e,_0x25c5a6){_0x3f0b7e=_0x3f0b7e-0x0;var _0x2bb8f3=_0xa41a[_0x3f0b7e];return _0x2bb8f3;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x1cc344,_0x4263d6,_0x38d930){return new BPromise(function(_0x806f08,_0x423a19){return client[_0xaa41('0x10')](_0x1cc344,_0x38d930)['then'](function(_0x1d3aac){logger[_0xaa41('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4263d6,'request\x20sent');logger[_0xaa41('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4263d6,_0xaa41('0x13'),JSON[_0xaa41('0x14')](_0x1d3aac));if(_0x1d3aac[_0xaa41('0x15')]){if(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x16')]===0x1f4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);return _0x423a19(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}logger[_0xaa41('0x15')](_0xaa41('0x17'),_0x4263d6,_0x1d3aac['error'][_0xaa41('0x18')]);return _0x806f08(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}else{logger[_0xaa41('0x11')](_0xaa41('0x17'),_0x4263d6,_0xaa41('0x13'));_0x806f08(_0x1d3aac[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x4fe1a4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x4fe1a4);_0x423a19(_0x4fe1a4);});});}exports[_0xaa41('0x1b')]=function(_0x35c753){var _0x54c488=this;return new Promise(function(_0x2bf794,_0x1f692b){return db['FaxMessage']['create'](_0x35c753[_0xaa41('0x1c')],{'raw':_0x35c753['options']?_0x35c753[_0xaa41('0x1d')][_0xaa41('0x1e')]===undefined?!![]:![]:!![]})[_0xaa41('0x1f')](function(_0x1f27f3){logger[_0xaa41('0x11')]('CreateFaxMessage',_0x35c753);logger[_0xaa41('0x12')](_0xaa41('0x1b'),_0x35c753,JSON[_0xaa41('0x14')](_0x1f27f3));_0x2bf794(_0x1f27f3);})[_0xaa41('0x1a')](function(_0x274630){logger[_0xaa41('0x15')]('CreateFaxMessage',_0x274630['message'],_0x35c753);_0x1f692b(_0x54c488[_0xaa41('0x15')](0x1f4,_0x274630['message']));});});};exports['UpdateFaxMessage']=function(_0x12e362){var _0x59707f=this;return new Promise(function(_0x536bed,_0x2d0ac0){return db[_0xaa41('0x20')][_0xaa41('0x21')](_0x12e362[_0xaa41('0x1c')],{'raw':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x22')]||null:null,'attributes':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x23')]||null:null,'limit':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['limit']||null:null})[_0xaa41('0x1f')](function(_0x48b48b){logger['info'](_0xaa41('0x24'),_0x12e362);logger[_0xaa41('0x12')]('UpdateFaxMessage',_0x12e362,JSON[_0xaa41('0x14')](_0x48b48b));_0x536bed(_0x48b48b);})[_0xaa41('0x1a')](function(_0x4e3b44){logger['error']('UpdateFaxMessage',_0x4e3b44[_0xaa41('0x18')],_0x12e362);_0x2d0ac0(_0x59707f[_0xaa41('0x15')](0x1f4,_0x4e3b44[_0xaa41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 1bb9776..fc0dc4f 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 _0x59ce=['emit','removeListener','register','update'];(function(_0xb94513,_0x3c8ba8){var _0x1cec1e=function(_0x3c16fa){while(--_0x3c16fa){_0xb94513['push'](_0xb94513['shift']());}};_0x1cec1e(++_0x3c8ba8);}(_0x59ce,0x7f));var _0xe59c=function(_0xe8dc24,_0xea55ed){_0xe8dc24=_0xe8dc24-0x0;var _0x4d8b0d=_0x59ce[_0xe8dc24];return _0x4d8b0d;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0xe59c('0x0')];function createListener(_0x470e35,_0x1e9d34){return function(_0x236907){_0x1e9d34[_0xe59c('0x1')](_0x470e35,_0x236907);};}function removeListener(_0x466245,_0x39d18b){return function(){FaxMessageEvents[_0xe59c('0x2')](_0x466245,_0x39d18b);};}exports[_0xe59c('0x3')]=function(_0x708c26){for(var _0x536847=0x0,_0x574156=events['length'];_0x536847<_0x574156;_0x536847++){var _0x516eac=events[_0x536847];var _0x593884=createListener('faxMessage:'+_0x516eac,_0x708c26);FaxMessageEvents['on'](_0x516eac,_0x593884);}}; \ No newline at end of file +var _0x0db0=['remove','emit','./faxMessage.events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0db0,0x16a));var _0x00db=function(_0x4d0f0e,_0x21b7e0){_0x4d0f0e=_0x4d0f0e-0x0;var _0x654fad=_0x0db0[_0x4d0f0e];return _0x654fad;};'use strict';var FaxMessageEvents=require(_0x00db('0x0'));var events=['save',_0x00db('0x1'),'update'];function createListener(_0x2068ae,_0x302342){return function(_0x17f27f){_0x302342[_0x00db('0x2')](_0x2068ae,_0x17f27f);};}function removeListener(_0x395e2b,_0x52d740){return function(){FaxMessageEvents['removeListener'](_0x395e2b,_0x52d740);};}exports['register']=function(_0x1553ef){for(var _0x57b979=0x0,_0x379e88=events['length'];_0x57b979<_0x379e88;_0x57b979++){var _0x173fdc=events[_0x57b979];var _0x556cc8=createListener('faxMessage:'+_0x173fdc,_0x1553ef);FaxMessageEvents['on'](_0x173fdc,_0x556cc8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 6d44c3b..ab4d2c3 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 _0xd87e=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','isAuthenticated','/describe','describe','get','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer'];(function(_0x19f255,_0xc5ae9a){var _0x90f882=function(_0x3c3854){while(--_0x3c3854){_0x19f255['push'](_0x19f255['shift']());}};_0x90f882(++_0xc5ae9a);}(_0xd87e,0x1bf));var _0xed87=function(_0x1e23b8,_0x4690f9){_0x1e23b8=_0x1e23b8-0x0;var _0x11f0f3=_0xd87e[_0x1e23b8];return _0x11f0f3;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);router[_0xed87('0xb')](_0xed87('0xd'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')]('/',auth['isAuthenticated'](),interaction[_0xed87('0x10')](_0xed87('0x11'),'faxmessage:create'),controller[_0xed87('0x12')]);router[_0xed87('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xed87('0x14')]);router[_0xed87('0x13')](_0xed87('0x15'),auth[_0xed87('0x8')](),controller[_0xed87('0x16')]);router[_0xed87('0x13')]('/:id/reject',auth[_0xed87('0x8')](),controller[_0xed87('0x17')]);router[_0xed87('0x18')](_0xed87('0x19'),auth[_0xed87('0x8')](),controller[_0xed87('0x1a')]);module[_0xed87('0x1b')]=router; \ No newline at end of file +var _0x44a3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','download','fax','create','put','update','/:id/accept','accept','reject','delete','exports'];(function(_0x3f5a64,_0x56027f){var _0x3725b3=function(_0x3f6e57){while(--_0x3f6e57){_0x3f5a64['push'](_0x3f5a64['shift']());}};_0x3725b3(++_0x56027f);}(_0x44a3,0x1a9));var _0x344a=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0x44a3[_0xb4788];return _0xd49d21;};'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']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/download',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),interaction['tracked'](_0x344a('0x10'),'faxmessage:create'),controller[_0x344a('0x11')]);router[_0x344a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x344a('0x13')]);router[_0x344a('0x12')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);router[_0x344a('0x12')]('/:id/reject',auth[_0x344a('0xb')](),controller[_0x344a('0x16')]);router[_0x344a('0x17')](_0x344a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x344a('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index cd5c5e0..e0b7e42 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 _0x6f7c=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x193126,_0x3cb2b8){var _0x39928f=function(_0x33d236){while(--_0x33d236){_0x193126['push'](_0x193126['shift']());}};_0x39928f(++_0x3cb2b8);}(_0x6f7c,0x137));var _0xc6f7=function(_0x19f4bd,_0x5671fa){_0x19f4bd=_0x19f4bd-0x0;var _0x3e7744=_0x6f7c[_0x19f4bd];return _0x3e7744;};'use strict';var Sequelize=require(_0xc6f7('0x0'));module[_0xc6f7('0x1')]={'name':{'type':Sequelize[_0xc6f7('0x2')],'unique':_0xc6f7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc6f7('0x2')]},'timeout':{'type':Sequelize[_0xc6f7('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc6f7('0x5')](_0xc6f7('0x6'),'beepall',_0xc6f7('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc6f7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe07e=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x12cf3e,_0x3c67b7){var _0x1bc889=function(_0x528118){while(--_0x528118){_0x12cf3e['push'](_0x12cf3e['shift']());}};_0x1bc889(++_0x3c67b7);}(_0xe07e,0xa3));var _0xee07=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0xe07e[_0x13524d];return _0x9918b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee07('0x0')],'unique':_0xee07('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee07('0x0')]},'timeout':{'type':Sequelize[_0xee07('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee07('0x3')](_0xee07('0x4'),'beepall',_0xee07('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xee07('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8d80db8..3cb8ab7 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 _0x304b=['sequelize','transaction','each','forEach','emit','removeTeams','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','nolimit','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','FaxQueues','UserProfileResource','error','index','map','rawAttributes','fieldName','type','where','FaxQueue','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','rows','format','%s/%s','SIP','createdAt','getTeams','Team','pick','addTeams','ids','Agents','voicePause','flatMap'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x304b,0xfb));var _0xb304=function(_0x5159d1,_0x634aba){_0x5159d1=_0x5159d1-0x0;var _0x455d41=_0x304b[_0x5159d1];return _0x455d41;};'use strict';var BPromise=require('bluebird');var util=require(_0xb304('0x0'));var _=require(_0xb304('0x1'));var squel=require(_0xb304('0x2'));var Redis=require(_0xb304('0x3'));var qs=require(_0xb304('0x4'));var logger=require(_0xb304('0x5'))(_0xb304('0x6'));var config=require(_0xb304('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb304('0x8')](config[_0xb304('0x9')],{'host':_0xb304('0xa'),'port':0x18eb});var socket=require(_0xb304('0xb'))(new Redis(config[_0xb304('0x9')]));require(_0xb304('0xc'))[_0xb304('0xd')](socket);function respondWithStatusCode(_0x329901,_0xf2591c){_0xf2591c=_0xf2591c||0xcc;return function(_0x5138c5){if(_0x5138c5){return _0x329901[_0xb304('0xe')](_0xf2591c);}return _0x329901[_0xb304('0xf')](_0xf2591c)[_0xb304('0x10')]();};}function respondWithResult(_0x5509d2,_0x45b5d9){_0x45b5d9=_0x45b5d9||0xc8;return function(_0x3d9841){if(_0x3d9841){return _0x5509d2[_0xb304('0xf')](_0x45b5d9)[_0xb304('0x11')](_0x3d9841);}};}function respondWithFilteredResult(_0x387851,_0x3077a5){return function(_0x4a2b56){if(_0x4a2b56){var _0x3024f1=typeof _0x3077a5[_0xb304('0x12')]===_0xb304('0x13')&&typeof _0x3077a5[_0xb304('0x14')]==='undefined';var _0x21153d=_0x4a2b56[_0xb304('0x15')];var _0x733030=_0x3024f1?0x0:_0x3077a5[_0xb304('0x12')];var _0x1ba608=_0x3024f1?_0x4a2b56[_0xb304('0x15')]:_0x3077a5[_0xb304('0x12')]+_0x3077a5[_0xb304('0x14')];var _0x218d92;if(_0x1ba608>=_0x21153d){_0x1ba608=_0x21153d;_0x218d92=0xc8;}else{_0x218d92=0xce;}_0x387851[_0xb304('0xf')](_0x218d92);return _0x387851[_0xb304('0x16')](_0xb304('0x17'),_0x733030+'-'+_0x1ba608+'/'+_0x21153d)[_0xb304('0x11')](_0x4a2b56);}return null;};}function saveUpdates(_0x5867c0){return function(_0xee0036){if(_0xee0036){return _0xee0036['update'](_0x5867c0)['then'](function(_0x79ca93){return _0x79ca93;});}return null;};}function removeEntity(_0x197bc7){return function(_0x45f368){if(_0x45f368){return _0x45f368[_0xb304('0x18')]()[_0xb304('0x19')](function(){var _0x57fe0e=_0x45f368[_0xb304('0x1a')]({'plain':!![]});var _0x5133e8=_0xb304('0x1b');return db[_0xb304('0x1c')]['destroy']({'where':{'type':_0x5133e8,'resourceId':_0x57fe0e['id']}})['then'](function(){return _0x45f368;});})['then'](function(){_0x197bc7[_0xb304('0xf')](0xcc)[_0xb304('0x10')]();});}};}function handleEntityNotFound(_0x193447){return function(_0x3eb360){if(!_0x3eb360){_0x193447['sendStatus'](0x194);}return _0x3eb360;};}function handleError(_0x218b9d,_0x3694c4){_0x3694c4=_0x3694c4||0x1f4;return function(_0x3f5226){logger[_0xb304('0x1d')](_0x3f5226['stack']);if(_0x3f5226['name']){delete _0x3f5226['name'];}_0x218b9d[_0xb304('0xf')](_0x3694c4)['send'](_0x3f5226);};}exports[_0xb304('0x1e')]=function(_0x5e2e5b,_0x19347f){var _0x148f48={};var _0x2b5271={'count':0x0,'rows':[]};var _0x4de541=_[_0xb304('0x1f')](db['FaxQueue'][_0xb304('0x20')],function(_0x4f46d2){return{'name':_0x4f46d2[_0xb304('0x21')],'type':_0x4f46d2[_0xb304('0x22')]['key']};});_0x148f48=qs['getOptions'](_0x4de541,_0x5e2e5b);var _0x368a0d={'where':_0x148f48[_0xb304('0x23')]};return db[_0xb304('0x24')][_0xb304('0x15')](_0x368a0d)[_0xb304('0x19')](function(_0x19ecc6){_0x2b5271[_0xb304('0x15')]=_0x19ecc6;_0x148f48[_0xb304('0x25')]=qs[_0xb304('0x25')](_0x5e2e5b[_0xb304('0x26')]);return db['FaxQueue'][_0xb304('0x27')](_0x148f48);})[_0xb304('0x19')](function(_0x530c78){_0x2b5271['rows']=_0x530c78;return _0x2b5271;})[_0xb304('0x19')](respondWithFilteredResult(_0x19347f,_0x148f48))[_0xb304('0x28')](handleError(_0x19347f,null));};exports[_0xb304('0x29')]=function(_0x4bb765,_0x2e61f6){var _0x32fecc={'raw':!![],'where':{'id':_0x4bb765[_0xb304('0x2a')]['id']}},_0x5c342b={};_0x5c342b[_0xb304('0x2b')]=_[_0xb304('0x2c')](db[_0xb304('0x24')][_0xb304('0x20')]);_0x5c342b['query']=_[_0xb304('0x2c')](_0x4bb765[_0xb304('0x26')]);_0x5c342b[_0xb304('0x2d')]=_[_0xb304('0x2e')](_0x5c342b[_0xb304('0x2b')],_0x5c342b[_0xb304('0x26')]);_0x32fecc[_0xb304('0x2f')]=_[_0xb304('0x2e')](_0x5c342b[_0xb304('0x2b')],qs[_0xb304('0x30')](_0x4bb765[_0xb304('0x26')][_0xb304('0x30')]));_0x32fecc[_0xb304('0x2f')]=_0x32fecc[_0xb304('0x2f')][_0xb304('0x31')]?_0x32fecc[_0xb304('0x2f')]:_0x5c342b[_0xb304('0x2b')];if(_0x4bb765[_0xb304('0x26')]['includeAll']){_0x32fecc[_0xb304('0x25')]=[{'all':!![]}];}_0x32fecc=_[_0xb304('0x32')]({},_0x32fecc,_0x4bb765['options']);return db[_0xb304('0x24')]['find'](_0x32fecc)[_0xb304('0x19')](handleEntityNotFound(_0x2e61f6,null))[_0xb304('0x19')](respondWithResult(_0x2e61f6,null))[_0xb304('0x28')](handleError(_0x2e61f6,null));};exports[_0xb304('0x33')]=function(_0x5b7024,_0x2757a9){return db['FaxQueue']['create'](_0x5b7024[_0xb304('0x34')],{})[_0xb304('0x19')](function(_0x1d6edd){var _0x510748=_0x5b7024['user'][_0xb304('0x1a')]({'plain':!![]});if(!_0x510748)throw new Error(_0xb304('0x35'));if(_0x510748[_0xb304('0x36')]===_0xb304('0x37')){var _0x13b691=_0x1d6edd[_0xb304('0x1a')]({'plain':!![]});var _0x4fe791=_0xb304('0x1b');return db[_0xb304('0x38')][_0xb304('0x39')]({'where':{'name':_0x4fe791,'userProfileId':_0x510748['userProfileId']},'raw':!![]})['then'](function(_0x49657c){if(_0x49657c&&_0x49657c['autoAssociation']===0x0){return db[_0xb304('0x1c')][_0xb304('0x33')]({'name':_0x13b691['name'],'resourceId':_0x13b691['id'],'type':_0x49657c[_0xb304('0x3a')],'sectionId':_0x49657c['id']},{})[_0xb304('0x19')](function(){return _0x1d6edd;});}else{return _0x1d6edd;}})[_0xb304('0x28')](function(_0xaf4872){logger[_0xb304('0x1d')](_0xb304('0x3b'),_0xaf4872);throw _0xaf4872;});}return _0x1d6edd;})[_0xb304('0x19')](respondWithResult(_0x2757a9,0xc9))[_0xb304('0x28')](handleError(_0x2757a9,null));};exports[_0xb304('0x3c')]=function(_0x8008a8,_0x364141){if(_0x8008a8[_0xb304('0x34')]['id']){delete _0x8008a8[_0xb304('0x34')]['id'];}return db['FaxQueue'][_0xb304('0x39')]({'where':{'id':_0x8008a8[_0xb304('0x2a')]['id']}})['then'](handleEntityNotFound(_0x364141,null))[_0xb304('0x19')](saveUpdates(_0x8008a8['body'],null))['then'](respondWithResult(_0x364141,null))[_0xb304('0x28')](handleError(_0x364141,null));};exports['destroy']=function(_0x1b75d5,_0x5d4e89){return db[_0xb304('0x24')][_0xb304('0x39')]({'where':{'id':_0x1b75d5[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](handleEntityNotFound(_0x5d4e89,null))['then'](removeEntity(_0x5d4e89,null))['catch'](handleError(_0x5d4e89,null));};exports[_0xb304('0x3d')]=function(_0x178b19,_0x4d6430){return db[_0xb304('0x24')]['describe']()[_0xb304('0x19')](respondWithResult(_0x4d6430,null))[_0xb304('0x28')](handleError(_0x4d6430,null));};exports[_0xb304('0x3e')]=function(_0x3b2f84,_0xeeb8b7){var _0x118e47={'raw':!![],'where':{}},_0x3c8ffd={},_0x4f50c3;return db['FaxQueue'][_0xb304('0x3f')]({'where':{'id':_0x3b2f84[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](handleEntityNotFound(_0xeeb8b7,null))[_0xb304('0x19')](function(_0x527a17){if(_0x527a17){_0x4f50c3=_0x527a17[_0xb304('0x1a')]({'plain':!![]});_0x3c8ffd[_0xb304('0x2b')]=_[_0xb304('0x2c')](db[_0xb304('0x40')][_0xb304('0x20')]);_0x3c8ffd[_0xb304('0x26')]=_[_0xb304('0x2c')](_0x3b2f84[_0xb304('0x26')]);_0x3c8ffd[_0xb304('0x2d')]=_[_0xb304('0x2e')](_0x3c8ffd[_0xb304('0x2b')],_0x3c8ffd[_0xb304('0x26')]);_0x118e47[_0xb304('0x2f')]=_[_0xb304('0x2e')](_0x3c8ffd[_0xb304('0x2b')],qs[_0xb304('0x30')](_0x3b2f84[_0xb304('0x26')][_0xb304('0x30')]));_0x118e47[_0xb304('0x2f')]=_0x118e47[_0xb304('0x2f')][_0xb304('0x31')]?_0x118e47[_0xb304('0x2f')]:_0x3c8ffd[_0xb304('0x2b')];if(!_0x3b2f84[_0xb304('0x26')][_0xb304('0x41')]('nolimit')){_0x118e47[_0xb304('0x14')]=qs['limit'](_0x3b2f84[_0xb304('0x26')][_0xb304('0x14')]);_0x118e47['offset']=qs['offset'](_0x3b2f84['query'][_0xb304('0x12')]);}_0x118e47[_0xb304('0x42')]=qs[_0xb304('0x43')](_0x3b2f84[_0xb304('0x26')]['sort']);_0x118e47[_0xb304('0x23')]=qs[_0xb304('0x2d')](_['pick'](_0x3b2f84[_0xb304('0x26')],_0x3c8ffd[_0xb304('0x2d')]));_0x118e47['where'][_0xb304('0x44')]=_0x527a17['id'];if(_0x3b2f84[_0xb304('0x26')][_0xb304('0x45')]){_0x118e47[_0xb304('0x23')]=_['merge'](_0x118e47[_0xb304('0x23')],{'$or':_[_0xb304('0x1f')](_0x118e47[_0xb304('0x2f')],function(_0x9a24f5){var _0x210c07={};_0x210c07[_0x9a24f5]={'$like':'%'+_0x3b2f84[_0xb304('0x26')][_0xb304('0x45')]+'%'};return _0x210c07;})});}_0x118e47=_[_0xb304('0x32')]({},_0x118e47,_0x3b2f84[_0xb304('0x46')]);return db[_0xb304('0x40')][_0xb304('0x27')](_0x118e47);}})['then'](function(_0x272493){if(_0x272493){return db[_0xb304('0x47')][_0xb304('0x48')]({'where':{'id':_[_0xb304('0x1f')](_0x272493,_0xb304('0x49')),'role':'agent'},'attributes':['id',_0xb304('0x3a'),_0xb304('0x4a'),'updatedAt','createdAt']});}})['then'](function(_0x4df2bf){if(_0x4df2bf){return{'count':_0x4df2bf[_0xb304('0x15')],'rows':_['map'](_0x4df2bf[_0xb304('0x4b')],function(_0x21daa0){return{'membername':_0x21daa0['name'],'UserId':_0x21daa0['id'],'queue_name':_0x4f50c3[_0xb304('0x3a')],'FaxQueueId':_0x4f50c3['id'],'interface':util[_0xb304('0x4c')](_0xb304('0x4d'),_0xb304('0x4e'),_0x21daa0[_0xb304('0x3a')]),'penalty':0x0,'paused':_0x21daa0[_0xb304('0x4a')],'createdAt':_0x21daa0[_0xb304('0x4f')],'updatedAt':_0x21daa0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb304('0x19')](respondWithFilteredResult(_0xeeb8b7,_0x118e47))[_0xb304('0x28')](handleError(_0xeeb8b7,null));};exports[_0xb304('0x50')]=function(_0x570000,_0x3132dc){var _0x10f24c={};var _0xcd7d41={};var _0x3e7da9;var _0x1d2283;return db[_0xb304('0x24')]['findOne']({'where':{'id':_0x570000[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](handleEntityNotFound(_0x3132dc,null))[_0xb304('0x19')](function(_0x5d1105){if(_0x5d1105){_0x3e7da9=_0x5d1105;_0xcd7d41['model']=_[_0xb304('0x2c')](db[_0xb304('0x51')][_0xb304('0x20')]);_0xcd7d41[_0xb304('0x26')]=_[_0xb304('0x2c')](_0x570000[_0xb304('0x26')]);_0xcd7d41[_0xb304('0x2d')]=_[_0xb304('0x2e')](_0xcd7d41[_0xb304('0x2b')],_0xcd7d41[_0xb304('0x26')]);_0x10f24c['attributes']=_[_0xb304('0x2e')](_0xcd7d41['model'],qs[_0xb304('0x30')](_0x570000[_0xb304('0x26')][_0xb304('0x30')]));_0x10f24c['attributes']=_0x10f24c[_0xb304('0x2f')][_0xb304('0x31')]?_0x10f24c[_0xb304('0x2f')]:_0xcd7d41[_0xb304('0x2b')];_0x10f24c[_0xb304('0x42')]=qs[_0xb304('0x43')](_0x570000[_0xb304('0x26')]['sort']);_0x10f24c[_0xb304('0x23')]=qs[_0xb304('0x2d')](_[_0xb304('0x52')](_0x570000['query'],_0xcd7d41[_0xb304('0x2d')]));if(_0x570000[_0xb304('0x26')][_0xb304('0x45')]){_0x10f24c[_0xb304('0x23')]=_[_0xb304('0x32')](_0x10f24c[_0xb304('0x23')],{'$or':_['map'](_0x10f24c['attributes'],function(_0x2782c9){var _0x490959={};_0x490959[_0x2782c9]={'$like':'%'+_0x570000[_0xb304('0x26')][_0xb304('0x45')]+'%'};return _0x490959;})});}_0x10f24c=_[_0xb304('0x32')]({},_0x10f24c,_0x570000[_0xb304('0x46')]);return _0x3e7da9[_0xb304('0x50')](_0x10f24c);}})[_0xb304('0x19')](function(_0x305f3a){if(_0x305f3a){_0x1d2283=_0x305f3a['length'];if(!_0x570000['query'][_0xb304('0x41')]('nolimit')){_0x10f24c['limit']=qs[_0xb304('0x14')](_0x570000[_0xb304('0x26')][_0xb304('0x14')]);_0x10f24c[_0xb304('0x12')]=qs[_0xb304('0x12')](_0x570000[_0xb304('0x26')]['offset']);}return _0x3e7da9['getTeams'](_0x10f24c);}})[_0xb304('0x19')](function(_0x117b4a){if(_0x117b4a){return _0x117b4a?{'count':_0x1d2283,'rows':_0x117b4a}:null;}})[_0xb304('0x19')](respondWithResult(_0x3132dc,null))['catch'](handleError(_0x3132dc,null));};exports[_0xb304('0x53')]=function(_0xc76eb,_0xce951b){var _0xea2085=_0xc76eb[_0xb304('0x34')][_0xb304('0x54')];return db[_0xb304('0x51')][_0xb304('0x27')]({'where':{'id':_0xea2085},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb304('0x55'),'attributes':['id',_0xb304('0x3a'),'online',_0xb304('0x56'),'interface'],'raw':!![]}]})[_0xb304('0x19')](function(_0x580c7c){if(_0x580c7c){var _0x1f0dac=_[_0xb304('0x57')](_0x580c7c,function(_0x368a3b){var _0x303836=_0x368a3b[_0xb304('0x1a')]({'plain':!![]});return _0x303836['Agents'];});return db[_0xb304('0x24')]['find']({'where':{'id':_0xc76eb[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](function(_0x392ffe){return db[_0xb304('0x58')][_0xb304('0x59')](function(_0x1be763){return _0x392ffe[_0xb304('0x53')](_0xea2085,{'transaction':_0x1be763})[_0xb304('0x19')](function(){return BPromise[_0xb304('0x5a')](_0x1f0dac,function(_0x4c0bbb){return db[_0xb304('0x40')]['findOrCreate']({'where':{'UserId':_0x4c0bbb['id'],'FaxQueueId':_0xc76eb['params']['id']},'transaction':_0x1be763});});})['then'](function(){_0x1f0dac[_0xb304('0x5b')](function(_0x3c9887){socket[_0xb304('0x5c')]('userFaxQueue:save',{'UserId':_0x3c9887['id'],'FaxQueueId':_0x392ffe['id']});});});});});}})['then'](respondWithStatusCode(_0xce951b,null))[_0xb304('0x28')](handleError(_0xce951b,null));};exports[_0xb304('0x5d')]=function(_0x8ca61b,_0x367729){return db[_0xb304('0x51')]['findAll']({'where':{'id':_0x8ca61b['query'][_0xb304('0x54')]},'attributes':['id'],'include':[{'model':db[_0xb304('0x47')],'as':_0xb304('0x55'),'attributes':['id'],'raw':!![]}]})[_0xb304('0x19')](handleEntityNotFound(_0x367729,null))[_0xb304('0x19')](function(_0x4a71f2){var _0x49dab9=_[_0xb304('0x1f')](_0x4a71f2,'id');var _0x18dfec=[];var _0x35bca4=[];var _0x1e08e8=squel['select']();_0x1e08e8['field']('tq.TeamId')[_0xb304('0x5e')]('team_has_fax_queues','tq')[_0xb304('0x5f')]('user_has_teams','ut',_0xb304('0x60'))[_0xb304('0x23')]('FaxQueueId\x20=\x20?',_0x8ca61b['params']['id']);for(var _0x2e35fc=0x0;_0x2e35fc<_0x4a71f2['length'];_0x2e35fc+=0x1){let _0x192aad=_0x4a71f2[_0x2e35fc];for(var _0x16c0a9=0x0;_0x16c0a9<_0x192aad[_0xb304('0x55')][_0xb304('0x31')];_0x16c0a9+=0x1){let _0x1484d9=_0x192aad[_0xb304('0x55')][_0x16c0a9];var _0x133450=_0x1e08e8[_0xb304('0x61')]();_0x133450[_0xb304('0x23')]('ut.UserId\x20=\x20?',_0x1484d9['id']);_0x35bca4['push'](db[_0xb304('0x58')]['query'](_0x133450['toString'](),{'type':db[_0xb304('0x58')][_0xb304('0x62')][_0xb304('0x63')]})['then'](function(_0x38882e){if(_0x38882e[_0xb304('0x31')]===0x1){return _0x1484d9['id'];}else{var _0x42ae=_['every'](_[_0xb304('0x1f')](_0x38882e,_0xb304('0x64')),function(_0xa7a709){return _['includes'](_0x49dab9,_0xa7a709);});if(_0x42ae){return _0x1484d9['id'];}}}));}}return BPromise[_0xb304('0x65')](_0x35bca4)[_0xb304('0x19')](function(_0x27b850){_0x18dfec=_(_0x18dfec)['union'](_0x27b850)[_0xb304('0x66')]()[_0xb304('0x67')]();return db[_0xb304('0x24')]['find']({'where':{'id':_0x8ca61b[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](function(_0x5167b8){return db['sequelize'][_0xb304('0x59')](function(_0x166dbc){return _0x5167b8['removeTeams'](_0x8ca61b[_0xb304('0x26')][_0xb304('0x54')],{'transaction':_0x166dbc})[_0xb304('0x19')](function(){if(!_[_0xb304('0x68')](_0x18dfec)){return _0x5167b8[_0xb304('0x69')](_0x18dfec,{'transaction':_0x166dbc});}})[_0xb304('0x19')](function(){_0x18dfec[_0xb304('0x5b')](function(_0x204b1d){socket[_0xb304('0x5c')](_0xb304('0x6a'),{'UserId':_0x204b1d,'FaxQueueId':_0x5167b8['id']});});});});});});})[_0xb304('0x19')](respondWithStatusCode(_0x367729,null))[_0xb304('0x28')](handleError(_0x367729,null));};exports['addAgents']=function(_0x25db78,_0x4dd1c3){return db[_0xb304('0x24')][_0xb304('0x39')]({'where':{'id':_0x25db78['params']['id']}})[_0xb304('0x19')](handleEntityNotFound(_0x4dd1c3,null))['then'](function(_0x1da1af){if(_0x1da1af){return _0x1da1af[_0xb304('0x6b')](_0x25db78['body']['ids'],_['omit'](_0x25db78[_0xb304('0x34')],[_0xb304('0x54'),'id'])||{})[_0xb304('0x6c')](function(_0x451f68){for(var _0x32aa31=0x0;_0x32aa31<_0x25db78[_0xb304('0x34')][_0xb304('0x54')][_0xb304('0x31')];_0x32aa31+=0x1){socket[_0xb304('0x5c')](_0xb304('0x6d'),{'UserId':Number(_0x25db78['body']['ids'][_0x32aa31]),'FaxQueueId':Number(_0x25db78['params']['id'])});}return _0x451f68;});}})[_0xb304('0x19')](respondWithResult(_0x4dd1c3,null))['catch'](handleError(_0x4dd1c3,null));};exports[_0xb304('0x69')]=function(_0x38b764,_0x3f663d){return db[_0xb304('0x24')]['find']({'where':{'id':_0x38b764[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](handleEntityNotFound(_0x3f663d,null))[_0xb304('0x19')](function(_0x4832c6){if(_0x4832c6){return _0x4832c6[_0xb304('0x69')](_0x38b764[_0xb304('0x26')][_0xb304('0x54')])[_0xb304('0x19')](function(){if(_[_0xb304('0x6e')](_0x38b764[_0xb304('0x26')][_0xb304('0x54')])){for(var _0x62e4d5=0x0;_0x62e4d5<_0x38b764[_0xb304('0x26')][_0xb304('0x54')][_0xb304('0x31')];_0x62e4d5+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x38b764[_0xb304('0x26')]['ids'][_0x62e4d5]),'FaxQueueId':Number(_0x38b764['params']['id'])});}}else{socket[_0xb304('0x5c')](_0xb304('0x6a'),{'UserId':Number(_0x38b764[_0xb304('0x26')]['ids']),'FaxQueueId':Number(_0x38b764[_0xb304('0x2a')]['id'])});}});}})[_0xb304('0x19')](respondWithStatusCode(_0x3f663d,null))[_0xb304('0x28')](handleError(_0x3f663d,null));};exports[_0xb304('0x6f')]=function(_0xaa1606,_0x45068c){var _0x244822={};var _0x30e32c={};var _0x3c5654;var _0x593520;return db[_0xb304('0x24')][_0xb304('0x3f')]({'where':{'id':_0xaa1606[_0xb304('0x2a')]['id']}})[_0xb304('0x19')](handleEntityNotFound(_0x45068c,null))[_0xb304('0x19')](function(_0x1aa590){if(_0x1aa590){_0x3c5654=_0x1aa590;_0x30e32c['model']=_[_0xb304('0x2c')](db[_0xb304('0x47')][_0xb304('0x20')]);_0x30e32c['query']=_[_0xb304('0x2c')](_0xaa1606[_0xb304('0x26')]);_0x30e32c[_0xb304('0x2d')]=_[_0xb304('0x2e')](_0x30e32c[_0xb304('0x2b')],_0x30e32c[_0xb304('0x26')]);_0x244822[_0xb304('0x2f')]=_[_0xb304('0x2e')](_0x30e32c[_0xb304('0x2b')],qs[_0xb304('0x30')](_0xaa1606[_0xb304('0x26')]['fields']));_0x244822['attributes']=_0x244822[_0xb304('0x2f')][_0xb304('0x31')]?_0x244822[_0xb304('0x2f')]:_0x30e32c[_0xb304('0x2b')];_0x244822[_0xb304('0x42')]=qs[_0xb304('0x43')](_0xaa1606[_0xb304('0x26')][_0xb304('0x43')]);_0x244822[_0xb304('0x23')]=qs[_0xb304('0x2d')](_[_0xb304('0x52')](_0xaa1606[_0xb304('0x26')],_0x30e32c[_0xb304('0x2d')]));if(_0xaa1606[_0xb304('0x26')][_0xb304('0x45')]){_0x244822[_0xb304('0x23')]=_[_0xb304('0x32')](_0x244822[_0xb304('0x23')],{'$or':_[_0xb304('0x1f')](_0x244822[_0xb304('0x2f')],function(_0x546dd9){var _0x47f61b={};_0x47f61b[_0x546dd9]={'$like':'%'+_0xaa1606['query'][_0xb304('0x45')]+'%'};return _0x47f61b;})});}_0x244822=_[_0xb304('0x32')]({},_0x244822,_0xaa1606[_0xb304('0x46')]);return _0x3c5654[_0xb304('0x6f')](_0x244822);}})[_0xb304('0x19')](function(_0x4349c7){if(_0x4349c7){_0x593520=_0x4349c7[_0xb304('0x31')];if(!_0xaa1606[_0xb304('0x26')][_0xb304('0x41')](_0xb304('0x70'))){_0x244822[_0xb304('0x14')]=qs[_0xb304('0x14')](_0xaa1606[_0xb304('0x26')]['limit']);_0x244822['offset']=qs['offset'](_0xaa1606['query'][_0xb304('0x12')]);}return _0x3c5654[_0xb304('0x6f')](_0x244822);}})['then'](function(_0x5ce936){if(_0x5ce936){return _0x5ce936?{'count':_0x593520,'rows':_0x5ce936}:null;}})[_0xb304('0x19')](respondWithResult(_0x45068c,null))[_0xb304('0x28')](handleError(_0x45068c,null));}; \ No newline at end of file +var _0x44fe=['spread','userFaxQueue:save','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','get','FaxQueues','UserProfileResource','destroy','sendStatus','stack','name','index','map','FaxQueue','fieldName','type','key','query','rows','catch','show','params','model','keys','attributes','intersection','fields','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','options','User','findAndCountAll','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','ids','findAll','Agents','online','voicePause','flatMap','transaction','each','forEach','emit','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','all','union','value','isEmpty','userFaxQueue:remove','omit'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x44fe,0x16f));var _0xe44f=function(_0x3500f0,_0x2a3fca){_0x3500f0=_0x3500f0-0x0;var _0x3d3dd2=_0x44fe[_0x3500f0];return _0x3d3dd2;};'use strict';var BPromise=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var _=require(_0xe44f('0x2'));var squel=require(_0xe44f('0x3'));var Redis=require(_0xe44f('0x4'));var qs=require(_0xe44f('0x5'));var logger=require(_0xe44f('0x6'))(_0xe44f('0x7'));var config=require(_0xe44f('0x8'));var db=require(_0xe44f('0x9'))['db'];config[_0xe44f('0xa')]=_['defaults'](config['redis'],{'host':_0xe44f('0xb'),'port':0x18eb});var socket=require(_0xe44f('0xc'))(new Redis(config['redis']));require(_0xe44f('0xd'))[_0xe44f('0xe')](socket);function respondWithStatusCode(_0x110de4,_0xdad72b){_0xdad72b=_0xdad72b||0xcc;return function(_0x47726a){if(_0x47726a){return _0x110de4['sendStatus'](_0xdad72b);}return _0x110de4[_0xe44f('0xf')](_0xdad72b)[_0xe44f('0x10')]();};}function respondWithResult(_0x44b180,_0x447184){_0x447184=_0x447184||0xc8;return function(_0x2d6ec5){if(_0x2d6ec5){return _0x44b180[_0xe44f('0xf')](_0x447184)[_0xe44f('0x11')](_0x2d6ec5);}};}function respondWithFilteredResult(_0xdb9b6c,_0x3b41c3){return function(_0x4971ab){if(_0x4971ab){var _0x1972ce=typeof _0x3b41c3[_0xe44f('0x12')]==='undefined'&&typeof _0x3b41c3[_0xe44f('0x13')]===_0xe44f('0x14');var _0x12cdf1=_0x4971ab[_0xe44f('0x15')];var _0x3c78e1=_0x1972ce?0x0:_0x3b41c3[_0xe44f('0x12')];var _0x3ec218=_0x1972ce?_0x4971ab[_0xe44f('0x15')]:_0x3b41c3['offset']+_0x3b41c3[_0xe44f('0x13')];var _0x1fa09f;if(_0x3ec218>=_0x12cdf1){_0x3ec218=_0x12cdf1;_0x1fa09f=0xc8;}else{_0x1fa09f=0xce;}_0xdb9b6c[_0xe44f('0xf')](_0x1fa09f);return _0xdb9b6c[_0xe44f('0x16')](_0xe44f('0x17'),_0x3c78e1+'-'+_0x3ec218+'/'+_0x12cdf1)[_0xe44f('0x11')](_0x4971ab);}return null;};}function saveUpdates(_0x3ee3f9){return function(_0x4029fe){if(_0x4029fe){return _0x4029fe[_0xe44f('0x18')](_0x3ee3f9)[_0xe44f('0x19')](function(_0x163af0){return _0x163af0;});}return null;};}function removeEntity(_0x3e7d5e){return function(_0x4c70e5){if(_0x4c70e5){return _0x4c70e5['destroy']()[_0xe44f('0x19')](function(){var _0x309a28=_0x4c70e5[_0xe44f('0x1a')]({'plain':!![]});var _0x117a30=_0xe44f('0x1b');return db[_0xe44f('0x1c')][_0xe44f('0x1d')]({'where':{'type':_0x117a30,'resourceId':_0x309a28['id']}})[_0xe44f('0x19')](function(){return _0x4c70e5;});})[_0xe44f('0x19')](function(){_0x3e7d5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2756e3){return function(_0x3fe450){if(!_0x3fe450){_0x2756e3[_0xe44f('0x1e')](0x194);}return _0x3fe450;};}function handleError(_0x3f7ef8,_0xf3c259){_0xf3c259=_0xf3c259||0x1f4;return function(_0x538a03){logger['error'](_0x538a03[_0xe44f('0x1f')]);if(_0x538a03[_0xe44f('0x20')]){delete _0x538a03[_0xe44f('0x20')];}_0x3f7ef8[_0xe44f('0xf')](_0xf3c259)['send'](_0x538a03);};}exports[_0xe44f('0x21')]=function(_0xb84f2d,_0x384c82){var _0x90d216={};var _0x59667c={'count':0x0,'rows':[]};var _0x45a632=_[_0xe44f('0x22')](db[_0xe44f('0x23')]['rawAttributes'],function(_0x4e3cce){return{'name':_0x4e3cce[_0xe44f('0x24')],'type':_0x4e3cce[_0xe44f('0x25')][_0xe44f('0x26')]};});_0x90d216=qs['getOptions'](_0x45a632,_0xb84f2d);var _0x460e67={'where':_0x90d216['where']};return db[_0xe44f('0x23')][_0xe44f('0x15')](_0x460e67)[_0xe44f('0x19')](function(_0x50eba5){_0x59667c['count']=_0x50eba5;_0x90d216['include']=qs['include'](_0xb84f2d[_0xe44f('0x27')]);return db[_0xe44f('0x23')]['findAll'](_0x90d216);})[_0xe44f('0x19')](function(_0x180047){_0x59667c[_0xe44f('0x28')]=_0x180047;return _0x59667c;})[_0xe44f('0x19')](respondWithFilteredResult(_0x384c82,_0x90d216))[_0xe44f('0x29')](handleError(_0x384c82,null));};exports[_0xe44f('0x2a')]=function(_0x59788c,_0x2f22d9){var _0x5af7ff={'raw':!![],'where':{'id':_0x59788c[_0xe44f('0x2b')]['id']}},_0x366f19={};_0x366f19[_0xe44f('0x2c')]=_['keys'](db[_0xe44f('0x23')]['rawAttributes']);_0x366f19[_0xe44f('0x27')]=_[_0xe44f('0x2d')](_0x59788c[_0xe44f('0x27')]);_0x366f19['filters']=_['intersection'](_0x366f19[_0xe44f('0x2c')],_0x366f19[_0xe44f('0x27')]);_0x5af7ff[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x366f19['model'],qs[_0xe44f('0x30')](_0x59788c[_0xe44f('0x27')]['fields']));_0x5af7ff[_0xe44f('0x2e')]=_0x5af7ff[_0xe44f('0x2e')]['length']?_0x5af7ff[_0xe44f('0x2e')]:_0x366f19[_0xe44f('0x2c')];if(_0x59788c[_0xe44f('0x27')][_0xe44f('0x31')]){_0x5af7ff[_0xe44f('0x32')]=[{'all':!![]}];}_0x5af7ff=_[_0xe44f('0x33')]({},_0x5af7ff,_0x59788c['options']);return db['FaxQueue'][_0xe44f('0x34')](_0x5af7ff)['then'](handleEntityNotFound(_0x2f22d9,null))[_0xe44f('0x19')](respondWithResult(_0x2f22d9,null))[_0xe44f('0x29')](handleError(_0x2f22d9,null));};exports['create']=function(_0x9e5556,_0x41ff84){return db[_0xe44f('0x23')][_0xe44f('0x35')](_0x9e5556[_0xe44f('0x36')],{})[_0xe44f('0x19')](function(_0x2fe610){var _0x135cc2=_0x9e5556[_0xe44f('0x37')][_0xe44f('0x1a')]({'plain':!![]});if(!_0x135cc2)throw new Error(_0xe44f('0x38'));if(_0x135cc2[_0xe44f('0x39')]===_0xe44f('0x37')){var _0x2a82ca=_0x2fe610[_0xe44f('0x1a')]({'plain':!![]});var _0x1df395=_0xe44f('0x1b');return db[_0xe44f('0x3a')][_0xe44f('0x34')]({'where':{'name':_0x1df395,'userProfileId':_0x135cc2['userProfileId']},'raw':!![]})['then'](function(_0x22d813){if(_0x22d813&&_0x22d813[_0xe44f('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a82ca[_0xe44f('0x20')],'resourceId':_0x2a82ca['id'],'type':_0x22d813[_0xe44f('0x20')],'sectionId':_0x22d813['id']},{})[_0xe44f('0x19')](function(){return _0x2fe610;});}else{return _0x2fe610;}})[_0xe44f('0x29')](function(_0x5b38ac){logger[_0xe44f('0x3c')](_0xe44f('0x3d'),_0x5b38ac);throw _0x5b38ac;});}return _0x2fe610;})[_0xe44f('0x19')](respondWithResult(_0x41ff84,0xc9))[_0xe44f('0x29')](handleError(_0x41ff84,null));};exports[_0xe44f('0x18')]=function(_0x3b85a9,_0x481d88){if(_0x3b85a9[_0xe44f('0x36')]['id']){delete _0x3b85a9['body']['id'];}return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x3b85a9[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x481d88,null))['then'](saveUpdates(_0x3b85a9['body'],null))[_0xe44f('0x19')](respondWithResult(_0x481d88,null))[_0xe44f('0x29')](handleError(_0x481d88,null));};exports['destroy']=function(_0x5ea96c,_0x53252b){return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x5ea96c['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x53252b,null))['then'](removeEntity(_0x53252b,null))[_0xe44f('0x29')](handleError(_0x53252b,null));};exports['describe']=function(_0x492030,_0x42ee16){return db[_0xe44f('0x23')][_0xe44f('0x3e')]()[_0xe44f('0x19')](respondWithResult(_0x42ee16,null))[_0xe44f('0x29')](handleError(_0x42ee16,null));};exports[_0xe44f('0x3f')]=function(_0x553e10,_0x14d87a){var _0x4bcba8={'raw':!![],'where':{}},_0x1177f4={},_0x39fe4f;return db[_0xe44f('0x23')][_0xe44f('0x40')]({'where':{'id':_0x553e10[_0xe44f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x14d87a,null))[_0xe44f('0x19')](function(_0x4c2259){if(_0x4c2259){_0x39fe4f=_0x4c2259['get']({'plain':!![]});_0x1177f4['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x41')][_0xe44f('0x42')]);_0x1177f4[_0xe44f('0x27')]=_['keys'](_0x553e10[_0xe44f('0x27')]);_0x1177f4[_0xe44f('0x43')]=_['intersection'](_0x1177f4[_0xe44f('0x2c')],_0x1177f4[_0xe44f('0x27')]);_0x4bcba8[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x1177f4['model'],qs[_0xe44f('0x30')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x30')]));_0x4bcba8[_0xe44f('0x2e')]=_0x4bcba8[_0xe44f('0x2e')]['length']?_0x4bcba8[_0xe44f('0x2e')]:_0x1177f4[_0xe44f('0x2c')];if(!_0x553e10[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x4bcba8[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x553e10[_0xe44f('0x27')]['limit']);_0x4bcba8[_0xe44f('0x12')]=qs[_0xe44f('0x12')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x12')]);}_0x4bcba8[_0xe44f('0x46')]=qs[_0xe44f('0x47')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x47')]);_0x4bcba8[_0xe44f('0x48')]=qs[_0xe44f('0x43')](_[_0xe44f('0x49')](_0x553e10['query'],_0x1177f4[_0xe44f('0x43')]));_0x4bcba8[_0xe44f('0x48')][_0xe44f('0x4a')]=_0x4c2259['id'];if(_0x553e10[_0xe44f('0x27')][_0xe44f('0x4b')]){_0x4bcba8['where']=_[_0xe44f('0x33')](_0x4bcba8[_0xe44f('0x48')],{'$or':_[_0xe44f('0x22')](_0x4bcba8[_0xe44f('0x2e')],function(_0x3c9556){var _0x2a3055={};_0x2a3055[_0x3c9556]={'$like':'%'+_0x553e10[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x2a3055;})});}_0x4bcba8=_[_0xe44f('0x33')]({},_0x4bcba8,_0x553e10[_0xe44f('0x4c')]);return db[_0xe44f('0x41')]['findAll'](_0x4bcba8);}})[_0xe44f('0x19')](function(_0xb01d5f){if(_0xb01d5f){return db[_0xe44f('0x4d')][_0xe44f('0x4e')]({'where':{'id':_['map'](_0xb01d5f,'UserId'),'role':_0xe44f('0x4f')},'attributes':['id',_0xe44f('0x20'),_0xe44f('0x50'),_0xe44f('0x51'),'createdAt']});}})[_0xe44f('0x19')](function(_0x106e02){if(_0x106e02){return{'count':_0x106e02[_0xe44f('0x15')],'rows':_['map'](_0x106e02[_0xe44f('0x28')],function(_0x2a2090){return{'membername':_0x2a2090[_0xe44f('0x20')],'UserId':_0x2a2090['id'],'queue_name':_0x39fe4f[_0xe44f('0x20')],'FaxQueueId':_0x39fe4f['id'],'interface':util[_0xe44f('0x52')](_0xe44f('0x53'),_0xe44f('0x54'),_0x2a2090[_0xe44f('0x20')]),'penalty':0x0,'paused':_0x2a2090['faxPause'],'createdAt':_0x2a2090[_0xe44f('0x55')],'updatedAt':_0x2a2090['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14d87a,_0x4bcba8))[_0xe44f('0x29')](handleError(_0x14d87a,null));};exports[_0xe44f('0x56')]=function(_0x6382e8,_0x4839c6){var _0x493cc0={};var _0x52f53e={};var _0x1eb147;var _0xb781c7;return db['FaxQueue']['findOne']({'where':{'id':_0x6382e8[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x4839c6,null))[_0xe44f('0x19')](function(_0x4335ca){if(_0x4335ca){_0x1eb147=_0x4335ca;_0x52f53e['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x57')]['rawAttributes']);_0x52f53e['query']=_[_0xe44f('0x2d')](_0x6382e8['query']);_0x52f53e[_0xe44f('0x43')]=_['intersection'](_0x52f53e[_0xe44f('0x2c')],_0x52f53e[_0xe44f('0x27')]);_0x493cc0[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x52f53e['model'],qs[_0xe44f('0x30')](_0x6382e8['query'][_0xe44f('0x30')]));_0x493cc0['attributes']=_0x493cc0[_0xe44f('0x2e')][_0xe44f('0x58')]?_0x493cc0[_0xe44f('0x2e')]:_0x52f53e[_0xe44f('0x2c')];_0x493cc0[_0xe44f('0x46')]=qs[_0xe44f('0x47')](_0x6382e8[_0xe44f('0x27')][_0xe44f('0x47')]);_0x493cc0[_0xe44f('0x48')]=qs['filters'](_['pick'](_0x6382e8[_0xe44f('0x27')],_0x52f53e['filters']));if(_0x6382e8[_0xe44f('0x27')][_0xe44f('0x4b')]){_0x493cc0[_0xe44f('0x48')]=_['merge'](_0x493cc0['where'],{'$or':_['map'](_0x493cc0[_0xe44f('0x2e')],function(_0x1b80ec){var _0x573734={};_0x573734[_0x1b80ec]={'$like':'%'+_0x6382e8[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x573734;})});}_0x493cc0=_['merge']({},_0x493cc0,_0x6382e8[_0xe44f('0x4c')]);return _0x1eb147['getTeams'](_0x493cc0);}})[_0xe44f('0x19')](function(_0x5d9bb3){if(_0x5d9bb3){_0xb781c7=_0x5d9bb3['length'];if(!_0x6382e8[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x493cc0[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x6382e8[_0xe44f('0x27')]['limit']);_0x493cc0[_0xe44f('0x12')]=qs[_0xe44f('0x12')](_0x6382e8[_0xe44f('0x27')][_0xe44f('0x12')]);}return _0x1eb147[_0xe44f('0x56')](_0x493cc0);}})[_0xe44f('0x19')](function(_0x5ac123){if(_0x5ac123){return _0x5ac123?{'count':_0xb781c7,'rows':_0x5ac123}:null;}})[_0xe44f('0x19')](respondWithResult(_0x4839c6,null))[_0xe44f('0x29')](handleError(_0x4839c6,null));};exports[_0xe44f('0x59')]=function(_0x21ab43,_0x977bce){var _0x150561=_0x21ab43['body'][_0xe44f('0x5a')];return db['Team'][_0xe44f('0x5b')]({'where':{'id':_0x150561},'attributes':['id'],'include':[{'model':db[_0xe44f('0x4d')],'as':_0xe44f('0x5c'),'attributes':['id',_0xe44f('0x20'),_0xe44f('0x5d'),_0xe44f('0x5e'),'interface'],'raw':!![]}]})[_0xe44f('0x19')](function(_0xf654c8){if(_0xf654c8){var _0x3dd3cd=_[_0xe44f('0x5f')](_0xf654c8,function(_0x3de607){var _0x36a9c8=_0x3de607[_0xe44f('0x1a')]({'plain':!![]});return _0x36a9c8[_0xe44f('0x5c')];});return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x21ab43[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](function(_0x39c48d){return db['sequelize'][_0xe44f('0x60')](function(_0x1da6ff){return _0x39c48d[_0xe44f('0x59')](_0x150561,{'transaction':_0x1da6ff})[_0xe44f('0x19')](function(){return BPromise[_0xe44f('0x61')](_0x3dd3cd,function(_0x174a12){return db[_0xe44f('0x41')]['findOrCreate']({'where':{'UserId':_0x174a12['id'],'FaxQueueId':_0x21ab43[_0xe44f('0x2b')]['id']},'transaction':_0x1da6ff});});})[_0xe44f('0x19')](function(){_0x3dd3cd[_0xe44f('0x62')](function(_0x2b1f60){socket[_0xe44f('0x63')]('userFaxQueue:save',{'UserId':_0x2b1f60['id'],'FaxQueueId':_0x39c48d['id']});});});});});}})['then'](respondWithStatusCode(_0x977bce,null))['catch'](handleError(_0x977bce,null));};exports['removeTeams']=function(_0x5f08f2,_0x132d0c){return db[_0xe44f('0x57')][_0xe44f('0x5b')]({'where':{'id':_0x5f08f2[_0xe44f('0x27')][_0xe44f('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xe44f('0x4d')],'as':_0xe44f('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x132d0c,null))[_0xe44f('0x19')](function(_0x7f9f9d){var _0x440ad9=_['map'](_0x7f9f9d,'id');var _0x5b22ae=[];var _0x22512b=[];var _0x417197=squel[_0xe44f('0x64')]();_0x417197[_0xe44f('0x65')](_0xe44f('0x66'))[_0xe44f('0x67')](_0xe44f('0x68'),'tq')['join'](_0xe44f('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe44f('0x48')]('FaxQueueId\x20=\x20?',_0x5f08f2['params']['id']);for(var _0x37f52c=0x0;_0x37f52c<_0x7f9f9d['length'];_0x37f52c+=0x1){let _0x4c4a68=_0x7f9f9d[_0x37f52c];for(var _0x2aea58=0x0;_0x2aea58<_0x4c4a68[_0xe44f('0x5c')][_0xe44f('0x58')];_0x2aea58+=0x1){let _0x4f07ce=_0x4c4a68['Agents'][_0x2aea58];var _0x183dd1=_0x417197['clone']();_0x183dd1[_0xe44f('0x48')](_0xe44f('0x6a'),_0x4f07ce['id']);_0x22512b[_0xe44f('0x6b')](db[_0xe44f('0x6c')][_0xe44f('0x27')](_0x183dd1['toString'](),{'type':db['sequelize'][_0xe44f('0x6d')]['SELECT']})[_0xe44f('0x19')](function(_0x5ca74e){if(_0x5ca74e[_0xe44f('0x58')]===0x1){return _0x4f07ce['id'];}else{var _0x36eb20=_[_0xe44f('0x6e')](_[_0xe44f('0x22')](_0x5ca74e,'TeamId'),function(_0x304b91){return _['includes'](_0x440ad9,_0x304b91);});if(_0x36eb20){return _0x4f07ce['id'];}}}));}}return BPromise[_0xe44f('0x6f')](_0x22512b)[_0xe44f('0x19')](function(_0x107f16){_0x5b22ae=_(_0x5b22ae)[_0xe44f('0x70')](_0x107f16)['compact']()[_0xe44f('0x71')]();return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x5f08f2[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](function(_0x268486){return db[_0xe44f('0x6c')]['transaction'](function(_0x4e7f54){return _0x268486['removeTeams'](_0x5f08f2[_0xe44f('0x27')][_0xe44f('0x5a')],{'transaction':_0x4e7f54})['then'](function(){if(!_[_0xe44f('0x72')](_0x5b22ae)){return _0x268486['removeAgents'](_0x5b22ae,{'transaction':_0x4e7f54});}})['then'](function(){_0x5b22ae['forEach'](function(_0x3be1bd){socket['emit'](_0xe44f('0x73'),{'UserId':_0x3be1bd,'FaxQueueId':_0x268486['id']});});});});});});})[_0xe44f('0x19')](respondWithStatusCode(_0x132d0c,null))['catch'](handleError(_0x132d0c,null));};exports['addAgents']=function(_0x56c0c5,_0x50111c){return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x56c0c5['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x50111c,null))[_0xe44f('0x19')](function(_0x52cf4e){if(_0x52cf4e){return _0x52cf4e['addAgents'](_0x56c0c5['body'][_0xe44f('0x5a')],_[_0xe44f('0x74')](_0x56c0c5[_0xe44f('0x36')],['ids','id'])||{})[_0xe44f('0x75')](function(_0x1f87a5){for(var _0x122f4d=0x0;_0x122f4d<_0x56c0c5['body'][_0xe44f('0x5a')][_0xe44f('0x58')];_0x122f4d+=0x1){socket[_0xe44f('0x63')](_0xe44f('0x76'),{'UserId':Number(_0x56c0c5[_0xe44f('0x36')]['ids'][_0x122f4d]),'FaxQueueId':Number(_0x56c0c5[_0xe44f('0x2b')]['id'])});}return _0x1f87a5;});}})[_0xe44f('0x19')](respondWithResult(_0x50111c,null))[_0xe44f('0x29')](handleError(_0x50111c,null));};exports[_0xe44f('0x77')]=function(_0x4a4972,_0x14c855){return db[_0xe44f('0x23')]['find']({'where':{'id':_0x4a4972['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x14c855,null))[_0xe44f('0x19')](function(_0xa5720a){if(_0xa5720a){return _0xa5720a['removeAgents'](_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')])[_0xe44f('0x19')](function(){if(_['isArray'](_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')])){for(var _0x42f17a=0x0;_0x42f17a<_0x4a4972['query'][_0xe44f('0x5a')][_0xe44f('0x58')];_0x42f17a+=0x1){socket['emit'](_0xe44f('0x73'),{'UserId':Number(_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')][_0x42f17a]),'FaxQueueId':Number(_0x4a4972['params']['id'])});}}else{socket[_0xe44f('0x63')](_0xe44f('0x73'),{'UserId':Number(_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')]),'FaxQueueId':Number(_0x4a4972['params']['id'])});}});}})[_0xe44f('0x19')](respondWithStatusCode(_0x14c855,null))[_0xe44f('0x29')](handleError(_0x14c855,null));};exports[_0xe44f('0x78')]=function(_0x42b38e,_0x1e7da6){var _0x51c2d8={};var _0x25d94b={};var _0x6c249c;var _0x3c1cb6;return db[_0xe44f('0x23')][_0xe44f('0x40')]({'where':{'id':_0x42b38e[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x1e7da6,null))[_0xe44f('0x19')](function(_0x36359c){if(_0x36359c){_0x6c249c=_0x36359c;_0x25d94b['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x4d')][_0xe44f('0x42')]);_0x25d94b[_0xe44f('0x27')]=_[_0xe44f('0x2d')](_0x42b38e[_0xe44f('0x27')]);_0x25d94b[_0xe44f('0x43')]=_[_0xe44f('0x2f')](_0x25d94b[_0xe44f('0x2c')],_0x25d94b[_0xe44f('0x27')]);_0x51c2d8['attributes']=_['intersection'](_0x25d94b['model'],qs[_0xe44f('0x30')](_0x42b38e['query']['fields']));_0x51c2d8[_0xe44f('0x2e')]=_0x51c2d8['attributes'][_0xe44f('0x58')]?_0x51c2d8[_0xe44f('0x2e')]:_0x25d94b['model'];_0x51c2d8[_0xe44f('0x46')]=qs['sort'](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x47')]);_0x51c2d8[_0xe44f('0x48')]=qs[_0xe44f('0x43')](_[_0xe44f('0x49')](_0x42b38e[_0xe44f('0x27')],_0x25d94b[_0xe44f('0x43')]));if(_0x42b38e['query'][_0xe44f('0x4b')]){_0x51c2d8[_0xe44f('0x48')]=_[_0xe44f('0x33')](_0x51c2d8['where'],{'$or':_[_0xe44f('0x22')](_0x51c2d8['attributes'],function(_0x2c4774){var _0x5b5476={};_0x5b5476[_0x2c4774]={'$like':'%'+_0x42b38e[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x5b5476;})});}_0x51c2d8=_[_0xe44f('0x33')]({},_0x51c2d8,_0x42b38e[_0xe44f('0x4c')]);return _0x6c249c[_0xe44f('0x78')](_0x51c2d8);}})[_0xe44f('0x19')](function(_0xe42016){if(_0xe42016){_0x3c1cb6=_0xe42016['length'];if(!_0x42b38e[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x51c2d8[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x13')]);_0x51c2d8[_0xe44f('0x12')]=qs['offset'](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x12')]);}return _0x6c249c[_0xe44f('0x78')](_0x51c2d8);}})['then'](function(_0x59ac0c){if(_0x59ac0c){return _0x59ac0c?{'count':_0x3c1cb6,'rows':_0x59ac0c}:null;}})[_0xe44f('0x19')](respondWithResult(_0x1e7da6,null))[_0xe44f('0x29')](handleError(_0x1e7da6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index abd579c..b2870ae 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 _0x1b6f=['FaxQueue','setMaxListeners','save','update','remove','hook','exports','events','../../mysqldb'];(function(_0x4ee618,_0x3c8269){var _0x151e9c=function(_0x26b720){while(--_0x26b720){_0x4ee618['push'](_0x4ee618['shift']());}};_0x151e9c(++_0x3c8269);}(_0x1b6f,0x10c));var _0xf1b6=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0x1b6f[_0xd93b26];return _0x25f668;};'use strict';var EventEmitter=require(_0xf1b6('0x0'));var FaxQueue=require(_0xf1b6('0x1'))['db'][_0xf1b6('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf1b6('0x3')](0x0);var events={'afterCreate':_0xf1b6('0x4'),'afterUpdate':_0xf1b6('0x5'),'afterDestroy':_0xf1b6('0x6')};function emitEvent(_0x289f5d){return function(_0x366864,_0x336eb2,_0x56f9f1){FaxQueueEvents['emit'](_0x289f5d+':'+_0x366864['id'],_0x366864);FaxQueueEvents['emit'](_0x289f5d,_0x366864);_0x56f9f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xf1b6('0x7')](e,emitEvent(event));}}module[_0xf1b6('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x3a4f=['../../mysqldb','FaxQueue','save','remove','emit','exports'];(function(_0x41b235,_0x367b5e){var _0xf9996b=function(_0x17c7e8){while(--_0x17c7e8){_0x41b235['push'](_0x41b235['shift']());}};_0xf9996b(++_0x367b5e);}(_0x3a4f,0x1ce));var _0xf3a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a4f[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xf3a4('0x0'))['db'][_0xf3a4('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf3a4('0x2'),'afterUpdate':'update','afterDestroy':_0xf3a4('0x3')};function emitEvent(_0x3b584c){return function(_0x46f348,_0x26a2f1,_0x21091a){FaxQueueEvents[_0xf3a4('0x4')](_0x3b584c+':'+_0x46f348['id'],_0x46f348);FaxQueueEvents[_0xf3a4('0x4')](_0x3b584c,_0x46f348);_0x21091a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xf3a4('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6c6d71c..db836d1 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 _0xa4c2=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','FaxQueue','fax_queues'];(function(_0x24869e,_0x5d9a14){var _0x183df6=function(_0x2ce6e1){while(--_0x2ce6e1){_0x24869e['push'](_0x24869e['shift']());}};_0x183df6(++_0x5d9a14);}(_0xa4c2,0x129));var _0x2a4c=function(_0x3126a8,_0x286644){_0x3126a8=_0x3126a8-0x0;var _0x358f8d=_0xa4c2[_0x3126a8];return _0x358f8d;};'use strict';var _=require(_0x2a4c('0x0'));var util=require(_0x2a4c('0x1'));var logger=require(_0x2a4c('0x2'))('api');var moment=require(_0x2a4c('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a4c('0x4'));var fs=require('fs');var path=require(_0x2a4c('0x5'));var rimraf=require(_0x2a4c('0x6'));var config=require(_0x2a4c('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x141433,_0x394674){return _0x141433[_0x2a4c('0x8')](_0x2a4c('0x9'),attributes,{'tableName':_0x2a4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x025c=['fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxQueue.attributes','exports'];(function(_0x2462fb,_0x45f03c){var _0x37018c=function(_0x1f9952){while(--_0x1f9952){_0x2462fb['push'](_0x2462fb['shift']());}};_0x37018c(++_0x45f03c);}(_0x025c,0x182));var _0xc025=function(_0x3fd078,_0x10e4a5){_0x3fd078=_0x3fd078-0x0;var _0x53506c=_0x025c[_0x3fd078];return _0x53506c;};'use strict';var _=require(_0xc025('0x0'));var util=require(_0xc025('0x1'));var logger=require(_0xc025('0x2'))(_0xc025('0x3'));var moment=require(_0xc025('0x4'));var BPromise=require(_0xc025('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc025('0x6'));var rimraf=require('rimraf');var config=require(_0xc025('0x7'));var attributes=require(_0xc025('0x8'));module[_0xc025('0x9')]=function(_0x51a3ff,_0x953a7f){return _0x51a3ff['define']('FaxQueue',attributes,{'tableName':_0xc025('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 7ac1c7b..978402b 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 _0x55ff=['where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxQueue','options','raw'];(function(_0x5c6f53,_0x5f08f6){var _0x4b9fff=function(_0x34595f){while(--_0x34595f){_0x5c6f53['push'](_0x5c6f53['shift']());}};_0x4b9fff(++_0x5f08f6);}(_0x55ff,0x1f3));var _0xf55f=function(_0x1f1a63,_0x3b5924){_0x1f1a63=_0x1f1a63-0x0;var _0x21492a=_0x55ff[_0x1f1a63];return _0x21492a;};'use strict';var _=require(_0xf55f('0x0'));var util=require(_0xf55f('0x1'));var moment=require(_0xf55f('0x2'));var BPromise=require(_0xf55f('0x3'));var rs=require(_0xf55f('0x4'));var fs=require('fs');var Redis=require(_0xf55f('0x5'));var db=require(_0xf55f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf55f('0x7'))(_0xf55f('0x8'));var config=require(_0xf55f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf55f('0xa')][_0xf55f('0xb')]({'port':0x232a});config['redis']=_[_0xf55f('0xc')](config[_0xf55f('0xd')],{'host':_0xf55f('0xe'),'port':0x18eb});var socket=require(_0xf55f('0xf'))(new Redis(config[_0xf55f('0xd')]));require(_0xf55f('0x10'))[_0xf55f('0x11')](socket);function respondWithRpcPromise(_0x154c67,_0x5ec876,_0x4e3d72){return new BPromise(function(_0x48305a,_0x33e048){return client[_0xf55f('0x12')](_0x154c67,_0x4e3d72)[_0xf55f('0x13')](function(_0x1324f0){logger['info'](_0xf55f('0x14'),_0x5ec876,_0xf55f('0x15'));logger[_0xf55f('0x16')](_0xf55f('0x17'),_0x5ec876,_0xf55f('0x15'),JSON[_0xf55f('0x18')](_0x1324f0));if(_0x1324f0[_0xf55f('0x19')]){if(_0x1324f0[_0xf55f('0x19')][_0xf55f('0x1a')]===0x1f4){logger[_0xf55f('0x19')](_0xf55f('0x14'),_0x5ec876,_0x1324f0['error']['message']);return _0x33e048(_0x1324f0['error'][_0xf55f('0x1b')]);}logger[_0xf55f('0x19')](_0xf55f('0x14'),_0x5ec876,_0x1324f0[_0xf55f('0x19')]['message']);return _0x48305a(_0x1324f0[_0xf55f('0x19')][_0xf55f('0x1b')]);}else{logger[_0xf55f('0x1c')](_0xf55f('0x14'),_0x5ec876,_0xf55f('0x15'));_0x48305a(_0x1324f0[_0xf55f('0x1d')][_0xf55f('0x1b')]);}})[_0xf55f('0x1e')](function(_0x1403d8){logger[_0xf55f('0x19')](_0xf55f('0x14'),_0x5ec876,_0x1403d8);_0x33e048(_0x1403d8);});});}exports['GetFaxQueue']=function(_0x5a0acc){var _0x5a76a1=this;return new Promise(function(_0xc23d90,_0x20d632){return db[_0xf55f('0x1f')]['findAll']({'raw':_0x5a0acc[_0xf55f('0x20')]?_0x5a0acc[_0xf55f('0x20')][_0xf55f('0x21')]===undefined?!![]:![]:!![],'where':_0x5a0acc[_0xf55f('0x20')]?_0x5a0acc['options'][_0xf55f('0x22')]||null:null,'attributes':_0x5a0acc[_0xf55f('0x20')]?_0x5a0acc['options'][_0xf55f('0x23')]||null:null,'limit':_0x5a0acc[_0xf55f('0x20')]?_0x5a0acc[_0xf55f('0x20')]['limit']||null:null,'include':_0x5a0acc[_0xf55f('0x20')]?_0x5a0acc[_0xf55f('0x20')][_0xf55f('0x24')]?_[_0xf55f('0x25')](_0x5a0acc[_0xf55f('0x20')][_0xf55f('0x24')],function(_0x3ba012){return{'model':db[_0x3ba012[_0xf55f('0x26')]],'as':_0x3ba012['as'],'attributes':_0x3ba012[_0xf55f('0x23')],'include':_0x3ba012[_0xf55f('0x24')]?_['map'](_0x3ba012[_0xf55f('0x24')],function(_0x2c558e){return{'model':db[_0x2c558e[_0xf55f('0x26')]],'as':_0x2c558e['as'],'attributes':_0x2c558e['attributes'],'include':_0x2c558e[_0xf55f('0x24')]?_[_0xf55f('0x25')](_0x2c558e[_0xf55f('0x24')],function(_0x2c7c6f){return{'model':db[_0x2c7c6f[_0xf55f('0x26')]],'as':_0x2c7c6f['as'],'attributes':_0x2c7c6f[_0xf55f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf55f('0x13')](function(_0x46d9ad){logger[_0xf55f('0x1c')](_0xf55f('0x27'),_0x5a0acc);logger['debug'](_0xf55f('0x27'),_0x5a0acc,JSON['stringify'](_0x46d9ad));_0xc23d90(_0x46d9ad);})[_0xf55f('0x1e')](function(_0x203a55){logger[_0xf55f('0x19')]('GetFaxQueue',_0x203a55[_0xf55f('0x1b')],_0x5a0acc);_0x20d632(_0x5a76a1[_0xf55f('0x19')](0x1f4,_0x203a55[_0xf55f('0x1b')]));});});};exports['ShowFaxQueue']=function(_0x1971d5){var _0x5e9628=this;return new Promise(function(_0x5a78b9,_0x41d141){return db[_0xf55f('0x1f')]['find']({'raw':_0x1971d5['options']?_0x1971d5[_0xf55f('0x20')][_0xf55f('0x21')]===undefined?!![]:![]:!![],'where':_0x1971d5[_0xf55f('0x20')]?_0x1971d5[_0xf55f('0x20')][_0xf55f('0x22')]||null:null,'attributes':_0x1971d5['options']?_0x1971d5[_0xf55f('0x20')][_0xf55f('0x23')]||null:null,'include':_0x1971d5[_0xf55f('0x20')]?_0x1971d5['options'][_0xf55f('0x24')]?_[_0xf55f('0x25')](_0x1971d5[_0xf55f('0x20')][_0xf55f('0x24')],function(_0x35b517){return{'model':db[_0x35b517[_0xf55f('0x26')]],'as':_0x35b517['as'],'attributes':_0x35b517[_0xf55f('0x23')],'include':_0x35b517[_0xf55f('0x24')]?_[_0xf55f('0x25')](_0x35b517[_0xf55f('0x24')],function(_0x3e4710){return{'model':db[_0x3e4710[_0xf55f('0x26')]],'as':_0x3e4710['as'],'attributes':_0x3e4710[_0xf55f('0x23')],'include':_0x3e4710[_0xf55f('0x24')]?_['map'](_0x3e4710['include'],function(_0x5bc905){return{'model':db[_0x5bc905[_0xf55f('0x26')]],'as':_0x5bc905['as'],'attributes':_0x5bc905[_0xf55f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf55f('0x13')](function(_0x730b0a){logger['info'](_0xf55f('0x28'),_0x1971d5);logger[_0xf55f('0x16')]('ShowFaxQueue',_0x1971d5,JSON[_0xf55f('0x18')](_0x730b0a));_0x5a78b9(_0x730b0a);})[_0xf55f('0x1e')](function(_0x314b39){logger[_0xf55f('0x19')](_0xf55f('0x28'),_0x314b39[_0xf55f('0x1b')],_0x1971d5);_0x41d141(_0x5e9628['error'](0x1f4,_0x314b39[_0xf55f('0x1b')]));});});}; \ No newline at end of file +var _0xdbe7=['ShowFaxQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','catch','FaxQueue','options','raw','attributes','limit','include','model','map','GetFaxQueue'];(function(_0x47bf0d,_0x35fbd5){var _0x12e061=function(_0x1d7057){while(--_0x1d7057){_0x47bf0d['push'](_0x47bf0d['shift']());}};_0x12e061(++_0x35fbd5);}(_0xdbe7,0x75));var _0x7dbe=function(_0x33106b,_0x4f4458){_0x33106b=_0x33106b-0x0;var _0x2ddd7d=_0xdbe7[_0x33106b];return _0x2ddd7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7dbe('0x0'));var BPromise=require(_0x7dbe('0x1'));var rs=require(_0x7dbe('0x2'));var fs=require('fs');var Redis=require(_0x7dbe('0x3'));var db=require(_0x7dbe('0x4'))['db'];var utils=require(_0x7dbe('0x5'));var logger=require(_0x7dbe('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dbe('0x7')][_0x7dbe('0x8')]({'port':0x232a});config[_0x7dbe('0x9')]=_[_0x7dbe('0xa')](config['redis'],{'host':_0x7dbe('0xb'),'port':0x18eb});var socket=require(_0x7dbe('0xc'))(new Redis(config[_0x7dbe('0x9')]));require(_0x7dbe('0xd'))['register'](socket);function respondWithRpcPromise(_0x3202ae,_0x229853,_0x2fa944){return new BPromise(function(_0x3678b1,_0x36a64b){return client[_0x7dbe('0xe')](_0x3202ae,_0x2fa944)[_0x7dbe('0xf')](function(_0x537c51){logger[_0x7dbe('0x10')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x7dbe('0x11'));logger[_0x7dbe('0x12')](_0x7dbe('0x13'),_0x229853,_0x7dbe('0x11'),JSON[_0x7dbe('0x14')](_0x537c51));if(_0x537c51[_0x7dbe('0x15')]){if(_0x537c51['error'][_0x7dbe('0x16')]===0x1f4){logger[_0x7dbe('0x15')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);return _0x36a64b(_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);}logger[_0x7dbe('0x15')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);return _0x3678b1(_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);}else{logger['info'](_0x7dbe('0x18'),_0x229853,'request\x20sent');_0x3678b1(_0x537c51['result'][_0x7dbe('0x17')]);}})[_0x7dbe('0x19')](function(_0x4d8eac){logger[_0x7dbe('0x15')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x4d8eac);_0x36a64b(_0x4d8eac);});});}exports['GetFaxQueue']=function(_0x47090c){var _0x8e8117=this;return new Promise(function(_0x3dfe33,_0x5e38c4){return db[_0x7dbe('0x1a')]['findAll']({'raw':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')][_0x7dbe('0x1c')]===undefined?!![]:![]:!![],'where':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')]['where']||null:null,'attributes':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')][_0x7dbe('0x1d')]||null:null,'limit':_0x47090c['options']?_0x47090c['options'][_0x7dbe('0x1e')]||null:null,'include':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')][_0x7dbe('0x1f')]?_['map'](_0x47090c[_0x7dbe('0x1b')]['include'],function(_0x5f554b){return{'model':db[_0x5f554b[_0x7dbe('0x20')]],'as':_0x5f554b['as'],'attributes':_0x5f554b['attributes'],'include':_0x5f554b[_0x7dbe('0x1f')]?_[_0x7dbe('0x21')](_0x5f554b[_0x7dbe('0x1f')],function(_0x42cdd2){return{'model':db[_0x42cdd2['model']],'as':_0x42cdd2['as'],'attributes':_0x42cdd2['attributes'],'include':_0x42cdd2[_0x7dbe('0x1f')]?_[_0x7dbe('0x21')](_0x42cdd2[_0x7dbe('0x1f')],function(_0x277b0d){return{'model':db[_0x277b0d['model']],'as':_0x277b0d['as'],'attributes':_0x277b0d[_0x7dbe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7dbe('0xf')](function(_0x10f5e0){logger['info'](_0x7dbe('0x22'),_0x47090c);logger[_0x7dbe('0x12')](_0x7dbe('0x22'),_0x47090c,JSON[_0x7dbe('0x14')](_0x10f5e0));_0x3dfe33(_0x10f5e0);})[_0x7dbe('0x19')](function(_0x4b9422){logger[_0x7dbe('0x15')](_0x7dbe('0x22'),_0x4b9422['message'],_0x47090c);_0x5e38c4(_0x8e8117['error'](0x1f4,_0x4b9422['message']));});});};exports[_0x7dbe('0x23')]=function(_0x1374f0){var _0x6eee6d=this;return new Promise(function(_0x5dd976,_0x199796){return db[_0x7dbe('0x1a')][_0x7dbe('0x24')]({'raw':_0x1374f0[_0x7dbe('0x1b')]?_0x1374f0[_0x7dbe('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1374f0[_0x7dbe('0x1b')]?_0x1374f0['options'][_0x7dbe('0x25')]||null:null,'attributes':_0x1374f0['options']?_0x1374f0['options']['attributes']||null:null,'include':_0x1374f0['options']?_0x1374f0[_0x7dbe('0x1b')][_0x7dbe('0x1f')]?_['map'](_0x1374f0[_0x7dbe('0x1b')][_0x7dbe('0x1f')],function(_0x52b522){return{'model':db[_0x52b522[_0x7dbe('0x20')]],'as':_0x52b522['as'],'attributes':_0x52b522[_0x7dbe('0x1d')],'include':_0x52b522['include']?_[_0x7dbe('0x21')](_0x52b522[_0x7dbe('0x1f')],function(_0x3efa35){return{'model':db[_0x3efa35[_0x7dbe('0x20')]],'as':_0x3efa35['as'],'attributes':_0x3efa35[_0x7dbe('0x1d')],'include':_0x3efa35['include']?_[_0x7dbe('0x21')](_0x3efa35['include'],function(_0x44dce7){return{'model':db[_0x44dce7[_0x7dbe('0x20')]],'as':_0x44dce7['as'],'attributes':_0x44dce7[_0x7dbe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7dbe('0xf')](function(_0x469bdc){logger[_0x7dbe('0x10')]('ShowFaxQueue',_0x1374f0);logger[_0x7dbe('0x12')](_0x7dbe('0x23'),_0x1374f0,JSON[_0x7dbe('0x14')](_0x469bdc));_0x5dd976(_0x469bdc);})[_0x7dbe('0x19')](function(_0x15260b){logger[_0x7dbe('0x15')](_0x7dbe('0x23'),_0x15260b['message'],_0x1374f0);_0x199796(_0x6eee6d[_0x7dbe('0x15')](0x1f4,_0x15260b[_0x7dbe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 57655d1..c1ecaf8 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 _0xa3e6=['removeListener','register','./faxQueue.events','remove'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x371a7d,_0x21818f){_0x371a7d=_0x371a7d-0x0;var _0x445471=_0xa3e6[_0x371a7d];return _0x445471;};'use strict';var FaxQueueEvents=require(_0x6a3e('0x0'));var events=['save',_0x6a3e('0x1'),'update'];function createListener(_0x1dbcdb,_0x111a5d){return function(_0x3e5620){_0x111a5d['emit'](_0x1dbcdb,_0x3e5620);};}function removeListener(_0xe03261,_0x5e9a85){return function(){FaxQueueEvents[_0x6a3e('0x2')](_0xe03261,_0x5e9a85);};}exports[_0x6a3e('0x3')]=function(_0x1c7709){for(var _0x315ed8=0x0,_0x19dd88=events['length'];_0x315ed8<_0x19dd88;_0x315ed8++){var _0x3d7fbe=events[_0x315ed8];var _0x3d2a86=createListener('faxQueue:'+_0x3d7fbe,_0x1c7709);FaxQueueEvents['on'](_0x3d7fbe,_0x3d2a86);}}; \ No newline at end of file +var _0x8e14=['faxQueue:','./faxQueue.events','save','remove','update','emit','length'];(function(_0x5d95be,_0x462e3c){var _0x1e5f22=function(_0x32707b){while(--_0x32707b){_0x5d95be['push'](_0x5d95be['shift']());}};_0x1e5f22(++_0x462e3c);}(_0x8e14,0x1c8));var _0x48e1=function(_0x475e00,_0x32d51d){_0x475e00=_0x475e00-0x0;var _0x248dde=_0x8e14[_0x475e00];return _0x248dde;};'use strict';var FaxQueueEvents=require(_0x48e1('0x0'));var events=[_0x48e1('0x1'),_0x48e1('0x2'),_0x48e1('0x3')];function createListener(_0x1c5224,_0x66500e){return function(_0x1e3d06){_0x66500e[_0x48e1('0x4')](_0x1c5224,_0x1e3d06);};}function removeListener(_0x50ce27,_0x3a917a){return function(){FaxQueueEvents['removeListener'](_0x50ce27,_0x3a917a);};}exports['register']=function(_0x242792){for(var _0x2779eb=0x0,_0x1d1353=events[_0x48e1('0x5')];_0x2779eb<_0x1d1353;_0x2779eb++){var _0x440193=events[_0x2779eb];var _0x3e46e2=createListener(_0x48e1('0x6')+_0x440193,_0x242792);FaxQueueEvents['on'](_0x440193,_0x3e46e2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6df3945..1fc0b1a 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 _0x5496=['/:id/teams','addTeams','post','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','/:id/users','create'];(function(_0x54cd71,_0x56a723){var _0x54ef89=function(_0xaed90c){while(--_0xaed90c){_0x54cd71['push'](_0x54cd71['shift']());}};_0x54ef89(++_0x56a723);}(_0x5496,0x175));var _0x6549=function(_0x50c995,_0x28b8c7){_0x50c995=_0x50c995-0x0;var _0x529fc3=_0x5496[_0x50c995];return _0x529fc3;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/describe',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xa')](_0x6549('0xe'),auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router['get']('/:id/teams',auth[_0x6549('0xb')](),controller[_0x6549('0x10')]);router[_0x6549('0xa')](_0x6549('0x11'),auth[_0x6549('0xb')](),controller['getAgents']);router['post']('/',auth[_0x6549('0xb')](),controller[_0x6549('0x12')]);router['post'](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);router[_0x6549('0x15')](_0x6549('0x11'),auth[_0x6549('0xb')](),controller['addAgents']);router['put'](_0x6549('0x16'),auth[_0x6549('0xb')](),controller['update']);router[_0x6549('0x17')](_0x6549('0x16'),auth[_0x6549('0xb')](),controller[_0x6549('0x18')]);router[_0x6549('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6549('0x19')]);router['delete']('/:id/users',auth[_0x6549('0xb')](),controller[_0x6549('0x1a')]);module[_0x6549('0x1b')]=router; \ No newline at end of file +var _0xef17=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','describe','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','/:id/users','put','update','destroy'];(function(_0x3f3b97,_0x395d93){var _0xb6ab0c=function(_0x330c5a){while(--_0x330c5a){_0x3f3b97['push'](_0x3f3b97['shift']());}};_0xb6ab0c(++_0x395d93);}(_0xef17,0x136));var _0x7ef1=function(_0x518370,_0x9c3902){_0x518370=_0x518370-0x0;var _0x5439fa=_0xef17[_0x518370];return _0x5439fa;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xb')](_0x7ef1('0xe'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xf')]);router[_0x7ef1('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7ef1('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7ef1('0x11')]);router['post']('/',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x12')]);router[_0x7ef1('0x13')](_0x7ef1('0x14'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x15')]);router[_0x7ef1('0x13')](_0x7ef1('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7ef1('0x17')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x19')]);router['delete'](_0x7ef1('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x7ef1('0x16'),auth['isAuthenticated'](),controller[_0x7ef1('0x1a')]);module[_0x7ef1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2e0a9b6..98dbff1 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 _0x3e9d=['STRING','DATE','moment','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x3e47a7,_0x395dec){_0x3e47a7=_0x3e47a7-0x0;var _0x987afb=_0x3e9d[_0x3e47a7];return _0x987afb;};'use strict';var moment=require(_0xd3e9('0x0'));var Sequelize=require(_0xd3e9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd3e9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd3e9('0x2')]},'joinAt':{'type':Sequelize[_0xd3e9('0x3')]},'leaveAt':{'type':Sequelize[_0xd3e9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd3e9('0x2')]}}; \ No newline at end of file +var _0x160c=['moment','sequelize','exports','STRING','DATE'];(function(_0xe7a99e,_0x4902a1){var _0x3bef5c=function(_0x60e02b){while(--_0x60e02b){_0xe7a99e['push'](_0xe7a99e['shift']());}};_0x3bef5c(++_0x4902a1);}(_0x160c,0x122));var _0xc160=function(_0x149e72,_0x376fc9){_0x149e72=_0x149e72-0x0;var _0x2ed697=_0x160c[_0x149e72];return _0x2ed697;};'use strict';var moment=require(_0xc160('0x0'));var Sequelize=require(_0xc160('0x1'));module[_0xc160('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc160('0x3')]},'joinAt':{'type':Sequelize[_0xc160('0x4')]},'leaveAt':{'type':Sequelize[_0xc160('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc160('0x4')]},'reason':{'type':Sequelize[_0xc160('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d680505..3ecc918 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 _0x25b5=['fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','index','map','FaxQueueReport','rawAttributes'];(function(_0x4e551d,_0x35505b){var _0x582ca5=function(_0x87643c){while(--_0x87643c){_0x4e551d['push'](_0x4e551d['shift']());}};_0x582ca5(++_0x35505b);}(_0x25b5,0x198));var _0x525b=function(_0x68282c,_0x186675){_0x68282c=_0x68282c-0x0;var _0x208ab6=_0x25b5[_0x68282c];return _0x208ab6;};'use strict';var emlformat=require(_0x525b('0x0'));var rimraf=require(_0x525b('0x1'));var zipdir=require(_0x525b('0x2'));var jsonpatch=require(_0x525b('0x3'));var rp=require(_0x525b('0x4'));var moment=require('moment');var BPromise=require(_0x525b('0x5'));var Mustache=require(_0x525b('0x6'));var util=require(_0x525b('0x7'));var path=require(_0x525b('0x8'));var sox=require(_0x525b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x525b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x525b('0xb'));var jsforce=require(_0x525b('0xc'));var deskjs=require(_0x525b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x525b('0xe'));var Papa=require(_0x525b('0xf'));var Redis=require(_0x525b('0x10'));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(_0x525b('0x11'))(_0x525b('0x12'));var utils=require('../../config/utils');var config=require(_0x525b('0x13'));var licenseUtil=require(_0x525b('0x14'));var db=require(_0x525b('0x15'))['db'];function respondWithStatusCode(_0x5e5fb7,_0x4dd1ca){_0x4dd1ca=_0x4dd1ca||0xcc;return function(_0x182ce8){if(_0x182ce8){return _0x5e5fb7[_0x525b('0x16')](_0x4dd1ca);}return _0x5e5fb7[_0x525b('0x17')](_0x4dd1ca)[_0x525b('0x18')]();};}function respondWithResult(_0xde75c3,_0x3897d5){_0x3897d5=_0x3897d5||0xc8;return function(_0x281bf4){if(_0x281bf4){return _0xde75c3[_0x525b('0x17')](_0x3897d5)[_0x525b('0x19')](_0x281bf4);}};}function respondWithFilteredResult(_0x28de50,_0xe1ace){return function(_0x4d5059){if(_0x4d5059){var _0x580429=typeof _0xe1ace[_0x525b('0x1a')]===_0x525b('0x1b')&&typeof _0xe1ace['limit']==='undefined';var _0x43b941=_0x4d5059[_0x525b('0x1c')];var _0x1cc987=_0x580429?0x0:_0xe1ace['offset'];var _0x19eabd=_0x580429?_0x4d5059[_0x525b('0x1c')]:_0xe1ace[_0x525b('0x1a')]+_0xe1ace['limit'];var _0x4db72e;if(_0x19eabd>=_0x43b941){_0x19eabd=_0x43b941;_0x4db72e=0xc8;}else{_0x4db72e=0xce;}_0x28de50['status'](_0x4db72e);return _0x28de50[_0x525b('0x1d')](_0x525b('0x1e'),_0x1cc987+'-'+_0x19eabd+'/'+_0x43b941)[_0x525b('0x19')](_0x4d5059);}return null;};}function patchUpdates(_0xe41f69){return function(_0x14da20){try{jsonpatch[_0x525b('0x1f')](_0x14da20,_0xe41f69,!![]);}catch(_0x41ad32){return BPromise[_0x525b('0x20')](_0x41ad32);}return _0x14da20[_0x525b('0x21')]();};}function saveUpdates(_0x5373fc,_0x22b7f3){return function(_0x3357a7){if(_0x3357a7){return _0x3357a7[_0x525b('0x22')](_0x5373fc)['then'](function(_0x1ebc2b){return _0x1ebc2b;});}return null;};}function removeEntity(_0x29b5dc,_0x40dbc7){return function(_0x4bfd2b){if(_0x4bfd2b){return _0x4bfd2b['destroy']()[_0x525b('0x23')](function(){_0x29b5dc[_0x525b('0x17')](0xcc)[_0x525b('0x18')]();});}};}function handleEntityNotFound(_0x5c0f0c,_0x466baa){return function(_0x3e250b){if(!_0x3e250b){_0x5c0f0c[_0x525b('0x16')](0x194);}return _0x3e250b;};}function handleError(_0x3f71ff,_0x19b964){_0x19b964=_0x19b964||0x1f4;return function(_0x2fbe49){logger[_0x525b('0x24')](_0x2fbe49[_0x525b('0x25')]);if(_0x2fbe49['name']){delete _0x2fbe49['name'];}_0x3f71ff[_0x525b('0x17')](_0x19b964)['send'](_0x2fbe49);};}exports[_0x525b('0x26')]=function(_0x23a248,_0x126477){var _0x480645={},_0x51167a={},_0xbb36d6={'count':0x0,'rows':[]};var _0x3b2029=_[_0x525b('0x27')](db[_0x525b('0x28')][_0x525b('0x29')],function(_0x504b2f){return{'name':_0x504b2f[_0x525b('0x2a')],'type':_0x504b2f[_0x525b('0x2b')][_0x525b('0x2c')]};});_0x51167a['model']=_[_0x525b('0x27')](_0x3b2029,_0x525b('0x2d'));_0x51167a[_0x525b('0x2e')]=_[_0x525b('0x2f')](_0x23a248[_0x525b('0x2e')]);_0x51167a[_0x525b('0x30')]=_['intersection'](_0x51167a[_0x525b('0x31')],_0x51167a[_0x525b('0x2e')]);_0x480645[_0x525b('0x32')]=_[_0x525b('0x33')](_0x51167a[_0x525b('0x31')],qs[_0x525b('0x34')](_0x23a248[_0x525b('0x2e')][_0x525b('0x34')]));_0x480645[_0x525b('0x32')]=_0x480645['attributes']['length']?_0x480645[_0x525b('0x32')]:_0x51167a['model'];if(!_0x23a248['query'][_0x525b('0x35')]('nolimit')){_0x480645['limit']=qs['limit'](_0x23a248[_0x525b('0x2e')][_0x525b('0x36')]);_0x480645[_0x525b('0x1a')]=qs[_0x525b('0x1a')](_0x23a248['query'][_0x525b('0x1a')]);}_0x480645[_0x525b('0x37')]=qs[_0x525b('0x38')](_0x23a248[_0x525b('0x2e')][_0x525b('0x38')]);_0x480645[_0x525b('0x39')]=qs[_0x525b('0x30')](_[_0x525b('0x3a')](_0x23a248[_0x525b('0x2e')],_0x51167a[_0x525b('0x30')]),_0x3b2029);if(_0x23a248[_0x525b('0x2e')][_0x525b('0x3b')]){_0x480645[_0x525b('0x39')]=_[_0x525b('0x3c')](_0x480645[_0x525b('0x39')],{'$or':_['map'](_0x3b2029,function(_0x4ee3b9){if(_0x4ee3b9[_0x525b('0x2b')]!==_0x525b('0x3d')){var _0x2c22e0={};_0x2c22e0[_0x4ee3b9[_0x525b('0x2d')]]={'$like':'%'+_0x23a248[_0x525b('0x2e')]['filter']+'%'};return _0x2c22e0;}})});}_0x480645=_[_0x525b('0x3c')]({},_0x480645,_0x23a248[_0x525b('0x3e')]);var _0xe32699={'where':_0x480645[_0x525b('0x39')]};return db[_0x525b('0x28')][_0x525b('0x1c')](_0xe32699)[_0x525b('0x23')](function(_0x257517){_0xbb36d6[_0x525b('0x1c')]=_0x257517;if(_0x23a248[_0x525b('0x2e')][_0x525b('0x3f')]){_0x480645['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x525b('0x40')](_0x480645);})['then'](function(_0xbe1f40){_0xbb36d6['rows']=_0xbe1f40;return _0xbb36d6;})['then'](respondWithFilteredResult(_0x126477,_0x480645))[_0x525b('0x41')](handleError(_0x126477,null));};exports[_0x525b('0x42')]=function(_0x2a45d6,_0x1decb0){var _0x5e7607={'raw':!![],'where':{'id':_0x2a45d6[_0x525b('0x43')]['id']}},_0x111d74={};_0x111d74[_0x525b('0x31')]=_[_0x525b('0x2f')](db[_0x525b('0x28')][_0x525b('0x29')]);_0x111d74[_0x525b('0x2e')]=_['keys'](_0x2a45d6[_0x525b('0x2e')]);_0x111d74['filters']=_[_0x525b('0x33')](_0x111d74[_0x525b('0x31')],_0x111d74[_0x525b('0x2e')]);_0x5e7607[_0x525b('0x32')]=_['intersection'](_0x111d74['model'],qs[_0x525b('0x34')](_0x2a45d6[_0x525b('0x2e')]['fields']));_0x5e7607[_0x525b('0x32')]=_0x5e7607[_0x525b('0x32')][_0x525b('0x44')]?_0x5e7607[_0x525b('0x32')]:_0x111d74[_0x525b('0x31')];if(_0x2a45d6[_0x525b('0x2e')]['includeAll']){_0x5e7607[_0x525b('0x45')]=[{'all':!![]}];}_0x5e7607=_[_0x525b('0x3c')]({},_0x5e7607,_0x2a45d6[_0x525b('0x3e')]);return db['FaxQueueReport'][_0x525b('0x46')](_0x5e7607)[_0x525b('0x23')](handleEntityNotFound(_0x1decb0,null))[_0x525b('0x23')](respondWithResult(_0x1decb0,null))[_0x525b('0x41')](handleError(_0x1decb0,null));};exports['create']=function(_0x5e14db,_0x704a87){return db['FaxQueueReport'][_0x525b('0x47')](_0x5e14db['body'],{})[_0x525b('0x23')](respondWithResult(_0x704a87,0xc9))['catch'](handleError(_0x704a87,null));};exports[_0x525b('0x22')]=function(_0x384074,_0x159d04){if(_0x384074[_0x525b('0x48')]['id']){delete _0x384074[_0x525b('0x48')]['id'];}return db['FaxQueueReport'][_0x525b('0x46')]({'where':{'id':_0x384074[_0x525b('0x43')]['id']}})['then'](handleEntityNotFound(_0x159d04,null))[_0x525b('0x23')](saveUpdates(_0x384074[_0x525b('0x48')],null))[_0x525b('0x23')](respondWithResult(_0x159d04,null))[_0x525b('0x41')](handleError(_0x159d04,null));};exports[_0x525b('0x49')]=function(_0x3cea55,_0x3eb8c2){return db[_0x525b('0x28')][_0x525b('0x46')]({'where':{'id':_0x3cea55[_0x525b('0x43')]['id']}})[_0x525b('0x23')](handleEntityNotFound(_0x3eb8c2,null))[_0x525b('0x23')](removeEntity(_0x3eb8c2,null))[_0x525b('0x41')](handleError(_0x3eb8c2,null));};exports[_0x525b('0x4a')]=function(_0x109d47,_0x4eecf3){return db['FaxQueueReport'][_0x525b('0x4a')]()[_0x525b('0x23')](respondWithResult(_0x4eecf3,null))['catch'](handleError(_0x4eecf3,null));}; \ No newline at end of file +var _0x9224=['merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','FaxQueueReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x9224,0xa3));var _0x4922=function(_0x2940a0,_0x1f4c3c){_0x2940a0=_0x2940a0-0x0;var _0x486341=_0x9224[_0x2940a0];return _0x486341;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4922('0x0'));var zipdir=require(_0x4922('0x1'));var jsonpatch=require(_0x4922('0x2'));var rp=require(_0x4922('0x3'));var moment=require(_0x4922('0x4'));var BPromise=require(_0x4922('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4922('0x6'));var csv=require('to-csv');var ejs=require(_0x4922('0x7'));var fs=require('fs');var fs_extra=require(_0x4922('0x8'));var _=require(_0x4922('0x9'));var squel=require(_0x4922('0xa'));var crypto=require(_0x4922('0xb'));var jsforce=require(_0x4922('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4922('0xd'));var querystring=require(_0x4922('0xe'));var Papa=require('papaparse');var Redis=require(_0x4922('0xf'));var authService=require(_0x4922('0x10'));var qs=require(_0x4922('0x11'));var as=require(_0x4922('0x12'));var hardwareService=require(_0x4922('0x13'));var logger=require(_0x4922('0x14'))(_0x4922('0x15'));var utils=require(_0x4922('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4922('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x410502,_0x45de0c){_0x45de0c=_0x45de0c||0xcc;return function(_0x35ca3d){if(_0x35ca3d){return _0x410502[_0x4922('0x18')](_0x45de0c);}return _0x410502[_0x4922('0x19')](_0x45de0c)['end']();};}function respondWithResult(_0x103fa8,_0x704e23){_0x704e23=_0x704e23||0xc8;return function(_0x542410){if(_0x542410){return _0x103fa8[_0x4922('0x19')](_0x704e23)[_0x4922('0x1a')](_0x542410);}};}function respondWithFilteredResult(_0x15bf3a,_0x3010bb){return function(_0x434f62){if(_0x434f62){var _0x4385d2=typeof _0x3010bb[_0x4922('0x1b')]==='undefined'&&typeof _0x3010bb[_0x4922('0x1c')]==='undefined';var _0x15fe9e=_0x434f62[_0x4922('0x1d')];var _0x1d7fc2=_0x4385d2?0x0:_0x3010bb[_0x4922('0x1b')];var _0x2ef410=_0x4385d2?_0x434f62[_0x4922('0x1d')]:_0x3010bb['offset']+_0x3010bb[_0x4922('0x1c')];var _0x3abfbf;if(_0x2ef410>=_0x15fe9e){_0x2ef410=_0x15fe9e;_0x3abfbf=0xc8;}else{_0x3abfbf=0xce;}_0x15bf3a[_0x4922('0x19')](_0x3abfbf);return _0x15bf3a[_0x4922('0x1e')](_0x4922('0x1f'),_0x1d7fc2+'-'+_0x2ef410+'/'+_0x15fe9e)['json'](_0x434f62);}return null;};}function patchUpdates(_0x2b6a2d){return function(_0x20ef64){try{jsonpatch[_0x4922('0x20')](_0x20ef64,_0x2b6a2d,!![]);}catch(_0x183ec9){return BPromise[_0x4922('0x21')](_0x183ec9);}return _0x20ef64[_0x4922('0x22')]();};}function saveUpdates(_0x1c1243,_0x3b182b){return function(_0x5c766e){if(_0x5c766e){return _0x5c766e[_0x4922('0x23')](_0x1c1243)[_0x4922('0x24')](function(_0x4bd606){return _0x4bd606;});}return null;};}function removeEntity(_0x21859a,_0x23ce8d){return function(_0x4f93cb){if(_0x4f93cb){return _0x4f93cb[_0x4922('0x25')]()['then'](function(){_0x21859a[_0x4922('0x19')](0xcc)[_0x4922('0x26')]();});}};}function handleEntityNotFound(_0x26bb17,_0x4ee748){return function(_0x234ddf){if(!_0x234ddf){_0x26bb17[_0x4922('0x18')](0x194);}return _0x234ddf;};}function handleError(_0xb6bc60,_0x54a80c){_0x54a80c=_0x54a80c||0x1f4;return function(_0x3eb5d){logger['error'](_0x3eb5d[_0x4922('0x27')]);if(_0x3eb5d[_0x4922('0x28')]){delete _0x3eb5d[_0x4922('0x28')];}_0xb6bc60[_0x4922('0x19')](_0x54a80c)[_0x4922('0x29')](_0x3eb5d);};}exports['index']=function(_0x46cd81,_0x4cc26e){var _0x3e3c7d={},_0x416e26={},_0x49fbbd={'count':0x0,'rows':[]};var _0x5d65bd=_['map'](db[_0x4922('0x2a')]['rawAttributes'],function(_0x5e7709){return{'name':_0x5e7709[_0x4922('0x2b')],'type':_0x5e7709[_0x4922('0x2c')]['key']};});_0x416e26[_0x4922('0x2d')]=_[_0x4922('0x2e')](_0x5d65bd,_0x4922('0x28'));_0x416e26['query']=_['keys'](_0x46cd81[_0x4922('0x2f')]);_0x416e26[_0x4922('0x30')]=_[_0x4922('0x31')](_0x416e26['model'],_0x416e26[_0x4922('0x2f')]);_0x3e3c7d[_0x4922('0x32')]=_[_0x4922('0x31')](_0x416e26['model'],qs['fields'](_0x46cd81[_0x4922('0x2f')][_0x4922('0x33')]));_0x3e3c7d['attributes']=_0x3e3c7d[_0x4922('0x32')]['length']?_0x3e3c7d[_0x4922('0x32')]:_0x416e26[_0x4922('0x2d')];if(!_0x46cd81[_0x4922('0x2f')][_0x4922('0x34')](_0x4922('0x35'))){_0x3e3c7d[_0x4922('0x1c')]=qs[_0x4922('0x1c')](_0x46cd81['query'][_0x4922('0x1c')]);_0x3e3c7d[_0x4922('0x1b')]=qs[_0x4922('0x1b')](_0x46cd81[_0x4922('0x2f')][_0x4922('0x1b')]);}_0x3e3c7d[_0x4922('0x36')]=qs[_0x4922('0x37')](_0x46cd81[_0x4922('0x2f')][_0x4922('0x37')]);_0x3e3c7d[_0x4922('0x38')]=qs['filters'](_['pick'](_0x46cd81[_0x4922('0x2f')],_0x416e26[_0x4922('0x30')]),_0x5d65bd);if(_0x46cd81[_0x4922('0x2f')][_0x4922('0x39')]){_0x3e3c7d[_0x4922('0x38')]=_['merge'](_0x3e3c7d['where'],{'$or':_[_0x4922('0x2e')](_0x5d65bd,function(_0x29a332){if(_0x29a332[_0x4922('0x2c')]!==_0x4922('0x3a')){var _0xd56813={};_0xd56813[_0x29a332['name']]={'$like':'%'+_0x46cd81[_0x4922('0x2f')][_0x4922('0x39')]+'%'};return _0xd56813;}})});}_0x3e3c7d=_[_0x4922('0x3b')]({},_0x3e3c7d,_0x46cd81[_0x4922('0x3c')]);var _0x802dad={'where':_0x3e3c7d['where']};return db['FaxQueueReport'][_0x4922('0x1d')](_0x802dad)[_0x4922('0x24')](function(_0x554766){_0x49fbbd[_0x4922('0x1d')]=_0x554766;if(_0x46cd81['query'][_0x4922('0x3d')]){_0x3e3c7d[_0x4922('0x3e')]=[{'all':!![]}];}return db[_0x4922('0x2a')][_0x4922('0x3f')](_0x3e3c7d);})[_0x4922('0x24')](function(_0x499b26){_0x49fbbd['rows']=_0x499b26;return _0x49fbbd;})[_0x4922('0x24')](respondWithFilteredResult(_0x4cc26e,_0x3e3c7d))[_0x4922('0x40')](handleError(_0x4cc26e,null));};exports[_0x4922('0x41')]=function(_0x344dc0,_0x23c883){var _0x1e7f9f={'raw':!![],'where':{'id':_0x344dc0[_0x4922('0x42')]['id']}},_0xa2fec8={};_0xa2fec8[_0x4922('0x2d')]=_['keys'](db[_0x4922('0x2a')][_0x4922('0x43')]);_0xa2fec8[_0x4922('0x2f')]=_[_0x4922('0x44')](_0x344dc0['query']);_0xa2fec8[_0x4922('0x30')]=_[_0x4922('0x31')](_0xa2fec8[_0x4922('0x2d')],_0xa2fec8[_0x4922('0x2f')]);_0x1e7f9f['attributes']=_['intersection'](_0xa2fec8[_0x4922('0x2d')],qs[_0x4922('0x33')](_0x344dc0[_0x4922('0x2f')]['fields']));_0x1e7f9f['attributes']=_0x1e7f9f[_0x4922('0x32')][_0x4922('0x45')]?_0x1e7f9f[_0x4922('0x32')]:_0xa2fec8[_0x4922('0x2d')];if(_0x344dc0[_0x4922('0x2f')][_0x4922('0x3d')]){_0x1e7f9f[_0x4922('0x3e')]=[{'all':!![]}];}_0x1e7f9f=_[_0x4922('0x3b')]({},_0x1e7f9f,_0x344dc0['options']);return db[_0x4922('0x2a')][_0x4922('0x46')](_0x1e7f9f)[_0x4922('0x24')](handleEntityNotFound(_0x23c883,null))[_0x4922('0x24')](respondWithResult(_0x23c883,null))[_0x4922('0x40')](handleError(_0x23c883,null));};exports[_0x4922('0x47')]=function(_0x2bdd8a,_0x2b1375){return db[_0x4922('0x2a')][_0x4922('0x47')](_0x2bdd8a[_0x4922('0x48')],{})[_0x4922('0x24')](respondWithResult(_0x2b1375,0xc9))[_0x4922('0x40')](handleError(_0x2b1375,null));};exports[_0x4922('0x23')]=function(_0x4c7c02,_0x58fadf){if(_0x4c7c02[_0x4922('0x48')]['id']){delete _0x4c7c02['body']['id'];}return db[_0x4922('0x2a')][_0x4922('0x46')]({'where':{'id':_0x4c7c02[_0x4922('0x42')]['id']}})['then'](handleEntityNotFound(_0x58fadf,null))['then'](saveUpdates(_0x4c7c02[_0x4922('0x48')],null))[_0x4922('0x24')](respondWithResult(_0x58fadf,null))['catch'](handleError(_0x58fadf,null));};exports[_0x4922('0x25')]=function(_0x121b03,_0x58d663){return db[_0x4922('0x2a')][_0x4922('0x46')]({'where':{'id':_0x121b03[_0x4922('0x42')]['id']}})[_0x4922('0x24')](handleEntityNotFound(_0x58d663,null))[_0x4922('0x24')](removeEntity(_0x58d663,null))[_0x4922('0x40')](handleError(_0x58d663,null));};exports[_0x4922('0x49')]=function(_0xdd0450,_0x733b92){return db[_0x4922('0x2a')][_0x4922('0x49')]()['then'](respondWithResult(_0x733b92,null))[_0x4922('0x40')](handleError(_0x733b92,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4f86117..9a3e0bf 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x2e8669,_0x1daddc){var _0x501cb9=function(_0x404032){while(--_0x404032){_0x2e8669['push'](_0x2e8669['shift']());}};_0x501cb9(++_0x1daddc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x170a68,_0x4340d3){var _0x2c114a=function(_0x9d99af){while(--_0x9d99af){_0x170a68['push'](_0x170a68['shift']());}};_0x2c114a(++_0x4340d3);}(_0x4975,0x86));var _0x5497=function(_0x43c36f,_0x4be898){_0x43c36f=_0x43c36f-0x0;var _0x3938a0=_0x4975[_0x43c36f];return _0x3938a0;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 959becd..f19e5c3 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 _0xfccb=['options','raw','UpdateFaxQueueReport','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','create','body'];(function(_0x48b012,_0x35586b){var _0x1520ac=function(_0xfce57c){while(--_0xfce57c){_0x48b012['push'](_0x48b012['shift']());}};_0x1520ac(++_0x35586b);}(_0xfccb,0x1f1));var _0xbfcc=function(_0x3258e5,_0x757ef5){_0x3258e5=_0x3258e5-0x0;var _0x12a721=_0xfccb[_0x3258e5];return _0x12a721;};'use strict';var _=require(_0xbfcc('0x0'));var util=require(_0xbfcc('0x1'));var moment=require(_0xbfcc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcc('0x3'));var db=require(_0xbfcc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfcc('0x5'))('rpc');var config=require(_0xbfcc('0x6'));var jayson=require(_0xbfcc('0x7'));var client=jayson['client'][_0xbfcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x831a1b,_0x287374,_0x734b26){return new BPromise(function(_0x5d47d5,_0x400870){return client[_0xbfcc('0x9')](_0x831a1b,_0x734b26)[_0xbfcc('0xa')](function(_0x59e775){logger[_0xbfcc('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x287374,_0xbfcc('0xc'));logger[_0xbfcc('0xd')](_0xbfcc('0xe'),_0x287374,_0xbfcc('0xc'),JSON[_0xbfcc('0xf')](_0x59e775));if(_0x59e775['error']){if(_0x59e775[_0xbfcc('0x10')][_0xbfcc('0x11')]===0x1f4){logger[_0xbfcc('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x287374,_0x59e775[_0xbfcc('0x10')]['message']);return _0x400870(_0x59e775['error'][_0xbfcc('0x12')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x287374,_0x59e775[_0xbfcc('0x10')]['message']);return _0x5d47d5(_0x59e775['error'][_0xbfcc('0x12')]);}else{logger[_0xbfcc('0xb')](_0xbfcc('0x13'),_0x287374,_0xbfcc('0xc'));_0x5d47d5(_0x59e775[_0xbfcc('0x14')][_0xbfcc('0x12')]);}})[_0xbfcc('0x15')](function(_0x535dfd){logger[_0xbfcc('0x10')](_0xbfcc('0x13'),_0x287374,_0x535dfd);_0x400870(_0x535dfd);});});}exports[_0xbfcc('0x16')]=function(_0x334537){var _0x4a54ce=this;return new Promise(function(_0x22977b,_0x1d405d){return db['FaxQueueReport'][_0xbfcc('0x17')](_0x334537[_0xbfcc('0x18')],{'raw':_0x334537[_0xbfcc('0x19')]?_0x334537[_0xbfcc('0x19')][_0xbfcc('0x1a')]===undefined?!![]:![]:!![]})[_0xbfcc('0xa')](function(_0xfdad4d){logger[_0xbfcc('0xb')](_0xbfcc('0x16'),_0x334537);logger[_0xbfcc('0xd')](_0xbfcc('0x16'),_0x334537,JSON[_0xbfcc('0xf')](_0xfdad4d));_0x22977b(_0xfdad4d);})[_0xbfcc('0x15')](function(_0x55a2cd){logger['error'](_0xbfcc('0x16'),_0x55a2cd[_0xbfcc('0x12')],_0x334537);_0x1d405d(_0x4a54ce[_0xbfcc('0x10')](0x1f4,_0x55a2cd[_0xbfcc('0x12')]));});});};exports[_0xbfcc('0x1b')]=function(_0x146484){var _0x5ea12a=this;return new Promise(function(_0x2b6608,_0x37224){return db['FaxQueueReport']['update'](_0x146484['body'],{'raw':_0x146484['options']?_0x146484[_0xbfcc('0x19')][_0xbfcc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146484[_0xbfcc('0x19')]?_0x146484['options']['where']||null:null,'attributes':_0x146484[_0xbfcc('0x19')]?_0x146484[_0xbfcc('0x19')]['attributes']||null:null,'limit':_0x146484[_0xbfcc('0x19')]?_0x146484[_0xbfcc('0x19')][_0xbfcc('0x1c')]||null:null})['then'](function(_0x3853d9){logger[_0xbfcc('0xb')](_0xbfcc('0x1b'),_0x146484);logger['debug']('UpdateFaxQueueReport',_0x146484,JSON[_0xbfcc('0xf')](_0x3853d9));_0x2b6608(_0x3853d9);})['catch'](function(_0x4e0be9){logger[_0xbfcc('0x10')](_0xbfcc('0x1b'),_0x4e0be9['message'],_0x146484);_0x37224(_0x5ea12a['error'](0x1f4,_0x4e0be9[_0xbfcc('0x12')]));});});}; \ No newline at end of file +var _0x219d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util'];(function(_0x3a6446,_0x1c4ac1){var _0x12b443=function(_0x4f14cf){while(--_0x4f14cf){_0x3a6446['push'](_0x3a6446['shift']());}};_0x12b443(++_0x1c4ac1);}(_0x219d,0x1e8));var _0xd219=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x219d[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd219('0x0'));var util=require(_0xd219('0x1'));var moment=require('moment');var BPromise=require(_0xd219('0x2'));var rs=require(_0xd219('0x3'));var fs=require('fs');var Redis=require(_0xd219('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd219('0x5'));var logger=require(_0xd219('0x6'))(_0xd219('0x7'));var config=require(_0xd219('0x8'));var jayson=require(_0xd219('0x9'));var client=jayson['client'][_0xd219('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d7295,_0x30043d,_0x4cd5b3){return new BPromise(function(_0x5d7b48,_0x28e866){return client[_0xd219('0xb')](_0x5d7295,_0x4cd5b3)[_0xd219('0xc')](function(_0x2805bc){logger[_0xd219('0xd')](_0xd219('0xe'),_0x30043d,_0xd219('0xf'));logger[_0xd219('0x10')](_0xd219('0x11'),_0x30043d,_0xd219('0xf'),JSON[_0xd219('0x12')](_0x2805bc));if(_0x2805bc[_0xd219('0x13')]){if(_0x2805bc[_0xd219('0x13')][_0xd219('0x14')]===0x1f4){logger[_0xd219('0x13')](_0xd219('0xe'),_0x30043d,_0x2805bc['error'][_0xd219('0x15')]);return _0x28e866(_0x2805bc[_0xd219('0x13')][_0xd219('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x30043d,_0x2805bc['error'][_0xd219('0x15')]);return _0x5d7b48(_0x2805bc[_0xd219('0x13')][_0xd219('0x15')]);}else{logger['info'](_0xd219('0xe'),_0x30043d,_0xd219('0xf'));_0x5d7b48(_0x2805bc[_0xd219('0x16')][_0xd219('0x15')]);}})[_0xd219('0x17')](function(_0x4711ba){logger[_0xd219('0x13')](_0xd219('0xe'),_0x30043d,_0x4711ba);_0x28e866(_0x4711ba);});});}exports[_0xd219('0x18')]=function(_0x33357f){var _0x28561d=this;return new Promise(function(_0x36f707,_0x54e1ac){return db[_0xd219('0x19')][_0xd219('0x1a')](_0x33357f[_0xd219('0x1b')],{'raw':_0x33357f[_0xd219('0x1c')]?_0x33357f[_0xd219('0x1c')][_0xd219('0x1d')]===undefined?!![]:![]:!![]})[_0xd219('0xc')](function(_0x1d0192){logger[_0xd219('0xd')](_0xd219('0x18'),_0x33357f);logger[_0xd219('0x10')](_0xd219('0x18'),_0x33357f,JSON[_0xd219('0x12')](_0x1d0192));_0x36f707(_0x1d0192);})[_0xd219('0x17')](function(_0x562ac1){logger[_0xd219('0x13')](_0xd219('0x18'),_0x562ac1[_0xd219('0x15')],_0x33357f);_0x54e1ac(_0x28561d[_0xd219('0x13')](0x1f4,_0x562ac1[_0xd219('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x2db0c8){var _0x5a37fd=this;return new Promise(function(_0x4b5068,_0x38a267){return db[_0xd219('0x19')][_0xd219('0x1e')](_0x2db0c8[_0xd219('0x1b')],{'raw':_0x2db0c8[_0xd219('0x1c')]?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2db0c8[_0xd219('0x1c')]?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x1f')]||null:null,'attributes':_0x2db0c8['options']?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x20')]||null:null,'limit':_0x2db0c8[_0xd219('0x1c')]?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x21')]||null:null})[_0xd219('0xc')](function(_0x1de6e6){logger[_0xd219('0xd')](_0xd219('0x22'),_0x2db0c8);logger[_0xd219('0x10')]('UpdateFaxQueueReport',_0x2db0c8,JSON[_0xd219('0x12')](_0x1de6e6));_0x4b5068(_0x1de6e6);})[_0xd219('0x17')](function(_0x33efa6){logger[_0xd219('0x13')](_0xd219('0x22'),_0x33efa6[_0xd219('0x15')],_0x2db0c8);_0x38a267(_0x5a37fd['error'](0x1f4,_0x33efa6[_0xd219('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index aaf9a7a..b13463c 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 _0x85f1=['/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x2daf64,_0x4a3c63){var _0x2c541d=function(_0x47e812){while(--_0x47e812){_0x2daf64['push'](_0x2daf64['shift']());}};_0x2c541d(++_0x4a3c63);}(_0x85f1,0x8d));var _0x185f=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x85f1[_0x22e47a];return _0x15a12a;};'use strict';var multer=require(_0x185f('0x0'));var util=require(_0x185f('0x1'));var path=require(_0x185f('0x2'));var timeout=require(_0x185f('0x3'));var express=require(_0x185f('0x4'));var router=express['Router']();var fs_extra=require(_0x185f('0x5'));var auth=require(_0x185f('0x6'));var interaction=require(_0x185f('0x7'));var config=require(_0x185f('0x8'));var controller=require(_0x185f('0x9'));router[_0x185f('0xa')]('/',auth[_0x185f('0xb')](),controller[_0x185f('0xc')]);router[_0x185f('0xa')](_0x185f('0xd'),auth[_0x185f('0xb')](),controller[_0x185f('0xe')]);router[_0x185f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x185f('0xf')]);router[_0x185f('0x10')]('/',auth['isAuthenticated'](),controller[_0x185f('0x11')]);router[_0x185f('0x12')](_0x185f('0x13'),auth[_0x185f('0xb')](),controller['update']);router['delete'](_0x185f('0x13'),auth[_0x185f('0xb')](),controller[_0x185f('0x14')]);module[_0x185f('0x15')]=router; \ No newline at end of file +var _0x6e8f=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x2359f6,_0x30f20b){var _0x1f716c=function(_0x5cd3b7){while(--_0x5cd3b7){_0x2359f6['push'](_0x2359f6['shift']());}};_0x1f716c(++_0x30f20b);}(_0x6e8f,0x76));var _0xf6e8=function(_0x1d8411,_0x20f72a){_0x1d8411=_0x1d8411-0x0;var _0x3a3833=_0x6e8f[_0x1d8411];return _0x3a3833;};'use strict';var multer=require(_0xf6e8('0x0'));var util=require('util');var path=require(_0xf6e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6e8('0x2'));var router=express[_0xf6e8('0x3')]();var fs_extra=require(_0xf6e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf6e8('0x5'));var config=require(_0xf6e8('0x6'));var controller=require('./faxQueueReport.controller');router[_0xf6e8('0x7')]('/',auth[_0xf6e8('0x8')](),controller[_0xf6e8('0x9')]);router[_0xf6e8('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xf6e8('0xa'),auth[_0xf6e8('0x8')](),controller[_0xf6e8('0xb')]);router['post']('/',auth[_0xf6e8('0x8')](),controller[_0xf6e8('0xc')]);router['put'](_0xf6e8('0xa'),auth[_0xf6e8('0x8')](),controller[_0xf6e8('0xd')]);router[_0xf6e8('0xe')](_0xf6e8('0xa'),auth['isAuthenticated'](),controller[_0xf6e8('0xf')]);module[_0xf6e8('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 1d26254..133d40a 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x48d1a4,_0x5ebcf4){var _0x2f351e=function(_0x28fe2a){while(--_0x28fe2a){_0x48d1a4['push'](_0x48d1a4['shift']());}};_0x2f351e(++_0x5ebcf4);}(_0xe706,0xa3));var _0x6e70=function(_0x10fac0,_0x59160c){_0x10fac0=_0x10fac0-0x0;var _0x22bc13=_0xe706[_0x10fac0];return _0x22bc13;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2ca92f,_0x1fbfc3){var _0x1945b9=function(_0x800cfa){while(--_0x800cfa){_0x2ca92f['push'](_0x2ca92f['shift']());}};_0x1945b9(++_0x1fbfc3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x00bb[_0x2b5eae];return _0x5f3ac9;};'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 34fd7c0..1be4525 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 _0x4ca1=['set','reject','then','destroy','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x3707bf,_0x323600){var _0x24102f=function(_0x316653){while(--_0x316653){_0x3707bf['push'](_0x3707bf['shift']());}};_0x24102f(++_0x323600);}(_0x4ca1,0x190));var _0x14ca=function(_0xfc0021,_0x336a32){_0xfc0021=_0xfc0021-0x0;var _0x5f392c=_0x4ca1[_0xfc0021];return _0x5f392c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14ca('0x0'));var zipdir=require(_0x14ca('0x1'));var jsonpatch=require(_0x14ca('0x2'));var rp=require(_0x14ca('0x3'));var moment=require('moment');var BPromise=require(_0x14ca('0x4'));var Mustache=require(_0x14ca('0x5'));var util=require(_0x14ca('0x6'));var path=require(_0x14ca('0x7'));var sox=require(_0x14ca('0x8'));var csv=require(_0x14ca('0x9'));var ejs=require(_0x14ca('0xa'));var fs=require('fs');var fs_extra=require(_0x14ca('0xb'));var _=require(_0x14ca('0xc'));var squel=require(_0x14ca('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x14ca('0xe'));var toCsv=require(_0x14ca('0x9'));var querystring=require(_0x14ca('0xf'));var Papa=require('papaparse');var Redis=require(_0x14ca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14ca('0x11'));var as=require(_0x14ca('0x12'));var hardwareService=require(_0x14ca('0x13'));var logger=require(_0x14ca('0x14'))(_0x14ca('0x15'));var utils=require('../../config/utils');var config=require(_0x14ca('0x16'));var licenseUtil=require(_0x14ca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1cbd,_0x9a58eb){_0x9a58eb=_0x9a58eb||0xcc;return function(_0x2b3732){if(_0x2b3732){return _0x3e1cbd[_0x14ca('0x18')](_0x9a58eb);}return _0x3e1cbd[_0x14ca('0x19')](_0x9a58eb)[_0x14ca('0x1a')]();};}function respondWithResult(_0x1966ad,_0x5ab639){_0x5ab639=_0x5ab639||0xc8;return function(_0x25e790){if(_0x25e790){return _0x1966ad['status'](_0x5ab639)[_0x14ca('0x1b')](_0x25e790);}};}function respondWithFilteredResult(_0x18f669,_0x163a45){return function(_0x3a38b4){if(_0x3a38b4){var _0x2a0a33=typeof _0x163a45[_0x14ca('0x1c')]===_0x14ca('0x1d')&&typeof _0x163a45[_0x14ca('0x1e')]===_0x14ca('0x1d');var _0x265b84=_0x3a38b4[_0x14ca('0x1f')];var _0x22dd2a=_0x2a0a33?0x0:_0x163a45[_0x14ca('0x1c')];var _0x58c66c=_0x2a0a33?_0x3a38b4[_0x14ca('0x1f')]:_0x163a45[_0x14ca('0x1c')]+_0x163a45['limit'];var _0x46b610;if(_0x58c66c>=_0x265b84){_0x58c66c=_0x265b84;_0x46b610=0xc8;}else{_0x46b610=0xce;}_0x18f669[_0x14ca('0x19')](_0x46b610);return _0x18f669[_0x14ca('0x20')]('Content-Range',_0x22dd2a+'-'+_0x58c66c+'/'+_0x265b84)[_0x14ca('0x1b')](_0x3a38b4);}return null;};}function patchUpdates(_0x3df77b){return function(_0x212287){try{jsonpatch['apply'](_0x212287,_0x3df77b,!![]);}catch(_0x40413e){return BPromise[_0x14ca('0x21')](_0x40413e);}return _0x212287['save']();};}function saveUpdates(_0x10d3d6,_0x360b52){return function(_0x9d24af){if(_0x9d24af){return _0x9d24af['update'](_0x10d3d6)[_0x14ca('0x22')](function(_0x37d575){return _0x37d575;});}return null;};}function removeEntity(_0x5a814c,_0x4de748){return function(_0x54ca32){if(_0x54ca32){return _0x54ca32[_0x14ca('0x23')]()[_0x14ca('0x22')](function(){_0x5a814c[_0x14ca('0x19')](0xcc)[_0x14ca('0x1a')]();});}};}function handleEntityNotFound(_0x593aef,_0x63de39){return function(_0x210ff8){if(!_0x210ff8){_0x593aef[_0x14ca('0x18')](0x194);}return _0x210ff8;};}function handleError(_0x218462,_0x2e14b7){_0x2e14b7=_0x2e14b7||0x1f4;return function(_0x3b84f){logger['error'](_0x3b84f[_0x14ca('0x24')]);if(_0x3b84f[_0x14ca('0x25')]){delete _0x3b84f[_0x14ca('0x25')];}_0x218462[_0x14ca('0x19')](_0x2e14b7)[_0x14ca('0x26')](_0x3b84f);};}exports[_0x14ca('0x27')]=function(_0x459090,_0x2cb2a3){var _0x459a47={},_0x37e070={},_0x37d482={'count':0x0,'rows':[]};var _0x15f787=_['map'](db[_0x14ca('0x28')][_0x14ca('0x29')],function(_0x55ead8){return{'name':_0x55ead8[_0x14ca('0x2a')],'type':_0x55ead8[_0x14ca('0x2b')][_0x14ca('0x2c')]};});_0x37e070[_0x14ca('0x2d')]=_[_0x14ca('0x2e')](_0x15f787,_0x14ca('0x25'));_0x37e070['query']=_[_0x14ca('0x2f')](_0x459090[_0x14ca('0x30')]);_0x37e070[_0x14ca('0x31')]=_['intersection'](_0x37e070['model'],_0x37e070[_0x14ca('0x30')]);_0x459a47['attributes']=_[_0x14ca('0x32')](_0x37e070[_0x14ca('0x2d')],qs['fields'](_0x459090[_0x14ca('0x30')][_0x14ca('0x33')]));_0x459a47[_0x14ca('0x34')]=_0x459a47['attributes']['length']?_0x459a47[_0x14ca('0x34')]:_0x37e070[_0x14ca('0x2d')];if(!_0x459090['query'][_0x14ca('0x35')](_0x14ca('0x36'))){_0x459a47[_0x14ca('0x1e')]=qs[_0x14ca('0x1e')](_0x459090[_0x14ca('0x30')][_0x14ca('0x1e')]);_0x459a47[_0x14ca('0x1c')]=qs[_0x14ca('0x1c')](_0x459090[_0x14ca('0x30')][_0x14ca('0x1c')]);}_0x459a47[_0x14ca('0x37')]=qs[_0x14ca('0x38')](_0x459090[_0x14ca('0x30')][_0x14ca('0x38')]);_0x459a47[_0x14ca('0x39')]=qs[_0x14ca('0x31')](_[_0x14ca('0x3a')](_0x459090[_0x14ca('0x30')],_0x37e070[_0x14ca('0x31')]),_0x15f787);if(_0x459090['query'][_0x14ca('0x3b')]){_0x459a47[_0x14ca('0x39')]=_[_0x14ca('0x3c')](_0x459a47[_0x14ca('0x39')],{'$or':_[_0x14ca('0x2e')](_0x15f787,function(_0x1e10f6){if(_0x1e10f6['type']!==_0x14ca('0x3d')){var _0x300f7c={};_0x300f7c[_0x1e10f6['name']]={'$like':'%'+_0x459090['query'][_0x14ca('0x3b')]+'%'};return _0x300f7c;}})});}_0x459a47=_['merge']({},_0x459a47,_0x459090[_0x14ca('0x3e')]);var _0x205c93={'where':_0x459a47[_0x14ca('0x39')]};return db[_0x14ca('0x28')]['count'](_0x205c93)[_0x14ca('0x22')](function(_0x35c6f8){_0x37d482[_0x14ca('0x1f')]=_0x35c6f8;if(_0x459090[_0x14ca('0x30')]['includeAll']){_0x459a47[_0x14ca('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x14ca('0x40')](_0x459a47);})[_0x14ca('0x22')](function(_0x337f84){_0x37d482['rows']=_0x337f84;return _0x37d482;})[_0x14ca('0x22')](respondWithFilteredResult(_0x2cb2a3,_0x459a47))[_0x14ca('0x41')](handleError(_0x2cb2a3,null));};exports['show']=function(_0x5f0f37,_0x5638b6){var _0x2d64af={'raw':!![],'where':{'id':_0x5f0f37[_0x14ca('0x42')]['id']}},_0x524d3c={};_0x524d3c[_0x14ca('0x2d')]=_['keys'](db[_0x14ca('0x28')][_0x14ca('0x29')]);_0x524d3c[_0x14ca('0x30')]=_[_0x14ca('0x2f')](_0x5f0f37[_0x14ca('0x30')]);_0x524d3c[_0x14ca('0x31')]=_['intersection'](_0x524d3c['model'],_0x524d3c[_0x14ca('0x30')]);_0x2d64af[_0x14ca('0x34')]=_[_0x14ca('0x32')](_0x524d3c[_0x14ca('0x2d')],qs['fields'](_0x5f0f37[_0x14ca('0x30')][_0x14ca('0x33')]));_0x2d64af[_0x14ca('0x34')]=_0x2d64af[_0x14ca('0x34')]['length']?_0x2d64af[_0x14ca('0x34')]:_0x524d3c[_0x14ca('0x2d')];if(_0x5f0f37[_0x14ca('0x30')][_0x14ca('0x43')]){_0x2d64af[_0x14ca('0x3f')]=[{'all':!![]}];}_0x2d64af=_[_0x14ca('0x3c')]({},_0x2d64af,_0x5f0f37['options']);return db[_0x14ca('0x28')][_0x14ca('0x44')](_0x2d64af)[_0x14ca('0x22')](handleEntityNotFound(_0x5638b6,null))[_0x14ca('0x22')](respondWithResult(_0x5638b6,null))['catch'](handleError(_0x5638b6,null));};exports['create']=function(_0x3bfc7d,_0x33f5af){return db[_0x14ca('0x28')][_0x14ca('0x45')](_0x3bfc7d[_0x14ca('0x46')],{})[_0x14ca('0x22')](respondWithResult(_0x33f5af,0xc9))[_0x14ca('0x41')](handleError(_0x33f5af,null));};exports['update']=function(_0x3fbedd,_0x220733){if(_0x3fbedd[_0x14ca('0x46')]['id']){delete _0x3fbedd['body']['id'];}return db[_0x14ca('0x28')][_0x14ca('0x44')]({'where':{'id':_0x3fbedd[_0x14ca('0x42')]['id']}})[_0x14ca('0x22')](handleEntityNotFound(_0x220733,null))[_0x14ca('0x22')](saveUpdates(_0x3fbedd[_0x14ca('0x46')],null))['then'](respondWithResult(_0x220733,null))[_0x14ca('0x41')](handleError(_0x220733,null));};exports['destroy']=function(_0x92436b,_0x4e69e2){return db[_0x14ca('0x28')]['find']({'where':{'id':_0x92436b[_0x14ca('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e69e2,null))[_0x14ca('0x22')](removeEntity(_0x4e69e2,null))[_0x14ca('0x41')](handleError(_0x4e69e2,null));};exports[_0x14ca('0x47')]=function(_0x3628a9,_0x9995e3){return db[_0x14ca('0x28')][_0x14ca('0x47')]()[_0x14ca('0x22')](respondWithResult(_0x9995e3,null))[_0x14ca('0x41')](handleError(_0x9995e3,null));}; \ No newline at end of file +var _0xbcc8=['body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xbcc8,0x97));var _0x8bcc=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xbcc8[_0x1f1511];return _0x1d9ab8;};'use strict';var emlformat=require(_0x8bcc('0x0'));var rimraf=require(_0x8bcc('0x1'));var zipdir=require(_0x8bcc('0x2'));var jsonpatch=require(_0x8bcc('0x3'));var rp=require(_0x8bcc('0x4'));var moment=require(_0x8bcc('0x5'));var BPromise=require(_0x8bcc('0x6'));var Mustache=require(_0x8bcc('0x7'));var util=require(_0x8bcc('0x8'));var path=require('path');var sox=require(_0x8bcc('0x9'));var csv=require(_0x8bcc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bcc('0xb'));var _=require(_0x8bcc('0xc'));var squel=require(_0x8bcc('0xd'));var crypto=require(_0x8bcc('0xe'));var jsforce=require(_0x8bcc('0xf'));var deskjs=require(_0x8bcc('0x10'));var toCsv=require(_0x8bcc('0xa'));var querystring=require('querystring');var Papa=require(_0x8bcc('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bcc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8bcc('0x13'));var config=require(_0x8bcc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bcc('0x15'))['db'];function respondWithStatusCode(_0x44a21d,_0x14c5e6){_0x14c5e6=_0x14c5e6||0xcc;return function(_0x22f506){if(_0x22f506){return _0x44a21d[_0x8bcc('0x16')](_0x14c5e6);}return _0x44a21d[_0x8bcc('0x17')](_0x14c5e6)[_0x8bcc('0x18')]();};}function respondWithResult(_0x231574,_0x306124){_0x306124=_0x306124||0xc8;return function(_0x38cf5e){if(_0x38cf5e){return _0x231574[_0x8bcc('0x17')](_0x306124)['json'](_0x38cf5e);}};}function respondWithFilteredResult(_0x7361f,_0x25c433){return function(_0x458120){if(_0x458120){var _0xf7eb34=typeof _0x25c433[_0x8bcc('0x19')]===_0x8bcc('0x1a')&&typeof _0x25c433[_0x8bcc('0x1b')]===_0x8bcc('0x1a');var _0x38c6a6=_0x458120['count'];var _0x4941d8=_0xf7eb34?0x0:_0x25c433[_0x8bcc('0x19')];var _0xfe175d=_0xf7eb34?_0x458120[_0x8bcc('0x1c')]:_0x25c433[_0x8bcc('0x19')]+_0x25c433['limit'];var _0x407820;if(_0xfe175d>=_0x38c6a6){_0xfe175d=_0x38c6a6;_0x407820=0xc8;}else{_0x407820=0xce;}_0x7361f[_0x8bcc('0x17')](_0x407820);return _0x7361f[_0x8bcc('0x1d')](_0x8bcc('0x1e'),_0x4941d8+'-'+_0xfe175d+'/'+_0x38c6a6)[_0x8bcc('0x1f')](_0x458120);}return null;};}function patchUpdates(_0x5ac5cd){return function(_0x5cd9d4){try{jsonpatch[_0x8bcc('0x20')](_0x5cd9d4,_0x5ac5cd,!![]);}catch(_0x4cc59a){return BPromise[_0x8bcc('0x21')](_0x4cc59a);}return _0x5cd9d4[_0x8bcc('0x22')]();};}function saveUpdates(_0x495846,_0x1c8901){return function(_0x41e534){if(_0x41e534){return _0x41e534['update'](_0x495846)['then'](function(_0x38fb04){return _0x38fb04;});}return null;};}function removeEntity(_0x210935,_0x249d50){return function(_0x5a5b3a){if(_0x5a5b3a){return _0x5a5b3a[_0x8bcc('0x23')]()[_0x8bcc('0x24')](function(){_0x210935[_0x8bcc('0x17')](0xcc)[_0x8bcc('0x18')]();});}};}function handleEntityNotFound(_0x5b18dd,_0x153589){return function(_0x1a4a9d){if(!_0x1a4a9d){_0x5b18dd[_0x8bcc('0x16')](0x194);}return _0x1a4a9d;};}function handleError(_0x122a2c,_0x144c22){_0x144c22=_0x144c22||0x1f4;return function(_0xdd8315){logger[_0x8bcc('0x25')](_0xdd8315[_0x8bcc('0x26')]);if(_0xdd8315[_0x8bcc('0x27')]){delete _0xdd8315[_0x8bcc('0x27')];}_0x122a2c[_0x8bcc('0x17')](_0x144c22)[_0x8bcc('0x28')](_0xdd8315);};}exports[_0x8bcc('0x29')]=function(_0x12b04d,_0x470e63){var _0x107064={},_0x1116b8={},_0x3b7b9b={'count':0x0,'rows':[]};var _0x92b29=_[_0x8bcc('0x2a')](db[_0x8bcc('0x2b')][_0x8bcc('0x2c')],function(_0xf7acd2){return{'name':_0xf7acd2['fieldName'],'type':_0xf7acd2[_0x8bcc('0x2d')][_0x8bcc('0x2e')]};});_0x1116b8['model']=_[_0x8bcc('0x2a')](_0x92b29,'name');_0x1116b8[_0x8bcc('0x2f')]=_[_0x8bcc('0x30')](_0x12b04d[_0x8bcc('0x2f')]);_0x1116b8[_0x8bcc('0x31')]=_['intersection'](_0x1116b8[_0x8bcc('0x32')],_0x1116b8[_0x8bcc('0x2f')]);_0x107064[_0x8bcc('0x33')]=_[_0x8bcc('0x34')](_0x1116b8[_0x8bcc('0x32')],qs[_0x8bcc('0x35')](_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x35')]));_0x107064[_0x8bcc('0x33')]=_0x107064[_0x8bcc('0x33')][_0x8bcc('0x36')]?_0x107064[_0x8bcc('0x33')]:_0x1116b8['model'];if(!_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x37')]('nolimit')){_0x107064['limit']=qs[_0x8bcc('0x1b')](_0x12b04d['query'][_0x8bcc('0x1b')]);_0x107064['offset']=qs[_0x8bcc('0x19')](_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x19')]);}_0x107064[_0x8bcc('0x38')]=qs['sort'](_0x12b04d[_0x8bcc('0x2f')]['sort']);_0x107064[_0x8bcc('0x39')]=qs[_0x8bcc('0x31')](_[_0x8bcc('0x3a')](_0x12b04d['query'],_0x1116b8[_0x8bcc('0x31')]),_0x92b29);if(_0x12b04d['query'][_0x8bcc('0x3b')]){_0x107064[_0x8bcc('0x39')]=_[_0x8bcc('0x3c')](_0x107064['where'],{'$or':_[_0x8bcc('0x2a')](_0x92b29,function(_0xe4f98e){if(_0xe4f98e[_0x8bcc('0x2d')]!==_0x8bcc('0x3d')){var _0x41419a={};_0x41419a[_0xe4f98e[_0x8bcc('0x27')]]={'$like':'%'+_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x3b')]+'%'};return _0x41419a;}})});}_0x107064=_['merge']({},_0x107064,_0x12b04d[_0x8bcc('0x3e')]);var _0x32ba62={'where':_0x107064[_0x8bcc('0x39')]};return db[_0x8bcc('0x2b')]['count'](_0x32ba62)[_0x8bcc('0x24')](function(_0x53008e){_0x3b7b9b['count']=_0x53008e;if(_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x3f')]){_0x107064['include']=[{'all':!![]}];}return db[_0x8bcc('0x2b')][_0x8bcc('0x40')](_0x107064);})[_0x8bcc('0x24')](function(_0x42962f){_0x3b7b9b[_0x8bcc('0x41')]=_0x42962f;return _0x3b7b9b;})['then'](respondWithFilteredResult(_0x470e63,_0x107064))[_0x8bcc('0x42')](handleError(_0x470e63,null));};exports[_0x8bcc('0x43')]=function(_0x529f5c,_0x4ea065){var _0x5e76d2={'raw':!![],'where':{'id':_0x529f5c['params']['id']}},_0x35de48={};_0x35de48[_0x8bcc('0x32')]=_[_0x8bcc('0x30')](db['FaxTransferReport'][_0x8bcc('0x2c')]);_0x35de48[_0x8bcc('0x2f')]=_[_0x8bcc('0x30')](_0x529f5c[_0x8bcc('0x2f')]);_0x35de48[_0x8bcc('0x31')]=_[_0x8bcc('0x34')](_0x35de48[_0x8bcc('0x32')],_0x35de48[_0x8bcc('0x2f')]);_0x5e76d2['attributes']=_[_0x8bcc('0x34')](_0x35de48[_0x8bcc('0x32')],qs[_0x8bcc('0x35')](_0x529f5c['query'][_0x8bcc('0x35')]));_0x5e76d2['attributes']=_0x5e76d2[_0x8bcc('0x33')][_0x8bcc('0x36')]?_0x5e76d2[_0x8bcc('0x33')]:_0x35de48[_0x8bcc('0x32')];if(_0x529f5c[_0x8bcc('0x2f')]['includeAll']){_0x5e76d2[_0x8bcc('0x44')]=[{'all':!![]}];}_0x5e76d2=_[_0x8bcc('0x3c')]({},_0x5e76d2,_0x529f5c['options']);return db['FaxTransferReport'][_0x8bcc('0x45')](_0x5e76d2)[_0x8bcc('0x24')](handleEntityNotFound(_0x4ea065,null))[_0x8bcc('0x24')](respondWithResult(_0x4ea065,null))[_0x8bcc('0x42')](handleError(_0x4ea065,null));};exports[_0x8bcc('0x46')]=function(_0x30538f,_0x2b7b52){return db['FaxTransferReport'][_0x8bcc('0x46')](_0x30538f[_0x8bcc('0x47')],{})[_0x8bcc('0x24')](respondWithResult(_0x2b7b52,0xc9))[_0x8bcc('0x42')](handleError(_0x2b7b52,null));};exports['update']=function(_0x2fb4a7,_0x456ecd){if(_0x2fb4a7['body']['id']){delete _0x2fb4a7['body']['id'];}return db[_0x8bcc('0x2b')]['find']({'where':{'id':_0x2fb4a7['params']['id']}})[_0x8bcc('0x24')](handleEntityNotFound(_0x456ecd,null))[_0x8bcc('0x24')](saveUpdates(_0x2fb4a7[_0x8bcc('0x47')],null))[_0x8bcc('0x24')](respondWithResult(_0x456ecd,null))[_0x8bcc('0x42')](handleError(_0x456ecd,null));};exports[_0x8bcc('0x23')]=function(_0x505bf9,_0xab9d6b){return db['FaxTransferReport']['find']({'where':{'id':_0x505bf9[_0x8bcc('0x48')]['id']}})['then'](handleEntityNotFound(_0xab9d6b,null))[_0x8bcc('0x24')](removeEntity(_0xab9d6b,null))[_0x8bcc('0x42')](handleError(_0xab9d6b,null));};exports[_0x8bcc('0x49')]=function(_0x3a0409,_0x108677){return db[_0x8bcc('0x2b')]['describe']()[_0x8bcc('0x24')](respondWithResult(_0x108677,null))[_0x8bcc('0x42')](handleError(_0x108677,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 85730d7..ea6628f 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 _0xfd2e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd2e,0x1a3));var _0xefd2=function(_0x353cd8,_0x1ee5cb){_0x353cd8=_0x353cd8-0x0;var _0x553bc6=_0xfd2e[_0x353cd8];return _0x553bc6;};'use strict';var _=require(_0xefd2('0x0'));var util=require(_0xefd2('0x1'));var logger=require(_0xefd2('0x2'))(_0xefd2('0x3'));var moment=require(_0xefd2('0x4'));var BPromise=require(_0xefd2('0x5'));var rp=require(_0xefd2('0x6'));var fs=require('fs');var path=require(_0xefd2('0x7'));var rimraf=require(_0xefd2('0x8'));var config=require('../../config/environment');var attributes=require(_0xefd2('0x9'));module[_0xefd2('0xa')]=function(_0x3d539c,_0xa7869f){return _0x3d539c[_0xefd2('0xb')](_0xefd2('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xefd2('0xd'),'fields':[_0xefd2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc5e=['bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1601ad,_0x4e4a92){var _0x3973aa=function(_0x39f34d){while(--_0x39f34d){_0x1601ad['push'](_0x1601ad['shift']());}};_0x3973aa(++_0x4e4a92);}(_0xbc5e,0x7d));var _0xebc5=function(_0x5b6332,_0x3a3348){_0x5b6332=_0x5b6332-0x0;var _0x1f315d=_0xbc5e[_0x5b6332];return _0x1f315d;};'use strict';var _=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var logger=require(_0xebc5('0x2'))(_0xebc5('0x3'));var moment=require(_0xebc5('0x4'));var BPromise=require(_0xebc5('0x5'));var rp=require(_0xebc5('0x6'));var fs=require('fs');var path=require(_0xebc5('0x7'));var rimraf=require(_0xebc5('0x8'));var config=require('../../config/environment');var attributes=require(_0xebc5('0x9'));module[_0xebc5('0xa')]=function(_0x19f4c6,_0x2cbf91){return _0x19f4c6[_0xebc5('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xebc5('0xc'),'fields':[_0xebc5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4c83b9f..9ca8d31 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 _0x6c3b=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x6c3b,0x1bd));var _0xb6c3=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x6c3b[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xb6c3('0x0'));var util=require(_0xb6c3('0x1'));var moment=require(_0xb6c3('0x2'));var BPromise=require(_0xb6c3('0x3'));var rs=require(_0xb6c3('0x4'));var fs=require('fs');var Redis=require(_0xb6c3('0x5'));var db=require(_0xb6c3('0x6'))['db'];var utils=require(_0xb6c3('0x7'));var logger=require(_0xb6c3('0x8'))('rpc');var config=require(_0xb6c3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb6c3('0xa')][_0xb6c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45da9e,_0x3c1f28,_0x1ded4e){return new BPromise(function(_0x598275,_0x65d488){return client[_0xb6c3('0xc')](_0x45da9e,_0x1ded4e)[_0xb6c3('0xd')](function(_0x23b58c){logger[_0xb6c3('0xe')](_0xb6c3('0xf'),_0x3c1f28,_0xb6c3('0x10'));logger[_0xb6c3('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3c1f28,_0xb6c3('0x10'),JSON[_0xb6c3('0x12')](_0x23b58c));if(_0x23b58c[_0xb6c3('0x13')]){if(_0x23b58c['error'][_0xb6c3('0x14')]===0x1f4){logger[_0xb6c3('0x13')](_0xb6c3('0xf'),_0x3c1f28,_0x23b58c['error'][_0xb6c3('0x15')]);return _0x65d488(_0x23b58c[_0xb6c3('0x13')][_0xb6c3('0x15')]);}logger[_0xb6c3('0x13')](_0xb6c3('0xf'),_0x3c1f28,_0x23b58c[_0xb6c3('0x13')]['message']);return _0x598275(_0x23b58c[_0xb6c3('0x13')][_0xb6c3('0x15')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x3c1f28,_0xb6c3('0x10'));_0x598275(_0x23b58c['result'][_0xb6c3('0x15')]);}})[_0xb6c3('0x16')](function(_0x4acf56){logger[_0xb6c3('0x13')](_0xb6c3('0xf'),_0x3c1f28,_0x4acf56);_0x65d488(_0x4acf56);});});} \ No newline at end of file +var _0xc902=['../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x546163,_0x2d4d18){var _0x1a07cb=function(_0x29f7e3){while(--_0x29f7e3){_0x546163['push'](_0x546163['shift']());}};_0x1a07cb(++_0x2d4d18);}(_0xc902,0xd3));var _0x2c90=function(_0x30281e,_0x206593){_0x30281e=_0x30281e-0x0;var _0x2ea42=_0xc902[_0x30281e];return _0x2ea42;};'use strict';var _=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var moment=require('moment');var BPromise=require(_0x2c90('0x2'));var rs=require(_0x2c90('0x3'));var fs=require('fs');var Redis=require(_0x2c90('0x4'));var db=require(_0x2c90('0x5'))['db'];var utils=require(_0x2c90('0x6'));var logger=require(_0x2c90('0x7'))(_0x2c90('0x8'));var config=require(_0x2c90('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2c90('0xa')][_0x2c90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e36d6,_0x38c95f,_0x120e98){return new BPromise(function(_0x52c707,_0x377ccc){return client[_0x2c90('0xc')](_0x1e36d6,_0x120e98)[_0x2c90('0xd')](function(_0x5913ba){logger[_0x2c90('0xe')](_0x2c90('0xf'),_0x38c95f,_0x2c90('0x10'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x38c95f,'request\x20sent',JSON['stringify'](_0x5913ba));if(_0x5913ba[_0x2c90('0x11')]){if(_0x5913ba['error']['code']===0x1f4){logger[_0x2c90('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x38c95f,_0x5913ba[_0x2c90('0x11')][_0x2c90('0x12')]);return _0x377ccc(_0x5913ba[_0x2c90('0x11')][_0x2c90('0x12')]);}logger['error'](_0x2c90('0xf'),_0x38c95f,_0x5913ba[_0x2c90('0x11')][_0x2c90('0x12')]);return _0x52c707(_0x5913ba['error'][_0x2c90('0x12')]);}else{logger[_0x2c90('0xe')](_0x2c90('0xf'),_0x38c95f,_0x2c90('0x10'));_0x52c707(_0x5913ba[_0x2c90('0x13')][_0x2c90('0x12')]);}})['catch'](function(_0xaa377a){logger[_0x2c90('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x38c95f,_0xaa377a);_0x377ccc(_0xaa377a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d3e1b99..941b7e1 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 _0xeb30=['show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0xeb30,0x1e2));var _0x0eb3=function(_0x1d90f2,_0x5e3c86){_0x1d90f2=_0x1d90f2-0x0;var _0xbbd6ab=_0xeb30[_0x1d90f2];return _0xbbd6ab;};'use strict';var multer=require(_0x0eb3('0x0'));var util=require('util');var path=require(_0x0eb3('0x1'));var timeout=require(_0x0eb3('0x2'));var express=require(_0x0eb3('0x3'));var router=express[_0x0eb3('0x4')]();var fs_extra=require(_0x0eb3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0eb3('0x6'));router[_0x0eb3('0x7')]('/',auth[_0x0eb3('0x8')](),controller[_0x0eb3('0x9')]);router[_0x0eb3('0x7')]('/describe',auth[_0x0eb3('0x8')](),controller[_0x0eb3('0xa')]);router[_0x0eb3('0x7')](_0x0eb3('0xb'),auth[_0x0eb3('0x8')](),controller[_0x0eb3('0xc')]);router[_0x0eb3('0xd')]('/',auth[_0x0eb3('0x8')](),controller[_0x0eb3('0xe')]);router[_0x0eb3('0xf')](_0x0eb3('0xb'),auth[_0x0eb3('0x8')](),controller[_0x0eb3('0x10')]);router[_0x0eb3('0x11')](_0x0eb3('0xb'),auth[_0x0eb3('0x8')](),controller[_0x0eb3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb9f8=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x17da62,_0x4ad6c1){var _0x2e7612=function(_0x373bf2){while(--_0x373bf2){_0x17da62['push'](_0x17da62['shift']());}};_0x2e7612(++_0x4ad6c1);}(_0xb9f8,0x16e));var _0x8b9f=function(_0x15662c,_0x579549){_0x15662c=_0x15662c-0x0;var _0x169164=_0xb9f8[_0x15662c];return _0x169164;};'use strict';var multer=require(_0x8b9f('0x0'));var util=require(_0x8b9f('0x1'));var path=require(_0x8b9f('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b9f('0x3'));var router=express[_0x8b9f('0x4')]();var fs_extra=require(_0x8b9f('0x5'));var auth=require(_0x8b9f('0x6'));var interaction=require(_0x8b9f('0x7'));var config=require(_0x8b9f('0x8'));var controller=require(_0x8b9f('0x9'));router[_0x8b9f('0xa')]('/',auth[_0x8b9f('0xb')](),controller[_0x8b9f('0xc')]);router[_0x8b9f('0xa')](_0x8b9f('0xd'),auth['isAuthenticated'](),controller[_0x8b9f('0xe')]);router[_0x8b9f('0xa')](_0x8b9f('0xf'),auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x10')]);router[_0x8b9f('0x11')]('/',auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x12')]);router[_0x8b9f('0x13')](_0x8b9f('0xf'),auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x14')]);router[_0x8b9f('0x15')](_0x8b9f('0xf'),auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x16')]);module[_0x8b9f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c21e3fe..8642d28 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 _0xeec7=['addConfiguration','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x11160d,_0x413adc){var _0x21520a=function(_0x272f3c){while(--_0x272f3c){_0x11160d['push'](_0x11160d['shift']());}};_0x21520a(++_0x413adc);}(_0xeec7,0x123));var _0x7eec=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0xeec7[_0x29c261];return _0x1a9335;};'use strict';var multer=require(_0x7eec('0x0'));var util=require(_0x7eec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7eec('0x2'));var router=express[_0x7eec('0x3')]();var fs_extra=require(_0x7eec('0x4'));var auth=require(_0x7eec('0x5'));var interaction=require(_0x7eec('0x6'));var config=require('../../config/environment');var controller=require(_0x7eec('0x7'));router[_0x7eec('0x8')]('/',auth[_0x7eec('0x9')](),controller[_0x7eec('0xa')]);router[_0x7eec('0x8')](_0x7eec('0xb'),auth[_0x7eec('0x9')](),controller[_0x7eec('0xc')]);router[_0x7eec('0x8')](_0x7eec('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7eec('0x8')](_0x7eec('0xe'),auth['isAuthenticated'](),controller[_0x7eec('0xf')]);router[_0x7eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7eec('0xd'),auth[_0x7eec('0x9')](),controller[_0x7eec('0x11')]);router[_0x7eec('0x12')]('/:id',auth[_0x7eec('0x9')](),controller['update']);router[_0x7eec('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7eec('0x14')]);module[_0x7eec('0x15')]=router; \ No newline at end of file +var _0x92d7=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x92d7,0xb3));var _0x792d=function(_0x21b012,_0x57f37a){_0x21b012=_0x21b012-0x0;var _0x253fb9=_0x92d7[_0x21b012];return _0x253fb9;};'use strict';var multer=require(_0x792d('0x0'));var util=require(_0x792d('0x1'));var path=require(_0x792d('0x2'));var timeout=require(_0x792d('0x3'));var express=require(_0x792d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x792d('0x5'));var interaction=require(_0x792d('0x6'));var config=require(_0x792d('0x7'));var controller=require('./intDeskAccount.controller');router[_0x792d('0x8')]('/',auth['isAuthenticated'](),controller[_0x792d('0x9')]);router['get'](_0x792d('0xa'),auth[_0x792d('0xb')](),controller[_0x792d('0xc')]);router[_0x792d('0x8')](_0x792d('0xd'),auth[_0x792d('0xb')](),controller[_0x792d('0xe')]);router[_0x792d('0x8')](_0x792d('0xf'),auth[_0x792d('0xb')](),controller[_0x792d('0x10')]);router[_0x792d('0x11')]('/',auth[_0x792d('0xb')](),controller[_0x792d('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x792d('0x13')]);router['put']('/:id',auth[_0x792d('0xb')](),controller[_0x792d('0x14')]);router[_0x792d('0x15')]('/:id',auth[_0x792d('0xb')](),controller[_0x792d('0x16')]);module[_0x792d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c460f15..4b14ff8 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 _0xcce3=['sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x32d062,_0x2138f5){var _0x80e072=function(_0x3988c9){while(--_0x3988c9){_0x32d062['push'](_0x32d062['shift']());}};_0x80e072(++_0x2138f5);}(_0xcce3,0x1c2));var _0x3cce=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0xcce3[_0x2962b4];return _0x411b7d;};'use strict';var Sequelize=require(_0x3cce('0x0'));module[_0x3cce('0x1')]={'name':{'type':Sequelize[_0x3cce('0x2')]},'description':{'type':Sequelize[_0x3cce('0x2')]},'username':{'type':Sequelize[_0x3cce('0x2')]},'remoteUri':{'type':Sequelize[_0x3cce('0x2')]},'authType':{'type':Sequelize[_0x3cce('0x3')](_0x3cce('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x3cce('0x2')]},'consumerSecret':{'type':Sequelize[_0x3cce('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x3cce('0x2')]},'serverUrl':{'type':Sequelize[_0x3cce('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3cce('0x3')](_0x3cce('0x5'),'newTab'),'defaultValue':_0x3cce('0x5')}}; \ No newline at end of file +var _0x5420=['integrationTab','newTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x5420,0x16e));var _0x0542=function(_0x435b2b,_0x2ae02c){_0x435b2b=_0x435b2b-0x0;var _0x4b88f6=_0x5420[_0x435b2b];return _0x4b88f6;};'use strict';var Sequelize=require(_0x0542('0x0'));module[_0x0542('0x1')]={'name':{'type':Sequelize[_0x0542('0x2')]},'description':{'type':Sequelize[_0x0542('0x2')]},'username':{'type':Sequelize[_0x0542('0x2')]},'remoteUri':{'type':Sequelize[_0x0542('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x0542('0x3')),'defaultValue':_0x0542('0x3')},'password':{'type':Sequelize[_0x0542('0x2')]},'consumerKey':{'type':Sequelize[_0x0542('0x2')]},'consumerSecret':{'type':Sequelize[_0x0542('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x0542('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0542('0x4')](_0x0542('0x5'),_0x0542('0x6')),'defaultValue':_0x0542('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 901cc4d..cd47c4c 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 _0xfba0=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','options','include','findAll','rows','params','intersection','fields','includeAll','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','filter','nolimit','addConfiguration','AccountId','getSubjects','getDescriptions','channel','Subjects','DeskField','getFields','priority','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','%s:%s','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0xfba0,0xcb));var _0x0fba=function(_0x15dfe4,_0x4a7b33){_0x15dfe4=_0x15dfe4-0x0;var _0x5277b9=_0xfba0[_0x15dfe4];return _0x5277b9;};'use strict';var emlformat=require(_0x0fba('0x0'));var rimraf=require(_0x0fba('0x1'));var zipdir=require(_0x0fba('0x2'));var jsonpatch=require(_0x0fba('0x3'));var rp=require(_0x0fba('0x4'));var moment=require(_0x0fba('0x5'));var BPromise=require(_0x0fba('0x6'));var Mustache=require('mustache');var util=require(_0x0fba('0x7'));var path=require(_0x0fba('0x8'));var sox=require('sox');var csv=require(_0x0fba('0x9'));var ejs=require(_0x0fba('0xa'));var fs=require('fs');var fs_extra=require(_0x0fba('0xb'));var _=require(_0x0fba('0xc'));var squel=require(_0x0fba('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fba('0xe'));var deskjs=require(_0x0fba('0xf'));var toCsv=require(_0x0fba('0x9'));var querystring=require(_0x0fba('0x10'));var Papa=require(_0x0fba('0x11'));var Redis=require(_0x0fba('0x12'));var authService=require(_0x0fba('0x13'));var qs=require(_0x0fba('0x14'));var as=require(_0x0fba('0x15'));var hardwareService=require(_0x0fba('0x16'));var logger=require(_0x0fba('0x17'))(_0x0fba('0x18'));var utils=require(_0x0fba('0x19'));var config=require(_0x0fba('0x1a'));var licenseUtil=require(_0x0fba('0x1b'));var db=require(_0x0fba('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xc24fa,_0x3141f5){_0x3141f5=_0x3141f5||0xcc;return function(_0x59165e){if(_0x59165e){return _0xc24fa[_0x0fba('0x1d')](_0x3141f5);}return _0xc24fa[_0x0fba('0x1e')](_0x3141f5)[_0x0fba('0x1f')]();};}function respondWithResult(_0x162ca1,_0x2aabfe){_0x2aabfe=_0x2aabfe||0xc8;return function(_0x1c3997){if(_0x1c3997){return _0x162ca1['status'](_0x2aabfe)[_0x0fba('0x20')](_0x1c3997);}};}function respondWithFilteredResult(_0x59e287,_0x5bfbfb){return function(_0x538d00){if(_0x538d00){var _0x3866f9=typeof _0x5bfbfb[_0x0fba('0x21')]===_0x0fba('0x22')&&typeof _0x5bfbfb[_0x0fba('0x23')]===_0x0fba('0x22');var _0x58ccc8=_0x538d00[_0x0fba('0x24')];var _0x3845ac=_0x3866f9?0x0:_0x5bfbfb['offset'];var _0x111700=_0x3866f9?_0x538d00[_0x0fba('0x24')]:_0x5bfbfb['offset']+_0x5bfbfb['limit'];var _0x572e9f;if(_0x111700>=_0x58ccc8){_0x111700=_0x58ccc8;_0x572e9f=0xc8;}else{_0x572e9f=0xce;}_0x59e287[_0x0fba('0x1e')](_0x572e9f);return _0x59e287[_0x0fba('0x25')](_0x0fba('0x26'),_0x3845ac+'-'+_0x111700+'/'+_0x58ccc8)[_0x0fba('0x20')](_0x538d00);}return null;};}function patchUpdates(_0x53e84a){return function(_0x2fc2f8){try{jsonpatch[_0x0fba('0x27')](_0x2fc2f8,_0x53e84a,!![]);}catch(_0x4129a6){return BPromise['reject'](_0x4129a6);}return _0x2fc2f8[_0x0fba('0x28')]();};}function saveUpdates(_0x563eda,_0x1483ad){return function(_0x46bce7){if(_0x46bce7){return _0x46bce7[_0x0fba('0x29')](_0x563eda)[_0x0fba('0x2a')](function(_0x421266){return _0x421266;});}return null;};}function removeEntity(_0x400767,_0x32dd20){return function(_0x59a2be){if(_0x59a2be){return _0x59a2be['destroy']()[_0x0fba('0x2a')](function(){_0x400767[_0x0fba('0x1e')](0xcc)[_0x0fba('0x1f')]();});}};}function handleEntityNotFound(_0x5c3947,_0x14ddf4){return function(_0x474a76){if(!_0x474a76){_0x5c3947[_0x0fba('0x1d')](0x194);}return _0x474a76;};}function handleError(_0x59ce66,_0x2ba0ad){_0x2ba0ad=_0x2ba0ad||0x1f4;return function(_0x2e284d){logger[_0x0fba('0x2b')](_0x2e284d[_0x0fba('0x2c')]);if(_0x2e284d[_0x0fba('0x2d')]){delete _0x2e284d[_0x0fba('0x2d')];}_0x59ce66['status'](_0x2ba0ad)['send'](_0x2e284d);};}exports[_0x0fba('0x2e')]=function(_0x390abb,_0x2fc841){var _0x12d8ec={},_0x565c38={},_0x3a0884={'count':0x0,'rows':[]};var _0x13282d=_[_0x0fba('0x2f')](db[_0x0fba('0x30')][_0x0fba('0x31')],function(_0x33fe5f){return{'name':_0x33fe5f[_0x0fba('0x32')],'type':_0x33fe5f[_0x0fba('0x33')][_0x0fba('0x34')]};});_0x565c38[_0x0fba('0x35')]=_['map'](_0x13282d,'name');_0x565c38[_0x0fba('0x36')]=_[_0x0fba('0x37')](_0x390abb['query']);_0x565c38['filters']=_['intersection'](_0x565c38['model'],_0x565c38[_0x0fba('0x36')]);_0x12d8ec['attributes']=_['intersection'](_0x565c38[_0x0fba('0x35')],qs['fields'](_0x390abb['query']['fields']));_0x12d8ec[_0x0fba('0x38')]=_0x12d8ec[_0x0fba('0x38')][_0x0fba('0x39')]?_0x12d8ec[_0x0fba('0x38')]:_0x565c38[_0x0fba('0x35')];if(!_0x390abb['query'][_0x0fba('0x3a')]('nolimit')){_0x12d8ec['limit']=qs['limit'](_0x390abb['query']['limit']);_0x12d8ec[_0x0fba('0x21')]=qs['offset'](_0x390abb[_0x0fba('0x36')]['offset']);}_0x12d8ec[_0x0fba('0x3b')]=qs[_0x0fba('0x3c')](_0x390abb[_0x0fba('0x36')][_0x0fba('0x3c')]);_0x12d8ec[_0x0fba('0x3d')]=qs[_0x0fba('0x3e')](_['pick'](_0x390abb[_0x0fba('0x36')],_0x565c38[_0x0fba('0x3e')]),_0x13282d);if(_0x390abb['query']['filter']){_0x12d8ec[_0x0fba('0x3d')]=_[_0x0fba('0x3f')](_0x12d8ec['where'],{'$or':_[_0x0fba('0x2f')](_0x13282d,function(_0x2ad1f4){if(_0x2ad1f4[_0x0fba('0x33')]!==_0x0fba('0x40')){var _0x4e11eb={};_0x4e11eb[_0x2ad1f4[_0x0fba('0x2d')]]={'$like':'%'+_0x390abb[_0x0fba('0x36')]['filter']+'%'};return _0x4e11eb;}})});}_0x12d8ec=_[_0x0fba('0x3f')]({},_0x12d8ec,_0x390abb[_0x0fba('0x41')]);var _0xf140ae={'where':_0x12d8ec[_0x0fba('0x3d')]};return db[_0x0fba('0x30')]['count'](_0xf140ae)['then'](function(_0x1ead14){_0x3a0884['count']=_0x1ead14;if(_0x390abb[_0x0fba('0x36')]['includeAll']){_0x12d8ec[_0x0fba('0x42')]=[{'all':!![]}];}return db[_0x0fba('0x30')][_0x0fba('0x43')](_0x12d8ec);})[_0x0fba('0x2a')](function(_0xdb5e43){_0x3a0884[_0x0fba('0x44')]=_0xdb5e43;return _0x3a0884;})['then'](respondWithFilteredResult(_0x2fc841,_0x12d8ec))['catch'](handleError(_0x2fc841,null));};exports['show']=function(_0x48395b,_0x338940){var _0x1b3576={'raw':![],'where':{'id':_0x48395b[_0x0fba('0x45')]['id']}},_0x4f1f88={};_0x4f1f88[_0x0fba('0x35')]=_[_0x0fba('0x37')](db[_0x0fba('0x30')][_0x0fba('0x31')]);_0x4f1f88[_0x0fba('0x36')]=_[_0x0fba('0x37')](_0x48395b[_0x0fba('0x36')]);_0x4f1f88[_0x0fba('0x3e')]=_[_0x0fba('0x46')](_0x4f1f88[_0x0fba('0x35')],_0x4f1f88[_0x0fba('0x36')]);_0x1b3576[_0x0fba('0x38')]=_[_0x0fba('0x46')](_0x4f1f88[_0x0fba('0x35')],qs[_0x0fba('0x47')](_0x48395b[_0x0fba('0x36')][_0x0fba('0x47')]));_0x1b3576[_0x0fba('0x38')]=_0x1b3576[_0x0fba('0x38')][_0x0fba('0x39')]?_0x1b3576[_0x0fba('0x38')]:_0x4f1f88['model'];if(_0x48395b['query'][_0x0fba('0x48')]){_0x1b3576[_0x0fba('0x42')]=[{'all':!![]}];}_0x1b3576=_['merge']({},_0x1b3576,_0x48395b[_0x0fba('0x41')]);return db[_0x0fba('0x30')][_0x0fba('0x49')](_0x1b3576)[_0x0fba('0x2a')](handleEntityNotFound(_0x338940,null))['then'](respondWithResult(_0x338940,null))[_0x0fba('0x4a')](handleError(_0x338940,null));};exports[_0x0fba('0x4b')]=function(_0x537d01,_0xa3967a){return db[_0x0fba('0x30')][_0x0fba('0x4b')](_0x537d01[_0x0fba('0x4c')],{})[_0x0fba('0x2a')](respondWithResult(_0xa3967a,0xc9))[_0x0fba('0x4a')](handleError(_0xa3967a,null));};exports[_0x0fba('0x29')]=function(_0x39d8dd,_0xebda9e){if(_0x39d8dd['body']['id']){delete _0x39d8dd[_0x0fba('0x4c')]['id'];}return db[_0x0fba('0x30')]['find']({'where':{'id':_0x39d8dd['params']['id']}})['then'](handleEntityNotFound(_0xebda9e,null))['then'](saveUpdates(_0x39d8dd[_0x0fba('0x4c')],null))[_0x0fba('0x2a')](respondWithResult(_0xebda9e,null))['catch'](handleError(_0xebda9e,null));};exports['destroy']=function(_0x445b8e,_0x568d00){return db[_0x0fba('0x30')]['find']({'where':{'id':_0x445b8e['params']['id']}})[_0x0fba('0x2a')](handleEntityNotFound(_0x568d00,null))[_0x0fba('0x2a')](removeEntity(_0x568d00,null))[_0x0fba('0x4a')](handleError(_0x568d00,null));};exports[_0x0fba('0x4d')]=function(_0x6415ba,_0x15822e,_0x3cb900){var _0x336ee5={};var _0x3a67b6={};var _0x4fb88f;var _0x359658;return db[_0x0fba('0x30')][_0x0fba('0x4e')]({'where':{'id':_0x6415ba['params']['id']}})['then'](handleEntityNotFound(_0x15822e,null))[_0x0fba('0x2a')](function(_0x42898d){if(_0x42898d){_0x4fb88f=_0x42898d;_0x3a67b6['model']=_[_0x0fba('0x37')](db[_0x0fba('0x4f')][_0x0fba('0x31')]);_0x3a67b6[_0x0fba('0x36')]=_[_0x0fba('0x37')](_0x6415ba[_0x0fba('0x36')]);_0x3a67b6[_0x0fba('0x3e')]=_[_0x0fba('0x46')](_0x3a67b6[_0x0fba('0x35')],_0x3a67b6['query']);_0x336ee5[_0x0fba('0x38')]=_['intersection'](_0x3a67b6[_0x0fba('0x35')],qs['fields'](_0x6415ba[_0x0fba('0x36')][_0x0fba('0x47')]));_0x336ee5[_0x0fba('0x38')]=_0x336ee5[_0x0fba('0x38')][_0x0fba('0x39')]?_0x336ee5[_0x0fba('0x38')]:_0x3a67b6['model'];_0x336ee5[_0x0fba('0x3b')]=qs['sort'](_0x6415ba[_0x0fba('0x36')][_0x0fba('0x3c')]);_0x336ee5['where']=qs[_0x0fba('0x3e')](_['pick'](_0x6415ba[_0x0fba('0x36')],_0x3a67b6['filters']));if(_0x6415ba[_0x0fba('0x36')][_0x0fba('0x50')]){_0x336ee5[_0x0fba('0x3d')]=_[_0x0fba('0x3f')](_0x336ee5[_0x0fba('0x3d')],{'$or':_[_0x0fba('0x2f')](_0x336ee5['attributes'],function(_0x57da46){var _0x5ae6a8={};_0x5ae6a8[_0x57da46]={'$like':'%'+_0x6415ba[_0x0fba('0x36')][_0x0fba('0x50')]+'%'};return _0x5ae6a8;})});}_0x336ee5=_['merge']({},_0x336ee5,_0x6415ba[_0x0fba('0x41')]);return _0x4fb88f[_0x0fba('0x4d')](_0x336ee5);}})['then'](function(_0x365d8a){if(_0x365d8a){_0x359658=_0x365d8a[_0x0fba('0x39')];if(!_0x6415ba[_0x0fba('0x36')]['hasOwnProperty'](_0x0fba('0x51'))){_0x336ee5['limit']=qs[_0x0fba('0x23')](_0x6415ba[_0x0fba('0x36')][_0x0fba('0x23')]);_0x336ee5['offset']=qs[_0x0fba('0x21')](_0x6415ba['query'][_0x0fba('0x21')]);}return _0x4fb88f['getConfigurations'](_0x336ee5);}})[_0x0fba('0x2a')](function(_0x1e12db){if(_0x1e12db){return _0x1e12db?{'count':_0x359658,'rows':_0x1e12db}:null;}})['then'](respondWithResult(_0x15822e,null))['catch'](handleError(_0x15822e,null));};exports[_0x0fba('0x52')]=function(_0x22bb6c,_0x1a9ce6,_0x3bb555){if(_0x22bb6c['body']['id']){delete _0x22bb6c[_0x0fba('0x4c')]['id'];}return db['DeskAccount'][_0x0fba('0x4e')]({'where':{'id':_0x22bb6c['params']['id']}})['then'](handleEntityNotFound(_0x1a9ce6,null))[_0x0fba('0x2a')](function(_0x42c388){if(_0x42c388){_0x22bb6c[_0x0fba('0x4c')][_0x0fba('0x53')]=_0x42c388['id'];_0x22bb6c['body']['Subjects']=integrations[_0x0fba('0x54')](_0x22bb6c[_0x0fba('0x4c')]['channel'],_0x22bb6c[_0x0fba('0x4c')][_0x0fba('0x33')]);_0x22bb6c[_0x0fba('0x4c')]['Descriptions']=integrations[_0x0fba('0x55')](_0x22bb6c[_0x0fba('0x4c')][_0x0fba('0x56')],_0x22bb6c[_0x0fba('0x4c')][_0x0fba('0x33')]);return db['DeskConfiguration'][_0x0fba('0x4b')](_0x22bb6c[_0x0fba('0x4c')],{'include':[{'model':db['DeskField'],'as':_0x0fba('0x57')},{'model':db[_0x0fba('0x58')],'as':'Descriptions'}]});}return null;})[_0x0fba('0x2a')](respondWithResult(_0x1a9ce6,null))[_0x0fba('0x4a')](handleError(_0x1a9ce6,null));};exports[_0x0fba('0x59')]=function(_0x1e5518,_0x4667e2,_0x3dec7f){var _0x2c5a24=[{'name':_0x0fba('0x5a'),'label':_0x0fba('0x5a'),'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 _0x478ea2='';return db[_0x0fba('0x30')][_0x0fba('0x4e')]({'where':{'id':_0x1e5518[_0x0fba('0x45')]['id']},'attributes':['id','remoteUri',_0x0fba('0x5b'),_0x0fba('0x5c'),_0x0fba('0x5d'),_0x0fba('0x5e'),'consumerSecret',_0x0fba('0x5f'),_0x0fba('0x60')]})[_0x0fba('0x2a')](handleEntityNotFound(_0x4667e2,null))[_0x0fba('0x2a')](function(_0x503947){if(_0x503947){_0x478ea2=_0x503947['remoteUri'];var _0x16cd43=_0x478ea2[_0x0fba('0x61')](-0x1);if(_0x16cd43==='/'){_0x478ea2=_0x478ea2[_0x0fba('0x62')](0x0,_0x478ea2[_0x0fba('0x63')](_0x16cd43));}var _0x5293b1={'method':_0x0fba('0x64'),'uri':util[_0x0fba('0x65')]('%s/custom_fields',_0x478ea2),'headers':{'Content-Type':_0x0fba('0x66'),'Accept':'application/json'},'json':!![]};if(_0x503947[_0x0fba('0x5b')]===_0x0fba('0x67')){_0x5293b1[_0x0fba('0x68')][_0x0fba('0x69')]=util[_0x0fba('0x65')]('Basic\x20%s',new Buffer(util[_0x0fba('0x65')](_0x0fba('0x6a'),_0x503947[_0x0fba('0x5c')],_0x503947[_0x0fba('0x5d')]))['toString']('base64'));}return rp(_0x5293b1)[_0x0fba('0x2a')](function(_0x263fbf){return _0x2c5a24[_0x0fba('0x6b')](_[_0x0fba('0x2f')](_0x263fbf[_0x0fba('0x6c')][_0x0fba('0x6d')],function(_0x91ca03){return{'id':_0x91ca03[_0x0fba('0x2d')],'name':_0x91ca03[_0x0fba('0x2d')],'type':_0x91ca03[_0x0fba('0x33')],'active':_0x91ca03[_0x0fba('0x6e')],'label':_0x91ca03[_0x0fba('0x6f')],'custom':!![]};}));});}})[_0x0fba('0x2a')](function(_0x58ab5c){return{'count':_0x58ab5c[_0x0fba('0x39')],'rows':_0x58ab5c};})[_0x0fba('0x2a')](respondWithResult(_0x4667e2,null))[_0x0fba('0x4a')](function(_0x154cce){var _0x955664=_0x1e5518[_0x0fba('0x36')][_0x0fba('0x70')]?0x1f4:_0x154cce[_0x0fba('0x71')]||0x1f4;logger[_0x0fba('0x2b')](_0x0fba('0x72'),_0x0fba('0x59'),_0x955664,JSON[_0x0fba('0x73')](_0x154cce));delete _0x154cce['name'];if(_0x955664===0x191){_0x955664=0x190;}_0x4667e2[_0x0fba('0x1e')](_0x955664)[_0x0fba('0x74')](_0x1e5518[_0x0fba('0x36')][_0x0fba('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x154cce[_0x0fba('0x71')]}:_0x154cce);});}; \ No newline at end of file +var _0x48d3=['send','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','find','create','body','update','params','destroy','getConfigurations','findOne','DeskConfiguration','sort','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','error','name'];(function(_0x302ab3,_0x21ab7b){var _0x12c0ca=function(_0x91ebf6){while(--_0x91ebf6){_0x302ab3['push'](_0x302ab3['shift']());}};_0x12c0ca(++_0x21ab7b);}(_0x48d3,0x19d));var _0x348d=function(_0x40d3cf,_0x2e0df6){_0x40d3cf=_0x40d3cf-0x0;var _0x3a9e12=_0x48d3[_0x40d3cf];return _0x3a9e12;};'use strict';var emlformat=require(_0x348d('0x0'));var rimraf=require(_0x348d('0x1'));var zipdir=require(_0x348d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x348d('0x3'));var moment=require(_0x348d('0x4'));var BPromise=require(_0x348d('0x5'));var Mustache=require('mustache');var util=require(_0x348d('0x6'));var path=require(_0x348d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x348d('0x8'));var _=require(_0x348d('0x9'));var squel=require(_0x348d('0xa'));var crypto=require(_0x348d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x348d('0xc'));var toCsv=require(_0x348d('0xd'));var querystring=require('querystring');var Papa=require(_0x348d('0xe'));var Redis=require(_0x348d('0xf'));var authService=require(_0x348d('0x10'));var qs=require(_0x348d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x348d('0x12'))(_0x348d('0x13'));var utils=require(_0x348d('0x14'));var config=require(_0x348d('0x15'));var licenseUtil=require(_0x348d('0x16'));var db=require(_0x348d('0x17'))['db'];var integrations=require(_0x348d('0x18'));function respondWithStatusCode(_0x1450db,_0x2dbafd){_0x2dbafd=_0x2dbafd||0xcc;return function(_0x30f942){if(_0x30f942){return _0x1450db[_0x348d('0x19')](_0x2dbafd);}return _0x1450db['status'](_0x2dbafd)[_0x348d('0x1a')]();};}function respondWithResult(_0x3eebf5,_0x1bc1ab){_0x1bc1ab=_0x1bc1ab||0xc8;return function(_0x1f380a){if(_0x1f380a){return _0x3eebf5[_0x348d('0x1b')](_0x1bc1ab)[_0x348d('0x1c')](_0x1f380a);}};}function respondWithFilteredResult(_0x31a176,_0x580efb){return function(_0x4c4fea){if(_0x4c4fea){var _0x2285a1=typeof _0x580efb[_0x348d('0x1d')]===_0x348d('0x1e')&&typeof _0x580efb[_0x348d('0x1f')]===_0x348d('0x1e');var _0x3c86d1=_0x4c4fea[_0x348d('0x20')];var _0x2ad401=_0x2285a1?0x0:_0x580efb[_0x348d('0x1d')];var _0x551738=_0x2285a1?_0x4c4fea[_0x348d('0x20')]:_0x580efb[_0x348d('0x1d')]+_0x580efb[_0x348d('0x1f')];var _0x259a43;if(_0x551738>=_0x3c86d1){_0x551738=_0x3c86d1;_0x259a43=0xc8;}else{_0x259a43=0xce;}_0x31a176[_0x348d('0x1b')](_0x259a43);return _0x31a176[_0x348d('0x21')]('Content-Range',_0x2ad401+'-'+_0x551738+'/'+_0x3c86d1)[_0x348d('0x1c')](_0x4c4fea);}return null;};}function patchUpdates(_0x1b04cd){return function(_0x414d19){try{jsonpatch['apply'](_0x414d19,_0x1b04cd,!![]);}catch(_0x3abdf3){return BPromise[_0x348d('0x22')](_0x3abdf3);}return _0x414d19[_0x348d('0x23')]();};}function saveUpdates(_0x48cac2,_0x29aad4){return function(_0x5a3137){if(_0x5a3137){return _0x5a3137['update'](_0x48cac2)[_0x348d('0x24')](function(_0x59b044){return _0x59b044;});}return null;};}function removeEntity(_0xb363,_0x1df30d){return function(_0x3be666){if(_0x3be666){return _0x3be666['destroy']()[_0x348d('0x24')](function(){_0xb363[_0x348d('0x1b')](0xcc)[_0x348d('0x1a')]();});}};}function handleEntityNotFound(_0x852157,_0x252c90){return function(_0x174560){if(!_0x174560){_0x852157[_0x348d('0x19')](0x194);}return _0x174560;};}function handleError(_0x4bca08,_0x15e6dd){_0x15e6dd=_0x15e6dd||0x1f4;return function(_0x18d9d4){logger[_0x348d('0x25')](_0x18d9d4['stack']);if(_0x18d9d4[_0x348d('0x26')]){delete _0x18d9d4[_0x348d('0x26')];}_0x4bca08['status'](_0x15e6dd)[_0x348d('0x27')](_0x18d9d4);};}exports['index']=function(_0x1f473f,_0x2b9969){var _0x3a2fec={},_0x48cc43={},_0x6f861={'count':0x0,'rows':[]};var _0x1fe77b=_['map'](db[_0x348d('0x28')][_0x348d('0x29')],function(_0x51ab9e){return{'name':_0x51ab9e[_0x348d('0x2a')],'type':_0x51ab9e[_0x348d('0x2b')][_0x348d('0x2c')]};});_0x48cc43[_0x348d('0x2d')]=_[_0x348d('0x2e')](_0x1fe77b,_0x348d('0x26'));_0x48cc43[_0x348d('0x2f')]=_[_0x348d('0x30')](_0x1f473f[_0x348d('0x2f')]);_0x48cc43['filters']=_[_0x348d('0x31')](_0x48cc43['model'],_0x48cc43[_0x348d('0x2f')]);_0x3a2fec[_0x348d('0x32')]=_[_0x348d('0x31')](_0x48cc43['model'],qs[_0x348d('0x33')](_0x1f473f['query'][_0x348d('0x33')]));_0x3a2fec[_0x348d('0x32')]=_0x3a2fec[_0x348d('0x32')][_0x348d('0x34')]?_0x3a2fec[_0x348d('0x32')]:_0x48cc43[_0x348d('0x2d')];if(!_0x1f473f['query'][_0x348d('0x35')](_0x348d('0x36'))){_0x3a2fec[_0x348d('0x1f')]=qs['limit'](_0x1f473f[_0x348d('0x2f')][_0x348d('0x1f')]);_0x3a2fec[_0x348d('0x1d')]=qs['offset'](_0x1f473f[_0x348d('0x2f')][_0x348d('0x1d')]);}_0x3a2fec[_0x348d('0x37')]=qs['sort'](_0x1f473f['query']['sort']);_0x3a2fec[_0x348d('0x38')]=qs[_0x348d('0x39')](_['pick'](_0x1f473f[_0x348d('0x2f')],_0x48cc43['filters']),_0x1fe77b);if(_0x1f473f[_0x348d('0x2f')][_0x348d('0x3a')]){_0x3a2fec[_0x348d('0x38')]=_[_0x348d('0x3b')](_0x3a2fec[_0x348d('0x38')],{'$or':_[_0x348d('0x2e')](_0x1fe77b,function(_0x10adf2){if(_0x10adf2['type']!==_0x348d('0x3c')){var _0x598c0f={};_0x598c0f[_0x10adf2[_0x348d('0x26')]]={'$like':'%'+_0x1f473f[_0x348d('0x2f')][_0x348d('0x3a')]+'%'};return _0x598c0f;}})});}_0x3a2fec=_[_0x348d('0x3b')]({},_0x3a2fec,_0x1f473f[_0x348d('0x3d')]);var _0x2e4a42={'where':_0x3a2fec[_0x348d('0x38')]};return db[_0x348d('0x28')][_0x348d('0x20')](_0x2e4a42)['then'](function(_0x7b935d){_0x6f861[_0x348d('0x20')]=_0x7b935d;if(_0x1f473f[_0x348d('0x2f')]['includeAll']){_0x3a2fec[_0x348d('0x3e')]=[{'all':!![]}];}return db[_0x348d('0x28')]['findAll'](_0x3a2fec);})[_0x348d('0x24')](function(_0x208914){_0x6f861[_0x348d('0x3f')]=_0x208914;return _0x6f861;})[_0x348d('0x24')](respondWithFilteredResult(_0x2b9969,_0x3a2fec))[_0x348d('0x40')](handleError(_0x2b9969,null));};exports['show']=function(_0x4fab4f,_0x528558){var _0x541e57={'raw':![],'where':{'id':_0x4fab4f['params']['id']}},_0x3ea66d={};_0x3ea66d[_0x348d('0x2d')]=_[_0x348d('0x30')](db[_0x348d('0x28')][_0x348d('0x29')]);_0x3ea66d[_0x348d('0x2f')]=_[_0x348d('0x30')](_0x4fab4f[_0x348d('0x2f')]);_0x3ea66d[_0x348d('0x39')]=_[_0x348d('0x31')](_0x3ea66d[_0x348d('0x2d')],_0x3ea66d[_0x348d('0x2f')]);_0x541e57[_0x348d('0x32')]=_[_0x348d('0x31')](_0x3ea66d[_0x348d('0x2d')],qs[_0x348d('0x33')](_0x4fab4f['query'][_0x348d('0x33')]));_0x541e57[_0x348d('0x32')]=_0x541e57[_0x348d('0x32')]['length']?_0x541e57['attributes']:_0x3ea66d['model'];if(_0x4fab4f[_0x348d('0x2f')]['includeAll']){_0x541e57['include']=[{'all':!![]}];}_0x541e57=_[_0x348d('0x3b')]({},_0x541e57,_0x4fab4f['options']);return db[_0x348d('0x28')][_0x348d('0x41')](_0x541e57)['then'](handleEntityNotFound(_0x528558,null))[_0x348d('0x24')](respondWithResult(_0x528558,null))[_0x348d('0x40')](handleError(_0x528558,null));};exports['create']=function(_0x38aca4,_0x4d369a){return db[_0x348d('0x28')][_0x348d('0x42')](_0x38aca4[_0x348d('0x43')],{})[_0x348d('0x24')](respondWithResult(_0x4d369a,0xc9))[_0x348d('0x40')](handleError(_0x4d369a,null));};exports[_0x348d('0x44')]=function(_0x5c4573,_0x95ef7b){if(_0x5c4573[_0x348d('0x43')]['id']){delete _0x5c4573[_0x348d('0x43')]['id'];}return db[_0x348d('0x28')][_0x348d('0x41')]({'where':{'id':_0x5c4573[_0x348d('0x45')]['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x95ef7b,null))[_0x348d('0x24')](saveUpdates(_0x5c4573['body'],null))['then'](respondWithResult(_0x95ef7b,null))[_0x348d('0x40')](handleError(_0x95ef7b,null));};exports[_0x348d('0x46')]=function(_0x2df497,_0x1bb413){return db['DeskAccount']['find']({'where':{'id':_0x2df497[_0x348d('0x45')]['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x1bb413,null))[_0x348d('0x24')](removeEntity(_0x1bb413,null))['catch'](handleError(_0x1bb413,null));};exports[_0x348d('0x47')]=function(_0xb2d026,_0x4d7559,_0x4f6d35){var _0x23f768={};var _0x5397ea={};var _0x3364c8;var _0x33ebd9;return db[_0x348d('0x28')][_0x348d('0x48')]({'where':{'id':_0xb2d026[_0x348d('0x45')]['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x4d7559,null))[_0x348d('0x24')](function(_0x33ba43){if(_0x33ba43){_0x3364c8=_0x33ba43;_0x5397ea['model']=_['keys'](db[_0x348d('0x49')]['rawAttributes']);_0x5397ea[_0x348d('0x2f')]=_['keys'](_0xb2d026[_0x348d('0x2f')]);_0x5397ea[_0x348d('0x39')]=_[_0x348d('0x31')](_0x5397ea[_0x348d('0x2d')],_0x5397ea['query']);_0x23f768['attributes']=_[_0x348d('0x31')](_0x5397ea[_0x348d('0x2d')],qs[_0x348d('0x33')](_0xb2d026[_0x348d('0x2f')][_0x348d('0x33')]));_0x23f768[_0x348d('0x32')]=_0x23f768['attributes'][_0x348d('0x34')]?_0x23f768[_0x348d('0x32')]:_0x5397ea['model'];_0x23f768['order']=qs[_0x348d('0x4a')](_0xb2d026[_0x348d('0x2f')][_0x348d('0x4a')]);_0x23f768[_0x348d('0x38')]=qs['filters'](_[_0x348d('0x4b')](_0xb2d026[_0x348d('0x2f')],_0x5397ea[_0x348d('0x39')]));if(_0xb2d026[_0x348d('0x2f')][_0x348d('0x3a')]){_0x23f768['where']=_['merge'](_0x23f768[_0x348d('0x38')],{'$or':_['map'](_0x23f768[_0x348d('0x32')],function(_0xbfd278){var _0x25f1bd={};_0x25f1bd[_0xbfd278]={'$like':'%'+_0xb2d026[_0x348d('0x2f')][_0x348d('0x3a')]+'%'};return _0x25f1bd;})});}_0x23f768=_[_0x348d('0x3b')]({},_0x23f768,_0xb2d026[_0x348d('0x3d')]);return _0x3364c8[_0x348d('0x47')](_0x23f768);}})[_0x348d('0x24')](function(_0x3f589b){if(_0x3f589b){_0x33ebd9=_0x3f589b[_0x348d('0x34')];if(!_0xb2d026[_0x348d('0x2f')][_0x348d('0x35')](_0x348d('0x36'))){_0x23f768['limit']=qs[_0x348d('0x1f')](_0xb2d026[_0x348d('0x2f')]['limit']);_0x23f768[_0x348d('0x1d')]=qs[_0x348d('0x1d')](_0xb2d026['query'][_0x348d('0x1d')]);}return _0x3364c8['getConfigurations'](_0x23f768);}})[_0x348d('0x24')](function(_0x114188){if(_0x114188){return _0x114188?{'count':_0x33ebd9,'rows':_0x114188}:null;}})[_0x348d('0x24')](respondWithResult(_0x4d7559,null))[_0x348d('0x40')](handleError(_0x4d7559,null));};exports[_0x348d('0x4c')]=function(_0x40be60,_0x297d00,_0x738105){if(_0x40be60[_0x348d('0x43')]['id']){delete _0x40be60[_0x348d('0x43')]['id'];}return db['DeskAccount'][_0x348d('0x48')]({'where':{'id':_0x40be60['params']['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x297d00,null))['then'](function(_0x4a74b5){if(_0x4a74b5){_0x40be60[_0x348d('0x43')][_0x348d('0x4d')]=_0x4a74b5['id'];_0x40be60[_0x348d('0x43')][_0x348d('0x4e')]=integrations[_0x348d('0x4f')](_0x40be60['body'][_0x348d('0x50')],_0x40be60['body']['type']);_0x40be60[_0x348d('0x43')][_0x348d('0x51')]=integrations[_0x348d('0x52')](_0x40be60[_0x348d('0x43')][_0x348d('0x50')],_0x40be60['body'][_0x348d('0x2b')]);return db['DeskConfiguration'][_0x348d('0x42')](_0x40be60[_0x348d('0x43')],{'include':[{'model':db[_0x348d('0x53')],'as':_0x348d('0x4e')},{'model':db[_0x348d('0x53')],'as':_0x348d('0x51')}]});}return null;})[_0x348d('0x24')](respondWithResult(_0x297d00,null))[_0x348d('0x40')](handleError(_0x297d00,null));};exports[_0x348d('0x54')]=function(_0x2472d6,_0x43c495,_0x43187a){var _0xe346bb=[{'name':'priority','label':_0x348d('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5389ba='';return db[_0x348d('0x28')]['findOne']({'where':{'id':_0x2472d6['params']['id']},'attributes':['id',_0x348d('0x56'),_0x348d('0x57'),_0x348d('0x58'),_0x348d('0x59'),_0x348d('0x5a'),_0x348d('0x5b'),_0x348d('0x5c'),_0x348d('0x5d')]})['then'](handleEntityNotFound(_0x43c495,null))[_0x348d('0x24')](function(_0x25b167){if(_0x25b167){_0x5389ba=_0x25b167[_0x348d('0x56')];var _0x134190=_0x5389ba['slice'](-0x1);if(_0x134190==='/'){_0x5389ba=_0x5389ba[_0x348d('0x5e')](0x0,_0x5389ba[_0x348d('0x5f')](_0x134190));}var _0x294271={'method':_0x348d('0x60'),'uri':util[_0x348d('0x61')]('%s/custom_fields',_0x5389ba),'headers':{'Content-Type':'application/json','Accept':_0x348d('0x62')},'json':!![]};if(_0x25b167['authType']===_0x348d('0x63')){_0x294271[_0x348d('0x64')][_0x348d('0x65')]=util['format'](_0x348d('0x66'),new Buffer(util[_0x348d('0x61')](_0x348d('0x67'),_0x25b167[_0x348d('0x58')],_0x25b167['password']))[_0x348d('0x68')](_0x348d('0x69')));}return rp(_0x294271)[_0x348d('0x24')](function(_0x310064){return _0xe346bb['concat'](_[_0x348d('0x2e')](_0x310064['_embedded'][_0x348d('0x6a')],function(_0x1d4a6c){return{'id':_0x1d4a6c[_0x348d('0x26')],'name':_0x1d4a6c['name'],'type':_0x1d4a6c[_0x348d('0x2b')],'active':_0x1d4a6c[_0x348d('0x6b')],'label':_0x1d4a6c[_0x348d('0x6c')],'custom':!![]};}));});}})[_0x348d('0x24')](function(_0x42faf8){return{'count':_0x42faf8[_0x348d('0x34')],'rows':_0x42faf8};})[_0x348d('0x24')](respondWithResult(_0x43c495,null))[_0x348d('0x40')](function(_0x50c69f){var _0x3a8e79=_0x2472d6['query']['test']?0x1f4:_0x50c69f[_0x348d('0x6d')]||0x1f4;logger['error'](_0x348d('0x6e'),'getFields',_0x3a8e79,JSON[_0x348d('0x6f')](_0x50c69f));delete _0x50c69f[_0x348d('0x26')];if(_0x3a8e79===0x191){_0x3a8e79=0x190;}_0x43c495[_0x348d('0x1b')](_0x3a8e79)['send'](_0x2472d6['query']['test']?{'message':_0x348d('0x70'),'statusCode':_0x50c69f['statusCode']}:_0x50c69f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ff2fbd6..55b6e1f 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 _0x8e2f=['api','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x29643d,_0x33db91){var _0x233750=function(_0x200eee){while(--_0x200eee){_0x29643d['push'](_0x29643d['shift']());}};_0x233750(++_0x33db91);}(_0x8e2f,0xa6));var _0xf8e2=function(_0x59fe72,_0x21cd0b){_0x59fe72=_0x59fe72-0x0;var _0x583b28=_0x8e2f[_0x59fe72];return _0x583b28;};'use strict';var _=require(_0xf8e2('0x0'));var util=require(_0xf8e2('0x1'));var logger=require('../../config/logger')(_0xf8e2('0x2'));var moment=require('moment');var BPromise=require(_0xf8e2('0x3'));var rp=require(_0xf8e2('0x4'));var fs=require('fs');var path=require(_0xf8e2('0x5'));var rimraf=require(_0xf8e2('0x6'));var config=require('../../config/environment');var attributes=require(_0xf8e2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xf8e2('0x8')]=function(_0x147565,_0x1aa92a){return _0x147565[_0xf8e2('0x9')](_0xf8e2('0xa'),attributes,{'tableName':_0xf8e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb3d=['request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','int_desk_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x35e300,_0x5a661b){var _0x34ffa7=function(_0x31b18e){while(--_0x31b18e){_0x35e300['push'](_0x35e300['shift']());}};_0x34ffa7(++_0x5a661b);}(_0xbb3d,0x145));var _0xdbb3=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0xbb3d[_0x2842b4];return _0x2b9521;};'use strict';var _=require('lodash');var util=require(_0xdbb3('0x0'));var logger=require(_0xdbb3('0x1'))(_0xdbb3('0x2'));var moment=require(_0xdbb3('0x3'));var BPromise=require(_0xdbb3('0x4'));var rp=require(_0xdbb3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbb3('0x6'));var config=require(_0xdbb3('0x7'));var attributes=require(_0xdbb3('0x8'));var integrations=require(_0xdbb3('0x9'));module['exports']=function(_0x5c8ed2,_0x5d896b){return _0x5c8ed2['define']('DeskAccount',attributes,{'tableName':_0xdbb3('0xa'),'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 740a917..294560e 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 _0xecbc=['../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowDeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xecbc,0xd6));var _0xcecb=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xecbc[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xcecb('0x0'));var util=require('util');var moment=require(_0xcecb('0x1'));var BPromise=require(_0xcecb('0x2'));var rs=require(_0xcecb('0x3'));var fs=require('fs');var Redis=require(_0xcecb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcecb('0x5'));var logger=require(_0xcecb('0x6'))(_0xcecb('0x7'));var config=require(_0xcecb('0x8'));var jayson=require(_0xcecb('0x9'));var client=jayson[_0xcecb('0xa')][_0xcecb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x327d4e,_0xaae14b,_0xc07bb){return new BPromise(function(_0x28f837,_0x4e1227){return client['request'](_0x327d4e,_0xc07bb)[_0xcecb('0xc')](function(_0x549c42){logger[_0xcecb('0xd')](_0xcecb('0xe'),_0xaae14b,_0xcecb('0xf'));logger[_0xcecb('0x10')](_0xcecb('0x11'),_0xaae14b,_0xcecb('0xf'),JSON[_0xcecb('0x12')](_0x549c42));if(_0x549c42[_0xcecb('0x13')]){if(_0x549c42[_0xcecb('0x13')][_0xcecb('0x14')]===0x1f4){logger['error'](_0xcecb('0xe'),_0xaae14b,_0x549c42[_0xcecb('0x13')][_0xcecb('0x15')]);return _0x4e1227(_0x549c42[_0xcecb('0x13')][_0xcecb('0x15')]);}logger[_0xcecb('0x13')](_0xcecb('0xe'),_0xaae14b,_0x549c42[_0xcecb('0x13')][_0xcecb('0x15')]);return _0x28f837(_0x549c42['error'][_0xcecb('0x15')]);}else{logger['info'](_0xcecb('0xe'),_0xaae14b,_0xcecb('0xf'));_0x28f837(_0x549c42[_0xcecb('0x16')]['message']);}})[_0xcecb('0x17')](function(_0x146a35){logger['error'](_0xcecb('0xe'),_0xaae14b,_0x146a35);_0x4e1227(_0x146a35);});});}exports[_0xcecb('0x18')]=function(_0x45327f){var _0x54b391=this;return new Promise(function(_0x3e3381,_0x5c2482){return db[_0xcecb('0x19')][_0xcecb('0x1a')]({'raw':_0x45327f[_0xcecb('0x1b')]?_0x45327f[_0xcecb('0x1b')][_0xcecb('0x1c')]===undefined?!![]:![]:!![],'where':_0x45327f['options']?_0x45327f[_0xcecb('0x1b')][_0xcecb('0x1d')]||null:null,'attributes':_0x45327f[_0xcecb('0x1b')]?_0x45327f[_0xcecb('0x1b')][_0xcecb('0x1e')]||null:null,'limit':_0x45327f[_0xcecb('0x1b')]?_0x45327f[_0xcecb('0x1b')][_0xcecb('0x1f')]||null:null,'include':_0x45327f[_0xcecb('0x1b')]?_0x45327f[_0xcecb('0x1b')]['include']?_[_0xcecb('0x20')](_0x45327f[_0xcecb('0x1b')][_0xcecb('0x21')],function(_0x4f9f0b){return{'model':db[_0x4f9f0b['model']],'as':_0x4f9f0b['as'],'attributes':_0x4f9f0b[_0xcecb('0x1e')],'include':_0x4f9f0b[_0xcecb('0x21')]?_[_0xcecb('0x20')](_0x4f9f0b[_0xcecb('0x21')],function(_0x41120c){return{'model':db[_0x41120c['model']],'as':_0x41120c['as'],'attributes':_0x41120c[_0xcecb('0x1e')],'include':_0x41120c['include']?_[_0xcecb('0x20')](_0x41120c['include'],function(_0x1675eb){return{'model':db[_0x1675eb[_0xcecb('0x22')]],'as':_0x1675eb['as'],'attributes':_0x1675eb[_0xcecb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcecb('0xc')](function(_0xebbdec){logger[_0xcecb('0xd')](_0xcecb('0x18'),_0x45327f);logger[_0xcecb('0x10')](_0xcecb('0x18'),_0x45327f,JSON[_0xcecb('0x12')](_0xebbdec));_0x3e3381(_0xebbdec);})['catch'](function(_0x313db4){logger[_0xcecb('0x13')](_0xcecb('0x18'),_0x313db4[_0xcecb('0x15')],_0x45327f);_0x5c2482(_0x54b391[_0xcecb('0x13')](0x1f4,_0x313db4[_0xcecb('0x15')]));});});};exports[_0xcecb('0x23')]=function(_0x4d9519){var _0x5cb9ed=this;return new Promise(function(_0x1d6921,_0x4d26e0){return db[_0xcecb('0x19')][_0xcecb('0x24')]({'raw':_0x4d9519[_0xcecb('0x1b')]?_0x4d9519[_0xcecb('0x1b')][_0xcecb('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d9519['options']?_0x4d9519['options'][_0xcecb('0x1d')]||null:null,'attributes':_0x4d9519['options']?_0x4d9519[_0xcecb('0x1b')][_0xcecb('0x1e')]||null:null,'include':_0x4d9519[_0xcecb('0x1b')]?_0x4d9519[_0xcecb('0x1b')]['include']?_[_0xcecb('0x20')](_0x4d9519[_0xcecb('0x1b')][_0xcecb('0x21')],function(_0xcdc1b3){return{'model':db[_0xcdc1b3[_0xcecb('0x22')]],'as':_0xcdc1b3['as'],'attributes':_0xcdc1b3[_0xcecb('0x1e')],'include':_0xcdc1b3[_0xcecb('0x21')]?_[_0xcecb('0x20')](_0xcdc1b3[_0xcecb('0x21')],function(_0x4da163){return{'model':db[_0x4da163[_0xcecb('0x22')]],'as':_0x4da163['as'],'attributes':_0x4da163[_0xcecb('0x1e')],'include':_0x4da163['include']?_['map'](_0x4da163[_0xcecb('0x21')],function(_0x5c0b2e){return{'model':db[_0x5c0b2e[_0xcecb('0x22')]],'as':_0x5c0b2e['as'],'attributes':_0x5c0b2e[_0xcecb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcecb('0xc')](function(_0x4cc2b3){logger[_0xcecb('0xd')]('ShowDeskAccount',_0x4d9519);logger[_0xcecb('0x10')](_0xcecb('0x23'),_0x4d9519,JSON['stringify'](_0x4cc2b3));_0x1d6921(_0x4cc2b3);})['catch'](function(_0x23df10){logger[_0xcecb('0x13')](_0xcecb('0x23'),_0x23df10[_0xcecb('0x15')],_0x4d9519);_0x4d26e0(_0x5cb9ed[_0xcecb('0x13')](0x1f4,_0x23df10[_0xcecb('0x15')]));});});}; \ No newline at end of file +var _0xa244=['attributes','limit','include','map','model','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0x47981e,_0x557751){var _0x5c66bc=function(_0x567911){while(--_0x567911){_0x47981e['push'](_0x47981e['shift']());}};_0x5c66bc(++_0x557751);}(_0xa244,0xfb));var _0x4a24=function(_0x53a7d,_0x3df61f){_0x53a7d=_0x53a7d-0x0;var _0x1f0308=_0xa244[_0x53a7d];return _0x1f0308;};'use strict';var _=require('lodash');var util=require(_0x4a24('0x0'));var moment=require(_0x4a24('0x1'));var BPromise=require(_0x4a24('0x2'));var rs=require(_0x4a24('0x3'));var fs=require('fs');var Redis=require(_0x4a24('0x4'));var db=require(_0x4a24('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a24('0x6'));var config=require(_0x4a24('0x7'));var jayson=require(_0x4a24('0x8'));var client=jayson[_0x4a24('0x9')][_0x4a24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x573a7e,_0x5e2a8d,_0x5708f3){return new BPromise(function(_0x1892ba,_0x4a168a){return client[_0x4a24('0xb')](_0x573a7e,_0x5708f3)[_0x4a24('0xc')](function(_0x5c3428){logger[_0x4a24('0xd')](_0x4a24('0xe'),_0x5e2a8d,'request\x20sent');logger[_0x4a24('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5e2a8d,'request\x20sent',JSON[_0x4a24('0x10')](_0x5c3428));if(_0x5c3428[_0x4a24('0x11')]){if(_0x5c3428[_0x4a24('0x11')][_0x4a24('0x12')]===0x1f4){logger['error'](_0x4a24('0xe'),_0x5e2a8d,_0x5c3428[_0x4a24('0x11')][_0x4a24('0x13')]);return _0x4a168a(_0x5c3428['error'][_0x4a24('0x13')]);}logger[_0x4a24('0x11')](_0x4a24('0xe'),_0x5e2a8d,_0x5c3428['error'][_0x4a24('0x13')]);return _0x1892ba(_0x5c3428[_0x4a24('0x11')]['message']);}else{logger[_0x4a24('0xd')](_0x4a24('0xe'),_0x5e2a8d,_0x4a24('0x14'));_0x1892ba(_0x5c3428[_0x4a24('0x15')][_0x4a24('0x13')]);}})[_0x4a24('0x16')](function(_0x1b0fd3){logger['error'](_0x4a24('0xe'),_0x5e2a8d,_0x1b0fd3);_0x4a168a(_0x1b0fd3);});});}exports[_0x4a24('0x17')]=function(_0x2ddbfc){var _0x3df11c=this;return new Promise(function(_0x115ba2,_0x57a5cc){return db[_0x4a24('0x18')][_0x4a24('0x19')]({'raw':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc[_0x4a24('0x1a')][_0x4a24('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc['options'][_0x4a24('0x1c')]||null:null,'attributes':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc['options'][_0x4a24('0x1d')]||null:null,'limit':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc[_0x4a24('0x1a')][_0x4a24('0x1e')]||null:null,'include':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc[_0x4a24('0x1a')][_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x2ddbfc[_0x4a24('0x1a')]['include'],function(_0x310c85){return{'model':db[_0x310c85[_0x4a24('0x21')]],'as':_0x310c85['as'],'attributes':_0x310c85['attributes'],'include':_0x310c85[_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x310c85[_0x4a24('0x1f')],function(_0x55ba99){return{'model':db[_0x55ba99[_0x4a24('0x21')]],'as':_0x55ba99['as'],'attributes':_0x55ba99[_0x4a24('0x1d')],'include':_0x55ba99[_0x4a24('0x1f')]?_['map'](_0x55ba99[_0x4a24('0x1f')],function(_0x37446b){return{'model':db[_0x37446b[_0x4a24('0x21')]],'as':_0x37446b['as'],'attributes':_0x37446b[_0x4a24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4a24('0xc')](function(_0x5568de){logger[_0x4a24('0xd')](_0x4a24('0x17'),_0x2ddbfc);logger[_0x4a24('0xf')](_0x4a24('0x17'),_0x2ddbfc,JSON[_0x4a24('0x10')](_0x5568de));_0x115ba2(_0x5568de);})[_0x4a24('0x16')](function(_0x51a0c6){logger['error']('GetDeskAccount',_0x51a0c6[_0x4a24('0x13')],_0x2ddbfc);_0x57a5cc(_0x3df11c[_0x4a24('0x11')](0x1f4,_0x51a0c6[_0x4a24('0x13')]));});});};exports[_0x4a24('0x22')]=function(_0x2f5305){var _0x2405f2=this;return new Promise(function(_0x2b544f,_0x1df1c5){return db[_0x4a24('0x18')]['find']({'raw':_0x2f5305[_0x4a24('0x1a')]?_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f5305[_0x4a24('0x1a')]?_0x2f5305[_0x4a24('0x1a')]['where']||null:null,'attributes':_0x2f5305['options']?_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1d')]||null:null,'include':_0x2f5305[_0x4a24('0x1a')]?_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1f')],function(_0xcec302){return{'model':db[_0xcec302['model']],'as':_0xcec302['as'],'attributes':_0xcec302[_0x4a24('0x1d')],'include':_0xcec302[_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0xcec302[_0x4a24('0x1f')],function(_0x10ec10){return{'model':db[_0x10ec10[_0x4a24('0x21')]],'as':_0x10ec10['as'],'attributes':_0x10ec10['attributes'],'include':_0x10ec10[_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x10ec10['include'],function(_0xdc387c){return{'model':db[_0xdc387c[_0x4a24('0x21')]],'as':_0xdc387c['as'],'attributes':_0xdc387c[_0x4a24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4a24('0xc')](function(_0x2dd1e3){logger['info'](_0x4a24('0x22'),_0x2f5305);logger[_0x4a24('0xf')](_0x4a24('0x22'),_0x2f5305,JSON[_0x4a24('0x10')](_0x2dd1e3));_0x2b544f(_0x2dd1e3);})[_0x4a24('0x16')](function(_0x5c30f4){logger[_0x4a24('0x11')](_0x4a24('0x22'),_0x5c30f4[_0x4a24('0x13')],_0x2f5305);_0x1df1c5(_0x2405f2['error'](0x1f4,_0x5c30f4[_0x4a24('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index feca4e7..00b6dbc 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x568e60,_0x5b56de){var _0x2f6f7a=function(_0x3d7cf2){while(--_0x3d7cf2){_0x568e60['push'](_0x568e60['shift']());}};_0x2f6f7a(++_0x5b56de);}(_0x008c,0x188));var _0xc008=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x008c[_0x5c7525];return _0x2e2ec8;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _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(_0xca8958,_0x25eed8){var _0x3d7165=function(_0x5dcced){while(--_0x5dcced){_0xca8958['push'](_0xca8958['shift']());}};_0x3d7165(++_0x25eed8);}(_0x55ca,0x126));var _0xa55c=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0x55ca[_0x206096];return _0x3f3b50;};'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 c8688df..7803f39 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 _0xf4da=['sequelize','STRING'];(function(_0x18f6ae,_0x13f5fd){var _0x1a1f82=function(_0x34efa9){while(--_0x34efa9){_0x18f6ae['push'](_0x18f6ae['shift']());}};_0x1a1f82(++_0x13f5fd);}(_0xf4da,0x102));var _0xaf4d=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xf4da[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xaf4d('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf4d('0x1')]},'description':{'type':Sequelize[_0xaf4d('0x1')]}}; \ No newline at end of file +var _0x6f87=['exports'];(function(_0x27b58e,_0x1401b4){var _0xda59da=function(_0x1e9d61){while(--_0x1e9d61){_0x27b58e['push'](_0x27b58e['shift']());}};_0xda59da(++_0x1401b4);}(_0x6f87,0x1a8));var _0x76f8=function(_0x3b8f99,_0x718933){_0x3b8f99=_0x3b8f99-0x0;var _0x104c8a=_0x6f87[_0x3b8f99];return _0x104c8a;};'use strict';var Sequelize=require('sequelize');module[_0x76f8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c0c9bc0..aaf1bbb 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 _0x7cf9=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','DeskConfiguration','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','update','DeskField','map','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x3d5555,_0x25cb34){var _0xf92e3c=function(_0x152d05){while(--_0x152d05){_0x3d5555['push'](_0x3d5555['shift']());}};_0xf92e3c(++_0x25cb34);}(_0x7cf9,0x1de));var _0x97cf=function(_0x572dbb,_0x4eb091){_0x572dbb=_0x572dbb-0x0;var _0x1e9cf7=_0x7cf9[_0x572dbb];return _0x1e9cf7;};'use strict';var emlformat=require(_0x97cf('0x0'));var rimraf=require(_0x97cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97cf('0x2'));var rp=require(_0x97cf('0x3'));var moment=require('moment');var BPromise=require(_0x97cf('0x4'));var Mustache=require(_0x97cf('0x5'));var util=require('util');var path=require(_0x97cf('0x6'));var sox=require('sox');var csv=require(_0x97cf('0x7'));var ejs=require(_0x97cf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97cf('0x9'));var crypto=require(_0x97cf('0xa'));var jsforce=require(_0x97cf('0xb'));var deskjs=require(_0x97cf('0xc'));var toCsv=require(_0x97cf('0x7'));var querystring=require(_0x97cf('0xd'));var Papa=require('papaparse');var Redis=require(_0x97cf('0xe'));var authService=require(_0x97cf('0xf'));var qs=require(_0x97cf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97cf('0x11'));var logger=require(_0x97cf('0x12'))(_0x97cf('0x13'));var utils=require(_0x97cf('0x14'));var config=require(_0x97cf('0x15'));var licenseUtil=require(_0x97cf('0x16'));var db=require(_0x97cf('0x17'))['db'];function respondWithStatusCode(_0x3b7a71,_0x3dd40b){_0x3dd40b=_0x3dd40b||0xcc;return function(_0x266cce){if(_0x266cce){return _0x3b7a71[_0x97cf('0x18')](_0x3dd40b);}return _0x3b7a71[_0x97cf('0x19')](_0x3dd40b)[_0x97cf('0x1a')]();};}function respondWithResult(_0x1941b3,_0x239e96){_0x239e96=_0x239e96||0xc8;return function(_0x3427b2){if(_0x3427b2){return _0x1941b3[_0x97cf('0x19')](_0x239e96)[_0x97cf('0x1b')](_0x3427b2);}};}function respondWithFilteredResult(_0x2e962b,_0x3cdb44){return function(_0x493ac9){if(_0x493ac9){var _0x15a997=typeof _0x3cdb44['offset']===_0x97cf('0x1c')&&typeof _0x3cdb44[_0x97cf('0x1d')]===_0x97cf('0x1c');var _0x5211c2=_0x493ac9[_0x97cf('0x1e')];var _0x2e7371=_0x15a997?0x0:_0x3cdb44[_0x97cf('0x1f')];var _0x2f16b1=_0x15a997?_0x493ac9[_0x97cf('0x1e')]:_0x3cdb44[_0x97cf('0x1f')]+_0x3cdb44['limit'];var _0x342d46;if(_0x2f16b1>=_0x5211c2){_0x2f16b1=_0x5211c2;_0x342d46=0xc8;}else{_0x342d46=0xce;}_0x2e962b['status'](_0x342d46);return _0x2e962b[_0x97cf('0x20')](_0x97cf('0x21'),_0x2e7371+'-'+_0x2f16b1+'/'+_0x5211c2)[_0x97cf('0x1b')](_0x493ac9);}return null;};}function patchUpdates(_0x51f98c){return function(_0x2bd1a4){try{jsonpatch[_0x97cf('0x22')](_0x2bd1a4,_0x51f98c,!![]);}catch(_0x14b4ae){return BPromise[_0x97cf('0x23')](_0x14b4ae);}return _0x2bd1a4[_0x97cf('0x24')]();};}function saveUpdates(_0x34d3f8,_0x6646d4){return function(_0x75e2e2){if(_0x75e2e2){return _0x75e2e2['update'](_0x34d3f8)[_0x97cf('0x25')](function(_0x23cdea){return _0x23cdea;});}return null;};}function removeEntity(_0x1768d6,_0x2ea9d3){return function(_0x246fb0){if(_0x246fb0){return _0x246fb0[_0x97cf('0x26')]()['then'](function(){_0x1768d6[_0x97cf('0x19')](0xcc)[_0x97cf('0x1a')]();});}};}function handleEntityNotFound(_0x4904de,_0x29d6a4){return function(_0x23e15b){if(!_0x23e15b){_0x4904de[_0x97cf('0x18')](0x194);}return _0x23e15b;};}function handleError(_0xaeaf72,_0x5d3358){_0x5d3358=_0x5d3358||0x1f4;return function(_0x3db349){logger[_0x97cf('0x27')](_0x3db349[_0x97cf('0x28')]);if(_0x3db349[_0x97cf('0x29')]){delete _0x3db349[_0x97cf('0x29')];}_0xaeaf72[_0x97cf('0x19')](_0x5d3358)[_0x97cf('0x2a')](_0x3db349);};}exports[_0x97cf('0x2b')]=function(_0x12859a,_0x5a9c61){var _0x4fce86={},_0x29c958={},_0x5c3068={'count':0x0,'rows':[]};var _0x4bbfe0=_['map'](db['DeskConfiguration'][_0x97cf('0x2c')],function(_0x37d892){return{'name':_0x37d892[_0x97cf('0x2d')],'type':_0x37d892[_0x97cf('0x2e')][_0x97cf('0x2f')]};});_0x29c958[_0x97cf('0x30')]=_['map'](_0x4bbfe0,_0x97cf('0x29'));_0x29c958[_0x97cf('0x31')]=_[_0x97cf('0x32')](_0x12859a[_0x97cf('0x31')]);_0x29c958[_0x97cf('0x33')]=_['intersection'](_0x29c958[_0x97cf('0x30')],_0x29c958['query']);_0x4fce86[_0x97cf('0x34')]=_['intersection'](_0x29c958[_0x97cf('0x30')],qs[_0x97cf('0x35')](_0x12859a['query'][_0x97cf('0x35')]));_0x4fce86[_0x97cf('0x34')]=_0x4fce86[_0x97cf('0x34')][_0x97cf('0x36')]?_0x4fce86[_0x97cf('0x34')]:_0x29c958['model'];if(!_0x12859a[_0x97cf('0x31')][_0x97cf('0x37')](_0x97cf('0x38'))){_0x4fce86['limit']=qs['limit'](_0x12859a[_0x97cf('0x31')]['limit']);_0x4fce86[_0x97cf('0x1f')]=qs['offset'](_0x12859a[_0x97cf('0x31')][_0x97cf('0x1f')]);}_0x4fce86[_0x97cf('0x39')]=qs[_0x97cf('0x3a')](_0x12859a[_0x97cf('0x31')][_0x97cf('0x3a')]);_0x4fce86['where']=qs[_0x97cf('0x33')](_[_0x97cf('0x3b')](_0x12859a['query'],_0x29c958[_0x97cf('0x33')]),_0x4bbfe0);if(_0x12859a[_0x97cf('0x31')][_0x97cf('0x3c')]){_0x4fce86['where']=_[_0x97cf('0x3d')](_0x4fce86[_0x97cf('0x3e')],{'$or':_['map'](_0x4bbfe0,function(_0x2cc08c){if(_0x2cc08c[_0x97cf('0x2e')]!=='VIRTUAL'){var _0x48002f={};_0x48002f[_0x2cc08c['name']]={'$like':'%'+_0x12859a[_0x97cf('0x31')][_0x97cf('0x3c')]+'%'};return _0x48002f;}})});}_0x4fce86=_[_0x97cf('0x3d')]({},_0x4fce86,_0x12859a[_0x97cf('0x3f')]);var _0x57e6fb={'where':_0x4fce86['where']};return db[_0x97cf('0x40')][_0x97cf('0x1e')](_0x57e6fb)['then'](function(_0x984866){_0x5c3068[_0x97cf('0x1e')]=_0x984866;if(_0x12859a[_0x97cf('0x31')][_0x97cf('0x41')]){_0x4fce86[_0x97cf('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x97cf('0x43')](_0x4fce86);})[_0x97cf('0x25')](function(_0xb8ebb2){_0x5c3068[_0x97cf('0x44')]=_0xb8ebb2;return _0x5c3068;})[_0x97cf('0x25')](respondWithFilteredResult(_0x5a9c61,_0x4fce86))['catch'](handleError(_0x5a9c61,null));};exports[_0x97cf('0x45')]=function(_0x177942,_0x29d4ee){var _0x308c4c={'raw':![],'where':{'id':_0x177942[_0x97cf('0x46')]['id']}},_0x27da99={};_0x27da99['model']=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x27da99['query']=_[_0x97cf('0x32')](_0x177942['query']);_0x27da99['filters']=_[_0x97cf('0x47')](_0x27da99[_0x97cf('0x30')],_0x27da99[_0x97cf('0x31')]);_0x308c4c[_0x97cf('0x34')]=_['intersection'](_0x27da99[_0x97cf('0x30')],qs[_0x97cf('0x35')](_0x177942[_0x97cf('0x31')][_0x97cf('0x35')]));_0x308c4c[_0x97cf('0x34')]=_0x308c4c[_0x97cf('0x34')][_0x97cf('0x36')]?_0x308c4c[_0x97cf('0x34')]:_0x27da99[_0x97cf('0x30')];if(_0x177942[_0x97cf('0x31')][_0x97cf('0x41')]){_0x308c4c[_0x97cf('0x42')]=[{'all':!![]}];}_0x308c4c=_[_0x97cf('0x3d')]({},_0x308c4c,_0x177942[_0x97cf('0x3f')]);return db[_0x97cf('0x40')][_0x97cf('0x48')](_0x308c4c)['then'](handleEntityNotFound(_0x29d4ee,null))['then'](respondWithResult(_0x29d4ee,null))[_0x97cf('0x49')](handleError(_0x29d4ee,null));};exports[_0x97cf('0x4a')]=function(_0x7d838,_0x4977f3){return db[_0x97cf('0x40')][_0x97cf('0x4a')](_0x7d838[_0x97cf('0x4b')],{})[_0x97cf('0x25')](respondWithResult(_0x4977f3,0xc9))[_0x97cf('0x49')](handleError(_0x4977f3,null));};exports[_0x97cf('0x4c')]=function(_0x3d6a94,_0x595722){if(_0x3d6a94['body']['id']){delete _0x3d6a94[_0x97cf('0x4b')]['id'];}return db[_0x97cf('0x40')][_0x97cf('0x48')]({'where':{'id':_0x3d6a94[_0x97cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x595722,null))[_0x97cf('0x25')](saveUpdates(_0x3d6a94[_0x97cf('0x4b')],null))[_0x97cf('0x25')](respondWithResult(_0x595722,null))[_0x97cf('0x49')](handleError(_0x595722,null));};exports[_0x97cf('0x26')]=function(_0x1295c3,_0x450ab8){return db['DeskConfiguration'][_0x97cf('0x48')]({'where':{'id':_0x1295c3['params']['id']}})[_0x97cf('0x25')](handleEntityNotFound(_0x450ab8,null))[_0x97cf('0x25')](removeEntity(_0x450ab8,null))[_0x97cf('0x49')](handleError(_0x450ab8,null));};exports['getFields']=function(_0x101060,_0x58ff64,_0x49b01f){var _0x20bae0={};var _0xf2b11b={};var _0x307404;var _0x18c1c7;return db[_0x97cf('0x40')]['findOne']({'where':{'id':_0x101060[_0x97cf('0x46')]['id']}})[_0x97cf('0x25')](handleEntityNotFound(_0x58ff64,null))[_0x97cf('0x25')](function(_0x2d222f){if(_0x2d222f){_0x307404=_0x2d222f;_0xf2b11b['model']=_['keys'](db[_0x97cf('0x4d')]['rawAttributes']);_0xf2b11b[_0x97cf('0x31')]=_[_0x97cf('0x32')](_0x101060[_0x97cf('0x31')]);_0xf2b11b[_0x97cf('0x33')]=_[_0x97cf('0x47')](_0xf2b11b[_0x97cf('0x30')],_0xf2b11b[_0x97cf('0x31')]);_0x20bae0[_0x97cf('0x34')]=_[_0x97cf('0x47')](_0xf2b11b[_0x97cf('0x30')],qs['fields'](_0x101060[_0x97cf('0x31')]['fields']));_0x20bae0[_0x97cf('0x34')]=_0x20bae0['attributes']['length']?_0x20bae0['attributes']:_0xf2b11b[_0x97cf('0x30')];_0x20bae0[_0x97cf('0x39')]=qs[_0x97cf('0x3a')](_0x101060[_0x97cf('0x31')]['sort']);_0x20bae0[_0x97cf('0x3e')]=qs['filters'](_[_0x97cf('0x3b')](_0x101060['query'],_0xf2b11b[_0x97cf('0x33')]));if(_0x101060[_0x97cf('0x31')]['filter']){_0x20bae0[_0x97cf('0x3e')]=_['merge'](_0x20bae0[_0x97cf('0x3e')],{'$or':_[_0x97cf('0x4e')](_0x20bae0[_0x97cf('0x34')],function(_0x507d06){var _0x5d09ea={};_0x5d09ea[_0x507d06]={'$like':'%'+_0x101060[_0x97cf('0x31')][_0x97cf('0x3c')]+'%'};return _0x5d09ea;})});}_0x20bae0=_['merge']({},_0x20bae0,_0x101060[_0x97cf('0x3f')]);return _0x307404[_0x97cf('0x4f')](_0x20bae0);}})['then'](function(_0x35311a){if(_0x35311a){_0x18c1c7=_0x35311a[_0x97cf('0x36')];if(!_0x101060[_0x97cf('0x31')][_0x97cf('0x37')](_0x97cf('0x38'))){_0x20bae0['limit']=qs[_0x97cf('0x1d')](_0x101060[_0x97cf('0x31')]['limit']);_0x20bae0[_0x97cf('0x1f')]=qs[_0x97cf('0x1f')](_0x101060[_0x97cf('0x31')][_0x97cf('0x1f')]);}return _0x307404['getFields'](_0x20bae0);}})[_0x97cf('0x25')](function(_0x157c27){if(_0x157c27){return _0x157c27?{'count':_0x18c1c7,'rows':_0x157c27}:null;}})[_0x97cf('0x25')](respondWithResult(_0x58ff64,null))[_0x97cf('0x49')](handleError(_0x58ff64,null));};exports[_0x97cf('0x50')]=function(_0x45a947,_0xe12c2f,_0x3fde6b){var _0x3dbce4={};var _0x492c19={};var _0x38e73d;var _0x2d811c;return db['DeskConfiguration'][_0x97cf('0x51')]({'where':{'id':_0x45a947[_0x97cf('0x46')]['id']}})[_0x97cf('0x25')](handleEntityNotFound(_0xe12c2f,null))[_0x97cf('0x25')](function(_0x35cd18){if(_0x35cd18){_0x38e73d=_0x35cd18;_0x492c19[_0x97cf('0x30')]=_[_0x97cf('0x32')](db['DeskField'][_0x97cf('0x2c')]);_0x492c19[_0x97cf('0x31')]=_[_0x97cf('0x32')](_0x45a947['query']);_0x492c19['filters']=_['intersection'](_0x492c19[_0x97cf('0x30')],_0x492c19[_0x97cf('0x31')]);_0x3dbce4[_0x97cf('0x34')]=_['intersection'](_0x492c19[_0x97cf('0x30')],qs[_0x97cf('0x35')](_0x45a947[_0x97cf('0x31')]['fields']));_0x3dbce4[_0x97cf('0x34')]=_0x3dbce4[_0x97cf('0x34')][_0x97cf('0x36')]?_0x3dbce4[_0x97cf('0x34')]:_0x492c19['model'];_0x3dbce4['order']=qs[_0x97cf('0x3a')](_0x45a947[_0x97cf('0x31')][_0x97cf('0x3a')]);_0x3dbce4[_0x97cf('0x3e')]=qs[_0x97cf('0x33')](_[_0x97cf('0x3b')](_0x45a947[_0x97cf('0x31')],_0x492c19[_0x97cf('0x33')]));if(_0x45a947[_0x97cf('0x31')][_0x97cf('0x3c')]){_0x3dbce4[_0x97cf('0x3e')]=_[_0x97cf('0x3d')](_0x3dbce4[_0x97cf('0x3e')],{'$or':_[_0x97cf('0x4e')](_0x3dbce4[_0x97cf('0x34')],function(_0x4a5e66){var _0x12ac0b={};_0x12ac0b[_0x4a5e66]={'$like':'%'+_0x45a947[_0x97cf('0x31')][_0x97cf('0x3c')]+'%'};return _0x12ac0b;})});}_0x3dbce4=_[_0x97cf('0x3d')]({},_0x3dbce4,_0x45a947['options']);return _0x38e73d[_0x97cf('0x50')](_0x3dbce4);}})[_0x97cf('0x25')](function(_0x45d363){if(_0x45d363){_0x2d811c=_0x45d363[_0x97cf('0x36')];if(!_0x45a947[_0x97cf('0x31')][_0x97cf('0x37')]('nolimit')){_0x3dbce4[_0x97cf('0x1d')]=qs[_0x97cf('0x1d')](_0x45a947[_0x97cf('0x31')][_0x97cf('0x1d')]);_0x3dbce4['offset']=qs['offset'](_0x45a947[_0x97cf('0x31')][_0x97cf('0x1f')]);}return _0x38e73d[_0x97cf('0x50')](_0x3dbce4);}})[_0x97cf('0x25')](function(_0x51f76f){if(_0x51f76f){return _0x51f76f?{'count':_0x2d811c,'rows':_0x51f76f}:null;}})[_0x97cf('0x25')](respondWithResult(_0xe12c2f,null))[_0x97cf('0x49')](handleError(_0xe12c2f,null));};exports[_0x97cf('0x52')]=function(_0x13fa01,_0x3426e7,_0x2d4605){var _0x2cd70a={};var _0x16cc44={};var _0x39f8d2;var _0xb1b1fa;return db[_0x97cf('0x40')][_0x97cf('0x51')]({'where':{'id':_0x13fa01[_0x97cf('0x46')]['id']}})[_0x97cf('0x25')](handleEntityNotFound(_0x3426e7,null))[_0x97cf('0x25')](function(_0x5dc57e){if(_0x5dc57e){_0x39f8d2=_0x5dc57e;_0x16cc44[_0x97cf('0x30')]=_[_0x97cf('0x32')](db[_0x97cf('0x4d')]['rawAttributes']);_0x16cc44[_0x97cf('0x31')]=_[_0x97cf('0x32')](_0x13fa01[_0x97cf('0x31')]);_0x16cc44['filters']=_[_0x97cf('0x47')](_0x16cc44[_0x97cf('0x30')],_0x16cc44[_0x97cf('0x31')]);_0x2cd70a[_0x97cf('0x34')]=_[_0x97cf('0x47')](_0x16cc44[_0x97cf('0x30')],qs[_0x97cf('0x35')](_0x13fa01[_0x97cf('0x31')][_0x97cf('0x35')]));_0x2cd70a[_0x97cf('0x34')]=_0x2cd70a[_0x97cf('0x34')][_0x97cf('0x36')]?_0x2cd70a[_0x97cf('0x34')]:_0x16cc44[_0x97cf('0x30')];_0x2cd70a['order']=qs[_0x97cf('0x3a')](_0x13fa01[_0x97cf('0x31')][_0x97cf('0x3a')]);_0x2cd70a['where']=qs['filters'](_[_0x97cf('0x3b')](_0x13fa01[_0x97cf('0x31')],_0x16cc44[_0x97cf('0x33')]));if(_0x13fa01[_0x97cf('0x31')][_0x97cf('0x3c')]){_0x2cd70a[_0x97cf('0x3e')]=_[_0x97cf('0x3d')](_0x2cd70a[_0x97cf('0x3e')],{'$or':_[_0x97cf('0x4e')](_0x2cd70a[_0x97cf('0x34')],function(_0x3be0cb){var _0x948549={};_0x948549[_0x3be0cb]={'$like':'%'+_0x13fa01[_0x97cf('0x31')][_0x97cf('0x3c')]+'%'};return _0x948549;})});}_0x2cd70a=_['merge']({},_0x2cd70a,_0x13fa01['options']);return _0x39f8d2[_0x97cf('0x52')](_0x2cd70a);}})[_0x97cf('0x25')](function(_0x1e633f){if(_0x1e633f){_0xb1b1fa=_0x1e633f[_0x97cf('0x36')];if(!_0x13fa01[_0x97cf('0x31')]['hasOwnProperty'](_0x97cf('0x38'))){_0x2cd70a['limit']=qs['limit'](_0x13fa01[_0x97cf('0x31')][_0x97cf('0x1d')]);_0x2cd70a[_0x97cf('0x1f')]=qs['offset'](_0x13fa01[_0x97cf('0x31')][_0x97cf('0x1f')]);}return _0x39f8d2[_0x97cf('0x52')](_0x2cd70a);}})['then'](function(_0x1eb2ba){if(_0x1eb2ba){return _0x1eb2ba?{'count':_0xb1b1fa,'rows':_0x1eb2ba}:null;}})[_0x97cf('0x25')](respondWithResult(_0x3426e7,null))[_0x97cf('0x49')](handleError(_0x3426e7,null));};exports[_0x97cf('0x53')]=function(_0x31e47a,_0x46fc7c,_0x56c189){var _0x3299d0={};var _0x18befb={};var _0x407ff9;var _0x42d48c;return db[_0x97cf('0x40')][_0x97cf('0x51')]({'where':{'id':_0x31e47a[_0x97cf('0x46')]['id']}})[_0x97cf('0x25')](handleEntityNotFound(_0x46fc7c,null))['then'](function(_0x1eb1a8){if(_0x1eb1a8){_0x407ff9=_0x1eb1a8;_0x18befb['model']=_[_0x97cf('0x32')](db[_0x97cf('0x54')][_0x97cf('0x2c')]);_0x18befb[_0x97cf('0x31')]=_['keys'](_0x31e47a[_0x97cf('0x31')]);_0x18befb[_0x97cf('0x33')]=_[_0x97cf('0x47')](_0x18befb['model'],_0x18befb['query']);_0x3299d0[_0x97cf('0x34')]=_[_0x97cf('0x47')](_0x18befb[_0x97cf('0x30')],qs[_0x97cf('0x35')](_0x31e47a[_0x97cf('0x31')][_0x97cf('0x35')]));_0x3299d0[_0x97cf('0x34')]=_0x3299d0[_0x97cf('0x34')][_0x97cf('0x36')]?_0x3299d0[_0x97cf('0x34')]:_0x18befb[_0x97cf('0x30')];_0x3299d0['order']=qs[_0x97cf('0x3a')](_0x31e47a[_0x97cf('0x31')][_0x97cf('0x3a')]);_0x3299d0[_0x97cf('0x3e')]=qs[_0x97cf('0x33')](_['pick'](_0x31e47a[_0x97cf('0x31')],_0x18befb[_0x97cf('0x33')]));if(_0x31e47a['query'][_0x97cf('0x3c')]){_0x3299d0[_0x97cf('0x3e')]=_[_0x97cf('0x3d')](_0x3299d0[_0x97cf('0x3e')],{'$or':_[_0x97cf('0x4e')](_0x3299d0[_0x97cf('0x34')],function(_0x32b759){var _0x22c4bc={};_0x22c4bc[_0x32b759]={'$like':'%'+_0x31e47a[_0x97cf('0x31')][_0x97cf('0x3c')]+'%'};return _0x22c4bc;})});}_0x3299d0=_['merge']({},_0x3299d0,_0x31e47a[_0x97cf('0x3f')]);return _0x407ff9[_0x97cf('0x53')](_0x3299d0);}})[_0x97cf('0x25')](function(_0x180802){if(_0x180802){_0x42d48c=_0x180802['length'];if(!_0x31e47a[_0x97cf('0x31')][_0x97cf('0x37')](_0x97cf('0x38'))){_0x3299d0[_0x97cf('0x1d')]=qs[_0x97cf('0x1d')](_0x31e47a[_0x97cf('0x31')][_0x97cf('0x1d')]);_0x3299d0[_0x97cf('0x1f')]=qs[_0x97cf('0x1f')](_0x31e47a[_0x97cf('0x31')][_0x97cf('0x1f')]);}return _0x407ff9['getTags'](_0x3299d0);}})[_0x97cf('0x25')](function(_0x111bbf){if(_0x111bbf){return _0x111bbf?{'count':_0x42d48c,'rows':_0x111bbf}:null;}})[_0x97cf('0x25')](respondWithResult(_0x46fc7c,null))[_0x97cf('0x49')](handleError(_0x46fc7c,null));};exports[_0x97cf('0x55')]=function(_0x13885c,_0x49097b,_0x43ca00){if(_0x13885c[_0x97cf('0x4b')]['id']){delete _0x13885c[_0x97cf('0x4b')]['id'];}return db[_0x97cf('0x40')]['findOne']({'where':{'id':_0x13885c[_0x97cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x49097b,null))[_0x97cf('0x25')](function(_0x379134){if(_0x379134){return _0x379134[_0x97cf('0x55')](_0x13885c[_0x97cf('0x4b')][_0x97cf('0x56')]||[]);}return null;})[_0x97cf('0x25')](respondWithResult(_0x49097b,null))[_0x97cf('0x49')](handleError(_0x49097b,null));}; \ No newline at end of file +var _0x2eda=['includeAll','include','findAll','catch','show','rawAttributes','keys','find','create','body','update','params','getFields','DeskField','findOne','getSubjects','getDescriptions','getTags','Tag','map','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','DeskConfiguration','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x35c1db,_0xd75c15){var _0x4173ff=function(_0x5d6901){while(--_0x5d6901){_0x35c1db['push'](_0x35c1db['shift']());}};_0x4173ff(++_0xd75c15);}(_0x2eda,0x10f));var _0xa2ed=function(_0x2204b4,_0x48e285){_0x2204b4=_0x2204b4-0x0;var _0x38e722=_0x2eda[_0x2204b4];return _0x38e722;};'use strict';var emlformat=require(_0xa2ed('0x0'));var rimraf=require(_0xa2ed('0x1'));var zipdir=require(_0xa2ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2ed('0x3'));var moment=require(_0xa2ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa2ed('0x5'));var util=require('util');var path=require(_0xa2ed('0x6'));var sox=require(_0xa2ed('0x7'));var csv=require(_0xa2ed('0x8'));var ejs=require(_0xa2ed('0x9'));var fs=require('fs');var fs_extra=require(_0xa2ed('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2ed('0xb'));var jsforce=require(_0xa2ed('0xc'));var deskjs=require(_0xa2ed('0xd'));var toCsv=require(_0xa2ed('0x8'));var querystring=require(_0xa2ed('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2ed('0xf'));var qs=require(_0xa2ed('0x10'));var as=require(_0xa2ed('0x11'));var hardwareService=require(_0xa2ed('0x12'));var logger=require(_0xa2ed('0x13'))(_0xa2ed('0x14'));var utils=require(_0xa2ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa2ed('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9cf763,_0x27fabe){_0x27fabe=_0x27fabe||0xcc;return function(_0x2f3fcd){if(_0x2f3fcd){return _0x9cf763['sendStatus'](_0x27fabe);}return _0x9cf763[_0xa2ed('0x17')](_0x27fabe)[_0xa2ed('0x18')]();};}function respondWithResult(_0x302ab8,_0x39d463){_0x39d463=_0x39d463||0xc8;return function(_0x4ba518){if(_0x4ba518){return _0x302ab8[_0xa2ed('0x17')](_0x39d463)[_0xa2ed('0x19')](_0x4ba518);}};}function respondWithFilteredResult(_0x126055,_0x446951){return function(_0x4fb281){if(_0x4fb281){var _0x3bde49=typeof _0x446951[_0xa2ed('0x1a')]===_0xa2ed('0x1b')&&typeof _0x446951[_0xa2ed('0x1c')]===_0xa2ed('0x1b');var _0x12a1e0=_0x4fb281[_0xa2ed('0x1d')];var _0x1feed2=_0x3bde49?0x0:_0x446951['offset'];var _0x242895=_0x3bde49?_0x4fb281[_0xa2ed('0x1d')]:_0x446951['offset']+_0x446951[_0xa2ed('0x1c')];var _0x2061cc;if(_0x242895>=_0x12a1e0){_0x242895=_0x12a1e0;_0x2061cc=0xc8;}else{_0x2061cc=0xce;}_0x126055['status'](_0x2061cc);return _0x126055[_0xa2ed('0x1e')]('Content-Range',_0x1feed2+'-'+_0x242895+'/'+_0x12a1e0)[_0xa2ed('0x19')](_0x4fb281);}return null;};}function patchUpdates(_0x276422){return function(_0x5a9c9c){try{jsonpatch[_0xa2ed('0x1f')](_0x5a9c9c,_0x276422,!![]);}catch(_0x21a661){return BPromise[_0xa2ed('0x20')](_0x21a661);}return _0x5a9c9c[_0xa2ed('0x21')]();};}function saveUpdates(_0x527568,_0x311bbe){return function(_0x5e48f5){if(_0x5e48f5){return _0x5e48f5['update'](_0x527568)[_0xa2ed('0x22')](function(_0x3a1093){return _0x3a1093;});}return null;};}function removeEntity(_0x21f8f6,_0xa74fe7){return function(_0x513776){if(_0x513776){return _0x513776[_0xa2ed('0x23')]()[_0xa2ed('0x22')](function(){_0x21f8f6[_0xa2ed('0x17')](0xcc)[_0xa2ed('0x18')]();});}};}function handleEntityNotFound(_0x591045,_0x298135){return function(_0x5d4913){if(!_0x5d4913){_0x591045[_0xa2ed('0x24')](0x194);}return _0x5d4913;};}function handleError(_0x29605a,_0x199fb6){_0x199fb6=_0x199fb6||0x1f4;return function(_0x24277b){logger[_0xa2ed('0x25')](_0x24277b['stack']);if(_0x24277b[_0xa2ed('0x26')]){delete _0x24277b[_0xa2ed('0x26')];}_0x29605a[_0xa2ed('0x17')](_0x199fb6)[_0xa2ed('0x27')](_0x24277b);};}exports['index']=function(_0x384c39,_0x5042e3){var _0x1f5b08={},_0x3ea600={},_0x2e68c0={'count':0x0,'rows':[]};var _0x2f9568=_['map'](db[_0xa2ed('0x28')]['rawAttributes'],function(_0x4c8a6c){return{'name':_0x4c8a6c[_0xa2ed('0x29')],'type':_0x4c8a6c[_0xa2ed('0x2a')][_0xa2ed('0x2b')]};});_0x3ea600[_0xa2ed('0x2c')]=_['map'](_0x2f9568,_0xa2ed('0x26'));_0x3ea600[_0xa2ed('0x2d')]=_['keys'](_0x384c39['query']);_0x3ea600['filters']=_['intersection'](_0x3ea600[_0xa2ed('0x2c')],_0x3ea600['query']);_0x1f5b08[_0xa2ed('0x2e')]=_[_0xa2ed('0x2f')](_0x3ea600[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x384c39['query']['fields']));_0x1f5b08[_0xa2ed('0x2e')]=_0x1f5b08[_0xa2ed('0x2e')][_0xa2ed('0x31')]?_0x1f5b08[_0xa2ed('0x2e')]:_0x3ea600[_0xa2ed('0x2c')];if(!_0x384c39['query'][_0xa2ed('0x32')](_0xa2ed('0x33'))){_0x1f5b08[_0xa2ed('0x1c')]=qs[_0xa2ed('0x1c')](_0x384c39['query'][_0xa2ed('0x1c')]);_0x1f5b08['offset']=qs[_0xa2ed('0x1a')](_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x1a')]);}_0x1f5b08[_0xa2ed('0x34')]=qs['sort'](_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x35')]);_0x1f5b08[_0xa2ed('0x36')]=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x384c39[_0xa2ed('0x2d')],_0x3ea600[_0xa2ed('0x37')]),_0x2f9568);if(_0x384c39['query']['filter']){_0x1f5b08['where']=_[_0xa2ed('0x39')](_0x1f5b08[_0xa2ed('0x36')],{'$or':_['map'](_0x2f9568,function(_0x4cc44e){if(_0x4cc44e['type']!==_0xa2ed('0x3a')){var _0x345688={};_0x345688[_0x4cc44e[_0xa2ed('0x26')]]={'$like':'%'+_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x3b')]+'%'};return _0x345688;}})});}_0x1f5b08=_[_0xa2ed('0x39')]({},_0x1f5b08,_0x384c39[_0xa2ed('0x3c')]);var _0x512f26={'where':_0x1f5b08[_0xa2ed('0x36')]};return db[_0xa2ed('0x28')][_0xa2ed('0x1d')](_0x512f26)[_0xa2ed('0x22')](function(_0x2f711f){_0x2e68c0[_0xa2ed('0x1d')]=_0x2f711f;if(_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x3d')]){_0x1f5b08[_0xa2ed('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xa2ed('0x3f')](_0x1f5b08);})[_0xa2ed('0x22')](function(_0x42e79b){_0x2e68c0['rows']=_0x42e79b;return _0x2e68c0;})[_0xa2ed('0x22')](respondWithFilteredResult(_0x5042e3,_0x1f5b08))[_0xa2ed('0x40')](handleError(_0x5042e3,null));};exports[_0xa2ed('0x41')]=function(_0x184463,_0x57aa28){var _0xb0ad7={'raw':![],'where':{'id':_0x184463['params']['id']}},_0x108477={};_0x108477['model']=_['keys'](db[_0xa2ed('0x28')][_0xa2ed('0x42')]);_0x108477[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x184463[_0xa2ed('0x2d')]);_0x108477[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0x108477[_0xa2ed('0x2c')],_0x108477[_0xa2ed('0x2d')]);_0xb0ad7[_0xa2ed('0x2e')]=_['intersection'](_0x108477[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x184463[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0xb0ad7['attributes']=_0xb0ad7['attributes'][_0xa2ed('0x31')]?_0xb0ad7[_0xa2ed('0x2e')]:_0x108477[_0xa2ed('0x2c')];if(_0x184463['query'][_0xa2ed('0x3d')]){_0xb0ad7[_0xa2ed('0x3e')]=[{'all':!![]}];}_0xb0ad7=_[_0xa2ed('0x39')]({},_0xb0ad7,_0x184463['options']);return db[_0xa2ed('0x28')][_0xa2ed('0x44')](_0xb0ad7)[_0xa2ed('0x22')](handleEntityNotFound(_0x57aa28,null))['then'](respondWithResult(_0x57aa28,null))[_0xa2ed('0x40')](handleError(_0x57aa28,null));};exports['create']=function(_0x522292,_0x154f81){return db[_0xa2ed('0x28')][_0xa2ed('0x45')](_0x522292[_0xa2ed('0x46')],{})[_0xa2ed('0x22')](respondWithResult(_0x154f81,0xc9))[_0xa2ed('0x40')](handleError(_0x154f81,null));};exports[_0xa2ed('0x47')]=function(_0x421010,_0x27406b){if(_0x421010[_0xa2ed('0x46')]['id']){delete _0x421010[_0xa2ed('0x46')]['id'];}return db[_0xa2ed('0x28')]['find']({'where':{'id':_0x421010[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x27406b,null))[_0xa2ed('0x22')](saveUpdates(_0x421010[_0xa2ed('0x46')],null))[_0xa2ed('0x22')](respondWithResult(_0x27406b,null))[_0xa2ed('0x40')](handleError(_0x27406b,null));};exports['destroy']=function(_0x56d4c2,_0x4a5898){return db[_0xa2ed('0x28')][_0xa2ed('0x44')]({'where':{'id':_0x56d4c2['params']['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x4a5898,null))[_0xa2ed('0x22')](removeEntity(_0x4a5898,null))['catch'](handleError(_0x4a5898,null));};exports[_0xa2ed('0x49')]=function(_0x555175,_0x6446b1,_0x202ee2){var _0x5a9dd5={};var _0xa7e6e8={};var _0xdeb00b;var _0x6477ed;return db['DeskConfiguration']['findOne']({'where':{'id':_0x555175[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x6446b1,null))[_0xa2ed('0x22')](function(_0x46c4a2){if(_0x46c4a2){_0xdeb00b=_0x46c4a2;_0xa7e6e8[_0xa2ed('0x2c')]=_['keys'](db[_0xa2ed('0x4a')]['rawAttributes']);_0xa7e6e8[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x555175[_0xa2ed('0x2d')]);_0xa7e6e8[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0xa7e6e8[_0xa2ed('0x2c')],_0xa7e6e8['query']);_0x5a9dd5['attributes']=_['intersection'](_0xa7e6e8[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x555175[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0x5a9dd5[_0xa2ed('0x2e')]=_0x5a9dd5[_0xa2ed('0x2e')][_0xa2ed('0x31')]?_0x5a9dd5['attributes']:_0xa7e6e8[_0xa2ed('0x2c')];_0x5a9dd5[_0xa2ed('0x34')]=qs[_0xa2ed('0x35')](_0x555175[_0xa2ed('0x2d')]['sort']);_0x5a9dd5[_0xa2ed('0x36')]=qs['filters'](_['pick'](_0x555175[_0xa2ed('0x2d')],_0xa7e6e8[_0xa2ed('0x37')]));if(_0x555175['query'][_0xa2ed('0x3b')]){_0x5a9dd5[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x5a9dd5[_0xa2ed('0x36')],{'$or':_['map'](_0x5a9dd5[_0xa2ed('0x2e')],function(_0x575111){var _0x3c5e55={};_0x3c5e55[_0x575111]={'$like':'%'+_0x555175[_0xa2ed('0x2d')]['filter']+'%'};return _0x3c5e55;})});}_0x5a9dd5=_[_0xa2ed('0x39')]({},_0x5a9dd5,_0x555175[_0xa2ed('0x3c')]);return _0xdeb00b[_0xa2ed('0x49')](_0x5a9dd5);}})['then'](function(_0x179811){if(_0x179811){_0x6477ed=_0x179811[_0xa2ed('0x31')];if(!_0x555175['query'][_0xa2ed('0x32')]('nolimit')){_0x5a9dd5[_0xa2ed('0x1c')]=qs['limit'](_0x555175[_0xa2ed('0x2d')][_0xa2ed('0x1c')]);_0x5a9dd5[_0xa2ed('0x1a')]=qs[_0xa2ed('0x1a')](_0x555175['query'][_0xa2ed('0x1a')]);}return _0xdeb00b[_0xa2ed('0x49')](_0x5a9dd5);}})[_0xa2ed('0x22')](function(_0x120818){if(_0x120818){return _0x120818?{'count':_0x6477ed,'rows':_0x120818}:null;}})['then'](respondWithResult(_0x6446b1,null))['catch'](handleError(_0x6446b1,null));};exports['getSubjects']=function(_0x4bf260,_0x2e6018,_0x495b74){var _0x41537a={};var _0x1addbf={};var _0x56e60e;var _0xc2e3cf;return db[_0xa2ed('0x28')][_0xa2ed('0x4b')]({'where':{'id':_0x4bf260[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x2e6018,null))[_0xa2ed('0x22')](function(_0x198ba0){if(_0x198ba0){_0x56e60e=_0x198ba0;_0x1addbf['model']=_['keys'](db[_0xa2ed('0x4a')]['rawAttributes']);_0x1addbf[_0xa2ed('0x2d')]=_['keys'](_0x4bf260[_0xa2ed('0x2d')]);_0x1addbf[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0x1addbf[_0xa2ed('0x2c')],_0x1addbf[_0xa2ed('0x2d')]);_0x41537a[_0xa2ed('0x2e')]=_[_0xa2ed('0x2f')](_0x1addbf[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0x41537a[_0xa2ed('0x2e')]=_0x41537a['attributes'][_0xa2ed('0x31')]?_0x41537a['attributes']:_0x1addbf['model'];_0x41537a[_0xa2ed('0x34')]=qs[_0xa2ed('0x35')](_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x35')]);_0x41537a['where']=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x4bf260[_0xa2ed('0x2d')],_0x1addbf[_0xa2ed('0x37')]));if(_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x3b')]){_0x41537a[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x41537a[_0xa2ed('0x36')],{'$or':_['map'](_0x41537a[_0xa2ed('0x2e')],function(_0x463cd1){var _0x4df5bf={};_0x4df5bf[_0x463cd1]={'$like':'%'+_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x3b')]+'%'};return _0x4df5bf;})});}_0x41537a=_[_0xa2ed('0x39')]({},_0x41537a,_0x4bf260[_0xa2ed('0x3c')]);return _0x56e60e[_0xa2ed('0x4c')](_0x41537a);}})[_0xa2ed('0x22')](function(_0x1984c7){if(_0x1984c7){_0xc2e3cf=_0x1984c7['length'];if(!_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x32')](_0xa2ed('0x33'))){_0x41537a['limit']=qs[_0xa2ed('0x1c')](_0x4bf260['query'][_0xa2ed('0x1c')]);_0x41537a[_0xa2ed('0x1a')]=qs[_0xa2ed('0x1a')](_0x4bf260[_0xa2ed('0x2d')]['offset']);}return _0x56e60e[_0xa2ed('0x4c')](_0x41537a);}})[_0xa2ed('0x22')](function(_0x236eb4){if(_0x236eb4){return _0x236eb4?{'count':_0xc2e3cf,'rows':_0x236eb4}:null;}})[_0xa2ed('0x22')](respondWithResult(_0x2e6018,null))[_0xa2ed('0x40')](handleError(_0x2e6018,null));};exports[_0xa2ed('0x4d')]=function(_0x3b3981,_0x3bf278,_0x610f0b){var _0x7bc4f4={};var _0x1c4a24={};var _0x2e7ef6;var _0x336825;return db[_0xa2ed('0x28')][_0xa2ed('0x4b')]({'where':{'id':_0x3b3981[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x3bf278,null))[_0xa2ed('0x22')](function(_0x19c368){if(_0x19c368){_0x2e7ef6=_0x19c368;_0x1c4a24[_0xa2ed('0x2c')]=_[_0xa2ed('0x43')](db[_0xa2ed('0x4a')][_0xa2ed('0x42')]);_0x1c4a24[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x3b3981['query']);_0x1c4a24[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0x1c4a24['model'],_0x1c4a24[_0xa2ed('0x2d')]);_0x7bc4f4['attributes']=_[_0xa2ed('0x2f')](_0x1c4a24['model'],qs['fields'](_0x3b3981[_0xa2ed('0x2d')]['fields']));_0x7bc4f4['attributes']=_0x7bc4f4['attributes'][_0xa2ed('0x31')]?_0x7bc4f4[_0xa2ed('0x2e')]:_0x1c4a24[_0xa2ed('0x2c')];_0x7bc4f4['order']=qs[_0xa2ed('0x35')](_0x3b3981['query'][_0xa2ed('0x35')]);_0x7bc4f4[_0xa2ed('0x36')]=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x3b3981[_0xa2ed('0x2d')],_0x1c4a24[_0xa2ed('0x37')]));if(_0x3b3981['query']['filter']){_0x7bc4f4[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x7bc4f4[_0xa2ed('0x36')],{'$or':_['map'](_0x7bc4f4[_0xa2ed('0x2e')],function(_0x3328ec){var _0x7a1c73={};_0x7a1c73[_0x3328ec]={'$like':'%'+_0x3b3981[_0xa2ed('0x2d')]['filter']+'%'};return _0x7a1c73;})});}_0x7bc4f4=_[_0xa2ed('0x39')]({},_0x7bc4f4,_0x3b3981['options']);return _0x2e7ef6[_0xa2ed('0x4d')](_0x7bc4f4);}})[_0xa2ed('0x22')](function(_0x649b39){if(_0x649b39){_0x336825=_0x649b39[_0xa2ed('0x31')];if(!_0x3b3981[_0xa2ed('0x2d')]['hasOwnProperty']('nolimit')){_0x7bc4f4[_0xa2ed('0x1c')]=qs[_0xa2ed('0x1c')](_0x3b3981['query']['limit']);_0x7bc4f4['offset']=qs[_0xa2ed('0x1a')](_0x3b3981[_0xa2ed('0x2d')][_0xa2ed('0x1a')]);}return _0x2e7ef6['getDescriptions'](_0x7bc4f4);}})[_0xa2ed('0x22')](function(_0x285bae){if(_0x285bae){return _0x285bae?{'count':_0x336825,'rows':_0x285bae}:null;}})[_0xa2ed('0x22')](respondWithResult(_0x3bf278,null))[_0xa2ed('0x40')](handleError(_0x3bf278,null));};exports[_0xa2ed('0x4e')]=function(_0x31b86b,_0x37fac7,_0x94933a){var _0x560889={};var _0x4872df={};var _0x5b692c;var _0x53f6b1;return db[_0xa2ed('0x28')][_0xa2ed('0x4b')]({'where':{'id':_0x31b86b['params']['id']}})['then'](handleEntityNotFound(_0x37fac7,null))['then'](function(_0x1cd1d3){if(_0x1cd1d3){_0x5b692c=_0x1cd1d3;_0x4872df[_0xa2ed('0x2c')]=_[_0xa2ed('0x43')](db[_0xa2ed('0x4f')][_0xa2ed('0x42')]);_0x4872df[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x31b86b[_0xa2ed('0x2d')]);_0x4872df[_0xa2ed('0x37')]=_['intersection'](_0x4872df['model'],_0x4872df['query']);_0x560889[_0xa2ed('0x2e')]=_[_0xa2ed('0x2f')](_0x4872df[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0x560889[_0xa2ed('0x2e')]=_0x560889['attributes']['length']?_0x560889['attributes']:_0x4872df[_0xa2ed('0x2c')];_0x560889['order']=qs[_0xa2ed('0x35')](_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x35')]);_0x560889['where']=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x31b86b[_0xa2ed('0x2d')],_0x4872df[_0xa2ed('0x37')]));if(_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x3b')]){_0x560889[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x560889[_0xa2ed('0x36')],{'$or':_[_0xa2ed('0x50')](_0x560889[_0xa2ed('0x2e')],function(_0x2463ea){var _0x4a555b={};_0x4a555b[_0x2463ea]={'$like':'%'+_0x31b86b['query'][_0xa2ed('0x3b')]+'%'};return _0x4a555b;})});}_0x560889=_[_0xa2ed('0x39')]({},_0x560889,_0x31b86b['options']);return _0x5b692c[_0xa2ed('0x4e')](_0x560889);}})['then'](function(_0x30009a){if(_0x30009a){_0x53f6b1=_0x30009a['length'];if(!_0x31b86b['query'][_0xa2ed('0x32')]('nolimit')){_0x560889['limit']=qs[_0xa2ed('0x1c')](_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x1c')]);_0x560889[_0xa2ed('0x1a')]=qs[_0xa2ed('0x1a')](_0x31b86b['query']['offset']);}return _0x5b692c[_0xa2ed('0x4e')](_0x560889);}})[_0xa2ed('0x22')](function(_0x5b1e29){if(_0x5b1e29){return _0x5b1e29?{'count':_0x53f6b1,'rows':_0x5b1e29}:null;}})['then'](respondWithResult(_0x37fac7,null))['catch'](handleError(_0x37fac7,null));};exports[_0xa2ed('0x51')]=function(_0x247d46,_0x5f32aa,_0x2e8298){if(_0x247d46[_0xa2ed('0x46')]['id']){delete _0x247d46[_0xa2ed('0x46')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x247d46[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x5f32aa,null))[_0xa2ed('0x22')](function(_0x3e94d2){if(_0x3e94d2){return _0x3e94d2[_0xa2ed('0x51')](_0x247d46[_0xa2ed('0x46')][_0xa2ed('0x52')]||[]);}return null;})['then'](respondWithResult(_0x5f32aa,null))[_0xa2ed('0x40')](handleError(_0x5f32aa,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0d16420..0e24a6d 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 _0x0bec=['exports','define','DeskConfiguration','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x547069,_0x811b37){var _0x247154=function(_0x4056ac){while(--_0x4056ac){_0x547069['push'](_0x547069['shift']());}};_0x247154(++_0x811b37);}(_0x0bec,0xea));var _0xc0be=function(_0x2dca05,_0x5a1231){_0x2dca05=_0x2dca05-0x0;var _0x42631a=_0x0bec[_0x2dca05];return _0x42631a;};'use strict';var _=require(_0xc0be('0x0'));var util=require(_0xc0be('0x1'));var logger=require(_0xc0be('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc0be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0be('0x4'));var rimraf=require(_0xc0be('0x5'));var config=require(_0xc0be('0x6'));var attributes=require(_0xc0be('0x7'));module[_0xc0be('0x8')]=function(_0x1cd6ba,_0x5544b5){return _0x1cd6ba[_0xc0be('0x9')](_0xc0be('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b00=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x23e92b,_0x2b39f8){var _0xc00ad6=function(_0x9157c2){while(--_0x9157c2){_0x23e92b['push'](_0x23e92b['shift']());}};_0xc00ad6(++_0x2b39f8);}(_0x9b00,0xcc));var _0x09b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9b00[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x09b0('0x0'));var util=require(_0x09b0('0x1'));var logger=require(_0x09b0('0x2'))('api');var moment=require(_0x09b0('0x3'));var BPromise=require(_0x09b0('0x4'));var rp=require(_0x09b0('0x5'));var fs=require('fs');var path=require(_0x09b0('0x6'));var rimraf=require(_0x09b0('0x7'));var config=require(_0x09b0('0x8'));var attributes=require(_0x09b0('0x9'));module['exports']=function(_0x79bc56,_0x57b9e0){return _0x79bc56[_0x09b0('0xa')](_0x09b0('0xb'),attributes,{'tableName':_0x09b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 7dcb88f..86d636a 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 _0xe98f=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1d7b41,_0x55b305){var _0x443ec1=function(_0x306ae5){while(--_0x306ae5){_0x1d7b41['push'](_0x1d7b41['shift']());}};_0x443ec1(++_0x55b305);}(_0xe98f,0xde));var _0xfe98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe98('0x0'));var util=require('util');var moment=require(_0xfe98('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe98('0x2'));var fs=require('fs');var Redis=require(_0xfe98('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe98('0x4'))('rpc');var config=require(_0xfe98('0x5'));var jayson=require(_0xfe98('0x6'));var client=jayson['client'][_0xfe98('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x585363,_0x39bc9f,_0x2721d1){return new BPromise(function(_0x3cbc45,_0x502d20){return client[_0xfe98('0x8')](_0x585363,_0x2721d1)[_0xfe98('0x9')](function(_0x57fc24){logger[_0xfe98('0xa')](_0xfe98('0xb'),_0x39bc9f,_0xfe98('0xc'));logger[_0xfe98('0xd')](_0xfe98('0xe'),_0x39bc9f,_0xfe98('0xc'),JSON['stringify'](_0x57fc24));if(_0x57fc24[_0xfe98('0xf')]){if(_0x57fc24[_0xfe98('0xf')][_0xfe98('0x10')]===0x1f4){logger[_0xfe98('0xf')](_0xfe98('0xb'),_0x39bc9f,_0x57fc24['error'][_0xfe98('0x11')]);return _0x502d20(_0x57fc24[_0xfe98('0xf')]['message']);}logger[_0xfe98('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x39bc9f,_0x57fc24[_0xfe98('0xf')][_0xfe98('0x11')]);return _0x3cbc45(_0x57fc24[_0xfe98('0xf')][_0xfe98('0x11')]);}else{logger['info'](_0xfe98('0xb'),_0x39bc9f,'request\x20sent');_0x3cbc45(_0x57fc24[_0xfe98('0x12')][_0xfe98('0x11')]);}})[_0xfe98('0x13')](function(_0x476932){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x39bc9f,_0x476932);_0x502d20(_0x476932);});});} \ No newline at end of file +var _0xc2e3=['../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3f3131,_0x326527){var _0x350016=function(_0x96ec78){while(--_0x96ec78){_0x3f3131['push'](_0x3f3131['shift']());}};_0x350016(++_0x326527);}(_0xc2e3,0x1f3));var _0x3c2e=function(_0x2d41a3,_0x80e45b){_0x2d41a3=_0x2d41a3-0x0;var _0x5acc25=_0xc2e3[_0x2d41a3];return _0x5acc25;};'use strict';var _=require(_0x3c2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c2e('0x1'));var rs=require(_0x3c2e('0x2'));var fs=require('fs');var Redis=require(_0x3c2e('0x3'));var db=require(_0x3c2e('0x4'))['db'];var utils=require(_0x3c2e('0x5'));var logger=require('../../config/logger')(_0x3c2e('0x6'));var config=require(_0x3c2e('0x7'));var jayson=require(_0x3c2e('0x8'));var client=jayson[_0x3c2e('0x9')][_0x3c2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51be99,_0x43763c,_0x1fbbcf){return new BPromise(function(_0x2c52a7,_0x2d3b55){return client['request'](_0x51be99,_0x1fbbcf)[_0x3c2e('0xb')](function(_0x594c93){logger[_0x3c2e('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x43763c,'request\x20sent');logger[_0x3c2e('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x43763c,_0x3c2e('0xe'),JSON[_0x3c2e('0xf')](_0x594c93));if(_0x594c93['error']){if(_0x594c93[_0x3c2e('0x10')][_0x3c2e('0x11')]===0x1f4){logger['error'](_0x3c2e('0x12'),_0x43763c,_0x594c93[_0x3c2e('0x10')][_0x3c2e('0x13')]);return _0x2d3b55(_0x594c93[_0x3c2e('0x10')]['message']);}logger[_0x3c2e('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x43763c,_0x594c93['error']['message']);return _0x2c52a7(_0x594c93[_0x3c2e('0x10')][_0x3c2e('0x13')]);}else{logger[_0x3c2e('0xc')](_0x3c2e('0x12'),_0x43763c,_0x3c2e('0xe'));_0x2c52a7(_0x594c93[_0x3c2e('0x14')][_0x3c2e('0x13')]);}})[_0x3c2e('0x15')](function(_0x5e7865){logger[_0x3c2e('0x10')](_0x3c2e('0x12'),_0x43763c,_0x5e7865);_0x2d3b55(_0x5e7865);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 845835c..9af238d 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 _0xbb87=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb87,0xa1));var _0x7bb8=function(_0x598042,_0x4108dd){_0x598042=_0x598042-0x0;var _0x1aef63=_0xbb87[_0x598042];return _0x1aef63;};'use strict';var multer=require(_0x7bb8('0x0'));var util=require(_0x7bb8('0x1'));var path=require(_0x7bb8('0x2'));var timeout=require(_0x7bb8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7bb8('0x4'));var interaction=require(_0x7bb8('0x5'));var config=require('../../config/environment');var controller=require(_0x7bb8('0x6'));router[_0x7bb8('0x7')]('/',auth[_0x7bb8('0x8')](),controller['index']);router[_0x7bb8('0x7')](_0x7bb8('0x9'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0xa')]);router['post']('/',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0xb')]);router[_0x7bb8('0xc')](_0x7bb8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7bb8('0xd')](_0x7bb8('0x9'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0xe')]);module[_0x7bb8('0xf')]=router; \ No newline at end of file +var _0x6262=['delete','/:id','util','connect-timeout','express','Router','../../config/environment','get','index','isAuthenticated','show','post','create','update'];(function(_0x3e89eb,_0x118484){var _0x1cf4ab=function(_0x5a8f2d){while(--_0x5a8f2d){_0x3e89eb['push'](_0x3e89eb['shift']());}};_0x1cf4ab(++_0x118484);}(_0x6262,0x72));var _0x2626=function(_0x58a364,_0x3439f6){_0x58a364=_0x58a364-0x0;var _0x409b74=_0x6262[_0x58a364];return _0x409b74;};'use strict';var multer=require('multer');var util=require(_0x2626('0x0'));var path=require('path');var timeout=require(_0x2626('0x1'));var express=require(_0x2626('0x2'));var router=express[_0x2626('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2626('0x4'));var controller=require('./intDeskField.controller');router[_0x2626('0x5')]('/',auth['isAuthenticated'](),controller[_0x2626('0x6')]);router['get']('/:id',auth[_0x2626('0x7')](),controller[_0x2626('0x8')]);router[_0x2626('0x9')]('/',auth[_0x2626('0x7')](),controller[_0x2626('0xa')]);router['put']('/:id',auth[_0x2626('0x7')](),controller[_0x2626('0xb')]);router[_0x2626('0xc')](_0x2626('0xd'),auth[_0x2626('0x7')](),controller['destroy']);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 8cc2be0..80b12c1 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 _0x32bf=['ENUM','string','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x137bda,_0x2b4b52){var _0x3258d6=function(_0x80824f){while(--_0x80824f){_0x137bda['push'](_0x137bda['shift']());}};_0x3258d6(++_0x2b4b52);}(_0x32bf,0x147));var _0xf32b=function(_0x3e55ed,_0x344e30){_0x3e55ed=_0x3e55ed-0x0;var _0x36ef8d=_0x32bf[_0x3e55ed];return _0x36ef8d;};'use strict';var Sequelize=require(_0xf32b('0x0'));module[_0xf32b('0x1')]={'type':{'type':Sequelize[_0xf32b('0x2')](_0xf32b('0x3'),_0xf32b('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0xf32b('0x3')},'content':{'type':Sequelize[_0xf32b('0x5')]},'key':{'type':Sequelize[_0xf32b('0x5')]},'keyType':{'type':Sequelize[_0xf32b('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xf32b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf32b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf32b('0x5')]}}; \ No newline at end of file +var _0xad89=['STRING','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x5181bf,_0x49af23){var _0x6167c3=function(_0x54a7bf){while(--_0x54a7bf){_0x5181bf['push'](_0x5181bf['shift']());}};_0x6167c3(++_0x49af23);}(_0xad89,0x1a9));var _0x9ad8=function(_0x12f4af,_0x4a2bb9){_0x12f4af=_0x12f4af-0x0;var _0x4c4d50=_0xad89[_0x12f4af];return _0x4c4d50;};'use strict';var Sequelize=require(_0x9ad8('0x0'));module[_0x9ad8('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9ad8('0x2'),_0x9ad8('0x3'),_0x9ad8('0x4'),_0x9ad8('0x5')),'defaultValue':_0x9ad8('0x6')},'content':{'type':Sequelize[_0x9ad8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9ad8('0x6'),_0x9ad8('0x2'),_0x9ad8('0x3'))},'keyContent':{'type':Sequelize[_0x9ad8('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9ad8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ad8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 18d2270..8bdbe04 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 _0xba55=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','then','name','index','map','DeskField','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xba55,0x1f3));var _0x5ba5=function(_0xaa87a9,_0x35606a){_0xaa87a9=_0xaa87a9-0x0;var _0x89e8d1=_0xba55[_0xaa87a9];return _0x89e8d1;};'use strict';var emlformat=require(_0x5ba5('0x0'));var rimraf=require(_0x5ba5('0x1'));var zipdir=require(_0x5ba5('0x2'));var jsonpatch=require(_0x5ba5('0x3'));var rp=require('request-promise');var moment=require(_0x5ba5('0x4'));var BPromise=require(_0x5ba5('0x5'));var Mustache=require(_0x5ba5('0x6'));var util=require(_0x5ba5('0x7'));var path=require(_0x5ba5('0x8'));var sox=require(_0x5ba5('0x9'));var csv=require('to-csv');var ejs=require(_0x5ba5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ba5('0xb'));var squel=require(_0x5ba5('0xc'));var crypto=require(_0x5ba5('0xd'));var jsforce=require(_0x5ba5('0xe'));var deskjs=require(_0x5ba5('0xf'));var toCsv=require(_0x5ba5('0x10'));var querystring=require(_0x5ba5('0x11'));var Papa=require(_0x5ba5('0x12'));var Redis=require('ioredis');var authService=require(_0x5ba5('0x13'));var qs=require(_0x5ba5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ba5('0x15'));var logger=require('../../config/logger')(_0x5ba5('0x16'));var utils=require(_0x5ba5('0x17'));var config=require(_0x5ba5('0x18'));var licenseUtil=require(_0x5ba5('0x19'));var db=require(_0x5ba5('0x1a'))['db'];function respondWithStatusCode(_0x3edd73,_0x12cd36){_0x12cd36=_0x12cd36||0xcc;return function(_0xe02cff){if(_0xe02cff){return _0x3edd73[_0x5ba5('0x1b')](_0x12cd36);}return _0x3edd73[_0x5ba5('0x1c')](_0x12cd36)[_0x5ba5('0x1d')]();};}function respondWithResult(_0x397a95,_0x81bec9){_0x81bec9=_0x81bec9||0xc8;return function(_0x43cf57){if(_0x43cf57){return _0x397a95[_0x5ba5('0x1c')](_0x81bec9)['json'](_0x43cf57);}};}function respondWithFilteredResult(_0x47af8d,_0x393751){return function(_0x56d746){if(_0x56d746){var _0x47ace1=typeof _0x393751['offset']===_0x5ba5('0x1e')&&typeof _0x393751['limit']===_0x5ba5('0x1e');var _0x425a86=_0x56d746[_0x5ba5('0x1f')];var _0x4677e5=_0x47ace1?0x0:_0x393751[_0x5ba5('0x20')];var _0x1a03ab=_0x47ace1?_0x56d746[_0x5ba5('0x1f')]:_0x393751['offset']+_0x393751[_0x5ba5('0x21')];var _0x53ce99;if(_0x1a03ab>=_0x425a86){_0x1a03ab=_0x425a86;_0x53ce99=0xc8;}else{_0x53ce99=0xce;}_0x47af8d['status'](_0x53ce99);return _0x47af8d[_0x5ba5('0x22')]('Content-Range',_0x4677e5+'-'+_0x1a03ab+'/'+_0x425a86)[_0x5ba5('0x23')](_0x56d746);}return null;};}function patchUpdates(_0x2bf6ca){return function(_0x325320){try{jsonpatch['apply'](_0x325320,_0x2bf6ca,!![]);}catch(_0x3fb230){return BPromise[_0x5ba5('0x24')](_0x3fb230);}return _0x325320[_0x5ba5('0x25')]();};}function saveUpdates(_0x4ac568,_0x286029){return function(_0x420668){if(_0x420668){return _0x420668['update'](_0x4ac568)[_0x5ba5('0x26')](function(_0x4ff13a){return _0x4ff13a;});}return null;};}function removeEntity(_0x370b8d,_0x2615f4){return function(_0x1ba75d){if(_0x1ba75d){return _0x1ba75d['destroy']()[_0x5ba5('0x26')](function(){_0x370b8d[_0x5ba5('0x1c')](0xcc)[_0x5ba5('0x1d')]();});}};}function handleEntityNotFound(_0x1c26ea,_0x3f7da7){return function(_0xc487de){if(!_0xc487de){_0x1c26ea[_0x5ba5('0x1b')](0x194);}return _0xc487de;};}function handleError(_0x13cfc8,_0x2225ca){_0x2225ca=_0x2225ca||0x1f4;return function(_0x20e7e9){logger['error'](_0x20e7e9['stack']);if(_0x20e7e9[_0x5ba5('0x27')]){delete _0x20e7e9[_0x5ba5('0x27')];}_0x13cfc8[_0x5ba5('0x1c')](_0x2225ca)['send'](_0x20e7e9);};}exports[_0x5ba5('0x28')]=function(_0x5315e1,_0x3129a5){var _0x2db0b8={},_0xdb7acf={},_0x295c6a={'count':0x0,'rows':[]};var _0x555efa=_[_0x5ba5('0x29')](db[_0x5ba5('0x2a')][_0x5ba5('0x2b')],function(_0x1b409d){return{'name':_0x1b409d['fieldName'],'type':_0x1b409d[_0x5ba5('0x2c')][_0x5ba5('0x2d')]};});_0xdb7acf['model']=_['map'](_0x555efa,_0x5ba5('0x27'));_0xdb7acf[_0x5ba5('0x2e')]=_[_0x5ba5('0x2f')](_0x5315e1[_0x5ba5('0x2e')]);_0xdb7acf['filters']=_['intersection'](_0xdb7acf[_0x5ba5('0x30')],_0xdb7acf[_0x5ba5('0x2e')]);_0x2db0b8[_0x5ba5('0x31')]=_['intersection'](_0xdb7acf[_0x5ba5('0x30')],qs['fields'](_0x5315e1['query'][_0x5ba5('0x32')]));_0x2db0b8['attributes']=_0x2db0b8[_0x5ba5('0x31')][_0x5ba5('0x33')]?_0x2db0b8[_0x5ba5('0x31')]:_0xdb7acf[_0x5ba5('0x30')];if(!_0x5315e1[_0x5ba5('0x2e')][_0x5ba5('0x34')](_0x5ba5('0x35'))){_0x2db0b8['limit']=qs[_0x5ba5('0x21')](_0x5315e1['query'][_0x5ba5('0x21')]);_0x2db0b8[_0x5ba5('0x20')]=qs[_0x5ba5('0x20')](_0x5315e1[_0x5ba5('0x2e')]['offset']);}_0x2db0b8[_0x5ba5('0x36')]=qs[_0x5ba5('0x37')](_0x5315e1[_0x5ba5('0x2e')][_0x5ba5('0x37')]);_0x2db0b8['where']=qs[_0x5ba5('0x38')](_[_0x5ba5('0x39')](_0x5315e1['query'],_0xdb7acf['filters']),_0x555efa);if(_0x5315e1[_0x5ba5('0x2e')]['filter']){_0x2db0b8[_0x5ba5('0x3a')]=_[_0x5ba5('0x3b')](_0x2db0b8[_0x5ba5('0x3a')],{'$or':_[_0x5ba5('0x29')](_0x555efa,function(_0x47c213){if(_0x47c213['type']!==_0x5ba5('0x3c')){var _0x1ced9d={};_0x1ced9d[_0x47c213[_0x5ba5('0x27')]]={'$like':'%'+_0x5315e1[_0x5ba5('0x2e')][_0x5ba5('0x3d')]+'%'};return _0x1ced9d;}})});}_0x2db0b8=_[_0x5ba5('0x3b')]({},_0x2db0b8,_0x5315e1[_0x5ba5('0x3e')]);var _0x3781ef={'where':_0x2db0b8[_0x5ba5('0x3a')]};return db['DeskField'][_0x5ba5('0x1f')](_0x3781ef)[_0x5ba5('0x26')](function(_0x2d1801){_0x295c6a[_0x5ba5('0x1f')]=_0x2d1801;if(_0x5315e1[_0x5ba5('0x2e')][_0x5ba5('0x3f')]){_0x2db0b8[_0x5ba5('0x40')]=[{'all':!![]}];}return db[_0x5ba5('0x2a')][_0x5ba5('0x41')](_0x2db0b8);})[_0x5ba5('0x26')](function(_0x57fe05){_0x295c6a[_0x5ba5('0x42')]=_0x57fe05;return _0x295c6a;})['then'](respondWithFilteredResult(_0x3129a5,_0x2db0b8))[_0x5ba5('0x43')](handleError(_0x3129a5,null));};exports['show']=function(_0x5f140e,_0x2a45e9){var _0x2fcb81={'raw':!![],'where':{'id':_0x5f140e[_0x5ba5('0x44')]['id']}},_0x33b414={};_0x33b414[_0x5ba5('0x30')]=_['keys'](db[_0x5ba5('0x2a')][_0x5ba5('0x2b')]);_0x33b414[_0x5ba5('0x2e')]=_[_0x5ba5('0x2f')](_0x5f140e[_0x5ba5('0x2e')]);_0x33b414[_0x5ba5('0x38')]=_[_0x5ba5('0x45')](_0x33b414[_0x5ba5('0x30')],_0x33b414[_0x5ba5('0x2e')]);_0x2fcb81[_0x5ba5('0x31')]=_[_0x5ba5('0x45')](_0x33b414[_0x5ba5('0x30')],qs['fields'](_0x5f140e[_0x5ba5('0x2e')][_0x5ba5('0x32')]));_0x2fcb81[_0x5ba5('0x31')]=_0x2fcb81[_0x5ba5('0x31')]['length']?_0x2fcb81[_0x5ba5('0x31')]:_0x33b414['model'];if(_0x5f140e['query'][_0x5ba5('0x3f')]){_0x2fcb81[_0x5ba5('0x40')]=[{'all':!![]}];}_0x2fcb81=_[_0x5ba5('0x3b')]({},_0x2fcb81,_0x5f140e[_0x5ba5('0x3e')]);return db[_0x5ba5('0x2a')][_0x5ba5('0x46')](_0x2fcb81)[_0x5ba5('0x26')](handleEntityNotFound(_0x2a45e9,null))[_0x5ba5('0x26')](respondWithResult(_0x2a45e9,null))[_0x5ba5('0x43')](handleError(_0x2a45e9,null));};exports[_0x5ba5('0x47')]=function(_0x4ad046,_0x211ce4){return db['DeskField'][_0x5ba5('0x47')](_0x4ad046['body'],{})[_0x5ba5('0x26')](respondWithResult(_0x211ce4,0xc9))[_0x5ba5('0x43')](handleError(_0x211ce4,null));};exports[_0x5ba5('0x48')]=function(_0x85aa8d,_0x474614){if(_0x85aa8d['body']['id']){delete _0x85aa8d[_0x5ba5('0x49')]['id'];}return db[_0x5ba5('0x2a')]['find']({'where':{'id':_0x85aa8d[_0x5ba5('0x44')]['id']}})['then'](handleEntityNotFound(_0x474614,null))[_0x5ba5('0x26')](saveUpdates(_0x85aa8d['body'],null))[_0x5ba5('0x26')](respondWithResult(_0x474614,null))[_0x5ba5('0x43')](handleError(_0x474614,null));};exports['destroy']=function(_0x4fe93b,_0x388378){return db[_0x5ba5('0x2a')][_0x5ba5('0x46')]({'where':{'id':_0x4fe93b[_0x5ba5('0x44')]['id']}})[_0x5ba5('0x26')](handleEntityNotFound(_0x388378,null))['then'](removeEntity(_0x388378,null))[_0x5ba5('0x43')](handleError(_0x388378,null));}; \ No newline at end of file +var _0xd837=['Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','stack','name','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','then','includeAll','include','rows','params','fields','options','find','catch','create','body','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set'];(function(_0x2c7e51,_0x561e94){var _0x5c69fb=function(_0x5e4e54){while(--_0x5e4e54){_0x2c7e51['push'](_0x2c7e51['shift']());}};_0x5c69fb(++_0x561e94);}(_0xd837,0x1a1));var _0x7d83=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xd837[_0x236d24];return _0x1574cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d83('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d83('0x1'));var rp=require(_0x7d83('0x2'));var moment=require('moment');var BPromise=require(_0x7d83('0x3'));var Mustache=require('mustache');var util=require(_0x7d83('0x4'));var path=require(_0x7d83('0x5'));var sox=require(_0x7d83('0x6'));var csv=require(_0x7d83('0x7'));var ejs=require(_0x7d83('0x8'));var fs=require('fs');var fs_extra=require(_0x7d83('0x9'));var _=require(_0x7d83('0xa'));var squel=require(_0x7d83('0xb'));var crypto=require(_0x7d83('0xc'));var jsforce=require(_0x7d83('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7d83('0xe'));var Papa=require(_0x7d83('0xf'));var Redis=require(_0x7d83('0x10'));var authService=require(_0x7d83('0x11'));var qs=require(_0x7d83('0x12'));var as=require(_0x7d83('0x13'));var hardwareService=require(_0x7d83('0x14'));var logger=require(_0x7d83('0x15'))('api');var utils=require(_0x7d83('0x16'));var config=require(_0x7d83('0x17'));var licenseUtil=require(_0x7d83('0x18'));var db=require(_0x7d83('0x19'))['db'];function respondWithStatusCode(_0x132130,_0x5335e1){_0x5335e1=_0x5335e1||0xcc;return function(_0x19165f){if(_0x19165f){return _0x132130['sendStatus'](_0x5335e1);}return _0x132130['status'](_0x5335e1)[_0x7d83('0x1a')]();};}function respondWithResult(_0x1586bf,_0xb49769){_0xb49769=_0xb49769||0xc8;return function(_0x42ba03){if(_0x42ba03){return _0x1586bf[_0x7d83('0x1b')](_0xb49769)['json'](_0x42ba03);}};}function respondWithFilteredResult(_0x30c006,_0x5ce871){return function(_0x156ce1){if(_0x156ce1){var _0x44553d=typeof _0x5ce871[_0x7d83('0x1c')]===_0x7d83('0x1d')&&typeof _0x5ce871['limit']==='undefined';var _0x2b947c=_0x156ce1['count'];var _0x426beb=_0x44553d?0x0:_0x5ce871['offset'];var _0x29ae09=_0x44553d?_0x156ce1[_0x7d83('0x1e')]:_0x5ce871['offset']+_0x5ce871[_0x7d83('0x1f')];var _0x44ba90;if(_0x29ae09>=_0x2b947c){_0x29ae09=_0x2b947c;_0x44ba90=0xc8;}else{_0x44ba90=0xce;}_0x30c006[_0x7d83('0x1b')](_0x44ba90);return _0x30c006[_0x7d83('0x20')](_0x7d83('0x21'),_0x426beb+'-'+_0x29ae09+'/'+_0x2b947c)[_0x7d83('0x22')](_0x156ce1);}return null;};}function patchUpdates(_0x3cdcb2){return function(_0x50856a){try{jsonpatch[_0x7d83('0x23')](_0x50856a,_0x3cdcb2,!![]);}catch(_0x3f033d){return BPromise[_0x7d83('0x24')](_0x3f033d);}return _0x50856a[_0x7d83('0x25')]();};}function saveUpdates(_0x22b0b7,_0x162320){return function(_0x12d2b6){if(_0x12d2b6){return _0x12d2b6[_0x7d83('0x26')](_0x22b0b7)['then'](function(_0x5dc560){return _0x5dc560;});}return null;};}function removeEntity(_0xe65f5e,_0x1329aa){return function(_0x44e0bb){if(_0x44e0bb){return _0x44e0bb[_0x7d83('0x27')]()['then'](function(){_0xe65f5e[_0x7d83('0x1b')](0xcc)[_0x7d83('0x1a')]();});}};}function handleEntityNotFound(_0x1d03a5,_0x1ad336){return function(_0x1aebb4){if(!_0x1aebb4){_0x1d03a5[_0x7d83('0x28')](0x194);}return _0x1aebb4;};}function handleError(_0x266033,_0x3b921e){_0x3b921e=_0x3b921e||0x1f4;return function(_0x1c251c){logger[_0x7d83('0x29')](_0x1c251c[_0x7d83('0x2a')]);if(_0x1c251c[_0x7d83('0x2b')]){delete _0x1c251c[_0x7d83('0x2b')];}_0x266033[_0x7d83('0x1b')](_0x3b921e)['send'](_0x1c251c);};}exports['index']=function(_0xac4328,_0x4489f4){var _0x8b464c={},_0x530067={},_0x2e2d7a={'count':0x0,'rows':[]};var _0x56a0ce=_[_0x7d83('0x2c')](db[_0x7d83('0x2d')][_0x7d83('0x2e')],function(_0x59570e){return{'name':_0x59570e[_0x7d83('0x2f')],'type':_0x59570e['type'][_0x7d83('0x30')]};});_0x530067[_0x7d83('0x31')]=_[_0x7d83('0x2c')](_0x56a0ce,_0x7d83('0x2b'));_0x530067[_0x7d83('0x32')]=_[_0x7d83('0x33')](_0xac4328[_0x7d83('0x32')]);_0x530067[_0x7d83('0x34')]=_[_0x7d83('0x35')](_0x530067[_0x7d83('0x31')],_0x530067['query']);_0x8b464c[_0x7d83('0x36')]=_[_0x7d83('0x35')](_0x530067['model'],qs['fields'](_0xac4328['query']['fields']));_0x8b464c['attributes']=_0x8b464c[_0x7d83('0x36')][_0x7d83('0x37')]?_0x8b464c[_0x7d83('0x36')]:_0x530067['model'];if(!_0xac4328[_0x7d83('0x32')][_0x7d83('0x38')](_0x7d83('0x39'))){_0x8b464c[_0x7d83('0x1f')]=qs[_0x7d83('0x1f')](_0xac4328[_0x7d83('0x32')]['limit']);_0x8b464c[_0x7d83('0x1c')]=qs['offset'](_0xac4328[_0x7d83('0x32')][_0x7d83('0x1c')]);}_0x8b464c['order']=qs[_0x7d83('0x3a')](_0xac4328[_0x7d83('0x32')]['sort']);_0x8b464c['where']=qs[_0x7d83('0x34')](_[_0x7d83('0x3b')](_0xac4328[_0x7d83('0x32')],_0x530067[_0x7d83('0x34')]),_0x56a0ce);if(_0xac4328['query']['filter']){_0x8b464c[_0x7d83('0x3c')]=_[_0x7d83('0x3d')](_0x8b464c[_0x7d83('0x3c')],{'$or':_[_0x7d83('0x2c')](_0x56a0ce,function(_0x40a1a9){if(_0x40a1a9[_0x7d83('0x3e')]!==_0x7d83('0x3f')){var _0x55b17d={};_0x55b17d[_0x40a1a9[_0x7d83('0x2b')]]={'$like':'%'+_0xac4328[_0x7d83('0x32')]['filter']+'%'};return _0x55b17d;}})});}_0x8b464c=_['merge']({},_0x8b464c,_0xac4328['options']);var _0x429ff3={'where':_0x8b464c[_0x7d83('0x3c')]};return db['DeskField'][_0x7d83('0x1e')](_0x429ff3)[_0x7d83('0x40')](function(_0x26aec3){_0x2e2d7a[_0x7d83('0x1e')]=_0x26aec3;if(_0xac4328[_0x7d83('0x32')][_0x7d83('0x41')]){_0x8b464c[_0x7d83('0x42')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x8b464c);})[_0x7d83('0x40')](function(_0x57010d){_0x2e2d7a[_0x7d83('0x43')]=_0x57010d;return _0x2e2d7a;})[_0x7d83('0x40')](respondWithFilteredResult(_0x4489f4,_0x8b464c))['catch'](handleError(_0x4489f4,null));};exports['show']=function(_0x1085ce,_0x41f111){var _0xed233a={'raw':!![],'where':{'id':_0x1085ce[_0x7d83('0x44')]['id']}},_0x5b3892={};_0x5b3892['model']=_[_0x7d83('0x33')](db[_0x7d83('0x2d')]['rawAttributes']);_0x5b3892['query']=_[_0x7d83('0x33')](_0x1085ce[_0x7d83('0x32')]);_0x5b3892[_0x7d83('0x34')]=_[_0x7d83('0x35')](_0x5b3892[_0x7d83('0x31')],_0x5b3892['query']);_0xed233a[_0x7d83('0x36')]=_[_0x7d83('0x35')](_0x5b3892[_0x7d83('0x31')],qs['fields'](_0x1085ce['query'][_0x7d83('0x45')]));_0xed233a[_0x7d83('0x36')]=_0xed233a[_0x7d83('0x36')]['length']?_0xed233a[_0x7d83('0x36')]:_0x5b3892[_0x7d83('0x31')];if(_0x1085ce['query'][_0x7d83('0x41')]){_0xed233a[_0x7d83('0x42')]=[{'all':!![]}];}_0xed233a=_[_0x7d83('0x3d')]({},_0xed233a,_0x1085ce[_0x7d83('0x46')]);return db[_0x7d83('0x2d')][_0x7d83('0x47')](_0xed233a)['then'](handleEntityNotFound(_0x41f111,null))[_0x7d83('0x40')](respondWithResult(_0x41f111,null))[_0x7d83('0x48')](handleError(_0x41f111,null));};exports[_0x7d83('0x49')]=function(_0x4c1e55,_0x3d2cad){return db[_0x7d83('0x2d')][_0x7d83('0x49')](_0x4c1e55[_0x7d83('0x4a')],{})[_0x7d83('0x40')](respondWithResult(_0x3d2cad,0xc9))[_0x7d83('0x48')](handleError(_0x3d2cad,null));};exports['update']=function(_0x112f7a,_0x85e8e6){if(_0x112f7a[_0x7d83('0x4a')]['id']){delete _0x112f7a['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x112f7a['params']['id']}})['then'](handleEntityNotFound(_0x85e8e6,null))['then'](saveUpdates(_0x112f7a[_0x7d83('0x4a')],null))[_0x7d83('0x40')](respondWithResult(_0x85e8e6,null))['catch'](handleError(_0x85e8e6,null));};exports[_0x7d83('0x27')]=function(_0x3431b7,_0x1d0fd9){return db[_0x7d83('0x2d')]['find']({'where':{'id':_0x3431b7[_0x7d83('0x44')]['id']}})[_0x7d83('0x40')](handleEntityNotFound(_0x1d0fd9,null))[_0x7d83('0x40')](removeEntity(_0x1d0fd9,null))[_0x7d83('0x48')](handleError(_0x1d0fd9,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index beadd89..35daebd 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 _0x6c56=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3446af,_0x3b2f92){var _0x252b14=function(_0x1caaca){while(--_0x1caaca){_0x3446af['push'](_0x3446af['shift']());}};_0x252b14(++_0x3b2f92);}(_0x6c56,0x180));var _0x66c5=function(_0x5e1f4b,_0x50b208){_0x5e1f4b=_0x5e1f4b-0x0;var _0x5ce7b4=_0x6c56[_0x5e1f4b];return _0x5ce7b4;};'use strict';var _=require(_0x66c5('0x0'));var util=require(_0x66c5('0x1'));var logger=require(_0x66c5('0x2'))(_0x66c5('0x3'));var moment=require('moment');var BPromise=require(_0x66c5('0x4'));var rp=require(_0x66c5('0x5'));var fs=require('fs');var path=require(_0x66c5('0x6'));var rimraf=require(_0x66c5('0x7'));var config=require(_0x66c5('0x8'));var attributes=require(_0x66c5('0x9'));module[_0x66c5('0xa')]=function(_0xdbf228,_0x3ab223){return _0xdbf228[_0x66c5('0xb')](_0x66c5('0xc'),attributes,{'tableName':_0x66c5('0xd'),'paranoid':![],'indexes':[{'name':_0x66c5('0xe'),'fields':[_0x66c5('0xf'),_0x66c5('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1797=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index'];(function(_0x2b8f18,_0x2d70ed){var _0x1bc8cf=function(_0x5166df){while(--_0x5166df){_0x2b8f18['push'](_0x2b8f18['shift']());}};_0x1bc8cf(++_0x2d70ed);}(_0x1797,0x119));var _0x7179=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1797[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x7179('0x0'));var util=require(_0x7179('0x1'));var logger=require(_0x7179('0x2'))(_0x7179('0x3'));var moment=require(_0x7179('0x4'));var BPromise=require(_0x7179('0x5'));var rp=require(_0x7179('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7179('0x7'));var config=require(_0x7179('0x8'));var attributes=require(_0x7179('0x9'));module[_0x7179('0xa')]=function(_0xebb0ae,_0x385289){return _0xebb0ae['define']('DeskField',attributes,{'tableName':_0x7179('0xb'),'paranoid':![],'indexes':[{'name':_0x7179('0xc'),'fields':[_0x7179('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 8fc2051..b66a5af 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 _0x8ade=['request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ade,0x1d9));var _0xe8ad=function(_0x3dffd5,_0x2667ed){_0x3dffd5=_0x3dffd5-0x0;var _0x1ae5ed=_0x8ade[_0x3dffd5];return _0x1ae5ed;};'use strict';var _=require(_0xe8ad('0x0'));var util=require(_0xe8ad('0x1'));var moment=require(_0xe8ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8ad('0x4'));var logger=require(_0xe8ad('0x5'))('rpc');var config=require(_0xe8ad('0x6'));var jayson=require(_0xe8ad('0x7'));var client=jayson[_0xe8ad('0x8')][_0xe8ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd73598,_0x1484cc,_0x16ef37){return new BPromise(function(_0xccc55e,_0x164afe){return client[_0xe8ad('0xa')](_0xd73598,_0x16ef37)['then'](function(_0x1d741e){logger[_0xe8ad('0xb')](_0xe8ad('0xc'),_0x1484cc,'request\x20sent');logger[_0xe8ad('0xd')](_0xe8ad('0xe'),_0x1484cc,_0xe8ad('0xf'),JSON[_0xe8ad('0x10')](_0x1d741e));if(_0x1d741e[_0xe8ad('0x11')]){if(_0x1d741e[_0xe8ad('0x11')][_0xe8ad('0x12')]===0x1f4){logger[_0xe8ad('0x11')](_0xe8ad('0xc'),_0x1484cc,_0x1d741e['error'][_0xe8ad('0x13')]);return _0x164afe(_0x1d741e[_0xe8ad('0x11')]['message']);}logger[_0xe8ad('0x11')](_0xe8ad('0xc'),_0x1484cc,_0x1d741e[_0xe8ad('0x11')][_0xe8ad('0x13')]);return _0xccc55e(_0x1d741e[_0xe8ad('0x11')][_0xe8ad('0x13')]);}else{logger[_0xe8ad('0xb')](_0xe8ad('0xc'),_0x1484cc,_0xe8ad('0xf'));_0xccc55e(_0x1d741e[_0xe8ad('0x14')][_0xe8ad('0x13')]);}})['catch'](function(_0x3bcdfc){logger['error'](_0xe8ad('0xc'),_0x1484cc,_0x3bcdfc);_0x164afe(_0x3bcdfc);});});} \ No newline at end of file +var _0xdd7c=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','client','info'];(function(_0x3c7f3f,_0x7499cd){var _0x3b789a=function(_0x30055e){while(--_0x30055e){_0x3c7f3f['push'](_0x3c7f3f['shift']());}};_0x3b789a(++_0x7499cd);}(_0xdd7c,0x191));var _0xcdd7=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0xdd7c[_0x93942f];return _0x23fcd8;};'use strict';var _=require(_0xcdd7('0x0'));var util=require('util');var moment=require(_0xcdd7('0x1'));var BPromise=require(_0xcdd7('0x2'));var rs=require(_0xcdd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdd7('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[_0xcdd7('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7190,_0x33ccbd,_0x8498d7){return new BPromise(function(_0x175ac6,_0x25dc0e){return client['request'](_0x3d7190,_0x8498d7)['then'](function(_0x417c44){logger[_0xcdd7('0x6')]('DeskField,\x20%s,\x20%s',_0x33ccbd,_0xcdd7('0x7'));logger[_0xcdd7('0x8')](_0xcdd7('0x9'),_0x33ccbd,'request\x20sent',JSON[_0xcdd7('0xa')](_0x417c44));if(_0x417c44[_0xcdd7('0xb')]){if(_0x417c44[_0xcdd7('0xb')][_0xcdd7('0xc')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x33ccbd,_0x417c44[_0xcdd7('0xb')][_0xcdd7('0xd')]);return _0x25dc0e(_0x417c44[_0xcdd7('0xb')]['message']);}logger[_0xcdd7('0xb')]('DeskField,\x20%s,\x20%s',_0x33ccbd,_0x417c44[_0xcdd7('0xb')][_0xcdd7('0xd')]);return _0x175ac6(_0x417c44['error'][_0xcdd7('0xd')]);}else{logger['info'](_0xcdd7('0xe'),_0x33ccbd,'request\x20sent');_0x175ac6(_0x417c44[_0xcdd7('0xf')][_0xcdd7('0xd')]);}})[_0xcdd7('0x10')](function(_0x51ad84){logger[_0xcdd7('0xb')](_0xcdd7('0xe'),_0x33ccbd,_0x51ad84);_0x25dc0e(_0x51ad84);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 85acffc..3c1dadf 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 _0x772d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','getFields','post','create','/:id/configurations','addConfiguration','put','update','exports','multer','util','path'];(function(_0x3a981a,_0x19ccfd){var _0x29187c=function(_0x38c26f){while(--_0x38c26f){_0x3a981a['push'](_0x3a981a['shift']());}};_0x29187c(++_0x19ccfd);}(_0x772d,0x1a1));var _0xd772=function(_0x29b7f0,_0x2d6e65){_0x29b7f0=_0x29b7f0-0x0;var _0x1ca51d=_0x772d[_0x29b7f0];return _0x1ca51d;};'use strict';var multer=require(_0xd772('0x0'));var util=require(_0xd772('0x1'));var path=require(_0xd772('0x2'));var timeout=require(_0xd772('0x3'));var express=require(_0xd772('0x4'));var router=express[_0xd772('0x5')]();var fs_extra=require(_0xd772('0x6'));var auth=require(_0xd772('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd772('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd772('0x9')](_0xd772('0xa'),auth[_0xd772('0xb')](),controller[_0xd772('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xd772('0xb')](),controller[_0xd772('0xd')]);router[_0xd772('0xe')]('/',auth[_0xd772('0xb')](),controller[_0xd772('0xf')]);router[_0xd772('0xe')](_0xd772('0x10'),auth[_0xd772('0xb')](),controller[_0xd772('0x11')]);router[_0xd772('0x12')](_0xd772('0xa'),auth[_0xd772('0xb')](),controller[_0xd772('0x13')]);router['delete'](_0xd772('0xa'),auth[_0xd772('0xb')](),controller['destroy']);module[_0xd772('0x14')]=router; \ No newline at end of file +var _0xf853=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xf94cab,_0x372d18){var _0x212f56=function(_0x2642d0){while(--_0x2642d0){_0xf94cab['push'](_0xf94cab['shift']());}};_0x212f56(++_0x372d18);}(_0xf853,0xcb));var _0x3f85=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0xf853[_0x585d09];return _0x7d9a14;};'use strict';var multer=require(_0x3f85('0x0'));var util=require(_0x3f85('0x1'));var path=require(_0x3f85('0x2'));var timeout=require(_0x3f85('0x3'));var express=require(_0x3f85('0x4'));var router=express[_0x3f85('0x5')]();var fs_extra=require(_0x3f85('0x6'));var auth=require(_0x3f85('0x7'));var interaction=require(_0x3f85('0x8'));var config=require(_0x3f85('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3f85('0xa')]);router[_0x3f85('0xb')](_0x3f85('0xc'),auth[_0x3f85('0xd')](),controller[_0x3f85('0xe')]);router[_0x3f85('0xb')](_0x3f85('0xf'),auth['isAuthenticated'](),controller[_0x3f85('0x10')]);router[_0x3f85('0xb')](_0x3f85('0x11'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x12')]);router[_0x3f85('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f85('0x13')](_0x3f85('0xf'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x14')]);router[_0x3f85('0x15')](_0x3f85('0xc'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x16')]);router[_0x3f85('0x17')](_0x3f85('0xc'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x18')]);module[_0x3f85('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8934a87..3d18705 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 _0x539d=['STRING','sequelize'];(function(_0xa9a48,_0x4dcb76){var _0x4738aa=function(_0x5b34e6){while(--_0x5b34e6){_0xa9a48['push'](_0xa9a48['shift']());}};_0x4738aa(++_0x4dcb76);}(_0x539d,0x17b));var _0xd539=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0x539d[_0xf31767];return _0x24bd0c;};'use strict';var Sequelize=require(_0xd539('0x0'));module['exports']={'name':{'type':Sequelize[_0xd539('0x1')]},'username':{'type':Sequelize[_0xd539('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xd539('0x1')]},'clientId':{'type':Sequelize[_0xd539('0x1')]},'clientSecret':{'type':Sequelize[_0xd539('0x1')]},'serverUrl':{'type':Sequelize[_0xd539('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd539('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a93=['exports','STRING','BOOLEAN'];(function(_0x7e7dd8,_0x5c00a9){var _0x2772ed=function(_0x1fc371){while(--_0x1fc371){_0x7e7dd8['push'](_0x7e7dd8['shift']());}};_0x2772ed(++_0x5c00a9);}(_0x5a93,0xf6));var _0x35a9=function(_0x8728f0,_0x45c302){_0x8728f0=_0x8728f0-0x0;var _0x292c15=_0x5a93[_0x8728f0];return _0x292c15;};'use strict';var Sequelize=require('sequelize');module[_0x35a9('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x35a9('0x1')]},'password':{'type':Sequelize[_0x35a9('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x35a9('0x1')]},'clientSecret':{'type':Sequelize[_0x35a9('0x1')]},'serverUrl':{'type':Sequelize[_0x35a9('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x35a9('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8782249..68235b9 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 _0xf679=['createdon','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','username','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','@odata.type','substring','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','request-promise','util','lodash','../../config/logger','api','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','destroy','then','end','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname'];(function(_0x1c75e1,_0x151481){var _0x184692=function(_0x11e498){while(--_0x11e498){_0x1c75e1['push'](_0x1c75e1['shift']());}};_0x184692(++_0x151481);}(_0xf679,0x11a));var _0x9f67=function(_0x5d38c1,_0x711f59){_0x5d38c1=_0x5d38c1-0x0;var _0x25c459=_0xf679[_0x5d38c1];return _0x25c459;};'use strict';var rp=require(_0x9f67('0x0'));var util=require(_0x9f67('0x1'));var _=require(_0x9f67('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9f67('0x3'))(_0x9f67('0x4'));var db=require(_0x9f67('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x4f6287,_0x19bbd4){_0x19bbd4=_0x19bbd4||0xc8;return function(_0x1a3241){if(_0x1a3241){return _0x4f6287[_0x9f67('0x6')](_0x19bbd4)['json'](_0x1a3241);}};}function respondWithFilteredResult(_0x2b44c3,_0x1b5944){return function(_0x5e39a3){if(_0x5e39a3){var _0x39ef22=typeof _0x1b5944['offset']===_0x9f67('0x7')&&typeof _0x1b5944[_0x9f67('0x8')]===_0x9f67('0x7');var _0x3bec44=_0x5e39a3[_0x9f67('0x9')];var _0x5e429d=_0x39ef22?0x0:_0x1b5944[_0x9f67('0xa')];var _0x53305f=_0x39ef22?_0x5e39a3[_0x9f67('0x9')]:_0x1b5944['offset']+_0x1b5944[_0x9f67('0x8')];var _0x40cba5;if(_0x53305f>=_0x3bec44){_0x53305f=_0x3bec44;_0x40cba5=0xc8;}else{_0x40cba5=0xce;}_0x2b44c3[_0x9f67('0x6')](_0x40cba5);return _0x2b44c3[_0x9f67('0xb')](_0x9f67('0xc'),_0x5e429d+'-'+_0x53305f+'/'+_0x3bec44)[_0x9f67('0xd')](_0x5e39a3);}return null;};}function saveUpdates(_0x178698){return function(_0x4d7130){if(_0x4d7130){return _0x4d7130['update'](_0x178698)['then'](function(_0x1d432f){return _0x1d432f;});}return null;};}function removeEntity(_0x36a863){return function(_0x378c17){if(_0x378c17){return _0x378c17[_0x9f67('0xe')]()[_0x9f67('0xf')](function(){_0x36a863[_0x9f67('0x6')](0xcc)[_0x9f67('0x10')]();});}};}function handleEntityNotFound(_0x110a77){return function(_0x3dbdb9){if(!_0x3dbdb9){_0x110a77['sendStatus'](0x194);}return _0x3dbdb9;};}function handleError(_0x30b8e5,_0x1b63a7){_0x1b63a7=_0x1b63a7||0x1f4;return function(_0x1286c8){logger[_0x9f67('0x11')](_0x1286c8[_0x9f67('0x12')]);if(_0x1286c8[_0x9f67('0x13')]){delete _0x1286c8[_0x9f67('0x13')];}_0x30b8e5[_0x9f67('0x6')](_0x1b63a7)['send'](_0x1286c8);};}exports[_0x9f67('0x14')]=function(_0x351aeb,_0x31712e){var _0x25928c={},_0xcaeda4={},_0x1f0287={'count':0x0,'rows':[]};var _0x21fc57=_[_0x9f67('0x15')](db[_0x9f67('0x16')][_0x9f67('0x17')],function(_0x2e016e){return{'name':_0x2e016e[_0x9f67('0x18')],'type':_0x2e016e['type'][_0x9f67('0x19')]};});_0xcaeda4[_0x9f67('0x1a')]=_['map'](_0x21fc57,_0x9f67('0x13'));_0xcaeda4[_0x9f67('0x1b')]=_[_0x9f67('0x1c')](_0x351aeb['query']);_0xcaeda4[_0x9f67('0x1d')]=_[_0x9f67('0x1e')](_0xcaeda4[_0x9f67('0x1a')],_0xcaeda4['query']);_0x25928c[_0x9f67('0x1f')]=_['intersection'](_0xcaeda4[_0x9f67('0x1a')],qs[_0x9f67('0x20')](_0x351aeb['query'][_0x9f67('0x20')]));_0x25928c[_0x9f67('0x1f')]=_0x25928c[_0x9f67('0x1f')][_0x9f67('0x21')]?_0x25928c[_0x9f67('0x1f')]:_0xcaeda4[_0x9f67('0x1a')];if(!_0x351aeb['query'][_0x9f67('0x22')]('nolimit')){_0x25928c[_0x9f67('0x8')]=qs[_0x9f67('0x8')](_0x351aeb[_0x9f67('0x1b')][_0x9f67('0x8')]);_0x25928c[_0x9f67('0xa')]=qs[_0x9f67('0xa')](_0x351aeb[_0x9f67('0x1b')][_0x9f67('0xa')]);}_0x25928c[_0x9f67('0x23')]=qs['sort'](_0x351aeb['query'][_0x9f67('0x24')]);_0x25928c[_0x9f67('0x25')]=qs['filters'](_[_0x9f67('0x26')](_0x351aeb[_0x9f67('0x1b')],_0xcaeda4[_0x9f67('0x1d')]),_0x21fc57);if(_0x351aeb[_0x9f67('0x1b')][_0x9f67('0x27')]){_0x25928c[_0x9f67('0x25')]=_[_0x9f67('0x28')](_0x25928c[_0x9f67('0x25')],{'$or':_[_0x9f67('0x15')](_0x21fc57,function(_0x224e05){if(_0x224e05[_0x9f67('0x29')]!=='VIRTUAL'){var _0xb48388={};_0xb48388[_0x224e05['name']]={'$like':'%'+_0x351aeb[_0x9f67('0x1b')][_0x9f67('0x27')]+'%'};return _0xb48388;}})});}_0x25928c=_[_0x9f67('0x28')]({},_0x25928c,_0x351aeb[_0x9f67('0x2a')]);var _0xb7d764={'where':_0x25928c[_0x9f67('0x25')]};return db['Dynamics365Account']['count'](_0xb7d764)['then'](function(_0x52358d){_0x1f0287[_0x9f67('0x9')]=_0x52358d;if(_0x351aeb[_0x9f67('0x1b')][_0x9f67('0x2b')]){_0x25928c['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x9f67('0x2c')](_0x25928c);})[_0x9f67('0xf')](function(_0xaeb9dc){_0x1f0287[_0x9f67('0x2d')]=_0xaeb9dc;return _0x1f0287;})[_0x9f67('0xf')](respondWithFilteredResult(_0x31712e,_0x25928c))[_0x9f67('0x2e')](handleError(_0x31712e,null));};exports['show']=function(_0x32ab2e,_0x5cde90){var _0x4effc1={'raw':![],'where':{'id':_0x32ab2e[_0x9f67('0x2f')]['id']}},_0x508d37={};_0x508d37[_0x9f67('0x1a')]=_[_0x9f67('0x1c')](db[_0x9f67('0x16')][_0x9f67('0x17')]);_0x508d37[_0x9f67('0x1b')]=_[_0x9f67('0x1c')](_0x32ab2e[_0x9f67('0x1b')]);_0x508d37['filters']=_[_0x9f67('0x1e')](_0x508d37[_0x9f67('0x1a')],_0x508d37[_0x9f67('0x1b')]);_0x4effc1[_0x9f67('0x1f')]=_[_0x9f67('0x1e')](_0x508d37[_0x9f67('0x1a')],qs['fields'](_0x32ab2e[_0x9f67('0x1b')][_0x9f67('0x20')]));_0x4effc1[_0x9f67('0x1f')]=_0x4effc1[_0x9f67('0x1f')][_0x9f67('0x21')]?_0x4effc1[_0x9f67('0x1f')]:_0x508d37[_0x9f67('0x1a')];if(_0x32ab2e['query'][_0x9f67('0x2b')]){_0x4effc1[_0x9f67('0x30')]=[{'all':!![]}];}_0x4effc1=_[_0x9f67('0x28')]({},_0x4effc1,_0x32ab2e[_0x9f67('0x2a')]);return db[_0x9f67('0x16')][_0x9f67('0x31')](_0x4effc1)['then'](handleEntityNotFound(_0x5cde90,null))['then'](respondWithResult(_0x5cde90,null))['catch'](handleError(_0x5cde90,null));};exports[_0x9f67('0x32')]=function(_0x230363,_0x53d97e){return db[_0x9f67('0x16')][_0x9f67('0x32')](_0x230363[_0x9f67('0x33')],{})['then'](respondWithResult(_0x53d97e,0xc9))[_0x9f67('0x2e')](handleError(_0x53d97e,null));};exports[_0x9f67('0x34')]=function(_0x1b41c0,_0x11c4aa){if(_0x1b41c0[_0x9f67('0x33')]['id']){delete _0x1b41c0[_0x9f67('0x33')]['id'];}return db[_0x9f67('0x16')][_0x9f67('0x31')]({'where':{'id':_0x1b41c0[_0x9f67('0x2f')]['id']}})['then'](handleEntityNotFound(_0x11c4aa,null))['then'](saveUpdates(_0x1b41c0[_0x9f67('0x33')],null))[_0x9f67('0xf')](respondWithResult(_0x11c4aa,null))[_0x9f67('0x2e')](handleError(_0x11c4aa,null));};exports[_0x9f67('0xe')]=function(_0xc97a07,_0x117521){return db['Dynamics365Account']['find']({'where':{'id':_0xc97a07[_0x9f67('0x2f')]['id']}})[_0x9f67('0xf')](handleEntityNotFound(_0x117521,null))[_0x9f67('0xf')](removeEntity(_0x117521,null))[_0x9f67('0x2e')](handleError(_0x117521,null));};exports[_0x9f67('0x35')]=function(_0x2ca593,_0x5bbd50){var _0xa02d8b={};var _0xc90fb6={};var _0xb01b4d;var _0x3992f1;return db['Dynamics365Account'][_0x9f67('0x36')]({'where':{'id':_0x2ca593[_0x9f67('0x2f')]['id']}})[_0x9f67('0xf')](handleEntityNotFound(_0x5bbd50,null))[_0x9f67('0xf')](function(_0x52a374){if(_0x52a374){_0xb01b4d=_0x52a374;_0xc90fb6[_0x9f67('0x1a')]=_[_0x9f67('0x1c')](db['Dynamics365Configuration']['rawAttributes']);_0xc90fb6[_0x9f67('0x1b')]=_[_0x9f67('0x1c')](_0x2ca593[_0x9f67('0x1b')]);_0xc90fb6['filters']=_[_0x9f67('0x1e')](_0xc90fb6[_0x9f67('0x1a')],_0xc90fb6['query']);_0xa02d8b[_0x9f67('0x1f')]=_[_0x9f67('0x1e')](_0xc90fb6[_0x9f67('0x1a')],qs[_0x9f67('0x20')](_0x2ca593[_0x9f67('0x1b')]['fields']));_0xa02d8b[_0x9f67('0x1f')]=_0xa02d8b[_0x9f67('0x1f')][_0x9f67('0x21')]?_0xa02d8b['attributes']:_0xc90fb6[_0x9f67('0x1a')];_0xa02d8b[_0x9f67('0x23')]=qs[_0x9f67('0x24')](_0x2ca593[_0x9f67('0x1b')]['sort']);_0xa02d8b[_0x9f67('0x25')]=qs[_0x9f67('0x1d')](_[_0x9f67('0x26')](_0x2ca593[_0x9f67('0x1b')],_0xc90fb6['filters']));if(_0x2ca593[_0x9f67('0x1b')][_0x9f67('0x27')]){_0xa02d8b[_0x9f67('0x25')]=_[_0x9f67('0x28')](_0xa02d8b[_0x9f67('0x25')],{'$or':_['map'](_0xa02d8b[_0x9f67('0x1f')],function(_0x21b53e){var _0x455b15={};_0x455b15[_0x21b53e]={'$like':'%'+_0x2ca593[_0x9f67('0x1b')][_0x9f67('0x27')]+'%'};return _0x455b15;})});}_0xa02d8b=_[_0x9f67('0x28')]({},_0xa02d8b,_0x2ca593[_0x9f67('0x2a')]);return _0xb01b4d[_0x9f67('0x35')](_0xa02d8b);}})[_0x9f67('0xf')](function(_0x2cfba8){if(_0x2cfba8){_0x3992f1=_0x2cfba8[_0x9f67('0x21')];if(!_0x2ca593[_0x9f67('0x1b')][_0x9f67('0x22')]('nolimit')){_0xa02d8b[_0x9f67('0x8')]=qs[_0x9f67('0x8')](_0x2ca593[_0x9f67('0x1b')][_0x9f67('0x8')]);_0xa02d8b[_0x9f67('0xa')]=qs[_0x9f67('0xa')](_0x2ca593['query']['offset']);}return _0xb01b4d[_0x9f67('0x35')](_0xa02d8b);}})['then'](function(_0x53d8e3){if(_0x53d8e3){return _0x53d8e3?{'count':_0x3992f1,'rows':_0x53d8e3}:null;}})[_0x9f67('0xf')](respondWithResult(_0x5bbd50,null))[_0x9f67('0x2e')](handleError(_0x5bbd50,null));};exports['addConfiguration']=function(_0x2a6afc,_0x29c4ba){if(_0x2a6afc[_0x9f67('0x33')]['id']){delete _0x2a6afc['body']['id'];}return db[_0x9f67('0x16')][_0x9f67('0x36')]({'where':{'id':_0x2a6afc[_0x9f67('0x2f')]['id']}})[_0x9f67('0xf')](handleEntityNotFound(_0x29c4ba,null))[_0x9f67('0xf')](function(_0x34d450){if(_0x34d450){_0x2a6afc[_0x9f67('0x33')][_0x9f67('0x37')]=_0x34d450['id'];_0x2a6afc[_0x9f67('0x33')][_0x9f67('0x38')]=integrations[_0x9f67('0x39')](_0x2a6afc[_0x9f67('0x33')][_0x9f67('0x3a')],_0x2a6afc[_0x9f67('0x33')]['type']);_0x2a6afc['body']['Descriptions']=integrations[_0x9f67('0x3b')](_0x2a6afc[_0x9f67('0x33')]['channel'],_0x2a6afc[_0x9f67('0x33')]['type']);return db[_0x9f67('0x3c')][_0x9f67('0x32')](_0x2a6afc[_0x9f67('0x33')],{'include':[{'model':db[_0x9f67('0x3d')],'as':_0x9f67('0x38')},{'model':db[_0x9f67('0x3d')],'as':_0x9f67('0x3e')}]});}return null;})[_0x9f67('0xf')](respondWithResult(_0x29c4ba,null))[_0x9f67('0x2e')](handleError(_0x29c4ba,null));};function sanitizeRemoteUri(_0x132194){var _0xe0e797=_0x132194[_0x9f67('0x3f')](-0x1);if(_0xe0e797==='/')return _0x132194['substring'](0x0,_0x132194[_0x9f67('0x40')](_0xe0e797));return _0x132194;}function getWebApiUrl(_0x2b68cf){return util[_0x9f67('0x41')](_0x9f67('0x42'),_0x2b68cf);}exports[_0x9f67('0x43')]=function(_0x586ccb,_0x4467ee){var _0x29d5f3=_0x586ccb[_0x9f67('0x1b')][_0x9f67('0x44')];var _0x4131e6=_0x29d5f3===_0x9f67('0x45')?_0x9f67('0x46'):_0x9f67('0x47');var _0x549259='';var _0x42d3c9='';var _0x16940b='';var _0x345c99='';var _0x39b749='';var _0x2dc2f5='';var _0x14e1b6='';var _0x385610='';var _0x1240da=['title',_0x9f67('0x48'),_0x9f67('0x49'),'ownerid',_0x9f67('0x4a'),_0x9f67('0x4b'),_0x9f67('0x4c'),_0x9f67('0x4d'),'directioncode',_0x9f67('0x4e')];var _0x1b1d7f=[_0x9f67('0x4f'),_0x9f67('0x50'),'actualserviceunits',_0x9f67('0x51'),'contactidname',_0x9f67('0x52'),_0x9f67('0x53'),_0x9f67('0x54'),_0x9f67('0x55'),_0x9f67('0x56'),_0x9f67('0x57'),'createdbyyominame',_0x9f67('0x58'),'createdonbehalfbyname','createdonbehalfbyyominame',_0x9f67('0x59'),_0x9f67('0x5a'),_0x9f67('0x5b'),_0x9f67('0x5c'),_0x9f67('0x5d'),_0x9f67('0x5e'),_0x9f67('0x5f'),'escalatedon',_0x9f67('0x60'),'firstresponsebykpiidname','followupby','importsequencenumber',_0x9f67('0x61'),_0x9f67('0x62'),_0x9f67('0x63'),_0x9f67('0x64'),_0x9f67('0x65'),_0x9f67('0x66'),_0x9f67('0x67'),_0x9f67('0x68'),_0x9f67('0x69'),_0x9f67('0x6a'),_0x9f67('0x6b'),'msdyn_incidenttypename',_0x9f67('0x6c'),_0x9f67('0x6d'),'onholdtime',_0x9f67('0x6e'),_0x9f67('0x6f'),_0x9f67('0x70'),'owneridyominame','parentcaseidname','primarycontactidname',_0x9f67('0x71'),'prioritycodename',_0x9f67('0x72'),_0x9f67('0x73'),_0x9f67('0x74'),'resolvebykpiidname',_0x9f67('0x75'),_0x9f67('0x76'),_0x9f67('0x77'),_0x9f67('0x78'),'slainvokedidname','slaname',_0x9f67('0x79'),'statecode','statuscode','subjectidname',_0x9f67('0x7a'),'timezoneruleversionnumber',_0x9f67('0x7b'),_0x9f67('0x7c'),'utcconversiontimezonecode',_0x9f67('0x7d')];var _0x561927=_0x1240da[_0x9f67('0x7e')](_0x1b1d7f);return db[_0x9f67('0x16')]['findOne']({'where':{'id':_0x586ccb[_0x9f67('0x2f')]['id']},'attributes':['id','username','password','remoteUri',_0x9f67('0x7f'),_0x9f67('0x80'),'clientSecret',_0x9f67('0x81')],'include':[{'model':db['CloudProvider'],'as':_0x9f67('0x82'),'attributes':['id',_0x9f67('0x83'),_0x9f67('0x84')]}]})['then'](handleEntityNotFound(_0x4467ee,null))[_0x9f67('0xf')](function(_0x12cb63){if(_0x12cb63){if(_0x12cb63[_0x9f67('0x81')]){_0x12cb63[_0x9f67('0x85')]=_0x12cb63[_0x9f67('0x82')][_0x9f67('0x83')];_0x385610=sanitizeRemoteUri(_0x12cb63[_0x9f67('0x82')][_0x9f67('0x84')]);_0x14e1b6=getWebApiUrl(_0x385610);return _0x12cb63;}_0x385610=sanitizeRemoteUri(_0x12cb63[_0x9f67('0x86')]);_0x14e1b6=getWebApiUrl(_0x385610);var _0xcf4c2d={'method':_0x9f67('0x87'),'uri':_0x9f67('0x88')+_0x12cb63[_0x9f67('0x7f')]+'/oauth2/token','form':{'client_id':_0x12cb63[_0x9f67('0x80')],'resource':_0x385610,'username':_0x12cb63[_0x9f67('0x89')],'password':_0x12cb63['password'],'grant_type':_0x9f67('0x8a'),'client_secret':_0x12cb63[_0x9f67('0x8b')]},'json':!![]};return rp(_0xcf4c2d);}})[_0x9f67('0xf')](function(_0x2ae923){_0x2dc2f5=_0x2ae923[_0x9f67('0x85')];var _0x4ba374={'method':_0x9f67('0x8c'),'uri':encodeURI(_0x14e1b6+_0x9f67('0x8d')+_0x4131e6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2dc2f5,'If-None-Match':null,'OData-Version':_0x9f67('0x8e')},'json':!![]};return rp(_0x4ba374);})[_0x9f67('0xf')](function(_0x3685fd){var _0x510e31=_0x3685fd[_0x9f67('0x8f')][0x0];var _0x19bc3d=_0x510e31[_0x9f67('0x90')];var _0x50a023={'method':'GET','uri':_0x14e1b6+_0x9f67('0x91')+_0x19bc3d+_0x9f67('0x92'),'headers':{'Authorization':_0x9f67('0x93')+_0x2dc2f5,'If-None-Match':null,'OData-Version':_0x9f67('0x8e')},'json':!![]};return rp(_0x50a023);})[_0x9f67('0xf')](function(_0x1840dc){_0x549259=_0x1840dc;_0x42d3c9=_0x549259[_0x9f67('0x94')];_0x42d3c9=_[_0x9f67('0x95')](_0x42d3c9,function(_0x1b151f){return!_0x561927[_0x9f67('0x96')](_0x1b151f['LogicalName']);});var _0x3c9415=[];var _0x3be8e4=[];_0x42d3c9['forEach'](function(_0x585792){if(_0x585792[_0x9f67('0x97')]){var _0x2878f4=_0x585792[_0x9f67('0x97')][_0x9f67('0x98')](_0x585792[_0x9f67('0x97')][_0x9f67('0x40')]('.')+0x1);if(_0x2878f4===_0x9f67('0x99')){_0x3c9415['push'](getSelectList(_0x14e1b6,_0x29d5f3,_0x3be8e4,_0x549259[_0x9f67('0x90')],_0x585792[_0x9f67('0x90')],_0x2dc2f5));}}});return Promise[_0x9f67('0x9a')](_0x3c9415);})['then'](function(_0x4ba284){_0x16940b=_0x4ba284[0x0];var _0xbb7e5c=[];var _0x4177fb=[];_0x42d3c9[_0x9f67('0x9b')](function(_0x164ebe){if(!_[_0x9f67('0x9c')](_0x164ebe[_0x9f67('0x97')])){var _0x132b9b=_0x164ebe['@odata.type'][_0x9f67('0x98')](_0x164ebe[_0x9f67('0x97')][_0x9f67('0x40')]('.')+0x1);if(_0x132b9b===_0x9f67('0x9d')){_0xbb7e5c[_0x9f67('0x9e')](getBooleanList(_0x14e1b6,_0x29d5f3,_0x4177fb,_0x549259[_0x9f67('0x90')],_0x164ebe[_0x9f67('0x90')],_0x2dc2f5));}}});return Promise[_0x9f67('0x9a')](_0xbb7e5c);})[_0x9f67('0xf')](function(_0x30f04f){_0x345c99=_0x30f04f[0x0];var _0x58e9ef=[];var _0x440cec=[];_0x42d3c9['forEach'](function(_0x24f5f4){if(_0x24f5f4[_0x9f67('0x97')]){var _0x189ad0=_0x24f5f4['@odata.type'][_0x9f67('0x98')](_0x24f5f4['@odata.type'][_0x9f67('0x40')]('.')+0x1);if(_0x189ad0===_0x9f67('0x9f')||_0x189ad0===_0x9f67('0xa0')||_0x189ad0==='BigIntAttributeMetadata'||_0x189ad0===_0x9f67('0xa1')||_0x189ad0===_0x9f67('0xa2')||_0x189ad0===_0x9f67('0xa3')||_0x189ad0==='StatusAttributeMetadata'||_0x189ad0===_0x9f67('0xa4')||_0x189ad0===_0x9f67('0xa5')||_0x189ad0===_0x9f67('0xa6')){_0x58e9ef[_0x9f67('0x9e')](getInputList(_0x14e1b6,_0x29d5f3,_0x189ad0,_0x440cec,_0x549259[_0x9f67('0x90')],_0x24f5f4['MetadataId'],_0x2dc2f5));}}});return Promise[_0x9f67('0x9a')](_0x58e9ef);})[_0x9f67('0xf')](function(_0x5d6353){_0x39b749=_0x5d6353[0x0];var _0x2a3bd8=_0x16940b[_0x9f67('0x7e')](_0x345c99)[_0x9f67('0x7e')](_0x39b749);var _0x3144b8={'count':_0x2a3bd8[_0x9f67('0x21')],'rows':_0x2a3bd8};return _0x3144b8;})['then'](respondWithResult(_0x4467ee,null))['catch'](function(_0x5bac95){var _0x28916f=_0x586ccb['query'][_0x9f67('0xa7')]?0x1f4:_0x5bac95[_0x9f67('0xa8')]||0x1f4;logger[_0x9f67('0x11')](_0x5bac95[_0x9f67('0x12')]);delete _0x5bac95[_0x9f67('0x13')];if(_0x28916f===0x191){_0x28916f=0x190;}_0x4467ee[_0x9f67('0x6')](_0x28916f)[_0x9f67('0xa9')](_0x586ccb['query'][_0x9f67('0xa7')]?{'message':_0x9f67('0xaa'),'statusCode':_0x5bac95[_0x9f67('0xa8')]}:_0x5bac95);});};function getSelectList(_0x2fea8b,_0x3541ca,_0x4d2ebc,_0x35b1af,_0x247406,_0x18721b){var _0x3fde2a={'method':_0x9f67('0x8c'),'uri':_0x2fea8b+'EntityDefinitions('+_0x35b1af+_0x9f67('0xab')+_0x247406+_0x9f67('0xac')+_0x9f67('0xad'),'headers':{'Authorization':_0x9f67('0x93')+_0x18721b,'If-None-Match':null,'OData-Version':_0x9f67('0x8e')},'json':!![]};return rp(_0x3fde2a)[_0x9f67('0xf')](function(_0x55259e){var _0x1e94e7=[];var _0x34cc1c=_0x55259e[_0x9f67('0xae')][_0x9f67('0xaf')];_0x34cc1c[_0x9f67('0x9b')](function(_0x3fcf51){_0x1e94e7['push']({'name':_0x3fcf51[_0x9f67('0xb0')][_0x9f67('0xb1')]['Label'],'value':String(_0x3fcf51[_0x9f67('0xb2')])});});var _0x5050d9={'id':_0x3541ca+'_'+_0x55259e[_0x9f67('0xb3')],'name':_0x55259e[_0x9f67('0xb4')]['UserLocalizedLabel'][_0x9f67('0xb0')],'custom':![],'options':_0x1e94e7};_0x4d2ebc[_0x9f67('0x9e')](_0x5050d9);return _0x4d2ebc;});}function getBooleanList(_0x16dc4c,_0x1d0827,_0x449b9e,_0x1ef45a,_0x4a7e55,_0x173062){var _0x53d66e={'method':_0x9f67('0x8c'),'uri':_0x16dc4c+_0x9f67('0x91')+_0x1ef45a+_0x9f67('0xab')+_0x4a7e55+_0x9f67('0xb5'),'headers':{'Authorization':_0x9f67('0x93')+_0x173062,'If-None-Match':null,'OData-Version':_0x9f67('0x8e')},'json':!![]};return rp(_0x53d66e)[_0x9f67('0xf')](function(_0x28c7e0){var _0x18afd8=[];_0x18afd8[_0x9f67('0x9e')]({'name':_0x28c7e0['OptionSet'][_0x9f67('0xb6')]['Label']['UserLocalizedLabel'][_0x9f67('0xb0')],'value':'true'},{'name':_0x28c7e0[_0x9f67('0xae')][_0x9f67('0xb7')]['Label'][_0x9f67('0xb1')][_0x9f67('0xb0')],'value':_0x9f67('0xb8')});var _0x4e8621={'id':_0x1d0827+'_'+_0x28c7e0[_0x9f67('0xb3')],'name':_0x28c7e0[_0x9f67('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x18afd8};_0x449b9e['push'](_0x4e8621);return _0x449b9e;});}function getInputList(_0x42c056,_0x320633,_0xb32ab2,_0x23122e,_0x50bfdb,_0x22df35,_0x595624){var _0x2faec8={'method':'GET','uri':_0x42c056+_0x9f67('0x91')+_0x50bfdb+_0x9f67('0xab')+_0x22df35+')/Microsoft.Dynamics.CRM.'+_0xb32ab2+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x9f67('0x93')+_0x595624,'If-None-Match':null,'OData-Version':_0x9f67('0x8e')},'json':!![]};return rp(_0x2faec8)[_0x9f67('0xf')](function(_0x9e3a62){var _0x841290={'id':_0x320633+'_'+_0x9e3a62['LogicalName'],'name':_0x9e3a62[_0x9f67('0xb4')][_0x9f67('0xb1')]?_0x9e3a62['DisplayName']['UserLocalizedLabel'][_0x9f67('0xb0')]:_0x9e3a62[_0x9f67('0xb3')],'custom':![],'options':[]};_0x23122e[_0x9f67('0x9e')](_0x841290);return _0x23122e;});} \ No newline at end of file +var _0x7ef2=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','body','destroy','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','statusCode','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','DisplayName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys'];(function(_0x59e3e2,_0x1f809b){var _0xb9814e=function(_0x2b22bb){while(--_0x2b22bb){_0x59e3e2['push'](_0x59e3e2['shift']());}};_0xb9814e(++_0x1f809b);}(_0x7ef2,0x15d));var _0x27ef=function(_0x57ada9,_0x34e9e7){_0x57ada9=_0x57ada9-0x0;var _0x5dd266=_0x7ef2[_0x57ada9];return _0x5dd266;};'use strict';var rp=require(_0x27ef('0x0'));var util=require('util');var _=require(_0x27ef('0x1'));var qs=require(_0x27ef('0x2'));var logger=require('../../config/logger')(_0x27ef('0x3'));var db=require(_0x27ef('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x567b7a,_0x424685){_0x424685=_0x424685||0xc8;return function(_0x2ac02a){if(_0x2ac02a){return _0x567b7a['status'](_0x424685)[_0x27ef('0x5')](_0x2ac02a);}};}function respondWithFilteredResult(_0x294340,_0x285292){return function(_0x563446){if(_0x563446){var _0x133d91=typeof _0x285292[_0x27ef('0x6')]===_0x27ef('0x7')&&typeof _0x285292[_0x27ef('0x8')]===_0x27ef('0x7');var _0x4ec4e5=_0x563446[_0x27ef('0x9')];var _0x481aec=_0x133d91?0x0:_0x285292[_0x27ef('0x6')];var _0x484660=_0x133d91?_0x563446[_0x27ef('0x9')]:_0x285292['offset']+_0x285292[_0x27ef('0x8')];var _0x277c2b;if(_0x484660>=_0x4ec4e5){_0x484660=_0x4ec4e5;_0x277c2b=0xc8;}else{_0x277c2b=0xce;}_0x294340[_0x27ef('0xa')](_0x277c2b);return _0x294340[_0x27ef('0xb')](_0x27ef('0xc'),_0x481aec+'-'+_0x484660+'/'+_0x4ec4e5)[_0x27ef('0x5')](_0x563446);}return null;};}function saveUpdates(_0x29f976){return function(_0x52d93d){if(_0x52d93d){return _0x52d93d[_0x27ef('0xd')](_0x29f976)[_0x27ef('0xe')](function(_0x336247){return _0x336247;});}return null;};}function removeEntity(_0x52af16){return function(_0x4784d1){if(_0x4784d1){return _0x4784d1['destroy']()[_0x27ef('0xe')](function(){_0x52af16[_0x27ef('0xa')](0xcc)[_0x27ef('0xf')]();});}};}function handleEntityNotFound(_0x4bf112){return function(_0x448240){if(!_0x448240){_0x4bf112[_0x27ef('0x10')](0x194);}return _0x448240;};}function handleError(_0x21bfb9,_0x44745a){_0x44745a=_0x44745a||0x1f4;return function(_0x1d2803){logger[_0x27ef('0x11')](_0x1d2803[_0x27ef('0x12')]);if(_0x1d2803[_0x27ef('0x13')]){delete _0x1d2803['name'];}_0x21bfb9[_0x27ef('0xa')](_0x44745a)[_0x27ef('0x14')](_0x1d2803);};}exports[_0x27ef('0x15')]=function(_0x217368,_0x22d171){var _0x573ec5={},_0xe344fa={},_0xa2911a={'count':0x0,'rows':[]};var _0x50a11a=_[_0x27ef('0x16')](db[_0x27ef('0x17')]['rawAttributes'],function(_0x13a3fd){return{'name':_0x13a3fd[_0x27ef('0x18')],'type':_0x13a3fd[_0x27ef('0x19')][_0x27ef('0x1a')]};});_0xe344fa['model']=_['map'](_0x50a11a,_0x27ef('0x13'));_0xe344fa[_0x27ef('0x1b')]=_[_0x27ef('0x1c')](_0x217368[_0x27ef('0x1b')]);_0xe344fa[_0x27ef('0x1d')]=_[_0x27ef('0x1e')](_0xe344fa[_0x27ef('0x1f')],_0xe344fa[_0x27ef('0x1b')]);_0x573ec5[_0x27ef('0x20')]=_[_0x27ef('0x1e')](_0xe344fa[_0x27ef('0x1f')],qs[_0x27ef('0x21')](_0x217368[_0x27ef('0x1b')][_0x27ef('0x21')]));_0x573ec5[_0x27ef('0x20')]=_0x573ec5[_0x27ef('0x20')][_0x27ef('0x22')]?_0x573ec5[_0x27ef('0x20')]:_0xe344fa[_0x27ef('0x1f')];if(!_0x217368[_0x27ef('0x1b')][_0x27ef('0x23')](_0x27ef('0x24'))){_0x573ec5['limit']=qs[_0x27ef('0x8')](_0x217368[_0x27ef('0x1b')][_0x27ef('0x8')]);_0x573ec5[_0x27ef('0x6')]=qs[_0x27ef('0x6')](_0x217368['query']['offset']);}_0x573ec5[_0x27ef('0x25')]=qs[_0x27ef('0x26')](_0x217368['query'][_0x27ef('0x26')]);_0x573ec5[_0x27ef('0x27')]=qs['filters'](_[_0x27ef('0x28')](_0x217368[_0x27ef('0x1b')],_0xe344fa['filters']),_0x50a11a);if(_0x217368[_0x27ef('0x1b')][_0x27ef('0x29')]){_0x573ec5['where']=_[_0x27ef('0x2a')](_0x573ec5[_0x27ef('0x27')],{'$or':_[_0x27ef('0x16')](_0x50a11a,function(_0x9f1e16){if(_0x9f1e16[_0x27ef('0x19')]!==_0x27ef('0x2b')){var _0x53eb8a={};_0x53eb8a[_0x9f1e16[_0x27ef('0x13')]]={'$like':'%'+_0x217368[_0x27ef('0x1b')][_0x27ef('0x29')]+'%'};return _0x53eb8a;}})});}_0x573ec5=_[_0x27ef('0x2a')]({},_0x573ec5,_0x217368['options']);var _0x239c5e={'where':_0x573ec5[_0x27ef('0x27')]};return db[_0x27ef('0x17')]['count'](_0x239c5e)[_0x27ef('0xe')](function(_0x424bf2){_0xa2911a[_0x27ef('0x9')]=_0x424bf2;if(_0x217368[_0x27ef('0x1b')][_0x27ef('0x2c')]){_0x573ec5[_0x27ef('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x27ef('0x2e')](_0x573ec5);})[_0x27ef('0xe')](function(_0x2676d7){_0xa2911a[_0x27ef('0x2f')]=_0x2676d7;return _0xa2911a;})[_0x27ef('0xe')](respondWithFilteredResult(_0x22d171,_0x573ec5))[_0x27ef('0x30')](handleError(_0x22d171,null));};exports['show']=function(_0x5ea24a,_0x8e0e22){var _0x6e9e36={'raw':![],'where':{'id':_0x5ea24a[_0x27ef('0x31')]['id']}},_0x43a368={};_0x43a368['model']=_['keys'](db[_0x27ef('0x17')][_0x27ef('0x32')]);_0x43a368[_0x27ef('0x1b')]=_[_0x27ef('0x1c')](_0x5ea24a['query']);_0x43a368[_0x27ef('0x1d')]=_['intersection'](_0x43a368[_0x27ef('0x1f')],_0x43a368['query']);_0x6e9e36[_0x27ef('0x20')]=_['intersection'](_0x43a368[_0x27ef('0x1f')],qs[_0x27ef('0x21')](_0x5ea24a['query'][_0x27ef('0x21')]));_0x6e9e36[_0x27ef('0x20')]=_0x6e9e36[_0x27ef('0x20')][_0x27ef('0x22')]?_0x6e9e36[_0x27ef('0x20')]:_0x43a368[_0x27ef('0x1f')];if(_0x5ea24a[_0x27ef('0x1b')][_0x27ef('0x2c')]){_0x6e9e36[_0x27ef('0x2d')]=[{'all':!![]}];}_0x6e9e36=_['merge']({},_0x6e9e36,_0x5ea24a[_0x27ef('0x33')]);return db[_0x27ef('0x17')]['find'](_0x6e9e36)[_0x27ef('0xe')](handleEntityNotFound(_0x8e0e22,null))['then'](respondWithResult(_0x8e0e22,null))[_0x27ef('0x30')](handleError(_0x8e0e22,null));};exports[_0x27ef('0x34')]=function(_0x4e6ab1,_0x3326ac){return db[_0x27ef('0x17')][_0x27ef('0x34')](_0x4e6ab1['body'],{})['then'](respondWithResult(_0x3326ac,0xc9))[_0x27ef('0x30')](handleError(_0x3326ac,null));};exports[_0x27ef('0xd')]=function(_0x39aae5,_0x436f64){if(_0x39aae5[_0x27ef('0x35')]['id']){delete _0x39aae5[_0x27ef('0x35')]['id'];}return db[_0x27ef('0x17')]['find']({'where':{'id':_0x39aae5[_0x27ef('0x31')]['id']}})[_0x27ef('0xe')](handleEntityNotFound(_0x436f64,null))[_0x27ef('0xe')](saveUpdates(_0x39aae5[_0x27ef('0x35')],null))['then'](respondWithResult(_0x436f64,null))[_0x27ef('0x30')](handleError(_0x436f64,null));};exports[_0x27ef('0x36')]=function(_0x1650da,_0x58469b){return db['Dynamics365Account'][_0x27ef('0x37')]({'where':{'id':_0x1650da['params']['id']}})[_0x27ef('0xe')](handleEntityNotFound(_0x58469b,null))[_0x27ef('0xe')](removeEntity(_0x58469b,null))['catch'](handleError(_0x58469b,null));};exports[_0x27ef('0x38')]=function(_0xc4f502,_0x1c1c04){var _0x38ef69={};var _0x3955dc={};var _0x5b5899;var _0x2020d5;return db[_0x27ef('0x17')][_0x27ef('0x39')]({'where':{'id':_0xc4f502[_0x27ef('0x31')]['id']}})['then'](handleEntityNotFound(_0x1c1c04,null))[_0x27ef('0xe')](function(_0x3e054c){if(_0x3e054c){_0x5b5899=_0x3e054c;_0x3955dc[_0x27ef('0x1f')]=_['keys'](db[_0x27ef('0x3a')][_0x27ef('0x32')]);_0x3955dc[_0x27ef('0x1b')]=_[_0x27ef('0x1c')](_0xc4f502['query']);_0x3955dc[_0x27ef('0x1d')]=_[_0x27ef('0x1e')](_0x3955dc[_0x27ef('0x1f')],_0x3955dc[_0x27ef('0x1b')]);_0x38ef69[_0x27ef('0x20')]=_[_0x27ef('0x1e')](_0x3955dc[_0x27ef('0x1f')],qs[_0x27ef('0x21')](_0xc4f502[_0x27ef('0x1b')]['fields']));_0x38ef69['attributes']=_0x38ef69[_0x27ef('0x20')][_0x27ef('0x22')]?_0x38ef69[_0x27ef('0x20')]:_0x3955dc[_0x27ef('0x1f')];_0x38ef69[_0x27ef('0x25')]=qs['sort'](_0xc4f502[_0x27ef('0x1b')]['sort']);_0x38ef69[_0x27ef('0x27')]=qs[_0x27ef('0x1d')](_[_0x27ef('0x28')](_0xc4f502[_0x27ef('0x1b')],_0x3955dc['filters']));if(_0xc4f502['query']['filter']){_0x38ef69[_0x27ef('0x27')]=_['merge'](_0x38ef69[_0x27ef('0x27')],{'$or':_[_0x27ef('0x16')](_0x38ef69[_0x27ef('0x20')],function(_0x103766){var _0x2a2cf1={};_0x2a2cf1[_0x103766]={'$like':'%'+_0xc4f502[_0x27ef('0x1b')][_0x27ef('0x29')]+'%'};return _0x2a2cf1;})});}_0x38ef69=_['merge']({},_0x38ef69,_0xc4f502[_0x27ef('0x33')]);return _0x5b5899[_0x27ef('0x38')](_0x38ef69);}})[_0x27ef('0xe')](function(_0x45e4f3){if(_0x45e4f3){_0x2020d5=_0x45e4f3['length'];if(!_0xc4f502[_0x27ef('0x1b')][_0x27ef('0x23')](_0x27ef('0x24'))){_0x38ef69['limit']=qs[_0x27ef('0x8')](_0xc4f502['query'][_0x27ef('0x8')]);_0x38ef69[_0x27ef('0x6')]=qs[_0x27ef('0x6')](_0xc4f502[_0x27ef('0x1b')][_0x27ef('0x6')]);}return _0x5b5899['getConfigurations'](_0x38ef69);}})[_0x27ef('0xe')](function(_0x3516db){if(_0x3516db){return _0x3516db?{'count':_0x2020d5,'rows':_0x3516db}:null;}})[_0x27ef('0xe')](respondWithResult(_0x1c1c04,null))[_0x27ef('0x30')](handleError(_0x1c1c04,null));};exports[_0x27ef('0x3b')]=function(_0x5d0ac2,_0x31626a){if(_0x5d0ac2[_0x27ef('0x35')]['id']){delete _0x5d0ac2[_0x27ef('0x35')]['id'];}return db[_0x27ef('0x17')]['findOne']({'where':{'id':_0x5d0ac2[_0x27ef('0x31')]['id']}})[_0x27ef('0xe')](handleEntityNotFound(_0x31626a,null))[_0x27ef('0xe')](function(_0x464f32){if(_0x464f32){_0x5d0ac2['body'][_0x27ef('0x3c')]=_0x464f32['id'];_0x5d0ac2['body'][_0x27ef('0x3d')]=integrations[_0x27ef('0x3e')](_0x5d0ac2['body'][_0x27ef('0x3f')],_0x5d0ac2[_0x27ef('0x35')][_0x27ef('0x19')]);_0x5d0ac2['body'][_0x27ef('0x40')]=integrations[_0x27ef('0x41')](_0x5d0ac2[_0x27ef('0x35')][_0x27ef('0x3f')],_0x5d0ac2[_0x27ef('0x35')]['type']);return db[_0x27ef('0x3a')]['create'](_0x5d0ac2['body'],{'include':[{'model':db[_0x27ef('0x42')],'as':_0x27ef('0x3d')},{'model':db['Dynamics365Field'],'as':_0x27ef('0x40')}]});}return null;})[_0x27ef('0xe')](respondWithResult(_0x31626a,null))[_0x27ef('0x30')](handleError(_0x31626a,null));};function sanitizeRemoteUri(_0x17a4ce){var _0x8a0f3c=_0x17a4ce[_0x27ef('0x43')](-0x1);if(_0x8a0f3c==='/')return _0x17a4ce['substring'](0x0,_0x17a4ce[_0x27ef('0x44')](_0x8a0f3c));return _0x17a4ce;}function getWebApiUrl(_0x4b29d6){return util[_0x27ef('0x45')](_0x27ef('0x46'),_0x4b29d6);}exports[_0x27ef('0x47')]=function(_0x25d5e8,_0x436881){var _0x2aeb2a=_0x25d5e8['query'][_0x27ef('0x48')];var _0x1520f9=_0x2aeb2a===_0x27ef('0x49')?_0x27ef('0x4a'):'PhoneCall';var _0x2e10a0='';var _0x2636e4='';var _0x40d231='';var _0x31f653='';var _0x50479e='';var _0x1b2caa='';var _0x474554='';var _0x695bd5='';var _0x1f8a5a=[_0x27ef('0x4b'),_0x27ef('0x4c'),'customerid',_0x27ef('0x4d'),_0x27ef('0x4e'),_0x27ef('0x4f'),_0x27ef('0x50'),_0x27ef('0x51'),_0x27ef('0x52'),_0x27ef('0x53')];var _0x13c6f1=[_0x27ef('0x54'),_0x27ef('0x55'),_0x27ef('0x56'),_0x27ef('0x57'),'contactidname',_0x27ef('0x58'),_0x27ef('0x59'),_0x27ef('0x5a'),'createdbyexternalpartyname',_0x27ef('0x5b'),_0x27ef('0x5c'),_0x27ef('0x5d'),'createdon',_0x27ef('0x5e'),_0x27ef('0x5f'),_0x27ef('0x60'),_0x27ef('0x61'),'customeridyominame','emailaddress',_0x27ef('0x62'),_0x27ef('0x63'),_0x27ef('0x64'),_0x27ef('0x65'),_0x27ef('0x66'),_0x27ef('0x67'),_0x27ef('0x68'),_0x27ef('0x69'),_0x27ef('0x6a'),_0x27ef('0x6b'),_0x27ef('0x6c'),_0x27ef('0x6d'),_0x27ef('0x6e'),_0x27ef('0x6f'),'modifiedbyname',_0x27ef('0x70'),_0x27ef('0x71'),_0x27ef('0x72'),_0x27ef('0x73'),'msdyn_incidenttypename',_0x27ef('0x74'),'numberofchildincidents',_0x27ef('0x75'),_0x27ef('0x76'),_0x27ef('0x77'),_0x27ef('0x78'),'owneridyominame',_0x27ef('0x79'),'primarycontactidname',_0x27ef('0x7a'),_0x27ef('0x7b'),'productidname','productserialnumber','resolveby',_0x27ef('0x7c'),_0x27ef('0x7d'),'responsiblecontactidname',_0x27ef('0x7e'),_0x27ef('0x7f'),_0x27ef('0x80'),'slaname',_0x27ef('0x81'),_0x27ef('0x82'),'statuscode','subjectidname','ticketnumber',_0x27ef('0x83'),_0x27ef('0x84'),_0x27ef('0x85'),_0x27ef('0x86'),_0x27ef('0x87')];var _0x1a576a=_0x1f8a5a[_0x27ef('0x88')](_0x13c6f1);return db[_0x27ef('0x17')][_0x27ef('0x39')]({'where':{'id':_0x25d5e8[_0x27ef('0x31')]['id']},'attributes':['id',_0x27ef('0x89'),_0x27ef('0x8a'),_0x27ef('0x8b'),_0x27ef('0x8c'),_0x27ef('0x8d'),_0x27ef('0x8e'),_0x27ef('0x8f')],'include':[{'model':db[_0x27ef('0x90')],'as':_0x27ef('0x90'),'attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0x436881,null))['then'](function(_0x487de3){if(_0x487de3){if(_0x487de3[_0x27ef('0x8f')]){_0x487de3['access_token']=_0x487de3['CloudProvider'][_0x27ef('0x91')];_0x695bd5=sanitizeRemoteUri(_0x487de3[_0x27ef('0x90')]['data7']);_0x474554=getWebApiUrl(_0x695bd5);return _0x487de3;}_0x695bd5=sanitizeRemoteUri(_0x487de3[_0x27ef('0x8b')]);_0x474554=getWebApiUrl(_0x695bd5);var _0x212401={'method':'POST','uri':_0x27ef('0x92')+_0x487de3[_0x27ef('0x8c')]+_0x27ef('0x93'),'form':{'client_id':_0x487de3[_0x27ef('0x8d')],'resource':_0x695bd5,'username':_0x487de3['username'],'password':_0x487de3['password'],'grant_type':_0x27ef('0x8a'),'client_secret':_0x487de3[_0x27ef('0x8e')]},'json':!![]};return rp(_0x212401);}})[_0x27ef('0xe')](function(_0x5f07b9){_0x1b2caa=_0x5f07b9[_0x27ef('0x94')];var _0x413502={'method':_0x27ef('0x95'),'uri':encodeURI(_0x474554+_0x27ef('0x96')+_0x1520f9+'\x27'),'headers':{'Authorization':_0x27ef('0x97')+_0x1b2caa,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0x413502);})[_0x27ef('0xe')](function(_0x59055f){var _0x3e29d8=_0x59055f[_0x27ef('0x99')][0x0];var _0x3e54cd=_0x3e29d8[_0x27ef('0x9a')];var _0x2c04db={'method':'GET','uri':_0x474554+_0x27ef('0x9b')+_0x3e54cd+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x27ef('0x97')+_0x1b2caa,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0x2c04db);})[_0x27ef('0xe')](function(_0x13d652){_0x2e10a0=_0x13d652;_0x2636e4=_0x2e10a0[_0x27ef('0x9c')];_0x2636e4=_[_0x27ef('0x9d')](_0x2636e4,function(_0x747491){return!_0x1a576a[_0x27ef('0x9e')](_0x747491[_0x27ef('0x9f')]);});var _0x772ffd=[];var _0x2c2865=[];_0x2636e4['forEach'](function(_0x462505){if(_0x462505[_0x27ef('0xa0')]){var _0xc084c3=_0x462505[_0x27ef('0xa0')][_0x27ef('0xa1')](_0x462505[_0x27ef('0xa0')][_0x27ef('0x44')]('.')+0x1);if(_0xc084c3===_0x27ef('0xa2')){_0x772ffd['push'](getSelectList(_0x474554,_0x2aeb2a,_0x2c2865,_0x2e10a0['MetadataId'],_0x462505['MetadataId'],_0x1b2caa));}}});return Promise['all'](_0x772ffd);})[_0x27ef('0xe')](function(_0x24c6b5){_0x40d231=_0x24c6b5[0x0];var _0x231e8c=[];var _0x224698=[];_0x2636e4[_0x27ef('0xa3')](function(_0x217ae8){if(!_[_0x27ef('0xa4')](_0x217ae8[_0x27ef('0xa0')])){var _0x2a12e5=_0x217ae8[_0x27ef('0xa0')]['substring'](_0x217ae8[_0x27ef('0xa0')][_0x27ef('0x44')]('.')+0x1);if(_0x2a12e5===_0x27ef('0xa5')){_0x231e8c[_0x27ef('0xa6')](getBooleanList(_0x474554,_0x2aeb2a,_0x224698,_0x2e10a0[_0x27ef('0x9a')],_0x217ae8['MetadataId'],_0x1b2caa));}}});return Promise['all'](_0x231e8c);})[_0x27ef('0xe')](function(_0x1b991f){_0x31f653=_0x1b991f[0x0];var _0x5cb708=[];var _0x4f8387=[];_0x2636e4['forEach'](function(_0x3563c7){if(_0x3563c7['@odata.type']){var _0x40c623=_0x3563c7['@odata.type'][_0x27ef('0xa1')](_0x3563c7[_0x27ef('0xa0')]['lastIndexOf']('.')+0x1);if(_0x40c623===_0x27ef('0xa7')||_0x40c623==='DoubleAttributeMetadata'||_0x40c623===_0x27ef('0xa8')||_0x40c623===_0x27ef('0xa9')||_0x40c623==='MemoAttributeMetadata'||_0x40c623===_0x27ef('0xaa')||_0x40c623==='StatusAttributeMetadata'||_0x40c623===_0x27ef('0xab')||_0x40c623==='StateAttributeMetadata'||_0x40c623===_0x27ef('0xac')){_0x5cb708[_0x27ef('0xa6')](getInputList(_0x474554,_0x2aeb2a,_0x40c623,_0x4f8387,_0x2e10a0[_0x27ef('0x9a')],_0x3563c7[_0x27ef('0x9a')],_0x1b2caa));}}});return Promise[_0x27ef('0xad')](_0x5cb708);})[_0x27ef('0xe')](function(_0x8cfe82){_0x50479e=_0x8cfe82[0x0];var _0x409aa0=_0x40d231[_0x27ef('0x88')](_0x31f653)[_0x27ef('0x88')](_0x50479e);var _0x16cf4a={'count':_0x409aa0[_0x27ef('0x22')],'rows':_0x409aa0};return _0x16cf4a;})[_0x27ef('0xe')](respondWithResult(_0x436881,null))[_0x27ef('0x30')](function(_0x3b097c){var _0x12decb=_0x25d5e8[_0x27ef('0x1b')]['test']?0x1f4:_0x3b097c[_0x27ef('0xae')]||0x1f4;logger[_0x27ef('0x11')](_0x3b097c['stack']);delete _0x3b097c[_0x27ef('0x13')];if(_0x12decb===0x191){_0x12decb=0x190;}_0x436881[_0x27ef('0xa')](_0x12decb)[_0x27ef('0x14')](_0x25d5e8[_0x27ef('0x1b')][_0x27ef('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x3b097c[_0x27ef('0xae')]}:_0x3b097c);});};function getSelectList(_0x2e7cff,_0x1995cb,_0x62c447,_0x4b0947,_0x1a5e50,_0xf51d7b){var _0x26236a={'method':'GET','uri':_0x2e7cff+_0x27ef('0x9b')+_0x4b0947+_0x27ef('0xb0')+_0x1a5e50+_0x27ef('0xb1')+_0x27ef('0xb2'),'headers':{'Authorization':_0x27ef('0x97')+_0xf51d7b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26236a)[_0x27ef('0xe')](function(_0x7d9775){var _0x52d929=[];var _0x18c444=_0x7d9775[_0x27ef('0xb3')][_0x27ef('0xb4')];_0x18c444['forEach'](function(_0x501b67){_0x52d929[_0x27ef('0xa6')]({'name':_0x501b67[_0x27ef('0xb5')][_0x27ef('0xb6')][_0x27ef('0xb5')],'value':String(_0x501b67[_0x27ef('0xb7')])});});var _0x3c8291={'id':_0x1995cb+'_'+_0x7d9775[_0x27ef('0x9f')],'name':_0x7d9775['DisplayName']['UserLocalizedLabel'][_0x27ef('0xb5')],'custom':![],'options':_0x52d929};_0x62c447['push'](_0x3c8291);return _0x62c447;});}function getBooleanList(_0x22608e,_0x1114ac,_0x172f07,_0x2b5734,_0x49a22d,_0xc95cfb){var _0x25ebce={'method':'GET','uri':_0x22608e+_0x27ef('0x9b')+_0x2b5734+_0x27ef('0xb0')+_0x49a22d+_0x27ef('0xb8'),'headers':{'Authorization':_0x27ef('0x97')+_0xc95cfb,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0x25ebce)[_0x27ef('0xe')](function(_0x3756ab){var _0x538b88=[];_0x538b88[_0x27ef('0xa6')]({'name':_0x3756ab[_0x27ef('0xb3')][_0x27ef('0xb9')]['Label'][_0x27ef('0xb6')]['Label'],'value':_0x27ef('0xba')},{'name':_0x3756ab[_0x27ef('0xb3')]['FalseOption']['Label']['UserLocalizedLabel'][_0x27ef('0xb5')],'value':'false'});var _0x2de334={'id':_0x1114ac+'_'+_0x3756ab['LogicalName'],'name':_0x3756ab['DisplayName'][_0x27ef('0xb6')][_0x27ef('0xb5')],'custom':![],'options':_0x538b88};_0x172f07[_0x27ef('0xa6')](_0x2de334);return _0x172f07;});}function getInputList(_0x24e2ba,_0x1226ce,_0x387241,_0x191790,_0x330edc,_0x4ca4de,_0x8f46de){var _0xcb57d2={'method':_0x27ef('0x95'),'uri':_0x24e2ba+_0x27ef('0x9b')+_0x330edc+_0x27ef('0xb0')+_0x4ca4de+_0x27ef('0xbb')+_0x387241+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x27ef('0x97')+_0x8f46de,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0xcb57d2)[_0x27ef('0xe')](function(_0x52e3db){var _0x4ee2e9={'id':_0x1226ce+'_'+_0x52e3db[_0x27ef('0x9f')],'name':_0x52e3db[_0x27ef('0xbc')][_0x27ef('0xb6')]?_0x52e3db[_0x27ef('0xbc')][_0x27ef('0xb6')]['Label']:_0x52e3db[_0x27ef('0x9f')],'custom':![],'options':[]};_0x191790['push'](_0x4ee2e9);return _0x191790;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 49be6fd..b509a11 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 _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(_0x2b43be,_0x72286d){var _0x5a80e8=function(_0x286831){while(--_0x286831){_0x2b43be['push'](_0x2b43be['shift']());}};_0x5a80e8(++_0x72286d);}(_0xe706,0xa3));var _0x6e70=function(_0x4f2039,_0x528e8e){_0x4f2039=_0x4f2039-0x0;var _0x9643db=_0xe706[_0x4f2039];return _0x9643db;};'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 +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x1ad164,_0x10af7f){var _0x1cfb0f=function(_0x5b4c4e){while(--_0x5b4c4e){_0x1ad164['push'](_0x1ad164['shift']());}};_0x1cfb0f(++_0x10af7f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index cada3b5..499d2ee 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 _0x45d0=['Dynamics365Account','options','raw','where','limit','map','include','model','attributes','GetDynamics365Account','debug','catch','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x39ad9e,_0xd8de85){var _0x51c04e=function(_0x170f01){while(--_0x170f01){_0x39ad9e['push'](_0x39ad9e['shift']());}};_0x51c04e(++_0xd8de85);}(_0x45d0,0x180));var _0x045d=function(_0x522c59,_0x175aaa){_0x522c59=_0x522c59-0x0;var _0x7b6dcc=_0x45d0[_0x522c59];return _0x7b6dcc;};'use strict';var _=require(_0x045d('0x0'));var util=require(_0x045d('0x1'));var moment=require(_0x045d('0x2'));var BPromise=require('bluebird');var rs=require(_0x045d('0x3'));var fs=require('fs');var Redis=require(_0x045d('0x4'));var db=require(_0x045d('0x5'))['db'];var utils=require(_0x045d('0x6'));var logger=require(_0x045d('0x7'))(_0x045d('0x8'));var config=require(_0x045d('0x9'));var jayson=require(_0x045d('0xa'));var client=jayson['client'][_0x045d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30251c,_0x4896da,_0x438649){return new BPromise(function(_0x343d81,_0x5ae4a9){return client[_0x045d('0xc')](_0x30251c,_0x438649)[_0x045d('0xd')](function(_0x204693){logger[_0x045d('0xe')](_0x045d('0xf'),_0x4896da,_0x045d('0x10'));logger['debug'](_0x045d('0x11'),_0x4896da,_0x045d('0x10'),JSON[_0x045d('0x12')](_0x204693));if(_0x204693[_0x045d('0x13')]){if(_0x204693[_0x045d('0x13')][_0x045d('0x14')]===0x1f4){logger['error'](_0x045d('0xf'),_0x4896da,_0x204693[_0x045d('0x13')]['message']);return _0x5ae4a9(_0x204693[_0x045d('0x13')][_0x045d('0x15')]);}logger[_0x045d('0x13')](_0x045d('0xf'),_0x4896da,_0x204693[_0x045d('0x13')][_0x045d('0x15')]);return _0x343d81(_0x204693[_0x045d('0x13')][_0x045d('0x15')]);}else{logger['info'](_0x045d('0xf'),_0x4896da,_0x045d('0x10'));_0x343d81(_0x204693[_0x045d('0x16')][_0x045d('0x15')]);}})['catch'](function(_0x276ba9){logger[_0x045d('0x13')](_0x045d('0xf'),_0x4896da,_0x276ba9);_0x5ae4a9(_0x276ba9);});});}exports['GetDynamics365Account']=function(_0x5a2bfa){var _0x1b23c4=this;return new Promise(function(_0x37dd8b,_0x235cd0){return db[_0x045d('0x17')]['findAll']({'raw':_0x5a2bfa[_0x045d('0x18')]?_0x5a2bfa['options'][_0x045d('0x19')]===undefined?!![]:![]:!![],'where':_0x5a2bfa[_0x045d('0x18')]?_0x5a2bfa[_0x045d('0x18')][_0x045d('0x1a')]||null:null,'attributes':_0x5a2bfa[_0x045d('0x18')]?_0x5a2bfa[_0x045d('0x18')]['attributes']||null:null,'limit':_0x5a2bfa[_0x045d('0x18')]?_0x5a2bfa[_0x045d('0x18')][_0x045d('0x1b')]||null:null,'include':_0x5a2bfa[_0x045d('0x18')]?_0x5a2bfa[_0x045d('0x18')]['include']?_[_0x045d('0x1c')](_0x5a2bfa[_0x045d('0x18')][_0x045d('0x1d')],function(_0x2c50a9){return{'model':db[_0x2c50a9[_0x045d('0x1e')]],'as':_0x2c50a9['as'],'attributes':_0x2c50a9[_0x045d('0x1f')],'include':_0x2c50a9[_0x045d('0x1d')]?_[_0x045d('0x1c')](_0x2c50a9[_0x045d('0x1d')],function(_0x268a1f){return{'model':db[_0x268a1f[_0x045d('0x1e')]],'as':_0x268a1f['as'],'attributes':_0x268a1f['attributes'],'include':_0x268a1f[_0x045d('0x1d')]?_[_0x045d('0x1c')](_0x268a1f['include'],function(_0x35d2d1){return{'model':db[_0x35d2d1[_0x045d('0x1e')]],'as':_0x35d2d1['as'],'attributes':_0x35d2d1[_0x045d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x045d('0xd')](function(_0x3478eb){logger[_0x045d('0xe')](_0x045d('0x20'),_0x5a2bfa);logger[_0x045d('0x21')](_0x045d('0x20'),_0x5a2bfa,JSON[_0x045d('0x12')](_0x3478eb));_0x37dd8b(_0x3478eb);})[_0x045d('0x22')](function(_0x27b316){logger['error'](_0x045d('0x20'),_0x27b316['message'],_0x5a2bfa);_0x235cd0(_0x1b23c4['error'](0x1f4,_0x27b316['message']));});});};exports[_0x045d('0x23')]=function(_0x503ac9){var _0x3b833a=this;return new Promise(function(_0x37eb12,_0x49fb43){return db['Dynamics365Account'][_0x045d('0x24')]({'raw':_0x503ac9[_0x045d('0x18')]?_0x503ac9[_0x045d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x503ac9[_0x045d('0x18')]?_0x503ac9[_0x045d('0x18')][_0x045d('0x1a')]||null:null,'attributes':_0x503ac9['options']?_0x503ac9[_0x045d('0x18')][_0x045d('0x1f')]||null:null,'include':_0x503ac9[_0x045d('0x18')]?_0x503ac9['options'][_0x045d('0x1d')]?_[_0x045d('0x1c')](_0x503ac9['options'][_0x045d('0x1d')],function(_0x1e41bf){return{'model':db[_0x1e41bf[_0x045d('0x1e')]],'as':_0x1e41bf['as'],'attributes':_0x1e41bf['attributes'],'include':_0x1e41bf['include']?_['map'](_0x1e41bf[_0x045d('0x1d')],function(_0x2e0ed0){return{'model':db[_0x2e0ed0[_0x045d('0x1e')]],'as':_0x2e0ed0['as'],'attributes':_0x2e0ed0[_0x045d('0x1f')],'include':_0x2e0ed0['include']?_[_0x045d('0x1c')](_0x2e0ed0[_0x045d('0x1d')],function(_0x213d55){return{'model':db[_0x213d55[_0x045d('0x1e')]],'as':_0x213d55['as'],'attributes':_0x213d55[_0x045d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x045d('0xd')](function(_0x30c253){logger[_0x045d('0xe')](_0x045d('0x23'),_0x503ac9);logger[_0x045d('0x21')](_0x045d('0x23'),_0x503ac9,JSON[_0x045d('0x12')](_0x30c253));_0x37eb12(_0x30c253);})[_0x045d('0x22')](function(_0xe7aeef){logger['error'](_0x045d('0x23'),_0xe7aeef[_0x045d('0x15')],_0x503ac9);_0x49fb43(_0x3b833a[_0x045d('0x13')](0x1f4,_0xe7aeef[_0x045d('0x15')]));});});}; \ No newline at end of file +var _0xad11=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4299d0,_0x500a91){var _0x5b5187=function(_0x2f359b){while(--_0x2f359b){_0x4299d0['push'](_0x4299d0['shift']());}};_0x5b5187(++_0x500a91);}(_0xad11,0xe2));var _0x1ad1=function(_0x4fe483,_0x57c2d3){_0x4fe483=_0x4fe483-0x0;var _0x13db76=_0xad11[_0x4fe483];return _0x13db76;};'use strict';var _=require(_0x1ad1('0x0'));var util=require(_0x1ad1('0x1'));var moment=require('moment');var BPromise=require(_0x1ad1('0x2'));var rs=require(_0x1ad1('0x3'));var fs=require('fs');var Redis=require(_0x1ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1ad1('0x5'))(_0x1ad1('0x6'));var config=require(_0x1ad1('0x7'));var jayson=require(_0x1ad1('0x8'));var client=jayson[_0x1ad1('0x9')][_0x1ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46af7e,_0x2058e1,_0x3d077a){return new BPromise(function(_0x19106d,_0x349840){return client[_0x1ad1('0xb')](_0x46af7e,_0x3d077a)[_0x1ad1('0xc')](function(_0x5b5b6d){logger[_0x1ad1('0xd')](_0x1ad1('0xe'),_0x2058e1,_0x1ad1('0xf'));logger[_0x1ad1('0x10')](_0x1ad1('0x11'),_0x2058e1,_0x1ad1('0xf'),JSON[_0x1ad1('0x12')](_0x5b5b6d));if(_0x5b5b6d[_0x1ad1('0x13')]){if(_0x5b5b6d[_0x1ad1('0x13')]['code']===0x1f4){logger[_0x1ad1('0x13')](_0x1ad1('0xe'),_0x2058e1,_0x5b5b6d['error']['message']);return _0x349840(_0x5b5b6d[_0x1ad1('0x13')][_0x1ad1('0x14')]);}logger[_0x1ad1('0x13')](_0x1ad1('0xe'),_0x2058e1,_0x5b5b6d[_0x1ad1('0x13')]['message']);return _0x19106d(_0x5b5b6d[_0x1ad1('0x13')]['message']);}else{logger[_0x1ad1('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2058e1,'request\x20sent');_0x19106d(_0x5b5b6d[_0x1ad1('0x15')][_0x1ad1('0x14')]);}})[_0x1ad1('0x16')](function(_0x4d0b68){logger[_0x1ad1('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x2058e1,_0x4d0b68);_0x349840(_0x4d0b68);});});}exports['GetDynamics365Account']=function(_0x15ea09){var _0x15347a=this;return new Promise(function(_0x4d4f32,_0x349032){return db['Dynamics365Account'][_0x1ad1('0x17')]({'raw':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x19')]===undefined?!![]:![]:!![],'where':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x1a')]||null:null,'attributes':_0x15ea09['options']?_0x15ea09['options'][_0x1ad1('0x1b')]||null:null,'limit':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09['options']['limit']||null:null,'include':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x1c')]?_[_0x1ad1('0x1d')](_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x1c')],function(_0x353d72){return{'model':db[_0x353d72[_0x1ad1('0x1e')]],'as':_0x353d72['as'],'attributes':_0x353d72[_0x1ad1('0x1b')],'include':_0x353d72[_0x1ad1('0x1c')]?_['map'](_0x353d72[_0x1ad1('0x1c')],function(_0x415150){return{'model':db[_0x415150[_0x1ad1('0x1e')]],'as':_0x415150['as'],'attributes':_0x415150[_0x1ad1('0x1b')],'include':_0x415150[_0x1ad1('0x1c')]?_[_0x1ad1('0x1d')](_0x415150[_0x1ad1('0x1c')],function(_0x495d86){return{'model':db[_0x495d86[_0x1ad1('0x1e')]],'as':_0x495d86['as'],'attributes':_0x495d86[_0x1ad1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ad1('0xc')](function(_0x3c1f3e){logger[_0x1ad1('0xd')](_0x1ad1('0x1f'),_0x15ea09);logger['debug'](_0x1ad1('0x1f'),_0x15ea09,JSON[_0x1ad1('0x12')](_0x3c1f3e));_0x4d4f32(_0x3c1f3e);})[_0x1ad1('0x16')](function(_0x408ca5){logger[_0x1ad1('0x13')](_0x1ad1('0x1f'),_0x408ca5[_0x1ad1('0x14')],_0x15ea09);_0x349032(_0x15347a[_0x1ad1('0x13')](0x1f4,_0x408ca5[_0x1ad1('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x540b23){var _0x43c366=this;return new Promise(function(_0x2c452e,_0x48b952){return db['Dynamics365Account']['find']({'raw':_0x540b23[_0x1ad1('0x18')]?_0x540b23[_0x1ad1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x540b23[_0x1ad1('0x18')]?_0x540b23['options'][_0x1ad1('0x1a')]||null:null,'attributes':_0x540b23[_0x1ad1('0x18')]?_0x540b23[_0x1ad1('0x18')][_0x1ad1('0x1b')]||null:null,'include':_0x540b23[_0x1ad1('0x18')]?_0x540b23[_0x1ad1('0x18')][_0x1ad1('0x1c')]?_['map'](_0x540b23['options'][_0x1ad1('0x1c')],function(_0x49629c){return{'model':db[_0x49629c['model']],'as':_0x49629c['as'],'attributes':_0x49629c[_0x1ad1('0x1b')],'include':_0x49629c[_0x1ad1('0x1c')]?_['map'](_0x49629c[_0x1ad1('0x1c')],function(_0x177c0e){return{'model':db[_0x177c0e[_0x1ad1('0x1e')]],'as':_0x177c0e['as'],'attributes':_0x177c0e[_0x1ad1('0x1b')],'include':_0x177c0e['include']?_[_0x1ad1('0x1d')](_0x177c0e['include'],function(_0x5786d7){return{'model':db[_0x5786d7[_0x1ad1('0x1e')]],'as':_0x5786d7['as'],'attributes':_0x5786d7[_0x1ad1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ad1('0xc')](function(_0x2e7435){logger[_0x1ad1('0xd')](_0x1ad1('0x20'),_0x540b23);logger['debug'](_0x1ad1('0x20'),_0x540b23,JSON[_0x1ad1('0x12')](_0x2e7435));_0x2c452e(_0x2e7435);})['catch'](function(_0x5ebe48){logger['error'](_0x1ad1('0x20'),_0x5ebe48[_0x1ad1('0x14')],_0x540b23);_0x48b952(_0x43c366[_0x1ad1('0x13')](0x1f4,_0x5ebe48[_0x1ad1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index da713b7..1387a4e 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 _0x5e8e=['/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0x2af1a5,_0x13fc0b){var _0x539915=function(_0x435f1c){while(--_0x435f1c){_0x2af1a5['push'](_0x2af1a5['shift']());}};_0x539915(++_0x13fc0b);}(_0x5e8e,0x1d4));var _0xe5e8=function(_0x455a49,_0x441ef7){_0x455a49=_0x455a49-0x0;var _0x2c1e7a=_0x5e8e[_0x455a49];return _0x2c1e7a;};'use strict';var multer=require('multer');var util=require(_0xe5e8('0x0'));var path=require(_0xe5e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xe5e8('0x2'));var router=express[_0xe5e8('0x3')]();var fs_extra=require(_0xe5e8('0x4'));var auth=require(_0xe5e8('0x5'));var interaction=require(_0xe5e8('0x6'));var config=require(_0xe5e8('0x7'));var controller=require(_0xe5e8('0x8'));router['get']('/',auth[_0xe5e8('0x9')](),controller[_0xe5e8('0xa')]);router[_0xe5e8('0xb')](_0xe5e8('0xc'),auth[_0xe5e8('0x9')](),controller[_0xe5e8('0xd')]);router['get'](_0xe5e8('0xe'),auth[_0xe5e8('0x9')](),controller['getFields']);router[_0xe5e8('0xb')]('/:id/subjects',auth[_0xe5e8('0x9')](),controller['getSubjects']);router['get'](_0xe5e8('0xf'),auth['isAuthenticated'](),controller[_0xe5e8('0x10')]);router[_0xe5e8('0x11')]('/',auth['isAuthenticated'](),controller[_0xe5e8('0x12')]);router[_0xe5e8('0x13')](_0xe5e8('0xc'),auth[_0xe5e8('0x9')](),controller[_0xe5e8('0x14')]);router[_0xe5e8('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe5e8('0x16')]=router; \ No newline at end of file +var _0x3441=['/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','isAuthenticated','index','get'];(function(_0x3e0638,_0x5ad6a0){var _0x40f220=function(_0x369b31){while(--_0x369b31){_0x3e0638['push'](_0x3e0638['shift']());}};_0x40f220(++_0x5ad6a0);}(_0x3441,0x14b));var _0x1344=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0x3441[_0x411e5d];return _0x58298;};'use strict';var multer=require(_0x1344('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1344('0x1'));var express=require(_0x1344('0x2'));var router=express['Router']();var fs_extra=require(_0x1344('0x3'));var auth=require(_0x1344('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1344('0x5'));router['get']('/',auth[_0x1344('0x6')](),controller[_0x1344('0x7')]);router[_0x1344('0x8')](_0x1344('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1344('0x8')](_0x1344('0xa'),auth[_0x1344('0x6')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x1344('0x6')](),controller[_0x1344('0xb')]);router[_0x1344('0x8')](_0x1344('0xc'),auth[_0x1344('0x6')](),controller[_0x1344('0xd')]);router[_0x1344('0xe')]('/',auth[_0x1344('0x6')](),controller[_0x1344('0xf')]);router[_0x1344('0x10')](_0x1344('0x9'),auth[_0x1344('0x6')](),controller[_0x1344('0x11')]);router['delete'](_0x1344('0x9'),auth[_0x1344('0x6')](),controller[_0x1344('0x12')]);module[_0x1344('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f3a629b..ba5640e 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 _0xf921=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xf921,0x83));var _0x1f92=function(_0x258c2d,_0x228ca5){_0x258c2d=_0x258c2d-0x0;var _0x58087f=_0xf921[_0x258c2d];return _0x58087f;};'use strict';var Sequelize=require(_0x1f92('0x0'));module[_0x1f92('0x1')]={'name':{'type':Sequelize[_0x1f92('0x2')]},'description':{'type':Sequelize[_0x1f92('0x2')]},'ticketType':{'type':Sequelize[_0x1f92('0x3')](_0x1f92('0x4'),_0x1f92('0x5')),'defaultValue':_0x1f92('0x4')},'moduleCreate':{'type':Sequelize[_0x1f92('0x3')](_0x1f92('0x6'),_0x1f92('0x7')),'defaultValue':_0x1f92('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1f92('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x1f92('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x63ca=['STRING','ENUM','incident','nothing','contact','sequelize'];(function(_0xfab997,_0x3c1244){var _0x3e54bc=function(_0x7a08c6){while(--_0x7a08c6){_0xfab997['push'](_0xfab997['shift']());}};_0x3e54bc(++_0x3c1244);}(_0x63ca,0xc5));var _0xa63c=function(_0x3eb052,_0x5c8591){_0x3eb052=_0x3eb052-0x0;var _0x411e93=_0x63ca[_0x3eb052];return _0x411e93;};'use strict';var Sequelize=require(_0xa63c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa63c('0x1')]},'description':{'type':Sequelize[_0xa63c('0x1')]},'ticketType':{'type':Sequelize[_0xa63c('0x2')]('incident','phonecall'),'defaultValue':_0xa63c('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xa63c('0x4')),'defaultValue':_0xa63c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa63c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c7c48b3..1d5c626 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 _0x88c5=['getFields','findOne','Dynamics365Field','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','Dynamics365Configuration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','update','params'];(function(_0x4f5260,_0x1e03dc){var _0x2a0958=function(_0x41d9db){while(--_0x41d9db){_0x4f5260['push'](_0x4f5260['shift']());}};_0x2a0958(++_0x1e03dc);}(_0x88c5,0x1e6));var _0x588c=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x88c5[_0x1663ae];return _0x30ffb8;};'use strict';var emlformat=require(_0x588c('0x0'));var rimraf=require(_0x588c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x588c('0x2'));var rp=require(_0x588c('0x3'));var moment=require(_0x588c('0x4'));var BPromise=require(_0x588c('0x5'));var Mustache=require(_0x588c('0x6'));var util=require('util');var path=require(_0x588c('0x7'));var sox=require(_0x588c('0x8'));var csv=require(_0x588c('0x9'));var ejs=require(_0x588c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x588c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x588c('0xc'));var toCsv=require(_0x588c('0x9'));var querystring=require(_0x588c('0xd'));var Papa=require('papaparse');var Redis=require(_0x588c('0xe'));var authService=require(_0x588c('0xf'));var qs=require(_0x588c('0x10'));var as=require(_0x588c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x588c('0x12'))(_0x588c('0x13'));var utils=require(_0x588c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x588c('0x15'));var db=require(_0x588c('0x16'))['db'];function respondWithStatusCode(_0x31a93d,_0x109a43){_0x109a43=_0x109a43||0xcc;return function(_0x367ddc){if(_0x367ddc){return _0x31a93d['sendStatus'](_0x109a43);}return _0x31a93d['status'](_0x109a43)['end']();};}function respondWithResult(_0x31106b,_0xce1947){_0xce1947=_0xce1947||0xc8;return function(_0x57ff75){if(_0x57ff75){return _0x31106b[_0x588c('0x17')](_0xce1947)[_0x588c('0x18')](_0x57ff75);}};}function respondWithFilteredResult(_0x242c99,_0x2b9033){return function(_0x9632db){if(_0x9632db){var _0x1e760b=typeof _0x2b9033[_0x588c('0x19')]===_0x588c('0x1a')&&typeof _0x2b9033[_0x588c('0x1b')]===_0x588c('0x1a');var _0x9c8659=_0x9632db[_0x588c('0x1c')];var _0x1c30b8=_0x1e760b?0x0:_0x2b9033[_0x588c('0x19')];var _0x1b0c36=_0x1e760b?_0x9632db[_0x588c('0x1c')]:_0x2b9033[_0x588c('0x19')]+_0x2b9033[_0x588c('0x1b')];var _0x893887;if(_0x1b0c36>=_0x9c8659){_0x1b0c36=_0x9c8659;_0x893887=0xc8;}else{_0x893887=0xce;}_0x242c99['status'](_0x893887);return _0x242c99['set'](_0x588c('0x1d'),_0x1c30b8+'-'+_0x1b0c36+'/'+_0x9c8659)[_0x588c('0x18')](_0x9632db);}return null;};}function patchUpdates(_0x3fe4f8){return function(_0x57dbe1){try{jsonpatch[_0x588c('0x1e')](_0x57dbe1,_0x3fe4f8,!![]);}catch(_0x97dc30){return BPromise[_0x588c('0x1f')](_0x97dc30);}return _0x57dbe1[_0x588c('0x20')]();};}function saveUpdates(_0x59e2f8,_0x1c95ea){return function(_0x467c9e){if(_0x467c9e){return _0x467c9e['update'](_0x59e2f8)[_0x588c('0x21')](function(_0x18ae2d){return _0x18ae2d;});}return null;};}function removeEntity(_0x2deff8,_0x5dcf92){return function(_0x5ec15e){if(_0x5ec15e){return _0x5ec15e[_0x588c('0x22')]()[_0x588c('0x21')](function(){_0x2deff8['status'](0xcc)[_0x588c('0x23')]();});}};}function handleEntityNotFound(_0x18ecc6,_0x584423){return function(_0x7868bb){if(!_0x7868bb){_0x18ecc6[_0x588c('0x24')](0x194);}return _0x7868bb;};}function handleError(_0x165bf6,_0x6ab467){_0x6ab467=_0x6ab467||0x1f4;return function(_0x104d5f){logger[_0x588c('0x25')](_0x104d5f[_0x588c('0x26')]);if(_0x104d5f[_0x588c('0x27')]){delete _0x104d5f[_0x588c('0x27')];}_0x165bf6[_0x588c('0x17')](_0x6ab467)['send'](_0x104d5f);};}exports[_0x588c('0x28')]=function(_0x346922,_0x4c1819){var _0x1bd055={},_0x388397={},_0x55619a={'count':0x0,'rows':[]};var _0x56d0bd=_['map'](db[_0x588c('0x29')]['rawAttributes'],function(_0x41a3b1){return{'name':_0x41a3b1[_0x588c('0x2a')],'type':_0x41a3b1[_0x588c('0x2b')][_0x588c('0x2c')]};});_0x388397[_0x588c('0x2d')]=_[_0x588c('0x2e')](_0x56d0bd,_0x588c('0x27'));_0x388397[_0x588c('0x2f')]=_[_0x588c('0x30')](_0x346922[_0x588c('0x2f')]);_0x388397[_0x588c('0x31')]=_[_0x588c('0x32')](_0x388397['model'],_0x388397['query']);_0x1bd055['attributes']=_[_0x588c('0x32')](_0x388397[_0x588c('0x2d')],qs[_0x588c('0x33')](_0x346922[_0x588c('0x2f')][_0x588c('0x33')]));_0x1bd055[_0x588c('0x34')]=_0x1bd055[_0x588c('0x34')][_0x588c('0x35')]?_0x1bd055[_0x588c('0x34')]:_0x388397[_0x588c('0x2d')];if(!_0x346922[_0x588c('0x2f')][_0x588c('0x36')](_0x588c('0x37'))){_0x1bd055[_0x588c('0x1b')]=qs[_0x588c('0x1b')](_0x346922[_0x588c('0x2f')][_0x588c('0x1b')]);_0x1bd055['offset']=qs[_0x588c('0x19')](_0x346922[_0x588c('0x2f')][_0x588c('0x19')]);}_0x1bd055[_0x588c('0x38')]=qs[_0x588c('0x39')](_0x346922[_0x588c('0x2f')]['sort']);_0x1bd055['where']=qs[_0x588c('0x31')](_[_0x588c('0x3a')](_0x346922[_0x588c('0x2f')],_0x388397[_0x588c('0x31')]),_0x56d0bd);if(_0x346922[_0x588c('0x2f')][_0x588c('0x3b')]){_0x1bd055[_0x588c('0x3c')]=_[_0x588c('0x3d')](_0x1bd055[_0x588c('0x3c')],{'$or':_[_0x588c('0x2e')](_0x56d0bd,function(_0x35525a){if(_0x35525a[_0x588c('0x2b')]!=='VIRTUAL'){var _0x267db8={};_0x267db8[_0x35525a[_0x588c('0x27')]]={'$like':'%'+_0x346922[_0x588c('0x2f')][_0x588c('0x3b')]+'%'};return _0x267db8;}})});}_0x1bd055=_['merge']({},_0x1bd055,_0x346922[_0x588c('0x3e')]);var _0x3896f6={'where':_0x1bd055[_0x588c('0x3c')]};return db[_0x588c('0x29')][_0x588c('0x1c')](_0x3896f6)[_0x588c('0x21')](function(_0x20ce38){_0x55619a['count']=_0x20ce38;if(_0x346922[_0x588c('0x2f')][_0x588c('0x3f')]){_0x1bd055['include']=[{'all':!![]}];}return db[_0x588c('0x29')][_0x588c('0x40')](_0x1bd055);})[_0x588c('0x21')](function(_0x2accc9){_0x55619a[_0x588c('0x41')]=_0x2accc9;return _0x55619a;})['then'](respondWithFilteredResult(_0x4c1819,_0x1bd055))[_0x588c('0x42')](handleError(_0x4c1819,null));};exports[_0x588c('0x43')]=function(_0x5b55ed,_0x3260ee){var _0x23e25d={'raw':![],'where':{'id':_0x5b55ed['params']['id']}},_0x263bba={};_0x263bba['model']=_[_0x588c('0x30')](db[_0x588c('0x29')]['rawAttributes']);_0x263bba[_0x588c('0x2f')]=_[_0x588c('0x30')](_0x5b55ed[_0x588c('0x2f')]);_0x263bba[_0x588c('0x31')]=_[_0x588c('0x32')](_0x263bba[_0x588c('0x2d')],_0x263bba['query']);_0x23e25d[_0x588c('0x34')]=_['intersection'](_0x263bba[_0x588c('0x2d')],qs[_0x588c('0x33')](_0x5b55ed[_0x588c('0x2f')][_0x588c('0x33')]));_0x23e25d[_0x588c('0x34')]=_0x23e25d['attributes'][_0x588c('0x35')]?_0x23e25d[_0x588c('0x34')]:_0x263bba[_0x588c('0x2d')];if(_0x5b55ed[_0x588c('0x2f')][_0x588c('0x3f')]){_0x23e25d[_0x588c('0x44')]=[{'all':!![]}];}_0x23e25d=_[_0x588c('0x3d')]({},_0x23e25d,_0x5b55ed[_0x588c('0x3e')]);return db['Dynamics365Configuration'][_0x588c('0x45')](_0x23e25d)[_0x588c('0x21')](handleEntityNotFound(_0x3260ee,null))['then'](respondWithResult(_0x3260ee,null))[_0x588c('0x42')](handleError(_0x3260ee,null));};exports[_0x588c('0x46')]=function(_0x57e144,_0x1d92e6){return db[_0x588c('0x29')][_0x588c('0x46')](_0x57e144[_0x588c('0x47')],{})['then'](respondWithResult(_0x1d92e6,0xc9))['catch'](handleError(_0x1d92e6,null));};exports[_0x588c('0x48')]=function(_0x1437df,_0x364fe9){if(_0x1437df[_0x588c('0x47')]['id']){delete _0x1437df[_0x588c('0x47')]['id'];}return db[_0x588c('0x29')][_0x588c('0x45')]({'where':{'id':_0x1437df[_0x588c('0x49')]['id']}})[_0x588c('0x21')](handleEntityNotFound(_0x364fe9,null))[_0x588c('0x21')](saveUpdates(_0x1437df[_0x588c('0x47')],null))['then'](respondWithResult(_0x364fe9,null))[_0x588c('0x42')](handleError(_0x364fe9,null));};exports[_0x588c('0x22')]=function(_0xced570,_0x5dfd5c){return db['Dynamics365Configuration'][_0x588c('0x45')]({'where':{'id':_0xced570[_0x588c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5dfd5c,null))[_0x588c('0x21')](removeEntity(_0x5dfd5c,null))[_0x588c('0x42')](handleError(_0x5dfd5c,null));};exports[_0x588c('0x4a')]=function(_0x32f60b,_0x254d44,_0xfe861e){var _0x464a2f={};var _0xf1367b={};var _0x21b287;var _0x52f867;return db[_0x588c('0x29')][_0x588c('0x4b')]({'where':{'id':_0x32f60b[_0x588c('0x49')]['id']}})[_0x588c('0x21')](handleEntityNotFound(_0x254d44,null))[_0x588c('0x21')](function(_0x42b7db){if(_0x42b7db){_0x21b287=_0x42b7db;_0xf1367b['model']=_[_0x588c('0x30')](db[_0x588c('0x4c')][_0x588c('0x4d')]);_0xf1367b['query']=_[_0x588c('0x30')](_0x32f60b['query']);_0xf1367b[_0x588c('0x31')]=_[_0x588c('0x32')](_0xf1367b['model'],_0xf1367b[_0x588c('0x2f')]);_0x464a2f['attributes']=_['intersection'](_0xf1367b[_0x588c('0x2d')],qs[_0x588c('0x33')](_0x32f60b[_0x588c('0x2f')][_0x588c('0x33')]));_0x464a2f[_0x588c('0x34')]=_0x464a2f['attributes'][_0x588c('0x35')]?_0x464a2f['attributes']:_0xf1367b[_0x588c('0x2d')];_0x464a2f[_0x588c('0x38')]=qs[_0x588c('0x39')](_0x32f60b[_0x588c('0x2f')][_0x588c('0x39')]);_0x464a2f[_0x588c('0x3c')]=qs[_0x588c('0x31')](_[_0x588c('0x3a')](_0x32f60b[_0x588c('0x2f')],_0xf1367b[_0x588c('0x31')]));if(_0x32f60b['query'][_0x588c('0x3b')]){_0x464a2f[_0x588c('0x3c')]=_[_0x588c('0x3d')](_0x464a2f[_0x588c('0x3c')],{'$or':_[_0x588c('0x2e')](_0x464a2f[_0x588c('0x34')],function(_0x143536){var _0x4968f1={};_0x4968f1[_0x143536]={'$like':'%'+_0x32f60b[_0x588c('0x2f')][_0x588c('0x3b')]+'%'};return _0x4968f1;})});}_0x464a2f=_[_0x588c('0x3d')]({},_0x464a2f,_0x32f60b['options']);return _0x21b287[_0x588c('0x4a')](_0x464a2f);}})[_0x588c('0x21')](function(_0x1d31ab){if(_0x1d31ab){_0x52f867=_0x1d31ab[_0x588c('0x35')];if(!_0x32f60b[_0x588c('0x2f')][_0x588c('0x36')]('nolimit')){_0x464a2f[_0x588c('0x1b')]=qs[_0x588c('0x1b')](_0x32f60b[_0x588c('0x2f')][_0x588c('0x1b')]);_0x464a2f['offset']=qs[_0x588c('0x19')](_0x32f60b[_0x588c('0x2f')][_0x588c('0x19')]);}return _0x21b287[_0x588c('0x4a')](_0x464a2f);}})[_0x588c('0x21')](function(_0x41ea7b){if(_0x41ea7b){return _0x41ea7b?{'count':_0x52f867,'rows':_0x41ea7b}:null;}})[_0x588c('0x21')](respondWithResult(_0x254d44,null))[_0x588c('0x42')](handleError(_0x254d44,null));};exports[_0x588c('0x4e')]=function(_0x28ecd8,_0x1977fc,_0x297399){var _0x9a974c={};var _0x5cbd3e={};var _0x10eb01;var _0x300364;return db[_0x588c('0x29')]['findOne']({'where':{'id':_0x28ecd8[_0x588c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1977fc,null))[_0x588c('0x21')](function(_0x40d5e9){if(_0x40d5e9){_0x10eb01=_0x40d5e9;_0x5cbd3e[_0x588c('0x2d')]=_[_0x588c('0x30')](db[_0x588c('0x4c')]['rawAttributes']);_0x5cbd3e[_0x588c('0x2f')]=_[_0x588c('0x30')](_0x28ecd8[_0x588c('0x2f')]);_0x5cbd3e[_0x588c('0x31')]=_['intersection'](_0x5cbd3e[_0x588c('0x2d')],_0x5cbd3e[_0x588c('0x2f')]);_0x9a974c[_0x588c('0x34')]=_[_0x588c('0x32')](_0x5cbd3e['model'],qs[_0x588c('0x33')](_0x28ecd8[_0x588c('0x2f')][_0x588c('0x33')]));_0x9a974c[_0x588c('0x34')]=_0x9a974c[_0x588c('0x34')]['length']?_0x9a974c['attributes']:_0x5cbd3e[_0x588c('0x2d')];_0x9a974c[_0x588c('0x38')]=qs[_0x588c('0x39')](_0x28ecd8['query'][_0x588c('0x39')]);_0x9a974c[_0x588c('0x3c')]=qs[_0x588c('0x31')](_[_0x588c('0x3a')](_0x28ecd8[_0x588c('0x2f')],_0x5cbd3e[_0x588c('0x31')]));if(_0x28ecd8[_0x588c('0x2f')][_0x588c('0x3b')]){_0x9a974c[_0x588c('0x3c')]=_['merge'](_0x9a974c[_0x588c('0x3c')],{'$or':_[_0x588c('0x2e')](_0x9a974c['attributes'],function(_0x476ff1){var _0x26ca99={};_0x26ca99[_0x476ff1]={'$like':'%'+_0x28ecd8[_0x588c('0x2f')]['filter']+'%'};return _0x26ca99;})});}_0x9a974c=_[_0x588c('0x3d')]({},_0x9a974c,_0x28ecd8[_0x588c('0x3e')]);return _0x10eb01[_0x588c('0x4e')](_0x9a974c);}})['then'](function(_0x3ee40c){if(_0x3ee40c){_0x300364=_0x3ee40c[_0x588c('0x35')];if(!_0x28ecd8[_0x588c('0x2f')][_0x588c('0x36')](_0x588c('0x37'))){_0x9a974c[_0x588c('0x1b')]=qs[_0x588c('0x1b')](_0x28ecd8['query']['limit']);_0x9a974c[_0x588c('0x19')]=qs[_0x588c('0x19')](_0x28ecd8[_0x588c('0x2f')][_0x588c('0x19')]);}return _0x10eb01[_0x588c('0x4e')](_0x9a974c);}})[_0x588c('0x21')](function(_0x54134f){if(_0x54134f){return _0x54134f?{'count':_0x300364,'rows':_0x54134f}:null;}})[_0x588c('0x21')](respondWithResult(_0x1977fc,null))['catch'](handleError(_0x1977fc,null));};exports[_0x588c('0x4f')]=function(_0x1d118c,_0x3ab450,_0x11ed64){var _0x7720af={};var _0x1e93ba={};var _0x55e82e;var _0x46ce27;return db[_0x588c('0x29')][_0x588c('0x4b')]({'where':{'id':_0x1d118c[_0x588c('0x49')]['id']}})[_0x588c('0x21')](handleEntityNotFound(_0x3ab450,null))[_0x588c('0x21')](function(_0x4abf8d){if(_0x4abf8d){_0x55e82e=_0x4abf8d;_0x1e93ba[_0x588c('0x2d')]=_[_0x588c('0x30')](db['Dynamics365Field'][_0x588c('0x4d')]);_0x1e93ba[_0x588c('0x2f')]=_[_0x588c('0x30')](_0x1d118c['query']);_0x1e93ba[_0x588c('0x31')]=_[_0x588c('0x32')](_0x1e93ba['model'],_0x1e93ba[_0x588c('0x2f')]);_0x7720af[_0x588c('0x34')]=_['intersection'](_0x1e93ba['model'],qs[_0x588c('0x33')](_0x1d118c[_0x588c('0x2f')][_0x588c('0x33')]));_0x7720af[_0x588c('0x34')]=_0x7720af[_0x588c('0x34')][_0x588c('0x35')]?_0x7720af['attributes']:_0x1e93ba[_0x588c('0x2d')];_0x7720af[_0x588c('0x38')]=qs[_0x588c('0x39')](_0x1d118c['query']['sort']);_0x7720af[_0x588c('0x3c')]=qs['filters'](_['pick'](_0x1d118c[_0x588c('0x2f')],_0x1e93ba['filters']));if(_0x1d118c['query'][_0x588c('0x3b')]){_0x7720af[_0x588c('0x3c')]=_[_0x588c('0x3d')](_0x7720af[_0x588c('0x3c')],{'$or':_[_0x588c('0x2e')](_0x7720af[_0x588c('0x34')],function(_0xf0fc3f){var _0xe5a1a1={};_0xe5a1a1[_0xf0fc3f]={'$like':'%'+_0x1d118c[_0x588c('0x2f')][_0x588c('0x3b')]+'%'};return _0xe5a1a1;})});}_0x7720af=_['merge']({},_0x7720af,_0x1d118c[_0x588c('0x3e')]);return _0x55e82e[_0x588c('0x4f')](_0x7720af);}})[_0x588c('0x21')](function(_0x11d68d){if(_0x11d68d){_0x46ce27=_0x11d68d[_0x588c('0x35')];if(!_0x1d118c[_0x588c('0x2f')]['hasOwnProperty'](_0x588c('0x37'))){_0x7720af[_0x588c('0x1b')]=qs[_0x588c('0x1b')](_0x1d118c[_0x588c('0x2f')][_0x588c('0x1b')]);_0x7720af['offset']=qs[_0x588c('0x19')](_0x1d118c[_0x588c('0x2f')][_0x588c('0x19')]);}return _0x55e82e[_0x588c('0x4f')](_0x7720af);}})['then'](function(_0x4dcac4){if(_0x4dcac4){return _0x4dcac4?{'count':_0x46ce27,'rows':_0x4dcac4}:null;}})['then'](respondWithResult(_0x3ab450,null))[_0x588c('0x42')](handleError(_0x3ab450,null));}; \ No newline at end of file +var _0x8f06=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','includeAll','find','create','body','then','params','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8f06,0x6c));var _0x68f0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f06[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68f0('0x0'));var zipdir=require(_0x68f0('0x1'));var jsonpatch=require(_0x68f0('0x2'));var rp=require(_0x68f0('0x3'));var moment=require(_0x68f0('0x4'));var BPromise=require(_0x68f0('0x5'));var Mustache=require(_0x68f0('0x6'));var util=require(_0x68f0('0x7'));var path=require('path');var sox=require(_0x68f0('0x8'));var csv=require(_0x68f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68f0('0xa'));var squel=require(_0x68f0('0xb'));var crypto=require('crypto');var jsforce=require(_0x68f0('0xc'));var deskjs=require(_0x68f0('0xd'));var toCsv=require(_0x68f0('0x9'));var querystring=require(_0x68f0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x68f0('0xf'));var qs=require(_0x68f0('0x10'));var as=require(_0x68f0('0x11'));var hardwareService=require(_0x68f0('0x12'));var logger=require(_0x68f0('0x13'))(_0x68f0('0x14'));var utils=require(_0x68f0('0x15'));var config=require(_0x68f0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x68f0('0x17'))['db'];function respondWithStatusCode(_0x1c904a,_0x280594){_0x280594=_0x280594||0xcc;return function(_0x4d4d32){if(_0x4d4d32){return _0x1c904a[_0x68f0('0x18')](_0x280594);}return _0x1c904a[_0x68f0('0x19')](_0x280594)[_0x68f0('0x1a')]();};}function respondWithResult(_0x5db1ff,_0xc879b9){_0xc879b9=_0xc879b9||0xc8;return function(_0x5d98d0){if(_0x5d98d0){return _0x5db1ff[_0x68f0('0x19')](_0xc879b9)[_0x68f0('0x1b')](_0x5d98d0);}};}function respondWithFilteredResult(_0x2e4c70,_0x1a6fde){return function(_0x72201f){if(_0x72201f){var _0x64404f=typeof _0x1a6fde[_0x68f0('0x1c')]===_0x68f0('0x1d')&&typeof _0x1a6fde[_0x68f0('0x1e')]==='undefined';var _0x39f95a=_0x72201f[_0x68f0('0x1f')];var _0x49d139=_0x64404f?0x0:_0x1a6fde['offset'];var _0x7d58e1=_0x64404f?_0x72201f[_0x68f0('0x1f')]:_0x1a6fde[_0x68f0('0x1c')]+_0x1a6fde[_0x68f0('0x1e')];var _0x3aa092;if(_0x7d58e1>=_0x39f95a){_0x7d58e1=_0x39f95a;_0x3aa092=0xc8;}else{_0x3aa092=0xce;}_0x2e4c70[_0x68f0('0x19')](_0x3aa092);return _0x2e4c70[_0x68f0('0x20')](_0x68f0('0x21'),_0x49d139+'-'+_0x7d58e1+'/'+_0x39f95a)[_0x68f0('0x1b')](_0x72201f);}return null;};}function patchUpdates(_0x5b9363){return function(_0x17290b){try{jsonpatch['apply'](_0x17290b,_0x5b9363,!![]);}catch(_0x1d439c){return BPromise[_0x68f0('0x22')](_0x1d439c);}return _0x17290b[_0x68f0('0x23')]();};}function saveUpdates(_0x2ff378,_0x228fe3){return function(_0x222e7c){if(_0x222e7c){return _0x222e7c['update'](_0x2ff378)['then'](function(_0x4dde44){return _0x4dde44;});}return null;};}function removeEntity(_0x4400f9,_0x8abfce){return function(_0x3d6c59){if(_0x3d6c59){return _0x3d6c59[_0x68f0('0x24')]()['then'](function(){_0x4400f9[_0x68f0('0x19')](0xcc)[_0x68f0('0x1a')]();});}};}function handleEntityNotFound(_0x4b7ad6,_0x24bb42){return function(_0x894ee6){if(!_0x894ee6){_0x4b7ad6[_0x68f0('0x18')](0x194);}return _0x894ee6;};}function handleError(_0x4c6880,_0x36fab7){_0x36fab7=_0x36fab7||0x1f4;return function(_0x3bc0fe){logger['error'](_0x3bc0fe[_0x68f0('0x25')]);if(_0x3bc0fe[_0x68f0('0x26')]){delete _0x3bc0fe[_0x68f0('0x26')];}_0x4c6880[_0x68f0('0x19')](_0x36fab7)[_0x68f0('0x27')](_0x3bc0fe);};}exports[_0x68f0('0x28')]=function(_0x1324e8,_0x1920a4){var _0x455806={},_0x46c9ba={},_0x54457d={'count':0x0,'rows':[]};var _0x571a22=_[_0x68f0('0x29')](db[_0x68f0('0x2a')][_0x68f0('0x2b')],function(_0x3e53ca){return{'name':_0x3e53ca[_0x68f0('0x2c')],'type':_0x3e53ca[_0x68f0('0x2d')]['key']};});_0x46c9ba[_0x68f0('0x2e')]=_[_0x68f0('0x29')](_0x571a22,_0x68f0('0x26'));_0x46c9ba[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x1324e8[_0x68f0('0x2f')]);_0x46c9ba[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x46c9ba[_0x68f0('0x2e')],_0x46c9ba[_0x68f0('0x2f')]);_0x455806['attributes']=_[_0x68f0('0x32')](_0x46c9ba[_0x68f0('0x2e')],qs[_0x68f0('0x33')](_0x1324e8['query'][_0x68f0('0x33')]));_0x455806['attributes']=_0x455806[_0x68f0('0x34')][_0x68f0('0x35')]?_0x455806[_0x68f0('0x34')]:_0x46c9ba[_0x68f0('0x2e')];if(!_0x1324e8[_0x68f0('0x2f')][_0x68f0('0x36')](_0x68f0('0x37'))){_0x455806[_0x68f0('0x1e')]=qs['limit'](_0x1324e8[_0x68f0('0x2f')][_0x68f0('0x1e')]);_0x455806[_0x68f0('0x1c')]=qs['offset'](_0x1324e8[_0x68f0('0x2f')]['offset']);}_0x455806[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x1324e8[_0x68f0('0x2f')]['sort']);_0x455806[_0x68f0('0x3a')]=qs['filters'](_[_0x68f0('0x3b')](_0x1324e8[_0x68f0('0x2f')],_0x46c9ba['filters']),_0x571a22);if(_0x1324e8[_0x68f0('0x2f')]['filter']){_0x455806['where']=_['merge'](_0x455806[_0x68f0('0x3a')],{'$or':_['map'](_0x571a22,function(_0x33eebc){if(_0x33eebc['type']!==_0x68f0('0x3c')){var _0x1e2beb={};_0x1e2beb[_0x33eebc[_0x68f0('0x26')]]={'$like':'%'+_0x1324e8['query'][_0x68f0('0x3d')]+'%'};return _0x1e2beb;}})});}_0x455806=_[_0x68f0('0x3e')]({},_0x455806,_0x1324e8[_0x68f0('0x3f')]);var _0xd45b05={'where':_0x455806[_0x68f0('0x3a')]};return db['Dynamics365Configuration']['count'](_0xd45b05)['then'](function(_0x3dcc15){_0x54457d['count']=_0x3dcc15;if(_0x1324e8['query']['includeAll']){_0x455806[_0x68f0('0x40')]=[{'all':!![]}];}return db[_0x68f0('0x2a')][_0x68f0('0x41')](_0x455806);})['then'](function(_0xfa8acb){_0x54457d[_0x68f0('0x42')]=_0xfa8acb;return _0x54457d;})['then'](respondWithFilteredResult(_0x1920a4,_0x455806))[_0x68f0('0x43')](handleError(_0x1920a4,null));};exports['show']=function(_0x4b476c,_0x572dc0){var _0x3b8040={'raw':![],'where':{'id':_0x4b476c['params']['id']}},_0x3b16b1={};_0x3b16b1[_0x68f0('0x2e')]=_[_0x68f0('0x30')](db[_0x68f0('0x2a')][_0x68f0('0x2b')]);_0x3b16b1['query']=_['keys'](_0x4b476c[_0x68f0('0x2f')]);_0x3b16b1[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x3b16b1['model'],_0x3b16b1[_0x68f0('0x2f')]);_0x3b8040[_0x68f0('0x34')]=_[_0x68f0('0x32')](_0x3b16b1['model'],qs[_0x68f0('0x33')](_0x4b476c[_0x68f0('0x2f')]['fields']));_0x3b8040[_0x68f0('0x34')]=_0x3b8040[_0x68f0('0x34')][_0x68f0('0x35')]?_0x3b8040['attributes']:_0x3b16b1[_0x68f0('0x2e')];if(_0x4b476c[_0x68f0('0x2f')][_0x68f0('0x44')]){_0x3b8040[_0x68f0('0x40')]=[{'all':!![]}];}_0x3b8040=_['merge']({},_0x3b8040,_0x4b476c[_0x68f0('0x3f')]);return db['Dynamics365Configuration'][_0x68f0('0x45')](_0x3b8040)['then'](handleEntityNotFound(_0x572dc0,null))['then'](respondWithResult(_0x572dc0,null))[_0x68f0('0x43')](handleError(_0x572dc0,null));};exports[_0x68f0('0x46')]=function(_0x383cfd,_0x1bf71c){return db[_0x68f0('0x2a')]['create'](_0x383cfd[_0x68f0('0x47')],{})[_0x68f0('0x48')](respondWithResult(_0x1bf71c,0xc9))['catch'](handleError(_0x1bf71c,null));};exports['update']=function(_0x11ddda,_0x22fbbf){if(_0x11ddda[_0x68f0('0x47')]['id']){delete _0x11ddda[_0x68f0('0x47')]['id'];}return db[_0x68f0('0x2a')][_0x68f0('0x45')]({'where':{'id':_0x11ddda[_0x68f0('0x49')]['id']}})[_0x68f0('0x48')](handleEntityNotFound(_0x22fbbf,null))[_0x68f0('0x48')](saveUpdates(_0x11ddda[_0x68f0('0x47')],null))[_0x68f0('0x48')](respondWithResult(_0x22fbbf,null))[_0x68f0('0x43')](handleError(_0x22fbbf,null));};exports[_0x68f0('0x24')]=function(_0xbe3c4f,_0x1f3413){return db['Dynamics365Configuration'][_0x68f0('0x45')]({'where':{'id':_0xbe3c4f[_0x68f0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f3413,null))[_0x68f0('0x48')](removeEntity(_0x1f3413,null))[_0x68f0('0x43')](handleError(_0x1f3413,null));};exports[_0x68f0('0x4a')]=function(_0x331b40,_0x288713,_0x5b2d59){var _0x587729={};var _0x2cc18f={};var _0x544cab;var _0x3e501f;return db[_0x68f0('0x2a')][_0x68f0('0x4b')]({'where':{'id':_0x331b40[_0x68f0('0x49')]['id']}})[_0x68f0('0x48')](handleEntityNotFound(_0x288713,null))[_0x68f0('0x48')](function(_0x344c96){if(_0x344c96){_0x544cab=_0x344c96;_0x2cc18f[_0x68f0('0x2e')]=_[_0x68f0('0x30')](db['Dynamics365Field'][_0x68f0('0x2b')]);_0x2cc18f[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x331b40[_0x68f0('0x2f')]);_0x2cc18f[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x2cc18f[_0x68f0('0x2e')],_0x2cc18f['query']);_0x587729[_0x68f0('0x34')]=_[_0x68f0('0x32')](_0x2cc18f[_0x68f0('0x2e')],qs[_0x68f0('0x33')](_0x331b40[_0x68f0('0x2f')][_0x68f0('0x33')]));_0x587729[_0x68f0('0x34')]=_0x587729[_0x68f0('0x34')][_0x68f0('0x35')]?_0x587729[_0x68f0('0x34')]:_0x2cc18f[_0x68f0('0x2e')];_0x587729[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x331b40[_0x68f0('0x2f')][_0x68f0('0x39')]);_0x587729[_0x68f0('0x3a')]=qs[_0x68f0('0x31')](_[_0x68f0('0x3b')](_0x331b40[_0x68f0('0x2f')],_0x2cc18f[_0x68f0('0x31')]));if(_0x331b40[_0x68f0('0x2f')][_0x68f0('0x3d')]){_0x587729[_0x68f0('0x3a')]=_['merge'](_0x587729[_0x68f0('0x3a')],{'$or':_[_0x68f0('0x29')](_0x587729[_0x68f0('0x34')],function(_0x49c88c){var _0x4c5b36={};_0x4c5b36[_0x49c88c]={'$like':'%'+_0x331b40[_0x68f0('0x2f')][_0x68f0('0x3d')]+'%'};return _0x4c5b36;})});}_0x587729=_[_0x68f0('0x3e')]({},_0x587729,_0x331b40[_0x68f0('0x3f')]);return _0x544cab[_0x68f0('0x4a')](_0x587729);}})[_0x68f0('0x48')](function(_0x3e44ac){if(_0x3e44ac){_0x3e501f=_0x3e44ac[_0x68f0('0x35')];if(!_0x331b40[_0x68f0('0x2f')][_0x68f0('0x36')](_0x68f0('0x37'))){_0x587729['limit']=qs[_0x68f0('0x1e')](_0x331b40['query'][_0x68f0('0x1e')]);_0x587729[_0x68f0('0x1c')]=qs['offset'](_0x331b40[_0x68f0('0x2f')][_0x68f0('0x1c')]);}return _0x544cab[_0x68f0('0x4a')](_0x587729);}})[_0x68f0('0x48')](function(_0x1c1554){if(_0x1c1554){return _0x1c1554?{'count':_0x3e501f,'rows':_0x1c1554}:null;}})['then'](respondWithResult(_0x288713,null))[_0x68f0('0x43')](handleError(_0x288713,null));};exports[_0x68f0('0x4c')]=function(_0x2383b7,_0x8a663f,_0x552f52){var _0x161f09={};var _0x2c7d65={};var _0x2bfe06;var _0x5320a3;return db[_0x68f0('0x2a')]['findOne']({'where':{'id':_0x2383b7[_0x68f0('0x49')]['id']}})[_0x68f0('0x48')](handleEntityNotFound(_0x8a663f,null))['then'](function(_0x4a2af3){if(_0x4a2af3){_0x2bfe06=_0x4a2af3;_0x2c7d65[_0x68f0('0x2e')]=_[_0x68f0('0x30')](db[_0x68f0('0x4d')][_0x68f0('0x2b')]);_0x2c7d65[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x2383b7['query']);_0x2c7d65[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x2c7d65[_0x68f0('0x2e')],_0x2c7d65[_0x68f0('0x2f')]);_0x161f09[_0x68f0('0x34')]=_['intersection'](_0x2c7d65[_0x68f0('0x2e')],qs['fields'](_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x33')]));_0x161f09[_0x68f0('0x34')]=_0x161f09[_0x68f0('0x34')]['length']?_0x161f09[_0x68f0('0x34')]:_0x2c7d65[_0x68f0('0x2e')];_0x161f09[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x2383b7['query'][_0x68f0('0x39')]);_0x161f09['where']=qs[_0x68f0('0x31')](_['pick'](_0x2383b7['query'],_0x2c7d65[_0x68f0('0x31')]));if(_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x3d')]){_0x161f09[_0x68f0('0x3a')]=_[_0x68f0('0x3e')](_0x161f09[_0x68f0('0x3a')],{'$or':_[_0x68f0('0x29')](_0x161f09[_0x68f0('0x34')],function(_0x2fb91b){var _0x2c1cb3={};_0x2c1cb3[_0x2fb91b]={'$like':'%'+_0x2383b7['query']['filter']+'%'};return _0x2c1cb3;})});}_0x161f09=_['merge']({},_0x161f09,_0x2383b7[_0x68f0('0x3f')]);return _0x2bfe06[_0x68f0('0x4c')](_0x161f09);}})[_0x68f0('0x48')](function(_0x19db3c){if(_0x19db3c){_0x5320a3=_0x19db3c[_0x68f0('0x35')];if(!_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x36')](_0x68f0('0x37'))){_0x161f09[_0x68f0('0x1e')]=qs['limit'](_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x1e')]);_0x161f09[_0x68f0('0x1c')]=qs[_0x68f0('0x1c')](_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x1c')]);}return _0x2bfe06[_0x68f0('0x4c')](_0x161f09);}})[_0x68f0('0x48')](function(_0x1055d2){if(_0x1055d2){return _0x1055d2?{'count':_0x5320a3,'rows':_0x1055d2}:null;}})[_0x68f0('0x48')](respondWithResult(_0x8a663f,null))[_0x68f0('0x43')](handleError(_0x8a663f,null));};exports['getDescriptions']=function(_0x32d8c3,_0x144d64,_0xa07616){var _0x2a7229={};var _0x354df4={};var _0x23ef61;var _0x3c85d8;return db['Dynamics365Configuration'][_0x68f0('0x4b')]({'where':{'id':_0x32d8c3['params']['id']}})['then'](handleEntityNotFound(_0x144d64,null))[_0x68f0('0x48')](function(_0xda9dae){if(_0xda9dae){_0x23ef61=_0xda9dae;_0x354df4['model']=_[_0x68f0('0x30')](db[_0x68f0('0x4d')][_0x68f0('0x2b')]);_0x354df4[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x32d8c3[_0x68f0('0x2f')]);_0x354df4[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x354df4[_0x68f0('0x2e')],_0x354df4[_0x68f0('0x2f')]);_0x2a7229[_0x68f0('0x34')]=_[_0x68f0('0x32')](_0x354df4[_0x68f0('0x2e')],qs[_0x68f0('0x33')](_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x33')]));_0x2a7229[_0x68f0('0x34')]=_0x2a7229[_0x68f0('0x34')][_0x68f0('0x35')]?_0x2a7229[_0x68f0('0x34')]:_0x354df4[_0x68f0('0x2e')];_0x2a7229[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x39')]);_0x2a7229[_0x68f0('0x3a')]=qs[_0x68f0('0x31')](_[_0x68f0('0x3b')](_0x32d8c3[_0x68f0('0x2f')],_0x354df4[_0x68f0('0x31')]));if(_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x3d')]){_0x2a7229[_0x68f0('0x3a')]=_[_0x68f0('0x3e')](_0x2a7229['where'],{'$or':_[_0x68f0('0x29')](_0x2a7229[_0x68f0('0x34')],function(_0x324084){var _0x431449={};_0x431449[_0x324084]={'$like':'%'+_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x3d')]+'%'};return _0x431449;})});}_0x2a7229=_['merge']({},_0x2a7229,_0x32d8c3['options']);return _0x23ef61[_0x68f0('0x4e')](_0x2a7229);}})['then'](function(_0x5e9f7f){if(_0x5e9f7f){_0x3c85d8=_0x5e9f7f[_0x68f0('0x35')];if(!_0x32d8c3[_0x68f0('0x2f')]['hasOwnProperty'](_0x68f0('0x37'))){_0x2a7229[_0x68f0('0x1e')]=qs[_0x68f0('0x1e')](_0x32d8c3[_0x68f0('0x2f')]['limit']);_0x2a7229[_0x68f0('0x1c')]=qs[_0x68f0('0x1c')](_0x32d8c3['query'][_0x68f0('0x1c')]);}return _0x23ef61[_0x68f0('0x4e')](_0x2a7229);}})['then'](function(_0x40d0d6){if(_0x40d0d6){return _0x40d0d6?{'count':_0x3c85d8,'rows':_0x40d0d6}:null;}})['then'](respondWithResult(_0x144d64,null))[_0x68f0('0x43')](handleError(_0x144d64,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5c12b52..4027692 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 _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x2b100f,_0x237749){var _0x38edf2=function(_0x7702b){while(--_0x7702b){_0x2b100f['push'](_0x2b100f['shift']());}};_0x38edf2(++_0x237749);}(_0xf109,0xce));var _0x9f10=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xf109[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0x008c,0x188));var _0xc008=function(_0x1de8cc,_0x3e3f90){_0x1de8cc=_0x1de8cc-0x0;var _0x6f59fa=_0x008c[_0x1de8cc];return _0x6f59fa;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'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 ab88765..cee94bc 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 _0x99ca=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x1e1f4a,_0x15d8c7){var _0x2221c8=function(_0xd9e618){while(--_0xd9e618){_0x1e1f4a['push'](_0x1e1f4a['shift']());}};_0x2221c8(++_0x15d8c7);}(_0x99ca,0x80));var _0xa99c=function(_0x170ffb,_0x507dfe){_0x170ffb=_0x170ffb-0x0;var _0x13916d=_0x99ca[_0x170ffb];return _0x13916d;};'use strict';var _=require(_0xa99c('0x0'));var util=require(_0xa99c('0x1'));var moment=require(_0xa99c('0x2'));var BPromise=require(_0xa99c('0x3'));var rs=require(_0xa99c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa99c('0x5'))['db'];var utils=require(_0xa99c('0x6'));var logger=require(_0xa99c('0x7'))(_0xa99c('0x8'));var config=require(_0xa99c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f04da,_0x50f3c0,_0x56e0e4){return new BPromise(function(_0x496d34,_0x2dcce3){return client[_0xa99c('0xa')](_0x3f04da,_0x56e0e4)[_0xa99c('0xb')](function(_0x5d95bd){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x50f3c0,'request\x20sent');logger['debug'](_0xa99c('0xc'),_0x50f3c0,'request\x20sent',JSON[_0xa99c('0xd')](_0x5d95bd));if(_0x5d95bd[_0xa99c('0xe')]){if(_0x5d95bd[_0xa99c('0xe')][_0xa99c('0xf')]===0x1f4){logger[_0xa99c('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x50f3c0,_0x5d95bd['error'][_0xa99c('0x10')]);return _0x2dcce3(_0x5d95bd[_0xa99c('0xe')]['message']);}logger[_0xa99c('0xe')](_0xa99c('0x11'),_0x50f3c0,_0x5d95bd[_0xa99c('0xe')][_0xa99c('0x10')]);return _0x496d34(_0x5d95bd[_0xa99c('0xe')][_0xa99c('0x10')]);}else{logger[_0xa99c('0x12')](_0xa99c('0x11'),_0x50f3c0,_0xa99c('0x13'));_0x496d34(_0x5d95bd[_0xa99c('0x14')][_0xa99c('0x10')]);}})[_0xa99c('0x15')](function(_0x414641){logger[_0xa99c('0xe')](_0xa99c('0x11'),_0x50f3c0,_0x414641);_0x2dcce3(_0x414641);});});} \ No newline at end of file +var _0x1f3f=['error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x1f3f,0x165));var _0xf1f3=function(_0x2508fd,_0xa8375b){_0x2508fd=_0x2508fd-0x0;var _0x3ce952=_0x1f3f[_0x2508fd];return _0x3ce952;};'use strict';var _=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var moment=require(_0xf1f3('0x2'));var BPromise=require(_0xf1f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1f3('0x4'))['db'];var utils=require(_0xf1f3('0x5'));var logger=require(_0xf1f3('0x6'))(_0xf1f3('0x7'));var config=require(_0xf1f3('0x8'));var jayson=require(_0xf1f3('0x9'));var client=jayson['client'][_0xf1f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f3ad,_0x3a1796,_0x856d5a){return new BPromise(function(_0x2c222d,_0x7a63d2){return client[_0xf1f3('0xb')](_0x25f3ad,_0x856d5a)[_0xf1f3('0xc')](function(_0x595b57){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3a1796,_0xf1f3('0xd'));logger[_0xf1f3('0xe')](_0xf1f3('0xf'),_0x3a1796,_0xf1f3('0xd'),JSON[_0xf1f3('0x10')](_0x595b57));if(_0x595b57[_0xf1f3('0x11')]){if(_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x12')]===0x1f4){logger['error'](_0xf1f3('0x13'),_0x3a1796,_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x14')]);return _0x7a63d2(_0x595b57[_0xf1f3('0x11')]['message']);}logger[_0xf1f3('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3a1796,_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x14')]);return _0x2c222d(_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x14')]);}else{logger['info'](_0xf1f3('0x13'),_0x3a1796,_0xf1f3('0xd'));_0x2c222d(_0x595b57['result'][_0xf1f3('0x14')]);}})[_0xf1f3('0x15')](function(_0x238215){logger['error'](_0xf1f3('0x13'),_0x3a1796,_0x238215);_0x7a63d2(_0x238215);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f2e8c84..bd9fc5b 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 _0x720f=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x45573f,_0x4bd4db){var _0xfae3b8=function(_0x55a6d3){while(--_0x55a6d3){_0x45573f['push'](_0x45573f['shift']());}};_0xfae3b8(++_0x4bd4db);}(_0x720f,0x79));var _0xf720=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x720f[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var path=require(_0xf720('0x2'));var timeout=require(_0xf720('0x3'));var express=require('express');var router=express[_0xf720('0x4')]();var fs_extra=require(_0xf720('0x5'));var auth=require(_0xf720('0x6'));var interaction=require(_0xf720('0x7'));var config=require('../../config/environment');var controller=require(_0xf720('0x8'));router[_0xf720('0x9')]('/',auth[_0xf720('0xa')](),controller[_0xf720('0xb')]);router[_0xf720('0x9')](_0xf720('0xc'),auth[_0xf720('0xa')](),controller[_0xf720('0xd')]);router[_0xf720('0xe')]('/',auth[_0xf720('0xa')](),controller[_0xf720('0xf')]);router[_0xf720('0x10')](_0xf720('0xc'),auth[_0xf720('0xa')](),controller['update']);router[_0xf720('0x11')]('/:id',auth[_0xf720('0xa')](),controller[_0xf720('0x12')]);module[_0xf720('0x13')]=router; \ No newline at end of file +var _0xaec4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x361ddd,_0x503739){var _0x3a92da=function(_0x439b0e){while(--_0x439b0e){_0x361ddd['push'](_0x361ddd['shift']());}};_0x3a92da(++_0x503739);}(_0xaec4,0x1c4));var _0x4aec=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xaec4[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x4aec('0x0'));var util=require('util');var path=require(_0x4aec('0x1'));var timeout=require(_0x4aec('0x2'));var express=require(_0x4aec('0x3'));var router=express[_0x4aec('0x4')]();var fs_extra=require(_0x4aec('0x5'));var auth=require(_0x4aec('0x6'));var interaction=require(_0x4aec('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x4aec('0x8')]('/',auth['isAuthenticated'](),controller[_0x4aec('0x9')]);router[_0x4aec('0x8')](_0x4aec('0xa'),auth[_0x4aec('0xb')](),controller[_0x4aec('0xc')]);router[_0x4aec('0xd')]('/',auth[_0x4aec('0xb')](),controller[_0x4aec('0xe')]);router[_0x4aec('0xf')]('/:id',auth[_0x4aec('0xb')](),controller[_0x4aec('0x10')]);router['delete'](_0x4aec('0xa'),auth[_0x4aec('0xb')](),controller[_0x4aec('0x11')]);module[_0x4aec('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 510b4c9..925e259 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 _0x64bd=['keyValue','picklist','STRING','ENUM','BOOLEAN','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64bd,0x1e5));var _0xd64b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x64bd[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xd64b('0x0'),_0xd64b('0x1'),_0xd64b('0x2'),_0xd64b('0x3'),_0xd64b('0x4')),'defaultValue':_0xd64b('0x0')},'content':{'type':Sequelize[_0xd64b('0x5')]},'key':{'type':Sequelize[_0xd64b('0x5')]},'keyType':{'type':Sequelize[_0xd64b('0x6')](_0xd64b('0x0'),_0xd64b('0x1'),_0xd64b('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd64b('0x5')]},'nameField':{'type':Sequelize[_0xd64b('0x5')]},'customField':{'type':Sequelize[_0xd64b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd64b('0x5')]}}; \ No newline at end of file +var _0xe097=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3c136c,_0x45bd73){var _0x10b4ab=function(_0x3530e7){while(--_0x3530e7){_0x3c136c['push'](_0x3c136c['shift']());}};_0x10b4ab(++_0x45bd73);}(_0xe097,0xd8));var _0x7e09=function(_0xd76857,_0x137b6b){_0xd76857=_0xd76857-0x0;var _0x1fd9b1=_0xe097[_0xd76857];return _0x1fd9b1;};'use strict';var Sequelize=require(_0x7e09('0x0'));module[_0x7e09('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7e09('0x2'),_0x7e09('0x3'),_0x7e09('0x4'),_0x7e09('0x5'),_0x7e09('0x6')),'defaultValue':_0x7e09('0x2')},'content':{'type':Sequelize[_0x7e09('0x7')]},'key':{'type':Sequelize[_0x7e09('0x7')]},'keyType':{'type':Sequelize[_0x7e09('0x8')](_0x7e09('0x2'),_0x7e09('0x3'),_0x7e09('0x4'))},'keyContent':{'type':Sequelize[_0x7e09('0x7')]},'idField':{'type':Sequelize[_0x7e09('0x7')]},'nameField':{'type':Sequelize[_0x7e09('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'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 39b160a..007c259 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 _0x8801=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','show','params','find','create','body','catch','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x37bab4,_0x1c72b7){var _0x3e60cb=function(_0x3b2116){while(--_0x3b2116){_0x37bab4['push'](_0x37bab4['shift']());}};_0x3e60cb(++_0x1c72b7);}(_0x8801,0x167));var _0x1880=function(_0x3ce09e,_0x1b5524){_0x3ce09e=_0x3ce09e-0x0;var _0x41fe13=_0x8801[_0x3ce09e];return _0x41fe13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1880('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1880('0x1'));var rp=require(_0x1880('0x2'));var moment=require('moment');var BPromise=require(_0x1880('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1880('0x4'));var csv=require(_0x1880('0x5'));var ejs=require(_0x1880('0x6'));var fs=require('fs');var fs_extra=require(_0x1880('0x7'));var _=require('lodash');var squel=require(_0x1880('0x8'));var crypto=require(_0x1880('0x9'));var jsforce=require(_0x1880('0xa'));var deskjs=require(_0x1880('0xb'));var toCsv=require(_0x1880('0x5'));var querystring=require(_0x1880('0xc'));var Papa=require(_0x1880('0xd'));var Redis=require(_0x1880('0xe'));var authService=require(_0x1880('0xf'));var qs=require(_0x1880('0x10'));var as=require(_0x1880('0x11'));var hardwareService=require(_0x1880('0x12'));var logger=require(_0x1880('0x13'))(_0x1880('0x14'));var utils=require(_0x1880('0x15'));var config=require(_0x1880('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1880('0x17'))['db'];function respondWithStatusCode(_0x563a1f,_0x38acb5){_0x38acb5=_0x38acb5||0xcc;return function(_0x274ccc){if(_0x274ccc){return _0x563a1f[_0x1880('0x18')](_0x38acb5);}return _0x563a1f[_0x1880('0x19')](_0x38acb5)['end']();};}function respondWithResult(_0x367e3a,_0x40e437){_0x40e437=_0x40e437||0xc8;return function(_0x3200d9){if(_0x3200d9){return _0x367e3a[_0x1880('0x19')](_0x40e437)[_0x1880('0x1a')](_0x3200d9);}};}function respondWithFilteredResult(_0x10ec1a,_0x4d4f93){return function(_0x1a3e50){if(_0x1a3e50){var _0x34271b=typeof _0x4d4f93[_0x1880('0x1b')]===_0x1880('0x1c')&&typeof _0x4d4f93[_0x1880('0x1d')]==='undefined';var _0x354eb1=_0x1a3e50[_0x1880('0x1e')];var _0x3d9f75=_0x34271b?0x0:_0x4d4f93['offset'];var _0x5b4974=_0x34271b?_0x1a3e50[_0x1880('0x1e')]:_0x4d4f93[_0x1880('0x1b')]+_0x4d4f93['limit'];var _0x1b955d;if(_0x5b4974>=_0x354eb1){_0x5b4974=_0x354eb1;_0x1b955d=0xc8;}else{_0x1b955d=0xce;}_0x10ec1a[_0x1880('0x19')](_0x1b955d);return _0x10ec1a[_0x1880('0x1f')](_0x1880('0x20'),_0x3d9f75+'-'+_0x5b4974+'/'+_0x354eb1)[_0x1880('0x1a')](_0x1a3e50);}return null;};}function patchUpdates(_0x4a8806){return function(_0x40acd2){try{jsonpatch[_0x1880('0x21')](_0x40acd2,_0x4a8806,!![]);}catch(_0x2d3129){return BPromise[_0x1880('0x22')](_0x2d3129);}return _0x40acd2[_0x1880('0x23')]();};}function saveUpdates(_0x233c3b,_0x134e9a){return function(_0x110677){if(_0x110677){return _0x110677[_0x1880('0x24')](_0x233c3b)['then'](function(_0x594805){return _0x594805;});}return null;};}function removeEntity(_0xcb7978,_0x581be6){return function(_0x2d9963){if(_0x2d9963){return _0x2d9963[_0x1880('0x25')]()['then'](function(){_0xcb7978[_0x1880('0x19')](0xcc)[_0x1880('0x26')]();});}};}function handleEntityNotFound(_0x134d86,_0x12167d){return function(_0x4f3c4b){if(!_0x4f3c4b){_0x134d86[_0x1880('0x18')](0x194);}return _0x4f3c4b;};}function handleError(_0x2dea26,_0x22a6e7){_0x22a6e7=_0x22a6e7||0x1f4;return function(_0x11ccf6){logger[_0x1880('0x27')](_0x11ccf6[_0x1880('0x28')]);if(_0x11ccf6[_0x1880('0x29')]){delete _0x11ccf6['name'];}_0x2dea26[_0x1880('0x19')](_0x22a6e7)[_0x1880('0x2a')](_0x11ccf6);};}exports[_0x1880('0x2b')]=function(_0x34e3b2,_0xc3498a){var _0x47ff96={},_0x4f870f={},_0x415ccc={'count':0x0,'rows':[]};var _0x38288e=_[_0x1880('0x2c')](db[_0x1880('0x2d')][_0x1880('0x2e')],function(_0x68311d){return{'name':_0x68311d['fieldName'],'type':_0x68311d[_0x1880('0x2f')][_0x1880('0x30')]};});_0x4f870f[_0x1880('0x31')]=_['map'](_0x38288e,_0x1880('0x29'));_0x4f870f[_0x1880('0x32')]=_[_0x1880('0x33')](_0x34e3b2[_0x1880('0x32')]);_0x4f870f[_0x1880('0x34')]=_['intersection'](_0x4f870f[_0x1880('0x31')],_0x4f870f['query']);_0x47ff96[_0x1880('0x35')]=_[_0x1880('0x36')](_0x4f870f[_0x1880('0x31')],qs['fields'](_0x34e3b2[_0x1880('0x32')][_0x1880('0x37')]));_0x47ff96[_0x1880('0x35')]=_0x47ff96[_0x1880('0x35')]['length']?_0x47ff96[_0x1880('0x35')]:_0x4f870f[_0x1880('0x31')];if(!_0x34e3b2['query'][_0x1880('0x38')]('nolimit')){_0x47ff96[_0x1880('0x1d')]=qs[_0x1880('0x1d')](_0x34e3b2['query'][_0x1880('0x1d')]);_0x47ff96['offset']=qs[_0x1880('0x1b')](_0x34e3b2[_0x1880('0x32')][_0x1880('0x1b')]);}_0x47ff96[_0x1880('0x39')]=qs[_0x1880('0x3a')](_0x34e3b2[_0x1880('0x32')][_0x1880('0x3a')]);_0x47ff96[_0x1880('0x3b')]=qs[_0x1880('0x34')](_[_0x1880('0x3c')](_0x34e3b2[_0x1880('0x32')],_0x4f870f[_0x1880('0x34')]),_0x38288e);if(_0x34e3b2[_0x1880('0x32')][_0x1880('0x3d')]){_0x47ff96[_0x1880('0x3b')]=_[_0x1880('0x3e')](_0x47ff96[_0x1880('0x3b')],{'$or':_[_0x1880('0x2c')](_0x38288e,function(_0x1a687a){if(_0x1a687a[_0x1880('0x2f')]!==_0x1880('0x3f')){var _0x296c7c={};_0x296c7c[_0x1a687a[_0x1880('0x29')]]={'$like':'%'+_0x34e3b2[_0x1880('0x32')][_0x1880('0x3d')]+'%'};return _0x296c7c;}})});}_0x47ff96=_['merge']({},_0x47ff96,_0x34e3b2[_0x1880('0x40')]);var _0x5e0674={'where':_0x47ff96[_0x1880('0x3b')]};return db[_0x1880('0x2d')][_0x1880('0x1e')](_0x5e0674)['then'](function(_0x55f601){_0x415ccc[_0x1880('0x1e')]=_0x55f601;if(_0x34e3b2['query'][_0x1880('0x41')]){_0x47ff96[_0x1880('0x42')]=[{'all':!![]}];}return db[_0x1880('0x2d')][_0x1880('0x43')](_0x47ff96);})['then'](function(_0x544266){_0x415ccc['rows']=_0x544266;return _0x415ccc;})[_0x1880('0x44')](respondWithFilteredResult(_0xc3498a,_0x47ff96))['catch'](handleError(_0xc3498a,null));};exports[_0x1880('0x45')]=function(_0x32053e,_0x430942){var _0x9b40ee={'raw':!![],'where':{'id':_0x32053e[_0x1880('0x46')]['id']}},_0x17d187={};_0x17d187['model']=_['keys'](db[_0x1880('0x2d')][_0x1880('0x2e')]);_0x17d187[_0x1880('0x32')]=_[_0x1880('0x33')](_0x32053e[_0x1880('0x32')]);_0x17d187[_0x1880('0x34')]=_[_0x1880('0x36')](_0x17d187[_0x1880('0x31')],_0x17d187[_0x1880('0x32')]);_0x9b40ee[_0x1880('0x35')]=_[_0x1880('0x36')](_0x17d187[_0x1880('0x31')],qs[_0x1880('0x37')](_0x32053e[_0x1880('0x32')][_0x1880('0x37')]));_0x9b40ee[_0x1880('0x35')]=_0x9b40ee[_0x1880('0x35')]['length']?_0x9b40ee['attributes']:_0x17d187[_0x1880('0x31')];if(_0x32053e['query']['includeAll']){_0x9b40ee[_0x1880('0x42')]=[{'all':!![]}];}_0x9b40ee=_[_0x1880('0x3e')]({},_0x9b40ee,_0x32053e['options']);return db[_0x1880('0x2d')][_0x1880('0x47')](_0x9b40ee)['then'](handleEntityNotFound(_0x430942,null))['then'](respondWithResult(_0x430942,null))['catch'](handleError(_0x430942,null));};exports[_0x1880('0x48')]=function(_0x14e41d,_0x4af0b8){return db[_0x1880('0x2d')][_0x1880('0x48')](_0x14e41d[_0x1880('0x49')],{})[_0x1880('0x44')](respondWithResult(_0x4af0b8,0xc9))['catch'](handleError(_0x4af0b8,null));};exports[_0x1880('0x24')]=function(_0x270883,_0x2100f0){if(_0x270883['body']['id']){delete _0x270883[_0x1880('0x49')]['id'];}return db[_0x1880('0x2d')][_0x1880('0x47')]({'where':{'id':_0x270883['params']['id']}})[_0x1880('0x44')](handleEntityNotFound(_0x2100f0,null))[_0x1880('0x44')](saveUpdates(_0x270883[_0x1880('0x49')],null))[_0x1880('0x44')](respondWithResult(_0x2100f0,null))['catch'](handleError(_0x2100f0,null));};exports['destroy']=function(_0x5ddb77,_0x560ebd){return db[_0x1880('0x2d')][_0x1880('0x47')]({'where':{'id':_0x5ddb77['params']['id']}})['then'](handleEntityNotFound(_0x560ebd,null))[_0x1880('0x44')](removeEntity(_0x560ebd,null))[_0x1880('0x4a')](handleError(_0x560ebd,null));}; \ No newline at end of file +var _0x29d3=['key','model','keys','query','attributes','intersection','fields','length','order','filters','pick','filter','where','merge','options','rows','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','Dynamics365Field','fieldName','type'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0x29d3,0x1b0));var _0x329d=function(_0x3c8df0,_0x5500ea){_0x3c8df0=_0x3c8df0-0x0;var _0x55fb99=_0x29d3[_0x3c8df0];return _0x55fb99;};'use strict';var emlformat=require(_0x329d('0x0'));var rimraf=require(_0x329d('0x1'));var zipdir=require(_0x329d('0x2'));var jsonpatch=require(_0x329d('0x3'));var rp=require(_0x329d('0x4'));var moment=require(_0x329d('0x5'));var BPromise=require(_0x329d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x329d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x329d('0x8'));var _=require(_0x329d('0x9'));var squel=require('squel');var crypto=require(_0x329d('0xa'));var jsforce=require(_0x329d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x329d('0xc'));var querystring=require(_0x329d('0xd'));var Papa=require(_0x329d('0xe'));var Redis=require('ioredis');var authService=require(_0x329d('0xf'));var qs=require(_0x329d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x329d('0x11'));var logger=require(_0x329d('0x12'))(_0x329d('0x13'));var utils=require('../../config/utils');var config=require(_0x329d('0x14'));var licenseUtil=require(_0x329d('0x15'));var db=require(_0x329d('0x16'))['db'];function respondWithStatusCode(_0x29a570,_0x54d716){_0x54d716=_0x54d716||0xcc;return function(_0x2bf73f){if(_0x2bf73f){return _0x29a570[_0x329d('0x17')](_0x54d716);}return _0x29a570[_0x329d('0x18')](_0x54d716)[_0x329d('0x19')]();};}function respondWithResult(_0x1e696c,_0x597bb2){_0x597bb2=_0x597bb2||0xc8;return function(_0x56bd9b){if(_0x56bd9b){return _0x1e696c[_0x329d('0x18')](_0x597bb2)['json'](_0x56bd9b);}};}function respondWithFilteredResult(_0x1fa508,_0x1a7771){return function(_0x4a6ea0){if(_0x4a6ea0){var _0x4ed1a3=typeof _0x1a7771[_0x329d('0x1a')]===_0x329d('0x1b')&&typeof _0x1a7771[_0x329d('0x1c')]===_0x329d('0x1b');var _0x53a48d=_0x4a6ea0['count'];var _0x5925d1=_0x4ed1a3?0x0:_0x1a7771['offset'];var _0x5c627b=_0x4ed1a3?_0x4a6ea0[_0x329d('0x1d')]:_0x1a7771[_0x329d('0x1a')]+_0x1a7771['limit'];var _0x7730b0;if(_0x5c627b>=_0x53a48d){_0x5c627b=_0x53a48d;_0x7730b0=0xc8;}else{_0x7730b0=0xce;}_0x1fa508[_0x329d('0x18')](_0x7730b0);return _0x1fa508['set'](_0x329d('0x1e'),_0x5925d1+'-'+_0x5c627b+'/'+_0x53a48d)[_0x329d('0x1f')](_0x4a6ea0);}return null;};}function patchUpdates(_0x3be020){return function(_0x15cd03){try{jsonpatch['apply'](_0x15cd03,_0x3be020,!![]);}catch(_0x507ac3){return BPromise[_0x329d('0x20')](_0x507ac3);}return _0x15cd03[_0x329d('0x21')]();};}function saveUpdates(_0x4bee7a,_0x40898b){return function(_0xdcbf64){if(_0xdcbf64){return _0xdcbf64[_0x329d('0x22')](_0x4bee7a)[_0x329d('0x23')](function(_0x2e605d){return _0x2e605d;});}return null;};}function removeEntity(_0x289f6c,_0x5bb990){return function(_0x1c0e36){if(_0x1c0e36){return _0x1c0e36[_0x329d('0x24')]()[_0x329d('0x23')](function(){_0x289f6c['status'](0xcc)[_0x329d('0x19')]();});}};}function handleEntityNotFound(_0x3ee931,_0x421a44){return function(_0x1a01bb){if(!_0x1a01bb){_0x3ee931[_0x329d('0x17')](0x194);}return _0x1a01bb;};}function handleError(_0x7d7de,_0x3ad3a2){_0x3ad3a2=_0x3ad3a2||0x1f4;return function(_0x12477c){logger['error'](_0x12477c['stack']);if(_0x12477c['name']){delete _0x12477c[_0x329d('0x25')];}_0x7d7de['status'](_0x3ad3a2)[_0x329d('0x26')](_0x12477c);};}exports[_0x329d('0x27')]=function(_0x5eb44c,_0x89c1f9){var _0x186222={},_0x58b886={},_0x35e8ab={'count':0x0,'rows':[]};var _0x448d6c=_[_0x329d('0x28')](db[_0x329d('0x29')]['rawAttributes'],function(_0x36fb57){return{'name':_0x36fb57[_0x329d('0x2a')],'type':_0x36fb57[_0x329d('0x2b')][_0x329d('0x2c')]};});_0x58b886[_0x329d('0x2d')]=_[_0x329d('0x28')](_0x448d6c,_0x329d('0x25'));_0x58b886['query']=_[_0x329d('0x2e')](_0x5eb44c[_0x329d('0x2f')]);_0x58b886['filters']=_['intersection'](_0x58b886[_0x329d('0x2d')],_0x58b886[_0x329d('0x2f')]);_0x186222[_0x329d('0x30')]=_[_0x329d('0x31')](_0x58b886['model'],qs[_0x329d('0x32')](_0x5eb44c[_0x329d('0x2f')]['fields']));_0x186222[_0x329d('0x30')]=_0x186222[_0x329d('0x30')][_0x329d('0x33')]?_0x186222[_0x329d('0x30')]:_0x58b886[_0x329d('0x2d')];if(!_0x5eb44c['query']['hasOwnProperty']('nolimit')){_0x186222[_0x329d('0x1c')]=qs[_0x329d('0x1c')](_0x5eb44c[_0x329d('0x2f')][_0x329d('0x1c')]);_0x186222[_0x329d('0x1a')]=qs['offset'](_0x5eb44c['query']['offset']);}_0x186222[_0x329d('0x34')]=qs['sort'](_0x5eb44c[_0x329d('0x2f')]['sort']);_0x186222['where']=qs[_0x329d('0x35')](_[_0x329d('0x36')](_0x5eb44c[_0x329d('0x2f')],_0x58b886[_0x329d('0x35')]),_0x448d6c);if(_0x5eb44c[_0x329d('0x2f')][_0x329d('0x37')]){_0x186222[_0x329d('0x38')]=_['merge'](_0x186222['where'],{'$or':_['map'](_0x448d6c,function(_0x398cd8){if(_0x398cd8['type']!=='VIRTUAL'){var _0x57e2a7={};_0x57e2a7[_0x398cd8['name']]={'$like':'%'+_0x5eb44c[_0x329d('0x2f')][_0x329d('0x37')]+'%'};return _0x57e2a7;}})});}_0x186222=_[_0x329d('0x39')]({},_0x186222,_0x5eb44c[_0x329d('0x3a')]);var _0x1a5067={'where':_0x186222[_0x329d('0x38')]};return db[_0x329d('0x29')][_0x329d('0x1d')](_0x1a5067)[_0x329d('0x23')](function(_0xb76523){_0x35e8ab[_0x329d('0x1d')]=_0xb76523;if(_0x5eb44c[_0x329d('0x2f')]['includeAll']){_0x186222['include']=[{'all':!![]}];}return db[_0x329d('0x29')]['findAll'](_0x186222);})[_0x329d('0x23')](function(_0x12eaf3){_0x35e8ab[_0x329d('0x3b')]=_0x12eaf3;return _0x35e8ab;})['then'](respondWithFilteredResult(_0x89c1f9,_0x186222))[_0x329d('0x3c')](handleError(_0x89c1f9,null));};exports[_0x329d('0x3d')]=function(_0x2dff4f,_0x476999){var _0x18bd0b={'raw':!![],'where':{'id':_0x2dff4f[_0x329d('0x3e')]['id']}},_0x4f73e3={};_0x4f73e3[_0x329d('0x2d')]=_[_0x329d('0x2e')](db[_0x329d('0x29')]['rawAttributes']);_0x4f73e3[_0x329d('0x2f')]=_[_0x329d('0x2e')](_0x2dff4f[_0x329d('0x2f')]);_0x4f73e3['filters']=_[_0x329d('0x31')](_0x4f73e3[_0x329d('0x2d')],_0x4f73e3[_0x329d('0x2f')]);_0x18bd0b[_0x329d('0x30')]=_[_0x329d('0x31')](_0x4f73e3[_0x329d('0x2d')],qs[_0x329d('0x32')](_0x2dff4f[_0x329d('0x2f')][_0x329d('0x32')]));_0x18bd0b[_0x329d('0x30')]=_0x18bd0b['attributes']['length']?_0x18bd0b['attributes']:_0x4f73e3[_0x329d('0x2d')];if(_0x2dff4f[_0x329d('0x2f')][_0x329d('0x3f')]){_0x18bd0b[_0x329d('0x40')]=[{'all':!![]}];}_0x18bd0b=_['merge']({},_0x18bd0b,_0x2dff4f[_0x329d('0x3a')]);return db[_0x329d('0x29')]['find'](_0x18bd0b)[_0x329d('0x23')](handleEntityNotFound(_0x476999,null))[_0x329d('0x23')](respondWithResult(_0x476999,null))['catch'](handleError(_0x476999,null));};exports[_0x329d('0x41')]=function(_0x52f31b,_0x14f5b9){return db[_0x329d('0x29')]['create'](_0x52f31b[_0x329d('0x42')],{})[_0x329d('0x23')](respondWithResult(_0x14f5b9,0xc9))[_0x329d('0x3c')](handleError(_0x14f5b9,null));};exports['update']=function(_0x1f27aa,_0x1f035b){if(_0x1f27aa[_0x329d('0x42')]['id']){delete _0x1f27aa['body']['id'];}return db[_0x329d('0x29')][_0x329d('0x43')]({'where':{'id':_0x1f27aa[_0x329d('0x3e')]['id']}})[_0x329d('0x23')](handleEntityNotFound(_0x1f035b,null))[_0x329d('0x23')](saveUpdates(_0x1f27aa['body'],null))['then'](respondWithResult(_0x1f035b,null))[_0x329d('0x3c')](handleError(_0x1f035b,null));};exports[_0x329d('0x24')]=function(_0x461551,_0x56d19e){return db[_0x329d('0x29')][_0x329d('0x43')]({'where':{'id':_0x461551['params']['id']}})['then'](handleEntityNotFound(_0x56d19e,null))[_0x329d('0x23')](removeEntity(_0x56d19e,null))[_0x329d('0x3c')](handleError(_0x56d19e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a88797d..dd1c5d4 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 _0x3905=['int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x3905,0x92));var _0x5390=function(_0x241c5d,_0x3ed23f){_0x241c5d=_0x241c5d-0x0;var _0x77650b=_0x3905[_0x241c5d];return _0x77650b;};'use strict';var _=require(_0x5390('0x0'));var util=require(_0x5390('0x1'));var logger=require(_0x5390('0x2'))(_0x5390('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5390('0x4'));var rimraf=require('rimraf');var config=require(_0x5390('0x5'));var attributes=require(_0x5390('0x6'));module[_0x5390('0x7')]=function(_0x355ff3,_0x30896b){return _0x355ff3[_0x5390('0x8')](_0x5390('0x9'),attributes,{'tableName':_0x5390('0xa'),'paranoid':![],'indexes':[{'name':_0x5390('0xb'),'fields':[_0x5390('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf645=['int_dynamics365_fields','idField','util','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','define'];(function(_0x1ab9bb,_0x515e80){var _0x1ecc89=function(_0x927579){while(--_0x927579){_0x1ab9bb['push'](_0x1ab9bb['shift']());}};_0x1ecc89(++_0x515e80);}(_0xf645,0x66));var _0x5f64=function(_0x2ef789,_0x26a493){_0x2ef789=_0x2ef789-0x0;var _0xf29e80=_0xf645[_0x2ef789];return _0xf29e80;};'use strict';var _=require('lodash');var util=require(_0x5f64('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5f64('0x1'));var BPromise=require(_0x5f64('0x2'));var rp=require(_0x5f64('0x3'));var fs=require('fs');var path=require(_0x5f64('0x4'));var rimraf=require('rimraf');var config=require(_0x5f64('0x5'));var attributes=require(_0x5f64('0x6'));module['exports']=function(_0x29b1b5,_0x5c6ef5){return _0x29b1b5[_0x5f64('0x7')]('Dynamics365Field',attributes,{'tableName':_0x5f64('0x8'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5f64('0x9'),'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 011cdd5..a70d02f 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 _0xfe7e=['request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x49c23a,_0x235ee5){var _0x570617=function(_0x16811a){while(--_0x16811a){_0x49c23a['push'](_0x49c23a['shift']());}};_0x570617(++_0x235ee5);}(_0xfe7e,0x14e));var _0xefe7=function(_0x7bb0fc,_0x434510){_0x7bb0fc=_0x7bb0fc-0x0;var _0xffdad0=_0xfe7e[_0x7bb0fc];return _0xffdad0;};'use strict';var _=require(_0xefe7('0x0'));var util=require(_0xefe7('0x1'));var moment=require(_0xefe7('0x2'));var BPromise=require(_0xefe7('0x3'));var rs=require(_0xefe7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefe7('0x5'))['db'];var utils=require(_0xefe7('0x6'));var logger=require('../../config/logger')(_0xefe7('0x7'));var config=require(_0xefe7('0x8'));var jayson=require(_0xefe7('0x9'));var client=jayson[_0xefe7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba093,_0x36ac14,_0x1d52c0){return new BPromise(function(_0x303300,_0x50ba4b){return client[_0xefe7('0xb')](_0x4ba093,_0x1d52c0)[_0xefe7('0xc')](function(_0x4304e5){logger[_0xefe7('0xd')](_0xefe7('0xe'),_0x36ac14,_0xefe7('0xf'));logger[_0xefe7('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x36ac14,_0xefe7('0xf'),JSON[_0xefe7('0x11')](_0x4304e5));if(_0x4304e5['error']){if(_0x4304e5[_0xefe7('0x12')][_0xefe7('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x36ac14,_0x4304e5['error'][_0xefe7('0x14')]);return _0x50ba4b(_0x4304e5['error'][_0xefe7('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x36ac14,_0x4304e5['error'][_0xefe7('0x14')]);return _0x303300(_0x4304e5['error'][_0xefe7('0x14')]);}else{logger[_0xefe7('0xd')](_0xefe7('0xe'),_0x36ac14,_0xefe7('0xf'));_0x303300(_0x4304e5[_0xefe7('0x15')]['message']);}})[_0xefe7('0x16')](function(_0x45fff3){logger[_0xefe7('0x12')](_0xefe7('0xe'),_0x36ac14,_0x45fff3);_0x50ba4b(_0x45fff3);});});} \ No newline at end of file +var _0x056c=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x481c1b,_0x29e064){var _0x485123=function(_0x7bb91b){while(--_0x7bb91b){_0x481c1b['push'](_0x481c1b['shift']());}};_0x485123(++_0x29e064);}(_0x056c,0x1cf));var _0xc056=function(_0x42bae6,_0x37979e){_0x42bae6=_0x42bae6-0x0;var _0x436662=_0x056c[_0x42bae6];return _0x436662;};'use strict';var _=require(_0xc056('0x0'));var util=require(_0xc056('0x1'));var moment=require('moment');var BPromise=require(_0xc056('0x2'));var rs=require(_0xc056('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc056('0x4'))['db'];var utils=require(_0xc056('0x5'));var logger=require('../../config/logger')(_0xc056('0x6'));var config=require(_0xc056('0x7'));var jayson=require(_0xc056('0x8'));var client=jayson[_0xc056('0x9')][_0xc056('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475098,_0xfd8484,_0x17a1a3){return new BPromise(function(_0x18846e,_0x11d628){return client[_0xc056('0xb')](_0x475098,_0x17a1a3)[_0xc056('0xc')](function(_0x34cb95){logger['info'](_0xc056('0xd'),_0xfd8484,'request\x20sent');logger[_0xc056('0xe')](_0xc056('0xf'),_0xfd8484,_0xc056('0x10'),JSON['stringify'](_0x34cb95));if(_0x34cb95[_0xc056('0x11')]){if(_0x34cb95['error'][_0xc056('0x12')]===0x1f4){logger['error'](_0xc056('0xd'),_0xfd8484,_0x34cb95[_0xc056('0x11')][_0xc056('0x13')]);return _0x11d628(_0x34cb95[_0xc056('0x11')]['message']);}logger[_0xc056('0x11')](_0xc056('0xd'),_0xfd8484,_0x34cb95[_0xc056('0x11')][_0xc056('0x13')]);return _0x18846e(_0x34cb95[_0xc056('0x11')][_0xc056('0x13')]);}else{logger[_0xc056('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0xfd8484,_0xc056('0x10'));_0x18846e(_0x34cb95[_0xc056('0x15')]['message']);}})[_0xc056('0x16')](function(_0xbd08ea){logger[_0xc056('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0xfd8484,_0xbd08ea);_0x11d628(_0xbd08ea);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index cfaa99c..3c374e3 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 _0x3efd=['getFields','post','create','addConfiguration','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x18bb91,_0x424236){var _0x162767=function(_0x53d4c0){while(--_0x53d4c0){_0x18bb91['push'](_0x18bb91['shift']());}};_0x162767(++_0x424236);}(_0x3efd,0x151));var _0xd3ef=function(_0x1efa73,_0xd70811){_0x1efa73=_0x1efa73-0x0;var _0x56060e=_0x3efd[_0x1efa73];return _0x56060e;};'use strict';var multer=require('multer');var util=require(_0xd3ef('0x0'));var path=require(_0xd3ef('0x1'));var timeout=require(_0xd3ef('0x2'));var express=require(_0xd3ef('0x3'));var router=express[_0xd3ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd3ef('0x5'));var interaction=require(_0xd3ef('0x6'));var config=require('../../config/environment');var controller=require(_0xd3ef('0x7'));router[_0xd3ef('0x8')]('/',auth[_0xd3ef('0x9')](),controller[_0xd3ef('0xa')]);router[_0xd3ef('0x8')]('/:id',auth[_0xd3ef('0x9')](),controller[_0xd3ef('0xb')]);router['get'](_0xd3ef('0xc'),auth[_0xd3ef('0x9')](),controller[_0xd3ef('0xd')]);router[_0xd3ef('0x8')](_0xd3ef('0xe'),auth['isAuthenticated'](),controller[_0xd3ef('0xf')]);router[_0xd3ef('0x10')]('/',auth[_0xd3ef('0x9')](),controller[_0xd3ef('0x11')]);router[_0xd3ef('0x10')](_0xd3ef('0xc'),auth['isAuthenticated'](),controller[_0xd3ef('0x12')]);router['put']('/:id',auth[_0xd3ef('0x9')](),controller['update']);router['delete'](_0xd3ef('0x13'),auth[_0xd3ef('0x9')](),controller[_0xd3ef('0x14')]);module[_0xd3ef('0x15')]=router; \ No newline at end of file +var _0x62cf=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index'];(function(_0x1d3e30,_0x534a6d){var _0x3fcd34=function(_0x58aa3f){while(--_0x58aa3f){_0x1d3e30['push'](_0x1d3e30['shift']());}};_0x3fcd34(++_0x534a6d);}(_0x62cf,0x1da));var _0xf62c=function(_0x57ebb7,_0x27a907){_0x57ebb7=_0x57ebb7-0x0;var _0x19f361=_0x62cf[_0x57ebb7];return _0x19f361;};'use strict';var multer=require('multer');var util=require(_0xf62c('0x0'));var path=require('path');var timeout=require(_0xf62c('0x1'));var express=require(_0xf62c('0x2'));var router=express[_0xf62c('0x3')]();var fs_extra=require(_0xf62c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf62c('0x5'));var config=require(_0xf62c('0x6'));var controller=require(_0xf62c('0x7'));router[_0xf62c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf62c('0x9')]);router[_0xf62c('0x8')](_0xf62c('0xa'),auth[_0xf62c('0xb')](),controller[_0xf62c('0xc')]);router['get'](_0xf62c('0xd'),auth[_0xf62c('0xb')](),controller[_0xf62c('0xe')]);router[_0xf62c('0x8')](_0xf62c('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xf62c('0x10')]('/',auth[_0xf62c('0xb')](),controller[_0xf62c('0x11')]);router[_0xf62c('0x10')](_0xf62c('0xd'),auth[_0xf62c('0xb')](),controller['addConfiguration']);router[_0xf62c('0x12')](_0xf62c('0xa'),auth[_0xf62c('0xb')](),controller[_0xf62c('0x13')]);router[_0xf62c('0x14')](_0xf62c('0xa'),auth[_0xf62c('0xb')](),controller['destroy']);module[_0xf62c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2b52ea6..89a0340 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 _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0xd4ec0c,_0x2afcd2){var _0x580218=function(_0x3b1cd4){while(--_0x3b1cd4){_0xd4ec0c['push'](_0xd4ec0c['shift']());}};_0x580218(++_0x2afcd2);}(_0x32f4,0x154));var _0x432f=function(_0xbf74e7,_0x5d2082){_0xbf74e7=_0xbf74e7-0x0;var _0x21461d=_0x32f4[_0xbf74e7];return _0x21461d;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5204=['exports','STRING','username','sequelize'];(function(_0x141963,_0x35994c){var _0x1ab4d8=function(_0x4b9447){while(--_0x4b9447){_0x141963['push'](_0x141963['shift']());}};_0x1ab4d8(++_0x35994c);}(_0x5204,0xdf));var _0x4520=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0x5204[_0x25cd2c];return _0x1e364c;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('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 0b69f6c..62faa79 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 _0xdca3=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','getConfigurations','findOne','order','map','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','ticket_type','group','company','remove','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse'];(function(_0x44c122,_0x839b15){var _0x4d69f1=function(_0x42b725){while(--_0x42b725){_0x44c122['push'](_0x44c122['shift']());}};_0x4d69f1(++_0x839b15);}(_0xdca3,0x64));var _0x3dca=function(_0xc5e60a,_0x49d4a1){_0xc5e60a=_0xc5e60a-0x0;var _0x314a95=_0xdca3[_0xc5e60a];return _0x314a95;};'use strict';var emlformat=require(_0x3dca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dca('0x1'));var jsonpatch=require(_0x3dca('0x2'));var rp=require(_0x3dca('0x3'));var moment=require(_0x3dca('0x4'));var BPromise=require(_0x3dca('0x5'));var Mustache=require(_0x3dca('0x6'));var util=require(_0x3dca('0x7'));var path=require(_0x3dca('0x8'));var sox=require(_0x3dca('0x9'));var csv=require(_0x3dca('0xa'));var ejs=require(_0x3dca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3dca('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3dca('0xa'));var querystring=require(_0x3dca('0xe'));var Papa=require(_0x3dca('0xf'));var Redis=require(_0x3dca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3dca('0x11'));var as=require(_0x3dca('0x12'));var hardwareService=require(_0x3dca('0x13'));var logger=require(_0x3dca('0x14'))(_0x3dca('0x15'));var utils=require(_0x3dca('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3dca('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x24c6c9,_0x11f54e){_0x11f54e=_0x11f54e||0xcc;return function(_0x24fcab){if(_0x24fcab){return _0x24c6c9[_0x3dca('0x18')](_0x11f54e);}return _0x24c6c9[_0x3dca('0x19')](_0x11f54e)[_0x3dca('0x1a')]();};}function respondWithResult(_0xa4149a,_0xf1350d){_0xf1350d=_0xf1350d||0xc8;return function(_0x4783ba){if(_0x4783ba){return _0xa4149a[_0x3dca('0x19')](_0xf1350d)[_0x3dca('0x1b')](_0x4783ba);}};}function respondWithFilteredResult(_0x911042,_0x1b5906){return function(_0x5dc428){if(_0x5dc428){var _0x4d2439=typeof _0x1b5906[_0x3dca('0x1c')]===_0x3dca('0x1d')&&typeof _0x1b5906[_0x3dca('0x1e')]===_0x3dca('0x1d');var _0x37cf7f=_0x5dc428[_0x3dca('0x1f')];var _0x47b1e9=_0x4d2439?0x0:_0x1b5906[_0x3dca('0x1c')];var _0x3919bb=_0x4d2439?_0x5dc428[_0x3dca('0x1f')]:_0x1b5906[_0x3dca('0x1c')]+_0x1b5906['limit'];var _0x475554;if(_0x3919bb>=_0x37cf7f){_0x3919bb=_0x37cf7f;_0x475554=0xc8;}else{_0x475554=0xce;}_0x911042[_0x3dca('0x19')](_0x475554);return _0x911042[_0x3dca('0x20')]('Content-Range',_0x47b1e9+'-'+_0x3919bb+'/'+_0x37cf7f)['json'](_0x5dc428);}return null;};}function patchUpdates(_0x4399ba){return function(_0x545058){try{jsonpatch[_0x3dca('0x21')](_0x545058,_0x4399ba,!![]);}catch(_0x2c6cec){return BPromise['reject'](_0x2c6cec);}return _0x545058[_0x3dca('0x22')]();};}function saveUpdates(_0x592459,_0x5b0dee){return function(_0x66cd90){if(_0x66cd90){return _0x66cd90[_0x3dca('0x23')](_0x592459)[_0x3dca('0x24')](function(_0x25f8e7){return _0x25f8e7;});}return null;};}function removeEntity(_0x59be49,_0x18a452){return function(_0x40e1c0){if(_0x40e1c0){return _0x40e1c0[_0x3dca('0x25')]()['then'](function(){_0x59be49[_0x3dca('0x19')](0xcc)[_0x3dca('0x1a')]();});}};}function handleEntityNotFound(_0x4c2dd2,_0x26a21b){return function(_0x28b9b7){if(!_0x28b9b7){_0x4c2dd2[_0x3dca('0x18')](0x194);}return _0x28b9b7;};}function handleError(_0x2580f6,_0x3fd367){_0x3fd367=_0x3fd367||0x1f4;return function(_0x1b8b0d){logger[_0x3dca('0x26')](_0x1b8b0d[_0x3dca('0x27')]);if(_0x1b8b0d[_0x3dca('0x28')]){delete _0x1b8b0d[_0x3dca('0x28')];}_0x2580f6[_0x3dca('0x19')](_0x3fd367)[_0x3dca('0x29')](_0x1b8b0d);};}exports[_0x3dca('0x2a')]=function(_0x12560e,_0x3d13f9){var _0x377c6e={},_0x1fdb6a={},_0xb42cec={'count':0x0,'rows':[]};var _0xaacf43=_['map'](db[_0x3dca('0x2b')][_0x3dca('0x2c')],function(_0x424c41){return{'name':_0x424c41[_0x3dca('0x2d')],'type':_0x424c41[_0x3dca('0x2e')][_0x3dca('0x2f')]};});_0x1fdb6a[_0x3dca('0x30')]=_['map'](_0xaacf43,'name');_0x1fdb6a['query']=_[_0x3dca('0x31')](_0x12560e['query']);_0x1fdb6a[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x1fdb6a[_0x3dca('0x30')],_0x1fdb6a[_0x3dca('0x34')]);_0x377c6e[_0x3dca('0x35')]=_[_0x3dca('0x33')](_0x1fdb6a[_0x3dca('0x30')],qs[_0x3dca('0x36')](_0x12560e[_0x3dca('0x34')][_0x3dca('0x36')]));_0x377c6e[_0x3dca('0x35')]=_0x377c6e['attributes'][_0x3dca('0x37')]?_0x377c6e[_0x3dca('0x35')]:_0x1fdb6a[_0x3dca('0x30')];if(!_0x12560e[_0x3dca('0x34')]['hasOwnProperty'](_0x3dca('0x38'))){_0x377c6e['limit']=qs[_0x3dca('0x1e')](_0x12560e[_0x3dca('0x34')][_0x3dca('0x1e')]);_0x377c6e[_0x3dca('0x1c')]=qs[_0x3dca('0x1c')](_0x12560e[_0x3dca('0x34')][_0x3dca('0x1c')]);}_0x377c6e['order']=qs[_0x3dca('0x39')](_0x12560e[_0x3dca('0x34')][_0x3dca('0x39')]);_0x377c6e[_0x3dca('0x3a')]=qs[_0x3dca('0x32')](_[_0x3dca('0x3b')](_0x12560e['query'],_0x1fdb6a[_0x3dca('0x32')]),_0xaacf43);if(_0x12560e[_0x3dca('0x34')][_0x3dca('0x3c')]){_0x377c6e[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x377c6e[_0x3dca('0x3a')],{'$or':_['map'](_0xaacf43,function(_0x4270c5){if(_0x4270c5[_0x3dca('0x2e')]!==_0x3dca('0x3e')){var _0x329543={};_0x329543[_0x4270c5[_0x3dca('0x28')]]={'$like':'%'+_0x12560e[_0x3dca('0x34')][_0x3dca('0x3c')]+'%'};return _0x329543;}})});}_0x377c6e=_[_0x3dca('0x3d')]({},_0x377c6e,_0x12560e[_0x3dca('0x3f')]);var _0x3adf54={'where':_0x377c6e[_0x3dca('0x3a')]};return db[_0x3dca('0x2b')][_0x3dca('0x1f')](_0x3adf54)[_0x3dca('0x24')](function(_0xd02f75){_0xb42cec[_0x3dca('0x1f')]=_0xd02f75;if(_0x12560e[_0x3dca('0x34')]['includeAll']){_0x377c6e[_0x3dca('0x40')]=[{'all':!![]}];}return db[_0x3dca('0x2b')]['findAll'](_0x377c6e);})[_0x3dca('0x24')](function(_0x390dfc){_0xb42cec[_0x3dca('0x41')]=_0x390dfc;return _0xb42cec;})[_0x3dca('0x24')](respondWithFilteredResult(_0x3d13f9,_0x377c6e))[_0x3dca('0x42')](handleError(_0x3d13f9,null));};exports[_0x3dca('0x43')]=function(_0x280523,_0x1bda64){var _0x299567={'raw':![],'where':{'id':_0x280523['params']['id']}},_0x195cc3={};_0x195cc3[_0x3dca('0x30')]=_[_0x3dca('0x31')](db[_0x3dca('0x2b')][_0x3dca('0x2c')]);_0x195cc3[_0x3dca('0x34')]=_['keys'](_0x280523[_0x3dca('0x34')]);_0x195cc3['filters']=_['intersection'](_0x195cc3['model'],_0x195cc3['query']);_0x299567[_0x3dca('0x35')]=_[_0x3dca('0x33')](_0x195cc3[_0x3dca('0x30')],qs[_0x3dca('0x36')](_0x280523['query'][_0x3dca('0x36')]));_0x299567[_0x3dca('0x35')]=_0x299567[_0x3dca('0x35')][_0x3dca('0x37')]?_0x299567['attributes']:_0x195cc3[_0x3dca('0x30')];if(_0x280523[_0x3dca('0x34')][_0x3dca('0x44')]){_0x299567['include']=[{'all':!![]}];}_0x299567=_[_0x3dca('0x3d')]({},_0x299567,_0x280523[_0x3dca('0x3f')]);return db[_0x3dca('0x2b')][_0x3dca('0x45')](_0x299567)[_0x3dca('0x24')](handleEntityNotFound(_0x1bda64,null))[_0x3dca('0x24')](respondWithResult(_0x1bda64,null))[_0x3dca('0x42')](handleError(_0x1bda64,null));};exports['create']=function(_0x54a034,_0x4bd8a8){return db['FreshdeskAccount'][_0x3dca('0x46')](_0x54a034[_0x3dca('0x47')],{})[_0x3dca('0x24')](respondWithResult(_0x4bd8a8,0xc9))[_0x3dca('0x42')](handleError(_0x4bd8a8,null));};exports[_0x3dca('0x23')]=function(_0x5af8cd,_0x31743d){if(_0x5af8cd[_0x3dca('0x47')]['id']){delete _0x5af8cd[_0x3dca('0x47')]['id'];}return db[_0x3dca('0x2b')][_0x3dca('0x45')]({'where':{'id':_0x5af8cd[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x31743d,null))[_0x3dca('0x24')](saveUpdates(_0x5af8cd[_0x3dca('0x47')],null))[_0x3dca('0x24')](respondWithResult(_0x31743d,null))['catch'](handleError(_0x31743d,null));};exports[_0x3dca('0x25')]=function(_0x26052f,_0x1c1ef9){return db[_0x3dca('0x2b')][_0x3dca('0x45')]({'where':{'id':_0x26052f[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x1c1ef9,null))[_0x3dca('0x24')](removeEntity(_0x1c1ef9,null))[_0x3dca('0x42')](handleError(_0x1c1ef9,null));};exports[_0x3dca('0x49')]=function(_0x4a85ca,_0x1dae0c,_0x3aec22){var _0x422574={};var _0x226804={};var _0x53955a;var _0x24d58f;return db['FreshdeskAccount'][_0x3dca('0x4a')]({'where':{'id':_0x4a85ca[_0x3dca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1dae0c,null))[_0x3dca('0x24')](function(_0x32f3f1){if(_0x32f3f1){_0x53955a=_0x32f3f1;_0x226804['model']=_['keys'](db['FreshdeskConfiguration'][_0x3dca('0x2c')]);_0x226804[_0x3dca('0x34')]=_[_0x3dca('0x31')](_0x4a85ca[_0x3dca('0x34')]);_0x226804[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x226804[_0x3dca('0x30')],_0x226804[_0x3dca('0x34')]);_0x422574['attributes']=_[_0x3dca('0x33')](_0x226804[_0x3dca('0x30')],qs[_0x3dca('0x36')](_0x4a85ca[_0x3dca('0x34')][_0x3dca('0x36')]));_0x422574[_0x3dca('0x35')]=_0x422574['attributes'][_0x3dca('0x37')]?_0x422574[_0x3dca('0x35')]:_0x226804[_0x3dca('0x30')];_0x422574[_0x3dca('0x4b')]=qs[_0x3dca('0x39')](_0x4a85ca[_0x3dca('0x34')][_0x3dca('0x39')]);_0x422574[_0x3dca('0x3a')]=qs[_0x3dca('0x32')](_[_0x3dca('0x3b')](_0x4a85ca[_0x3dca('0x34')],_0x226804[_0x3dca('0x32')]));if(_0x4a85ca[_0x3dca('0x34')]['filter']){_0x422574['where']=_['merge'](_0x422574[_0x3dca('0x3a')],{'$or':_[_0x3dca('0x4c')](_0x422574[_0x3dca('0x35')],function(_0x40df15){var _0x2d7ac4={};_0x2d7ac4[_0x40df15]={'$like':'%'+_0x4a85ca[_0x3dca('0x34')][_0x3dca('0x3c')]+'%'};return _0x2d7ac4;})});}_0x422574=_[_0x3dca('0x3d')]({},_0x422574,_0x4a85ca[_0x3dca('0x3f')]);return _0x53955a[_0x3dca('0x49')](_0x422574);}})['then'](function(_0x2063a4){if(_0x2063a4){_0x24d58f=_0x2063a4[_0x3dca('0x37')];if(!_0x4a85ca[_0x3dca('0x34')][_0x3dca('0x4d')](_0x3dca('0x38'))){_0x422574[_0x3dca('0x1e')]=qs[_0x3dca('0x1e')](_0x4a85ca[_0x3dca('0x34')][_0x3dca('0x1e')]);_0x422574[_0x3dca('0x1c')]=qs[_0x3dca('0x1c')](_0x4a85ca[_0x3dca('0x34')][_0x3dca('0x1c')]);}return _0x53955a[_0x3dca('0x49')](_0x422574);}})['then'](function(_0x40e717){if(_0x40e717){return _0x40e717?{'count':_0x24d58f,'rows':_0x40e717}:null;}})['then'](respondWithResult(_0x1dae0c,null))[_0x3dca('0x42')](handleError(_0x1dae0c,null));};exports['addConfiguration']=function(_0x565ece,_0x42450e,_0x53cec0){if(_0x565ece[_0x3dca('0x47')]['id']){delete _0x565ece[_0x3dca('0x47')]['id'];}return db[_0x3dca('0x2b')][_0x3dca('0x4a')]({'where':{'id':_0x565ece['params']['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x42450e,null))[_0x3dca('0x24')](function(_0x51c7ec){if(_0x51c7ec){_0x565ece['body']['AccountId']=_0x51c7ec['id'];_0x565ece[_0x3dca('0x47')][_0x3dca('0x4e')]=integrations[_0x3dca('0x4f')](_0x565ece[_0x3dca('0x47')][_0x3dca('0x50')],_0x565ece[_0x3dca('0x47')]['type']);_0x565ece[_0x3dca('0x47')][_0x3dca('0x51')]=integrations['getDescriptions'](_0x565ece['body'][_0x3dca('0x50')],_0x565ece[_0x3dca('0x47')][_0x3dca('0x2e')]);return db[_0x3dca('0x52')][_0x3dca('0x46')](_0x565ece[_0x3dca('0x47')],{'include':[{'model':db[_0x3dca('0x53')],'as':_0x3dca('0x4e')},{'model':db[_0x3dca('0x53')],'as':_0x3dca('0x51')}]});}return null;})[_0x3dca('0x24')](respondWithResult(_0x42450e,null))[_0x3dca('0x42')](handleError(_0x42450e,null));};exports[_0x3dca('0x54')]=function(_0x44f216,_0x5454e9,_0x17159a){var _0x1a814f='';return db[_0x3dca('0x2b')]['findOne']({'where':{'id':_0x44f216[_0x3dca('0x48')]['id']},'attributes':['id','remoteUri',_0x3dca('0x55')]})[_0x3dca('0x24')](handleEntityNotFound(_0x5454e9,null))[_0x3dca('0x24')](function(_0x474b65){if(_0x474b65){_0x1a814f=_0x474b65[_0x3dca('0x56')];var _0x58c2fc=_0x1a814f[_0x3dca('0x57')](-0x1);if(_0x58c2fc==='/'){_0x1a814f=_0x1a814f[_0x3dca('0x58')](0x0,_0x1a814f[_0x3dca('0x59')](_0x58c2fc));}return rp({'method':_0x3dca('0x5a'),'uri':util[_0x3dca('0x5b')]('%s/%s',_0x1a814f,_0x3dca('0x5c')),'headers':{'Authorization':util['format'](_0x3dca('0x5d'),new Buffer(util[_0x3dca('0x5b')](_0x3dca('0x5e'),_0x474b65[_0x3dca('0x55')]))[_0x3dca('0x5f')](_0x3dca('0x60')))},'json':!![]});}})[_0x3dca('0x24')](function(_0x53b938){if(_0x53b938){var _0x4ca4bd=[_0x3dca('0x61'),_0x3dca('0x62'),_0x3dca('0x63'),_0x3dca('0x64'),_0x3dca('0x19'),_0x3dca('0x65'),'group','source',_0x3dca('0x66'),_0x3dca('0x67'),_0x3dca('0x68')];_[_0x3dca('0x69')](_0x53b938,function(_0x39af0a){return _0x4ca4bd[_0x3dca('0x6a')](_0x39af0a['name'])||!_0x39af0a[_0x3dca('0x6b')]&&_0x39af0a['type']!=='custom_text'&&_0x39af0a[_0x3dca('0x2e')]!==_0x3dca('0x6c');});return{'count':_0x53b938[_0x3dca('0x37')],'rows':_[_0x3dca('0x4c')](_0x53b938,function(_0x2c66d9){return{'id':_0x2c66d9[_0x3dca('0x28')],'name':_0x2c66d9[_0x3dca('0x6d')],'custom':!_0x2c66d9['default'],'options':_0x2c66d9['choices']?_['map'](_0x2c66d9[_0x3dca('0x6e')],function(_0x3dbbab){return{'name':_[_0x3dca('0x6f')](_0x3dbbab),'value':_0x3dbbab};}):[]};})};}})[_0x3dca('0x24')](respondWithResult(_0x5454e9,null))[_0x3dca('0x42')](function(_0x3992bf){var _0xa5a2af=_0x44f216[_0x3dca('0x34')][_0x3dca('0x70')]?0x1f4:_0x3992bf[_0x3dca('0x71')]||0x1f4;logger[_0x3dca('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x3dca('0x54'),_0xa5a2af,JSON[_0x3dca('0x72')](_0x3992bf));delete _0x3992bf[_0x3dca('0x28')];if(_0xa5a2af===0x191){_0xa5a2af=0x190;}_0x5454e9[_0x3dca('0x19')](_0xa5a2af)[_0x3dca('0x29')](_0x44f216['query'][_0x3dca('0x70')]?{'message':_0x3dca('0x73'),'statusCode':_0x3992bf[_0x3dca('0x71')]}:_0x3992bf);});}; \ No newline at end of file +var _0x4a47=['model','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','getFields','apiKey','remoteUri','slice','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','keys','query','filters'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x4a47,0xb5));var _0x74a4=function(_0x50e001,_0x45aa55){_0x50e001=_0x50e001-0x0;var _0x3fe4a2=_0x4a47[_0x50e001];return _0x3fe4a2;};'use strict';var emlformat=require(_0x74a4('0x0'));var rimraf=require(_0x74a4('0x1'));var zipdir=require(_0x74a4('0x2'));var jsonpatch=require(_0x74a4('0x3'));var rp=require(_0x74a4('0x4'));var moment=require('moment');var BPromise=require(_0x74a4('0x5'));var Mustache=require('mustache');var util=require(_0x74a4('0x6'));var path=require(_0x74a4('0x7'));var sox=require('sox');var csv=require(_0x74a4('0x8'));var ejs=require(_0x74a4('0x9'));var fs=require('fs');var fs_extra=require(_0x74a4('0xa'));var _=require('lodash');var squel=require(_0x74a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x74a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x74a4('0x8'));var querystring=require(_0x74a4('0xd'));var Papa=require(_0x74a4('0xe'));var Redis=require(_0x74a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74a4('0x10'));var as=require(_0x74a4('0x11'));var hardwareService=require(_0x74a4('0x12'));var logger=require(_0x74a4('0x13'))('api');var utils=require(_0x74a4('0x14'));var config=require(_0x74a4('0x15'));var licenseUtil=require(_0x74a4('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43ffb8,_0x20eb02){_0x20eb02=_0x20eb02||0xcc;return function(_0x46d788){if(_0x46d788){return _0x43ffb8[_0x74a4('0x17')](_0x20eb02);}return _0x43ffb8[_0x74a4('0x18')](_0x20eb02)[_0x74a4('0x19')]();};}function respondWithResult(_0x391be4,_0x1d6f41){_0x1d6f41=_0x1d6f41||0xc8;return function(_0x39e2b4){if(_0x39e2b4){return _0x391be4[_0x74a4('0x18')](_0x1d6f41)[_0x74a4('0x1a')](_0x39e2b4);}};}function respondWithFilteredResult(_0x28c364,_0xc6796e){return function(_0x3c9fc9){if(_0x3c9fc9){var _0x3d9b8c=typeof _0xc6796e[_0x74a4('0x1b')]==='undefined'&&typeof _0xc6796e[_0x74a4('0x1c')]===_0x74a4('0x1d');var _0x327562=_0x3c9fc9[_0x74a4('0x1e')];var _0x55cf53=_0x3d9b8c?0x0:_0xc6796e[_0x74a4('0x1b')];var _0x105998=_0x3d9b8c?_0x3c9fc9[_0x74a4('0x1e')]:_0xc6796e[_0x74a4('0x1b')]+_0xc6796e['limit'];var _0x1eb6fb;if(_0x105998>=_0x327562){_0x105998=_0x327562;_0x1eb6fb=0xc8;}else{_0x1eb6fb=0xce;}_0x28c364[_0x74a4('0x18')](_0x1eb6fb);return _0x28c364['set'](_0x74a4('0x1f'),_0x55cf53+'-'+_0x105998+'/'+_0x327562)[_0x74a4('0x1a')](_0x3c9fc9);}return null;};}function patchUpdates(_0x5438d2){return function(_0x5d08d9){try{jsonpatch[_0x74a4('0x20')](_0x5d08d9,_0x5438d2,!![]);}catch(_0x3d6464){return BPromise[_0x74a4('0x21')](_0x3d6464);}return _0x5d08d9[_0x74a4('0x22')]();};}function saveUpdates(_0x484802,_0x4139af){return function(_0x506bac){if(_0x506bac){return _0x506bac['update'](_0x484802)[_0x74a4('0x23')](function(_0x404128){return _0x404128;});}return null;};}function removeEntity(_0x2eabd8,_0x5c3362){return function(_0x22f0fa){if(_0x22f0fa){return _0x22f0fa[_0x74a4('0x24')]()['then'](function(){_0x2eabd8[_0x74a4('0x18')](0xcc)[_0x74a4('0x19')]();});}};}function handleEntityNotFound(_0x4f4fc0,_0x12895a){return function(_0x3d9270){if(!_0x3d9270){_0x4f4fc0[_0x74a4('0x17')](0x194);}return _0x3d9270;};}function handleError(_0x54f5ed,_0x408140){_0x408140=_0x408140||0x1f4;return function(_0x23a74c){logger[_0x74a4('0x25')](_0x23a74c[_0x74a4('0x26')]);if(_0x23a74c[_0x74a4('0x27')]){delete _0x23a74c[_0x74a4('0x27')];}_0x54f5ed['status'](_0x408140)['send'](_0x23a74c);};}exports[_0x74a4('0x28')]=function(_0x4fe101,_0x1d252f){var _0x4a4a3d={},_0x446340={},_0x55f21e={'count':0x0,'rows':[]};var _0x5a1dad=_[_0x74a4('0x29')](db[_0x74a4('0x2a')][_0x74a4('0x2b')],function(_0x4b833d){return{'name':_0x4b833d['fieldName'],'type':_0x4b833d['type']['key']};});_0x446340['model']=_['map'](_0x5a1dad,_0x74a4('0x27'));_0x446340['query']=_[_0x74a4('0x2c')](_0x4fe101[_0x74a4('0x2d')]);_0x446340[_0x74a4('0x2e')]=_['intersection'](_0x446340[_0x74a4('0x2f')],_0x446340[_0x74a4('0x2d')]);_0x4a4a3d[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x446340[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x32')]));_0x4a4a3d['attributes']=_0x4a4a3d[_0x74a4('0x30')][_0x74a4('0x33')]?_0x4a4a3d['attributes']:_0x446340[_0x74a4('0x2f')];if(!_0x4fe101['query']['hasOwnProperty'](_0x74a4('0x34'))){_0x4a4a3d[_0x74a4('0x1c')]=qs[_0x74a4('0x1c')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x1c')]);_0x4a4a3d[_0x74a4('0x1b')]=qs[_0x74a4('0x1b')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x1b')]);}_0x4a4a3d['order']=qs[_0x74a4('0x35')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x35')]);_0x4a4a3d[_0x74a4('0x36')]=qs[_0x74a4('0x2e')](_['pick'](_0x4fe101[_0x74a4('0x2d')],_0x446340[_0x74a4('0x2e')]),_0x5a1dad);if(_0x4fe101['query'][_0x74a4('0x37')]){_0x4a4a3d[_0x74a4('0x36')]=_[_0x74a4('0x38')](_0x4a4a3d[_0x74a4('0x36')],{'$or':_[_0x74a4('0x29')](_0x5a1dad,function(_0x19c228){if(_0x19c228['type']!==_0x74a4('0x39')){var _0x2a0d4c={};_0x2a0d4c[_0x19c228['name']]={'$like':'%'+_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x37')]+'%'};return _0x2a0d4c;}})});}_0x4a4a3d=_[_0x74a4('0x38')]({},_0x4a4a3d,_0x4fe101[_0x74a4('0x3a')]);var _0x3088e9={'where':_0x4a4a3d['where']};return db[_0x74a4('0x2a')][_0x74a4('0x1e')](_0x3088e9)['then'](function(_0x200a70){_0x55f21e[_0x74a4('0x1e')]=_0x200a70;if(_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x3b')]){_0x4a4a3d['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x74a4('0x3c')](_0x4a4a3d);})['then'](function(_0x4bfa7a){_0x55f21e[_0x74a4('0x3d')]=_0x4bfa7a;return _0x55f21e;})[_0x74a4('0x23')](respondWithFilteredResult(_0x1d252f,_0x4a4a3d))[_0x74a4('0x3e')](handleError(_0x1d252f,null));};exports['show']=function(_0x399c84,_0xf23a8a){var _0x53207c={'raw':![],'where':{'id':_0x399c84[_0x74a4('0x3f')]['id']}},_0x2df134={};_0x2df134[_0x74a4('0x2f')]=_[_0x74a4('0x2c')](db['FreshdeskAccount'][_0x74a4('0x2b')]);_0x2df134[_0x74a4('0x2d')]=_['keys'](_0x399c84[_0x74a4('0x2d')]);_0x2df134[_0x74a4('0x2e')]=_[_0x74a4('0x31')](_0x2df134[_0x74a4('0x2f')],_0x2df134[_0x74a4('0x2d')]);_0x53207c[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x2df134[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x399c84[_0x74a4('0x2d')][_0x74a4('0x32')]));_0x53207c['attributes']=_0x53207c[_0x74a4('0x30')]['length']?_0x53207c[_0x74a4('0x30')]:_0x2df134[_0x74a4('0x2f')];if(_0x399c84[_0x74a4('0x2d')]['includeAll']){_0x53207c[_0x74a4('0x40')]=[{'all':!![]}];}_0x53207c=_[_0x74a4('0x38')]({},_0x53207c,_0x399c84['options']);return db[_0x74a4('0x2a')][_0x74a4('0x41')](_0x53207c)[_0x74a4('0x23')](handleEntityNotFound(_0xf23a8a,null))[_0x74a4('0x23')](respondWithResult(_0xf23a8a,null))[_0x74a4('0x3e')](handleError(_0xf23a8a,null));};exports['create']=function(_0x49d4d0,_0x4fa783){return db[_0x74a4('0x2a')][_0x74a4('0x42')](_0x49d4d0[_0x74a4('0x43')],{})['then'](respondWithResult(_0x4fa783,0xc9))[_0x74a4('0x3e')](handleError(_0x4fa783,null));};exports[_0x74a4('0x44')]=function(_0x1c0ebf,_0x13697b){if(_0x1c0ebf['body']['id']){delete _0x1c0ebf[_0x74a4('0x43')]['id'];}return db[_0x74a4('0x2a')]['find']({'where':{'id':_0x1c0ebf['params']['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x13697b,null))[_0x74a4('0x23')](saveUpdates(_0x1c0ebf['body'],null))[_0x74a4('0x23')](respondWithResult(_0x13697b,null))[_0x74a4('0x3e')](handleError(_0x13697b,null));};exports['destroy']=function(_0x3fbead,_0x3c8df2){return db[_0x74a4('0x2a')][_0x74a4('0x41')]({'where':{'id':_0x3fbead[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x3c8df2,null))[_0x74a4('0x23')](removeEntity(_0x3c8df2,null))[_0x74a4('0x3e')](handleError(_0x3c8df2,null));};exports[_0x74a4('0x45')]=function(_0x21be32,_0x1a86d3,_0x86d342){var _0x9007b7={};var _0x29891c={};var _0x5d3ead;var _0xf2bbca;return db['FreshdeskAccount'][_0x74a4('0x46')]({'where':{'id':_0x21be32[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x1a86d3,null))[_0x74a4('0x23')](function(_0x7e745e){if(_0x7e745e){_0x5d3ead=_0x7e745e;_0x29891c[_0x74a4('0x2f')]=_[_0x74a4('0x2c')](db[_0x74a4('0x47')]['rawAttributes']);_0x29891c[_0x74a4('0x2d')]=_[_0x74a4('0x2c')](_0x21be32['query']);_0x29891c[_0x74a4('0x2e')]=_['intersection'](_0x29891c[_0x74a4('0x2f')],_0x29891c[_0x74a4('0x2d')]);_0x9007b7[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x29891c[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x21be32[_0x74a4('0x2d')]['fields']));_0x9007b7[_0x74a4('0x30')]=_0x9007b7[_0x74a4('0x30')][_0x74a4('0x33')]?_0x9007b7[_0x74a4('0x30')]:_0x29891c[_0x74a4('0x2f')];_0x9007b7['order']=qs['sort'](_0x21be32['query']['sort']);_0x9007b7[_0x74a4('0x36')]=qs[_0x74a4('0x2e')](_[_0x74a4('0x48')](_0x21be32[_0x74a4('0x2d')],_0x29891c[_0x74a4('0x2e')]));if(_0x21be32[_0x74a4('0x2d')][_0x74a4('0x37')]){_0x9007b7[_0x74a4('0x36')]=_[_0x74a4('0x38')](_0x9007b7[_0x74a4('0x36')],{'$or':_[_0x74a4('0x29')](_0x9007b7[_0x74a4('0x30')],function(_0x24e1c2){var _0xc27550={};_0xc27550[_0x24e1c2]={'$like':'%'+_0x21be32['query'][_0x74a4('0x37')]+'%'};return _0xc27550;})});}_0x9007b7=_[_0x74a4('0x38')]({},_0x9007b7,_0x21be32['options']);return _0x5d3ead['getConfigurations'](_0x9007b7);}})[_0x74a4('0x23')](function(_0x5afcce){if(_0x5afcce){_0xf2bbca=_0x5afcce[_0x74a4('0x33')];if(!_0x21be32[_0x74a4('0x2d')][_0x74a4('0x49')](_0x74a4('0x34'))){_0x9007b7[_0x74a4('0x1c')]=qs['limit'](_0x21be32['query'][_0x74a4('0x1c')]);_0x9007b7['offset']=qs[_0x74a4('0x1b')](_0x21be32['query'][_0x74a4('0x1b')]);}return _0x5d3ead[_0x74a4('0x45')](_0x9007b7);}})[_0x74a4('0x23')](function(_0x157fbb){if(_0x157fbb){return _0x157fbb?{'count':_0xf2bbca,'rows':_0x157fbb}:null;}})[_0x74a4('0x23')](respondWithResult(_0x1a86d3,null))[_0x74a4('0x3e')](handleError(_0x1a86d3,null));};exports[_0x74a4('0x4a')]=function(_0x443d10,_0x54b89b,_0x562462){if(_0x443d10['body']['id']){delete _0x443d10['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x443d10[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x54b89b,null))[_0x74a4('0x23')](function(_0x4972dd){if(_0x4972dd){_0x443d10[_0x74a4('0x43')][_0x74a4('0x4b')]=_0x4972dd['id'];_0x443d10[_0x74a4('0x43')][_0x74a4('0x4c')]=integrations[_0x74a4('0x4d')](_0x443d10[_0x74a4('0x43')][_0x74a4('0x4e')],_0x443d10['body'][_0x74a4('0x4f')]);_0x443d10[_0x74a4('0x43')][_0x74a4('0x50')]=integrations[_0x74a4('0x51')](_0x443d10[_0x74a4('0x43')][_0x74a4('0x4e')],_0x443d10[_0x74a4('0x43')]['type']);return db[_0x74a4('0x47')][_0x74a4('0x42')](_0x443d10[_0x74a4('0x43')],{'include':[{'model':db['FreshdeskField'],'as':_0x74a4('0x4c')},{'model':db['FreshdeskField'],'as':_0x74a4('0x50')}]});}return null;})[_0x74a4('0x23')](respondWithResult(_0x54b89b,null))[_0x74a4('0x3e')](handleError(_0x54b89b,null));};exports[_0x74a4('0x52')]=function(_0x42b265,_0x24d2ef,_0x5b3235){var _0x56858b='';return db[_0x74a4('0x2a')][_0x74a4('0x46')]({'where':{'id':_0x42b265[_0x74a4('0x3f')]['id']},'attributes':['id','remoteUri',_0x74a4('0x53')]})[_0x74a4('0x23')](handleEntityNotFound(_0x24d2ef,null))['then'](function(_0x89c771){if(_0x89c771){_0x56858b=_0x89c771[_0x74a4('0x54')];var _0x328f1b=_0x56858b[_0x74a4('0x55')](-0x1);if(_0x328f1b==='/'){_0x56858b=_0x56858b['substring'](0x0,_0x56858b[_0x74a4('0x56')](_0x328f1b));}return rp({'method':_0x74a4('0x57'),'uri':util[_0x74a4('0x58')]('%s/%s',_0x56858b,_0x74a4('0x59')),'headers':{'Authorization':util[_0x74a4('0x58')](_0x74a4('0x5a'),new Buffer(util['format'](_0x74a4('0x5b'),_0x89c771[_0x74a4('0x53')]))[_0x74a4('0x5c')](_0x74a4('0x5d')))},'json':!![]});}})[_0x74a4('0x23')](function(_0x3b2710){if(_0x3b2710){var _0x337cf2=[_0x74a4('0x5e'),_0x74a4('0x5f'),_0x74a4('0x60'),_0x74a4('0x61'),_0x74a4('0x18'),_0x74a4('0x62'),_0x74a4('0x63'),_0x74a4('0x64'),_0x74a4('0x65'),'group','company'];_[_0x74a4('0x66')](_0x3b2710,function(_0xaccd33){return _0x337cf2[_0x74a4('0x67')](_0xaccd33[_0x74a4('0x27')])||!_0xaccd33[_0x74a4('0x68')]&&_0xaccd33[_0x74a4('0x4f')]!==_0x74a4('0x69')&&_0xaccd33[_0x74a4('0x4f')]!==_0x74a4('0x6a');});return{'count':_0x3b2710[_0x74a4('0x33')],'rows':_['map'](_0x3b2710,function(_0x284105){return{'id':_0x284105['name'],'name':_0x284105[_0x74a4('0x6b')],'custom':!_0x284105['default'],'options':_0x284105[_0x74a4('0x6c')]?_[_0x74a4('0x29')](_0x284105[_0x74a4('0x6c')],function(_0x4ba23e){return{'name':_[_0x74a4('0x6d')](_0x4ba23e),'value':_0x4ba23e};}):[]};})};}})['then'](respondWithResult(_0x24d2ef,null))['catch'](function(_0x1669d9){var _0x5c97a1=_0x42b265[_0x74a4('0x2d')]['test']?0x1f4:_0x1669d9[_0x74a4('0x6e')]||0x1f4;logger[_0x74a4('0x25')](_0x74a4('0x6f'),_0x74a4('0x52'),_0x5c97a1,JSON[_0x74a4('0x70')](_0x1669d9));delete _0x1669d9[_0x74a4('0x27')];if(_0x5c97a1===0x191){_0x5c97a1=0x190;}_0x24d2ef['status'](_0x5c97a1)['send'](_0x42b265[_0x74a4('0x2d')][_0x74a4('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1669d9[_0x74a4('0x6e')]}:_0x1669d9);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d4401a7..85621d5 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 _0xb78b=['int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x121cae,_0x235369){var _0x26c9c0=function(_0x1ac1ce){while(--_0x1ac1ce){_0x121cae['push'](_0x121cae['shift']());}};_0x26c9c0(++_0x235369);}(_0xb78b,0x85));var _0xbb78=function(_0x1eea8b,_0x579693){_0x1eea8b=_0x1eea8b-0x0;var _0x154575=_0xb78b[_0x1eea8b];return _0x154575;};'use strict';var _=require('lodash');var util=require(_0xbb78('0x0'));var logger=require(_0xbb78('0x1'))(_0xbb78('0x2'));var moment=require(_0xbb78('0x3'));var BPromise=require(_0xbb78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb78('0x5'));var rimraf=require(_0xbb78('0x6'));var config=require(_0xbb78('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xbb78('0x8'));module['exports']=function(_0x118d76,_0x27bbc4){return _0x118d76[_0xbb78('0x9')]('FreshdeskAccount',attributes,{'tableName':_0xbb78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5f8=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf5f8,0x1b5));var _0x8f5f=function(_0x49b7ea,_0x403e3b){_0x49b7ea=_0x49b7ea-0x0;var _0x1c1147=_0xf5f8[_0x49b7ea];return _0x1c1147;};'use strict';var _=require(_0x8f5f('0x0'));var util=require(_0x8f5f('0x1'));var logger=require(_0x8f5f('0x2'))(_0x8f5f('0x3'));var moment=require(_0x8f5f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f5f('0x5'));var rimraf=require(_0x8f5f('0x6'));var config=require(_0x8f5f('0x7'));var attributes=require(_0x8f5f('0x8'));var integrations=require(_0x8f5f('0x9'));module[_0x8f5f('0xa')]=function(_0x1a2e6b,_0x494f8a){return _0x1a2e6b[_0x8f5f('0xb')](_0x8f5f('0xc'),attributes,{'tableName':_0x8f5f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 62dd4a1..5dad882 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 _0x2b4b=['request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x2b4b,0x89));var _0xb2b4=function(_0x2d21aa,_0x13fad7){_0x2d21aa=_0x2d21aa-0x0;var _0x5b9e22=_0x2b4b[_0x2d21aa];return _0x5b9e22;};'use strict';var _=require(_0xb2b4('0x0'));var util=require(_0xb2b4('0x1'));var moment=require(_0xb2b4('0x2'));var BPromise=require(_0xb2b4('0x3'));var rs=require(_0xb2b4('0x4'));var fs=require('fs');var Redis=require(_0xb2b4('0x5'));var db=require(_0xb2b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2b4('0x7'))(_0xb2b4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2b4('0x9')][_0xb2b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x166a4d,_0x1c5fe1,_0x23ae43){return new BPromise(function(_0x2c2504,_0x3826bc){return client[_0xb2b4('0xb')](_0x166a4d,_0x23ae43)[_0xb2b4('0xc')](function(_0x45c57c){logger[_0xb2b4('0xd')](_0xb2b4('0xe'),_0x1c5fe1,_0xb2b4('0xf'));logger[_0xb2b4('0x10')](_0xb2b4('0x11'),_0x1c5fe1,_0xb2b4('0xf'),JSON[_0xb2b4('0x12')](_0x45c57c));if(_0x45c57c[_0xb2b4('0x13')]){if(_0x45c57c[_0xb2b4('0x13')][_0xb2b4('0x14')]===0x1f4){logger[_0xb2b4('0x13')](_0xb2b4('0xe'),_0x1c5fe1,_0x45c57c[_0xb2b4('0x13')]['message']);return _0x3826bc(_0x45c57c[_0xb2b4('0x13')][_0xb2b4('0x15')]);}logger[_0xb2b4('0x13')](_0xb2b4('0xe'),_0x1c5fe1,_0x45c57c[_0xb2b4('0x13')][_0xb2b4('0x15')]);return _0x2c2504(_0x45c57c['error']['message']);}else{logger[_0xb2b4('0xd')](_0xb2b4('0xe'),_0x1c5fe1,_0xb2b4('0xf'));_0x2c2504(_0x45c57c[_0xb2b4('0x16')][_0xb2b4('0x15')]);}})[_0xb2b4('0x17')](function(_0x1618d2){logger[_0xb2b4('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x1c5fe1,_0x1618d2);_0x3826bc(_0x1618d2);});});}exports['GetFreshdeskAccount']=function(_0x16b345){var _0x598eb4=this;return new Promise(function(_0x11d1fa,_0x211e9b){return db[_0xb2b4('0x18')][_0xb2b4('0x19')]({'raw':_0x16b345[_0xb2b4('0x1a')]?_0x16b345['options'][_0xb2b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x16b345[_0xb2b4('0x1a')]?_0x16b345[_0xb2b4('0x1a')][_0xb2b4('0x1c')]||null:null,'attributes':_0x16b345[_0xb2b4('0x1a')]?_0x16b345[_0xb2b4('0x1a')][_0xb2b4('0x1d')]||null:null,'limit':_0x16b345['options']?_0x16b345[_0xb2b4('0x1a')][_0xb2b4('0x1e')]||null:null,'include':_0x16b345[_0xb2b4('0x1a')]?_0x16b345[_0xb2b4('0x1a')][_0xb2b4('0x1f')]?_[_0xb2b4('0x20')](_0x16b345[_0xb2b4('0x1a')][_0xb2b4('0x1f')],function(_0x1e2540){return{'model':db[_0x1e2540[_0xb2b4('0x21')]],'as':_0x1e2540['as'],'attributes':_0x1e2540['attributes'],'include':_0x1e2540[_0xb2b4('0x1f')]?_['map'](_0x1e2540[_0xb2b4('0x1f')],function(_0x24ce0f){return{'model':db[_0x24ce0f[_0xb2b4('0x21')]],'as':_0x24ce0f['as'],'attributes':_0x24ce0f[_0xb2b4('0x1d')],'include':_0x24ce0f['include']?_[_0xb2b4('0x20')](_0x24ce0f[_0xb2b4('0x1f')],function(_0x445265){return{'model':db[_0x445265[_0xb2b4('0x21')]],'as':_0x445265['as'],'attributes':_0x445265[_0xb2b4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb2b4('0xc')](function(_0x5656f2){logger['info']('GetFreshdeskAccount',_0x16b345);logger['debug'](_0xb2b4('0x22'),_0x16b345,JSON[_0xb2b4('0x12')](_0x5656f2));_0x11d1fa(_0x5656f2);})[_0xb2b4('0x17')](function(_0x558648){logger[_0xb2b4('0x13')](_0xb2b4('0x22'),_0x558648[_0xb2b4('0x15')],_0x16b345);_0x211e9b(_0x598eb4[_0xb2b4('0x13')](0x1f4,_0x558648[_0xb2b4('0x15')]));});});};exports[_0xb2b4('0x23')]=function(_0x5dcb27){var _0x193d9b=this;return new Promise(function(_0x37c31a,_0x3e6cfd){return db[_0xb2b4('0x18')][_0xb2b4('0x24')]({'raw':_0x5dcb27[_0xb2b4('0x1a')]?_0x5dcb27[_0xb2b4('0x1a')][_0xb2b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5dcb27[_0xb2b4('0x1a')]?_0x5dcb27[_0xb2b4('0x1a')][_0xb2b4('0x1c')]||null:null,'attributes':_0x5dcb27['options']?_0x5dcb27[_0xb2b4('0x1a')][_0xb2b4('0x1d')]||null:null,'include':_0x5dcb27[_0xb2b4('0x1a')]?_0x5dcb27['options'][_0xb2b4('0x1f')]?_[_0xb2b4('0x20')](_0x5dcb27[_0xb2b4('0x1a')][_0xb2b4('0x1f')],function(_0x10409b){return{'model':db[_0x10409b['model']],'as':_0x10409b['as'],'attributes':_0x10409b[_0xb2b4('0x1d')],'include':_0x10409b[_0xb2b4('0x1f')]?_['map'](_0x10409b[_0xb2b4('0x1f')],function(_0xf68d8f){return{'model':db[_0xf68d8f[_0xb2b4('0x21')]],'as':_0xf68d8f['as'],'attributes':_0xf68d8f[_0xb2b4('0x1d')],'include':_0xf68d8f[_0xb2b4('0x1f')]?_[_0xb2b4('0x20')](_0xf68d8f[_0xb2b4('0x1f')],function(_0x899cb4){return{'model':db[_0x899cb4['model']],'as':_0x899cb4['as'],'attributes':_0x899cb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2b4('0xc')](function(_0xa17f0f){logger[_0xb2b4('0xd')](_0xb2b4('0x23'),_0x5dcb27);logger[_0xb2b4('0x10')](_0xb2b4('0x23'),_0x5dcb27,JSON[_0xb2b4('0x12')](_0xa17f0f));_0x37c31a(_0xa17f0f);})[_0xb2b4('0x17')](function(_0x20d3de){logger[_0xb2b4('0x13')](_0xb2b4('0x23'),_0x20d3de[_0xb2b4('0x15')],_0x5dcb27);_0x3e6cfd(_0x193d9b[_0xb2b4('0x13')](0x1f4,_0x20d3de[_0xb2b4('0x15')]));});});}; \ No newline at end of file +var _0xf412=['error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','model','attributes','ShowFreshdeskAccount','find','raw','map','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xf412,0x121));var _0x2f41=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xf412[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0x2f41('0x0'));var util=require(_0x2f41('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f41('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f41('0x3'));var logger=require(_0x2f41('0x4'))(_0x2f41('0x5'));var config=require(_0x2f41('0x6'));var jayson=require(_0x2f41('0x7'));var client=jayson['client'][_0x2f41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56d57a,_0x22007d,_0x3c315e){return new BPromise(function(_0x4b85b7,_0x3bbafc){return client[_0x2f41('0x9')](_0x56d57a,_0x3c315e)[_0x2f41('0xa')](function(_0x324e87){logger[_0x2f41('0xb')](_0x2f41('0xc'),_0x22007d,_0x2f41('0xd'));logger[_0x2f41('0xe')](_0x2f41('0xf'),_0x22007d,_0x2f41('0xd'),JSON[_0x2f41('0x10')](_0x324e87));if(_0x324e87['error']){if(_0x324e87[_0x2f41('0x11')][_0x2f41('0x12')]===0x1f4){logger[_0x2f41('0x11')](_0x2f41('0xc'),_0x22007d,_0x324e87[_0x2f41('0x11')][_0x2f41('0x13')]);return _0x3bbafc(_0x324e87['error'][_0x2f41('0x13')]);}logger[_0x2f41('0x11')](_0x2f41('0xc'),_0x22007d,_0x324e87[_0x2f41('0x11')][_0x2f41('0x13')]);return _0x4b85b7(_0x324e87['error'][_0x2f41('0x13')]);}else{logger[_0x2f41('0xb')](_0x2f41('0xc'),_0x22007d,_0x2f41('0xd'));_0x4b85b7(_0x324e87['result'][_0x2f41('0x13')]);}})[_0x2f41('0x14')](function(_0x36c2c6){logger[_0x2f41('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x22007d,_0x36c2c6);_0x3bbafc(_0x36c2c6);});});}exports[_0x2f41('0x15')]=function(_0x5d2bd8){var _0x1efe1d=this;return new Promise(function(_0x1d22c8,_0xcd17a2){return db[_0x2f41('0x16')][_0x2f41('0x17')]({'raw':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')][_0x2f41('0x19')]||null:null,'attributes':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8['options']['attributes']||null:null,'limit':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')][_0x2f41('0x1a')]||null:null,'include':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')][_0x2f41('0x1b')]?_['map'](_0x5d2bd8[_0x2f41('0x18')]['include'],function(_0x101627){return{'model':db[_0x101627[_0x2f41('0x1c')]],'as':_0x101627['as'],'attributes':_0x101627[_0x2f41('0x1d')],'include':_0x101627['include']?_['map'](_0x101627['include'],function(_0x432163){return{'model':db[_0x432163[_0x2f41('0x1c')]],'as':_0x432163['as'],'attributes':_0x432163[_0x2f41('0x1d')],'include':_0x432163['include']?_['map'](_0x432163[_0x2f41('0x1b')],function(_0x24c5b4){return{'model':db[_0x24c5b4['model']],'as':_0x24c5b4['as'],'attributes':_0x24c5b4[_0x2f41('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f41('0xa')](function(_0xd48b62){logger['info'](_0x2f41('0x15'),_0x5d2bd8);logger[_0x2f41('0xe')](_0x2f41('0x15'),_0x5d2bd8,JSON[_0x2f41('0x10')](_0xd48b62));_0x1d22c8(_0xd48b62);})[_0x2f41('0x14')](function(_0x44a837){logger[_0x2f41('0x11')]('GetFreshdeskAccount',_0x44a837[_0x2f41('0x13')],_0x5d2bd8);_0xcd17a2(_0x1efe1d[_0x2f41('0x11')](0x1f4,_0x44a837['message']));});});};exports[_0x2f41('0x1e')]=function(_0x1927c0){var _0x4b6f0c=this;return new Promise(function(_0x58dc59,_0x22d157){return db[_0x2f41('0x16')][_0x2f41('0x1f')]({'raw':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')][_0x2f41('0x20')]===undefined?!![]:![]:!![],'where':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')]['where']||null:null,'attributes':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')][_0x2f41('0x1d')]||null:null,'include':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')][_0x2f41('0x1b')]?_[_0x2f41('0x21')](_0x1927c0['options'][_0x2f41('0x1b')],function(_0x4e6e1c){return{'model':db[_0x4e6e1c['model']],'as':_0x4e6e1c['as'],'attributes':_0x4e6e1c[_0x2f41('0x1d')],'include':_0x4e6e1c[_0x2f41('0x1b')]?_[_0x2f41('0x21')](_0x4e6e1c[_0x2f41('0x1b')],function(_0x4578ac){return{'model':db[_0x4578ac['model']],'as':_0x4578ac['as'],'attributes':_0x4578ac[_0x2f41('0x1d')],'include':_0x4578ac[_0x2f41('0x1b')]?_[_0x2f41('0x21')](_0x4578ac[_0x2f41('0x1b')],function(_0x12f77d){return{'model':db[_0x12f77d[_0x2f41('0x1c')]],'as':_0x12f77d['as'],'attributes':_0x12f77d[_0x2f41('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f41('0xa')](function(_0xcaf974){logger[_0x2f41('0xb')]('ShowFreshdeskAccount',_0x1927c0);logger[_0x2f41('0xe')](_0x2f41('0x1e'),_0x1927c0,JSON[_0x2f41('0x10')](_0xcaf974));_0x58dc59(_0xcaf974);})[_0x2f41('0x14')](function(_0x15778a){logger[_0x2f41('0x11')](_0x2f41('0x1e'),_0x15778a[_0x2f41('0x13')],_0x1927c0);_0x22d157(_0x4b6f0c['error'](0x1f4,_0x15778a[_0x2f41('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 82485a3..58c70bf 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 _0x8695=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','setTags','put','update'];(function(_0x53fa98,_0xa6111d){var _0x343c7b=function(_0x55c4f7){while(--_0x55c4f7){_0x53fa98['push'](_0x53fa98['shift']());}};_0x343c7b(++_0xa6111d);}(_0x8695,0xb2));var _0x5869=function(_0x33f6f8,_0x578c72){_0x33f6f8=_0x33f6f8-0x0;var _0x2fc3e8=_0x8695[_0x33f6f8];return _0x2fc3e8;};'use strict';var multer=require(_0x5869('0x0'));var util=require(_0x5869('0x1'));var path=require(_0x5869('0x2'));var timeout=require(_0x5869('0x3'));var express=require(_0x5869('0x4'));var router=express[_0x5869('0x5')]();var fs_extra=require(_0x5869('0x6'));var auth=require(_0x5869('0x7'));var interaction=require(_0x5869('0x8'));var config=require(_0x5869('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5869('0xa')](_0x5869('0xb'),auth[_0x5869('0xc')](),controller[_0x5869('0xd')]);router[_0x5869('0xa')]('/:id/fields',auth[_0x5869('0xc')](),controller[_0x5869('0xe')]);router[_0x5869('0xa')](_0x5869('0xf'),auth[_0x5869('0xc')](),controller[_0x5869('0x10')]);router[_0x5869('0xa')]('/:id/descriptions',auth[_0x5869('0xc')](),controller['getDescriptions']);router['get'](_0x5869('0x11'),auth[_0x5869('0xc')](),controller['getTags']);router['post']('/',auth[_0x5869('0xc')](),controller['create']);router[_0x5869('0x12')](_0x5869('0x11'),auth[_0x5869('0xc')](),controller[_0x5869('0x13')]);router[_0x5869('0x14')](_0x5869('0xb'),auth['isAuthenticated'](),controller[_0x5869('0x15')]);router[_0x5869('0x16')](_0x5869('0xb'),auth[_0x5869('0xc')](),controller[_0x5869('0x17')]);module[_0x5869('0x18')]=router; \ No newline at end of file +var _0x65c4=['/:id/tags','setTags','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getTags','post','create'];(function(_0x4e4755,_0x1152a0){var _0x4e9370=function(_0x34bf29){while(--_0x34bf29){_0x4e4755['push'](_0x4e4755['shift']());}};_0x4e9370(++_0x1152a0);}(_0x65c4,0x1b6));var _0x465c=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x65c4[_0x1cd674];return _0x27928f;};'use strict';var multer=require(_0x465c('0x0'));var util=require(_0x465c('0x1'));var path=require(_0x465c('0x2'));var timeout=require('connect-timeout');var express=require(_0x465c('0x3'));var router=express[_0x465c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x465c('0x5'));var config=require(_0x465c('0x6'));var controller=require(_0x465c('0x7'));router[_0x465c('0x8')]('/',auth[_0x465c('0x9')](),controller[_0x465c('0xa')]);router['get']('/:id',auth[_0x465c('0x9')](),controller[_0x465c('0xb')]);router[_0x465c('0x8')](_0x465c('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0x465c('0x9')](),controller[_0x465c('0xd')]);router['get'](_0x465c('0xe'),auth[_0x465c('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x465c('0x9')](),controller[_0x465c('0xf')]);router[_0x465c('0x10')]('/',auth[_0x465c('0x9')](),controller[_0x465c('0x11')]);router['post'](_0x465c('0x12'),auth[_0x465c('0x9')](),controller[_0x465c('0x13')]);router[_0x465c('0x14')](_0x465c('0x15'),auth[_0x465c('0x9')](),controller['update']);router['delete'](_0x465c('0x15'),auth[_0x465c('0x9')](),controller[_0x465c('0x16')]);module[_0x465c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ab8e814..40e2b70 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 _0x9e65=['exports','STRING'];(function(_0x1ecccb,_0x1fc9dd){var _0x44241d=function(_0x40cf11){while(--_0x40cf11){_0x1ecccb['push'](_0x1ecccb['shift']());}};_0x44241d(++_0x1fc9dd);}(_0x9e65,0x9c));var _0x59e6=function(_0x173336,_0x3f98c4){_0x173336=_0x173336-0x0;var _0x12dc79=_0x9e65[_0x173336];return _0x12dc79;};'use strict';var Sequelize=require('sequelize');module[_0x59e6('0x0')]={'name':{'type':Sequelize[_0x59e6('0x1')]},'description':{'type':Sequelize[_0x59e6('0x1')]}}; \ No newline at end of file +var _0x5068=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5068,0x1b8));var _0x8506=function(_0x2d6183,_0x1e741c){_0x2d6183=_0x2d6183-0x0;var _0xe0f2e4=_0x5068[_0x2d6183];return _0xe0f2e4;};'use strict';var Sequelize=require(_0x8506('0x0'));module[_0x8506('0x1')]={'name':{'type':Sequelize[_0x8506('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d8c7f91..ecc6f24 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 _0xb539=['getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','show','params','keys','fields','options','find','catch','create','body','findOne','getFields'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0xb539,0x157));var _0x9b53=function(_0x1e7286,_0xc259ee){_0x1e7286=_0x1e7286-0x0;var _0x3ab62a=_0xb539[_0x1e7286];return _0x3ab62a;};'use strict';var emlformat=require(_0x9b53('0x0'));var rimraf=require(_0x9b53('0x1'));var zipdir=require(_0x9b53('0x2'));var jsonpatch=require(_0x9b53('0x3'));var rp=require(_0x9b53('0x4'));var moment=require(_0x9b53('0x5'));var BPromise=require(_0x9b53('0x6'));var Mustache=require(_0x9b53('0x7'));var util=require(_0x9b53('0x8'));var path=require(_0x9b53('0x9'));var sox=require(_0x9b53('0xa'));var csv=require(_0x9b53('0xb'));var ejs=require(_0x9b53('0xc'));var fs=require('fs');var fs_extra=require(_0x9b53('0xd'));var _=require('lodash');var squel=require(_0x9b53('0xe'));var crypto=require('crypto');var jsforce=require(_0x9b53('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9b53('0xb'));var querystring=require(_0x9b53('0x10'));var Papa=require(_0x9b53('0x11'));var Redis=require(_0x9b53('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9b53('0x13'));var as=require(_0x9b53('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9b53('0x15'));var utils=require(_0x9b53('0x16'));var config=require(_0x9b53('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b53('0x18'))['db'];function respondWithStatusCode(_0x1b86bb,_0x2bc5cf){_0x2bc5cf=_0x2bc5cf||0xcc;return function(_0x4fc795){if(_0x4fc795){return _0x1b86bb[_0x9b53('0x19')](_0x2bc5cf);}return _0x1b86bb[_0x9b53('0x1a')](_0x2bc5cf)[_0x9b53('0x1b')]();};}function respondWithResult(_0x57a16a,_0x54cca3){_0x54cca3=_0x54cca3||0xc8;return function(_0x5096cc){if(_0x5096cc){return _0x57a16a[_0x9b53('0x1a')](_0x54cca3)[_0x9b53('0x1c')](_0x5096cc);}};}function respondWithFilteredResult(_0x35003e,_0x4af07a){return function(_0xdec178){if(_0xdec178){var _0x32e0cb=typeof _0x4af07a[_0x9b53('0x1d')]===_0x9b53('0x1e')&&typeof _0x4af07a[_0x9b53('0x1f')]===_0x9b53('0x1e');var _0x3c0320=_0xdec178[_0x9b53('0x20')];var _0x1d7fe4=_0x32e0cb?0x0:_0x4af07a[_0x9b53('0x1d')];var _0x111c75=_0x32e0cb?_0xdec178[_0x9b53('0x20')]:_0x4af07a[_0x9b53('0x1d')]+_0x4af07a[_0x9b53('0x1f')];var _0x273c51;if(_0x111c75>=_0x3c0320){_0x111c75=_0x3c0320;_0x273c51=0xc8;}else{_0x273c51=0xce;}_0x35003e[_0x9b53('0x1a')](_0x273c51);return _0x35003e[_0x9b53('0x21')]('Content-Range',_0x1d7fe4+'-'+_0x111c75+'/'+_0x3c0320)[_0x9b53('0x1c')](_0xdec178);}return null;};}function patchUpdates(_0x54429d){return function(_0x5edbf9){try{jsonpatch[_0x9b53('0x22')](_0x5edbf9,_0x54429d,!![]);}catch(_0x286186){return BPromise[_0x9b53('0x23')](_0x286186);}return _0x5edbf9[_0x9b53('0x24')]();};}function saveUpdates(_0x1c80d4,_0xaf7c82){return function(_0x252185){if(_0x252185){return _0x252185[_0x9b53('0x25')](_0x1c80d4)[_0x9b53('0x26')](function(_0x302087){return _0x302087;});}return null;};}function removeEntity(_0x558260,_0x52c0cc){return function(_0x50c50c){if(_0x50c50c){return _0x50c50c[_0x9b53('0x27')]()['then'](function(){_0x558260[_0x9b53('0x1a')](0xcc)[_0x9b53('0x1b')]();});}};}function handleEntityNotFound(_0x19f655,_0x144267){return function(_0x11feec){if(!_0x11feec){_0x19f655[_0x9b53('0x19')](0x194);}return _0x11feec;};}function handleError(_0x423a8f,_0x211a89){_0x211a89=_0x211a89||0x1f4;return function(_0x495d83){logger[_0x9b53('0x28')](_0x495d83[_0x9b53('0x29')]);if(_0x495d83[_0x9b53('0x2a')]){delete _0x495d83['name'];}_0x423a8f[_0x9b53('0x1a')](_0x211a89)[_0x9b53('0x2b')](_0x495d83);};}exports['index']=function(_0x4f5bb6,_0x52ba8d){var _0x1e6ae7={},_0x1725c9={},_0x505f14={'count':0x0,'rows':[]};var _0x1b8749=_[_0x9b53('0x2c')](db[_0x9b53('0x2d')][_0x9b53('0x2e')],function(_0x41f258){return{'name':_0x41f258[_0x9b53('0x2f')],'type':_0x41f258[_0x9b53('0x30')]['key']};});_0x1725c9['model']=_['map'](_0x1b8749,_0x9b53('0x2a'));_0x1725c9[_0x9b53('0x31')]=_['keys'](_0x4f5bb6[_0x9b53('0x31')]);_0x1725c9[_0x9b53('0x32')]=_[_0x9b53('0x33')](_0x1725c9[_0x9b53('0x34')],_0x1725c9['query']);_0x1e6ae7['attributes']=_['intersection'](_0x1725c9['model'],qs['fields'](_0x4f5bb6[_0x9b53('0x31')]['fields']));_0x1e6ae7['attributes']=_0x1e6ae7[_0x9b53('0x35')][_0x9b53('0x36')]?_0x1e6ae7['attributes']:_0x1725c9[_0x9b53('0x34')];if(!_0x4f5bb6[_0x9b53('0x31')][_0x9b53('0x37')](_0x9b53('0x38'))){_0x1e6ae7[_0x9b53('0x1f')]=qs['limit'](_0x4f5bb6[_0x9b53('0x31')]['limit']);_0x1e6ae7[_0x9b53('0x1d')]=qs['offset'](_0x4f5bb6['query'][_0x9b53('0x1d')]);}_0x1e6ae7[_0x9b53('0x39')]=qs[_0x9b53('0x3a')](_0x4f5bb6[_0x9b53('0x31')][_0x9b53('0x3a')]);_0x1e6ae7[_0x9b53('0x3b')]=qs[_0x9b53('0x32')](_[_0x9b53('0x3c')](_0x4f5bb6[_0x9b53('0x31')],_0x1725c9[_0x9b53('0x32')]),_0x1b8749);if(_0x4f5bb6['query']['filter']){_0x1e6ae7['where']=_[_0x9b53('0x3d')](_0x1e6ae7['where'],{'$or':_[_0x9b53('0x2c')](_0x1b8749,function(_0x4b86eb){if(_0x4b86eb[_0x9b53('0x30')]!=='VIRTUAL'){var _0x3f4108={};_0x3f4108[_0x4b86eb[_0x9b53('0x2a')]]={'$like':'%'+_0x4f5bb6[_0x9b53('0x31')][_0x9b53('0x3e')]+'%'};return _0x3f4108;}})});}_0x1e6ae7=_[_0x9b53('0x3d')]({},_0x1e6ae7,_0x4f5bb6['options']);var _0x44a493={'where':_0x1e6ae7[_0x9b53('0x3b')]};return db[_0x9b53('0x2d')][_0x9b53('0x20')](_0x44a493)[_0x9b53('0x26')](function(_0x5021a7){_0x505f14[_0x9b53('0x20')]=_0x5021a7;if(_0x4f5bb6[_0x9b53('0x31')][_0x9b53('0x3f')]){_0x1e6ae7[_0x9b53('0x40')]=[{'all':!![]}];}return db[_0x9b53('0x2d')][_0x9b53('0x41')](_0x1e6ae7);})[_0x9b53('0x26')](function(_0x39ecab){_0x505f14['rows']=_0x39ecab;return _0x505f14;})['then'](respondWithFilteredResult(_0x52ba8d,_0x1e6ae7))['catch'](handleError(_0x52ba8d,null));};exports[_0x9b53('0x42')]=function(_0x4d1184,_0x12b2ff){var _0x125af9={'raw':![],'where':{'id':_0x4d1184[_0x9b53('0x43')]['id']}},_0x304d5e={};_0x304d5e[_0x9b53('0x34')]=_[_0x9b53('0x44')](db[_0x9b53('0x2d')]['rawAttributes']);_0x304d5e[_0x9b53('0x31')]=_[_0x9b53('0x44')](_0x4d1184[_0x9b53('0x31')]);_0x304d5e[_0x9b53('0x32')]=_[_0x9b53('0x33')](_0x304d5e[_0x9b53('0x34')],_0x304d5e[_0x9b53('0x31')]);_0x125af9[_0x9b53('0x35')]=_[_0x9b53('0x33')](_0x304d5e['model'],qs['fields'](_0x4d1184[_0x9b53('0x31')][_0x9b53('0x45')]));_0x125af9[_0x9b53('0x35')]=_0x125af9[_0x9b53('0x35')][_0x9b53('0x36')]?_0x125af9['attributes']:_0x304d5e['model'];if(_0x4d1184[_0x9b53('0x31')][_0x9b53('0x3f')]){_0x125af9['include']=[{'all':!![]}];}_0x125af9=_[_0x9b53('0x3d')]({},_0x125af9,_0x4d1184[_0x9b53('0x46')]);return db[_0x9b53('0x2d')][_0x9b53('0x47')](_0x125af9)[_0x9b53('0x26')](handleEntityNotFound(_0x12b2ff,null))[_0x9b53('0x26')](respondWithResult(_0x12b2ff,null))[_0x9b53('0x48')](handleError(_0x12b2ff,null));};exports[_0x9b53('0x49')]=function(_0x1662d1,_0x1cc5c7){return db[_0x9b53('0x2d')][_0x9b53('0x49')](_0x1662d1[_0x9b53('0x4a')],{})['then'](respondWithResult(_0x1cc5c7,0xc9))[_0x9b53('0x48')](handleError(_0x1cc5c7,null));};exports[_0x9b53('0x25')]=function(_0x32fd55,_0x3a78a7){if(_0x32fd55['body']['id']){delete _0x32fd55[_0x9b53('0x4a')]['id'];}return db[_0x9b53('0x2d')][_0x9b53('0x47')]({'where':{'id':_0x32fd55['params']['id']}})[_0x9b53('0x26')](handleEntityNotFound(_0x3a78a7,null))[_0x9b53('0x26')](saveUpdates(_0x32fd55[_0x9b53('0x4a')],null))[_0x9b53('0x26')](respondWithResult(_0x3a78a7,null))[_0x9b53('0x48')](handleError(_0x3a78a7,null));};exports['destroy']=function(_0x120e6c,_0x87c9bd){return db[_0x9b53('0x2d')][_0x9b53('0x47')]({'where':{'id':_0x120e6c[_0x9b53('0x43')]['id']}})['then'](handleEntityNotFound(_0x87c9bd,null))[_0x9b53('0x26')](removeEntity(_0x87c9bd,null))['catch'](handleError(_0x87c9bd,null));};exports['getFields']=function(_0x557a55,_0x457fa6,_0x2832c3){var _0x17aeab={};var _0x2255c7={};var _0x186c78;var _0x26df6d;return db['FreshdeskConfiguration'][_0x9b53('0x4b')]({'where':{'id':_0x557a55[_0x9b53('0x43')]['id']}})[_0x9b53('0x26')](handleEntityNotFound(_0x457fa6,null))[_0x9b53('0x26')](function(_0x4b29b1){if(_0x4b29b1){_0x186c78=_0x4b29b1;_0x2255c7['model']=_[_0x9b53('0x44')](db['FreshdeskField']['rawAttributes']);_0x2255c7[_0x9b53('0x31')]=_[_0x9b53('0x44')](_0x557a55[_0x9b53('0x31')]);_0x2255c7[_0x9b53('0x32')]=_[_0x9b53('0x33')](_0x2255c7[_0x9b53('0x34')],_0x2255c7[_0x9b53('0x31')]);_0x17aeab[_0x9b53('0x35')]=_['intersection'](_0x2255c7[_0x9b53('0x34')],qs[_0x9b53('0x45')](_0x557a55['query'][_0x9b53('0x45')]));_0x17aeab[_0x9b53('0x35')]=_0x17aeab[_0x9b53('0x35')][_0x9b53('0x36')]?_0x17aeab[_0x9b53('0x35')]:_0x2255c7[_0x9b53('0x34')];_0x17aeab[_0x9b53('0x39')]=qs[_0x9b53('0x3a')](_0x557a55[_0x9b53('0x31')][_0x9b53('0x3a')]);_0x17aeab['where']=qs[_0x9b53('0x32')](_[_0x9b53('0x3c')](_0x557a55['query'],_0x2255c7['filters']));if(_0x557a55['query']['filter']){_0x17aeab[_0x9b53('0x3b')]=_[_0x9b53('0x3d')](_0x17aeab[_0x9b53('0x3b')],{'$or':_[_0x9b53('0x2c')](_0x17aeab['attributes'],function(_0x2fb584){var _0xb53c62={};_0xb53c62[_0x2fb584]={'$like':'%'+_0x557a55[_0x9b53('0x31')][_0x9b53('0x3e')]+'%'};return _0xb53c62;})});}_0x17aeab=_['merge']({},_0x17aeab,_0x557a55[_0x9b53('0x46')]);return _0x186c78[_0x9b53('0x4c')](_0x17aeab);}})[_0x9b53('0x26')](function(_0x7d568c){if(_0x7d568c){_0x26df6d=_0x7d568c[_0x9b53('0x36')];if(!_0x557a55[_0x9b53('0x31')][_0x9b53('0x37')](_0x9b53('0x38'))){_0x17aeab['limit']=qs[_0x9b53('0x1f')](_0x557a55[_0x9b53('0x31')]['limit']);_0x17aeab[_0x9b53('0x1d')]=qs['offset'](_0x557a55[_0x9b53('0x31')]['offset']);}return _0x186c78[_0x9b53('0x4c')](_0x17aeab);}})['then'](function(_0x34a3ae){if(_0x34a3ae){return _0x34a3ae?{'count':_0x26df6d,'rows':_0x34a3ae}:null;}})['then'](respondWithResult(_0x457fa6,null))[_0x9b53('0x48')](handleError(_0x457fa6,null));};exports[_0x9b53('0x4d')]=function(_0x439ea6,_0x4df2ab,_0x50e365){var _0x20201d={};var _0x25abb8={};var _0x19718a;var _0x44f68a;return db[_0x9b53('0x2d')]['findOne']({'where':{'id':_0x439ea6['params']['id']}})['then'](handleEntityNotFound(_0x4df2ab,null))['then'](function(_0x2bb1b0){if(_0x2bb1b0){_0x19718a=_0x2bb1b0;_0x25abb8[_0x9b53('0x34')]=_['keys'](db['FreshdeskField'][_0x9b53('0x2e')]);_0x25abb8[_0x9b53('0x31')]=_[_0x9b53('0x44')](_0x439ea6[_0x9b53('0x31')]);_0x25abb8[_0x9b53('0x32')]=_[_0x9b53('0x33')](_0x25abb8['model'],_0x25abb8[_0x9b53('0x31')]);_0x20201d[_0x9b53('0x35')]=_['intersection'](_0x25abb8[_0x9b53('0x34')],qs[_0x9b53('0x45')](_0x439ea6[_0x9b53('0x31')][_0x9b53('0x45')]));_0x20201d[_0x9b53('0x35')]=_0x20201d['attributes'][_0x9b53('0x36')]?_0x20201d[_0x9b53('0x35')]:_0x25abb8['model'];_0x20201d[_0x9b53('0x39')]=qs[_0x9b53('0x3a')](_0x439ea6[_0x9b53('0x31')]['sort']);_0x20201d[_0x9b53('0x3b')]=qs[_0x9b53('0x32')](_[_0x9b53('0x3c')](_0x439ea6[_0x9b53('0x31')],_0x25abb8['filters']));if(_0x439ea6[_0x9b53('0x31')][_0x9b53('0x3e')]){_0x20201d[_0x9b53('0x3b')]=_[_0x9b53('0x3d')](_0x20201d[_0x9b53('0x3b')],{'$or':_[_0x9b53('0x2c')](_0x20201d[_0x9b53('0x35')],function(_0x1bfb2a){var _0x38ca59={};_0x38ca59[_0x1bfb2a]={'$like':'%'+_0x439ea6[_0x9b53('0x31')][_0x9b53('0x3e')]+'%'};return _0x38ca59;})});}_0x20201d=_['merge']({},_0x20201d,_0x439ea6[_0x9b53('0x46')]);return _0x19718a[_0x9b53('0x4d')](_0x20201d);}})[_0x9b53('0x26')](function(_0x49c9c4){if(_0x49c9c4){_0x44f68a=_0x49c9c4['length'];if(!_0x439ea6[_0x9b53('0x31')][_0x9b53('0x37')](_0x9b53('0x38'))){_0x20201d[_0x9b53('0x1f')]=qs['limit'](_0x439ea6[_0x9b53('0x31')][_0x9b53('0x1f')]);_0x20201d[_0x9b53('0x1d')]=qs[_0x9b53('0x1d')](_0x439ea6['query'][_0x9b53('0x1d')]);}return _0x19718a[_0x9b53('0x4d')](_0x20201d);}})[_0x9b53('0x26')](function(_0x3e1291){if(_0x3e1291){return _0x3e1291?{'count':_0x44f68a,'rows':_0x3e1291}:null;}})[_0x9b53('0x26')](respondWithResult(_0x4df2ab,null))[_0x9b53('0x48')](handleError(_0x4df2ab,null));};exports['getDescriptions']=function(_0x5d1c69,_0x20d950,_0x3b5b98){var _0x1d330e={};var _0x277ed4={};var _0x4627ea;var _0x2ce05d;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5d1c69['params']['id']}})['then'](handleEntityNotFound(_0x20d950,null))[_0x9b53('0x26')](function(_0x28f0bd){if(_0x28f0bd){_0x4627ea=_0x28f0bd;_0x277ed4[_0x9b53('0x34')]=_[_0x9b53('0x44')](db[_0x9b53('0x4e')]['rawAttributes']);_0x277ed4[_0x9b53('0x31')]=_[_0x9b53('0x44')](_0x5d1c69[_0x9b53('0x31')]);_0x277ed4[_0x9b53('0x32')]=_[_0x9b53('0x33')](_0x277ed4[_0x9b53('0x34')],_0x277ed4[_0x9b53('0x31')]);_0x1d330e[_0x9b53('0x35')]=_[_0x9b53('0x33')](_0x277ed4['model'],qs[_0x9b53('0x45')](_0x5d1c69[_0x9b53('0x31')][_0x9b53('0x45')]));_0x1d330e[_0x9b53('0x35')]=_0x1d330e[_0x9b53('0x35')][_0x9b53('0x36')]?_0x1d330e[_0x9b53('0x35')]:_0x277ed4[_0x9b53('0x34')];_0x1d330e['order']=qs['sort'](_0x5d1c69[_0x9b53('0x31')]['sort']);_0x1d330e[_0x9b53('0x3b')]=qs['filters'](_[_0x9b53('0x3c')](_0x5d1c69['query'],_0x277ed4[_0x9b53('0x32')]));if(_0x5d1c69['query']['filter']){_0x1d330e['where']=_[_0x9b53('0x3d')](_0x1d330e[_0x9b53('0x3b')],{'$or':_[_0x9b53('0x2c')](_0x1d330e[_0x9b53('0x35')],function(_0x1c139b){var _0x4db9c1={};_0x4db9c1[_0x1c139b]={'$like':'%'+_0x5d1c69[_0x9b53('0x31')][_0x9b53('0x3e')]+'%'};return _0x4db9c1;})});}_0x1d330e=_[_0x9b53('0x3d')]({},_0x1d330e,_0x5d1c69['options']);return _0x4627ea[_0x9b53('0x4f')](_0x1d330e);}})[_0x9b53('0x26')](function(_0x3ba7cf){if(_0x3ba7cf){_0x2ce05d=_0x3ba7cf['length'];if(!_0x5d1c69[_0x9b53('0x31')][_0x9b53('0x37')](_0x9b53('0x38'))){_0x1d330e['limit']=qs['limit'](_0x5d1c69[_0x9b53('0x31')][_0x9b53('0x1f')]);_0x1d330e[_0x9b53('0x1d')]=qs['offset'](_0x5d1c69['query'][_0x9b53('0x1d')]);}return _0x4627ea['getDescriptions'](_0x1d330e);}})['then'](function(_0x572787){if(_0x572787){return _0x572787?{'count':_0x2ce05d,'rows':_0x572787}:null;}})[_0x9b53('0x26')](respondWithResult(_0x20d950,null))[_0x9b53('0x48')](handleError(_0x20d950,null));};exports[_0x9b53('0x50')]=function(_0x4bfb49,_0x1e8ff4,_0x3b55d4){var _0x183b76={};var _0xb9f5f={};var _0x656341;var _0x2c6ca8;return db[_0x9b53('0x2d')][_0x9b53('0x4b')]({'where':{'id':_0x4bfb49[_0x9b53('0x43')]['id']}})[_0x9b53('0x26')](handleEntityNotFound(_0x1e8ff4,null))['then'](function(_0x20ddac){if(_0x20ddac){_0x656341=_0x20ddac;_0xb9f5f[_0x9b53('0x34')]=_[_0x9b53('0x44')](db[_0x9b53('0x51')][_0x9b53('0x2e')]);_0xb9f5f['query']=_[_0x9b53('0x44')](_0x4bfb49[_0x9b53('0x31')]);_0xb9f5f[_0x9b53('0x32')]=_[_0x9b53('0x33')](_0xb9f5f[_0x9b53('0x34')],_0xb9f5f[_0x9b53('0x31')]);_0x183b76[_0x9b53('0x35')]=_[_0x9b53('0x33')](_0xb9f5f[_0x9b53('0x34')],qs[_0x9b53('0x45')](_0x4bfb49[_0x9b53('0x31')][_0x9b53('0x45')]));_0x183b76['attributes']=_0x183b76[_0x9b53('0x35')][_0x9b53('0x36')]?_0x183b76['attributes']:_0xb9f5f['model'];_0x183b76['order']=qs[_0x9b53('0x3a')](_0x4bfb49[_0x9b53('0x31')][_0x9b53('0x3a')]);_0x183b76[_0x9b53('0x3b')]=qs[_0x9b53('0x32')](_[_0x9b53('0x3c')](_0x4bfb49['query'],_0xb9f5f[_0x9b53('0x32')]));if(_0x4bfb49[_0x9b53('0x31')][_0x9b53('0x3e')]){_0x183b76[_0x9b53('0x3b')]=_[_0x9b53('0x3d')](_0x183b76[_0x9b53('0x3b')],{'$or':_[_0x9b53('0x2c')](_0x183b76[_0x9b53('0x35')],function(_0x21cab2){var _0x20f842={};_0x20f842[_0x21cab2]={'$like':'%'+_0x4bfb49[_0x9b53('0x31')][_0x9b53('0x3e')]+'%'};return _0x20f842;})});}_0x183b76=_[_0x9b53('0x3d')]({},_0x183b76,_0x4bfb49['options']);return _0x656341[_0x9b53('0x50')](_0x183b76);}})[_0x9b53('0x26')](function(_0xf89ba){if(_0xf89ba){_0x2c6ca8=_0xf89ba[_0x9b53('0x36')];if(!_0x4bfb49[_0x9b53('0x31')]['hasOwnProperty'](_0x9b53('0x38'))){_0x183b76[_0x9b53('0x1f')]=qs['limit'](_0x4bfb49['query'][_0x9b53('0x1f')]);_0x183b76[_0x9b53('0x1d')]=qs['offset'](_0x4bfb49[_0x9b53('0x31')]['offset']);}return _0x656341[_0x9b53('0x50')](_0x183b76);}})[_0x9b53('0x26')](function(_0x480fe6){if(_0x480fe6){return _0x480fe6?{'count':_0x2c6ca8,'rows':_0x480fe6}:null;}})[_0x9b53('0x26')](respondWithResult(_0x1e8ff4,null))[_0x9b53('0x48')](handleError(_0x1e8ff4,null));};exports[_0x9b53('0x52')]=function(_0x4e41a1,_0x13f508,_0x5c3fbb){if(_0x4e41a1[_0x9b53('0x4a')]['id']){delete _0x4e41a1['body']['id'];}return db['FreshdeskConfiguration'][_0x9b53('0x4b')]({'where':{'id':_0x4e41a1['params']['id']}})['then'](handleEntityNotFound(_0x13f508,null))[_0x9b53('0x26')](function(_0x424be8){if(_0x424be8){return _0x424be8[_0x9b53('0x52')](_0x4e41a1['body'][_0x9b53('0x53')]||[]);}return null;})[_0x9b53('0x26')](respondWithResult(_0x13f508,null))[_0x9b53('0x48')](handleError(_0x13f508,null));}; \ No newline at end of file +var _0x846c=['setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','FreshdeskConfiguration','findAll','catch','show','rawAttributes','includeAll','include','options','find','create','body','params','getFields','FreshdeskField','order','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag'];(function(_0xa3c2dc,_0x46e0da){var _0x2f967c=function(_0x1db84e){while(--_0x1db84e){_0xa3c2dc['push'](_0xa3c2dc['shift']());}};_0x2f967c(++_0x46e0da);}(_0x846c,0x151));var _0xc846=function(_0xe0277e,_0x5096e2){_0xe0277e=_0xe0277e-0x0;var _0xfe4003=_0x846c[_0xe0277e];return _0xfe4003;};'use strict';var emlformat=require(_0xc846('0x0'));var rimraf=require(_0xc846('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc846('0x2'));var rp=require(_0xc846('0x3'));var moment=require(_0xc846('0x4'));var BPromise=require(_0xc846('0x5'));var Mustache=require(_0xc846('0x6'));var util=require('util');var path=require(_0xc846('0x7'));var sox=require(_0xc846('0x8'));var csv=require('to-csv');var ejs=require(_0xc846('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc846('0xa'));var crypto=require(_0xc846('0xb'));var jsforce=require(_0xc846('0xc'));var deskjs=require(_0xc846('0xd'));var toCsv=require(_0xc846('0xe'));var querystring=require(_0xc846('0xf'));var Papa=require(_0xc846('0x10'));var Redis=require('ioredis');var authService=require(_0xc846('0x11'));var qs=require(_0xc846('0x12'));var as=require(_0xc846('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc846('0x14'))(_0xc846('0x15'));var utils=require(_0xc846('0x16'));var config=require(_0xc846('0x17'));var licenseUtil=require(_0xc846('0x18'));var db=require(_0xc846('0x19'))['db'];function respondWithStatusCode(_0x50f93c,_0x28939){_0x28939=_0x28939||0xcc;return function(_0x4365ad){if(_0x4365ad){return _0x50f93c['sendStatus'](_0x28939);}return _0x50f93c[_0xc846('0x1a')](_0x28939)[_0xc846('0x1b')]();};}function respondWithResult(_0xe24491,_0x31f950){_0x31f950=_0x31f950||0xc8;return function(_0x3d9333){if(_0x3d9333){return _0xe24491[_0xc846('0x1a')](_0x31f950)[_0xc846('0x1c')](_0x3d9333);}};}function respondWithFilteredResult(_0x20ab0d,_0x4c06d3){return function(_0x812266){if(_0x812266){var _0x4b65dc=typeof _0x4c06d3[_0xc846('0x1d')]===_0xc846('0x1e')&&typeof _0x4c06d3['limit']==='undefined';var _0x3cfeef=_0x812266['count'];var _0x3b2dce=_0x4b65dc?0x0:_0x4c06d3[_0xc846('0x1d')];var _0x358c9b=_0x4b65dc?_0x812266[_0xc846('0x1f')]:_0x4c06d3['offset']+_0x4c06d3[_0xc846('0x20')];var _0x8d19a8;if(_0x358c9b>=_0x3cfeef){_0x358c9b=_0x3cfeef;_0x8d19a8=0xc8;}else{_0x8d19a8=0xce;}_0x20ab0d[_0xc846('0x1a')](_0x8d19a8);return _0x20ab0d[_0xc846('0x21')](_0xc846('0x22'),_0x3b2dce+'-'+_0x358c9b+'/'+_0x3cfeef)[_0xc846('0x1c')](_0x812266);}return null;};}function patchUpdates(_0x389e60){return function(_0x1ddab0){try{jsonpatch[_0xc846('0x23')](_0x1ddab0,_0x389e60,!![]);}catch(_0x4ec9e2){return BPromise[_0xc846('0x24')](_0x4ec9e2);}return _0x1ddab0[_0xc846('0x25')]();};}function saveUpdates(_0x76f72d,_0x3f00f9){return function(_0x2915ef){if(_0x2915ef){return _0x2915ef['update'](_0x76f72d)['then'](function(_0x2675ed){return _0x2675ed;});}return null;};}function removeEntity(_0x44f31d,_0xff1464){return function(_0x449501){if(_0x449501){return _0x449501[_0xc846('0x26')]()[_0xc846('0x27')](function(){_0x44f31d[_0xc846('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef608,_0xa43d44){return function(_0x314f57){if(!_0x314f57){_0x5ef608[_0xc846('0x28')](0x194);}return _0x314f57;};}function handleError(_0x48d359,_0x291782){_0x291782=_0x291782||0x1f4;return function(_0x491664){logger['error'](_0x491664['stack']);if(_0x491664[_0xc846('0x29')]){delete _0x491664[_0xc846('0x29')];}_0x48d359['status'](_0x291782)[_0xc846('0x2a')](_0x491664);};}exports[_0xc846('0x2b')]=function(_0x27b4a0,_0x5ecd99){var _0x453b12={},_0x19ba68={},_0x1b0c26={'count':0x0,'rows':[]};var _0x592ec2=_[_0xc846('0x2c')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x4450b8){return{'name':_0x4450b8['fieldName'],'type':_0x4450b8[_0xc846('0x2d')][_0xc846('0x2e')]};});_0x19ba68[_0xc846('0x2f')]=_[_0xc846('0x2c')](_0x592ec2,_0xc846('0x29'));_0x19ba68[_0xc846('0x30')]=_[_0xc846('0x31')](_0x27b4a0[_0xc846('0x30')]);_0x19ba68[_0xc846('0x32')]=_[_0xc846('0x33')](_0x19ba68['model'],_0x19ba68[_0xc846('0x30')]);_0x453b12[_0xc846('0x34')]=_[_0xc846('0x33')](_0x19ba68[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x35')]));_0x453b12[_0xc846('0x34')]=_0x453b12[_0xc846('0x34')][_0xc846('0x36')]?_0x453b12[_0xc846('0x34')]:_0x19ba68[_0xc846('0x2f')];if(!_0x27b4a0[_0xc846('0x30')][_0xc846('0x37')]('nolimit')){_0x453b12[_0xc846('0x20')]=qs[_0xc846('0x20')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x20')]);_0x453b12[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x1d')]);}_0x453b12['order']=qs[_0xc846('0x38')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x38')]);_0x453b12[_0xc846('0x39')]=qs[_0xc846('0x32')](_[_0xc846('0x3a')](_0x27b4a0[_0xc846('0x30')],_0x19ba68[_0xc846('0x32')]),_0x592ec2);if(_0x27b4a0[_0xc846('0x30')][_0xc846('0x3b')]){_0x453b12[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x453b12[_0xc846('0x39')],{'$or':_[_0xc846('0x2c')](_0x592ec2,function(_0x474cb3){if(_0x474cb3['type']!==_0xc846('0x3d')){var _0x3c1f01={};_0x3c1f01[_0x474cb3[_0xc846('0x29')]]={'$like':'%'+_0x27b4a0[_0xc846('0x30')][_0xc846('0x3b')]+'%'};return _0x3c1f01;}})});}_0x453b12=_[_0xc846('0x3c')]({},_0x453b12,_0x27b4a0['options']);var _0x573bc9={'where':_0x453b12[_0xc846('0x39')]};return db[_0xc846('0x3e')]['count'](_0x573bc9)[_0xc846('0x27')](function(_0x162943){_0x1b0c26[_0xc846('0x1f')]=_0x162943;if(_0x27b4a0[_0xc846('0x30')]['includeAll']){_0x453b12['include']=[{'all':!![]}];}return db[_0xc846('0x3e')][_0xc846('0x3f')](_0x453b12);})[_0xc846('0x27')](function(_0x45f068){_0x1b0c26['rows']=_0x45f068;return _0x1b0c26;})[_0xc846('0x27')](respondWithFilteredResult(_0x5ecd99,_0x453b12))[_0xc846('0x40')](handleError(_0x5ecd99,null));};exports[_0xc846('0x41')]=function(_0x219560,_0x132f0e){var _0x5c097a={'raw':![],'where':{'id':_0x219560['params']['id']}},_0x1c85be={};_0x1c85be[_0xc846('0x2f')]=_[_0xc846('0x31')](db[_0xc846('0x3e')][_0xc846('0x42')]);_0x1c85be['query']=_[_0xc846('0x31')](_0x219560['query']);_0x1c85be[_0xc846('0x32')]=_['intersection'](_0x1c85be['model'],_0x1c85be[_0xc846('0x30')]);_0x5c097a[_0xc846('0x34')]=_[_0xc846('0x33')](_0x1c85be[_0xc846('0x2f')],qs['fields'](_0x219560['query'][_0xc846('0x35')]));_0x5c097a[_0xc846('0x34')]=_0x5c097a[_0xc846('0x34')]['length']?_0x5c097a[_0xc846('0x34')]:_0x1c85be[_0xc846('0x2f')];if(_0x219560['query'][_0xc846('0x43')]){_0x5c097a[_0xc846('0x44')]=[{'all':!![]}];}_0x5c097a=_[_0xc846('0x3c')]({},_0x5c097a,_0x219560[_0xc846('0x45')]);return db['FreshdeskConfiguration'][_0xc846('0x46')](_0x5c097a)['then'](handleEntityNotFound(_0x132f0e,null))[_0xc846('0x27')](respondWithResult(_0x132f0e,null))[_0xc846('0x40')](handleError(_0x132f0e,null));};exports[_0xc846('0x47')]=function(_0x1f88b5,_0x38e95b){return db[_0xc846('0x3e')]['create'](_0x1f88b5['body'],{})[_0xc846('0x27')](respondWithResult(_0x38e95b,0xc9))[_0xc846('0x40')](handleError(_0x38e95b,null));};exports['update']=function(_0x207593,_0x5c5933){if(_0x207593[_0xc846('0x48')]['id']){delete _0x207593[_0xc846('0x48')]['id'];}return db[_0xc846('0x3e')]['find']({'where':{'id':_0x207593[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x5c5933,null))[_0xc846('0x27')](saveUpdates(_0x207593[_0xc846('0x48')],null))['then'](respondWithResult(_0x5c5933,null))[_0xc846('0x40')](handleError(_0x5c5933,null));};exports['destroy']=function(_0xbea8a7,_0x159327){return db['FreshdeskConfiguration'][_0xc846('0x46')]({'where':{'id':_0xbea8a7['params']['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x159327,null))[_0xc846('0x27')](removeEntity(_0x159327,null))['catch'](handleError(_0x159327,null));};exports[_0xc846('0x4a')]=function(_0xc26979,_0x29fc7d,_0x19fb44){var _0x375401={};var _0x1fc1f8={};var _0x3126db;var _0x4bd1c6;return db[_0xc846('0x3e')]['findOne']({'where':{'id':_0xc26979['params']['id']}})['then'](handleEntityNotFound(_0x29fc7d,null))[_0xc846('0x27')](function(_0x2532be){if(_0x2532be){_0x3126db=_0x2532be;_0x1fc1f8[_0xc846('0x2f')]=_['keys'](db[_0xc846('0x4b')]['rawAttributes']);_0x1fc1f8[_0xc846('0x30')]=_[_0xc846('0x31')](_0xc26979['query']);_0x1fc1f8[_0xc846('0x32')]=_[_0xc846('0x33')](_0x1fc1f8[_0xc846('0x2f')],_0x1fc1f8[_0xc846('0x30')]);_0x375401[_0xc846('0x34')]=_[_0xc846('0x33')](_0x1fc1f8[_0xc846('0x2f')],qs['fields'](_0xc26979[_0xc846('0x30')][_0xc846('0x35')]));_0x375401[_0xc846('0x34')]=_0x375401['attributes'][_0xc846('0x36')]?_0x375401['attributes']:_0x1fc1f8[_0xc846('0x2f')];_0x375401[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0xc26979[_0xc846('0x30')][_0xc846('0x38')]);_0x375401[_0xc846('0x39')]=qs[_0xc846('0x32')](_[_0xc846('0x3a')](_0xc26979['query'],_0x1fc1f8[_0xc846('0x32')]));if(_0xc26979[_0xc846('0x30')][_0xc846('0x3b')]){_0x375401[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x375401['where'],{'$or':_[_0xc846('0x2c')](_0x375401[_0xc846('0x34')],function(_0x5847e6){var _0x1bb281={};_0x1bb281[_0x5847e6]={'$like':'%'+_0xc26979[_0xc846('0x30')][_0xc846('0x3b')]+'%'};return _0x1bb281;})});}_0x375401=_[_0xc846('0x3c')]({},_0x375401,_0xc26979[_0xc846('0x45')]);return _0x3126db['getFields'](_0x375401);}})[_0xc846('0x27')](function(_0x1f61b0){if(_0x1f61b0){_0x4bd1c6=_0x1f61b0['length'];if(!_0xc26979[_0xc846('0x30')][_0xc846('0x37')](_0xc846('0x4d'))){_0x375401[_0xc846('0x20')]=qs[_0xc846('0x20')](_0xc26979[_0xc846('0x30')][_0xc846('0x20')]);_0x375401[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0xc26979[_0xc846('0x30')][_0xc846('0x1d')]);}return _0x3126db[_0xc846('0x4a')](_0x375401);}})[_0xc846('0x27')](function(_0x57ac9){if(_0x57ac9){return _0x57ac9?{'count':_0x4bd1c6,'rows':_0x57ac9}:null;}})[_0xc846('0x27')](respondWithResult(_0x29fc7d,null))[_0xc846('0x40')](handleError(_0x29fc7d,null));};exports[_0xc846('0x4e')]=function(_0x592007,_0x35b4b9,_0x278ef8){var _0x561435={};var _0x4ad87f={};var _0xfe07d5;var _0xe52d70;return db[_0xc846('0x3e')][_0xc846('0x4f')]({'where':{'id':_0x592007[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x35b4b9,null))[_0xc846('0x27')](function(_0x48cf06){if(_0x48cf06){_0xfe07d5=_0x48cf06;_0x4ad87f['model']=_[_0xc846('0x31')](db['FreshdeskField'][_0xc846('0x42')]);_0x4ad87f[_0xc846('0x30')]=_['keys'](_0x592007[_0xc846('0x30')]);_0x4ad87f[_0xc846('0x32')]=_[_0xc846('0x33')](_0x4ad87f[_0xc846('0x2f')],_0x4ad87f[_0xc846('0x30')]);_0x561435[_0xc846('0x34')]=_[_0xc846('0x33')](_0x4ad87f[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x592007['query'][_0xc846('0x35')]));_0x561435[_0xc846('0x34')]=_0x561435[_0xc846('0x34')][_0xc846('0x36')]?_0x561435['attributes']:_0x4ad87f[_0xc846('0x2f')];_0x561435[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0x592007[_0xc846('0x30')][_0xc846('0x38')]);_0x561435[_0xc846('0x39')]=qs['filters'](_[_0xc846('0x3a')](_0x592007[_0xc846('0x30')],_0x4ad87f[_0xc846('0x32')]));if(_0x592007[_0xc846('0x30')][_0xc846('0x3b')]){_0x561435[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x561435['where'],{'$or':_[_0xc846('0x2c')](_0x561435['attributes'],function(_0x385a46){var _0x10d74b={};_0x10d74b[_0x385a46]={'$like':'%'+_0x592007['query'][_0xc846('0x3b')]+'%'};return _0x10d74b;})});}_0x561435=_[_0xc846('0x3c')]({},_0x561435,_0x592007[_0xc846('0x45')]);return _0xfe07d5[_0xc846('0x4e')](_0x561435);}})[_0xc846('0x27')](function(_0x2114e3){if(_0x2114e3){_0xe52d70=_0x2114e3[_0xc846('0x36')];if(!_0x592007['query'][_0xc846('0x37')](_0xc846('0x4d'))){_0x561435[_0xc846('0x20')]=qs[_0xc846('0x20')](_0x592007[_0xc846('0x30')][_0xc846('0x20')]);_0x561435[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x592007[_0xc846('0x30')][_0xc846('0x1d')]);}return _0xfe07d5[_0xc846('0x4e')](_0x561435);}})[_0xc846('0x27')](function(_0x40332d){if(_0x40332d){return _0x40332d?{'count':_0xe52d70,'rows':_0x40332d}:null;}})[_0xc846('0x27')](respondWithResult(_0x35b4b9,null))[_0xc846('0x40')](handleError(_0x35b4b9,null));};exports[_0xc846('0x50')]=function(_0x2f4910,_0x5ce1d2,_0x2e8d93){var _0xc21772={};var _0x174254={};var _0x38a305;var _0x2e0734;return db[_0xc846('0x3e')][_0xc846('0x4f')]({'where':{'id':_0x2f4910[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x5ce1d2,null))[_0xc846('0x27')](function(_0x4be807){if(_0x4be807){_0x38a305=_0x4be807;_0x174254[_0xc846('0x2f')]=_[_0xc846('0x31')](db[_0xc846('0x4b')][_0xc846('0x42')]);_0x174254[_0xc846('0x30')]=_['keys'](_0x2f4910[_0xc846('0x30')]);_0x174254[_0xc846('0x32')]=_[_0xc846('0x33')](_0x174254[_0xc846('0x2f')],_0x174254[_0xc846('0x30')]);_0xc21772['attributes']=_['intersection'](_0x174254[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x2f4910[_0xc846('0x30')][_0xc846('0x35')]));_0xc21772[_0xc846('0x34')]=_0xc21772[_0xc846('0x34')][_0xc846('0x36')]?_0xc21772[_0xc846('0x34')]:_0x174254[_0xc846('0x2f')];_0xc21772[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0x2f4910[_0xc846('0x30')][_0xc846('0x38')]);_0xc21772[_0xc846('0x39')]=qs[_0xc846('0x32')](_['pick'](_0x2f4910[_0xc846('0x30')],_0x174254[_0xc846('0x32')]));if(_0x2f4910[_0xc846('0x30')][_0xc846('0x3b')]){_0xc21772[_0xc846('0x39')]=_[_0xc846('0x3c')](_0xc21772[_0xc846('0x39')],{'$or':_[_0xc846('0x2c')](_0xc21772[_0xc846('0x34')],function(_0x5ebe1e){var _0x44f803={};_0x44f803[_0x5ebe1e]={'$like':'%'+_0x2f4910['query'][_0xc846('0x3b')]+'%'};return _0x44f803;})});}_0xc21772=_[_0xc846('0x3c')]({},_0xc21772,_0x2f4910[_0xc846('0x45')]);return _0x38a305[_0xc846('0x50')](_0xc21772);}})['then'](function(_0x4eb917){if(_0x4eb917){_0x2e0734=_0x4eb917[_0xc846('0x36')];if(!_0x2f4910['query']['hasOwnProperty'](_0xc846('0x4d'))){_0xc21772['limit']=qs[_0xc846('0x20')](_0x2f4910[_0xc846('0x30')]['limit']);_0xc21772[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x2f4910[_0xc846('0x30')][_0xc846('0x1d')]);}return _0x38a305[_0xc846('0x50')](_0xc21772);}})[_0xc846('0x27')](function(_0x4d092e){if(_0x4d092e){return _0x4d092e?{'count':_0x2e0734,'rows':_0x4d092e}:null;}})[_0xc846('0x27')](respondWithResult(_0x5ce1d2,null))[_0xc846('0x40')](handleError(_0x5ce1d2,null));};exports[_0xc846('0x51')]=function(_0x3fa3fb,_0x3396ee,_0x4de1e0){var _0x31cb2b={};var _0x5ee324={};var _0xb88fb2;var _0x46ac28;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3fa3fb[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x3396ee,null))['then'](function(_0x1dd4ca){if(_0x1dd4ca){_0xb88fb2=_0x1dd4ca;_0x5ee324[_0xc846('0x2f')]=_[_0xc846('0x31')](db[_0xc846('0x52')]['rawAttributes']);_0x5ee324[_0xc846('0x30')]=_[_0xc846('0x31')](_0x3fa3fb['query']);_0x5ee324[_0xc846('0x32')]=_['intersection'](_0x5ee324[_0xc846('0x2f')],_0x5ee324[_0xc846('0x30')]);_0x31cb2b[_0xc846('0x34')]=_[_0xc846('0x33')](_0x5ee324[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x3fa3fb['query'][_0xc846('0x35')]));_0x31cb2b[_0xc846('0x34')]=_0x31cb2b[_0xc846('0x34')][_0xc846('0x36')]?_0x31cb2b[_0xc846('0x34')]:_0x5ee324[_0xc846('0x2f')];_0x31cb2b[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0x3fa3fb[_0xc846('0x30')][_0xc846('0x38')]);_0x31cb2b['where']=qs[_0xc846('0x32')](_['pick'](_0x3fa3fb[_0xc846('0x30')],_0x5ee324[_0xc846('0x32')]));if(_0x3fa3fb[_0xc846('0x30')][_0xc846('0x3b')]){_0x31cb2b[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x31cb2b[_0xc846('0x39')],{'$or':_[_0xc846('0x2c')](_0x31cb2b['attributes'],function(_0x38904a){var _0x29433e={};_0x29433e[_0x38904a]={'$like':'%'+_0x3fa3fb[_0xc846('0x30')]['filter']+'%'};return _0x29433e;})});}_0x31cb2b=_[_0xc846('0x3c')]({},_0x31cb2b,_0x3fa3fb['options']);return _0xb88fb2[_0xc846('0x51')](_0x31cb2b);}})[_0xc846('0x27')](function(_0x190d75){if(_0x190d75){_0x46ac28=_0x190d75['length'];if(!_0x3fa3fb['query'][_0xc846('0x37')](_0xc846('0x4d'))){_0x31cb2b['limit']=qs[_0xc846('0x20')](_0x3fa3fb[_0xc846('0x30')][_0xc846('0x20')]);_0x31cb2b[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x3fa3fb[_0xc846('0x30')][_0xc846('0x1d')]);}return _0xb88fb2[_0xc846('0x51')](_0x31cb2b);}})[_0xc846('0x27')](function(_0x5e1cc6){if(_0x5e1cc6){return _0x5e1cc6?{'count':_0x46ac28,'rows':_0x5e1cc6}:null;}})[_0xc846('0x27')](respondWithResult(_0x3396ee,null))['catch'](handleError(_0x3396ee,null));};exports[_0xc846('0x53')]=function(_0x4e8bbb,_0xca5795,_0x263e55){if(_0x4e8bbb[_0xc846('0x48')]['id']){delete _0x4e8bbb[_0xc846('0x48')]['id'];}return db[_0xc846('0x3e')][_0xc846('0x4f')]({'where':{'id':_0x4e8bbb[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0xca5795,null))['then'](function(_0xdd217d){if(_0xdd217d){return _0xdd217d['setTags'](_0x4e8bbb[_0xc846('0x48')]['ids']||[]);}return null;})[_0xc846('0x27')](respondWithResult(_0xca5795,null))['catch'](handleError(_0xca5795,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 321b4e2..2cb33e7 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 _0x2595=['int_freshdesk_configurations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x2fa8e5,_0x4d47f0){var _0x2c671b=function(_0x2d4834){while(--_0x2d4834){_0x2fa8e5['push'](_0x2fa8e5['shift']());}};_0x2c671b(++_0x4d47f0);}(_0x2595,0x76));var _0x5259=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x2595[_0x3181cc];return _0x547a4a;};'use strict';var _=require('lodash');var util=require(_0x5259('0x0'));var logger=require(_0x5259('0x1'))('api');var moment=require(_0x5259('0x2'));var BPromise=require(_0x5259('0x3'));var rp=require(_0x5259('0x4'));var fs=require('fs');var path=require(_0x5259('0x5'));var rimraf=require(_0x5259('0x6'));var config=require(_0x5259('0x7'));var attributes=require(_0x5259('0x8'));module[_0x5259('0x9')]=function(_0x1a234c,_0x5e1194){return _0x1a234c[_0x5259('0xa')](_0x5259('0xb'),attributes,{'tableName':_0x5259('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcba3=['rimraf','../../config/environment','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird','request-promise','path'];(function(_0x726a6b,_0x43cb31){var _0x51733d=function(_0x22fdc5){while(--_0x22fdc5){_0x726a6b['push'](_0x726a6b['shift']());}};_0x51733d(++_0x43cb31);}(_0xcba3,0xb8));var _0x3cba=function(_0x574b5d,_0x517954){_0x574b5d=_0x574b5d-0x0;var _0x1dc2c9=_0xcba3[_0x574b5d];return _0x1dc2c9;};'use strict';var _=require(_0x3cba('0x0'));var util=require(_0x3cba('0x1'));var logger=require('../../config/logger')(_0x3cba('0x2'));var moment=require('moment');var BPromise=require(_0x3cba('0x3'));var rp=require(_0x3cba('0x4'));var fs=require('fs');var path=require(_0x3cba('0x5'));var rimraf=require(_0x3cba('0x6'));var config=require(_0x3cba('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x310834,_0x3c5b07){return _0x310834['define'](_0x3cba('0x8'),attributes,{'tableName':_0x3cba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 43c5b2f..6385c1c 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 _0x946b=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x7dfd37,_0x6a8efc){var _0x4cf35b=function(_0x584ede){while(--_0x584ede){_0x7dfd37['push'](_0x7dfd37['shift']());}};_0x4cf35b(++_0x6a8efc);}(_0x946b,0x7e));var _0xb946=function(_0x50faae,_0x519149){_0x50faae=_0x50faae-0x0;var _0x18cd6d=_0x946b[_0x50faae];return _0x18cd6d;};'use strict';var _=require(_0xb946('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb946('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb946('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb946('0x3'))('rpc');var config=require(_0xb946('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb946('0x5')][_0xb946('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2e3024,_0x2b73fd,_0x50646d){return new BPromise(function(_0x78194d,_0x22e71a){return client[_0xb946('0x7')](_0x2e3024,_0x50646d)[_0xb946('0x8')](function(_0x3523e6){logger[_0xb946('0x9')](_0xb946('0xa'),_0x2b73fd,_0xb946('0xb'));logger[_0xb946('0xc')](_0xb946('0xd'),_0x2b73fd,_0xb946('0xb'),JSON[_0xb946('0xe')](_0x3523e6));if(_0x3523e6[_0xb946('0xf')]){if(_0x3523e6[_0xb946('0xf')][_0xb946('0x10')]===0x1f4){logger[_0xb946('0xf')](_0xb946('0xa'),_0x2b73fd,_0x3523e6[_0xb946('0xf')][_0xb946('0x11')]);return _0x22e71a(_0x3523e6['error'][_0xb946('0x11')]);}logger[_0xb946('0xf')](_0xb946('0xa'),_0x2b73fd,_0x3523e6[_0xb946('0xf')][_0xb946('0x11')]);return _0x78194d(_0x3523e6[_0xb946('0xf')][_0xb946('0x11')]);}else{logger[_0xb946('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2b73fd,_0xb946('0xb'));_0x78194d(_0x3523e6['result'][_0xb946('0x11')]);}})[_0xb946('0x12')](function(_0x2309e1){logger[_0xb946('0xf')](_0xb946('0xa'),_0x2b73fd,_0x2309e1);_0x22e71a(_0x2309e1);});});} \ No newline at end of file +var _0x7a71=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x8a4f9f,_0x12b10f){var _0x5a5710=function(_0x1501b4){while(--_0x1501b4){_0x8a4f9f['push'](_0x8a4f9f['shift']());}};_0x5a5710(++_0x12b10f);}(_0x7a71,0xc7));var _0x17a7=function(_0xeb79bb,_0x5683a7){_0xeb79bb=_0xeb79bb-0x0;var _0x5c509e=_0x7a71[_0xeb79bb];return _0x5c509e;};'use strict';var _=require('lodash');var util=require(_0x17a7('0x0'));var moment=require(_0x17a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x17a7('0x2'));var fs=require('fs');var Redis=require(_0x17a7('0x3'));var db=require(_0x17a7('0x4'))['db'];var utils=require(_0x17a7('0x5'));var logger=require(_0x17a7('0x6'))(_0x17a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x17a7('0x8'));var client=jayson[_0x17a7('0x9')][_0x17a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x887972,_0x507d2c,_0x123ba4){return new BPromise(function(_0x4956d5,_0x5f01c5){return client[_0x17a7('0xb')](_0x887972,_0x123ba4)[_0x17a7('0xc')](function(_0x26994b){logger[_0x17a7('0xd')](_0x17a7('0xe'),_0x507d2c,'request\x20sent');logger[_0x17a7('0xf')](_0x17a7('0x10'),_0x507d2c,_0x17a7('0x11'),JSON[_0x17a7('0x12')](_0x26994b));if(_0x26994b[_0x17a7('0x13')]){if(_0x26994b['error']['code']===0x1f4){logger[_0x17a7('0x13')](_0x17a7('0xe'),_0x507d2c,_0x26994b[_0x17a7('0x13')][_0x17a7('0x14')]);return _0x5f01c5(_0x26994b[_0x17a7('0x13')][_0x17a7('0x14')]);}logger[_0x17a7('0x13')](_0x17a7('0xe'),_0x507d2c,_0x26994b['error'][_0x17a7('0x14')]);return _0x4956d5(_0x26994b['error'][_0x17a7('0x14')]);}else{logger[_0x17a7('0xd')](_0x17a7('0xe'),_0x507d2c,_0x17a7('0x11'));_0x4956d5(_0x26994b['result']['message']);}})['catch'](function(_0x4178ef){logger[_0x17a7('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x507d2c,_0x4178ef);_0x5f01c5(_0x4178ef);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index bec4caf..0b72be4 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 _0xab64=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x42fa22,_0x2f068c){var _0x3e0056=function(_0x47edbb){while(--_0x47edbb){_0x42fa22['push'](_0x42fa22['shift']());}};_0x3e0056(++_0x2f068c);}(_0xab64,0x1de));var _0x4ab6=function(_0x206a56,_0x5b8cf3){_0x206a56=_0x206a56-0x0;var _0x50bd86=_0xab64[_0x206a56];return _0x50bd86;};'use strict';var multer=require(_0x4ab6('0x0'));var util=require(_0x4ab6('0x1'));var path=require(_0x4ab6('0x2'));var timeout=require(_0x4ab6('0x3'));var express=require(_0x4ab6('0x4'));var router=express[_0x4ab6('0x5')]();var fs_extra=require(_0x4ab6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4ab6('0x7'));var config=require(_0x4ab6('0x8'));var controller=require(_0x4ab6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4ab6('0xa')]);router[_0x4ab6('0xb')](_0x4ab6('0xc'),auth['isAuthenticated'](),controller[_0x4ab6('0xd')]);router[_0x4ab6('0xe')]('/',auth[_0x4ab6('0xf')](),controller[_0x4ab6('0x10')]);router[_0x4ab6('0x11')]('/:id',auth[_0x4ab6('0xf')](),controller[_0x4ab6('0x12')]);router[_0x4ab6('0x13')](_0x4ab6('0xc'),auth[_0x4ab6('0xf')](),controller[_0x4ab6('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa37c=['isAuthenticated','index','/:id','show','post','delete','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xa37c,0x1ab));var _0xca37=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0xa37c[_0x476c7];return _0x47ae56;};'use strict';var multer=require(_0xca37('0x0'));var util=require(_0xca37('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca37('0x2')]();var fs_extra=require(_0xca37('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xca37('0x4'));var config=require(_0xca37('0x5'));var controller=require(_0xca37('0x6'));router[_0xca37('0x7')]('/',auth[_0xca37('0x8')](),controller[_0xca37('0x9')]);router['get'](_0xca37('0xa'),auth['isAuthenticated'](),controller[_0xca37('0xb')]);router[_0xca37('0xc')]('/',auth[_0xca37('0x8')](),controller['create']);router['put'](_0xca37('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xca37('0xd')]('/:id',auth[_0xca37('0x8')](),controller['destroy']);module[_0xca37('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 090dd9c..71d6776 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 _0x5fe4=['STRING','customVariable','sequelize','exports','string','variable','keyValue','picklist'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5fe4,0x18a));var _0x45fe=function(_0x6f479e,_0x4a59e7){_0x6f479e=_0x6f479e-0x0;var _0x2a773b=_0x5fe4[_0x6f479e];return _0x2a773b;};'use strict';var Sequelize=require(_0x45fe('0x0'));module[_0x45fe('0x1')]={'type':{'type':Sequelize['ENUM'](_0x45fe('0x2'),_0x45fe('0x3'),'customVariable',_0x45fe('0x4'),_0x45fe('0x5')),'defaultValue':_0x45fe('0x2')},'content':{'type':Sequelize[_0x45fe('0x6')]},'key':{'type':Sequelize[_0x45fe('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x45fe('0x7'))},'keyContent':{'type':Sequelize[_0x45fe('0x6')]},'idField':{'type':Sequelize[_0x45fe('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45fe('0x6')]}}; \ No newline at end of file +var _0x4b4c=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x4b4c,0x76));var _0xc4b4=function(_0x6e7593,_0xd331aa){_0x6e7593=_0x6e7593-0x0;var _0x1da0b5=_0x4b4c[_0x6e7593];return _0x1da0b5;};'use strict';var Sequelize=require(_0xc4b4('0x0'));module[_0xc4b4('0x1')]={'type':{'type':Sequelize[_0xc4b4('0x2')](_0xc4b4('0x3'),_0xc4b4('0x4'),_0xc4b4('0x5'),_0xc4b4('0x6'),_0xc4b4('0x7')),'defaultValue':_0xc4b4('0x3')},'content':{'type':Sequelize[_0xc4b4('0x8')]},'key':{'type':Sequelize[_0xc4b4('0x8')]},'keyType':{'type':Sequelize[_0xc4b4('0x2')](_0xc4b4('0x3'),_0xc4b4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc4b4('0x8')]},'idField':{'type':Sequelize[_0xc4b4('0x8')]},'nameField':{'type':Sequelize[_0xc4b4('0x8')]},'customField':{'type':Sequelize[_0xc4b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4b4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 19f96ac..2b1481f 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 _0xfe57=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','name','send','map','FreshdeskField','fieldName','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','destroy','eml-format','rimraf','request-promise'];(function(_0x3b4957,_0x29c67a){var _0x3a5bc=function(_0x1f39b8){while(--_0x1f39b8){_0x3b4957['push'](_0x3b4957['shift']());}};_0x3a5bc(++_0x29c67a);}(_0xfe57,0x195));var _0x7fe5=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xfe57[_0x519756];return _0x37047e;};'use strict';var emlformat=require(_0x7fe5('0x0'));var rimraf=require(_0x7fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var Mustache=require(_0x7fe5('0x5'));var util=require(_0x7fe5('0x6'));var path=require(_0x7fe5('0x7'));var sox=require(_0x7fe5('0x8'));var csv=require(_0x7fe5('0x9'));var ejs=require(_0x7fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe5('0xb'));var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=typeof _0x39f175[_0x7fe5('0x1b')]===_0x7fe5('0x1c')&&typeof _0x39f175[_0x7fe5('0x1d')]==='undefined';var _0x166e23=_0x221ab2[_0x7fe5('0x1e')];var _0x340d5e=_0xbdf0a4?0x0:_0x39f175[_0x7fe5('0x1b')];var _0x2533db=_0xbdf0a4?_0x221ab2[_0x7fe5('0x1e')]:_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1d')];var _0x478523;if(_0x2533db>=_0x166e23){_0x2533db=_0x166e23;_0x478523=0xc8;}else{_0x478523=0xce;}_0x56e76f[_0x7fe5('0x1f')](_0x478523);return _0x56e76f['set']('Content-Range',_0x340d5e+'-'+_0x2533db+'/'+_0x166e23)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x459c2d){return function(_0x2f6592){try{jsonpatch[_0x7fe5('0x20')](_0x2f6592,_0x459c2d,!![]);}catch(_0x39c560){return BPromise[_0x7fe5('0x21')](_0x39c560);}return _0x2f6592[_0x7fe5('0x22')]();};}function saveUpdates(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x23')](_0xdd9df7)[_0x7fe5('0x24')](function(_0x54ee98){return _0x54ee98;});}return null;};}function removeEntity(_0x3e7340,_0x2f39e0){return function(_0x43e547){if(_0x43e547){return _0x43e547['destroy']()[_0x7fe5('0x24')](function(){_0x3e7340['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x53f522,_0x5c3b37){return function(_0x190355){if(!_0x190355){_0x53f522[_0x7fe5('0x18')](0x194);}return _0x190355;};}function handleError(_0x2a96f4,_0x399c55){_0x399c55=_0x399c55||0x1f4;return function(_0x4393c3){logger['error'](_0x4393c3['stack']);if(_0x4393c3[_0x7fe5('0x25')]){delete _0x4393c3[_0x7fe5('0x25')];}_0x2a96f4[_0x7fe5('0x1f')](_0x399c55)[_0x7fe5('0x26')](_0x4393c3);};}exports['index']=function(_0x46f816,_0x4a77e9){var _0x150ab9={},_0x1420de={},_0x204bc8={'count':0x0,'rows':[]};var _0x28a689=_[_0x7fe5('0x27')](db[_0x7fe5('0x28')]['rawAttributes'],function(_0xe521c6){return{'name':_0xe521c6[_0x7fe5('0x29')],'type':_0xe521c6['type'][_0x7fe5('0x2a')]};});_0x1420de[_0x7fe5('0x2b')]=_[_0x7fe5('0x27')](_0x28a689,_0x7fe5('0x25'));_0x1420de[_0x7fe5('0x2c')]=_['keys'](_0x46f816['query']);_0x1420de[_0x7fe5('0x2d')]=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],_0x1420de[_0x7fe5('0x2c')]);_0x150ab9['attributes']=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],qs[_0x7fe5('0x2f')](_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x2f')]));_0x150ab9[_0x7fe5('0x30')]=_0x150ab9['attributes'][_0x7fe5('0x31')]?_0x150ab9[_0x7fe5('0x30')]:_0x1420de[_0x7fe5('0x2b')];if(!_0x46f816[_0x7fe5('0x2c')]['hasOwnProperty']('nolimit')){_0x150ab9[_0x7fe5('0x1d')]=qs['limit'](_0x46f816[_0x7fe5('0x2c')]['limit']);_0x150ab9[_0x7fe5('0x1b')]=qs['offset'](_0x46f816['query']['offset']);}_0x150ab9['order']=qs[_0x7fe5('0x32')](_0x46f816[_0x7fe5('0x2c')]['sort']);_0x150ab9[_0x7fe5('0x33')]=qs[_0x7fe5('0x2d')](_['pick'](_0x46f816[_0x7fe5('0x2c')],_0x1420de['filters']),_0x28a689);if(_0x46f816['query'][_0x7fe5('0x34')]){_0x150ab9[_0x7fe5('0x33')]=_[_0x7fe5('0x35')](_0x150ab9[_0x7fe5('0x33')],{'$or':_[_0x7fe5('0x27')](_0x28a689,function(_0x4c4b05){if(_0x4c4b05[_0x7fe5('0x36')]!==_0x7fe5('0x37')){var _0x5839b2={};_0x5839b2[_0x4c4b05[_0x7fe5('0x25')]]={'$like':'%'+_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x34')]+'%'};return _0x5839b2;}})});}_0x150ab9=_[_0x7fe5('0x35')]({},_0x150ab9,_0x46f816[_0x7fe5('0x38')]);var _0x1c81c8={'where':_0x150ab9[_0x7fe5('0x33')]};return db['FreshdeskField']['count'](_0x1c81c8)[_0x7fe5('0x24')](function(_0x5f5db0){_0x204bc8[_0x7fe5('0x1e')]=_0x5f5db0;if(_0x46f816[_0x7fe5('0x2c')]['includeAll']){_0x150ab9[_0x7fe5('0x39')]=[{'all':!![]}];}return db[_0x7fe5('0x28')][_0x7fe5('0x3a')](_0x150ab9);})[_0x7fe5('0x24')](function(_0x2fd004){_0x204bc8[_0x7fe5('0x3b')]=_0x2fd004;return _0x204bc8;})[_0x7fe5('0x24')](respondWithFilteredResult(_0x4a77e9,_0x150ab9))['catch'](handleError(_0x4a77e9,null));};exports['show']=function(_0x411002,_0x4f81ca){var _0xad0b05={'raw':!![],'where':{'id':_0x411002[_0x7fe5('0x3c')]['id']}},_0x1a3e0d={};_0x1a3e0d[_0x7fe5('0x2b')]=_['keys'](db[_0x7fe5('0x28')]['rawAttributes']);_0x1a3e0d['query']=_[_0x7fe5('0x3d')](_0x411002[_0x7fe5('0x2c')]);_0x1a3e0d['filters']=_[_0x7fe5('0x2e')](_0x1a3e0d[_0x7fe5('0x2b')],_0x1a3e0d[_0x7fe5('0x2c')]);_0xad0b05[_0x7fe5('0x30')]=_[_0x7fe5('0x2e')](_0x1a3e0d['model'],qs[_0x7fe5('0x2f')](_0x411002[_0x7fe5('0x2c')]['fields']));_0xad0b05[_0x7fe5('0x30')]=_0xad0b05[_0x7fe5('0x30')][_0x7fe5('0x31')]?_0xad0b05[_0x7fe5('0x30')]:_0x1a3e0d['model'];if(_0x411002[_0x7fe5('0x2c')][_0x7fe5('0x3e')]){_0xad0b05[_0x7fe5('0x39')]=[{'all':!![]}];}_0xad0b05=_['merge']({},_0xad0b05,_0x411002[_0x7fe5('0x38')]);return db[_0x7fe5('0x28')][_0x7fe5('0x3f')](_0xad0b05)['then'](handleEntityNotFound(_0x4f81ca,null))[_0x7fe5('0x24')](respondWithResult(_0x4f81ca,null))[_0x7fe5('0x40')](handleError(_0x4f81ca,null));};exports[_0x7fe5('0x41')]=function(_0x4b8642,_0x19c4a6){return db[_0x7fe5('0x28')][_0x7fe5('0x41')](_0x4b8642[_0x7fe5('0x42')],{})[_0x7fe5('0x24')](respondWithResult(_0x19c4a6,0xc9))[_0x7fe5('0x40')](handleError(_0x19c4a6,null));};exports[_0x7fe5('0x23')]=function(_0x447b57,_0x446f01){if(_0x447b57[_0x7fe5('0x42')]['id']){delete _0x447b57[_0x7fe5('0x42')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x447b57['params']['id']}})['then'](handleEntityNotFound(_0x446f01,null))[_0x7fe5('0x24')](saveUpdates(_0x447b57['body'],null))[_0x7fe5('0x24')](respondWithResult(_0x446f01,null))[_0x7fe5('0x40')](handleError(_0x446f01,null));};exports[_0x7fe5('0x43')]=function(_0x1d9ca8,_0x362f33){return db['FreshdeskField'][_0x7fe5('0x3f')]({'where':{'id':_0x1d9ca8[_0x7fe5('0x3c')]['id']}})[_0x7fe5('0x24')](handleEntityNotFound(_0x362f33,null))[_0x7fe5('0x24')](removeEntity(_0x362f33,null))[_0x7fe5('0x40')](handleError(_0x362f33,null));}; \ No newline at end of file +var _0x7d98=['pick','filter','merge','where','include','FreshdeskField','findAll','rows','show','rawAttributes','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','name','send','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x7d98,0xe7));var _0x87d9=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x7d98[_0x128bef];return _0x1ba862;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x340462,_0x3641c8){return function(_0x32b83f){if(!_0x32b83f){_0x340462['sendStatus'](0x194);}return _0x32b83f;};}function handleError(_0x8b1ab7,_0x600404){_0x600404=_0x600404||0x1f4;return function(_0x2f63fa){logger[_0x87d9('0x27')](_0x2f63fa['stack']);if(_0x2f63fa[_0x87d9('0x28')]){delete _0x2f63fa[_0x87d9('0x28')];}_0x8b1ab7[_0x87d9('0x1a')](_0x600404)[_0x87d9('0x29')](_0x2f63fa);};}exports['index']=function(_0x21916a,_0x3c0283){var _0x501c5={},_0x5e1b55={},_0x1d04a9={'count':0x0,'rows':[]};var _0x22a401=_['map'](db['FreshdeskField']['rawAttributes'],function(_0x31122b){return{'name':_0x31122b[_0x87d9('0x2a')],'type':_0x31122b['type'][_0x87d9('0x2b')]};});_0x5e1b55['model']=_[_0x87d9('0x2c')](_0x22a401,'name');_0x5e1b55[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x21916a['query']);_0x5e1b55[_0x87d9('0x2f')]=_['intersection'](_0x5e1b55[_0x87d9('0x30')],_0x5e1b55[_0x87d9('0x2d')]);_0x501c5[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x5e1b55[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x21916a['query'][_0x87d9('0x33')]));_0x501c5[_0x87d9('0x31')]=_0x501c5[_0x87d9('0x31')][_0x87d9('0x34')]?_0x501c5[_0x87d9('0x31')]:_0x5e1b55[_0x87d9('0x30')];if(!_0x21916a[_0x87d9('0x2d')][_0x87d9('0x35')](_0x87d9('0x36'))){_0x501c5['limit']=qs[_0x87d9('0x1d')](_0x21916a[_0x87d9('0x2d')][_0x87d9('0x1d')]);_0x501c5[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x21916a['query'][_0x87d9('0x1f')]);}_0x501c5[_0x87d9('0x37')]=qs[_0x87d9('0x38')](_0x21916a['query'][_0x87d9('0x38')]);_0x501c5['where']=qs[_0x87d9('0x2f')](_[_0x87d9('0x39')](_0x21916a[_0x87d9('0x2d')],_0x5e1b55[_0x87d9('0x2f')]),_0x22a401);if(_0x21916a['query'][_0x87d9('0x3a')]){_0x501c5['where']=_[_0x87d9('0x3b')](_0x501c5[_0x87d9('0x3c')],{'$or':_[_0x87d9('0x2c')](_0x22a401,function(_0x1af8eb){if(_0x1af8eb['type']!=='VIRTUAL'){var _0x2063de={};_0x2063de[_0x1af8eb['name']]={'$like':'%'+_0x21916a[_0x87d9('0x2d')]['filter']+'%'};return _0x2063de;}})});}_0x501c5=_[_0x87d9('0x3b')]({},_0x501c5,_0x21916a['options']);var _0xdf56e8={'where':_0x501c5[_0x87d9('0x3c')]};return db['FreshdeskField'][_0x87d9('0x1e')](_0xdf56e8)['then'](function(_0x4bc1ba){_0x1d04a9['count']=_0x4bc1ba;if(_0x21916a[_0x87d9('0x2d')]['includeAll']){_0x501c5[_0x87d9('0x3d')]=[{'all':!![]}];}return db[_0x87d9('0x3e')][_0x87d9('0x3f')](_0x501c5);})['then'](function(_0x915f05){_0x1d04a9[_0x87d9('0x40')]=_0x915f05;return _0x1d04a9;})[_0x87d9('0x25')](respondWithFilteredResult(_0x3c0283,_0x501c5))['catch'](handleError(_0x3c0283,null));};exports[_0x87d9('0x41')]=function(_0x58ec85,_0x5c2db5){var _0x59338e={'raw':!![],'where':{'id':_0x58ec85['params']['id']}},_0x39e807={};_0x39e807['model']=_[_0x87d9('0x2e')](db[_0x87d9('0x3e')][_0x87d9('0x42')]);_0x39e807[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x58ec85['query']);_0x39e807[_0x87d9('0x2f')]=_[_0x87d9('0x32')](_0x39e807['model'],_0x39e807['query']);_0x59338e[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x39e807[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x58ec85[_0x87d9('0x2d')][_0x87d9('0x33')]));_0x59338e[_0x87d9('0x31')]=_0x59338e[_0x87d9('0x31')]['length']?_0x59338e[_0x87d9('0x31')]:_0x39e807[_0x87d9('0x30')];if(_0x58ec85['query']['includeAll']){_0x59338e[_0x87d9('0x3d')]=[{'all':!![]}];}_0x59338e=_[_0x87d9('0x3b')]({},_0x59338e,_0x58ec85['options']);return db[_0x87d9('0x3e')]['find'](_0x59338e)['then'](handleEntityNotFound(_0x5c2db5,null))['then'](respondWithResult(_0x5c2db5,null))['catch'](handleError(_0x5c2db5,null));};exports[_0x87d9('0x43')]=function(_0x101446,_0x533a74){return db[_0x87d9('0x3e')][_0x87d9('0x43')](_0x101446[_0x87d9('0x44')],{})['then'](respondWithResult(_0x533a74,0xc9))[_0x87d9('0x45')](handleError(_0x533a74,null));};exports[_0x87d9('0x24')]=function(_0x2d4766,_0x384273){if(_0x2d4766[_0x87d9('0x44')]['id']){delete _0x2d4766[_0x87d9('0x44')]['id'];}return db['FreshdeskField'][_0x87d9('0x46')]({'where':{'id':_0x2d4766['params']['id']}})['then'](handleEntityNotFound(_0x384273,null))[_0x87d9('0x25')](saveUpdates(_0x2d4766[_0x87d9('0x44')],null))[_0x87d9('0x25')](respondWithResult(_0x384273,null))[_0x87d9('0x45')](handleError(_0x384273,null));};exports[_0x87d9('0x26')]=function(_0x4fdfa9,_0x4558f5){return db[_0x87d9('0x3e')][_0x87d9('0x46')]({'where':{'id':_0x4fdfa9[_0x87d9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4558f5,null))[_0x87d9('0x25')](removeEntity(_0x4558f5,null))[_0x87d9('0x45')](handleError(_0x4558f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 897caed..4016a04 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 _0xf886=['../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','util','moment','bluebird','request-promise','rimraf'];(function(_0x4ece3f,_0x546aa3){var _0x25fcd8=function(_0x36ff33){while(--_0x36ff33){_0x4ece3f['push'](_0x4ece3f['shift']());}};_0x25fcd8(++_0x546aa3);}(_0xf886,0xc3));var _0x6f88=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0xf886[_0x40b2ed];return _0x18397d;};'use strict';var _=require('lodash');var util=require(_0x6f88('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6f88('0x1'));var BPromise=require(_0x6f88('0x2'));var rp=require(_0x6f88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f88('0x4'));var config=require(_0x6f88('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x6f88('0x6')]=function(_0x208c61,_0x5df046){return _0x208c61[_0x6f88('0x7')](_0x6f88('0x8'),attributes,{'tableName':_0x6f88('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfc9=['./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x295f38,_0x227ab8){var _0x4690f1=function(_0x4e85c7){while(--_0x4e85c7){_0x295f38['push'](_0x295f38['shift']());}};_0x4690f1(++_0x227ab8);}(_0xbfc9,0x173));var _0x9bfc=function(_0x582551,_0xd79827){_0x582551=_0x582551-0x0;var _0x2dd835=_0xbfc9[_0x582551];return _0x2dd835;};'use strict';var _=require(_0x9bfc('0x0'));var util=require(_0x9bfc('0x1'));var logger=require('../../config/logger')(_0x9bfc('0x2'));var moment=require('moment');var BPromise=require(_0x9bfc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bfc('0x4'));var rimraf=require(_0x9bfc('0x5'));var config=require(_0x9bfc('0x6'));var attributes=require(_0x9bfc('0x7'));module['exports']=function(_0x34b4ab,_0x277959){return _0x34b4ab[_0x9bfc('0x8')](_0x9bfc('0x9'),attributes,{'tableName':_0x9bfc('0xa'),'paranoid':![],'indexes':[{'name':_0x9bfc('0xb'),'fields':[_0x9bfc('0xc'),_0x9bfc('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 d71fa84..def19ea 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 _0xa5e7=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1067f5,_0xed39cf){var _0x86052a=function(_0x4722fe){while(--_0x4722fe){_0x1067f5['push'](_0x1067f5['shift']());}};_0x86052a(++_0xed39cf);}(_0xa5e7,0x138));var _0x7a5e=function(_0x3661ae,_0x3add37){_0x3661ae=_0x3661ae-0x0;var _0x298c5b=_0xa5e7[_0x3661ae];return _0x298c5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a5e('0x0'));var BPromise=require('bluebird');var rs=require(_0x7a5e('0x1'));var fs=require('fs');var Redis=require(_0x7a5e('0x2'));var db=require(_0x7a5e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a5e('0x4'))('rpc');var config=require(_0x7a5e('0x5'));var jayson=require(_0x7a5e('0x6'));var client=jayson[_0x7a5e('0x7')][_0x7a5e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29d8cf,_0x3ad011,_0x25ae62){return new BPromise(function(_0x2a5a7c,_0x481d12){return client[_0x7a5e('0x9')](_0x29d8cf,_0x25ae62)[_0x7a5e('0xa')](function(_0x39e157){logger[_0x7a5e('0xb')](_0x7a5e('0xc'),_0x3ad011,_0x7a5e('0xd'));logger['debug'](_0x7a5e('0xe'),_0x3ad011,_0x7a5e('0xd'),JSON['stringify'](_0x39e157));if(_0x39e157['error']){if(_0x39e157[_0x7a5e('0xf')][_0x7a5e('0x10')]===0x1f4){logger[_0x7a5e('0xf')](_0x7a5e('0xc'),_0x3ad011,_0x39e157[_0x7a5e('0xf')][_0x7a5e('0x11')]);return _0x481d12(_0x39e157[_0x7a5e('0xf')][_0x7a5e('0x11')]);}logger[_0x7a5e('0xf')](_0x7a5e('0xc'),_0x3ad011,_0x39e157[_0x7a5e('0xf')][_0x7a5e('0x11')]);return _0x2a5a7c(_0x39e157[_0x7a5e('0xf')][_0x7a5e('0x11')]);}else{logger[_0x7a5e('0xb')](_0x7a5e('0xc'),_0x3ad011,_0x7a5e('0xd'));_0x2a5a7c(_0x39e157[_0x7a5e('0x12')]['message']);}})[_0x7a5e('0x13')](function(_0x48f1e1){logger[_0x7a5e('0xf')](_0x7a5e('0xc'),_0x3ad011,_0x48f1e1);_0x481d12(_0x48f1e1);});});} \ No newline at end of file +var _0x64d7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','util','moment'];(function(_0x5cb5e6,_0x46722c){var _0x1093ac=function(_0x5e830d){while(--_0x5e830d){_0x5cb5e6['push'](_0x5cb5e6['shift']());}};_0x1093ac(++_0x46722c);}(_0x64d7,0x91));var _0x764d=function(_0x2610f9,_0x531c0b){_0x2610f9=_0x2610f9-0x0;var _0x553bc1=_0x64d7[_0x2610f9];return _0x553bc1;};'use strict';var _=require('lodash');var util=require(_0x764d('0x0'));var moment=require(_0x764d('0x1'));var BPromise=require(_0x764d('0x2'));var rs=require(_0x764d('0x3'));var fs=require('fs');var Redis=require(_0x764d('0x4'));var db=require(_0x764d('0x5'))['db'];var utils=require(_0x764d('0x6'));var logger=require(_0x764d('0x7'))(_0x764d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x764d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b989d,_0x40fe04,_0x3b5822){return new BPromise(function(_0x2a6bd8,_0x5cbee3){return client[_0x764d('0xa')](_0x3b989d,_0x3b5822)[_0x764d('0xb')](function(_0x3cb7db){logger['info'](_0x764d('0xc'),_0x40fe04,'request\x20sent');logger[_0x764d('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x40fe04,_0x764d('0xe'),JSON[_0x764d('0xf')](_0x3cb7db));if(_0x3cb7db['error']){if(_0x3cb7db[_0x764d('0x10')][_0x764d('0x11')]===0x1f4){logger[_0x764d('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x40fe04,_0x3cb7db[_0x764d('0x10')]['message']);return _0x5cbee3(_0x3cb7db[_0x764d('0x10')][_0x764d('0x12')]);}logger[_0x764d('0x10')](_0x764d('0xc'),_0x40fe04,_0x3cb7db[_0x764d('0x10')]['message']);return _0x2a6bd8(_0x3cb7db['error'][_0x764d('0x12')]);}else{logger[_0x764d('0x13')](_0x764d('0xc'),_0x40fe04,_0x764d('0xe'));_0x2a6bd8(_0x3cb7db['result']['message']);}})[_0x764d('0x14')](function(_0x59e1bf){logger[_0x764d('0x10')](_0x764d('0xc'),_0x40fe04,_0x59e1bf);_0x5cbee3(_0x59e1bf);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 787ac59..24d9d55 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 _0xb9a7=['addConfiguration','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x167658,_0x43b436){var _0x15f4cd=function(_0x1f43ba){while(--_0x1f43ba){_0x167658['push'](_0x167658['shift']());}};_0x15f4cd(++_0x43b436);}(_0xb9a7,0x112));var _0x7b9a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb9a7[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['show']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['getFields']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b9a('0xd')]);router['post'](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0xe')]);router['put'](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['update']);router[_0x7b9a('0xf')](_0x7b9a('0x9'),auth['isAuthenticated'](),controller[_0x7b9a('0x10')]);module[_0x7b9a('0x11')]=router; \ No newline at end of file +var _0xae60=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x172648,_0x556f98){var _0x42d1fd=function(_0x32e554){while(--_0x32e554){_0x172648['push'](_0x172648['shift']());}};_0x42d1fd(++_0x556f98);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xae60[_0x2f45ea];return _0x485a84;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id/configurations',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x11')]);router[_0x0ae6('0x10')](_0x0ae6('0x12'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x13')]);router[_0x0ae6('0x14')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x15')]);router[_0x0ae6('0x16')](_0x0ae6('0xb'),auth['isAuthenticated'](),controller[_0x0ae6('0x17')]);module[_0x0ae6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 99bd8c5..88a29dd 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 _0xa456=['STRING','username','sequelize','exports'];(function(_0xcc3d6b,_0x5dd008){var _0x3e25fe=function(_0x44c0b8){while(--_0x44c0b8){_0xcc3d6b['push'](_0xcc3d6b['shift']());}};_0x3e25fe(++_0x5dd008);}(_0xa456,0x142));var _0x6a45=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xa456[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x42d58a,_0x4b8f7a){var _0x129e6a=function(_0x2f74ab){while(--_0x2f74ab){_0x42d58a['push'](_0x42d58a['shift']());}};_0x129e6a(++_0x4b8f7a);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('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 f736a03..565bc4c 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 _0xdac5=['stack','name','send','index','FreshsalesAccount','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','options','includeAll','include','params','length','merge','find','body','catch','findOne','FreshsalesConfiguration','sort','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error'];(function(_0x4d7f05,_0x58e084){var _0xe49318=function(_0x1143d9){while(--_0x1143d9){_0x4d7f05['push'](_0x4d7f05['shift']());}};_0xe49318(++_0x58e084);}(_0xdac5,0x159));var _0x5dac=function(_0xaca2a0,_0xcfc885){_0xaca2a0=_0xaca2a0-0x0;var _0x5c32d4=_0xdac5[_0xaca2a0];return _0x5c32d4;};'use strict';var emlformat=require(_0x5dac('0x0'));var rimraf=require(_0x5dac('0x1'));var zipdir=require(_0x5dac('0x2'));var jsonpatch=require(_0x5dac('0x3'));var rp=require(_0x5dac('0x4'));var moment=require(_0x5dac('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5dac('0x6'));var sox=require(_0x5dac('0x7'));var csv=require(_0x5dac('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5dac('0x9'));var crypto=require(_0x5dac('0xa'));var jsforce=require(_0x5dac('0xb'));var deskjs=require(_0x5dac('0xc'));var toCsv=require(_0x5dac('0x8'));var querystring=require(_0x5dac('0xd'));var Papa=require(_0x5dac('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5dac('0xf'));var as=require(_0x5dac('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dac('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dac('0x12'));var db=require(_0x5dac('0x13'))['db'];var integrations=require(_0x5dac('0x14'));function respondWithStatusCode(_0x194c76,_0x4b2683){_0x4b2683=_0x4b2683||0xcc;return function(_0x303196){if(_0x303196){return _0x194c76[_0x5dac('0x15')](_0x4b2683);}return _0x194c76['status'](_0x4b2683)[_0x5dac('0x16')]();};}function respondWithResult(_0x1ba8fd,_0x2e4396){_0x2e4396=_0x2e4396||0xc8;return function(_0x4182ef){if(_0x4182ef){return _0x1ba8fd[_0x5dac('0x17')](_0x2e4396)[_0x5dac('0x18')](_0x4182ef);}};}function respondWithFilteredResult(_0x59d1d8,_0x37a4aa){return function(_0x4cf4a0){if(_0x4cf4a0){var _0x48141e=typeof _0x37a4aa[_0x5dac('0x19')]==='undefined'&&typeof _0x37a4aa[_0x5dac('0x1a')]===_0x5dac('0x1b');var _0x18ecc3=_0x4cf4a0[_0x5dac('0x1c')];var _0x1ebff6=_0x48141e?0x0:_0x37a4aa[_0x5dac('0x19')];var _0x339258=_0x48141e?_0x4cf4a0[_0x5dac('0x1c')]:_0x37a4aa[_0x5dac('0x19')]+_0x37a4aa['limit'];var _0x15cfa2;if(_0x339258>=_0x18ecc3){_0x339258=_0x18ecc3;_0x15cfa2=0xc8;}else{_0x15cfa2=0xce;}_0x59d1d8[_0x5dac('0x17')](_0x15cfa2);return _0x59d1d8[_0x5dac('0x1d')](_0x5dac('0x1e'),_0x1ebff6+'-'+_0x339258+'/'+_0x18ecc3)['json'](_0x4cf4a0);}return null;};}function patchUpdates(_0x1ed3fc){return function(_0x247864){try{jsonpatch['apply'](_0x247864,_0x1ed3fc,!![]);}catch(_0x18d35b){return BPromise['reject'](_0x18d35b);}return _0x247864['save']();};}function saveUpdates(_0x553af4,_0x20fac0){return function(_0x4e33ad){if(_0x4e33ad){return _0x4e33ad[_0x5dac('0x1f')](_0x553af4)[_0x5dac('0x20')](function(_0x91a5e7){return _0x91a5e7;});}return null;};}function removeEntity(_0x66789c,_0x491b14){return function(_0x39d141){if(_0x39d141){return _0x39d141[_0x5dac('0x21')]()[_0x5dac('0x20')](function(){_0x66789c[_0x5dac('0x17')](0xcc)[_0x5dac('0x16')]();});}};}function handleEntityNotFound(_0x95baa8,_0x1cef33){return function(_0x1ebf39){if(!_0x1ebf39){_0x95baa8['sendStatus'](0x194);}return _0x1ebf39;};}function handleError(_0x2e3c04,_0x2a7d42){_0x2a7d42=_0x2a7d42||0x1f4;return function(_0xa3b7cd){logger[_0x5dac('0x22')](_0xa3b7cd[_0x5dac('0x23')]);if(_0xa3b7cd[_0x5dac('0x24')]){delete _0xa3b7cd[_0x5dac('0x24')];}_0x2e3c04[_0x5dac('0x17')](_0x2a7d42)[_0x5dac('0x25')](_0xa3b7cd);};}exports[_0x5dac('0x26')]=function(_0x41724c,_0xd24521){var _0xacd19={},_0x1b4e44={},_0x1b0f9b={'count':0x0,'rows':[]};var _0x1a5c1d=_['map'](db[_0x5dac('0x27')][_0x5dac('0x28')],function(_0xb35ac7){return{'name':_0xb35ac7['fieldName'],'type':_0xb35ac7[_0x5dac('0x29')]['key']};});_0x1b4e44[_0x5dac('0x2a')]=_[_0x5dac('0x2b')](_0x1a5c1d,_0x5dac('0x24'));_0x1b4e44[_0x5dac('0x2c')]=_[_0x5dac('0x2d')](_0x41724c[_0x5dac('0x2c')]);_0x1b4e44[_0x5dac('0x2e')]=_[_0x5dac('0x2f')](_0x1b4e44[_0x5dac('0x2a')],_0x1b4e44[_0x5dac('0x2c')]);_0xacd19[_0x5dac('0x30')]=_['intersection'](_0x1b4e44[_0x5dac('0x2a')],qs[_0x5dac('0x31')](_0x41724c[_0x5dac('0x2c')]['fields']));_0xacd19['attributes']=_0xacd19['attributes']['length']?_0xacd19['attributes']:_0x1b4e44['model'];if(!_0x41724c['query'][_0x5dac('0x32')](_0x5dac('0x33'))){_0xacd19[_0x5dac('0x1a')]=qs[_0x5dac('0x1a')](_0x41724c[_0x5dac('0x2c')][_0x5dac('0x1a')]);_0xacd19['offset']=qs['offset'](_0x41724c[_0x5dac('0x2c')]['offset']);}_0xacd19[_0x5dac('0x34')]=qs['sort'](_0x41724c[_0x5dac('0x2c')]['sort']);_0xacd19['where']=qs[_0x5dac('0x2e')](_[_0x5dac('0x35')](_0x41724c['query'],_0x1b4e44[_0x5dac('0x2e')]),_0x1a5c1d);if(_0x41724c[_0x5dac('0x2c')][_0x5dac('0x36')]){_0xacd19[_0x5dac('0x37')]=_['merge'](_0xacd19[_0x5dac('0x37')],{'$or':_[_0x5dac('0x2b')](_0x1a5c1d,function(_0x29faaa){if(_0x29faaa[_0x5dac('0x29')]!==_0x5dac('0x38')){var _0x28c12c={};_0x28c12c[_0x29faaa['name']]={'$like':'%'+_0x41724c['query'][_0x5dac('0x36')]+'%'};return _0x28c12c;}})});}_0xacd19=_['merge']({},_0xacd19,_0x41724c[_0x5dac('0x39')]);var _0x45eb59={'where':_0xacd19[_0x5dac('0x37')]};return db['FreshsalesAccount'][_0x5dac('0x1c')](_0x45eb59)[_0x5dac('0x20')](function(_0x174fb0){_0x1b0f9b['count']=_0x174fb0;if(_0x41724c['query'][_0x5dac('0x3a')]){_0xacd19[_0x5dac('0x3b')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0xacd19);})['then'](function(_0x509b3b){_0x1b0f9b['rows']=_0x509b3b;return _0x1b0f9b;})['then'](respondWithFilteredResult(_0xd24521,_0xacd19))['catch'](handleError(_0xd24521,null));};exports['show']=function(_0x3d80c1,_0xa27fa3){var _0x420763={'raw':![],'where':{'id':_0x3d80c1[_0x5dac('0x3c')]['id']}},_0x2e7800={};_0x2e7800[_0x5dac('0x2a')]=_[_0x5dac('0x2d')](db[_0x5dac('0x27')][_0x5dac('0x28')]);_0x2e7800[_0x5dac('0x2c')]=_[_0x5dac('0x2d')](_0x3d80c1[_0x5dac('0x2c')]);_0x2e7800[_0x5dac('0x2e')]=_['intersection'](_0x2e7800['model'],_0x2e7800['query']);_0x420763['attributes']=_[_0x5dac('0x2f')](_0x2e7800[_0x5dac('0x2a')],qs[_0x5dac('0x31')](_0x3d80c1[_0x5dac('0x2c')][_0x5dac('0x31')]));_0x420763[_0x5dac('0x30')]=_0x420763[_0x5dac('0x30')][_0x5dac('0x3d')]?_0x420763[_0x5dac('0x30')]:_0x2e7800[_0x5dac('0x2a')];if(_0x3d80c1['query'][_0x5dac('0x3a')]){_0x420763['include']=[{'all':!![]}];}_0x420763=_[_0x5dac('0x3e')]({},_0x420763,_0x3d80c1['options']);return db['FreshsalesAccount'][_0x5dac('0x3f')](_0x420763)[_0x5dac('0x20')](handleEntityNotFound(_0xa27fa3,null))[_0x5dac('0x20')](respondWithResult(_0xa27fa3,null))['catch'](handleError(_0xa27fa3,null));};exports['create']=function(_0x1f3975,_0x4ad5ca){return db[_0x5dac('0x27')]['create'](_0x1f3975['body'],{})[_0x5dac('0x20')](respondWithResult(_0x4ad5ca,0xc9))['catch'](handleError(_0x4ad5ca,null));};exports['update']=function(_0x21af9f,_0x4ac4b2){if(_0x21af9f[_0x5dac('0x40')]['id']){delete _0x21af9f['body']['id'];}return db['FreshsalesAccount'][_0x5dac('0x3f')]({'where':{'id':_0x21af9f['params']['id']}})[_0x5dac('0x20')](handleEntityNotFound(_0x4ac4b2,null))[_0x5dac('0x20')](saveUpdates(_0x21af9f[_0x5dac('0x40')],null))[_0x5dac('0x20')](respondWithResult(_0x4ac4b2,null))[_0x5dac('0x41')](handleError(_0x4ac4b2,null));};exports[_0x5dac('0x21')]=function(_0x431857,_0x1acb27){return db[_0x5dac('0x27')]['find']({'where':{'id':_0x431857[_0x5dac('0x3c')]['id']}})[_0x5dac('0x20')](handleEntityNotFound(_0x1acb27,null))['then'](removeEntity(_0x1acb27,null))[_0x5dac('0x41')](handleError(_0x1acb27,null));};exports['getConfigurations']=function(_0x4f4abd,_0x274f49,_0x134ce3){var _0x4312aa={};var _0x39c0fc={};var _0x533d90;var _0x35aae5;return db[_0x5dac('0x27')][_0x5dac('0x42')]({'where':{'id':_0x4f4abd[_0x5dac('0x3c')]['id']}})[_0x5dac('0x20')](handleEntityNotFound(_0x274f49,null))[_0x5dac('0x20')](function(_0x1ff901){if(_0x1ff901){_0x533d90=_0x1ff901;_0x39c0fc['model']=_[_0x5dac('0x2d')](db[_0x5dac('0x43')][_0x5dac('0x28')]);_0x39c0fc[_0x5dac('0x2c')]=_['keys'](_0x4f4abd[_0x5dac('0x2c')]);_0x39c0fc[_0x5dac('0x2e')]=_[_0x5dac('0x2f')](_0x39c0fc[_0x5dac('0x2a')],_0x39c0fc['query']);_0x4312aa[_0x5dac('0x30')]=_[_0x5dac('0x2f')](_0x39c0fc[_0x5dac('0x2a')],qs['fields'](_0x4f4abd[_0x5dac('0x2c')][_0x5dac('0x31')]));_0x4312aa[_0x5dac('0x30')]=_0x4312aa[_0x5dac('0x30')]['length']?_0x4312aa[_0x5dac('0x30')]:_0x39c0fc[_0x5dac('0x2a')];_0x4312aa[_0x5dac('0x34')]=qs['sort'](_0x4f4abd[_0x5dac('0x2c')][_0x5dac('0x44')]);_0x4312aa[_0x5dac('0x37')]=qs[_0x5dac('0x2e')](_['pick'](_0x4f4abd[_0x5dac('0x2c')],_0x39c0fc['filters']));if(_0x4f4abd[_0x5dac('0x2c')][_0x5dac('0x36')]){_0x4312aa['where']=_[_0x5dac('0x3e')](_0x4312aa['where'],{'$or':_[_0x5dac('0x2b')](_0x4312aa['attributes'],function(_0x653aaf){var _0x36a6f2={};_0x36a6f2[_0x653aaf]={'$like':'%'+_0x4f4abd['query'][_0x5dac('0x36')]+'%'};return _0x36a6f2;})});}_0x4312aa=_[_0x5dac('0x3e')]({},_0x4312aa,_0x4f4abd['options']);return _0x533d90[_0x5dac('0x45')](_0x4312aa);}})['then'](function(_0x22ab48){if(_0x22ab48){_0x35aae5=_0x22ab48[_0x5dac('0x3d')];if(!_0x4f4abd['query']['hasOwnProperty'](_0x5dac('0x33'))){_0x4312aa[_0x5dac('0x1a')]=qs[_0x5dac('0x1a')](_0x4f4abd['query'][_0x5dac('0x1a')]);_0x4312aa[_0x5dac('0x19')]=qs['offset'](_0x4f4abd[_0x5dac('0x2c')]['offset']);}return _0x533d90[_0x5dac('0x45')](_0x4312aa);}})[_0x5dac('0x20')](function(_0x4e5721){if(_0x4e5721){return _0x4e5721?{'count':_0x35aae5,'rows':_0x4e5721}:null;}})[_0x5dac('0x20')](respondWithResult(_0x274f49,null))['catch'](handleError(_0x274f49,null));};exports['addConfiguration']=function(_0x17ae28,_0x5bc966,_0x33eb79){if(_0x17ae28[_0x5dac('0x40')]['id']){delete _0x17ae28['body']['id'];}return db[_0x5dac('0x27')][_0x5dac('0x42')]({'where':{'id':_0x17ae28[_0x5dac('0x3c')]['id']}})[_0x5dac('0x20')](handleEntityNotFound(_0x5bc966,null))[_0x5dac('0x20')](function(_0x208031){if(_0x208031){_0x17ae28[_0x5dac('0x40')][_0x5dac('0x46')]=_0x208031['id'];_0x17ae28[_0x5dac('0x40')][_0x5dac('0x47')]=integrations[_0x5dac('0x48')](_0x17ae28[_0x5dac('0x40')][_0x5dac('0x49')],_0x17ae28['body'][_0x5dac('0x29')]);_0x17ae28[_0x5dac('0x40')][_0x5dac('0x4a')]=integrations[_0x5dac('0x4b')](_0x17ae28['body'][_0x5dac('0x49')],_0x17ae28[_0x5dac('0x40')][_0x5dac('0x29')]);return db[_0x5dac('0x43')]['create'](_0x17ae28[_0x5dac('0x40')],{'include':[{'model':db[_0x5dac('0x4c')],'as':_0x5dac('0x47')},{'model':db[_0x5dac('0x4c')],'as':_0x5dac('0x4a')}]});}return null;})[_0x5dac('0x20')](respondWithResult(_0x5bc966,null))[_0x5dac('0x41')](handleError(_0x5bc966,null));};exports[_0x5dac('0x4d')]=function(_0x469ebf,_0x16ad19,_0x3cf93c){var _0x41a269='';var _0x449636='';return db[_0x5dac('0x27')][_0x5dac('0x42')]({'where':{'id':_0x469ebf[_0x5dac('0x3c')]['id']},'attributes':['id',_0x5dac('0x4e'),_0x5dac('0x4f'),_0x5dac('0x50')]})[_0x5dac('0x20')](handleEntityNotFound(_0x16ad19,null))[_0x5dac('0x20')](function(_0x13dca3){if(_0x13dca3){_0x449636=_0x13dca3['username'];_0x41a269=_0x13dca3[_0x5dac('0x4f')];var _0x5a0a33=_0x13dca3[_0x5dac('0x4f')][_0x5dac('0x51')](-0x1);if(_0x5a0a33==='/'){_0x41a269=_0x41a269[_0x5dac('0x52')](0x0,_0x41a269[_0x5dac('0x53')](_0x5a0a33));}return rp({'method':_0x5dac('0x54'),'uri':util[_0x5dac('0x55')](_0x5dac('0x56'),_0x41a269,_0x5dac('0x57')),'headers':{'Authorization':_0x5dac('0x58')+_0x13dca3['apiKey']},'json':!![]});}})[_0x5dac('0x20')](function(_0x1a8610){if(_0x1a8610){var _0x5e95a6=_0x1a8610[_0x5dac('0x59')];var _0x36116d=![];var _0x299bd8=null;for(_0x299bd8=0x0;_0x299bd8<_0x5e95a6[_0x5dac('0x3d')];_0x299bd8++){if(_0x5e95a6[_0x299bd8]['email']===_0x449636){_0x36116d=!![];}}if(_0x36116d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5dac('0x5a')});}}})[_0x5dac('0x20')](respondWithResult(_0x16ad19,null))[_0x5dac('0x41')](function(_0x444945){var _0x2114c0=_0x469ebf[_0x5dac('0x2c')][_0x5dac('0x5b')]?0x1f4:_0x444945[_0x5dac('0x5c')]||0x1f4;logger[_0x5dac('0x22')](_0x5dac('0x5d'),'getFields',_0x2114c0,JSON['stringify'](_0x444945));delete _0x444945[_0x5dac('0x24')];if(_0x2114c0===0x191){_0x2114c0=0x190;}_0x16ad19['status'](_0x2114c0)['send'](_0x469ebf[_0x5dac('0x2c')][_0x5dac('0x5b')]?{'message':_0x5dac('0x5e'),'statusCode':_0x444945['statusCode']}:_0x444945);});}; \ No newline at end of file +var _0x21f4=['zip-dir','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FreshsalesAccount','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','findOne','FreshsalesConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','username','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x21f4,0x1ea));var _0x421f=function(_0x1abeba,_0x51ff94){_0x1abeba=_0x1abeba-0x0;var _0x53684c=_0x21f4[_0x1abeba];return _0x53684c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x421f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x421f('0x1'));var Mustache=require(_0x421f('0x2'));var util=require(_0x421f('0x3'));var path=require(_0x421f('0x4'));var sox=require(_0x421f('0x5'));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(_0x421f('0x6'));var crypto=require(_0x421f('0x7'));var jsforce=require(_0x421f('0x8'));var deskjs=require(_0x421f('0x9'));var toCsv=require('to-csv');var querystring=require(_0x421f('0xa'));var Papa=require(_0x421f('0xb'));var Redis=require(_0x421f('0xc'));var authService=require(_0x421f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x421f('0xe'));var hardwareService=require(_0x421f('0xf'));var logger=require(_0x421f('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x421f('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0x421f('0x12'));function respondWithStatusCode(_0x336c2f,_0x502344){_0x502344=_0x502344||0xcc;return function(_0x714ea5){if(_0x714ea5){return _0x336c2f[_0x421f('0x13')](_0x502344);}return _0x336c2f[_0x421f('0x14')](_0x502344)[_0x421f('0x15')]();};}function respondWithResult(_0x24ba92,_0x3b83e9){_0x3b83e9=_0x3b83e9||0xc8;return function(_0x3193e7){if(_0x3193e7){return _0x24ba92[_0x421f('0x14')](_0x3b83e9)['json'](_0x3193e7);}};}function respondWithFilteredResult(_0x55f1e7,_0xf0ded2){return function(_0x1fcaf0){if(_0x1fcaf0){var _0x5707fe=typeof _0xf0ded2[_0x421f('0x16')]==='undefined'&&typeof _0xf0ded2['limit']===_0x421f('0x17');var _0x597ffc=_0x1fcaf0[_0x421f('0x18')];var _0xd574f8=_0x5707fe?0x0:_0xf0ded2[_0x421f('0x16')];var _0x438da6=_0x5707fe?_0x1fcaf0[_0x421f('0x18')]:_0xf0ded2[_0x421f('0x16')]+_0xf0ded2[_0x421f('0x19')];var _0x464ce9;if(_0x438da6>=_0x597ffc){_0x438da6=_0x597ffc;_0x464ce9=0xc8;}else{_0x464ce9=0xce;}_0x55f1e7['status'](_0x464ce9);return _0x55f1e7[_0x421f('0x1a')](_0x421f('0x1b'),_0xd574f8+'-'+_0x438da6+'/'+_0x597ffc)[_0x421f('0x1c')](_0x1fcaf0);}return null;};}function patchUpdates(_0x2a1aea){return function(_0x51face){try{jsonpatch[_0x421f('0x1d')](_0x51face,_0x2a1aea,!![]);}catch(_0x383894){return BPromise[_0x421f('0x1e')](_0x383894);}return _0x51face['save']();};}function saveUpdates(_0xdb614d,_0x1174fe){return function(_0x2dde49){if(_0x2dde49){return _0x2dde49[_0x421f('0x1f')](_0xdb614d)['then'](function(_0x44b4d7){return _0x44b4d7;});}return null;};}function removeEntity(_0x531d5e,_0x11d3ed){return function(_0xa8b81f){if(_0xa8b81f){return _0xa8b81f[_0x421f('0x20')]()['then'](function(){_0x531d5e['status'](0xcc)[_0x421f('0x15')]();});}};}function handleEntityNotFound(_0x2ddf54,_0x249bed){return function(_0x3215be){if(!_0x3215be){_0x2ddf54[_0x421f('0x13')](0x194);}return _0x3215be;};}function handleError(_0x3ec19f,_0x4698ed){_0x4698ed=_0x4698ed||0x1f4;return function(_0x239649){logger[_0x421f('0x21')](_0x239649[_0x421f('0x22')]);if(_0x239649['name']){delete _0x239649[_0x421f('0x23')];}_0x3ec19f[_0x421f('0x14')](_0x4698ed)[_0x421f('0x24')](_0x239649);};}exports['index']=function(_0x325f8c,_0x1ef133){var _0x37ab04={},_0xcee760={},_0x24063f={'count':0x0,'rows':[]};var _0x2abe42=_[_0x421f('0x25')](db['FreshsalesAccount']['rawAttributes'],function(_0x3e1860){return{'name':_0x3e1860[_0x421f('0x26')],'type':_0x3e1860[_0x421f('0x27')][_0x421f('0x28')]};});_0xcee760['model']=_[_0x421f('0x25')](_0x2abe42,_0x421f('0x23'));_0xcee760[_0x421f('0x29')]=_[_0x421f('0x2a')](_0x325f8c[_0x421f('0x29')]);_0xcee760['filters']=_[_0x421f('0x2b')](_0xcee760[_0x421f('0x2c')],_0xcee760[_0x421f('0x29')]);_0x37ab04[_0x421f('0x2d')]=_[_0x421f('0x2b')](_0xcee760[_0x421f('0x2c')],qs[_0x421f('0x2e')](_0x325f8c[_0x421f('0x29')]['fields']));_0x37ab04[_0x421f('0x2d')]=_0x37ab04['attributes'][_0x421f('0x2f')]?_0x37ab04[_0x421f('0x2d')]:_0xcee760['model'];if(!_0x325f8c[_0x421f('0x29')][_0x421f('0x30')](_0x421f('0x31'))){_0x37ab04['limit']=qs[_0x421f('0x19')](_0x325f8c[_0x421f('0x29')]['limit']);_0x37ab04[_0x421f('0x16')]=qs[_0x421f('0x16')](_0x325f8c[_0x421f('0x29')][_0x421f('0x16')]);}_0x37ab04[_0x421f('0x32')]=qs[_0x421f('0x33')](_0x325f8c[_0x421f('0x29')][_0x421f('0x33')]);_0x37ab04[_0x421f('0x34')]=qs[_0x421f('0x35')](_['pick'](_0x325f8c['query'],_0xcee760['filters']),_0x2abe42);if(_0x325f8c[_0x421f('0x29')][_0x421f('0x36')]){_0x37ab04[_0x421f('0x34')]=_[_0x421f('0x37')](_0x37ab04[_0x421f('0x34')],{'$or':_[_0x421f('0x25')](_0x2abe42,function(_0x12b861){if(_0x12b861[_0x421f('0x27')]!==_0x421f('0x38')){var _0x69ca3a={};_0x69ca3a[_0x12b861[_0x421f('0x23')]]={'$like':'%'+_0x325f8c[_0x421f('0x29')][_0x421f('0x36')]+'%'};return _0x69ca3a;}})});}_0x37ab04=_['merge']({},_0x37ab04,_0x325f8c[_0x421f('0x39')]);var _0x5db3c8={'where':_0x37ab04[_0x421f('0x34')]};return db[_0x421f('0x3a')][_0x421f('0x18')](_0x5db3c8)[_0x421f('0x3b')](function(_0x36fdd7){_0x24063f['count']=_0x36fdd7;if(_0x325f8c[_0x421f('0x29')][_0x421f('0x3c')]){_0x37ab04[_0x421f('0x3d')]=[{'all':!![]}];}return db[_0x421f('0x3a')][_0x421f('0x3e')](_0x37ab04);})['then'](function(_0x3e80d0){_0x24063f[_0x421f('0x3f')]=_0x3e80d0;return _0x24063f;})['then'](respondWithFilteredResult(_0x1ef133,_0x37ab04))[_0x421f('0x40')](handleError(_0x1ef133,null));};exports[_0x421f('0x41')]=function(_0x138e98,_0x6995b0){var _0x390ac8={'raw':![],'where':{'id':_0x138e98[_0x421f('0x42')]['id']}},_0x593005={};_0x593005['model']=_[_0x421f('0x2a')](db[_0x421f('0x3a')][_0x421f('0x43')]);_0x593005[_0x421f('0x29')]=_[_0x421f('0x2a')](_0x138e98[_0x421f('0x29')]);_0x593005[_0x421f('0x35')]=_[_0x421f('0x2b')](_0x593005['model'],_0x593005[_0x421f('0x29')]);_0x390ac8[_0x421f('0x2d')]=_[_0x421f('0x2b')](_0x593005[_0x421f('0x2c')],qs['fields'](_0x138e98['query'][_0x421f('0x2e')]));_0x390ac8['attributes']=_0x390ac8[_0x421f('0x2d')][_0x421f('0x2f')]?_0x390ac8[_0x421f('0x2d')]:_0x593005[_0x421f('0x2c')];if(_0x138e98[_0x421f('0x29')]['includeAll']){_0x390ac8[_0x421f('0x3d')]=[{'all':!![]}];}_0x390ac8=_[_0x421f('0x37')]({},_0x390ac8,_0x138e98['options']);return db['FreshsalesAccount'][_0x421f('0x44')](_0x390ac8)[_0x421f('0x3b')](handleEntityNotFound(_0x6995b0,null))[_0x421f('0x3b')](respondWithResult(_0x6995b0,null))[_0x421f('0x40')](handleError(_0x6995b0,null));};exports[_0x421f('0x45')]=function(_0x5cb100,_0x46ad48){return db['FreshsalesAccount'][_0x421f('0x45')](_0x5cb100[_0x421f('0x46')],{})[_0x421f('0x3b')](respondWithResult(_0x46ad48,0xc9))[_0x421f('0x40')](handleError(_0x46ad48,null));};exports[_0x421f('0x1f')]=function(_0x1a0598,_0x3c2959){if(_0x1a0598[_0x421f('0x46')]['id']){delete _0x1a0598[_0x421f('0x46')]['id'];}return db['FreshsalesAccount'][_0x421f('0x44')]({'where':{'id':_0x1a0598[_0x421f('0x42')]['id']}})[_0x421f('0x3b')](handleEntityNotFound(_0x3c2959,null))[_0x421f('0x3b')](saveUpdates(_0x1a0598[_0x421f('0x46')],null))[_0x421f('0x3b')](respondWithResult(_0x3c2959,null))['catch'](handleError(_0x3c2959,null));};exports[_0x421f('0x20')]=function(_0x48ddfd,_0xcf6147){return db[_0x421f('0x3a')]['find']({'where':{'id':_0x48ddfd[_0x421f('0x42')]['id']}})['then'](handleEntityNotFound(_0xcf6147,null))[_0x421f('0x3b')](removeEntity(_0xcf6147,null))['catch'](handleError(_0xcf6147,null));};exports['getConfigurations']=function(_0x872162,_0x470342,_0x272e71){var _0x511dc5={};var _0x17afc1={};var _0x28d835;var _0x1c403a;return db[_0x421f('0x3a')][_0x421f('0x47')]({'where':{'id':_0x872162['params']['id']}})[_0x421f('0x3b')](handleEntityNotFound(_0x470342,null))[_0x421f('0x3b')](function(_0xcde601){if(_0xcde601){_0x28d835=_0xcde601;_0x17afc1[_0x421f('0x2c')]=_[_0x421f('0x2a')](db[_0x421f('0x48')][_0x421f('0x43')]);_0x17afc1['query']=_[_0x421f('0x2a')](_0x872162['query']);_0x17afc1[_0x421f('0x35')]=_['intersection'](_0x17afc1[_0x421f('0x2c')],_0x17afc1[_0x421f('0x29')]);_0x511dc5[_0x421f('0x2d')]=_[_0x421f('0x2b')](_0x17afc1['model'],qs[_0x421f('0x2e')](_0x872162[_0x421f('0x29')]['fields']));_0x511dc5['attributes']=_0x511dc5[_0x421f('0x2d')]['length']?_0x511dc5[_0x421f('0x2d')]:_0x17afc1['model'];_0x511dc5[_0x421f('0x32')]=qs[_0x421f('0x33')](_0x872162[_0x421f('0x29')][_0x421f('0x33')]);_0x511dc5[_0x421f('0x34')]=qs[_0x421f('0x35')](_[_0x421f('0x49')](_0x872162[_0x421f('0x29')],_0x17afc1[_0x421f('0x35')]));if(_0x872162[_0x421f('0x29')][_0x421f('0x36')]){_0x511dc5['where']=_[_0x421f('0x37')](_0x511dc5[_0x421f('0x34')],{'$or':_[_0x421f('0x25')](_0x511dc5[_0x421f('0x2d')],function(_0x49d215){var _0x6e136b={};_0x6e136b[_0x49d215]={'$like':'%'+_0x872162[_0x421f('0x29')][_0x421f('0x36')]+'%'};return _0x6e136b;})});}_0x511dc5=_['merge']({},_0x511dc5,_0x872162[_0x421f('0x39')]);return _0x28d835[_0x421f('0x4a')](_0x511dc5);}})[_0x421f('0x3b')](function(_0x2106d5){if(_0x2106d5){_0x1c403a=_0x2106d5[_0x421f('0x2f')];if(!_0x872162['query'][_0x421f('0x30')](_0x421f('0x31'))){_0x511dc5['limit']=qs[_0x421f('0x19')](_0x872162[_0x421f('0x29')]['limit']);_0x511dc5['offset']=qs[_0x421f('0x16')](_0x872162[_0x421f('0x29')][_0x421f('0x16')]);}return _0x28d835['getConfigurations'](_0x511dc5);}})[_0x421f('0x3b')](function(_0xeca2a8){if(_0xeca2a8){return _0xeca2a8?{'count':_0x1c403a,'rows':_0xeca2a8}:null;}})['then'](respondWithResult(_0x470342,null))[_0x421f('0x40')](handleError(_0x470342,null));};exports[_0x421f('0x4b')]=function(_0x7eae20,_0x1906c7,_0x40e536){if(_0x7eae20[_0x421f('0x46')]['id']){delete _0x7eae20['body']['id'];}return db[_0x421f('0x3a')]['findOne']({'where':{'id':_0x7eae20['params']['id']}})[_0x421f('0x3b')](handleEntityNotFound(_0x1906c7,null))[_0x421f('0x3b')](function(_0x3851fb){if(_0x3851fb){_0x7eae20[_0x421f('0x46')][_0x421f('0x4c')]=_0x3851fb['id'];_0x7eae20[_0x421f('0x46')][_0x421f('0x4d')]=integrations[_0x421f('0x4e')](_0x7eae20[_0x421f('0x46')]['channel'],_0x7eae20['body'][_0x421f('0x27')]);_0x7eae20['body'][_0x421f('0x4f')]=integrations[_0x421f('0x50')](_0x7eae20[_0x421f('0x46')]['channel'],_0x7eae20[_0x421f('0x46')][_0x421f('0x27')]);return db[_0x421f('0x48')][_0x421f('0x45')](_0x7eae20['body'],{'include':[{'model':db[_0x421f('0x51')],'as':'Subjects'},{'model':db[_0x421f('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1906c7,null))[_0x421f('0x40')](handleError(_0x1906c7,null));};exports[_0x421f('0x52')]=function(_0x461d8d,_0x49a12a,_0x2efb4d){var _0x11acf5='';var _0x3b7f3c='';return db[_0x421f('0x3a')][_0x421f('0x47')]({'where':{'id':_0x461d8d[_0x421f('0x42')]['id']},'attributes':['id','username',_0x421f('0x53'),'apiKey']})['then'](handleEntityNotFound(_0x49a12a,null))['then'](function(_0x22ef14){if(_0x22ef14){_0x3b7f3c=_0x22ef14[_0x421f('0x54')];_0x11acf5=_0x22ef14['remoteUri'];var _0x1bbfdc=_0x22ef14[_0x421f('0x53')]['slice'](-0x1);if(_0x1bbfdc==='/'){_0x11acf5=_0x11acf5[_0x421f('0x55')](0x0,_0x11acf5[_0x421f('0x56')](_0x1bbfdc));}return rp({'method':_0x421f('0x57'),'uri':util[_0x421f('0x58')](_0x421f('0x59'),_0x11acf5,_0x421f('0x5a')),'headers':{'Authorization':_0x421f('0x5b')+_0x22ef14['apiKey']},'json':!![]});}})[_0x421f('0x3b')](function(_0x15a355){if(_0x15a355){var _0x54415b=_0x15a355['users'];var _0x1cbd8f=![];var _0x2bb6bc=null;for(_0x2bb6bc=0x0;_0x2bb6bc<_0x54415b[_0x421f('0x2f')];_0x2bb6bc++){if(_0x54415b[_0x2bb6bc][_0x421f('0x5c')]===_0x3b7f3c){_0x1cbd8f=!![];}}if(_0x1cbd8f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x49a12a,null))[_0x421f('0x40')](function(_0x304ee2){var _0x354bf5=_0x461d8d[_0x421f('0x29')][_0x421f('0x5d')]?0x1f4:_0x304ee2[_0x421f('0x5e')]||0x1f4;logger[_0x421f('0x21')](_0x421f('0x5f'),_0x421f('0x52'),_0x354bf5,JSON[_0x421f('0x60')](_0x304ee2));delete _0x304ee2[_0x421f('0x23')];if(_0x354bf5===0x191){_0x354bf5=0x190;}_0x49a12a[_0x421f('0x14')](_0x354bf5)['send'](_0x461d8d[_0x421f('0x29')]['test']?{'message':_0x421f('0x61'),'statusCode':_0x304ee2[_0x421f('0x5e')]}:_0x304ee2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7db3438..a012978 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 _0x187d=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0x187d,0x93));var _0xd187=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x187d[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x264de4,_0x41f555){var _0x4e004e=function(_0x43f7c8){while(--_0x43f7c8){_0x264de4['push'](_0x264de4['shift']());}};_0x4e004e(++_0x41f555);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1ee69b,_0x55a65b){_0x1ee69b=_0x1ee69b-0x0;var _0x33e413=_0xe5af[_0x1ee69b];return _0x33e413;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'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 6fe2804..d2a7003 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 _0xf2e3=['FreshsalesAccount','findAll','options','where','attributes','model','include','map','ShowFreshsalesAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount'];(function(_0x3fa479,_0x222259){var _0x23feb5=function(_0x115e68){while(--_0x115e68){_0x3fa479['push'](_0x3fa479['shift']());}};_0x23feb5(++_0x222259);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf2e3[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});}exports[_0x3f2e('0x18')]=function(_0xc00add){var _0x107876=this;return new Promise(function(_0x5b9989,_0x40e28f){return db[_0x3f2e('0x19')][_0x3f2e('0x1a')]({'raw':_0xc00add[_0x3f2e('0x1b')]?_0xc00add[_0x3f2e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc00add['options']?_0xc00add[_0x3f2e('0x1b')][_0x3f2e('0x1c')]||null:null,'attributes':_0xc00add[_0x3f2e('0x1b')]?_0xc00add[_0x3f2e('0x1b')][_0x3f2e('0x1d')]||null:null,'limit':_0xc00add[_0x3f2e('0x1b')]?_0xc00add['options']['limit']||null:null,'include':_0xc00add[_0x3f2e('0x1b')]?_0xc00add[_0x3f2e('0x1b')]['include']?_['map'](_0xc00add[_0x3f2e('0x1b')]['include'],function(_0x1b8c67){return{'model':db[_0x1b8c67[_0x3f2e('0x1e')]],'as':_0x1b8c67['as'],'attributes':_0x1b8c67['attributes'],'include':_0x1b8c67['include']?_['map'](_0x1b8c67[_0x3f2e('0x1f')],function(_0x3d7631){return{'model':db[_0x3d7631['model']],'as':_0x3d7631['as'],'attributes':_0x3d7631[_0x3f2e('0x1d')],'include':_0x3d7631['include']?_[_0x3f2e('0x20')](_0x3d7631['include'],function(_0x2806d0){return{'model':db[_0x2806d0[_0x3f2e('0x1e')]],'as':_0x2806d0['as'],'attributes':_0x2806d0[_0x3f2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f2e('0xd')](function(_0x11bad1){logger['info'](_0x3f2e('0x18'),_0xc00add);logger[_0x3f2e('0x11')]('GetFreshsalesAccount',_0xc00add,JSON['stringify'](_0x11bad1));_0x5b9989(_0x11bad1);})[_0x3f2e('0x17')](function(_0x1e5db4){logger[_0x3f2e('0x14')](_0x3f2e('0x18'),_0x1e5db4['message'],_0xc00add);_0x40e28f(_0x107876[_0x3f2e('0x14')](0x1f4,_0x1e5db4[_0x3f2e('0x15')]));});});};exports[_0x3f2e('0x21')]=function(_0x4d9b8c){var _0x349ed4=this;return new Promise(function(_0x2741d0,_0xa6a8ab){return db['FreshsalesAccount'][_0x3f2e('0x22')]({'raw':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')][_0x3f2e('0x23')]===undefined?!![]:![]:!![],'where':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')]['where']||null:null,'attributes':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')][_0x3f2e('0x1d')]||null:null,'include':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')][_0x3f2e('0x1f')]?_[_0x3f2e('0x20')](_0x4d9b8c['options'][_0x3f2e('0x1f')],function(_0x1e4866){return{'model':db[_0x1e4866[_0x3f2e('0x1e')]],'as':_0x1e4866['as'],'attributes':_0x1e4866[_0x3f2e('0x1d')],'include':_0x1e4866['include']?_['map'](_0x1e4866[_0x3f2e('0x1f')],function(_0x35ead3){return{'model':db[_0x35ead3[_0x3f2e('0x1e')]],'as':_0x35ead3['as'],'attributes':_0x35ead3[_0x3f2e('0x1d')],'include':_0x35ead3[_0x3f2e('0x1f')]?_[_0x3f2e('0x20')](_0x35ead3[_0x3f2e('0x1f')],function(_0x35937a){return{'model':db[_0x35937a[_0x3f2e('0x1e')]],'as':_0x35937a['as'],'attributes':_0x35937a[_0x3f2e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff764){logger[_0x3f2e('0xe')](_0x3f2e('0x21'),_0x4d9b8c);logger[_0x3f2e('0x11')]('ShowFreshsalesAccount',_0x4d9b8c,JSON[_0x3f2e('0x13')](_0x1ff764));_0x2741d0(_0x1ff764);})[_0x3f2e('0x17')](function(_0x3f41af){logger[_0x3f2e('0x14')](_0x3f2e('0x21'),_0x3f41af[_0x3f2e('0x15')],_0x4d9b8c);_0xa6a8ab(_0x349ed4[_0x3f2e('0x14')](0x1f4,_0x3f41af[_0x3f2e('0x15')]));});});}; \ No newline at end of file +var _0x0120=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0120,0x6f));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['FreshsalesAccount'][_0x0012('0x17')]({'raw':_0x1d0423[_0x0012('0x18')]?_0x1d0423['options'][_0x0012('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x1d0423['options']?_0x1d0423['options'][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1c')]||null:null,'include':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x1d0423['options'][_0x0012('0x1d')],function(_0x24a280){return{'model':db[_0x24a280['model']],'as':_0x24a280['as'],'attributes':_0x24a280[_0x0012('0x1b')],'include':_0x24a280[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x24a280[_0x0012('0x1d')],function(_0x42bcd7){return{'model':db[_0x42bcd7['model']],'as':_0x42bcd7['as'],'attributes':_0x42bcd7[_0x0012('0x1b')],'include':_0x42bcd7[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x42bcd7[_0x0012('0x1d')],function(_0x173cb3){return{'model':db[_0x173cb3[_0x0012('0x1f')]],'as':_0x173cb3['as'],'attributes':_0x173cb3[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0012('0x20')](function(_0x300e13){logger[_0x0012('0xd')](_0x0012('0x16'),_0x1d0423);logger[_0x0012('0x21')](_0x0012('0x16'),_0x1d0423,JSON[_0x0012('0x11')](_0x300e13));_0x1e78ee(_0x300e13);})[_0x0012('0x22')](function(_0x276389){logger[_0x0012('0x12')](_0x0012('0x16'),_0x276389[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1[_0x0012('0x12')](0x1f4,_0x276389[_0x0012('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x283134){var _0x1bb49b=this;return new Promise(function(_0x4c2601,_0x2fa6a2){return db[_0x0012('0x23')][_0x0012('0x24')]({'raw':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x283134['options']?_0x283134[_0x0012('0x18')][_0x0012('0x1b')]||null:null,'include':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x283134['options'][_0x0012('0x1d')],function(_0x30dfd8){return{'model':db[_0x30dfd8[_0x0012('0x1f')]],'as':_0x30dfd8['as'],'attributes':_0x30dfd8[_0x0012('0x1b')],'include':_0x30dfd8['include']?_['map'](_0x30dfd8[_0x0012('0x1d')],function(_0x30f8a2){return{'model':db[_0x30f8a2[_0x0012('0x1f')]],'as':_0x30f8a2['as'],'attributes':_0x30f8a2[_0x0012('0x1b')],'include':_0x30f8a2[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x30f8a2[_0x0012('0x1d')],function(_0x4f13b9){return{'model':db[_0x4f13b9[_0x0012('0x1f')]],'as':_0x4f13b9['as'],'attributes':_0x4f13b9[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196222){logger[_0x0012('0xd')](_0x0012('0x25'),_0x283134);logger[_0x0012('0x21')](_0x0012('0x25'),_0x283134,JSON[_0x0012('0x11')](_0x196222));_0x4c2601(_0x196222);})[_0x0012('0x22')](function(_0x4a4af8){logger[_0x0012('0x12')]('ShowFreshsalesAccount',_0x4a4af8[_0x0012('0x14')],_0x283134);_0x2fa6a2(_0x1bb49b['error'](0x1f4,_0x4a4af8['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index ede65e1..3f7a410 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 _0x218e=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create'];(function(_0x5f0189,_0x25cfef){var _0x4d6237=function(_0x12aeca){while(--_0x12aeca){_0x5f0189['push'](_0x5f0189['shift']());}};_0x4d6237(++_0x25cfef);}(_0x218e,0x64));var _0xe218=function(_0x2f0b14,_0x18151b){_0x2f0b14=_0x2f0b14-0x0;var _0x2d2167=_0x218e[_0x2f0b14];return _0x2d2167;};'use strict';var multer=require(_0xe218('0x0'));var util=require(_0xe218('0x1'));var path=require(_0xe218('0x2'));var timeout=require('connect-timeout');var express=require(_0xe218('0x3'));var router=express[_0xe218('0x4')]();var fs_extra=require(_0xe218('0x5'));var auth=require(_0xe218('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe218('0x7'));var controller=require(_0xe218('0x8'));router[_0xe218('0x9')]('/',auth[_0xe218('0xa')](),controller[_0xe218('0xb')]);router[_0xe218('0x9')](_0xe218('0xc'),auth[_0xe218('0xa')](),controller['show']);router[_0xe218('0x9')](_0xe218('0xd'),auth['isAuthenticated'](),controller[_0xe218('0xe')]);router[_0xe218('0x9')](_0xe218('0xf'),auth[_0xe218('0xa')](),controller[_0xe218('0x10')]);router[_0xe218('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe218('0x11')]);router[_0xe218('0x12')]('/',auth[_0xe218('0xa')](),controller[_0xe218('0x13')]);router['put'](_0xe218('0xc'),auth[_0xe218('0xa')](),controller[_0xe218('0x14')]);router[_0xe218('0x15')]('/:id',auth[_0xe218('0xa')](),controller[_0xe218('0x16')]);module[_0xe218('0x17')]=router; \ No newline at end of file +var _0xd0fb=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x130f4b,_0x47ad96){var _0xa81216=function(_0x54ee57){while(--_0x54ee57){_0x130f4b['push'](_0x130f4b['shift']());}};_0xa81216(++_0x47ad96);}(_0xd0fb,0x85));var _0xbd0f=function(_0x52ef65,_0x3b7378){_0x52ef65=_0x52ef65-0x0;var _0xd87bfa=_0xd0fb[_0x52ef65];return _0xd87bfa;};'use strict';var multer=require(_0xbd0f('0x0'));var util=require(_0xbd0f('0x1'));var path=require(_0xbd0f('0x2'));var timeout=require(_0xbd0f('0x3'));var express=require('express');var router=express[_0xbd0f('0x4')]();var fs_extra=require(_0xbd0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd0f('0x6'));var config=require(_0xbd0f('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xbd0f('0x8')]('/',auth[_0xbd0f('0x9')](),controller[_0xbd0f('0xa')]);router['get'](_0xbd0f('0xb'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0xc')]);router[_0xbd0f('0x8')](_0xbd0f('0xd'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0xe')]);router[_0xbd0f('0x8')](_0xbd0f('0xf'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x10')]);router[_0xbd0f('0x8')](_0xbd0f('0x11'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x12')]);router[_0xbd0f('0x13')]('/',auth[_0xbd0f('0x9')](),controller['create']);router['put']('/:id',auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x14')]);router['delete']('/:id',auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x15')]);module[_0xbd0f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c674f6f..3372962 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 _0x75d9=['sequelize','STRING'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x75d9,0x92));var _0x975d=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x75d9[_0x12ddb2];return _0x10b6dd;};'use strict';var Sequelize=require(_0x975d('0x0'));module['exports']={'name':{'type':Sequelize[_0x975d('0x1')]},'description':{'type':Sequelize[_0x975d('0x1')]}}; \ No newline at end of file +var _0x2dcf=['exports','STRING'];(function(_0x56ca61,_0x187321){var _0x1e7bee=function(_0x1d6eb4){while(--_0x1d6eb4){_0x56ca61['push'](_0x56ca61['shift']());}};_0x1e7bee(++_0x187321);}(_0x2dcf,0xae));var _0xf2dc=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x2dcf[_0x18afca];return _0x11603f;};'use strict';var Sequelize=require('sequelize');module[_0xf2dc('0x0')]={'name':{'type':Sequelize[_0xf2dc('0x1')]},'description':{'type':Sequelize[_0xf2dc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 939a6ed..a6b0b5a 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 _0x3223=['order','where','filters','filter','VIRTUAL','options','includeAll','include','FreshsalesConfiguration','findAll','rows','show','params','merge','find','catch','create','body','getSubjects','sort','pick','getDescriptions','findOne','FreshsalesField','getFields','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../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','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x27926c,_0x37d579){var _0x584578=function(_0x32e167){while(--_0x32e167){_0x27926c['push'](_0x27926c['shift']());}};_0x584578(++_0x37d579);}(_0x3223,0x6a));var _0x3322=function(_0x127442,_0x13180a){_0x127442=_0x127442-0x0;var _0x4ef394=_0x3223[_0x127442];return _0x4ef394;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3322('0x0'));var zipdir=require(_0x3322('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3322('0x2'));var moment=require('moment');var BPromise=require(_0x3322('0x3'));var Mustache=require(_0x3322('0x4'));var util=require(_0x3322('0x5'));var path=require('path');var sox=require(_0x3322('0x6'));var csv=require(_0x3322('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3322('0x8'));var _=require(_0x3322('0x9'));var squel=require(_0x3322('0xa'));var crypto=require(_0x3322('0xb'));var jsforce=require(_0x3322('0xc'));var deskjs=require(_0x3322('0xd'));var toCsv=require(_0x3322('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3322('0xe'));var qs=require(_0x3322('0xf'));var as=require(_0x3322('0x10'));var hardwareService=require(_0x3322('0x11'));var logger=require(_0x3322('0x12'))(_0x3322('0x13'));var utils=require(_0x3322('0x14'));var config=require(_0x3322('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3322('0x16'))['db'];function respondWithStatusCode(_0x5be325,_0x2f2657){_0x2f2657=_0x2f2657||0xcc;return function(_0xb37bcb){if(_0xb37bcb){return _0x5be325[_0x3322('0x17')](_0x2f2657);}return _0x5be325[_0x3322('0x18')](_0x2f2657)[_0x3322('0x19')]();};}function respondWithResult(_0x6406c7,_0x19a57d){_0x19a57d=_0x19a57d||0xc8;return function(_0x1a6e47){if(_0x1a6e47){return _0x6406c7[_0x3322('0x18')](_0x19a57d)['json'](_0x1a6e47);}};}function respondWithFilteredResult(_0xcde1fc,_0x3efec5){return function(_0xd78077){if(_0xd78077){var _0x402b60=typeof _0x3efec5[_0x3322('0x1a')]===_0x3322('0x1b')&&typeof _0x3efec5[_0x3322('0x1c')]==='undefined';var _0x289e94=_0xd78077['count'];var _0x151c20=_0x402b60?0x0:_0x3efec5[_0x3322('0x1a')];var _0x34eed0=_0x402b60?_0xd78077[_0x3322('0x1d')]:_0x3efec5['offset']+_0x3efec5[_0x3322('0x1c')];var _0x167359;if(_0x34eed0>=_0x289e94){_0x34eed0=_0x289e94;_0x167359=0xc8;}else{_0x167359=0xce;}_0xcde1fc[_0x3322('0x18')](_0x167359);return _0xcde1fc[_0x3322('0x1e')](_0x3322('0x1f'),_0x151c20+'-'+_0x34eed0+'/'+_0x289e94)[_0x3322('0x20')](_0xd78077);}return null;};}function patchUpdates(_0x133c23){return function(_0x129ea0){try{jsonpatch[_0x3322('0x21')](_0x129ea0,_0x133c23,!![]);}catch(_0x2a7ba3){return BPromise[_0x3322('0x22')](_0x2a7ba3);}return _0x129ea0[_0x3322('0x23')]();};}function saveUpdates(_0x203e08,_0x1e6a4e){return function(_0x177ed2){if(_0x177ed2){return _0x177ed2[_0x3322('0x24')](_0x203e08)[_0x3322('0x25')](function(_0x326826){return _0x326826;});}return null;};}function removeEntity(_0x16852b,_0x3d1609){return function(_0x1893bb){if(_0x1893bb){return _0x1893bb[_0x3322('0x26')]()['then'](function(){_0x16852b[_0x3322('0x18')](0xcc)[_0x3322('0x19')]();});}};}function handleEntityNotFound(_0x511d7a,_0x462076){return function(_0x217430){if(!_0x217430){_0x511d7a[_0x3322('0x17')](0x194);}return _0x217430;};}function handleError(_0x44f482,_0x122d35){_0x122d35=_0x122d35||0x1f4;return function(_0x3b6868){logger[_0x3322('0x27')](_0x3b6868[_0x3322('0x28')]);if(_0x3b6868[_0x3322('0x29')]){delete _0x3b6868[_0x3322('0x29')];}_0x44f482[_0x3322('0x18')](_0x122d35)['send'](_0x3b6868);};}exports['index']=function(_0x2f9ac2,_0x414b35){var _0x57f870={},_0x228f5c={},_0xd4108e={'count':0x0,'rows':[]};var _0x5d965a=_[_0x3322('0x2a')](db['FreshsalesConfiguration'][_0x3322('0x2b')],function(_0x4dfdab){return{'name':_0x4dfdab[_0x3322('0x2c')],'type':_0x4dfdab[_0x3322('0x2d')][_0x3322('0x2e')]};});_0x228f5c[_0x3322('0x2f')]=_[_0x3322('0x2a')](_0x5d965a,_0x3322('0x29'));_0x228f5c[_0x3322('0x30')]=_[_0x3322('0x31')](_0x2f9ac2[_0x3322('0x30')]);_0x228f5c['filters']=_[_0x3322('0x32')](_0x228f5c[_0x3322('0x2f')],_0x228f5c['query']);_0x57f870['attributes']=_['intersection'](_0x228f5c[_0x3322('0x2f')],qs[_0x3322('0x33')](_0x2f9ac2[_0x3322('0x30')][_0x3322('0x33')]));_0x57f870[_0x3322('0x34')]=_0x57f870[_0x3322('0x34')][_0x3322('0x35')]?_0x57f870['attributes']:_0x228f5c['model'];if(!_0x2f9ac2['query'][_0x3322('0x36')](_0x3322('0x37'))){_0x57f870[_0x3322('0x1c')]=qs[_0x3322('0x1c')](_0x2f9ac2[_0x3322('0x30')][_0x3322('0x1c')]);_0x57f870['offset']=qs['offset'](_0x2f9ac2[_0x3322('0x30')]['offset']);}_0x57f870[_0x3322('0x38')]=qs['sort'](_0x2f9ac2[_0x3322('0x30')]['sort']);_0x57f870[_0x3322('0x39')]=qs[_0x3322('0x3a')](_['pick'](_0x2f9ac2['query'],_0x228f5c['filters']),_0x5d965a);if(_0x2f9ac2[_0x3322('0x30')][_0x3322('0x3b')]){_0x57f870[_0x3322('0x39')]=_['merge'](_0x57f870[_0x3322('0x39')],{'$or':_[_0x3322('0x2a')](_0x5d965a,function(_0x56df9c){if(_0x56df9c['type']!==_0x3322('0x3c')){var _0x57334e={};_0x57334e[_0x56df9c[_0x3322('0x29')]]={'$like':'%'+_0x2f9ac2['query'][_0x3322('0x3b')]+'%'};return _0x57334e;}})});}_0x57f870=_['merge']({},_0x57f870,_0x2f9ac2[_0x3322('0x3d')]);var _0x485349={'where':_0x57f870[_0x3322('0x39')]};return db['FreshsalesConfiguration']['count'](_0x485349)[_0x3322('0x25')](function(_0x3b005f){_0xd4108e[_0x3322('0x1d')]=_0x3b005f;if(_0x2f9ac2['query'][_0x3322('0x3e')]){_0x57f870[_0x3322('0x3f')]=[{'all':!![]}];}return db[_0x3322('0x40')][_0x3322('0x41')](_0x57f870);})[_0x3322('0x25')](function(_0x35a4b9){_0xd4108e[_0x3322('0x42')]=_0x35a4b9;return _0xd4108e;})[_0x3322('0x25')](respondWithFilteredResult(_0x414b35,_0x57f870))['catch'](handleError(_0x414b35,null));};exports[_0x3322('0x43')]=function(_0x557e9e,_0x1ccc24){var _0x32ce2e={'raw':![],'where':{'id':_0x557e9e[_0x3322('0x44')]['id']}},_0x1ab9cd={};_0x1ab9cd['model']=_[_0x3322('0x31')](db['FreshsalesConfiguration'][_0x3322('0x2b')]);_0x1ab9cd[_0x3322('0x30')]=_[_0x3322('0x31')](_0x557e9e[_0x3322('0x30')]);_0x1ab9cd['filters']=_[_0x3322('0x32')](_0x1ab9cd[_0x3322('0x2f')],_0x1ab9cd['query']);_0x32ce2e[_0x3322('0x34')]=_[_0x3322('0x32')](_0x1ab9cd[_0x3322('0x2f')],qs[_0x3322('0x33')](_0x557e9e[_0x3322('0x30')][_0x3322('0x33')]));_0x32ce2e['attributes']=_0x32ce2e[_0x3322('0x34')][_0x3322('0x35')]?_0x32ce2e[_0x3322('0x34')]:_0x1ab9cd[_0x3322('0x2f')];if(_0x557e9e[_0x3322('0x30')][_0x3322('0x3e')]){_0x32ce2e[_0x3322('0x3f')]=[{'all':!![]}];}_0x32ce2e=_[_0x3322('0x45')]({},_0x32ce2e,_0x557e9e[_0x3322('0x3d')]);return db['FreshsalesConfiguration'][_0x3322('0x46')](_0x32ce2e)[_0x3322('0x25')](handleEntityNotFound(_0x1ccc24,null))[_0x3322('0x25')](respondWithResult(_0x1ccc24,null))[_0x3322('0x47')](handleError(_0x1ccc24,null));};exports[_0x3322('0x48')]=function(_0x1ce02a,_0x5eb3e4){return db[_0x3322('0x40')][_0x3322('0x48')](_0x1ce02a[_0x3322('0x49')],{})['then'](respondWithResult(_0x5eb3e4,0xc9))['catch'](handleError(_0x5eb3e4,null));};exports['update']=function(_0x1960a7,_0x131a22){if(_0x1960a7[_0x3322('0x49')]['id']){delete _0x1960a7['body']['id'];}return db['FreshsalesConfiguration'][_0x3322('0x46')]({'where':{'id':_0x1960a7['params']['id']}})[_0x3322('0x25')](handleEntityNotFound(_0x131a22,null))[_0x3322('0x25')](saveUpdates(_0x1960a7['body'],null))['then'](respondWithResult(_0x131a22,null))[_0x3322('0x47')](handleError(_0x131a22,null));};exports[_0x3322('0x26')]=function(_0x14c700,_0x542540){return db[_0x3322('0x40')]['find']({'where':{'id':_0x14c700[_0x3322('0x44')]['id']}})[_0x3322('0x25')](handleEntityNotFound(_0x542540,null))[_0x3322('0x25')](removeEntity(_0x542540,null))[_0x3322('0x47')](handleError(_0x542540,null));};exports[_0x3322('0x4a')]=function(_0x5b8f4b,_0x37b50c,_0x20a556){var _0x398806={};var _0x3715b2={};var _0x97cbf5;var _0x4fbac8;return db[_0x3322('0x40')]['findOne']({'where':{'id':_0x5b8f4b[_0x3322('0x44')]['id']}})[_0x3322('0x25')](handleEntityNotFound(_0x37b50c,null))[_0x3322('0x25')](function(_0x3337e8){if(_0x3337e8){_0x97cbf5=_0x3337e8;_0x3715b2[_0x3322('0x2f')]=_['keys'](db['FreshsalesField'][_0x3322('0x2b')]);_0x3715b2[_0x3322('0x30')]=_['keys'](_0x5b8f4b[_0x3322('0x30')]);_0x3715b2[_0x3322('0x3a')]=_[_0x3322('0x32')](_0x3715b2['model'],_0x3715b2[_0x3322('0x30')]);_0x398806['attributes']=_[_0x3322('0x32')](_0x3715b2[_0x3322('0x2f')],qs[_0x3322('0x33')](_0x5b8f4b[_0x3322('0x30')][_0x3322('0x33')]));_0x398806[_0x3322('0x34')]=_0x398806[_0x3322('0x34')]['length']?_0x398806[_0x3322('0x34')]:_0x3715b2[_0x3322('0x2f')];_0x398806[_0x3322('0x38')]=qs['sort'](_0x5b8f4b[_0x3322('0x30')][_0x3322('0x4b')]);_0x398806[_0x3322('0x39')]=qs['filters'](_[_0x3322('0x4c')](_0x5b8f4b[_0x3322('0x30')],_0x3715b2[_0x3322('0x3a')]));if(_0x5b8f4b[_0x3322('0x30')]['filter']){_0x398806[_0x3322('0x39')]=_[_0x3322('0x45')](_0x398806[_0x3322('0x39')],{'$or':_['map'](_0x398806[_0x3322('0x34')],function(_0x3432d8){var _0x4cff35={};_0x4cff35[_0x3432d8]={'$like':'%'+_0x5b8f4b[_0x3322('0x30')]['filter']+'%'};return _0x4cff35;})});}_0x398806=_[_0x3322('0x45')]({},_0x398806,_0x5b8f4b[_0x3322('0x3d')]);return _0x97cbf5['getSubjects'](_0x398806);}})['then'](function(_0x36f224){if(_0x36f224){_0x4fbac8=_0x36f224[_0x3322('0x35')];if(!_0x5b8f4b['query']['hasOwnProperty'](_0x3322('0x37'))){_0x398806['limit']=qs[_0x3322('0x1c')](_0x5b8f4b[_0x3322('0x30')][_0x3322('0x1c')]);_0x398806['offset']=qs[_0x3322('0x1a')](_0x5b8f4b['query']['offset']);}return _0x97cbf5['getSubjects'](_0x398806);}})['then'](function(_0x4d2c43){if(_0x4d2c43){return _0x4d2c43?{'count':_0x4fbac8,'rows':_0x4d2c43}:null;}})['then'](respondWithResult(_0x37b50c,null))[_0x3322('0x47')](handleError(_0x37b50c,null));};exports[_0x3322('0x4d')]=function(_0x355611,_0x402573,_0x5399b3){var _0x384db8={};var _0x3830c1={};var _0x513970;var _0x56a60a;return db[_0x3322('0x40')][_0x3322('0x4e')]({'where':{'id':_0x355611[_0x3322('0x44')]['id']}})[_0x3322('0x25')](handleEntityNotFound(_0x402573,null))[_0x3322('0x25')](function(_0x54dacc){if(_0x54dacc){_0x513970=_0x54dacc;_0x3830c1['model']=_['keys'](db[_0x3322('0x4f')]['rawAttributes']);_0x3830c1[_0x3322('0x30')]=_[_0x3322('0x31')](_0x355611['query']);_0x3830c1[_0x3322('0x3a')]=_[_0x3322('0x32')](_0x3830c1[_0x3322('0x2f')],_0x3830c1[_0x3322('0x30')]);_0x384db8[_0x3322('0x34')]=_[_0x3322('0x32')](_0x3830c1['model'],qs[_0x3322('0x33')](_0x355611[_0x3322('0x30')]['fields']));_0x384db8[_0x3322('0x34')]=_0x384db8[_0x3322('0x34')][_0x3322('0x35')]?_0x384db8[_0x3322('0x34')]:_0x3830c1['model'];_0x384db8[_0x3322('0x38')]=qs[_0x3322('0x4b')](_0x355611[_0x3322('0x30')][_0x3322('0x4b')]);_0x384db8[_0x3322('0x39')]=qs[_0x3322('0x3a')](_['pick'](_0x355611[_0x3322('0x30')],_0x3830c1['filters']));if(_0x355611[_0x3322('0x30')][_0x3322('0x3b')]){_0x384db8[_0x3322('0x39')]=_[_0x3322('0x45')](_0x384db8[_0x3322('0x39')],{'$or':_[_0x3322('0x2a')](_0x384db8[_0x3322('0x34')],function(_0x329463){var _0x5a4b91={};_0x5a4b91[_0x329463]={'$like':'%'+_0x355611[_0x3322('0x30')][_0x3322('0x3b')]+'%'};return _0x5a4b91;})});}_0x384db8=_[_0x3322('0x45')]({},_0x384db8,_0x355611[_0x3322('0x3d')]);return _0x513970[_0x3322('0x4d')](_0x384db8);}})[_0x3322('0x25')](function(_0x14563a){if(_0x14563a){_0x56a60a=_0x14563a[_0x3322('0x35')];if(!_0x355611['query'][_0x3322('0x36')](_0x3322('0x37'))){_0x384db8[_0x3322('0x1c')]=qs[_0x3322('0x1c')](_0x355611[_0x3322('0x30')][_0x3322('0x1c')]);_0x384db8[_0x3322('0x1a')]=qs[_0x3322('0x1a')](_0x355611[_0x3322('0x30')][_0x3322('0x1a')]);}return _0x513970['getDescriptions'](_0x384db8);}})[_0x3322('0x25')](function(_0x454823){if(_0x454823){return _0x454823?{'count':_0x56a60a,'rows':_0x454823}:null;}})['then'](respondWithResult(_0x402573,null))[_0x3322('0x47')](handleError(_0x402573,null));};exports[_0x3322('0x50')]=function(_0x21dbf9,_0x2126ba,_0x5920e9){var _0x3245e1={};var _0x52652e={};var _0x1b7e44;var _0x210bb3;return db[_0x3322('0x40')]['findOne']({'where':{'id':_0x21dbf9[_0x3322('0x44')]['id']}})['then'](handleEntityNotFound(_0x2126ba,null))[_0x3322('0x25')](function(_0x2a335b){if(_0x2a335b){_0x1b7e44=_0x2a335b;_0x52652e['model']=_[_0x3322('0x31')](db[_0x3322('0x4f')][_0x3322('0x2b')]);_0x52652e[_0x3322('0x30')]=_[_0x3322('0x31')](_0x21dbf9['query']);_0x52652e['filters']=_[_0x3322('0x32')](_0x52652e['model'],_0x52652e[_0x3322('0x30')]);_0x3245e1[_0x3322('0x34')]=_[_0x3322('0x32')](_0x52652e[_0x3322('0x2f')],qs[_0x3322('0x33')](_0x21dbf9[_0x3322('0x30')][_0x3322('0x33')]));_0x3245e1[_0x3322('0x34')]=_0x3245e1[_0x3322('0x34')]['length']?_0x3245e1[_0x3322('0x34')]:_0x52652e[_0x3322('0x2f')];_0x3245e1[_0x3322('0x38')]=qs['sort'](_0x21dbf9['query'][_0x3322('0x4b')]);_0x3245e1[_0x3322('0x39')]=qs[_0x3322('0x3a')](_[_0x3322('0x4c')](_0x21dbf9[_0x3322('0x30')],_0x52652e[_0x3322('0x3a')]));if(_0x21dbf9[_0x3322('0x30')]['filter']){_0x3245e1[_0x3322('0x39')]=_[_0x3322('0x45')](_0x3245e1['where'],{'$or':_['map'](_0x3245e1[_0x3322('0x34')],function(_0x59567a){var _0x3010a1={};_0x3010a1[_0x59567a]={'$like':'%'+_0x21dbf9['query'][_0x3322('0x3b')]+'%'};return _0x3010a1;})});}_0x3245e1=_['merge']({},_0x3245e1,_0x21dbf9['options']);return _0x1b7e44[_0x3322('0x50')](_0x3245e1);}})[_0x3322('0x25')](function(_0x2924bf){if(_0x2924bf){_0x210bb3=_0x2924bf[_0x3322('0x35')];if(!_0x21dbf9[_0x3322('0x30')][_0x3322('0x36')](_0x3322('0x37'))){_0x3245e1[_0x3322('0x1c')]=qs[_0x3322('0x1c')](_0x21dbf9[_0x3322('0x30')][_0x3322('0x1c')]);_0x3245e1[_0x3322('0x1a')]=qs[_0x3322('0x1a')](_0x21dbf9[_0x3322('0x30')][_0x3322('0x1a')]);}return _0x1b7e44['getFields'](_0x3245e1);}})['then'](function(_0x22ca81){if(_0x22ca81){return _0x22ca81?{'count':_0x210bb3,'rows':_0x22ca81}:null;}})[_0x3322('0x25')](respondWithResult(_0x2126ba,null))[_0x3322('0x47')](handleError(_0x2126ba,null));}; \ No newline at end of file +var _0x0b5a=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getSubjects','FreshsalesField','hasOwnProperty','nolimit','getDescriptions','getFields','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','rawAttributes','fieldName','type'];(function(_0x107b1a,_0x5c0b3d){var _0x288b01=function(_0x86084a){while(--_0x86084a){_0x107b1a['push'](_0x107b1a['shift']());}};_0x288b01(++_0x5c0b3d);}(_0x0b5a,0x175));var _0xa0b5=function(_0x30c70c,_0xbe6d54){_0x30c70c=_0x30c70c-0x0;var _0x5cab7d=_0x0b5a[_0x30c70c];return _0x5cab7d;};'use strict';var emlformat=require(_0xa0b5('0x0'));var rimraf=require(_0xa0b5('0x1'));var zipdir=require(_0xa0b5('0x2'));var jsonpatch=require(_0xa0b5('0x3'));var rp=require(_0xa0b5('0x4'));var moment=require(_0xa0b5('0x5'));var BPromise=require(_0xa0b5('0x6'));var Mustache=require(_0xa0b5('0x7'));var util=require(_0xa0b5('0x8'));var path=require(_0xa0b5('0x9'));var sox=require(_0xa0b5('0xa'));var csv=require(_0xa0b5('0xb'));var ejs=require(_0xa0b5('0xc'));var fs=require('fs');var fs_extra=require(_0xa0b5('0xd'));var _=require(_0xa0b5('0xe'));var squel=require(_0xa0b5('0xf'));var crypto=require(_0xa0b5('0x10'));var jsforce=require(_0xa0b5('0x11'));var deskjs=require(_0xa0b5('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa0b5('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0b5('0x14'));var hardwareService=require(_0xa0b5('0x15'));var logger=require('../../config/logger')(_0xa0b5('0x16'));var utils=require('../../config/utils');var config=require(_0xa0b5('0x17'));var licenseUtil=require(_0xa0b5('0x18'));var db=require(_0xa0b5('0x19'))['db'];function respondWithStatusCode(_0x31bac5,_0xca8aa7){_0xca8aa7=_0xca8aa7||0xcc;return function(_0x38e8c1){if(_0x38e8c1){return _0x31bac5[_0xa0b5('0x1a')](_0xca8aa7);}return _0x31bac5[_0xa0b5('0x1b')](_0xca8aa7)[_0xa0b5('0x1c')]();};}function respondWithResult(_0x3b336c,_0x3d5b04){_0x3d5b04=_0x3d5b04||0xc8;return function(_0x345cdd){if(_0x345cdd){return _0x3b336c[_0xa0b5('0x1b')](_0x3d5b04)[_0xa0b5('0x1d')](_0x345cdd);}};}function respondWithFilteredResult(_0x521c48,_0x1a5d9e){return function(_0x269e3c){if(_0x269e3c){var _0x593b7b=typeof _0x1a5d9e[_0xa0b5('0x1e')]===_0xa0b5('0x1f')&&typeof _0x1a5d9e['limit']===_0xa0b5('0x1f');var _0x1b9b45=_0x269e3c['count'];var _0x1b2a4c=_0x593b7b?0x0:_0x1a5d9e['offset'];var _0x2ff197=_0x593b7b?_0x269e3c[_0xa0b5('0x20')]:_0x1a5d9e['offset']+_0x1a5d9e[_0xa0b5('0x21')];var _0x2e6dab;if(_0x2ff197>=_0x1b9b45){_0x2ff197=_0x1b9b45;_0x2e6dab=0xc8;}else{_0x2e6dab=0xce;}_0x521c48['status'](_0x2e6dab);return _0x521c48[_0xa0b5('0x22')](_0xa0b5('0x23'),_0x1b2a4c+'-'+_0x2ff197+'/'+_0x1b9b45)[_0xa0b5('0x1d')](_0x269e3c);}return null;};}function patchUpdates(_0x147fd5){return function(_0x5cf2f1){try{jsonpatch[_0xa0b5('0x24')](_0x5cf2f1,_0x147fd5,!![]);}catch(_0x4ec755){return BPromise[_0xa0b5('0x25')](_0x4ec755);}return _0x5cf2f1[_0xa0b5('0x26')]();};}function saveUpdates(_0x5e9040,_0x3dae95){return function(_0x23bf71){if(_0x23bf71){return _0x23bf71['update'](_0x5e9040)[_0xa0b5('0x27')](function(_0x2346d5){return _0x2346d5;});}return null;};}function removeEntity(_0x51061e,_0x44773e){return function(_0x50aa3a){if(_0x50aa3a){return _0x50aa3a[_0xa0b5('0x28')]()[_0xa0b5('0x27')](function(){_0x51061e['status'](0xcc)[_0xa0b5('0x1c')]();});}};}function handleEntityNotFound(_0x58631f,_0x100610){return function(_0x3e04cd){if(!_0x3e04cd){_0x58631f['sendStatus'](0x194);}return _0x3e04cd;};}function handleError(_0x42fa2b,_0x4924e0){_0x4924e0=_0x4924e0||0x1f4;return function(_0x350aca){logger['error'](_0x350aca[_0xa0b5('0x29')]);if(_0x350aca[_0xa0b5('0x2a')]){delete _0x350aca[_0xa0b5('0x2a')];}_0x42fa2b[_0xa0b5('0x1b')](_0x4924e0)['send'](_0x350aca);};}exports[_0xa0b5('0x2b')]=function(_0x934795,_0x46a178){var _0x1e243a={},_0x36fd82={},_0x10edd6={'count':0x0,'rows':[]};var _0x45f27=_['map'](db['FreshsalesConfiguration'][_0xa0b5('0x2c')],function(_0x2b46b6){return{'name':_0x2b46b6[_0xa0b5('0x2d')],'type':_0x2b46b6[_0xa0b5('0x2e')][_0xa0b5('0x2f')]};});_0x36fd82[_0xa0b5('0x30')]=_['map'](_0x45f27,_0xa0b5('0x2a'));_0x36fd82[_0xa0b5('0x31')]=_[_0xa0b5('0x32')](_0x934795[_0xa0b5('0x31')]);_0x36fd82[_0xa0b5('0x33')]=_[_0xa0b5('0x34')](_0x36fd82[_0xa0b5('0x30')],_0x36fd82[_0xa0b5('0x31')]);_0x1e243a[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x36fd82[_0xa0b5('0x30')],qs[_0xa0b5('0x36')](_0x934795['query'][_0xa0b5('0x36')]));_0x1e243a[_0xa0b5('0x35')]=_0x1e243a[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x1e243a['attributes']:_0x36fd82[_0xa0b5('0x30')];if(!_0x934795[_0xa0b5('0x31')]['hasOwnProperty']('nolimit')){_0x1e243a[_0xa0b5('0x21')]=qs['limit'](_0x934795[_0xa0b5('0x31')]['limit']);_0x1e243a[_0xa0b5('0x1e')]=qs[_0xa0b5('0x1e')](_0x934795[_0xa0b5('0x31')]['offset']);}_0x1e243a[_0xa0b5('0x38')]=qs[_0xa0b5('0x39')](_0x934795[_0xa0b5('0x31')][_0xa0b5('0x39')]);_0x1e243a[_0xa0b5('0x3a')]=qs[_0xa0b5('0x33')](_[_0xa0b5('0x3b')](_0x934795[_0xa0b5('0x31')],_0x36fd82[_0xa0b5('0x33')]),_0x45f27);if(_0x934795[_0xa0b5('0x31')][_0xa0b5('0x3c')]){_0x1e243a[_0xa0b5('0x3a')]=_[_0xa0b5('0x3d')](_0x1e243a[_0xa0b5('0x3a')],{'$or':_['map'](_0x45f27,function(_0x106f00){if(_0x106f00[_0xa0b5('0x2e')]!==_0xa0b5('0x3e')){var _0x3bae9d={};_0x3bae9d[_0x106f00[_0xa0b5('0x2a')]]={'$like':'%'+_0x934795[_0xa0b5('0x31')][_0xa0b5('0x3c')]+'%'};return _0x3bae9d;}})});}_0x1e243a=_[_0xa0b5('0x3d')]({},_0x1e243a,_0x934795[_0xa0b5('0x3f')]);var _0x1b0216={'where':_0x1e243a['where']};return db[_0xa0b5('0x40')][_0xa0b5('0x20')](_0x1b0216)[_0xa0b5('0x27')](function(_0x1cda30){_0x10edd6[_0xa0b5('0x20')]=_0x1cda30;if(_0x934795[_0xa0b5('0x31')][_0xa0b5('0x41')]){_0x1e243a[_0xa0b5('0x42')]=[{'all':!![]}];}return db[_0xa0b5('0x40')][_0xa0b5('0x43')](_0x1e243a);})[_0xa0b5('0x27')](function(_0x5d55ef){_0x10edd6[_0xa0b5('0x44')]=_0x5d55ef;return _0x10edd6;})['then'](respondWithFilteredResult(_0x46a178,_0x1e243a))[_0xa0b5('0x45')](handleError(_0x46a178,null));};exports[_0xa0b5('0x46')]=function(_0x2824cd,_0xf20f5f){var _0x19b04c={'raw':![],'where':{'id':_0x2824cd[_0xa0b5('0x47')]['id']}},_0x6d5745={};_0x6d5745[_0xa0b5('0x30')]=_[_0xa0b5('0x32')](db['FreshsalesConfiguration'][_0xa0b5('0x2c')]);_0x6d5745['query']=_[_0xa0b5('0x32')](_0x2824cd[_0xa0b5('0x31')]);_0x6d5745[_0xa0b5('0x33')]=_[_0xa0b5('0x34')](_0x6d5745[_0xa0b5('0x30')],_0x6d5745[_0xa0b5('0x31')]);_0x19b04c[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x6d5745[_0xa0b5('0x30')],qs[_0xa0b5('0x36')](_0x2824cd[_0xa0b5('0x31')][_0xa0b5('0x36')]));_0x19b04c[_0xa0b5('0x35')]=_0x19b04c[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x19b04c[_0xa0b5('0x35')]:_0x6d5745['model'];if(_0x2824cd[_0xa0b5('0x31')]['includeAll']){_0x19b04c[_0xa0b5('0x42')]=[{'all':!![]}];}_0x19b04c=_[_0xa0b5('0x3d')]({},_0x19b04c,_0x2824cd[_0xa0b5('0x3f')]);return db[_0xa0b5('0x40')][_0xa0b5('0x48')](_0x19b04c)[_0xa0b5('0x27')](handleEntityNotFound(_0xf20f5f,null))[_0xa0b5('0x27')](respondWithResult(_0xf20f5f,null))[_0xa0b5('0x45')](handleError(_0xf20f5f,null));};exports[_0xa0b5('0x49')]=function(_0x13a5fd,_0x5578c5){return db['FreshsalesConfiguration'][_0xa0b5('0x49')](_0x13a5fd[_0xa0b5('0x4a')],{})[_0xa0b5('0x27')](respondWithResult(_0x5578c5,0xc9))[_0xa0b5('0x45')](handleError(_0x5578c5,null));};exports[_0xa0b5('0x4b')]=function(_0x47b87d,_0x30e161){if(_0x47b87d[_0xa0b5('0x4a')]['id']){delete _0x47b87d[_0xa0b5('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0xa0b5('0x48')]({'where':{'id':_0x47b87d[_0xa0b5('0x47')]['id']}})[_0xa0b5('0x27')](handleEntityNotFound(_0x30e161,null))[_0xa0b5('0x27')](saveUpdates(_0x47b87d[_0xa0b5('0x4a')],null))['then'](respondWithResult(_0x30e161,null))[_0xa0b5('0x45')](handleError(_0x30e161,null));};exports[_0xa0b5('0x28')]=function(_0x11771,_0x31bcbe){return db['FreshsalesConfiguration'][_0xa0b5('0x48')]({'where':{'id':_0x11771['params']['id']}})['then'](handleEntityNotFound(_0x31bcbe,null))[_0xa0b5('0x27')](removeEntity(_0x31bcbe,null))[_0xa0b5('0x45')](handleError(_0x31bcbe,null));};exports[_0xa0b5('0x4c')]=function(_0x2ff85a,_0x1e7d3e,_0x300da8){var _0x540d19={};var _0x4d52f1={};var _0x2f2ab9;var _0x52cd90;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x2ff85a[_0xa0b5('0x47')]['id']}})[_0xa0b5('0x27')](handleEntityNotFound(_0x1e7d3e,null))['then'](function(_0x31b707){if(_0x31b707){_0x2f2ab9=_0x31b707;_0x4d52f1[_0xa0b5('0x30')]=_[_0xa0b5('0x32')](db[_0xa0b5('0x4d')][_0xa0b5('0x2c')]);_0x4d52f1['query']=_['keys'](_0x2ff85a[_0xa0b5('0x31')]);_0x4d52f1[_0xa0b5('0x33')]=_[_0xa0b5('0x34')](_0x4d52f1[_0xa0b5('0x30')],_0x4d52f1[_0xa0b5('0x31')]);_0x540d19[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x4d52f1['model'],qs[_0xa0b5('0x36')](_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x36')]));_0x540d19[_0xa0b5('0x35')]=_0x540d19[_0xa0b5('0x35')]['length']?_0x540d19[_0xa0b5('0x35')]:_0x4d52f1['model'];_0x540d19['order']=qs['sort'](_0x2ff85a['query'][_0xa0b5('0x39')]);_0x540d19[_0xa0b5('0x3a')]=qs[_0xa0b5('0x33')](_['pick'](_0x2ff85a['query'],_0x4d52f1[_0xa0b5('0x33')]));if(_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x3c')]){_0x540d19[_0xa0b5('0x3a')]=_[_0xa0b5('0x3d')](_0x540d19[_0xa0b5('0x3a')],{'$or':_['map'](_0x540d19[_0xa0b5('0x35')],function(_0x338fc5){var _0x5a55c5={};_0x5a55c5[_0x338fc5]={'$like':'%'+_0x2ff85a[_0xa0b5('0x31')]['filter']+'%'};return _0x5a55c5;})});}_0x540d19=_['merge']({},_0x540d19,_0x2ff85a[_0xa0b5('0x3f')]);return _0x2f2ab9['getSubjects'](_0x540d19);}})['then'](function(_0x2208b9){if(_0x2208b9){_0x52cd90=_0x2208b9[_0xa0b5('0x37')];if(!_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x4e')](_0xa0b5('0x4f'))){_0x540d19['limit']=qs[_0xa0b5('0x21')](_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x21')]);_0x540d19[_0xa0b5('0x1e')]=qs[_0xa0b5('0x1e')](_0x2ff85a['query'][_0xa0b5('0x1e')]);}return _0x2f2ab9[_0xa0b5('0x4c')](_0x540d19);}})['then'](function(_0x4490ec){if(_0x4490ec){return _0x4490ec?{'count':_0x52cd90,'rows':_0x4490ec}:null;}})[_0xa0b5('0x27')](respondWithResult(_0x1e7d3e,null))[_0xa0b5('0x45')](handleError(_0x1e7d3e,null));};exports['getDescriptions']=function(_0x4bc37c,_0x83d511,_0x8c53d){var _0x3a6486={};var _0x4378f0={};var _0x14f830;var _0x4b2c8a;return db[_0xa0b5('0x40')]['findOne']({'where':{'id':_0x4bc37c[_0xa0b5('0x47')]['id']}})[_0xa0b5('0x27')](handleEntityNotFound(_0x83d511,null))[_0xa0b5('0x27')](function(_0x1a23cb){if(_0x1a23cb){_0x14f830=_0x1a23cb;_0x4378f0['model']=_[_0xa0b5('0x32')](db[_0xa0b5('0x4d')][_0xa0b5('0x2c')]);_0x4378f0[_0xa0b5('0x31')]=_[_0xa0b5('0x32')](_0x4bc37c[_0xa0b5('0x31')]);_0x4378f0['filters']=_[_0xa0b5('0x34')](_0x4378f0[_0xa0b5('0x30')],_0x4378f0[_0xa0b5('0x31')]);_0x3a6486['attributes']=_[_0xa0b5('0x34')](_0x4378f0[_0xa0b5('0x30')],qs['fields'](_0x4bc37c[_0xa0b5('0x31')]['fields']));_0x3a6486['attributes']=_0x3a6486[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x3a6486['attributes']:_0x4378f0[_0xa0b5('0x30')];_0x3a6486[_0xa0b5('0x38')]=qs[_0xa0b5('0x39')](_0x4bc37c[_0xa0b5('0x31')]['sort']);_0x3a6486[_0xa0b5('0x3a')]=qs[_0xa0b5('0x33')](_['pick'](_0x4bc37c[_0xa0b5('0x31')],_0x4378f0[_0xa0b5('0x33')]));if(_0x4bc37c['query'][_0xa0b5('0x3c')]){_0x3a6486[_0xa0b5('0x3a')]=_[_0xa0b5('0x3d')](_0x3a6486[_0xa0b5('0x3a')],{'$or':_['map'](_0x3a6486['attributes'],function(_0x16a2a7){var _0xd7fdc={};_0xd7fdc[_0x16a2a7]={'$like':'%'+_0x4bc37c['query']['filter']+'%'};return _0xd7fdc;})});}_0x3a6486=_['merge']({},_0x3a6486,_0x4bc37c[_0xa0b5('0x3f')]);return _0x14f830['getDescriptions'](_0x3a6486);}})[_0xa0b5('0x27')](function(_0x2d5104){if(_0x2d5104){_0x4b2c8a=_0x2d5104['length'];if(!_0x4bc37c[_0xa0b5('0x31')][_0xa0b5('0x4e')]('nolimit')){_0x3a6486[_0xa0b5('0x21')]=qs[_0xa0b5('0x21')](_0x4bc37c['query'][_0xa0b5('0x21')]);_0x3a6486['offset']=qs[_0xa0b5('0x1e')](_0x4bc37c[_0xa0b5('0x31')][_0xa0b5('0x1e')]);}return _0x14f830[_0xa0b5('0x50')](_0x3a6486);}})['then'](function(_0x53002b){if(_0x53002b){return _0x53002b?{'count':_0x4b2c8a,'rows':_0x53002b}:null;}})[_0xa0b5('0x27')](respondWithResult(_0x83d511,null))['catch'](handleError(_0x83d511,null));};exports[_0xa0b5('0x51')]=function(_0x7eb729,_0x1de792,_0x554a95){var _0x2a0e08={};var _0x1a0611={};var _0x2a3ee5;var _0x239e77;return db[_0xa0b5('0x40')][_0xa0b5('0x52')]({'where':{'id':_0x7eb729['params']['id']}})['then'](handleEntityNotFound(_0x1de792,null))['then'](function(_0x234359){if(_0x234359){_0x2a3ee5=_0x234359;_0x1a0611[_0xa0b5('0x30')]=_[_0xa0b5('0x32')](db[_0xa0b5('0x4d')][_0xa0b5('0x2c')]);_0x1a0611[_0xa0b5('0x31')]=_[_0xa0b5('0x32')](_0x7eb729[_0xa0b5('0x31')]);_0x1a0611[_0xa0b5('0x33')]=_['intersection'](_0x1a0611[_0xa0b5('0x30')],_0x1a0611[_0xa0b5('0x31')]);_0x2a0e08[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x1a0611[_0xa0b5('0x30')],qs[_0xa0b5('0x36')](_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x36')]));_0x2a0e08['attributes']=_0x2a0e08[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x2a0e08['attributes']:_0x1a0611[_0xa0b5('0x30')];_0x2a0e08[_0xa0b5('0x38')]=qs['sort'](_0x7eb729[_0xa0b5('0x31')]['sort']);_0x2a0e08['where']=qs[_0xa0b5('0x33')](_[_0xa0b5('0x3b')](_0x7eb729['query'],_0x1a0611[_0xa0b5('0x33')]));if(_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x3c')]){_0x2a0e08[_0xa0b5('0x3a')]=_['merge'](_0x2a0e08['where'],{'$or':_[_0xa0b5('0x53')](_0x2a0e08[_0xa0b5('0x35')],function(_0x23617c){var _0x1d76b={};_0x1d76b[_0x23617c]={'$like':'%'+_0x7eb729[_0xa0b5('0x31')]['filter']+'%'};return _0x1d76b;})});}_0x2a0e08=_[_0xa0b5('0x3d')]({},_0x2a0e08,_0x7eb729[_0xa0b5('0x3f')]);return _0x2a3ee5['getFields'](_0x2a0e08);}})['then'](function(_0x47a4bc){if(_0x47a4bc){_0x239e77=_0x47a4bc[_0xa0b5('0x37')];if(!_0x7eb729['query']['hasOwnProperty'](_0xa0b5('0x4f'))){_0x2a0e08[_0xa0b5('0x21')]=qs[_0xa0b5('0x21')](_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x21')]);_0x2a0e08[_0xa0b5('0x1e')]=qs['offset'](_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x1e')]);}return _0x2a3ee5['getFields'](_0x2a0e08);}})['then'](function(_0x55c47c){if(_0x55c47c){return _0x55c47c?{'count':_0x239e77,'rows':_0x55c47c}:null;}})[_0xa0b5('0x27')](respondWithResult(_0x1de792,null))[_0xa0b5('0x45')](handleError(_0x1de792,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4bf0cb5..7bcb7a1 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 _0x8bbd=['FreshsalesConfiguration','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0xb8724,_0x4400aa){var _0x454e2e=function(_0x3161e7){while(--_0x3161e7){_0xb8724['push'](_0xb8724['shift']());}};_0x454e2e(++_0x4400aa);}(_0x8bbd,0x1e5));var _0xd8bb=function(_0x366fbc,_0x2d1c58){_0x366fbc=_0x366fbc-0x0;var _0xa93ea3=_0x8bbd[_0x366fbc];return _0xa93ea3;};'use strict';var _=require(_0xd8bb('0x0'));var util=require(_0xd8bb('0x1'));var logger=require(_0xd8bb('0x2'))(_0xd8bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8bb('0x4'));var fs=require('fs');var path=require(_0xd8bb('0x5'));var rimraf=require(_0xd8bb('0x6'));var config=require(_0xd8bb('0x7'));var attributes=require(_0xd8bb('0x8'));module[_0xd8bb('0x9')]=function(_0x466e40,_0x33449b){return _0x466e40['define'](_0xd8bb('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c10=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1fd4cb,_0x25f3ee){var _0x45e715=function(_0x3e8e3a){while(--_0x3e8e3a){_0x1fd4cb['push'](_0x1fd4cb['shift']());}};_0x45e715(++_0x25f3ee);}(_0x0c10,0xfe));var _0x00c1=function(_0x40ad05,_0x18c3ae){_0x40ad05=_0x40ad05-0x0;var _0x5cc00f=_0x0c10[_0x40ad05];return _0x5cc00f;};'use strict';var _=require(_0x00c1('0x0'));var util=require(_0x00c1('0x1'));var logger=require(_0x00c1('0x2'))(_0x00c1('0x3'));var moment=require(_0x00c1('0x4'));var BPromise=require(_0x00c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00c1('0x6'));var rimraf=require(_0x00c1('0x7'));var config=require('../../config/environment');var attributes=require(_0x00c1('0x8'));module[_0x00c1('0x9')]=function(_0x5151f6,_0x4fb8c2){return _0x5151f6[_0x00c1('0xa')](_0x00c1('0xb'),attributes,{'tableName':_0x00c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 8dc3e6d..b5488bc 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 _0xf51e=['message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xeb4a1f,_0x4d9e4a){var _0x2a36af=function(_0x28c7d7){while(--_0x28c7d7){_0xeb4a1f['push'](_0xeb4a1f['shift']());}};_0x2a36af(++_0x4d9e4a);}(_0xf51e,0xca));var _0xef51=function(_0xb3c2c3,_0x30b158){_0xb3c2c3=_0xb3c2c3-0x0;var _0x2d5f11=_0xf51e[_0xb3c2c3];return _0x2d5f11;};'use strict';var _=require('lodash');var util=require(_0xef51('0x0'));var moment=require(_0xef51('0x1'));var BPromise=require(_0xef51('0x2'));var rs=require(_0xef51('0x3'));var fs=require('fs');var Redis=require(_0xef51('0x4'));var db=require(_0xef51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef51('0x6'))(_0xef51('0x7'));var config=require(_0xef51('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xef51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d45b6,_0x371841,_0x3a0e94){return new BPromise(function(_0x4b7f78,_0x42c1d9){return client[_0xef51('0xa')](_0x8d45b6,_0x3a0e94)[_0xef51('0xb')](function(_0x448837){logger[_0xef51('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x371841,_0xef51('0xd'));logger[_0xef51('0xe')](_0xef51('0xf'),_0x371841,_0xef51('0xd'),JSON[_0xef51('0x10')](_0x448837));if(_0x448837[_0xef51('0x11')]){if(_0x448837[_0xef51('0x11')]['code']===0x1f4){logger[_0xef51('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x371841,_0x448837[_0xef51('0x11')][_0xef51('0x12')]);return _0x42c1d9(_0x448837[_0xef51('0x11')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x371841,_0x448837[_0xef51('0x11')][_0xef51('0x12')]);return _0x4b7f78(_0x448837[_0xef51('0x11')][_0xef51('0x12')]);}else{logger[_0xef51('0xc')](_0xef51('0x13'),_0x371841,'request\x20sent');_0x4b7f78(_0x448837[_0xef51('0x14')]['message']);}})[_0xef51('0x15')](function(_0xbda407){logger[_0xef51('0x11')](_0xef51('0x13'),_0x371841,_0xbda407);_0x42c1d9(_0xbda407);});});} \ No newline at end of file +var _0xd81f=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xd81f,0x8a));var _0xfd81=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xd81f[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0xfd81('0x0'));var util=require(_0xfd81('0x1'));var moment=require(_0xfd81('0x2'));var BPromise=require(_0xfd81('0x3'));var rs=require(_0xfd81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd81('0x5'))['db'];var utils=require(_0xfd81('0x6'));var logger=require(_0xfd81('0x7'))(_0xfd81('0x8'));var config=require(_0xfd81('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfd81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ef3fe,_0x1ab8e3,_0x28f5a2){return new BPromise(function(_0x473981,_0x2759b7){return client[_0xfd81('0xb')](_0x2ef3fe,_0x28f5a2)[_0xfd81('0xc')](function(_0x373491){logger[_0xfd81('0xd')](_0xfd81('0xe'),_0x1ab8e3,'request\x20sent');logger[_0xfd81('0xf')](_0xfd81('0x10'),_0x1ab8e3,'request\x20sent',JSON['stringify'](_0x373491));if(_0x373491[_0xfd81('0x11')]){if(_0x373491[_0xfd81('0x11')][_0xfd81('0x12')]===0x1f4){logger[_0xfd81('0x11')](_0xfd81('0xe'),_0x1ab8e3,_0x373491[_0xfd81('0x11')][_0xfd81('0x13')]);return _0x2759b7(_0x373491[_0xfd81('0x11')]['message']);}logger[_0xfd81('0x11')](_0xfd81('0xe'),_0x1ab8e3,_0x373491[_0xfd81('0x11')][_0xfd81('0x13')]);return _0x473981(_0x373491['error'][_0xfd81('0x13')]);}else{logger[_0xfd81('0xd')](_0xfd81('0xe'),_0x1ab8e3,_0xfd81('0x14'));_0x473981(_0x373491[_0xfd81('0x15')][_0xfd81('0x13')]);}})['catch'](function(_0x298152){logger[_0xfd81('0x11')](_0xfd81('0xe'),_0x1ab8e3,_0x298152);_0x2759b7(_0x298152);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 607eee3..fe87924 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 _0x43f3=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1eae3c,_0x34b41b){var _0x4a6b10=function(_0xbccda8){while(--_0xbccda8){_0x1eae3c['push'](_0x1eae3c['shift']());}};_0x4a6b10(++_0x34b41b);}(_0x43f3,0xab));var _0x343f=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x43f3[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require('multer');var util=require(_0x343f('0x0'));var path=require(_0x343f('0x1'));var timeout=require('connect-timeout');var express=require(_0x343f('0x2'));var router=express['Router']();var fs_extra=require(_0x343f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x343f('0x4'));var config=require(_0x343f('0x5'));var controller=require(_0x343f('0x6'));router['get']('/',auth[_0x343f('0x7')](),controller[_0x343f('0x8')]);router[_0x343f('0x9')](_0x343f('0xa'),auth[_0x343f('0x7')](),controller[_0x343f('0xb')]);router[_0x343f('0xc')]('/',auth[_0x343f('0x7')](),controller[_0x343f('0xd')]);router[_0x343f('0xe')](_0x343f('0xa'),auth[_0x343f('0x7')](),controller[_0x343f('0xf')]);router[_0x343f('0x10')](_0x343f('0xa'),auth[_0x343f('0x7')](),controller[_0x343f('0x11')]);module[_0x343f('0x12')]=router; \ No newline at end of file +var _0xc737=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','get','isAuthenticated','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x20d32c,_0x433c36){var _0x546acf=function(_0x1b4ffb){while(--_0x1b4ffb){_0x20d32c['push'](_0x20d32c['shift']());}};_0x546acf(++_0x433c36);}(_0xc737,0x154));var _0x7c73=function(_0xffaf6f,_0x3833bc){_0xffaf6f=_0xffaf6f-0x0;var _0x42bcf2=_0xc737[_0xffaf6f];return _0x42bcf2;};'use strict';var multer=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var path=require(_0x7c73('0x2'));var timeout=require(_0x7c73('0x3'));var express=require('express');var router=express[_0x7c73('0x4')]();var fs_extra=require(_0x7c73('0x5'));var auth=require(_0x7c73('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7c73('0x7'));var controller=require(_0x7c73('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c73('0x9')]);router[_0x7c73('0xa')]('/:id',auth[_0x7c73('0xb')](),controller[_0x7c73('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c73('0xd')]);router[_0x7c73('0xe')](_0x7c73('0xf'),auth['isAuthenticated'](),controller[_0x7c73('0x10')]);router[_0x7c73('0x11')]('/:id',auth[_0x7c73('0xb')](),controller['destroy']);module[_0x7c73('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f7eacc0..db5e11a 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 _0x4395=['keyValue','picklist','variable','customVariable','STRING','sequelize','exports','ENUM','string'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4395,0xb9));var _0x5439=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4395[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5439('0x0'));module[_0x5439('0x1')]={'type':{'type':Sequelize[_0x5439('0x2')](_0x5439('0x3'),'variable','customVariable',_0x5439('0x4'),_0x5439('0x5')),'defaultValue':_0x5439('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5439('0x2')](_0x5439('0x3'),_0x5439('0x6'),_0x5439('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5439('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5439('0x8')]}}; \ No newline at end of file +var _0xa786=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x3f1812,_0x2e919f){var _0x5b88ec=function(_0x90ed0d){while(--_0x90ed0d){_0x3f1812['push'](_0x3f1812['shift']());}};_0x5b88ec(++_0x2e919f);}(_0xa786,0x1d1));var _0x6a78=function(_0x5c6062,_0x3ae632){_0x5c6062=_0x5c6062-0x0;var _0x140331=_0xa786[_0x5c6062];return _0x140331;};'use strict';var Sequelize=require(_0x6a78('0x0'));module[_0x6a78('0x1')]={'type':{'type':Sequelize[_0x6a78('0x2')]('string',_0x6a78('0x3'),'customVariable',_0x6a78('0x4'),_0x6a78('0x5')),'defaultValue':_0x6a78('0x6')},'content':{'type':Sequelize[_0x6a78('0x7')]},'key':{'type':Sequelize[_0x6a78('0x7')]},'keyType':{'type':Sequelize[_0x6a78('0x2')](_0x6a78('0x6'),_0x6a78('0x3'),_0x6a78('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6a78('0x7')]},'nameField':{'type':Sequelize[_0x6a78('0x7')]},'customField':{'type':Sequelize[_0x6a78('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a78('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index cf2bb79..9b92e5c 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 _0xa7c4=['limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined'];(function(_0xe5846b,_0x4d4c28){var _0x4322b2=function(_0x2c0a9e){while(--_0x2c0a9e){_0xe5846b['push'](_0xe5846b['shift']());}};_0x4322b2(++_0x4d4c28);}(_0xa7c4,0x111));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4a7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a7c('0x1'));var jsonpatch=require(_0x4a7c('0x2'));var rp=require(_0x4a7c('0x3'));var moment=require(_0x4a7c('0x4'));var BPromise=require(_0x4a7c('0x5'));var Mustache=require('mustache');var util=require(_0x4a7c('0x6'));var path=require('path');var sox=require(_0x4a7c('0x7'));var csv=require(_0x4a7c('0x8'));var ejs=require(_0x4a7c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a7c('0xa'));var squel=require(_0x4a7c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a7c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4a7c('0xd'));var Papa=require(_0x4a7c('0xe'));var Redis=require(_0x4a7c('0xf'));var authService=require(_0x4a7c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a7c('0x11'));var logger=require('../../config/logger')(_0x4a7c('0x12'));var utils=require(_0x4a7c('0x13'));var config=require(_0x4a7c('0x14'));var licenseUtil=require(_0x4a7c('0x15'));var db=require(_0x4a7c('0x16'))['db'];function respondWithStatusCode(_0x1a5496,_0xc9e12){_0xc9e12=_0xc9e12||0xcc;return function(_0x5563ed){if(_0x5563ed){return _0x1a5496[_0x4a7c('0x17')](_0xc9e12);}return _0x1a5496[_0x4a7c('0x18')](_0xc9e12)[_0x4a7c('0x19')]();};}function respondWithResult(_0x1e3bfc,_0x14cf63){_0x14cf63=_0x14cf63||0xc8;return function(_0x6ae76){if(_0x6ae76){return _0x1e3bfc[_0x4a7c('0x18')](_0x14cf63)['json'](_0x6ae76);}};}function respondWithFilteredResult(_0x11db06,_0x265c07){return function(_0xc64406){if(_0xc64406){var _0x206fd0=typeof _0x265c07['offset']===_0x4a7c('0x1a')&&typeof _0x265c07[_0x4a7c('0x1b')]==='undefined';var _0x1f2731=_0xc64406['count'];var _0x53ebe9=_0x206fd0?0x0:_0x265c07[_0x4a7c('0x1c')];var _0x4e7205=_0x206fd0?_0xc64406[_0x4a7c('0x1d')]:_0x265c07[_0x4a7c('0x1c')]+_0x265c07[_0x4a7c('0x1b')];var _0x36cc6a;if(_0x4e7205>=_0x1f2731){_0x4e7205=_0x1f2731;_0x36cc6a=0xc8;}else{_0x36cc6a=0xce;}_0x11db06[_0x4a7c('0x18')](_0x36cc6a);return _0x11db06[_0x4a7c('0x1e')](_0x4a7c('0x1f'),_0x53ebe9+'-'+_0x4e7205+'/'+_0x1f2731)[_0x4a7c('0x20')](_0xc64406);}return null;};}function patchUpdates(_0x421825){return function(_0x2a94e){try{jsonpatch[_0x4a7c('0x21')](_0x2a94e,_0x421825,!![]);}catch(_0x48cc01){return BPromise[_0x4a7c('0x22')](_0x48cc01);}return _0x2a94e[_0x4a7c('0x23')]();};}function saveUpdates(_0x1a5b45,_0x15011d){return function(_0x5d7257){if(_0x5d7257){return _0x5d7257[_0x4a7c('0x24')](_0x1a5b45)[_0x4a7c('0x25')](function(_0x28eb22){return _0x28eb22;});}return null;};}function removeEntity(_0xb11ac8,_0x133a7c){return function(_0x1878f0){if(_0x1878f0){return _0x1878f0[_0x4a7c('0x26')]()['then'](function(){_0xb11ac8[_0x4a7c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321d08,_0x591644){return function(_0x272fd6){if(!_0x272fd6){_0x321d08[_0x4a7c('0x17')](0x194);}return _0x272fd6;};}function handleError(_0x40ccc3,_0x5ef5ee){_0x5ef5ee=_0x5ef5ee||0x1f4;return function(_0x43efbb){logger[_0x4a7c('0x27')](_0x43efbb[_0x4a7c('0x28')]);if(_0x43efbb[_0x4a7c('0x29')]){delete _0x43efbb[_0x4a7c('0x29')];}_0x40ccc3['status'](_0x5ef5ee)[_0x4a7c('0x2a')](_0x43efbb);};}exports[_0x4a7c('0x2b')]=function(_0x233011,_0x236078){var _0x3b51ad={},_0x5c4bd0={},_0x2b02c6={'count':0x0,'rows':[]};var _0x4aaea7=_[_0x4a7c('0x2c')](db[_0x4a7c('0x2d')]['rawAttributes'],function(_0x4ebfbe){return{'name':_0x4ebfbe[_0x4a7c('0x2e')],'type':_0x4ebfbe['type'][_0x4a7c('0x2f')]};});_0x5c4bd0[_0x4a7c('0x30')]=_['map'](_0x4aaea7,'name');_0x5c4bd0[_0x4a7c('0x31')]=_[_0x4a7c('0x32')](_0x233011[_0x4a7c('0x31')]);_0x5c4bd0[_0x4a7c('0x33')]=_[_0x4a7c('0x34')](_0x5c4bd0[_0x4a7c('0x30')],_0x5c4bd0[_0x4a7c('0x31')]);_0x3b51ad[_0x4a7c('0x35')]=_[_0x4a7c('0x34')](_0x5c4bd0[_0x4a7c('0x30')],qs['fields'](_0x233011['query']['fields']));_0x3b51ad[_0x4a7c('0x35')]=_0x3b51ad[_0x4a7c('0x35')][_0x4a7c('0x36')]?_0x3b51ad[_0x4a7c('0x35')]:_0x5c4bd0[_0x4a7c('0x30')];if(!_0x233011['query'][_0x4a7c('0x37')]('nolimit')){_0x3b51ad[_0x4a7c('0x1b')]=qs[_0x4a7c('0x1b')](_0x233011['query'][_0x4a7c('0x1b')]);_0x3b51ad[_0x4a7c('0x1c')]=qs[_0x4a7c('0x1c')](_0x233011['query']['offset']);}_0x3b51ad[_0x4a7c('0x38')]=qs[_0x4a7c('0x39')](_0x233011[_0x4a7c('0x31')]['sort']);_0x3b51ad[_0x4a7c('0x3a')]=qs[_0x4a7c('0x33')](_[_0x4a7c('0x3b')](_0x233011['query'],_0x5c4bd0[_0x4a7c('0x33')]),_0x4aaea7);if(_0x233011[_0x4a7c('0x31')][_0x4a7c('0x3c')]){_0x3b51ad['where']=_[_0x4a7c('0x3d')](_0x3b51ad['where'],{'$or':_[_0x4a7c('0x2c')](_0x4aaea7,function(_0x23ee58){if(_0x23ee58[_0x4a7c('0x3e')]!==_0x4a7c('0x3f')){var _0x553718={};_0x553718[_0x23ee58[_0x4a7c('0x29')]]={'$like':'%'+_0x233011['query'][_0x4a7c('0x3c')]+'%'};return _0x553718;}})});}_0x3b51ad=_[_0x4a7c('0x3d')]({},_0x3b51ad,_0x233011[_0x4a7c('0x40')]);var _0x178862={'where':_0x3b51ad[_0x4a7c('0x3a')]};return db[_0x4a7c('0x2d')][_0x4a7c('0x1d')](_0x178862)[_0x4a7c('0x25')](function(_0x3cba21){_0x2b02c6[_0x4a7c('0x1d')]=_0x3cba21;if(_0x233011[_0x4a7c('0x31')][_0x4a7c('0x41')]){_0x3b51ad['include']=[{'all':!![]}];}return db[_0x4a7c('0x2d')][_0x4a7c('0x42')](_0x3b51ad);})[_0x4a7c('0x25')](function(_0x3a42b0){_0x2b02c6['rows']=_0x3a42b0;return _0x2b02c6;})[_0x4a7c('0x25')](respondWithFilteredResult(_0x236078,_0x3b51ad))[_0x4a7c('0x43')](handleError(_0x236078,null));};exports[_0x4a7c('0x44')]=function(_0x382267,_0x29552f){var _0xf075b3={'raw':!![],'where':{'id':_0x382267[_0x4a7c('0x45')]['id']}},_0x30a4d1={};_0x30a4d1[_0x4a7c('0x30')]=_[_0x4a7c('0x32')](db[_0x4a7c('0x2d')][_0x4a7c('0x46')]);_0x30a4d1[_0x4a7c('0x31')]=_['keys'](_0x382267[_0x4a7c('0x31')]);_0x30a4d1[_0x4a7c('0x33')]=_[_0x4a7c('0x34')](_0x30a4d1['model'],_0x30a4d1[_0x4a7c('0x31')]);_0xf075b3[_0x4a7c('0x35')]=_[_0x4a7c('0x34')](_0x30a4d1[_0x4a7c('0x30')],qs[_0x4a7c('0x47')](_0x382267['query'][_0x4a7c('0x47')]));_0xf075b3[_0x4a7c('0x35')]=_0xf075b3['attributes']['length']?_0xf075b3[_0x4a7c('0x35')]:_0x30a4d1[_0x4a7c('0x30')];if(_0x382267['query'][_0x4a7c('0x41')]){_0xf075b3['include']=[{'all':!![]}];}_0xf075b3=_[_0x4a7c('0x3d')]({},_0xf075b3,_0x382267['options']);return db['FreshsalesField'][_0x4a7c('0x48')](_0xf075b3)[_0x4a7c('0x25')](handleEntityNotFound(_0x29552f,null))[_0x4a7c('0x25')](respondWithResult(_0x29552f,null))[_0x4a7c('0x43')](handleError(_0x29552f,null));};exports[_0x4a7c('0x49')]=function(_0x35af3f,_0x53c410){return db['FreshsalesField'][_0x4a7c('0x49')](_0x35af3f[_0x4a7c('0x4a')],{})[_0x4a7c('0x25')](respondWithResult(_0x53c410,0xc9))[_0x4a7c('0x43')](handleError(_0x53c410,null));};exports[_0x4a7c('0x24')]=function(_0x865c59,_0xdb87b6){if(_0x865c59[_0x4a7c('0x4a')]['id']){delete _0x865c59[_0x4a7c('0x4a')]['id'];}return db[_0x4a7c('0x2d')][_0x4a7c('0x48')]({'where':{'id':_0x865c59[_0x4a7c('0x45')]['id']}})[_0x4a7c('0x25')](handleEntityNotFound(_0xdb87b6,null))['then'](saveUpdates(_0x865c59[_0x4a7c('0x4a')],null))[_0x4a7c('0x25')](respondWithResult(_0xdb87b6,null))['catch'](handleError(_0xdb87b6,null));};exports[_0x4a7c('0x26')]=function(_0x58f0eb,_0x1eaa11){return db['FreshsalesField']['find']({'where':{'id':_0x58f0eb[_0x4a7c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1eaa11,null))[_0x4a7c('0x25')](removeEntity(_0x1eaa11,null))[_0x4a7c('0x43')](handleError(_0x1eaa11,null));}; \ No newline at end of file +var _0x727b=['pick','filter','VIRTUAL','merge','includeAll','catch','show','params','include','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','FreshsalesField','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xe59443,_0x1c7fbc){var _0x155142=function(_0x147ab1){while(--_0x147ab1){_0xe59443['push'](_0xe59443['shift']());}};_0x155142(++_0x1c7fbc);}(_0x727b,0xec));var _0xb727=function(_0x3610bc,_0x37a897){_0x3610bc=_0x3610bc-0x0;var _0x374b84=_0x727b[_0x3610bc];return _0x374b84;};'use strict';var emlformat=require(_0xb727('0x0'));var rimraf=require(_0xb727('0x1'));var zipdir=require(_0xb727('0x2'));var jsonpatch=require(_0xb727('0x3'));var rp=require('request-promise');var moment=require(_0xb727('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb727('0x5'));var util=require(_0xb727('0x6'));var path=require(_0xb727('0x7'));var sox=require('sox');var csv=require(_0xb727('0x8'));var ejs=require(_0xb727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb727('0xa'));var squel=require('squel');var crypto=require(_0xb727('0xb'));var jsforce=require(_0xb727('0xc'));var deskjs=require(_0xb727('0xd'));var toCsv=require(_0xb727('0x8'));var querystring=require('querystring');var Papa=require(_0xb727('0xe'));var Redis=require(_0xb727('0xf'));var authService=require(_0xb727('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb727('0x11'));var hardwareService=require(_0xb727('0x12'));var logger=require('../../config/logger')(_0xb727('0x13'));var utils=require(_0xb727('0x14'));var config=require(_0xb727('0x15'));var licenseUtil=require(_0xb727('0x16'));var db=require(_0xb727('0x17'))['db'];function respondWithStatusCode(_0x50c728,_0xfa9dd){_0xfa9dd=_0xfa9dd||0xcc;return function(_0x35a428){if(_0x35a428){return _0x50c728['sendStatus'](_0xfa9dd);}return _0x50c728['status'](_0xfa9dd)[_0xb727('0x18')]();};}function respondWithResult(_0x457076,_0x48f1a5){_0x48f1a5=_0x48f1a5||0xc8;return function(_0x377737){if(_0x377737){return _0x457076[_0xb727('0x19')](_0x48f1a5)[_0xb727('0x1a')](_0x377737);}};}function respondWithFilteredResult(_0x317d1a,_0x1263a6){return function(_0x37bbc){if(_0x37bbc){var _0x39d307=typeof _0x1263a6[_0xb727('0x1b')]===_0xb727('0x1c')&&typeof _0x1263a6['limit']===_0xb727('0x1c');var _0x55da00=_0x37bbc[_0xb727('0x1d')];var _0x1dc037=_0x39d307?0x0:_0x1263a6['offset'];var _0x5d3b43=_0x39d307?_0x37bbc[_0xb727('0x1d')]:_0x1263a6['offset']+_0x1263a6[_0xb727('0x1e')];var _0x184b1d;if(_0x5d3b43>=_0x55da00){_0x5d3b43=_0x55da00;_0x184b1d=0xc8;}else{_0x184b1d=0xce;}_0x317d1a['status'](_0x184b1d);return _0x317d1a[_0xb727('0x1f')](_0xb727('0x20'),_0x1dc037+'-'+_0x5d3b43+'/'+_0x55da00)[_0xb727('0x1a')](_0x37bbc);}return null;};}function patchUpdates(_0x1ff963){return function(_0x571b07){try{jsonpatch[_0xb727('0x21')](_0x571b07,_0x1ff963,!![]);}catch(_0x25afd0){return BPromise[_0xb727('0x22')](_0x25afd0);}return _0x571b07[_0xb727('0x23')]();};}function saveUpdates(_0x595d91,_0x20d0d1){return function(_0x2f09b0){if(_0x2f09b0){return _0x2f09b0[_0xb727('0x24')](_0x595d91)[_0xb727('0x25')](function(_0x253d4d){return _0x253d4d;});}return null;};}function removeEntity(_0x2d5756,_0x24c89d){return function(_0x22b593){if(_0x22b593){return _0x22b593['destroy']()[_0xb727('0x25')](function(){_0x2d5756[_0xb727('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5683,_0x32dbe3){return function(_0x41d8d3){if(!_0x41d8d3){_0x1a5683[_0xb727('0x26')](0x194);}return _0x41d8d3;};}function handleError(_0x3889d5,_0x7656d8){_0x7656d8=_0x7656d8||0x1f4;return function(_0x3836a8){logger['error'](_0x3836a8['stack']);if(_0x3836a8[_0xb727('0x27')]){delete _0x3836a8[_0xb727('0x27')];}_0x3889d5[_0xb727('0x19')](_0x7656d8)[_0xb727('0x28')](_0x3836a8);};}exports[_0xb727('0x29')]=function(_0x522ba2,_0x423f40){var _0x5c5434={},_0x53c2f6={},_0x206ad6={'count':0x0,'rows':[]};var _0x2ea1b0=_[_0xb727('0x2a')](db[_0xb727('0x2b')][_0xb727('0x2c')],function(_0x229b11){return{'name':_0x229b11['fieldName'],'type':_0x229b11[_0xb727('0x2d')][_0xb727('0x2e')]};});_0x53c2f6['model']=_[_0xb727('0x2a')](_0x2ea1b0,_0xb727('0x27'));_0x53c2f6[_0xb727('0x2f')]=_[_0xb727('0x30')](_0x522ba2[_0xb727('0x2f')]);_0x53c2f6[_0xb727('0x31')]=_[_0xb727('0x32')](_0x53c2f6['model'],_0x53c2f6[_0xb727('0x2f')]);_0x5c5434[_0xb727('0x33')]=_[_0xb727('0x32')](_0x53c2f6[_0xb727('0x34')],qs[_0xb727('0x35')](_0x522ba2[_0xb727('0x2f')][_0xb727('0x35')]));_0x5c5434[_0xb727('0x33')]=_0x5c5434['attributes'][_0xb727('0x36')]?_0x5c5434[_0xb727('0x33')]:_0x53c2f6['model'];if(!_0x522ba2[_0xb727('0x2f')][_0xb727('0x37')](_0xb727('0x38'))){_0x5c5434[_0xb727('0x1e')]=qs['limit'](_0x522ba2[_0xb727('0x2f')][_0xb727('0x1e')]);_0x5c5434[_0xb727('0x1b')]=qs[_0xb727('0x1b')](_0x522ba2[_0xb727('0x2f')][_0xb727('0x1b')]);}_0x5c5434[_0xb727('0x39')]=qs[_0xb727('0x3a')](_0x522ba2[_0xb727('0x2f')][_0xb727('0x3a')]);_0x5c5434[_0xb727('0x3b')]=qs[_0xb727('0x31')](_[_0xb727('0x3c')](_0x522ba2[_0xb727('0x2f')],_0x53c2f6[_0xb727('0x31')]),_0x2ea1b0);if(_0x522ba2['query'][_0xb727('0x3d')]){_0x5c5434[_0xb727('0x3b')]=_['merge'](_0x5c5434[_0xb727('0x3b')],{'$or':_[_0xb727('0x2a')](_0x2ea1b0,function(_0x4e56a6){if(_0x4e56a6[_0xb727('0x2d')]!==_0xb727('0x3e')){var _0x11a79c={};_0x11a79c[_0x4e56a6[_0xb727('0x27')]]={'$like':'%'+_0x522ba2[_0xb727('0x2f')]['filter']+'%'};return _0x11a79c;}})});}_0x5c5434=_[_0xb727('0x3f')]({},_0x5c5434,_0x522ba2['options']);var _0x186ef7={'where':_0x5c5434[_0xb727('0x3b')]};return db[_0xb727('0x2b')][_0xb727('0x1d')](_0x186ef7)[_0xb727('0x25')](function(_0x281b52){_0x206ad6['count']=_0x281b52;if(_0x522ba2[_0xb727('0x2f')][_0xb727('0x40')]){_0x5c5434['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x5c5434);})['then'](function(_0x321fc7){_0x206ad6['rows']=_0x321fc7;return _0x206ad6;})[_0xb727('0x25')](respondWithFilteredResult(_0x423f40,_0x5c5434))[_0xb727('0x41')](handleError(_0x423f40,null));};exports[_0xb727('0x42')]=function(_0x26445,_0x4112d1){var _0x3de2ea={'raw':!![],'where':{'id':_0x26445[_0xb727('0x43')]['id']}},_0x1791e1={};_0x1791e1['model']=_[_0xb727('0x30')](db[_0xb727('0x2b')]['rawAttributes']);_0x1791e1['query']=_[_0xb727('0x30')](_0x26445['query']);_0x1791e1['filters']=_['intersection'](_0x1791e1[_0xb727('0x34')],_0x1791e1[_0xb727('0x2f')]);_0x3de2ea['attributes']=_[_0xb727('0x32')](_0x1791e1['model'],qs['fields'](_0x26445[_0xb727('0x2f')][_0xb727('0x35')]));_0x3de2ea['attributes']=_0x3de2ea['attributes'][_0xb727('0x36')]?_0x3de2ea[_0xb727('0x33')]:_0x1791e1[_0xb727('0x34')];if(_0x26445[_0xb727('0x2f')][_0xb727('0x40')]){_0x3de2ea[_0xb727('0x44')]=[{'all':!![]}];}_0x3de2ea=_['merge']({},_0x3de2ea,_0x26445[_0xb727('0x45')]);return db['FreshsalesField']['find'](_0x3de2ea)[_0xb727('0x25')](handleEntityNotFound(_0x4112d1,null))[_0xb727('0x25')](respondWithResult(_0x4112d1,null))[_0xb727('0x41')](handleError(_0x4112d1,null));};exports[_0xb727('0x46')]=function(_0x343f01,_0x580fac){return db[_0xb727('0x2b')][_0xb727('0x46')](_0x343f01[_0xb727('0x47')],{})[_0xb727('0x25')](respondWithResult(_0x580fac,0xc9))['catch'](handleError(_0x580fac,null));};exports[_0xb727('0x24')]=function(_0x2cc656,_0x49b623){if(_0x2cc656[_0xb727('0x47')]['id']){delete _0x2cc656[_0xb727('0x47')]['id'];}return db[_0xb727('0x2b')][_0xb727('0x48')]({'where':{'id':_0x2cc656[_0xb727('0x43')]['id']}})[_0xb727('0x25')](handleEntityNotFound(_0x49b623,null))['then'](saveUpdates(_0x2cc656[_0xb727('0x47')],null))[_0xb727('0x25')](respondWithResult(_0x49b623,null))[_0xb727('0x41')](handleError(_0x49b623,null));};exports[_0xb727('0x49')]=function(_0x56c1c8,_0x55a7cf){return db[_0xb727('0x2b')][_0xb727('0x48')]({'where':{'id':_0x56c1c8[_0xb727('0x43')]['id']}})[_0xb727('0x25')](handleEntityNotFound(_0x55a7cf,null))['then'](removeEntity(_0x55a7cf,null))[_0xb727('0x41')](handleError(_0x55a7cf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b2ee037..3f559c5 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 _0x32b6=['int_freshsales_fields','idField','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x12b40a,_0x2a06ae){var _0x4e549c=function(_0x1efd71){while(--_0x1efd71){_0x12b40a['push'](_0x12b40a['shift']());}};_0x4e549c(++_0x2a06ae);}(_0x32b6,0x1d1));var _0x632b=function(_0x515d66,_0xb90547){_0x515d66=_0x515d66-0x0;var _0x3a718e=_0x32b6[_0x515d66];return _0x3a718e;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x632b('0xc'),_0x632b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5276=['exports','define','int_freshsales_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x5276,0x163));var _0x6527=function(_0x163b8d,_0x194eec){_0x163b8d=_0x163b8d-0x0;var _0x2134ff=_0x5276[_0x163b8d];return _0x2134ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6527('0x0'))(_0x6527('0x1'));var moment=require(_0x6527('0x2'));var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require(_0x6527('0x5'));var rimraf=require(_0x6527('0x6'));var config=require(_0x6527('0x7'));var attributes=require(_0x6527('0x8'));module[_0x6527('0x9')]=function(_0x3deb56,_0x9d7ba2){return _0x3deb56[_0x6527('0xa')]('FreshsalesField',attributes,{'tableName':_0x6527('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x6527('0xc'),_0x6527('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 85b5527..faef6cb 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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xd9efd3,_0x37e049){_0xd9efd3=_0xd9efd3-0x0;var _0x3feb1c=_0x3f8a[_0xd9efd3];return _0x3feb1c;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0x1967=['then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\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','client','http','request'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1967,0x173));var _0x7196=function(_0x39bd70,_0x484d78){_0x39bd70=_0x39bd70-0x0;var _0x7524d7=_0x1967[_0x39bd70];return _0x7524d7;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 26d69e2..c51061b 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(_0x347c1d,_0x8f7842){var _0x3acf61=function(_0x18f581){while(--_0x18f581){_0x347c1d['push'](_0x347c1d['shift']());}};_0x3acf61(++_0x8f7842);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x54fddc,_0x2399b0){var _0x16fbe1=function(_0x5c384a){while(--_0x5c384a){_0x54fddc['push'](_0x54fddc['shift']());}};_0x16fbe1(++_0x2399b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 794a723..495a720 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 _0xbd5d=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xbd5d,0x118));var _0xdbd5=function(_0x2f0d19,_0x262cd8){_0x2f0d19=_0x2f0d19-0x0;var _0xeda77e=_0xbd5d[_0x2f0d19];return _0xeda77e;};'use strict';var Sequelize=require(_0xdbd5('0x0'));module[_0xdbd5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdbd5('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xdbd5('0x2')]},'password':{'type':Sequelize[_0xdbd5('0x2')]},'clientId':{'type':Sequelize[_0xdbd5('0x2')]},'clientSecret':{'type':Sequelize[_0xdbd5('0x2')]},'securityToken':{'type':Sequelize[_0xdbd5('0x2')]},'serverUrl':{'type':Sequelize[_0xdbd5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdbd5('0x3')](_0xdbd5('0x4'),_0xdbd5('0x5')),'defaultValue':_0xdbd5('0x4')}}; \ No newline at end of file +var _0xdfdd=['ENUM','newTab','sequelize','exports','STRING','username'];(function(_0x82213,_0x464cbb){var _0x5430ea=function(_0x395b33){while(--_0x395b33){_0x82213['push'](_0x82213['shift']());}};_0x5430ea(++_0x464cbb);}(_0xdfdd,0x104));var _0xddfd=function(_0x4c90b4,_0x163f70){_0x4c90b4=_0x4c90b4-0x0;var _0x4c4510=_0xdfdd[_0x4c90b4];return _0x4c4510;};'use strict';var Sequelize=require(_0xddfd('0x0'));module[_0xddfd('0x1')]={'name':{'type':Sequelize[_0xddfd('0x2')]},'description':{'type':Sequelize[_0xddfd('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xddfd('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xddfd('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xddfd('0x2')]},'securityToken':{'type':Sequelize[_0xddfd('0x2')]},'serverUrl':{'type':Sequelize[_0xddfd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xddfd('0x4')]('integrationTab',_0xddfd('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9430f2b..22eacfc 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 _0x7fc4=['username','securityToken','slice','substring','clientSecret','login','password','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Description','int','picklist','boolean','email','textarea','phone','remove','includes','picklistValues','label','True','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','SalesforceAccount','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','getConfigurations','findOne','order','AccountId','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x7fc4,0x174));var _0x47fc=function(_0x4d8340,_0x3a40f3){_0x4d8340=_0x4d8340-0x0;var _0x5078ef=_0x7fc4[_0x4d8340];return _0x5078ef;};'use strict';var emlformat=require(_0x47fc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47fc('0x1'));var moment=require(_0x47fc('0x2'));var BPromise=require(_0x47fc('0x3'));var Mustache=require(_0x47fc('0x4'));var util=require(_0x47fc('0x5'));var path=require('path');var sox=require(_0x47fc('0x6'));var csv=require(_0x47fc('0x7'));var ejs=require(_0x47fc('0x8'));var fs=require('fs');var fs_extra=require(_0x47fc('0x9'));var _=require(_0x47fc('0xa'));var squel=require(_0x47fc('0xb'));var crypto=require('crypto');var jsforce=require(_0x47fc('0xc'));var deskjs=require(_0x47fc('0xd'));var toCsv=require(_0x47fc('0x7'));var querystring=require(_0x47fc('0xe'));var Papa=require(_0x47fc('0xf'));var Redis=require('ioredis');var authService=require(_0x47fc('0x10'));var qs=require(_0x47fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47fc('0x12'))('api');var utils=require(_0x47fc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x47fc('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x47fc('0x15'));function respondWithStatusCode(_0x3f73ee,_0x46ed5c){_0x46ed5c=_0x46ed5c||0xcc;return function(_0x260738){if(_0x260738){return _0x3f73ee[_0x47fc('0x16')](_0x46ed5c);}return _0x3f73ee[_0x47fc('0x17')](_0x46ed5c)[_0x47fc('0x18')]();};}function respondWithResult(_0x5b16b8,_0x1e8939){_0x1e8939=_0x1e8939||0xc8;return function(_0xc0b20d){if(_0xc0b20d){return _0x5b16b8[_0x47fc('0x17')](_0x1e8939)['json'](_0xc0b20d);}};}function respondWithFilteredResult(_0x5e67b6,_0x139e5c){return function(_0x5cdc40){if(_0x5cdc40){var _0x4ab234=typeof _0x139e5c[_0x47fc('0x19')]==='undefined'&&typeof _0x139e5c[_0x47fc('0x1a')]==='undefined';var _0x42c5a7=_0x5cdc40[_0x47fc('0x1b')];var _0x1e04a0=_0x4ab234?0x0:_0x139e5c[_0x47fc('0x19')];var _0x62ded7=_0x4ab234?_0x5cdc40[_0x47fc('0x1b')]:_0x139e5c[_0x47fc('0x19')]+_0x139e5c[_0x47fc('0x1a')];var _0x11da00;if(_0x62ded7>=_0x42c5a7){_0x62ded7=_0x42c5a7;_0x11da00=0xc8;}else{_0x11da00=0xce;}_0x5e67b6[_0x47fc('0x17')](_0x11da00);return _0x5e67b6['set'](_0x47fc('0x1c'),_0x1e04a0+'-'+_0x62ded7+'/'+_0x42c5a7)['json'](_0x5cdc40);}return null;};}function patchUpdates(_0x42613d){return function(_0x242d9d){try{jsonpatch['apply'](_0x242d9d,_0x42613d,!![]);}catch(_0x558516){return BPromise[_0x47fc('0x1d')](_0x558516);}return _0x242d9d[_0x47fc('0x1e')]();};}function saveUpdates(_0x156b16,_0x1f8b03){return function(_0x503216){if(_0x503216){return _0x503216[_0x47fc('0x1f')](_0x156b16)['then'](function(_0x2ba93f){return _0x2ba93f;});}return null;};}function removeEntity(_0xe45655,_0x21213a){return function(_0x2724ea){if(_0x2724ea){return _0x2724ea[_0x47fc('0x20')]()[_0x47fc('0x21')](function(){_0xe45655[_0x47fc('0x17')](0xcc)[_0x47fc('0x18')]();});}};}function handleEntityNotFound(_0xd1763a,_0x2e1709){return function(_0x5c0f1d){if(!_0x5c0f1d){_0xd1763a[_0x47fc('0x16')](0x194);}return _0x5c0f1d;};}function handleError(_0x357d7d,_0x4c0038){_0x4c0038=_0x4c0038||0x1f4;return function(_0x7e5ff6){logger[_0x47fc('0x22')](_0x7e5ff6[_0x47fc('0x23')]);if(_0x7e5ff6[_0x47fc('0x24')]){delete _0x7e5ff6[_0x47fc('0x24')];}_0x357d7d[_0x47fc('0x17')](_0x4c0038)[_0x47fc('0x25')](_0x7e5ff6);};}exports[_0x47fc('0x26')]=function(_0x21e9cd,_0x3d00a1){var _0x366b7a={},_0x3142f4={},_0x2cf2dd={'count':0x0,'rows':[]};var _0x15344e=_[_0x47fc('0x27')](db['SalesforceAccount']['rawAttributes'],function(_0x5c0a69){return{'name':_0x5c0a69[_0x47fc('0x28')],'type':_0x5c0a69[_0x47fc('0x29')][_0x47fc('0x2a')]};});_0x3142f4[_0x47fc('0x2b')]=_['map'](_0x15344e,_0x47fc('0x24'));_0x3142f4['query']=_[_0x47fc('0x2c')](_0x21e9cd[_0x47fc('0x2d')]);_0x3142f4[_0x47fc('0x2e')]=_[_0x47fc('0x2f')](_0x3142f4[_0x47fc('0x2b')],_0x3142f4[_0x47fc('0x2d')]);_0x366b7a['attributes']=_[_0x47fc('0x2f')](_0x3142f4[_0x47fc('0x2b')],qs[_0x47fc('0x30')](_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x30')]));_0x366b7a[_0x47fc('0x31')]=_0x366b7a[_0x47fc('0x31')]['length']?_0x366b7a['attributes']:_0x3142f4[_0x47fc('0x2b')];if(!_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x32')](_0x47fc('0x33'))){_0x366b7a[_0x47fc('0x1a')]=qs[_0x47fc('0x1a')](_0x21e9cd['query']['limit']);_0x366b7a['offset']=qs[_0x47fc('0x19')](_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x19')]);}_0x366b7a['order']=qs[_0x47fc('0x34')](_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x34')]);_0x366b7a[_0x47fc('0x35')]=qs['filters'](_[_0x47fc('0x36')](_0x21e9cd[_0x47fc('0x2d')],_0x3142f4['filters']),_0x15344e);if(_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x37')]){_0x366b7a['where']=_[_0x47fc('0x38')](_0x366b7a[_0x47fc('0x35')],{'$or':_[_0x47fc('0x27')](_0x15344e,function(_0x417245){if(_0x417245[_0x47fc('0x29')]!=='VIRTUAL'){var _0x114440={};_0x114440[_0x417245['name']]={'$like':'%'+_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x37')]+'%'};return _0x114440;}})});}_0x366b7a=_['merge']({},_0x366b7a,_0x21e9cd[_0x47fc('0x39')]);var _0x21e58b={'where':_0x366b7a['where']};return db['SalesforceAccount']['count'](_0x21e58b)[_0x47fc('0x21')](function(_0x4ec763){_0x2cf2dd[_0x47fc('0x1b')]=_0x4ec763;if(_0x21e9cd[_0x47fc('0x2d')][_0x47fc('0x3a')]){_0x366b7a[_0x47fc('0x3b')]=[{'all':!![]}];}return db[_0x47fc('0x3c')][_0x47fc('0x3d')](_0x366b7a);})[_0x47fc('0x21')](function(_0xeb30cc){_0x2cf2dd[_0x47fc('0x3e')]=_0xeb30cc;return _0x2cf2dd;})['then'](respondWithFilteredResult(_0x3d00a1,_0x366b7a))[_0x47fc('0x3f')](handleError(_0x3d00a1,null));};exports[_0x47fc('0x40')]=function(_0xc45ff4,_0x30eca3){var _0x430a5b={'raw':![],'where':{'id':_0xc45ff4['params']['id']}},_0x21d7b9={};_0x21d7b9['model']=_[_0x47fc('0x2c')](db[_0x47fc('0x3c')][_0x47fc('0x41')]);_0x21d7b9[_0x47fc('0x2d')]=_[_0x47fc('0x2c')](_0xc45ff4[_0x47fc('0x2d')]);_0x21d7b9[_0x47fc('0x2e')]=_[_0x47fc('0x2f')](_0x21d7b9[_0x47fc('0x2b')],_0x21d7b9[_0x47fc('0x2d')]);_0x430a5b[_0x47fc('0x31')]=_[_0x47fc('0x2f')](_0x21d7b9[_0x47fc('0x2b')],qs[_0x47fc('0x30')](_0xc45ff4[_0x47fc('0x2d')][_0x47fc('0x30')]));_0x430a5b[_0x47fc('0x31')]=_0x430a5b['attributes'][_0x47fc('0x42')]?_0x430a5b[_0x47fc('0x31')]:_0x21d7b9[_0x47fc('0x2b')];if(_0xc45ff4[_0x47fc('0x2d')]['includeAll']){_0x430a5b[_0x47fc('0x3b')]=[{'all':!![]}];}_0x430a5b=_['merge']({},_0x430a5b,_0xc45ff4['options']);return db[_0x47fc('0x3c')][_0x47fc('0x43')](_0x430a5b)[_0x47fc('0x21')](handleEntityNotFound(_0x30eca3,null))[_0x47fc('0x21')](respondWithResult(_0x30eca3,null))[_0x47fc('0x3f')](handleError(_0x30eca3,null));};exports['create']=function(_0x5e1914,_0x583e2b){return db['SalesforceAccount'][_0x47fc('0x44')](_0x5e1914[_0x47fc('0x45')],{})[_0x47fc('0x21')](respondWithResult(_0x583e2b,0xc9))[_0x47fc('0x3f')](handleError(_0x583e2b,null));};exports[_0x47fc('0x1f')]=function(_0x4ad8d5,_0x18379e){if(_0x4ad8d5['body']['id']){delete _0x4ad8d5[_0x47fc('0x45')]['id'];}return db[_0x47fc('0x3c')][_0x47fc('0x43')]({'where':{'id':_0x4ad8d5[_0x47fc('0x46')]['id']}})[_0x47fc('0x21')](handleEntityNotFound(_0x18379e,null))[_0x47fc('0x21')](saveUpdates(_0x4ad8d5['body'],null))[_0x47fc('0x21')](respondWithResult(_0x18379e,null))[_0x47fc('0x3f')](handleError(_0x18379e,null));};exports['destroy']=function(_0x4efb8b,_0x486e60){return db[_0x47fc('0x3c')][_0x47fc('0x43')]({'where':{'id':_0x4efb8b['params']['id']}})[_0x47fc('0x21')](handleEntityNotFound(_0x486e60,null))[_0x47fc('0x21')](removeEntity(_0x486e60,null))['catch'](handleError(_0x486e60,null));};exports[_0x47fc('0x47')]=function(_0x16f9de,_0x1e5416,_0x1be04b){var _0x12fd6c={};var _0x4d7a51={};var _0x32f47e;var _0x11ec6d;return db['SalesforceAccount'][_0x47fc('0x48')]({'where':{'id':_0x16f9de[_0x47fc('0x46')]['id']}})[_0x47fc('0x21')](handleEntityNotFound(_0x1e5416,null))['then'](function(_0x5ced4d){if(_0x5ced4d){_0x32f47e=_0x5ced4d;_0x4d7a51[_0x47fc('0x2b')]=_[_0x47fc('0x2c')](db['SalesforceConfiguration'][_0x47fc('0x41')]);_0x4d7a51[_0x47fc('0x2d')]=_[_0x47fc('0x2c')](_0x16f9de[_0x47fc('0x2d')]);_0x4d7a51['filters']=_[_0x47fc('0x2f')](_0x4d7a51[_0x47fc('0x2b')],_0x4d7a51[_0x47fc('0x2d')]);_0x12fd6c[_0x47fc('0x31')]=_[_0x47fc('0x2f')](_0x4d7a51[_0x47fc('0x2b')],qs[_0x47fc('0x30')](_0x16f9de[_0x47fc('0x2d')][_0x47fc('0x30')]));_0x12fd6c[_0x47fc('0x31')]=_0x12fd6c[_0x47fc('0x31')][_0x47fc('0x42')]?_0x12fd6c[_0x47fc('0x31')]:_0x4d7a51[_0x47fc('0x2b')];_0x12fd6c[_0x47fc('0x49')]=qs[_0x47fc('0x34')](_0x16f9de[_0x47fc('0x2d')][_0x47fc('0x34')]);_0x12fd6c[_0x47fc('0x35')]=qs[_0x47fc('0x2e')](_['pick'](_0x16f9de['query'],_0x4d7a51[_0x47fc('0x2e')]));if(_0x16f9de[_0x47fc('0x2d')][_0x47fc('0x37')]){_0x12fd6c['where']=_['merge'](_0x12fd6c[_0x47fc('0x35')],{'$or':_[_0x47fc('0x27')](_0x12fd6c[_0x47fc('0x31')],function(_0x1e4df2){var _0xc7ba43={};_0xc7ba43[_0x1e4df2]={'$like':'%'+_0x16f9de[_0x47fc('0x2d')][_0x47fc('0x37')]+'%'};return _0xc7ba43;})});}_0x12fd6c=_[_0x47fc('0x38')]({},_0x12fd6c,_0x16f9de[_0x47fc('0x39')]);return _0x32f47e[_0x47fc('0x47')](_0x12fd6c);}})['then'](function(_0x4c6031){if(_0x4c6031){_0x11ec6d=_0x4c6031[_0x47fc('0x42')];if(!_0x16f9de[_0x47fc('0x2d')][_0x47fc('0x32')](_0x47fc('0x33'))){_0x12fd6c['limit']=qs['limit'](_0x16f9de[_0x47fc('0x2d')]['limit']);_0x12fd6c[_0x47fc('0x19')]=qs[_0x47fc('0x19')](_0x16f9de[_0x47fc('0x2d')][_0x47fc('0x19')]);}return _0x32f47e['getConfigurations'](_0x12fd6c);}})[_0x47fc('0x21')](function(_0x802a56){if(_0x802a56){return _0x802a56?{'count':_0x11ec6d,'rows':_0x802a56}:null;}})[_0x47fc('0x21')](respondWithResult(_0x1e5416,null))[_0x47fc('0x3f')](handleError(_0x1e5416,null));};exports['addConfiguration']=function(_0x4d0638,_0x8ca39,_0x33b61a){if(_0x4d0638[_0x47fc('0x45')]['id']){delete _0x4d0638[_0x47fc('0x45')]['id'];}return db[_0x47fc('0x3c')][_0x47fc('0x48')]({'where':{'id':_0x4d0638[_0x47fc('0x46')]['id']}})[_0x47fc('0x21')](handleEntityNotFound(_0x8ca39,null))[_0x47fc('0x21')](function(_0x4f1560){if(_0x4f1560){_0x4d0638[_0x47fc('0x45')][_0x47fc('0x4a')]=_0x4f1560['id'];_0x4d0638[_0x47fc('0x45')]['Subjects']=integrations['getSubjects'](_0x4d0638[_0x47fc('0x45')][_0x47fc('0x4b')],_0x4d0638[_0x47fc('0x45')][_0x47fc('0x29')]);_0x4d0638[_0x47fc('0x45')][_0x47fc('0x4c')]=integrations[_0x47fc('0x4d')](_0x4d0638[_0x47fc('0x45')][_0x47fc('0x4b')],_0x4d0638[_0x47fc('0x45')]['type']);return db['SalesforceConfiguration'][_0x47fc('0x44')](_0x4d0638[_0x47fc('0x45')],{'include':[{'model':db[_0x47fc('0x4e')],'as':_0x47fc('0x4f')},{'model':db[_0x47fc('0x4e')],'as':'Descriptions'}]});}return null;})[_0x47fc('0x21')](respondWithResult(_0x8ca39,null))[_0x47fc('0x3f')](handleError(_0x8ca39,null));};exports[_0x47fc('0x50')]=function(_0x127e17,_0xe26ece,_0x11d927){var _0x17100f;var _0xe551d6='';var _0x2bd8d3=_0x47fc('0x51');return db['SalesforceAccount'][_0x47fc('0x48')]({'where':{'id':_0x127e17['params']['id']},'attributes':['id',_0x47fc('0x52'),_0x47fc('0x53'),'clientSecret',_0x47fc('0x54'),'password',_0x47fc('0x55')]})[_0x47fc('0x21')](handleEntityNotFound(_0xe26ece,null))['then'](function(_0xdfcabe){if(_0xdfcabe){_0xe551d6=_0xdfcabe['remoteUri'];var _0x5e7f0f=_0xe551d6[_0x47fc('0x56')](-0x1);if(_0x5e7f0f==='/'){_0xe551d6=_0xe551d6[_0x47fc('0x57')](0x0,_0xe551d6['lastIndexOf'](_0x5e7f0f));}_0x17100f=new jsforce['Connection']({'oauth2':{'loginUrl':_0xe551d6,'clientId':_0xdfcabe['clientId'],'clientSecret':_0xdfcabe[_0x47fc('0x58')]}});return _0x17100f[_0x47fc('0x59')](_0xdfcabe['username'],_0xdfcabe[_0x47fc('0x5a')][_0x47fc('0x5b')](_0xdfcabe[_0x47fc('0x55')]));}})[_0x47fc('0x21')](function(_0x4c2ec3){if(_0x4c2ec3){if(!_['isNil'](_0x127e17['query'][_0x47fc('0x5c')])){_0x2bd8d3=_0x127e17[_0x47fc('0x2d')][_0x47fc('0x5c')];}return _0x17100f[_0x47fc('0x5d')](_0x2bd8d3)[_0x47fc('0x5e')]();}})[_0x47fc('0x21')](function(_0x52a7de){var _0x41eebc=[_0x47fc('0x5f'),_0x47fc('0x60'),_0x47fc('0x61'),'IsRecurrence','Subject',_0x47fc('0x62')];var _0x3eecf3=['string',_0x47fc('0x63'),_0x47fc('0x64'),_0x47fc('0x65'),_0x47fc('0x66'),_0x47fc('0x67'),_0x47fc('0x68')];if(_0x52a7de){_[_0x47fc('0x69')](_0x52a7de[_0x47fc('0x30')],function(_0x4fb21f){return _0x41eebc[_0x47fc('0x6a')](_0x4fb21f['name'])||!_0x3eecf3['includes'](_0x4fb21f[_0x47fc('0x29')]);});return{'count':_0x52a7de[_0x47fc('0x30')][_0x47fc('0x42')],'rows':_[_0x47fc('0x27')](_0x52a7de[_0x47fc('0x30')],function(_0x4f3d78){return{'id':_0x4f3d78[_0x47fc('0x24')],'name':_0x4f3d78['label'],'custom':_0x4f3d78['custom'],'options':_0x4f3d78[_0x47fc('0x6b')][_0x47fc('0x42')]>0x0?_[_0x47fc('0x27')](_0x4f3d78['picklistValues'],function(_0x1d1007){return{'name':_0x1d1007[_0x47fc('0x6c')],'value':_0x1d1007['value']};}):_0x4f3d78[_0x47fc('0x29')]==_0x47fc('0x65')?[{'name':_0x47fc('0x6d'),'value':'true'},{'name':_0x47fc('0x6e'),'value':'false'}]:[]};})};}})[_0x47fc('0x21')](respondWithResult(_0xe26ece,null))[_0x47fc('0x3f')](function(_0xc32a2a){var _0x38ad16=_0x127e17[_0x47fc('0x2d')]['test']?0x1f4:_0xc32a2a[_0x47fc('0x6f')]||0x1f4;logger[_0x47fc('0x22')](_0x47fc('0x70'),_0x47fc('0x50'),_0x38ad16,JSON['stringify'](_0xc32a2a));delete _0xc32a2a['name'];if(_0x38ad16===0x191){_0x38ad16=0x190;}_0xe26ece[_0x47fc('0x17')](_0x38ad16)[_0x47fc('0x25')](_0x127e17[_0x47fc('0x2d')]['test']?{'message':_0x47fc('0x71'),'statusCode':_0xc32a2a[_0x47fc('0x6f')]}:_0xc32a2a);});}; \ No newline at end of file +var _0x4dcc=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','reject','update','then','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SalesforceAccount','findAll','rows','catch','show','params','create','body','find','destroy','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','clientId','clientSecret','username','password','securityToken','lastIndexOf','concat','isNil','describe','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','error','stringify','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x41dd01,_0x3287fe){var _0x1b2a58=function(_0x399d16){while(--_0x399d16){_0x41dd01['push'](_0x41dd01['shift']());}};_0x1b2a58(++_0x3287fe);}(_0x4dcc,0x144));var _0xc4dc=function(_0x53a97a,_0x3135e8){_0x53a97a=_0x53a97a-0x0;var _0x3ff3ff=_0x4dcc[_0x53a97a];return _0x3ff3ff;};'use strict';var emlformat=require(_0xc4dc('0x0'));var rimraf=require(_0xc4dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4dc('0x2'));var rp=require('request-promise');var moment=require(_0xc4dc('0x3'));var BPromise=require(_0xc4dc('0x4'));var Mustache=require('mustache');var util=require(_0xc4dc('0x5'));var path=require('path');var sox=require(_0xc4dc('0x6'));var csv=require('to-csv');var ejs=require(_0xc4dc('0x7'));var fs=require('fs');var fs_extra=require(_0xc4dc('0x8'));var _=require(_0xc4dc('0x9'));var squel=require(_0xc4dc('0xa'));var crypto=require('crypto');var jsforce=require(_0xc4dc('0xb'));var deskjs=require(_0xc4dc('0xc'));var toCsv=require(_0xc4dc('0xd'));var querystring=require(_0xc4dc('0xe'));var Papa=require(_0xc4dc('0xf'));var Redis=require(_0xc4dc('0x10'));var authService=require(_0xc4dc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc4dc('0x12'));var hardwareService=require(_0xc4dc('0x13'));var logger=require(_0xc4dc('0x14'))('api');var utils=require(_0xc4dc('0x15'));var config=require(_0xc4dc('0x16'));var licenseUtil=require(_0xc4dc('0x17'));var db=require(_0xc4dc('0x18'))['db'];var integrations=require(_0xc4dc('0x19'));function respondWithStatusCode(_0x2570e2,_0x549df1){_0x549df1=_0x549df1||0xcc;return function(_0x229894){if(_0x229894){return _0x2570e2[_0xc4dc('0x1a')](_0x549df1);}return _0x2570e2[_0xc4dc('0x1b')](_0x549df1)['end']();};}function respondWithResult(_0x18f792,_0x16fbaa){_0x16fbaa=_0x16fbaa||0xc8;return function(_0x407efa){if(_0x407efa){return _0x18f792[_0xc4dc('0x1b')](_0x16fbaa)['json'](_0x407efa);}};}function respondWithFilteredResult(_0x364155,_0x1d1847){return function(_0x36569d){if(_0x36569d){var _0x4fae4b=typeof _0x1d1847['offset']==='undefined'&&typeof _0x1d1847['limit']===_0xc4dc('0x1c');var _0x4faaa6=_0x36569d[_0xc4dc('0x1d')];var _0x48e68d=_0x4fae4b?0x0:_0x1d1847[_0xc4dc('0x1e')];var _0x248a29=_0x4fae4b?_0x36569d['count']:_0x1d1847[_0xc4dc('0x1e')]+_0x1d1847[_0xc4dc('0x1f')];var _0x3ed800;if(_0x248a29>=_0x4faaa6){_0x248a29=_0x4faaa6;_0x3ed800=0xc8;}else{_0x3ed800=0xce;}_0x364155[_0xc4dc('0x1b')](_0x3ed800);return _0x364155[_0xc4dc('0x20')](_0xc4dc('0x21'),_0x48e68d+'-'+_0x248a29+'/'+_0x4faaa6)[_0xc4dc('0x22')](_0x36569d);}return null;};}function patchUpdates(_0x442fe1){return function(_0x1e53fe){try{jsonpatch['apply'](_0x1e53fe,_0x442fe1,!![]);}catch(_0x149e78){return BPromise[_0xc4dc('0x23')](_0x149e78);}return _0x1e53fe['save']();};}function saveUpdates(_0x259665,_0x1d7069){return function(_0x36a02c){if(_0x36a02c){return _0x36a02c[_0xc4dc('0x24')](_0x259665)['then'](function(_0x589445){return _0x589445;});}return null;};}function removeEntity(_0xef795f,_0x308c3){return function(_0x445cd6){if(_0x445cd6){return _0x445cd6['destroy']()[_0xc4dc('0x25')](function(){_0xef795f[_0xc4dc('0x1b')](0xcc)[_0xc4dc('0x26')]();});}};}function handleEntityNotFound(_0x4fafb9,_0x2da05d){return function(_0xd095d0){if(!_0xd095d0){_0x4fafb9[_0xc4dc('0x1a')](0x194);}return _0xd095d0;};}function handleError(_0x447ed5,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x47240f){logger['error'](_0x47240f[_0xc4dc('0x27')]);if(_0x47240f[_0xc4dc('0x28')]){delete _0x47240f[_0xc4dc('0x28')];}_0x447ed5[_0xc4dc('0x1b')](_0x3b7492)[_0xc4dc('0x29')](_0x47240f);};}exports[_0xc4dc('0x2a')]=function(_0x47dadc,_0x171536){var _0x6ec344={},_0xf6bcfd={},_0x1c2bca={'count':0x0,'rows':[]};var _0x2520e6=_[_0xc4dc('0x2b')](db['SalesforceAccount'][_0xc4dc('0x2c')],function(_0x49eae8){return{'name':_0x49eae8['fieldName'],'type':_0x49eae8[_0xc4dc('0x2d')][_0xc4dc('0x2e')]};});_0xf6bcfd[_0xc4dc('0x2f')]=_[_0xc4dc('0x2b')](_0x2520e6,_0xc4dc('0x28'));_0xf6bcfd[_0xc4dc('0x30')]=_[_0xc4dc('0x31')](_0x47dadc['query']);_0xf6bcfd[_0xc4dc('0x32')]=_['intersection'](_0xf6bcfd[_0xc4dc('0x2f')],_0xf6bcfd['query']);_0x6ec344[_0xc4dc('0x33')]=_[_0xc4dc('0x34')](_0xf6bcfd[_0xc4dc('0x2f')],qs[_0xc4dc('0x35')](_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x35')]));_0x6ec344[_0xc4dc('0x33')]=_0x6ec344['attributes'][_0xc4dc('0x36')]?_0x6ec344[_0xc4dc('0x33')]:_0xf6bcfd[_0xc4dc('0x2f')];if(!_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x37')](_0xc4dc('0x38'))){_0x6ec344[_0xc4dc('0x1f')]=qs[_0xc4dc('0x1f')](_0x47dadc['query'][_0xc4dc('0x1f')]);_0x6ec344['offset']=qs[_0xc4dc('0x1e')](_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x1e')]);}_0x6ec344[_0xc4dc('0x39')]=qs['sort'](_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x3a')]);_0x6ec344[_0xc4dc('0x3b')]=qs[_0xc4dc('0x32')](_['pick'](_0x47dadc[_0xc4dc('0x30')],_0xf6bcfd['filters']),_0x2520e6);if(_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x3c')]){_0x6ec344[_0xc4dc('0x3b')]=_['merge'](_0x6ec344[_0xc4dc('0x3b')],{'$or':_[_0xc4dc('0x2b')](_0x2520e6,function(_0x429442){if(_0x429442[_0xc4dc('0x2d')]!==_0xc4dc('0x3d')){var _0x4accab={};_0x4accab[_0x429442[_0xc4dc('0x28')]]={'$like':'%'+_0x47dadc[_0xc4dc('0x30')]['filter']+'%'};return _0x4accab;}})});}_0x6ec344=_[_0xc4dc('0x3e')]({},_0x6ec344,_0x47dadc[_0xc4dc('0x3f')]);var _0x35f5a9={'where':_0x6ec344['where']};return db[_0xc4dc('0x40')][_0xc4dc('0x1d')](_0x35f5a9)['then'](function(_0x1224df){_0x1c2bca[_0xc4dc('0x1d')]=_0x1224df;if(_0x47dadc[_0xc4dc('0x30')]['includeAll']){_0x6ec344['include']=[{'all':!![]}];}return db[_0xc4dc('0x40')][_0xc4dc('0x41')](_0x6ec344);})['then'](function(_0x34c2b7){_0x1c2bca[_0xc4dc('0x42')]=_0x34c2b7;return _0x1c2bca;})[_0xc4dc('0x25')](respondWithFilteredResult(_0x171536,_0x6ec344))[_0xc4dc('0x43')](handleError(_0x171536,null));};exports[_0xc4dc('0x44')]=function(_0x160d98,_0x7cd3e3){var _0x36f3c6={'raw':![],'where':{'id':_0x160d98[_0xc4dc('0x45')]['id']}},_0x360adc={};_0x360adc[_0xc4dc('0x2f')]=_['keys'](db[_0xc4dc('0x40')][_0xc4dc('0x2c')]);_0x360adc[_0xc4dc('0x30')]=_['keys'](_0x160d98[_0xc4dc('0x30')]);_0x360adc[_0xc4dc('0x32')]=_[_0xc4dc('0x34')](_0x360adc[_0xc4dc('0x2f')],_0x360adc[_0xc4dc('0x30')]);_0x36f3c6[_0xc4dc('0x33')]=_[_0xc4dc('0x34')](_0x360adc['model'],qs['fields'](_0x160d98[_0xc4dc('0x30')][_0xc4dc('0x35')]));_0x36f3c6[_0xc4dc('0x33')]=_0x36f3c6['attributes'][_0xc4dc('0x36')]?_0x36f3c6[_0xc4dc('0x33')]:_0x360adc[_0xc4dc('0x2f')];if(_0x160d98[_0xc4dc('0x30')]['includeAll']){_0x36f3c6['include']=[{'all':!![]}];}_0x36f3c6=_[_0xc4dc('0x3e')]({},_0x36f3c6,_0x160d98[_0xc4dc('0x3f')]);return db[_0xc4dc('0x40')]['find'](_0x36f3c6)['then'](handleEntityNotFound(_0x7cd3e3,null))[_0xc4dc('0x25')](respondWithResult(_0x7cd3e3,null))[_0xc4dc('0x43')](handleError(_0x7cd3e3,null));};exports[_0xc4dc('0x46')]=function(_0x242989,_0x3e2fc4){return db[_0xc4dc('0x40')][_0xc4dc('0x46')](_0x242989['body'],{})[_0xc4dc('0x25')](respondWithResult(_0x3e2fc4,0xc9))['catch'](handleError(_0x3e2fc4,null));};exports[_0xc4dc('0x24')]=function(_0x4a6e5a,_0x3a6d5a){if(_0x4a6e5a[_0xc4dc('0x47')]['id']){delete _0x4a6e5a[_0xc4dc('0x47')]['id'];}return db[_0xc4dc('0x40')][_0xc4dc('0x48')]({'where':{'id':_0x4a6e5a[_0xc4dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a6d5a,null))['then'](saveUpdates(_0x4a6e5a[_0xc4dc('0x47')],null))[_0xc4dc('0x25')](respondWithResult(_0x3a6d5a,null))[_0xc4dc('0x43')](handleError(_0x3a6d5a,null));};exports[_0xc4dc('0x49')]=function(_0x28972f,_0xae3ade){return db[_0xc4dc('0x40')][_0xc4dc('0x48')]({'where':{'id':_0x28972f['params']['id']}})[_0xc4dc('0x25')](handleEntityNotFound(_0xae3ade,null))[_0xc4dc('0x25')](removeEntity(_0xae3ade,null))[_0xc4dc('0x43')](handleError(_0xae3ade,null));};exports['getConfigurations']=function(_0x176736,_0x33d3aa,_0xc1eadc){var _0x2b2d72={};var _0x304850={};var _0x4b7d25;var _0xd8f2a9;return db[_0xc4dc('0x40')][_0xc4dc('0x4a')]({'where':{'id':_0x176736[_0xc4dc('0x45')]['id']}})[_0xc4dc('0x25')](handleEntityNotFound(_0x33d3aa,null))[_0xc4dc('0x25')](function(_0x231373){if(_0x231373){_0x4b7d25=_0x231373;_0x304850[_0xc4dc('0x2f')]=_['keys'](db[_0xc4dc('0x4b')][_0xc4dc('0x2c')]);_0x304850[_0xc4dc('0x30')]=_[_0xc4dc('0x31')](_0x176736[_0xc4dc('0x30')]);_0x304850['filters']=_[_0xc4dc('0x34')](_0x304850[_0xc4dc('0x2f')],_0x304850[_0xc4dc('0x30')]);_0x2b2d72[_0xc4dc('0x33')]=_[_0xc4dc('0x34')](_0x304850[_0xc4dc('0x2f')],qs[_0xc4dc('0x35')](_0x176736[_0xc4dc('0x30')][_0xc4dc('0x35')]));_0x2b2d72['attributes']=_0x2b2d72[_0xc4dc('0x33')][_0xc4dc('0x36')]?_0x2b2d72[_0xc4dc('0x33')]:_0x304850[_0xc4dc('0x2f')];_0x2b2d72[_0xc4dc('0x39')]=qs[_0xc4dc('0x3a')](_0x176736[_0xc4dc('0x30')]['sort']);_0x2b2d72[_0xc4dc('0x3b')]=qs['filters'](_['pick'](_0x176736['query'],_0x304850['filters']));if(_0x176736[_0xc4dc('0x30')][_0xc4dc('0x3c')]){_0x2b2d72[_0xc4dc('0x3b')]=_['merge'](_0x2b2d72['where'],{'$or':_['map'](_0x2b2d72[_0xc4dc('0x33')],function(_0x50815b){var _0x1377ef={};_0x1377ef[_0x50815b]={'$like':'%'+_0x176736[_0xc4dc('0x30')][_0xc4dc('0x3c')]+'%'};return _0x1377ef;})});}_0x2b2d72=_[_0xc4dc('0x3e')]({},_0x2b2d72,_0x176736['options']);return _0x4b7d25[_0xc4dc('0x4c')](_0x2b2d72);}})[_0xc4dc('0x25')](function(_0x4ac85e){if(_0x4ac85e){_0xd8f2a9=_0x4ac85e[_0xc4dc('0x36')];if(!_0x176736[_0xc4dc('0x30')][_0xc4dc('0x37')](_0xc4dc('0x38'))){_0x2b2d72[_0xc4dc('0x1f')]=qs[_0xc4dc('0x1f')](_0x176736['query']['limit']);_0x2b2d72[_0xc4dc('0x1e')]=qs['offset'](_0x176736[_0xc4dc('0x30')][_0xc4dc('0x1e')]);}return _0x4b7d25['getConfigurations'](_0x2b2d72);}})[_0xc4dc('0x25')](function(_0x15cc63){if(_0x15cc63){return _0x15cc63?{'count':_0xd8f2a9,'rows':_0x15cc63}:null;}})[_0xc4dc('0x25')](respondWithResult(_0x33d3aa,null))[_0xc4dc('0x43')](handleError(_0x33d3aa,null));};exports[_0xc4dc('0x4d')]=function(_0x179f20,_0xc9cfbf,_0x220010){if(_0x179f20[_0xc4dc('0x47')]['id']){delete _0x179f20[_0xc4dc('0x47')]['id'];}return db['SalesforceAccount'][_0xc4dc('0x4a')]({'where':{'id':_0x179f20[_0xc4dc('0x45')]['id']}})[_0xc4dc('0x25')](handleEntityNotFound(_0xc9cfbf,null))[_0xc4dc('0x25')](function(_0x40032c){if(_0x40032c){_0x179f20[_0xc4dc('0x47')]['AccountId']=_0x40032c['id'];_0x179f20['body']['Subjects']=integrations['getSubjects'](_0x179f20[_0xc4dc('0x47')][_0xc4dc('0x4e')],_0x179f20[_0xc4dc('0x47')]['type']);_0x179f20[_0xc4dc('0x47')][_0xc4dc('0x4f')]=integrations[_0xc4dc('0x50')](_0x179f20['body']['channel'],_0x179f20[_0xc4dc('0x47')][_0xc4dc('0x2d')]);return db[_0xc4dc('0x4b')]['create'](_0x179f20['body'],{'include':[{'model':db[_0xc4dc('0x51')],'as':_0xc4dc('0x52')},{'model':db['SalesforceField'],'as':_0xc4dc('0x4f')}]});}return null;})[_0xc4dc('0x25')](respondWithResult(_0xc9cfbf,null))['catch'](handleError(_0xc9cfbf,null));};exports[_0xc4dc('0x53')]=function(_0x3dd717,_0x3ef9d5,_0x4518eb){var _0x50b2b6;var _0x822560='';var _0xede6d8=_0xc4dc('0x54');return db[_0xc4dc('0x40')][_0xc4dc('0x4a')]({'where':{'id':_0x3dd717[_0xc4dc('0x45')]['id']},'attributes':['id','remoteUri',_0xc4dc('0x55'),_0xc4dc('0x56'),_0xc4dc('0x57'),_0xc4dc('0x58'),_0xc4dc('0x59')]})['then'](handleEntityNotFound(_0x3ef9d5,null))[_0xc4dc('0x25')](function(_0x4ed11c){if(_0x4ed11c){_0x822560=_0x4ed11c['remoteUri'];var _0x1dd5ad=_0x822560['slice'](-0x1);if(_0x1dd5ad==='/'){_0x822560=_0x822560['substring'](0x0,_0x822560[_0xc4dc('0x5a')](_0x1dd5ad));}_0x50b2b6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x822560,'clientId':_0x4ed11c['clientId'],'clientSecret':_0x4ed11c[_0xc4dc('0x56')]}});return _0x50b2b6['login'](_0x4ed11c['username'],_0x4ed11c[_0xc4dc('0x58')][_0xc4dc('0x5b')](_0x4ed11c[_0xc4dc('0x59')]));}})[_0xc4dc('0x25')](function(_0x29d91f){if(_0x29d91f){if(!_[_0xc4dc('0x5c')](_0x3dd717['query']['ticketType'])){_0xede6d8=_0x3dd717[_0xc4dc('0x30')]['ticketType'];}return _0x50b2b6['sobject'](_0xede6d8)[_0xc4dc('0x5d')]();}})['then'](function(_0x4383c0){var _0x5158ed=['OwnerId','ActivityDate',_0xc4dc('0x5e'),_0xc4dc('0x5f'),_0xc4dc('0x60'),'Description'];var _0x249bb1=[_0xc4dc('0x61'),_0xc4dc('0x62'),_0xc4dc('0x63'),_0xc4dc('0x64'),_0xc4dc('0x65'),'textarea',_0xc4dc('0x66')];if(_0x4383c0){_[_0xc4dc('0x67')](_0x4383c0[_0xc4dc('0x35')],function(_0x3fccc5){return _0x5158ed[_0xc4dc('0x68')](_0x3fccc5[_0xc4dc('0x28')])||!_0x249bb1[_0xc4dc('0x68')](_0x3fccc5['type']);});return{'count':_0x4383c0[_0xc4dc('0x35')][_0xc4dc('0x36')],'rows':_[_0xc4dc('0x2b')](_0x4383c0['fields'],function(_0x39ead5){return{'id':_0x39ead5[_0xc4dc('0x28')],'name':_0x39ead5[_0xc4dc('0x69')],'custom':_0x39ead5['custom'],'options':_0x39ead5[_0xc4dc('0x6a')]['length']>0x0?_[_0xc4dc('0x2b')](_0x39ead5[_0xc4dc('0x6a')],function(_0x378f09){return{'name':_0x378f09[_0xc4dc('0x69')],'value':_0x378f09[_0xc4dc('0x6b')]};}):_0x39ead5[_0xc4dc('0x2d')]==_0xc4dc('0x64')?[{'name':_0xc4dc('0x6c'),'value':_0xc4dc('0x6d')},{'name':_0xc4dc('0x6e'),'value':_0xc4dc('0x6f')}]:[]};})};}})[_0xc4dc('0x25')](respondWithResult(_0x3ef9d5,null))['catch'](function(_0x59b6d9){var _0x49693c=_0x3dd717[_0xc4dc('0x30')][_0xc4dc('0x70')]?0x1f4:_0x59b6d9[_0xc4dc('0x71')]||0x1f4;logger[_0xc4dc('0x72')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x49693c,JSON[_0xc4dc('0x73')](_0x59b6d9));delete _0x59b6d9['name'];if(_0x49693c===0x191){_0x49693c=0x190;}_0x3ef9d5['status'](_0x49693c)[_0xc4dc('0x29')](_0x3dd717[_0xc4dc('0x30')][_0xc4dc('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x59b6d9[_0xc4dc('0x71')]}:_0x59b6d9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8a3298d..2e7f2e8 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 _0x7eb9=['int_salesforce_accounts','lodash','api','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','exports'];(function(_0x2bf31e,_0x3d5db7){var _0x528176=function(_0x4f8d63){while(--_0x4f8d63){_0x2bf31e['push'](_0x2bf31e['shift']());}};_0x528176(++_0x3d5db7);}(_0x7eb9,0xd9));var _0x97eb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7eb9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x97eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97eb('0x1'));var moment=require('moment');var BPromise=require(_0x97eb('0x2'));var rp=require(_0x97eb('0x3'));var fs=require('fs');var path=require(_0x97eb('0x4'));var rimraf=require(_0x97eb('0x5'));var config=require('../../config/environment');var attributes=require(_0x97eb('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x97eb('0x7')]=function(_0x5327d4,_0x44595e){return _0x5327d4['define']('SalesforceAccount',attributes,{'tableName':_0x97eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda79=['api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util'];(function(_0x58d9c5,_0x575cb7){var _0x4ade69=function(_0x1b9dfd){while(--_0x1b9dfd){_0x58d9c5['push'](_0x58d9c5['shift']());}};_0x4ade69(++_0x575cb7);}(_0xda79,0x82));var _0x9da7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xda79[_0x432682];return _0x463d05;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var logger=require('../../config/logger')(_0x9da7('0x2'));var moment=require('moment');var BPromise=require(_0x9da7('0x3'));var rp=require(_0x9da7('0x4'));var fs=require('fs');var path=require(_0x9da7('0x5'));var rimraf=require('rimraf');var config=require(_0x9da7('0x6'));var attributes=require(_0x9da7('0x7'));var integrations=require(_0x9da7('0x8'));module[_0x9da7('0x9')]=function(_0x2d1a1,_0x1cfb66){return _0x2d1a1[_0x9da7('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index fa27296..1e68940 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 _0x1b8e=['request','then','info','request\x20sent','debug','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','include','map','attributes','model','stringify','catch','find','raw','ShowSalesforceAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x12f329,_0x1135e6){var _0x47ed78=function(_0x243c8f){while(--_0x243c8f){_0x12f329['push'](_0x12f329['shift']());}};_0x47ed78(++_0x1135e6);}(_0x1b8e,0x14b));var _0xe1b8=function(_0x24b729,_0x5a5d3c){_0x24b729=_0x24b729-0x0;var _0x5eaa94=_0x1b8e[_0x24b729];return _0x5eaa94;};'use strict';var _=require(_0xe1b8('0x0'));var util=require(_0xe1b8('0x1'));var moment=require(_0xe1b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1b8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe1b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1b8('0x5'))('rpc');var config=require(_0xe1b8('0x6'));var jayson=require(_0xe1b8('0x7'));var client=jayson['client'][_0xe1b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd4c0b8,_0x26b1c3,_0xe7c025){return new BPromise(function(_0x38b413,_0x14972d){return client[_0xe1b8('0x9')](_0xd4c0b8,_0xe7c025)[_0xe1b8('0xa')](function(_0x363f92){logger[_0xe1b8('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x26b1c3,_0xe1b8('0xc'));logger[_0xe1b8('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x26b1c3,_0xe1b8('0xc'),JSON['stringify'](_0x363f92));if(_0x363f92[_0xe1b8('0xe')]){if(_0x363f92['error'][_0xe1b8('0xf')]===0x1f4){logger[_0xe1b8('0xe')](_0xe1b8('0x10'),_0x26b1c3,_0x363f92[_0xe1b8('0xe')][_0xe1b8('0x11')]);return _0x14972d(_0x363f92[_0xe1b8('0xe')][_0xe1b8('0x11')]);}logger['error'](_0xe1b8('0x10'),_0x26b1c3,_0x363f92[_0xe1b8('0xe')][_0xe1b8('0x11')]);return _0x38b413(_0x363f92[_0xe1b8('0xe')][_0xe1b8('0x11')]);}else{logger[_0xe1b8('0xb')](_0xe1b8('0x10'),_0x26b1c3,'request\x20sent');_0x38b413(_0x363f92[_0xe1b8('0x12')][_0xe1b8('0x11')]);}})['catch'](function(_0x557ec8){logger[_0xe1b8('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x26b1c3,_0x557ec8);_0x14972d(_0x557ec8);});});}exports[_0xe1b8('0x13')]=function(_0x143c40){var _0x3adfb3=this;return new Promise(function(_0xdb0a13,_0x345e0e){return db[_0xe1b8('0x14')][_0xe1b8('0x15')]({'raw':_0x143c40[_0xe1b8('0x16')]?_0x143c40[_0xe1b8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x143c40['options']?_0x143c40[_0xe1b8('0x16')][_0xe1b8('0x17')]||null:null,'attributes':_0x143c40[_0xe1b8('0x16')]?_0x143c40[_0xe1b8('0x16')]['attributes']||null:null,'limit':_0x143c40[_0xe1b8('0x16')]?_0x143c40[_0xe1b8('0x16')][_0xe1b8('0x18')]||null:null,'include':_0x143c40[_0xe1b8('0x16')]?_0x143c40[_0xe1b8('0x16')][_0xe1b8('0x19')]?_[_0xe1b8('0x1a')](_0x143c40['options'][_0xe1b8('0x19')],function(_0x69f523){return{'model':db[_0x69f523['model']],'as':_0x69f523['as'],'attributes':_0x69f523[_0xe1b8('0x1b')],'include':_0x69f523[_0xe1b8('0x19')]?_[_0xe1b8('0x1a')](_0x69f523[_0xe1b8('0x19')],function(_0x491e55){return{'model':db[_0x491e55[_0xe1b8('0x1c')]],'as':_0x491e55['as'],'attributes':_0x491e55[_0xe1b8('0x1b')],'include':_0x491e55[_0xe1b8('0x19')]?_[_0xe1b8('0x1a')](_0x491e55[_0xe1b8('0x19')],function(_0x223611){return{'model':db[_0x223611['model']],'as':_0x223611['as'],'attributes':_0x223611[_0xe1b8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe1b8('0xa')](function(_0x50d6e2){logger[_0xe1b8('0xb')](_0xe1b8('0x13'),_0x143c40);logger[_0xe1b8('0xd')](_0xe1b8('0x13'),_0x143c40,JSON[_0xe1b8('0x1d')](_0x50d6e2));_0xdb0a13(_0x50d6e2);})[_0xe1b8('0x1e')](function(_0x1c6226){logger[_0xe1b8('0xe')]('GetSalesforceAccount',_0x1c6226[_0xe1b8('0x11')],_0x143c40);_0x345e0e(_0x3adfb3[_0xe1b8('0xe')](0x1f4,_0x1c6226[_0xe1b8('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x2d47dc){var _0x32cddb=this;return new Promise(function(_0x463040,_0x47baf9){return db[_0xe1b8('0x14')][_0xe1b8('0x1f')]({'raw':_0x2d47dc['options']?_0x2d47dc[_0xe1b8('0x16')][_0xe1b8('0x20')]===undefined?!![]:![]:!![],'where':_0x2d47dc[_0xe1b8('0x16')]?_0x2d47dc[_0xe1b8('0x16')][_0xe1b8('0x17')]||null:null,'attributes':_0x2d47dc[_0xe1b8('0x16')]?_0x2d47dc['options'][_0xe1b8('0x1b')]||null:null,'include':_0x2d47dc[_0xe1b8('0x16')]?_0x2d47dc[_0xe1b8('0x16')]['include']?_[_0xe1b8('0x1a')](_0x2d47dc[_0xe1b8('0x16')][_0xe1b8('0x19')],function(_0x197965){return{'model':db[_0x197965['model']],'as':_0x197965['as'],'attributes':_0x197965[_0xe1b8('0x1b')],'include':_0x197965[_0xe1b8('0x19')]?_['map'](_0x197965[_0xe1b8('0x19')],function(_0x4b7ed9){return{'model':db[_0x4b7ed9[_0xe1b8('0x1c')]],'as':_0x4b7ed9['as'],'attributes':_0x4b7ed9['attributes'],'include':_0x4b7ed9[_0xe1b8('0x19')]?_[_0xe1b8('0x1a')](_0x4b7ed9['include'],function(_0x30292d){return{'model':db[_0x30292d[_0xe1b8('0x1c')]],'as':_0x30292d['as'],'attributes':_0x30292d[_0xe1b8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe1b8('0xa')](function(_0x3a92c5){logger[_0xe1b8('0xb')](_0xe1b8('0x21'),_0x2d47dc);logger[_0xe1b8('0xd')](_0xe1b8('0x21'),_0x2d47dc,JSON['stringify'](_0x3a92c5));_0x463040(_0x3a92c5);})[_0xe1b8('0x1e')](function(_0x1bdb72){logger[_0xe1b8('0xe')](_0xe1b8('0x21'),_0x1bdb72[_0xe1b8('0x11')],_0x2d47dc);_0x47baf9(_0x32cddb[_0xe1b8('0xe')](0x1f4,_0x1bdb72['message']));});});}; \ No newline at end of file +var _0x1865=['map','model','attributes','include','debug','catch','ShowSalesforceAccount','find','then','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit'];(function(_0x5da853,_0x1d33c1){var _0x44fa40=function(_0x3691cc){while(--_0x3691cc){_0x5da853['push'](_0x5da853['shift']());}};_0x44fa40(++_0x1d33c1);}(_0x1865,0x6f));var _0x5186=function(_0x1a4a7a,_0x3a6a3c){_0x1a4a7a=_0x1a4a7a-0x0;var _0x57aaf2=_0x1865[_0x1a4a7a];return _0x57aaf2;};'use strict';var _=require(_0x5186('0x0'));var util=require('util');var moment=require(_0x5186('0x1'));var BPromise=require(_0x5186('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5186('0x3'))['db'];var utils=require(_0x5186('0x4'));var logger=require(_0x5186('0x5'))(_0x5186('0x6'));var config=require(_0x5186('0x7'));var jayson=require(_0x5186('0x8'));var client=jayson[_0x5186('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51af80,_0x22a55e,_0x3bfa27){return new BPromise(function(_0x4568b4,_0x170aed){return client['request'](_0x51af80,_0x3bfa27)['then'](function(_0x170df){logger[_0x5186('0xa')](_0x5186('0xb'),_0x22a55e,_0x5186('0xc'));logger['debug'](_0x5186('0xd'),_0x22a55e,'request\x20sent',JSON[_0x5186('0xe')](_0x170df));if(_0x170df[_0x5186('0xf')]){if(_0x170df[_0x5186('0xf')][_0x5186('0x10')]===0x1f4){logger[_0x5186('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x22a55e,_0x170df['error'][_0x5186('0x11')]);return _0x170aed(_0x170df[_0x5186('0xf')][_0x5186('0x11')]);}logger[_0x5186('0xf')](_0x5186('0xb'),_0x22a55e,_0x170df[_0x5186('0xf')]['message']);return _0x4568b4(_0x170df[_0x5186('0xf')][_0x5186('0x11')]);}else{logger[_0x5186('0xa')](_0x5186('0xb'),_0x22a55e,_0x5186('0xc'));_0x4568b4(_0x170df[_0x5186('0x12')][_0x5186('0x11')]);}})['catch'](function(_0x52009b){logger['error'](_0x5186('0xb'),_0x22a55e,_0x52009b);_0x170aed(_0x52009b);});});}exports[_0x5186('0x13')]=function(_0x468656){var _0x51b03f=this;return new Promise(function(_0x5ac2a2,_0x36887a){return db[_0x5186('0x14')][_0x5186('0x15')]({'raw':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')][_0x5186('0x17')]===undefined?!![]:![]:!![],'where':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')]['where']||null:null,'attributes':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')]['attributes']||null:null,'limit':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')][_0x5186('0x18')]||null:null,'include':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')]['include']?_[_0x5186('0x19')](_0x468656[_0x5186('0x16')]['include'],function(_0x113954){return{'model':db[_0x113954[_0x5186('0x1a')]],'as':_0x113954['as'],'attributes':_0x113954[_0x5186('0x1b')],'include':_0x113954['include']?_['map'](_0x113954['include'],function(_0x9eb71){return{'model':db[_0x9eb71[_0x5186('0x1a')]],'as':_0x9eb71['as'],'attributes':_0x9eb71['attributes'],'include':_0x9eb71[_0x5186('0x1c')]?_[_0x5186('0x19')](_0x9eb71['include'],function(_0x290fc5){return{'model':db[_0x290fc5[_0x5186('0x1a')]],'as':_0x290fc5['as'],'attributes':_0x290fc5[_0x5186('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x157437){logger[_0x5186('0xa')]('GetSalesforceAccount',_0x468656);logger[_0x5186('0x1d')](_0x5186('0x13'),_0x468656,JSON[_0x5186('0xe')](_0x157437));_0x5ac2a2(_0x157437);})[_0x5186('0x1e')](function(_0x4fe069){logger[_0x5186('0xf')](_0x5186('0x13'),_0x4fe069[_0x5186('0x11')],_0x468656);_0x36887a(_0x51b03f[_0x5186('0xf')](0x1f4,_0x4fe069[_0x5186('0x11')]));});});};exports[_0x5186('0x1f')]=function(_0x3eb6ee){var _0x27076b=this;return new Promise(function(_0x4c8ee7,_0x7a681b){return db['SalesforceAccount'][_0x5186('0x20')]({'raw':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['where']||null:null,'attributes':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['attributes']||null:null,'include':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['include']?_['map'](_0x3eb6ee[_0x5186('0x16')][_0x5186('0x1c')],function(_0x603ff4){return{'model':db[_0x603ff4['model']],'as':_0x603ff4['as'],'attributes':_0x603ff4[_0x5186('0x1b')],'include':_0x603ff4[_0x5186('0x1c')]?_['map'](_0x603ff4[_0x5186('0x1c')],function(_0x35ea5b){return{'model':db[_0x35ea5b[_0x5186('0x1a')]],'as':_0x35ea5b['as'],'attributes':_0x35ea5b[_0x5186('0x1b')],'include':_0x35ea5b['include']?_[_0x5186('0x19')](_0x35ea5b['include'],function(_0x5b73b4){return{'model':db[_0x5b73b4[_0x5186('0x1a')]],'as':_0x5b73b4['as'],'attributes':_0x5b73b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x5186('0x21')](function(_0x472566){logger['info'](_0x5186('0x1f'),_0x3eb6ee);logger[_0x5186('0x1d')](_0x5186('0x1f'),_0x3eb6ee,JSON[_0x5186('0xe')](_0x472566));_0x4c8ee7(_0x472566);})[_0x5186('0x1e')](function(_0x1bd609){logger[_0x5186('0xf')](_0x5186('0x1f'),_0x1bd609[_0x5186('0x11')],_0x3eb6ee);_0x7a681b(_0x27076b[_0x5186('0xf')](0x1f4,_0x1bd609[_0x5186('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ca7c9df..ce11180 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xdb28,0x106));var _0x8db2=function(_0x5eeb82,_0xf86005){_0x5eeb82=_0x5eeb82-0x0;var _0x206d9d=_0xdb28[_0x5eeb82];return _0x206d9d;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('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(_0x56d02c,_0x5e20a1){var _0x43c693=function(_0x2f933d){while(--_0x2f933d){_0x56d02c['push'](_0x56d02c['shift']());}};_0x43c693(++_0x5e20a1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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 b92f4e0..cee473b 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 _0xadb2=['Case','ENUM','contact','lead','contact_lead','account','sequelize','exports','STRING','Task'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xadb2,0x15a));var _0x2adb=function(_0x2176d5,_0x81d9b8){_0x2176d5=_0x2176d5-0x0;var _0x276dae=_0xadb2[_0x2176d5];return _0x276dae;};'use strict';var Sequelize=require(_0x2adb('0x0'));module[_0x2adb('0x1')]={'name':{'type':Sequelize[_0x2adb('0x2')]},'description':{'type':Sequelize[_0x2adb('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x2adb('0x3'),_0x2adb('0x4')),'defaultValue':_0x2adb('0x3')},'moduleSearch':{'type':Sequelize[_0x2adb('0x5')]('contact_lead',_0x2adb('0x6'),_0x2adb('0x7'),'account_contact_lead','account'),'defaultValue':_0x2adb('0x8')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x2adb('0x6'),'lead',_0x2adb('0x9')),'defaultValue':_0x2adb('0x7')},'leadId':{'type':Sequelize[_0x2adb('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x2adb('0x2')]}}; \ No newline at end of file +var _0x5cce=['account_contact_lead','account','sequelize','exports','STRING','ENUM','Task','Case','contact','lead'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5cce,0x160));var _0xe5cc=function(_0x3ebe8f,_0x310ba8){_0x3ebe8f=_0x3ebe8f-0x0;var _0x502270=_0x5cce[_0x3ebe8f];return _0x502270;};'use strict';var Sequelize=require(_0xe5cc('0x0'));module[_0xe5cc('0x1')]={'name':{'type':Sequelize[_0xe5cc('0x2')]},'description':{'type':Sequelize[_0xe5cc('0x2')]},'ticketType':{'type':Sequelize[_0xe5cc('0x3')](_0xe5cc('0x4'),_0xe5cc('0x5')),'defaultValue':_0xe5cc('0x4')},'moduleSearch':{'type':Sequelize[_0xe5cc('0x3')]('contact_lead',_0xe5cc('0x6'),_0xe5cc('0x7'),_0xe5cc('0x8'),_0xe5cc('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xe5cc('0x3')]('nothing',_0xe5cc('0x6'),_0xe5cc('0x7'),_0xe5cc('0x9')),'defaultValue':_0xe5cc('0x7')},'leadId':{'type':Sequelize[_0xe5cc('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xe5cc('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xe5cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3626267..7d7ddda 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 _0x67bb=['destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','SalesforceConfiguration','includeAll','rows','catch','show','include','find','create','body','findOne','params','filter','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then'];(function(_0x1eb759,_0x3782e7){var _0x4a3d43=function(_0x5cb204){while(--_0x5cb204){_0x1eb759['push'](_0x1eb759['shift']());}};_0x4a3d43(++_0x3782e7);}(_0x67bb,0x11a));var _0xb67b=function(_0x3d249b,_0x2a159b){_0x3d249b=_0x3d249b-0x0;var _0x2e4722=_0x67bb[_0x3d249b];return _0x2e4722;};'use strict';var emlformat=require(_0xb67b('0x0'));var rimraf=require(_0xb67b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb67b('0x2'));var rp=require(_0xb67b('0x3'));var moment=require(_0xb67b('0x4'));var BPromise=require(_0xb67b('0x5'));var Mustache=require(_0xb67b('0x6'));var util=require(_0xb67b('0x7'));var path=require(_0xb67b('0x8'));var sox=require(_0xb67b('0x9'));var csv=require(_0xb67b('0xa'));var ejs=require(_0xb67b('0xb'));var fs=require('fs');var fs_extra=require(_0xb67b('0xc'));var _=require(_0xb67b('0xd'));var squel=require(_0xb67b('0xe'));var crypto=require('crypto');var jsforce=require(_0xb67b('0xf'));var deskjs=require(_0xb67b('0x10'));var toCsv=require(_0xb67b('0xa'));var querystring=require('querystring');var Papa=require(_0xb67b('0x11'));var Redis=require('ioredis');var authService=require(_0xb67b('0x12'));var qs=require(_0xb67b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb67b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb67b('0x15'));var config=require(_0xb67b('0x16'));var licenseUtil=require(_0xb67b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fc104,_0x3d4fcf){_0x3d4fcf=_0x3d4fcf||0xcc;return function(_0x96b5ac){if(_0x96b5ac){return _0x3fc104[_0xb67b('0x18')](_0x3d4fcf);}return _0x3fc104[_0xb67b('0x19')](_0x3d4fcf)[_0xb67b('0x1a')]();};}function respondWithResult(_0x3d6c84,_0x3bc040){_0x3bc040=_0x3bc040||0xc8;return function(_0xaa9d0f){if(_0xaa9d0f){return _0x3d6c84[_0xb67b('0x19')](_0x3bc040)[_0xb67b('0x1b')](_0xaa9d0f);}};}function respondWithFilteredResult(_0x565312,_0x4da48f){return function(_0x1d282e){if(_0x1d282e){var _0x476511=typeof _0x4da48f['offset']===_0xb67b('0x1c')&&typeof _0x4da48f[_0xb67b('0x1d')]===_0xb67b('0x1c');var _0x57b8ab=_0x1d282e[_0xb67b('0x1e')];var _0x217e26=_0x476511?0x0:_0x4da48f[_0xb67b('0x1f')];var _0x4fefd6=_0x476511?_0x1d282e[_0xb67b('0x1e')]:_0x4da48f[_0xb67b('0x1f')]+_0x4da48f[_0xb67b('0x1d')];var _0x3a06e7;if(_0x4fefd6>=_0x57b8ab){_0x4fefd6=_0x57b8ab;_0x3a06e7=0xc8;}else{_0x3a06e7=0xce;}_0x565312[_0xb67b('0x19')](_0x3a06e7);return _0x565312[_0xb67b('0x20')]('Content-Range',_0x217e26+'-'+_0x4fefd6+'/'+_0x57b8ab)[_0xb67b('0x1b')](_0x1d282e);}return null;};}function patchUpdates(_0x24ac34){return function(_0x2d3e68){try{jsonpatch[_0xb67b('0x21')](_0x2d3e68,_0x24ac34,!![]);}catch(_0x41a1e6){return BPromise[_0xb67b('0x22')](_0x41a1e6);}return _0x2d3e68[_0xb67b('0x23')]();};}function saveUpdates(_0x2842b2,_0x1277bd){return function(_0x129f9f){if(_0x129f9f){return _0x129f9f[_0xb67b('0x24')](_0x2842b2)[_0xb67b('0x25')](function(_0x1324d8){return _0x1324d8;});}return null;};}function removeEntity(_0x57a6b6,_0x21d61e){return function(_0xbdd2df){if(_0xbdd2df){return _0xbdd2df[_0xb67b('0x26')]()[_0xb67b('0x25')](function(){_0x57a6b6[_0xb67b('0x19')](0xcc)[_0xb67b('0x1a')]();});}};}function handleEntityNotFound(_0x3dddd3,_0x2b27af){return function(_0x2db2d2){if(!_0x2db2d2){_0x3dddd3[_0xb67b('0x18')](0x194);}return _0x2db2d2;};}function handleError(_0xef79dd,_0x1536aa){_0x1536aa=_0x1536aa||0x1f4;return function(_0x29e015){logger[_0xb67b('0x27')](_0x29e015[_0xb67b('0x28')]);if(_0x29e015['name']){delete _0x29e015[_0xb67b('0x29')];}_0xef79dd[_0xb67b('0x19')](_0x1536aa)['send'](_0x29e015);};}exports[_0xb67b('0x2a')]=function(_0x1943be,_0x5e34d9){var _0x19227d={},_0x4433c4={},_0x402c7e={'count':0x0,'rows':[]};var _0x19a432=_[_0xb67b('0x2b')](db['SalesforceConfiguration'][_0xb67b('0x2c')],function(_0x5d7219){return{'name':_0x5d7219[_0xb67b('0x2d')],'type':_0x5d7219[_0xb67b('0x2e')][_0xb67b('0x2f')]};});_0x4433c4['model']=_[_0xb67b('0x2b')](_0x19a432,_0xb67b('0x29'));_0x4433c4[_0xb67b('0x30')]=_[_0xb67b('0x31')](_0x1943be[_0xb67b('0x30')]);_0x4433c4[_0xb67b('0x32')]=_[_0xb67b('0x33')](_0x4433c4[_0xb67b('0x34')],_0x4433c4['query']);_0x19227d[_0xb67b('0x35')]=_[_0xb67b('0x33')](_0x4433c4[_0xb67b('0x34')],qs[_0xb67b('0x36')](_0x1943be[_0xb67b('0x30')][_0xb67b('0x36')]));_0x19227d['attributes']=_0x19227d[_0xb67b('0x35')][_0xb67b('0x37')]?_0x19227d[_0xb67b('0x35')]:_0x4433c4['model'];if(!_0x1943be[_0xb67b('0x30')][_0xb67b('0x38')](_0xb67b('0x39'))){_0x19227d[_0xb67b('0x1d')]=qs['limit'](_0x1943be['query'][_0xb67b('0x1d')]);_0x19227d[_0xb67b('0x1f')]=qs[_0xb67b('0x1f')](_0x1943be[_0xb67b('0x30')][_0xb67b('0x1f')]);}_0x19227d[_0xb67b('0x3a')]=qs[_0xb67b('0x3b')](_0x1943be['query']['sort']);_0x19227d[_0xb67b('0x3c')]=qs[_0xb67b('0x32')](_[_0xb67b('0x3d')](_0x1943be['query'],_0x4433c4['filters']),_0x19a432);if(_0x1943be[_0xb67b('0x30')]['filter']){_0x19227d[_0xb67b('0x3c')]=_[_0xb67b('0x3e')](_0x19227d[_0xb67b('0x3c')],{'$or':_[_0xb67b('0x2b')](_0x19a432,function(_0x2a134e){if(_0x2a134e[_0xb67b('0x2e')]!=='VIRTUAL'){var _0x5f3e89={};_0x5f3e89[_0x2a134e[_0xb67b('0x29')]]={'$like':'%'+_0x1943be[_0xb67b('0x30')]['filter']+'%'};return _0x5f3e89;}})});}_0x19227d=_['merge']({},_0x19227d,_0x1943be[_0xb67b('0x3f')]);var _0x421498={'where':_0x19227d[_0xb67b('0x3c')]};return db[_0xb67b('0x40')]['count'](_0x421498)[_0xb67b('0x25')](function(_0xdcfe27){_0x402c7e[_0xb67b('0x1e')]=_0xdcfe27;if(_0x1943be[_0xb67b('0x30')][_0xb67b('0x41')]){_0x19227d['include']=[{'all':!![]}];}return db[_0xb67b('0x40')]['findAll'](_0x19227d);})[_0xb67b('0x25')](function(_0x117595){_0x402c7e[_0xb67b('0x42')]=_0x117595;return _0x402c7e;})[_0xb67b('0x25')](respondWithFilteredResult(_0x5e34d9,_0x19227d))[_0xb67b('0x43')](handleError(_0x5e34d9,null));};exports[_0xb67b('0x44')]=function(_0x17cc35,_0x4b6609){var _0x26c201={'raw':![],'where':{'id':_0x17cc35['params']['id']}},_0x22b219={};_0x22b219[_0xb67b('0x34')]=_[_0xb67b('0x31')](db[_0xb67b('0x40')][_0xb67b('0x2c')]);_0x22b219[_0xb67b('0x30')]=_[_0xb67b('0x31')](_0x17cc35['query']);_0x22b219[_0xb67b('0x32')]=_[_0xb67b('0x33')](_0x22b219['model'],_0x22b219[_0xb67b('0x30')]);_0x26c201[_0xb67b('0x35')]=_['intersection'](_0x22b219[_0xb67b('0x34')],qs[_0xb67b('0x36')](_0x17cc35[_0xb67b('0x30')][_0xb67b('0x36')]));_0x26c201['attributes']=_0x26c201[_0xb67b('0x35')]['length']?_0x26c201[_0xb67b('0x35')]:_0x22b219[_0xb67b('0x34')];if(_0x17cc35[_0xb67b('0x30')][_0xb67b('0x41')]){_0x26c201[_0xb67b('0x45')]=[{'all':!![]}];}_0x26c201=_[_0xb67b('0x3e')]({},_0x26c201,_0x17cc35[_0xb67b('0x3f')]);return db[_0xb67b('0x40')][_0xb67b('0x46')](_0x26c201)['then'](handleEntityNotFound(_0x4b6609,null))[_0xb67b('0x25')](respondWithResult(_0x4b6609,null))[_0xb67b('0x43')](handleError(_0x4b6609,null));};exports['create']=function(_0x9ff323,_0x315c05){return db['SalesforceConfiguration'][_0xb67b('0x47')](_0x9ff323['body'],{})['then'](respondWithResult(_0x315c05,0xc9))[_0xb67b('0x43')](handleError(_0x315c05,null));};exports[_0xb67b('0x24')]=function(_0x5e24b2,_0x2f7b9d){if(_0x5e24b2[_0xb67b('0x48')]['id']){delete _0x5e24b2[_0xb67b('0x48')]['id'];}return db[_0xb67b('0x40')][_0xb67b('0x46')]({'where':{'id':_0x5e24b2['params']['id']}})['then'](handleEntityNotFound(_0x2f7b9d,null))['then'](saveUpdates(_0x5e24b2[_0xb67b('0x48')],null))['then'](respondWithResult(_0x2f7b9d,null))[_0xb67b('0x43')](handleError(_0x2f7b9d,null));};exports['destroy']=function(_0x1980fd,_0x809bbb){return db[_0xb67b('0x40')][_0xb67b('0x46')]({'where':{'id':_0x1980fd['params']['id']}})[_0xb67b('0x25')](handleEntityNotFound(_0x809bbb,null))[_0xb67b('0x25')](removeEntity(_0x809bbb,null))['catch'](handleError(_0x809bbb,null));};exports['getFields']=function(_0x128737,_0x3f8a6e,_0x228399){var _0x3da46f={};var _0x290365={};var _0x4b79ff;var _0x425ec1;return db['SalesforceConfiguration'][_0xb67b('0x49')]({'where':{'id':_0x128737[_0xb67b('0x4a')]['id']}})[_0xb67b('0x25')](handleEntityNotFound(_0x3f8a6e,null))['then'](function(_0x3fb6e9){if(_0x3fb6e9){_0x4b79ff=_0x3fb6e9;_0x290365[_0xb67b('0x34')]=_[_0xb67b('0x31')](db['SalesforceField'][_0xb67b('0x2c')]);_0x290365['query']=_['keys'](_0x128737['query']);_0x290365[_0xb67b('0x32')]=_[_0xb67b('0x33')](_0x290365[_0xb67b('0x34')],_0x290365[_0xb67b('0x30')]);_0x3da46f[_0xb67b('0x35')]=_[_0xb67b('0x33')](_0x290365[_0xb67b('0x34')],qs[_0xb67b('0x36')](_0x128737[_0xb67b('0x30')]['fields']));_0x3da46f[_0xb67b('0x35')]=_0x3da46f[_0xb67b('0x35')]['length']?_0x3da46f[_0xb67b('0x35')]:_0x290365[_0xb67b('0x34')];_0x3da46f[_0xb67b('0x3a')]=qs[_0xb67b('0x3b')](_0x128737['query'][_0xb67b('0x3b')]);_0x3da46f[_0xb67b('0x3c')]=qs['filters'](_[_0xb67b('0x3d')](_0x128737[_0xb67b('0x30')],_0x290365[_0xb67b('0x32')]));if(_0x128737[_0xb67b('0x30')][_0xb67b('0x4b')]){_0x3da46f[_0xb67b('0x3c')]=_[_0xb67b('0x3e')](_0x3da46f[_0xb67b('0x3c')],{'$or':_['map'](_0x3da46f['attributes'],function(_0x4ddb36){var _0x4cfbe6={};_0x4cfbe6[_0x4ddb36]={'$like':'%'+_0x128737[_0xb67b('0x30')]['filter']+'%'};return _0x4cfbe6;})});}_0x3da46f=_[_0xb67b('0x3e')]({},_0x3da46f,_0x128737[_0xb67b('0x3f')]);return _0x4b79ff['getFields'](_0x3da46f);}})[_0xb67b('0x25')](function(_0x5d5d9b){if(_0x5d5d9b){_0x425ec1=_0x5d5d9b[_0xb67b('0x37')];if(!_0x128737['query']['hasOwnProperty'](_0xb67b('0x39'))){_0x3da46f[_0xb67b('0x1d')]=qs[_0xb67b('0x1d')](_0x128737[_0xb67b('0x30')]['limit']);_0x3da46f[_0xb67b('0x1f')]=qs[_0xb67b('0x1f')](_0x128737[_0xb67b('0x30')][_0xb67b('0x1f')]);}return _0x4b79ff[_0xb67b('0x4c')](_0x3da46f);}})['then'](function(_0x459cf0){if(_0x459cf0){return _0x459cf0?{'count':_0x425ec1,'rows':_0x459cf0}:null;}})['then'](respondWithResult(_0x3f8a6e,null))['catch'](handleError(_0x3f8a6e,null));};exports[_0xb67b('0x4d')]=function(_0x4f7330,_0x243e92,_0x5a3914){var _0x278b45={};var _0x50ebf0={};var _0x4c0ba7;var _0xaf7dc3;return db[_0xb67b('0x40')][_0xb67b('0x49')]({'where':{'id':_0x4f7330[_0xb67b('0x4a')]['id']}})[_0xb67b('0x25')](handleEntityNotFound(_0x243e92,null))[_0xb67b('0x25')](function(_0x4314a8){if(_0x4314a8){_0x4c0ba7=_0x4314a8;_0x50ebf0['model']=_[_0xb67b('0x31')](db[_0xb67b('0x4e')][_0xb67b('0x2c')]);_0x50ebf0[_0xb67b('0x30')]=_['keys'](_0x4f7330[_0xb67b('0x30')]);_0x50ebf0[_0xb67b('0x32')]=_[_0xb67b('0x33')](_0x50ebf0[_0xb67b('0x34')],_0x50ebf0[_0xb67b('0x30')]);_0x278b45[_0xb67b('0x35')]=_[_0xb67b('0x33')](_0x50ebf0[_0xb67b('0x34')],qs[_0xb67b('0x36')](_0x4f7330['query'][_0xb67b('0x36')]));_0x278b45['attributes']=_0x278b45['attributes'][_0xb67b('0x37')]?_0x278b45[_0xb67b('0x35')]:_0x50ebf0[_0xb67b('0x34')];_0x278b45[_0xb67b('0x3a')]=qs[_0xb67b('0x3b')](_0x4f7330['query'][_0xb67b('0x3b')]);_0x278b45[_0xb67b('0x3c')]=qs[_0xb67b('0x32')](_[_0xb67b('0x3d')](_0x4f7330[_0xb67b('0x30')],_0x50ebf0['filters']));if(_0x4f7330['query'][_0xb67b('0x4b')]){_0x278b45['where']=_[_0xb67b('0x3e')](_0x278b45[_0xb67b('0x3c')],{'$or':_['map'](_0x278b45['attributes'],function(_0x10e9e0){var _0x1b7b93={};_0x1b7b93[_0x10e9e0]={'$like':'%'+_0x4f7330[_0xb67b('0x30')]['filter']+'%'};return _0x1b7b93;})});}_0x278b45=_[_0xb67b('0x3e')]({},_0x278b45,_0x4f7330[_0xb67b('0x3f')]);return _0x4c0ba7['getSubjects'](_0x278b45);}})['then'](function(_0x23768f){if(_0x23768f){_0xaf7dc3=_0x23768f['length'];if(!_0x4f7330[_0xb67b('0x30')][_0xb67b('0x38')](_0xb67b('0x39'))){_0x278b45[_0xb67b('0x1d')]=qs['limit'](_0x4f7330[_0xb67b('0x30')][_0xb67b('0x1d')]);_0x278b45[_0xb67b('0x1f')]=qs[_0xb67b('0x1f')](_0x4f7330[_0xb67b('0x30')][_0xb67b('0x1f')]);}return _0x4c0ba7[_0xb67b('0x4d')](_0x278b45);}})[_0xb67b('0x25')](function(_0x84c17e){if(_0x84c17e){return _0x84c17e?{'count':_0xaf7dc3,'rows':_0x84c17e}:null;}})['then'](respondWithResult(_0x243e92,null))['catch'](handleError(_0x243e92,null));};exports[_0xb67b('0x4f')]=function(_0x1c6267,_0x24b24e,_0x475f3b){var _0x5c32bc={};var _0x557047={};var _0x3f8529;var _0x58b0cd;return db[_0xb67b('0x40')][_0xb67b('0x49')]({'where':{'id':_0x1c6267[_0xb67b('0x4a')]['id']}})[_0xb67b('0x25')](handleEntityNotFound(_0x24b24e,null))[_0xb67b('0x25')](function(_0x4c4c6d){if(_0x4c4c6d){_0x3f8529=_0x4c4c6d;_0x557047['model']=_['keys'](db[_0xb67b('0x4e')][_0xb67b('0x2c')]);_0x557047[_0xb67b('0x30')]=_['keys'](_0x1c6267[_0xb67b('0x30')]);_0x557047[_0xb67b('0x32')]=_['intersection'](_0x557047[_0xb67b('0x34')],_0x557047[_0xb67b('0x30')]);_0x5c32bc[_0xb67b('0x35')]=_[_0xb67b('0x33')](_0x557047['model'],qs['fields'](_0x1c6267[_0xb67b('0x30')][_0xb67b('0x36')]));_0x5c32bc['attributes']=_0x5c32bc[_0xb67b('0x35')]['length']?_0x5c32bc[_0xb67b('0x35')]:_0x557047['model'];_0x5c32bc[_0xb67b('0x3a')]=qs['sort'](_0x1c6267[_0xb67b('0x30')][_0xb67b('0x3b')]);_0x5c32bc['where']=qs['filters'](_[_0xb67b('0x3d')](_0x1c6267[_0xb67b('0x30')],_0x557047['filters']));if(_0x1c6267['query']['filter']){_0x5c32bc[_0xb67b('0x3c')]=_[_0xb67b('0x3e')](_0x5c32bc[_0xb67b('0x3c')],{'$or':_[_0xb67b('0x2b')](_0x5c32bc['attributes'],function(_0xeea1f9){var _0x4568a0={};_0x4568a0[_0xeea1f9]={'$like':'%'+_0x1c6267[_0xb67b('0x30')][_0xb67b('0x4b')]+'%'};return _0x4568a0;})});}_0x5c32bc=_[_0xb67b('0x3e')]({},_0x5c32bc,_0x1c6267[_0xb67b('0x3f')]);return _0x3f8529['getDescriptions'](_0x5c32bc);}})['then'](function(_0x18fdca){if(_0x18fdca){_0x58b0cd=_0x18fdca[_0xb67b('0x37')];if(!_0x1c6267['query'][_0xb67b('0x38')](_0xb67b('0x39'))){_0x5c32bc['limit']=qs[_0xb67b('0x1d')](_0x1c6267['query'][_0xb67b('0x1d')]);_0x5c32bc[_0xb67b('0x1f')]=qs['offset'](_0x1c6267[_0xb67b('0x30')][_0xb67b('0x1f')]);}return _0x3f8529[_0xb67b('0x4f')](_0x5c32bc);}})[_0xb67b('0x25')](function(_0x127428){if(_0x127428){return _0x127428?{'count':_0x58b0cd,'rows':_0x127428}:null;}})['then'](respondWithResult(_0x24b24e,null))[_0xb67b('0x43')](handleError(_0x24b24e,null));}; \ No newline at end of file +var _0xbf63=['filters','where','merge','map','filter','options','include','SalesforceConfiguration','findAll','catch','show','params','includeAll','create','body','find','destroy','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5d63a5,_0x53976c){var _0x534a5c=function(_0x1f6892){while(--_0x1f6892){_0x5d63a5['push'](_0x5d63a5['shift']());}};_0x534a5c(++_0x53976c);}(_0xbf63,0x1eb));var _0x3bf6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbf63[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x3bf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bf6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3bf6('0x2'));var BPromise=require(_0x3bf6('0x3'));var Mustache=require(_0x3bf6('0x4'));var util=require(_0x3bf6('0x5'));var path=require(_0x3bf6('0x6'));var sox=require(_0x3bf6('0x7'));var csv=require(_0x3bf6('0x8'));var ejs=require(_0x3bf6('0x9'));var fs=require('fs');var fs_extra=require(_0x3bf6('0xa'));var _=require(_0x3bf6('0xb'));var squel=require(_0x3bf6('0xc'));var crypto=require(_0x3bf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3bf6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3bf6('0xf'));var Redis=require(_0x3bf6('0x10'));var authService=require(_0x3bf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3bf6('0x12'));var hardwareService=require(_0x3bf6('0x13'));var logger=require(_0x3bf6('0x14'))(_0x3bf6('0x15'));var utils=require('../../config/utils');var config=require(_0x3bf6('0x16'));var licenseUtil=require(_0x3bf6('0x17'));var db=require(_0x3bf6('0x18'))['db'];function respondWithStatusCode(_0x57afa7,_0x3be423){_0x3be423=_0x3be423||0xcc;return function(_0x4dfe94){if(_0x4dfe94){return _0x57afa7[_0x3bf6('0x19')](_0x3be423);}return _0x57afa7[_0x3bf6('0x1a')](_0x3be423)[_0x3bf6('0x1b')]();};}function respondWithResult(_0xd7cac5,_0x4e9d24){_0x4e9d24=_0x4e9d24||0xc8;return function(_0x56a47b){if(_0x56a47b){return _0xd7cac5['status'](_0x4e9d24)['json'](_0x56a47b);}};}function respondWithFilteredResult(_0xa5818d,_0x19fe93){return function(_0x340865){if(_0x340865){var _0x48b89b=typeof _0x19fe93[_0x3bf6('0x1c')]==='undefined'&&typeof _0x19fe93[_0x3bf6('0x1d')]===_0x3bf6('0x1e');var _0x59ebbf=_0x340865[_0x3bf6('0x1f')];var _0x3944ef=_0x48b89b?0x0:_0x19fe93[_0x3bf6('0x1c')];var _0x267f28=_0x48b89b?_0x340865[_0x3bf6('0x1f')]:_0x19fe93[_0x3bf6('0x1c')]+_0x19fe93[_0x3bf6('0x1d')];var _0x247a89;if(_0x267f28>=_0x59ebbf){_0x267f28=_0x59ebbf;_0x247a89=0xc8;}else{_0x247a89=0xce;}_0xa5818d[_0x3bf6('0x1a')](_0x247a89);return _0xa5818d['set'](_0x3bf6('0x20'),_0x3944ef+'-'+_0x267f28+'/'+_0x59ebbf)['json'](_0x340865);}return null;};}function patchUpdates(_0x1ff99b){return function(_0x2c375e){try{jsonpatch[_0x3bf6('0x21')](_0x2c375e,_0x1ff99b,!![]);}catch(_0x1bf4e9){return BPromise['reject'](_0x1bf4e9);}return _0x2c375e[_0x3bf6('0x22')]();};}function saveUpdates(_0x13dd5e,_0x56caa3){return function(_0x3db9a2){if(_0x3db9a2){return _0x3db9a2[_0x3bf6('0x23')](_0x13dd5e)[_0x3bf6('0x24')](function(_0x2fd089){return _0x2fd089;});}return null;};}function removeEntity(_0x151b27,_0x356348){return function(_0x89cbcc){if(_0x89cbcc){return _0x89cbcc['destroy']()[_0x3bf6('0x24')](function(){_0x151b27[_0x3bf6('0x1a')](0xcc)[_0x3bf6('0x1b')]();});}};}function handleEntityNotFound(_0x55fae0,_0x3d3e8e){return function(_0x8ca4f5){if(!_0x8ca4f5){_0x55fae0[_0x3bf6('0x19')](0x194);}return _0x8ca4f5;};}function handleError(_0xa79ed4,_0x4f15f5){_0x4f15f5=_0x4f15f5||0x1f4;return function(_0x49d574){logger[_0x3bf6('0x25')](_0x49d574[_0x3bf6('0x26')]);if(_0x49d574[_0x3bf6('0x27')]){delete _0x49d574[_0x3bf6('0x27')];}_0xa79ed4[_0x3bf6('0x1a')](_0x4f15f5)[_0x3bf6('0x28')](_0x49d574);};}exports[_0x3bf6('0x29')]=function(_0x23c37b,_0x23118e){var _0x1d825f={},_0x2fd1f9={},_0x3b2304={'count':0x0,'rows':[]};var _0x167fb6=_['map'](db['SalesforceConfiguration'][_0x3bf6('0x2a')],function(_0x34b84b){return{'name':_0x34b84b['fieldName'],'type':_0x34b84b[_0x3bf6('0x2b')]['key']};});_0x2fd1f9['model']=_['map'](_0x167fb6,_0x3bf6('0x27'));_0x2fd1f9['query']=_[_0x3bf6('0x2c')](_0x23c37b['query']);_0x2fd1f9['filters']=_[_0x3bf6('0x2d')](_0x2fd1f9[_0x3bf6('0x2e')],_0x2fd1f9[_0x3bf6('0x2f')]);_0x1d825f[_0x3bf6('0x30')]=_['intersection'](_0x2fd1f9[_0x3bf6('0x2e')],qs[_0x3bf6('0x31')](_0x23c37b['query'][_0x3bf6('0x31')]));_0x1d825f['attributes']=_0x1d825f[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x1d825f[_0x3bf6('0x30')]:_0x2fd1f9[_0x3bf6('0x2e')];if(!_0x23c37b['query'][_0x3bf6('0x33')](_0x3bf6('0x34'))){_0x1d825f[_0x3bf6('0x1d')]=qs[_0x3bf6('0x1d')](_0x23c37b[_0x3bf6('0x2f')][_0x3bf6('0x1d')]);_0x1d825f[_0x3bf6('0x1c')]=qs[_0x3bf6('0x1c')](_0x23c37b[_0x3bf6('0x2f')][_0x3bf6('0x1c')]);}_0x1d825f[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x23c37b['query'][_0x3bf6('0x36')]);_0x1d825f['where']=qs[_0x3bf6('0x37')](_['pick'](_0x23c37b[_0x3bf6('0x2f')],_0x2fd1f9[_0x3bf6('0x37')]),_0x167fb6);if(_0x23c37b[_0x3bf6('0x2f')]['filter']){_0x1d825f[_0x3bf6('0x38')]=_[_0x3bf6('0x39')](_0x1d825f[_0x3bf6('0x38')],{'$or':_[_0x3bf6('0x3a')](_0x167fb6,function(_0x2e99cc){if(_0x2e99cc['type']!=='VIRTUAL'){var _0x57c2ce={};_0x57c2ce[_0x2e99cc['name']]={'$like':'%'+_0x23c37b['query'][_0x3bf6('0x3b')]+'%'};return _0x57c2ce;}})});}_0x1d825f=_[_0x3bf6('0x39')]({},_0x1d825f,_0x23c37b[_0x3bf6('0x3c')]);var _0x1be12a={'where':_0x1d825f['where']};return db['SalesforceConfiguration'][_0x3bf6('0x1f')](_0x1be12a)[_0x3bf6('0x24')](function(_0x506e4c){_0x3b2304[_0x3bf6('0x1f')]=_0x506e4c;if(_0x23c37b['query']['includeAll']){_0x1d825f[_0x3bf6('0x3d')]=[{'all':!![]}];}return db[_0x3bf6('0x3e')][_0x3bf6('0x3f')](_0x1d825f);})[_0x3bf6('0x24')](function(_0x2c338f){_0x3b2304['rows']=_0x2c338f;return _0x3b2304;})['then'](respondWithFilteredResult(_0x23118e,_0x1d825f))[_0x3bf6('0x40')](handleError(_0x23118e,null));};exports[_0x3bf6('0x41')]=function(_0x517d63,_0x555c46){var _0x10d65c={'raw':![],'where':{'id':_0x517d63[_0x3bf6('0x42')]['id']}},_0x807443={};_0x807443[_0x3bf6('0x2e')]=_[_0x3bf6('0x2c')](db[_0x3bf6('0x3e')]['rawAttributes']);_0x807443[_0x3bf6('0x2f')]=_['keys'](_0x517d63[_0x3bf6('0x2f')]);_0x807443['filters']=_[_0x3bf6('0x2d')](_0x807443[_0x3bf6('0x2e')],_0x807443['query']);_0x10d65c[_0x3bf6('0x30')]=_[_0x3bf6('0x2d')](_0x807443[_0x3bf6('0x2e')],qs[_0x3bf6('0x31')](_0x517d63[_0x3bf6('0x2f')][_0x3bf6('0x31')]));_0x10d65c[_0x3bf6('0x30')]=_0x10d65c['attributes']['length']?_0x10d65c[_0x3bf6('0x30')]:_0x807443[_0x3bf6('0x2e')];if(_0x517d63[_0x3bf6('0x2f')][_0x3bf6('0x43')]){_0x10d65c['include']=[{'all':!![]}];}_0x10d65c=_['merge']({},_0x10d65c,_0x517d63['options']);return db['SalesforceConfiguration']['find'](_0x10d65c)[_0x3bf6('0x24')](handleEntityNotFound(_0x555c46,null))[_0x3bf6('0x24')](respondWithResult(_0x555c46,null))[_0x3bf6('0x40')](handleError(_0x555c46,null));};exports[_0x3bf6('0x44')]=function(_0xebd4c3,_0x30ff8a){return db[_0x3bf6('0x3e')][_0x3bf6('0x44')](_0xebd4c3[_0x3bf6('0x45')],{})[_0x3bf6('0x24')](respondWithResult(_0x30ff8a,0xc9))['catch'](handleError(_0x30ff8a,null));};exports['update']=function(_0x21a344,_0x2d985c){if(_0x21a344[_0x3bf6('0x45')]['id']){delete _0x21a344['body']['id'];}return db[_0x3bf6('0x3e')][_0x3bf6('0x46')]({'where':{'id':_0x21a344[_0x3bf6('0x42')]['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x2d985c,null))[_0x3bf6('0x24')](saveUpdates(_0x21a344[_0x3bf6('0x45')],null))[_0x3bf6('0x24')](respondWithResult(_0x2d985c,null))[_0x3bf6('0x40')](handleError(_0x2d985c,null));};exports[_0x3bf6('0x47')]=function(_0x4d90aa,_0x2b643a){return db['SalesforceConfiguration']['find']({'where':{'id':_0x4d90aa[_0x3bf6('0x42')]['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x2b643a,null))['then'](removeEntity(_0x2b643a,null))[_0x3bf6('0x40')](handleError(_0x2b643a,null));};exports[_0x3bf6('0x48')]=function(_0x32df20,_0x17771e,_0x140e34){var _0x2412ec={};var _0x356770={};var _0x1237e4;var _0x567b6b;return db['SalesforceConfiguration'][_0x3bf6('0x49')]({'where':{'id':_0x32df20[_0x3bf6('0x42')]['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x17771e,null))[_0x3bf6('0x24')](function(_0x4e9299){if(_0x4e9299){_0x1237e4=_0x4e9299;_0x356770[_0x3bf6('0x2e')]=_[_0x3bf6('0x2c')](db[_0x3bf6('0x4a')][_0x3bf6('0x2a')]);_0x356770[_0x3bf6('0x2f')]=_[_0x3bf6('0x2c')](_0x32df20[_0x3bf6('0x2f')]);_0x356770[_0x3bf6('0x37')]=_[_0x3bf6('0x2d')](_0x356770[_0x3bf6('0x2e')],_0x356770[_0x3bf6('0x2f')]);_0x2412ec[_0x3bf6('0x30')]=_['intersection'](_0x356770[_0x3bf6('0x2e')],qs[_0x3bf6('0x31')](_0x32df20[_0x3bf6('0x2f')]['fields']));_0x2412ec[_0x3bf6('0x30')]=_0x2412ec[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x2412ec[_0x3bf6('0x30')]:_0x356770[_0x3bf6('0x2e')];_0x2412ec[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x32df20[_0x3bf6('0x2f')][_0x3bf6('0x36')]);_0x2412ec['where']=qs[_0x3bf6('0x37')](_[_0x3bf6('0x4b')](_0x32df20[_0x3bf6('0x2f')],_0x356770[_0x3bf6('0x37')]));if(_0x32df20[_0x3bf6('0x2f')]['filter']){_0x2412ec[_0x3bf6('0x38')]=_[_0x3bf6('0x39')](_0x2412ec[_0x3bf6('0x38')],{'$or':_[_0x3bf6('0x3a')](_0x2412ec[_0x3bf6('0x30')],function(_0xccbb40){var _0x3824af={};_0x3824af[_0xccbb40]={'$like':'%'+_0x32df20['query'][_0x3bf6('0x3b')]+'%'};return _0x3824af;})});}_0x2412ec=_['merge']({},_0x2412ec,_0x32df20[_0x3bf6('0x3c')]);return _0x1237e4['getFields'](_0x2412ec);}})[_0x3bf6('0x24')](function(_0x15b093){if(_0x15b093){_0x567b6b=_0x15b093[_0x3bf6('0x32')];if(!_0x32df20[_0x3bf6('0x2f')]['hasOwnProperty'](_0x3bf6('0x34'))){_0x2412ec['limit']=qs[_0x3bf6('0x1d')](_0x32df20[_0x3bf6('0x2f')][_0x3bf6('0x1d')]);_0x2412ec['offset']=qs['offset'](_0x32df20[_0x3bf6('0x2f')]['offset']);}return _0x1237e4['getFields'](_0x2412ec);}})[_0x3bf6('0x24')](function(_0x1cdb55){if(_0x1cdb55){return _0x1cdb55?{'count':_0x567b6b,'rows':_0x1cdb55}:null;}})['then'](respondWithResult(_0x17771e,null))[_0x3bf6('0x40')](handleError(_0x17771e,null));};exports[_0x3bf6('0x4c')]=function(_0x30a67a,_0x13b7d1,_0x422bae){var _0x53701d={};var _0x2f05b4={};var _0x203c54;var _0x6c3c86;return db['SalesforceConfiguration'][_0x3bf6('0x49')]({'where':{'id':_0x30a67a['params']['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x13b7d1,null))[_0x3bf6('0x24')](function(_0x5c45fc){if(_0x5c45fc){_0x203c54=_0x5c45fc;_0x2f05b4[_0x3bf6('0x2e')]=_['keys'](db[_0x3bf6('0x4a')][_0x3bf6('0x2a')]);_0x2f05b4['query']=_['keys'](_0x30a67a[_0x3bf6('0x2f')]);_0x2f05b4[_0x3bf6('0x37')]=_[_0x3bf6('0x2d')](_0x2f05b4[_0x3bf6('0x2e')],_0x2f05b4['query']);_0x53701d[_0x3bf6('0x30')]=_['intersection'](_0x2f05b4[_0x3bf6('0x2e')],qs['fields'](_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x31')]));_0x53701d['attributes']=_0x53701d[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x53701d[_0x3bf6('0x30')]:_0x2f05b4['model'];_0x53701d[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x30a67a['query']['sort']);_0x53701d['where']=qs[_0x3bf6('0x37')](_[_0x3bf6('0x4b')](_0x30a67a[_0x3bf6('0x2f')],_0x2f05b4[_0x3bf6('0x37')]));if(_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x3b')]){_0x53701d['where']=_['merge'](_0x53701d['where'],{'$or':_['map'](_0x53701d[_0x3bf6('0x30')],function(_0x3898db){var _0xa1ad08={};_0xa1ad08[_0x3898db]={'$like':'%'+_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x3b')]+'%'};return _0xa1ad08;})});}_0x53701d=_['merge']({},_0x53701d,_0x30a67a[_0x3bf6('0x3c')]);return _0x203c54[_0x3bf6('0x4c')](_0x53701d);}})[_0x3bf6('0x24')](function(_0x2b8e39){if(_0x2b8e39){_0x6c3c86=_0x2b8e39['length'];if(!_0x30a67a['query'][_0x3bf6('0x33')](_0x3bf6('0x34'))){_0x53701d[_0x3bf6('0x1d')]=qs[_0x3bf6('0x1d')](_0x30a67a['query'][_0x3bf6('0x1d')]);_0x53701d[_0x3bf6('0x1c')]=qs[_0x3bf6('0x1c')](_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x1c')]);}return _0x203c54[_0x3bf6('0x4c')](_0x53701d);}})[_0x3bf6('0x24')](function(_0x2c7779){if(_0x2c7779){return _0x2c7779?{'count':_0x6c3c86,'rows':_0x2c7779}:null;}})[_0x3bf6('0x24')](respondWithResult(_0x13b7d1,null))[_0x3bf6('0x40')](handleError(_0x13b7d1,null));};exports['getDescriptions']=function(_0x31b35f,_0x39489d,_0x44a915){var _0x20fee4={};var _0x238c77={};var _0x1a8b41;var _0x8a96f;return db[_0x3bf6('0x3e')][_0x3bf6('0x49')]({'where':{'id':_0x31b35f[_0x3bf6('0x42')]['id']}})['then'](handleEntityNotFound(_0x39489d,null))['then'](function(_0x4e9356){if(_0x4e9356){_0x1a8b41=_0x4e9356;_0x238c77['model']=_[_0x3bf6('0x2c')](db[_0x3bf6('0x4a')][_0x3bf6('0x2a')]);_0x238c77[_0x3bf6('0x2f')]=_[_0x3bf6('0x2c')](_0x31b35f[_0x3bf6('0x2f')]);_0x238c77[_0x3bf6('0x37')]=_[_0x3bf6('0x2d')](_0x238c77[_0x3bf6('0x2e')],_0x238c77[_0x3bf6('0x2f')]);_0x20fee4[_0x3bf6('0x30')]=_['intersection'](_0x238c77['model'],qs[_0x3bf6('0x31')](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x31')]));_0x20fee4[_0x3bf6('0x30')]=_0x20fee4[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x20fee4[_0x3bf6('0x30')]:_0x238c77[_0x3bf6('0x2e')];_0x20fee4[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x36')]);_0x20fee4[_0x3bf6('0x38')]=qs[_0x3bf6('0x37')](_[_0x3bf6('0x4b')](_0x31b35f[_0x3bf6('0x2f')],_0x238c77[_0x3bf6('0x37')]));if(_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x3b')]){_0x20fee4[_0x3bf6('0x38')]=_[_0x3bf6('0x39')](_0x20fee4[_0x3bf6('0x38')],{'$or':_[_0x3bf6('0x3a')](_0x20fee4[_0x3bf6('0x30')],function(_0x25f14d){var _0x14eb51={};_0x14eb51[_0x25f14d]={'$like':'%'+_0x31b35f[_0x3bf6('0x2f')]['filter']+'%'};return _0x14eb51;})});}_0x20fee4=_[_0x3bf6('0x39')]({},_0x20fee4,_0x31b35f[_0x3bf6('0x3c')]);return _0x1a8b41['getDescriptions'](_0x20fee4);}})[_0x3bf6('0x24')](function(_0x25ca94){if(_0x25ca94){_0x8a96f=_0x25ca94[_0x3bf6('0x32')];if(!_0x31b35f[_0x3bf6('0x2f')]['hasOwnProperty'](_0x3bf6('0x34'))){_0x20fee4[_0x3bf6('0x1d')]=qs['limit'](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x1d')]);_0x20fee4[_0x3bf6('0x1c')]=qs[_0x3bf6('0x1c')](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x1c')]);}return _0x1a8b41[_0x3bf6('0x4d')](_0x20fee4);}})['then'](function(_0x4ac55f){if(_0x4ac55f){return _0x4ac55f?{'count':_0x8a96f,'rows':_0x4ac55f}:null;}})[_0x3bf6('0x24')](respondWithResult(_0x39489d,null))[_0x3bf6('0x40')](handleError(_0x39489d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2e70fa6..774b24a 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 _0x637e=['SalesforceConfiguration','lodash','util','../../config/logger','api','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x314a54,_0x4421d2){var _0x34105a=function(_0x5a4d19){while(--_0x5a4d19){_0x314a54['push'](_0x314a54['shift']());}};_0x34105a(++_0x4421d2);}(_0x637e,0x169));var _0xe637=function(_0x32bfac,_0x4c7cda){_0x32bfac=_0x32bfac-0x0;var _0x19f3d2=_0x637e[_0x32bfac];return _0x19f3d2;};'use strict';var _=require(_0xe637('0x0'));var util=require(_0xe637('0x1'));var logger=require(_0xe637('0x2'))(_0xe637('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe637('0x4'));var config=require(_0xe637('0x5'));var attributes=require(_0xe637('0x6'));module[_0xe637('0x7')]=function(_0x35cb8c,_0xba3b5b){return _0x35cb8c[_0xe637('0x8')](_0xe637('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4129=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','bluebird','request-promise'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0x4129,0x76));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9412('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9412('0x1'));var rp=require(_0x9412('0x2'));var fs=require('fs');var path=require(_0x9412('0x3'));var rimraf=require(_0x9412('0x4'));var config=require(_0x9412('0x5'));var attributes=require(_0x9412('0x6'));module[_0x9412('0x7')]=function(_0x25fb9b,_0x1be98d){return _0x25fb9b[_0x9412('0x8')](_0x9412('0x9'),attributes,{'tableName':_0x9412('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index ffcf175..c7bf0cb 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 _0x6273=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x390371,_0x116e62){var _0x244ec7=function(_0xec6ec){while(--_0xec6ec){_0x390371['push'](_0x390371['shift']());}};_0x244ec7(++_0x116e62);}(_0x6273,0x175));var _0x3627=function(_0x3e2e4e,_0x1c50b6){_0x3e2e4e=_0x3e2e4e-0x0;var _0x199f1b=_0x6273[_0x3e2e4e];return _0x199f1b;};'use strict';var _=require(_0x3627('0x0'));var util=require(_0x3627('0x1'));var moment=require(_0x3627('0x2'));var BPromise=require(_0x3627('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3627('0x4'));var db=require(_0x3627('0x5'))['db'];var utils=require(_0x3627('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3627('0x7'));var jayson=require(_0x3627('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4a5c,_0x31253c,_0x4c2895){return new BPromise(function(_0x4efe04,_0x4aaf07){return client[_0x3627('0x9')](_0x1e4a5c,_0x4c2895)[_0x3627('0xa')](function(_0x423c01){logger[_0x3627('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x31253c,_0x3627('0xc'));logger[_0x3627('0xd')](_0x3627('0xe'),_0x31253c,_0x3627('0xc'),JSON['stringify'](_0x423c01));if(_0x423c01[_0x3627('0xf')]){if(_0x423c01[_0x3627('0xf')][_0x3627('0x10')]===0x1f4){logger[_0x3627('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x31253c,_0x423c01[_0x3627('0xf')]['message']);return _0x4aaf07(_0x423c01['error'][_0x3627('0x11')]);}logger[_0x3627('0xf')](_0x3627('0x12'),_0x31253c,_0x423c01[_0x3627('0xf')][_0x3627('0x11')]);return _0x4efe04(_0x423c01[_0x3627('0xf')]['message']);}else{logger['info'](_0x3627('0x12'),_0x31253c,_0x3627('0xc'));_0x4efe04(_0x423c01[_0x3627('0x13')]['message']);}})['catch'](function(_0xb62001){logger[_0x3627('0xf')](_0x3627('0x12'),_0x31253c,_0xb62001);_0x4aaf07(_0xb62001);});});} \ No newline at end of file +var _0x484b=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x243e23,_0x33453a){var _0x9d84dd=function(_0xbfe48){while(--_0xbfe48){_0x243e23['push'](_0x243e23['shift']());}};_0x9d84dd(++_0x33453a);}(_0x484b,0x1ec));var _0xb484=function(_0x1e7ae4,_0x45991d){_0x1e7ae4=_0x1e7ae4-0x0;var _0x481545=_0x484b[_0x1e7ae4];return _0x481545;};'use strict';var _=require('lodash');var util=require(_0xb484('0x0'));var moment=require(_0xb484('0x1'));var BPromise=require('bluebird');var rs=require(_0xb484('0x2'));var fs=require('fs');var Redis=require(_0xb484('0x3'));var db=require(_0xb484('0x4'))['db'];var utils=require(_0xb484('0x5'));var logger=require(_0xb484('0x6'))('rpc');var config=require(_0xb484('0x7'));var jayson=require(_0xb484('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5891ed,_0x172ebc,_0x4aba25){return new BPromise(function(_0x1d5fb1,_0x113959){return client[_0xb484('0x9')](_0x5891ed,_0x4aba25)[_0xb484('0xa')](function(_0x5e4e45){logger[_0xb484('0xb')](_0xb484('0xc'),_0x172ebc,_0xb484('0xd'));logger[_0xb484('0xe')](_0xb484('0xf'),_0x172ebc,_0xb484('0xd'),JSON[_0xb484('0x10')](_0x5e4e45));if(_0x5e4e45[_0xb484('0x11')]){if(_0x5e4e45[_0xb484('0x11')][_0xb484('0x12')]===0x1f4){logger[_0xb484('0x11')](_0xb484('0xc'),_0x172ebc,_0x5e4e45['error']['message']);return _0x113959(_0x5e4e45['error'][_0xb484('0x13')]);}logger[_0xb484('0x11')](_0xb484('0xc'),_0x172ebc,_0x5e4e45[_0xb484('0x11')][_0xb484('0x13')]);return _0x1d5fb1(_0x5e4e45[_0xb484('0x11')]['message']);}else{logger[_0xb484('0xb')](_0xb484('0xc'),_0x172ebc,'request\x20sent');_0x1d5fb1(_0x5e4e45[_0xb484('0x14')]['message']);}})[_0xb484('0x15')](function(_0x34dcfc){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x172ebc,_0x34dcfc);_0x113959(_0x34dcfc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c6f2374..18ea2b5 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 _0x0585=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy'];(function(_0x406957,_0x36fc08){var _0x803a57=function(_0x27f25f){while(--_0x27f25f){_0x406957['push'](_0x406957['shift']());}};_0x803a57(++_0x36fc08);}(_0x0585,0x18d));var _0x5058=function(_0x257c3e,_0x39c522){_0x257c3e=_0x257c3e-0x0;var _0x2ce22c=_0x0585[_0x257c3e];return _0x2ce22c;};'use strict';var multer=require('multer');var util=require(_0x5058('0x0'));var path=require(_0x5058('0x1'));var timeout=require(_0x5058('0x2'));var express=require(_0x5058('0x3'));var router=express[_0x5058('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5058('0x5'));var interaction=require(_0x5058('0x6'));var config=require('../../config/environment');var controller=require(_0x5058('0x7'));router['get']('/',auth[_0x5058('0x8')](),controller[_0x5058('0x9')]);router[_0x5058('0xa')](_0x5058('0xb'),auth[_0x5058('0x8')](),controller['show']);router['post']('/',auth[_0x5058('0x8')](),controller[_0x5058('0xc')]);router[_0x5058('0xd')]('/:id',auth[_0x5058('0x8')](),controller[_0x5058('0xe')]);router[_0x5058('0xf')](_0x5058('0xb'),auth[_0x5058('0x8')](),controller[_0x5058('0x10')]);module[_0x5058('0x11')]=router; \ No newline at end of file +var _0xe1d7=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x466ae7,_0x1a7bb5){var _0x453444=function(_0xf63ea9){while(--_0xf63ea9){_0x466ae7['push'](_0x466ae7['shift']());}};_0x453444(++_0x1a7bb5);}(_0xe1d7,0x1f0));var _0x7e1d=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xe1d7[_0xccf869];return _0x21a9db;};'use strict';var multer=require(_0x7e1d('0x0'));var util=require('util');var path=require(_0x7e1d('0x1'));var timeout=require(_0x7e1d('0x2'));var express=require(_0x7e1d('0x3'));var router=express[_0x7e1d('0x4')]();var fs_extra=require(_0x7e1d('0x5'));var auth=require(_0x7e1d('0x6'));var interaction=require(_0x7e1d('0x7'));var config=require(_0x7e1d('0x8'));var controller=require(_0x7e1d('0x9'));router[_0x7e1d('0xa')]('/',auth[_0x7e1d('0xb')](),controller[_0x7e1d('0xc')]);router[_0x7e1d('0xa')](_0x7e1d('0xd'),auth[_0x7e1d('0xb')](),controller[_0x7e1d('0xe')]);router[_0x7e1d('0xf')]('/',auth[_0x7e1d('0xb')](),controller[_0x7e1d('0x10')]);router[_0x7e1d('0x11')](_0x7e1d('0xd'),auth[_0x7e1d('0xb')](),controller['update']);router[_0x7e1d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7e1d('0x13')]);module[_0x7e1d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b08cf03..2926cb0 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 _0x6517=['customVariable','keyValue','STRING','ENUM','sequelize','exports','string','variable'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6517,0x1d4));var _0x7651=function(_0x970c67,_0x3ef5a4){_0x970c67=_0x970c67-0x0;var _0x5e191e=_0x6517[_0x970c67];return _0x5e191e;};'use strict';var Sequelize=require(_0x7651('0x0'));module[_0x7651('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7651('0x2'),_0x7651('0x3'),_0x7651('0x4'),_0x7651('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7651('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7651('0x7')](_0x7651('0x2'),_0x7651('0x3'),_0x7651('0x4'))},'keyContent':{'type':Sequelize[_0x7651('0x6')]},'idField':{'type':Sequelize[_0x7651('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9800=['sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0x9800,0x6c));var _0x0980=function(_0x21d164,_0x56f290){_0x21d164=_0x21d164-0x0;var _0x3ac5fd=_0x9800[_0x21d164];return _0x3ac5fd;};'use strict';var Sequelize=require(_0x0980('0x0'));module[_0x0980('0x1')]={'type':{'type':Sequelize[_0x0980('0x2')]('string',_0x0980('0x3'),'customVariable',_0x0980('0x4'),_0x0980('0x5')),'defaultValue':_0x0980('0x6')},'content':{'type':Sequelize[_0x0980('0x7')]},'key':{'type':Sequelize[_0x0980('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0980('0x3'),_0x0980('0x8'))},'keyContent':{'type':Sequelize[_0x0980('0x7')]},'idField':{'type':Sequelize[_0x0980('0x7')]},'variableName':{'type':Sequelize[_0x0980('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 793cd1f..2cfe190 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 _0x82b6=['mustache','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','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','SalesforceField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','rows','show','params','rawAttributes','includeAll','include','catch','create','body','find','destroy','rimraf','zip-dir','request-promise','bluebird'];(function(_0x161e4a,_0x19096d){var _0x57cb12=function(_0x6a76db){while(--_0x6a76db){_0x161e4a['push'](_0x161e4a['shift']());}};_0x57cb12(++_0x19096d);}(_0x82b6,0x17d));var _0x682b=function(_0x45964b,_0xe849e5){_0x45964b=_0x45964b-0x0;var _0x4dc863=_0x82b6[_0x45964b];return _0x4dc863;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x682b('0x0'));var zipdir=require(_0x682b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x682b('0x2'));var moment=require('moment');var BPromise=require(_0x682b('0x3'));var Mustache=require(_0x682b('0x4'));var util=require('util');var path=require(_0x682b('0x5'));var sox=require(_0x682b('0x6'));var csv=require(_0x682b('0x7'));var ejs=require(_0x682b('0x8'));var fs=require('fs');var fs_extra=require(_0x682b('0x9'));var _=require(_0x682b('0xa'));var squel=require(_0x682b('0xb'));var crypto=require(_0x682b('0xc'));var jsforce=require(_0x682b('0xd'));var deskjs=require(_0x682b('0xe'));var toCsv=require(_0x682b('0x7'));var querystring=require(_0x682b('0xf'));var Papa=require(_0x682b('0x10'));var Redis=require('ioredis');var authService=require(_0x682b('0x11'));var qs=require(_0x682b('0x12'));var as=require(_0x682b('0x13'));var hardwareService=require(_0x682b('0x14'));var logger=require(_0x682b('0x15'))(_0x682b('0x16'));var utils=require(_0x682b('0x17'));var config=require(_0x682b('0x18'));var licenseUtil=require(_0x682b('0x19'));var db=require(_0x682b('0x1a'))['db'];function respondWithStatusCode(_0x5d6276,_0xeb4c93){_0xeb4c93=_0xeb4c93||0xcc;return function(_0x286d8e){if(_0x286d8e){return _0x5d6276['sendStatus'](_0xeb4c93);}return _0x5d6276[_0x682b('0x1b')](_0xeb4c93)[_0x682b('0x1c')]();};}function respondWithResult(_0x5192c9,_0x225d0c){_0x225d0c=_0x225d0c||0xc8;return function(_0x505938){if(_0x505938){return _0x5192c9[_0x682b('0x1b')](_0x225d0c)[_0x682b('0x1d')](_0x505938);}};}function respondWithFilteredResult(_0x4c58d0,_0x408903){return function(_0x3d779e){if(_0x3d779e){var _0x396543=typeof _0x408903['offset']===_0x682b('0x1e')&&typeof _0x408903[_0x682b('0x1f')]==='undefined';var _0x2d97ed=_0x3d779e[_0x682b('0x20')];var _0x8c957=_0x396543?0x0:_0x408903[_0x682b('0x21')];var _0x4fe8fc=_0x396543?_0x3d779e['count']:_0x408903[_0x682b('0x21')]+_0x408903['limit'];var _0x45b494;if(_0x4fe8fc>=_0x2d97ed){_0x4fe8fc=_0x2d97ed;_0x45b494=0xc8;}else{_0x45b494=0xce;}_0x4c58d0[_0x682b('0x1b')](_0x45b494);return _0x4c58d0[_0x682b('0x22')](_0x682b('0x23'),_0x8c957+'-'+_0x4fe8fc+'/'+_0x2d97ed)[_0x682b('0x1d')](_0x3d779e);}return null;};}function patchUpdates(_0x37165d){return function(_0x4ffb3b){try{jsonpatch[_0x682b('0x24')](_0x4ffb3b,_0x37165d,!![]);}catch(_0x1d7c97){return BPromise[_0x682b('0x25')](_0x1d7c97);}return _0x4ffb3b[_0x682b('0x26')]();};}function saveUpdates(_0x421fba,_0x5d505b){return function(_0x3e3370){if(_0x3e3370){return _0x3e3370['update'](_0x421fba)[_0x682b('0x27')](function(_0x47d0d3){return _0x47d0d3;});}return null;};}function removeEntity(_0x4d2646,_0x404ba7){return function(_0x5595ba){if(_0x5595ba){return _0x5595ba['destroy']()['then'](function(){_0x4d2646[_0x682b('0x1b')](0xcc)[_0x682b('0x1c')]();});}};}function handleEntityNotFound(_0x1eaa5c,_0x3993c9){return function(_0x5ae56d){if(!_0x5ae56d){_0x1eaa5c[_0x682b('0x28')](0x194);}return _0x5ae56d;};}function handleError(_0x18dff6,_0x3644db){_0x3644db=_0x3644db||0x1f4;return function(_0x526171){logger[_0x682b('0x29')](_0x526171['stack']);if(_0x526171['name']){delete _0x526171[_0x682b('0x2a')];}_0x18dff6[_0x682b('0x1b')](_0x3644db)[_0x682b('0x2b')](_0x526171);};}exports[_0x682b('0x2c')]=function(_0x5e3194,_0x85bec6){var _0x2d156f={},_0x537fd2={},_0x45fe9e={'count':0x0,'rows':[]};var _0x5c4ecd=_[_0x682b('0x2d')](db[_0x682b('0x2e')]['rawAttributes'],function(_0xab233c){return{'name':_0xab233c[_0x682b('0x2f')],'type':_0xab233c[_0x682b('0x30')][_0x682b('0x31')]};});_0x537fd2[_0x682b('0x32')]=_[_0x682b('0x2d')](_0x5c4ecd,_0x682b('0x2a'));_0x537fd2[_0x682b('0x33')]=_[_0x682b('0x34')](_0x5e3194['query']);_0x537fd2[_0x682b('0x35')]=_[_0x682b('0x36')](_0x537fd2[_0x682b('0x32')],_0x537fd2[_0x682b('0x33')]);_0x2d156f[_0x682b('0x37')]=_['intersection'](_0x537fd2[_0x682b('0x32')],qs[_0x682b('0x38')](_0x5e3194['query'][_0x682b('0x38')]));_0x2d156f[_0x682b('0x37')]=_0x2d156f[_0x682b('0x37')][_0x682b('0x39')]?_0x2d156f[_0x682b('0x37')]:_0x537fd2['model'];if(!_0x5e3194['query'][_0x682b('0x3a')]('nolimit')){_0x2d156f['limit']=qs[_0x682b('0x1f')](_0x5e3194[_0x682b('0x33')]['limit']);_0x2d156f[_0x682b('0x21')]=qs[_0x682b('0x21')](_0x5e3194[_0x682b('0x33')]['offset']);}_0x2d156f[_0x682b('0x3b')]=qs[_0x682b('0x3c')](_0x5e3194[_0x682b('0x33')][_0x682b('0x3c')]);_0x2d156f[_0x682b('0x3d')]=qs[_0x682b('0x35')](_[_0x682b('0x3e')](_0x5e3194[_0x682b('0x33')],_0x537fd2[_0x682b('0x35')]),_0x5c4ecd);if(_0x5e3194[_0x682b('0x33')][_0x682b('0x3f')]){_0x2d156f[_0x682b('0x3d')]=_[_0x682b('0x40')](_0x2d156f[_0x682b('0x3d')],{'$or':_[_0x682b('0x2d')](_0x5c4ecd,function(_0x10cacf){if(_0x10cacf['type']!==_0x682b('0x41')){var _0x428422={};_0x428422[_0x10cacf[_0x682b('0x2a')]]={'$like':'%'+_0x5e3194['query'][_0x682b('0x3f')]+'%'};return _0x428422;}})});}_0x2d156f=_['merge']({},_0x2d156f,_0x5e3194['options']);var _0x54003b={'where':_0x2d156f[_0x682b('0x3d')]};return db[_0x682b('0x2e')][_0x682b('0x20')](_0x54003b)[_0x682b('0x27')](function(_0x24e429){_0x45fe9e[_0x682b('0x20')]=_0x24e429;if(_0x5e3194[_0x682b('0x33')]['includeAll']){_0x2d156f['include']=[{'all':!![]}];}return db[_0x682b('0x2e')]['findAll'](_0x2d156f);})[_0x682b('0x27')](function(_0x17f927){_0x45fe9e[_0x682b('0x42')]=_0x17f927;return _0x45fe9e;})['then'](respondWithFilteredResult(_0x85bec6,_0x2d156f))['catch'](handleError(_0x85bec6,null));};exports[_0x682b('0x43')]=function(_0xddbb59,_0x4f4542){var _0xd330c3={'raw':!![],'where':{'id':_0xddbb59[_0x682b('0x44')]['id']}},_0x7130e={};_0x7130e[_0x682b('0x32')]=_['keys'](db[_0x682b('0x2e')][_0x682b('0x45')]);_0x7130e[_0x682b('0x33')]=_[_0x682b('0x34')](_0xddbb59[_0x682b('0x33')]);_0x7130e['filters']=_[_0x682b('0x36')](_0x7130e['model'],_0x7130e[_0x682b('0x33')]);_0xd330c3[_0x682b('0x37')]=_[_0x682b('0x36')](_0x7130e[_0x682b('0x32')],qs[_0x682b('0x38')](_0xddbb59['query'][_0x682b('0x38')]));_0xd330c3[_0x682b('0x37')]=_0xd330c3[_0x682b('0x37')][_0x682b('0x39')]?_0xd330c3[_0x682b('0x37')]:_0x7130e['model'];if(_0xddbb59[_0x682b('0x33')][_0x682b('0x46')]){_0xd330c3[_0x682b('0x47')]=[{'all':!![]}];}_0xd330c3=_[_0x682b('0x40')]({},_0xd330c3,_0xddbb59['options']);return db[_0x682b('0x2e')]['find'](_0xd330c3)[_0x682b('0x27')](handleEntityNotFound(_0x4f4542,null))[_0x682b('0x27')](respondWithResult(_0x4f4542,null))[_0x682b('0x48')](handleError(_0x4f4542,null));};exports[_0x682b('0x49')]=function(_0xe3268e,_0x3efaa2){return db[_0x682b('0x2e')][_0x682b('0x49')](_0xe3268e['body'],{})[_0x682b('0x27')](respondWithResult(_0x3efaa2,0xc9))[_0x682b('0x48')](handleError(_0x3efaa2,null));};exports['update']=function(_0x44dbdf,_0x3c6504){if(_0x44dbdf[_0x682b('0x4a')]['id']){delete _0x44dbdf[_0x682b('0x4a')]['id'];}return db['SalesforceField'][_0x682b('0x4b')]({'where':{'id':_0x44dbdf['params']['id']}})[_0x682b('0x27')](handleEntityNotFound(_0x3c6504,null))['then'](saveUpdates(_0x44dbdf[_0x682b('0x4a')],null))[_0x682b('0x27')](respondWithResult(_0x3c6504,null))[_0x682b('0x48')](handleError(_0x3c6504,null));};exports[_0x682b('0x4c')]=function(_0x978622,_0x3dfd26){return db['SalesforceField'][_0x682b('0x4b')]({'where':{'id':_0x978622[_0x682b('0x44')]['id']}})[_0x682b('0x27')](handleEntityNotFound(_0x3dfd26,null))[_0x682b('0x27')](removeEntity(_0x3dfd26,null))[_0x682b('0x48')](handleError(_0x3dfd26,null));}; \ No newline at end of file +var _0x102b=['destroy','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','update','then'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x102b,0x146));var _0xb102=function(_0x4b817c,_0x19dbec){_0x4b817c=_0x4b817c-0x0;var _0x4a2c7d=_0x102b[_0x4b817c];return _0x4a2c7d;};'use strict';var emlformat=require(_0xb102('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb102('0x1'));var jsonpatch=require(_0xb102('0x2'));var rp=require(_0xb102('0x3'));var moment=require(_0xb102('0x4'));var BPromise=require(_0xb102('0x5'));var Mustache=require('mustache');var util=require(_0xb102('0x6'));var path=require('path');var sox=require(_0xb102('0x7'));var csv=require(_0xb102('0x8'));var ejs=require(_0xb102('0x9'));var fs=require('fs');var fs_extra=require(_0xb102('0xa'));var _=require(_0xb102('0xb'));var squel=require(_0xb102('0xc'));var crypto=require('crypto');var jsforce=require(_0xb102('0xd'));var deskjs=require(_0xb102('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb102('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb102('0x10'));var hardwareService=require(_0xb102('0x11'));var logger=require(_0xb102('0x12'))(_0xb102('0x13'));var utils=require(_0xb102('0x14'));var config=require(_0xb102('0x15'));var licenseUtil=require(_0xb102('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5371c5,_0x202c09){_0x202c09=_0x202c09||0xcc;return function(_0x5312a6){if(_0x5312a6){return _0x5371c5[_0xb102('0x17')](_0x202c09);}return _0x5371c5[_0xb102('0x18')](_0x202c09)['end']();};}function respondWithResult(_0x3263ef,_0x223c14){_0x223c14=_0x223c14||0xc8;return function(_0x340351){if(_0x340351){return _0x3263ef[_0xb102('0x18')](_0x223c14)['json'](_0x340351);}};}function respondWithFilteredResult(_0xf4f58d,_0x4a13ce){return function(_0x4ef15c){if(_0x4ef15c){var _0x528895=typeof _0x4a13ce[_0xb102('0x19')]==='undefined'&&typeof _0x4a13ce[_0xb102('0x1a')]===_0xb102('0x1b');var _0x37ff48=_0x4ef15c['count'];var _0xfb192d=_0x528895?0x0:_0x4a13ce[_0xb102('0x19')];var _0x29b25d=_0x528895?_0x4ef15c[_0xb102('0x1c')]:_0x4a13ce[_0xb102('0x19')]+_0x4a13ce['limit'];var _0x420533;if(_0x29b25d>=_0x37ff48){_0x29b25d=_0x37ff48;_0x420533=0xc8;}else{_0x420533=0xce;}_0xf4f58d[_0xb102('0x18')](_0x420533);return _0xf4f58d[_0xb102('0x1d')](_0xb102('0x1e'),_0xfb192d+'-'+_0x29b25d+'/'+_0x37ff48)['json'](_0x4ef15c);}return null;};}function patchUpdates(_0x5db0f5){return function(_0x5cb969){try{jsonpatch['apply'](_0x5cb969,_0x5db0f5,!![]);}catch(_0x184b43){return BPromise[_0xb102('0x1f')](_0x184b43);}return _0x5cb969['save']();};}function saveUpdates(_0x3db12d,_0x581174){return function(_0x4ae4a6){if(_0x4ae4a6){return _0x4ae4a6[_0xb102('0x20')](_0x3db12d)[_0xb102('0x21')](function(_0x28c08a){return _0x28c08a;});}return null;};}function removeEntity(_0x5af043,_0x1beb0f){return function(_0x3caffe){if(_0x3caffe){return _0x3caffe[_0xb102('0x22')]()[_0xb102('0x21')](function(){_0x5af043[_0xb102('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10bfc3,_0x3e49c0){return function(_0x7df51f){if(!_0x7df51f){_0x10bfc3[_0xb102('0x17')](0x194);}return _0x7df51f;};}function handleError(_0x3a4198,_0xe5897c){_0xe5897c=_0xe5897c||0x1f4;return function(_0x227caf){logger['error'](_0x227caf[_0xb102('0x23')]);if(_0x227caf[_0xb102('0x24')]){delete _0x227caf[_0xb102('0x24')];}_0x3a4198['status'](_0xe5897c)[_0xb102('0x25')](_0x227caf);};}exports[_0xb102('0x26')]=function(_0x38c60f,_0x5dd50e){var _0x2f96e0={},_0x468dbc={},_0x3f8284={'count':0x0,'rows':[]};var _0x1c44a5=_['map'](db[_0xb102('0x27')][_0xb102('0x28')],function(_0x24a794){return{'name':_0x24a794[_0xb102('0x29')],'type':_0x24a794[_0xb102('0x2a')][_0xb102('0x2b')]};});_0x468dbc[_0xb102('0x2c')]=_[_0xb102('0x2d')](_0x1c44a5,_0xb102('0x24'));_0x468dbc[_0xb102('0x2e')]=_[_0xb102('0x2f')](_0x38c60f[_0xb102('0x2e')]);_0x468dbc[_0xb102('0x30')]=_[_0xb102('0x31')](_0x468dbc['model'],_0x468dbc[_0xb102('0x2e')]);_0x2f96e0[_0xb102('0x32')]=_['intersection'](_0x468dbc[_0xb102('0x2c')],qs[_0xb102('0x33')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x33')]));_0x2f96e0[_0xb102('0x32')]=_0x2f96e0[_0xb102('0x32')]['length']?_0x2f96e0['attributes']:_0x468dbc[_0xb102('0x2c')];if(!_0x38c60f[_0xb102('0x2e')][_0xb102('0x34')](_0xb102('0x35'))){_0x2f96e0[_0xb102('0x1a')]=qs[_0xb102('0x1a')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x1a')]);_0x2f96e0[_0xb102('0x19')]=qs[_0xb102('0x19')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x19')]);}_0x2f96e0[_0xb102('0x36')]=qs[_0xb102('0x37')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x37')]);_0x2f96e0[_0xb102('0x38')]=qs[_0xb102('0x30')](_[_0xb102('0x39')](_0x38c60f['query'],_0x468dbc[_0xb102('0x30')]),_0x1c44a5);if(_0x38c60f[_0xb102('0x2e')][_0xb102('0x3a')]){_0x2f96e0['where']=_[_0xb102('0x3b')](_0x2f96e0[_0xb102('0x38')],{'$or':_[_0xb102('0x2d')](_0x1c44a5,function(_0x599c58){if(_0x599c58[_0xb102('0x2a')]!==_0xb102('0x3c')){var _0x8990a1={};_0x8990a1[_0x599c58[_0xb102('0x24')]]={'$like':'%'+_0x38c60f[_0xb102('0x2e')][_0xb102('0x3a')]+'%'};return _0x8990a1;}})});}_0x2f96e0=_['merge']({},_0x2f96e0,_0x38c60f[_0xb102('0x3d')]);var _0x5190a0={'where':_0x2f96e0[_0xb102('0x38')]};return db['SalesforceField'][_0xb102('0x1c')](_0x5190a0)[_0xb102('0x21')](function(_0x2ef50e){_0x3f8284['count']=_0x2ef50e;if(_0x38c60f[_0xb102('0x2e')][_0xb102('0x3e')]){_0x2f96e0['include']=[{'all':!![]}];}return db[_0xb102('0x27')][_0xb102('0x3f')](_0x2f96e0);})['then'](function(_0x5dc920){_0x3f8284['rows']=_0x5dc920;return _0x3f8284;})[_0xb102('0x21')](respondWithFilteredResult(_0x5dd50e,_0x2f96e0))['catch'](handleError(_0x5dd50e,null));};exports[_0xb102('0x40')]=function(_0xa00e5,_0x1a0b59){var _0x34c20d={'raw':!![],'where':{'id':_0xa00e5[_0xb102('0x41')]['id']}},_0x23553e={};_0x23553e[_0xb102('0x2c')]=_[_0xb102('0x2f')](db[_0xb102('0x27')][_0xb102('0x28')]);_0x23553e[_0xb102('0x2e')]=_['keys'](_0xa00e5[_0xb102('0x2e')]);_0x23553e['filters']=_['intersection'](_0x23553e[_0xb102('0x2c')],_0x23553e[_0xb102('0x2e')]);_0x34c20d[_0xb102('0x32')]=_['intersection'](_0x23553e[_0xb102('0x2c')],qs[_0xb102('0x33')](_0xa00e5[_0xb102('0x2e')]['fields']));_0x34c20d['attributes']=_0x34c20d[_0xb102('0x32')][_0xb102('0x42')]?_0x34c20d[_0xb102('0x32')]:_0x23553e[_0xb102('0x2c')];if(_0xa00e5[_0xb102('0x2e')][_0xb102('0x3e')]){_0x34c20d[_0xb102('0x43')]=[{'all':!![]}];}_0x34c20d=_['merge']({},_0x34c20d,_0xa00e5['options']);return db[_0xb102('0x27')][_0xb102('0x44')](_0x34c20d)[_0xb102('0x21')](handleEntityNotFound(_0x1a0b59,null))[_0xb102('0x21')](respondWithResult(_0x1a0b59,null))[_0xb102('0x45')](handleError(_0x1a0b59,null));};exports[_0xb102('0x46')]=function(_0x412345,_0x4e9f2c){return db[_0xb102('0x27')][_0xb102('0x46')](_0x412345[_0xb102('0x47')],{})[_0xb102('0x21')](respondWithResult(_0x4e9f2c,0xc9))[_0xb102('0x45')](handleError(_0x4e9f2c,null));};exports[_0xb102('0x20')]=function(_0x1ce7c5,_0x54bc0f){if(_0x1ce7c5[_0xb102('0x47')]['id']){delete _0x1ce7c5[_0xb102('0x47')]['id'];}return db[_0xb102('0x27')][_0xb102('0x44')]({'where':{'id':_0x1ce7c5['params']['id']}})[_0xb102('0x21')](handleEntityNotFound(_0x54bc0f,null))[_0xb102('0x21')](saveUpdates(_0x1ce7c5[_0xb102('0x47')],null))[_0xb102('0x21')](respondWithResult(_0x54bc0f,null))[_0xb102('0x45')](handleError(_0x54bc0f,null));};exports[_0xb102('0x22')]=function(_0xb9c2f2,_0x45dd2f){return db[_0xb102('0x27')]['find']({'where':{'id':_0xb9c2f2['params']['id']}})['then'](handleEntityNotFound(_0x45dd2f,null))[_0xb102('0x21')](removeEntity(_0x45dd2f,null))['catch'](handleError(_0x45dd2f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index a3a2ffb..b64bc11 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 _0x8004=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','util','../../config/logger'];(function(_0x54378a,_0x539a4f){var _0x814ce6=function(_0x1788d){while(--_0x1788d){_0x54378a['push'](_0x54378a['shift']());}};_0x814ce6(++_0x539a4f);}(_0x8004,0xc0));var _0x4800=function(_0x58f2f7,_0x4e250c){_0x58f2f7=_0x58f2f7-0x0;var _0x22dacb=_0x8004[_0x58f2f7];return _0x22dacb;};'use strict';var _=require(_0x4800('0x0'));var util=require(_0x4800('0x1'));var logger=require(_0x4800('0x2'))(_0x4800('0x3'));var moment=require(_0x4800('0x4'));var BPromise=require(_0x4800('0x5'));var rp=require(_0x4800('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4800('0x7'));var config=require(_0x4800('0x8'));var attributes=require(_0x4800('0x9'));module[_0x4800('0xa')]=function(_0x37648b,_0xc0c65c){return _0x37648b[_0x4800('0xb')](_0x4800('0xc'),attributes,{'tableName':_0x4800('0xd'),'paranoid':![],'indexes':[{'name':_0x4800('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81a7=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x51a4cf,_0x538974){var _0x4e4746=function(_0x39b5bc){while(--_0x39b5bc){_0x51a4cf['push'](_0x51a4cf['shift']());}};_0x4e4746(++_0x538974);}(_0x81a7,0xb9));var _0x781a=function(_0x4cd309,_0x24d714){_0x4cd309=_0x4cd309-0x0;var _0x3e871e=_0x81a7[_0x4cd309];return _0x3e871e;};'use strict';var _=require(_0x781a('0x0'));var util=require(_0x781a('0x1'));var logger=require('../../config/logger')(_0x781a('0x2'));var moment=require(_0x781a('0x3'));var BPromise=require(_0x781a('0x4'));var rp=require(_0x781a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781a('0x6'));var config=require(_0x781a('0x7'));var attributes=require(_0x781a('0x8'));module[_0x781a('0x9')]=function(_0x479c13,_0x5c0a2f){return _0x479c13[_0x781a('0xa')](_0x781a('0xb'),attributes,{'tableName':_0x781a('0xc'),'paranoid':![],'indexes':[{'name':_0x781a('0xd'),'fields':['idField',_0x781a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 0f7558b..30e9c54 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 _0x954e=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3cb9b2,_0x35468b){var _0x5001f1=function(_0xd8498c){while(--_0xd8498c){_0x3cb9b2['push'](_0x3cb9b2['shift']());}};_0x5001f1(++_0x35468b);}(_0x954e,0x1cf));var _0xe954=function(_0x5e836a,_0x156644){_0x5e836a=_0x5e836a-0x0;var _0x484835=_0x954e[_0x5e836a];return _0x484835;};'use strict';var _=require(_0xe954('0x0'));var util=require(_0xe954('0x1'));var moment=require(_0xe954('0x2'));var BPromise=require('bluebird');var rs=require(_0xe954('0x3'));var fs=require('fs');var Redis=require(_0xe954('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe954('0x5'));var logger=require(_0xe954('0x6'))(_0xe954('0x7'));var config=require(_0xe954('0x8'));var jayson=require(_0xe954('0x9'));var client=jayson[_0xe954('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1facf4,_0xa62967,_0x5cccba){return new BPromise(function(_0x227ee8,_0x5a4aa3){return client[_0xe954('0xb')](_0x1facf4,_0x5cccba)[_0xe954('0xc')](function(_0x440794){logger[_0xe954('0xd')](_0xe954('0xe'),_0xa62967,_0xe954('0xf'));logger[_0xe954('0x10')](_0xe954('0x11'),_0xa62967,_0xe954('0xf'),JSON['stringify'](_0x440794));if(_0x440794['error']){if(_0x440794[_0xe954('0x12')]['code']===0x1f4){logger[_0xe954('0x12')]('SalesforceField,\x20%s,\x20%s',_0xa62967,_0x440794[_0xe954('0x12')][_0xe954('0x13')]);return _0x5a4aa3(_0x440794[_0xe954('0x12')][_0xe954('0x13')]);}logger['error'](_0xe954('0xe'),_0xa62967,_0x440794['error'][_0xe954('0x13')]);return _0x227ee8(_0x440794[_0xe954('0x12')][_0xe954('0x13')]);}else{logger[_0xe954('0xd')](_0xe954('0xe'),_0xa62967,_0xe954('0xf'));_0x227ee8(_0x440794[_0xe954('0x14')][_0xe954('0x13')]);}})[_0xe954('0x15')](function(_0x3f535c){logger[_0xe954('0x12')]('SalesforceField,\x20%s,\x20%s',_0xa62967,_0x3f535c);_0x5a4aa3(_0x3f535c);});});} \ No newline at end of file +var _0x0ad1=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0xe8a45d,_0x3d0c26){var _0x419b15=function(_0x2cbd24){while(--_0x2cbd24){_0xe8a45d['push'](_0xe8a45d['shift']());}};_0x419b15(++_0x3d0c26);}(_0x0ad1,0x173));var _0x10ad=function(_0x9039e6,_0x939aaf){_0x9039e6=_0x9039e6-0x0;var _0x777cd7=_0x0ad1[_0x9039e6];return _0x777cd7;};'use strict';var _=require(_0x10ad('0x0'));var util=require(_0x10ad('0x1'));var moment=require(_0x10ad('0x2'));var BPromise=require(_0x10ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10ad('0x4'));var db=require(_0x10ad('0x5'))['db'];var utils=require(_0x10ad('0x6'));var logger=require(_0x10ad('0x7'))(_0x10ad('0x8'));var config=require(_0x10ad('0x9'));var jayson=require(_0x10ad('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2159c9,_0x424423,_0x487fdf){return new BPromise(function(_0x191652,_0x1271b0){return client[_0x10ad('0xb')](_0x2159c9,_0x487fdf)[_0x10ad('0xc')](function(_0x1e3456){logger[_0x10ad('0xd')](_0x10ad('0xe'),_0x424423,_0x10ad('0xf'));logger['debug'](_0x10ad('0x10'),_0x424423,_0x10ad('0xf'),JSON[_0x10ad('0x11')](_0x1e3456));if(_0x1e3456[_0x10ad('0x12')]){if(_0x1e3456[_0x10ad('0x12')][_0x10ad('0x13')]===0x1f4){logger[_0x10ad('0x12')]('SalesforceField,\x20%s,\x20%s',_0x424423,_0x1e3456[_0x10ad('0x12')]['message']);return _0x1271b0(_0x1e3456[_0x10ad('0x12')][_0x10ad('0x14')]);}logger[_0x10ad('0x12')]('SalesforceField,\x20%s,\x20%s',_0x424423,_0x1e3456[_0x10ad('0x12')]['message']);return _0x191652(_0x1e3456[_0x10ad('0x12')][_0x10ad('0x14')]);}else{logger[_0x10ad('0xd')](_0x10ad('0xe'),_0x424423,_0x10ad('0xf'));_0x191652(_0x1e3456[_0x10ad('0x15')][_0x10ad('0x14')]);}})['catch'](function(_0x2b7748){logger[_0x10ad('0x12')](_0x10ad('0xe'),_0x424423,_0x2b7748);_0x1271b0(_0x2b7748);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 53db67f..9e3389f 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 _0x8985=['isAuthenticated','index','get','/:id/configurations','getConfigurations','create','post','put','/:id','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x13c737,_0xc1ab62){var _0x34e425=function(_0x3e2ae3){while(--_0x3e2ae3){_0x13c737['push'](_0x13c737['shift']());}};_0x34e425(++_0xc1ab62);}(_0x8985,0x198));var _0x5898=function(_0x1c9ae9,_0x1b37ef){_0x1c9ae9=_0x1c9ae9-0x0;var _0x213ec1=_0x8985[_0x1c9ae9];return _0x213ec1;};'use strict';var multer=require(_0x5898('0x0'));var util=require(_0x5898('0x1'));var path=require(_0x5898('0x2'));var timeout=require('connect-timeout');var express=require(_0x5898('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5898('0x4'));var interaction=require(_0x5898('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x5898('0x6')](),controller[_0x5898('0x7')]);router[_0x5898('0x8')]('/:id',auth[_0x5898('0x6')](),controller['show']);router[_0x5898('0x8')](_0x5898('0x9'),auth['isAuthenticated'](),controller[_0x5898('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x5898('0xb')]);router[_0x5898('0xc')](_0x5898('0x9'),auth[_0x5898('0x6')](),controller['addConfiguration']);router[_0x5898('0xd')](_0x5898('0xe'),auth[_0x5898('0x6')](),controller[_0x5898('0xf')]);router[_0x5898('0x10')]('/:id',auth[_0x5898('0x6')](),controller[_0x5898('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4b3e=['path','connect-timeout','fs-extra','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','multer','util'];(function(_0x5d754d,_0x5999af){var _0x1d827c=function(_0x366bde){while(--_0x366bde){_0x5d754d['push'](_0x5d754d['shift']());}};_0x1d827c(++_0x5999af);}(_0x4b3e,0x1cc));var _0xe4b3=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x4b3e[_0x33593e];return _0x53db1a;};'use strict';var multer=require(_0xe4b3('0x0'));var util=require(_0xe4b3('0x1'));var path=require(_0xe4b3('0x2'));var timeout=require(_0xe4b3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe4b3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe4b3('0x5'));var controller=require(_0xe4b3('0x6'));router[_0xe4b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4b3('0x8')]);router[_0xe4b3('0x7')](_0xe4b3('0x9'),auth[_0xe4b3('0xa')](),controller['show']);router[_0xe4b3('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe4b3('0xb')]);router[_0xe4b3('0x7')](_0xe4b3('0xc'),auth[_0xe4b3('0xa')](),controller[_0xe4b3('0xd')]);router[_0xe4b3('0xe')]('/',auth[_0xe4b3('0xa')](),controller[_0xe4b3('0xf')]);router[_0xe4b3('0xe')](_0xe4b3('0x10'),auth[_0xe4b3('0xa')](),controller[_0xe4b3('0x11')]);router['put'](_0xe4b3('0x9'),auth[_0xe4b3('0xa')](),controller['update']);router[_0xe4b3('0x12')](_0xe4b3('0x9'),auth[_0xe4b3('0xa')](),controller[_0xe4b3('0x13')]);module[_0xe4b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 08ee822..d660de2 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 _0x60a5=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3dc00a,_0x144a1b){var _0x2aa3a9=function(_0x3f116d){while(--_0x3f116d){_0x3dc00a['push'](_0x3dc00a['shift']());}};_0x2aa3a9(++_0x144a1b);}(_0x60a5,0x1c0));var _0x560a=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x60a5[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x560a('0x0'));module[_0x560a('0x1')]={'name':{'type':Sequelize[_0x560a('0x2')]},'description':{'type':Sequelize[_0x560a('0x2')]},'username':{'type':Sequelize[_0x560a('0x2')],'unique':_0x560a('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x560a('0x2')],'unique':_0x560a('0x4')},'serverUrl':{'type':Sequelize[_0x560a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3b37=['STRING','remoteUri','sequelize','exports'];(function(_0x463155,_0x52b6ff){var _0x44dbe8=function(_0x14dc3a){while(--_0x14dc3a){_0x463155['push'](_0x463155['shift']());}};_0x44dbe8(++_0x52b6ff);}(_0x3b37,0x9e));var _0x73b3=function(_0x1d5b08,_0x4abfe9){_0x1d5b08=_0x1d5b08-0x0;var _0x17a0c7=_0x3b37[_0x1d5b08];return _0x17a0c7;};'use strict';var Sequelize=require(_0x73b3('0x0'));module[_0x73b3('0x1')]={'name':{'type':Sequelize[_0x73b3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x73b3('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x73b3('0x2')]},'email':{'type':Sequelize[_0x73b3('0x2')]},'remoteUri':{'type':Sequelize[_0x73b3('0x2')],'unique':_0x73b3('0x3')},'serverUrl':{'type':Sequelize[_0x73b3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1197349..5bc2dbf 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 _0xc199=['label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','request-promise','moment','mustache','path','ejs','fs-extra','lodash','crypto','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','offset','limit','count','json','save','update','then','destroy','end','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','body','params','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','parent','watch_list','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','knowledge','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','location','category','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType'];(function(_0x771b6f,_0x149e60){var _0x4a2b8f=function(_0x9ffaab){while(--_0x9ffaab){_0x771b6f['push'](_0x771b6f['shift']());}};_0x4a2b8f(++_0x149e60);}(_0xc199,0x175));var _0x9c19=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xc199[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require(_0x9c19('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c19('0x1'));var moment=require(_0x9c19('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c19('0x3'));var util=require('util');var path=require(_0x9c19('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9c19('0x5'));var fs=require('fs');var fs_extra=require(_0x9c19('0x6'));var _=require(_0x9c19('0x7'));var squel=require('squel');var crypto=require(_0x9c19('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9c19('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9c19('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c19('0xb'));var qs=require(_0x9c19('0xc'));var as=require(_0x9c19('0xd'));var hardwareService=require(_0x9c19('0xe'));var logger=require(_0x9c19('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x9c19('0x10'));var licenseUtil=require(_0x9c19('0x11'));var db=require(_0x9c19('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a90f8,_0x363b8a){_0x363b8a=_0x363b8a||0xcc;return function(_0x45cff8){if(_0x45cff8){return _0x1a90f8[_0x9c19('0x13')](_0x363b8a);}return _0x1a90f8[_0x9c19('0x14')](_0x363b8a)['end']();};}function respondWithResult(_0x580b4c,_0x411e93){_0x411e93=_0x411e93||0xc8;return function(_0x55aff3){if(_0x55aff3){return _0x580b4c[_0x9c19('0x14')](_0x411e93)['json'](_0x55aff3);}};}function respondWithFilteredResult(_0x57c668,_0x51be6b){return function(_0x31ca90){if(_0x31ca90){var _0x538668=typeof _0x51be6b[_0x9c19('0x15')]==='undefined'&&typeof _0x51be6b[_0x9c19('0x16')]==='undefined';var _0x280033=_0x31ca90[_0x9c19('0x17')];var _0x409eb9=_0x538668?0x0:_0x51be6b[_0x9c19('0x15')];var _0x5550fa=_0x538668?_0x31ca90[_0x9c19('0x17')]:_0x51be6b[_0x9c19('0x15')]+_0x51be6b[_0x9c19('0x16')];var _0x2c9bb7;if(_0x5550fa>=_0x280033){_0x5550fa=_0x280033;_0x2c9bb7=0xc8;}else{_0x2c9bb7=0xce;}_0x57c668[_0x9c19('0x14')](_0x2c9bb7);return _0x57c668['set']('Content-Range',_0x409eb9+'-'+_0x5550fa+'/'+_0x280033)[_0x9c19('0x18')](_0x31ca90);}return null;};}function patchUpdates(_0x3d2fb4){return function(_0x4a3565){try{jsonpatch['apply'](_0x4a3565,_0x3d2fb4,!![]);}catch(_0x54a3b1){return BPromise['reject'](_0x54a3b1);}return _0x4a3565[_0x9c19('0x19')]();};}function saveUpdates(_0x426bf7,_0x2395e5){return function(_0x8eb0a2){if(_0x8eb0a2){return _0x8eb0a2[_0x9c19('0x1a')](_0x426bf7)[_0x9c19('0x1b')](function(_0x50f126){return _0x50f126;});}return null;};}function removeEntity(_0x1c3bb7,_0x2d9e25){return function(_0x2acaae){if(_0x2acaae){return _0x2acaae[_0x9c19('0x1c')]()[_0x9c19('0x1b')](function(){_0x1c3bb7[_0x9c19('0x14')](0xcc)[_0x9c19('0x1d')]();});}};}function handleEntityNotFound(_0x4b5a93,_0x2f5d4b){return function(_0x264f25){if(!_0x264f25){_0x4b5a93['sendStatus'](0x194);}return _0x264f25;};}function handleError(_0x4328fe,_0xe11992){_0xe11992=_0xe11992||0x1f4;return function(_0x31c953){logger[_0x9c19('0x1e')](_0x31c953[_0x9c19('0x1f')]);if(_0x31c953[_0x9c19('0x20')]){delete _0x31c953[_0x9c19('0x20')];}_0x4328fe['status'](_0xe11992)[_0x9c19('0x21')](_0x31c953);};}exports[_0x9c19('0x22')]=function(_0x24ff8d,_0x51f960){var _0x154cf4={},_0x1aa65f={},_0x2d5b6e={'count':0x0,'rows':[]};var _0x29c8b3=_[_0x9c19('0x23')](db[_0x9c19('0x24')]['rawAttributes'],function(_0x2cce76){return{'name':_0x2cce76[_0x9c19('0x25')],'type':_0x2cce76[_0x9c19('0x26')]['key']};});_0x1aa65f[_0x9c19('0x27')]=_[_0x9c19('0x23')](_0x29c8b3,_0x9c19('0x20'));_0x1aa65f[_0x9c19('0x28')]=_[_0x9c19('0x29')](_0x24ff8d[_0x9c19('0x28')]);_0x1aa65f[_0x9c19('0x2a')]=_[_0x9c19('0x2b')](_0x1aa65f['model'],_0x1aa65f['query']);_0x154cf4[_0x9c19('0x2c')]=_[_0x9c19('0x2b')](_0x1aa65f['model'],qs['fields'](_0x24ff8d[_0x9c19('0x28')]['fields']));_0x154cf4['attributes']=_0x154cf4[_0x9c19('0x2c')][_0x9c19('0x2d')]?_0x154cf4['attributes']:_0x1aa65f[_0x9c19('0x27')];if(!_0x24ff8d[_0x9c19('0x28')][_0x9c19('0x2e')](_0x9c19('0x2f'))){_0x154cf4[_0x9c19('0x16')]=qs[_0x9c19('0x16')](_0x24ff8d['query'][_0x9c19('0x16')]);_0x154cf4[_0x9c19('0x15')]=qs['offset'](_0x24ff8d[_0x9c19('0x28')]['offset']);}_0x154cf4[_0x9c19('0x30')]=qs['sort'](_0x24ff8d[_0x9c19('0x28')][_0x9c19('0x31')]);_0x154cf4[_0x9c19('0x32')]=qs[_0x9c19('0x2a')](_['pick'](_0x24ff8d[_0x9c19('0x28')],_0x1aa65f[_0x9c19('0x2a')]),_0x29c8b3);if(_0x24ff8d[_0x9c19('0x28')]['filter']){_0x154cf4[_0x9c19('0x32')]=_[_0x9c19('0x33')](_0x154cf4[_0x9c19('0x32')],{'$or':_[_0x9c19('0x23')](_0x29c8b3,function(_0x370635){if(_0x370635['type']!=='VIRTUAL'){var _0x48a728={};_0x48a728[_0x370635[_0x9c19('0x20')]]={'$like':'%'+_0x24ff8d['query'][_0x9c19('0x34')]+'%'};return _0x48a728;}})});}_0x154cf4=_[_0x9c19('0x33')]({},_0x154cf4,_0x24ff8d[_0x9c19('0x35')]);var _0x286e42={'where':_0x154cf4[_0x9c19('0x32')]};return db[_0x9c19('0x24')][_0x9c19('0x17')](_0x286e42)[_0x9c19('0x1b')](function(_0xa82a13){_0x2d5b6e[_0x9c19('0x17')]=_0xa82a13;if(_0x24ff8d[_0x9c19('0x28')][_0x9c19('0x36')]){_0x154cf4[_0x9c19('0x37')]=[{'all':!![]}];}return db[_0x9c19('0x24')][_0x9c19('0x38')](_0x154cf4);})['then'](function(_0x4718ab){_0x2d5b6e[_0x9c19('0x39')]=_0x4718ab;return _0x2d5b6e;})[_0x9c19('0x1b')](respondWithFilteredResult(_0x51f960,_0x154cf4))[_0x9c19('0x3a')](handleError(_0x51f960,null));};exports[_0x9c19('0x3b')]=function(_0x335a4d,_0x42e269){var _0x4f1173={'raw':![],'where':{'id':_0x335a4d['params']['id']}},_0x5cb494={};_0x5cb494[_0x9c19('0x27')]=_['keys'](db[_0x9c19('0x24')][_0x9c19('0x3c')]);_0x5cb494['query']=_[_0x9c19('0x29')](_0x335a4d[_0x9c19('0x28')]);_0x5cb494['filters']=_['intersection'](_0x5cb494[_0x9c19('0x27')],_0x5cb494['query']);_0x4f1173[_0x9c19('0x2c')]=_[_0x9c19('0x2b')](_0x5cb494[_0x9c19('0x27')],qs[_0x9c19('0x3d')](_0x335a4d['query']['fields']));_0x4f1173[_0x9c19('0x2c')]=_0x4f1173[_0x9c19('0x2c')]['length']?_0x4f1173[_0x9c19('0x2c')]:_0x5cb494[_0x9c19('0x27')];if(_0x335a4d[_0x9c19('0x28')][_0x9c19('0x36')]){_0x4f1173[_0x9c19('0x37')]=[{'all':!![]}];}_0x4f1173=_['merge']({},_0x4f1173,_0x335a4d[_0x9c19('0x35')]);return db[_0x9c19('0x24')][_0x9c19('0x3e')](_0x4f1173)[_0x9c19('0x1b')](handleEntityNotFound(_0x42e269,null))[_0x9c19('0x1b')](respondWithResult(_0x42e269,null))[_0x9c19('0x3a')](handleError(_0x42e269,null));};exports[_0x9c19('0x3f')]=function(_0x4cb4e2,_0x34890f){return db[_0x9c19('0x24')][_0x9c19('0x3f')](_0x4cb4e2[_0x9c19('0x40')],{})[_0x9c19('0x1b')](respondWithResult(_0x34890f,0xc9))[_0x9c19('0x3a')](handleError(_0x34890f,null));};exports[_0x9c19('0x1a')]=function(_0x5d580f,_0x376c69){if(_0x5d580f[_0x9c19('0x40')]['id']){delete _0x5d580f[_0x9c19('0x40')]['id'];}return db[_0x9c19('0x24')][_0x9c19('0x3e')]({'where':{'id':_0x5d580f[_0x9c19('0x41')]['id']}})[_0x9c19('0x1b')](handleEntityNotFound(_0x376c69,null))[_0x9c19('0x1b')](saveUpdates(_0x5d580f[_0x9c19('0x40')],null))[_0x9c19('0x1b')](respondWithResult(_0x376c69,null))['catch'](handleError(_0x376c69,null));};exports[_0x9c19('0x1c')]=function(_0x3a85d6,_0x10b209){return db[_0x9c19('0x24')][_0x9c19('0x3e')]({'where':{'id':_0x3a85d6[_0x9c19('0x41')]['id']}})['then'](handleEntityNotFound(_0x10b209,null))['then'](removeEntity(_0x10b209,null))[_0x9c19('0x3a')](handleError(_0x10b209,null));};exports[_0x9c19('0x42')]=function(_0x55778f,_0x23acf8,_0x5cae3){var _0x467027={};var _0x70b32c={};var _0x56e204;var _0x570e0b;return db[_0x9c19('0x24')]['findOne']({'where':{'id':_0x55778f[_0x9c19('0x41')]['id']}})['then'](handleEntityNotFound(_0x23acf8,null))[_0x9c19('0x1b')](function(_0x202ff4){if(_0x202ff4){_0x56e204=_0x202ff4;_0x70b32c[_0x9c19('0x27')]=_['keys'](db['ServicenowConfiguration'][_0x9c19('0x3c')]);_0x70b32c[_0x9c19('0x28')]=_['keys'](_0x55778f['query']);_0x70b32c[_0x9c19('0x2a')]=_[_0x9c19('0x2b')](_0x70b32c[_0x9c19('0x27')],_0x70b32c['query']);_0x467027['attributes']=_['intersection'](_0x70b32c[_0x9c19('0x27')],qs['fields'](_0x55778f[_0x9c19('0x28')][_0x9c19('0x3d')]));_0x467027[_0x9c19('0x2c')]=_0x467027[_0x9c19('0x2c')][_0x9c19('0x2d')]?_0x467027[_0x9c19('0x2c')]:_0x70b32c['model'];_0x467027[_0x9c19('0x30')]=qs[_0x9c19('0x31')](_0x55778f[_0x9c19('0x28')][_0x9c19('0x31')]);_0x467027[_0x9c19('0x32')]=qs[_0x9c19('0x2a')](_['pick'](_0x55778f['query'],_0x70b32c[_0x9c19('0x2a')]));if(_0x55778f[_0x9c19('0x28')][_0x9c19('0x34')]){_0x467027['where']=_['merge'](_0x467027[_0x9c19('0x32')],{'$or':_[_0x9c19('0x23')](_0x467027[_0x9c19('0x2c')],function(_0xb491de){var _0x5ec0e2={};_0x5ec0e2[_0xb491de]={'$like':'%'+_0x55778f[_0x9c19('0x28')]['filter']+'%'};return _0x5ec0e2;})});}_0x467027=_['merge']({},_0x467027,_0x55778f[_0x9c19('0x35')]);return _0x56e204['getConfigurations'](_0x467027);}})[_0x9c19('0x1b')](function(_0x5d29e1){if(_0x5d29e1){_0x570e0b=_0x5d29e1[_0x9c19('0x2d')];if(!_0x55778f[_0x9c19('0x28')]['hasOwnProperty'](_0x9c19('0x2f'))){_0x467027[_0x9c19('0x16')]=qs[_0x9c19('0x16')](_0x55778f[_0x9c19('0x28')][_0x9c19('0x16')]);_0x467027[_0x9c19('0x15')]=qs[_0x9c19('0x15')](_0x55778f[_0x9c19('0x28')]['offset']);}return _0x56e204[_0x9c19('0x42')](_0x467027);}})['then'](function(_0x411b09){if(_0x411b09){return _0x411b09?{'count':_0x570e0b,'rows':_0x411b09}:null;}})['then'](respondWithResult(_0x23acf8,null))[_0x9c19('0x3a')](handleError(_0x23acf8,null));};exports[_0x9c19('0x43')]=function(_0x308222,_0x4bc374,_0x3f48bc){if(_0x308222[_0x9c19('0x40')]['id']){delete _0x308222[_0x9c19('0x40')]['id'];}return db[_0x9c19('0x24')][_0x9c19('0x44')]({'where':{'id':_0x308222[_0x9c19('0x41')]['id']}})[_0x9c19('0x1b')](handleEntityNotFound(_0x4bc374,null))[_0x9c19('0x1b')](function(_0x3b1c58){if(_0x3b1c58){_0x308222[_0x9c19('0x40')]['AccountId']=_0x3b1c58['id'];_0x308222[_0x9c19('0x40')][_0x9c19('0x45')]=integrations[_0x9c19('0x46')](_0x308222[_0x9c19('0x40')][_0x9c19('0x47')],_0x308222['body'][_0x9c19('0x26')]);_0x308222['body'][_0x9c19('0x48')]=integrations[_0x9c19('0x49')](_0x308222['body']['channel'],_0x308222[_0x9c19('0x40')][_0x9c19('0x26')]);return db[_0x9c19('0x4a')][_0x9c19('0x3f')](_0x308222[_0x9c19('0x40')],{'include':[{'model':db[_0x9c19('0x4b')],'as':_0x9c19('0x45')},{'model':db[_0x9c19('0x4b')],'as':_0x9c19('0x48')}]});}return null;})[_0x9c19('0x1b')](respondWithResult(_0x4bc374,null))[_0x9c19('0x3a')](handleError(_0x4bc374,null));};exports[_0x9c19('0x4c')]=function(_0x948b11,_0x7d08a0,_0x417ede){var _0x2d8f04=[_0x9c19('0x4d'),_0x9c19('0x4e'),'knowledge',_0x9c19('0x4f'),_0x9c19('0x50'),'notify',_0x9c19('0x51'),'severity','category'];var _0x4cd4be=[_0x9c19('0x52'),_0x9c19('0x4d'),'caused_by',_0x9c19('0x53'),'upon_reject','sys_updated_on','child_incidents',_0x9c19('0x4e'),_0x9c19('0x54'),_0x9c19('0x55'),_0x9c19('0x56'),_0x9c19('0x57'),_0x9c19('0x58'),_0x9c19('0x59'),'sys_created_on',_0x9c19('0x5a'),_0x9c19('0x5b'),_0x9c19('0x5c'),_0x9c19('0x5d'),_0x9c19('0x30'),_0x9c19('0x5e'),'closed_at',_0x9c19('0x5f'),_0x9c19('0x60'),_0x9c19('0x61'),_0x9c19('0x62'),_0x9c19('0x63'),_0x9c19('0x64'),_0x9c19('0x65'),'sys_domain_path','rfc',_0x9c19('0x66'),_0x9c19('0x67'),_0x9c19('0x68'),_0x9c19('0x69'),'group_list',_0x9c19('0x6a'),_0x9c19('0x6b'),_0x9c19('0x6c'),_0x9c19('0x6d'),_0x9c19('0x6e'),_0x9c19('0x4f'),_0x9c19('0x6f'),_0x9c19('0x70'),_0x9c19('0x50'),_0x9c19('0x71'),_0x9c19('0x72'),_0x9c19('0x73'),'assignment_group',_0x9c19('0x74'),_0x9c19('0x75'),_0x9c19('0x76'),_0x9c19('0x77'),_0x9c19('0x78'),_0x9c19('0x79'),'close_notes',_0x9c19('0x7a'),_0x9c19('0x7b'),'parent_incident','sys_id',_0x9c19('0x7c'),_0x9c19('0x7d'),_0x9c19('0x51'),_0x9c19('0x7e'),_0x9c19('0x7f'),'company',_0x9c19('0x80'),_0x9c19('0x81'),_0x9c19('0x82'),_0x9c19('0x83'),'comments',_0x9c19('0x84'),_0x9c19('0x85'),_0x9c19('0x86'),_0x9c19('0x87'),_0x9c19('0x88'),_0x9c19('0x89'),_0x9c19('0x8a'),'escalation',_0x9c19('0x8b'),'correlation_id',_0x9c19('0x8c'),_0x9c19('0x8d')];var _0x3460e9='';var _0x414536='';var _0x26f0a7=[];var _0x294ff0='';var _0x45d52c='';var _0x4f3300=[];var _0x188399='';var _0xa2f964='';var _0x241dfb={};var _0x4f68c5='';return db[_0x9c19('0x24')]['findOne']({'where':{'id':_0x948b11[_0x9c19('0x41')]['id']},'attributes':['id','username',_0x9c19('0x8e'),'email',_0x9c19('0x8f'),_0x9c19('0x90')]})['then'](handleEntityNotFound(_0x7d08a0,null))[_0x9c19('0x1b')](function(_0x1097c5){if(_0x1097c5){_0x4f68c5=_0x1097c5[_0x9c19('0x8f')];var _0x5b0744=_0x4f68c5[_0x9c19('0x91')](-0x1);if(_0x5b0744==='/'){_0x4f68c5=_0x4f68c5[_0x9c19('0x92')](0x0,_0x4f68c5[_0x9c19('0x93')](_0x5b0744));}_0xa2f964=util[_0x9c19('0x94')]('%s/api/now/doc/table/schema/',_0x4f68c5);_0x188399=util['format'](_0x9c19('0x95'),_0x4f68c5);_0x241dfb={'user':_0x1097c5[_0x9c19('0x96')],'pass':_0x1097c5[_0x9c19('0x8e')]};var _0x5d87e5={'method':_0x9c19('0x97'),'uri':_0xa2f964+_0x9c19('0x98'),'auth':_0x241dfb,'json':!![]};return rp(_0x5d87e5);}})['then'](function(_0x52ae28){if(_0x52ae28[_0x9c19('0x99')][_0x9c19('0x2d')]>0x0){_0x3460e9=_0x52ae28[_0x9c19('0x99')];}console[_0x9c19('0x9a')](_0x9c19('0x9b'),_0x3460e9);_0x4f3300=[];_0x414536=Object[_0x9c19('0x9c')]([],_0x3460e9);_[_0x9c19('0x9d')](_0x414536,function(_0x51165a){return!_0x2d8f04[_0x9c19('0x9e')](_0x51165a[_0x9c19('0x20')]);});_0x414536[_0x9c19('0x9f')](function(_0x45ad4d){var _0x591fcb=createFieldObject(_0x188399,_0x241dfb,_0x45ad4d[_0x9c19('0xa0')],_0x45ad4d[_0x9c19('0x20')],_0x45ad4d[_0x9c19('0xa1')],![]);_0x4f3300[_0x9c19('0xa2')](_0x591fcb);});return Promise[_0x9c19('0xa3')](_0x4f3300);})[_0x9c19('0x1b')](function(_0x13f922){_0x26f0a7=_0x13f922;_0x294ff0=Object[_0x9c19('0x9c')]([],_0x3460e9);console[_0x9c19('0x9a')](_0x9c19('0xa4'),_0x3460e9);_[_0x9c19('0x9d')](_0x294ff0,function(_0x5c79ed){return _0x4cd4be[_0x9c19('0x9e')](_0x5c79ed[_0x9c19('0x20')]);});console[_0x9c19('0x9a')](_0x9c19('0xa5'),_0x294ff0);_0x4f3300=[];_0x294ff0[_0x9c19('0x9f')](function(_0x476de7){var _0x1c4950=createFieldObject(_0x188399,_0x241dfb,_0x476de7[_0x9c19('0xa0')],_0x476de7[_0x9c19('0x20')],_0x476de7[_0x9c19('0xa1')],!![]);_0x4f3300[_0x9c19('0xa2')](_0x1c4950);});return Promise[_0x9c19('0xa3')](_0x4f3300);})[_0x9c19('0x1b')](function(_0x2e11ed){_0x45d52c=_0x2e11ed;var _0x4bbcbb=_0x26f0a7[_0x9c19('0xa6')](_0x45d52c);return{'count':_0x4bbcbb[_0x9c19('0x2d')],'rows':_0x4bbcbb};})['then'](respondWithResult(_0x7d08a0,null))[_0x9c19('0x3a')](function(_0x9ea351){console['log'](_0x9c19('0xa7')+_0x9ea351);var _0x2fe78c=_0x948b11['query'][_0x9c19('0xa8')]?0x1f4:_0x9ea351[_0x9c19('0xa9')]||0x1f4;logger[_0x9c19('0x1e')](_0x9ea351[_0x9c19('0x1f')]);delete _0x9ea351[_0x9c19('0x20')];if(_0x2fe78c===0x191){_0x2fe78c=0x190;}_0x7d08a0[_0x9c19('0x14')](_0x2fe78c)['send'](_0x948b11[_0x9c19('0x28')][_0x9c19('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0x9ea351['statusCode']}:_0x9ea351);});};function createFieldObject(_0x2da9e3,_0x425259,_0x3b62b2,_0x1c9b59,_0x396d8d,_0x2ce007){return new Promise(function(_0x3b191b,_0x123097){var _0x55ae5e={'id':_0x1c9b59,'name':_0x396d8d,'custom':_0x2ce007};if(_0x3b62b2===_0x9c19('0xaa')){_0x55ae5e['options']=[{'name':_0x9c19('0xab'),'value':_0x9c19('0xac')},{'name':_0x9c19('0xad'),'value':_0x9c19('0xae')}];_0x3b191b(_0x55ae5e);}else{var _0x2f9086={'method':_0x9c19('0x97'),'uri':_0x2da9e3+_0x9c19('0xaf')+_0x1c9b59,'auth':_0x425259,'json':!![]};return rp(_0x2f9086)[_0x9c19('0x1b')](function(_0x87626b){var _0x36a810=[];if(_0x87626b['result'][_0x9c19('0x2d')]>0x0){_0x87626b[_0x9c19('0x99')][_0x9c19('0x9f')](function(_0x4765f2){if(_0x4765f2[_0x9c19('0xb0')]==='false'){var _0x31bf6d={'name':_0x4765f2['label'],'value':_0x4765f2[_0x9c19('0xb1')]};_0x36a810[_0x9c19('0xa2')](_0x31bf6d);}});}_0x55ae5e[_0x9c19('0x35')]=_0x36a810;if(_0x55ae5e[_0x9c19('0x35')]['length']>0x0){_0x3b191b(_0x55ae5e);}else{if(_0x2ce007==![]){_0x3b191b();}else{_0x3b191b(_0x55ae5e);}}});}});} \ No newline at end of file +var _0xb110=['nolimit','sort','where','filters','pick','filter','merge','options','count','includeAll','include','rows','params','ServicenowAccount','rawAttributes','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','category','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','test','Wrong\x20credentials','statusCode','True','true','False','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','send','map','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x323fa2,_0x4ba631){var _0x277baa=function(_0x4351a6){while(--_0x4351a6){_0x323fa2['push'](_0x323fa2['shift']());}};_0x277baa(++_0x4ba631);}(_0xb110,0x12e));var _0x0b11=function(_0x3b5b83,_0x298489){_0x3b5b83=_0x3b5b83-0x0;var _0x537eea=_0xb110[_0x3b5b83];return _0x537eea;};'use strict';var emlformat=require(_0x0b11('0x0'));var rimraf=require(_0x0b11('0x1'));var zipdir=require(_0x0b11('0x2'));var jsonpatch=require(_0x0b11('0x3'));var rp=require(_0x0b11('0x4'));var moment=require(_0x0b11('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0b11('0x6'));var util=require(_0x0b11('0x7'));var path=require('path');var sox=require(_0x0b11('0x8'));var csv=require(_0x0b11('0x9'));var ejs=require(_0x0b11('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0b11('0xb'));var crypto=require(_0x0b11('0xc'));var jsforce=require(_0x0b11('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b11('0x9'));var querystring=require(_0x0b11('0xe'));var Papa=require(_0x0b11('0xf'));var Redis=require(_0x0b11('0x10'));var authService=require(_0x0b11('0x11'));var qs=require(_0x0b11('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b11('0x13'))(_0x0b11('0x14'));var utils=require(_0x0b11('0x15'));var config=require(_0x0b11('0x16'));var licenseUtil=require(_0x0b11('0x17'));var db=require(_0x0b11('0x18'))['db'];var integrations=require(_0x0b11('0x19'));function respondWithStatusCode(_0x317946,_0x2ea83e){_0x2ea83e=_0x2ea83e||0xcc;return function(_0x9d3416){if(_0x9d3416){return _0x317946[_0x0b11('0x1a')](_0x2ea83e);}return _0x317946[_0x0b11('0x1b')](_0x2ea83e)[_0x0b11('0x1c')]();};}function respondWithResult(_0x14c6a4,_0x5351a6){_0x5351a6=_0x5351a6||0xc8;return function(_0x2af498){if(_0x2af498){return _0x14c6a4[_0x0b11('0x1b')](_0x5351a6)[_0x0b11('0x1d')](_0x2af498);}};}function respondWithFilteredResult(_0x4a5501,_0x51869c){return function(_0x5ee8b2){if(_0x5ee8b2){var _0x2c60ab=typeof _0x51869c[_0x0b11('0x1e')]===_0x0b11('0x1f')&&typeof _0x51869c[_0x0b11('0x20')]===_0x0b11('0x1f');var _0x4e4976=_0x5ee8b2['count'];var _0xe6d782=_0x2c60ab?0x0:_0x51869c[_0x0b11('0x1e')];var _0x28dffb=_0x2c60ab?_0x5ee8b2['count']:_0x51869c['offset']+_0x51869c[_0x0b11('0x20')];var _0x213e12;if(_0x28dffb>=_0x4e4976){_0x28dffb=_0x4e4976;_0x213e12=0xc8;}else{_0x213e12=0xce;}_0x4a5501['status'](_0x213e12);return _0x4a5501[_0x0b11('0x21')](_0x0b11('0x22'),_0xe6d782+'-'+_0x28dffb+'/'+_0x4e4976)['json'](_0x5ee8b2);}return null;};}function patchUpdates(_0x21908c){return function(_0x1d40e){try{jsonpatch[_0x0b11('0x23')](_0x1d40e,_0x21908c,!![]);}catch(_0x1e6b31){return BPromise['reject'](_0x1e6b31);}return _0x1d40e[_0x0b11('0x24')]();};}function saveUpdates(_0x482a7d,_0x1cfb1d){return function(_0x1e7ff4){if(_0x1e7ff4){return _0x1e7ff4[_0x0b11('0x25')](_0x482a7d)[_0x0b11('0x26')](function(_0x4936ff){return _0x4936ff;});}return null;};}function removeEntity(_0x5c45e3,_0x2bc0c2){return function(_0x9ad36a){if(_0x9ad36a){return _0x9ad36a[_0x0b11('0x27')]()[_0x0b11('0x26')](function(){_0x5c45e3['status'](0xcc)[_0x0b11('0x1c')]();});}};}function handleEntityNotFound(_0xe85b27,_0x9d7a7a){return function(_0x18c952){if(!_0x18c952){_0xe85b27[_0x0b11('0x1a')](0x194);}return _0x18c952;};}function handleError(_0x1ac187,_0x254998){_0x254998=_0x254998||0x1f4;return function(_0xfd0cdd){logger[_0x0b11('0x28')](_0xfd0cdd[_0x0b11('0x29')]);if(_0xfd0cdd['name']){delete _0xfd0cdd['name'];}_0x1ac187[_0x0b11('0x1b')](_0x254998)[_0x0b11('0x2a')](_0xfd0cdd);};}exports['index']=function(_0xdce856,_0x37d161){var _0x5944cb={},_0x3bb4be={},_0x38e322={'count':0x0,'rows':[]};var _0x2d0de3=_[_0x0b11('0x2b')](db['ServicenowAccount']['rawAttributes'],function(_0x4dc085){return{'name':_0x4dc085[_0x0b11('0x2c')],'type':_0x4dc085[_0x0b11('0x2d')][_0x0b11('0x2e')]};});_0x3bb4be[_0x0b11('0x2f')]=_['map'](_0x2d0de3,_0x0b11('0x30'));_0x3bb4be[_0x0b11('0x31')]=_[_0x0b11('0x32')](_0xdce856[_0x0b11('0x31')]);_0x3bb4be['filters']=_['intersection'](_0x3bb4be['model'],_0x3bb4be['query']);_0x5944cb['attributes']=_[_0x0b11('0x33')](_0x3bb4be[_0x0b11('0x2f')],qs[_0x0b11('0x34')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x34')]));_0x5944cb[_0x0b11('0x35')]=_0x5944cb['attributes'][_0x0b11('0x36')]?_0x5944cb[_0x0b11('0x35')]:_0x3bb4be[_0x0b11('0x2f')];if(!_0xdce856[_0x0b11('0x31')][_0x0b11('0x37')](_0x0b11('0x38'))){_0x5944cb[_0x0b11('0x20')]=qs[_0x0b11('0x20')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x20')]);_0x5944cb[_0x0b11('0x1e')]=qs[_0x0b11('0x1e')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x1e')]);}_0x5944cb['order']=qs[_0x0b11('0x39')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x39')]);_0x5944cb[_0x0b11('0x3a')]=qs[_0x0b11('0x3b')](_[_0x0b11('0x3c')](_0xdce856[_0x0b11('0x31')],_0x3bb4be[_0x0b11('0x3b')]),_0x2d0de3);if(_0xdce856['query'][_0x0b11('0x3d')]){_0x5944cb[_0x0b11('0x3a')]=_[_0x0b11('0x3e')](_0x5944cb['where'],{'$or':_[_0x0b11('0x2b')](_0x2d0de3,function(_0x4a1975){if(_0x4a1975[_0x0b11('0x2d')]!=='VIRTUAL'){var _0x577ef2={};_0x577ef2[_0x4a1975['name']]={'$like':'%'+_0xdce856[_0x0b11('0x31')][_0x0b11('0x3d')]+'%'};return _0x577ef2;}})});}_0x5944cb=_[_0x0b11('0x3e')]({},_0x5944cb,_0xdce856[_0x0b11('0x3f')]);var _0x296fdc={'where':_0x5944cb['where']};return db['ServicenowAccount'][_0x0b11('0x40')](_0x296fdc)['then'](function(_0xcc8c75){_0x38e322[_0x0b11('0x40')]=_0xcc8c75;if(_0xdce856[_0x0b11('0x31')][_0x0b11('0x41')]){_0x5944cb[_0x0b11('0x42')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x5944cb);})['then'](function(_0x485726){_0x38e322[_0x0b11('0x43')]=_0x485726;return _0x38e322;})[_0x0b11('0x26')](respondWithFilteredResult(_0x37d161,_0x5944cb))['catch'](handleError(_0x37d161,null));};exports['show']=function(_0x50971b,_0x2a341d){var _0x58efcb={'raw':![],'where':{'id':_0x50971b[_0x0b11('0x44')]['id']}},_0x27c096={};_0x27c096[_0x0b11('0x2f')]=_[_0x0b11('0x32')](db[_0x0b11('0x45')][_0x0b11('0x46')]);_0x27c096['query']=_['keys'](_0x50971b['query']);_0x27c096[_0x0b11('0x3b')]=_[_0x0b11('0x33')](_0x27c096['model'],_0x27c096[_0x0b11('0x31')]);_0x58efcb['attributes']=_[_0x0b11('0x33')](_0x27c096[_0x0b11('0x2f')],qs[_0x0b11('0x34')](_0x50971b[_0x0b11('0x31')][_0x0b11('0x34')]));_0x58efcb[_0x0b11('0x35')]=_0x58efcb['attributes'][_0x0b11('0x36')]?_0x58efcb[_0x0b11('0x35')]:_0x27c096[_0x0b11('0x2f')];if(_0x50971b[_0x0b11('0x31')][_0x0b11('0x41')]){_0x58efcb[_0x0b11('0x42')]=[{'all':!![]}];}_0x58efcb=_[_0x0b11('0x3e')]({},_0x58efcb,_0x50971b[_0x0b11('0x3f')]);return db[_0x0b11('0x45')][_0x0b11('0x47')](_0x58efcb)[_0x0b11('0x26')](handleEntityNotFound(_0x2a341d,null))['then'](respondWithResult(_0x2a341d,null))[_0x0b11('0x48')](handleError(_0x2a341d,null));};exports[_0x0b11('0x49')]=function(_0x4000a7,_0xffbd3e){return db[_0x0b11('0x45')][_0x0b11('0x49')](_0x4000a7['body'],{})['then'](respondWithResult(_0xffbd3e,0xc9))[_0x0b11('0x48')](handleError(_0xffbd3e,null));};exports[_0x0b11('0x25')]=function(_0x1ec68c,_0x40a024){if(_0x1ec68c[_0x0b11('0x4a')]['id']){delete _0x1ec68c['body']['id'];}return db['ServicenowAccount'][_0x0b11('0x47')]({'where':{'id':_0x1ec68c['params']['id']}})[_0x0b11('0x26')](handleEntityNotFound(_0x40a024,null))['then'](saveUpdates(_0x1ec68c['body'],null))[_0x0b11('0x26')](respondWithResult(_0x40a024,null))[_0x0b11('0x48')](handleError(_0x40a024,null));};exports[_0x0b11('0x27')]=function(_0x53e13b,_0x3ece72){return db[_0x0b11('0x45')][_0x0b11('0x47')]({'where':{'id':_0x53e13b[_0x0b11('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ece72,null))[_0x0b11('0x26')](removeEntity(_0x3ece72,null))[_0x0b11('0x48')](handleError(_0x3ece72,null));};exports[_0x0b11('0x4b')]=function(_0x1c00ef,_0x36c84b,_0x123713){var _0x58885e={};var _0x3ab9e4={};var _0xe39107;var _0x583491;return db[_0x0b11('0x45')][_0x0b11('0x4c')]({'where':{'id':_0x1c00ef[_0x0b11('0x44')]['id']}})[_0x0b11('0x26')](handleEntityNotFound(_0x36c84b,null))[_0x0b11('0x26')](function(_0x8dd9fd){if(_0x8dd9fd){_0xe39107=_0x8dd9fd;_0x3ab9e4['model']=_[_0x0b11('0x32')](db[_0x0b11('0x4d')][_0x0b11('0x46')]);_0x3ab9e4[_0x0b11('0x31')]=_[_0x0b11('0x32')](_0x1c00ef[_0x0b11('0x31')]);_0x3ab9e4[_0x0b11('0x3b')]=_[_0x0b11('0x33')](_0x3ab9e4[_0x0b11('0x2f')],_0x3ab9e4[_0x0b11('0x31')]);_0x58885e[_0x0b11('0x35')]=_[_0x0b11('0x33')](_0x3ab9e4['model'],qs[_0x0b11('0x34')](_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x34')]));_0x58885e[_0x0b11('0x35')]=_0x58885e[_0x0b11('0x35')][_0x0b11('0x36')]?_0x58885e['attributes']:_0x3ab9e4[_0x0b11('0x2f')];_0x58885e[_0x0b11('0x4e')]=qs['sort'](_0x1c00ef['query'][_0x0b11('0x39')]);_0x58885e[_0x0b11('0x3a')]=qs['filters'](_[_0x0b11('0x3c')](_0x1c00ef[_0x0b11('0x31')],_0x3ab9e4['filters']));if(_0x1c00ef['query'][_0x0b11('0x3d')]){_0x58885e['where']=_['merge'](_0x58885e[_0x0b11('0x3a')],{'$or':_['map'](_0x58885e[_0x0b11('0x35')],function(_0x544408){var _0x2dfb70={};_0x2dfb70[_0x544408]={'$like':'%'+_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x3d')]+'%'};return _0x2dfb70;})});}_0x58885e=_[_0x0b11('0x3e')]({},_0x58885e,_0x1c00ef[_0x0b11('0x3f')]);return _0xe39107[_0x0b11('0x4b')](_0x58885e);}})['then'](function(_0x3cc3e0){if(_0x3cc3e0){_0x583491=_0x3cc3e0['length'];if(!_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x37')]('nolimit')){_0x58885e['limit']=qs['limit'](_0x1c00ef['query'][_0x0b11('0x20')]);_0x58885e[_0x0b11('0x1e')]=qs['offset'](_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x1e')]);}return _0xe39107[_0x0b11('0x4b')](_0x58885e);}})[_0x0b11('0x26')](function(_0x69d909){if(_0x69d909){return _0x69d909?{'count':_0x583491,'rows':_0x69d909}:null;}})[_0x0b11('0x26')](respondWithResult(_0x36c84b,null))[_0x0b11('0x48')](handleError(_0x36c84b,null));};exports[_0x0b11('0x4f')]=function(_0x3bdbd1,_0x5d46c4,_0x124991){if(_0x3bdbd1['body']['id']){delete _0x3bdbd1['body']['id'];}return db[_0x0b11('0x45')][_0x0b11('0x4c')]({'where':{'id':_0x3bdbd1[_0x0b11('0x44')]['id']}})[_0x0b11('0x26')](handleEntityNotFound(_0x5d46c4,null))[_0x0b11('0x26')](function(_0x33116d){if(_0x33116d){_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x50')]=_0x33116d['id'];_0x3bdbd1['body']['Subjects']=integrations[_0x0b11('0x51')](_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x52')],_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x2d')]);_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x53')]=integrations[_0x0b11('0x54')](_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x52')],_0x3bdbd1['body']['type']);return db[_0x0b11('0x4d')][_0x0b11('0x49')](_0x3bdbd1[_0x0b11('0x4a')],{'include':[{'model':db[_0x0b11('0x55')],'as':_0x0b11('0x56')},{'model':db[_0x0b11('0x55')],'as':'Descriptions'}]});}return null;})[_0x0b11('0x26')](respondWithResult(_0x5d46c4,null))[_0x0b11('0x48')](handleError(_0x5d46c4,null));};exports[_0x0b11('0x57')]=function(_0x3d3448,_0x1750dd,_0x3ca56c){var _0x533372=[_0x0b11('0x58'),_0x0b11('0x59'),_0x0b11('0x5a'),'subcategory','close_code','notify',_0x0b11('0x5b'),'severity','category'];var _0x2e8639=[_0x0b11('0x5c'),_0x0b11('0x58'),_0x0b11('0x5d'),_0x0b11('0x5e'),_0x0b11('0x5f'),_0x0b11('0x60'),_0x0b11('0x61'),_0x0b11('0x59'),_0x0b11('0x62'),_0x0b11('0x63'),_0x0b11('0x64'),_0x0b11('0x65'),_0x0b11('0x66'),'user_input','sys_created_on','sys_domain','state','sys_created_by',_0x0b11('0x5a'),_0x0b11('0x4e'),_0x0b11('0x67'),_0x0b11('0x68'),'cmdb_ci',_0x0b11('0x69'),_0x0b11('0x6a'),_0x0b11('0x6b'),_0x0b11('0x6c'),'business_service','priority',_0x0b11('0x6d'),_0x0b11('0x6e'),_0x0b11('0x6f'),'expected_start',_0x0b11('0x70'),'business_duration',_0x0b11('0x71'),_0x0b11('0x72'),_0x0b11('0x73'),_0x0b11('0x74'),_0x0b11('0x75'),_0x0b11('0x76'),'subcategory',_0x0b11('0x77'),_0x0b11('0x78'),_0x0b11('0x79'),'correlation_display','delivery_task','work_start',_0x0b11('0x7a'),'business_stc',_0x0b11('0x7b'),_0x0b11('0x7c'),_0x0b11('0x7d'),_0x0b11('0x7e'),_0x0b11('0x7f'),_0x0b11('0x80'),_0x0b11('0x81'),'follow_up',_0x0b11('0x82'),_0x0b11('0x83'),_0x0b11('0x84'),_0x0b11('0x85'),'incident_state','urgency',_0x0b11('0x86'),_0x0b11('0x87'),_0x0b11('0x88'),'activity_due','assigned_to',_0x0b11('0x89'),_0x0b11('0x8a'),_0x0b11('0x8b'),_0x0b11('0x8c'),_0x0b11('0x8d'),_0x0b11('0x8e'),_0x0b11('0x8f'),_0x0b11('0x90'),_0x0b11('0x91'),'escalation',_0x0b11('0x92'),_0x0b11('0x93'),_0x0b11('0x94'),_0x0b11('0x95')];var _0x2f6b27='';var _0x456c65='';var _0x292a49=[];var _0x841f67='';var _0x588d7c='';var _0x3bcb05=[];var _0x368ff0='';var _0x18d95d='';var _0x32cb79={};var _0x3fd341='';return db['ServicenowAccount'][_0x0b11('0x4c')]({'where':{'id':_0x3d3448[_0x0b11('0x44')]['id']},'attributes':['id','username',_0x0b11('0x96'),'email',_0x0b11('0x97'),_0x0b11('0x98')]})[_0x0b11('0x26')](handleEntityNotFound(_0x1750dd,null))['then'](function(_0x14bc09){if(_0x14bc09){_0x3fd341=_0x14bc09['remoteUri'];var _0x411ac6=_0x3fd341[_0x0b11('0x99')](-0x1);if(_0x411ac6==='/'){_0x3fd341=_0x3fd341[_0x0b11('0x9a')](0x0,_0x3fd341[_0x0b11('0x9b')](_0x411ac6));}_0x18d95d=util['format']('%s/api/now/doc/table/schema/',_0x3fd341);_0x368ff0=util[_0x0b11('0x9c')](_0x0b11('0x9d'),_0x3fd341);_0x32cb79={'user':_0x14bc09[_0x0b11('0x9e')],'pass':_0x14bc09[_0x0b11('0x96')]};var _0x5c9990={'method':_0x0b11('0x9f'),'uri':_0x18d95d+_0x0b11('0xa0'),'auth':_0x32cb79,'json':!![]};return rp(_0x5c9990);}})[_0x0b11('0x26')](function(_0x5ec69c){if(_0x5ec69c['result'][_0x0b11('0x36')]>0x0){_0x2f6b27=_0x5ec69c[_0x0b11('0xa1')];}console[_0x0b11('0xa2')]('incident\x20table\x20objects',_0x2f6b27);_0x3bcb05=[];_0x456c65=Object[_0x0b11('0xa3')]([],_0x2f6b27);_[_0x0b11('0xa4')](_0x456c65,function(_0x1a2cdb){return!_0x533372[_0x0b11('0xa5')](_0x1a2cdb[_0x0b11('0x30')]);});_0x456c65[_0x0b11('0xa6')](function(_0x377229){var _0x40562b=createFieldObject(_0x368ff0,_0x32cb79,_0x377229[_0x0b11('0xa7')],_0x377229[_0x0b11('0x30')],_0x377229['label'],![]);_0x3bcb05[_0x0b11('0xa8')](_0x40562b);});return Promise[_0x0b11('0xa9')](_0x3bcb05);})[_0x0b11('0x26')](function(_0x35909d){_0x292a49=_0x35909d;_0x841f67=Object[_0x0b11('0xa3')]([],_0x2f6b27);console['log']('TCL:\x20_object',_0x2f6b27);_[_0x0b11('0xa4')](_0x841f67,function(_0x2185df){return _0x2e8639[_0x0b11('0xa5')](_0x2185df[_0x0b11('0x30')]);});console[_0x0b11('0xa2')](_0x0b11('0xaa'),_0x841f67);_0x3bcb05=[];_0x841f67[_0x0b11('0xa6')](function(_0x3dffa0){var _0x199407=createFieldObject(_0x368ff0,_0x32cb79,_0x3dffa0[_0x0b11('0xa7')],_0x3dffa0[_0x0b11('0x30')],_0x3dffa0[_0x0b11('0xab')],!![]);_0x3bcb05['push'](_0x199407);});return Promise[_0x0b11('0xa9')](_0x3bcb05);})[_0x0b11('0x26')](function(_0x3f95fb){_0x588d7c=_0x3f95fb;var _0x4c0da9=_0x292a49['concat'](_0x588d7c);return{'count':_0x4c0da9[_0x0b11('0x36')],'rows':_0x4c0da9};})[_0x0b11('0x26')](respondWithResult(_0x1750dd,null))[_0x0b11('0x48')](function(_0x5b5934){console['log']('ServiceNow\x20error:\x20'+_0x5b5934);var _0x3ee467=_0x3d3448[_0x0b11('0x31')][_0x0b11('0xac')]?0x1f4:_0x5b5934['statusCode']||0x1f4;logger[_0x0b11('0x28')](_0x5b5934[_0x0b11('0x29')]);delete _0x5b5934[_0x0b11('0x30')];if(_0x3ee467===0x191){_0x3ee467=0x190;}_0x1750dd[_0x0b11('0x1b')](_0x3ee467)[_0x0b11('0x2a')](_0x3d3448[_0x0b11('0x31')][_0x0b11('0xac')]?{'message':_0x0b11('0xad'),'statusCode':_0x5b5934[_0x0b11('0xae')]}:_0x5b5934);});};function createFieldObject(_0x3a9b22,_0x531667,_0x36b495,_0x250993,_0x24451f,_0x5ecc42){return new Promise(function(_0x442e05,_0x2ddf7b){var _0x9abd5d={'id':_0x250993,'name':_0x24451f,'custom':_0x5ecc42};if(_0x36b495==='boolean'){_0x9abd5d[_0x0b11('0x3f')]=[{'name':_0x0b11('0xaf'),'value':_0x0b11('0xb0')},{'name':_0x0b11('0xb1'),'value':_0x0b11('0xb2')}];_0x442e05(_0x9abd5d);}else{var _0x109dd6={'method':_0x0b11('0x9f'),'uri':_0x3a9b22+'sys_choice?sysparm_query=name=incident^element='+_0x250993,'auth':_0x531667,'json':!![]};return rp(_0x109dd6)[_0x0b11('0x26')](function(_0x43d26d){var _0x19189f=[];if(_0x43d26d[_0x0b11('0xa1')][_0x0b11('0x36')]>0x0){_0x43d26d[_0x0b11('0xa1')][_0x0b11('0xa6')](function(_0x3fb9f9){if(_0x3fb9f9['inactive']===_0x0b11('0xb2')){var _0x51b5c7={'name':_0x3fb9f9[_0x0b11('0xab')],'value':_0x3fb9f9['value']};_0x19189f[_0x0b11('0xa8')](_0x51b5c7);}});}_0x9abd5d['options']=_0x19189f;if(_0x9abd5d[_0x0b11('0x3f')][_0x0b11('0x36')]>0x0){_0x442e05(_0x9abd5d);}else{if(_0x5ecc42==![]){_0x442e05();}else{_0x442e05(_0x9abd5d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9d52ec6..165f417 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 _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x5c160b,_0x25bb02){var _0x4a2f57=function(_0x4e260c){while(--_0x4e260c){_0x5c160b['push'](_0x5c160b['shift']());}};_0x4a2f57(++_0x25bb02);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4b4d21,_0x315383){_0x4b4d21=_0x4b4d21-0x0;var _0x5254dd=_0x9c5a[_0x4b4d21];return _0x5254dd;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0xe109af,_0x17c337){var _0x599e29=function(_0x2d7c7b){while(--_0x2d7c7b){_0xe109af['push'](_0xe109af['shift']());}};_0x599e29(++_0x17c337);}(_0xdc97,0x13b));var _0x7dc9=function(_0x13ec3a,_0x52890d){_0x13ec3a=_0x13ec3a-0x0;var _0x2f4625=_0xdc97[_0x13ec3a];return _0x2f4625;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'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 0a1cab0..04406de 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 _0xe606=['ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','raw','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','catch','GetServicenowAccount'];(function(_0x506d6e,_0x26f53b){var _0xe178ff=function(_0xdd8197){while(--_0xdd8197){_0x506d6e['push'](_0x506d6e['shift']());}};_0xe178ff(++_0x26f53b);}(_0xe606,0x1a4));var _0x6e60=function(_0xec92ff,_0x6ff1f4){_0xec92ff=_0xec92ff-0x0;var _0x17fea7=_0xe606[_0xec92ff];return _0x17fea7;};'use strict';var _=require(_0x6e60('0x0'));var util=require(_0x6e60('0x1'));var moment=require(_0x6e60('0x2'));var BPromise=require(_0x6e60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e60('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e60('0x5'));var config=require(_0x6e60('0x6'));var jayson=require(_0x6e60('0x7'));var client=jayson['client'][_0x6e60('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c39bd,_0x505842,_0x2e4dbe){return new BPromise(function(_0x37fdaa,_0xaedb84){return client[_0x6e60('0x9')](_0x4c39bd,_0x2e4dbe)[_0x6e60('0xa')](function(_0x395c98){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x505842,'request\x20sent');logger[_0x6e60('0xb')](_0x6e60('0xc'),_0x505842,_0x6e60('0xd'),JSON[_0x6e60('0xe')](_0x395c98));if(_0x395c98[_0x6e60('0xf')]){if(_0x395c98['error'][_0x6e60('0x10')]===0x1f4){logger[_0x6e60('0xf')](_0x6e60('0x11'),_0x505842,_0x395c98[_0x6e60('0xf')]['message']);return _0xaedb84(_0x395c98[_0x6e60('0xf')][_0x6e60('0x12')]);}logger['error'](_0x6e60('0x11'),_0x505842,_0x395c98[_0x6e60('0xf')][_0x6e60('0x12')]);return _0x37fdaa(_0x395c98[_0x6e60('0xf')][_0x6e60('0x12')]);}else{logger[_0x6e60('0x13')](_0x6e60('0x11'),_0x505842,_0x6e60('0xd'));_0x37fdaa(_0x395c98['result'][_0x6e60('0x12')]);}})[_0x6e60('0x14')](function(_0xfa2abe){logger[_0x6e60('0xf')](_0x6e60('0x11'),_0x505842,_0xfa2abe);_0xaedb84(_0xfa2abe);});});}exports[_0x6e60('0x15')]=function(_0x47bf47){var _0x588620=this;return new Promise(function(_0x25f956,_0x185e85){return db[_0x6e60('0x16')][_0x6e60('0x17')]({'raw':_0x47bf47[_0x6e60('0x18')]?_0x47bf47[_0x6e60('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x47bf47[_0x6e60('0x18')]?_0x47bf47['options'][_0x6e60('0x19')]||null:null,'attributes':_0x47bf47[_0x6e60('0x18')]?_0x47bf47[_0x6e60('0x18')][_0x6e60('0x1a')]||null:null,'limit':_0x47bf47[_0x6e60('0x18')]?_0x47bf47[_0x6e60('0x18')][_0x6e60('0x1b')]||null:null,'include':_0x47bf47['options']?_0x47bf47[_0x6e60('0x18')][_0x6e60('0x1c')]?_[_0x6e60('0x1d')](_0x47bf47['options'][_0x6e60('0x1c')],function(_0x34beca){return{'model':db[_0x34beca['model']],'as':_0x34beca['as'],'attributes':_0x34beca[_0x6e60('0x1a')],'include':_0x34beca[_0x6e60('0x1c')]?_[_0x6e60('0x1d')](_0x34beca[_0x6e60('0x1c')],function(_0x516bc6){return{'model':db[_0x516bc6[_0x6e60('0x1e')]],'as':_0x516bc6['as'],'attributes':_0x516bc6[_0x6e60('0x1a')],'include':_0x516bc6[_0x6e60('0x1c')]?_[_0x6e60('0x1d')](_0x516bc6[_0x6e60('0x1c')],function(_0x291055){return{'model':db[_0x291055[_0x6e60('0x1e')]],'as':_0x291055['as'],'attributes':_0x291055[_0x6e60('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6e60('0xa')](function(_0x3f808f){logger['info']('GetServicenowAccount',_0x47bf47);logger[_0x6e60('0xb')]('GetServicenowAccount',_0x47bf47,JSON[_0x6e60('0xe')](_0x3f808f));_0x25f956(_0x3f808f);})[_0x6e60('0x14')](function(_0x31acfa){logger[_0x6e60('0xf')](_0x6e60('0x15'),_0x31acfa[_0x6e60('0x12')],_0x47bf47);_0x185e85(_0x588620[_0x6e60('0xf')](0x1f4,_0x31acfa[_0x6e60('0x12')]));});});};exports[_0x6e60('0x1f')]=function(_0x256e54){var _0x4d593a=this;return new Promise(function(_0xcc2251,_0x316412){return db[_0x6e60('0x16')][_0x6e60('0x20')]({'raw':_0x256e54[_0x6e60('0x18')]?_0x256e54[_0x6e60('0x18')][_0x6e60('0x21')]===undefined?!![]:![]:!![],'where':_0x256e54[_0x6e60('0x18')]?_0x256e54[_0x6e60('0x18')][_0x6e60('0x19')]||null:null,'attributes':_0x256e54[_0x6e60('0x18')]?_0x256e54[_0x6e60('0x18')][_0x6e60('0x1a')]||null:null,'include':_0x256e54[_0x6e60('0x18')]?_0x256e54[_0x6e60('0x18')][_0x6e60('0x1c')]?_['map'](_0x256e54['options'][_0x6e60('0x1c')],function(_0x31fb0b){return{'model':db[_0x31fb0b[_0x6e60('0x1e')]],'as':_0x31fb0b['as'],'attributes':_0x31fb0b[_0x6e60('0x1a')],'include':_0x31fb0b[_0x6e60('0x1c')]?_[_0x6e60('0x1d')](_0x31fb0b['include'],function(_0x476c0e){return{'model':db[_0x476c0e[_0x6e60('0x1e')]],'as':_0x476c0e['as'],'attributes':_0x476c0e[_0x6e60('0x1a')],'include':_0x476c0e[_0x6e60('0x1c')]?_[_0x6e60('0x1d')](_0x476c0e[_0x6e60('0x1c')],function(_0x19a3c1){return{'model':db[_0x19a3c1[_0x6e60('0x1e')]],'as':_0x19a3c1['as'],'attributes':_0x19a3c1[_0x6e60('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6e60('0xa')](function(_0x2a8ebb){logger['info'](_0x6e60('0x1f'),_0x256e54);logger[_0x6e60('0xb')]('ShowServicenowAccount',_0x256e54,JSON[_0x6e60('0xe')](_0x2a8ebb));_0xcc2251(_0x2a8ebb);})[_0x6e60('0x14')](function(_0x2b25b4){logger[_0x6e60('0xf')](_0x6e60('0x1f'),_0x2b25b4[_0x6e60('0x12')],_0x256e54);_0x316412(_0x4d593a[_0x6e60('0xf')](0x1f4,_0x2b25b4['message']));});});}; \ No newline at end of file +var _0x4258=['limit','include','map','model','GetServicenowAccount','find','raw','ShowServicenowAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','where','attributes'];(function(_0x462e79,_0x13e601){var _0x502abc=function(_0x432436){while(--_0x432436){_0x462e79['push'](_0x462e79['shift']());}};_0x502abc(++_0x13e601);}(_0x4258,0x1b8));var _0x8425=function(_0x4c8fc7,_0x4760c2){_0x4c8fc7=_0x4c8fc7-0x0;var _0x1adab6=_0x4258[_0x4c8fc7];return _0x1adab6;};'use strict';var _=require(_0x8425('0x0'));var util=require(_0x8425('0x1'));var moment=require('moment');var BPromise=require(_0x8425('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8425('0x3'))['db'];var utils=require(_0x8425('0x4'));var logger=require(_0x8425('0x5'))('rpc');var config=require(_0x8425('0x6'));var jayson=require(_0x8425('0x7'));var client=jayson[_0x8425('0x8')][_0x8425('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f83d0,_0x41fc9e,_0x465359){return new BPromise(function(_0x15e24c,_0x14ad67){return client[_0x8425('0xa')](_0x2f83d0,_0x465359)[_0x8425('0xb')](function(_0x2b364c){logger[_0x8425('0xc')](_0x8425('0xd'),_0x41fc9e,_0x8425('0xe'));logger[_0x8425('0xf')](_0x8425('0x10'),_0x41fc9e,'request\x20sent',JSON[_0x8425('0x11')](_0x2b364c));if(_0x2b364c['error']){if(_0x2b364c[_0x8425('0x12')][_0x8425('0x13')]===0x1f4){logger[_0x8425('0x12')](_0x8425('0xd'),_0x41fc9e,_0x2b364c[_0x8425('0x12')][_0x8425('0x14')]);return _0x14ad67(_0x2b364c['error']['message']);}logger[_0x8425('0x12')](_0x8425('0xd'),_0x41fc9e,_0x2b364c[_0x8425('0x12')][_0x8425('0x14')]);return _0x15e24c(_0x2b364c[_0x8425('0x12')][_0x8425('0x14')]);}else{logger[_0x8425('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x41fc9e,_0x8425('0xe'));_0x15e24c(_0x2b364c[_0x8425('0x15')][_0x8425('0x14')]);}})[_0x8425('0x16')](function(_0x5c5d11){logger[_0x8425('0x12')](_0x8425('0xd'),_0x41fc9e,_0x5c5d11);_0x14ad67(_0x5c5d11);});});}exports['GetServicenowAccount']=function(_0x29d005){var _0x54fea4=this;return new Promise(function(_0x462383,_0x513065){return db[_0x8425('0x17')][_0x8425('0x18')]({'raw':_0x29d005[_0x8425('0x19')]?_0x29d005[_0x8425('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x29d005[_0x8425('0x19')]?_0x29d005['options'][_0x8425('0x1a')]||null:null,'attributes':_0x29d005[_0x8425('0x19')]?_0x29d005[_0x8425('0x19')][_0x8425('0x1b')]||null:null,'limit':_0x29d005[_0x8425('0x19')]?_0x29d005[_0x8425('0x19')][_0x8425('0x1c')]||null:null,'include':_0x29d005[_0x8425('0x19')]?_0x29d005['options'][_0x8425('0x1d')]?_[_0x8425('0x1e')](_0x29d005[_0x8425('0x19')][_0x8425('0x1d')],function(_0xdc3611){return{'model':db[_0xdc3611[_0x8425('0x1f')]],'as':_0xdc3611['as'],'attributes':_0xdc3611[_0x8425('0x1b')],'include':_0xdc3611[_0x8425('0x1d')]?_[_0x8425('0x1e')](_0xdc3611[_0x8425('0x1d')],function(_0xf76605){return{'model':db[_0xf76605[_0x8425('0x1f')]],'as':_0xf76605['as'],'attributes':_0xf76605['attributes'],'include':_0xf76605[_0x8425('0x1d')]?_['map'](_0xf76605[_0x8425('0x1d')],function(_0x54b3db){return{'model':db[_0x54b3db[_0x8425('0x1f')]],'as':_0x54b3db['as'],'attributes':_0x54b3db[_0x8425('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8425('0xb')](function(_0x31aada){logger[_0x8425('0xc')](_0x8425('0x20'),_0x29d005);logger[_0x8425('0xf')](_0x8425('0x20'),_0x29d005,JSON['stringify'](_0x31aada));_0x462383(_0x31aada);})['catch'](function(_0x278617){logger[_0x8425('0x12')](_0x8425('0x20'),_0x278617['message'],_0x29d005);_0x513065(_0x54fea4[_0x8425('0x12')](0x1f4,_0x278617[_0x8425('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x12b7b5){var _0x393f76=this;return new Promise(function(_0x2a7fa7,_0x178509){return db['ServicenowAccount'][_0x8425('0x21')]({'raw':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5[_0x8425('0x19')][_0x8425('0x22')]===undefined?!![]:![]:!![],'where':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5[_0x8425('0x19')][_0x8425('0x1a')]||null:null,'attributes':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5[_0x8425('0x19')][_0x8425('0x1b')]||null:null,'include':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5['options'][_0x8425('0x1d')]?_[_0x8425('0x1e')](_0x12b7b5[_0x8425('0x19')][_0x8425('0x1d')],function(_0x1a90ec){return{'model':db[_0x1a90ec[_0x8425('0x1f')]],'as':_0x1a90ec['as'],'attributes':_0x1a90ec[_0x8425('0x1b')],'include':_0x1a90ec[_0x8425('0x1d')]?_[_0x8425('0x1e')](_0x1a90ec['include'],function(_0x213721){return{'model':db[_0x213721[_0x8425('0x1f')]],'as':_0x213721['as'],'attributes':_0x213721[_0x8425('0x1b')],'include':_0x213721['include']?_['map'](_0x213721['include'],function(_0x5a3e95){return{'model':db[_0x5a3e95['model']],'as':_0x5a3e95['as'],'attributes':_0x5a3e95[_0x8425('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8425('0xb')](function(_0x52d4a9){logger[_0x8425('0xc')](_0x8425('0x23'),_0x12b7b5);logger[_0x8425('0xf')](_0x8425('0x23'),_0x12b7b5,JSON[_0x8425('0x11')](_0x52d4a9));_0x2a7fa7(_0x52d4a9);})[_0x8425('0x16')](function(_0x3f3589){logger[_0x8425('0x12')](_0x8425('0x23'),_0x3f3589[_0x8425('0x14')],_0x12b7b5);_0x178509(_0x393f76[_0x8425('0x12')](0x1f4,_0x3f3589[_0x8425('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 04283cf..251836b 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 _0x86c2=['connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0xf5a7ed,_0xc81711){var _0x4fc5c6=function(_0x3598d4){while(--_0x3598d4){_0xf5a7ed['push'](_0xf5a7ed['shift']());}};_0x4fc5c6(++_0xc81711);}(_0x86c2,0x1b5));var _0x286c=function(_0x131c4d,_0x5dea07){_0x131c4d=_0x131c4d-0x0;var _0x21ee7a=_0x86c2[_0x131c4d];return _0x21ee7a;};'use strict';var multer=require(_0x286c('0x0'));var util=require(_0x286c('0x1'));var path=require(_0x286c('0x2'));var timeout=require(_0x286c('0x3'));var express=require('express');var router=express[_0x286c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x286c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x286c('0x6'));var controller=require(_0x286c('0x7'));router[_0x286c('0x8')]('/',auth[_0x286c('0x9')](),controller['index']);router[_0x286c('0x8')]('/:id',auth[_0x286c('0x9')](),controller[_0x286c('0xa')]);router['get'](_0x286c('0xb'),auth[_0x286c('0x9')](),controller['getFields']);router['get'](_0x286c('0xc'),auth[_0x286c('0x9')](),controller['getSubjects']);router['get'](_0x286c('0xd'),auth[_0x286c('0x9')](),controller[_0x286c('0xe')]);router[_0x286c('0xf')]('/',auth[_0x286c('0x9')](),controller[_0x286c('0x10')]);router[_0x286c('0x11')](_0x286c('0x12'),auth[_0x286c('0x9')](),controller['update']);router[_0x286c('0x13')](_0x286c('0x12'),auth[_0x286c('0x9')](),controller[_0x286c('0x14')]);module[_0x286c('0x15')]=router; \ No newline at end of file +var _0x6932=['./intServicenowConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a39f0,_0x370d38){var _0x2a78ef=function(_0x911d04){while(--_0x911d04){_0x3a39f0['push'](_0x3a39f0['shift']());}};_0x2a78ef(++_0x370d38);}(_0x6932,0xd4));var _0x2693=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6932[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x2693('0x0'));var util=require(_0x2693('0x1'));var path=require(_0x2693('0x2'));var timeout=require(_0x2693('0x3'));var express=require('express');var router=express[_0x2693('0x4')]();var fs_extra=require(_0x2693('0x5'));var auth=require(_0x2693('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2693('0x7'));var controller=require(_0x2693('0x8'));router['get']('/',auth[_0x2693('0x9')](),controller['index']);router['get'](_0x2693('0xa'),auth[_0x2693('0x9')](),controller[_0x2693('0xb')]);router[_0x2693('0xc')](_0x2693('0xd'),auth[_0x2693('0x9')](),controller[_0x2693('0xe')]);router[_0x2693('0xc')](_0x2693('0xf'),auth[_0x2693('0x9')](),controller[_0x2693('0x10')]);router[_0x2693('0xc')](_0x2693('0x11'),auth[_0x2693('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x2693('0x9')](),controller[_0x2693('0x12')]);router['put'](_0x2693('0xa'),auth[_0x2693('0x9')](),controller[_0x2693('0x13')]);router[_0x2693('0x14')](_0x2693('0xa'),auth[_0x2693('0x9')](),controller['destroy']);module[_0x2693('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9c5ecc8..4f63eaa 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 _0x6fb1=['exports','STRING','sequelize'];(function(_0xec95fc,_0xd8653c){var _0x27a7dc=function(_0x422d8a){while(--_0x422d8a){_0xec95fc['push'](_0xec95fc['shift']());}};_0x27a7dc(++_0xd8653c);}(_0x6fb1,0x6e));var _0x16fb=function(_0x154e31,_0x5bbe94){_0x154e31=_0x154e31-0x0;var _0x366160=_0x6fb1[_0x154e31];return _0x366160;};'use strict';var Sequelize=require(_0x16fb('0x0'));module[_0x16fb('0x1')]={'name':{'type':Sequelize[_0x16fb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf44=['exports','STRING','sequelize'];(function(_0x5750c0,_0x36b16f){var _0x21caef=function(_0x8a4abb){while(--_0x8a4abb){_0x5750c0['push'](_0x5750c0['shift']());}};_0x21caef(++_0x36b16f);}(_0xbf44,0x107));var _0x4bf4=function(_0x41d40b,_0x415ea0){_0x41d40b=_0x41d40b-0x0;var _0x13b700=_0xbf44[_0x41d40b];return _0x13b700;};'use strict';var Sequelize=require(_0x4bf4('0x0'));module[_0x4bf4('0x1')]={'name':{'type':Sequelize[_0x4bf4('0x2')]},'description':{'type':Sequelize[_0x4bf4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d7e9eac..ba6d4fe 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 _0xc6f5=['sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','fast-json-patch','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/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x104f0e,_0x207f2d){var _0x322790=function(_0x42c6ce){while(--_0x42c6ce){_0x104f0e['push'](_0x104f0e['shift']());}};_0x322790(++_0x207f2d);}(_0xc6f5,0x68));var _0x5c6f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc6f5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x5c6f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c6f('0x1'));var rp=require(_0x5c6f('0x2'));var moment=require(_0x5c6f('0x3'));var BPromise=require(_0x5c6f('0x4'));var Mustache=require(_0x5c6f('0x5'));var util=require(_0x5c6f('0x6'));var path=require(_0x5c6f('0x7'));var sox=require(_0x5c6f('0x8'));var csv=require('to-csv');var ejs=require(_0x5c6f('0x9'));var fs=require('fs');var fs_extra=require(_0x5c6f('0xa'));var _=require(_0x5c6f('0xb'));var squel=require(_0x5c6f('0xc'));var crypto=require(_0x5c6f('0xd'));var jsforce=require(_0x5c6f('0xe'));var deskjs=require(_0x5c6f('0xf'));var toCsv=require(_0x5c6f('0x10'));var querystring=require('querystring');var Papa=require(_0x5c6f('0x11'));var Redis=require(_0x5c6f('0x12'));var authService=require(_0x5c6f('0x13'));var qs=require(_0x5c6f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c6f('0x15'))('api');var utils=require(_0x5c6f('0x16'));var config=require(_0x5c6f('0x17'));var licenseUtil=require(_0x5c6f('0x18'));var db=require(_0x5c6f('0x19'))['db'];function respondWithStatusCode(_0x2fb7cc,_0x25c54f){_0x25c54f=_0x25c54f||0xcc;return function(_0x46cbb3){if(_0x46cbb3){return _0x2fb7cc['sendStatus'](_0x25c54f);}return _0x2fb7cc[_0x5c6f('0x1a')](_0x25c54f)[_0x5c6f('0x1b')]();};}function respondWithResult(_0x286b3c,_0xf0f81c){_0xf0f81c=_0xf0f81c||0xc8;return function(_0x1e6530){if(_0x1e6530){return _0x286b3c['status'](_0xf0f81c)[_0x5c6f('0x1c')](_0x1e6530);}};}function respondWithFilteredResult(_0x38228f,_0x85e70a){return function(_0x31cbe9){if(_0x31cbe9){var _0x902ece=typeof _0x85e70a[_0x5c6f('0x1d')]===_0x5c6f('0x1e')&&typeof _0x85e70a[_0x5c6f('0x1f')]===_0x5c6f('0x1e');var _0xe944e3=_0x31cbe9['count'];var _0x1a62cd=_0x902ece?0x0:_0x85e70a[_0x5c6f('0x1d')];var _0x2e2068=_0x902ece?_0x31cbe9[_0x5c6f('0x20')]:_0x85e70a[_0x5c6f('0x1d')]+_0x85e70a[_0x5c6f('0x1f')];var _0x2b4d1b;if(_0x2e2068>=_0xe944e3){_0x2e2068=_0xe944e3;_0x2b4d1b=0xc8;}else{_0x2b4d1b=0xce;}_0x38228f[_0x5c6f('0x1a')](_0x2b4d1b);return _0x38228f[_0x5c6f('0x21')](_0x5c6f('0x22'),_0x1a62cd+'-'+_0x2e2068+'/'+_0xe944e3)['json'](_0x31cbe9);}return null;};}function patchUpdates(_0x44a166){return function(_0x53b1a6){try{jsonpatch['apply'](_0x53b1a6,_0x44a166,!![]);}catch(_0x1192eb){return BPromise[_0x5c6f('0x23')](_0x1192eb);}return _0x53b1a6[_0x5c6f('0x24')]();};}function saveUpdates(_0x21e6b0,_0x15f9d9){return function(_0x4e7f23){if(_0x4e7f23){return _0x4e7f23[_0x5c6f('0x25')](_0x21e6b0)[_0x5c6f('0x26')](function(_0x274e5a){return _0x274e5a;});}return null;};}function removeEntity(_0x4e3d4d,_0x2893ce){return function(_0x3966b3){if(_0x3966b3){return _0x3966b3[_0x5c6f('0x27')]()[_0x5c6f('0x26')](function(){_0x4e3d4d[_0x5c6f('0x1a')](0xcc)[_0x5c6f('0x1b')]();});}};}function handleEntityNotFound(_0x46cf84,_0x556d88){return function(_0x396071){if(!_0x396071){_0x46cf84[_0x5c6f('0x28')](0x194);}return _0x396071;};}function handleError(_0x1d4c26,_0x2ec07e){_0x2ec07e=_0x2ec07e||0x1f4;return function(_0x30111c){logger[_0x5c6f('0x29')](_0x30111c[_0x5c6f('0x2a')]);if(_0x30111c[_0x5c6f('0x2b')]){delete _0x30111c[_0x5c6f('0x2b')];}_0x1d4c26[_0x5c6f('0x1a')](_0x2ec07e)[_0x5c6f('0x2c')](_0x30111c);};}exports[_0x5c6f('0x2d')]=function(_0x2e121f,_0x5788c7){var _0x556c91={},_0x56ca09={},_0x3172ba={'count':0x0,'rows':[]};var _0x4f9dcf=_[_0x5c6f('0x2e')](db[_0x5c6f('0x2f')][_0x5c6f('0x30')],function(_0xfae5a4){return{'name':_0xfae5a4[_0x5c6f('0x31')],'type':_0xfae5a4[_0x5c6f('0x32')][_0x5c6f('0x33')]};});_0x56ca09['model']=_[_0x5c6f('0x2e')](_0x4f9dcf,_0x5c6f('0x2b'));_0x56ca09[_0x5c6f('0x34')]=_['keys'](_0x2e121f[_0x5c6f('0x34')]);_0x56ca09[_0x5c6f('0x35')]=_[_0x5c6f('0x36')](_0x56ca09[_0x5c6f('0x37')],_0x56ca09[_0x5c6f('0x34')]);_0x556c91[_0x5c6f('0x38')]=_[_0x5c6f('0x36')](_0x56ca09[_0x5c6f('0x37')],qs[_0x5c6f('0x39')](_0x2e121f['query'][_0x5c6f('0x39')]));_0x556c91[_0x5c6f('0x38')]=_0x556c91[_0x5c6f('0x38')][_0x5c6f('0x3a')]?_0x556c91['attributes']:_0x56ca09[_0x5c6f('0x37')];if(!_0x2e121f[_0x5c6f('0x34')][_0x5c6f('0x3b')](_0x5c6f('0x3c'))){_0x556c91[_0x5c6f('0x1f')]=qs[_0x5c6f('0x1f')](_0x2e121f[_0x5c6f('0x34')][_0x5c6f('0x1f')]);_0x556c91[_0x5c6f('0x1d')]=qs[_0x5c6f('0x1d')](_0x2e121f[_0x5c6f('0x34')][_0x5c6f('0x1d')]);}_0x556c91[_0x5c6f('0x3d')]=qs['sort'](_0x2e121f['query'][_0x5c6f('0x3e')]);_0x556c91[_0x5c6f('0x3f')]=qs[_0x5c6f('0x35')](_[_0x5c6f('0x40')](_0x2e121f[_0x5c6f('0x34')],_0x56ca09[_0x5c6f('0x35')]),_0x4f9dcf);if(_0x2e121f[_0x5c6f('0x34')][_0x5c6f('0x41')]){_0x556c91[_0x5c6f('0x3f')]=_[_0x5c6f('0x42')](_0x556c91['where'],{'$or':_[_0x5c6f('0x2e')](_0x4f9dcf,function(_0x1cd8fa){if(_0x1cd8fa[_0x5c6f('0x32')]!=='VIRTUAL'){var _0x64a6cf={};_0x64a6cf[_0x1cd8fa[_0x5c6f('0x2b')]]={'$like':'%'+_0x2e121f[_0x5c6f('0x34')][_0x5c6f('0x41')]+'%'};return _0x64a6cf;}})});}_0x556c91=_[_0x5c6f('0x42')]({},_0x556c91,_0x2e121f[_0x5c6f('0x43')]);var _0x4b7af4={'where':_0x556c91[_0x5c6f('0x3f')]};return db[_0x5c6f('0x2f')][_0x5c6f('0x20')](_0x4b7af4)[_0x5c6f('0x26')](function(_0x48e3f2){_0x3172ba[_0x5c6f('0x20')]=_0x48e3f2;if(_0x2e121f[_0x5c6f('0x34')][_0x5c6f('0x44')]){_0x556c91[_0x5c6f('0x45')]=[{'all':!![]}];}return db[_0x5c6f('0x2f')][_0x5c6f('0x46')](_0x556c91);})[_0x5c6f('0x26')](function(_0x57c612){_0x3172ba['rows']=_0x57c612;return _0x3172ba;})[_0x5c6f('0x26')](respondWithFilteredResult(_0x5788c7,_0x556c91))['catch'](handleError(_0x5788c7,null));};exports[_0x5c6f('0x47')]=function(_0x2aa29b,_0x275fb9){var _0xc5189e={'raw':![],'where':{'id':_0x2aa29b[_0x5c6f('0x48')]['id']}},_0x2e57cc={};_0x2e57cc[_0x5c6f('0x37')]=_[_0x5c6f('0x49')](db[_0x5c6f('0x2f')][_0x5c6f('0x30')]);_0x2e57cc[_0x5c6f('0x34')]=_[_0x5c6f('0x49')](_0x2aa29b[_0x5c6f('0x34')]);_0x2e57cc['filters']=_[_0x5c6f('0x36')](_0x2e57cc[_0x5c6f('0x37')],_0x2e57cc[_0x5c6f('0x34')]);_0xc5189e[_0x5c6f('0x38')]=_[_0x5c6f('0x36')](_0x2e57cc[_0x5c6f('0x37')],qs[_0x5c6f('0x39')](_0x2aa29b[_0x5c6f('0x34')][_0x5c6f('0x39')]));_0xc5189e['attributes']=_0xc5189e[_0x5c6f('0x38')]['length']?_0xc5189e[_0x5c6f('0x38')]:_0x2e57cc[_0x5c6f('0x37')];if(_0x2aa29b[_0x5c6f('0x34')][_0x5c6f('0x44')]){_0xc5189e['include']=[{'all':!![]}];}_0xc5189e=_[_0x5c6f('0x42')]({},_0xc5189e,_0x2aa29b[_0x5c6f('0x43')]);return db[_0x5c6f('0x2f')][_0x5c6f('0x4a')](_0xc5189e)[_0x5c6f('0x26')](handleEntityNotFound(_0x275fb9,null))[_0x5c6f('0x26')](respondWithResult(_0x275fb9,null))[_0x5c6f('0x4b')](handleError(_0x275fb9,null));};exports[_0x5c6f('0x4c')]=function(_0xa5db44,_0x4e0f21){return db['ServicenowConfiguration'][_0x5c6f('0x4c')](_0xa5db44[_0x5c6f('0x4d')],{})[_0x5c6f('0x26')](respondWithResult(_0x4e0f21,0xc9))['catch'](handleError(_0x4e0f21,null));};exports[_0x5c6f('0x25')]=function(_0x33aff6,_0x10ced7){if(_0x33aff6['body']['id']){delete _0x33aff6[_0x5c6f('0x4d')]['id'];}return db[_0x5c6f('0x2f')][_0x5c6f('0x4a')]({'where':{'id':_0x33aff6['params']['id']}})[_0x5c6f('0x26')](handleEntityNotFound(_0x10ced7,null))[_0x5c6f('0x26')](saveUpdates(_0x33aff6[_0x5c6f('0x4d')],null))[_0x5c6f('0x26')](respondWithResult(_0x10ced7,null))[_0x5c6f('0x4b')](handleError(_0x10ced7,null));};exports[_0x5c6f('0x27')]=function(_0x53f715,_0x11d196){return db[_0x5c6f('0x2f')][_0x5c6f('0x4a')]({'where':{'id':_0x53f715[_0x5c6f('0x48')]['id']}})['then'](handleEntityNotFound(_0x11d196,null))[_0x5c6f('0x26')](removeEntity(_0x11d196,null))[_0x5c6f('0x4b')](handleError(_0x11d196,null));};exports[_0x5c6f('0x4e')]=function(_0x19e46c,_0x3e8331,_0x2b0b7c){var _0x4cc9cf={};var _0x3f0d08={};var _0x495155;var _0x3409c2;return db[_0x5c6f('0x2f')][_0x5c6f('0x4f')]({'where':{'id':_0x19e46c[_0x5c6f('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e8331,null))['then'](function(_0x5ac692){if(_0x5ac692){_0x495155=_0x5ac692;_0x3f0d08[_0x5c6f('0x37')]=_[_0x5c6f('0x49')](db[_0x5c6f('0x50')][_0x5c6f('0x30')]);_0x3f0d08[_0x5c6f('0x34')]=_[_0x5c6f('0x49')](_0x19e46c[_0x5c6f('0x34')]);_0x3f0d08['filters']=_['intersection'](_0x3f0d08[_0x5c6f('0x37')],_0x3f0d08['query']);_0x4cc9cf[_0x5c6f('0x38')]=_['intersection'](_0x3f0d08[_0x5c6f('0x37')],qs[_0x5c6f('0x39')](_0x19e46c[_0x5c6f('0x34')]['fields']));_0x4cc9cf[_0x5c6f('0x38')]=_0x4cc9cf[_0x5c6f('0x38')][_0x5c6f('0x3a')]?_0x4cc9cf[_0x5c6f('0x38')]:_0x3f0d08[_0x5c6f('0x37')];_0x4cc9cf[_0x5c6f('0x3d')]=qs[_0x5c6f('0x3e')](_0x19e46c[_0x5c6f('0x34')]['sort']);_0x4cc9cf[_0x5c6f('0x3f')]=qs[_0x5c6f('0x35')](_[_0x5c6f('0x40')](_0x19e46c[_0x5c6f('0x34')],_0x3f0d08[_0x5c6f('0x35')]));if(_0x19e46c['query']['filter']){_0x4cc9cf[_0x5c6f('0x3f')]=_[_0x5c6f('0x42')](_0x4cc9cf[_0x5c6f('0x3f')],{'$or':_['map'](_0x4cc9cf[_0x5c6f('0x38')],function(_0x503beb){var _0x38481b={};_0x38481b[_0x503beb]={'$like':'%'+_0x19e46c[_0x5c6f('0x34')][_0x5c6f('0x41')]+'%'};return _0x38481b;})});}_0x4cc9cf=_[_0x5c6f('0x42')]({},_0x4cc9cf,_0x19e46c['options']);return _0x495155['getFields'](_0x4cc9cf);}})[_0x5c6f('0x26')](function(_0x5b0e11){if(_0x5b0e11){_0x3409c2=_0x5b0e11['length'];if(!_0x19e46c['query'][_0x5c6f('0x3b')]('nolimit')){_0x4cc9cf['limit']=qs['limit'](_0x19e46c[_0x5c6f('0x34')][_0x5c6f('0x1f')]);_0x4cc9cf[_0x5c6f('0x1d')]=qs[_0x5c6f('0x1d')](_0x19e46c[_0x5c6f('0x34')][_0x5c6f('0x1d')]);}return _0x495155[_0x5c6f('0x4e')](_0x4cc9cf);}})[_0x5c6f('0x26')](function(_0x4ae730){if(_0x4ae730){return _0x4ae730?{'count':_0x3409c2,'rows':_0x4ae730}:null;}})['then'](respondWithResult(_0x3e8331,null))[_0x5c6f('0x4b')](handleError(_0x3e8331,null));};exports['getSubjects']=function(_0x382a5e,_0x34de24,_0x55d8da){var _0x5da8bd={};var _0x347b1a={};var _0x454e1d;var _0x27491e;return db['ServicenowConfiguration'][_0x5c6f('0x4f')]({'where':{'id':_0x382a5e[_0x5c6f('0x48')]['id']}})[_0x5c6f('0x26')](handleEntityNotFound(_0x34de24,null))['then'](function(_0x4d1661){if(_0x4d1661){_0x454e1d=_0x4d1661;_0x347b1a[_0x5c6f('0x37')]=_[_0x5c6f('0x49')](db['ServicenowField'][_0x5c6f('0x30')]);_0x347b1a[_0x5c6f('0x34')]=_[_0x5c6f('0x49')](_0x382a5e[_0x5c6f('0x34')]);_0x347b1a[_0x5c6f('0x35')]=_[_0x5c6f('0x36')](_0x347b1a[_0x5c6f('0x37')],_0x347b1a[_0x5c6f('0x34')]);_0x5da8bd['attributes']=_['intersection'](_0x347b1a[_0x5c6f('0x37')],qs['fields'](_0x382a5e[_0x5c6f('0x34')][_0x5c6f('0x39')]));_0x5da8bd[_0x5c6f('0x38')]=_0x5da8bd[_0x5c6f('0x38')][_0x5c6f('0x3a')]?_0x5da8bd[_0x5c6f('0x38')]:_0x347b1a[_0x5c6f('0x37')];_0x5da8bd['order']=qs[_0x5c6f('0x3e')](_0x382a5e[_0x5c6f('0x34')][_0x5c6f('0x3e')]);_0x5da8bd[_0x5c6f('0x3f')]=qs[_0x5c6f('0x35')](_[_0x5c6f('0x40')](_0x382a5e[_0x5c6f('0x34')],_0x347b1a[_0x5c6f('0x35')]));if(_0x382a5e[_0x5c6f('0x34')][_0x5c6f('0x41')]){_0x5da8bd[_0x5c6f('0x3f')]=_[_0x5c6f('0x42')](_0x5da8bd[_0x5c6f('0x3f')],{'$or':_[_0x5c6f('0x2e')](_0x5da8bd['attributes'],function(_0x4eaa47){var _0x45c9da={};_0x45c9da[_0x4eaa47]={'$like':'%'+_0x382a5e[_0x5c6f('0x34')][_0x5c6f('0x41')]+'%'};return _0x45c9da;})});}_0x5da8bd=_['merge']({},_0x5da8bd,_0x382a5e[_0x5c6f('0x43')]);return _0x454e1d['getSubjects'](_0x5da8bd);}})['then'](function(_0x3ac522){if(_0x3ac522){_0x27491e=_0x3ac522[_0x5c6f('0x3a')];if(!_0x382a5e['query']['hasOwnProperty'](_0x5c6f('0x3c'))){_0x5da8bd['limit']=qs['limit'](_0x382a5e['query']['limit']);_0x5da8bd['offset']=qs[_0x5c6f('0x1d')](_0x382a5e[_0x5c6f('0x34')][_0x5c6f('0x1d')]);}return _0x454e1d[_0x5c6f('0x51')](_0x5da8bd);}})['then'](function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5?{'count':_0x27491e,'rows':_0x1a44e5}:null;}})[_0x5c6f('0x26')](respondWithResult(_0x34de24,null))['catch'](handleError(_0x34de24,null));};exports[_0x5c6f('0x52')]=function(_0x18a29c,_0x565a83,_0x4209f0){var _0x517592={};var _0x2ba129={};var _0x59f287;var _0x2c75e2;return db[_0x5c6f('0x2f')][_0x5c6f('0x4f')]({'where':{'id':_0x18a29c[_0x5c6f('0x48')]['id']}})[_0x5c6f('0x26')](handleEntityNotFound(_0x565a83,null))['then'](function(_0x502dcc){if(_0x502dcc){_0x59f287=_0x502dcc;_0x2ba129[_0x5c6f('0x37')]=_[_0x5c6f('0x49')](db[_0x5c6f('0x50')][_0x5c6f('0x30')]);_0x2ba129['query']=_[_0x5c6f('0x49')](_0x18a29c[_0x5c6f('0x34')]);_0x2ba129[_0x5c6f('0x35')]=_[_0x5c6f('0x36')](_0x2ba129[_0x5c6f('0x37')],_0x2ba129[_0x5c6f('0x34')]);_0x517592[_0x5c6f('0x38')]=_['intersection'](_0x2ba129['model'],qs[_0x5c6f('0x39')](_0x18a29c[_0x5c6f('0x34')][_0x5c6f('0x39')]));_0x517592[_0x5c6f('0x38')]=_0x517592[_0x5c6f('0x38')][_0x5c6f('0x3a')]?_0x517592['attributes']:_0x2ba129[_0x5c6f('0x37')];_0x517592['order']=qs[_0x5c6f('0x3e')](_0x18a29c['query'][_0x5c6f('0x3e')]);_0x517592[_0x5c6f('0x3f')]=qs[_0x5c6f('0x35')](_[_0x5c6f('0x40')](_0x18a29c['query'],_0x2ba129[_0x5c6f('0x35')]));if(_0x18a29c['query'][_0x5c6f('0x41')]){_0x517592[_0x5c6f('0x3f')]=_['merge'](_0x517592[_0x5c6f('0x3f')],{'$or':_['map'](_0x517592['attributes'],function(_0x5df1cc){var _0xf9061={};_0xf9061[_0x5df1cc]={'$like':'%'+_0x18a29c['query']['filter']+'%'};return _0xf9061;})});}_0x517592=_[_0x5c6f('0x42')]({},_0x517592,_0x18a29c[_0x5c6f('0x43')]);return _0x59f287[_0x5c6f('0x52')](_0x517592);}})['then'](function(_0x33e720){if(_0x33e720){_0x2c75e2=_0x33e720[_0x5c6f('0x3a')];if(!_0x18a29c['query']['hasOwnProperty'](_0x5c6f('0x3c'))){_0x517592[_0x5c6f('0x1f')]=qs[_0x5c6f('0x1f')](_0x18a29c[_0x5c6f('0x34')][_0x5c6f('0x1f')]);_0x517592[_0x5c6f('0x1d')]=qs[_0x5c6f('0x1d')](_0x18a29c[_0x5c6f('0x34')][_0x5c6f('0x1d')]);}return _0x59f287[_0x5c6f('0x52')](_0x517592);}})[_0x5c6f('0x26')](function(_0x405bf1){if(_0x405bf1){return _0x405bf1?{'count':_0x2c75e2,'rows':_0x405bf1}:null;}})['then'](respondWithResult(_0x565a83,null))[_0x5c6f('0x4b')](handleError(_0x565a83,null));}; \ No newline at end of file +var _0x7983=['../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','attributes','fields','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','ServicenowConfiguration','include','show','params','keys','intersection','length','includeAll','find','catch','create','body','getFields','findOne','ServicenowField','getSubjects','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x38b8ba,_0x38a336){var _0x5316be=function(_0x404a7c){while(--_0x404a7c){_0x38b8ba['push'](_0x38b8ba['shift']());}};_0x5316be(++_0x38a336);}(_0x7983,0xd0));var _0x3798=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7983[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3798('0x0'));var zipdir=require(_0x3798('0x1'));var jsonpatch=require(_0x3798('0x2'));var rp=require(_0x3798('0x3'));var moment=require(_0x3798('0x4'));var BPromise=require(_0x3798('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3798('0x6'));var csv=require('to-csv');var ejs=require(_0x3798('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3798('0x8'));var squel=require(_0x3798('0x9'));var crypto=require(_0x3798('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3798('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3798('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3798('0xd'));var as=require(_0x3798('0xe'));var hardwareService=require(_0x3798('0xf'));var logger=require(_0x3798('0x10'))('api');var utils=require(_0x3798('0x11'));var config=require(_0x3798('0x12'));var licenseUtil=require(_0x3798('0x13'));var db=require(_0x3798('0x14'))['db'];function respondWithStatusCode(_0x4414a0,_0x529071){_0x529071=_0x529071||0xcc;return function(_0x5f1516){if(_0x5f1516){return _0x4414a0[_0x3798('0x15')](_0x529071);}return _0x4414a0['status'](_0x529071)[_0x3798('0x16')]();};}function respondWithResult(_0x1b6578,_0x23ebf9){_0x23ebf9=_0x23ebf9||0xc8;return function(_0x198f6f){if(_0x198f6f){return _0x1b6578[_0x3798('0x17')](_0x23ebf9)[_0x3798('0x18')](_0x198f6f);}};}function respondWithFilteredResult(_0xafad6d,_0x866584){return function(_0x2a1849){if(_0x2a1849){var _0x2fc5dd=typeof _0x866584[_0x3798('0x19')]==='undefined'&&typeof _0x866584[_0x3798('0x1a')]===_0x3798('0x1b');var _0x157c06=_0x2a1849[_0x3798('0x1c')];var _0x3bf7a0=_0x2fc5dd?0x0:_0x866584['offset'];var _0x16684e=_0x2fc5dd?_0x2a1849[_0x3798('0x1c')]:_0x866584['offset']+_0x866584[_0x3798('0x1a')];var _0x104bda;if(_0x16684e>=_0x157c06){_0x16684e=_0x157c06;_0x104bda=0xc8;}else{_0x104bda=0xce;}_0xafad6d[_0x3798('0x17')](_0x104bda);return _0xafad6d[_0x3798('0x1d')](_0x3798('0x1e'),_0x3bf7a0+'-'+_0x16684e+'/'+_0x157c06)[_0x3798('0x18')](_0x2a1849);}return null;};}function patchUpdates(_0x4dbf60){return function(_0x486a19){try{jsonpatch[_0x3798('0x1f')](_0x486a19,_0x4dbf60,!![]);}catch(_0xc556b7){return BPromise[_0x3798('0x20')](_0xc556b7);}return _0x486a19['save']();};}function saveUpdates(_0x174c0d,_0x3def9b){return function(_0x1675b6){if(_0x1675b6){return _0x1675b6[_0x3798('0x21')](_0x174c0d)[_0x3798('0x22')](function(_0xcad056){return _0xcad056;});}return null;};}function removeEntity(_0x4ec188,_0x531a59){return function(_0x946a26){if(_0x946a26){return _0x946a26[_0x3798('0x23')]()[_0x3798('0x22')](function(){_0x4ec188[_0x3798('0x17')](0xcc)[_0x3798('0x16')]();});}};}function handleEntityNotFound(_0x38de06,_0x43daa9){return function(_0x461bd9){if(!_0x461bd9){_0x38de06[_0x3798('0x15')](0x194);}return _0x461bd9;};}function handleError(_0x1c9641,_0x592f04){_0x592f04=_0x592f04||0x1f4;return function(_0x5bf81b){logger[_0x3798('0x24')](_0x5bf81b[_0x3798('0x25')]);if(_0x5bf81b[_0x3798('0x26')]){delete _0x5bf81b[_0x3798('0x26')];}_0x1c9641[_0x3798('0x17')](_0x592f04)[_0x3798('0x27')](_0x5bf81b);};}exports[_0x3798('0x28')]=function(_0x484365,_0x50abd9){var _0x581ad1={},_0x20f633={},_0x1e57b0={'count':0x0,'rows':[]};var _0x4b7115=_[_0x3798('0x29')](db['ServicenowConfiguration'][_0x3798('0x2a')],function(_0x2b789a){return{'name':_0x2b789a['fieldName'],'type':_0x2b789a['type'][_0x3798('0x2b')]};});_0x20f633[_0x3798('0x2c')]=_[_0x3798('0x29')](_0x4b7115,'name');_0x20f633[_0x3798('0x2d')]=_['keys'](_0x484365[_0x3798('0x2d')]);_0x20f633['filters']=_['intersection'](_0x20f633[_0x3798('0x2c')],_0x20f633['query']);_0x581ad1[_0x3798('0x2e')]=_['intersection'](_0x20f633['model'],qs[_0x3798('0x2f')](_0x484365[_0x3798('0x2d')][_0x3798('0x2f')]));_0x581ad1['attributes']=_0x581ad1[_0x3798('0x2e')]['length']?_0x581ad1[_0x3798('0x2e')]:_0x20f633[_0x3798('0x2c')];if(!_0x484365['query']['hasOwnProperty'](_0x3798('0x30'))){_0x581ad1[_0x3798('0x1a')]=qs['limit'](_0x484365['query']['limit']);_0x581ad1[_0x3798('0x19')]=qs[_0x3798('0x19')](_0x484365['query'][_0x3798('0x19')]);}_0x581ad1[_0x3798('0x31')]=qs['sort'](_0x484365['query'][_0x3798('0x32')]);_0x581ad1['where']=qs[_0x3798('0x33')](_[_0x3798('0x34')](_0x484365[_0x3798('0x2d')],_0x20f633[_0x3798('0x33')]),_0x4b7115);if(_0x484365[_0x3798('0x2d')]['filter']){_0x581ad1[_0x3798('0x35')]=_[_0x3798('0x36')](_0x581ad1['where'],{'$or':_[_0x3798('0x29')](_0x4b7115,function(_0x37dba4){if(_0x37dba4[_0x3798('0x37')]!==_0x3798('0x38')){var _0x50786d={};_0x50786d[_0x37dba4['name']]={'$like':'%'+_0x484365[_0x3798('0x2d')][_0x3798('0x39')]+'%'};return _0x50786d;}})});}_0x581ad1=_[_0x3798('0x36')]({},_0x581ad1,_0x484365[_0x3798('0x3a')]);var _0x326289={'where':_0x581ad1['where']};return db[_0x3798('0x3b')][_0x3798('0x1c')](_0x326289)[_0x3798('0x22')](function(_0x28847c){_0x1e57b0[_0x3798('0x1c')]=_0x28847c;if(_0x484365[_0x3798('0x2d')]['includeAll']){_0x581ad1[_0x3798('0x3c')]=[{'all':!![]}];}return db[_0x3798('0x3b')]['findAll'](_0x581ad1);})['then'](function(_0x355437){_0x1e57b0['rows']=_0x355437;return _0x1e57b0;})['then'](respondWithFilteredResult(_0x50abd9,_0x581ad1))['catch'](handleError(_0x50abd9,null));};exports[_0x3798('0x3d')]=function(_0x1b0965,_0x5935a3){var _0x31cb4e={'raw':![],'where':{'id':_0x1b0965[_0x3798('0x3e')]['id']}},_0x505d71={};_0x505d71[_0x3798('0x2c')]=_[_0x3798('0x3f')](db['ServicenowConfiguration'][_0x3798('0x2a')]);_0x505d71[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x1b0965[_0x3798('0x2d')]);_0x505d71['filters']=_[_0x3798('0x40')](_0x505d71['model'],_0x505d71['query']);_0x31cb4e['attributes']=_[_0x3798('0x40')](_0x505d71[_0x3798('0x2c')],qs['fields'](_0x1b0965[_0x3798('0x2d')][_0x3798('0x2f')]));_0x31cb4e[_0x3798('0x2e')]=_0x31cb4e[_0x3798('0x2e')][_0x3798('0x41')]?_0x31cb4e[_0x3798('0x2e')]:_0x505d71[_0x3798('0x2c')];if(_0x1b0965[_0x3798('0x2d')][_0x3798('0x42')]){_0x31cb4e['include']=[{'all':!![]}];}_0x31cb4e=_[_0x3798('0x36')]({},_0x31cb4e,_0x1b0965[_0x3798('0x3a')]);return db[_0x3798('0x3b')][_0x3798('0x43')](_0x31cb4e)['then'](handleEntityNotFound(_0x5935a3,null))[_0x3798('0x22')](respondWithResult(_0x5935a3,null))[_0x3798('0x44')](handleError(_0x5935a3,null));};exports[_0x3798('0x45')]=function(_0x25813e,_0x481ac9){return db[_0x3798('0x3b')][_0x3798('0x45')](_0x25813e[_0x3798('0x46')],{})[_0x3798('0x22')](respondWithResult(_0x481ac9,0xc9))[_0x3798('0x44')](handleError(_0x481ac9,null));};exports[_0x3798('0x21')]=function(_0x5aa9b6,_0x48e3e5){if(_0x5aa9b6['body']['id']){delete _0x5aa9b6[_0x3798('0x46')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x5aa9b6['params']['id']}})['then'](handleEntityNotFound(_0x48e3e5,null))['then'](saveUpdates(_0x5aa9b6[_0x3798('0x46')],null))[_0x3798('0x22')](respondWithResult(_0x48e3e5,null))[_0x3798('0x44')](handleError(_0x48e3e5,null));};exports[_0x3798('0x23')]=function(_0x524424,_0x16de99){return db[_0x3798('0x3b')][_0x3798('0x43')]({'where':{'id':_0x524424[_0x3798('0x3e')]['id']}})[_0x3798('0x22')](handleEntityNotFound(_0x16de99,null))[_0x3798('0x22')](removeEntity(_0x16de99,null))[_0x3798('0x44')](handleError(_0x16de99,null));};exports[_0x3798('0x47')]=function(_0x3b9664,_0x5c0808,_0x2150e5){var _0x24b991={};var _0x4f1201={};var _0x26db72;var _0x5b1b13;return db['ServicenowConfiguration'][_0x3798('0x48')]({'where':{'id':_0x3b9664[_0x3798('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5c0808,null))[_0x3798('0x22')](function(_0x41b8b3){if(_0x41b8b3){_0x26db72=_0x41b8b3;_0x4f1201[_0x3798('0x2c')]=_['keys'](db[_0x3798('0x49')][_0x3798('0x2a')]);_0x4f1201[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x3b9664[_0x3798('0x2d')]);_0x4f1201['filters']=_['intersection'](_0x4f1201[_0x3798('0x2c')],_0x4f1201['query']);_0x24b991['attributes']=_['intersection'](_0x4f1201[_0x3798('0x2c')],qs[_0x3798('0x2f')](_0x3b9664['query'][_0x3798('0x2f')]));_0x24b991[_0x3798('0x2e')]=_0x24b991[_0x3798('0x2e')][_0x3798('0x41')]?_0x24b991['attributes']:_0x4f1201['model'];_0x24b991[_0x3798('0x31')]=qs['sort'](_0x3b9664[_0x3798('0x2d')][_0x3798('0x32')]);_0x24b991[_0x3798('0x35')]=qs['filters'](_['pick'](_0x3b9664[_0x3798('0x2d')],_0x4f1201[_0x3798('0x33')]));if(_0x3b9664[_0x3798('0x2d')][_0x3798('0x39')]){_0x24b991[_0x3798('0x35')]=_[_0x3798('0x36')](_0x24b991[_0x3798('0x35')],{'$or':_[_0x3798('0x29')](_0x24b991[_0x3798('0x2e')],function(_0x290bed){var _0x2087eb={};_0x2087eb[_0x290bed]={'$like':'%'+_0x3b9664[_0x3798('0x2d')][_0x3798('0x39')]+'%'};return _0x2087eb;})});}_0x24b991=_[_0x3798('0x36')]({},_0x24b991,_0x3b9664[_0x3798('0x3a')]);return _0x26db72[_0x3798('0x47')](_0x24b991);}})[_0x3798('0x22')](function(_0x5dea39){if(_0x5dea39){_0x5b1b13=_0x5dea39[_0x3798('0x41')];if(!_0x3b9664[_0x3798('0x2d')]['hasOwnProperty'](_0x3798('0x30'))){_0x24b991[_0x3798('0x1a')]=qs[_0x3798('0x1a')](_0x3b9664[_0x3798('0x2d')]['limit']);_0x24b991[_0x3798('0x19')]=qs['offset'](_0x3b9664['query'][_0x3798('0x19')]);}return _0x26db72[_0x3798('0x47')](_0x24b991);}})[_0x3798('0x22')](function(_0xba7d61){if(_0xba7d61){return _0xba7d61?{'count':_0x5b1b13,'rows':_0xba7d61}:null;}})[_0x3798('0x22')](respondWithResult(_0x5c0808,null))['catch'](handleError(_0x5c0808,null));};exports[_0x3798('0x4a')]=function(_0x596f42,_0x2a048a,_0x29ddb6){var _0x232fc0={};var _0x39c39f={};var _0x2304b6;var _0x1bf92a;return db[_0x3798('0x3b')][_0x3798('0x48')]({'where':{'id':_0x596f42[_0x3798('0x3e')]['id']}})[_0x3798('0x22')](handleEntityNotFound(_0x2a048a,null))['then'](function(_0x307305){if(_0x307305){_0x2304b6=_0x307305;_0x39c39f[_0x3798('0x2c')]=_[_0x3798('0x3f')](db[_0x3798('0x49')][_0x3798('0x2a')]);_0x39c39f[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x596f42[_0x3798('0x2d')]);_0x39c39f[_0x3798('0x33')]=_[_0x3798('0x40')](_0x39c39f[_0x3798('0x2c')],_0x39c39f[_0x3798('0x2d')]);_0x232fc0[_0x3798('0x2e')]=_['intersection'](_0x39c39f['model'],qs['fields'](_0x596f42['query'][_0x3798('0x2f')]));_0x232fc0[_0x3798('0x2e')]=_0x232fc0[_0x3798('0x2e')][_0x3798('0x41')]?_0x232fc0['attributes']:_0x39c39f[_0x3798('0x2c')];_0x232fc0[_0x3798('0x31')]=qs[_0x3798('0x32')](_0x596f42['query'][_0x3798('0x32')]);_0x232fc0[_0x3798('0x35')]=qs[_0x3798('0x33')](_[_0x3798('0x34')](_0x596f42[_0x3798('0x2d')],_0x39c39f[_0x3798('0x33')]));if(_0x596f42[_0x3798('0x2d')][_0x3798('0x39')]){_0x232fc0[_0x3798('0x35')]=_['merge'](_0x232fc0[_0x3798('0x35')],{'$or':_[_0x3798('0x29')](_0x232fc0[_0x3798('0x2e')],function(_0x905b4d){var _0x133f21={};_0x133f21[_0x905b4d]={'$like':'%'+_0x596f42[_0x3798('0x2d')]['filter']+'%'};return _0x133f21;})});}_0x232fc0=_[_0x3798('0x36')]({},_0x232fc0,_0x596f42[_0x3798('0x3a')]);return _0x2304b6[_0x3798('0x4a')](_0x232fc0);}})[_0x3798('0x22')](function(_0x2a07e9){if(_0x2a07e9){_0x1bf92a=_0x2a07e9['length'];if(!_0x596f42[_0x3798('0x2d')][_0x3798('0x4b')](_0x3798('0x30'))){_0x232fc0[_0x3798('0x1a')]=qs[_0x3798('0x1a')](_0x596f42[_0x3798('0x2d')]['limit']);_0x232fc0[_0x3798('0x19')]=qs[_0x3798('0x19')](_0x596f42[_0x3798('0x2d')][_0x3798('0x19')]);}return _0x2304b6[_0x3798('0x4a')](_0x232fc0);}})['then'](function(_0x1d343f){if(_0x1d343f){return _0x1d343f?{'count':_0x1bf92a,'rows':_0x1d343f}:null;}})[_0x3798('0x22')](respondWithResult(_0x2a048a,null))['catch'](handleError(_0x2a048a,null));};exports['getDescriptions']=function(_0x3fa104,_0x16c06b,_0x2d35ed){var _0x1d400c={};var _0x4905df={};var _0x474d31;var _0x39eaab;return db[_0x3798('0x3b')]['findOne']({'where':{'id':_0x3fa104[_0x3798('0x3e')]['id']}})[_0x3798('0x22')](handleEntityNotFound(_0x16c06b,null))[_0x3798('0x22')](function(_0x41ab63){if(_0x41ab63){_0x474d31=_0x41ab63;_0x4905df[_0x3798('0x2c')]=_[_0x3798('0x3f')](db[_0x3798('0x49')][_0x3798('0x2a')]);_0x4905df[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x3fa104[_0x3798('0x2d')]);_0x4905df[_0x3798('0x33')]=_['intersection'](_0x4905df['model'],_0x4905df['query']);_0x1d400c[_0x3798('0x2e')]=_[_0x3798('0x40')](_0x4905df[_0x3798('0x2c')],qs[_0x3798('0x2f')](_0x3fa104['query'][_0x3798('0x2f')]));_0x1d400c[_0x3798('0x2e')]=_0x1d400c[_0x3798('0x2e')][_0x3798('0x41')]?_0x1d400c[_0x3798('0x2e')]:_0x4905df[_0x3798('0x2c')];_0x1d400c['order']=qs[_0x3798('0x32')](_0x3fa104[_0x3798('0x2d')][_0x3798('0x32')]);_0x1d400c[_0x3798('0x35')]=qs[_0x3798('0x33')](_[_0x3798('0x34')](_0x3fa104[_0x3798('0x2d')],_0x4905df[_0x3798('0x33')]));if(_0x3fa104[_0x3798('0x2d')]['filter']){_0x1d400c['where']=_[_0x3798('0x36')](_0x1d400c[_0x3798('0x35')],{'$or':_['map'](_0x1d400c['attributes'],function(_0x48fdf4){var _0x59b508={};_0x59b508[_0x48fdf4]={'$like':'%'+_0x3fa104[_0x3798('0x2d')][_0x3798('0x39')]+'%'};return _0x59b508;})});}_0x1d400c=_[_0x3798('0x36')]({},_0x1d400c,_0x3fa104[_0x3798('0x3a')]);return _0x474d31['getDescriptions'](_0x1d400c);}})[_0x3798('0x22')](function(_0x42ed69){if(_0x42ed69){_0x39eaab=_0x42ed69[_0x3798('0x41')];if(!_0x3fa104[_0x3798('0x2d')][_0x3798('0x4b')](_0x3798('0x30'))){_0x1d400c[_0x3798('0x1a')]=qs['limit'](_0x3fa104[_0x3798('0x2d')][_0x3798('0x1a')]);_0x1d400c[_0x3798('0x19')]=qs[_0x3798('0x19')](_0x3fa104['query'][_0x3798('0x19')]);}return _0x474d31['getDescriptions'](_0x1d400c);}})['then'](function(_0x2add77){if(_0x2add77){return _0x2add77?{'count':_0x39eaab,'rows':_0x2add77}:null;}})[_0x3798('0x22')](respondWithResult(_0x16c06b,null))[_0x3798('0x44')](handleError(_0x16c06b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 16a4fa7..3e38813 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 _0x263f=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x263f,0x182));var _0xf263=function(_0x943974,_0x585469){_0x943974=_0x943974-0x0;var _0x45a6bd=_0x263f[_0x943974];return _0x45a6bd;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var logger=require(_0xf263('0x2'))(_0xf263('0x3'));var moment=require(_0xf263('0x4'));var BPromise=require(_0xf263('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf263('0x6'));var rimraf=require(_0xf263('0x7'));var config=require(_0xf263('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xf263('0x9')]=function(_0xdb2fc1,_0x4c7ab2){return _0xdb2fc1['define'](_0xf263('0xa'),attributes,{'tableName':_0xf263('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7fa=['exports','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var attributes=require(_0xaa7f('0x7'));module[_0xaa7f('0x8')]=function(_0x48e98f,_0xf79d63){return _0x48e98f['define']('ServicenowConfiguration',attributes,{'tableName':_0xaa7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 83c85e6..2d7d743 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 _0x038f=['info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1db7fb,_0x54396b){var _0x5dd4c7=function(_0x4ad82b){while(--_0x4ad82b){_0x1db7fb['push'](_0x1db7fb['shift']());}};_0x5dd4c7(++_0x54396b);}(_0x038f,0xf4));var _0xf038=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x038f[_0x3fa296];return _0x10b19f;};'use strict';var _=require(_0xf038('0x0'));var util=require(_0xf038('0x1'));var moment=require(_0xf038('0x2'));var BPromise=require(_0xf038('0x3'));var rs=require(_0xf038('0x4'));var fs=require('fs');var Redis=require(_0xf038('0x5'));var db=require(_0xf038('0x6'))['db'];var utils=require(_0xf038('0x7'));var logger=require(_0xf038('0x8'))(_0xf038('0x9'));var config=require(_0xf038('0xa'));var jayson=require(_0xf038('0xb'));var client=jayson[_0xf038('0xc')][_0xf038('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4d1408,_0x1c74f6,_0xfb39a8){return new BPromise(function(_0x4eb42,_0x55750d){return client[_0xf038('0xe')](_0x4d1408,_0xfb39a8)[_0xf038('0xf')](function(_0x2faf90){logger[_0xf038('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c74f6,_0xf038('0x11'));logger[_0xf038('0x12')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1c74f6,_0xf038('0x11'),JSON[_0xf038('0x13')](_0x2faf90));if(_0x2faf90['error']){if(_0x2faf90[_0xf038('0x14')][_0xf038('0x15')]===0x1f4){logger[_0xf038('0x14')](_0xf038('0x16'),_0x1c74f6,_0x2faf90[_0xf038('0x14')][_0xf038('0x17')]);return _0x55750d(_0x2faf90['error'][_0xf038('0x17')]);}logger[_0xf038('0x14')](_0xf038('0x16'),_0x1c74f6,_0x2faf90['error'][_0xf038('0x17')]);return _0x4eb42(_0x2faf90[_0xf038('0x14')][_0xf038('0x17')]);}else{logger[_0xf038('0x10')](_0xf038('0x16'),_0x1c74f6,_0xf038('0x11'));_0x4eb42(_0x2faf90[_0xf038('0x18')]['message']);}})[_0xf038('0x19')](function(_0xbf21b5){logger[_0xf038('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c74f6,_0xbf21b5);_0x55750d(_0xbf21b5);});});} \ No newline at end of file +var _0x169c=['info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x1730ae,_0x1b3871){var _0x5de173=function(_0x2ce5ea){while(--_0x2ce5ea){_0x1730ae['push'](_0x1730ae['shift']());}};_0x5de173(++_0x1b3871);}(_0x169c,0xe3));var _0xc169=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x169c[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var moment=require(_0xc169('0x2'));var BPromise=require(_0xc169('0x3'));var rs=require(_0xc169('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc169('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc169('0x6'))(_0xc169('0x7'));var config=require(_0xc169('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc169('0x9')][_0xc169('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c5f45,_0x48d0b8,_0x11a4ee){return new BPromise(function(_0x19d93b,_0x4c1d7a){return client[_0xc169('0xb')](_0x2c5f45,_0x11a4ee)[_0xc169('0xc')](function(_0x1f8712){logger[_0xc169('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x48d0b8,_0xc169('0xe'));logger[_0xc169('0xf')](_0xc169('0x10'),_0x48d0b8,_0xc169('0xe'),JSON[_0xc169('0x11')](_0x1f8712));if(_0x1f8712[_0xc169('0x12')]){if(_0x1f8712[_0xc169('0x12')][_0xc169('0x13')]===0x1f4){logger[_0xc169('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x48d0b8,_0x1f8712['error'][_0xc169('0x14')]);return _0x4c1d7a(_0x1f8712[_0xc169('0x12')][_0xc169('0x14')]);}logger['error'](_0xc169('0x15'),_0x48d0b8,_0x1f8712[_0xc169('0x12')][_0xc169('0x14')]);return _0x19d93b(_0x1f8712[_0xc169('0x12')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x48d0b8,'request\x20sent');_0x19d93b(_0x1f8712[_0xc169('0x16')][_0xc169('0x14')]);}})[_0xc169('0x17')](function(_0x2fe7c4){logger['error'](_0xc169('0x15'),_0x48d0b8,_0x2fe7c4);_0x4c1d7a(_0x2fe7c4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a9fbb3b..9f5b966 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 _0x930c=['isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x930c,0x1ac));var _0xc930=function(_0x4dafa5,_0x31ab97){_0x4dafa5=_0x4dafa5-0x0;var _0x4ad399=_0x930c[_0x4dafa5];return _0x4ad399;};'use strict';var multer=require(_0xc930('0x0'));var util=require(_0xc930('0x1'));var path=require(_0xc930('0x2'));var timeout=require('connect-timeout');var express=require(_0xc930('0x3'));var router=express[_0xc930('0x4')]();var fs_extra=require(_0xc930('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc930('0x6'));var config=require(_0xc930('0x7'));var controller=require(_0xc930('0x8'));router[_0xc930('0x9')]('/',auth['isAuthenticated'](),controller[_0xc930('0xa')]);router[_0xc930('0x9')](_0xc930('0xb'),auth[_0xc930('0xc')](),controller[_0xc930('0xd')]);router[_0xc930('0xe')]('/',auth[_0xc930('0xc')](),controller[_0xc930('0xf')]);router[_0xc930('0x10')](_0xc930('0xb'),auth[_0xc930('0xc')](),controller[_0xc930('0x11')]);router['delete'](_0xc930('0xb'),auth[_0xc930('0xc')](),controller[_0xc930('0x12')]);module[_0xc930('0x13')]=router; \ No newline at end of file +var _0x5c87=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','update','delete'];(function(_0x504801,_0x483bd1){var _0x237d10=function(_0x57256a){while(--_0x57256a){_0x504801['push'](_0x504801['shift']());}};_0x237d10(++_0x483bd1);}(_0x5c87,0x1b7));var _0x75c8=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x5c87[_0x454165];return _0x56db53;};'use strict';var multer=require(_0x75c8('0x0'));var util=require('util');var path=require(_0x75c8('0x1'));var timeout=require(_0x75c8('0x2'));var express=require(_0x75c8('0x3'));var router=express[_0x75c8('0x4')]();var fs_extra=require(_0x75c8('0x5'));var auth=require(_0x75c8('0x6'));var interaction=require(_0x75c8('0x7'));var config=require(_0x75c8('0x8'));var controller=require(_0x75c8('0x9'));router['get']('/',auth[_0x75c8('0xa')](),controller[_0x75c8('0xb')]);router[_0x75c8('0xc')](_0x75c8('0xd'),auth[_0x75c8('0xa')](),controller[_0x75c8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x75c8('0xa')](),controller[_0x75c8('0xf')]);router[_0x75c8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x75c8('0x11')]);module[_0x75c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6710fa8..29c6dc4 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 _0xa9a3=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa9a3,0xc1));var _0x3a9a=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xa9a3[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0x3a9a('0x0'));module[_0x3a9a('0x1')]={'type':{'type':Sequelize[_0x3a9a('0x2')](_0x3a9a('0x3'),'variable',_0x3a9a('0x4'),_0x3a9a('0x5'),_0x3a9a('0x6')),'defaultValue':_0x3a9a('0x3')},'content':{'type':Sequelize[_0x3a9a('0x7')]},'key':{'type':Sequelize[_0x3a9a('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3a9a('0x3'),_0x3a9a('0x8'),_0x3a9a('0x4'))},'keyContent':{'type':Sequelize[_0x3a9a('0x7')]},'idField':{'type':Sequelize[_0x3a9a('0x7')]},'nameField':{'type':Sequelize[_0x3a9a('0x7')]},'customField':{'type':Sequelize[_0x3a9a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5925=['sequelize','string','picklist','STRING','customVariable'];(function(_0x4e88de,_0xa524e6){var _0x1e8c31=function(_0x249b88){while(--_0x249b88){_0x4e88de['push'](_0x4e88de['shift']());}};_0x1e8c31(++_0xa524e6);}(_0x5925,0x140));var _0x5592=function(_0x348681,_0x486a1d){_0x348681=_0x348681-0x0;var _0x30d4b7=_0x5925[_0x348681];return _0x30d4b7;};'use strict';var Sequelize=require(_0x5592('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5592('0x1'),'variable','customVariable','keyValue',_0x5592('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5592('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x5592('0x1'),'variable',_0x5592('0x4'))},'keyContent':{'type':Sequelize[_0x5592('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5592('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5592('0x3')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 489cf53..1cae438 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 _0x381f=['then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x38d8f8,_0x1d7e9c){var _0x38ef33=function(_0x4f258){while(--_0x4f258){_0x38d8f8['push'](_0x38d8f8['shift']());}};_0x38ef33(++_0x1d7e9c);}(_0x381f,0x13b));var _0xf381=function(_0x56511e,_0x2d9192){_0x56511e=_0x56511e-0x0;var _0xf2ebf1=_0x381f[_0x56511e];return _0xf2ebf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf381('0x0'));var zipdir=require(_0xf381('0x1'));var jsonpatch=require(_0xf381('0x2'));var rp=require(_0xf381('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf381('0x4'));var path=require('path');var sox=require(_0xf381('0x5'));var csv=require(_0xf381('0x6'));var ejs=require(_0xf381('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf381('0x8'));var squel=require(_0xf381('0x9'));var crypto=require(_0xf381('0xa'));var jsforce=require(_0xf381('0xb'));var deskjs=require(_0xf381('0xc'));var toCsv=require(_0xf381('0x6'));var querystring=require(_0xf381('0xd'));var Papa=require(_0xf381('0xe'));var Redis=require(_0xf381('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf381('0x10'));var as=require(_0xf381('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf381('0x12'));var utils=require(_0xf381('0x13'));var config=require(_0xf381('0x14'));var licenseUtil=require(_0xf381('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd929,_0xb40872){_0xb40872=_0xb40872||0xcc;return function(_0xbd570e){if(_0xbd570e){return _0x5dd929[_0xf381('0x16')](_0xb40872);}return _0x5dd929['status'](_0xb40872)[_0xf381('0x17')]();};}function respondWithResult(_0x4eb353,_0x34c9cb){_0x34c9cb=_0x34c9cb||0xc8;return function(_0x3cbc18){if(_0x3cbc18){return _0x4eb353[_0xf381('0x18')](_0x34c9cb)[_0xf381('0x19')](_0x3cbc18);}};}function respondWithFilteredResult(_0x407549,_0xe00414){return function(_0x4c7176){if(_0x4c7176){var _0x246395=typeof _0xe00414[_0xf381('0x1a')]===_0xf381('0x1b')&&typeof _0xe00414[_0xf381('0x1c')]===_0xf381('0x1b');var _0x105d2b=_0x4c7176[_0xf381('0x1d')];var _0x11fdb1=_0x246395?0x0:_0xe00414['offset'];var _0x350ffa=_0x246395?_0x4c7176[_0xf381('0x1d')]:_0xe00414[_0xf381('0x1a')]+_0xe00414[_0xf381('0x1c')];var _0x3a1338;if(_0x350ffa>=_0x105d2b){_0x350ffa=_0x105d2b;_0x3a1338=0xc8;}else{_0x3a1338=0xce;}_0x407549['status'](_0x3a1338);return _0x407549[_0xf381('0x1e')](_0xf381('0x1f'),_0x11fdb1+'-'+_0x350ffa+'/'+_0x105d2b)[_0xf381('0x19')](_0x4c7176);}return null;};}function patchUpdates(_0x172baf){return function(_0x39db71){try{jsonpatch['apply'](_0x39db71,_0x172baf,!![]);}catch(_0x51c058){return BPromise[_0xf381('0x20')](_0x51c058);}return _0x39db71[_0xf381('0x21')]();};}function saveUpdates(_0x4ff0f6,_0x505f1f){return function(_0x49174c){if(_0x49174c){return _0x49174c[_0xf381('0x22')](_0x4ff0f6)[_0xf381('0x23')](function(_0x471306){return _0x471306;});}return null;};}function removeEntity(_0x1e3dd6,_0x371326){return function(_0x470a0c){if(_0x470a0c){return _0x470a0c[_0xf381('0x24')]()[_0xf381('0x23')](function(){_0x1e3dd6[_0xf381('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145df5,_0x23b597){return function(_0x8f7091){if(!_0x8f7091){_0x145df5[_0xf381('0x16')](0x194);}return _0x8f7091;};}function handleError(_0xc98706,_0xa0a4df){_0xa0a4df=_0xa0a4df||0x1f4;return function(_0x109199){logger[_0xf381('0x25')](_0x109199[_0xf381('0x26')]);if(_0x109199[_0xf381('0x27')]){delete _0x109199[_0xf381('0x27')];}_0xc98706['status'](_0xa0a4df)['send'](_0x109199);};}exports[_0xf381('0x28')]=function(_0x3ea9ce,_0x3905ec){var _0x22be29={},_0x4fd00c={},_0x2adb46={'count':0x0,'rows':[]};var _0x180f5d=_[_0xf381('0x29')](db[_0xf381('0x2a')][_0xf381('0x2b')],function(_0x3ac7de){return{'name':_0x3ac7de['fieldName'],'type':_0x3ac7de[_0xf381('0x2c')][_0xf381('0x2d')]};});_0x4fd00c['model']=_[_0xf381('0x29')](_0x180f5d,'name');_0x4fd00c[_0xf381('0x2e')]=_[_0xf381('0x2f')](_0x3ea9ce[_0xf381('0x2e')]);_0x4fd00c[_0xf381('0x30')]=_[_0xf381('0x31')](_0x4fd00c[_0xf381('0x32')],_0x4fd00c[_0xf381('0x2e')]);_0x22be29[_0xf381('0x33')]=_[_0xf381('0x31')](_0x4fd00c[_0xf381('0x32')],qs[_0xf381('0x34')](_0x3ea9ce[_0xf381('0x2e')][_0xf381('0x34')]));_0x22be29[_0xf381('0x33')]=_0x22be29[_0xf381('0x33')][_0xf381('0x35')]?_0x22be29[_0xf381('0x33')]:_0x4fd00c['model'];if(!_0x3ea9ce[_0xf381('0x2e')][_0xf381('0x36')]('nolimit')){_0x22be29['limit']=qs[_0xf381('0x1c')](_0x3ea9ce[_0xf381('0x2e')][_0xf381('0x1c')]);_0x22be29[_0xf381('0x1a')]=qs[_0xf381('0x1a')](_0x3ea9ce['query'][_0xf381('0x1a')]);}_0x22be29[_0xf381('0x37')]=qs['sort'](_0x3ea9ce[_0xf381('0x2e')][_0xf381('0x38')]);_0x22be29[_0xf381('0x39')]=qs[_0xf381('0x30')](_['pick'](_0x3ea9ce['query'],_0x4fd00c[_0xf381('0x30')]),_0x180f5d);if(_0x3ea9ce[_0xf381('0x2e')]['filter']){_0x22be29[_0xf381('0x39')]=_['merge'](_0x22be29['where'],{'$or':_[_0xf381('0x29')](_0x180f5d,function(_0x30fa70){if(_0x30fa70[_0xf381('0x2c')]!==_0xf381('0x3a')){var _0x3d0d29={};_0x3d0d29[_0x30fa70[_0xf381('0x27')]]={'$like':'%'+_0x3ea9ce[_0xf381('0x2e')]['filter']+'%'};return _0x3d0d29;}})});}_0x22be29=_[_0xf381('0x3b')]({},_0x22be29,_0x3ea9ce[_0xf381('0x3c')]);var _0x21d0a6={'where':_0x22be29[_0xf381('0x39')]};return db[_0xf381('0x2a')]['count'](_0x21d0a6)['then'](function(_0x48e9bf){_0x2adb46[_0xf381('0x1d')]=_0x48e9bf;if(_0x3ea9ce[_0xf381('0x2e')]['includeAll']){_0x22be29['include']=[{'all':!![]}];}return db[_0xf381('0x2a')][_0xf381('0x3d')](_0x22be29);})[_0xf381('0x23')](function(_0x2b065f){_0x2adb46[_0xf381('0x3e')]=_0x2b065f;return _0x2adb46;})[_0xf381('0x23')](respondWithFilteredResult(_0x3905ec,_0x22be29))[_0xf381('0x3f')](handleError(_0x3905ec,null));};exports[_0xf381('0x40')]=function(_0x2a4a7a,_0x50004b){var _0x3c0587={'raw':!![],'where':{'id':_0x2a4a7a[_0xf381('0x41')]['id']}},_0x38ddf3={};_0x38ddf3[_0xf381('0x32')]=_[_0xf381('0x2f')](db[_0xf381('0x2a')][_0xf381('0x2b')]);_0x38ddf3['query']=_['keys'](_0x2a4a7a[_0xf381('0x2e')]);_0x38ddf3[_0xf381('0x30')]=_[_0xf381('0x31')](_0x38ddf3[_0xf381('0x32')],_0x38ddf3['query']);_0x3c0587[_0xf381('0x33')]=_['intersection'](_0x38ddf3[_0xf381('0x32')],qs['fields'](_0x2a4a7a[_0xf381('0x2e')][_0xf381('0x34')]));_0x3c0587['attributes']=_0x3c0587[_0xf381('0x33')][_0xf381('0x35')]?_0x3c0587[_0xf381('0x33')]:_0x38ddf3[_0xf381('0x32')];if(_0x2a4a7a['query'][_0xf381('0x42')]){_0x3c0587['include']=[{'all':!![]}];}_0x3c0587=_['merge']({},_0x3c0587,_0x2a4a7a[_0xf381('0x3c')]);return db['ServicenowField'][_0xf381('0x43')](_0x3c0587)[_0xf381('0x23')](handleEntityNotFound(_0x50004b,null))[_0xf381('0x23')](respondWithResult(_0x50004b,null))['catch'](handleError(_0x50004b,null));};exports[_0xf381('0x44')]=function(_0xe3193d,_0x2d9e47){return db[_0xf381('0x2a')][_0xf381('0x44')](_0xe3193d['body'],{})[_0xf381('0x23')](respondWithResult(_0x2d9e47,0xc9))[_0xf381('0x3f')](handleError(_0x2d9e47,null));};exports[_0xf381('0x22')]=function(_0x1c8e9e,_0x14826d){if(_0x1c8e9e[_0xf381('0x45')]['id']){delete _0x1c8e9e['body']['id'];}return db['ServicenowField'][_0xf381('0x43')]({'where':{'id':_0x1c8e9e[_0xf381('0x41')]['id']}})[_0xf381('0x23')](handleEntityNotFound(_0x14826d,null))[_0xf381('0x23')](saveUpdates(_0x1c8e9e[_0xf381('0x45')],null))[_0xf381('0x23')](respondWithResult(_0x14826d,null))[_0xf381('0x3f')](handleError(_0x14826d,null));};exports[_0xf381('0x24')]=function(_0x5855ea,_0x411341){return db[_0xf381('0x2a')]['find']({'where':{'id':_0x5855ea[_0xf381('0x41')]['id']}})[_0xf381('0x23')](handleEntityNotFound(_0x411341,null))['then'](removeEntity(_0x411341,null))['catch'](handleError(_0x411341,null));}; \ No newline at end of file +var _0x9163=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','index','map','ServicenowField','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','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'];(function(_0x37470c,_0x4f7bab){var _0x1853f0=function(_0x2f078b){while(--_0x2f078b){_0x37470c['push'](_0x37470c['shift']());}};_0x1853f0(++_0x4f7bab);}(_0x9163,0xcd));var _0x3916=function(_0x2041f7,_0x49509d){_0x2041f7=_0x2041f7-0x0;var _0x3fbc1b=_0x9163[_0x2041f7];return _0x3fbc1b;};'use strict';var emlformat=require(_0x3916('0x0'));var rimraf=require(_0x3916('0x1'));var zipdir=require(_0x3916('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3916('0x3'));var util=require(_0x3916('0x4'));var path=require('path');var sox=require(_0x3916('0x5'));var csv=require(_0x3916('0x6'));var ejs=require(_0x3916('0x7'));var fs=require('fs');var fs_extra=require(_0x3916('0x8'));var _=require(_0x3916('0x9'));var squel=require(_0x3916('0xa'));var crypto=require(_0x3916('0xb'));var jsforce=require(_0x3916('0xc'));var deskjs=require(_0x3916('0xd'));var toCsv=require(_0x3916('0x6'));var querystring=require(_0x3916('0xe'));var Papa=require(_0x3916('0xf'));var Redis=require(_0x3916('0x10'));var authService=require(_0x3916('0x11'));var qs=require(_0x3916('0x12'));var as=require(_0x3916('0x13'));var hardwareService=require(_0x3916('0x14'));var logger=require(_0x3916('0x15'))(_0x3916('0x16'));var utils=require(_0x3916('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3916('0x18'));var db=require(_0x3916('0x19'))['db'];function respondWithStatusCode(_0x122f71,_0x2e994a){_0x2e994a=_0x2e994a||0xcc;return function(_0x9cbc54){if(_0x9cbc54){return _0x122f71[_0x3916('0x1a')](_0x2e994a);}return _0x122f71[_0x3916('0x1b')](_0x2e994a)[_0x3916('0x1c')]();};}function respondWithResult(_0x1f77ec,_0x39bcfb){_0x39bcfb=_0x39bcfb||0xc8;return function(_0x3914c8){if(_0x3914c8){return _0x1f77ec[_0x3916('0x1b')](_0x39bcfb)['json'](_0x3914c8);}};}function respondWithFilteredResult(_0x5888b1,_0x5f4a1a){return function(_0x52718f){if(_0x52718f){var _0x3e00e3=typeof _0x5f4a1a[_0x3916('0x1d')]===_0x3916('0x1e')&&typeof _0x5f4a1a[_0x3916('0x1f')]===_0x3916('0x1e');var _0x476cdb=_0x52718f[_0x3916('0x20')];var _0x318387=_0x3e00e3?0x0:_0x5f4a1a[_0x3916('0x1d')];var _0x29069c=_0x3e00e3?_0x52718f['count']:_0x5f4a1a[_0x3916('0x1d')]+_0x5f4a1a[_0x3916('0x1f')];var _0x1d82fc;if(_0x29069c>=_0x476cdb){_0x29069c=_0x476cdb;_0x1d82fc=0xc8;}else{_0x1d82fc=0xce;}_0x5888b1[_0x3916('0x1b')](_0x1d82fc);return _0x5888b1['set'](_0x3916('0x21'),_0x318387+'-'+_0x29069c+'/'+_0x476cdb)[_0x3916('0x22')](_0x52718f);}return null;};}function patchUpdates(_0x23f33f){return function(_0x52d349){try{jsonpatch[_0x3916('0x23')](_0x52d349,_0x23f33f,!![]);}catch(_0x4e6ee5){return BPromise[_0x3916('0x24')](_0x4e6ee5);}return _0x52d349[_0x3916('0x25')]();};}function saveUpdates(_0x2703f5,_0x9950aa){return function(_0x5a9d9d){if(_0x5a9d9d){return _0x5a9d9d['update'](_0x2703f5)[_0x3916('0x26')](function(_0x2d9bfb){return _0x2d9bfb;});}return null;};}function removeEntity(_0x181ee8,_0x488159){return function(_0xfbfa33){if(_0xfbfa33){return _0xfbfa33['destroy']()['then'](function(){_0x181ee8[_0x3916('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d095,_0x2d33b6){return function(_0x15079b){if(!_0x15079b){_0x46d095['sendStatus'](0x194);}return _0x15079b;};}function handleError(_0x18b56c,_0x1d5301){_0x1d5301=_0x1d5301||0x1f4;return function(_0x3a5ebb){logger[_0x3916('0x27')](_0x3a5ebb[_0x3916('0x28')]);if(_0x3a5ebb[_0x3916('0x29')]){delete _0x3a5ebb[_0x3916('0x29')];}_0x18b56c[_0x3916('0x1b')](_0x1d5301)['send'](_0x3a5ebb);};}exports[_0x3916('0x2a')]=function(_0x23df0e,_0x16415a){var _0x2c9741={},_0x35734c={},_0x329016={'count':0x0,'rows':[]};var _0x548991=_[_0x3916('0x2b')](db[_0x3916('0x2c')]['rawAttributes'],function(_0x1d01bc){return{'name':_0x1d01bc['fieldName'],'type':_0x1d01bc[_0x3916('0x2d')][_0x3916('0x2e')]};});_0x35734c[_0x3916('0x2f')]=_[_0x3916('0x2b')](_0x548991,_0x3916('0x29'));_0x35734c[_0x3916('0x30')]=_['keys'](_0x23df0e['query']);_0x35734c[_0x3916('0x31')]=_[_0x3916('0x32')](_0x35734c['model'],_0x35734c[_0x3916('0x30')]);_0x2c9741[_0x3916('0x33')]=_[_0x3916('0x32')](_0x35734c[_0x3916('0x2f')],qs['fields'](_0x23df0e[_0x3916('0x30')][_0x3916('0x34')]));_0x2c9741[_0x3916('0x33')]=_0x2c9741[_0x3916('0x33')][_0x3916('0x35')]?_0x2c9741[_0x3916('0x33')]:_0x35734c['model'];if(!_0x23df0e['query'][_0x3916('0x36')](_0x3916('0x37'))){_0x2c9741[_0x3916('0x1f')]=qs[_0x3916('0x1f')](_0x23df0e[_0x3916('0x30')][_0x3916('0x1f')]);_0x2c9741[_0x3916('0x1d')]=qs[_0x3916('0x1d')](_0x23df0e[_0x3916('0x30')][_0x3916('0x1d')]);}_0x2c9741[_0x3916('0x38')]=qs[_0x3916('0x39')](_0x23df0e[_0x3916('0x30')]['sort']);_0x2c9741['where']=qs['filters'](_[_0x3916('0x3a')](_0x23df0e['query'],_0x35734c[_0x3916('0x31')]),_0x548991);if(_0x23df0e[_0x3916('0x30')][_0x3916('0x3b')]){_0x2c9741[_0x3916('0x3c')]=_[_0x3916('0x3d')](_0x2c9741['where'],{'$or':_['map'](_0x548991,function(_0x257ae2){if(_0x257ae2[_0x3916('0x2d')]!==_0x3916('0x3e')){var _0x5ca0a3={};_0x5ca0a3[_0x257ae2[_0x3916('0x29')]]={'$like':'%'+_0x23df0e[_0x3916('0x30')][_0x3916('0x3b')]+'%'};return _0x5ca0a3;}})});}_0x2c9741=_[_0x3916('0x3d')]({},_0x2c9741,_0x23df0e[_0x3916('0x3f')]);var _0x209fa5={'where':_0x2c9741['where']};return db[_0x3916('0x2c')]['count'](_0x209fa5)[_0x3916('0x26')](function(_0x5b8212){_0x329016['count']=_0x5b8212;if(_0x23df0e['query']['includeAll']){_0x2c9741[_0x3916('0x40')]=[{'all':!![]}];}return db[_0x3916('0x2c')][_0x3916('0x41')](_0x2c9741);})[_0x3916('0x26')](function(_0x1e66b1){_0x329016[_0x3916('0x42')]=_0x1e66b1;return _0x329016;})[_0x3916('0x26')](respondWithFilteredResult(_0x16415a,_0x2c9741))[_0x3916('0x43')](handleError(_0x16415a,null));};exports[_0x3916('0x44')]=function(_0xc328bb,_0x4b8637){var _0x23902e={'raw':!![],'where':{'id':_0xc328bb[_0x3916('0x45')]['id']}},_0x2de4e4={};_0x2de4e4['model']=_['keys'](db[_0x3916('0x2c')][_0x3916('0x46')]);_0x2de4e4[_0x3916('0x30')]=_['keys'](_0xc328bb['query']);_0x2de4e4[_0x3916('0x31')]=_[_0x3916('0x32')](_0x2de4e4['model'],_0x2de4e4['query']);_0x23902e[_0x3916('0x33')]=_['intersection'](_0x2de4e4[_0x3916('0x2f')],qs[_0x3916('0x34')](_0xc328bb['query'][_0x3916('0x34')]));_0x23902e[_0x3916('0x33')]=_0x23902e[_0x3916('0x33')]['length']?_0x23902e[_0x3916('0x33')]:_0x2de4e4[_0x3916('0x2f')];if(_0xc328bb['query'][_0x3916('0x47')]){_0x23902e[_0x3916('0x40')]=[{'all':!![]}];}_0x23902e=_[_0x3916('0x3d')]({},_0x23902e,_0xc328bb[_0x3916('0x3f')]);return db['ServicenowField'][_0x3916('0x48')](_0x23902e)[_0x3916('0x26')](handleEntityNotFound(_0x4b8637,null))[_0x3916('0x26')](respondWithResult(_0x4b8637,null))[_0x3916('0x43')](handleError(_0x4b8637,null));};exports[_0x3916('0x49')]=function(_0x25c84f,_0x33beba){return db['ServicenowField'][_0x3916('0x49')](_0x25c84f[_0x3916('0x4a')],{})[_0x3916('0x26')](respondWithResult(_0x33beba,0xc9))[_0x3916('0x43')](handleError(_0x33beba,null));};exports[_0x3916('0x4b')]=function(_0x55ae95,_0x36b769){if(_0x55ae95[_0x3916('0x4a')]['id']){delete _0x55ae95['body']['id'];}return db['ServicenowField'][_0x3916('0x48')]({'where':{'id':_0x55ae95['params']['id']}})['then'](handleEntityNotFound(_0x36b769,null))['then'](saveUpdates(_0x55ae95[_0x3916('0x4a')],null))[_0x3916('0x26')](respondWithResult(_0x36b769,null))[_0x3916('0x43')](handleError(_0x36b769,null));};exports['destroy']=function(_0xc20321,_0x662841){return db[_0x3916('0x2c')][_0x3916('0x48')]({'where':{'id':_0xc20321['params']['id']}})[_0x3916('0x26')](handleEntityNotFound(_0x662841,null))[_0x3916('0x26')](removeEntity(_0x662841,null))[_0x3916('0x43')](handleError(_0x662841,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index bde589a..9256fc5 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 _0x3b9f=['rimraf','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x248886,_0x221551){var _0x3f0957=function(_0x4e5670){while(--_0x4e5670){_0x248886['push'](_0x248886['shift']());}};_0x3f0957(++_0x221551);}(_0x3b9f,0x8b));var _0xf3b9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3b9f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf3b9('0x0'));var util=require('util');var logger=require(_0xf3b9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf3b9('0x2'));var rp=require(_0xf3b9('0x3'));var fs=require('fs');var path=require(_0xf3b9('0x4'));var rimraf=require(_0xf3b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf3b9('0x6'));module['exports']=function(_0x18be6e,_0x3b5492){return _0x18be6e['define'](_0xf3b9('0x7'),attributes,{'tableName':_0xf3b9('0x8'),'paranoid':![],'indexes':[{'name':_0xf3b9('0x9'),'fields':[_0xf3b9('0xa'),_0xf3b9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf571=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x21ca30,_0x1674a6){var _0x2655b9=function(_0xc08718){while(--_0xc08718){_0x21ca30['push'](_0x21ca30['shift']());}};_0x2655b9(++_0x1674a6);}(_0xf571,0xdf));var _0x1f57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf571[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1f57('0x0'));var util=require(_0x1f57('0x1'));var logger=require(_0x1f57('0x2'))(_0x1f57('0x3'));var moment=require('moment');var BPromise=require(_0x1f57('0x4'));var rp=require(_0x1f57('0x5'));var fs=require('fs');var path=require(_0x1f57('0x6'));var rimraf=require(_0x1f57('0x7'));var config=require(_0x1f57('0x8'));var attributes=require(_0x1f57('0x9'));module[_0x1f57('0xa')]=function(_0x33546c,_0x33fc83){return _0x33546c['define'](_0x1f57('0xb'),attributes,{'tableName':_0x1f57('0xc'),'paranoid':![],'indexes':[{'name':_0x1f57('0xd'),'fields':[_0x1f57('0xe'),_0x1f57('0xf')],'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 9ac77d7..6adad98 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x31fdc5,_0x222d09){var _0x5daf08=function(_0x4d3e30){while(--_0x4d3e30){_0x31fdc5['push'](_0x31fdc5['shift']());}};_0x5daf08(++_0x222d09);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xcb91[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1a1c45,_0x4fdc66){_0x1a1c45=_0x1a1c45-0x0;var _0x3dbd0f=_0xbdb7[_0x1a1c45];return _0x3dbd0f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1b9e925..e309295 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5d37aa,_0x263975){var _0x2ca2a7=function(_0x3d4481){while(--_0x3d4481){_0x5d37aa['push'](_0x5d37aa['shift']());}};_0x2ca2a7(++_0x263975);}(_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 +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(_0x412ea2,_0x28c2fa){var _0x3980d5=function(_0x24e3d2){while(--_0x24e3d2){_0x412ea2['push'](_0x412ea2['shift']());}};_0x3980d5(++_0x28c2fa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2063047..d3945d5 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(_0x57bce7,_0x3cceee){var _0x5f2389=function(_0x3f5e04){while(--_0x3f5e04){_0x57bce7['push'](_0x57bce7['shift']());}};_0x5f2389(++_0x3cceee);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x110f6f,_0x486ce8){var _0x2794bc=function(_0x13a3da){while(--_0x13a3da){_0x110f6f['push'](_0x110f6f['shift']());}};_0x2794bc(++_0x486ce8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 6ae395e..ec2c834 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 _0x8eee=['model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','merge','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','remoteUri','slice','substring','lastIndexOf','format','JSON','stringify','password','PLAIN','Invalid\x20Login','Password\x20Expired','POST','%s%s','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','includes','label','endsWith','values','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','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','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','name','send','index','map','SugarcrmAccount','fieldName','type','key'];(function(_0x25a756,_0x23752b){var _0x440fae=function(_0x3f6091){while(--_0x3f6091){_0x25a756['push'](_0x25a756['shift']());}};_0x440fae(++_0x23752b);}(_0x8eee,0x1c8));var _0xe8ee=function(_0x4bfd95,_0x1c3b3b){_0x4bfd95=_0x4bfd95-0x0;var _0x1484cd=_0x8eee[_0x4bfd95];return _0x1484cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8ee('0x0'));var jsonpatch=require(_0xe8ee('0x1'));var rp=require(_0xe8ee('0x2'));var moment=require(_0xe8ee('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe8ee('0x4'));var path=require(_0xe8ee('0x5'));var sox=require(_0xe8ee('0x6'));var csv=require('to-csv');var ejs=require(_0xe8ee('0x7'));var fs=require('fs');var fs_extra=require(_0xe8ee('0x8'));var _=require(_0xe8ee('0x9'));var squel=require(_0xe8ee('0xa'));var crypto=require('crypto');var jsforce=require(_0xe8ee('0xb'));var deskjs=require(_0xe8ee('0xc'));var toCsv=require(_0xe8ee('0xd'));var querystring=require(_0xe8ee('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8ee('0xf'));var qs=require(_0xe8ee('0x10'));var as=require(_0xe8ee('0x11'));var hardwareService=require(_0xe8ee('0x12'));var logger=require(_0xe8ee('0x13'))(_0xe8ee('0x14'));var utils=require(_0xe8ee('0x15'));var config=require(_0xe8ee('0x16'));var licenseUtil=require(_0xe8ee('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe8ee('0x18'));function respondWithStatusCode(_0x126428,_0x28d347){_0x28d347=_0x28d347||0xcc;return function(_0x516c7e){if(_0x516c7e){return _0x126428[_0xe8ee('0x19')](_0x28d347);}return _0x126428[_0xe8ee('0x1a')](_0x28d347)['end']();};}function respondWithResult(_0x2919ee,_0x414047){_0x414047=_0x414047||0xc8;return function(_0x3b331e){if(_0x3b331e){return _0x2919ee[_0xe8ee('0x1a')](_0x414047)[_0xe8ee('0x1b')](_0x3b331e);}};}function respondWithFilteredResult(_0x3d61f5,_0x6aa54f){return function(_0xafd8e0){if(_0xafd8e0){var _0x20badd=typeof _0x6aa54f[_0xe8ee('0x1c')]===_0xe8ee('0x1d')&&typeof _0x6aa54f[_0xe8ee('0x1e')]===_0xe8ee('0x1d');var _0x476157=_0xafd8e0[_0xe8ee('0x1f')];var _0x510917=_0x20badd?0x0:_0x6aa54f[_0xe8ee('0x1c')];var _0x28dff8=_0x20badd?_0xafd8e0['count']:_0x6aa54f[_0xe8ee('0x1c')]+_0x6aa54f[_0xe8ee('0x1e')];var _0x5b09a0;if(_0x28dff8>=_0x476157){_0x28dff8=_0x476157;_0x5b09a0=0xc8;}else{_0x5b09a0=0xce;}_0x3d61f5[_0xe8ee('0x1a')](_0x5b09a0);return _0x3d61f5[_0xe8ee('0x20')](_0xe8ee('0x21'),_0x510917+'-'+_0x28dff8+'/'+_0x476157)['json'](_0xafd8e0);}return null;};}function patchUpdates(_0x2016e0){return function(_0x15d684){try{jsonpatch[_0xe8ee('0x22')](_0x15d684,_0x2016e0,!![]);}catch(_0x2fd354){return BPromise[_0xe8ee('0x23')](_0x2fd354);}return _0x15d684['save']();};}function saveUpdates(_0x260cd0,_0x3c5c59){return function(_0x12f519){if(_0x12f519){return _0x12f519[_0xe8ee('0x24')](_0x260cd0)[_0xe8ee('0x25')](function(_0xb16003){return _0xb16003;});}return null;};}function removeEntity(_0x3fd3c6,_0xbf0b64){return function(_0x1ad5f7){if(_0x1ad5f7){return _0x1ad5f7['destroy']()[_0xe8ee('0x25')](function(){_0x3fd3c6[_0xe8ee('0x1a')](0xcc)[_0xe8ee('0x26')]();});}};}function handleEntityNotFound(_0x5d5ed3,_0x1bd918){return function(_0x34fa4b){if(!_0x34fa4b){_0x5d5ed3['sendStatus'](0x194);}return _0x34fa4b;};}function handleError(_0x417f98,_0x790944){_0x790944=_0x790944||0x1f4;return function(_0x4dbe3f){logger[_0xe8ee('0x27')](_0x4dbe3f['stack']);if(_0x4dbe3f[_0xe8ee('0x28')]){delete _0x4dbe3f['name'];}_0x417f98[_0xe8ee('0x1a')](_0x790944)[_0xe8ee('0x29')](_0x4dbe3f);};}exports[_0xe8ee('0x2a')]=function(_0x55f3dc,_0x483235){var _0x3c8ea0={},_0x5a0b1b={},_0x4c08a6={'count':0x0,'rows':[]};var _0x536365=_[_0xe8ee('0x2b')](db[_0xe8ee('0x2c')]['rawAttributes'],function(_0x4054f8){return{'name':_0x4054f8[_0xe8ee('0x2d')],'type':_0x4054f8[_0xe8ee('0x2e')][_0xe8ee('0x2f')]};});_0x5a0b1b[_0xe8ee('0x30')]=_[_0xe8ee('0x2b')](_0x536365,_0xe8ee('0x28'));_0x5a0b1b[_0xe8ee('0x31')]=_[_0xe8ee('0x32')](_0x55f3dc[_0xe8ee('0x31')]);_0x5a0b1b['filters']=_['intersection'](_0x5a0b1b[_0xe8ee('0x30')],_0x5a0b1b[_0xe8ee('0x31')]);_0x3c8ea0[_0xe8ee('0x33')]=_[_0xe8ee('0x34')](_0x5a0b1b[_0xe8ee('0x30')],qs[_0xe8ee('0x35')](_0x55f3dc['query']['fields']));_0x3c8ea0[_0xe8ee('0x33')]=_0x3c8ea0[_0xe8ee('0x33')][_0xe8ee('0x36')]?_0x3c8ea0[_0xe8ee('0x33')]:_0x5a0b1b[_0xe8ee('0x30')];if(!_0x55f3dc['query'][_0xe8ee('0x37')](_0xe8ee('0x38'))){_0x3c8ea0['limit']=qs[_0xe8ee('0x1e')](_0x55f3dc['query'][_0xe8ee('0x1e')]);_0x3c8ea0[_0xe8ee('0x1c')]=qs[_0xe8ee('0x1c')](_0x55f3dc[_0xe8ee('0x31')]['offset']);}_0x3c8ea0[_0xe8ee('0x39')]=qs[_0xe8ee('0x3a')](_0x55f3dc[_0xe8ee('0x31')]['sort']);_0x3c8ea0[_0xe8ee('0x3b')]=qs[_0xe8ee('0x3c')](_[_0xe8ee('0x3d')](_0x55f3dc[_0xe8ee('0x31')],_0x5a0b1b[_0xe8ee('0x3c')]),_0x536365);if(_0x55f3dc[_0xe8ee('0x31')][_0xe8ee('0x3e')]){_0x3c8ea0['where']=_['merge'](_0x3c8ea0['where'],{'$or':_['map'](_0x536365,function(_0x28f149){if(_0x28f149[_0xe8ee('0x2e')]!==_0xe8ee('0x3f')){var _0x4483e9={};_0x4483e9[_0x28f149[_0xe8ee('0x28')]]={'$like':'%'+_0x55f3dc[_0xe8ee('0x31')][_0xe8ee('0x3e')]+'%'};return _0x4483e9;}})});}_0x3c8ea0=_['merge']({},_0x3c8ea0,_0x55f3dc[_0xe8ee('0x40')]);var _0x10aa65={'where':_0x3c8ea0[_0xe8ee('0x3b')]};return db[_0xe8ee('0x2c')][_0xe8ee('0x1f')](_0x10aa65)[_0xe8ee('0x25')](function(_0xeebbc2){_0x4c08a6[_0xe8ee('0x1f')]=_0xeebbc2;if(_0x55f3dc[_0xe8ee('0x31')][_0xe8ee('0x41')]){_0x3c8ea0[_0xe8ee('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xe8ee('0x43')](_0x3c8ea0);})[_0xe8ee('0x25')](function(_0x5ae7e2){_0x4c08a6[_0xe8ee('0x44')]=_0x5ae7e2;return _0x4c08a6;})['then'](respondWithFilteredResult(_0x483235,_0x3c8ea0))[_0xe8ee('0x45')](handleError(_0x483235,null));};exports[_0xe8ee('0x46')]=function(_0x5db3bb,_0x3b10f4){var _0xafff3c={'raw':![],'where':{'id':_0x5db3bb['params']['id']}},_0x458004={};_0x458004['model']=_[_0xe8ee('0x32')](db[_0xe8ee('0x2c')][_0xe8ee('0x47')]);_0x458004[_0xe8ee('0x31')]=_[_0xe8ee('0x32')](_0x5db3bb[_0xe8ee('0x31')]);_0x458004['filters']=_[_0xe8ee('0x34')](_0x458004[_0xe8ee('0x30')],_0x458004[_0xe8ee('0x31')]);_0xafff3c['attributes']=_['intersection'](_0x458004['model'],qs[_0xe8ee('0x35')](_0x5db3bb['query'][_0xe8ee('0x35')]));_0xafff3c[_0xe8ee('0x33')]=_0xafff3c['attributes'][_0xe8ee('0x36')]?_0xafff3c[_0xe8ee('0x33')]:_0x458004[_0xe8ee('0x30')];if(_0x5db3bb[_0xe8ee('0x31')][_0xe8ee('0x41')]){_0xafff3c[_0xe8ee('0x42')]=[{'all':!![]}];}_0xafff3c=_['merge']({},_0xafff3c,_0x5db3bb[_0xe8ee('0x40')]);return db[_0xe8ee('0x2c')][_0xe8ee('0x48')](_0xafff3c)[_0xe8ee('0x25')](handleEntityNotFound(_0x3b10f4,null))[_0xe8ee('0x25')](respondWithResult(_0x3b10f4,null))['catch'](handleError(_0x3b10f4,null));};exports['create']=function(_0x31f93d,_0x3cb120){return db[_0xe8ee('0x2c')][_0xe8ee('0x49')](_0x31f93d[_0xe8ee('0x4a')],{})[_0xe8ee('0x25')](respondWithResult(_0x3cb120,0xc9))['catch'](handleError(_0x3cb120,null));};exports[_0xe8ee('0x24')]=function(_0x8dbde3,_0x2e0d01){if(_0x8dbde3[_0xe8ee('0x4a')]['id']){delete _0x8dbde3[_0xe8ee('0x4a')]['id'];}return db[_0xe8ee('0x2c')][_0xe8ee('0x48')]({'where':{'id':_0x8dbde3[_0xe8ee('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e0d01,null))[_0xe8ee('0x25')](saveUpdates(_0x8dbde3[_0xe8ee('0x4a')],null))[_0xe8ee('0x25')](respondWithResult(_0x2e0d01,null))[_0xe8ee('0x45')](handleError(_0x2e0d01,null));};exports[_0xe8ee('0x4c')]=function(_0x2e1f49,_0x137038){return db[_0xe8ee('0x2c')][_0xe8ee('0x48')]({'where':{'id':_0x2e1f49[_0xe8ee('0x4b')]['id']}})[_0xe8ee('0x25')](handleEntityNotFound(_0x137038,null))[_0xe8ee('0x25')](removeEntity(_0x137038,null))[_0xe8ee('0x45')](handleError(_0x137038,null));};exports[_0xe8ee('0x4d')]=function(_0x577ddb,_0x4cf0aa,_0x105eea){var _0x45d61a={};var _0x5dd166={};var _0x3c1eb8;var _0x2c6d87;return db[_0xe8ee('0x2c')][_0xe8ee('0x4e')]({'where':{'id':_0x577ddb[_0xe8ee('0x4b')]['id']}})[_0xe8ee('0x25')](handleEntityNotFound(_0x4cf0aa,null))[_0xe8ee('0x25')](function(_0x1de8e5){if(_0x1de8e5){_0x3c1eb8=_0x1de8e5;_0x5dd166[_0xe8ee('0x30')]=_[_0xe8ee('0x32')](db[_0xe8ee('0x4f')]['rawAttributes']);_0x5dd166[_0xe8ee('0x31')]=_[_0xe8ee('0x32')](_0x577ddb[_0xe8ee('0x31')]);_0x5dd166[_0xe8ee('0x3c')]=_[_0xe8ee('0x34')](_0x5dd166[_0xe8ee('0x30')],_0x5dd166[_0xe8ee('0x31')]);_0x45d61a['attributes']=_[_0xe8ee('0x34')](_0x5dd166[_0xe8ee('0x30')],qs[_0xe8ee('0x35')](_0x577ddb[_0xe8ee('0x31')][_0xe8ee('0x35')]));_0x45d61a[_0xe8ee('0x33')]=_0x45d61a[_0xe8ee('0x33')][_0xe8ee('0x36')]?_0x45d61a['attributes']:_0x5dd166[_0xe8ee('0x30')];_0x45d61a[_0xe8ee('0x39')]=qs[_0xe8ee('0x3a')](_0x577ddb[_0xe8ee('0x31')][_0xe8ee('0x3a')]);_0x45d61a[_0xe8ee('0x3b')]=qs[_0xe8ee('0x3c')](_['pick'](_0x577ddb['query'],_0x5dd166[_0xe8ee('0x3c')]));if(_0x577ddb[_0xe8ee('0x31')][_0xe8ee('0x3e')]){_0x45d61a[_0xe8ee('0x3b')]=_[_0xe8ee('0x50')](_0x45d61a[_0xe8ee('0x3b')],{'$or':_[_0xe8ee('0x2b')](_0x45d61a[_0xe8ee('0x33')],function(_0x214da6){var _0x707cb0={};_0x707cb0[_0x214da6]={'$like':'%'+_0x577ddb[_0xe8ee('0x31')][_0xe8ee('0x3e')]+'%'};return _0x707cb0;})});}_0x45d61a=_[_0xe8ee('0x50')]({},_0x45d61a,_0x577ddb[_0xe8ee('0x40')]);return _0x3c1eb8['getConfigurations'](_0x45d61a);}})[_0xe8ee('0x25')](function(_0x43144e){if(_0x43144e){_0x2c6d87=_0x43144e['length'];if(!_0x577ddb[_0xe8ee('0x31')]['hasOwnProperty'](_0xe8ee('0x38'))){_0x45d61a[_0xe8ee('0x1e')]=qs['limit'](_0x577ddb['query']['limit']);_0x45d61a[_0xe8ee('0x1c')]=qs[_0xe8ee('0x1c')](_0x577ddb[_0xe8ee('0x31')]['offset']);}return _0x3c1eb8[_0xe8ee('0x4d')](_0x45d61a);}})[_0xe8ee('0x25')](function(_0x426c37){if(_0x426c37){return _0x426c37?{'count':_0x2c6d87,'rows':_0x426c37}:null;}})['then'](respondWithResult(_0x4cf0aa,null))['catch'](handleError(_0x4cf0aa,null));};exports[_0xe8ee('0x51')]=function(_0x4d9630,_0x1ac9cd,_0x341062){if(_0x4d9630[_0xe8ee('0x4a')]['id']){delete _0x4d9630[_0xe8ee('0x4a')]['id'];}return db[_0xe8ee('0x2c')][_0xe8ee('0x4e')]({'where':{'id':_0x4d9630[_0xe8ee('0x4b')]['id']}})[_0xe8ee('0x25')](handleEntityNotFound(_0x1ac9cd,null))['then'](function(_0xbfed8a){if(_0xbfed8a){_0x4d9630[_0xe8ee('0x4a')][_0xe8ee('0x52')]=_0xbfed8a['id'];_0x4d9630[_0xe8ee('0x4a')][_0xe8ee('0x53')]=integrations[_0xe8ee('0x54')](_0x4d9630[_0xe8ee('0x4a')][_0xe8ee('0x55')],_0x4d9630[_0xe8ee('0x4a')]['type']);_0x4d9630[_0xe8ee('0x4a')][_0xe8ee('0x56')]=integrations[_0xe8ee('0x57')](_0x4d9630[_0xe8ee('0x4a')]['channel'],_0x4d9630[_0xe8ee('0x4a')][_0xe8ee('0x2e')]);return db[_0xe8ee('0x4f')][_0xe8ee('0x49')](_0x4d9630['body'],{'include':[{'model':db[_0xe8ee('0x58')],'as':_0xe8ee('0x53')},{'model':db[_0xe8ee('0x58')],'as':_0xe8ee('0x56')}]});}return null;})['then'](respondWithResult(_0x1ac9cd,null))['catch'](handleError(_0x1ac9cd,null));};exports['getFields']=function(_0x4542be,_0x54cec2,_0x29184e){var _0x21c5d4='';var _0x108533=['id',_0xe8ee('0x28'),_0xe8ee('0x59'),_0xe8ee('0x5a'),_0xe8ee('0x5b'),_0xe8ee('0x5c'),_0xe8ee('0x5d'),_0xe8ee('0x5e'),_0xe8ee('0x5f'),_0xe8ee('0x60'),_0xe8ee('0x61'),'direction'];return db['SugarcrmAccount'][_0xe8ee('0x4e')]({'where':{'id':_0x4542be[_0xe8ee('0x4b')]['id']},'attributes':['id',_0xe8ee('0x62'),'password',_0xe8ee('0x63')]})[_0xe8ee('0x25')](handleEntityNotFound(_0x54cec2,null))[_0xe8ee('0x25')](function(_0x24431){if(_0x24431){_0x21c5d4=_0x24431[_0xe8ee('0x63')];var _0x8975f9=_0x21c5d4[_0xe8ee('0x64')](-0x1);if(_0x8975f9==='/'){_0x21c5d4=_0x21c5d4[_0xe8ee('0x65')](0x0,_0x21c5d4[_0xe8ee('0x66')](_0x8975f9));}return rp({'method':'POST','uri':util[_0xe8ee('0x67')]('%s%s',_0x21c5d4,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xe8ee('0x68'),'response_type':_0xe8ee('0x68'),'rest_data':JSON[_0xe8ee('0x69')]({'user_auth':{'user_name':_0x24431['username'],'password':_0x24431[_0xe8ee('0x6a')],'encryption':_0xe8ee('0x6b')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x1cd801){if(_0x1cd801&&_0x1cd801['name']!==_0xe8ee('0x6c')&&_0x1cd801['name']!==_0xe8ee('0x6d')){return rp({'method':_0xe8ee('0x6e'),'uri':util[_0xe8ee('0x67')](_0xe8ee('0x6f'),_0x21c5d4,_0xe8ee('0x70')),'json':!![],'form':{'method':_0xe8ee('0x71'),'input_type':'JSON','response_type':_0xe8ee('0x68'),'rest_data':JSON[_0xe8ee('0x69')]({'session':_0x1cd801['id'],'module_name':_0xe8ee('0x72')})}})[_0xe8ee('0x25')](function(_0x786e9){if(_0x786e9){var _0x53e441=_['values'](_0x786e9[_0xe8ee('0x73')]);_['remove'](_0x53e441,function(_0x4099ef){return _0x108533[_0xe8ee('0x74')](_0x4099ef[_0xe8ee('0x28')]);});return{'count':_0x53e441[_0xe8ee('0x36')],'rows':_[_0xe8ee('0x2b')](_0x53e441,function(_0x3e6cc7){return{'id':_0x3e6cc7[_0xe8ee('0x28')],'name':_0x3e6cc7[_0xe8ee('0x75')],'custom':_[_0xe8ee('0x76')](_0x3e6cc7[_0xe8ee('0x28')],'_c')?!![]:![],'options':_0x3e6cc7[_0xe8ee('0x40')]?_[_0xe8ee('0x2b')](_[_0xe8ee('0x77')](_0x3e6cc7[_0xe8ee('0x40')]),function(_0x15a0e7){return{'name':_0x15a0e7[_0xe8ee('0x78')],'value':_0x15a0e7['name']};}):[]};})};}})['then'](respondWithResult(_0x54cec2,null))['catch'](function(_0x171729){var _0x55b3d5=_0x4542be[_0xe8ee('0x31')][_0xe8ee('0x79')]?0x1f4:_0x171729['statusCode']||0x1f4;logger['error'](_0xe8ee('0x7a'),_0xe8ee('0x7b'),_0x55b3d5,JSON[_0xe8ee('0x69')](_0x171729));delete _0x171729[_0xe8ee('0x28')];if(_0x55b3d5===0x191){_0x55b3d5=0x190;}_0x54cec2[_0xe8ee('0x1a')](_0x55b3d5)['send'](_0x4542be[_0xe8ee('0x31')]['test']?{'message':_0xe8ee('0x7c'),'statusCode':_0x171729[_0xe8ee('0x7d')]}:_0x171729);});}else{var _0x4adfaa=0x1f4;_0x54cec2[_0xe8ee('0x1a')](_0x4adfaa)[_0xe8ee('0x29')]({'message':_0xe8ee('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x37c6=['AccountId','Subjects','getSubjects','channel','Descriptions','create','SugarcrmField','getFields','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','POST','%s%s','JSON','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','stringify','Calls','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','send','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','length','find','catch','update','body','getConfigurations','findOne','hasOwnProperty','nolimit','addConfiguration'];(function(_0x1371df,_0xbaea0c){var _0x380a92=function(_0x3e8982){while(--_0x3e8982){_0x1371df['push'](_0x1371df['shift']());}};_0x380a92(++_0xbaea0c);}(_0x37c6,0x1ef));var _0x637c=function(_0x3a0cae,_0xf2f32e){_0x3a0cae=_0x3a0cae-0x0;var _0x245cc2=_0x37c6[_0x3a0cae];return _0x245cc2;};'use strict';var emlformat=require(_0x637c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x637c('0x1'));var moment=require('moment');var BPromise=require(_0x637c('0x2'));var Mustache=require(_0x637c('0x3'));var util=require('util');var path=require(_0x637c('0x4'));var sox=require(_0x637c('0x5'));var csv=require(_0x637c('0x6'));var ejs=require(_0x637c('0x7'));var fs=require('fs');var fs_extra=require(_0x637c('0x8'));var _=require(_0x637c('0x9'));var squel=require(_0x637c('0xa'));var crypto=require(_0x637c('0xb'));var jsforce=require(_0x637c('0xc'));var deskjs=require(_0x637c('0xd'));var toCsv=require(_0x637c('0x6'));var querystring=require(_0x637c('0xe'));var Papa=require(_0x637c('0xf'));var Redis=require(_0x637c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x637c('0x11'));var as=require(_0x637c('0x12'));var hardwareService=require(_0x637c('0x13'));var logger=require(_0x637c('0x14'))(_0x637c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x637c('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x637c('0x17'));function respondWithStatusCode(_0x378b64,_0x55b04f){_0x55b04f=_0x55b04f||0xcc;return function(_0x3a2772){if(_0x3a2772){return _0x378b64[_0x637c('0x18')](_0x55b04f);}return _0x378b64['status'](_0x55b04f)[_0x637c('0x19')]();};}function respondWithResult(_0x4d8f28,_0x46c57e){_0x46c57e=_0x46c57e||0xc8;return function(_0x4fd4fa){if(_0x4fd4fa){return _0x4d8f28[_0x637c('0x1a')](_0x46c57e)[_0x637c('0x1b')](_0x4fd4fa);}};}function respondWithFilteredResult(_0x18d3fe,_0x401658){return function(_0x216462){if(_0x216462){var _0x546986=typeof _0x401658[_0x637c('0x1c')]===_0x637c('0x1d')&&typeof _0x401658[_0x637c('0x1e')]===_0x637c('0x1d');var _0x4dfa67=_0x216462[_0x637c('0x1f')];var _0x44bcef=_0x546986?0x0:_0x401658[_0x637c('0x1c')];var _0x4b88dd=_0x546986?_0x216462[_0x637c('0x1f')]:_0x401658[_0x637c('0x1c')]+_0x401658[_0x637c('0x1e')];var _0x2f5806;if(_0x4b88dd>=_0x4dfa67){_0x4b88dd=_0x4dfa67;_0x2f5806=0xc8;}else{_0x2f5806=0xce;}_0x18d3fe[_0x637c('0x1a')](_0x2f5806);return _0x18d3fe[_0x637c('0x20')]('Content-Range',_0x44bcef+'-'+_0x4b88dd+'/'+_0x4dfa67)[_0x637c('0x1b')](_0x216462);}return null;};}function patchUpdates(_0x1d2076){return function(_0x45907f){try{jsonpatch['apply'](_0x45907f,_0x1d2076,!![]);}catch(_0x1945b8){return BPromise[_0x637c('0x21')](_0x1945b8);}return _0x45907f['save']();};}function saveUpdates(_0xe7180f,_0x273dd1){return function(_0x3c9448){if(_0x3c9448){return _0x3c9448['update'](_0xe7180f)[_0x637c('0x22')](function(_0x1b927c){return _0x1b927c;});}return null;};}function removeEntity(_0x5a1a0b,_0x329bb3){return function(_0x31d680){if(_0x31d680){return _0x31d680[_0x637c('0x23')]()[_0x637c('0x22')](function(){_0x5a1a0b[_0x637c('0x1a')](0xcc)[_0x637c('0x19')]();});}};}function handleEntityNotFound(_0x2aa088,_0x572b23){return function(_0x1ba9d2){if(!_0x1ba9d2){_0x2aa088[_0x637c('0x18')](0x194);}return _0x1ba9d2;};}function handleError(_0xbe090f,_0xe41341){_0xe41341=_0xe41341||0x1f4;return function(_0x2091da){logger[_0x637c('0x24')](_0x2091da[_0x637c('0x25')]);if(_0x2091da[_0x637c('0x26')]){delete _0x2091da[_0x637c('0x26')];}_0xbe090f[_0x637c('0x1a')](_0xe41341)['send'](_0x2091da);};}exports[_0x637c('0x27')]=function(_0x1ceb8c,_0x541924){var _0x1ca725={},_0xe8ff18={},_0x515aaf={'count':0x0,'rows':[]};var _0x3d2c55=_[_0x637c('0x28')](db[_0x637c('0x29')][_0x637c('0x2a')],function(_0x39d34e){return{'name':_0x39d34e[_0x637c('0x2b')],'type':_0x39d34e[_0x637c('0x2c')]['key']};});_0xe8ff18[_0x637c('0x2d')]=_[_0x637c('0x28')](_0x3d2c55,_0x637c('0x26'));_0xe8ff18[_0x637c('0x2e')]=_[_0x637c('0x2f')](_0x1ceb8c[_0x637c('0x2e')]);_0xe8ff18['filters']=_['intersection'](_0xe8ff18[_0x637c('0x2d')],_0xe8ff18[_0x637c('0x2e')]);_0x1ca725[_0x637c('0x30')]=_[_0x637c('0x31')](_0xe8ff18[_0x637c('0x2d')],qs[_0x637c('0x32')](_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x32')]));_0x1ca725[_0x637c('0x30')]=_0x1ca725[_0x637c('0x30')]['length']?_0x1ca725[_0x637c('0x30')]:_0xe8ff18[_0x637c('0x2d')];if(!_0x1ceb8c['query']['hasOwnProperty']('nolimit')){_0x1ca725['limit']=qs[_0x637c('0x1e')](_0x1ceb8c[_0x637c('0x2e')]['limit']);_0x1ca725[_0x637c('0x1c')]=qs['offset'](_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x1c')]);}_0x1ca725[_0x637c('0x33')]=qs[_0x637c('0x34')](_0x1ceb8c['query'][_0x637c('0x34')]);_0x1ca725[_0x637c('0x35')]=qs[_0x637c('0x36')](_[_0x637c('0x37')](_0x1ceb8c['query'],_0xe8ff18['filters']),_0x3d2c55);if(_0x1ceb8c[_0x637c('0x2e')]['filter']){_0x1ca725['where']=_['merge'](_0x1ca725[_0x637c('0x35')],{'$or':_[_0x637c('0x28')](_0x3d2c55,function(_0x335ae6){if(_0x335ae6[_0x637c('0x2c')]!==_0x637c('0x38')){var _0x18bc3d={};_0x18bc3d[_0x335ae6[_0x637c('0x26')]]={'$like':'%'+_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x39')]+'%'};return _0x18bc3d;}})});}_0x1ca725=_[_0x637c('0x3a')]({},_0x1ca725,_0x1ceb8c[_0x637c('0x3b')]);var _0x5ce342={'where':_0x1ca725[_0x637c('0x35')]};return db[_0x637c('0x29')][_0x637c('0x1f')](_0x5ce342)[_0x637c('0x22')](function(_0x3db2b4){_0x515aaf['count']=_0x3db2b4;if(_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x3c')]){_0x1ca725[_0x637c('0x3d')]=[{'all':!![]}];}return db[_0x637c('0x29')]['findAll'](_0x1ca725);})[_0x637c('0x22')](function(_0x5dd58c){_0x515aaf[_0x637c('0x3e')]=_0x5dd58c;return _0x515aaf;})[_0x637c('0x22')](respondWithFilteredResult(_0x541924,_0x1ca725))['catch'](handleError(_0x541924,null));};exports[_0x637c('0x3f')]=function(_0x481eb7,_0x1820f5){var _0x270a28={'raw':![],'where':{'id':_0x481eb7[_0x637c('0x40')]['id']}},_0x5bfd8d={};_0x5bfd8d[_0x637c('0x2d')]=_['keys'](db[_0x637c('0x29')]['rawAttributes']);_0x5bfd8d[_0x637c('0x2e')]=_['keys'](_0x481eb7['query']);_0x5bfd8d['filters']=_[_0x637c('0x31')](_0x5bfd8d[_0x637c('0x2d')],_0x5bfd8d[_0x637c('0x2e')]);_0x270a28[_0x637c('0x30')]=_[_0x637c('0x31')](_0x5bfd8d[_0x637c('0x2d')],qs['fields'](_0x481eb7[_0x637c('0x2e')][_0x637c('0x32')]));_0x270a28[_0x637c('0x30')]=_0x270a28['attributes'][_0x637c('0x41')]?_0x270a28['attributes']:_0x5bfd8d[_0x637c('0x2d')];if(_0x481eb7[_0x637c('0x2e')][_0x637c('0x3c')]){_0x270a28[_0x637c('0x3d')]=[{'all':!![]}];}_0x270a28=_[_0x637c('0x3a')]({},_0x270a28,_0x481eb7[_0x637c('0x3b')]);return db[_0x637c('0x29')][_0x637c('0x42')](_0x270a28)[_0x637c('0x22')](handleEntityNotFound(_0x1820f5,null))[_0x637c('0x22')](respondWithResult(_0x1820f5,null))[_0x637c('0x43')](handleError(_0x1820f5,null));};exports['create']=function(_0x35d5ff,_0x40c5be){return db[_0x637c('0x29')]['create'](_0x35d5ff['body'],{})[_0x637c('0x22')](respondWithResult(_0x40c5be,0xc9))[_0x637c('0x43')](handleError(_0x40c5be,null));};exports[_0x637c('0x44')]=function(_0xbd7a02,_0x578e71){if(_0xbd7a02[_0x637c('0x45')]['id']){delete _0xbd7a02[_0x637c('0x45')]['id'];}return db[_0x637c('0x29')]['find']({'where':{'id':_0xbd7a02['params']['id']}})[_0x637c('0x22')](handleEntityNotFound(_0x578e71,null))[_0x637c('0x22')](saveUpdates(_0xbd7a02[_0x637c('0x45')],null))[_0x637c('0x22')](respondWithResult(_0x578e71,null))['catch'](handleError(_0x578e71,null));};exports[_0x637c('0x23')]=function(_0x5bcb2c,_0xceea01){return db[_0x637c('0x29')][_0x637c('0x42')]({'where':{'id':_0x5bcb2c['params']['id']}})[_0x637c('0x22')](handleEntityNotFound(_0xceea01,null))[_0x637c('0x22')](removeEntity(_0xceea01,null))[_0x637c('0x43')](handleError(_0xceea01,null));};exports[_0x637c('0x46')]=function(_0x4308c5,_0xc65ffb,_0x285337){var _0x476826={};var _0x44752a={};var _0x41b623;var _0x4b4b5e;return db[_0x637c('0x29')][_0x637c('0x47')]({'where':{'id':_0x4308c5[_0x637c('0x40')]['id']}})[_0x637c('0x22')](handleEntityNotFound(_0xc65ffb,null))[_0x637c('0x22')](function(_0x155c35){if(_0x155c35){_0x41b623=_0x155c35;_0x44752a[_0x637c('0x2d')]=_[_0x637c('0x2f')](db['SugarcrmConfiguration'][_0x637c('0x2a')]);_0x44752a['query']=_['keys'](_0x4308c5['query']);_0x44752a[_0x637c('0x36')]=_['intersection'](_0x44752a[_0x637c('0x2d')],_0x44752a['query']);_0x476826[_0x637c('0x30')]=_[_0x637c('0x31')](_0x44752a[_0x637c('0x2d')],qs['fields'](_0x4308c5[_0x637c('0x2e')]['fields']));_0x476826[_0x637c('0x30')]=_0x476826[_0x637c('0x30')]['length']?_0x476826['attributes']:_0x44752a['model'];_0x476826[_0x637c('0x33')]=qs['sort'](_0x4308c5['query'][_0x637c('0x34')]);_0x476826[_0x637c('0x35')]=qs[_0x637c('0x36')](_[_0x637c('0x37')](_0x4308c5[_0x637c('0x2e')],_0x44752a[_0x637c('0x36')]));if(_0x4308c5[_0x637c('0x2e')][_0x637c('0x39')]){_0x476826[_0x637c('0x35')]=_[_0x637c('0x3a')](_0x476826[_0x637c('0x35')],{'$or':_['map'](_0x476826[_0x637c('0x30')],function(_0x1bb82a){var _0x43ff1e={};_0x43ff1e[_0x1bb82a]={'$like':'%'+_0x4308c5[_0x637c('0x2e')]['filter']+'%'};return _0x43ff1e;})});}_0x476826=_[_0x637c('0x3a')]({},_0x476826,_0x4308c5[_0x637c('0x3b')]);return _0x41b623['getConfigurations'](_0x476826);}})[_0x637c('0x22')](function(_0x1cc65d){if(_0x1cc65d){_0x4b4b5e=_0x1cc65d['length'];if(!_0x4308c5[_0x637c('0x2e')][_0x637c('0x48')](_0x637c('0x49'))){_0x476826[_0x637c('0x1e')]=qs['limit'](_0x4308c5[_0x637c('0x2e')]['limit']);_0x476826[_0x637c('0x1c')]=qs[_0x637c('0x1c')](_0x4308c5[_0x637c('0x2e')][_0x637c('0x1c')]);}return _0x41b623[_0x637c('0x46')](_0x476826);}})[_0x637c('0x22')](function(_0x41575a){if(_0x41575a){return _0x41575a?{'count':_0x4b4b5e,'rows':_0x41575a}:null;}})[_0x637c('0x22')](respondWithResult(_0xc65ffb,null))['catch'](handleError(_0xc65ffb,null));};exports[_0x637c('0x4a')]=function(_0x5e2bc5,_0x28994b,_0x5cc3be){if(_0x5e2bc5[_0x637c('0x45')]['id']){delete _0x5e2bc5[_0x637c('0x45')]['id'];}return db[_0x637c('0x29')][_0x637c('0x47')]({'where':{'id':_0x5e2bc5[_0x637c('0x40')]['id']}})[_0x637c('0x22')](handleEntityNotFound(_0x28994b,null))[_0x637c('0x22')](function(_0x329a2d){if(_0x329a2d){_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4b')]=_0x329a2d['id'];_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4c')]=integrations[_0x637c('0x4d')](_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4e')],_0x5e2bc5[_0x637c('0x45')]['type']);_0x5e2bc5['body'][_0x637c('0x4f')]=integrations['getDescriptions'](_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4e')],_0x5e2bc5[_0x637c('0x45')][_0x637c('0x2c')]);return db['SugarcrmConfiguration'][_0x637c('0x50')](_0x5e2bc5[_0x637c('0x45')],{'include':[{'model':db[_0x637c('0x51')],'as':_0x637c('0x4c')},{'model':db[_0x637c('0x51')],'as':_0x637c('0x4f')}]});}return null;})[_0x637c('0x22')](respondWithResult(_0x28994b,null))[_0x637c('0x43')](handleError(_0x28994b,null));};exports[_0x637c('0x52')]=function(_0x50cdea,_0x5bd5f2,_0x3ff29f){var _0x53893e='';var _0x1ac334=['id',_0x637c('0x26'),'assigned_user_id',_0x637c('0x53'),'description',_0x637c('0x54'),'duration_hours',_0x637c('0x55'),_0x637c('0x56'),_0x637c('0x57'),_0x637c('0x58'),_0x637c('0x59')];return db[_0x637c('0x29')]['findOne']({'where':{'id':_0x50cdea['params']['id']},'attributes':['id',_0x637c('0x5a'),_0x637c('0x5b'),_0x637c('0x5c')]})[_0x637c('0x22')](handleEntityNotFound(_0x5bd5f2,null))[_0x637c('0x22')](function(_0x5a6059){if(_0x5a6059){_0x53893e=_0x5a6059[_0x637c('0x5c')];var _0xef4e86=_0x53893e[_0x637c('0x5d')](-0x1);if(_0xef4e86==='/'){_0x53893e=_0x53893e['substring'](0x0,_0x53893e['lastIndexOf'](_0xef4e86));}return rp({'method':_0x637c('0x5e'),'uri':util['format'](_0x637c('0x5f'),_0x53893e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x637c('0x60'),'response_type':_0x637c('0x60'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5a6059['username'],'password':_0x5a6059[_0x637c('0x5b')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x5c748a){if(_0x5c748a&&_0x5c748a['name']!==_0x637c('0x61')&&_0x5c748a['name']!==_0x637c('0x62')){return rp({'method':_0x637c('0x5e'),'uri':util[_0x637c('0x63')](_0x637c('0x5f'),_0x53893e,_0x637c('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x637c('0x60'),'rest_data':JSON[_0x637c('0x65')]({'session':_0x5c748a['id'],'module_name':_0x637c('0x66')})}})[_0x637c('0x22')](function(_0xfe0bdd){if(_0xfe0bdd){var _0x3bbbd6=_[_0x637c('0x67')](_0xfe0bdd[_0x637c('0x68')]);_[_0x637c('0x69')](_0x3bbbd6,function(_0xf06cb){return _0x1ac334[_0x637c('0x6a')](_0xf06cb[_0x637c('0x26')]);});return{'count':_0x3bbbd6[_0x637c('0x41')],'rows':_[_0x637c('0x28')](_0x3bbbd6,function(_0x19e45d){return{'id':_0x19e45d[_0x637c('0x26')],'name':_0x19e45d[_0x637c('0x6b')],'custom':_['endsWith'](_0x19e45d[_0x637c('0x26')],'_c')?!![]:![],'options':_0x19e45d[_0x637c('0x3b')]?_[_0x637c('0x28')](_[_0x637c('0x67')](_0x19e45d[_0x637c('0x3b')]),function(_0x371751){return{'name':_0x371751[_0x637c('0x6c')],'value':_0x371751[_0x637c('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x5bd5f2,null))[_0x637c('0x43')](function(_0x1e2412){var _0xf6d39c=_0x50cdea['query']['test']?0x1f4:_0x1e2412[_0x637c('0x6d')]||0x1f4;logger['error'](_0x637c('0x6e'),'getFields',_0xf6d39c,JSON['stringify'](_0x1e2412));delete _0x1e2412[_0x637c('0x26')];if(_0xf6d39c===0x191){_0xf6d39c=0x190;}_0x5bd5f2[_0x637c('0x1a')](_0xf6d39c)['send'](_0x50cdea[_0x637c('0x2e')][_0x637c('0x6f')]?{'message':_0x637c('0x70'),'statusCode':_0x1e2412[_0x637c('0x6d')]}:_0x1e2412);});}else{var _0xfd51d1=0x1f4;_0x5bd5f2['status'](_0xfd51d1)[_0x637c('0x71')]({'message':_0x637c('0x70'),'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 8c25746..f5fce89 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 _0x3970=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x19090c,_0x268e71){var _0x346bdb=function(_0x2beb54){while(--_0x2beb54){_0x19090c['push'](_0x19090c['shift']());}};_0x346bdb(++_0x268e71);}(_0x3970,0x1d4));var _0x0397=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x3970[_0x622035];return _0x326cf2;};'use strict';var _=require(_0x0397('0x0'));var util=require(_0x0397('0x1'));var logger=require('../../config/logger')(_0x0397('0x2'));var moment=require('moment');var BPromise=require(_0x0397('0x3'));var rp=require(_0x0397('0x4'));var fs=require('fs');var path=require(_0x0397('0x5'));var rimraf=require(_0x0397('0x6'));var config=require(_0x0397('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x0397('0x8'));module[_0x0397('0x9')]=function(_0x15dbbe,_0x40a950){return _0x15dbbe[_0x0397('0xa')](_0x0397('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x337f=['rimraf','../../config/environment','../../components/integrations/configuration','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x18fb62,_0x2bf8cf){var _0x5edc13=function(_0x420b22){while(--_0x420b22){_0x18fb62['push'](_0x18fb62['shift']());}};_0x5edc13(++_0x2bf8cf);}(_0x337f,0x11c));var _0xf337=function(_0x5dc8dd,_0x10ada4){_0x5dc8dd=_0x5dc8dd-0x0;var _0x16d583=_0x337f[_0x5dc8dd];return _0x16d583;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var logger=require(_0xf337('0x2'))('api');var moment=require(_0xf337('0x3'));var BPromise=require(_0xf337('0x4'));var rp=require(_0xf337('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf337('0x6'));var config=require(_0xf337('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf337('0x8'));module['exports']=function(_0x4580a3,_0x5ae4d6){return _0x4580a3[_0xf337('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index bf74943..d39eda2 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 _0x9098=['SugarcrmAccount','findAll','options','raw','where','include','model','attributes','map','ShowSugarcrmAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x9098,0x1c5));var _0x8909=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9098[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x8909('0x0'));var moment=require(_0x8909('0x1'));var BPromise=require(_0x8909('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8909('0x3'));var db=require(_0x8909('0x4'))['db'];var utils=require(_0x8909('0x5'));var logger=require(_0x8909('0x6'))(_0x8909('0x7'));var config=require('../../config/environment');var jayson=require(_0x8909('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43fc83,_0x124757,_0x787d4a){return new BPromise(function(_0x4877cc,_0x5d5de3){return client[_0x8909('0x9')](_0x43fc83,_0x787d4a)[_0x8909('0xa')](function(_0x1822a6){logger[_0x8909('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x124757,_0x8909('0xc'));logger[_0x8909('0xd')](_0x8909('0xe'),_0x124757,_0x8909('0xc'),JSON[_0x8909('0xf')](_0x1822a6));if(_0x1822a6[_0x8909('0x10')]){if(_0x1822a6['error'][_0x8909('0x11')]===0x1f4){logger[_0x8909('0x10')](_0x8909('0x12'),_0x124757,_0x1822a6['error'][_0x8909('0x13')]);return _0x5d5de3(_0x1822a6[_0x8909('0x10')][_0x8909('0x13')]);}logger[_0x8909('0x10')](_0x8909('0x12'),_0x124757,_0x1822a6['error'][_0x8909('0x13')]);return _0x4877cc(_0x1822a6[_0x8909('0x10')][_0x8909('0x13')]);}else{logger['info'](_0x8909('0x12'),_0x124757,_0x8909('0xc'));_0x4877cc(_0x1822a6[_0x8909('0x14')][_0x8909('0x13')]);}})[_0x8909('0x15')](function(_0x49d5e0){logger['error'](_0x8909('0x12'),_0x124757,_0x49d5e0);_0x5d5de3(_0x49d5e0);});});}exports[_0x8909('0x16')]=function(_0x332f53){var _0x214d14=this;return new Promise(function(_0x5c09b4,_0x22146b){return db[_0x8909('0x17')][_0x8909('0x18')]({'raw':_0x332f53[_0x8909('0x19')]?_0x332f53['options'][_0x8909('0x1a')]===undefined?!![]:![]:!![],'where':_0x332f53['options']?_0x332f53[_0x8909('0x19')][_0x8909('0x1b')]||null:null,'attributes':_0x332f53[_0x8909('0x19')]?_0x332f53[_0x8909('0x19')]['attributes']||null:null,'limit':_0x332f53['options']?_0x332f53[_0x8909('0x19')]['limit']||null:null,'include':_0x332f53['options']?_0x332f53[_0x8909('0x19')][_0x8909('0x1c')]?_['map'](_0x332f53[_0x8909('0x19')][_0x8909('0x1c')],function(_0x8e9ce){return{'model':db[_0x8e9ce[_0x8909('0x1d')]],'as':_0x8e9ce['as'],'attributes':_0x8e9ce[_0x8909('0x1e')],'include':_0x8e9ce[_0x8909('0x1c')]?_[_0x8909('0x1f')](_0x8e9ce[_0x8909('0x1c')],function(_0x4186f8){return{'model':db[_0x4186f8[_0x8909('0x1d')]],'as':_0x4186f8['as'],'attributes':_0x4186f8[_0x8909('0x1e')],'include':_0x4186f8[_0x8909('0x1c')]?_['map'](_0x4186f8[_0x8909('0x1c')],function(_0x11c550){return{'model':db[_0x11c550[_0x8909('0x1d')]],'as':_0x11c550['as'],'attributes':_0x11c550[_0x8909('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe80c64){logger[_0x8909('0xb')](_0x8909('0x16'),_0x332f53);logger['debug'](_0x8909('0x16'),_0x332f53,JSON[_0x8909('0xf')](_0xe80c64));_0x5c09b4(_0xe80c64);})[_0x8909('0x15')](function(_0x402d4f){logger[_0x8909('0x10')](_0x8909('0x16'),_0x402d4f[_0x8909('0x13')],_0x332f53);_0x22146b(_0x214d14['error'](0x1f4,_0x402d4f[_0x8909('0x13')]));});});};exports[_0x8909('0x20')]=function(_0x78a858){var _0x1bd59e=this;return new Promise(function(_0x3499cc,_0x1047df){return db['SugarcrmAccount'][_0x8909('0x21')]({'raw':_0x78a858[_0x8909('0x19')]?_0x78a858[_0x8909('0x19')][_0x8909('0x1a')]===undefined?!![]:![]:!![],'where':_0x78a858[_0x8909('0x19')]?_0x78a858[_0x8909('0x19')]['where']||null:null,'attributes':_0x78a858[_0x8909('0x19')]?_0x78a858[_0x8909('0x19')]['attributes']||null:null,'include':_0x78a858[_0x8909('0x19')]?_0x78a858[_0x8909('0x19')][_0x8909('0x1c')]?_[_0x8909('0x1f')](_0x78a858[_0x8909('0x19')][_0x8909('0x1c')],function(_0xfd2ccf){return{'model':db[_0xfd2ccf['model']],'as':_0xfd2ccf['as'],'attributes':_0xfd2ccf[_0x8909('0x1e')],'include':_0xfd2ccf['include']?_[_0x8909('0x1f')](_0xfd2ccf['include'],function(_0x143cab){return{'model':db[_0x143cab['model']],'as':_0x143cab['as'],'attributes':_0x143cab[_0x8909('0x1e')],'include':_0x143cab['include']?_['map'](_0x143cab[_0x8909('0x1c')],function(_0x539603){return{'model':db[_0x539603['model']],'as':_0x539603['as'],'attributes':_0x539603['attributes']};}):[]};}):[]};}):[]:[]})[_0x8909('0xa')](function(_0x5635ab){logger['info'](_0x8909('0x20'),_0x78a858);logger[_0x8909('0xd')](_0x8909('0x20'),_0x78a858,JSON[_0x8909('0xf')](_0x5635ab));_0x3499cc(_0x5635ab);})[_0x8909('0x15')](function(_0x1c1071){logger['error'](_0x8909('0x20'),_0x1c1071[_0x8909('0x13')],_0x78a858);_0x1047df(_0x1bd59e[_0x8909('0x10')](0x1f4,_0x1c1071[_0x8909('0x13')]));});});}; \ No newline at end of file +var _0xf149=['map','then','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','limit','include','attributes','model'];(function(_0x5b5a08,_0x305a30){var _0x4f550f=function(_0x4cc4f1){while(--_0x4cc4f1){_0x5b5a08['push'](_0x5b5a08['shift']());}};_0x4f550f(++_0x305a30);}(_0xf149,0x97));var _0x9f14=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0xf149[_0x2637ac];return _0x4a5758;};'use strict';var _=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var moment=require(_0x9f14('0x2'));var BPromise=require(_0x9f14('0x3'));var rs=require(_0x9f14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f14('0x5'))['db'];var utils=require(_0x9f14('0x6'));var logger=require(_0x9f14('0x7'))(_0x9f14('0x8'));var config=require(_0x9f14('0x9'));var jayson=require(_0x9f14('0xa'));var client=jayson[_0x9f14('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2126ef,_0x2122e2,_0x1f8079){return new BPromise(function(_0x2444df,_0x1e240e){return client['request'](_0x2126ef,_0x1f8079)['then'](function(_0x557c3f){logger[_0x9f14('0xc')](_0x9f14('0xd'),_0x2122e2,_0x9f14('0xe'));logger['debug'](_0x9f14('0xf'),_0x2122e2,_0x9f14('0xe'),JSON[_0x9f14('0x10')](_0x557c3f));if(_0x557c3f[_0x9f14('0x11')]){if(_0x557c3f[_0x9f14('0x11')][_0x9f14('0x12')]===0x1f4){logger[_0x9f14('0x11')](_0x9f14('0xd'),_0x2122e2,_0x557c3f[_0x9f14('0x11')][_0x9f14('0x13')]);return _0x1e240e(_0x557c3f[_0x9f14('0x11')]['message']);}logger[_0x9f14('0x11')](_0x9f14('0xd'),_0x2122e2,_0x557c3f[_0x9f14('0x11')][_0x9f14('0x13')]);return _0x2444df(_0x557c3f['error'][_0x9f14('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x2122e2,'request\x20sent');_0x2444df(_0x557c3f['result'][_0x9f14('0x13')]);}})[_0x9f14('0x14')](function(_0x5069b){logger[_0x9f14('0x11')](_0x9f14('0xd'),_0x2122e2,_0x5069b);_0x1e240e(_0x5069b);});});}exports['GetSugarcrmAccount']=function(_0x2b5a9c){var _0x251fc3=this;return new Promise(function(_0x5d2ce1,_0x1b6cb0){return db['SugarcrmAccount'][_0x9f14('0x15')]({'raw':_0x2b5a9c[_0x9f14('0x16')]?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x17')]===undefined?!![]:![]:!![],'where':_0x2b5a9c['options']?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x18')]||null:null,'attributes':_0x2b5a9c[_0x9f14('0x16')]?_0x2b5a9c[_0x9f14('0x16')]['attributes']||null:null,'limit':_0x2b5a9c['options']?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x19')]||null:null,'include':_0x2b5a9c[_0x9f14('0x16')]?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x1a')]?_['map'](_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x1a')],function(_0x22bc8d){return{'model':db[_0x22bc8d['model']],'as':_0x22bc8d['as'],'attributes':_0x22bc8d[_0x9f14('0x1b')],'include':_0x22bc8d['include']?_['map'](_0x22bc8d[_0x9f14('0x1a')],function(_0x51dd61){return{'model':db[_0x51dd61[_0x9f14('0x1c')]],'as':_0x51dd61['as'],'attributes':_0x51dd61[_0x9f14('0x1b')],'include':_0x51dd61[_0x9f14('0x1a')]?_[_0x9f14('0x1d')](_0x51dd61[_0x9f14('0x1a')],function(_0xca5b9d){return{'model':db[_0xca5b9d[_0x9f14('0x1c')]],'as':_0xca5b9d['as'],'attributes':_0xca5b9d[_0x9f14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9f14('0x1e')](function(_0x46242d){logger[_0x9f14('0xc')](_0x9f14('0x1f'),_0x2b5a9c);logger['debug'](_0x9f14('0x1f'),_0x2b5a9c,JSON['stringify'](_0x46242d));_0x5d2ce1(_0x46242d);})[_0x9f14('0x14')](function(_0x55e669){logger[_0x9f14('0x11')](_0x9f14('0x1f'),_0x55e669[_0x9f14('0x13')],_0x2b5a9c);_0x1b6cb0(_0x251fc3[_0x9f14('0x11')](0x1f4,_0x55e669['message']));});});};exports[_0x9f14('0x20')]=function(_0x57bf83){var _0x453c36=this;return new Promise(function(_0x202de8,_0x2dcd1d){return db[_0x9f14('0x21')][_0x9f14('0x22')]({'raw':_0x57bf83[_0x9f14('0x16')]?_0x57bf83['options'][_0x9f14('0x17')]===undefined?!![]:![]:!![],'where':_0x57bf83['options']?_0x57bf83[_0x9f14('0x16')]['where']||null:null,'attributes':_0x57bf83[_0x9f14('0x16')]?_0x57bf83[_0x9f14('0x16')][_0x9f14('0x1b')]||null:null,'include':_0x57bf83[_0x9f14('0x16')]?_0x57bf83[_0x9f14('0x16')][_0x9f14('0x1a')]?_[_0x9f14('0x1d')](_0x57bf83[_0x9f14('0x16')][_0x9f14('0x1a')],function(_0x15893b){return{'model':db[_0x15893b[_0x9f14('0x1c')]],'as':_0x15893b['as'],'attributes':_0x15893b[_0x9f14('0x1b')],'include':_0x15893b[_0x9f14('0x1a')]?_['map'](_0x15893b['include'],function(_0x4672e5){return{'model':db[_0x4672e5[_0x9f14('0x1c')]],'as':_0x4672e5['as'],'attributes':_0x4672e5[_0x9f14('0x1b')],'include':_0x4672e5[_0x9f14('0x1a')]?_[_0x9f14('0x1d')](_0x4672e5['include'],function(_0x26db3d){return{'model':db[_0x26db3d['model']],'as':_0x26db3d['as'],'attributes':_0x26db3d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f14('0x1e')](function(_0x400e0d){logger['info']('ShowSugarcrmAccount',_0x57bf83);logger[_0x9f14('0x23')](_0x9f14('0x20'),_0x57bf83,JSON[_0x9f14('0x10')](_0x400e0d));_0x202de8(_0x400e0d);})[_0x9f14('0x14')](function(_0x3de84d){logger[_0x9f14('0x11')](_0x9f14('0x20'),_0x3de84d[_0x9f14('0x13')],_0x57bf83);_0x2dcd1d(_0x453c36['error'](0x1f4,_0x3de84d['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 197eef9..9b8e24e 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 _0x301c=['put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/descriptions','create'];(function(_0x4441cf,_0x4509a6){var _0x3b8877=function(_0x3f3a17){while(--_0x3f3a17){_0x4441cf['push'](_0x4441cf['shift']());}};_0x3b8877(++_0x4509a6);}(_0x301c,0x68));var _0xc301=function(_0x335e51,_0x3c63fb){_0x335e51=_0x335e51-0x0;var _0x11637f=_0x301c[_0x335e51];return _0x11637f;};'use strict';var multer=require(_0xc301('0x0'));var util=require(_0xc301('0x1'));var path=require(_0xc301('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc301('0x3')]();var fs_extra=require(_0xc301('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc301('0x5'));var config=require(_0xc301('0x6'));var controller=require(_0xc301('0x7'));router[_0xc301('0x8')]('/',auth[_0xc301('0x9')](),controller[_0xc301('0xa')]);router[_0xc301('0x8')](_0xc301('0xb'),auth[_0xc301('0x9')](),controller[_0xc301('0xc')]);router[_0xc301('0x8')](_0xc301('0xd'),auth[_0xc301('0x9')](),controller['getFields']);router[_0xc301('0x8')]('/:id/subjects',auth[_0xc301('0x9')](),controller['getSubjects']);router[_0xc301('0x8')](_0xc301('0xe'),auth[_0xc301('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xc301('0x9')](),controller[_0xc301('0xf')]);router[_0xc301('0x10')](_0xc301('0xb'),auth[_0xc301('0x9')](),controller[_0xc301('0x11')]);router['delete'](_0xc301('0xb'),auth['isAuthenticated'](),controller[_0xc301('0x12')]);module[_0xc301('0x13')]=router; \ No newline at end of file +var _0xdd7a=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x4a328f,_0xd272ee){var _0x369988=function(_0x3eebff){while(--_0x3eebff){_0x4a328f['push'](_0x4a328f['shift']());}};_0x369988(++_0xd272ee);}(_0xdd7a,0x8e));var _0xadd7=function(_0xb8d136,_0x2992dc){_0xb8d136=_0xb8d136-0x0;var _0x2bc98a=_0xdd7a[_0xb8d136];return _0x2bc98a;};'use strict';var multer=require(_0xadd7('0x0'));var util=require(_0xadd7('0x1'));var path=require('path');var timeout=require(_0xadd7('0x2'));var express=require(_0xadd7('0x3'));var router=express[_0xadd7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xadd7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xadd7('0x6'));var controller=require(_0xadd7('0x7'));router[_0xadd7('0x8')]('/',auth[_0xadd7('0x9')](),controller[_0xadd7('0xa')]);router[_0xadd7('0x8')](_0xadd7('0xb'),auth[_0xadd7('0x9')](),controller[_0xadd7('0xc')]);router[_0xadd7('0x8')](_0xadd7('0xd'),auth[_0xadd7('0x9')](),controller['getFields']);router[_0xadd7('0x8')](_0xadd7('0xe'),auth[_0xadd7('0x9')](),controller[_0xadd7('0xf')]);router[_0xadd7('0x8')](_0xadd7('0x10'),auth['isAuthenticated'](),controller[_0xadd7('0x11')]);router[_0xadd7('0x12')]('/',auth['isAuthenticated'](),controller[_0xadd7('0x13')]);router[_0xadd7('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xadd7('0x15')]);router[_0xadd7('0x16')](_0xadd7('0xb'),auth[_0xadd7('0x9')](),controller[_0xadd7('0x17')]);module[_0xadd7('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c2cd193..bdd63e2 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 _0xdc7e=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdc7e,0x1c1));var _0xedc7=function(_0x964896,_0x477f71){_0x964896=_0x964896-0x0;var _0x40043e=_0xdc7e[_0x964896];return _0x40043e;};'use strict';var Sequelize=require(_0xedc7('0x0'));module[_0xedc7('0x1')]={'name':{'type':Sequelize[_0xedc7('0x2')]},'description':{'type':Sequelize[_0xedc7('0x2')]}}; \ No newline at end of file +var _0x2455=['STRING','sequelize','exports'];(function(_0x5ac93e,_0x1e9514){var _0x349d2c=function(_0x3b9220){while(--_0x3b9220){_0x5ac93e['push'](_0x5ac93e['shift']());}};_0x349d2c(++_0x1e9514);}(_0x2455,0x1e1));var _0x5245=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0x2455[_0x39bc06];return _0x131143;};'use strict';var Sequelize=require(_0x5245('0x0'));module[_0x5245('0x1')]={'name':{'type':Sequelize[_0x5245('0x2')]},'description':{'type':Sequelize[_0x5245('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1515de1..a47322d 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 _0x020f=['attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','fields','create','body','params','find','getFields','findOne','keys','getSubjects','hasOwnProperty','SugarcrmField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','query','filters','intersection','model'];(function(_0x550552,_0x911116){var _0x2486df=function(_0x1a6bbc){while(--_0x1a6bbc){_0x550552['push'](_0x550552['shift']());}};_0x2486df(++_0x911116);}(_0x020f,0x1b6));var _0xf020=function(_0x56c450,_0x257c25){_0x56c450=_0x56c450-0x0;var _0x869353=_0x020f[_0x56c450];return _0x869353;};'use strict';var emlformat=require(_0xf020('0x0'));var rimraf=require(_0xf020('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf020('0x2'));var rp=require(_0xf020('0x3'));var moment=require(_0xf020('0x4'));var BPromise=require(_0xf020('0x5'));var Mustache=require(_0xf020('0x6'));var util=require('util');var path=require(_0xf020('0x7'));var sox=require(_0xf020('0x8'));var csv=require('to-csv');var ejs=require(_0xf020('0x9'));var fs=require('fs');var fs_extra=require(_0xf020('0xa'));var _=require(_0xf020('0xb'));var squel=require(_0xf020('0xc'));var crypto=require(_0xf020('0xd'));var jsforce=require(_0xf020('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf020('0xf'));var querystring=require(_0xf020('0x10'));var Papa=require('papaparse');var Redis=require(_0xf020('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf020('0x12'));var hardwareService=require(_0xf020('0x13'));var logger=require(_0xf020('0x14'))(_0xf020('0x15'));var utils=require(_0xf020('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf020('0x17'));var db=require(_0xf020('0x18'))['db'];function respondWithStatusCode(_0x4de020,_0x5af096){_0x5af096=_0x5af096||0xcc;return function(_0x310ed1){if(_0x310ed1){return _0x4de020[_0xf020('0x19')](_0x5af096);}return _0x4de020[_0xf020('0x1a')](_0x5af096)[_0xf020('0x1b')]();};}function respondWithResult(_0x1de8c7,_0x121f3b){_0x121f3b=_0x121f3b||0xc8;return function(_0x357c51){if(_0x357c51){return _0x1de8c7[_0xf020('0x1a')](_0x121f3b)['json'](_0x357c51);}};}function respondWithFilteredResult(_0x29f8bd,_0x442040){return function(_0x3161bf){if(_0x3161bf){var _0x1d4984=typeof _0x442040['offset']===_0xf020('0x1c')&&typeof _0x442040['limit']===_0xf020('0x1c');var _0x379a88=_0x3161bf[_0xf020('0x1d')];var _0x26fe5a=_0x1d4984?0x0:_0x442040[_0xf020('0x1e')];var _0x2bc730=_0x1d4984?_0x3161bf[_0xf020('0x1d')]:_0x442040[_0xf020('0x1e')]+_0x442040[_0xf020('0x1f')];var _0xe4b850;if(_0x2bc730>=_0x379a88){_0x2bc730=_0x379a88;_0xe4b850=0xc8;}else{_0xe4b850=0xce;}_0x29f8bd[_0xf020('0x1a')](_0xe4b850);return _0x29f8bd[_0xf020('0x20')](_0xf020('0x21'),_0x26fe5a+'-'+_0x2bc730+'/'+_0x379a88)[_0xf020('0x22')](_0x3161bf);}return null;};}function patchUpdates(_0x3df332){return function(_0x1b8186){try{jsonpatch[_0xf020('0x23')](_0x1b8186,_0x3df332,!![]);}catch(_0x2fa241){return BPromise[_0xf020('0x24')](_0x2fa241);}return _0x1b8186[_0xf020('0x25')]();};}function saveUpdates(_0xb3dce4,_0x248425){return function(_0x54c115){if(_0x54c115){return _0x54c115[_0xf020('0x26')](_0xb3dce4)[_0xf020('0x27')](function(_0x1a7579){return _0x1a7579;});}return null;};}function removeEntity(_0x413b25,_0x4586be){return function(_0x29dd0e){if(_0x29dd0e){return _0x29dd0e[_0xf020('0x28')]()[_0xf020('0x27')](function(){_0x413b25['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3452d8,_0x1f3e44){return function(_0x3ecfde){if(!_0x3ecfde){_0x3452d8[_0xf020('0x19')](0x194);}return _0x3ecfde;};}function handleError(_0x1226a0,_0x1082f2){_0x1082f2=_0x1082f2||0x1f4;return function(_0x42c9ca){logger['error'](_0x42c9ca[_0xf020('0x29')]);if(_0x42c9ca[_0xf020('0x2a')]){delete _0x42c9ca[_0xf020('0x2a')];}_0x1226a0[_0xf020('0x1a')](_0x1082f2)[_0xf020('0x2b')](_0x42c9ca);};}exports[_0xf020('0x2c')]=function(_0x50824c,_0x48b1be){var _0x277353={},_0x4043bb={},_0x517d81={'count':0x0,'rows':[]};var _0x16cbbf=_[_0xf020('0x2d')](db[_0xf020('0x2e')][_0xf020('0x2f')],function(_0x344c96){return{'name':_0x344c96['fieldName'],'type':_0x344c96[_0xf020('0x30')][_0xf020('0x31')]};});_0x4043bb['model']=_[_0xf020('0x2d')](_0x16cbbf,_0xf020('0x2a'));_0x4043bb['query']=_['keys'](_0x50824c[_0xf020('0x32')]);_0x4043bb[_0xf020('0x33')]=_[_0xf020('0x34')](_0x4043bb[_0xf020('0x35')],_0x4043bb['query']);_0x277353[_0xf020('0x36')]=_[_0xf020('0x34')](_0x4043bb[_0xf020('0x35')],qs['fields'](_0x50824c['query']['fields']));_0x277353[_0xf020('0x36')]=_0x277353[_0xf020('0x36')][_0xf020('0x37')]?_0x277353[_0xf020('0x36')]:_0x4043bb[_0xf020('0x35')];if(!_0x50824c[_0xf020('0x32')]['hasOwnProperty'](_0xf020('0x38'))){_0x277353[_0xf020('0x1f')]=qs[_0xf020('0x1f')](_0x50824c['query'][_0xf020('0x1f')]);_0x277353[_0xf020('0x1e')]=qs['offset'](_0x50824c[_0xf020('0x32')][_0xf020('0x1e')]);}_0x277353[_0xf020('0x39')]=qs[_0xf020('0x3a')](_0x50824c['query'][_0xf020('0x3a')]);_0x277353['where']=qs[_0xf020('0x33')](_[_0xf020('0x3b')](_0x50824c['query'],_0x4043bb[_0xf020('0x33')]),_0x16cbbf);if(_0x50824c[_0xf020('0x32')][_0xf020('0x3c')]){_0x277353['where']=_[_0xf020('0x3d')](_0x277353[_0xf020('0x3e')],{'$or':_['map'](_0x16cbbf,function(_0x135457){if(_0x135457[_0xf020('0x30')]!==_0xf020('0x3f')){var _0x3779c2={};_0x3779c2[_0x135457['name']]={'$like':'%'+_0x50824c[_0xf020('0x32')][_0xf020('0x3c')]+'%'};return _0x3779c2;}})});}_0x277353=_['merge']({},_0x277353,_0x50824c[_0xf020('0x40')]);var _0x1b0d08={'where':_0x277353[_0xf020('0x3e')]};return db[_0xf020('0x2e')][_0xf020('0x1d')](_0x1b0d08)[_0xf020('0x27')](function(_0xabed7b){_0x517d81[_0xf020('0x1d')]=_0xabed7b;if(_0x50824c['query'][_0xf020('0x41')]){_0x277353[_0xf020('0x42')]=[{'all':!![]}];}return db[_0xf020('0x2e')]['findAll'](_0x277353);})[_0xf020('0x27')](function(_0x927393){_0x517d81[_0xf020('0x43')]=_0x927393;return _0x517d81;})[_0xf020('0x27')](respondWithFilteredResult(_0x48b1be,_0x277353))[_0xf020('0x44')](handleError(_0x48b1be,null));};exports[_0xf020('0x45')]=function(_0x376140,_0x3217ba){var _0x274bea={'raw':![],'where':{'id':_0x376140['params']['id']}},_0x4a37a9={};_0x4a37a9[_0xf020('0x35')]=_['keys'](db['SugarcrmConfiguration'][_0xf020('0x2f')]);_0x4a37a9[_0xf020('0x32')]=_['keys'](_0x376140[_0xf020('0x32')]);_0x4a37a9[_0xf020('0x33')]=_['intersection'](_0x4a37a9['model'],_0x4a37a9['query']);_0x274bea[_0xf020('0x36')]=_[_0xf020('0x34')](_0x4a37a9['model'],qs['fields'](_0x376140[_0xf020('0x32')][_0xf020('0x46')]));_0x274bea[_0xf020('0x36')]=_0x274bea[_0xf020('0x36')]['length']?_0x274bea[_0xf020('0x36')]:_0x4a37a9[_0xf020('0x35')];if(_0x376140[_0xf020('0x32')][_0xf020('0x41')]){_0x274bea[_0xf020('0x42')]=[{'all':!![]}];}_0x274bea=_[_0xf020('0x3d')]({},_0x274bea,_0x376140['options']);return db[_0xf020('0x2e')]['find'](_0x274bea)[_0xf020('0x27')](handleEntityNotFound(_0x3217ba,null))[_0xf020('0x27')](respondWithResult(_0x3217ba,null))[_0xf020('0x44')](handleError(_0x3217ba,null));};exports[_0xf020('0x47')]=function(_0x1649cc,_0xc5f420){return db[_0xf020('0x2e')][_0xf020('0x47')](_0x1649cc[_0xf020('0x48')],{})['then'](respondWithResult(_0xc5f420,0xc9))[_0xf020('0x44')](handleError(_0xc5f420,null));};exports[_0xf020('0x26')]=function(_0x50d6f6,_0x52fdd5){if(_0x50d6f6['body']['id']){delete _0x50d6f6[_0xf020('0x48')]['id'];}return db[_0xf020('0x2e')]['find']({'where':{'id':_0x50d6f6[_0xf020('0x49')]['id']}})['then'](handleEntityNotFound(_0x52fdd5,null))['then'](saveUpdates(_0x50d6f6['body'],null))[_0xf020('0x27')](respondWithResult(_0x52fdd5,null))[_0xf020('0x44')](handleError(_0x52fdd5,null));};exports[_0xf020('0x28')]=function(_0x3da5d0,_0x2f4688){return db[_0xf020('0x2e')][_0xf020('0x4a')]({'where':{'id':_0x3da5d0['params']['id']}})[_0xf020('0x27')](handleEntityNotFound(_0x2f4688,null))[_0xf020('0x27')](removeEntity(_0x2f4688,null))[_0xf020('0x44')](handleError(_0x2f4688,null));};exports[_0xf020('0x4b')]=function(_0x19b629,_0x332cfb,_0xc89d73){var _0x1bbfd8={};var _0x333266={};var _0x4362fa;var _0xf4d483;return db[_0xf020('0x2e')][_0xf020('0x4c')]({'where':{'id':_0x19b629[_0xf020('0x49')]['id']}})[_0xf020('0x27')](handleEntityNotFound(_0x332cfb,null))[_0xf020('0x27')](function(_0x53629d){if(_0x53629d){_0x4362fa=_0x53629d;_0x333266[_0xf020('0x35')]=_[_0xf020('0x4d')](db['SugarcrmField'][_0xf020('0x2f')]);_0x333266[_0xf020('0x32')]=_['keys'](_0x19b629[_0xf020('0x32')]);_0x333266[_0xf020('0x33')]=_[_0xf020('0x34')](_0x333266[_0xf020('0x35')],_0x333266[_0xf020('0x32')]);_0x1bbfd8['attributes']=_[_0xf020('0x34')](_0x333266['model'],qs[_0xf020('0x46')](_0x19b629[_0xf020('0x32')][_0xf020('0x46')]));_0x1bbfd8[_0xf020('0x36')]=_0x1bbfd8[_0xf020('0x36')][_0xf020('0x37')]?_0x1bbfd8[_0xf020('0x36')]:_0x333266['model'];_0x1bbfd8['order']=qs['sort'](_0x19b629['query'][_0xf020('0x3a')]);_0x1bbfd8['where']=qs[_0xf020('0x33')](_['pick'](_0x19b629[_0xf020('0x32')],_0x333266[_0xf020('0x33')]));if(_0x19b629[_0xf020('0x32')][_0xf020('0x3c')]){_0x1bbfd8[_0xf020('0x3e')]=_[_0xf020('0x3d')](_0x1bbfd8[_0xf020('0x3e')],{'$or':_['map'](_0x1bbfd8[_0xf020('0x36')],function(_0x1e34e4){var _0x4880d2={};_0x4880d2[_0x1e34e4]={'$like':'%'+_0x19b629[_0xf020('0x32')][_0xf020('0x3c')]+'%'};return _0x4880d2;})});}_0x1bbfd8=_[_0xf020('0x3d')]({},_0x1bbfd8,_0x19b629['options']);return _0x4362fa[_0xf020('0x4b')](_0x1bbfd8);}})[_0xf020('0x27')](function(_0x6c691f){if(_0x6c691f){_0xf4d483=_0x6c691f['length'];if(!_0x19b629[_0xf020('0x32')]['hasOwnProperty'](_0xf020('0x38'))){_0x1bbfd8['limit']=qs['limit'](_0x19b629[_0xf020('0x32')][_0xf020('0x1f')]);_0x1bbfd8[_0xf020('0x1e')]=qs[_0xf020('0x1e')](_0x19b629[_0xf020('0x32')][_0xf020('0x1e')]);}return _0x4362fa[_0xf020('0x4b')](_0x1bbfd8);}})[_0xf020('0x27')](function(_0x3ada79){if(_0x3ada79){return _0x3ada79?{'count':_0xf4d483,'rows':_0x3ada79}:null;}})[_0xf020('0x27')](respondWithResult(_0x332cfb,null))[_0xf020('0x44')](handleError(_0x332cfb,null));};exports[_0xf020('0x4e')]=function(_0x752158,_0x43764f,_0x326eb2){var _0x142e4d={};var _0x5b2513={};var _0x1b74bd;var _0xcfd744;return db[_0xf020('0x2e')][_0xf020('0x4c')]({'where':{'id':_0x752158[_0xf020('0x49')]['id']}})[_0xf020('0x27')](handleEntityNotFound(_0x43764f,null))[_0xf020('0x27')](function(_0x3a8214){if(_0x3a8214){_0x1b74bd=_0x3a8214;_0x5b2513['model']=_['keys'](db['SugarcrmField'][_0xf020('0x2f')]);_0x5b2513[_0xf020('0x32')]=_[_0xf020('0x4d')](_0x752158[_0xf020('0x32')]);_0x5b2513[_0xf020('0x33')]=_[_0xf020('0x34')](_0x5b2513[_0xf020('0x35')],_0x5b2513['query']);_0x142e4d[_0xf020('0x36')]=_[_0xf020('0x34')](_0x5b2513[_0xf020('0x35')],qs[_0xf020('0x46')](_0x752158['query'][_0xf020('0x46')]));_0x142e4d[_0xf020('0x36')]=_0x142e4d[_0xf020('0x36')][_0xf020('0x37')]?_0x142e4d['attributes']:_0x5b2513[_0xf020('0x35')];_0x142e4d[_0xf020('0x39')]=qs[_0xf020('0x3a')](_0x752158[_0xf020('0x32')][_0xf020('0x3a')]);_0x142e4d[_0xf020('0x3e')]=qs['filters'](_['pick'](_0x752158['query'],_0x5b2513['filters']));if(_0x752158[_0xf020('0x32')][_0xf020('0x3c')]){_0x142e4d[_0xf020('0x3e')]=_[_0xf020('0x3d')](_0x142e4d[_0xf020('0x3e')],{'$or':_[_0xf020('0x2d')](_0x142e4d[_0xf020('0x36')],function(_0x1aab83){var _0x3307be={};_0x3307be[_0x1aab83]={'$like':'%'+_0x752158[_0xf020('0x32')][_0xf020('0x3c')]+'%'};return _0x3307be;})});}_0x142e4d=_[_0xf020('0x3d')]({},_0x142e4d,_0x752158[_0xf020('0x40')]);return _0x1b74bd[_0xf020('0x4e')](_0x142e4d);}})['then'](function(_0x51517d){if(_0x51517d){_0xcfd744=_0x51517d[_0xf020('0x37')];if(!_0x752158[_0xf020('0x32')][_0xf020('0x4f')](_0xf020('0x38'))){_0x142e4d[_0xf020('0x1f')]=qs[_0xf020('0x1f')](_0x752158[_0xf020('0x32')][_0xf020('0x1f')]);_0x142e4d[_0xf020('0x1e')]=qs[_0xf020('0x1e')](_0x752158[_0xf020('0x32')][_0xf020('0x1e')]);}return _0x1b74bd[_0xf020('0x4e')](_0x142e4d);}})[_0xf020('0x27')](function(_0xe42e87){if(_0xe42e87){return _0xe42e87?{'count':_0xcfd744,'rows':_0xe42e87}:null;}})['then'](respondWithResult(_0x43764f,null))[_0xf020('0x44')](handleError(_0x43764f,null));};exports['getDescriptions']=function(_0x44ea5c,_0x571cde,_0x3a4fc9){var _0x5c262c={};var _0x20dc0d={};var _0x37d43f;var _0x29ff9b;return db[_0xf020('0x2e')][_0xf020('0x4c')]({'where':{'id':_0x44ea5c['params']['id']}})[_0xf020('0x27')](handleEntityNotFound(_0x571cde,null))[_0xf020('0x27')](function(_0x3a9ce9){if(_0x3a9ce9){_0x37d43f=_0x3a9ce9;_0x20dc0d[_0xf020('0x35')]=_['keys'](db[_0xf020('0x50')][_0xf020('0x2f')]);_0x20dc0d[_0xf020('0x32')]=_['keys'](_0x44ea5c[_0xf020('0x32')]);_0x20dc0d[_0xf020('0x33')]=_[_0xf020('0x34')](_0x20dc0d['model'],_0x20dc0d[_0xf020('0x32')]);_0x5c262c[_0xf020('0x36')]=_[_0xf020('0x34')](_0x20dc0d[_0xf020('0x35')],qs[_0xf020('0x46')](_0x44ea5c[_0xf020('0x32')][_0xf020('0x46')]));_0x5c262c[_0xf020('0x36')]=_0x5c262c['attributes'][_0xf020('0x37')]?_0x5c262c['attributes']:_0x20dc0d[_0xf020('0x35')];_0x5c262c[_0xf020('0x39')]=qs[_0xf020('0x3a')](_0x44ea5c[_0xf020('0x32')][_0xf020('0x3a')]);_0x5c262c[_0xf020('0x3e')]=qs[_0xf020('0x33')](_[_0xf020('0x3b')](_0x44ea5c[_0xf020('0x32')],_0x20dc0d[_0xf020('0x33')]));if(_0x44ea5c[_0xf020('0x32')][_0xf020('0x3c')]){_0x5c262c[_0xf020('0x3e')]=_[_0xf020('0x3d')](_0x5c262c[_0xf020('0x3e')],{'$or':_[_0xf020('0x2d')](_0x5c262c[_0xf020('0x36')],function(_0xe8ac8f){var _0x27f118={};_0x27f118[_0xe8ac8f]={'$like':'%'+_0x44ea5c[_0xf020('0x32')][_0xf020('0x3c')]+'%'};return _0x27f118;})});}_0x5c262c=_[_0xf020('0x3d')]({},_0x5c262c,_0x44ea5c[_0xf020('0x40')]);return _0x37d43f['getDescriptions'](_0x5c262c);}})[_0xf020('0x27')](function(_0x5ef904){if(_0x5ef904){_0x29ff9b=_0x5ef904[_0xf020('0x37')];if(!_0x44ea5c[_0xf020('0x32')][_0xf020('0x4f')](_0xf020('0x38'))){_0x5c262c[_0xf020('0x1f')]=qs[_0xf020('0x1f')](_0x44ea5c['query'][_0xf020('0x1f')]);_0x5c262c['offset']=qs['offset'](_0x44ea5c[_0xf020('0x32')]['offset']);}return _0x37d43f[_0xf020('0x51')](_0x5c262c);}})[_0xf020('0x27')](function(_0xbd6b8b){if(_0xbd6b8b){return _0xbd6b8b?{'count':_0x29ff9b,'rows':_0xbd6b8b}:null;}})[_0xf020('0x27')](respondWithResult(_0x571cde,null))[_0xf020('0x44')](handleError(_0x571cde,null));}; \ No newline at end of file +var _0x5539=['sendStatus','error','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','update','getFields','SugarcrmField','sort','filter','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','then','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5539,0x7c));var _0x9553=function(_0x344890,_0x3332a2){_0x344890=_0x344890-0x0;var _0x210860=_0x5539[_0x344890];return _0x210860;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9553('0x0'));var zipdir=require(_0x9553('0x1'));var jsonpatch=require(_0x9553('0x2'));var rp=require(_0x9553('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9553('0x4'));var util=require(_0x9553('0x5'));var path=require(_0x9553('0x6'));var sox=require('sox');var csv=require(_0x9553('0x7'));var ejs=require(_0x9553('0x8'));var fs=require('fs');var fs_extra=require(_0x9553('0x9'));var _=require(_0x9553('0xa'));var squel=require(_0x9553('0xb'));var crypto=require(_0x9553('0xc'));var jsforce=require(_0x9553('0xd'));var deskjs=require(_0x9553('0xe'));var toCsv=require(_0x9553('0x7'));var querystring=require(_0x9553('0xf'));var Papa=require(_0x9553('0x10'));var Redis=require(_0x9553('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9553('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9553('0x13'));var logger=require(_0x9553('0x14'))(_0x9553('0x15'));var utils=require('../../config/utils');var config=require(_0x9553('0x16'));var licenseUtil=require(_0x9553('0x17'));var db=require(_0x9553('0x18'))['db'];function respondWithStatusCode(_0x2ff187,_0x108ed9){_0x108ed9=_0x108ed9||0xcc;return function(_0x2b6c00){if(_0x2b6c00){return _0x2ff187['sendStatus'](_0x108ed9);}return _0x2ff187['status'](_0x108ed9)[_0x9553('0x19')]();};}function respondWithResult(_0x1e6973,_0x299222){_0x299222=_0x299222||0xc8;return function(_0x1cf804){if(_0x1cf804){return _0x1e6973[_0x9553('0x1a')](_0x299222)[_0x9553('0x1b')](_0x1cf804);}};}function respondWithFilteredResult(_0x3db344,_0x10d506){return function(_0x38147b){if(_0x38147b){var _0x59014d=typeof _0x10d506[_0x9553('0x1c')]===_0x9553('0x1d')&&typeof _0x10d506[_0x9553('0x1e')]===_0x9553('0x1d');var _0x27c4fc=_0x38147b[_0x9553('0x1f')];var _0x4901fa=_0x59014d?0x0:_0x10d506[_0x9553('0x1c')];var _0x43899f=_0x59014d?_0x38147b[_0x9553('0x1f')]:_0x10d506[_0x9553('0x1c')]+_0x10d506['limit'];var _0x1086ea;if(_0x43899f>=_0x27c4fc){_0x43899f=_0x27c4fc;_0x1086ea=0xc8;}else{_0x1086ea=0xce;}_0x3db344[_0x9553('0x1a')](_0x1086ea);return _0x3db344[_0x9553('0x20')]('Content-Range',_0x4901fa+'-'+_0x43899f+'/'+_0x27c4fc)[_0x9553('0x1b')](_0x38147b);}return null;};}function patchUpdates(_0x4a438c){return function(_0x2cca45){try{jsonpatch[_0x9553('0x21')](_0x2cca45,_0x4a438c,!![]);}catch(_0x5370a8){return BPromise['reject'](_0x5370a8);}return _0x2cca45['save']();};}function saveUpdates(_0x232bcc,_0x5cc922){return function(_0x595ca8){if(_0x595ca8){return _0x595ca8['update'](_0x232bcc)[_0x9553('0x22')](function(_0x5186dc){return _0x5186dc;});}return null;};}function removeEntity(_0x44e43d,_0x9b0363){return function(_0x343e3f){if(_0x343e3f){return _0x343e3f[_0x9553('0x23')]()['then'](function(){_0x44e43d[_0x9553('0x1a')](0xcc)[_0x9553('0x19')]();});}};}function handleEntityNotFound(_0x24d966,_0x13d391){return function(_0x1a16c4){if(!_0x1a16c4){_0x24d966[_0x9553('0x24')](0x194);}return _0x1a16c4;};}function handleError(_0x18a1b5,_0x38240f){_0x38240f=_0x38240f||0x1f4;return function(_0xb1e0b){logger[_0x9553('0x25')](_0xb1e0b['stack']);if(_0xb1e0b[_0x9553('0x26')]){delete _0xb1e0b[_0x9553('0x26')];}_0x18a1b5[_0x9553('0x1a')](_0x38240f)[_0x9553('0x27')](_0xb1e0b);};}exports[_0x9553('0x28')]=function(_0x3f49a3,_0x590d07){var _0x3089d3={},_0x230675={},_0x31bb57={'count':0x0,'rows':[]};var _0xa3c335=_['map'](db[_0x9553('0x29')][_0x9553('0x2a')],function(_0x552697){return{'name':_0x552697[_0x9553('0x2b')],'type':_0x552697['type'][_0x9553('0x2c')]};});_0x230675[_0x9553('0x2d')]=_[_0x9553('0x2e')](_0xa3c335,_0x9553('0x26'));_0x230675['query']=_[_0x9553('0x2f')](_0x3f49a3[_0x9553('0x30')]);_0x230675[_0x9553('0x31')]=_[_0x9553('0x32')](_0x230675['model'],_0x230675[_0x9553('0x30')]);_0x3089d3[_0x9553('0x33')]=_[_0x9553('0x32')](_0x230675[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x3f49a3['query']['fields']));_0x3089d3[_0x9553('0x33')]=_0x3089d3[_0x9553('0x33')][_0x9553('0x35')]?_0x3089d3[_0x9553('0x33')]:_0x230675[_0x9553('0x2d')];if(!_0x3f49a3[_0x9553('0x30')]['hasOwnProperty'](_0x9553('0x36'))){_0x3089d3[_0x9553('0x1e')]=qs[_0x9553('0x1e')](_0x3f49a3[_0x9553('0x30')][_0x9553('0x1e')]);_0x3089d3[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x3f49a3['query'][_0x9553('0x1c')]);}_0x3089d3[_0x9553('0x37')]=qs['sort'](_0x3f49a3[_0x9553('0x30')]['sort']);_0x3089d3[_0x9553('0x38')]=qs[_0x9553('0x31')](_[_0x9553('0x39')](_0x3f49a3[_0x9553('0x30')],_0x230675['filters']),_0xa3c335);if(_0x3f49a3['query']['filter']){_0x3089d3['where']=_['merge'](_0x3089d3['where'],{'$or':_['map'](_0xa3c335,function(_0x524cc2){if(_0x524cc2[_0x9553('0x3a')]!==_0x9553('0x3b')){var _0x4b7679={};_0x4b7679[_0x524cc2['name']]={'$like':'%'+_0x3f49a3[_0x9553('0x30')]['filter']+'%'};return _0x4b7679;}})});}_0x3089d3=_['merge']({},_0x3089d3,_0x3f49a3[_0x9553('0x3c')]);var _0x170240={'where':_0x3089d3[_0x9553('0x38')]};return db[_0x9553('0x29')]['count'](_0x170240)[_0x9553('0x22')](function(_0xb973ad){_0x31bb57[_0x9553('0x1f')]=_0xb973ad;if(_0x3f49a3[_0x9553('0x30')][_0x9553('0x3d')]){_0x3089d3[_0x9553('0x3e')]=[{'all':!![]}];}return db[_0x9553('0x29')]['findAll'](_0x3089d3);})[_0x9553('0x22')](function(_0x2025b6){_0x31bb57[_0x9553('0x3f')]=_0x2025b6;return _0x31bb57;})[_0x9553('0x22')](respondWithFilteredResult(_0x590d07,_0x3089d3))[_0x9553('0x40')](handleError(_0x590d07,null));};exports[_0x9553('0x41')]=function(_0x30ae44,_0x22b784){var _0x7a8dea={'raw':![],'where':{'id':_0x30ae44[_0x9553('0x42')]['id']}},_0x3f7307={};_0x3f7307['model']=_['keys'](db[_0x9553('0x29')][_0x9553('0x2a')]);_0x3f7307['query']=_['keys'](_0x30ae44[_0x9553('0x30')]);_0x3f7307[_0x9553('0x31')]=_[_0x9553('0x32')](_0x3f7307[_0x9553('0x2d')],_0x3f7307[_0x9553('0x30')]);_0x7a8dea['attributes']=_['intersection'](_0x3f7307[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x30ae44[_0x9553('0x30')][_0x9553('0x34')]));_0x7a8dea['attributes']=_0x7a8dea[_0x9553('0x33')][_0x9553('0x35')]?_0x7a8dea[_0x9553('0x33')]:_0x3f7307['model'];if(_0x30ae44[_0x9553('0x30')][_0x9553('0x3d')]){_0x7a8dea['include']=[{'all':!![]}];}_0x7a8dea=_[_0x9553('0x43')]({},_0x7a8dea,_0x30ae44['options']);return db[_0x9553('0x29')][_0x9553('0x44')](_0x7a8dea)[_0x9553('0x22')](handleEntityNotFound(_0x22b784,null))['then'](respondWithResult(_0x22b784,null))[_0x9553('0x40')](handleError(_0x22b784,null));};exports[_0x9553('0x45')]=function(_0x143fc7,_0x3ef7db){return db[_0x9553('0x29')][_0x9553('0x45')](_0x143fc7[_0x9553('0x46')],{})[_0x9553('0x22')](respondWithResult(_0x3ef7db,0xc9))[_0x9553('0x40')](handleError(_0x3ef7db,null));};exports[_0x9553('0x47')]=function(_0x3f9966,_0x56cba7){if(_0x3f9966[_0x9553('0x46')]['id']){delete _0x3f9966['body']['id'];}return db[_0x9553('0x29')]['find']({'where':{'id':_0x3f9966[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0x56cba7,null))[_0x9553('0x22')](saveUpdates(_0x3f9966[_0x9553('0x46')],null))[_0x9553('0x22')](respondWithResult(_0x56cba7,null))[_0x9553('0x40')](handleError(_0x56cba7,null));};exports['destroy']=function(_0x4c1d14,_0x26e1d6){return db['SugarcrmConfiguration'][_0x9553('0x44')]({'where':{'id':_0x4c1d14[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0x26e1d6,null))[_0x9553('0x22')](removeEntity(_0x26e1d6,null))[_0x9553('0x40')](handleError(_0x26e1d6,null));};exports[_0x9553('0x48')]=function(_0x2234de,_0x10929a,_0x11aa82){var _0x213521={};var _0x94d6af={};var _0x20859b;var _0x2dc925;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2234de[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0x10929a,null))[_0x9553('0x22')](function(_0x139312){if(_0x139312){_0x20859b=_0x139312;_0x94d6af[_0x9553('0x2d')]=_[_0x9553('0x2f')](db[_0x9553('0x49')]['rawAttributes']);_0x94d6af[_0x9553('0x30')]=_[_0x9553('0x2f')](_0x2234de[_0x9553('0x30')]);_0x94d6af['filters']=_[_0x9553('0x32')](_0x94d6af[_0x9553('0x2d')],_0x94d6af[_0x9553('0x30')]);_0x213521[_0x9553('0x33')]=_[_0x9553('0x32')](_0x94d6af[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x2234de[_0x9553('0x30')][_0x9553('0x34')]));_0x213521[_0x9553('0x33')]=_0x213521['attributes']['length']?_0x213521[_0x9553('0x33')]:_0x94d6af[_0x9553('0x2d')];_0x213521[_0x9553('0x37')]=qs['sort'](_0x2234de[_0x9553('0x30')][_0x9553('0x4a')]);_0x213521['where']=qs[_0x9553('0x31')](_['pick'](_0x2234de[_0x9553('0x30')],_0x94d6af[_0x9553('0x31')]));if(_0x2234de[_0x9553('0x30')][_0x9553('0x4b')]){_0x213521[_0x9553('0x38')]=_[_0x9553('0x43')](_0x213521[_0x9553('0x38')],{'$or':_[_0x9553('0x2e')](_0x213521['attributes'],function(_0x267c44){var _0x1679c8={};_0x1679c8[_0x267c44]={'$like':'%'+_0x2234de[_0x9553('0x30')]['filter']+'%'};return _0x1679c8;})});}_0x213521=_[_0x9553('0x43')]({},_0x213521,_0x2234de[_0x9553('0x3c')]);return _0x20859b['getFields'](_0x213521);}})[_0x9553('0x22')](function(_0x240139){if(_0x240139){_0x2dc925=_0x240139[_0x9553('0x35')];if(!_0x2234de[_0x9553('0x30')][_0x9553('0x4c')](_0x9553('0x36'))){_0x213521[_0x9553('0x1e')]=qs[_0x9553('0x1e')](_0x2234de[_0x9553('0x30')][_0x9553('0x1e')]);_0x213521[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x2234de['query'][_0x9553('0x1c')]);}return _0x20859b[_0x9553('0x48')](_0x213521);}})[_0x9553('0x22')](function(_0x5d8a54){if(_0x5d8a54){return _0x5d8a54?{'count':_0x2dc925,'rows':_0x5d8a54}:null;}})[_0x9553('0x22')](respondWithResult(_0x10929a,null))[_0x9553('0x40')](handleError(_0x10929a,null));};exports[_0x9553('0x4d')]=function(_0x3c12b5,_0x4075cf,_0x2445b1){var _0x54c078={};var _0x4182d9={};var _0x5018ae;var _0x11baa0;return db[_0x9553('0x29')][_0x9553('0x4e')]({'where':{'id':_0x3c12b5[_0x9553('0x42')]['id']}})['then'](handleEntityNotFound(_0x4075cf,null))[_0x9553('0x22')](function(_0xaff28c){if(_0xaff28c){_0x5018ae=_0xaff28c;_0x4182d9[_0x9553('0x2d')]=_['keys'](db[_0x9553('0x49')][_0x9553('0x2a')]);_0x4182d9[_0x9553('0x30')]=_[_0x9553('0x2f')](_0x3c12b5[_0x9553('0x30')]);_0x4182d9['filters']=_[_0x9553('0x32')](_0x4182d9[_0x9553('0x2d')],_0x4182d9[_0x9553('0x30')]);_0x54c078[_0x9553('0x33')]=_['intersection'](_0x4182d9[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x3c12b5[_0x9553('0x30')][_0x9553('0x34')]));_0x54c078[_0x9553('0x33')]=_0x54c078[_0x9553('0x33')][_0x9553('0x35')]?_0x54c078[_0x9553('0x33')]:_0x4182d9[_0x9553('0x2d')];_0x54c078[_0x9553('0x37')]=qs['sort'](_0x3c12b5['query'][_0x9553('0x4a')]);_0x54c078[_0x9553('0x38')]=qs[_0x9553('0x31')](_[_0x9553('0x39')](_0x3c12b5['query'],_0x4182d9[_0x9553('0x31')]));if(_0x3c12b5[_0x9553('0x30')]['filter']){_0x54c078[_0x9553('0x38')]=_['merge'](_0x54c078[_0x9553('0x38')],{'$or':_['map'](_0x54c078[_0x9553('0x33')],function(_0xc859cc){var _0x445f05={};_0x445f05[_0xc859cc]={'$like':'%'+_0x3c12b5[_0x9553('0x30')][_0x9553('0x4b')]+'%'};return _0x445f05;})});}_0x54c078=_[_0x9553('0x43')]({},_0x54c078,_0x3c12b5[_0x9553('0x3c')]);return _0x5018ae[_0x9553('0x4d')](_0x54c078);}})[_0x9553('0x22')](function(_0x437da1){if(_0x437da1){_0x11baa0=_0x437da1[_0x9553('0x35')];if(!_0x3c12b5[_0x9553('0x30')][_0x9553('0x4c')](_0x9553('0x36'))){_0x54c078[_0x9553('0x1e')]=qs['limit'](_0x3c12b5[_0x9553('0x30')][_0x9553('0x1e')]);_0x54c078[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x3c12b5[_0x9553('0x30')][_0x9553('0x1c')]);}return _0x5018ae['getSubjects'](_0x54c078);}})[_0x9553('0x22')](function(_0x16a773){if(_0x16a773){return _0x16a773?{'count':_0x11baa0,'rows':_0x16a773}:null;}})[_0x9553('0x22')](respondWithResult(_0x4075cf,null))[_0x9553('0x40')](handleError(_0x4075cf,null));};exports[_0x9553('0x4f')]=function(_0x53ac93,_0xd790ed,_0x39d6b1){var _0xd77812={};var _0x49a916={};var _0x166032;var _0x39eda5;return db[_0x9553('0x29')][_0x9553('0x4e')]({'where':{'id':_0x53ac93[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0xd790ed,null))[_0x9553('0x22')](function(_0x2e439d){if(_0x2e439d){_0x166032=_0x2e439d;_0x49a916[_0x9553('0x2d')]=_[_0x9553('0x2f')](db[_0x9553('0x49')][_0x9553('0x2a')]);_0x49a916[_0x9553('0x30')]=_[_0x9553('0x2f')](_0x53ac93[_0x9553('0x30')]);_0x49a916[_0x9553('0x31')]=_[_0x9553('0x32')](_0x49a916[_0x9553('0x2d')],_0x49a916[_0x9553('0x30')]);_0xd77812[_0x9553('0x33')]=_[_0x9553('0x32')](_0x49a916[_0x9553('0x2d')],qs['fields'](_0x53ac93['query'][_0x9553('0x34')]));_0xd77812[_0x9553('0x33')]=_0xd77812[_0x9553('0x33')]['length']?_0xd77812['attributes']:_0x49a916[_0x9553('0x2d')];_0xd77812[_0x9553('0x37')]=qs['sort'](_0x53ac93['query'][_0x9553('0x4a')]);_0xd77812[_0x9553('0x38')]=qs[_0x9553('0x31')](_['pick'](_0x53ac93[_0x9553('0x30')],_0x49a916[_0x9553('0x31')]));if(_0x53ac93[_0x9553('0x30')][_0x9553('0x4b')]){_0xd77812[_0x9553('0x38')]=_[_0x9553('0x43')](_0xd77812[_0x9553('0x38')],{'$or':_['map'](_0xd77812['attributes'],function(_0x57c149){var _0x3037af={};_0x3037af[_0x57c149]={'$like':'%'+_0x53ac93[_0x9553('0x30')]['filter']+'%'};return _0x3037af;})});}_0xd77812=_[_0x9553('0x43')]({},_0xd77812,_0x53ac93['options']);return _0x166032[_0x9553('0x4f')](_0xd77812);}})[_0x9553('0x22')](function(_0x3cf7b9){if(_0x3cf7b9){_0x39eda5=_0x3cf7b9['length'];if(!_0x53ac93['query'][_0x9553('0x4c')](_0x9553('0x36'))){_0xd77812[_0x9553('0x1e')]=qs[_0x9553('0x1e')](_0x53ac93[_0x9553('0x30')]['limit']);_0xd77812[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x53ac93['query'][_0x9553('0x1c')]);}return _0x166032[_0x9553('0x4f')](_0xd77812);}})['then'](function(_0x39a9ad){if(_0x39a9ad){return _0x39a9ad?{'count':_0x39eda5,'rows':_0x39a9ad}:null;}})['then'](respondWithResult(_0xd790ed,null))[_0x9553('0x40')](handleError(_0xd790ed,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e2aae33..2f3b889 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 _0x2aba=['path','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x55ed73,_0x5eff7c){var _0x44bc2e=function(_0x243398){while(--_0x243398){_0x55ed73['push'](_0x55ed73['shift']());}};_0x44bc2e(++_0x5eff7c);}(_0x2aba,0x1c9));var _0xa2ab=function(_0x5166ef,_0x4725cd){_0x5166ef=_0x5166ef-0x0;var _0x45992a=_0x2aba[_0x5166ef];return _0x45992a;};'use strict';var _=require(_0xa2ab('0x0'));var util=require('util');var logger=require(_0xa2ab('0x1'))('api');var moment=require(_0xa2ab('0x2'));var BPromise=require(_0xa2ab('0x3'));var rp=require(_0xa2ab('0x4'));var fs=require('fs');var path=require(_0xa2ab('0x5'));var rimraf=require('rimraf');var config=require(_0xa2ab('0x6'));var attributes=require(_0xa2ab('0x7'));module['exports']=function(_0x1c9b62,_0x382b66){return _0x1c9b62[_0xa2ab('0x8')](_0xa2ab('0x9'),attributes,{'tableName':_0xa2ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d6f=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger'];(function(_0xa584ad,_0x487170){var _0x2ad711=function(_0x26ced0){while(--_0x26ced0){_0xa584ad['push'](_0xa584ad['shift']());}};_0x2ad711(++_0x487170);}(_0x5d6f,0x1b9));var _0xf5d6=function(_0x3c54d3,_0x9719e3){_0x3c54d3=_0x3c54d3-0x0;var _0xd67c8f=_0x5d6f[_0x3c54d3];return _0xd67c8f;};'use strict';var _=require(_0xf5d6('0x0'));var util=require(_0xf5d6('0x1'));var logger=require(_0xf5d6('0x2'))(_0xf5d6('0x3'));var moment=require(_0xf5d6('0x4'));var BPromise=require('bluebird');var rp=require(_0xf5d6('0x5'));var fs=require('fs');var path=require(_0xf5d6('0x6'));var rimraf=require(_0xf5d6('0x7'));var config=require(_0xf5d6('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xf5d6('0x9')]=function(_0x549655,_0x3b61b1){return _0x549655[_0xf5d6('0xa')](_0xf5d6('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 072c03e..df96c82 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 _0xd87d=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http'];(function(_0x20d8f9,_0x4bc82f){var _0x27b0f8=function(_0x3454c5){while(--_0x3454c5){_0x20d8f9['push'](_0x20d8f9['shift']());}};_0x27b0f8(++_0x4bc82f);}(_0xd87d,0x171));var _0xdd87=function(_0x132695,_0x2aae70){_0x132695=_0x132695-0x0;var _0x8a8e8b=_0xd87d[_0x132695];return _0x8a8e8b;};'use strict';var _=require(_0xdd87('0x0'));var util=require(_0xdd87('0x1'));var moment=require(_0xdd87('0x2'));var BPromise=require(_0xdd87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd87('0x4'));var db=require(_0xdd87('0x5'))['db'];var utils=require(_0xdd87('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdd87('0x7'));var client=jayson['client'][_0xdd87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2389b6,_0x1a1838,_0x216c84){return new BPromise(function(_0x4f1eda,_0x3a9fbe){return client[_0xdd87('0x9')](_0x2389b6,_0x216c84)[_0xdd87('0xa')](function(_0x4833bb){logger[_0xdd87('0xb')](_0xdd87('0xc'),_0x1a1838,_0xdd87('0xd'));logger[_0xdd87('0xe')](_0xdd87('0xf'),_0x1a1838,'request\x20sent',JSON[_0xdd87('0x10')](_0x4833bb));if(_0x4833bb[_0xdd87('0x11')]){if(_0x4833bb['error'][_0xdd87('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1a1838,_0x4833bb[_0xdd87('0x11')][_0xdd87('0x13')]);return _0x3a9fbe(_0x4833bb[_0xdd87('0x11')][_0xdd87('0x13')]);}logger[_0xdd87('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1a1838,_0x4833bb[_0xdd87('0x11')][_0xdd87('0x13')]);return _0x4f1eda(_0x4833bb[_0xdd87('0x11')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1a1838,'request\x20sent');_0x4f1eda(_0x4833bb[_0xdd87('0x14')][_0xdd87('0x13')]);}})['catch'](function(_0x3fc234){logger[_0xdd87('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1a1838,_0x3fc234);_0x3a9fbe(_0x3fc234);});});} \ No newline at end of file +var _0x19ca=['../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf182,_0x22fffd){var _0x5f4c30=function(_0x593753){while(--_0x593753){_0xf182['push'](_0xf182['shift']());}};_0x5f4c30(++_0x22fffd);}(_0x19ca,0xdd));var _0xa19c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x19ca[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xa19c('0x0'));var util=require(_0xa19c('0x1'));var moment=require(_0xa19c('0x2'));var BPromise=require(_0xa19c('0x3'));var rs=require(_0xa19c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa19c('0x5'))['db'];var utils=require(_0xa19c('0x6'));var logger=require(_0xa19c('0x7'))(_0xa19c('0x8'));var config=require(_0xa19c('0x9'));var jayson=require(_0xa19c('0xa'));var client=jayson['client'][_0xa19c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x349fa,_0x58b690,_0x33ea3d){return new BPromise(function(_0x2ed74f,_0xda77b7){return client[_0xa19c('0xc')](_0x349fa,_0x33ea3d)[_0xa19c('0xd')](function(_0x5b2bde){logger['info'](_0xa19c('0xe'),_0x58b690,_0xa19c('0xf'));logger[_0xa19c('0x10')](_0xa19c('0x11'),_0x58b690,'request\x20sent',JSON[_0xa19c('0x12')](_0x5b2bde));if(_0x5b2bde[_0xa19c('0x13')]){if(_0x5b2bde[_0xa19c('0x13')][_0xa19c('0x14')]===0x1f4){logger['error'](_0xa19c('0xe'),_0x58b690,_0x5b2bde[_0xa19c('0x13')][_0xa19c('0x15')]);return _0xda77b7(_0x5b2bde['error'][_0xa19c('0x15')]);}logger[_0xa19c('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58b690,_0x5b2bde['error'][_0xa19c('0x15')]);return _0x2ed74f(_0x5b2bde[_0xa19c('0x13')][_0xa19c('0x15')]);}else{logger[_0xa19c('0x16')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58b690,_0xa19c('0xf'));_0x2ed74f(_0x5b2bde['result'][_0xa19c('0x15')]);}})['catch'](function(_0x2641e0){logger[_0xa19c('0x13')](_0xa19c('0xe'),_0x58b690,_0x2641e0);_0xda77b7(_0x2641e0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 085a398..1d5fc8b 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 _0x51e3=['path','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x51e3,0x8f));var _0x351e=function(_0x4a1f11,_0x37f97c){_0x4a1f11=_0x4a1f11-0x0;var _0x47dca0=_0x51e3[_0x4a1f11];return _0x47dca0;};'use strict';var multer=require('multer');var util=require(_0x351e('0x0'));var path=require(_0x351e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x351e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x351e('0x3'));var config=require(_0x351e('0x4'));var controller=require(_0x351e('0x5'));router[_0x351e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x351e('0x7')](),controller[_0x351e('0x8')]);router[_0x351e('0x9')]('/',auth[_0x351e('0x7')](),controller[_0x351e('0xa')]);router[_0x351e('0xb')](_0x351e('0xc'),auth[_0x351e('0x7')](),controller[_0x351e('0xd')]);router[_0x351e('0xe')]('/:id',auth[_0x351e('0x7')](),controller[_0x351e('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb68e=['/:id','show','post','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x33dde6,_0x2c422a){var _0x5610d0=function(_0x315cee){while(--_0x315cee){_0x33dde6['push'](_0x33dde6['shift']());}};_0x5610d0(++_0x2c422a);}(_0xb68e,0x19b));var _0xeb68=function(_0x5ec09f,_0x1596c5){_0x5ec09f=_0x5ec09f-0x0;var _0x30d587=_0xb68e[_0x5ec09f];return _0x30d587;};'use strict';var multer=require(_0xeb68('0x0'));var util=require(_0xeb68('0x1'));var path=require('path');var timeout=require(_0xeb68('0x2'));var express=require('express');var router=express[_0xeb68('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeb68('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb68('0x5'));router[_0xeb68('0x6')]('/',auth[_0xeb68('0x7')](),controller[_0xeb68('0x8')]);router[_0xeb68('0x6')](_0xeb68('0x9'),auth[_0xeb68('0x7')](),controller[_0xeb68('0xa')]);router[_0xeb68('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xeb68('0x9'),auth[_0xeb68('0x7')](),controller[_0xeb68('0xc')]);router['delete'](_0xeb68('0x9'),auth[_0xeb68('0x7')](),controller['destroy']);module[_0xeb68('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ea87c9d..344c67d 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 _0x0f4a=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x1664f3,_0x2cd94f){var _0xda7015=function(_0x27c26e){while(--_0x27c26e){_0x1664f3['push'](_0x1664f3['shift']());}};_0xda7015(++_0x2cd94f);}(_0x0f4a,0x6f));var _0xa0f4=function(_0xe90b6f,_0x3fef7d){_0xe90b6f=_0xe90b6f-0x0;var _0x37c506=_0x0f4a[_0xe90b6f];return _0x37c506;};'use strict';var Sequelize=require(_0xa0f4('0x0'));module[_0xa0f4('0x1')]={'type':{'type':Sequelize[_0xa0f4('0x2')](_0xa0f4('0x3'),_0xa0f4('0x4'),'customVariable',_0xa0f4('0x5'),_0xa0f4('0x6')),'defaultValue':_0xa0f4('0x3')},'content':{'type':Sequelize[_0xa0f4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa0f4('0x2')](_0xa0f4('0x3'),_0xa0f4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xa0f4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa0f4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa0f4('0x7')]}}; \ No newline at end of file +var _0x3e70=['BOOLEAN','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x44f664,_0x4b2097){var _0x59d329=function(_0x251b89){while(--_0x251b89){_0x44f664['push'](_0x44f664['shift']());}};_0x59d329(++_0x4b2097);}(_0x3e70,0x71));var _0x03e7=function(_0x892f47,_0x1bb4be){_0x892f47=_0x892f47-0x0;var _0x17e7e8=_0x3e70[_0x892f47];return _0x17e7e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x03e7('0x0'),_0x03e7('0x1'),_0x03e7('0x2'),_0x03e7('0x3'),_0x03e7('0x4')),'defaultValue':_0x03e7('0x0')},'content':{'type':Sequelize[_0x03e7('0x5')]},'key':{'type':Sequelize[_0x03e7('0x5')]},'keyType':{'type':Sequelize[_0x03e7('0x6')](_0x03e7('0x0'),_0x03e7('0x1'),_0x03e7('0x2'))},'keyContent':{'type':Sequelize[_0x03e7('0x5')]},'idField':{'type':Sequelize[_0x03e7('0x5')]},'nameField':{'type':Sequelize[_0x03e7('0x5')]},'customField':{'type':Sequelize[_0x03e7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03e7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b112144..323d713 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 _0x5a4f=['where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','SugarcrmField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort'];(function(_0x593cbd,_0x141c5b){var _0x1ea4aa=function(_0x5d42ba){while(--_0x5d42ba){_0x593cbd['push'](_0x593cbd['shift']());}};_0x1ea4aa(++_0x141c5b);}(_0x5a4f,0x96));var _0xf5a4=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x5a4f[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0xf5a4('0x0'));var rimraf=require(_0xf5a4('0x1'));var zipdir=require(_0xf5a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5a4('0x3'));var moment=require('moment');var BPromise=require(_0xf5a4('0x4'));var Mustache=require(_0xf5a4('0x5'));var util=require(_0xf5a4('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5a4('0x7'));var fs=require('fs');var fs_extra=require(_0xf5a4('0x8'));var _=require(_0xf5a4('0x9'));var squel=require(_0xf5a4('0xa'));var crypto=require(_0xf5a4('0xb'));var jsforce=require(_0xf5a4('0xc'));var deskjs=require(_0xf5a4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf5a4('0xe'));var Redis=require('ioredis');var authService=require(_0xf5a4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf5a4('0x10'));var hardwareService=require(_0xf5a4('0x11'));var logger=require(_0xf5a4('0x12'))('api');var utils=require(_0xf5a4('0x13'));var config=require(_0xf5a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41aaad,_0x43caf4){_0x43caf4=_0x43caf4||0xcc;return function(_0x3f57ff){if(_0x3f57ff){return _0x41aaad[_0xf5a4('0x15')](_0x43caf4);}return _0x41aaad[_0xf5a4('0x16')](_0x43caf4)['end']();};}function respondWithResult(_0x53e0ac,_0x2b9fbd){_0x2b9fbd=_0x2b9fbd||0xc8;return function(_0x246e15){if(_0x246e15){return _0x53e0ac['status'](_0x2b9fbd)['json'](_0x246e15);}};}function respondWithFilteredResult(_0x4a0fcc,_0x3b31a4){return function(_0x40738c){if(_0x40738c){var _0x3ab438=typeof _0x3b31a4[_0xf5a4('0x17')]===_0xf5a4('0x18')&&typeof _0x3b31a4[_0xf5a4('0x19')]===_0xf5a4('0x18');var _0x421b8e=_0x40738c[_0xf5a4('0x1a')];var _0x118d93=_0x3ab438?0x0:_0x3b31a4['offset'];var _0x5e445a=_0x3ab438?_0x40738c[_0xf5a4('0x1a')]:_0x3b31a4[_0xf5a4('0x17')]+_0x3b31a4[_0xf5a4('0x19')];var _0x21c63f;if(_0x5e445a>=_0x421b8e){_0x5e445a=_0x421b8e;_0x21c63f=0xc8;}else{_0x21c63f=0xce;}_0x4a0fcc[_0xf5a4('0x16')](_0x21c63f);return _0x4a0fcc['set'](_0xf5a4('0x1b'),_0x118d93+'-'+_0x5e445a+'/'+_0x421b8e)[_0xf5a4('0x1c')](_0x40738c);}return null;};}function patchUpdates(_0x45cd80){return function(_0x576ba9){try{jsonpatch[_0xf5a4('0x1d')](_0x576ba9,_0x45cd80,!![]);}catch(_0x308969){return BPromise[_0xf5a4('0x1e')](_0x308969);}return _0x576ba9['save']();};}function saveUpdates(_0x21cc2e,_0x3638ea){return function(_0x5f3867){if(_0x5f3867){return _0x5f3867[_0xf5a4('0x1f')](_0x21cc2e)['then'](function(_0x3e0e13){return _0x3e0e13;});}return null;};}function removeEntity(_0x242e17,_0x27a884){return function(_0x575e8c){if(_0x575e8c){return _0x575e8c[_0xf5a4('0x20')]()[_0xf5a4('0x21')](function(){_0x242e17[_0xf5a4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e00a,_0x49a3e8){return function(_0xc758db){if(!_0xc758db){_0x49e00a['sendStatus'](0x194);}return _0xc758db;};}function handleError(_0x354906,_0x308d71){_0x308d71=_0x308d71||0x1f4;return function(_0x280542){logger[_0xf5a4('0x22')](_0x280542[_0xf5a4('0x23')]);if(_0x280542[_0xf5a4('0x24')]){delete _0x280542[_0xf5a4('0x24')];}_0x354906[_0xf5a4('0x16')](_0x308d71)[_0xf5a4('0x25')](_0x280542);};}exports[_0xf5a4('0x26')]=function(_0x34e0f3,_0xc10360){var _0x2e44d0={},_0x4a7a9c={},_0x14ff27={'count':0x0,'rows':[]};var _0x4688fb=_['map'](db[_0xf5a4('0x27')][_0xf5a4('0x28')],function(_0x18da45){return{'name':_0x18da45['fieldName'],'type':_0x18da45[_0xf5a4('0x29')][_0xf5a4('0x2a')]};});_0x4a7a9c[_0xf5a4('0x2b')]=_[_0xf5a4('0x2c')](_0x4688fb,_0xf5a4('0x24'));_0x4a7a9c[_0xf5a4('0x2d')]=_[_0xf5a4('0x2e')](_0x34e0f3[_0xf5a4('0x2d')]);_0x4a7a9c[_0xf5a4('0x2f')]=_[_0xf5a4('0x30')](_0x4a7a9c['model'],_0x4a7a9c['query']);_0x2e44d0[_0xf5a4('0x31')]=_['intersection'](_0x4a7a9c[_0xf5a4('0x2b')],qs['fields'](_0x34e0f3['query'][_0xf5a4('0x32')]));_0x2e44d0[_0xf5a4('0x31')]=_0x2e44d0[_0xf5a4('0x31')][_0xf5a4('0x33')]?_0x2e44d0[_0xf5a4('0x31')]:_0x4a7a9c['model'];if(!_0x34e0f3[_0xf5a4('0x2d')]['hasOwnProperty']('nolimit')){_0x2e44d0[_0xf5a4('0x19')]=qs['limit'](_0x34e0f3[_0xf5a4('0x2d')][_0xf5a4('0x19')]);_0x2e44d0[_0xf5a4('0x17')]=qs[_0xf5a4('0x17')](_0x34e0f3[_0xf5a4('0x2d')][_0xf5a4('0x17')]);}_0x2e44d0[_0xf5a4('0x34')]=qs[_0xf5a4('0x35')](_0x34e0f3[_0xf5a4('0x2d')][_0xf5a4('0x35')]);_0x2e44d0[_0xf5a4('0x36')]=qs[_0xf5a4('0x2f')](_[_0xf5a4('0x37')](_0x34e0f3['query'],_0x4a7a9c[_0xf5a4('0x2f')]),_0x4688fb);if(_0x34e0f3[_0xf5a4('0x2d')][_0xf5a4('0x38')]){_0x2e44d0[_0xf5a4('0x36')]=_[_0xf5a4('0x39')](_0x2e44d0[_0xf5a4('0x36')],{'$or':_[_0xf5a4('0x2c')](_0x4688fb,function(_0x493cbb){if(_0x493cbb[_0xf5a4('0x29')]!=='VIRTUAL'){var _0x5cc3b0={};_0x5cc3b0[_0x493cbb[_0xf5a4('0x24')]]={'$like':'%'+_0x34e0f3[_0xf5a4('0x2d')][_0xf5a4('0x38')]+'%'};return _0x5cc3b0;}})});}_0x2e44d0=_[_0xf5a4('0x39')]({},_0x2e44d0,_0x34e0f3[_0xf5a4('0x3a')]);var _0x268f10={'where':_0x2e44d0[_0xf5a4('0x36')]};return db['SugarcrmField']['count'](_0x268f10)[_0xf5a4('0x21')](function(_0x78002d){_0x14ff27[_0xf5a4('0x1a')]=_0x78002d;if(_0x34e0f3[_0xf5a4('0x2d')][_0xf5a4('0x3b')]){_0x2e44d0[_0xf5a4('0x3c')]=[{'all':!![]}];}return db[_0xf5a4('0x27')]['findAll'](_0x2e44d0);})[_0xf5a4('0x21')](function(_0x324118){_0x14ff27[_0xf5a4('0x3d')]=_0x324118;return _0x14ff27;})[_0xf5a4('0x21')](respondWithFilteredResult(_0xc10360,_0x2e44d0))[_0xf5a4('0x3e')](handleError(_0xc10360,null));};exports[_0xf5a4('0x3f')]=function(_0x221456,_0x181a0d){var _0x393c80={'raw':!![],'where':{'id':_0x221456[_0xf5a4('0x40')]['id']}},_0x5c2f01={};_0x5c2f01[_0xf5a4('0x2b')]=_[_0xf5a4('0x2e')](db[_0xf5a4('0x27')][_0xf5a4('0x28')]);_0x5c2f01[_0xf5a4('0x2d')]=_[_0xf5a4('0x2e')](_0x221456['query']);_0x5c2f01[_0xf5a4('0x2f')]=_[_0xf5a4('0x30')](_0x5c2f01[_0xf5a4('0x2b')],_0x5c2f01[_0xf5a4('0x2d')]);_0x393c80[_0xf5a4('0x31')]=_[_0xf5a4('0x30')](_0x5c2f01[_0xf5a4('0x2b')],qs[_0xf5a4('0x32')](_0x221456[_0xf5a4('0x2d')]['fields']));_0x393c80[_0xf5a4('0x31')]=_0x393c80[_0xf5a4('0x31')]['length']?_0x393c80[_0xf5a4('0x31')]:_0x5c2f01[_0xf5a4('0x2b')];if(_0x221456[_0xf5a4('0x2d')]['includeAll']){_0x393c80[_0xf5a4('0x3c')]=[{'all':!![]}];}_0x393c80=_[_0xf5a4('0x39')]({},_0x393c80,_0x221456[_0xf5a4('0x3a')]);return db[_0xf5a4('0x27')][_0xf5a4('0x41')](_0x393c80)[_0xf5a4('0x21')](handleEntityNotFound(_0x181a0d,null))[_0xf5a4('0x21')](respondWithResult(_0x181a0d,null))[_0xf5a4('0x3e')](handleError(_0x181a0d,null));};exports[_0xf5a4('0x42')]=function(_0x19cfbe,_0x2ccd8){return db['SugarcrmField'][_0xf5a4('0x42')](_0x19cfbe[_0xf5a4('0x43')],{})[_0xf5a4('0x21')](respondWithResult(_0x2ccd8,0xc9))[_0xf5a4('0x3e')](handleError(_0x2ccd8,null));};exports[_0xf5a4('0x1f')]=function(_0x299abc,_0x4ae903){if(_0x299abc['body']['id']){delete _0x299abc['body']['id'];}return db['SugarcrmField'][_0xf5a4('0x41')]({'where':{'id':_0x299abc[_0xf5a4('0x40')]['id']}})[_0xf5a4('0x21')](handleEntityNotFound(_0x4ae903,null))[_0xf5a4('0x21')](saveUpdates(_0x299abc[_0xf5a4('0x43')],null))[_0xf5a4('0x21')](respondWithResult(_0x4ae903,null))[_0xf5a4('0x3e')](handleError(_0x4ae903,null));};exports['destroy']=function(_0x34e905,_0x3925ec){return db[_0xf5a4('0x27')]['find']({'where':{'id':_0x34e905[_0xf5a4('0x40')]['id']}})[_0xf5a4('0x21')](handleEntityNotFound(_0x3925ec,null))[_0xf5a4('0x21')](removeEntity(_0x3925ec,null))['catch'](handleError(_0x3925ec,null));}; \ No newline at end of file +var _0xe16a=['limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','set','apply','save','update','then','destroy','end','sendStatus','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x301075,_0x33b785){var _0x1a04c5=function(_0x8d5143){while(--_0x8d5143){_0x301075['push'](_0x301075['shift']());}};_0x1a04c5(++_0x33b785);}(_0xe16a,0xae));var _0xae16=function(_0x2354c3,_0x59de7c){_0x2354c3=_0x2354c3-0x0;var _0x27db54=_0xe16a[_0x2354c3];return _0x27db54;};'use strict';var emlformat=require(_0xae16('0x0'));var rimraf=require(_0xae16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae16('0x2'));var moment=require(_0xae16('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae16('0x4'));var util=require(_0xae16('0x5'));var path=require(_0xae16('0x6'));var sox=require(_0xae16('0x7'));var csv=require(_0xae16('0x8'));var ejs=require(_0xae16('0x9'));var fs=require('fs');var fs_extra=require(_0xae16('0xa'));var _=require(_0xae16('0xb'));var squel=require(_0xae16('0xc'));var crypto=require(_0xae16('0xd'));var jsforce=require(_0xae16('0xe'));var deskjs=require(_0xae16('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae16('0x10'));var Papa=require(_0xae16('0x11'));var Redis=require('ioredis');var authService=require(_0xae16('0x12'));var qs=require(_0xae16('0x13'));var as=require(_0xae16('0x14'));var hardwareService=require(_0xae16('0x15'));var logger=require(_0xae16('0x16'))(_0xae16('0x17'));var utils=require(_0xae16('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xae16('0x19'));var db=require(_0xae16('0x1a'))['db'];function respondWithStatusCode(_0x5e41e0,_0x1cc7c0){_0x1cc7c0=_0x1cc7c0||0xcc;return function(_0x254da8){if(_0x254da8){return _0x5e41e0['sendStatus'](_0x1cc7c0);}return _0x5e41e0[_0xae16('0x1b')](_0x1cc7c0)['end']();};}function respondWithResult(_0x584e4b,_0x579b2c){_0x579b2c=_0x579b2c||0xc8;return function(_0x59edb3){if(_0x59edb3){return _0x584e4b[_0xae16('0x1b')](_0x579b2c)[_0xae16('0x1c')](_0x59edb3);}};}function respondWithFilteredResult(_0x281a72,_0x47d1d9){return function(_0x273d48){if(_0x273d48){var _0x543187=typeof _0x47d1d9[_0xae16('0x1d')]===_0xae16('0x1e')&&typeof _0x47d1d9['limit']===_0xae16('0x1e');var _0x2ffa77=_0x273d48['count'];var _0x50bebc=_0x543187?0x0:_0x47d1d9['offset'];var _0x865220=_0x543187?_0x273d48['count']:_0x47d1d9['offset']+_0x47d1d9['limit'];var _0x814fb9;if(_0x865220>=_0x2ffa77){_0x865220=_0x2ffa77;_0x814fb9=0xc8;}else{_0x814fb9=0xce;}_0x281a72[_0xae16('0x1b')](_0x814fb9);return _0x281a72[_0xae16('0x1f')]('Content-Range',_0x50bebc+'-'+_0x865220+'/'+_0x2ffa77)['json'](_0x273d48);}return null;};}function patchUpdates(_0x4e4c96){return function(_0x3ae604){try{jsonpatch[_0xae16('0x20')](_0x3ae604,_0x4e4c96,!![]);}catch(_0x329504){return BPromise['reject'](_0x329504);}return _0x3ae604[_0xae16('0x21')]();};}function saveUpdates(_0x1811b6,_0x8ec48f){return function(_0x12c349){if(_0x12c349){return _0x12c349[_0xae16('0x22')](_0x1811b6)[_0xae16('0x23')](function(_0x18407b){return _0x18407b;});}return null;};}function removeEntity(_0xc15f75,_0x1cc5dc){return function(_0x12e71a){if(_0x12e71a){return _0x12e71a[_0xae16('0x24')]()['then'](function(){_0xc15f75[_0xae16('0x1b')](0xcc)[_0xae16('0x25')]();});}};}function handleEntityNotFound(_0xf3a3ed,_0x487b69){return function(_0x29b75e){if(!_0x29b75e){_0xf3a3ed[_0xae16('0x26')](0x194);}return _0x29b75e;};}function handleError(_0x3973e1,_0x4da52e){_0x4da52e=_0x4da52e||0x1f4;return function(_0x381995){logger[_0xae16('0x27')](_0x381995['stack']);if(_0x381995[_0xae16('0x28')]){delete _0x381995[_0xae16('0x28')];}_0x3973e1[_0xae16('0x1b')](_0x4da52e)[_0xae16('0x29')](_0x381995);};}exports['index']=function(_0x57a37e,_0x556b79){var _0x4ee6b0={},_0x33b479={},_0x384ccd={'count':0x0,'rows':[]};var _0x53cb9e=_[_0xae16('0x2a')](db[_0xae16('0x2b')][_0xae16('0x2c')],function(_0x2ca97a){return{'name':_0x2ca97a[_0xae16('0x2d')],'type':_0x2ca97a[_0xae16('0x2e')][_0xae16('0x2f')]};});_0x33b479[_0xae16('0x30')]=_[_0xae16('0x2a')](_0x53cb9e,'name');_0x33b479[_0xae16('0x31')]=_['keys'](_0x57a37e[_0xae16('0x31')]);_0x33b479[_0xae16('0x32')]=_[_0xae16('0x33')](_0x33b479['model'],_0x33b479[_0xae16('0x31')]);_0x4ee6b0[_0xae16('0x34')]=_[_0xae16('0x33')](_0x33b479[_0xae16('0x30')],qs[_0xae16('0x35')](_0x57a37e['query'][_0xae16('0x35')]));_0x4ee6b0[_0xae16('0x34')]=_0x4ee6b0[_0xae16('0x34')][_0xae16('0x36')]?_0x4ee6b0[_0xae16('0x34')]:_0x33b479[_0xae16('0x30')];if(!_0x57a37e[_0xae16('0x31')][_0xae16('0x37')](_0xae16('0x38'))){_0x4ee6b0[_0xae16('0x39')]=qs['limit'](_0x57a37e['query'][_0xae16('0x39')]);_0x4ee6b0[_0xae16('0x1d')]=qs[_0xae16('0x1d')](_0x57a37e[_0xae16('0x31')]['offset']);}_0x4ee6b0[_0xae16('0x3a')]=qs[_0xae16('0x3b')](_0x57a37e[_0xae16('0x31')][_0xae16('0x3b')]);_0x4ee6b0[_0xae16('0x3c')]=qs[_0xae16('0x32')](_[_0xae16('0x3d')](_0x57a37e[_0xae16('0x31')],_0x33b479[_0xae16('0x32')]),_0x53cb9e);if(_0x57a37e[_0xae16('0x31')][_0xae16('0x3e')]){_0x4ee6b0['where']=_[_0xae16('0x3f')](_0x4ee6b0[_0xae16('0x3c')],{'$or':_['map'](_0x53cb9e,function(_0x1d005c){if(_0x1d005c[_0xae16('0x2e')]!==_0xae16('0x40')){var _0x48c86b={};_0x48c86b[_0x1d005c[_0xae16('0x28')]]={'$like':'%'+_0x57a37e[_0xae16('0x31')][_0xae16('0x3e')]+'%'};return _0x48c86b;}})});}_0x4ee6b0=_['merge']({},_0x4ee6b0,_0x57a37e['options']);var _0x1ef7f5={'where':_0x4ee6b0[_0xae16('0x3c')]};return db['SugarcrmField']['count'](_0x1ef7f5)['then'](function(_0xfd14e9){_0x384ccd[_0xae16('0x41')]=_0xfd14e9;if(_0x57a37e[_0xae16('0x31')][_0xae16('0x42')]){_0x4ee6b0[_0xae16('0x43')]=[{'all':!![]}];}return db[_0xae16('0x2b')][_0xae16('0x44')](_0x4ee6b0);})['then'](function(_0x4697df){_0x384ccd[_0xae16('0x45')]=_0x4697df;return _0x384ccd;})[_0xae16('0x23')](respondWithFilteredResult(_0x556b79,_0x4ee6b0))[_0xae16('0x46')](handleError(_0x556b79,null));};exports[_0xae16('0x47')]=function(_0x2a7471,_0x41a4be){var _0x1646ab={'raw':!![],'where':{'id':_0x2a7471['params']['id']}},_0x5703a5={};_0x5703a5['model']=_['keys'](db['SugarcrmField'][_0xae16('0x2c')]);_0x5703a5[_0xae16('0x31')]=_['keys'](_0x2a7471[_0xae16('0x31')]);_0x5703a5[_0xae16('0x32')]=_['intersection'](_0x5703a5['model'],_0x5703a5[_0xae16('0x31')]);_0x1646ab[_0xae16('0x34')]=_['intersection'](_0x5703a5[_0xae16('0x30')],qs[_0xae16('0x35')](_0x2a7471['query'][_0xae16('0x35')]));_0x1646ab[_0xae16('0x34')]=_0x1646ab[_0xae16('0x34')][_0xae16('0x36')]?_0x1646ab[_0xae16('0x34')]:_0x5703a5[_0xae16('0x30')];if(_0x2a7471[_0xae16('0x31')][_0xae16('0x42')]){_0x1646ab[_0xae16('0x43')]=[{'all':!![]}];}_0x1646ab=_[_0xae16('0x3f')]({},_0x1646ab,_0x2a7471[_0xae16('0x48')]);return db[_0xae16('0x2b')][_0xae16('0x49')](_0x1646ab)['then'](handleEntityNotFound(_0x41a4be,null))[_0xae16('0x23')](respondWithResult(_0x41a4be,null))[_0xae16('0x46')](handleError(_0x41a4be,null));};exports[_0xae16('0x4a')]=function(_0x2c6617,_0x45078a){return db['SugarcrmField'][_0xae16('0x4a')](_0x2c6617[_0xae16('0x4b')],{})[_0xae16('0x23')](respondWithResult(_0x45078a,0xc9))[_0xae16('0x46')](handleError(_0x45078a,null));};exports[_0xae16('0x22')]=function(_0x3eb8ed,_0x4b196c){if(_0x3eb8ed['body']['id']){delete _0x3eb8ed[_0xae16('0x4b')]['id'];}return db['SugarcrmField'][_0xae16('0x49')]({'where':{'id':_0x3eb8ed['params']['id']}})['then'](handleEntityNotFound(_0x4b196c,null))[_0xae16('0x23')](saveUpdates(_0x3eb8ed[_0xae16('0x4b')],null))[_0xae16('0x23')](respondWithResult(_0x4b196c,null))[_0xae16('0x46')](handleError(_0x4b196c,null));};exports[_0xae16('0x24')]=function(_0x2cc122,_0x23e4e9){return db[_0xae16('0x2b')][_0xae16('0x49')]({'where':{'id':_0x2cc122[_0xae16('0x4c')]['id']}})[_0xae16('0x23')](handleEntityNotFound(_0x23e4e9,null))[_0xae16('0x23')](removeEntity(_0x23e4e9,null))[_0xae16('0x46')](handleError(_0x23e4e9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 44c86a0..1bb9efb 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 _0xa173=['rimraf','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x684f8d,_0x35f431){var _0x1487d4=function(_0x342f8f){while(--_0x342f8f){_0x684f8d['push'](_0x684f8d['shift']());}};_0x1487d4(++_0x35f431);}(_0xa173,0xf1));var _0x3a17=function(_0x51150f,_0x37b3fe){_0x51150f=_0x51150f-0x0;var _0x54e39f=_0xa173[_0x51150f];return _0x54e39f;};'use strict';var _=require(_0x3a17('0x0'));var util=require('util');var logger=require(_0x3a17('0x1'))(_0x3a17('0x2'));var moment=require(_0x3a17('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a17('0x4'));var fs=require('fs');var path=require(_0x3a17('0x5'));var rimraf=require(_0x3a17('0x6'));var config=require('../../config/environment');var attributes=require(_0x3a17('0x7'));module[_0x3a17('0x8')]=function(_0x569fa8,_0x49338e){return _0x569fa8['define']('SugarcrmField',attributes,{'tableName':_0x3a17('0x9'),'paranoid':![],'indexes':[{'name':_0x3a17('0xa'),'fields':[_0x3a17('0xb'),_0x3a17('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6a=['lodash','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x3cb147,_0x5186aa){var _0xa21484=function(_0x53c4a7){while(--_0x53c4a7){_0x3cb147['push'](_0x3cb147['shift']());}};_0xa21484(++_0x5186aa);}(_0x3a6a,0x132));var _0xa3a6=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x3a6a[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xa3a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa3a6('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3a6('0x2'));var config=require(_0xa3a6('0x3'));var attributes=require(_0xa3a6('0x4'));module[_0xa3a6('0x5')]=function(_0x4d1979,_0x17b1e){return _0x4d1979[_0xa3a6('0x6')]('SugarcrmField',attributes,{'tableName':_0xa3a6('0x7'),'paranoid':![],'indexes':[{'name':_0xa3a6('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 83d78c5..6882c1d 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 _0xd47e=['rpc','jayson/promise','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd47e,0x67));var _0xed47=function(_0x3ff4bc,_0x1aebe2){_0x3ff4bc=_0x3ff4bc-0x0;var _0x3297fa=_0xd47e[_0x3ff4bc];return _0x3297fa;};'use strict';var _=require(_0xed47('0x0'));var util=require(_0xed47('0x1'));var moment=require(_0xed47('0x2'));var BPromise=require('bluebird');var rs=require(_0xed47('0x3'));var fs=require('fs');var Redis=require(_0xed47('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed47('0x5'));var logger=require(_0xed47('0x6'))(_0xed47('0x7'));var config=require('../../config/environment');var jayson=require(_0xed47('0x8'));var client=jayson['client'][_0xed47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x490f65,_0x507f12,_0x58aeb9){return new BPromise(function(_0x10df06,_0x18f67a){return client[_0xed47('0xa')](_0x490f65,_0x58aeb9)['then'](function(_0x11b7c2){logger['info'](_0xed47('0xb'),_0x507f12,_0xed47('0xc'));logger[_0xed47('0xd')](_0xed47('0xe'),_0x507f12,_0xed47('0xc'),JSON[_0xed47('0xf')](_0x11b7c2));if(_0x11b7c2['error']){if(_0x11b7c2['error'][_0xed47('0x10')]===0x1f4){logger[_0xed47('0x11')](_0xed47('0xb'),_0x507f12,_0x11b7c2[_0xed47('0x11')][_0xed47('0x12')]);return _0x18f67a(_0x11b7c2['error']['message']);}logger[_0xed47('0x11')](_0xed47('0xb'),_0x507f12,_0x11b7c2[_0xed47('0x11')]['message']);return _0x10df06(_0x11b7c2[_0xed47('0x11')][_0xed47('0x12')]);}else{logger[_0xed47('0x13')](_0xed47('0xb'),_0x507f12,'request\x20sent');_0x10df06(_0x11b7c2[_0xed47('0x14')][_0xed47('0x12')]);}})[_0xed47('0x15')](function(_0x431d67){logger[_0xed47('0x11')](_0xed47('0xb'),_0x507f12,_0x431d67);_0x18f67a(_0x431d67);});});} \ No newline at end of file +var _0xe3f0=['catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4c78ee,_0x1202fa){var _0x1124b8=function(_0xd7804){while(--_0xd7804){_0x4c78ee['push'](_0x4c78ee['shift']());}};_0x1124b8(++_0x1202fa);}(_0xe3f0,0xc7));var _0x0e3f=function(_0x3824ee,_0x3b1fc4){_0x3824ee=_0x3824ee-0x0;var _0x32c800=_0xe3f0[_0x3824ee];return _0x32c800;};'use strict';var _=require(_0x0e3f('0x0'));var util=require(_0x0e3f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e3f('0x2'));var db=require(_0x0e3f('0x3'))['db'];var utils=require(_0x0e3f('0x4'));var logger=require(_0x0e3f('0x5'))(_0x0e3f('0x6'));var config=require(_0x0e3f('0x7'));var jayson=require(_0x0e3f('0x8'));var client=jayson[_0x0e3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x524824,_0x4f6820,_0x3823f2){return new BPromise(function(_0x57b6bb,_0x435e01){return client[_0x0e3f('0xa')](_0x524824,_0x3823f2)[_0x0e3f('0xb')](function(_0x2ec04b){logger[_0x0e3f('0xc')](_0x0e3f('0xd'),_0x4f6820,_0x0e3f('0xe'));logger[_0x0e3f('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4f6820,_0x0e3f('0xe'),JSON[_0x0e3f('0x10')](_0x2ec04b));if(_0x2ec04b[_0x0e3f('0x11')]){if(_0x2ec04b[_0x0e3f('0x11')][_0x0e3f('0x12')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4f6820,_0x2ec04b[_0x0e3f('0x11')]['message']);return _0x435e01(_0x2ec04b[_0x0e3f('0x11')][_0x0e3f('0x13')]);}logger[_0x0e3f('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x4f6820,_0x2ec04b[_0x0e3f('0x11')][_0x0e3f('0x13')]);return _0x57b6bb(_0x2ec04b['error'][_0x0e3f('0x13')]);}else{logger[_0x0e3f('0xc')](_0x0e3f('0xd'),_0x4f6820,'request\x20sent');_0x57b6bb(_0x2ec04b[_0x0e3f('0x14')]['message']);}})[_0x0e3f('0x15')](function(_0x4ba8f4){logger['error'](_0x0e3f('0xd'),_0x4f6820,_0x4ba8f4);_0x435e01(_0x4ba8f4);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2de0da1..917400e 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 _0xc73e=['getFields','create','post','addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x4fd7dd,_0x73b9ba){var _0x415b55=function(_0x5e3fd6){while(--_0x5e3fd6){_0x4fd7dd['push'](_0x4fd7dd['shift']());}};_0x415b55(++_0x73b9ba);}(_0xc73e,0x1e9));var _0xec73=function(_0x3d0cbb,_0x3f9bb6){_0x3d0cbb=_0x3d0cbb-0x0;var _0x34520f=_0xc73e[_0x3d0cbb];return _0x34520f;};'use strict';var multer=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var path=require('path');var timeout=require(_0xec73('0x2'));var express=require(_0xec73('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var controller=require('./intVtigerAccount.controller');router[_0xec73('0x6')]('/',auth[_0xec73('0x7')](),controller[_0xec73('0x8')]);router[_0xec73('0x6')]('/:id',auth[_0xec73('0x7')](),controller['show']);router[_0xec73('0x6')](_0xec73('0x9'),auth[_0xec73('0x7')](),controller[_0xec73('0xa')]);router['get']('/:id/fields',auth[_0xec73('0x7')](),controller[_0xec73('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec73('0xc')]);router[_0xec73('0xd')](_0xec73('0x9'),auth[_0xec73('0x7')](),controller[_0xec73('0xe')]);router[_0xec73('0xf')](_0xec73('0x10'),auth['isAuthenticated'](),controller[_0xec73('0x11')]);router['delete'](_0xec73('0x10'),auth['isAuthenticated'](),controller[_0xec73('0x12')]);module[_0xec73('0x13')]=router; \ No newline at end of file +var _0x643f=['getFields','post','create','/:id/configurations','/:id','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','show','get','getConfigurations','/:id/fields'];(function(_0x19017b,_0x56d52c){var _0x3becdc=function(_0x1e0fde){while(--_0x1e0fde){_0x19017b['push'](_0x19017b['shift']());}};_0x3becdc(++_0x56d52c);}(_0x643f,0x1e6));var _0xf643=function(_0x2437b0,_0x3c3194){_0x2437b0=_0x2437b0-0x0;var _0x2e5de9=_0x643f[_0x2437b0];return _0x2e5de9;};'use strict';var multer=require('multer');var util=require(_0xf643('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf643('0x1'));var router=express[_0xf643('0x2')]();var fs_extra=require(_0xf643('0x3'));var auth=require(_0xf643('0x4'));var interaction=require(_0xf643('0x5'));var config=require(_0xf643('0x6'));var controller=require(_0xf643('0x7'));router['get']('/',auth[_0xf643('0x8')](),controller[_0xf643('0x9')]);router['get']('/:id',auth[_0xf643('0x8')](),controller[_0xf643('0xa')]);router[_0xf643('0xb')]('/:id/configurations',auth[_0xf643('0x8')](),controller[_0xf643('0xc')]);router[_0xf643('0xb')](_0xf643('0xd'),auth[_0xf643('0x8')](),controller[_0xf643('0xe')]);router[_0xf643('0xf')]('/',auth[_0xf643('0x8')](),controller[_0xf643('0x10')]);router[_0xf643('0xf')](_0xf643('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xf643('0x8')](),controller['update']);router['delete'](_0xf643('0x12'),auth[_0xf643('0x8')](),controller['destroy']);module[_0xf643('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1e72b71..403bcf5 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 _0x8d8e=['exports','STRING','HelpDesk','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8d8e,0x113));var _0xe8d8=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x8d8e[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0xe8d8('0x0'));module[_0xe8d8('0x1')]={'name':{'type':Sequelize[_0xe8d8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe8d8('0x2')]},'username':{'type':Sequelize[_0xe8d8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe8d8('0x2')],'allowNull':![],'defaultValue':_0xe8d8('0x3')},'remoteUri':{'type':Sequelize[_0xe8d8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe8d8('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe8d8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0e16=['exports','STRING','HelpDesk','sequelize'];(function(_0x1cfbdd,_0x4bdd68){var _0xdbe895=function(_0x1824d5){while(--_0x1824d5){_0x1cfbdd['push'](_0x1cfbdd['shift']());}};_0xdbe895(++_0x4bdd68);}(_0x0e16,0x87));var _0x60e1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0e16[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x60e1('0x0'));module[_0x60e1('0x1')]={'name':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x60e1('0x2')]},'username':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![],'defaultValue':_0x60e1('0x3')},'remoteUri':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 70f1838..de7d7c9 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 _0xdf98=['getchallenge','success','POST','login','result','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','map','VtigerAccount','rawAttributes','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerConfiguration','create','VtigerField','md5','getFields','username','description','serverUrl','accessKey','moduleName','remoteUri','slice','format','%s/webservice.php','GET'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf98,0x1eb));var _0x8df9=function(_0x3550b4,_0x59b309){_0x3550b4=_0x3550b4-0x0;var _0x237bca=_0xdf98[_0x3550b4];return _0x237bca;};'use strict';var emlformat=require(_0x8df9('0x0'));var rimraf=require(_0x8df9('0x1'));var zipdir=require(_0x8df9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8df9('0x3'));var moment=require('moment');var BPromise=require(_0x8df9('0x4'));var Mustache=require(_0x8df9('0x5'));var util=require(_0x8df9('0x6'));var path=require(_0x8df9('0x7'));var sox=require(_0x8df9('0x8'));var csv=require(_0x8df9('0x9'));var ejs=require(_0x8df9('0xa'));var fs=require('fs');var fs_extra=require(_0x8df9('0xb'));var _=require(_0x8df9('0xc'));var squel=require('squel');var crypto=require(_0x8df9('0xd'));var jsforce=require(_0x8df9('0xe'));var deskjs=require(_0x8df9('0xf'));var toCsv=require(_0x8df9('0x9'));var querystring=require(_0x8df9('0x10'));var Papa=require(_0x8df9('0x11'));var Redis=require('ioredis');var authService=require(_0x8df9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8df9('0x13'));var logger=require(_0x8df9('0x14'))('api');var utils=require(_0x8df9('0x15'));var config=require(_0x8df9('0x16'));var licenseUtil=require(_0x8df9('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8df9('0x18'));function respondWithStatusCode(_0x3c5fb9,_0x474c37){_0x474c37=_0x474c37||0xcc;return function(_0x404431){if(_0x404431){return _0x3c5fb9[_0x8df9('0x19')](_0x474c37);}return _0x3c5fb9[_0x8df9('0x1a')](_0x474c37)[_0x8df9('0x1b')]();};}function respondWithResult(_0x45373e,_0x2a399c){_0x2a399c=_0x2a399c||0xc8;return function(_0x4d9bc9){if(_0x4d9bc9){return _0x45373e['status'](_0x2a399c)[_0x8df9('0x1c')](_0x4d9bc9);}};}function respondWithFilteredResult(_0x5e80fd,_0x4a6610){return function(_0x5e6c8b){if(_0x5e6c8b){var _0x5a7747=typeof _0x4a6610[_0x8df9('0x1d')]===_0x8df9('0x1e')&&typeof _0x4a6610[_0x8df9('0x1f')]===_0x8df9('0x1e');var _0x2a7fdd=_0x5e6c8b['count'];var _0x2001d3=_0x5a7747?0x0:_0x4a6610[_0x8df9('0x1d')];var _0x46baba=_0x5a7747?_0x5e6c8b[_0x8df9('0x20')]:_0x4a6610[_0x8df9('0x1d')]+_0x4a6610[_0x8df9('0x1f')];var _0x452484;if(_0x46baba>=_0x2a7fdd){_0x46baba=_0x2a7fdd;_0x452484=0xc8;}else{_0x452484=0xce;}_0x5e80fd[_0x8df9('0x1a')](_0x452484);return _0x5e80fd[_0x8df9('0x21')](_0x8df9('0x22'),_0x2001d3+'-'+_0x46baba+'/'+_0x2a7fdd)[_0x8df9('0x1c')](_0x5e6c8b);}return null;};}function patchUpdates(_0x46fc70){return function(_0x2318d5){try{jsonpatch['apply'](_0x2318d5,_0x46fc70,!![]);}catch(_0x2ff8ef){return BPromise[_0x8df9('0x23')](_0x2ff8ef);}return _0x2318d5['save']();};}function saveUpdates(_0x26ae91,_0xfb57a9){return function(_0xc78ea3){if(_0xc78ea3){return _0xc78ea3[_0x8df9('0x24')](_0x26ae91)[_0x8df9('0x25')](function(_0x278db0){return _0x278db0;});}return null;};}function removeEntity(_0x7eae0f,_0x487501){return function(_0x26c100){if(_0x26c100){return _0x26c100[_0x8df9('0x26')]()['then'](function(){_0x7eae0f[_0x8df9('0x1a')](0xcc)[_0x8df9('0x1b')]();});}};}function handleEntityNotFound(_0x13bd34,_0x48d1bb){return function(_0x44735b){if(!_0x44735b){_0x13bd34[_0x8df9('0x19')](0x194);}return _0x44735b;};}function handleError(_0x3c967d,_0x2307cd){_0x2307cd=_0x2307cd||0x1f4;return function(_0x155788){logger[_0x8df9('0x27')](_0x155788[_0x8df9('0x28')]);if(_0x155788[_0x8df9('0x29')]){delete _0x155788['name'];}_0x3c967d[_0x8df9('0x1a')](_0x2307cd)['send'](_0x155788);};}exports['index']=function(_0x40f09f,_0x4746b0){var _0x2efc1d={},_0x10f45f={},_0x54478d={'count':0x0,'rows':[]};var _0x360d15=_[_0x8df9('0x2a')](db[_0x8df9('0x2b')][_0x8df9('0x2c')],function(_0x199e8e){return{'name':_0x199e8e['fieldName'],'type':_0x199e8e[_0x8df9('0x2d')][_0x8df9('0x2e')]};});_0x10f45f[_0x8df9('0x2f')]=_[_0x8df9('0x2a')](_0x360d15,_0x8df9('0x29'));_0x10f45f['query']=_['keys'](_0x40f09f['query']);_0x10f45f[_0x8df9('0x30')]=_[_0x8df9('0x31')](_0x10f45f['model'],_0x10f45f['query']);_0x2efc1d[_0x8df9('0x32')]=_[_0x8df9('0x31')](_0x10f45f[_0x8df9('0x2f')],qs[_0x8df9('0x33')](_0x40f09f[_0x8df9('0x34')][_0x8df9('0x33')]));_0x2efc1d[_0x8df9('0x32')]=_0x2efc1d[_0x8df9('0x32')][_0x8df9('0x35')]?_0x2efc1d[_0x8df9('0x32')]:_0x10f45f[_0x8df9('0x2f')];if(!_0x40f09f['query'][_0x8df9('0x36')](_0x8df9('0x37'))){_0x2efc1d[_0x8df9('0x1f')]=qs['limit'](_0x40f09f[_0x8df9('0x34')]['limit']);_0x2efc1d['offset']=qs['offset'](_0x40f09f[_0x8df9('0x34')][_0x8df9('0x1d')]);}_0x2efc1d[_0x8df9('0x38')]=qs['sort'](_0x40f09f['query'][_0x8df9('0x39')]);_0x2efc1d[_0x8df9('0x3a')]=qs[_0x8df9('0x30')](_[_0x8df9('0x3b')](_0x40f09f[_0x8df9('0x34')],_0x10f45f[_0x8df9('0x30')]),_0x360d15);if(_0x40f09f[_0x8df9('0x34')][_0x8df9('0x3c')]){_0x2efc1d[_0x8df9('0x3a')]=_[_0x8df9('0x3d')](_0x2efc1d[_0x8df9('0x3a')],{'$or':_[_0x8df9('0x2a')](_0x360d15,function(_0x1cdcaa){if(_0x1cdcaa[_0x8df9('0x2d')]!=='VIRTUAL'){var _0x3fa6ee={};_0x3fa6ee[_0x1cdcaa[_0x8df9('0x29')]]={'$like':'%'+_0x40f09f['query']['filter']+'%'};return _0x3fa6ee;}})});}_0x2efc1d=_[_0x8df9('0x3d')]({},_0x2efc1d,_0x40f09f[_0x8df9('0x3e')]);var _0x3796a8={'where':_0x2efc1d[_0x8df9('0x3a')]};return db[_0x8df9('0x2b')][_0x8df9('0x20')](_0x3796a8)[_0x8df9('0x25')](function(_0x1ef4c2){_0x54478d[_0x8df9('0x20')]=_0x1ef4c2;if(_0x40f09f[_0x8df9('0x34')][_0x8df9('0x3f')]){_0x2efc1d[_0x8df9('0x40')]=[{'all':!![]}];}return db[_0x8df9('0x2b')][_0x8df9('0x41')](_0x2efc1d);})[_0x8df9('0x25')](function(_0x591cdb){_0x54478d[_0x8df9('0x42')]=_0x591cdb;return _0x54478d;})[_0x8df9('0x25')](respondWithFilteredResult(_0x4746b0,_0x2efc1d))['catch'](handleError(_0x4746b0,null));};exports['show']=function(_0x382074,_0x4aaa2f){var _0x20a405={'raw':![],'where':{'id':_0x382074[_0x8df9('0x43')]['id']}},_0x2a2da2={};_0x2a2da2['model']=_[_0x8df9('0x44')](db[_0x8df9('0x2b')][_0x8df9('0x2c')]);_0x2a2da2[_0x8df9('0x34')]=_[_0x8df9('0x44')](_0x382074[_0x8df9('0x34')]);_0x2a2da2[_0x8df9('0x30')]=_[_0x8df9('0x31')](_0x2a2da2['model'],_0x2a2da2[_0x8df9('0x34')]);_0x20a405['attributes']=_[_0x8df9('0x31')](_0x2a2da2[_0x8df9('0x2f')],qs[_0x8df9('0x33')](_0x382074[_0x8df9('0x34')][_0x8df9('0x33')]));_0x20a405['attributes']=_0x20a405['attributes'][_0x8df9('0x35')]?_0x20a405['attributes']:_0x2a2da2['model'];if(_0x382074[_0x8df9('0x34')][_0x8df9('0x3f')]){_0x20a405['include']=[{'all':!![]}];}_0x20a405=_[_0x8df9('0x3d')]({},_0x20a405,_0x382074[_0x8df9('0x3e')]);return db[_0x8df9('0x2b')][_0x8df9('0x45')](_0x20a405)[_0x8df9('0x25')](handleEntityNotFound(_0x4aaa2f,null))[_0x8df9('0x25')](respondWithResult(_0x4aaa2f,null))[_0x8df9('0x46')](handleError(_0x4aaa2f,null));};exports['create']=function(_0x3c9c15,_0x504d1b){return db['VtigerAccount']['create'](_0x3c9c15[_0x8df9('0x47')],{})[_0x8df9('0x25')](respondWithResult(_0x504d1b,0xc9))['catch'](handleError(_0x504d1b,null));};exports['update']=function(_0x38f78f,_0x5536bd){if(_0x38f78f[_0x8df9('0x47')]['id']){delete _0x38f78f[_0x8df9('0x47')]['id'];}return db['VtigerAccount'][_0x8df9('0x45')]({'where':{'id':_0x38f78f[_0x8df9('0x43')]['id']}})[_0x8df9('0x25')](handleEntityNotFound(_0x5536bd,null))[_0x8df9('0x25')](saveUpdates(_0x38f78f[_0x8df9('0x47')],null))[_0x8df9('0x25')](respondWithResult(_0x5536bd,null))['catch'](handleError(_0x5536bd,null));};exports[_0x8df9('0x26')]=function(_0x1ec5af,_0x379808){return db[_0x8df9('0x2b')][_0x8df9('0x45')]({'where':{'id':_0x1ec5af[_0x8df9('0x43')]['id']}})[_0x8df9('0x25')](handleEntityNotFound(_0x379808,null))[_0x8df9('0x25')](removeEntity(_0x379808,null))[_0x8df9('0x46')](handleError(_0x379808,null));};exports[_0x8df9('0x48')]=function(_0x5f04de,_0x2ef321,_0x5c1e8a){var _0x294c87={};var _0xb6d23e={};var _0x3d1ad1;var _0x432214;return db[_0x8df9('0x2b')][_0x8df9('0x49')]({'where':{'id':_0x5f04de['params']['id']}})[_0x8df9('0x25')](handleEntityNotFound(_0x2ef321,null))[_0x8df9('0x25')](function(_0x5f3d29){if(_0x5f3d29){_0x3d1ad1=_0x5f3d29;_0xb6d23e[_0x8df9('0x2f')]=_[_0x8df9('0x44')](db['VtigerConfiguration'][_0x8df9('0x2c')]);_0xb6d23e[_0x8df9('0x34')]=_[_0x8df9('0x44')](_0x5f04de[_0x8df9('0x34')]);_0xb6d23e['filters']=_['intersection'](_0xb6d23e[_0x8df9('0x2f')],_0xb6d23e[_0x8df9('0x34')]);_0x294c87['attributes']=_[_0x8df9('0x31')](_0xb6d23e['model'],qs['fields'](_0x5f04de[_0x8df9('0x34')][_0x8df9('0x33')]));_0x294c87[_0x8df9('0x32')]=_0x294c87[_0x8df9('0x32')][_0x8df9('0x35')]?_0x294c87[_0x8df9('0x32')]:_0xb6d23e[_0x8df9('0x2f')];_0x294c87['order']=qs[_0x8df9('0x39')](_0x5f04de[_0x8df9('0x34')][_0x8df9('0x39')]);_0x294c87[_0x8df9('0x3a')]=qs['filters'](_[_0x8df9('0x3b')](_0x5f04de[_0x8df9('0x34')],_0xb6d23e[_0x8df9('0x30')]));if(_0x5f04de[_0x8df9('0x34')][_0x8df9('0x3c')]){_0x294c87[_0x8df9('0x3a')]=_['merge'](_0x294c87['where'],{'$or':_[_0x8df9('0x2a')](_0x294c87['attributes'],function(_0x45236e){var _0x467b65={};_0x467b65[_0x45236e]={'$like':'%'+_0x5f04de['query'][_0x8df9('0x3c')]+'%'};return _0x467b65;})});}_0x294c87=_['merge']({},_0x294c87,_0x5f04de[_0x8df9('0x3e')]);return _0x3d1ad1[_0x8df9('0x48')](_0x294c87);}})[_0x8df9('0x25')](function(_0x461d98){if(_0x461d98){_0x432214=_0x461d98['length'];if(!_0x5f04de['query'][_0x8df9('0x36')](_0x8df9('0x37'))){_0x294c87['limit']=qs['limit'](_0x5f04de['query']['limit']);_0x294c87[_0x8df9('0x1d')]=qs[_0x8df9('0x1d')](_0x5f04de['query'][_0x8df9('0x1d')]);}return _0x3d1ad1[_0x8df9('0x48')](_0x294c87);}})[_0x8df9('0x25')](function(_0x265f21){if(_0x265f21){return _0x265f21?{'count':_0x432214,'rows':_0x265f21}:null;}})[_0x8df9('0x25')](respondWithResult(_0x2ef321,null))['catch'](handleError(_0x2ef321,null));};exports['addConfiguration']=function(_0x9ee0c3,_0x50de83,_0x263dcf){if(_0x9ee0c3[_0x8df9('0x47')]['id']){delete _0x9ee0c3['body']['id'];}return db[_0x8df9('0x2b')][_0x8df9('0x49')]({'where':{'id':_0x9ee0c3[_0x8df9('0x43')]['id']}})[_0x8df9('0x25')](handleEntityNotFound(_0x50de83,null))[_0x8df9('0x25')](function(_0x134ae8){if(_0x134ae8){_0x9ee0c3[_0x8df9('0x47')][_0x8df9('0x4a')]=_0x134ae8['id'];_0x9ee0c3[_0x8df9('0x47')][_0x8df9('0x4b')]=integrations[_0x8df9('0x4c')](_0x9ee0c3[_0x8df9('0x47')][_0x8df9('0x4d')],_0x9ee0c3['body'][_0x8df9('0x2d')]);_0x9ee0c3[_0x8df9('0x47')][_0x8df9('0x4e')]=integrations['getDescriptions'](_0x9ee0c3['body'][_0x8df9('0x4d')],_0x9ee0c3['body'][_0x8df9('0x2d')]);return db[_0x8df9('0x4f')][_0x8df9('0x50')](_0x9ee0c3[_0x8df9('0x47')],{'include':[{'model':db['VtigerField'],'as':_0x8df9('0x4b')},{'model':db[_0x8df9('0x51')],'as':_0x8df9('0x4e')}]});}return null;})[_0x8df9('0x25')](respondWithResult(_0x50de83,null))['catch'](handleError(_0x50de83,null));};var md5=require(_0x8df9('0x52'));exports[_0x8df9('0x53')]=function(_0x12f256,_0x167f17,_0x35a4c9){var _0x3e242f=null;var _0x30c5e4=null;var _0x46fa3b=null;var _0x243da5=null;var _0x5bc53d='';return db[_0x8df9('0x2b')][_0x8df9('0x49')]({'where':{'id':_0x12f256[_0x8df9('0x43')]['id']},'attributes':['id',_0x8df9('0x29'),_0x8df9('0x54'),_0x8df9('0x55'),'moduleName','remoteUri',_0x8df9('0x56'),_0x8df9('0x57')]})[_0x8df9('0x25')](handleEntityNotFound(_0x167f17,null))['then'](function(_0x2f65d1){if(_0x2f65d1){_0x3e242f=_0x2f65d1[_0x8df9('0x54')];_0x30c5e4=_0x2f65d1[_0x8df9('0x57')];_0x46fa3b=_0x2f65d1[_0x8df9('0x58')];_0x5bc53d=_0x2f65d1[_0x8df9('0x59')];var _0x4ec426=_0x5bc53d[_0x8df9('0x5a')](-0x1);if(_0x4ec426==='/'){_0x5bc53d=_0x5bc53d['substring'](0x0,_0x5bc53d['lastIndexOf'](_0x4ec426));}_0x243da5=util[_0x8df9('0x5b')](_0x8df9('0x5c'),_0x5bc53d);var _0x4394ae={'method':_0x8df9('0x5d'),'uri':_0x243da5,'qs':{'operation':_0x8df9('0x5e'),'username':_0x2f65d1[_0x8df9('0x54')]},'json':!![]};return rp(_0x4394ae);}})[_0x8df9('0x25')](function(_0x45de82){if(_0x45de82[_0x8df9('0x5f')]){var _0x49b9e7={'method':_0x8df9('0x60'),'uri':_0x243da5,'form':{'operation':_0x8df9('0x61'),'username':_0x3e242f,'accessKey':md5(_0x45de82['result']['token']+_0x30c5e4)},'json':!![]};return rp(_0x49b9e7);}})[_0x8df9('0x25')](function(_0x23acbd){if(_0x23acbd[_0x8df9('0x5f')]){var _0x2a24a6={'method':'GET','uri':_0x243da5,'qs':{'operation':'describe','username':_0x3e242f,'sessionName':_0x23acbd[_0x8df9('0x62')]['sessionName'],'elementType':_0x46fa3b},'json':!![]};return rp(_0x2a24a6);}})['then'](function(_0x40710f){if(_0x40710f['success']){var _0x319be0=[_0x8df9('0x63'),_0x8df9('0x64'),'owner'];_[_0x8df9('0x65')](_0x40710f[_0x8df9('0x62')][_0x8df9('0x33')],function(_0x15edd5){return _0x319be0[_0x8df9('0x66')](_0x15edd5['type']['name']);});_[_0x8df9('0x65')](_0x40710f[_0x8df9('0x62')][_0x8df9('0x33')],function(_0x588394){return _0x588394[_0x8df9('0x67')]===_0x8df9('0x68');});return{'count':_0x40710f[_0x8df9('0x62')][_0x8df9('0x33')][_0x8df9('0x35')],'rows':_[_0x8df9('0x2a')](_0x40710f[_0x8df9('0x62')][_0x8df9('0x33')],function(_0xbc3def){return{'id':_0xbc3def[_0x8df9('0x29')],'name':_0xbc3def[_0x8df9('0x69')],'custom':_[_0x8df9('0x6a')](_0xbc3def[_0x8df9('0x29')],_0x8df9('0x6b'))?!![]:![],'options':_0xbc3def['type'][_0x8df9('0x29')]===_0x8df9('0x6c')&&_0xbc3def[_0x8df9('0x2d')]['picklistValues']['length']>0x0?_[_0x8df9('0x2a')](_0xbc3def[_0x8df9('0x2d')][_0x8df9('0x6d')],function(_0x21259e){return{'name':_0x21259e[_0x8df9('0x69')],'value':_0x21259e[_0x8df9('0x6e')]};}):[]};})};}})[_0x8df9('0x25')](respondWithResult(_0x167f17,null))[_0x8df9('0x46')](function(_0x1776cb){console['log'](_0x8df9('0x6f')+_0x1776cb);var _0x4bdce9=_0x12f256['query'][_0x8df9('0x70')]?0x1f4:_0x1776cb[_0x8df9('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4bdce9,JSON[_0x8df9('0x72')](_0x1776cb));delete _0x1776cb[_0x8df9('0x29')];if(_0x4bdce9===0x191){_0x4bdce9=0x190;}_0x167f17['status'](_0x4bdce9)[_0x8df9('0x73')](_0x12f256[_0x8df9('0x34')][_0x8df9('0x70')]?{'message':_0x8df9('0x74'),'statusCode':_0x1776cb[_0x8df9('0x71')]}:_0x1776cb);});}; \ No newline at end of file +var _0x966a=['description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','includes','remove','false','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','name','index','VtigerAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x966a,0x1ef));var _0xa966=function(_0x353c7a,_0x26f09b){_0x353c7a=_0x353c7a-0x0;var _0x475689=_0x966a[_0x353c7a];return _0x475689;};'use strict';var emlformat=require(_0xa966('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa966('0x1'));var jsonpatch=require(_0xa966('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa966('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa966('0x4'));var fs=require('fs');var fs_extra=require(_0xa966('0x5'));var _=require(_0xa966('0x6'));var squel=require(_0xa966('0x7'));var crypto=require(_0xa966('0x8'));var jsforce=require(_0xa966('0x9'));var deskjs=require(_0xa966('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa966('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa966('0xc'));var as=require(_0xa966('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa966('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa966('0xf'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa966('0x10'));function respondWithStatusCode(_0x50be4f,_0x5b06ab){_0x5b06ab=_0x5b06ab||0xcc;return function(_0x5b534b){if(_0x5b534b){return _0x50be4f[_0xa966('0x11')](_0x5b06ab);}return _0x50be4f['status'](_0x5b06ab)[_0xa966('0x12')]();};}function respondWithResult(_0xe2642a,_0x4e64a3){_0x4e64a3=_0x4e64a3||0xc8;return function(_0x2414bb){if(_0x2414bb){return _0xe2642a['status'](_0x4e64a3)[_0xa966('0x13')](_0x2414bb);}};}function respondWithFilteredResult(_0x2b977d,_0x5dfe7a){return function(_0x56d91e){if(_0x56d91e){var _0x58c89d=typeof _0x5dfe7a[_0xa966('0x14')]==='undefined'&&typeof _0x5dfe7a[_0xa966('0x15')]==='undefined';var _0x590329=_0x56d91e[_0xa966('0x16')];var _0x572e82=_0x58c89d?0x0:_0x5dfe7a[_0xa966('0x14')];var _0x5705f2=_0x58c89d?_0x56d91e[_0xa966('0x16')]:_0x5dfe7a[_0xa966('0x14')]+_0x5dfe7a[_0xa966('0x15')];var _0xa736e5;if(_0x5705f2>=_0x590329){_0x5705f2=_0x590329;_0xa736e5=0xc8;}else{_0xa736e5=0xce;}_0x2b977d[_0xa966('0x17')](_0xa736e5);return _0x2b977d['set'](_0xa966('0x18'),_0x572e82+'-'+_0x5705f2+'/'+_0x590329)[_0xa966('0x13')](_0x56d91e);}return null;};}function patchUpdates(_0x2ed925){return function(_0xbb21f9){try{jsonpatch[_0xa966('0x19')](_0xbb21f9,_0x2ed925,!![]);}catch(_0x342429){return BPromise[_0xa966('0x1a')](_0x342429);}return _0xbb21f9[_0xa966('0x1b')]();};}function saveUpdates(_0x24e254,_0x510c43){return function(_0xf3d879){if(_0xf3d879){return _0xf3d879[_0xa966('0x1c')](_0x24e254)[_0xa966('0x1d')](function(_0x423eb0){return _0x423eb0;});}return null;};}function removeEntity(_0x39ad1d,_0x4b150b){return function(_0x36c001){if(_0x36c001){return _0x36c001[_0xa966('0x1e')]()[_0xa966('0x1d')](function(){_0x39ad1d[_0xa966('0x17')](0xcc)[_0xa966('0x12')]();});}};}function handleEntityNotFound(_0x57c33e,_0x10d41d){return function(_0x3a486e){if(!_0x3a486e){_0x57c33e[_0xa966('0x11')](0x194);}return _0x3a486e;};}function handleError(_0x368f4,_0x1276b9){_0x1276b9=_0x1276b9||0x1f4;return function(_0x476ad8){logger[_0xa966('0x1f')](_0x476ad8['stack']);if(_0x476ad8[_0xa966('0x20')]){delete _0x476ad8['name'];}_0x368f4[_0xa966('0x17')](_0x1276b9)['send'](_0x476ad8);};}exports[_0xa966('0x21')]=function(_0x5d77dd,_0x404c05){var _0x463207={},_0x3d88e7={},_0x243fca={'count':0x0,'rows':[]};var _0x6fe219=_['map'](db[_0xa966('0x22')]['rawAttributes'],function(_0x3e8a24){return{'name':_0x3e8a24[_0xa966('0x23')],'type':_0x3e8a24[_0xa966('0x24')][_0xa966('0x25')]};});_0x3d88e7[_0xa966('0x26')]=_[_0xa966('0x27')](_0x6fe219,_0xa966('0x20'));_0x3d88e7[_0xa966('0x28')]=_[_0xa966('0x29')](_0x5d77dd[_0xa966('0x28')]);_0x3d88e7[_0xa966('0x2a')]=_[_0xa966('0x2b')](_0x3d88e7[_0xa966('0x26')],_0x3d88e7[_0xa966('0x28')]);_0x463207[_0xa966('0x2c')]=_[_0xa966('0x2b')](_0x3d88e7[_0xa966('0x26')],qs['fields'](_0x5d77dd['query'][_0xa966('0x2d')]));_0x463207[_0xa966('0x2c')]=_0x463207['attributes']['length']?_0x463207['attributes']:_0x3d88e7[_0xa966('0x26')];if(!_0x5d77dd[_0xa966('0x28')][_0xa966('0x2e')](_0xa966('0x2f'))){_0x463207['limit']=qs[_0xa966('0x15')](_0x5d77dd[_0xa966('0x28')][_0xa966('0x15')]);_0x463207[_0xa966('0x14')]=qs[_0xa966('0x14')](_0x5d77dd[_0xa966('0x28')][_0xa966('0x14')]);}_0x463207[_0xa966('0x30')]=qs[_0xa966('0x31')](_0x5d77dd[_0xa966('0x28')]['sort']);_0x463207[_0xa966('0x32')]=qs[_0xa966('0x2a')](_[_0xa966('0x33')](_0x5d77dd[_0xa966('0x28')],_0x3d88e7[_0xa966('0x2a')]),_0x6fe219);if(_0x5d77dd[_0xa966('0x28')]['filter']){_0x463207['where']=_[_0xa966('0x34')](_0x463207[_0xa966('0x32')],{'$or':_[_0xa966('0x27')](_0x6fe219,function(_0x42dbe9){if(_0x42dbe9['type']!==_0xa966('0x35')){var _0x2347a0={};_0x2347a0[_0x42dbe9['name']]={'$like':'%'+_0x5d77dd['query'][_0xa966('0x36')]+'%'};return _0x2347a0;}})});}_0x463207=_[_0xa966('0x34')]({},_0x463207,_0x5d77dd[_0xa966('0x37')]);var _0x1af7f6={'where':_0x463207[_0xa966('0x32')]};return db['VtigerAccount'][_0xa966('0x16')](_0x1af7f6)[_0xa966('0x1d')](function(_0x119ed0){_0x243fca['count']=_0x119ed0;if(_0x5d77dd[_0xa966('0x28')]['includeAll']){_0x463207[_0xa966('0x38')]=[{'all':!![]}];}return db[_0xa966('0x22')]['findAll'](_0x463207);})[_0xa966('0x1d')](function(_0x39dc43){_0x243fca[_0xa966('0x39')]=_0x39dc43;return _0x243fca;})['then'](respondWithFilteredResult(_0x404c05,_0x463207))[_0xa966('0x3a')](handleError(_0x404c05,null));};exports[_0xa966('0x3b')]=function(_0x12f049,_0x3a4c4e){var _0x3fa137={'raw':![],'where':{'id':_0x12f049['params']['id']}},_0xa3d702={};_0xa3d702[_0xa966('0x26')]=_[_0xa966('0x29')](db[_0xa966('0x22')][_0xa966('0x3c')]);_0xa3d702[_0xa966('0x28')]=_['keys'](_0x12f049[_0xa966('0x28')]);_0xa3d702[_0xa966('0x2a')]=_[_0xa966('0x2b')](_0xa3d702[_0xa966('0x26')],_0xa3d702[_0xa966('0x28')]);_0x3fa137['attributes']=_[_0xa966('0x2b')](_0xa3d702[_0xa966('0x26')],qs['fields'](_0x12f049[_0xa966('0x28')][_0xa966('0x2d')]));_0x3fa137[_0xa966('0x2c')]=_0x3fa137['attributes'][_0xa966('0x3d')]?_0x3fa137['attributes']:_0xa3d702[_0xa966('0x26')];if(_0x12f049[_0xa966('0x28')][_0xa966('0x3e')]){_0x3fa137[_0xa966('0x38')]=[{'all':!![]}];}_0x3fa137=_['merge']({},_0x3fa137,_0x12f049['options']);return db['VtigerAccount'][_0xa966('0x3f')](_0x3fa137)['then'](handleEntityNotFound(_0x3a4c4e,null))['then'](respondWithResult(_0x3a4c4e,null))['catch'](handleError(_0x3a4c4e,null));};exports[_0xa966('0x40')]=function(_0x4535f7,_0x3de549){return db[_0xa966('0x22')][_0xa966('0x40')](_0x4535f7[_0xa966('0x41')],{})[_0xa966('0x1d')](respondWithResult(_0x3de549,0xc9))[_0xa966('0x3a')](handleError(_0x3de549,null));};exports[_0xa966('0x1c')]=function(_0x500569,_0x339a44){if(_0x500569['body']['id']){delete _0x500569[_0xa966('0x41')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x500569[_0xa966('0x42')]['id']}})[_0xa966('0x1d')](handleEntityNotFound(_0x339a44,null))[_0xa966('0x1d')](saveUpdates(_0x500569[_0xa966('0x41')],null))[_0xa966('0x1d')](respondWithResult(_0x339a44,null))['catch'](handleError(_0x339a44,null));};exports[_0xa966('0x1e')]=function(_0x4867fa,_0x17e910){return db[_0xa966('0x22')][_0xa966('0x3f')]({'where':{'id':_0x4867fa[_0xa966('0x42')]['id']}})['then'](handleEntityNotFound(_0x17e910,null))[_0xa966('0x1d')](removeEntity(_0x17e910,null))['catch'](handleError(_0x17e910,null));};exports['getConfigurations']=function(_0x286c03,_0x4f9dc4,_0x48a054){var _0x15912f={};var _0x18a950={};var _0x4b019e;var _0x2cb5b4;return db[_0xa966('0x22')][_0xa966('0x43')]({'where':{'id':_0x286c03[_0xa966('0x42')]['id']}})[_0xa966('0x1d')](handleEntityNotFound(_0x4f9dc4,null))[_0xa966('0x1d')](function(_0x244254){if(_0x244254){_0x4b019e=_0x244254;_0x18a950['model']=_[_0xa966('0x29')](db[_0xa966('0x44')]['rawAttributes']);_0x18a950['query']=_[_0xa966('0x29')](_0x286c03[_0xa966('0x28')]);_0x18a950[_0xa966('0x2a')]=_[_0xa966('0x2b')](_0x18a950[_0xa966('0x26')],_0x18a950[_0xa966('0x28')]);_0x15912f['attributes']=_[_0xa966('0x2b')](_0x18a950[_0xa966('0x26')],qs['fields'](_0x286c03['query'][_0xa966('0x2d')]));_0x15912f[_0xa966('0x2c')]=_0x15912f[_0xa966('0x2c')][_0xa966('0x3d')]?_0x15912f[_0xa966('0x2c')]:_0x18a950[_0xa966('0x26')];_0x15912f[_0xa966('0x30')]=qs[_0xa966('0x31')](_0x286c03[_0xa966('0x28')]['sort']);_0x15912f[_0xa966('0x32')]=qs[_0xa966('0x2a')](_[_0xa966('0x33')](_0x286c03[_0xa966('0x28')],_0x18a950[_0xa966('0x2a')]));if(_0x286c03[_0xa966('0x28')][_0xa966('0x36')]){_0x15912f[_0xa966('0x32')]=_[_0xa966('0x34')](_0x15912f['where'],{'$or':_[_0xa966('0x27')](_0x15912f[_0xa966('0x2c')],function(_0x410c02){var _0x1fd6f7={};_0x1fd6f7[_0x410c02]={'$like':'%'+_0x286c03[_0xa966('0x28')][_0xa966('0x36')]+'%'};return _0x1fd6f7;})});}_0x15912f=_[_0xa966('0x34')]({},_0x15912f,_0x286c03['options']);return _0x4b019e[_0xa966('0x45')](_0x15912f);}})[_0xa966('0x1d')](function(_0x2ee45e){if(_0x2ee45e){_0x2cb5b4=_0x2ee45e[_0xa966('0x3d')];if(!_0x286c03[_0xa966('0x28')][_0xa966('0x2e')](_0xa966('0x2f'))){_0x15912f[_0xa966('0x15')]=qs['limit'](_0x286c03[_0xa966('0x28')][_0xa966('0x15')]);_0x15912f['offset']=qs[_0xa966('0x14')](_0x286c03[_0xa966('0x28')]['offset']);}return _0x4b019e['getConfigurations'](_0x15912f);}})['then'](function(_0x5ac695){if(_0x5ac695){return _0x5ac695?{'count':_0x2cb5b4,'rows':_0x5ac695}:null;}})[_0xa966('0x1d')](respondWithResult(_0x4f9dc4,null))[_0xa966('0x3a')](handleError(_0x4f9dc4,null));};exports[_0xa966('0x46')]=function(_0x329c87,_0x19242f,_0x1e245d){if(_0x329c87[_0xa966('0x41')]['id']){delete _0x329c87[_0xa966('0x41')]['id'];}return db[_0xa966('0x22')][_0xa966('0x43')]({'where':{'id':_0x329c87[_0xa966('0x42')]['id']}})[_0xa966('0x1d')](handleEntityNotFound(_0x19242f,null))[_0xa966('0x1d')](function(_0x2a6b8a){if(_0x2a6b8a){_0x329c87[_0xa966('0x41')][_0xa966('0x47')]=_0x2a6b8a['id'];_0x329c87[_0xa966('0x41')][_0xa966('0x48')]=integrations[_0xa966('0x49')](_0x329c87['body'][_0xa966('0x4a')],_0x329c87[_0xa966('0x41')][_0xa966('0x24')]);_0x329c87[_0xa966('0x41')][_0xa966('0x4b')]=integrations[_0xa966('0x4c')](_0x329c87[_0xa966('0x41')][_0xa966('0x4a')],_0x329c87['body'][_0xa966('0x24')]);return db['VtigerConfiguration']['create'](_0x329c87[_0xa966('0x41')],{'include':[{'model':db[_0xa966('0x4d')],'as':_0xa966('0x48')},{'model':db['VtigerField'],'as':_0xa966('0x4b')}]});}return null;})[_0xa966('0x1d')](respondWithResult(_0x19242f,null))[_0xa966('0x3a')](handleError(_0x19242f,null));};var md5=require('md5');exports[_0xa966('0x4e')]=function(_0x38b042,_0x5ce71a,_0x523414){var _0x38fe0f=null;var _0x28a788=null;var _0x1f6b58=null;var _0x5aea54=null;var _0x47b2df='';return db[_0xa966('0x22')][_0xa966('0x43')]({'where':{'id':_0x38b042[_0xa966('0x42')]['id']},'attributes':['id',_0xa966('0x20'),_0xa966('0x4f'),_0xa966('0x50'),_0xa966('0x51'),_0xa966('0x52'),_0xa966('0x53'),_0xa966('0x54')]})['then'](handleEntityNotFound(_0x5ce71a,null))[_0xa966('0x1d')](function(_0x24931b){if(_0x24931b){_0x38fe0f=_0x24931b['username'];_0x28a788=_0x24931b[_0xa966('0x54')];_0x1f6b58=_0x24931b['moduleName'];_0x47b2df=_0x24931b['remoteUri'];var _0x3add6d=_0x47b2df[_0xa966('0x55')](-0x1);if(_0x3add6d==='/'){_0x47b2df=_0x47b2df['substring'](0x0,_0x47b2df[_0xa966('0x56')](_0x3add6d));}_0x5aea54=util[_0xa966('0x57')](_0xa966('0x58'),_0x47b2df);var _0xecdd91={'method':'GET','uri':_0x5aea54,'qs':{'operation':_0xa966('0x59'),'username':_0x24931b['username']},'json':!![]};return rp(_0xecdd91);}})['then'](function(_0x504cf0){if(_0x504cf0[_0xa966('0x5a')]){var _0x50aa4a={'method':_0xa966('0x5b'),'uri':_0x5aea54,'form':{'operation':_0xa966('0x5c'),'username':_0x38fe0f,'accessKey':md5(_0x504cf0[_0xa966('0x5d')][_0xa966('0x5e')]+_0x28a788)},'json':!![]};return rp(_0x50aa4a);}})['then'](function(_0x583f49){if(_0x583f49[_0xa966('0x5a')]){var _0x303fde={'method':'GET','uri':_0x5aea54,'qs':{'operation':_0xa966('0x5f'),'username':_0x38fe0f,'sessionName':_0x583f49['result'][_0xa966('0x60')],'elementType':_0x1f6b58},'json':!![]};return rp(_0x303fde);}})['then'](function(_0x31393d){if(_0x31393d[_0xa966('0x5a')]){var _0x1599a4=[_0xa966('0x61'),_0xa966('0x62'),_0xa966('0x63')];_['remove'](_0x31393d['result']['fields'],function(_0x975dd8){return _0x1599a4[_0xa966('0x64')](_0x975dd8[_0xa966('0x24')][_0xa966('0x20')]);});_[_0xa966('0x65')](_0x31393d[_0xa966('0x5d')][_0xa966('0x2d')],function(_0x486beb){return _0x486beb['editable']===_0xa966('0x66');});return{'count':_0x31393d[_0xa966('0x5d')][_0xa966('0x2d')][_0xa966('0x3d')],'rows':_[_0xa966('0x27')](_0x31393d[_0xa966('0x5d')][_0xa966('0x2d')],function(_0x1d030d){return{'id':_0x1d030d[_0xa966('0x20')],'name':_0x1d030d[_0xa966('0x67')],'custom':_[_0xa966('0x68')](_0x1d030d['name'],'cf_')?!![]:![],'options':_0x1d030d[_0xa966('0x24')]['name']==='picklist'&&_0x1d030d[_0xa966('0x24')][_0xa966('0x69')]['length']>0x0?_[_0xa966('0x27')](_0x1d030d[_0xa966('0x24')][_0xa966('0x69')],function(_0x376617){return{'name':_0x376617[_0xa966('0x67')],'value':_0x376617[_0xa966('0x6a')]};}):[]};})};}})[_0xa966('0x1d')](respondWithResult(_0x5ce71a,null))['catch'](function(_0x4c3e1d){console[_0xa966('0x6b')](_0xa966('0x6c')+_0x4c3e1d);var _0x1d8717=_0x38b042[_0xa966('0x28')][_0xa966('0x6d')]?0x1f4:_0x4c3e1d[_0xa966('0x6e')]||0x1f4;logger['error'](_0xa966('0x6f'),_0xa966('0x4e'),_0x1d8717,JSON[_0xa966('0x70')](_0x4c3e1d));delete _0x4c3e1d[_0xa966('0x20')];if(_0x1d8717===0x191){_0x1d8717=0x190;}_0x5ce71a[_0xa966('0x17')](_0x1d8717)[_0xa966('0x71')](_0x38b042['query']['test']?{'message':_0xa966('0x72'),'statusCode':_0x4c3e1d[_0xa966('0x6e')]}:_0x4c3e1d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3551b74..52d14e5 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 _0x7ef0=['request-promise','path','rimraf','../../config/environment','exports','int_vtiger_accounts','lodash','moment','bluebird'];(function(_0xe605fb,_0x3e3eef){var _0x9a845d=function(_0x3dfd91){while(--_0x3dfd91){_0xe605fb['push'](_0xe605fb['shift']());}};_0x9a845d(++_0x3e3eef);}(_0x7ef0,0xe7));var _0x07ef=function(_0x5ee8af,_0x55d492){_0x5ee8af=_0x5ee8af-0x0;var _0x2c7b53=_0x7ef0[_0x5ee8af];return _0x2c7b53;};'use strict';var _=require(_0x07ef('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x07ef('0x1'));var BPromise=require(_0x07ef('0x2'));var rp=require(_0x07ef('0x3'));var fs=require('fs');var path=require(_0x07ef('0x4'));var rimraf=require(_0x07ef('0x5'));var config=require(_0x07ef('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x07ef('0x7')]=function(_0x21a31b,_0x53b2b5){return _0x21a31b['define']('VtigerAccount',attributes,{'tableName':_0x07ef('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed3=['int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x574841,_0x165eb6){var _0x552118=function(_0x4a3afc){while(--_0x4a3afc){_0x574841['push'](_0x574841['shift']());}};_0x552118(++_0x165eb6);}(_0x0ed3,0xd1));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x30ed('0x0'));var util=require(_0x30ed('0x1'));var logger=require(_0x30ed('0x2'))(_0x30ed('0x3'));var moment=require(_0x30ed('0x4'));var BPromise=require(_0x30ed('0x5'));var rp=require(_0x30ed('0x6'));var fs=require('fs');var path=require(_0x30ed('0x7'));var rimraf=require(_0x30ed('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x30ed('0x9'));module[_0x30ed('0xa')]=function(_0x57bc68,_0x3f9089){return _0x57bc68[_0x30ed('0xb')]('VtigerAccount',attributes,{'tableName':_0x30ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 08d9d52..1a97e96 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 _0x0972=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowVtigerAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x373774,_0xbfdbd0){var _0x3eec03=function(_0x338f3a){while(--_0x338f3a){_0x373774['push'](_0x373774['shift']());}};_0x3eec03(++_0xbfdbd0);}(_0x0972,0x64));var _0x2097=function(_0x377ed8,_0x244c12){_0x377ed8=_0x377ed8-0x0;var _0x4a1f59=_0x0972[_0x377ed8];return _0x4a1f59;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')]({'raw':_0x44c584[_0x2097('0x18')]?_0x44c584[_0x2097('0x18')][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x44c584[_0x2097('0x18')]?_0x44c584['options']['where']||null:null,'attributes':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1a')]||null:null,'limit':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1b')]||null:null,'include':_0x44c584['options']?_0x44c584[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x44c584[_0x2097('0x18')][_0x2097('0x1c')],function(_0x35047b){return{'model':db[_0x35047b['model']],'as':_0x35047b['as'],'attributes':_0x35047b[_0x2097('0x1a')],'include':_0x35047b['include']?_[_0x2097('0x1d')](_0x35047b[_0x2097('0x1c')],function(_0x345875){return{'model':db[_0x345875[_0x2097('0x1e')]],'as':_0x345875['as'],'attributes':_0x345875['attributes'],'include':_0x345875[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x345875['include'],function(_0x1229fc){return{'model':db[_0x1229fc['model']],'as':_0x1229fc['as'],'attributes':_0x1229fc[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc0339){logger[_0x2097('0xc')](_0x2097('0x15'),_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON[_0x2097('0x11')](_0xbc0339));_0x324652(_0xbc0339);})[_0x2097('0x1f')](function(_0x4b443d){logger[_0x2097('0x12')](_0x2097('0x15'),_0x4b443d['message'],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x4b443d[_0x2097('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4d0916){var _0x312c77=this;return new Promise(function(_0x11b051,_0x1649c8){return db[_0x2097('0x16')][_0x2097('0x20')]({'raw':_0x4d0916[_0x2097('0x18')]?_0x4d0916['options'][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0916['options']?_0x4d0916[_0x2097('0x18')][_0x2097('0x21')]||null:null,'attributes':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1a')]||null:null,'include':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x4d0916['options'][_0x2097('0x1c')],function(_0x40baed){return{'model':db[_0x40baed[_0x2097('0x1e')]],'as':_0x40baed['as'],'attributes':_0x40baed['attributes'],'include':_0x40baed[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x40baed[_0x2097('0x1c')],function(_0x396162){return{'model':db[_0x396162['model']],'as':_0x396162['as'],'attributes':_0x396162['attributes'],'include':_0x396162['include']?_[_0x2097('0x1d')](_0x396162[_0x2097('0x1c')],function(_0x4123b7){return{'model':db[_0x4123b7[_0x2097('0x1e')]],'as':_0x4123b7['as'],'attributes':_0x4123b7[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2097('0xb')](function(_0x49b724){logger[_0x2097('0xc')](_0x2097('0x22'),_0x4d0916);logger[_0x2097('0xf')](_0x2097('0x22'),_0x4d0916,JSON[_0x2097('0x11')](_0x49b724));_0x11b051(_0x49b724);})[_0x2097('0x1f')](function(_0x52b937){logger[_0x2097('0x12')](_0x2097('0x22'),_0x52b937[_0x2097('0x14')],_0x4d0916);_0x1649c8(_0x312c77['error'](0x1f4,_0x52b937['message']));});});}; \ No newline at end of file +var _0xf7b4=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x27d409,_0x474e7d){var _0x135c4b=function(_0x29e74d){while(--_0x29e74d){_0x27d409['push'](_0x27d409['shift']());}};_0x135c4b(++_0x474e7d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x383523,_0x262138){_0x383523=_0x383523-0x0;var _0x29c502=_0xf7b4[_0x383523];return _0x29c502;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetVtigerAccount']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6f3175d..02d4459 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 _0x7569=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer'];(function(_0xd70344,_0x304eac){var _0x338d4b=function(_0x4d42a8){while(--_0x4d42a8){_0xd70344['push'](_0xd70344['shift']());}};_0x338d4b(++_0x304eac);}(_0x7569,0x1e3));var _0x9756=function(_0x57f49d,_0x48fc4a){_0x57f49d=_0x57f49d-0x0;var _0x5ab7be=_0x7569[_0x57f49d];return _0x5ab7be;};'use strict';var multer=require(_0x9756('0x0'));var util=require(_0x9756('0x1'));var path=require(_0x9756('0x2'));var timeout=require(_0x9756('0x3'));var express=require('express');var router=express[_0x9756('0x4')]();var fs_extra=require(_0x9756('0x5'));var auth=require(_0x9756('0x6'));var interaction=require(_0x9756('0x7'));var config=require(_0x9756('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x9756('0x9')]('/',auth[_0x9756('0xa')](),controller['index']);router[_0x9756('0x9')](_0x9756('0xb'),auth[_0x9756('0xa')](),controller[_0x9756('0xc')]);router['get'](_0x9756('0xd'),auth[_0x9756('0xa')](),controller['getFields']);router['get'](_0x9756('0xe'),auth[_0x9756('0xa')](),controller['getSubjects']);router['get'](_0x9756('0xf'),auth[_0x9756('0xa')](),controller['getDescriptions']);router[_0x9756('0x10')]('/',auth[_0x9756('0xa')](),controller['create']);router[_0x9756('0x11')]('/:id',auth[_0x9756('0xa')](),controller[_0x9756('0x12')]);router[_0x9756('0x13')](_0x9756('0xb'),auth[_0x9756('0xa')](),controller[_0x9756('0x14')]);module[_0x9756('0x15')]=router; \ No newline at end of file +var _0x4df3=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4df3,0x178));var _0x34df=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x4df3[_0x1fa759];return _0x2da9f4;};'use strict';var multer=require(_0x34df('0x0'));var util=require(_0x34df('0x1'));var path=require(_0x34df('0x2'));var timeout=require('connect-timeout');var express=require(_0x34df('0x3'));var router=express[_0x34df('0x4')]();var fs_extra=require(_0x34df('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x34df('0x6'));var controller=require(_0x34df('0x7'));router[_0x34df('0x8')]('/',auth[_0x34df('0x9')](),controller[_0x34df('0xa')]);router['get'](_0x34df('0xb'),auth[_0x34df('0x9')](),controller[_0x34df('0xc')]);router[_0x34df('0x8')](_0x34df('0xd'),auth['isAuthenticated'](),controller[_0x34df('0xe')]);router[_0x34df('0x8')](_0x34df('0xf'),auth['isAuthenticated'](),controller[_0x34df('0x10')]);router[_0x34df('0x8')](_0x34df('0x11'),auth[_0x34df('0x9')](),controller[_0x34df('0x12')]);router[_0x34df('0x13')]('/',auth['isAuthenticated'](),controller[_0x34df('0x14')]);router[_0x34df('0x15')](_0x34df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x34df('0x16')](_0x34df('0xb'),auth[_0x34df('0x9')](),controller[_0x34df('0x17')]);module[_0x34df('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c204770..83656c1 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 _0x42fb=['STRING','exports'];(function(_0x25d023,_0x5169dd){var _0x49a679=function(_0x28eff9){while(--_0x28eff9){_0x25d023['push'](_0x25d023['shift']());}};_0x49a679(++_0x5169dd);}(_0x42fb,0xd5));var _0xb42f=function(_0x404e3b,_0x2696cb){_0x404e3b=_0x404e3b-0x0;var _0x4d87f9=_0x42fb[_0x404e3b];return _0x4d87f9;};'use strict';var Sequelize=require('sequelize');module[_0xb42f('0x0')]={'name':{'type':Sequelize[_0xb42f('0x1')]},'description':{'type':Sequelize[_0xb42f('0x1')]}}; \ No newline at end of file +var _0xf699=['exports','STRING','sequelize'];(function(_0x5a2d6c,_0x4cb424){var _0x9341ed=function(_0x58b5b1){while(--_0x58b5b1){_0x5a2d6c['push'](_0x5a2d6c['shift']());}};_0x9341ed(++_0x4cb424);}(_0xf699,0x146));var _0x9f69=function(_0x567ab9,_0x240ddd){_0x567ab9=_0x567ab9-0x0;var _0xe262ee=_0xf699[_0x567ab9];return _0xe262ee;};'use strict';var Sequelize=require(_0x9f69('0x0'));module[_0x9f69('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f69('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 097b382..23aeba5 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 _0x7b5b=['include','findAll','rows','catch','length','includeAll','options','find','create','body','params','getFields','findOne','pick','hasOwnProperty','getSubjects','VtigerField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x25cb3c,_0x2ad079){_0x25cb3c=_0x25cb3c-0x0;var _0x4a31ae=_0x7b5b[_0x25cb3c];return _0x4a31ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7b5('0x0'));var zipdir=require(_0xb7b5('0x1'));var jsonpatch=require(_0xb7b5('0x2'));var rp=require(_0xb7b5('0x3'));var moment=require(_0xb7b5('0x4'));var BPromise=require(_0xb7b5('0x5'));var Mustache=require(_0xb7b5('0x6'));var util=require(_0xb7b5('0x7'));var path=require(_0xb7b5('0x8'));var sox=require(_0xb7b5('0x9'));var csv=require(_0xb7b5('0xa'));var ejs=require(_0xb7b5('0xb'));var fs=require('fs');var fs_extra=require(_0xb7b5('0xc'));var _=require(_0xb7b5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb7b5('0xe'));var deskjs=require(_0xb7b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7b5('0x10'));var Redis=require(_0xb7b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb7b5('0x12'));var as=require(_0xb7b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb7b5('0x14'));var utils=require(_0xb7b5('0x15'));var config=require(_0xb7b5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7b5('0x17'))['db'];function respondWithStatusCode(_0x23296b,_0x597282){_0x597282=_0x597282||0xcc;return function(_0x566bc8){if(_0x566bc8){return _0x23296b[_0xb7b5('0x18')](_0x597282);}return _0x23296b[_0xb7b5('0x19')](_0x597282)[_0xb7b5('0x1a')]();};}function respondWithResult(_0x74562f,_0x423cc5){_0x423cc5=_0x423cc5||0xc8;return function(_0x1e23ba){if(_0x1e23ba){return _0x74562f[_0xb7b5('0x19')](_0x423cc5)[_0xb7b5('0x1b')](_0x1e23ba);}};}function respondWithFilteredResult(_0x5d9bba,_0x5bf6c2){return function(_0x2d09f7){if(_0x2d09f7){var _0x5def9e=typeof _0x5bf6c2[_0xb7b5('0x1c')]==='undefined'&&typeof _0x5bf6c2[_0xb7b5('0x1d')]==='undefined';var _0x55f17a=_0x2d09f7[_0xb7b5('0x1e')];var _0x14ff87=_0x5def9e?0x0:_0x5bf6c2[_0xb7b5('0x1c')];var _0x189dcc=_0x5def9e?_0x2d09f7['count']:_0x5bf6c2['offset']+_0x5bf6c2[_0xb7b5('0x1d')];var _0x460042;if(_0x189dcc>=_0x55f17a){_0x189dcc=_0x55f17a;_0x460042=0xc8;}else{_0x460042=0xce;}_0x5d9bba[_0xb7b5('0x19')](_0x460042);return _0x5d9bba['set'](_0xb7b5('0x1f'),_0x14ff87+'-'+_0x189dcc+'/'+_0x55f17a)['json'](_0x2d09f7);}return null;};}function patchUpdates(_0x716b32){return function(_0x8fefa4){try{jsonpatch['apply'](_0x8fefa4,_0x716b32,!![]);}catch(_0xd11b80){return BPromise[_0xb7b5('0x20')](_0xd11b80);}return _0x8fefa4[_0xb7b5('0x21')]();};}function saveUpdates(_0x3487b5,_0x1f18d0){return function(_0x55221b){if(_0x55221b){return _0x55221b[_0xb7b5('0x22')](_0x3487b5)[_0xb7b5('0x23')](function(_0x22a073){return _0x22a073;});}return null;};}function removeEntity(_0x33b321,_0x365629){return function(_0xb11413){if(_0xb11413){return _0xb11413[_0xb7b5('0x24')]()[_0xb7b5('0x23')](function(){_0x33b321[_0xb7b5('0x19')](0xcc)[_0xb7b5('0x1a')]();});}};}function handleEntityNotFound(_0x5e6f41,_0x4f0ef3){return function(_0x52c97d){if(!_0x52c97d){_0x5e6f41['sendStatus'](0x194);}return _0x52c97d;};}function handleError(_0x507f58,_0x1c54c5){_0x1c54c5=_0x1c54c5||0x1f4;return function(_0xea59f9){logger['error'](_0xea59f9[_0xb7b5('0x25')]);if(_0xea59f9[_0xb7b5('0x26')]){delete _0xea59f9[_0xb7b5('0x26')];}_0x507f58['status'](_0x1c54c5)[_0xb7b5('0x27')](_0xea59f9);};}exports[_0xb7b5('0x28')]=function(_0x5d2193,_0x2bae4d){var _0x4262a5={},_0x331ee8={},_0x51532f={'count':0x0,'rows':[]};var _0x276d76=_[_0xb7b5('0x29')](db[_0xb7b5('0x2a')][_0xb7b5('0x2b')],function(_0x6f9bfd){return{'name':_0x6f9bfd['fieldName'],'type':_0x6f9bfd[_0xb7b5('0x2c')][_0xb7b5('0x2d')]};});_0x331ee8[_0xb7b5('0x2e')]=_[_0xb7b5('0x29')](_0x276d76,'name');_0x331ee8['query']=_[_0xb7b5('0x2f')](_0x5d2193[_0xb7b5('0x30')]);_0x331ee8['filters']=_[_0xb7b5('0x31')](_0x331ee8[_0xb7b5('0x2e')],_0x331ee8['query']);_0x4262a5[_0xb7b5('0x32')]=_[_0xb7b5('0x31')](_0x331ee8['model'],qs['fields'](_0x5d2193[_0xb7b5('0x30')][_0xb7b5('0x33')]));_0x4262a5[_0xb7b5('0x32')]=_0x4262a5['attributes']['length']?_0x4262a5['attributes']:_0x331ee8[_0xb7b5('0x2e')];if(!_0x5d2193[_0xb7b5('0x30')]['hasOwnProperty'](_0xb7b5('0x34'))){_0x4262a5['limit']=qs[_0xb7b5('0x1d')](_0x5d2193[_0xb7b5('0x30')][_0xb7b5('0x1d')]);_0x4262a5[_0xb7b5('0x1c')]=qs[_0xb7b5('0x1c')](_0x5d2193[_0xb7b5('0x30')][_0xb7b5('0x1c')]);}_0x4262a5[_0xb7b5('0x35')]=qs[_0xb7b5('0x36')](_0x5d2193[_0xb7b5('0x30')][_0xb7b5('0x36')]);_0x4262a5[_0xb7b5('0x37')]=qs[_0xb7b5('0x38')](_['pick'](_0x5d2193['query'],_0x331ee8[_0xb7b5('0x38')]),_0x276d76);if(_0x5d2193['query']['filter']){_0x4262a5[_0xb7b5('0x37')]=_[_0xb7b5('0x39')](_0x4262a5[_0xb7b5('0x37')],{'$or':_[_0xb7b5('0x29')](_0x276d76,function(_0x5ec456){if(_0x5ec456[_0xb7b5('0x2c')]!==_0xb7b5('0x3a')){var _0x53fb46={};_0x53fb46[_0x5ec456[_0xb7b5('0x26')]]={'$like':'%'+_0x5d2193['query'][_0xb7b5('0x3b')]+'%'};return _0x53fb46;}})});}_0x4262a5=_[_0xb7b5('0x39')]({},_0x4262a5,_0x5d2193['options']);var _0x5894eb={'where':_0x4262a5['where']};return db[_0xb7b5('0x2a')][_0xb7b5('0x1e')](_0x5894eb)[_0xb7b5('0x23')](function(_0x309427){_0x51532f[_0xb7b5('0x1e')]=_0x309427;if(_0x5d2193[_0xb7b5('0x30')]['includeAll']){_0x4262a5[_0xb7b5('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xb7b5('0x3d')](_0x4262a5);})[_0xb7b5('0x23')](function(_0x26d58c){_0x51532f[_0xb7b5('0x3e')]=_0x26d58c;return _0x51532f;})[_0xb7b5('0x23')](respondWithFilteredResult(_0x2bae4d,_0x4262a5))[_0xb7b5('0x3f')](handleError(_0x2bae4d,null));};exports['show']=function(_0x8f7345,_0x1ca9d0){var _0x21f1b0={'raw':![],'where':{'id':_0x8f7345['params']['id']}},_0x3d7b0a={};_0x3d7b0a[_0xb7b5('0x2e')]=_[_0xb7b5('0x2f')](db['VtigerConfiguration'][_0xb7b5('0x2b')]);_0x3d7b0a[_0xb7b5('0x30')]=_[_0xb7b5('0x2f')](_0x8f7345[_0xb7b5('0x30')]);_0x3d7b0a[_0xb7b5('0x38')]=_[_0xb7b5('0x31')](_0x3d7b0a[_0xb7b5('0x2e')],_0x3d7b0a[_0xb7b5('0x30')]);_0x21f1b0['attributes']=_[_0xb7b5('0x31')](_0x3d7b0a['model'],qs[_0xb7b5('0x33')](_0x8f7345[_0xb7b5('0x30')][_0xb7b5('0x33')]));_0x21f1b0[_0xb7b5('0x32')]=_0x21f1b0['attributes'][_0xb7b5('0x40')]?_0x21f1b0[_0xb7b5('0x32')]:_0x3d7b0a['model'];if(_0x8f7345[_0xb7b5('0x30')][_0xb7b5('0x41')]){_0x21f1b0['include']=[{'all':!![]}];}_0x21f1b0=_['merge']({},_0x21f1b0,_0x8f7345[_0xb7b5('0x42')]);return db[_0xb7b5('0x2a')][_0xb7b5('0x43')](_0x21f1b0)['then'](handleEntityNotFound(_0x1ca9d0,null))[_0xb7b5('0x23')](respondWithResult(_0x1ca9d0,null))['catch'](handleError(_0x1ca9d0,null));};exports[_0xb7b5('0x44')]=function(_0x2480d4,_0x2342ed){return db['VtigerConfiguration'][_0xb7b5('0x44')](_0x2480d4[_0xb7b5('0x45')],{})[_0xb7b5('0x23')](respondWithResult(_0x2342ed,0xc9))[_0xb7b5('0x3f')](handleError(_0x2342ed,null));};exports['update']=function(_0x5ec3c6,_0x26fe1a){if(_0x5ec3c6[_0xb7b5('0x45')]['id']){delete _0x5ec3c6[_0xb7b5('0x45')]['id'];}return db[_0xb7b5('0x2a')][_0xb7b5('0x43')]({'where':{'id':_0x5ec3c6[_0xb7b5('0x46')]['id']}})[_0xb7b5('0x23')](handleEntityNotFound(_0x26fe1a,null))[_0xb7b5('0x23')](saveUpdates(_0x5ec3c6[_0xb7b5('0x45')],null))[_0xb7b5('0x23')](respondWithResult(_0x26fe1a,null))[_0xb7b5('0x3f')](handleError(_0x26fe1a,null));};exports[_0xb7b5('0x24')]=function(_0x1a6a7d,_0x3703ef){return db[_0xb7b5('0x2a')]['find']({'where':{'id':_0x1a6a7d[_0xb7b5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3703ef,null))[_0xb7b5('0x23')](removeEntity(_0x3703ef,null))[_0xb7b5('0x3f')](handleError(_0x3703ef,null));};exports[_0xb7b5('0x47')]=function(_0x5465f3,_0xadce1e,_0x52c32a){var _0x5b71c7={};var _0x2469c5={};var _0x421aef;var _0x4d0313;return db[_0xb7b5('0x2a')][_0xb7b5('0x48')]({'where':{'id':_0x5465f3['params']['id']}})[_0xb7b5('0x23')](handleEntityNotFound(_0xadce1e,null))[_0xb7b5('0x23')](function(_0x4cc58f){if(_0x4cc58f){_0x421aef=_0x4cc58f;_0x2469c5['model']=_['keys'](db['VtigerField'][_0xb7b5('0x2b')]);_0x2469c5['query']=_[_0xb7b5('0x2f')](_0x5465f3[_0xb7b5('0x30')]);_0x2469c5[_0xb7b5('0x38')]=_['intersection'](_0x2469c5[_0xb7b5('0x2e')],_0x2469c5[_0xb7b5('0x30')]);_0x5b71c7[_0xb7b5('0x32')]=_[_0xb7b5('0x31')](_0x2469c5[_0xb7b5('0x2e')],qs['fields'](_0x5465f3[_0xb7b5('0x30')][_0xb7b5('0x33')]));_0x5b71c7[_0xb7b5('0x32')]=_0x5b71c7[_0xb7b5('0x32')][_0xb7b5('0x40')]?_0x5b71c7[_0xb7b5('0x32')]:_0x2469c5['model'];_0x5b71c7['order']=qs[_0xb7b5('0x36')](_0x5465f3[_0xb7b5('0x30')]['sort']);_0x5b71c7[_0xb7b5('0x37')]=qs[_0xb7b5('0x38')](_[_0xb7b5('0x49')](_0x5465f3[_0xb7b5('0x30')],_0x2469c5[_0xb7b5('0x38')]));if(_0x5465f3[_0xb7b5('0x30')]['filter']){_0x5b71c7['where']=_['merge'](_0x5b71c7[_0xb7b5('0x37')],{'$or':_[_0xb7b5('0x29')](_0x5b71c7[_0xb7b5('0x32')],function(_0x4bbc38){var _0x2cb2d4={};_0x2cb2d4[_0x4bbc38]={'$like':'%'+_0x5465f3['query'][_0xb7b5('0x3b')]+'%'};return _0x2cb2d4;})});}_0x5b71c7=_[_0xb7b5('0x39')]({},_0x5b71c7,_0x5465f3['options']);return _0x421aef['getFields'](_0x5b71c7);}})[_0xb7b5('0x23')](function(_0x44c808){if(_0x44c808){_0x4d0313=_0x44c808['length'];if(!_0x5465f3[_0xb7b5('0x30')][_0xb7b5('0x4a')](_0xb7b5('0x34'))){_0x5b71c7[_0xb7b5('0x1d')]=qs[_0xb7b5('0x1d')](_0x5465f3['query']['limit']);_0x5b71c7[_0xb7b5('0x1c')]=qs[_0xb7b5('0x1c')](_0x5465f3[_0xb7b5('0x30')][_0xb7b5('0x1c')]);}return _0x421aef[_0xb7b5('0x47')](_0x5b71c7);}})[_0xb7b5('0x23')](function(_0x421c5b){if(_0x421c5b){return _0x421c5b?{'count':_0x4d0313,'rows':_0x421c5b}:null;}})[_0xb7b5('0x23')](respondWithResult(_0xadce1e,null))['catch'](handleError(_0xadce1e,null));};exports[_0xb7b5('0x4b')]=function(_0x431f5c,_0x1bf28a,_0x5c6d58){var _0x5e2399={};var _0x5941f7={};var _0x30667a;var _0x15582e;return db[_0xb7b5('0x2a')][_0xb7b5('0x48')]({'where':{'id':_0x431f5c[_0xb7b5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bf28a,null))[_0xb7b5('0x23')](function(_0x378ac5){if(_0x378ac5){_0x30667a=_0x378ac5;_0x5941f7[_0xb7b5('0x2e')]=_[_0xb7b5('0x2f')](db[_0xb7b5('0x4c')]['rawAttributes']);_0x5941f7[_0xb7b5('0x30')]=_['keys'](_0x431f5c[_0xb7b5('0x30')]);_0x5941f7[_0xb7b5('0x38')]=_[_0xb7b5('0x31')](_0x5941f7[_0xb7b5('0x2e')],_0x5941f7[_0xb7b5('0x30')]);_0x5e2399['attributes']=_[_0xb7b5('0x31')](_0x5941f7['model'],qs[_0xb7b5('0x33')](_0x431f5c[_0xb7b5('0x30')][_0xb7b5('0x33')]));_0x5e2399['attributes']=_0x5e2399[_0xb7b5('0x32')]['length']?_0x5e2399[_0xb7b5('0x32')]:_0x5941f7[_0xb7b5('0x2e')];_0x5e2399[_0xb7b5('0x35')]=qs[_0xb7b5('0x36')](_0x431f5c[_0xb7b5('0x30')][_0xb7b5('0x36')]);_0x5e2399[_0xb7b5('0x37')]=qs['filters'](_[_0xb7b5('0x49')](_0x431f5c[_0xb7b5('0x30')],_0x5941f7['filters']));if(_0x431f5c[_0xb7b5('0x30')][_0xb7b5('0x3b')]){_0x5e2399['where']=_[_0xb7b5('0x39')](_0x5e2399['where'],{'$or':_[_0xb7b5('0x29')](_0x5e2399[_0xb7b5('0x32')],function(_0x4da93b){var _0xb8fa4c={};_0xb8fa4c[_0x4da93b]={'$like':'%'+_0x431f5c[_0xb7b5('0x30')][_0xb7b5('0x3b')]+'%'};return _0xb8fa4c;})});}_0x5e2399=_[_0xb7b5('0x39')]({},_0x5e2399,_0x431f5c[_0xb7b5('0x42')]);return _0x30667a[_0xb7b5('0x4b')](_0x5e2399);}})['then'](function(_0x192b15){if(_0x192b15){_0x15582e=_0x192b15[_0xb7b5('0x40')];if(!_0x431f5c[_0xb7b5('0x30')][_0xb7b5('0x4a')]('nolimit')){_0x5e2399['limit']=qs['limit'](_0x431f5c[_0xb7b5('0x30')]['limit']);_0x5e2399[_0xb7b5('0x1c')]=qs['offset'](_0x431f5c[_0xb7b5('0x30')][_0xb7b5('0x1c')]);}return _0x30667a[_0xb7b5('0x4b')](_0x5e2399);}})['then'](function(_0x3dc8b7){if(_0x3dc8b7){return _0x3dc8b7?{'count':_0x15582e,'rows':_0x3dc8b7}:null;}})['then'](respondWithResult(_0x1bf28a,null))[_0xb7b5('0x3f')](handleError(_0x1bf28a,null));};exports[_0xb7b5('0x4d')]=function(_0x4f4d4d,_0x436731,_0x725912){var _0x531534={};var _0x244892={};var _0x6c2354;var _0x43b45d;return db['VtigerConfiguration'][_0xb7b5('0x48')]({'where':{'id':_0x4f4d4d[_0xb7b5('0x46')]['id']}})['then'](handleEntityNotFound(_0x436731,null))[_0xb7b5('0x23')](function(_0x556981){if(_0x556981){_0x6c2354=_0x556981;_0x244892[_0xb7b5('0x2e')]=_['keys'](db['VtigerField'][_0xb7b5('0x2b')]);_0x244892[_0xb7b5('0x30')]=_[_0xb7b5('0x2f')](_0x4f4d4d[_0xb7b5('0x30')]);_0x244892[_0xb7b5('0x38')]=_[_0xb7b5('0x31')](_0x244892[_0xb7b5('0x2e')],_0x244892[_0xb7b5('0x30')]);_0x531534[_0xb7b5('0x32')]=_[_0xb7b5('0x31')](_0x244892[_0xb7b5('0x2e')],qs['fields'](_0x4f4d4d['query']['fields']));_0x531534['attributes']=_0x531534[_0xb7b5('0x32')][_0xb7b5('0x40')]?_0x531534['attributes']:_0x244892[_0xb7b5('0x2e')];_0x531534[_0xb7b5('0x35')]=qs['sort'](_0x4f4d4d[_0xb7b5('0x30')][_0xb7b5('0x36')]);_0x531534[_0xb7b5('0x37')]=qs['filters'](_[_0xb7b5('0x49')](_0x4f4d4d['query'],_0x244892[_0xb7b5('0x38')]));if(_0x4f4d4d[_0xb7b5('0x30')]['filter']){_0x531534[_0xb7b5('0x37')]=_[_0xb7b5('0x39')](_0x531534[_0xb7b5('0x37')],{'$or':_['map'](_0x531534['attributes'],function(_0x2c1bd7){var _0x5c90a6={};_0x5c90a6[_0x2c1bd7]={'$like':'%'+_0x4f4d4d[_0xb7b5('0x30')][_0xb7b5('0x3b')]+'%'};return _0x5c90a6;})});}_0x531534=_[_0xb7b5('0x39')]({},_0x531534,_0x4f4d4d[_0xb7b5('0x42')]);return _0x6c2354[_0xb7b5('0x4d')](_0x531534);}})[_0xb7b5('0x23')](function(_0x4e80be){if(_0x4e80be){_0x43b45d=_0x4e80be['length'];if(!_0x4f4d4d[_0xb7b5('0x30')][_0xb7b5('0x4a')](_0xb7b5('0x34'))){_0x531534['limit']=qs[_0xb7b5('0x1d')](_0x4f4d4d[_0xb7b5('0x30')][_0xb7b5('0x1d')]);_0x531534['offset']=qs['offset'](_0x4f4d4d[_0xb7b5('0x30')][_0xb7b5('0x1c')]);}return _0x6c2354['getDescriptions'](_0x531534);}})[_0xb7b5('0x23')](function(_0xb2b934){if(_0xb2b934){return _0xb2b934?{'count':_0x43b45d,'rows':_0xb2b934}:null;}})[_0xb7b5('0x23')](respondWithResult(_0x436731,null))['catch'](handleError(_0x436731,null));}; \ No newline at end of file +var _0x1cc7=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','getFields','findOne','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1cc7,0x15a));var _0x71cc=function(_0x463949,_0x215920){_0x463949=_0x463949-0x0;var _0x28292d=_0x1cc7[_0x463949];return _0x28292d;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));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(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){_0x1a9b4f[_0x71cc('0x13')](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x180cd2,_0x36367b){return function(_0x5fa323){if(!_0x5fa323){_0x180cd2[_0x71cc('0x20')](0x194);}return _0x5fa323;};}function handleError(_0x42e6ec,_0xbce208){_0xbce208=_0xbce208||0x1f4;return function(_0x4d4529){logger[_0x71cc('0x21')](_0x4d4529[_0x71cc('0x22')]);if(_0x4d4529[_0x71cc('0x23')]){delete _0x4d4529[_0x71cc('0x23')];}_0x42e6ec[_0x71cc('0x13')](_0xbce208)[_0x71cc('0x24')](_0x4d4529);};}exports[_0x71cc('0x25')]=function(_0x9a7ca3,_0x3cc813){var _0x1fc046={},_0x30f94d={},_0x35f723={'count':0x0,'rows':[]};var _0x1d5805=_[_0x71cc('0x26')](db[_0x71cc('0x27')][_0x71cc('0x28')],function(_0x4fa63e){return{'name':_0x4fa63e[_0x71cc('0x29')],'type':_0x4fa63e[_0x71cc('0x2a')][_0x71cc('0x2b')]};});_0x30f94d[_0x71cc('0x2c')]=_[_0x71cc('0x26')](_0x1d5805,_0x71cc('0x23'));_0x30f94d['query']=_[_0x71cc('0x2d')](_0x9a7ca3[_0x71cc('0x2e')]);_0x30f94d[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x30f94d[_0x71cc('0x2c')],_0x30f94d[_0x71cc('0x2e')]);_0x1fc046[_0x71cc('0x31')]=_['intersection'](_0x30f94d[_0x71cc('0x2c')],qs['fields'](_0x9a7ca3['query'][_0x71cc('0x32')]));_0x1fc046['attributes']=_0x1fc046['attributes'][_0x71cc('0x33')]?_0x1fc046['attributes']:_0x30f94d[_0x71cc('0x2c')];if(!_0x9a7ca3['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x1fc046['limit']=qs[_0x71cc('0x19')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1fc046[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x16')]);}_0x1fc046[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x9a7ca3[_0x71cc('0x2e')]['sort']);_0x1fc046[_0x71cc('0x38')]=qs['filters'](_[_0x71cc('0x39')](_0x9a7ca3[_0x71cc('0x2e')],_0x30f94d[_0x71cc('0x2f')]),_0x1d5805);if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x1fc046[_0x71cc('0x38')]=_['merge'](_0x1fc046[_0x71cc('0x38')],{'$or':_['map'](_0x1d5805,function(_0x468b4b){if(_0x468b4b[_0x71cc('0x2a')]!==_0x71cc('0x3b')){var _0x487e13={};_0x487e13[_0x468b4b[_0x71cc('0x23')]]={'$like':'%'+_0x9a7ca3['query'][_0x71cc('0x3a')]+'%'};return _0x487e13;}})});}_0x1fc046=_[_0x71cc('0x3c')]({},_0x1fc046,_0x9a7ca3[_0x71cc('0x3d')]);var _0x92389={'where':_0x1fc046[_0x71cc('0x38')]};return db[_0x71cc('0x27')][_0x71cc('0x18')](_0x92389)[_0x71cc('0x1f')](function(_0x3c3fae){_0x35f723[_0x71cc('0x18')]=_0x3c3fae;if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x1fc046['include']=[{'all':!![]}];}return db[_0x71cc('0x27')][_0x71cc('0x3f')](_0x1fc046);})['then'](function(_0x54fc85){_0x35f723[_0x71cc('0x40')]=_0x54fc85;return _0x35f723;})[_0x71cc('0x1f')](respondWithFilteredResult(_0x3cc813,_0x1fc046))['catch'](handleError(_0x3cc813,null));};exports[_0x71cc('0x41')]=function(_0x3b9eec,_0x2fbe5e){var _0x19d7c8={'raw':![],'where':{'id':_0x3b9eec['params']['id']}},_0x21ef21={};_0x21ef21['model']=_['keys'](db[_0x71cc('0x27')]['rawAttributes']);_0x21ef21[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x3b9eec[_0x71cc('0x2e')]);_0x21ef21[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],_0x21ef21[_0x71cc('0x2e')]);_0x19d7c8[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x19d7c8['attributes']=_0x19d7c8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x19d7c8[_0x71cc('0x31')]:_0x21ef21['model'];if(_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x19d7c8[_0x71cc('0x42')]=[{'all':!![]}];}_0x19d7c8=_[_0x71cc('0x3c')]({},_0x19d7c8,_0x3b9eec[_0x71cc('0x3d')]);return db[_0x71cc('0x27')][_0x71cc('0x43')](_0x19d7c8)[_0x71cc('0x1f')](handleEntityNotFound(_0x2fbe5e,null))[_0x71cc('0x1f')](respondWithResult(_0x2fbe5e,null))[_0x71cc('0x44')](handleError(_0x2fbe5e,null));};exports[_0x71cc('0x45')]=function(_0xbb951c,_0x47cefc){return db[_0x71cc('0x27')][_0x71cc('0x45')](_0xbb951c[_0x71cc('0x46')],{})[_0x71cc('0x1f')](respondWithResult(_0x47cefc,0xc9))[_0x71cc('0x44')](handleError(_0x47cefc,null));};exports[_0x71cc('0x1e')]=function(_0x430387,_0x51cd49){if(_0x430387[_0x71cc('0x46')]['id']){delete _0x430387[_0x71cc('0x46')]['id'];}return db['VtigerConfiguration'][_0x71cc('0x43')]({'where':{'id':_0x430387[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x51cd49,null))[_0x71cc('0x1f')](saveUpdates(_0x430387[_0x71cc('0x46')],null))[_0x71cc('0x1f')](respondWithResult(_0x51cd49,null))[_0x71cc('0x44')](handleError(_0x51cd49,null));};exports[_0x71cc('0x48')]=function(_0x3cf0bf,_0x1647ce){return db[_0x71cc('0x27')]['find']({'where':{'id':_0x3cf0bf[_0x71cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1647ce,null))[_0x71cc('0x1f')](removeEntity(_0x1647ce,null))['catch'](handleError(_0x1647ce,null));};exports[_0x71cc('0x49')]=function(_0x36c71e,_0x5c9ac5,_0x2cac03){var _0x3d0f9f={};var _0x5c88a3={};var _0x3edacf;var _0x1c311b;return db[_0x71cc('0x27')][_0x71cc('0x4a')]({'where':{'id':_0x36c71e[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x5c9ac5,null))[_0x71cc('0x1f')](function(_0x5236c0){if(_0x5236c0){_0x3edacf=_0x5236c0;_0x5c88a3[_0x71cc('0x2c')]=_[_0x71cc('0x2d')](db['VtigerField']['rawAttributes']);_0x5c88a3[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x36c71e['query']);_0x5c88a3[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x5c88a3[_0x71cc('0x2c')],_0x5c88a3[_0x71cc('0x2e')]);_0x3d0f9f[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x5c88a3['model'],qs['fields'](_0x36c71e[_0x71cc('0x2e')]['fields']));_0x3d0f9f['attributes']=_0x3d0f9f[_0x71cc('0x31')]['length']?_0x3d0f9f['attributes']:_0x5c88a3['model'];_0x3d0f9f['order']=qs['sort'](_0x36c71e[_0x71cc('0x2e')]['sort']);_0x3d0f9f['where']=qs[_0x71cc('0x2f')](_[_0x71cc('0x39')](_0x36c71e[_0x71cc('0x2e')],_0x5c88a3[_0x71cc('0x2f')]));if(_0x36c71e[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x3d0f9f['where']=_['merge'](_0x3d0f9f['where'],{'$or':_[_0x71cc('0x26')](_0x3d0f9f[_0x71cc('0x31')],function(_0x4078a8){var _0x18811b={};_0x18811b[_0x4078a8]={'$like':'%'+_0x36c71e[_0x71cc('0x2e')]['filter']+'%'};return _0x18811b;})});}_0x3d0f9f=_[_0x71cc('0x3c')]({},_0x3d0f9f,_0x36c71e[_0x71cc('0x3d')]);return _0x3edacf['getFields'](_0x3d0f9f);}})['then'](function(_0x349d62){if(_0x349d62){_0x1c311b=_0x349d62[_0x71cc('0x33')];if(!_0x36c71e['query']['hasOwnProperty'](_0x71cc('0x35'))){_0x3d0f9f['limit']=qs['limit'](_0x36c71e[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x3d0f9f[_0x71cc('0x16')]=qs['offset'](_0x36c71e[_0x71cc('0x2e')][_0x71cc('0x16')]);}return _0x3edacf[_0x71cc('0x49')](_0x3d0f9f);}})['then'](function(_0x56c295){if(_0x56c295){return _0x56c295?{'count':_0x1c311b,'rows':_0x56c295}:null;}})['then'](respondWithResult(_0x5c9ac5,null))[_0x71cc('0x44')](handleError(_0x5c9ac5,null));};exports[_0x71cc('0x4b')]=function(_0x4092f7,_0xf1301,_0xaa5aca){var _0x184e30={};var _0x515d18={};var _0x48b10c;var _0x3cf283;return db[_0x71cc('0x27')][_0x71cc('0x4a')]({'where':{'id':_0x4092f7[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0xf1301,null))[_0x71cc('0x1f')](function(_0x1f8649){if(_0x1f8649){_0x48b10c=_0x1f8649;_0x515d18[_0x71cc('0x2c')]=_[_0x71cc('0x2d')](db[_0x71cc('0x4c')]['rawAttributes']);_0x515d18['query']=_[_0x71cc('0x2d')](_0x4092f7[_0x71cc('0x2e')]);_0x515d18[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x515d18[_0x71cc('0x2c')],_0x515d18[_0x71cc('0x2e')]);_0x184e30[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x515d18[_0x71cc('0x2c')],qs['fields'](_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x184e30[_0x71cc('0x31')]=_0x184e30[_0x71cc('0x31')]['length']?_0x184e30['attributes']:_0x515d18[_0x71cc('0x2c')];_0x184e30[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x37')]);_0x184e30['where']=qs['filters'](_[_0x71cc('0x39')](_0x4092f7[_0x71cc('0x2e')],_0x515d18['filters']));if(_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x184e30[_0x71cc('0x38')]=_[_0x71cc('0x3c')](_0x184e30['where'],{'$or':_['map'](_0x184e30['attributes'],function(_0x2afcda){var _0x39cf93={};_0x39cf93[_0x2afcda]={'$like':'%'+_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x3a')]+'%'};return _0x39cf93;})});}_0x184e30=_[_0x71cc('0x3c')]({},_0x184e30,_0x4092f7[_0x71cc('0x3d')]);return _0x48b10c[_0x71cc('0x4b')](_0x184e30);}})[_0x71cc('0x1f')](function(_0x24a072){if(_0x24a072){_0x3cf283=_0x24a072[_0x71cc('0x33')];if(!_0x4092f7['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x184e30[_0x71cc('0x19')]=qs[_0x71cc('0x19')](_0x4092f7['query']['limit']);_0x184e30[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x16')]);}return _0x48b10c[_0x71cc('0x4b')](_0x184e30);}})[_0x71cc('0x1f')](function(_0x482e21){if(_0x482e21){return _0x482e21?{'count':_0x3cf283,'rows':_0x482e21}:null;}})[_0x71cc('0x1f')](respondWithResult(_0xf1301,null))[_0x71cc('0x44')](handleError(_0xf1301,null));};exports['getDescriptions']=function(_0x508b82,_0x3d4edf,_0x350f34){var _0x1c18f8={};var _0x141a4e={};var _0x48d807;var _0x5a6b22;return db['VtigerConfiguration'][_0x71cc('0x4a')]({'where':{'id':_0x508b82['params']['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x3d4edf,null))[_0x71cc('0x1f')](function(_0x5d23c9){if(_0x5d23c9){_0x48d807=_0x5d23c9;_0x141a4e['model']=_[_0x71cc('0x2d')](db[_0x71cc('0x4c')][_0x71cc('0x28')]);_0x141a4e[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x508b82[_0x71cc('0x2e')]);_0x141a4e[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x141a4e[_0x71cc('0x2c')],_0x141a4e['query']);_0x1c18f8['attributes']=_[_0x71cc('0x30')](_0x141a4e[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x508b82[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x1c18f8['attributes']=_0x1c18f8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x1c18f8['attributes']:_0x141a4e['model'];_0x1c18f8[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x508b82[_0x71cc('0x2e')]['sort']);_0x1c18f8[_0x71cc('0x38')]=qs[_0x71cc('0x2f')](_[_0x71cc('0x39')](_0x508b82['query'],_0x141a4e[_0x71cc('0x2f')]));if(_0x508b82[_0x71cc('0x2e')]['filter']){_0x1c18f8[_0x71cc('0x38')]=_[_0x71cc('0x3c')](_0x1c18f8[_0x71cc('0x38')],{'$or':_[_0x71cc('0x26')](_0x1c18f8[_0x71cc('0x31')],function(_0x1d9bfe){var _0x3525e2={};_0x3525e2[_0x1d9bfe]={'$like':'%'+_0x508b82[_0x71cc('0x2e')][_0x71cc('0x3a')]+'%'};return _0x3525e2;})});}_0x1c18f8=_['merge']({},_0x1c18f8,_0x508b82[_0x71cc('0x3d')]);return _0x48d807[_0x71cc('0x4d')](_0x1c18f8);}})[_0x71cc('0x1f')](function(_0x153bc0){if(_0x153bc0){_0x5a6b22=_0x153bc0[_0x71cc('0x33')];if(!_0x508b82[_0x71cc('0x2e')][_0x71cc('0x34')]('nolimit')){_0x1c18f8[_0x71cc('0x19')]=qs[_0x71cc('0x19')](_0x508b82[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1c18f8['offset']=qs[_0x71cc('0x16')](_0x508b82[_0x71cc('0x2e')]['offset']);}return _0x48d807[_0x71cc('0x4d')](_0x1c18f8);}})[_0x71cc('0x1f')](function(_0x469269){if(_0x469269){return _0x469269?{'count':_0x5a6b22,'rows':_0x469269}:null;}})[_0x71cc('0x1f')](respondWithResult(_0x3d4edf,null))[_0x71cc('0x44')](handleError(_0x3d4edf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c82d1c3..1c48aab 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 _0x6085=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger'];(function(_0x1405b8,_0x4781b4){var _0x3103ca=function(_0x3628a1){while(--_0x3628a1){_0x1405b8['push'](_0x1405b8['shift']());}};_0x3103ca(++_0x4781b4);}(_0x6085,0xa6));var _0x5608=function(_0x47ee51,_0x411c42){_0x47ee51=_0x47ee51-0x0;var _0x5fdffb=_0x6085[_0x47ee51];return _0x5fdffb;};'use strict';var _=require(_0x5608('0x0'));var util=require('util');var logger=require(_0x5608('0x1'))(_0x5608('0x2'));var moment=require(_0x5608('0x3'));var BPromise=require(_0x5608('0x4'));var rp=require(_0x5608('0x5'));var fs=require('fs');var path=require(_0x5608('0x6'));var rimraf=require(_0x5608('0x7'));var config=require(_0x5608('0x8'));var attributes=require(_0x5608('0x9'));module[_0x5608('0xa')]=function(_0x10aff6,_0x508138){return _0x10aff6[_0x5608('0xb')](_0x5608('0xc'),attributes,{'tableName':_0x5608('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3acf=['VtigerConfiguration','util','api','moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3acf,0xb1));var _0xf3ac=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x3acf[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var util=require(_0xf3ac('0x0'));var logger=require('../../config/logger')(_0xf3ac('0x1'));var moment=require(_0xf3ac('0x2'));var BPromise=require(_0xf3ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3ac('0x4'));var config=require(_0xf3ac('0x5'));var attributes=require(_0xf3ac('0x6'));module['exports']=function(_0x37070d,_0x2af819){return _0x37070d['define'](_0xf3ac('0x7'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 0cacc96..29c68cb 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 _0x5205=['info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4a4b17,_0x206748){var _0xfdb599=function(_0x4caa69){while(--_0x4caa69){_0x4a4b17['push'](_0x4a4b17['shift']());}};_0xfdb599(++_0x206748);}(_0x5205,0x1d9));var _0x5520=function(_0x238040,_0x287baa){_0x238040=_0x238040-0x0;var _0x28fbe2=_0x5205[_0x238040];return _0x28fbe2;};'use strict';var _=require(_0x5520('0x0'));var util=require(_0x5520('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5520('0x2'));var db=require(_0x5520('0x3'))['db'];var utils=require(_0x5520('0x4'));var logger=require(_0x5520('0x5'))(_0x5520('0x6'));var config=require('../../config/environment');var jayson=require(_0x5520('0x7'));var client=jayson[_0x5520('0x8')][_0x5520('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf9395e,_0x2c3a5f,_0x50ce7c){return new BPromise(function(_0x1fe7d1,_0x164055){return client[_0x5520('0xa')](_0xf9395e,_0x50ce7c)['then'](function(_0x21ef3e){logger[_0x5520('0xb')](_0x5520('0xc'),_0x2c3a5f,'request\x20sent');logger[_0x5520('0xd')](_0x5520('0xe'),_0x2c3a5f,_0x5520('0xf'),JSON[_0x5520('0x10')](_0x21ef3e));if(_0x21ef3e['error']){if(_0x21ef3e[_0x5520('0x11')][_0x5520('0x12')]===0x1f4){logger[_0x5520('0x11')](_0x5520('0xc'),_0x2c3a5f,_0x21ef3e[_0x5520('0x11')]['message']);return _0x164055(_0x21ef3e[_0x5520('0x11')][_0x5520('0x13')]);}logger[_0x5520('0x11')](_0x5520('0xc'),_0x2c3a5f,_0x21ef3e[_0x5520('0x11')][_0x5520('0x13')]);return _0x1fe7d1(_0x21ef3e[_0x5520('0x11')][_0x5520('0x13')]);}else{logger['info'](_0x5520('0xc'),_0x2c3a5f,_0x5520('0xf'));_0x1fe7d1(_0x21ef3e[_0x5520('0x14')]['message']);}})[_0x5520('0x15')](function(_0x452dd6){logger[_0x5520('0x11')](_0x5520('0xc'),_0x2c3a5f,_0x452dd6);_0x164055(_0x452dd6);});});} \ No newline at end of file +var _0xa45c=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x26e8c8,_0x156146){var _0x2a25e7=function(_0xfde90b){while(--_0xfde90b){_0x26e8c8['push'](_0x26e8c8['shift']());}};_0x2a25e7(++_0x156146);}(_0xa45c,0x184));var _0xca45=function(_0x4a334e,_0x2cbdfa){_0x4a334e=_0x4a334e-0x0;var _0x4ec93c=_0xa45c[_0x4a334e];return _0x4ec93c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xca45('0x0'));var rs=require(_0xca45('0x1'));var fs=require('fs');var Redis=require(_0xca45('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x3'))(_0xca45('0x4'));var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46e4bb,_0x4a358c,_0x3eb4dc){return new BPromise(function(_0xcd4a5b,_0x40c50a){return client[_0xca45('0x8')](_0x46e4bb,_0x3eb4dc)[_0xca45('0x9')](function(_0x56ddac){logger[_0xca45('0xa')](_0xca45('0xb'),_0x4a358c,_0xca45('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4a358c,_0xca45('0xc'),JSON[_0xca45('0xd')](_0x56ddac));if(_0x56ddac[_0xca45('0xe')]){if(_0x56ddac[_0xca45('0xe')][_0xca45('0xf')]===0x1f4){logger[_0xca45('0xe')](_0xca45('0xb'),_0x4a358c,_0x56ddac['error'][_0xca45('0x10')]);return _0x40c50a(_0x56ddac[_0xca45('0xe')][_0xca45('0x10')]);}logger[_0xca45('0xe')](_0xca45('0xb'),_0x4a358c,_0x56ddac[_0xca45('0xe')][_0xca45('0x10')]);return _0xcd4a5b(_0x56ddac[_0xca45('0xe')]['message']);}else{logger[_0xca45('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x4a358c,'request\x20sent');_0xcd4a5b(_0x56ddac['result'][_0xca45('0x10')]);}})[_0xca45('0x11')](function(_0x59fda0){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4a358c,_0x59fda0);_0x40c50a(_0x59fda0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2e17f2b..698d1c3 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 _0x4d90=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xcc840a,_0x30482e){var _0x2d61b1=function(_0x4b1e4b){while(--_0x4b1e4b){_0xcc840a['push'](_0xcc840a['shift']());}};_0x2d61b1(++_0x30482e);}(_0x4d90,0x156));var _0x04d9=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4d90[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x04d9('0x0'));var util=require(_0x04d9('0x1'));var path=require(_0x04d9('0x2'));var timeout=require(_0x04d9('0x3'));var express=require(_0x04d9('0x4'));var router=express[_0x04d9('0x5')]();var fs_extra=require(_0x04d9('0x6'));var auth=require(_0x04d9('0x7'));var interaction=require(_0x04d9('0x8'));var config=require(_0x04d9('0x9'));var controller=require(_0x04d9('0xa'));router[_0x04d9('0xb')]('/',auth['isAuthenticated'](),controller[_0x04d9('0xc')]);router[_0x04d9('0xb')](_0x04d9('0xd'),auth[_0x04d9('0xe')](),controller[_0x04d9('0xf')]);router[_0x04d9('0x10')]('/',auth[_0x04d9('0xe')](),controller[_0x04d9('0x11')]);router[_0x04d9('0x12')](_0x04d9('0xd'),auth[_0x04d9('0xe')](),controller[_0x04d9('0x13')]);router[_0x04d9('0x14')](_0x04d9('0xd'),auth[_0x04d9('0xe')](),controller[_0x04d9('0x15')]);module[_0x04d9('0x16')]=router; \ No newline at end of file +var _0xabb6=['index','get','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated'];(function(_0x23f0bf,_0x2409b9){var _0x5f0d69=function(_0x2b544f){while(--_0x2b544f){_0x23f0bf['push'](_0x23f0bf['shift']());}};_0x5f0d69(++_0x2409b9);}(_0xabb6,0x135));var _0x6abb=function(_0xa8f42f,_0x43083d){_0xa8f42f=_0xa8f42f-0x0;var _0x51b04b=_0xabb6[_0xa8f42f];return _0x51b04b;};'use strict';var multer=require(_0x6abb('0x0'));var util=require('util');var path=require(_0x6abb('0x1'));var timeout=require(_0x6abb('0x2'));var express=require(_0x6abb('0x3'));var router=express[_0x6abb('0x4')]();var fs_extra=require(_0x6abb('0x5'));var auth=require(_0x6abb('0x6'));var interaction=require(_0x6abb('0x7'));var config=require(_0x6abb('0x8'));var controller=require(_0x6abb('0x9'));router['get']('/',auth[_0x6abb('0xa')](),controller[_0x6abb('0xb')]);router[_0x6abb('0xc')](_0x6abb('0xd'),auth[_0x6abb('0xa')](),controller[_0x6abb('0xe')]);router[_0x6abb('0xf')]('/',auth[_0x6abb('0xa')](),controller[_0x6abb('0x10')]);router[_0x6abb('0x11')](_0x6abb('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6abb('0x12')]('/:id',auth[_0x6abb('0xa')](),controller[_0x6abb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 750d061..3616497 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 _0x7ed4=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x7ed4,0x1e6));var _0x47ed=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x7ed4[_0x1a595a];return _0x33f008;};'use strict';var Sequelize=require('sequelize');module[_0x47ed('0x0')]={'type':{'type':Sequelize[_0x47ed('0x1')](_0x47ed('0x2'),_0x47ed('0x3'),_0x47ed('0x4'),_0x47ed('0x5'),_0x47ed('0x6')),'defaultValue':_0x47ed('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x47ed('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x47ed('0x2'),_0x47ed('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x47ed('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcc0f=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x25c18b,_0x47f089){var _0x493114=function(_0x575495){while(--_0x575495){_0x25c18b['push'](_0x25c18b['shift']());}};_0x493114(++_0x47f089);}(_0xcc0f,0x1b9));var _0xfcc0=function(_0x50aa0d,_0x54c5d9){_0x50aa0d=_0x50aa0d-0x0;var _0x49b870=_0xcc0f[_0x50aa0d];return _0x49b870;};'use strict';var Sequelize=require(_0xfcc0('0x0'));module[_0xfcc0('0x1')]={'type':{'type':Sequelize[_0xfcc0('0x2')]('string',_0xfcc0('0x3'),_0xfcc0('0x4'),_0xfcc0('0x5'),_0xfcc0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfcc0('0x7')]},'key':{'type':Sequelize[_0xfcc0('0x7')]},'keyType':{'type':Sequelize[_0xfcc0('0x2')](_0xfcc0('0x8'),_0xfcc0('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfcc0('0x7')]},'idField':{'type':Sequelize[_0xfcc0('0x7')]},'nameField':{'type':Sequelize[_0xfcc0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfcc0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 2089ebb..e0d3ed7 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 _0xe838=['destroy','sendStatus','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x472768,_0x56d166){var _0x37f568=function(_0x64403d){while(--_0x64403d){_0x472768['push'](_0x472768['shift']());}};_0x37f568(++_0x56d166);}(_0xe838,0x1e9));var _0x8e83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe838[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8e83('0x0'));var rimraf=require(_0x8e83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e83('0x2'));var rp=require('request-promise');var moment=require(_0x8e83('0x3'));var BPromise=require(_0x8e83('0x4'));var Mustache=require(_0x8e83('0x5'));var util=require(_0x8e83('0x6'));var path=require(_0x8e83('0x7'));var sox=require(_0x8e83('0x8'));var csv=require('to-csv');var ejs=require(_0x8e83('0x9'));var fs=require('fs');var fs_extra=require(_0x8e83('0xa'));var _=require(_0x8e83('0xb'));var squel=require(_0x8e83('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e83('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e83('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8e83('0xf'));var authService=require(_0x8e83('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8e83('0x11'));var hardwareService=require(_0x8e83('0x12'));var logger=require('../../config/logger')(_0x8e83('0x13'));var utils=require(_0x8e83('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e83('0x15'))['db'];function respondWithStatusCode(_0x413e0b,_0x2a0ee6){_0x2a0ee6=_0x2a0ee6||0xcc;return function(_0x1a177a){if(_0x1a177a){return _0x413e0b['sendStatus'](_0x2a0ee6);}return _0x413e0b[_0x8e83('0x16')](_0x2a0ee6)[_0x8e83('0x17')]();};}function respondWithResult(_0x257c15,_0x200af1){_0x200af1=_0x200af1||0xc8;return function(_0x3280e9){if(_0x3280e9){return _0x257c15['status'](_0x200af1)['json'](_0x3280e9);}};}function respondWithFilteredResult(_0x4a72ab,_0x3da967){return function(_0x3eec05){if(_0x3eec05){var _0x1d296b=typeof _0x3da967[_0x8e83('0x18')]==='undefined'&&typeof _0x3da967[_0x8e83('0x19')]===_0x8e83('0x1a');var _0x3c8987=_0x3eec05[_0x8e83('0x1b')];var _0x483186=_0x1d296b?0x0:_0x3da967[_0x8e83('0x18')];var _0x38e436=_0x1d296b?_0x3eec05[_0x8e83('0x1b')]:_0x3da967[_0x8e83('0x18')]+_0x3da967[_0x8e83('0x19')];var _0x304e9f;if(_0x38e436>=_0x3c8987){_0x38e436=_0x3c8987;_0x304e9f=0xc8;}else{_0x304e9f=0xce;}_0x4a72ab[_0x8e83('0x16')](_0x304e9f);return _0x4a72ab[_0x8e83('0x1c')](_0x8e83('0x1d'),_0x483186+'-'+_0x38e436+'/'+_0x3c8987)[_0x8e83('0x1e')](_0x3eec05);}return null;};}function patchUpdates(_0x3c70ea){return function(_0x47784c){try{jsonpatch[_0x8e83('0x1f')](_0x47784c,_0x3c70ea,!![]);}catch(_0x1b0da2){return BPromise[_0x8e83('0x20')](_0x1b0da2);}return _0x47784c[_0x8e83('0x21')]();};}function saveUpdates(_0x352fb7,_0x275ad8){return function(_0x19b7a9){if(_0x19b7a9){return _0x19b7a9[_0x8e83('0x22')](_0x352fb7)[_0x8e83('0x23')](function(_0x121615){return _0x121615;});}return null;};}function removeEntity(_0x3ebaa6,_0x386766){return function(_0x4ac224){if(_0x4ac224){return _0x4ac224[_0x8e83('0x24')]()[_0x8e83('0x23')](function(){_0x3ebaa6[_0x8e83('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23cb5d,_0x1ba988){return function(_0x3e0f89){if(!_0x3e0f89){_0x23cb5d[_0x8e83('0x25')](0x194);}return _0x3e0f89;};}function handleError(_0x242fab,_0x2d3519){_0x2d3519=_0x2d3519||0x1f4;return function(_0xdb1250){logger[_0x8e83('0x26')](_0xdb1250[_0x8e83('0x27')]);if(_0xdb1250[_0x8e83('0x28')]){delete _0xdb1250['name'];}_0x242fab[_0x8e83('0x16')](_0x2d3519)['send'](_0xdb1250);};}exports[_0x8e83('0x29')]=function(_0x1a45f8,_0x5d5ecc){var _0x2037ca={},_0x8d73f={},_0x2118ef={'count':0x0,'rows':[]};var _0x2fd60f=_[_0x8e83('0x2a')](db[_0x8e83('0x2b')][_0x8e83('0x2c')],function(_0xce1e3){return{'name':_0xce1e3[_0x8e83('0x2d')],'type':_0xce1e3[_0x8e83('0x2e')][_0x8e83('0x2f')]};});_0x8d73f[_0x8e83('0x30')]=_[_0x8e83('0x2a')](_0x2fd60f,_0x8e83('0x28'));_0x8d73f[_0x8e83('0x31')]=_[_0x8e83('0x32')](_0x1a45f8[_0x8e83('0x31')]);_0x8d73f[_0x8e83('0x33')]=_[_0x8e83('0x34')](_0x8d73f[_0x8e83('0x30')],_0x8d73f[_0x8e83('0x31')]);_0x2037ca[_0x8e83('0x35')]=_['intersection'](_0x8d73f['model'],qs['fields'](_0x1a45f8['query'][_0x8e83('0x36')]));_0x2037ca[_0x8e83('0x35')]=_0x2037ca[_0x8e83('0x35')][_0x8e83('0x37')]?_0x2037ca['attributes']:_0x8d73f['model'];if(!_0x1a45f8[_0x8e83('0x31')][_0x8e83('0x38')](_0x8e83('0x39'))){_0x2037ca[_0x8e83('0x19')]=qs[_0x8e83('0x19')](_0x1a45f8[_0x8e83('0x31')][_0x8e83('0x19')]);_0x2037ca[_0x8e83('0x18')]=qs[_0x8e83('0x18')](_0x1a45f8['query'][_0x8e83('0x18')]);}_0x2037ca[_0x8e83('0x3a')]=qs[_0x8e83('0x3b')](_0x1a45f8[_0x8e83('0x31')][_0x8e83('0x3b')]);_0x2037ca[_0x8e83('0x3c')]=qs[_0x8e83('0x33')](_[_0x8e83('0x3d')](_0x1a45f8[_0x8e83('0x31')],_0x8d73f[_0x8e83('0x33')]),_0x2fd60f);if(_0x1a45f8['query']['filter']){_0x2037ca[_0x8e83('0x3c')]=_[_0x8e83('0x3e')](_0x2037ca[_0x8e83('0x3c')],{'$or':_[_0x8e83('0x2a')](_0x2fd60f,function(_0x5a72cf){if(_0x5a72cf['type']!==_0x8e83('0x3f')){var _0x2028ee={};_0x2028ee[_0x5a72cf[_0x8e83('0x28')]]={'$like':'%'+_0x1a45f8[_0x8e83('0x31')]['filter']+'%'};return _0x2028ee;}})});}_0x2037ca=_[_0x8e83('0x3e')]({},_0x2037ca,_0x1a45f8['options']);var _0x51071e={'where':_0x2037ca[_0x8e83('0x3c')]};return db['VtigerField'][_0x8e83('0x1b')](_0x51071e)['then'](function(_0x6eb53){_0x2118ef['count']=_0x6eb53;if(_0x1a45f8[_0x8e83('0x31')][_0x8e83('0x40')]){_0x2037ca[_0x8e83('0x41')]=[{'all':!![]}];}return db[_0x8e83('0x2b')][_0x8e83('0x42')](_0x2037ca);})[_0x8e83('0x23')](function(_0x334412){_0x2118ef[_0x8e83('0x43')]=_0x334412;return _0x2118ef;})['then'](respondWithFilteredResult(_0x5d5ecc,_0x2037ca))[_0x8e83('0x44')](handleError(_0x5d5ecc,null));};exports[_0x8e83('0x45')]=function(_0x411baa,_0x34d970){var _0x4c34d3={'raw':!![],'where':{'id':_0x411baa[_0x8e83('0x46')]['id']}},_0x31a380={};_0x31a380[_0x8e83('0x30')]=_[_0x8e83('0x32')](db[_0x8e83('0x2b')][_0x8e83('0x2c')]);_0x31a380[_0x8e83('0x31')]=_[_0x8e83('0x32')](_0x411baa['query']);_0x31a380['filters']=_[_0x8e83('0x34')](_0x31a380[_0x8e83('0x30')],_0x31a380[_0x8e83('0x31')]);_0x4c34d3[_0x8e83('0x35')]=_['intersection'](_0x31a380[_0x8e83('0x30')],qs['fields'](_0x411baa['query'][_0x8e83('0x36')]));_0x4c34d3[_0x8e83('0x35')]=_0x4c34d3['attributes'][_0x8e83('0x37')]?_0x4c34d3['attributes']:_0x31a380[_0x8e83('0x30')];if(_0x411baa[_0x8e83('0x31')][_0x8e83('0x40')]){_0x4c34d3[_0x8e83('0x41')]=[{'all':!![]}];}_0x4c34d3=_[_0x8e83('0x3e')]({},_0x4c34d3,_0x411baa[_0x8e83('0x47')]);return db[_0x8e83('0x2b')][_0x8e83('0x48')](_0x4c34d3)[_0x8e83('0x23')](handleEntityNotFound(_0x34d970,null))[_0x8e83('0x23')](respondWithResult(_0x34d970,null))[_0x8e83('0x44')](handleError(_0x34d970,null));};exports[_0x8e83('0x49')]=function(_0x46641a,_0x22c4fd){return db[_0x8e83('0x2b')][_0x8e83('0x49')](_0x46641a[_0x8e83('0x4a')],{})['then'](respondWithResult(_0x22c4fd,0xc9))[_0x8e83('0x44')](handleError(_0x22c4fd,null));};exports['update']=function(_0x3eb19e,_0x3df67d){if(_0x3eb19e[_0x8e83('0x4a')]['id']){delete _0x3eb19e[_0x8e83('0x4a')]['id'];}return db['VtigerField'][_0x8e83('0x48')]({'where':{'id':_0x3eb19e[_0x8e83('0x46')]['id']}})['then'](handleEntityNotFound(_0x3df67d,null))[_0x8e83('0x23')](saveUpdates(_0x3eb19e[_0x8e83('0x4a')],null))[_0x8e83('0x23')](respondWithResult(_0x3df67d,null))['catch'](handleError(_0x3df67d,null));};exports[_0x8e83('0x24')]=function(_0x362f0d,_0xde946d){return db['VtigerField']['find']({'where':{'id':_0x362f0d['params']['id']}})['then'](handleEntityNotFound(_0xde946d,null))[_0x8e83('0x23')](removeEntity(_0xde946d,null))[_0x8e83('0x44')](handleError(_0xde946d,null));}; \ No newline at end of file +var _0xe18b=['error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy'];(function(_0x2aee6d,_0x56cbc8){var _0x1d292b=function(_0x2292ca){while(--_0x2292ca){_0x2aee6d['push'](_0x2aee6d['shift']());}};_0x1d292b(++_0x56cbc8);}(_0xe18b,0x1cd));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbe18('0x0'));var rimraf=require(_0xbe18('0x1'));var zipdir=require(_0xbe18('0x2'));var jsonpatch=require(_0xbe18('0x3'));var rp=require('request-promise');var moment=require(_0xbe18('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe18('0x5'));var util=require(_0xbe18('0x6'));var path=require('path');var sox=require(_0xbe18('0x7'));var csv=require(_0xbe18('0x8'));var ejs=require(_0xbe18('0x9'));var fs=require('fs');var fs_extra=require(_0xbe18('0xa'));var _=require('lodash');var squel=require(_0xbe18('0xb'));var crypto=require('crypto');var jsforce=require(_0xbe18('0xc'));var deskjs=require(_0xbe18('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe18('0xe'));var Papa=require(_0xbe18('0xf'));var Redis=require(_0xbe18('0x10'));var authService=require(_0xbe18('0x11'));var qs=require(_0xbe18('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe18('0x13'));var logger=require(_0xbe18('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbe18('0x15'));var licenseUtil=require(_0xbe18('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3136eb,_0x5b2a0b){_0x5b2a0b=_0x5b2a0b||0xcc;return function(_0x57ac30){if(_0x57ac30){return _0x3136eb[_0xbe18('0x17')](_0x5b2a0b);}return _0x3136eb[_0xbe18('0x18')](_0x5b2a0b)[_0xbe18('0x19')]();};}function respondWithResult(_0x444a0f,_0x31ea2b){_0x31ea2b=_0x31ea2b||0xc8;return function(_0x5edbb0){if(_0x5edbb0){return _0x444a0f[_0xbe18('0x18')](_0x31ea2b)[_0xbe18('0x1a')](_0x5edbb0);}};}function respondWithFilteredResult(_0x4f8fb9,_0x3242fd){return function(_0xab34f0){if(_0xab34f0){var _0xf8e9ba=typeof _0x3242fd['offset']==='undefined'&&typeof _0x3242fd['limit']==='undefined';var _0x461c05=_0xab34f0[_0xbe18('0x1b')];var _0x4890d2=_0xf8e9ba?0x0:_0x3242fd[_0xbe18('0x1c')];var _0x2d3c6a=_0xf8e9ba?_0xab34f0[_0xbe18('0x1b')]:_0x3242fd['offset']+_0x3242fd[_0xbe18('0x1d')];var _0x325b0d;if(_0x2d3c6a>=_0x461c05){_0x2d3c6a=_0x461c05;_0x325b0d=0xc8;}else{_0x325b0d=0xce;}_0x4f8fb9[_0xbe18('0x18')](_0x325b0d);return _0x4f8fb9['set'](_0xbe18('0x1e'),_0x4890d2+'-'+_0x2d3c6a+'/'+_0x461c05)[_0xbe18('0x1a')](_0xab34f0);}return null;};}function patchUpdates(_0x341d5b){return function(_0x5cdc62){try{jsonpatch[_0xbe18('0x1f')](_0x5cdc62,_0x341d5b,!![]);}catch(_0x246557){return BPromise['reject'](_0x246557);}return _0x5cdc62[_0xbe18('0x20')]();};}function saveUpdates(_0x154d71,_0x543c72){return function(_0x3b80cb){if(_0x3b80cb){return _0x3b80cb[_0xbe18('0x21')](_0x154d71)[_0xbe18('0x22')](function(_0x12364d){return _0x12364d;});}return null;};}function removeEntity(_0x1d317a,_0x34def6){return function(_0x478260){if(_0x478260){return _0x478260[_0xbe18('0x23')]()[_0xbe18('0x22')](function(){_0x1d317a[_0xbe18('0x18')](0xcc)[_0xbe18('0x19')]();});}};}function handleEntityNotFound(_0xbbfd7a,_0x49bcf8){return function(_0x413555){if(!_0x413555){_0xbbfd7a['sendStatus'](0x194);}return _0x413555;};}function handleError(_0x3f66c3,_0x1a1b7b){_0x1a1b7b=_0x1a1b7b||0x1f4;return function(_0xc76d8d){logger[_0xbe18('0x24')](_0xc76d8d[_0xbe18('0x25')]);if(_0xc76d8d['name']){delete _0xc76d8d[_0xbe18('0x26')];}_0x3f66c3[_0xbe18('0x18')](_0x1a1b7b)[_0xbe18('0x27')](_0xc76d8d);};}exports['index']=function(_0x3d6b9b,_0x4bb1c8){var _0x2012ba={},_0x47dde2={},_0x573cc2={'count':0x0,'rows':[]};var _0x1fbb62=_[_0xbe18('0x28')](db[_0xbe18('0x29')][_0xbe18('0x2a')],function(_0x9db8da){return{'name':_0x9db8da[_0xbe18('0x2b')],'type':_0x9db8da[_0xbe18('0x2c')]['key']};});_0x47dde2[_0xbe18('0x2d')]=_[_0xbe18('0x28')](_0x1fbb62,_0xbe18('0x26'));_0x47dde2[_0xbe18('0x2e')]=_[_0xbe18('0x2f')](_0x3d6b9b[_0xbe18('0x2e')]);_0x47dde2['filters']=_[_0xbe18('0x30')](_0x47dde2[_0xbe18('0x2d')],_0x47dde2[_0xbe18('0x2e')]);_0x2012ba[_0xbe18('0x31')]=_[_0xbe18('0x30')](_0x47dde2[_0xbe18('0x2d')],qs[_0xbe18('0x32')](_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x32')]));_0x2012ba[_0xbe18('0x31')]=_0x2012ba['attributes'][_0xbe18('0x33')]?_0x2012ba[_0xbe18('0x31')]:_0x47dde2[_0xbe18('0x2d')];if(!_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x34')](_0xbe18('0x35'))){_0x2012ba[_0xbe18('0x1d')]=qs[_0xbe18('0x1d')](_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x1d')]);_0x2012ba['offset']=qs['offset'](_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x1c')]);}_0x2012ba[_0xbe18('0x36')]=qs[_0xbe18('0x37')](_0x3d6b9b['query'][_0xbe18('0x37')]);_0x2012ba[_0xbe18('0x38')]=qs[_0xbe18('0x39')](_[_0xbe18('0x3a')](_0x3d6b9b[_0xbe18('0x2e')],_0x47dde2[_0xbe18('0x39')]),_0x1fbb62);if(_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x3b')]){_0x2012ba['where']=_[_0xbe18('0x3c')](_0x2012ba[_0xbe18('0x38')],{'$or':_['map'](_0x1fbb62,function(_0x12ac97){if(_0x12ac97[_0xbe18('0x2c')]!==_0xbe18('0x3d')){var _0x49f540={};_0x49f540[_0x12ac97['name']]={'$like':'%'+_0x3d6b9b[_0xbe18('0x2e')]['filter']+'%'};return _0x49f540;}})});}_0x2012ba=_[_0xbe18('0x3c')]({},_0x2012ba,_0x3d6b9b[_0xbe18('0x3e')]);var _0x3ea96e={'where':_0x2012ba['where']};return db['VtigerField'][_0xbe18('0x1b')](_0x3ea96e)[_0xbe18('0x22')](function(_0x20de36){_0x573cc2[_0xbe18('0x1b')]=_0x20de36;if(_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x3f')]){_0x2012ba[_0xbe18('0x40')]=[{'all':!![]}];}return db[_0xbe18('0x29')][_0xbe18('0x41')](_0x2012ba);})[_0xbe18('0x22')](function(_0x202192){_0x573cc2['rows']=_0x202192;return _0x573cc2;})[_0xbe18('0x22')](respondWithFilteredResult(_0x4bb1c8,_0x2012ba))[_0xbe18('0x42')](handleError(_0x4bb1c8,null));};exports['show']=function(_0x16b9f7,_0xfcd617){var _0xaf16b3={'raw':!![],'where':{'id':_0x16b9f7[_0xbe18('0x43')]['id']}},_0x47bee7={};_0x47bee7[_0xbe18('0x2d')]=_[_0xbe18('0x2f')](db[_0xbe18('0x29')]['rawAttributes']);_0x47bee7[_0xbe18('0x2e')]=_['keys'](_0x16b9f7[_0xbe18('0x2e')]);_0x47bee7['filters']=_[_0xbe18('0x30')](_0x47bee7[_0xbe18('0x2d')],_0x47bee7[_0xbe18('0x2e')]);_0xaf16b3[_0xbe18('0x31')]=_[_0xbe18('0x30')](_0x47bee7[_0xbe18('0x2d')],qs[_0xbe18('0x32')](_0x16b9f7[_0xbe18('0x2e')]['fields']));_0xaf16b3[_0xbe18('0x31')]=_0xaf16b3[_0xbe18('0x31')][_0xbe18('0x33')]?_0xaf16b3[_0xbe18('0x31')]:_0x47bee7[_0xbe18('0x2d')];if(_0x16b9f7[_0xbe18('0x2e')][_0xbe18('0x3f')]){_0xaf16b3[_0xbe18('0x40')]=[{'all':!![]}];}_0xaf16b3=_[_0xbe18('0x3c')]({},_0xaf16b3,_0x16b9f7[_0xbe18('0x3e')]);return db[_0xbe18('0x29')]['find'](_0xaf16b3)['then'](handleEntityNotFound(_0xfcd617,null))[_0xbe18('0x22')](respondWithResult(_0xfcd617,null))[_0xbe18('0x42')](handleError(_0xfcd617,null));};exports[_0xbe18('0x44')]=function(_0x25200e,_0xa5c2ea){return db[_0xbe18('0x29')]['create'](_0x25200e['body'],{})['then'](respondWithResult(_0xa5c2ea,0xc9))['catch'](handleError(_0xa5c2ea,null));};exports[_0xbe18('0x21')]=function(_0x4f2796,_0x1f8780){if(_0x4f2796['body']['id']){delete _0x4f2796[_0xbe18('0x45')]['id'];}return db[_0xbe18('0x29')][_0xbe18('0x46')]({'where':{'id':_0x4f2796[_0xbe18('0x43')]['id']}})[_0xbe18('0x22')](handleEntityNotFound(_0x1f8780,null))['then'](saveUpdates(_0x4f2796[_0xbe18('0x45')],null))[_0xbe18('0x22')](respondWithResult(_0x1f8780,null))[_0xbe18('0x42')](handleError(_0x1f8780,null));};exports[_0xbe18('0x23')]=function(_0x5cde54,_0x1e6b3f){return db[_0xbe18('0x29')][_0xbe18('0x46')]({'where':{'id':_0x5cde54['params']['id']}})[_0xbe18('0x22')](handleEntityNotFound(_0x1e6b3f,null))[_0xbe18('0x22')](removeEntity(_0x1e6b3f,null))['catch'](handleError(_0x1e6b3f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c3ee85f..f12b531 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 _0x9037=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','idField','FieldId'];(function(_0x3ae2f7,_0x57a69e){var _0x152a75=function(_0x3531fd){while(--_0x3531fd){_0x3ae2f7['push'](_0x3ae2f7['shift']());}};_0x152a75(++_0x57a69e);}(_0x9037,0x196));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7903('0x0'));var util=require(_0x7903('0x1'));var logger=require(_0x7903('0x2'))(_0x7903('0x3'));var moment=require(_0x7903('0x4'));var BPromise=require(_0x7903('0x5'));var rp=require(_0x7903('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7903('0x7'));var config=require('../../config/environment');var attributes=require(_0x7903('0x8'));module['exports']=function(_0x25786d,_0x46c193){return _0x25786d[_0x7903('0x9')](_0x7903('0xa'),attributes,{'tableName':_0x7903('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x7903('0xc'),_0x7903('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb14e=['rimraf','./intVtigerField.attributes','VtigerField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x51343f,_0x4a9b30){var _0x3d8113=function(_0x45b41e){while(--_0x45b41e){_0x51343f['push'](_0x51343f['shift']());}};_0x3d8113(++_0x4a9b30);}(_0xb14e,0x159));var _0xeb14=function(_0x3d3d40,_0x25152d){_0x3d3d40=_0x3d3d40-0x0;var _0x49e2cb=_0xb14e[_0x3d3d40];return _0x49e2cb;};'use strict';var _=require(_0xeb14('0x0'));var util=require(_0xeb14('0x1'));var logger=require(_0xeb14('0x2'))(_0xeb14('0x3'));var moment=require(_0xeb14('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb14('0x5'));var fs=require('fs');var path=require(_0xeb14('0x6'));var rimraf=require(_0xeb14('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb14('0x8'));module['exports']=function(_0x35aba8,_0x3241d6){return _0x35aba8['define'](_0xeb14('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xeb14('0xa')],'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 2ad34e2..aac93ed 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 _0x39d6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch'];(function(_0x44468f,_0x34c598){var _0x2ec332=function(_0x1f34ab){while(--_0x1f34ab){_0x44468f['push'](_0x44468f['shift']());}};_0x2ec332(++_0x34c598);}(_0x39d6,0x8a));var _0x639d=function(_0x2a2799,_0x5e25a8){_0x2a2799=_0x2a2799-0x0;var _0x17f761=_0x39d6[_0x2a2799];return _0x17f761;};'use strict';var _=require(_0x639d('0x0'));var util=require(_0x639d('0x1'));var moment=require(_0x639d('0x2'));var BPromise=require(_0x639d('0x3'));var rs=require(_0x639d('0x4'));var fs=require('fs');var Redis=require(_0x639d('0x5'));var db=require(_0x639d('0x6'))['db'];var utils=require(_0x639d('0x7'));var logger=require(_0x639d('0x8'))(_0x639d('0x9'));var config=require('../../config/environment');var jayson=require(_0x639d('0xa'));var client=jayson[_0x639d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5840fa,_0x1a8135,_0x4944fa){return new BPromise(function(_0x1475f5,_0x1e6ae8){return client[_0x639d('0xc')](_0x5840fa,_0x4944fa)[_0x639d('0xd')](function(_0x111e2c){logger['info'](_0x639d('0xe'),_0x1a8135,_0x639d('0xf'));logger[_0x639d('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1a8135,_0x639d('0xf'),JSON['stringify'](_0x111e2c));if(_0x111e2c[_0x639d('0x11')]){if(_0x111e2c[_0x639d('0x11')][_0x639d('0x12')]===0x1f4){logger[_0x639d('0x11')](_0x639d('0xe'),_0x1a8135,_0x111e2c[_0x639d('0x11')]['message']);return _0x1e6ae8(_0x111e2c[_0x639d('0x11')][_0x639d('0x13')]);}logger[_0x639d('0x11')](_0x639d('0xe'),_0x1a8135,_0x111e2c['error'][_0x639d('0x13')]);return _0x1475f5(_0x111e2c[_0x639d('0x11')][_0x639d('0x13')]);}else{logger[_0x639d('0x14')](_0x639d('0xe'),_0x1a8135,_0x639d('0xf'));_0x1475f5(_0x111e2c[_0x639d('0x15')][_0x639d('0x13')]);}})[_0x639d('0x16')](function(_0x452dad){logger[_0x639d('0x11')]('VtigerField,\x20%s,\x20%s',_0x1a8135,_0x452dad);_0x1e6ae8(_0x452dad);});});} \ No newline at end of file +var _0xbf0b=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d0786,_0x51217f){var _0x24fda2=function(_0x5b48f1){while(--_0x5b48f1){_0x4d0786['push'](_0x4d0786['shift']());}};_0x24fda2(++_0x51217f);}(_0xbf0b,0x16a));var _0xbbf0=function(_0x2220d6,_0x580e12){_0x2220d6=_0x2220d6-0x0;var _0x2e4d10=_0xbf0b[_0x2220d6];return _0x2e4d10;};'use strict';var _=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var moment=require(_0xbbf0('0x2'));var BPromise=require(_0xbbf0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbf0('0x4'));var db=require(_0xbbf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbf0('0x6'))(_0xbbf0('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbf0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43cd5d,_0x511824,_0x3f7821){return new BPromise(function(_0x49f86c,_0x1e6dcc){return client[_0xbbf0('0x9')](_0x43cd5d,_0x3f7821)['then'](function(_0x1c18ce){logger[_0xbbf0('0xa')](_0xbbf0('0xb'),_0x511824,_0xbbf0('0xc'));logger[_0xbbf0('0xd')](_0xbbf0('0xe'),_0x511824,_0xbbf0('0xc'),JSON[_0xbbf0('0xf')](_0x1c18ce));if(_0x1c18ce[_0xbbf0('0x10')]){if(_0x1c18ce['error'][_0xbbf0('0x11')]===0x1f4){logger[_0xbbf0('0x10')]('VtigerField,\x20%s,\x20%s',_0x511824,_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);return _0x1e6dcc(_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);}logger[_0xbbf0('0x10')](_0xbbf0('0xb'),_0x511824,_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);return _0x49f86c(_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);}else{logger['info'](_0xbbf0('0xb'),_0x511824,_0xbbf0('0xc'));_0x49f86c(_0x1c18ce[_0xbbf0('0x13')]['message']);}})[_0xbbf0('0x14')](function(_0x1f03ff){logger[_0xbbf0('0x10')](_0xbbf0('0xb'),_0x511824,_0x1f03ff);_0x1e6dcc(_0x1f03ff);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 16356f7..847171f 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 _0x0e5e=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/:id','get','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','put','update'];(function(_0x4f9c54,_0x52f506){var _0x527d47=function(_0x11d320){while(--_0x11d320){_0x4f9c54['push'](_0x4f9c54['shift']());}};_0x527d47(++_0x52f506);}(_0x0e5e,0x1ce));var _0xe0e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e5e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe0e5('0x0'));var util=require(_0xe0e5('0x1'));var path=require(_0xe0e5('0x2'));var timeout=require(_0xe0e5('0x3'));var express=require(_0xe0e5('0x4'));var router=express['Router']();var fs_extra=require(_0xe0e5('0x5'));var auth=require(_0xe0e5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe0e5('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe0e5('0x8')]);router['get'](_0xe0e5('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe0e5('0xa')](_0xe0e5('0xb'),auth[_0xe0e5('0xc')](),controller[_0xe0e5('0xd')]);router[_0xe0e5('0xa')]('/:id/fields',auth[_0xe0e5('0xc')](),controller[_0xe0e5('0xe')]);router[_0xe0e5('0xf')]('/',auth[_0xe0e5('0xc')](),controller['create']);router[_0xe0e5('0xf')](_0xe0e5('0xb'),auth[_0xe0e5('0xc')](),controller['addConfiguration']);router[_0xe0e5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe0e5('0x11')]);router[_0xe0e5('0x12')](_0xe0e5('0x9'),auth[_0xe0e5('0xc')](),controller['destroy']);module[_0xe0e5('0x13')]=router; \ No newline at end of file +var _0x4b38=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','/:id','show','getConfigurations','/:id/fields','isAuthenticated','post','create','update'];(function(_0x51129d,_0x363ea2){var _0x40558a=function(_0x3d5509){while(--_0x3d5509){_0x51129d['push'](_0x51129d['shift']());}};_0x40558a(++_0x363ea2);}(_0x4b38,0x157));var _0x84b3=function(_0x258b8e,_0x1edf10){_0x258b8e=_0x258b8e-0x0;var _0x3c8e19=_0x4b38[_0x258b8e];return _0x3c8e19;};'use strict';var multer=require(_0x84b3('0x0'));var util=require('util');var path=require(_0x84b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x84b3('0x2'));var router=express[_0x84b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x84b3('0x4'));var interaction=require(_0x84b3('0x5'));var config=require('../../config/environment');var controller=require(_0x84b3('0x6'));router[_0x84b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x84b3('0x8')]);router['get'](_0x84b3('0x9'),auth['isAuthenticated'](),controller[_0x84b3('0xa')]);router[_0x84b3('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x84b3('0xb')]);router[_0x84b3('0x7')](_0x84b3('0xc'),auth[_0x84b3('0xd')](),controller['getFields']);router[_0x84b3('0xe')]('/',auth[_0x84b3('0xd')](),controller[_0x84b3('0xf')]);router[_0x84b3('0xe')]('/:id/configurations',auth[_0x84b3('0xd')](),controller['addConfiguration']);router['put'](_0x84b3('0x9'),auth[_0x84b3('0xd')](),controller[_0x84b3('0x10')]);router[_0x84b3('0x11')](_0x84b3('0x9'),auth[_0x84b3('0xd')](),controller[_0x84b3('0x12')]);module[_0x84b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index dcd51a1..8baf0df 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 _0x6a55=['ENUM','integrationTab','newTab','sequelize','STRING','remoteUri','password','token'];(function(_0x2b5448,_0xe31456){var _0xee510e=function(_0x48a4fa){while(--_0x48a4fa){_0x2b5448['push'](_0x2b5448['shift']());}};_0xee510e(++_0xe31456);}(_0x6a55,0xdb));var _0x56a5=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x6a55[_0x53fe97];return _0x5c49a2;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x56a5('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x56a5('0x2')},'authType':{'type':Sequelize['ENUM'](_0x56a5('0x3'),_0x56a5('0x4')),'defaultValue':_0x56a5('0x3')},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x56a5('0x5')](_0x56a5('0x6'),_0x56a5('0x7')),'defaultValue':_0x56a5('0x6')}}; \ No newline at end of file +var _0x9ab8=['token','integrationTab','newTab','sequelize','exports','STRING','username','ENUM','password'];(function(_0x3f4b07,_0x39c6c9){var _0x52fc3f=function(_0x447c25){while(--_0x447c25){_0x3f4b07['push'](_0x3f4b07['shift']());}};_0x52fc3f(++_0x39c6c9);}(_0x9ab8,0x81));var _0x89ab=function(_0x33b02b,_0x3bce6b){_0x33b02b=_0x33b02b-0x0;var _0x35c57f=_0x9ab8[_0x33b02b];return _0x35c57f;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'name':{'type':Sequelize[_0x89ab('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x89ab('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x89ab('0x2')]},'remoteUri':{'type':Sequelize[_0x89ab('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x5'),_0x89ab('0x6')),'defaultValue':_0x89ab('0x5')},'serverUrl':{'type':Sequelize[_0x89ab('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x7'),_0x89ab('0x8')),'defaultValue':_0x89ab('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1de5853..ae929bc 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 _0xe1e3=['assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','status','set','apply','save','then','destroy','name','send','ZendeskAccount','type','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','update','ZendeskConfiguration','length','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group'];(function(_0x4d8ebf,_0x2a2dce){var _0x5066c2=function(_0x5b1a56){while(--_0x5b1a56){_0x4d8ebf['push'](_0x4d8ebf['shift']());}};_0x5066c2(++_0x2a2dce);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x27293a,_0x3b6e0a){_0x27293a=_0x27293a-0x0;var _0x4d4224=_0xe1e3[_0x27293a];return _0x4d4224;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536129,_0x5c09a2){_0x5c09a2=_0x5c09a2||0xcc;return function(_0x14ad58){if(_0x14ad58){return _0x536129['sendStatus'](_0x5c09a2);}return _0x536129['status'](_0x5c09a2)[_0x3e1e('0x14')]();};}function respondWithResult(_0x8bd4cd,_0x78ee54){_0x78ee54=_0x78ee54||0xc8;return function(_0x50f221){if(_0x50f221){return _0x8bd4cd['status'](_0x78ee54)[_0x3e1e('0x15')](_0x50f221);}};}function respondWithFilteredResult(_0x1b62e6,_0x4dca60){return function(_0x26cb35){if(_0x26cb35){var _0x1f0af9=typeof _0x4dca60['offset']===_0x3e1e('0x16')&&typeof _0x4dca60['limit']===_0x3e1e('0x16');var _0x247daa=_0x26cb35[_0x3e1e('0x17')];var _0x39eaa7=_0x1f0af9?0x0:_0x4dca60[_0x3e1e('0x18')];var _0x1c181b=_0x1f0af9?_0x26cb35['count']:_0x4dca60['offset']+_0x4dca60['limit'];var _0x428e4e;if(_0x1c181b>=_0x247daa){_0x1c181b=_0x247daa;_0x428e4e=0xc8;}else{_0x428e4e=0xce;}_0x1b62e6[_0x3e1e('0x19')](_0x428e4e);return _0x1b62e6[_0x3e1e('0x1a')]('Content-Range',_0x39eaa7+'-'+_0x1c181b+'/'+_0x247daa)[_0x3e1e('0x15')](_0x26cb35);}return null;};}function patchUpdates(_0x530815){return function(_0x228991){try{jsonpatch[_0x3e1e('0x1b')](_0x228991,_0x530815,!![]);}catch(_0x474085){return BPromise['reject'](_0x474085);}return _0x228991[_0x3e1e('0x1c')]();};}function saveUpdates(_0x96396,_0xefa098){return function(_0x55dc62){if(_0x55dc62){return _0x55dc62['update'](_0x96396)[_0x3e1e('0x1d')](function(_0x1b5097){return _0x1b5097;});}return null;};}function removeEntity(_0x488f9f,_0x60e6bc){return function(_0x56ae51){if(_0x56ae51){return _0x56ae51[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x488f9f[_0x3e1e('0x19')](0xcc)[_0x3e1e('0x14')]();});}};}function handleEntityNotFound(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(!_0x4ee2b5){_0x43d583['sendStatus'](0x194);}return _0x4ee2b5;};}function handleError(_0x44e419,_0x541ef1){_0x541ef1=_0x541ef1||0x1f4;return function(_0x55db8f){logger['error'](_0x55db8f['stack']);if(_0x55db8f[_0x3e1e('0x1f')]){delete _0x55db8f[_0x3e1e('0x1f')];}_0x44e419['status'](_0x541ef1)[_0x3e1e('0x20')](_0x55db8f);};}exports['index']=function(_0xdfcd93,_0x176bb4){var _0x53a6ff={},_0x43e029={},_0x210a84={'count':0x0,'rows':[]};var _0x45ed0e=_['map'](db[_0x3e1e('0x21')]['rawAttributes'],function(_0x591c36){return{'name':_0x591c36['fieldName'],'type':_0x591c36[_0x3e1e('0x22')]['key']};});_0x43e029['model']=_[_0x3e1e('0x23')](_0x45ed0e,_0x3e1e('0x1f'));_0x43e029[_0x3e1e('0x24')]=_[_0x3e1e('0x25')](_0xdfcd93[_0x3e1e('0x24')]);_0x43e029['filters']=_['intersection'](_0x43e029['model'],_0x43e029['query']);_0x53a6ff[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x43e029[_0x3e1e('0x28')],qs[_0x3e1e('0x29')](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x29')]));_0x53a6ff[_0x3e1e('0x26')]=_0x53a6ff[_0x3e1e('0x26')]['length']?_0x53a6ff[_0x3e1e('0x26')]:_0x43e029[_0x3e1e('0x28')];if(!_0xdfcd93['query'][_0x3e1e('0x2a')](_0x3e1e('0x2b'))){_0x53a6ff[_0x3e1e('0x2c')]=qs[_0x3e1e('0x2c')](_0xdfcd93['query']['limit']);_0x53a6ff[_0x3e1e('0x18')]=qs[_0x3e1e('0x18')](_0xdfcd93['query'][_0x3e1e('0x18')]);}_0x53a6ff[_0x3e1e('0x2d')]=qs['sort'](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x2e')]);_0x53a6ff[_0x3e1e('0x2f')]=qs[_0x3e1e('0x30')](_[_0x3e1e('0x31')](_0xdfcd93['query'],_0x43e029[_0x3e1e('0x30')]),_0x45ed0e);if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x32')]){_0x53a6ff[_0x3e1e('0x2f')]=_['merge'](_0x53a6ff[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x45ed0e,function(_0x111da4){if(_0x111da4[_0x3e1e('0x22')]!==_0x3e1e('0x33')){var _0x25a95b={};_0x25a95b[_0x111da4[_0x3e1e('0x1f')]]={'$like':'%'+_0xdfcd93['query'][_0x3e1e('0x32')]+'%'};return _0x25a95b;}})});}_0x53a6ff=_['merge']({},_0x53a6ff,_0xdfcd93['options']);var _0x4f598e={'where':_0x53a6ff[_0x3e1e('0x2f')]};return db[_0x3e1e('0x21')]['count'](_0x4f598e)[_0x3e1e('0x1d')](function(_0xb030eb){_0x210a84['count']=_0xb030eb;if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x53a6ff['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x3e1e('0x35')](_0x53a6ff);})['then'](function(_0x4ff868){_0x210a84[_0x3e1e('0x36')]=_0x4ff868;return _0x210a84;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x176bb4,_0x53a6ff))[_0x3e1e('0x37')](handleError(_0x176bb4,null));};exports[_0x3e1e('0x38')]=function(_0x377a06,_0x55ea1d){var _0x5b32ad={'raw':![],'where':{'id':_0x377a06[_0x3e1e('0x39')]['id']}},_0x24b2ad={};_0x24b2ad[_0x3e1e('0x28')]=_['keys'](db[_0x3e1e('0x21')][_0x3e1e('0x3a')]);_0x24b2ad[_0x3e1e('0x24')]=_['keys'](_0x377a06[_0x3e1e('0x24')]);_0x24b2ad['filters']=_['intersection'](_0x24b2ad[_0x3e1e('0x28')],_0x24b2ad[_0x3e1e('0x24')]);_0x5b32ad[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x24b2ad['model'],qs['fields'](_0x377a06['query']['fields']));_0x5b32ad[_0x3e1e('0x26')]=_0x5b32ad[_0x3e1e('0x26')]['length']?_0x5b32ad['attributes']:_0x24b2ad[_0x3e1e('0x28')];if(_0x377a06[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x5b32ad['include']=[{'all':!![]}];}_0x5b32ad=_[_0x3e1e('0x3b')]({},_0x5b32ad,_0x377a06['options']);return db[_0x3e1e('0x21')][_0x3e1e('0x3c')](_0x5b32ad)[_0x3e1e('0x1d')](handleEntityNotFound(_0x55ea1d,null))[_0x3e1e('0x1d')](respondWithResult(_0x55ea1d,null))[_0x3e1e('0x37')](handleError(_0x55ea1d,null));};exports[_0x3e1e('0x3d')]=function(_0x53d32b,_0x2f14b3){return db[_0x3e1e('0x21')]['create'](_0x53d32b[_0x3e1e('0x3e')],{})[_0x3e1e('0x1d')](respondWithResult(_0x2f14b3,0xc9))['catch'](handleError(_0x2f14b3,null));};exports[_0x3e1e('0x3f')]=function(_0x347b3f,_0x2e286f){if(_0x347b3f[_0x3e1e('0x3e')]['id']){delete _0x347b3f['body']['id'];}return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0x347b3f[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x2e286f,null))['then'](saveUpdates(_0x347b3f[_0x3e1e('0x3e')],null))[_0x3e1e('0x1d')](respondWithResult(_0x2e286f,null))[_0x3e1e('0x37')](handleError(_0x2e286f,null));};exports[_0x3e1e('0x1e')]=function(_0xe2516c,_0x1df5a8){return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0xe2516c['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1df5a8,null))['then'](removeEntity(_0x1df5a8,null))['catch'](handleError(_0x1df5a8,null));};exports['getConfigurations']=function(_0x1c4269,_0x17641c,_0x5147a2){var _0x13b076={};var _0x592733={};var _0x5b2416;var _0x3eaf76;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1c4269['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x17641c,null))[_0x3e1e('0x1d')](function(_0x1334c8){if(_0x1334c8){_0x5b2416=_0x1334c8;_0x592733[_0x3e1e('0x28')]=_[_0x3e1e('0x25')](db[_0x3e1e('0x40')][_0x3e1e('0x3a')]);_0x592733['query']=_[_0x3e1e('0x25')](_0x1c4269['query']);_0x592733[_0x3e1e('0x30')]=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],_0x592733['query']);_0x13b076['attributes']=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],qs['fields'](_0x1c4269[_0x3e1e('0x24')]['fields']));_0x13b076['attributes']=_0x13b076[_0x3e1e('0x26')][_0x3e1e('0x41')]?_0x13b076['attributes']:_0x592733[_0x3e1e('0x28')];_0x13b076['order']=qs['sort'](_0x1c4269[_0x3e1e('0x24')]['sort']);_0x13b076[_0x3e1e('0x2f')]=qs['filters'](_[_0x3e1e('0x31')](_0x1c4269['query'],_0x592733[_0x3e1e('0x30')]));if(_0x1c4269[_0x3e1e('0x24')]['filter']){_0x13b076['where']=_['merge'](_0x13b076[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x13b076[_0x3e1e('0x26')],function(_0x588189){var _0x1b04ce={};_0x1b04ce[_0x588189]={'$like':'%'+_0x1c4269[_0x3e1e('0x24')][_0x3e1e('0x32')]+'%'};return _0x1b04ce;})});}_0x13b076=_['merge']({},_0x13b076,_0x1c4269['options']);return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x3b97a2){if(_0x3b97a2){_0x3eaf76=_0x3b97a2[_0x3e1e('0x41')];if(!_0x1c4269[_0x3e1e('0x24')]['hasOwnProperty'](_0x3e1e('0x2b'))){_0x13b076['limit']=qs[_0x3e1e('0x2c')](_0x1c4269[_0x3e1e('0x24')]['limit']);_0x13b076[_0x3e1e('0x18')]=qs['offset'](_0x1c4269[_0x3e1e('0x24')]['offset']);}return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x31062e){if(_0x31062e){return _0x31062e?{'count':_0x3eaf76,'rows':_0x31062e}:null;}})[_0x3e1e('0x1d')](respondWithResult(_0x17641c,null))[_0x3e1e('0x37')](handleError(_0x17641c,null));};exports['addConfiguration']=function(_0x11cab1,_0x1fbcfc,_0x4e6957){if(_0x11cab1[_0x3e1e('0x3e')]['id']){delete _0x11cab1['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x11cab1[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1fbcfc,null))[_0x3e1e('0x1d')](function(_0x4b0944){if(_0x4b0944){_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x43')]=_0x4b0944['id'];_0x11cab1[_0x3e1e('0x3e')]['Subjects']=integrations[_0x3e1e('0x44')](_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x45')],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x46')]=integrations[_0x3e1e('0x47')](_0x11cab1['body']['channel'],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);return db[_0x3e1e('0x40')][_0x3e1e('0x3d')](_0x11cab1[_0x3e1e('0x3e')],{'include':[{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x49')},{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x46')}]});}return null;})[_0x3e1e('0x1d')](respondWithResult(_0x1fbcfc,null))[_0x3e1e('0x37')](handleError(_0x1fbcfc,null));};exports[_0x3e1e('0x4a')]=function(_0x5e148e,_0x5581ee,_0x20bc4d){var _0x29ddc4='';return db[_0x3e1e('0x21')][_0x3e1e('0x4b')]({'where':{'id':_0x5e148e[_0x3e1e('0x39')]['id']},'attributes':['id','username',_0x3e1e('0x4c'),_0x3e1e('0x4d'),_0x3e1e('0x4e'),_0x3e1e('0x4f')]})[_0x3e1e('0x1d')](handleEntityNotFound(_0x5581ee,null))['then'](function(_0x8b6b28){if(_0x8b6b28){_0x29ddc4=_0x8b6b28[_0x3e1e('0x4f')];var _0xc60340=_0x29ddc4[_0x3e1e('0x50')](-0x1);if(_0xc60340==='/'){_0x29ddc4=_0x29ddc4[_0x3e1e('0x51')](0x0,_0x29ddc4[_0x3e1e('0x52')](_0xc60340));}var _0x4d0854={'method':_0x3e1e('0x53'),'uri':util[_0x3e1e('0x54')](_0x3e1e('0x55'),_0x29ddc4,_0x3e1e('0x56')),'json':!![]};switch(_0x8b6b28[_0x3e1e('0x4e')]){case _0x3e1e('0x4c'):_0x4d0854['headers']={'Authorization':util[_0x3e1e('0x54')](_0x3e1e('0x57'),new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x58'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4c')]))['toString'](_0x3e1e('0x5a')))};break;case'token':_0x4d0854[_0x3e1e('0x5b')]={'Authorization':util[_0x3e1e('0x54')]('Basic\x20%s',new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x5c'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4d')]))['toString'](_0x3e1e('0x5a')))};break;default:throw new db['Sequelize'][(_0x3e1e('0x5d'))](_0x3e1e('0x5e'));}return rp(_0x4d0854);}})[_0x3e1e('0x1d')](function(_0x632f99){if(_0x632f99){var _0x2ef476=[_0x3e1e('0x5f'),'description',_0x3e1e('0x60'),_0x3e1e('0x61')];_[_0x3e1e('0x62')](_0x632f99[_0x3e1e('0x56')],function(_0x4b4fd4){return _0x2ef476[_0x3e1e('0x63')](_0x4b4fd4[_0x3e1e('0x22')]);});return{'count':_0x632f99[_0x3e1e('0x56')][_0x3e1e('0x41')],'rows':_['map'](_0x632f99[_0x3e1e('0x56')],function(_0x41d98f){return{'id':_0x41d98f['id'],'name':_0x41d98f[_0x3e1e('0x64')]>0x7?_0x41d98f[_0x3e1e('0x65')]:_0x41d98f[_0x3e1e('0x22')],'custom':_0x41d98f[_0x3e1e('0x64')]>0x7?!![]:![],'options':_0x41d98f['system_field_options']?_0x41d98f['system_field_options']:_0x41d98f['custom_field_options']?_0x41d98f[_0x3e1e('0x66')]:[]};})};}})['then'](respondWithResult(_0x5581ee,null))[_0x3e1e('0x37')](function(_0x5f436f){var _0x32b5ef=_0x5e148e[_0x3e1e('0x24')][_0x3e1e('0x67')]?0x1f4:_0x5f436f[_0x3e1e('0x68')]||0x1f4;logger['error'](_0x3e1e('0x69'),'getFields',_0x32b5ef,JSON[_0x3e1e('0x6a')](_0x5f436f));delete _0x5f436f['name'];if(_0x32b5ef===0x191){_0x32b5ef=0x190;}_0x5581ee[_0x3e1e('0x19')](_0x32b5ef)[_0x3e1e('0x20')](_0x5e148e['query'][_0x3e1e('0x67')]?{'message':_0x3e1e('0x6b'),'statusCode':_0x5f436f[_0x3e1e('0x68')]}:_0x5f436f);});}; \ No newline at end of file +var _0xa478=['ZendeskAccount','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ZendeskField','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','index','map'];(function(_0x200e64,_0x510106){var _0x35e78d=function(_0x41005d){while(--_0x41005d){_0x200e64['push'](_0x200e64['shift']());}};_0x35e78d(++_0x510106);}(_0xa478,0x136));var _0x8a47=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xa478[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59efc7,_0x36941a){_0x36941a=_0x36941a||0xcc;return function(_0x12539c){if(_0x12539c){return _0x59efc7['sendStatus'](_0x36941a);}return _0x59efc7[_0x8a47('0x1a')](_0x36941a)[_0x8a47('0x1b')]();};}function respondWithResult(_0x1a9a6f,_0x55985c){_0x55985c=_0x55985c||0xc8;return function(_0x1c23e3){if(_0x1c23e3){return _0x1a9a6f[_0x8a47('0x1a')](_0x55985c)[_0x8a47('0x1c')](_0x1c23e3);}};}function respondWithFilteredResult(_0x1c8488,_0x41bdaf){return function(_0x18f2be){if(_0x18f2be){var _0x26fd48=typeof _0x41bdaf[_0x8a47('0x1d')]===_0x8a47('0x1e')&&typeof _0x41bdaf['limit']===_0x8a47('0x1e');var _0x1d0b04=_0x18f2be[_0x8a47('0x1f')];var _0x5f5884=_0x26fd48?0x0:_0x41bdaf[_0x8a47('0x1d')];var _0x5c62eb=_0x26fd48?_0x18f2be['count']:_0x41bdaf[_0x8a47('0x1d')]+_0x41bdaf[_0x8a47('0x20')];var _0x158e0c;if(_0x5c62eb>=_0x1d0b04){_0x5c62eb=_0x1d0b04;_0x158e0c=0xc8;}else{_0x158e0c=0xce;}_0x1c8488[_0x8a47('0x1a')](_0x158e0c);return _0x1c8488[_0x8a47('0x21')](_0x8a47('0x22'),_0x5f5884+'-'+_0x5c62eb+'/'+_0x1d0b04)[_0x8a47('0x1c')](_0x18f2be);}return null;};}function patchUpdates(_0x1bbed6){return function(_0x2b88a7){try{jsonpatch[_0x8a47('0x23')](_0x2b88a7,_0x1bbed6,!![]);}catch(_0x54ce6a){return BPromise[_0x8a47('0x24')](_0x54ce6a);}return _0x2b88a7['save']();};}function saveUpdates(_0x289f28,_0x3d7993){return function(_0x36908d){if(_0x36908d){return _0x36908d[_0x8a47('0x25')](_0x289f28)['then'](function(_0x116b5e){return _0x116b5e;});}return null;};}function removeEntity(_0x5ae186,_0x50f6ba){return function(_0x4d71f4){if(_0x4d71f4){return _0x4d71f4['destroy']()[_0x8a47('0x26')](function(){_0x5ae186[_0x8a47('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb0d4,_0xb4590d){return function(_0x42dae1){if(!_0x42dae1){_0x2bb0d4[_0x8a47('0x27')](0x194);}return _0x42dae1;};}function handleError(_0x44cf20,_0xd06be6){_0xd06be6=_0xd06be6||0x1f4;return function(_0x24a20b){logger['error'](_0x24a20b[_0x8a47('0x28')]);if(_0x24a20b['name']){delete _0x24a20b[_0x8a47('0x29')];}_0x44cf20[_0x8a47('0x1a')](_0xd06be6)['send'](_0x24a20b);};}exports[_0x8a47('0x2a')]=function(_0x526571,_0x4d5d32){var _0x12470a={},_0x9b51b8={},_0x1ddbcf={'count':0x0,'rows':[]};var _0x12f0b7=_[_0x8a47('0x2b')](db[_0x8a47('0x2c')]['rawAttributes'],function(_0x353576){return{'name':_0x353576['fieldName'],'type':_0x353576['type'][_0x8a47('0x2d')]};});_0x9b51b8[_0x8a47('0x2e')]=_[_0x8a47('0x2b')](_0x12f0b7,_0x8a47('0x29'));_0x9b51b8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x526571[_0x8a47('0x2f')]);_0x9b51b8[_0x8a47('0x31')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],_0x9b51b8['query']);_0x12470a[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],qs['fields'](_0x526571[_0x8a47('0x2f')][_0x8a47('0x34')]));_0x12470a['attributes']=_0x12470a[_0x8a47('0x33')][_0x8a47('0x35')]?_0x12470a[_0x8a47('0x33')]:_0x9b51b8[_0x8a47('0x2e')];if(!_0x526571['query']['hasOwnProperty'](_0x8a47('0x36'))){_0x12470a[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x20')]);_0x12470a[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x526571['query']['offset']);}_0x12470a[_0x8a47('0x37')]=qs[_0x8a47('0x38')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x38')]);_0x12470a[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x526571[_0x8a47('0x2f')],_0x9b51b8[_0x8a47('0x31')]),_0x12f0b7);if(_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0x12470a['where']=_[_0x8a47('0x3c')](_0x12470a['where'],{'$or':_['map'](_0x12f0b7,function(_0x544fe2){if(_0x544fe2['type']!=='VIRTUAL'){var _0x3edb2e={};_0x3edb2e[_0x544fe2[_0x8a47('0x29')]]={'$like':'%'+_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]+'%'};return _0x3edb2e;}})});}_0x12470a=_[_0x8a47('0x3c')]({},_0x12470a,_0x526571[_0x8a47('0x3d')]);var _0x25c45b={'where':_0x12470a[_0x8a47('0x39')]};return db['ZendeskAccount']['count'](_0x25c45b)[_0x8a47('0x26')](function(_0x437b86){_0x1ddbcf[_0x8a47('0x1f')]=_0x437b86;if(_0x526571[_0x8a47('0x2f')]['includeAll']){_0x12470a[_0x8a47('0x3e')]=[{'all':!![]}];}return db[_0x8a47('0x2c')][_0x8a47('0x3f')](_0x12470a);})[_0x8a47('0x26')](function(_0x1ef057){_0x1ddbcf['rows']=_0x1ef057;return _0x1ddbcf;})[_0x8a47('0x26')](respondWithFilteredResult(_0x4d5d32,_0x12470a))[_0x8a47('0x40')](handleError(_0x4d5d32,null));};exports[_0x8a47('0x41')]=function(_0x5d23ed,_0x2b3874){var _0x2c70ea={'raw':![],'where':{'id':_0x5d23ed[_0x8a47('0x42')]['id']}},_0xf313ec={};_0xf313ec['model']=_[_0x8a47('0x30')](db[_0x8a47('0x2c')][_0x8a47('0x43')]);_0xf313ec[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x5d23ed[_0x8a47('0x2f')]);_0xf313ec['filters']=_['intersection'](_0xf313ec[_0x8a47('0x2e')],_0xf313ec[_0x8a47('0x2f')]);_0x2c70ea[_0x8a47('0x33')]=_['intersection'](_0xf313ec[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x5d23ed['query']['fields']));_0x2c70ea[_0x8a47('0x33')]=_0x2c70ea['attributes'][_0x8a47('0x35')]?_0x2c70ea[_0x8a47('0x33')]:_0xf313ec[_0x8a47('0x2e')];if(_0x5d23ed[_0x8a47('0x2f')][_0x8a47('0x44')]){_0x2c70ea[_0x8a47('0x3e')]=[{'all':!![]}];}_0x2c70ea=_['merge']({},_0x2c70ea,_0x5d23ed['options']);return db[_0x8a47('0x2c')][_0x8a47('0x45')](_0x2c70ea)[_0x8a47('0x26')](handleEntityNotFound(_0x2b3874,null))[_0x8a47('0x26')](respondWithResult(_0x2b3874,null))[_0x8a47('0x40')](handleError(_0x2b3874,null));};exports['create']=function(_0x4898d0,_0x17a755){return db['ZendeskAccount'][_0x8a47('0x46')](_0x4898d0[_0x8a47('0x47')],{})['then'](respondWithResult(_0x17a755,0xc9))[_0x8a47('0x40')](handleError(_0x17a755,null));};exports[_0x8a47('0x25')]=function(_0x14e22c,_0x108c7f){if(_0x14e22c[_0x8a47('0x47')]['id']){delete _0x14e22c[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0x14e22c['params']['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x108c7f,null))[_0x8a47('0x26')](saveUpdates(_0x14e22c[_0x8a47('0x47')],null))[_0x8a47('0x26')](respondWithResult(_0x108c7f,null))['catch'](handleError(_0x108c7f,null));};exports[_0x8a47('0x48')]=function(_0xa428dd,_0x24e123){return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0xa428dd[_0x8a47('0x42')]['id']}})['then'](handleEntityNotFound(_0x24e123,null))['then'](removeEntity(_0x24e123,null))[_0x8a47('0x40')](handleError(_0x24e123,null));};exports['getConfigurations']=function(_0x1da8b7,_0x175023,_0x5a1b29){var _0xb05ed1={};var _0x4bf9a8={};var _0x315111;var _0x5c5577;return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x1da8b7[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x175023,null))[_0x8a47('0x26')](function(_0x144ce6){if(_0x144ce6){_0x315111=_0x144ce6;_0x4bf9a8[_0x8a47('0x2e')]=_[_0x8a47('0x30')](db[_0x8a47('0x49')][_0x8a47('0x43')]);_0x4bf9a8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x1da8b7[_0x8a47('0x2f')]);_0x4bf9a8['filters']=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],_0x4bf9a8['query']);_0xb05ed1[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x34')]));_0xb05ed1[_0x8a47('0x33')]=_0xb05ed1[_0x8a47('0x33')][_0x8a47('0x35')]?_0xb05ed1[_0x8a47('0x33')]:_0x4bf9a8[_0x8a47('0x2e')];_0xb05ed1[_0x8a47('0x37')]=qs['sort'](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x38')]);_0xb05ed1[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x1da8b7[_0x8a47('0x2f')],_0x4bf9a8[_0x8a47('0x31')]));if(_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0xb05ed1[_0x8a47('0x39')]=_[_0x8a47('0x3c')](_0xb05ed1[_0x8a47('0x39')],{'$or':_[_0x8a47('0x2b')](_0xb05ed1[_0x8a47('0x33')],function(_0x2edcaf){var _0x7664a8={};_0x7664a8[_0x2edcaf]={'$like':'%'+_0x1da8b7['query'][_0x8a47('0x3b')]+'%'};return _0x7664a8;})});}_0xb05ed1=_['merge']({},_0xb05ed1,_0x1da8b7[_0x8a47('0x3d')]);return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x21fdb5){if(_0x21fdb5){_0x5c5577=_0x21fdb5[_0x8a47('0x35')];if(!_0x1da8b7[_0x8a47('0x2f')]['hasOwnProperty'](_0x8a47('0x36'))){_0xb05ed1[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x1da8b7['query']['limit']);_0xb05ed1[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x1da8b7['query'][_0x8a47('0x1d')]);}return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x17f20f){if(_0x17f20f){return _0x17f20f?{'count':_0x5c5577,'rows':_0x17f20f}:null;}})[_0x8a47('0x26')](respondWithResult(_0x175023,null))[_0x8a47('0x40')](handleError(_0x175023,null));};exports[_0x8a47('0x4b')]=function(_0x2932f1,_0x99848c,_0x1b834a){if(_0x2932f1[_0x8a47('0x47')]['id']){delete _0x2932f1[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x2932f1[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x99848c,null))[_0x8a47('0x26')](function(_0x13a002){if(_0x13a002){_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4c')]=_0x13a002['id'];_0x2932f1['body'][_0x8a47('0x4d')]=integrations['getSubjects'](_0x2932f1['body'][_0x8a47('0x4e')],_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4f')]);_0x2932f1[_0x8a47('0x47')][_0x8a47('0x50')]=integrations[_0x8a47('0x51')](_0x2932f1['body']['channel'],_0x2932f1[_0x8a47('0x47')]['type']);return db[_0x8a47('0x49')][_0x8a47('0x46')](_0x2932f1[_0x8a47('0x47')],{'include':[{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x4d')},{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x50')}]});}return null;})[_0x8a47('0x26')](respondWithResult(_0x99848c,null))['catch'](handleError(_0x99848c,null));};exports['getFields']=function(_0x435039,_0x131176,_0x2761bf){var _0x5d6ebc='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x435039[_0x8a47('0x42')]['id']},'attributes':['id','username',_0x8a47('0x53'),_0x8a47('0x54'),_0x8a47('0x55'),_0x8a47('0x56')]})['then'](handleEntityNotFound(_0x131176,null))[_0x8a47('0x26')](function(_0x55c590){if(_0x55c590){_0x5d6ebc=_0x55c590[_0x8a47('0x56')];var _0x430ee2=_0x5d6ebc[_0x8a47('0x57')](-0x1);if(_0x430ee2==='/'){_0x5d6ebc=_0x5d6ebc['substring'](0x0,_0x5d6ebc[_0x8a47('0x58')](_0x430ee2));}var _0x3f53ba={'method':'GET','uri':util[_0x8a47('0x59')](_0x8a47('0x5a'),_0x5d6ebc,_0x8a47('0x5b')),'json':!![]};switch(_0x55c590[_0x8a47('0x55')]){case _0x8a47('0x53'):_0x3f53ba[_0x8a47('0x5c')]={'Authorization':util[_0x8a47('0x59')](_0x8a47('0x5d'),new Buffer(util['format'](_0x8a47('0x5e'),_0x55c590[_0x8a47('0x5f')],_0x55c590['password']))[_0x8a47('0x60')](_0x8a47('0x61')))};break;case'token':_0x3f53ba[_0x8a47('0x5c')]={'Authorization':util[_0x8a47('0x59')](_0x8a47('0x5d'),new Buffer(util[_0x8a47('0x59')](_0x8a47('0x62'),_0x55c590['username'],_0x55c590['token']))[_0x8a47('0x60')](_0x8a47('0x61')))};break;default:throw new db[(_0x8a47('0x63'))][(_0x8a47('0x64'))](_0x8a47('0x65'));}return rp(_0x3f53ba);}})[_0x8a47('0x26')](function(_0x34bb61){if(_0x34bb61){var _0x4845fa=[_0x8a47('0x66'),_0x8a47('0x67'),_0x8a47('0x68'),'assignee'];_[_0x8a47('0x69')](_0x34bb61[_0x8a47('0x5b')],function(_0xa2ea5c){return _0x4845fa[_0x8a47('0x6a')](_0xa2ea5c[_0x8a47('0x4f')]);});return{'count':_0x34bb61[_0x8a47('0x5b')][_0x8a47('0x35')],'rows':_[_0x8a47('0x2b')](_0x34bb61['ticket_fields'],function(_0x509e91){return{'id':_0x509e91['id'],'name':_0x509e91[_0x8a47('0x6b')]>0x7?_0x509e91[_0x8a47('0x6c')]:_0x509e91[_0x8a47('0x4f')],'custom':_0x509e91['position']>0x7?!![]:![],'options':_0x509e91[_0x8a47('0x6d')]?_0x509e91[_0x8a47('0x6d')]:_0x509e91[_0x8a47('0x6e')]?_0x509e91[_0x8a47('0x6e')]:[]};})};}})[_0x8a47('0x26')](respondWithResult(_0x131176,null))[_0x8a47('0x40')](function(_0x18def4){var _0x2a2379=_0x435039[_0x8a47('0x2f')][_0x8a47('0x6f')]?0x1f4:_0x18def4[_0x8a47('0x70')]||0x1f4;logger[_0x8a47('0x71')]('getFields,\x20%s,\x20%s,\x20%s',_0x8a47('0x72'),_0x2a2379,JSON[_0x8a47('0x73')](_0x18def4));delete _0x18def4[_0x8a47('0x29')];if(_0x2a2379===0x191){_0x2a2379=0x190;}_0x131176[_0x8a47('0x1a')](_0x2a2379)[_0x8a47('0x74')](_0x435039[_0x8a47('0x2f')][_0x8a47('0x6f')]?{'message':_0x8a47('0x75'),'statusCode':_0x18def4[_0x8a47('0x70')]}:_0x18def4);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index aa0f92a..cd1b55a 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 _0x49d9=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','util','../../config/logger','api','moment'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x49d9,0x100));var _0x949d=function(_0x2bce55,_0x444cfe){_0x2bce55=_0x2bce55-0x0;var _0x18951e=_0x49d9[_0x2bce55];return _0x18951e;};'use strict';var _=require('lodash');var util=require(_0x949d('0x0'));var logger=require(_0x949d('0x1'))(_0x949d('0x2'));var moment=require(_0x949d('0x3'));var BPromise=require(_0x949d('0x4'));var rp=require(_0x949d('0x5'));var fs=require('fs');var path=require(_0x949d('0x6'));var rimraf=require(_0x949d('0x7'));var config=require('../../config/environment');var attributes=require(_0x949d('0x8'));var integrations=require(_0x949d('0x9'));module[_0x949d('0xa')]=function(_0x49f1a7,_0x5dfd9a){return _0x49f1a7[_0x949d('0xb')](_0x949d('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6407=['rimraf','../../config/environment','../../components/integrations/configuration','exports','int_zendesk_accounts','util','api','moment','bluebird','request-promise','path'];(function(_0x4c1b17,_0x4c3bb8){var _0x23694a=function(_0x102927){while(--_0x102927){_0x4c1b17['push'](_0x4c1b17['shift']());}};_0x23694a(++_0x4c3bb8);}(_0x6407,0xb5));var _0x7640=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x6407[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0x7640('0x0'));var logger=require('../../config/logger')(_0x7640('0x1'));var moment=require(_0x7640('0x2'));var BPromise=require(_0x7640('0x3'));var rp=require(_0x7640('0x4'));var fs=require('fs');var path=require(_0x7640('0x5'));var rimraf=require(_0x7640('0x6'));var config=require(_0x7640('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x7640('0x8'));module[_0x7640('0x9')]=function(_0x59a1d3,_0x14f438){return _0x59a1d3['define']('ZendeskAccount',attributes,{'tableName':_0x7640('0xa'),'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 73e7a74..8f34a62 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 _0x0018=['attributes','map','model','then','ShowZendeskAccount','find','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','include'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x0018,0xa6));var _0x8001=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0018[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x8001('0x0'));var moment=require(_0x8001('0x1'));var BPromise=require('bluebird');var rs=require(_0x8001('0x2'));var fs=require('fs');var Redis=require(_0x8001('0x3'));var db=require(_0x8001('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8001('0x5'));var config=require('../../config/environment');var jayson=require(_0x8001('0x6'));var client=jayson[_0x8001('0x7')][_0x8001('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ddbf5,_0x2af1c0,_0x3fd295){return new BPromise(function(_0x1f6c20,_0x267853){return client[_0x8001('0x9')](_0x2ddbf5,_0x3fd295)['then'](function(_0x138b9b){logger['info'](_0x8001('0xa'),_0x2af1c0,_0x8001('0xb'));logger[_0x8001('0xc')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2af1c0,_0x8001('0xb'),JSON[_0x8001('0xd')](_0x138b9b));if(_0x138b9b[_0x8001('0xe')]){if(_0x138b9b['error'][_0x8001('0xf')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2af1c0,_0x138b9b[_0x8001('0xe')]['message']);return _0x267853(_0x138b9b['error'][_0x8001('0x10')]);}logger[_0x8001('0xe')](_0x8001('0xa'),_0x2af1c0,_0x138b9b[_0x8001('0xe')]['message']);return _0x1f6c20(_0x138b9b[_0x8001('0xe')]['message']);}else{logger[_0x8001('0x11')](_0x8001('0xa'),_0x2af1c0,_0x8001('0xb'));_0x1f6c20(_0x138b9b[_0x8001('0x12')][_0x8001('0x10')]);}})[_0x8001('0x13')](function(_0x1f1b4d){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2af1c0,_0x1f1b4d);_0x267853(_0x1f1b4d);});});}exports[_0x8001('0x14')]=function(_0xfe41df){var _0x30723f=this;return new Promise(function(_0x5390fc,_0x1b8139){return db[_0x8001('0x15')][_0x8001('0x16')]({'raw':_0xfe41df[_0x8001('0x17')]?_0xfe41df[_0x8001('0x17')][_0x8001('0x18')]===undefined?!![]:![]:!![],'where':_0xfe41df[_0x8001('0x17')]?_0xfe41df['options']['where']||null:null,'attributes':_0xfe41df[_0x8001('0x17')]?_0xfe41df[_0x8001('0x17')]['attributes']||null:null,'limit':_0xfe41df[_0x8001('0x17')]?_0xfe41df[_0x8001('0x17')]['limit']||null:null,'include':_0xfe41df[_0x8001('0x17')]?_0xfe41df[_0x8001('0x17')][_0x8001('0x19')]?_['map'](_0xfe41df['options'][_0x8001('0x19')],function(_0x57083c){return{'model':db[_0x57083c['model']],'as':_0x57083c['as'],'attributes':_0x57083c['attributes'],'include':_0x57083c['include']?_['map'](_0x57083c[_0x8001('0x19')],function(_0x26c3f9){return{'model':db[_0x26c3f9['model']],'as':_0x26c3f9['as'],'attributes':_0x26c3f9[_0x8001('0x1a')],'include':_0x26c3f9[_0x8001('0x19')]?_[_0x8001('0x1b')](_0x26c3f9['include'],function(_0x25e9b8){return{'model':db[_0x25e9b8[_0x8001('0x1c')]],'as':_0x25e9b8['as'],'attributes':_0x25e9b8[_0x8001('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8001('0x1d')](function(_0x54fedb){logger['info'](_0x8001('0x14'),_0xfe41df);logger[_0x8001('0xc')]('GetZendeskAccount',_0xfe41df,JSON[_0x8001('0xd')](_0x54fedb));_0x5390fc(_0x54fedb);})[_0x8001('0x13')](function(_0xc5ca3c){logger[_0x8001('0xe')](_0x8001('0x14'),_0xc5ca3c[_0x8001('0x10')],_0xfe41df);_0x1b8139(_0x30723f[_0x8001('0xe')](0x1f4,_0xc5ca3c[_0x8001('0x10')]));});});};exports[_0x8001('0x1e')]=function(_0xe00472){var _0x190925=this;return new Promise(function(_0x3ffbdd,_0x37efa5){return db[_0x8001('0x15')][_0x8001('0x1f')]({'raw':_0xe00472[_0x8001('0x17')]?_0xe00472['options']['raw']===undefined?!![]:![]:!![],'where':_0xe00472[_0x8001('0x17')]?_0xe00472[_0x8001('0x17')]['where']||null:null,'attributes':_0xe00472[_0x8001('0x17')]?_0xe00472['options']['attributes']||null:null,'include':_0xe00472['options']?_0xe00472[_0x8001('0x17')][_0x8001('0x19')]?_[_0x8001('0x1b')](_0xe00472['options'][_0x8001('0x19')],function(_0xc9ad5f){return{'model':db[_0xc9ad5f['model']],'as':_0xc9ad5f['as'],'attributes':_0xc9ad5f[_0x8001('0x1a')],'include':_0xc9ad5f['include']?_['map'](_0xc9ad5f[_0x8001('0x19')],function(_0x3389fe){return{'model':db[_0x3389fe[_0x8001('0x1c')]],'as':_0x3389fe['as'],'attributes':_0x3389fe[_0x8001('0x1a')],'include':_0x3389fe[_0x8001('0x19')]?_[_0x8001('0x1b')](_0x3389fe[_0x8001('0x19')],function(_0x3ee942){return{'model':db[_0x3ee942[_0x8001('0x1c')]],'as':_0x3ee942['as'],'attributes':_0x3ee942[_0x8001('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8001('0x1d')](function(_0x501f4b){logger[_0x8001('0x11')](_0x8001('0x1e'),_0xe00472);logger[_0x8001('0xc')](_0x8001('0x1e'),_0xe00472,JSON[_0x8001('0xd')](_0x501f4b));_0x3ffbdd(_0x501f4b);})['catch'](function(_0x4bbe61){logger[_0x8001('0xe')](_0x8001('0x1e'),_0x4bbe61[_0x8001('0x10')],_0xe00472);_0x37efa5(_0x190925[_0x8001('0xe')](0x1f4,_0x4bbe61[_0x8001('0x10')]));});});}; \ No newline at end of file +var _0xee2d=['jayson/promise','client','http','request','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','options','raw','where','attributes','map','include','model','then','ZendeskAccount','find','ShowZendeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xecab6a,_0x3c768a){var _0x40b98b=function(_0x448a28){while(--_0x448a28){_0xecab6a['push'](_0xecab6a['shift']());}};_0x40b98b(++_0x3c768a);}(_0xee2d,0xcf));var _0xdee2=function(_0xb65b81,_0x3a8a23){_0xb65b81=_0xb65b81-0x0;var _0x23091e=_0xee2d[_0xb65b81];return _0x23091e;};'use strict';var _=require(_0xdee2('0x0'));var util=require(_0xdee2('0x1'));var moment=require(_0xdee2('0x2'));var BPromise=require(_0xdee2('0x3'));var rs=require(_0xdee2('0x4'));var fs=require('fs');var Redis=require(_0xdee2('0x5'));var db=require(_0xdee2('0x6'))['db'];var utils=require(_0xdee2('0x7'));var logger=require('../../config/logger')(_0xdee2('0x8'));var config=require('../../config/environment');var jayson=require(_0xdee2('0x9'));var client=jayson[_0xdee2('0xa')][_0xdee2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xafad92,_0x3d0f68,_0x468162){return new BPromise(function(_0xef050f,_0x571930){return client[_0xdee2('0xc')](_0xafad92,_0x468162)['then'](function(_0x5cfa55){logger[_0xdee2('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x3d0f68,'request\x20sent');logger[_0xdee2('0xe')](_0xdee2('0xf'),_0x3d0f68,_0xdee2('0x10'),JSON[_0xdee2('0x11')](_0x5cfa55));if(_0x5cfa55[_0xdee2('0x12')]){if(_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x13')]===0x1f4){logger[_0xdee2('0x12')](_0xdee2('0x14'),_0x3d0f68,_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x15')]);return _0x571930(_0x5cfa55['error'][_0xdee2('0x15')]);}logger[_0xdee2('0x12')](_0xdee2('0x14'),_0x3d0f68,_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x15')]);return _0xef050f(_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x15')]);}else{logger[_0xdee2('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x3d0f68,_0xdee2('0x10'));_0xef050f(_0x5cfa55[_0xdee2('0x16')]['message']);}})['catch'](function(_0x389188){logger['error'](_0xdee2('0x14'),_0x3d0f68,_0x389188);_0x571930(_0x389188);});});}exports[_0xdee2('0x17')]=function(_0x495878){var _0x487351=this;return new Promise(function(_0x55edeb,_0x1936ac){return db['ZendeskAccount']['findAll']({'raw':_0x495878[_0xdee2('0x18')]?_0x495878[_0xdee2('0x18')][_0xdee2('0x19')]===undefined?!![]:![]:!![],'where':_0x495878[_0xdee2('0x18')]?_0x495878[_0xdee2('0x18')][_0xdee2('0x1a')]||null:null,'attributes':_0x495878[_0xdee2('0x18')]?_0x495878[_0xdee2('0x18')][_0xdee2('0x1b')]||null:null,'limit':_0x495878[_0xdee2('0x18')]?_0x495878['options']['limit']||null:null,'include':_0x495878[_0xdee2('0x18')]?_0x495878['options']['include']?_[_0xdee2('0x1c')](_0x495878[_0xdee2('0x18')][_0xdee2('0x1d')],function(_0x583f38){return{'model':db[_0x583f38[_0xdee2('0x1e')]],'as':_0x583f38['as'],'attributes':_0x583f38['attributes'],'include':_0x583f38[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x583f38['include'],function(_0x140e07){return{'model':db[_0x140e07[_0xdee2('0x1e')]],'as':_0x140e07['as'],'attributes':_0x140e07[_0xdee2('0x1b')],'include':_0x140e07[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x140e07[_0xdee2('0x1d')],function(_0x37a75c){return{'model':db[_0x37a75c[_0xdee2('0x1e')]],'as':_0x37a75c['as'],'attributes':_0x37a75c[_0xdee2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdee2('0x1f')](function(_0x2bbafa){logger[_0xdee2('0xd')](_0xdee2('0x17'),_0x495878);logger[_0xdee2('0xe')]('GetZendeskAccount',_0x495878,JSON['stringify'](_0x2bbafa));_0x55edeb(_0x2bbafa);})['catch'](function(_0x107304){logger[_0xdee2('0x12')](_0xdee2('0x17'),_0x107304[_0xdee2('0x15')],_0x495878);_0x1936ac(_0x487351[_0xdee2('0x12')](0x1f4,_0x107304[_0xdee2('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x53f5f8){var _0x3d8c67=this;return new Promise(function(_0x3a819b,_0x37f196){return db[_0xdee2('0x20')][_0xdee2('0x21')]({'raw':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x19')]===undefined?!![]:![]:!![],'where':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x1a')]||null:null,'attributes':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x1b')]||null:null,'include':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x53f5f8[_0xdee2('0x18')]['include'],function(_0x12b1db){return{'model':db[_0x12b1db[_0xdee2('0x1e')]],'as':_0x12b1db['as'],'attributes':_0x12b1db['attributes'],'include':_0x12b1db[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x12b1db[_0xdee2('0x1d')],function(_0x4b0471){return{'model':db[_0x4b0471[_0xdee2('0x1e')]],'as':_0x4b0471['as'],'attributes':_0x4b0471[_0xdee2('0x1b')],'include':_0x4b0471[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x4b0471[_0xdee2('0x1d')],function(_0x29c53f){return{'model':db[_0x29c53f['model']],'as':_0x29c53f['as'],'attributes':_0x29c53f[_0xdee2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57b573){logger[_0xdee2('0xd')](_0xdee2('0x22'),_0x53f5f8);logger[_0xdee2('0xe')](_0xdee2('0x22'),_0x53f5f8,JSON[_0xdee2('0x11')](_0x57b573));_0x3a819b(_0x57b573);})[_0xdee2('0x23')](function(_0x3e95bd){logger[_0xdee2('0x12')](_0xdee2('0x22'),_0x3e95bd[_0xdee2('0x15')],_0x53f5f8);_0x37f196(_0x3d8c67['error'](0x1f4,_0x3e95bd[_0xdee2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5189704..dcfd195 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xb688,0xcf));var _0x8b68=function(_0x278cc5,_0x1b4de0){_0x278cc5=_0x278cc5-0x0;var _0x3d0190=_0xb688[_0x278cc5];return _0x3d0190;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x878f,0x173));var _0xf878=function(_0x5a1819,_0x2718de){_0x5a1819=_0x5a1819-0x0;var _0x44948d=_0x878f[_0x5a1819];return _0x44948d;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0fe7f9d..2bb1ca4 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 _0x79d2=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79d2,0x187));var _0x279d=function(_0x168478,_0x323a27){_0x168478=_0x168478-0x0;var _0x29c2f8=_0x79d2[_0x168478];return _0x29c2f8;};'use strict';var Sequelize=require(_0x279d('0x0'));module[_0x279d('0x1')]={'name':{'type':Sequelize[_0x279d('0x2')]},'description':{'type':Sequelize[_0x279d('0x2')]}}; \ No newline at end of file +var _0x842d=['STRING','sequelize'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x842d,0x10f));var _0xd842=function(_0x7d5a8b,_0x2aedef){_0x7d5a8b=_0x7d5a8b-0x0;var _0x56ac46=_0x842d[_0x7d5a8b];return _0x56ac46;};'use strict';var Sequelize=require(_0xd842('0x0'));module['exports']={'name':{'type':Sequelize[_0xd842('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0c0d953..e39cdb7 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 _0xc474=['keys','find','create','body','getFields','findOne','order','pick','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xc474,0x65));var _0x4c47=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xc474[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x4c47('0x0'));var rimraf=require(_0x4c47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c47('0x2'));var rp=require(_0x4c47('0x3'));var moment=require(_0x4c47('0x4'));var BPromise=require(_0x4c47('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c47('0x6'));var sox=require(_0x4c47('0x7'));var csv=require(_0x4c47('0x8'));var ejs=require(_0x4c47('0x9'));var fs=require('fs');var fs_extra=require(_0x4c47('0xa'));var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c47('0xd'));var toCsv=require(_0x4c47('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4c47('0xe'));var authService=require(_0x4c47('0xf'));var qs=require(_0x4c47('0x10'));var as=require(_0x4c47('0x11'));var hardwareService=require(_0x4c47('0x12'));var logger=require(_0x4c47('0x13'))(_0x4c47('0x14'));var utils=require(_0x4c47('0x15'));var config=require(_0x4c47('0x16'));var licenseUtil=require(_0x4c47('0x17'));var db=require(_0x4c47('0x18'))['db'];function respondWithStatusCode(_0x1420fd,_0xf8413f){_0xf8413f=_0xf8413f||0xcc;return function(_0x241a57){if(_0x241a57){return _0x1420fd[_0x4c47('0x19')](_0xf8413f);}return _0x1420fd[_0x4c47('0x1a')](_0xf8413f)[_0x4c47('0x1b')]();};}function respondWithResult(_0x4560aa,_0x19754c){_0x19754c=_0x19754c||0xc8;return function(_0x13105a){if(_0x13105a){return _0x4560aa['status'](_0x19754c)[_0x4c47('0x1c')](_0x13105a);}};}function respondWithFilteredResult(_0x38049d,_0x5f3c83){return function(_0x54539c){if(_0x54539c){var _0x2fae95=typeof _0x5f3c83[_0x4c47('0x1d')]==='undefined'&&typeof _0x5f3c83[_0x4c47('0x1e')]===_0x4c47('0x1f');var _0x238108=_0x54539c[_0x4c47('0x20')];var _0x4f8e3b=_0x2fae95?0x0:_0x5f3c83[_0x4c47('0x1d')];var _0x3494ff=_0x2fae95?_0x54539c['count']:_0x5f3c83[_0x4c47('0x1d')]+_0x5f3c83[_0x4c47('0x1e')];var _0x5f26bc;if(_0x3494ff>=_0x238108){_0x3494ff=_0x238108;_0x5f26bc=0xc8;}else{_0x5f26bc=0xce;}_0x38049d[_0x4c47('0x1a')](_0x5f26bc);return _0x38049d[_0x4c47('0x21')](_0x4c47('0x22'),_0x4f8e3b+'-'+_0x3494ff+'/'+_0x238108)['json'](_0x54539c);}return null;};}function patchUpdates(_0x960309){return function(_0x531fcb){try{jsonpatch['apply'](_0x531fcb,_0x960309,!![]);}catch(_0x23f356){return BPromise[_0x4c47('0x23')](_0x23f356);}return _0x531fcb[_0x4c47('0x24')]();};}function saveUpdates(_0x30d0b9,_0x3c0566){return function(_0x1e6b42){if(_0x1e6b42){return _0x1e6b42[_0x4c47('0x25')](_0x30d0b9)[_0x4c47('0x26')](function(_0x1e6eb6){return _0x1e6eb6;});}return null;};}function removeEntity(_0x192480,_0x4f525c){return function(_0x57e944){if(_0x57e944){return _0x57e944[_0x4c47('0x27')]()['then'](function(){_0x192480[_0x4c47('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x428e89,_0x1cd75d){return function(_0x456d7f){if(!_0x456d7f){_0x428e89[_0x4c47('0x19')](0x194);}return _0x456d7f;};}function handleError(_0x2753ef,_0x1343e7){_0x1343e7=_0x1343e7||0x1f4;return function(_0x592cec){logger['error'](_0x592cec[_0x4c47('0x28')]);if(_0x592cec[_0x4c47('0x29')]){delete _0x592cec[_0x4c47('0x29')];}_0x2753ef[_0x4c47('0x1a')](_0x1343e7)['send'](_0x592cec);};}exports[_0x4c47('0x2a')]=function(_0x23a980,_0x273b1c){var _0x21c927={},_0x33cfaf={},_0x85daf4={'count':0x0,'rows':[]};var _0x527c51=_[_0x4c47('0x2b')](db[_0x4c47('0x2c')][_0x4c47('0x2d')],function(_0x3ae637){return{'name':_0x3ae637[_0x4c47('0x2e')],'type':_0x3ae637[_0x4c47('0x2f')][_0x4c47('0x30')]};});_0x33cfaf[_0x4c47('0x31')]=_[_0x4c47('0x2b')](_0x527c51,_0x4c47('0x29'));_0x33cfaf[_0x4c47('0x32')]=_['keys'](_0x23a980['query']);_0x33cfaf[_0x4c47('0x33')]=_[_0x4c47('0x34')](_0x33cfaf[_0x4c47('0x31')],_0x33cfaf['query']);_0x21c927[_0x4c47('0x35')]=_['intersection'](_0x33cfaf[_0x4c47('0x31')],qs[_0x4c47('0x36')](_0x23a980[_0x4c47('0x32')][_0x4c47('0x36')]));_0x21c927[_0x4c47('0x35')]=_0x21c927[_0x4c47('0x35')][_0x4c47('0x37')]?_0x21c927[_0x4c47('0x35')]:_0x33cfaf['model'];if(!_0x23a980[_0x4c47('0x32')]['hasOwnProperty'](_0x4c47('0x38'))){_0x21c927[_0x4c47('0x1e')]=qs[_0x4c47('0x1e')](_0x23a980[_0x4c47('0x32')]['limit']);_0x21c927[_0x4c47('0x1d')]=qs[_0x4c47('0x1d')](_0x23a980[_0x4c47('0x32')][_0x4c47('0x1d')]);}_0x21c927['order']=qs['sort'](_0x23a980[_0x4c47('0x32')][_0x4c47('0x39')]);_0x21c927[_0x4c47('0x3a')]=qs['filters'](_['pick'](_0x23a980[_0x4c47('0x32')],_0x33cfaf[_0x4c47('0x33')]),_0x527c51);if(_0x23a980['query'][_0x4c47('0x3b')]){_0x21c927[_0x4c47('0x3a')]=_[_0x4c47('0x3c')](_0x21c927['where'],{'$or':_[_0x4c47('0x2b')](_0x527c51,function(_0x5d3903){if(_0x5d3903[_0x4c47('0x2f')]!=='VIRTUAL'){var _0x59f0c7={};_0x59f0c7[_0x5d3903[_0x4c47('0x29')]]={'$like':'%'+_0x23a980['query']['filter']+'%'};return _0x59f0c7;}})});}_0x21c927=_[_0x4c47('0x3c')]({},_0x21c927,_0x23a980[_0x4c47('0x3d')]);var _0x226693={'where':_0x21c927[_0x4c47('0x3a')]};return db[_0x4c47('0x2c')]['count'](_0x226693)[_0x4c47('0x26')](function(_0xdab9ca){_0x85daf4[_0x4c47('0x20')]=_0xdab9ca;if(_0x23a980[_0x4c47('0x32')][_0x4c47('0x3e')]){_0x21c927[_0x4c47('0x3f')]=[{'all':!![]}];}return db[_0x4c47('0x2c')][_0x4c47('0x40')](_0x21c927);})[_0x4c47('0x26')](function(_0x24bb5f){_0x85daf4[_0x4c47('0x41')]=_0x24bb5f;return _0x85daf4;})[_0x4c47('0x26')](respondWithFilteredResult(_0x273b1c,_0x21c927))[_0x4c47('0x42')](handleError(_0x273b1c,null));};exports[_0x4c47('0x43')]=function(_0x31afae,_0x33b1bd){var _0x566141={'raw':![],'where':{'id':_0x31afae[_0x4c47('0x44')]['id']}},_0x4b4aba={};_0x4b4aba[_0x4c47('0x31')]=_[_0x4c47('0x45')](db[_0x4c47('0x2c')]['rawAttributes']);_0x4b4aba[_0x4c47('0x32')]=_['keys'](_0x31afae[_0x4c47('0x32')]);_0x4b4aba[_0x4c47('0x33')]=_[_0x4c47('0x34')](_0x4b4aba['model'],_0x4b4aba[_0x4c47('0x32')]);_0x566141[_0x4c47('0x35')]=_[_0x4c47('0x34')](_0x4b4aba['model'],qs['fields'](_0x31afae[_0x4c47('0x32')][_0x4c47('0x36')]));_0x566141[_0x4c47('0x35')]=_0x566141[_0x4c47('0x35')][_0x4c47('0x37')]?_0x566141[_0x4c47('0x35')]:_0x4b4aba[_0x4c47('0x31')];if(_0x31afae[_0x4c47('0x32')][_0x4c47('0x3e')]){_0x566141['include']=[{'all':!![]}];}_0x566141=_[_0x4c47('0x3c')]({},_0x566141,_0x31afae[_0x4c47('0x3d')]);return db[_0x4c47('0x2c')][_0x4c47('0x46')](_0x566141)[_0x4c47('0x26')](handleEntityNotFound(_0x33b1bd,null))['then'](respondWithResult(_0x33b1bd,null))[_0x4c47('0x42')](handleError(_0x33b1bd,null));};exports[_0x4c47('0x47')]=function(_0x530687,_0x2134f1){return db[_0x4c47('0x2c')]['create'](_0x530687[_0x4c47('0x48')],{})[_0x4c47('0x26')](respondWithResult(_0x2134f1,0xc9))['catch'](handleError(_0x2134f1,null));};exports[_0x4c47('0x25')]=function(_0xcfabbb,_0x1d6dd7){if(_0xcfabbb[_0x4c47('0x48')]['id']){delete _0xcfabbb[_0x4c47('0x48')]['id'];}return db[_0x4c47('0x2c')][_0x4c47('0x46')]({'where':{'id':_0xcfabbb[_0x4c47('0x44')]['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x1d6dd7,null))['then'](saveUpdates(_0xcfabbb[_0x4c47('0x48')],null))[_0x4c47('0x26')](respondWithResult(_0x1d6dd7,null))[_0x4c47('0x42')](handleError(_0x1d6dd7,null));};exports[_0x4c47('0x27')]=function(_0xbbe030,_0x2f8448){return db[_0x4c47('0x2c')]['find']({'where':{'id':_0xbbe030['params']['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x2f8448,null))['then'](removeEntity(_0x2f8448,null))[_0x4c47('0x42')](handleError(_0x2f8448,null));};exports[_0x4c47('0x49')]=function(_0x191fd5,_0x28b1ab,_0x2090b7){var _0x2e9f6d={};var _0x2949cd={};var _0x4be3da;var _0x4fb45a;return db['ZendeskConfiguration'][_0x4c47('0x4a')]({'where':{'id':_0x191fd5['params']['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x28b1ab,null))[_0x4c47('0x26')](function(_0x3bf67a){if(_0x3bf67a){_0x4be3da=_0x3bf67a;_0x2949cd[_0x4c47('0x31')]=_['keys'](db['ZendeskField'][_0x4c47('0x2d')]);_0x2949cd[_0x4c47('0x32')]=_['keys'](_0x191fd5[_0x4c47('0x32')]);_0x2949cd[_0x4c47('0x33')]=_[_0x4c47('0x34')](_0x2949cd['model'],_0x2949cd[_0x4c47('0x32')]);_0x2e9f6d[_0x4c47('0x35')]=_[_0x4c47('0x34')](_0x2949cd[_0x4c47('0x31')],qs[_0x4c47('0x36')](_0x191fd5['query']['fields']));_0x2e9f6d['attributes']=_0x2e9f6d[_0x4c47('0x35')][_0x4c47('0x37')]?_0x2e9f6d['attributes']:_0x2949cd[_0x4c47('0x31')];_0x2e9f6d[_0x4c47('0x4b')]=qs[_0x4c47('0x39')](_0x191fd5['query'][_0x4c47('0x39')]);_0x2e9f6d[_0x4c47('0x3a')]=qs[_0x4c47('0x33')](_[_0x4c47('0x4c')](_0x191fd5['query'],_0x2949cd['filters']));if(_0x191fd5[_0x4c47('0x32')]['filter']){_0x2e9f6d[_0x4c47('0x3a')]=_[_0x4c47('0x3c')](_0x2e9f6d[_0x4c47('0x3a')],{'$or':_[_0x4c47('0x2b')](_0x2e9f6d[_0x4c47('0x35')],function(_0x4ebf01){var _0x1d3ada={};_0x1d3ada[_0x4ebf01]={'$like':'%'+_0x191fd5['query'][_0x4c47('0x3b')]+'%'};return _0x1d3ada;})});}_0x2e9f6d=_['merge']({},_0x2e9f6d,_0x191fd5[_0x4c47('0x3d')]);return _0x4be3da['getFields'](_0x2e9f6d);}})[_0x4c47('0x26')](function(_0x11d6e8){if(_0x11d6e8){_0x4fb45a=_0x11d6e8[_0x4c47('0x37')];if(!_0x191fd5[_0x4c47('0x32')][_0x4c47('0x4d')](_0x4c47('0x38'))){_0x2e9f6d[_0x4c47('0x1e')]=qs['limit'](_0x191fd5[_0x4c47('0x32')][_0x4c47('0x1e')]);_0x2e9f6d[_0x4c47('0x1d')]=qs[_0x4c47('0x1d')](_0x191fd5[_0x4c47('0x32')]['offset']);}return _0x4be3da['getFields'](_0x2e9f6d);}})[_0x4c47('0x26')](function(_0x17dfd1){if(_0x17dfd1){return _0x17dfd1?{'count':_0x4fb45a,'rows':_0x17dfd1}:null;}})['then'](respondWithResult(_0x28b1ab,null))[_0x4c47('0x42')](handleError(_0x28b1ab,null));};exports[_0x4c47('0x4e')]=function(_0x7f14f4,_0x3a1fb0,_0x11cd5a){var _0x3fbf9e={};var _0x4868e8={};var _0x28b57d;var _0x2ee35f;return db[_0x4c47('0x2c')]['findOne']({'where':{'id':_0x7f14f4[_0x4c47('0x44')]['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x3a1fb0,null))['then'](function(_0x1d060a){if(_0x1d060a){_0x28b57d=_0x1d060a;_0x4868e8[_0x4c47('0x31')]=_[_0x4c47('0x45')](db[_0x4c47('0x4f')][_0x4c47('0x2d')]);_0x4868e8[_0x4c47('0x32')]=_[_0x4c47('0x45')](_0x7f14f4[_0x4c47('0x32')]);_0x4868e8[_0x4c47('0x33')]=_[_0x4c47('0x34')](_0x4868e8[_0x4c47('0x31')],_0x4868e8[_0x4c47('0x32')]);_0x3fbf9e[_0x4c47('0x35')]=_[_0x4c47('0x34')](_0x4868e8['model'],qs[_0x4c47('0x36')](_0x7f14f4[_0x4c47('0x32')][_0x4c47('0x36')]));_0x3fbf9e['attributes']=_0x3fbf9e[_0x4c47('0x35')][_0x4c47('0x37')]?_0x3fbf9e[_0x4c47('0x35')]:_0x4868e8['model'];_0x3fbf9e[_0x4c47('0x4b')]=qs[_0x4c47('0x39')](_0x7f14f4[_0x4c47('0x32')]['sort']);_0x3fbf9e[_0x4c47('0x3a')]=qs[_0x4c47('0x33')](_[_0x4c47('0x4c')](_0x7f14f4[_0x4c47('0x32')],_0x4868e8[_0x4c47('0x33')]));if(_0x7f14f4[_0x4c47('0x32')]['filter']){_0x3fbf9e[_0x4c47('0x3a')]=_[_0x4c47('0x3c')](_0x3fbf9e[_0x4c47('0x3a')],{'$or':_[_0x4c47('0x2b')](_0x3fbf9e[_0x4c47('0x35')],function(_0x40fc2d){var _0x544663={};_0x544663[_0x40fc2d]={'$like':'%'+_0x7f14f4[_0x4c47('0x32')]['filter']+'%'};return _0x544663;})});}_0x3fbf9e=_[_0x4c47('0x3c')]({},_0x3fbf9e,_0x7f14f4[_0x4c47('0x3d')]);return _0x28b57d['getSubjects'](_0x3fbf9e);}})[_0x4c47('0x26')](function(_0x4da9e4){if(_0x4da9e4){_0x2ee35f=_0x4da9e4[_0x4c47('0x37')];if(!_0x7f14f4[_0x4c47('0x32')]['hasOwnProperty'](_0x4c47('0x38'))){_0x3fbf9e[_0x4c47('0x1e')]=qs[_0x4c47('0x1e')](_0x7f14f4[_0x4c47('0x32')][_0x4c47('0x1e')]);_0x3fbf9e[_0x4c47('0x1d')]=qs['offset'](_0x7f14f4['query'][_0x4c47('0x1d')]);}return _0x28b57d[_0x4c47('0x4e')](_0x3fbf9e);}})[_0x4c47('0x26')](function(_0x1a7fb3){if(_0x1a7fb3){return _0x1a7fb3?{'count':_0x2ee35f,'rows':_0x1a7fb3}:null;}})[_0x4c47('0x26')](respondWithResult(_0x3a1fb0,null))[_0x4c47('0x42')](handleError(_0x3a1fb0,null));};exports['getDescriptions']=function(_0x42dd23,_0x4c79db,_0x3a6ca1){var _0x3fe634={};var _0x199cd6={};var _0x46802d;var _0x2461bb;return db['ZendeskConfiguration'][_0x4c47('0x4a')]({'where':{'id':_0x42dd23[_0x4c47('0x44')]['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x4c79db,null))[_0x4c47('0x26')](function(_0x24e462){if(_0x24e462){_0x46802d=_0x24e462;_0x199cd6[_0x4c47('0x31')]=_[_0x4c47('0x45')](db[_0x4c47('0x4f')][_0x4c47('0x2d')]);_0x199cd6[_0x4c47('0x32')]=_[_0x4c47('0x45')](_0x42dd23[_0x4c47('0x32')]);_0x199cd6['filters']=_[_0x4c47('0x34')](_0x199cd6[_0x4c47('0x31')],_0x199cd6['query']);_0x3fe634[_0x4c47('0x35')]=_[_0x4c47('0x34')](_0x199cd6[_0x4c47('0x31')],qs[_0x4c47('0x36')](_0x42dd23[_0x4c47('0x32')][_0x4c47('0x36')]));_0x3fe634[_0x4c47('0x35')]=_0x3fe634[_0x4c47('0x35')]['length']?_0x3fe634[_0x4c47('0x35')]:_0x199cd6[_0x4c47('0x31')];_0x3fe634['order']=qs['sort'](_0x42dd23[_0x4c47('0x32')][_0x4c47('0x39')]);_0x3fe634['where']=qs[_0x4c47('0x33')](_[_0x4c47('0x4c')](_0x42dd23[_0x4c47('0x32')],_0x199cd6[_0x4c47('0x33')]));if(_0x42dd23['query'][_0x4c47('0x3b')]){_0x3fe634[_0x4c47('0x3a')]=_[_0x4c47('0x3c')](_0x3fe634[_0x4c47('0x3a')],{'$or':_[_0x4c47('0x2b')](_0x3fe634[_0x4c47('0x35')],function(_0x552be4){var _0x2ef3c1={};_0x2ef3c1[_0x552be4]={'$like':'%'+_0x42dd23[_0x4c47('0x32')][_0x4c47('0x3b')]+'%'};return _0x2ef3c1;})});}_0x3fe634=_[_0x4c47('0x3c')]({},_0x3fe634,_0x42dd23[_0x4c47('0x3d')]);return _0x46802d['getDescriptions'](_0x3fe634);}})[_0x4c47('0x26')](function(_0x3bda81){if(_0x3bda81){_0x2461bb=_0x3bda81['length'];if(!_0x42dd23[_0x4c47('0x32')][_0x4c47('0x4d')]('nolimit')){_0x3fe634['limit']=qs[_0x4c47('0x1e')](_0x42dd23['query'][_0x4c47('0x1e')]);_0x3fe634['offset']=qs[_0x4c47('0x1d')](_0x42dd23[_0x4c47('0x32')][_0x4c47('0x1d')]);}return _0x46802d[_0x4c47('0x50')](_0x3fe634);}})[_0x4c47('0x26')](function(_0x4fe4c0){if(_0x4fe4c0){return _0x4fe4c0?{'count':_0x2461bb,'rows':_0x4fe4c0}:null;}})[_0x4c47('0x26')](respondWithResult(_0x4c79db,null))[_0x4c47('0x42')](handleError(_0x4c79db,null));};exports[_0x4c47('0x51')]=function(_0x4bfd38,_0x4e3001,_0x4cd854){var _0x31f676={};var _0x5a60b5={};var _0x4335d6;var _0x2f4d9a;return db[_0x4c47('0x2c')][_0x4c47('0x4a')]({'where':{'id':_0x4bfd38['params']['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x4e3001,null))[_0x4c47('0x26')](function(_0x52afd9){if(_0x52afd9){_0x4335d6=_0x52afd9;_0x5a60b5[_0x4c47('0x31')]=_[_0x4c47('0x45')](db[_0x4c47('0x52')]['rawAttributes']);_0x5a60b5['query']=_[_0x4c47('0x45')](_0x4bfd38[_0x4c47('0x32')]);_0x5a60b5[_0x4c47('0x33')]=_[_0x4c47('0x34')](_0x5a60b5[_0x4c47('0x31')],_0x5a60b5[_0x4c47('0x32')]);_0x31f676[_0x4c47('0x35')]=_[_0x4c47('0x34')](_0x5a60b5[_0x4c47('0x31')],qs[_0x4c47('0x36')](_0x4bfd38[_0x4c47('0x32')][_0x4c47('0x36')]));_0x31f676[_0x4c47('0x35')]=_0x31f676['attributes'][_0x4c47('0x37')]?_0x31f676[_0x4c47('0x35')]:_0x5a60b5['model'];_0x31f676[_0x4c47('0x4b')]=qs[_0x4c47('0x39')](_0x4bfd38[_0x4c47('0x32')]['sort']);_0x31f676[_0x4c47('0x3a')]=qs[_0x4c47('0x33')](_[_0x4c47('0x4c')](_0x4bfd38[_0x4c47('0x32')],_0x5a60b5[_0x4c47('0x33')]));if(_0x4bfd38[_0x4c47('0x32')][_0x4c47('0x3b')]){_0x31f676[_0x4c47('0x3a')]=_[_0x4c47('0x3c')](_0x31f676['where'],{'$or':_[_0x4c47('0x2b')](_0x31f676['attributes'],function(_0x27b546){var _0x317c31={};_0x317c31[_0x27b546]={'$like':'%'+_0x4bfd38[_0x4c47('0x32')][_0x4c47('0x3b')]+'%'};return _0x317c31;})});}_0x31f676=_[_0x4c47('0x3c')]({},_0x31f676,_0x4bfd38['options']);return _0x4335d6[_0x4c47('0x51')](_0x31f676);}})[_0x4c47('0x26')](function(_0x587b13){if(_0x587b13){_0x2f4d9a=_0x587b13[_0x4c47('0x37')];if(!_0x4bfd38[_0x4c47('0x32')]['hasOwnProperty'](_0x4c47('0x38'))){_0x31f676[_0x4c47('0x1e')]=qs[_0x4c47('0x1e')](_0x4bfd38[_0x4c47('0x32')][_0x4c47('0x1e')]);_0x31f676[_0x4c47('0x1d')]=qs['offset'](_0x4bfd38[_0x4c47('0x32')][_0x4c47('0x1d')]);}return _0x4335d6[_0x4c47('0x51')](_0x31f676);}})[_0x4c47('0x26')](function(_0x40cd35){if(_0x40cd35){return _0x40cd35?{'count':_0x2f4d9a,'rows':_0x40cd35}:null;}})['then'](respondWithResult(_0x4e3001,null))[_0x4c47('0x42')](handleError(_0x4e3001,null));};exports[_0x4c47('0x53')]=function(_0x320822,_0x2bdad7,_0x4d9876){if(_0x320822[_0x4c47('0x48')]['id']){delete _0x320822[_0x4c47('0x48')]['id'];}return db['ZendeskConfiguration'][_0x4c47('0x4a')]({'where':{'id':_0x320822[_0x4c47('0x44')]['id']}})[_0x4c47('0x26')](handleEntityNotFound(_0x2bdad7,null))['then'](function(_0x5d2760){if(_0x5d2760){return _0x5d2760[_0x4c47('0x53')](_0x320822['body'][_0x4c47('0x54')]||[]);}return null;})[_0x4c47('0x26')](respondWithResult(_0x2bdad7,null))['catch'](handleError(_0x2bdad7,null));}; \ No newline at end of file +var _0x358c=['offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','VIRTUAL','merge','options','include','rows','catch','params','length','includeAll','find','create','body','getFields','findOne','ZendeskField','getDescriptions','Tag','getTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x10bfc0,_0x261768){var _0x37567f=function(_0x395c2d){while(--_0x395c2d){_0x10bfc0['push'](_0x10bfc0['shift']());}};_0x37567f(++_0x261768);}(_0x358c,0x17a));var _0xc358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x358c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc358('0x0'));var rimraf=require(_0xc358('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc358('0x2'));var rp=require(_0xc358('0x3'));var moment=require(_0xc358('0x4'));var BPromise=require(_0xc358('0x5'));var Mustache=require(_0xc358('0x6'));var util=require(_0xc358('0x7'));var path=require(_0xc358('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc358('0x9'));var fs=require('fs');var fs_extra=require(_0xc358('0xa'));var _=require(_0xc358('0xb'));var squel=require('squel');var crypto=require(_0xc358('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc358('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc358('0xe'));var Papa=require(_0xc358('0xf'));var Redis=require(_0xc358('0x10'));var authService=require(_0xc358('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc358('0x12'));var hardwareService=require(_0xc358('0x13'));var logger=require(_0xc358('0x14'))(_0xc358('0x15'));var utils=require(_0xc358('0x16'));var config=require(_0xc358('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bdf07,_0x581745){_0x581745=_0x581745||0xcc;return function(_0xeeef16){if(_0xeeef16){return _0x1bdf07['sendStatus'](_0x581745);}return _0x1bdf07[_0xc358('0x18')](_0x581745)[_0xc358('0x19')]();};}function respondWithResult(_0x1cc21e,_0x1950db){_0x1950db=_0x1950db||0xc8;return function(_0x201939){if(_0x201939){return _0x1cc21e[_0xc358('0x18')](_0x1950db)[_0xc358('0x1a')](_0x201939);}};}function respondWithFilteredResult(_0xa42d98,_0x5d2956){return function(_0xb02b58){if(_0xb02b58){var _0x11d9e0=typeof _0x5d2956[_0xc358('0x1b')]===_0xc358('0x1c')&&typeof _0x5d2956[_0xc358('0x1d')]==='undefined';var _0x3a1423=_0xb02b58[_0xc358('0x1e')];var _0x58e3c9=_0x11d9e0?0x0:_0x5d2956[_0xc358('0x1b')];var _0x1337a6=_0x11d9e0?_0xb02b58[_0xc358('0x1e')]:_0x5d2956[_0xc358('0x1b')]+_0x5d2956[_0xc358('0x1d')];var _0x2dff40;if(_0x1337a6>=_0x3a1423){_0x1337a6=_0x3a1423;_0x2dff40=0xc8;}else{_0x2dff40=0xce;}_0xa42d98[_0xc358('0x18')](_0x2dff40);return _0xa42d98[_0xc358('0x1f')]('Content-Range',_0x58e3c9+'-'+_0x1337a6+'/'+_0x3a1423)['json'](_0xb02b58);}return null;};}function patchUpdates(_0x5c64b7){return function(_0x5acfeb){try{jsonpatch[_0xc358('0x20')](_0x5acfeb,_0x5c64b7,!![]);}catch(_0x209789){return BPromise['reject'](_0x209789);}return _0x5acfeb[_0xc358('0x21')]();};}function saveUpdates(_0xb40d6a,_0x1f8716){return function(_0x42adbc){if(_0x42adbc){return _0x42adbc[_0xc358('0x22')](_0xb40d6a)[_0xc358('0x23')](function(_0x422824){return _0x422824;});}return null;};}function removeEntity(_0x4632cc,_0xfd4b2d){return function(_0x2cf7af){if(_0x2cf7af){return _0x2cf7af[_0xc358('0x24')]()[_0xc358('0x23')](function(){_0x4632cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c986e,_0x43a385){return function(_0x16f777){if(!_0x16f777){_0x4c986e['sendStatus'](0x194);}return _0x16f777;};}function handleError(_0x26d4c5,_0x2d0199){_0x2d0199=_0x2d0199||0x1f4;return function(_0x561ce8){logger[_0xc358('0x25')](_0x561ce8[_0xc358('0x26')]);if(_0x561ce8[_0xc358('0x27')]){delete _0x561ce8[_0xc358('0x27')];}_0x26d4c5[_0xc358('0x18')](_0x2d0199)[_0xc358('0x28')](_0x561ce8);};}exports[_0xc358('0x29')]=function(_0x4e85f5,_0x17135c){var _0x5e5357={},_0x4b0eac={},_0x1cff37={'count':0x0,'rows':[]};var _0x4204d9=_['map'](db[_0xc358('0x2a')][_0xc358('0x2b')],function(_0xc86569){return{'name':_0xc86569[_0xc358('0x2c')],'type':_0xc86569['type'][_0xc358('0x2d')]};});_0x4b0eac[_0xc358('0x2e')]=_['map'](_0x4204d9,_0xc358('0x27'));_0x4b0eac['query']=_[_0xc358('0x2f')](_0x4e85f5[_0xc358('0x30')]);_0x4b0eac[_0xc358('0x31')]=_[_0xc358('0x32')](_0x4b0eac[_0xc358('0x2e')],_0x4b0eac['query']);_0x5e5357['attributes']=_[_0xc358('0x32')](_0x4b0eac['model'],qs[_0xc358('0x33')](_0x4e85f5[_0xc358('0x30')][_0xc358('0x33')]));_0x5e5357[_0xc358('0x34')]=_0x5e5357[_0xc358('0x34')]['length']?_0x5e5357[_0xc358('0x34')]:_0x4b0eac[_0xc358('0x2e')];if(!_0x4e85f5[_0xc358('0x30')][_0xc358('0x35')](_0xc358('0x36'))){_0x5e5357[_0xc358('0x1d')]=qs['limit'](_0x4e85f5[_0xc358('0x30')][_0xc358('0x1d')]);_0x5e5357[_0xc358('0x1b')]=qs[_0xc358('0x1b')](_0x4e85f5[_0xc358('0x30')][_0xc358('0x1b')]);}_0x5e5357[_0xc358('0x37')]=qs['sort'](_0x4e85f5['query'][_0xc358('0x38')]);_0x5e5357['where']=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x4e85f5['query'],_0x4b0eac[_0xc358('0x31')]),_0x4204d9);if(_0x4e85f5[_0xc358('0x30')][_0xc358('0x3a')]){_0x5e5357[_0xc358('0x3b')]=_['merge'](_0x5e5357[_0xc358('0x3b')],{'$or':_[_0xc358('0x3c')](_0x4204d9,function(_0x44fe0a){if(_0x44fe0a[_0xc358('0x3d')]!==_0xc358('0x3e')){var _0x15dc48={};_0x15dc48[_0x44fe0a['name']]={'$like':'%'+_0x4e85f5[_0xc358('0x30')][_0xc358('0x3a')]+'%'};return _0x15dc48;}})});}_0x5e5357=_[_0xc358('0x3f')]({},_0x5e5357,_0x4e85f5[_0xc358('0x40')]);var _0x581e67={'where':_0x5e5357['where']};return db[_0xc358('0x2a')][_0xc358('0x1e')](_0x581e67)['then'](function(_0x160d33){_0x1cff37[_0xc358('0x1e')]=_0x160d33;if(_0x4e85f5[_0xc358('0x30')]['includeAll']){_0x5e5357[_0xc358('0x41')]=[{'all':!![]}];}return db[_0xc358('0x2a')]['findAll'](_0x5e5357);})[_0xc358('0x23')](function(_0x3cf2c3){_0x1cff37[_0xc358('0x42')]=_0x3cf2c3;return _0x1cff37;})[_0xc358('0x23')](respondWithFilteredResult(_0x17135c,_0x5e5357))[_0xc358('0x43')](handleError(_0x17135c,null));};exports['show']=function(_0x384d3b,_0x555d44){var _0x3b3d57={'raw':![],'where':{'id':_0x384d3b[_0xc358('0x44')]['id']}},_0x3a356d={};_0x3a356d['model']=_[_0xc358('0x2f')](db[_0xc358('0x2a')]['rawAttributes']);_0x3a356d[_0xc358('0x30')]=_[_0xc358('0x2f')](_0x384d3b[_0xc358('0x30')]);_0x3a356d['filters']=_[_0xc358('0x32')](_0x3a356d[_0xc358('0x2e')],_0x3a356d['query']);_0x3b3d57[_0xc358('0x34')]=_['intersection'](_0x3a356d['model'],qs[_0xc358('0x33')](_0x384d3b[_0xc358('0x30')][_0xc358('0x33')]));_0x3b3d57[_0xc358('0x34')]=_0x3b3d57[_0xc358('0x34')][_0xc358('0x45')]?_0x3b3d57[_0xc358('0x34')]:_0x3a356d['model'];if(_0x384d3b[_0xc358('0x30')][_0xc358('0x46')]){_0x3b3d57[_0xc358('0x41')]=[{'all':!![]}];}_0x3b3d57=_[_0xc358('0x3f')]({},_0x3b3d57,_0x384d3b['options']);return db[_0xc358('0x2a')][_0xc358('0x47')](_0x3b3d57)[_0xc358('0x23')](handleEntityNotFound(_0x555d44,null))[_0xc358('0x23')](respondWithResult(_0x555d44,null))[_0xc358('0x43')](handleError(_0x555d44,null));};exports['create']=function(_0x52f8b,_0x27f7ce){return db[_0xc358('0x2a')][_0xc358('0x48')](_0x52f8b[_0xc358('0x49')],{})[_0xc358('0x23')](respondWithResult(_0x27f7ce,0xc9))[_0xc358('0x43')](handleError(_0x27f7ce,null));};exports[_0xc358('0x22')]=function(_0x50c0e0,_0x5eecb6){if(_0x50c0e0[_0xc358('0x49')]['id']){delete _0x50c0e0[_0xc358('0x49')]['id'];}return db[_0xc358('0x2a')][_0xc358('0x47')]({'where':{'id':_0x50c0e0[_0xc358('0x44')]['id']}})['then'](handleEntityNotFound(_0x5eecb6,null))[_0xc358('0x23')](saveUpdates(_0x50c0e0[_0xc358('0x49')],null))[_0xc358('0x23')](respondWithResult(_0x5eecb6,null))[_0xc358('0x43')](handleError(_0x5eecb6,null));};exports[_0xc358('0x24')]=function(_0x258474,_0x2e37c3){return db[_0xc358('0x2a')][_0xc358('0x47')]({'where':{'id':_0x258474['params']['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x2e37c3,null))[_0xc358('0x23')](removeEntity(_0x2e37c3,null))['catch'](handleError(_0x2e37c3,null));};exports[_0xc358('0x4a')]=function(_0x468929,_0x1f4349,_0x4c6a78){var _0x10480b={};var _0x1bacb2={};var _0x1bc673;var _0x1d6376;return db[_0xc358('0x2a')][_0xc358('0x4b')]({'where':{'id':_0x468929[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x1f4349,null))[_0xc358('0x23')](function(_0x3364fa){if(_0x3364fa){_0x1bc673=_0x3364fa;_0x1bacb2[_0xc358('0x2e')]=_['keys'](db['ZendeskField'][_0xc358('0x2b')]);_0x1bacb2[_0xc358('0x30')]=_['keys'](_0x468929[_0xc358('0x30')]);_0x1bacb2[_0xc358('0x31')]=_['intersection'](_0x1bacb2[_0xc358('0x2e')],_0x1bacb2['query']);_0x10480b[_0xc358('0x34')]=_[_0xc358('0x32')](_0x1bacb2[_0xc358('0x2e')],qs[_0xc358('0x33')](_0x468929[_0xc358('0x30')][_0xc358('0x33')]));_0x10480b[_0xc358('0x34')]=_0x10480b[_0xc358('0x34')][_0xc358('0x45')]?_0x10480b[_0xc358('0x34')]:_0x1bacb2['model'];_0x10480b[_0xc358('0x37')]=qs['sort'](_0x468929[_0xc358('0x30')]['sort']);_0x10480b['where']=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x468929[_0xc358('0x30')],_0x1bacb2[_0xc358('0x31')]));if(_0x468929['query'][_0xc358('0x3a')]){_0x10480b[_0xc358('0x3b')]=_[_0xc358('0x3f')](_0x10480b['where'],{'$or':_[_0xc358('0x3c')](_0x10480b[_0xc358('0x34')],function(_0x57ba1e){var _0x2aff8f={};_0x2aff8f[_0x57ba1e]={'$like':'%'+_0x468929['query']['filter']+'%'};return _0x2aff8f;})});}_0x10480b=_[_0xc358('0x3f')]({},_0x10480b,_0x468929[_0xc358('0x40')]);return _0x1bc673[_0xc358('0x4a')](_0x10480b);}})[_0xc358('0x23')](function(_0x375ec3){if(_0x375ec3){_0x1d6376=_0x375ec3['length'];if(!_0x468929[_0xc358('0x30')][_0xc358('0x35')]('nolimit')){_0x10480b['limit']=qs[_0xc358('0x1d')](_0x468929['query'][_0xc358('0x1d')]);_0x10480b['offset']=qs[_0xc358('0x1b')](_0x468929[_0xc358('0x30')]['offset']);}return _0x1bc673[_0xc358('0x4a')](_0x10480b);}})['then'](function(_0x245488){if(_0x245488){return _0x245488?{'count':_0x1d6376,'rows':_0x245488}:null;}})[_0xc358('0x23')](respondWithResult(_0x1f4349,null))[_0xc358('0x43')](handleError(_0x1f4349,null));};exports['getSubjects']=function(_0x2c07d8,_0x2ef8a1,_0xee0971){var _0x523cee={};var _0x15b63d={};var _0x8ea3a8;var _0xd944a7;return db[_0xc358('0x2a')]['findOne']({'where':{'id':_0x2c07d8[_0xc358('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef8a1,null))[_0xc358('0x23')](function(_0x2e82af){if(_0x2e82af){_0x8ea3a8=_0x2e82af;_0x15b63d['model']=_['keys'](db[_0xc358('0x4c')][_0xc358('0x2b')]);_0x15b63d[_0xc358('0x30')]=_[_0xc358('0x2f')](_0x2c07d8[_0xc358('0x30')]);_0x15b63d[_0xc358('0x31')]=_[_0xc358('0x32')](_0x15b63d[_0xc358('0x2e')],_0x15b63d[_0xc358('0x30')]);_0x523cee[_0xc358('0x34')]=_[_0xc358('0x32')](_0x15b63d[_0xc358('0x2e')],qs[_0xc358('0x33')](_0x2c07d8['query'][_0xc358('0x33')]));_0x523cee[_0xc358('0x34')]=_0x523cee[_0xc358('0x34')][_0xc358('0x45')]?_0x523cee[_0xc358('0x34')]:_0x15b63d[_0xc358('0x2e')];_0x523cee[_0xc358('0x37')]=qs[_0xc358('0x38')](_0x2c07d8[_0xc358('0x30')][_0xc358('0x38')]);_0x523cee[_0xc358('0x3b')]=qs['filters'](_[_0xc358('0x39')](_0x2c07d8[_0xc358('0x30')],_0x15b63d['filters']));if(_0x2c07d8[_0xc358('0x30')]['filter']){_0x523cee['where']=_['merge'](_0x523cee['where'],{'$or':_[_0xc358('0x3c')](_0x523cee['attributes'],function(_0x2cf3dc){var _0x4ea1cd={};_0x4ea1cd[_0x2cf3dc]={'$like':'%'+_0x2c07d8[_0xc358('0x30')][_0xc358('0x3a')]+'%'};return _0x4ea1cd;})});}_0x523cee=_['merge']({},_0x523cee,_0x2c07d8[_0xc358('0x40')]);return _0x8ea3a8['getSubjects'](_0x523cee);}})['then'](function(_0x365541){if(_0x365541){_0xd944a7=_0x365541['length'];if(!_0x2c07d8[_0xc358('0x30')][_0xc358('0x35')](_0xc358('0x36'))){_0x523cee['limit']=qs[_0xc358('0x1d')](_0x2c07d8['query'][_0xc358('0x1d')]);_0x523cee[_0xc358('0x1b')]=qs['offset'](_0x2c07d8['query']['offset']);}return _0x8ea3a8['getSubjects'](_0x523cee);}})['then'](function(_0x5d9abc){if(_0x5d9abc){return _0x5d9abc?{'count':_0xd944a7,'rows':_0x5d9abc}:null;}})[_0xc358('0x23')](respondWithResult(_0x2ef8a1,null))[_0xc358('0x43')](handleError(_0x2ef8a1,null));};exports['getDescriptions']=function(_0x5e4396,_0x11e30c,_0x57901d){var _0x386131={};var _0x33b10e={};var _0x352840;var _0x21ac3b;return db['ZendeskConfiguration'][_0xc358('0x4b')]({'where':{'id':_0x5e4396[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x11e30c,null))['then'](function(_0x30d4db){if(_0x30d4db){_0x352840=_0x30d4db;_0x33b10e[_0xc358('0x2e')]=_[_0xc358('0x2f')](db[_0xc358('0x4c')][_0xc358('0x2b')]);_0x33b10e[_0xc358('0x30')]=_[_0xc358('0x2f')](_0x5e4396['query']);_0x33b10e[_0xc358('0x31')]=_[_0xc358('0x32')](_0x33b10e['model'],_0x33b10e[_0xc358('0x30')]);_0x386131[_0xc358('0x34')]=_[_0xc358('0x32')](_0x33b10e[_0xc358('0x2e')],qs['fields'](_0x5e4396[_0xc358('0x30')]['fields']));_0x386131[_0xc358('0x34')]=_0x386131[_0xc358('0x34')][_0xc358('0x45')]?_0x386131[_0xc358('0x34')]:_0x33b10e[_0xc358('0x2e')];_0x386131[_0xc358('0x37')]=qs[_0xc358('0x38')](_0x5e4396[_0xc358('0x30')]['sort']);_0x386131['where']=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x5e4396[_0xc358('0x30')],_0x33b10e[_0xc358('0x31')]));if(_0x5e4396[_0xc358('0x30')][_0xc358('0x3a')]){_0x386131['where']=_['merge'](_0x386131[_0xc358('0x3b')],{'$or':_[_0xc358('0x3c')](_0x386131['attributes'],function(_0x454542){var _0xe9eb71={};_0xe9eb71[_0x454542]={'$like':'%'+_0x5e4396['query'][_0xc358('0x3a')]+'%'};return _0xe9eb71;})});}_0x386131=_[_0xc358('0x3f')]({},_0x386131,_0x5e4396['options']);return _0x352840['getDescriptions'](_0x386131);}})[_0xc358('0x23')](function(_0x136e88){if(_0x136e88){_0x21ac3b=_0x136e88['length'];if(!_0x5e4396['query']['hasOwnProperty'](_0xc358('0x36'))){_0x386131[_0xc358('0x1d')]=qs['limit'](_0x5e4396[_0xc358('0x30')][_0xc358('0x1d')]);_0x386131[_0xc358('0x1b')]=qs[_0xc358('0x1b')](_0x5e4396['query'][_0xc358('0x1b')]);}return _0x352840[_0xc358('0x4d')](_0x386131);}})[_0xc358('0x23')](function(_0x1d8a23){if(_0x1d8a23){return _0x1d8a23?{'count':_0x21ac3b,'rows':_0x1d8a23}:null;}})['then'](respondWithResult(_0x11e30c,null))['catch'](handleError(_0x11e30c,null));};exports['getTags']=function(_0x2a0320,_0x21b3ad,_0x33d6d1){var _0x4203d9={};var _0x1aaa6b={};var _0x108945;var _0x1484f4;return db[_0xc358('0x2a')]['findOne']({'where':{'id':_0x2a0320[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x21b3ad,null))[_0xc358('0x23')](function(_0x1c5514){if(_0x1c5514){_0x108945=_0x1c5514;_0x1aaa6b['model']=_[_0xc358('0x2f')](db[_0xc358('0x4e')][_0xc358('0x2b')]);_0x1aaa6b['query']=_[_0xc358('0x2f')](_0x2a0320['query']);_0x1aaa6b[_0xc358('0x31')]=_[_0xc358('0x32')](_0x1aaa6b[_0xc358('0x2e')],_0x1aaa6b['query']);_0x4203d9[_0xc358('0x34')]=_[_0xc358('0x32')](_0x1aaa6b[_0xc358('0x2e')],qs['fields'](_0x2a0320[_0xc358('0x30')][_0xc358('0x33')]));_0x4203d9['attributes']=_0x4203d9[_0xc358('0x34')][_0xc358('0x45')]?_0x4203d9[_0xc358('0x34')]:_0x1aaa6b['model'];_0x4203d9[_0xc358('0x37')]=qs[_0xc358('0x38')](_0x2a0320[_0xc358('0x30')][_0xc358('0x38')]);_0x4203d9[_0xc358('0x3b')]=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x2a0320[_0xc358('0x30')],_0x1aaa6b[_0xc358('0x31')]));if(_0x2a0320[_0xc358('0x30')]['filter']){_0x4203d9[_0xc358('0x3b')]=_[_0xc358('0x3f')](_0x4203d9[_0xc358('0x3b')],{'$or':_['map'](_0x4203d9[_0xc358('0x34')],function(_0x150e1c){var _0x5b1447={};_0x5b1447[_0x150e1c]={'$like':'%'+_0x2a0320['query']['filter']+'%'};return _0x5b1447;})});}_0x4203d9=_[_0xc358('0x3f')]({},_0x4203d9,_0x2a0320[_0xc358('0x40')]);return _0x108945[_0xc358('0x4f')](_0x4203d9);}})['then'](function(_0x420c77){if(_0x420c77){_0x1484f4=_0x420c77['length'];if(!_0x2a0320[_0xc358('0x30')][_0xc358('0x35')](_0xc358('0x36'))){_0x4203d9['limit']=qs['limit'](_0x2a0320['query'][_0xc358('0x1d')]);_0x4203d9[_0xc358('0x1b')]=qs['offset'](_0x2a0320[_0xc358('0x30')]['offset']);}return _0x108945[_0xc358('0x4f')](_0x4203d9);}})['then'](function(_0x5447d6){if(_0x5447d6){return _0x5447d6?{'count':_0x1484f4,'rows':_0x5447d6}:null;}})[_0xc358('0x23')](respondWithResult(_0x21b3ad,null))[_0xc358('0x43')](handleError(_0x21b3ad,null));};exports['setTags']=function(_0x12ea38,_0x33f5f7,_0x3ae639){if(_0x12ea38[_0xc358('0x49')]['id']){delete _0x12ea38['body']['id'];}return db[_0xc358('0x2a')][_0xc358('0x4b')]({'where':{'id':_0x12ea38[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x33f5f7,null))[_0xc358('0x23')](function(_0x1f49f7){if(_0x1f49f7){return _0x1f49f7['setTags'](_0x12ea38[_0xc358('0x49')][_0xc358('0x50')]||[]);}return null;})[_0xc358('0x23')](respondWithResult(_0x33f5f7,null))[_0xc358('0x43')](handleError(_0x33f5f7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 385858a..cdc3574 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 _0x4e81=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x4e81,0x1bc));var _0x14e8=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x4e81[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14e8('0x3'));var fs=require('fs');var path=require(_0x14e8('0x4'));var rimraf=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var attributes=require(_0x14e8('0x7'));module[_0x14e8('0x8')]=function(_0x56a266,_0x57c79b){return _0x56a266[_0x14e8('0x9')](_0x14e8('0xa'),attributes,{'tableName':_0x14e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xb5972a,_0xdd734d){var _0x3a5f0c=function(_0x3d79df){while(--_0x3d79df){_0xb5972a['push'](_0xb5972a['shift']());}};_0x3a5f0c(++_0xdd734d);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfe26da,_0x5ac1b7){_0xfe26da=_0xfe26da-0x0;var _0x2abe6e=_0x0b0e[_0xfe26da];return _0x2abe6e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('ZendeskConfiguration',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 a31e985..0d5d759 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 _0xed58=['client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1c6f3d,_0xe06d79){var _0x48bea9=function(_0x10405c){while(--_0x10405c){_0x1c6f3d['push'](_0x1c6f3d['shift']());}};_0x48bea9(++_0xe06d79);}(_0xed58,0x8b));var _0x8ed5=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xed58[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x8ed5('0x0'));var moment=require('moment');var BPromise=require(_0x8ed5('0x1'));var rs=require(_0x8ed5('0x2'));var fs=require('fs');var Redis=require(_0x8ed5('0x3'));var db=require(_0x8ed5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ed5('0x5'))(_0x8ed5('0x6'));var config=require(_0x8ed5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ed5('0x8')][_0x8ed5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f5b26,_0x4029f9,_0x226e69){return new BPromise(function(_0x3c501b,_0x55beac){return client['request'](_0x2f5b26,_0x226e69)['then'](function(_0x5f1177){logger[_0x8ed5('0xa')](_0x8ed5('0xb'),_0x4029f9,_0x8ed5('0xc'));logger[_0x8ed5('0xd')](_0x8ed5('0xe'),_0x4029f9,_0x8ed5('0xc'),JSON[_0x8ed5('0xf')](_0x5f1177));if(_0x5f1177['error']){if(_0x5f1177[_0x8ed5('0x10')][_0x8ed5('0x11')]===0x1f4){logger[_0x8ed5('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4029f9,_0x5f1177['error'][_0x8ed5('0x12')]);return _0x55beac(_0x5f1177['error'][_0x8ed5('0x12')]);}logger['error'](_0x8ed5('0xb'),_0x4029f9,_0x5f1177['error'][_0x8ed5('0x12')]);return _0x3c501b(_0x5f1177[_0x8ed5('0x10')][_0x8ed5('0x12')]);}else{logger[_0x8ed5('0xa')](_0x8ed5('0xb'),_0x4029f9,_0x8ed5('0xc'));_0x3c501b(_0x5f1177[_0x8ed5('0x13')]['message']);}})[_0x8ed5('0x14')](function(_0x4a420d){logger[_0x8ed5('0x10')](_0x8ed5('0xb'),_0x4029f9,_0x4a420d);_0x55beac(_0x4a420d);});});} \ No newline at end of file +var _0xeb44=['rpc','jayson/promise','http','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34586d,_0x4b88cd){var _0xa8620c=function(_0x3ba342){while(--_0x3ba342){_0x34586d['push'](_0x34586d['shift']());}};_0xa8620c(++_0x4b88cd);}(_0xeb44,0x8c));var _0x4eb4=function(_0xeeab72,_0x461e98){_0xeeab72=_0xeeab72-0x0;var _0x3c20ab=_0xeb44[_0xeeab72];return _0x3c20ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4eb4('0x0'));var BPromise=require(_0x4eb4('0x1'));var rs=require(_0x4eb4('0x2'));var fs=require('fs');var Redis=require(_0x4eb4('0x3'));var db=require(_0x4eb4('0x4'))['db'];var utils=require(_0x4eb4('0x5'));var logger=require(_0x4eb4('0x6'))(_0x4eb4('0x7'));var config=require('../../config/environment');var jayson=require(_0x4eb4('0x8'));var client=jayson['client'][_0x4eb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e2937,_0xe15d92,_0x4571ba){return new BPromise(function(_0x2e6c87,_0x3c9d21){return client['request'](_0x7e2937,_0x4571ba)['then'](function(_0x2681b4){logger[_0x4eb4('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe15d92,_0x4eb4('0xb'));logger[_0x4eb4('0xc')](_0x4eb4('0xd'),_0xe15d92,'request\x20sent',JSON[_0x4eb4('0xe')](_0x2681b4));if(_0x2681b4['error']){if(_0x2681b4[_0x4eb4('0xf')][_0x4eb4('0x10')]===0x1f4){logger[_0x4eb4('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe15d92,_0x2681b4[_0x4eb4('0xf')][_0x4eb4('0x11')]);return _0x3c9d21(_0x2681b4['error']['message']);}logger[_0x4eb4('0xf')](_0x4eb4('0x12'),_0xe15d92,_0x2681b4[_0x4eb4('0xf')]['message']);return _0x2e6c87(_0x2681b4[_0x4eb4('0xf')]['message']);}else{logger[_0x4eb4('0xa')](_0x4eb4('0x12'),_0xe15d92,_0x4eb4('0xb'));_0x2e6c87(_0x2681b4[_0x4eb4('0x13')][_0x4eb4('0x11')]);}})[_0x4eb4('0x14')](function(_0x396bbd){logger['error'](_0x4eb4('0x12'),_0xe15d92,_0x396bbd);_0x3c9d21(_0x396bbd);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index a311114..881458f 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 _0x647e=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x2a8c1f,_0x44f7fd){var _0x30985b=function(_0x37f946){while(--_0x37f946){_0x2a8c1f['push'](_0x2a8c1f['shift']());}};_0x30985b(++_0x44f7fd);}(_0x647e,0x12e));var _0xe647=function(_0x455be0,_0x2d9831){_0x455be0=_0x455be0-0x0;var _0x65cf11=_0x647e[_0x455be0];return _0x65cf11;};'use strict';var multer=require(_0xe647('0x0'));var util=require(_0xe647('0x1'));var path=require(_0xe647('0x2'));var timeout=require(_0xe647('0x3'));var express=require(_0xe647('0x4'));var router=express['Router']();var fs_extra=require(_0xe647('0x5'));var auth=require(_0xe647('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe647('0x7'));var controller=require(_0xe647('0x8'));router[_0xe647('0x9')]('/',auth[_0xe647('0xa')](),controller[_0xe647('0xb')]);router['get'](_0xe647('0xc'),auth[_0xe647('0xa')](),controller[_0xe647('0xd')]);router[_0xe647('0xe')]('/',auth[_0xe647('0xa')](),controller[_0xe647('0xf')]);router[_0xe647('0x10')](_0xe647('0xc'),auth[_0xe647('0xa')](),controller[_0xe647('0x11')]);router[_0xe647('0x12')](_0xe647('0xc'),auth['isAuthenticated'](),controller[_0xe647('0x13')]);module[_0xe647('0x14')]=router; \ No newline at end of file +var _0x969a=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','show','post','create','put','isAuthenticated'];(function(_0x27236e,_0x5319f2){var _0x3dbc69=function(_0x289d52){while(--_0x289d52){_0x27236e['push'](_0x27236e['shift']());}};_0x3dbc69(++_0x5319f2);}(_0x969a,0xd6));var _0xa969=function(_0x4397a3,_0x2b0013){_0x4397a3=_0x4397a3-0x0;var _0x58729e=_0x969a[_0x4397a3];return _0x58729e;};'use strict';var multer=require(_0xa969('0x0'));var util=require('util');var path=require(_0xa969('0x1'));var timeout=require(_0xa969('0x2'));var express=require(_0xa969('0x3'));var router=express[_0xa969('0x4')]();var fs_extra=require(_0xa969('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa969('0x6'));var config=require(_0xa969('0x7'));var controller=require(_0xa969('0x8'));router[_0xa969('0x9')]('/',auth['isAuthenticated'](),controller[_0xa969('0xa')]);router[_0xa969('0x9')](_0xa969('0xb'),auth['isAuthenticated'](),controller[_0xa969('0xc')]);router[_0xa969('0xd')]('/',auth['isAuthenticated'](),controller[_0xa969('0xe')]);router[_0xa969('0xf')]('/:id',auth[_0xa969('0x10')](),controller[_0xa969('0x11')]);router[_0xa969('0x12')](_0xa969('0xb'),auth[_0xa969('0x10')](),controller[_0xa969('0x13')]);module[_0xa969('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8252f47..125e085 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 _0x03f4=['BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x2fccb2,_0x2c650a){var _0x33ab3e=function(_0x1ff52f){while(--_0x1ff52f){_0x2fccb2['push'](_0x2fccb2['shift']());}};_0x33ab3e(++_0x2c650a);}(_0x03f4,0x118));var _0x403f=function(_0x441e9b,_0x31c059){_0x441e9b=_0x441e9b-0x0;var _0x56eb9e=_0x03f4[_0x441e9b];return _0x56eb9e;};'use strict';var Sequelize=require(_0x403f('0x0'));module[_0x403f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x403f('0x2'),_0x403f('0x3'),'customVariable',_0x403f('0x4'),_0x403f('0x5')),'defaultValue':_0x403f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x403f('0x6')]},'keyType':{'type':Sequelize[_0x403f('0x7')](_0x403f('0x2'),_0x403f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x403f('0x6')]},'idField':{'type':Sequelize[_0x403f('0x6')]},'nameField':{'type':Sequelize[_0x403f('0x6')]},'customField':{'type':Sequelize[_0x403f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x403f('0x6')]}}; \ No newline at end of file +var _0x6abf=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x1406a2,_0x44b969){var _0x1fa385=function(_0x504fc4){while(--_0x504fc4){_0x1406a2['push'](_0x1406a2['shift']());}};_0x1fa385(++_0x44b969);}(_0x6abf,0xd5));var _0xf6ab=function(_0x53357f,_0x1c1616){_0x53357f=_0x53357f-0x0;var _0x51cd30=_0x6abf[_0x53357f];return _0x51cd30;};'use strict';var Sequelize=require(_0xf6ab('0x0'));module[_0xf6ab('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf6ab('0x2'),_0xf6ab('0x3'),_0xf6ab('0x4'),_0xf6ab('0x5'),'picklist'),'defaultValue':_0xf6ab('0x2')},'content':{'type':Sequelize[_0xf6ab('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf6ab('0x7')](_0xf6ab('0x2'),_0xf6ab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf6ab('0x6')]},'idField':{'type':Sequelize[_0xf6ab('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6ab('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e6ca1bb..4212148 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 _0x2bda=['sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ZendeskField','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','destroy','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x2bda,0x1e1));var _0xa2bd=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x2bda[_0x383158];return _0x507985;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa2bd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2bd('0x1'));var moment=require(_0xa2bd('0x2'));var BPromise=require(_0xa2bd('0x3'));var Mustache=require(_0xa2bd('0x4'));var util=require('util');var path=require(_0xa2bd('0x5'));var sox=require(_0xa2bd('0x6'));var csv=require(_0xa2bd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2bd('0x8'));var _=require(_0xa2bd('0x9'));var squel=require(_0xa2bd('0xa'));var crypto=require(_0xa2bd('0xb'));var jsforce=require(_0xa2bd('0xc'));var deskjs=require(_0xa2bd('0xd'));var toCsv=require(_0xa2bd('0x7'));var querystring=require(_0xa2bd('0xe'));var Papa=require(_0xa2bd('0xf'));var Redis=require(_0xa2bd('0x10'));var authService=require(_0xa2bd('0x11'));var qs=require(_0xa2bd('0x12'));var as=require(_0xa2bd('0x13'));var hardwareService=require(_0xa2bd('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa2bd('0x15'));var db=require(_0xa2bd('0x16'))['db'];function respondWithStatusCode(_0x42fbe2,_0x6d2c37){_0x6d2c37=_0x6d2c37||0xcc;return function(_0x5226e8){if(_0x5226e8){return _0x42fbe2[_0xa2bd('0x17')](_0x6d2c37);}return _0x42fbe2[_0xa2bd('0x18')](_0x6d2c37)[_0xa2bd('0x19')]();};}function respondWithResult(_0x460db1,_0x3c14d1){_0x3c14d1=_0x3c14d1||0xc8;return function(_0x5a6765){if(_0x5a6765){return _0x460db1['status'](_0x3c14d1)['json'](_0x5a6765);}};}function respondWithFilteredResult(_0x42885f,_0x1cf8c5){return function(_0xe4cfe){if(_0xe4cfe){var _0x2d2aca=typeof _0x1cf8c5['offset']===_0xa2bd('0x1a')&&typeof _0x1cf8c5[_0xa2bd('0x1b')]===_0xa2bd('0x1a');var _0x26efe4=_0xe4cfe[_0xa2bd('0x1c')];var _0x2c8366=_0x2d2aca?0x0:_0x1cf8c5[_0xa2bd('0x1d')];var _0x4fe224=_0x2d2aca?_0xe4cfe['count']:_0x1cf8c5['offset']+_0x1cf8c5['limit'];var _0x298c0a;if(_0x4fe224>=_0x26efe4){_0x4fe224=_0x26efe4;_0x298c0a=0xc8;}else{_0x298c0a=0xce;}_0x42885f['status'](_0x298c0a);return _0x42885f[_0xa2bd('0x1e')](_0xa2bd('0x1f'),_0x2c8366+'-'+_0x4fe224+'/'+_0x26efe4)[_0xa2bd('0x20')](_0xe4cfe);}return null;};}function patchUpdates(_0x1f2e04){return function(_0x161228){try{jsonpatch[_0xa2bd('0x21')](_0x161228,_0x1f2e04,!![]);}catch(_0x768e84){return BPromise[_0xa2bd('0x22')](_0x768e84);}return _0x161228['save']();};}function saveUpdates(_0x33e237,_0x212f3c){return function(_0x55b6e1){if(_0x55b6e1){return _0x55b6e1[_0xa2bd('0x23')](_0x33e237)[_0xa2bd('0x24')](function(_0xe1c614){return _0xe1c614;});}return null;};}function removeEntity(_0xf4d724,_0x5a623e){return function(_0x30806b){if(_0x30806b){return _0x30806b['destroy']()[_0xa2bd('0x24')](function(){_0xf4d724[_0xa2bd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426682,_0x3bd342){return function(_0x545d6d){if(!_0x545d6d){_0x426682[_0xa2bd('0x17')](0x194);}return _0x545d6d;};}function handleError(_0x38f401,_0x1f3f92){_0x1f3f92=_0x1f3f92||0x1f4;return function(_0x35988f){logger['error'](_0x35988f[_0xa2bd('0x25')]);if(_0x35988f[_0xa2bd('0x26')]){delete _0x35988f[_0xa2bd('0x26')];}_0x38f401[_0xa2bd('0x18')](_0x1f3f92)[_0xa2bd('0x27')](_0x35988f);};}exports[_0xa2bd('0x28')]=function(_0x15b4ea,_0x340ff8){var _0x320f7f={},_0x31c403={},_0x2ac442={'count':0x0,'rows':[]};var _0x34f26a=_[_0xa2bd('0x29')](db[_0xa2bd('0x2a')]['rawAttributes'],function(_0xf3dc79){return{'name':_0xf3dc79['fieldName'],'type':_0xf3dc79[_0xa2bd('0x2b')]['key']};});_0x31c403[_0xa2bd('0x2c')]=_['map'](_0x34f26a,_0xa2bd('0x26'));_0x31c403['query']=_['keys'](_0x15b4ea[_0xa2bd('0x2d')]);_0x31c403[_0xa2bd('0x2e')]=_[_0xa2bd('0x2f')](_0x31c403[_0xa2bd('0x2c')],_0x31c403[_0xa2bd('0x2d')]);_0x320f7f[_0xa2bd('0x30')]=_['intersection'](_0x31c403[_0xa2bd('0x2c')],qs[_0xa2bd('0x31')](_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x31')]));_0x320f7f[_0xa2bd('0x30')]=_0x320f7f[_0xa2bd('0x30')][_0xa2bd('0x32')]?_0x320f7f[_0xa2bd('0x30')]:_0x31c403['model'];if(!_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x33')]('nolimit')){_0x320f7f[_0xa2bd('0x1b')]=qs[_0xa2bd('0x1b')](_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x1b')]);_0x320f7f[_0xa2bd('0x1d')]=qs[_0xa2bd('0x1d')](_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x1d')]);}_0x320f7f['order']=qs[_0xa2bd('0x34')](_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x34')]);_0x320f7f[_0xa2bd('0x35')]=qs[_0xa2bd('0x2e')](_[_0xa2bd('0x36')](_0x15b4ea['query'],_0x31c403[_0xa2bd('0x2e')]),_0x34f26a);if(_0x15b4ea[_0xa2bd('0x2d')]['filter']){_0x320f7f[_0xa2bd('0x35')]=_[_0xa2bd('0x37')](_0x320f7f[_0xa2bd('0x35')],{'$or':_[_0xa2bd('0x29')](_0x34f26a,function(_0x9be634){if(_0x9be634[_0xa2bd('0x2b')]!==_0xa2bd('0x38')){var _0x3ff510={};_0x3ff510[_0x9be634['name']]={'$like':'%'+_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x39')]+'%'};return _0x3ff510;}})});}_0x320f7f=_[_0xa2bd('0x37')]({},_0x320f7f,_0x15b4ea[_0xa2bd('0x3a')]);var _0x412f0d={'where':_0x320f7f[_0xa2bd('0x35')]};return db[_0xa2bd('0x2a')][_0xa2bd('0x1c')](_0x412f0d)[_0xa2bd('0x24')](function(_0x2e7b07){_0x2ac442[_0xa2bd('0x1c')]=_0x2e7b07;if(_0x15b4ea[_0xa2bd('0x2d')][_0xa2bd('0x3b')]){_0x320f7f['include']=[{'all':!![]}];}return db['ZendeskField'][_0xa2bd('0x3c')](_0x320f7f);})[_0xa2bd('0x24')](function(_0x3df091){_0x2ac442[_0xa2bd('0x3d')]=_0x3df091;return _0x2ac442;})[_0xa2bd('0x24')](respondWithFilteredResult(_0x340ff8,_0x320f7f))[_0xa2bd('0x3e')](handleError(_0x340ff8,null));};exports[_0xa2bd('0x3f')]=function(_0x4f53d4,_0x1a2304){var _0x5ea6c3={'raw':!![],'where':{'id':_0x4f53d4[_0xa2bd('0x40')]['id']}},_0x35a5dc={};_0x35a5dc[_0xa2bd('0x2c')]=_[_0xa2bd('0x41')](db[_0xa2bd('0x2a')][_0xa2bd('0x42')]);_0x35a5dc[_0xa2bd('0x2d')]=_[_0xa2bd('0x41')](_0x4f53d4[_0xa2bd('0x2d')]);_0x35a5dc[_0xa2bd('0x2e')]=_[_0xa2bd('0x2f')](_0x35a5dc[_0xa2bd('0x2c')],_0x35a5dc[_0xa2bd('0x2d')]);_0x5ea6c3[_0xa2bd('0x30')]=_['intersection'](_0x35a5dc[_0xa2bd('0x2c')],qs[_0xa2bd('0x31')](_0x4f53d4[_0xa2bd('0x2d')][_0xa2bd('0x31')]));_0x5ea6c3[_0xa2bd('0x30')]=_0x5ea6c3[_0xa2bd('0x30')][_0xa2bd('0x32')]?_0x5ea6c3['attributes']:_0x35a5dc[_0xa2bd('0x2c')];if(_0x4f53d4['query'][_0xa2bd('0x3b')]){_0x5ea6c3[_0xa2bd('0x43')]=[{'all':!![]}];}_0x5ea6c3=_['merge']({},_0x5ea6c3,_0x4f53d4[_0xa2bd('0x3a')]);return db['ZendeskField'][_0xa2bd('0x44')](_0x5ea6c3)[_0xa2bd('0x24')](handleEntityNotFound(_0x1a2304,null))[_0xa2bd('0x24')](respondWithResult(_0x1a2304,null))[_0xa2bd('0x3e')](handleError(_0x1a2304,null));};exports[_0xa2bd('0x45')]=function(_0x2d1629,_0xea44c7){return db[_0xa2bd('0x2a')]['create'](_0x2d1629['body'],{})['then'](respondWithResult(_0xea44c7,0xc9))[_0xa2bd('0x3e')](handleError(_0xea44c7,null));};exports['update']=function(_0x5c0230,_0x55c7fa){if(_0x5c0230['body']['id']){delete _0x5c0230['body']['id'];}return db[_0xa2bd('0x2a')][_0xa2bd('0x44')]({'where':{'id':_0x5c0230[_0xa2bd('0x40')]['id']}})[_0xa2bd('0x24')](handleEntityNotFound(_0x55c7fa,null))['then'](saveUpdates(_0x5c0230[_0xa2bd('0x46')],null))[_0xa2bd('0x24')](respondWithResult(_0x55c7fa,null))[_0xa2bd('0x3e')](handleError(_0x55c7fa,null));};exports[_0xa2bd('0x47')]=function(_0x5e2546,_0xd81907){return db[_0xa2bd('0x2a')][_0xa2bd('0x44')]({'where':{'id':_0x5e2546[_0xa2bd('0x40')]['id']}})[_0xa2bd('0x24')](handleEntityNotFound(_0xd81907,null))['then'](removeEntity(_0xd81907,null))[_0xa2bd('0x3e')](handleError(_0xd81907,null));}; \ No newline at end of file +var _0xd68a=['fast-json-patch','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','save','update','then','destroy','stack','name','index','map','ZendeskField','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x5529fa,_0x1030a3){var _0x3f7313=function(_0x516862){while(--_0x516862){_0x5529fa['push'](_0x5529fa['shift']());}};_0x3f7313(++_0x1030a3);}(_0xd68a,0xc6));var _0xad68=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xd68a[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0xad68('0x0'));var rimraf=require(_0xad68('0x1'));var zipdir=require(_0xad68('0x2'));var jsonpatch=require(_0xad68('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad68('0x4'));var Mustache=require(_0xad68('0x5'));var util=require(_0xad68('0x6'));var path=require(_0xad68('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad68('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xad68('0x9'));var crypto=require(_0xad68('0xa'));var jsforce=require(_0xad68('0xb'));var deskjs=require(_0xad68('0xc'));var toCsv=require(_0xad68('0xd'));var querystring=require(_0xad68('0xe'));var Papa=require(_0xad68('0xf'));var Redis=require(_0xad68('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xad68('0x11'));var as=require(_0xad68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xad68('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xad68('0x14'))['db'];function respondWithStatusCode(_0x285f5a,_0x4aba2f){_0x4aba2f=_0x4aba2f||0xcc;return function(_0x2181ea){if(_0x2181ea){return _0x285f5a[_0xad68('0x15')](_0x4aba2f);}return _0x285f5a[_0xad68('0x16')](_0x4aba2f)[_0xad68('0x17')]();};}function respondWithResult(_0x4d96c6,_0x494329){_0x494329=_0x494329||0xc8;return function(_0x37f9ec){if(_0x37f9ec){return _0x4d96c6[_0xad68('0x16')](_0x494329)['json'](_0x37f9ec);}};}function respondWithFilteredResult(_0x4c5ae2,_0x50da04){return function(_0x2c3649){if(_0x2c3649){var _0x5286cc=typeof _0x50da04[_0xad68('0x18')]===_0xad68('0x19')&&typeof _0x50da04[_0xad68('0x1a')]===_0xad68('0x19');var _0x6f57b4=_0x2c3649['count'];var _0x545714=_0x5286cc?0x0:_0x50da04[_0xad68('0x18')];var _0x3b36cd=_0x5286cc?_0x2c3649['count']:_0x50da04[_0xad68('0x18')]+_0x50da04['limit'];var _0x318f;if(_0x3b36cd>=_0x6f57b4){_0x3b36cd=_0x6f57b4;_0x318f=0xc8;}else{_0x318f=0xce;}_0x4c5ae2['status'](_0x318f);return _0x4c5ae2['set'](_0xad68('0x1b'),_0x545714+'-'+_0x3b36cd+'/'+_0x6f57b4)['json'](_0x2c3649);}return null;};}function patchUpdates(_0x463d40){return function(_0x1b2e02){try{jsonpatch['apply'](_0x1b2e02,_0x463d40,!![]);}catch(_0x2d4347){return BPromise['reject'](_0x2d4347);}return _0x1b2e02[_0xad68('0x1c')]();};}function saveUpdates(_0xe11425,_0x6ed158){return function(_0x2cab79){if(_0x2cab79){return _0x2cab79[_0xad68('0x1d')](_0xe11425)[_0xad68('0x1e')](function(_0xe09090){return _0xe09090;});}return null;};}function removeEntity(_0x4f5c50,_0x311555){return function(_0x3acc86){if(_0x3acc86){return _0x3acc86[_0xad68('0x1f')]()['then'](function(){_0x4f5c50[_0xad68('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469dd5,_0x2fada1){return function(_0x415eed){if(!_0x415eed){_0x469dd5['sendStatus'](0x194);}return _0x415eed;};}function handleError(_0x2c526c,_0x585ae1){_0x585ae1=_0x585ae1||0x1f4;return function(_0x4d1cec){logger['error'](_0x4d1cec[_0xad68('0x20')]);if(_0x4d1cec[_0xad68('0x21')]){delete _0x4d1cec[_0xad68('0x21')];}_0x2c526c[_0xad68('0x16')](_0x585ae1)['send'](_0x4d1cec);};}exports[_0xad68('0x22')]=function(_0x267f34,_0x7e8344){var _0x4aa051={},_0x404f81={},_0x4c0d2f={'count':0x0,'rows':[]};var _0x4e6867=_[_0xad68('0x23')](db[_0xad68('0x24')]['rawAttributes'],function(_0x6fb025){return{'name':_0x6fb025[_0xad68('0x25')],'type':_0x6fb025[_0xad68('0x26')]['key']};});_0x404f81['model']=_[_0xad68('0x23')](_0x4e6867,_0xad68('0x21'));_0x404f81[_0xad68('0x27')]=_[_0xad68('0x28')](_0x267f34['query']);_0x404f81[_0xad68('0x29')]=_[_0xad68('0x2a')](_0x404f81['model'],_0x404f81[_0xad68('0x27')]);_0x4aa051['attributes']=_[_0xad68('0x2a')](_0x404f81[_0xad68('0x2b')],qs['fields'](_0x267f34['query']['fields']));_0x4aa051[_0xad68('0x2c')]=_0x4aa051[_0xad68('0x2c')][_0xad68('0x2d')]?_0x4aa051[_0xad68('0x2c')]:_0x404f81[_0xad68('0x2b')];if(!_0x267f34[_0xad68('0x27')][_0xad68('0x2e')](_0xad68('0x2f'))){_0x4aa051['limit']=qs[_0xad68('0x1a')](_0x267f34[_0xad68('0x27')][_0xad68('0x1a')]);_0x4aa051[_0xad68('0x18')]=qs['offset'](_0x267f34[_0xad68('0x27')][_0xad68('0x18')]);}_0x4aa051['order']=qs['sort'](_0x267f34[_0xad68('0x27')][_0xad68('0x30')]);_0x4aa051['where']=qs[_0xad68('0x29')](_[_0xad68('0x31')](_0x267f34[_0xad68('0x27')],_0x404f81[_0xad68('0x29')]),_0x4e6867);if(_0x267f34['query'][_0xad68('0x32')]){_0x4aa051['where']=_[_0xad68('0x33')](_0x4aa051[_0xad68('0x34')],{'$or':_[_0xad68('0x23')](_0x4e6867,function(_0x1d2dec){if(_0x1d2dec[_0xad68('0x26')]!==_0xad68('0x35')){var _0x6e55d0={};_0x6e55d0[_0x1d2dec['name']]={'$like':'%'+_0x267f34['query']['filter']+'%'};return _0x6e55d0;}})});}_0x4aa051=_[_0xad68('0x33')]({},_0x4aa051,_0x267f34[_0xad68('0x36')]);var _0x3a7c3f={'where':_0x4aa051[_0xad68('0x34')]};return db[_0xad68('0x24')][_0xad68('0x37')](_0x3a7c3f)[_0xad68('0x1e')](function(_0x50d082){_0x4c0d2f[_0xad68('0x37')]=_0x50d082;if(_0x267f34['query'][_0xad68('0x38')]){_0x4aa051['include']=[{'all':!![]}];}return db[_0xad68('0x24')]['findAll'](_0x4aa051);})[_0xad68('0x1e')](function(_0x1405a0){_0x4c0d2f[_0xad68('0x39')]=_0x1405a0;return _0x4c0d2f;})['then'](respondWithFilteredResult(_0x7e8344,_0x4aa051))[_0xad68('0x3a')](handleError(_0x7e8344,null));};exports[_0xad68('0x3b')]=function(_0x5044d0,_0x960b21){var _0x2d1edb={'raw':!![],'where':{'id':_0x5044d0[_0xad68('0x3c')]['id']}},_0x460524={};_0x460524[_0xad68('0x2b')]=_[_0xad68('0x28')](db[_0xad68('0x24')][_0xad68('0x3d')]);_0x460524[_0xad68('0x27')]=_['keys'](_0x5044d0[_0xad68('0x27')]);_0x460524[_0xad68('0x29')]=_[_0xad68('0x2a')](_0x460524[_0xad68('0x2b')],_0x460524[_0xad68('0x27')]);_0x2d1edb[_0xad68('0x2c')]=_[_0xad68('0x2a')](_0x460524['model'],qs['fields'](_0x5044d0[_0xad68('0x27')][_0xad68('0x3e')]));_0x2d1edb[_0xad68('0x2c')]=_0x2d1edb[_0xad68('0x2c')]['length']?_0x2d1edb[_0xad68('0x2c')]:_0x460524[_0xad68('0x2b')];if(_0x5044d0[_0xad68('0x27')]['includeAll']){_0x2d1edb[_0xad68('0x3f')]=[{'all':!![]}];}_0x2d1edb=_[_0xad68('0x33')]({},_0x2d1edb,_0x5044d0[_0xad68('0x36')]);return db['ZendeskField'][_0xad68('0x40')](_0x2d1edb)[_0xad68('0x1e')](handleEntityNotFound(_0x960b21,null))[_0xad68('0x1e')](respondWithResult(_0x960b21,null))['catch'](handleError(_0x960b21,null));};exports['create']=function(_0x1fa9e9,_0x42c6d3){return db[_0xad68('0x24')][_0xad68('0x41')](_0x1fa9e9[_0xad68('0x42')],{})[_0xad68('0x1e')](respondWithResult(_0x42c6d3,0xc9))['catch'](handleError(_0x42c6d3,null));};exports[_0xad68('0x1d')]=function(_0x29dcfc,_0x4c2901){if(_0x29dcfc[_0xad68('0x42')]['id']){delete _0x29dcfc['body']['id'];}return db[_0xad68('0x24')][_0xad68('0x40')]({'where':{'id':_0x29dcfc['params']['id']}})['then'](handleEntityNotFound(_0x4c2901,null))['then'](saveUpdates(_0x29dcfc[_0xad68('0x42')],null))[_0xad68('0x1e')](respondWithResult(_0x4c2901,null))[_0xad68('0x3a')](handleError(_0x4c2901,null));};exports[_0xad68('0x1f')]=function(_0x201cae,_0x21cafc){return db[_0xad68('0x24')][_0xad68('0x40')]({'where':{'id':_0x201cae[_0xad68('0x3c')]['id']}})[_0xad68('0x1e')](handleEntityNotFound(_0x21cafc,null))['then'](removeEntity(_0x21cafc,null))[_0xad68('0x3a')](handleError(_0x21cafc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 898747e..f59b659 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 _0xda56=['int_zendesk_fields','zendesk_unique_index','idField','../../config/logger','api','moment','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x2f36d2,_0x24285c){var _0x147f7f=function(_0x41db50){while(--_0x41db50){_0x2f36d2['push'](_0x2f36d2['shift']());}};_0x147f7f(++_0x24285c);}(_0xda56,0x123));var _0x6da5=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0xda56[_0xf46bd9];return _0x2763c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6da5('0x0'))(_0x6da5('0x1'));var moment=require(_0x6da5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6da5('0x3'));var rimraf=require('rimraf');var config=require(_0x6da5('0x4'));var attributes=require(_0x6da5('0x5'));module[_0x6da5('0x6')]=function(_0xf45f0,_0x6b6a92){return _0xf45f0[_0x6da5('0x7')](_0x6da5('0x8'),attributes,{'tableName':_0x6da5('0x9'),'paranoid':![],'indexes':[{'name':_0x6da5('0xa'),'fields':[_0x6da5('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20d1=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes'];(function(_0x24d344,_0x4a2291){var _0x341736=function(_0x40fb8b){while(--_0x40fb8b){_0x24d344['push'](_0x24d344['shift']());}};_0x341736(++_0x4a2291);}(_0x20d1,0x75));var _0x120d=function(_0x3dc0c3,_0x11d641){_0x3dc0c3=_0x3dc0c3-0x0;var _0x5eede1=_0x20d1[_0x3dc0c3];return _0x5eede1;};'use strict';var _=require(_0x120d('0x0'));var util=require('util');var logger=require(_0x120d('0x1'))(_0x120d('0x2'));var moment=require(_0x120d('0x3'));var BPromise=require(_0x120d('0x4'));var rp=require(_0x120d('0x5'));var fs=require('fs');var path=require(_0x120d('0x6'));var rimraf=require(_0x120d('0x7'));var config=require('../../config/environment');var attributes=require(_0x120d('0x8'));module['exports']=function(_0x4d7baa,_0x1a8e20){return _0x4d7baa[_0x120d('0x9')](_0x120d('0xa'),attributes,{'tableName':_0x120d('0xb'),'paranoid':![],'indexes':[{'name':_0x120d('0xc'),'fields':['idField',_0x120d('0xd')],'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 61f4420..9838bfa 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 _0x826d=['info','request\x20sent','debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x3eae65,_0x242f4d){var _0x4cf3db=function(_0xaf59c0){while(--_0xaf59c0){_0x3eae65['push'](_0x3eae65['shift']());}};_0x4cf3db(++_0x242f4d);}(_0x826d,0x17a));var _0xd826=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x826d[_0x14490c];return _0x2f6825;};'use strict';var _=require(_0xd826('0x0'));var util=require(_0xd826('0x1'));var moment=require(_0xd826('0x2'));var BPromise=require(_0xd826('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd826('0x4'));var db=require(_0xd826('0x5'))['db'];var utils=require(_0xd826('0x6'));var logger=require(_0xd826('0x7'))(_0xd826('0x8'));var config=require(_0xd826('0x9'));var jayson=require(_0xd826('0xa'));var client=jayson['client'][_0xd826('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2a66,_0x521e41,_0x48f9c2){return new BPromise(function(_0x1b0af8,_0x996d92){return client['request'](_0x5b2a66,_0x48f9c2)[_0xd826('0xc')](function(_0x3eaf8f){logger[_0xd826('0xd')]('ZendeskField,\x20%s,\x20%s',_0x521e41,_0xd826('0xe'));logger[_0xd826('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x521e41,_0xd826('0xe'),JSON[_0xd826('0x10')](_0x3eaf8f));if(_0x3eaf8f['error']){if(_0x3eaf8f[_0xd826('0x11')][_0xd826('0x12')]===0x1f4){logger[_0xd826('0x11')](_0xd826('0x13'),_0x521e41,_0x3eaf8f[_0xd826('0x11')][_0xd826('0x14')]);return _0x996d92(_0x3eaf8f[_0xd826('0x11')]['message']);}logger[_0xd826('0x11')](_0xd826('0x13'),_0x521e41,_0x3eaf8f[_0xd826('0x11')]['message']);return _0x1b0af8(_0x3eaf8f[_0xd826('0x11')][_0xd826('0x14')]);}else{logger[_0xd826('0xd')](_0xd826('0x13'),_0x521e41,_0xd826('0xe'));_0x1b0af8(_0x3eaf8f[_0xd826('0x15')][_0xd826('0x14')]);}})[_0xd826('0x16')](function(_0x5cfe2c){logger[_0xd826('0x11')](_0xd826('0x13'),_0x521e41,_0x5cfe2c);_0x996d92(_0x5cfe2c);});});} \ No newline at end of file +var _0x5cdd=['request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x5cdd,0x12c));var _0xd5cd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5cdd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd5cd('0x0'));var util=require(_0xd5cd('0x1'));var moment=require('moment');var BPromise=require(_0xd5cd('0x2'));var rs=require(_0xd5cd('0x3'));var fs=require('fs');var Redis=require(_0xd5cd('0x4'));var db=require(_0xd5cd('0x5'))['db'];var utils=require(_0xd5cd('0x6'));var logger=require('../../config/logger')(_0xd5cd('0x7'));var config=require(_0xd5cd('0x8'));var jayson=require(_0xd5cd('0x9'));var client=jayson[_0xd5cd('0xa')][_0xd5cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d08f,_0x4c7a8c,_0x202f3b){return new BPromise(function(_0x198409,_0x24a6fb){return client[_0xd5cd('0xc')](_0x51d08f,_0x202f3b)[_0xd5cd('0xd')](function(_0x43869a){logger['info'](_0xd5cd('0xe'),_0x4c7a8c,_0xd5cd('0xf'));logger[_0xd5cd('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4c7a8c,_0xd5cd('0xf'),JSON[_0xd5cd('0x11')](_0x43869a));if(_0x43869a['error']){if(_0x43869a['error'][_0xd5cd('0x12')]===0x1f4){logger[_0xd5cd('0x13')](_0xd5cd('0xe'),_0x4c7a8c,_0x43869a[_0xd5cd('0x13')][_0xd5cd('0x14')]);return _0x24a6fb(_0x43869a[_0xd5cd('0x13')][_0xd5cd('0x14')]);}logger[_0xd5cd('0x13')](_0xd5cd('0xe'),_0x4c7a8c,_0x43869a['error']['message']);return _0x198409(_0x43869a[_0xd5cd('0x13')][_0xd5cd('0x14')]);}else{logger[_0xd5cd('0x15')](_0xd5cd('0xe'),_0x4c7a8c,_0xd5cd('0xf'));_0x198409(_0x43869a[_0xd5cd('0x16')][_0xd5cd('0x14')]);}})[_0xd5cd('0x17')](function(_0x2db0c1){logger[_0xd5cd('0x13')](_0xd5cd('0xe'),_0x4c7a8c,_0x2db0c1);_0x24a6fb(_0x2db0c1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f77820e..6c5fd63 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 _0xcee6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy'];(function(_0x4b2310,_0x5ea021){var _0xc6dd68=function(_0x373d65){while(--_0x373d65){_0x4b2310['push'](_0x4b2310['shift']());}};_0xc6dd68(++_0x5ea021);}(_0xcee6,0x15f));var _0x6cee=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xcee6[_0x3c6dce];return _0x1450e9;};'use strict';var multer=require(_0x6cee('0x0'));var util=require(_0x6cee('0x1'));var path=require(_0x6cee('0x2'));var timeout=require(_0x6cee('0x3'));var express=require(_0x6cee('0x4'));var router=express[_0x6cee('0x5')]();var fs_extra=require(_0x6cee('0x6'));var auth=require(_0x6cee('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6cee('0x8'));var controller=require(_0x6cee('0x9'));router[_0x6cee('0xa')]('/',auth[_0x6cee('0xb')](),controller[_0x6cee('0xc')]);router[_0x6cee('0xa')](_0x6cee('0xd'),auth['isAuthenticated'](),controller[_0x6cee('0xe')]);router['get'](_0x6cee('0xf'),auth[_0x6cee('0xb')](),controller[_0x6cee('0x10')]);router[_0x6cee('0xa')](_0x6cee('0x11'),auth[_0x6cee('0xb')](),controller[_0x6cee('0x12')]);router[_0x6cee('0x13')]('/',auth[_0x6cee('0xb')](),controller['create']);router[_0x6cee('0x13')](_0x6cee('0xf'),auth[_0x6cee('0xb')](),controller['addConfiguration']);router[_0x6cee('0x14')](_0x6cee('0xd'),auth[_0x6cee('0xb')](),controller[_0x6cee('0x15')]);router[_0x6cee('0x16')](_0x6cee('0xd'),auth['isAuthenticated'](),controller[_0x6cee('0x17')]);module[_0x6cee('0x18')]=router; \ No newline at end of file +var _0xfbfe=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xfbfe,0x1ad));var _0xefbf=function(_0x56f329,_0x3e52ff){_0x56f329=_0x56f329-0x0;var _0x2ed786=_0xfbfe[_0x56f329];return _0x2ed786;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xefbf('0x0'));var timeout=require(_0xefbf('0x1'));var express=require(_0xefbf('0x2'));var router=express[_0xefbf('0x3')]();var fs_extra=require(_0xefbf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xefbf('0x5'));var config=require(_0xefbf('0x6'));var controller=require(_0xefbf('0x7'));router[_0xefbf('0x8')]('/',auth[_0xefbf('0x9')](),controller['index']);router[_0xefbf('0x8')](_0xefbf('0xa'),auth[_0xefbf('0x9')](),controller[_0xefbf('0xb')]);router['get'](_0xefbf('0xc'),auth[_0xefbf('0x9')](),controller[_0xefbf('0xd')]);router[_0xefbf('0x8')](_0xefbf('0xe'),auth['isAuthenticated'](),controller[_0xefbf('0xf')]);router[_0xefbf('0x10')]('/',auth[_0xefbf('0x9')](),controller['create']);router[_0xefbf('0x10')](_0xefbf('0xc'),auth['isAuthenticated'](),controller[_0xefbf('0x11')]);router[_0xefbf('0x12')](_0xefbf('0xa'),auth[_0xefbf('0x9')](),controller[_0xefbf('0x13')]);router[_0xefbf('0x14')](_0xefbf('0xa'),auth[_0xefbf('0x9')](),controller[_0xefbf('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8c7e009..a7fc6a3 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 _0xbd50=['STRING','sequelize','exports'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xbd50,0x196));var _0x0bd5=function(_0x125784,_0xdc246e){_0x125784=_0x125784-0x0;var _0xedefd6=_0xbd50[_0x125784];return _0xedefd6;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0bd5('0x2')]},'zone':{'type':Sequelize[_0x0bd5('0x2')]},'clientId':{'type':Sequelize[_0x0bd5('0x2')]},'clientSecret':{'type':Sequelize[_0x0bd5('0x2')]},'serverUrl':{'type':Sequelize[_0x0bd5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x00bb=['STRING','sequelize','exports'];(function(_0x17de40,_0x564903){var _0x233e21=function(_0x370c9f){while(--_0x370c9f){_0x17de40['push'](_0x17de40['shift']());}};_0x233e21(++_0x564903);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bd39458..f0973a5 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 _0x6ceb=['rows','show','params','includeAll','find','catch','create','body','destroy','getConfigurations','ZohoConfiguration','length','filter','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','options','ZohoAccount','include','findAll'];(function(_0x549652,_0x28a9f8){var _0x58cff0=function(_0x31511e){while(--_0x31511e){_0x549652['push'](_0x549652['shift']());}};_0x58cff0(++_0x28a9f8);}(_0x6ceb,0x14b));var _0xb6ce=function(_0x1bc2f0,_0x4934ec){_0x1bc2f0=_0x1bc2f0-0x0;var _0x107574=_0x6ceb[_0x1bc2f0];return _0x107574;};'use strict';var emlformat=require(_0xb6ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6ce('0x1'));var jsonpatch=require(_0xb6ce('0x2'));var rp=require(_0xb6ce('0x3'));var moment=require(_0xb6ce('0x4'));var BPromise=require(_0xb6ce('0x5'));var Mustache=require(_0xb6ce('0x6'));var util=require(_0xb6ce('0x7'));var path=require('path');var sox=require(_0xb6ce('0x8'));var csv=require('to-csv');var ejs=require(_0xb6ce('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb6ce('0xa'));var crypto=require(_0xb6ce('0xb'));var jsforce=require(_0xb6ce('0xc'));var deskjs=require(_0xb6ce('0xd'));var toCsv=require(_0xb6ce('0xe'));var querystring=require(_0xb6ce('0xf'));var Papa=require(_0xb6ce('0x10'));var Redis=require(_0xb6ce('0x11'));var authService=require(_0xb6ce('0x12'));var qs=require(_0xb6ce('0x13'));var as=require(_0xb6ce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb6ce('0x15'));var utils=require('../../config/utils');var config=require(_0xb6ce('0x16'));var licenseUtil=require(_0xb6ce('0x17'));var db=require(_0xb6ce('0x18'))['db'];var integrations=require(_0xb6ce('0x19'));function respondWithStatusCode(_0x3d2478,_0x29baaa){_0x29baaa=_0x29baaa||0xcc;return function(_0x50255d){if(_0x50255d){return _0x3d2478['sendStatus'](_0x29baaa);}return _0x3d2478[_0xb6ce('0x1a')](_0x29baaa)[_0xb6ce('0x1b')]();};}function respondWithResult(_0x2a66b3,_0x4d5a58){_0x4d5a58=_0x4d5a58||0xc8;return function(_0x27c8cc){if(_0x27c8cc){return _0x2a66b3[_0xb6ce('0x1a')](_0x4d5a58)[_0xb6ce('0x1c')](_0x27c8cc);}};}function respondWithFilteredResult(_0x3311f9,_0x615c28){return function(_0x3c5424){if(_0x3c5424){var _0x4d43ad=typeof _0x615c28[_0xb6ce('0x1d')]===_0xb6ce('0x1e')&&typeof _0x615c28[_0xb6ce('0x1f')]===_0xb6ce('0x1e');var _0x142287=_0x3c5424[_0xb6ce('0x20')];var _0x2d20a6=_0x4d43ad?0x0:_0x615c28[_0xb6ce('0x1d')];var _0x3c303d=_0x4d43ad?_0x3c5424[_0xb6ce('0x20')]:_0x615c28[_0xb6ce('0x1d')]+_0x615c28[_0xb6ce('0x1f')];var _0x5005ab;if(_0x3c303d>=_0x142287){_0x3c303d=_0x142287;_0x5005ab=0xc8;}else{_0x5005ab=0xce;}_0x3311f9['status'](_0x5005ab);return _0x3311f9[_0xb6ce('0x21')](_0xb6ce('0x22'),_0x2d20a6+'-'+_0x3c303d+'/'+_0x142287)[_0xb6ce('0x1c')](_0x3c5424);}return null;};}function patchUpdates(_0x4c4330){return function(_0x478530){try{jsonpatch[_0xb6ce('0x23')](_0x478530,_0x4c4330,!![]);}catch(_0x47a010){return BPromise[_0xb6ce('0x24')](_0x47a010);}return _0x478530[_0xb6ce('0x25')]();};}function saveUpdates(_0xf1222e,_0x4a7ddb){return function(_0x515929){if(_0x515929){return _0x515929[_0xb6ce('0x26')](_0xf1222e)['then'](function(_0x31b79f){return _0x31b79f;});}return null;};}function removeEntity(_0x4b8dc7,_0x4b476d){return function(_0x719f62){if(_0x719f62){return _0x719f62['destroy']()[_0xb6ce('0x27')](function(){_0x4b8dc7[_0xb6ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a870,_0x54a8b1){return function(_0x264e74){if(!_0x264e74){_0x43a870[_0xb6ce('0x28')](0x194);}return _0x264e74;};}function handleError(_0x28759d,_0x2c5d8e){_0x2c5d8e=_0x2c5d8e||0x1f4;return function(_0x197a3b){logger[_0xb6ce('0x29')](_0x197a3b[_0xb6ce('0x2a')]);if(_0x197a3b[_0xb6ce('0x2b')]){delete _0x197a3b[_0xb6ce('0x2b')];}_0x28759d[_0xb6ce('0x1a')](_0x2c5d8e)[_0xb6ce('0x2c')](_0x197a3b);};}exports[_0xb6ce('0x2d')]=function(_0x5c4035,_0x118296){var _0x512bbb={},_0x5a135d={},_0x21a11c={'count':0x0,'rows':[]};var _0x405796=_[_0xb6ce('0x2e')](db['ZohoAccount'][_0xb6ce('0x2f')],function(_0x3c0345){return{'name':_0x3c0345[_0xb6ce('0x30')],'type':_0x3c0345[_0xb6ce('0x31')][_0xb6ce('0x32')]};});_0x5a135d[_0xb6ce('0x33')]=_[_0xb6ce('0x2e')](_0x405796,_0xb6ce('0x2b'));_0x5a135d[_0xb6ce('0x34')]=_[_0xb6ce('0x35')](_0x5c4035[_0xb6ce('0x34')]);_0x5a135d['filters']=_[_0xb6ce('0x36')](_0x5a135d[_0xb6ce('0x33')],_0x5a135d['query']);_0x512bbb[_0xb6ce('0x37')]=_[_0xb6ce('0x36')](_0x5a135d['model'],qs['fields'](_0x5c4035[_0xb6ce('0x34')][_0xb6ce('0x38')]));_0x512bbb[_0xb6ce('0x37')]=_0x512bbb['attributes']['length']?_0x512bbb[_0xb6ce('0x37')]:_0x5a135d[_0xb6ce('0x33')];if(!_0x5c4035[_0xb6ce('0x34')][_0xb6ce('0x39')]('nolimit')){_0x512bbb['limit']=qs[_0xb6ce('0x1f')](_0x5c4035['query'][_0xb6ce('0x1f')]);_0x512bbb[_0xb6ce('0x1d')]=qs[_0xb6ce('0x1d')](_0x5c4035[_0xb6ce('0x34')][_0xb6ce('0x1d')]);}_0x512bbb['order']=qs['sort'](_0x5c4035[_0xb6ce('0x34')][_0xb6ce('0x3a')]);_0x512bbb['where']=qs[_0xb6ce('0x3b')](_[_0xb6ce('0x3c')](_0x5c4035[_0xb6ce('0x34')],_0x5a135d['filters']),_0x405796);if(_0x5c4035[_0xb6ce('0x34')]['filter']){_0x512bbb[_0xb6ce('0x3d')]=_[_0xb6ce('0x3e')](_0x512bbb[_0xb6ce('0x3d')],{'$or':_['map'](_0x405796,function(_0x2d27ef){if(_0x2d27ef[_0xb6ce('0x31')]!==_0xb6ce('0x3f')){var _0x570372={};_0x570372[_0x2d27ef[_0xb6ce('0x2b')]]={'$like':'%'+_0x5c4035[_0xb6ce('0x34')]['filter']+'%'};return _0x570372;}})});}_0x512bbb=_[_0xb6ce('0x3e')]({},_0x512bbb,_0x5c4035[_0xb6ce('0x40')]);var _0x4282ae={'where':_0x512bbb[_0xb6ce('0x3d')]};return db[_0xb6ce('0x41')][_0xb6ce('0x20')](_0x4282ae)[_0xb6ce('0x27')](function(_0x351ce2){_0x21a11c[_0xb6ce('0x20')]=_0x351ce2;if(_0x5c4035[_0xb6ce('0x34')]['includeAll']){_0x512bbb[_0xb6ce('0x42')]=[{'all':!![]}];}return db[_0xb6ce('0x41')][_0xb6ce('0x43')](_0x512bbb);})[_0xb6ce('0x27')](function(_0x5a9df8){_0x21a11c[_0xb6ce('0x44')]=_0x5a9df8;return _0x21a11c;})[_0xb6ce('0x27')](respondWithFilteredResult(_0x118296,_0x512bbb))['catch'](handleError(_0x118296,null));};exports[_0xb6ce('0x45')]=function(_0x94cbb3,_0x23707b){var _0x18c5eb={'raw':![],'where':{'id':_0x94cbb3[_0xb6ce('0x46')]['id']}},_0x10ae41={};_0x10ae41[_0xb6ce('0x33')]=_[_0xb6ce('0x35')](db[_0xb6ce('0x41')][_0xb6ce('0x2f')]);_0x10ae41[_0xb6ce('0x34')]=_[_0xb6ce('0x35')](_0x94cbb3[_0xb6ce('0x34')]);_0x10ae41[_0xb6ce('0x3b')]=_[_0xb6ce('0x36')](_0x10ae41[_0xb6ce('0x33')],_0x10ae41[_0xb6ce('0x34')]);_0x18c5eb['attributes']=_[_0xb6ce('0x36')](_0x10ae41['model'],qs[_0xb6ce('0x38')](_0x94cbb3[_0xb6ce('0x34')]['fields']));_0x18c5eb['attributes']=_0x18c5eb[_0xb6ce('0x37')]['length']?_0x18c5eb['attributes']:_0x10ae41[_0xb6ce('0x33')];if(_0x94cbb3[_0xb6ce('0x34')][_0xb6ce('0x47')]){_0x18c5eb[_0xb6ce('0x42')]=[{'all':!![]}];}_0x18c5eb=_['merge']({},_0x18c5eb,_0x94cbb3['options']);return db['ZohoAccount'][_0xb6ce('0x48')](_0x18c5eb)[_0xb6ce('0x27')](handleEntityNotFound(_0x23707b,null))[_0xb6ce('0x27')](respondWithResult(_0x23707b,null))[_0xb6ce('0x49')](handleError(_0x23707b,null));};exports[_0xb6ce('0x4a')]=function(_0x1476d3,_0x4301f6){return db[_0xb6ce('0x41')]['create'](_0x1476d3['body'],{})[_0xb6ce('0x27')](respondWithResult(_0x4301f6,0xc9))[_0xb6ce('0x49')](handleError(_0x4301f6,null));};exports['update']=function(_0x280ed1,_0xd93f7c){if(_0x280ed1[_0xb6ce('0x4b')]['id']){delete _0x280ed1['body']['id'];}return db[_0xb6ce('0x41')][_0xb6ce('0x48')]({'where':{'id':_0x280ed1[_0xb6ce('0x46')]['id']}})['then'](handleEntityNotFound(_0xd93f7c,null))[_0xb6ce('0x27')](saveUpdates(_0x280ed1[_0xb6ce('0x4b')],null))[_0xb6ce('0x27')](respondWithResult(_0xd93f7c,null))[_0xb6ce('0x49')](handleError(_0xd93f7c,null));};exports[_0xb6ce('0x4c')]=function(_0x3b3e47,_0x8e6192){return db[_0xb6ce('0x41')][_0xb6ce('0x48')]({'where':{'id':_0x3b3e47[_0xb6ce('0x46')]['id']}})['then'](handleEntityNotFound(_0x8e6192,null))[_0xb6ce('0x27')](removeEntity(_0x8e6192,null))[_0xb6ce('0x49')](handleError(_0x8e6192,null));};exports[_0xb6ce('0x4d')]=function(_0x2f6575,_0x359aa4,_0x102d1c){var _0x33d6b6={};var _0x4889ca={};var _0x3e0833;var _0x19ad23;return db['ZohoAccount']['findOne']({'where':{'id':_0x2f6575[_0xb6ce('0x46')]['id']}})[_0xb6ce('0x27')](handleEntityNotFound(_0x359aa4,null))['then'](function(_0x5c81da){if(_0x5c81da){_0x3e0833=_0x5c81da;_0x4889ca[_0xb6ce('0x33')]=_[_0xb6ce('0x35')](db[_0xb6ce('0x4e')]['rawAttributes']);_0x4889ca['query']=_[_0xb6ce('0x35')](_0x2f6575[_0xb6ce('0x34')]);_0x4889ca[_0xb6ce('0x3b')]=_[_0xb6ce('0x36')](_0x4889ca['model'],_0x4889ca['query']);_0x33d6b6[_0xb6ce('0x37')]=_[_0xb6ce('0x36')](_0x4889ca['model'],qs[_0xb6ce('0x38')](_0x2f6575[_0xb6ce('0x34')][_0xb6ce('0x38')]));_0x33d6b6['attributes']=_0x33d6b6['attributes'][_0xb6ce('0x4f')]?_0x33d6b6['attributes']:_0x4889ca[_0xb6ce('0x33')];_0x33d6b6['order']=qs[_0xb6ce('0x3a')](_0x2f6575[_0xb6ce('0x34')][_0xb6ce('0x3a')]);_0x33d6b6[_0xb6ce('0x3d')]=qs[_0xb6ce('0x3b')](_[_0xb6ce('0x3c')](_0x2f6575[_0xb6ce('0x34')],_0x4889ca['filters']));if(_0x2f6575[_0xb6ce('0x34')][_0xb6ce('0x50')]){_0x33d6b6[_0xb6ce('0x3d')]=_[_0xb6ce('0x3e')](_0x33d6b6[_0xb6ce('0x3d')],{'$or':_[_0xb6ce('0x2e')](_0x33d6b6[_0xb6ce('0x37')],function(_0x814bed){var _0x57eaaa={};_0x57eaaa[_0x814bed]={'$like':'%'+_0x2f6575[_0xb6ce('0x34')][_0xb6ce('0x50')]+'%'};return _0x57eaaa;})});}_0x33d6b6=_[_0xb6ce('0x3e')]({},_0x33d6b6,_0x2f6575[_0xb6ce('0x40')]);return _0x3e0833['getConfigurations'](_0x33d6b6);}})[_0xb6ce('0x27')](function(_0x436615){if(_0x436615){_0x19ad23=_0x436615[_0xb6ce('0x4f')];if(!_0x2f6575['query']['hasOwnProperty'](_0xb6ce('0x51'))){_0x33d6b6['limit']=qs['limit'](_0x2f6575[_0xb6ce('0x34')][_0xb6ce('0x1f')]);_0x33d6b6[_0xb6ce('0x1d')]=qs[_0xb6ce('0x1d')](_0x2f6575['query']['offset']);}return _0x3e0833[_0xb6ce('0x4d')](_0x33d6b6);}})[_0xb6ce('0x27')](function(_0x442e94){if(_0x442e94){return _0x442e94?{'count':_0x19ad23,'rows':_0x442e94}:null;}})[_0xb6ce('0x27')](respondWithResult(_0x359aa4,null))[_0xb6ce('0x49')](handleError(_0x359aa4,null));};exports['addConfiguration']=function(_0x5ae25e,_0x21d45a,_0x4aafb0){if(_0x5ae25e[_0xb6ce('0x4b')]['id']){delete _0x5ae25e[_0xb6ce('0x4b')]['id'];}return db[_0xb6ce('0x41')][_0xb6ce('0x52')]({'where':{'id':_0x5ae25e[_0xb6ce('0x46')]['id']}})['then'](handleEntityNotFound(_0x21d45a,null))[_0xb6ce('0x27')](function(_0x4a1805){if(_0x4a1805){_0x5ae25e[_0xb6ce('0x4b')][_0xb6ce('0x53')]=_0x4a1805['id'];_0x5ae25e[_0xb6ce('0x4b')][_0xb6ce('0x54')]=integrations[_0xb6ce('0x55')](_0x5ae25e['body'][_0xb6ce('0x56')],_0x5ae25e[_0xb6ce('0x4b')]['type']);_0x5ae25e[_0xb6ce('0x4b')][_0xb6ce('0x57')]=integrations[_0xb6ce('0x58')](_0x5ae25e[_0xb6ce('0x4b')][_0xb6ce('0x56')],_0x5ae25e[_0xb6ce('0x4b')][_0xb6ce('0x31')]);return db[_0xb6ce('0x4e')][_0xb6ce('0x4a')](_0x5ae25e[_0xb6ce('0x4b')],{'include':[{'model':db[_0xb6ce('0x59')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xb6ce('0x57')}]});}return null;})[_0xb6ce('0x27')](respondWithResult(_0x21d45a,null))[_0xb6ce('0x49')](handleError(_0x21d45a,null));};function getAccessToken(_0x2643db){return new Promise(function(_0x34eec8,_0x4796af){var _0x2abc99;switch(_0x2643db['zone']){case'US':_0x2abc99=_0xb6ce('0x5a');break;case'AU':_0x2abc99='https://accounts.zoho.com.au';break;case'EU':_0x2abc99=_0xb6ce('0x5b');break;case'IN':_0x2abc99=_0xb6ce('0x5c');break;case'CN':_0x2abc99=_0xb6ce('0x5d');break;default:_0x2abc99=_0xb6ce('0x5b');break;}var _0x4d2bc6={'method':_0xb6ce('0x5e'),'uri':_0x2abc99+'/oauth/v2/token','qs':{'refresh_token':_0x2643db[_0xb6ce('0x5f')],'client_id':_0x2643db[_0xb6ce('0x60')],'client_secret':_0x2643db[_0xb6ce('0x61')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4d2bc6)[_0xb6ce('0x27')](function(_0x38b700){if(_0x38b700[_0xb6ce('0x62')]){_0x34eec8(_0x38b700['access_token']);}else{_0x4796af(_0xb6ce('0x63'));}})[_0xb6ce('0x49')](function(_0x46bcd7){_0x4796af(_0x46bcd7);});});}exports[_0xb6ce('0x64')]=function(_0x1d8290,_0x2f30ca,_0x2993be){var _0x4cb38c,_0x9a73af,_0x5324aa,_0x51c9cd,_0x41d9db;return db[_0xb6ce('0x41')]['findOne']({'where':{'id':_0x1d8290[_0xb6ce('0x46')]['id']},'attributes':['id',_0xb6ce('0x65'),_0xb6ce('0x66'),_0xb6ce('0x60'),_0xb6ce('0x61'),_0xb6ce('0x67'),_0xb6ce('0x68'),_0xb6ce('0x5f')]})[_0xb6ce('0x27')](handleEntityNotFound(_0x2f30ca,null))[_0xb6ce('0x27')](function(_0x231a63){_0x41d9db=_0x231a63;_0x4cb38c=_0x41d9db[_0xb6ce('0x65')];_0x9a73af=_0x4cb38c==='zoho.eu'?'eu':_0xb6ce('0x69');_0x5324aa=_0x41d9db[_0xb6ce('0x67')];var _0x58835b=_0x5324aa['slice'](-0x1);if(_0x58835b==='/'||_0x58835b==='\x5c'||_0x58835b===':'){_0x5324aa=_0x5324aa[_0xb6ce('0x6a')](0x0,_0x5324aa[_0xb6ce('0x6b')](_0x58835b));}if(!_0x41d9db[_0xb6ce('0x5f')]){throw new Error(_0xb6ce('0x6c'));}return getAccessToken(_0x41d9db);})[_0xb6ce('0x27')](function(_0x3d85cd){if(_0x3d85cd){return rp({'method':_0xb6ce('0x6d'),'uri':util[_0xb6ce('0x6e')](_0xb6ce('0x6f'),_0x9a73af),'qs':{'module':'Calls'},'headers':{'Authorization':_0xb6ce('0x70')+_0x3d85cd},'json':!![]});}})[_0xb6ce('0x27')](function(_0x34185d){if(_0x34185d){if(_0x34185d[_0xb6ce('0x71')]&&_0x34185d[_0xb6ce('0x71')][_0xb6ce('0x29')]){throw new Error(_0x34185d['response'][_0xb6ce('0x29')]['message']);}var _0x119335=[];var _0x1ee7a1=[];var _0x14e8bb=[_0xb6ce('0x72'),_0xb6ce('0x73'),_0xb6ce('0x74'),_0xb6ce('0x75'),_0xb6ce('0x76'),_0xb6ce('0x77'),'Call_Start_Time',_0xb6ce('0x78')];_0x1ee7a1=_[_0xb6ce('0x79')](_0x34185d[_0xb6ce('0x38')],function(_0x472b3f){return _0x14e8bb['includes'](_0x472b3f[_0xb6ce('0x7a')]);});for(var _0x1bf582=0x0;_0x1bf582<_0x1ee7a1['length'];_0x1bf582++){if(_0x1ee7a1[_0x1bf582][_0xb6ce('0x7b')]===![]){_0x119335[_0xb6ce('0x7c')]({'id':_0x1ee7a1[_0x1bf582]['id'],'name':_0x1ee7a1[_0x1bf582][_0xb6ce('0x7d')],'custom':_0x1ee7a1[_0x1bf582]['custom_field'],'options':_0x1ee7a1[_0x1bf582][_0xb6ce('0x7e')]===_0xb6ce('0x7f')&&_0x1ee7a1[_0x1bf582][_0xb6ce('0x80')]['length']>-0x1?_['map'](_0x1ee7a1[_0x1bf582][_0xb6ce('0x80')],function(_0x403d27){return{'name':_0x403d27,'value':_0x403d27};}):[]});}}return{'count':_0x119335[_0xb6ce('0x4f')],'rows':_0x119335};}else{return{'count':0x0,'rows':[]};}})[_0xb6ce('0x27')](respondWithResult(_0x2f30ca,null))['catch'](function(_0x3e9b37){var _0x5aee64=_0x1d8290[_0xb6ce('0x34')][_0xb6ce('0x81')]?0x1f4:_0x3e9b37[_0xb6ce('0x82')]||0x1f4;logger['error'](_0xb6ce('0x83'),_0xb6ce('0x64'),_0x5aee64,JSON[_0xb6ce('0x84')](_0x3e9b37));delete _0x3e9b37['name'];if(_0x5aee64===0x191){_0x5aee64=0x190;}_0x2f30ca[_0xb6ce('0x1a')](_0x5aee64)[_0xb6ce('0x2c')](_0x1d8290[_0xb6ce('0x34')][_0xb6ce('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x3e9b37[_0xb6ce('0x82')]}:_0x3e9b37);});}; \ No newline at end of file +var _0xf672=['Call_Duration','Call_Result','Call_Type','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','update','find','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId'];(function(_0x9717be,_0x3557cc){var _0x1e36b3=function(_0x4799d3){while(--_0x4799d3){_0x9717be['push'](_0x9717be['shift']());}};_0x1e36b3(++_0x3557cc);}(_0xf672,0x107));var _0x2f67=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf672[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x2f67('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f67('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f67('0x2'));var Mustache=require(_0x2f67('0x3'));var util=require(_0x2f67('0x4'));var path=require(_0x2f67('0x5'));var sox=require('sox');var csv=require(_0x2f67('0x6'));var ejs=require(_0x2f67('0x7'));var fs=require('fs');var fs_extra=require(_0x2f67('0x8'));var _=require(_0x2f67('0x9'));var squel=require('squel');var crypto=require(_0x2f67('0xa'));var jsforce=require(_0x2f67('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2f67('0x6'));var querystring=require('querystring');var Papa=require(_0x2f67('0xc'));var Redis=require(_0x2f67('0xd'));var authService=require(_0x2f67('0xe'));var qs=require(_0x2f67('0xf'));var as=require(_0x2f67('0x10'));var hardwareService=require(_0x2f67('0x11'));var logger=require(_0x2f67('0x12'))(_0x2f67('0x13'));var utils=require(_0x2f67('0x14'));var config=require(_0x2f67('0x15'));var licenseUtil=require(_0x2f67('0x16'));var db=require(_0x2f67('0x17'))['db'];var integrations=require(_0x2f67('0x18'));function respondWithStatusCode(_0x5d244c,_0x27f1b3){_0x27f1b3=_0x27f1b3||0xcc;return function(_0x24b99b){if(_0x24b99b){return _0x5d244c[_0x2f67('0x19')](_0x27f1b3);}return _0x5d244c[_0x2f67('0x1a')](_0x27f1b3)[_0x2f67('0x1b')]();};}function respondWithResult(_0x279fac,_0x3bcc7c){_0x3bcc7c=_0x3bcc7c||0xc8;return function(_0x2693f6){if(_0x2693f6){return _0x279fac[_0x2f67('0x1a')](_0x3bcc7c)[_0x2f67('0x1c')](_0x2693f6);}};}function respondWithFilteredResult(_0x2b81d9,_0x3eb603){return function(_0x330f08){if(_0x330f08){var _0x426c50=typeof _0x3eb603[_0x2f67('0x1d')]===_0x2f67('0x1e')&&typeof _0x3eb603[_0x2f67('0x1f')]==='undefined';var _0x9266ed=_0x330f08[_0x2f67('0x20')];var _0x5c6326=_0x426c50?0x0:_0x3eb603[_0x2f67('0x1d')];var _0x4a37b0=_0x426c50?_0x330f08['count']:_0x3eb603['offset']+_0x3eb603['limit'];var _0x3d76db;if(_0x4a37b0>=_0x9266ed){_0x4a37b0=_0x9266ed;_0x3d76db=0xc8;}else{_0x3d76db=0xce;}_0x2b81d9[_0x2f67('0x1a')](_0x3d76db);return _0x2b81d9[_0x2f67('0x21')]('Content-Range',_0x5c6326+'-'+_0x4a37b0+'/'+_0x9266ed)['json'](_0x330f08);}return null;};}function patchUpdates(_0x32f18b){return function(_0x5b2715){try{jsonpatch[_0x2f67('0x22')](_0x5b2715,_0x32f18b,!![]);}catch(_0x1ab33b){return BPromise[_0x2f67('0x23')](_0x1ab33b);}return _0x5b2715['save']();};}function saveUpdates(_0x9a8cd0,_0x11f2d2){return function(_0x27d498){if(_0x27d498){return _0x27d498['update'](_0x9a8cd0)[_0x2f67('0x24')](function(_0x59db4b){return _0x59db4b;});}return null;};}function removeEntity(_0x3d8f54,_0x5e022f){return function(_0xfb9088){if(_0xfb9088){return _0xfb9088[_0x2f67('0x25')]()[_0x2f67('0x24')](function(){_0x3d8f54[_0x2f67('0x1a')](0xcc)[_0x2f67('0x1b')]();});}};}function handleEntityNotFound(_0x4988c7,_0xf10ce3){return function(_0x2d491c){if(!_0x2d491c){_0x4988c7['sendStatus'](0x194);}return _0x2d491c;};}function handleError(_0x3130d6,_0x11aa7b){_0x11aa7b=_0x11aa7b||0x1f4;return function(_0x1eb576){logger[_0x2f67('0x26')](_0x1eb576[_0x2f67('0x27')]);if(_0x1eb576[_0x2f67('0x28')]){delete _0x1eb576[_0x2f67('0x28')];}_0x3130d6[_0x2f67('0x1a')](_0x11aa7b)[_0x2f67('0x29')](_0x1eb576);};}exports[_0x2f67('0x2a')]=function(_0x1d37fc,_0xb341e0){var _0x29910c={},_0x5e38ef={},_0x97c373={'count':0x0,'rows':[]};var _0x51e125=_[_0x2f67('0x2b')](db[_0x2f67('0x2c')][_0x2f67('0x2d')],function(_0x1c5114){return{'name':_0x1c5114['fieldName'],'type':_0x1c5114['type'][_0x2f67('0x2e')]};});_0x5e38ef[_0x2f67('0x2f')]=_[_0x2f67('0x2b')](_0x51e125,_0x2f67('0x28'));_0x5e38ef[_0x2f67('0x30')]=_[_0x2f67('0x31')](_0x1d37fc[_0x2f67('0x30')]);_0x5e38ef['filters']=_['intersection'](_0x5e38ef[_0x2f67('0x2f')],_0x5e38ef['query']);_0x29910c['attributes']=_[_0x2f67('0x32')](_0x5e38ef[_0x2f67('0x2f')],qs['fields'](_0x1d37fc[_0x2f67('0x30')]['fields']));_0x29910c[_0x2f67('0x33')]=_0x29910c[_0x2f67('0x33')][_0x2f67('0x34')]?_0x29910c[_0x2f67('0x33')]:_0x5e38ef['model'];if(!_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x35')](_0x2f67('0x36'))){_0x29910c[_0x2f67('0x1f')]=qs[_0x2f67('0x1f')](_0x1d37fc[_0x2f67('0x30')]['limit']);_0x29910c[_0x2f67('0x1d')]=qs[_0x2f67('0x1d')](_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x1d')]);}_0x29910c['order']=qs[_0x2f67('0x37')](_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x37')]);_0x29910c[_0x2f67('0x38')]=qs[_0x2f67('0x39')](_[_0x2f67('0x3a')](_0x1d37fc[_0x2f67('0x30')],_0x5e38ef[_0x2f67('0x39')]),_0x51e125);if(_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x3b')]){_0x29910c['where']=_[_0x2f67('0x3c')](_0x29910c[_0x2f67('0x38')],{'$or':_[_0x2f67('0x2b')](_0x51e125,function(_0x355a5f){if(_0x355a5f[_0x2f67('0x3d')]!==_0x2f67('0x3e')){var _0x54e824={};_0x54e824[_0x355a5f[_0x2f67('0x28')]]={'$like':'%'+_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x3b')]+'%'};return _0x54e824;}})});}_0x29910c=_[_0x2f67('0x3c')]({},_0x29910c,_0x1d37fc[_0x2f67('0x3f')]);var _0x4a2731={'where':_0x29910c[_0x2f67('0x38')]};return db[_0x2f67('0x2c')][_0x2f67('0x20')](_0x4a2731)['then'](function(_0x46e7cd){_0x97c373[_0x2f67('0x20')]=_0x46e7cd;if(_0x1d37fc['query'][_0x2f67('0x40')]){_0x29910c[_0x2f67('0x41')]=[{'all':!![]}];}return db[_0x2f67('0x2c')][_0x2f67('0x42')](_0x29910c);})['then'](function(_0x181759){_0x97c373[_0x2f67('0x43')]=_0x181759;return _0x97c373;})['then'](respondWithFilteredResult(_0xb341e0,_0x29910c))[_0x2f67('0x44')](handleError(_0xb341e0,null));};exports[_0x2f67('0x45')]=function(_0x40514e,_0x3743e4){var _0x48dc5d={'raw':![],'where':{'id':_0x40514e[_0x2f67('0x46')]['id']}},_0x3be3cc={};_0x3be3cc[_0x2f67('0x2f')]=_[_0x2f67('0x31')](db[_0x2f67('0x2c')]['rawAttributes']);_0x3be3cc[_0x2f67('0x30')]=_['keys'](_0x40514e[_0x2f67('0x30')]);_0x3be3cc[_0x2f67('0x39')]=_[_0x2f67('0x32')](_0x3be3cc[_0x2f67('0x2f')],_0x3be3cc[_0x2f67('0x30')]);_0x48dc5d[_0x2f67('0x33')]=_[_0x2f67('0x32')](_0x3be3cc['model'],qs[_0x2f67('0x47')](_0x40514e['query'][_0x2f67('0x47')]));_0x48dc5d['attributes']=_0x48dc5d[_0x2f67('0x33')][_0x2f67('0x34')]?_0x48dc5d[_0x2f67('0x33')]:_0x3be3cc[_0x2f67('0x2f')];if(_0x40514e[_0x2f67('0x30')][_0x2f67('0x40')]){_0x48dc5d['include']=[{'all':!![]}];}_0x48dc5d=_[_0x2f67('0x3c')]({},_0x48dc5d,_0x40514e[_0x2f67('0x3f')]);return db[_0x2f67('0x2c')]['find'](_0x48dc5d)[_0x2f67('0x24')](handleEntityNotFound(_0x3743e4,null))[_0x2f67('0x24')](respondWithResult(_0x3743e4,null))[_0x2f67('0x44')](handleError(_0x3743e4,null));};exports[_0x2f67('0x48')]=function(_0x55b338,_0x5c5910){return db[_0x2f67('0x2c')][_0x2f67('0x48')](_0x55b338[_0x2f67('0x49')],{})[_0x2f67('0x24')](respondWithResult(_0x5c5910,0xc9))[_0x2f67('0x44')](handleError(_0x5c5910,null));};exports[_0x2f67('0x4a')]=function(_0x5642b1,_0x498c06){if(_0x5642b1[_0x2f67('0x49')]['id']){delete _0x5642b1[_0x2f67('0x49')]['id'];}return db[_0x2f67('0x2c')][_0x2f67('0x4b')]({'where':{'id':_0x5642b1[_0x2f67('0x46')]['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x498c06,null))['then'](saveUpdates(_0x5642b1[_0x2f67('0x49')],null))[_0x2f67('0x24')](respondWithResult(_0x498c06,null))[_0x2f67('0x44')](handleError(_0x498c06,null));};exports[_0x2f67('0x25')]=function(_0x29746b,_0x29e5f3){return db[_0x2f67('0x2c')][_0x2f67('0x4b')]({'where':{'id':_0x29746b[_0x2f67('0x46')]['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x29e5f3,null))[_0x2f67('0x24')](removeEntity(_0x29e5f3,null))['catch'](handleError(_0x29e5f3,null));};exports['getConfigurations']=function(_0x1e442e,_0x5c9482,_0x19dfb4){var _0x499a50={};var _0x5b50a9={};var _0x22a60c;var _0x5bcf4c;return db[_0x2f67('0x2c')]['findOne']({'where':{'id':_0x1e442e['params']['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x5c9482,null))[_0x2f67('0x24')](function(_0xbca1ac){if(_0xbca1ac){_0x22a60c=_0xbca1ac;_0x5b50a9[_0x2f67('0x2f')]=_[_0x2f67('0x31')](db['ZohoConfiguration'][_0x2f67('0x2d')]);_0x5b50a9[_0x2f67('0x30')]=_[_0x2f67('0x31')](_0x1e442e[_0x2f67('0x30')]);_0x5b50a9[_0x2f67('0x39')]=_['intersection'](_0x5b50a9[_0x2f67('0x2f')],_0x5b50a9[_0x2f67('0x30')]);_0x499a50['attributes']=_['intersection'](_0x5b50a9[_0x2f67('0x2f')],qs[_0x2f67('0x47')](_0x1e442e[_0x2f67('0x30')]['fields']));_0x499a50[_0x2f67('0x33')]=_0x499a50[_0x2f67('0x33')][_0x2f67('0x34')]?_0x499a50['attributes']:_0x5b50a9['model'];_0x499a50['order']=qs['sort'](_0x1e442e[_0x2f67('0x30')][_0x2f67('0x37')]);_0x499a50[_0x2f67('0x38')]=qs[_0x2f67('0x39')](_['pick'](_0x1e442e[_0x2f67('0x30')],_0x5b50a9[_0x2f67('0x39')]));if(_0x1e442e['query'][_0x2f67('0x3b')]){_0x499a50['where']=_['merge'](_0x499a50[_0x2f67('0x38')],{'$or':_[_0x2f67('0x2b')](_0x499a50['attributes'],function(_0x574e8a){var _0x555df9={};_0x555df9[_0x574e8a]={'$like':'%'+_0x1e442e['query'][_0x2f67('0x3b')]+'%'};return _0x555df9;})});}_0x499a50=_[_0x2f67('0x3c')]({},_0x499a50,_0x1e442e[_0x2f67('0x3f')]);return _0x22a60c['getConfigurations'](_0x499a50);}})[_0x2f67('0x24')](function(_0x1acf35){if(_0x1acf35){_0x5bcf4c=_0x1acf35[_0x2f67('0x34')];if(!_0x1e442e[_0x2f67('0x30')][_0x2f67('0x35')](_0x2f67('0x36'))){_0x499a50[_0x2f67('0x1f')]=qs[_0x2f67('0x1f')](_0x1e442e['query'][_0x2f67('0x1f')]);_0x499a50[_0x2f67('0x1d')]=qs[_0x2f67('0x1d')](_0x1e442e[_0x2f67('0x30')]['offset']);}return _0x22a60c['getConfigurations'](_0x499a50);}})[_0x2f67('0x24')](function(_0x57f4ae){if(_0x57f4ae){return _0x57f4ae?{'count':_0x5bcf4c,'rows':_0x57f4ae}:null;}})['then'](respondWithResult(_0x5c9482,null))[_0x2f67('0x44')](handleError(_0x5c9482,null));};exports['addConfiguration']=function(_0x2fb87b,_0x401955,_0x34d395){if(_0x2fb87b['body']['id']){delete _0x2fb87b['body']['id'];}return db['ZohoAccount'][_0x2f67('0x4c')]({'where':{'id':_0x2fb87b[_0x2f67('0x46')]['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x401955,null))[_0x2f67('0x24')](function(_0x2ad06e){if(_0x2ad06e){_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x4d')]=_0x2ad06e['id'];_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x4e')]=integrations['getSubjects'](_0x2fb87b[_0x2f67('0x49')]['channel'],_0x2fb87b['body'][_0x2f67('0x3d')]);_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x4f')]=integrations[_0x2f67('0x50')](_0x2fb87b['body'][_0x2f67('0x51')],_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x3d')]);return db[_0x2f67('0x52')][_0x2f67('0x48')](_0x2fb87b[_0x2f67('0x49')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x2f67('0x53')],'as':_0x2f67('0x4f')}]});}return null;})[_0x2f67('0x24')](respondWithResult(_0x401955,null))['catch'](handleError(_0x401955,null));};function getAccessToken(_0x187664){return new Promise(function(_0x16cc5c,_0xce2903){var _0x3eb694;switch(_0x187664[_0x2f67('0x54')]){case'US':_0x3eb694=_0x2f67('0x55');break;case'AU':_0x3eb694=_0x2f67('0x56');break;case'EU':_0x3eb694='https://accounts.zoho.eu';break;case'IN':_0x3eb694=_0x2f67('0x57');break;case'CN':_0x3eb694='https://accounts.zoho.com.cn';break;default:_0x3eb694=_0x2f67('0x58');break;}var _0x286dc6={'method':'POST','uri':_0x3eb694+_0x2f67('0x59'),'qs':{'refresh_token':_0x187664['refreshToken'],'client_id':_0x187664[_0x2f67('0x5a')],'client_secret':_0x187664[_0x2f67('0x5b')],'grant_type':_0x2f67('0x5c')},'json':!![]};return rp(_0x286dc6)[_0x2f67('0x24')](function(_0x4f8d9d){if(_0x4f8d9d[_0x2f67('0x5d')]){_0x16cc5c(_0x4f8d9d[_0x2f67('0x5d')]);}else{_0xce2903('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2f67('0x44')](function(_0x1d0ac3){_0xce2903(_0x1d0ac3);});});}exports[_0x2f67('0x5e')]=function(_0x181d50,_0x4cbeb2,_0x42515f){var _0x15204d,_0x5e425c,_0x5a8f0e,_0x3a96d0,_0x442935;return db['ZohoAccount'][_0x2f67('0x4c')]({'where':{'id':_0x181d50['params']['id']},'attributes':['id',_0x2f67('0x5f'),_0x2f67('0x54'),_0x2f67('0x5a'),_0x2f67('0x5b'),_0x2f67('0x60'),_0x2f67('0x61'),_0x2f67('0x62')]})[_0x2f67('0x24')](handleEntityNotFound(_0x4cbeb2,null))[_0x2f67('0x24')](function(_0x2ba918){_0x442935=_0x2ba918;_0x15204d=_0x442935[_0x2f67('0x5f')];_0x5e425c=_0x15204d===_0x2f67('0x63')?'eu':_0x2f67('0x64');_0x5a8f0e=_0x442935['serverUrl'];var _0x3bc22a=_0x5a8f0e[_0x2f67('0x65')](-0x1);if(_0x3bc22a==='/'||_0x3bc22a==='\x5c'||_0x3bc22a===':'){_0x5a8f0e=_0x5a8f0e[_0x2f67('0x66')](0x0,_0x5a8f0e['lastIndexOf'](_0x3bc22a));}if(!_0x442935[_0x2f67('0x62')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x442935);})['then'](function(_0x5218a2){if(_0x5218a2){return rp({'method':_0x2f67('0x67'),'uri':util[_0x2f67('0x68')](_0x2f67('0x69'),_0x5e425c),'qs':{'module':'Calls'},'headers':{'Authorization':_0x2f67('0x6a')+_0x5218a2},'json':!![]});}})['then'](function(_0x404241){if(_0x404241){if(_0x404241[_0x2f67('0x6b')]&&_0x404241[_0x2f67('0x6b')][_0x2f67('0x26')]){throw new Error(_0x404241[_0x2f67('0x6b')][_0x2f67('0x26')]['message']);}var _0x1aed65=[];var _0x1e61e8=[];var _0x1ab7c7=[_0x2f67('0x6c'),_0x2f67('0x6d'),_0x2f67('0x6e'),_0x2f67('0x6f'),_0x2f67('0x70'),_0x2f67('0x71'),'Call_Start_Time',_0x2f67('0x72')];_0x1e61e8=_['remove'](_0x404241[_0x2f67('0x47')],function(_0x5bd581){return _0x1ab7c7['includes'](_0x5bd581[_0x2f67('0x73')]);});for(var _0xa2fc9d=0x0;_0xa2fc9d<_0x1e61e8[_0x2f67('0x34')];_0xa2fc9d++){if(_0x1e61e8[_0xa2fc9d][_0x2f67('0x74')]===![]){_0x1aed65[_0x2f67('0x75')]({'id':_0x1e61e8[_0xa2fc9d]['id'],'name':_0x1e61e8[_0xa2fc9d]['display_label'],'custom':_0x1e61e8[_0xa2fc9d][_0x2f67('0x76')],'options':_0x1e61e8[_0xa2fc9d]['data_type']===_0x2f67('0x77')&&_0x1e61e8[_0xa2fc9d]['pick_list_values'][_0x2f67('0x34')]>-0x1?_['map'](_0x1e61e8[_0xa2fc9d][_0x2f67('0x78')],function(_0x1e046a){return{'name':_0x1e046a,'value':_0x1e046a};}):[]});}}return{'count':_0x1aed65[_0x2f67('0x34')],'rows':_0x1aed65};}else{return{'count':0x0,'rows':[]};}})[_0x2f67('0x24')](respondWithResult(_0x4cbeb2,null))['catch'](function(_0x13e15d){var _0x10a1e0=_0x181d50['query']['test']?0x1f4:_0x13e15d[_0x2f67('0x79')]||0x1f4;logger[_0x2f67('0x26')](_0x2f67('0x7a'),_0x2f67('0x5e'),_0x10a1e0,JSON['stringify'](_0x13e15d));delete _0x13e15d[_0x2f67('0x28')];if(_0x10a1e0===0x191){_0x10a1e0=0x190;}_0x4cbeb2[_0x2f67('0x1a')](_0x10a1e0)[_0x2f67('0x29')](_0x181d50['query'][_0x2f67('0x7b')]?{'message':_0x2f67('0x7c'),'statusCode':_0x13e15d['statusCode']}:_0x13e15d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5155ab8..6fb02dd 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 _0xc60b=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refreshToken','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','format','clientId','https://accounts.zoho.com.au','info','lodash','util','../../config/logger','api','moment','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x3ec8b7,_0x4f78a0){var _0x417aae=function(_0x3b4be9){while(--_0x3b4be9){_0x3ec8b7['push'](_0x3ec8b7['shift']());}};_0x417aae(++_0x4f78a0);}(_0xc60b,0x168));var _0xbc60=function(_0x3d0196,_0x17cc51){_0x3d0196=_0x3d0196-0x0;var _0x89620=_0xc60b[_0x3d0196];return _0x89620;};'use strict';var _=require(_0xbc60('0x0'));var util=require(_0xbc60('0x1'));var logger=require(_0xbc60('0x2'))(_0xbc60('0x3'));var moment=require(_0xbc60('0x4'));var BPromise=require('bluebird');var rp=require(_0xbc60('0x5'));var fs=require('fs');var path=require(_0xbc60('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc60('0x7'));var integrations=require(_0xbc60('0x8'));module[_0xbc60('0x9')]=function(_0x328248,_0x556489){return _0x328248[_0xbc60('0xa')](_0xbc60('0xb'),attributes,{'tableName':_0xbc60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a963e,_0x451547,_0xbdff4d){if(_0x1a963e[_0xbc60('0xd')](_0xbc60('0xe'))||_0x1a963e['changed']('serverUrl')||_0x1a963e[_0xbc60('0xd')]('clientId')||_0x1a963e[_0xbc60('0xd')](_0xbc60('0xf'))||_0x1a963e[_0xbc60('0xd')](_0xbc60('0x10'))||_0x1a963e[_0xbc60('0xd')](_0xbc60('0x11'))){var _0x5b0231,_0x71953c;_0x5b0231=_0x1a963e[_0xbc60('0x12')];var _0x5d26b4=_0x5b0231[_0xbc60('0x13')](-0x1);if(_0x5d26b4==='/'||_0x5d26b4==='\x5c'||_0x5d26b4===':'){_0x5b0231=_0x5b0231[_0xbc60('0x14')](0x0,_0x5b0231['lastIndexOf'](_0x5d26b4));}switch(_0x1a963e[_0xbc60('0xe')]){case'US':_0x71953c=_0xbc60('0x15');break;case'AU':_0x71953c='https://accounts.zoho.com.au';break;case'IN':_0x71953c='https://accounts.zoho.in';break;case'CN':_0x71953c=_0xbc60('0x16');break;default:_0x71953c=_0xbc60('0x17');break;}var _0x1896c0={'method':_0xbc60('0x18'),'uri':_0x71953c+_0xbc60('0x19'),'form':{'grant_type':_0xbc60('0x1a'),'client_id':_0x1a963e['clientId'],'client_secret':_0x1a963e[_0xbc60('0xf')],'redirect_uri':_0x1a963e[_0xbc60('0x12')],'code':_0x1a963e[_0xbc60('0x10')]},'headers':{'Content-Type':_0xbc60('0x1b')}};return rp(_0x1896c0)[_0xbc60('0x1c')](function(_0x56fef8){var _0x5e5d87=JSON['parse'](_0x56fef8);if(_0x5e5d87['refresh_token']){_0x1a963e[_0xbc60('0x1d')]=_0x5e5d87[_0xbc60('0x1e')];logger['info'](util['format'](_0xbc60('0x1f'),_0x1a963e[_0xbc60('0x20')],_0x1a963e['id']));}else{logger[_0xbc60('0x21')](util['format'](_0xbc60('0x22'),_0x1a963e[_0xbc60('0x20')],_0x1a963e['id']),util[_0xbc60('0x23')](_0x5e5d87,{'showHidden':![],'depth':null}));}return _0xbdff4d(null,_0x451547);})[_0xbc60('0x24')](function(_0x5c1dad){logger['error'](util[_0xbc60('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a963e[_0xbc60('0x20')],_0x1a963e['id']),util[_0xbc60('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xbdff4d(_0x5c1dad);});}else{return _0xbdff4d(null,_0x451547);}},'beforeUpdate':function(_0x55cf30,_0x285288,_0x23257c){if(_0x55cf30[_0xbc60('0xd')](_0xbc60('0xe'))||_0x55cf30[_0xbc60('0xd')](_0xbc60('0x12'))||_0x55cf30[_0xbc60('0xd')](_0xbc60('0x26'))||_0x55cf30[_0xbc60('0xd')](_0xbc60('0xf'))||_0x55cf30[_0xbc60('0xd')]('code')||_0x55cf30[_0xbc60('0xd')](_0xbc60('0x11'))){var _0x244b8d,_0xb4939c;_0x244b8d=_0x55cf30[_0xbc60('0x12')];var _0x11ce58=_0x244b8d[_0xbc60('0x13')](-0x1);if(_0x11ce58==='/'||_0x11ce58==='\x5c'||_0x11ce58===':'){_0x244b8d=_0x244b8d[_0xbc60('0x14')](0x0,_0x244b8d['lastIndexOf'](_0x11ce58));}switch(_0x55cf30[_0xbc60('0xe')]){case'US':_0xb4939c=_0xbc60('0x15');break;case'AU':_0xb4939c=_0xbc60('0x27');break;case'IN':_0xb4939c='https://accounts.zoho.in';break;case'CN':_0xb4939c=_0xbc60('0x16');break;default:_0xb4939c=_0xbc60('0x17');break;}var _0x235c24={'method':_0xbc60('0x18'),'uri':_0xb4939c+_0xbc60('0x19'),'form':{'grant_type':_0xbc60('0x1a'),'client_id':_0x55cf30[_0xbc60('0x26')],'client_secret':_0x55cf30[_0xbc60('0xf')],'redirect_uri':_0x55cf30[_0xbc60('0x12')],'code':_0x55cf30[_0xbc60('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x235c24)['then'](function(_0x1b7fae){var _0x1ec284=JSON['parse'](_0x1b7fae);if(_0x1ec284['refresh_token']){_0x55cf30[_0xbc60('0x1d')]=_0x1ec284[_0xbc60('0x1e')];logger[_0xbc60('0x28')](util[_0xbc60('0x25')](_0xbc60('0x1f'),_0x55cf30[_0xbc60('0x20')],_0x55cf30['id']));}else{logger['error'](util['format'](_0xbc60('0x22'),_0x55cf30[_0xbc60('0x20')],_0x55cf30['id']),util[_0xbc60('0x23')](_0x1ec284,{'showHidden':![],'depth':null}));}return _0x23257c(null,_0x285288);})[_0xbc60('0x24')](function(_0x9da90a){logger[_0xbc60('0x21')](util[_0xbc60('0x25')](_0xbc60('0x22'),_0x55cf30[_0xbc60('0x20')],_0x55cf30['id']),util[_0xbc60('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x23257c(_0x9da90a);});}else{return _0x23257c(null,_0x285288);}}}});}; \ No newline at end of file +var _0x7ec6=['slice','lastIndexOf','https://accounts.zoho.com','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','../../config/logger','api','moment','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','clientSecret','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','serverUrl','code','application/x-www-form-urlencoded','then','parse','refreshToken','format','name','error','inspect','zone','host'];(function(_0x5349ca,_0x36de95){var _0x368856=function(_0xf12434){while(--_0xf12434){_0x5349ca['push'](_0x5349ca['shift']());}};_0x368856(++_0x36de95);}(_0x7ec6,0xfe));var _0x67ec=function(_0x953701,_0x5d2bf2){_0x953701=_0x953701-0x0;var _0x5a2c8f=_0x7ec6[_0x953701];return _0x5a2c8f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x67ec('0x0'))(_0x67ec('0x1'));var moment=require(_0x67ec('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x67ec('0x3'));var rimraf=require(_0x67ec('0x4'));var config=require('../../config/environment');var attributes=require(_0x67ec('0x5'));var integrations=require(_0x67ec('0x6'));module[_0x67ec('0x7')]=function(_0x4bbbe4,_0x54d400){return _0x4bbbe4['define'](_0x67ec('0x8'),attributes,{'tableName':_0x67ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29f5a3,_0x269eb9,_0x1cdd8b){if(_0x29f5a3['changed']('zone')||_0x29f5a3[_0x67ec('0xa')]('serverUrl')||_0x29f5a3['changed']('clientId')||_0x29f5a3['changed'](_0x67ec('0xb'))||_0x29f5a3[_0x67ec('0xa')]('code')||_0x29f5a3[_0x67ec('0xa')]('host')){var _0x336a67,_0x173b75;_0x336a67=_0x29f5a3['serverUrl'];var _0x2d9792=_0x336a67['slice'](-0x1);if(_0x2d9792==='/'||_0x2d9792==='\x5c'||_0x2d9792===':'){_0x336a67=_0x336a67[_0x67ec('0xc')](0x0,_0x336a67['lastIndexOf'](_0x2d9792));}switch(_0x29f5a3['zone']){case'US':_0x173b75='https://accounts.zoho.com';break;case'AU':_0x173b75=_0x67ec('0xd');break;case'IN':_0x173b75=_0x67ec('0xe');break;case'CN':_0x173b75=_0x67ec('0xf');break;default:_0x173b75=_0x67ec('0x10');break;}var _0x447e29={'method':_0x67ec('0x11'),'uri':_0x173b75+_0x67ec('0x12'),'form':{'grant_type':_0x67ec('0x13'),'client_id':_0x29f5a3[_0x67ec('0x14')],'client_secret':_0x29f5a3[_0x67ec('0xb')],'redirect_uri':_0x29f5a3[_0x67ec('0x15')],'code':_0x29f5a3[_0x67ec('0x16')]},'headers':{'Content-Type':_0x67ec('0x17')}};return rp(_0x447e29)[_0x67ec('0x18')](function(_0x52ddee){var _0x2592a8=JSON[_0x67ec('0x19')](_0x52ddee);if(_0x2592a8['refresh_token']){_0x29f5a3[_0x67ec('0x1a')]=_0x2592a8['refresh_token'];logger['info'](util[_0x67ec('0x1b')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29f5a3[_0x67ec('0x1c')],_0x29f5a3['id']));}else{logger[_0x67ec('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29f5a3[_0x67ec('0x1c')],_0x29f5a3['id']),util[_0x67ec('0x1e')](_0x2592a8,{'showHidden':![],'depth':null}));}return _0x1cdd8b(null,_0x269eb9);})['catch'](function(_0x15d5a5){logger[_0x67ec('0x1d')](util[_0x67ec('0x1b')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29f5a3[_0x67ec('0x1c')],_0x29f5a3['id']),util[_0x67ec('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x1cdd8b(_0x15d5a5);});}else{return _0x1cdd8b(null,_0x269eb9);}},'beforeUpdate':function(_0xc10e93,_0x5a059a,_0x5a3f12){if(_0xc10e93[_0x67ec('0xa')](_0x67ec('0x1f'))||_0xc10e93['changed'](_0x67ec('0x15'))||_0xc10e93['changed'](_0x67ec('0x14'))||_0xc10e93[_0x67ec('0xa')](_0x67ec('0xb'))||_0xc10e93[_0x67ec('0xa')](_0x67ec('0x16'))||_0xc10e93['changed'](_0x67ec('0x20'))){var _0xca919,_0x38d539;_0xca919=_0xc10e93['serverUrl'];var _0x3ad836=_0xca919[_0x67ec('0x21')](-0x1);if(_0x3ad836==='/'||_0x3ad836==='\x5c'||_0x3ad836===':'){_0xca919=_0xca919[_0x67ec('0xc')](0x0,_0xca919[_0x67ec('0x22')](_0x3ad836));}switch(_0xc10e93[_0x67ec('0x1f')]){case'US':_0x38d539=_0x67ec('0x23');break;case'AU':_0x38d539=_0x67ec('0xd');break;case'IN':_0x38d539=_0x67ec('0xe');break;case'CN':_0x38d539=_0x67ec('0xf');break;default:_0x38d539=_0x67ec('0x10');break;}var _0x3d9590={'method':'POST','uri':_0x38d539+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0xc10e93[_0x67ec('0x14')],'client_secret':_0xc10e93[_0x67ec('0xb')],'redirect_uri':_0xc10e93[_0x67ec('0x15')],'code':_0xc10e93[_0x67ec('0x16')]},'headers':{'Content-Type':_0x67ec('0x17')}};return rp(_0x3d9590)[_0x67ec('0x18')](function(_0x1393f8){var _0x4b8a15=JSON[_0x67ec('0x19')](_0x1393f8);if(_0x4b8a15[_0x67ec('0x24')]){_0xc10e93['refreshToken']=_0x4b8a15[_0x67ec('0x24')];logger[_0x67ec('0x25')](util[_0x67ec('0x1b')](_0x67ec('0x26'),_0xc10e93[_0x67ec('0x1c')],_0xc10e93['id']));}else{logger[_0x67ec('0x1d')](util[_0x67ec('0x1b')](_0x67ec('0x27'),_0xc10e93[_0x67ec('0x1c')],_0xc10e93['id']),util[_0x67ec('0x1e')](_0x4b8a15,{'showHidden':![],'depth':null}));}return _0x5a3f12(null,_0x5a059a);})[_0x67ec('0x28')](function(_0x4faa44){logger[_0x67ec('0x1d')](util[_0x67ec('0x1b')](_0x67ec('0x27'),_0xc10e93[_0x67ec('0x1c')],_0xc10e93['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5a3f12(_0x4faa44);});}else{return _0x5a3f12(null,_0x5a059a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 98e37c0..90942dd 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 _0xdf5d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','include','model','map','debug','where','ShowZohoAccount','lodash','util'];(function(_0x16e6db,_0x2e5a01){var _0x5a9151=function(_0x7498a4){while(--_0x7498a4){_0x16e6db['push'](_0x16e6db['shift']());}};_0x5a9151(++_0x2e5a01);}(_0xdf5d,0x126));var _0xddf5=function(_0x2d474d,_0x514c67){_0x2d474d=_0x2d474d-0x0;var _0x2973d9=_0xdf5d[_0x2d474d];return _0x2973d9;};'use strict';var _=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var moment=require(_0xddf5('0x2'));var BPromise=require(_0xddf5('0x3'));var rs=require(_0xddf5('0x4'));var fs=require('fs');var Redis=require(_0xddf5('0x5'));var db=require(_0xddf5('0x6'))['db'];var utils=require(_0xddf5('0x7'));var logger=require('../../config/logger')(_0xddf5('0x8'));var config=require(_0xddf5('0x9'));var jayson=require(_0xddf5('0xa'));var client=jayson[_0xddf5('0xb')][_0xddf5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x228fd4,_0xf3a209,_0xa029d2){return new BPromise(function(_0x3a1e13,_0x3df89){return client[_0xddf5('0xd')](_0x228fd4,_0xa029d2)[_0xddf5('0xe')](function(_0x36b306){logger[_0xddf5('0xf')](_0xddf5('0x10'),_0xf3a209,_0xddf5('0x11'));logger['debug'](_0xddf5('0x12'),_0xf3a209,_0xddf5('0x11'),JSON[_0xddf5('0x13')](_0x36b306));if(_0x36b306[_0xddf5('0x14')]){if(_0x36b306[_0xddf5('0x14')][_0xddf5('0x15')]===0x1f4){logger[_0xddf5('0x14')](_0xddf5('0x10'),_0xf3a209,_0x36b306['error']['message']);return _0x3df89(_0x36b306[_0xddf5('0x14')][_0xddf5('0x16')]);}logger[_0xddf5('0x14')](_0xddf5('0x10'),_0xf3a209,_0x36b306[_0xddf5('0x14')][_0xddf5('0x16')]);return _0x3a1e13(_0x36b306[_0xddf5('0x14')][_0xddf5('0x16')]);}else{logger['info'](_0xddf5('0x10'),_0xf3a209,_0xddf5('0x11'));_0x3a1e13(_0x36b306[_0xddf5('0x17')][_0xddf5('0x16')]);}})[_0xddf5('0x18')](function(_0x5ef952){logger[_0xddf5('0x14')]('ZohoAccount,\x20%s,\x20%s',_0xf3a209,_0x5ef952);_0x3df89(_0x5ef952);});});}exports[_0xddf5('0x19')]=function(_0x50c1ed){var _0x4b4f9a=this;return new Promise(function(_0x3d61df,_0x44db09){return db[_0xddf5('0x1a')]['findAll']({'raw':_0x50c1ed['options']?_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1c')]===undefined?!![]:![]:!![],'where':_0x50c1ed[_0xddf5('0x1b')]?_0x50c1ed[_0xddf5('0x1b')]['where']||null:null,'attributes':_0x50c1ed['options']?_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1d')]||null:null,'limit':_0x50c1ed[_0xddf5('0x1b')]?_0x50c1ed['options'][_0xddf5('0x1e')]||null:null,'include':_0x50c1ed[_0xddf5('0x1b')]?_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1f')]?_['map'](_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1f')],function(_0x496e16){return{'model':db[_0x496e16[_0xddf5('0x20')]],'as':_0x496e16['as'],'attributes':_0x496e16[_0xddf5('0x1d')],'include':_0x496e16[_0xddf5('0x1f')]?_[_0xddf5('0x21')](_0x496e16['include'],function(_0x497382){return{'model':db[_0x497382[_0xddf5('0x20')]],'as':_0x497382['as'],'attributes':_0x497382[_0xddf5('0x1d')],'include':_0x497382[_0xddf5('0x1f')]?_[_0xddf5('0x21')](_0x497382['include'],function(_0x2caa8f){return{'model':db[_0x2caa8f[_0xddf5('0x20')]],'as':_0x2caa8f['as'],'attributes':_0x2caa8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x984d22){logger[_0xddf5('0xf')](_0xddf5('0x19'),_0x50c1ed);logger[_0xddf5('0x22')](_0xddf5('0x19'),_0x50c1ed,JSON[_0xddf5('0x13')](_0x984d22));_0x3d61df(_0x984d22);})['catch'](function(_0x26f43c){logger[_0xddf5('0x14')]('GetZohoAccount',_0x26f43c[_0xddf5('0x16')],_0x50c1ed);_0x44db09(_0x4b4f9a[_0xddf5('0x14')](0x1f4,_0x26f43c[_0xddf5('0x16')]));});});};exports['ShowZohoAccount']=function(_0x4b352b){var _0x4d1632=this;return new Promise(function(_0xdc764b,_0x25e11e){return db[_0xddf5('0x1a')]['find']({'raw':_0x4b352b[_0xddf5('0x1b')]?_0x4b352b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b352b['options']?_0x4b352b[_0xddf5('0x1b')][_0xddf5('0x23')]||null:null,'attributes':_0x4b352b[_0xddf5('0x1b')]?_0x4b352b[_0xddf5('0x1b')][_0xddf5('0x1d')]||null:null,'include':_0x4b352b['options']?_0x4b352b[_0xddf5('0x1b')]['include']?_[_0xddf5('0x21')](_0x4b352b[_0xddf5('0x1b')]['include'],function(_0xf355f4){return{'model':db[_0xf355f4[_0xddf5('0x20')]],'as':_0xf355f4['as'],'attributes':_0xf355f4[_0xddf5('0x1d')],'include':_0xf355f4[_0xddf5('0x1f')]?_[_0xddf5('0x21')](_0xf355f4['include'],function(_0x873d16){return{'model':db[_0x873d16['model']],'as':_0x873d16['as'],'attributes':_0x873d16[_0xddf5('0x1d')],'include':_0x873d16[_0xddf5('0x1f')]?_['map'](_0x873d16[_0xddf5('0x1f')],function(_0x5bf8f2){return{'model':db[_0x5bf8f2[_0xddf5('0x20')]],'as':_0x5bf8f2['as'],'attributes':_0x5bf8f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4cde){logger['info'](_0xddf5('0x24'),_0x4b352b);logger[_0xddf5('0x22')](_0xddf5('0x24'),_0x4b352b,JSON[_0xddf5('0x13')](_0x1b4cde));_0xdc764b(_0x1b4cde);})[_0xddf5('0x18')](function(_0x3ff650){logger[_0xddf5('0x14')](_0xddf5('0x24'),_0x3ff650[_0xddf5('0x16')],_0x4b352b);_0x25e11e(_0x4d1632[_0xddf5('0x14')](0x1f4,_0x3ff650[_0xddf5('0x16')]));});});}; \ No newline at end of file +var _0x6888=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','info','result','catch','GetZohoAccount','options','raw','where','attributes','map','include','model','ShowZohoAccount','ZohoAccount','find'];(function(_0x2511c0,_0x29a147){var _0x3afda5=function(_0x99de5){while(--_0x99de5){_0x2511c0['push'](_0x2511c0['shift']());}};_0x3afda5(++_0x29a147);}(_0x6888,0xd2));var _0x8688=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x6888[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x8688('0x0'));var util=require('util');var moment=require(_0x8688('0x1'));var BPromise=require(_0x8688('0x2'));var rs=require(_0x8688('0x3'));var fs=require('fs');var Redis=require(_0x8688('0x4'));var db=require(_0x8688('0x5'))['db'];var utils=require(_0x8688('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8688('0x7'));var jayson=require(_0x8688('0x8'));var client=jayson[_0x8688('0x9')][_0x8688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa1a28,_0xcc92be,_0x5860a8){return new BPromise(function(_0x457991,_0x15f2b9){return client[_0x8688('0xb')](_0xfa1a28,_0x5860a8)[_0x8688('0xc')](function(_0x18723c){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xcc92be,_0x8688('0xd'));logger[_0x8688('0xe')](_0x8688('0xf'),_0xcc92be,_0x8688('0xd'),JSON[_0x8688('0x10')](_0x18723c));if(_0x18723c[_0x8688('0x11')]){if(_0x18723c[_0x8688('0x11')][_0x8688('0x12')]===0x1f4){logger[_0x8688('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xcc92be,_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);return _0x15f2b9(_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);}logger[_0x8688('0x11')](_0x8688('0x14'),_0xcc92be,_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);return _0x457991(_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);}else{logger[_0x8688('0x15')](_0x8688('0x14'),_0xcc92be,'request\x20sent');_0x457991(_0x18723c[_0x8688('0x16')][_0x8688('0x13')]);}})[_0x8688('0x17')](function(_0x5ef2e6){logger[_0x8688('0x11')](_0x8688('0x14'),_0xcc92be,_0x5ef2e6);_0x15f2b9(_0x5ef2e6);});});}exports[_0x8688('0x18')]=function(_0x48eab9){var _0x48bcc9=this;return new Promise(function(_0x3c3021,_0x179355){return db['ZohoAccount']['findAll']({'raw':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')][_0x8688('0x1a')]===undefined?!![]:![]:!![],'where':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')][_0x8688('0x1b')]||null:null,'attributes':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')][_0x8688('0x1c')]||null:null,'limit':_0x48eab9['options']?_0x48eab9[_0x8688('0x19')]['limit']||null:null,'include':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')]['include']?_[_0x8688('0x1d')](_0x48eab9['options'][_0x8688('0x1e')],function(_0x3e92cd){return{'model':db[_0x3e92cd[_0x8688('0x1f')]],'as':_0x3e92cd['as'],'attributes':_0x3e92cd[_0x8688('0x1c')],'include':_0x3e92cd[_0x8688('0x1e')]?_[_0x8688('0x1d')](_0x3e92cd[_0x8688('0x1e')],function(_0x1e6aca){return{'model':db[_0x1e6aca['model']],'as':_0x1e6aca['as'],'attributes':_0x1e6aca[_0x8688('0x1c')],'include':_0x1e6aca[_0x8688('0x1e')]?_[_0x8688('0x1d')](_0x1e6aca[_0x8688('0x1e')],function(_0x4d4b9c){return{'model':db[_0x4d4b9c[_0x8688('0x1f')]],'as':_0x4d4b9c['as'],'attributes':_0x4d4b9c[_0x8688('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8688('0xc')](function(_0x481feb){logger[_0x8688('0x15')](_0x8688('0x18'),_0x48eab9);logger[_0x8688('0xe')]('GetZohoAccount',_0x48eab9,JSON[_0x8688('0x10')](_0x481feb));_0x3c3021(_0x481feb);})['catch'](function(_0x4ab1fb){logger['error'](_0x8688('0x18'),_0x4ab1fb[_0x8688('0x13')],_0x48eab9);_0x179355(_0x48bcc9[_0x8688('0x11')](0x1f4,_0x4ab1fb['message']));});});};exports[_0x8688('0x20')]=function(_0x24c55a){var _0xc3c53f=this;return new Promise(function(_0x2fabfa,_0x1af3d5){return db[_0x8688('0x21')][_0x8688('0x22')]({'raw':_0x24c55a[_0x8688('0x19')]?_0x24c55a[_0x8688('0x19')][_0x8688('0x1a')]===undefined?!![]:![]:!![],'where':_0x24c55a[_0x8688('0x19')]?_0x24c55a['options'][_0x8688('0x1b')]||null:null,'attributes':_0x24c55a['options']?_0x24c55a[_0x8688('0x19')][_0x8688('0x1c')]||null:null,'include':_0x24c55a['options']?_0x24c55a[_0x8688('0x19')][_0x8688('0x1e')]?_['map'](_0x24c55a['options'][_0x8688('0x1e')],function(_0x15ceb6){return{'model':db[_0x15ceb6[_0x8688('0x1f')]],'as':_0x15ceb6['as'],'attributes':_0x15ceb6['attributes'],'include':_0x15ceb6['include']?_[_0x8688('0x1d')](_0x15ceb6[_0x8688('0x1e')],function(_0x2c20ab){return{'model':db[_0x2c20ab['model']],'as':_0x2c20ab['as'],'attributes':_0x2c20ab['attributes'],'include':_0x2c20ab[_0x8688('0x1e')]?_[_0x8688('0x1d')](_0x2c20ab[_0x8688('0x1e')],function(_0x397262){return{'model':db[_0x397262[_0x8688('0x1f')]],'as':_0x397262['as'],'attributes':_0x397262[_0x8688('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8688('0xc')](function(_0x47a3b3){logger[_0x8688('0x15')](_0x8688('0x20'),_0x24c55a);logger['debug'](_0x8688('0x20'),_0x24c55a,JSON[_0x8688('0x10')](_0x47a3b3));_0x2fabfa(_0x47a3b3);})[_0x8688('0x17')](function(_0x3fe6c0){logger[_0x8688('0x11')](_0x8688('0x20'),_0x3fe6c0[_0x8688('0x13')],_0x24c55a);_0x1af3d5(_0xc3c53f[_0x8688('0x11')](0x1f4,_0x3fe6c0['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 08a3d8c..0b3878d 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 _0x007e=['/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x007e,0xdc));var _0xe007=function(_0x24e4d1,_0xffcfba){_0x24e4d1=_0x24e4d1-0x0;var _0x465d98=_0x007e[_0x24e4d1];return _0x465d98;};'use strict';var multer=require(_0xe007('0x0'));var util=require(_0xe007('0x1'));var path=require('path');var timeout=require(_0xe007('0x2'));var express=require(_0xe007('0x3'));var router=express[_0xe007('0x4')]();var fs_extra=require(_0xe007('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe007('0x6'));var config=require(_0xe007('0x7'));var controller=require(_0xe007('0x8'));router['get']('/',auth[_0xe007('0x9')](),controller['index']);router['get'](_0xe007('0xa'),auth[_0xe007('0x9')](),controller[_0xe007('0xb')]);router[_0xe007('0xc')](_0xe007('0xd'),auth[_0xe007('0x9')](),controller[_0xe007('0xe')]);router[_0xe007('0xc')](_0xe007('0xf'),auth[_0xe007('0x9')](),controller[_0xe007('0x10')]);router[_0xe007('0xc')]('/:id/descriptions',auth[_0xe007('0x9')](),controller[_0xe007('0x11')]);router[_0xe007('0x12')]('/',auth[_0xe007('0x9')](),controller[_0xe007('0x13')]);router[_0xe007('0x14')](_0xe007('0xa'),auth[_0xe007('0x9')](),controller['update']);router[_0xe007('0x15')]('/:id',auth[_0xe007('0x9')](),controller[_0xe007('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf7c3=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete'];(function(_0x332a7f,_0x3e88f5){var _0x57d651=function(_0x29cdfa){while(--_0x29cdfa){_0x332a7f['push'](_0x332a7f['shift']());}};_0x57d651(++_0x3e88f5);}(_0xf7c3,0x161));var _0x3f7c=function(_0x19d87d,_0x45800d){_0x19d87d=_0x19d87d-0x0;var _0x422c8e=_0xf7c3[_0x19d87d];return _0x422c8e;};'use strict';var multer=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var path=require('path');var timeout=require(_0x3f7c('0x2'));var express=require(_0x3f7c('0x3'));var router=express[_0x3f7c('0x4')]();var fs_extra=require(_0x3f7c('0x5'));var auth=require(_0x3f7c('0x6'));var interaction=require(_0x3f7c('0x7'));var config=require(_0x3f7c('0x8'));var controller=require(_0x3f7c('0x9'));router[_0x3f7c('0xa')]('/',auth[_0x3f7c('0xb')](),controller[_0x3f7c('0xc')]);router[_0x3f7c('0xa')](_0x3f7c('0xd'),auth['isAuthenticated'](),controller[_0x3f7c('0xe')]);router[_0x3f7c('0xa')](_0x3f7c('0xf'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x10')]);router['get'](_0x3f7c('0x11'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x12')]);router[_0x3f7c('0xa')](_0x3f7c('0x13'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x14')]);router[_0x3f7c('0x15')]('/',auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x16')]);router['put'](_0x3f7c('0xd'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x17')]);router[_0x3f7c('0x18')](_0x3f7c('0xd'),auth['isAuthenticated'](),controller[_0x3f7c('0x19')]);module[_0x3f7c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4bb1aa4..9d6019e 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 _0xf596=['contact','nothing','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x297d6f,_0x12c8be){var _0x4e0852=function(_0x37780e){while(--_0x37780e){_0x297d6f['push'](_0x297d6f['shift']());}};_0x4e0852(++_0x12c8be);}(_0xf596,0xd3));var _0x6f59=function(_0x85a9b0,_0x53b8c5){_0x85a9b0=_0x85a9b0-0x0;var _0x3d313f=_0xf596[_0x85a9b0];return _0x3d313f;};'use strict';var Sequelize=require(_0x6f59('0x0'));module[_0x6f59('0x1')]={'name':{'type':Sequelize[_0x6f59('0x2')]},'moduleCreate':{'type':Sequelize[_0x6f59('0x3')](_0x6f59('0x4'),_0x6f59('0x5'),_0x6f59('0x6')),'defaultValue':_0x6f59('0x4')},'moduleSearch':{'type':Sequelize[_0x6f59('0x3')](_0x6f59('0x7'),_0x6f59('0x5'),_0x6f59('0x4')),'defaultValue':_0x6f59('0x7')},'description':{'type':Sequelize[_0x6f59('0x2')]}}; \ No newline at end of file +var _0x29fb=['nothing','contact_lead','sequelize','STRING','ENUM','lead','contact'];(function(_0x189496,_0x41b01c){var _0xf3d805=function(_0x2cc829){while(--_0x2cc829){_0x189496['push'](_0x189496['shift']());}};_0xf3d805(++_0x41b01c);}(_0x29fb,0x13d));var _0xb29f=function(_0x4464e0,_0x23186c){_0x4464e0=_0x4464e0-0x0;var _0x496a70=_0x29fb[_0x4464e0];return _0x496a70;};'use strict';var Sequelize=require(_0xb29f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb29f('0x1')]},'moduleCreate':{'type':Sequelize[_0xb29f('0x2')](_0xb29f('0x3'),_0xb29f('0x4'),_0xb29f('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xb29f('0x2')]('contact_lead',_0xb29f('0x4'),_0xb29f('0x3')),'defaultValue':_0xb29f('0x6')},'description':{'type':Sequelize[_0xb29f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index cc0ccca..ebc6314 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 _0xfd16=['offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','index','map','query','keys','attributes','intersection','fields','length','model','order','sort','where','filters','filter','merge','options','ZohoConfiguration','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','pick','hasOwnProperty','nolimit','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end'];(function(_0x3291e7,_0xf037f){var _0x5152c3=function(_0x12058c){while(--_0x12058c){_0x3291e7['push'](_0x3291e7['shift']());}};_0x5152c3(++_0xf037f);}(_0xfd16,0x156));var _0x6fd1=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xfd16[_0x2555d0];return _0x3bb486;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fd1('0x0'));var zipdir=require(_0x6fd1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fd1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6fd1('0x3'));var util=require('util');var path=require(_0x6fd1('0x4'));var sox=require(_0x6fd1('0x5'));var csv=require(_0x6fd1('0x6'));var ejs=require(_0x6fd1('0x7'));var fs=require('fs');var fs_extra=require(_0x6fd1('0x8'));var _=require(_0x6fd1('0x9'));var squel=require('squel');var crypto=require(_0x6fd1('0xa'));var jsforce=require(_0x6fd1('0xb'));var deskjs=require(_0x6fd1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6fd1('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6fd1('0xe'));var as=require(_0x6fd1('0xf'));var hardwareService=require(_0x6fd1('0x10'));var logger=require(_0x6fd1('0x11'))(_0x6fd1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6fd1('0x13'));var db=require(_0x6fd1('0x14'))['db'];function respondWithStatusCode(_0x2b8edc,_0xc11b4d){_0xc11b4d=_0xc11b4d||0xcc;return function(_0x2c4aa6){if(_0x2c4aa6){return _0x2b8edc['sendStatus'](_0xc11b4d);}return _0x2b8edc[_0x6fd1('0x15')](_0xc11b4d)[_0x6fd1('0x16')]();};}function respondWithResult(_0xd91200,_0x445b79){_0x445b79=_0x445b79||0xc8;return function(_0x3748c0){if(_0x3748c0){return _0xd91200[_0x6fd1('0x15')](_0x445b79)['json'](_0x3748c0);}};}function respondWithFilteredResult(_0x18d569,_0x319c3d){return function(_0x5b5ffd){if(_0x5b5ffd){var _0x5ba73a=typeof _0x319c3d[_0x6fd1('0x17')]===_0x6fd1('0x18')&&typeof _0x319c3d[_0x6fd1('0x19')]===_0x6fd1('0x18');var _0xbfbaa1=_0x5b5ffd[_0x6fd1('0x1a')];var _0xe1af8b=_0x5ba73a?0x0:_0x319c3d[_0x6fd1('0x17')];var _0x218b80=_0x5ba73a?_0x5b5ffd[_0x6fd1('0x1a')]:_0x319c3d[_0x6fd1('0x17')]+_0x319c3d[_0x6fd1('0x19')];var _0x53fed2;if(_0x218b80>=_0xbfbaa1){_0x218b80=_0xbfbaa1;_0x53fed2=0xc8;}else{_0x53fed2=0xce;}_0x18d569[_0x6fd1('0x15')](_0x53fed2);return _0x18d569[_0x6fd1('0x1b')](_0x6fd1('0x1c'),_0xe1af8b+'-'+_0x218b80+'/'+_0xbfbaa1)['json'](_0x5b5ffd);}return null;};}function patchUpdates(_0x16d2a7){return function(_0x43de79){try{jsonpatch[_0x6fd1('0x1d')](_0x43de79,_0x16d2a7,!![]);}catch(_0x1fe420){return BPromise[_0x6fd1('0x1e')](_0x1fe420);}return _0x43de79['save']();};}function saveUpdates(_0x2f7517,_0x54d520){return function(_0x198181){if(_0x198181){return _0x198181['update'](_0x2f7517)['then'](function(_0x83aab4){return _0x83aab4;});}return null;};}function removeEntity(_0x421cc6,_0x136250){return function(_0x16fcfd){if(_0x16fcfd){return _0x16fcfd[_0x6fd1('0x1f')]()[_0x6fd1('0x20')](function(){_0x421cc6[_0x6fd1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c5a7,_0xfd900d){return function(_0x5e9b0c){if(!_0x5e9b0c){_0x26c5a7[_0x6fd1('0x21')](0x194);}return _0x5e9b0c;};}function handleError(_0x59bf26,_0x26d8b5){_0x26d8b5=_0x26d8b5||0x1f4;return function(_0x3e65ae){logger[_0x6fd1('0x22')](_0x3e65ae[_0x6fd1('0x23')]);if(_0x3e65ae[_0x6fd1('0x24')]){delete _0x3e65ae[_0x6fd1('0x24')];}_0x59bf26['status'](_0x26d8b5)['send'](_0x3e65ae);};}exports[_0x6fd1('0x25')]=function(_0x44eec1,_0x409f9){var _0x4a05d9={},_0x150ff9={},_0x2ce795={'count':0x0,'rows':[]};var _0x4c552b=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x301673){return{'name':_0x301673['fieldName'],'type':_0x301673['type']['key']};});_0x150ff9['model']=_[_0x6fd1('0x26')](_0x4c552b,'name');_0x150ff9[_0x6fd1('0x27')]=_[_0x6fd1('0x28')](_0x44eec1[_0x6fd1('0x27')]);_0x150ff9['filters']=_['intersection'](_0x150ff9['model'],_0x150ff9[_0x6fd1('0x27')]);_0x4a05d9[_0x6fd1('0x29')]=_[_0x6fd1('0x2a')](_0x150ff9['model'],qs[_0x6fd1('0x2b')](_0x44eec1['query'][_0x6fd1('0x2b')]));_0x4a05d9['attributes']=_0x4a05d9['attributes'][_0x6fd1('0x2c')]?_0x4a05d9[_0x6fd1('0x29')]:_0x150ff9[_0x6fd1('0x2d')];if(!_0x44eec1['query']['hasOwnProperty']('nolimit')){_0x4a05d9[_0x6fd1('0x19')]=qs['limit'](_0x44eec1[_0x6fd1('0x27')][_0x6fd1('0x19')]);_0x4a05d9[_0x6fd1('0x17')]=qs['offset'](_0x44eec1['query'][_0x6fd1('0x17')]);}_0x4a05d9[_0x6fd1('0x2e')]=qs[_0x6fd1('0x2f')](_0x44eec1[_0x6fd1('0x27')][_0x6fd1('0x2f')]);_0x4a05d9[_0x6fd1('0x30')]=qs[_0x6fd1('0x31')](_['pick'](_0x44eec1[_0x6fd1('0x27')],_0x150ff9[_0x6fd1('0x31')]),_0x4c552b);if(_0x44eec1[_0x6fd1('0x27')][_0x6fd1('0x32')]){_0x4a05d9[_0x6fd1('0x30')]=_['merge'](_0x4a05d9[_0x6fd1('0x30')],{'$or':_[_0x6fd1('0x26')](_0x4c552b,function(_0xd624e6){if(_0xd624e6['type']!=='VIRTUAL'){var _0xe903ea={};_0xe903ea[_0xd624e6[_0x6fd1('0x24')]]={'$like':'%'+_0x44eec1['query'][_0x6fd1('0x32')]+'%'};return _0xe903ea;}})});}_0x4a05d9=_[_0x6fd1('0x33')]({},_0x4a05d9,_0x44eec1[_0x6fd1('0x34')]);var _0x231bbb={'where':_0x4a05d9['where']};return db[_0x6fd1('0x35')][_0x6fd1('0x1a')](_0x231bbb)[_0x6fd1('0x20')](function(_0x108d7e){_0x2ce795['count']=_0x108d7e;if(_0x44eec1['query']['includeAll']){_0x4a05d9[_0x6fd1('0x36')]=[{'all':!![]}];}return db[_0x6fd1('0x35')][_0x6fd1('0x37')](_0x4a05d9);})[_0x6fd1('0x20')](function(_0x41951a){_0x2ce795[_0x6fd1('0x38')]=_0x41951a;return _0x2ce795;})['then'](respondWithFilteredResult(_0x409f9,_0x4a05d9))[_0x6fd1('0x39')](handleError(_0x409f9,null));};exports[_0x6fd1('0x3a')]=function(_0x440bd4,_0xd8c587){var _0xa0bd0c={'raw':![],'where':{'id':_0x440bd4[_0x6fd1('0x3b')]['id']}},_0x1e7c5={};_0x1e7c5[_0x6fd1('0x2d')]=_['keys'](db[_0x6fd1('0x35')][_0x6fd1('0x3c')]);_0x1e7c5[_0x6fd1('0x27')]=_[_0x6fd1('0x28')](_0x440bd4[_0x6fd1('0x27')]);_0x1e7c5['filters']=_[_0x6fd1('0x2a')](_0x1e7c5[_0x6fd1('0x2d')],_0x1e7c5[_0x6fd1('0x27')]);_0xa0bd0c[_0x6fd1('0x29')]=_[_0x6fd1('0x2a')](_0x1e7c5[_0x6fd1('0x2d')],qs[_0x6fd1('0x2b')](_0x440bd4['query'][_0x6fd1('0x2b')]));_0xa0bd0c['attributes']=_0xa0bd0c['attributes'][_0x6fd1('0x2c')]?_0xa0bd0c['attributes']:_0x1e7c5[_0x6fd1('0x2d')];if(_0x440bd4[_0x6fd1('0x27')][_0x6fd1('0x3d')]){_0xa0bd0c[_0x6fd1('0x36')]=[{'all':!![]}];}_0xa0bd0c=_[_0x6fd1('0x33')]({},_0xa0bd0c,_0x440bd4[_0x6fd1('0x34')]);return db['ZohoConfiguration'][_0x6fd1('0x3e')](_0xa0bd0c)[_0x6fd1('0x20')](handleEntityNotFound(_0xd8c587,null))['then'](respondWithResult(_0xd8c587,null))[_0x6fd1('0x39')](handleError(_0xd8c587,null));};exports[_0x6fd1('0x3f')]=function(_0x26310d,_0x344de8){return db[_0x6fd1('0x35')][_0x6fd1('0x3f')](_0x26310d[_0x6fd1('0x40')],{})[_0x6fd1('0x20')](respondWithResult(_0x344de8,0xc9))[_0x6fd1('0x39')](handleError(_0x344de8,null));};exports['update']=function(_0x52dc56,_0x27b951){if(_0x52dc56[_0x6fd1('0x40')]['id']){delete _0x52dc56[_0x6fd1('0x40')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x52dc56[_0x6fd1('0x3b')]['id']}})[_0x6fd1('0x20')](handleEntityNotFound(_0x27b951,null))[_0x6fd1('0x20')](saveUpdates(_0x52dc56['body'],null))['then'](respondWithResult(_0x27b951,null))[_0x6fd1('0x39')](handleError(_0x27b951,null));};exports[_0x6fd1('0x1f')]=function(_0x5c5016,_0x335b77){return db[_0x6fd1('0x35')][_0x6fd1('0x3e')]({'where':{'id':_0x5c5016['params']['id']}})[_0x6fd1('0x20')](handleEntityNotFound(_0x335b77,null))['then'](removeEntity(_0x335b77,null))[_0x6fd1('0x39')](handleError(_0x335b77,null));};exports[_0x6fd1('0x41')]=function(_0xe6f1b8,_0x24e48c,_0x1a9817){var _0x8b4f9a={};var _0x274427={};var _0x1a3629;var _0x43aecc;return db[_0x6fd1('0x35')][_0x6fd1('0x42')]({'where':{'id':_0xe6f1b8[_0x6fd1('0x3b')]['id']}})['then'](handleEntityNotFound(_0x24e48c,null))[_0x6fd1('0x20')](function(_0x17a1f4){if(_0x17a1f4){_0x1a3629=_0x17a1f4;_0x274427['model']=_[_0x6fd1('0x28')](db['ZohoField'][_0x6fd1('0x3c')]);_0x274427[_0x6fd1('0x27')]=_[_0x6fd1('0x28')](_0xe6f1b8['query']);_0x274427[_0x6fd1('0x31')]=_[_0x6fd1('0x2a')](_0x274427[_0x6fd1('0x2d')],_0x274427['query']);_0x8b4f9a['attributes']=_[_0x6fd1('0x2a')](_0x274427[_0x6fd1('0x2d')],qs['fields'](_0xe6f1b8[_0x6fd1('0x27')]['fields']));_0x8b4f9a[_0x6fd1('0x29')]=_0x8b4f9a[_0x6fd1('0x29')][_0x6fd1('0x2c')]?_0x8b4f9a[_0x6fd1('0x29')]:_0x274427[_0x6fd1('0x2d')];_0x8b4f9a[_0x6fd1('0x2e')]=qs[_0x6fd1('0x2f')](_0xe6f1b8['query']['sort']);_0x8b4f9a[_0x6fd1('0x30')]=qs['filters'](_[_0x6fd1('0x43')](_0xe6f1b8['query'],_0x274427['filters']));if(_0xe6f1b8[_0x6fd1('0x27')]['filter']){_0x8b4f9a[_0x6fd1('0x30')]=_[_0x6fd1('0x33')](_0x8b4f9a[_0x6fd1('0x30')],{'$or':_[_0x6fd1('0x26')](_0x8b4f9a[_0x6fd1('0x29')],function(_0x444bdb){var _0x4cd078={};_0x4cd078[_0x444bdb]={'$like':'%'+_0xe6f1b8[_0x6fd1('0x27')][_0x6fd1('0x32')]+'%'};return _0x4cd078;})});}_0x8b4f9a=_[_0x6fd1('0x33')]({},_0x8b4f9a,_0xe6f1b8[_0x6fd1('0x34')]);return _0x1a3629['getFields'](_0x8b4f9a);}})['then'](function(_0x2b4b9d){if(_0x2b4b9d){_0x43aecc=_0x2b4b9d['length'];if(!_0xe6f1b8[_0x6fd1('0x27')][_0x6fd1('0x44')](_0x6fd1('0x45'))){_0x8b4f9a[_0x6fd1('0x19')]=qs[_0x6fd1('0x19')](_0xe6f1b8[_0x6fd1('0x27')][_0x6fd1('0x19')]);_0x8b4f9a['offset']=qs[_0x6fd1('0x17')](_0xe6f1b8[_0x6fd1('0x27')][_0x6fd1('0x17')]);}return _0x1a3629[_0x6fd1('0x41')](_0x8b4f9a);}})[_0x6fd1('0x20')](function(_0x4cb1ac){if(_0x4cb1ac){return _0x4cb1ac?{'count':_0x43aecc,'rows':_0x4cb1ac}:null;}})[_0x6fd1('0x20')](respondWithResult(_0x24e48c,null))['catch'](handleError(_0x24e48c,null));};exports[_0x6fd1('0x46')]=function(_0x622d91,_0x386406,_0x5025f8){var _0x1a5932={};var _0x5a4576={};var _0x5a8731;var _0x55cad9;return db[_0x6fd1('0x35')][_0x6fd1('0x42')]({'where':{'id':_0x622d91[_0x6fd1('0x3b')]['id']}})[_0x6fd1('0x20')](handleEntityNotFound(_0x386406,null))['then'](function(_0x57e2b6){if(_0x57e2b6){_0x5a8731=_0x57e2b6;_0x5a4576[_0x6fd1('0x2d')]=_[_0x6fd1('0x28')](db[_0x6fd1('0x47')][_0x6fd1('0x3c')]);_0x5a4576[_0x6fd1('0x27')]=_[_0x6fd1('0x28')](_0x622d91[_0x6fd1('0x27')]);_0x5a4576[_0x6fd1('0x31')]=_[_0x6fd1('0x2a')](_0x5a4576[_0x6fd1('0x2d')],_0x5a4576[_0x6fd1('0x27')]);_0x1a5932[_0x6fd1('0x29')]=_['intersection'](_0x5a4576['model'],qs[_0x6fd1('0x2b')](_0x622d91[_0x6fd1('0x27')][_0x6fd1('0x2b')]));_0x1a5932[_0x6fd1('0x29')]=_0x1a5932[_0x6fd1('0x29')][_0x6fd1('0x2c')]?_0x1a5932[_0x6fd1('0x29')]:_0x5a4576[_0x6fd1('0x2d')];_0x1a5932[_0x6fd1('0x2e')]=qs[_0x6fd1('0x2f')](_0x622d91[_0x6fd1('0x27')]['sort']);_0x1a5932[_0x6fd1('0x30')]=qs[_0x6fd1('0x31')](_[_0x6fd1('0x43')](_0x622d91[_0x6fd1('0x27')],_0x5a4576['filters']));if(_0x622d91[_0x6fd1('0x27')][_0x6fd1('0x32')]){_0x1a5932[_0x6fd1('0x30')]=_[_0x6fd1('0x33')](_0x1a5932[_0x6fd1('0x30')],{'$or':_[_0x6fd1('0x26')](_0x1a5932[_0x6fd1('0x29')],function(_0x64975a){var _0x1a8c05={};_0x1a8c05[_0x64975a]={'$like':'%'+_0x622d91[_0x6fd1('0x27')][_0x6fd1('0x32')]+'%'};return _0x1a8c05;})});}_0x1a5932=_[_0x6fd1('0x33')]({},_0x1a5932,_0x622d91['options']);return _0x5a8731[_0x6fd1('0x46')](_0x1a5932);}})[_0x6fd1('0x20')](function(_0x2f863a){if(_0x2f863a){_0x55cad9=_0x2f863a[_0x6fd1('0x2c')];if(!_0x622d91[_0x6fd1('0x27')][_0x6fd1('0x44')]('nolimit')){_0x1a5932['limit']=qs[_0x6fd1('0x19')](_0x622d91['query'][_0x6fd1('0x19')]);_0x1a5932[_0x6fd1('0x17')]=qs['offset'](_0x622d91[_0x6fd1('0x27')][_0x6fd1('0x17')]);}return _0x5a8731[_0x6fd1('0x46')](_0x1a5932);}})['then'](function(_0x46d02d){if(_0x46d02d){return _0x46d02d?{'count':_0x55cad9,'rows':_0x46d02d}:null;}})[_0x6fd1('0x20')](respondWithResult(_0x386406,null))[_0x6fd1('0x39')](handleError(_0x386406,null));};exports[_0x6fd1('0x48')]=function(_0x156f82,_0x36fed8,_0x47a540){var _0x5d9dd5={};var _0x347e51={};var _0x4e1034;var _0x2cbb5f;return db['ZohoConfiguration'][_0x6fd1('0x42')]({'where':{'id':_0x156f82[_0x6fd1('0x3b')]['id']}})[_0x6fd1('0x20')](handleEntityNotFound(_0x36fed8,null))[_0x6fd1('0x20')](function(_0x4e1b25){if(_0x4e1b25){_0x4e1034=_0x4e1b25;_0x347e51[_0x6fd1('0x2d')]=_[_0x6fd1('0x28')](db[_0x6fd1('0x47')][_0x6fd1('0x3c')]);_0x347e51[_0x6fd1('0x27')]=_['keys'](_0x156f82['query']);_0x347e51[_0x6fd1('0x31')]=_['intersection'](_0x347e51[_0x6fd1('0x2d')],_0x347e51[_0x6fd1('0x27')]);_0x5d9dd5[_0x6fd1('0x29')]=_[_0x6fd1('0x2a')](_0x347e51[_0x6fd1('0x2d')],qs[_0x6fd1('0x2b')](_0x156f82[_0x6fd1('0x27')][_0x6fd1('0x2b')]));_0x5d9dd5[_0x6fd1('0x29')]=_0x5d9dd5['attributes'][_0x6fd1('0x2c')]?_0x5d9dd5[_0x6fd1('0x29')]:_0x347e51[_0x6fd1('0x2d')];_0x5d9dd5[_0x6fd1('0x2e')]=qs[_0x6fd1('0x2f')](_0x156f82['query'][_0x6fd1('0x2f')]);_0x5d9dd5[_0x6fd1('0x30')]=qs[_0x6fd1('0x31')](_[_0x6fd1('0x43')](_0x156f82[_0x6fd1('0x27')],_0x347e51[_0x6fd1('0x31')]));if(_0x156f82[_0x6fd1('0x27')][_0x6fd1('0x32')]){_0x5d9dd5['where']=_['merge'](_0x5d9dd5[_0x6fd1('0x30')],{'$or':_[_0x6fd1('0x26')](_0x5d9dd5[_0x6fd1('0x29')],function(_0x43dfc0){var _0x4cdb38={};_0x4cdb38[_0x43dfc0]={'$like':'%'+_0x156f82[_0x6fd1('0x27')]['filter']+'%'};return _0x4cdb38;})});}_0x5d9dd5=_[_0x6fd1('0x33')]({},_0x5d9dd5,_0x156f82[_0x6fd1('0x34')]);return _0x4e1034[_0x6fd1('0x48')](_0x5d9dd5);}})[_0x6fd1('0x20')](function(_0x3e8ec2){if(_0x3e8ec2){_0x2cbb5f=_0x3e8ec2[_0x6fd1('0x2c')];if(!_0x156f82[_0x6fd1('0x27')][_0x6fd1('0x44')](_0x6fd1('0x45'))){_0x5d9dd5['limit']=qs[_0x6fd1('0x19')](_0x156f82[_0x6fd1('0x27')]['limit']);_0x5d9dd5[_0x6fd1('0x17')]=qs[_0x6fd1('0x17')](_0x156f82[_0x6fd1('0x27')][_0x6fd1('0x17')]);}return _0x4e1034['getDescriptions'](_0x5d9dd5);}})[_0x6fd1('0x20')](function(_0xdaf8f){if(_0xdaf8f){return _0xdaf8f?{'count':_0x2cbb5f,'rows':_0xdaf8f}:null;}})[_0x6fd1('0x20')](respondWithResult(_0x36fed8,null))[_0x6fd1('0x39')](handleError(_0x36fed8,null));}; \ No newline at end of file +var _0x77b3=['filter','VIRTUAL','options','include','findAll','rows','catch','show','params','merge','find','create','body','destroy','getFields','findOne','ZohoField','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where'];(function(_0x4f1a12,_0x401962){var _0x1fabac=function(_0x21c68f){while(--_0x21c68f){_0x4f1a12['push'](_0x4f1a12['shift']());}};_0x1fabac(++_0x401962);}(_0x77b3,0x1ef));var _0x377b=function(_0x1edc74,_0xd181ef){_0x1edc74=_0x1edc74-0x0;var _0x44548b=_0x77b3[_0x1edc74];return _0x44548b;};'use strict';var emlformat=require(_0x377b('0x0'));var rimraf=require(_0x377b('0x1'));var zipdir=require(_0x377b('0x2'));var jsonpatch=require(_0x377b('0x3'));var rp=require('request-promise');var moment=require(_0x377b('0x4'));var BPromise=require(_0x377b('0x5'));var Mustache=require(_0x377b('0x6'));var util=require('util');var path=require(_0x377b('0x7'));var sox=require(_0x377b('0x8'));var csv=require('to-csv');var ejs=require(_0x377b('0x9'));var fs=require('fs');var fs_extra=require(_0x377b('0xa'));var _=require(_0x377b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x377b('0xc'));var deskjs=require(_0x377b('0xd'));var toCsv=require(_0x377b('0xe'));var querystring=require(_0x377b('0xf'));var Papa=require(_0x377b('0x10'));var Redis=require(_0x377b('0x11'));var authService=require(_0x377b('0x12'));var qs=require(_0x377b('0x13'));var as=require(_0x377b('0x14'));var hardwareService=require(_0x377b('0x15'));var logger=require('../../config/logger')(_0x377b('0x16'));var utils=require(_0x377b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49e503,_0xd4ca11){_0xd4ca11=_0xd4ca11||0xcc;return function(_0xd3eb72){if(_0xd3eb72){return _0x49e503[_0x377b('0x18')](_0xd4ca11);}return _0x49e503[_0x377b('0x19')](_0xd4ca11)[_0x377b('0x1a')]();};}function respondWithResult(_0x415b78,_0x1c84a2){_0x1c84a2=_0x1c84a2||0xc8;return function(_0x264ed4){if(_0x264ed4){return _0x415b78[_0x377b('0x19')](_0x1c84a2)[_0x377b('0x1b')](_0x264ed4);}};}function respondWithFilteredResult(_0x4acb65,_0x5dd8e7){return function(_0x3bfaef){if(_0x3bfaef){var _0x445ba5=typeof _0x5dd8e7[_0x377b('0x1c')]===_0x377b('0x1d')&&typeof _0x5dd8e7[_0x377b('0x1e')]==='undefined';var _0x26f9a0=_0x3bfaef['count'];var _0x5cf310=_0x445ba5?0x0:_0x5dd8e7[_0x377b('0x1c')];var _0x418d08=_0x445ba5?_0x3bfaef[_0x377b('0x1f')]:_0x5dd8e7[_0x377b('0x1c')]+_0x5dd8e7[_0x377b('0x1e')];var _0x5af534;if(_0x418d08>=_0x26f9a0){_0x418d08=_0x26f9a0;_0x5af534=0xc8;}else{_0x5af534=0xce;}_0x4acb65[_0x377b('0x19')](_0x5af534);return _0x4acb65[_0x377b('0x20')](_0x377b('0x21'),_0x5cf310+'-'+_0x418d08+'/'+_0x26f9a0)[_0x377b('0x1b')](_0x3bfaef);}return null;};}function patchUpdates(_0x2da92d){return function(_0x175413){try{jsonpatch[_0x377b('0x22')](_0x175413,_0x2da92d,!![]);}catch(_0x450d22){return BPromise[_0x377b('0x23')](_0x450d22);}return _0x175413[_0x377b('0x24')]();};}function saveUpdates(_0x25cde6,_0x9e239b){return function(_0x1f2745){if(_0x1f2745){return _0x1f2745[_0x377b('0x25')](_0x25cde6)[_0x377b('0x26')](function(_0x5da948){return _0x5da948;});}return null;};}function removeEntity(_0x4d310c,_0x5c3671){return function(_0x2b0acd){if(_0x2b0acd){return _0x2b0acd['destroy']()[_0x377b('0x26')](function(){_0x4d310c['status'](0xcc)[_0x377b('0x1a')]();});}};}function handleEntityNotFound(_0x5d4215,_0x15836f){return function(_0x2e8873){if(!_0x2e8873){_0x5d4215[_0x377b('0x18')](0x194);}return _0x2e8873;};}function handleError(_0x44715f,_0xc9eb9c){_0xc9eb9c=_0xc9eb9c||0x1f4;return function(_0x429f80){logger['error'](_0x429f80[_0x377b('0x27')]);if(_0x429f80[_0x377b('0x28')]){delete _0x429f80[_0x377b('0x28')];}_0x44715f[_0x377b('0x19')](_0xc9eb9c)['send'](_0x429f80);};}exports[_0x377b('0x29')]=function(_0x2f69fa,_0x5de4a5){var _0x55b5ce={},_0x2ba280={},_0x53e07d={'count':0x0,'rows':[]};var _0x474962=_[_0x377b('0x2a')](db[_0x377b('0x2b')][_0x377b('0x2c')],function(_0x419055){return{'name':_0x419055[_0x377b('0x2d')],'type':_0x419055['type'][_0x377b('0x2e')]};});_0x2ba280[_0x377b('0x2f')]=_[_0x377b('0x2a')](_0x474962,'name');_0x2ba280[_0x377b('0x30')]=_[_0x377b('0x31')](_0x2f69fa[_0x377b('0x30')]);_0x2ba280[_0x377b('0x32')]=_[_0x377b('0x33')](_0x2ba280['model'],_0x2ba280[_0x377b('0x30')]);_0x55b5ce['attributes']=_['intersection'](_0x2ba280[_0x377b('0x2f')],qs[_0x377b('0x34')](_0x2f69fa[_0x377b('0x30')][_0x377b('0x34')]));_0x55b5ce[_0x377b('0x35')]=_0x55b5ce[_0x377b('0x35')][_0x377b('0x36')]?_0x55b5ce[_0x377b('0x35')]:_0x2ba280['model'];if(!_0x2f69fa[_0x377b('0x30')]['hasOwnProperty'](_0x377b('0x37'))){_0x55b5ce[_0x377b('0x1e')]=qs[_0x377b('0x1e')](_0x2f69fa[_0x377b('0x30')][_0x377b('0x1e')]);_0x55b5ce[_0x377b('0x1c')]=qs['offset'](_0x2f69fa[_0x377b('0x30')][_0x377b('0x1c')]);}_0x55b5ce[_0x377b('0x38')]=qs['sort'](_0x2f69fa['query']['sort']);_0x55b5ce[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x2f69fa['query'],_0x2ba280[_0x377b('0x32')]),_0x474962);if(_0x2f69fa[_0x377b('0x30')][_0x377b('0x3a')]){_0x55b5ce[_0x377b('0x39')]=_['merge'](_0x55b5ce[_0x377b('0x39')],{'$or':_[_0x377b('0x2a')](_0x474962,function(_0x4afb25){if(_0x4afb25['type']!==_0x377b('0x3b')){var _0x1e82c6={};_0x1e82c6[_0x4afb25['name']]={'$like':'%'+_0x2f69fa[_0x377b('0x30')]['filter']+'%'};return _0x1e82c6;}})});}_0x55b5ce=_['merge']({},_0x55b5ce,_0x2f69fa[_0x377b('0x3c')]);var _0x518de0={'where':_0x55b5ce['where']};return db[_0x377b('0x2b')][_0x377b('0x1f')](_0x518de0)[_0x377b('0x26')](function(_0x3b50aa){_0x53e07d[_0x377b('0x1f')]=_0x3b50aa;if(_0x2f69fa[_0x377b('0x30')]['includeAll']){_0x55b5ce[_0x377b('0x3d')]=[{'all':!![]}];}return db[_0x377b('0x2b')][_0x377b('0x3e')](_0x55b5ce);})['then'](function(_0x1e1b71){_0x53e07d[_0x377b('0x3f')]=_0x1e1b71;return _0x53e07d;})['then'](respondWithFilteredResult(_0x5de4a5,_0x55b5ce))[_0x377b('0x40')](handleError(_0x5de4a5,null));};exports[_0x377b('0x41')]=function(_0x4ced79,_0x147a5){var _0x29bc9e={'raw':![],'where':{'id':_0x4ced79[_0x377b('0x42')]['id']}},_0x116495={};_0x116495[_0x377b('0x2f')]=_[_0x377b('0x31')](db['ZohoConfiguration'][_0x377b('0x2c')]);_0x116495[_0x377b('0x30')]=_['keys'](_0x4ced79[_0x377b('0x30')]);_0x116495[_0x377b('0x32')]=_['intersection'](_0x116495['model'],_0x116495['query']);_0x29bc9e['attributes']=_[_0x377b('0x33')](_0x116495[_0x377b('0x2f')],qs[_0x377b('0x34')](_0x4ced79['query'][_0x377b('0x34')]));_0x29bc9e['attributes']=_0x29bc9e[_0x377b('0x35')]['length']?_0x29bc9e['attributes']:_0x116495[_0x377b('0x2f')];if(_0x4ced79[_0x377b('0x30')]['includeAll']){_0x29bc9e[_0x377b('0x3d')]=[{'all':!![]}];}_0x29bc9e=_[_0x377b('0x43')]({},_0x29bc9e,_0x4ced79[_0x377b('0x3c')]);return db[_0x377b('0x2b')][_0x377b('0x44')](_0x29bc9e)[_0x377b('0x26')](handleEntityNotFound(_0x147a5,null))[_0x377b('0x26')](respondWithResult(_0x147a5,null))['catch'](handleError(_0x147a5,null));};exports['create']=function(_0x31f790,_0x5c81ad){return db['ZohoConfiguration'][_0x377b('0x45')](_0x31f790[_0x377b('0x46')],{})['then'](respondWithResult(_0x5c81ad,0xc9))[_0x377b('0x40')](handleError(_0x5c81ad,null));};exports[_0x377b('0x25')]=function(_0x4e441c,_0x5024b8){if(_0x4e441c[_0x377b('0x46')]['id']){delete _0x4e441c[_0x377b('0x46')]['id'];}return db['ZohoConfiguration'][_0x377b('0x44')]({'where':{'id':_0x4e441c['params']['id']}})['then'](handleEntityNotFound(_0x5024b8,null))[_0x377b('0x26')](saveUpdates(_0x4e441c[_0x377b('0x46')],null))[_0x377b('0x26')](respondWithResult(_0x5024b8,null))['catch'](handleError(_0x5024b8,null));};exports[_0x377b('0x47')]=function(_0x58427b,_0x2ab92c){return db[_0x377b('0x2b')]['find']({'where':{'id':_0x58427b['params']['id']}})['then'](handleEntityNotFound(_0x2ab92c,null))[_0x377b('0x26')](removeEntity(_0x2ab92c,null))['catch'](handleError(_0x2ab92c,null));};exports[_0x377b('0x48')]=function(_0x3034db,_0x2a988b,_0x14826a){var _0x5d14a0={};var _0x44bfb8={};var _0x51fc1b;var _0xabed6a;return db['ZohoConfiguration'][_0x377b('0x49')]({'where':{'id':_0x3034db[_0x377b('0x42')]['id']}})[_0x377b('0x26')](handleEntityNotFound(_0x2a988b,null))[_0x377b('0x26')](function(_0x3aa44b){if(_0x3aa44b){_0x51fc1b=_0x3aa44b;_0x44bfb8[_0x377b('0x2f')]=_[_0x377b('0x31')](db[_0x377b('0x4a')][_0x377b('0x2c')]);_0x44bfb8[_0x377b('0x30')]=_[_0x377b('0x31')](_0x3034db[_0x377b('0x30')]);_0x44bfb8[_0x377b('0x32')]=_[_0x377b('0x33')](_0x44bfb8[_0x377b('0x2f')],_0x44bfb8[_0x377b('0x30')]);_0x5d14a0[_0x377b('0x35')]=_[_0x377b('0x33')](_0x44bfb8[_0x377b('0x2f')],qs['fields'](_0x3034db['query']['fields']));_0x5d14a0[_0x377b('0x35')]=_0x5d14a0[_0x377b('0x35')][_0x377b('0x36')]?_0x5d14a0[_0x377b('0x35')]:_0x44bfb8[_0x377b('0x2f')];_0x5d14a0[_0x377b('0x38')]=qs[_0x377b('0x4b')](_0x3034db[_0x377b('0x30')][_0x377b('0x4b')]);_0x5d14a0[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x3034db[_0x377b('0x30')],_0x44bfb8[_0x377b('0x32')]));if(_0x3034db[_0x377b('0x30')][_0x377b('0x3a')]){_0x5d14a0[_0x377b('0x39')]=_['merge'](_0x5d14a0[_0x377b('0x39')],{'$or':_['map'](_0x5d14a0['attributes'],function(_0x223d1c){var _0x46e89d={};_0x46e89d[_0x223d1c]={'$like':'%'+_0x3034db[_0x377b('0x30')][_0x377b('0x3a')]+'%'};return _0x46e89d;})});}_0x5d14a0=_[_0x377b('0x43')]({},_0x5d14a0,_0x3034db[_0x377b('0x3c')]);return _0x51fc1b[_0x377b('0x48')](_0x5d14a0);}})[_0x377b('0x26')](function(_0x1d4510){if(_0x1d4510){_0xabed6a=_0x1d4510[_0x377b('0x36')];if(!_0x3034db[_0x377b('0x30')][_0x377b('0x4c')](_0x377b('0x37'))){_0x5d14a0[_0x377b('0x1e')]=qs['limit'](_0x3034db['query']['limit']);_0x5d14a0[_0x377b('0x1c')]=qs['offset'](_0x3034db[_0x377b('0x30')][_0x377b('0x1c')]);}return _0x51fc1b[_0x377b('0x48')](_0x5d14a0);}})[_0x377b('0x26')](function(_0x223bb6){if(_0x223bb6){return _0x223bb6?{'count':_0xabed6a,'rows':_0x223bb6}:null;}})['then'](respondWithResult(_0x2a988b,null))[_0x377b('0x40')](handleError(_0x2a988b,null));};exports[_0x377b('0x4d')]=function(_0x47ab26,_0x2f5b0e,_0x1992e9){var _0xffbf33={};var _0x562228={};var _0x1b53fc;var _0x3fe50d;return db['ZohoConfiguration'][_0x377b('0x49')]({'where':{'id':_0x47ab26['params']['id']}})[_0x377b('0x26')](handleEntityNotFound(_0x2f5b0e,null))['then'](function(_0x124a3f){if(_0x124a3f){_0x1b53fc=_0x124a3f;_0x562228[_0x377b('0x2f')]=_[_0x377b('0x31')](db[_0x377b('0x4a')]['rawAttributes']);_0x562228[_0x377b('0x30')]=_[_0x377b('0x31')](_0x47ab26[_0x377b('0x30')]);_0x562228['filters']=_['intersection'](_0x562228[_0x377b('0x2f')],_0x562228[_0x377b('0x30')]);_0xffbf33[_0x377b('0x35')]=_[_0x377b('0x33')](_0x562228[_0x377b('0x2f')],qs['fields'](_0x47ab26[_0x377b('0x30')][_0x377b('0x34')]));_0xffbf33['attributes']=_0xffbf33[_0x377b('0x35')]['length']?_0xffbf33[_0x377b('0x35')]:_0x562228[_0x377b('0x2f')];_0xffbf33[_0x377b('0x38')]=qs['sort'](_0x47ab26['query']['sort']);_0xffbf33[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x47ab26['query'],_0x562228[_0x377b('0x32')]));if(_0x47ab26[_0x377b('0x30')][_0x377b('0x3a')]){_0xffbf33[_0x377b('0x39')]=_['merge'](_0xffbf33[_0x377b('0x39')],{'$or':_[_0x377b('0x2a')](_0xffbf33['attributes'],function(_0x583867){var _0x29c144={};_0x29c144[_0x583867]={'$like':'%'+_0x47ab26[_0x377b('0x30')][_0x377b('0x3a')]+'%'};return _0x29c144;})});}_0xffbf33=_[_0x377b('0x43')]({},_0xffbf33,_0x47ab26[_0x377b('0x3c')]);return _0x1b53fc[_0x377b('0x4d')](_0xffbf33);}})[_0x377b('0x26')](function(_0x4bf08a){if(_0x4bf08a){_0x3fe50d=_0x4bf08a['length'];if(!_0x47ab26['query'][_0x377b('0x4c')](_0x377b('0x37'))){_0xffbf33[_0x377b('0x1e')]=qs['limit'](_0x47ab26[_0x377b('0x30')][_0x377b('0x1e')]);_0xffbf33[_0x377b('0x1c')]=qs[_0x377b('0x1c')](_0x47ab26[_0x377b('0x30')][_0x377b('0x1c')]);}return _0x1b53fc[_0x377b('0x4d')](_0xffbf33);}})[_0x377b('0x26')](function(_0x560fce){if(_0x560fce){return _0x560fce?{'count':_0x3fe50d,'rows':_0x560fce}:null;}})[_0x377b('0x26')](respondWithResult(_0x2f5b0e,null))[_0x377b('0x40')](handleError(_0x2f5b0e,null));};exports[_0x377b('0x4e')]=function(_0x4818d9,_0x59f0fd,_0x3fb654){var _0x3ff07c={};var _0x22bfd6={};var _0x2ed986;var _0xcd0548;return db[_0x377b('0x2b')][_0x377b('0x49')]({'where':{'id':_0x4818d9[_0x377b('0x42')]['id']}})[_0x377b('0x26')](handleEntityNotFound(_0x59f0fd,null))[_0x377b('0x26')](function(_0x25fb8f){if(_0x25fb8f){_0x2ed986=_0x25fb8f;_0x22bfd6[_0x377b('0x2f')]=_[_0x377b('0x31')](db[_0x377b('0x4a')][_0x377b('0x2c')]);_0x22bfd6[_0x377b('0x30')]=_['keys'](_0x4818d9[_0x377b('0x30')]);_0x22bfd6[_0x377b('0x32')]=_[_0x377b('0x33')](_0x22bfd6[_0x377b('0x2f')],_0x22bfd6[_0x377b('0x30')]);_0x3ff07c[_0x377b('0x35')]=_[_0x377b('0x33')](_0x22bfd6[_0x377b('0x2f')],qs[_0x377b('0x34')](_0x4818d9[_0x377b('0x30')][_0x377b('0x34')]));_0x3ff07c[_0x377b('0x35')]=_0x3ff07c[_0x377b('0x35')][_0x377b('0x36')]?_0x3ff07c[_0x377b('0x35')]:_0x22bfd6[_0x377b('0x2f')];_0x3ff07c['order']=qs[_0x377b('0x4b')](_0x4818d9['query'][_0x377b('0x4b')]);_0x3ff07c[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x4818d9['query'],_0x22bfd6['filters']));if(_0x4818d9['query']['filter']){_0x3ff07c[_0x377b('0x39')]=_[_0x377b('0x43')](_0x3ff07c['where'],{'$or':_[_0x377b('0x2a')](_0x3ff07c[_0x377b('0x35')],function(_0x519f8d){var _0x54a91b={};_0x54a91b[_0x519f8d]={'$like':'%'+_0x4818d9[_0x377b('0x30')][_0x377b('0x3a')]+'%'};return _0x54a91b;})});}_0x3ff07c=_[_0x377b('0x43')]({},_0x3ff07c,_0x4818d9[_0x377b('0x3c')]);return _0x2ed986[_0x377b('0x4e')](_0x3ff07c);}})[_0x377b('0x26')](function(_0x62c9b1){if(_0x62c9b1){_0xcd0548=_0x62c9b1[_0x377b('0x36')];if(!_0x4818d9[_0x377b('0x30')][_0x377b('0x4c')](_0x377b('0x37'))){_0x3ff07c[_0x377b('0x1e')]=qs['limit'](_0x4818d9['query']['limit']);_0x3ff07c[_0x377b('0x1c')]=qs[_0x377b('0x1c')](_0x4818d9[_0x377b('0x30')][_0x377b('0x1c')]);}return _0x2ed986[_0x377b('0x4e')](_0x3ff07c);}})[_0x377b('0x26')](function(_0x4146ed){if(_0x4146ed){return _0x4146ed?{'count':_0xcd0548,'rows':_0x4146ed}:null;}})[_0x377b('0x26')](respondWithResult(_0x59f0fd,null))[_0x377b('0x40')](handleError(_0x59f0fd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 58bd264..adee2bc 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 _0x67af=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x67af,0x131));var _0xf67a=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x67af[_0x23ec06];return _0x2831d4;};'use strict';var _=require(_0xf67a('0x0'));var util=require(_0xf67a('0x1'));var logger=require(_0xf67a('0x2'))(_0xf67a('0x3'));var moment=require(_0xf67a('0x4'));var BPromise=require(_0xf67a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf67a('0x6'));var config=require(_0xf67a('0x7'));var attributes=require(_0xf67a('0x8'));module[_0xf67a('0x9')]=function(_0xdc7d65,_0x7831bc){return _0xdc7d65[_0xf67a('0xa')](_0xf67a('0xb'),attributes,{'tableName':_0xf67a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b24=['moment','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x3199d7,_0x3ea674){var _0x3313bf=function(_0x49c4cb){while(--_0x49c4cb){_0x3199d7['push'](_0x3199d7['shift']());}};_0x3313bf(++_0x3ea674);}(_0x6b24,0x15b));var _0x46b2=function(_0x5b0f89,_0x303a8b){_0x5b0f89=_0x5b0f89-0x0;var _0x21ae25=_0x6b24[_0x5b0f89];return _0x21ae25;};'use strict';var _=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var logger=require(_0x46b2('0x2'))(_0x46b2('0x3'));var moment=require(_0x46b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x46b2('0x5'));var fs=require('fs');var path=require(_0x46b2('0x6'));var rimraf=require(_0x46b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x46b2('0x8'));module[_0x46b2('0x9')]=function(_0x44a356,_0x4e0afb){return _0x44a356[_0x46b2('0xa')](_0x46b2('0xb'),attributes,{'tableName':_0x46b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 02b1bec..82b5de5 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 _0xb01f=['error','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0xb01f,0x104));var _0xfb01=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xb01f[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require(_0xfb01('0x0'));var util=require(_0xfb01('0x1'));var moment=require('moment');var BPromise=require(_0xfb01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb01('0x3'))['db'];var utils=require(_0xfb01('0x4'));var logger=require('../../config/logger')(_0xfb01('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x397842,_0x4ce021){return new BPromise(function(_0x209745,_0x22df89){return client[_0xfb01('0x6')](_0x3b0829,_0x4ce021)['then'](function(_0x7efa22){logger[_0xfb01('0x7')]('ZohoConfiguration,\x20%s,\x20%s',_0x397842,_0xfb01('0x8'));logger[_0xfb01('0x9')](_0xfb01('0xa'),_0x397842,_0xfb01('0x8'),JSON[_0xfb01('0xb')](_0x7efa22));if(_0x7efa22[_0xfb01('0xc')]){if(_0x7efa22[_0xfb01('0xc')]['code']===0x1f4){logger[_0xfb01('0xc')](_0xfb01('0xd'),_0x397842,_0x7efa22['error'][_0xfb01('0xe')]);return _0x22df89(_0x7efa22[_0xfb01('0xc')]['message']);}logger[_0xfb01('0xc')](_0xfb01('0xd'),_0x397842,_0x7efa22[_0xfb01('0xc')][_0xfb01('0xe')]);return _0x209745(_0x7efa22['error'][_0xfb01('0xe')]);}else{logger[_0xfb01('0x7')](_0xfb01('0xd'),_0x397842,_0xfb01('0x8'));_0x209745(_0x7efa22[_0xfb01('0xf')][_0xfb01('0xe')]);}})['catch'](function(_0x1d124d){logger[_0xfb01('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x397842,_0x1d124d);_0x22df89(_0x1d124d);});});} \ No newline at end of file +var _0x8f88=['http','request','then','info','request\x20sent','debug','stringify','code','ZohoConfiguration,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x8f88,0xb5));var _0x88f8=function(_0x2e140d,_0x333831){_0x2e140d=_0x2e140d-0x0;var _0x48cfe2=_0x8f88[_0x2e140d];return _0x48cfe2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x88f8('0x0'));var BPromise=require(_0x88f8('0x1'));var rs=require(_0x88f8('0x2'));var fs=require('fs');var Redis=require(_0x88f8('0x3'));var db=require(_0x88f8('0x4'))['db'];var utils=require(_0x88f8('0x5'));var logger=require(_0x88f8('0x6'))(_0x88f8('0x7'));var config=require(_0x88f8('0x8'));var jayson=require(_0x88f8('0x9'));var client=jayson[_0x88f8('0xa')][_0x88f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4887f3,_0x42cf18,_0xe01b19){return new BPromise(function(_0x375141,_0x1126b3){return client[_0x88f8('0xc')](_0x4887f3,_0xe01b19)[_0x88f8('0xd')](function(_0x4b98f8){logger[_0x88f8('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x42cf18,_0x88f8('0xf'));logger[_0x88f8('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x42cf18,'request\x20sent',JSON[_0x88f8('0x11')](_0x4b98f8));if(_0x4b98f8['error']){if(_0x4b98f8['error'][_0x88f8('0x12')]===0x1f4){logger['error'](_0x88f8('0x13'),_0x42cf18,_0x4b98f8[_0x88f8('0x14')][_0x88f8('0x15')]);return _0x1126b3(_0x4b98f8[_0x88f8('0x14')]['message']);}logger[_0x88f8('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x42cf18,_0x4b98f8[_0x88f8('0x14')][_0x88f8('0x15')]);return _0x375141(_0x4b98f8[_0x88f8('0x14')][_0x88f8('0x15')]);}else{logger[_0x88f8('0xe')](_0x88f8('0x13'),_0x42cf18,_0x88f8('0xf'));_0x375141(_0x4b98f8[_0x88f8('0x16')][_0x88f8('0x15')]);}})[_0x88f8('0x17')](function(_0x3aff51){logger[_0x88f8('0x14')](_0x88f8('0x13'),_0x42cf18,_0x3aff51);_0x1126b3(_0x3aff51);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5e4b5c8..89602f2 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 _0xdef5=['../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x163edd,_0x254f73){var _0x1de602=function(_0x36b290){while(--_0x36b290){_0x163edd['push'](_0x163edd['shift']());}};_0x1de602(++_0x254f73);}(_0xdef5,0x1b1));var _0x5def=function(_0x6490c4,_0x2b2190){_0x6490c4=_0x6490c4-0x0;var _0x1cccdc=_0xdef5[_0x6490c4];return _0x1cccdc;};'use strict';var multer=require(_0x5def('0x0'));var util=require('util');var path=require(_0x5def('0x1'));var timeout=require(_0x5def('0x2'));var express=require(_0x5def('0x3'));var router=express[_0x5def('0x4')]();var fs_extra=require(_0x5def('0x5'));var auth=require(_0x5def('0x6'));var interaction=require(_0x5def('0x7'));var config=require(_0x5def('0x8'));var controller=require(_0x5def('0x9'));router['get']('/',auth[_0x5def('0xa')](),controller[_0x5def('0xb')]);router[_0x5def('0xc')](_0x5def('0xd'),auth[_0x5def('0xa')](),controller[_0x5def('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5def('0xf')]);router[_0x5def('0x10')](_0x5def('0xd'),auth[_0x5def('0xa')](),controller['update']);router[_0x5def('0x11')](_0x5def('0xd'),auth[_0x5def('0xa')](),controller[_0x5def('0x12')]);module[_0x5def('0x13')]=router; \ No newline at end of file +var _0x051c=['put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x1ddb03,_0xffb9c7){var _0x1e6726=function(_0x5c8da0){while(--_0x5c8da0){_0x1ddb03['push'](_0x1ddb03['shift']());}};_0x1e6726(++_0xffb9c7);}(_0x051c,0x16e));var _0xc051=function(_0x310953,_0x4871ae){_0x310953=_0x310953-0x0;var _0x4b1699=_0x051c[_0x310953];return _0x4b1699;};'use strict';var multer=require(_0xc051('0x0'));var util=require('util');var path=require(_0xc051('0x1'));var timeout=require('connect-timeout');var express=require(_0xc051('0x2'));var router=express['Router']();var fs_extra=require(_0xc051('0x3'));var auth=require(_0xc051('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc051('0x5'));var controller=require('./intZohoField.controller');router[_0xc051('0x6')]('/',auth[_0xc051('0x7')](),controller[_0xc051('0x8')]);router[_0xc051('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc051('0x9')]);router[_0xc051('0xa')]('/',auth[_0xc051('0x7')](),controller[_0xc051('0xb')]);router[_0xc051('0xc')](_0xc051('0xd'),auth[_0xc051('0x7')](),controller[_0xc051('0xe')]);router[_0xc051('0xf')](_0xc051('0xd'),auth['isAuthenticated'](),controller[_0xc051('0x10')]);module[_0xc051('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c3343be..56ee480 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 _0xa99d=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x1cca8d,_0x2a8803){var _0x1ce80c=function(_0x535de3){while(--_0x535de3){_0x1cca8d['push'](_0x1cca8d['shift']());}};_0x1ce80c(++_0x2a8803);}(_0xa99d,0xcb));var _0xda99=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0xa99d[_0x516927];return _0x30749b;};'use strict';var Sequelize=require(_0xda99('0x0'));module[_0xda99('0x1')]={'type':{'type':Sequelize[_0xda99('0x2')](_0xda99('0x3'),_0xda99('0x4'),_0xda99('0x5'),_0xda99('0x6'),_0xda99('0x7')),'defaultValue':_0xda99('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xda99('0x8')]},'keyType':{'type':Sequelize[_0xda99('0x2')](_0xda99('0x3'),_0xda99('0x4'),_0xda99('0x5'))},'keyContent':{'type':Sequelize[_0xda99('0x8')]},'idField':{'type':Sequelize[_0xda99('0x8')]},'nameField':{'type':Sequelize[_0xda99('0x8')]},'customField':{'type':Sequelize[_0xda99('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda99('0x8')]}}; \ No newline at end of file +var _0x76b2=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x57c6c4,_0x10bd9a){var _0x604afb=function(_0x1b1d1a){while(--_0x1b1d1a){_0x57c6c4['push'](_0x57c6c4['shift']());}};_0x604afb(++_0x10bd9a);}(_0x76b2,0x103));var _0x276b=function(_0x5e8c3f,_0x28f60d){_0x5e8c3f=_0x5e8c3f-0x0;var _0xa051c4=_0x76b2[_0x5e8c3f];return _0xa051c4;};'use strict';var Sequelize=require(_0x276b('0x0'));module[_0x276b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x276b('0x2'),_0x276b('0x3'),_0x276b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x276b('0x5')]},'key':{'type':Sequelize[_0x276b('0x5')]},'keyType':{'type':Sequelize[_0x276b('0x6')]('string',_0x276b('0x7'),_0x276b('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x276b('0x5')]},'nameField':{'type':Sequelize[_0x276b('0x5')]},'customField':{'type':Sequelize[_0x276b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x276b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ff0e231..7dcbe67 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 _0x6722=['sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','attributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','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','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6722,0x134));var _0x2672=function(_0x135121,_0x3f1f2e){_0x135121=_0x135121-0x0;var _0x84bfe6=_0x6722[_0x135121];return _0x84bfe6;};'use strict';var emlformat=require(_0x2672('0x0'));var rimraf=require(_0x2672('0x1'));var zipdir=require(_0x2672('0x2'));var jsonpatch=require(_0x2672('0x3'));var rp=require('request-promise');var moment=require(_0x2672('0x4'));var BPromise=require(_0x2672('0x5'));var Mustache=require(_0x2672('0x6'));var util=require(_0x2672('0x7'));var path=require(_0x2672('0x8'));var sox=require('sox');var csv=require(_0x2672('0x9'));var ejs=require(_0x2672('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2672('0xb'));var squel=require(_0x2672('0xc'));var crypto=require(_0x2672('0xd'));var jsforce=require(_0x2672('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2672('0xf'));var Papa=require(_0x2672('0x10'));var Redis=require('ioredis');var authService=require(_0x2672('0x11'));var qs=require(_0x2672('0x12'));var as=require(_0x2672('0x13'));var hardwareService=require(_0x2672('0x14'));var logger=require(_0x2672('0x15'))(_0x2672('0x16'));var utils=require(_0x2672('0x17'));var config=require(_0x2672('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x133afe,_0x3caddd){_0x3caddd=_0x3caddd||0xcc;return function(_0x5dc55a){if(_0x5dc55a){return _0x133afe[_0x2672('0x19')](_0x3caddd);}return _0x133afe[_0x2672('0x1a')](_0x3caddd)[_0x2672('0x1b')]();};}function respondWithResult(_0x3b9dfe,_0x353f52){_0x353f52=_0x353f52||0xc8;return function(_0x230bc0){if(_0x230bc0){return _0x3b9dfe[_0x2672('0x1a')](_0x353f52)[_0x2672('0x1c')](_0x230bc0);}};}function respondWithFilteredResult(_0x4ddfd4,_0x14a90f){return function(_0x18c98c){if(_0x18c98c){var _0x212ae7=typeof _0x14a90f[_0x2672('0x1d')]==='undefined'&&typeof _0x14a90f[_0x2672('0x1e')]===_0x2672('0x1f');var _0x1a3a1c=_0x18c98c['count'];var _0x56cc22=_0x212ae7?0x0:_0x14a90f[_0x2672('0x1d')];var _0x39f1f4=_0x212ae7?_0x18c98c[_0x2672('0x20')]:_0x14a90f[_0x2672('0x1d')]+_0x14a90f[_0x2672('0x1e')];var _0x19510e;if(_0x39f1f4>=_0x1a3a1c){_0x39f1f4=_0x1a3a1c;_0x19510e=0xc8;}else{_0x19510e=0xce;}_0x4ddfd4['status'](_0x19510e);return _0x4ddfd4[_0x2672('0x21')]('Content-Range',_0x56cc22+'-'+_0x39f1f4+'/'+_0x1a3a1c)[_0x2672('0x1c')](_0x18c98c);}return null;};}function patchUpdates(_0x498df6){return function(_0x2a31a1){try{jsonpatch[_0x2672('0x22')](_0x2a31a1,_0x498df6,!![]);}catch(_0x3935d){return BPromise['reject'](_0x3935d);}return _0x2a31a1['save']();};}function saveUpdates(_0x25f0e2,_0x3e127d){return function(_0x344569){if(_0x344569){return _0x344569[_0x2672('0x23')](_0x25f0e2)[_0x2672('0x24')](function(_0x3d57ed){return _0x3d57ed;});}return null;};}function removeEntity(_0xb06d25,_0xaa2a84){return function(_0x1b19ed){if(_0x1b19ed){return _0x1b19ed[_0x2672('0x25')]()[_0x2672('0x24')](function(){_0xb06d25[_0x2672('0x1a')](0xcc)[_0x2672('0x1b')]();});}};}function handleEntityNotFound(_0x141051,_0x2fd9b5){return function(_0x8d8fc2){if(!_0x8d8fc2){_0x141051['sendStatus'](0x194);}return _0x8d8fc2;};}function handleError(_0x1e8d5e,_0x2c33dc){_0x2c33dc=_0x2c33dc||0x1f4;return function(_0x17f08a){logger[_0x2672('0x26')](_0x17f08a[_0x2672('0x27')]);if(_0x17f08a[_0x2672('0x28')]){delete _0x17f08a['name'];}_0x1e8d5e['status'](_0x2c33dc)['send'](_0x17f08a);};}exports[_0x2672('0x29')]=function(_0x1d9124,_0x202ac1){var _0x43e110={},_0x56b4a9={},_0x173177={'count':0x0,'rows':[]};var _0x17d9d0=_[_0x2672('0x2a')](db[_0x2672('0x2b')][_0x2672('0x2c')],function(_0x21eff3){return{'name':_0x21eff3['fieldName'],'type':_0x21eff3[_0x2672('0x2d')][_0x2672('0x2e')]};});_0x56b4a9['model']=_[_0x2672('0x2a')](_0x17d9d0,_0x2672('0x28'));_0x56b4a9[_0x2672('0x2f')]=_[_0x2672('0x30')](_0x1d9124['query']);_0x56b4a9[_0x2672('0x31')]=_[_0x2672('0x32')](_0x56b4a9[_0x2672('0x33')],_0x56b4a9[_0x2672('0x2f')]);_0x43e110['attributes']=_[_0x2672('0x32')](_0x56b4a9[_0x2672('0x33')],qs[_0x2672('0x34')](_0x1d9124[_0x2672('0x2f')]['fields']));_0x43e110['attributes']=_0x43e110['attributes'][_0x2672('0x35')]?_0x43e110['attributes']:_0x56b4a9[_0x2672('0x33')];if(!_0x1d9124[_0x2672('0x2f')][_0x2672('0x36')](_0x2672('0x37'))){_0x43e110[_0x2672('0x1e')]=qs[_0x2672('0x1e')](_0x1d9124[_0x2672('0x2f')][_0x2672('0x1e')]);_0x43e110[_0x2672('0x1d')]=qs[_0x2672('0x1d')](_0x1d9124[_0x2672('0x2f')][_0x2672('0x1d')]);}_0x43e110[_0x2672('0x38')]=qs['sort'](_0x1d9124[_0x2672('0x2f')][_0x2672('0x39')]);_0x43e110['where']=qs[_0x2672('0x31')](_['pick'](_0x1d9124[_0x2672('0x2f')],_0x56b4a9[_0x2672('0x31')]),_0x17d9d0);if(_0x1d9124[_0x2672('0x2f')][_0x2672('0x3a')]){_0x43e110[_0x2672('0x3b')]=_[_0x2672('0x3c')](_0x43e110[_0x2672('0x3b')],{'$or':_[_0x2672('0x2a')](_0x17d9d0,function(_0x118a0a){if(_0x118a0a['type']!==_0x2672('0x3d')){var _0x443b3b={};_0x443b3b[_0x118a0a[_0x2672('0x28')]]={'$like':'%'+_0x1d9124[_0x2672('0x2f')][_0x2672('0x3a')]+'%'};return _0x443b3b;}})});}_0x43e110=_[_0x2672('0x3c')]({},_0x43e110,_0x1d9124[_0x2672('0x3e')]);var _0x66dd4c={'where':_0x43e110['where']};return db[_0x2672('0x2b')]['count'](_0x66dd4c)[_0x2672('0x24')](function(_0x74a913){_0x173177['count']=_0x74a913;if(_0x1d9124[_0x2672('0x2f')]['includeAll']){_0x43e110['include']=[{'all':!![]}];}return db[_0x2672('0x2b')][_0x2672('0x3f')](_0x43e110);})[_0x2672('0x24')](function(_0x148ec3){_0x173177[_0x2672('0x40')]=_0x148ec3;return _0x173177;})[_0x2672('0x24')](respondWithFilteredResult(_0x202ac1,_0x43e110))[_0x2672('0x41')](handleError(_0x202ac1,null));};exports[_0x2672('0x42')]=function(_0x15e5d7,_0x86324a){var _0x25bb01={'raw':!![],'where':{'id':_0x15e5d7[_0x2672('0x43')]['id']}},_0x32c312={};_0x32c312['model']=_[_0x2672('0x30')](db[_0x2672('0x2b')][_0x2672('0x2c')]);_0x32c312[_0x2672('0x2f')]=_[_0x2672('0x30')](_0x15e5d7[_0x2672('0x2f')]);_0x32c312['filters']=_['intersection'](_0x32c312[_0x2672('0x33')],_0x32c312['query']);_0x25bb01[_0x2672('0x44')]=_[_0x2672('0x32')](_0x32c312['model'],qs[_0x2672('0x34')](_0x15e5d7[_0x2672('0x2f')]['fields']));_0x25bb01[_0x2672('0x44')]=_0x25bb01['attributes'][_0x2672('0x35')]?_0x25bb01[_0x2672('0x44')]:_0x32c312[_0x2672('0x33')];if(_0x15e5d7[_0x2672('0x2f')][_0x2672('0x45')]){_0x25bb01['include']=[{'all':!![]}];}_0x25bb01=_[_0x2672('0x3c')]({},_0x25bb01,_0x15e5d7[_0x2672('0x3e')]);return db[_0x2672('0x2b')][_0x2672('0x46')](_0x25bb01)[_0x2672('0x24')](handleEntityNotFound(_0x86324a,null))[_0x2672('0x24')](respondWithResult(_0x86324a,null))['catch'](handleError(_0x86324a,null));};exports[_0x2672('0x47')]=function(_0x443208,_0x15969c){return db[_0x2672('0x2b')][_0x2672('0x47')](_0x443208[_0x2672('0x48')],{})['then'](respondWithResult(_0x15969c,0xc9))[_0x2672('0x41')](handleError(_0x15969c,null));};exports[_0x2672('0x23')]=function(_0x52055b,_0x13a9a3){if(_0x52055b['body']['id']){delete _0x52055b['body']['id'];}return db[_0x2672('0x2b')][_0x2672('0x46')]({'where':{'id':_0x52055b[_0x2672('0x43')]['id']}})[_0x2672('0x24')](handleEntityNotFound(_0x13a9a3,null))[_0x2672('0x24')](saveUpdates(_0x52055b[_0x2672('0x48')],null))[_0x2672('0x24')](respondWithResult(_0x13a9a3,null))['catch'](handleError(_0x13a9a3,null));};exports['destroy']=function(_0x5924f6,_0x2e17fc){return db[_0x2672('0x2b')]['find']({'where':{'id':_0x5924f6['params']['id']}})[_0x2672('0x24')](handleEntityNotFound(_0x2e17fc,null))[_0x2672('0x24')](removeEntity(_0x2e17fc,null))['catch'](handleError(_0x2e17fc,null));}; \ No newline at end of file +var _0x9f6d=['save','then','destroy','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','rows','catch','show','params','ZohoField','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f6d,0x140));var _0xd9f6=function(_0x21c62e,_0x225e32){_0x21c62e=_0x21c62e-0x0;var _0x2774f6=_0x9f6d[_0x21c62e];return _0x2774f6;};'use strict';var emlformat=require(_0xd9f6('0x0'));var rimraf=require(_0xd9f6('0x1'));var zipdir=require(_0xd9f6('0x2'));var jsonpatch=require(_0xd9f6('0x3'));var rp=require(_0xd9f6('0x4'));var moment=require(_0xd9f6('0x5'));var BPromise=require(_0xd9f6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd9f6('0x7'));var sox=require(_0xd9f6('0x8'));var csv=require(_0xd9f6('0x9'));var ejs=require(_0xd9f6('0xa'));var fs=require('fs');var fs_extra=require(_0xd9f6('0xb'));var _=require(_0xd9f6('0xc'));var squel=require('squel');var crypto=require(_0xd9f6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd9f6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd9f6('0xe'));var authService=require(_0xd9f6('0xf'));var qs=require(_0xd9f6('0x10'));var as=require(_0xd9f6('0x11'));var hardwareService=require(_0xd9f6('0x12'));var logger=require(_0xd9f6('0x13'))(_0xd9f6('0x14'));var utils=require(_0xd9f6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd9f6('0x16'));var db=require(_0xd9f6('0x17'))['db'];function respondWithStatusCode(_0x53aeed,_0x1abcb7){_0x1abcb7=_0x1abcb7||0xcc;return function(_0x40d13e){if(_0x40d13e){return _0x53aeed[_0xd9f6('0x18')](_0x1abcb7);}return _0x53aeed[_0xd9f6('0x19')](_0x1abcb7)[_0xd9f6('0x1a')]();};}function respondWithResult(_0x3cde5e,_0x37ee27){_0x37ee27=_0x37ee27||0xc8;return function(_0x252f82){if(_0x252f82){return _0x3cde5e[_0xd9f6('0x19')](_0x37ee27)[_0xd9f6('0x1b')](_0x252f82);}};}function respondWithFilteredResult(_0x30aeae,_0x3bb89a){return function(_0x3f1f87){if(_0x3f1f87){var _0x44bcd9=typeof _0x3bb89a[_0xd9f6('0x1c')]===_0xd9f6('0x1d')&&typeof _0x3bb89a[_0xd9f6('0x1e')]==='undefined';var _0x48bf2e=_0x3f1f87[_0xd9f6('0x1f')];var _0x1b7811=_0x44bcd9?0x0:_0x3bb89a[_0xd9f6('0x1c')];var _0x2fe111=_0x44bcd9?_0x3f1f87['count']:_0x3bb89a[_0xd9f6('0x1c')]+_0x3bb89a[_0xd9f6('0x1e')];var _0x44f80c;if(_0x2fe111>=_0x48bf2e){_0x2fe111=_0x48bf2e;_0x44f80c=0xc8;}else{_0x44f80c=0xce;}_0x30aeae['status'](_0x44f80c);return _0x30aeae['set'](_0xd9f6('0x20'),_0x1b7811+'-'+_0x2fe111+'/'+_0x48bf2e)[_0xd9f6('0x1b')](_0x3f1f87);}return null;};}function patchUpdates(_0x472b2a){return function(_0x4250df){try{jsonpatch[_0xd9f6('0x21')](_0x4250df,_0x472b2a,!![]);}catch(_0x509b9e){return BPromise[_0xd9f6('0x22')](_0x509b9e);}return _0x4250df[_0xd9f6('0x23')]();};}function saveUpdates(_0x635e35,_0x12b38b){return function(_0x5b1698){if(_0x5b1698){return _0x5b1698['update'](_0x635e35)[_0xd9f6('0x24')](function(_0x561528){return _0x561528;});}return null;};}function removeEntity(_0x444156,_0x9829e8){return function(_0x42f3c9){if(_0x42f3c9){return _0x42f3c9[_0xd9f6('0x25')]()[_0xd9f6('0x24')](function(){_0x444156[_0xd9f6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475adc,_0x36ed61){return function(_0x1350af){if(!_0x1350af){_0x475adc['sendStatus'](0x194);}return _0x1350af;};}function handleError(_0x27cd23,_0x421845){_0x421845=_0x421845||0x1f4;return function(_0x1492b4){logger['error'](_0x1492b4[_0xd9f6('0x26')]);if(_0x1492b4[_0xd9f6('0x27')]){delete _0x1492b4[_0xd9f6('0x27')];}_0x27cd23[_0xd9f6('0x19')](_0x421845)[_0xd9f6('0x28')](_0x1492b4);};}exports[_0xd9f6('0x29')]=function(_0x245275,_0x3ff00b){var _0x334dda={},_0x4b5f3d={},_0x5333aa={'count':0x0,'rows':[]};var _0x20bf32=_['map'](db['ZohoField']['rawAttributes'],function(_0x46149b){return{'name':_0x46149b['fieldName'],'type':_0x46149b['type'][_0xd9f6('0x2a')]};});_0x4b5f3d[_0xd9f6('0x2b')]=_[_0xd9f6('0x2c')](_0x20bf32,_0xd9f6('0x27'));_0x4b5f3d[_0xd9f6('0x2d')]=_[_0xd9f6('0x2e')](_0x245275[_0xd9f6('0x2d')]);_0x4b5f3d[_0xd9f6('0x2f')]=_[_0xd9f6('0x30')](_0x4b5f3d[_0xd9f6('0x2b')],_0x4b5f3d[_0xd9f6('0x2d')]);_0x334dda[_0xd9f6('0x31')]=_[_0xd9f6('0x30')](_0x4b5f3d[_0xd9f6('0x2b')],qs['fields'](_0x245275[_0xd9f6('0x2d')]['fields']));_0x334dda[_0xd9f6('0x31')]=_0x334dda[_0xd9f6('0x31')][_0xd9f6('0x32')]?_0x334dda[_0xd9f6('0x31')]:_0x4b5f3d['model'];if(!_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x33')](_0xd9f6('0x34'))){_0x334dda['limit']=qs[_0xd9f6('0x1e')](_0x245275['query']['limit']);_0x334dda[_0xd9f6('0x1c')]=qs[_0xd9f6('0x1c')](_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x1c')]);}_0x334dda['order']=qs[_0xd9f6('0x35')](_0x245275['query']['sort']);_0x334dda['where']=qs[_0xd9f6('0x2f')](_[_0xd9f6('0x36')](_0x245275[_0xd9f6('0x2d')],_0x4b5f3d[_0xd9f6('0x2f')]),_0x20bf32);if(_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x37')]){_0x334dda[_0xd9f6('0x38')]=_[_0xd9f6('0x39')](_0x334dda['where'],{'$or':_[_0xd9f6('0x2c')](_0x20bf32,function(_0x367556){if(_0x367556[_0xd9f6('0x3a')]!=='VIRTUAL'){var _0xe5da9a={};_0xe5da9a[_0x367556[_0xd9f6('0x27')]]={'$like':'%'+_0x245275[_0xd9f6('0x2d')]['filter']+'%'};return _0xe5da9a;}})});}_0x334dda=_[_0xd9f6('0x39')]({},_0x334dda,_0x245275[_0xd9f6('0x3b')]);var _0x3fa86f={'where':_0x334dda[_0xd9f6('0x38')]};return db['ZohoField'][_0xd9f6('0x1f')](_0x3fa86f)[_0xd9f6('0x24')](function(_0x290895){_0x5333aa[_0xd9f6('0x1f')]=_0x290895;if(_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x3c')]){_0x334dda[_0xd9f6('0x3d')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x334dda);})[_0xd9f6('0x24')](function(_0x268649){_0x5333aa[_0xd9f6('0x3e')]=_0x268649;return _0x5333aa;})['then'](respondWithFilteredResult(_0x3ff00b,_0x334dda))[_0xd9f6('0x3f')](handleError(_0x3ff00b,null));};exports[_0xd9f6('0x40')]=function(_0x3212ea,_0x4765db){var _0x46fda0={'raw':!![],'where':{'id':_0x3212ea[_0xd9f6('0x41')]['id']}},_0x263dc2={};_0x263dc2[_0xd9f6('0x2b')]=_['keys'](db['ZohoField']['rawAttributes']);_0x263dc2[_0xd9f6('0x2d')]=_['keys'](_0x3212ea[_0xd9f6('0x2d')]);_0x263dc2[_0xd9f6('0x2f')]=_['intersection'](_0x263dc2[_0xd9f6('0x2b')],_0x263dc2[_0xd9f6('0x2d')]);_0x46fda0[_0xd9f6('0x31')]=_[_0xd9f6('0x30')](_0x263dc2[_0xd9f6('0x2b')],qs['fields'](_0x3212ea[_0xd9f6('0x2d')]['fields']));_0x46fda0[_0xd9f6('0x31')]=_0x46fda0['attributes'][_0xd9f6('0x32')]?_0x46fda0[_0xd9f6('0x31')]:_0x263dc2[_0xd9f6('0x2b')];if(_0x3212ea[_0xd9f6('0x2d')][_0xd9f6('0x3c')]){_0x46fda0[_0xd9f6('0x3d')]=[{'all':!![]}];}_0x46fda0=_['merge']({},_0x46fda0,_0x3212ea[_0xd9f6('0x3b')]);return db[_0xd9f6('0x42')][_0xd9f6('0x43')](_0x46fda0)[_0xd9f6('0x24')](handleEntityNotFound(_0x4765db,null))[_0xd9f6('0x24')](respondWithResult(_0x4765db,null))[_0xd9f6('0x3f')](handleError(_0x4765db,null));};exports[_0xd9f6('0x44')]=function(_0x51ec5c,_0x2d4724){return db['ZohoField'][_0xd9f6('0x44')](_0x51ec5c['body'],{})['then'](respondWithResult(_0x2d4724,0xc9))[_0xd9f6('0x3f')](handleError(_0x2d4724,null));};exports[_0xd9f6('0x45')]=function(_0x40492a,_0x30f8d2){if(_0x40492a['body']['id']){delete _0x40492a[_0xd9f6('0x46')]['id'];}return db[_0xd9f6('0x42')][_0xd9f6('0x43')]({'where':{'id':_0x40492a[_0xd9f6('0x41')]['id']}})['then'](handleEntityNotFound(_0x30f8d2,null))[_0xd9f6('0x24')](saveUpdates(_0x40492a[_0xd9f6('0x46')],null))[_0xd9f6('0x24')](respondWithResult(_0x30f8d2,null))[_0xd9f6('0x3f')](handleError(_0x30f8d2,null));};exports['destroy']=function(_0x57f6db,_0x1c99fb){return db[_0xd9f6('0x42')][_0xd9f6('0x43')]({'where':{'id':_0x57f6db[_0xd9f6('0x41')]['id']}})[_0xd9f6('0x24')](handleEntityNotFound(_0x1c99fb,null))[_0xd9f6('0x24')](removeEntity(_0x1c99fb,null))[_0xd9f6('0x3f')](handleError(_0x1c99fb,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 488d04f..1063019 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 _0xb016=['rimraf','../../config/environment','exports','int_zoho_fields','zoho_unique_index','lodash','util','moment','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb016,0x159));var _0x6b01=function(_0x259feb,_0xc0e3d){_0x259feb=_0x259feb-0x0;var _0x11aaf2=_0xb016[_0x259feb];return _0x11aaf2;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./intZohoField.attributes');module[_0x6b01('0x7')]=function(_0x65407a,_0x192b2d){return _0x65407a['define']('ZohoField',attributes,{'tableName':_0x6b01('0x8'),'paranoid':![],'indexes':[{'name':_0x6b01('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api'];(function(_0x246513,_0x450ad0){var _0x686fe6=function(_0x286f81){while(--_0x286f81){_0x246513['push'](_0x246513['shift']());}};_0x686fe6(++_0x450ad0);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0xfcf0[_0x1044e5];return _0x5ad0dd;};'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'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xd'),_0x0fcf('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index e71df04..c1ca558 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 _0xe903=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x3233c3,_0x15e5fa){var _0x36029b=function(_0xe3dd12){while(--_0xe3dd12){_0x3233c3['push'](_0x3233c3['shift']());}};_0x36029b(++_0x15e5fa);}(_0xe903,0x18d));var _0x3e90=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xe903[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x3e90('0x0'));var util=require(_0x3e90('0x1'));var moment=require('moment');var BPromise=require(_0x3e90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e90('0x3'));var db=require(_0x3e90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e90('0x5'))(_0x3e90('0x6'));var config=require(_0x3e90('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e90('0x8')][_0x3e90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f4fbe,_0x336245,_0x163bc9){return new BPromise(function(_0x199ca8,_0x429294){return client['request'](_0x4f4fbe,_0x163bc9)[_0x3e90('0xa')](function(_0x1be263){logger['info'](_0x3e90('0xb'),_0x336245,_0x3e90('0xc'));logger['debug'](_0x3e90('0xd'),_0x336245,_0x3e90('0xc'),JSON[_0x3e90('0xe')](_0x1be263));if(_0x1be263[_0x3e90('0xf')]){if(_0x1be263['error'][_0x3e90('0x10')]===0x1f4){logger['error'](_0x3e90('0xb'),_0x336245,_0x1be263[_0x3e90('0xf')][_0x3e90('0x11')]);return _0x429294(_0x1be263['error'][_0x3e90('0x11')]);}logger[_0x3e90('0xf')]('ZohoField,\x20%s,\x20%s',_0x336245,_0x1be263[_0x3e90('0xf')][_0x3e90('0x11')]);return _0x199ca8(_0x1be263[_0x3e90('0xf')][_0x3e90('0x11')]);}else{logger[_0x3e90('0x12')](_0x3e90('0xb'),_0x336245,_0x3e90('0xc'));_0x199ca8(_0x1be263[_0x3e90('0x13')][_0x3e90('0x11')]);}})[_0x3e90('0x14')](function(_0x1eedf1){logger['error'](_0x3e90('0xb'),_0x336245,_0x1eedf1);_0x429294(_0x1eedf1);});});} \ No newline at end of file +var _0x5f51=['jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xec88f0,_0x3b9fe2){var _0x148be0=function(_0x4e1670){while(--_0x4e1670){_0xec88f0['push'](_0xec88f0['shift']());}};_0x148be0(++_0x3b9fe2);}(_0x5f51,0x157));var _0x15f5=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f51[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x15f5('0x0'));var util=require(_0x15f5('0x1'));var moment=require('moment');var BPromise=require(_0x15f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15f5('0x3'));var db=require(_0x15f5('0x4'))['db'];var utils=require(_0x15f5('0x5'));var logger=require(_0x15f5('0x6'))(_0x15f5('0x7'));var config=require(_0x15f5('0x8'));var jayson=require(_0x15f5('0x9'));var client=jayson[_0x15f5('0xa')][_0x15f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x560339,_0x22e8cf,_0x2f541b){return new BPromise(function(_0x2a14f0,_0x137b06){return client['request'](_0x560339,_0x2f541b)['then'](function(_0x42efae){logger[_0x15f5('0xc')](_0x15f5('0xd'),_0x22e8cf,_0x15f5('0xe'));logger[_0x15f5('0xf')](_0x15f5('0x10'),_0x22e8cf,'request\x20sent',JSON[_0x15f5('0x11')](_0x42efae));if(_0x42efae[_0x15f5('0x12')]){if(_0x42efae['error'][_0x15f5('0x13')]===0x1f4){logger[_0x15f5('0x12')](_0x15f5('0xd'),_0x22e8cf,_0x42efae[_0x15f5('0x12')][_0x15f5('0x14')]);return _0x137b06(_0x42efae[_0x15f5('0x12')][_0x15f5('0x14')]);}logger[_0x15f5('0x12')](_0x15f5('0xd'),_0x22e8cf,_0x42efae[_0x15f5('0x12')]['message']);return _0x2a14f0(_0x42efae['error'][_0x15f5('0x14')]);}else{logger[_0x15f5('0xc')](_0x15f5('0xd'),_0x22e8cf,_0x15f5('0xe'));_0x2a14f0(_0x42efae['result'][_0x15f5('0x14')]);}})[_0x15f5('0x15')](function(_0x586d35){logger[_0x15f5('0x12')](_0x15f5('0xd'),_0x22e8cf,_0x586d35);_0x137b06(_0x586d35);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5d2d3cc..8a6fe7a 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(_0x4ad6e4,_0x103161){var _0x11e62a=function(_0x10dc1e){while(--_0x10dc1e){_0x4ad6e4['push'](_0x4ad6e4['shift']());}};_0x11e62a(++_0x103161);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e3b9b,_0x4060e2){var _0x39079a=function(_0x599b13){while(--_0x599b13){_0x3e3b9b['push'](_0x3e3b9b['shift']());}};_0x39079a(++_0x4060e2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xcb91[_0x398294];return _0x2a872d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index fd74e29..f5c2a37 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 _0x3fb7=['INTEGER','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0xa55183,_0x13f619){var _0x3619ab=function(_0x3dd3cd){while(--_0x3dd3cd){_0xa55183['push'](_0xa55183['shift']());}};_0x3619ab(++_0x13f619);}(_0x3fb7,0x187));var _0x73fb=function(_0x376632,_0x48f51c){_0x376632=_0x376632-0x0;var _0x3e3dda=_0x3fb7[_0x376632];return _0x3e3dda;};'use strict';var Sequelize=require(_0x73fb('0x0'));module[_0x73fb('0x1')]={'name':{'type':Sequelize[_0x73fb('0x2')],'allowNull':![],'unique':_0x73fb('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x73fb('0x3')},'main':{'type':Sequelize[_0x73fb('0x2')],'defaultValue':_0x73fb('0x4')},'filename':{'type':Sequelize[_0x73fb('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x73fb('0x2')]},'size':{'type':Sequelize[_0x73fb('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x73fb('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x73fb('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x73fb('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x38f5=['app.js','INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x367284,_0x26688c){var _0xe5c015=function(_0x19705e){while(--_0x19705e){_0x367284['push'](_0x367284['shift']());}};_0xe5c015(++_0x26688c);}(_0x38f5,0x89));var _0x538f=function(_0x1ce01c,_0x3d45cf){_0x1ce01c=_0x1ce01c-0x0;var _0x2b86b9=_0x38f5[_0x1ce01c];return _0x2b86b9;};'use strict';var Sequelize=require('sequelize');module[_0x538f('0x0')]={'name':{'type':Sequelize[_0x538f('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x538f('0x1')],'allowNull':![],'unique':_0x538f('0x2')},'main':{'type':Sequelize[_0x538f('0x1')],'defaultValue':_0x538f('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x538f('0x1')]},'size':{'type':Sequelize[_0x538f('0x4')]},'active':{'type':Sequelize[_0x538f('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x538f('0x1')]},'logo':{'type':Sequelize[_0x538f('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x538f('0x6')},'description':{'type':Sequelize[_0x538f('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x538f('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 528ba8d..87f8de3 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 _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x46e860,_0xd50cb){var _0x2ce1ec=function(_0x106485){while(--_0x106485){_0x46e860['push'](_0x46e860['shift']());}};_0x2ce1ec(++_0xd50cb);}(_0x6343,0x168));var _0x3634=function(_0x264dd1,_0x439eb7){_0x264dd1=_0x264dd1-0x0;var _0x2ebffa=_0x6343[_0x264dd1];return _0x2ebffa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file +var _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x59c4e8,_0xebac9a){_0x59c4e8=_0x59c4e8-0x0;var _0x5a5a6e=_0xc2c7[_0x59c4e8];return _0x5a5a6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['Integration'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['Integration'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e410829..8aea930 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 _0x5d22=['./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4fef05,_0x5cd3ee){var _0x3d6830=function(_0xda1b38){while(--_0xda1b38){_0x4fef05['push'](_0x4fef05['shift']());}};_0x3d6830(++_0x5cd3ee);}(_0x5d22,0xe8));var _0x25d2=function(_0x2fd1bb,_0x2db164){_0x2fd1bb=_0x2fd1bb-0x0;var _0x1261bd=_0x5d22[_0x2fd1bb];return _0x1261bd;};'use strict';var _=require(_0x25d2('0x0'));var util=require(_0x25d2('0x1'));var logger=require(_0x25d2('0x2'))('api');var moment=require(_0x25d2('0x3'));var BPromise=require(_0x25d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25d2('0x5'));var rimraf=require(_0x25d2('0x6'));var config=require(_0x25d2('0x7'));var attributes=require(_0x25d2('0x8'));module[_0x25d2('0x9')]=function(_0x4cb515,_0xff64f2){return _0x4cb515[_0x25d2('0xa')](_0x25d2('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf78f=['exports','define','Integration','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51d89a,_0x3ec6af){var _0x150686=function(_0x21a8c2){while(--_0x21a8c2){_0x51d89a['push'](_0x51d89a['shift']());}};_0x150686(++_0x3ec6af);}(_0xf78f,0x111));var _0xff78=function(_0x4b48c2,_0x19e9cc){_0x4b48c2=_0x4b48c2-0x0;var _0x3d51e2=_0xf78f[_0x4b48c2];return _0x3d51e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff78('0x0'))('api');var moment=require(_0xff78('0x1'));var BPromise=require('bluebird');var rp=require(_0xff78('0x2'));var fs=require('fs');var path=require(_0xff78('0x3'));var rimraf=require(_0xff78('0x4'));var config=require(_0xff78('0x5'));var attributes=require('./integration.attributes');module[_0xff78('0x6')]=function(_0x3408ac,_0x71f224){return _0x3408ac[_0xff78('0x7')](_0xff78('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index d637b06..adaee78 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 _0x7a54=['info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x451923,_0x3ab1b2){_0x451923=_0x451923-0x0;var _0x52595b=_0x7a54[_0x451923];return _0x52595b;};'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')]('Integration,\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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0xadb5,0xad));var _0x5adb=function(_0x293aa5,_0x1fdfa3){_0x293aa5=_0x293aa5-0x0;var _0xe298bb=_0xadb5[_0x293aa5];return _0xe298bb;};'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']('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 5fac3c0..e8a0789 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xffd160,_0x2861a9){var _0xf25891=function(_0x3abc19){while(--_0x3abc19){_0xffd160['push'](_0xffd160['shift']());}};_0xf25891(++_0x2861a9);}(_0x57ca,0x108));var _0xa57c=function(_0x332451,_0x592144){_0x332451=_0x332451-0x0;var _0xda02cc=_0x57ca[_0x332451];return _0xda02cc;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _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(_0x275511,_0x2b8e8f){var _0x418418=function(_0x19cbf2){while(--_0x19cbf2){_0x275511['push'](_0x275511['shift']());}};_0x418418(++_0x2b8e8f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x474037,_0x2a4c42){_0x474037=_0x474037-0x0;var _0x481f68=_0xc6ac[_0x474037];return _0x481f68;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c0652de..1bdf3ee 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 _0x727c=['SENT','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x727c,0x1f2));var _0xc727=function(_0x97385e,_0x17e853){_0x97385e=_0x97385e-0x0;var _0x5d337e=_0x727c[_0x97385e];return _0x5d337e;};'use strict';var Sequelize=require(_0xc727('0x0'));module['exports']={'integration':{'type':Sequelize[_0xc727('0x1')]},'eventChannel':{'type':Sequelize[_0xc727('0x1')]},'exitStatus':{'type':Sequelize[_0xc727('0x1')]},'ticketId':{'type':Sequelize[_0xc727('0x1')]},'integrationId':{'type':Sequelize[_0xc727('0x2')]},'contacts':{'type':Sequelize[_0xc727('0x1')]},'uniqueid':{'type':Sequelize[_0xc727('0x1')]},'calleridnum':{'type':Sequelize[_0xc727('0x1')]},'calleridname':{'type':Sequelize[_0xc727('0x1')]},'queue':{'type':Sequelize[_0xc727('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc727('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc727('0x3')]},'holdtime':{'type':Sequelize[_0xc727('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc727('0x3')]},'talktime':{'type':Sequelize[_0xc727('0x2')]},'agentacw':{'type':Sequelize[_0xc727('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xc727('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc727('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc727('0x3')]},'lastevent':{'type':Sequelize[_0xc727('0x1')]},'channel':{'type':Sequelize[_0xc727('0x1')]},'channelstate':{'type':Sequelize[_0xc727('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc727('0x1')]},'language':{'type':Sequelize[_0xc727('0x1')]},'accountcode':{'type':Sequelize[_0xc727('0x1')]},'context':{'type':Sequelize[_0xc727('0x1')]},'exten':{'type':Sequelize[_0xc727('0x1')]},'priority':{'type':Sequelize[_0xc727('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc727('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc727('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc727('0x1')]},'destcalleridname':{'type':Sequelize[_0xc727('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc727('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xc727('0x1')]},'destlanguage':{'type':Sequelize[_0xc727('0x1')]},'destaccountcode':{'type':Sequelize[_0xc727('0x1')]},'destcontext':{'type':Sequelize[_0xc727('0x1')]},'destexten':{'type':Sequelize[_0xc727('0x1')]},'destpriority':{'type':Sequelize[_0xc727('0x1')]},'destuniqueid':{'type':Sequelize[_0xc727('0x1')]},'messageId':{'type':Sequelize[_0xc727('0x1')]},'inReplyTo':{'type':Sequelize[_0xc727('0x1')]},'subject':{'type':Sequelize[_0xc727('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc727('0x1')]},'cc':{'type':Sequelize[_0xc727('0x1')]},'attachment':{'type':Sequelize[_0xc727('0x5')]},'html':{'type':Sequelize[_0xc727('0x5')]},'text':{'type':Sequelize[_0xc727('0x5')]},'status':{'type':Sequelize['ENUM'](_0xc727('0x6'),'SENDING',_0xc727('0x7'),_0xc727('0x8'))},'url':{'type':Sequelize[_0xc727('0x1')]},'app':{'type':Sequelize[_0xc727('0x1')]},'appdata':{'type':Sequelize[_0xc727('0x1')]},'projectId':{'type':Sequelize[_0xc727('0x2')]}}; \ No newline at end of file +var _0x04d0=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING'];(function(_0xe73021,_0x330885){var _0x1c4b81=function(_0x1b3391){while(--_0x1b3391){_0xe73021['push'](_0xe73021['shift']());}};_0x1c4b81(++_0x330885);}(_0x04d0,0x76));var _0x004d=function(_0x30c9fb,_0x459109){_0x30c9fb=_0x30c9fb-0x0;var _0x56fe61=_0x04d0[_0x30c9fb];return _0x56fe61;};'use strict';var Sequelize=require(_0x004d('0x0'));module['exports']={'integration':{'type':Sequelize[_0x004d('0x1')]},'eventChannel':{'type':Sequelize[_0x004d('0x1')]},'exitStatus':{'type':Sequelize[_0x004d('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x004d('0x2')]},'contacts':{'type':Sequelize[_0x004d('0x1')]},'uniqueid':{'type':Sequelize[_0x004d('0x1')]},'calleridnum':{'type':Sequelize[_0x004d('0x1')]},'calleridname':{'type':Sequelize[_0x004d('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x004d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x004d('0x3')]},'holdtime':{'type':Sequelize[_0x004d('0x2')]},'agentcomplete':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x004d('0x3')]},'talktime':{'type':Sequelize[_0x004d('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x004d('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x004d('0x3')]},'agentdump':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x004d('0x3')]},'lastevent':{'type':Sequelize[_0x004d('0x1')]},'channel':{'type':Sequelize[_0x004d('0x1')]},'channelstate':{'type':Sequelize[_0x004d('0x2')]},'channelstatedesc':{'type':Sequelize[_0x004d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x004d('0x1')]},'connectedlinename':{'type':Sequelize[_0x004d('0x1')]},'language':{'type':Sequelize[_0x004d('0x1')]},'accountcode':{'type':Sequelize[_0x004d('0x1')]},'context':{'type':Sequelize[_0x004d('0x1')]},'exten':{'type':Sequelize[_0x004d('0x1')]},'priority':{'type':Sequelize[_0x004d('0x1')]},'destchannel':{'type':Sequelize[_0x004d('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x004d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x004d('0x1')]},'destlanguage':{'type':Sequelize[_0x004d('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x004d('0x1')]},'destpriority':{'type':Sequelize[_0x004d('0x1')]},'destuniqueid':{'type':Sequelize[_0x004d('0x1')]},'messageId':{'type':Sequelize[_0x004d('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x004d('0x1')]},'to':{'type':Sequelize[_0x004d('0x1')]},'cc':{'type':Sequelize[_0x004d('0x1')]},'attachment':{'type':Sequelize[_0x004d('0x5')]},'html':{'type':Sequelize[_0x004d('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x004d('0x6')](_0x004d('0x7'),'SENDING',_0x004d('0x8'),_0x004d('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x004d('0x1')]},'appdata':{'type':Sequelize[_0x004d('0x1')]},'projectId':{'type':Sequelize[_0x004d('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 88ea7d8..b1c9ce5 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 _0xfeca=['show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','catch'];(function(_0x4f54dc,_0x267c9a){var _0x23331b=function(_0x17588a){while(--_0x17588a){_0x4f54dc['push'](_0x4f54dc['shift']());}};_0x23331b(++_0x267c9a);}(_0xfeca,0xa3));var _0xafec=function(_0x538da2,_0x24a22f){_0x538da2=_0x538da2-0x0;var _0xbda25c=_0xfeca[_0x538da2];return _0xbda25c;};'use strict';var emlformat=require(_0xafec('0x0'));var rimraf=require(_0xafec('0x1'));var zipdir=require(_0xafec('0x2'));var jsonpatch=require(_0xafec('0x3'));var rp=require(_0xafec('0x4'));var moment=require(_0xafec('0x5'));var BPromise=require(_0xafec('0x6'));var Mustache=require(_0xafec('0x7'));var util=require('util');var path=require(_0xafec('0x8'));var sox=require(_0xafec('0x9'));var csv=require('to-csv');var ejs=require(_0xafec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xafec('0xb'));var crypto=require(_0xafec('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xafec('0xd'));var toCsv=require(_0xafec('0xe'));var querystring=require(_0xafec('0xf'));var Papa=require(_0xafec('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xafec('0x11'));var as=require(_0xafec('0x12'));var hardwareService=require(_0xafec('0x13'));var logger=require(_0xafec('0x14'))('api');var utils=require(_0xafec('0x15'));var config=require(_0xafec('0x16'));var licenseUtil=require(_0xafec('0x17'));var db=require(_0xafec('0x18'))['db'];function respondWithStatusCode(_0x41951c,_0x2b161a){_0x2b161a=_0x2b161a||0xcc;return function(_0x524cfc){if(_0x524cfc){return _0x41951c[_0xafec('0x19')](_0x2b161a);}return _0x41951c[_0xafec('0x1a')](_0x2b161a)[_0xafec('0x1b')]();};}function respondWithResult(_0x3625e9,_0x1375b4){_0x1375b4=_0x1375b4||0xc8;return function(_0x6b3b78){if(_0x6b3b78){return _0x3625e9['status'](_0x1375b4)[_0xafec('0x1c')](_0x6b3b78);}};}function respondWithFilteredResult(_0x42bddf,_0xc43d0e){return function(_0x12c28d){if(_0x12c28d){var _0x5b50b3=typeof _0xc43d0e[_0xafec('0x1d')]===_0xafec('0x1e')&&typeof _0xc43d0e[_0xafec('0x1f')]===_0xafec('0x1e');var _0x4f7a77=_0x12c28d[_0xafec('0x20')];var _0x3c034b=_0x5b50b3?0x0:_0xc43d0e[_0xafec('0x1d')];var _0x50198d=_0x5b50b3?_0x12c28d[_0xafec('0x20')]:_0xc43d0e[_0xafec('0x1d')]+_0xc43d0e[_0xafec('0x1f')];var _0x3d34d5;if(_0x50198d>=_0x4f7a77){_0x50198d=_0x4f7a77;_0x3d34d5=0xc8;}else{_0x3d34d5=0xce;}_0x42bddf['status'](_0x3d34d5);return _0x42bddf[_0xafec('0x21')](_0xafec('0x22'),_0x3c034b+'-'+_0x50198d+'/'+_0x4f7a77)[_0xafec('0x1c')](_0x12c28d);}return null;};}function patchUpdates(_0x53d121){return function(_0x60bae){try{jsonpatch[_0xafec('0x23')](_0x60bae,_0x53d121,!![]);}catch(_0x33b3bd){return BPromise[_0xafec('0x24')](_0x33b3bd);}return _0x60bae[_0xafec('0x25')]();};}function saveUpdates(_0x3ba66d,_0xcc6bd9){return function(_0x573203){if(_0x573203){return _0x573203[_0xafec('0x26')](_0x3ba66d)[_0xafec('0x27')](function(_0x551ce0){return _0x551ce0;});}return null;};}function removeEntity(_0x25cc1a,_0x267758){return function(_0x193c79){if(_0x193c79){return _0x193c79[_0xafec('0x28')]()[_0xafec('0x27')](function(){_0x25cc1a['status'](0xcc)[_0xafec('0x1b')]();});}};}function handleEntityNotFound(_0x4a244f,_0x1631c7){return function(_0x2026fe){if(!_0x2026fe){_0x4a244f[_0xafec('0x19')](0x194);}return _0x2026fe;};}function handleError(_0x28b791,_0x2eed41){_0x2eed41=_0x2eed41||0x1f4;return function(_0x5f3896){logger[_0xafec('0x29')](_0x5f3896[_0xafec('0x2a')]);if(_0x5f3896['name']){delete _0x5f3896[_0xafec('0x2b')];}_0x28b791[_0xafec('0x1a')](_0x2eed41)['send'](_0x5f3896);};}exports[_0xafec('0x2c')]=function(_0x334904,_0x3391e6){var _0x27c0cf={},_0x11d602={},_0x49bafe={'count':0x0,'rows':[]};var _0x464555=_[_0xafec('0x2d')](db['IntegrationReport'][_0xafec('0x2e')],function(_0x1442d6){return{'name':_0x1442d6[_0xafec('0x2f')],'type':_0x1442d6['type'][_0xafec('0x30')]};});_0x11d602['model']=_[_0xafec('0x2d')](_0x464555,_0xafec('0x2b'));_0x11d602[_0xafec('0x31')]=_['keys'](_0x334904[_0xafec('0x31')]);_0x11d602[_0xafec('0x32')]=_[_0xafec('0x33')](_0x11d602[_0xafec('0x34')],_0x11d602[_0xafec('0x31')]);_0x27c0cf['attributes']=_['intersection'](_0x11d602[_0xafec('0x34')],qs['fields'](_0x334904[_0xafec('0x31')][_0xafec('0x35')]));_0x27c0cf[_0xafec('0x36')]=_0x27c0cf['attributes'][_0xafec('0x37')]?_0x27c0cf[_0xafec('0x36')]:_0x11d602['model'];if(!_0x334904['query'][_0xafec('0x38')](_0xafec('0x39'))){_0x27c0cf[_0xafec('0x1f')]=qs[_0xafec('0x1f')](_0x334904['query'][_0xafec('0x1f')]);_0x27c0cf[_0xafec('0x1d')]=qs['offset'](_0x334904['query'][_0xafec('0x1d')]);}_0x27c0cf[_0xafec('0x3a')]=qs['sort'](_0x334904['query'][_0xafec('0x3b')]);_0x27c0cf[_0xafec('0x3c')]=qs[_0xafec('0x32')](_['pick'](_0x334904[_0xafec('0x31')],_0x11d602[_0xafec('0x32')]),_0x464555);if(_0x334904[_0xafec('0x31')][_0xafec('0x3d')]){_0x27c0cf[_0xafec('0x3c')]=_[_0xafec('0x3e')](_0x27c0cf[_0xafec('0x3c')],{'$or':_['map'](_0x464555,function(_0x288a31){if(_0x288a31[_0xafec('0x3f')]!==_0xafec('0x40')){var _0x1e0ef7={};_0x1e0ef7[_0x288a31['name']]={'$like':'%'+_0x334904['query'][_0xafec('0x3d')]+'%'};return _0x1e0ef7;}})});}_0x27c0cf=_[_0xafec('0x3e')]({},_0x27c0cf,_0x334904[_0xafec('0x41')]);var _0x1e27d3={'where':_0x27c0cf[_0xafec('0x3c')]};return db[_0xafec('0x42')][_0xafec('0x20')](_0x1e27d3)[_0xafec('0x27')](function(_0x9a6ac6){_0x49bafe['count']=_0x9a6ac6;if(_0x334904[_0xafec('0x31')][_0xafec('0x43')]){_0x27c0cf[_0xafec('0x44')]=[{'all':!![]}];}return db[_0xafec('0x42')][_0xafec('0x45')](_0x27c0cf);})['then'](function(_0x464672){_0x49bafe['rows']=_0x464672;return _0x49bafe;})['then'](respondWithFilteredResult(_0x3391e6,_0x27c0cf))[_0xafec('0x46')](handleError(_0x3391e6,null));};exports[_0xafec('0x47')]=function(_0x324882,_0x1dcc1f){var _0x588bdc={'raw':![],'where':{'id':_0x324882[_0xafec('0x48')]['id']}},_0x19041f={};_0x19041f[_0xafec('0x34')]=_[_0xafec('0x49')](db['IntegrationReport'][_0xafec('0x2e')]);_0x19041f['query']=_[_0xafec('0x49')](_0x324882[_0xafec('0x31')]);_0x19041f[_0xafec('0x32')]=_['intersection'](_0x19041f[_0xafec('0x34')],_0x19041f['query']);_0x588bdc[_0xafec('0x36')]=_['intersection'](_0x19041f[_0xafec('0x34')],qs['fields'](_0x324882[_0xafec('0x31')][_0xafec('0x35')]));_0x588bdc[_0xafec('0x36')]=_0x588bdc['attributes'][_0xafec('0x37')]?_0x588bdc[_0xafec('0x36')]:_0x19041f['model'];if(_0x324882[_0xafec('0x31')]['includeAll']){_0x588bdc[_0xafec('0x44')]=[{'all':!![]}];}_0x588bdc=_[_0xafec('0x3e')]({},_0x588bdc,_0x324882[_0xafec('0x41')]);return db[_0xafec('0x42')]['find'](_0x588bdc)[_0xafec('0x27')](handleEntityNotFound(_0x1dcc1f,null))[_0xafec('0x27')](respondWithResult(_0x1dcc1f,null))['catch'](handleError(_0x1dcc1f,null));};exports[_0xafec('0x4a')]=function(_0x1f7001,_0x1c1f61){return db[_0xafec('0x42')][_0xafec('0x4a')](_0x1f7001['body'],{})[_0xafec('0x27')](respondWithResult(_0x1c1f61,0xc9))['catch'](handleError(_0x1c1f61,null));};exports[_0xafec('0x26')]=function(_0x391170,_0x3b9652){if(_0x391170[_0xafec('0x4b')]['id']){delete _0x391170[_0xafec('0x4b')]['id'];}return db[_0xafec('0x42')][_0xafec('0x4c')]({'where':{'id':_0x391170['params']['id']}})['then'](handleEntityNotFound(_0x3b9652,null))[_0xafec('0x27')](saveUpdates(_0x391170['body'],null))[_0xafec('0x27')](respondWithResult(_0x3b9652,null))[_0xafec('0x46')](handleError(_0x3b9652,null));};exports[_0xafec('0x28')]=function(_0x3dd22a,_0x16a49b){return db[_0xafec('0x42')]['find']({'where':{'id':_0x3dd22a[_0xafec('0x48')]['id']}})[_0xafec('0x27')](handleEntityNotFound(_0x16a49b,null))[_0xafec('0x27')](removeEntity(_0x16a49b,null))[_0xafec('0x46')](handleError(_0x16a49b,null));};exports[_0xafec('0x4d')]=function(_0x420ba2,_0x36a46b){return db[_0xafec('0x42')][_0xafec('0x4d')]()[_0xafec('0x27')](respondWithResult(_0x36a46b,null))[_0xafec('0x46')](handleError(_0x36a46b,null));}; \ No newline at end of file +var _0x3998=['order','sort','where','filters','filter','VIRTUAL','options','include','rows','catch','show','params','keys','intersection','merge','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2c6c95,_0x3e88d6){var _0x109f35=function(_0x1f02e3){while(--_0x1f02e3){_0x2c6c95['push'](_0x2c6c95['shift']());}};_0x109f35(++_0x3e88d6);}(_0x3998,0xf2));var _0x8399=function(_0x163dd1,_0xc50470){_0x163dd1=_0x163dd1-0x0;var _0x591417=_0x3998[_0x163dd1];return _0x591417;};'use strict';var emlformat=require(_0x8399('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8399('0x1'));var jsonpatch=require(_0x8399('0x2'));var rp=require(_0x8399('0x3'));var moment=require(_0x8399('0x4'));var BPromise=require(_0x8399('0x5'));var Mustache=require(_0x8399('0x6'));var util=require(_0x8399('0x7'));var path=require('path');var sox=require(_0x8399('0x8'));var csv=require(_0x8399('0x9'));var ejs=require(_0x8399('0xa'));var fs=require('fs');var fs_extra=require(_0x8399('0xb'));var _=require(_0x8399('0xc'));var squel=require(_0x8399('0xd'));var crypto=require(_0x8399('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8399('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8399('0x10'));var Redis=require(_0x8399('0x11'));var authService=require(_0x8399('0x12'));var qs=require(_0x8399('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8399('0x14'));var logger=require(_0x8399('0x15'))('api');var utils=require(_0x8399('0x16'));var config=require(_0x8399('0x17'));var licenseUtil=require(_0x8399('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42cd69,_0x2892cc){_0x2892cc=_0x2892cc||0xcc;return function(_0x5c2fbd){if(_0x5c2fbd){return _0x42cd69[_0x8399('0x19')](_0x2892cc);}return _0x42cd69[_0x8399('0x1a')](_0x2892cc)[_0x8399('0x1b')]();};}function respondWithResult(_0x50d1b6,_0x1c8d5d){_0x1c8d5d=_0x1c8d5d||0xc8;return function(_0x3ff490){if(_0x3ff490){return _0x50d1b6[_0x8399('0x1a')](_0x1c8d5d)[_0x8399('0x1c')](_0x3ff490);}};}function respondWithFilteredResult(_0xd65be9,_0x42ff34){return function(_0x7de1ed){if(_0x7de1ed){var _0x4ca8ac=typeof _0x42ff34[_0x8399('0x1d')]===_0x8399('0x1e')&&typeof _0x42ff34[_0x8399('0x1f')]===_0x8399('0x1e');var _0x50b0b4=_0x7de1ed[_0x8399('0x20')];var _0x3346e3=_0x4ca8ac?0x0:_0x42ff34[_0x8399('0x1d')];var _0x2048b1=_0x4ca8ac?_0x7de1ed[_0x8399('0x20')]:_0x42ff34[_0x8399('0x1d')]+_0x42ff34[_0x8399('0x1f')];var _0x532467;if(_0x2048b1>=_0x50b0b4){_0x2048b1=_0x50b0b4;_0x532467=0xc8;}else{_0x532467=0xce;}_0xd65be9['status'](_0x532467);return _0xd65be9['set'](_0x8399('0x21'),_0x3346e3+'-'+_0x2048b1+'/'+_0x50b0b4)[_0x8399('0x1c')](_0x7de1ed);}return null;};}function patchUpdates(_0x4fc495){return function(_0x5472ad){try{jsonpatch['apply'](_0x5472ad,_0x4fc495,!![]);}catch(_0x137d3e){return BPromise[_0x8399('0x22')](_0x137d3e);}return _0x5472ad[_0x8399('0x23')]();};}function saveUpdates(_0x10ba48,_0x448073){return function(_0x53e916){if(_0x53e916){return _0x53e916['update'](_0x10ba48)[_0x8399('0x24')](function(_0x516fe0){return _0x516fe0;});}return null;};}function removeEntity(_0x269e65,_0x4c9e2e){return function(_0x2a6830){if(_0x2a6830){return _0x2a6830[_0x8399('0x25')]()['then'](function(){_0x269e65[_0x8399('0x1a')](0xcc)[_0x8399('0x1b')]();});}};}function handleEntityNotFound(_0x16fecc,_0x4f5976){return function(_0x7ada0a){if(!_0x7ada0a){_0x16fecc['sendStatus'](0x194);}return _0x7ada0a;};}function handleError(_0x22593b,_0x3375c0){_0x3375c0=_0x3375c0||0x1f4;return function(_0x7a49ba){logger[_0x8399('0x26')](_0x7a49ba[_0x8399('0x27')]);if(_0x7a49ba['name']){delete _0x7a49ba[_0x8399('0x28')];}_0x22593b[_0x8399('0x1a')](_0x3375c0)[_0x8399('0x29')](_0x7a49ba);};}exports[_0x8399('0x2a')]=function(_0x223f29,_0x1c143a){var _0x5389ab={},_0x461598={},_0x25126a={'count':0x0,'rows':[]};var _0x346903=_[_0x8399('0x2b')](db[_0x8399('0x2c')][_0x8399('0x2d')],function(_0x304380){return{'name':_0x304380[_0x8399('0x2e')],'type':_0x304380['type'][_0x8399('0x2f')]};});_0x461598[_0x8399('0x30')]=_['map'](_0x346903,_0x8399('0x28'));_0x461598['query']=_['keys'](_0x223f29[_0x8399('0x31')]);_0x461598['filters']=_['intersection'](_0x461598[_0x8399('0x30')],_0x461598['query']);_0x5389ab[_0x8399('0x32')]=_['intersection'](_0x461598[_0x8399('0x30')],qs[_0x8399('0x33')](_0x223f29['query'][_0x8399('0x33')]));_0x5389ab['attributes']=_0x5389ab[_0x8399('0x32')]['length']?_0x5389ab[_0x8399('0x32')]:_0x461598['model'];if(!_0x223f29[_0x8399('0x31')][_0x8399('0x34')](_0x8399('0x35'))){_0x5389ab['limit']=qs[_0x8399('0x1f')](_0x223f29[_0x8399('0x31')]['limit']);_0x5389ab['offset']=qs[_0x8399('0x1d')](_0x223f29['query'][_0x8399('0x1d')]);}_0x5389ab[_0x8399('0x36')]=qs[_0x8399('0x37')](_0x223f29[_0x8399('0x31')]['sort']);_0x5389ab[_0x8399('0x38')]=qs['filters'](_['pick'](_0x223f29[_0x8399('0x31')],_0x461598[_0x8399('0x39')]),_0x346903);if(_0x223f29[_0x8399('0x31')][_0x8399('0x3a')]){_0x5389ab[_0x8399('0x38')]=_['merge'](_0x5389ab['where'],{'$or':_[_0x8399('0x2b')](_0x346903,function(_0x3e11f5){if(_0x3e11f5['type']!==_0x8399('0x3b')){var _0x1a74f3={};_0x1a74f3[_0x3e11f5['name']]={'$like':'%'+_0x223f29['query']['filter']+'%'};return _0x1a74f3;}})});}_0x5389ab=_['merge']({},_0x5389ab,_0x223f29[_0x8399('0x3c')]);var _0x5e3795={'where':_0x5389ab['where']};return db[_0x8399('0x2c')][_0x8399('0x20')](_0x5e3795)[_0x8399('0x24')](function(_0x1d0bf0){_0x25126a['count']=_0x1d0bf0;if(_0x223f29['query']['includeAll']){_0x5389ab[_0x8399('0x3d')]=[{'all':!![]}];}return db[_0x8399('0x2c')]['findAll'](_0x5389ab);})[_0x8399('0x24')](function(_0x46d5b0){_0x25126a[_0x8399('0x3e')]=_0x46d5b0;return _0x25126a;})[_0x8399('0x24')](respondWithFilteredResult(_0x1c143a,_0x5389ab))[_0x8399('0x3f')](handleError(_0x1c143a,null));};exports[_0x8399('0x40')]=function(_0x2f91bd,_0x149e9a){var _0x561a14={'raw':![],'where':{'id':_0x2f91bd[_0x8399('0x41')]['id']}},_0x142be9={};_0x142be9[_0x8399('0x30')]=_[_0x8399('0x42')](db[_0x8399('0x2c')][_0x8399('0x2d')]);_0x142be9[_0x8399('0x31')]=_[_0x8399('0x42')](_0x2f91bd[_0x8399('0x31')]);_0x142be9[_0x8399('0x39')]=_[_0x8399('0x43')](_0x142be9['model'],_0x142be9[_0x8399('0x31')]);_0x561a14[_0x8399('0x32')]=_[_0x8399('0x43')](_0x142be9[_0x8399('0x30')],qs['fields'](_0x2f91bd[_0x8399('0x31')][_0x8399('0x33')]));_0x561a14[_0x8399('0x32')]=_0x561a14[_0x8399('0x32')]['length']?_0x561a14['attributes']:_0x142be9[_0x8399('0x30')];if(_0x2f91bd[_0x8399('0x31')]['includeAll']){_0x561a14[_0x8399('0x3d')]=[{'all':!![]}];}_0x561a14=_[_0x8399('0x44')]({},_0x561a14,_0x2f91bd['options']);return db[_0x8399('0x2c')][_0x8399('0x45')](_0x561a14)['then'](handleEntityNotFound(_0x149e9a,null))['then'](respondWithResult(_0x149e9a,null))[_0x8399('0x3f')](handleError(_0x149e9a,null));};exports[_0x8399('0x46')]=function(_0x4ad4ca,_0x3a135a){return db[_0x8399('0x2c')]['create'](_0x4ad4ca[_0x8399('0x47')],{})[_0x8399('0x24')](respondWithResult(_0x3a135a,0xc9))[_0x8399('0x3f')](handleError(_0x3a135a,null));};exports[_0x8399('0x48')]=function(_0x1e0da8,_0x289afd){if(_0x1e0da8['body']['id']){delete _0x1e0da8[_0x8399('0x47')]['id'];}return db['IntegrationReport'][_0x8399('0x45')]({'where':{'id':_0x1e0da8[_0x8399('0x41')]['id']}})[_0x8399('0x24')](handleEntityNotFound(_0x289afd,null))[_0x8399('0x24')](saveUpdates(_0x1e0da8[_0x8399('0x47')],null))[_0x8399('0x24')](respondWithResult(_0x289afd,null))[_0x8399('0x3f')](handleError(_0x289afd,null));};exports[_0x8399('0x25')]=function(_0x329c1f,_0x32d0c9){return db['IntegrationReport']['find']({'where':{'id':_0x329c1f[_0x8399('0x41')]['id']}})[_0x8399('0x24')](handleEntityNotFound(_0x32d0c9,null))['then'](removeEntity(_0x32d0c9,null))[_0x8399('0x3f')](handleError(_0x32d0c9,null));};exports[_0x8399('0x49')]=function(_0x3555bc,_0x40159e){return db[_0x8399('0x2c')][_0x8399('0x49')]()[_0x8399('0x24')](respondWithResult(_0x40159e,null))[_0x8399('0x3f')](handleError(_0x40159e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c5d54f2..7dc913b 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 _0x9207=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x9207,0x1cd));var _0x7920=function(_0x3cb7c1,_0x1bde10){_0x3cb7c1=_0x3cb7c1-0x0;var _0x3f6ffc=_0x9207[_0x3cb7c1];return _0x3f6ffc;};'use strict';var _=require(_0x7920('0x0'));var util=require(_0x7920('0x1'));var logger=require(_0x7920('0x2'))(_0x7920('0x3'));var moment=require(_0x7920('0x4'));var BPromise=require(_0x7920('0x5'));var rp=require(_0x7920('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7920('0x7'));var config=require(_0x7920('0x8'));var attributes=require(_0x7920('0x9'));module[_0x7920('0xa')]=function(_0x310cef,_0x3c9a27){return _0x310cef[_0x7920('0xb')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa31e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','../../config/logger'];(function(_0x2dced6,_0x3ebeca){var _0x49774f=function(_0x45cca0){while(--_0x45cca0){_0x2dced6['push'](_0x2dced6['shift']());}};_0x49774f(++_0x3ebeca);}(_0xa31e,0x15a));var _0xea31=function(_0x4a00d0,_0x56d533){_0x4a00d0=_0x4a00d0-0x0;var _0x6e25bf=_0xa31e[_0x4a00d0];return _0x6e25bf;};'use strict';var _=require(_0xea31('0x0'));var util=require('util');var logger=require(_0xea31('0x1'))('api');var moment=require(_0xea31('0x2'));var BPromise=require(_0xea31('0x3'));var rp=require(_0xea31('0x4'));var fs=require('fs');var path=require(_0xea31('0x5'));var rimraf=require(_0xea31('0x6'));var config=require(_0xea31('0x7'));var attributes=require(_0xea31('0x8'));module['exports']=function(_0x1c9f10,_0x1bef5c){return _0x1c9f10[_0xea31('0x9')](_0xea31('0xa'),attributes,{'tableName':_0xea31('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 37de4ad..4556091 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x4975,0x86));var _0x5497=function(_0x4c712f,_0x514dc6){_0x4c712f=_0x4c712f-0x0;var _0x23aa37=_0x4975[_0x4c712f];return _0x23aa37;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1e77a2,_0x329255){var _0x2b9446=function(_0x3dd0d6){while(--_0x3dd0d6){_0x1e77a2['push'](_0x1e77a2['shift']());}};_0x2b9446(++_0x329255);}(_0x1261,0x144));var _0x1126=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0x1261[_0x291ec3];return _0x423b99;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a9a881c..edd6f90 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 _0xd3e3=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x5dfbc3,_0x358c22){var _0x488b94=function(_0xe3c950){while(--_0xe3c950){_0x5dfbc3['push'](_0x5dfbc3['shift']());}};_0x488b94(++_0x358c22);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x122582,_0xc7828e){_0x122582=_0x122582-0x0;var _0x17c799=_0xd3e3[_0x122582];return _0x17c799;};'use strict';var multer=require(_0x3d3e('0x0'));var util=require(_0x3d3e('0x1'));var path=require(_0x3d3e('0x2'));var timeout=require(_0x3d3e('0x3'));var express=require('express');var router=express[_0x3d3e('0x4')]();var fs_extra=require(_0x3d3e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d3e('0x6'));var config=require(_0x3d3e('0x7'));var controller=require('./interval.controller');router[_0x3d3e('0x8')]('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xa')]);router[_0x3d3e('0x8')](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0xc')]);router[_0x3d3e('0x8')](_0x3d3e('0xd'),auth['isAuthenticated'](),controller[_0x3d3e('0xe')]);router[_0x3d3e('0xf')]('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0x10')]);router['post'](_0x3d3e('0xd'),auth['isAuthenticated'](),controller[_0x3d3e('0x11')]);router[_0x3d3e('0xf')](_0x3d3e('0x12'),auth[_0x3d3e('0x9')](),controller['addIntervals']);router[_0x3d3e('0x13')](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0x14')]);router[_0x3d3e('0x15')](_0x3d3e('0xb'),auth[_0x3d3e('0x9')](),controller[_0x3d3e('0x16')]);module[_0x3d3e('0x17')]=router; \ No newline at end of file +var _0x0578=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','get','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy'];(function(_0x5bc95c,_0xfed759){var _0x3721fc=function(_0x49fca7){while(--_0x49fca7){_0x5bc95c['push'](_0x5bc95c['shift']());}};_0x3721fc(++_0xfed759);}(_0x0578,0x1b8));var _0x8057=function(_0x4ace09,_0x5b6e68){_0x4ace09=_0x4ace09-0x0;var _0x3fdf87=_0x0578[_0x4ace09];return _0x3fdf87;};'use strict';var multer=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var path=require(_0x8057('0x2'));var timeout=require(_0x8057('0x3'));var express=require(_0x8057('0x4'));var router=express['Router']();var fs_extra=require(_0x8057('0x5'));var auth=require(_0x8057('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8057('0x7'));var controller=require(_0x8057('0x8'));router['get']('/',auth[_0x8057('0x9')](),controller['index']);router[_0x8057('0xa')](_0x8057('0xb'),auth['isAuthenticated'](),controller[_0x8057('0xc')]);router['get'](_0x8057('0xd'),auth[_0x8057('0x9')](),controller[_0x8057('0xe')]);router[_0x8057('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8057('0xd'),auth[_0x8057('0x9')](),controller[_0x8057('0x10')]);router[_0x8057('0xf')](_0x8057('0x11'),auth[_0x8057('0x9')](),controller['addIntervals']);router[_0x8057('0x12')](_0x8057('0xb'),auth['isAuthenticated'](),controller[_0x8057('0x13')]);router[_0x8057('0x14')]('/:id',auth[_0x8057('0x9')](),controller[_0x8057('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b60c923..36550fb 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 _0xfb49=['sequelize','exports','STRING'];(function(_0x53c309,_0x3e3c71){var _0xe1c297=function(_0x4c605f){while(--_0x4c605f){_0x53c309['push'](_0x53c309['shift']());}};_0xe1c297(++_0x3e3c71);}(_0xfb49,0x1ec));var _0x9fb4=function(_0x21929f,_0xb96182){_0x21929f=_0x21929f-0x0;var _0x1a6077=_0xfb49[_0x21929f];return _0x1a6077;};'use strict';var Sequelize=require(_0x9fb4('0x0'));module[_0x9fb4('0x1')]={'name':{'type':Sequelize[_0x9fb4('0x2')]},'description':{'type':Sequelize[_0x9fb4('0x2')]},'interval':{'type':Sequelize[_0x9fb4('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe808=['STRING','sequelize'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0xe808,0x151));var _0x8e80=function(_0x32e007,_0x553a84){_0x32e007=_0x32e007-0x0;var _0x26dae4=_0xe808[_0x32e007];return _0x26dae4;};'use strict';var Sequelize=require(_0x8e80('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e80('0x1')]},'description':{'type':Sequelize[_0x8e80('0x1')]},'interval':{'type':Sequelize[_0x8e80('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 22a3a2d..6761ee8 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 _0x7786=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','save','update','then','destroy','get','UserProfileResource','name','send','map','Interval','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body'];(function(_0xf36aa6,_0x302470){var _0x28c4d3=function(_0x5358a0){while(--_0x5358a0){_0xf36aa6['push'](_0xf36aa6['shift']());}};_0x28c4d3(++_0x302470);}(_0x7786,0x11e));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6778('0x0'));var jsonpatch=require(_0x6778('0x1'));var rp=require(_0x6778('0x2'));var moment=require(_0x6778('0x3'));var BPromise=require(_0x6778('0x4'));var Mustache=require(_0x6778('0x5'));var util=require(_0x6778('0x6'));var path=require(_0x6778('0x7'));var sox=require(_0x6778('0x8'));var csv=require(_0x6778('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6778('0xa'));var squel=require('squel');var crypto=require(_0x6778('0xb'));var jsforce=require(_0x6778('0xc'));var deskjs=require(_0x6778('0xd'));var toCsv=require(_0x6778('0x9'));var querystring=require(_0x6778('0xe'));var Papa=require(_0x6778('0xf'));var Redis=require(_0x6778('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6778('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6778('0x12'))(_0x6778('0x13'));var utils=require(_0x6778('0x14'));var config=require(_0x6778('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x6778('0x16'));function respondWithStatusCode(_0x132a0b,_0x35b4ca){_0x35b4ca=_0x35b4ca||0xcc;return function(_0x7a099){if(_0x7a099){return _0x132a0b[_0x6778('0x17')](_0x35b4ca);}return _0x132a0b['status'](_0x35b4ca)[_0x6778('0x18')]();};}function respondWithResult(_0x2b0cab,_0x5166b0){_0x5166b0=_0x5166b0||0xc8;return function(_0x50dad6){if(_0x50dad6){return _0x2b0cab['status'](_0x5166b0)[_0x6778('0x19')](_0x50dad6);}};}function respondWithFilteredResult(_0x27c52e,_0x18d45d){return function(_0x2c323a){if(_0x2c323a){var _0x19b4f9=typeof _0x18d45d[_0x6778('0x1a')]==='undefined'&&typeof _0x18d45d[_0x6778('0x1b')]===_0x6778('0x1c');var _0x7c1cba=_0x2c323a[_0x6778('0x1d')];var _0x178d53=_0x19b4f9?0x0:_0x18d45d[_0x6778('0x1a')];var _0x251da8=_0x19b4f9?_0x2c323a['count']:_0x18d45d[_0x6778('0x1a')]+_0x18d45d['limit'];var _0x4ea2f9;if(_0x251da8>=_0x7c1cba){_0x251da8=_0x7c1cba;_0x4ea2f9=0xc8;}else{_0x4ea2f9=0xce;}_0x27c52e[_0x6778('0x1e')](_0x4ea2f9);return _0x27c52e[_0x6778('0x1f')](_0x6778('0x20'),_0x178d53+'-'+_0x251da8+'/'+_0x7c1cba)[_0x6778('0x19')](_0x2c323a);}return null;};}function patchUpdates(_0x13c67f){return function(_0x194c9d){try{jsonpatch['apply'](_0x194c9d,_0x13c67f,!![]);}catch(_0x37050b){return BPromise['reject'](_0x37050b);}return _0x194c9d[_0x6778('0x21')]();};}function saveUpdates(_0x5a004f,_0x3c658a){return function(_0x40533b){if(_0x40533b){return _0x40533b[_0x6778('0x22')](_0x5a004f)[_0x6778('0x23')](function(_0x5f0805){return _0x5f0805;});}return null;};}function removeEntity(_0x434349,_0x356722){return function(_0x1a66da){if(_0x1a66da){return _0x1a66da[_0x6778('0x24')]()[_0x6778('0x23')](function(){var _0x5967e4=_0x1a66da[_0x6778('0x25')]({'plain':!![]});var _0x18eae5='Intervals';return db[_0x6778('0x26')][_0x6778('0x24')]({'where':{'type':_0x18eae5,'resourceId':_0x5967e4['id']}})['then'](function(){return _0x1a66da;});})[_0x6778('0x23')](function(){_0x434349[_0x6778('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb4e4,_0x476dd6){return function(_0x18d5f8){if(!_0x18d5f8){_0x3eb4e4['sendStatus'](0x194);}return _0x18d5f8;};}function handleError(_0xc7db64,_0x4d6172){_0x4d6172=_0x4d6172||0x1f4;return function(_0x16d9a9){logger['error'](_0x16d9a9['stack']);if(_0x16d9a9[_0x6778('0x27')]){delete _0x16d9a9[_0x6778('0x27')];}_0xc7db64[_0x6778('0x1e')](_0x4d6172)[_0x6778('0x28')](_0x16d9a9);};}exports['index']=function(_0x3dd283,_0x59e8dd){var _0x45e400={},_0xe7038d={},_0x53e95c={'count':0x0,'rows':[]};var _0x5afd9d=_[_0x6778('0x29')](db[_0x6778('0x2a')][_0x6778('0x2b')],function(_0x5e5950){return{'name':_0x5e5950[_0x6778('0x2c')],'type':_0x5e5950[_0x6778('0x2d')]['key']};});_0xe7038d['model']=_[_0x6778('0x29')](_0x5afd9d,_0x6778('0x27'));_0xe7038d[_0x6778('0x2e')]=_['keys'](_0x3dd283[_0x6778('0x2e')]);_0xe7038d['filters']=_[_0x6778('0x2f')](_0xe7038d[_0x6778('0x30')],_0xe7038d[_0x6778('0x2e')]);_0x45e400[_0x6778('0x31')]=_[_0x6778('0x2f')](_0xe7038d[_0x6778('0x30')],qs[_0x6778('0x32')](_0x3dd283[_0x6778('0x2e')]['fields']));_0x45e400[_0x6778('0x31')]=_0x45e400[_0x6778('0x31')][_0x6778('0x33')]?_0x45e400[_0x6778('0x31')]:_0xe7038d[_0x6778('0x30')];if(!_0x3dd283[_0x6778('0x2e')]['hasOwnProperty'](_0x6778('0x34'))){_0x45e400['limit']=qs[_0x6778('0x1b')](_0x3dd283['query']['limit']);_0x45e400[_0x6778('0x1a')]=qs['offset'](_0x3dd283['query'][_0x6778('0x1a')]);}_0x45e400[_0x6778('0x35')]=qs[_0x6778('0x36')](_0x3dd283['query'][_0x6778('0x36')]);_0x45e400[_0x6778('0x37')]=qs[_0x6778('0x38')](_['pick'](_0x3dd283[_0x6778('0x2e')],_0xe7038d['filters']),_0x5afd9d);if(_0x3dd283[_0x6778('0x2e')][_0x6778('0x39')]){_0x45e400[_0x6778('0x37')]=_[_0x6778('0x3a')](_0x45e400[_0x6778('0x37')],{'$or':_['map'](_0x5afd9d,function(_0x4439da){if(_0x4439da[_0x6778('0x2d')]!=='VIRTUAL'){var _0x138f30={};_0x138f30[_0x4439da[_0x6778('0x27')]]={'$like':'%'+_0x3dd283['query']['filter']+'%'};return _0x138f30;}})});}_0x45e400=_[_0x6778('0x3a')]({},_0x45e400,_0x3dd283[_0x6778('0x3b')]);var _0x4db92e={'where':_0x45e400['where']};return db['Interval'][_0x6778('0x1d')](_0x4db92e)['then'](function(_0x6a7414){_0x53e95c[_0x6778('0x1d')]=_0x6a7414;if(_0x3dd283[_0x6778('0x2e')][_0x6778('0x3c')]){_0x45e400[_0x6778('0x3d')]=[{'all':!![]}];}return db[_0x6778('0x2a')][_0x6778('0x3e')](_0x45e400);})['then'](function(_0x25ebd1){_0x53e95c[_0x6778('0x3f')]=_0x25ebd1;return _0x53e95c;})[_0x6778('0x23')](respondWithFilteredResult(_0x59e8dd,_0x45e400))['catch'](handleError(_0x59e8dd,null));};exports[_0x6778('0x40')]=function(_0x1cf3b9,_0x55d761){var _0x2e2124={'raw':!![],'where':{'id':_0x1cf3b9[_0x6778('0x41')]['id']}},_0xd200fd={};_0xd200fd['model']=_[_0x6778('0x42')](db[_0x6778('0x2a')]['rawAttributes']);_0xd200fd[_0x6778('0x2e')]=_[_0x6778('0x42')](_0x1cf3b9[_0x6778('0x2e')]);_0xd200fd[_0x6778('0x38')]=_[_0x6778('0x2f')](_0xd200fd[_0x6778('0x30')],_0xd200fd['query']);_0x2e2124[_0x6778('0x31')]=_['intersection'](_0xd200fd[_0x6778('0x30')],qs['fields'](_0x1cf3b9[_0x6778('0x2e')][_0x6778('0x32')]));_0x2e2124['attributes']=_0x2e2124[_0x6778('0x31')][_0x6778('0x33')]?_0x2e2124[_0x6778('0x31')]:_0xd200fd[_0x6778('0x30')];if(_0x1cf3b9[_0x6778('0x2e')][_0x6778('0x3c')]){_0x2e2124[_0x6778('0x3d')]=[{'all':!![]}];}_0x2e2124=_[_0x6778('0x3a')]({},_0x2e2124,_0x1cf3b9['options']);return db[_0x6778('0x2a')]['find'](_0x2e2124)[_0x6778('0x23')](handleEntityNotFound(_0x55d761,null))[_0x6778('0x23')](respondWithResult(_0x55d761,null))[_0x6778('0x43')](handleError(_0x55d761,null));};exports[_0x6778('0x44')]=function(_0x8cb0d3,_0xa65996){return db[_0x6778('0x2a')][_0x6778('0x44')](_0x8cb0d3[_0x6778('0x45')],{})['then'](function(_0x26af06){var _0x30f2e0=_0x8cb0d3[_0x6778('0x46')]['get']({'plain':!![]});if(!_0x30f2e0)throw new Error(_0x6778('0x47'));if(_0x30f2e0[_0x6778('0x48')]===_0x6778('0x46')){var _0x164a54=_0x26af06['get']({'plain':!![]});var _0x8ebd08=_0x6778('0x49');return db[_0x6778('0x4a')][_0x6778('0x4b')]({'where':{'name':_0x8ebd08,'userProfileId':_0x30f2e0[_0x6778('0x4c')]},'raw':!![]})[_0x6778('0x23')](function(_0xe852ac){if(_0xe852ac&&_0xe852ac['autoAssociation']===0x0){return db[_0x6778('0x26')]['create']({'name':_0x164a54[_0x6778('0x27')],'resourceId':_0x164a54['id'],'type':_0xe852ac[_0x6778('0x27')],'sectionId':_0xe852ac['id']},{})['then'](function(){return _0x26af06;});}else{return _0x26af06;}})[_0x6778('0x43')](function(_0x350e0b){logger[_0x6778('0x4d')](_0x6778('0x4e'),_0x350e0b);throw _0x350e0b;});}return _0x26af06;})[_0x6778('0x23')](respondWithResult(_0xa65996,0xc9))[_0x6778('0x43')](handleError(_0xa65996,null));};exports['update']=function(_0x471aaf,_0x38d8ec){if(_0x471aaf[_0x6778('0x45')]['id']){delete _0x471aaf['body']['id'];}return db[_0x6778('0x2a')]['find']({'where':{'id':_0x471aaf['params']['id']}})[_0x6778('0x23')](handleEntityNotFound(_0x38d8ec,null))[_0x6778('0x23')](saveUpdates(_0x471aaf['body'],null))[_0x6778('0x23')](respondWithResult(_0x38d8ec,null))['catch'](handleError(_0x38d8ec,null));};exports['destroy']=function(_0x348628,_0x19eccf){return db[_0x6778('0x2a')][_0x6778('0x4b')]({'where':{'id':_0x348628[_0x6778('0x41')]['id']}})[_0x6778('0x23')](handleEntityNotFound(_0x19eccf,null))[_0x6778('0x23')](removeEntity(_0x19eccf,null))[_0x6778('0x43')](handleError(_0x19eccf,null));};exports[_0x6778('0x4f')]=function(_0x4abcff,_0x1dda9f,_0x15ff3c){if(_0x4abcff[_0x6778('0x45')]['id']){delete _0x4abcff[_0x6778('0x45')]['id'];}return db[_0x6778('0x2a')]['find']({'where':{'id':_0x4abcff['params']['id']}})[_0x6778('0x23')](handleEntityNotFound(_0x1dda9f,null))[_0x6778('0x23')](function(_0x14fcf2){if(_0x14fcf2){_0x4abcff[_0x6778('0x45')][_0x6778('0x50')]=_0x14fcf2['id'];return db[_0x6778('0x2a')][_0x6778('0x44')](_0x4abcff[_0x6778('0x45')]);}})[_0x6778('0x23')](respondWithResult(_0x1dda9f,null))[_0x6778('0x43')](handleError(_0x1dda9f,null));};exports[_0x6778('0x51')]=function(_0x27d547,_0x33413e,_0x58a376){var _0x4be69a={};var _0x1f2720={};var _0x2256c7;var _0xf42e24;return db[_0x6778('0x2a')][_0x6778('0x52')]({'where':{'id':_0x27d547[_0x6778('0x41')]['id']}})[_0x6778('0x23')](handleEntityNotFound(_0x33413e,null))['then'](function(_0x2dfb86){if(_0x2dfb86){_0x2256c7=_0x2dfb86;_0x1f2720[_0x6778('0x30')]=_[_0x6778('0x42')](db[_0x6778('0x2a')][_0x6778('0x2b')]);_0x1f2720[_0x6778('0x2e')]=_[_0x6778('0x42')](_0x27d547[_0x6778('0x2e')]);_0x1f2720['filters']=_[_0x6778('0x2f')](_0x1f2720['model'],_0x1f2720[_0x6778('0x2e')]);_0x4be69a[_0x6778('0x31')]=_[_0x6778('0x2f')](_0x1f2720[_0x6778('0x30')],qs[_0x6778('0x32')](_0x27d547[_0x6778('0x2e')][_0x6778('0x32')]));_0x4be69a['attributes']=_0x4be69a[_0x6778('0x31')][_0x6778('0x33')]?_0x4be69a[_0x6778('0x31')]:_0x1f2720[_0x6778('0x30')];_0x4be69a[_0x6778('0x35')]=qs[_0x6778('0x36')](_0x27d547[_0x6778('0x2e')]['sort']);_0x4be69a['where']=qs[_0x6778('0x38')](_[_0x6778('0x53')](_0x27d547[_0x6778('0x2e')],_0x1f2720[_0x6778('0x38')]));if(_0x27d547[_0x6778('0x2e')][_0x6778('0x39')]){_0x4be69a[_0x6778('0x37')]=_[_0x6778('0x3a')](_0x4be69a['where'],{'$or':_['map'](_0x4be69a[_0x6778('0x31')],function(_0x5f38f2){var _0x32659d={};_0x32659d[_0x5f38f2]={'$like':'%'+_0x27d547[_0x6778('0x2e')][_0x6778('0x39')]+'%'};return _0x32659d;})});}_0x4be69a=_[_0x6778('0x3a')]({},_0x4be69a,_0x27d547[_0x6778('0x3b')]);return _0x2256c7[_0x6778('0x51')](_0x4be69a);}})[_0x6778('0x23')](function(_0x1521a1){if(_0x1521a1){_0xf42e24=_0x1521a1[_0x6778('0x33')];if(!_0x27d547[_0x6778('0x2e')][_0x6778('0x54')](_0x6778('0x34'))){_0x4be69a['limit']=qs['limit'](_0x27d547[_0x6778('0x2e')]['limit']);_0x4be69a[_0x6778('0x1a')]=qs[_0x6778('0x1a')](_0x27d547[_0x6778('0x2e')][_0x6778('0x1a')]);}return _0x2256c7[_0x6778('0x51')](_0x4be69a);}})['then'](function(_0x5635c9){if(_0x5635c9){return _0x5635c9?{'count':_0xf42e24,'rows':_0x5635c9}:null;}})['then'](respondWithResult(_0x33413e,null))[_0x6778('0x43')](handleError(_0x33413e,null));};exports[_0x6778('0x55')]=function(_0x4fe4c6,_0x5eea6e,_0x56a603){return db[_0x6778('0x2a')][_0x6778('0x52')]({'where':{'id':_0x4fe4c6['params']['id']}})[_0x6778('0x23')](handleEntityNotFound(_0x5eea6e,null))[_0x6778('0x23')](function(_0x29d3a3){if(_0x29d3a3){return db[_0x6778('0x56')][_0x6778('0x57')](function(_0x142fe9){return db['Interval'][_0x6778('0x24')]({'where':{'IntervalId':_0x4fe4c6[_0x6778('0x41')]['id']},'transaction':_0x142fe9})[_0x6778('0x23')](function(_0x4e343b){var _0x3aacd8=_['map'](_0x4fe4c6[_0x6778('0x45')],function(_0x1ed859){delete _0x1ed859['id'];_0x1ed859[_0x6778('0x50')]=_0x4fe4c6['params']['id'];return _0x1ed859;});return db[_0x6778('0x2a')][_0x6778('0x58')](_0x3aacd8,{'transaction':_0x142fe9});});})[_0x6778('0x23')](function(){return db[_0x6778('0x2a')][_0x6778('0x3e')]({'where':{'IntervalId':_0x4fe4c6[_0x6778('0x41')]['id']}});});}})[_0x6778('0x23')](respondWithResult(_0x5eea6e,null))[_0x6778('0x43')](handleError(_0x5eea6e,null));}; \ No newline at end of file +var _0xe8fa=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','get','Intervals','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','Interval','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','sequelize','bulkCreate','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x4dd8e3,_0x297015){var _0x53c676=function(_0x323522){while(--_0x323522){_0x4dd8e3['push'](_0x4dd8e3['shift']());}};_0x53c676(++_0x297015);}(_0xe8fa,0x164));var _0xae8f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe8fa[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae8f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae8f('0x1'));var rp=require(_0xae8f('0x2'));var moment=require(_0xae8f('0x3'));var BPromise=require(_0xae8f('0x4'));var Mustache=require(_0xae8f('0x5'));var util=require(_0xae8f('0x6'));var path=require(_0xae8f('0x7'));var sox=require(_0xae8f('0x8'));var csv=require(_0xae8f('0x9'));var ejs=require(_0xae8f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae8f('0xb'));var squel=require(_0xae8f('0xc'));var crypto=require(_0xae8f('0xd'));var jsforce=require(_0xae8f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae8f('0xf'));var Redis=require(_0xae8f('0x10'));var authService=require(_0xae8f('0x11'));var qs=require(_0xae8f('0x12'));var as=require(_0xae8f('0x13'));var hardwareService=require(_0xae8f('0x14'));var logger=require('../../config/logger')(_0xae8f('0x15'));var utils=require('../../config/utils');var config=require(_0xae8f('0x16'));var licenseUtil=require(_0xae8f('0x17'));var db=require(_0xae8f('0x18'))['db'];var extensions=require(_0xae8f('0x19'));function respondWithStatusCode(_0x1541d1,_0x3df548){_0x3df548=_0x3df548||0xcc;return function(_0x53d469){if(_0x53d469){return _0x1541d1[_0xae8f('0x1a')](_0x3df548);}return _0x1541d1[_0xae8f('0x1b')](_0x3df548)[_0xae8f('0x1c')]();};}function respondWithResult(_0x59157c,_0x4f252c){_0x4f252c=_0x4f252c||0xc8;return function(_0xe332af){if(_0xe332af){return _0x59157c['status'](_0x4f252c)['json'](_0xe332af);}};}function respondWithFilteredResult(_0x659872,_0x2a6305){return function(_0x4a6504){if(_0x4a6504){var _0x258d80=typeof _0x2a6305[_0xae8f('0x1d')]===_0xae8f('0x1e')&&typeof _0x2a6305[_0xae8f('0x1f')]==='undefined';var _0x40ccd7=_0x4a6504['count'];var _0x24325d=_0x258d80?0x0:_0x2a6305[_0xae8f('0x1d')];var _0x17fcd4=_0x258d80?_0x4a6504[_0xae8f('0x20')]:_0x2a6305[_0xae8f('0x1d')]+_0x2a6305['limit'];var _0x4011c9;if(_0x17fcd4>=_0x40ccd7){_0x17fcd4=_0x40ccd7;_0x4011c9=0xc8;}else{_0x4011c9=0xce;}_0x659872[_0xae8f('0x1b')](_0x4011c9);return _0x659872['set'](_0xae8f('0x21'),_0x24325d+'-'+_0x17fcd4+'/'+_0x40ccd7)[_0xae8f('0x22')](_0x4a6504);}return null;};}function patchUpdates(_0x326d05){return function(_0x621b99){try{jsonpatch[_0xae8f('0x23')](_0x621b99,_0x326d05,!![]);}catch(_0x160cfb){return BPromise[_0xae8f('0x24')](_0x160cfb);}return _0x621b99['save']();};}function saveUpdates(_0x50707d,_0x2acf6b){return function(_0x817427){if(_0x817427){return _0x817427[_0xae8f('0x25')](_0x50707d)[_0xae8f('0x26')](function(_0x530e3a){return _0x530e3a;});}return null;};}function removeEntity(_0x54b4de,_0x41f40c){return function(_0x4f6142){if(_0x4f6142){return _0x4f6142[_0xae8f('0x27')]()[_0xae8f('0x26')](function(){var _0x378c92=_0x4f6142[_0xae8f('0x28')]({'plain':!![]});var _0xc95efb=_0xae8f('0x29');return db['UserProfileResource'][_0xae8f('0x27')]({'where':{'type':_0xc95efb,'resourceId':_0x378c92['id']}})[_0xae8f('0x26')](function(){return _0x4f6142;});})[_0xae8f('0x26')](function(){_0x54b4de[_0xae8f('0x1b')](0xcc)[_0xae8f('0x1c')]();});}};}function handleEntityNotFound(_0x4f0847,_0xd0882a){return function(_0x3c4223){if(!_0x3c4223){_0x4f0847[_0xae8f('0x1a')](0x194);}return _0x3c4223;};}function handleError(_0x112d89,_0xe35258){_0xe35258=_0xe35258||0x1f4;return function(_0x44a79e){logger[_0xae8f('0x2a')](_0x44a79e[_0xae8f('0x2b')]);if(_0x44a79e[_0xae8f('0x2c')]){delete _0x44a79e[_0xae8f('0x2c')];}_0x112d89['status'](_0xe35258)[_0xae8f('0x2d')](_0x44a79e);};}exports[_0xae8f('0x2e')]=function(_0x14fe9b,_0x3de475){var _0x31f742={},_0x5648f6={},_0x36adc1={'count':0x0,'rows':[]};var _0x465b5b=_[_0xae8f('0x2f')](db['Interval'][_0xae8f('0x30')],function(_0x5e1001){return{'name':_0x5e1001['fieldName'],'type':_0x5e1001[_0xae8f('0x31')]['key']};});_0x5648f6['model']=_['map'](_0x465b5b,_0xae8f('0x2c'));_0x5648f6[_0xae8f('0x32')]=_[_0xae8f('0x33')](_0x14fe9b[_0xae8f('0x32')]);_0x5648f6[_0xae8f('0x34')]=_[_0xae8f('0x35')](_0x5648f6[_0xae8f('0x36')],_0x5648f6[_0xae8f('0x32')]);_0x31f742[_0xae8f('0x37')]=_[_0xae8f('0x35')](_0x5648f6[_0xae8f('0x36')],qs[_0xae8f('0x38')](_0x14fe9b[_0xae8f('0x32')][_0xae8f('0x38')]));_0x31f742['attributes']=_0x31f742[_0xae8f('0x37')][_0xae8f('0x39')]?_0x31f742[_0xae8f('0x37')]:_0x5648f6[_0xae8f('0x36')];if(!_0x14fe9b[_0xae8f('0x32')][_0xae8f('0x3a')]('nolimit')){_0x31f742[_0xae8f('0x1f')]=qs[_0xae8f('0x1f')](_0x14fe9b['query'][_0xae8f('0x1f')]);_0x31f742['offset']=qs[_0xae8f('0x1d')](_0x14fe9b['query'][_0xae8f('0x1d')]);}_0x31f742[_0xae8f('0x3b')]=qs[_0xae8f('0x3c')](_0x14fe9b[_0xae8f('0x32')][_0xae8f('0x3c')]);_0x31f742[_0xae8f('0x3d')]=qs[_0xae8f('0x34')](_['pick'](_0x14fe9b[_0xae8f('0x32')],_0x5648f6[_0xae8f('0x34')]),_0x465b5b);if(_0x14fe9b['query']['filter']){_0x31f742[_0xae8f('0x3d')]=_['merge'](_0x31f742['where'],{'$or':_[_0xae8f('0x2f')](_0x465b5b,function(_0x8d5651){if(_0x8d5651[_0xae8f('0x31')]!==_0xae8f('0x3e')){var _0x35b082={};_0x35b082[_0x8d5651[_0xae8f('0x2c')]]={'$like':'%'+_0x14fe9b['query'][_0xae8f('0x3f')]+'%'};return _0x35b082;}})});}_0x31f742=_[_0xae8f('0x40')]({},_0x31f742,_0x14fe9b[_0xae8f('0x41')]);var _0x100676={'where':_0x31f742['where']};return db[_0xae8f('0x42')][_0xae8f('0x20')](_0x100676)[_0xae8f('0x26')](function(_0xe5762){_0x36adc1[_0xae8f('0x20')]=_0xe5762;if(_0x14fe9b['query'][_0xae8f('0x43')]){_0x31f742[_0xae8f('0x44')]=[{'all':!![]}];}return db[_0xae8f('0x42')][_0xae8f('0x45')](_0x31f742);})[_0xae8f('0x26')](function(_0x52dd3e){_0x36adc1[_0xae8f('0x46')]=_0x52dd3e;return _0x36adc1;})[_0xae8f('0x26')](respondWithFilteredResult(_0x3de475,_0x31f742))[_0xae8f('0x47')](handleError(_0x3de475,null));};exports[_0xae8f('0x48')]=function(_0x25164e,_0xcb7d25){var _0x4633b0={'raw':!![],'where':{'id':_0x25164e[_0xae8f('0x49')]['id']}},_0x387341={};_0x387341[_0xae8f('0x36')]=_[_0xae8f('0x33')](db['Interval'][_0xae8f('0x30')]);_0x387341[_0xae8f('0x32')]=_[_0xae8f('0x33')](_0x25164e[_0xae8f('0x32')]);_0x387341['filters']=_[_0xae8f('0x35')](_0x387341[_0xae8f('0x36')],_0x387341['query']);_0x4633b0[_0xae8f('0x37')]=_[_0xae8f('0x35')](_0x387341[_0xae8f('0x36')],qs[_0xae8f('0x38')](_0x25164e[_0xae8f('0x32')][_0xae8f('0x38')]));_0x4633b0[_0xae8f('0x37')]=_0x4633b0[_0xae8f('0x37')][_0xae8f('0x39')]?_0x4633b0[_0xae8f('0x37')]:_0x387341[_0xae8f('0x36')];if(_0x25164e[_0xae8f('0x32')][_0xae8f('0x43')]){_0x4633b0['include']=[{'all':!![]}];}_0x4633b0=_[_0xae8f('0x40')]({},_0x4633b0,_0x25164e[_0xae8f('0x41')]);return db[_0xae8f('0x42')]['find'](_0x4633b0)[_0xae8f('0x26')](handleEntityNotFound(_0xcb7d25,null))[_0xae8f('0x26')](respondWithResult(_0xcb7d25,null))[_0xae8f('0x47')](handleError(_0xcb7d25,null));};exports[_0xae8f('0x4a')]=function(_0x941b08,_0x1c320b){return db[_0xae8f('0x42')][_0xae8f('0x4a')](_0x941b08[_0xae8f('0x4b')],{})[_0xae8f('0x26')](function(_0x536ac0){var _0x4f2856=_0x941b08[_0xae8f('0x4c')][_0xae8f('0x28')]({'plain':!![]});if(!_0x4f2856)throw new Error(_0xae8f('0x4d'));if(_0x4f2856[_0xae8f('0x4e')]===_0xae8f('0x4c')){var _0xc90bb7=_0x536ac0[_0xae8f('0x28')]({'plain':!![]});var _0x509751='Intervals';return db[_0xae8f('0x4f')][_0xae8f('0x50')]({'where':{'name':_0x509751,'userProfileId':_0x4f2856['userProfileId']},'raw':!![]})['then'](function(_0x4e78d1){if(_0x4e78d1&&_0x4e78d1[_0xae8f('0x51')]===0x0){return db[_0xae8f('0x52')][_0xae8f('0x4a')]({'name':_0xc90bb7[_0xae8f('0x2c')],'resourceId':_0xc90bb7['id'],'type':_0x4e78d1['name'],'sectionId':_0x4e78d1['id']},{})[_0xae8f('0x26')](function(){return _0x536ac0;});}else{return _0x536ac0;}})[_0xae8f('0x47')](function(_0x2d81b4){logger[_0xae8f('0x2a')](_0xae8f('0x53'),_0x2d81b4);throw _0x2d81b4;});}return _0x536ac0;})[_0xae8f('0x26')](respondWithResult(_0x1c320b,0xc9))['catch'](handleError(_0x1c320b,null));};exports[_0xae8f('0x25')]=function(_0x38b61e,_0x135d9a){if(_0x38b61e[_0xae8f('0x4b')]['id']){delete _0x38b61e[_0xae8f('0x4b')]['id'];}return db[_0xae8f('0x42')]['find']({'where':{'id':_0x38b61e[_0xae8f('0x49')]['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x135d9a,null))['then'](saveUpdates(_0x38b61e['body'],null))[_0xae8f('0x26')](respondWithResult(_0x135d9a,null))[_0xae8f('0x47')](handleError(_0x135d9a,null));};exports[_0xae8f('0x27')]=function(_0x4dd088,_0x48c82e){return db['Interval']['find']({'where':{'id':_0x4dd088[_0xae8f('0x49')]['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x48c82e,null))[_0xae8f('0x26')](removeEntity(_0x48c82e,null))[_0xae8f('0x47')](handleError(_0x48c82e,null));};exports[_0xae8f('0x54')]=function(_0x4a2a07,_0x497844,_0x4f37ad){if(_0x4a2a07[_0xae8f('0x4b')]['id']){delete _0x4a2a07['body']['id'];}return db[_0xae8f('0x42')]['find']({'where':{'id':_0x4a2a07['params']['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x497844,null))[_0xae8f('0x26')](function(_0x8da9a4){if(_0x8da9a4){_0x4a2a07[_0xae8f('0x4b')][_0xae8f('0x55')]=_0x8da9a4['id'];return db['Interval']['create'](_0x4a2a07['body']);}})[_0xae8f('0x26')](respondWithResult(_0x497844,null))[_0xae8f('0x47')](handleError(_0x497844,null));};exports[_0xae8f('0x56')]=function(_0x3b3366,_0x1d276a,_0x37f2a2){var _0x3cc37d={};var _0x81f2bc={};var _0x4fcfb6;var _0x13f694;return db['Interval'][_0xae8f('0x57')]({'where':{'id':_0x3b3366['params']['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x1d276a,null))[_0xae8f('0x26')](function(_0x579ed7){if(_0x579ed7){_0x4fcfb6=_0x579ed7;_0x81f2bc[_0xae8f('0x36')]=_['keys'](db['Interval'][_0xae8f('0x30')]);_0x81f2bc[_0xae8f('0x32')]=_['keys'](_0x3b3366[_0xae8f('0x32')]);_0x81f2bc[_0xae8f('0x34')]=_[_0xae8f('0x35')](_0x81f2bc['model'],_0x81f2bc[_0xae8f('0x32')]);_0x3cc37d[_0xae8f('0x37')]=_[_0xae8f('0x35')](_0x81f2bc[_0xae8f('0x36')],qs[_0xae8f('0x38')](_0x3b3366[_0xae8f('0x32')][_0xae8f('0x38')]));_0x3cc37d[_0xae8f('0x37')]=_0x3cc37d[_0xae8f('0x37')]['length']?_0x3cc37d[_0xae8f('0x37')]:_0x81f2bc[_0xae8f('0x36')];_0x3cc37d[_0xae8f('0x3b')]=qs[_0xae8f('0x3c')](_0x3b3366['query'][_0xae8f('0x3c')]);_0x3cc37d[_0xae8f('0x3d')]=qs[_0xae8f('0x34')](_[_0xae8f('0x58')](_0x3b3366[_0xae8f('0x32')],_0x81f2bc[_0xae8f('0x34')]));if(_0x3b3366[_0xae8f('0x32')][_0xae8f('0x3f')]){_0x3cc37d['where']=_[_0xae8f('0x40')](_0x3cc37d[_0xae8f('0x3d')],{'$or':_[_0xae8f('0x2f')](_0x3cc37d[_0xae8f('0x37')],function(_0x185ab2){var _0x3cfac3={};_0x3cfac3[_0x185ab2]={'$like':'%'+_0x3b3366[_0xae8f('0x32')]['filter']+'%'};return _0x3cfac3;})});}_0x3cc37d=_[_0xae8f('0x40')]({},_0x3cc37d,_0x3b3366[_0xae8f('0x41')]);return _0x4fcfb6[_0xae8f('0x56')](_0x3cc37d);}})['then'](function(_0x3b54e4){if(_0x3b54e4){_0x13f694=_0x3b54e4[_0xae8f('0x39')];if(!_0x3b3366[_0xae8f('0x32')]['hasOwnProperty'](_0xae8f('0x59'))){_0x3cc37d['limit']=qs[_0xae8f('0x1f')](_0x3b3366[_0xae8f('0x32')][_0xae8f('0x1f')]);_0x3cc37d[_0xae8f('0x1d')]=qs[_0xae8f('0x1d')](_0x3b3366[_0xae8f('0x32')]['offset']);}return _0x4fcfb6[_0xae8f('0x56')](_0x3cc37d);}})[_0xae8f('0x26')](function(_0x4feed7){if(_0x4feed7){return _0x4feed7?{'count':_0x13f694,'rows':_0x4feed7}:null;}})[_0xae8f('0x26')](respondWithResult(_0x1d276a,null))['catch'](handleError(_0x1d276a,null));};exports['addIntervals']=function(_0x1cc8a4,_0x2d59d7,_0x23a8d5){return db['Interval'][_0xae8f('0x57')]({'where':{'id':_0x1cc8a4[_0xae8f('0x49')]['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x2d59d7,null))['then'](function(_0x231e3c){if(_0x231e3c){return db[_0xae8f('0x5a')]['transaction'](function(_0x1e7abd){return db[_0xae8f('0x42')][_0xae8f('0x27')]({'where':{'IntervalId':_0x1cc8a4[_0xae8f('0x49')]['id']},'transaction':_0x1e7abd})[_0xae8f('0x26')](function(_0x275636){var _0x11bcb1=_[_0xae8f('0x2f')](_0x1cc8a4[_0xae8f('0x4b')],function(_0x163692){delete _0x163692['id'];_0x163692[_0xae8f('0x55')]=_0x1cc8a4[_0xae8f('0x49')]['id'];return _0x163692;});return db[_0xae8f('0x42')][_0xae8f('0x5b')](_0x11bcb1,{'transaction':_0x1e7abd});});})[_0xae8f('0x26')](function(){return db[_0xae8f('0x42')][_0xae8f('0x45')]({'where':{'IntervalId':_0x1cc8a4['params']['id']}});});}})[_0xae8f('0x26')](respondWithResult(_0x2d59d7,null))[_0xae8f('0x47')](handleError(_0x2d59d7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 24adf14..b4c7758 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 _0x4c04=['ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','string','getIntervals','then','all','map'];(function(_0x5e78b4,_0x4c0bbd){var _0x576555=function(_0x1fe5b3){while(--_0x1fe5b3){_0x5e78b4['push'](_0x5e78b4['shift']());}};_0x576555(++_0x4c0bbd);}(_0x4c04,0x1a2));var _0x44c0=function(_0xbf6cec,_0x406e75){_0xbf6cec=_0xbf6cec-0x0;var _0x24d8ef=_0x4c04[_0xbf6cec];return _0x24d8ef;};'use strict';var attributes=require(_0x44c0('0x0'));var extensions=require(_0x44c0('0x1'));var iftime=require(_0x44c0('0x2'))[_0x44c0('0x3')];module[_0x44c0('0x4')]=function(_0x3206a7){return _0x3206a7[_0x44c0('0x5')]('Interval',attributes,{'tableName':_0x44c0('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a677d){extensions[_0x44c0('0x7')](_0x3206a7,_0x1a677d);},'afterBulkCreate':function(_0x5b7dcf,_0x554c0d,_0x3f44d9){_0x3f44d9();extensions['rewrite'](_0x3206a7,_0x5b7dcf[0x0]);},'afterUpdate':function(_0x5d8be6){extensions[_0x44c0('0x7')](_0x3206a7,_0x5d8be6);},'afterDestroy':function(_0x401ca4){extensions['rewrite'](_0x3206a7,_0x401ca4);}},'instanceMethods':{'ifTime':function(_0x189eba=undefined,_0xf6d6e=new Date()){if(typeof this[_0x44c0('0x8')]===_0x44c0('0x9')){return iftime(this[_0x44c0('0x8')],_0x189eba,_0xf6d6e);}else{return this[_0x44c0('0xa')]()[_0x44c0('0xb')](function(_0x603801){return Promise[_0x44c0('0xc')](_0x603801[_0x44c0('0xd')](function(_0x304ca5){return _0x304ca5[_0x44c0('0xe')](_0x189eba,_0xf6d6e);}));})['then'](function(_0x505d39){return _0x505d39[_0x44c0('0xf')](function(_0x3db017,_0x351b45){return _0x3db017||_0x351b45;},![]);});}}}});}; \ No newline at end of file +var _0x2352=['map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','string','interval','then','all'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x2352,0x9d));var _0x2235=function(_0x28c275,_0x345caa){_0x28c275=_0x28c275-0x0;var _0x232969=_0x2352[_0x28c275];return _0x232969;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x2235('0x0'));var iftime=require(_0x2235('0x1'))[_0x2235('0x2')];module[_0x2235('0x3')]=function(_0x3abdeb){return _0x3abdeb[_0x2235('0x4')]('Interval',attributes,{'tableName':_0x2235('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1af656){extensions[_0x2235('0x6')](_0x3abdeb,_0x1af656);},'afterBulkCreate':function(_0x4b426e,_0x14a467,_0x45267c){_0x45267c();extensions[_0x2235('0x6')](_0x3abdeb,_0x4b426e[0x0]);},'afterUpdate':function(_0x197296){extensions[_0x2235('0x6')](_0x3abdeb,_0x197296);},'afterDestroy':function(_0x49339d){extensions[_0x2235('0x6')](_0x3abdeb,_0x49339d);}},'instanceMethods':{'ifTime':function(_0x5b0ebb=undefined,_0x198b8f=new Date()){if(typeof this['interval']===_0x2235('0x7')){return iftime(this[_0x2235('0x8')],_0x5b0ebb,_0x198b8f);}else{return this['getIntervals']()[_0x2235('0x9')](function(_0x1cfc42){return Promise[_0x2235('0xa')](_0x1cfc42[_0x2235('0xb')](function(_0x16d4ec){return _0x16d4ec[_0x2235('0xc')](_0x5b0ebb,_0x198b8f);}));})['then'](function(_0x1d6bb1){return _0x1d6bb1[_0x2235('0xd')](function(_0x194803,_0x839df4){return _0x194803||_0x839df4;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ae08a0c..67244c2 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 _0xe658=['Interval','find','where','info','all','ifTime','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','reduce','lodash','util','../../mysqldb','iftime','rpc','options','raw','attributes','limit','include','map','model','then','GetInterval','debug','stringify','catch','error','message','ShowInterval'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe658,0xe8));var _0x8e65=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe658[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x8e65('0x0'));var util=require(_0x8e65('0x1'));var db=require(_0x8e65('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x8e65('0x3')];var logger=require('../../config/logger')(_0x8e65('0x4'));exports['GetInterval']=function(_0x341b8b){var _0x218412=this;return new Promise(function(_0x3b5c5b,_0x1e83f2){return db['Interval']['findAll']({'raw':_0x341b8b[_0x8e65('0x5')]?_0x341b8b[_0x8e65('0x5')][_0x8e65('0x6')]===undefined?!![]:![]:!![],'where':_0x341b8b[_0x8e65('0x5')]?_0x341b8b[_0x8e65('0x5')]['where']||null:null,'attributes':_0x341b8b[_0x8e65('0x5')]?_0x341b8b[_0x8e65('0x5')][_0x8e65('0x7')]||null:null,'limit':_0x341b8b[_0x8e65('0x5')]?_0x341b8b['options'][_0x8e65('0x8')]||null:null,'include':_0x341b8b['options']?_0x341b8b[_0x8e65('0x5')][_0x8e65('0x9')]?_[_0x8e65('0xa')](_0x341b8b[_0x8e65('0x5')][_0x8e65('0x9')],function(_0x167dc4){return{'model':db[_0x167dc4[_0x8e65('0xb')]],'as':_0x167dc4['as'],'attributes':_0x167dc4[_0x8e65('0x7')],'include':_0x167dc4[_0x8e65('0x9')]?_[_0x8e65('0xa')](_0x167dc4[_0x8e65('0x9')],function(_0x15c5fb){return{'model':db[_0x15c5fb[_0x8e65('0xb')]],'as':_0x15c5fb['as'],'attributes':_0x15c5fb[_0x8e65('0x7')],'include':_0x15c5fb[_0x8e65('0x9')]?_[_0x8e65('0xa')](_0x15c5fb[_0x8e65('0x9')],function(_0x57d6db){return{'model':db[_0x57d6db['model']],'as':_0x57d6db['as'],'attributes':_0x57d6db[_0x8e65('0x7')]};}):[]};}):[]};}):[]:[]})[_0x8e65('0xc')](function(_0x20887e){logger['info'](_0x8e65('0xd'),_0x341b8b);logger[_0x8e65('0xe')](_0x8e65('0xd'),_0x341b8b,JSON[_0x8e65('0xf')](_0x20887e));_0x3b5c5b(_0x20887e);})[_0x8e65('0x10')](function(_0x14c678){logger[_0x8e65('0x11')](_0x8e65('0xd'),_0x14c678[_0x8e65('0x12')],_0x341b8b);_0x1e83f2(_0x218412[_0x8e65('0x11')](0x1f4,_0x14c678[_0x8e65('0x12')]));});});};exports[_0x8e65('0x13')]=function(_0x5312d0){var _0x1ca224=this;return new Promise(function(_0x4daf4e,_0x533f86){return db[_0x8e65('0x14')][_0x8e65('0x15')]({'raw':_0x5312d0['options']?_0x5312d0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5312d0['options']?_0x5312d0[_0x8e65('0x5')][_0x8e65('0x16')]||null:null,'attributes':_0x5312d0[_0x8e65('0x5')]?_0x5312d0['options']['attributes']||null:null,'include':_0x5312d0['options']?_0x5312d0[_0x8e65('0x5')][_0x8e65('0x9')]?_['map'](_0x5312d0['options'][_0x8e65('0x9')],function(_0x194fa3){return{'model':db[_0x194fa3[_0x8e65('0xb')]],'as':_0x194fa3['as'],'attributes':_0x194fa3['attributes'],'include':_0x194fa3[_0x8e65('0x9')]?_[_0x8e65('0xa')](_0x194fa3[_0x8e65('0x9')],function(_0x16dab8){return{'model':db[_0x16dab8[_0x8e65('0xb')]],'as':_0x16dab8['as'],'attributes':_0x16dab8[_0x8e65('0x7')],'include':_0x16dab8[_0x8e65('0x9')]?_[_0x8e65('0xa')](_0x16dab8['include'],function(_0x17b382){return{'model':db[_0x17b382[_0x8e65('0xb')]],'as':_0x17b382['as'],'attributes':_0x17b382[_0x8e65('0x7')]};}):[]};}):[]};}):[]:[]})[_0x8e65('0xc')](function(_0x303cd4){logger[_0x8e65('0x17')]('ShowInterval',_0x5312d0);logger['debug']('ShowInterval',_0x5312d0,JSON[_0x8e65('0xf')](_0x303cd4));_0x4daf4e(_0x303cd4);})[_0x8e65('0x10')](function(_0x3b52c9){logger[_0x8e65('0x11')](_0x8e65('0x13'),_0x3b52c9[_0x8e65('0x12')],_0x5312d0);_0x533f86(_0x1ca224[_0x8e65('0x11')](0x1f4,_0x3b52c9[_0x8e65('0x12')]));});});};function checkArrayOfIntervals(_0x1caa8b,_0x39f1e5){var _0x2f0eac=[];return db['Interval']['findAll']({'where':{'id':_0x1caa8b}})['then'](function(_0x24a5fd){_0x2f0eac=_0x24a5fd;return Promise[_0x8e65('0x18')](_0x2f0eac[_0x8e65('0xa')](function(_0x1619a9){return _0x1619a9[_0x8e65('0x19')](_0x39f1e5);}));})['then'](function(_0x5a644f){var _0x63f9f=_0x5a644f['reduce'](function(_0x2bc647,_0x4c5d3f){return _0x2bc647||_0x4c5d3f;},![]);logger['info'](util[_0x8e65('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2f0eac[_0x8e65('0xa')](function(_0xdc09fa){return _0xdc09fa[_0x8e65('0x1b')];})[_0x8e65('0x1c')](',\x20'),_0x2f0eac[_0x8e65('0xa')](function(_0x479ff2){return _0x479ff2['id'];})[_0x8e65('0x1c')](',\x20')));return _0x63f9f;});}function checkSingleInterval(_0x16bc4a,_0x5b5cb6){return db[_0x8e65('0x14')][_0x8e65('0x1d')](_0x16bc4a)['then'](function(_0x34a6da){if(_0x34a6da){logger[_0x8e65('0x17')](util['format'](_0x8e65('0x1e'),_0x34a6da[_0x8e65('0x1b')],_0x34a6da['id']));return _0x34a6da[_0x8e65('0x19')](_0x5b5cb6);}});}exports[_0x8e65('0x1f')]=function(_0x1e2aee){var _0x384602=_0x1e2aee[_0x8e65('0x20')];var _0x1db667=Array['isArray'](_0x1e2aee['intervals'])?_0x1e2aee[_0x8e65('0x21')]:typeof _0x1e2aee[_0x8e65('0x21')]===_0x8e65('0x22')?[_0x1e2aee[_0x8e65('0x21')]]:[];var _0x984c91=_0x1e2aee[_0x8e65('0x23')]||undefined;var _0x336ceb=![];if(_0x1db667[_0x8e65('0x24')]){logger[_0x8e65('0x17')](util[_0x8e65('0x1a')](_0x8e65('0x25'),_0x1db667['join'](';\x20')));}if(_0x984c91){logger[_0x8e65('0x17')](util['format'](_0x8e65('0x26'),_0x984c91));}logger['debug'](_0x8e65('0x27'),_0x336ceb);logger['silly']('IntervalIftime',_0x1e2aee);return Promise[_0x8e65('0x28')]()['then'](function(){if(Array['isArray'](_0x384602)){return checkArrayOfIntervals(_0x384602,_0x984c91);}else if(_0x384602){return checkSingleInterval(_0x384602,_0x984c91);}})[_0x8e65('0xc')](function(_0x4791fe){var _0x38aef2=_0x1db667[_0x8e65('0x29')](function(_0x435901,_0x2e8eae){return _0x435901||iftime(_0x2e8eae,_0x984c91);},![]);_0x336ceb=_0x4791fe||_0x38aef2;return _0x336ceb;})[_0x8e65('0x10')](function(_0x572a65){logger[_0x8e65('0x11')](_0x8e65('0x1f'),_0x1e2aee,_0x572a65);throw this[_0x8e65('0x11')](0x1f4,_0x572a65[_0x8e65('0x12')]);});}; \ No newline at end of file +var _0x3e53=['GetInterval','debug','stringify','catch','error','message','ShowInterval','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','util','../../mysqldb','iftime','../../config/logger','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3e53,0xbd));var _0x33e5=function(_0x3d40f9,_0x514554){_0x3d40f9=_0x3d40f9-0x0;var _0x4108da=_0x3e53[_0x3d40f9];return _0x4108da;};'use strict';var _=require('lodash');var util=require(_0x33e5('0x0'));var db=require(_0x33e5('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x33e5('0x2')];var logger=require(_0x33e5('0x3'))('rpc');exports['GetInterval']=function(_0x18026c){var _0x5030ef=this;return new Promise(function(_0xeaf6b4,_0x3db67b){return db[_0x33e5('0x4')][_0x33e5('0x5')]({'raw':_0x18026c[_0x33e5('0x6')]?_0x18026c[_0x33e5('0x6')][_0x33e5('0x7')]===undefined?!![]:![]:!![],'where':_0x18026c[_0x33e5('0x6')]?_0x18026c['options'][_0x33e5('0x8')]||null:null,'attributes':_0x18026c[_0x33e5('0x6')]?_0x18026c[_0x33e5('0x6')][_0x33e5('0x9')]||null:null,'limit':_0x18026c['options']?_0x18026c[_0x33e5('0x6')][_0x33e5('0xa')]||null:null,'include':_0x18026c[_0x33e5('0x6')]?_0x18026c[_0x33e5('0x6')][_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x18026c[_0x33e5('0x6')][_0x33e5('0xb')],function(_0x3bcced){return{'model':db[_0x3bcced[_0x33e5('0xd')]],'as':_0x3bcced['as'],'attributes':_0x3bcced[_0x33e5('0x9')],'include':_0x3bcced[_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x3bcced[_0x33e5('0xb')],function(_0x46036a){return{'model':db[_0x46036a['model']],'as':_0x46036a['as'],'attributes':_0x46036a['attributes'],'include':_0x46036a[_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x46036a['include'],function(_0x16fd0c){return{'model':db[_0x16fd0c[_0x33e5('0xd')]],'as':_0x16fd0c['as'],'attributes':_0x16fd0c[_0x33e5('0x9')]};}):[]};}):[]};}):[]:[]})[_0x33e5('0xe')](function(_0x288fb0){logger[_0x33e5('0xf')](_0x33e5('0x10'),_0x18026c);logger[_0x33e5('0x11')](_0x33e5('0x10'),_0x18026c,JSON[_0x33e5('0x12')](_0x288fb0));_0xeaf6b4(_0x288fb0);})[_0x33e5('0x13')](function(_0x176651){logger[_0x33e5('0x14')](_0x33e5('0x10'),_0x176651[_0x33e5('0x15')],_0x18026c);_0x3db67b(_0x5030ef[_0x33e5('0x14')](0x1f4,_0x176651[_0x33e5('0x15')]));});});};exports[_0x33e5('0x16')]=function(_0x34e732){var _0x9d1573=this;return new Promise(function(_0x3baafc,_0x14ebe2){return db[_0x33e5('0x4')]['find']({'raw':_0x34e732['options']?_0x34e732[_0x33e5('0x6')][_0x33e5('0x7')]===undefined?!![]:![]:!![],'where':_0x34e732['options']?_0x34e732[_0x33e5('0x6')][_0x33e5('0x8')]||null:null,'attributes':_0x34e732[_0x33e5('0x6')]?_0x34e732[_0x33e5('0x6')][_0x33e5('0x9')]||null:null,'include':_0x34e732[_0x33e5('0x6')]?_0x34e732[_0x33e5('0x6')][_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x34e732[_0x33e5('0x6')][_0x33e5('0xb')],function(_0xc6449e){return{'model':db[_0xc6449e[_0x33e5('0xd')]],'as':_0xc6449e['as'],'attributes':_0xc6449e[_0x33e5('0x9')],'include':_0xc6449e[_0x33e5('0xb')]?_[_0x33e5('0xc')](_0xc6449e[_0x33e5('0xb')],function(_0x4fe974){return{'model':db[_0x4fe974['model']],'as':_0x4fe974['as'],'attributes':_0x4fe974['attributes'],'include':_0x4fe974['include']?_[_0x33e5('0xc')](_0x4fe974[_0x33e5('0xb')],function(_0x1bfbed){return{'model':db[_0x1bfbed[_0x33e5('0xd')]],'as':_0x1bfbed['as'],'attributes':_0x1bfbed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b4a15){logger['info'](_0x33e5('0x16'),_0x34e732);logger[_0x33e5('0x11')](_0x33e5('0x16'),_0x34e732,JSON[_0x33e5('0x12')](_0x2b4a15));_0x3baafc(_0x2b4a15);})[_0x33e5('0x13')](function(_0x42f762){logger[_0x33e5('0x14')](_0x33e5('0x16'),_0x42f762[_0x33e5('0x15')],_0x34e732);_0x14ebe2(_0x9d1573[_0x33e5('0x14')](0x1f4,_0x42f762[_0x33e5('0x15')]));});});};function checkArrayOfIntervals(_0x5032d9,_0x260d73){var _0x5263cb=[];return db['Interval'][_0x33e5('0x5')]({'where':{'id':_0x5032d9}})[_0x33e5('0xe')](function(_0x7717d8){_0x5263cb=_0x7717d8;return Promise[_0x33e5('0x17')](_0x5263cb[_0x33e5('0xc')](function(_0x6f0ad2){return _0x6f0ad2[_0x33e5('0x18')](_0x260d73);}));})[_0x33e5('0xe')](function(_0x1a9912){var _0x5b7ae6=_0x1a9912[_0x33e5('0x19')](function(_0x5e81a4,_0x447442){return _0x5e81a4||_0x447442;},![]);logger[_0x33e5('0xf')](util[_0x33e5('0x1a')](_0x33e5('0x1b'),_0x5263cb[_0x33e5('0xc')](function(_0x5bbed0){return _0x5bbed0[_0x33e5('0x1c')];})['join'](',\x20'),_0x5263cb[_0x33e5('0xc')](function(_0x3d93ec){return _0x3d93ec['id'];})[_0x33e5('0x1d')](',\x20')));return _0x5b7ae6;});}function checkSingleInterval(_0x14eb92,_0x58bb50){return db['Interval'][_0x33e5('0x1e')](_0x14eb92)[_0x33e5('0xe')](function(_0x5da789){if(_0x5da789){logger[_0x33e5('0xf')](util[_0x33e5('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5da789[_0x33e5('0x1c')],_0x5da789['id']));return _0x5da789['ifTime'](_0x58bb50);}});}exports[_0x33e5('0x1f')]=function(_0x40a77c){var _0x10968f=_0x40a77c[_0x33e5('0x20')];var _0x4e847c=Array[_0x33e5('0x21')](_0x40a77c[_0x33e5('0x22')])?_0x40a77c[_0x33e5('0x22')]:typeof _0x40a77c[_0x33e5('0x22')]===_0x33e5('0x23')?[_0x40a77c[_0x33e5('0x22')]]:[];var _0x1955dc=_0x40a77c[_0x33e5('0x24')]||undefined;var _0x1eadea=![];if(_0x4e847c['length']){logger[_0x33e5('0xf')](util[_0x33e5('0x1a')](_0x33e5('0x25'),_0x4e847c[_0x33e5('0x1d')](';\x20')));}if(_0x1955dc){logger['info'](util[_0x33e5('0x1a')](_0x33e5('0x26'),_0x1955dc));}logger[_0x33e5('0x11')]('Iftime',_0x1eadea);logger[_0x33e5('0x27')](_0x33e5('0x1f'),_0x40a77c);return Promise[_0x33e5('0x28')]()[_0x33e5('0xe')](function(){if(Array[_0x33e5('0x21')](_0x10968f)){return checkArrayOfIntervals(_0x10968f,_0x1955dc);}else if(_0x10968f){return checkSingleInterval(_0x10968f,_0x1955dc);}})[_0x33e5('0xe')](function(_0x574897){var _0x2a8b64=_0x4e847c[_0x33e5('0x19')](function(_0x23c053,_0x2e28e9){return _0x23c053||iftime(_0x2e28e9,_0x1955dc);},![]);_0x1eadea=_0x574897||_0x2a8b64;return _0x1eadea;})['catch'](function(_0x26a23c){logger['error'](_0x33e5('0x1f'),_0x40a77c,_0x26a23c);throw this[_0x33e5('0x14')](0x1f4,_0x26a23c['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0a905af..cf43666 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x30cb0a,_0x5420ca){var _0x37d8ef=function(_0x53be60){while(--_0x53be60){_0x30cb0a['push'](_0x30cb0a['shift']());}};_0x37d8ef(++_0x5420ca);}(_0x2ef3,0xba));var _0x32ef=function(_0x54d4b7,_0x18dea9){_0x54d4b7=_0x54d4b7-0x0;var _0x1feae0=_0x2ef3[_0x54d4b7];return _0x1feae0;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x464909,_0x105153){var _0x2d1746=function(_0x49f777){while(--_0x49f777){_0x464909['push'](_0x464909['shift']());}};_0x2d1746(++_0x105153);}(_0x2032,0xd9));var _0x2203=function(_0x5cb9d3,_0x4b348b){_0x5cb9d3=_0x5cb9d3-0x0;var _0x2b0a3c=_0x2032[_0x5cb9d3];return _0x2b0a3c;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4949bc9..499979b 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 _0x8120=['name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','status','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify','Bug','customfield_11500','fields','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x14fe25,_0x15d6cc){var _0x311521=function(_0x176a13){while(--_0x176a13){_0x14fe25['push'](_0x14fe25['shift']());}};_0x311521(++_0x15d6cc);}(_0x8120,0x171));var _0x0812=function(_0x3c5968,_0x8ea860){_0x3c5968=_0x3c5968-0x0;var _0x2157bc=_0x8120[_0x3c5968];return _0x2157bc;};'use strict';var BPromise=require(_0x0812('0x0'));var https=require(_0x0812('0x1'));var logger=require(_0x0812('0x2'))(_0x0812('0x3'));var USERNAME=_0x0812('0x4');var PASSWORD=_0x0812('0x5');function openIssue(_0xab7830,_0x18f1cf){var _0x2a61f4={'fields':{'project':{'key':_0xab7830[_0x0812('0x6')]||_0x0812('0x7')},'summary':(_0xab7830['summary']||_0x0812('0x8'))+'\x20from\x20'+_0xab7830['ip'],'description':_0xab7830[_0x0812('0x9')]||JSON[_0x0812('0xa')](_0xab7830),'issuetype':{'name':_0xab7830['issuetype']||_0x0812('0xb')}}};_0x2a61f4['fields'][_0x0812('0xc')]=_0xab7830['email'];_0x2a61f4[_0x0812('0xd')][_0x0812('0xe')]=_0xab7830[_0x0812('0xf')];_0x2a61f4[_0x0812('0xd')][_0x0812('0x10')]=_0xab7830[_0x0812('0x11')];_0x2a61f4[_0x0812('0xd')]['customfield_11503']=_0xab7830[_0x0812('0x12')];_0x2a61f4[_0x0812('0xd')][_0x0812('0x13')]=_0xab7830[_0x0812('0x14')];_0x2a61f4[_0x0812('0xd')][_0x0812('0x15')]=_0xab7830['ip'];var _0x5de486={'host':_0x0812('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0812('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x0812('0x18'),'Authorization':_0x0812('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x0812('0x1a')](_0x0812('0x1b'))}};var _0x32f25c=JSON[_0x0812('0xa')](_0x2a61f4);var _0x4fa2f7=https['request'](_0x5de486,function(_0x59114f){_0x59114f[_0x0812('0x1c')](_0x0812('0x1d'));var _0x2d00b7='';_0x59114f['on']('data',function(_0x1d01b9){_0x2d00b7+=_0x1d01b9;});_0x59114f['on']('end',function(){if(_0x18f1cf){return _0x18f1cf[_0x0812('0x1e')](_0x59114f['statusCode'])['json'](JSON[_0x0812('0x1f')](_0x2d00b7));}});});_0x4fa2f7['on'](_0x0812('0x20'),function(_0xbfa7c0){if(_0x18f1cf){return _0x18f1cf[_0x0812('0x1e')](0x1f4)['json']({'errors':[{'message':_0x0812('0x21'),'type':_0x0812('0x22')}]});}});_0x4fa2f7[_0x0812('0x23')](_0x32f25c);_0x4fa2f7['end']();}exports[_0x0812('0x24')]=openIssue;exports[_0x0812('0x25')]=function(_0x15a155,_0xe95321){_0x15a155['body']['ip']=_0x15a155[_0x0812('0x26')][_0x0812('0x27')]||_0x15a155[_0x0812('0x28')]['remoteAddress']||_0x15a155['socket'][_0x0812('0x29')]||_0x15a155[_0x0812('0x28')]['socket'][_0x0812('0x29')];return openIssue(_0x15a155[_0x0812('0x2a')],_0xe95321);}; \ No newline at end of file +var _0xc780=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc780,0xd7));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x0c78('0x0'));var https=require(_0x0c78('0x1'));var logger=require(_0x0c78('0x2'))(_0x0c78('0x3'));var USERNAME=_0x0c78('0x4');var PASSWORD=_0x0c78('0x5');function openIssue(_0x4c0ae5,_0x17c18e){var _0x2189f5={'fields':{'project':{'key':_0x4c0ae5['key']||_0x0c78('0x6')},'summary':(_0x4c0ae5['summary']||_0x0c78('0x7'))+_0x0c78('0x8')+_0x4c0ae5['ip'],'description':_0x4c0ae5[_0x0c78('0x9')]||JSON[_0x0c78('0xa')](_0x4c0ae5),'issuetype':{'name':_0x4c0ae5[_0x0c78('0xb')]||'Bug'}}};_0x2189f5[_0x0c78('0xc')][_0x0c78('0xd')]=_0x4c0ae5[_0x0c78('0xe')];_0x2189f5[_0x0c78('0xc')][_0x0c78('0xf')]=_0x4c0ae5[_0x0c78('0x10')];_0x2189f5[_0x0c78('0xc')][_0x0c78('0x11')]=_0x4c0ae5['newToken'];_0x2189f5[_0x0c78('0xc')][_0x0c78('0x12')]=_0x4c0ae5['name'];_0x2189f5['fields'][_0x0c78('0x13')]=_0x4c0ae5[_0x0c78('0x14')];_0x2189f5[_0x0c78('0xc')][_0x0c78('0x15')]=_0x4c0ae5['ip'];var _0x560d9a={'host':_0x0c78('0x16'),'port':0x1bb,'path':_0x0c78('0x17'),'method':_0x0c78('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0c78('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x0c78('0x1a')](_0x0c78('0x1b'))}};var _0x2e9b03=JSON['stringify'](_0x2189f5);var _0x27646a=https[_0x0c78('0x1c')](_0x560d9a,function(_0x34afa4){_0x34afa4[_0x0c78('0x1d')](_0x0c78('0x1e'));var _0x29dd68='';_0x34afa4['on']('data',function(_0x35891a){_0x29dd68+=_0x35891a;});_0x34afa4['on'](_0x0c78('0x1f'),function(){if(_0x17c18e){return _0x17c18e[_0x0c78('0x20')](_0x34afa4[_0x0c78('0x21')])[_0x0c78('0x22')](JSON[_0x0c78('0x23')](_0x29dd68));}});});_0x27646a['on'](_0x0c78('0x24'),function(_0xe08434){if(_0x17c18e){return _0x17c18e['status'](0x1f4)[_0x0c78('0x22')]({'errors':[{'message':_0x0c78('0x25'),'type':_0x0c78('0x26')}]});}});_0x27646a[_0x0c78('0x27')](_0x2e9b03);_0x27646a[_0x0c78('0x1f')]();}exports[_0x0c78('0x28')]=openIssue;exports['send']=function(_0x368428,_0x2d045c){_0x368428[_0x0c78('0x29')]['ip']=_0x368428[_0x0c78('0x2a')][_0x0c78('0x2b')]||_0x368428[_0x0c78('0x2c')][_0x0c78('0x2d')]||_0x368428[_0x0c78('0x2e')][_0x0c78('0x2d')]||_0x368428[_0x0c78('0x2c')][_0x0c78('0x2e')][_0x0c78('0x2d')];return openIssue(_0x368428[_0x0c78('0x29')],_0x2d045c);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 35df2a3..7880761 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 _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x10843d,_0x215e2d){var _0x112b08=function(_0x201443){while(--_0x201443){_0x10843d['push'](_0x10843d['shift']());}};_0x112b08(++_0x215e2d);}(_0x1be1,0x192));var _0x11be=function(_0xd83c3a,_0x2e6db){_0xd83c3a=_0xd83c3a-0x0;var _0x536216=_0x1be1[_0xd83c3a];return _0x536216;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file +var _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x42b841,_0x5d7faf){var _0x6a150c=function(_0x2087e6){while(--_0x2087e6){_0x42b841['push'](_0x42b841['shift']());}};_0x6a150c(++_0x5d7faf);}(_0xe14d,0x1ee));var _0xde14=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xe14d[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4d6fcfb..bad9ea5 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x5300b2,_0x26c820){_0x5300b2=_0x5300b2-0x0;var _0x4a554a=_0x7a54[_0x5300b2];return _0x4a554a;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x59f880,_0x5c9ddc){_0x59f880=_0x59f880-0x0;var _0xb2cd7e=_0x7a54[_0x59f880];return _0xb2cd7e;};'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 7916dc3..2eb20d5 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 _0x90b5=['nolimit','limit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','then','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x333118,_0x1015ab){var _0x5a92bd=function(_0x212178){while(--_0x212178){_0x333118['push'](_0x333118['shift']());}};_0x5a92bd(++_0x1015ab);}(_0x90b5,0x139));var _0x590b=function(_0x1553b7,_0x578e65){_0x1553b7=_0x1553b7-0x0;var _0x20a1de=_0x90b5[_0x1553b7];return _0x20a1de;};'use strict';var emlformat=require(_0x590b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x590b('0x1'));var jsonpatch=require(_0x590b('0x2'));var rp=require(_0x590b('0x3'));var moment=require(_0x590b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x590b('0x5'));var path=require(_0x590b('0x6'));var sox=require('sox');var csv=require(_0x590b('0x7'));var ejs=require(_0x590b('0x8'));var fs=require('fs');var fs_extra=require(_0x590b('0x9'));var _=require('lodash');var squel=require(_0x590b('0xa'));var crypto=require(_0x590b('0xb'));var jsforce=require(_0x590b('0xc'));var deskjs=require(_0x590b('0xd'));var toCsv=require(_0x590b('0x7'));var querystring=require(_0x590b('0xe'));var Papa=require(_0x590b('0xf'));var Redis=require(_0x590b('0x10'));var authService=require(_0x590b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x590b('0x12'));var hardwareService=require(_0x590b('0x13'));var logger=require('../../config/logger')(_0x590b('0x14'));var utils=require('../../config/utils');var config=require(_0x590b('0x15'));var licenseUtil=require(_0x590b('0x16'));var db=require(_0x590b('0x17'))['db'];function respondWithStatusCode(_0x477069,_0x527487){_0x527487=_0x527487||0xcc;return function(_0xb0ca22){if(_0xb0ca22){return _0x477069[_0x590b('0x18')](_0x527487);}return _0x477069[_0x590b('0x19')](_0x527487)[_0x590b('0x1a')]();};}function respondWithResult(_0x2e85b1,_0x6ad7e7){_0x6ad7e7=_0x6ad7e7||0xc8;return function(_0x45ac04){if(_0x45ac04){return _0x2e85b1[_0x590b('0x19')](_0x6ad7e7)[_0x590b('0x1b')](_0x45ac04);}};}function respondWithFilteredResult(_0x1fbc84,_0x3fc5ca){return function(_0x260f47){if(_0x260f47){var _0x3e4723=typeof _0x3fc5ca[_0x590b('0x1c')]===_0x590b('0x1d')&&typeof _0x3fc5ca['limit']===_0x590b('0x1d');var _0x530e24=_0x260f47[_0x590b('0x1e')];var _0x115309=_0x3e4723?0x0:_0x3fc5ca[_0x590b('0x1c')];var _0x53337c=_0x3e4723?_0x260f47['count']:_0x3fc5ca[_0x590b('0x1c')]+_0x3fc5ca['limit'];var _0x21e771;if(_0x53337c>=_0x530e24){_0x53337c=_0x530e24;_0x21e771=0xc8;}else{_0x21e771=0xce;}_0x1fbc84[_0x590b('0x19')](_0x21e771);return _0x1fbc84[_0x590b('0x1f')]('Content-Range',_0x115309+'-'+_0x53337c+'/'+_0x530e24)[_0x590b('0x1b')](_0x260f47);}return null;};}function patchUpdates(_0x8ab843){return function(_0x2b8ea0){try{jsonpatch[_0x590b('0x20')](_0x2b8ea0,_0x8ab843,!![]);}catch(_0x4990ba){return BPromise[_0x590b('0x21')](_0x4990ba);}return _0x2b8ea0['save']();};}function saveUpdates(_0x10a339,_0x30dc9f){return function(_0x5bdaba){if(_0x5bdaba){return _0x5bdaba['update'](_0x10a339)[_0x590b('0x22')](function(_0x2bcfca){return _0x2bcfca;});}return null;};}function removeEntity(_0x52bdad,_0x21638c){return function(_0x1045d5){if(_0x1045d5){return _0x1045d5['destroy']()['then'](function(){_0x52bdad[_0x590b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fead,_0x520095){return function(_0x4d3ff9){if(!_0x4d3ff9){_0x39fead[_0x590b('0x18')](0x194);}return _0x4d3ff9;};}function handleError(_0x20571b,_0x5cf6b6){_0x5cf6b6=_0x5cf6b6||0x1f4;return function(_0x1febcd){logger[_0x590b('0x23')](_0x1febcd[_0x590b('0x24')]);if(_0x1febcd[_0x590b('0x25')]){delete _0x1febcd[_0x590b('0x25')];}_0x20571b['status'](_0x5cf6b6)[_0x590b('0x26')](_0x1febcd);};}exports[_0x590b('0x27')]=function(_0x333af8,_0x38a64a){var _0x1ee769={},_0x3b881f={},_0x5ee979={'count':0x0,'rows':[]};var _0x1dfce0=_['map'](db[_0x590b('0x28')][_0x590b('0x29')],function(_0x448ab3){return{'name':_0x448ab3[_0x590b('0x2a')],'type':_0x448ab3['type'][_0x590b('0x2b')]};});_0x3b881f['model']=_[_0x590b('0x2c')](_0x1dfce0,_0x590b('0x25'));_0x3b881f[_0x590b('0x2d')]=_[_0x590b('0x2e')](_0x333af8[_0x590b('0x2d')]);_0x3b881f['filters']=_[_0x590b('0x2f')](_0x3b881f[_0x590b('0x30')],_0x3b881f[_0x590b('0x2d')]);_0x1ee769[_0x590b('0x31')]=_['intersection'](_0x3b881f['model'],qs[_0x590b('0x32')](_0x333af8[_0x590b('0x2d')][_0x590b('0x32')]));_0x1ee769[_0x590b('0x31')]=_0x1ee769['attributes']['length']?_0x1ee769[_0x590b('0x31')]:_0x3b881f['model'];if(!_0x333af8[_0x590b('0x2d')][_0x590b('0x33')](_0x590b('0x34'))){_0x1ee769[_0x590b('0x35')]=qs[_0x590b('0x35')](_0x333af8[_0x590b('0x2d')][_0x590b('0x35')]);_0x1ee769[_0x590b('0x1c')]=qs[_0x590b('0x1c')](_0x333af8[_0x590b('0x2d')]['offset']);}_0x1ee769['order']=qs[_0x590b('0x36')](_0x333af8[_0x590b('0x2d')][_0x590b('0x36')]);_0x1ee769[_0x590b('0x37')]=qs[_0x590b('0x38')](_['pick'](_0x333af8[_0x590b('0x2d')],_0x3b881f[_0x590b('0x38')]),_0x1dfce0);if(_0x333af8[_0x590b('0x2d')][_0x590b('0x39')]){_0x1ee769[_0x590b('0x37')]=_['merge'](_0x1ee769[_0x590b('0x37')],{'$or':_[_0x590b('0x2c')](_0x1dfce0,function(_0x4e3f84){if(_0x4e3f84['type']!==_0x590b('0x3a')){var _0x4be52e={};_0x4be52e[_0x4e3f84[_0x590b('0x25')]]={'$like':'%'+_0x333af8[_0x590b('0x2d')][_0x590b('0x39')]+'%'};return _0x4be52e;}})});}_0x1ee769=_[_0x590b('0x3b')]({},_0x1ee769,_0x333af8[_0x590b('0x3c')]);var _0x419e6a={'where':_0x1ee769[_0x590b('0x37')]};return db[_0x590b('0x28')][_0x590b('0x1e')](_0x419e6a)[_0x590b('0x22')](function(_0x593b35){_0x5ee979[_0x590b('0x1e')]=_0x593b35;if(_0x333af8[_0x590b('0x2d')][_0x590b('0x3d')]){_0x1ee769['include']=[{'all':!![]}];}return db[_0x590b('0x28')][_0x590b('0x3e')](_0x1ee769);})[_0x590b('0x22')](function(_0x114bbe){_0x5ee979[_0x590b('0x3f')]=_0x114bbe;return _0x5ee979;})[_0x590b('0x22')](respondWithFilteredResult(_0x38a64a,_0x1ee769))[_0x590b('0x40')](handleError(_0x38a64a,null));};exports[_0x590b('0x41')]=function(_0x58c62e,_0x7da2e3){var _0x5984c0={'raw':!![],'where':{'id':_0x58c62e[_0x590b('0x42')]['id']}},_0xb345c0={};_0xb345c0[_0x590b('0x30')]=_['keys'](db[_0x590b('0x28')][_0x590b('0x29')]);_0xb345c0[_0x590b('0x2d')]=_[_0x590b('0x2e')](_0x58c62e['query']);_0xb345c0[_0x590b('0x38')]=_[_0x590b('0x2f')](_0xb345c0['model'],_0xb345c0['query']);_0x5984c0['attributes']=_[_0x590b('0x2f')](_0xb345c0[_0x590b('0x30')],qs[_0x590b('0x32')](_0x58c62e['query']['fields']));_0x5984c0[_0x590b('0x31')]=_0x5984c0[_0x590b('0x31')]['length']?_0x5984c0[_0x590b('0x31')]:_0xb345c0[_0x590b('0x30')];if(_0x58c62e[_0x590b('0x2d')][_0x590b('0x3d')]){_0x5984c0[_0x590b('0x43')]=[{'all':!![]}];}_0x5984c0=_[_0x590b('0x3b')]({},_0x5984c0,_0x58c62e[_0x590b('0x3c')]);return db[_0x590b('0x28')][_0x590b('0x44')](_0x5984c0)[_0x590b('0x22')](handleEntityNotFound(_0x7da2e3,null))[_0x590b('0x22')](respondWithResult(_0x7da2e3,null))[_0x590b('0x40')](handleError(_0x7da2e3,null));};exports[_0x590b('0x45')]=function(_0x5e10de,_0x5e79c5){return db[_0x590b('0x28')][_0x590b('0x45')](_0x5e10de[_0x590b('0x46')],{})[_0x590b('0x22')](respondWithResult(_0x5e79c5,0xc9))['catch'](handleError(_0x5e79c5,null));};exports[_0x590b('0x47')]=function(_0x11bb48,_0x2f492a){if(_0x11bb48['body']['id']){delete _0x11bb48[_0x590b('0x46')]['id'];}return db[_0x590b('0x28')]['find']({'where':{'id':_0x11bb48['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0x2f492a,null))[_0x590b('0x22')](saveUpdates(_0x11bb48['body'],null))[_0x590b('0x22')](respondWithResult(_0x2f492a,null))[_0x590b('0x40')](handleError(_0x2f492a,null));};exports['destroy']=function(_0x67ee4f,_0xa6c336){return db[_0x590b('0x28')]['find']({'where':{'id':_0x67ee4f['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0xa6c336,null))[_0x590b('0x22')](removeEntity(_0xa6c336,null))['catch'](handleError(_0xa6c336,null));};exports[_0x590b('0x48')]=function(_0xd409f5,_0x228203){return db[_0x590b('0x28')][_0x590b('0x48')]()[_0x590b('0x22')](respondWithResult(_0x228203,null))[_0x590b('0x40')](handleError(_0x228203,null));}; \ No newline at end of file +var _0xbfe8=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','JscriptyAnswerReport','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x10625e,_0x2f3d7e){_0x10625e=_0x10625e-0x0;var _0x888cd9=_0xbfe8[_0x10625e];return _0x888cd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bfe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bfe('0x1'));var rp=require(_0x8bfe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bfe('0x3'));var util=require(_0x8bfe('0x4'));var path=require('path');var sox=require(_0x8bfe('0x5'));var csv=require(_0x8bfe('0x6'));var ejs=require(_0x8bfe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bfe('0x8'));var squel=require(_0x8bfe('0x9'));var crypto=require(_0x8bfe('0xa'));var jsforce=require(_0x8bfe('0xb'));var deskjs=require(_0x8bfe('0xc'));var toCsv=require(_0x8bfe('0x6'));var querystring=require(_0x8bfe('0xd'));var Papa=require(_0x8bfe('0xe'));var Redis=require(_0x8bfe('0xf'));var authService=require(_0x8bfe('0x10'));var qs=require(_0x8bfe('0x11'));var as=require(_0x8bfe('0x12'));var hardwareService=require(_0x8bfe('0x13'));var logger=require(_0x8bfe('0x14'))(_0x8bfe('0x15'));var utils=require('../../config/utils');var config=require(_0x8bfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bfe('0x17'))['db'];function respondWithStatusCode(_0x2f479d,_0x22a131){_0x22a131=_0x22a131||0xcc;return function(_0x5ba48c){if(_0x5ba48c){return _0x2f479d['sendStatus'](_0x22a131);}return _0x2f479d[_0x8bfe('0x18')](_0x22a131)[_0x8bfe('0x19')]();};}function respondWithResult(_0x22737f,_0x36fd25){_0x36fd25=_0x36fd25||0xc8;return function(_0x46c8e3){if(_0x46c8e3){return _0x22737f['status'](_0x36fd25)[_0x8bfe('0x1a')](_0x46c8e3);}};}function respondWithFilteredResult(_0x5520d7,_0x55914b){return function(_0x778f01){if(_0x778f01){var _0xe57cb1=typeof _0x55914b[_0x8bfe('0x1b')]==='undefined'&&typeof _0x55914b['limit']===_0x8bfe('0x1c');var _0x5019ba=_0x778f01['count'];var _0x2e7c29=_0xe57cb1?0x0:_0x55914b[_0x8bfe('0x1b')];var _0x5d8bf1=_0xe57cb1?_0x778f01[_0x8bfe('0x1d')]:_0x55914b[_0x8bfe('0x1b')]+_0x55914b[_0x8bfe('0x1e')];var _0x3b0837;if(_0x5d8bf1>=_0x5019ba){_0x5d8bf1=_0x5019ba;_0x3b0837=0xc8;}else{_0x3b0837=0xce;}_0x5520d7['status'](_0x3b0837);return _0x5520d7[_0x8bfe('0x1f')]('Content-Range',_0x2e7c29+'-'+_0x5d8bf1+'/'+_0x5019ba)[_0x8bfe('0x1a')](_0x778f01);}return null;};}function patchUpdates(_0x3f8050){return function(_0x3c6e7b){try{jsonpatch['apply'](_0x3c6e7b,_0x3f8050,!![]);}catch(_0x55af8c){return BPromise[_0x8bfe('0x20')](_0x55af8c);}return _0x3c6e7b['save']();};}function saveUpdates(_0x55f5bc,_0xef5e81){return function(_0x5397fb){if(_0x5397fb){return _0x5397fb[_0x8bfe('0x21')](_0x55f5bc)['then'](function(_0x34043a){return _0x34043a;});}return null;};}function removeEntity(_0x19058e,_0x42a93f){return function(_0x260dd9){if(_0x260dd9){return _0x260dd9['destroy']()[_0x8bfe('0x22')](function(){_0x19058e[_0x8bfe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f73d0,_0x1789f7){return function(_0x46526f){if(!_0x46526f){_0x2f73d0[_0x8bfe('0x23')](0x194);}return _0x46526f;};}function handleError(_0x2dc8d5,_0x91271f){_0x91271f=_0x91271f||0x1f4;return function(_0x4fcb3a){logger[_0x8bfe('0x24')](_0x4fcb3a[_0x8bfe('0x25')]);if(_0x4fcb3a[_0x8bfe('0x26')]){delete _0x4fcb3a[_0x8bfe('0x26')];}_0x2dc8d5[_0x8bfe('0x18')](_0x91271f)[_0x8bfe('0x27')](_0x4fcb3a);};}exports[_0x8bfe('0x28')]=function(_0x2cbfb3,_0x15fccc){var _0x2b47c6={},_0x3c6a3c={},_0x597651={'count':0x0,'rows':[]};var _0xdf4c3f=_[_0x8bfe('0x29')](db['JscriptyAnswerReport'][_0x8bfe('0x2a')],function(_0x2e86ee){return{'name':_0x2e86ee[_0x8bfe('0x2b')],'type':_0x2e86ee['type'][_0x8bfe('0x2c')]};});_0x3c6a3c[_0x8bfe('0x2d')]=_['map'](_0xdf4c3f,'name');_0x3c6a3c[_0x8bfe('0x2e')]=_[_0x8bfe('0x2f')](_0x2cbfb3[_0x8bfe('0x2e')]);_0x3c6a3c[_0x8bfe('0x30')]=_[_0x8bfe('0x31')](_0x3c6a3c[_0x8bfe('0x2d')],_0x3c6a3c[_0x8bfe('0x2e')]);_0x2b47c6[_0x8bfe('0x32')]=_[_0x8bfe('0x31')](_0x3c6a3c[_0x8bfe('0x2d')],qs['fields'](_0x2cbfb3['query'][_0x8bfe('0x33')]));_0x2b47c6[_0x8bfe('0x32')]=_0x2b47c6[_0x8bfe('0x32')][_0x8bfe('0x34')]?_0x2b47c6[_0x8bfe('0x32')]:_0x3c6a3c[_0x8bfe('0x2d')];if(!_0x2cbfb3[_0x8bfe('0x2e')]['hasOwnProperty'](_0x8bfe('0x35'))){_0x2b47c6[_0x8bfe('0x1e')]=qs['limit'](_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x1e')]);_0x2b47c6[_0x8bfe('0x1b')]=qs[_0x8bfe('0x1b')](_0x2cbfb3[_0x8bfe('0x2e')]['offset']);}_0x2b47c6[_0x8bfe('0x36')]=qs['sort'](_0x2cbfb3['query']['sort']);_0x2b47c6['where']=qs[_0x8bfe('0x30')](_[_0x8bfe('0x37')](_0x2cbfb3[_0x8bfe('0x2e')],_0x3c6a3c[_0x8bfe('0x30')]),_0xdf4c3f);if(_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x38')]){_0x2b47c6[_0x8bfe('0x39')]=_['merge'](_0x2b47c6[_0x8bfe('0x39')],{'$or':_['map'](_0xdf4c3f,function(_0x5c5801){if(_0x5c5801['type']!==_0x8bfe('0x3a')){var _0x65a1a3={};_0x65a1a3[_0x5c5801[_0x8bfe('0x26')]]={'$like':'%'+_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x38')]+'%'};return _0x65a1a3;}})});}_0x2b47c6=_[_0x8bfe('0x3b')]({},_0x2b47c6,_0x2cbfb3[_0x8bfe('0x3c')]);var _0x20b085={'where':_0x2b47c6['where']};return db['JscriptyAnswerReport'][_0x8bfe('0x1d')](_0x20b085)[_0x8bfe('0x22')](function(_0x36d23c){_0x597651[_0x8bfe('0x1d')]=_0x36d23c;if(_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x3d')]){_0x2b47c6[_0x8bfe('0x3e')]=[{'all':!![]}];}return db[_0x8bfe('0x3f')][_0x8bfe('0x40')](_0x2b47c6);})['then'](function(_0x62a6e2){_0x597651[_0x8bfe('0x41')]=_0x62a6e2;return _0x597651;})[_0x8bfe('0x22')](respondWithFilteredResult(_0x15fccc,_0x2b47c6))[_0x8bfe('0x42')](handleError(_0x15fccc,null));};exports[_0x8bfe('0x43')]=function(_0x234edc,_0x403456){var _0x55814c={'raw':!![],'where':{'id':_0x234edc[_0x8bfe('0x44')]['id']}},_0x25d26f={};_0x25d26f['model']=_[_0x8bfe('0x2f')](db['JscriptyAnswerReport']['rawAttributes']);_0x25d26f[_0x8bfe('0x2e')]=_[_0x8bfe('0x2f')](_0x234edc[_0x8bfe('0x2e')]);_0x25d26f['filters']=_[_0x8bfe('0x31')](_0x25d26f['model'],_0x25d26f[_0x8bfe('0x2e')]);_0x55814c[_0x8bfe('0x32')]=_['intersection'](_0x25d26f[_0x8bfe('0x2d')],qs[_0x8bfe('0x33')](_0x234edc[_0x8bfe('0x2e')][_0x8bfe('0x33')]));_0x55814c['attributes']=_0x55814c[_0x8bfe('0x32')][_0x8bfe('0x34')]?_0x55814c[_0x8bfe('0x32')]:_0x25d26f['model'];if(_0x234edc['query'][_0x8bfe('0x3d')]){_0x55814c[_0x8bfe('0x3e')]=[{'all':!![]}];}_0x55814c=_[_0x8bfe('0x3b')]({},_0x55814c,_0x234edc[_0x8bfe('0x3c')]);return db[_0x8bfe('0x3f')][_0x8bfe('0x45')](_0x55814c)[_0x8bfe('0x22')](handleEntityNotFound(_0x403456,null))[_0x8bfe('0x22')](respondWithResult(_0x403456,null))['catch'](handleError(_0x403456,null));};exports[_0x8bfe('0x46')]=function(_0x2af8fa,_0x4e6949){return db['JscriptyAnswerReport'][_0x8bfe('0x46')](_0x2af8fa[_0x8bfe('0x47')],{})[_0x8bfe('0x22')](respondWithResult(_0x4e6949,0xc9))['catch'](handleError(_0x4e6949,null));};exports[_0x8bfe('0x21')]=function(_0x3c4086,_0x55ad6e){if(_0x3c4086[_0x8bfe('0x47')]['id']){delete _0x3c4086[_0x8bfe('0x47')]['id'];}return db[_0x8bfe('0x3f')][_0x8bfe('0x45')]({'where':{'id':_0x3c4086[_0x8bfe('0x44')]['id']}})[_0x8bfe('0x22')](handleEntityNotFound(_0x55ad6e,null))['then'](saveUpdates(_0x3c4086['body'],null))['then'](respondWithResult(_0x55ad6e,null))['catch'](handleError(_0x55ad6e,null));};exports[_0x8bfe('0x48')]=function(_0x2b84a3,_0x36e938){return db[_0x8bfe('0x3f')][_0x8bfe('0x45')]({'where':{'id':_0x2b84a3['params']['id']}})[_0x8bfe('0x22')](handleEntityNotFound(_0x36e938,null))[_0x8bfe('0x22')](removeEntity(_0x36e938,null))[_0x8bfe('0x42')](handleError(_0x36e938,null));};exports[_0x8bfe('0x49')]=function(_0x3c6cbc,_0x43a0c5){return db['JscriptyAnswerReport'][_0x8bfe('0x49')]()[_0x8bfe('0x22')](respondWithResult(_0x43a0c5,null))['catch'](handleError(_0x43a0c5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7ab38af..06b922f 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 _0xba3a=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0xfdd6b6,_0x19497a){var _0x464439=function(_0x147e70){while(--_0x147e70){_0xfdd6b6['push'](_0xfdd6b6['shift']());}};_0x464439(++_0x19497a);}(_0xba3a,0x83));var _0xaba3=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0xba3a[_0x319fc1];return _0xb768af;};'use strict';var _=require(_0xaba3('0x0'));var util=require(_0xaba3('0x1'));var logger=require(_0xaba3('0x2'))('api');var moment=require(_0xaba3('0x3'));var BPromise=require(_0xaba3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaba3('0x5'));var config=require(_0xaba3('0x6'));var attributes=require(_0xaba3('0x7'));module[_0xaba3('0x8')]=function(_0x469232,_0x9097b8){return _0x469232['define'](_0xaba3('0x9'),attributes,{'tableName':_0xaba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a0=['bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash','util','../../config/logger','moment'];(function(_0xa95fde,_0xaa6ec6){var _0x387844=function(_0x398b6b){while(--_0x398b6b){_0xa95fde['push'](_0xa95fde['shift']());}};_0x387844(++_0xaa6ec6);}(_0xb8a0,0xb7));var _0x0b8a=function(_0x7c9fb0,_0x1c5562){_0x7c9fb0=_0x7c9fb0-0x0;var _0x213625=_0xb8a0[_0x7c9fb0];return _0x213625;};'use strict';var _=require(_0x0b8a('0x0'));var util=require(_0x0b8a('0x1'));var logger=require(_0x0b8a('0x2'))('api');var moment=require(_0x0b8a('0x3'));var BPromise=require(_0x0b8a('0x4'));var rp=require(_0x0b8a('0x5'));var fs=require('fs');var path=require(_0x0b8a('0x6'));var rimraf=require('rimraf');var config=require(_0x0b8a('0x7'));var attributes=require(_0x0b8a('0x8'));module[_0x0b8a('0x9')]=function(_0x5de340,_0x19358f){return _0x5de340['define']('JscriptyAnswerReport',attributes,{'tableName':_0x0b8a('0xa'),'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 d49c8c7..3619bb1 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 _0xa6ae=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','info','request\x20sent','debug','stringify','code','message','error','JscriptyAnswerReport,\x20%s,\x20%s','result','catch'];(function(_0x178a98,_0x5ee745){var _0x4bca4e=function(_0x3f316b){while(--_0x3f316b){_0x178a98['push'](_0x178a98['shift']());}};_0x4bca4e(++_0x5ee745);}(_0xa6ae,0x132));var _0xea6a=function(_0x421e6b,_0x4fa4c4){_0x421e6b=_0x421e6b-0x0;var _0x1969d5=_0xa6ae[_0x421e6b];return _0x1969d5;};'use strict';var _=require(_0xea6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xea6a('0x1'));var rs=require(_0xea6a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea6a('0x3'))['db'];var utils=require(_0xea6a('0x4'));var logger=require(_0xea6a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xea6a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28f503,_0x320d09,_0x194541){return new BPromise(function(_0xca7567,_0xa89f5f){return client['request'](_0x28f503,_0x194541)['then'](function(_0x3d30d1){logger[_0xea6a('0x7')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x320d09,_0xea6a('0x8'));logger[_0xea6a('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x320d09,'request\x20sent',JSON[_0xea6a('0xa')](_0x3d30d1));if(_0x3d30d1['error']){if(_0x3d30d1['error'][_0xea6a('0xb')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x320d09,_0x3d30d1['error'][_0xea6a('0xc')]);return _0xa89f5f(_0x3d30d1[_0xea6a('0xd')]['message']);}logger[_0xea6a('0xd')](_0xea6a('0xe'),_0x320d09,_0x3d30d1[_0xea6a('0xd')][_0xea6a('0xc')]);return _0xca7567(_0x3d30d1[_0xea6a('0xd')]['message']);}else{logger[_0xea6a('0x7')](_0xea6a('0xe'),_0x320d09,_0xea6a('0x8'));_0xca7567(_0x3d30d1[_0xea6a('0xf')][_0xea6a('0xc')]);}})[_0xea6a('0x10')](function(_0x5b4195){logger[_0xea6a('0xd')](_0xea6a('0xe'),_0x320d09,_0x5b4195);_0xa89f5f(_0x5b4195);});});} \ No newline at end of file +var _0xe99c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3c0e90,_0x52f4ae){var _0x1928c6=function(_0x47e7cc){while(--_0x47e7cc){_0x3c0e90['push'](_0x3c0e90['shift']());}};_0x1928c6(++_0x52f4ae);}(_0xe99c,0x15b));var _0xce99=function(_0x5f237e,_0x2c231f){_0x5f237e=_0x5f237e-0x0;var _0x69f20a=_0xe99c[_0x5f237e];return _0x69f20a;};'use strict';var _=require(_0xce99('0x0'));var util=require(_0xce99('0x1'));var moment=require('moment');var BPromise=require(_0xce99('0x2'));var rs=require(_0xce99('0x3'));var fs=require('fs');var Redis=require(_0xce99('0x4'));var db=require(_0xce99('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce99('0x6'))(_0xce99('0x7'));var config=require(_0xce99('0x8'));var jayson=require(_0xce99('0x9'));var client=jayson['client'][_0xce99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4215d0,_0x3fbc8b,_0x2a75ef){return new BPromise(function(_0x367bfb,_0x4a9009){return client[_0xce99('0xb')](_0x4215d0,_0x2a75ef)['then'](function(_0x37cac3){logger[_0xce99('0xc')](_0xce99('0xd'),_0x3fbc8b,_0xce99('0xe'));logger[_0xce99('0xf')](_0xce99('0x10'),_0x3fbc8b,_0xce99('0xe'),JSON['stringify'](_0x37cac3));if(_0x37cac3[_0xce99('0x11')]){if(_0x37cac3[_0xce99('0x11')][_0xce99('0x12')]===0x1f4){logger['error'](_0xce99('0xd'),_0x3fbc8b,_0x37cac3[_0xce99('0x11')][_0xce99('0x13')]);return _0x4a9009(_0x37cac3[_0xce99('0x11')]['message']);}logger[_0xce99('0x11')](_0xce99('0xd'),_0x3fbc8b,_0x37cac3['error'][_0xce99('0x13')]);return _0x367bfb(_0x37cac3[_0xce99('0x11')][_0xce99('0x13')]);}else{logger[_0xce99('0xc')](_0xce99('0xd'),_0x3fbc8b,_0xce99('0xe'));_0x367bfb(_0x37cac3[_0xce99('0x14')][_0xce99('0x13')]);}})[_0xce99('0x15')](function(_0x550144){logger[_0xce99('0x11')](_0xce99('0xd'),_0x3fbc8b,_0x550144);_0x4a9009(_0x550144);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 290e5b4..4aeeb29 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 _0xb8f4=['fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','connect-timeout','express','Router'];(function(_0x5c3514,_0x18e281){var _0x56e259=function(_0x4914e3){while(--_0x4914e3){_0x5c3514['push'](_0x5c3514['shift']());}};_0x56e259(++_0x18e281);}(_0xb8f4,0xa5));var _0x4b8f=function(_0x5b9df0,_0x5a2587){_0x5b9df0=_0x5b9df0-0x0;var _0x58a845=_0xb8f4[_0x5b9df0];return _0x58a845;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4b8f('0x0'));var express=require(_0x4b8f('0x1'));var router=express[_0x4b8f('0x2')]();var fs_extra=require(_0x4b8f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4b8f('0x4'));var config=require('../../config/environment');var controller=require(_0x4b8f('0x5'));router[_0x4b8f('0x6')]('/',auth[_0x4b8f('0x7')](),controller[_0x4b8f('0x8')]);router[_0x4b8f('0x6')](_0x4b8f('0x9'),auth[_0x4b8f('0x7')](),controller[_0x4b8f('0xa')]);router[_0x4b8f('0x6')](_0x4b8f('0xb'),auth['isAuthenticated'](),controller['getSessions']);router[_0x4b8f('0x6')]('/:id/answers',auth[_0x4b8f('0x7')](),controller[_0x4b8f('0xc')]);router[_0x4b8f('0x6')](_0x4b8f('0xd'),auth['isAuthenticated'](),timeout('30s'),controller[_0x4b8f('0xe')]);router[_0x4b8f('0xf')]('/',auth[_0x4b8f('0x7')](),controller[_0x4b8f('0x10')]);router[_0x4b8f('0xf')](_0x4b8f('0x11'),auth[_0x4b8f('0x7')](),controller[_0x4b8f('0x12')]);router[_0x4b8f('0x13')](_0x4b8f('0x9'),auth[_0x4b8f('0x7')](),controller[_0x4b8f('0x14')]);router[_0x4b8f('0x15')](_0x4b8f('0x9'),auth['isAuthenticated'](),controller[_0x4b8f('0x16')]);module[_0x4b8f('0x17')]=router; \ No newline at end of file +var _0x3814=['destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','/:id','isAuthenticated','get','/:id/sessions','getSessions','getAnswers','/:id/summary','create','post','/:id/clone','put','update'];(function(_0x58de96,_0x1489b1){var _0x37f4a6=function(_0x3339e9){while(--_0x3339e9){_0x58de96['push'](_0x58de96['shift']());}};_0x37f4a6(++_0x1489b1);}(_0x3814,0x1d0));var _0x4381=function(_0xcfec3,_0x549ce2){_0xcfec3=_0xcfec3-0x0;var _0x11f00a=_0x3814[_0xcfec3];return _0x11f00a;};'use strict';var multer=require(_0x4381('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4381('0x1'));var router=express[_0x4381('0x2')]();var fs_extra=require(_0x4381('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4381('0x4'));var config=require(_0x4381('0x5'));var controller=require(_0x4381('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4381('0x7'),auth[_0x4381('0x8')](),controller['show']);router[_0x4381('0x9')](_0x4381('0xa'),auth[_0x4381('0x8')](),controller[_0x4381('0xb')]);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x4381('0xc')]);router[_0x4381('0x9')](_0x4381('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x4381('0x8')](),controller[_0x4381('0xe')]);router[_0x4381('0xf')](_0x4381('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x4381('0x11')](_0x4381('0x7'),auth[_0x4381('0x8')](),controller[_0x4381('0x12')]);router['delete']('/:id',auth[_0x4381('0x8')](),controller[_0x4381('0x13')]);module[_0x4381('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3a0b7b0..bed9c6b 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 _0x7f41=['sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike','setDataValue','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0x7f41,0xe1));var _0x17f4=function(_0xec9ca5,_0x5ccafa){_0xec9ca5=_0xec9ca5-0x0;var _0x5aab18=_0x7f41[_0xec9ca5];return _0x5aab18;};'use strict';var Sequelize=require(_0x17f4('0x0'));var _=require(_0x17f4('0x1'));var util=require(_0x17f4('0x2'));module[_0x17f4('0x3')]={'name':{'type':Sequelize[_0x17f4('0x4')],'unique':_0x17f4('0x5')},'description':{'type':Sequelize[_0x17f4('0x4')]},'formData':{'type':Sequelize[_0x17f4('0x6')]('long'),'set':function(_0x4f1520){if(_[_0x17f4('0x7')](_0x4f1520)){this[_0x17f4('0x8')]('formData',JSON['stringify'](_0x4f1520));}else if(_[_0x17f4('0x9')](_0x4f1520)){this[_0x17f4('0x8')](_0x17f4('0xa'),_0x4f1520);}else{this[_0x17f4('0x8')](_0x17f4('0xa'),util['format'](_0x17f4('0xb'),this[_0x17f4('0xc')](_0x17f4('0x5'))||'',this[_0x17f4('0xc')](_0x17f4('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x17f4('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x02c7=['BOOLEAN','lodash','exports','STRING','name','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x34d32a,_0xade3fa){var _0x5dfbe2=function(_0x5781b3){while(--_0x5781b3){_0x34d32a['push'](_0x34d32a['shift']());}};_0x5dfbe2(++_0xade3fa);}(_0x02c7,0x16d));var _0x702c=function(_0xbff391,_0x3f81ae){_0xbff391=_0xbff391-0x0;var _0x187e9b=_0x02c7[_0xbff391];return _0x187e9b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x702c('0x0'));var util=require('util');module[_0x702c('0x1')]={'name':{'type':Sequelize[_0x702c('0x2')],'unique':_0x702c('0x3')},'description':{'type':Sequelize[_0x702c('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x702c('0x4')),'set':function(_0x58c5a0){if(_[_0x702c('0x5')](_0x58c5a0)){this[_0x702c('0x6')]('formData',JSON['stringify'](_0x58c5a0));}else if(_[_0x702c('0x7')](_0x58c5a0)){this[_0x702c('0x6')]('formData',_0x58c5a0);}else{this[_0x702c('0x6')](_0x702c('0x8'),util[_0x702c('0x9')](_0x702c('0xa'),this[_0x702c('0xb')](_0x702c('0x3'))||'',this[_0x702c('0xb')](_0x702c('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x702c('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x702c('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cd41d2e..9b9aa10 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 _0x13cc=['startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','then','get','stack','name','send','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','role','Projects','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','findOne','JscriptySessionReport','order','sort','pick','ProjectId','map','number','fromCharCode','toString','indexOf','replace','getSummary'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x13cc,0x161));var _0xc13c=function(_0x23bc1f,_0x1a44cd){_0x23bc1f=_0x23bc1f-0x0;var _0x435db5=_0x13cc[_0x23bc1f];return _0x435db5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc13c('0x0'));var jsonpatch=require(_0xc13c('0x1'));var rp=require('request-promise');var moment=require(_0xc13c('0x2'));var BPromise=require(_0xc13c('0x3'));var Mustache=require(_0xc13c('0x4'));var util=require(_0xc13c('0x5'));var path=require(_0xc13c('0x6'));var sox=require(_0xc13c('0x7'));var csv=require('to-csv');var ejs=require(_0xc13c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc13c('0x9'));var squel=require(_0xc13c('0xa'));var crypto=require(_0xc13c('0xb'));var jsforce=require(_0xc13c('0xc'));var deskjs=require(_0xc13c('0xd'));var toCsv=require(_0xc13c('0xe'));var querystring=require(_0xc13c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc13c('0x10'));var as=require(_0xc13c('0x11'));var hardwareService=require(_0xc13c('0x12'));var logger=require(_0xc13c('0x13'))(_0xc13c('0x14'));var utils=require('../../config/utils');var config=require(_0xc13c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc13c('0x16'))['db'];function respondWithStatusCode(_0x4e063d,_0x57b176){_0x57b176=_0x57b176||0xcc;return function(_0x18bfd5){if(_0x18bfd5){return _0x4e063d[_0xc13c('0x17')](_0x57b176);}return _0x4e063d[_0xc13c('0x18')](_0x57b176)[_0xc13c('0x19')]();};}function respondWithResult(_0x2854e4,_0x4175b2){_0x4175b2=_0x4175b2||0xc8;return function(_0x2e828a){if(_0x2e828a){return _0x2854e4[_0xc13c('0x18')](_0x4175b2)[_0xc13c('0x1a')](_0x2e828a);}};}function respondWithFilteredResult(_0x250070,_0x56b427){return function(_0x228497){if(_0x228497){var _0x63cf6f=typeof _0x56b427[_0xc13c('0x1b')]==='undefined'&&typeof _0x56b427[_0xc13c('0x1c')]===_0xc13c('0x1d');var _0x3e66b6=_0x228497[_0xc13c('0x1e')];var _0x18c11c=_0x63cf6f?0x0:_0x56b427[_0xc13c('0x1b')];var _0x265255=_0x63cf6f?_0x228497[_0xc13c('0x1e')]:_0x56b427['offset']+_0x56b427[_0xc13c('0x1c')];var _0xa4cc8e;if(_0x265255>=_0x3e66b6){_0x265255=_0x3e66b6;_0xa4cc8e=0xc8;}else{_0xa4cc8e=0xce;}_0x250070[_0xc13c('0x18')](_0xa4cc8e);return _0x250070['set'](_0xc13c('0x1f'),_0x18c11c+'-'+_0x265255+'/'+_0x3e66b6)[_0xc13c('0x1a')](_0x228497);}return null;};}function patchUpdates(_0x52bc34){return function(_0x592522){try{jsonpatch[_0xc13c('0x20')](_0x592522,_0x52bc34,!![]);}catch(_0x7b7391){return BPromise['reject'](_0x7b7391);}return _0x592522[_0xc13c('0x21')]();};}function saveUpdates(_0xf804dc,_0x17495d){return function(_0xa183d6){if(_0xa183d6){return _0xa183d6['update'](_0xf804dc)['then'](function(_0x36bb1c){return _0x36bb1c;});}return null;};}function removeEntity(_0x3c38b6,_0x30cc6d){return function(_0xcfa0ec){if(_0xcfa0ec){return _0xcfa0ec[_0xc13c('0x22')]()[_0xc13c('0x23')](function(){var _0x43fca3=_0xcfa0ec[_0xc13c('0x24')]({'plain':!![]});var _0x3eceec='Projects';return db['UserProfileResource'][_0xc13c('0x22')]({'where':{'type':_0x3eceec,'resourceId':_0x43fca3['id']}})[_0xc13c('0x23')](function(){return _0xcfa0ec;});})[_0xc13c('0x23')](function(){_0x3c38b6[_0xc13c('0x18')](0xcc)[_0xc13c('0x19')]();});}};}function handleEntityNotFound(_0x2a1b98,_0x458608){return function(_0x3c1564){if(!_0x3c1564){_0x2a1b98[_0xc13c('0x17')](0x194);}return _0x3c1564;};}function handleError(_0x5b230,_0x2f6220){_0x2f6220=_0x2f6220||0x1f4;return function(_0x1b005a){logger['error'](_0x1b005a[_0xc13c('0x25')]);if(_0x1b005a[_0xc13c('0x26')]){delete _0x1b005a[_0xc13c('0x26')];}_0x5b230[_0xc13c('0x18')](_0x2f6220)[_0xc13c('0x27')](_0x1b005a);};}exports['index']=function(_0xcac8b0,_0x1dbf82){var _0x1fc255={},_0x5b0c18={},_0x3922bb={'count':0x0,'rows':[]};var _0x4979a1=_['map'](db[_0xc13c('0x28')][_0xc13c('0x29')],function(_0x30e043){return{'name':_0x30e043[_0xc13c('0x2a')],'type':_0x30e043['type'][_0xc13c('0x2b')]};});_0x5b0c18[_0xc13c('0x2c')]=_['map'](_0x4979a1,_0xc13c('0x26'));_0x5b0c18[_0xc13c('0x2d')]=_[_0xc13c('0x2e')](_0xcac8b0['query']);_0x5b0c18[_0xc13c('0x2f')]=_[_0xc13c('0x30')](_0x5b0c18[_0xc13c('0x2c')],_0x5b0c18['query']);_0x1fc255[_0xc13c('0x31')]=_[_0xc13c('0x30')](_0x5b0c18['model'],qs[_0xc13c('0x32')](_0xcac8b0[_0xc13c('0x2d')][_0xc13c('0x32')]));_0x1fc255[_0xc13c('0x31')]=_0x1fc255[_0xc13c('0x31')][_0xc13c('0x33')]?_0x1fc255[_0xc13c('0x31')]:_0x5b0c18[_0xc13c('0x2c')];if(!_0xcac8b0[_0xc13c('0x2d')][_0xc13c('0x34')](_0xc13c('0x35'))){_0x1fc255['limit']=qs[_0xc13c('0x1c')](_0xcac8b0[_0xc13c('0x2d')][_0xc13c('0x1c')]);_0x1fc255[_0xc13c('0x1b')]=qs['offset'](_0xcac8b0[_0xc13c('0x2d')][_0xc13c('0x1b')]);}_0x1fc255['order']=qs['sort'](_0xcac8b0[_0xc13c('0x2d')]['sort']);_0x1fc255[_0xc13c('0x36')]=qs[_0xc13c('0x2f')](_['pick'](_0xcac8b0[_0xc13c('0x2d')],_0x5b0c18[_0xc13c('0x2f')]),_0x4979a1);if(_0xcac8b0[_0xc13c('0x2d')][_0xc13c('0x37')]){_0x1fc255['where']=_['merge'](_0x1fc255[_0xc13c('0x36')],{'$or':_['map'](_0x4979a1,function(_0x1d03b8){if(_0x1d03b8[_0xc13c('0x38')]!==_0xc13c('0x39')){var _0x157cc0={};_0x157cc0[_0x1d03b8['name']]={'$like':'%'+_0xcac8b0[_0xc13c('0x2d')]['filter']+'%'};return _0x157cc0;}})});}_0x1fc255=_[_0xc13c('0x3a')]({},_0x1fc255,_0xcac8b0['options']);var _0x2d6c43={'where':_0x1fc255[_0xc13c('0x36')]};return db[_0xc13c('0x28')][_0xc13c('0x1e')](_0x2d6c43)['then'](function(_0x250776){_0x3922bb[_0xc13c('0x1e')]=_0x250776;if(_0xcac8b0[_0xc13c('0x2d')][_0xc13c('0x3b')]){_0x1fc255[_0xc13c('0x3c')]=[{'all':!![]}];}return db[_0xc13c('0x28')][_0xc13c('0x3d')](_0x1fc255);})[_0xc13c('0x23')](function(_0x26354c){_0x3922bb[_0xc13c('0x3e')]=_0x26354c;return _0x3922bb;})[_0xc13c('0x23')](respondWithFilteredResult(_0x1dbf82,_0x1fc255))[_0xc13c('0x3f')](handleError(_0x1dbf82,null));};exports['show']=function(_0x4ad6c9,_0x11feb8){var _0x5f2d99={'raw':![],'where':{'id':_0x4ad6c9[_0xc13c('0x40')]['id']}},_0x5b1e47={};_0x5b1e47[_0xc13c('0x2c')]=_['keys'](db[_0xc13c('0x28')]['rawAttributes']);_0x5b1e47[_0xc13c('0x2d')]=_[_0xc13c('0x2e')](_0x4ad6c9[_0xc13c('0x2d')]);_0x5b1e47[_0xc13c('0x2f')]=_[_0xc13c('0x30')](_0x5b1e47['model'],_0x5b1e47[_0xc13c('0x2d')]);_0x5f2d99[_0xc13c('0x31')]=_[_0xc13c('0x30')](_0x5b1e47[_0xc13c('0x2c')],qs[_0xc13c('0x32')](_0x4ad6c9[_0xc13c('0x2d')][_0xc13c('0x32')]));_0x5f2d99[_0xc13c('0x31')]=_0x5f2d99[_0xc13c('0x31')][_0xc13c('0x33')]?_0x5f2d99[_0xc13c('0x31')]:_0x5b1e47[_0xc13c('0x2c')];if(_0x4ad6c9['query'][_0xc13c('0x3b')]){_0x5f2d99['include']=[{'all':!![]}];}_0x5f2d99=_[_0xc13c('0x3a')]({},_0x5f2d99,_0x4ad6c9[_0xc13c('0x41')]);return db[_0xc13c('0x28')][_0xc13c('0x42')](_0x5f2d99)[_0xc13c('0x23')](handleEntityNotFound(_0x11feb8,null))[_0xc13c('0x23')](respondWithResult(_0x11feb8,null))['catch'](handleError(_0x11feb8,null));};exports['create']=function(_0x227607,_0x4536ab){return db['JscriptyProject'][_0xc13c('0x43')](_0x227607[_0xc13c('0x44')],{})[_0xc13c('0x23')](function(_0x505c92){var _0x213d7c=_0x227607[_0xc13c('0x45')][_0xc13c('0x24')]({'plain':!![]});if(!_0x213d7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x213d7c[_0xc13c('0x46')]===_0xc13c('0x45')){var _0x11d7a9=_0x505c92[_0xc13c('0x24')]({'plain':!![]});var _0x4c4a98=_0xc13c('0x47');return db[_0xc13c('0x48')]['find']({'where':{'name':_0x4c4a98,'userProfileId':_0x213d7c[_0xc13c('0x49')]},'raw':!![]})[_0xc13c('0x23')](function(_0x348f19){if(_0x348f19&&_0x348f19['autoAssociation']===0x0){return db[_0xc13c('0x4a')][_0xc13c('0x43')]({'name':_0x11d7a9[_0xc13c('0x26')],'resourceId':_0x11d7a9['id'],'type':_0x348f19['name'],'sectionId':_0x348f19['id']},{})[_0xc13c('0x23')](function(){return _0x505c92;});}else{return _0x505c92;}})[_0xc13c('0x3f')](function(_0x458c0d){logger[_0xc13c('0x4b')](_0xc13c('0x4c'),_0x458c0d);throw _0x458c0d;});}return _0x505c92;})['then'](respondWithResult(_0x4536ab,0xc9))['catch'](handleError(_0x4536ab,null));};exports['clone']=function(_0x5c3b1d,_0x21aeb6){var _0x58fded={'where':{'id':_0x5c3b1d[_0xc13c('0x40')]['id']}},_0x39e6ed={};_0x39e6ed['model']=_[_0xc13c('0x2e')](db[_0xc13c('0x28')][_0xc13c('0x29')]);_0x58fded[_0xc13c('0x31')]=_[_0xc13c('0x30')](_0x39e6ed[_0xc13c('0x2c')],qs[_0xc13c('0x32')](_0x5c3b1d[_0xc13c('0x2d')][_0xc13c('0x32')]));_0x58fded['attributes']=_0x58fded[_0xc13c('0x31')][_0xc13c('0x33')]?_0x58fded[_0xc13c('0x31')]:_0x39e6ed[_0xc13c('0x2c')];if(_0x5c3b1d[_0xc13c('0x2d')][_0xc13c('0x3b')]){_0x58fded[_0xc13c('0x3c')]=[{'all':!![]}];}_0x58fded=_['merge']({},_0x58fded,_0x5c3b1d['options']);return db[_0xc13c('0x28')][_0xc13c('0x42')](_0x58fded)[_0xc13c('0x23')](handleEntityNotFound(_0x21aeb6,null))[_0xc13c('0x23')](function(_0x4f6702){if(_0x4f6702){var _0x384d82=_0x4f6702[_0xc13c('0x24')]({'plain':!![]});_0x384d82=qs[_0xc13c('0x4d')](_0x384d82,['id','createdAt',_0xc13c('0x4e')]);_0x5c3b1d[_0xc13c('0x44')]=_[_0xc13c('0x4d')](_0x5c3b1d[_0xc13c('0x44')],['id','createdAt',_0xc13c('0x4e')]);return db[_0xc13c('0x28')]['create'](_[_0xc13c('0x3a')](_0x384d82,_0x5c3b1d['body']),{'include':_0x5c3b1d['query'][_0xc13c('0x3b')]?[{'all':!![]}]:undefined})['then'](function(_0x386822){var _0x292b7d=_0x5c3b1d[_0xc13c('0x45')]['get']({'plain':!![]});if(!_0x292b7d)throw new Error(_0xc13c('0x4f'));if(_0x292b7d[_0xc13c('0x46')]==='user'){var _0x4d8a5e=_0x386822['get']({'plain':!![]});var _0x30437f=_0xc13c('0x47');return db['UserProfileSection'][_0xc13c('0x42')]({'where':{'name':_0x30437f,'userProfileId':_0x292b7d['userProfileId']},'raw':!![]})[_0xc13c('0x23')](function(_0x38adfe){if(_0x38adfe&&_0x38adfe[_0xc13c('0x50')]===0x0){return db[_0xc13c('0x4a')][_0xc13c('0x43')]({'name':_0x4d8a5e[_0xc13c('0x26')],'resourceId':_0x4d8a5e['id'],'type':_0x38adfe[_0xc13c('0x26')],'sectionId':_0x38adfe['id']},{})[_0xc13c('0x23')](function(){return _0x386822;});}else{return _0x386822;}})['catch'](function(_0x578097){logger[_0xc13c('0x4b')](_0xc13c('0x4c'),_0x578097);throw _0x578097;});}return _0x386822;});}})[_0xc13c('0x23')](respondWithResult(_0x21aeb6,0xc9))[_0xc13c('0x3f')](handleError(_0x21aeb6,null));};exports[_0xc13c('0x51')]=function(_0x5f457f,_0x325cae){if(_0x5f457f[_0xc13c('0x44')]['id']){delete _0x5f457f[_0xc13c('0x44')]['id'];}return db['JscriptyProject'][_0xc13c('0x42')]({'where':{'id':_0x5f457f[_0xc13c('0x40')]['id']}})[_0xc13c('0x23')](handleEntityNotFound(_0x325cae,null))[_0xc13c('0x23')](saveUpdates(_0x5f457f['body'],null))[_0xc13c('0x23')](respondWithResult(_0x325cae,null))['catch'](handleError(_0x325cae,null));};exports[_0xc13c('0x22')]=function(_0x2e2cca,_0x171c48){return db[_0xc13c('0x28')][_0xc13c('0x42')]({'where':{'id':_0x2e2cca['params']['id']}})[_0xc13c('0x23')](handleEntityNotFound(_0x171c48,null))[_0xc13c('0x23')](removeEntity(_0x171c48,null))[_0xc13c('0x3f')](handleError(_0x171c48,null));};exports['getSessions']=function(_0x2df9ea,_0x5cf263,_0x211fad){var _0xbc4a73={'raw':!![],'where':{}};var _0xc0bf7a={};var _0xf261a2={'count':0x0,'rows':[]};return db[_0xc13c('0x28')][_0xc13c('0x52')]({'where':{'id':_0x2df9ea[_0xc13c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5cf263,null))[_0xc13c('0x23')](function(_0x418f73){if(_0x418f73){_0xc0bf7a[_0xc13c('0x2c')]=_[_0xc13c('0x2e')](db[_0xc13c('0x53')][_0xc13c('0x29')]);_0xc0bf7a[_0xc13c('0x2d')]=_['keys'](_0x2df9ea[_0xc13c('0x2d')]);_0xc0bf7a['filters']=_[_0xc13c('0x30')](_0xc0bf7a[_0xc13c('0x2c')],_0xc0bf7a[_0xc13c('0x2d')]);_0xbc4a73['attributes']=_[_0xc13c('0x30')](_0xc0bf7a[_0xc13c('0x2c')],qs['fields'](_0x2df9ea['query']['fields']));_0xbc4a73[_0xc13c('0x31')]=_0xbc4a73[_0xc13c('0x31')][_0xc13c('0x33')]?_0xbc4a73['attributes']:_0xc0bf7a[_0xc13c('0x2c')];if(!_0x2df9ea[_0xc13c('0x2d')][_0xc13c('0x34')](_0xc13c('0x35'))){_0xbc4a73[_0xc13c('0x1c')]=qs[_0xc13c('0x1c')](_0x2df9ea[_0xc13c('0x2d')][_0xc13c('0x1c')]);_0xbc4a73[_0xc13c('0x1b')]=qs[_0xc13c('0x1b')](_0x2df9ea[_0xc13c('0x2d')][_0xc13c('0x1b')]);}_0xbc4a73[_0xc13c('0x54')]=qs[_0xc13c('0x55')](_0x2df9ea[_0xc13c('0x2d')]['sort']);_0xbc4a73[_0xc13c('0x36')]=qs[_0xc13c('0x2f')](_[_0xc13c('0x56')](_0x2df9ea['query'],_0xc0bf7a[_0xc13c('0x2f')]));_0xbc4a73['where'][_0xc13c('0x57')]=_0x418f73['id'];if(_0x2df9ea['query'][_0xc13c('0x37')]){_0xbc4a73[_0xc13c('0x36')]=_[_0xc13c('0x3a')](_0xbc4a73[_0xc13c('0x36')],{'$or':_[_0xc13c('0x58')](_0xbc4a73['attributes'],function(_0xa0944f){var _0x1d40d4={};_0x1d40d4[_0xa0944f]={'$like':'%'+_0x2df9ea[_0xc13c('0x2d')][_0xc13c('0x37')]+'%'};return _0x1d40d4;})});}_0xbc4a73=_[_0xc13c('0x3a')]({},_0xbc4a73,_0x2df9ea[_0xc13c('0x41')]);return db[_0xc13c('0x53')][_0xc13c('0x1e')]({'where':_0xbc4a73[_0xc13c('0x36')]})['then'](function(_0x2ab129){_0xf261a2[_0xc13c('0x1e')]=_0x2ab129;if(_0x2df9ea['query']['includeAll']){_0xbc4a73['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xbc4a73);})['then'](function(_0x3d8260){_0xf261a2[_0xc13c('0x3e')]=_0x3d8260;return _0xf261a2;});}})['then'](respondWithFilteredResult(_0x5cf263,_0xbc4a73))[_0xc13c('0x3f')](handleError(_0x5cf263,null));};exports['getAnswers']=function(_0x4bbfe1,_0x210dc5,_0x19a4ae){var _0x23757c={'raw':!![],'where':{}};var _0x17714d={};var _0x18cace={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc13c('0x52')]({'where':{'id':_0x4bbfe1['params']['id']}})[_0xc13c('0x23')](handleEntityNotFound(_0x210dc5,null))[_0xc13c('0x23')](function(_0x5678b1){if(_0x5678b1){_0x17714d['model']=_[_0xc13c('0x2e')](db['JscriptyAnswerReport'][_0xc13c('0x29')]);_0x17714d[_0xc13c('0x2d')]=_[_0xc13c('0x2e')](_0x4bbfe1[_0xc13c('0x2d')]);_0x17714d[_0xc13c('0x2f')]=_[_0xc13c('0x30')](_0x17714d[_0xc13c('0x2c')],_0x17714d[_0xc13c('0x2d')]);_0x23757c[_0xc13c('0x31')]=_[_0xc13c('0x30')](_0x17714d['model'],qs[_0xc13c('0x32')](_0x4bbfe1['query'][_0xc13c('0x32')]));_0x23757c[_0xc13c('0x31')]=_0x23757c[_0xc13c('0x31')][_0xc13c('0x33')]?_0x23757c[_0xc13c('0x31')]:_0x17714d[_0xc13c('0x2c')];if(!_0x4bbfe1[_0xc13c('0x2d')]['hasOwnProperty'](_0xc13c('0x35'))){_0x23757c[_0xc13c('0x1c')]=qs[_0xc13c('0x1c')](_0x4bbfe1[_0xc13c('0x2d')][_0xc13c('0x1c')]);_0x23757c[_0xc13c('0x1b')]=qs['offset'](_0x4bbfe1[_0xc13c('0x2d')][_0xc13c('0x1b')]);}_0x23757c['order']=qs[_0xc13c('0x55')](_0x4bbfe1[_0xc13c('0x2d')][_0xc13c('0x55')]);_0x23757c[_0xc13c('0x36')]=qs['filters'](_['pick'](_0x4bbfe1[_0xc13c('0x2d')],_0x17714d[_0xc13c('0x2f')]));_0x23757c['where']['ProjectId']=_0x5678b1['id'];if(_0x4bbfe1[_0xc13c('0x2d')][_0xc13c('0x37')]){_0x23757c[_0xc13c('0x36')]=_[_0xc13c('0x3a')](_0x23757c[_0xc13c('0x36')],{'$or':_[_0xc13c('0x58')](_0x23757c[_0xc13c('0x31')],function(_0x1cd32a){var _0x15252b={};_0x15252b[_0x1cd32a]={'$like':'%'+_0x4bbfe1[_0xc13c('0x2d')][_0xc13c('0x37')]+'%'};return _0x15252b;})});}_0x23757c=_[_0xc13c('0x3a')]({},_0x23757c,_0x4bbfe1[_0xc13c('0x41')]);return db['JscriptyAnswerReport'][_0xc13c('0x1e')]({'where':_0x23757c[_0xc13c('0x36')]})[_0xc13c('0x23')](function(_0x4eb482){_0x18cace[_0xc13c('0x1e')]=_0x4eb482;if(_0x4bbfe1[_0xc13c('0x2d')]['includeAll']){_0x23757c[_0xc13c('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc13c('0x3d')](_0x23757c);})[_0xc13c('0x23')](function(_0x1afd92){_0x18cace['rows']=_0x1afd92;return _0x18cace;});}})[_0xc13c('0x23')](respondWithFilteredResult(_0x210dc5,_0x23757c))['catch'](handleError(_0x210dc5,null));};function char(_0x3579aa){return _0xc13c('0x59')===typeof _0x3579aa?String[_0xc13c('0x5a')][_0xc13c('0x20')](null,arguments):_0x3579aa;}function needsEncapsulation(_0x5a8664){return!!_0x5a8664&&(_0x5a8664[_0xc13c('0x5b')]()[_0xc13c('0x5c')](char(0xd))>=0x0||_0x5a8664[_0xc13c('0x5b')]()[_0xc13c('0x5c')](char(0xa))>=0x0||_0x5a8664[_0xc13c('0x5b')]()[_0xc13c('0x5c')](char(0x2c))>=0x0||_0x5a8664[_0xc13c('0x5b')]()[_0xc13c('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x2687c0){var _0x2754dd=char(0x22),_0x30e452='\x5c'+char(0x22),_0x89c39e=_0x2687c0['toString']()[_0xc13c('0x5d')](new RegExp(_0x2754dd,'g'),_0x30e452);return _0x2754dd+_0x89c39e+_0x2754dd;}exports[_0xc13c('0x5e')]=function(_0x1bc28a,_0x4c0ce2,_0x51ca34){var _0x44e6a2,_0x43b7b0;var _0x55cd41={'where':{'ProjectId':_0x1bc28a[_0xc13c('0x40')]['id']}};if(_0x1bc28a['query'][_0xc13c('0x5f')]){_0x55cd41['where'][_0xc13c('0x60')]=JSON[_0xc13c('0x61')](_0x1bc28a[_0xc13c('0x2d')][_0xc13c('0x5f')]);}return db['JscriptySessionReport'][_0xc13c('0x3d')](_0x55cd41)[_0xc13c('0x23')](handleEntityNotFound(_0x4c0ce2,null))[_0xc13c('0x23')](function(_0xa94b64){if(_0xa94b64){_0x44e6a2=_0xa94b64;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xc13c('0x58')](_0x44e6a2,'id')},'ProjectId':_0x1bc28a[_0xc13c('0x40')]['id']},'order':_0xc13c('0x62')});}})[_0xc13c('0x23')](handleEntityNotFound(_0x4c0ce2,null))[_0xc13c('0x23')](function(_0xbcfeba){if(_0xbcfeba){_0x43b7b0=_0xbcfeba;var _0x1421fa={};for(var _0x2fd6b9=0x0,_0x48a988=_0x43b7b0['length'];_0x2fd6b9<_0x48a988;_0x2fd6b9++){if(!_0x1421fa[_0xc13c('0x34')](_0x43b7b0[_0x2fd6b9][_0xc13c('0x63')])){_0x1421fa[_0x43b7b0[_0x2fd6b9]['questionId']]=needsEncapsulation(_0x43b7b0[_0x2fd6b9][_0xc13c('0x64')])?encapsulate(_0x43b7b0[_0x2fd6b9][_0xc13c('0x64')]):_0x43b7b0[_0x2fd6b9]['question'];}}var _0x3285c6=[],_0x32b9b7={};for(var _0x1ceafd=0x0,_0x54b32c=_0x44e6a2['length'];_0x1ceafd<_0x54b32c;_0x1ceafd++){_0x32b9b7={'ProjectId':_0x1bc28a['params']['id'],'SessionId':_0x44e6a2[_0x1ceafd]['id'],'StartTime':moment(_0x44e6a2[_0x1ceafd][_0xc13c('0x60')])[_0xc13c('0x65')](_0xc13c('0x66'))};for(var _0x195b16=0x0,_0x3f1449=_0x43b7b0[_0xc13c('0x33')];_0x195b16<_0x3f1449;_0x195b16++){if(_0x43b7b0[_0x195b16]['SessionId']==_0x44e6a2[_0x1ceafd]['id']&&_0x1421fa[_0xc13c('0x34')](_0x43b7b0[_0x195b16]['questionId'])){_0x32b9b7[_0x1421fa[_0x43b7b0[_0x195b16][_0xc13c('0x63')]]]=_0x43b7b0[_0x195b16][_0xc13c('0x67')];}}for(var _0x339bdb in _0x1421fa){if(!_0x32b9b7[_0xc13c('0x34')](_0x1421fa[_0x339bdb])){_0x32b9b7[_0x1421fa[_0x339bdb]]=null;}}_0x3285c6[_0xc13c('0x68')](_0x32b9b7);}return _0x3285c6;}})[_0xc13c('0x23')](function(_0x37f47e){if(!_[_0xc13c('0x69')](_0x37f47e)){var _0x4d3961=toCsv(_0x37f47e);var _0x5bc340=Date['now']();fs['writeFileSync'](util[_0xc13c('0x65')](_0xc13c('0x6a'),_0x1bc28a[_0xc13c('0x40')]['id'],_0x5bc340),_0x4d3961);_0x4c0ce2[_0xc13c('0x6b')](_0xc13c('0x6c'),'attachment;\x20filename='+util[_0xc13c('0x65')]('Jscripty_Project_%d_Summary_%s.csv',_0x1bc28a['params']['id'],_0x5bc340));_0x4c0ce2['setHeader'](_0xc13c('0x6d'),_0xc13c('0x6e'));return _0x4c0ce2[_0xc13c('0x6f')](util[_0xc13c('0x65')](_0xc13c('0x6a'),_0x1bc28a[_0xc13c('0x40')]['id'],_0x5bc340));}else{return _0x4c0ce2['sendStatus'](0xcc);}})['catch'](handleError(_0x4c0ce2,null));}; \ No newline at end of file +var _0xcd4d=['../../components/auth/service','../../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','update','then','destroy','get','Projects','UserProfileResource','name','send','map','JscriptyProject','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','getSessions','findOne','JscriptySessionReport','hasOwnProperty','order','sort','findAll','rows','getAnswers','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x189166,_0x3d84a9){var _0x166a69=function(_0xf7a045){while(--_0xf7a045){_0x189166['push'](_0x189166['shift']());}};_0x166a69(++_0x3d84a9);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x276eb0,_0x2a4953){_0x276eb0=_0x276eb0-0x0;var _0x5d9833=_0xcd4d[_0x276eb0];return _0x5d9833;};'use strict';var emlformat=require(_0xdcd4('0x0'));var rimraf=require(_0xdcd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcd4('0x2'));var rp=require(_0xdcd4('0x3'));var moment=require(_0xdcd4('0x4'));var BPromise=require(_0xdcd4('0x5'));var Mustache=require(_0xdcd4('0x6'));var util=require(_0xdcd4('0x7'));var path=require(_0xdcd4('0x8'));var sox=require(_0xdcd4('0x9'));var csv=require(_0xdcd4('0xa'));var ejs=require(_0xdcd4('0xb'));var fs=require('fs');var fs_extra=require(_0xdcd4('0xc'));var _=require(_0xdcd4('0xd'));var squel=require(_0xdcd4('0xe'));var crypto=require(_0xdcd4('0xf'));var jsforce=require(_0xdcd4('0x10'));var deskjs=require(_0xdcd4('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdcd4('0x12'));var Papa=require(_0xdcd4('0x13'));var Redis=require('ioredis');var authService=require(_0xdcd4('0x14'));var qs=require(_0xdcd4('0x15'));var as=require(_0xdcd4('0x16'));var hardwareService=require(_0xdcd4('0x17'));var logger=require(_0xdcd4('0x18'))('api');var utils=require(_0xdcd4('0x19'));var config=require(_0xdcd4('0x1a'));var licenseUtil=require(_0xdcd4('0x1b'));var db=require(_0xdcd4('0x1c'))['db'];function respondWithStatusCode(_0x2bf080,_0x553279){_0x553279=_0x553279||0xcc;return function(_0x12af2b){if(_0x12af2b){return _0x2bf080[_0xdcd4('0x1d')](_0x553279);}return _0x2bf080['status'](_0x553279)[_0xdcd4('0x1e')]();};}function respondWithResult(_0x16f7e5,_0x4aa877){_0x4aa877=_0x4aa877||0xc8;return function(_0x49f85e){if(_0x49f85e){return _0x16f7e5[_0xdcd4('0x1f')](_0x4aa877)[_0xdcd4('0x20')](_0x49f85e);}};}function respondWithFilteredResult(_0x282a21,_0x26b226){return function(_0x280598){if(_0x280598){var _0x3a1d3a=typeof _0x26b226[_0xdcd4('0x21')]===_0xdcd4('0x22')&&typeof _0x26b226[_0xdcd4('0x23')]===_0xdcd4('0x22');var _0xdb8b41=_0x280598['count'];var _0x579125=_0x3a1d3a?0x0:_0x26b226[_0xdcd4('0x21')];var _0x7682f8=_0x3a1d3a?_0x280598[_0xdcd4('0x24')]:_0x26b226[_0xdcd4('0x21')]+_0x26b226[_0xdcd4('0x23')];var _0x2433f0;if(_0x7682f8>=_0xdb8b41){_0x7682f8=_0xdb8b41;_0x2433f0=0xc8;}else{_0x2433f0=0xce;}_0x282a21[_0xdcd4('0x1f')](_0x2433f0);return _0x282a21[_0xdcd4('0x25')](_0xdcd4('0x26'),_0x579125+'-'+_0x7682f8+'/'+_0xdb8b41)[_0xdcd4('0x20')](_0x280598);}return null;};}function patchUpdates(_0x28bec2){return function(_0x2864c9){try{jsonpatch[_0xdcd4('0x27')](_0x2864c9,_0x28bec2,!![]);}catch(_0x196619){return BPromise[_0xdcd4('0x28')](_0x196619);}return _0x2864c9['save']();};}function saveUpdates(_0x21a330,_0xb4414e){return function(_0x520bb7){if(_0x520bb7){return _0x520bb7[_0xdcd4('0x29')](_0x21a330)[_0xdcd4('0x2a')](function(_0x17faa9){return _0x17faa9;});}return null;};}function removeEntity(_0x4d1e32,_0x46768f){return function(_0x427c92){if(_0x427c92){return _0x427c92[_0xdcd4('0x2b')]()['then'](function(){var _0x44dc04=_0x427c92[_0xdcd4('0x2c')]({'plain':!![]});var _0x48b046=_0xdcd4('0x2d');return db[_0xdcd4('0x2e')][_0xdcd4('0x2b')]({'where':{'type':_0x48b046,'resourceId':_0x44dc04['id']}})[_0xdcd4('0x2a')](function(){return _0x427c92;});})[_0xdcd4('0x2a')](function(){_0x4d1e32[_0xdcd4('0x1f')](0xcc)[_0xdcd4('0x1e')]();});}};}function handleEntityNotFound(_0xc9e4d4,_0x48dec1){return function(_0x134c00){if(!_0x134c00){_0xc9e4d4['sendStatus'](0x194);}return _0x134c00;};}function handleError(_0x114e94,_0x3d29d7){_0x3d29d7=_0x3d29d7||0x1f4;return function(_0x5b9f9d){logger['error'](_0x5b9f9d['stack']);if(_0x5b9f9d['name']){delete _0x5b9f9d[_0xdcd4('0x2f')];}_0x114e94[_0xdcd4('0x1f')](_0x3d29d7)[_0xdcd4('0x30')](_0x5b9f9d);};}exports['index']=function(_0x239479,_0x1d0937){var _0x565e9e={},_0x35d1e3={},_0x2e11d6={'count':0x0,'rows':[]};var _0x21aaaf=_[_0xdcd4('0x31')](db[_0xdcd4('0x32')][_0xdcd4('0x33')],function(_0x4a6a1f){return{'name':_0x4a6a1f[_0xdcd4('0x34')],'type':_0x4a6a1f['type'][_0xdcd4('0x35')]};});_0x35d1e3[_0xdcd4('0x36')]=_[_0xdcd4('0x31')](_0x21aaaf,_0xdcd4('0x2f'));_0x35d1e3[_0xdcd4('0x37')]=_['keys'](_0x239479['query']);_0x35d1e3[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x35d1e3[_0xdcd4('0x36')],_0x35d1e3['query']);_0x565e9e[_0xdcd4('0x3a')]=_[_0xdcd4('0x39')](_0x35d1e3['model'],qs['fields'](_0x239479[_0xdcd4('0x37')][_0xdcd4('0x3b')]));_0x565e9e[_0xdcd4('0x3a')]=_0x565e9e[_0xdcd4('0x3a')][_0xdcd4('0x3c')]?_0x565e9e[_0xdcd4('0x3a')]:_0x35d1e3['model'];if(!_0x239479[_0xdcd4('0x37')]['hasOwnProperty'](_0xdcd4('0x3d'))){_0x565e9e[_0xdcd4('0x23')]=qs[_0xdcd4('0x23')](_0x239479['query'][_0xdcd4('0x23')]);_0x565e9e[_0xdcd4('0x21')]=qs[_0xdcd4('0x21')](_0x239479[_0xdcd4('0x37')]['offset']);}_0x565e9e['order']=qs['sort'](_0x239479[_0xdcd4('0x37')]['sort']);_0x565e9e[_0xdcd4('0x3e')]=qs[_0xdcd4('0x38')](_[_0xdcd4('0x3f')](_0x239479[_0xdcd4('0x37')],_0x35d1e3[_0xdcd4('0x38')]),_0x21aaaf);if(_0x239479[_0xdcd4('0x37')][_0xdcd4('0x40')]){_0x565e9e[_0xdcd4('0x3e')]=_['merge'](_0x565e9e[_0xdcd4('0x3e')],{'$or':_['map'](_0x21aaaf,function(_0xf0b2c8){if(_0xf0b2c8[_0xdcd4('0x41')]!==_0xdcd4('0x42')){var _0x595e61={};_0x595e61[_0xf0b2c8[_0xdcd4('0x2f')]]={'$like':'%'+_0x239479[_0xdcd4('0x37')][_0xdcd4('0x40')]+'%'};return _0x595e61;}})});}_0x565e9e=_[_0xdcd4('0x43')]({},_0x565e9e,_0x239479[_0xdcd4('0x44')]);var _0x47717d={'where':_0x565e9e['where']};return db[_0xdcd4('0x32')][_0xdcd4('0x24')](_0x47717d)['then'](function(_0x82cd5e){_0x2e11d6['count']=_0x82cd5e;if(_0x239479[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x565e9e[_0xdcd4('0x46')]=[{'all':!![]}];}return db[_0xdcd4('0x32')]['findAll'](_0x565e9e);})[_0xdcd4('0x2a')](function(_0x30a725){_0x2e11d6['rows']=_0x30a725;return _0x2e11d6;})[_0xdcd4('0x2a')](respondWithFilteredResult(_0x1d0937,_0x565e9e))[_0xdcd4('0x47')](handleError(_0x1d0937,null));};exports[_0xdcd4('0x48')]=function(_0x392bc3,_0x1e53ec){var _0x35a808={'raw':![],'where':{'id':_0x392bc3[_0xdcd4('0x49')]['id']}},_0x193501={};_0x193501[_0xdcd4('0x36')]=_[_0xdcd4('0x4a')](db[_0xdcd4('0x32')]['rawAttributes']);_0x193501[_0xdcd4('0x37')]=_[_0xdcd4('0x4a')](_0x392bc3[_0xdcd4('0x37')]);_0x193501[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x193501[_0xdcd4('0x36')],_0x193501[_0xdcd4('0x37')]);_0x35a808['attributes']=_['intersection'](_0x193501[_0xdcd4('0x36')],qs['fields'](_0x392bc3['query']['fields']));_0x35a808['attributes']=_0x35a808[_0xdcd4('0x3a')][_0xdcd4('0x3c')]?_0x35a808['attributes']:_0x193501[_0xdcd4('0x36')];if(_0x392bc3[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x35a808['include']=[{'all':!![]}];}_0x35a808=_[_0xdcd4('0x43')]({},_0x35a808,_0x392bc3[_0xdcd4('0x44')]);return db[_0xdcd4('0x32')][_0xdcd4('0x4b')](_0x35a808)[_0xdcd4('0x2a')](handleEntityNotFound(_0x1e53ec,null))[_0xdcd4('0x2a')](respondWithResult(_0x1e53ec,null))[_0xdcd4('0x47')](handleError(_0x1e53ec,null));};exports[_0xdcd4('0x4c')]=function(_0x942d98,_0xa91417){return db['JscriptyProject'][_0xdcd4('0x4c')](_0x942d98[_0xdcd4('0x4d')],{})[_0xdcd4('0x2a')](function(_0x472827){var _0x535de8=_0x942d98['user'][_0xdcd4('0x2c')]({'plain':!![]});if(!_0x535de8)throw new Error(_0xdcd4('0x4e'));if(_0x535de8['role']==='user'){var _0x5a1695=_0x472827[_0xdcd4('0x2c')]({'plain':!![]});var _0x4b7457=_0xdcd4('0x2d');return db[_0xdcd4('0x4f')][_0xdcd4('0x4b')]({'where':{'name':_0x4b7457,'userProfileId':_0x535de8[_0xdcd4('0x50')]},'raw':!![]})['then'](function(_0x1bc801){if(_0x1bc801&&_0x1bc801[_0xdcd4('0x51')]===0x0){return db['UserProfileResource'][_0xdcd4('0x4c')]({'name':_0x5a1695[_0xdcd4('0x2f')],'resourceId':_0x5a1695['id'],'type':_0x1bc801[_0xdcd4('0x2f')],'sectionId':_0x1bc801['id']},{})[_0xdcd4('0x2a')](function(){return _0x472827;});}else{return _0x472827;}})['catch'](function(_0x4ce6bc){logger[_0xdcd4('0x52')](_0xdcd4('0x53'),_0x4ce6bc);throw _0x4ce6bc;});}return _0x472827;})[_0xdcd4('0x2a')](respondWithResult(_0xa91417,0xc9))[_0xdcd4('0x47')](handleError(_0xa91417,null));};exports[_0xdcd4('0x54')]=function(_0x5ecd77,_0xa1e423){var _0x4a8f5b={'where':{'id':_0x5ecd77[_0xdcd4('0x49')]['id']}},_0x3b133b={};_0x3b133b[_0xdcd4('0x36')]=_[_0xdcd4('0x4a')](db[_0xdcd4('0x32')]['rawAttributes']);_0x4a8f5b['attributes']=_['intersection'](_0x3b133b[_0xdcd4('0x36')],qs[_0xdcd4('0x3b')](_0x5ecd77[_0xdcd4('0x37')][_0xdcd4('0x3b')]));_0x4a8f5b[_0xdcd4('0x3a')]=_0x4a8f5b[_0xdcd4('0x3a')]['length']?_0x4a8f5b[_0xdcd4('0x3a')]:_0x3b133b[_0xdcd4('0x36')];if(_0x5ecd77[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x4a8f5b[_0xdcd4('0x46')]=[{'all':!![]}];}_0x4a8f5b=_[_0xdcd4('0x43')]({},_0x4a8f5b,_0x5ecd77[_0xdcd4('0x44')]);return db[_0xdcd4('0x32')][_0xdcd4('0x4b')](_0x4a8f5b)[_0xdcd4('0x2a')](handleEntityNotFound(_0xa1e423,null))[_0xdcd4('0x2a')](function(_0x1293f4){if(_0x1293f4){var _0x40ad2a=_0x1293f4['get']({'plain':!![]});_0x40ad2a=qs[_0xdcd4('0x55')](_0x40ad2a,['id',_0xdcd4('0x56'),'updatedAt']);_0x5ecd77[_0xdcd4('0x4d')]=_[_0xdcd4('0x55')](_0x5ecd77['body'],['id',_0xdcd4('0x56'),_0xdcd4('0x57')]);return db[_0xdcd4('0x32')][_0xdcd4('0x4c')](_[_0xdcd4('0x43')](_0x40ad2a,_0x5ecd77[_0xdcd4('0x4d')]),{'include':_0x5ecd77['query'][_0xdcd4('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x3bef7c){var _0xf41e7b=_0x5ecd77[_0xdcd4('0x58')]['get']({'plain':!![]});if(!_0xf41e7b)throw new Error(_0xdcd4('0x4e'));if(_0xf41e7b['role']==='user'){var _0x37d222=_0x3bef7c['get']({'plain':!![]});var _0x5a3402=_0xdcd4('0x2d');return db[_0xdcd4('0x4f')][_0xdcd4('0x4b')]({'where':{'name':_0x5a3402,'userProfileId':_0xf41e7b[_0xdcd4('0x50')]},'raw':!![]})[_0xdcd4('0x2a')](function(_0xb0bf48){if(_0xb0bf48&&_0xb0bf48[_0xdcd4('0x51')]===0x0){return db[_0xdcd4('0x2e')][_0xdcd4('0x4c')]({'name':_0x37d222[_0xdcd4('0x2f')],'resourceId':_0x37d222['id'],'type':_0xb0bf48[_0xdcd4('0x2f')],'sectionId':_0xb0bf48['id']},{})['then'](function(){return _0x3bef7c;});}else{return _0x3bef7c;}})['catch'](function(_0x3fa3de){logger[_0xdcd4('0x52')](_0xdcd4('0x53'),_0x3fa3de);throw _0x3fa3de;});}return _0x3bef7c;});}})[_0xdcd4('0x2a')](respondWithResult(_0xa1e423,0xc9))[_0xdcd4('0x47')](handleError(_0xa1e423,null));};exports['update']=function(_0x22e94a,_0x4048c9){if(_0x22e94a[_0xdcd4('0x4d')]['id']){delete _0x22e94a['body']['id'];}return db[_0xdcd4('0x32')]['find']({'where':{'id':_0x22e94a[_0xdcd4('0x49')]['id']}})[_0xdcd4('0x2a')](handleEntityNotFound(_0x4048c9,null))[_0xdcd4('0x2a')](saveUpdates(_0x22e94a[_0xdcd4('0x4d')],null))['then'](respondWithResult(_0x4048c9,null))[_0xdcd4('0x47')](handleError(_0x4048c9,null));};exports[_0xdcd4('0x2b')]=function(_0x1c117f,_0x580fca){return db['JscriptyProject'][_0xdcd4('0x4b')]({'where':{'id':_0x1c117f[_0xdcd4('0x49')]['id']}})[_0xdcd4('0x2a')](handleEntityNotFound(_0x580fca,null))[_0xdcd4('0x2a')](removeEntity(_0x580fca,null))['catch'](handleError(_0x580fca,null));};exports[_0xdcd4('0x59')]=function(_0x1ebdc7,_0x1ebcc1,_0x18aaa1){var _0x466a49={'raw':!![],'where':{}};var _0x2c29b2={};var _0x107b2f={'count':0x0,'rows':[]};return db[_0xdcd4('0x32')][_0xdcd4('0x5a')]({'where':{'id':_0x1ebdc7['params']['id']}})['then'](handleEntityNotFound(_0x1ebcc1,null))['then'](function(_0xda61ca){if(_0xda61ca){_0x2c29b2['model']=_[_0xdcd4('0x4a')](db[_0xdcd4('0x5b')][_0xdcd4('0x33')]);_0x2c29b2[_0xdcd4('0x37')]=_[_0xdcd4('0x4a')](_0x1ebdc7['query']);_0x2c29b2[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x2c29b2['model'],_0x2c29b2[_0xdcd4('0x37')]);_0x466a49['attributes']=_[_0xdcd4('0x39')](_0x2c29b2[_0xdcd4('0x36')],qs['fields'](_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x3b')]));_0x466a49[_0xdcd4('0x3a')]=_0x466a49['attributes']['length']?_0x466a49[_0xdcd4('0x3a')]:_0x2c29b2[_0xdcd4('0x36')];if(!_0x1ebdc7['query'][_0xdcd4('0x5c')]('nolimit')){_0x466a49[_0xdcd4('0x23')]=qs[_0xdcd4('0x23')](_0x1ebdc7['query']['limit']);_0x466a49[_0xdcd4('0x21')]=qs[_0xdcd4('0x21')](_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x21')]);}_0x466a49[_0xdcd4('0x5d')]=qs[_0xdcd4('0x5e')](_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x5e')]);_0x466a49['where']=qs[_0xdcd4('0x38')](_[_0xdcd4('0x3f')](_0x1ebdc7['query'],_0x2c29b2['filters']));_0x466a49['where']['ProjectId']=_0xda61ca['id'];if(_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x40')]){_0x466a49['where']=_['merge'](_0x466a49[_0xdcd4('0x3e')],{'$or':_[_0xdcd4('0x31')](_0x466a49[_0xdcd4('0x3a')],function(_0x18a215){var _0x3e8390={};_0x3e8390[_0x18a215]={'$like':'%'+_0x1ebdc7['query']['filter']+'%'};return _0x3e8390;})});}_0x466a49=_[_0xdcd4('0x43')]({},_0x466a49,_0x1ebdc7[_0xdcd4('0x44')]);return db[_0xdcd4('0x5b')][_0xdcd4('0x24')]({'where':_0x466a49[_0xdcd4('0x3e')]})[_0xdcd4('0x2a')](function(_0xf623ed){_0x107b2f[_0xdcd4('0x24')]=_0xf623ed;if(_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x466a49['include']=[{'all':!![]}];}return db[_0xdcd4('0x5b')][_0xdcd4('0x5f')](_0x466a49);})['then'](function(_0x55d517){_0x107b2f[_0xdcd4('0x60')]=_0x55d517;return _0x107b2f;});}})[_0xdcd4('0x2a')](respondWithFilteredResult(_0x1ebcc1,_0x466a49))[_0xdcd4('0x47')](handleError(_0x1ebcc1,null));};exports[_0xdcd4('0x61')]=function(_0x5a60cb,_0x3e4f01,_0x5d1853){var _0x36eb6d={'raw':!![],'where':{}};var _0x361725={};var _0x11f15d={'count':0x0,'rows':[]};return db[_0xdcd4('0x32')]['findOne']({'where':{'id':_0x5a60cb[_0xdcd4('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e4f01,null))[_0xdcd4('0x2a')](function(_0x22435c){if(_0x22435c){_0x361725[_0xdcd4('0x36')]=_['keys'](db['JscriptyAnswerReport'][_0xdcd4('0x33')]);_0x361725[_0xdcd4('0x37')]=_[_0xdcd4('0x4a')](_0x5a60cb['query']);_0x361725[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x361725['model'],_0x361725[_0xdcd4('0x37')]);_0x36eb6d[_0xdcd4('0x3a')]=_[_0xdcd4('0x39')](_0x361725[_0xdcd4('0x36')],qs[_0xdcd4('0x3b')](_0x5a60cb[_0xdcd4('0x37')]['fields']));_0x36eb6d[_0xdcd4('0x3a')]=_0x36eb6d[_0xdcd4('0x3a')][_0xdcd4('0x3c')]?_0x36eb6d[_0xdcd4('0x3a')]:_0x361725[_0xdcd4('0x36')];if(!_0x5a60cb['query'][_0xdcd4('0x5c')]('nolimit')){_0x36eb6d[_0xdcd4('0x23')]=qs['limit'](_0x5a60cb[_0xdcd4('0x37')][_0xdcd4('0x23')]);_0x36eb6d[_0xdcd4('0x21')]=qs[_0xdcd4('0x21')](_0x5a60cb[_0xdcd4('0x37')]['offset']);}_0x36eb6d[_0xdcd4('0x5d')]=qs['sort'](_0x5a60cb[_0xdcd4('0x37')][_0xdcd4('0x5e')]);_0x36eb6d[_0xdcd4('0x3e')]=qs[_0xdcd4('0x38')](_[_0xdcd4('0x3f')](_0x5a60cb['query'],_0x361725[_0xdcd4('0x38')]));_0x36eb6d[_0xdcd4('0x3e')][_0xdcd4('0x62')]=_0x22435c['id'];if(_0x5a60cb['query'][_0xdcd4('0x40')]){_0x36eb6d[_0xdcd4('0x3e')]=_['merge'](_0x36eb6d['where'],{'$or':_['map'](_0x36eb6d[_0xdcd4('0x3a')],function(_0x5e2085){var _0x5dc68d={};_0x5dc68d[_0x5e2085]={'$like':'%'+_0x5a60cb[_0xdcd4('0x37')]['filter']+'%'};return _0x5dc68d;})});}_0x36eb6d=_[_0xdcd4('0x43')]({},_0x36eb6d,_0x5a60cb['options']);return db['JscriptyAnswerReport'][_0xdcd4('0x24')]({'where':_0x36eb6d[_0xdcd4('0x3e')]})[_0xdcd4('0x2a')](function(_0x4d2b28){_0x11f15d['count']=_0x4d2b28;if(_0x5a60cb[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x36eb6d[_0xdcd4('0x46')]=[{'all':!![]}];}return db[_0xdcd4('0x63')]['findAll'](_0x36eb6d);})[_0xdcd4('0x2a')](function(_0x4ddc72){_0x11f15d[_0xdcd4('0x60')]=_0x4ddc72;return _0x11f15d;});}})['then'](respondWithFilteredResult(_0x3e4f01,_0x36eb6d))[_0xdcd4('0x47')](handleError(_0x3e4f01,null));};function char(_0x256c6a){return _0xdcd4('0x64')===typeof _0x256c6a?String[_0xdcd4('0x65')][_0xdcd4('0x27')](null,arguments):_0x256c6a;}function needsEncapsulation(_0x4b8209){return!!_0x4b8209&&(_0x4b8209[_0xdcd4('0x66')]()['indexOf'](char(0xd))>=0x0||_0x4b8209[_0xdcd4('0x66')]()['indexOf'](char(0xa))>=0x0||_0x4b8209[_0xdcd4('0x66')]()[_0xdcd4('0x67')](char(0x2c))>=0x0||_0x4b8209['toString']()[_0xdcd4('0x67')](char(0x22))>=0x0);}function encapsulate(_0x34b90b){var _0x5c9db3=char(0x22),_0x143cdc='\x5c'+char(0x22),_0x2d0f2a=_0x34b90b[_0xdcd4('0x66')]()['replace'](new RegExp(_0x5c9db3,'g'),_0x143cdc);return _0x5c9db3+_0x2d0f2a+_0x5c9db3;}exports[_0xdcd4('0x68')]=function(_0x4d152c,_0x4776ff,_0x39503a){var _0x595da1,_0x174ced;var _0x265fb0={'where':{'ProjectId':_0x4d152c[_0xdcd4('0x49')]['id']}};if(_0x4d152c[_0xdcd4('0x37')][_0xdcd4('0x69')]){_0x265fb0[_0xdcd4('0x3e')][_0xdcd4('0x6a')]=JSON[_0xdcd4('0x6b')](_0x4d152c[_0xdcd4('0x37')][_0xdcd4('0x69')]);}return db[_0xdcd4('0x5b')][_0xdcd4('0x5f')](_0x265fb0)[_0xdcd4('0x2a')](handleEntityNotFound(_0x4776ff,null))['then'](function(_0x3aed9c){if(_0x3aed9c){_0x595da1=_0x3aed9c;return db['JscriptyQuestionReport'][_0xdcd4('0x5f')]({'where':{'SessionId':{'$in':_[_0xdcd4('0x31')](_0x595da1,'id')},'ProjectId':_0x4d152c[_0xdcd4('0x49')]['id']},'order':_0xdcd4('0x6c')});}})['then'](handleEntityNotFound(_0x4776ff,null))[_0xdcd4('0x2a')](function(_0x2d332f){if(_0x2d332f){_0x174ced=_0x2d332f;var _0x389718={};for(var _0xbefcff=0x0,_0x3316b5=_0x174ced[_0xdcd4('0x3c')];_0xbefcff<_0x3316b5;_0xbefcff++){if(!_0x389718[_0xdcd4('0x5c')](_0x174ced[_0xbefcff][_0xdcd4('0x6d')])){_0x389718[_0x174ced[_0xbefcff][_0xdcd4('0x6d')]]=needsEncapsulation(_0x174ced[_0xbefcff][_0xdcd4('0x6e')])?encapsulate(_0x174ced[_0xbefcff][_0xdcd4('0x6e')]):_0x174ced[_0xbefcff][_0xdcd4('0x6e')];}}var _0x3d65cc=[],_0x35a64a={};for(var _0x1f5b59=0x0,_0x412bea=_0x595da1['length'];_0x1f5b59<_0x412bea;_0x1f5b59++){_0x35a64a={'ProjectId':_0x4d152c[_0xdcd4('0x49')]['id'],'SessionId':_0x595da1[_0x1f5b59]['id'],'StartTime':moment(_0x595da1[_0x1f5b59][_0xdcd4('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5b09ff=0x0,_0x492808=_0x174ced[_0xdcd4('0x3c')];_0x5b09ff<_0x492808;_0x5b09ff++){if(_0x174ced[_0x5b09ff][_0xdcd4('0x6f')]==_0x595da1[_0x1f5b59]['id']&&_0x389718['hasOwnProperty'](_0x174ced[_0x5b09ff][_0xdcd4('0x6d')])){_0x35a64a[_0x389718[_0x174ced[_0x5b09ff]['questionId']]]=_0x174ced[_0x5b09ff][_0xdcd4('0x70')];}}for(var _0x2f2c6a in _0x389718){if(!_0x35a64a[_0xdcd4('0x5c')](_0x389718[_0x2f2c6a])){_0x35a64a[_0x389718[_0x2f2c6a]]=null;}}_0x3d65cc[_0xdcd4('0x71')](_0x35a64a);}return _0x3d65cc;}})[_0xdcd4('0x2a')](function(_0x401529){if(!_[_0xdcd4('0x72')](_0x401529)){var _0x452a9c=toCsv(_0x401529);var _0xb56a81=Date[_0xdcd4('0x73')]();fs[_0xdcd4('0x74')](util['format'](_0xdcd4('0x75'),_0x4d152c[_0xdcd4('0x49')]['id'],_0xb56a81),_0x452a9c);_0x4776ff[_0xdcd4('0x76')](_0xdcd4('0x77'),_0xdcd4('0x78')+util[_0xdcd4('0x79')]('Jscripty_Project_%d_Summary_%s.csv',_0x4d152c[_0xdcd4('0x49')]['id'],_0xb56a81));_0x4776ff[_0xdcd4('0x76')](_0xdcd4('0x7a'),_0xdcd4('0x7b'));return _0x4776ff['download'](util[_0xdcd4('0x79')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4d152c['params']['id'],_0xb56a81));}else{return _0x4776ff['sendStatus'](0xcc);}})[_0xdcd4('0x47')](handleError(_0x4776ff,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 39f7554..30fc886 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 _0x4e00=['moment','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','util','api'];(function(_0x2e937e,_0x925b29){var _0xb9cb1b=function(_0x3fea3a){while(--_0x3fea3a){_0x2e937e['push'](_0x2e937e['shift']());}};_0xb9cb1b(++_0x925b29);}(_0x4e00,0xa0));var _0x04e0=function(_0x369052,_0x2ad636){_0x369052=_0x369052-0x0;var _0x5b460d=_0x4e00[_0x369052];return _0x5b460d;};'use strict';var _=require('lodash');var util=require(_0x04e0('0x0'));var logger=require('../../config/logger')(_0x04e0('0x1'));var moment=require(_0x04e0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04e0('0x3'));var rimraf=require('rimraf');var config=require(_0x04e0('0x4'));var attributes=require(_0x04e0('0x5'));module[_0x04e0('0x6')]=function(_0x2a5402,_0x424fec){return _0x2a5402[_0x04e0('0x7')](_0x04e0('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a4=['./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x28bb12,_0x20dba5){var _0x4b9577=function(_0x1fc967){while(--_0x1fc967){_0x28bb12['push'](_0x28bb12['shift']());}};_0x4b9577(++_0x20dba5);}(_0x56a4,0x11b));var _0x456a=function(_0x43d106,_0x96a475){_0x43d106=_0x43d106-0x0;var _0x2160bc=_0x56a4[_0x43d106];return _0x2160bc;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('JscriptyProject',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 485032c..581d4c2 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x17eccb,_0x265b28){var _0x5b72fe=function(_0x22d3e1){while(--_0x22d3e1){_0x17eccb['push'](_0x17eccb['shift']());}};_0x5b72fe(++_0x265b28);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xcb91[_0x57e00e];return _0x415e60;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac4a,0x13f));var _0xaac4=function(_0x22b9a7,_0x455ea6){_0x22b9a7=_0x22b9a7-0x0;var _0x4ce0bb=_0xac4a[_0x22b9a7];return _0x4ce0bb;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e0b4051..7b16cae 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 _0xeea0=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','destroy','exports','multer'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xeea0,0xe9));var _0x0eea=function(_0x3502ed,_0x358159){_0x3502ed=_0x3502ed-0x0;var _0x58d710=_0xeea0[_0x3502ed];return _0x58d710;};'use strict';var multer=require(_0x0eea('0x0'));var util=require('util');var path=require(_0x0eea('0x1'));var timeout=require(_0x0eea('0x2'));var express=require(_0x0eea('0x3'));var router=express[_0x0eea('0x4')]();var fs_extra=require(_0x0eea('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0eea('0x6'));var controller=require(_0x0eea('0x7'));router[_0x0eea('0x8')]('/',auth['isAuthenticated'](),controller[_0x0eea('0x9')]);router[_0x0eea('0x8')](_0x0eea('0xa'),auth[_0x0eea('0xb')](),controller['describe']);router[_0x0eea('0x8')](_0x0eea('0xc'),auth['isAuthenticated'](),controller[_0x0eea('0xd')]);router[_0x0eea('0xe')]('/',auth[_0x0eea('0xb')](),controller['create']);router[_0x0eea('0xf')]('/:id',auth[_0x0eea('0xb')](),controller['update']);router['delete'](_0x0eea('0xc'),auth[_0x0eea('0xb')](),controller[_0x0eea('0x10')]);module[_0x0eea('0x11')]=router; \ No newline at end of file +var _0x19dd=['create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xf7081d,_0x30aef2){var _0x20a813=function(_0x4d6619){while(--_0x4d6619){_0xf7081d['push'](_0xf7081d['shift']());}};_0x20a813(++_0x30aef2);}(_0x19dd,0x1e9));var _0xd19d=function(_0x2db20e,_0x16ba57){_0x2db20e=_0x2db20e-0x0;var _0x126722=_0x19dd[_0x2db20e];return _0x126722;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd19d('0x0'));var timeout=require(_0xd19d('0x1'));var express=require(_0xd19d('0x2'));var router=express[_0xd19d('0x3')]();var fs_extra=require(_0xd19d('0x4'));var auth=require(_0xd19d('0x5'));var interaction=require(_0xd19d('0x6'));var config=require(_0xd19d('0x7'));var controller=require(_0xd19d('0x8'));router[_0xd19d('0x9')]('/',auth[_0xd19d('0xa')](),controller[_0xd19d('0xb')]);router[_0xd19d('0x9')](_0xd19d('0xc'),auth[_0xd19d('0xa')](),controller[_0xd19d('0xd')]);router[_0xd19d('0x9')](_0xd19d('0xe'),auth[_0xd19d('0xa')](),controller[_0xd19d('0xf')]);router[_0xd19d('0x10')]('/',auth[_0xd19d('0xa')](),controller[_0xd19d('0x11')]);router[_0xd19d('0x12')](_0xd19d('0xe'),auth[_0xd19d('0xa')](),controller[_0xd19d('0x13')]);router[_0xd19d('0x14')]('/:id',auth[_0xd19d('0xa')](),controller['destroy']);module[_0xd19d('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 239d0c0..2c31279 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x196ece,_0x1b156a){_0x196ece=_0x196ece-0x0;var _0x37d434=_0x7a54[_0x196ece];return _0x37d434;};'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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x46734f,_0x16d7de){_0x46734f=_0x46734f-0x0;var _0x2fff67=_0x7a54[_0x46734f];return _0x2fff67;};'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 85ec3a7..e459f8e 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 _0xbb59=['offset','undefined','count','limit','json','reject','save','update','error','name','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','includeAll','include','then','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xbb59,0x18f));var _0x9bb5=function(_0x3cf295,_0x26aa6b){_0x3cf295=_0x3cf295-0x0;var _0x59325c=_0xbb59[_0x3cf295];return _0x59325c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bb5('0x0'));var zipdir=require(_0x9bb5('0x1'));var jsonpatch=require(_0x9bb5('0x2'));var rp=require(_0x9bb5('0x3'));var moment=require('moment');var BPromise=require(_0x9bb5('0x4'));var Mustache=require(_0x9bb5('0x5'));var util=require(_0x9bb5('0x6'));var path=require(_0x9bb5('0x7'));var sox=require('sox');var csv=require(_0x9bb5('0x8'));var ejs=require(_0x9bb5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9bb5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9bb5('0xb'));var toCsv=require(_0x9bb5('0x8'));var querystring=require(_0x9bb5('0xc'));var Papa=require(_0x9bb5('0xd'));var Redis=require(_0x9bb5('0xe'));var authService=require(_0x9bb5('0xf'));var qs=require(_0x9bb5('0x10'));var as=require(_0x9bb5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9bb5('0x12'))(_0x9bb5('0x13'));var utils=require(_0x9bb5('0x14'));var config=require(_0x9bb5('0x15'));var licenseUtil=require(_0x9bb5('0x16'));var db=require(_0x9bb5('0x17'))['db'];function respondWithStatusCode(_0x2f128a,_0x1ab268){_0x1ab268=_0x1ab268||0xcc;return function(_0x50a7a0){if(_0x50a7a0){return _0x2f128a[_0x9bb5('0x18')](_0x1ab268);}return _0x2f128a[_0x9bb5('0x19')](_0x1ab268)[_0x9bb5('0x1a')]();};}function respondWithResult(_0x378fc5,_0x25e681){_0x25e681=_0x25e681||0xc8;return function(_0x2875f1){if(_0x2875f1){return _0x378fc5[_0x9bb5('0x19')](_0x25e681)['json'](_0x2875f1);}};}function respondWithFilteredResult(_0x5c4e77,_0x123bc4){return function(_0x19ffac){if(_0x19ffac){var _0x5d37d7=typeof _0x123bc4[_0x9bb5('0x1b')]===_0x9bb5('0x1c')&&typeof _0x123bc4['limit']===_0x9bb5('0x1c');var _0x3b5d8d=_0x19ffac['count'];var _0x577c64=_0x5d37d7?0x0:_0x123bc4[_0x9bb5('0x1b')];var _0x159252=_0x5d37d7?_0x19ffac[_0x9bb5('0x1d')]:_0x123bc4[_0x9bb5('0x1b')]+_0x123bc4[_0x9bb5('0x1e')];var _0x5d2fe5;if(_0x159252>=_0x3b5d8d){_0x159252=_0x3b5d8d;_0x5d2fe5=0xc8;}else{_0x5d2fe5=0xce;}_0x5c4e77['status'](_0x5d2fe5);return _0x5c4e77['set']('Content-Range',_0x577c64+'-'+_0x159252+'/'+_0x3b5d8d)[_0x9bb5('0x1f')](_0x19ffac);}return null;};}function patchUpdates(_0x571fd5){return function(_0x37d893){try{jsonpatch['apply'](_0x37d893,_0x571fd5,!![]);}catch(_0x23c805){return BPromise[_0x9bb5('0x20')](_0x23c805);}return _0x37d893[_0x9bb5('0x21')]();};}function saveUpdates(_0xf5b9d6,_0x5d8594){return function(_0xcc1373){if(_0xcc1373){return _0xcc1373[_0x9bb5('0x22')](_0xf5b9d6)['then'](function(_0x7c5435){return _0x7c5435;});}return null;};}function removeEntity(_0x26f4d0,_0x136e5f){return function(_0x3c691e){if(_0x3c691e){return _0x3c691e['destroy']()['then'](function(){_0x26f4d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5406bb,_0x50f9db){return function(_0x4ad346){if(!_0x4ad346){_0x5406bb[_0x9bb5('0x18')](0x194);}return _0x4ad346;};}function handleError(_0x1ae890,_0x10e4b4){_0x10e4b4=_0x10e4b4||0x1f4;return function(_0x5b0dba){logger[_0x9bb5('0x23')](_0x5b0dba['stack']);if(_0x5b0dba[_0x9bb5('0x24')]){delete _0x5b0dba[_0x9bb5('0x24')];}_0x1ae890['status'](_0x10e4b4)['send'](_0x5b0dba);};}exports[_0x9bb5('0x25')]=function(_0x4dbba3,_0x2f34c8){var _0x17a36d={},_0x4283b9={},_0x295b7c={'count':0x0,'rows':[]};var _0x382bbf=_[_0x9bb5('0x26')](db[_0x9bb5('0x27')][_0x9bb5('0x28')],function(_0x554bf2){return{'name':_0x554bf2['fieldName'],'type':_0x554bf2[_0x9bb5('0x29')][_0x9bb5('0x2a')]};});_0x4283b9[_0x9bb5('0x2b')]=_['map'](_0x382bbf,_0x9bb5('0x24'));_0x4283b9[_0x9bb5('0x2c')]=_[_0x9bb5('0x2d')](_0x4dbba3[_0x9bb5('0x2c')]);_0x4283b9[_0x9bb5('0x2e')]=_[_0x9bb5('0x2f')](_0x4283b9['model'],_0x4283b9[_0x9bb5('0x2c')]);_0x17a36d['attributes']=_[_0x9bb5('0x2f')](_0x4283b9[_0x9bb5('0x2b')],qs['fields'](_0x4dbba3[_0x9bb5('0x2c')][_0x9bb5('0x30')]));_0x17a36d[_0x9bb5('0x31')]=_0x17a36d[_0x9bb5('0x31')][_0x9bb5('0x32')]?_0x17a36d[_0x9bb5('0x31')]:_0x4283b9[_0x9bb5('0x2b')];if(!_0x4dbba3[_0x9bb5('0x2c')][_0x9bb5('0x33')](_0x9bb5('0x34'))){_0x17a36d[_0x9bb5('0x1e')]=qs[_0x9bb5('0x1e')](_0x4dbba3[_0x9bb5('0x2c')][_0x9bb5('0x1e')]);_0x17a36d['offset']=qs[_0x9bb5('0x1b')](_0x4dbba3[_0x9bb5('0x2c')][_0x9bb5('0x1b')]);}_0x17a36d['order']=qs['sort'](_0x4dbba3[_0x9bb5('0x2c')][_0x9bb5('0x35')]);_0x17a36d['where']=qs[_0x9bb5('0x2e')](_[_0x9bb5('0x36')](_0x4dbba3[_0x9bb5('0x2c')],_0x4283b9[_0x9bb5('0x2e')]),_0x382bbf);if(_0x4dbba3[_0x9bb5('0x2c')]['filter']){_0x17a36d['where']=_[_0x9bb5('0x37')](_0x17a36d[_0x9bb5('0x38')],{'$or':_[_0x9bb5('0x26')](_0x382bbf,function(_0x541178){if(_0x541178[_0x9bb5('0x29')]!==_0x9bb5('0x39')){var _0x1f4fcf={};_0x1f4fcf[_0x541178['name']]={'$like':'%'+_0x4dbba3['query'][_0x9bb5('0x3a')]+'%'};return _0x1f4fcf;}})});}_0x17a36d=_[_0x9bb5('0x37')]({},_0x17a36d,_0x4dbba3['options']);var _0x3ead19={'where':_0x17a36d[_0x9bb5('0x38')]};return db[_0x9bb5('0x27')]['count'](_0x3ead19)['then'](function(_0x3f9f88){_0x295b7c[_0x9bb5('0x1d')]=_0x3f9f88;if(_0x4dbba3['query'][_0x9bb5('0x3b')]){_0x17a36d[_0x9bb5('0x3c')]=[{'all':!![]}];}return db[_0x9bb5('0x27')]['findAll'](_0x17a36d);})[_0x9bb5('0x3d')](function(_0x58e31b){_0x295b7c[_0x9bb5('0x3e')]=_0x58e31b;return _0x295b7c;})[_0x9bb5('0x3d')](respondWithFilteredResult(_0x2f34c8,_0x17a36d))[_0x9bb5('0x3f')](handleError(_0x2f34c8,null));};exports[_0x9bb5('0x40')]=function(_0x3c14ca,_0x289d5c){var _0x33bff0={'raw':!![],'where':{'id':_0x3c14ca[_0x9bb5('0x41')]['id']}},_0x203eab={};_0x203eab[_0x9bb5('0x2b')]=_[_0x9bb5('0x2d')](db[_0x9bb5('0x27')]['rawAttributes']);_0x203eab[_0x9bb5('0x2c')]=_['keys'](_0x3c14ca[_0x9bb5('0x2c')]);_0x203eab[_0x9bb5('0x2e')]=_[_0x9bb5('0x2f')](_0x203eab['model'],_0x203eab[_0x9bb5('0x2c')]);_0x33bff0[_0x9bb5('0x31')]=_[_0x9bb5('0x2f')](_0x203eab[_0x9bb5('0x2b')],qs[_0x9bb5('0x30')](_0x3c14ca[_0x9bb5('0x2c')]['fields']));_0x33bff0['attributes']=_0x33bff0['attributes'][_0x9bb5('0x32')]?_0x33bff0[_0x9bb5('0x31')]:_0x203eab[_0x9bb5('0x2b')];if(_0x3c14ca[_0x9bb5('0x2c')][_0x9bb5('0x3b')]){_0x33bff0[_0x9bb5('0x3c')]=[{'all':!![]}];}_0x33bff0=_[_0x9bb5('0x37')]({},_0x33bff0,_0x3c14ca['options']);return db[_0x9bb5('0x27')][_0x9bb5('0x42')](_0x33bff0)['then'](handleEntityNotFound(_0x289d5c,null))[_0x9bb5('0x3d')](respondWithResult(_0x289d5c,null))[_0x9bb5('0x3f')](handleError(_0x289d5c,null));};exports[_0x9bb5('0x43')]=function(_0x556526,_0x7ef588){return db[_0x9bb5('0x27')]['create'](_0x556526[_0x9bb5('0x44')],{})['then'](respondWithResult(_0x7ef588,0xc9))['catch'](handleError(_0x7ef588,null));};exports['update']=function(_0x5d1949,_0x280675){if(_0x5d1949['body']['id']){delete _0x5d1949[_0x9bb5('0x44')]['id'];}return db[_0x9bb5('0x27')]['find']({'where':{'id':_0x5d1949[_0x9bb5('0x41')]['id']}})['then'](handleEntityNotFound(_0x280675,null))[_0x9bb5('0x3d')](saveUpdates(_0x5d1949[_0x9bb5('0x44')],null))[_0x9bb5('0x3d')](respondWithResult(_0x280675,null))[_0x9bb5('0x3f')](handleError(_0x280675,null));};exports[_0x9bb5('0x45')]=function(_0x4ad7d6,_0x6567f){return db['JscriptyQuestionReport'][_0x9bb5('0x42')]({'where':{'id':_0x4ad7d6[_0x9bb5('0x41')]['id']}})[_0x9bb5('0x3d')](handleEntityNotFound(_0x6567f,null))[_0x9bb5('0x3d')](removeEntity(_0x6567f,null))[_0x9bb5('0x3f')](handleError(_0x6567f,null));};exports[_0x9bb5('0x46')]=function(_0x2ebbe5,_0x429498){return db[_0x9bb5('0x27')][_0x9bb5('0x46')]()[_0x9bb5('0x3d')](respondWithResult(_0x429498,null))[_0x9bb5('0x3f')](handleError(_0x429498,null));}; \ No newline at end of file +var _0x55e4=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','update','destroy','end','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','then','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x3cc248,_0x443931){var _0x2bf7e1=function(_0x57723e){while(--_0x57723e){_0x3cc248['push'](_0x3cc248['shift']());}};_0x2bf7e1(++_0x443931);}(_0x55e4,0x8b));var _0x455e=function(_0xdd3b2b,_0x543d86){_0xdd3b2b=_0xdd3b2b-0x0;var _0x2a7e7a=_0x55e4[_0xdd3b2b];return _0x2a7e7a;};'use strict';var emlformat=require(_0x455e('0x0'));var rimraf=require(_0x455e('0x1'));var zipdir=require(_0x455e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x455e('0x3'));var moment=require(_0x455e('0x4'));var BPromise=require(_0x455e('0x5'));var Mustache=require(_0x455e('0x6'));var util=require(_0x455e('0x7'));var path=require(_0x455e('0x8'));var sox=require('sox');var csv=require(_0x455e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x455e('0xa'));var _=require(_0x455e('0xb'));var squel=require(_0x455e('0xc'));var crypto=require(_0x455e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x455e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x455e('0xf'));var Redis=require(_0x455e('0x10'));var authService=require(_0x455e('0x11'));var qs=require(_0x455e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x455e('0x13'));var logger=require(_0x455e('0x14'))(_0x455e('0x15'));var utils=require(_0x455e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x455e('0x17'));var db=require(_0x455e('0x18'))['db'];function respondWithStatusCode(_0xed7b35,_0x5a8461){_0x5a8461=_0x5a8461||0xcc;return function(_0x3f0601){if(_0x3f0601){return _0xed7b35[_0x455e('0x19')](_0x5a8461);}return _0xed7b35[_0x455e('0x1a')](_0x5a8461)['end']();};}function respondWithResult(_0x7e5a3,_0x5955bc){_0x5955bc=_0x5955bc||0xc8;return function(_0x22532b){if(_0x22532b){return _0x7e5a3[_0x455e('0x1a')](_0x5955bc)[_0x455e('0x1b')](_0x22532b);}};}function respondWithFilteredResult(_0x28035a,_0x175c6b){return function(_0x47035f){if(_0x47035f){var _0x58a3a7=typeof _0x175c6b['offset']===_0x455e('0x1c')&&typeof _0x175c6b['limit']==='undefined';var _0x19b75b=_0x47035f[_0x455e('0x1d')];var _0x1154a8=_0x58a3a7?0x0:_0x175c6b[_0x455e('0x1e')];var _0xa64ed9=_0x58a3a7?_0x47035f[_0x455e('0x1d')]:_0x175c6b['offset']+_0x175c6b[_0x455e('0x1f')];var _0x2bab6a;if(_0xa64ed9>=_0x19b75b){_0xa64ed9=_0x19b75b;_0x2bab6a=0xc8;}else{_0x2bab6a=0xce;}_0x28035a[_0x455e('0x1a')](_0x2bab6a);return _0x28035a['set']('Content-Range',_0x1154a8+'-'+_0xa64ed9+'/'+_0x19b75b)[_0x455e('0x1b')](_0x47035f);}return null;};}function patchUpdates(_0x6d58f5){return function(_0x25d54d){try{jsonpatch[_0x455e('0x20')](_0x25d54d,_0x6d58f5,!![]);}catch(_0x5c1ae5){return BPromise[_0x455e('0x21')](_0x5c1ae5);}return _0x25d54d[_0x455e('0x22')]();};}function saveUpdates(_0x2c2289,_0x5e26d4){return function(_0x3c8f93){if(_0x3c8f93){return _0x3c8f93[_0x455e('0x23')](_0x2c2289)['then'](function(_0x33ea84){return _0x33ea84;});}return null;};}function removeEntity(_0x3d0628,_0x2ce175){return function(_0x1e136b){if(_0x1e136b){return _0x1e136b[_0x455e('0x24')]()['then'](function(){_0x3d0628[_0x455e('0x1a')](0xcc)[_0x455e('0x25')]();});}};}function handleEntityNotFound(_0xc321ed,_0xf91971){return function(_0x18e708){if(!_0x18e708){_0xc321ed[_0x455e('0x19')](0x194);}return _0x18e708;};}function handleError(_0x10e5f8,_0x3168b6){_0x3168b6=_0x3168b6||0x1f4;return function(_0x22e79d){logger[_0x455e('0x26')](_0x22e79d[_0x455e('0x27')]);if(_0x22e79d['name']){delete _0x22e79d[_0x455e('0x28')];}_0x10e5f8[_0x455e('0x1a')](_0x3168b6)[_0x455e('0x29')](_0x22e79d);};}exports['index']=function(_0x4470ae,_0x1990a9){var _0x5586fe={},_0xb72154={},_0x30eedc={'count':0x0,'rows':[]};var _0x568fa9=_[_0x455e('0x2a')](db[_0x455e('0x2b')][_0x455e('0x2c')],function(_0x1abb4b){return{'name':_0x1abb4b[_0x455e('0x2d')],'type':_0x1abb4b['type'][_0x455e('0x2e')]};});_0xb72154['model']=_[_0x455e('0x2a')](_0x568fa9,'name');_0xb72154[_0x455e('0x2f')]=_[_0x455e('0x30')](_0x4470ae[_0x455e('0x2f')]);_0xb72154[_0x455e('0x31')]=_['intersection'](_0xb72154[_0x455e('0x32')],_0xb72154[_0x455e('0x2f')]);_0x5586fe[_0x455e('0x33')]=_['intersection'](_0xb72154['model'],qs[_0x455e('0x34')](_0x4470ae[_0x455e('0x2f')][_0x455e('0x34')]));_0x5586fe['attributes']=_0x5586fe[_0x455e('0x33')][_0x455e('0x35')]?_0x5586fe[_0x455e('0x33')]:_0xb72154[_0x455e('0x32')];if(!_0x4470ae[_0x455e('0x2f')][_0x455e('0x36')]('nolimit')){_0x5586fe[_0x455e('0x1f')]=qs['limit'](_0x4470ae[_0x455e('0x2f')]['limit']);_0x5586fe[_0x455e('0x1e')]=qs[_0x455e('0x1e')](_0x4470ae[_0x455e('0x2f')][_0x455e('0x1e')]);}_0x5586fe[_0x455e('0x37')]=qs[_0x455e('0x38')](_0x4470ae['query'][_0x455e('0x38')]);_0x5586fe[_0x455e('0x39')]=qs['filters'](_[_0x455e('0x3a')](_0x4470ae[_0x455e('0x2f')],_0xb72154['filters']),_0x568fa9);if(_0x4470ae[_0x455e('0x2f')]['filter']){_0x5586fe[_0x455e('0x39')]=_[_0x455e('0x3b')](_0x5586fe[_0x455e('0x39')],{'$or':_[_0x455e('0x2a')](_0x568fa9,function(_0x30c6bb){if(_0x30c6bb['type']!=='VIRTUAL'){var _0x1005b2={};_0x1005b2[_0x30c6bb['name']]={'$like':'%'+_0x4470ae[_0x455e('0x2f')][_0x455e('0x3c')]+'%'};return _0x1005b2;}})});}_0x5586fe=_[_0x455e('0x3b')]({},_0x5586fe,_0x4470ae['options']);var _0x8a4ef1={'where':_0x5586fe[_0x455e('0x39')]};return db[_0x455e('0x2b')][_0x455e('0x1d')](_0x8a4ef1)[_0x455e('0x3d')](function(_0xbea10b){_0x30eedc[_0x455e('0x1d')]=_0xbea10b;if(_0x4470ae[_0x455e('0x2f')][_0x455e('0x3e')]){_0x5586fe['include']=[{'all':!![]}];}return db[_0x455e('0x2b')][_0x455e('0x3f')](_0x5586fe);})[_0x455e('0x3d')](function(_0x206a94){_0x30eedc[_0x455e('0x40')]=_0x206a94;return _0x30eedc;})['then'](respondWithFilteredResult(_0x1990a9,_0x5586fe))[_0x455e('0x41')](handleError(_0x1990a9,null));};exports[_0x455e('0x42')]=function(_0x2eae8b,_0x31833c){var _0x4e6c3a={'raw':!![],'where':{'id':_0x2eae8b[_0x455e('0x43')]['id']}},_0x317f1b={};_0x317f1b[_0x455e('0x32')]=_[_0x455e('0x30')](db['JscriptyQuestionReport'][_0x455e('0x2c')]);_0x317f1b['query']=_[_0x455e('0x30')](_0x2eae8b[_0x455e('0x2f')]);_0x317f1b[_0x455e('0x31')]=_[_0x455e('0x44')](_0x317f1b[_0x455e('0x32')],_0x317f1b[_0x455e('0x2f')]);_0x4e6c3a['attributes']=_['intersection'](_0x317f1b[_0x455e('0x32')],qs[_0x455e('0x34')](_0x2eae8b[_0x455e('0x2f')][_0x455e('0x34')]));_0x4e6c3a[_0x455e('0x33')]=_0x4e6c3a[_0x455e('0x33')][_0x455e('0x35')]?_0x4e6c3a[_0x455e('0x33')]:_0x317f1b[_0x455e('0x32')];if(_0x2eae8b[_0x455e('0x2f')]['includeAll']){_0x4e6c3a[_0x455e('0x45')]=[{'all':!![]}];}_0x4e6c3a=_['merge']({},_0x4e6c3a,_0x2eae8b[_0x455e('0x46')]);return db[_0x455e('0x2b')][_0x455e('0x47')](_0x4e6c3a)[_0x455e('0x3d')](handleEntityNotFound(_0x31833c,null))['then'](respondWithResult(_0x31833c,null))[_0x455e('0x41')](handleError(_0x31833c,null));};exports[_0x455e('0x48')]=function(_0x9cf26b,_0x1e1ffd){return db[_0x455e('0x2b')][_0x455e('0x48')](_0x9cf26b['body'],{})[_0x455e('0x3d')](respondWithResult(_0x1e1ffd,0xc9))['catch'](handleError(_0x1e1ffd,null));};exports[_0x455e('0x23')]=function(_0x2b5e2c,_0xb1a887){if(_0x2b5e2c[_0x455e('0x49')]['id']){delete _0x2b5e2c[_0x455e('0x49')]['id'];}return db[_0x455e('0x2b')][_0x455e('0x47')]({'where':{'id':_0x2b5e2c['params']['id']}})['then'](handleEntityNotFound(_0xb1a887,null))['then'](saveUpdates(_0x2b5e2c[_0x455e('0x49')],null))[_0x455e('0x3d')](respondWithResult(_0xb1a887,null))[_0x455e('0x41')](handleError(_0xb1a887,null));};exports[_0x455e('0x24')]=function(_0x1d84f2,_0x2945c2){return db['JscriptyQuestionReport'][_0x455e('0x47')]({'where':{'id':_0x1d84f2[_0x455e('0x43')]['id']}})['then'](handleEntityNotFound(_0x2945c2,null))[_0x455e('0x3d')](removeEntity(_0x2945c2,null))[_0x455e('0x41')](handleError(_0x2945c2,null));};exports[_0x455e('0x4a')]=function(_0x12779c,_0x210847){return db['JscriptyQuestionReport'][_0x455e('0x4a')]()[_0x455e('0x3d')](respondWithResult(_0x210847,null))[_0x455e('0x41')](handleError(_0x210847,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 093c013..99ffb9e 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 _0x7dad=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1fa680,_0x56d9b7){var _0x1d7c4e=function(_0x3e50e3){while(--_0x3e50e3){_0x1fa680['push'](_0x1fa680['shift']());}};_0x1d7c4e(++_0x56d9b7);}(_0x7dad,0x1cc));var _0xd7da=function(_0x2e4eef,_0x1cb476){_0x2e4eef=_0x2e4eef-0x0;var _0x2a8428=_0x7dad[_0x2e4eef];return _0x2a8428;};'use strict';var _=require(_0xd7da('0x0'));var util=require('util');var logger=require(_0xd7da('0x1'))(_0xd7da('0x2'));var moment=require(_0xd7da('0x3'));var BPromise=require(_0xd7da('0x4'));var rp=require(_0xd7da('0x5'));var fs=require('fs');var path=require(_0xd7da('0x6'));var rimraf=require(_0xd7da('0x7'));var config=require(_0xd7da('0x8'));var attributes=require(_0xd7da('0x9'));module[_0xd7da('0xa')]=function(_0x51c622,_0x26b9a4){return _0x51c622[_0xd7da('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0xd7da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a9d=['exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1a9d,0x1c6));var _0xd1a9=function(_0x125bfa,_0x43e986){_0x125bfa=_0x125bfa-0x0;var _0x29613f=_0x1a9d[_0x125bfa];return _0x29613f;};'use strict';var _=require(_0xd1a9('0x0'));var util=require(_0xd1a9('0x1'));var logger=require(_0xd1a9('0x2'))(_0xd1a9('0x3'));var moment=require(_0xd1a9('0x4'));var BPromise=require(_0xd1a9('0x5'));var rp=require(_0xd1a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1a9('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0xd1a9('0x8')]=function(_0x1fdb0a,_0x2a295e){return _0x1fdb0a[_0xd1a9('0x9')](_0xd1a9('0xa'),attributes,{'tableName':'report_jscripty_questions','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 965894c..28ea653 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 _0xa152=['message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xa152,0x1dd));var _0x2a15=function(_0x46363f,_0x37c62e){_0x46363f=_0x46363f-0x0;var _0x5bc670=_0xa152[_0x46363f];return _0x5bc670;};'use strict';var _=require(_0x2a15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2a15('0x1'));var fs=require('fs');var Redis=require(_0x2a15('0x2'));var db=require(_0x2a15('0x3'))['db'];var utils=require(_0x2a15('0x4'));var logger=require(_0x2a15('0x5'))('rpc');var config=require(_0x2a15('0x6'));var jayson=require(_0x2a15('0x7'));var client=jayson[_0x2a15('0x8')][_0x2a15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cd6b8,_0x41627b,_0x531848){return new BPromise(function(_0x4fa100,_0x83f498){return client['request'](_0x1cd6b8,_0x531848)['then'](function(_0x59741d){logger[_0x2a15('0xa')](_0x2a15('0xb'),_0x41627b,_0x2a15('0xc'));logger[_0x2a15('0xd')](_0x2a15('0xe'),_0x41627b,_0x2a15('0xc'),JSON['stringify'](_0x59741d));if(_0x59741d[_0x2a15('0xf')]){if(_0x59741d[_0x2a15('0xf')][_0x2a15('0x10')]===0x1f4){logger[_0x2a15('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x41627b,_0x59741d['error'][_0x2a15('0x11')]);return _0x83f498(_0x59741d[_0x2a15('0xf')]['message']);}logger[_0x2a15('0xf')](_0x2a15('0xb'),_0x41627b,_0x59741d[_0x2a15('0xf')][_0x2a15('0x11')]);return _0x4fa100(_0x59741d[_0x2a15('0xf')][_0x2a15('0x11')]);}else{logger[_0x2a15('0xa')](_0x2a15('0xb'),_0x41627b,_0x2a15('0xc'));_0x4fa100(_0x59741d['result']['message']);}})[_0x2a15('0x12')](function(_0x2b12fe){logger['error'](_0x2a15('0xb'),_0x41627b,_0x2b12fe);_0x83f498(_0x2b12fe);});});} \ No newline at end of file +var _0x4894=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','request\x20sent','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4894,0x9f));var _0x4489=function(_0x321759,_0xce9854){_0x321759=_0x321759-0x0;var _0x1ca8a2=_0x4894[_0x321759];return _0x1ca8a2;};'use strict';var _=require('lodash');var util=require(_0x4489('0x0'));var moment=require(_0x4489('0x1'));var BPromise=require('bluebird');var rs=require(_0x4489('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4489('0x3'))['db'];var utils=require(_0x4489('0x4'));var logger=require(_0x4489('0x5'))(_0x4489('0x6'));var config=require(_0x4489('0x7'));var jayson=require(_0x4489('0x8'));var client=jayson['client'][_0x4489('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b169,_0x509d7d,_0x2ba89f){return new BPromise(function(_0x54aa19,_0x3d9bd4){return client[_0x4489('0xa')](_0x45b169,_0x2ba89f)[_0x4489('0xb')](function(_0x3949dd){logger[_0x4489('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x509d7d,'request\x20sent');logger[_0x4489('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x509d7d,'request\x20sent',JSON[_0x4489('0xe')](_0x3949dd));if(_0x3949dd[_0x4489('0xf')]){if(_0x3949dd['error']['code']===0x1f4){logger[_0x4489('0xf')](_0x4489('0x10'),_0x509d7d,_0x3949dd[_0x4489('0xf')][_0x4489('0x11')]);return _0x3d9bd4(_0x3949dd[_0x4489('0xf')][_0x4489('0x11')]);}logger[_0x4489('0xf')](_0x4489('0x10'),_0x509d7d,_0x3949dd[_0x4489('0xf')]['message']);return _0x54aa19(_0x3949dd[_0x4489('0xf')][_0x4489('0x11')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x509d7d,_0x4489('0x12'));_0x54aa19(_0x3949dd['result']['message']);}})[_0x4489('0x13')](function(_0x387314){logger[_0x4489('0xf')](_0x4489('0x10'),_0x509d7d,_0x387314);_0x3d9bd4(_0x387314);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5b82bb9..2ee1fc5 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 _0x110c=['fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','exports','util','express','Router'];(function(_0x5acf17,_0x2aae90){var _0x51c05a=function(_0x191931){while(--_0x191931){_0x5acf17['push'](_0x5acf17['shift']());}};_0x51c05a(++_0x2aae90);}(_0x110c,0xc5));var _0xc110=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x110c[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require(_0xc110('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc110('0x1'));var router=express[_0xc110('0x2')]();var fs_extra=require(_0xc110('0x3'));var auth=require(_0xc110('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc110('0x5'));var controller=require(_0xc110('0x6'));router[_0xc110('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc110('0x7')](_0xc110('0x8'),auth[_0xc110('0x9')](),controller[_0xc110('0xa')]);router['get'](_0xc110('0xb'),auth[_0xc110('0x9')](),controller[_0xc110('0xc')]);router[_0xc110('0x7')](_0xc110('0xd'),auth[_0xc110('0x9')](),controller[_0xc110('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc110('0xf')]);router[_0xc110('0x10')]('/:id',auth[_0xc110('0x9')](),controller[_0xc110('0x11')]);router[_0xc110('0x12')]('/:id',auth[_0xc110('0x9')](),controller['destroy']);module[_0xc110('0x13')]=router; \ No newline at end of file +var _0xda96=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','/:id','/:id/questions','getQuestions','post','put','update','destroy'];(function(_0x281120,_0x407437){var _0x288731=function(_0x3da371){while(--_0x3da371){_0x281120['push'](_0x281120['shift']());}};_0x288731(++_0x407437);}(_0xda96,0x73));var _0x6da9=function(_0x5664fd,_0x58f991){_0x5664fd=_0x5664fd-0x0;var _0x95a400=_0xda96[_0x5664fd];return _0x95a400;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6da9('0x0'));var timeout=require(_0x6da9('0x1'));var express=require(_0x6da9('0x2'));var router=express[_0x6da9('0x3')]();var fs_extra=require(_0x6da9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6da9('0x5'));var config=require('../../config/environment');var controller=require(_0x6da9('0x6'));router[_0x6da9('0x7')]('/',auth['isAuthenticated'](),controller[_0x6da9('0x8')]);router[_0x6da9('0x7')](_0x6da9('0x9'),auth[_0x6da9('0xa')](),controller['describe']);router['get'](_0x6da9('0xb'),auth[_0x6da9('0xa')](),controller['show']);router[_0x6da9('0x7')](_0x6da9('0xc'),auth[_0x6da9('0xa')](),controller[_0x6da9('0xd')]);router[_0x6da9('0xe')]('/',auth[_0x6da9('0xa')](),controller['create']);router[_0x6da9('0xf')](_0x6da9('0xb'),auth[_0x6da9('0xa')](),controller[_0x6da9('0x10')]);router['delete'](_0x6da9('0xb'),auth[_0x6da9('0xa')](),controller[_0x6da9('0x11')]);module[_0x6da9('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f6dc150..aaa2e0c 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 _0x0381=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue'];(function(_0x7600ed,_0x268305){var _0x348504=function(_0x427412){while(--_0x427412){_0x7600ed['push'](_0x7600ed['shift']());}};_0x348504(++_0x268305);}(_0x0381,0x1c7));var _0x1038=function(_0x15f590,_0x42b288){_0x15f590=_0x15f590-0x0;var _0x53671c=_0x0381[_0x15f590];return _0x53671c;};'use strict';var moment=require(_0x1038('0x0'));var Sequelize=require(_0x1038('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1038('0x2')],'set':function(_0x23bc48){this[_0x1038('0x3')]('starttime',_0x23bc48);this[_0x1038('0x3')](_0x1038('0x4'),moment()[_0x1038('0x5')](_0x1038('0x6')));}},'endtime':{'type':Sequelize[_0x1038('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x1038('0x7')]},'queue':{'type':Sequelize[_0x1038('0x7')]},'uniqueid':{'type':Sequelize[_0x1038('0x7')]},'calleridname':{'type':Sequelize[_0x1038('0x7')]},'calleridnum':{'type':Sequelize[_0x1038('0x7')]},'completed':{'type':Sequelize[_0x1038('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xebde=['sequelize','DATE','setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x22a223,_0x4ecc6d){var _0xd8148d=function(_0xe0138d){while(--_0xe0138d){_0x22a223['push'](_0x22a223['shift']());}};_0xd8148d(++_0x4ecc6d);}(_0xebde,0x92));var _0xeebd=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xebde[_0x4ef734];return _0x33a7cb;};'use strict';var moment=require(_0xeebd('0x0'));var Sequelize=require(_0xeebd('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xeebd('0x2')],'set':function(_0x248bed){this['setDataValue']('starttime',_0x248bed);this[_0xeebd('0x3')]('endtime',moment()['format'](_0xeebd('0x4')));}},'endtime':{'type':Sequelize[_0xeebd('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xeebd('0x5')]},'queue':{'type':Sequelize[_0xeebd('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xeebd('0x5')]},'completed':{'type':Sequelize[_0xeebd('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1996a5e..a1b9706 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 _0x5956=['update','body','params','describe','getQuestions','findOne','length','SessionId','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','keys','options','find','create'];(function(_0x4d3d12,_0xd2de56){var _0x224e52=function(_0x22116d){while(--_0x22116d){_0x4d3d12['push'](_0x4d3d12['shift']());}};_0x224e52(++_0xd2de56);}(_0x5956,0x18b));var _0x6595=function(_0x2adf1f,_0x191e30){_0x2adf1f=_0x2adf1f-0x0;var _0x5a2b40=_0x5956[_0x2adf1f];return _0x5a2b40;};'use strict';var emlformat=require(_0x6595('0x0'));var rimraf=require(_0x6595('0x1'));var zipdir=require(_0x6595('0x2'));var jsonpatch=require(_0x6595('0x3'));var rp=require('request-promise');var moment=require(_0x6595('0x4'));var BPromise=require(_0x6595('0x5'));var Mustache=require('mustache');var util=require(_0x6595('0x6'));var path=require(_0x6595('0x7'));var sox=require(_0x6595('0x8'));var csv=require(_0x6595('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6595('0xa'));var squel=require('squel');var crypto=require(_0x6595('0xb'));var jsforce=require(_0x6595('0xc'));var deskjs=require(_0x6595('0xd'));var toCsv=require(_0x6595('0x9'));var querystring=require(_0x6595('0xe'));var Papa=require('papaparse');var Redis=require(_0x6595('0xf'));var authService=require(_0x6595('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6595('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6595('0x12'))('api');var utils=require(_0x6595('0x13'));var config=require(_0x6595('0x14'));var licenseUtil=require(_0x6595('0x15'));var db=require(_0x6595('0x16'))['db'];function respondWithStatusCode(_0x51b10d,_0xdd7973){_0xdd7973=_0xdd7973||0xcc;return function(_0xa68b01){if(_0xa68b01){return _0x51b10d[_0x6595('0x17')](_0xdd7973);}return _0x51b10d[_0x6595('0x18')](_0xdd7973)[_0x6595('0x19')]();};}function respondWithResult(_0x111d36,_0x214600){_0x214600=_0x214600||0xc8;return function(_0x319eda){if(_0x319eda){return _0x111d36['status'](_0x214600)[_0x6595('0x1a')](_0x319eda);}};}function respondWithFilteredResult(_0x389603,_0x1e4ecf){return function(_0x239a0a){if(_0x239a0a){var _0xdbb4ae=typeof _0x1e4ecf[_0x6595('0x1b')]===_0x6595('0x1c')&&typeof _0x1e4ecf[_0x6595('0x1d')]===_0x6595('0x1c');var _0x34273b=_0x239a0a[_0x6595('0x1e')];var _0x2ddd4a=_0xdbb4ae?0x0:_0x1e4ecf[_0x6595('0x1b')];var _0x5ec1ab=_0xdbb4ae?_0x239a0a[_0x6595('0x1e')]:_0x1e4ecf[_0x6595('0x1b')]+_0x1e4ecf[_0x6595('0x1d')];var _0x3fdfb9;if(_0x5ec1ab>=_0x34273b){_0x5ec1ab=_0x34273b;_0x3fdfb9=0xc8;}else{_0x3fdfb9=0xce;}_0x389603[_0x6595('0x18')](_0x3fdfb9);return _0x389603[_0x6595('0x1f')]('Content-Range',_0x2ddd4a+'-'+_0x5ec1ab+'/'+_0x34273b)[_0x6595('0x1a')](_0x239a0a);}return null;};}function patchUpdates(_0x2d1205){return function(_0x32fe2b){try{jsonpatch['apply'](_0x32fe2b,_0x2d1205,!![]);}catch(_0x70a0fa){return BPromise[_0x6595('0x20')](_0x70a0fa);}return _0x32fe2b['save']();};}function saveUpdates(_0x5dbd42,_0x32a88f){return function(_0x383528){if(_0x383528){return _0x383528['update'](_0x5dbd42)[_0x6595('0x21')](function(_0x2f1627){return _0x2f1627;});}return null;};}function removeEntity(_0x26a2e9,_0x23f872){return function(_0x4d1f20){if(_0x4d1f20){return _0x4d1f20[_0x6595('0x22')]()[_0x6595('0x21')](function(){_0x26a2e9[_0x6595('0x18')](0xcc)[_0x6595('0x19')]();});}};}function handleEntityNotFound(_0x1c0ea3,_0x1ed59f){return function(_0x5280a4){if(!_0x5280a4){_0x1c0ea3['sendStatus'](0x194);}return _0x5280a4;};}function handleError(_0x46ed8a,_0x3c413e){_0x3c413e=_0x3c413e||0x1f4;return function(_0x1ce506){logger[_0x6595('0x23')](_0x1ce506[_0x6595('0x24')]);if(_0x1ce506[_0x6595('0x25')]){delete _0x1ce506[_0x6595('0x25')];}_0x46ed8a[_0x6595('0x18')](_0x3c413e)[_0x6595('0x26')](_0x1ce506);};}exports[_0x6595('0x27')]=function(_0x2b4039,_0x2f022b){var _0x611036={},_0x399a66={},_0x18fbed={'count':0x0,'rows':[]};var _0x21ee1c=_[_0x6595('0x28')](db[_0x6595('0x29')][_0x6595('0x2a')],function(_0x42e7db){return{'name':_0x42e7db['fieldName'],'type':_0x42e7db[_0x6595('0x2b')]['key']};});_0x399a66[_0x6595('0x2c')]=_[_0x6595('0x28')](_0x21ee1c,_0x6595('0x25'));_0x399a66[_0x6595('0x2d')]=_['keys'](_0x2b4039['query']);_0x399a66['filters']=_['intersection'](_0x399a66[_0x6595('0x2c')],_0x399a66[_0x6595('0x2d')]);_0x611036[_0x6595('0x2e')]=_[_0x6595('0x2f')](_0x399a66[_0x6595('0x2c')],qs['fields'](_0x2b4039['query'][_0x6595('0x30')]));_0x611036['attributes']=_0x611036[_0x6595('0x2e')]['length']?_0x611036[_0x6595('0x2e')]:_0x399a66[_0x6595('0x2c')];if(!_0x2b4039['query'][_0x6595('0x31')](_0x6595('0x32'))){_0x611036[_0x6595('0x1d')]=qs['limit'](_0x2b4039['query']['limit']);_0x611036[_0x6595('0x1b')]=qs[_0x6595('0x1b')](_0x2b4039[_0x6595('0x2d')]['offset']);}_0x611036[_0x6595('0x33')]=qs[_0x6595('0x34')](_0x2b4039[_0x6595('0x2d')][_0x6595('0x34')]);_0x611036[_0x6595('0x35')]=qs[_0x6595('0x36')](_[_0x6595('0x37')](_0x2b4039[_0x6595('0x2d')],_0x399a66['filters']),_0x21ee1c);if(_0x2b4039['query'][_0x6595('0x38')]){_0x611036[_0x6595('0x35')]=_[_0x6595('0x39')](_0x611036[_0x6595('0x35')],{'$or':_[_0x6595('0x28')](_0x21ee1c,function(_0x5295f9){if(_0x5295f9[_0x6595('0x2b')]!==_0x6595('0x3a')){var _0x2dfa35={};_0x2dfa35[_0x5295f9[_0x6595('0x25')]]={'$like':'%'+_0x2b4039[_0x6595('0x2d')][_0x6595('0x38')]+'%'};return _0x2dfa35;}})});}_0x611036=_[_0x6595('0x39')]({},_0x611036,_0x2b4039['options']);var _0x24f8c4={'where':_0x611036[_0x6595('0x35')]};return db[_0x6595('0x29')][_0x6595('0x1e')](_0x24f8c4)[_0x6595('0x21')](function(_0x8bb4e4){_0x18fbed[_0x6595('0x1e')]=_0x8bb4e4;if(_0x2b4039[_0x6595('0x2d')][_0x6595('0x3b')]){_0x611036[_0x6595('0x3c')]=[{'all':!![]}];}return db[_0x6595('0x29')]['findAll'](_0x611036);})[_0x6595('0x21')](function(_0x3bbee6){_0x18fbed['rows']=_0x3bbee6;return _0x18fbed;})[_0x6595('0x21')](respondWithFilteredResult(_0x2f022b,_0x611036))[_0x6595('0x3d')](handleError(_0x2f022b,null));};exports[_0x6595('0x3e')]=function(_0x20c889,_0x139e73){var _0x12733f={'raw':!![],'where':{'id':_0x20c889['params']['id']}},_0x157c87={};_0x157c87[_0x6595('0x2c')]=_[_0x6595('0x3f')](db[_0x6595('0x29')][_0x6595('0x2a')]);_0x157c87['query']=_['keys'](_0x20c889[_0x6595('0x2d')]);_0x157c87[_0x6595('0x36')]=_[_0x6595('0x2f')](_0x157c87[_0x6595('0x2c')],_0x157c87[_0x6595('0x2d')]);_0x12733f[_0x6595('0x2e')]=_[_0x6595('0x2f')](_0x157c87['model'],qs[_0x6595('0x30')](_0x20c889['query'][_0x6595('0x30')]));_0x12733f[_0x6595('0x2e')]=_0x12733f[_0x6595('0x2e')]['length']?_0x12733f[_0x6595('0x2e')]:_0x157c87[_0x6595('0x2c')];if(_0x20c889[_0x6595('0x2d')]['includeAll']){_0x12733f[_0x6595('0x3c')]=[{'all':!![]}];}_0x12733f=_[_0x6595('0x39')]({},_0x12733f,_0x20c889[_0x6595('0x40')]);return db[_0x6595('0x29')][_0x6595('0x41')](_0x12733f)[_0x6595('0x21')](handleEntityNotFound(_0x139e73,null))[_0x6595('0x21')](respondWithResult(_0x139e73,null))[_0x6595('0x3d')](handleError(_0x139e73,null));};exports[_0x6595('0x42')]=function(_0x3053cc,_0x3e7f4e){return db[_0x6595('0x29')][_0x6595('0x42')](_0x3053cc['body'],{})[_0x6595('0x21')](respondWithResult(_0x3e7f4e,0xc9))[_0x6595('0x3d')](handleError(_0x3e7f4e,null));};exports[_0x6595('0x43')]=function(_0x36d74e,_0x432312){if(_0x36d74e[_0x6595('0x44')]['id']){delete _0x36d74e[_0x6595('0x44')]['id'];}return db[_0x6595('0x29')]['find']({'where':{'id':_0x36d74e[_0x6595('0x45')]['id']}})[_0x6595('0x21')](handleEntityNotFound(_0x432312,null))['then'](saveUpdates(_0x36d74e[_0x6595('0x44')],null))['then'](respondWithResult(_0x432312,null))[_0x6595('0x3d')](handleError(_0x432312,null));};exports[_0x6595('0x22')]=function(_0x170276,_0x1d5fb6){return db['JscriptySessionReport']['find']({'where':{'id':_0x170276[_0x6595('0x45')]['id']}})['then'](handleEntityNotFound(_0x1d5fb6,null))[_0x6595('0x21')](removeEntity(_0x1d5fb6,null))[_0x6595('0x3d')](handleError(_0x1d5fb6,null));};exports[_0x6595('0x46')]=function(_0xdcdb2e,_0x15662d){return db[_0x6595('0x29')][_0x6595('0x46')]()[_0x6595('0x21')](respondWithResult(_0x15662d,null))[_0x6595('0x3d')](handleError(_0x15662d,null));};exports[_0x6595('0x47')]=function(_0x77a39,_0x46249f,_0x2dfc05){var _0x4f8ee8={'raw':!![],'where':{}};var _0x4fbb95={};var _0x2daa19={'count':0x0,'rows':[]};return db[_0x6595('0x29')][_0x6595('0x48')]({'where':{'id':_0x77a39[_0x6595('0x45')]['id']}})[_0x6595('0x21')](handleEntityNotFound(_0x46249f,null))[_0x6595('0x21')](function(_0xb22d41){if(_0xb22d41){_0x4fbb95[_0x6595('0x2c')]=_[_0x6595('0x3f')](db['JscriptyQuestionReport']['rawAttributes']);_0x4fbb95[_0x6595('0x2d')]=_[_0x6595('0x3f')](_0x77a39[_0x6595('0x2d')]);_0x4fbb95['filters']=_[_0x6595('0x2f')](_0x4fbb95[_0x6595('0x2c')],_0x4fbb95['query']);_0x4f8ee8['attributes']=_['intersection'](_0x4fbb95[_0x6595('0x2c')],qs[_0x6595('0x30')](_0x77a39[_0x6595('0x2d')][_0x6595('0x30')]));_0x4f8ee8['attributes']=_0x4f8ee8[_0x6595('0x2e')][_0x6595('0x49')]?_0x4f8ee8[_0x6595('0x2e')]:_0x4fbb95['model'];if(!_0x77a39['query'][_0x6595('0x31')](_0x6595('0x32'))){_0x4f8ee8[_0x6595('0x1d')]=qs[_0x6595('0x1d')](_0x77a39[_0x6595('0x2d')][_0x6595('0x1d')]);_0x4f8ee8[_0x6595('0x1b')]=qs['offset'](_0x77a39['query'][_0x6595('0x1b')]);}_0x4f8ee8[_0x6595('0x33')]=qs[_0x6595('0x34')](_0x77a39['query'][_0x6595('0x34')]);_0x4f8ee8[_0x6595('0x35')]=qs[_0x6595('0x36')](_[_0x6595('0x37')](_0x77a39['query'],_0x4fbb95[_0x6595('0x36')]));_0x4f8ee8[_0x6595('0x35')][_0x6595('0x4a')]=_0xb22d41['id'];if(_0x77a39[_0x6595('0x2d')]['filter']){_0x4f8ee8[_0x6595('0x35')]=_[_0x6595('0x39')](_0x4f8ee8[_0x6595('0x35')],{'$or':_['map'](_0x4f8ee8['attributes'],function(_0x520359){var _0x462525={};_0x462525[_0x520359]={'$like':'%'+_0x77a39['query'][_0x6595('0x38')]+'%'};return _0x462525;})});}_0x4f8ee8=_[_0x6595('0x39')]({},_0x4f8ee8,_0x77a39[_0x6595('0x40')]);return db[_0x6595('0x4b')]['count']({'where':_0x4f8ee8[_0x6595('0x35')]})[_0x6595('0x21')](function(_0x2fb152){_0x2daa19[_0x6595('0x1e')]=_0x2fb152;if(_0x77a39[_0x6595('0x2d')][_0x6595('0x3b')]){_0x4f8ee8[_0x6595('0x3c')]=[{'all':!![]}];}return db[_0x6595('0x4b')]['findAll'](_0x4f8ee8);})['then'](function(_0xa982dc){_0x2daa19[_0x6595('0x4c')]=_0xa982dc;return _0x2daa19;});}})[_0x6595('0x21')](respondWithFilteredResult(_0x46249f,_0x4f8ee8))['catch'](handleError(_0x46249f,null));}; \ No newline at end of file +var _0x68f4=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','JscriptySessionReport','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','create','body','find','describe','getQuestions','filter','JscriptyQuestionReport','findAll','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x597fc6,_0x32f069){var _0x121bba=function(_0x8da8e2){while(--_0x8da8e2){_0x597fc6['push'](_0x597fc6['shift']());}};_0x121bba(++_0x32f069);}(_0x68f4,0x87));var _0x468f=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x68f4[_0x5951e8];return _0x20a1f5;};'use strict';var emlformat=require(_0x468f('0x0'));var rimraf=require(_0x468f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x468f('0x2'));var rp=require(_0x468f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x468f('0x4'));var util=require(_0x468f('0x5'));var path=require(_0x468f('0x6'));var sox=require(_0x468f('0x7'));var csv=require(_0x468f('0x8'));var ejs=require(_0x468f('0x9'));var fs=require('fs');var fs_extra=require(_0x468f('0xa'));var _=require(_0x468f('0xb'));var squel=require(_0x468f('0xc'));var crypto=require(_0x468f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x468f('0x8'));var querystring=require(_0x468f('0xe'));var Papa=require('papaparse');var Redis=require(_0x468f('0xf'));var authService=require(_0x468f('0x10'));var qs=require(_0x468f('0x11'));var as=require(_0x468f('0x12'));var hardwareService=require(_0x468f('0x13'));var logger=require('../../config/logger')(_0x468f('0x14'));var utils=require(_0x468f('0x15'));var config=require(_0x468f('0x16'));var licenseUtil=require(_0x468f('0x17'));var db=require(_0x468f('0x18'))['db'];function respondWithStatusCode(_0x295b64,_0x99afe7){_0x99afe7=_0x99afe7||0xcc;return function(_0x52acea){if(_0x52acea){return _0x295b64[_0x468f('0x19')](_0x99afe7);}return _0x295b64[_0x468f('0x1a')](_0x99afe7)[_0x468f('0x1b')]();};}function respondWithResult(_0xe5e9bf,_0x3ceedd){_0x3ceedd=_0x3ceedd||0xc8;return function(_0x104dbf){if(_0x104dbf){return _0xe5e9bf[_0x468f('0x1a')](_0x3ceedd)[_0x468f('0x1c')](_0x104dbf);}};}function respondWithFilteredResult(_0x3e0557,_0x85b846){return function(_0x3d5d90){if(_0x3d5d90){var _0x38b354=typeof _0x85b846[_0x468f('0x1d')]===_0x468f('0x1e')&&typeof _0x85b846[_0x468f('0x1f')]===_0x468f('0x1e');var _0x112589=_0x3d5d90[_0x468f('0x20')];var _0x43d6ff=_0x38b354?0x0:_0x85b846[_0x468f('0x1d')];var _0x5693bc=_0x38b354?_0x3d5d90[_0x468f('0x20')]:_0x85b846[_0x468f('0x1d')]+_0x85b846[_0x468f('0x1f')];var _0x17cf00;if(_0x5693bc>=_0x112589){_0x5693bc=_0x112589;_0x17cf00=0xc8;}else{_0x17cf00=0xce;}_0x3e0557[_0x468f('0x1a')](_0x17cf00);return _0x3e0557[_0x468f('0x21')](_0x468f('0x22'),_0x43d6ff+'-'+_0x5693bc+'/'+_0x112589)[_0x468f('0x1c')](_0x3d5d90);}return null;};}function patchUpdates(_0x9fbc23){return function(_0x3a8e72){try{jsonpatch[_0x468f('0x23')](_0x3a8e72,_0x9fbc23,!![]);}catch(_0x2112e4){return BPromise['reject'](_0x2112e4);}return _0x3a8e72['save']();};}function saveUpdates(_0x96f3e9,_0x5d3c22){return function(_0x4ac7c0){if(_0x4ac7c0){return _0x4ac7c0[_0x468f('0x24')](_0x96f3e9)[_0x468f('0x25')](function(_0x1d8f35){return _0x1d8f35;});}return null;};}function removeEntity(_0x4f6795,_0x300d23){return function(_0x451751){if(_0x451751){return _0x451751[_0x468f('0x26')]()[_0x468f('0x25')](function(){_0x4f6795[_0x468f('0x1a')](0xcc)[_0x468f('0x1b')]();});}};}function handleEntityNotFound(_0x5c02b9,_0x39d90a){return function(_0x22ccd4){if(!_0x22ccd4){_0x5c02b9['sendStatus'](0x194);}return _0x22ccd4;};}function handleError(_0x26db10,_0x5b50f3){_0x5b50f3=_0x5b50f3||0x1f4;return function(_0x149c9d){logger[_0x468f('0x27')](_0x149c9d[_0x468f('0x28')]);if(_0x149c9d[_0x468f('0x29')]){delete _0x149c9d['name'];}_0x26db10[_0x468f('0x1a')](_0x5b50f3)[_0x468f('0x2a')](_0x149c9d);};}exports[_0x468f('0x2b')]=function(_0x1b0955,_0x1d4213){var _0xc67b28={},_0x4a76d4={},_0x40260e={'count':0x0,'rows':[]};var _0x19f3c9=_['map'](db[_0x468f('0x2c')][_0x468f('0x2d')],function(_0x42295b){return{'name':_0x42295b['fieldName'],'type':_0x42295b[_0x468f('0x2e')][_0x468f('0x2f')]};});_0x4a76d4['model']=_[_0x468f('0x30')](_0x19f3c9,_0x468f('0x29'));_0x4a76d4[_0x468f('0x31')]=_[_0x468f('0x32')](_0x1b0955[_0x468f('0x31')]);_0x4a76d4[_0x468f('0x33')]=_[_0x468f('0x34')](_0x4a76d4[_0x468f('0x35')],_0x4a76d4[_0x468f('0x31')]);_0xc67b28[_0x468f('0x36')]=_['intersection'](_0x4a76d4[_0x468f('0x35')],qs[_0x468f('0x37')](_0x1b0955[_0x468f('0x31')][_0x468f('0x37')]));_0xc67b28['attributes']=_0xc67b28[_0x468f('0x36')]['length']?_0xc67b28['attributes']:_0x4a76d4['model'];if(!_0x1b0955[_0x468f('0x31')][_0x468f('0x38')](_0x468f('0x39'))){_0xc67b28['limit']=qs[_0x468f('0x1f')](_0x1b0955[_0x468f('0x31')][_0x468f('0x1f')]);_0xc67b28['offset']=qs[_0x468f('0x1d')](_0x1b0955[_0x468f('0x31')]['offset']);}_0xc67b28[_0x468f('0x3a')]=qs['sort'](_0x1b0955[_0x468f('0x31')][_0x468f('0x3b')]);_0xc67b28[_0x468f('0x3c')]=qs['filters'](_[_0x468f('0x3d')](_0x1b0955[_0x468f('0x31')],_0x4a76d4[_0x468f('0x33')]),_0x19f3c9);if(_0x1b0955[_0x468f('0x31')]['filter']){_0xc67b28['where']=_['merge'](_0xc67b28['where'],{'$or':_[_0x468f('0x30')](_0x19f3c9,function(_0x43ba0d){if(_0x43ba0d[_0x468f('0x2e')]!==_0x468f('0x3e')){var _0x11787={};_0x11787[_0x43ba0d[_0x468f('0x29')]]={'$like':'%'+_0x1b0955['query']['filter']+'%'};return _0x11787;}})});}_0xc67b28=_[_0x468f('0x3f')]({},_0xc67b28,_0x1b0955[_0x468f('0x40')]);var _0x1e876b={'where':_0xc67b28[_0x468f('0x3c')]};return db[_0x468f('0x2c')][_0x468f('0x20')](_0x1e876b)['then'](function(_0x369b4c){_0x40260e[_0x468f('0x20')]=_0x369b4c;if(_0x1b0955[_0x468f('0x31')][_0x468f('0x41')]){_0xc67b28[_0x468f('0x42')]=[{'all':!![]}];}return db[_0x468f('0x2c')]['findAll'](_0xc67b28);})['then'](function(_0x1f6acb){_0x40260e[_0x468f('0x43')]=_0x1f6acb;return _0x40260e;})['then'](respondWithFilteredResult(_0x1d4213,_0xc67b28))[_0x468f('0x44')](handleError(_0x1d4213,null));};exports[_0x468f('0x45')]=function(_0x1ec15f,_0x34f10c){var _0x391fd9={'raw':!![],'where':{'id':_0x1ec15f[_0x468f('0x46')]['id']}},_0x5a3b24={};_0x5a3b24[_0x468f('0x35')]=_[_0x468f('0x32')](db[_0x468f('0x2c')][_0x468f('0x2d')]);_0x5a3b24['query']=_['keys'](_0x1ec15f[_0x468f('0x31')]);_0x5a3b24[_0x468f('0x33')]=_['intersection'](_0x5a3b24[_0x468f('0x35')],_0x5a3b24['query']);_0x391fd9[_0x468f('0x36')]=_['intersection'](_0x5a3b24['model'],qs[_0x468f('0x37')](_0x1ec15f[_0x468f('0x31')][_0x468f('0x37')]));_0x391fd9[_0x468f('0x36')]=_0x391fd9[_0x468f('0x36')][_0x468f('0x47')]?_0x391fd9[_0x468f('0x36')]:_0x5a3b24[_0x468f('0x35')];if(_0x1ec15f['query'][_0x468f('0x41')]){_0x391fd9['include']=[{'all':!![]}];}_0x391fd9=_['merge']({},_0x391fd9,_0x1ec15f['options']);return db[_0x468f('0x2c')]['find'](_0x391fd9)['then'](handleEntityNotFound(_0x34f10c,null))[_0x468f('0x25')](respondWithResult(_0x34f10c,null))['catch'](handleError(_0x34f10c,null));};exports[_0x468f('0x48')]=function(_0x5aa8d9,_0x14bcd8){return db[_0x468f('0x2c')]['create'](_0x5aa8d9[_0x468f('0x49')],{})[_0x468f('0x25')](respondWithResult(_0x14bcd8,0xc9))[_0x468f('0x44')](handleError(_0x14bcd8,null));};exports[_0x468f('0x24')]=function(_0x2922e2,_0x57f4c8){if(_0x2922e2['body']['id']){delete _0x2922e2[_0x468f('0x49')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x2922e2[_0x468f('0x46')]['id']}})[_0x468f('0x25')](handleEntityNotFound(_0x57f4c8,null))['then'](saveUpdates(_0x2922e2[_0x468f('0x49')],null))['then'](respondWithResult(_0x57f4c8,null))[_0x468f('0x44')](handleError(_0x57f4c8,null));};exports[_0x468f('0x26')]=function(_0x51e5a4,_0x3308e5){return db[_0x468f('0x2c')][_0x468f('0x4a')]({'where':{'id':_0x51e5a4[_0x468f('0x46')]['id']}})[_0x468f('0x25')](handleEntityNotFound(_0x3308e5,null))['then'](removeEntity(_0x3308e5,null))[_0x468f('0x44')](handleError(_0x3308e5,null));};exports[_0x468f('0x4b')]=function(_0x213a2e,_0x819669){return db['JscriptySessionReport'][_0x468f('0x4b')]()['then'](respondWithResult(_0x819669,null))[_0x468f('0x44')](handleError(_0x819669,null));};exports[_0x468f('0x4c')]=function(_0x1b45e9,_0x60e4ec,_0x394f6d){var _0x27b485={'raw':!![],'where':{}};var _0xa655c2={};var _0x53dc96={'count':0x0,'rows':[]};return db[_0x468f('0x2c')]['findOne']({'where':{'id':_0x1b45e9[_0x468f('0x46')]['id']}})[_0x468f('0x25')](handleEntityNotFound(_0x60e4ec,null))[_0x468f('0x25')](function(_0x1d08af){if(_0x1d08af){_0xa655c2[_0x468f('0x35')]=_[_0x468f('0x32')](db['JscriptyQuestionReport']['rawAttributes']);_0xa655c2[_0x468f('0x31')]=_[_0x468f('0x32')](_0x1b45e9['query']);_0xa655c2['filters']=_[_0x468f('0x34')](_0xa655c2[_0x468f('0x35')],_0xa655c2[_0x468f('0x31')]);_0x27b485[_0x468f('0x36')]=_[_0x468f('0x34')](_0xa655c2['model'],qs['fields'](_0x1b45e9['query'][_0x468f('0x37')]));_0x27b485[_0x468f('0x36')]=_0x27b485[_0x468f('0x36')][_0x468f('0x47')]?_0x27b485[_0x468f('0x36')]:_0xa655c2[_0x468f('0x35')];if(!_0x1b45e9[_0x468f('0x31')][_0x468f('0x38')]('nolimit')){_0x27b485[_0x468f('0x1f')]=qs[_0x468f('0x1f')](_0x1b45e9[_0x468f('0x31')]['limit']);_0x27b485[_0x468f('0x1d')]=qs['offset'](_0x1b45e9[_0x468f('0x31')][_0x468f('0x1d')]);}_0x27b485['order']=qs[_0x468f('0x3b')](_0x1b45e9[_0x468f('0x31')][_0x468f('0x3b')]);_0x27b485[_0x468f('0x3c')]=qs['filters'](_['pick'](_0x1b45e9['query'],_0xa655c2['filters']));_0x27b485['where']['SessionId']=_0x1d08af['id'];if(_0x1b45e9['query'][_0x468f('0x4d')]){_0x27b485[_0x468f('0x3c')]=_['merge'](_0x27b485[_0x468f('0x3c')],{'$or':_['map'](_0x27b485[_0x468f('0x36')],function(_0x31b370){var _0x311558={};_0x311558[_0x31b370]={'$like':'%'+_0x1b45e9[_0x468f('0x31')][_0x468f('0x4d')]+'%'};return _0x311558;})});}_0x27b485=_[_0x468f('0x3f')]({},_0x27b485,_0x1b45e9['options']);return db['JscriptyQuestionReport'][_0x468f('0x20')]({'where':_0x27b485['where']})[_0x468f('0x25')](function(_0x8bc37d){_0x53dc96[_0x468f('0x20')]=_0x8bc37d;if(_0x1b45e9[_0x468f('0x31')]['includeAll']){_0x27b485[_0x468f('0x42')]=[{'all':!![]}];}return db[_0x468f('0x4e')][_0x468f('0x4f')](_0x27b485);})[_0x468f('0x25')](function(_0x155890){_0x53dc96['rows']=_0x155890;return _0x53dc96;});}})[_0x468f('0x25')](respondWithFilteredResult(_0x60e4ec,_0x27b485))['catch'](handleError(_0x60e4ec,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2e5dd0e..dac7d6d 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 _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x7e19de,_0x368cce){var _0x3b06be=function(_0x5021eb){while(--_0x5021eb){_0x7e19de['push'](_0x7e19de['shift']());}};_0x3b06be(++_0x368cce);}(_0x1db9,0x176));var _0x91db=function(_0x209018,_0x5e2c12){_0x209018=_0x209018-0x0;var _0x4d5cc1=_0x1db9[_0x209018];return _0x4d5cc1;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc949=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x33dc26,_0x27d730){var _0x13b00a=function(_0x4bf546){while(--_0x4bf546){_0x33dc26['push'](_0x33dc26['shift']());}};_0x13b00a(++_0x27d730);}(_0xc949,0x181));var _0x9c94=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc949[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c94('0x5'));var rimraf=require(_0x9c94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x7'));module[_0x9c94('0x8')]=function(_0x46d560,_0x1357ac){return _0x46d560['define'](_0x9c94('0x9'),attributes,{'tableName':_0x9c94('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 2427692..740bc2c 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 _0xf2e3=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x255738,_0x145a4d){var _0x5db0af=function(_0x42b1ec){while(--_0x42b1ec){_0x255738['push'](_0x255738['shift']());}};_0x5db0af(++_0x145a4d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf2e3[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});} \ No newline at end of file +var _0x5204=['rpc','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5204,0xdf));var _0x4520=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x5204[_0x16938f];return _0x5c66e9;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4a20687..4cf232f 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 _0xc21d=['isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get','index','put','update'];(function(_0x13a0b0,_0x5b4f02){var _0x9cb7eb=function(_0x1d9603){while(--_0x1d9603){_0x13a0b0['push'](_0x13a0b0['shift']());}};_0x9cb7eb(++_0x5b4f02);}(_0xc21d,0x73));var _0xdc21=function(_0x54d13c,_0x1e97c1){_0x54d13c=_0x54d13c-0x0;var _0xe751dc=_0xc21d[_0x54d13c];return _0xe751dc;};'use strict';var multer=require(_0xdc21('0x0'));var util=require(_0xdc21('0x1'));var path=require(_0xdc21('0x2'));var timeout=require(_0xdc21('0x3'));var express=require(_0xdc21('0x4'));var router=express[_0xdc21('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdc21('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc21('0x7'));var controller=require(_0xdc21('0x8'));router[_0xdc21('0x9')]('/',controller[_0xdc21('0xa')]);router[_0xdc21('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xdc21('0xc')]);router[_0xdc21('0x9')]('/download_log_file',auth[_0xdc21('0xd')](),controller[_0xdc21('0xe')]);module[_0xdc21('0xf')]=router; \ No newline at end of file +var _0xe1e2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','exports','util','path','connect-timeout'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0xe1e2,0x11e));var _0x2e1e=function(_0x22bf47,_0x5b3cfd){_0x22bf47=_0x22bf47-0x0;var _0x63e280=_0xe1e2[_0x22bf47];return _0x63e280;};'use strict';var multer=require('multer');var util=require(_0x2e1e('0x0'));var path=require(_0x2e1e('0x1'));var timeout=require(_0x2e1e('0x2'));var express=require(_0x2e1e('0x3'));var router=express['Router']();var fs_extra=require(_0x2e1e('0x4'));var auth=require(_0x2e1e('0x5'));var interaction=require(_0x2e1e('0x6'));var config=require(_0x2e1e('0x7'));var controller=require(_0x2e1e('0x8'));router[_0x2e1e('0x9')]('/',controller[_0x2e1e('0xa')]);router[_0x2e1e('0xb')](_0x2e1e('0xc'),auth[_0x2e1e('0xd')](),controller[_0x2e1e('0xe')]);router[_0x2e1e('0x9')]('/download_log_file',auth[_0x2e1e('0xd')](),controller[_0x2e1e('0xf')]);module[_0x2e1e('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 14670ed..b97fda7 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 _0x6f15=['TEXT','STRING','INTEGER'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6f15,0xdb));var _0x56f1=function(_0x2eaa82,_0x2af1d7){_0x2eaa82=_0x2eaa82-0x0;var _0x183fe8=_0x6f15[_0x2eaa82];return _0x183fe8;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x56f1('0x0')]},'data1':{'type':Sequelize[_0x56f1('0x1')]},'data2':{'type':Sequelize[_0x56f1('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x56f1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5840=['INTEGER','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5840,0xb5));var _0x0584=function(_0x4474fd,_0x133fa1){_0x4474fd=_0x4474fd-0x0;var _0x26b17c=_0x5840[_0x4474fd];return _0x26b17c;};'use strict';var Sequelize=require(_0x0584('0x0'));module[_0x0584('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x0584('0x2')]},'data2':{'type':Sequelize[_0x0584('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x0584('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c71a396..5ab9931 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 _0x8623=['update','then','sendStatus','error','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','set','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject'];(function(_0x396fef,_0x5bc90d){var _0x581951=function(_0x4e47c4){while(--_0x4e47c4){_0x396fef['push'](_0x396fef['shift']());}};_0x581951(++_0x5bc90d);}(_0x8623,0x148));var _0x3862=function(_0x80a495,_0x3247f5){_0x80a495=_0x80a495-0x0;var _0x1d95c2=_0x8623[_0x80a495];return _0x1d95c2;};'use strict';var emlformat=require(_0x3862('0x0'));var rimraf=require(_0x3862('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3862('0x2'));var rp=require(_0x3862('0x3'));var moment=require(_0x3862('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3862('0x5'));var util=require(_0x3862('0x6'));var path=require(_0x3862('0x7'));var sox=require(_0x3862('0x8'));var csv=require(_0x3862('0x9'));var ejs=require(_0x3862('0xa'));var fs=require('fs');var fs_extra=require(_0x3862('0xb'));var _=require(_0x3862('0xc'));var squel=require(_0x3862('0xd'));var crypto=require('crypto');var jsforce=require(_0x3862('0xe'));var deskjs=require(_0x3862('0xf'));var toCsv=require(_0x3862('0x9'));var querystring=require(_0x3862('0x10'));var Papa=require('papaparse');var Redis=require(_0x3862('0x11'));var authService=require(_0x3862('0x12'));var qs=require(_0x3862('0x13'));var as=require(_0x3862('0x14'));var hardwareService=require(_0x3862('0x15'));var logger=require(_0x3862('0x16'))(_0x3862('0x17'));var utils=require(_0x3862('0x18'));var config=require(_0x3862('0x19'));var licenseUtil=require(_0x3862('0x1a'));var db=require(_0x3862('0x1b'))['db'];function respondWithStatusCode(_0x187e1a,_0xce5967){_0xce5967=_0xce5967||0xcc;return function(_0x45aee3){if(_0x45aee3){return _0x187e1a['sendStatus'](_0xce5967);}return _0x187e1a[_0x3862('0x1c')](_0xce5967)[_0x3862('0x1d')]();};}function respondWithResult(_0x383bcd,_0x596046){_0x596046=_0x596046||0xc8;return function(_0x26850f){if(_0x26850f){return _0x383bcd[_0x3862('0x1c')](_0x596046)[_0x3862('0x1e')](_0x26850f);}};}function respondWithFilteredResult(_0x4a6dbf,_0x4c011a){return function(_0x11c97a){if(_0x11c97a){var _0x407551=typeof _0x4c011a[_0x3862('0x1f')]===_0x3862('0x20')&&typeof _0x4c011a[_0x3862('0x21')]==='undefined';var _0x3b4480=_0x11c97a[_0x3862('0x22')];var _0x17064b=_0x407551?0x0:_0x4c011a[_0x3862('0x1f')];var _0xb47eb=_0x407551?_0x11c97a[_0x3862('0x22')]:_0x4c011a[_0x3862('0x1f')]+_0x4c011a[_0x3862('0x21')];var _0x58a7fa;if(_0xb47eb>=_0x3b4480){_0xb47eb=_0x3b4480;_0x58a7fa=0xc8;}else{_0x58a7fa=0xce;}_0x4a6dbf['status'](_0x58a7fa);return _0x4a6dbf['set'](_0x3862('0x23'),_0x17064b+'-'+_0xb47eb+'/'+_0x3b4480)['json'](_0x11c97a);}return null;};}function patchUpdates(_0x3f4664){return function(_0x1e8bc8){try{jsonpatch['apply'](_0x1e8bc8,_0x3f4664,!![]);}catch(_0x3620c5){return BPromise[_0x3862('0x24')](_0x3620c5);}return _0x1e8bc8['save']();};}function saveUpdates(_0x5e633a,_0x407b28){return function(_0x325da8){if(_0x325da8){return _0x325da8[_0x3862('0x25')](_0x5e633a)[_0x3862('0x26')](function(_0x4c2334){return _0x4c2334;});}return null;};}function removeEntity(_0x145258,_0x57cbdf){return function(_0xf2c312){if(_0xf2c312){return _0xf2c312['destroy']()['then'](function(){_0x145258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41212a,_0x3c2b4a){return function(_0x274c7c){if(!_0x274c7c){_0x41212a[_0x3862('0x27')](0x194);}return _0x274c7c;};}function handleError(_0x420553,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||0x1f4;return function(_0x14ac27){logger[_0x3862('0x28')](_0x14ac27['stack']);if(_0x14ac27[_0x3862('0x29')]){delete _0x14ac27[_0x3862('0x29')];}_0x420553[_0x3862('0x1c')](_0x5ee4b8)[_0x3862('0x2a')](_0x14ac27);};}var utilLicense=require('../../config/license/util');exports[_0x3862('0x2b')]=function(_0x5e16d0,_0x4e8cb5){var _0x1a3b25={'raw':!![],'where':{'id':0x1}},_0x483a34={};_0x483a34[_0x3862('0x2c')]=_[_0x3862('0x2d')](db[_0x3862('0x2e')][_0x3862('0x2f')]);_0x483a34[_0x3862('0x30')]=_[_0x3862('0x2d')](_0x5e16d0[_0x3862('0x30')]);_0x483a34[_0x3862('0x31')]=_[_0x3862('0x32')](_0x483a34[_0x3862('0x2c')],_0x483a34['query']);_0x1a3b25['attributes']=_[_0x3862('0x32')](_0x483a34[_0x3862('0x2c')],qs[_0x3862('0x33')](_0x5e16d0[_0x3862('0x30')][_0x3862('0x33')]));_0x1a3b25[_0x3862('0x34')]=_0x1a3b25[_0x3862('0x34')][_0x3862('0x35')]?_0x1a3b25[_0x3862('0x34')]:_0x483a34[_0x3862('0x2c')];_0x1a3b25=_[_0x3862('0x36')]({},_0x1a3b25,_0x5e16d0[_0x3862('0x37')]);return utilLicense['getLicense'](_0x1a3b25)[_0x3862('0x26')](respondWithResult(_0x4e8cb5,null))[_0x3862('0x38')](handleError(_0x4e8cb5,null));};exports[_0x3862('0x25')]=function(_0xdb74c4,_0x428773){if(_0xdb74c4[_0x3862('0x39')]['id']){delete _0xdb74c4['body']['id'];}return db[_0x3862('0x2e')]['find']({'where':{'id':_0xdb74c4[_0x3862('0x3a')]['id']}})['then'](handleEntityNotFound(_0x428773,null))[_0x3862('0x26')](function(_0x431717){var _0x13d64b=_0x431717[_0x3862('0x3b')]({'plain':!![]});return utilLicense[_0x3862('0x3c')](_0x13d64b,_0xdb74c4['body'][_0x3862('0x3d')]);})[_0x3862('0x26')](function(_0x471968){if(!_0x471968[_0x3862('0x3e')]){return saveUpdates(_0xdb74c4[_0x3862('0x39')],null);}return _0x471968;})[_0x3862('0x26')](respondWithResult(_0x428773,null))[_0x3862('0x38')](handleError(_0x428773,null));};exports[_0x3862('0x3f')]=function(_0x11650f,_0x2614b8){var _0x524dea=_0x3862('0x40');var _0xc13ef0=path[_0x3862('0x41')](_0x3862('0x42'),_0x3862('0x43'),'xcally',_0x524dea);_0x2614b8[_0x3862('0x44')]('Content-disposition','attachment;\x20filename='+_0x524dea);_0x2614b8[_0x3862('0x45')](_0x3862('0x46'),_0x3862('0x47'));_0x2614b8[_0x3862('0x48')](_0xc13ef0);}; \ No newline at end of file +var _0xba85=['join','/var','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','params','get','checkLicense','key','demo','license-info.log'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0xba85,0x120));var _0x5ba8=function(_0x344ed6,_0x3eb850){_0x344ed6=_0x344ed6-0x0;var _0xeec74e=_0xba85[_0x344ed6];return _0xeec74e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ba8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ba8('0x1'));var moment=require(_0x5ba8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5ba8('0x3'));var util=require('util');var path=require(_0x5ba8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ba8('0x5'));var fs=require('fs');var fs_extra=require(_0x5ba8('0x6'));var _=require(_0x5ba8('0x7'));var squel=require(_0x5ba8('0x8'));var crypto=require(_0x5ba8('0x9'));var jsforce=require(_0x5ba8('0xa'));var deskjs=require(_0x5ba8('0xb'));var toCsv=require(_0x5ba8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ba8('0xd'));var authService=require(_0x5ba8('0xe'));var qs=require(_0x5ba8('0xf'));var as=require(_0x5ba8('0x10'));var hardwareService=require(_0x5ba8('0x11'));var logger=require(_0x5ba8('0x12'))('api');var utils=require(_0x5ba8('0x13'));var config=require(_0x5ba8('0x14'));var licenseUtil=require(_0x5ba8('0x15'));var db=require(_0x5ba8('0x16'))['db'];function respondWithStatusCode(_0x535afb,_0x2d3df9){_0x2d3df9=_0x2d3df9||0xcc;return function(_0xfd4d7a){if(_0xfd4d7a){return _0x535afb[_0x5ba8('0x17')](_0x2d3df9);}return _0x535afb['status'](_0x2d3df9)[_0x5ba8('0x18')]();};}function respondWithResult(_0x4ce0aa,_0x3f4127){_0x3f4127=_0x3f4127||0xc8;return function(_0x566f82){if(_0x566f82){return _0x4ce0aa[_0x5ba8('0x19')](_0x3f4127)[_0x5ba8('0x1a')](_0x566f82);}};}function respondWithFilteredResult(_0x1c11b6,_0x51c87a){return function(_0x3be54a){if(_0x3be54a){var _0x2b8900=typeof _0x51c87a[_0x5ba8('0x1b')]==='undefined'&&typeof _0x51c87a['limit']===_0x5ba8('0x1c');var _0x2d0dc9=_0x3be54a[_0x5ba8('0x1d')];var _0x596edb=_0x2b8900?0x0:_0x51c87a['offset'];var _0x3ac6e0=_0x2b8900?_0x3be54a['count']:_0x51c87a['offset']+_0x51c87a[_0x5ba8('0x1e')];var _0x59841e;if(_0x3ac6e0>=_0x2d0dc9){_0x3ac6e0=_0x2d0dc9;_0x59841e=0xc8;}else{_0x59841e=0xce;}_0x1c11b6[_0x5ba8('0x19')](_0x59841e);return _0x1c11b6[_0x5ba8('0x1f')](_0x5ba8('0x20'),_0x596edb+'-'+_0x3ac6e0+'/'+_0x2d0dc9)[_0x5ba8('0x1a')](_0x3be54a);}return null;};}function patchUpdates(_0x8d0008){return function(_0x13067c){try{jsonpatch[_0x5ba8('0x21')](_0x13067c,_0x8d0008,!![]);}catch(_0x2e54b1){return BPromise[_0x5ba8('0x22')](_0x2e54b1);}return _0x13067c[_0x5ba8('0x23')]();};}function saveUpdates(_0x7ecf13,_0x208248){return function(_0xca0eee){if(_0xca0eee){return _0xca0eee[_0x5ba8('0x24')](_0x7ecf13)[_0x5ba8('0x25')](function(_0x8b9963){return _0x8b9963;});}return null;};}function removeEntity(_0x209be6,_0x266430){return function(_0x1d705f){if(_0x1d705f){return _0x1d705f['destroy']()[_0x5ba8('0x25')](function(){_0x209be6['status'](0xcc)[_0x5ba8('0x18')]();});}};}function handleEntityNotFound(_0x306c38,_0x4314b0){return function(_0x67b0c9){if(!_0x67b0c9){_0x306c38[_0x5ba8('0x17')](0x194);}return _0x67b0c9;};}function handleError(_0x54f37c,_0x4b3e4e){_0x4b3e4e=_0x4b3e4e||0x1f4;return function(_0x3a7fba){logger[_0x5ba8('0x26')](_0x3a7fba[_0x5ba8('0x27')]);if(_0x3a7fba[_0x5ba8('0x28')]){delete _0x3a7fba[_0x5ba8('0x28')];}_0x54f37c[_0x5ba8('0x19')](_0x4b3e4e)[_0x5ba8('0x29')](_0x3a7fba);};}var utilLicense=require('../../config/license/util');exports[_0x5ba8('0x2a')]=function(_0xd622a1,_0x32945a){var _0x490138={'raw':!![],'where':{'id':0x1}},_0x27c85c={};_0x27c85c[_0x5ba8('0x2b')]=_[_0x5ba8('0x2c')](db[_0x5ba8('0x2d')][_0x5ba8('0x2e')]);_0x27c85c['query']=_['keys'](_0xd622a1[_0x5ba8('0x2f')]);_0x27c85c[_0x5ba8('0x30')]=_[_0x5ba8('0x31')](_0x27c85c[_0x5ba8('0x2b')],_0x27c85c[_0x5ba8('0x2f')]);_0x490138[_0x5ba8('0x32')]=_[_0x5ba8('0x31')](_0x27c85c['model'],qs['fields'](_0xd622a1['query'][_0x5ba8('0x33')]));_0x490138[_0x5ba8('0x32')]=_0x490138[_0x5ba8('0x32')][_0x5ba8('0x34')]?_0x490138[_0x5ba8('0x32')]:_0x27c85c['model'];_0x490138=_['merge']({},_0x490138,_0xd622a1[_0x5ba8('0x35')]);return utilLicense['getLicense'](_0x490138)['then'](respondWithResult(_0x32945a,null))[_0x5ba8('0x36')](handleError(_0x32945a,null));};exports['update']=function(_0x583fd8,_0x25b126){if(_0x583fd8[_0x5ba8('0x37')]['id']){delete _0x583fd8['body']['id'];}return db[_0x5ba8('0x2d')]['find']({'where':{'id':_0x583fd8[_0x5ba8('0x38')]['id']}})[_0x5ba8('0x25')](handleEntityNotFound(_0x25b126,null))[_0x5ba8('0x25')](function(_0x449167){var _0x2ce3b9=_0x449167[_0x5ba8('0x39')]({'plain':!![]});return utilLicense[_0x5ba8('0x3a')](_0x2ce3b9,_0x583fd8[_0x5ba8('0x37')][_0x5ba8('0x3b')]);})[_0x5ba8('0x25')](function(_0x2fb9a6){if(!_0x2fb9a6[_0x5ba8('0x3c')]){return saveUpdates(_0x583fd8[_0x5ba8('0x37')],null);}return _0x2fb9a6;})[_0x5ba8('0x25')](respondWithResult(_0x25b126,null))[_0x5ba8('0x36')](handleError(_0x25b126,null));};exports['downloadLogFile']=function(_0x1b9ed9,_0x12b26d){var _0x209241=_0x5ba8('0x3d');var _0x5b4479=path[_0x5ba8('0x3e')](_0x5ba8('0x3f'),_0x5ba8('0x40'),'xcally',_0x209241);_0x12b26d[_0x5ba8('0x41')]('Content-disposition',_0x5ba8('0x42')+_0x209241);_0x12b26d[_0x5ba8('0x1f')](_0x5ba8('0x43'),_0x5ba8('0x44'));_0x12b26d[_0x5ba8('0x45')](_0x5b4479);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8ff6a42..10fec48 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 _0xa193=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','License','license'];(function(_0x4c9f70,_0x53990b){var _0x3b1dd9=function(_0x1548fa){while(--_0x1548fa){_0x4c9f70['push'](_0x4c9f70['shift']());}};_0x3b1dd9(++_0x53990b);}(_0xa193,0x138));var _0x3a19=function(_0x2562fe,_0xb4b171){_0x2562fe=_0x2562fe-0x0;var _0x15ebca=_0xa193[_0x2562fe];return _0x15ebca;};'use strict';var _=require(_0x3a19('0x0'));var util=require(_0x3a19('0x1'));var logger=require(_0x3a19('0x2'))(_0x3a19('0x3'));var moment=require(_0x3a19('0x4'));var BPromise=require(_0x3a19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a19('0x6'));var rimraf=require(_0x3a19('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x3a19('0x8')]=function(_0x5772d2,_0x632b3c){return _0x5772d2[_0x3a19('0x9')](_0x3a19('0xa'),attributes,{'tableName':_0x3a19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0a1=['./license.attributes','exports','define','License','license','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xb68cdd,_0x45c638){var _0x130f67=function(_0x5040be){while(--_0x5040be){_0xb68cdd['push'](_0xb68cdd['shift']());}};_0x130f67(++_0x45c638);}(_0xc0a1,0x1f1));var _0x1c0a=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xc0a1[_0x77d310];return _0x2cdce4;};'use strict';var _=require('lodash');var util=require(_0x1c0a('0x0'));var logger=require(_0x1c0a('0x1'))(_0x1c0a('0x2'));var moment=require('moment');var BPromise=require(_0x1c0a('0x3'));var rp=require(_0x1c0a('0x4'));var fs=require('fs');var path=require(_0x1c0a('0x5'));var rimraf=require('rimraf');var config=require(_0x1c0a('0x6'));var attributes=require(_0x1c0a('0x7'));module[_0x1c0a('0x8')]=function(_0x2647a8,_0x4f42b1){return _0x2647a8[_0x1c0a('0x9')](_0x1c0a('0xa'),attributes,{'tableName':_0x1c0a('0xb'),'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 4cd7d0f..d75066f 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 _0xbc90=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x497ed2,_0xf386ec){var _0x44341f=function(_0x58a9e0){while(--_0x58a9e0){_0x497ed2['push'](_0x497ed2['shift']());}};_0x44341f(++_0xf386ec);}(_0xbc90,0x1a2));var _0x0bc9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xbc90[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x0bc9('0x0'));var util=require(_0x0bc9('0x1'));var moment=require(_0x0bc9('0x2'));var BPromise=require(_0x0bc9('0x3'));var rs=require(_0x0bc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bc9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0bc9('0x6'));var config=require(_0x0bc9('0x7'));var jayson=require(_0x0bc9('0x8'));var client=jayson[_0x0bc9('0x9')][_0x0bc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aee04,_0x1f21e1,_0xc2fa1e){return new BPromise(function(_0x452c89,_0x186afa){return client[_0x0bc9('0xb')](_0x4aee04,_0xc2fa1e)[_0x0bc9('0xc')](function(_0x56f21c){logger[_0x0bc9('0xd')](_0x0bc9('0xe'),_0x1f21e1,_0x0bc9('0xf'));logger['debug'](_0x0bc9('0x10'),_0x1f21e1,_0x0bc9('0xf'),JSON[_0x0bc9('0x11')](_0x56f21c));if(_0x56f21c['error']){if(_0x56f21c[_0x0bc9('0x12')][_0x0bc9('0x13')]===0x1f4){logger[_0x0bc9('0x12')](_0x0bc9('0xe'),_0x1f21e1,_0x56f21c[_0x0bc9('0x12')][_0x0bc9('0x14')]);return _0x186afa(_0x56f21c[_0x0bc9('0x12')][_0x0bc9('0x14')]);}logger[_0x0bc9('0x12')](_0x0bc9('0xe'),_0x1f21e1,_0x56f21c['error'][_0x0bc9('0x14')]);return _0x452c89(_0x56f21c[_0x0bc9('0x12')][_0x0bc9('0x14')]);}else{logger[_0x0bc9('0xd')](_0x0bc9('0xe'),_0x1f21e1,_0x0bc9('0xf'));_0x452c89(_0x56f21c['result']['message']);}})[_0x0bc9('0x15')](function(_0xd0f108){logger[_0x0bc9('0x12')](_0x0bc9('0xe'),_0x1f21e1,_0xd0f108);_0x186afa(_0xd0f108);});});} \ No newline at end of file +var _0xe10b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x227f51,_0x8d50b9){var _0x5d1943=function(_0x3d2b07){while(--_0x3d2b07){_0x227f51['push'](_0x227f51['shift']());}};_0x5d1943(++_0x8d50b9);}(_0xe10b,0xda));var _0xbe10=function(_0x371c85,_0x264681){_0x371c85=_0x371c85-0x0;var _0x33fb3c=_0xe10b[_0x371c85];return _0x33fb3c;};'use strict';var _=require('lodash');var util=require(_0xbe10('0x0'));var moment=require(_0xbe10('0x1'));var BPromise=require(_0xbe10('0x2'));var rs=require(_0xbe10('0x3'));var fs=require('fs');var Redis=require(_0xbe10('0x4'));var db=require(_0xbe10('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbe10('0x6'));var jayson=require(_0xbe10('0x7'));var client=jayson[_0xbe10('0x8')][_0xbe10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27c844,_0x1bf9c1,_0x3dbc62){return new BPromise(function(_0x136b94,_0x4ccfbd){return client[_0xbe10('0xa')](_0x27c844,_0x3dbc62)[_0xbe10('0xb')](function(_0x499621){logger['info'](_0xbe10('0xc'),_0x1bf9c1,_0xbe10('0xd'));logger[_0xbe10('0xe')](_0xbe10('0xf'),_0x1bf9c1,_0xbe10('0xd'),JSON[_0xbe10('0x10')](_0x499621));if(_0x499621[_0xbe10('0x11')]){if(_0x499621[_0xbe10('0x11')][_0xbe10('0x12')]===0x1f4){logger[_0xbe10('0x11')](_0xbe10('0xc'),_0x1bf9c1,_0x499621['error'][_0xbe10('0x13')]);return _0x4ccfbd(_0x499621['error']['message']);}logger[_0xbe10('0x11')](_0xbe10('0xc'),_0x1bf9c1,_0x499621[_0xbe10('0x11')]['message']);return _0x136b94(_0x499621['error'][_0xbe10('0x13')]);}else{logger['info'](_0xbe10('0xc'),_0x1bf9c1,_0xbe10('0xd'));_0x136b94(_0x499621[_0xbe10('0x14')]['message']);}})[_0xbe10('0x15')](function(_0x1f08f1){logger[_0xbe10('0x11')]('License,\x20%s,\x20%s',_0x1bf9c1,_0x1f08f1);_0x4ccfbd(_0x1f08f1);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 393e8d1..ef95543 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 _0x7672=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getApplications','getMessages','verifySmtp','/:id/users','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','/:id/applications','addApplications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','/:id/out_servers','removeSmtp','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x7672,0x74));var _0x2767=function(_0x4ad924,_0x240bed){_0x4ad924=_0x4ad924-0x0;var _0x107578=_0x7672[_0x4ad924];return _0x107578;};'use strict';var multer=require(_0x2767('0x0'));var util=require('util');var path=require(_0x2767('0x1'));var timeout=require('connect-timeout');var express=require(_0x2767('0x2'));var router=express[_0x2767('0x3')]();var fs_extra=require(_0x2767('0x4'));var auth=require(_0x2767('0x5'));var interaction=require(_0x2767('0x6'));var config=require('../../config/environment');var controller=require(_0x2767('0x7'));router[_0x2767('0x8')]('/',auth[_0x2767('0x9')](),controller[_0x2767('0xa')]);router[_0x2767('0x8')](_0x2767('0xb'),auth[_0x2767('0x9')](),controller[_0x2767('0xc')]);router[_0x2767('0x8')](_0x2767('0xd'),auth[_0x2767('0x9')](),controller[_0x2767('0xe')]);router[_0x2767('0x8')](_0x2767('0xf'),auth[_0x2767('0x9')](),controller[_0x2767('0x10')]);router[_0x2767('0x8')]('/:id/canned_answers',auth[_0x2767('0x9')](),controller[_0x2767('0x11')]);router[_0x2767('0x8')](_0x2767('0x12'),auth['isAuthenticated'](),controller['getImap']);router[_0x2767('0x8')]('/:id/out_servers',auth[_0x2767('0x9')](),controller['getSmtp']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x2767('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x2767('0x13')]);router[_0x2767('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2767('0x14')]);router[_0x2767('0x8')]('/:id/verify',auth[_0x2767('0x9')](),controller[_0x2767('0x15')]);router[_0x2767('0x8')](_0x2767('0x16'),auth[_0x2767('0x9')](),controller['getAgents']);router[_0x2767('0x17')](_0x2767('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x2767('0x17')](_0x2767('0x18'),auth[_0x2767('0x9')](),controller[_0x2767('0x19')]);router[_0x2767('0x17')]('/',auth[_0x2767('0x9')](),controller[_0x2767('0x1a')]);router[_0x2767('0x17')]('/:id/in_servers',auth[_0x2767('0x9')](),controller[_0x2767('0x1b')]);router['post']('/:id/out_servers',auth[_0x2767('0x9')](),controller[_0x2767('0x1c')]);router['post'](_0x2767('0x1d'),auth[_0x2767('0x9')](),controller[_0x2767('0x1e')]);router[_0x2767('0x17')](_0x2767('0x1f'),auth[_0x2767('0x9')](),controller[_0x2767('0x20')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x2767('0x21')]);router[_0x2767('0x17')](_0x2767('0x16'),auth[_0x2767('0x9')](),controller[_0x2767('0x22')]);router[_0x2767('0x23')]('/:id',auth[_0x2767('0x9')](),controller[_0x2767('0x24')]);router[_0x2767('0x25')]('/:id/dispositions',auth[_0x2767('0x9')](),controller[_0x2767('0x26')]);router[_0x2767('0x25')](_0x2767('0x18'),auth['isAuthenticated'](),controller[_0x2767('0x27')]);router[_0x2767('0x25')](_0x2767('0x12'),auth[_0x2767('0x9')](),controller['removeImap']);router[_0x2767('0x25')](_0x2767('0x28'),auth[_0x2767('0x9')](),controller[_0x2767('0x29')]);router[_0x2767('0x25')]('/:id',auth[_0x2767('0x9')](),controller['destroy']);router['delete'](_0x2767('0x16'),auth[_0x2767('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x473b=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/messages','getMessages','verifySmtp','/:id/users','post','addAnswer','create','/:id/in_servers','addImap','/:id/interactions','addApplications','send','addAgents','put','removeDispositions','delete','removeAnswers','removeSmtp','/:id','destroy','removeAgents','exports','multer'];(function(_0x17a760,_0x539893){var _0x354340=function(_0x1be248){while(--_0x1be248){_0x17a760['push'](_0x17a760['shift']());}};_0x354340(++_0x539893);}(_0x473b,0xd1));var _0xb473=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x473b[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0xb473('0x0'));var util=require(_0xb473('0x1'));var path=require(_0xb473('0x2'));var timeout=require('connect-timeout');var express=require(_0xb473('0x3'));var router=express['Router']();var fs_extra=require(_0xb473('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb473('0x5'));var config=require(_0xb473('0x6'));var controller=require('./mailAccount.controller');router[_0xb473('0x7')]('/',auth[_0xb473('0x8')](),controller[_0xb473('0x9')]);router[_0xb473('0x7')](_0xb473('0xa'),auth[_0xb473('0x8')](),controller[_0xb473('0xb')]);router[_0xb473('0x7')]('/:id',auth[_0xb473('0x8')](),controller[_0xb473('0xc')]);router['get'](_0xb473('0xd'),auth['isAuthenticated'](),controller[_0xb473('0xe')]);router[_0xb473('0x7')](_0xb473('0xf'),auth[_0xb473('0x8')](),controller['getAnswers']);router[_0xb473('0x7')]('/:id/in_servers',auth[_0xb473('0x8')](),controller[_0xb473('0x10')]);router['get'](_0xb473('0x11'),auth[_0xb473('0x8')](),controller[_0xb473('0x12')]);router[_0xb473('0x7')]('/:id/interactions',auth[_0xb473('0x8')](),controller[_0xb473('0x13')]);router[_0xb473('0x7')]('/:id/applications',auth[_0xb473('0x8')](),controller['getApplications']);router[_0xb473('0x7')](_0xb473('0x14'),auth[_0xb473('0x8')](),controller[_0xb473('0x15')]);router[_0xb473('0x7')]('/:id/verify',auth[_0xb473('0x8')](),controller[_0xb473('0x16')]);router[_0xb473('0x7')](_0xb473('0x17'),auth[_0xb473('0x8')](),controller['getAgents']);router[_0xb473('0x18')](_0xb473('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xb473('0x8')](),controller[_0xb473('0x19')]);router[_0xb473('0x18')]('/',auth[_0xb473('0x8')](),controller[_0xb473('0x1a')]);router[_0xb473('0x18')](_0xb473('0x1b'),auth['isAuthenticated'](),controller[_0xb473('0x1c')]);router['post'](_0xb473('0x11'),auth[_0xb473('0x8')](),controller['addSmtp']);router[_0xb473('0x18')](_0xb473('0x1d'),auth[_0xb473('0x8')](),controller['addInteraction']);router[_0xb473('0x18')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb473('0x1e')]);router[_0xb473('0x18')]('/:id/send',auth[_0xb473('0x8')](),controller[_0xb473('0x1f')]);router[_0xb473('0x18')](_0xb473('0x17'),auth[_0xb473('0x8')](),controller[_0xb473('0x20')]);router[_0xb473('0x21')]('/:id',auth[_0xb473('0x8')](),controller['update']);router['delete']('/:id/dispositions',auth[_0xb473('0x8')](),controller[_0xb473('0x22')]);router[_0xb473('0x23')]('/:id/canned_answers',auth[_0xb473('0x8')](),controller[_0xb473('0x24')]);router[_0xb473('0x23')](_0xb473('0x1b'),auth['isAuthenticated'](),controller['removeImap']);router[_0xb473('0x23')]('/:id/out_servers',auth[_0xb473('0x8')](),controller[_0xb473('0x25')]);router[_0xb473('0x23')](_0xb473('0x26'),auth[_0xb473('0x8')](),controller[_0xb473('0x27')]);router[_0xb473('0x23')](_0xb473('0x17'),auth[_0xb473('0x8')](),controller[_0xb473('0x28')]);module[_0xb473('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e92c4a7..73a4cd5 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 _0x33dc=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','UNSIGNED'];(function(_0x5e6959,_0x9e4166){var _0x52c348=function(_0x4f1a7d){while(--_0x4f1a7d){_0x5e6959['push'](_0x5e6959['shift']());}};_0x52c348(++_0x9e4166);}(_0x33dc,0x12a));var _0xc33d=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0x33dc[_0x2bf5bd];return _0xc810c0;};'use strict';var Sequelize=require(_0xc33d('0x0'));module[_0xc33d('0x1')]={'description':{'type':Sequelize[_0xc33d('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc33d('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc33d('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc33d('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xc33d('0x4')]},'markAsUnread':{'type':Sequelize[_0xc33d('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xc33d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc33d('0x6');}},'notificationSound':{'type':Sequelize[_0xc33d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc33d('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc33d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc33d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc33d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc33d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc33d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc33d('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc33d('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x55acc0){if(!_0x55acc0)this['setDataValue'](_0xc33d('0x8'),null);this[_0xc33d('0x9')](_0xc33d('0xa'),_0x55acc0);}},'provider':{'type':Sequelize[_0xc33d('0xb')](_0xc33d('0xc'),_0xc33d('0xd'),_0xc33d('0xe'),_0xc33d('0xf')),'defaultValue':null,'get':function(){var _0x33b187=this[_0xc33d('0x10')](_0xc33d('0x11'));return _0x33b187||'custom';},'set':function(_0x1088e6){if(_0x1088e6===_0xc33d('0x12')){_0x1088e6=null;}return this[_0xc33d('0x9')](_0xc33d('0x11'),_0x1088e6);}}}; \ No newline at end of file +var _0x7de3=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT'];(function(_0x40aaf5,_0x19a868){var _0x52a10a=function(_0x22f91d){while(--_0x22f91d){_0x40aaf5['push'](_0x40aaf5['shift']());}};_0x52a10a(++_0x19a868);}(_0x7de3,0xba));var _0x37de=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7de3[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module[_0x37de('0x0')]={'description':{'type':Sequelize[_0x37de('0x1')]},'name':{'type':Sequelize[_0x37de('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x37de('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x37de('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x37de('0x3')]},'markAsUnread':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x37de('0x1')],'allowNull':![],'defaultValue':_0x37de('0x4')},'fontSize':{'type':Sequelize[_0x37de('0x5')](0x2)[_0x37de('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x37de('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x37de('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x37de('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x37de('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x37de('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x37de('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![],'comment':_0x37de('0x8'),'set':function(_0x1ed20e){if(!_0x1ed20e)this[_0x37de('0x9')](_0x37de('0xa'),null);this['setDataValue'](_0x37de('0xb'),_0x1ed20e);}},'provider':{'type':Sequelize['ENUM'](_0x37de('0xc'),_0x37de('0xd'),_0x37de('0xe'),_0x37de('0xf')),'defaultValue':null,'get':function(){var _0x3cf811=this[_0x37de('0x10')](_0x37de('0x11'));return _0x3cf811||_0x37de('0x12');},'set':function(_0x291c9e){if(_0x291c9e===_0x37de('0x12')){_0x291c9e=null;}return this[_0x37de('0x9')](_0x37de('0x11'),_0x291c9e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index adae48c..d0ac532 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 _0xb6a9=['smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','length','includeAll','find','body','custom','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','merge','rows','ids','addAnswer','MailAccountId','getAnswers','CannedAnswer','removeAnswers','email','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','MailMessage','$gte','split','format','true','CmList','List','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','Contacts','ListId','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','api','../../config/environment','defaults','redis','socket.io-emitter','./mailAccount.socket','register','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','limit','undefined','count','set','Content-Range','update','then','get','MailAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','send','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com'];(function(_0x4d67bd,_0x5b2cf5){var _0x4a5ce1=function(_0x45862e){while(--_0x45862e){_0x4d67bd['push'](_0x4d67bd['shift']());}};_0x4a5ce1(++_0x5b2cf5);}(_0xb6a9,0x90));var _0x9b6a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb6a9[_0x13d07a];return _0x5ee0ee;};'use strict';var moment=require(_0x9b6a('0x0'));var BPromise=require(_0x9b6a('0x1'));var util=require(_0x9b6a('0x2'));var path=require(_0x9b6a('0x3'));var _=require('lodash');var juice=require(_0x9b6a('0x4'));var Redis=require(_0x9b6a('0x5'));var qs=require(_0x9b6a('0x6'));var logger=require('../../config/logger')(_0x9b6a('0x7'));var config=require(_0x9b6a('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9b6a('0x9')](config[_0x9b6a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b6a('0xb'))(new Redis(config[_0x9b6a('0xa')]));require(_0x9b6a('0xc'))[_0x9b6a('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9b6a('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x231424,_0x21ea1b,_0x4c809b,_0x5eea24){return new BPromise(function(_0x5ae37c,_0x3211cb){var _0x2fe27d=_0x5eea24||client;return _0x2fe27d[_0x9b6a('0xf')](_0x231424,_0x4c809b)['then'](function(_0x425471){logger[_0x9b6a('0x10')](_0x9b6a('0x11'),_0x21ea1b,_0x9b6a('0x12'));logger[_0x9b6a('0x13')](_0x9b6a('0x14'),_0x21ea1b,'request\x20sent',JSON[_0x9b6a('0x15')](_0x425471));if(_0x425471[_0x9b6a('0x16')]){if(_0x425471[_0x9b6a('0x16')]['code']===0x1f4){logger['error'](_0x9b6a('0x11'),_0x21ea1b,_0x425471[_0x9b6a('0x16')][_0x9b6a('0x17')]);return _0x3211cb(_0x425471['error'][_0x9b6a('0x17')]);}logger[_0x9b6a('0x16')](_0x9b6a('0x11'),_0x21ea1b,_0x425471[_0x9b6a('0x16')][_0x9b6a('0x17')]);return _0x5ae37c(_0x425471[_0x9b6a('0x16')][_0x9b6a('0x17')]);}else{logger[_0x9b6a('0x10')](_0x9b6a('0x11'),_0x21ea1b,'request\x20sent');_0x5ae37c(_0x425471[_0x9b6a('0x18')][_0x9b6a('0x17')]);}})['catch'](function(_0x3a09e5){logger['error'](_0x9b6a('0x11'),_0x21ea1b,_0x3a09e5);_0x3211cb(_0x3a09e5);});});}function respondWithStatusCode(_0x8ad7ca,_0xfb5973){_0xfb5973=_0xfb5973||0xcc;return function(_0x3701fe){if(_0x3701fe){return _0x8ad7ca['sendStatus'](_0xfb5973);}return _0x8ad7ca['status'](_0xfb5973)['end']();};}function respondWithResult(_0x211a1f,_0x4fe906){_0x4fe906=_0x4fe906||0xc8;return function(_0x3217bc){if(_0x3217bc){return _0x211a1f[_0x9b6a('0x19')](_0x4fe906)[_0x9b6a('0x1a')](_0x3217bc);}};}function respondWithFilteredResult(_0x2e7639,_0x1162d5){return function(_0x42cf62){if(_0x42cf62){var _0x567560=typeof _0x1162d5[_0x9b6a('0x1b')]==='undefined'&&typeof _0x1162d5[_0x9b6a('0x1c')]===_0x9b6a('0x1d');var _0x37f112=_0x42cf62['count'];var _0x51863a=_0x567560?0x0:_0x1162d5[_0x9b6a('0x1b')];var _0x5e5581=_0x567560?_0x42cf62[_0x9b6a('0x1e')]:_0x1162d5[_0x9b6a('0x1b')]+_0x1162d5[_0x9b6a('0x1c')];var _0x4ba7b7;if(_0x5e5581>=_0x37f112){_0x5e5581=_0x37f112;_0x4ba7b7=0xc8;}else{_0x4ba7b7=0xce;}_0x2e7639[_0x9b6a('0x19')](_0x4ba7b7);return _0x2e7639[_0x9b6a('0x1f')](_0x9b6a('0x20'),_0x51863a+'-'+_0x5e5581+'/'+_0x37f112)[_0x9b6a('0x1a')](_0x42cf62);}return null;};}function saveUpdates(_0xaa99da){return function(_0x259925){if(_0x259925){return _0x259925[_0x9b6a('0x21')](_0xaa99da)[_0x9b6a('0x22')](function(_0x4a66a8){return _0x4a66a8;});}return null;};}function removeEntity(_0x11e40d){return function(_0x3d24c4){if(_0x3d24c4){return _0x3d24c4['destroy']()[_0x9b6a('0x22')](function(){var _0x26bb03=_0x3d24c4[_0x9b6a('0x23')]({'plain':!![]});var _0x504196=_0x9b6a('0x24');return db[_0x9b6a('0x25')][_0x9b6a('0x26')]({'where':{'type':_0x504196,'resourceId':_0x26bb03['id']}})['then'](function(){return _0x3d24c4;});})[_0x9b6a('0x22')](function(){_0x11e40d[_0x9b6a('0x19')](0xcc)[_0x9b6a('0x27')]();});}};}function handleEntityNotFound(_0x54d653){return function(_0x3289d0){if(!_0x3289d0){_0x54d653[_0x9b6a('0x28')](0x194);}return _0x3289d0;};}function handleError(_0x5028f6,_0x1f2f2a){_0x1f2f2a=_0x1f2f2a||0x1f4;return function(_0x574db3){logger[_0x9b6a('0x16')](_0x574db3[_0x9b6a('0x29')]);if(_0x574db3[_0x9b6a('0x2a')]){delete _0x574db3[_0x9b6a('0x2a')];}_0x5028f6[_0x9b6a('0x19')](_0x1f2f2a)[_0x9b6a('0x2b')](_0x574db3);};}function getImapHost(_0x4d7b7f){switch(_0x4d7b7f){case'gmail':return _0x9b6a('0x2c');case'yahoo':return'imap.mail.yahoo.com';case _0x9b6a('0x2d'):return _0x9b6a('0x2e');case'outlook365':return _0x9b6a('0x2f');}throw new Error(_0x9b6a('0x30'),_0x4d7b7f);}function getSmtpHost(_0x19cfee){switch(_0x19cfee){case _0x9b6a('0x31'):return _0x9b6a('0x32');case'yahoo':return _0x9b6a('0x33');case'hotmail':return'smtp-mail.outlook.com';case _0x9b6a('0x34'):return _0x9b6a('0x35');}throw new Error(_0x9b6a('0x30'),_0x19cfee);}function getAuthenticationOptions(_0x2032e7,_0x3eb0cc){var _0x331db0={};var _0x13f50b={};if(_0x2032e7){_0x331db0[_0x9b6a('0x36')]=_0x13f50b[_0x9b6a('0x36')]=_0x3eb0cc['username'];_0x331db0[_0x9b6a('0x37')]=_0x13f50b[_0x9b6a('0x38')]=_0x3eb0cc[_0x9b6a('0x37')];if(_0x3eb0cc[_0x9b6a('0x39')]){_0x331db0['modernAuthentication']=_0x13f50b[_0x9b6a('0x39')]=!![];_0x331db0[_0x9b6a('0x3a')]=_0x13f50b[_0x9b6a('0x3a')]=_0x3eb0cc[_0x9b6a('0x3a')];_0x331db0[_0x9b6a('0x37')]=_0x13f50b[_0x9b6a('0x38')]=null;}else{_0x331db0[_0x9b6a('0x3a')]=_0x13f50b[_0x9b6a('0x3a')]=null;}_0x331db0['host']=getImapHost(_0x2032e7);_0x331db0[_0x9b6a('0x3b')]=0x3e1;_0x13f50b[_0x9b6a('0x3c')]=getSmtpHost(_0x2032e7);_0x13f50b['port']=0x24b;_0x13f50b[_0x9b6a('0x3d')]=![];_0x331db0[_0x9b6a('0x3e')]=_0x13f50b[_0x9b6a('0x3e')]=null;}else{if(_0x3eb0cc[_0x9b6a('0x3f')]){_0x331db0[_0x9b6a('0x36')]=_0x13f50b[_0x9b6a('0x36')]=_0x3eb0cc['username'];_0x331db0[_0x9b6a('0x37')]=_0x13f50b[_0x9b6a('0x38')]=_0x3eb0cc[_0x9b6a('0x37')];}else{_0x331db0[_0x9b6a('0x3f')]=_0x13f50b[_0x9b6a('0x3f')]=![];_0x331db0[_0x9b6a('0x36')]=_0x13f50b[_0x9b6a('0x36')]=null;_0x331db0[_0x9b6a('0x37')]=_0x13f50b['pass']=null;}_0x331db0[_0x9b6a('0x3c')]=_0x3eb0cc[_0x9b6a('0x40')]['host'];_0x331db0['port']=_0x3eb0cc[_0x9b6a('0x40')][_0x9b6a('0x3b')];_0x13f50b[_0x9b6a('0x3c')]=_0x3eb0cc[_0x9b6a('0x41')][_0x9b6a('0x3c')];_0x13f50b[_0x9b6a('0x3b')]=_0x3eb0cc[_0x9b6a('0x41')]['port'];}return{'Imap':_0x331db0,'Smtp':_0x13f50b};}exports[_0x9b6a('0x42')]=function(_0x37e8a2,_0x23557b){var _0x10192e={'include':[{'model':db[_0x9b6a('0x43')],'as':_0x9b6a('0x40')},{'model':db[_0x9b6a('0x44')],'as':_0x9b6a('0x41')},{'model':db[_0x9b6a('0x45')],'as':_0x9b6a('0x46')}]},_0x155dbb={},_0x47aac3={'count':0x0,'rows':[]};var _0x39ae5d=_[_0x9b6a('0x47')](db[_0x9b6a('0x48')][_0x9b6a('0x49')],function(_0x21e7ee){return{'name':_0x21e7ee[_0x9b6a('0x4a')],'type':_0x21e7ee[_0x9b6a('0x4b')][_0x9b6a('0x4c')]};});_0x155dbb[_0x9b6a('0x4d')]=_[_0x9b6a('0x47')](_0x39ae5d,_0x9b6a('0x2a'));_0x155dbb[_0x9b6a('0x4e')]=_[_0x9b6a('0x4f')](_0x37e8a2[_0x9b6a('0x4e')]);_0x155dbb[_0x9b6a('0x50')]=_[_0x9b6a('0x51')](_0x155dbb[_0x9b6a('0x4d')],_0x155dbb[_0x9b6a('0x4e')]);_0x10192e['attributes']=_[_0x9b6a('0x51')](_0x155dbb[_0x9b6a('0x4d')],qs[_0x9b6a('0x52')](_0x37e8a2['query'][_0x9b6a('0x52')]));_0x10192e['attributes']=_0x10192e['attributes']['length']?_0x10192e[_0x9b6a('0x53')]:_0x155dbb[_0x9b6a('0x4d')];if(!_0x37e8a2[_0x9b6a('0x4e')][_0x9b6a('0x54')](_0x9b6a('0x55'))){_0x10192e[_0x9b6a('0x1c')]=qs['limit'](_0x37e8a2[_0x9b6a('0x4e')]['limit']);_0x10192e[_0x9b6a('0x1b')]=qs[_0x9b6a('0x1b')](_0x37e8a2['query']['offset']);}_0x10192e[_0x9b6a('0x56')]=qs[_0x9b6a('0x57')](_0x37e8a2[_0x9b6a('0x4e')][_0x9b6a('0x57')]);_0x10192e[_0x9b6a('0x58')]=qs[_0x9b6a('0x50')](_[_0x9b6a('0x59')](_0x37e8a2['query'],_0x155dbb[_0x9b6a('0x50')]),_0x39ae5d);if(_0x37e8a2[_0x9b6a('0x4e')][_0x9b6a('0x5a')]){_0x10192e[_0x9b6a('0x58')]=_['merge'](_0x10192e[_0x9b6a('0x58')],{'$or':_[_0x9b6a('0x47')](_0x39ae5d,function(_0x5be8f9){if(_0x5be8f9[_0x9b6a('0x4b')]!==_0x9b6a('0x5b')){var _0x38a90c={};_0x38a90c[_0x5be8f9[_0x9b6a('0x2a')]]={'$like':'%'+_0x37e8a2[_0x9b6a('0x4e')][_0x9b6a('0x5a')]+'%'};return _0x38a90c;}})});}_0x10192e=_['merge']({},_0x10192e,_0x37e8a2[_0x9b6a('0x5c')]);var _0x43a543={'where':_0x10192e[_0x9b6a('0x58')]};return db[_0x9b6a('0x48')][_0x9b6a('0x1e')](_0x43a543)[_0x9b6a('0x22')](function(_0x1b7e86){_0x47aac3['count']=_0x1b7e86;if(_0x37e8a2[_0x9b6a('0x4e')]['includeAll']){_0x10192e[_0x9b6a('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x9b6a('0x5e')](_0x10192e);})[_0x9b6a('0x22')](function(_0x3bb74e){_0x47aac3['rows']=_0x3bb74e;return _0x47aac3;})['then'](respondWithFilteredResult(_0x23557b,_0x10192e))[_0x9b6a('0x5f')](handleError(_0x23557b,null));};exports['show']=function(_0x3ebccd,_0x2e319e){var _0x35e57b={'raw':![],'where':{'id':_0x3ebccd[_0x9b6a('0x60')]['id']},'include':[{'model':db[_0x9b6a('0x43')],'as':_0x9b6a('0x40')},{'model':db[_0x9b6a('0x44')],'as':'Smtp'},{'model':db[_0x9b6a('0x45')],'as':_0x9b6a('0x46')}]},_0x330774={};_0x330774['model']=_['keys'](db[_0x9b6a('0x48')][_0x9b6a('0x49')]);_0x330774['query']=_[_0x9b6a('0x4f')](_0x3ebccd[_0x9b6a('0x4e')]);_0x330774['filters']=_['intersection'](_0x330774['model'],_0x330774[_0x9b6a('0x4e')]);_0x35e57b[_0x9b6a('0x53')]=_[_0x9b6a('0x51')](_0x330774[_0x9b6a('0x4d')],qs[_0x9b6a('0x52')](_0x3ebccd[_0x9b6a('0x4e')][_0x9b6a('0x52')]));_0x35e57b[_0x9b6a('0x53')]=_0x35e57b[_0x9b6a('0x53')][_0x9b6a('0x61')]?_0x35e57b[_0x9b6a('0x53')]:_0x330774[_0x9b6a('0x4d')];if(_0x3ebccd[_0x9b6a('0x4e')][_0x9b6a('0x62')]){_0x35e57b[_0x9b6a('0x5d')]=[{'all':!![]}];}_0x35e57b=_['merge']({},_0x35e57b,_0x3ebccd[_0x9b6a('0x5c')]);return db[_0x9b6a('0x48')][_0x9b6a('0x63')](_0x35e57b)[_0x9b6a('0x22')](handleEntityNotFound(_0x2e319e,null))[_0x9b6a('0x22')](respondWithResult(_0x2e319e,null))[_0x9b6a('0x5f')](handleError(_0x2e319e,null));};exports[_0x9b6a('0x21')]=function(_0x5a65e8,_0x66422f){if(_0x5a65e8[_0x9b6a('0x64')]['id']){delete _0x5a65e8[_0x9b6a('0x64')]['id'];}var _0x5d3e2d=_0x5a65e8['body']['provider']===_0x9b6a('0x65')?null:_0x5a65e8[_0x9b6a('0x64')][_0x9b6a('0x66')];var _0xfe7036=_0x5a65e8[_0x9b6a('0x64')]['Imap']||{};var _0x22c426=_0x5a65e8[_0x9b6a('0x64')][_0x9b6a('0x41')]||{};if(_0x5d3e2d){_0xfe7036[_0x9b6a('0x3c')]=getImapHost(_0x5d3e2d);_0xfe7036['port']=0x3e1;_0x22c426[_0x9b6a('0x3c')]=getSmtpHost(_0x5d3e2d);_0x22c426[_0x9b6a('0x3b')]=0x24b;_0x22c426[_0x9b6a('0x3d')]=![];}if(_0x22c426[_0x9b6a('0x39')]){_0x22c426[_0x9b6a('0x3d')]=![];}else{_0x22c426[_0x9b6a('0x3a')]=null;}if(!_0xfe7036['modernAuthentication'])_0xfe7036[_0x9b6a('0x3a')]=null;_0x5a65e8['body'][_0x9b6a('0x40')]=_0xfe7036;_0x5a65e8['body'][_0x9b6a('0x41')]=_0x22c426;return db[_0x9b6a('0x48')]['find']({'where':{'id':_0x5a65e8[_0x9b6a('0x60')]['id']},'include':[{'model':db[_0x9b6a('0x43')],'as':_0x9b6a('0x40')},{'model':db[_0x9b6a('0x44')],'as':'Smtp'},{'model':db[_0x9b6a('0x45')],'as':_0x9b6a('0x46')}]})['then'](handleEntityNotFound(_0x66422f,null))[_0x9b6a('0x22')](function(_0x3c0dc8){if(!_0x3c0dc8)throw new Error(_0x9b6a('0x67'));if(_0x3c0dc8['service'])delete _0x5a65e8[_0x9b6a('0x64')]['Imap'];return _0x3c0dc8;})[_0x9b6a('0x22')](saveUpdates(_0x5a65e8[_0x9b6a('0x64')],null))['then'](function(_0x49655c){if(!_0x5a65e8[_0x9b6a('0x64')][_0x9b6a('0x40')])return _0x49655c;return db[_0x9b6a('0x43')]['update'](_0x5a65e8[_0x9b6a('0x64')]['Imap'],{'where':{'MailAccountId':_0x49655c['id']}})[_0x9b6a('0x22')](function(){return _0x49655c;});})[_0x9b6a('0x22')](function(_0x34ca18){if(!_0x5a65e8[_0x9b6a('0x64')][_0x9b6a('0x41')])return _0x34ca18;return db['MailServerOut'][_0x9b6a('0x21')](_0x5a65e8[_0x9b6a('0x64')][_0x9b6a('0x41')],{'where':{'MailAccountId':_0x34ca18['id']}})[_0x9b6a('0x22')](function(){return _0x34ca18;});})[_0x9b6a('0x22')](respondWithResult(_0x66422f,null))[_0x9b6a('0x5f')](handleError(_0x66422f,null));};exports[_0x9b6a('0x68')]=function(_0x45e75b,_0x346148){return db[_0x9b6a('0x48')][_0x9b6a('0x68')]()['then'](respondWithResult(_0x346148,null))[_0x9b6a('0x5f')](handleError(_0x346148,null));};exports[_0x9b6a('0x69')]=function(_0x22ec99,_0x383816){if(_0x22ec99['body']['id']){delete _0x22ec99['body']['id'];}return db[_0x9b6a('0x48')][_0x9b6a('0x63')]({'where':{'id':_0x22ec99[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x383816,null))[_0x9b6a('0x22')](function(_0x394575){if(_0x394575){_0x22ec99['body']['MailAccountId']=_0x394575['id'];return db[_0x9b6a('0x6a')][_0x9b6a('0x6b')](_0x22ec99['body']);}})[_0x9b6a('0x22')](respondWithResult(_0x383816,null))['catch'](handleError(_0x383816,null));};exports[_0x9b6a('0x6c')]=function(_0x535df0,_0x2a6dd7){var _0x32e3bd={'raw':![],'where':{}};var _0x50029d={};var _0x2c0556={'count':0x0,'rows':[]};return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0x535df0['params']['id']}})['then'](handleEntityNotFound(_0x2a6dd7,null))[_0x9b6a('0x22')](function(_0x47e91b){if(_0x47e91b){_0x50029d[_0x9b6a('0x4d')]=_[_0x9b6a('0x4f')](db['Disposition'][_0x9b6a('0x49')]);_0x50029d['query']=_[_0x9b6a('0x4f')](_0x535df0[_0x9b6a('0x4e')]);_0x50029d['filters']=_['intersection'](_0x50029d[_0x9b6a('0x4d')],_0x50029d[_0x9b6a('0x4e')]);_0x32e3bd[_0x9b6a('0x53')]=_[_0x9b6a('0x51')](_0x50029d[_0x9b6a('0x4d')],qs[_0x9b6a('0x52')](_0x535df0[_0x9b6a('0x4e')][_0x9b6a('0x52')]));_0x32e3bd[_0x9b6a('0x53')]=_0x32e3bd[_0x9b6a('0x53')][_0x9b6a('0x61')]?_0x32e3bd[_0x9b6a('0x53')]:_0x50029d[_0x9b6a('0x4d')];if(!_0x535df0[_0x9b6a('0x4e')][_0x9b6a('0x54')](_0x9b6a('0x55'))){_0x32e3bd[_0x9b6a('0x1c')]=qs[_0x9b6a('0x1c')](_0x535df0['query'][_0x9b6a('0x1c')]);_0x32e3bd[_0x9b6a('0x1b')]=qs[_0x9b6a('0x1b')](_0x535df0[_0x9b6a('0x4e')][_0x9b6a('0x1b')]);}_0x32e3bd['order']=qs[_0x9b6a('0x57')](_0x535df0['query'][_0x9b6a('0x57')]);_0x32e3bd[_0x9b6a('0x58')]=qs[_0x9b6a('0x50')](_[_0x9b6a('0x59')](_0x535df0[_0x9b6a('0x4e')],_0x50029d[_0x9b6a('0x50')]));_0x32e3bd[_0x9b6a('0x58')]['MailAccountId']=_0x47e91b['id'];if(_0x535df0[_0x9b6a('0x4e')][_0x9b6a('0x5a')]){_0x32e3bd['where']=_['merge'](_0x32e3bd[_0x9b6a('0x58')],{'$or':_[_0x9b6a('0x47')](_0x32e3bd['attributes'],function(_0x3ed71a){var _0x5caf97={};_0x5caf97[_0x3ed71a]={'$like':'%'+_0x535df0[_0x9b6a('0x4e')][_0x9b6a('0x5a')]+'%'};return _0x5caf97;})});}_0x32e3bd=_[_0x9b6a('0x6e')]({},_0x32e3bd,_0x535df0[_0x9b6a('0x5c')]);return db[_0x9b6a('0x6a')]['count']({'where':_0x32e3bd['where']})[_0x9b6a('0x22')](function(_0x30cf0a){_0x2c0556['count']=_0x30cf0a;if(_0x535df0[_0x9b6a('0x4e')]['includeAll']){_0x32e3bd['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x32e3bd);})['then'](function(_0x2b6ada){_0x2c0556[_0x9b6a('0x6f')]=_0x2b6ada;return _0x2c0556;});}})[_0x9b6a('0x22')](respondWithFilteredResult(_0x2a6dd7,_0x32e3bd))[_0x9b6a('0x5f')](handleError(_0x2a6dd7,null));};exports['removeDispositions']=function(_0x3a2699,_0x5be367){return db[_0x9b6a('0x48')]['find']({'where':{'id':_0x3a2699[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x5be367,null))['then'](function(_0x3e9c83){if(_0x3e9c83){return _0x3e9c83['removeDispositions'](_0x3a2699[_0x9b6a('0x4e')][_0x9b6a('0x70')]);}})[_0x9b6a('0x22')](respondWithStatusCode(_0x5be367,null))[_0x9b6a('0x5f')](handleError(_0x5be367,null));};exports[_0x9b6a('0x71')]=function(_0x5f1ab5,_0x494e25){if(_0x5f1ab5[_0x9b6a('0x64')]['id']){delete _0x5f1ab5[_0x9b6a('0x64')]['id'];}return db[_0x9b6a('0x48')]['find']({'where':{'id':_0x5f1ab5[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x494e25,null))[_0x9b6a('0x22')](function(_0x7f44a){if(_0x7f44a){_0x5f1ab5[_0x9b6a('0x64')][_0x9b6a('0x72')]=_0x7f44a['id'];return db['CannedAnswer'][_0x9b6a('0x6b')](_0x5f1ab5[_0x9b6a('0x64')]);}})[_0x9b6a('0x22')](respondWithResult(_0x494e25,null))[_0x9b6a('0x5f')](handleError(_0x494e25,null));};exports[_0x9b6a('0x73')]=function(_0x4ce742,_0x212073){var _0x511081={'raw':![],'where':{}};var _0x572609={};var _0x43cf1c={'count':0x0,'rows':[]};return db[_0x9b6a('0x48')]['findOne']({'where':{'id':_0x4ce742[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x212073,null))['then'](function(_0x50870a){if(_0x50870a){_0x572609[_0x9b6a('0x4d')]=_[_0x9b6a('0x4f')](db[_0x9b6a('0x74')][_0x9b6a('0x49')]);_0x572609[_0x9b6a('0x4e')]=_['keys'](_0x4ce742['query']);_0x572609[_0x9b6a('0x50')]=_[_0x9b6a('0x51')](_0x572609['model'],_0x572609[_0x9b6a('0x4e')]);_0x511081['attributes']=_[_0x9b6a('0x51')](_0x572609[_0x9b6a('0x4d')],qs[_0x9b6a('0x52')](_0x4ce742['query'][_0x9b6a('0x52')]));_0x511081[_0x9b6a('0x53')]=_0x511081[_0x9b6a('0x53')]['length']?_0x511081['attributes']:_0x572609[_0x9b6a('0x4d')];if(!_0x4ce742[_0x9b6a('0x4e')][_0x9b6a('0x54')](_0x9b6a('0x55'))){_0x511081[_0x9b6a('0x1c')]=qs['limit'](_0x4ce742[_0x9b6a('0x4e')]['limit']);_0x511081[_0x9b6a('0x1b')]=qs[_0x9b6a('0x1b')](_0x4ce742[_0x9b6a('0x4e')][_0x9b6a('0x1b')]);}_0x511081[_0x9b6a('0x56')]=qs[_0x9b6a('0x57')](_0x4ce742[_0x9b6a('0x4e')][_0x9b6a('0x57')]);_0x511081[_0x9b6a('0x58')]=qs[_0x9b6a('0x50')](_[_0x9b6a('0x59')](_0x4ce742[_0x9b6a('0x4e')],_0x572609['filters']));_0x511081[_0x9b6a('0x58')][_0x9b6a('0x72')]=_0x50870a['id'];if(_0x4ce742['query'][_0x9b6a('0x5a')]){_0x511081[_0x9b6a('0x58')]=_['merge'](_0x511081[_0x9b6a('0x58')],{'$or':_['map'](_0x511081[_0x9b6a('0x53')],function(_0x1eff0c){var _0x409649={};_0x409649[_0x1eff0c]={'$like':'%'+_0x4ce742['query'][_0x9b6a('0x5a')]+'%'};return _0x409649;})});}_0x511081=_['merge']({},_0x511081,_0x4ce742['options']);return db['CannedAnswer'][_0x9b6a('0x1e')]({'where':_0x511081['where']})[_0x9b6a('0x22')](function(_0x1460a3){_0x43cf1c[_0x9b6a('0x1e')]=_0x1460a3;if(_0x4ce742['query'][_0x9b6a('0x62')]){_0x511081['include']=[{'all':!![]}];}return db[_0x9b6a('0x74')]['findAll'](_0x511081);})['then'](function(_0x364433){_0x43cf1c[_0x9b6a('0x6f')]=_0x364433;return _0x43cf1c;});}})[_0x9b6a('0x22')](respondWithFilteredResult(_0x212073,_0x511081))[_0x9b6a('0x5f')](handleError(_0x212073,null));};exports[_0x9b6a('0x75')]=function(_0x1923c5,_0xfd5a9f){return db['MailAccount'][_0x9b6a('0x63')]({'where':{'id':_0x1923c5[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0xfd5a9f,null))[_0x9b6a('0x22')](function(_0x44866d){if(_0x44866d){return _0x44866d[_0x9b6a('0x75')](_0x1923c5['query'][_0x9b6a('0x70')]);}})[_0x9b6a('0x22')](respondWithStatusCode(_0xfd5a9f,null))[_0x9b6a('0x5f')](handleError(_0xfd5a9f,null));};exports[_0x9b6a('0x6b')]=function(_0x1bc118,_0x14422f){var _0x70506c={'name':_0x1bc118[_0x9b6a('0x64')][_0x9b6a('0x2a')],'key':_0x1bc118[_0x9b6a('0x64')][_0x9b6a('0x4c')],'provider':_0x1bc118[_0x9b6a('0x64')][_0x9b6a('0x66')]==='custom'?null:_0x1bc118[_0x9b6a('0x64')][_0x9b6a('0x66')],'email':_0x1bc118['body'][_0x9b6a('0x76')],'ListId':_0x1bc118[_0x9b6a('0x64')]['ListId'],'active':!_[_0x9b6a('0x77')](_0x1bc118[_0x9b6a('0x64')]['active'])?_0x1bc118[_0x9b6a('0x64')]['active']:!![],'description':_0x1bc118[_0x9b6a('0x64')][_0x9b6a('0x78')]||null};var _0x53008f=getAuthenticationOptions(_0x70506c['provider'],_0x1bc118[_0x9b6a('0x64')]);_0x70506c[_0x9b6a('0x40')]=_0x53008f['Imap'];_0x70506c['Smtp']=_0x53008f[_0x9b6a('0x41')];return db['MailAccount'][_0x9b6a('0x6b')](_0x70506c,{'include':[{'model':db['MailServerOut'],'as':_0x9b6a('0x41')},{'model':db['MailServerIn'],'as':_0x9b6a('0x40')}]})[_0x9b6a('0x22')](function(_0x516acd){var _0x5ddcaf=_0x1bc118[_0x9b6a('0x36')][_0x9b6a('0x23')]({'plain':!![]});if(!_0x5ddcaf)throw new Error(_0x9b6a('0x79'));if(_0x5ddcaf[_0x9b6a('0x7a')]===_0x9b6a('0x36')){var _0x51ed4a=_0x516acd[_0x9b6a('0x23')]({'plain':!![]});return db[_0x9b6a('0x7b')][_0x9b6a('0x63')]({'where':{'name':_0x9b6a('0x24'),'userProfileId':_0x5ddcaf[_0x9b6a('0x7c')]},'raw':!![]})[_0x9b6a('0x22')](function(_0x4d68ef){if(_0x4d68ef&&_0x4d68ef[_0x9b6a('0x7d')]===0x0){return db[_0x9b6a('0x25')][_0x9b6a('0x6b')]({'name':_0x51ed4a[_0x9b6a('0x2a')],'resourceId':_0x51ed4a['id'],'type':_0x4d68ef['name'],'sectionId':_0x4d68ef['id']},{})[_0x9b6a('0x22')](function(){return _0x516acd;});}else{return _0x516acd;}})[_0x9b6a('0x5f')](function(_0x5cd552){logger[_0x9b6a('0x16')](_0x9b6a('0x7e'),_0x5cd552);throw _0x5cd552;});}return _0x516acd;})[_0x9b6a('0x22')](respondWithResult(_0x14422f,0xc9))['catch'](handleError(_0x14422f,null));};exports[_0x9b6a('0x7f')]=function(_0x24244e,_0x12a912){return db['MailAccount']['findOne']({'where':{'id':_0x24244e[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x12a912,null))[_0x9b6a('0x22')](function(_0x9a6b47){if(_0x9a6b47){return _0x9a6b47['getImap']();}return null;})[_0x9b6a('0x22')](respondWithResult(_0x12a912,null))[_0x9b6a('0x5f')](handleError(_0x12a912,null));};exports[_0x9b6a('0x80')]=function(_0x1b174d,_0xda13c8){if(_0x1b174d[_0x9b6a('0x64')]['id']){delete _0x1b174d[_0x9b6a('0x64')]['id'];}return db[_0x9b6a('0x48')][_0x9b6a('0x63')]({'where':{'id':_0x1b174d[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0xda13c8,null))[_0x9b6a('0x22')](function(_0x99db0f){if(_0x99db0f){_0x1b174d[_0x9b6a('0x64')][_0x9b6a('0x72')]=_0x99db0f['id'];return db[_0x9b6a('0x43')][_0x9b6a('0x6b')](_0x1b174d[_0x9b6a('0x64')]);}})[_0x9b6a('0x22')](respondWithResult(_0xda13c8,null))[_0x9b6a('0x5f')](handleError(_0xda13c8,null));};exports[_0x9b6a('0x81')]=function(_0xaa95d3,_0xb0a114){return db[_0x9b6a('0x48')]['findOne']({'where':{'id':_0xaa95d3[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0xb0a114,null))[_0x9b6a('0x22')](function(_0xe78398){if(_0xe78398){return _0xe78398[_0x9b6a('0x82')](null);}return null;})[_0x9b6a('0x22')](respondWithStatusCode(_0xb0a114,null))['catch'](handleError(_0xb0a114,null));};exports[_0x9b6a('0x83')]=function(_0x4f3294,_0xd936c9){return db[_0x9b6a('0x48')]['findOne']({'where':{'id':_0x4f3294[_0x9b6a('0x60')]['id']}})['then'](handleEntityNotFound(_0xd936c9,null))[_0x9b6a('0x22')](function(_0xd64777){if(_0xd64777){return _0xd64777[_0x9b6a('0x83')]();}return null;})[_0x9b6a('0x22')](respondWithResult(_0xd936c9,null))[_0x9b6a('0x5f')](handleError(_0xd936c9,null));};exports[_0x9b6a('0x84')]=function(_0x3b25e1,_0x51b132){if(_0x3b25e1[_0x9b6a('0x64')]['id']){delete _0x3b25e1[_0x9b6a('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3b25e1[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x51b132,null))['then'](function(_0x3e32a8){if(_0x3e32a8){_0x3b25e1['body'][_0x9b6a('0x72')]=_0x3e32a8['id'];return db[_0x9b6a('0x44')]['create'](_0x3b25e1[_0x9b6a('0x64')]);}})['then'](respondWithResult(_0x51b132,null))[_0x9b6a('0x5f')](handleError(_0x51b132,null));};exports['removeSmtp']=function(_0x1d948f,_0x20ab4b){return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0x1d948f['params']['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x20ab4b,null))[_0x9b6a('0x22')](function(_0xf5c1a7){if(_0xf5c1a7){return _0xf5c1a7['setSmtp'](null);}return null;})[_0x9b6a('0x22')](respondWithStatusCode(_0x20ab4b,null))[_0x9b6a('0x5f')](handleError(_0x20ab4b,null));};exports[_0x9b6a('0x85')]=function(_0x29b525,_0x2f724c){return db['MailInteraction'][_0x9b6a('0x63')]({'where':{'id':_0x29b525['params']['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x2f724c,null))[_0x9b6a('0x22')](function(_0x268605){if(_0x268605){return _0x268605[_0x9b6a('0x85')](_0x29b525['body'][_0x9b6a('0x70')],_['omit'](_0x29b525[_0x9b6a('0x64')],[_0x9b6a('0x70'),'id'])||{});}})['then'](respondWithResult(_0x2f724c,null))['catch'](handleError(_0x2f724c,null));};exports[_0x9b6a('0x86')]=function(_0xd51133,_0x37b50e){var _0x1d559a={'raw':![],'where':{}};var _0x29209d={};var _0x12404e={'count':0x0,'rows':[]};return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0xd51133[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x37b50e,null))[_0x9b6a('0x22')](function(_0x37b106){if(_0x37b106){_0x29209d[_0x9b6a('0x4d')]=_['keys'](db[_0x9b6a('0x87')][_0x9b6a('0x49')]);_0x29209d[_0x9b6a('0x4e')]=_[_0x9b6a('0x4f')](_0xd51133[_0x9b6a('0x4e')]);_0x29209d['filters']=_[_0x9b6a('0x51')](_0x29209d[_0x9b6a('0x4d')],_0x29209d[_0x9b6a('0x4e')]);_0x1d559a[_0x9b6a('0x53')]=_['intersection'](_0x29209d[_0x9b6a('0x4d')],qs['fields'](_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x52')]));_0x1d559a[_0x9b6a('0x53')]=_0x1d559a[_0x9b6a('0x53')][_0x9b6a('0x61')]?_0x1d559a[_0x9b6a('0x53')]:_0x29209d[_0x9b6a('0x4d')];if(!_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x54')](_0x9b6a('0x55'))){_0x1d559a['limit']=qs[_0x9b6a('0x1c')](_0xd51133['query'][_0x9b6a('0x1c')]);_0x1d559a[_0x9b6a('0x1b')]=qs[_0x9b6a('0x1b')](_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x1b')]);}_0x1d559a['order']=qs[_0x9b6a('0x57')](_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x57')]);_0x1d559a[_0x9b6a('0x58')]=qs['filters'](_['pick'](_0xd51133[_0x9b6a('0x4e')],_0x29209d[_0x9b6a('0x50')]));_0x1d559a[_0x9b6a('0x58')][_0x9b6a('0x72')]=_0x37b106['id'];if(_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x5a')]){_0x1d559a['where']=_[_0x9b6a('0x6e')](_0x1d559a[_0x9b6a('0x58')],{'$or':_[_0x9b6a('0x47')](_0x1d559a[_0x9b6a('0x53')],function(_0x5eb854){var _0x1ed3f4={};_0x1ed3f4[_0x5eb854]={'$like':'%'+_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x5a')]+'%'};return _0x1ed3f4;})});}_0x1d559a=_[_0x9b6a('0x6e')]({},_0x1d559a,_0xd51133[_0x9b6a('0x5c')]);return db[_0x9b6a('0x87')][_0x9b6a('0x1e')]({'where':_0x1d559a[_0x9b6a('0x58')]})['then'](function(_0xd78175){_0x12404e[_0x9b6a('0x1e')]=_0xd78175;if(_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x62')]){_0x1d559a['include']=[{'model':db['CmContact'],'as':_0x9b6a('0x88'),'required':![]},{'model':db[_0x9b6a('0x89')],'as':_0x9b6a('0x8a'),'attributes':[_0x9b6a('0x2a'),_0x9b6a('0x8b'),_0x9b6a('0x8c')],'required':![]},{'model':db[_0x9b6a('0x8d')],'as':_0x9b6a('0x8e'),'attributes':['id',_0x9b6a('0x2a'),_0x9b6a('0x8f')],'where':_0xd51133['query'][_0x9b6a('0x90')]?{'id':_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x90')]}:undefined,'required':_0xd51133[_0x9b6a('0x4e')][_0x9b6a('0x90')]?!![]:![]}];}return db['MailInteraction'][_0x9b6a('0x5e')](_0x1d559a);})['then'](function(_0x2bc50c){_0x12404e[_0x9b6a('0x6f')]=_0x2bc50c;return _0x12404e;});}})[_0x9b6a('0x22')](respondWithFilteredResult(_0x37b50e,_0x1d559a))[_0x9b6a('0x5f')](handleError(_0x37b50e,null));};exports[_0x9b6a('0x91')]=function addApplications(_0xf66ab2,_0x4c9764){var _0x49813e=_0xf66ab2[_0x9b6a('0x60')]['id'];var _0x1b5ba5=_0xf66ab2['body'];var _0x274b4e=0xc8;var _0x3f2962=null;return db['sequelize'][_0x9b6a('0x92')]({'isolationLevel':db['sequelize']['Transaction'][_0x9b6a('0x93')][_0x9b6a('0x94')]},function(_0x3a284f){return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0x49813e},'transaction':_0x3a284f})['then'](function(_0x624942){if(_0x624942){return db['MailApplication'][_0x9b6a('0x26')]({'where':{'MailAccountId':_0x49813e},'transaction':_0x3a284f})['then'](function(){var _0x352b53=_['map'](_0x1b5ba5,function(_0x13d925){_0x13d925['MailAccountId']=_0x49813e;return _0x13d925;});return db[_0x9b6a('0x95')][_0x9b6a('0x96')](_0x352b53,{'transaction':_0x3a284f});});}else{_0x274b4e=0x194;_0x3f2962=[];}});})[_0x9b6a('0x22')](function(){if(_0x274b4e!==0x194){return db[_0x9b6a('0x95')][_0x9b6a('0x97')]({'where':{'MailAccountId':_0x49813e},'order':'priority'})[_0x9b6a('0x22')](function(_0x2e99f4){_0x3f2962=_0x2e99f4;});}})['catch'](function(_0x5ef522){_0x274b4e=0x1f4;logger[_0x9b6a('0x16')](_0x5ef522['stack']);if(_0x5ef522[_0x9b6a('0x2a')]){delete _0x5ef522[_0x9b6a('0x2a')];}_0x3f2962=_0x5ef522;})[_0x9b6a('0x98')](function(){if(_0x3f2962===null){_0x4c9764[_0x9b6a('0x28')](_0x274b4e);}else{if(_0x274b4e===0x1f4){_0x4c9764[_0x9b6a('0x19')](_0x274b4e)[_0x9b6a('0x2b')](_0x3f2962);}else{_0x4c9764[_0x9b6a('0x19')](_0x274b4e)[_0x9b6a('0x1a')](_0x3f2962);}}});};exports[_0x9b6a('0x99')]=function(_0xe471fc,_0x785c74){var _0x44e84f={};var _0x178f1f={};var _0x4b2cce;var _0x43ce39;return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0xe471fc[_0x9b6a('0x60')]['id']}})['then'](handleEntityNotFound(_0x785c74,null))['then'](function(_0x19bead){if(_0x19bead){_0x4b2cce=_0x19bead;_0x178f1f['model']=_[_0x9b6a('0x4f')](db[_0x9b6a('0x95')][_0x9b6a('0x49')]);_0x178f1f['query']=_[_0x9b6a('0x4f')](_0xe471fc[_0x9b6a('0x4e')]);_0x178f1f[_0x9b6a('0x50')]=_[_0x9b6a('0x51')](_0x178f1f[_0x9b6a('0x4d')],_0x178f1f[_0x9b6a('0x4e')]);_0x44e84f[_0x9b6a('0x53')]=_[_0x9b6a('0x51')](_0x178f1f[_0x9b6a('0x4d')],qs[_0x9b6a('0x52')](_0xe471fc[_0x9b6a('0x4e')][_0x9b6a('0x52')]));_0x44e84f[_0x9b6a('0x53')]=_0x44e84f[_0x9b6a('0x53')][_0x9b6a('0x61')]?_0x44e84f[_0x9b6a('0x53')]:_0x178f1f[_0x9b6a('0x4d')];_0x44e84f[_0x9b6a('0x56')]=qs['sort'](_0xe471fc[_0x9b6a('0x4e')][_0x9b6a('0x57')]);_0x44e84f[_0x9b6a('0x58')]=qs[_0x9b6a('0x50')](_[_0x9b6a('0x59')](_0xe471fc[_0x9b6a('0x4e')],_0x178f1f[_0x9b6a('0x50')]));if(_0xe471fc[_0x9b6a('0x4e')]['filter']){_0x44e84f[_0x9b6a('0x58')]=_['merge'](_0x44e84f['where'],{'$or':_[_0x9b6a('0x47')](_0x44e84f[_0x9b6a('0x53')],function(_0x24c8b2){var _0x17b0d8={};_0x17b0d8[_0x24c8b2]={'$like':'%'+_0xe471fc[_0x9b6a('0x4e')]['filter']+'%'};return _0x17b0d8;})});}_0x44e84f=_[_0x9b6a('0x6e')]({},_0x44e84f,_0xe471fc[_0x9b6a('0x5c')]);return _0x4b2cce[_0x9b6a('0x99')](_0x44e84f);}})[_0x9b6a('0x22')](function(_0x23c927){if(_0x23c927){_0x43ce39=_0x23c927['length'];if(!_0xe471fc[_0x9b6a('0x4e')][_0x9b6a('0x54')](_0x9b6a('0x55'))){_0x44e84f[_0x9b6a('0x1c')]=qs[_0x9b6a('0x1c')](_0xe471fc['query'][_0x9b6a('0x1c')]);_0x44e84f[_0x9b6a('0x1b')]=qs['offset'](_0xe471fc[_0x9b6a('0x4e')][_0x9b6a('0x1b')]);}return _0x4b2cce[_0x9b6a('0x99')](_0x44e84f);}})['then'](function(_0x2875c8){if(_0x2875c8){return _0x2875c8?{'count':_0x43ce39,'rows':_0x2875c8}:null;}})['then'](respondWithResult(_0x785c74,null))['catch'](handleError(_0x785c74,null));};exports['getMessages']=function(_0x2350d2,_0x159ecd){var _0x47ca2a={'raw':!![],'where':{}};var _0x299617={};var _0x4b4dc8={'count':0x0,'rows':[]};return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0x2350d2[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x159ecd,null))[_0x9b6a('0x22')](function(_0x428cfc){if(_0x428cfc){_0x299617['model']=_[_0x9b6a('0x4f')](db[_0x9b6a('0x9a')][_0x9b6a('0x49')]);_0x299617[_0x9b6a('0x4e')]=_[_0x9b6a('0x4f')](_0x2350d2[_0x9b6a('0x4e')]);_0x299617['filters']=_[_0x9b6a('0x51')](_0x299617[_0x9b6a('0x4d')],_0x299617[_0x9b6a('0x4e')]);_0x47ca2a[_0x9b6a('0x53')]=_[_0x9b6a('0x51')](_0x299617[_0x9b6a('0x4d')],qs[_0x9b6a('0x52')](_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x52')]));_0x47ca2a[_0x9b6a('0x53')]=_0x47ca2a[_0x9b6a('0x53')][_0x9b6a('0x61')]?_0x47ca2a[_0x9b6a('0x53')]:_0x299617[_0x9b6a('0x4d')];if(!_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x54')](_0x9b6a('0x55'))){_0x47ca2a[_0x9b6a('0x1c')]=qs['limit'](_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x1c')]);_0x47ca2a[_0x9b6a('0x1b')]=qs['offset'](_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x1b')]);}_0x47ca2a[_0x9b6a('0x56')]=qs[_0x9b6a('0x57')](_0x2350d2['query'][_0x9b6a('0x57')]);_0x47ca2a[_0x9b6a('0x58')]=qs[_0x9b6a('0x50')](_[_0x9b6a('0x59')](_0x2350d2[_0x9b6a('0x4e')],_0x299617['filters']));_0x47ca2a[_0x9b6a('0x58')][_0x9b6a('0x72')]=_0x428cfc['id'];if(_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x5a')]){_0x47ca2a[_0x9b6a('0x58')]=_['merge'](_0x47ca2a[_0x9b6a('0x58')],{'$or':_['map'](_0x47ca2a[_0x9b6a('0x53')],function(_0x2dd933){var _0x6f0a73={};_0x6f0a73[_0x2dd933]={'$like':'%'+_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x5a')]+'%'};return _0x6f0a73;})});}if(_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x9b')]){var _0x3f7dd0=_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x9b')][_0x9b6a('0x9c')](',');var _0x4cb8ff={};_0x4cb8ff[_0x3f7dd0[0x0]]={'$gte':moment(_0x3f7dd0[0x1])[_0x9b6a('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x47ca2a['where']=_['merge'](_0x47ca2a[_0x9b6a('0x58')],_0x4cb8ff);}_0x47ca2a=_[_0x9b6a('0x6e')]({},_0x47ca2a,_0x2350d2[_0x9b6a('0x5c')]);return db['MailMessage'][_0x9b6a('0x1e')]({'where':_0x47ca2a['where']})[_0x9b6a('0x22')](function(_0x22b3c2){_0x4b4dc8[_0x9b6a('0x1e')]=_0x22b3c2;if(_0x2350d2[_0x9b6a('0x4e')][_0x9b6a('0x62')]){_0x47ca2a[_0x9b6a('0x5d')]=[{'all':!![]}];}return db[_0x9b6a('0x9a')][_0x9b6a('0x5e')](_0x47ca2a);})[_0x9b6a('0x22')](function(_0x4f6bf4){if(_0x2350d2[_0x9b6a('0x4e')]['inlineCss']===_0x9b6a('0x9e')){for(var _0x2099de=0x0;_0x2099de<_0x4f6bf4[_0x9b6a('0x61')];_0x2099de++){_0x4f6bf4[_0x2099de][_0x9b6a('0x64')]=juice(_0x4f6bf4[_0x2099de][_0x9b6a('0x64')]);}}_0x4b4dc8[_0x9b6a('0x6f')]=_0x4f6bf4;return _0x4b4dc8;});}})[_0x9b6a('0x22')](respondWithFilteredResult(_0x159ecd,_0x47ca2a))[_0x9b6a('0x5f')](handleError(_0x159ecd,null));};exports[_0x9b6a('0x2b')]=function(_0x5b3e10,_0x1f5d69){var _0xe34ebc,_0x15f167={},_0x2c51c6;if(_0x5b3e10[_0x9b6a('0x64')]['to']){_0x2c51c6=_0x5b3e10[_0x9b6a('0x64')]['to']['split'](',')[0x0];}return db[_0x9b6a('0x48')][_0x9b6a('0x63')]({'where':{'id':_0x5b3e10[_0x9b6a('0x60')]['id']},'include':[{'model':db[_0x9b6a('0x9f')],'as':_0x9b6a('0xa0'),'include':[{'model':db[_0x9b6a('0xa1')],'as':'Contacts','where':{'email':_0x2c51c6},'limit':0x1,'order':[[_0x9b6a('0xa2'),_0x9b6a('0xa3')]]}]},{'model':db['MailServerOut'],'as':_0x9b6a('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9b6a('0xa4'),'raw':!![]}]}]})[_0x9b6a('0x22')](handleEntityNotFound(_0x1f5d69,null))[_0x9b6a('0x22')](function(_0x18a7f5){if(!_0x18a7f5)return;_0xe34ebc=_0x18a7f5;if(!_0x18a7f5[_0x9b6a('0x41')])throw new Error(_0x9b6a('0xa5'));if(_[_0x9b6a('0x77')](_0x5b3e10['body'][_0x9b6a('0xa6')])){_0x5b3e10[_0x9b6a('0x64')][_0x9b6a('0xa6')]=util[_0x9b6a('0x9d')](_0x9b6a('0xa7'),_0x18a7f5[_0x9b6a('0x2a')],_0x18a7f5[_0x9b6a('0x76')]||_0x18a7f5['Smtp'][_0x9b6a('0x36')]);}if(_0x5b3e10[_0x9b6a('0x64')][_0x9b6a('0xa8')]&&_0x5b3e10['body']['attachments'][_0x9b6a('0x61')]){for(var _0x5e37f8=0x0;_0x5e37f8<_0x5b3e10[_0x9b6a('0x64')][_0x9b6a('0xa8')]['length'];_0x5e37f8+=0x1){_0x5b3e10[_0x9b6a('0x64')][_0x9b6a('0xa8')][_0x5e37f8]={'filename':_0x5b3e10[_0x9b6a('0x64')]['attachments'][_0x5e37f8]['name'],'path':path['join'](config['root'],_0x9b6a('0xa9'),_0x5b3e10['body'][_0x9b6a('0xa8')][_0x5e37f8][_0x9b6a('0xaa')])};}}var _0xc52ed9=_0x18a7f5[_0x9b6a('0xab')]();return respondWithRpcPromise(_0x9b6a('0xac'),_0x9b6a('0xad'),{'account':_0xc52ed9,'message':_0x5b3e10[_0x9b6a('0x64')]});})['then'](function(_0x2d8f7b){if(!_0x2d8f7b)return;_0x15f167=_0x2d8f7b;if(!_0xe34ebc[_0x9b6a('0xa0')])throw new Error('List\x20not\x20found');if(_0xe34ebc[_0x9b6a('0xa0')][_0x9b6a('0xae')]['length'])return _0xe34ebc[_0x9b6a('0xa0')][_0x9b6a('0xae')][0x0];return db['CmContact'][_0x9b6a('0x6b')](_[_0x9b6a('0x9')](_0x5b3e10['body'],{'firstName':_0x5b3e10[_0x9b6a('0x64')]['to'],'email':_0x5b3e10[_0x9b6a('0x64')]['to'],'phone':_0x5b3e10[_0x9b6a('0x64')]['to'],'ListId':_0xe34ebc[_0x9b6a('0xaf')]}));})[_0x9b6a('0x22')](function(_0x15910f){if(!_0x15910f)return;var _0x32dcd9={'UserId':_0x5b3e10['user']['id'],'ContactId':_0x15910f['id'],'MailAccountId':_0xe34ebc['id'],'inReplyTo':_0x15f167[_0x9b6a('0xb0')],'to':_0x5b3e10[_0x9b6a('0x64')]['from'],'cc':_0x5b3e10[_0x9b6a('0x64')]['cc'],'subject':_0x5b3e10[_0x9b6a('0x64')]['subject'],'attach':_0x5b3e10['body'][_0x9b6a('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9b6a('0x9d')](_0x9b6a('0xb2')),'lastMsgDirection':_0x9b6a('0xb3'),'Messages':[_[_0x9b6a('0x6e')](_0x5b3e10['body'],{'messageId':_0x15f167['messageId'],'sentAt':moment()[_0x9b6a('0x9d')](_0x9b6a('0xb2')),'read':!![],'MailAccountId':_0xe34ebc['id'],'UserId':_0x5b3e10[_0x9b6a('0x36')]['id'],'ContactId':_0x15910f['id']})]};if(_0x5b3e10[_0x9b6a('0x64')][_0x9b6a('0xb4')]){_0x32dcd9=_[_0x9b6a('0x6e')](_0x32dcd9,_0x5b3e10['body'][_0x9b6a('0xb4')]);}return db[_0x9b6a('0x87')]['create'](_0x32dcd9,{'include':[{'model':db['MailMessage'],'as':_0x9b6a('0xb5')}]});})[_0x9b6a('0x22')](respondWithResult(_0x1f5d69,null))[_0x9b6a('0x5f')](handleError(_0x1f5d69,null));};exports['verifySmtp']=function(_0xfc3287,_0x5456ed){return db[_0x9b6a('0x48')][_0x9b6a('0x63')]({'where':{'id':_0xfc3287['params']['id']},'include':[{'model':db[_0x9b6a('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9b6a('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5456ed,null))['then'](function(_0x2d837d){if(!_0x2d837d[_0x9b6a('0x41')])return;var _0x5e1760=_0x2d837d[_0x9b6a('0xab')]();return respondWithRpcPromise(_0x9b6a('0xb6'),_0x9b6a('0xb7'),{'account':_0x5e1760});})[_0x9b6a('0x22')](respondWithResult(_0x5456ed,null))['catch'](handleError(_0x5456ed,null));};exports['destroy']=function(_0x203f9a,_0x2c8a87){return db[_0x9b6a('0x48')][_0x9b6a('0x63')]({'where':{'id':_0x203f9a[_0x9b6a('0x60')]['id']}})['then'](handleEntityNotFound(_0x2c8a87,null))[_0x9b6a('0x22')](function(_0x1982a7){if(_0x1982a7&&_0x1982a7[_0x9b6a('0x3e')]){throw new db[(_0x9b6a('0xb8'))][(_0x9b6a('0xb9'))](_0x9b6a('0xba'));}return _0x1982a7;})[_0x9b6a('0x22')](removeEntity(_0x2c8a87,null))[_0x9b6a('0x5f')](handleError(_0x2c8a87,null));};exports[_0x9b6a('0xbb')]=function(_0x1c668a,_0x3e5695){return db['MailAccount']['find']({'where':{'id':_0x1c668a['params']['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x3e5695,null))['then'](function(_0x458994){if(_0x458994){return _0x458994[_0x9b6a('0xbb')](_0x1c668a['body'][_0x9b6a('0x70')],_[_0x9b6a('0xbc')](_0x1c668a['body'],[_0x9b6a('0x70'),'id'])||{})[_0x9b6a('0xbd')](function(_0x2dc275){for(var _0xafd46c=0x0;_0xafd46c<_0x1c668a[_0x9b6a('0x64')][_0x9b6a('0x70')][_0x9b6a('0x61')];_0xafd46c+=0x1){socket[_0x9b6a('0xbe')]('userMailAccount:save',{'UserId':Number(_0x1c668a[_0x9b6a('0x64')]['ids'][_0xafd46c]),'MailAccountId':Number(_0x1c668a[_0x9b6a('0x60')]['id'])});}return _0x2dc275;});}})[_0x9b6a('0x22')](respondWithResult(_0x3e5695,null))[_0x9b6a('0x5f')](handleError(_0x3e5695,null));};exports['removeAgents']=function(_0x103248,_0x4b672c){return db[_0x9b6a('0x48')][_0x9b6a('0x63')]({'where':{'id':_0x103248[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x4b672c,null))[_0x9b6a('0x22')](function(_0x30c042){if(_0x30c042){return _0x30c042[_0x9b6a('0xbf')](_0x103248[_0x9b6a('0x4e')][_0x9b6a('0x70')])['then'](function(){if(_[_0x9b6a('0xc0')](_0x103248[_0x9b6a('0x4e')][_0x9b6a('0x70')])){for(var _0x5ece57=0x0;_0x5ece57<_0x103248['query'][_0x9b6a('0x70')][_0x9b6a('0x61')];_0x5ece57+=0x1){socket[_0x9b6a('0xbe')](_0x9b6a('0xc1'),{'UserId':Number(_0x103248['query'][_0x9b6a('0x70')][_0x5ece57]),'MailAccountId':Number(_0x103248[_0x9b6a('0x60')]['id'])});}}else{socket[_0x9b6a('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x103248[_0x9b6a('0x4e')][_0x9b6a('0x70')]),'MailAccountId':Number(_0x103248['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b672c,null))['catch'](handleError(_0x4b672c,null));};exports[_0x9b6a('0xc2')]=function(_0x231fe5,_0x30494e){var _0x562381={};var _0x3ef8f1={};var _0x3ac476;var _0x2cce19;return db[_0x9b6a('0x48')][_0x9b6a('0x6d')]({'where':{'id':_0x231fe5[_0x9b6a('0x60')]['id']}})[_0x9b6a('0x22')](handleEntityNotFound(_0x30494e,null))['then'](function(_0x1d02b2){if(_0x1d02b2){_0x3ac476=_0x1d02b2;_0x3ef8f1[_0x9b6a('0x4d')]=_[_0x9b6a('0x4f')](db[_0x9b6a('0x89')][_0x9b6a('0x49')]);_0x3ef8f1['query']=_[_0x9b6a('0x4f')](_0x231fe5[_0x9b6a('0x4e')]);_0x3ef8f1[_0x9b6a('0x50')]=_[_0x9b6a('0x51')](_0x3ef8f1['model'],_0x3ef8f1[_0x9b6a('0x4e')]);_0x562381['attributes']=_[_0x9b6a('0x51')](_0x3ef8f1['model'],qs[_0x9b6a('0x52')](_0x231fe5[_0x9b6a('0x4e')][_0x9b6a('0x52')]));_0x562381[_0x9b6a('0x53')]=_0x562381[_0x9b6a('0x53')][_0x9b6a('0x61')]?_0x562381[_0x9b6a('0x53')]:_0x3ef8f1['model'];_0x562381[_0x9b6a('0x56')]=qs[_0x9b6a('0x57')](_0x231fe5['query'][_0x9b6a('0x57')]);_0x562381[_0x9b6a('0x58')]=qs['filters'](_[_0x9b6a('0x59')](_0x231fe5[_0x9b6a('0x4e')],_0x3ef8f1['filters']));if(_0x231fe5['query'][_0x9b6a('0x5a')]){_0x562381[_0x9b6a('0x58')]=_[_0x9b6a('0x6e')](_0x562381[_0x9b6a('0x58')],{'$or':_['map'](_0x562381[_0x9b6a('0x53')],function(_0x5d2356){var _0x2182ca={};_0x2182ca[_0x5d2356]={'$like':'%'+_0x231fe5['query']['filter']+'%'};return _0x2182ca;})});}_0x562381=_['merge']({},_0x562381,_0x231fe5[_0x9b6a('0x5c')]);return _0x3ac476[_0x9b6a('0xc2')](_0x562381);}})[_0x9b6a('0x22')](function(_0xb61cc4){if(_0xb61cc4){_0x2cce19=_0xb61cc4['length'];if(!_0x231fe5['query'][_0x9b6a('0x54')]('nolimit')){_0x562381['limit']=qs[_0x9b6a('0x1c')](_0x231fe5[_0x9b6a('0x4e')][_0x9b6a('0x1c')]);_0x562381[_0x9b6a('0x1b')]=qs[_0x9b6a('0x1b')](_0x231fe5['query'][_0x9b6a('0x1b')]);}return _0x3ac476[_0x9b6a('0xc2')](_0x562381);}})[_0x9b6a('0x22')](function(_0x2a1ea2){if(_0x2a1ea2){return _0x2a1ea2?{'count':_0x2cce19,'rows':_0x2a1ea2}:null;}})[_0x9b6a('0x22')](respondWithResult(_0x30494e,null))[_0x9b6a('0x5f')](handleError(_0x30494e,null));}; \ No newline at end of file +var _0x7adf=['intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','include','findAll','rows','params','keys','includeAll','options','find','update','body','provider','custom','describe','addDisposition','Disposition','create','getDispositions','hasOwnProperty','order','MailAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','findOne','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','getSmtpOptions','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','User','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','get','MailAccounts','destroy','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query'];(function(_0x255733,_0x52db8c){var _0x2c0d55=function(_0x1062b0){while(--_0x1062b0){_0x255733['push'](_0x255733['shift']());}};_0x2c0d55(++_0x52db8c);}(_0x7adf,0x140));var _0xf7ad=function(_0x536442,_0x18e920){_0x536442=_0x536442-0x0;var _0x82516e=_0x7adf[_0x536442];return _0x82516e;};'use strict';var moment=require('moment');var BPromise=require(_0xf7ad('0x0'));var util=require(_0xf7ad('0x1'));var path=require(_0xf7ad('0x2'));var _=require(_0xf7ad('0x3'));var juice=require(_0xf7ad('0x4'));var Redis=require(_0xf7ad('0x5'));var qs=require(_0xf7ad('0x6'));var logger=require(_0xf7ad('0x7'))(_0xf7ad('0x8'));var config=require(_0xf7ad('0x9'));var db=require(_0xf7ad('0xa'))['db'];config['redis']=_['defaults'](config[_0xf7ad('0xb')],{'host':_0xf7ad('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf7ad('0xd'))[_0xf7ad('0xe')](socket);var jayson=require(_0xf7ad('0xf'));var client=jayson[_0xf7ad('0x10')][_0xf7ad('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x35c94c,_0x35f49f,_0x33c15c,_0x29dc40){return new BPromise(function(_0x1bdc69,_0x27f675){var _0x587599=_0x29dc40||client;return _0x587599[_0xf7ad('0x12')](_0x35c94c,_0x33c15c)[_0xf7ad('0x13')](function(_0x7692eb){logger[_0xf7ad('0x14')]('MailAccount,\x20%s,\x20%s',_0x35f49f,_0xf7ad('0x15'));logger[_0xf7ad('0x16')](_0xf7ad('0x17'),_0x35f49f,'request\x20sent',JSON[_0xf7ad('0x18')](_0x7692eb));if(_0x7692eb[_0xf7ad('0x19')]){if(_0x7692eb['error'][_0xf7ad('0x1a')]===0x1f4){logger[_0xf7ad('0x19')](_0xf7ad('0x1b'),_0x35f49f,_0x7692eb['error'][_0xf7ad('0x1c')]);return _0x27f675(_0x7692eb[_0xf7ad('0x19')][_0xf7ad('0x1c')]);}logger[_0xf7ad('0x19')](_0xf7ad('0x1b'),_0x35f49f,_0x7692eb[_0xf7ad('0x19')][_0xf7ad('0x1c')]);return _0x1bdc69(_0x7692eb['error'][_0xf7ad('0x1c')]);}else{logger[_0xf7ad('0x14')]('MailAccount,\x20%s,\x20%s',_0x35f49f,_0xf7ad('0x15'));_0x1bdc69(_0x7692eb[_0xf7ad('0x1d')]['message']);}})[_0xf7ad('0x1e')](function(_0x919e34){logger[_0xf7ad('0x19')](_0xf7ad('0x1b'),_0x35f49f,_0x919e34);_0x27f675(_0x919e34);});});}function respondWithStatusCode(_0x49c33d,_0x228b96){_0x228b96=_0x228b96||0xcc;return function(_0x44a4de){if(_0x44a4de){return _0x49c33d[_0xf7ad('0x1f')](_0x228b96);}return _0x49c33d['status'](_0x228b96)[_0xf7ad('0x20')]();};}function respondWithResult(_0x2ca489,_0x4b01ad){_0x4b01ad=_0x4b01ad||0xc8;return function(_0x35f081){if(_0x35f081){return _0x2ca489[_0xf7ad('0x21')](_0x4b01ad)[_0xf7ad('0x22')](_0x35f081);}};}function respondWithFilteredResult(_0x4565d0,_0x285f44){return function(_0x383180){if(_0x383180){var _0x168d36=typeof _0x285f44[_0xf7ad('0x23')]===_0xf7ad('0x24')&&typeof _0x285f44['limit']===_0xf7ad('0x24');var _0x4e10a2=_0x383180[_0xf7ad('0x25')];var _0x377082=_0x168d36?0x0:_0x285f44[_0xf7ad('0x23')];var _0x3377af=_0x168d36?_0x383180[_0xf7ad('0x25')]:_0x285f44[_0xf7ad('0x23')]+_0x285f44[_0xf7ad('0x26')];var _0x547899;if(_0x3377af>=_0x4e10a2){_0x3377af=_0x4e10a2;_0x547899=0xc8;}else{_0x547899=0xce;}_0x4565d0[_0xf7ad('0x21')](_0x547899);return _0x4565d0[_0xf7ad('0x27')]('Content-Range',_0x377082+'-'+_0x3377af+'/'+_0x4e10a2)['json'](_0x383180);}return null;};}function saveUpdates(_0x205c63){return function(_0x288af7){if(_0x288af7){return _0x288af7['update'](_0x205c63)[_0xf7ad('0x13')](function(_0x18f080){return _0x18f080;});}return null;};}function removeEntity(_0x262cf4){return function(_0x30fd07){if(_0x30fd07){return _0x30fd07['destroy']()['then'](function(){var _0x248421=_0x30fd07[_0xf7ad('0x28')]({'plain':!![]});var _0x50f616=_0xf7ad('0x29');return db['UserProfileResource'][_0xf7ad('0x2a')]({'where':{'type':_0x50f616,'resourceId':_0x248421['id']}})[_0xf7ad('0x13')](function(){return _0x30fd07;});})[_0xf7ad('0x13')](function(){_0x262cf4['status'](0xcc)[_0xf7ad('0x20')]();});}};}function handleEntityNotFound(_0x403103){return function(_0x24cd92){if(!_0x24cd92){_0x403103[_0xf7ad('0x1f')](0x194);}return _0x24cd92;};}function handleError(_0x5ee9c7,_0x1e84e2){_0x1e84e2=_0x1e84e2||0x1f4;return function(_0x1356ea){logger[_0xf7ad('0x19')](_0x1356ea[_0xf7ad('0x2b')]);if(_0x1356ea[_0xf7ad('0x2c')]){delete _0x1356ea[_0xf7ad('0x2c')];}_0x5ee9c7[_0xf7ad('0x21')](_0x1e84e2)['send'](_0x1356ea);};}function getImapHost(_0x36a8b6){switch(_0x36a8b6){case _0xf7ad('0x2d'):return _0xf7ad('0x2e');case _0xf7ad('0x2f'):return _0xf7ad('0x30');case _0xf7ad('0x31'):return'imap-mail.outlook.com';case _0xf7ad('0x32'):return _0xf7ad('0x33');}throw new Error(_0xf7ad('0x34'),_0x36a8b6);}function getSmtpHost(_0x47f3a6){switch(_0x47f3a6){case _0xf7ad('0x2d'):return'smtp.gmail.com';case _0xf7ad('0x2f'):return'smtp.mail.yahoo.com';case _0xf7ad('0x31'):return'smtp-mail.outlook.com';case _0xf7ad('0x32'):return _0xf7ad('0x35');}throw new Error(_0xf7ad('0x34'),_0x47f3a6);}function getAuthenticationOptions(_0x294816,_0x1e2151){var _0x35d314={};var _0x457654={};if(_0x294816){_0x35d314['user']=_0x457654[_0xf7ad('0x36')]=_0x1e2151[_0xf7ad('0x37')];_0x35d314['password']=_0x457654[_0xf7ad('0x38')]=_0x1e2151[_0xf7ad('0x39')];if(_0x1e2151[_0xf7ad('0x3a')]){_0x35d314['modernAuthentication']=_0x457654[_0xf7ad('0x3a')]=!![];_0x35d314[_0xf7ad('0x3b')]=_0x457654[_0xf7ad('0x3b')]=_0x1e2151[_0xf7ad('0x3b')];_0x35d314[_0xf7ad('0x39')]=_0x457654[_0xf7ad('0x38')]=null;}else{_0x35d314['CloudProviderId']=_0x457654[_0xf7ad('0x3b')]=null;}_0x35d314[_0xf7ad('0x3c')]=getImapHost(_0x294816);_0x35d314[_0xf7ad('0x3d')]=0x3e1;_0x457654[_0xf7ad('0x3c')]=getSmtpHost(_0x294816);_0x457654[_0xf7ad('0x3d')]=0x24b;_0x457654[_0xf7ad('0x3e')]=![];_0x35d314[_0xf7ad('0x3f')]=_0x457654[_0xf7ad('0x3f')]=null;}else{if(_0x1e2151[_0xf7ad('0x40')]){_0x35d314[_0xf7ad('0x36')]=_0x457654['user']=_0x1e2151[_0xf7ad('0x37')];_0x35d314['password']=_0x457654[_0xf7ad('0x38')]=_0x1e2151[_0xf7ad('0x39')];}else{_0x35d314[_0xf7ad('0x40')]=_0x457654[_0xf7ad('0x40')]=![];_0x35d314[_0xf7ad('0x36')]=_0x457654[_0xf7ad('0x36')]=null;_0x35d314[_0xf7ad('0x39')]=_0x457654[_0xf7ad('0x38')]=null;}_0x35d314[_0xf7ad('0x3c')]=_0x1e2151[_0xf7ad('0x41')][_0xf7ad('0x3c')];_0x35d314[_0xf7ad('0x3d')]=_0x1e2151[_0xf7ad('0x41')][_0xf7ad('0x3d')];_0x457654[_0xf7ad('0x3c')]=_0x1e2151[_0xf7ad('0x42')][_0xf7ad('0x3c')];_0x457654['port']=_0x1e2151[_0xf7ad('0x42')][_0xf7ad('0x3d')];}return{'Imap':_0x35d314,'Smtp':_0x457654};}exports['index']=function(_0x49e258,_0xf9e43a){var _0x24c985={'include':[{'model':db[_0xf7ad('0x43')],'as':_0xf7ad('0x41')},{'model':db[_0xf7ad('0x44')],'as':'Smtp'},{'model':db[_0xf7ad('0x45')],'as':_0xf7ad('0x46')}]},_0x3829bf={},_0x3ae3bf={'count':0x0,'rows':[]};var _0x43126a=_[_0xf7ad('0x47')](db[_0xf7ad('0x48')][_0xf7ad('0x49')],function(_0x47148e){return{'name':_0x47148e[_0xf7ad('0x4a')],'type':_0x47148e[_0xf7ad('0x4b')][_0xf7ad('0x4c')]};});_0x3829bf['model']=_[_0xf7ad('0x47')](_0x43126a,_0xf7ad('0x2c'));_0x3829bf[_0xf7ad('0x4d')]=_['keys'](_0x49e258[_0xf7ad('0x4d')]);_0x3829bf['filters']=_[_0xf7ad('0x4e')](_0x3829bf[_0xf7ad('0x4f')],_0x3829bf[_0xf7ad('0x4d')]);_0x24c985[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x3829bf[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x24c985[_0xf7ad('0x50')]=_0x24c985[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x24c985[_0xf7ad('0x50')]:_0x3829bf[_0xf7ad('0x4f')];if(!_0x49e258[_0xf7ad('0x4d')]['hasOwnProperty'](_0xf7ad('0x53'))){_0x24c985[_0xf7ad('0x26')]=qs['limit'](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x24c985['offset']=qs['offset'](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}_0x24c985['order']=qs['sort'](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x24c985[_0xf7ad('0x55')]=qs['filters'](_[_0xf7ad('0x56')](_0x49e258[_0xf7ad('0x4d')],_0x3829bf[_0xf7ad('0x57')]),_0x43126a);if(_0x49e258[_0xf7ad('0x4d')]['filter']){_0x24c985[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x24c985[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x43126a,function(_0x2a28fa){if(_0x2a28fa[_0xf7ad('0x4b')]!==_0xf7ad('0x59')){var _0x135759={};_0x135759[_0x2a28fa['name']]={'$like':'%'+_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x135759;}})});}_0x24c985=_['merge']({},_0x24c985,_0x49e258['options']);var _0x5863a5={'where':_0x24c985[_0xf7ad('0x55')]};return db['MailAccount']['count'](_0x5863a5)[_0xf7ad('0x13')](function(_0xe47d3){_0x3ae3bf[_0xf7ad('0x25')]=_0xe47d3;if(_0x49e258[_0xf7ad('0x4d')]['includeAll']){_0x24c985[_0xf7ad('0x5b')]=[{'all':!![]}];}return db[_0xf7ad('0x48')][_0xf7ad('0x5c')](_0x24c985);})[_0xf7ad('0x13')](function(_0x4a5b68){_0x3ae3bf[_0xf7ad('0x5d')]=_0x4a5b68;return _0x3ae3bf;})[_0xf7ad('0x13')](respondWithFilteredResult(_0xf9e43a,_0x24c985))['catch'](handleError(_0xf9e43a,null));};exports['show']=function(_0x29f909,_0x8cb6bf){var _0x15e71e={'raw':![],'where':{'id':_0x29f909[_0xf7ad('0x5e')]['id']},'include':[{'model':db[_0xf7ad('0x43')],'as':'Imap'},{'model':db[_0xf7ad('0x44')],'as':_0xf7ad('0x42')},{'model':db[_0xf7ad('0x45')],'as':_0xf7ad('0x46')}]},_0x34059d={};_0x34059d[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x48')][_0xf7ad('0x49')]);_0x34059d[_0xf7ad('0x4d')]=_['keys'](_0x29f909['query']);_0x34059d[_0xf7ad('0x57')]=_['intersection'](_0x34059d[_0xf7ad('0x4f')],_0x34059d[_0xf7ad('0x4d')]);_0x15e71e[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x34059d[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x29f909['query'][_0xf7ad('0x51')]));_0x15e71e['attributes']=_0x15e71e[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x15e71e[_0xf7ad('0x50')]:_0x34059d['model'];if(_0x29f909['query'][_0xf7ad('0x60')]){_0x15e71e['include']=[{'all':!![]}];}_0x15e71e=_['merge']({},_0x15e71e,_0x29f909[_0xf7ad('0x61')]);return db[_0xf7ad('0x48')][_0xf7ad('0x62')](_0x15e71e)[_0xf7ad('0x13')](handleEntityNotFound(_0x8cb6bf,null))[_0xf7ad('0x13')](respondWithResult(_0x8cb6bf,null))[_0xf7ad('0x1e')](handleError(_0x8cb6bf,null));};exports[_0xf7ad('0x63')]=function(_0x55bd2e,_0x536f88){if(_0x55bd2e[_0xf7ad('0x64')]['id']){delete _0x55bd2e[_0xf7ad('0x64')]['id'];}var _0x32c848=_0x55bd2e['body'][_0xf7ad('0x65')]===_0xf7ad('0x66')?null:_0x55bd2e['body'][_0xf7ad('0x65')];var _0x5583b9=_0x55bd2e['body'][_0xf7ad('0x41')]||{};var _0x5b5983=_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x42')]||{};if(_0x32c848){_0x5583b9[_0xf7ad('0x3c')]=getImapHost(_0x32c848);_0x5583b9[_0xf7ad('0x3d')]=0x3e1;_0x5b5983[_0xf7ad('0x3c')]=getSmtpHost(_0x32c848);_0x5b5983[_0xf7ad('0x3d')]=0x24b;_0x5b5983[_0xf7ad('0x3e')]=![];}if(_0x5b5983[_0xf7ad('0x3a')]){_0x5b5983[_0xf7ad('0x3e')]=![];}else{_0x5b5983[_0xf7ad('0x3b')]=null;}if(!_0x5583b9[_0xf7ad('0x3a')])_0x5583b9['CloudProviderId']=null;_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x41')]=_0x5583b9;_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x42')]=_0x5b5983;return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x55bd2e[_0xf7ad('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xf7ad('0x44')],'as':_0xf7ad('0x42')},{'model':db['Pause'],'as':_0xf7ad('0x46')}]})[_0xf7ad('0x13')](handleEntityNotFound(_0x536f88,null))[_0xf7ad('0x13')](function(_0x5d4782){if(!_0x5d4782)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5d4782['service'])delete _0x55bd2e['body'][_0xf7ad('0x41')];return _0x5d4782;})[_0xf7ad('0x13')](saveUpdates(_0x55bd2e['body'],null))[_0xf7ad('0x13')](function(_0x22f788){if(!_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x41')])return _0x22f788;return db[_0xf7ad('0x43')]['update'](_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x41')],{'where':{'MailAccountId':_0x22f788['id']}})[_0xf7ad('0x13')](function(){return _0x22f788;});})['then'](function(_0x307b5f){if(!_0x55bd2e['body'][_0xf7ad('0x42')])return _0x307b5f;return db[_0xf7ad('0x44')][_0xf7ad('0x63')](_0x55bd2e['body'][_0xf7ad('0x42')],{'where':{'MailAccountId':_0x307b5f['id']}})[_0xf7ad('0x13')](function(){return _0x307b5f;});})[_0xf7ad('0x13')](respondWithResult(_0x536f88,null))['catch'](handleError(_0x536f88,null));};exports[_0xf7ad('0x67')]=function(_0x79422d,_0x4beeed){return db[_0xf7ad('0x48')]['describe']()[_0xf7ad('0x13')](respondWithResult(_0x4beeed,null))['catch'](handleError(_0x4beeed,null));};exports[_0xf7ad('0x68')]=function(_0x1eb141,_0x51c4dd){if(_0x1eb141[_0xf7ad('0x64')]['id']){delete _0x1eb141['body']['id'];}return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x1eb141[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x51c4dd,null))[_0xf7ad('0x13')](function(_0x188b03){if(_0x188b03){_0x1eb141[_0xf7ad('0x64')]['MailAccountId']=_0x188b03['id'];return db[_0xf7ad('0x69')][_0xf7ad('0x6a')](_0x1eb141[_0xf7ad('0x64')]);}})['then'](respondWithResult(_0x51c4dd,null))[_0xf7ad('0x1e')](handleError(_0x51c4dd,null));};exports[_0xf7ad('0x6b')]=function(_0x368123,_0x2116b4){var _0x337fe0={'raw':![],'where':{}};var _0x267797={};var _0x5884bd={'count':0x0,'rows':[]};return db[_0xf7ad('0x48')]['findOne']({'where':{'id':_0x368123['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x2116b4,null))[_0xf7ad('0x13')](function(_0x46e2ce){if(_0x46e2ce){_0x267797[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x69')][_0xf7ad('0x49')]);_0x267797[_0xf7ad('0x4d')]=_['keys'](_0x368123['query']);_0x267797[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x267797[_0xf7ad('0x4f')],_0x267797[_0xf7ad('0x4d')]);_0x337fe0[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x267797['model'],qs[_0xf7ad('0x51')](_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x337fe0['attributes']=_0x337fe0[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x337fe0['attributes']:_0x267797[_0xf7ad('0x4f')];if(!_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x337fe0[_0xf7ad('0x26')]=qs[_0xf7ad('0x26')](_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x337fe0[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}_0x337fe0[_0xf7ad('0x6d')]=qs[_0xf7ad('0x54')](_0x368123['query'][_0xf7ad('0x54')]);_0x337fe0[_0xf7ad('0x55')]=qs['filters'](_[_0xf7ad('0x56')](_0x368123[_0xf7ad('0x4d')],_0x267797[_0xf7ad('0x57')]));_0x337fe0[_0xf7ad('0x55')][_0xf7ad('0x6e')]=_0x46e2ce['id'];if(_0x368123[_0xf7ad('0x4d')]['filter']){_0x337fe0['where']=_['merge'](_0x337fe0[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x337fe0[_0xf7ad('0x50')],function(_0x3384ff){var _0x303060={};_0x303060[_0x3384ff]={'$like':'%'+_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x303060;})});}_0x337fe0=_['merge']({},_0x337fe0,_0x368123[_0xf7ad('0x61')]);return db[_0xf7ad('0x69')][_0xf7ad('0x25')]({'where':_0x337fe0['where']})[_0xf7ad('0x13')](function(_0x5ebaea){_0x5884bd['count']=_0x5ebaea;if(_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x60')]){_0x337fe0[_0xf7ad('0x5b')]=[{'all':!![]}];}return db[_0xf7ad('0x69')][_0xf7ad('0x5c')](_0x337fe0);})[_0xf7ad('0x13')](function(_0x227d6d){_0x5884bd[_0xf7ad('0x5d')]=_0x227d6d;return _0x5884bd;});}})[_0xf7ad('0x13')](respondWithFilteredResult(_0x2116b4,_0x337fe0))[_0xf7ad('0x1e')](handleError(_0x2116b4,null));};exports[_0xf7ad('0x6f')]=function(_0x8d55d9,_0xd2834d){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x8d55d9['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0xd2834d,null))[_0xf7ad('0x13')](function(_0xba6d8){if(_0xba6d8){return _0xba6d8[_0xf7ad('0x6f')](_0x8d55d9[_0xf7ad('0x4d')][_0xf7ad('0x70')]);}})['then'](respondWithStatusCode(_0xd2834d,null))[_0xf7ad('0x1e')](handleError(_0xd2834d,null));};exports[_0xf7ad('0x71')]=function(_0x17774c,_0x5279b0){if(_0x17774c['body']['id']){delete _0x17774c['body']['id'];}return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x17774c[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x5279b0,null))[_0xf7ad('0x13')](function(_0xc1f51e){if(_0xc1f51e){_0x17774c[_0xf7ad('0x64')][_0xf7ad('0x6e')]=_0xc1f51e['id'];return db['CannedAnswer']['create'](_0x17774c[_0xf7ad('0x64')]);}})[_0xf7ad('0x13')](respondWithResult(_0x5279b0,null))[_0xf7ad('0x1e')](handleError(_0x5279b0,null));};exports[_0xf7ad('0x72')]=function(_0x40b6b5,_0x1c0ca2){var _0x1deae9={'raw':![],'where':{}};var _0xb59ab2={};var _0x4f9627={'count':0x0,'rows':[]};return db[_0xf7ad('0x48')]['findOne']({'where':{'id':_0x40b6b5[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x1c0ca2,null))['then'](function(_0x4846c0){if(_0x4846c0){_0xb59ab2['model']=_[_0xf7ad('0x5f')](db[_0xf7ad('0x73')][_0xf7ad('0x49')]);_0xb59ab2[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0x40b6b5[_0xf7ad('0x4d')]);_0xb59ab2[_0xf7ad('0x57')]=_['intersection'](_0xb59ab2[_0xf7ad('0x4f')],_0xb59ab2['query']);_0x1deae9[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0xb59ab2['model'],qs[_0xf7ad('0x51')](_0x40b6b5['query'][_0xf7ad('0x51')]));_0x1deae9[_0xf7ad('0x50')]=_0x1deae9['attributes']['length']?_0x1deae9['attributes']:_0xb59ab2[_0xf7ad('0x4f')];if(!_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x1deae9[_0xf7ad('0x26')]=qs[_0xf7ad('0x26')](_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x1deae9['offset']=qs[_0xf7ad('0x23')](_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}_0x1deae9[_0xf7ad('0x6d')]=qs['sort'](_0x40b6b5['query'][_0xf7ad('0x54')]);_0x1deae9[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_['pick'](_0x40b6b5['query'],_0xb59ab2[_0xf7ad('0x57')]));_0x1deae9['where'][_0xf7ad('0x6e')]=_0x4846c0['id'];if(_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x1deae9['where']=_[_0xf7ad('0x58')](_0x1deae9[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x1deae9[_0xf7ad('0x50')],function(_0x5d9e9e){var _0x49cf71={};_0x49cf71[_0x5d9e9e]={'$like':'%'+_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x49cf71;})});}_0x1deae9=_['merge']({},_0x1deae9,_0x40b6b5[_0xf7ad('0x61')]);return db['CannedAnswer'][_0xf7ad('0x25')]({'where':_0x1deae9[_0xf7ad('0x55')]})['then'](function(_0x2a032d){_0x4f9627[_0xf7ad('0x25')]=_0x2a032d;if(_0x40b6b5['query'][_0xf7ad('0x60')]){_0x1deae9['include']=[{'all':!![]}];}return db[_0xf7ad('0x73')][_0xf7ad('0x5c')](_0x1deae9);})[_0xf7ad('0x13')](function(_0x1e28e1){_0x4f9627['rows']=_0x1e28e1;return _0x4f9627;});}})['then'](respondWithFilteredResult(_0x1c0ca2,_0x1deae9))[_0xf7ad('0x1e')](handleError(_0x1c0ca2,null));};exports[_0xf7ad('0x74')]=function(_0x2d25c0,_0x572074){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x2d25c0['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x572074,null))[_0xf7ad('0x13')](function(_0x21e3bd){if(_0x21e3bd){return _0x21e3bd[_0xf7ad('0x74')](_0x2d25c0[_0xf7ad('0x4d')][_0xf7ad('0x70')]);}})[_0xf7ad('0x13')](respondWithStatusCode(_0x572074,null))['catch'](handleError(_0x572074,null));};exports[_0xf7ad('0x6a')]=function(_0x7bc347,_0x3604ac){var _0x5b1aae={'name':_0x7bc347['body']['name'],'key':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x4c')],'provider':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x65')]===_0xf7ad('0x66')?null:_0x7bc347['body'][_0xf7ad('0x65')],'email':_0x7bc347[_0xf7ad('0x64')]['email'],'ListId':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x75')],'active':!_['isNil'](_0x7bc347['body'][_0xf7ad('0x76')])?_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x76')]:!![],'description':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x77')]||null};var _0x510809=getAuthenticationOptions(_0x5b1aae[_0xf7ad('0x65')],_0x7bc347[_0xf7ad('0x64')]);_0x5b1aae[_0xf7ad('0x41')]=_0x510809[_0xf7ad('0x41')];_0x5b1aae[_0xf7ad('0x42')]=_0x510809[_0xf7ad('0x42')];return db[_0xf7ad('0x48')][_0xf7ad('0x6a')](_0x5b1aae,{'include':[{'model':db[_0xf7ad('0x44')],'as':'Smtp'},{'model':db[_0xf7ad('0x43')],'as':'Imap'}]})['then'](function(_0x46f6fb){var _0x540c02=_0x7bc347[_0xf7ad('0x36')][_0xf7ad('0x28')]({'plain':!![]});if(!_0x540c02)throw new Error(_0xf7ad('0x78'));if(_0x540c02[_0xf7ad('0x79')]==='user'){var _0x2813fe=_0x46f6fb[_0xf7ad('0x28')]({'plain':!![]});return db[_0xf7ad('0x7a')][_0xf7ad('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x540c02[_0xf7ad('0x7b')]},'raw':!![]})[_0xf7ad('0x13')](function(_0x529a7b){if(_0x529a7b&&_0x529a7b['autoAssociation']===0x0){return db[_0xf7ad('0x7c')][_0xf7ad('0x6a')]({'name':_0x2813fe[_0xf7ad('0x2c')],'resourceId':_0x2813fe['id'],'type':_0x529a7b['name'],'sectionId':_0x529a7b['id']},{})[_0xf7ad('0x13')](function(){return _0x46f6fb;});}else{return _0x46f6fb;}})[_0xf7ad('0x1e')](function(_0x5ef475){logger[_0xf7ad('0x19')](_0xf7ad('0x7d'),_0x5ef475);throw _0x5ef475;});}return _0x46f6fb;})['then'](respondWithResult(_0x3604ac,0xc9))['catch'](handleError(_0x3604ac,null));};exports[_0xf7ad('0x7e')]=function(_0x2710f6,_0x5ed398){return db[_0xf7ad('0x48')]['findOne']({'where':{'id':_0x2710f6['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x5ed398,null))[_0xf7ad('0x13')](function(_0x294abc){if(_0x294abc){return _0x294abc['getImap']();}return null;})['then'](respondWithResult(_0x5ed398,null))['catch'](handleError(_0x5ed398,null));};exports['addImap']=function(_0x268c69,_0x3eae79){if(_0x268c69['body']['id']){delete _0x268c69[_0xf7ad('0x64')]['id'];}return db[_0xf7ad('0x48')]['find']({'where':{'id':_0x268c69[_0xf7ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3eae79,null))[_0xf7ad('0x13')](function(_0x483f8d){if(_0x483f8d){_0x268c69[_0xf7ad('0x64')][_0xf7ad('0x6e')]=_0x483f8d['id'];return db['MailServerIn'][_0xf7ad('0x6a')](_0x268c69[_0xf7ad('0x64')]);}})[_0xf7ad('0x13')](respondWithResult(_0x3eae79,null))['catch'](handleError(_0x3eae79,null));};exports[_0xf7ad('0x7f')]=function(_0x258dfe,_0x31bd48){return db['MailAccount'][_0xf7ad('0x80')]({'where':{'id':_0x258dfe[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x31bd48,null))[_0xf7ad('0x13')](function(_0x39fc92){if(_0x39fc92){return _0x39fc92['setImap'](null);}return null;})[_0xf7ad('0x13')](respondWithStatusCode(_0x31bd48,null))['catch'](handleError(_0x31bd48,null));};exports[_0xf7ad('0x81')]=function(_0x1ed538,_0x4a8cff){return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0x1ed538['params']['id']}})['then'](handleEntityNotFound(_0x4a8cff,null))[_0xf7ad('0x13')](function(_0x3190fb){if(_0x3190fb){return _0x3190fb['getSmtp']();}return null;})[_0xf7ad('0x13')](respondWithResult(_0x4a8cff,null))[_0xf7ad('0x1e')](handleError(_0x4a8cff,null));};exports[_0xf7ad('0x82')]=function(_0x5b88d6,_0x588f01){if(_0x5b88d6['body']['id']){delete _0x5b88d6[_0xf7ad('0x64')]['id'];}return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x5b88d6[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x588f01,null))[_0xf7ad('0x13')](function(_0xa4f1af){if(_0xa4f1af){_0x5b88d6[_0xf7ad('0x64')][_0xf7ad('0x6e')]=_0xa4f1af['id'];return db[_0xf7ad('0x44')][_0xf7ad('0x6a')](_0x5b88d6[_0xf7ad('0x64')]);}})[_0xf7ad('0x13')](respondWithResult(_0x588f01,null))['catch'](handleError(_0x588f01,null));};exports[_0xf7ad('0x83')]=function(_0x51ce5f,_0x578eb4){return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0x51ce5f['params']['id']}})['then'](handleEntityNotFound(_0x578eb4,null))[_0xf7ad('0x13')](function(_0x4b88cc){if(_0x4b88cc){return _0x4b88cc[_0xf7ad('0x84')](null);}return null;})[_0xf7ad('0x13')](respondWithStatusCode(_0x578eb4,null))[_0xf7ad('0x1e')](handleError(_0x578eb4,null));};exports[_0xf7ad('0x85')]=function(_0x11e84d,_0x52f702){return db[_0xf7ad('0x86')][_0xf7ad('0x62')]({'where':{'id':_0x11e84d['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x52f702,null))[_0xf7ad('0x13')](function(_0x27ff1a){if(_0x27ff1a){return _0x27ff1a[_0xf7ad('0x85')](_0x11e84d['body'][_0xf7ad('0x70')],_[_0xf7ad('0x87')](_0x11e84d['body'],[_0xf7ad('0x70'),'id'])||{});}})[_0xf7ad('0x13')](respondWithResult(_0x52f702,null))[_0xf7ad('0x1e')](handleError(_0x52f702,null));};exports[_0xf7ad('0x88')]=function(_0xcbba08,_0x5eae9f){var _0x4404a9={'raw':![],'where':{}};var _0x355a31={};var _0x8641c8={'count':0x0,'rows':[]};return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0xcbba08[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x5eae9f,null))['then'](function(_0x45c945){if(_0x45c945){_0x355a31[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x86')]['rawAttributes']);_0x355a31[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0xcbba08[_0xf7ad('0x4d')]);_0x355a31[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x355a31[_0xf7ad('0x4f')],_0x355a31[_0xf7ad('0x4d')]);_0x4404a9[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x355a31[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x4404a9[_0xf7ad('0x50')]=_0x4404a9[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x4404a9[_0xf7ad('0x50')]:_0x355a31[_0xf7ad('0x4f')];if(!_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x4404a9[_0xf7ad('0x26')]=qs['limit'](_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x4404a9[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0xcbba08[_0xf7ad('0x4d')]['offset']);}_0x4404a9[_0xf7ad('0x6d')]=qs['sort'](_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x4404a9[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_[_0xf7ad('0x56')](_0xcbba08[_0xf7ad('0x4d')],_0x355a31[_0xf7ad('0x57')]));_0x4404a9[_0xf7ad('0x55')]['MailAccountId']=_0x45c945['id'];if(_0xcbba08['query'][_0xf7ad('0x5a')]){_0x4404a9[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x4404a9[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x4404a9[_0xf7ad('0x50')],function(_0x263da5){var _0x5b0463={};_0x5b0463[_0x263da5]={'$like':'%'+_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x5b0463;})});}_0x4404a9=_[_0xf7ad('0x58')]({},_0x4404a9,_0xcbba08['options']);return db['MailInteraction'][_0xf7ad('0x25')]({'where':_0x4404a9['where']})[_0xf7ad('0x13')](function(_0x165aa9){_0x8641c8[_0xf7ad('0x25')]=_0x165aa9;if(_0xcbba08[_0xf7ad('0x4d')]['includeAll']){_0x4404a9[_0xf7ad('0x5b')]=[{'model':db[_0xf7ad('0x89')],'as':_0xf7ad('0x8a'),'required':![]},{'model':db['User'],'as':_0xf7ad('0x8b'),'attributes':['name',_0xf7ad('0x8c'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xf7ad('0x2c'),_0xf7ad('0x8d')],'where':_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x8e')]?{'id':_0xcbba08['query'][_0xf7ad('0x8e')]}:undefined,'required':_0xcbba08['query']['tag']?!![]:![]}];}return db['MailInteraction']['findAll'](_0x4404a9);})[_0xf7ad('0x13')](function(_0x1ffb1a){_0x8641c8[_0xf7ad('0x5d')]=_0x1ffb1a;return _0x8641c8;});}})[_0xf7ad('0x13')](respondWithFilteredResult(_0x5eae9f,_0x4404a9))[_0xf7ad('0x1e')](handleError(_0x5eae9f,null));};exports[_0xf7ad('0x8f')]=function addApplications(_0x471461,_0x43a7bb){var _0x5b0bf9=_0x471461[_0xf7ad('0x5e')]['id'];var _0x45f2e1=_0x471461[_0xf7ad('0x64')];var _0x2fa0e4=0xc8;var _0x5eb91d=null;return db['sequelize'][_0xf7ad('0x90')]({'isolationLevel':db[_0xf7ad('0x91')][_0xf7ad('0x92')]['ISOLATION_LEVELS'][_0xf7ad('0x93')]},function(_0x269b5a){return db['MailAccount'][_0xf7ad('0x80')]({'where':{'id':_0x5b0bf9},'transaction':_0x269b5a})['then'](function(_0x2a8c4b){if(_0x2a8c4b){return db[_0xf7ad('0x94')][_0xf7ad('0x2a')]({'where':{'MailAccountId':_0x5b0bf9},'transaction':_0x269b5a})[_0xf7ad('0x13')](function(){var _0x372de6=_[_0xf7ad('0x47')](_0x45f2e1,function(_0x7cbca0){_0x7cbca0[_0xf7ad('0x6e')]=_0x5b0bf9;return _0x7cbca0;});return db['MailApplication'][_0xf7ad('0x95')](_0x372de6,{'transaction':_0x269b5a});});}else{_0x2fa0e4=0x194;_0x5eb91d=[];}});})['then'](function(){if(_0x2fa0e4!==0x194){return db['MailApplication'][_0xf7ad('0x96')]({'where':{'MailAccountId':_0x5b0bf9},'order':_0xf7ad('0x97')})[_0xf7ad('0x13')](function(_0x144077){_0x5eb91d=_0x144077;});}})[_0xf7ad('0x1e')](function(_0x2b4c88){_0x2fa0e4=0x1f4;logger[_0xf7ad('0x19')](_0x2b4c88['stack']);if(_0x2b4c88[_0xf7ad('0x2c')]){delete _0x2b4c88[_0xf7ad('0x2c')];}_0x5eb91d=_0x2b4c88;})[_0xf7ad('0x98')](function(){if(_0x5eb91d===null){_0x43a7bb[_0xf7ad('0x1f')](_0x2fa0e4);}else{if(_0x2fa0e4===0x1f4){_0x43a7bb[_0xf7ad('0x21')](_0x2fa0e4)[_0xf7ad('0x99')](_0x5eb91d);}else{_0x43a7bb['status'](_0x2fa0e4)[_0xf7ad('0x22')](_0x5eb91d);}}});};exports[_0xf7ad('0x9a')]=function(_0x4b8757,_0x523c25){var _0x146966={};var _0x38da34={};var _0x509fc3;var _0x2cc7d3;return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0x4b8757[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x523c25,null))[_0xf7ad('0x13')](function(_0x5a4eb5){if(_0x5a4eb5){_0x509fc3=_0x5a4eb5;_0x38da34[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x94')][_0xf7ad('0x49')]);_0x38da34[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0x4b8757['query']);_0x38da34[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x38da34[_0xf7ad('0x4f')],_0x38da34['query']);_0x146966[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x38da34[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x146966[_0xf7ad('0x50')]=_0x146966[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x146966[_0xf7ad('0x50')]:_0x38da34[_0xf7ad('0x4f')];_0x146966['order']=qs[_0xf7ad('0x54')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x146966[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_[_0xf7ad('0x56')](_0x4b8757[_0xf7ad('0x4d')],_0x38da34[_0xf7ad('0x57')]));if(_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x146966[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x146966[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x146966['attributes'],function(_0x4444d6){var _0x3c05b9={};_0x3c05b9[_0x4444d6]={'$like':'%'+_0x4b8757['query'][_0xf7ad('0x5a')]+'%'};return _0x3c05b9;})});}_0x146966=_[_0xf7ad('0x58')]({},_0x146966,_0x4b8757[_0xf7ad('0x61')]);return _0x509fc3['getApplications'](_0x146966);}})['then'](function(_0x3f2bf0){if(_0x3f2bf0){_0x2cc7d3=_0x3f2bf0[_0xf7ad('0x52')];if(!_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x146966['limit']=qs[_0xf7ad('0x26')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x146966[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}return _0x509fc3[_0xf7ad('0x9a')](_0x146966);}})[_0xf7ad('0x13')](function(_0x3b0908){if(_0x3b0908){return _0x3b0908?{'count':_0x2cc7d3,'rows':_0x3b0908}:null;}})['then'](respondWithResult(_0x523c25,null))[_0xf7ad('0x1e')](handleError(_0x523c25,null));};exports[_0xf7ad('0x9b')]=function(_0x46fd93,_0xd725c0){var _0x4a238f={'raw':!![],'where':{}};var _0x43af97={};var _0x5e8f5f={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x46fd93[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0xd725c0,null))[_0xf7ad('0x13')](function(_0x298fc0){if(_0x298fc0){_0x43af97[_0xf7ad('0x4f')]=_['keys'](db[_0xf7ad('0x9c')][_0xf7ad('0x49')]);_0x43af97['query']=_[_0xf7ad('0x5f')](_0x46fd93[_0xf7ad('0x4d')]);_0x43af97[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x43af97[_0xf7ad('0x4f')],_0x43af97[_0xf7ad('0x4d')]);_0x4a238f[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x43af97[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x46fd93['query'][_0xf7ad('0x51')]));_0x4a238f[_0xf7ad('0x50')]=_0x4a238f[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x4a238f[_0xf7ad('0x50')]:_0x43af97[_0xf7ad('0x4f')];if(!_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x4a238f['limit']=qs[_0xf7ad('0x26')](_0x46fd93[_0xf7ad('0x4d')]['limit']);_0x4a238f[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0x46fd93[_0xf7ad('0x4d')]['offset']);}_0x4a238f[_0xf7ad('0x6d')]=qs[_0xf7ad('0x54')](_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x4a238f[_0xf7ad('0x55')]=qs['filters'](_[_0xf7ad('0x56')](_0x46fd93[_0xf7ad('0x4d')],_0x43af97[_0xf7ad('0x57')]));_0x4a238f[_0xf7ad('0x55')][_0xf7ad('0x6e')]=_0x298fc0['id'];if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x4a238f['where']=_[_0xf7ad('0x58')](_0x4a238f['where'],{'$or':_[_0xf7ad('0x47')](_0x4a238f[_0xf7ad('0x50')],function(_0x202aaa){var _0x244331={};_0x244331[_0x202aaa]={'$like':'%'+_0x46fd93[_0xf7ad('0x4d')]['filter']+'%'};return _0x244331;})});}if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x9d')]){var _0x46f29b=_0x46fd93['query'][_0xf7ad('0x9d')][_0xf7ad('0x9e')](',');var _0x34eb32={};_0x34eb32[_0x46f29b[0x0]]={'$gte':moment(_0x46f29b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a238f['where']=_[_0xf7ad('0x58')](_0x4a238f[_0xf7ad('0x55')],_0x34eb32);}_0x4a238f=_[_0xf7ad('0x58')]({},_0x4a238f,_0x46fd93[_0xf7ad('0x61')]);return db[_0xf7ad('0x9c')][_0xf7ad('0x25')]({'where':_0x4a238f['where']})[_0xf7ad('0x13')](function(_0x4f0c6d){_0x5e8f5f[_0xf7ad('0x25')]=_0x4f0c6d;if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x60')]){_0x4a238f[_0xf7ad('0x5b')]=[{'all':!![]}];}return db[_0xf7ad('0x9c')][_0xf7ad('0x5c')](_0x4a238f);})[_0xf7ad('0x13')](function(_0x1cebef){if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x9f')]===_0xf7ad('0xa0')){for(var _0x3d4c5c=0x0;_0x3d4c5c<_0x1cebef[_0xf7ad('0x52')];_0x3d4c5c++){_0x1cebef[_0x3d4c5c][_0xf7ad('0x64')]=juice(_0x1cebef[_0x3d4c5c][_0xf7ad('0x64')]);}}_0x5e8f5f['rows']=_0x1cebef;return _0x5e8f5f;});}})[_0xf7ad('0x13')](respondWithFilteredResult(_0xd725c0,_0x4a238f))['catch'](handleError(_0xd725c0,null));};exports[_0xf7ad('0x99')]=function(_0x4a3144,_0x2e1dab){var _0x3371ac,_0x55f9f7={},_0x1c2965;if(_0x4a3144[_0xf7ad('0x64')]['to']){_0x1c2965=_0x4a3144[_0xf7ad('0x64')]['to'][_0xf7ad('0x9e')](',')[0x0];}return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x4a3144[_0xf7ad('0x5e')]['id']},'include':[{'model':db[_0xf7ad('0xa1')],'as':_0xf7ad('0xa2'),'include':[{'model':db[_0xf7ad('0x89')],'as':_0xf7ad('0xa3'),'where':{'email':_0x1c2965},'limit':0x1,'order':[[_0xf7ad('0xa4'),_0xf7ad('0xa5')]]}]},{'model':db[_0xf7ad('0x44')],'as':_0xf7ad('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xf7ad('0xa6'),'raw':!![]}]}]})[_0xf7ad('0x13')](handleEntityNotFound(_0x2e1dab,null))['then'](function(_0x268f09){if(!_0x268f09)return;_0x3371ac=_0x268f09;if(!_0x268f09['Smtp'])throw new Error(_0xf7ad('0xa7'));if(_[_0xf7ad('0xa8')](_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xa9')])){_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xa9')]=util[_0xf7ad('0xaa')](_0xf7ad('0xab'),_0x268f09[_0xf7ad('0x2c')],_0x268f09[_0xf7ad('0xac')]||_0x268f09[_0xf7ad('0x42')][_0xf7ad('0x36')]);}if(_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xad')]&&_0x4a3144['body'][_0xf7ad('0xad')]['length']){for(var _0x5da19d=0x0;_0x5da19d<_0x4a3144['body'][_0xf7ad('0xad')][_0xf7ad('0x52')];_0x5da19d+=0x1){_0x4a3144[_0xf7ad('0x64')]['attachments'][_0x5da19d]={'filename':_0x4a3144[_0xf7ad('0x64')]['attachments'][_0x5da19d][_0xf7ad('0x2c')],'path':path[_0xf7ad('0xae')](config['root'],_0xf7ad('0xaf'),_0x4a3144[_0xf7ad('0x64')]['attachments'][_0x5da19d][_0xf7ad('0xb0')])};}}var _0x33a370=_0x268f09['getSmtpOptions']();return respondWithRpcPromise(_0xf7ad('0xb1'),_0xf7ad('0xb2'),{'account':_0x33a370,'message':_0x4a3144[_0xf7ad('0x64')]});})[_0xf7ad('0x13')](function(_0x442725){if(!_0x442725)return;_0x55f9f7=_0x442725;if(!_0x3371ac[_0xf7ad('0xa2')])throw new Error(_0xf7ad('0xb3'));if(_0x3371ac[_0xf7ad('0xa2')]['Contacts'][_0xf7ad('0x52')])return _0x3371ac[_0xf7ad('0xa2')][_0xf7ad('0xa3')][0x0];return db[_0xf7ad('0x89')]['create'](_['defaults'](_0x4a3144['body'],{'firstName':_0x4a3144[_0xf7ad('0x64')]['to'],'email':_0x4a3144[_0xf7ad('0x64')]['to'],'phone':_0x4a3144['body']['to'],'ListId':_0x3371ac[_0xf7ad('0x75')]}));})[_0xf7ad('0x13')](function(_0x149574){if(!_0x149574)return;var _0x411054={'UserId':_0x4a3144[_0xf7ad('0x36')]['id'],'ContactId':_0x149574['id'],'MailAccountId':_0x3371ac['id'],'inReplyTo':_0x55f9f7['messageId'],'to':_0x4a3144[_0xf7ad('0x64')]['from'],'cc':_0x4a3144[_0xf7ad('0x64')]['cc'],'subject':_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb4')],'attach':_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb5')],'firstMsgDirection':_0xf7ad('0xb6'),'lastMsgAt':moment()['format'](_0xf7ad('0xb7')),'lastMsgDirection':'out','Messages':[_[_0xf7ad('0x58')](_0x4a3144['body'],{'messageId':_0x55f9f7[_0xf7ad('0xb8')],'sentAt':moment()[_0xf7ad('0xaa')](_0xf7ad('0xb7')),'read':!![],'MailAccountId':_0x3371ac['id'],'UserId':_0x4a3144[_0xf7ad('0x36')]['id'],'ContactId':_0x149574['id']})]};if(_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb9')]){_0x411054=_[_0xf7ad('0x58')](_0x411054,_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb9')]);}return db['MailInteraction']['create'](_0x411054,{'include':[{'model':db[_0xf7ad('0x9c')],'as':_0xf7ad('0xba')}]});})[_0xf7ad('0x13')](respondWithResult(_0x2e1dab,null))[_0xf7ad('0x1e')](handleError(_0x2e1dab,null));};exports['verifySmtp']=function(_0x5cc67c,_0x1cf3e7){return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x5cc67c[_0xf7ad('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xf7ad('0x42'),'raw':!![],'include':[{'model':db[_0xf7ad('0xa6')],'as':_0xf7ad('0xa6'),'raw':!![]}]}]})[_0xf7ad('0x13')](handleEntityNotFound(_0x1cf3e7,null))['then'](function(_0x11fd34){if(!_0x11fd34[_0xf7ad('0x42')])return;var _0x1e162e=_0x11fd34[_0xf7ad('0xbb')]();return respondWithRpcPromise('VerifySmtp',_0xf7ad('0xbc'),{'account':_0x1e162e});})['then'](respondWithResult(_0x1cf3e7,null))[_0xf7ad('0x1e')](handleError(_0x1cf3e7,null));};exports[_0xf7ad('0x2a')]=function(_0x212dcc,_0x1a25a4){return db[_0xf7ad('0x48')]['find']({'where':{'id':_0x212dcc['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x1a25a4,null))[_0xf7ad('0x13')](function(_0x200d6f){if(_0x200d6f&&_0x200d6f[_0xf7ad('0x3f')]){throw new db[(_0xf7ad('0xbd'))][(_0xf7ad('0xbe'))](_0xf7ad('0xbf'));}return _0x200d6f;})['then'](removeEntity(_0x1a25a4,null))['catch'](handleError(_0x1a25a4,null));};exports['addAgents']=function(_0x29e78b,_0x11acf9){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x29e78b['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x11acf9,null))[_0xf7ad('0x13')](function(_0x46a6b6){if(_0x46a6b6){return _0x46a6b6[_0xf7ad('0xc0')](_0x29e78b[_0xf7ad('0x64')][_0xf7ad('0x70')],_['omit'](_0x29e78b[_0xf7ad('0x64')],[_0xf7ad('0x70'),'id'])||{})[_0xf7ad('0xc1')](function(_0xd1ba93){for(var _0x4338bb=0x0;_0x4338bb<_0x29e78b[_0xf7ad('0x64')][_0xf7ad('0x70')][_0xf7ad('0x52')];_0x4338bb+=0x1){socket[_0xf7ad('0xc2')](_0xf7ad('0xc3'),{'UserId':Number(_0x29e78b[_0xf7ad('0x64')][_0xf7ad('0x70')][_0x4338bb]),'MailAccountId':Number(_0x29e78b['params']['id'])});}return _0xd1ba93;});}})[_0xf7ad('0x13')](respondWithResult(_0x11acf9,null))[_0xf7ad('0x1e')](handleError(_0x11acf9,null));};exports['removeAgents']=function(_0x169d58,_0x428a35){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x169d58[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x428a35,null))[_0xf7ad('0x13')](function(_0x13e92e){if(_0x13e92e){return _0x13e92e['removeAgents'](_0x169d58[_0xf7ad('0x4d')][_0xf7ad('0x70')])[_0xf7ad('0x13')](function(){if(_[_0xf7ad('0xc4')](_0x169d58[_0xf7ad('0x4d')][_0xf7ad('0x70')])){for(var _0x5ceea8=0x0;_0x5ceea8<_0x169d58[_0xf7ad('0x4d')]['ids'][_0xf7ad('0x52')];_0x5ceea8+=0x1){socket[_0xf7ad('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x169d58['query'][_0xf7ad('0x70')][_0x5ceea8]),'MailAccountId':Number(_0x169d58[_0xf7ad('0x5e')]['id'])});}}else{socket['emit'](_0xf7ad('0xc5'),{'UserId':Number(_0x169d58[_0xf7ad('0x4d')][_0xf7ad('0x70')]),'MailAccountId':Number(_0x169d58['params']['id'])});}});}})[_0xf7ad('0x13')](respondWithStatusCode(_0x428a35,null))['catch'](handleError(_0x428a35,null));};exports['getAgents']=function(_0x4a1bfc,_0xfe9f85){var _0x2dc942={};var _0x422c78={};var _0x33a72e;var _0x5f41eb;return db['MailAccount'][_0xf7ad('0x80')]({'where':{'id':_0x4a1bfc[_0xf7ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0xfe9f85,null))[_0xf7ad('0x13')](function(_0x311b32){if(_0x311b32){_0x33a72e=_0x311b32;_0x422c78[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0xc6')][_0xf7ad('0x49')]);_0x422c78[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0x4a1bfc['query']);_0x422c78[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x422c78[_0xf7ad('0x4f')],_0x422c78[_0xf7ad('0x4d')]);_0x2dc942[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x422c78[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x2dc942[_0xf7ad('0x50')]=_0x2dc942[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x2dc942[_0xf7ad('0x50')]:_0x422c78[_0xf7ad('0x4f')];_0x2dc942[_0xf7ad('0x6d')]=qs[_0xf7ad('0x54')](_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x2dc942[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_[_0xf7ad('0x56')](_0x4a1bfc[_0xf7ad('0x4d')],_0x422c78[_0xf7ad('0x57')]));if(_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x2dc942[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x2dc942[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x2dc942[_0xf7ad('0x50')],function(_0x612c50){var _0x560fcb={};_0x560fcb[_0x612c50]={'$like':'%'+_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x560fcb;})});}_0x2dc942=_['merge']({},_0x2dc942,_0x4a1bfc[_0xf7ad('0x61')]);return _0x33a72e['getAgents'](_0x2dc942);}})[_0xf7ad('0x13')](function(_0x43185e){if(_0x43185e){_0x5f41eb=_0x43185e['length'];if(!_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x2dc942[_0xf7ad('0x26')]=qs['limit'](_0x4a1bfc[_0xf7ad('0x4d')]['limit']);_0x2dc942['offset']=qs[_0xf7ad('0x23')](_0x4a1bfc['query']['offset']);}return _0x33a72e['getAgents'](_0x2dc942);}})[_0xf7ad('0x13')](function(_0xc44465){if(_0xc44465){return _0xc44465?{'count':_0x5f41eb,'rows':_0xc44465}:null;}})[_0xf7ad('0x13')](respondWithResult(_0xfe9f85,null))['catch'](handleError(_0xfe9f85,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index db5bdb6..0154d57 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 _0xccd4=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e6fec,_0x3a299d){var _0xfcc77=function(_0x3a42a6){while(--_0x3a42a6){_0x3e6fec['push'](_0x3e6fec['shift']());}};_0xfcc77(++_0x3a299d);}(_0xccd4,0xa4));var _0x4ccd=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xccd4[_0x47a7d0];return _0xb9bd08;};'use strict';var EventEmitter=require(_0x4ccd('0x0'));var MailAccount=require(_0x4ccd('0x1'))['db'][_0x4ccd('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4ccd('0x3')](0x0);var events={'afterCreate':_0x4ccd('0x4'),'afterUpdate':_0x4ccd('0x5'),'afterDestroy':_0x4ccd('0x6')};function emitEvent(_0x2e98de){return function(_0x5b697e,_0x4e359e,_0x4b0825){MailAccountEvents['emit'](_0x2e98de+':'+_0x5b697e['id'],_0x5b697e);MailAccountEvents[_0x4ccd('0x7')](_0x2e98de,_0x5b697e);_0x4b0825(null);};}for(var e in events){if(events[_0x4ccd('0x8')](e)){var event=events[e];MailAccount[_0x4ccd('0x9')](e,emitEvent(event));}}module[_0x4ccd('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x8daf=['save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x8daf,0x15c));var _0xf8da=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0x8daf[_0x5aece9];return _0x1c46d6;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8da('0x0'),'afterUpdate':_0xf8da('0x1'),'afterDestroy':'remove'};function emitEvent(_0x3a62fe){return function(_0x109758,_0x258561,_0x3357f6){MailAccountEvents[_0xf8da('0x2')](_0x3a62fe+':'+_0x109758['id'],_0x109758);MailAccountEvents[_0xf8da('0x2')](_0x3a62fe,_0x109758);_0x3357f6(null);};}for(var e in events){if(events[_0xf8da('0x3')](e)){var event=events[e];MailAccount[_0xf8da('0x4')](e,emitEvent(event));}}module[_0xf8da('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4e06427..b1d543f 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 _0xfde9=['data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service','host','port','Smtp','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user'];(function(_0x3f9954,_0x409c51){var _0x26d766=function(_0x4f923e){while(--_0x4f923e){_0x3f9954['push'](_0x3f9954['shift']());}};_0x26d766(++_0x409c51);}(_0xfde9,0x120));var _0x9fde=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0xfde9[_0x2c7b86];return _0x256735;};'use strict';var attributes=require(_0x9fde('0x0'));module[_0x9fde('0x1')]=function(_0x41308e){return _0x41308e[_0x9fde('0x2')](_0x9fde('0x3'),attributes,{'tableName':_0x9fde('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xb62185=this;var _0xbabb4={'id':_0xb62185['id'],'tls':{'rejectUnauthorized':![]}};if(_0xb62185[_0x9fde('0x5')]!=='custom'){_0xbabb4[_0x9fde('0x6')]=_0xb62185[_0x9fde('0x5')];}else{_0xbabb4[_0x9fde('0x7')]=_0xb62185['Smtp'][_0x9fde('0x7')];_0xbabb4[_0x9fde('0x8')]=_0xb62185['Smtp'][_0x9fde('0x8')];_0xbabb4['secure']=_0xb62185[_0x9fde('0x9')]['secure'];}if(_0xb62185['Smtp'][_0x9fde('0xa')]){if(_0xb62185['Smtp'][_0x9fde('0xb')]){if(!_0xb62185['Smtp'][_0x9fde('0xc')])throw new Error(_0x9fde('0xd'));_0xbabb4['auth']={'type':_0x9fde('0xe'),'user':_0xb62185[_0x9fde('0x9')][_0x9fde('0xf')],'accessToken':_0xb62185['Smtp']['CloudProvider'][_0x9fde('0x10')]};}else{_0xbabb4[_0x9fde('0x11')]={'user':_0xb62185[_0x9fde('0x9')][_0x9fde('0xf')],'pass':_0xb62185[_0x9fde('0x9')][_0x9fde('0x12')]};}}return _0xbabb4;}}});}; \ No newline at end of file +var _0x6c52=['OAuth2','user','CloudProvider','pass','./mailAccount.attributes','exports','MailAccount','provider','custom','service','host','port','secure','Smtp','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x25023b,_0x383839){var _0x48b984=function(_0x3d3258){while(--_0x3d3258){_0x25023b['push'](_0x25023b['shift']());}};_0x48b984(++_0x383839);}(_0x6c52,0x1ea));var _0x26c5=function(_0x140f21,_0x3e9551){_0x140f21=_0x140f21-0x0;var _0x573a18=_0x6c52[_0x140f21];return _0x573a18;};'use strict';var attributes=require(_0x26c5('0x0'));module[_0x26c5('0x1')]=function(_0x2c1968){return _0x2c1968['define'](_0x26c5('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x364916=this;var _0x2ac549={'id':_0x364916['id'],'tls':{'rejectUnauthorized':![]}};if(_0x364916[_0x26c5('0x3')]!==_0x26c5('0x4')){_0x2ac549[_0x26c5('0x5')]=_0x364916[_0x26c5('0x3')];}else{_0x2ac549[_0x26c5('0x6')]=_0x364916['Smtp'][_0x26c5('0x6')];_0x2ac549[_0x26c5('0x7')]=_0x364916['Smtp'][_0x26c5('0x7')];_0x2ac549[_0x26c5('0x8')]=_0x364916[_0x26c5('0x9')]['secure'];}if(_0x364916[_0x26c5('0x9')][_0x26c5('0xa')]){if(_0x364916['Smtp'][_0x26c5('0xb')]){if(!_0x364916['Smtp']['CloudProvider'])throw new Error(_0x26c5('0xc'));_0x2ac549[_0x26c5('0xd')]={'type':_0x26c5('0xe'),'user':_0x364916[_0x26c5('0x9')][_0x26c5('0xf')],'accessToken':_0x364916[_0x26c5('0x9')][_0x26c5('0x10')]['data5']};}else{_0x2ac549[_0x26c5('0xd')]={'user':_0x364916[_0x26c5('0x9')][_0x26c5('0xf')],'pass':_0x364916[_0x26c5('0x9')][_0x26c5('0x11')]};}}return _0x2ac549;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 777f7a0..b5fab45 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 _0xca9e=['GetMailAccount','MailAccount','smtp','setDataValue','getSmtpOptions','ShowMailAccount','catch','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','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','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','get','omit','smtpOptions','list','applications','orderBy','priority','asc','close','autoclose','length','from','ListId','create','List\x20not\x20found','contact','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','attachments','originTo','bcc','Email','ChatOfflineMessageId','Attachments','UserId','User','unshift','agent','*,*,*,*','queueId','name','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','findAll','options','raw','where','attributes','limit','include','map','model','stringify'];(function(_0x23d6c5,_0x19e233){var _0x12a2b4=function(_0x2a8339){while(--_0x2a8339){_0x23d6c5['push'](_0x23d6c5['shift']());}};_0x12a2b4(++_0x19e233);}(_0xca9e,0x136));var _0xeca9=function(_0x25b9ea,_0x5b4c6d){_0x25b9ea=_0x25b9ea-0x0;var _0xe85dd6=_0xca9e[_0x25b9ea];return _0xe85dd6;};'use strict';var _=require(_0xeca9('0x0'));var moment=require(_0xeca9('0x1'));var BPromise=require(_0xeca9('0x2'));var rs=require(_0xeca9('0x3'));var Redis=require(_0xeca9('0x4'));var db=require(_0xeca9('0x5'))['db'];var logger=require(_0xeca9('0x6'))(_0xeca9('0x7'));var config=require(_0xeca9('0x8'));var jayson=require(_0xeca9('0x9'));var client=jayson[_0xeca9('0xa')][_0xeca9('0xb')]({'port':0x232c});config[_0xeca9('0xc')]=_[_0xeca9('0xd')](config['redis'],{'host':_0xeca9('0xe'),'port':0x18eb});var socket=require(_0xeca9('0xf'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xeca9('0x10')](socket);function respondWithRpcPromise(_0x239e92,_0x1673b6,_0x5305ce){return new BPromise(function(_0x2dba50,_0x364eb2){return client[_0xeca9('0x11')](_0x239e92,_0x5305ce)[_0xeca9('0x12')](function(_0x19584d){logger[_0xeca9('0x13')]('MailAccount,\x20%s,\x20%s',_0x1673b6,_0xeca9('0x14'));logger[_0xeca9('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1673b6,_0xeca9('0x14'),JSON['stringify'](_0x19584d));if(_0x19584d[_0xeca9('0x16')]){if(_0x19584d[_0xeca9('0x16')]['code']===0x1f4){logger[_0xeca9('0x16')](_0xeca9('0x17'),_0x1673b6,_0x19584d[_0xeca9('0x16')]['message']);return _0x364eb2(_0x19584d[_0xeca9('0x16')][_0xeca9('0x18')]);}logger[_0xeca9('0x16')](_0xeca9('0x17'),_0x1673b6,_0x19584d['error']['message']);return _0x2dba50(_0x19584d[_0xeca9('0x16')][_0xeca9('0x18')]);}else{logger['info'](_0xeca9('0x17'),_0x1673b6,_0xeca9('0x14'));_0x2dba50(_0x19584d['result']['message']);}})['catch'](function(_0x132008){logger[_0xeca9('0x16')](_0xeca9('0x17'),_0x1673b6,_0x132008);_0x364eb2(_0x132008);});});}exports['GetMailAccount']=function(_0xf1ef9f){var _0x5a5c52=this;return new Promise(function(_0x5bbdce,_0x317159){return db['MailAccount'][_0xeca9('0x19')]({'raw':_0xf1ef9f[_0xeca9('0x1a')]?_0xf1ef9f['options'][_0xeca9('0x1b')]===undefined?!![]:![]:!![],'where':_0xf1ef9f[_0xeca9('0x1a')]?_0xf1ef9f['options'][_0xeca9('0x1c')]||null:null,'attributes':_0xf1ef9f['options']?_0xf1ef9f[_0xeca9('0x1a')][_0xeca9('0x1d')]||null:null,'limit':_0xf1ef9f[_0xeca9('0x1a')]?_0xf1ef9f['options'][_0xeca9('0x1e')]||null:null,'include':_0xf1ef9f[_0xeca9('0x1a')]?_0xf1ef9f['options'][_0xeca9('0x1f')]?_[_0xeca9('0x20')](_0xf1ef9f[_0xeca9('0x1a')][_0xeca9('0x1f')],function(_0x498f4a){return{'model':db[_0x498f4a[_0xeca9('0x21')]],'as':_0x498f4a['as'],'attributes':_0x498f4a['attributes'],'include':_0x498f4a[_0xeca9('0x1f')]?_[_0xeca9('0x20')](_0x498f4a[_0xeca9('0x1f')],function(_0x3e41df){return{'model':db[_0x3e41df[_0xeca9('0x21')]],'as':_0x3e41df['as'],'attributes':_0x3e41df[_0xeca9('0x1d')],'include':_0x3e41df[_0xeca9('0x1f')]?_[_0xeca9('0x20')](_0x3e41df[_0xeca9('0x1f')],function(_0x271720){return{'model':db[_0x271720[_0xeca9('0x21')]],'as':_0x271720['as'],'attributes':_0x271720[_0xeca9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeca9('0x12')](function(_0x1436d0){logger[_0xeca9('0x13')]('GetMailAccount',_0xf1ef9f);logger['debug']('GetMailAccount',_0xf1ef9f,JSON[_0xeca9('0x22')](_0x1436d0));_0x5bbdce(_0x1436d0);})['catch'](function(_0x2ca943){logger[_0xeca9('0x16')](_0xeca9('0x23'),_0x2ca943[_0xeca9('0x18')],_0xf1ef9f);_0x317159(_0x5a5c52[_0xeca9('0x16')](0x1f4,_0x2ca943[_0xeca9('0x18')]));});});};exports['ShowMailAccount']=function(_0x3b60c3){var _0x5d2451=this;return new Promise(function(_0x43fbff,_0x23a5fe){return db[_0xeca9('0x24')]['find']({'raw':_0x3b60c3[_0xeca9('0x1a')]?_0x3b60c3[_0xeca9('0x1a')][_0xeca9('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b60c3[_0xeca9('0x1a')]?_0x3b60c3['options'][_0xeca9('0x1c')]||null:null,'attributes':_0x3b60c3['options']?_0x3b60c3[_0xeca9('0x1a')][_0xeca9('0x1d')]||null:null,'include':_0x3b60c3[_0xeca9('0x1a')]?_0x3b60c3[_0xeca9('0x1a')][_0xeca9('0x1f')]?_[_0xeca9('0x20')](_0x3b60c3['options'][_0xeca9('0x1f')],function(_0x2424df){return{'model':db[_0x2424df[_0xeca9('0x21')]],'as':_0x2424df['as'],'attributes':_0x2424df[_0xeca9('0x1d')],'include':_0x2424df[_0xeca9('0x1f')]?_[_0xeca9('0x20')](_0x2424df[_0xeca9('0x1f')],function(_0x54d9cf){return{'model':db[_0x54d9cf[_0xeca9('0x21')]],'as':_0x54d9cf['as'],'attributes':_0x54d9cf[_0xeca9('0x1d')],'include':_0x54d9cf[_0xeca9('0x1f')]?_[_0xeca9('0x20')](_0x54d9cf[_0xeca9('0x1f')],function(_0x1eeb0a){return{'model':db[_0x1eeb0a['model']],'as':_0x1eeb0a['as'],'attributes':_0x1eeb0a[_0xeca9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fbd69){if(_0x3b60c3['options'][_0xeca9('0x25')]===!![])_0x2fbd69[_0xeca9('0x26')]('smtpOptions',_0x2fbd69[_0xeca9('0x27')]());logger['info'](_0xeca9('0x28'),_0x3b60c3);logger['debug'](_0xeca9('0x28'),_0x3b60c3,JSON['stringify'](_0x2fbd69));_0x43fbff(_0x2fbd69);})[_0xeca9('0x29')](function(_0xd6d935){logger['error'](_0xeca9('0x28'),_0xd6d935[_0xeca9('0x18')],_0x3b60c3);_0x23a5fe(_0x5d2451['error'](0x1f4,_0xd6d935[_0xeca9('0x18')]));});});};exports[_0xeca9('0x2a')]=function(_0x3fd0d2){var _0x1a5768=this;return new Promise(function(_0xb1f2fc,_0x2d72e3){var _0x34c502={'body':_0x3fd0d2[_0xeca9('0x2b')],'channel':_0xeca9('0x2c')};var _0x5b1194=_[_0xeca9('0x2d')](_[_0xeca9('0x2e')](db[_0xeca9('0x2f')][_0xeca9('0x30')]),[_0xeca9('0x31'),_0xeca9('0x32'),_0xeca9('0x33'),'ListId']);var _0x1d3338=![];if(_0x3fd0d2[_0xeca9('0x2b')]['id']){delete _0x3fd0d2[_0xeca9('0x2b')]['id'];}if(_[_0xeca9('0x34')](_0x3fd0d2[_0xeca9('0x2b')]['from'])){return _0x2d72e3(_0x1a5768[_0xeca9('0x16')](0x1f4,_0xeca9('0x35')));}if(_[_0xeca9('0x34')](_0x3fd0d2[_0xeca9('0x2b')]['body'])||_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x2b')]===''){return _0x2d72e3(_0x1a5768['error'](0x1f4,_0xeca9('0x36')));}if(_[_0xeca9('0x34')](_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x37')])){return _0x2d72e3(_0x1a5768[_0xeca9('0x16')](0x1f4,_0xeca9('0x38')+_0x5b1194));}if(!_[_0xeca9('0x39')](_0x5b1194,_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x37')])){return _0x2d72e3(_0x1a5768[_0xeca9('0x16')](0x1f4,_0xeca9('0x3a')+_0x5b1194));}var _0x22599e={};_0x22599e[_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x37')]]=_0x3fd0d2[_0xeca9('0x2b')]['from'];return db[_0xeca9('0x24')][_0xeca9('0x3b')]({'where':{'id':_0x3fd0d2[_0xeca9('0x3c')]['id']},'include':[{'model':db[_0xeca9('0x3d')],'as':'List','include':[{'model':db[_0xeca9('0x2f')],'as':_0xeca9('0x3e'),'where':_0x22599e,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xeca9('0x3f')],'as':_0xeca9('0x40')},{'model':db[_0xeca9('0x41')],'as':_0xeca9('0x42'),'include':[{'model':db['CloudProvider'],'as':_0xeca9('0x43')}]}]})[_0xeca9('0x12')](function(_0x346c62){if(_0x346c62&&_0x346c62[_0xeca9('0x44')]){var _0x2b024b=_0x346c62[_0xeca9('0x45')]({'plain':!![]});_0x34c502[_0xeca9('0x3c')]=_[_0xeca9('0x46')](_0x2b024b,[_0xeca9('0x40'),'List']);_0x34c502['account'][_0xeca9('0x47')]=_0x346c62[_0xeca9('0x27')]();_0x34c502['applications']=_0x2b024b[_0xeca9('0x40')];_0x34c502[_0xeca9('0x48')]=_0x2b024b[_0xeca9('0x44')];_0x34c502[_0xeca9('0x49')]=_[_0xeca9('0x4a')](_0x34c502[_0xeca9('0x49')],[_0xeca9('0x4b')],[_0xeca9('0x4c')]);if(_0x34c502[_0xeca9('0x3c')]&&_0x34c502['account']['autoclose']){_0x34c502['applications']['push']({'id':0x0,'priority':_0x34c502[_0xeca9('0x49')]['length']+0x1,'app':_0xeca9('0x4d'),'appdata':_0xeca9('0x4e'),'interval':'*,*,*,*'});}if(_0x34c502[_0xeca9('0x3c')][_0xeca9('0x40')]){delete _0x34c502[_0xeca9('0x3c')]['Applications'];}if(_0x34c502['account'][_0xeca9('0x44')]){delete _0x34c502[_0xeca9('0x3c')][_0xeca9('0x44')];}if(_0x2b024b[_0xeca9('0x44')]['Contacts'][_0xeca9('0x4f')]){return _0x2b024b[_0xeca9('0x44')][_0xeca9('0x3e')][0x0];}var _0x1a046d=_[_0xeca9('0xd')](_0x3fd0d2[_0xeca9('0x2b')],{'firstName':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x50')],'ListId':_0x2b024b[_0xeca9('0x51')]});_0x1a046d[_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x37')]]=_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x50')];return db[_0xeca9('0x2f')][_0xeca9('0x52')](_0x1a046d);}else{throw new Error(_0xeca9('0x53'));}})['then'](function(_0x22d1b9){_0x34c502[_0xeca9('0x54')]=_0x22d1b9;if(_0x22d1b9){if(!_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['messageId']){_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['messageId']=rs[_0xeca9('0x55')]()+'\x20'+_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x50')];}var _0x35be0f={'ContactId':_0x22d1b9['id'],'MailAccountId':_0x3fd0d2['account']['id'],'inReplyTo':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['messageId'],'to':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x50')],'cc':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['cc'],'subject':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x56')],'attach':_0x3fd0d2['body']['message']['attach'],'lastMsgAt':moment()[_0xeca9('0x57')](_0xeca9('0x58')),'lastMsgDirection':'in'};return db[_0xeca9('0x59')]['find']({'where':{'closed':![],'MailAccountId':_0x3fd0d2[_0xeca9('0x3c')]['id']},'include':[{'model':db[_0xeca9('0x5a')],'as':_0xeca9('0x5b'),'attributes':[_0xeca9('0x5c')],'where':{'messageId':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x5d')]}}]})['then'](function(_0x5e1049){if(_0x5e1049){return[_0x5e1049,![]];}return db['MailInteraction'][_0xeca9('0x52')](_0x35be0f)[_0xeca9('0x12')](function(_0x5be034){return[_0x5be034,!![]];});});}else{throw new Error(_0xeca9('0x5e'));}})['spread'](function(_0x33760f,_0x28bbf7){if(_0x33760f){_0x1d3338=_0x28bbf7;if(!_0x28bbf7){return _0x33760f[_0xeca9('0x5f')]({'inReplyTo':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['messageId'],'to':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x50')],'cc':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['cc'],'subject':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x56')],'attach':_0x33760f['attach']?_0x33760f[_0xeca9('0x60')]:_0x3fd0d2['body'][_0xeca9('0x18')][_0xeca9('0x60')],'substatus':null,'substatusAt':moment()[_0xeca9('0x57')](_0xeca9('0x58')),'lastMsgAt':moment()[_0xeca9('0x57')](_0xeca9('0x58')),'lastMsgDirection':'in'});}else{return _0x33760f;}}})['then'](function(_0x1c2821){_0x34c502[_0xeca9('0x61')]=_0x1c2821[_0xeca9('0x45')]({'plain':!![]});_0x34c502['interaction'][_0xeca9('0x62')]=_0x1d3338;return db[_0xeca9('0x5a')][_0xeca9('0x52')]({'body':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x2b')],'MailAccountId':_0x3fd0d2[_0xeca9('0x3c')]['id'],'MailInteractionId':_0x1c2821['id'],'direction':'in','ContactId':_0x34c502[_0xeca9('0x54')]['id'],'messageId':_0x3fd0d2[_0xeca9('0x2b')]['message'][_0xeca9('0x5c')],'from':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x50')],'to':_0x3fd0d2[_0xeca9('0x2b')]['message']['to'],'cc':_0x3fd0d2['body'][_0xeca9('0x18')]['cc'],'subject':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x56')],'attach':_0x3fd0d2['body'][_0xeca9('0x18')][_0xeca9('0x60')],'Attachments':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x63')],'originTo':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x64')],'originCc':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['originCc'],'bcc':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x65')],'ChatWebsiteId':_0x3fd0d2['body']['message']['ChatWebsiteId']||null,'originChannel':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')]['originChannel']||_0xeca9('0x66'),'ChatOfflineMessageId':_0x3fd0d2[_0xeca9('0x2b')][_0xeca9('0x18')][_0xeca9('0x67')]||null},{'include':[{'model':db['Attachment'],'as':_0xeca9('0x68')}]});})[_0xeca9('0x12')](function(_0x48a310){_0x34c502['message']=_0x48a310;if(!_0x34c502['interaction'][_0xeca9('0x69')]){return;}return db[_0xeca9('0x6a')][_0xeca9('0x3b')]({'attributes':['id','name'],'where':{'id':_0x34c502[_0xeca9('0x61')]['UserId']}});})[_0xeca9('0x12')](function(_0xbc11b7){if(_0xbc11b7){_0x34c502[_0xeca9('0x49')][_0xeca9('0x6b')]({'id':0x0,'priority':0x0,'app':_0xeca9('0x6c'),'appdata':_0xbc11b7['name']+','+(_0x34c502[_0xeca9('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xeca9('0x6d')});}if(!_0x34c502['interaction']['queueId']){return;}return db['MailQueue'][_0xeca9('0x3b')]({'attributes':['id','name'],'where':{'id':_0x34c502[_0xeca9('0x61')][_0xeca9('0x6e')]}});})[_0xeca9('0x12')](function(_0x30e115){if(_0x30e115){_0x34c502[_0xeca9('0x49')][_0xeca9('0x6b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x30e115[_0xeca9('0x6f')]+','+(_0x34c502[_0xeca9('0x3c')][_0xeca9('0x70')]||0x12c),'interval':_0xeca9('0x6d')});}return respondWithRpcPromise(_0xeca9('0x71'),_0xeca9('0x72'),_0x34c502);})[_0xeca9('0x12')](function(_0x368128){_0xb1f2fc(_0x368128);})['catch'](function(_0x3bc532){_0x2d72e3(_0x1a5768[_0xeca9('0x16')](0x1f4,_0x3bc532[_0xeca9('0x18')]));});});}; \ No newline at end of file +var _0x2b83=['attributes','include','map','model','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','List','account','omit','smtpOptions','applications','orderBy','priority','asc','autoclose','push','close','*,*,*,*','Contacts','defaults','create','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','format','interaction','attachments','originCc','ChatWebsiteId','Email','ChatOfflineMessageId','User','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','name','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where'];(function(_0x170d06,_0x351221){var _0x3393de=function(_0x4edb56){while(--_0x4edb56){_0x170d06['push'](_0x170d06['shift']());}};_0x3393de(++_0x351221);}(_0x2b83,0x1d3));var _0x32b8=function(_0x57bcd6,_0xa2551b){_0x57bcd6=_0x57bcd6-0x0;var _0x210b71=_0x2b83[_0x57bcd6];return _0x210b71;};'use strict';var _=require('lodash');var moment=require(_0x32b8('0x0'));var BPromise=require(_0x32b8('0x1'));var rs=require('randomstring');var Redis=require(_0x32b8('0x2'));var db=require(_0x32b8('0x3'))['db'];var logger=require(_0x32b8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x32b8('0x5'));var client=jayson[_0x32b8('0x6')]['http']({'port':0x232c});config[_0x32b8('0x7')]=_['defaults'](config[_0x32b8('0x7')],{'host':_0x32b8('0x8'),'port':0x18eb});var socket=require(_0x32b8('0x9'))(new Redis(config[_0x32b8('0x7')]));require('./mailAccount.socket')[_0x32b8('0xa')](socket);function respondWithRpcPromise(_0x2c9e57,_0x48257a,_0x4f2aa0){return new BPromise(function(_0x3f58a5,_0x5ecf4e){return client[_0x32b8('0xb')](_0x2c9e57,_0x4f2aa0)[_0x32b8('0xc')](function(_0x465672){logger[_0x32b8('0xd')]('MailAccount,\x20%s,\x20%s',_0x48257a,_0x32b8('0xe'));logger[_0x32b8('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48257a,'request\x20sent',JSON[_0x32b8('0x10')](_0x465672));if(_0x465672['error']){if(_0x465672[_0x32b8('0x11')]['code']===0x1f4){logger[_0x32b8('0x11')](_0x32b8('0x12'),_0x48257a,_0x465672[_0x32b8('0x11')][_0x32b8('0x13')]);return _0x5ecf4e(_0x465672[_0x32b8('0x11')]['message']);}logger['error'](_0x32b8('0x12'),_0x48257a,_0x465672['error']['message']);return _0x3f58a5(_0x465672['error'][_0x32b8('0x13')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x48257a,_0x32b8('0xe'));_0x3f58a5(_0x465672[_0x32b8('0x14')][_0x32b8('0x13')]);}})[_0x32b8('0x15')](function(_0x599bc3){logger['error']('MailAccount,\x20%s,\x20%s',_0x48257a,_0x599bc3);_0x5ecf4e(_0x599bc3);});});}exports[_0x32b8('0x16')]=function(_0x2ffea2){var _0x748394=this;return new Promise(function(_0x445da1,_0x4c6077){return db[_0x32b8('0x17')][_0x32b8('0x18')]({'raw':_0x2ffea2[_0x32b8('0x19')]?_0x2ffea2[_0x32b8('0x19')][_0x32b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ffea2[_0x32b8('0x19')]?_0x2ffea2[_0x32b8('0x19')][_0x32b8('0x1b')]||null:null,'attributes':_0x2ffea2['options']?_0x2ffea2['options'][_0x32b8('0x1c')]||null:null,'limit':_0x2ffea2['options']?_0x2ffea2[_0x32b8('0x19')]['limit']||null:null,'include':_0x2ffea2[_0x32b8('0x19')]?_0x2ffea2[_0x32b8('0x19')][_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x2ffea2[_0x32b8('0x19')]['include'],function(_0x4e1360){return{'model':db[_0x4e1360[_0x32b8('0x1f')]],'as':_0x4e1360['as'],'attributes':_0x4e1360[_0x32b8('0x1c')],'include':_0x4e1360[_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x4e1360[_0x32b8('0x1d')],function(_0x57a6a3){return{'model':db[_0x57a6a3[_0x32b8('0x1f')]],'as':_0x57a6a3['as'],'attributes':_0x57a6a3[_0x32b8('0x1c')],'include':_0x57a6a3[_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x57a6a3[_0x32b8('0x1d')],function(_0x17dd70){return{'model':db[_0x17dd70[_0x32b8('0x1f')]],'as':_0x17dd70['as'],'attributes':_0x17dd70[_0x32b8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32b8('0xc')](function(_0xa225ec){logger[_0x32b8('0xd')](_0x32b8('0x16'),_0x2ffea2);logger[_0x32b8('0xf')]('GetMailAccount',_0x2ffea2,JSON[_0x32b8('0x10')](_0xa225ec));_0x445da1(_0xa225ec);})[_0x32b8('0x15')](function(_0x383b0e){logger[_0x32b8('0x11')](_0x32b8('0x16'),_0x383b0e[_0x32b8('0x13')],_0x2ffea2);_0x4c6077(_0x748394[_0x32b8('0x11')](0x1f4,_0x383b0e[_0x32b8('0x13')]));});});};exports[_0x32b8('0x20')]=function(_0x15f152){var _0x521bf4=this;return new Promise(function(_0x1833af,_0x3c1122){return db[_0x32b8('0x17')][_0x32b8('0x21')]({'raw':_0x15f152['options']?_0x15f152['options'][_0x32b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x15f152[_0x32b8('0x19')]?_0x15f152[_0x32b8('0x19')][_0x32b8('0x1b')]||null:null,'attributes':_0x15f152['options']?_0x15f152[_0x32b8('0x19')][_0x32b8('0x1c')]||null:null,'include':_0x15f152[_0x32b8('0x19')]?_0x15f152[_0x32b8('0x19')][_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x15f152[_0x32b8('0x19')][_0x32b8('0x1d')],function(_0x591ba8){return{'model':db[_0x591ba8[_0x32b8('0x1f')]],'as':_0x591ba8['as'],'attributes':_0x591ba8['attributes'],'include':_0x591ba8[_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x591ba8[_0x32b8('0x1d')],function(_0xc5fa8b){return{'model':db[_0xc5fa8b[_0x32b8('0x1f')]],'as':_0xc5fa8b['as'],'attributes':_0xc5fa8b[_0x32b8('0x1c')],'include':_0xc5fa8b['include']?_[_0x32b8('0x1e')](_0xc5fa8b[_0x32b8('0x1d')],function(_0x7e13a9){return{'model':db[_0x7e13a9['model']],'as':_0x7e13a9['as'],'attributes':_0x7e13a9[_0x32b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449f52){if(_0x15f152[_0x32b8('0x19')][_0x32b8('0x22')]===!![])_0x449f52[_0x32b8('0x23')]('smtpOptions',_0x449f52[_0x32b8('0x24')]());logger[_0x32b8('0xd')](_0x32b8('0x20'),_0x15f152);logger['debug']('ShowMailAccount',_0x15f152,JSON[_0x32b8('0x10')](_0x449f52));_0x1833af(_0x449f52);})[_0x32b8('0x15')](function(_0x117a08){logger['error']('ShowMailAccount',_0x117a08['message'],_0x15f152);_0x3c1122(_0x521bf4[_0x32b8('0x11')](0x1f4,_0x117a08[_0x32b8('0x13')]));});});};exports[_0x32b8('0x25')]=function(_0x544fe5){var _0x305428=this;return new Promise(function(_0x14c109,_0x895b74){var _0x273d5f={'body':_0x544fe5[_0x32b8('0x26')],'channel':_0x32b8('0x27')};var _0x8dd996=_[_0x32b8('0x28')](_['keys'](db[_0x32b8('0x29')]['rawAttributes']),['createdAt','updatedAt','CompanyId',_0x32b8('0x2a')]);var _0x50e6e3=![];if(_0x544fe5[_0x32b8('0x26')]['id']){delete _0x544fe5['body']['id'];}if(_['isNil'](_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2b')])){return _0x895b74(_0x305428[_0x32b8('0x11')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x32b8('0x2c')](_0x544fe5[_0x32b8('0x26')][_0x32b8('0x26')])||_0x544fe5['body']['body']===''){return _0x895b74(_0x305428[_0x32b8('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x32b8('0x2c')](_0x544fe5['body'][_0x32b8('0x2d')])){return _0x895b74(_0x305428['error'](0x1f4,_0x32b8('0x2e')+_0x8dd996));}if(!_[_0x32b8('0x2f')](_0x8dd996,_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2d')])){return _0x895b74(_0x305428['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x8dd996));}var _0x923049={};_0x923049[_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2d')]]=_0x544fe5['body']['from'];return db[_0x32b8('0x17')][_0x32b8('0x21')]({'where':{'id':_0x544fe5['account']['id']},'include':[{'model':db[_0x32b8('0x30')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x923049,'limit':0x1,'order':[[_0x32b8('0x31'),_0x32b8('0x32')]]}]},{'model':db[_0x32b8('0x33')],'as':_0x32b8('0x34')},{'model':db['MailServerOut'],'as':_0x32b8('0x35'),'include':[{'model':db[_0x32b8('0x36')],'as':_0x32b8('0x36')}]}]})[_0x32b8('0xc')](function(_0x1a5bd4){if(_0x1a5bd4&&_0x1a5bd4[_0x32b8('0x37')]){var _0x25a2a8=_0x1a5bd4['get']({'plain':!![]});_0x273d5f[_0x32b8('0x38')]=_[_0x32b8('0x39')](_0x25a2a8,[_0x32b8('0x34'),_0x32b8('0x37')]);_0x273d5f[_0x32b8('0x38')][_0x32b8('0x3a')]=_0x1a5bd4[_0x32b8('0x24')]();_0x273d5f[_0x32b8('0x3b')]=_0x25a2a8[_0x32b8('0x34')];_0x273d5f['list']=_0x25a2a8['List'];_0x273d5f[_0x32b8('0x3b')]=_[_0x32b8('0x3c')](_0x273d5f[_0x32b8('0x3b')],[_0x32b8('0x3d')],[_0x32b8('0x3e')]);if(_0x273d5f[_0x32b8('0x38')]&&_0x273d5f['account'][_0x32b8('0x3f')]){_0x273d5f[_0x32b8('0x3b')][_0x32b8('0x40')]({'id':0x0,'priority':_0x273d5f[_0x32b8('0x3b')]['length']+0x1,'app':_0x32b8('0x41'),'appdata':_0x32b8('0x3f'),'interval':_0x32b8('0x42')});}if(_0x273d5f['account'][_0x32b8('0x34')]){delete _0x273d5f[_0x32b8('0x38')][_0x32b8('0x34')];}if(_0x273d5f[_0x32b8('0x38')][_0x32b8('0x37')]){delete _0x273d5f[_0x32b8('0x38')][_0x32b8('0x37')];}if(_0x25a2a8['List'][_0x32b8('0x43')]['length']){return _0x25a2a8['List'][_0x32b8('0x43')][0x0];}var _0x2d458e=_[_0x32b8('0x44')](_0x544fe5[_0x32b8('0x26')],{'firstName':_0x544fe5[_0x32b8('0x26')]['from'],'ListId':_0x25a2a8[_0x32b8('0x2a')]});_0x2d458e[_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2d')]]=_0x544fe5['body'][_0x32b8('0x2b')];return db[_0x32b8('0x29')][_0x32b8('0x45')](_0x2d458e);}else{throw new Error('List\x20not\x20found');}})[_0x32b8('0xc')](function(_0x531b62){_0x273d5f[_0x32b8('0x46')]=_0x531b62;if(_0x531b62){if(!_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x47')]){_0x544fe5['body'][_0x32b8('0x13')]['messageId']=rs[_0x32b8('0x48')]()+'\x20'+_0x544fe5['body']['message']['from'];}var _0x1618db={'ContactId':_0x531b62['id'],'MailAccountId':_0x544fe5[_0x32b8('0x38')]['id'],'inReplyTo':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['messageId'],'to':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x2b')],'cc':_0x544fe5[_0x32b8('0x26')]['message']['cc'],'subject':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x49')],'attach':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x4a')],'lastMsgAt':moment()['format'](_0x32b8('0x4b')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x544fe5[_0x32b8('0x38')]['id']},'include':[{'model':db[_0x32b8('0x4c')],'as':_0x32b8('0x4d'),'attributes':['messageId'],'where':{'messageId':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x4e')]}}]})[_0x32b8('0xc')](function(_0x419969){if(_0x419969){return[_0x419969,![]];}return db[_0x32b8('0x4f')][_0x32b8('0x45')](_0x1618db)[_0x32b8('0xc')](function(_0x13c351){return[_0x13c351,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x32b8('0x50')](function(_0x3ff3ad,_0x5a1e0a){if(_0x3ff3ad){_0x50e6e3=_0x5a1e0a;if(!_0x5a1e0a){return _0x3ff3ad[_0x32b8('0x51')]({'inReplyTo':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x47')],'to':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x2b')],'cc':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['cc'],'subject':_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x49')],'attach':_0x3ff3ad['attach']?_0x3ff3ad[_0x32b8('0x4a')]:_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x4a')],'substatus':null,'substatusAt':moment()[_0x32b8('0x52')](_0x32b8('0x4b')),'lastMsgAt':moment()[_0x32b8('0x52')](_0x32b8('0x4b')),'lastMsgDirection':'in'});}else{return _0x3ff3ad;}}})[_0x32b8('0xc')](function(_0x8310c7){_0x273d5f['interaction']=_0x8310c7['get']({'plain':!![]});_0x273d5f[_0x32b8('0x53')]['created']=_0x50e6e3;return db[_0x32b8('0x4c')][_0x32b8('0x45')]({'body':_0x544fe5[_0x32b8('0x26')]['body'],'MailAccountId':_0x544fe5[_0x32b8('0x38')]['id'],'MailInteractionId':_0x8310c7['id'],'direction':'in','ContactId':_0x273d5f[_0x32b8('0x46')]['id'],'messageId':_0x544fe5['body'][_0x32b8('0x13')]['messageId'],'from':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x2b')],'to':_0x544fe5[_0x32b8('0x26')]['message']['to'],'cc':_0x544fe5[_0x32b8('0x26')]['message']['cc'],'subject':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['subject'],'attach':_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x4a')],'Attachments':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x54')],'originTo':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['originTo'],'originCc':_0x544fe5[_0x32b8('0x26')]['message'][_0x32b8('0x55')],'bcc':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['bcc'],'ChatWebsiteId':_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x56')]||null,'originChannel':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['originChannel']||_0x32b8('0x57'),'ChatOfflineMessageId':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x58')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32b8('0xc')](function(_0x5bc582){_0x273d5f[_0x32b8('0x13')]=_0x5bc582;if(!_0x273d5f[_0x32b8('0x53')]['UserId']){return;}return db[_0x32b8('0x59')][_0x32b8('0x21')]({'attributes':['id','name'],'where':{'id':_0x273d5f[_0x32b8('0x53')]['UserId']}});})[_0x32b8('0xc')](function(_0x41dd0e){if(_0x41dd0e){_0x273d5f[_0x32b8('0x3b')][_0x32b8('0x5a')]({'id':0x0,'priority':0x0,'app':_0x32b8('0x5b'),'appdata':_0x41dd0e['name']+','+(_0x273d5f[_0x32b8('0x38')][_0x32b8('0x5c')]||0xa),'interval':_0x32b8('0x42')});}if(!_0x273d5f[_0x32b8('0x53')][_0x32b8('0x5d')]){return;}return db[_0x32b8('0x5e')][_0x32b8('0x21')]({'attributes':['id',_0x32b8('0x5f')],'where':{'id':_0x273d5f['interaction'][_0x32b8('0x5d')]}});})['then'](function(_0x238c22){if(_0x238c22){_0x273d5f['applications'][_0x32b8('0x5a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x238c22['name']+','+(_0x273d5f[_0x32b8('0x38')][_0x32b8('0x60')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32b8('0x61'),_0x32b8('0x62'),_0x273d5f);})[_0x32b8('0xc')](function(_0x315a32){_0x14c109(_0x315a32);})['catch'](function(_0x180000){_0x895b74(_0x305428[_0x32b8('0x11')](0x1f4,_0x180000['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 840772b..f167e14 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 _0x2e4c=['remove','update','emit','removeListener','register','length','mailAccount:','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2e4c,0x1df));var _0xc2e4=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x2e4c[_0x13b330];return _0x1f666c;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xc2e4('0x0'),_0xc2e4('0x1'),_0xc2e4('0x2')];function createListener(_0x1b54f,_0x203088){return function(_0x21d1ad){_0x203088[_0xc2e4('0x3')](_0x1b54f,_0x21d1ad);};}function removeListener(_0x11cd9e,_0x554b4c){return function(){MailAccountEvents[_0xc2e4('0x4')](_0x11cd9e,_0x554b4c);};}exports[_0xc2e4('0x5')]=function(_0x6b26d0){for(var _0x2e234f=0x0,_0x1251f8=events[_0xc2e4('0x6')];_0x2e234f<_0x1251f8;_0x2e234f++){var _0x25a2b3=events[_0x2e234f];var _0x90f831=createListener(_0xc2e4('0x7')+_0x25a2b3,_0x6b26d0);MailAccountEvents['on'](_0x25a2b3,_0x90f831);}}; \ No newline at end of file +var _0x5665=['removeListener','mailAccount:','./mailAccount.events','remove','emit'];(function(_0x5dcd6a,_0x484a00){var _0x135b5e=function(_0x5541d3){while(--_0x5541d3){_0x5dcd6a['push'](_0x5dcd6a['shift']());}};_0x135b5e(++_0x484a00);}(_0x5665,0x183));var _0x5566=function(_0x547698,_0x2c177a){_0x547698=_0x547698-0x0;var _0x15fd16=_0x5665[_0x547698];return _0x15fd16;};'use strict';var MailAccountEvents=require(_0x5566('0x0'));var events=['save',_0x5566('0x1'),'update'];function createListener(_0x999bd1,_0x16e638){return function(_0x28c30c){_0x16e638[_0x5566('0x2')](_0x999bd1,_0x28c30c);};}function removeListener(_0x2a76,_0x5ee65c){return function(){MailAccountEvents[_0x5566('0x3')](_0x2a76,_0x5ee65c);};}exports['register']=function(_0x1509d7){for(var _0x59c1af=0x0,_0x36ad47=events['length'];_0x59c1af<_0x36ad47;_0x59c1af++){var _0x11ef4d=events[_0x59c1af];var _0x220770=createListener(_0x5566('0x4')+_0x11ef4d,_0x1509d7);MailAccountEvents['on'](_0x11ef4d,_0x220770);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0fb10ab..b21310c 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 _0xc471=['show','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailApplication.controller','isAuthenticated'];(function(_0x2d6e34,_0x30f14c){var _0x387c77=function(_0xb46d1c){while(--_0xb46d1c){_0x2d6e34['push'](_0x2d6e34['shift']());}};_0x387c77(++_0x30f14c);}(_0xc471,0xfd));var _0x1c47=function(_0xf32982,_0x300c2b){_0xf32982=_0xf32982-0x0;var _0x53b3ce=_0xc471[_0xf32982];return _0x53b3ce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c47('0x0'));var timeout=require(_0x1c47('0x1'));var express=require(_0x1c47('0x2'));var router=express['Router']();var fs_extra=require(_0x1c47('0x3'));var auth=require(_0x1c47('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1c47('0x5'));router['get']('/:id',auth[_0x1c47('0x6')](),controller[_0x1c47('0x7')]);router['put'](_0x1c47('0x8'),auth[_0x1c47('0x6')](),controller[_0x1c47('0x9')]);router[_0x1c47('0xa')](_0x1c47('0x8'),auth['isAuthenticated'](),controller[_0x1c47('0xb')]);module[_0x1c47('0xc')]=router; \ No newline at end of file +var _0x4982=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put','/:id','destroy','multer','util','connect-timeout'];(function(_0xf26e77,_0x429091){var _0x3256fe=function(_0x3e6a51){while(--_0x3e6a51){_0xf26e77['push'](_0xf26e77['shift']());}};_0x3256fe(++_0x429091);}(_0x4982,0x66));var _0x2498=function(_0x421fa9,_0x5da593){_0x421fa9=_0x421fa9-0x0;var _0x366b27=_0x4982[_0x421fa9];return _0x366b27;};'use strict';var multer=require(_0x2498('0x0'));var util=require(_0x2498('0x1'));var path=require('path');var timeout=require(_0x2498('0x2'));var express=require(_0x2498('0x3'));var router=express[_0x2498('0x4')]();var fs_extra=require(_0x2498('0x5'));var auth=require(_0x2498('0x6'));var interaction=require(_0x2498('0x7'));var config=require(_0x2498('0x8'));var controller=require(_0x2498('0x9'));router[_0x2498('0xa')]('/:id',auth[_0x2498('0xb')](),controller['show']);router[_0x2498('0xc')]('/:id',auth[_0x2498('0xb')](),controller['update']);router['delete'](_0x2498('0xd'),auth[_0x2498('0xb')](),controller[_0x2498('0xe')]);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 ed176ea..344e46c 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 _0x7286=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x39fb09,_0x4f0fc6){var _0x31aa84=function(_0x45312a){while(--_0x45312a){_0x39fb09['push'](_0x39fb09['shift']());}};_0x31aa84(++_0x4f0fc6);}(_0x7286,0xa3));var _0x6728=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7286[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require('sequelize');module[_0x6728('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6728('0x1')],'allowNull':![],'defaultValue':_0x6728('0x2')},'appdata':{'type':Sequelize[_0x6728('0x3')]()},'description':{'type':Sequelize[_0x6728('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6728('0x4')}}; \ No newline at end of file +var _0xfdc7=['TEXT','STRING','*,*,*,*','sequelize','noop'];(function(_0xc2dccb,_0x5957f2){var _0x3239b3=function(_0x58f337){while(--_0x58f337){_0xc2dccb['push'](_0xc2dccb['shift']());}};_0x3239b3(++_0x5957f2);}(_0xfdc7,0x99));var _0x7fdc=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xfdc7[_0x55ff3e];return _0x2709eb;};'use strict';var Sequelize=require(_0x7fdc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7fdc('0x1')},'appdata':{'type':Sequelize[_0x7fdc('0x2')]()},'description':{'type':Sequelize[_0x7fdc('0x3')]},'interval':{'type':Sequelize[_0x7fdc('0x3')],'defaultValue':_0x7fdc('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 08d8736..7884008 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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2d7676,_0x1a4420){var _0x38d992=function(_0x3652d6){while(--_0x3652d6){_0x2d7676['push'](_0x2d7676['shift']());}};_0x38d992(++_0x1a4420);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2e1f2c,_0x1524e0){var _0x1e5a28=function(_0x1ae334){while(--_0x1ae334){_0x2e1f2c['push'](_0x2e1f2c['shift']());}};_0x1e5a28(++_0x1524e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index bdcd5ad..40b741e 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 _0x6f29=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','./mailApplication.attributes'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x6f29,0xf6));var _0x96f2=function(_0x40889c,_0x73e154){_0x40889c=_0x40889c-0x0;var _0x1e69a3=_0x6f29[_0x40889c];return _0x1e69a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x96f2('0x0'))(_0x96f2('0x1'));var moment=require(_0x96f2('0x2'));var BPromise=require(_0x96f2('0x3'));var rp=require(_0x96f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x96f2('0x5'));module[_0x96f2('0x6')]=function(_0x444a1c,_0x5a30ae){return _0x444a1c[_0x96f2('0x7')](_0x96f2('0x8'),attributes,{'tableName':_0x96f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96f2('0xa'),'collate':_0x96f2('0xb')});}; \ No newline at end of file +var _0xba7d=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba7d,0x1db));var _0xdba7=function(_0x398a71,_0x343ef0){_0x398a71=_0x398a71-0x0;var _0x2c0eed=_0xba7d[_0x398a71];return _0x2c0eed;};'use strict';var _=require(_0xdba7('0x0'));var util=require(_0xdba7('0x1'));var logger=require(_0xdba7('0x2'))(_0xdba7('0x3'));var moment=require(_0xdba7('0x4'));var BPromise=require(_0xdba7('0x5'));var rp=require(_0xdba7('0x6'));var fs=require('fs');var path=require(_0xdba7('0x7'));var rimraf=require(_0xdba7('0x8'));var config=require(_0xdba7('0x9'));var attributes=require(_0xdba7('0xa'));module['exports']=function(_0x33e608,_0x5b528d){return _0x33e608[_0xdba7('0xb')](_0xdba7('0xc'),attributes,{'tableName':_0xdba7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdba7('0xe'),'collate':_0xdba7('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 2cdb238..ebe77e6 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 _0xfc20=['message','result','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x31151e,_0x5c2f99){var _0xf4ebda=function(_0x21e7df){while(--_0x21e7df){_0x31151e['push'](_0x31151e['shift']());}};_0xf4ebda(++_0x5c2f99);}(_0xfc20,0x1cc));var _0x0fc2=function(_0x28d777,_0x49588c){_0x28d777=_0x28d777-0x0;var _0x3d7f06=_0xfc20[_0x28d777];return _0x3d7f06;};'use strict';var _=require(_0x0fc2('0x0'));var util=require(_0x0fc2('0x1'));var moment=require(_0x0fc2('0x2'));var BPromise=require(_0x0fc2('0x3'));var rs=require(_0x0fc2('0x4'));var fs=require('fs');var Redis=require(_0x0fc2('0x5'));var db=require(_0x0fc2('0x6'))['db'];var utils=require(_0x0fc2('0x7'));var logger=require(_0x0fc2('0x8'))(_0x0fc2('0x9'));var config=require(_0x0fc2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0fc2('0xb')][_0x0fc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53f549,_0x31fb4b,_0x1ec6dd){return new BPromise(function(_0x1648e3,_0x45efbe){return client[_0x0fc2('0xd')](_0x53f549,_0x1ec6dd)['then'](function(_0x186943){logger[_0x0fc2('0xe')](_0x0fc2('0xf'),_0x31fb4b,_0x0fc2('0x10'));logger[_0x0fc2('0x11')](_0x0fc2('0x12'),_0x31fb4b,'request\x20sent',JSON['stringify'](_0x186943));if(_0x186943[_0x0fc2('0x13')]){if(_0x186943[_0x0fc2('0x13')]['code']===0x1f4){logger['error'](_0x0fc2('0xf'),_0x31fb4b,_0x186943[_0x0fc2('0x13')]['message']);return _0x45efbe(_0x186943['error']['message']);}logger[_0x0fc2('0x13')](_0x0fc2('0xf'),_0x31fb4b,_0x186943[_0x0fc2('0x13')][_0x0fc2('0x14')]);return _0x1648e3(_0x186943[_0x0fc2('0x13')][_0x0fc2('0x14')]);}else{logger[_0x0fc2('0xe')](_0x0fc2('0xf'),_0x31fb4b,_0x0fc2('0x10'));_0x1648e3(_0x186943[_0x0fc2('0x15')][_0x0fc2('0x14')]);}})[_0x0fc2('0x16')](function(_0xe8a38){logger['error'](_0x0fc2('0xf'),_0x31fb4b,_0xe8a38);_0x45efbe(_0xe8a38);});});}exports[_0x0fc2('0x17')]=function(_0x3d0c15){var _0x41bbad=this;return new Promise(function(_0x21b690,_0xa03177){return db[_0x0fc2('0x18')]['update'](_0x3d0c15[_0x0fc2('0x19')],{'raw':_0x3d0c15['options']?_0x3d0c15[_0x0fc2('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d0c15[_0x0fc2('0x1a')]?_0x3d0c15['options'][_0x0fc2('0x1b')]||null:null,'attributes':_0x3d0c15[_0x0fc2('0x1a')]?_0x3d0c15[_0x0fc2('0x1a')][_0x0fc2('0x1c')]||null:null,'limit':_0x3d0c15[_0x0fc2('0x1a')]?_0x3d0c15[_0x0fc2('0x1a')]['limit']||null:null})[_0x0fc2('0x1d')](function(_0x11e722){logger[_0x0fc2('0xe')]('UpdateMailApplication',_0x3d0c15);logger[_0x0fc2('0x11')](_0x0fc2('0x17'),_0x3d0c15,JSON['stringify'](_0x11e722));_0x21b690(_0x11e722);})[_0x0fc2('0x16')](function(_0xc9c0ec){logger[_0x0fc2('0x13')](_0x0fc2('0x17'),_0xc9c0ec[_0x0fc2('0x14')],_0x3d0c15);_0xa03177(_0x41bbad[_0x0fc2('0x13')](0x1f4,_0xc9c0ec[_0x0fc2('0x14')]));});});}; \ No newline at end of file +var _0x264a=['UpdateMailApplication','MailApplication','body','options','raw','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result'];(function(_0x5ec95a,_0x344b14){var _0x504fb7=function(_0x58aefc){while(--_0x58aefc){_0x5ec95a['push'](_0x5ec95a['shift']());}};_0x504fb7(++_0x344b14);}(_0x264a,0x1e6));var _0xa264=function(_0x3014fe,_0xe7fe68){_0x3014fe=_0x3014fe-0x0;var _0x67b54d=_0x264a[_0x3014fe];return _0x67b54d;};'use strict';var _=require(_0xa264('0x0'));var util=require(_0xa264('0x1'));var moment=require(_0xa264('0x2'));var BPromise=require(_0xa264('0x3'));var rs=require(_0xa264('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa264('0x5'))['db'];var utils=require(_0xa264('0x6'));var logger=require(_0xa264('0x7'))(_0xa264('0x8'));var config=require(_0xa264('0x9'));var jayson=require(_0xa264('0xa'));var client=jayson[_0xa264('0xb')][_0xa264('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422d05,_0x42d270,_0x2b88bd){return new BPromise(function(_0x1b403c,_0x383781){return client[_0xa264('0xd')](_0x422d05,_0x2b88bd)[_0xa264('0xe')](function(_0x572dd7){logger[_0xa264('0xf')]('MailApplication,\x20%s,\x20%s',_0x42d270,'request\x20sent');logger[_0xa264('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x42d270,_0xa264('0x11'),JSON[_0xa264('0x12')](_0x572dd7));if(_0x572dd7[_0xa264('0x13')]){if(_0x572dd7['error'][_0xa264('0x14')]===0x1f4){logger[_0xa264('0x13')](_0xa264('0x15'),_0x42d270,_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);return _0x383781(_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);}logger[_0xa264('0x13')](_0xa264('0x15'),_0x42d270,_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);return _0x1b403c(_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);}else{logger[_0xa264('0xf')](_0xa264('0x15'),_0x42d270,'request\x20sent');_0x1b403c(_0x572dd7[_0xa264('0x17')]['message']);}})['catch'](function(_0x3889a2){logger[_0xa264('0x13')](_0xa264('0x15'),_0x42d270,_0x3889a2);_0x383781(_0x3889a2);});});}exports[_0xa264('0x18')]=function(_0x3efb00){var _0x437162=this;return new Promise(function(_0x5c28b9,_0xa1d68a){return db[_0xa264('0x19')]['update'](_0x3efb00[_0xa264('0x1a')],{'raw':_0x3efb00[_0xa264('0x1b')]?_0x3efb00['options'][_0xa264('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efb00[_0xa264('0x1b')]?_0x3efb00[_0xa264('0x1b')]['where']||null:null,'attributes':_0x3efb00[_0xa264('0x1b')]?_0x3efb00[_0xa264('0x1b')]['attributes']||null:null,'limit':_0x3efb00[_0xa264('0x1b')]?_0x3efb00[_0xa264('0x1b')][_0xa264('0x1d')]||null:null})[_0xa264('0xe')](function(_0x57ec47){logger[_0xa264('0xf')](_0xa264('0x18'),_0x3efb00);logger['debug'](_0xa264('0x18'),_0x3efb00,JSON[_0xa264('0x12')](_0x57ec47));_0x5c28b9(_0x57ec47);})['catch'](function(_0x2a2922){logger['error']('UpdateMailApplication',_0x2a2922[_0xa264('0x16')],_0x3efb00);_0xa1d68a(_0x437162[_0xa264('0x13')](0x1f4,_0x2a2922[_0xa264('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5463f4e..1652260 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 _0xbccf=['mail','put','mailinteraction:update','delete','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','get','/describe','describe','/:id','getMessages','/:id/download','isAuthenticated','create','post','/:id/messages','/:id/tags','tracked'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0xbccf,0x117));var _0xfbcc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xbccf[_0x543084];return _0x306a57;};'use strict';var express=require(_0xfbcc('0x0'));var router=express['Router']();var auth=require(_0xfbcc('0x1'));var interaction=require(_0xfbcc('0x2'));var controller=require('./mailInteraction.controller');router[_0xfbcc('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbcc('0x3')](_0xfbcc('0x4'),auth['isAuthenticated'](),controller[_0xfbcc('0x5')]);router[_0xfbcc('0x3')](_0xfbcc('0x6'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xfbcc('0x7')]);router[_0xfbcc('0x3')](_0xfbcc('0x8'),auth[_0xfbcc('0x9')](),controller['download']);router['post']('/',auth[_0xfbcc('0x9')](),controller[_0xfbcc('0xa')]);router[_0xfbcc('0xb')](_0xfbcc('0xc'),auth[_0xfbcc('0x9')](),controller['addMessage']);router[_0xfbcc('0xb')](_0xfbcc('0xd'),auth[_0xfbcc('0x9')](),interaction[_0xfbcc('0xe')](_0xfbcc('0xf'),'mailinteraction:addtags'),controller['addTags']);router[_0xfbcc('0x10')](_0xfbcc('0x6'),auth[_0xfbcc('0x9')](),interaction[_0xfbcc('0xe')](_0xfbcc('0xf'),_0xfbcc('0x11')),controller['update']);router[_0xfbcc('0x12')](_0xfbcc('0x6'),auth[_0xfbcc('0x9')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0xfbcc('0x13')]);router[_0xfbcc('0x12')](_0xfbcc('0xd'),auth[_0xfbcc('0x9')](),controller[_0xfbcc('0x14')]);module['exports']=router; \ No newline at end of file +var _0xfa68=['/:id/download','post','/:id/tags','tracked','mail','addTags','put','/:id','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages'];(function(_0x5bb149,_0x456cdc){var _0x1c85f5=function(_0x3c0645){while(--_0x3c0645){_0x5bb149['push'](_0x5bb149['shift']());}};_0x1c85f5(++_0x456cdc);}(_0xfa68,0x86));var _0x8fa6=function(_0x24c246,_0x3f0c88){_0x24c246=_0x24c246-0x0;var _0x3d6517=_0xfa68[_0x24c246];return _0x3d6517;};'use strict';var express=require(_0x8fa6('0x0'));var router=express[_0x8fa6('0x1')]();var auth=require(_0x8fa6('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x8fa6('0x3'));router[_0x8fa6('0x4')]('/',auth[_0x8fa6('0x5')](),controller['index']);router[_0x8fa6('0x4')](_0x8fa6('0x6'),auth[_0x8fa6('0x5')](),controller[_0x8fa6('0x7')]);router[_0x8fa6('0x4')]('/:id',auth[_0x8fa6('0x5')](),controller[_0x8fa6('0x8')]);router['get'](_0x8fa6('0x9'),auth[_0x8fa6('0x5')](),controller['getMessages']);router['get'](_0x8fa6('0xa'),auth[_0x8fa6('0x5')](),controller['download']);router[_0x8fa6('0xb')]('/',auth[_0x8fa6('0x5')](),controller['create']);router['post'](_0x8fa6('0x9'),auth[_0x8fa6('0x5')](),controller['addMessage']);router[_0x8fa6('0xb')](_0x8fa6('0xc'),auth['isAuthenticated'](),interaction[_0x8fa6('0xd')](_0x8fa6('0xe'),'mailinteraction:addtags'),controller[_0x8fa6('0xf')]);router[_0x8fa6('0x10')](_0x8fa6('0x11'),auth[_0x8fa6('0x5')](),interaction[_0x8fa6('0xd')]('mail','mailinteraction:update'),controller[_0x8fa6('0x12')]);router['delete'](_0x8fa6('0x11'),auth[_0x8fa6('0x5')](),interaction[_0x8fa6('0xd')]('mail',_0x8fa6('0x13')),controller[_0x8fa6('0x14')]);router[_0x8fa6('0x15')]('/:id/tags',auth[_0x8fa6('0x5')](),controller[_0x8fa6('0x16')]);module[_0x8fa6('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f78e7b8..de5c938 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 _0x5b26=['out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x5b17b4,_0x5a3221){var _0x55af79=function(_0x888225){while(--_0x888225){_0x5b17b4['push'](_0x5b17b4['shift']());}};_0x55af79(++_0x5a3221);}(_0x5b26,0xa2));var _0x65b2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5b26[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x65b2('0x0'));var iconv=require(_0x65b2('0x1'));module[_0x65b2('0x2')]={'closed':{'type':Sequelize[_0x65b2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x65b2('0x4')]},'disposition':{'type':Sequelize[_0x65b2('0x5')]},'secondDisposition':{'type':Sequelize[_0x65b2('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x65b2('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x65b2('0x6')]('long')},'subject':{'type':Sequelize[_0x65b2('0x6')]()},'attach':{'type':Sequelize[_0x65b2('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x65b2('0x4')]},'substatus':{'type':Sequelize[_0x65b2('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x65b2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x65b2('0x7')]('in',_0x65b2('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x65b2('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x65b2('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x65b2('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x65b2('0x9')]}}; \ No newline at end of file +var _0x5c60=['iconv','exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out','INTEGER'];(function(_0xcbc60d,_0x2e604a){var _0x102149=function(_0x3c0991){while(--_0x3c0991){_0xcbc60d['push'](_0xcbc60d['shift']());}};_0x102149(++_0x2e604a);}(_0x5c60,0xb4));var _0x05c6=function(_0x194b87,_0x445891){_0x194b87=_0x194b87-0x0;var _0x47f6ba=_0x5c60[_0x194b87];return _0x47f6ba;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x05c6('0x0'));module[_0x05c6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05c6('0x2')]},'disposition':{'type':Sequelize[_0x05c6('0x3')]},'secondDisposition':{'type':Sequelize[_0x05c6('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x05c6('0x3')]},'inReplyTo':{'type':Sequelize[_0x05c6('0x3')](0x1fe)},'to':{'type':Sequelize[_0x05c6('0x3')]},'cc':{'type':Sequelize[_0x05c6('0x4')]('long')},'subject':{'type':Sequelize[_0x05c6('0x4')]()},'attach':{'type':Sequelize[_0x05c6('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x05c6('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x05c6('0x6')]('in',_0x05c6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x05c6('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x05c6('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x05c6('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x05c6('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ad1ac89..3cf89bd 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 _0xfc33=['destroy','name','send','index','MailInteraction','type','getOptions','findAll','mail','query','catch','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','find','create','body','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','rawAttributes','hasOwnProperty','limit','order','sort','pick','where','MailInteractionId','filter','merge','$gte','split','format','options','inlineCss','true','rows','addTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','Attachment','Attachments','Messages','from','get','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','then'];(function(_0x5b3fb7,_0x24fcf6){var _0x4b947b=function(_0x2fa059){while(--_0x2fa059){_0x5b3fb7['push'](_0x5b3fb7['shift']());}};_0x4b947b(++_0x24fcf6);}(_0xfc33,0xbc));var _0x3fc3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xfc33[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x3fc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc3('0x1'));var moment=require(_0x3fc3('0x2'));var BPromise=require(_0x3fc3('0x3'));var util=require(_0x3fc3('0x4'));var path=require(_0x3fc3('0x5'));var fs=require('fs');var _=require(_0x3fc3('0x6'));var juice=require(_0x3fc3('0x7'));var Redis=require('ioredis');var interaction=require(_0x3fc3('0x8'));var qs=require(_0x3fc3('0x9'));var logger=require(_0x3fc3('0xa'))(_0x3fc3('0xb'));var config=require(_0x3fc3('0xc'));var db=require(_0x3fc3('0xd'))['db'];var htmlEntities=require(_0x3fc3('0xe'));config[_0x3fc3('0xf')]=_[_0x3fc3('0x10')](config[_0x3fc3('0xf')],{'host':_0x3fc3('0x11'),'port':0x18eb});var socket=require(_0x3fc3('0x12'))(new Redis(config[_0x3fc3('0xf')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x165e8b,_0x4f7c59){_0x4f7c59=_0x4f7c59||0xcc;return function(_0x3a394d){if(_0x3a394d){return _0x165e8b[_0x3fc3('0x13')](_0x4f7c59);}return _0x165e8b[_0x3fc3('0x14')](_0x4f7c59)[_0x3fc3('0x15')]();};}function respondWithResult(_0x58947e,_0x3bc24b){_0x3bc24b=_0x3bc24b||0xc8;return function(_0x157159){if(_0x157159){return _0x58947e[_0x3fc3('0x14')](_0x3bc24b)['json'](_0x157159);}};}function respondWithFilteredResult(_0x359b51,_0x4eeccc){return function(_0x3c3846){if(_0x3c3846){var _0x182606=typeof _0x4eeccc[_0x3fc3('0x16')]===_0x3fc3('0x17')&&typeof _0x4eeccc['limit']===_0x3fc3('0x17');var _0x5d6a13=_0x3c3846[_0x3fc3('0x18')];var _0x5865b1=_0x182606?0x0:_0x4eeccc['offset'];var _0xd73fe9=_0x182606?_0x3c3846[_0x3fc3('0x18')]:_0x4eeccc[_0x3fc3('0x16')]+_0x4eeccc['limit'];var _0x3f9a42;if(_0xd73fe9>=_0x5d6a13){_0xd73fe9=_0x5d6a13;_0x3f9a42=0xc8;}else{_0x3f9a42=0xce;}_0x359b51['status'](_0x3f9a42);return _0x359b51[_0x3fc3('0x19')](_0x3fc3('0x1a'),_0x5865b1+'-'+_0xd73fe9+'/'+_0x5d6a13)[_0x3fc3('0x1b')](_0x3c3846);}return null;};}function saveUpdates(_0x4bd24d){return function(_0x397303){if(_0x397303){return _0x397303[_0x3fc3('0x1c')](_0x4bd24d)[_0x3fc3('0x1d')](function(_0x12f03f){return _0x12f03f;});}return null;};}function removeEntity(_0x257fa5){return function(_0x5766ac){if(_0x5766ac){return _0x5766ac[_0x3fc3('0x1e')]()[_0x3fc3('0x1d')](function(){_0x257fa5[_0x3fc3('0x14')](0xcc)[_0x3fc3('0x15')]();});}};}function handleEntityNotFound(_0x10630b){return function(_0x2eaae8){if(!_0x2eaae8){_0x10630b[_0x3fc3('0x13')](0x194);}return _0x2eaae8;};}function handleError(_0x39f385,_0xaff9da){_0xaff9da=_0xaff9da||0x1f4;return function(_0x7e0d4e){logger['error'](_0x7e0d4e['stack']);if(_0x7e0d4e[_0x3fc3('0x1f')]){delete _0x7e0d4e[_0x3fc3('0x1f')];}_0x39f385[_0x3fc3('0x14')](_0xaff9da)[_0x3fc3('0x20')](_0x7e0d4e);};}exports[_0x3fc3('0x21')]=function(_0x5b139e,_0x3a1fb7){var _0x463bc6={};var _0x302bed=_['map'](db[_0x3fc3('0x22')]['rawAttributes'],function(_0x16e73a){return{'name':_0x16e73a['fieldName'],'type':_0x16e73a[_0x3fc3('0x23')]['key']};});_0x463bc6=qs[_0x3fc3('0x24')](_0x302bed,_0x5b139e);return interaction[_0x3fc3('0x25')](_0x3fc3('0x26'),_0x5b139e[_0x3fc3('0x27')],_0x5b139e['user'],_0x463bc6,_0x302bed)[_0x3fc3('0x1d')](respondWithFilteredResult(_0x3a1fb7,_0x463bc6))[_0x3fc3('0x28')](handleError(_0x3a1fb7,null));};exports['show']=function(_0x1fe95b,_0xfe9d7c){var _0x3920db={'raw':![],'where':{'id':_0x1fe95b[_0x3fc3('0x29')]['id']}},_0xdb3bb4={};_0xdb3bb4[_0x3fc3('0x2a')]=_[_0x3fc3('0x2b')](db[_0x3fc3('0x22')]['rawAttributes']);_0xdb3bb4[_0x3fc3('0x27')]=_[_0x3fc3('0x2b')](_0x1fe95b[_0x3fc3('0x27')]);_0xdb3bb4[_0x3fc3('0x2c')]=_['intersection'](_0xdb3bb4[_0x3fc3('0x2a')],_0xdb3bb4[_0x3fc3('0x27')]);_0x3920db[_0x3fc3('0x2d')]=_[_0x3fc3('0x2e')](_0xdb3bb4[_0x3fc3('0x2a')],qs[_0x3fc3('0x2f')](_0x1fe95b[_0x3fc3('0x27')]['fields']));_0x3920db[_0x3fc3('0x2d')]=_0x3920db[_0x3fc3('0x2d')][_0x3fc3('0x30')]?_0x3920db[_0x3fc3('0x2d')]:_0xdb3bb4['model'];if(_0x1fe95b[_0x3fc3('0x27')][_0x3fc3('0x31')]){_0x3920db[_0x3fc3('0x32')]=[{'all':!![]}];}_0x3920db=_['merge']({},_0x3920db,_0x1fe95b['options']);return db[_0x3fc3('0x22')][_0x3fc3('0x33')](_0x3920db)[_0x3fc3('0x1d')](handleEntityNotFound(_0xfe9d7c,null))[_0x3fc3('0x1d')](respondWithResult(_0xfe9d7c,null))[_0x3fc3('0x28')](handleError(_0xfe9d7c,null));};exports[_0x3fc3('0x34')]=function(_0x14819f,_0xea2cdd){return db[_0x3fc3('0x22')][_0x3fc3('0x34')](_0x14819f[_0x3fc3('0x35')],{})['then'](respondWithResult(_0xea2cdd,0xc9))[_0x3fc3('0x28')](handleError(_0xea2cdd,null));};exports[_0x3fc3('0x1c')]=function(_0x487d8a,_0x2724dc){if(_0x487d8a[_0x3fc3('0x35')]['id']){delete _0x487d8a[_0x3fc3('0x35')]['id'];}return db[_0x3fc3('0x22')][_0x3fc3('0x33')]({'where':{'id':_0x487d8a['params']['id']}})[_0x3fc3('0x1d')](handleEntityNotFound(_0x2724dc,null))[_0x3fc3('0x1d')](saveUpdates(_0x487d8a['body'],null))[_0x3fc3('0x1d')](respondWithResult(_0x2724dc,null))[_0x3fc3('0x28')](handleError(_0x2724dc,null));};exports['destroy']=function(_0x1ea3d0,_0x41f429){return db[_0x3fc3('0x22')][_0x3fc3('0x33')]({'where':{'id':_0x1ea3d0[_0x3fc3('0x29')]['id']}})[_0x3fc3('0x1d')](handleEntityNotFound(_0x41f429,null))[_0x3fc3('0x1d')](removeEntity(_0x41f429,null))[_0x3fc3('0x28')](handleError(_0x41f429,null));};exports[_0x3fc3('0x36')]=function(_0x3e5e9a,_0xbfc84c){return db[_0x3fc3('0x22')]['describe']()[_0x3fc3('0x1d')](respondWithResult(_0xbfc84c,null))[_0x3fc3('0x28')](handleError(_0xbfc84c,null));};exports['addMessage']=function(_0x261215,_0x26b623){return db[_0x3fc3('0x37')][_0x3fc3('0x33')]({'where':{'id':_0x261215[_0x3fc3('0x29')]['id']}})['then'](handleEntityNotFound(_0x26b623,null))[_0x3fc3('0x1d')](function(_0x2f1f21){if(_0x2f1f21){return _0x2f1f21[_0x3fc3('0x38')](_0x261215['body'][_0x3fc3('0x39')],_[_0x3fc3('0x3a')](_0x261215[_0x3fc3('0x35')],[_0x3fc3('0x39'),'id'])||{});}})[_0x3fc3('0x1d')](respondWithResult(_0x26b623,null))['catch'](handleError(_0x26b623,null));};exports[_0x3fc3('0x3b')]=function(_0x216368,_0x1e93f3){var _0x13a17b={'raw':![],'where':{}};var _0x31fc47={};var _0x222bd8={'count':0x0,'rows':[]};return db[_0x3fc3('0x22')][_0x3fc3('0x3c')]({'where':{'id':_0x216368[_0x3fc3('0x29')]['id']}})[_0x3fc3('0x1d')](handleEntityNotFound(_0x1e93f3,null))[_0x3fc3('0x1d')](function(_0x55771a){if(_0x55771a){_0x31fc47[_0x3fc3('0x2a')]=_[_0x3fc3('0x2b')](db[_0x3fc3('0x37')][_0x3fc3('0x3d')]);_0x31fc47[_0x3fc3('0x27')]=_[_0x3fc3('0x2b')](_0x216368[_0x3fc3('0x27')]);_0x31fc47['filters']=_[_0x3fc3('0x2e')](_0x31fc47[_0x3fc3('0x2a')],_0x31fc47[_0x3fc3('0x27')]);_0x13a17b[_0x3fc3('0x2d')]=_[_0x3fc3('0x2e')](_0x31fc47[_0x3fc3('0x2a')],qs[_0x3fc3('0x2f')](_0x216368[_0x3fc3('0x27')][_0x3fc3('0x2f')]));_0x13a17b['attributes']=_0x13a17b[_0x3fc3('0x2d')][_0x3fc3('0x30')]?_0x13a17b[_0x3fc3('0x2d')]:_0x31fc47[_0x3fc3('0x2a')];if(!_0x216368['query'][_0x3fc3('0x3e')]('nolimit')){_0x13a17b[_0x3fc3('0x3f')]=qs[_0x3fc3('0x3f')](_0x216368[_0x3fc3('0x27')]['limit']);_0x13a17b['offset']=qs[_0x3fc3('0x16')](_0x216368['query']['offset']);}_0x13a17b[_0x3fc3('0x40')]=qs[_0x3fc3('0x41')](_0x216368[_0x3fc3('0x27')]['sort']);_0x13a17b['where']=qs[_0x3fc3('0x2c')](_[_0x3fc3('0x42')](_0x216368[_0x3fc3('0x27')],_0x31fc47[_0x3fc3('0x2c')]));_0x13a17b[_0x3fc3('0x43')][_0x3fc3('0x44')]=_0x55771a['id'];if(_0x216368['query'][_0x3fc3('0x45')]){_0x13a17b['where']=_[_0x3fc3('0x46')](_0x13a17b[_0x3fc3('0x43')],{'$or':_['map'](_0x13a17b[_0x3fc3('0x2d')],function(_0x2b15b7){var _0x3bf9bf={};_0x3bf9bf[_0x2b15b7]={'$like':'%'+_0x216368[_0x3fc3('0x27')]['filter']+'%'};return _0x3bf9bf;})});}if(_0x216368['query'][_0x3fc3('0x47')]){var _0x5edec7=_0x216368[_0x3fc3('0x27')][_0x3fc3('0x47')][_0x3fc3('0x48')](',');var _0x292cb5={};_0x292cb5[_0x5edec7[0x0]]={'$gte':moment(_0x5edec7[0x1])[_0x3fc3('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13a17b['where']=_[_0x3fc3('0x46')](_0x13a17b[_0x3fc3('0x43')],_0x292cb5);}_0x13a17b=_[_0x3fc3('0x46')]({},_0x13a17b,_0x216368[_0x3fc3('0x4a')]);return db['MailMessage']['count']({'where':_0x13a17b['where']})['then'](function(_0x181fc4){_0x222bd8['count']=_0x181fc4;if(_0x216368[_0x3fc3('0x27')]['includeAll']){_0x13a17b[_0x3fc3('0x32')]=[{'all':!![]}];}return db[_0x3fc3('0x37')]['findAll'](_0x13a17b);})[_0x3fc3('0x1d')](function(_0x51e9ef){if(_0x216368['query'][_0x3fc3('0x4b')]===_0x3fc3('0x4c')){for(var _0x45c3c7=0x0;_0x45c3c7<_0x51e9ef['length'];_0x45c3c7++){_0x51e9ef[_0x45c3c7][_0x3fc3('0x35')]=juice(_0x51e9ef[_0x45c3c7][_0x3fc3('0x35')]);}}_0x222bd8[_0x3fc3('0x4d')]=_0x51e9ef;return _0x222bd8;});}})[_0x3fc3('0x1d')](respondWithFilteredResult(_0x1e93f3,_0x13a17b))[_0x3fc3('0x28')](handleError(_0x1e93f3,null));};exports[_0x3fc3('0x4e')]=function(_0x620d7,_0x2759c2){return db[_0x3fc3('0x22')][_0x3fc3('0x33')]({'where':{'id':_0x620d7[_0x3fc3('0x29')]['id']}})['then'](handleEntityNotFound(_0x2759c2,null))['then'](function(_0x47e782){if(_0x47e782){return _0x47e782['setTags'](_0x620d7[_0x3fc3('0x35')]['ids'],_[_0x3fc3('0x3a')](_0x620d7['body'],[_0x3fc3('0x39'),'id'])||{})[_0x3fc3('0x4f')](function(){return db[_0x3fc3('0x50')][_0x3fc3('0x25')]({'attributes':['id',_0x3fc3('0x1f'),'color'],'where':{'id':_0x620d7['body']['ids']}});})[_0x3fc3('0x1d')](function(_0x349de2){socket[_0x3fc3('0x51')](_0x3fc3('0x52'),{'id':Number(_0x620d7[_0x3fc3('0x29')]['id']),'tags':_0x349de2||[]});return{'id':Number(_0x620d7[_0x3fc3('0x29')]['id']),'tags':_0x349de2||[]};});}})[_0x3fc3('0x1d')](respondWithResult(_0x2759c2,null))[_0x3fc3('0x28')](handleError(_0x2759c2,null));};exports[_0x3fc3('0x53')]=function(_0x496695,_0xff8e32){return db[_0x3fc3('0x22')][_0x3fc3('0x33')]({'where':{'id':_0x496695['params']['id']}})[_0x3fc3('0x1d')](handleEntityNotFound(_0xff8e32,null))['then'](function(_0x4d2a52){if(_0x4d2a52){return _0x4d2a52['removeTags'](_0x496695[_0x3fc3('0x27')][_0x3fc3('0x39')]);}})[_0x3fc3('0x1d')](respondWithStatusCode(_0xff8e32,null))[_0x3fc3('0x28')](handleError(_0xff8e32,null));};exports[_0x3fc3('0x54')]=function(_0x44be6e,_0x43fa59){var _0x112637=moment()['unix']()[_0x3fc3('0x55')]();var _0x2d8ecd=path[_0x3fc3('0x56')](config[_0x3fc3('0x57')],_0x3fc3('0x58'),_0x3fc3('0x59'),_0x3fc3('0x5a'));var _0x418b4f=path[_0x3fc3('0x56')](config[_0x3fc3('0x57')],_0x3fc3('0x58'),'files',_0x3fc3('0x5b'));var _0x47ddef=path[_0x3fc3('0x56')](_0x2d8ecd,_0x112637);var _0x205ed2=util[_0x3fc3('0x49')]('transcript-%d-%s.zip',_0x44be6e['params']['id'],_0x112637);var _0x52fda1=path['join'](_0x2d8ecd,_0x205ed2);var _0x4f1c3c=[];if(_0x44be6e[_0x3fc3('0x27')][_0x3fc3('0x5b')]){_0x4f1c3c['push']({'model':db[_0x3fc3('0x5c')],'as':_0x3fc3('0x5d'),'raw':!![]});}var _0x14ca9b=[{'model':db[_0x3fc3('0x37')],'as':_0x3fc3('0x5e'),'attributes':['id',_0x3fc3('0x35'),_0x3fc3('0x5f'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4f1c3c}];return db[_0x3fc3('0x22')][_0x3fc3('0x33')]({'where':{'id':_0x44be6e['params']['id']},'include':_0x14ca9b})[_0x3fc3('0x1d')](handleEntityNotFound(_0x43fa59,null))['then'](function(_0x40e25f){if(_0x40e25f&&_0x40e25f[_0x3fc3('0x5e')]){var _0x35bb5d=_0x40e25f[_0x3fc3('0x60')]({'plain':!![]});fs['mkdirSync'](_0x47ddef);return BPromise['each'](_0x35bb5d[_0x3fc3('0x5e')],function(_0x240650,_0x406a00){var _0xc6045b={'from':_0x240650[_0x3fc3('0x5f')],'to':_0x240650['to']||_0x3fc3('0x61'),'subject':_0x240650['subject'],'html':htmlEntities['decode'](_0x240650[_0x3fc3('0x35')]),'headers':{'Date':moment(_0x240650['createdAt'])[_0x3fc3('0x49')](_0x3fc3('0x62'))},'attachments':[]};if(_0x240650['cc']){_0xc6045b[_0x3fc3('0x63')]['Cc']=_0x240650['cc'];}if(_0x240650['bcc']){_0xc6045b[_0x3fc3('0x63')][_0x3fc3('0x64')]=_0x240650['bcc'];}return new BPromise(function(_0x4248b4,_0x2361e5){if(_0x240650[_0x3fc3('0x5d')]){for(var _0x2ee0ce=0x0;_0x2ee0ce<_0x240650[_0x3fc3('0x5d')][_0x3fc3('0x30')];_0x2ee0ce++){var _0x7a912=_0x240650[_0x3fc3('0x5d')][_0x2ee0ce];var _0x1755d0=path[_0x3fc3('0x56')](_0x418b4f,_0x7a912[_0x3fc3('0x65')]);if(fs[_0x3fc3('0x66')](_0x1755d0)){_0xc6045b[_0x3fc3('0x5b')][_0x3fc3('0x67')]({'name':_0x7a912['name'],'contentType':_0x7a912['type'],'data':fs[_0x3fc3('0x68')](_0x1755d0)});}}}emlformat[_0x3fc3('0x69')](_0xc6045b,function(_0x2771d2,_0x51a746){if(_0x2771d2)return _0x2361e5(_0x2771d2);fs[_0x3fc3('0x6a')](path[_0x3fc3('0x56')](_0x47ddef,util['format'](_0x3fc3('0x6b'),_0x406a00)),_0x51a746);return _0x4248b4(_0x51a746);});});})[_0x3fc3('0x1d')](function(){return new BPromise(function(_0x2470b6,_0x29b2be){zipdir(_0x47ddef,{'saveTo':_0x52fda1},function(_0x4847e9,_0x50e796){if(_0x4847e9)return _0x29b2be(_0x4847e9);return _0x2470b6(_0x50e796);});})[_0x3fc3('0x1d')](function(){return new BPromise(function(_0x21e011,_0x131f00){rimraf(_0x47ddef,function(_0x45fedb){if(_0x45fedb)_0x131f00(_0x45fedb);return _0x21e011();});});})[_0x3fc3('0x1d')](function(){return _0x43fa59['download'](_0x52fda1,_0x205ed2,function(_0x49588e){if(!_0x49588e)fs[_0x3fc3('0x6c')](_0x52fda1);});});});}else{return _0x43fa59[_0x3fc3('0x13')](0xc8);}})['catch'](handleError(_0x43fa59,null));}; \ No newline at end of file +var _0xf9a2=['unlinkSync','eml-format','rimraf','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','html-entities','redis','defaults','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','error','stack','name','send','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','show','params','model','keys','intersection','attributes','fields','includeAll','options','find','catch','create','update','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','include','true','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Attachments','basename','readFileSync'];(function(_0x3efe22,_0x3702b7){var _0x99543=function(_0x3a095d){while(--_0x3a095d){_0x3efe22['push'](_0x3efe22['shift']());}};_0x99543(++_0x3702b7);}(_0xf9a2,0x72));var _0x2f9a=function(_0x4fc79e,_0x3b1919){_0x4fc79e=_0x4fc79e-0x0;var _0x301cba=_0xf9a2[_0x4fc79e];return _0x301cba;};'use strict';var emlformat=require(_0x2f9a('0x0'));var rimraf=require(_0x2f9a('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x2f9a('0x2'));var util=require(_0x2f9a('0x3'));var path=require(_0x2f9a('0x4'));var fs=require('fs');var _=require(_0x2f9a('0x5'));var juice=require(_0x2f9a('0x6'));var Redis=require(_0x2f9a('0x7'));var interaction=require(_0x2f9a('0x8'));var qs=require(_0x2f9a('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x2f9a('0xa'));var db=require(_0x2f9a('0xb'))['db'];var htmlEntities=require(_0x2f9a('0xc'));config[_0x2f9a('0xd')]=_[_0x2f9a('0xe')](config[_0x2f9a('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f9a('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1ddd38,_0x4a26e7){_0x4a26e7=_0x4a26e7||0xcc;return function(_0x6ccbf5){if(_0x6ccbf5){return _0x1ddd38[_0x2f9a('0xf')](_0x4a26e7);}return _0x1ddd38[_0x2f9a('0x10')](_0x4a26e7)[_0x2f9a('0x11')]();};}function respondWithResult(_0x381b1b,_0x95c2c){_0x95c2c=_0x95c2c||0xc8;return function(_0x43c083){if(_0x43c083){return _0x381b1b[_0x2f9a('0x10')](_0x95c2c)[_0x2f9a('0x12')](_0x43c083);}};}function respondWithFilteredResult(_0x260c4b,_0x28c298){return function(_0x4d15fe){if(_0x4d15fe){var _0x420fbd=typeof _0x28c298[_0x2f9a('0x13')]==='undefined'&&typeof _0x28c298[_0x2f9a('0x14')]===_0x2f9a('0x15');var _0x15092e=_0x4d15fe[_0x2f9a('0x16')];var _0x4b43e8=_0x420fbd?0x0:_0x28c298[_0x2f9a('0x13')];var _0x7a90b7=_0x420fbd?_0x4d15fe[_0x2f9a('0x16')]:_0x28c298[_0x2f9a('0x13')]+_0x28c298[_0x2f9a('0x14')];var _0x199c8d;if(_0x7a90b7>=_0x15092e){_0x7a90b7=_0x15092e;_0x199c8d=0xc8;}else{_0x199c8d=0xce;}_0x260c4b[_0x2f9a('0x10')](_0x199c8d);return _0x260c4b[_0x2f9a('0x17')](_0x2f9a('0x18'),_0x4b43e8+'-'+_0x7a90b7+'/'+_0x15092e)[_0x2f9a('0x12')](_0x4d15fe);}return null;};}function saveUpdates(_0x26da34){return function(_0x31ad96){if(_0x31ad96){return _0x31ad96['update'](_0x26da34)['then'](function(_0x101426){return _0x101426;});}return null;};}function removeEntity(_0x408bdf){return function(_0xbe96b5){if(_0xbe96b5){return _0xbe96b5[_0x2f9a('0x19')]()[_0x2f9a('0x1a')](function(){_0x408bdf[_0x2f9a('0x10')](0xcc)[_0x2f9a('0x11')]();});}};}function handleEntityNotFound(_0x385108){return function(_0x1ef7c1){if(!_0x1ef7c1){_0x385108[_0x2f9a('0xf')](0x194);}return _0x1ef7c1;};}function handleError(_0x2a74af,_0x793c2f){_0x793c2f=_0x793c2f||0x1f4;return function(_0x20d5c9){logger[_0x2f9a('0x1b')](_0x20d5c9[_0x2f9a('0x1c')]);if(_0x20d5c9['name']){delete _0x20d5c9[_0x2f9a('0x1d')];}_0x2a74af['status'](_0x793c2f)[_0x2f9a('0x1e')](_0x20d5c9);};}exports['index']=function(_0x368d60,_0xf274cc){var _0x166809={};var _0x37c601=_['map'](db[_0x2f9a('0x1f')][_0x2f9a('0x20')],function(_0x4cc8df){return{'name':_0x4cc8df[_0x2f9a('0x21')],'type':_0x4cc8df[_0x2f9a('0x22')][_0x2f9a('0x23')]};});_0x166809=qs[_0x2f9a('0x24')](_0x37c601,_0x368d60);return interaction[_0x2f9a('0x25')](_0x2f9a('0x26'),_0x368d60[_0x2f9a('0x27')],_0x368d60[_0x2f9a('0x28')],_0x166809,_0x37c601)[_0x2f9a('0x1a')](respondWithFilteredResult(_0xf274cc,_0x166809))['catch'](handleError(_0xf274cc,null));};exports[_0x2f9a('0x29')]=function(_0x1a4994,_0x187cff){var _0xea62af={'raw':![],'where':{'id':_0x1a4994[_0x2f9a('0x2a')]['id']}},_0xe69211={};_0xe69211[_0x2f9a('0x2b')]=_[_0x2f9a('0x2c')](db[_0x2f9a('0x1f')][_0x2f9a('0x20')]);_0xe69211[_0x2f9a('0x27')]=_[_0x2f9a('0x2c')](_0x1a4994['query']);_0xe69211['filters']=_[_0x2f9a('0x2d')](_0xe69211['model'],_0xe69211[_0x2f9a('0x27')]);_0xea62af[_0x2f9a('0x2e')]=_[_0x2f9a('0x2d')](_0xe69211['model'],qs['fields'](_0x1a4994[_0x2f9a('0x27')][_0x2f9a('0x2f')]));_0xea62af[_0x2f9a('0x2e')]=_0xea62af['attributes']['length']?_0xea62af[_0x2f9a('0x2e')]:_0xe69211[_0x2f9a('0x2b')];if(_0x1a4994[_0x2f9a('0x27')][_0x2f9a('0x30')]){_0xea62af['include']=[{'all':!![]}];}_0xea62af=_['merge']({},_0xea62af,_0x1a4994[_0x2f9a('0x31')]);return db[_0x2f9a('0x1f')][_0x2f9a('0x32')](_0xea62af)[_0x2f9a('0x1a')](handleEntityNotFound(_0x187cff,null))[_0x2f9a('0x1a')](respondWithResult(_0x187cff,null))[_0x2f9a('0x33')](handleError(_0x187cff,null));};exports[_0x2f9a('0x34')]=function(_0x43b380,_0x288dcd){return db[_0x2f9a('0x1f')][_0x2f9a('0x34')](_0x43b380['body'],{})[_0x2f9a('0x1a')](respondWithResult(_0x288dcd,0xc9))[_0x2f9a('0x33')](handleError(_0x288dcd,null));};exports[_0x2f9a('0x35')]=function(_0x539f0c,_0x22c5ac){if(_0x539f0c['body']['id']){delete _0x539f0c[_0x2f9a('0x36')]['id'];}return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0x539f0c['params']['id']}})[_0x2f9a('0x1a')](handleEntityNotFound(_0x22c5ac,null))[_0x2f9a('0x1a')](saveUpdates(_0x539f0c[_0x2f9a('0x36')],null))['then'](respondWithResult(_0x22c5ac,null))[_0x2f9a('0x33')](handleError(_0x22c5ac,null));};exports[_0x2f9a('0x19')]=function(_0x4a576d,_0x45b563){return db[_0x2f9a('0x1f')][_0x2f9a('0x32')]({'where':{'id':_0x4a576d[_0x2f9a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x45b563,null))[_0x2f9a('0x1a')](removeEntity(_0x45b563,null))[_0x2f9a('0x33')](handleError(_0x45b563,null));};exports[_0x2f9a('0x37')]=function(_0x52dad7,_0x2bf6b1){return db[_0x2f9a('0x1f')][_0x2f9a('0x37')]()[_0x2f9a('0x1a')](respondWithResult(_0x2bf6b1,null))[_0x2f9a('0x33')](handleError(_0x2bf6b1,null));};exports[_0x2f9a('0x38')]=function(_0x180e0c,_0x531bed){return db[_0x2f9a('0x39')][_0x2f9a('0x32')]({'where':{'id':_0x180e0c[_0x2f9a('0x2a')]['id']}})[_0x2f9a('0x1a')](handleEntityNotFound(_0x531bed,null))[_0x2f9a('0x1a')](function(_0x2fb22f){if(_0x2fb22f){return _0x2fb22f[_0x2f9a('0x38')](_0x180e0c['body'][_0x2f9a('0x3a')],_[_0x2f9a('0x3b')](_0x180e0c[_0x2f9a('0x36')],[_0x2f9a('0x3a'),'id'])||{});}})[_0x2f9a('0x1a')](respondWithResult(_0x531bed,null))[_0x2f9a('0x33')](handleError(_0x531bed,null));};exports[_0x2f9a('0x3c')]=function(_0x166d8e,_0x48b956){var _0x224894={'raw':![],'where':{}};var _0x368771={};var _0x5e037b={'count':0x0,'rows':[]};return db[_0x2f9a('0x1f')][_0x2f9a('0x3d')]({'where':{'id':_0x166d8e[_0x2f9a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48b956,null))[_0x2f9a('0x1a')](function(_0x452129){if(_0x452129){_0x368771[_0x2f9a('0x2b')]=_[_0x2f9a('0x2c')](db[_0x2f9a('0x39')]['rawAttributes']);_0x368771[_0x2f9a('0x27')]=_[_0x2f9a('0x2c')](_0x166d8e[_0x2f9a('0x27')]);_0x368771[_0x2f9a('0x3e')]=_[_0x2f9a('0x2d')](_0x368771[_0x2f9a('0x2b')],_0x368771[_0x2f9a('0x27')]);_0x224894['attributes']=_[_0x2f9a('0x2d')](_0x368771['model'],qs[_0x2f9a('0x2f')](_0x166d8e[_0x2f9a('0x27')]['fields']));_0x224894[_0x2f9a('0x2e')]=_0x224894[_0x2f9a('0x2e')][_0x2f9a('0x3f')]?_0x224894[_0x2f9a('0x2e')]:_0x368771[_0x2f9a('0x2b')];if(!_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x40')](_0x2f9a('0x41'))){_0x224894[_0x2f9a('0x14')]=qs[_0x2f9a('0x14')](_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x14')]);_0x224894[_0x2f9a('0x13')]=qs[_0x2f9a('0x13')](_0x166d8e['query']['offset']);}_0x224894[_0x2f9a('0x42')]=qs[_0x2f9a('0x43')](_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x43')]);_0x224894[_0x2f9a('0x44')]=qs['filters'](_[_0x2f9a('0x45')](_0x166d8e[_0x2f9a('0x27')],_0x368771['filters']));_0x224894[_0x2f9a('0x44')][_0x2f9a('0x46')]=_0x452129['id'];if(_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x47')]){_0x224894[_0x2f9a('0x44')]=_['merge'](_0x224894['where'],{'$or':_['map'](_0x224894[_0x2f9a('0x2e')],function(_0x140b3a){var _0x4ce8b6={};_0x4ce8b6[_0x140b3a]={'$like':'%'+_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x47')]+'%'};return _0x4ce8b6;})});}if(_0x166d8e['query'][_0x2f9a('0x48')]){var _0x184f84=_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x48')][_0x2f9a('0x49')](',');var _0x29cb99={};_0x29cb99[_0x184f84[0x0]]={'$gte':moment(_0x184f84[0x1])[_0x2f9a('0x4a')](_0x2f9a('0x4b'))};_0x224894[_0x2f9a('0x44')]=_[_0x2f9a('0x4c')](_0x224894[_0x2f9a('0x44')],_0x29cb99);}_0x224894=_['merge']({},_0x224894,_0x166d8e[_0x2f9a('0x31')]);return db['MailMessage'][_0x2f9a('0x16')]({'where':_0x224894[_0x2f9a('0x44')]})['then'](function(_0x268d3f){_0x5e037b[_0x2f9a('0x16')]=_0x268d3f;if(_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x30')]){_0x224894[_0x2f9a('0x4d')]=[{'all':!![]}];}return db[_0x2f9a('0x39')][_0x2f9a('0x25')](_0x224894);})[_0x2f9a('0x1a')](function(_0x3f871c){if(_0x166d8e[_0x2f9a('0x27')]['inlineCss']===_0x2f9a('0x4e')){for(var _0x4a9817=0x0;_0x4a9817<_0x3f871c['length'];_0x4a9817++){_0x3f871c[_0x4a9817][_0x2f9a('0x36')]=juice(_0x3f871c[_0x4a9817][_0x2f9a('0x36')]);}}_0x5e037b['rows']=_0x3f871c;return _0x5e037b;});}})[_0x2f9a('0x1a')](respondWithFilteredResult(_0x48b956,_0x224894))[_0x2f9a('0x33')](handleError(_0x48b956,null));};exports[_0x2f9a('0x4f')]=function(_0x523a0e,_0x3ef296){return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0x523a0e[_0x2f9a('0x2a')]['id']}})[_0x2f9a('0x1a')](handleEntityNotFound(_0x3ef296,null))[_0x2f9a('0x1a')](function(_0x4389c1){if(_0x4389c1){return _0x4389c1['setTags'](_0x523a0e['body'][_0x2f9a('0x3a')],_[_0x2f9a('0x3b')](_0x523a0e['body'],['ids','id'])||{})[_0x2f9a('0x50')](function(){return db[_0x2f9a('0x51')][_0x2f9a('0x25')]({'attributes':['id',_0x2f9a('0x1d'),_0x2f9a('0x52')],'where':{'id':_0x523a0e[_0x2f9a('0x36')][_0x2f9a('0x3a')]}});})['then'](function(_0x3e24ce){socket[_0x2f9a('0x53')](_0x2f9a('0x54'),{'id':Number(_0x523a0e[_0x2f9a('0x2a')]['id']),'tags':_0x3e24ce||[]});return{'id':Number(_0x523a0e[_0x2f9a('0x2a')]['id']),'tags':_0x3e24ce||[]};});}})[_0x2f9a('0x1a')](respondWithResult(_0x3ef296,null))['catch'](handleError(_0x3ef296,null));};exports[_0x2f9a('0x55')]=function(_0x3b66a3,_0x1a4139){return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0x3b66a3[_0x2f9a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1a4139,null))[_0x2f9a('0x1a')](function(_0x2cb83f){if(_0x2cb83f){return _0x2cb83f[_0x2f9a('0x55')](_0x3b66a3[_0x2f9a('0x27')][_0x2f9a('0x3a')]);}})[_0x2f9a('0x1a')](respondWithStatusCode(_0x1a4139,null))[_0x2f9a('0x33')](handleError(_0x1a4139,null));};exports[_0x2f9a('0x56')]=function(_0xfe9dfe,_0x425fa4){var _0x9cf5f2=moment()[_0x2f9a('0x57')]()[_0x2f9a('0x58')]();var _0x427e69=path['join'](config[_0x2f9a('0x59')],'server',_0x2f9a('0x5a'),_0x2f9a('0x5b'));var _0x3b98f9=path[_0x2f9a('0x5c')](config['root'],_0x2f9a('0x5d'),'files',_0x2f9a('0x5e'));var _0x334d77=path['join'](_0x427e69,_0x9cf5f2);var _0x12ba06=util[_0x2f9a('0x4a')]('transcript-%d-%s.zip',_0xfe9dfe[_0x2f9a('0x2a')]['id'],_0x9cf5f2);var _0x4c5e47=path[_0x2f9a('0x5c')](_0x427e69,_0x12ba06);var _0x5c6000=[];if(_0xfe9dfe[_0x2f9a('0x27')][_0x2f9a('0x5e')]){_0x5c6000[_0x2f9a('0x5f')]({'model':db[_0x2f9a('0x60')],'as':'Attachments','raw':!![]});}var _0x5d4051=[{'model':db[_0x2f9a('0x39')],'as':_0x2f9a('0x61'),'attributes':['id',_0x2f9a('0x36'),_0x2f9a('0x62'),'to','cc','bcc',_0x2f9a('0x63'),_0x2f9a('0x64')],'where':{'secret':![]},'order':qs[_0x2f9a('0x43')]('id'),'include':_0x5c6000}];return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0xfe9dfe['params']['id']},'include':_0x5d4051})['then'](handleEntityNotFound(_0x425fa4,null))[_0x2f9a('0x1a')](function(_0x32fc24){if(_0x32fc24&&_0x32fc24[_0x2f9a('0x61')]){var _0x50085c=_0x32fc24[_0x2f9a('0x65')]({'plain':!![]});fs[_0x2f9a('0x66')](_0x334d77);return BPromise[_0x2f9a('0x67')](_0x50085c[_0x2f9a('0x61')],function(_0x5b33b5,_0x130b8d){var _0x13acda={'from':_0x5b33b5[_0x2f9a('0x62')],'to':_0x5b33b5['to']||_0x2f9a('0x68'),'subject':_0x5b33b5['subject'],'html':htmlEntities[_0x2f9a('0x69')](_0x5b33b5[_0x2f9a('0x36')]),'headers':{'Date':moment(_0x5b33b5[_0x2f9a('0x64')])[_0x2f9a('0x4a')](_0x2f9a('0x6a'))},'attachments':[]};if(_0x5b33b5['cc']){_0x13acda['headers']['Cc']=_0x5b33b5['cc'];}if(_0x5b33b5[_0x2f9a('0x6b')]){_0x13acda[_0x2f9a('0x6c')]['Bcc']=_0x5b33b5[_0x2f9a('0x6b')];}return new BPromise(function(_0x74f3b9,_0x14aeda){if(_0x5b33b5['Attachments']){for(var _0x3b6e30=0x0;_0x3b6e30<_0x5b33b5[_0x2f9a('0x6d')]['length'];_0x3b6e30++){var _0x59cc81=_0x5b33b5[_0x2f9a('0x6d')][_0x3b6e30];var _0x323f62=path[_0x2f9a('0x5c')](_0x3b98f9,_0x59cc81[_0x2f9a('0x6e')]);if(fs['existsSync'](_0x323f62)){_0x13acda[_0x2f9a('0x5e')][_0x2f9a('0x5f')]({'name':_0x59cc81[_0x2f9a('0x1d')],'contentType':_0x59cc81['type'],'data':fs[_0x2f9a('0x6f')](_0x323f62)});}}}emlformat['build'](_0x13acda,function(_0xbff93f,_0x36da8d){if(_0xbff93f)return _0x14aeda(_0xbff93f);fs['writeFileSync'](path[_0x2f9a('0x5c')](_0x334d77,util[_0x2f9a('0x4a')]('message%d.eml',_0x130b8d)),_0x36da8d);return _0x74f3b9(_0x36da8d);});});})[_0x2f9a('0x1a')](function(){return new BPromise(function(_0x3ee3fe,_0x366143){zipdir(_0x334d77,{'saveTo':_0x4c5e47},function(_0x193f96,_0x47125f){if(_0x193f96)return _0x366143(_0x193f96);return _0x3ee3fe(_0x47125f);});})[_0x2f9a('0x1a')](function(){return new BPromise(function(_0x261d89,_0x4c3847){rimraf(_0x334d77,function(_0x5d5a86){if(_0x5d5a86)_0x4c3847(_0x5d5a86);return _0x261d89();});});})['then'](function(){return _0x425fa4['download'](_0x4c5e47,_0x12ba06,function(_0xc62ea6){if(!_0xc62ea6)fs[_0x2f9a('0x70')](_0x4c5e47);});});});}else{return _0x425fa4[_0x2f9a('0xf')](0xc8);}})[_0x2f9a('0x33')](handleError(_0x425fa4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 931f6f0..e99fa73 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 _0x8644=['update','remove','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x22b824,_0x54e2cb){var _0x573452=function(_0x308170){while(--_0x308170){_0x22b824['push'](_0x22b824['shift']());}};_0x573452(++_0x54e2cb);}(_0x8644,0x1dc));var _0x4864=function(_0xe01c24,_0x508d50){_0xe01c24=_0xe01c24-0x0;var _0x18c6fe=_0x8644[_0xe01c24];return _0x18c6fe;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x4864('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x4864('0x0'))['db'][_0x4864('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4864('0x2')](0x0);var events={'afterCreate':_0x4864('0x3'),'afterUpdate':_0x4864('0x4'),'afterDestroy':_0x4864('0x5')};function emitEvent(_0x2d0e45){return function(_0x2eb675,_0x12ec75,_0x105f3f){_0x2eb675['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x580f6c){_0x2eb675[_0x4864('0x6')](_0x4864('0x7'),_0x580f6c[_0x4864('0x8')](function(_0x34f5f2){return{'id':_0x34f5f2['id']};}));return MailMessage[_0x4864('0x9')]({'where':{'MailInteractionId':_0x2eb675['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xce0571){_0x2eb675[_0x4864('0x6')](_0x4864('0xa'),_0xce0571[_0x4864('0xb')]);MailInteractionEvents[_0x4864('0xc')](_0x2d0e45+':'+_0x2eb675['id'],_0x2eb675);MailInteractionEvents[_0x4864('0xc')](_0x2d0e45,_0x2eb675);_0x105f3f(null);})['catch'](_0x105f3f(null));};}for(var e in events){if(events[_0x4864('0xd')](e)){var event=events[e];MailInteraction[_0x4864('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x780c=['catch','hook','events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','emit'];(function(_0x31ff69,_0x374548){var _0x47d90f=function(_0x57a717){while(--_0x57a717){_0x31ff69['push'](_0x31ff69['shift']());}};_0x47d90f(++_0x374548);}(_0x780c,0x72));var _0xc780=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x780c[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0xc780('0x0'));var MailInteraction=require(_0xc780('0x1'))['db'][_0xc780('0x2')];var MailMessage=require(_0xc780('0x1'))['db'][_0xc780('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc780('0x4'),'afterUpdate':_0xc780('0x5'),'afterDestroy':_0xc780('0x6')};function emitEvent(_0x26a423){return function(_0x56a8bc,_0x35e8d5,_0x1f4260){_0x56a8bc[_0xc780('0x7')]({'attributes':['id'],'raw':!![]})[_0xc780('0x8')](function(_0x378a20){_0x56a8bc['setDataValue'](_0xc780('0x9'),_0x378a20[_0xc780('0xa')](function(_0xac5329){return{'id':_0xac5329['id']};}));return MailMessage[_0xc780('0xb')]({'where':{'MailInteractionId':_0x56a8bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc780('0x8')](function(_0xb0d3d7){_0x56a8bc[_0xc780('0xc')]('unreadMessages',_0xb0d3d7['length']);MailInteractionEvents[_0xc780('0xd')](_0x26a423+':'+_0x56a8bc['id'],_0x56a8bc);MailInteractionEvents[_0xc780('0xd')](_0x26a423,_0x56a8bc);_0x1f4260(null);})[_0xc780('0xe')](_0x1f4260(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xc780('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a1abf5e..ded2c01 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 _0xe74d=['models','closed','MailMessage','then','catch','utf8mb4','util','moment','request-promise','path','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','substatus','changed'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xe74d,0x1e9));var _0xde74=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0xe74d[_0x38fb8b];return _0x1ec681;};'use strict';var _=require('lodash');var util=require(_0xde74('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xde74('0x1'));var BPromise=require('bluebird');var rp=require(_0xde74('0x2'));var fs=require('fs');var path=require(_0xde74('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde74('0x4'));module['exports']=function(_0x46ef77,_0x33a6af){return _0x46ef77[_0xde74('0x5')](_0xde74('0x6'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xde74('0x7'),'fields':[_0xde74('0x8'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11a988,_0x2e09e3,_0x16ccb8){if(_0x11a988['substatus']){_0x11a988[_0xde74('0x9')]=moment()[_0xde74('0xa')](_0xde74('0xb'));}if(_0x11a988['closed']){_0x11a988[_0xde74('0xc')]=moment()[_0xde74('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x16ccb8(null,_0x2e09e3);},'beforeUpdate':function(_0x17c278,_0x4cbc45,_0x2b704f){if(_0x17c278['changed']('substatus')){_0x17c278[_0xde74('0x9')]=_0x17c278[_0xde74('0xd')]?moment()[_0xde74('0xa')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x17c278[_0xde74('0xe')]('closed')){_0x17c278['closedAt']=moment()[_0xde74('0xa')](_0xde74('0xb'));_0x17c278[_0xde74('0xd')]=null;_0x17c278[_0xde74('0x9')]=null;}_0x2b704f(null,_0x17c278);},'afterUpdate':function(_0x4cdfc8,_0x29d73f,_0x5af028){var _0x24e38c=_0x46ef77[_0xde74('0xf')];var _0x313fd1=_0x4cdfc8['get']({'plain':!![]});if(_0x313fd1[_0xde74('0x10')]){return _0x24e38c[_0xde74('0x11')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x313fd1['id']}})[_0xde74('0x12')](function(){_0x5af028();})[_0xde74('0x13')](function(_0x384ccd){_0x5af028(_0x384ccd);});}else{_0x5af028();}}},'charset':_0xde74('0x14'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x769a=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatusAt','models','get','MailMessage'];(function(_0x8261bb,_0x48e718){var _0x530867=function(_0x4b2b4e){while(--_0x4b2b4e){_0x8261bb['push'](_0x8261bb['shift']());}};_0x530867(++_0x48e718);}(_0x769a,0xb8));var _0xa769=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x769a[_0x430459];return _0x3a2439;};'use strict';var _=require(_0xa769('0x0'));var util=require(_0xa769('0x1'));var logger=require(_0xa769('0x2'))(_0xa769('0x3'));var moment=require(_0xa769('0x4'));var BPromise=require(_0xa769('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa769('0x6'));var rimraf=require(_0xa769('0x7'));var config=require(_0xa769('0x8'));var attributes=require(_0xa769('0x9'));module[_0xa769('0xa')]=function(_0x31504b,_0x41b1f3){return _0x31504b[_0xa769('0xb')](_0xa769('0xc'),attributes,{'tableName':_0xa769('0xd'),'paranoid':![],'indexes':[{'name':_0xa769('0xe'),'fields':['subject','to'],'type':_0xa769('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xde22ec,_0x26e744,_0x2a886d){if(_0xde22ec[_0xa769('0x10')]){_0xde22ec['substatusAt']=moment()['format'](_0xa769('0x11'));}if(_0xde22ec[_0xa769('0x12')]){_0xde22ec[_0xa769('0x13')]=moment()[_0xa769('0x14')](_0xa769('0x11'));}_0x2a886d(null,_0x26e744);},'beforeUpdate':function(_0x41c8d7,_0x2a037c,_0x2bb484){if(_0x41c8d7[_0xa769('0x15')](_0xa769('0x10'))){_0x41c8d7[_0xa769('0x16')]=_0x41c8d7[_0xa769('0x10')]?moment()[_0xa769('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x41c8d7['changed'](_0xa769('0x12'))){_0x41c8d7['closedAt']=moment()[_0xa769('0x14')](_0xa769('0x11'));_0x41c8d7['substatus']=null;_0x41c8d7[_0xa769('0x16')]=null;}_0x2bb484(null,_0x41c8d7);},'afterUpdate':function(_0x1aafeb,_0x2744bd,_0x478e8d){var _0x271668=_0x31504b[_0xa769('0x17')];var _0x4430e2=_0x1aafeb[_0xa769('0x18')]({'plain':!![]});if(_0x4430e2[_0xa769('0x12')]){return _0x271668[_0xa769('0x19')][_0xa769('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x4430e2['id']}})['then'](function(){_0x478e8d();})[_0xa769('0x1b')](function(_0x300873){_0x478e8d(_0x300873);});}else{_0x478e8d();}}},'charset':_0xa769('0x1c'),'collate':_0xa769('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4e5453f..f92c4c8 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 _0x0497=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','then','AddTagsToMailInteraction','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0497,0xe1));var _0x7049=function(_0x270323,_0x72160){_0x270323=_0x270323-0x0;var _0x48a027=_0x0497[_0x270323];return _0x48a027;};'use strict';var _=require(_0x7049('0x0'));var util=require(_0x7049('0x1'));var moment=require('moment');var BPromise=require(_0x7049('0x2'));var rs=require(_0x7049('0x3'));var fs=require('fs');var Redis=require(_0x7049('0x4'));var db=require(_0x7049('0x5'))['db'];var utils=require(_0x7049('0x6'));var logger=require(_0x7049('0x7'))(_0x7049('0x8'));var config=require(_0x7049('0x9'));var jayson=require(_0x7049('0xa'));var client=jayson[_0x7049('0xb')][_0x7049('0xc')]({'port':0x232a});config[_0x7049('0xd')]=_['defaults'](config[_0x7049('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7049('0xe'))(new Redis(config[_0x7049('0xd')]));require(_0x7049('0xf'))[_0x7049('0x10')](socket);function respondWithRpcPromise(_0x4c0026,_0x25f0aa,_0x2d17b0){return new BPromise(function(_0x35bf18,_0x229a26){return client[_0x7049('0x11')](_0x4c0026,_0x2d17b0)['then'](function(_0xd4cd9b){logger['info'](_0x7049('0x12'),_0x25f0aa,_0x7049('0x13'));logger[_0x7049('0x14')](_0x7049('0x15'),_0x25f0aa,_0x7049('0x13'),JSON[_0x7049('0x16')](_0xd4cd9b));if(_0xd4cd9b[_0x7049('0x17')]){if(_0xd4cd9b[_0x7049('0x17')][_0x7049('0x18')]===0x1f4){logger[_0x7049('0x17')]('MailInteraction,\x20%s,\x20%s',_0x25f0aa,_0xd4cd9b[_0x7049('0x17')]['message']);return _0x229a26(_0xd4cd9b[_0x7049('0x17')][_0x7049('0x19')]);}logger[_0x7049('0x17')](_0x7049('0x12'),_0x25f0aa,_0xd4cd9b[_0x7049('0x17')][_0x7049('0x19')]);return _0x35bf18(_0xd4cd9b[_0x7049('0x17')][_0x7049('0x19')]);}else{logger[_0x7049('0x1a')]('MailInteraction,\x20%s,\x20%s',_0x25f0aa,_0x7049('0x13'));_0x35bf18(_0xd4cd9b[_0x7049('0x1b')][_0x7049('0x19')]);}})[_0x7049('0x1c')](function(_0x13f81c){logger[_0x7049('0x17')](_0x7049('0x12'),_0x25f0aa,_0x13f81c);_0x229a26(_0x13f81c);});});}exports[_0x7049('0x1d')]=function(_0xf751e8){var _0x530e10=this;return new Promise(function(_0x37e1e0,_0x4f6d46){return db[_0x7049('0x1e')][_0x7049('0x1f')](_0xf751e8[_0x7049('0x20')],{'raw':_0xf751e8[_0x7049('0x21')]?_0xf751e8[_0x7049('0x21')][_0x7049('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf751e8[_0x7049('0x21')]?_0xf751e8[_0x7049('0x21')][_0x7049('0x23')]||null:null,'attributes':_0xf751e8[_0x7049('0x21')]?_0xf751e8[_0x7049('0x21')][_0x7049('0x24')]||null:null,'limit':_0xf751e8[_0x7049('0x21')]?_0xf751e8['options']['limit']||null:null})[_0x7049('0x25')](function(_0x420dd6){logger[_0x7049('0x1a')]('UpdateMailInteraction',_0xf751e8);logger['debug']('UpdateMailInteraction',_0xf751e8,JSON[_0x7049('0x16')](_0x420dd6));_0x37e1e0(_0x420dd6);})['catch'](function(_0x5ecf32){logger['error'](_0x7049('0x1d'),_0x5ecf32['message'],_0xf751e8);_0x4f6d46(_0x530e10[_0x7049('0x17')](0x1f4,_0x5ecf32[_0x7049('0x19')]));});});};exports[_0x7049('0x26')]=function(_0x8fd59b){return new Promise(function(_0x5f53ed,_0x5c75c3){return db[_0x7049('0x1e')]['find']({'where':_0x8fd59b[_0x7049('0x21')]?_0x8fd59b[_0x7049('0x21')][_0x7049('0x23')]||null:null})[_0x7049('0x25')](function(_0x2d8836){if(_0x2d8836){return _0x2d8836['addTags'](_0x8fd59b[_0x7049('0x20')][_0x7049('0x27')],_['omit'](_0x8fd59b[_0x7049('0x20')],['ids','id'])||{});}})['spread'](function(_0x2e159a){logger[_0x7049('0x1a')](_0x7049('0x28'),_0x8fd59b);logger[_0x7049('0x14')](_0x7049('0x28'),_0x8fd59b,JSON['stringify'](_0x2e159a));_0x5f53ed(_0x2e159a);})[_0x7049('0x1c')](function(_0x5ca6fb){logger['error'](_0x7049('0x28'),_0x5ca6fb[_0x7049('0x19')],_0x8fd59b);_0x5c75c3(_this['error'](0x1f4,_0x5ca6fb[_0x7049('0x19')]));});});}; \ No newline at end of file +var _0xc69b=['message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','stringify','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x570ced,_0x34262b){var _0x2cf1dc=function(_0x4823d9){while(--_0x4823d9){_0x570ced['push'](_0x570ced['shift']());}};_0x2cf1dc(++_0x34262b);}(_0xc69b,0xcf));var _0xbc69=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xc69b[_0x4b7b69];return _0x173b4c;};'use strict';var _=require(_0xbc69('0x0'));var util=require('util');var moment=require(_0xbc69('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc69('0x2'));var fs=require('fs');var Redis=require(_0xbc69('0x3'));var db=require(_0xbc69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc69('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc69('0x6'));var client=jayson[_0xbc69('0x7')]['http']({'port':0x232a});config[_0xbc69('0x8')]=_[_0xbc69('0x9')](config[_0xbc69('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc69('0xa'))(new Redis(config[_0xbc69('0x8')]));require(_0xbc69('0xb'))[_0xbc69('0xc')](socket);function respondWithRpcPromise(_0x3adb11,_0x57be21,_0x181560){return new BPromise(function(_0x2e8394,_0xd7337e){return client[_0xbc69('0xd')](_0x3adb11,_0x181560)[_0xbc69('0xe')](function(_0x5dc950){logger[_0xbc69('0xf')](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));logger[_0xbc69('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x57be21,_0xbc69('0x11'),JSON['stringify'](_0x5dc950));if(_0x5dc950[_0xbc69('0x13')]){if(_0x5dc950['error'][_0xbc69('0x14')]===0x1f4){logger[_0xbc69('0x13')]('MailInteraction,\x20%s,\x20%s',_0x57be21,_0x5dc950['error'][_0xbc69('0x15')]);return _0xd7337e(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);return _0x2e8394(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}else{logger['info'](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));_0x2e8394(_0x5dc950[_0xbc69('0x16')][_0xbc69('0x15')]);}})[_0xbc69('0x17')](function(_0x4cca15){logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x4cca15);_0xd7337e(_0x4cca15);});});}exports[_0xbc69('0x18')]=function(_0x19aa26){var _0x1ba59f=this;return new Promise(function(_0x71fbd9,_0x4e00ec){return db[_0xbc69('0x19')][_0xbc69('0x1a')](_0x19aa26[_0xbc69('0x1b')],{'raw':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null,'attributes':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')]['attributes']||null:null,'limit':_0x19aa26['options']?_0x19aa26[_0xbc69('0x1c')]['limit']||null:null})[_0xbc69('0xe')](function(_0x47d454){logger[_0xbc69('0xf')](_0xbc69('0x18'),_0x19aa26);logger['debug'](_0xbc69('0x18'),_0x19aa26,JSON[_0xbc69('0x1f')](_0x47d454));_0x71fbd9(_0x47d454);})[_0xbc69('0x17')](function(_0x4b22e5){logger[_0xbc69('0x13')]('UpdateMailInteraction',_0x4b22e5[_0xbc69('0x15')],_0x19aa26);_0x4e00ec(_0x1ba59f[_0xbc69('0x13')](0x1f4,_0x4b22e5[_0xbc69('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0xe424c2){return new Promise(function(_0x182473,_0x582908){return db[_0xbc69('0x19')][_0xbc69('0x20')]({'where':_0xe424c2[_0xbc69('0x1c')]?_0xe424c2[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null})['then'](function(_0x53a7f0){if(_0x53a7f0){return _0x53a7f0[_0xbc69('0x21')](_0xe424c2[_0xbc69('0x1b')][_0xbc69('0x22')],_[_0xbc69('0x23')](_0xe424c2[_0xbc69('0x1b')],[_0xbc69('0x22'),'id'])||{});}})[_0xbc69('0x24')](function(_0xc72391){logger[_0xbc69('0xf')](_0xbc69('0x25'),_0xe424c2);logger[_0xbc69('0x12')]('AddTags',_0xe424c2,JSON[_0xbc69('0x1f')](_0xc72391));_0x182473(_0xc72391);})['catch'](function(_0x54f6a6){logger[_0xbc69('0x13')](_0xbc69('0x25'),_0x54f6a6[_0xbc69('0x15')],_0xe424c2);_0x582908(_this['error'](0x1f4,_0x54f6a6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6a6e0d5..b2aa3d6 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 _0xe2ac=['emit','removeListener','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x3bed64,_0x257ade){var _0x728562=function(_0x3cc14a){while(--_0x3cc14a){_0x3bed64['push'](_0x3bed64['shift']());}};_0x728562(++_0x257ade);}(_0xe2ac,0x1c4));var _0xce2a=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0xe2ac[_0x38841c];return _0x500610;};'use strict';var MailInteractionEvents=require(_0xce2a('0x0'));var events=[_0xce2a('0x1'),_0xce2a('0x2'),'update'];function createListener(_0x2f9375,_0x33e092){return function(_0x29b72c){_0x33e092[_0xce2a('0x3')](_0x2f9375,_0x29b72c);};}function removeListener(_0x5869e8,_0x43065e){return function(){MailInteractionEvents[_0xce2a('0x4')](_0x5869e8,_0x43065e);};}exports['register']=function(_0x458e8c){for(var _0x39f753=0x0,_0x482917=events[_0xce2a('0x5')];_0x39f753<_0x482917;_0x39f753++){var _0xb86e38=events[_0x39f753];var _0x6d533d=createListener(_0xce2a('0x6')+_0xb86e38,_0x458e8c);MailInteractionEvents['on'](_0xb86e38,_0x6d533d);}}; \ No newline at end of file +var _0xeede=['mailInteraction:','./mailInteraction.events','save','remove','removeListener','register','length'];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0xeede,0x86));var _0xeeed=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xeede[_0x43e4b3];return _0x10c655;};'use strict';var MailInteractionEvents=require(_0xeeed('0x0'));var events=[_0xeeed('0x1'),_0xeeed('0x2'),'update'];function createListener(_0x3a03b1,_0x2f2b72){return function(_0x4120a8){_0x2f2b72['emit'](_0x3a03b1,_0x4120a8);};}function removeListener(_0x427cda,_0xb7c81f){return function(){MailInteractionEvents[_0xeeed('0x3')](_0x427cda,_0xb7c81f);};}exports[_0xeeed('0x4')]=function(_0xca8cde){for(var _0x138166=0x0,_0x240ef1=events[_0xeeed('0x5')];_0x138166<_0x240ef1;_0x138166++){var _0x4f5b23=events[_0x138166];var _0x2e32b6=createListener(_0xeeed('0x6')+_0x4f5b23,_0xca8cde);MailInteractionEvents['on'](_0x4f5b23,_0x2e32b6);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 045fe2d..98eac6e 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e08=['/describe','describe','exports','Router','./mailInteractionHasTag.controller','get'];(function(_0x5853a8,_0x5694fa){var _0x58a249=function(_0x32ccee){while(--_0x32ccee){_0x5853a8['push'](_0x5853a8['shift']());}};_0x58a249(++_0x5694fa);}(_0x8e08,0xf9));var _0x88e0=function(_0x288451,_0x18f126){_0x288451=_0x288451-0x0;var _0x34b340=_0x8e08[_0x288451];return _0x34b340;};'use strict';var express=require('express');var router=express[_0x88e0('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x88e0('0x1'));router[_0x88e0('0x2')](_0x88e0('0x3'),auth['isAuthenticated'](),controller[_0x88e0('0x4')]);module[_0x88e0('0x5')]=router; \ No newline at end of file +var _0xb934=['describe','exports','express','Router','../../components/auth/service','get','/describe','isAuthenticated'];(function(_0x22e26e,_0x3144fc){var _0x57c32d=function(_0x464cdb){while(--_0x464cdb){_0x22e26e['push'](_0x22e26e['shift']());}};_0x57c32d(++_0x3144fc);}(_0xb934,0x92));var _0x4b93=function(_0x5a7123,_0xf3d016){_0x5a7123=_0x5a7123-0x0;var _0x166efc=_0xb934[_0x5a7123];return _0x166efc;};'use strict';var express=require(_0x4b93('0x0'));var router=express[_0x4b93('0x1')]();var auth=require(_0x4b93('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x4b93('0x3')](_0x4b93('0x4'),auth[_0x4b93('0x5')](),controller[_0x4b93('0x6')]);module[_0x4b93('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 35b5437..43ac891 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x2d8fca,_0x2414f0){var _0xff5d5f=function(_0x40340f){while(--_0x40340f){_0x2d8fca['push'](_0x2d8fca['shift']());}};_0xff5d5f(++_0x2414f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4e4c09,_0x50f642){var _0x617d1d=function(_0x2fd7fb){while(--_0x2fd7fb){_0x4e4c09['push'](_0x4e4c09['shift']());}};_0x617d1d(++_0x50f642);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 8acbeaf..a839406 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7625=['sequelize','exports','INTEGER'];(function(_0x1bdb7d,_0x3a24bc){var _0x3c04d3=function(_0x1d3269){while(--_0x1d3269){_0x1bdb7d['push'](_0x1bdb7d['shift']());}};_0x3c04d3(++_0x3a24bc);}(_0x7625,0x10e));var _0x5762=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7625[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x5762('0x0'));module[_0x5762('0x1')]={'MailInteractionId':{'type':Sequelize[_0x5762('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x5762('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xd2ce=['INTEGER'];(function(_0x25a528,_0xa25773){var _0xe3dd11=function(_0x19547c){while(--_0x19547c){_0x25a528['push'](_0x25a528['shift']());}};_0xe3dd11(++_0xa25773);}(_0xd2ce,0x195));var _0xed2c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xd2ce[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize[_0xed2c('0x0')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xed2c('0x0')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index e88808d..dc4428c 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x961f=['MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x961f,0x174));var _0xf961=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x961f[_0x3511d3];return _0x5d6321;};'use strict';var attributes=require(_0xf961('0x0'));module[_0xf961('0x1')]=function(_0x48c456){return _0x48c456[_0xf961('0x2')](_0xf961('0x3'),attributes,{'tableName':_0xf961('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8231=['./mailInteractionHasTag','exports','mail_interaction_has_tags'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x8231,0x117));var _0x1823=function(_0x2612be,_0x2117dd){_0x2612be=_0x2612be-0x0;var _0x48ef56=_0x8231[_0x2612be];return _0x48ef56;};'use strict';var attributes=require(_0x1823('0x0'));module[_0x1823('0x1')]=function(_0x485ab8){return _0x485ab8['define']('MailInteractionHasTag',attributes,{'tableName':_0x1823('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 12dbff8..7c1a3fd 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 _0x4d4b=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','mail','mailmessage:create','create','update','put','/:id/reject','reject'];(function(_0x2ca359,_0x1f4e14){var _0x2dd4a6=function(_0x3aa9b9){while(--_0x3aa9b9){_0x2ca359['push'](_0x2ca359['shift']());}};_0x2dd4a6(++_0x1f4e14);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x4cb5bf,_0x2af510){_0x4cb5bf=_0x4cb5bf-0x0;var _0x293780=_0x4d4b[_0x4cb5bf];return _0x293780;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb4d4('0x0'));var timeout=require(_0xb4d4('0x1'));var express=require(_0xb4d4('0x2'));var router=express[_0xb4d4('0x3')]();var fs_extra=require(_0xb4d4('0x4'));var auth=require(_0xb4d4('0x5'));var interaction=require(_0xb4d4('0x6'));var config=require(_0xb4d4('0x7'));var controller=require(_0xb4d4('0x8'));router[_0xb4d4('0x9')]('/',auth[_0xb4d4('0xa')](),controller[_0xb4d4('0xb')]);router[_0xb4d4('0x9')](_0xb4d4('0xc'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0xd')]);router['get'](_0xb4d4('0xe'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0xf')]);router['get']('/:id/download',auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x10')]);router[_0xb4d4('0x11')]('/',auth[_0xb4d4('0xa')](),interaction['tracked'](_0xb4d4('0x12'),_0xb4d4('0x13')),controller[_0xb4d4('0x14')]);router['put'](_0xb4d4('0xe'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x15')]);router['put']('/:id/accept',auth[_0xb4d4('0xa')](),controller['accept']);router[_0xb4d4('0x16')](_0xb4d4('0x17'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x18')]);router[_0xb4d4('0x19')](_0xb4d4('0xe'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9c00=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe','isAuthenticated','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','express','Router'];(function(_0x2b06d9,_0x370826){var _0x22841b=function(_0x2fbad5){while(--_0x2fbad5){_0x2b06d9['push'](_0x2b06d9['shift']());}};_0x22841b(++_0x370826);}(_0x9c00,0x1a0));var _0x09c0=function(_0x35655f,_0x23dfc3){_0x35655f=_0x35655f-0x0;var _0x1f2ae8=_0x9c00[_0x35655f];return _0x1f2ae8;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),interaction[_0x09c0('0x10')](_0x09c0('0x11'),_0x09c0('0x12')),controller[_0x09c0('0x13')]);router[_0x09c0('0x14')](_0x09c0('0x15'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);router[_0x09c0('0x14')](_0x09c0('0x17'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x18')]);router[_0x09c0('0x14')](_0x09c0('0x19'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1a')]);router[_0x09c0('0x1b')](_0x09c0('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2727f6e..7fe6a37 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 _0xae87=['BOOLEAN','out','STRING','DATE','INTEGER','Email','long','TEXT'];(function(_0x118e53,_0x303bfe){var _0x157b26=function(_0x14a5af){while(--_0x14a5af){_0x118e53['push'](_0x118e53['shift']());}};_0x157b26(++_0x303bfe);}(_0xae87,0x1ce));var _0x7ae8=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0xae87[_0x3c5f8d];return _0x3b7beb;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize['TEXT'](_0x7ae8('0x0')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7ae8('0x1')]('medium')},'read':{'type':Sequelize[_0x7ae8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7ae8('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7ae8('0x4')](0x1fe)},'from':{'type':Sequelize[_0x7ae8('0x4')]},'to':{'type':Sequelize[_0x7ae8('0x1')]('long')},'cc':{'type':Sequelize[_0x7ae8('0x1')](_0x7ae8('0x0'))},'bcc':{'type':Sequelize[_0x7ae8('0x1')](_0x7ae8('0x0'))},'subject':{'type':Sequelize[_0x7ae8('0x1')]},'sentAt':{'type':Sequelize[_0x7ae8('0x5')]},'attach':{'type':Sequelize[_0x7ae8('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x7ae8('0x1')](_0x7ae8('0x0'))},'originCc':{'type':Sequelize['TEXT'](_0x7ae8('0x0'))},'originChannel':{'type':Sequelize['ENUM'](_0x7ae8('0x7'),'Chat'),'defaultValue':_0x7ae8('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x6b12=['lodash','exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE','Email','Chat','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b12,0x1a3));var _0x26b1=function(_0x538f84,_0x12c40a){_0x538f84=_0x538f84-0x0;var _0x43519e=_0x6b12[_0x538f84];return _0x43519e;};'use strict';var Sequelize=require(_0x26b1('0x0'));var _=require(_0x26b1('0x1'));module[_0x26b1('0x2')]={'body':{'type':Sequelize[_0x26b1('0x3')](_0x26b1('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x26b1('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x26b1('0x6')]('in',_0x26b1('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x26b1('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x26b1('0x3')](_0x26b1('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x26b1('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x26b1('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x26b1('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x26b1('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x26b1('0xb')]},'originTo':{'type':Sequelize['TEXT'](_0x26b1('0x4'))},'originCc':{'type':Sequelize[_0x26b1('0x3')](_0x26b1('0x4'))},'originChannel':{'type':Sequelize[_0x26b1('0x6')](_0x26b1('0xc'),_0x26b1('0xd')),'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 c44cd9f..645d48e 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 _0x989c=['User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','MailInteraction','download','unix','toString','server','tmp','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','MailMessage','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','body','find','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteractionId','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact'];(function(_0x5b7f09,_0x130cfe){var _0x258591=function(_0x5354b2){while(--_0x5354b2){_0x5b7f09['push'](_0x5b7f09['shift']());}};_0x258591(++_0x130cfe);}(_0x989c,0x15c));var _0xc989=function(_0x5e529f,_0x280b2d){_0x5e529f=_0x5e529f-0x0;var _0x88fe76=_0x989c[_0x5e529f];return _0x88fe76;};'use strict';var emlformat=require(_0xc989('0x0'));var moment=require(_0xc989('0x1'));var BPromise=require(_0xc989('0x2'));var util=require(_0xc989('0x3'));var path=require(_0xc989('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc989('0x5'));var htmlToText=require(_0xc989('0x6'));var qs=require(_0xc989('0x7'));var logger=require('../../config/logger')(_0xc989('0x8'));var interaction_log=require(_0xc989('0x9'))(_0xc989('0xa'));var config=require(_0xc989('0xb'));var db=require('../../mysqldb')['db'];config[_0xc989('0xc')]=_[_0xc989('0xd')](config[_0xc989('0xc')],{'host':_0xc989('0xe'),'port':0x18eb});var socket=require(_0xc989('0xf'))(new Redis(config[_0xc989('0xc')]));var htmlEntities=require(_0xc989('0x10'));require('./mailMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc989('0x11')][_0xc989('0x12')]({'port':0x232c});var client9003=jayson[_0xc989('0x11')]['http']({'port':0x232b});var client9002=jayson[_0xc989('0x11')][_0xc989('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x37e5c0,_0x5066f2,_0x4d2002,_0x158e50){return new BPromise(function(_0x5542c5,_0x1b6dcc){var _0x37a83f=_0x158e50||client;return _0x37a83f[_0xc989('0x13')](_0x37e5c0,_0x4d2002)['then'](function(_0x615e69){logger[_0xc989('0x14')](_0xc989('0x15'),_0x5066f2,_0xc989('0x16'));logger[_0xc989('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5066f2,_0xc989('0x16'),JSON[_0xc989('0x18')](_0x615e69));if(_0x615e69[_0xc989('0x19')]){if(_0x615e69[_0xc989('0x19')]['code']===0x1f4){logger[_0xc989('0x19')](_0xc989('0x15'),_0x5066f2,_0x615e69[_0xc989('0x19')][_0xc989('0x1a')]);return _0x1b6dcc(_0x615e69[_0xc989('0x19')][_0xc989('0x1a')]);}logger['error'](_0xc989('0x15'),_0x5066f2,_0x615e69['error'][_0xc989('0x1a')]);return _0x5542c5(_0x615e69[_0xc989('0x19')][_0xc989('0x1a')]);}else{logger[_0xc989('0x14')]('MailMessage,\x20%s,\x20%s',_0x5066f2,_0xc989('0x16'));_0x5542c5(_0x615e69[_0xc989('0x1b')]['message']);}})['catch'](function(_0x3b01fe){logger['error'](_0xc989('0x15'),_0x5066f2,_0x3b01fe);_0x1b6dcc(_0x3b01fe);});});}function respondWithResult(_0xcd5a51,_0x44129b){_0x44129b=_0x44129b||0xc8;return function(_0x5634d8){if(_0x5634d8){return _0xcd5a51['status'](_0x44129b)[_0xc989('0x1c')](_0x5634d8);}};}function respondWithFilteredResult(_0x6d3467,_0x1622c6){return function(_0xf0538a){if(_0xf0538a){var _0x198063=typeof _0x1622c6[_0xc989('0x1d')]===_0xc989('0x1e')&&typeof _0x1622c6[_0xc989('0x1f')]===_0xc989('0x1e');var _0x357f3e=_0xf0538a[_0xc989('0x20')];var _0x60d22f=_0x198063?0x0:_0x1622c6['offset'];var _0x15df95=_0x198063?_0xf0538a[_0xc989('0x20')]:_0x1622c6[_0xc989('0x1d')]+_0x1622c6['limit'];var _0x13a27e;if(_0x15df95>=_0x357f3e){_0x15df95=_0x357f3e;_0x13a27e=0xc8;}else{_0x13a27e=0xce;}_0x6d3467[_0xc989('0x21')](_0x13a27e);return _0x6d3467[_0xc989('0x22')](_0xc989('0x23'),_0x60d22f+'-'+_0x15df95+'/'+_0x357f3e)[_0xc989('0x1c')](_0xf0538a);}return null;};}function saveUpdates(_0x414fe1){return function(_0x15302f){if(_0x15302f){return _0x15302f[_0xc989('0x24')](_0x414fe1)[_0xc989('0x25')](function(_0x34995b){return _0x34995b;});}return null;};}function removeEntity(_0xeebd2c){return function(_0xd0461){if(_0xd0461){return _0xd0461[_0xc989('0x26')]()[_0xc989('0x25')](function(){_0xeebd2c[_0xc989('0x21')](0xcc)[_0xc989('0x27')]();});}};}function handleEntityNotFound(_0x1ba7b2){return function(_0x3050ca){if(!_0x3050ca){_0x1ba7b2[_0xc989('0x28')](0x194);}return _0x3050ca;};}function handleError(_0x8dd232,_0x46a033){_0x46a033=_0x46a033||0x1f4;return function(_0x2eddfa){logger[_0xc989('0x19')](_0x2eddfa['stack']);if(_0x2eddfa[_0xc989('0x29')]){delete _0x2eddfa[_0xc989('0x29')];}_0x8dd232['status'](_0x46a033)[_0xc989('0x2a')](_0x2eddfa);};}exports[_0xc989('0x2b')]=function(_0x1933ff,_0x2befc9){var _0x27e37d={},_0x284d99={},_0x19c778={'count':0x0,'rows':[]};var _0x1a6b1c=_['map'](db[_0xc989('0x2c')][_0xc989('0x2d')],function(_0x2361d9){return{'name':_0x2361d9['fieldName'],'type':_0x2361d9['type'][_0xc989('0x2e')]};});_0x284d99['model']=_['map'](_0x1a6b1c,_0xc989('0x29'));_0x284d99[_0xc989('0x2f')]=_[_0xc989('0x30')](_0x1933ff['query']);_0x284d99[_0xc989('0x31')]=_[_0xc989('0x32')](_0x284d99[_0xc989('0x33')],_0x284d99[_0xc989('0x2f')]);_0x27e37d['attributes']=_[_0xc989('0x32')](_0x284d99[_0xc989('0x33')],qs[_0xc989('0x34')](_0x1933ff['query'][_0xc989('0x34')]));_0x27e37d[_0xc989('0x35')]=_0x27e37d['attributes'][_0xc989('0x36')]?_0x27e37d[_0xc989('0x35')]:_0x284d99[_0xc989('0x33')];if(!_0x1933ff[_0xc989('0x2f')][_0xc989('0x37')](_0xc989('0x38'))){_0x27e37d[_0xc989('0x1f')]=qs[_0xc989('0x1f')](_0x1933ff['query'][_0xc989('0x1f')]);_0x27e37d[_0xc989('0x1d')]=qs['offset'](_0x1933ff[_0xc989('0x2f')][_0xc989('0x1d')]);}_0x27e37d['order']=qs[_0xc989('0x39')](_0x1933ff[_0xc989('0x2f')][_0xc989('0x39')]);_0x27e37d[_0xc989('0x3a')]=qs[_0xc989('0x31')](_[_0xc989('0x3b')](_0x1933ff[_0xc989('0x2f')],_0x284d99[_0xc989('0x31')]),_0x1a6b1c);if(_0x1933ff[_0xc989('0x2f')][_0xc989('0x3c')]){_0x27e37d[_0xc989('0x3a')]=_['merge'](_0x27e37d['where'],{'$or':_[_0xc989('0x3d')](_0x1a6b1c,function(_0x11b3eb){if(_0x11b3eb[_0xc989('0x3e')]!==_0xc989('0x3f')){var _0x1ad518={};_0x1ad518[_0x11b3eb[_0xc989('0x29')]]={'$like':'%'+_0x1933ff[_0xc989('0x2f')][_0xc989('0x3c')]+'%'};return _0x1ad518;}})});}_0x27e37d=_[_0xc989('0x40')]({},_0x27e37d,_0x1933ff[_0xc989('0x41')]);var _0x131ca2={'where':_0x27e37d[_0xc989('0x3a')]};return db[_0xc989('0x2c')][_0xc989('0x20')](_0x131ca2)[_0xc989('0x25')](function(_0x43f1e2){_0x19c778['count']=_0x43f1e2;if(_0x1933ff[_0xc989('0x2f')][_0xc989('0x42')]){_0x27e37d['include']=[{'all':!![]}];}return db[_0xc989('0x2c')][_0xc989('0x43')](_0x27e37d);})['then'](function(_0x5216df){_0x19c778['rows']=_0x5216df;return _0x19c778;})['then'](respondWithFilteredResult(_0x2befc9,_0x27e37d))[_0xc989('0x44')](handleError(_0x2befc9,null));};exports[_0xc989('0x45')]=function(_0x32664c,_0x4068f5){var _0x5c8564={'raw':!![],'where':{'id':_0x32664c[_0xc989('0x46')]['id']}},_0xa10d64={};_0xa10d64[_0xc989('0x33')]=_[_0xc989('0x30')](db[_0xc989('0x2c')][_0xc989('0x2d')]);_0xa10d64[_0xc989('0x2f')]=_[_0xc989('0x30')](_0x32664c[_0xc989('0x2f')]);_0xa10d64[_0xc989('0x31')]=_[_0xc989('0x32')](_0xa10d64[_0xc989('0x33')],_0xa10d64[_0xc989('0x2f')]);_0x5c8564[_0xc989('0x35')]=_['intersection'](_0xa10d64['model'],qs['fields'](_0x32664c[_0xc989('0x2f')]['fields']));_0x5c8564['attributes']=_0x5c8564[_0xc989('0x35')][_0xc989('0x36')]?_0x5c8564['attributes']:_0xa10d64[_0xc989('0x33')];if(_0x32664c[_0xc989('0x2f')][_0xc989('0x42')]){_0x5c8564[_0xc989('0x47')]=[{'all':!![]}];}_0x5c8564=_[_0xc989('0x40')]({},_0x5c8564,_0x32664c[_0xc989('0x41')]);return db[_0xc989('0x2c')]['find'](_0x5c8564)[_0xc989('0x25')](handleEntityNotFound(_0x4068f5,null))[_0xc989('0x25')](respondWithResult(_0x4068f5,null))[_0xc989('0x44')](handleError(_0x4068f5,null));};exports['update']=function(_0x3ae522,_0x57e50c){if(_0x3ae522[_0xc989('0x48')]['id']){delete _0x3ae522[_0xc989('0x48')]['id'];}return db[_0xc989('0x2c')][_0xc989('0x49')]({'where':{'id':_0x3ae522[_0xc989('0x46')]['id']}})[_0xc989('0x25')](handleEntityNotFound(_0x57e50c,null))[_0xc989('0x25')](saveUpdates(_0x3ae522[_0xc989('0x48')],null))['then'](respondWithResult(_0x57e50c,null))[_0xc989('0x44')](handleError(_0x57e50c,null));};exports[_0xc989('0x26')]=function(_0x1fd121,_0x2be09b){return db[_0xc989('0x2c')][_0xc989('0x49')]({'where':{'id':_0x1fd121['params']['id']}})['then'](handleEntityNotFound(_0x2be09b,null))['then'](removeEntity(_0x2be09b,null))['catch'](handleError(_0x2be09b,null));};exports[_0xc989('0x4a')]=function(_0x412cf3,_0x233175){return db[_0xc989('0x2c')]['describe']()[_0xc989('0x25')](respondWithResult(_0x233175,null))[_0xc989('0x44')](handleError(_0x233175,null));};exports[_0xc989('0x4b')]=function(_0x2d07e3,_0x573a7e){return db[_0xc989('0x2c')][_0xc989('0x4b')](_0x2d07e3[_0xc989('0x48')])[_0xc989('0x25')](function(_0x57e6b2){if(_0x57e6b2){if(_0x57e6b2[_0xc989('0x4c')]==='out'&&!_0x57e6b2[_0xc989('0x4d')]){var _0x3c4b6a,_0x2f1a94,_0x46fa0c;if(_0x2d07e3['body']['to']){_0x2f1a94=_0x2d07e3[_0xc989('0x48')]['to']['split'](',')[0x0];}return db[_0xc989('0x4e')][_0xc989('0x4f')]({'where':{'id':_0x57e6b2[_0xc989('0x50')]},'include':[{'model':db[_0xc989('0x51')],'as':_0xc989('0x52'),'include':[{'model':db[_0xc989('0x53')],'as':_0xc989('0x54'),'where':{'email':_0x2f1a94},'limit':0x1,'order':[['updatedAt',_0xc989('0x55')]]}]},{'model':db[_0xc989('0x56')],'as':_0xc989('0x57'),'raw':!![],'include':[{'model':db[_0xc989('0x58')],'as':'CloudProvider','raw':!![]}]}]})[_0xc989('0x25')](function(_0x546fff){_0x3c4b6a=_0x546fff;if(!_0x3c4b6a||!_0x3c4b6a['Smtp'])return;var _0x53f1a4=_0x3c4b6a['getSmtpOptions']();if(_0x2d07e3['body'][_0xc989('0x59')]&&_0x2d07e3[_0xc989('0x48')][_0xc989('0x59')]['length']){for(var _0x261d0d=0x0;_0x261d0d<_0x2d07e3[_0xc989('0x48')][_0xc989('0x59')]['length'];_0x261d0d+=0x1){_0x2d07e3[_0xc989('0x48')][_0xc989('0x59')][_0x261d0d]={'filename':_0x2d07e3['body'][_0xc989('0x59')][_0x261d0d][_0xc989('0x29')],'path':path[_0xc989('0x5a')](config[_0xc989('0x5b')],'server/files/attachments',_0x2d07e3['body'][_0xc989('0x59')][_0x261d0d]['basename'])};}}_0x46fa0c={'account':_0x53f1a4,'message':_0x2d07e3[_0xc989('0x48')]};return;})[_0xc989('0x25')](function(){if(_0x3c4b6a[_0xc989('0x52')]){if(_0x3c4b6a[_0xc989('0x52')][_0xc989('0x54')]['length']){return _0x3c4b6a['List'][_0xc989('0x54')][0x0];}else{return db['CmContact'][_0xc989('0x4b')](_[_0xc989('0xd')](_0x2d07e3[_0xc989('0x48')],{'firstName':_0x2d07e3['body']['to'],'email':_0x2d07e3[_0xc989('0x48')]['to'],'phone':_0x2d07e3[_0xc989('0x48')]['to'],'ListId':_0x3c4b6a[_0xc989('0x5c')]}));}}else{throw new Error(_0xc989('0x5d'));}})[_0xc989('0x25')](function(){if(_0x46fa0c){return respondWithRpcPromise('SendMail',_0xc989('0x5e'),_0x46fa0c,client9003)[_0xc989('0x25')](function(_0xe1da46){return _0x57e6b2['update']({'read':!![],'messageId':_0xe1da46[_0xc989('0x5f')],'sentAt':moment()['format'](_0xc989('0x60'))});})[_0xc989('0x44')](function(_0x57249c){logger[_0xc989('0x19')]('%s',JSON[_0xc989('0x18')](_0x57249c));return _0x57e6b2;});}return _0x57e6b2;});}return _0x57e6b2;}})[_0xc989('0x25')](respondWithResult(_0x573a7e,0xc9))[_0xc989('0x44')](handleError(_0x573a7e,null));};exports[_0xc989('0x61')]=function(_0x5e3d44,_0x311f0e){var _0xc62f74={'agent':{},'channel':'mail'};if(_0x5e3d44[_0xc989('0x48')]['id']){delete _0x5e3d44[_0xc989('0x48')]['id'];}_0x5e3d44['body'][_0xc989('0x62')]=!![];_0x5e3d44[_0xc989('0x48')][_0xc989('0x63')]=moment()['format'](_0xc989('0x60'));_0x5e3d44[_0xc989('0x48')][_0xc989('0x64')]=_0x5e3d44[_0xc989('0x48')][_0xc989('0x64')]||_0x5e3d44['user']['id'];_0xc62f74[_0xc989('0x65')]['id']=_0x5e3d44[_0xc989('0x48')]['UserId'];return db[_0xc989('0x2c')]['find']({'where':{'id':_0x5e3d44[_0xc989('0x46')]['id'],'UserId':null}})[_0xc989('0x25')](handleEntityNotFound(_0x311f0e,null))[_0xc989('0x25')](saveUpdates(_0x5e3d44[_0xc989('0x48')],null))[_0xc989('0x25')](function(_0x3b697f){if(_0x3b697f){_0xc62f74['message']=_0x3b697f[_0xc989('0x66')]({'plain':!![]});return db['MailInteraction'][_0xc989('0x49')]({'where':{'id':_0x3b697f[_0xc989('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x311f0e,null))[_0xc989('0x25')](function(_0x241732){if(_0x241732){return _0x241732[_0xc989('0x24')]({'UserId':_0x5e3d44[_0xc989('0x48')][_0xc989('0x64')],'read1stAt':_[_0xc989('0x68')](_0x241732[_0xc989('0x69')])?moment()[_0xc989('0x6a')](_0xc989('0x60')):undefined});}return null;})[_0xc989('0x25')](function(_0x47d241){if(_0x47d241){_0xc62f74[_0xc989('0x6b')]=_0x47d241[_0xc989('0x66')]({'plain':!![]});interaction_log[_0xc989('0x14')](_0xc989('0x6c'),_0x5e3d44['user']['id'],_0x5e3d44[_0xc989('0x6d')]['name'],_0x5e3d44[_0xc989('0x6d')][_0xc989('0x6e')],_0xc62f74[_0xc989('0x6b')]['id'],_0x5e3d44[_0xc989('0x48')]?JSON[_0xc989('0x18')](_0x5e3d44[_0xc989('0x48')]):_0xc989('0x6f'));return respondWithRpcPromise(_0xc989('0x70'),'acceptMessage',_0xc62f74);}return null;})[_0xc989('0x25')](function(_0xc63d2f){var _0x4eec47=_0xc989('0x71')+_0xc63d2f['message'][_0xc989('0x72')];return db[_0xc989('0x73')][_0xc989('0x2f')](_0x4eec47,{'type':db[_0xc989('0x74')][_0xc989('0x75')][_0xc989('0x76')],'raw':!![]})[_0xc989('0x25')](function(_0x855dd6){return _0x855dd6;});})[_0xc989('0x25')](function(_0x23bd20){if(_0x23bd20){_0xc62f74[_0xc989('0x1a')][_0xc989('0x77')]=_0x23bd20[0x0];if(!_0x5e3d44[_0xc989('0x48')]['UserId'])return;return db[_0xc989('0x78')][_0xc989('0x49')]({'where':{'id':_0x5e3d44[_0xc989('0x48')][_0xc989('0x64')],'role':'agent'},'attributes':['id',_0xc989('0x29'),_0xc989('0x79'),_0xc989('0x7a'),_0xc989('0x7b')],'raw':!![]});}return null;})[_0xc989('0x25')](function(_0x2e030d){if(!_0x2e030d)return null;_0xc62f74[_0xc989('0x1a')]['agent']=_0x2e030d;return _0xc62f74;})[_0xc989('0x25')](function(_0x414164){if(_0x414164){if(_0x5e3d44['body'][_0xc989('0x7c')]){_0xc62f74[_0xc989('0x1a')][_0xc989('0x7d')]=util[_0xc989('0x6a')](_0xc989('0x7e'),_0x5e3d44[_0xc989('0x6d')][_0xc989('0x29')]);_0xc62f74[_0xc989('0x1a')][_0xc989('0x7f')]=_0xc62f74['channel'];_0xc62f74[_0xc989('0x1a')][_0xc989('0x80')]=_0xc62f74['channel'];_0xc62f74[_0xc989('0x1a')][_0xc989('0x81')]='accept';_0xc62f74[_0xc989('0x1a')][_0xc989('0x48')]=htmlToText[_0xc989('0x82')](_0xc62f74[_0xc989('0x1a')]['body']);return respondWithRpcPromise(_0xc989('0x83'),'EventManager',{'event':_0xc989('0x84'),'message':_0xc62f74[_0xc989('0x1a')]},client9002)[_0xc989('0x25')](function(){return _0xc62f74;});}return _0xc62f74;}return null;})[_0xc989('0x25')](respondWithResult(_0x311f0e,null))['catch'](handleError(_0x311f0e,null));};exports[_0xc989('0x85')]=function(_0x47c726,_0x2fd368){var _0x522847={'agent':{},'channel':_0xc989('0x86')};if(_0x47c726[_0xc989('0x48')]['id']){delete _0x47c726['body']['id'];}_0x47c726[_0xc989('0x48')][_0xc989('0x64')]=_0x47c726[_0xc989('0x48')][_0xc989('0x64')]||_0x47c726[_0xc989('0x6d')]['id'];_0x522847[_0xc989('0x65')]['id']=_0x47c726[_0xc989('0x48')][_0xc989('0x64')];return db['MailMessage']['find']({'where':{'id':_0x47c726['params']['id'],'UserId':null}})[_0xc989('0x25')](handleEntityNotFound(_0x2fd368,null))[_0xc989('0x25')](function(_0x46cb6f){if(_0x46cb6f){_0x522847[_0xc989('0x1a')]=_0x46cb6f[_0xc989('0x66')]({'plain':!![]});return db[_0xc989('0x87')][_0xc989('0x49')]({'where':{'id':_0x46cb6f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2fd368,null))[_0xc989('0x25')](function(_0x1ad9aa){if(_0x1ad9aa){_0x522847['interaction']=_0x1ad9aa[_0xc989('0x66')]({'plain':!![]});interaction_log[_0xc989('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47c726['user']['id'],_0x47c726[_0xc989('0x6d')][_0xc989('0x29')],_0x47c726[_0xc989('0x6d')][_0xc989('0x6e')],_0x522847[_0xc989('0x6b')]['id'],_0x47c726[_0xc989('0x48')]?JSON[_0xc989('0x18')](_0x47c726[_0xc989('0x48')]):_0xc989('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x522847);}return null;})[_0xc989('0x25')](function(_0x296e45){var _0x52b19c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x296e45[_0xc989('0x1a')]['ContactId'];return db[_0xc989('0x73')][_0xc989('0x2f')](_0x52b19c,{'type':db[_0xc989('0x74')][_0xc989('0x75')][_0xc989('0x76')],'raw':!![]})[_0xc989('0x25')](function(_0x5bd178){return _0x5bd178;});})['then'](function(_0x5ceef9){if(_0x5ceef9){_0x522847[_0xc989('0x1a')][_0xc989('0x77')]=_0x5ceef9[0x0];if(!_0x47c726[_0xc989('0x48')][_0xc989('0x64')])return;return db[_0xc989('0x78')][_0xc989('0x49')]({'where':{'id':_0x47c726[_0xc989('0x48')][_0xc989('0x64')],'role':_0xc989('0x65')},'attributes':['id',_0xc989('0x29'),_0xc989('0x79'),_0xc989('0x7a'),_0xc989('0x7b')],'raw':!![]});}return null;})[_0xc989('0x25')](function(_0x6944ae){if(!_0x6944ae)return null;_0x522847[_0xc989('0x1a')]['agent']=_0x6944ae;return _0x522847;})['then'](function(_0x348ed7){if(_0x348ed7){_0x348ed7[_0xc989('0x1a')][_0xc989('0x7d')]=util[_0xc989('0x6a')](_0xc989('0x7e'),_0x47c726[_0xc989('0x6d')][_0xc989('0x29')]);_0x348ed7[_0xc989('0x1a')][_0xc989('0x7f')]=_0x522847[_0xc989('0x7f')];_0x348ed7['message'][_0xc989('0x80')]=_0x522847['channel'];_0x348ed7[_0xc989('0x1a')][_0xc989('0x81')]='reject';_0x348ed7[_0xc989('0x1a')]['body']=htmlToText['fromString'](_0x522847['message'][_0xc989('0x48')]);respondWithRpcPromise('EventManager',_0xc989('0x83'),{'event':'rejectmessage','message':_0x348ed7[_0xc989('0x1a')]},client9002);return _0x522847;}return null;})[_0xc989('0x25')](respondWithResult(_0x2fd368,null))[_0xc989('0x44')](handleError(_0x2fd368,null));};exports[_0xc989('0x88')]=function(_0x3d7b48,_0x55d97c){var _0x319708=moment()[_0xc989('0x89')]()[_0xc989('0x8a')]();var _0x14e197=path[_0xc989('0x5a')](config['root'],_0xc989('0x8b'),'files',_0xc989('0x8c'));var _0x337023=path[_0xc989('0x5a')](config[_0xc989('0x5b')],_0xc989('0x8b'),_0xc989('0x8d'),_0xc989('0x59'));var _0x2cdca3=util[_0xc989('0x6a')](_0xc989('0x8e'),_0x319708);return db[_0xc989('0x2c')][_0xc989('0x49')]({'where':{'id':_0x3d7b48[_0xc989('0x46')]['id']},'attributes':['id',_0xc989('0x48'),_0xc989('0x8f'),'to','cc','bcc',_0xc989('0x90'),_0xc989('0x91')],'include':_0x3d7b48[_0xc989('0x2f')][_0xc989('0x59')]?[{'model':db[_0xc989('0x92')],'as':_0xc989('0x93')}]:undefined})[_0xc989('0x25')](handleEntityNotFound(_0x55d97c,null))[_0xc989('0x25')](function(_0x132b1b){if(_0x132b1b){var _0x4dc4c5=_0x132b1b;var _0xf385e7={'from':_0x4dc4c5['from'],'to':_0x4dc4c5['to'],'subject':_0x4dc4c5['subject'],'html':htmlEntities['decode'](_0x4dc4c5[_0xc989('0x48')]),'headers':{'Date':moment(_0x4dc4c5[_0xc989('0x91')])['format'](_0xc989('0x94'))},'attachments':[]};if(_0x132b1b['cc']){_0xf385e7[_0xc989('0x95')]['Cc']=_0x132b1b['cc'];}if(_0x132b1b['bcc']){_0xf385e7[_0xc989('0x95')]['Bcc']=_0x132b1b[_0xc989('0x96')];}return new BPromise(function(_0x263551,_0xc8803f){if(_0x132b1b[_0xc989('0x93')]){for(var _0x6960e=0x0;_0x6960e<_0x132b1b[_0xc989('0x93')][_0xc989('0x36')];_0x6960e++){var _0x385a68=_0x132b1b['Attachments'][_0x6960e];var _0x5a4747=path[_0xc989('0x5a')](_0x337023,_0x385a68[_0xc989('0x97')]);if(fs['existsSync'](_0x5a4747)){_0xf385e7[_0xc989('0x59')][_0xc989('0x98')]({'name':_0x385a68[_0xc989('0x29')],'contentType':_0x385a68['type'],'data':fs['readFileSync'](_0x5a4747)});}}}emlformat[_0xc989('0x99')](_0xf385e7,function(_0xb29a6b,_0x2f2517){if(_0xb29a6b)return _0xc8803f(_0xb29a6b);fs[_0xc989('0x9a')](path[_0xc989('0x5a')](_0x14e197,_0x2cdca3),_0x2f2517);return _0x263551(_0x2f2517);});});}})[_0xc989('0x25')](function(_0x50a2df){if(_0x50a2df){return _0x55d97c[_0xc989('0x88')](path[_0xc989('0x5a')](_0x14e197,_0x2cdca3),_0x2cdca3,function(_0x21780b){if(!_0x21780b)fs[_0xc989('0x9b')](path[_0xc989('0x5a')](_0x14e197,_0x2cdca3));});}})['catch'](handleError(_0x55d97c,null));}; \ No newline at end of file +var _0xd574=['rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','email','internal','reject','rejectmessage','toString','files','tmp','server','Attachment','Attachments','from','subject','decode','bcc','headers','push','readFileSync','build','download','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','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','result','catch','status','json','offset','undefined','limit','Content-Range','update','destroy','end','sendStatus','stack','send','map','MailMessage','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','keys','find','body','params','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','user','agent','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x4c6290,_0x2221ae){var _0x1798d8=function(_0x1d353b){while(--_0x1d353b){_0x4c6290['push'](_0x4c6290['shift']());}};_0x1798d8(++_0x2221ae);}(_0xd574,0xb4));var _0x4d57=function(_0x2592cc,_0x275ff7){_0x2592cc=_0x2592cc-0x0;var _0x57197b=_0xd574[_0x2592cc];return _0x57197b;};'use strict';var emlformat=require(_0x4d57('0x0'));var moment=require(_0x4d57('0x1'));var BPromise=require(_0x4d57('0x2'));var util=require(_0x4d57('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x4d57('0x4'));var Redis=require(_0x4d57('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x4d57('0x6'));var logger=require(_0x4d57('0x7'))(_0x4d57('0x8'));var interaction_log=require(_0x4d57('0x7'))(_0x4d57('0x9'));var config=require(_0x4d57('0xa'));var db=require(_0x4d57('0xb'))['db'];config[_0x4d57('0xc')]=_['defaults'](config[_0x4d57('0xc')],{'host':_0x4d57('0xd'),'port':0x18eb});var socket=require(_0x4d57('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x4d57('0xf'))[_0x4d57('0x10')](socket);var jayson=require(_0x4d57('0x11'));var client=jayson[_0x4d57('0x12')][_0x4d57('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x4d57('0x13')]({'port':0x232b});var client9002=jayson['client'][_0x4d57('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x169adc,_0x54ec2d,_0x281fd4,_0x433c06){return new BPromise(function(_0x1e3539,_0x3fae9c){var _0x52a5f3=_0x433c06||client;return _0x52a5f3[_0x4d57('0x14')](_0x169adc,_0x281fd4)[_0x4d57('0x15')](function(_0x1eae94){logger[_0x4d57('0x16')](_0x4d57('0x17'),_0x54ec2d,_0x4d57('0x18'));logger[_0x4d57('0x19')](_0x4d57('0x1a'),_0x54ec2d,_0x4d57('0x18'),JSON[_0x4d57('0x1b')](_0x1eae94));if(_0x1eae94[_0x4d57('0x1c')]){if(_0x1eae94['error']['code']===0x1f4){logger[_0x4d57('0x1c')](_0x4d57('0x17'),_0x54ec2d,_0x1eae94[_0x4d57('0x1c')][_0x4d57('0x1d')]);return _0x3fae9c(_0x1eae94[_0x4d57('0x1c')][_0x4d57('0x1d')]);}logger[_0x4d57('0x1c')]('MailMessage,\x20%s,\x20%s',_0x54ec2d,_0x1eae94[_0x4d57('0x1c')]['message']);return _0x1e3539(_0x1eae94['error'][_0x4d57('0x1d')]);}else{logger[_0x4d57('0x16')]('MailMessage,\x20%s,\x20%s',_0x54ec2d,_0x4d57('0x18'));_0x1e3539(_0x1eae94[_0x4d57('0x1e')][_0x4d57('0x1d')]);}})[_0x4d57('0x1f')](function(_0x3ff658){logger[_0x4d57('0x1c')](_0x4d57('0x17'),_0x54ec2d,_0x3ff658);_0x3fae9c(_0x3ff658);});});}function respondWithResult(_0x55040f,_0x2d9e17){_0x2d9e17=_0x2d9e17||0xc8;return function(_0x30d4d6){if(_0x30d4d6){return _0x55040f[_0x4d57('0x20')](_0x2d9e17)[_0x4d57('0x21')](_0x30d4d6);}};}function respondWithFilteredResult(_0x535c01,_0x3bd468){return function(_0x24eb82){if(_0x24eb82){var _0x2123bd=typeof _0x3bd468[_0x4d57('0x22')]===_0x4d57('0x23')&&typeof _0x3bd468[_0x4d57('0x24')]===_0x4d57('0x23');var _0x14b0da=_0x24eb82['count'];var _0x22d0b5=_0x2123bd?0x0:_0x3bd468[_0x4d57('0x22')];var _0x5e1916=_0x2123bd?_0x24eb82['count']:_0x3bd468[_0x4d57('0x22')]+_0x3bd468[_0x4d57('0x24')];var _0x2f1a25;if(_0x5e1916>=_0x14b0da){_0x5e1916=_0x14b0da;_0x2f1a25=0xc8;}else{_0x2f1a25=0xce;}_0x535c01['status'](_0x2f1a25);return _0x535c01['set'](_0x4d57('0x25'),_0x22d0b5+'-'+_0x5e1916+'/'+_0x14b0da)[_0x4d57('0x21')](_0x24eb82);}return null;};}function saveUpdates(_0x5a191f){return function(_0x40dc79){if(_0x40dc79){return _0x40dc79[_0x4d57('0x26')](_0x5a191f)[_0x4d57('0x15')](function(_0x56ff85){return _0x56ff85;});}return null;};}function removeEntity(_0x35071d){return function(_0x5574f0){if(_0x5574f0){return _0x5574f0[_0x4d57('0x27')]()[_0x4d57('0x15')](function(){_0x35071d[_0x4d57('0x20')](0xcc)[_0x4d57('0x28')]();});}};}function handleEntityNotFound(_0x1ab593){return function(_0x4043d7){if(!_0x4043d7){_0x1ab593[_0x4d57('0x29')](0x194);}return _0x4043d7;};}function handleError(_0x3a5d0a,_0x23fbd8){_0x23fbd8=_0x23fbd8||0x1f4;return function(_0x3b6d08){logger[_0x4d57('0x1c')](_0x3b6d08[_0x4d57('0x2a')]);if(_0x3b6d08['name']){delete _0x3b6d08['name'];}_0x3a5d0a[_0x4d57('0x20')](_0x23fbd8)[_0x4d57('0x2b')](_0x3b6d08);};}exports['index']=function(_0x3bba68,_0x3f7d61){var _0x15d933={},_0x9ed347={},_0x53830c={'count':0x0,'rows':[]};var _0x3d9694=_[_0x4d57('0x2c')](db[_0x4d57('0x2d')][_0x4d57('0x2e')],function(_0x1ef1ca){return{'name':_0x1ef1ca[_0x4d57('0x2f')],'type':_0x1ef1ca[_0x4d57('0x30')][_0x4d57('0x31')]};});_0x9ed347['model']=_[_0x4d57('0x2c')](_0x3d9694,_0x4d57('0x32'));_0x9ed347['query']=_['keys'](_0x3bba68[_0x4d57('0x33')]);_0x9ed347[_0x4d57('0x34')]=_[_0x4d57('0x35')](_0x9ed347['model'],_0x9ed347['query']);_0x15d933[_0x4d57('0x36')]=_[_0x4d57('0x35')](_0x9ed347[_0x4d57('0x37')],qs['fields'](_0x3bba68[_0x4d57('0x33')][_0x4d57('0x38')]));_0x15d933[_0x4d57('0x36')]=_0x15d933['attributes'][_0x4d57('0x39')]?_0x15d933[_0x4d57('0x36')]:_0x9ed347['model'];if(!_0x3bba68['query'][_0x4d57('0x3a')]('nolimit')){_0x15d933[_0x4d57('0x24')]=qs[_0x4d57('0x24')](_0x3bba68[_0x4d57('0x33')]['limit']);_0x15d933[_0x4d57('0x22')]=qs['offset'](_0x3bba68['query'][_0x4d57('0x22')]);}_0x15d933['order']=qs[_0x4d57('0x3b')](_0x3bba68['query']['sort']);_0x15d933[_0x4d57('0x3c')]=qs['filters'](_[_0x4d57('0x3d')](_0x3bba68['query'],_0x9ed347[_0x4d57('0x34')]),_0x3d9694);if(_0x3bba68[_0x4d57('0x33')][_0x4d57('0x3e')]){_0x15d933['where']=_[_0x4d57('0x3f')](_0x15d933[_0x4d57('0x3c')],{'$or':_['map'](_0x3d9694,function(_0x2c8394){if(_0x2c8394[_0x4d57('0x30')]!==_0x4d57('0x40')){var _0x265d19={};_0x265d19[_0x2c8394['name']]={'$like':'%'+_0x3bba68[_0x4d57('0x33')][_0x4d57('0x3e')]+'%'};return _0x265d19;}})});}_0x15d933=_[_0x4d57('0x3f')]({},_0x15d933,_0x3bba68[_0x4d57('0x41')]);var _0x26d602={'where':_0x15d933['where']};return db[_0x4d57('0x2d')][_0x4d57('0x42')](_0x26d602)[_0x4d57('0x15')](function(_0x247ff5){_0x53830c[_0x4d57('0x42')]=_0x247ff5;if(_0x3bba68[_0x4d57('0x33')][_0x4d57('0x43')]){_0x15d933[_0x4d57('0x44')]=[{'all':!![]}];}return db[_0x4d57('0x2d')]['findAll'](_0x15d933);})[_0x4d57('0x15')](function(_0x5120f1){_0x53830c[_0x4d57('0x45')]=_0x5120f1;return _0x53830c;})[_0x4d57('0x15')](respondWithFilteredResult(_0x3f7d61,_0x15d933))[_0x4d57('0x1f')](handleError(_0x3f7d61,null));};exports[_0x4d57('0x46')]=function(_0x27c4b6,_0x2c5968){var _0x4775a1={'raw':!![],'where':{'id':_0x27c4b6['params']['id']}},_0x4ac3ca={};_0x4ac3ca[_0x4d57('0x37')]=_[_0x4d57('0x47')](db[_0x4d57('0x2d')][_0x4d57('0x2e')]);_0x4ac3ca['query']=_[_0x4d57('0x47')](_0x27c4b6[_0x4d57('0x33')]);_0x4ac3ca[_0x4d57('0x34')]=_['intersection'](_0x4ac3ca[_0x4d57('0x37')],_0x4ac3ca[_0x4d57('0x33')]);_0x4775a1[_0x4d57('0x36')]=_[_0x4d57('0x35')](_0x4ac3ca[_0x4d57('0x37')],qs[_0x4d57('0x38')](_0x27c4b6[_0x4d57('0x33')]['fields']));_0x4775a1[_0x4d57('0x36')]=_0x4775a1[_0x4d57('0x36')]['length']?_0x4775a1[_0x4d57('0x36')]:_0x4ac3ca[_0x4d57('0x37')];if(_0x27c4b6[_0x4d57('0x33')][_0x4d57('0x43')]){_0x4775a1[_0x4d57('0x44')]=[{'all':!![]}];}_0x4775a1=_[_0x4d57('0x3f')]({},_0x4775a1,_0x27c4b6[_0x4d57('0x41')]);return db[_0x4d57('0x2d')][_0x4d57('0x48')](_0x4775a1)[_0x4d57('0x15')](handleEntityNotFound(_0x2c5968,null))[_0x4d57('0x15')](respondWithResult(_0x2c5968,null))['catch'](handleError(_0x2c5968,null));};exports[_0x4d57('0x26')]=function(_0x80164d,_0x15fb2f){if(_0x80164d['body']['id']){delete _0x80164d[_0x4d57('0x49')]['id'];}return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x80164d[_0x4d57('0x4a')]['id']}})[_0x4d57('0x15')](handleEntityNotFound(_0x15fb2f,null))[_0x4d57('0x15')](saveUpdates(_0x80164d[_0x4d57('0x49')],null))[_0x4d57('0x15')](respondWithResult(_0x15fb2f,null))[_0x4d57('0x1f')](handleError(_0x15fb2f,null));};exports[_0x4d57('0x27')]=function(_0x41c3ff,_0x583da8){return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x41c3ff['params']['id']}})[_0x4d57('0x15')](handleEntityNotFound(_0x583da8,null))['then'](removeEntity(_0x583da8,null))[_0x4d57('0x1f')](handleError(_0x583da8,null));};exports[_0x4d57('0x4b')]=function(_0x46c1c6,_0x527424){return db[_0x4d57('0x2d')][_0x4d57('0x4b')]()[_0x4d57('0x15')](respondWithResult(_0x527424,null))[_0x4d57('0x1f')](handleError(_0x527424,null));};exports[_0x4d57('0x4c')]=function(_0x56b616,_0x3b302f){return db['MailMessage'][_0x4d57('0x4c')](_0x56b616[_0x4d57('0x49')])[_0x4d57('0x15')](function(_0x463751){if(_0x463751){if(_0x463751[_0x4d57('0x4d')]===_0x4d57('0x4e')&&!_0x463751[_0x4d57('0x4f')]){var _0x12dcf7,_0x40ffc3,_0x286efa;if(_0x56b616[_0x4d57('0x49')]['to']){_0x40ffc3=_0x56b616[_0x4d57('0x49')]['to']['split'](',')[0x0];}return db[_0x4d57('0x50')][_0x4d57('0x51')]({'where':{'id':_0x463751[_0x4d57('0x52')]},'include':[{'model':db[_0x4d57('0x53')],'as':_0x4d57('0x54'),'include':[{'model':db['CmContact'],'as':_0x4d57('0x55'),'where':{'email':_0x40ffc3},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x4d57('0x56')],'as':_0x4d57('0x57'),'raw':!![],'include':[{'model':db[_0x4d57('0x58')],'as':_0x4d57('0x58'),'raw':!![]}]}]})['then'](function(_0x2c7954){_0x12dcf7=_0x2c7954;if(!_0x12dcf7||!_0x12dcf7[_0x4d57('0x57')])return;var _0x1fcc56=_0x12dcf7[_0x4d57('0x59')]();if(_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')]&&_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')][_0x4d57('0x39')]){for(var _0x65981a=0x0;_0x65981a<_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')][_0x4d57('0x39')];_0x65981a+=0x1){_0x56b616['body'][_0x4d57('0x5a')][_0x65981a]={'filename':_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')][_0x65981a][_0x4d57('0x32')],'path':path[_0x4d57('0x5b')](config[_0x4d57('0x5c')],_0x4d57('0x5d'),_0x56b616['body'][_0x4d57('0x5a')][_0x65981a][_0x4d57('0x5e')])};}}_0x286efa={'account':_0x1fcc56,'message':_0x56b616[_0x4d57('0x49')]};return;})[_0x4d57('0x15')](function(){if(_0x12dcf7['List']){if(_0x12dcf7[_0x4d57('0x54')][_0x4d57('0x55')][_0x4d57('0x39')]){return _0x12dcf7[_0x4d57('0x54')]['Contacts'][0x0];}else{return db[_0x4d57('0x5f')][_0x4d57('0x4c')](_[_0x4d57('0x60')](_0x56b616[_0x4d57('0x49')],{'firstName':_0x56b616[_0x4d57('0x49')]['to'],'email':_0x56b616['body']['to'],'phone':_0x56b616['body']['to'],'ListId':_0x12dcf7[_0x4d57('0x61')]}));}}else{throw new Error(_0x4d57('0x62'));}})[_0x4d57('0x15')](function(){if(_0x286efa){return respondWithRpcPromise(_0x4d57('0x63'),'sendMail',_0x286efa,client9003)[_0x4d57('0x15')](function(_0x5b2c68){return _0x463751[_0x4d57('0x26')]({'read':!![],'messageId':_0x5b2c68['messageId'],'sentAt':moment()[_0x4d57('0x64')](_0x4d57('0x65'))});})['catch'](function(_0x21fb6d){logger[_0x4d57('0x1c')]('%s',JSON['stringify'](_0x21fb6d));return _0x463751;});}return _0x463751;});}return _0x463751;}})['then'](respondWithResult(_0x3b302f,0xc9))[_0x4d57('0x1f')](handleError(_0x3b302f,null));};exports['accept']=function(_0x249170,_0x3ee9fc){var _0x3445c4={'agent':{},'channel':_0x4d57('0x66')};if(_0x249170[_0x4d57('0x49')]['id']){delete _0x249170[_0x4d57('0x49')]['id'];}_0x249170[_0x4d57('0x49')][_0x4d57('0x67')]=!![];_0x249170['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x249170[_0x4d57('0x49')][_0x4d57('0x68')]=_0x249170[_0x4d57('0x49')][_0x4d57('0x68')]||_0x249170[_0x4d57('0x69')]['id'];_0x3445c4[_0x4d57('0x6a')]['id']=_0x249170[_0x4d57('0x49')][_0x4d57('0x68')];return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x249170[_0x4d57('0x4a')]['id'],'UserId':null}})[_0x4d57('0x15')](handleEntityNotFound(_0x3ee9fc,null))[_0x4d57('0x15')](saveUpdates(_0x249170[_0x4d57('0x49')],null))[_0x4d57('0x15')](function(_0x6abb56){if(_0x6abb56){_0x3445c4[_0x4d57('0x1d')]=_0x6abb56['get']({'plain':!![]});return db['MailInteraction'][_0x4d57('0x48')]({'where':{'id':_0x6abb56[_0x4d57('0x6b')]}});}return null;})[_0x4d57('0x15')](handleEntityNotFound(_0x3ee9fc,null))['then'](function(_0x204fbf){if(_0x204fbf){return _0x204fbf[_0x4d57('0x26')]({'UserId':_0x249170[_0x4d57('0x49')][_0x4d57('0x68')],'read1stAt':_['isNil'](_0x204fbf[_0x4d57('0x6c')])?moment()[_0x4d57('0x64')](_0x4d57('0x65')):undefined});}return null;})[_0x4d57('0x15')](function(_0x3cdcee){if(_0x3cdcee){_0x3445c4[_0x4d57('0x6d')]=_0x3cdcee[_0x4d57('0x6e')]({'plain':!![]});interaction_log[_0x4d57('0x16')](_0x4d57('0x6f'),_0x249170[_0x4d57('0x69')]['id'],_0x249170[_0x4d57('0x69')]['name'],_0x249170[_0x4d57('0x69')]['role'],_0x3445c4[_0x4d57('0x6d')]['id'],_0x249170[_0x4d57('0x49')]?JSON[_0x4d57('0x1b')](_0x249170[_0x4d57('0x49')]):_0x4d57('0x70'));return respondWithRpcPromise(_0x4d57('0x71'),_0x4d57('0x72'),_0x3445c4);}return null;})[_0x4d57('0x15')](function(_0x53921a){var _0x30f6a5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53921a[_0x4d57('0x1d')][_0x4d57('0x73')];return db[_0x4d57('0x74')][_0x4d57('0x33')](_0x30f6a5,{'type':db[_0x4d57('0x75')][_0x4d57('0x76')][_0x4d57('0x77')],'raw':!![]})[_0x4d57('0x15')](function(_0x1a5462){return _0x1a5462;});})[_0x4d57('0x15')](function(_0x487723){if(_0x487723){_0x3445c4['message'][_0x4d57('0x78')]=_0x487723[0x0];if(!_0x249170[_0x4d57('0x49')][_0x4d57('0x68')])return;return db[_0x4d57('0x79')][_0x4d57('0x48')]({'where':{'id':_0x249170[_0x4d57('0x49')][_0x4d57('0x68')],'role':_0x4d57('0x6a')},'attributes':['id',_0x4d57('0x32'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x53426e){if(!_0x53426e)return null;_0x3445c4['message'][_0x4d57('0x6a')]=_0x53426e;return _0x3445c4;})[_0x4d57('0x15')](function(_0xe2ed65){if(_0xe2ed65){if(_0x249170['body'][_0x4d57('0x7a')]){_0x3445c4['message'][_0x4d57('0x7b')]=util[_0x4d57('0x64')](_0x4d57('0x7c'),_0x249170[_0x4d57('0x69')][_0x4d57('0x32')]);_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x7d')]=_0x3445c4[_0x4d57('0x7d')];_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x7e')]=_0x3445c4[_0x4d57('0x7d')];_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x7f')]=_0x4d57('0x80');_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x49')]=htmlToText[_0x4d57('0x81')](_0x3445c4['message'][_0x4d57('0x49')]);return respondWithRpcPromise(_0x4d57('0x82'),_0x4d57('0x82'),{'event':_0x4d57('0x83'),'message':_0x3445c4['message']},client9002)['then'](function(){return _0x3445c4;});}return _0x3445c4;}return null;})[_0x4d57('0x15')](respondWithResult(_0x3ee9fc,null))[_0x4d57('0x1f')](handleError(_0x3ee9fc,null));};exports['reject']=function(_0x139122,_0x1fa644){var _0x1a8c67={'agent':{},'channel':_0x4d57('0x66')};if(_0x139122[_0x4d57('0x49')]['id']){delete _0x139122['body']['id'];}_0x139122[_0x4d57('0x49')]['UserId']=_0x139122['body'][_0x4d57('0x68')]||_0x139122['user']['id'];_0x1a8c67[_0x4d57('0x6a')]['id']=_0x139122[_0x4d57('0x49')][_0x4d57('0x68')];return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x139122[_0x4d57('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fa644,null))[_0x4d57('0x15')](function(_0x485f63){if(_0x485f63){_0x1a8c67['message']=_0x485f63[_0x4d57('0x6e')]({'plain':!![]});return db[_0x4d57('0x84')]['find']({'where':{'id':_0x485f63[_0x4d57('0x6b')]}});}return null;})[_0x4d57('0x15')](handleEntityNotFound(_0x1fa644,null))[_0x4d57('0x15')](function(_0x588ae1){if(_0x588ae1){_0x1a8c67['interaction']=_0x588ae1[_0x4d57('0x6e')]({'plain':!![]});interaction_log[_0x4d57('0x16')](_0x4d57('0x85'),_0x139122['user']['id'],_0x139122[_0x4d57('0x69')][_0x4d57('0x32')],_0x139122['user']['role'],_0x1a8c67[_0x4d57('0x6d')]['id'],_0x139122[_0x4d57('0x49')]?JSON['stringify'](_0x139122[_0x4d57('0x49')]):'null');return respondWithRpcPromise('RejectMessage',_0x4d57('0x86'),_0x1a8c67);}return null;})[_0x4d57('0x15')](function(_0x2bbfbd){var _0x304292=_0x4d57('0x87')+_0x2bbfbd[_0x4d57('0x1d')][_0x4d57('0x73')];return db['sequelize'][_0x4d57('0x33')](_0x304292,{'type':db[_0x4d57('0x75')][_0x4d57('0x76')][_0x4d57('0x77')],'raw':!![]})['then'](function(_0x3f2679){return _0x3f2679;});})['then'](function(_0xb15917){if(_0xb15917){_0x1a8c67['message'][_0x4d57('0x78')]=_0xb15917[0x0];if(!_0x139122[_0x4d57('0x49')][_0x4d57('0x68')])return;return db[_0x4d57('0x79')]['find']({'where':{'id':_0x139122[_0x4d57('0x49')][_0x4d57('0x68')],'role':_0x4d57('0x6a')},'attributes':['id',_0x4d57('0x32'),_0x4d57('0x88'),_0x4d57('0x89'),_0x4d57('0x8a')],'raw':!![]});}return null;})['then'](function(_0x473197){if(!_0x473197)return null;_0x1a8c67[_0x4d57('0x1d')][_0x4d57('0x6a')]=_0x473197;return _0x1a8c67;})['then'](function(_0x5aeb5b){if(_0x5aeb5b){_0x5aeb5b[_0x4d57('0x1d')][_0x4d57('0x7b')]=util['format'](_0x4d57('0x7c'),_0x139122['user'][_0x4d57('0x32')]);_0x5aeb5b[_0x4d57('0x1d')]['channel']=_0x1a8c67[_0x4d57('0x7d')];_0x5aeb5b[_0x4d57('0x1d')][_0x4d57('0x7e')]=_0x1a8c67[_0x4d57('0x7d')];_0x5aeb5b[_0x4d57('0x1d')][_0x4d57('0x7f')]=_0x4d57('0x8b');_0x5aeb5b['message']['body']=htmlToText['fromString'](_0x1a8c67['message'][_0x4d57('0x49')]);respondWithRpcPromise(_0x4d57('0x82'),_0x4d57('0x82'),{'event':_0x4d57('0x8c'),'message':_0x5aeb5b['message']},client9002);return _0x1a8c67;}return null;})[_0x4d57('0x15')](respondWithResult(_0x1fa644,null))[_0x4d57('0x1f')](handleError(_0x1fa644,null));};exports['download']=function(_0x14ac96,_0x26a4cc){var _0x122f5e=moment()['unix']()[_0x4d57('0x8d')]();var _0x5e2560=path[_0x4d57('0x5b')](config[_0x4d57('0x5c')],'server',_0x4d57('0x8e'),_0x4d57('0x8f'));var _0x41404b=path[_0x4d57('0x5b')](config[_0x4d57('0x5c')],_0x4d57('0x90'),_0x4d57('0x8e'),_0x4d57('0x5a'));var _0x36dc3f=util[_0x4d57('0x64')]('message-%s.eml',_0x122f5e);return db[_0x4d57('0x2d')]['find']({'where':{'id':_0x14ac96['params']['id']},'attributes':['id',_0x4d57('0x49'),'from','to','cc','bcc','subject','createdAt'],'include':_0x14ac96[_0x4d57('0x33')]['attachments']?[{'model':db[_0x4d57('0x91')],'as':_0x4d57('0x92')}]:undefined})[_0x4d57('0x15')](handleEntityNotFound(_0x26a4cc,null))[_0x4d57('0x15')](function(_0xf6c420){if(_0xf6c420){var _0x326a3c=_0xf6c420;var _0x1dc9ca={'from':_0x326a3c[_0x4d57('0x93')],'to':_0x326a3c['to'],'subject':_0x326a3c[_0x4d57('0x94')],'html':htmlEntities[_0x4d57('0x95')](_0x326a3c[_0x4d57('0x49')]),'headers':{'Date':moment(_0x326a3c['createdAt'])[_0x4d57('0x64')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xf6c420['cc']){_0x1dc9ca['headers']['Cc']=_0xf6c420['cc'];}if(_0xf6c420[_0x4d57('0x96')]){_0x1dc9ca[_0x4d57('0x97')]['Bcc']=_0xf6c420[_0x4d57('0x96')];}return new BPromise(function(_0x538454,_0x6697c2){if(_0xf6c420[_0x4d57('0x92')]){for(var _0x208578=0x0;_0x208578<_0xf6c420[_0x4d57('0x92')][_0x4d57('0x39')];_0x208578++){var _0x2eca97=_0xf6c420['Attachments'][_0x208578];var _0x1e976d=path[_0x4d57('0x5b')](_0x41404b,_0x2eca97[_0x4d57('0x5e')]);if(fs['existsSync'](_0x1e976d)){_0x1dc9ca[_0x4d57('0x5a')][_0x4d57('0x98')]({'name':_0x2eca97[_0x4d57('0x32')],'contentType':_0x2eca97[_0x4d57('0x30')],'data':fs[_0x4d57('0x99')](_0x1e976d)});}}}emlformat[_0x4d57('0x9a')](_0x1dc9ca,function(_0x4c6e95,_0x5e1d5f){if(_0x4c6e95)return _0x6697c2(_0x4c6e95);fs['writeFileSync'](path[_0x4d57('0x5b')](_0x5e2560,_0x36dc3f),_0x5e1d5f);return _0x538454(_0x5e1d5f);});});}})[_0x4d57('0x15')](function(_0x259e9a){if(_0x259e9a){return _0x26a4cc[_0x4d57('0x9b')](path[_0x4d57('0x5b')](_0x5e2560,_0x36dc3f),_0x36dc3f,function(_0x3235ce){if(!_0x3235ce)fs[_0x4d57('0x9c')](path['join'](_0x5e2560,_0x36dc3f));});}})['catch'](handleError(_0x26a4cc,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 22e686f..e6680bf 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 _0x48d4=['exports','events','MailMessage','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x48d4,0x1d9));var _0x448d=function(_0xaa4d82,_0x1196f1){_0xaa4d82=_0xaa4d82-0x0;var _0x3de566=_0x48d4[_0xaa4d82];return _0x3de566;};'use strict';var EventEmitter=require(_0x448d('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x448d('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x448d('0x2')](0x0);var events={'afterCreate':_0x448d('0x3'),'afterUpdate':_0x448d('0x4'),'afterDestroy':_0x448d('0x5')};function emitEvent(_0x440b58){return function(_0x5f0a63,_0x52bc30,_0x570a7e){MailMessageEvents['emit'](_0x440b58+':'+_0x5f0a63['id'],_0x5f0a63);MailMessageEvents['emit'](_0x440b58,_0x5f0a63);_0x570a7e(null);};}for(var e in events){if(events[_0x448d('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x448d('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xc03e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc03e,0xd6));var _0xec03=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc03e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xec03('0x0'));var MailMessage=require(_0xec03('0x1'))['db'][_0xec03('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xec03('0x3')](0x0);var events={'afterCreate':_0xec03('0x4'),'afterUpdate':_0xec03('0x5'),'afterDestroy':_0xec03('0x6')};function emitEvent(_0x3b816f){return function(_0x42fb74,_0xd1a87c,_0x44d5c9){MailMessageEvents['emit'](_0x3b816f+':'+_0x42fb74['id'],_0x42fb74);MailMessageEvents[_0xec03('0x7')](_0x3b816f,_0x42fb74);_0x44d5c9(null);};}for(var e in events){if(events[_0xec03('0x8')](e)){var event=events[e];MailMessage[_0xec03('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b095861..21a5ece 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 _0xe50a=['models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString'];(function(_0x599a87,_0x51bc08){var _0x2e7580=function(_0x4b46ec){while(--_0x4b46ec){_0x599a87['push'](_0x599a87['shift']());}};_0x2e7580(++_0x51bc08);}(_0xe50a,0x6f));var _0xae50=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xe50a[_0x35ef6b];return _0x3ad145;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae50('0x0'))(_0xae50('0x1'));var moment=require(_0xae50('0x2'));var BPromise=require(_0xae50('0x3'));var rp=require(_0xae50('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xae50('0x5'));var rimraf=require('rimraf');var config=require(_0xae50('0x6'));var attributes=require(_0xae50('0x7'));module[_0xae50('0x8')]=function(_0x19730c,_0x5a2075){return _0x19730c[_0xae50('0x9')]('MailMessage',attributes,{'tableName':_0xae50('0xa'),'paranoid':![],'indexes':[{'name':_0xae50('0xb'),'fields':[_0xae50('0xb')]},{'name':'fti_mail_messages','fields':[_0xae50('0xc'),_0xae50('0xd')],'type':_0xae50('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb227f8,_0x51040c,_0x435843){if(_0xb227f8[_0xae50('0xf')]){_0xb227f8[_0xae50('0xc')]=htmlToText[_0xae50('0x10')](_0xb227f8[_0xae50('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x435843(null,_0x51040c);},'afterCreate':function(_0x241928,_0x117aad,_0x3c7bce){var _0x3a440b=_0x19730c[_0xae50('0x11')];var _0x346020=_0x241928[_0xae50('0x12')]({'plain':!![]});if(_0x346020[_0xae50('0x13')][_0xae50('0x14')]()==='in'||_0x346020[_0xae50('0x13')][_0xae50('0x14')]()===_0xae50('0x15')&&!_0x346020[_0xae50('0x16')]&&!_[_0xae50('0x17')](_0x346020[_0xae50('0x18')])){_0x3a440b['MailInteraction']['findOne']({'where':{'id':_0x346020[_0xae50('0x19')]}})['then'](function(_0x49755c){if(_0x49755c){_0x49755c[_0xae50('0x1a')]({'lastMsgAt':_0x346020[_0xae50('0x1b')],'lastMsgDirection':_0x346020[_0xae50('0x13')]['toLowerCase']()});}})[_0xae50('0x1c')](function(_0x1a75cb){console[_0xae50('0x1d')](_0x1a75cb);});}_0x3c7bce();}},'charset':_0xae50('0x1e'),'collate':_0xae50('0x1f')});}; \ No newline at end of file +var _0xfb1b=['secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','get','direction','toLowerCase','out'];(function(_0x591172,_0x3e2128){var _0x5c9240=function(_0xd897b3){while(--_0xd897b3){_0x591172['push'](_0x591172['shift']());}};_0x5c9240(++_0x3e2128);}(_0xfb1b,0xd5));var _0xbfb1=function(_0x10afb2,_0x431e94){_0x10afb2=_0x10afb2-0x0;var _0x23c228=_0xfb1b[_0x10afb2];return _0x23c228;};'use strict';var _=require('lodash');var util=require(_0xbfb1('0x0'));var logger=require('../../config/logger')(_0xbfb1('0x1'));var moment=require('moment');var BPromise=require(_0xbfb1('0x2'));var rp=require(_0xbfb1('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xbfb1('0x4'));var rimraf=require(_0xbfb1('0x5'));var config=require(_0xbfb1('0x6'));var attributes=require(_0xbfb1('0x7'));module[_0xbfb1('0x8')]=function(_0x4fc9d4,_0x282765){return _0x4fc9d4['define'](_0xbfb1('0x9'),attributes,{'tableName':_0xbfb1('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbfb1('0xb')]},{'name':_0xbfb1('0xc'),'fields':[_0xbfb1('0xd'),_0xbfb1('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xd51d8,_0x5cc0da,_0x79d312){if(_0xd51d8['body']){_0xd51d8[_0xbfb1('0xd')]=htmlToText['fromString'](_0xd51d8['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x79d312(null,_0x5cc0da);},'afterCreate':function(_0x1de0ec,_0x439664,_0x3708b4){var _0x38d2bc=_0x4fc9d4['models'];var _0x2af49b=_0x1de0ec[_0xbfb1('0xf')]({'plain':!![]});if(_0x2af49b[_0xbfb1('0x10')]['toLowerCase']()==='in'||_0x2af49b[_0xbfb1('0x10')][_0xbfb1('0x11')]()===_0xbfb1('0x12')&&!_0x2af49b[_0xbfb1('0x13')]&&!_[_0xbfb1('0x14')](_0x2af49b[_0xbfb1('0x15')])){_0x38d2bc[_0xbfb1('0x16')][_0xbfb1('0x17')]({'where':{'id':_0x2af49b[_0xbfb1('0x18')]}})[_0xbfb1('0x19')](function(_0x4bc66d){if(_0x4bc66d){_0x4bc66d['update']({'lastMsgAt':_0x2af49b[_0xbfb1('0x1a')],'lastMsgDirection':_0x2af49b['direction'][_0xbfb1('0x11')]()});}})[_0xbfb1('0x1b')](function(_0x2fdcff){console['error'](_0x2fdcff);});}_0x3708b4();}},'charset':_0xbfb1('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b9729ca..563a792 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 _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(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x1eba[_0x5af97c];return _0x3472ae;};'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 +var _0x14a0=['code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1fa85d,_0x298a9b){var _0x488959=function(_0x3f6213){while(--_0x3f6213){_0x1fa85d['push'](_0x1fa85d['shift']());}};_0x488959(++_0x298a9b);}(_0x14a0,0x8e));var _0x014a=function(_0x43cec0,_0x268416){_0x43cec0=_0x43cec0-0x0;var _0x1de61d=_0x14a0[_0x43cec0];return _0x1de61d;};'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});config['redis']=_[_0x014a('0xa')](config[_0x014a('0xb')],{'host':_0x014a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x014a('0xd'))['register'](socket);function respondWithRpcPromise(_0x490ea2,_0x5aa52f,_0x4f3539){return new BPromise(function(_0x330469,_0x4c7418){return client[_0x014a('0xe')](_0x490ea2,_0x4f3539)[_0x014a('0xf')](function(_0x543bbf){logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));logger[_0x014a('0x13')](_0x014a('0x14'),_0x5aa52f,_0x014a('0x12'),JSON[_0x014a('0x15')](_0x543bbf));if(_0x543bbf[_0x014a('0x16')]){if(_0x543bbf[_0x014a('0x16')][_0x014a('0x17')]===0x1f4){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x4c7418(_0x543bbf[_0x014a('0x16')]['message']);}logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x330469(_0x543bbf[_0x014a('0x16')][_0x014a('0x18')]);}else{logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));_0x330469(_0x543bbf[_0x014a('0x19')][_0x014a('0x18')]);}})[_0x014a('0x1a')](function(_0x3b9341){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x3b9341);_0x4c7418(_0x3b9341);});});}exports[_0x014a('0x1b')]=function(_0x34e5c3){var _0x5c69c5=this;return new Promise(function(_0x359903,_0x109a9c){return db[_0x014a('0x1c')][_0x014a('0x1d')](_0x34e5c3[_0x014a('0x1e')],{'raw':_0x34e5c3[_0x014a('0x1f')]?_0x34e5c3[_0x014a('0x1f')][_0x014a('0x20')]===undefined?!![]:![]:!![]})[_0x014a('0xf')](function(_0x486e66){logger[_0x014a('0x10')]('CreateMailMessage',_0x34e5c3);logger[_0x014a('0x13')](_0x014a('0x1b'),_0x34e5c3,JSON[_0x014a('0x15')](_0x486e66));_0x359903(_0x486e66);})[_0x014a('0x1a')](function(_0x2b3c10){logger[_0x014a('0x16')](_0x014a('0x1b'),_0x2b3c10[_0x014a('0x18')],_0x34e5c3);_0x109a9c(_0x5c69c5[_0x014a('0x16')](0x1f4,_0x2b3c10['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 626c614..755b85d 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 _0x3cd1=['length','mailMessage:','save','remove','update','emit','removeListener','register'];(function(_0x10975a,_0x484169){var _0x38c015=function(_0x165681){while(--_0x165681){_0x10975a['push'](_0x10975a['shift']());}};_0x38c015(++_0x484169);}(_0x3cd1,0x112));var _0x13cd=function(_0x31ed35,_0x4bb33a){_0x31ed35=_0x31ed35-0x0;var _0x2ac6ee=_0x3cd1[_0x31ed35];return _0x2ac6ee;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x13cd('0x0'),_0x13cd('0x1'),_0x13cd('0x2')];function createListener(_0x2e2c4c,_0x105bd6){return function(_0x174a5f){_0x105bd6[_0x13cd('0x3')](_0x2e2c4c,_0x174a5f);};}function removeListener(_0x5d0e7,_0x511fcf){return function(){MailMessageEvents[_0x13cd('0x4')](_0x5d0e7,_0x511fcf);};}exports[_0x13cd('0x5')]=function(_0x3c0209){for(var _0x48ae57=0x0,_0x55cac0=events[_0x13cd('0x6')];_0x48ae57<_0x55cac0;_0x48ae57++){var _0x427fb0=events[_0x48ae57];var _0x258008=createListener(_0x13cd('0x7')+_0x427fb0,_0x3c0209);MailMessageEvents['on'](_0x427fb0,_0x258008);}}; \ No newline at end of file +var _0x6de8=['removeListener','register','save','emit'];(function(_0x45aa75,_0x389fd2){var _0x5bac72=function(_0x17ebfe){while(--_0x17ebfe){_0x45aa75['push'](_0x45aa75['shift']());}};_0x5bac72(++_0x389fd2);}(_0x6de8,0x126));var _0x86de=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6de8[_0x263a74];return _0x2aa86c;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x86de('0x0'),'remove','update'];function createListener(_0x43f089,_0x19236c){return function(_0x46713f){_0x19236c[_0x86de('0x1')](_0x43f089,_0x46713f);};}function removeListener(_0x1b3659,_0x255609){return function(){MailMessageEvents[_0x86de('0x2')](_0x1b3659,_0x255609);};}exports[_0x86de('0x3')]=function(_0x5b22ac){for(var _0x5f2eca=0x0,_0x4663c9=events['length'];_0x5f2eca<_0x4663c9;_0x5f2eca++){var _0x5039b3=events[_0x5f2eca];var _0x131456=createListener('mailMessage:'+_0x5039b3,_0x5b22ac);MailMessageEvents['on'](_0x5039b3,_0x131456);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index cd0b672..c158c0d 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 _0xa536=['/:id/teams','/:id/users','getAgents','create','addTeams','/:id','update','destroy','delete','removeTeams','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','show','/:id/members','getMembers'];(function(_0x36b063,_0x25e359){var _0x1844c4=function(_0x1fd8f5){while(--_0x1fd8f5){_0x36b063['push'](_0x36b063['shift']());}};_0x1844c4(++_0x25e359);}(_0xa536,0x1cd));var _0x6a53=function(_0x292a14,_0x1dd30a){_0x292a14=_0x292a14-0x0;var _0x782ff4=_0xa536[_0x292a14];return _0x782ff4;};'use strict';var multer=require(_0x6a53('0x0'));var util=require(_0x6a53('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a53('0x2')]();var fs_extra=require(_0x6a53('0x3'));var auth=require(_0x6a53('0x4'));var interaction=require(_0x6a53('0x5'));var config=require('../../config/environment');var controller=require(_0x6a53('0x6'));router['get']('/',auth[_0x6a53('0x7')](),controller[_0x6a53('0x8')]);router[_0x6a53('0x9')](_0x6a53('0xa'),auth[_0x6a53('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6a53('0xb')]);router[_0x6a53('0x9')](_0x6a53('0xc'),auth[_0x6a53('0x7')](),controller[_0x6a53('0xd')]);router[_0x6a53('0x9')](_0x6a53('0xe'),auth[_0x6a53('0x7')](),controller['getTeams']);router['get'](_0x6a53('0xf'),auth[_0x6a53('0x7')](),controller[_0x6a53('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a53('0x11')]);router['post'](_0x6a53('0xe'),auth[_0x6a53('0x7')](),controller[_0x6a53('0x12')]);router['post']('/:id/users',auth[_0x6a53('0x7')](),controller['addAgents']);router['put'](_0x6a53('0x13'),auth[_0x6a53('0x7')](),controller[_0x6a53('0x14')]);router['delete'](_0x6a53('0x13'),auth[_0x6a53('0x7')](),controller[_0x6a53('0x15')]);router[_0x6a53('0x16')](_0x6a53('0xe'),auth[_0x6a53('0x7')](),controller[_0x6a53('0x17')]);router[_0x6a53('0x16')]('/:id/users',auth[_0x6a53('0x7')](),controller['removeAgents']);module[_0x6a53('0x18')]=router; \ No newline at end of file +var _0x9841=['delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x9841,0x164));var _0x1984=function(_0x2ef8fa,_0x54eede){_0x2ef8fa=_0x2ef8fa-0x0;var _0x6960af=_0x9841[_0x2ef8fa];return _0x6960af;};'use strict';var multer=require(_0x1984('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1984('0x1'));var express=require(_0x1984('0x2'));var router=express[_0x1984('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1984('0x4'));var interaction=require(_0x1984('0x5'));var config=require(_0x1984('0x6'));var controller=require('./mailQueue.controller');router[_0x1984('0x7')]('/',auth[_0x1984('0x8')](),controller['index']);router[_0x1984('0x7')](_0x1984('0x9'),auth[_0x1984('0x8')](),controller[_0x1984('0xa')]);router[_0x1984('0x7')](_0x1984('0xb'),auth[_0x1984('0x8')](),controller['show']);router[_0x1984('0x7')](_0x1984('0xc'),auth[_0x1984('0x8')](),controller['getMembers']);router[_0x1984('0x7')]('/:id/teams',auth[_0x1984('0x8')](),controller[_0x1984('0xd')]);router[_0x1984('0x7')](_0x1984('0xe'),auth['isAuthenticated'](),controller[_0x1984('0xf')]);router[_0x1984('0x10')]('/',auth[_0x1984('0x8')](),controller['create']);router[_0x1984('0x10')](_0x1984('0x11'),auth[_0x1984('0x8')](),controller[_0x1984('0x12')]);router[_0x1984('0x10')](_0x1984('0xe'),auth['isAuthenticated'](),controller[_0x1984('0x13')]);router[_0x1984('0x14')](_0x1984('0xb'),auth[_0x1984('0x8')](),controller[_0x1984('0x15')]);router[_0x1984('0x16')](_0x1984('0xb'),auth[_0x1984('0x8')](),controller[_0x1984('0x17')]);router[_0x1984('0x16')](_0x1984('0x11'),auth[_0x1984('0x8')](),controller[_0x1984('0x18')]);router[_0x1984('0x16')](_0x1984('0xe'),auth[_0x1984('0x8')](),controller[_0x1984('0x19')]);module[_0x1984('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 32feb18..9d95d31 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 _0x9f8d=['roundrobin','sequelize','exports','name','STRING','rrmemory','beepall'];(function(_0x4ff5e0,_0x541a0c){var _0x5ae4fb=function(_0x1044ed){while(--_0x1044ed){_0x4ff5e0['push'](_0x4ff5e0['shift']());}};_0x5ae4fb(++_0x541a0c);}(_0x9f8d,0x1ac));var _0xd9f8=function(_0x154577,_0x1495f8){_0x154577=_0x154577-0x0;var _0x439e38=_0x9f8d[_0x154577];return _0x439e38;};'use strict';var Sequelize=require(_0xd9f8('0x0'));module[_0xd9f8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd9f8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd9f8('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd9f8('0x4'),_0xd9f8('0x5'),_0xd9f8('0x6'))}}; \ No newline at end of file +var _0x6f90=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x6f90,0xdf));var _0x06f9=function(_0x4088a4,_0x4218ee){_0x4088a4=_0x4088a4-0x0;var _0x5e621e=_0x6f90[_0x4088a4];return _0x5e621e;};'use strict';var Sequelize=require(_0x06f9('0x0'));module[_0x06f9('0x1')]={'name':{'type':Sequelize[_0x06f9('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x06f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x06f9('0x4')](_0x06f9('0x5'),_0x06f9('0x6'),_0x06f9('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 472d7c7..5398843 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 _0xf135=['includeAll','merge','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','body','params','describe','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','where','UserMailQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','removeAgents','forEach','userMailQueue:remove','addAgents','isArray','getAgents','findOne','options','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','include','query','findAll','show','model','keys','filters','intersection','attributes','fields','length'];(function(_0x49bdd2,_0x63b889){var _0x1e052f=function(_0x58af51){while(--_0x58af51){_0x49bdd2['push'](_0x49bdd2['shift']());}};_0x1e052f(++_0x63b889);}(_0xf135,0xb7));var _0x5f13=function(_0x1d2e8f,_0x22ae0f){_0x1d2e8f=_0x1d2e8f-0x0;var _0x52588f=_0xf135[_0x1d2e8f];return _0x52588f;};'use strict';var BPromise=require(_0x5f13('0x0'));var util=require('util');var _=require(_0x5f13('0x1'));var squel=require('squel');var Redis=require(_0x5f13('0x2'));var qs=require(_0x5f13('0x3'));var logger=require(_0x5f13('0x4'))(_0x5f13('0x5'));var config=require(_0x5f13('0x6'));var db=require(_0x5f13('0x7'))['db'];config[_0x5f13('0x8')]=_[_0x5f13('0x9')](config[_0x5f13('0x8')],{'host':_0x5f13('0xa'),'port':0x18eb});var socket=require(_0x5f13('0xb'))(new Redis(config[_0x5f13('0x8')]));require(_0x5f13('0xc'))[_0x5f13('0xd')](socket);function respondWithStatusCode(_0x5bc0d2,_0x296bfa){_0x296bfa=_0x296bfa||0xcc;return function(_0x30a17e){if(_0x30a17e){return _0x5bc0d2[_0x5f13('0xe')](_0x296bfa);}return _0x5bc0d2[_0x5f13('0xf')](_0x296bfa)['end']();};}function respondWithResult(_0x3b51f4,_0x311bd6){_0x311bd6=_0x311bd6||0xc8;return function(_0x17ddec){if(_0x17ddec){return _0x3b51f4['status'](_0x311bd6)[_0x5f13('0x10')](_0x17ddec);}};}function respondWithFilteredResult(_0x4cb65c,_0x455860){return function(_0x207fec){if(_0x207fec){var _0x3b8a68=typeof _0x455860[_0x5f13('0x11')]===_0x5f13('0x12')&&typeof _0x455860[_0x5f13('0x13')]===_0x5f13('0x12');var _0xb18858=_0x207fec[_0x5f13('0x14')];var _0x477cf0=_0x3b8a68?0x0:_0x455860[_0x5f13('0x11')];var _0x282b1d=_0x3b8a68?_0x207fec[_0x5f13('0x14')]:_0x455860[_0x5f13('0x11')]+_0x455860[_0x5f13('0x13')];var _0x47f1b5;if(_0x282b1d>=_0xb18858){_0x282b1d=_0xb18858;_0x47f1b5=0xc8;}else{_0x47f1b5=0xce;}_0x4cb65c['status'](_0x47f1b5);return _0x4cb65c[_0x5f13('0x15')](_0x5f13('0x16'),_0x477cf0+'-'+_0x282b1d+'/'+_0xb18858)[_0x5f13('0x10')](_0x207fec);}return null;};}function saveUpdates(_0x41af7d){return function(_0x1b6dbe){if(_0x1b6dbe){return _0x1b6dbe[_0x5f13('0x17')](_0x41af7d)[_0x5f13('0x18')](function(_0x36c811){return _0x36c811;});}return null;};}function removeEntity(_0x29e8d9){return function(_0x26ff50){if(_0x26ff50){return _0x26ff50['destroy']()[_0x5f13('0x18')](function(){var _0x2110fc=_0x26ff50['get']({'plain':!![]});var _0x147d9f=_0x5f13('0x19');return db[_0x5f13('0x1a')]['destroy']({'where':{'type':_0x147d9f,'resourceId':_0x2110fc['id']}})['then'](function(){return _0x26ff50;});})[_0x5f13('0x18')](function(){_0x29e8d9[_0x5f13('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ce865){return function(_0x56fff2){if(!_0x56fff2){_0x3ce865[_0x5f13('0xe')](0x194);}return _0x56fff2;};}function handleError(_0x5e5548,_0x45b69e){_0x45b69e=_0x45b69e||0x1f4;return function(_0x1e234d){logger['error'](_0x1e234d[_0x5f13('0x1b')]);if(_0x1e234d[_0x5f13('0x1c')]){delete _0x1e234d[_0x5f13('0x1c')];}_0x5e5548['status'](_0x45b69e)[_0x5f13('0x1d')](_0x1e234d);};}exports[_0x5f13('0x1e')]=function(_0x4f7191,_0xb8d14f){var _0x35b6fc={};var _0x5b5751={'count':0x0,'rows':[]};var _0x4faa26=_[_0x5f13('0x1f')](db[_0x5f13('0x20')][_0x5f13('0x21')],function(_0xdbbd5c){return{'name':_0xdbbd5c[_0x5f13('0x22')],'type':_0xdbbd5c[_0x5f13('0x23')]['key']};});_0x35b6fc=qs['getOptions'](_0x4faa26,_0x4f7191);var _0x1cccc2={'where':_0x35b6fc['where']};return db[_0x5f13('0x20')][_0x5f13('0x14')](_0x1cccc2)[_0x5f13('0x18')](function(_0x4285c5){_0x5b5751['count']=_0x4285c5;_0x35b6fc['include']=qs[_0x5f13('0x24')](_0x4f7191[_0x5f13('0x25')]);return db[_0x5f13('0x20')][_0x5f13('0x26')](_0x35b6fc);})['then'](function(_0x34e4a6){_0x5b5751['rows']=_0x34e4a6;return _0x5b5751;})['then'](respondWithFilteredResult(_0xb8d14f,_0x35b6fc))['catch'](handleError(_0xb8d14f,null));};exports[_0x5f13('0x27')]=function(_0x18b611,_0x37ce09){var _0x4283a1={'raw':!![],'where':{'id':_0x18b611['params']['id']}},_0x47ec36={};_0x47ec36[_0x5f13('0x28')]=_[_0x5f13('0x29')](db[_0x5f13('0x20')][_0x5f13('0x21')]);_0x47ec36[_0x5f13('0x25')]=_[_0x5f13('0x29')](_0x18b611[_0x5f13('0x25')]);_0x47ec36[_0x5f13('0x2a')]=_[_0x5f13('0x2b')](_0x47ec36[_0x5f13('0x28')],_0x47ec36[_0x5f13('0x25')]);_0x4283a1[_0x5f13('0x2c')]=_['intersection'](_0x47ec36[_0x5f13('0x28')],qs[_0x5f13('0x2d')](_0x18b611[_0x5f13('0x25')][_0x5f13('0x2d')]));_0x4283a1['attributes']=_0x4283a1[_0x5f13('0x2c')][_0x5f13('0x2e')]?_0x4283a1[_0x5f13('0x2c')]:_0x47ec36['model'];if(_0x18b611[_0x5f13('0x25')][_0x5f13('0x2f')]){_0x4283a1[_0x5f13('0x24')]=[{'all':!![]}];}_0x4283a1=_[_0x5f13('0x30')]({},_0x4283a1,_0x18b611['options']);return db['MailQueue'][_0x5f13('0x31')](_0x4283a1)[_0x5f13('0x18')](handleEntityNotFound(_0x37ce09,null))[_0x5f13('0x18')](respondWithResult(_0x37ce09,null))[_0x5f13('0x32')](handleError(_0x37ce09,null));};exports['create']=function(_0x4953ea,_0x1fa37e){return db['MailQueue'][_0x5f13('0x33')](_0x4953ea['body'],{})[_0x5f13('0x18')](function(_0x249239){var _0x235c32=_0x4953ea[_0x5f13('0x34')][_0x5f13('0x35')]({'plain':!![]});if(!_0x235c32)throw new Error(_0x5f13('0x36'));if(_0x235c32[_0x5f13('0x37')]===_0x5f13('0x34')){var _0x327159=_0x249239['get']({'plain':!![]});var _0x30f4c6='MailQueues';return db[_0x5f13('0x38')][_0x5f13('0x31')]({'where':{'name':_0x30f4c6,'userProfileId':_0x235c32['userProfileId']},'raw':!![]})['then'](function(_0xf37eae){if(_0xf37eae&&_0xf37eae['autoAssociation']===0x0){return db[_0x5f13('0x1a')][_0x5f13('0x33')]({'name':_0x327159['name'],'resourceId':_0x327159['id'],'type':_0xf37eae[_0x5f13('0x1c')],'sectionId':_0xf37eae['id']},{})[_0x5f13('0x18')](function(){return _0x249239;});}else{return _0x249239;}})[_0x5f13('0x32')](function(_0x3c70d7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c70d7);throw _0x3c70d7;});}return _0x249239;})[_0x5f13('0x18')](respondWithResult(_0x1fa37e,0xc9))[_0x5f13('0x32')](handleError(_0x1fa37e,null));};exports['update']=function(_0x91434b,_0x16c470){if(_0x91434b[_0x5f13('0x39')]['id']){delete _0x91434b[_0x5f13('0x39')]['id'];}return db[_0x5f13('0x20')][_0x5f13('0x31')]({'where':{'id':_0x91434b[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](handleEntityNotFound(_0x16c470,null))[_0x5f13('0x18')](saveUpdates(_0x91434b[_0x5f13('0x39')],null))['then'](respondWithResult(_0x16c470,null))[_0x5f13('0x32')](handleError(_0x16c470,null));};exports['destroy']=function(_0x29c509,_0x4f4760){return db[_0x5f13('0x20')]['find']({'where':{'id':_0x29c509[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](handleEntityNotFound(_0x4f4760,null))[_0x5f13('0x18')](removeEntity(_0x4f4760,null))['catch'](handleError(_0x4f4760,null));};exports[_0x5f13('0x3b')]=function(_0x1a587d,_0x5db29e){return db[_0x5f13('0x20')]['describe']()['then'](respondWithResult(_0x5db29e,null))[_0x5f13('0x32')](handleError(_0x5db29e,null));};exports['getMembers']=function(_0x507aba,_0xc46fc){var _0x2ded24={'raw':!![],'where':{}},_0x36d99c={},_0x27f946;return db[_0x5f13('0x20')]['findOne']({'where':{'id':_0x507aba[_0x5f13('0x3a')]['id']}})['then'](handleEntityNotFound(_0xc46fc,null))[_0x5f13('0x18')](function(_0x4f3897){if(_0x4f3897){_0x27f946=_0x4f3897['get']({'plain':!![]});_0x36d99c[_0x5f13('0x28')]=_[_0x5f13('0x29')](db['UserMailQueue'][_0x5f13('0x21')]);_0x36d99c['query']=_[_0x5f13('0x29')](_0x507aba[_0x5f13('0x25')]);_0x36d99c['filters']=_[_0x5f13('0x2b')](_0x36d99c[_0x5f13('0x28')],_0x36d99c['query']);_0x2ded24[_0x5f13('0x2c')]=_[_0x5f13('0x2b')](_0x36d99c[_0x5f13('0x28')],qs[_0x5f13('0x2d')](_0x507aba[_0x5f13('0x25')]['fields']));_0x2ded24[_0x5f13('0x2c')]=_0x2ded24[_0x5f13('0x2c')][_0x5f13('0x2e')]?_0x2ded24['attributes']:_0x36d99c[_0x5f13('0x28')];if(!_0x507aba[_0x5f13('0x25')][_0x5f13('0x3c')](_0x5f13('0x3d'))){_0x2ded24[_0x5f13('0x13')]=qs[_0x5f13('0x13')](_0x507aba['query'][_0x5f13('0x13')]);_0x2ded24[_0x5f13('0x11')]=qs[_0x5f13('0x11')](_0x507aba[_0x5f13('0x25')][_0x5f13('0x11')]);}_0x2ded24[_0x5f13('0x3e')]=qs[_0x5f13('0x3f')](_0x507aba[_0x5f13('0x25')]['sort']);_0x2ded24['where']=qs[_0x5f13('0x2a')](_[_0x5f13('0x40')](_0x507aba['query'],_0x36d99c[_0x5f13('0x2a')]));_0x2ded24['where'][_0x5f13('0x41')]=_0x4f3897['id'];if(_0x507aba[_0x5f13('0x25')][_0x5f13('0x42')]){_0x2ded24['where']=_[_0x5f13('0x30')](_0x2ded24[_0x5f13('0x43')],{'$or':_['map'](_0x2ded24[_0x5f13('0x2c')],function(_0x340c42){var _0x3145cd={};_0x3145cd[_0x340c42]={'$like':'%'+_0x507aba[_0x5f13('0x25')][_0x5f13('0x42')]+'%'};return _0x3145cd;})});}_0x2ded24=_[_0x5f13('0x30')]({},_0x2ded24,_0x507aba['options']);return db[_0x5f13('0x44')][_0x5f13('0x26')](_0x2ded24);}})[_0x5f13('0x18')](function(_0x41493c){if(_0x41493c){return db['User'][_0x5f13('0x45')]({'where':{'id':_['map'](_0x41493c,_0x5f13('0x46')),'role':_0x5f13('0x47')},'attributes':['id',_0x5f13('0x1c'),'mailPause',_0x5f13('0x48'),_0x5f13('0x49')]});}})[_0x5f13('0x18')](function(_0xcedb90){if(_0xcedb90){return{'count':_0xcedb90[_0x5f13('0x14')],'rows':_[_0x5f13('0x1f')](_0xcedb90[_0x5f13('0x4a')],function(_0x33f985){return{'membername':_0x33f985['name'],'UserId':_0x33f985['id'],'queue_name':_0x27f946[_0x5f13('0x1c')],'MailQueueId':_0x27f946['id'],'interface':util[_0x5f13('0x4b')](_0x5f13('0x4c'),_0x5f13('0x4d'),_0x33f985[_0x5f13('0x1c')]),'penalty':0x0,'paused':_0x33f985['mailPause'],'createdAt':_0x33f985[_0x5f13('0x49')],'updatedAt':_0x33f985[_0x5f13('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5f13('0x18')](respondWithFilteredResult(_0xc46fc,_0x2ded24))['catch'](handleError(_0xc46fc,null));};exports[_0x5f13('0x4e')]=function(_0x55858f,_0x325b5d){var _0x1297ae={};var _0x577bf6={};var _0x2fb80c;var _0x31dd40;return db[_0x5f13('0x20')]['findOne']({'where':{'id':_0x55858f[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](handleEntityNotFound(_0x325b5d,null))[_0x5f13('0x18')](function(_0x4c3e3e){if(_0x4c3e3e){_0x2fb80c=_0x4c3e3e;_0x577bf6[_0x5f13('0x28')]=_[_0x5f13('0x29')](db[_0x5f13('0x4f')][_0x5f13('0x21')]);_0x577bf6[_0x5f13('0x25')]=_['keys'](_0x55858f[_0x5f13('0x25')]);_0x577bf6[_0x5f13('0x2a')]=_['intersection'](_0x577bf6[_0x5f13('0x28')],_0x577bf6[_0x5f13('0x25')]);_0x1297ae['attributes']=_[_0x5f13('0x2b')](_0x577bf6[_0x5f13('0x28')],qs[_0x5f13('0x2d')](_0x55858f[_0x5f13('0x25')][_0x5f13('0x2d')]));_0x1297ae['attributes']=_0x1297ae[_0x5f13('0x2c')][_0x5f13('0x2e')]?_0x1297ae[_0x5f13('0x2c')]:_0x577bf6['model'];_0x1297ae[_0x5f13('0x3e')]=qs[_0x5f13('0x3f')](_0x55858f['query'][_0x5f13('0x3f')]);_0x1297ae[_0x5f13('0x43')]=qs[_0x5f13('0x2a')](_[_0x5f13('0x40')](_0x55858f[_0x5f13('0x25')],_0x577bf6[_0x5f13('0x2a')]));if(_0x55858f[_0x5f13('0x25')][_0x5f13('0x42')]){_0x1297ae['where']=_[_0x5f13('0x30')](_0x1297ae[_0x5f13('0x43')],{'$or':_[_0x5f13('0x1f')](_0x1297ae[_0x5f13('0x2c')],function(_0x3b898f){var _0x25784e={};_0x25784e[_0x3b898f]={'$like':'%'+_0x55858f[_0x5f13('0x25')][_0x5f13('0x42')]+'%'};return _0x25784e;})});}_0x1297ae=_[_0x5f13('0x30')]({},_0x1297ae,_0x55858f['options']);return _0x2fb80c[_0x5f13('0x4e')](_0x1297ae);}})[_0x5f13('0x18')](function(_0x4a516a){if(_0x4a516a){_0x31dd40=_0x4a516a[_0x5f13('0x2e')];if(!_0x55858f['query']['hasOwnProperty']('nolimit')){_0x1297ae[_0x5f13('0x13')]=qs[_0x5f13('0x13')](_0x55858f[_0x5f13('0x25')][_0x5f13('0x13')]);_0x1297ae[_0x5f13('0x11')]=qs['offset'](_0x55858f['query'][_0x5f13('0x11')]);}return _0x2fb80c[_0x5f13('0x4e')](_0x1297ae);}})[_0x5f13('0x18')](function(_0x46afa2){if(_0x46afa2){return _0x46afa2?{'count':_0x31dd40,'rows':_0x46afa2}:null;}})[_0x5f13('0x18')](respondWithResult(_0x325b5d,null))[_0x5f13('0x32')](handleError(_0x325b5d,null));};exports['addTeams']=function(_0x105d89,_0x262cba){var _0x509494=_0x105d89[_0x5f13('0x39')][_0x5f13('0x50')];return db[_0x5f13('0x4f')][_0x5f13('0x26')]({'where':{'id':_0x509494},'attributes':['id'],'include':[{'model':db[_0x5f13('0x51')],'as':_0x5f13('0x52'),'attributes':['id',_0x5f13('0x1c'),_0x5f13('0x53'),'voicePause',_0x5f13('0x54')],'raw':!![]}]})[_0x5f13('0x18')](function(_0x53ce87){if(_0x53ce87){var _0xe4bffa=_[_0x5f13('0x55')](_0x53ce87,function(_0x10895c){var _0x5c1efd=_0x10895c['get']({'plain':!![]});return _0x5c1efd[_0x5f13('0x52')];});return db[_0x5f13('0x20')][_0x5f13('0x31')]({'where':{'id':_0x105d89[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](function(_0x3770e3){return db[_0x5f13('0x56')][_0x5f13('0x57')](function(_0x27c873){return _0x3770e3['addTeams'](_0x509494,{'transaction':_0x27c873})['then'](function(){return BPromise[_0x5f13('0x58')](_0xe4bffa,function(_0x5b6a26){return db['UserMailQueue'][_0x5f13('0x59')]({'where':{'UserId':_0x5b6a26['id'],'MailQueueId':_0x105d89[_0x5f13('0x3a')]['id']},'transaction':_0x27c873});});})[_0x5f13('0x18')](function(){_0xe4bffa['forEach'](function(_0x4d2040){socket[_0x5f13('0x5a')](_0x5f13('0x5b'),{'UserId':_0x4d2040['id'],'MailQueueId':_0x3770e3['id']});});});});});}})['then'](respondWithStatusCode(_0x262cba,null))[_0x5f13('0x32')](handleError(_0x262cba,null));};exports[_0x5f13('0x5c')]=function(_0x1f5428,_0x443bf6){return db[_0x5f13('0x4f')][_0x5f13('0x26')]({'where':{'id':_0x1f5428['query'][_0x5f13('0x50')]},'attributes':['id'],'include':[{'model':db[_0x5f13('0x51')],'as':_0x5f13('0x52'),'attributes':['id'],'raw':!![]}]})[_0x5f13('0x18')](handleEntityNotFound(_0x443bf6,null))['then'](function(_0x1ecf77){var _0x640cf1=_['map'](_0x1ecf77,'id');var _0x5d1111=[];var _0x3b9449=[];var _0x1bcdba=squel[_0x5f13('0x5d')]();_0x1bcdba['field'](_0x5f13('0x5e'))[_0x5f13('0x5f')](_0x5f13('0x60'),'tq')[_0x5f13('0x61')]('user_has_teams','ut',_0x5f13('0x62'))[_0x5f13('0x43')](_0x5f13('0x63'),_0x1f5428[_0x5f13('0x3a')]['id']);for(var _0x247dca=0x0;_0x247dca<_0x1ecf77[_0x5f13('0x2e')];_0x247dca+=0x1){let _0x260384=_0x1ecf77[_0x247dca];for(var _0x5b7307=0x0;_0x5b7307<_0x260384['Agents'][_0x5f13('0x2e')];_0x5b7307+=0x1){let _0x40b0b7=_0x260384[_0x5f13('0x52')][_0x5b7307];var _0x4b7642=_0x1bcdba['clone']();_0x4b7642[_0x5f13('0x43')](_0x5f13('0x64'),_0x40b0b7['id']);_0x3b9449[_0x5f13('0x65')](db[_0x5f13('0x56')][_0x5f13('0x25')](_0x4b7642['toString'](),{'type':db[_0x5f13('0x56')][_0x5f13('0x66')]['SELECT']})[_0x5f13('0x18')](function(_0x24cc22){if(_0x24cc22[_0x5f13('0x2e')]===0x1){return _0x40b0b7['id'];}else{var _0x251ac1=_['every'](_['map'](_0x24cc22,_0x5f13('0x67')),function(_0xcbbeac){return _[_0x5f13('0x68')](_0x640cf1,_0xcbbeac);});if(_0x251ac1){return _0x40b0b7['id'];}}}));}}return BPromise[_0x5f13('0x69')](_0x3b9449)[_0x5f13('0x18')](function(_0x5d49c8){_0x5d1111=_(_0x5d1111)[_0x5f13('0x6a')](_0x5d49c8)['compact']()['value']();return db[_0x5f13('0x20')]['find']({'where':{'id':_0x1f5428[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](function(_0x18cabb){return db[_0x5f13('0x56')][_0x5f13('0x57')](function(_0x169c96){return _0x18cabb[_0x5f13('0x5c')](_0x1f5428['query'][_0x5f13('0x50')],{'transaction':_0x169c96})[_0x5f13('0x18')](function(){if(!_['isEmpty'](_0x5d1111)){return _0x18cabb[_0x5f13('0x6b')](_0x5d1111,{'transaction':_0x169c96});}})['then'](function(){_0x5d1111[_0x5f13('0x6c')](function(_0x256cd0){socket[_0x5f13('0x5a')](_0x5f13('0x6d'),{'UserId':_0x256cd0,'MailQueueId':_0x18cabb['id']});});});});});});})[_0x5f13('0x18')](respondWithStatusCode(_0x443bf6,null))['catch'](handleError(_0x443bf6,null));};exports[_0x5f13('0x6e')]=function(_0x46c180,_0xe7d860){return db[_0x5f13('0x20')][_0x5f13('0x31')]({'where':{'id':_0x46c180[_0x5f13('0x3a')]['id']}})['then'](handleEntityNotFound(_0xe7d860,null))[_0x5f13('0x18')](function(_0x423152){if(_0x423152){return _0x423152[_0x5f13('0x6e')](_0x46c180['body'][_0x5f13('0x50')],_['omit'](_0x46c180[_0x5f13('0x39')],[_0x5f13('0x50'),'id'])||{})['spread'](function(_0x4bcaf5){for(var _0x3d2708=0x0;_0x3d2708<_0x46c180['body'][_0x5f13('0x50')][_0x5f13('0x2e')];_0x3d2708+=0x1){socket['emit'](_0x5f13('0x5b'),{'UserId':Number(_0x46c180[_0x5f13('0x39')][_0x5f13('0x50')][_0x3d2708]),'MailQueueId':Number(_0x46c180[_0x5f13('0x3a')]['id'])});}return _0x4bcaf5;});}})[_0x5f13('0x18')](respondWithResult(_0xe7d860,null))[_0x5f13('0x32')](handleError(_0xe7d860,null));};exports[_0x5f13('0x6b')]=function(_0x56873f,_0x5a38c5){return db['MailQueue'][_0x5f13('0x31')]({'where':{'id':_0x56873f[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](handleEntityNotFound(_0x5a38c5,null))['then'](function(_0x2c66d0){if(_0x2c66d0){return _0x2c66d0[_0x5f13('0x6b')](_0x56873f[_0x5f13('0x25')][_0x5f13('0x50')])[_0x5f13('0x18')](function(){if(_[_0x5f13('0x6f')](_0x56873f[_0x5f13('0x25')][_0x5f13('0x50')])){for(var _0x2b502a=0x0;_0x2b502a<_0x56873f[_0x5f13('0x25')][_0x5f13('0x50')][_0x5f13('0x2e')];_0x2b502a+=0x1){socket[_0x5f13('0x5a')](_0x5f13('0x6d'),{'UserId':Number(_0x56873f[_0x5f13('0x25')][_0x5f13('0x50')][_0x2b502a]),'MailQueueId':Number(_0x56873f[_0x5f13('0x3a')]['id'])});}}else{socket['emit'](_0x5f13('0x6d'),{'UserId':Number(_0x56873f['query'][_0x5f13('0x50')]),'MailQueueId':Number(_0x56873f[_0x5f13('0x3a')]['id'])});}});}})[_0x5f13('0x18')](respondWithStatusCode(_0x5a38c5,null))['catch'](handleError(_0x5a38c5,null));};exports[_0x5f13('0x70')]=function(_0x222f03,_0x5b4049){var _0x1f1184={};var _0x44d092={};var _0x28615e;var _0x3b7d01;return db['MailQueue'][_0x5f13('0x71')]({'where':{'id':_0x222f03[_0x5f13('0x3a')]['id']}})[_0x5f13('0x18')](handleEntityNotFound(_0x5b4049,null))[_0x5f13('0x18')](function(_0x35d17a){if(_0x35d17a){_0x28615e=_0x35d17a;_0x44d092[_0x5f13('0x28')]=_['keys'](db[_0x5f13('0x51')][_0x5f13('0x21')]);_0x44d092[_0x5f13('0x25')]=_['keys'](_0x222f03['query']);_0x44d092[_0x5f13('0x2a')]=_['intersection'](_0x44d092[_0x5f13('0x28')],_0x44d092[_0x5f13('0x25')]);_0x1f1184[_0x5f13('0x2c')]=_[_0x5f13('0x2b')](_0x44d092['model'],qs[_0x5f13('0x2d')](_0x222f03[_0x5f13('0x25')][_0x5f13('0x2d')]));_0x1f1184['attributes']=_0x1f1184['attributes']['length']?_0x1f1184[_0x5f13('0x2c')]:_0x44d092['model'];_0x1f1184['order']=qs[_0x5f13('0x3f')](_0x222f03[_0x5f13('0x25')][_0x5f13('0x3f')]);_0x1f1184['where']=qs['filters'](_[_0x5f13('0x40')](_0x222f03['query'],_0x44d092[_0x5f13('0x2a')]));if(_0x222f03[_0x5f13('0x25')][_0x5f13('0x42')]){_0x1f1184[_0x5f13('0x43')]=_[_0x5f13('0x30')](_0x1f1184[_0x5f13('0x43')],{'$or':_['map'](_0x1f1184[_0x5f13('0x2c')],function(_0x3eb276){var _0x418dcd={};_0x418dcd[_0x3eb276]={'$like':'%'+_0x222f03['query'][_0x5f13('0x42')]+'%'};return _0x418dcd;})});}_0x1f1184=_[_0x5f13('0x30')]({},_0x1f1184,_0x222f03[_0x5f13('0x72')]);return _0x28615e[_0x5f13('0x70')](_0x1f1184);}})['then'](function(_0x3226e3){if(_0x3226e3){_0x3b7d01=_0x3226e3[_0x5f13('0x2e')];if(!_0x222f03[_0x5f13('0x25')][_0x5f13('0x3c')](_0x5f13('0x3d'))){_0x1f1184[_0x5f13('0x13')]=qs[_0x5f13('0x13')](_0x222f03[_0x5f13('0x25')][_0x5f13('0x13')]);_0x1f1184['offset']=qs['offset'](_0x222f03[_0x5f13('0x25')][_0x5f13('0x11')]);}return _0x28615e[_0x5f13('0x70')](_0x1f1184);}})[_0x5f13('0x18')](function(_0x33ff4){if(_0x33ff4){return _0x33ff4?{'count':_0x3b7d01,'rows':_0x33ff4}:null;}})['then'](respondWithResult(_0x5b4049,null))[_0x5f13('0x32')](handleError(_0x5b4049,null));}; \ No newline at end of file +var _0x51ce=['set','Content-Range','update','then','destroy','get','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','rows','catch','show','params','model','MailQueue','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserMailQueue','nolimit','order','sort','pick','filter','findAll','User','UserId','agent','mailPause','updatedAt','createdAt','SIP','getTeams','findOne','Team','options','hasOwnProperty','online','voicePause','flatMap','Agents','sequelize','addTeams','findOrCreate','emit','ids','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','userMailQueue:save','isArray','userMailQueue:remove','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','undefined','limit','count','offset'];(function(_0x5dec99,_0x5d2958){var _0x3a47c5=function(_0x59be1d){while(--_0x59be1d){_0x5dec99['push'](_0x5dec99['shift']());}};_0x3a47c5(++_0x5d2958);}(_0x51ce,0x69));var _0xe51c=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x51ce[_0x2dbcef];return _0x5a90ea;};'use strict';var BPromise=require('bluebird');var util=require(_0xe51c('0x0'));var _=require('lodash');var squel=require(_0xe51c('0x1'));var Redis=require(_0xe51c('0x2'));var qs=require(_0xe51c('0x3'));var logger=require(_0xe51c('0x4'))(_0xe51c('0x5'));var config=require(_0xe51c('0x6'));var db=require(_0xe51c('0x7'))['db'];config[_0xe51c('0x8')]=_[_0xe51c('0x9')](config[_0xe51c('0x8')],{'host':_0xe51c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x3d442b,_0x10a297){_0x10a297=_0x10a297||0xcc;return function(_0x4f8457){if(_0x4f8457){return _0x3d442b['sendStatus'](_0x10a297);}return _0x3d442b[_0xe51c('0xb')](_0x10a297)[_0xe51c('0xc')]();};}function respondWithResult(_0x5628ba,_0x68eed6){_0x68eed6=_0x68eed6||0xc8;return function(_0x8b8fc5){if(_0x8b8fc5){return _0x5628ba[_0xe51c('0xb')](_0x68eed6)[_0xe51c('0xd')](_0x8b8fc5);}};}function respondWithFilteredResult(_0x4a2432,_0x5ccc85){return function(_0x5371b1){if(_0x5371b1){var _0x4eaf4f=typeof _0x5ccc85['offset']===_0xe51c('0xe')&&typeof _0x5ccc85[_0xe51c('0xf')]===_0xe51c('0xe');var _0x118860=_0x5371b1[_0xe51c('0x10')];var _0x14bd90=_0x4eaf4f?0x0:_0x5ccc85[_0xe51c('0x11')];var _0x26bc10=_0x4eaf4f?_0x5371b1[_0xe51c('0x10')]:_0x5ccc85[_0xe51c('0x11')]+_0x5ccc85[_0xe51c('0xf')];var _0x2f4e7e;if(_0x26bc10>=_0x118860){_0x26bc10=_0x118860;_0x2f4e7e=0xc8;}else{_0x2f4e7e=0xce;}_0x4a2432[_0xe51c('0xb')](_0x2f4e7e);return _0x4a2432[_0xe51c('0x12')](_0xe51c('0x13'),_0x14bd90+'-'+_0x26bc10+'/'+_0x118860)[_0xe51c('0xd')](_0x5371b1);}return null;};}function saveUpdates(_0x33e785){return function(_0x4d6948){if(_0x4d6948){return _0x4d6948[_0xe51c('0x14')](_0x33e785)[_0xe51c('0x15')](function(_0x35c94b){return _0x35c94b;});}return null;};}function removeEntity(_0x2cb938){return function(_0x1879bb){if(_0x1879bb){return _0x1879bb[_0xe51c('0x16')]()[_0xe51c('0x15')](function(){var _0x3213a8=_0x1879bb[_0xe51c('0x17')]({'plain':!![]});var _0x232d3b='MailQueues';return db['UserProfileResource'][_0xe51c('0x16')]({'where':{'type':_0x232d3b,'resourceId':_0x3213a8['id']}})[_0xe51c('0x15')](function(){return _0x1879bb;});})[_0xe51c('0x15')](function(){_0x2cb938['status'](0xcc)[_0xe51c('0xc')]();});}};}function handleEntityNotFound(_0x1df34f){return function(_0x1361db){if(!_0x1361db){_0x1df34f[_0xe51c('0x18')](0x194);}return _0x1361db;};}function handleError(_0x5aaea5,_0x1cda73){_0x1cda73=_0x1cda73||0x1f4;return function(_0xcf4ee){logger['error'](_0xcf4ee[_0xe51c('0x19')]);if(_0xcf4ee[_0xe51c('0x1a')]){delete _0xcf4ee[_0xe51c('0x1a')];}_0x5aaea5[_0xe51c('0xb')](_0x1cda73)[_0xe51c('0x1b')](_0xcf4ee);};}exports[_0xe51c('0x1c')]=function(_0x5884d4,_0x3627a4){var _0x4a747d={};var _0xc00ce3={'count':0x0,'rows':[]};var _0x3dd7fe=_[_0xe51c('0x1d')](db['MailQueue'][_0xe51c('0x1e')],function(_0x209b53){return{'name':_0x209b53[_0xe51c('0x1f')],'type':_0x209b53[_0xe51c('0x20')][_0xe51c('0x21')]};});_0x4a747d=qs[_0xe51c('0x22')](_0x3dd7fe,_0x5884d4);var _0xc1de7e={'where':_0x4a747d[_0xe51c('0x23')]};return db['MailQueue']['count'](_0xc1de7e)['then'](function(_0x188ebc){_0xc00ce3[_0xe51c('0x10')]=_0x188ebc;_0x4a747d['include']=qs[_0xe51c('0x24')](_0x5884d4['query']);return db['MailQueue']['findAll'](_0x4a747d);})[_0xe51c('0x15')](function(_0x46ffb6){_0xc00ce3[_0xe51c('0x25')]=_0x46ffb6;return _0xc00ce3;})[_0xe51c('0x15')](respondWithFilteredResult(_0x3627a4,_0x4a747d))[_0xe51c('0x26')](handleError(_0x3627a4,null));};exports[_0xe51c('0x27')]=function(_0xe0eb16,_0x338c2d){var _0x550569={'raw':!![],'where':{'id':_0xe0eb16[_0xe51c('0x28')]['id']}},_0x249a84={};_0x249a84[_0xe51c('0x29')]=_['keys'](db[_0xe51c('0x2a')]['rawAttributes']);_0x249a84['query']=_[_0xe51c('0x2b')](_0xe0eb16[_0xe51c('0x2c')]);_0x249a84[_0xe51c('0x2d')]=_[_0xe51c('0x2e')](_0x249a84[_0xe51c('0x29')],_0x249a84[_0xe51c('0x2c')]);_0x550569['attributes']=_[_0xe51c('0x2e')](_0x249a84['model'],qs['fields'](_0xe0eb16[_0xe51c('0x2c')][_0xe51c('0x2f')]));_0x550569[_0xe51c('0x30')]=_0x550569[_0xe51c('0x30')][_0xe51c('0x31')]?_0x550569[_0xe51c('0x30')]:_0x249a84['model'];if(_0xe0eb16[_0xe51c('0x2c')][_0xe51c('0x32')]){_0x550569[_0xe51c('0x24')]=[{'all':!![]}];}_0x550569=_[_0xe51c('0x33')]({},_0x550569,_0xe0eb16['options']);return db[_0xe51c('0x2a')]['find'](_0x550569)[_0xe51c('0x15')](handleEntityNotFound(_0x338c2d,null))[_0xe51c('0x15')](respondWithResult(_0x338c2d,null))[_0xe51c('0x26')](handleError(_0x338c2d,null));};exports[_0xe51c('0x34')]=function(_0x5566ac,_0x2d9069){return db[_0xe51c('0x2a')]['create'](_0x5566ac[_0xe51c('0x35')],{})[_0xe51c('0x15')](function(_0x4da005){var _0x5e3bf1=_0x5566ac[_0xe51c('0x36')][_0xe51c('0x17')]({'plain':!![]});if(!_0x5e3bf1)throw new Error(_0xe51c('0x37'));if(_0x5e3bf1[_0xe51c('0x38')]==='user'){var _0x46f25c=_0x4da005[_0xe51c('0x17')]({'plain':!![]});var _0x30f457=_0xe51c('0x39');return db[_0xe51c('0x3a')]['find']({'where':{'name':_0x30f457,'userProfileId':_0x5e3bf1[_0xe51c('0x3b')]},'raw':!![]})['then'](function(_0x5d70d3){if(_0x5d70d3&&_0x5d70d3[_0xe51c('0x3c')]===0x0){return db[_0xe51c('0x3d')][_0xe51c('0x34')]({'name':_0x46f25c[_0xe51c('0x1a')],'resourceId':_0x46f25c['id'],'type':_0x5d70d3[_0xe51c('0x1a')],'sectionId':_0x5d70d3['id']},{})[_0xe51c('0x15')](function(){return _0x4da005;});}else{return _0x4da005;}})[_0xe51c('0x26')](function(_0x3081a6){logger[_0xe51c('0x3e')](_0xe51c('0x3f'),_0x3081a6);throw _0x3081a6;});}return _0x4da005;})[_0xe51c('0x15')](respondWithResult(_0x2d9069,0xc9))['catch'](handleError(_0x2d9069,null));};exports['update']=function(_0x470f22,_0x30ce05){if(_0x470f22[_0xe51c('0x35')]['id']){delete _0x470f22[_0xe51c('0x35')]['id'];}return db[_0xe51c('0x2a')][_0xe51c('0x40')]({'where':{'id':_0x470f22[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x30ce05,null))[_0xe51c('0x15')](saveUpdates(_0x470f22[_0xe51c('0x35')],null))[_0xe51c('0x15')](respondWithResult(_0x30ce05,null))[_0xe51c('0x26')](handleError(_0x30ce05,null));};exports['destroy']=function(_0x1cdf9c,_0x5182b4){return db[_0xe51c('0x2a')]['find']({'where':{'id':_0x1cdf9c[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x5182b4,null))[_0xe51c('0x15')](removeEntity(_0x5182b4,null))[_0xe51c('0x26')](handleError(_0x5182b4,null));};exports[_0xe51c('0x41')]=function(_0x59dad4,_0x430f7b){return db[_0xe51c('0x2a')][_0xe51c('0x41')]()['then'](respondWithResult(_0x430f7b,null))['catch'](handleError(_0x430f7b,null));};exports[_0xe51c('0x42')]=function(_0x3539da,_0x303489){var _0x2dbec4={'raw':!![],'where':{}},_0x185d80={},_0x48cebd;return db[_0xe51c('0x2a')]['findOne']({'where':{'id':_0x3539da[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x303489,null))[_0xe51c('0x15')](function(_0xdc19f0){if(_0xdc19f0){_0x48cebd=_0xdc19f0[_0xe51c('0x17')]({'plain':!![]});_0x185d80['model']=_[_0xe51c('0x2b')](db[_0xe51c('0x43')][_0xe51c('0x1e')]);_0x185d80[_0xe51c('0x2c')]=_[_0xe51c('0x2b')](_0x3539da[_0xe51c('0x2c')]);_0x185d80['filters']=_['intersection'](_0x185d80[_0xe51c('0x29')],_0x185d80['query']);_0x2dbec4['attributes']=_['intersection'](_0x185d80[_0xe51c('0x29')],qs[_0xe51c('0x2f')](_0x3539da['query'][_0xe51c('0x2f')]));_0x2dbec4[_0xe51c('0x30')]=_0x2dbec4[_0xe51c('0x30')][_0xe51c('0x31')]?_0x2dbec4[_0xe51c('0x30')]:_0x185d80[_0xe51c('0x29')];if(!_0x3539da[_0xe51c('0x2c')]['hasOwnProperty'](_0xe51c('0x44'))){_0x2dbec4[_0xe51c('0xf')]=qs[_0xe51c('0xf')](_0x3539da[_0xe51c('0x2c')][_0xe51c('0xf')]);_0x2dbec4['offset']=qs[_0xe51c('0x11')](_0x3539da['query'][_0xe51c('0x11')]);}_0x2dbec4[_0xe51c('0x45')]=qs[_0xe51c('0x46')](_0x3539da[_0xe51c('0x2c')][_0xe51c('0x46')]);_0x2dbec4[_0xe51c('0x23')]=qs[_0xe51c('0x2d')](_[_0xe51c('0x47')](_0x3539da['query'],_0x185d80[_0xe51c('0x2d')]));_0x2dbec4[_0xe51c('0x23')]['MailQueueId']=_0xdc19f0['id'];if(_0x3539da[_0xe51c('0x2c')][_0xe51c('0x48')]){_0x2dbec4['where']=_['merge'](_0x2dbec4[_0xe51c('0x23')],{'$or':_[_0xe51c('0x1d')](_0x2dbec4['attributes'],function(_0x55fcaf){var _0x2d532f={};_0x2d532f[_0x55fcaf]={'$like':'%'+_0x3539da[_0xe51c('0x2c')][_0xe51c('0x48')]+'%'};return _0x2d532f;})});}_0x2dbec4=_['merge']({},_0x2dbec4,_0x3539da['options']);return db[_0xe51c('0x43')][_0xe51c('0x49')](_0x2dbec4);}})[_0xe51c('0x15')](function(_0x2354f1){if(_0x2354f1){return db[_0xe51c('0x4a')]['findAndCountAll']({'where':{'id':_[_0xe51c('0x1d')](_0x2354f1,_0xe51c('0x4b')),'role':_0xe51c('0x4c')},'attributes':['id',_0xe51c('0x1a'),_0xe51c('0x4d'),_0xe51c('0x4e'),_0xe51c('0x4f')]});}})['then'](function(_0x591ff9){if(_0x591ff9){return{'count':_0x591ff9[_0xe51c('0x10')],'rows':_[_0xe51c('0x1d')](_0x591ff9[_0xe51c('0x25')],function(_0x225c23){return{'membername':_0x225c23[_0xe51c('0x1a')],'UserId':_0x225c23['id'],'queue_name':_0x48cebd[_0xe51c('0x1a')],'MailQueueId':_0x48cebd['id'],'interface':util['format']('%s/%s',_0xe51c('0x50'),_0x225c23['name']),'penalty':0x0,'paused':_0x225c23[_0xe51c('0x4d')],'createdAt':_0x225c23[_0xe51c('0x4f')],'updatedAt':_0x225c23[_0xe51c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe51c('0x15')](respondWithFilteredResult(_0x303489,_0x2dbec4))['catch'](handleError(_0x303489,null));};exports[_0xe51c('0x51')]=function(_0x550636,_0xa1f2d0){var _0x18e041={};var _0x4da0d0={};var _0x1e3811;var _0x2a4d86;return db[_0xe51c('0x2a')][_0xe51c('0x52')]({'where':{'id':_0x550636[_0xe51c('0x28')]['id']}})['then'](handleEntityNotFound(_0xa1f2d0,null))[_0xe51c('0x15')](function(_0x3dde87){if(_0x3dde87){_0x1e3811=_0x3dde87;_0x4da0d0['model']=_[_0xe51c('0x2b')](db[_0xe51c('0x53')][_0xe51c('0x1e')]);_0x4da0d0[_0xe51c('0x2c')]=_['keys'](_0x550636[_0xe51c('0x2c')]);_0x4da0d0[_0xe51c('0x2d')]=_[_0xe51c('0x2e')](_0x4da0d0[_0xe51c('0x29')],_0x4da0d0[_0xe51c('0x2c')]);_0x18e041[_0xe51c('0x30')]=_[_0xe51c('0x2e')](_0x4da0d0[_0xe51c('0x29')],qs[_0xe51c('0x2f')](_0x550636['query'][_0xe51c('0x2f')]));_0x18e041[_0xe51c('0x30')]=_0x18e041[_0xe51c('0x30')][_0xe51c('0x31')]?_0x18e041[_0xe51c('0x30')]:_0x4da0d0[_0xe51c('0x29')];_0x18e041[_0xe51c('0x45')]=qs[_0xe51c('0x46')](_0x550636[_0xe51c('0x2c')][_0xe51c('0x46')]);_0x18e041[_0xe51c('0x23')]=qs[_0xe51c('0x2d')](_['pick'](_0x550636['query'],_0x4da0d0[_0xe51c('0x2d')]));if(_0x550636[_0xe51c('0x2c')][_0xe51c('0x48')]){_0x18e041[_0xe51c('0x23')]=_[_0xe51c('0x33')](_0x18e041['where'],{'$or':_['map'](_0x18e041[_0xe51c('0x30')],function(_0x59b31f){var _0x28d8f8={};_0x28d8f8[_0x59b31f]={'$like':'%'+_0x550636[_0xe51c('0x2c')]['filter']+'%'};return _0x28d8f8;})});}_0x18e041=_['merge']({},_0x18e041,_0x550636[_0xe51c('0x54')]);return _0x1e3811[_0xe51c('0x51')](_0x18e041);}})['then'](function(_0x55824d){if(_0x55824d){_0x2a4d86=_0x55824d['length'];if(!_0x550636[_0xe51c('0x2c')][_0xe51c('0x55')]('nolimit')){_0x18e041[_0xe51c('0xf')]=qs[_0xe51c('0xf')](_0x550636[_0xe51c('0x2c')][_0xe51c('0xf')]);_0x18e041['offset']=qs['offset'](_0x550636[_0xe51c('0x2c')][_0xe51c('0x11')]);}return _0x1e3811[_0xe51c('0x51')](_0x18e041);}})[_0xe51c('0x15')](function(_0x50e326){if(_0x50e326){return _0x50e326?{'count':_0x2a4d86,'rows':_0x50e326}:null;}})[_0xe51c('0x15')](respondWithResult(_0xa1f2d0,null))['catch'](handleError(_0xa1f2d0,null));};exports['addTeams']=function(_0x57d845,_0x4c6390){var _0x334032=_0x57d845[_0xe51c('0x35')]['ids'];return db[_0xe51c('0x53')][_0xe51c('0x49')]({'where':{'id':_0x334032},'attributes':['id'],'include':[{'model':db[_0xe51c('0x4a')],'as':'Agents','attributes':['id','name',_0xe51c('0x56'),_0xe51c('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x13d540){if(_0x13d540){var _0x4abaf3=_[_0xe51c('0x58')](_0x13d540,function(_0x45dabf){var _0x16e3bc=_0x45dabf[_0xe51c('0x17')]({'plain':!![]});return _0x16e3bc[_0xe51c('0x59')];});return db[_0xe51c('0x2a')][_0xe51c('0x40')]({'where':{'id':_0x57d845[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](function(_0x3b6c04){return db[_0xe51c('0x5a')]['transaction'](function(_0x4d184a){return _0x3b6c04[_0xe51c('0x5b')](_0x334032,{'transaction':_0x4d184a})[_0xe51c('0x15')](function(){return BPromise['each'](_0x4abaf3,function(_0x54ba2a){return db[_0xe51c('0x43')][_0xe51c('0x5c')]({'where':{'UserId':_0x54ba2a['id'],'MailQueueId':_0x57d845['params']['id']},'transaction':_0x4d184a});});})[_0xe51c('0x15')](function(){_0x4abaf3['forEach'](function(_0x1fe9f9){socket[_0xe51c('0x5d')]('userMailQueue:save',{'UserId':_0x1fe9f9['id'],'MailQueueId':_0x3b6c04['id']});});});});});}})['then'](respondWithStatusCode(_0x4c6390,null))['catch'](handleError(_0x4c6390,null));};exports['removeTeams']=function(_0x389360,_0x27f4b3){return db[_0xe51c('0x53')][_0xe51c('0x49')]({'where':{'id':_0x389360['query'][_0xe51c('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xe51c('0x4a')],'as':_0xe51c('0x59'),'attributes':['id'],'raw':!![]}]})[_0xe51c('0x15')](handleEntityNotFound(_0x27f4b3,null))['then'](function(_0x42c333){var _0x4bae6c=_[_0xe51c('0x1d')](_0x42c333,'id');var _0x2a5221=[];var _0x267bf0=[];var _0x248a50=squel['select']();_0x248a50[_0xe51c('0x5f')](_0xe51c('0x60'))[_0xe51c('0x61')](_0xe51c('0x62'),'tq')[_0xe51c('0x63')](_0xe51c('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xe51c('0x65'),_0x389360[_0xe51c('0x28')]['id']);for(var _0x25850e=0x0;_0x25850e<_0x42c333[_0xe51c('0x31')];_0x25850e+=0x1){let _0x5074f6=_0x42c333[_0x25850e];for(var _0x57a45a=0x0;_0x57a45a<_0x5074f6[_0xe51c('0x59')][_0xe51c('0x31')];_0x57a45a+=0x1){let _0x518666=_0x5074f6['Agents'][_0x57a45a];var _0x35b460=_0x248a50[_0xe51c('0x66')]();_0x35b460[_0xe51c('0x23')]('ut.UserId\x20=\x20?',_0x518666['id']);_0x267bf0[_0xe51c('0x67')](db[_0xe51c('0x5a')][_0xe51c('0x2c')](_0x35b460[_0xe51c('0x68')](),{'type':db[_0xe51c('0x5a')][_0xe51c('0x69')][_0xe51c('0x6a')]})[_0xe51c('0x15')](function(_0x11af02){if(_0x11af02[_0xe51c('0x31')]===0x1){return _0x518666['id'];}else{var _0x1231dd=_[_0xe51c('0x6b')](_['map'](_0x11af02,'TeamId'),function(_0xd8142){return _['includes'](_0x4bae6c,_0xd8142);});if(_0x1231dd){return _0x518666['id'];}}}));}}return BPromise[_0xe51c('0x6c')](_0x267bf0)[_0xe51c('0x15')](function(_0x12af49){_0x2a5221=_(_0x2a5221)[_0xe51c('0x6d')](_0x12af49)[_0xe51c('0x6e')]()[_0xe51c('0x6f')]();return db[_0xe51c('0x2a')][_0xe51c('0x40')]({'where':{'id':_0x389360[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](function(_0x31bf94){return db[_0xe51c('0x5a')][_0xe51c('0x70')](function(_0x509f7b){return _0x31bf94['removeTeams'](_0x389360[_0xe51c('0x2c')][_0xe51c('0x5e')],{'transaction':_0x509f7b})[_0xe51c('0x15')](function(){if(!_[_0xe51c('0x71')](_0x2a5221)){return _0x31bf94[_0xe51c('0x72')](_0x2a5221,{'transaction':_0x509f7b});}})['then'](function(){_0x2a5221[_0xe51c('0x73')](function(_0x370335){socket[_0xe51c('0x5d')]('userMailQueue:remove',{'UserId':_0x370335,'MailQueueId':_0x31bf94['id']});});});});});});})[_0xe51c('0x15')](respondWithStatusCode(_0x27f4b3,null))['catch'](handleError(_0x27f4b3,null));};exports[_0xe51c('0x74')]=function(_0x538170,_0x312404){return db['MailQueue']['find']({'where':{'id':_0x538170[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x312404,null))[_0xe51c('0x15')](function(_0x4f914b){if(_0x4f914b){return _0x4f914b[_0xe51c('0x74')](_0x538170[_0xe51c('0x35')][_0xe51c('0x5e')],_[_0xe51c('0x75')](_0x538170[_0xe51c('0x35')],['ids','id'])||{})[_0xe51c('0x76')](function(_0x43509b){for(var _0x11bee6=0x0;_0x11bee6<_0x538170['body'][_0xe51c('0x5e')][_0xe51c('0x31')];_0x11bee6+=0x1){socket[_0xe51c('0x5d')](_0xe51c('0x77'),{'UserId':Number(_0x538170[_0xe51c('0x35')][_0xe51c('0x5e')][_0x11bee6]),'MailQueueId':Number(_0x538170[_0xe51c('0x28')]['id'])});}return _0x43509b;});}})['then'](respondWithResult(_0x312404,null))[_0xe51c('0x26')](handleError(_0x312404,null));};exports[_0xe51c('0x72')]=function(_0x5da2bc,_0x6446d4){return db['MailQueue'][_0xe51c('0x40')]({'where':{'id':_0x5da2bc[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x6446d4,null))['then'](function(_0x4b7569){if(_0x4b7569){return _0x4b7569[_0xe51c('0x72')](_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')])[_0xe51c('0x15')](function(){if(_[_0xe51c('0x78')](_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')])){for(var _0xbb981e=0x0;_0xbb981e<_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')][_0xe51c('0x31')];_0xbb981e+=0x1){socket['emit'](_0xe51c('0x79'),{'UserId':Number(_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')][_0xbb981e]),'MailQueueId':Number(_0x5da2bc[_0xe51c('0x28')]['id'])});}}else{socket['emit'](_0xe51c('0x79'),{'UserId':Number(_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')]),'MailQueueId':Number(_0x5da2bc[_0xe51c('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x6446d4,null))['catch'](handleError(_0x6446d4,null));};exports[_0xe51c('0x7a')]=function(_0x23c2e2,_0x590860){var _0x5bf82b={};var _0x1594e2={};var _0x6aa61d;var _0x3a994a;return db['MailQueue'][_0xe51c('0x52')]({'where':{'id':_0x23c2e2[_0xe51c('0x28')]['id']}})['then'](handleEntityNotFound(_0x590860,null))[_0xe51c('0x15')](function(_0x3fdc6c){if(_0x3fdc6c){_0x6aa61d=_0x3fdc6c;_0x1594e2[_0xe51c('0x29')]=_[_0xe51c('0x2b')](db[_0xe51c('0x4a')][_0xe51c('0x1e')]);_0x1594e2[_0xe51c('0x2c')]=_[_0xe51c('0x2b')](_0x23c2e2['query']);_0x1594e2[_0xe51c('0x2d')]=_[_0xe51c('0x2e')](_0x1594e2[_0xe51c('0x29')],_0x1594e2[_0xe51c('0x2c')]);_0x5bf82b[_0xe51c('0x30')]=_[_0xe51c('0x2e')](_0x1594e2[_0xe51c('0x29')],qs[_0xe51c('0x2f')](_0x23c2e2['query'][_0xe51c('0x2f')]));_0x5bf82b['attributes']=_0x5bf82b[_0xe51c('0x30')][_0xe51c('0x31')]?_0x5bf82b[_0xe51c('0x30')]:_0x1594e2[_0xe51c('0x29')];_0x5bf82b[_0xe51c('0x45')]=qs[_0xe51c('0x46')](_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0x46')]);_0x5bf82b[_0xe51c('0x23')]=qs[_0xe51c('0x2d')](_[_0xe51c('0x47')](_0x23c2e2[_0xe51c('0x2c')],_0x1594e2[_0xe51c('0x2d')]));if(_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0x48')]){_0x5bf82b['where']=_[_0xe51c('0x33')](_0x5bf82b[_0xe51c('0x23')],{'$or':_[_0xe51c('0x1d')](_0x5bf82b[_0xe51c('0x30')],function(_0xf9d363){var _0x42a484={};_0x42a484[_0xf9d363]={'$like':'%'+_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0x48')]+'%'};return _0x42a484;})});}_0x5bf82b=_[_0xe51c('0x33')]({},_0x5bf82b,_0x23c2e2['options']);return _0x6aa61d[_0xe51c('0x7a')](_0x5bf82b);}})[_0xe51c('0x15')](function(_0x1d6166){if(_0x1d6166){_0x3a994a=_0x1d6166['length'];if(!_0x23c2e2[_0xe51c('0x2c')]['hasOwnProperty']('nolimit')){_0x5bf82b['limit']=qs[_0xe51c('0xf')](_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0xf')]);_0x5bf82b[_0xe51c('0x11')]=qs[_0xe51c('0x11')](_0x23c2e2[_0xe51c('0x2c')]['offset']);}return _0x6aa61d[_0xe51c('0x7a')](_0x5bf82b);}})[_0xe51c('0x15')](function(_0x3d9e72){if(_0x3d9e72){return _0x3d9e72?{'count':_0x3a994a,'rows':_0x3d9e72}:null;}})['then'](respondWithResult(_0x590860,null))[_0xe51c('0x26')](handleError(_0x590860,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 101f0ac..3f67298 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 _0xff30=['../../mysqldb','MailQueue','setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x30a2b4,_0x2fe7b3){var _0x1b2bef=function(_0x1ac36d){while(--_0x1ac36d){_0x30a2b4['push'](_0x30a2b4['shift']());}};_0x1b2bef(++_0x2fe7b3);}(_0xff30,0xa7));var _0x0ff3=function(_0x1f41e3,_0x1b653e){_0x1f41e3=_0x1f41e3-0x0;var _0x599580=_0xff30[_0x1f41e3];return _0x599580;};'use strict';var EventEmitter=require(_0x0ff3('0x0'));var MailQueue=require(_0x0ff3('0x1'))['db'][_0x0ff3('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0ff3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0ff3('0x4')};function emitEvent(_0x6d5c72){return function(_0x296e16,_0x3f396f,_0x11c4ea){MailQueueEvents[_0x0ff3('0x5')](_0x6d5c72+':'+_0x296e16['id'],_0x296e16);MailQueueEvents[_0x0ff3('0x5')](_0x6d5c72,_0x296e16);_0x11c4ea(null);};}for(var e in events){if(events[_0x0ff3('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x0ff3('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x0f5e=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x36e900,_0x4b0279){var _0xeccc59=function(_0x198867){while(--_0x198867){_0x36e900['push'](_0x36e900['shift']());}};_0xeccc59(++_0x4b0279);}(_0x0f5e,0x177));var _0xe0f5=function(_0x14bbb2,_0x332f86){_0x14bbb2=_0x14bbb2-0x0;var _0x2026ca=_0x0f5e[_0x14bbb2];return _0x2026ca;};'use strict';var EventEmitter=require(_0xe0f5('0x0'));var MailQueue=require(_0xe0f5('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0f5('0x2'),'afterUpdate':_0xe0f5('0x3'),'afterDestroy':_0xe0f5('0x4')};function emitEvent(_0xb02936){return function(_0x1fc531,_0x1ba229,_0x57459b){MailQueueEvents[_0xe0f5('0x5')](_0xb02936+':'+_0x1fc531['id'],_0x1fc531);MailQueueEvents[_0xe0f5('0x5')](_0xb02936,_0x1fc531);_0x57459b(null);};}for(var e in events){if(events[_0xe0f5('0x6')](e)){var event=events[e];MailQueue[_0xe0f5('0x7')](e,emitEvent(event));}}module[_0xe0f5('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 61244f0..f8e96e3 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 _0xd8ca=['rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','api','request-promise','path'];(function(_0x3d0450,_0xea960a){var _0x46c497=function(_0x331f6d){while(--_0x331f6d){_0x3d0450['push'](_0x3d0450['shift']());}};_0x46c497(++_0xea960a);}(_0xd8ca,0xde));var _0xad8c=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xd8ca[_0x4b12ae];return _0x16957b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xad8c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad8c('0x1'));var fs=require('fs');var path=require(_0xad8c('0x2'));var rimraf=require(_0xad8c('0x3'));var config=require(_0xad8c('0x4'));var attributes=require(_0xad8c('0x5'));module['exports']=function(_0x2ef020,_0x204bef){return _0x2ef020[_0xad8c('0x6')](_0xad8c('0x7'),attributes,{'tableName':_0xad8c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f80=['request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','lodash','util','api','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4f80,0xb7));var _0x04f8=function(_0x1e441f,_0x51dcad){_0x1e441f=_0x1e441f-0x0;var _0x5dc8d4=_0x4f80[_0x1e441f];return _0x5dc8d4;};'use strict';var _=require(_0x04f8('0x0'));var util=require(_0x04f8('0x1'));var logger=require('../../config/logger')(_0x04f8('0x2'));var moment=require('moment');var BPromise=require(_0x04f8('0x3'));var rp=require(_0x04f8('0x4'));var fs=require('fs');var path=require(_0x04f8('0x5'));var rimraf=require(_0x04f8('0x6'));var config=require('../../config/environment');var attributes=require(_0x04f8('0x7'));module[_0x04f8('0x8')]=function(_0x1a1645,_0x526127){return _0x1a1645[_0x04f8('0x9')](_0x04f8('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index da48a1c..88047ea 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 _0x0624=['options','raw','attributes','include','map','model','GetMailQueue','find','where','ShowMailQueue','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0x0624,0x132));var _0x4062=function(_0x142f2d,_0x1c1211){_0x142f2d=_0x142f2d-0x0;var _0x2f072c=_0x0624[_0x142f2d];return _0x2f072c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});config[_0x4062('0x8')]=_[_0x4062('0x9')](config[_0x4062('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4062('0xa'))(new Redis(config['redis']));require(_0x4062('0xb'))[_0x4062('0xc')](socket);function respondWithRpcPromise(_0xec9d4f,_0x5343e6,_0x4065eb){return new BPromise(function(_0x27632,_0x112194){return client['request'](_0xec9d4f,_0x4065eb)[_0x4062('0xd')](function(_0x5274a0){logger[_0x4062('0xe')](_0x4062('0xf'),_0x5343e6,_0x4062('0x10'));logger[_0x4062('0x11')](_0x4062('0x12'),_0x5343e6,'request\x20sent',JSON[_0x4062('0x13')](_0x5274a0));if(_0x5274a0[_0x4062('0x14')]){if(_0x5274a0['error'][_0x4062('0x15')]===0x1f4){logger[_0x4062('0x14')](_0x4062('0xf'),_0x5343e6,_0x5274a0['error']['message']);return _0x112194(_0x5274a0[_0x4062('0x14')][_0x4062('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x5343e6,_0x5274a0['error']['message']);return _0x27632(_0x5274a0[_0x4062('0x14')]['message']);}else{logger[_0x4062('0xe')](_0x4062('0xf'),_0x5343e6,_0x4062('0x10'));_0x27632(_0x5274a0[_0x4062('0x17')][_0x4062('0x16')]);}})[_0x4062('0x18')](function(_0x448779){logger['error'](_0x4062('0xf'),_0x5343e6,_0x448779);_0x112194(_0x448779);});});}exports['GetMailQueue']=function(_0x197d25){var _0x4f0a3f=this;return new Promise(function(_0x8da592,_0x31777f){return db[_0x4062('0x19')][_0x4062('0x1a')]({'raw':_0x197d25[_0x4062('0x1b')]?_0x197d25[_0x4062('0x1b')][_0x4062('0x1c')]===undefined?!![]:![]:!![],'where':_0x197d25[_0x4062('0x1b')]?_0x197d25[_0x4062('0x1b')]['where']||null:null,'attributes':_0x197d25['options']?_0x197d25[_0x4062('0x1b')][_0x4062('0x1d')]||null:null,'limit':_0x197d25[_0x4062('0x1b')]?_0x197d25[_0x4062('0x1b')]['limit']||null:null,'include':_0x197d25['options']?_0x197d25['options'][_0x4062('0x1e')]?_[_0x4062('0x1f')](_0x197d25[_0x4062('0x1b')][_0x4062('0x1e')],function(_0x3c1ee0){return{'model':db[_0x3c1ee0[_0x4062('0x20')]],'as':_0x3c1ee0['as'],'attributes':_0x3c1ee0['attributes'],'include':_0x3c1ee0[_0x4062('0x1e')]?_[_0x4062('0x1f')](_0x3c1ee0[_0x4062('0x1e')],function(_0x28e9e4){return{'model':db[_0x28e9e4[_0x4062('0x20')]],'as':_0x28e9e4['as'],'attributes':_0x28e9e4['attributes'],'include':_0x28e9e4[_0x4062('0x1e')]?_['map'](_0x28e9e4['include'],function(_0x391065){return{'model':db[_0x391065['model']],'as':_0x391065['as'],'attributes':_0x391065[_0x4062('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4062('0xd')](function(_0x9c9fc3){logger[_0x4062('0xe')](_0x4062('0x21'),_0x197d25);logger[_0x4062('0x11')](_0x4062('0x21'),_0x197d25,JSON[_0x4062('0x13')](_0x9c9fc3));_0x8da592(_0x9c9fc3);})['catch'](function(_0x592fca){logger['error'](_0x4062('0x21'),_0x592fca[_0x4062('0x16')],_0x197d25);_0x31777f(_0x4f0a3f['error'](0x1f4,_0x592fca[_0x4062('0x16')]));});});};exports['ShowMailQueue']=function(_0x52e996){var _0x584f49=this;return new Promise(function(_0x40368d,_0x1792d0){return db[_0x4062('0x19')][_0x4062('0x22')]({'raw':_0x52e996[_0x4062('0x1b')]?_0x52e996[_0x4062('0x1b')][_0x4062('0x1c')]===undefined?!![]:![]:!![],'where':_0x52e996[_0x4062('0x1b')]?_0x52e996[_0x4062('0x1b')][_0x4062('0x23')]||null:null,'attributes':_0x52e996[_0x4062('0x1b')]?_0x52e996[_0x4062('0x1b')]['attributes']||null:null,'include':_0x52e996[_0x4062('0x1b')]?_0x52e996['options'][_0x4062('0x1e')]?_[_0x4062('0x1f')](_0x52e996[_0x4062('0x1b')]['include'],function(_0x389d65){return{'model':db[_0x389d65[_0x4062('0x20')]],'as':_0x389d65['as'],'attributes':_0x389d65[_0x4062('0x1d')],'include':_0x389d65[_0x4062('0x1e')]?_[_0x4062('0x1f')](_0x389d65[_0x4062('0x1e')],function(_0x452e59){return{'model':db[_0x452e59[_0x4062('0x20')]],'as':_0x452e59['as'],'attributes':_0x452e59[_0x4062('0x1d')],'include':_0x452e59['include']?_[_0x4062('0x1f')](_0x452e59[_0x4062('0x1e')],function(_0x1c3851){return{'model':db[_0x1c3851[_0x4062('0x20')]],'as':_0x1c3851['as'],'attributes':_0x1c3851[_0x4062('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4062('0xd')](function(_0x50616c){logger[_0x4062('0xe')](_0x4062('0x24'),_0x52e996);logger[_0x4062('0x11')](_0x4062('0x24'),_0x52e996,JSON[_0x4062('0x13')](_0x50616c));_0x40368d(_0x50616c);})['catch'](function(_0x5534b7){logger[_0x4062('0x14')](_0x4062('0x24'),_0x5534b7['message'],_0x52e996);_0x1792d0(_0x584f49[_0x4062('0x14')](0x1f4,_0x5534b7[_0x4062('0x16')]));});});}; \ No newline at end of file +var _0x9e1d=['MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','result','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info'];(function(_0x4b0b34,_0x2e2f7c){var _0x574dc5=function(_0x253a7a){while(--_0x253a7a){_0x4b0b34['push'](_0x4b0b34['shift']());}};_0x574dc5(++_0x2e2f7c);}(_0x9e1d,0x12e));var _0xd9e1=function(_0x7087c3,_0xafa184){_0x7087c3=_0x7087c3-0x0;var _0x2b70db=_0x9e1d[_0x7087c3];return _0x2b70db;};'use strict';var _=require(_0xd9e1('0x0'));var util=require(_0xd9e1('0x1'));var moment=require(_0xd9e1('0x2'));var BPromise=require(_0xd9e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e1('0x4'));var db=require(_0xd9e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9e1('0x6'))(_0xd9e1('0x7'));var config=require(_0xd9e1('0x8'));var jayson=require(_0xd9e1('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd9e1('0xa')]=_['defaults'](config[_0xd9e1('0xa')],{'host':_0xd9e1('0xb'),'port':0x18eb});var socket=require(_0xd9e1('0xc'))(new Redis(config['redis']));require(_0xd9e1('0xd'))[_0xd9e1('0xe')](socket);function respondWithRpcPromise(_0x3233aa,_0x436ed9,_0x109505){return new BPromise(function(_0x26f14b,_0x478f19){return client[_0xd9e1('0xf')](_0x3233aa,_0x109505)[_0xd9e1('0x10')](function(_0x58834e){logger[_0xd9e1('0x11')](_0xd9e1('0x12'),_0x436ed9,'request\x20sent');logger[_0xd9e1('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x436ed9,_0xd9e1('0x14'),JSON[_0xd9e1('0x15')](_0x58834e));if(_0x58834e[_0xd9e1('0x16')]){if(_0x58834e[_0xd9e1('0x16')][_0xd9e1('0x17')]===0x1f4){logger[_0xd9e1('0x16')]('MailQueue,\x20%s,\x20%s',_0x436ed9,_0x58834e['error']['message']);return _0x478f19(_0x58834e[_0xd9e1('0x16')]['message']);}logger[_0xd9e1('0x16')]('MailQueue,\x20%s,\x20%s',_0x436ed9,_0x58834e[_0xd9e1('0x16')]['message']);return _0x26f14b(_0x58834e[_0xd9e1('0x16')]['message']);}else{logger[_0xd9e1('0x11')](_0xd9e1('0x12'),_0x436ed9,_0xd9e1('0x14'));_0x26f14b(_0x58834e[_0xd9e1('0x18')][_0xd9e1('0x19')]);}})[_0xd9e1('0x1a')](function(_0x220297){logger['error'](_0xd9e1('0x12'),_0x436ed9,_0x220297);_0x478f19(_0x220297);});});}exports[_0xd9e1('0x1b')]=function(_0x58befc){var _0x1956b6=this;return new Promise(function(_0x4c0cd3,_0x5da2c7){return db[_0xd9e1('0x1c')][_0xd9e1('0x1d')]({'raw':_0x58befc[_0xd9e1('0x1e')]?_0x58befc[_0xd9e1('0x1e')][_0xd9e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x58befc[_0xd9e1('0x1e')]?_0x58befc[_0xd9e1('0x1e')][_0xd9e1('0x20')]||null:null,'attributes':_0x58befc[_0xd9e1('0x1e')]?_0x58befc[_0xd9e1('0x1e')]['attributes']||null:null,'limit':_0x58befc[_0xd9e1('0x1e')]?_0x58befc['options'][_0xd9e1('0x21')]||null:null,'include':_0x58befc['options']?_0x58befc[_0xd9e1('0x1e')][_0xd9e1('0x22')]?_[_0xd9e1('0x23')](_0x58befc[_0xd9e1('0x1e')]['include'],function(_0x25807b){return{'model':db[_0x25807b['model']],'as':_0x25807b['as'],'attributes':_0x25807b[_0xd9e1('0x24')],'include':_0x25807b[_0xd9e1('0x22')]?_[_0xd9e1('0x23')](_0x25807b[_0xd9e1('0x22')],function(_0x58210a){return{'model':db[_0x58210a[_0xd9e1('0x25')]],'as':_0x58210a['as'],'attributes':_0x58210a[_0xd9e1('0x24')],'include':_0x58210a['include']?_['map'](_0x58210a[_0xd9e1('0x22')],function(_0x3cd58a){return{'model':db[_0x3cd58a[_0xd9e1('0x25')]],'as':_0x3cd58a['as'],'attributes':_0x3cd58a[_0xd9e1('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28b2c6){logger[_0xd9e1('0x11')](_0xd9e1('0x1b'),_0x58befc);logger[_0xd9e1('0x13')]('GetMailQueue',_0x58befc,JSON['stringify'](_0x28b2c6));_0x4c0cd3(_0x28b2c6);})[_0xd9e1('0x1a')](function(_0x52a315){logger[_0xd9e1('0x16')]('GetMailQueue',_0x52a315[_0xd9e1('0x19')],_0x58befc);_0x5da2c7(_0x1956b6[_0xd9e1('0x16')](0x1f4,_0x52a315['message']));});});};exports[_0xd9e1('0x26')]=function(_0x29696d){var _0x5b00d2=this;return new Promise(function(_0x2345b6,_0x200273){return db[_0xd9e1('0x1c')][_0xd9e1('0x27')]({'raw':_0x29696d[_0xd9e1('0x1e')]?_0x29696d[_0xd9e1('0x1e')][_0xd9e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x29696d[_0xd9e1('0x1e')]?_0x29696d[_0xd9e1('0x1e')]['where']||null:null,'attributes':_0x29696d[_0xd9e1('0x1e')]?_0x29696d[_0xd9e1('0x1e')][_0xd9e1('0x24')]||null:null,'include':_0x29696d[_0xd9e1('0x1e')]?_0x29696d['options'][_0xd9e1('0x22')]?_['map'](_0x29696d['options'][_0xd9e1('0x22')],function(_0xed9009){return{'model':db[_0xed9009[_0xd9e1('0x25')]],'as':_0xed9009['as'],'attributes':_0xed9009[_0xd9e1('0x24')],'include':_0xed9009[_0xd9e1('0x22')]?_[_0xd9e1('0x23')](_0xed9009[_0xd9e1('0x22')],function(_0x33c656){return{'model':db[_0x33c656[_0xd9e1('0x25')]],'as':_0x33c656['as'],'attributes':_0x33c656['attributes'],'include':_0x33c656[_0xd9e1('0x22')]?_['map'](_0x33c656['include'],function(_0x53b988){return{'model':db[_0x53b988[_0xd9e1('0x25')]],'as':_0x53b988['as'],'attributes':_0x53b988[_0xd9e1('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43a00f){logger[_0xd9e1('0x11')](_0xd9e1('0x26'),_0x29696d);logger['debug'](_0xd9e1('0x26'),_0x29696d,JSON[_0xd9e1('0x15')](_0x43a00f));_0x2345b6(_0x43a00f);})[_0xd9e1('0x1a')](function(_0x5bfb61){logger[_0xd9e1('0x16')]('ShowMailQueue',_0x5bfb61[_0xd9e1('0x19')],_0x29696d);_0x200273(_0x5b00d2[_0xd9e1('0x16')](0x1f4,_0x5bfb61[_0xd9e1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3f6cae0..b5a5fc4 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 _0xf640=['remove','update','emit','removeListener','length','mailQueue:','./mailQueue.events','save'];(function(_0x1f4310,_0x1253bd){var _0x3511fe=function(_0x31e70f){while(--_0x31e70f){_0x1f4310['push'](_0x1f4310['shift']());}};_0x3511fe(++_0x1253bd);}(_0xf640,0x16e));var _0x0f64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf640[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x0f64('0x0'));var events=[_0x0f64('0x1'),_0x0f64('0x2'),_0x0f64('0x3')];function createListener(_0x4c8149,_0xa2b00){return function(_0x3031b4){_0xa2b00[_0x0f64('0x4')](_0x4c8149,_0x3031b4);};}function removeListener(_0x12666b,_0x5d9ab6){return function(){MailQueueEvents[_0x0f64('0x5')](_0x12666b,_0x5d9ab6);};}exports['register']=function(_0x6c0f81){for(var _0x20af0d=0x0,_0x56de6b=events[_0x0f64('0x6')];_0x20af0d<_0x56de6b;_0x20af0d++){var _0xbb7460=events[_0x20af0d];var _0x3b1630=createListener(_0x0f64('0x7')+_0xbb7460,_0x6c0f81);MailQueueEvents['on'](_0xbb7460,_0x3b1630);}}; \ No newline at end of file +var _0xfe99=['remove','update','emit','removeListener','register','length','mailQueue:','save'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xfe99,0x11f));var _0x9fe9=function(_0x1cf979,_0x53c123){_0x1cf979=_0x1cf979-0x0;var _0x2eda48=_0xfe99[_0x1cf979];return _0x2eda48;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9fe9('0x0'),_0x9fe9('0x1'),_0x9fe9('0x2')];function createListener(_0x3113,_0x2dd6ac){return function(_0x1bc527){_0x2dd6ac[_0x9fe9('0x3')](_0x3113,_0x1bc527);};}function removeListener(_0x491bd7,_0x2dbfae){return function(){MailQueueEvents[_0x9fe9('0x4')](_0x491bd7,_0x2dbfae);};}exports[_0x9fe9('0x5')]=function(_0x3b31ce){for(var _0x25cd36=0x0,_0x46e6c5=events[_0x9fe9('0x6')];_0x25cd36<_0x46e6c5;_0x25cd36++){var _0x1e544d=events[_0x25cd36];var _0x1e63b9=createListener(_0x9fe9('0x7')+_0x1e544d,_0x3b31ce);MailQueueEvents['on'](_0x1e544d,_0x1e63b9);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b5fb7b3..e04bc2a 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 _0x02ca=['./mailQueueReport.controller','get','index','isAuthenticated','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20d290,_0x40fc11){var _0x2bfa8f=function(_0x2498e0){while(--_0x2498e0){_0x20d290['push'](_0x20d290['shift']());}};_0x2bfa8f(++_0x40fc11);}(_0x02ca,0xa3));var _0xa02c=function(_0x57204f,_0x111285){_0x57204f=_0x57204f-0x0;var _0x1366d1=_0x02ca[_0x57204f];return _0x1366d1;};'use strict';var multer=require('multer');var util=require(_0xa02c('0x0'));var path=require(_0xa02c('0x1'));var timeout=require(_0xa02c('0x2'));var express=require(_0xa02c('0x3'));var router=express[_0xa02c('0x4')]();var fs_extra=require(_0xa02c('0x5'));var auth=require(_0xa02c('0x6'));var interaction=require(_0xa02c('0x7'));var config=require('../../config/environment');var controller=require(_0xa02c('0x8'));router[_0xa02c('0x9')]('/',auth['isAuthenticated'](),controller[_0xa02c('0xa')]);router[_0xa02c('0x9')]('/describe',auth[_0xa02c('0xb')](),controller['describe']);router[_0xa02c('0x9')](_0xa02c('0xc'),auth[_0xa02c('0xb')](),controller[_0xa02c('0xd')]);router[_0xa02c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa02c('0xf')](_0xa02c('0xc'),auth[_0xa02c('0xb')](),controller[_0xa02c('0x10')]);router[_0xa02c('0x11')](_0xa02c('0xc'),auth[_0xa02c('0xb')](),controller[_0xa02c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8a5d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x2a30e5,_0x320656){var _0x2ab913=function(_0xf735b4){while(--_0xf735b4){_0x2a30e5['push'](_0x2a30e5['shift']());}};_0x2ab913(++_0x320656);}(_0x8a5d,0x104));var _0xd8a5=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x8a5d[_0x23e6bb];return _0x1e3b4c;};'use strict';var multer=require('multer');var util=require(_0xd8a5('0x0'));var path=require(_0xd8a5('0x1'));var timeout=require(_0xd8a5('0x2'));var express=require('express');var router=express[_0xd8a5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd8a5('0x4'));var interaction=require(_0xd8a5('0x5'));var config=require(_0xd8a5('0x6'));var controller=require(_0xd8a5('0x7'));router[_0xd8a5('0x8')]('/',auth[_0xd8a5('0x9')](),controller[_0xd8a5('0xa')]);router['get'](_0xd8a5('0xb'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0xc')]);router[_0xd8a5('0x8')](_0xd8a5('0xd'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0xe')]);router[_0xd8a5('0xf')]('/',auth[_0xd8a5('0x9')](),controller[_0xd8a5('0x10')]);router[_0xd8a5('0x11')](_0xd8a5('0xd'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0x12')]);router[_0xd8a5('0x13')](_0xd8a5('0xd'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0x14')]);module[_0xd8a5('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a55c4c5..f60c842 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 _0x9b08=['STRING','DATE','moment','sequelize'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x9b08,0x1ea));var _0x89b0=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x9b08[_0xcd0918];return _0x250704;};'use strict';var moment=require(_0x89b0('0x0'));var Sequelize=require(_0x89b0('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x89b0('0x2')]},'joinAt':{'type':Sequelize[_0x89b0('0x3')]},'leaveAt':{'type':Sequelize[_0x89b0('0x3')]},'acceptAt':{'type':Sequelize[_0x89b0('0x3')]},'exitAt':{'type':Sequelize[_0x89b0('0x3')]},'reason':{'type':Sequelize[_0x89b0('0x2')]}}; \ No newline at end of file +var _0xba27=['sequelize','exports','STRING','DATE'];(function(_0x443b42,_0xe3f647){var _0x2b706b=function(_0x26abce){while(--_0x26abce){_0x443b42['push'](_0x443b42['shift']());}};_0x2b706b(++_0xe3f647);}(_0xba27,0x15c));var _0x7ba2=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xba27[_0x349367];return _0x14179b;};'use strict';var moment=require('moment');var Sequelize=require(_0x7ba2('0x0'));module[_0x7ba2('0x1')]={'uniqueid':{'type':Sequelize[_0x7ba2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7ba2('0x2')]},'joinAt':{'type':Sequelize[_0x7ba2('0x3')]},'leaveAt':{'type':Sequelize[_0x7ba2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7ba2('0x3')]},'reason':{'type':Sequelize[_0x7ba2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ff11326..7bc71bc 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 _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x4c8d17,_0x397374){var _0x199da0=function(_0x384e92){while(--_0x384e92){_0x4c8d17['push'](_0x4c8d17['shift']());}};_0x199da0(++_0x397374);}(_0x47c5,0x165));var _0x547c=function(_0xf6bb7d,_0x8af4f5){_0xf6bb7d=_0xf6bb7d-0x0;var _0x132764=_0x47c5[_0xf6bb7d];return _0x132764;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0x056b=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','stack','name','send','MailQueueReport','rawAttributes'];(function(_0x571f28,_0x51320b){var _0x5b8667=function(_0x236314){while(--_0x236314){_0x571f28['push'](_0x571f28['shift']());}};_0x5b8667(++_0x51320b);}(_0x056b,0xb6));var _0xb056=function(_0x24e893,_0x130483){_0x24e893=_0x24e893-0x0;var _0x437e82=_0x056b[_0x24e893];return _0x437e82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a14f,_0x10b9b3){return function(_0x5c39db){if(!_0x5c39db){_0x44a14f[_0xb056('0x1b')](0x194);}return _0x5c39db;};}function handleError(_0x265782,_0x2ae873){_0x2ae873=_0x2ae873||0x1f4;return function(_0x1d2c66){logger[_0xb056('0x28')](_0x1d2c66[_0xb056('0x29')]);if(_0x1d2c66[_0xb056('0x2a')]){delete _0x1d2c66[_0xb056('0x2a')];}_0x265782['status'](_0x2ae873)[_0xb056('0x2b')](_0x1d2c66);};}exports['index']=function(_0x3d83d3,_0x9c6f4a){var _0x294874={},_0x488185={},_0xd53267={'count':0x0,'rows':[]};var _0x264569=_['map'](db[_0xb056('0x2c')][_0xb056('0x2d')],function(_0x329eaa){return{'name':_0x329eaa[_0xb056('0x2e')],'type':_0x329eaa[_0xb056('0x2f')]['key']};});_0x488185[_0xb056('0x30')]=_[_0xb056('0x31')](_0x264569,_0xb056('0x2a'));_0x488185[_0xb056('0x32')]=_[_0xb056('0x33')](_0x3d83d3['query']);_0x488185[_0xb056('0x34')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],_0x488185[_0xb056('0x32')]);_0x294874[_0xb056('0x36')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],qs[_0xb056('0x37')](_0x3d83d3['query'][_0xb056('0x37')]));_0x294874['attributes']=_0x294874[_0xb056('0x36')]['length']?_0x294874['attributes']:_0x488185[_0xb056('0x30')];if(!_0x3d83d3[_0xb056('0x32')][_0xb056('0x38')](_0xb056('0x39'))){_0x294874[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x3d83d3[_0xb056('0x32')]['limit']);_0x294874[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x3d83d3['query']['offset']);}_0x294874[_0xb056('0x3a')]=qs[_0xb056('0x3b')](_0x3d83d3[_0xb056('0x32')]['sort']);_0x294874[_0xb056('0x3c')]=qs[_0xb056('0x34')](_[_0xb056('0x3d')](_0x3d83d3[_0xb056('0x32')],_0x488185[_0xb056('0x34')]),_0x264569);if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]){_0x294874[_0xb056('0x3c')]=_[_0xb056('0x3f')](_0x294874[_0xb056('0x3c')],{'$or':_[_0xb056('0x31')](_0x264569,function(_0x1afc7f){if(_0x1afc7f['type']!==_0xb056('0x40')){var _0x4acc94={};_0x4acc94[_0x1afc7f[_0xb056('0x2a')]]={'$like':'%'+_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]+'%'};return _0x4acc94;}})});}_0x294874=_[_0xb056('0x3f')]({},_0x294874,_0x3d83d3[_0xb056('0x41')]);var _0x661784={'where':_0x294874[_0xb056('0x3c')]};return db[_0xb056('0x2c')]['count'](_0x661784)[_0xb056('0x26')](function(_0x21a34b){_0xd53267[_0xb056('0x21')]=_0x21a34b;if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x42')]){_0x294874['include']=[{'all':!![]}];}return db[_0xb056('0x2c')][_0xb056('0x43')](_0x294874);})[_0xb056('0x26')](function(_0x216f72){_0xd53267[_0xb056('0x44')]=_0x216f72;return _0xd53267;})[_0xb056('0x26')](respondWithFilteredResult(_0x9c6f4a,_0x294874))['catch'](handleError(_0x9c6f4a,null));};exports[_0xb056('0x45')]=function(_0x5040f6,_0x3bcc3d){var _0xc729f3={'raw':!![],'where':{'id':_0x5040f6[_0xb056('0x46')]['id']}},_0x21d98e={};_0x21d98e[_0xb056('0x30')]=_[_0xb056('0x33')](db[_0xb056('0x2c')][_0xb056('0x2d')]);_0x21d98e[_0xb056('0x32')]=_[_0xb056('0x33')](_0x5040f6['query']);_0x21d98e[_0xb056('0x34')]=_[_0xb056('0x35')](_0x21d98e[_0xb056('0x30')],_0x21d98e['query']);_0xc729f3[_0xb056('0x36')]=_[_0xb056('0x35')](_0x21d98e['model'],qs['fields'](_0x5040f6[_0xb056('0x32')][_0xb056('0x37')]));_0xc729f3[_0xb056('0x36')]=_0xc729f3[_0xb056('0x36')]['length']?_0xc729f3['attributes']:_0x21d98e['model'];if(_0x5040f6['query']['includeAll']){_0xc729f3['include']=[{'all':!![]}];}_0xc729f3=_[_0xb056('0x3f')]({},_0xc729f3,_0x5040f6['options']);return db[_0xb056('0x2c')][_0xb056('0x47')](_0xc729f3)[_0xb056('0x26')](handleEntityNotFound(_0x3bcc3d,null))[_0xb056('0x26')](respondWithResult(_0x3bcc3d,null))[_0xb056('0x48')](handleError(_0x3bcc3d,null));};exports[_0xb056('0x49')]=function(_0x45b4aa,_0x1d3f86){return db['MailQueueReport'][_0xb056('0x49')](_0x45b4aa[_0xb056('0x4a')],{})['then'](respondWithResult(_0x1d3f86,0xc9))[_0xb056('0x48')](handleError(_0x1d3f86,null));};exports[_0xb056('0x25')]=function(_0xe40439,_0x2f2d22){if(_0xe40439[_0xb056('0x4a')]['id']){delete _0xe40439[_0xb056('0x4a')]['id'];}return db['MailQueueReport'][_0xb056('0x47')]({'where':{'id':_0xe40439['params']['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x2f2d22,null))[_0xb056('0x26')](saveUpdates(_0xe40439[_0xb056('0x4a')],null))[_0xb056('0x26')](respondWithResult(_0x2f2d22,null))[_0xb056('0x48')](handleError(_0x2f2d22,null));};exports[_0xb056('0x27')]=function(_0x2b6733,_0x25bb16){return db['MailQueueReport'][_0xb056('0x47')]({'where':{'id':_0x2b6733[_0xb056('0x46')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x25bb16,null))[_0xb056('0x26')](removeEntity(_0x25bb16,null))[_0xb056('0x48')](handleError(_0x25bb16,null));};exports[_0xb056('0x4b')]=function(_0x3de967,_0x43fb4a){return db['MailQueueReport'][_0xb056('0x4b')]()[_0xb056('0x26')](respondWithResult(_0x43fb4a,null))[_0xb056('0x48')](handleError(_0x43fb4a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 5fd277e..4a3d581 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 _0x01ed=['report_mail_queue','util','../../config/logger','api','moment','path','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x5a705c,_0x1597a3){var _0x3fadc6=function(_0xb967bf){while(--_0xb967bf){_0x5a705c['push'](_0x5a705c['shift']());}};_0x3fadc6(++_0x1597a3);}(_0x01ed,0x119));var _0xd01e=function(_0x54597a,_0x4ea42f){_0x54597a=_0x54597a-0x0;var _0x5a764f=_0x01ed[_0x54597a];return _0x5a764f;};'use strict';var _=require('lodash');var util=require(_0xd01e('0x0'));var logger=require(_0xd01e('0x1'))(_0xd01e('0x2'));var moment=require(_0xd01e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd01e('0x4'));var rimraf=require('rimraf');var config=require(_0xd01e('0x5'));var attributes=require(_0xd01e('0x6'));module[_0xd01e('0x7')]=function(_0x4624c7,_0x43bc91){return _0x4624c7[_0xd01e('0x8')]('MailQueueReport',attributes,{'tableName':_0xd01e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e6b=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3d95f8,_0x45f525){var _0x583a21=function(_0x127b2e){while(--_0x127b2e){_0x3d95f8['push'](_0x3d95f8['shift']());}};_0x583a21(++_0x45f525);}(_0x4e6b,0x172));var _0xb4e6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4e6b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var logger=require('../../config/logger')(_0xb4e6('0x2'));var moment=require('moment');var BPromise=require(_0xb4e6('0x3'));var rp=require(_0xb4e6('0x4'));var fs=require('fs');var path=require(_0xb4e6('0x5'));var rimraf=require(_0xb4e6('0x6'));var config=require(_0xb4e6('0x7'));var attributes=require(_0xb4e6('0x8'));module[_0xb4e6('0x9')]=function(_0x1d7883,_0x1cda58){return _0x1d7883[_0xb4e6('0xa')](_0xb4e6('0xb'),attributes,{'tableName':_0xb4e6('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6bbef64..cbc76bd 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e9d88,_0x14dc6b){var _0x2143f0=function(_0x52d6f4){while(--_0x52d6f4){_0x3e9d88['push'](_0x3e9d88['shift']());}};_0x2143f0(++_0x14dc6b);}(_0x326f,0xd1));var _0xf326=function(_0x54392d,_0x21f984){_0x54392d=_0x54392d-0x0;var _0x51112d=_0x326f[_0x54392d];return _0x51112d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x40375c,_0x57ea2f){var _0xdca3fb=function(_0xb4ee4){while(--_0xb4ee4){_0x40375c['push'](_0x40375c['shift']());}};_0xdca3fb(++_0x57ea2f);}(_0x2ef3,0xba));var _0x32ef=function(_0x28ffb0,_0x53ec49){_0x28ffb0=_0x28ffb0-0x0;var _0x234cd9=_0x2ef3[_0x28ffb0];return _0x234cd9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5f3d1a5..b3694af 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4d3287,_0xe83871){var _0x3e46fc=function(_0x2e6f0a){while(--_0x2e6f0a){_0x4d3287['push'](_0x4d3287['shift']());}};_0x3e46fc(++_0xe83871);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a9948,_0x5a063e){var _0x1f4210=function(_0x2f8f26){while(--_0x2f8f26){_0x5a9948['push'](_0x5a9948['shift']());}};_0x1f4210(++_0x5a063e);}(_0xe706,0xa3));var _0x6e70=function(_0x581e01,_0x241cbd){_0x581e01=_0x581e01-0x0;var _0x558b54=_0xe706[_0x581e01];return _0x558b54;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4b8fedb..3aa0e11 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 _0x5c8a=['exports','BOOLEAN','STRING','INTEGER','INBOX'];(function(_0x383915,_0x2fcb7a){var _0x31d02f=function(_0x329955){while(--_0x329955){_0x383915['push'](_0x383915['shift']());}};_0x31d02f(++_0x2fcb7a);}(_0x5c8a,0x64));var _0xa5c8=function(_0x5b1698,_0x4624a8){_0x5b1698=_0x5b1698-0x0;var _0x1b416e=_0x5c8a[_0x5b1698];return _0x1b416e;};'use strict';var Sequelize=require('sequelize');module[_0xa5c8('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa5c8('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa5c8('0x2')]},'password':{'type':Sequelize[_0xa5c8('0x2')]},'port':{'type':Sequelize[_0xa5c8('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa5c8('0x4')},'connTimeout':{'type':Sequelize[_0xa5c8('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xa5c8('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0f04=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0f04,0x1de));var _0x40f0=function(_0x50fecb,_0x667edb){_0x50fecb=_0x50fecb-0x0;var _0x1d76a2=_0x0f04[_0x50fecb];return _0x1d76a2;};'use strict';var Sequelize=require('sequelize');module[_0x40f0('0x0')]={'description':{'type':Sequelize[_0x40f0('0x1')]},'host':{'type':Sequelize[_0x40f0('0x1')]},'authentication':{'type':Sequelize[_0x40f0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x40f0('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x40f0('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x40f0('0x1')],'defaultValue':_0x40f0('0x4')},'connTimeout':{'type':Sequelize[_0x40f0('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x40f0('0x1')]},'modernAuthentication':{'type':Sequelize[_0x40f0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 31b078a..46e1181 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 _0x60ef=['rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird'];(function(_0x34ad09,_0x53f211){var _0xafb65e=function(_0x56cacb){while(--_0x56cacb){_0x34ad09['push'](_0x34ad09['shift']());}};_0xafb65e(++_0x53f211);}(_0x60ef,0x74));var _0xf60e=function(_0x22942b,_0x28e763){_0x22942b=_0x22942b-0x0;var _0x2e7041=_0x60ef[_0x22942b];return _0x2e7041;};'use strict';var _=require(_0xf60e('0x0'));var util=require(_0xf60e('0x1'));var logger=require(_0xf60e('0x2'))('api');var moment=require(_0xf60e('0x3'));var BPromise=require(_0xf60e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf60e('0x5'));var config=require(_0xf60e('0x6'));var attributes=require('./mailServerIn.attributes');module[_0xf60e('0x7')]=function(_0x504f79,_0x4e4c64){return _0x504f79[_0xf60e('0x8')](_0xf60e('0x9'),attributes,{'tableName':_0xf60e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x014c=['./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x59b470,_0x2d1b3a){var _0x1bbd91=function(_0xe98c12){while(--_0xe98c12){_0x59b470['push'](_0x59b470['shift']());}};_0x1bbd91(++_0x2d1b3a);}(_0x014c,0x190));var _0xc014=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0x014c[_0xbf5e16];return _0x5975a5;};'use strict';var _=require('lodash');var util=require(_0xc014('0x0'));var logger=require(_0xc014('0x1'))(_0xc014('0x2'));var moment=require(_0xc014('0x3'));var BPromise=require(_0xc014('0x4'));var rp=require(_0xc014('0x5'));var fs=require('fs');var path=require(_0xc014('0x6'));var rimraf=require(_0xc014('0x7'));var config=require('../../config/environment');var attributes=require(_0xc014('0x8'));module[_0xc014('0x9')]=function(_0x1de2e5,_0x3cdb86){return _0x1de2e5['define'](_0xc014('0xa'),attributes,{'tableName':_0xc014('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 35f84a7..98fb22d 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 _0x3c0d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','findAll','options','raw','attributes','map','model','include','debug','stringify','catch','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c0d,0xf6));var _0xd3c0=function(_0xd03824,_0x227f4c){_0xd03824=_0xd03824-0x0;var _0x2ccb5c=_0x3c0d[_0xd03824];return _0x2ccb5c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd3c0('0x0'));var rs=require(_0xd3c0('0x1'));var fs=require('fs');var Redis=require(_0xd3c0('0x2'));var db=require(_0xd3c0('0x3'))['db'];var utils=require(_0xd3c0('0x4'));var logger=require(_0xd3c0('0x5'))(_0xd3c0('0x6'));var config=require(_0xd3c0('0x7'));var jayson=require(_0xd3c0('0x8'));var client=jayson['client'][_0xd3c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fa5f,_0x6308e2,_0x10f804){return new BPromise(function(_0x2c37b8,_0x2d11d5){return client[_0xd3c0('0xa')](_0x47fa5f,_0x10f804)[_0xd3c0('0xb')](function(_0x2be3c0){logger[_0xd3c0('0xc')](_0xd3c0('0xd'),_0x6308e2,_0xd3c0('0xe'));logger['debug'](_0xd3c0('0xf'),_0x6308e2,_0xd3c0('0xe'),JSON['stringify'](_0x2be3c0));if(_0x2be3c0['error']){if(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x11')]===0x1f4){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0['error'][_0xd3c0('0x12')]);return _0x2d11d5(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}logger['error'](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);return _0x2c37b8(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}else{logger[_0xd3c0('0xc')]('MailServerIn,\x20%s,\x20%s',_0x6308e2,'request\x20sent');_0x2c37b8(_0x2be3c0[_0xd3c0('0x13')][_0xd3c0('0x12')]);}})['catch'](function(_0x3e9b6b){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x3e9b6b);_0x2d11d5(_0x3e9b6b);});});}exports[_0xd3c0('0x14')]=function(_0x1a204c){var _0x2adf93=this;return new Promise(function(_0x24e048,_0x53584a){return db['MailServerIn'][_0xd3c0('0x15')]({'raw':_0x1a204c['options']?_0x1a204c[_0xd3c0('0x16')][_0xd3c0('0x17')]===undefined?!![]:![]:!![],'where':_0x1a204c[_0xd3c0('0x16')]?_0x1a204c[_0xd3c0('0x16')]['where']||null:null,'attributes':_0x1a204c['options']?_0x1a204c[_0xd3c0('0x16')][_0xd3c0('0x18')]||null:null,'limit':_0x1a204c[_0xd3c0('0x16')]?_0x1a204c[_0xd3c0('0x16')]['limit']||null:null,'include':_0x1a204c[_0xd3c0('0x16')]?_0x1a204c['options']['include']?_[_0xd3c0('0x19')](_0x1a204c[_0xd3c0('0x16')]['include'],function(_0x3ac1b3){return{'model':db[_0x3ac1b3[_0xd3c0('0x1a')]],'as':_0x3ac1b3['as'],'attributes':_0x3ac1b3['attributes'],'include':_0x3ac1b3[_0xd3c0('0x1b')]?_['map'](_0x3ac1b3['include'],function(_0x23e772){return{'model':db[_0x23e772[_0xd3c0('0x1a')]],'as':_0x23e772['as'],'attributes':_0x23e772['attributes'],'include':_0x23e772['include']?_[_0xd3c0('0x19')](_0x23e772[_0xd3c0('0x1b')],function(_0x58d3cc){return{'model':db[_0x58d3cc['model']],'as':_0x58d3cc['as'],'attributes':_0x58d3cc[_0xd3c0('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd3c0('0xb')](function(_0xa7a5c2){logger['info'](_0xd3c0('0x14'),_0x1a204c);logger[_0xd3c0('0x1c')]('GetMailServerIn',_0x1a204c,JSON[_0xd3c0('0x1d')](_0xa7a5c2));_0x24e048(_0xa7a5c2);})[_0xd3c0('0x1e')](function(_0xeeaecc){logger[_0xd3c0('0x10')](_0xd3c0('0x14'),_0xeeaecc['message'],_0x1a204c);_0x53584a(_0x2adf93[_0xd3c0('0x10')](0x1f4,_0xeeaecc[_0xd3c0('0x12')]));});});}; \ No newline at end of file +var _0x18a9=['raw','where','attributes','include','model','map','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options'];(function(_0x2b4c49,_0x5a3e8a){var _0x18b246=function(_0x1d4c2f){while(--_0x1d4c2f){_0x2b4c49['push'](_0x2b4c49['shift']());}};_0x18b246(++_0x5a3e8a);}(_0x18a9,0x15b));var _0x918a=function(_0x39bc67,_0x4d286d){_0x39bc67=_0x39bc67-0x0;var _0x11d4cc=_0x18a9[_0x39bc67];return _0x11d4cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x918a('0x0'));var BPromise=require(_0x918a('0x1'));var rs=require(_0x918a('0x2'));var fs=require('fs');var Redis=require(_0x918a('0x3'));var db=require(_0x918a('0x4'))['db'];var utils=require(_0x918a('0x5'));var logger=require(_0x918a('0x6'))(_0x918a('0x7'));var config=require(_0x918a('0x8'));var jayson=require(_0x918a('0x9'));var client=jayson[_0x918a('0xa')][_0x918a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492c39,_0xdb8dd8,_0x266256){return new BPromise(function(_0x51caca,_0x40518f){return client[_0x918a('0xc')](_0x492c39,_0x266256)[_0x918a('0xd')](function(_0x224a87){logger[_0x918a('0xe')](_0x918a('0xf'),_0xdb8dd8,_0x918a('0x10'));logger['debug'](_0x918a('0x11'),_0xdb8dd8,_0x918a('0x10'),JSON[_0x918a('0x12')](_0x224a87));if(_0x224a87[_0x918a('0x13')]){if(_0x224a87['error'][_0x918a('0x14')]===0x1f4){logger[_0x918a('0x13')]('MailServerIn,\x20%s,\x20%s',_0xdb8dd8,_0x224a87[_0x918a('0x13')][_0x918a('0x15')]);return _0x40518f(_0x224a87[_0x918a('0x13')][_0x918a('0x15')]);}logger['error'](_0x918a('0xf'),_0xdb8dd8,_0x224a87['error'][_0x918a('0x15')]);return _0x51caca(_0x224a87['error']['message']);}else{logger[_0x918a('0xe')](_0x918a('0xf'),_0xdb8dd8,'request\x20sent');_0x51caca(_0x224a87[_0x918a('0x16')]['message']);}})[_0x918a('0x17')](function(_0x17f988){logger[_0x918a('0x13')]('MailServerIn,\x20%s,\x20%s',_0xdb8dd8,_0x17f988);_0x40518f(_0x17f988);});});}exports[_0x918a('0x18')]=function(_0x51e467){var _0x199eb1=this;return new Promise(function(_0x22e347,_0x38ca45){return db[_0x918a('0x19')]['findAll']({'raw':_0x51e467[_0x918a('0x1a')]?_0x51e467[_0x918a('0x1a')][_0x918a('0x1b')]===undefined?!![]:![]:!![],'where':_0x51e467[_0x918a('0x1a')]?_0x51e467[_0x918a('0x1a')][_0x918a('0x1c')]||null:null,'attributes':_0x51e467[_0x918a('0x1a')]?_0x51e467['options'][_0x918a('0x1d')]||null:null,'limit':_0x51e467['options']?_0x51e467[_0x918a('0x1a')]['limit']||null:null,'include':_0x51e467['options']?_0x51e467['options'][_0x918a('0x1e')]?_['map'](_0x51e467[_0x918a('0x1a')][_0x918a('0x1e')],function(_0xadd3bc){return{'model':db[_0xadd3bc[_0x918a('0x1f')]],'as':_0xadd3bc['as'],'attributes':_0xadd3bc[_0x918a('0x1d')],'include':_0xadd3bc[_0x918a('0x1e')]?_[_0x918a('0x20')](_0xadd3bc[_0x918a('0x1e')],function(_0xfdad4a){return{'model':db[_0xfdad4a[_0x918a('0x1f')]],'as':_0xfdad4a['as'],'attributes':_0xfdad4a['attributes'],'include':_0xfdad4a[_0x918a('0x1e')]?_[_0x918a('0x20')](_0xfdad4a[_0x918a('0x1e')],function(_0x4a77c6){return{'model':db[_0x4a77c6[_0x918a('0x1f')]],'as':_0x4a77c6['as'],'attributes':_0x4a77c6[_0x918a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x918a('0xd')](function(_0x549cb4){logger[_0x918a('0xe')](_0x918a('0x18'),_0x51e467);logger[_0x918a('0x21')](_0x918a('0x18'),_0x51e467,JSON[_0x918a('0x12')](_0x549cb4));_0x22e347(_0x549cb4);})[_0x918a('0x17')](function(_0x51361c){logger['error']('GetMailServerIn',_0x51361c[_0x918a('0x15')],_0x51e467);_0x38ca45(_0x199eb1[_0x918a('0x13')](0x1f4,_0x51361c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 58063e1..1bdc564 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x1704cd,_0x5b5a3f){_0x1704cd=_0x1704cd-0x0;var _0x4f7513=_0x7a54[_0x1704cd];return _0x4f7513;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 df630b2..ff8ceab 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 _0xa74f=['BOOLEAN','STRING','INTEGER'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa74f,0x9a));var _0xfa74=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xa74f[_0x1f99a0];return _0x1e0849;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'secure':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfa74('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc900=['INTEGER','BOOLEAN','STRING'];(function(_0x1a6b8e,_0x42a281){var _0x141887=function(_0x1f7c79){while(--_0x1f7c79){_0x1a6b8e['push'](_0x1a6b8e['shift']());}};_0x141887(++_0x42a281);}(_0xc900,0xb3));var _0x0c90=function(_0x308623,_0x1b1fd3){_0x308623=_0x308623-0x0;var _0x5ca563=_0xc900[_0x308623];return _0x5ca563;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0c90('0x0')]},'host':{'type':Sequelize[_0x0c90('0x0')]},'user':{'type':Sequelize[_0x0c90('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0c90('0x1')]},'secure':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 2fb2bcc..9f3bee2 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 _0x19c8=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','MailServerOut','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','params','rawAttributes','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5c0644,_0x436539){var _0x55b9c2=function(_0xf99a73){while(--_0xf99a73){_0x5c0644['push'](_0x5c0644['shift']());}};_0x55b9c2(++_0x436539);}(_0x19c8,0x7a));var _0x819c=function(_0x98ad5e,_0x5f001b){_0x98ad5e=_0x98ad5e-0x0;var _0x16df81=_0x19c8[_0x98ad5e];return _0x16df81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x819c('0x0'));var zipdir=require(_0x819c('0x1'));var jsonpatch=require(_0x819c('0x2'));var rp=require(_0x819c('0x3'));var moment=require(_0x819c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x819c('0x5'));var util=require(_0x819c('0x6'));var path=require('path');var sox=require(_0x819c('0x7'));var csv=require(_0x819c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x819c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x819c('0xa'));var jsforce=require(_0x819c('0xb'));var deskjs=require(_0x819c('0xc'));var toCsv=require(_0x819c('0x8'));var querystring=require(_0x819c('0xd'));var Papa=require(_0x819c('0xe'));var Redis=require(_0x819c('0xf'));var authService=require(_0x819c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x819c('0x11'));var hardwareService=require(_0x819c('0x12'));var logger=require(_0x819c('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x819c('0x14'));var db=require(_0x819c('0x15'))['db'];function respondWithStatusCode(_0x371cbe,_0x10e1c2){_0x10e1c2=_0x10e1c2||0xcc;return function(_0xce1293){if(_0xce1293){return _0x371cbe[_0x819c('0x16')](_0x10e1c2);}return _0x371cbe['status'](_0x10e1c2)[_0x819c('0x17')]();};}function respondWithResult(_0x297d77,_0x4d958c){_0x4d958c=_0x4d958c||0xc8;return function(_0x4ec903){if(_0x4ec903){return _0x297d77[_0x819c('0x18')](_0x4d958c)[_0x819c('0x19')](_0x4ec903);}};}function respondWithFilteredResult(_0x9c636d,_0x4121a7){return function(_0x24b5c5){if(_0x24b5c5){var _0xa1bd64=typeof _0x4121a7[_0x819c('0x1a')]===_0x819c('0x1b')&&typeof _0x4121a7[_0x819c('0x1c')]===_0x819c('0x1b');var _0x20b3e4=_0x24b5c5[_0x819c('0x1d')];var _0x41b76d=_0xa1bd64?0x0:_0x4121a7[_0x819c('0x1a')];var _0x2bb989=_0xa1bd64?_0x24b5c5[_0x819c('0x1d')]:_0x4121a7[_0x819c('0x1a')]+_0x4121a7[_0x819c('0x1c')];var _0x1b831a;if(_0x2bb989>=_0x20b3e4){_0x2bb989=_0x20b3e4;_0x1b831a=0xc8;}else{_0x1b831a=0xce;}_0x9c636d[_0x819c('0x18')](_0x1b831a);return _0x9c636d[_0x819c('0x1e')](_0x819c('0x1f'),_0x41b76d+'-'+_0x2bb989+'/'+_0x20b3e4)[_0x819c('0x19')](_0x24b5c5);}return null;};}function patchUpdates(_0x516bbe){return function(_0x357015){try{jsonpatch[_0x819c('0x20')](_0x357015,_0x516bbe,!![]);}catch(_0x26366b){return BPromise[_0x819c('0x21')](_0x26366b);}return _0x357015['save']();};}function saveUpdates(_0x2fdc2c,_0x1a2429){return function(_0x43ee9){if(_0x43ee9){return _0x43ee9[_0x819c('0x22')](_0x2fdc2c)[_0x819c('0x23')](function(_0x5575ab){return _0x5575ab;});}return null;};}function removeEntity(_0x453fe8,_0x1fc5fe){return function(_0x37e218){if(_0x37e218){return _0x37e218[_0x819c('0x24')]()['then'](function(){_0x453fe8['status'](0xcc)[_0x819c('0x17')]();});}};}function handleEntityNotFound(_0x4f0fc9,_0x33c95e){return function(_0xa5f903){if(!_0xa5f903){_0x4f0fc9['sendStatus'](0x194);}return _0xa5f903;};}function handleError(_0x52aa93,_0x37343c){_0x37343c=_0x37343c||0x1f4;return function(_0x2aaeb6){logger[_0x819c('0x25')](_0x2aaeb6[_0x819c('0x26')]);if(_0x2aaeb6[_0x819c('0x27')]){delete _0x2aaeb6['name'];}_0x52aa93[_0x819c('0x18')](_0x37343c)[_0x819c('0x28')](_0x2aaeb6);};}exports['index']=function(_0x1fe644,_0x4ecfa2){var _0x1cfefd={},_0x406fdf={},_0x1150df={'count':0x0,'rows':[]};var _0x2d10e4=_[_0x819c('0x29')](db[_0x819c('0x2a')]['rawAttributes'],function(_0x2d3bd2){return{'name':_0x2d3bd2[_0x819c('0x2b')],'type':_0x2d3bd2[_0x819c('0x2c')][_0x819c('0x2d')]};});_0x406fdf['model']=_[_0x819c('0x29')](_0x2d10e4,_0x819c('0x27'));_0x406fdf[_0x819c('0x2e')]=_[_0x819c('0x2f')](_0x1fe644[_0x819c('0x2e')]);_0x406fdf[_0x819c('0x30')]=_[_0x819c('0x31')](_0x406fdf[_0x819c('0x32')],_0x406fdf[_0x819c('0x2e')]);_0x1cfefd[_0x819c('0x33')]=_[_0x819c('0x31')](_0x406fdf[_0x819c('0x32')],qs[_0x819c('0x34')](_0x1fe644[_0x819c('0x2e')][_0x819c('0x34')]));_0x1cfefd[_0x819c('0x33')]=_0x1cfefd['attributes'][_0x819c('0x35')]?_0x1cfefd[_0x819c('0x33')]:_0x406fdf[_0x819c('0x32')];if(!_0x1fe644[_0x819c('0x2e')]['hasOwnProperty'](_0x819c('0x36'))){_0x1cfefd[_0x819c('0x1c')]=qs[_0x819c('0x1c')](_0x1fe644[_0x819c('0x2e')]['limit']);_0x1cfefd[_0x819c('0x1a')]=qs['offset'](_0x1fe644[_0x819c('0x2e')][_0x819c('0x1a')]);}_0x1cfefd[_0x819c('0x37')]=qs[_0x819c('0x38')](_0x1fe644[_0x819c('0x2e')]['sort']);_0x1cfefd[_0x819c('0x39')]=qs[_0x819c('0x30')](_[_0x819c('0x3a')](_0x1fe644[_0x819c('0x2e')],_0x406fdf[_0x819c('0x30')]),_0x2d10e4);if(_0x1fe644['query']['filter']){_0x1cfefd[_0x819c('0x39')]=_[_0x819c('0x3b')](_0x1cfefd['where'],{'$or':_[_0x819c('0x29')](_0x2d10e4,function(_0x4bc473){if(_0x4bc473['type']!=='VIRTUAL'){var _0x5b8073={};_0x5b8073[_0x4bc473[_0x819c('0x27')]]={'$like':'%'+_0x1fe644[_0x819c('0x2e')][_0x819c('0x3c')]+'%'};return _0x5b8073;}})});}_0x1cfefd=_[_0x819c('0x3b')]({},_0x1cfefd,_0x1fe644[_0x819c('0x3d')]);var _0x1c641c={'where':_0x1cfefd[_0x819c('0x39')]};return db['MailServerOut'][_0x819c('0x1d')](_0x1c641c)[_0x819c('0x23')](function(_0x59a3d5){_0x1150df[_0x819c('0x1d')]=_0x59a3d5;if(_0x1fe644[_0x819c('0x2e')][_0x819c('0x3e')]){_0x1cfefd['include']=[{'all':!![]}];}return db['MailServerOut'][_0x819c('0x3f')](_0x1cfefd);})[_0x819c('0x23')](function(_0x32636a){_0x1150df['rows']=_0x32636a;return _0x1150df;})[_0x819c('0x23')](respondWithFilteredResult(_0x4ecfa2,_0x1cfefd))['catch'](handleError(_0x4ecfa2,null));};exports['show']=function(_0x1bfad8,_0x5a6d53){var _0x4b93c4={'raw':!![],'where':{'id':_0x1bfad8[_0x819c('0x40')]['id']}},_0x196437={};_0x196437[_0x819c('0x32')]=_['keys'](db[_0x819c('0x2a')][_0x819c('0x41')]);_0x196437['query']=_[_0x819c('0x2f')](_0x1bfad8[_0x819c('0x2e')]);_0x196437[_0x819c('0x30')]=_[_0x819c('0x31')](_0x196437[_0x819c('0x32')],_0x196437[_0x819c('0x2e')]);_0x4b93c4['attributes']=_[_0x819c('0x31')](_0x196437[_0x819c('0x32')],qs[_0x819c('0x34')](_0x1bfad8[_0x819c('0x2e')]['fields']));_0x4b93c4[_0x819c('0x33')]=_0x4b93c4[_0x819c('0x33')]['length']?_0x4b93c4[_0x819c('0x33')]:_0x196437[_0x819c('0x32')];if(_0x1bfad8[_0x819c('0x2e')]['includeAll']){_0x4b93c4['include']=[{'all':!![]}];}_0x4b93c4=_['merge']({},_0x4b93c4,_0x1bfad8['options']);return db[_0x819c('0x2a')][_0x819c('0x42')](_0x4b93c4)[_0x819c('0x23')](handleEntityNotFound(_0x5a6d53,null))[_0x819c('0x23')](respondWithResult(_0x5a6d53,null))[_0x819c('0x43')](handleError(_0x5a6d53,null));};exports['create']=function(_0x5c100a,_0x48283c){return db[_0x819c('0x2a')][_0x819c('0x44')](_0x5c100a[_0x819c('0x45')],{})[_0x819c('0x23')](respondWithResult(_0x48283c,0xc9))[_0x819c('0x43')](handleError(_0x48283c,null));};exports[_0x819c('0x22')]=function(_0x320a1e,_0x94f6f9){if(_0x320a1e['body']['id']){delete _0x320a1e['body']['id'];}return db[_0x819c('0x2a')][_0x819c('0x42')]({'where':{'id':_0x320a1e[_0x819c('0x40')]['id']}})[_0x819c('0x23')](handleEntityNotFound(_0x94f6f9,null))[_0x819c('0x23')](saveUpdates(_0x320a1e[_0x819c('0x45')],null))[_0x819c('0x23')](respondWithResult(_0x94f6f9,null))[_0x819c('0x43')](handleError(_0x94f6f9,null));};exports[_0x819c('0x24')]=function(_0x3c018c,_0x476cf6){return db['MailServerOut'][_0x819c('0x42')]({'where':{'id':_0x3c018c[_0x819c('0x40')]['id']}})[_0x819c('0x23')](handleEntityNotFound(_0x476cf6,null))[_0x819c('0x23')](removeEntity(_0x476cf6,null))[_0x819c('0x43')](handleError(_0x476cf6,null));}; \ No newline at end of file +var _0x7fd5=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','findAll','rows','catch','show','include','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x1f282b,_0x18221b){var _0x202f29=function(_0x50f494){while(--_0x50f494){_0x1f282b['push'](_0x1f282b['shift']());}};_0x202f29(++_0x18221b);}(_0x7fd5,0x8c));var _0x57fd=function(_0x24fc2c,_0x47b500){_0x24fc2c=_0x24fc2c-0x0;var _0x483de4=_0x7fd5[_0x24fc2c];return _0x483de4;};'use strict';var emlformat=require(_0x57fd('0x0'));var rimraf=require(_0x57fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57fd('0x2'));var rp=require(_0x57fd('0x3'));var moment=require('moment');var BPromise=require(_0x57fd('0x4'));var Mustache=require(_0x57fd('0x5'));var util=require(_0x57fd('0x6'));var path=require(_0x57fd('0x7'));var sox=require(_0x57fd('0x8'));var csv=require(_0x57fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57fd('0xa'));var squel=require(_0x57fd('0xb'));var crypto=require(_0x57fd('0xc'));var jsforce=require(_0x57fd('0xd'));var deskjs=require(_0x57fd('0xe'));var toCsv=require(_0x57fd('0x9'));var querystring=require(_0x57fd('0xf'));var Papa=require(_0x57fd('0x10'));var Redis=require(_0x57fd('0x11'));var authService=require(_0x57fd('0x12'));var qs=require(_0x57fd('0x13'));var as=require(_0x57fd('0x14'));var hardwareService=require(_0x57fd('0x15'));var logger=require(_0x57fd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x57fd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x57fd('0x18'))['db'];function respondWithStatusCode(_0x5c854c,_0x5d4bd8){_0x5d4bd8=_0x5d4bd8||0xcc;return function(_0x32ad07){if(_0x32ad07){return _0x5c854c[_0x57fd('0x19')](_0x5d4bd8);}return _0x5c854c[_0x57fd('0x1a')](_0x5d4bd8)[_0x57fd('0x1b')]();};}function respondWithResult(_0xadde42,_0x21a743){_0x21a743=_0x21a743||0xc8;return function(_0xc55e69){if(_0xc55e69){return _0xadde42[_0x57fd('0x1a')](_0x21a743)[_0x57fd('0x1c')](_0xc55e69);}};}function respondWithFilteredResult(_0x117ecc,_0x4c1dcc){return function(_0x2593ef){if(_0x2593ef){var _0x19d5d9=typeof _0x4c1dcc[_0x57fd('0x1d')]===_0x57fd('0x1e')&&typeof _0x4c1dcc[_0x57fd('0x1f')]==='undefined';var _0x5f219b=_0x2593ef[_0x57fd('0x20')];var _0x3e799d=_0x19d5d9?0x0:_0x4c1dcc['offset'];var _0x380e88=_0x19d5d9?_0x2593ef['count']:_0x4c1dcc[_0x57fd('0x1d')]+_0x4c1dcc['limit'];var _0x3b820b;if(_0x380e88>=_0x5f219b){_0x380e88=_0x5f219b;_0x3b820b=0xc8;}else{_0x3b820b=0xce;}_0x117ecc[_0x57fd('0x1a')](_0x3b820b);return _0x117ecc[_0x57fd('0x21')]('Content-Range',_0x3e799d+'-'+_0x380e88+'/'+_0x5f219b)[_0x57fd('0x1c')](_0x2593ef);}return null;};}function patchUpdates(_0x51147b){return function(_0xf49fde){try{jsonpatch[_0x57fd('0x22')](_0xf49fde,_0x51147b,!![]);}catch(_0x250b75){return BPromise[_0x57fd('0x23')](_0x250b75);}return _0xf49fde[_0x57fd('0x24')]();};}function saveUpdates(_0x970dd3,_0x414cf7){return function(_0xcb275f){if(_0xcb275f){return _0xcb275f['update'](_0x970dd3)['then'](function(_0x1a1a19){return _0x1a1a19;});}return null;};}function removeEntity(_0x577581,_0x1173c3){return function(_0x37358c){if(_0x37358c){return _0x37358c[_0x57fd('0x25')]()[_0x57fd('0x26')](function(){_0x577581[_0x57fd('0x1a')](0xcc)[_0x57fd('0x1b')]();});}};}function handleEntityNotFound(_0x508b9c,_0x3bdb3e){return function(_0x4489d5){if(!_0x4489d5){_0x508b9c['sendStatus'](0x194);}return _0x4489d5;};}function handleError(_0x2a427e,_0x6b2a44){_0x6b2a44=_0x6b2a44||0x1f4;return function(_0x1815a2){logger[_0x57fd('0x27')](_0x1815a2[_0x57fd('0x28')]);if(_0x1815a2[_0x57fd('0x29')]){delete _0x1815a2['name'];}_0x2a427e['status'](_0x6b2a44)['send'](_0x1815a2);};}exports['index']=function(_0x13a6ff,_0x42733b){var _0x1d650e={},_0x55d853={},_0x5b341d={'count':0x0,'rows':[]};var _0x93953=_['map'](db[_0x57fd('0x2a')][_0x57fd('0x2b')],function(_0x4ad900){return{'name':_0x4ad900[_0x57fd('0x2c')],'type':_0x4ad900[_0x57fd('0x2d')][_0x57fd('0x2e')]};});_0x55d853['model']=_['map'](_0x93953,_0x57fd('0x29'));_0x55d853[_0x57fd('0x2f')]=_[_0x57fd('0x30')](_0x13a6ff[_0x57fd('0x2f')]);_0x55d853[_0x57fd('0x31')]=_[_0x57fd('0x32')](_0x55d853[_0x57fd('0x33')],_0x55d853[_0x57fd('0x2f')]);_0x1d650e[_0x57fd('0x34')]=_[_0x57fd('0x32')](_0x55d853[_0x57fd('0x33')],qs[_0x57fd('0x35')](_0x13a6ff['query']['fields']));_0x1d650e['attributes']=_0x1d650e['attributes'][_0x57fd('0x36')]?_0x1d650e[_0x57fd('0x34')]:_0x55d853['model'];if(!_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x37')](_0x57fd('0x38'))){_0x1d650e[_0x57fd('0x1f')]=qs[_0x57fd('0x1f')](_0x13a6ff['query']['limit']);_0x1d650e[_0x57fd('0x1d')]=qs['offset'](_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x1d')]);}_0x1d650e[_0x57fd('0x39')]=qs[_0x57fd('0x3a')](_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x3a')]);_0x1d650e[_0x57fd('0x3b')]=qs[_0x57fd('0x31')](_[_0x57fd('0x3c')](_0x13a6ff[_0x57fd('0x2f')],_0x55d853[_0x57fd('0x31')]),_0x93953);if(_0x13a6ff['query']['filter']){_0x1d650e[_0x57fd('0x3b')]=_[_0x57fd('0x3d')](_0x1d650e[_0x57fd('0x3b')],{'$or':_[_0x57fd('0x3e')](_0x93953,function(_0x170ed3){if(_0x170ed3[_0x57fd('0x2d')]!==_0x57fd('0x3f')){var _0x5df8ba={};_0x5df8ba[_0x170ed3[_0x57fd('0x29')]]={'$like':'%'+_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x40')]+'%'};return _0x5df8ba;}})});}_0x1d650e=_[_0x57fd('0x3d')]({},_0x1d650e,_0x13a6ff[_0x57fd('0x41')]);var _0x390e87={'where':_0x1d650e[_0x57fd('0x3b')]};return db[_0x57fd('0x2a')]['count'](_0x390e87)['then'](function(_0x2a00fe){_0x5b341d[_0x57fd('0x20')]=_0x2a00fe;if(_0x13a6ff['query']['includeAll']){_0x1d650e['include']=[{'all':!![]}];}return db[_0x57fd('0x2a')][_0x57fd('0x42')](_0x1d650e);})[_0x57fd('0x26')](function(_0x3dcf5c){_0x5b341d[_0x57fd('0x43')]=_0x3dcf5c;return _0x5b341d;})['then'](respondWithFilteredResult(_0x42733b,_0x1d650e))[_0x57fd('0x44')](handleError(_0x42733b,null));};exports[_0x57fd('0x45')]=function(_0x29f4a8,_0x2fad2f){var _0x19943f={'raw':!![],'where':{'id':_0x29f4a8['params']['id']}},_0x425651={};_0x425651[_0x57fd('0x33')]=_[_0x57fd('0x30')](db['MailServerOut'][_0x57fd('0x2b')]);_0x425651[_0x57fd('0x2f')]=_['keys'](_0x29f4a8['query']);_0x425651[_0x57fd('0x31')]=_[_0x57fd('0x32')](_0x425651[_0x57fd('0x33')],_0x425651[_0x57fd('0x2f')]);_0x19943f[_0x57fd('0x34')]=_[_0x57fd('0x32')](_0x425651['model'],qs[_0x57fd('0x35')](_0x29f4a8[_0x57fd('0x2f')][_0x57fd('0x35')]));_0x19943f[_0x57fd('0x34')]=_0x19943f[_0x57fd('0x34')][_0x57fd('0x36')]?_0x19943f[_0x57fd('0x34')]:_0x425651[_0x57fd('0x33')];if(_0x29f4a8['query']['includeAll']){_0x19943f[_0x57fd('0x46')]=[{'all':!![]}];}_0x19943f=_[_0x57fd('0x3d')]({},_0x19943f,_0x29f4a8[_0x57fd('0x41')]);return db['MailServerOut'][_0x57fd('0x47')](_0x19943f)[_0x57fd('0x26')](handleEntityNotFound(_0x2fad2f,null))[_0x57fd('0x26')](respondWithResult(_0x2fad2f,null))[_0x57fd('0x44')](handleError(_0x2fad2f,null));};exports[_0x57fd('0x48')]=function(_0x55ea57,_0x416a9f){return db[_0x57fd('0x2a')][_0x57fd('0x48')](_0x55ea57[_0x57fd('0x49')],{})[_0x57fd('0x26')](respondWithResult(_0x416a9f,0xc9))[_0x57fd('0x44')](handleError(_0x416a9f,null));};exports[_0x57fd('0x4a')]=function(_0x28b85f,_0x2c2961){if(_0x28b85f[_0x57fd('0x49')]['id']){delete _0x28b85f[_0x57fd('0x49')]['id'];}return db['MailServerOut'][_0x57fd('0x47')]({'where':{'id':_0x28b85f[_0x57fd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c2961,null))[_0x57fd('0x26')](saveUpdates(_0x28b85f[_0x57fd('0x49')],null))[_0x57fd('0x26')](respondWithResult(_0x2c2961,null))[_0x57fd('0x44')](handleError(_0x2c2961,null));};exports[_0x57fd('0x25')]=function(_0x57fcdc,_0x3b5e56){return db['MailServerOut'][_0x57fd('0x47')]({'where':{'id':_0x57fcdc[_0x57fd('0x4b')]['id']}})[_0x57fd('0x26')](handleEntityNotFound(_0x3b5e56,null))[_0x57fd('0x26')](removeEntity(_0x3b5e56,null))[_0x57fd('0x44')](handleError(_0x3b5e56,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4cdbecc..eee9f61 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 _0x2d43=['util','moment','request-promise','./mailServerOut.attributes','define','MailServerOut','lodash'];(function(_0x49293c,_0x504fc4){var _0x3c42b8=function(_0x387551){while(--_0x387551){_0x49293c['push'](_0x49293c['shift']());}};_0x3c42b8(++_0x504fc4);}(_0x2d43,0x14f));var _0x32d4=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x2d43[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0x32d4('0x0'));var util=require(_0x32d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x32d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x32d4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32d4('0x4'));module['exports']=function(_0x4c984a,_0x251479){return _0x4c984a[_0x32d4('0x5')](_0x32d4('0x6'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5fe=['../../config/environment','exports','mail_servers_out','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xc5fe,0x1e0));var _0xec5f=function(_0xcdc46b,_0x5007bf){_0xcdc46b=_0xcdc46b-0x0;var _0x4f46cb=_0xc5fe[_0xcdc46b];return _0x4f46cb;};'use strict';var _=require('lodash');var util=require(_0xec5f('0x0'));var logger=require(_0xec5f('0x1'))(_0xec5f('0x2'));var moment=require(_0xec5f('0x3'));var BPromise=require(_0xec5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec5f('0x5'));var rimraf=require('rimraf');var config=require(_0xec5f('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xec5f('0x7')]=function(_0x5da9fe,_0x55d28e){return _0x5da9fe['define']('MailServerOut',attributes,{'tableName':_0xec5f('0x8'),'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 b3d29b3..2fd8704 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x20aad0,_0x41a776){var _0x2a21ad=function(_0x4b7236){while(--_0x4b7236){_0x20aad0['push'](_0x20aad0['shift']());}};_0x2a21ad(++_0x41a776);}(_0x2ef3,0xba));var _0x32ef=function(_0x24ca06,_0x441791){_0x24ca06=_0x24ca06-0x0;var _0x524497=_0x2ef3[_0x24ca06];return _0x524497;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4702cf,_0x5e6a24){var _0x45d9b9=function(_0x3bed56){while(--_0x3bed56){_0x4702cf['push'](_0x4702cf['shift']());}};_0x45d9b9(++_0x5e6a24);}(_0x1261,0x144));var _0x1126=function(_0x18e333,_0x1caf42){_0x18e333=_0x18e333-0x0;var _0x41c26e=_0x1261[_0x18e333];return _0x41c26e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7dd700f..fdb41e5 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 _0x8ef8=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x406c1e,_0x279e87){var _0x883a01=function(_0x3a5d76){while(--_0x3a5d76){_0x406c1e['push'](_0x406c1e['shift']());}};_0x883a01(++_0x279e87);}(_0x8ef8,0x102));var _0x88ef=function(_0xe421b3,_0x2924ba){_0xe421b3=_0xe421b3-0x0;var _0x3e3caa=_0x8ef8[_0xe421b3];return _0x3e3caa;};'use strict';var multer=require('multer');var util=require(_0x88ef('0x0'));var path=require('path');var timeout=require(_0x88ef('0x1'));var express=require(_0x88ef('0x2'));var router=express[_0x88ef('0x3')]();var fs_extra=require(_0x88ef('0x4'));var auth=require(_0x88ef('0x5'));var interaction=require(_0x88ef('0x6'));var config=require(_0x88ef('0x7'));var controller=require(_0x88ef('0x8'));router[_0x88ef('0x9')]('/',auth['isAuthenticated'](),controller[_0x88ef('0xa')]);router[_0x88ef('0x9')](_0x88ef('0xb'),auth['isAuthenticated'](),controller[_0x88ef('0xc')]);router[_0x88ef('0x9')](_0x88ef('0xd'),auth[_0x88ef('0xe')](),controller[_0x88ef('0xf')]);router[_0x88ef('0x10')]('/',auth[_0x88ef('0xe')](),controller[_0x88ef('0x11')]);router['put']('/:id',auth[_0x88ef('0xe')](),controller[_0x88ef('0x12')]);router[_0x88ef('0x13')]('/:id',auth[_0x88ef('0xe')](),controller[_0x88ef('0x14')]);module[_0x88ef('0x15')]=router; \ No newline at end of file +var _0x0d69=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','create','put','update','delete','destroy'];(function(_0x2d7894,_0x424de2){var _0x5a5bfc=function(_0x2b8019){while(--_0x2b8019){_0x2d7894['push'](_0x2d7894['shift']());}};_0x5a5bfc(++_0x424de2);}(_0x0d69,0xa8));var _0x90d6=function(_0x7ac4c8,_0x270ea5){_0x7ac4c8=_0x7ac4c8-0x0;var _0x3e0ed0=_0x0d69[_0x7ac4c8];return _0x3e0ed0;};'use strict';var multer=require(_0x90d6('0x0'));var util=require(_0x90d6('0x1'));var path=require(_0x90d6('0x2'));var timeout=require(_0x90d6('0x3'));var express=require(_0x90d6('0x4'));var router=express['Router']();var fs_extra=require(_0x90d6('0x5'));var auth=require(_0x90d6('0x6'));var interaction=require(_0x90d6('0x7'));var config=require(_0x90d6('0x8'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x90d6('0x9')](),controller[_0x90d6('0xa')]);router['get'](_0x90d6('0xb'),auth[_0x90d6('0x9')](),controller[_0x90d6('0xc')]);router[_0x90d6('0xd')](_0x90d6('0xe'),auth[_0x90d6('0x9')](),controller[_0x90d6('0xf')]);router['post']('/',auth[_0x90d6('0x9')](),controller[_0x90d6('0x10')]);router[_0x90d6('0x11')](_0x90d6('0xe'),auth[_0x90d6('0x9')](),controller[_0x90d6('0x12')]);router[_0x90d6('0x13')](_0x90d6('0xe'),auth[_0x90d6('0x9')](),controller[_0x90d6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b42935a..dd271ec 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x53b0ca,_0xad73f8){var _0x1bf6de=function(_0x576aee){while(--_0x576aee){_0x53b0ca['push'](_0x53b0ca['shift']());}};_0x1bf6de(++_0xad73f8);}(_0xe14b,0x93));var _0xbe14=function(_0xe8a7a6,_0x3cb4bb){_0xe8a7a6=_0xe8a7a6-0x0;var _0x5aa2c5=_0xe14b[_0xe8a7a6];return _0x5aa2c5;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbe14('0x2')]}}; \ No newline at end of file +var _0xcd59=['exports','STRING','name','sequelize'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xcd59,0x14b));var _0x9cd5=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0xcd59[_0x1895b7];return _0x1aecdc;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'name':{'type':Sequelize[_0x9cd5('0x2')],'unique':_0x9cd5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9cd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a9e6afc..4d4e267 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 _0xa295=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','type','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x2b5077,_0x41b49f){var _0x51fea9=function(_0x308922){while(--_0x308922){_0x2b5077['push'](_0x2b5077['shift']());}};_0x51fea9(++_0x41b49f);}(_0xa295,0x92));var _0x5a29=function(_0x15c8fd,_0x5376e0){_0x15c8fd=_0x15c8fd-0x0;var _0x263c9c=_0xa295[_0x15c8fd];return _0x263c9c;};'use strict';var emlformat=require(_0x5a29('0x0'));var rimraf=require(_0x5a29('0x1'));var zipdir=require(_0x5a29('0x2'));var jsonpatch=require(_0x5a29('0x3'));var rp=require(_0x5a29('0x4'));var moment=require(_0x5a29('0x5'));var BPromise=require(_0x5a29('0x6'));var Mustache=require(_0x5a29('0x7'));var util=require('util');var path=require(_0x5a29('0x8'));var sox=require(_0x5a29('0x9'));var csv=require('to-csv');var ejs=require(_0x5a29('0xa'));var fs=require('fs');var fs_extra=require(_0x5a29('0xb'));var _=require(_0x5a29('0xc'));var squel=require('squel');var crypto=require(_0x5a29('0xd'));var jsforce=require(_0x5a29('0xe'));var deskjs=require(_0x5a29('0xf'));var toCsv=require(_0x5a29('0x10'));var querystring=require(_0x5a29('0x11'));var Papa=require(_0x5a29('0x12'));var Redis=require(_0x5a29('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5a29('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a29('0x15'))(_0x5a29('0x16'));var utils=require(_0x5a29('0x17'));var config=require(_0x5a29('0x18'));var licenseUtil=require(_0x5a29('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1656d9,_0x2b10cc){_0x2b10cc=_0x2b10cc||0xcc;return function(_0x772397){if(_0x772397){return _0x1656d9[_0x5a29('0x1a')](_0x2b10cc);}return _0x1656d9[_0x5a29('0x1b')](_0x2b10cc)[_0x5a29('0x1c')]();};}function respondWithResult(_0x5ebcdc,_0x470ad8){_0x470ad8=_0x470ad8||0xc8;return function(_0x1fef09){if(_0x1fef09){return _0x5ebcdc[_0x5a29('0x1b')](_0x470ad8)[_0x5a29('0x1d')](_0x1fef09);}};}function respondWithFilteredResult(_0x1cfcd2,_0x3ed5be){return function(_0x4153ea){if(_0x4153ea){var _0x1da6eb=typeof _0x3ed5be['offset']==='undefined'&&typeof _0x3ed5be[_0x5a29('0x1e')]===_0x5a29('0x1f');var _0x121cd8=_0x4153ea[_0x5a29('0x20')];var _0x3cfac0=_0x1da6eb?0x0:_0x3ed5be[_0x5a29('0x21')];var _0x2e0967=_0x1da6eb?_0x4153ea[_0x5a29('0x20')]:_0x3ed5be[_0x5a29('0x21')]+_0x3ed5be['limit'];var _0x4715dc;if(_0x2e0967>=_0x121cd8){_0x2e0967=_0x121cd8;_0x4715dc=0xc8;}else{_0x4715dc=0xce;}_0x1cfcd2[_0x5a29('0x1b')](_0x4715dc);return _0x1cfcd2[_0x5a29('0x22')](_0x5a29('0x23'),_0x3cfac0+'-'+_0x2e0967+'/'+_0x121cd8)[_0x5a29('0x1d')](_0x4153ea);}return null;};}function patchUpdates(_0x1c2e40){return function(_0x5e8e87){try{jsonpatch[_0x5a29('0x24')](_0x5e8e87,_0x1c2e40,!![]);}catch(_0x46f51a){return BPromise['reject'](_0x46f51a);}return _0x5e8e87[_0x5a29('0x25')]();};}function saveUpdates(_0x1fba7e,_0x1a9034){return function(_0x1067ef){if(_0x1067ef){return _0x1067ef[_0x5a29('0x26')](_0x1fba7e)[_0x5a29('0x27')](function(_0x57a018){return _0x57a018;});}return null;};}function removeEntity(_0x212072,_0x26306c){return function(_0x5bf635){if(_0x5bf635){return _0x5bf635[_0x5a29('0x28')]()[_0x5a29('0x27')](function(){_0x212072[_0x5a29('0x1b')](0xcc)[_0x5a29('0x1c')]();});}};}function handleEntityNotFound(_0x3f9fcf,_0xf2024){return function(_0xb55908){if(!_0xb55908){_0x3f9fcf[_0x5a29('0x1a')](0x194);}return _0xb55908;};}function handleError(_0x42ea06,_0x37c711){_0x37c711=_0x37c711||0x1f4;return function(_0x4f5d97){logger[_0x5a29('0x29')](_0x4f5d97[_0x5a29('0x2a')]);if(_0x4f5d97[_0x5a29('0x2b')]){delete _0x4f5d97[_0x5a29('0x2b')];}_0x42ea06['status'](_0x37c711)[_0x5a29('0x2c')](_0x4f5d97);};}exports[_0x5a29('0x2d')]=function(_0x21b44b,_0x2882ed){var _0x107337={},_0x20c65f={},_0x24a271={'count':0x0,'rows':[]};var _0x54df6c=_[_0x5a29('0x2e')](db[_0x5a29('0x2f')][_0x5a29('0x30')],function(_0x20b378){return{'name':_0x20b378[_0x5a29('0x31')],'type':_0x20b378['type']['key']};});_0x20c65f[_0x5a29('0x32')]=_[_0x5a29('0x2e')](_0x54df6c,_0x5a29('0x2b'));_0x20c65f['query']=_[_0x5a29('0x33')](_0x21b44b['query']);_0x20c65f['filters']=_[_0x5a29('0x34')](_0x20c65f[_0x5a29('0x32')],_0x20c65f[_0x5a29('0x35')]);_0x107337[_0x5a29('0x36')]=_['intersection'](_0x20c65f[_0x5a29('0x32')],qs[_0x5a29('0x37')](_0x21b44b['query'][_0x5a29('0x37')]));_0x107337[_0x5a29('0x36')]=_0x107337[_0x5a29('0x36')][_0x5a29('0x38')]?_0x107337[_0x5a29('0x36')]:_0x20c65f[_0x5a29('0x32')];if(!_0x21b44b[_0x5a29('0x35')][_0x5a29('0x39')](_0x5a29('0x3a'))){_0x107337[_0x5a29('0x1e')]=qs[_0x5a29('0x1e')](_0x21b44b[_0x5a29('0x35')][_0x5a29('0x1e')]);_0x107337[_0x5a29('0x21')]=qs['offset'](_0x21b44b[_0x5a29('0x35')][_0x5a29('0x21')]);}_0x107337[_0x5a29('0x3b')]=qs[_0x5a29('0x3c')](_0x21b44b[_0x5a29('0x35')]['sort']);_0x107337['where']=qs[_0x5a29('0x3d')](_['pick'](_0x21b44b[_0x5a29('0x35')],_0x20c65f[_0x5a29('0x3d')]),_0x54df6c);if(_0x21b44b[_0x5a29('0x35')][_0x5a29('0x3e')]){_0x107337['where']=_[_0x5a29('0x3f')](_0x107337[_0x5a29('0x40')],{'$or':_[_0x5a29('0x2e')](_0x54df6c,function(_0x3cc6ff){if(_0x3cc6ff[_0x5a29('0x41')]!=='VIRTUAL'){var _0x41dd10={};_0x41dd10[_0x3cc6ff[_0x5a29('0x2b')]]={'$like':'%'+_0x21b44b[_0x5a29('0x35')][_0x5a29('0x3e')]+'%'};return _0x41dd10;}})});}_0x107337=_[_0x5a29('0x3f')]({},_0x107337,_0x21b44b[_0x5a29('0x42')]);var _0xb092be={'where':_0x107337[_0x5a29('0x40')]};return db[_0x5a29('0x2f')][_0x5a29('0x20')](_0xb092be)[_0x5a29('0x27')](function(_0x15e92b){_0x24a271[_0x5a29('0x20')]=_0x15e92b;if(_0x21b44b[_0x5a29('0x35')][_0x5a29('0x43')]){_0x107337[_0x5a29('0x44')]=[{'all':!![]}];}return db[_0x5a29('0x2f')][_0x5a29('0x45')](_0x107337);})['then'](function(_0x200737){_0x24a271[_0x5a29('0x46')]=_0x200737;return _0x24a271;})[_0x5a29('0x27')](respondWithFilteredResult(_0x2882ed,_0x107337))[_0x5a29('0x47')](handleError(_0x2882ed,null));};exports[_0x5a29('0x48')]=function(_0x59b348,_0x35472a){var _0x2dc5d6={'raw':!![],'where':{'id':_0x59b348[_0x5a29('0x49')]['id']}},_0xa4ac2f={};_0xa4ac2f['model']=_[_0x5a29('0x33')](db[_0x5a29('0x2f')]['rawAttributes']);_0xa4ac2f[_0x5a29('0x35')]=_[_0x5a29('0x33')](_0x59b348[_0x5a29('0x35')]);_0xa4ac2f['filters']=_[_0x5a29('0x34')](_0xa4ac2f[_0x5a29('0x32')],_0xa4ac2f[_0x5a29('0x35')]);_0x2dc5d6[_0x5a29('0x36')]=_[_0x5a29('0x34')](_0xa4ac2f[_0x5a29('0x32')],qs['fields'](_0x59b348[_0x5a29('0x35')]['fields']));_0x2dc5d6[_0x5a29('0x36')]=_0x2dc5d6[_0x5a29('0x36')][_0x5a29('0x38')]?_0x2dc5d6[_0x5a29('0x36')]:_0xa4ac2f[_0x5a29('0x32')];if(_0x59b348[_0x5a29('0x35')][_0x5a29('0x43')]){_0x2dc5d6['include']=[{'all':!![]}];}_0x2dc5d6=_[_0x5a29('0x3f')]({},_0x2dc5d6,_0x59b348[_0x5a29('0x42')]);return db[_0x5a29('0x2f')]['find'](_0x2dc5d6)[_0x5a29('0x27')](handleEntityNotFound(_0x35472a,null))['then'](respondWithResult(_0x35472a,null))[_0x5a29('0x47')](handleError(_0x35472a,null));};exports['create']=function(_0xe1b30d,_0x1f868f){return db[_0x5a29('0x2f')][_0x5a29('0x4a')](_0xe1b30d['body'],{})[_0x5a29('0x27')](respondWithResult(_0x1f868f,0xc9))['catch'](handleError(_0x1f868f,null));};exports[_0x5a29('0x26')]=function(_0x4f5e36,_0x220098){if(_0x4f5e36[_0x5a29('0x4b')]['id']){delete _0x4f5e36['body']['id'];}return db[_0x5a29('0x2f')][_0x5a29('0x4c')]({'where':{'id':_0x4f5e36[_0x5a29('0x49')]['id']}})[_0x5a29('0x27')](handleEntityNotFound(_0x220098,null))[_0x5a29('0x27')](saveUpdates(_0x4f5e36['body'],null))[_0x5a29('0x27')](respondWithResult(_0x220098,null))[_0x5a29('0x47')](handleError(_0x220098,null));};exports[_0x5a29('0x28')]=function(_0x3af1d2,_0x31a238){return db[_0x5a29('0x2f')][_0x5a29('0x4c')]({'where':{'id':_0x3af1d2[_0x5a29('0x49')]['id']}})[_0x5a29('0x27')](handleEntityNotFound(_0x31a238,null))[_0x5a29('0x27')](removeEntity(_0x31a238,null))[_0x5a29('0x47')](handleError(_0x31a238,null));};exports['describe']=function(_0x1a5ec9,_0x47554f){return db['MailSubstatus'][_0x5a29('0x4d')]()[_0x5a29('0x27')](respondWithResult(_0x47554f,null))[_0x5a29('0x47')](handleError(_0x47554f,null));}; \ No newline at end of file +var _0x2581=['sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x433439,_0x46c160){var _0x5d7489=function(_0x55505e){while(--_0x55505e){_0x433439['push'](_0x433439['shift']());}};_0x5d7489(++_0x46c160);}(_0x2581,0xda));var _0x1258=function(_0x41acdb,_0x21d8fd){_0x41acdb=_0x41acdb-0x0;var _0x1273c7=_0x2581[_0x41acdb];return _0x1273c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1258('0x0'));var jsonpatch=require(_0x1258('0x1'));var rp=require(_0x1258('0x2'));var moment=require(_0x1258('0x3'));var BPromise=require(_0x1258('0x4'));var Mustache=require('mustache');var util=require(_0x1258('0x5'));var path=require(_0x1258('0x6'));var sox=require(_0x1258('0x7'));var csv=require('to-csv');var ejs=require(_0x1258('0x8'));var fs=require('fs');var fs_extra=require(_0x1258('0x9'));var _=require(_0x1258('0xa'));var squel=require('squel');var crypto=require(_0x1258('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1258('0xc'));var toCsv=require(_0x1258('0xd'));var querystring=require(_0x1258('0xe'));var Papa=require(_0x1258('0xf'));var Redis=require(_0x1258('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1258('0x11'));var as=require(_0x1258('0x12'));var hardwareService=require(_0x1258('0x13'));var logger=require(_0x1258('0x14'))(_0x1258('0x15'));var utils=require(_0x1258('0x16'));var config=require(_0x1258('0x17'));var licenseUtil=require(_0x1258('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451d95,_0x32a615){_0x32a615=_0x32a615||0xcc;return function(_0x5b389){if(_0x5b389){return _0x451d95[_0x1258('0x19')](_0x32a615);}return _0x451d95[_0x1258('0x1a')](_0x32a615)[_0x1258('0x1b')]();};}function respondWithResult(_0x407da4,_0x524c93){_0x524c93=_0x524c93||0xc8;return function(_0x3c036d){if(_0x3c036d){return _0x407da4[_0x1258('0x1a')](_0x524c93)[_0x1258('0x1c')](_0x3c036d);}};}function respondWithFilteredResult(_0x31f8ac,_0x517f2a){return function(_0x45e134){if(_0x45e134){var _0x594929=typeof _0x517f2a['offset']===_0x1258('0x1d')&&typeof _0x517f2a[_0x1258('0x1e')]===_0x1258('0x1d');var _0x5a34f1=_0x45e134[_0x1258('0x1f')];var _0x4a5774=_0x594929?0x0:_0x517f2a[_0x1258('0x20')];var _0x4bd10e=_0x594929?_0x45e134[_0x1258('0x1f')]:_0x517f2a[_0x1258('0x20')]+_0x517f2a[_0x1258('0x1e')];var _0x4e1817;if(_0x4bd10e>=_0x5a34f1){_0x4bd10e=_0x5a34f1;_0x4e1817=0xc8;}else{_0x4e1817=0xce;}_0x31f8ac['status'](_0x4e1817);return _0x31f8ac[_0x1258('0x21')](_0x1258('0x22'),_0x4a5774+'-'+_0x4bd10e+'/'+_0x5a34f1)[_0x1258('0x1c')](_0x45e134);}return null;};}function patchUpdates(_0x47e9cd){return function(_0x20a9da){try{jsonpatch[_0x1258('0x23')](_0x20a9da,_0x47e9cd,!![]);}catch(_0x186f2b){return BPromise[_0x1258('0x24')](_0x186f2b);}return _0x20a9da['save']();};}function saveUpdates(_0x57f158,_0xba817f){return function(_0x3e5f77){if(_0x3e5f77){return _0x3e5f77[_0x1258('0x25')](_0x57f158)['then'](function(_0x4c29f0){return _0x4c29f0;});}return null;};}function removeEntity(_0x489e65,_0x2226ab){return function(_0x3d1098){if(_0x3d1098){return _0x3d1098['destroy']()[_0x1258('0x26')](function(){_0x489e65[_0x1258('0x1a')](0xcc)[_0x1258('0x1b')]();});}};}function handleEntityNotFound(_0x2adf14,_0x2e4c78){return function(_0x59dba1){if(!_0x59dba1){_0x2adf14[_0x1258('0x19')](0x194);}return _0x59dba1;};}function handleError(_0x2e15d3,_0x2219b3){_0x2219b3=_0x2219b3||0x1f4;return function(_0x4948ff){logger[_0x1258('0x27')](_0x4948ff[_0x1258('0x28')]);if(_0x4948ff[_0x1258('0x29')]){delete _0x4948ff[_0x1258('0x29')];}_0x2e15d3[_0x1258('0x1a')](_0x2219b3)[_0x1258('0x2a')](_0x4948ff);};}exports['index']=function(_0x17ddff,_0xdc1488){var _0x187168={},_0x38f4b0={},_0x2d419d={'count':0x0,'rows':[]};var _0xd3a080=_[_0x1258('0x2b')](db[_0x1258('0x2c')][_0x1258('0x2d')],function(_0x53f2b5){return{'name':_0x53f2b5[_0x1258('0x2e')],'type':_0x53f2b5['type'][_0x1258('0x2f')]};});_0x38f4b0[_0x1258('0x30')]=_['map'](_0xd3a080,_0x1258('0x29'));_0x38f4b0[_0x1258('0x31')]=_[_0x1258('0x32')](_0x17ddff[_0x1258('0x31')]);_0x38f4b0['filters']=_['intersection'](_0x38f4b0[_0x1258('0x30')],_0x38f4b0[_0x1258('0x31')]);_0x187168[_0x1258('0x33')]=_[_0x1258('0x34')](_0x38f4b0[_0x1258('0x30')],qs['fields'](_0x17ddff[_0x1258('0x31')][_0x1258('0x35')]));_0x187168[_0x1258('0x33')]=_0x187168[_0x1258('0x33')][_0x1258('0x36')]?_0x187168[_0x1258('0x33')]:_0x38f4b0[_0x1258('0x30')];if(!_0x17ddff[_0x1258('0x31')][_0x1258('0x37')]('nolimit')){_0x187168[_0x1258('0x1e')]=qs[_0x1258('0x1e')](_0x17ddff[_0x1258('0x31')][_0x1258('0x1e')]);_0x187168['offset']=qs[_0x1258('0x20')](_0x17ddff[_0x1258('0x31')][_0x1258('0x20')]);}_0x187168[_0x1258('0x38')]=qs['sort'](_0x17ddff['query'][_0x1258('0x39')]);_0x187168[_0x1258('0x3a')]=qs['filters'](_[_0x1258('0x3b')](_0x17ddff['query'],_0x38f4b0[_0x1258('0x3c')]),_0xd3a080);if(_0x17ddff[_0x1258('0x31')][_0x1258('0x3d')]){_0x187168[_0x1258('0x3a')]=_[_0x1258('0x3e')](_0x187168[_0x1258('0x3a')],{'$or':_[_0x1258('0x2b')](_0xd3a080,function(_0x4d5fb1){if(_0x4d5fb1['type']!==_0x1258('0x3f')){var _0x28d637={};_0x28d637[_0x4d5fb1[_0x1258('0x29')]]={'$like':'%'+_0x17ddff['query']['filter']+'%'};return _0x28d637;}})});}_0x187168=_['merge']({},_0x187168,_0x17ddff['options']);var _0x3a4f8f={'where':_0x187168[_0x1258('0x3a')]};return db[_0x1258('0x2c')][_0x1258('0x1f')](_0x3a4f8f)['then'](function(_0x256db6){_0x2d419d[_0x1258('0x1f')]=_0x256db6;if(_0x17ddff['query'][_0x1258('0x40')]){_0x187168[_0x1258('0x41')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x187168);})['then'](function(_0x30afa3){_0x2d419d[_0x1258('0x42')]=_0x30afa3;return _0x2d419d;})['then'](respondWithFilteredResult(_0xdc1488,_0x187168))[_0x1258('0x43')](handleError(_0xdc1488,null));};exports[_0x1258('0x44')]=function(_0x48b8a2,_0xd6c33b){var _0x181750={'raw':!![],'where':{'id':_0x48b8a2[_0x1258('0x45')]['id']}},_0x571d42={};_0x571d42[_0x1258('0x30')]=_[_0x1258('0x32')](db[_0x1258('0x2c')][_0x1258('0x2d')]);_0x571d42[_0x1258('0x31')]=_['keys'](_0x48b8a2['query']);_0x571d42[_0x1258('0x3c')]=_[_0x1258('0x34')](_0x571d42[_0x1258('0x30')],_0x571d42[_0x1258('0x31')]);_0x181750['attributes']=_[_0x1258('0x34')](_0x571d42['model'],qs[_0x1258('0x35')](_0x48b8a2['query'][_0x1258('0x35')]));_0x181750['attributes']=_0x181750[_0x1258('0x33')]['length']?_0x181750[_0x1258('0x33')]:_0x571d42['model'];if(_0x48b8a2[_0x1258('0x31')][_0x1258('0x40')]){_0x181750['include']=[{'all':!![]}];}_0x181750=_['merge']({},_0x181750,_0x48b8a2['options']);return db['MailSubstatus'][_0x1258('0x46')](_0x181750)[_0x1258('0x26')](handleEntityNotFound(_0xd6c33b,null))[_0x1258('0x26')](respondWithResult(_0xd6c33b,null))['catch'](handleError(_0xd6c33b,null));};exports[_0x1258('0x47')]=function(_0x282699,_0x3d85f0){return db[_0x1258('0x2c')][_0x1258('0x47')](_0x282699[_0x1258('0x48')],{})[_0x1258('0x26')](respondWithResult(_0x3d85f0,0xc9))['catch'](handleError(_0x3d85f0,null));};exports[_0x1258('0x25')]=function(_0x1037f3,_0x34fa20){if(_0x1037f3[_0x1258('0x48')]['id']){delete _0x1037f3[_0x1258('0x48')]['id'];}return db[_0x1258('0x2c')][_0x1258('0x46')]({'where':{'id':_0x1037f3['params']['id']}})['then'](handleEntityNotFound(_0x34fa20,null))[_0x1258('0x26')](saveUpdates(_0x1037f3[_0x1258('0x48')],null))[_0x1258('0x26')](respondWithResult(_0x34fa20,null))[_0x1258('0x43')](handleError(_0x34fa20,null));};exports[_0x1258('0x49')]=function(_0x4fb9b7,_0x29cbb2){return db[_0x1258('0x2c')][_0x1258('0x46')]({'where':{'id':_0x4fb9b7[_0x1258('0x45')]['id']}})['then'](handleEntityNotFound(_0x29cbb2,null))[_0x1258('0x26')](removeEntity(_0x29cbb2,null))['catch'](handleError(_0x29cbb2,null));};exports[_0x1258('0x4a')]=function(_0xad48a3,_0x58e279){return db[_0x1258('0x2c')][_0x1258('0x4a')]()[_0x1258('0x26')](respondWithResult(_0x58e279,null))['catch'](handleError(_0x58e279,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index fb66968..e089302 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3455=['hasOwnProperty','exports','events','../../mysqldb','MailSubstatus','update','emit'];(function(_0x5452ac,_0x42e6d3){var _0xe0382c=function(_0x3f2710){while(--_0x3f2710){_0x5452ac['push'](_0x5452ac['shift']());}};_0xe0382c(++_0x42e6d3);}(_0x3455,0x13d));var _0x5345=function(_0xcbff5,_0x50eb75){_0xcbff5=_0xcbff5-0x0;var _0x13a00a=_0x3455[_0xcbff5];return _0x13a00a;};'use strict';var EventEmitter=require(_0x5345('0x0'));var MailSubstatus=require(_0x5345('0x1'))['db'][_0x5345('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x5345('0x3')};function emitEvent(_0x2395a3){return function(_0x2b3a28,_0x46a823,_0x2e1be4){MailSubstatusEvents[_0x5345('0x4')](_0x2395a3+':'+_0x2b3a28['id'],_0x2b3a28);MailSubstatusEvents[_0x5345('0x4')](_0x2395a3,_0x2b3a28);_0x2e1be4(null);};}for(var e in events){if(events[_0x5345('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x5345('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x4686=['hasOwnProperty','hook','exports','MailSubstatus','update','emit'];(function(_0x5630db,_0x176962){var _0x2c40a6=function(_0x3c6fe4){while(--_0x3c6fe4){_0x5630db['push'](_0x5630db['shift']());}};_0x2c40a6(++_0x176962);}(_0x4686,0x1dd));var _0x6468=function(_0x53d85d,_0x36ca43){_0x53d85d=_0x53d85d-0x0;var _0x546a8a=_0x4686[_0x53d85d];return _0x546a8a;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x6468('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x6468('0x1')};function emitEvent(_0x5027c2){return function(_0x23d462,_0x15079a,_0x68f9b5){MailSubstatusEvents[_0x6468('0x2')](_0x5027c2+':'+_0x23d462['id'],_0x23d462);MailSubstatusEvents[_0x6468('0x2')](_0x5027c2,_0x23d462);_0x68f9b5(null);};}for(var e in events){if(events[_0x6468('0x3')](e)){var event=events[e];MailSubstatus[_0x6468('0x4')](e,emitEvent(event));}}module[_0x6468('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5cabd59..fa9c5b3 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 _0xca96=['define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x146ab2,_0x430ad3){var _0x3af80b=function(_0x469061){while(--_0x469061){_0x146ab2['push'](_0x146ab2['shift']());}};_0x3af80b(++_0x430ad3);}(_0xca96,0x12b));var _0x6ca9=function(_0x371186,_0xaea471){_0x371186=_0x371186-0x0;var _0x7d5c44=_0xca96[_0x371186];return _0x7d5c44;};'use strict';var attributes=require(_0x6ca9('0x0'));module['exports']=function(_0x3b0815){var _0x26da38=_0x3b0815['models'];return _0x3b0815[_0x6ca9('0x1')](_0x6ca9('0x2'),attributes,{'tableName':_0x6ca9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x51a8b5,_0x387758,_0xa9d37){return _0x26da38[_0x6ca9('0x4')][_0x6ca9('0x5')]({'value':_0x51a8b5['name']},{'where':{'field':_0x6ca9('0x6'),'value':_0x51a8b5[_0x6ca9('0x7')]['name']}})[_0x6ca9('0x8')](function(){_0xa9d37();})[_0x6ca9('0x9')](function(_0x12ce99){_0xa9d37(_0x12ce99);});}}});}; \ No newline at end of file +var _0x023d=['name','mailSubstatus','_previousDataValues','catch','exports','models','mail_substatuses','Condition','update'];(function(_0x5dd752,_0x1be018){var _0x5066df=function(_0x53ea5f){while(--_0x53ea5f){_0x5dd752['push'](_0x5dd752['shift']());}};_0x5066df(++_0x1be018);}(_0x023d,0x67));var _0xd023=function(_0x53309c,_0x21c68a){_0x53309c=_0x53309c-0x0;var _0x13d243=_0x023d[_0x53309c];return _0x13d243;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xd023('0x0')]=function(_0x4f01da){var _0x2a85ec=_0x4f01da[_0xd023('0x1')];return _0x4f01da['define']('MailSubstatus',attributes,{'tableName':_0xd023('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4c460f,_0x35e6ed,_0x1c9881){return _0x2a85ec[_0xd023('0x3')][_0xd023('0x4')]({'value':_0x4c460f[_0xd023('0x5')]},{'where':{'field':_0xd023('0x6'),'value':_0x4c460f[_0xd023('0x7')]['name']}})['then'](function(){_0x1c9881();})[_0xd023('0x8')](function(_0x536bbd){_0x1c9881(_0x536bbd);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 17e82dd..85ae2cb 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 _0xa521=['code','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0xa521,0x1d2));var _0x1a52=function(_0x45d00f,_0x4e97ae){_0x45d00f=_0x45d00f-0x0;var _0x4689ba=_0xa521[_0x45d00f];return _0x4689ba;};'use strict';var _=require(_0x1a52('0x0'));var util=require(_0x1a52('0x1'));var moment=require(_0x1a52('0x2'));var BPromise=require(_0x1a52('0x3'));var rs=require(_0x1a52('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a52('0x5'))['db'];var utils=require(_0x1a52('0x6'));var logger=require(_0x1a52('0x7'))(_0x1a52('0x8'));var config=require(_0x1a52('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1a52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5930ed,_0x137085,_0x4ab8b1){return new BPromise(function(_0x2ffb54,_0x49f8dc){return client[_0x1a52('0xb')](_0x5930ed,_0x4ab8b1)[_0x1a52('0xc')](function(_0x42d1b7){logger[_0x1a52('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x137085,_0x1a52('0xe'));logger[_0x1a52('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x137085,_0x1a52('0xe'),JSON[_0x1a52('0x10')](_0x42d1b7));if(_0x42d1b7[_0x1a52('0x11')]){if(_0x42d1b7[_0x1a52('0x11')][_0x1a52('0x12')]===0x1f4){logger[_0x1a52('0x11')](_0x1a52('0x13'),_0x137085,_0x42d1b7['error']['message']);return _0x49f8dc(_0x42d1b7['error']['message']);}logger[_0x1a52('0x11')](_0x1a52('0x13'),_0x137085,_0x42d1b7[_0x1a52('0x11')][_0x1a52('0x14')]);return _0x2ffb54(_0x42d1b7[_0x1a52('0x11')][_0x1a52('0x14')]);}else{logger[_0x1a52('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x137085,_0x1a52('0xe'));_0x2ffb54(_0x42d1b7[_0x1a52('0x15')][_0x1a52('0x14')]);}})['catch'](function(_0x559b67){logger[_0x1a52('0x11')](_0x1a52('0x13'),_0x137085,_0x559b67);_0x49f8dc(_0x559b67);});});} \ No newline at end of file +var _0x9040=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x25e700,_0x120fb6){var _0x2d5367=function(_0x29e25a){while(--_0x29e25a){_0x25e700['push'](_0x25e700['shift']());}};_0x2d5367(++_0x120fb6);}(_0x9040,0x74));var _0x0904=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x9040[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x0904('0x0'));var util=require(_0x0904('0x1'));var moment=require('moment');var BPromise=require(_0x0904('0x2'));var rs=require(_0x0904('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0904('0x4'));var logger=require(_0x0904('0x5'))(_0x0904('0x6'));var config=require(_0x0904('0x7'));var jayson=require(_0x0904('0x8'));var client=jayson[_0x0904('0x9')][_0x0904('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1963e2,_0x39335c,_0x4a1c3d){return new BPromise(function(_0x16c6b3,_0x334a23){return client['request'](_0x1963e2,_0x4a1c3d)[_0x0904('0xb')](function(_0x5ab8d7){logger[_0x0904('0xc')](_0x0904('0xd'),_0x39335c,_0x0904('0xe'));logger[_0x0904('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x39335c,'request\x20sent',JSON[_0x0904('0x10')](_0x5ab8d7));if(_0x5ab8d7[_0x0904('0x11')]){if(_0x5ab8d7[_0x0904('0x11')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x39335c,_0x5ab8d7[_0x0904('0x11')][_0x0904('0x12')]);return _0x334a23(_0x5ab8d7[_0x0904('0x11')][_0x0904('0x12')]);}logger[_0x0904('0x11')](_0x0904('0xd'),_0x39335c,_0x5ab8d7['error'][_0x0904('0x12')]);return _0x16c6b3(_0x5ab8d7[_0x0904('0x11')]['message']);}else{logger[_0x0904('0xc')](_0x0904('0xd'),_0x39335c,_0x0904('0xe'));_0x16c6b3(_0x5ab8d7['result'][_0x0904('0x12')]);}})[_0x0904('0x13')](function(_0x1e37b0){logger[_0x0904('0x11')](_0x0904('0xd'),_0x39335c,_0x1e37b0);_0x334a23(_0x1e37b0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 86eaa70..efb7d95 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 _0x3f13=['/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x3f13,0x106));var _0x33f1=function(_0x563153,_0x4efee2){_0x563153=_0x563153-0x0;var _0x35ec58=_0x3f13[_0x563153];return _0x35ec58;};'use strict';var multer=require(_0x33f1('0x0'));var util=require(_0x33f1('0x1'));var path=require(_0x33f1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x33f1('0x3')]();var fs_extra=require(_0x33f1('0x4'));var auth=require(_0x33f1('0x5'));var interaction=require(_0x33f1('0x6'));var config=require('../../config/environment');var controller=require(_0x33f1('0x7'));router[_0x33f1('0x8')]('/',auth[_0x33f1('0x9')](),controller[_0x33f1('0xa')]);router[_0x33f1('0x8')](_0x33f1('0xb'),auth['isAuthenticated'](),controller[_0x33f1('0xc')]);router[_0x33f1('0x8')](_0x33f1('0xd'),auth[_0x33f1('0x9')](),controller[_0x33f1('0xe')]);router[_0x33f1('0xf')]('/',auth[_0x33f1('0x9')](),controller[_0x33f1('0x10')]);router[_0x33f1('0x11')]('/:id',auth[_0x33f1('0x9')](),controller['update']);router[_0x33f1('0x12')](_0x33f1('0xd'),auth['isAuthenticated'](),controller[_0x33f1('0x13')]);module[_0x33f1('0x14')]=router; \ No newline at end of file +var _0x0b32=['./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x0b32,0x110));var _0x20b3=function(_0x5c999e,_0x536932){_0x5c999e=_0x5c999e-0x0;var _0x2eb589=_0x0b32[_0x5c999e];return _0x2eb589;};'use strict';var multer=require(_0x20b3('0x0'));var util=require('util');var path=require(_0x20b3('0x1'));var timeout=require(_0x20b3('0x2'));var express=require(_0x20b3('0x3'));var router=express[_0x20b3('0x4')]();var fs_extra=require(_0x20b3('0x5'));var auth=require(_0x20b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x20b3('0x7'));var controller=require(_0x20b3('0x8'));router['get']('/',auth[_0x20b3('0x9')](),controller[_0x20b3('0xa')]);router[_0x20b3('0xb')](_0x20b3('0xc'),auth[_0x20b3('0x9')](),controller[_0x20b3('0xd')]);router[_0x20b3('0xb')](_0x20b3('0xe'),auth[_0x20b3('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x20b3('0xf')]('/:id',auth[_0x20b3('0x9')](),controller[_0x20b3('0x10')]);router[_0x20b3('0x11')](_0x20b3('0xe'),auth[_0x20b3('0x9')](),controller[_0x20b3('0x12')]);module[_0x20b3('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 5709fd4..9772cca 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x478927,_0x137268){var _0x37223f=function(_0x16faf8){while(--_0x16faf8){_0x478927['push'](_0x478927['shift']());}};_0x37223f(++_0x137268);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3ddbf5,_0x55a958){var _0x1caa47=function(_0x1715d1){while(--_0x1715d1){_0x3ddbf5['push'](_0x3ddbf5['shift']());}};_0x1caa47(++_0x55a958);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0xf3cd[_0x292423];return _0x2801cb;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e72f86e..81515ac 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 _0x37e2=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x550ef9,_0x3a9b13){var _0x252d95=function(_0x32e135){while(--_0x32e135){_0x550ef9['push'](_0x550ef9['shift']());}};_0x252d95(++_0x3a9b13);}(_0x37e2,0x1d1));var _0x237e=function(_0xa1d326,_0x28feef){_0xa1d326=_0xa1d326-0x0;var _0x4cc70f=_0x37e2[_0xa1d326];return _0x4cc70f;};'use strict';var emlformat=require(_0x237e('0x0'));var rimraf=require(_0x237e('0x1'));var zipdir=require(_0x237e('0x2'));var jsonpatch=require(_0x237e('0x3'));var rp=require('request-promise');var moment=require(_0x237e('0x4'));var BPromise=require(_0x237e('0x5'));var Mustache=require(_0x237e('0x6'));var util=require(_0x237e('0x7'));var path=require(_0x237e('0x8'));var sox=require(_0x237e('0x9'));var csv=require('to-csv');var ejs=require(_0x237e('0xa'));var fs=require('fs');var fs_extra=require(_0x237e('0xb'));var _=require(_0x237e('0xc'));var squel=require(_0x237e('0xd'));var crypto=require(_0x237e('0xe'));var jsforce=require(_0x237e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x237e('0x10'));var querystring=require(_0x237e('0x11'));var Papa=require(_0x237e('0x12'));var Redis=require(_0x237e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x237e('0x14'));var as=require(_0x237e('0x15'));var hardwareService=require(_0x237e('0x16'));var logger=require(_0x237e('0x17'))('api');var utils=require(_0x237e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x237e('0x19'))['db'];function respondWithStatusCode(_0x15e6f8,_0x19e1e7){_0x19e1e7=_0x19e1e7||0xcc;return function(_0x395937){if(_0x395937){return _0x15e6f8['sendStatus'](_0x19e1e7);}return _0x15e6f8[_0x237e('0x1a')](_0x19e1e7)[_0x237e('0x1b')]();};}function respondWithResult(_0x3e1f78,_0x4ebff4){_0x4ebff4=_0x4ebff4||0xc8;return function(_0x52a03e){if(_0x52a03e){return _0x3e1f78[_0x237e('0x1a')](_0x4ebff4)[_0x237e('0x1c')](_0x52a03e);}};}function respondWithFilteredResult(_0x13168c,_0x2c8661){return function(_0x2784aa){if(_0x2784aa){var _0x1081d0=typeof _0x2c8661[_0x237e('0x1d')]===_0x237e('0x1e')&&typeof _0x2c8661['limit']===_0x237e('0x1e');var _0x4e5db1=_0x2784aa[_0x237e('0x1f')];var _0x1c8153=_0x1081d0?0x0:_0x2c8661[_0x237e('0x1d')];var _0x2a2747=_0x1081d0?_0x2784aa[_0x237e('0x1f')]:_0x2c8661[_0x237e('0x1d')]+_0x2c8661[_0x237e('0x20')];var _0x542c78;if(_0x2a2747>=_0x4e5db1){_0x2a2747=_0x4e5db1;_0x542c78=0xc8;}else{_0x542c78=0xce;}_0x13168c[_0x237e('0x1a')](_0x542c78);return _0x13168c[_0x237e('0x21')](_0x237e('0x22'),_0x1c8153+'-'+_0x2a2747+'/'+_0x4e5db1)[_0x237e('0x1c')](_0x2784aa);}return null;};}function patchUpdates(_0x405243){return function(_0x2324e3){try{jsonpatch[_0x237e('0x23')](_0x2324e3,_0x405243,!![]);}catch(_0x4e7c6a){return BPromise[_0x237e('0x24')](_0x4e7c6a);}return _0x2324e3[_0x237e('0x25')]();};}function saveUpdates(_0xd1b5bf,_0x2c6230){return function(_0x2f738b){if(_0x2f738b){return _0x2f738b['update'](_0xd1b5bf)[_0x237e('0x26')](function(_0x48983a){return _0x48983a;});}return null;};}function removeEntity(_0x220a33,_0x3e23f){return function(_0x286f44){if(_0x286f44){return _0x286f44[_0x237e('0x27')]()['then'](function(){_0x220a33['status'](0xcc)[_0x237e('0x1b')]();});}};}function handleEntityNotFound(_0x1c7eee,_0x4be4b1){return function(_0x1d40e1){if(!_0x1d40e1){_0x1c7eee['sendStatus'](0x194);}return _0x1d40e1;};}function handleError(_0x31e3fa,_0x140a78){_0x140a78=_0x140a78||0x1f4;return function(_0x5c8023){logger[_0x237e('0x28')](_0x5c8023[_0x237e('0x29')]);if(_0x5c8023[_0x237e('0x2a')]){delete _0x5c8023['name'];}_0x31e3fa[_0x237e('0x1a')](_0x140a78)[_0x237e('0x2b')](_0x5c8023);};}exports[_0x237e('0x2c')]=function(_0x324daf,_0x27851d){var _0x4247d3={},_0xc33037={},_0x530351={'count':0x0,'rows':[]};var _0x300729=_[_0x237e('0x2d')](db[_0x237e('0x2e')][_0x237e('0x2f')],function(_0x3b874a){return{'name':_0x3b874a[_0x237e('0x30')],'type':_0x3b874a[_0x237e('0x31')][_0x237e('0x32')]};});_0xc33037['model']=_[_0x237e('0x2d')](_0x300729,_0x237e('0x2a'));_0xc33037[_0x237e('0x33')]=_[_0x237e('0x34')](_0x324daf[_0x237e('0x33')]);_0xc33037[_0x237e('0x35')]=_['intersection'](_0xc33037[_0x237e('0x36')],_0xc33037[_0x237e('0x33')]);_0x4247d3['attributes']=_[_0x237e('0x37')](_0xc33037[_0x237e('0x36')],qs[_0x237e('0x38')](_0x324daf['query']['fields']));_0x4247d3['attributes']=_0x4247d3[_0x237e('0x39')][_0x237e('0x3a')]?_0x4247d3['attributes']:_0xc33037[_0x237e('0x36')];if(!_0x324daf['query'][_0x237e('0x3b')](_0x237e('0x3c'))){_0x4247d3[_0x237e('0x20')]=qs['limit'](_0x324daf['query']['limit']);_0x4247d3[_0x237e('0x1d')]=qs[_0x237e('0x1d')](_0x324daf[_0x237e('0x33')]['offset']);}_0x4247d3[_0x237e('0x3d')]=qs[_0x237e('0x3e')](_0x324daf[_0x237e('0x33')]['sort']);_0x4247d3[_0x237e('0x3f')]=qs['filters'](_['pick'](_0x324daf['query'],_0xc33037[_0x237e('0x35')]),_0x300729);if(_0x324daf['query'][_0x237e('0x40')]){_0x4247d3[_0x237e('0x3f')]=_['merge'](_0x4247d3[_0x237e('0x3f')],{'$or':_['map'](_0x300729,function(_0x4c703d){if(_0x4c703d[_0x237e('0x31')]!==_0x237e('0x41')){var _0x41acc0={};_0x41acc0[_0x4c703d['name']]={'$like':'%'+_0x324daf[_0x237e('0x33')]['filter']+'%'};return _0x41acc0;}})});}_0x4247d3=_[_0x237e('0x42')]({},_0x4247d3,_0x324daf[_0x237e('0x43')]);var _0x44375a={'where':_0x4247d3[_0x237e('0x3f')]};return db[_0x237e('0x2e')][_0x237e('0x1f')](_0x44375a)[_0x237e('0x26')](function(_0x24beac){_0x530351[_0x237e('0x1f')]=_0x24beac;if(_0x324daf[_0x237e('0x33')]['includeAll']){_0x4247d3[_0x237e('0x44')]=[{'all':!![]}];}return db[_0x237e('0x2e')][_0x237e('0x45')](_0x4247d3);})[_0x237e('0x26')](function(_0x59ea4f){_0x530351[_0x237e('0x46')]=_0x59ea4f;return _0x530351;})[_0x237e('0x26')](respondWithFilteredResult(_0x27851d,_0x4247d3))[_0x237e('0x47')](handleError(_0x27851d,null));};exports[_0x237e('0x48')]=function(_0x419de8,_0x4fb4c6){var _0x43f46a={'raw':!![],'where':{'id':_0x419de8['params']['id']}},_0x43d5de={};_0x43d5de[_0x237e('0x36')]=_[_0x237e('0x34')](db[_0x237e('0x2e')]['rawAttributes']);_0x43d5de[_0x237e('0x33')]=_[_0x237e('0x34')](_0x419de8[_0x237e('0x33')]);_0x43d5de['filters']=_['intersection'](_0x43d5de['model'],_0x43d5de['query']);_0x43f46a[_0x237e('0x39')]=_[_0x237e('0x37')](_0x43d5de[_0x237e('0x36')],qs[_0x237e('0x38')](_0x419de8[_0x237e('0x33')][_0x237e('0x38')]));_0x43f46a[_0x237e('0x39')]=_0x43f46a['attributes'][_0x237e('0x3a')]?_0x43f46a['attributes']:_0x43d5de['model'];if(_0x419de8[_0x237e('0x33')][_0x237e('0x49')]){_0x43f46a[_0x237e('0x44')]=[{'all':!![]}];}_0x43f46a=_['merge']({},_0x43f46a,_0x419de8[_0x237e('0x43')]);return db['MailTransferReport'][_0x237e('0x4a')](_0x43f46a)['then'](handleEntityNotFound(_0x4fb4c6,null))[_0x237e('0x26')](respondWithResult(_0x4fb4c6,null))[_0x237e('0x47')](handleError(_0x4fb4c6,null));};exports[_0x237e('0x4b')]=function(_0x4f514b,_0x495b33){return db[_0x237e('0x2e')]['create'](_0x4f514b[_0x237e('0x4c')],{})[_0x237e('0x26')](respondWithResult(_0x495b33,0xc9))['catch'](handleError(_0x495b33,null));};exports['update']=function(_0x8abb3a,_0x19dabf){if(_0x8abb3a['body']['id']){delete _0x8abb3a['body']['id'];}return db[_0x237e('0x2e')][_0x237e('0x4a')]({'where':{'id':_0x8abb3a['params']['id']}})[_0x237e('0x26')](handleEntityNotFound(_0x19dabf,null))['then'](saveUpdates(_0x8abb3a['body'],null))[_0x237e('0x26')](respondWithResult(_0x19dabf,null))[_0x237e('0x47')](handleError(_0x19dabf,null));};exports['destroy']=function(_0x4c2e17,_0x112822){return db[_0x237e('0x2e')][_0x237e('0x4a')]({'where':{'id':_0x4c2e17[_0x237e('0x4d')]['id']}})[_0x237e('0x26')](handleEntityNotFound(_0x112822,null))[_0x237e('0x26')](removeEntity(_0x112822,null))[_0x237e('0x47')](handleError(_0x112822,null));};exports[_0x237e('0x4e')]=function(_0x340b79,_0x22ea71){return db[_0x237e('0x2e')][_0x237e('0x4e')]()[_0x237e('0x26')](respondWithResult(_0x22ea71,null))[_0x237e('0x47')](handleError(_0x22ea71,null));}; \ No newline at end of file +var _0xa276=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','MailTransferReport','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','update','find','describe','eml-format','rimraf','zip-dir'];(function(_0x180770,_0xbc82cf){var _0x2b0def=function(_0x4a0533){while(--_0x4a0533){_0x180770['push'](_0x180770['shift']());}};_0x2b0def(++_0xbc82cf);}(_0xa276,0x8b));var _0x6a27=function(_0x22ada8,_0x23a7ea){_0x22ada8=_0x22ada8-0x0;var _0x506e36=_0xa276[_0x22ada8];return _0x506e36;};'use strict';var emlformat=require(_0x6a27('0x0'));var rimraf=require(_0x6a27('0x1'));var zipdir=require(_0x6a27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a27('0x3'));var BPromise=require(_0x6a27('0x4'));var Mustache=require('mustache');var util=require(_0x6a27('0x5'));var path=require(_0x6a27('0x6'));var sox=require(_0x6a27('0x7'));var csv=require(_0x6a27('0x8'));var ejs=require(_0x6a27('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a27('0xa'));var squel=require(_0x6a27('0xb'));var crypto=require(_0x6a27('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6a27('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6a27('0xe'));var Papa=require(_0x6a27('0xf'));var Redis=require(_0x6a27('0x10'));var authService=require(_0x6a27('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6a27('0x12'));var hardwareService=require(_0x6a27('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a27('0x14'));var licenseUtil=require(_0x6a27('0x15'));var db=require(_0x6a27('0x16'))['db'];function respondWithStatusCode(_0x326bad,_0x226dc2){_0x226dc2=_0x226dc2||0xcc;return function(_0x37c0a8){if(_0x37c0a8){return _0x326bad[_0x6a27('0x17')](_0x226dc2);}return _0x326bad[_0x6a27('0x18')](_0x226dc2)[_0x6a27('0x19')]();};}function respondWithResult(_0x8f5a96,_0x4a1d9e){_0x4a1d9e=_0x4a1d9e||0xc8;return function(_0x297591){if(_0x297591){return _0x8f5a96[_0x6a27('0x18')](_0x4a1d9e)[_0x6a27('0x1a')](_0x297591);}};}function respondWithFilteredResult(_0x387774,_0x261933){return function(_0x46271c){if(_0x46271c){var _0x1b67f6=typeof _0x261933[_0x6a27('0x1b')]===_0x6a27('0x1c')&&typeof _0x261933[_0x6a27('0x1d')]===_0x6a27('0x1c');var _0x467c0f=_0x46271c[_0x6a27('0x1e')];var _0x42e4f=_0x1b67f6?0x0:_0x261933[_0x6a27('0x1b')];var _0x647410=_0x1b67f6?_0x46271c[_0x6a27('0x1e')]:_0x261933[_0x6a27('0x1b')]+_0x261933[_0x6a27('0x1d')];var _0x57d010;if(_0x647410>=_0x467c0f){_0x647410=_0x467c0f;_0x57d010=0xc8;}else{_0x57d010=0xce;}_0x387774[_0x6a27('0x18')](_0x57d010);return _0x387774['set']('Content-Range',_0x42e4f+'-'+_0x647410+'/'+_0x467c0f)[_0x6a27('0x1a')](_0x46271c);}return null;};}function patchUpdates(_0x2017bd){return function(_0x4bf498){try{jsonpatch[_0x6a27('0x1f')](_0x4bf498,_0x2017bd,!![]);}catch(_0x499897){return BPromise[_0x6a27('0x20')](_0x499897);}return _0x4bf498[_0x6a27('0x21')]();};}function saveUpdates(_0x15570d,_0x1b506f){return function(_0x2b05f5){if(_0x2b05f5){return _0x2b05f5['update'](_0x15570d)[_0x6a27('0x22')](function(_0x4a6334){return _0x4a6334;});}return null;};}function removeEntity(_0x23cc5e,_0x140719){return function(_0x50c493){if(_0x50c493){return _0x50c493[_0x6a27('0x23')]()[_0x6a27('0x22')](function(){_0x23cc5e[_0x6a27('0x18')](0xcc)[_0x6a27('0x19')]();});}};}function handleEntityNotFound(_0x2e4f23,_0x2a667a){return function(_0x216fce){if(!_0x216fce){_0x2e4f23[_0x6a27('0x17')](0x194);}return _0x216fce;};}function handleError(_0x1bbf04,_0x1e82d4){_0x1e82d4=_0x1e82d4||0x1f4;return function(_0x4162ac){logger['error'](_0x4162ac[_0x6a27('0x24')]);if(_0x4162ac[_0x6a27('0x25')]){delete _0x4162ac['name'];}_0x1bbf04[_0x6a27('0x18')](_0x1e82d4)[_0x6a27('0x26')](_0x4162ac);};}exports[_0x6a27('0x27')]=function(_0x389a02,_0x90ec67){var _0x5f0ac5={},_0x2d6220={},_0x3c6ef8={'count':0x0,'rows':[]};var _0x1c3667=_['map'](db[_0x6a27('0x28')]['rawAttributes'],function(_0x3bbd97){return{'name':_0x3bbd97['fieldName'],'type':_0x3bbd97[_0x6a27('0x29')]['key']};});_0x2d6220[_0x6a27('0x2a')]=_['map'](_0x1c3667,'name');_0x2d6220['query']=_['keys'](_0x389a02[_0x6a27('0x2b')]);_0x2d6220[_0x6a27('0x2c')]=_[_0x6a27('0x2d')](_0x2d6220[_0x6a27('0x2a')],_0x2d6220[_0x6a27('0x2b')]);_0x5f0ac5['attributes']=_['intersection'](_0x2d6220['model'],qs['fields'](_0x389a02[_0x6a27('0x2b')][_0x6a27('0x2e')]));_0x5f0ac5['attributes']=_0x5f0ac5['attributes'][_0x6a27('0x2f')]?_0x5f0ac5[_0x6a27('0x30')]:_0x2d6220[_0x6a27('0x2a')];if(!_0x389a02[_0x6a27('0x2b')][_0x6a27('0x31')](_0x6a27('0x32'))){_0x5f0ac5[_0x6a27('0x1d')]=qs[_0x6a27('0x1d')](_0x389a02[_0x6a27('0x2b')][_0x6a27('0x1d')]);_0x5f0ac5[_0x6a27('0x1b')]=qs[_0x6a27('0x1b')](_0x389a02['query'][_0x6a27('0x1b')]);}_0x5f0ac5[_0x6a27('0x33')]=qs['sort'](_0x389a02[_0x6a27('0x2b')]['sort']);_0x5f0ac5[_0x6a27('0x34')]=qs[_0x6a27('0x2c')](_[_0x6a27('0x35')](_0x389a02[_0x6a27('0x2b')],_0x2d6220['filters']),_0x1c3667);if(_0x389a02[_0x6a27('0x2b')][_0x6a27('0x36')]){_0x5f0ac5[_0x6a27('0x34')]=_['merge'](_0x5f0ac5['where'],{'$or':_['map'](_0x1c3667,function(_0x3236d8){if(_0x3236d8[_0x6a27('0x29')]!==_0x6a27('0x37')){var _0x3ff133={};_0x3ff133[_0x3236d8[_0x6a27('0x25')]]={'$like':'%'+_0x389a02[_0x6a27('0x2b')][_0x6a27('0x36')]+'%'};return _0x3ff133;}})});}_0x5f0ac5=_['merge']({},_0x5f0ac5,_0x389a02['options']);var _0x171937={'where':_0x5f0ac5[_0x6a27('0x34')]};return db[_0x6a27('0x28')][_0x6a27('0x1e')](_0x171937)[_0x6a27('0x22')](function(_0x3d3553){_0x3c6ef8['count']=_0x3d3553;if(_0x389a02[_0x6a27('0x2b')][_0x6a27('0x38')]){_0x5f0ac5[_0x6a27('0x39')]=[{'all':!![]}];}return db[_0x6a27('0x28')][_0x6a27('0x3a')](_0x5f0ac5);})[_0x6a27('0x22')](function(_0x76ef0){_0x3c6ef8[_0x6a27('0x3b')]=_0x76ef0;return _0x3c6ef8;})[_0x6a27('0x22')](respondWithFilteredResult(_0x90ec67,_0x5f0ac5))[_0x6a27('0x3c')](handleError(_0x90ec67,null));};exports[_0x6a27('0x3d')]=function(_0x479229,_0xd2d3d4){var _0x3febaf={'raw':!![],'where':{'id':_0x479229[_0x6a27('0x3e')]['id']}},_0x4ce623={};_0x4ce623[_0x6a27('0x2a')]=_[_0x6a27('0x3f')](db[_0x6a27('0x28')][_0x6a27('0x40')]);_0x4ce623[_0x6a27('0x2b')]=_['keys'](_0x479229[_0x6a27('0x2b')]);_0x4ce623[_0x6a27('0x2c')]=_['intersection'](_0x4ce623['model'],_0x4ce623[_0x6a27('0x2b')]);_0x3febaf[_0x6a27('0x30')]=_['intersection'](_0x4ce623[_0x6a27('0x2a')],qs[_0x6a27('0x2e')](_0x479229['query'][_0x6a27('0x2e')]));_0x3febaf['attributes']=_0x3febaf['attributes'][_0x6a27('0x2f')]?_0x3febaf[_0x6a27('0x30')]:_0x4ce623[_0x6a27('0x2a')];if(_0x479229[_0x6a27('0x2b')][_0x6a27('0x38')]){_0x3febaf[_0x6a27('0x39')]=[{'all':!![]}];}_0x3febaf=_['merge']({},_0x3febaf,_0x479229[_0x6a27('0x41')]);return db['MailTransferReport']['find'](_0x3febaf)[_0x6a27('0x22')](handleEntityNotFound(_0xd2d3d4,null))[_0x6a27('0x22')](respondWithResult(_0xd2d3d4,null))[_0x6a27('0x3c')](handleError(_0xd2d3d4,null));};exports[_0x6a27('0x42')]=function(_0x556c96,_0x450016){return db['MailTransferReport'][_0x6a27('0x42')](_0x556c96[_0x6a27('0x43')],{})['then'](respondWithResult(_0x450016,0xc9))['catch'](handleError(_0x450016,null));};exports[_0x6a27('0x44')]=function(_0x552062,_0x14e2b7){if(_0x552062[_0x6a27('0x43')]['id']){delete _0x552062[_0x6a27('0x43')]['id'];}return db[_0x6a27('0x28')]['find']({'where':{'id':_0x552062[_0x6a27('0x3e')]['id']}})[_0x6a27('0x22')](handleEntityNotFound(_0x14e2b7,null))[_0x6a27('0x22')](saveUpdates(_0x552062['body'],null))['then'](respondWithResult(_0x14e2b7,null))[_0x6a27('0x3c')](handleError(_0x14e2b7,null));};exports[_0x6a27('0x23')]=function(_0xd8ed94,_0xbab1b9){return db['MailTransferReport'][_0x6a27('0x45')]({'where':{'id':_0xd8ed94[_0x6a27('0x3e')]['id']}})[_0x6a27('0x22')](handleEntityNotFound(_0xbab1b9,null))[_0x6a27('0x22')](removeEntity(_0xbab1b9,null))[_0x6a27('0x3c')](handleError(_0xbab1b9,null));};exports[_0x6a27('0x46')]=function(_0x20918a,_0xac58d4){return db['MailTransferReport'][_0x6a27('0x46')]()[_0x6a27('0x22')](respondWithResult(_0xac58d4,null))[_0x6a27('0x3c')](handleError(_0xac58d4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e54e9d7..b2bdda7 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 _0x3e74=['../../config/logger','api','moment','path','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3e74,0x175));var _0x43e7=function(_0x242276,_0x5c7c6d){_0x242276=_0x242276-0x0;var _0x3e9792=_0x3e74[_0x242276];return _0x3e9792;};'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':[{'name':_0x43e7('0xa'),'fields':[_0x43e7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb0d=['../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','moment','bluebird','path','rimraf'];(function(_0x2c73fa,_0x41b660){var _0x201374=function(_0xb0a36c){while(--_0xb0a36c){_0x2c73fa['push'](_0x2c73fa['shift']());}};_0x201374(++_0x41b660);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x1b6685,_0x553c4d){_0x1b6685=_0x1b6685-0x0;var _0x31280b=_0xeb0d[_0x1b6685];return _0x31280b;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb0('0x3'));var rimraf=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var attributes=require(_0xdeb0('0x6'));module[_0xdeb0('0x7')]=function(_0x13d486,_0xc48108){return _0x13d486[_0xdeb0('0x8')]('MailTransferReport',attributes,{'tableName':_0xdeb0('0x9'),'paranoid':![],'indexes':[{'name':_0xdeb0('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index adbca18..a417691 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 _0x0937=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0x0937,0x149));var _0x7093=function(_0x2091e7,_0x3875d7){_0x2091e7=_0x2091e7-0x0;var _0x142c07=_0x0937[_0x2091e7];return _0x142c07;};'use strict';var _=require(_0x7093('0x0'));var util=require(_0x7093('0x1'));var moment=require(_0x7093('0x2'));var BPromise=require(_0x7093('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7093('0x4'))['db'];var utils=require(_0x7093('0x5'));var logger=require(_0x7093('0x6'))(_0x7093('0x7'));var config=require(_0x7093('0x8'));var jayson=require(_0x7093('0x9'));var client=jayson[_0x7093('0xa')][_0x7093('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552b18,_0x1c12a6,_0x3c6af2){return new BPromise(function(_0x3412cd,_0xd032a1){return client[_0x7093('0xc')](_0x552b18,_0x3c6af2)[_0x7093('0xd')](function(_0x1a3680){logger[_0x7093('0xe')](_0x7093('0xf'),_0x1c12a6,'request\x20sent');logger[_0x7093('0x10')](_0x7093('0x11'),_0x1c12a6,'request\x20sent',JSON[_0x7093('0x12')](_0x1a3680));if(_0x1a3680['error']){if(_0x1a3680[_0x7093('0x13')]['code']===0x1f4){logger[_0x7093('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1c12a6,_0x1a3680['error'][_0x7093('0x14')]);return _0xd032a1(_0x1a3680['error'][_0x7093('0x14')]);}logger['error'](_0x7093('0xf'),_0x1c12a6,_0x1a3680[_0x7093('0x13')][_0x7093('0x14')]);return _0x3412cd(_0x1a3680[_0x7093('0x13')][_0x7093('0x14')]);}else{logger[_0x7093('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1c12a6,_0x7093('0x15'));_0x3412cd(_0x1a3680[_0x7093('0x16')][_0x7093('0x14')]);}})[_0x7093('0x17')](function(_0x2a5420){logger['error'](_0x7093('0xf'),_0x1c12a6,_0x2a5420);_0xd032a1(_0x2a5420);});});} \ No newline at end of file +var _0x8dd2=['MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x8dd2,0x16c));var _0x28dd=function(_0x100f05,_0x2de0fa){_0x100f05=_0x100f05-0x0;var _0x2bcde1=_0x8dd2[_0x100f05];return _0x2bcde1;};'use strict';var _=require(_0x28dd('0x0'));var util=require(_0x28dd('0x1'));var moment=require('moment');var BPromise=require(_0x28dd('0x2'));var rs=require(_0x28dd('0x3'));var fs=require('fs');var Redis=require(_0x28dd('0x4'));var db=require(_0x28dd('0x5'))['db'];var utils=require(_0x28dd('0x6'));var logger=require(_0x28dd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28dd('0x8')][_0x28dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x279df8,_0x541c81,_0x33eb86){return new BPromise(function(_0x4d627a,_0x3dbeae){return client[_0x28dd('0xa')](_0x279df8,_0x33eb86)['then'](function(_0x170649){logger[_0x28dd('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x541c81,_0x28dd('0xc'));logger['debug'](_0x28dd('0xd'),_0x541c81,_0x28dd('0xc'),JSON['stringify'](_0x170649));if(_0x170649[_0x28dd('0xe')]){if(_0x170649[_0x28dd('0xe')][_0x28dd('0xf')]===0x1f4){logger['error'](_0x28dd('0x10'),_0x541c81,_0x170649[_0x28dd('0xe')]['message']);return _0x3dbeae(_0x170649[_0x28dd('0xe')][_0x28dd('0x11')]);}logger[_0x28dd('0xe')](_0x28dd('0x10'),_0x541c81,_0x170649[_0x28dd('0xe')]['message']);return _0x4d627a(_0x170649[_0x28dd('0xe')][_0x28dd('0x11')]);}else{logger[_0x28dd('0xb')](_0x28dd('0x10'),_0x541c81,_0x28dd('0xc'));_0x4d627a(_0x170649['result'][_0x28dd('0x11')]);}})[_0x28dd('0x12')](function(_0x7ed795){logger[_0x28dd('0xe')](_0x28dd('0x10'),_0x541c81,_0x7ed795);_0x3dbeae(_0x7ed795);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 200cc14..9e8d191 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 _0xf063=['destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0xf063,0xeb));var _0x3f06=function(_0xf4cebd,_0x241512){_0xf4cebd=_0xf4cebd-0x0;var _0x5de16f=_0xf063[_0xf4cebd];return _0x5de16f;};'use strict';var multer=require(_0x3f06('0x0'));var util=require(_0x3f06('0x1'));var path=require(_0x3f06('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f06('0x3')]();var fs_extra=require(_0x3f06('0x4'));var auth=require(_0x3f06('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3f06('0x6'));var controller=require(_0x3f06('0x7'));router[_0x3f06('0x8')]('/',auth['isAuthenticated'](),controller[_0x3f06('0x9')]);router[_0x3f06('0x8')](_0x3f06('0xa'),auth[_0x3f06('0xb')](),controller[_0x3f06('0xc')]);router['get'](_0x3f06('0xd'),auth[_0x3f06('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3f06('0xe')]);router[_0x3f06('0xf')](_0x3f06('0xd'),auth[_0x3f06('0xb')](),controller[_0x3f06('0x10')]);router['delete'](_0x3f06('0xd'),auth[_0x3f06('0xb')](),controller[_0x3f06('0x11')]);module['exports']=router; \ No newline at end of file +var _0xedb3=['../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xedb3,0x67));var _0x3edb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xedb3[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x3edb('0x0'));var util=require(_0x3edb('0x1'));var path=require(_0x3edb('0x2'));var timeout=require(_0x3edb('0x3'));var express=require(_0x3edb('0x4'));var router=express['Router']();var fs_extra=require(_0x3edb('0x5'));var auth=require(_0x3edb('0x6'));var interaction=require(_0x3edb('0x7'));var config=require('../../config/environment');var controller=require(_0x3edb('0x8'));router[_0x3edb('0x9')]('/',auth[_0x3edb('0xa')](),controller[_0x3edb('0xb')]);router[_0x3edb('0x9')](_0x3edb('0xc'),auth[_0x3edb('0xa')](),controller[_0x3edb('0xd')]);router[_0x3edb('0x9')](_0x3edb('0xe'),auth[_0x3edb('0xa')](),controller[_0x3edb('0xf')]);router[_0x3edb('0x10')]('/',auth[_0x3edb('0xa')](),controller[_0x3edb('0x11')]);router[_0x3edb('0x12')](_0x3edb('0xe'),auth[_0x3edb('0xa')](),controller['update']);router[_0x3edb('0x13')](_0x3edb('0xe'),auth[_0x3edb('0xa')](),controller[_0x3edb('0x14')]);module[_0x3edb('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 67caa46..9d1c20e 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 _0x33c4=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration'];(function(_0x1ccc8d,_0x2f8937){var _0x18b289=function(_0x568510){while(--_0x568510){_0x1ccc8d['push'](_0x1ccc8d['shift']());}};_0x18b289(++_0x2f8937);}(_0x33c4,0x1d4));var _0x433c=function(_0x50f298,_0x15ec50){_0x50f298=_0x50f298-0x0;var _0xa1ab2=_0x33c4[_0x50f298];return _0xa1ab2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x433c('0x0')]={'channel':{'type':Sequelize[_0x433c('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x433c('0x1')]},'type':{'type':Sequelize[_0x433c('0x1')],'defaultValue':_0x433c('0x2'),'comment':_0x433c('0x3')},'duration':{'type':Sequelize[_0x433c('0x4')]},'enterAt':{'type':Sequelize[_0x433c('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1b2b87){var _0x4e470f=moment(_0x1b2b87);var _0x17489b=moment(this[_0x433c('0x6')]('enterAt'));var _0x511d5c=_0x4e470f[_0x433c('0x7')](_0x17489b,_0x433c('0x8'));this[_0x433c('0x9')](_0x433c('0xa'),_0x1b2b87);this[_0x433c('0x9')](_0x433c('0xb'),_0x511d5c>=0x0?_0x511d5c:null);}},'data1':{'type':Sequelize[_0x433c('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x433c('0x1')],'comment':_0x433c('0xc')},'data3':{'type':Sequelize[_0x433c('0x1')],'comment':_0x433c('0xd')},'data4':{'type':Sequelize[_0x433c('0x1')],'comment':_0x433c('0xe')},'data5':{'type':Sequelize[_0x433c('0x1')],'comment':_0x433c('0xf')},'role':{'type':Sequelize[_0x433c('0x1')]},'internal':{'type':Sequelize[_0x433c('0x4')]},'uniqueid':{'type':Sequelize[_0x433c('0x1')]}}; \ No newline at end of file +var _0x5eba=['sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]'];(function(_0x4f81cd,_0x19ad69){var _0x43a889=function(_0x47743e){while(--_0x47743e){_0x4f81cd['push'](_0x4f81cd['shift']());}};_0x43a889(++_0x19ad69);}(_0x5eba,0xa5));var _0xa5eb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5eba[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xa5eb('0x0'));var moment=require('moment');module[_0xa5eb('0x1')]={'channel':{'type':Sequelize[_0xa5eb('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xa5eb('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xa5eb('0x3'),'comment':_0xa5eb('0x4')},'duration':{'type':Sequelize[_0xa5eb('0x5')]},'enterAt':{'type':Sequelize[_0xa5eb('0x6')]},'exitAt':{'type':Sequelize[_0xa5eb('0x6')],'set':function(_0x298302){var _0x44b5bc=moment(_0x298302);var _0x38b08f=moment(this['getDataValue'](_0xa5eb('0x7')));var _0x4da221=_0x44b5bc[_0xa5eb('0x8')](_0x38b08f,_0xa5eb('0x9'));this['setDataValue']('exitAt',_0x298302);this[_0xa5eb('0xa')](_0xa5eb('0xb'),_0x4da221>=0x0?_0x4da221:null);}},'data1':{'type':Sequelize[_0xa5eb('0x2')],'comment':_0xa5eb('0xc')},'data2':{'type':Sequelize[_0xa5eb('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xa5eb('0x2')],'comment':_0xa5eb('0xd')},'data4':{'type':Sequelize[_0xa5eb('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xa5eb('0xe')},'role':{'type':Sequelize[_0xa5eb('0x2')]},'internal':{'type':Sequelize[_0xa5eb('0x5')]},'uniqueid':{'type':Sequelize[_0xa5eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 46d0812..8528759 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5e3167,_0xf05dcd){var _0x17f61c=function(_0x19efd9){while(--_0x19efd9){_0x5e3167['push'](_0x5e3167['shift']());}};_0x17f61c(++_0xf05dcd);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _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(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xedd9,0xfc));var _0x9edd=function(_0x1ef38d,_0x19d520){_0x1ef38d=_0x1ef38d-0x0;var _0x4bb5cf=_0xedd9[_0x1ef38d];return _0x4bb5cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 411071b..ccfb228 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 _0x00b3=['rimraf','./memberReport.attributes','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5f05ad,_0x36dcf9){var _0x502bc1=function(_0x3069a4){while(--_0x3069a4){_0x5f05ad['push'](_0x5f05ad['shift']());}};_0x502bc1(++_0x36dcf9);}(_0x00b3,0x157));var _0x300b=function(_0x53d7ec,_0x223d8f){_0x53d7ec=_0x53d7ec-0x0;var _0x361d2f=_0x00b3[_0x53d7ec];return _0x361d2f;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var logger=require(_0x300b('0x2'))(_0x300b('0x3'));var moment=require(_0x300b('0x4'));var BPromise=require(_0x300b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x300b('0x6'));var rimraf=require(_0x300b('0x7'));var config=require('../../config/environment');var attributes=require(_0x300b('0x8'));module['exports']=function(_0x2bd6ef,_0x345454){return _0x2bd6ef[_0x300b('0x9')](_0x300b('0xa'),attributes,{'tableName':_0x300b('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x300b('0xc'),_0x300b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf61a=['../../config/logger','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','membername_interface','membername','interface','util'];(function(_0x50f8e4,_0x258cd2){var _0xe731b7=function(_0x4c46a7){while(--_0x4c46a7){_0x50f8e4['push'](_0x50f8e4['shift']());}};_0xe731b7(++_0x258cd2);}(_0xf61a,0xe3));var _0xaf61=function(_0x26b4ff,_0x49cda7){_0x26b4ff=_0x26b4ff-0x0;var _0x1f2856=_0xf61a[_0x26b4ff];return _0x1f2856;};'use strict';var _=require('lodash');var util=require(_0xaf61('0x0'));var logger=require(_0xaf61('0x1'))(_0xaf61('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaf61('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf61('0x4'));var config=require(_0xaf61('0x5'));var attributes=require(_0xaf61('0x6'));module[_0xaf61('0x7')]=function(_0x242dfb,_0x508567){return _0x242dfb['define'](_0xaf61('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xaf61('0x9'),'fields':[_0xaf61('0xa'),_0xaf61('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f8420b9..39b57fe 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 _0x7ed1=['MemberReport','findAll','options','raw','where','attributes','limit','map','model','include','GetMemberReport','stringify','catch','CreateMemberReport','create','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x14702c,_0x5c39bc){var _0xc653e1=function(_0x3ff5d9){while(--_0x3ff5d9){_0x14702c['push'](_0x14702c['shift']());}};_0xc653e1(++_0x5c39bc);}(_0x7ed1,0xca));var _0x17ed=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7ed1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x17ed('0x0'));var util=require('util');var moment=require(_0x17ed('0x1'));var BPromise=require(_0x17ed('0x2'));var rs=require(_0x17ed('0x3'));var fs=require('fs');var Redis=require(_0x17ed('0x4'));var db=require(_0x17ed('0x5'))['db'];var utils=require(_0x17ed('0x6'));var logger=require('../../config/logger')(_0x17ed('0x7'));var config=require(_0x17ed('0x8'));var jayson=require(_0x17ed('0x9'));var client=jayson[_0x17ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566a07,_0x3f6dca,_0x408fc2){return new BPromise(function(_0xcd3d39,_0x6e2d89){return client['request'](_0x566a07,_0x408fc2)[_0x17ed('0xb')](function(_0x321cd2){logger[_0x17ed('0xc')](_0x17ed('0xd'),_0x3f6dca,_0x17ed('0xe'));logger[_0x17ed('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3f6dca,_0x17ed('0xe'),JSON['stringify'](_0x321cd2));if(_0x321cd2['error']){if(_0x321cd2[_0x17ed('0x10')][_0x17ed('0x11')]===0x1f4){logger[_0x17ed('0x10')](_0x17ed('0xd'),_0x3f6dca,_0x321cd2[_0x17ed('0x10')]['message']);return _0x6e2d89(_0x321cd2[_0x17ed('0x10')][_0x17ed('0x12')]);}logger[_0x17ed('0x10')]('MemberReport,\x20%s,\x20%s',_0x3f6dca,_0x321cd2[_0x17ed('0x10')]['message']);return _0xcd3d39(_0x321cd2['error'][_0x17ed('0x12')]);}else{logger['info'](_0x17ed('0xd'),_0x3f6dca,_0x17ed('0xe'));_0xcd3d39(_0x321cd2[_0x17ed('0x13')][_0x17ed('0x12')]);}})['catch'](function(_0x897d4b){logger[_0x17ed('0x10')](_0x17ed('0xd'),_0x3f6dca,_0x897d4b);_0x6e2d89(_0x897d4b);});});}exports['GetMemberReport']=function(_0x52518e){var _0x81e1a6=this;return new Promise(function(_0x2903f3,_0x933215){return db[_0x17ed('0x14')][_0x17ed('0x15')]({'raw':_0x52518e['options']?_0x52518e[_0x17ed('0x16')][_0x17ed('0x17')]===undefined?!![]:![]:!![],'where':_0x52518e['options']?_0x52518e[_0x17ed('0x16')][_0x17ed('0x18')]||null:null,'attributes':_0x52518e['options']?_0x52518e[_0x17ed('0x16')][_0x17ed('0x19')]||null:null,'limit':_0x52518e[_0x17ed('0x16')]?_0x52518e[_0x17ed('0x16')][_0x17ed('0x1a')]||null:null,'include':_0x52518e[_0x17ed('0x16')]?_0x52518e[_0x17ed('0x16')]['include']?_[_0x17ed('0x1b')](_0x52518e[_0x17ed('0x16')]['include'],function(_0x5e4f27){return{'model':db[_0x5e4f27[_0x17ed('0x1c')]],'as':_0x5e4f27['as'],'attributes':_0x5e4f27['attributes'],'include':_0x5e4f27['include']?_['map'](_0x5e4f27[_0x17ed('0x1d')],function(_0x56722d){return{'model':db[_0x56722d[_0x17ed('0x1c')]],'as':_0x56722d['as'],'attributes':_0x56722d[_0x17ed('0x19')],'include':_0x56722d[_0x17ed('0x1d')]?_['map'](_0x56722d[_0x17ed('0x1d')],function(_0x37d5d3){return{'model':db[_0x37d5d3[_0x17ed('0x1c')]],'as':_0x37d5d3['as'],'attributes':_0x37d5d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x170d4f){logger[_0x17ed('0xc')](_0x17ed('0x1e'),_0x52518e);logger['debug'](_0x17ed('0x1e'),_0x52518e,JSON[_0x17ed('0x1f')](_0x170d4f));_0x2903f3(_0x170d4f);})[_0x17ed('0x20')](function(_0x101ed6){logger['error'](_0x17ed('0x1e'),_0x101ed6[_0x17ed('0x12')],_0x52518e);_0x933215(_0x81e1a6['error'](0x1f4,_0x101ed6[_0x17ed('0x12')]));});});};exports[_0x17ed('0x21')]=function(_0xf325ed){var _0x529966=this;return new Promise(function(_0x3a9f86,_0x4544ec){return db[_0x17ed('0x14')][_0x17ed('0x22')](_0xf325ed['body'],{'raw':_0xf325ed[_0x17ed('0x16')]?_0xf325ed['options'][_0x17ed('0x17')]===undefined?!![]:![]:!![]})[_0x17ed('0xb')](function(_0x1f091d){logger[_0x17ed('0xc')]('CreateMemberReport',_0xf325ed);logger[_0x17ed('0xf')](_0x17ed('0x21'),_0xf325ed,JSON[_0x17ed('0x1f')](_0x1f091d));_0x3a9f86(_0x1f091d);})[_0x17ed('0x20')](function(_0x3f25dc){logger[_0x17ed('0x10')](_0x17ed('0x21'),_0x3f25dc[_0x17ed('0x12')],_0xf325ed);_0x4544ec(_0x529966['error'](0x1f4,_0x3f25dc[_0x17ed('0x12')]));});});};exports[_0x17ed('0x23')]=function(_0x1c9439){var _0x2202b1=this;return new Promise(function(_0x428ea0,_0x555977){return db[_0x17ed('0x14')][_0x17ed('0x24')](_0x1c9439['body'],{'raw':_0x1c9439['options']?_0x1c9439['options'][_0x17ed('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9439['options']?_0x1c9439[_0x17ed('0x16')][_0x17ed('0x18')]||null:null,'attributes':_0x1c9439[_0x17ed('0x16')]?_0x1c9439['options'][_0x17ed('0x19')]||null:null,'limit':_0x1c9439[_0x17ed('0x16')]?_0x1c9439[_0x17ed('0x16')][_0x17ed('0x1a')]||null:null})[_0x17ed('0xb')](function(_0x579146){logger[_0x17ed('0xc')](_0x17ed('0x23'),_0x1c9439);logger[_0x17ed('0xf')](_0x17ed('0x23'),_0x1c9439,JSON[_0x17ed('0x1f')](_0x579146));_0x428ea0(_0x579146);})[_0x17ed('0x20')](function(_0x54d037){logger['error'](_0x17ed('0x23'),_0x54d037[_0x17ed('0x12')],_0x1c9439);_0x555977(_0x2202b1['error'](0x1f4,_0x54d037[_0x17ed('0x12')]));});});}; \ No newline at end of file +var _0x3d4b=['attributes','then','debug','CreateMemberReport','create','body','where','catch','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','limit','include','model','map'];(function(_0x116279,_0x17fc0d){var _0x521ac8=function(_0x4690e7){while(--_0x4690e7){_0x116279['push'](_0x116279['shift']());}};_0x521ac8(++_0x17fc0d);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x572f57,_0x2feb1c){_0x572f57=_0x572f57-0x0;var _0x42f1ec=_0x3d4b[_0x572f57];return _0x42f1ec;};'use strict';var _=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var moment=require('moment');var BPromise=require(_0xb3d4('0x2'));var rs=require(_0xb3d4('0x3'));var fs=require('fs');var Redis=require(_0xb3d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3d4('0x5'));var logger=require(_0xb3d4('0x6'))(_0xb3d4('0x7'));var config=require(_0xb3d4('0x8'));var jayson=require(_0xb3d4('0x9'));var client=jayson[_0xb3d4('0xa')][_0xb3d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c49,_0x43bc45,_0x35e0b3){return new BPromise(function(_0xd1d4c4,_0x2eb3b3){return client['request'](_0x448c49,_0x35e0b3)['then'](function(_0x343c8d){logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,_0xb3d4('0xe'));logger['debug'](_0xb3d4('0xf'),_0x43bc45,_0xb3d4('0xe'),JSON[_0xb3d4('0x10')](_0x343c8d));if(_0x343c8d[_0xb3d4('0x11')]){if(_0x343c8d[_0xb3d4('0x11')][_0xb3d4('0x12')]===0x1f4){logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d[_0xb3d4('0x11')]['message']);return _0x2eb3b3(_0x343c8d['error'][_0xb3d4('0x13')]);}logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d['error'][_0xb3d4('0x13')]);return _0xd1d4c4(_0x343c8d[_0xb3d4('0x11')]['message']);}else{logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,'request\x20sent');_0xd1d4c4(_0x343c8d[_0xb3d4('0x14')]['message']);}})['catch'](function(_0x539d5){logger['error'](_0xb3d4('0xd'),_0x43bc45,_0x539d5);_0x2eb3b3(_0x539d5);});});}exports[_0xb3d4('0x15')]=function(_0x1676a5){var _0x270298=this;return new Promise(function(_0x233adc,_0x5688d4){return db[_0xb3d4('0x16')][_0xb3d4('0x17')]({'raw':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['where']||null:null,'attributes':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['attributes']||null:null,'limit':_0x1676a5['options']?_0x1676a5['options'][_0xb3d4('0x1a')]||null:null,'include':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x1b')]?_['map'](_0x1676a5['options'][_0xb3d4('0x1b')],function(_0x51c3a9){return{'model':db[_0x51c3a9[_0xb3d4('0x1c')]],'as':_0x51c3a9['as'],'attributes':_0x51c3a9['attributes'],'include':_0x51c3a9['include']?_[_0xb3d4('0x1d')](_0x51c3a9[_0xb3d4('0x1b')],function(_0x1fdbf6){return{'model':db[_0x1fdbf6['model']],'as':_0x1fdbf6['as'],'attributes':_0x1fdbf6[_0xb3d4('0x1e')],'include':_0x1fdbf6['include']?_['map'](_0x1fdbf6[_0xb3d4('0x1b')],function(_0x5482a4){return{'model':db[_0x5482a4[_0xb3d4('0x1c')]],'as':_0x5482a4['as'],'attributes':_0x5482a4[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x552da8){logger['info'](_0xb3d4('0x15'),_0x1676a5);logger[_0xb3d4('0x20')](_0xb3d4('0x15'),_0x1676a5,JSON['stringify'](_0x552da8));_0x233adc(_0x552da8);})['catch'](function(_0x4921c1){logger[_0xb3d4('0x11')](_0xb3d4('0x15'),_0x4921c1[_0xb3d4('0x13')],_0x1676a5);_0x5688d4(_0x270298['error'](0x1f4,_0x4921c1[_0xb3d4('0x13')]));});});};exports[_0xb3d4('0x21')]=function(_0x37cff4){var _0x5a3fe7=this;return new Promise(function(_0x447200,_0x98a5ff){return db['MemberReport'][_0xb3d4('0x22')](_0x37cff4['body'],{'raw':_0x37cff4['options']?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![]})[_0xb3d4('0x1f')](function(_0x3204f1){logger[_0xb3d4('0xc')](_0xb3d4('0x21'),_0x37cff4);logger[_0xb3d4('0x20')](_0xb3d4('0x21'),_0x37cff4,JSON[_0xb3d4('0x10')](_0x3204f1));_0x447200(_0x3204f1);})['catch'](function(_0x35ade5){logger[_0xb3d4('0x11')](_0xb3d4('0x21'),_0x35ade5['message'],_0x37cff4);_0x98a5ff(_0x5a3fe7[_0xb3d4('0x11')](0x1f4,_0x35ade5['message']));});});};exports['UpdateMemberReport']=function(_0x56da7d){var _0x45c8ab=this;return new Promise(function(_0x359084,_0x58ae1d){return db[_0xb3d4('0x16')]['update'](_0x56da7d[_0xb3d4('0x23')],{'raw':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d['options'][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x24')]||null:null,'attributes':_0x56da7d['options']?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x1e')]||null:null,'limit':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x1a')]||null:null})[_0xb3d4('0x1f')](function(_0x265574){logger['info']('UpdateMemberReport',_0x56da7d);logger[_0xb3d4('0x20')]('UpdateMemberReport',_0x56da7d,JSON[_0xb3d4('0x10')](_0x265574));_0x359084(_0x265574);})[_0xb3d4('0x25')](function(_0x5e5b95){logger[_0xb3d4('0x11')](_0xb3d4('0x26'),_0x5e5b95['message'],_0x56da7d);_0x58ae1d(_0x45c8ab[_0xb3d4('0x11')](0x1f4,_0x5e5b95[_0xb3d4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 63b4e1d..7640934 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 _0x074b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','multer','util','path'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x074b,0x195));var _0xb074=function(_0x239a1d,_0x22b168){_0x239a1d=_0x239a1d-0x0;var _0x3b1d66=_0x074b[_0x239a1d];return _0x3b1d66;};'use strict';var multer=require(_0xb074('0x0'));var util=require(_0xb074('0x1'));var path=require(_0xb074('0x2'));var timeout=require(_0xb074('0x3'));var express=require(_0xb074('0x4'));var router=express[_0xb074('0x5')]();var fs_extra=require(_0xb074('0x6'));var auth=require(_0xb074('0x7'));var interaction=require(_0xb074('0x8'));var config=require(_0xb074('0x9'));var controller=require('./migration.controller');router[_0xb074('0xa')]('/',controller[_0xb074('0xb')]);module['exports']=router; \ No newline at end of file +var _0xb63f=['fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','connect-timeout','express','Router'];(function(_0x53f118,_0x5e5740){var _0x3b4087=function(_0x48eca6){while(--_0x48eca6){_0x53f118['push'](_0x53f118['shift']());}};_0x3b4087(++_0x5e5740);}(_0xb63f,0x193));var _0xfb63=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xb63f[_0xd22d95];return _0x15d7a3;};'use strict';var multer=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var path=require('path');var timeout=require(_0xfb63('0x2'));var express=require(_0xfb63('0x3'));var router=express[_0xfb63('0x4')]();var fs_extra=require(_0xfb63('0x5'));var auth=require(_0xfb63('0x6'));var interaction=require(_0xfb63('0x7'));var config=require('../../config/environment');var controller=require(_0xfb63('0x8'));router[_0xfb63('0x9')]('/',controller[_0xfb63('0xa')]);module[_0xfb63('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e7a577b..1f45f1b 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 _0xd638=['exports','version','sequelize'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xd638,0x182));var _0x8d63=function(_0x4b92f4,_0x32a49a){_0x4b92f4=_0x4b92f4-0x0;var _0x4b2ca2=_0xd638[_0x4b92f4];return _0x4b2ca2;};'use strict';var Sequelize=require(_0x8d63('0x0'));module[_0x8d63('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x8d63('0x2')}}; \ No newline at end of file +var _0x2e0a=['STRING','version','sequelize'];(function(_0x14b01a,_0x47a80b){var _0x52b34f=function(_0x6dcc72){while(--_0x6dcc72){_0x14b01a['push'](_0x14b01a['shift']());}};_0x52b34f(++_0x47a80b);}(_0x2e0a,0x122));var _0xa2e0=function(_0x37c394,_0x53536a){_0x37c394=_0x37c394-0x0;var _0x1fb3f7=_0x2e0a[_0x37c394];return _0x1fb3f7;};'use strict';var Sequelize=require(_0xa2e0('0x0'));module['exports']={'version':{'type':Sequelize[_0xa2e0('0x1')],'unique':_0xa2e0('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index cbdd90a..e34de24 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 _0x00e0=['model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','then','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','destroy','error','stack','name','send','index','map','Migration','fieldName','type','key'];(function(_0x36d2e1,_0x25f327){var _0x28ddf6=function(_0x372d2e){while(--_0x372d2e){_0x36d2e1['push'](_0x36d2e1['shift']());}};_0x28ddf6(++_0x25f327);}(_0x00e0,0x1e3));var _0x000e=function(_0x3258d8,_0x5293f9){_0x3258d8=_0x3258d8-0x0;var _0x322163=_0x00e0[_0x3258d8];return _0x322163;};'use strict';var emlformat=require(_0x000e('0x0'));var rimraf=require(_0x000e('0x1'));var zipdir=require(_0x000e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x000e('0x3'));var moment=require('moment');var BPromise=require(_0x000e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x000e('0x5'));var ejs=require(_0x000e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x000e('0x7'));var squel=require(_0x000e('0x8'));var crypto=require(_0x000e('0x9'));var jsforce=require(_0x000e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x000e('0x5'));var querystring=require('querystring');var Papa=require(_0x000e('0xb'));var Redis=require(_0x000e('0xc'));var authService=require(_0x000e('0xd'));var qs=require(_0x000e('0xe'));var as=require(_0x000e('0xf'));var hardwareService=require(_0x000e('0x10'));var logger=require(_0x000e('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40beb0,_0x302012){_0x302012=_0x302012||0xcc;return function(_0x2081a4){if(_0x2081a4){return _0x40beb0[_0x000e('0x12')](_0x302012);}return _0x40beb0[_0x000e('0x13')](_0x302012)[_0x000e('0x14')]();};}function respondWithResult(_0x2f853,_0x3f55b4){_0x3f55b4=_0x3f55b4||0xc8;return function(_0xe126bc){if(_0xe126bc){return _0x2f853[_0x000e('0x13')](_0x3f55b4)[_0x000e('0x15')](_0xe126bc);}};}function respondWithFilteredResult(_0xe0cfa0,_0x111963){return function(_0x272d99){if(_0x272d99){var _0x2960b7=typeof _0x111963[_0x000e('0x16')]===_0x000e('0x17')&&typeof _0x111963[_0x000e('0x18')]==='undefined';var _0xc74b0a=_0x272d99[_0x000e('0x19')];var _0x108150=_0x2960b7?0x0:_0x111963['offset'];var _0x579b61=_0x2960b7?_0x272d99[_0x000e('0x19')]:_0x111963[_0x000e('0x16')]+_0x111963[_0x000e('0x18')];var _0x53b452;if(_0x579b61>=_0xc74b0a){_0x579b61=_0xc74b0a;_0x53b452=0xc8;}else{_0x53b452=0xce;}_0xe0cfa0['status'](_0x53b452);return _0xe0cfa0['set'](_0x000e('0x1a'),_0x108150+'-'+_0x579b61+'/'+_0xc74b0a)[_0x000e('0x15')](_0x272d99);}return null;};}function patchUpdates(_0x212db7){return function(_0x4351a6){try{jsonpatch['apply'](_0x4351a6,_0x212db7,!![]);}catch(_0x4eb5f2){return BPromise['reject'](_0x4eb5f2);}return _0x4351a6[_0x000e('0x1b')]();};}function saveUpdates(_0x883fb3,_0x4565b6){return function(_0x4fa062){if(_0x4fa062){return _0x4fa062['update'](_0x883fb3)['then'](function(_0x291e10){return _0x291e10;});}return null;};}function removeEntity(_0x4c1564,_0x2eb42b){return function(_0x12ffb6){if(_0x12ffb6){return _0x12ffb6[_0x000e('0x1c')]()['then'](function(){_0x4c1564[_0x000e('0x13')](0xcc)[_0x000e('0x14')]();});}};}function handleEntityNotFound(_0x55e076,_0xdf0cb9){return function(_0x56ba85){if(!_0x56ba85){_0x55e076['sendStatus'](0x194);}return _0x56ba85;};}function handleError(_0x1c5855,_0x474946){_0x474946=_0x474946||0x1f4;return function(_0x56efb3){logger[_0x000e('0x1d')](_0x56efb3[_0x000e('0x1e')]);if(_0x56efb3[_0x000e('0x1f')]){delete _0x56efb3[_0x000e('0x1f')];}_0x1c5855[_0x000e('0x13')](_0x474946)[_0x000e('0x20')](_0x56efb3);};}exports[_0x000e('0x21')]=function(_0x5df1f5,_0x4dd4d5){var _0x5cb6ef={},_0x3834fb={},_0xa5d011={'count':0x0,'rows':[]};var _0x34ae9d=_[_0x000e('0x22')](db[_0x000e('0x23')]['rawAttributes'],function(_0x1749d8){return{'name':_0x1749d8[_0x000e('0x24')],'type':_0x1749d8[_0x000e('0x25')][_0x000e('0x26')]};});_0x3834fb[_0x000e('0x27')]=_[_0x000e('0x22')](_0x34ae9d,_0x000e('0x1f'));_0x3834fb[_0x000e('0x28')]=_['keys'](_0x5df1f5['query']);_0x3834fb['filters']=_['intersection'](_0x3834fb['model'],_0x3834fb[_0x000e('0x28')]);_0x5cb6ef['attributes']=_[_0x000e('0x29')](_0x3834fb[_0x000e('0x27')],qs['fields'](_0x5df1f5[_0x000e('0x28')][_0x000e('0x2a')]));_0x5cb6ef[_0x000e('0x2b')]=_0x5cb6ef['attributes'][_0x000e('0x2c')]?_0x5cb6ef[_0x000e('0x2b')]:_0x3834fb['model'];if(!_0x5df1f5['query']['hasOwnProperty'](_0x000e('0x2d'))){_0x5cb6ef[_0x000e('0x18')]=qs['limit'](_0x5df1f5[_0x000e('0x28')][_0x000e('0x18')]);_0x5cb6ef[_0x000e('0x16')]=qs[_0x000e('0x16')](_0x5df1f5[_0x000e('0x28')]['offset']);}_0x5cb6ef[_0x000e('0x2e')]=qs[_0x000e('0x2f')](_0x5df1f5['query'][_0x000e('0x2f')]);_0x5cb6ef[_0x000e('0x30')]=qs[_0x000e('0x31')](_[_0x000e('0x32')](_0x5df1f5[_0x000e('0x28')],_0x3834fb[_0x000e('0x31')]),_0x34ae9d);if(_0x5df1f5[_0x000e('0x28')]['filter']){_0x5cb6ef[_0x000e('0x30')]=_[_0x000e('0x33')](_0x5cb6ef[_0x000e('0x30')],{'$or':_[_0x000e('0x22')](_0x34ae9d,function(_0x21e783){if(_0x21e783[_0x000e('0x25')]!=='VIRTUAL'){var _0x442365={};_0x442365[_0x21e783[_0x000e('0x1f')]]={'$like':'%'+_0x5df1f5[_0x000e('0x28')][_0x000e('0x34')]+'%'};return _0x442365;}})});}_0x5cb6ef=_[_0x000e('0x33')]({},_0x5cb6ef,_0x5df1f5['options']);var _0x9c088d={'where':_0x5cb6ef['where']};return db[_0x000e('0x23')][_0x000e('0x19')](_0x9c088d)[_0x000e('0x35')](function(_0x3f2ad4){_0xa5d011[_0x000e('0x19')]=_0x3f2ad4;if(_0x5df1f5['query'][_0x000e('0x36')]){_0x5cb6ef[_0x000e('0x37')]=[{'all':!![]}];}return db[_0x000e('0x23')][_0x000e('0x38')](_0x5cb6ef);})[_0x000e('0x35')](function(_0x375012){_0xa5d011['rows']=_0x375012;return _0xa5d011;})['then'](respondWithFilteredResult(_0x4dd4d5,_0x5cb6ef))[_0x000e('0x39')](handleError(_0x4dd4d5,null));}; \ No newline at end of file +var _0x75bc=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5631b9,_0x3c43f2){var _0x37b9ea=function(_0x446465){while(--_0x446465){_0x5631b9['push'](_0x5631b9['shift']());}};_0x37b9ea(++_0x3c43f2);}(_0x75bc,0x10f));var _0xc75b=function(_0x58805e,_0x427435){_0x58805e=_0x58805e-0x0;var _0x35e220=_0x75bc[_0x58805e];return _0x35e220;};'use strict';var emlformat=require(_0xc75b('0x0'));var rimraf=require(_0xc75b('0x1'));var zipdir=require(_0xc75b('0x2'));var jsonpatch=require(_0xc75b('0x3'));var rp=require(_0xc75b('0x4'));var moment=require(_0xc75b('0x5'));var BPromise=require(_0xc75b('0x6'));var Mustache=require(_0xc75b('0x7'));var util=require(_0xc75b('0x8'));var path=require(_0xc75b('0x9'));var sox=require(_0xc75b('0xa'));var csv=require(_0xc75b('0xb'));var ejs=require(_0xc75b('0xc'));var fs=require('fs');var fs_extra=require(_0xc75b('0xd'));var _=require(_0xc75b('0xe'));var squel=require(_0xc75b('0xf'));var crypto=require(_0xc75b('0x10'));var jsforce=require(_0xc75b('0x11'));var deskjs=require(_0xc75b('0x12'));var toCsv=require(_0xc75b('0xb'));var querystring=require(_0xc75b('0x13'));var Papa=require('papaparse');var Redis=require(_0xc75b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc75b('0x15'));var as=require(_0xc75b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc75b('0x17'));var utils=require('../../config/utils');var config=require(_0xc75b('0x18'));var licenseUtil=require(_0xc75b('0x19'));var db=require(_0xc75b('0x1a'))['db'];function respondWithStatusCode(_0x43e22e,_0x32921e){_0x32921e=_0x32921e||0xcc;return function(_0x8cf925){if(_0x8cf925){return _0x43e22e[_0xc75b('0x1b')](_0x32921e);}return _0x43e22e[_0xc75b('0x1c')](_0x32921e)[_0xc75b('0x1d')]();};}function respondWithResult(_0xcdc8fb,_0xdea2c){_0xdea2c=_0xdea2c||0xc8;return function(_0x453e0a){if(_0x453e0a){return _0xcdc8fb[_0xc75b('0x1c')](_0xdea2c)['json'](_0x453e0a);}};}function respondWithFilteredResult(_0x352684,_0x4a0eae){return function(_0x556f4c){if(_0x556f4c){var _0x21bfb6=typeof _0x4a0eae[_0xc75b('0x1e')]===_0xc75b('0x1f')&&typeof _0x4a0eae['limit']==='undefined';var _0x360d8b=_0x556f4c[_0xc75b('0x20')];var _0x3c6f1d=_0x21bfb6?0x0:_0x4a0eae[_0xc75b('0x1e')];var _0x43c547=_0x21bfb6?_0x556f4c['count']:_0x4a0eae[_0xc75b('0x1e')]+_0x4a0eae[_0xc75b('0x21')];var _0x2fe7a6;if(_0x43c547>=_0x360d8b){_0x43c547=_0x360d8b;_0x2fe7a6=0xc8;}else{_0x2fe7a6=0xce;}_0x352684['status'](_0x2fe7a6);return _0x352684[_0xc75b('0x22')](_0xc75b('0x23'),_0x3c6f1d+'-'+_0x43c547+'/'+_0x360d8b)[_0xc75b('0x24')](_0x556f4c);}return null;};}function patchUpdates(_0x141b19){return function(_0x494880){try{jsonpatch[_0xc75b('0x25')](_0x494880,_0x141b19,!![]);}catch(_0x1ba9cd){return BPromise[_0xc75b('0x26')](_0x1ba9cd);}return _0x494880[_0xc75b('0x27')]();};}function saveUpdates(_0x1960fa,_0x4bfc45){return function(_0x4777d8){if(_0x4777d8){return _0x4777d8[_0xc75b('0x28')](_0x1960fa)['then'](function(_0x50108e){return _0x50108e;});}return null;};}function removeEntity(_0x9dcc5c,_0x11d202){return function(_0x940da8){if(_0x940da8){return _0x940da8[_0xc75b('0x29')]()[_0xc75b('0x2a')](function(){_0x9dcc5c['status'](0xcc)[_0xc75b('0x1d')]();});}};}function handleEntityNotFound(_0x2b40d6,_0x2fa6a8){return function(_0x1dac54){if(!_0x1dac54){_0x2b40d6[_0xc75b('0x1b')](0x194);}return _0x1dac54;};}function handleError(_0x404b4e,_0x375aa5){_0x375aa5=_0x375aa5||0x1f4;return function(_0x5ea0ed){logger[_0xc75b('0x2b')](_0x5ea0ed[_0xc75b('0x2c')]);if(_0x5ea0ed[_0xc75b('0x2d')]){delete _0x5ea0ed[_0xc75b('0x2d')];}_0x404b4e[_0xc75b('0x1c')](_0x375aa5)[_0xc75b('0x2e')](_0x5ea0ed);};}exports[_0xc75b('0x2f')]=function(_0x5ee7b4,_0x3da2fb){var _0xaea4ff={},_0x3bacb1={},_0x22f87b={'count':0x0,'rows':[]};var _0x15d5c2=_[_0xc75b('0x30')](db[_0xc75b('0x31')][_0xc75b('0x32')],function(_0x294ef4){return{'name':_0x294ef4[_0xc75b('0x33')],'type':_0x294ef4[_0xc75b('0x34')][_0xc75b('0x35')]};});_0x3bacb1[_0xc75b('0x36')]=_[_0xc75b('0x30')](_0x15d5c2,_0xc75b('0x2d'));_0x3bacb1[_0xc75b('0x37')]=_[_0xc75b('0x38')](_0x5ee7b4['query']);_0x3bacb1[_0xc75b('0x39')]=_[_0xc75b('0x3a')](_0x3bacb1[_0xc75b('0x36')],_0x3bacb1[_0xc75b('0x37')]);_0xaea4ff[_0xc75b('0x3b')]=_[_0xc75b('0x3a')](_0x3bacb1[_0xc75b('0x36')],qs[_0xc75b('0x3c')](_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x3c')]));_0xaea4ff[_0xc75b('0x3b')]=_0xaea4ff[_0xc75b('0x3b')][_0xc75b('0x3d')]?_0xaea4ff[_0xc75b('0x3b')]:_0x3bacb1['model'];if(!_0x5ee7b4['query']['hasOwnProperty']('nolimit')){_0xaea4ff[_0xc75b('0x21')]=qs['limit'](_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x21')]);_0xaea4ff[_0xc75b('0x1e')]=qs[_0xc75b('0x1e')](_0x5ee7b4['query'][_0xc75b('0x1e')]);}_0xaea4ff[_0xc75b('0x3e')]=qs['sort'](_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x3f')]);_0xaea4ff['where']=qs['filters'](_[_0xc75b('0x40')](_0x5ee7b4[_0xc75b('0x37')],_0x3bacb1[_0xc75b('0x39')]),_0x15d5c2);if(_0x5ee7b4[_0xc75b('0x37')]['filter']){_0xaea4ff['where']=_['merge'](_0xaea4ff[_0xc75b('0x41')],{'$or':_[_0xc75b('0x30')](_0x15d5c2,function(_0x6a0496){if(_0x6a0496[_0xc75b('0x34')]!==_0xc75b('0x42')){var _0x1b547a={};_0x1b547a[_0x6a0496[_0xc75b('0x2d')]]={'$like':'%'+_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x43')]+'%'};return _0x1b547a;}})});}_0xaea4ff=_[_0xc75b('0x44')]({},_0xaea4ff,_0x5ee7b4['options']);var _0x415cce={'where':_0xaea4ff[_0xc75b('0x41')]};return db[_0xc75b('0x31')][_0xc75b('0x20')](_0x415cce)['then'](function(_0x194005){_0x22f87b[_0xc75b('0x20')]=_0x194005;if(_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x45')]){_0xaea4ff[_0xc75b('0x46')]=[{'all':!![]}];}return db[_0xc75b('0x31')]['findAll'](_0xaea4ff);})['then'](function(_0x2a2480){_0x22f87b[_0xc75b('0x47')]=_0x2a2480;return _0x22f87b;})[_0xc75b('0x2a')](respondWithFilteredResult(_0x3da2fb,_0xaea4ff))[_0xc75b('0x48')](handleError(_0x3da2fb,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9b444bb..03913b0 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 _0xee3d=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','./migration.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xee3d,0x16c));var _0xdee3=function(_0x41f03c,_0x665763){_0x41f03c=_0x41f03c-0x0;var _0x2a06aa=_0xee3d[_0x41f03c];return _0x2a06aa;};'use strict';var _=require(_0xdee3('0x0'));var util=require(_0xdee3('0x1'));var logger=require(_0xdee3('0x2'))(_0xdee3('0x3'));var moment=require(_0xdee3('0x4'));var BPromise=require('bluebird');var rp=require(_0xdee3('0x5'));var fs=require('fs');var path=require(_0xdee3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdee3('0x7'));module[_0xdee3('0x8')]=function(_0x243480,_0x25b6c4){return _0x243480[_0xdee3('0x9')](_0xdee3('0xa'),attributes,{'tableName':_0xdee3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90f0=['migrations','lodash','util','api','moment','request-promise','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0x378d37,_0x21b6f2){var _0x42a8cf=function(_0xcf4d8c){while(--_0xcf4d8c){_0x378d37['push'](_0x378d37['shift']());}};_0x42a8cf(++_0x21b6f2);}(_0x90f0,0x79));var _0x090f=function(_0x1fd563,_0x196466){_0x1fd563=_0x1fd563-0x0;var _0x4673f3=_0x90f0[_0x1fd563];return _0x4673f3;};'use strict';var _=require(_0x090f('0x0'));var util=require(_0x090f('0x1'));var logger=require('../../config/logger')(_0x090f('0x2'));var moment=require(_0x090f('0x3'));var BPromise=require('bluebird');var rp=require(_0x090f('0x4'));var fs=require('fs');var path=require(_0x090f('0x5'));var rimraf=require(_0x090f('0x6'));var config=require('../../config/environment');var attributes=require(_0x090f('0x7'));module[_0x090f('0x8')]=function(_0x4c908c,_0x16e91d){return _0x4c908c[_0x090f('0x9')](_0x090f('0xa'),attributes,{'tableName':_0x090f('0xb'),'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 5b20c1b..c4f4dc4 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 _0x3ae9=['then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x50f1c5,_0x564b0d){var _0x302741=function(_0x49f3fd){while(--_0x49f3fd){_0x50f1c5['push'](_0x50f1c5['shift']());}};_0x302741(++_0x564b0d);}(_0x3ae9,0xdb));var _0x93ae=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x3ae9[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93ae('0x0'));var BPromise=require(_0x93ae('0x1'));var rs=require(_0x93ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93ae('0x3'))['db'];var utils=require(_0x93ae('0x4'));var logger=require(_0x93ae('0x5'))(_0x93ae('0x6'));var config=require('../../config/environment');var jayson=require(_0x93ae('0x7'));var client=jayson['client'][_0x93ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32564c,_0x2a0972,_0x36e141){return new BPromise(function(_0x22761c,_0x354bf9){return client['request'](_0x32564c,_0x36e141)[_0x93ae('0x9')](function(_0x4ac4b0){logger['info']('Migration,\x20%s,\x20%s',_0x2a0972,_0x93ae('0xa'));logger[_0x93ae('0xb')](_0x93ae('0xc'),_0x2a0972,_0x93ae('0xa'),JSON[_0x93ae('0xd')](_0x4ac4b0));if(_0x4ac4b0[_0x93ae('0xe')]){if(_0x4ac4b0['error']['code']===0x1f4){logger[_0x93ae('0xe')](_0x93ae('0xf'),_0x2a0972,_0x4ac4b0['error']['message']);return _0x354bf9(_0x4ac4b0[_0x93ae('0xe')]['message']);}logger[_0x93ae('0xe')](_0x93ae('0xf'),_0x2a0972,_0x4ac4b0['error'][_0x93ae('0x10')]);return _0x22761c(_0x4ac4b0[_0x93ae('0xe')][_0x93ae('0x10')]);}else{logger[_0x93ae('0x11')](_0x93ae('0xf'),_0x2a0972,_0x93ae('0xa'));_0x22761c(_0x4ac4b0['result'][_0x93ae('0x10')]);}})[_0x93ae('0x12')](function(_0x129e44){logger['error'](_0x93ae('0xf'),_0x2a0972,_0x129e44);_0x354bf9(_0x129e44);});});} \ No newline at end of file +var _0x7794=['randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7794,0x7b));var _0x4779=function(_0x1c6416,_0x2431f3){_0x1c6416=_0x1c6416-0x0;var _0x49ebb3=_0x7794[_0x1c6416];return _0x49ebb3;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('Migration,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 199e9f4..73e89ed 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 _0xdc9e=['destroy','util','path','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0xdc9e,0x76));var _0xedc9=function(_0x1b8fdd,_0x11a782){_0x1b8fdd=_0x1b8fdd-0x0;var _0x129768=_0xdc9e[_0x1b8fdd];return _0x129768;};'use strict';var multer=require('multer');var util=require(_0xedc9('0x0'));var path=require(_0xedc9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xedc9('0x2')]();var fs_extra=require(_0xedc9('0x3'));var auth=require(_0xedc9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xedc9('0x5'));router[_0xedc9('0x6')]('/',auth[_0xedc9('0x7')](),controller['index']);router[_0xedc9('0x6')](_0xedc9('0x8'),auth[_0xedc9('0x7')](),controller[_0xedc9('0x9')]);router[_0xedc9('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xedc9('0xb')](_0xedc9('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xedc9('0x8'),auth[_0xedc9('0x7')](),controller[_0xedc9('0xc')]);module['exports']=router; \ No newline at end of file +var _0x6050=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','post','isAuthenticated','create'];(function(_0x4470dc,_0x277b43){var _0x2105ff=function(_0x3f7ffc){while(--_0x3f7ffc){_0x4470dc['push'](_0x4470dc['shift']());}};_0x2105ff(++_0x277b43);}(_0x6050,0x196));var _0x0605=function(_0x55bccc,_0x1e258f){_0x55bccc=_0x55bccc-0x0;var _0x5a18d2=_0x6050[_0x55bccc];return _0x5a18d2;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')]('/',auth[_0x0605('0xc')](),controller[_0x0605('0xd')]);router[_0x0605('0xe')]('/:id',auth[_0x0605('0xc')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xc')](),controller[_0x0605('0x12')]);module[_0x0605('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c2adcea..9be69c8 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 _0x34f2=['stun','turn','STRING','localnet'];(function(_0x33ed4f,_0x5e60e2){var _0x2f3c31=function(_0x5ec8df){while(--_0x5ec8df){_0x33ed4f['push'](_0x33ed4f['shift']());}};_0x2f3c31(++_0x5e60e2);}(_0x34f2,0xc3));var _0x234f=function(_0xd5ab14,_0x21f2f4){_0xd5ab14=_0xd5ab14-0x0;var _0xb53b4c=_0x34f2[_0xd5ab14];return _0xb53b4c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x234f('0x0'),'externip',_0x234f('0x1'),_0x234f('0x2'))},'value':{'type':Sequelize[_0x234f('0x3')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x234f('0x3')]}}; \ No newline at end of file +var _0xa74b=['turn','STRING','sequelize','exports','ENUM','localnet','stun'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa74b,0x1a6));var _0xba74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa74b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xba74('0x0'));module[_0xba74('0x1')]={'type':{'type':Sequelize[_0xba74('0x2')](_0xba74('0x3'),'externip',_0xba74('0x4'),_0xba74('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xba74('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f7b10f0..146c52b 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 _0xab81=['sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Network','includeAll','findAll','rows','show','params','fields','include','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','TURN','format','destroy','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','request\x20sent','debug','error','code','Network,\x20%s,\x20%s','message','info','catch','status','offset','limit','undefined','count','Content-Range','update','end'];(function(_0x2ba66e,_0x5a390d){var _0x48584b=function(_0x2e92e9){while(--_0x2e92e9){_0x2ba66e['push'](_0x2ba66e['shift']());}};_0x48584b(++_0x5a390d);}(_0xab81,0x130));var _0x1ab8=function(_0x4f71dd,_0x59bf3c){_0x4f71dd=_0x4f71dd-0x0;var _0x524aa9=_0xab81[_0x4f71dd];return _0x524aa9;};'use strict';var util=require('util');var path=require(_0x1ab8('0x0'));var ejs=require(_0x1ab8('0x1'));var fs=require('fs');var _=require(_0x1ab8('0x2'));var qs=require(_0x1ab8('0x3'));var logger=require(_0x1ab8('0x4'))(_0x1ab8('0x5'));var config=require(_0x1ab8('0x6'));var db=require(_0x1ab8('0x7'))['db'];var jayson=require(_0x1ab8('0x8'));var client=jayson[_0x1ab8('0x9')][_0x1ab8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x401555,_0x35e8fd,_0x1e49b0,_0x3b57b9){return new Promise(function(_0x37e15e,_0x56b22f){var _0x5f364b=_0x3b57b9||client;return _0x5f364b['request'](_0x401555,_0x1e49b0)[_0x1ab8('0xb')](function(_0x5ba543){logger['info']('Network,\x20%s,\x20%s',_0x35e8fd,_0x1ab8('0xc'));logger[_0x1ab8('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x35e8fd,'request\x20sent',JSON['stringify'](_0x5ba543));if(_0x5ba543[_0x1ab8('0xe')]){if(_0x5ba543['error'][_0x1ab8('0xf')]===0x1f4){logger['error'](_0x1ab8('0x10'),_0x35e8fd,_0x5ba543['error'][_0x1ab8('0x11')]);return _0x56b22f(_0x5ba543['error'][_0x1ab8('0x11')]);}logger[_0x1ab8('0xe')](_0x1ab8('0x10'),_0x35e8fd,_0x5ba543[_0x1ab8('0xe')]['message']);return _0x37e15e(_0x5ba543[_0x1ab8('0xe')][_0x1ab8('0x11')]);}else{logger[_0x1ab8('0x12')]('Network,\x20%s,\x20%s',_0x35e8fd,'request\x20sent');_0x37e15e(_0x5ba543['result']['message']);}})[_0x1ab8('0x13')](function(_0x1db53b){logger[_0x1ab8('0xe')](_0x1ab8('0x10'),_0x35e8fd,_0x1db53b);_0x56b22f(_0x1db53b);});});}function respondWithResult(_0x59ecce,_0xdfa1d7){_0xdfa1d7=_0xdfa1d7||0xc8;return function(_0x4ee746){if(_0x4ee746){return _0x59ecce[_0x1ab8('0x14')](_0xdfa1d7)['json'](_0x4ee746);}};}function respondWithFilteredResult(_0x4a41e3,_0x4f4cd5){return function(_0x272c43){if(_0x272c43){var _0x10822f=typeof _0x4f4cd5[_0x1ab8('0x15')]==='undefined'&&typeof _0x4f4cd5[_0x1ab8('0x16')]===_0x1ab8('0x17');var _0x3a165a=_0x272c43['count'];var _0x487e6a=_0x10822f?0x0:_0x4f4cd5[_0x1ab8('0x15')];var _0x4c3f59=_0x10822f?_0x272c43[_0x1ab8('0x18')]:_0x4f4cd5[_0x1ab8('0x15')]+_0x4f4cd5[_0x1ab8('0x16')];var _0x46c44d;if(_0x4c3f59>=_0x3a165a){_0x4c3f59=_0x3a165a;_0x46c44d=0xc8;}else{_0x46c44d=0xce;}_0x4a41e3['status'](_0x46c44d);return _0x4a41e3['set'](_0x1ab8('0x19'),_0x487e6a+'-'+_0x4c3f59+'/'+_0x3a165a)['json'](_0x272c43);}return null;};}function saveUpdates(_0x5e7d43){return function(_0x2d438d){if(_0x2d438d){return _0x2d438d[_0x1ab8('0x1a')](_0x5e7d43)[_0x1ab8('0xb')](function(_0x37ac36){return _0x37ac36;});}return null;};}function removeEntity(_0x3c0681){return function(_0x3e2333){if(_0x3e2333){return _0x3e2333['destroy']()['then'](function(){_0x3c0681[_0x1ab8('0x14')](0xcc)[_0x1ab8('0x1b')]();});}};}function handleEntityNotFound(_0x355608){return function(_0x533fc4){if(!_0x533fc4){_0x355608[_0x1ab8('0x1c')](0x194);}return _0x533fc4;};}function handleError(_0x4e95df,_0x3acea8){_0x3acea8=_0x3acea8||0x1f4;return function(_0x4bc4bf){logger[_0x1ab8('0xe')](_0x4bc4bf[_0x1ab8('0x1d')]);if(_0x4bc4bf[_0x1ab8('0x1e')]){delete _0x4bc4bf[_0x1ab8('0x1e')];}_0x4e95df[_0x1ab8('0x14')](_0x3acea8)['send'](_0x4bc4bf);};}exports[_0x1ab8('0x1f')]=function(_0x4d35ff,_0x3e00b6){var _0x246a3d={},_0x363239={},_0x3a9794={'count':0x0,'rows':[]};var _0x1c0f10=_[_0x1ab8('0x20')](db['Network'][_0x1ab8('0x21')],function(_0x3ae918){return{'name':_0x3ae918['fieldName'],'type':_0x3ae918[_0x1ab8('0x22')][_0x1ab8('0x23')]};});_0x363239[_0x1ab8('0x24')]=_[_0x1ab8('0x20')](_0x1c0f10,_0x1ab8('0x1e'));_0x363239[_0x1ab8('0x25')]=_[_0x1ab8('0x26')](_0x4d35ff[_0x1ab8('0x25')]);_0x363239[_0x1ab8('0x27')]=_[_0x1ab8('0x28')](_0x363239[_0x1ab8('0x24')],_0x363239[_0x1ab8('0x25')]);_0x246a3d[_0x1ab8('0x29')]=_['intersection'](_0x363239[_0x1ab8('0x24')],qs['fields'](_0x4d35ff[_0x1ab8('0x25')]['fields']));_0x246a3d['attributes']=_0x246a3d['attributes'][_0x1ab8('0x2a')]?_0x246a3d[_0x1ab8('0x29')]:_0x363239[_0x1ab8('0x24')];if(!_0x4d35ff[_0x1ab8('0x25')][_0x1ab8('0x2b')](_0x1ab8('0x2c'))){_0x246a3d[_0x1ab8('0x16')]=qs['limit'](_0x4d35ff[_0x1ab8('0x25')][_0x1ab8('0x16')]);_0x246a3d[_0x1ab8('0x15')]=qs[_0x1ab8('0x15')](_0x4d35ff['query'][_0x1ab8('0x15')]);}_0x246a3d[_0x1ab8('0x2d')]=qs[_0x1ab8('0x2e')](_0x4d35ff[_0x1ab8('0x25')][_0x1ab8('0x2e')]);_0x246a3d[_0x1ab8('0x2f')]=qs[_0x1ab8('0x27')](_[_0x1ab8('0x30')](_0x4d35ff['query'],_0x363239[_0x1ab8('0x27')]),_0x1c0f10);if(_0x4d35ff[_0x1ab8('0x25')][_0x1ab8('0x31')]){_0x246a3d[_0x1ab8('0x2f')]=_[_0x1ab8('0x32')](_0x246a3d[_0x1ab8('0x2f')],{'$or':_['map'](_0x1c0f10,function(_0xed966b){if(_0xed966b[_0x1ab8('0x22')]!=='VIRTUAL'){var _0x2b6839={};_0x2b6839[_0xed966b[_0x1ab8('0x1e')]]={'$like':'%'+_0x4d35ff['query'][_0x1ab8('0x31')]+'%'};return _0x2b6839;}})});}_0x246a3d=_[_0x1ab8('0x32')]({},_0x246a3d,_0x4d35ff[_0x1ab8('0x33')]);var _0x1e0cfd={'where':_0x246a3d[_0x1ab8('0x2f')]};return db[_0x1ab8('0x34')][_0x1ab8('0x18')](_0x1e0cfd)[_0x1ab8('0xb')](function(_0x29ada4){_0x3a9794[_0x1ab8('0x18')]=_0x29ada4;if(_0x4d35ff[_0x1ab8('0x25')][_0x1ab8('0x35')]){_0x246a3d['include']=[{'all':!![]}];}return db[_0x1ab8('0x34')][_0x1ab8('0x36')](_0x246a3d);})[_0x1ab8('0xb')](function(_0x57f4a3){_0x3a9794[_0x1ab8('0x37')]=_0x57f4a3;return _0x3a9794;})['then'](respondWithFilteredResult(_0x3e00b6,_0x246a3d))[_0x1ab8('0x13')](handleError(_0x3e00b6,null));};exports[_0x1ab8('0x38')]=function(_0xa5ebf1,_0x33c7b1){var _0x5557e1={'raw':!![],'where':{'id':_0xa5ebf1[_0x1ab8('0x39')]['id']}},_0x27f599={};_0x27f599['model']=_[_0x1ab8('0x26')](db[_0x1ab8('0x34')]['rawAttributes']);_0x27f599[_0x1ab8('0x25')]=_[_0x1ab8('0x26')](_0xa5ebf1[_0x1ab8('0x25')]);_0x27f599[_0x1ab8('0x27')]=_[_0x1ab8('0x28')](_0x27f599[_0x1ab8('0x24')],_0x27f599['query']);_0x5557e1[_0x1ab8('0x29')]=_['intersection'](_0x27f599[_0x1ab8('0x24')],qs[_0x1ab8('0x3a')](_0xa5ebf1[_0x1ab8('0x25')][_0x1ab8('0x3a')]));_0x5557e1['attributes']=_0x5557e1[_0x1ab8('0x29')][_0x1ab8('0x2a')]?_0x5557e1[_0x1ab8('0x29')]:_0x27f599[_0x1ab8('0x24')];if(_0xa5ebf1['query']['includeAll']){_0x5557e1[_0x1ab8('0x3b')]=[{'all':!![]}];}_0x5557e1=_[_0x1ab8('0x32')]({},_0x5557e1,_0xa5ebf1['options']);return db[_0x1ab8('0x34')][_0x1ab8('0x3c')](_0x5557e1)[_0x1ab8('0xb')](handleEntityNotFound(_0x33c7b1,null))[_0x1ab8('0xb')](respondWithResult(_0x33c7b1,null))[_0x1ab8('0x13')](handleError(_0x33c7b1,null));};exports[_0x1ab8('0x3d')]=function(_0x35d64d,_0x27f5f4){var _0x50f9e;return db[_0x1ab8('0x34')][_0x1ab8('0x3d')](_0x35d64d[_0x1ab8('0x3e')],{'raw':!![]})[_0x1ab8('0xb')](function(_0x36264c){_0x50f9e=_0x36264c;return db[_0x1ab8('0x34')]['findAll']({'where':{'type':_0x35d64d[_0x1ab8('0x3e')]['type']},'raw':!![]});})[_0x1ab8('0xb')](function(_0x106846){if(_0x50f9e[_0x1ab8('0x22')][_0x1ab8('0x3f')]()==_0x1ab8('0x40')){var _0x2f2236=fs[_0x1ab8('0x41')](path[_0x1ab8('0x42')](config['root'],_0x1ab8('0x43')),'utf8');var _0x550862=ejs[_0x1ab8('0x44')](_0x2f2236,{'networks':_0x106846||[]});fs['writeFileSync'](_0x1ab8('0x45'),_0x550862);return respondWithRpcPromise(_0x1ab8('0x46'),_0x1ab8('0x3d'),{'module':_0x1ab8('0x47')});}else if(_0x50f9e['type']['toUpperCase']()=='TURN'){var _0x5d0765=fs[_0x1ab8('0x41')](path[_0x1ab8('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x1ab8('0x48'));var _0xf79df=ejs[_0x1ab8('0x44')](_0x5d0765,{'networks':_0x106846||[]});fs[_0x1ab8('0x49')](_0x1ab8('0x4a'),_0xf79df);return respondWithRpcPromise('Reload',_0x1ab8('0x3d'),{'module':_0x1ab8('0x47')});}else{var _0x27bd7a=fs[_0x1ab8('0x41')](path[_0x1ab8('0x42')](config[_0x1ab8('0x4b')],_0x1ab8('0x4c')),'utf8');var _0x361474=ejs[_0x1ab8('0x44')](_0x27bd7a,{'networks':_0x106846||[]});fs[_0x1ab8('0x49')](util['format'](_0x1ab8('0x4d'),_0x35d64d[_0x1ab8('0x3e')][_0x1ab8('0x22')][_0x1ab8('0x4e')]()),_0x361474);return respondWithRpcPromise(_0x1ab8('0x46'),'create',{'module':_0x1ab8('0x4f')});}})[_0x1ab8('0xb')](function(){return _0x50f9e;})['then'](respondWithResult(_0x27f5f4,0xc9))[_0x1ab8('0x13')](handleError(_0x27f5f4,null));};exports[_0x1ab8('0x1a')]=function(_0x160080,_0x3052b0){var _0x326389;return db[_0x1ab8('0x34')][_0x1ab8('0x3c')]({'where':{'id':_0x160080[_0x1ab8('0x39')]['id']}})[_0x1ab8('0xb')](handleEntityNotFound(_0x3052b0,null))['then'](saveUpdates(_0x160080['body'],null))[_0x1ab8('0xb')](function(_0x1ef88d){if(_0x1ef88d){_0x326389=_0x1ef88d;return db[_0x1ab8('0x34')][_0x1ab8('0x36')]({'where':{'type':_0x326389[_0x1ab8('0x22')]},'raw':!![]});}return null;})[_0x1ab8('0xb')](function(_0x38a8e7){if(_0x326389[_0x1ab8('0x22')][_0x1ab8('0x3f')]()=='STUN'){var _0x5e085e=fs[_0x1ab8('0x41')](path[_0x1ab8('0x42')](config[_0x1ab8('0x4b')],_0x1ab8('0x43')),'utf8');var _0x538975=ejs['render'](_0x5e085e,{'networks':_0x38a8e7||[]});fs[_0x1ab8('0x49')](_0x1ab8('0x45'),_0x538975);return respondWithRpcPromise(_0x1ab8('0x46'),_0x1ab8('0x1a'),{'module':_0x1ab8('0x47')});}else if(_0x326389['type'][_0x1ab8('0x3f')]()==_0x1ab8('0x50')){var _0x8b18e5=fs['readFileSync'](path[_0x1ab8('0x42')](config[_0x1ab8('0x4b')],'server/files/templates/turn_multiple.ejs'),_0x1ab8('0x48'));var _0x1db97c=ejs[_0x1ab8('0x44')](_0x8b18e5,{'networks':_0x38a8e7||[]});fs[_0x1ab8('0x49')]('/etc/asterisk/turn_xcally.conf',_0x1db97c);return respondWithRpcPromise(_0x1ab8('0x46'),_0x1ab8('0x1a'),{'module':_0x1ab8('0x47')});}else{var _0x885d31=fs[_0x1ab8('0x41')](path['join'](config['root'],_0x1ab8('0x4c')),'utf8');var _0x1a29e7=ejs[_0x1ab8('0x44')](_0x885d31,{'networks':_0x38a8e7||[]});fs[_0x1ab8('0x49')](util[_0x1ab8('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x160080[_0x1ab8('0x3e')]['type'][_0x1ab8('0x4e')]()),_0x1a29e7);return respondWithRpcPromise(_0x1ab8('0x46'),_0x1ab8('0x1a'),{'module':_0x1ab8('0x4f')});}})['then'](function(_0x4f8614){if(_0x4f8614){return _0x326389;}return null;})[_0x1ab8('0xb')](respondWithResult(_0x3052b0,null))[_0x1ab8('0x13')](handleError(_0x3052b0,null));};exports[_0x1ab8('0x52')]=function(_0x3ee72f,_0x30c01e){var _0x3bbb60;return db['Network'][_0x1ab8('0x3c')]({'where':{'id':_0x3ee72f[_0x1ab8('0x39')]['id']}})[_0x1ab8('0xb')](function(_0x5ab568){_0x3bbb60=_0x5ab568;return _0x5ab568;})[_0x1ab8('0xb')](handleEntityNotFound(_0x30c01e,null))[_0x1ab8('0xb')](removeEntity(_0x30c01e,null))[_0x1ab8('0xb')](function(){if(_0x3bbb60){return db[_0x1ab8('0x34')][_0x1ab8('0x36')]({'where':{'type':_0x3bbb60['type']},'raw':!![]});}})[_0x1ab8('0xb')](function(_0x28ffa2){if(_0x3bbb60[_0x1ab8('0x22')][_0x1ab8('0x3f')]()==_0x1ab8('0x40')){var _0x4bf669=fs[_0x1ab8('0x41')](path[_0x1ab8('0x42')](config[_0x1ab8('0x4b')],'server/files/templates/stun_multiple.ejs'),_0x1ab8('0x48'));var _0x5e77eb=ejs[_0x1ab8('0x44')](_0x4bf669,{'networks':_0x28ffa2||[]});fs[_0x1ab8('0x49')](_0x1ab8('0x45'),_0x5e77eb);return respondWithRpcPromise(_0x1ab8('0x46'),_0x1ab8('0x52'),{'module':_0x1ab8('0x47')});}else if(_0x3bbb60[_0x1ab8('0x22')][_0x1ab8('0x3f')]()==_0x1ab8('0x50')){var _0x8b3de9=fs[_0x1ab8('0x41')](path[_0x1ab8('0x42')](config[_0x1ab8('0x4b')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x821442=ejs[_0x1ab8('0x44')](_0x8b3de9,{'networks':_0x28ffa2||[]});fs[_0x1ab8('0x49')](_0x1ab8('0x4a'),_0x821442);return respondWithRpcPromise('Reload',_0x1ab8('0x52'),{'module':_0x1ab8('0x47')});}else{var _0x3b07d8=fs['readFileSync'](path[_0x1ab8('0x42')](config[_0x1ab8('0x4b')],_0x1ab8('0x4c')),_0x1ab8('0x48'));var _0x165914=ejs[_0x1ab8('0x44')](_0x3b07d8,{'networks':_0x28ffa2||[]});fs[_0x1ab8('0x49')](util[_0x1ab8('0x51')](_0x1ab8('0x4d'),_0x3bbb60[_0x1ab8('0x22')][_0x1ab8('0x4e')]()),_0x165914);return respondWithRpcPromise(_0x1ab8('0x46'),_0x1ab8('0x52'),{'module':'chan_sip.so'});}})[_0x1ab8('0x13')](handleError(_0x30c01e,null));}; \ No newline at end of file +var _0xa9e2=['result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','create','body','toUpperCase','readFileSync','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','find','STUN','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3fb386,_0x5c6111){var _0x2983e5=function(_0x4d8417){while(--_0x4d8417){_0x3fb386['push'](_0x3fb386['shift']());}};_0x2983e5(++_0x5c6111);}(_0xa9e2,0x9b));var _0x2a9e=function(_0x3aeea5,_0x7da3dd){_0x3aeea5=_0x3aeea5-0x0;var _0x3f58ea=_0xa9e2[_0x3aeea5];return _0x3f58ea;};'use strict';var util=require(_0x2a9e('0x0'));var path=require(_0x2a9e('0x1'));var ejs=require(_0x2a9e('0x2'));var fs=require('fs');var _=require(_0x2a9e('0x3'));var qs=require(_0x2a9e('0x4'));var logger=require(_0x2a9e('0x5'))('api');var config=require(_0x2a9e('0x6'));var db=require(_0x2a9e('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2a9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47c16b,_0x457787,_0x5debb9,_0x1ed026){return new Promise(function(_0x221b7c,_0x1801c0){var _0x51ed69=_0x1ed026||client;return _0x51ed69[_0x2a9e('0x9')](_0x47c16b,_0x5debb9)[_0x2a9e('0xa')](function(_0xb7c881){logger['info'](_0x2a9e('0xb'),_0x457787,_0x2a9e('0xc'));logger[_0x2a9e('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x457787,_0x2a9e('0xc'),JSON[_0x2a9e('0xe')](_0xb7c881));if(_0xb7c881[_0x2a9e('0xf')]){if(_0xb7c881[_0x2a9e('0xf')][_0x2a9e('0x10')]===0x1f4){logger['error'](_0x2a9e('0xb'),_0x457787,_0xb7c881['error'][_0x2a9e('0x11')]);return _0x1801c0(_0xb7c881['error'][_0x2a9e('0x11')]);}logger['error']('Network,\x20%s,\x20%s',_0x457787,_0xb7c881['error']['message']);return _0x221b7c(_0xb7c881['error'][_0x2a9e('0x11')]);}else{logger[_0x2a9e('0x12')](_0x2a9e('0xb'),_0x457787,_0x2a9e('0xc'));_0x221b7c(_0xb7c881[_0x2a9e('0x13')][_0x2a9e('0x11')]);}})[_0x2a9e('0x14')](function(_0x56500e){logger[_0x2a9e('0xf')]('Network,\x20%s,\x20%s',_0x457787,_0x56500e);_0x1801c0(_0x56500e);});});}function respondWithResult(_0x171564,_0x59d2aa){_0x59d2aa=_0x59d2aa||0xc8;return function(_0x4b1fff){if(_0x4b1fff){return _0x171564[_0x2a9e('0x15')](_0x59d2aa)[_0x2a9e('0x16')](_0x4b1fff);}};}function respondWithFilteredResult(_0x254771,_0x23a81c){return function(_0x195eef){if(_0x195eef){var _0x196f5a=typeof _0x23a81c['offset']===_0x2a9e('0x17')&&typeof _0x23a81c['limit']===_0x2a9e('0x17');var _0xe3adec=_0x195eef[_0x2a9e('0x18')];var _0x4428ec=_0x196f5a?0x0:_0x23a81c[_0x2a9e('0x19')];var _0x3db3ca=_0x196f5a?_0x195eef[_0x2a9e('0x18')]:_0x23a81c['offset']+_0x23a81c[_0x2a9e('0x1a')];var _0x4bf803;if(_0x3db3ca>=_0xe3adec){_0x3db3ca=_0xe3adec;_0x4bf803=0xc8;}else{_0x4bf803=0xce;}_0x254771[_0x2a9e('0x15')](_0x4bf803);return _0x254771[_0x2a9e('0x1b')](_0x2a9e('0x1c'),_0x4428ec+'-'+_0x3db3ca+'/'+_0xe3adec)[_0x2a9e('0x16')](_0x195eef);}return null;};}function saveUpdates(_0x3d030a){return function(_0x16bb13){if(_0x16bb13){return _0x16bb13[_0x2a9e('0x1d')](_0x3d030a)[_0x2a9e('0xa')](function(_0x1bd079){return _0x1bd079;});}return null;};}function removeEntity(_0x10e992){return function(_0x19581c){if(_0x19581c){return _0x19581c[_0x2a9e('0x1e')]()[_0x2a9e('0xa')](function(){_0x10e992[_0x2a9e('0x15')](0xcc)[_0x2a9e('0x1f')]();});}};}function handleEntityNotFound(_0x3c6a32){return function(_0x6d04b9){if(!_0x6d04b9){_0x3c6a32[_0x2a9e('0x20')](0x194);}return _0x6d04b9;};}function handleError(_0x3c1ccf,_0x417ae2){_0x417ae2=_0x417ae2||0x1f4;return function(_0x2da12f){logger[_0x2a9e('0xf')](_0x2da12f[_0x2a9e('0x21')]);if(_0x2da12f[_0x2a9e('0x22')]){delete _0x2da12f[_0x2a9e('0x22')];}_0x3c1ccf[_0x2a9e('0x15')](_0x417ae2)[_0x2a9e('0x23')](_0x2da12f);};}exports[_0x2a9e('0x24')]=function(_0x33ccfd,_0x33d52e){var _0x298adb={},_0x208c33={},_0x40d5af={'count':0x0,'rows':[]};var _0xe9fb67=_[_0x2a9e('0x25')](db[_0x2a9e('0x26')][_0x2a9e('0x27')],function(_0x55e04f){return{'name':_0x55e04f[_0x2a9e('0x28')],'type':_0x55e04f[_0x2a9e('0x29')][_0x2a9e('0x2a')]};});_0x208c33[_0x2a9e('0x2b')]=_['map'](_0xe9fb67,_0x2a9e('0x22'));_0x208c33[_0x2a9e('0x2c')]=_[_0x2a9e('0x2d')](_0x33ccfd['query']);_0x208c33['filters']=_[_0x2a9e('0x2e')](_0x208c33['model'],_0x208c33[_0x2a9e('0x2c')]);_0x298adb['attributes']=_[_0x2a9e('0x2e')](_0x208c33[_0x2a9e('0x2b')],qs[_0x2a9e('0x2f')](_0x33ccfd['query'][_0x2a9e('0x2f')]));_0x298adb[_0x2a9e('0x30')]=_0x298adb['attributes'][_0x2a9e('0x31')]?_0x298adb[_0x2a9e('0x30')]:_0x208c33[_0x2a9e('0x2b')];if(!_0x33ccfd['query']['hasOwnProperty']('nolimit')){_0x298adb[_0x2a9e('0x1a')]=qs['limit'](_0x33ccfd[_0x2a9e('0x2c')]['limit']);_0x298adb[_0x2a9e('0x19')]=qs[_0x2a9e('0x19')](_0x33ccfd[_0x2a9e('0x2c')]['offset']);}_0x298adb[_0x2a9e('0x32')]=qs['sort'](_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x33')]);_0x298adb[_0x2a9e('0x34')]=qs['filters'](_['pick'](_0x33ccfd[_0x2a9e('0x2c')],_0x208c33[_0x2a9e('0x35')]),_0xe9fb67);if(_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x36')]){_0x298adb[_0x2a9e('0x34')]=_['merge'](_0x298adb[_0x2a9e('0x34')],{'$or':_['map'](_0xe9fb67,function(_0x4a55d4){if(_0x4a55d4[_0x2a9e('0x29')]!==_0x2a9e('0x37')){var _0x54392d={};_0x54392d[_0x4a55d4[_0x2a9e('0x22')]]={'$like':'%'+_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x36')]+'%'};return _0x54392d;}})});}_0x298adb=_[_0x2a9e('0x38')]({},_0x298adb,_0x33ccfd['options']);var _0x3adc46={'where':_0x298adb[_0x2a9e('0x34')]};return db[_0x2a9e('0x26')][_0x2a9e('0x18')](_0x3adc46)[_0x2a9e('0xa')](function(_0x455f2f){_0x40d5af[_0x2a9e('0x18')]=_0x455f2f;if(_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x39')]){_0x298adb[_0x2a9e('0x3a')]=[{'all':!![]}];}return db['Network'][_0x2a9e('0x3b')](_0x298adb);})[_0x2a9e('0xa')](function(_0x42f525){_0x40d5af[_0x2a9e('0x3c')]=_0x42f525;return _0x40d5af;})[_0x2a9e('0xa')](respondWithFilteredResult(_0x33d52e,_0x298adb))[_0x2a9e('0x14')](handleError(_0x33d52e,null));};exports[_0x2a9e('0x3d')]=function(_0x246f9b,_0x217505){var _0x29a239={'raw':!![],'where':{'id':_0x246f9b[_0x2a9e('0x3e')]['id']}},_0x37d598={};_0x37d598[_0x2a9e('0x2b')]=_[_0x2a9e('0x2d')](db['Network'][_0x2a9e('0x27')]);_0x37d598[_0x2a9e('0x2c')]=_['keys'](_0x246f9b[_0x2a9e('0x2c')]);_0x37d598[_0x2a9e('0x35')]=_['intersection'](_0x37d598['model'],_0x37d598['query']);_0x29a239[_0x2a9e('0x30')]=_[_0x2a9e('0x2e')](_0x37d598[_0x2a9e('0x2b')],qs['fields'](_0x246f9b[_0x2a9e('0x2c')][_0x2a9e('0x2f')]));_0x29a239[_0x2a9e('0x30')]=_0x29a239['attributes'][_0x2a9e('0x31')]?_0x29a239[_0x2a9e('0x30')]:_0x37d598[_0x2a9e('0x2b')];if(_0x246f9b['query'][_0x2a9e('0x39')]){_0x29a239[_0x2a9e('0x3a')]=[{'all':!![]}];}_0x29a239=_['merge']({},_0x29a239,_0x246f9b[_0x2a9e('0x3f')]);return db['Network']['find'](_0x29a239)[_0x2a9e('0xa')](handleEntityNotFound(_0x217505,null))['then'](respondWithResult(_0x217505,null))[_0x2a9e('0x14')](handleError(_0x217505,null));};exports[_0x2a9e('0x40')]=function(_0x274969,_0x441d47){var _0x19b120;return db[_0x2a9e('0x26')]['create'](_0x274969[_0x2a9e('0x41')],{'raw':!![]})[_0x2a9e('0xa')](function(_0x110fbd){_0x19b120=_0x110fbd;return db[_0x2a9e('0x26')][_0x2a9e('0x3b')]({'where':{'type':_0x274969[_0x2a9e('0x41')][_0x2a9e('0x29')]},'raw':!![]});})['then'](function(_0x29fa3b){if(_0x19b120[_0x2a9e('0x29')][_0x2a9e('0x42')]()=='STUN'){var _0x3863b3=fs[_0x2a9e('0x43')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x2a9e('0x44'));var _0x1db041=ejs['render'](_0x3863b3,{'networks':_0x29fa3b||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x46'),_0x1db041);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x40'),{'module':_0x2a9e('0x48')});}else if(_0x19b120['type'][_0x2a9e('0x42')]()==_0x2a9e('0x49')){var _0x258f8a=fs[_0x2a9e('0x43')](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x4c')),_0x2a9e('0x44'));var _0x4fdf45=ejs[_0x2a9e('0x4d')](_0x258f8a,{'networks':_0x29fa3b||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x4e'),_0x4fdf45);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x40'),{'module':'res_stun_monitor.so'});}else{var _0x5c72c0=fs[_0x2a9e('0x43')](path['join'](config['root'],_0x2a9e('0x4f')),_0x2a9e('0x44'));var _0x1e860d=ejs[_0x2a9e('0x4d')](_0x5c72c0,{'networks':_0x29fa3b||[]});fs[_0x2a9e('0x45')](util[_0x2a9e('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x274969[_0x2a9e('0x41')]['type'][_0x2a9e('0x51')]()),_0x1e860d);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x40'),{'module':_0x2a9e('0x52')});}})['then'](function(){return _0x19b120;})[_0x2a9e('0xa')](respondWithResult(_0x441d47,0xc9))[_0x2a9e('0x14')](handleError(_0x441d47,null));};exports[_0x2a9e('0x1d')]=function(_0x579fd0,_0x2229df){var _0x517624;return db[_0x2a9e('0x26')][_0x2a9e('0x53')]({'where':{'id':_0x579fd0[_0x2a9e('0x3e')]['id']}})[_0x2a9e('0xa')](handleEntityNotFound(_0x2229df,null))['then'](saveUpdates(_0x579fd0[_0x2a9e('0x41')],null))['then'](function(_0x3b2977){if(_0x3b2977){_0x517624=_0x3b2977;return db[_0x2a9e('0x26')][_0x2a9e('0x3b')]({'where':{'type':_0x517624['type']},'raw':!![]});}return null;})[_0x2a9e('0xa')](function(_0x5614e8){if(_0x517624[_0x2a9e('0x29')][_0x2a9e('0x42')]()==_0x2a9e('0x54')){var _0x2896bd=fs[_0x2a9e('0x43')](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x55')),_0x2a9e('0x44'));var _0x1156ea=ejs['render'](_0x2896bd,{'networks':_0x5614e8||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x46'),_0x1156ea);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1d'),{'module':_0x2a9e('0x48')});}else if(_0x517624[_0x2a9e('0x29')][_0x2a9e('0x42')]()=='TURN'){var _0x11f644=fs['readFileSync'](path['join'](config[_0x2a9e('0x4b')],_0x2a9e('0x4c')),_0x2a9e('0x44'));var _0x4a97f9=ejs[_0x2a9e('0x4d')](_0x11f644,{'networks':_0x5614e8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4a97f9);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1d'),{'module':_0x2a9e('0x48')});}else{var _0x249441=fs[_0x2a9e('0x43')](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x4f')),'utf8');var _0x48ef9d=ejs[_0x2a9e('0x4d')](_0x249441,{'networks':_0x5614e8||[]});fs['writeFileSync'](util[_0x2a9e('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x579fd0[_0x2a9e('0x41')]['type']['toLowerCase']()),_0x48ef9d);return respondWithRpcPromise(_0x2a9e('0x47'),'update',{'module':_0x2a9e('0x52')});}})[_0x2a9e('0xa')](function(_0x45618f){if(_0x45618f){return _0x517624;}return null;})[_0x2a9e('0xa')](respondWithResult(_0x2229df,null))[_0x2a9e('0x14')](handleError(_0x2229df,null));};exports['destroy']=function(_0x5282d6,_0x160ac7){var _0x1df32c;return db['Network'][_0x2a9e('0x53')]({'where':{'id':_0x5282d6[_0x2a9e('0x3e')]['id']}})[_0x2a9e('0xa')](function(_0x1f7e25){_0x1df32c=_0x1f7e25;return _0x1f7e25;})[_0x2a9e('0xa')](handleEntityNotFound(_0x160ac7,null))[_0x2a9e('0xa')](removeEntity(_0x160ac7,null))['then'](function(){if(_0x1df32c){return db[_0x2a9e('0x26')][_0x2a9e('0x3b')]({'where':{'type':_0x1df32c[_0x2a9e('0x29')]},'raw':!![]});}})[_0x2a9e('0xa')](function(_0x450d96){if(_0x1df32c[_0x2a9e('0x29')]['toUpperCase']()==_0x2a9e('0x54')){var _0x1bc9dd=fs['readFileSync'](path[_0x2a9e('0x4a')](config['root'],_0x2a9e('0x55')),_0x2a9e('0x44'));var _0x96fb3=ejs[_0x2a9e('0x4d')](_0x1bc9dd,{'networks':_0x450d96||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x46'),_0x96fb3);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x1df32c['type'][_0x2a9e('0x42')]()=='TURN'){var _0x512b58=fs[_0x2a9e('0x43')](path['join'](config[_0x2a9e('0x4b')],_0x2a9e('0x4c')),_0x2a9e('0x44'));var _0x1a1618=ejs[_0x2a9e('0x4d')](_0x512b58,{'networks':_0x450d96||[]});fs[_0x2a9e('0x45')]('/etc/asterisk/turn_xcally.conf',_0x1a1618);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1e'),{'module':_0x2a9e('0x48')});}else{var _0x512cd1=fs['readFileSync'](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x4f')),_0x2a9e('0x44'));var _0x11fbed=ejs[_0x2a9e('0x4d')](_0x512cd1,{'networks':_0x450d96||[]});fs['writeFileSync'](util[_0x2a9e('0x50')](_0x2a9e('0x56'),_0x1df32c[_0x2a9e('0x29')][_0x2a9e('0x51')]()),_0x11fbed);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1e'),{'module':_0x2a9e('0x52')});}})[_0x2a9e('0x14')](handleError(_0x160ac7,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e9ce3ab..6281923 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 _0x878f=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x878f,0x173));var _0xf878=function(_0x5b387f,_0x5de515){_0x5b387f=_0x5b387f-0x0;var _0x4feb0f=_0x878f[_0x5b387f];return _0x4feb0f;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0db9=['network','lodash','moment','bluebird','path','../../config/environment','./network.attributes','define','Network'];(function(_0x1e558d,_0x309ad0){var _0x4cf263=function(_0x4aec1f){while(--_0x4aec1f){_0x1e558d['push'](_0x1e558d['shift']());}};_0x4cf263(++_0x309ad0);}(_0x0db9,0xa3));var _0x90db=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x0db9[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'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 e2655fd..79e07d3 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x74433a,_0x28ca8b){_0x74433a=_0x74433a-0x0;var _0xaa946=_0x7a54[_0x74433a];return _0xaa946;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x267ee1,_0x140792){_0x267ee1=_0x267ee1-0x0;var _0x3fc2ba=_0x7a54[_0x267ee1];return _0x3fc2ba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 87b9ff2..2b2d7f9 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 _0xa30a=['../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/:id/send','send','put','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ca79e,_0x185d0e){var _0x8d5177=function(_0x19f16c){while(--_0x19f16c){_0x5ca79e['push'](_0x5ca79e['shift']());}};_0x8d5177(++_0x185d0e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var path=require(_0xaa30('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa30('0x3'));var router=express[_0xaa30('0x4')]();var fs_extra=require(_0xaa30('0x5'));var auth=require(_0xaa30('0x6'));var interaction=require(_0xaa30('0x7'));var config=require(_0xaa30('0x8'));var controller=require(_0xaa30('0x9'));router['get']('/',auth[_0xaa30('0xa')](),controller['index']);router[_0xaa30('0xb')](_0xaa30('0xc'),auth[_0xaa30('0xa')](),controller['describe']);router[_0xaa30('0xb')](_0xaa30('0xd'),auth[_0xaa30('0xa')](),controller[_0xaa30('0xe')]);router[_0xaa30('0xb')](_0xaa30('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xaa30('0xb')]('/:id/canned_answers',auth[_0xaa30('0xa')](),controller[_0xaa30('0x10')]);router[_0xaa30('0xb')](_0xaa30('0x11'),auth['isAuthenticated'](),controller[_0xaa30('0x12')]);router[_0xaa30('0xb')](_0xaa30('0x13'),auth['isAuthenticated'](),controller[_0xaa30('0x14')]);router[_0xaa30('0xb')](_0xaa30('0x15'),auth[_0xaa30('0xa')](),controller[_0xaa30('0x16')]);router[_0xaa30('0x17')]('/',auth[_0xaa30('0xa')](),controller[_0xaa30('0x18')]);router[_0xaa30('0x17')](_0xaa30('0xf'),auth['isAuthenticated'](),controller[_0xaa30('0x19')]);router['post']('/:id/canned_answers',auth[_0xaa30('0xa')](),controller[_0xaa30('0x1a')]);router[_0xaa30('0x17')]('/:id/notify',controller['notify']);router['post'](_0xaa30('0x11'),auth['isAuthenticated'](),controller[_0xaa30('0x1b')]);router[_0xaa30('0x17')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xaa30('0x17')](_0xaa30('0x1c'),auth[_0xaa30('0xa')](),controller[_0xaa30('0x1d')]);router[_0xaa30('0x1e')]('/:id',auth[_0xaa30('0xa')](),controller[_0xaa30('0x1f')]);router[_0xaa30('0x20')](_0xaa30('0xd'),auth[_0xaa30('0xa')](),controller['destroy']);router[_0xaa30('0x20')](_0xaa30('0xf'),auth[_0xaa30('0xa')](),controller[_0xaa30('0x21')]);router['delete'](_0xaa30('0x22'),auth[_0xaa30('0xa')](),controller[_0xaa30('0x23')]);router[_0xaa30('0x20')](_0xaa30('0x15'),auth[_0xaa30('0xa')](),controller['removeAgents']);module[_0xaa30('0x24')]=router; \ No newline at end of file +var _0x3423=['/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2175a3,_0x426e08){var _0x3d308b=function(_0x3756fa){while(--_0x3756fa){_0x2175a3['push'](_0x2175a3['shift']());}};_0x3d308b(++_0x426e08);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x9')]('/:id/interactions',auth[_0x3342('0xa')](),controller[_0x3342('0x13')]);router[_0x3342('0x9')](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x15')]);router[_0x3342('0x16')]('/',auth['isAuthenticated'](),controller[_0x3342('0x17')]);router[_0x3342('0x16')]('/:id/dispositions',auth[_0x3342('0xa')](),controller[_0x3342('0x18')]);router['post']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x19')]);router[_0x3342('0x16')](_0x3342('0x1a'),controller[_0x3342('0x1b')]);router[_0x3342('0x16')](_0x3342('0x11'),auth[_0x3342('0xa')](),controller[_0x3342('0x1c')]);router['post'](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x1d')]);router['post'](_0x3342('0x1e'),auth[_0x3342('0xa')](),controller['send']);router[_0x3342('0x1f')](_0x3342('0xe'),auth['isAuthenticated'](),controller[_0x3342('0x20')]);router['delete'](_0x3342('0xe'),auth[_0x3342('0xa')](),controller[_0x3342('0x21')]);router[_0x3342('0x22')](_0x3342('0xf'),auth[_0x3342('0xa')](),controller[_0x3342('0x23')]);router[_0x3342('0x22')]('/:id/canned_answers',auth[_0x3342('0xa')](),controller['removeAnswers']);router['delete'](_0x3342('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3342('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4db6779..d2a7be5 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 _0x8091=['STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x8091,0x11e));var _0x1809=function(_0x230615,_0x3916bc){_0x230615=_0x230615-0x0;var _0xf81957=_0x8091[_0x230615];return _0xf81957;};'use strict';var Sequelize=require(_0x1809('0x0'));var rs=require('randomstring');module[_0x1809('0x1')]={'name':{'type':Sequelize[_0x1809('0x2')],'unique':_0x1809('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1809('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1809('0x4')]();}},'replyUri':{'type':Sequelize[_0x1809('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1809('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1809('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1809('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1809('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1809('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1809('0x2')]},'queueTransfer':{'type':Sequelize[_0x1809('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1809('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1809('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1809('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1809('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x1809('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3fbf4f){if(!_0x3fbf4f)this['setDataValue'](_0x1809('0x9'),null);this[_0x1809('0xa')](_0x1809('0xb'),_0x3fbf4f);}}}; \ No newline at end of file +var _0x5b4a=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','generate','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x5b4a,0x12e));var _0xa5b4=function(_0x259d97,_0x2a07a4){_0x259d97=_0x259d97-0x0;var _0x5eac44=_0x5b4a[_0x259d97];return _0x5eac44;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa5b4('0x0'));module[_0xa5b4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa5b4('0x2')]();}},'replyUri':{'type':Sequelize[_0xa5b4('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa5b4('0x4')],'defaultValue':function(){return _0xa5b4('0x5');}},'notificationSound':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa5b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa5b4('0x3')]},'queueTransfer':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa5b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa5b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa5b4('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xa5b4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![],'comment':_0xa5b4('0x9'),'set':function(_0x5b53d8){if(!_0x5b53d8)this[_0xa5b4('0xa')](_0xa5b4('0xb'),null);this[_0xa5b4('0xa')](_0xa5b4('0xc'),_0x5b53d8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index feaf460..d7c203f 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 _0xe864=['OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','rows','show','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','CannedAnswer','getAnswers','pick','removeAnswers','notify','openchannel','CmContact','createdAt','updatedAt','difference','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','priority','asc','defaults','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','queue','Start','sequelize','Transaction','READ_COMMITTED','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x44b124,_0x53f626){var _0x4ada33=function(_0x442b57){while(--_0x442b57){_0x44b124['push'](_0x44b124['shift']());}};_0x4ada33(++_0x53f626);}(_0xe864,0x14b));var _0x4e86=function(_0x29efc7,_0x230e6e){_0x29efc7=_0x29efc7-0x0;var _0x3c8ecf=_0xe864[_0x29efc7];return _0x3c8ecf;};'use strict';var emlformat=require(_0x4e86('0x0'));var rimraf=require(_0x4e86('0x1'));var zipdir=require(_0x4e86('0x2'));var jsonpatch=require(_0x4e86('0x3'));var rp=require(_0x4e86('0x4'));var moment=require(_0x4e86('0x5'));var BPromise=require(_0x4e86('0x6'));var Mustache=require(_0x4e86('0x7'));var util=require(_0x4e86('0x8'));var path=require(_0x4e86('0x9'));var sox=require(_0x4e86('0xa'));var csv=require(_0x4e86('0xb'));var ejs=require(_0x4e86('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e86('0xd'));var squel=require(_0x4e86('0xe'));var crypto=require('crypto');var jsforce=require(_0x4e86('0xf'));var deskjs=require(_0x4e86('0x10'));var toCsv=require(_0x4e86('0xb'));var querystring=require(_0x4e86('0x11'));var Papa=require(_0x4e86('0x12'));var Redis=require(_0x4e86('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e86('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e86('0x15'))(_0x4e86('0x16'));var utils=require(_0x4e86('0x17'));var config=require(_0x4e86('0x18'));var licenseUtil=require(_0x4e86('0x19'));var db=require(_0x4e86('0x1a'))['db'];config[_0x4e86('0x1b')]=_['defaults'](config[_0x4e86('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4e86('0x1c'))[_0x4e86('0x1d')](socket);var jayson=require(_0x4e86('0x1e'));var client=jayson[_0x4e86('0x1f')][_0x4e86('0x20')]({'port':0x232c});var client9002=jayson[_0x4e86('0x1f')][_0x4e86('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x292ef8,_0x1f6875,_0x3f19d0,_0x20cd27){return new BPromise(function(_0x5185b5,_0x5788b7){var _0x55a7b0=_0x20cd27||client;return _0x55a7b0[_0x4e86('0x21')](_0x292ef8,_0x3f19d0)['then'](function(_0x1e917c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1f6875,_0x4e86('0x22'));logger['debug'](_0x4e86('0x23'),_0x1f6875,_0x4e86('0x22'),JSON['stringify'](_0x1e917c));if(_0x1e917c['error']){if(_0x1e917c[_0x4e86('0x24')][_0x4e86('0x25')]===0x1f4){logger[_0x4e86('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f6875,_0x1e917c[_0x4e86('0x24')]['message']);return _0x5788b7(_0x1e917c['error'][_0x4e86('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1f6875,_0x1e917c[_0x4e86('0x24')][_0x4e86('0x26')]);return _0x5185b5(_0x1e917c['error'][_0x4e86('0x26')]);}else{logger[_0x4e86('0x27')](_0x4e86('0x28'),_0x1f6875,'request\x20sent');_0x5185b5(_0x1e917c[_0x4e86('0x29')][_0x4e86('0x26')]);}})[_0x4e86('0x2a')](function(_0x388887){logger[_0x4e86('0x24')](_0x4e86('0x28'),_0x1f6875,_0x388887);_0x5788b7(_0x388887);});});}function respondWithStatusCode(_0x860ef,_0x2a4ff1){_0x2a4ff1=_0x2a4ff1||0xcc;return function(_0x5c2d72){if(_0x5c2d72){return _0x860ef[_0x4e86('0x2b')](_0x2a4ff1);}return _0x860ef['status'](_0x2a4ff1)['end']();};}function respondWithResult(_0x1f9f25,_0x532bed){_0x532bed=_0x532bed||0xc8;return function(_0x1e9c1b){if(_0x1e9c1b){return _0x1f9f25[_0x4e86('0x2c')](_0x532bed)[_0x4e86('0x2d')](_0x1e9c1b);}};}function respondWithFilteredResult(_0x2ff569,_0x4a5c7d){return function(_0x2bbd61){if(_0x2bbd61){var _0x325f46=typeof _0x4a5c7d[_0x4e86('0x2e')]===_0x4e86('0x2f')&&typeof _0x4a5c7d[_0x4e86('0x30')]===_0x4e86('0x2f');var _0x8f2658=_0x2bbd61[_0x4e86('0x31')];var _0xdda456=_0x325f46?0x0:_0x4a5c7d[_0x4e86('0x2e')];var _0x5d6fa8=_0x325f46?_0x2bbd61[_0x4e86('0x31')]:_0x4a5c7d[_0x4e86('0x2e')]+_0x4a5c7d[_0x4e86('0x30')];var _0x5002ee;if(_0x5d6fa8>=_0x8f2658){_0x5d6fa8=_0x8f2658;_0x5002ee=0xc8;}else{_0x5002ee=0xce;}_0x2ff569[_0x4e86('0x2c')](_0x5002ee);return _0x2ff569[_0x4e86('0x32')](_0x4e86('0x33'),_0xdda456+'-'+_0x5d6fa8+'/'+_0x8f2658)['json'](_0x2bbd61);}return null;};}function patchUpdates(_0x223021){return function(_0x207e57){try{jsonpatch[_0x4e86('0x34')](_0x207e57,_0x223021,!![]);}catch(_0x557bd5){return BPromise[_0x4e86('0x35')](_0x557bd5);}return _0x207e57[_0x4e86('0x36')]();};}function saveUpdates(_0x18e855,_0x47fcc8){return function(_0x381b10){if(_0x381b10){return _0x381b10[_0x4e86('0x37')](_0x18e855)['then'](function(_0x26e41a){return _0x26e41a;});}return null;};}function removeEntity(_0x1a8b8d,_0x52697a){return function(_0x3246e3){if(_0x3246e3){return _0x3246e3[_0x4e86('0x38')]()[_0x4e86('0x39')](function(){var _0xf4b0ee=_0x3246e3[_0x4e86('0x3a')]({'plain':!![]});var _0x2a089b=_0x4e86('0x3b');return db[_0x4e86('0x3c')][_0x4e86('0x38')]({'where':{'type':_0x2a089b,'resourceId':_0xf4b0ee['id']}})[_0x4e86('0x39')](function(){return _0x3246e3;});})[_0x4e86('0x39')](function(){_0x1a8b8d[_0x4e86('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20fe2e,_0x13c54a){return function(_0x3c3c9d){if(!_0x3c3c9d){_0x20fe2e[_0x4e86('0x2b')](0x194);}return _0x3c3c9d;};}function handleError(_0x34ae08,_0x2dd790){_0x2dd790=_0x2dd790||0x1f4;return function(_0x429ac4){logger[_0x4e86('0x24')](_0x429ac4[_0x4e86('0x3d')]);if(_0x429ac4[_0x4e86('0x3e')]){delete _0x429ac4[_0x4e86('0x3e')];}_0x34ae08[_0x4e86('0x2c')](_0x2dd790)['send'](_0x429ac4);};}exports[_0x4e86('0x3f')]=function(_0x20ad14,_0x5c3c88){var _0x164854={'include':[{'model':db['Pause'],'as':_0x4e86('0x40')}]},_0x518fb6={},_0x2688ee={'count':0x0,'rows':[]};var _0x17fca6=_[_0x4e86('0x41')](db[_0x4e86('0x42')][_0x4e86('0x43')],function(_0x190ae1){return{'name':_0x190ae1[_0x4e86('0x44')],'type':_0x190ae1[_0x4e86('0x45')][_0x4e86('0x46')]};});_0x518fb6[_0x4e86('0x47')]=_[_0x4e86('0x41')](_0x17fca6,_0x4e86('0x3e'));_0x518fb6['query']=_[_0x4e86('0x48')](_0x20ad14[_0x4e86('0x49')]);_0x518fb6['filters']=_[_0x4e86('0x4a')](_0x518fb6[_0x4e86('0x47')],_0x518fb6[_0x4e86('0x49')]);_0x164854[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x518fb6['model'],qs[_0x4e86('0x4c')](_0x20ad14['query'][_0x4e86('0x4c')]));_0x164854[_0x4e86('0x4b')]=_0x164854[_0x4e86('0x4b')]['length']?_0x164854['attributes']:_0x518fb6[_0x4e86('0x47')];if(!_0x20ad14[_0x4e86('0x49')][_0x4e86('0x4d')](_0x4e86('0x4e'))){_0x164854['limit']=qs[_0x4e86('0x30')](_0x20ad14[_0x4e86('0x49')][_0x4e86('0x30')]);_0x164854[_0x4e86('0x2e')]=qs[_0x4e86('0x2e')](_0x20ad14['query'][_0x4e86('0x2e')]);}_0x164854[_0x4e86('0x4f')]=qs[_0x4e86('0x50')](_0x20ad14[_0x4e86('0x49')]['sort']);_0x164854[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_['pick'](_0x20ad14[_0x4e86('0x49')],_0x518fb6[_0x4e86('0x52')]),_0x17fca6);if(_0x20ad14[_0x4e86('0x49')]['filter']){_0x164854[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x164854[_0x4e86('0x51')],{'$or':_[_0x4e86('0x41')](_0x17fca6,function(_0x4436bf){if(_0x4436bf['type']!=='VIRTUAL'){var _0x1ce9f1={};_0x1ce9f1[_0x4436bf['name']]={'$like':'%'+_0x20ad14[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0x1ce9f1;}})});}_0x164854=_[_0x4e86('0x53')]({},_0x164854,_0x20ad14[_0x4e86('0x55')]);var _0x392bf2={'where':_0x164854[_0x4e86('0x51')]};return db[_0x4e86('0x42')][_0x4e86('0x31')](_0x392bf2)[_0x4e86('0x39')](function(_0x3a6d0c){_0x2688ee['count']=_0x3a6d0c;if(_0x20ad14[_0x4e86('0x49')][_0x4e86('0x56')]){_0x164854[_0x4e86('0x57')]=[{'all':!![]}];}return db[_0x4e86('0x42')]['findAll'](_0x164854);})[_0x4e86('0x39')](function(_0x37e853){_0x2688ee[_0x4e86('0x58')]=_0x37e853;return _0x2688ee;})['then'](respondWithFilteredResult(_0x5c3c88,_0x164854))[_0x4e86('0x2a')](handleError(_0x5c3c88,null));};exports[_0x4e86('0x59')]=function(_0x111aa3,_0x26d3ae){var _0x45a4df={'raw':![],'where':{'id':_0x111aa3['params']['id']},'include':[{'model':db[_0x4e86('0x5a')],'as':_0x4e86('0x40')}]},_0x2e6763={};_0x2e6763[_0x4e86('0x47')]=_[_0x4e86('0x48')](db['OpenchannelAccount']['rawAttributes']);_0x2e6763[_0x4e86('0x49')]=_[_0x4e86('0x48')](_0x111aa3[_0x4e86('0x49')]);_0x2e6763[_0x4e86('0x52')]=_['intersection'](_0x2e6763[_0x4e86('0x47')],_0x2e6763[_0x4e86('0x49')]);_0x45a4df[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x2e6763[_0x4e86('0x47')],qs['fields'](_0x111aa3[_0x4e86('0x49')][_0x4e86('0x4c')]));_0x45a4df[_0x4e86('0x4b')]=_0x45a4df['attributes'][_0x4e86('0x5b')]?_0x45a4df['attributes']:_0x2e6763['model'];if(_0x111aa3[_0x4e86('0x49')][_0x4e86('0x56')]){_0x45a4df[_0x4e86('0x57')]=[{'all':!![]}];}_0x45a4df=_['merge']({},_0x45a4df,_0x111aa3['options']);return db[_0x4e86('0x42')][_0x4e86('0x5c')](_0x45a4df)[_0x4e86('0x39')](handleEntityNotFound(_0x26d3ae,null))[_0x4e86('0x39')](respondWithResult(_0x26d3ae,null))[_0x4e86('0x2a')](handleError(_0x26d3ae,null));};exports[_0x4e86('0x5d')]=function(_0x3b4d33,_0x4684eb){return db[_0x4e86('0x42')]['create'](_0x3b4d33[_0x4e86('0x5e')],{})[_0x4e86('0x39')](function(_0x50ecb8){var _0xc29b96=_0x3b4d33[_0x4e86('0x5f')]['get']({'plain':!![]});if(!_0xc29b96)throw new Error(_0x4e86('0x60'));if(_0xc29b96[_0x4e86('0x61')]===_0x4e86('0x5f')){var _0x235bdb=_0x50ecb8['get']({'plain':!![]});var _0x23d216=_0x4e86('0x3b');return db['UserProfileSection'][_0x4e86('0x5c')]({'where':{'name':_0x23d216,'userProfileId':_0xc29b96[_0x4e86('0x62')]},'raw':!![]})['then'](function(_0x229431){if(_0x229431&&_0x229431[_0x4e86('0x63')]===0x0){return db[_0x4e86('0x3c')][_0x4e86('0x5d')]({'name':_0x235bdb['name'],'resourceId':_0x235bdb['id'],'type':_0x229431[_0x4e86('0x3e')],'sectionId':_0x229431['id']},{})['then'](function(){return _0x50ecb8;});}else{return _0x50ecb8;}})[_0x4e86('0x2a')](function(_0x318768){logger[_0x4e86('0x24')](_0x4e86('0x64'),_0x318768);throw _0x318768;});}return _0x50ecb8;})[_0x4e86('0x39')](respondWithResult(_0x4684eb,0xc9))['catch'](handleError(_0x4684eb,null));};exports[_0x4e86('0x37')]=function(_0x5e527c,_0x51e16f){if(_0x5e527c['body']['id']){delete _0x5e527c[_0x4e86('0x5e')]['id'];}return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x5e527c[_0x4e86('0x65')]['id']},'include':[{'model':db[_0x4e86('0x5a')],'as':_0x4e86('0x40')}]})[_0x4e86('0x39')](handleEntityNotFound(_0x51e16f,null))[_0x4e86('0x39')](saveUpdates(_0x5e527c[_0x4e86('0x5e')],null))['then'](respondWithResult(_0x51e16f,null))[_0x4e86('0x2a')](handleError(_0x51e16f,null));};exports[_0x4e86('0x38')]=function(_0xf7979c,_0x321a1b){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0xf7979c[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x321a1b,null))[_0x4e86('0x39')](removeEntity(_0x321a1b,null))[_0x4e86('0x2a')](handleError(_0x321a1b,null));};exports['describe']=function(_0xa66c2e,_0x1b345a){return db[_0x4e86('0x42')][_0x4e86('0x66')]()[_0x4e86('0x39')](respondWithResult(_0x1b345a,null))[_0x4e86('0x2a')](handleError(_0x1b345a,null));};exports['addDisposition']=function(_0x724ce1,_0x5d65b7,_0x510139){if(_0x724ce1['body']['id']){delete _0x724ce1[_0x4e86('0x5e')]['id'];}return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x724ce1[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x5d65b7,null))[_0x4e86('0x39')](function(_0x421f16){if(_0x421f16){_0x724ce1[_0x4e86('0x5e')][_0x4e86('0x67')]=_0x421f16['id'];return db[_0x4e86('0x68')][_0x4e86('0x5d')](_0x724ce1[_0x4e86('0x5e')]);}})[_0x4e86('0x39')](respondWithResult(_0x5d65b7,null))[_0x4e86('0x2a')](handleError(_0x5d65b7,null));};exports[_0x4e86('0x69')]=function(_0x2d44f8,_0x3a6cac,_0x45e706){var _0x575e23={'raw':![],'where':{}};var _0x7164f4={};var _0x4e38a2={'count':0x0,'rows':[]};return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x2d44f8[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x3a6cac,null))[_0x4e86('0x39')](function(_0x4d26fe){if(_0x4d26fe){_0x7164f4[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x68')]['rawAttributes']);_0x7164f4[_0x4e86('0x49')]=_[_0x4e86('0x48')](_0x2d44f8[_0x4e86('0x49')]);_0x7164f4[_0x4e86('0x52')]=_[_0x4e86('0x4a')](_0x7164f4[_0x4e86('0x47')],_0x7164f4[_0x4e86('0x49')]);_0x575e23[_0x4e86('0x4b')]=_['intersection'](_0x7164f4['model'],qs['fields'](_0x2d44f8[_0x4e86('0x49')]['fields']));_0x575e23['attributes']=_0x575e23[_0x4e86('0x4b')]['length']?_0x575e23[_0x4e86('0x4b')]:_0x7164f4['model'];if(!_0x2d44f8['query'][_0x4e86('0x4d')](_0x4e86('0x4e'))){_0x575e23[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x30')]);_0x575e23[_0x4e86('0x2e')]=qs[_0x4e86('0x2e')](_0x2d44f8['query'][_0x4e86('0x2e')]);}_0x575e23[_0x4e86('0x4f')]=qs['sort'](_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x50')]);_0x575e23[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_['pick'](_0x2d44f8[_0x4e86('0x49')],_0x7164f4['filters']));_0x575e23[_0x4e86('0x51')]['OpenchannelAccountId']=_0x4d26fe['id'];if(_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x54')]){_0x575e23['where']=_[_0x4e86('0x53')](_0x575e23['where'],{'$or':_[_0x4e86('0x41')](_0x575e23[_0x4e86('0x4b')],function(_0xa38c14){var _0xef9464={};_0xef9464[_0xa38c14]={'$like':'%'+_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0xef9464;})});}_0x575e23=_[_0x4e86('0x53')]({},_0x575e23,_0x2d44f8[_0x4e86('0x55')]);return db[_0x4e86('0x68')][_0x4e86('0x31')]({'where':_0x575e23[_0x4e86('0x51')]})['then'](function(_0x34b287){_0x4e38a2[_0x4e86('0x31')]=_0x34b287;if(_0x2d44f8['query']['includeAll']){_0x575e23[_0x4e86('0x57')]=[{'all':!![]}];}return db[_0x4e86('0x68')][_0x4e86('0x6b')](_0x575e23);})['then'](function(_0x17c7e8){_0x4e38a2['rows']=_0x17c7e8;return _0x4e38a2;});}})[_0x4e86('0x39')](respondWithFilteredResult(_0x3a6cac,_0x575e23))[_0x4e86('0x2a')](handleError(_0x3a6cac,null));};exports[_0x4e86('0x6c')]=function(_0x472c7c,_0x49747b,_0x1bf551){return db['OpenchannelAccount']['find']({'where':{'id':_0x472c7c[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x49747b,null))['then'](function(_0x167c8b){if(_0x167c8b){return _0x167c8b['removeDispositions'](_0x472c7c['query'][_0x4e86('0x6d')]);}})['then'](respondWithStatusCode(_0x49747b,null))[_0x4e86('0x2a')](handleError(_0x49747b,null));};exports['addAnswer']=function(_0xdfc441,_0xbbf2c9,_0x2c2fff){if(_0xdfc441[_0x4e86('0x5e')]['id']){delete _0xdfc441[_0x4e86('0x5e')]['id'];}return db[_0x4e86('0x42')]['find']({'where':{'id':_0xdfc441['params']['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0xbbf2c9,null))['then'](function(_0xce773f){if(_0xce773f){_0xdfc441[_0x4e86('0x5e')][_0x4e86('0x67')]=_0xce773f['id'];return db[_0x4e86('0x6e')]['create'](_0xdfc441[_0x4e86('0x5e')]);}})[_0x4e86('0x39')](respondWithResult(_0xbbf2c9,null))[_0x4e86('0x2a')](handleError(_0xbbf2c9,null));};exports[_0x4e86('0x6f')]=function(_0x136640,_0x2dda74,_0x3c1a97){var _0x536add={'raw':![],'where':{}};var _0x48fcb8={};var _0x598fd5={'count':0x0,'rows':[]};return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x136640[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x2dda74,null))[_0x4e86('0x39')](function(_0xbc621b){if(_0xbc621b){_0x48fcb8[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x6e')][_0x4e86('0x43')]);_0x48fcb8[_0x4e86('0x49')]=_['keys'](_0x136640[_0x4e86('0x49')]);_0x48fcb8[_0x4e86('0x52')]=_['intersection'](_0x48fcb8['model'],_0x48fcb8['query']);_0x536add[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x48fcb8[_0x4e86('0x47')],qs[_0x4e86('0x4c')](_0x136640['query']['fields']));_0x536add[_0x4e86('0x4b')]=_0x536add[_0x4e86('0x4b')]['length']?_0x536add[_0x4e86('0x4b')]:_0x48fcb8['model'];if(!_0x136640[_0x4e86('0x49')][_0x4e86('0x4d')]('nolimit')){_0x536add[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x136640[_0x4e86('0x49')][_0x4e86('0x30')]);_0x536add['offset']=qs[_0x4e86('0x2e')](_0x136640[_0x4e86('0x49')][_0x4e86('0x2e')]);}_0x536add[_0x4e86('0x4f')]=qs['sort'](_0x136640[_0x4e86('0x49')][_0x4e86('0x50')]);_0x536add[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_[_0x4e86('0x70')](_0x136640[_0x4e86('0x49')],_0x48fcb8['filters']));_0x536add[_0x4e86('0x51')][_0x4e86('0x67')]=_0xbc621b['id'];if(_0x136640[_0x4e86('0x49')][_0x4e86('0x54')]){_0x536add[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x536add[_0x4e86('0x51')],{'$or':_['map'](_0x536add[_0x4e86('0x4b')],function(_0x19503a){var _0xbf8e48={};_0xbf8e48[_0x19503a]={'$like':'%'+_0x136640[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0xbf8e48;})});}_0x536add=_['merge']({},_0x536add,_0x136640[_0x4e86('0x55')]);return db[_0x4e86('0x6e')]['count']({'where':_0x536add[_0x4e86('0x51')]})[_0x4e86('0x39')](function(_0xd1ee6e){_0x598fd5[_0x4e86('0x31')]=_0xd1ee6e;if(_0x136640['query'][_0x4e86('0x56')]){_0x536add[_0x4e86('0x57')]=[{'all':!![]}];}return db[_0x4e86('0x6e')][_0x4e86('0x6b')](_0x536add);})[_0x4e86('0x39')](function(_0x10f964){_0x598fd5['rows']=_0x10f964;return _0x598fd5;});}})[_0x4e86('0x39')](respondWithFilteredResult(_0x2dda74,_0x536add))[_0x4e86('0x2a')](handleError(_0x2dda74,null));};exports[_0x4e86('0x71')]=function(_0x4f110d,_0x52138d,_0x4fb90c){return db[_0x4e86('0x42')]['find']({'where':{'id':_0x4f110d[_0x4e86('0x65')]['id']}})['then'](handleEntityNotFound(_0x52138d,null))[_0x4e86('0x39')](function(_0x3fe738){if(_0x3fe738){return _0x3fe738[_0x4e86('0x71')](_0x4f110d['query'][_0x4e86('0x6d')]);}})[_0x4e86('0x39')](respondWithStatusCode(_0x52138d,null))[_0x4e86('0x2a')](handleError(_0x52138d,null));};exports[_0x4e86('0x72')]=function(_0x4e7fa0,_0x44fc44,_0x216959){var _0x143dad={'body':_0x4e7fa0[_0x4e86('0x5e')],'channel':_0x4e86('0x73')};var _0x440e8f=[];var _0x5edb6f=[];var _0xba1990={};var _0x5f57ea=![];return db[_0x4e86('0x74')][_0x4e86('0x66')]()[_0x4e86('0x39')](function(_0xb6b692){if(!_0xb6b692){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x440e8f=_['difference'](_[_0x4e86('0x48')](_0xb6b692),[_0x4e86('0x75'),_0x4e86('0x76')]);_0x5edb6f=_[_0x4e86('0x77')](_['keys'](_0xb6b692),[_0x4e86('0x75'),'updatedAt',_0x4e86('0x78'),'ListId']);if(_0x4e7fa0[_0x4e86('0x5e')]['id']){delete _0x4e7fa0[_0x4e86('0x5e')]['id'];}if(_[_0x4e86('0x79')](_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7a')])){throw new db[(_0x4e86('0x7b'))][(_0x4e86('0x7c'))](_0x4e86('0x7d'));}if(_['isNil'](_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x5e')])||_0x4e7fa0['body']['body']===''){throw new db[(_0x4e86('0x7b'))][(_0x4e86('0x7c'))](_0x4e86('0x7e'));}if(_[_0x4e86('0x79')](_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7f')])){throw new db['Sequelize']['ValidationError'](_0x4e86('0x80')+_0x5edb6f);}if(!_[_0x4e86('0x81')](_0x5edb6f,_0x4e7fa0[_0x4e86('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5edb6f);}_0xba1990[_0x4e7fa0[_0x4e86('0x5e')]['mapKey']]=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7a')];})[_0x4e86('0x39')](function(){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x4e7fa0['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4e86('0x74')],'as':_0x4e86('0x82'),'where':_0xba1990,'limit':0x1,'order':[[_0x4e86('0x76'),_0x4e86('0x83')]]}]},{'model':db[_0x4e86('0x84')],'as':_0x4e86('0x85')}]});})[_0x4e86('0x39')](handleEntityNotFound(_0x44fc44,null))[_0x4e86('0x39')](function(_0xb412e4){if(_0xb412e4&&_0xb412e4[_0x4e86('0x86')]){_0x143dad[_0x4e86('0x87')]=_0xb412e4;_0x143dad[_0x4e86('0x88')]=_0xb412e4['Applications'];_0x143dad[_0x4e86('0x89')]=_0xb412e4[_0x4e86('0x86')];_0x143dad[_0x4e86('0x88')]=_['orderBy'](_0x143dad['applications'],[_0x4e86('0x8a')],[_0x4e86('0x8b')]);if(_0x143dad[_0x4e86('0x87')][_0x4e86('0x85')]){delete _0x143dad[_0x4e86('0x87')][_0x4e86('0x85')];}if(_0x143dad['account']['List']&&_0x143dad['account'][_0x4e86('0x86')][_0x4e86('0x82')][_0x4e86('0x5b')]){return _0x143dad[_0x4e86('0x87')][_0x4e86('0x86')][_0x4e86('0x82')][0x0];}var _0x2812d2=_[_0x4e86('0x8c')](_0x4e7fa0[_0x4e86('0x5e')],{'firstName':_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7a')],'ListId':_0xb412e4[_0x4e86('0x8d')]});_0x2812d2[_0x4e7fa0['body'][_0x4e86('0x7f')]]=_0x4e7fa0[_0x4e86('0x5e')]['from'];return db[_0x4e86('0x74')][_0x4e86('0x5d')](_0x2812d2,{'fields':_0x440e8f,'raw':!![]});}})[_0x4e86('0x39')](handleEntityNotFound(_0x44fc44,null))[_0x4e86('0x39')](function(_0x5d06f3){_0x143dad[_0x4e86('0x8e')]=_0x5d06f3;if(_0x5d06f3){var _0x5396ab={'ContactId':_0x5d06f3['id'],'OpenchannelAccountId':_0x4e7fa0[_0x4e86('0x65')]['id'],'from':(_0x5d06f3[_0x4e86('0x8f')]||'')+'\x20'+(_0x5d06f3[_0x4e86('0x90')]||'')};var _0x106a90={'OpenchannelAccountId':_0x4e7fa0[_0x4e86('0x65')]['id'],'closed':![]};if(_0x4e7fa0['body'][_0x4e86('0x91')]){_0x106a90[_0x4e86('0x91')]=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x91')];return db['OpenchannelInteraction']['find']({'where':_0x106a90})[_0x4e86('0x39')](function(_0x3593bf){if(_0x3593bf){return[_0x3593bf,![]];}_0x5396ab['threadId']=_0x4e7fa0['body'][_0x4e86('0x91')];_0x5396ab[_0x4e86('0x92')]=_0x4e7fa0[_0x4e86('0x5e')]['externalUrl'];return db[_0x4e86('0x93')][_0x4e86('0x5d')](_0x5396ab)[_0x4e86('0x39')](function(_0x16a25e){return[_0x16a25e,!![]];});});}else{_0x106a90['threadId']=null;}_0x106a90[_0x4e86('0x94')]=_0x5d06f3['id'];return db[_0x4e86('0x93')]['find']({'where':_0x106a90})['then'](function(_0x23b37b){if(_0x23b37b){return[_0x23b37b,![]];}return db[_0x4e86('0x93')][_0x4e86('0x5d')](_0x5396ab)[_0x4e86('0x39')](function(_0x188408){return[_0x188408,!![]];});});}})[_0x4e86('0x95')](function(_0x5ea112,_0x6645aa){if(_0x5ea112){_0x5f57ea=_0x6645aa;if(!_0x6645aa){var _0x10dc89={'from':(_0x143dad[_0x4e86('0x8e')][_0x4e86('0x8f')]||'')+'\x20'+(_0x143dad[_0x4e86('0x8e')][_0x4e86('0x90')]||'')};if(_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x91')]&&_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x96')]&&_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x91')]!=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x96')]){_0x10dc89[_0x4e86('0x91')]=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x96')];}return _0x5ea112[_0x4e86('0x37')](_0x10dc89);}else{return _0x5ea112;}}})[_0x4e86('0x39')](function(_0x1dc21c){_0x143dad[_0x4e86('0x97')]=_0x1dc21c['get']({'plain':!![]});_0x143dad[_0x4e86('0x97')][_0x4e86('0x98')]=_0x5f57ea;if(_0x143dad['interaction'][_0x4e86('0x98')]){if(_0x143dad[_0x4e86('0x87')][_0x4e86('0x99')]){_0x143dad[_0x4e86('0x88')][_0x4e86('0x9a')]({'id':0x0,'priority':_0x143dad['applications'][_0x4e86('0x5b')]+0x1,'app':_0x4e86('0x9b'),'appdata':_0x4e86('0x9c'),'interval':_0x4e86('0x9d')});}}return db[_0x4e86('0x9e')][_0x4e86('0x5d')]({'body':_0x4e7fa0['body'][_0x4e86('0x5e')],'OpenchannelAccountId':_0x4e7fa0[_0x4e86('0x65')]['id'],'OpenchannelInteractionId':_0x1dc21c['id'],'direction':'in','ContactId':_0x143dad[_0x4e86('0x8e')]['id'],'AttachmentId':_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x9f')]});})[_0x4e86('0x39')](function(_0x5bc912){_0x143dad[_0x4e86('0x26')]=_0x5bc912;if(!_0x143dad['interaction'][_0x4e86('0xa0')])return;return db[_0x4e86('0xa1')][_0x4e86('0x5c')]({'attributes':['id',_0x4e86('0x3e')],'where':{'id':_0x143dad[_0x4e86('0x97')][_0x4e86('0xa0')]}});})[_0x4e86('0x39')](function(_0x4535b9){if(_0x4535b9){_0x143dad[_0x4e86('0x88')][_0x4e86('0xa2')]({'id':0x0,'priority':0x0,'app':_0x4e86('0xa3'),'appdata':_0x4535b9[_0x4e86('0x3e')]+','+(_0x143dad['account'][_0x4e86('0xa4')]||0xa),'interval':_0x4e86('0x9d')});}if(!_0x143dad['interaction']['queueId'])return;return db[_0x4e86('0xa5')][_0x4e86('0x5c')]({'attributes':['id','name'],'where':{'id':_0x143dad[_0x4e86('0x97')][_0x4e86('0xa6')]}});})[_0x4e86('0x39')](function(_0x31791e){if(_0x31791e){_0x143dad[_0x4e86('0x88')][_0x4e86('0xa2')]({'id':0x0,'priority':0x1,'app':_0x4e86('0xa7'),'appdata':_0x31791e['name']+','+(_0x143dad[_0x4e86('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':_0x4e86('0x9d')});}return respondWithRpcPromise(_0x4e86('0xa8'),'startRouting',_0x143dad);})[_0x4e86('0x39')](function(_0x30073f){respondWithRpcPromise('EventManager','EventManager',{'event':_0x4e86('0x72'),'message':_0x30073f},client9002);return _0x30073f;})[_0x4e86('0x39')](respondWithResult(_0x44fc44,null))[_0x4e86('0x2a')](handleError(_0x44fc44,null));};exports['addApplications']=function(_0x264549,_0x4d6206){var _0x247b51=_0x264549['params']['id'];var _0x51d7b7=_0x264549[_0x4e86('0x5e')];var _0x37d50d=0xc8;var _0x5eed48=null;return db[_0x4e86('0xa9')]['transaction']({'isolationLevel':db[_0x4e86('0xa9')][_0x4e86('0xaa')]['ISOLATION_LEVELS'][_0x4e86('0xab')]},function(_0x4183c1){return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x247b51},'transaction':_0x4183c1})[_0x4e86('0x39')](function(_0x1ec902){if(_0x1ec902){return db[_0x4e86('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0x247b51},'transaction':_0x4183c1})[_0x4e86('0x39')](function(){var _0x1871b9=_[_0x4e86('0x41')](_0x51d7b7,function(_0x1e5fe6){_0x1e5fe6[_0x4e86('0x67')]=_0x247b51;return _0x1e5fe6;});return db[_0x4e86('0x84')]['bulkCreate'](_0x1871b9,{'transaction':_0x4183c1});});}else{_0x37d50d=0x194;_0x5eed48=[];}});})[_0x4e86('0x39')](function(){if(_0x37d50d!==0x194){return db[_0x4e86('0x84')][_0x4e86('0xac')]({'where':{'OpenchannelAccountId':_0x247b51},'order':'priority'})[_0x4e86('0x39')](function(_0x5291e7){_0x5eed48=_0x5291e7;});}})['catch'](function(_0x578028){_0x37d50d=0x1f4;logger[_0x4e86('0x24')](_0x578028[_0x4e86('0x3d')]);if(_0x578028[_0x4e86('0x3e')]){delete _0x578028[_0x4e86('0x3e')];}_0x5eed48=_0x578028;})[_0x4e86('0xad')](function(){if(_0x5eed48===null){_0x4d6206[_0x4e86('0x2b')](_0x37d50d);}else{if(_0x37d50d===0x1f4){_0x4d6206['status'](_0x37d50d)[_0x4e86('0xae')](_0x5eed48);}else{_0x4d6206[_0x4e86('0x2c')](_0x37d50d)['json'](_0x5eed48);}}});};exports[_0x4e86('0xaf')]=function(_0x466e23,_0x3edc6c,_0x331168){var _0x1e4da8={};var _0x334fcf={};var _0x5d2d23;var _0x1f44c3;return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x466e23['params']['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x3edc6c,null))['then'](function(_0x490713){if(_0x490713){_0x5d2d23=_0x490713;_0x334fcf[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x84')][_0x4e86('0x43')]);_0x334fcf[_0x4e86('0x49')]=_[_0x4e86('0x48')](_0x466e23[_0x4e86('0x49')]);_0x334fcf[_0x4e86('0x52')]=_['intersection'](_0x334fcf['model'],_0x334fcf[_0x4e86('0x49')]);_0x1e4da8['attributes']=_[_0x4e86('0x4a')](_0x334fcf[_0x4e86('0x47')],qs[_0x4e86('0x4c')](_0x466e23[_0x4e86('0x49')]['fields']));_0x1e4da8[_0x4e86('0x4b')]=_0x1e4da8[_0x4e86('0x4b')][_0x4e86('0x5b')]?_0x1e4da8['attributes']:_0x334fcf[_0x4e86('0x47')];_0x1e4da8[_0x4e86('0x4f')]=qs[_0x4e86('0x50')](_0x466e23[_0x4e86('0x49')][_0x4e86('0x50')]);_0x1e4da8['where']=qs[_0x4e86('0x52')](_[_0x4e86('0x70')](_0x466e23['query'],_0x334fcf[_0x4e86('0x52')]));if(_0x466e23['query'][_0x4e86('0x54')]){_0x1e4da8[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x1e4da8[_0x4e86('0x51')],{'$or':_['map'](_0x1e4da8[_0x4e86('0x4b')],function(_0x4c9540){var _0x452ad3={};_0x452ad3[_0x4c9540]={'$like':'%'+_0x466e23['query'][_0x4e86('0x54')]+'%'};return _0x452ad3;})});}_0x1e4da8=_['merge']({},_0x1e4da8,_0x466e23[_0x4e86('0x55')]);return _0x5d2d23[_0x4e86('0xaf')](_0x1e4da8);}})[_0x4e86('0x39')](function(_0x52228f){if(_0x52228f){_0x1f44c3=_0x52228f[_0x4e86('0x5b')];if(!_0x466e23[_0x4e86('0x49')][_0x4e86('0x4d')](_0x4e86('0x4e'))){_0x1e4da8[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x466e23[_0x4e86('0x49')][_0x4e86('0x30')]);_0x1e4da8[_0x4e86('0x2e')]=qs['offset'](_0x466e23['query'][_0x4e86('0x2e')]);}return _0x5d2d23[_0x4e86('0xaf')](_0x1e4da8);}})[_0x4e86('0x39')](function(_0x4d2bfe){if(_0x4d2bfe){return _0x4d2bfe?{'count':_0x1f44c3,'rows':_0x4d2bfe}:null;}})[_0x4e86('0x39')](respondWithResult(_0x3edc6c,null))[_0x4e86('0x2a')](handleError(_0x3edc6c,null));};exports[_0x4e86('0xb0')]=function(_0xb83cb5,_0x272bd2,_0x2438c8){var _0x1f9a42={'raw':![],'where':{}};var _0x4a42b0={};var _0x42f453={'count':0x0,'rows':[]};return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0xb83cb5[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x272bd2,null))[_0x4e86('0x39')](function(_0x50d2fa){if(_0x50d2fa){_0x4a42b0[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x93')][_0x4e86('0x43')]);_0x4a42b0['query']=_[_0x4e86('0x48')](_0xb83cb5[_0x4e86('0x49')]);_0x4a42b0['filters']=_[_0x4e86('0x4a')](_0x4a42b0['model'],_0x4a42b0[_0x4e86('0x49')]);_0x1f9a42[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x4a42b0['model'],qs['fields'](_0xb83cb5['query'][_0x4e86('0x4c')]));_0x1f9a42[_0x4e86('0x4b')]=_0x1f9a42['attributes'][_0x4e86('0x5b')]?_0x1f9a42[_0x4e86('0x4b')]:_0x4a42b0[_0x4e86('0x47')];if(!_0xb83cb5[_0x4e86('0x49')]['hasOwnProperty'](_0x4e86('0x4e'))){_0x1f9a42[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0xb83cb5[_0x4e86('0x49')]['limit']);_0x1f9a42['offset']=qs[_0x4e86('0x2e')](_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x2e')]);}_0x1f9a42[_0x4e86('0x4f')]=qs['sort'](_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x50')]);_0x1f9a42['where']=qs['filters'](_[_0x4e86('0x70')](_0xb83cb5[_0x4e86('0x49')],_0x4a42b0[_0x4e86('0x52')]));_0x1f9a42['where'][_0x4e86('0x67')]=_0x50d2fa['id'];if(_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x54')]){_0x1f9a42[_0x4e86('0x51')]=_['merge'](_0x1f9a42[_0x4e86('0x51')],{'$or':_['map'](_0x1f9a42[_0x4e86('0x4b')],function(_0x5d3d01){var _0x4e94cc={};_0x4e94cc[_0x5d3d01]={'$like':'%'+_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0x4e94cc;})});}_0x1f9a42=_[_0x4e86('0x53')]({},_0x1f9a42,_0xb83cb5[_0x4e86('0x55')]);return db[_0x4e86('0x93')][_0x4e86('0x31')]({'where':_0x1f9a42[_0x4e86('0x51')]})[_0x4e86('0x39')](function(_0x80e38a){_0x42f453['count']=_0x80e38a;if(_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x56')]){_0x1f9a42[_0x4e86('0x57')]=[{'model':db[_0x4e86('0x74')],'as':_0x4e86('0xb1'),'required':![]},{'model':db['User'],'as':_0x4e86('0xb2'),'attributes':[_0x4e86('0x3e'),_0x4e86('0xb3'),_0x4e86('0xb4')],'required':![]},{'model':db[_0x4e86('0xb5')],'as':'Tags','attributes':['id',_0x4e86('0x3e'),_0x4e86('0xb6')],'where':_0xb83cb5[_0x4e86('0x49')][_0x4e86('0xb7')]?{'id':_0xb83cb5[_0x4e86('0x49')][_0x4e86('0xb7')]}:undefined,'required':_0xb83cb5[_0x4e86('0x49')][_0x4e86('0xb7')]?!![]:![]}];}return db[_0x4e86('0x93')][_0x4e86('0x6b')](_0x1f9a42);})[_0x4e86('0x39')](function(_0x3f13fc){_0x42f453[_0x4e86('0x58')]=_0x3f13fc;return _0x42f453;});}})['then'](respondWithFilteredResult(_0x272bd2,_0x1f9a42))['catch'](handleError(_0x272bd2,null));};exports[_0x4e86('0xb8')]=function(_0x1343bd,_0x305e2e,_0x3e3745){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x1343bd[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x305e2e,null))['then'](function(_0x3f4390){if(_0x3f4390){return _0x3f4390['addAgents'](_0x1343bd[_0x4e86('0x5e')]['ids'],_[_0x4e86('0xb9')](_0x1343bd['body'],['ids','id'])||{})['spread'](function(_0x5192a8){for(var _0x26889e=0x0;_0x26889e<_0x1343bd[_0x4e86('0x5e')][_0x4e86('0x6d')][_0x4e86('0x5b')];_0x26889e+=0x1){socket['emit'](_0x4e86('0xba'),{'UserId':Number(_0x1343bd[_0x4e86('0x5e')][_0x4e86('0x6d')][_0x26889e]),'OpenchannelAccountId':Number(_0x1343bd['params']['id'])});}return _0x5192a8;});}})['then'](respondWithResult(_0x305e2e,null))[_0x4e86('0x2a')](handleError(_0x305e2e,null));};exports[_0x4e86('0xbb')]=function(_0x59b742,_0x38d7b7,_0x37f0e2){return db['OpenchannelAccount'][_0x4e86('0x5c')]({'where':{'id':_0x59b742[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x38d7b7,null))[_0x4e86('0x39')](function(_0x2b7acd){if(_0x2b7acd){return _0x2b7acd[_0x4e86('0xbb')](_0x59b742[_0x4e86('0x49')][_0x4e86('0x6d')])[_0x4e86('0x39')](function(){if(_[_0x4e86('0xbc')](_0x59b742[_0x4e86('0x49')]['ids'])){for(var _0xabdfd8=0x0;_0xabdfd8<_0x59b742[_0x4e86('0x49')][_0x4e86('0x6d')][_0x4e86('0x5b')];_0xabdfd8+=0x1){socket[_0x4e86('0xbd')](_0x4e86('0xbe'),{'UserId':Number(_0x59b742[_0x4e86('0x49')][_0x4e86('0x6d')][_0xabdfd8]),'OpenchannelAccountId':Number(_0x59b742[_0x4e86('0x65')]['id'])});}}else{socket[_0x4e86('0xbd')]('userOpenchannelAccount:remove',{'UserId':Number(_0x59b742['query'][_0x4e86('0x6d')]),'OpenchannelAccountId':Number(_0x59b742[_0x4e86('0x65')]['id'])});}});}})[_0x4e86('0x39')](respondWithStatusCode(_0x38d7b7,null))[_0x4e86('0x2a')](handleError(_0x38d7b7,null));};exports[_0x4e86('0xbf')]=function(_0x59a6c7,_0x58ae84,_0x34f538){var _0x11db36={};var _0x52b8cf={};var _0x53a300;var _0xf119ed;return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x59a6c7[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x58ae84,null))['then'](function(_0x2d463b){if(_0x2d463b){_0x53a300=_0x2d463b;_0x52b8cf['model']=_[_0x4e86('0x48')](db['User']['rawAttributes']);_0x52b8cf['query']=_[_0x4e86('0x48')](_0x59a6c7['query']);_0x52b8cf[_0x4e86('0x52')]=_['intersection'](_0x52b8cf[_0x4e86('0x47')],_0x52b8cf[_0x4e86('0x49')]);_0x11db36['attributes']=_[_0x4e86('0x4a')](_0x52b8cf['model'],qs[_0x4e86('0x4c')](_0x59a6c7['query'][_0x4e86('0x4c')]));_0x11db36['attributes']=_0x11db36[_0x4e86('0x4b')][_0x4e86('0x5b')]?_0x11db36[_0x4e86('0x4b')]:_0x52b8cf[_0x4e86('0x47')];_0x11db36[_0x4e86('0x4f')]=qs[_0x4e86('0x50')](_0x59a6c7[_0x4e86('0x49')][_0x4e86('0x50')]);_0x11db36[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_[_0x4e86('0x70')](_0x59a6c7[_0x4e86('0x49')],_0x52b8cf[_0x4e86('0x52')]));if(_0x59a6c7[_0x4e86('0x49')][_0x4e86('0x54')]){_0x11db36[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x11db36[_0x4e86('0x51')],{'$or':_[_0x4e86('0x41')](_0x11db36[_0x4e86('0x4b')],function(_0x28146e){var _0x24dab3={};_0x24dab3[_0x28146e]={'$like':'%'+_0x59a6c7[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0x24dab3;})});}_0x11db36=_['merge']({},_0x11db36,_0x59a6c7[_0x4e86('0x55')]);return _0x53a300[_0x4e86('0xbf')](_0x11db36);}})[_0x4e86('0x39')](function(_0x132d5e){if(_0x132d5e){_0xf119ed=_0x132d5e[_0x4e86('0x5b')];if(!_0x59a6c7[_0x4e86('0x49')]['hasOwnProperty']('nolimit')){_0x11db36[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x59a6c7[_0x4e86('0x49')]['limit']);_0x11db36['offset']=qs[_0x4e86('0x2e')](_0x59a6c7[_0x4e86('0x49')]['offset']);}return _0x53a300[_0x4e86('0xbf')](_0x11db36);}})['then'](function(_0x591eb2){if(_0x591eb2){return _0x591eb2?{'count':_0xf119ed,'rows':_0x591eb2}:null;}})[_0x4e86('0x39')](respondWithResult(_0x58ae84,null))[_0x4e86('0x2a')](handleError(_0x58ae84,null));};exports[_0x4e86('0xae')]=function(_0x1eeb0e,_0x2592f6,_0x267405){var _0x442f02,_0x54a282,_0x57fdae;if(_[_0x4e86('0x79')](_0x1eeb0e['body'][_0x4e86('0x5e')])||_0x1eeb0e[_0x4e86('0x5e')][_0x4e86('0x5e')]===''){throw new db['Sequelize'][(_0x4e86('0x7c'))](_0x4e86('0x7e'));}if(_[_0x4e86('0x79')](_0x1eeb0e['body']['to'])){}_0x442f02=_0x1eeb0e[_0x4e86('0x5e')]['to'];return db['OpenchannelAccount'][_0x4e86('0x6a')]({'where':{'id':_0x1eeb0e['params']['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x2592f6,null))[_0x4e86('0x39')](function(_0x408ee5){if(_0x408ee5){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x408ee5['id']},'include':[{'model':db['CmList'],'as':_0x4e86('0x86'),'include':[{'model':db[_0x4e86('0x74')],'as':_0x4e86('0x82'),'where':{[_0x408ee5[_0x4e86('0x7f')]]:_0x442f02},'limit':0x1,'order':[['updatedAt',_0x4e86('0x83')]]}]}]})[_0x4e86('0x39')](handleEntityNotFound(_0x2592f6,null))[_0x4e86('0x39')](function(_0x190153){if(_0x190153&&_0x190153[_0x4e86('0x86')]){_0x54a282=_0x190153[_0x4e86('0x3a')]({'plain':!![]});if(_0x54a282['List']&&_0x54a282[_0x4e86('0x86')]['Contacts'][_0x4e86('0x5b')]){return _0x54a282['List']['Contacts'][0x0];}return db['CmContact'][_0x4e86('0x5d')](_['defaults'](_0x1eeb0e[_0x4e86('0x5e')],{'firstName':_0x442f02,[_0x190153[_0x4e86('0x7f')]]:_0x442f02,'phone':_0x442f02,'ListId':_0x54a282[_0x4e86('0x8d')]}));}})[_0x4e86('0x39')](handleEntityNotFound(_0x2592f6,null))[_0x4e86('0x39')](function(_0x3750e){if(_0x3750e){_0x57fdae=_0x3750e;return db['OpenchannelInteraction'][_0x4e86('0x5c')]({'where':{'ContactId':_0x57fdae['id'],'closed':![],'OpenchannelAccountId':_0x54a282['id']}})[_0x4e86('0x39')](function(_0x296bc0){if(_0x296bc0){return[_0x296bc0,![]];}return db['OpenchannelInteraction'][_0x4e86('0x5d')]({'UserId':_0x1eeb0e['user']['id'],'ContactId':_0x57fdae['id'],'OpenchannelAccountId':_0x54a282['id'],'lastMsgDirection':_0x4e86('0xc0'),'firstMsgDirection':_0x4e86('0xc0'),'Messages':[_[_0x4e86('0x53')](_0x1eeb0e[_0x4e86('0x5e')],{'read':![],'body':_0x1eeb0e[_0x4e86('0x5e')][_0x4e86('0x5e')],'OpenchannelAccountId':_0x54a282['id'],'UserId':_0x1eeb0e[_0x4e86('0x5f')]['id'],'ContactId':_0x57fdae['id']})]},{'include':[{'model':db[_0x4e86('0x9e')],'as':_0x4e86('0xc1')}]})['then'](function(_0x1fe947){return[_0x1fe947,!![]];});});}})[_0x4e86('0x95')](function(_0xcb9fcf,_0x29bae9){if(_0x29bae9){return _0xcb9fcf;}return db[_0x4e86('0x9e')][_0x4e86('0x5d')](_[_0x4e86('0x53')](_0x1eeb0e[_0x4e86('0x5e')],{'read':![],'body':_0x1eeb0e[_0x4e86('0x5e')]['body'],'OpenchannelAccountId':_0x54a282['id'],'OpenchannelInteractionId':_0xcb9fcf['id'],'UserId':_0x1eeb0e[_0x4e86('0x5f')]['id'],'ContactId':_0x57fdae['id']}))[_0x4e86('0x39')](function(_0xe8215a){_0xcb9fcf[_0x4e86('0xc2')][_0x4e86('0xc1')]=[];_0xcb9fcf[_0x4e86('0xc2')][_0x4e86('0xc1')][_0x4e86('0x9a')](_0xe8215a['dataValues']);return _0xcb9fcf;});});}})['then'](respondWithResult(_0x2592f6,null))[_0x4e86('0x2a')](handleError(_0x2592f6,null));}; \ No newline at end of file +var _0xe641=['find','userProfileId','autoAssociation','UserProfileResource','body','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','nolimit','CannedAnswer','removeAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','DESC','OpenchannelApplication','Applications','account','applications','list','priority','Contacts','from','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','OpenchannelAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','OpenchannelAccount','findAll','catch','show','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection'];(function(_0x44450c,_0x39f7e0){var _0x4e53ad=function(_0x578047){while(--_0x578047){_0x44450c['push'](_0x44450c['shift']());}};_0x4e53ad(++_0x39f7e0);}(_0xe641,0x1ec));var _0x1e64=function(_0x31919b,_0x41056d){_0x31919b=_0x31919b-0x0;var _0x29e2f1=_0xe641[_0x31919b];return _0x29e2f1;};'use strict';var emlformat=require(_0x1e64('0x0'));var rimraf=require(_0x1e64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e64('0x2'));var rp=require(_0x1e64('0x3'));var moment=require(_0x1e64('0x4'));var BPromise=require(_0x1e64('0x5'));var Mustache=require(_0x1e64('0x6'));var util=require(_0x1e64('0x7'));var path=require(_0x1e64('0x8'));var sox=require(_0x1e64('0x9'));var csv=require(_0x1e64('0xa'));var ejs=require(_0x1e64('0xb'));var fs=require('fs');var fs_extra=require(_0x1e64('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e64('0xd'));var jsforce=require(_0x1e64('0xe'));var deskjs=require(_0x1e64('0xf'));var toCsv=require(_0x1e64('0xa'));var querystring=require(_0x1e64('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e64('0x11'));var authService=require(_0x1e64('0x12'));var qs=require(_0x1e64('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e64('0x14'))(_0x1e64('0x15'));var utils=require(_0x1e64('0x16'));var config=require(_0x1e64('0x17'));var licenseUtil=require(_0x1e64('0x18'));var db=require('../../mysqldb')['db'];config[_0x1e64('0x19')]=_[_0x1e64('0x1a')](config[_0x1e64('0x19')],{'host':_0x1e64('0x1b'),'port':0x18eb});var socket=require(_0x1e64('0x1c'))(new Redis(config[_0x1e64('0x19')]));require(_0x1e64('0x1d'))[_0x1e64('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1e64('0x1f')][_0x1e64('0x20')]({'port':0x232c});var client9002=jayson[_0x1e64('0x1f')][_0x1e64('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x16b1b2,_0x3a513c,_0x566fb5,_0x55e83f){return new BPromise(function(_0x4d2e35,_0x7cc083){var _0x2a48e2=_0x55e83f||client;return _0x2a48e2[_0x1e64('0x21')](_0x16b1b2,_0x566fb5)[_0x1e64('0x22')](function(_0x2ffddf){logger['info'](_0x1e64('0x23'),_0x3a513c,_0x1e64('0x24'));logger[_0x1e64('0x25')](_0x1e64('0x26'),_0x3a513c,'request\x20sent',JSON[_0x1e64('0x27')](_0x2ffddf));if(_0x2ffddf['error']){if(_0x2ffddf[_0x1e64('0x28')][_0x1e64('0x29')]===0x1f4){logger[_0x1e64('0x28')](_0x1e64('0x23'),_0x3a513c,_0x2ffddf[_0x1e64('0x28')]['message']);return _0x7cc083(_0x2ffddf[_0x1e64('0x28')][_0x1e64('0x2a')]);}logger[_0x1e64('0x28')](_0x1e64('0x23'),_0x3a513c,_0x2ffddf[_0x1e64('0x28')][_0x1e64('0x2a')]);return _0x4d2e35(_0x2ffddf['error'][_0x1e64('0x2a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3a513c,'request\x20sent');_0x4d2e35(_0x2ffddf[_0x1e64('0x2b')][_0x1e64('0x2a')]);}})['catch'](function(_0x546f30){logger[_0x1e64('0x28')](_0x1e64('0x23'),_0x3a513c,_0x546f30);_0x7cc083(_0x546f30);});});}function respondWithStatusCode(_0x7b7f9b,_0x135131){_0x135131=_0x135131||0xcc;return function(_0x3427d3){if(_0x3427d3){return _0x7b7f9b['sendStatus'](_0x135131);}return _0x7b7f9b[_0x1e64('0x2c')](_0x135131)[_0x1e64('0x2d')]();};}function respondWithResult(_0x1d0e78,_0x3956a6){_0x3956a6=_0x3956a6||0xc8;return function(_0x278325){if(_0x278325){return _0x1d0e78[_0x1e64('0x2c')](_0x3956a6)[_0x1e64('0x2e')](_0x278325);}};}function respondWithFilteredResult(_0x23abcb,_0x5d79f6){return function(_0x4f861a){if(_0x4f861a){var _0x49f0c5=typeof _0x5d79f6[_0x1e64('0x2f')]===_0x1e64('0x30')&&typeof _0x5d79f6[_0x1e64('0x31')]===_0x1e64('0x30');var _0xdfc268=_0x4f861a[_0x1e64('0x32')];var _0x114cf9=_0x49f0c5?0x0:_0x5d79f6['offset'];var _0x23a32c=_0x49f0c5?_0x4f861a['count']:_0x5d79f6[_0x1e64('0x2f')]+_0x5d79f6[_0x1e64('0x31')];var _0x423bfe;if(_0x23a32c>=_0xdfc268){_0x23a32c=_0xdfc268;_0x423bfe=0xc8;}else{_0x423bfe=0xce;}_0x23abcb[_0x1e64('0x2c')](_0x423bfe);return _0x23abcb[_0x1e64('0x33')]('Content-Range',_0x114cf9+'-'+_0x23a32c+'/'+_0xdfc268)[_0x1e64('0x2e')](_0x4f861a);}return null;};}function patchUpdates(_0x527a8f){return function(_0x58f21a){try{jsonpatch[_0x1e64('0x34')](_0x58f21a,_0x527a8f,!![]);}catch(_0x3dce3b){return BPromise[_0x1e64('0x35')](_0x3dce3b);}return _0x58f21a[_0x1e64('0x36')]();};}function saveUpdates(_0x28ba97,_0x1fd1d2){return function(_0x44e3d6){if(_0x44e3d6){return _0x44e3d6[_0x1e64('0x37')](_0x28ba97)[_0x1e64('0x22')](function(_0x467678){return _0x467678;});}return null;};}function removeEntity(_0x5d705e,_0x170bc1){return function(_0x44cc2f){if(_0x44cc2f){return _0x44cc2f[_0x1e64('0x38')]()[_0x1e64('0x22')](function(){var _0x1b2d08=_0x44cc2f['get']({'plain':!![]});var _0x4648b2=_0x1e64('0x39');return db['UserProfileResource'][_0x1e64('0x38')]({'where':{'type':_0x4648b2,'resourceId':_0x1b2d08['id']}})[_0x1e64('0x22')](function(){return _0x44cc2f;});})[_0x1e64('0x22')](function(){_0x5d705e[_0x1e64('0x2c')](0xcc)[_0x1e64('0x2d')]();});}};}function handleEntityNotFound(_0x5dc115,_0x9dd35f){return function(_0x86c9c8){if(!_0x86c9c8){_0x5dc115[_0x1e64('0x3a')](0x194);}return _0x86c9c8;};}function handleError(_0x3f7e75,_0x57b8db){_0x57b8db=_0x57b8db||0x1f4;return function(_0x4cf170){logger[_0x1e64('0x28')](_0x4cf170[_0x1e64('0x3b')]);if(_0x4cf170[_0x1e64('0x3c')]){delete _0x4cf170[_0x1e64('0x3c')];}_0x3f7e75[_0x1e64('0x2c')](_0x57b8db)[_0x1e64('0x3d')](_0x4cf170);};}exports[_0x1e64('0x3e')]=function(_0xce5931,_0x23f08d){var _0x31b120={'include':[{'model':db[_0x1e64('0x3f')],'as':_0x1e64('0x40')}]},_0x4f1e8a={},_0xdf4048={'count':0x0,'rows':[]};var _0x5a84a4=_[_0x1e64('0x41')](db['OpenchannelAccount'][_0x1e64('0x42')],function(_0x2cfa08){return{'name':_0x2cfa08[_0x1e64('0x43')],'type':_0x2cfa08[_0x1e64('0x44')][_0x1e64('0x45')]};});_0x4f1e8a['model']=_['map'](_0x5a84a4,_0x1e64('0x3c'));_0x4f1e8a[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0xce5931['query']);_0x4f1e8a[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x4f1e8a[_0x1e64('0x4a')],_0x4f1e8a[_0x1e64('0x46')]);_0x31b120['attributes']=_[_0x1e64('0x49')](_0x4f1e8a[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0xce5931[_0x1e64('0x46')][_0x1e64('0x4b')]));_0x31b120['attributes']=_0x31b120[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x31b120[_0x1e64('0x4c')]:_0x4f1e8a[_0x1e64('0x4a')];if(!_0xce5931[_0x1e64('0x46')][_0x1e64('0x4e')]('nolimit')){_0x31b120[_0x1e64('0x31')]=qs['limit'](_0xce5931[_0x1e64('0x46')]['limit']);_0x31b120[_0x1e64('0x2f')]=qs[_0x1e64('0x2f')](_0xce5931[_0x1e64('0x46')][_0x1e64('0x2f')]);}_0x31b120[_0x1e64('0x4f')]=qs[_0x1e64('0x50')](_0xce5931[_0x1e64('0x46')][_0x1e64('0x50')]);_0x31b120[_0x1e64('0x51')]=qs['filters'](_[_0x1e64('0x52')](_0xce5931[_0x1e64('0x46')],_0x4f1e8a['filters']),_0x5a84a4);if(_0xce5931[_0x1e64('0x46')][_0x1e64('0x53')]){_0x31b120[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x31b120[_0x1e64('0x51')],{'$or':_['map'](_0x5a84a4,function(_0xd0ee6e){if(_0xd0ee6e[_0x1e64('0x44')]!==_0x1e64('0x55')){var _0x5c889e={};_0x5c889e[_0xd0ee6e[_0x1e64('0x3c')]]={'$like':'%'+_0xce5931['query'][_0x1e64('0x53')]+'%'};return _0x5c889e;}})});}_0x31b120=_['merge']({},_0x31b120,_0xce5931['options']);var _0x2bc7c8={'where':_0x31b120[_0x1e64('0x51')]};return db['OpenchannelAccount']['count'](_0x2bc7c8)[_0x1e64('0x22')](function(_0x490408){_0xdf4048[_0x1e64('0x32')]=_0x490408;if(_0xce5931[_0x1e64('0x46')][_0x1e64('0x56')]){_0x31b120[_0x1e64('0x57')]=[{'all':!![]}];}return db[_0x1e64('0x58')][_0x1e64('0x59')](_0x31b120);})[_0x1e64('0x22')](function(_0x5a4c57){_0xdf4048['rows']=_0x5a4c57;return _0xdf4048;})[_0x1e64('0x22')](respondWithFilteredResult(_0x23f08d,_0x31b120))[_0x1e64('0x5a')](handleError(_0x23f08d,null));};exports[_0x1e64('0x5b')]=function(_0xc6265f,_0x9b4587){var _0xf8467d={'raw':![],'where':{'id':_0xc6265f['params']['id']},'include':[{'model':db[_0x1e64('0x3f')],'as':'mandatoryDispositionPause'}]},_0x29ff02={};_0x29ff02[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db[_0x1e64('0x58')][_0x1e64('0x42')]);_0x29ff02[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0xc6265f[_0x1e64('0x46')]);_0x29ff02['filters']=_[_0x1e64('0x49')](_0x29ff02[_0x1e64('0x4a')],_0x29ff02['query']);_0xf8467d[_0x1e64('0x4c')]=_[_0x1e64('0x49')](_0x29ff02[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0xc6265f['query'][_0x1e64('0x4b')]));_0xf8467d[_0x1e64('0x4c')]=_0xf8467d[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0xf8467d[_0x1e64('0x4c')]:_0x29ff02['model'];if(_0xc6265f[_0x1e64('0x46')][_0x1e64('0x56')]){_0xf8467d[_0x1e64('0x57')]=[{'all':!![]}];}_0xf8467d=_[_0x1e64('0x54')]({},_0xf8467d,_0xc6265f[_0x1e64('0x5c')]);return db[_0x1e64('0x58')]['find'](_0xf8467d)[_0x1e64('0x22')](handleEntityNotFound(_0x9b4587,null))[_0x1e64('0x22')](respondWithResult(_0x9b4587,null))[_0x1e64('0x5a')](handleError(_0x9b4587,null));};exports[_0x1e64('0x5d')]=function(_0x14fe1f,_0x56890a){return db[_0x1e64('0x58')][_0x1e64('0x5d')](_0x14fe1f['body'],{})[_0x1e64('0x22')](function(_0x250d38){var _0x9c92c8=_0x14fe1f[_0x1e64('0x5e')]['get']({'plain':!![]});if(!_0x9c92c8)throw new Error(_0x1e64('0x5f'));if(_0x9c92c8[_0x1e64('0x60')]===_0x1e64('0x5e')){var _0x3fc7e8=_0x250d38[_0x1e64('0x61')]({'plain':!![]});var _0xe17284=_0x1e64('0x39');return db[_0x1e64('0x62')][_0x1e64('0x63')]({'where':{'name':_0xe17284,'userProfileId':_0x9c92c8[_0x1e64('0x64')]},'raw':!![]})[_0x1e64('0x22')](function(_0x4d4ecc){if(_0x4d4ecc&&_0x4d4ecc[_0x1e64('0x65')]===0x0){return db[_0x1e64('0x66')]['create']({'name':_0x3fc7e8[_0x1e64('0x3c')],'resourceId':_0x3fc7e8['id'],'type':_0x4d4ecc['name'],'sectionId':_0x4d4ecc['id']},{})[_0x1e64('0x22')](function(){return _0x250d38;});}else{return _0x250d38;}})[_0x1e64('0x5a')](function(_0x41d24e){logger[_0x1e64('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41d24e);throw _0x41d24e;});}return _0x250d38;})[_0x1e64('0x22')](respondWithResult(_0x56890a,0xc9))[_0x1e64('0x5a')](handleError(_0x56890a,null));};exports[_0x1e64('0x37')]=function(_0x1b9837,_0x5f9425){if(_0x1b9837[_0x1e64('0x67')]['id']){delete _0x1b9837['body']['id'];}return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x1b9837['params']['id']},'include':[{'model':db[_0x1e64('0x3f')],'as':_0x1e64('0x40')}]})['then'](handleEntityNotFound(_0x5f9425,null))['then'](saveUpdates(_0x1b9837[_0x1e64('0x67')],null))['then'](respondWithResult(_0x5f9425,null))[_0x1e64('0x5a')](handleError(_0x5f9425,null));};exports[_0x1e64('0x38')]=function(_0x57295d,_0x31273e){return db['OpenchannelAccount'][_0x1e64('0x63')]({'where':{'id':_0x57295d[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0x31273e,null))[_0x1e64('0x22')](removeEntity(_0x31273e,null))['catch'](handleError(_0x31273e,null));};exports[_0x1e64('0x69')]=function(_0x218e32,_0x5bca91){return db[_0x1e64('0x58')][_0x1e64('0x69')]()['then'](respondWithResult(_0x5bca91,null))[_0x1e64('0x5a')](handleError(_0x5bca91,null));};exports['addDisposition']=function(_0x50e76e,_0x51914c,_0x499228){if(_0x50e76e['body']['id']){delete _0x50e76e[_0x1e64('0x67')]['id'];}return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x50e76e[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x51914c,null))['then'](function(_0x1b3b65){if(_0x1b3b65){_0x50e76e[_0x1e64('0x67')][_0x1e64('0x6a')]=_0x1b3b65['id'];return db[_0x1e64('0x6b')][_0x1e64('0x5d')](_0x50e76e['body']);}})[_0x1e64('0x22')](respondWithResult(_0x51914c,null))[_0x1e64('0x5a')](handleError(_0x51914c,null));};exports[_0x1e64('0x6c')]=function(_0x113648,_0x3d2171,_0x4c3b1d){var _0x1ffc65={'raw':![],'where':{}};var _0x2f0848={};var _0x3e464c={'count':0x0,'rows':[]};return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x113648[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x3d2171,null))[_0x1e64('0x22')](function(_0x121a56){if(_0x121a56){_0x2f0848['model']=_[_0x1e64('0x47')](db[_0x1e64('0x6b')][_0x1e64('0x42')]);_0x2f0848[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0x113648[_0x1e64('0x46')]);_0x2f0848[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x2f0848[_0x1e64('0x4a')],_0x2f0848[_0x1e64('0x46')]);_0x1ffc65[_0x1e64('0x4c')]=_['intersection'](_0x2f0848['model'],qs[_0x1e64('0x4b')](_0x113648[_0x1e64('0x46')]['fields']));_0x1ffc65['attributes']=_0x1ffc65[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x1ffc65[_0x1e64('0x4c')]:_0x2f0848['model'];if(!_0x113648['query'][_0x1e64('0x4e')]('nolimit')){_0x1ffc65[_0x1e64('0x31')]=qs[_0x1e64('0x31')](_0x113648['query'][_0x1e64('0x31')]);_0x1ffc65[_0x1e64('0x2f')]=qs['offset'](_0x113648['query'][_0x1e64('0x2f')]);}_0x1ffc65[_0x1e64('0x4f')]=qs['sort'](_0x113648['query'][_0x1e64('0x50')]);_0x1ffc65['where']=qs[_0x1e64('0x48')](_[_0x1e64('0x52')](_0x113648[_0x1e64('0x46')],_0x2f0848[_0x1e64('0x48')]));_0x1ffc65[_0x1e64('0x51')][_0x1e64('0x6a')]=_0x121a56['id'];if(_0x113648[_0x1e64('0x46')][_0x1e64('0x53')]){_0x1ffc65[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x1ffc65[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x1ffc65[_0x1e64('0x4c')],function(_0x76db66){var _0x449513={};_0x449513[_0x76db66]={'$like':'%'+_0x113648[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0x449513;})});}_0x1ffc65=_[_0x1e64('0x54')]({},_0x1ffc65,_0x113648['options']);return db['Disposition'][_0x1e64('0x32')]({'where':_0x1ffc65['where']})[_0x1e64('0x22')](function(_0xd53a44){_0x3e464c[_0x1e64('0x32')]=_0xd53a44;if(_0x113648[_0x1e64('0x46')]['includeAll']){_0x1ffc65['include']=[{'all':!![]}];}return db[_0x1e64('0x6b')][_0x1e64('0x59')](_0x1ffc65);})[_0x1e64('0x22')](function(_0x245bf4){_0x3e464c[_0x1e64('0x6e')]=_0x245bf4;return _0x3e464c;});}})[_0x1e64('0x22')](respondWithFilteredResult(_0x3d2171,_0x1ffc65))[_0x1e64('0x5a')](handleError(_0x3d2171,null));};exports['removeDispositions']=function(_0x29800b,_0x1bd4ad,_0x1d0d71){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x29800b['params']['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x1bd4ad,null))[_0x1e64('0x22')](function(_0x26f396){if(_0x26f396){return _0x26f396[_0x1e64('0x6f')](_0x29800b[_0x1e64('0x46')][_0x1e64('0x70')]);}})[_0x1e64('0x22')](respondWithStatusCode(_0x1bd4ad,null))[_0x1e64('0x5a')](handleError(_0x1bd4ad,null));};exports[_0x1e64('0x71')]=function(_0x436f1,_0x4aad56,_0x434a92){if(_0x436f1['body']['id']){delete _0x436f1[_0x1e64('0x67')]['id'];}return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x436f1[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x4aad56,null))[_0x1e64('0x22')](function(_0x831a77){if(_0x831a77){_0x436f1[_0x1e64('0x67')][_0x1e64('0x6a')]=_0x831a77['id'];return db['CannedAnswer']['create'](_0x436f1[_0x1e64('0x67')]);}})[_0x1e64('0x22')](respondWithResult(_0x4aad56,null))[_0x1e64('0x5a')](handleError(_0x4aad56,null));};exports['getAnswers']=function(_0x424c6f,_0x37c02b,_0x2261d8){var _0x125574={'raw':![],'where':{}};var _0x5ebd3e={};var _0x1e896a={'count':0x0,'rows':[]};return db[_0x1e64('0x58')]['findOne']({'where':{'id':_0x424c6f[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x37c02b,null))[_0x1e64('0x22')](function(_0x20e96d){if(_0x20e96d){_0x5ebd3e[_0x1e64('0x4a')]=_['keys'](db['CannedAnswer'][_0x1e64('0x42')]);_0x5ebd3e[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0x424c6f[_0x1e64('0x46')]);_0x5ebd3e[_0x1e64('0x48')]=_['intersection'](_0x5ebd3e['model'],_0x5ebd3e['query']);_0x125574['attributes']=_['intersection'](_0x5ebd3e[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x4b')]));_0x125574[_0x1e64('0x4c')]=_0x125574[_0x1e64('0x4c')]['length']?_0x125574[_0x1e64('0x4c')]:_0x5ebd3e[_0x1e64('0x4a')];if(!_0x424c6f['query']['hasOwnProperty'](_0x1e64('0x72'))){_0x125574[_0x1e64('0x31')]=qs['limit'](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x31')]);_0x125574[_0x1e64('0x2f')]=qs[_0x1e64('0x2f')](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x2f')]);}_0x125574[_0x1e64('0x4f')]=qs['sort'](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x50')]);_0x125574['where']=qs['filters'](_[_0x1e64('0x52')](_0x424c6f[_0x1e64('0x46')],_0x5ebd3e[_0x1e64('0x48')]));_0x125574['where'][_0x1e64('0x6a')]=_0x20e96d['id'];if(_0x424c6f[_0x1e64('0x46')][_0x1e64('0x53')]){_0x125574['where']=_['merge'](_0x125574[_0x1e64('0x51')],{'$or':_['map'](_0x125574[_0x1e64('0x4c')],function(_0x5c856b){var _0x12647f={};_0x12647f[_0x5c856b]={'$like':'%'+_0x424c6f[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0x12647f;})});}_0x125574=_[_0x1e64('0x54')]({},_0x125574,_0x424c6f[_0x1e64('0x5c')]);return db[_0x1e64('0x73')][_0x1e64('0x32')]({'where':_0x125574[_0x1e64('0x51')]})[_0x1e64('0x22')](function(_0x244e6c){_0x1e896a[_0x1e64('0x32')]=_0x244e6c;if(_0x424c6f[_0x1e64('0x46')][_0x1e64('0x56')]){_0x125574[_0x1e64('0x57')]=[{'all':!![]}];}return db[_0x1e64('0x73')][_0x1e64('0x59')](_0x125574);})['then'](function(_0x3fa90d){_0x1e896a[_0x1e64('0x6e')]=_0x3fa90d;return _0x1e896a;});}})['then'](respondWithFilteredResult(_0x37c02b,_0x125574))[_0x1e64('0x5a')](handleError(_0x37c02b,null));};exports[_0x1e64('0x74')]=function(_0x68c95,_0xe27cb,_0x374f31){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x68c95[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0xe27cb,null))[_0x1e64('0x22')](function(_0x41412b){if(_0x41412b){return _0x41412b['removeAnswers'](_0x68c95['query'][_0x1e64('0x70')]);}})['then'](respondWithStatusCode(_0xe27cb,null))[_0x1e64('0x5a')](handleError(_0xe27cb,null));};exports['notify']=function(_0x2b90bf,_0x40508d,_0x513147){var _0x287e91={'body':_0x2b90bf[_0x1e64('0x67')],'channel':_0x1e64('0x75')};var _0x31374f=[];var _0x58077f=[];var _0x5b8df5={};var _0xac3ec5=![];return db['CmContact']['describe']()[_0x1e64('0x22')](function(_0x32a83c){if(!_0x32a83c){throw new db[(_0x1e64('0x76'))][(_0x1e64('0x77'))](_0x1e64('0x78'));}_0x31374f=_[_0x1e64('0x79')](_[_0x1e64('0x47')](_0x32a83c),[_0x1e64('0x7a'),_0x1e64('0x7b')]);_0x58077f=_['difference'](_['keys'](_0x32a83c),['createdAt',_0x1e64('0x7b'),_0x1e64('0x7c'),'ListId']);if(_0x2b90bf[_0x1e64('0x67')]['id']){delete _0x2b90bf[_0x1e64('0x67')]['id'];}if(_[_0x1e64('0x7d')](_0x2b90bf[_0x1e64('0x67')]['from'])){throw new db['Sequelize'][(_0x1e64('0x77'))](_0x1e64('0x7e'));}if(_['isNil'](_0x2b90bf['body']['body'])||_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x67')]===''){throw new db[(_0x1e64('0x76'))][(_0x1e64('0x77'))](_0x1e64('0x7f'));}if(_[_0x1e64('0x7d')](_0x2b90bf[_0x1e64('0x67')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x1e64('0x80')+_0x58077f);}if(!_[_0x1e64('0x81')](_0x58077f,_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x82')])){throw new db[(_0x1e64('0x76'))]['ValidationError'](_0x1e64('0x83')+_0x58077f);}_0x5b8df5[_0x2b90bf['body'][_0x1e64('0x82')]]=_0x2b90bf[_0x1e64('0x67')]['from'];})[_0x1e64('0x22')](function(){return db['OpenchannelAccount'][_0x1e64('0x63')]({'where':{'id':_0x2b90bf[_0x1e64('0x68')]['id']},'include':[{'model':db[_0x1e64('0x84')],'as':_0x1e64('0x85'),'include':[{'model':db[_0x1e64('0x86')],'as':'Contacts','where':_0x5b8df5,'limit':0x1,'order':[['updatedAt',_0x1e64('0x87')]]}]},{'model':db[_0x1e64('0x88')],'as':_0x1e64('0x89')}]});})[_0x1e64('0x22')](handleEntityNotFound(_0x40508d,null))[_0x1e64('0x22')](function(_0x8b8044){if(_0x8b8044&&_0x8b8044[_0x1e64('0x85')]){_0x287e91[_0x1e64('0x8a')]=_0x8b8044;_0x287e91[_0x1e64('0x8b')]=_0x8b8044['Applications'];_0x287e91[_0x1e64('0x8c')]=_0x8b8044[_0x1e64('0x85')];_0x287e91['applications']=_['orderBy'](_0x287e91['applications'],[_0x1e64('0x8d')],['asc']);if(_0x287e91[_0x1e64('0x8a')][_0x1e64('0x89')]){delete _0x287e91[_0x1e64('0x8a')][_0x1e64('0x89')];}if(_0x287e91['account']['List']&&_0x287e91[_0x1e64('0x8a')][_0x1e64('0x85')]['Contacts'][_0x1e64('0x4d')]){return _0x287e91[_0x1e64('0x8a')][_0x1e64('0x85')][_0x1e64('0x8e')][0x0];}var _0x422aac=_['defaults'](_0x2b90bf['body'],{'firstName':_0x2b90bf['body'][_0x1e64('0x8f')],'ListId':_0x8b8044[_0x1e64('0x90')]});_0x422aac[_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x82')]]=_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x8f')];return db[_0x1e64('0x86')]['create'](_0x422aac,{'fields':_0x31374f,'raw':!![]});}})[_0x1e64('0x22')](handleEntityNotFound(_0x40508d,null))['then'](function(_0x5aac3f){_0x287e91[_0x1e64('0x91')]=_0x5aac3f;if(_0x5aac3f){var _0x51705d={'ContactId':_0x5aac3f['id'],'OpenchannelAccountId':_0x2b90bf[_0x1e64('0x68')]['id'],'from':(_0x5aac3f[_0x1e64('0x92')]||'')+'\x20'+(_0x5aac3f[_0x1e64('0x93')]||'')};var _0x1f21d5={'OpenchannelAccountId':_0x2b90bf[_0x1e64('0x68')]['id'],'closed':![]};if(_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x94')]){_0x1f21d5[_0x1e64('0x94')]=_0x2b90bf['body'][_0x1e64('0x94')];return db['OpenchannelInteraction'][_0x1e64('0x63')]({'where':_0x1f21d5})['then'](function(_0x534c79){if(_0x534c79){return[_0x534c79,![]];}_0x51705d[_0x1e64('0x94')]=_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x94')];_0x51705d[_0x1e64('0x95')]=_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x95')];return db[_0x1e64('0x96')][_0x1e64('0x5d')](_0x51705d)[_0x1e64('0x22')](function(_0x1b8a99){return[_0x1b8a99,!![]];});});}else{_0x1f21d5[_0x1e64('0x94')]=null;}_0x1f21d5['ContactId']=_0x5aac3f['id'];return db[_0x1e64('0x96')][_0x1e64('0x63')]({'where':_0x1f21d5})[_0x1e64('0x22')](function(_0x10f43c){if(_0x10f43c){return[_0x10f43c,![]];}return db[_0x1e64('0x96')][_0x1e64('0x5d')](_0x51705d)['then'](function(_0x566403){return[_0x566403,!![]];});});}})[_0x1e64('0x97')](function(_0x459929,_0x14975b){if(_0x459929){_0xac3ec5=_0x14975b;if(!_0x14975b){var _0x3158a7={'from':(_0x287e91[_0x1e64('0x91')]['firstName']||'')+'\x20'+(_0x287e91[_0x1e64('0x91')][_0x1e64('0x93')]||'')};if(_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x94')]&&_0x2b90bf['body'][_0x1e64('0x98')]&&_0x2b90bf['body'][_0x1e64('0x94')]!=_0x2b90bf[_0x1e64('0x67')]['messageId']){_0x3158a7[_0x1e64('0x94')]=_0x2b90bf[_0x1e64('0x67')]['messageId'];}return _0x459929[_0x1e64('0x37')](_0x3158a7);}else{return _0x459929;}}})[_0x1e64('0x22')](function(_0x4ef668){_0x287e91[_0x1e64('0x99')]=_0x4ef668['get']({'plain':!![]});_0x287e91[_0x1e64('0x99')][_0x1e64('0x9a')]=_0xac3ec5;if(_0x287e91[_0x1e64('0x99')]['created']){if(_0x287e91[_0x1e64('0x8a')][_0x1e64('0x9b')]){_0x287e91[_0x1e64('0x8b')][_0x1e64('0x9c')]({'id':0x0,'priority':_0x287e91[_0x1e64('0x8b')][_0x1e64('0x4d')]+0x1,'app':_0x1e64('0x9d'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x1e64('0x5d')]({'body':_0x2b90bf['body'][_0x1e64('0x67')],'OpenchannelAccountId':_0x2b90bf[_0x1e64('0x68')]['id'],'OpenchannelInteractionId':_0x4ef668['id'],'direction':'in','ContactId':_0x287e91[_0x1e64('0x91')]['id'],'AttachmentId':_0x2b90bf[_0x1e64('0x67')]['AttachmentId']});})[_0x1e64('0x22')](function(_0x287ac9){_0x287e91['message']=_0x287ac9;if(!_0x287e91['interaction'][_0x1e64('0x9e')])return;return db[_0x1e64('0x9f')][_0x1e64('0x63')]({'attributes':['id',_0x1e64('0x3c')],'where':{'id':_0x287e91[_0x1e64('0x99')][_0x1e64('0x9e')]}});})[_0x1e64('0x22')](function(_0x3a5837){if(_0x3a5837){_0x287e91[_0x1e64('0x8b')][_0x1e64('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3a5837[_0x1e64('0x3c')]+','+(_0x287e91['account'][_0x1e64('0xa1')]||0xa),'interval':_0x1e64('0xa2')});}if(!_0x287e91[_0x1e64('0x99')][_0x1e64('0xa3')])return;return db[_0x1e64('0xa4')][_0x1e64('0x63')]({'attributes':['id',_0x1e64('0x3c')],'where':{'id':_0x287e91[_0x1e64('0x99')][_0x1e64('0xa3')]}});})[_0x1e64('0x22')](function(_0x449d26){if(_0x449d26){_0x287e91[_0x1e64('0x8b')][_0x1e64('0xa0')]({'id':0x0,'priority':0x1,'app':_0x1e64('0xa5'),'appdata':_0x449d26[_0x1e64('0x3c')]+','+(_0x287e91[_0x1e64('0x8a')][_0x1e64('0xa6')]||0x12c),'interval':_0x1e64('0xa2')});}return respondWithRpcPromise(_0x1e64('0xa7'),_0x1e64('0xa8'),_0x287e91);})['then'](function(_0x4be348){respondWithRpcPromise('EventManager',_0x1e64('0xa9'),{'event':_0x1e64('0xaa'),'message':_0x4be348},client9002);return _0x4be348;})[_0x1e64('0x22')](respondWithResult(_0x40508d,null))['catch'](handleError(_0x40508d,null));};exports[_0x1e64('0xab')]=function(_0x4f8785,_0x48377d){var _0x571f65=_0x4f8785[_0x1e64('0x68')]['id'];var _0x10f313=_0x4f8785[_0x1e64('0x67')];var _0x1e5114=0xc8;var _0x2a22da=null;return db[_0x1e64('0xac')][_0x1e64('0xad')]({'isolationLevel':db[_0x1e64('0xac')][_0x1e64('0xae')][_0x1e64('0xaf')][_0x1e64('0xb0')]},function(_0x54d9c3){return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x571f65},'transaction':_0x54d9c3})[_0x1e64('0x22')](function(_0x67b7b3){if(_0x67b7b3){return db[_0x1e64('0x88')]['destroy']({'where':{'OpenchannelAccountId':_0x571f65},'transaction':_0x54d9c3})['then'](function(){var _0x85800=_[_0x1e64('0x41')](_0x10f313,function(_0x4453d3){_0x4453d3['OpenchannelAccountId']=_0x571f65;return _0x4453d3;});return db[_0x1e64('0x88')]['bulkCreate'](_0x85800,{'transaction':_0x54d9c3});});}else{_0x1e5114=0x194;_0x2a22da=[];}});})['then'](function(){if(_0x1e5114!==0x194){return db[_0x1e64('0x88')][_0x1e64('0xb1')]({'where':{'OpenchannelAccountId':_0x571f65},'order':_0x1e64('0x8d')})[_0x1e64('0x22')](function(_0x232169){_0x2a22da=_0x232169;});}})[_0x1e64('0x5a')](function(_0x293505){_0x1e5114=0x1f4;logger[_0x1e64('0x28')](_0x293505[_0x1e64('0x3b')]);if(_0x293505['name']){delete _0x293505[_0x1e64('0x3c')];}_0x2a22da=_0x293505;})[_0x1e64('0xb2')](function(){if(_0x2a22da===null){_0x48377d[_0x1e64('0x3a')](_0x1e5114);}else{if(_0x1e5114===0x1f4){_0x48377d['status'](_0x1e5114)['send'](_0x2a22da);}else{_0x48377d[_0x1e64('0x2c')](_0x1e5114)[_0x1e64('0x2e')](_0x2a22da);}}});};exports[_0x1e64('0xb3')]=function(_0x43e063,_0x355999,_0x462349){var _0x561a52={};var _0x25bae8={};var _0x3024ad;var _0x2fb06a;return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x43e063[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0x355999,null))[_0x1e64('0x22')](function(_0x2c0304){if(_0x2c0304){_0x3024ad=_0x2c0304;_0x25bae8[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db[_0x1e64('0x88')][_0x1e64('0x42')]);_0x25bae8[_0x1e64('0x46')]=_['keys'](_0x43e063[_0x1e64('0x46')]);_0x25bae8[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x25bae8[_0x1e64('0x4a')],_0x25bae8[_0x1e64('0x46')]);_0x561a52[_0x1e64('0x4c')]=_[_0x1e64('0x49')](_0x25bae8['model'],qs[_0x1e64('0x4b')](_0x43e063[_0x1e64('0x46')]['fields']));_0x561a52[_0x1e64('0x4c')]=_0x561a52[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x561a52[_0x1e64('0x4c')]:_0x25bae8[_0x1e64('0x4a')];_0x561a52['order']=qs[_0x1e64('0x50')](_0x43e063[_0x1e64('0x46')][_0x1e64('0x50')]);_0x561a52[_0x1e64('0x51')]=qs[_0x1e64('0x48')](_[_0x1e64('0x52')](_0x43e063['query'],_0x25bae8['filters']));if(_0x43e063['query'][_0x1e64('0x53')]){_0x561a52[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x561a52[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x561a52[_0x1e64('0x4c')],function(_0x4a1a5c){var _0x1cf93f={};_0x1cf93f[_0x4a1a5c]={'$like':'%'+_0x43e063[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0x1cf93f;})});}_0x561a52=_['merge']({},_0x561a52,_0x43e063['options']);return _0x3024ad[_0x1e64('0xb3')](_0x561a52);}})[_0x1e64('0x22')](function(_0x3eb690){if(_0x3eb690){_0x2fb06a=_0x3eb690[_0x1e64('0x4d')];if(!_0x43e063[_0x1e64('0x46')][_0x1e64('0x4e')]('nolimit')){_0x561a52[_0x1e64('0x31')]=qs[_0x1e64('0x31')](_0x43e063['query'][_0x1e64('0x31')]);_0x561a52['offset']=qs[_0x1e64('0x2f')](_0x43e063[_0x1e64('0x46')][_0x1e64('0x2f')]);}return _0x3024ad['getApplications'](_0x561a52);}})[_0x1e64('0x22')](function(_0x270121){if(_0x270121){return _0x270121?{'count':_0x2fb06a,'rows':_0x270121}:null;}})[_0x1e64('0x22')](respondWithResult(_0x355999,null))[_0x1e64('0x5a')](handleError(_0x355999,null));};exports['getInteractions']=function(_0x4b593d,_0x14a6d2,_0x2df19d){var _0x5a5b61={'raw':![],'where':{}};var _0x7295ee={};var _0x1f4d1e={'count':0x0,'rows':[]};return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x4b593d['params']['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x14a6d2,null))['then'](function(_0x29e2fa){if(_0x29e2fa){_0x7295ee[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db[_0x1e64('0x96')][_0x1e64('0x42')]);_0x7295ee[_0x1e64('0x46')]=_['keys'](_0x4b593d[_0x1e64('0x46')]);_0x7295ee[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x7295ee['model'],_0x7295ee[_0x1e64('0x46')]);_0x5a5b61[_0x1e64('0x4c')]=_[_0x1e64('0x49')](_0x7295ee[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0x4b593d[_0x1e64('0x46')][_0x1e64('0x4b')]));_0x5a5b61[_0x1e64('0x4c')]=_0x5a5b61[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x5a5b61[_0x1e64('0x4c')]:_0x7295ee[_0x1e64('0x4a')];if(!_0x4b593d[_0x1e64('0x46')]['hasOwnProperty'](_0x1e64('0x72'))){_0x5a5b61[_0x1e64('0x31')]=qs['limit'](_0x4b593d['query'][_0x1e64('0x31')]);_0x5a5b61[_0x1e64('0x2f')]=qs[_0x1e64('0x2f')](_0x4b593d[_0x1e64('0x46')][_0x1e64('0x2f')]);}_0x5a5b61[_0x1e64('0x4f')]=qs[_0x1e64('0x50')](_0x4b593d[_0x1e64('0x46')]['sort']);_0x5a5b61[_0x1e64('0x51')]=qs[_0x1e64('0x48')](_[_0x1e64('0x52')](_0x4b593d[_0x1e64('0x46')],_0x7295ee['filters']));_0x5a5b61['where'][_0x1e64('0x6a')]=_0x29e2fa['id'];if(_0x4b593d['query'][_0x1e64('0x53')]){_0x5a5b61[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x5a5b61[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x5a5b61[_0x1e64('0x4c')],function(_0x391513){var _0x403738={};_0x403738[_0x391513]={'$like':'%'+_0x4b593d['query'][_0x1e64('0x53')]+'%'};return _0x403738;})});}_0x5a5b61=_[_0x1e64('0x54')]({},_0x5a5b61,_0x4b593d['options']);return db[_0x1e64('0x96')][_0x1e64('0x32')]({'where':_0x5a5b61[_0x1e64('0x51')]})[_0x1e64('0x22')](function(_0x187db7){_0x1f4d1e['count']=_0x187db7;if(_0x4b593d[_0x1e64('0x46')][_0x1e64('0x56')]){_0x5a5b61[_0x1e64('0x57')]=[{'model':db[_0x1e64('0x86')],'as':'Contact','required':![]},{'model':db[_0x1e64('0x9f')],'as':_0x1e64('0xb4'),'attributes':[_0x1e64('0x3c'),_0x1e64('0xb5'),_0x1e64('0xb6')],'required':![]},{'model':db['Tag'],'as':_0x1e64('0xb7'),'attributes':['id',_0x1e64('0x3c'),_0x1e64('0xb8')],'where':_0x4b593d[_0x1e64('0x46')][_0x1e64('0xb9')]?{'id':_0x4b593d[_0x1e64('0x46')]['tag']}:undefined,'required':_0x4b593d[_0x1e64('0x46')][_0x1e64('0xb9')]?!![]:![]}];}return db[_0x1e64('0x96')][_0x1e64('0x59')](_0x5a5b61);})['then'](function(_0x2acc85){_0x1f4d1e[_0x1e64('0x6e')]=_0x2acc85;return _0x1f4d1e;});}})[_0x1e64('0x22')](respondWithFilteredResult(_0x14a6d2,_0x5a5b61))[_0x1e64('0x5a')](handleError(_0x14a6d2,null));};exports[_0x1e64('0xba')]=function(_0x1fee26,_0x30dcec,_0x339aad){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x1fee26[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x30dcec,null))[_0x1e64('0x22')](function(_0x1e77e2){if(_0x1e77e2){return _0x1e77e2[_0x1e64('0xba')](_0x1fee26['body']['ids'],_[_0x1e64('0xbb')](_0x1fee26[_0x1e64('0x67')],['ids','id'])||{})[_0x1e64('0x97')](function(_0x3da4fb){for(var _0x284b94=0x0;_0x284b94<_0x1fee26[_0x1e64('0x67')][_0x1e64('0x70')][_0x1e64('0x4d')];_0x284b94+=0x1){socket[_0x1e64('0xbc')]('userOpenchannelAccount:save',{'UserId':Number(_0x1fee26[_0x1e64('0x67')][_0x1e64('0x70')][_0x284b94]),'OpenchannelAccountId':Number(_0x1fee26[_0x1e64('0x68')]['id'])});}return _0x3da4fb;});}})[_0x1e64('0x22')](respondWithResult(_0x30dcec,null))['catch'](handleError(_0x30dcec,null));};exports['removeAgents']=function(_0x2b7497,_0x288a71,_0x1ce2db){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x2b7497[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x288a71,null))['then'](function(_0x1eb4ce){if(_0x1eb4ce){return _0x1eb4ce[_0x1e64('0xbd')](_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')])[_0x1e64('0x22')](function(){if(_[_0x1e64('0xbe')](_0x2b7497['query'][_0x1e64('0x70')])){for(var _0x49ed90=0x0;_0x49ed90<_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')][_0x1e64('0x4d')];_0x49ed90+=0x1){socket[_0x1e64('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')][_0x49ed90]),'OpenchannelAccountId':Number(_0x2b7497[_0x1e64('0x68')]['id'])});}}else{socket['emit'](_0x1e64('0xbf'),{'UserId':Number(_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')]),'OpenchannelAccountId':Number(_0x2b7497[_0x1e64('0x68')]['id'])});}});}})[_0x1e64('0x22')](respondWithStatusCode(_0x288a71,null))[_0x1e64('0x5a')](handleError(_0x288a71,null));};exports[_0x1e64('0xc0')]=function(_0x36e341,_0x136fc8,_0x46cc9e){var _0x42a45d={};var _0x4314d0={};var _0x38817b;var _0x2382dc;return db[_0x1e64('0x58')]['findOne']({'where':{'id':_0x36e341[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0x136fc8,null))['then'](function(_0x32aad4){if(_0x32aad4){_0x38817b=_0x32aad4;_0x4314d0[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db['User']['rawAttributes']);_0x4314d0[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0x36e341[_0x1e64('0x46')]);_0x4314d0[_0x1e64('0x48')]=_['intersection'](_0x4314d0['model'],_0x4314d0[_0x1e64('0x46')]);_0x42a45d['attributes']=_['intersection'](_0x4314d0[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0x36e341[_0x1e64('0x46')]['fields']));_0x42a45d['attributes']=_0x42a45d[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x42a45d['attributes']:_0x4314d0[_0x1e64('0x4a')];_0x42a45d['order']=qs[_0x1e64('0x50')](_0x36e341[_0x1e64('0x46')][_0x1e64('0x50')]);_0x42a45d['where']=qs['filters'](_[_0x1e64('0x52')](_0x36e341['query'],_0x4314d0[_0x1e64('0x48')]));if(_0x36e341[_0x1e64('0x46')][_0x1e64('0x53')]){_0x42a45d['where']=_['merge'](_0x42a45d[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x42a45d['attributes'],function(_0x181ca0){var _0xde492e={};_0xde492e[_0x181ca0]={'$like':'%'+_0x36e341[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0xde492e;})});}_0x42a45d=_[_0x1e64('0x54')]({},_0x42a45d,_0x36e341[_0x1e64('0x5c')]);return _0x38817b[_0x1e64('0xc0')](_0x42a45d);}})[_0x1e64('0x22')](function(_0x30461a){if(_0x30461a){_0x2382dc=_0x30461a[_0x1e64('0x4d')];if(!_0x36e341['query'][_0x1e64('0x4e')](_0x1e64('0x72'))){_0x42a45d[_0x1e64('0x31')]=qs['limit'](_0x36e341[_0x1e64('0x46')]['limit']);_0x42a45d['offset']=qs[_0x1e64('0x2f')](_0x36e341[_0x1e64('0x46')][_0x1e64('0x2f')]);}return _0x38817b[_0x1e64('0xc0')](_0x42a45d);}})['then'](function(_0xd2fc0){if(_0xd2fc0){return _0xd2fc0?{'count':_0x2382dc,'rows':_0xd2fc0}:null;}})[_0x1e64('0x22')](respondWithResult(_0x136fc8,null))[_0x1e64('0x5a')](handleError(_0x136fc8,null));};exports['send']=function(_0x148608,_0xbb07e3,_0x8e1ff5){var _0x76e36f,_0x17a1c8,_0x3e5560;if(_[_0x1e64('0x7d')](_0x148608[_0x1e64('0x67')][_0x1e64('0x67')])||_0x148608['body'][_0x1e64('0x67')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e64('0x7d')](_0x148608['body']['to'])){}_0x76e36f=_0x148608[_0x1e64('0x67')]['to'];return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x148608['params']['id']}})['then'](handleEntityNotFound(_0xbb07e3,null))[_0x1e64('0x22')](function(_0x1ab468){if(_0x1ab468){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x1ab468['id']},'include':[{'model':db[_0x1e64('0x84')],'as':_0x1e64('0x85'),'include':[{'model':db[_0x1e64('0x86')],'as':_0x1e64('0x8e'),'where':{[_0x1ab468[_0x1e64('0x82')]]:_0x76e36f},'limit':0x1,'order':[['updatedAt',_0x1e64('0x87')]]}]}]})[_0x1e64('0x22')](handleEntityNotFound(_0xbb07e3,null))['then'](function(_0x5dcf98){if(_0x5dcf98&&_0x5dcf98['List']){_0x17a1c8=_0x5dcf98[_0x1e64('0x61')]({'plain':!![]});if(_0x17a1c8[_0x1e64('0x85')]&&_0x17a1c8[_0x1e64('0x85')][_0x1e64('0x8e')][_0x1e64('0x4d')]){return _0x17a1c8[_0x1e64('0x85')]['Contacts'][0x0];}return db[_0x1e64('0x86')][_0x1e64('0x5d')](_[_0x1e64('0x1a')](_0x148608[_0x1e64('0x67')],{'firstName':_0x76e36f,[_0x5dcf98['mapKey']]:_0x76e36f,'phone':_0x76e36f,'ListId':_0x17a1c8[_0x1e64('0x90')]}));}})['then'](handleEntityNotFound(_0xbb07e3,null))[_0x1e64('0x22')](function(_0x19c7a9){if(_0x19c7a9){_0x3e5560=_0x19c7a9;return db[_0x1e64('0x96')][_0x1e64('0x63')]({'where':{'ContactId':_0x3e5560['id'],'closed':![],'OpenchannelAccountId':_0x17a1c8['id']}})[_0x1e64('0x22')](function(_0x60db95){if(_0x60db95){return[_0x60db95,![]];}return db[_0x1e64('0x96')][_0x1e64('0x5d')]({'UserId':_0x148608['user']['id'],'ContactId':_0x3e5560['id'],'OpenchannelAccountId':_0x17a1c8['id'],'lastMsgDirection':_0x1e64('0xc1'),'firstMsgDirection':_0x1e64('0xc1'),'Messages':[_[_0x1e64('0x54')](_0x148608[_0x1e64('0x67')],{'read':![],'body':_0x148608[_0x1e64('0x67')][_0x1e64('0x67')],'OpenchannelAccountId':_0x17a1c8['id'],'UserId':_0x148608[_0x1e64('0x5e')]['id'],'ContactId':_0x3e5560['id']})]},{'include':[{'model':db[_0x1e64('0xc2')],'as':_0x1e64('0xc3')}]})[_0x1e64('0x22')](function(_0x1fecfc){return[_0x1fecfc,!![]];});});}})['spread'](function(_0x3b42e4,_0x3bd5c6){if(_0x3bd5c6){return _0x3b42e4;}return db[_0x1e64('0xc2')][_0x1e64('0x5d')](_[_0x1e64('0x54')](_0x148608['body'],{'read':![],'body':_0x148608[_0x1e64('0x67')][_0x1e64('0x67')],'OpenchannelAccountId':_0x17a1c8['id'],'OpenchannelInteractionId':_0x3b42e4['id'],'UserId':_0x148608[_0x1e64('0x5e')]['id'],'ContactId':_0x3e5560['id']}))[_0x1e64('0x22')](function(_0xae2cc4){_0x3b42e4[_0x1e64('0xc4')][_0x1e64('0xc3')]=[];_0x3b42e4[_0x1e64('0xc4')]['Messages'][_0x1e64('0x9c')](_0xae2cc4[_0x1e64('0xc4')]);return _0x3b42e4;});});}})[_0x1e64('0x22')](respondWithResult(_0xbb07e3,null))[_0x1e64('0x5a')](handleError(_0xbb07e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 71ad020..04d582d 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 _0xd64b=['exports','events','OpenchannelAccount','save','update','remove','hasOwnProperty','hook'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd64b,0xc1));var _0xbd64=function(_0x123623,_0x9694e2){_0x123623=_0x123623-0x0;var _0x3b00d1=_0xd64b[_0x123623];return _0x3b00d1;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbd64('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd64('0x2'),'afterUpdate':_0xbd64('0x3'),'afterDestroy':_0xbd64('0x4')};function emitEvent(_0x3f1f05){return function(_0x30fe29,_0x5458d8,_0x5446e4){OpenchannelAccountEvents['emit'](_0x3f1f05+':'+_0x30fe29['id'],_0x30fe29);OpenchannelAccountEvents['emit'](_0x3f1f05,_0x30fe29);_0x5446e4(null);};}for(var e in events){if(events[_0xbd64('0x5')](e)){var event=events[e];OpenchannelAccount[_0xbd64('0x6')](e,emitEvent(event));}}module[_0xbd64('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x1390a0,_0x499668){var _0x359f67=function(_0x3daff4){while(--_0x3daff4){_0x1390a0['push'](_0x1390a0['shift']());}};_0x359f67(++_0x499668);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xb4e6[_0x9d1e6b];return _0x2b3070;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c1ee2e4..62d7174 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(_0x492073,_0xbb0c82){var _0x14a4ae=function(_0xee44a4){while(--_0xee44a4){_0x492073['push'](_0x492073['shift']());}};_0x14a4ae(++_0xbb0c82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x53dc12,_0x4884b6){var _0x1b2f64=function(_0x208e19){while(--_0x208e19){_0x53dc12['push'](_0x53dc12['shift']());}};_0x1b2f64(++_0x4884b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 7104fbc..a56c6ad 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 _0x9d5b=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket'];(function(_0x40e917,_0x55b395){var _0x10d30e=function(_0x442fb8){while(--_0x442fb8){_0x40e917['push'](_0x40e917['shift']());}};_0x10d30e(++_0x55b395);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x41afc1,_0x4101ba){_0x41afc1=_0x41afc1-0x0;var _0x51b4fa=_0x9d5b[_0x41afc1];return _0x51b4fa;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config['redis']=_[_0xb9d5('0xb')](config[_0xb9d5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d5('0xd'))(new Redis(config[_0xb9d5('0xc')]));require(_0xb9d5('0xe'))[_0xb9d5('0xf')](socket);function respondWithRpcPromise(_0x5d0fc6,_0x1aec1b,_0x1ae073){return new BPromise(function(_0x4c1ce3,_0x35d69f){return client[_0xb9d5('0x10')](_0x5d0fc6,_0x1ae073)[_0xb9d5('0x11')](function(_0x422b36){logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));logger[_0xb9d5('0x15')](_0xb9d5('0x16'),_0x1aec1b,_0xb9d5('0x14'),JSON[_0xb9d5('0x17')](_0x422b36));if(_0x422b36['error']){if(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x19')]===0x1f4){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x35d69f(_0x422b36['error'][_0xb9d5('0x1a')]);}logger[_0xb9d5('0x18')](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x4c1ce3(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);}else{logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));_0x4c1ce3(_0x422b36[_0xb9d5('0x1b')][_0xb9d5('0x1a')]);}})[_0xb9d5('0x1c')](function(_0x171487){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x171487);_0x35d69f(_0x171487);});});} \ No newline at end of file +var _0x705f=['jayson/promise','client','http','redis','localhost','./openchannelAccount.socket','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a0fa7,_0x4a00f9){var _0x992bee=function(_0x3dbb1d){while(--_0x3dbb1d){_0x3a0fa7['push'](_0x3a0fa7['shift']());}};_0x992bee(++_0x4a00f9);}(_0x705f,0x75));var _0xf705=function(_0x820d7b,_0xa5564c){_0x820d7b=_0x820d7b-0x0;var _0x249af0=_0x705f[_0x820d7b];return _0x249af0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});config[_0xf705('0xb')]=_['defaults'](config['redis'],{'host':_0xf705('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf705('0xb')]));require(_0xf705('0xd'))['register'](socket);function respondWithRpcPromise(_0x4bd6fd,_0x1f9ab1,_0xc6fbde){return new BPromise(function(_0xfe67fe,_0x45316b){return client[_0xf705('0xe')](_0x4bd6fd,_0xc6fbde)[_0xf705('0xf')](function(_0x13db14){logger[_0xf705('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f9ab1,_0xf705('0x11'));logger[_0xf705('0x12')](_0xf705('0x13'),_0x1f9ab1,_0xf705('0x11'),JSON[_0xf705('0x14')](_0x13db14));if(_0x13db14['error']){if(_0x13db14['error'][_0xf705('0x15')]===0x1f4){logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x13db14[_0xf705('0x16')]['message']);return _0x45316b(_0x13db14[_0xf705('0x16')][_0xf705('0x18')]);}logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x13db14['error'][_0xf705('0x18')]);return _0xfe67fe(_0x13db14['error'][_0xf705('0x18')]);}else{logger[_0xf705('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f9ab1,_0xf705('0x11'));_0xfe67fe(_0x13db14['result'][_0xf705('0x18')]);}})['catch'](function(_0x57d537){logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x57d537);_0x45316b(_0x57d537);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c235cf4..6ae9198 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 _0x3360=['register','length','openchannelAccount:','./openchannelAccount.events','save','removeListener'];(function(_0x57d0df,_0x47026a){var _0xb4134c=function(_0x2c914d){while(--_0x2c914d){_0x57d0df['push'](_0x57d0df['shift']());}};_0xb4134c(++_0x47026a);}(_0x3360,0x1d7));var _0x0336=function(_0x12658c,_0x4375d3){_0x12658c=_0x12658c-0x0;var _0xc3a002=_0x3360[_0x12658c];return _0xc3a002;};'use strict';var OpenchannelAccountEvents=require(_0x0336('0x0'));var events=[_0x0336('0x1'),'remove','update'];function createListener(_0x5882e7,_0x12fd21){return function(_0x56bf8b){_0x12fd21['emit'](_0x5882e7,_0x56bf8b);};}function removeListener(_0x472555,_0xeb42d1){return function(){OpenchannelAccountEvents[_0x0336('0x2')](_0x472555,_0xeb42d1);};}exports[_0x0336('0x3')]=function(_0x340a8a){for(var _0x4aed6a=0x0,_0x4890e5=events[_0x0336('0x4')];_0x4aed6a<_0x4890e5;_0x4aed6a++){var _0x36a973=events[_0x4aed6a];var _0x310327=createListener(_0x0336('0x5')+_0x36a973,_0x340a8a);OpenchannelAccountEvents['on'](_0x36a973,_0x310327);}}; \ No newline at end of file +var _0x1542=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x41b1a1,_0x1efb9f){var _0x59342a=function(_0x114f91){while(--_0x114f91){_0x41b1a1['push'](_0x41b1a1['shift']());}};_0x59342a(++_0x1efb9f);}(_0x1542,0x116));var _0x2154=function(_0x19c4e5,_0x6c0736){_0x19c4e5=_0x19c4e5-0x0;var _0x2ddc52=_0x1542[_0x19c4e5];return _0x2ddc52;};'use strict';var OpenchannelAccountEvents=require(_0x2154('0x0'));var events=[_0x2154('0x1'),_0x2154('0x2'),_0x2154('0x3')];function createListener(_0x229bed,_0x4faf69){return function(_0x42644b){_0x4faf69[_0x2154('0x4')](_0x229bed,_0x42644b);};}function removeListener(_0x13e41b,_0x4ded8a){return function(){OpenchannelAccountEvents[_0x2154('0x5')](_0x13e41b,_0x4ded8a);};}exports[_0x2154('0x6')]=function(_0x5406f9){for(var _0x13d9c2=0x0,_0x23abb5=events[_0x2154('0x7')];_0x13d9c2<_0x23abb5;_0x13d9c2++){var _0x791345=events[_0x13d9c2];var _0x2e6295=createListener(_0x2154('0x8')+_0x791345,_0x5406f9);OpenchannelAccountEvents['on'](_0x791345,_0x2e6295);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 191adea..8e4bf04 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 _0xdfb0=['create','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x338fca,_0x2855ac){var _0x2ed569=function(_0x144770){while(--_0x144770){_0x338fca['push'](_0x338fca['shift']());}};_0x2ed569(++_0x2855ac);}(_0xdfb0,0x94));var _0x0dfb=function(_0x5073bf,_0xa3a628){_0x5073bf=_0x5073bf-0x0;var _0x2ee9f9=_0xdfb0[_0x5073bf];return _0x2ee9f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0dfb('0x0'));var timeout=require(_0x0dfb('0x1'));var express=require(_0x0dfb('0x2'));var router=express[_0x0dfb('0x3')]();var fs_extra=require(_0x0dfb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0dfb('0x5'));var config=require(_0x0dfb('0x6'));var controller=require('./openchannelApplication.controller');router[_0x0dfb('0x7')]('/',auth[_0x0dfb('0x8')](),controller[_0x0dfb('0x9')]);router['get'](_0x0dfb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0dfb('0xb')]('/',auth['isAuthenticated'](),controller[_0x0dfb('0xc')]);router['put'](_0x0dfb('0xa'),auth[_0x0dfb('0x8')](),controller[_0x0dfb('0xd')]);router[_0x0dfb('0xe')]('/:id',auth[_0x0dfb('0x8')](),controller[_0x0dfb('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd25d=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x442939,_0xe783a){var _0x45dd63=function(_0x5578ed){while(--_0x5578ed){_0x442939['push'](_0x442939['shift']());}};_0x45dd63(++_0xe783a);}(_0xd25d,0x79));var _0xdd25=function(_0x51687f,_0x35c457){_0x51687f=_0x51687f-0x0;var _0x5bb285=_0xd25d[_0x51687f];return _0x5bb285;};'use strict';var multer=require(_0xdd25('0x0'));var util=require('util');var path=require(_0xdd25('0x1'));var timeout=require(_0xdd25('0x2'));var express=require(_0xdd25('0x3'));var router=express[_0xdd25('0x4')]();var fs_extra=require(_0xdd25('0x5'));var auth=require(_0xdd25('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xdd25('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd25('0x8')]);router[_0xdd25('0x7')](_0xdd25('0x9'),auth[_0xdd25('0xa')](),controller[_0xdd25('0xb')]);router[_0xdd25('0xc')]('/',auth['isAuthenticated'](),controller[_0xdd25('0xd')]);router['put'](_0xdd25('0x9'),auth['isAuthenticated'](),controller[_0xdd25('0xe')]);router[_0xdd25('0xf')]('/:id',auth[_0xdd25('0xa')](),controller[_0xdd25('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5996e3a..f3823fa 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 _0x7a97=['*,*,*,*','sequelize','exports','noop'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x7a97,0xb1));var _0x77a9=function(_0x1b8ba1,_0xe13465){_0x1b8ba1=_0x1b8ba1-0x0;var _0x23db14=_0x7a97[_0x1b8ba1];return _0x23db14;};'use strict';var Sequelize=require(_0x77a9('0x0'));module[_0x77a9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x77a9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x77a9('0x3')}}; \ No newline at end of file +var _0x0ed7=['TEXT','*,*,*,*','sequelize','noop'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0ed7,0x1ea));var _0x70ed=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0x0ed7[_0x385467];return _0x5ed67e;};'use strict';var Sequelize=require(_0x70ed('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x70ed('0x1')},'appdata':{'type':Sequelize[_0x70ed('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x70ed('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index bff32da..298fd2d 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 _0x0f6b=['request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','zip-dir'];(function(_0x3d2645,_0x180148){var _0x42160c=function(_0x2ea288){while(--_0x2ea288){_0x3d2645['push'](_0x3d2645['shift']());}};_0x42160c(++_0x180148);}(_0x0f6b,0x97));var _0xb0f6=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x0f6b[_0x482214];return _0x38d0cb;};'use strict';var emlformat=require(_0xb0f6('0x0'));var rimraf=require(_0xb0f6('0x1'));var zipdir=require(_0xb0f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb0f6('0x4'));var util=require(_0xb0f6('0x5'));var path=require('path');var sox=require(_0xb0f6('0x6'));var csv=require(_0xb0f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0f6('0x8'));var _=require(_0xb0f6('0x9'));var squel=require(_0xb0f6('0xa'));var crypto=require(_0xb0f6('0xb'));var jsforce=require(_0xb0f6('0xc'));var deskjs=require(_0xb0f6('0xd'));var toCsv=require(_0xb0f6('0x7'));var querystring=require(_0xb0f6('0xe'));var Papa=require(_0xb0f6('0xf'));var Redis=require('ioredis');var authService=require(_0xb0f6('0x10'));var qs=require(_0xb0f6('0x11'));var as=require(_0xb0f6('0x12'));var hardwareService=require(_0xb0f6('0x13'));var logger=require(_0xb0f6('0x14'))(_0xb0f6('0x15'));var utils=require(_0xb0f6('0x16'));var config=require(_0xb0f6('0x17'));var licenseUtil=require(_0xb0f6('0x18'));var db=require(_0xb0f6('0x19'))['db'];function respondWithStatusCode(_0x2d7240,_0x5956eb){_0x5956eb=_0x5956eb||0xcc;return function(_0x5e1594){if(_0x5e1594){return _0x2d7240[_0xb0f6('0x1a')](_0x5956eb);}return _0x2d7240['status'](_0x5956eb)[_0xb0f6('0x1b')]();};}function respondWithResult(_0x461527,_0x128bd2){_0x128bd2=_0x128bd2||0xc8;return function(_0x4e657c){if(_0x4e657c){return _0x461527[_0xb0f6('0x1c')](_0x128bd2)[_0xb0f6('0x1d')](_0x4e657c);}};}function respondWithFilteredResult(_0x44ad6a,_0x109993){return function(_0x583f55){if(_0x583f55){var _0x36a101=typeof _0x109993[_0xb0f6('0x1e')]==='undefined'&&typeof _0x109993[_0xb0f6('0x1f')]===_0xb0f6('0x20');var _0x28280a=_0x583f55[_0xb0f6('0x21')];var _0x23f3c2=_0x36a101?0x0:_0x109993[_0xb0f6('0x1e')];var _0x536023=_0x36a101?_0x583f55[_0xb0f6('0x21')]:_0x109993[_0xb0f6('0x1e')]+_0x109993[_0xb0f6('0x1f')];var _0x3e2dde;if(_0x536023>=_0x28280a){_0x536023=_0x28280a;_0x3e2dde=0xc8;}else{_0x3e2dde=0xce;}_0x44ad6a[_0xb0f6('0x1c')](_0x3e2dde);return _0x44ad6a[_0xb0f6('0x22')]('Content-Range',_0x23f3c2+'-'+_0x536023+'/'+_0x28280a)[_0xb0f6('0x1d')](_0x583f55);}return null;};}function patchUpdates(_0x11b03a){return function(_0x2659b1){try{jsonpatch[_0xb0f6('0x23')](_0x2659b1,_0x11b03a,!![]);}catch(_0x4f5993){return BPromise[_0xb0f6('0x24')](_0x4f5993);}return _0x2659b1[_0xb0f6('0x25')]();};}function saveUpdates(_0x3bfe06,_0x10ace6){return function(_0xae9482){if(_0xae9482){return _0xae9482[_0xb0f6('0x26')](_0x3bfe06)['then'](function(_0x239b6b){return _0x239b6b;});}return null;};}function removeEntity(_0x27d597,_0x17d016){return function(_0x278ebb){if(_0x278ebb){return _0x278ebb[_0xb0f6('0x27')]()[_0xb0f6('0x28')](function(){_0x27d597[_0xb0f6('0x1c')](0xcc)[_0xb0f6('0x1b')]();});}};}function handleEntityNotFound(_0x1331b8,_0x310e47){return function(_0x3bc606){if(!_0x3bc606){_0x1331b8[_0xb0f6('0x1a')](0x194);}return _0x3bc606;};}function handleError(_0x5025ad,_0xe98e7f){_0xe98e7f=_0xe98e7f||0x1f4;return function(_0xb4eaaa){logger['error'](_0xb4eaaa[_0xb0f6('0x29')]);if(_0xb4eaaa[_0xb0f6('0x2a')]){delete _0xb4eaaa[_0xb0f6('0x2a')];}_0x5025ad[_0xb0f6('0x1c')](_0xe98e7f)[_0xb0f6('0x2b')](_0xb4eaaa);};}exports[_0xb0f6('0x2c')]=function(_0x529b6a,_0x53bd6d){var _0x49c8af={},_0x420fbd={},_0x3e72e3={'count':0x0,'rows':[]};var _0x1f6b06=_[_0xb0f6('0x2d')](db['OpenchannelApplication']['rawAttributes'],function(_0x2b352c){return{'name':_0x2b352c[_0xb0f6('0x2e')],'type':_0x2b352c[_0xb0f6('0x2f')][_0xb0f6('0x30')]};});_0x420fbd['model']=_[_0xb0f6('0x2d')](_0x1f6b06,_0xb0f6('0x2a'));_0x420fbd['query']=_[_0xb0f6('0x31')](_0x529b6a['query']);_0x420fbd[_0xb0f6('0x32')]=_[_0xb0f6('0x33')](_0x420fbd['model'],_0x420fbd[_0xb0f6('0x34')]);_0x49c8af[_0xb0f6('0x35')]=_[_0xb0f6('0x33')](_0x420fbd[_0xb0f6('0x36')],qs[_0xb0f6('0x37')](_0x529b6a[_0xb0f6('0x34')][_0xb0f6('0x37')]));_0x49c8af['attributes']=_0x49c8af[_0xb0f6('0x35')][_0xb0f6('0x38')]?_0x49c8af[_0xb0f6('0x35')]:_0x420fbd[_0xb0f6('0x36')];if(!_0x529b6a['query']['hasOwnProperty'](_0xb0f6('0x39'))){_0x49c8af[_0xb0f6('0x1f')]=qs['limit'](_0x529b6a['query'][_0xb0f6('0x1f')]);_0x49c8af[_0xb0f6('0x1e')]=qs[_0xb0f6('0x1e')](_0x529b6a[_0xb0f6('0x34')][_0xb0f6('0x1e')]);}_0x49c8af['order']=qs[_0xb0f6('0x3a')](_0x529b6a[_0xb0f6('0x34')]['sort']);_0x49c8af[_0xb0f6('0x3b')]=qs[_0xb0f6('0x32')](_[_0xb0f6('0x3c')](_0x529b6a[_0xb0f6('0x34')],_0x420fbd[_0xb0f6('0x32')]),_0x1f6b06);if(_0x529b6a[_0xb0f6('0x34')][_0xb0f6('0x3d')]){_0x49c8af[_0xb0f6('0x3b')]=_[_0xb0f6('0x3e')](_0x49c8af[_0xb0f6('0x3b')],{'$or':_[_0xb0f6('0x2d')](_0x1f6b06,function(_0xee6187){if(_0xee6187[_0xb0f6('0x2f')]!==_0xb0f6('0x3f')){var _0x594b3c={};_0x594b3c[_0xee6187[_0xb0f6('0x2a')]]={'$like':'%'+_0x529b6a[_0xb0f6('0x34')]['filter']+'%'};return _0x594b3c;}})});}_0x49c8af=_[_0xb0f6('0x3e')]({},_0x49c8af,_0x529b6a['options']);var _0x4ef486={'where':_0x49c8af[_0xb0f6('0x3b')]};return db[_0xb0f6('0x40')][_0xb0f6('0x21')](_0x4ef486)['then'](function(_0x3945c0){_0x3e72e3[_0xb0f6('0x21')]=_0x3945c0;if(_0x529b6a[_0xb0f6('0x34')][_0xb0f6('0x41')]){_0x49c8af[_0xb0f6('0x42')]=[{'all':!![]}];}return db[_0xb0f6('0x40')][_0xb0f6('0x43')](_0x49c8af);})[_0xb0f6('0x28')](function(_0x1ff36a){_0x3e72e3[_0xb0f6('0x44')]=_0x1ff36a;return _0x3e72e3;})['then'](respondWithFilteredResult(_0x53bd6d,_0x49c8af))[_0xb0f6('0x45')](handleError(_0x53bd6d,null));};exports[_0xb0f6('0x46')]=function(_0x302da8,_0x4a1637){var _0x41d0db={'raw':!![],'where':{'id':_0x302da8[_0xb0f6('0x47')]['id']}},_0x2a4cac={};_0x2a4cac[_0xb0f6('0x36')]=_[_0xb0f6('0x31')](db[_0xb0f6('0x40')][_0xb0f6('0x48')]);_0x2a4cac[_0xb0f6('0x34')]=_[_0xb0f6('0x31')](_0x302da8[_0xb0f6('0x34')]);_0x2a4cac[_0xb0f6('0x32')]=_['intersection'](_0x2a4cac['model'],_0x2a4cac['query']);_0x41d0db[_0xb0f6('0x35')]=_[_0xb0f6('0x33')](_0x2a4cac[_0xb0f6('0x36')],qs[_0xb0f6('0x37')](_0x302da8[_0xb0f6('0x34')][_0xb0f6('0x37')]));_0x41d0db['attributes']=_0x41d0db['attributes'][_0xb0f6('0x38')]?_0x41d0db['attributes']:_0x2a4cac[_0xb0f6('0x36')];if(_0x302da8[_0xb0f6('0x34')]['includeAll']){_0x41d0db[_0xb0f6('0x42')]=[{'all':!![]}];}_0x41d0db=_[_0xb0f6('0x3e')]({},_0x41d0db,_0x302da8[_0xb0f6('0x49')]);return db['OpenchannelApplication']['find'](_0x41d0db)[_0xb0f6('0x28')](handleEntityNotFound(_0x4a1637,null))[_0xb0f6('0x28')](respondWithResult(_0x4a1637,null))[_0xb0f6('0x45')](handleError(_0x4a1637,null));};exports[_0xb0f6('0x4a')]=function(_0x3227c3,_0x3c70d0){return db[_0xb0f6('0x40')][_0xb0f6('0x4a')](_0x3227c3[_0xb0f6('0x4b')],{})[_0xb0f6('0x28')](respondWithResult(_0x3c70d0,0xc9))[_0xb0f6('0x45')](handleError(_0x3c70d0,null));};exports[_0xb0f6('0x26')]=function(_0x264c86,_0x3607ac){if(_0x264c86[_0xb0f6('0x4b')]['id']){delete _0x264c86['body']['id'];}return db['OpenchannelApplication'][_0xb0f6('0x4c')]({'where':{'id':_0x264c86['params']['id']}})[_0xb0f6('0x28')](handleEntityNotFound(_0x3607ac,null))[_0xb0f6('0x28')](saveUpdates(_0x264c86[_0xb0f6('0x4b')],null))[_0xb0f6('0x28')](respondWithResult(_0x3607ac,null))['catch'](handleError(_0x3607ac,null));};exports[_0xb0f6('0x27')]=function(_0x4f8a93,_0x585fbd){return db[_0xb0f6('0x40')][_0xb0f6('0x4c')]({'where':{'id':_0x4f8a93[_0xb0f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x585fbd,null))['then'](removeEntity(_0x585fbd,null))[_0xb0f6('0x45')](handleError(_0x585fbd,null));}; \ No newline at end of file +var _0xf7d1=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','OpenchannelApplication','then','includeAll','include','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5685e7,_0x2d5cbb){var _0x315011=function(_0x367a8c){while(--_0x367a8c){_0x5685e7['push'](_0x5685e7['shift']());}};_0x315011(++_0x2d5cbb);}(_0xf7d1,0x1a8));var _0x1f7d=function(_0x349542,_0x2ba7e5){_0x349542=_0x349542-0x0;var _0x479110=_0xf7d1[_0x349542];return _0x479110;};'use strict';var emlformat=require(_0x1f7d('0x0'));var rimraf=require(_0x1f7d('0x1'));var zipdir=require(_0x1f7d('0x2'));var jsonpatch=require(_0x1f7d('0x3'));var rp=require(_0x1f7d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f7d('0x5'));var util=require(_0x1f7d('0x6'));var path=require(_0x1f7d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f7d('0x8'));var _=require(_0x1f7d('0x9'));var squel=require(_0x1f7d('0xa'));var crypto=require(_0x1f7d('0xb'));var jsforce=require(_0x1f7d('0xc'));var deskjs=require(_0x1f7d('0xd'));var toCsv=require(_0x1f7d('0xe'));var querystring=require('querystring');var Papa=require(_0x1f7d('0xf'));var Redis=require(_0x1f7d('0x10'));var authService=require(_0x1f7d('0x11'));var qs=require(_0x1f7d('0x12'));var as=require(_0x1f7d('0x13'));var hardwareService=require(_0x1f7d('0x14'));var logger=require(_0x1f7d('0x15'))(_0x1f7d('0x16'));var utils=require(_0x1f7d('0x17'));var config=require(_0x1f7d('0x18'));var licenseUtil=require(_0x1f7d('0x19'));var db=require(_0x1f7d('0x1a'))['db'];function respondWithStatusCode(_0x414831,_0x2652da){_0x2652da=_0x2652da||0xcc;return function(_0x8df899){if(_0x8df899){return _0x414831[_0x1f7d('0x1b')](_0x2652da);}return _0x414831[_0x1f7d('0x1c')](_0x2652da)[_0x1f7d('0x1d')]();};}function respondWithResult(_0x4dc4a2,_0x5196c){_0x5196c=_0x5196c||0xc8;return function(_0x48eff8){if(_0x48eff8){return _0x4dc4a2[_0x1f7d('0x1c')](_0x5196c)[_0x1f7d('0x1e')](_0x48eff8);}};}function respondWithFilteredResult(_0x568f62,_0x2248f8){return function(_0x5c60a1){if(_0x5c60a1){var _0x1264af=typeof _0x2248f8[_0x1f7d('0x1f')]==='undefined'&&typeof _0x2248f8[_0x1f7d('0x20')]===_0x1f7d('0x21');var _0x5f4baf=_0x5c60a1[_0x1f7d('0x22')];var _0x180ecd=_0x1264af?0x0:_0x2248f8[_0x1f7d('0x1f')];var _0x1aa8ca=_0x1264af?_0x5c60a1['count']:_0x2248f8['offset']+_0x2248f8['limit'];var _0x3061c0;if(_0x1aa8ca>=_0x5f4baf){_0x1aa8ca=_0x5f4baf;_0x3061c0=0xc8;}else{_0x3061c0=0xce;}_0x568f62['status'](_0x3061c0);return _0x568f62['set'](_0x1f7d('0x23'),_0x180ecd+'-'+_0x1aa8ca+'/'+_0x5f4baf)['json'](_0x5c60a1);}return null;};}function patchUpdates(_0x2ad67e){return function(_0x4265fe){try{jsonpatch[_0x1f7d('0x24')](_0x4265fe,_0x2ad67e,!![]);}catch(_0x4d8d4b){return BPromise['reject'](_0x4d8d4b);}return _0x4265fe[_0x1f7d('0x25')]();};}function saveUpdates(_0xa4dcf0,_0x51d579){return function(_0x39f5b0){if(_0x39f5b0){return _0x39f5b0[_0x1f7d('0x26')](_0xa4dcf0)['then'](function(_0x42854d){return _0x42854d;});}return null;};}function removeEntity(_0x1c5c71,_0x14ece7){return function(_0x4b5d83){if(_0x4b5d83){return _0x4b5d83[_0x1f7d('0x27')]()['then'](function(){_0x1c5c71[_0x1f7d('0x1c')](0xcc)[_0x1f7d('0x1d')]();});}};}function handleEntityNotFound(_0x57a02b,_0xb26346){return function(_0x58e767){if(!_0x58e767){_0x57a02b[_0x1f7d('0x1b')](0x194);}return _0x58e767;};}function handleError(_0x3ca6ac,_0x373afe){_0x373afe=_0x373afe||0x1f4;return function(_0x2b13d3){logger['error'](_0x2b13d3[_0x1f7d('0x28')]);if(_0x2b13d3['name']){delete _0x2b13d3[_0x1f7d('0x29')];}_0x3ca6ac[_0x1f7d('0x1c')](_0x373afe)[_0x1f7d('0x2a')](_0x2b13d3);};}exports[_0x1f7d('0x2b')]=function(_0x1f41ec,_0x1167c3){var _0x101e10={},_0x16d23e={},_0x524bc4={'count':0x0,'rows':[]};var _0x14e068=_[_0x1f7d('0x2c')](db['OpenchannelApplication']['rawAttributes'],function(_0x565ff2){return{'name':_0x565ff2[_0x1f7d('0x2d')],'type':_0x565ff2['type']['key']};});_0x16d23e[_0x1f7d('0x2e')]=_[_0x1f7d('0x2c')](_0x14e068,_0x1f7d('0x29'));_0x16d23e[_0x1f7d('0x2f')]=_[_0x1f7d('0x30')](_0x1f41ec['query']);_0x16d23e[_0x1f7d('0x31')]=_[_0x1f7d('0x32')](_0x16d23e['model'],_0x16d23e[_0x1f7d('0x2f')]);_0x101e10[_0x1f7d('0x33')]=_[_0x1f7d('0x32')](_0x16d23e['model'],qs[_0x1f7d('0x34')](_0x1f41ec['query'][_0x1f7d('0x34')]));_0x101e10[_0x1f7d('0x33')]=_0x101e10[_0x1f7d('0x33')][_0x1f7d('0x35')]?_0x101e10[_0x1f7d('0x33')]:_0x16d23e[_0x1f7d('0x2e')];if(!_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x36')](_0x1f7d('0x37'))){_0x101e10[_0x1f7d('0x20')]=qs[_0x1f7d('0x20')](_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x20')]);_0x101e10[_0x1f7d('0x1f')]=qs[_0x1f7d('0x1f')](_0x1f41ec[_0x1f7d('0x2f')]['offset']);}_0x101e10[_0x1f7d('0x38')]=qs['sort'](_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x39')]);_0x101e10[_0x1f7d('0x3a')]=qs[_0x1f7d('0x31')](_[_0x1f7d('0x3b')](_0x1f41ec[_0x1f7d('0x2f')],_0x16d23e[_0x1f7d('0x31')]),_0x14e068);if(_0x1f41ec[_0x1f7d('0x2f')]['filter']){_0x101e10[_0x1f7d('0x3a')]=_[_0x1f7d('0x3c')](_0x101e10[_0x1f7d('0x3a')],{'$or':_[_0x1f7d('0x2c')](_0x14e068,function(_0x1906e2){if(_0x1906e2['type']!=='VIRTUAL'){var _0x2cf55a={};_0x2cf55a[_0x1906e2[_0x1f7d('0x29')]]={'$like':'%'+_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x3d')]+'%'};return _0x2cf55a;}})});}_0x101e10=_[_0x1f7d('0x3c')]({},_0x101e10,_0x1f41ec[_0x1f7d('0x3e')]);var _0x109926={'where':_0x101e10[_0x1f7d('0x3a')]};return db[_0x1f7d('0x3f')][_0x1f7d('0x22')](_0x109926)[_0x1f7d('0x40')](function(_0x120f2f){_0x524bc4['count']=_0x120f2f;if(_0x1f41ec['query'][_0x1f7d('0x41')]){_0x101e10[_0x1f7d('0x42')]=[{'all':!![]}];}return db[_0x1f7d('0x3f')]['findAll'](_0x101e10);})[_0x1f7d('0x40')](function(_0x2078ee){_0x524bc4['rows']=_0x2078ee;return _0x524bc4;})[_0x1f7d('0x40')](respondWithFilteredResult(_0x1167c3,_0x101e10))[_0x1f7d('0x43')](handleError(_0x1167c3,null));};exports[_0x1f7d('0x44')]=function(_0x4e2b31,_0x4ad387){var _0x1523f9={'raw':!![],'where':{'id':_0x4e2b31[_0x1f7d('0x45')]['id']}},_0x1930e4={};_0x1930e4[_0x1f7d('0x2e')]=_[_0x1f7d('0x30')](db[_0x1f7d('0x3f')][_0x1f7d('0x46')]);_0x1930e4[_0x1f7d('0x2f')]=_[_0x1f7d('0x30')](_0x4e2b31[_0x1f7d('0x2f')]);_0x1930e4[_0x1f7d('0x31')]=_[_0x1f7d('0x32')](_0x1930e4[_0x1f7d('0x2e')],_0x1930e4[_0x1f7d('0x2f')]);_0x1523f9['attributes']=_[_0x1f7d('0x32')](_0x1930e4[_0x1f7d('0x2e')],qs['fields'](_0x4e2b31[_0x1f7d('0x2f')]['fields']));_0x1523f9['attributes']=_0x1523f9[_0x1f7d('0x33')][_0x1f7d('0x35')]?_0x1523f9[_0x1f7d('0x33')]:_0x1930e4[_0x1f7d('0x2e')];if(_0x4e2b31['query'][_0x1f7d('0x41')]){_0x1523f9[_0x1f7d('0x42')]=[{'all':!![]}];}_0x1523f9=_[_0x1f7d('0x3c')]({},_0x1523f9,_0x4e2b31[_0x1f7d('0x3e')]);return db['OpenchannelApplication'][_0x1f7d('0x47')](_0x1523f9)['then'](handleEntityNotFound(_0x4ad387,null))[_0x1f7d('0x40')](respondWithResult(_0x4ad387,null))['catch'](handleError(_0x4ad387,null));};exports['create']=function(_0x58e4ff,_0x38252f){return db[_0x1f7d('0x3f')][_0x1f7d('0x48')](_0x58e4ff[_0x1f7d('0x49')],{})[_0x1f7d('0x40')](respondWithResult(_0x38252f,0xc9))[_0x1f7d('0x43')](handleError(_0x38252f,null));};exports[_0x1f7d('0x26')]=function(_0x508933,_0x3b4630){if(_0x508933[_0x1f7d('0x49')]['id']){delete _0x508933[_0x1f7d('0x49')]['id'];}return db[_0x1f7d('0x3f')]['find']({'where':{'id':_0x508933[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x40')](handleEntityNotFound(_0x3b4630,null))[_0x1f7d('0x40')](saveUpdates(_0x508933[_0x1f7d('0x49')],null))[_0x1f7d('0x40')](respondWithResult(_0x3b4630,null))[_0x1f7d('0x43')](handleError(_0x3b4630,null));};exports[_0x1f7d('0x27')]=function(_0x3cf92d,_0x5be70d){return db['OpenchannelApplication'][_0x1f7d('0x47')]({'where':{'id':_0x3cf92d['params']['id']}})[_0x1f7d('0x40')](handleEntityNotFound(_0x5be70d,null))['then'](removeEntity(_0x5be70d,null))['catch'](handleError(_0x5be70d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2595852..29094e8 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 _0x0b80=['moment','bluebird','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5aa00a,_0x5a6a3c){var _0x13999d=function(_0x5407f5){while(--_0x5407f5){_0x5aa00a['push'](_0x5aa00a['shift']());}};_0x13999d(++_0x5a6a3c);}(_0x0b80,0x171));var _0x00b8=function(_0xd50b5f,_0xb8bb94){_0xd50b5f=_0xd50b5f-0x0;var _0x2aa051=_0x0b80[_0xd50b5f];return _0x2aa051;};'use strict';var _=require(_0x00b8('0x0'));var util=require('util');var logger=require(_0x00b8('0x1'))(_0x00b8('0x2'));var moment=require(_0x00b8('0x3'));var BPromise=require(_0x00b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x00b8('0x5'));var attributes=require(_0x00b8('0x6'));module[_0x00b8('0x7')]=function(_0x422e14,_0x282f62){return _0x422e14['define'](_0x00b8('0x8'),attributes,{'tableName':_0x00b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x00b8('0xa'),'collate':_0x00b8('0xb')});}; \ No newline at end of file +var _0x6383=['exports','define','openchannel_applications','utf8mb4','lodash','util','api','moment','bluebird','path','./openchannelApplication.attributes'];(function(_0x56585b,_0x2f45cd){var _0xe7002f=function(_0x57b451){while(--_0x57b451){_0x56585b['push'](_0x56585b['shift']());}};_0xe7002f(++_0x2f45cd);}(_0x6383,0x117));var _0x3638=function(_0x2e7b74,_0x313472){_0x2e7b74=_0x2e7b74-0x0;var _0x54a082=_0x6383[_0x2e7b74];return _0x54a082;};'use strict';var _=require(_0x3638('0x0'));var util=require(_0x3638('0x1'));var logger=require('../../config/logger')(_0x3638('0x2'));var moment=require(_0x3638('0x3'));var BPromise=require(_0x3638('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3638('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3638('0x6'));module[_0x3638('0x7')]=function(_0x4e9c33,_0x3b7eaa){return _0x4e9c33[_0x3638('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x3638('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3638('0xa'),'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 f83ea44..33eb7d5 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 _0xfc49=['../../config/environment','jayson/promise','client','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x443992,_0x1c37a2){var _0xa88a4c=function(_0xa5bcc1){while(--_0xa5bcc1){_0x443992['push'](_0x443992['shift']());}};_0xa88a4c(++_0x1c37a2);}(_0xfc49,0x98));var _0x9fc4=function(_0x22d17b,_0xf2182e){_0x22d17b=_0x22d17b-0x0;var _0x2f2bb3=_0xfc49[_0x22d17b];return _0x2f2bb3;};'use strict';var _=require('lodash');var util=require(_0x9fc4('0x0'));var moment=require(_0x9fc4('0x1'));var BPromise=require(_0x9fc4('0x2'));var rs=require(_0x9fc4('0x3'));var fs=require('fs');var Redis=require(_0x9fc4('0x4'));var db=require(_0x9fc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fc4('0x6'))(_0x9fc4('0x7'));var config=require(_0x9fc4('0x8'));var jayson=require(_0x9fc4('0x9'));var client=jayson[_0x9fc4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d35dc,_0x25d7e4,_0x2fd69b){return new BPromise(function(_0x18590f,_0x59bb73){return client[_0x9fc4('0xb')](_0x1d35dc,_0x2fd69b)['then'](function(_0x3f4f40){logger[_0x9fc4('0xc')](_0x9fc4('0xd'),_0x25d7e4,_0x9fc4('0xe'));logger[_0x9fc4('0xf')](_0x9fc4('0x10'),_0x25d7e4,_0x9fc4('0xe'),JSON['stringify'](_0x3f4f40));if(_0x3f4f40[_0x9fc4('0x11')]){if(_0x3f4f40[_0x9fc4('0x11')]['code']===0x1f4){logger[_0x9fc4('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x25d7e4,_0x3f4f40[_0x9fc4('0x11')][_0x9fc4('0x12')]);return _0x59bb73(_0x3f4f40['error']['message']);}logger[_0x9fc4('0x11')](_0x9fc4('0xd'),_0x25d7e4,_0x3f4f40['error'][_0x9fc4('0x12')]);return _0x18590f(_0x3f4f40[_0x9fc4('0x11')][_0x9fc4('0x12')]);}else{logger[_0x9fc4('0xc')](_0x9fc4('0xd'),_0x25d7e4,_0x9fc4('0xe'));_0x18590f(_0x3f4f40[_0x9fc4('0x13')]['message']);}})[_0x9fc4('0x14')](function(_0x504e16){logger['error'](_0x9fc4('0xd'),_0x25d7e4,_0x504e16);_0x59bb73(_0x504e16);});});}exports[_0x9fc4('0x15')]=function(_0x8e1739){var _0x45d1c1=this;return new Promise(function(_0x5f24dc,_0x109ecf){return db[_0x9fc4('0x16')][_0x9fc4('0x17')](_0x8e1739[_0x9fc4('0x18')],{'raw':_0x8e1739[_0x9fc4('0x19')]?_0x8e1739[_0x9fc4('0x19')][_0x9fc4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e1739[_0x9fc4('0x19')]?_0x8e1739['options'][_0x9fc4('0x1b')]||null:null,'attributes':_0x8e1739[_0x9fc4('0x19')]?_0x8e1739[_0x9fc4('0x19')][_0x9fc4('0x1c')]||null:null,'limit':_0x8e1739[_0x9fc4('0x19')]?_0x8e1739['options'][_0x9fc4('0x1d')]||null:null})[_0x9fc4('0x1e')](function(_0xe35ddf){logger[_0x9fc4('0xc')](_0x9fc4('0x15'),_0x8e1739);logger['debug'](_0x9fc4('0x15'),_0x8e1739,JSON[_0x9fc4('0x1f')](_0xe35ddf));_0x5f24dc(_0xe35ddf);})['catch'](function(_0x18abcb){logger[_0x9fc4('0x11')](_0x9fc4('0x15'),_0x18abcb[_0x9fc4('0x12')],_0x8e1739);_0x109ecf(_0x45d1c1[_0x9fc4('0x11')](0x1f4,_0x18abcb[_0x9fc4('0x12')]));});});}; \ No newline at end of file +var _0x286a=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','attributes'];(function(_0x3aa931,_0x845306){var _0x48214e=function(_0x3f6e1b){while(--_0x3f6e1b){_0x3aa931['push'](_0x3aa931['shift']());}};_0x48214e(++_0x845306);}(_0x286a,0xe9));var _0xa286=function(_0x14e861,_0xb0836e){_0x14e861=_0x14e861-0x0;var _0x20e408=_0x286a[_0x14e861];return _0x20e408;};'use strict';var _=require(_0xa286('0x0'));var util=require(_0xa286('0x1'));var moment=require(_0xa286('0x2'));var BPromise=require(_0xa286('0x3'));var rs=require(_0xa286('0x4'));var fs=require('fs');var Redis=require(_0xa286('0x5'));var db=require(_0xa286('0x6'))['db'];var utils=require(_0xa286('0x7'));var logger=require(_0xa286('0x8'))(_0xa286('0x9'));var config=require(_0xa286('0xa'));var jayson=require(_0xa286('0xb'));var client=jayson[_0xa286('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45df6c,_0x23549d,_0x4c65c7){return new BPromise(function(_0x41f4dc,_0x12d707){return client[_0xa286('0xd')](_0x45df6c,_0x4c65c7)['then'](function(_0x4efc98){logger[_0xa286('0xe')](_0xa286('0xf'),_0x23549d,_0xa286('0x10'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x23549d,_0xa286('0x10'),JSON[_0xa286('0x11')](_0x4efc98));if(_0x4efc98[_0xa286('0x12')]){if(_0x4efc98['error']['code']===0x1f4){logger[_0xa286('0x12')](_0xa286('0xf'),_0x23549d,_0x4efc98['error']['message']);return _0x12d707(_0x4efc98['error'][_0xa286('0x13')]);}logger[_0xa286('0x12')](_0xa286('0xf'),_0x23549d,_0x4efc98['error'][_0xa286('0x13')]);return _0x41f4dc(_0x4efc98[_0xa286('0x12')]['message']);}else{logger['info'](_0xa286('0xf'),_0x23549d,_0xa286('0x10'));_0x41f4dc(_0x4efc98[_0xa286('0x14')]['message']);}})[_0xa286('0x15')](function(_0x24217d){logger['error'](_0xa286('0xf'),_0x23549d,_0x24217d);_0x12d707(_0x24217d);});});}exports[_0xa286('0x16')]=function(_0x26abaa){var _0x3900e5=this;return new Promise(function(_0x35475f,_0x448025){return db[_0xa286('0x17')][_0xa286('0x18')](_0x26abaa['body'],{'raw':_0x26abaa[_0xa286('0x19')]?_0x26abaa[_0xa286('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26abaa['options']?_0x26abaa[_0xa286('0x19')][_0xa286('0x1a')]||null:null,'attributes':_0x26abaa[_0xa286('0x19')]?_0x26abaa['options'][_0xa286('0x1b')]||null:null,'limit':_0x26abaa[_0xa286('0x19')]?_0x26abaa[_0xa286('0x19')][_0xa286('0x1c')]||null:null})['then'](function(_0x6e55d7){logger[_0xa286('0xe')](_0xa286('0x16'),_0x26abaa);logger['debug'](_0xa286('0x16'),_0x26abaa,JSON[_0xa286('0x11')](_0x6e55d7));_0x35475f(_0x6e55d7);})[_0xa286('0x15')](function(_0x396888){logger['error'](_0xa286('0x16'),_0x396888[_0xa286('0x13')],_0x26abaa);_0x448025(_0x3900e5[_0xa286('0x12')](0x1f4,_0x396888[_0xa286('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a572cad..8fd04a0 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 _0x26ab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','path','connect-timeout'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x26ab,0x13d));var _0xb26a=function(_0x523f2e,_0x43463c){_0x523f2e=_0x523f2e-0x0;var _0x172362=_0x26ab[_0x523f2e];return _0x172362;};'use strict';var multer=require(_0xb26a('0x0'));var util=require('util');var path=require(_0xb26a('0x1'));var timeout=require(_0xb26a('0x2'));var express=require(_0xb26a('0x3'));var router=express[_0xb26a('0x4')]();var fs_extra=require(_0xb26a('0x5'));var auth=require(_0xb26a('0x6'));var interaction=require(_0xb26a('0x7'));var config=require(_0xb26a('0x8'));var controller=require(_0xb26a('0x9'));router[_0xb26a('0xa')]('/',auth['isAuthenticated'](),controller[_0xb26a('0xb')]);router[_0xb26a('0xa')](_0xb26a('0xc'),auth[_0xb26a('0xd')](),controller[_0xb26a('0xe')]);router[_0xb26a('0xa')](_0xb26a('0xf'),auth['isAuthenticated'](),controller[_0xb26a('0x10')]);router[_0xb26a('0xa')]('/:id/messages',auth[_0xb26a('0xd')](),controller[_0xb26a('0x11')]);router[_0xb26a('0xa')](_0xb26a('0x12'),auth[_0xb26a('0xd')](),controller['download']);router[_0xb26a('0x13')]('/',auth[_0xb26a('0xd')](),controller[_0xb26a('0x14')]);router[_0xb26a('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xb26a('0x13')](_0xb26a('0x15'),auth[_0xb26a('0xd')](),interaction['tracked'](_0xb26a('0x16'),_0xb26a('0x17')),controller['addTags']);router[_0xb26a('0x18')]('/:id',auth[_0xb26a('0xd')](),interaction[_0xb26a('0x19')]('openchannel',_0xb26a('0x1a')),controller[_0xb26a('0x1b')]);router[_0xb26a('0x1c')]('/:id',auth[_0xb26a('0xd')](),interaction['tracked'](_0xb26a('0x16'),'openchannelinteraction:destroy'),controller[_0xb26a('0x1d')]);router[_0xb26a('0x1c')](_0xb26a('0x15'),auth[_0xb26a('0xd')](),controller[_0xb26a('0x1e')]);module[_0xb26a('0x1f')]=router; \ No newline at end of file +var _0x4f9b=['./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannel','openchannelinteraction:destroy','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x4f9b,0x154));var _0xb4f9=function(_0x59e62a,_0x24befb){_0x59e62a=_0x59e62a-0x0;var _0x283057=_0x4f9b[_0x59e62a];return _0x283057;};'use strict';var multer=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4f9('0x2'));var router=express[_0xb4f9('0x3')]();var fs_extra=require(_0xb4f9('0x4'));var auth=require(_0xb4f9('0x5'));var interaction=require(_0xb4f9('0x6'));var config=require(_0xb4f9('0x7'));var controller=require(_0xb4f9('0x8'));router[_0xb4f9('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4f9('0xa')]);router[_0xb4f9('0x9')](_0xb4f9('0xb'),auth[_0xb4f9('0xc')](),controller['describe']);router[_0xb4f9('0x9')](_0xb4f9('0xd'),auth[_0xb4f9('0xc')](),controller['show']);router[_0xb4f9('0x9')]('/:id/messages',auth[_0xb4f9('0xc')](),controller[_0xb4f9('0xe')]);router[_0xb4f9('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xb4f9('0xf')]);router[_0xb4f9('0x10')]('/',auth[_0xb4f9('0xc')](),controller['create']);router[_0xb4f9('0x10')](_0xb4f9('0x11'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x12')]);router[_0xb4f9('0x10')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),interaction[_0xb4f9('0x14')]('openchannel',_0xb4f9('0x15')),controller[_0xb4f9('0x16')]);router[_0xb4f9('0x17')](_0xb4f9('0xd'),auth['isAuthenticated'](),interaction[_0xb4f9('0x14')]('openchannel',_0xb4f9('0x18')),controller[_0xb4f9('0x19')]);router['delete'](_0xb4f9('0xd'),auth['isAuthenticated'](),interaction[_0xb4f9('0x14')](_0xb4f9('0x1a'),_0xb4f9('0x1b')),controller['destroy']);router[_0xb4f9('0x1c')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index deb49ba..efb402d 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 _0x6ea9=['DATE','STRING','ENUM','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x6ea9,0x89));var _0x96ea=function(_0x58ea63,_0xfca155){_0x58ea63=_0x58ea63-0x0;var _0x27e7e4=_0x6ea9[_0x58ea63];return _0x27e7e4;};'use strict';var Sequelize=require(_0x96ea('0x0'));module[_0x96ea('0x1')]={'closed':{'type':Sequelize[_0x96ea('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x96ea('0x3')]},'disposition':{'type':Sequelize[_0x96ea('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x96ea('0x4')]},'note':{'type':Sequelize[_0x96ea('0x4')]},'read1stAt':{'type':Sequelize[_0x96ea('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x96ea('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x96ea('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x96ea('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x96ea('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x96ea('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96ea('0x6')]}}; \ No newline at end of file +var _0xc116=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xa20c56,_0x2b48b6){var _0x2f9eaa=function(_0x29f8ed){while(--_0x29f8ed){_0xa20c56['push'](_0xa20c56['shift']());}};_0x2f9eaa(++_0x2b48b6);}(_0xc116,0x164));var _0x6c11=function(_0x386de8,_0x13ae17){_0x386de8=_0x386de8-0x0;var _0x469b3c=_0xc116[_0x386de8];return _0x469b3c;};'use strict';var Sequelize=require(_0x6c11('0x0'));module[_0x6c11('0x1')]={'closed':{'type':Sequelize[_0x6c11('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6c11('0x3')]},'disposition':{'type':Sequelize[_0x6c11('0x4')]},'secondDisposition':{'type':Sequelize[_0x6c11('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6c11('0x4')]},'note':{'type':Sequelize[_0x6c11('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6c11('0x4')]},'externalUrl':{'type':Sequelize[_0x6c11('0x4')]},'lastMsgAt':{'type':Sequelize[_0x6c11('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6c11('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6c11('0x5')]('in',_0x6c11('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x6c11('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6b42bbd..bd74136 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 _0x661e=['N.A.','createdAt','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','user','query','from','params','model','keys','intersection','attributes','fields','includeAll','include','options','OpenchannelInteraction','find','catch','create','body','describe','addMessage','ids','omit','findOne','OpenchannelMessage','filters','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','where','rows','addTags','setTags','spread','Tag','color','emit','removeTags','toString','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','read','get','mkdirSync','Openchannel','Account','Owner'];(function(_0xf82dba,_0x1dc9b9){var _0x4463d9=function(_0x119903){while(--_0x119903){_0xf82dba['push'](_0xf82dba['shift']());}};_0x4463d9(++_0x1dc9b9);}(_0x661e,0x120));var _0xe661=function(_0x4b46ad,_0x135e63){_0x4b46ad=_0x4b46ad-0x0;var _0x3f9e21=_0x661e[_0x4b46ad];return _0x3f9e21;};'use strict';var rimraf=require(_0xe661('0x0'));var zipdir=require(_0xe661('0x1'));var moment=require(_0xe661('0x2'));var util=require(_0xe661('0x3'));var path=require(_0xe661('0x4'));var ejs=require(_0xe661('0x5'));var fs=require('fs');var _=require(_0xe661('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xe661('0x7'));var pdf=require(_0xe661('0x8'));var logger=require(_0xe661('0x9'))('api');var config=require(_0xe661('0xa'));var db=require(_0xe661('0xb'))['db'];config[_0xe661('0xc')]=_['defaults'](config[_0xe661('0xc')],{'host':_0xe661('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe661('0xc')]));require('./openchannelInteraction.socket')[_0xe661('0xe')](socket);function respondWithStatusCode(_0x1410c0,_0x4f5570){_0x4f5570=_0x4f5570||0xcc;return function(_0x2ecf46){if(_0x2ecf46){return _0x1410c0[_0xe661('0xf')](_0x4f5570);}return _0x1410c0['status'](_0x4f5570)[_0xe661('0x10')]();};}function respondWithResult(_0x35f239,_0x300cbb){_0x300cbb=_0x300cbb||0xc8;return function(_0xa6e2b6){if(_0xa6e2b6){return _0x35f239[_0xe661('0x11')](_0x300cbb)[_0xe661('0x12')](_0xa6e2b6);}};}function respondWithFilteredResult(_0x2032ba,_0x46e4aa){return function(_0xdef3b5){if(_0xdef3b5){var _0xdc465e=typeof _0x46e4aa[_0xe661('0x13')]===_0xe661('0x14')&&typeof _0x46e4aa[_0xe661('0x15')]===_0xe661('0x14');var _0x3ab353=_0xdef3b5[_0xe661('0x16')];var _0x56a6e1=_0xdc465e?0x0:_0x46e4aa[_0xe661('0x13')];var _0x2ea1a5=_0xdc465e?_0xdef3b5[_0xe661('0x16')]:_0x46e4aa['offset']+_0x46e4aa[_0xe661('0x15')];var _0x203fe1;if(_0x2ea1a5>=_0x3ab353){_0x2ea1a5=_0x3ab353;_0x203fe1=0xc8;}else{_0x203fe1=0xce;}_0x2032ba[_0xe661('0x11')](_0x203fe1);return _0x2032ba[_0xe661('0x17')](_0xe661('0x18'),_0x56a6e1+'-'+_0x2ea1a5+'/'+_0x3ab353)[_0xe661('0x12')](_0xdef3b5);}return null;};}function saveUpdates(_0x39f506){return function(_0xc53a5){if(_0xc53a5){return _0xc53a5[_0xe661('0x19')](_0x39f506)[_0xe661('0x1a')](function(_0x417b88){return _0x417b88;});}return null;};}function removeEntity(_0x4364fe){return function(_0x21a5bb){if(_0x21a5bb){return _0x21a5bb[_0xe661('0x1b')]()['then'](function(){_0x4364fe[_0xe661('0x11')](0xcc)[_0xe661('0x10')]();});}};}function handleEntityNotFound(_0x532201){return function(_0x50f54f){if(!_0x50f54f){_0x532201[_0xe661('0xf')](0x194);}return _0x50f54f;};}function handleError(_0xbafcc0,_0xac323f){_0xac323f=_0xac323f||0x1f4;return function(_0x3eaf91){logger[_0xe661('0x1c')](_0x3eaf91['stack']);if(_0x3eaf91[_0xe661('0x1d')]){delete _0x3eaf91['name'];}_0xbafcc0[_0xe661('0x11')](_0xac323f)[_0xe661('0x1e')](_0x3eaf91);};}exports[_0xe661('0x1f')]=function(_0x5cb039,_0x5c8576){var _0x1eff18={};var _0x33cba7=_[_0xe661('0x20')](db['OpenchannelInteraction'][_0xe661('0x21')],function(_0x1267ac){return{'name':_0x1267ac[_0xe661('0x22')],'type':_0x1267ac[_0xe661('0x23')][_0xe661('0x24')]};});_0x1eff18=qs[_0xe661('0x25')](_0x33cba7,_0x5cb039);return interaction[_0xe661('0x26')](_0xe661('0x27'),_0x5cb039['query'],_0x5cb039[_0xe661('0x28')],_0x1eff18,_0x33cba7)['then'](respondWithFilteredResult(_0x5c8576,_0x1eff18))['catch'](handleError(_0x5c8576,null));};exports['show']=function(_0x487681,_0x1c6d17){var _0x6a7932={};if(_0x487681[_0xe661('0x29')][_0xe661('0x23')]&&_0x487681[_0xe661('0x29')][_0xe661('0x23')]===_0xe661('0x2a')){_0x6a7932[_0xe661('0x2a')]=_0x487681[_0xe661('0x2b')]['id'];}else{_0x6a7932['id']=_0x487681['params']['id'];}var _0x110548={'raw':![],'where':_0x6a7932},_0x153dfc={};_0x153dfc[_0xe661('0x2c')]=_[_0xe661('0x2d')](db['OpenchannelInteraction'][_0xe661('0x21')]);_0x153dfc['query']=_[_0xe661('0x2d')](_0x487681[_0xe661('0x29')]);_0x153dfc['filters']=_[_0xe661('0x2e')](_0x153dfc[_0xe661('0x2c')],_0x153dfc['query']);_0x110548[_0xe661('0x2f')]=_[_0xe661('0x2e')](_0x153dfc[_0xe661('0x2c')],qs[_0xe661('0x30')](_0x487681[_0xe661('0x29')][_0xe661('0x30')]));_0x110548['attributes']=_0x110548['attributes']['length']?_0x110548[_0xe661('0x2f')]:_0x153dfc[_0xe661('0x2c')];if(_0x487681[_0xe661('0x29')][_0xe661('0x31')]){_0x110548[_0xe661('0x32')]=[{'all':!![]}];}_0x110548=_['merge']({},_0x110548,_0x487681[_0xe661('0x33')]);return db[_0xe661('0x34')][_0xe661('0x35')](_0x110548)[_0xe661('0x1a')](handleEntityNotFound(_0x1c6d17,null))[_0xe661('0x1a')](respondWithResult(_0x1c6d17,null))[_0xe661('0x36')](handleError(_0x1c6d17,null));};exports[_0xe661('0x37')]=function(_0xba580d,_0x251266){return db['OpenchannelInteraction'][_0xe661('0x37')](_0xba580d[_0xe661('0x38')],{})[_0xe661('0x1a')](respondWithResult(_0x251266,0xc9))[_0xe661('0x36')](handleError(_0x251266,null));};exports[_0xe661('0x19')]=function(_0x1665a0,_0x1b3ecf){if(_0x1665a0['body']['id']){delete _0x1665a0['body']['id'];}return db[_0xe661('0x34')][_0xe661('0x35')]({'where':{'id':_0x1665a0[_0xe661('0x2b')]['id']}})[_0xe661('0x1a')](handleEntityNotFound(_0x1b3ecf,null))[_0xe661('0x1a')](saveUpdates(_0x1665a0[_0xe661('0x38')],null))[_0xe661('0x1a')](respondWithResult(_0x1b3ecf,null))[_0xe661('0x36')](handleError(_0x1b3ecf,null));};exports[_0xe661('0x1b')]=function(_0x34c6d1,_0xbe266c){return db[_0xe661('0x34')][_0xe661('0x35')]({'where':{'id':_0x34c6d1[_0xe661('0x2b')]['id']}})[_0xe661('0x1a')](handleEntityNotFound(_0xbe266c,null))[_0xe661('0x1a')](removeEntity(_0xbe266c,null))['catch'](handleError(_0xbe266c,null));};exports[_0xe661('0x39')]=function(_0x1e0966,_0x2e0b8c){return db[_0xe661('0x34')][_0xe661('0x39')]()[_0xe661('0x1a')](respondWithResult(_0x2e0b8c,null))['catch'](handleError(_0x2e0b8c,null));};exports[_0xe661('0x3a')]=function(_0x5a4945,_0x2d33c9){return db['OpenchannelMessage']['find']({'where':{'id':_0x5a4945[_0xe661('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2d33c9,null))['then'](function(_0x510b04){if(_0x510b04){return _0x510b04[_0xe661('0x3a')](_0x5a4945[_0xe661('0x38')][_0xe661('0x3b')],_[_0xe661('0x3c')](_0x5a4945[_0xe661('0x38')],[_0xe661('0x3b'),'id'])||{});}})[_0xe661('0x1a')](respondWithResult(_0x2d33c9,null))['catch'](handleError(_0x2d33c9,null));};exports['getMessages']=function(_0x5e5ad4,_0x43295a){var _0x47a803={'raw':![],'where':{}};var _0x23af52={};var _0x18276b={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xe661('0x3d')]({'where':{'id':_0x5e5ad4[_0xe661('0x2b')]['id']}})[_0xe661('0x1a')](handleEntityNotFound(_0x43295a,null))[_0xe661('0x1a')](function(_0x4ef1e4){if(_0x4ef1e4){_0x23af52[_0xe661('0x2c')]=_[_0xe661('0x2d')](db[_0xe661('0x3e')][_0xe661('0x21')]);_0x23af52[_0xe661('0x29')]=_['keys'](_0x5e5ad4[_0xe661('0x29')]);_0x23af52[_0xe661('0x3f')]=_[_0xe661('0x2e')](_0x23af52['model'],_0x23af52[_0xe661('0x29')]);_0x47a803['attributes']=_[_0xe661('0x2e')](_0x23af52[_0xe661('0x2c')],qs[_0xe661('0x30')](_0x5e5ad4[_0xe661('0x29')][_0xe661('0x30')]));_0x47a803['attributes']=_0x47a803[_0xe661('0x2f')][_0xe661('0x40')]?_0x47a803[_0xe661('0x2f')]:_0x23af52[_0xe661('0x2c')];if(!_0x5e5ad4[_0xe661('0x29')][_0xe661('0x41')](_0xe661('0x42'))){_0x47a803[_0xe661('0x15')]=qs[_0xe661('0x15')](_0x5e5ad4['query'][_0xe661('0x15')]);_0x47a803[_0xe661('0x13')]=qs[_0xe661('0x13')](_0x5e5ad4[_0xe661('0x29')][_0xe661('0x13')]);}_0x47a803[_0xe661('0x43')]=qs[_0xe661('0x44')](_0x5e5ad4[_0xe661('0x29')]['sort']);_0x47a803['where']=qs[_0xe661('0x3f')](_[_0xe661('0x45')](_0x5e5ad4[_0xe661('0x29')],_0x23af52[_0xe661('0x3f')]));_0x47a803['where']['OpenchannelInteractionId']=_0x4ef1e4['id'];if(_0x5e5ad4[_0xe661('0x29')][_0xe661('0x46')]){_0x47a803['where']=_[_0xe661('0x47')](_0x47a803['where'],{'$or':_[_0xe661('0x20')](_0x47a803[_0xe661('0x2f')],function(_0x388ebf){var _0xeae818={};_0xeae818[_0x388ebf]={'$like':'%'+_0x5e5ad4[_0xe661('0x29')]['filter']+'%'};return _0xeae818;})});}if(_0x5e5ad4['query'][_0xe661('0x48')]){var _0x5e8e6e=_0x5e5ad4[_0xe661('0x29')][_0xe661('0x48')][_0xe661('0x49')](',');var _0x5bec7c={};_0x5bec7c[_0x5e8e6e[0x0]]={'$gte':moment(_0x5e8e6e[0x1])[_0xe661('0x4a')](_0xe661('0x4b'))};_0x47a803[_0xe661('0x4c')]=_[_0xe661('0x47')](_0x47a803[_0xe661('0x4c')],_0x5bec7c);}_0x47a803=_[_0xe661('0x47')]({},_0x47a803,_0x5e5ad4[_0xe661('0x33')]);return db['OpenchannelMessage'][_0xe661('0x16')]({'where':_0x47a803[_0xe661('0x4c')]})[_0xe661('0x1a')](function(_0x4010a6){_0x18276b['count']=_0x4010a6;if(_0x5e5ad4[_0xe661('0x29')][_0xe661('0x31')]){_0x47a803[_0xe661('0x32')]=[{'all':!![]}];}return db[_0xe661('0x3e')][_0xe661('0x26')](_0x47a803);})[_0xe661('0x1a')](function(_0x47735a){_0x18276b[_0xe661('0x4d')]=_0x47735a;return _0x18276b;});}})[_0xe661('0x1a')](respondWithFilteredResult(_0x43295a,_0x47a803))['catch'](handleError(_0x43295a,null));};exports[_0xe661('0x4e')]=function(_0x106523,_0x3045c0){return db['OpenchannelInteraction'][_0xe661('0x35')]({'where':{'id':_0x106523['params']['id']}})[_0xe661('0x1a')](handleEntityNotFound(_0x3045c0,null))[_0xe661('0x1a')](function(_0x11d912){if(_0x11d912){return _0x11d912[_0xe661('0x4f')](_0x106523['body'][_0xe661('0x3b')],_['omit'](_0x106523[_0xe661('0x38')],[_0xe661('0x3b'),'id'])||{})[_0xe661('0x50')](function(){return db[_0xe661('0x51')]['findAll']({'attributes':['id',_0xe661('0x1d'),_0xe661('0x52')],'where':{'id':_0x106523['body']['ids']}});})['then'](function(_0x39a020){socket[_0xe661('0x53')]('openchannelInteractionTags:save',{'id':Number(_0x106523[_0xe661('0x2b')]['id']),'tags':_0x39a020||[]});return{'id':Number(_0x106523[_0xe661('0x2b')]['id']),'tags':_0x39a020||[]};});}})[_0xe661('0x1a')](respondWithResult(_0x3045c0,null))[_0xe661('0x36')](handleError(_0x3045c0,null));};exports['removeTags']=function(_0x47482e,_0x7ca703){return db[_0xe661('0x34')][_0xe661('0x35')]({'where':{'id':_0x47482e[_0xe661('0x2b')]['id']}})['then'](handleEntityNotFound(_0x7ca703,null))['then'](function(_0x30354d){if(_0x30354d){return _0x30354d[_0xe661('0x54')](_0x47482e['query'][_0xe661('0x3b')]);}})[_0xe661('0x1a')](respondWithStatusCode(_0x7ca703,null))[_0xe661('0x36')](handleError(_0x7ca703,null));};exports['download']=function(_0x772fc7,_0x533a6e){var _0x430a36=moment()['unix']()[_0xe661('0x55')]();var _0x23a401=path[_0xe661('0x56')](config[_0xe661('0x57')],_0xe661('0x58'),_0xe661('0x59'),_0xe661('0x5a'));var _0x4c6a1d=path[_0xe661('0x56')](config[_0xe661('0x57')],_0xe661('0x58'),_0xe661('0x59'),_0xe661('0x5b'));var _0x4012e8=path[_0xe661('0x56')](_0x23a401,_0x430a36);var _0x48012c=util[_0xe661('0x4a')]('transcript-%d-%s.zip',_0x772fc7[_0xe661('0x2b')]['id'],_0x430a36);var _0x5423ab=path[_0xe661('0x56')](_0x23a401,_0x48012c);var _0x2ddf20=[];_0x2ddf20[_0xe661('0x5c')]({'model':db[_0xe661('0x5d')],'as':_0xe661('0x5d'),'attributes':['id',_0xe661('0x5e')],'raw':!![]});_0x2ddf20[_0xe661('0x5c')]({'model':db[_0xe661('0x5f')],'as':_0xe661('0x60'),'attributes':['id',_0xe661('0x61'),_0xe661('0x62')],'raw':!![]});if(_0x772fc7[_0xe661('0x29')][_0xe661('0x5b')]){_0x2ddf20['push']({'model':db[_0xe661('0x63')],'as':_0xe661('0x63'),'raw':!![]});}var _0x9f92b9=[{'model':db[_0xe661('0x3e')],'as':_0xe661('0x64'),'attributes':['id',_0xe661('0x38'),'createdAt',_0xe661('0x65'),'secret',_0xe661('0x66')],'include':_0x2ddf20}];_0x9f92b9[_0xe661('0x5c')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xe661('0x1d')]});_0x9f92b9[_0xe661('0x5c')]({'model':db[_0xe661('0x5d')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xe661('0x35')]({'where':{'id':_0x772fc7[_0xe661('0x2b')]['id']},'include':_0x9f92b9})['then'](handleEntityNotFound(_0x533a6e,null))[_0xe661('0x1a')](function(_0x4aaeb1){if(_0x4aaeb1){var _0x184886=_0x4aaeb1[_0xe661('0x67')]({'plain':!![]});fs[_0xe661('0x68')](_0x4012e8);var _0x159042={'channel':_0xe661('0x69'),'account':_0x184886[_0xe661('0x6a')][_0xe661('0x1d')],'agent':_0x184886[_0xe661('0x6b')]?_0x184886[_0xe661('0x6b')][_0xe661('0x5e')]:_0xe661('0x6c'),'createdAt':moment(_0x184886[_0xe661('0x6d')])[_0xe661('0x4a')](_0xe661('0x4b'))[_0xe661('0x55')](),'closedAt':_0x184886[_0xe661('0x6e')]?moment(_0x184886[_0xe661('0x6f')])['format'](_0xe661('0x4b'))[_0xe661('0x55')]():'','disposition':_0x184886[_0xe661('0x70')],'visibility':_0x184886['threadId']?_0xe661('0x71'):_0xe661('0x72'),'messages':_(_0x184886[_0xe661('0x64')])[_0xe661('0x46')]({'secret':![]})[_0xe661('0x20')](function(_0x2cc103){if(_0x2cc103[_0xe661('0x63')]){var _0x3682e1=path[_0xe661('0x56')](_0x4c6a1d,_0x2cc103[_0xe661('0x63')][_0xe661('0x73')]);if(fs[_0xe661('0x74')](_0x3682e1)){fs[_0xe661('0x75')](_0x3682e1)[_0xe661('0x76')](fs[_0xe661('0x77')](path[_0xe661('0x56')](_0x4012e8,_0x2cc103[_0xe661('0x63')]['basename'])));}}return{'date':moment(_0x2cc103[_0xe661('0x6d')])[_0xe661('0x4a')](_0xe661('0x4b'))[_0xe661('0x55')](),'sender':_0x2cc103['direction']===_0xe661('0x78')?_0x2cc103[_0xe661('0x5d')]?_0x2cc103[_0xe661('0x5d')][_0xe661('0x5e')]:_0xe661('0x79'):_0x2cc103[_0xe661('0x60')]['firstName']+(_0x2cc103['Contact'][_0xe661('0x62')]?'\x20'+_0x2cc103[_0xe661('0x60')]['lastName']:''),'body':_0x2cc103[_0xe661('0x63')]?_0x2cc103[_0xe661('0x63')]['basename']:_0x2cc103[_0xe661('0x38')],'direction':_0x2cc103[_0xe661('0x65')]===_0xe661('0x78')?'A':'C','secret':_0x2cc103[_0xe661('0x7a')],'read':_0x2cc103[_0xe661('0x66')],'attachment':_0x2cc103[_0xe661('0x63')]};})[_0xe661('0x7b')]()};return ejs[_0xe661('0x7c')](path[_0xe661('0x56')](config[_0xe661('0x57')],_0xe661('0x58'),_0xe661('0x7d'),_0xe661('0x7e')),{'interaction':_0x159042})[_0xe661('0x1a')](function(_0xa0cee9){var _0x30a903=path['join'](_0x4012e8,_0xe661('0x7f')+_0x184886['id']+'-'+_0x430a36+_0xe661('0x80'));var _0xc16553={'path':_0x30a903,'channel':_0xe661('0x69'),'interactionId':_0x184886['id']};return pdf[_0xe661('0x81')](_0xa0cee9,_0xc16553);})[_0xe661('0x1a')](function(){return new Promise(function(_0x13ecda,_0x20884e){zipdir(_0x4012e8,{'saveTo':_0x5423ab},function(_0x3e2921,_0x39aef0){if(_0x3e2921)return _0x20884e(_0x3e2921);return _0x13ecda(_0x39aef0);});})[_0xe661('0x1a')](function(){return new Promise(function(_0xff935c,_0x5777e5){rimraf(_0x4012e8,function(_0x57181c){if(_0x57181c)_0x5777e5(_0x57181c);return _0xff935c();});});})[_0xe661('0x1a')](function(){return _0x533a6e[_0xe661('0x82')](_0x5423ab,_0x48012c,function(_0x16cb42){if(_0x16cb42){logger['error'](_0xe661('0x83'),_0x16cb42);}else{fs['unlinkSync'](_0x5423ab);}});});});}else{return _0x533a6e[_0xe661('0xf')](0xc8);}})[_0xe661('0x36')](handleError(_0x533a6e,null));}; \ No newline at end of file +var _0xf3c7=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','end','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','findAll','openchannel','query','catch','show','type','from','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','find','create','body','update','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','fullname','get','mkdirSync','Openchannel','Owner','N.A.','closedAt','disposition','threadId','Private','createReadStream','pipe','createWriteStream','basename','System','Contact','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','rimraf','zip-dir','moment','util','ejs','lodash','../../components/parsers/qs','../../components/export/pdf'];(function(_0xe0d554,_0x425f68){var _0x566b75=function(_0x1281ab){while(--_0x1281ab){_0xe0d554['push'](_0xe0d554['shift']());}};_0x566b75(++_0x425f68);}(_0xf3c7,0x79));var _0x7f3c=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0xf3c7[_0x874cf1];return _0x233579;};'use strict';var rimraf=require(_0x7f3c('0x0'));var zipdir=require(_0x7f3c('0x1'));var moment=require(_0x7f3c('0x2'));var util=require(_0x7f3c('0x3'));var path=require('path');var ejs=require(_0x7f3c('0x4'));var fs=require('fs');var _=require(_0x7f3c('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x7f3c('0x6'));var pdf=require(_0x7f3c('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x7f3c('0x8'));var db=require(_0x7f3c('0x9'))['db'];config[_0x7f3c('0xa')]=_['defaults'](config[_0x7f3c('0xa')],{'host':_0x7f3c('0xb'),'port':0x18eb});var socket=require(_0x7f3c('0xc'))(new Redis(config['redis']));require(_0x7f3c('0xd'))[_0x7f3c('0xe')](socket);function respondWithStatusCode(_0xd60c0e,_0x48321e){_0x48321e=_0x48321e||0xcc;return function(_0x3a8cf7){if(_0x3a8cf7){return _0xd60c0e[_0x7f3c('0xf')](_0x48321e);}return _0xd60c0e[_0x7f3c('0x10')](_0x48321e)['end']();};}function respondWithResult(_0x18d0f9,_0x3d250f){_0x3d250f=_0x3d250f||0xc8;return function(_0x561022){if(_0x561022){return _0x18d0f9['status'](_0x3d250f)['json'](_0x561022);}};}function respondWithFilteredResult(_0x12aaaa,_0xe208fe){return function(_0xf52521){if(_0xf52521){var _0x1093d5=typeof _0xe208fe[_0x7f3c('0x11')]===_0x7f3c('0x12')&&typeof _0xe208fe[_0x7f3c('0x13')]===_0x7f3c('0x12');var _0x46b463=_0xf52521['count'];var _0x3f81ad=_0x1093d5?0x0:_0xe208fe['offset'];var _0x127e4d=_0x1093d5?_0xf52521[_0x7f3c('0x14')]:_0xe208fe[_0x7f3c('0x11')]+_0xe208fe[_0x7f3c('0x13')];var _0x1ee245;if(_0x127e4d>=_0x46b463){_0x127e4d=_0x46b463;_0x1ee245=0xc8;}else{_0x1ee245=0xce;}_0x12aaaa['status'](_0x1ee245);return _0x12aaaa[_0x7f3c('0x15')](_0x7f3c('0x16'),_0x3f81ad+'-'+_0x127e4d+'/'+_0x46b463)[_0x7f3c('0x17')](_0xf52521);}return null;};}function saveUpdates(_0x38a76f){return function(_0x59363c){if(_0x59363c){return _0x59363c['update'](_0x38a76f)['then'](function(_0x3ff2ad){return _0x3ff2ad;});}return null;};}function removeEntity(_0xb274f){return function(_0x185d66){if(_0x185d66){return _0x185d66[_0x7f3c('0x18')]()[_0x7f3c('0x19')](function(){_0xb274f[_0x7f3c('0x10')](0xcc)[_0x7f3c('0x1a')]();});}};}function handleEntityNotFound(_0x1bf358){return function(_0x5587a8){if(!_0x5587a8){_0x1bf358[_0x7f3c('0xf')](0x194);}return _0x5587a8;};}function handleError(_0x2fbb93,_0x3f69a0){_0x3f69a0=_0x3f69a0||0x1f4;return function(_0x43d21f){logger[_0x7f3c('0x1b')](_0x43d21f[_0x7f3c('0x1c')]);if(_0x43d21f[_0x7f3c('0x1d')]){delete _0x43d21f[_0x7f3c('0x1d')];}_0x2fbb93[_0x7f3c('0x10')](_0x3f69a0)[_0x7f3c('0x1e')](_0x43d21f);};}exports[_0x7f3c('0x1f')]=function(_0x244130,_0x32ca03){var _0x4effad={};var _0x483311=_[_0x7f3c('0x20')](db[_0x7f3c('0x21')][_0x7f3c('0x22')],function(_0x2c80e5){return{'name':_0x2c80e5[_0x7f3c('0x23')],'type':_0x2c80e5['type'][_0x7f3c('0x24')]};});_0x4effad=qs['getOptions'](_0x483311,_0x244130);return interaction[_0x7f3c('0x25')](_0x7f3c('0x26'),_0x244130[_0x7f3c('0x27')],_0x244130['user'],_0x4effad,_0x483311)[_0x7f3c('0x19')](respondWithFilteredResult(_0x32ca03,_0x4effad))[_0x7f3c('0x28')](handleError(_0x32ca03,null));};exports[_0x7f3c('0x29')]=function(_0x58c311,_0x305bd8){var _0x53c40f={};if(_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x2a')]&&_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x2a')]===_0x7f3c('0x2b')){_0x53c40f[_0x7f3c('0x2b')]=_0x58c311['params']['id'];}else{_0x53c40f['id']=_0x58c311[_0x7f3c('0x2c')]['id'];}var _0x3cbac7={'raw':![],'where':_0x53c40f},_0x53f217={};_0x53f217[_0x7f3c('0x2d')]=_[_0x7f3c('0x2e')](db[_0x7f3c('0x21')][_0x7f3c('0x22')]);_0x53f217[_0x7f3c('0x27')]=_[_0x7f3c('0x2e')](_0x58c311[_0x7f3c('0x27')]);_0x53f217[_0x7f3c('0x2f')]=_[_0x7f3c('0x30')](_0x53f217[_0x7f3c('0x2d')],_0x53f217[_0x7f3c('0x27')]);_0x3cbac7[_0x7f3c('0x31')]=_[_0x7f3c('0x30')](_0x53f217[_0x7f3c('0x2d')],qs[_0x7f3c('0x32')](_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x32')]));_0x3cbac7[_0x7f3c('0x31')]=_0x3cbac7['attributes']['length']?_0x3cbac7['attributes']:_0x53f217[_0x7f3c('0x2d')];if(_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x33')]){_0x3cbac7['include']=[{'all':!![]}];}_0x3cbac7=_[_0x7f3c('0x34')]({},_0x3cbac7,_0x58c311['options']);return db['OpenchannelInteraction'][_0x7f3c('0x35')](_0x3cbac7)[_0x7f3c('0x19')](handleEntityNotFound(_0x305bd8,null))['then'](respondWithResult(_0x305bd8,null))['catch'](handleError(_0x305bd8,null));};exports[_0x7f3c('0x36')]=function(_0x572839,_0x3f4ccb){return db['OpenchannelInteraction']['create'](_0x572839[_0x7f3c('0x37')],{})[_0x7f3c('0x19')](respondWithResult(_0x3f4ccb,0xc9))[_0x7f3c('0x28')](handleError(_0x3f4ccb,null));};exports[_0x7f3c('0x38')]=function(_0x2aa6d6,_0x4e4f50){if(_0x2aa6d6[_0x7f3c('0x37')]['id']){delete _0x2aa6d6[_0x7f3c('0x37')]['id'];}return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x2aa6d6[_0x7f3c('0x2c')]['id']}})[_0x7f3c('0x19')](handleEntityNotFound(_0x4e4f50,null))[_0x7f3c('0x19')](saveUpdates(_0x2aa6d6[_0x7f3c('0x37')],null))[_0x7f3c('0x19')](respondWithResult(_0x4e4f50,null))[_0x7f3c('0x28')](handleError(_0x4e4f50,null));};exports[_0x7f3c('0x18')]=function(_0x5f0e85,_0x15f4e9){return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x5f0e85['params']['id']}})['then'](handleEntityNotFound(_0x15f4e9,null))[_0x7f3c('0x19')](removeEntity(_0x15f4e9,null))[_0x7f3c('0x28')](handleError(_0x15f4e9,null));};exports[_0x7f3c('0x39')]=function(_0xd7b151,_0x368e2b){return db[_0x7f3c('0x21')][_0x7f3c('0x39')]()['then'](respondWithResult(_0x368e2b,null))[_0x7f3c('0x28')](handleError(_0x368e2b,null));};exports['addMessage']=function(_0x1c377c,_0x241849){return db['OpenchannelMessage'][_0x7f3c('0x35')]({'where':{'id':_0x1c377c[_0x7f3c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x241849,null))[_0x7f3c('0x19')](function(_0x1a320c){if(_0x1a320c){return _0x1a320c[_0x7f3c('0x3a')](_0x1c377c[_0x7f3c('0x37')]['ids'],_[_0x7f3c('0x3b')](_0x1c377c[_0x7f3c('0x37')],[_0x7f3c('0x3c'),'id'])||{});}})[_0x7f3c('0x19')](respondWithResult(_0x241849,null))['catch'](handleError(_0x241849,null));};exports[_0x7f3c('0x3d')]=function(_0x1de0b2,_0x28713d){var _0x9d1f65={'raw':![],'where':{}};var _0x486367={};var _0x39a5ad={'count':0x0,'rows':[]};return db[_0x7f3c('0x21')][_0x7f3c('0x3e')]({'where':{'id':_0x1de0b2[_0x7f3c('0x2c')]['id']}})[_0x7f3c('0x19')](handleEntityNotFound(_0x28713d,null))[_0x7f3c('0x19')](function(_0x38ef92){if(_0x38ef92){_0x486367['model']=_[_0x7f3c('0x2e')](db[_0x7f3c('0x3f')][_0x7f3c('0x22')]);_0x486367['query']=_['keys'](_0x1de0b2[_0x7f3c('0x27')]);_0x486367[_0x7f3c('0x2f')]=_[_0x7f3c('0x30')](_0x486367[_0x7f3c('0x2d')],_0x486367[_0x7f3c('0x27')]);_0x9d1f65[_0x7f3c('0x31')]=_[_0x7f3c('0x30')](_0x486367[_0x7f3c('0x2d')],qs[_0x7f3c('0x32')](_0x1de0b2[_0x7f3c('0x27')]['fields']));_0x9d1f65[_0x7f3c('0x31')]=_0x9d1f65['attributes']['length']?_0x9d1f65[_0x7f3c('0x31')]:_0x486367[_0x7f3c('0x2d')];if(!_0x1de0b2[_0x7f3c('0x27')]['hasOwnProperty'](_0x7f3c('0x40'))){_0x9d1f65[_0x7f3c('0x13')]=qs['limit'](_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x13')]);_0x9d1f65[_0x7f3c('0x11')]=qs[_0x7f3c('0x11')](_0x1de0b2['query'][_0x7f3c('0x11')]);}_0x9d1f65[_0x7f3c('0x41')]=qs[_0x7f3c('0x42')](_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x42')]);_0x9d1f65[_0x7f3c('0x43')]=qs['filters'](_[_0x7f3c('0x44')](_0x1de0b2[_0x7f3c('0x27')],_0x486367[_0x7f3c('0x2f')]));_0x9d1f65[_0x7f3c('0x43')][_0x7f3c('0x45')]=_0x38ef92['id'];if(_0x1de0b2[_0x7f3c('0x27')]['filter']){_0x9d1f65['where']=_[_0x7f3c('0x34')](_0x9d1f65[_0x7f3c('0x43')],{'$or':_[_0x7f3c('0x20')](_0x9d1f65[_0x7f3c('0x31')],function(_0x486b75){var _0x4180dc={};_0x4180dc[_0x486b75]={'$like':'%'+_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x46')]+'%'};return _0x4180dc;})});}if(_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x47')]){var _0x318a3b=_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x47')][_0x7f3c('0x48')](',');var _0x53518b={};_0x53518b[_0x318a3b[0x0]]={'$gte':moment(_0x318a3b[0x1])[_0x7f3c('0x49')](_0x7f3c('0x4a'))};_0x9d1f65[_0x7f3c('0x43')]=_[_0x7f3c('0x34')](_0x9d1f65[_0x7f3c('0x43')],_0x53518b);}_0x9d1f65=_[_0x7f3c('0x34')]({},_0x9d1f65,_0x1de0b2[_0x7f3c('0x4b')]);return db['OpenchannelMessage'][_0x7f3c('0x14')]({'where':_0x9d1f65[_0x7f3c('0x43')]})[_0x7f3c('0x19')](function(_0x26a90e){_0x39a5ad[_0x7f3c('0x14')]=_0x26a90e;if(_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x33')]){_0x9d1f65[_0x7f3c('0x4c')]=[{'all':!![]}];}return db[_0x7f3c('0x3f')][_0x7f3c('0x25')](_0x9d1f65);})['then'](function(_0x464592){_0x39a5ad[_0x7f3c('0x4d')]=_0x464592;return _0x39a5ad;});}})[_0x7f3c('0x19')](respondWithFilteredResult(_0x28713d,_0x9d1f65))[_0x7f3c('0x28')](handleError(_0x28713d,null));};exports[_0x7f3c('0x4e')]=function(_0x3f7e2d,_0x36e62f){return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x3f7e2d['params']['id']}})[_0x7f3c('0x19')](handleEntityNotFound(_0x36e62f,null))[_0x7f3c('0x19')](function(_0x2b1d46){if(_0x2b1d46){return _0x2b1d46['setTags'](_0x3f7e2d['body'][_0x7f3c('0x3c')],_[_0x7f3c('0x3b')](_0x3f7e2d[_0x7f3c('0x37')],[_0x7f3c('0x3c'),'id'])||{})[_0x7f3c('0x4f')](function(){return db[_0x7f3c('0x50')][_0x7f3c('0x25')]({'attributes':['id',_0x7f3c('0x1d'),_0x7f3c('0x51')],'where':{'id':_0x3f7e2d[_0x7f3c('0x37')][_0x7f3c('0x3c')]}});})[_0x7f3c('0x19')](function(_0x1c7da9){socket['emit'](_0x7f3c('0x52'),{'id':Number(_0x3f7e2d['params']['id']),'tags':_0x1c7da9||[]});return{'id':Number(_0x3f7e2d[_0x7f3c('0x2c')]['id']),'tags':_0x1c7da9||[]};});}})['then'](respondWithResult(_0x36e62f,null))['catch'](handleError(_0x36e62f,null));};exports[_0x7f3c('0x53')]=function(_0x3f4bdc,_0x54f425){return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x3f4bdc['params']['id']}})['then'](handleEntityNotFound(_0x54f425,null))[_0x7f3c('0x19')](function(_0x23606c){if(_0x23606c){return _0x23606c['removeTags'](_0x3f4bdc[_0x7f3c('0x27')]['ids']);}})[_0x7f3c('0x19')](respondWithStatusCode(_0x54f425,null))[_0x7f3c('0x28')](handleError(_0x54f425,null));};exports[_0x7f3c('0x54')]=function(_0x56d808,_0x3dfd8d){var _0x4d0e59=moment()[_0x7f3c('0x55')]()[_0x7f3c('0x56')]();var _0x3a819d=path[_0x7f3c('0x57')](config[_0x7f3c('0x58')],'server',_0x7f3c('0x59'),_0x7f3c('0x5a'));var _0x195b70=path[_0x7f3c('0x57')](config[_0x7f3c('0x58')],_0x7f3c('0x5b'),_0x7f3c('0x59'),_0x7f3c('0x5c'));var _0x57daf0=path[_0x7f3c('0x57')](_0x3a819d,_0x4d0e59);var _0x507761=util[_0x7f3c('0x49')](_0x7f3c('0x5d'),_0x56d808['params']['id'],_0x4d0e59);var _0x50846c=path['join'](_0x3a819d,_0x507761);var _0x4a0c1b=[];_0x4a0c1b['push']({'model':db[_0x7f3c('0x5e')],'as':_0x7f3c('0x5e'),'attributes':['id','fullname'],'raw':!![]});_0x4a0c1b[_0x7f3c('0x5f')]({'model':db[_0x7f3c('0x60')],'as':'Contact','attributes':['id',_0x7f3c('0x61'),_0x7f3c('0x62')],'raw':!![]});if(_0x56d808[_0x7f3c('0x27')][_0x7f3c('0x5c')]){_0x4a0c1b[_0x7f3c('0x5f')]({'model':db[_0x7f3c('0x63')],'as':_0x7f3c('0x63'),'raw':!![]});}var _0x25431f=[{'model':db[_0x7f3c('0x3f')],'as':_0x7f3c('0x64'),'attributes':['id',_0x7f3c('0x37'),_0x7f3c('0x65'),_0x7f3c('0x66'),_0x7f3c('0x67'),_0x7f3c('0x68')],'include':_0x4a0c1b}];_0x25431f[_0x7f3c('0x5f')]({'model':db['OpenchannelAccount'],'as':_0x7f3c('0x69'),'attributes':['id',_0x7f3c('0x1d')]});_0x25431f[_0x7f3c('0x5f')]({'model':db[_0x7f3c('0x5e')],'as':'Owner','attributes':['id',_0x7f3c('0x6a')]});return db[_0x7f3c('0x21')]['find']({'where':{'id':_0x56d808['params']['id']},'include':_0x25431f})['then'](handleEntityNotFound(_0x3dfd8d,null))[_0x7f3c('0x19')](function(_0x350bed){if(_0x350bed){var _0x276465=_0x350bed[_0x7f3c('0x6b')]({'plain':!![]});fs[_0x7f3c('0x6c')](_0x57daf0);var _0x2eb1f1={'channel':_0x7f3c('0x6d'),'account':_0x276465[_0x7f3c('0x69')]['name'],'agent':_0x276465[_0x7f3c('0x6e')]?_0x276465[_0x7f3c('0x6e')][_0x7f3c('0x6a')]:_0x7f3c('0x6f'),'createdAt':moment(_0x276465[_0x7f3c('0x65')])[_0x7f3c('0x49')](_0x7f3c('0x4a'))[_0x7f3c('0x56')](),'closedAt':_0x276465['closed']?moment(_0x276465[_0x7f3c('0x70')])[_0x7f3c('0x49')](_0x7f3c('0x4a'))[_0x7f3c('0x56')]():'','disposition':_0x276465[_0x7f3c('0x71')],'visibility':_0x276465[_0x7f3c('0x72')]?'Public':_0x7f3c('0x73'),'messages':_(_0x276465[_0x7f3c('0x64')])[_0x7f3c('0x46')]({'secret':![]})[_0x7f3c('0x20')](function(_0x267fbd){if(_0x267fbd[_0x7f3c('0x63')]){var _0x80adc1=path['join'](_0x195b70,_0x267fbd['Attachment']['basename']);if(fs['existsSync'](_0x80adc1)){fs[_0x7f3c('0x74')](_0x80adc1)[_0x7f3c('0x75')](fs[_0x7f3c('0x76')](path['join'](_0x57daf0,_0x267fbd['Attachment'][_0x7f3c('0x77')])));}}return{'date':moment(_0x267fbd[_0x7f3c('0x65')])[_0x7f3c('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7f3c('0x56')](),'sender':_0x267fbd[_0x7f3c('0x66')]==='out'?_0x267fbd[_0x7f3c('0x5e')]?_0x267fbd[_0x7f3c('0x5e')][_0x7f3c('0x6a')]:_0x7f3c('0x78'):_0x267fbd[_0x7f3c('0x79')]['firstName']+(_0x267fbd[_0x7f3c('0x79')]['lastName']?'\x20'+_0x267fbd['Contact'][_0x7f3c('0x62')]:''),'body':_0x267fbd[_0x7f3c('0x63')]?_0x267fbd['Attachment'][_0x7f3c('0x77')]:_0x267fbd['body'],'direction':_0x267fbd[_0x7f3c('0x66')]===_0x7f3c('0x7a')?'A':'C','secret':_0x267fbd['secret'],'read':_0x267fbd[_0x7f3c('0x68')],'attachment':_0x267fbd['Attachment']};})[_0x7f3c('0x7b')]()};return ejs[_0x7f3c('0x7c')](path[_0x7f3c('0x57')](config[_0x7f3c('0x58')],_0x7f3c('0x5b'),_0x7f3c('0x7d'),_0x7f3c('0x7e')),{'interaction':_0x2eb1f1})[_0x7f3c('0x19')](function(_0x4d07aa){var _0x18ac69=path[_0x7f3c('0x57')](_0x57daf0,_0x7f3c('0x7f')+_0x276465['id']+'-'+_0x4d0e59+_0x7f3c('0x80'));var _0xd87fed={'path':_0x18ac69,'channel':_0x7f3c('0x6d'),'interactionId':_0x276465['id']};return pdf['createPdfFromHTML'](_0x4d07aa,_0xd87fed);})[_0x7f3c('0x19')](function(){return new Promise(function(_0x11a50,_0x593879){zipdir(_0x57daf0,{'saveTo':_0x50846c},function(_0x2cae08,_0x1acca0){if(_0x2cae08)return _0x593879(_0x2cae08);return _0x11a50(_0x1acca0);});})[_0x7f3c('0x19')](function(){return new Promise(function(_0x3ab551,_0x4761ef){rimraf(_0x57daf0,function(_0x38c386){if(_0x38c386)_0x4761ef(_0x38c386);return _0x3ab551();});});})[_0x7f3c('0x19')](function(){return _0x3dfd8d[_0x7f3c('0x54')](_0x50846c,_0x507761,function(_0x342088){if(_0x342088){logger[_0x7f3c('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x342088);}else{fs['unlinkSync'](_0x50846c);}});});});}else{return _0x3dfd8d['sendStatus'](0xc8);}})[_0x7f3c('0x28')](handleError(_0x3dfd8d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b85561f..f3692d0 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 _0x0aa4=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','remove','getUsers'];(function(_0x397014,_0x17cc12){var _0x1163f7=function(_0x290ac1){while(--_0x290ac1){_0x397014['push'](_0x397014['shift']());}};_0x1163f7(++_0x17cc12);}(_0x0aa4,0x89));var _0x40aa=function(_0xfc9b6b,_0x4edf2e){_0xfc9b6b=_0xfc9b6b-0x0;var _0x4670b4=_0x0aa4[_0xfc9b6b];return _0x4670b4;};'use strict';var EventEmitter=require(_0x40aa('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x40aa('0x1')];var OpenchannelMessage=require(_0x40aa('0x2'))['db'][_0x40aa('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x40aa('0x4'),'afterUpdate':'update','afterDestroy':_0x40aa('0x5')};function emitEvent(_0x285ea4){return function(_0x3b96ae,_0x58e7f8,_0x1bc12e){_0x3b96ae[_0x40aa('0x6')]({'attributes':['id'],'raw':!![]})[_0x40aa('0x7')](function(_0x139f15){_0x3b96ae[_0x40aa('0x8')](_0x40aa('0x9'),_0x139f15[_0x40aa('0xa')](function(_0x4a4fef){return{'id':_0x4a4fef['id']};}));return OpenchannelMessage[_0x40aa('0xb')]({'where':{'OpenchannelInteractionId':_0x3b96ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0x40aa('0x7')](function(_0xdc325){_0x3b96ae[_0x40aa('0x8')](_0x40aa('0xc'),_0xdc325[_0x40aa('0xd')]);OpenchannelInteractionEvents[_0x40aa('0xe')](_0x285ea4+':'+_0x3b96ae['id'],_0x3b96ae);OpenchannelInteractionEvents[_0x40aa('0xe')](_0x285ea4,_0x3b96ae);_0x1bc12e(null);})[_0x40aa('0xf')](_0x1bc12e(null));};}for(var e in events){if(events[_0x40aa('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x40aa('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2c43=['length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','update','then','setDataValue','Users'];(function(_0x34ed6d,_0xce1d11){var _0x1a5993=function(_0x15131e){while(--_0x15131e){_0x34ed6d['push'](_0x34ed6d['shift']());}};_0x1a5993(++_0xce1d11);}(_0x2c43,0x67));var _0x32c4=function(_0x4035e2,_0x102b9d){_0x4035e2=_0x4035e2-0x0;var _0x1f0ed9=_0x2c43[_0x4035e2];return _0x1f0ed9;};'use strict';var EventEmitter=require(_0x32c4('0x0'));var OpenchannelInteraction=require(_0x32c4('0x1'))['db'][_0x32c4('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x32c4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x81b3d6){return function(_0x1def03,_0x384a38,_0x4d02b8){_0x1def03['getUsers']({'attributes':['id'],'raw':!![]})[_0x32c4('0x4')](function(_0x56588e){_0x1def03[_0x32c4('0x5')](_0x32c4('0x6'),_0x56588e['map'](function(_0x2922e5){return{'id':_0x2922e5['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1def03['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32c4('0x4')](function(_0x549037){_0x1def03['setDataValue']('unreadMessages',_0x549037[_0x32c4('0x7')]);OpenchannelInteractionEvents[_0x32c4('0x8')](_0x81b3d6+':'+_0x1def03['id'],_0x1def03);OpenchannelInteractionEvents[_0x32c4('0x8')](_0x81b3d6,_0x1def03);_0x4d02b8(null);})[_0x32c4('0x9')](_0x4d02b8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x32c4('0xa')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 233ae20..ba8bfb6 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 _0xf4c6=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','changed','closed','format','api','moment','bluebird','request-promise','path'];(function(_0x5e5c7e,_0x33f499){var _0x30feec=function(_0x43a07e){while(--_0x43a07e){_0x5e5c7e['push'](_0x5e5c7e['shift']());}};_0x30feec(++_0x33f499);}(_0xf4c6,0x73));var _0x6f4c=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xf4c6[_0x83af7f];return _0x32d85c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6f4c('0x0'));var moment=require(_0x6f4c('0x1'));var BPromise=require(_0x6f4c('0x2'));var rp=require(_0x6f4c('0x3'));var fs=require('fs');var path=require(_0x6f4c('0x4'));var rimraf=require(_0x6f4c('0x5'));var config=require(_0x6f4c('0x6'));var attributes=require(_0x6f4c('0x7'));module[_0x6f4c('0x8')]=function(_0x5b480c,_0x847ea){return _0x5b480c[_0x6f4c('0x9')](_0x6f4c('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f4c('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x8047bb,_0x53c231,_0x27cfbb){if(_0x8047bb[_0x6f4c('0xc')](_0x6f4c('0xd'))){_0x8047bb['closedAt']=moment()[_0x6f4c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x27cfbb(null,_0x8047bb);}}});}; \ No newline at end of file +var _0x1be6=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x5ed93c,_0x2906d3){var _0x4e8de8=function(_0x46afa6){while(--_0x46afa6){_0x5ed93c['push'](_0x5ed93c['shift']());}};_0x4e8de8(++_0x2906d3);}(_0x1be6,0x8f));var _0x61be=function(_0x97264,_0x5db8a7){_0x97264=_0x97264-0x0;var _0x4c3d58=_0x1be6[_0x97264];return _0x4c3d58;};'use strict';var _=require(_0x61be('0x0'));var util=require(_0x61be('0x1'));var logger=require(_0x61be('0x2'))(_0x61be('0x3'));var moment=require('moment');var BPromise=require(_0x61be('0x4'));var rp=require(_0x61be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x61be('0x6'));var attributes=require(_0x61be('0x7'));module['exports']=function(_0x2d4001,_0x176e04){return _0x2d4001['define'](_0x61be('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61be('0x9'),'collate':_0x61be('0xa'),'hooks':{'beforeUpdate':function(_0x2853a6,_0x1f4f9c,_0x56ab67){if(_0x2853a6[_0x61be('0xb')](_0x61be('0xc'))){_0x2853a6[_0x61be('0xd')]=moment()[_0x61be('0xe')](_0x61be('0xf'));}_0x56ab67(null,_0x2853a6);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 85fdce1..e01bfd6 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 _0x1e23=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info'];(function(_0x3b41b3,_0x1de537){var _0x3bb379=function(_0x2e129b){while(--_0x2e129b){_0x3b41b3['push'](_0x3b41b3['shift']());}};_0x3bb379(++_0x1de537);}(_0x1e23,0x76));var _0x31e2=function(_0x5c404a,_0x36dea1){_0x5c404a=_0x5c404a-0x0;var _0x463837=_0x1e23[_0x5c404a];return _0x463837;};'use strict';var _=require(_0x31e2('0x0'));var util=require(_0x31e2('0x1'));var moment=require(_0x31e2('0x2'));var BPromise=require(_0x31e2('0x3'));var rs=require(_0x31e2('0x4'));var fs=require('fs');var Redis=require(_0x31e2('0x5'));var db=require(_0x31e2('0x6'))['db'];var utils=require(_0x31e2('0x7'));var logger=require(_0x31e2('0x8'))(_0x31e2('0x9'));var config=require(_0x31e2('0xa'));var jayson=require(_0x31e2('0xb'));var client=jayson[_0x31e2('0xc')][_0x31e2('0xd')]({'port':0x232a});config[_0x31e2('0xe')]=_[_0x31e2('0xf')](config[_0x31e2('0xe')],{'host':_0x31e2('0x10'),'port':0x18eb});var socket=require(_0x31e2('0x11'))(new Redis(config[_0x31e2('0xe')]));require(_0x31e2('0x12'))[_0x31e2('0x13')](socket);function respondWithRpcPromise(_0x697f2d,_0x344cc5,_0x52273f){return new BPromise(function(_0x54444d,_0x5f507c){return client[_0x31e2('0x14')](_0x697f2d,_0x52273f)[_0x31e2('0x15')](function(_0x35a540){logger[_0x31e2('0x16')](_0x31e2('0x17'),_0x344cc5,_0x31e2('0x18'));logger[_0x31e2('0x19')](_0x31e2('0x1a'),_0x344cc5,_0x31e2('0x18'),JSON[_0x31e2('0x1b')](_0x35a540));if(_0x35a540['error']){if(_0x35a540[_0x31e2('0x1c')][_0x31e2('0x1d')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x344cc5,_0x35a540[_0x31e2('0x1c')][_0x31e2('0x1e')]);return _0x5f507c(_0x35a540[_0x31e2('0x1c')]['message']);}logger[_0x31e2('0x1c')](_0x31e2('0x17'),_0x344cc5,_0x35a540[_0x31e2('0x1c')][_0x31e2('0x1e')]);return _0x54444d(_0x35a540[_0x31e2('0x1c')]['message']);}else{logger['info'](_0x31e2('0x17'),_0x344cc5,_0x31e2('0x18'));_0x54444d(_0x35a540['result'][_0x31e2('0x1e')]);}})['catch'](function(_0x4b2b29){logger['error'](_0x31e2('0x17'),_0x344cc5,_0x4b2b29);_0x5f507c(_0x4b2b29);});});}exports[_0x31e2('0x1f')]=function(_0x1c91c6){var _0xca9f7=this;return new Promise(function(_0xbfc196,_0x30271d){return db[_0x31e2('0x20')][_0x31e2('0x21')](_0x1c91c6[_0x31e2('0x22')],{'raw':_0x1c91c6['options']?_0x1c91c6['options'][_0x31e2('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c91c6[_0x31e2('0x24')]?_0x1c91c6[_0x31e2('0x24')][_0x31e2('0x25')]||null:null,'attributes':_0x1c91c6[_0x31e2('0x24')]?_0x1c91c6['options'][_0x31e2('0x26')]||null:null,'limit':_0x1c91c6[_0x31e2('0x24')]?_0x1c91c6[_0x31e2('0x24')][_0x31e2('0x27')]||null:null})[_0x31e2('0x15')](function(_0x33f733){logger['info']('UpdateOpenchannelInteraction',_0x1c91c6);logger[_0x31e2('0x19')](_0x31e2('0x1f'),_0x1c91c6,JSON[_0x31e2('0x1b')](_0x33f733));_0xbfc196(_0x33f733);})[_0x31e2('0x28')](function(_0x5c017c){logger[_0x31e2('0x1c')](_0x31e2('0x1f'),_0x5c017c['message'],_0x1c91c6);_0x30271d(_0xca9f7[_0x31e2('0x1c')](0x1f4,_0x5c017c['message']));});});};exports[_0x31e2('0x29')]=function(_0x5801e1){return new Promise(function(_0x56238a,_0x4568f5){return db[_0x31e2('0x20')]['find']({'where':_0x5801e1[_0x31e2('0x24')]?_0x5801e1[_0x31e2('0x24')][_0x31e2('0x25')]||null:null})[_0x31e2('0x15')](function(_0x3b8460){if(_0x3b8460){return _0x3b8460[_0x31e2('0x2a')](_0x5801e1[_0x31e2('0x22')][_0x31e2('0x2b')],_[_0x31e2('0x2c')](_0x5801e1[_0x31e2('0x22')],[_0x31e2('0x2b'),'id'])||{});}})[_0x31e2('0x2d')](function(_0x2fbdbc){logger[_0x31e2('0x16')]('AddTags',_0x5801e1);logger[_0x31e2('0x19')]('AddTags',_0x5801e1,JSON[_0x31e2('0x1b')](_0x2fbdbc));_0x56238a(_0x2fbdbc);})[_0x31e2('0x28')](function(_0x5407ae){logger[_0x31e2('0x1c')](_0x31e2('0x2e'),_0x5407ae[_0x31e2('0x1e')],_0x5801e1);_0x4568f5(_this[_0x31e2('0x1c')](0x1f4,_0x5407ae[_0x31e2('0x1e')]));});});}; \ No newline at end of file +var _0xc148=['find','body','ids','omit','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','debug'];(function(_0x361d7a,_0x53aa8f){var _0x107d0b=function(_0x5087db){while(--_0x5087db){_0x361d7a['push'](_0x361d7a['shift']());}};_0x107d0b(++_0x53aa8f);}(_0xc148,0x7d));var _0x8c14=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc148[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x8c14('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c14('0x1'));var fs=require('fs');var Redis=require(_0x8c14('0x2'));var db=require(_0x8c14('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c14('0x4'))(_0x8c14('0x5'));var config=require(_0x8c14('0x6'));var jayson=require(_0x8c14('0x7'));var client=jayson['client'][_0x8c14('0x8')]({'port':0x232a});config[_0x8c14('0x9')]=_[_0x8c14('0xa')](config[_0x8c14('0x9')],{'host':_0x8c14('0xb'),'port':0x18eb});var socket=require(_0x8c14('0xc'))(new Redis(config['redis']));require(_0x8c14('0xd'))[_0x8c14('0xe')](socket);function respondWithRpcPromise(_0x23cb3e,_0x314713,_0x25cb5a){return new BPromise(function(_0x4645b9,_0x4d4519){return client[_0x8c14('0xf')](_0x23cb3e,_0x25cb5a)[_0x8c14('0x10')](function(_0x7cbb05){logger[_0x8c14('0x11')](_0x8c14('0x12'),_0x314713,_0x8c14('0x13'));logger['debug'](_0x8c14('0x14'),_0x314713,_0x8c14('0x13'),JSON[_0x8c14('0x15')](_0x7cbb05));if(_0x7cbb05[_0x8c14('0x16')]){if(_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x17')]===0x1f4){logger[_0x8c14('0x16')](_0x8c14('0x12'),_0x314713,_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x18')]);return _0x4d4519(_0x7cbb05['error'][_0x8c14('0x18')]);}logger[_0x8c14('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x314713,_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x18')]);return _0x4645b9(_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x18')]);}else{logger[_0x8c14('0x11')](_0x8c14('0x12'),_0x314713,'request\x20sent');_0x4645b9(_0x7cbb05[_0x8c14('0x19')][_0x8c14('0x18')]);}})[_0x8c14('0x1a')](function(_0x2aa8da){logger[_0x8c14('0x16')](_0x8c14('0x12'),_0x314713,_0x2aa8da);_0x4d4519(_0x2aa8da);});});}exports[_0x8c14('0x1b')]=function(_0x40ca32){var _0x4af6c2=this;return new Promise(function(_0x273d98,_0x1c63bf){return db[_0x8c14('0x1c')]['update'](_0x40ca32['body'],{'raw':_0x40ca32[_0x8c14('0x1d')]?_0x40ca32['options'][_0x8c14('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40ca32[_0x8c14('0x1d')]?_0x40ca32['options'][_0x8c14('0x1f')]||null:null,'attributes':_0x40ca32[_0x8c14('0x1d')]?_0x40ca32[_0x8c14('0x1d')][_0x8c14('0x20')]||null:null,'limit':_0x40ca32['options']?_0x40ca32[_0x8c14('0x1d')][_0x8c14('0x21')]||null:null})[_0x8c14('0x10')](function(_0xdeffc3){logger[_0x8c14('0x11')]('UpdateOpenchannelInteraction',_0x40ca32);logger[_0x8c14('0x22')](_0x8c14('0x1b'),_0x40ca32,JSON[_0x8c14('0x15')](_0xdeffc3));_0x273d98(_0xdeffc3);})[_0x8c14('0x1a')](function(_0x3ae0b7){logger[_0x8c14('0x16')](_0x8c14('0x1b'),_0x3ae0b7['message'],_0x40ca32);_0x1c63bf(_0x4af6c2[_0x8c14('0x16')](0x1f4,_0x3ae0b7[_0x8c14('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x43c12e){return new Promise(function(_0x3780cd,_0xbb0d23){return db['OpenchannelInteraction'][_0x8c14('0x23')]({'where':_0x43c12e[_0x8c14('0x1d')]?_0x43c12e[_0x8c14('0x1d')]['where']||null:null})[_0x8c14('0x10')](function(_0x3e94e5){if(_0x3e94e5){return _0x3e94e5['addTags'](_0x43c12e[_0x8c14('0x24')][_0x8c14('0x25')],_[_0x8c14('0x26')](_0x43c12e[_0x8c14('0x24')],['ids','id'])||{});}})['spread'](function(_0x1918f3){logger['info']('AddTags',_0x43c12e);logger[_0x8c14('0x22')]('AddTags',_0x43c12e,JSON[_0x8c14('0x15')](_0x1918f3));_0x3780cd(_0x1918f3);})[_0x8c14('0x1a')](function(_0xf9eabe){logger[_0x8c14('0x16')](_0x8c14('0x27'),_0xf9eabe[_0x8c14('0x18')],_0x43c12e);_0xbb0d23(_this[_0x8c14('0x16')](0x1f4,_0xf9eabe[_0x8c14('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index cfe59ec..a476dd8 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 _0x070e=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x070e,0x8e));var _0xe070=function(_0x571729,_0x5d03e2){_0x571729=_0x571729-0x0;var _0x38820e=_0x070e[_0x571729];return _0x38820e;};'use strict';var OpenchannelInteractionEvents=require(_0xe070('0x0'));var events=[_0xe070('0x1'),_0xe070('0x2'),_0xe070('0x3')];function createListener(_0x5100ff,_0x273461){return function(_0x3522a8){_0x273461[_0xe070('0x4')](_0x5100ff,_0x3522a8);};}function removeListener(_0x155487,_0x3a5227){return function(){OpenchannelInteractionEvents['removeListener'](_0x155487,_0x3a5227);};}exports[_0xe070('0x5')]=function(_0x89e2b5){for(var _0x43f5f6=0x0,_0x3870ee=events['length'];_0x43f5f6<_0x3870ee;_0x43f5f6++){var _0x324895=events[_0x43f5f6];var _0x5a8d13=createListener(_0xe070('0x6')+_0x324895,_0x89e2b5);OpenchannelInteractionEvents['on'](_0x324895,_0x5a8d13);}}; \ No newline at end of file +var _0x5473=['./openchannelInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x3ba553,_0x1b3afb){var _0x2c8bbf=function(_0x26ba01){while(--_0x26ba01){_0x3ba553['push'](_0x3ba553['shift']());}};_0x2c8bbf(++_0x1b3afb);}(_0x5473,0x19d));var _0x3547=function(_0x4f8e84,_0x36adc9){_0x4f8e84=_0x4f8e84-0x0;var _0x2ab68f=_0x5473[_0x4f8e84];return _0x2ab68f;};'use strict';var OpenchannelInteractionEvents=require(_0x3547('0x0'));var events=[_0x3547('0x1'),'remove',_0x3547('0x2')];function createListener(_0x277630,_0x43e7a0){return function(_0x245217){_0x43e7a0[_0x3547('0x3')](_0x277630,_0x245217);};}function removeListener(_0x28e3d4,_0xf1c1f1){return function(){OpenchannelInteractionEvents[_0x3547('0x4')](_0x28e3d4,_0xf1c1f1);};}exports[_0x3547('0x5')]=function(_0x5d0a1f){for(var _0x197905=0x0,_0x42c1b8=events[_0x3547('0x6')];_0x197905<_0x42c1b8;_0x197905++){var _0x3fdc02=events[_0x197905];var _0x9acc25=createListener('openchannelInteraction:'+_0x3fdc02,_0x5d0a1f);OpenchannelInteractionEvents['on'](_0x3fdc02,_0x9acc25);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b399639..794bd86 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x4f0057,_0x23c77a){var _0x45e03a=function(_0xf280a8){while(--_0xf280a8){_0x4f0057['push'](_0x4f0057['shift']());}};_0x45e03a(++_0x23c77a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44454f,_0x4bfbe8){_0x44454f=_0x44454f-0x0;var _0x475150=_0xcb91[_0x44454f];return _0x475150;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x73aef5,_0x5b2293){var _0x29be73=function(_0x1c9129){while(--_0x1c9129){_0x73aef5['push'](_0x73aef5['shift']());}};_0x29be73(++_0x5b2293);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xcb91[_0x36436d];return _0x34615d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4dd2100..5fd3e0c 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 _0x0490=['DATE','STRING','TEXT','exports','ENUM','out'];(function(_0x5c2f91,_0x11ba5f){var _0x46cc45=function(_0x3c30f3){while(--_0x3c30f3){_0x5c2f91['push'](_0x5c2f91['shift']());}};_0x46cc45(++_0x11ba5f);}(_0x0490,0x147));var _0x0049=function(_0x52ef84,_0x536bd9){_0x52ef84=_0x52ef84-0x0;var _0x97ef7b=_0x0490[_0x52ef84];return _0x97ef7b;};'use strict';var Sequelize=require('sequelize');module[_0x0049('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0049('0x1')]('in',_0x0049('0x2')),'defaultValue':_0x0049('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0049('0x3')]},'providerName':{'type':Sequelize[_0x0049('0x4')]},'providerResponse':{'type':Sequelize[_0x0049('0x5')]}}; \ No newline at end of file +var _0xf69c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x27efc5,_0x4afa2a){var _0x17cc9e=function(_0x185b38){while(--_0x185b38){_0x27efc5['push'](_0x27efc5['shift']());}};_0x17cc9e(++_0x4afa2a);}(_0xf69c,0x1e2));var _0xcf69=function(_0x44e78e,_0x5f2ba5){_0x44e78e=_0x44e78e-0x0;var _0xff1bb2=_0xf69c[_0x44e78e];return _0xff1bb2;};'use strict';var Sequelize=require(_0xcf69('0x0'));module[_0xcf69('0x1')]={'body':{'type':Sequelize[_0xcf69('0x2')](_0xcf69('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xcf69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf69('0x5')]('in',_0xcf69('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xcf69('0x7')]},'providerName':{'type':Sequelize[_0xcf69('0x8')]},'providerResponse':{'type':Sequelize[_0xcf69('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 2a53eee..82a2e6d 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 _0x45a4=['SIP/%s','motionChannel','channel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','internal','event','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','./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','code','message','result','sendStatus','end','status','json','limit','undefined','offset','set','Content-Range','save','update','destroy','stack','name','send','index','map','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelMessage','count','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface'];(function(_0x2e6a19,_0x3bec10){var _0x3fb300=function(_0x563df3){while(--_0x563df3){_0x2e6a19['push'](_0x2e6a19['shift']());}};_0x3fb300(++_0x3bec10);}(_0x45a4,0x19c));var _0x445a=function(_0xe62f06,_0x2a5da8){_0xe62f06=_0xe62f06-0x0;var _0x386a3d=_0x45a4[_0xe62f06];return _0x386a3d;};'use strict';var emlformat=require(_0x445a('0x0'));var rimraf=require(_0x445a('0x1'));var zipdir=require(_0x445a('0x2'));var jsonpatch=require(_0x445a('0x3'));var rp=require('request-promise');var moment=require(_0x445a('0x4'));var BPromise=require(_0x445a('0x5'));var Mustache=require('mustache');var util=require(_0x445a('0x6'));var path=require(_0x445a('0x7'));var sox=require(_0x445a('0x8'));var csv=require(_0x445a('0x9'));var ejs=require(_0x445a('0xa'));var fs=require('fs');var fs_extra=require(_0x445a('0xb'));var _=require('lodash');var squel=require(_0x445a('0xc'));var crypto=require(_0x445a('0xd'));var jsforce=require(_0x445a('0xe'));var deskjs=require(_0x445a('0xf'));var toCsv=require(_0x445a('0x9'));var querystring=require(_0x445a('0x10'));var Papa=require('papaparse');var Redis=require(_0x445a('0x11'));var authService=require(_0x445a('0x12'));var qs=require(_0x445a('0x13'));var as=require(_0x445a('0x14'));var hardwareService=require(_0x445a('0x15'));var logger=require(_0x445a('0x16'))('api');var utils=require(_0x445a('0x17'));var config=require(_0x445a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x445a('0x19')]=_['defaults'](config[_0x445a('0x19')],{'host':_0x445a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x445a('0x19')]));require(_0x445a('0x1b'))[_0x445a('0x1c')](socket);var jayson=require(_0x445a('0x1d'));var client=jayson[_0x445a('0x1e')][_0x445a('0x1f')]({'port':0x232c});var client9002=jayson[_0x445a('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235656,_0x3674c9,_0x11da17,_0x377ff7){return new BPromise(function(_0x24f6f3,_0x152840){var _0x189879=_0x377ff7||client;return _0x189879[_0x445a('0x20')](_0x235656,_0x11da17)[_0x445a('0x21')](function(_0x486a08){logger[_0x445a('0x22')](_0x445a('0x23'),_0x3674c9,_0x445a('0x24'));logger['debug'](_0x445a('0x25'),_0x3674c9,_0x445a('0x24'),JSON[_0x445a('0x26')](_0x486a08));if(_0x486a08[_0x445a('0x27')]){if(_0x486a08['error'][_0x445a('0x28')]===0x1f4){logger[_0x445a('0x27')](_0x445a('0x23'),_0x3674c9,_0x486a08[_0x445a('0x27')]['message']);return _0x152840(_0x486a08['error'][_0x445a('0x29')]);}logger[_0x445a('0x27')](_0x445a('0x23'),_0x3674c9,_0x486a08[_0x445a('0x27')]['message']);return _0x24f6f3(_0x486a08[_0x445a('0x27')][_0x445a('0x29')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3674c9,_0x445a('0x24'));_0x24f6f3(_0x486a08[_0x445a('0x2a')]['message']);}})['catch'](function(_0x4c8546){logger[_0x445a('0x27')](_0x445a('0x23'),_0x3674c9,_0x4c8546);_0x152840(_0x4c8546);});});}function respondWithStatusCode(_0x488647,_0x4e29f4){_0x4e29f4=_0x4e29f4||0xcc;return function(_0x1106f5){if(_0x1106f5){return _0x488647[_0x445a('0x2b')](_0x4e29f4);}return _0x488647['status'](_0x4e29f4)[_0x445a('0x2c')]();};}function respondWithResult(_0x1d4c3b,_0x33a374){_0x33a374=_0x33a374||0xc8;return function(_0x31faf9){if(_0x31faf9){return _0x1d4c3b[_0x445a('0x2d')](_0x33a374)[_0x445a('0x2e')](_0x31faf9);}};}function respondWithFilteredResult(_0x27930a,_0x25133e){return function(_0x3905c1){if(_0x3905c1){var _0x4bf019=typeof _0x25133e['offset']==='undefined'&&typeof _0x25133e[_0x445a('0x2f')]===_0x445a('0x30');var _0x281807=_0x3905c1['count'];var _0x58c6ed=_0x4bf019?0x0:_0x25133e[_0x445a('0x31')];var _0x2eb524=_0x4bf019?_0x3905c1['count']:_0x25133e['offset']+_0x25133e[_0x445a('0x2f')];var _0x46ebee;if(_0x2eb524>=_0x281807){_0x2eb524=_0x281807;_0x46ebee=0xc8;}else{_0x46ebee=0xce;}_0x27930a['status'](_0x46ebee);return _0x27930a[_0x445a('0x32')](_0x445a('0x33'),_0x58c6ed+'-'+_0x2eb524+'/'+_0x281807)['json'](_0x3905c1);}return null;};}function patchUpdates(_0x5eb5c7){return function(_0x20faef){try{jsonpatch['apply'](_0x20faef,_0x5eb5c7,!![]);}catch(_0x5ef72b){return BPromise['reject'](_0x5ef72b);}return _0x20faef[_0x445a('0x34')]();};}function saveUpdates(_0xdd8add,_0xeb6f48){return function(_0x494dc3){if(_0x494dc3){return _0x494dc3[_0x445a('0x35')](_0xdd8add)[_0x445a('0x21')](function(_0x9335f2){return _0x9335f2;});}return null;};}function removeEntity(_0x391295,_0x13778d){return function(_0x8b5ec4){if(_0x8b5ec4){return _0x8b5ec4[_0x445a('0x36')]()['then'](function(){_0x391295['status'](0xcc)[_0x445a('0x2c')]();});}};}function handleEntityNotFound(_0x4712ca,_0x254748){return function(_0x5f5dad){if(!_0x5f5dad){_0x4712ca['sendStatus'](0x194);}return _0x5f5dad;};}function handleError(_0x56fc0b,_0x236232){_0x236232=_0x236232||0x1f4;return function(_0xaf341f){logger[_0x445a('0x27')](_0xaf341f[_0x445a('0x37')]);if(_0xaf341f[_0x445a('0x38')]){delete _0xaf341f[_0x445a('0x38')];}_0x56fc0b[_0x445a('0x2d')](_0x236232)[_0x445a('0x39')](_0xaf341f);};}exports[_0x445a('0x3a')]=function(_0x30b211,_0x3e8082){var _0x210a97={},_0x4dcfd4={},_0x3da5af={'count':0x0,'rows':[]};var _0x11024b=_[_0x445a('0x3b')](db['OpenchannelMessage']['rawAttributes'],function(_0x703218){return{'name':_0x703218['fieldName'],'type':_0x703218['type']['key']};});_0x4dcfd4[_0x445a('0x3c')]=_[_0x445a('0x3b')](_0x11024b,'name');_0x4dcfd4[_0x445a('0x3d')]=_['keys'](_0x30b211[_0x445a('0x3d')]);_0x4dcfd4[_0x445a('0x3e')]=_[_0x445a('0x3f')](_0x4dcfd4[_0x445a('0x3c')],_0x4dcfd4['query']);_0x210a97[_0x445a('0x40')]=_['intersection'](_0x4dcfd4[_0x445a('0x3c')],qs[_0x445a('0x41')](_0x30b211[_0x445a('0x3d')][_0x445a('0x41')]));_0x210a97[_0x445a('0x40')]=_0x210a97[_0x445a('0x40')][_0x445a('0x42')]?_0x210a97[_0x445a('0x40')]:_0x4dcfd4[_0x445a('0x3c')];if(!_0x30b211['query'][_0x445a('0x43')](_0x445a('0x44'))){_0x210a97[_0x445a('0x2f')]=qs['limit'](_0x30b211['query'][_0x445a('0x2f')]);_0x210a97[_0x445a('0x31')]=qs[_0x445a('0x31')](_0x30b211[_0x445a('0x3d')]['offset']);}_0x210a97['order']=qs[_0x445a('0x45')](_0x30b211['query']['sort']);_0x210a97['where']=qs[_0x445a('0x3e')](_[_0x445a('0x46')](_0x30b211[_0x445a('0x3d')],_0x4dcfd4[_0x445a('0x3e')]),_0x11024b);if(_0x30b211['query'][_0x445a('0x47')]){_0x210a97[_0x445a('0x48')]=_[_0x445a('0x49')](_0x210a97[_0x445a('0x48')],{'$or':_[_0x445a('0x3b')](_0x11024b,function(_0xd210cd){if(_0xd210cd[_0x445a('0x4a')]!==_0x445a('0x4b')){var _0x3d2b21={};_0x3d2b21[_0xd210cd['name']]={'$like':'%'+_0x30b211['query']['filter']+'%'};return _0x3d2b21;}})});}_0x210a97=_[_0x445a('0x49')]({},_0x210a97,_0x30b211[_0x445a('0x4c')]);var _0x45a91f={'where':_0x210a97['where']};return db[_0x445a('0x4d')][_0x445a('0x4e')](_0x45a91f)[_0x445a('0x21')](function(_0x35a102){_0x3da5af[_0x445a('0x4e')]=_0x35a102;if(_0x30b211[_0x445a('0x3d')]['includeAll']){_0x210a97[_0x445a('0x4f')]=[{'all':!![]}];}return db[_0x445a('0x4d')]['findAll'](_0x210a97);})[_0x445a('0x21')](function(_0x5855a0){_0x3da5af[_0x445a('0x50')]=_0x5855a0;return _0x3da5af;})[_0x445a('0x21')](respondWithFilteredResult(_0x3e8082,_0x210a97))[_0x445a('0x51')](handleError(_0x3e8082,null));};exports[_0x445a('0x52')]=function(_0x265b3e,_0x31e8e8){var _0x459797={'raw':!![],'where':{'id':_0x265b3e[_0x445a('0x53')]['id']}},_0x2cff8d={};_0x2cff8d[_0x445a('0x3c')]=_[_0x445a('0x54')](db[_0x445a('0x4d')][_0x445a('0x55')]);_0x2cff8d['query']=_[_0x445a('0x54')](_0x265b3e[_0x445a('0x3d')]);_0x2cff8d[_0x445a('0x3e')]=_['intersection'](_0x2cff8d[_0x445a('0x3c')],_0x2cff8d[_0x445a('0x3d')]);_0x459797[_0x445a('0x40')]=_[_0x445a('0x3f')](_0x2cff8d['model'],qs[_0x445a('0x41')](_0x265b3e[_0x445a('0x3d')][_0x445a('0x41')]));_0x459797[_0x445a('0x40')]=_0x459797[_0x445a('0x40')][_0x445a('0x42')]?_0x459797['attributes']:_0x2cff8d[_0x445a('0x3c')];if(_0x265b3e[_0x445a('0x3d')][_0x445a('0x56')]){_0x459797[_0x445a('0x4f')]=[{'all':!![]}];}_0x459797=_[_0x445a('0x49')]({},_0x459797,_0x265b3e['options']);return db[_0x445a('0x4d')][_0x445a('0x57')](_0x459797)['then'](handleEntityNotFound(_0x31e8e8,null))[_0x445a('0x21')](respondWithResult(_0x31e8e8,null))[_0x445a('0x51')](handleError(_0x31e8e8,null));};exports[_0x445a('0x58')]=function(_0x64effb,_0x27b30c){return db[_0x445a('0x4d')]['create'](_0x64effb[_0x445a('0x59')],{})['then'](respondWithResult(_0x27b30c,0xc9))['catch'](handleError(_0x27b30c,null));};exports[_0x445a('0x35')]=function(_0x3814fc,_0x31e367){if(_0x3814fc[_0x445a('0x59')]['id']){delete _0x3814fc[_0x445a('0x59')]['id'];}return db[_0x445a('0x4d')][_0x445a('0x57')]({'where':{'id':_0x3814fc['params']['id']}})['then'](handleEntityNotFound(_0x31e367,null))[_0x445a('0x21')](saveUpdates(_0x3814fc[_0x445a('0x59')],null))[_0x445a('0x21')](respondWithResult(_0x31e367,null))[_0x445a('0x51')](handleError(_0x31e367,null));};exports[_0x445a('0x36')]=function(_0x1f52c6,_0x5df8b6){return db[_0x445a('0x4d')][_0x445a('0x57')]({'where':{'id':_0x1f52c6[_0x445a('0x53')]['id']}})[_0x445a('0x21')](handleEntityNotFound(_0x5df8b6,null))[_0x445a('0x21')](removeEntity(_0x5df8b6,null))['catch'](handleError(_0x5df8b6,null));};exports[_0x445a('0x5a')]=function(_0x469287,_0x455089){return db[_0x445a('0x4d')][_0x445a('0x5a')]()['then'](respondWithResult(_0x455089,null))[_0x445a('0x51')](handleError(_0x455089,null));};var interaction_log=require(_0x445a('0x16'))(_0x445a('0x5b'));exports['accept']=function(_0x14bd12,_0x2fe007,_0x15c4c7){var _0x2ca495={'agent':{},'channel':_0x445a('0x5c')};if(_0x14bd12['body']['id']){delete _0x14bd12[_0x445a('0x59')]['id'];}_0x14bd12['body'][_0x445a('0x5d')]=!![];_0x14bd12[_0x445a('0x59')][_0x445a('0x5e')]=moment()[_0x445a('0x5f')](_0x445a('0x60'));_0x14bd12[_0x445a('0x59')]['UserId']=_0x14bd12['body'][_0x445a('0x61')]||_0x14bd12[_0x445a('0x62')]['id'];_0x2ca495[_0x445a('0x63')]['id']=_0x14bd12[_0x445a('0x59')][_0x445a('0x61')];return db[_0x445a('0x4d')]['find']({'where':{'id':_0x14bd12[_0x445a('0x53')]['id'],'UserId':null}})[_0x445a('0x21')](handleEntityNotFound(_0x2fe007,null))['then'](saveUpdates(_0x14bd12['body'],null))[_0x445a('0x21')](function(_0x77ebde){if(_0x77ebde){_0x2ca495['message']=_0x77ebde[_0x445a('0x64')]({'plain':!![]});return db[_0x445a('0x65')][_0x445a('0x57')]({'where':{'id':_0x77ebde[_0x445a('0x66')]}});}return null;})[_0x445a('0x21')](handleEntityNotFound(_0x2fe007,null))[_0x445a('0x21')](function(_0x4562e5){if(_0x4562e5){return _0x4562e5['update']({'UserId':_0x14bd12[_0x445a('0x59')]['UserId'],'read1stAt':_[_0x445a('0x67')](_0x4562e5[_0x445a('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x445a('0x21')](function(_0x4e8237){if(_0x4e8237){_0x2ca495[_0x445a('0x69')]=_0x4e8237[_0x445a('0x64')]({'plain':!![]});interaction_log[_0x445a('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14bd12['user']['id'],_0x14bd12[_0x445a('0x62')][_0x445a('0x38')],_0x14bd12['user']['role'],_0x2ca495[_0x445a('0x69')]['id'],_0x14bd12[_0x445a('0x59')]?JSON[_0x445a('0x26')](_0x14bd12[_0x445a('0x59')]):_0x445a('0x6a'));return respondWithRpcPromise(_0x445a('0x6b'),_0x445a('0x6c'),_0x2ca495);}return null;})[_0x445a('0x21')](function(_0x3d42ce){var _0x46aa07=_0x445a('0x6d')+_0x3d42ce[_0x445a('0x29')][_0x445a('0x6e')];return db[_0x445a('0x6f')]['query'](_0x46aa07,{'type':db['Sequelize'][_0x445a('0x70')][_0x445a('0x71')],'raw':!![]})[_0x445a('0x21')](function(_0x431548){return _0x431548;});})[_0x445a('0x21')](function(_0x146efb){if(_0x146efb){_0x2ca495[_0x445a('0x29')][_0x445a('0x72')]=_0x146efb[0x0];if(!_0x14bd12[_0x445a('0x59')]['UserId'])return;return db[_0x445a('0x73')][_0x445a('0x57')]({'where':{'id':_0x14bd12[_0x445a('0x59')]['UserId'],'role':_0x445a('0x63')},'attributes':['id','name',_0x445a('0x74'),_0x445a('0x75'),'internal'],'raw':!![]});}return null;})[_0x445a('0x21')](function(_0x2da80b){if(!_0x2da80b)return null;_0x2ca495[_0x445a('0x29')][_0x445a('0x63')]=_0x2da80b;return _0x2ca495;})[_0x445a('0x21')](function(_0x43683f){if(_0x43683f){if(_0x14bd12[_0x445a('0x59')][_0x445a('0x76')]){_0x2ca495['message'][_0x445a('0x77')]=util[_0x445a('0x5f')](_0x445a('0x78'),_0x14bd12[_0x445a('0x62')][_0x445a('0x38')]);_0x2ca495['message']['channel']=_0x2ca495['channel'];_0x2ca495['message'][_0x445a('0x79')]=_0x2ca495[_0x445a('0x7a')];_0x2ca495[_0x445a('0x29')]['event']=_0x445a('0x7b');return respondWithRpcPromise(_0x445a('0x7c'),_0x445a('0x7c'),{'event':_0x445a('0x7d'),'message':_0x2ca495[_0x445a('0x29')]},client9002)['then'](function(){return _0x2ca495;});}return _0x2ca495;}return null;})[_0x445a('0x21')](respondWithResult(_0x2fe007,null))['catch'](handleError(_0x2fe007,null));};var interaction_log=require(_0x445a('0x16'))(_0x445a('0x5b'));exports['reject']=function(_0x4493df,_0x6ec645,_0x4c567c){var _0x2174da={'agent':{},'channel':_0x445a('0x5c')};if(_0x4493df[_0x445a('0x59')]['id']){delete _0x4493df[_0x445a('0x59')]['id'];}_0x4493df[_0x445a('0x59')]['UserId']=_0x4493df[_0x445a('0x59')]['UserId']||_0x4493df[_0x445a('0x62')]['id'];_0x2174da[_0x445a('0x63')]['id']=_0x4493df['body'][_0x445a('0x61')];return db['OpenchannelMessage'][_0x445a('0x57')]({'where':{'id':_0x4493df['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6ec645,null))[_0x445a('0x21')](function(_0x1b5192){if(_0x1b5192){_0x2174da[_0x445a('0x29')]=_0x1b5192[_0x445a('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x445a('0x57')]({'where':{'id':_0x1b5192[_0x445a('0x66')]}});}return null;})[_0x445a('0x21')](handleEntityNotFound(_0x6ec645,null))[_0x445a('0x21')](function(_0x8e9704){if(_0x8e9704){_0x2174da[_0x445a('0x69')]=_0x8e9704['get']({'plain':!![]});interaction_log['info'](_0x445a('0x7e'),_0x4493df[_0x445a('0x62')]['id'],_0x4493df[_0x445a('0x62')][_0x445a('0x38')],_0x4493df[_0x445a('0x62')][_0x445a('0x7f')],_0x2174da[_0x445a('0x69')]['id'],_0x4493df[_0x445a('0x59')]?JSON[_0x445a('0x26')](_0x4493df[_0x445a('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x445a('0x80'),_0x2174da);}return null;})[_0x445a('0x21')](function(_0x4a3c76){var _0x6eba63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4a3c76[_0x445a('0x29')]['ContactId'];return db[_0x445a('0x6f')][_0x445a('0x3d')](_0x6eba63,{'type':db['Sequelize'][_0x445a('0x70')][_0x445a('0x71')],'raw':!![]})[_0x445a('0x21')](function(_0x2ddd05){return _0x2ddd05;});})['then'](function(_0x4dee30){if(_0x4dee30){_0x2174da[_0x445a('0x29')]['contact']=_0x4dee30[0x0];if(!_0x4493df[_0x445a('0x59')]['UserId'])return;return db['User'][_0x445a('0x57')]({'where':{'id':_0x4493df[_0x445a('0x59')][_0x445a('0x61')],'role':_0x445a('0x63')},'attributes':['id',_0x445a('0x38'),_0x445a('0x74'),_0x445a('0x75'),_0x445a('0x81')],'raw':!![]});}return null;})['then'](function(_0x55ec48){if(!_0x55ec48)return null;_0x2174da['message'][_0x445a('0x63')]=_0x55ec48;return _0x2174da;})[_0x445a('0x21')](function(_0x1d9380){if(_0x1d9380){_0x1d9380[_0x445a('0x29')][_0x445a('0x77')]=util['format']('SIP/%s',_0x4493df[_0x445a('0x62')][_0x445a('0x38')]);_0x1d9380[_0x445a('0x29')][_0x445a('0x7a')]=_0x2174da[_0x445a('0x7a')];_0x1d9380[_0x445a('0x29')][_0x445a('0x79')]=_0x2174da[_0x445a('0x7a')];_0x1d9380['message'][_0x445a('0x82')]=_0x445a('0x83');respondWithRpcPromise(_0x445a('0x7c'),'EventManager',{'event':_0x445a('0x84'),'message':_0x1d9380['message']},client9002);return _0x2174da;}return null;})[_0x445a('0x21')](respondWithResult(_0x6ec645,null))[_0x445a('0x51')](handleError(_0x6ec645,null));}; \ No newline at end of file +var _0x6c25=['[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','openchannel-interactions','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','params','find','body','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction'];(function(_0x4ab77c,_0x13a5fc){var _0x35bc3d=function(_0x151ff3){while(--_0x151ff3){_0x4ab77c['push'](_0x4ab77c['shift']());}};_0x35bc3d(++_0x13a5fc);}(_0x6c25,0x9d));var _0x56c2=function(_0x4ea37f,_0x43cd78){_0x4ea37f=_0x4ea37f-0x0;var _0x1578ba=_0x6c25[_0x4ea37f];return _0x1578ba;};'use strict';var emlformat=require(_0x56c2('0x0'));var rimraf=require(_0x56c2('0x1'));var zipdir=require(_0x56c2('0x2'));var jsonpatch=require(_0x56c2('0x3'));var rp=require('request-promise');var moment=require(_0x56c2('0x4'));var BPromise=require(_0x56c2('0x5'));var Mustache=require(_0x56c2('0x6'));var util=require(_0x56c2('0x7'));var path=require(_0x56c2('0x8'));var sox=require(_0x56c2('0x9'));var csv=require(_0x56c2('0xa'));var ejs=require(_0x56c2('0xb'));var fs=require('fs');var fs_extra=require(_0x56c2('0xc'));var _=require('lodash');var squel=require(_0x56c2('0xd'));var crypto=require(_0x56c2('0xe'));var jsforce=require(_0x56c2('0xf'));var deskjs=require(_0x56c2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x56c2('0x11'));var Papa=require(_0x56c2('0x12'));var Redis=require(_0x56c2('0x13'));var authService=require(_0x56c2('0x14'));var qs=require(_0x56c2('0x15'));var as=require(_0x56c2('0x16'));var hardwareService=require(_0x56c2('0x17'));var logger=require(_0x56c2('0x18'))('api');var utils=require(_0x56c2('0x19'));var config=require(_0x56c2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c2('0x1b'))['db'];config['redis']=_[_0x56c2('0x1c')](config[_0x56c2('0x1d')],{'host':_0x56c2('0x1e'),'port':0x18eb});var socket=require(_0x56c2('0x1f'))(new Redis(config['redis']));require(_0x56c2('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x56c2('0x21')][_0x56c2('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x57b40e,_0x436024,_0x1d0374,_0x5ab627){return new BPromise(function(_0x4fb634,_0x19905d){var _0x2b0470=_0x5ab627||client;return _0x2b0470['request'](_0x57b40e,_0x1d0374)[_0x56c2('0x23')](function(_0x2a87e0){logger[_0x56c2('0x24')](_0x56c2('0x25'),_0x436024,_0x56c2('0x26'));logger['debug'](_0x56c2('0x27'),_0x436024,'request\x20sent',JSON[_0x56c2('0x28')](_0x2a87e0));if(_0x2a87e0[_0x56c2('0x29')]){if(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2a')]===0x1f4){logger[_0x56c2('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x436024,_0x2a87e0[_0x56c2('0x29')]['message']);return _0x19905d(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);}logger['error'](_0x56c2('0x25'),_0x436024,_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);return _0x4fb634(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);}else{logger[_0x56c2('0x24')](_0x56c2('0x25'),_0x436024,'request\x20sent');_0x4fb634(_0x2a87e0[_0x56c2('0x2c')][_0x56c2('0x2b')]);}})[_0x56c2('0x2d')](function(_0x4b326f){logger[_0x56c2('0x29')](_0x56c2('0x25'),_0x436024,_0x4b326f);_0x19905d(_0x4b326f);});});}function respondWithStatusCode(_0x4e6561,_0x1c97d5){_0x1c97d5=_0x1c97d5||0xcc;return function(_0x19780f){if(_0x19780f){return _0x4e6561[_0x56c2('0x2e')](_0x1c97d5);}return _0x4e6561[_0x56c2('0x2f')](_0x1c97d5)[_0x56c2('0x30')]();};}function respondWithResult(_0x3bd4eb,_0x2a2a71){_0x2a2a71=_0x2a2a71||0xc8;return function(_0x187079){if(_0x187079){return _0x3bd4eb[_0x56c2('0x2f')](_0x2a2a71)[_0x56c2('0x31')](_0x187079);}};}function respondWithFilteredResult(_0x232c0f,_0x3fabc7){return function(_0x56f161){if(_0x56f161){var _0xf0f454=typeof _0x3fabc7[_0x56c2('0x32')]===_0x56c2('0x33')&&typeof _0x3fabc7['limit']===_0x56c2('0x33');var _0x5bfd82=_0x56f161[_0x56c2('0x34')];var _0x13d5ff=_0xf0f454?0x0:_0x3fabc7[_0x56c2('0x32')];var _0x5d63e5=_0xf0f454?_0x56f161['count']:_0x3fabc7[_0x56c2('0x32')]+_0x3fabc7['limit'];var _0x3f5802;if(_0x5d63e5>=_0x5bfd82){_0x5d63e5=_0x5bfd82;_0x3f5802=0xc8;}else{_0x3f5802=0xce;}_0x232c0f[_0x56c2('0x2f')](_0x3f5802);return _0x232c0f[_0x56c2('0x35')]('Content-Range',_0x13d5ff+'-'+_0x5d63e5+'/'+_0x5bfd82)[_0x56c2('0x31')](_0x56f161);}return null;};}function patchUpdates(_0x2f5dbd){return function(_0x3434d5){try{jsonpatch['apply'](_0x3434d5,_0x2f5dbd,!![]);}catch(_0x2cb1ae){return BPromise[_0x56c2('0x36')](_0x2cb1ae);}return _0x3434d5[_0x56c2('0x37')]();};}function saveUpdates(_0x318ff6,_0x3ee92f){return function(_0x3052e6){if(_0x3052e6){return _0x3052e6[_0x56c2('0x38')](_0x318ff6)[_0x56c2('0x23')](function(_0x26a2fa){return _0x26a2fa;});}return null;};}function removeEntity(_0x1ddf2e,_0x9c6bb8){return function(_0x48af43){if(_0x48af43){return _0x48af43[_0x56c2('0x39')]()[_0x56c2('0x23')](function(){_0x1ddf2e[_0x56c2('0x2f')](0xcc)[_0x56c2('0x30')]();});}};}function handleEntityNotFound(_0xe8b81f,_0x14a4e8){return function(_0x2f0a48){if(!_0x2f0a48){_0xe8b81f[_0x56c2('0x2e')](0x194);}return _0x2f0a48;};}function handleError(_0xddf64b,_0x50f615){_0x50f615=_0x50f615||0x1f4;return function(_0x2a8187){logger['error'](_0x2a8187['stack']);if(_0x2a8187['name']){delete _0x2a8187[_0x56c2('0x3a')];}_0xddf64b['status'](_0x50f615)[_0x56c2('0x3b')](_0x2a8187);};}exports[_0x56c2('0x3c')]=function(_0x3e95a9,_0x14cad7){var _0x3d0696={},_0x5b9db0={},_0x25db36={'count':0x0,'rows':[]};var _0x2e1c3e=_[_0x56c2('0x3d')](db[_0x56c2('0x3e')][_0x56c2('0x3f')],function(_0x10c16c){return{'name':_0x10c16c[_0x56c2('0x40')],'type':_0x10c16c[_0x56c2('0x41')][_0x56c2('0x42')]};});_0x5b9db0['model']=_[_0x56c2('0x3d')](_0x2e1c3e,_0x56c2('0x3a'));_0x5b9db0['query']=_['keys'](_0x3e95a9[_0x56c2('0x43')]);_0x5b9db0[_0x56c2('0x44')]=_[_0x56c2('0x45')](_0x5b9db0[_0x56c2('0x46')],_0x5b9db0[_0x56c2('0x43')]);_0x3d0696[_0x56c2('0x47')]=_[_0x56c2('0x45')](_0x5b9db0['model'],qs['fields'](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x48')]));_0x3d0696[_0x56c2('0x47')]=_0x3d0696['attributes'][_0x56c2('0x49')]?_0x3d0696[_0x56c2('0x47')]:_0x5b9db0[_0x56c2('0x46')];if(!_0x3e95a9['query']['hasOwnProperty'](_0x56c2('0x4a'))){_0x3d0696['limit']=qs[_0x56c2('0x4b')](_0x3e95a9['query'][_0x56c2('0x4b')]);_0x3d0696[_0x56c2('0x32')]=qs['offset'](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x32')]);}_0x3d0696[_0x56c2('0x4c')]=qs[_0x56c2('0x4d')](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4d')]);_0x3d0696['where']=qs[_0x56c2('0x44')](_['pick'](_0x3e95a9[_0x56c2('0x43')],_0x5b9db0[_0x56c2('0x44')]),_0x2e1c3e);if(_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4e')]){_0x3d0696[_0x56c2('0x4f')]=_[_0x56c2('0x50')](_0x3d0696[_0x56c2('0x4f')],{'$or':_[_0x56c2('0x3d')](_0x2e1c3e,function(_0x4a32ee){if(_0x4a32ee[_0x56c2('0x41')]!==_0x56c2('0x51')){var _0x89a99f={};_0x89a99f[_0x4a32ee['name']]={'$like':'%'+_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4e')]+'%'};return _0x89a99f;}})});}_0x3d0696=_[_0x56c2('0x50')]({},_0x3d0696,_0x3e95a9[_0x56c2('0x52')]);var _0x2bdb71={'where':_0x3d0696[_0x56c2('0x4f')]};return db[_0x56c2('0x3e')][_0x56c2('0x34')](_0x2bdb71)['then'](function(_0x40492d){_0x25db36[_0x56c2('0x34')]=_0x40492d;if(_0x3e95a9['query']['includeAll']){_0x3d0696[_0x56c2('0x53')]=[{'all':!![]}];}return db[_0x56c2('0x3e')][_0x56c2('0x54')](_0x3d0696);})[_0x56c2('0x23')](function(_0x1693ee){_0x25db36['rows']=_0x1693ee;return _0x25db36;})[_0x56c2('0x23')](respondWithFilteredResult(_0x14cad7,_0x3d0696))[_0x56c2('0x2d')](handleError(_0x14cad7,null));};exports[_0x56c2('0x55')]=function(_0x24fc75,_0x2c12b4){var _0x4cb5bb={'raw':!![],'where':{'id':_0x24fc75[_0x56c2('0x56')]['id']}},_0x419fc2={};_0x419fc2[_0x56c2('0x46')]=_['keys'](db[_0x56c2('0x3e')]['rawAttributes']);_0x419fc2[_0x56c2('0x43')]=_['keys'](_0x24fc75[_0x56c2('0x43')]);_0x419fc2['filters']=_[_0x56c2('0x45')](_0x419fc2['model'],_0x419fc2[_0x56c2('0x43')]);_0x4cb5bb[_0x56c2('0x47')]=_['intersection'](_0x419fc2[_0x56c2('0x46')],qs[_0x56c2('0x48')](_0x24fc75[_0x56c2('0x43')][_0x56c2('0x48')]));_0x4cb5bb['attributes']=_0x4cb5bb[_0x56c2('0x47')][_0x56c2('0x49')]?_0x4cb5bb[_0x56c2('0x47')]:_0x419fc2[_0x56c2('0x46')];if(_0x24fc75['query']['includeAll']){_0x4cb5bb[_0x56c2('0x53')]=[{'all':!![]}];}_0x4cb5bb=_[_0x56c2('0x50')]({},_0x4cb5bb,_0x24fc75[_0x56c2('0x52')]);return db[_0x56c2('0x3e')][_0x56c2('0x57')](_0x4cb5bb)[_0x56c2('0x23')](handleEntityNotFound(_0x2c12b4,null))['then'](respondWithResult(_0x2c12b4,null))['catch'](handleError(_0x2c12b4,null));};exports['create']=function(_0x2bab39,_0xb96ef0){return db['OpenchannelMessage']['create'](_0x2bab39[_0x56c2('0x58')],{})[_0x56c2('0x23')](respondWithResult(_0xb96ef0,0xc9))[_0x56c2('0x2d')](handleError(_0xb96ef0,null));};exports[_0x56c2('0x38')]=function(_0x5706d5,_0x1f105b){if(_0x5706d5[_0x56c2('0x58')]['id']){delete _0x5706d5[_0x56c2('0x58')]['id'];}return db['OpenchannelMessage'][_0x56c2('0x57')]({'where':{'id':_0x5706d5[_0x56c2('0x56')]['id']}})[_0x56c2('0x23')](handleEntityNotFound(_0x1f105b,null))[_0x56c2('0x23')](saveUpdates(_0x5706d5[_0x56c2('0x58')],null))[_0x56c2('0x23')](respondWithResult(_0x1f105b,null))[_0x56c2('0x2d')](handleError(_0x1f105b,null));};exports[_0x56c2('0x39')]=function(_0x2ef814,_0x5419a7){return db[_0x56c2('0x3e')][_0x56c2('0x57')]({'where':{'id':_0x2ef814[_0x56c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5419a7,null))[_0x56c2('0x23')](removeEntity(_0x5419a7,null))['catch'](handleError(_0x5419a7,null));};exports[_0x56c2('0x59')]=function(_0x1b5b27,_0x7d1e2f){return db['OpenchannelMessage'][_0x56c2('0x59')]()[_0x56c2('0x23')](respondWithResult(_0x7d1e2f,null))['catch'](handleError(_0x7d1e2f,null));};var interaction_log=require(_0x56c2('0x18'))('openchannel-interactions');exports[_0x56c2('0x5a')]=function(_0x2e8247,_0x324ca5,_0x132709){var _0x7a69a4={'agent':{},'channel':'openchannel'};if(_0x2e8247['body']['id']){delete _0x2e8247[_0x56c2('0x58')]['id'];}_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5b')]=!![];_0x2e8247[_0x56c2('0x58')]['readAt']=moment()[_0x56c2('0x5c')](_0x56c2('0x5d'));_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')]=_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')]||_0x2e8247[_0x56c2('0x5f')]['id'];_0x7a69a4[_0x56c2('0x60')]['id']=_0x2e8247[_0x56c2('0x58')]['UserId'];return db[_0x56c2('0x3e')]['find']({'where':{'id':_0x2e8247[_0x56c2('0x56')]['id'],'UserId':null}})[_0x56c2('0x23')](handleEntityNotFound(_0x324ca5,null))['then'](saveUpdates(_0x2e8247[_0x56c2('0x58')],null))[_0x56c2('0x23')](function(_0x362ee8){if(_0x362ee8){_0x7a69a4[_0x56c2('0x2b')]=_0x362ee8[_0x56c2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x56c2('0x57')]({'where':{'id':_0x362ee8['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x324ca5,null))[_0x56c2('0x23')](function(_0x8e3f4f){if(_0x8e3f4f){return _0x8e3f4f[_0x56c2('0x38')]({'UserId':_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')],'read1stAt':_[_0x56c2('0x62')](_0x8e3f4f[_0x56c2('0x63')])?moment()[_0x56c2('0x5c')](_0x56c2('0x5d')):undefined});}return null;})[_0x56c2('0x23')](function(_0x4c522f){if(_0x4c522f){_0x7a69a4[_0x56c2('0x64')]=_0x4c522f[_0x56c2('0x61')]({'plain':!![]});interaction_log[_0x56c2('0x24')](_0x56c2('0x65'),_0x2e8247['user']['id'],_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x3a')],_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x66')],_0x7a69a4[_0x56c2('0x64')]['id'],_0x2e8247[_0x56c2('0x58')]?JSON[_0x56c2('0x28')](_0x2e8247[_0x56c2('0x58')]):'null');return respondWithRpcPromise(_0x56c2('0x67'),_0x56c2('0x68'),_0x7a69a4);}return null;})['then'](function(_0x4a41e7){var _0x4c956c=_0x56c2('0x69')+_0x4a41e7[_0x56c2('0x2b')]['ContactId'];return db['sequelize']['query'](_0x4c956c,{'type':db[_0x56c2('0x6a')][_0x56c2('0x6b')]['SELECT'],'raw':!![]})[_0x56c2('0x23')](function(_0x36537a){return _0x36537a;});})[_0x56c2('0x23')](function(_0x6a9e91){if(_0x6a9e91){_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x6c')]=_0x6a9e91[0x0];if(!_0x2e8247[_0x56c2('0x58')]['UserId'])return;return db[_0x56c2('0x6d')][_0x56c2('0x57')]({'where':{'id':_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')],'role':_0x56c2('0x60')},'attributes':['id',_0x56c2('0x3a'),_0x56c2('0x6e'),_0x56c2('0x6f'),_0x56c2('0x70')],'raw':!![]});}return null;})[_0x56c2('0x23')](function(_0x14e4c5){if(!_0x14e4c5)return null;_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x60')]=_0x14e4c5;return _0x7a69a4;})[_0x56c2('0x23')](function(_0x19300f){if(_0x19300f){if(_0x2e8247[_0x56c2('0x58')][_0x56c2('0x71')]){_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x72')]=util[_0x56c2('0x5c')](_0x56c2('0x73'),_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x3a')]);_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x74')]=_0x7a69a4[_0x56c2('0x74')];_0x7a69a4['message']['motionChannel']=_0x7a69a4[_0x56c2('0x74')];_0x7a69a4[_0x56c2('0x2b')]['event']=_0x56c2('0x5a');return respondWithRpcPromise('EventManager',_0x56c2('0x75'),{'event':'acceptmessage','message':_0x7a69a4[_0x56c2('0x2b')]},client9002)[_0x56c2('0x23')](function(){return _0x7a69a4;});}return _0x7a69a4;}return null;})['then'](respondWithResult(_0x324ca5,null))[_0x56c2('0x2d')](handleError(_0x324ca5,null));};var interaction_log=require('../../config/logger')(_0x56c2('0x76'));exports[_0x56c2('0x36')]=function(_0x1d7ae7,_0x4211b6,_0x3b877c){var _0x5cdfc5={'agent':{},'channel':_0x56c2('0x77')};if(_0x1d7ae7[_0x56c2('0x58')]['id']){delete _0x1d7ae7[_0x56c2('0x58')]['id'];}_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')]=_0x1d7ae7['body'][_0x56c2('0x5e')]||_0x1d7ae7[_0x56c2('0x5f')]['id'];_0x5cdfc5[_0x56c2('0x60')]['id']=_0x1d7ae7['body']['UserId'];return db[_0x56c2('0x3e')][_0x56c2('0x57')]({'where':{'id':_0x1d7ae7[_0x56c2('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4211b6,null))[_0x56c2('0x23')](function(_0x113b29){if(_0x113b29){_0x5cdfc5['message']=_0x113b29[_0x56c2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x56c2('0x57')]({'where':{'id':_0x113b29[_0x56c2('0x78')]}});}return null;})[_0x56c2('0x23')](handleEntityNotFound(_0x4211b6,null))[_0x56c2('0x23')](function(_0xf18e77){if(_0xf18e77){_0x5cdfc5['interaction']=_0xf18e77[_0x56c2('0x61')]({'plain':!![]});interaction_log[_0x56c2('0x24')](_0x56c2('0x79'),_0x1d7ae7[_0x56c2('0x5f')]['id'],_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x3a')],_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x66')],_0x5cdfc5['interaction']['id'],_0x1d7ae7[_0x56c2('0x58')]?JSON['stringify'](_0x1d7ae7['body']):_0x56c2('0x7a'));return respondWithRpcPromise(_0x56c2('0x7b'),_0x56c2('0x7c'),_0x5cdfc5);}return null;})[_0x56c2('0x23')](function(_0x47860c){var _0x218176='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47860c['message'][_0x56c2('0x7d')];return db['sequelize'][_0x56c2('0x43')](_0x218176,{'type':db[_0x56c2('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0xc85ef3){return _0xc85ef3;});})[_0x56c2('0x23')](function(_0x276ca0){if(_0x276ca0){_0x5cdfc5[_0x56c2('0x2b')][_0x56c2('0x6c')]=_0x276ca0[0x0];if(!_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')])return;return db[_0x56c2('0x6d')][_0x56c2('0x57')]({'where':{'id':_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')],'role':_0x56c2('0x60')},'attributes':['id',_0x56c2('0x3a'),'fullname',_0x56c2('0x6f'),_0x56c2('0x70')],'raw':!![]});}return null;})['then'](function(_0x28b4fe){if(!_0x28b4fe)return null;_0x5cdfc5['message'][_0x56c2('0x60')]=_0x28b4fe;return _0x5cdfc5;})['then'](function(_0x85fcf){if(_0x85fcf){_0x85fcf['message'][_0x56c2('0x72')]=util['format'](_0x56c2('0x73'),_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x3a')]);_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x74')]=_0x5cdfc5[_0x56c2('0x74')];_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x7e')]=_0x5cdfc5['channel'];_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x7f')]='reject';respondWithRpcPromise('EventManager',_0x56c2('0x75'),{'event':_0x56c2('0x80'),'message':_0x85fcf[_0x56c2('0x2b')]},client9002);return _0x5cdfc5;}return null;})[_0x56c2('0x23')](respondWithResult(_0x4211b6,null))['catch'](handleError(_0x4211b6,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b7c8766..da5382e 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 _0x6c27=['emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','save'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x6c27,0xdc));var _0x76c2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6c27[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x76c2('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x76c2('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x76c2('0x2')](0x0);var events={'afterCreate':_0x76c2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a8238){return function(_0x9da931,_0x26a047,_0x4513ca){OpenchannelMessageEvents['emit'](_0x1a8238+':'+_0x9da931['id'],_0x9da931);OpenchannelMessageEvents[_0x76c2('0x4')](_0x1a8238,_0x9da931);_0x4513ca(null);};}for(var e in events){if(events[_0x76c2('0x5')](e)){var event=events[e];OpenchannelMessage[_0x76c2('0x6')](e,emitEvent(event));}}module[_0x76c2('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xcf33=['hasOwnProperty','hook','events','OpenchannelMessage','remove','emit'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0xcf33,0x182));var _0x3cf3=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcf33[_0x243b59];return _0x3e1676;};'use strict';var EventEmitter=require(_0x3cf3('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x3cf3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3cf3('0x2')};function emitEvent(_0xbde1bf){return function(_0x11f58d,_0x43be78,_0x509d23){OpenchannelMessageEvents[_0x3cf3('0x3')](_0xbde1bf+':'+_0x11f58d['id'],_0x11f58d);OpenchannelMessageEvents['emit'](_0xbde1bf,_0x11f58d);_0x509d23(null);};}for(var e in events){if(events[_0x3cf3('0x4')](e)){var event=events[e];OpenchannelMessage[_0x3cf3('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 581590f..58a7f47 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 _0x01d9=['threadId','error','inspect','finally','utf8mb4','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x617ad4,_0x5d5442){var _0x448438=function(_0xdfdde0){while(--_0xdfdde0){_0x617ad4['push'](_0x617ad4['shift']());}};_0x448438(++_0x5d5442);}(_0x01d9,0x15c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x901d('0x0'))('api');var moment=require(_0x901d('0x1'));var BPromise=require(_0x901d('0x2'));var rp=require(_0x901d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x901d('0x4'));var config=require('../../config/environment');var attributes=require(_0x901d('0x5'));module[_0x901d('0x6')]=function(_0x2ba810,_0x3e796a){return _0x2ba810[_0x901d('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x901d('0x8'),'paranoid':![],'indexes':[{'name':_0x901d('0x9'),'fields':[_0x901d('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xda7ab6,_0x5e1fd1,_0x446a08){var _0x199922=_0x2ba810[_0x901d('0xb')];var _0x513fb5=_0xda7ab6['get']({'plain':!![]});if(_0x513fb5[_0x901d('0xc')][_0x901d('0xd')]()==='in'||_0x513fb5[_0x901d('0xc')]['toLowerCase']()==='out'&&!_0x513fb5[_0x901d('0xe')]&&!_[_0x901d('0xf')](_0x513fb5[_0x901d('0x10')])){_0x199922[_0x901d('0x11')][_0x901d('0x12')]({'where':{'id':_0x513fb5[_0x901d('0x13')]}})[_0x901d('0x14')](function(_0x5ba2fc){if(_0x5ba2fc){_0x5ba2fc[_0x901d('0x15')]({'lastMsgAt':_0x513fb5['createdAt'],'lastMsgDirection':_0x513fb5[_0x901d('0xc')]['toLowerCase']()});}})[_0x901d('0x16')](function(_0x9ef5d7){console['error'](_0x9ef5d7);});}if(_0x513fb5[_0x901d('0xc')]==='out'&&!_0x513fb5[_0x901d('0xe')]){var _0x3cbd7a;_0x199922[_0x901d('0x17')][_0x901d('0x18')]()[_0x901d('0x14')](function(_0x8d0103){return _0x199922[_0x901d('0x19')][_0x901d('0x1a')]({'where':{'id':_0x513fb5[_0x901d('0x1b')]},'include':[{'model':_0x199922[_0x901d('0x11')],'as':_0x901d('0x1c'),'where':{'id':_0x513fb5[_0x901d('0x13')]},'limit':0x1,'include':[{'model':_0x199922[_0x901d('0x17')],'as':_0x901d('0x1d'),'attributes':_[_0x901d('0x1e')](_0x8d0103)}]}]});})[_0x901d('0x14')](function(_0x3ebe4f){_0x3cbd7a=_0x3ebe4f['get']({'plain':!![]});if(_0x3cbd7a&&_0x3cbd7a[_0x901d('0x1f')]){logger[_0x901d('0x20')](_0x901d('0x21'),_0x901d('0x22'),util[_0x901d('0x23')](_0x901d('0x24'),_0x513fb5['id'],_0x3cbd7a[_0x901d('0x1f')]));if(_0x3cbd7a[_0x901d('0x1c')]&&_0x3cbd7a['Interactions'][_0x901d('0x25')]){_0x513fb5[_0x901d('0x26')]=_[_0x901d('0x27')](_0x3cbd7a[_0x901d('0x1c')][0x0],_0x901d('0x1d'));_0x513fb5[_0x901d('0x1d')]=_0x3cbd7a[_0x901d('0x1c')][0x0][_0x901d('0x1d')];}var _0x5e1fd1={'method':'POST','uri':encodeURI(_0x3cbd7a[_0x901d('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5e1fd1[_0x901d('0x28')]){case _0x901d('0x29'):_0x5e1fd1['qs']=_0x513fb5;break;case _0x901d('0x2a'):_0x5e1fd1[_0x901d('0xa')]=_0x513fb5;break;}return rp(_0x5e1fd1)['then'](function(_0x5abfd6){logger[_0x901d('0x20')](_0x901d('0x21'),_0x901d('0x22'),util[_0x901d('0x23')](_0x901d('0x2b'),_0x513fb5['id'],_0x3cbd7a['replyUri']));if(_0x5abfd6[_0x901d('0xa')][_0x901d('0x2c')]&&_0x5abfd6[_0x901d('0xa')][_0x901d('0x2c')]!=_0x513fb5[_0x901d('0x26')][_0x901d('0x2c')]){return _0x199922['OpenchannelInteraction'][_0x901d('0x15')]({'threadId':_0x5abfd6[_0x901d('0xa')][_0x901d('0x2c')]},{'where':{'id':_0x513fb5[_0x901d('0x26')]['id']}});}else{return;}})[_0x901d('0x14')](function(){return _0xda7ab6[_0x901d('0x15')]({'read':!![]});})[_0x901d('0x16')](function(_0x4f01dd){logger[_0x901d('0x2d')](_0x901d('0x21'),_0x901d('0x22'),util[_0x901d('0x2e')](_0x4f01dd,{'showHidden':![],'depth':null}));_0x446a08();});}else{_0x446a08();}})[_0x901d('0x2f')](function(){_0x446a08();});}else{_0x446a08();}}},'charset':_0x901d('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1172=['exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','then','find','OpenchannelAccountId','Contact','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','info','threadId','update','inspect','finally','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes'];(function(_0x42c241,_0x505e52){var _0x5cc387=function(_0x38197e){while(--_0x38197e){_0x42c241['push'](_0x42c241['shift']());}};_0x5cc387(++_0x505e52);}(_0x1172,0xc6));var _0x2117=function(_0xcc2b1e,_0x1da238){_0xcc2b1e=_0xcc2b1e-0x0;var _0x1c4b5d=_0x1172[_0xcc2b1e];return _0x1c4b5d;};'use strict';var _=require(_0x2117('0x0'));var util=require(_0x2117('0x1'));var logger=require(_0x2117('0x2'))(_0x2117('0x3'));var moment=require(_0x2117('0x4'));var BPromise=require(_0x2117('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2117('0x6'));var rimraf=require(_0x2117('0x7'));var config=require(_0x2117('0x8'));var attributes=require(_0x2117('0x9'));module[_0x2117('0xa')]=function(_0x57cf3b,_0xeaf308){return _0x57cf3b[_0x2117('0xb')](_0x2117('0xc'),attributes,{'tableName':_0x2117('0xd'),'paranoid':![],'indexes':[{'name':_0x2117('0xe'),'fields':[_0x2117('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdaac21,_0x5794b5,_0x23e6c0){var _0x2438b3=_0x57cf3b[_0x2117('0x10')];var _0x2bdcdc=_0xdaac21['get']({'plain':!![]});if(_0x2bdcdc[_0x2117('0x11')][_0x2117('0x12')]()==='in'||_0x2bdcdc[_0x2117('0x11')][_0x2117('0x12')]()===_0x2117('0x13')&&!_0x2bdcdc[_0x2117('0x14')]&&!_[_0x2117('0x15')](_0x2bdcdc[_0x2117('0x16')])){_0x2438b3[_0x2117('0x17')][_0x2117('0x18')]({'where':{'id':_0x2bdcdc[_0x2117('0x19')]}})['then'](function(_0x3ac0bc){if(_0x3ac0bc){_0x3ac0bc['update']({'lastMsgAt':_0x2bdcdc[_0x2117('0x1a')],'lastMsgDirection':_0x2bdcdc[_0x2117('0x11')]['toLowerCase']()});}})[_0x2117('0x1b')](function(_0xd27468){console[_0x2117('0x1c')](_0xd27468);});}if(_0x2bdcdc[_0x2117('0x11')]===_0x2117('0x13')&&!_0x2bdcdc[_0x2117('0x14')]){var _0x4f2d03;_0x2438b3[_0x2117('0x1d')]['describe']()[_0x2117('0x1e')](function(_0x3d6986){return _0x2438b3['OpenchannelAccount'][_0x2117('0x1f')]({'where':{'id':_0x2bdcdc[_0x2117('0x20')]},'include':[{'model':_0x2438b3['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x2bdcdc[_0x2117('0x19')]},'limit':0x1,'include':[{'model':_0x2438b3[_0x2117('0x1d')],'as':_0x2117('0x21'),'attributes':_['keys'](_0x3d6986)}]}]});})[_0x2117('0x1e')](function(_0x50b657){_0x4f2d03=_0x50b657[_0x2117('0x22')]({'plain':!![]});if(_0x4f2d03&&_0x4f2d03[_0x2117('0x23')]){logger['info'](_0x2117('0x24'),_0x2117('0x25'),util[_0x2117('0x26')](_0x2117('0x27'),_0x2bdcdc['id'],_0x4f2d03[_0x2117('0x23')]));if(_0x4f2d03['Interactions']&&_0x4f2d03[_0x2117('0x28')][_0x2117('0x29')]){_0x2bdcdc[_0x2117('0x2a')]=_[_0x2117('0x2b')](_0x4f2d03[_0x2117('0x28')][0x0],'Contact');_0x2bdcdc[_0x2117('0x21')]=_0x4f2d03[_0x2117('0x28')][0x0]['Contact'];}var _0x5794b5={'method':_0x2117('0x2c'),'uri':encodeURI(_0x4f2d03[_0x2117('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5794b5[_0x2117('0x2d')]){case _0x2117('0x2e'):_0x5794b5['qs']=_0x2bdcdc;break;case'POST':_0x5794b5[_0x2117('0xf')]=_0x2bdcdc;break;}return rp(_0x5794b5)['then'](function(_0x2dd36d){logger[_0x2117('0x2f')](_0x2117('0x24'),'afterCreate',util[_0x2117('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2bdcdc['id'],_0x4f2d03[_0x2117('0x23')]));if(_0x2dd36d[_0x2117('0xf')]['threadId']&&_0x2dd36d[_0x2117('0xf')]['threadId']!=_0x2bdcdc[_0x2117('0x2a')][_0x2117('0x30')]){return _0x2438b3[_0x2117('0x17')]['update']({'threadId':_0x2dd36d['body'][_0x2117('0x30')]},{'where':{'id':_0x2bdcdc[_0x2117('0x2a')]['id']}});}else{return;}})[_0x2117('0x1e')](function(){return _0xdaac21[_0x2117('0x31')]({'read':!![]});})[_0x2117('0x1b')](function(_0x908a6a){logger[_0x2117('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x2117('0x25'),util[_0x2117('0x32')](_0x908a6a,{'showHidden':![],'depth':null}));_0x23e6c0();});}else{_0x23e6c0();}})[_0x2117('0x33')](function(){_0x23e6c0();});}else{_0x23e6c0();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9f3b6e3..77b3244 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4f5107,_0x3553bf){var _0x1d2568=function(_0x59b0e3){while(--_0x59b0e3){_0x4f5107['push'](_0x4f5107['shift']());}};_0x1d2568(++_0x3553bf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _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(_0x59e3f0,_0x43a9bf){var _0x2eaf15=function(_0x537c3d){while(--_0x537c3d){_0x59e3f0['push'](_0x59e3f0['shift']());}};_0x2eaf15(++_0x43a9bf);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x0b0e[_0x2390bd];return _0x3a969d;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 37713f9..6a20c1a 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 _0xa91c=['remove','update','length','openchannelMessage:','save'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xa91c,0x68));var _0xca91=function(_0x34e44b,_0x484ffc){_0x34e44b=_0x34e44b-0x0;var _0x2420b5=_0xa91c[_0x34e44b];return _0x2420b5;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xca91('0x0'),_0xca91('0x1'),_0xca91('0x2')];function createListener(_0x451631,_0x408cb3){return function(_0x5dcc84){_0x408cb3['emit'](_0x451631,_0x5dcc84);};}function removeListener(_0x5866d6,_0x927ce8){return function(){OpenchannelMessageEvents['removeListener'](_0x5866d6,_0x927ce8);};}exports['register']=function(_0x10d7fd){for(var _0x289c8e=0x0,_0x4a3172=events[_0xca91('0x3')];_0x289c8e<_0x4a3172;_0x289c8e++){var _0x5254e2=events[_0x289c8e];var _0x5c9ee9=createListener(_0xca91('0x4')+_0x5254e2,_0x10d7fd);OpenchannelMessageEvents['on'](_0x5254e2,_0x5c9ee9);}}; \ No newline at end of file +var _0xdf89=['emit','removeListener','register','./openchannelMessage.events','save','remove','update'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xdf89,0x16f));var _0x9df8=function(_0x38e6d1,_0x2fe815){_0x38e6d1=_0x38e6d1-0x0;var _0x4a8e17=_0xdf89[_0x38e6d1];return _0x4a8e17;};'use strict';var OpenchannelMessageEvents=require(_0x9df8('0x0'));var events=[_0x9df8('0x1'),_0x9df8('0x2'),_0x9df8('0x3')];function createListener(_0x89bce8,_0x19f262){return function(_0x18463a){_0x19f262[_0x9df8('0x4')](_0x89bce8,_0x18463a);};}function removeListener(_0x31b021,_0x57a211){return function(){OpenchannelMessageEvents[_0x9df8('0x5')](_0x31b021,_0x57a211);};}exports[_0x9df8('0x6')]=function(_0xa87d49){for(var _0x16ef8f=0x0,_0x174cbc=events['length'];_0x16ef8f<_0x174cbc;_0x16ef8f++){var _0x35f5f1=events[_0x16ef8f];var _0x335854=createListener('openchannelMessage:'+_0x35f5f1,_0xa87d49);OpenchannelMessageEvents['on'](_0x35f5f1,_0x335854);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5ea654d..fb178f4 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 _0xa20e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','getAgents','/:id/teams','post','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x354cc1,_0x1274fc){var _0x17f4fb=function(_0x218be7){while(--_0x218be7){_0x354cc1['push'](_0x354cc1['shift']());}};_0x17f4fb(++_0x1274fc);}(_0xa20e,0x172));var _0xea20=function(_0x39e2d7,_0x1b15f6){_0x39e2d7=_0x39e2d7-0x0;var _0x413d0d=_0xa20e[_0x39e2d7];return _0x413d0d;};'use strict';var multer=require(_0xea20('0x0'));var util=require(_0xea20('0x1'));var path=require(_0xea20('0x2'));var timeout=require(_0xea20('0x3'));var express=require(_0xea20('0x4'));var router=express[_0xea20('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea20('0x6'));var interaction=require(_0xea20('0x7'));var config=require(_0xea20('0x8'));var controller=require(_0xea20('0x9'));router[_0xea20('0xa')]('/',auth['isAuthenticated'](),controller[_0xea20('0xb')]);router[_0xea20('0xa')](_0xea20('0xc'),auth['isAuthenticated'](),controller[_0xea20('0xd')]);router[_0xea20('0xa')](_0xea20('0xe'),auth[_0xea20('0xf')](),controller[_0xea20('0x10')]);router['get'](_0xea20('0x11'),auth[_0xea20('0xf')](),controller[_0xea20('0x12')]);router[_0xea20('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xea20('0x13')]);router[_0xea20('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xea20('0x14')]);router['post']('/',auth[_0xea20('0xf')](),controller['create']);router['post'](_0xea20('0x15'),auth['isAuthenticated'](),controller['addTeams']);router[_0xea20('0x16')](_0xea20('0x17'),auth['isAuthenticated'](),controller[_0xea20('0x18')]);router['put']('/:id',auth[_0xea20('0xf')](),controller[_0xea20('0x19')]);router[_0xea20('0x1a')](_0xea20('0xe'),auth[_0xea20('0xf')](),controller[_0xea20('0x1b')]);router[_0xea20('0x1a')](_0xea20('0x15'),auth[_0xea20('0xf')](),controller[_0xea20('0x1c')]);router[_0xea20('0x1a')](_0xea20('0x17'),auth[_0xea20('0xf')](),controller[_0xea20('0x1d')]);module[_0xea20('0x1e')]=router; \ No newline at end of file +var _0x2d14=['addTeams','put','destroy','delete','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x138a6b,_0x4e85f5){var _0x313d4a=function(_0x5e6b06){while(--_0x5e6b06){_0x138a6b['push'](_0x138a6b['shift']());}};_0x313d4a(++_0x4e85f5);}(_0x2d14,0x18c));var _0x42d1=function(_0x9725c0,_0x3b6b9b){_0x9725c0=_0x9725c0-0x0;var _0x513242=_0x2d14[_0x9725c0];return _0x513242;};'use strict';var multer=require(_0x42d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42d1('0x1'));var express=require(_0x42d1('0x2'));var router=express[_0x42d1('0x3')]();var fs_extra=require(_0x42d1('0x4'));var auth=require(_0x42d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42d1('0x6'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x42d1('0x7')](),controller[_0x42d1('0x8')]);router[_0x42d1('0x9')]('/describe',auth[_0x42d1('0x7')](),controller[_0x42d1('0xa')]);router['get'](_0x42d1('0xb'),auth[_0x42d1('0x7')](),controller[_0x42d1('0xc')]);router['get'](_0x42d1('0xd'),auth[_0x42d1('0x7')](),controller[_0x42d1('0xe')]);router['get'](_0x42d1('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x42d1('0x9')](_0x42d1('0x10'),auth['isAuthenticated'](),controller[_0x42d1('0x11')]);router[_0x42d1('0x12')]('/',auth[_0x42d1('0x7')](),controller[_0x42d1('0x13')]);router['post'](_0x42d1('0xf'),auth[_0x42d1('0x7')](),controller[_0x42d1('0x14')]);router[_0x42d1('0x12')](_0x42d1('0x10'),auth[_0x42d1('0x7')](),controller['addAgents']);router[_0x42d1('0x15')]('/:id',auth[_0x42d1('0x7')](),controller['update']);router['delete'](_0x42d1('0xb'),auth[_0x42d1('0x7')](),controller[_0x42d1('0x16')]);router[_0x42d1('0x17')](_0x42d1('0xf'),auth[_0x42d1('0x7')](),controller[_0x42d1('0x18')]);router['delete'](_0x42d1('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x42d1('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a22b0d5..a8d28b3 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 _0x2ff5=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x42b9aa,_0x4b8265){var _0x4d0441=function(_0x4cd0da){while(--_0x4cd0da){_0x42b9aa['push'](_0x42b9aa['shift']());}};_0x4d0441(++_0x4b8265);}(_0x2ff5,0x170));var _0x52ff=function(_0x4c6547,_0x5cb0b6){_0x4c6547=_0x4c6547-0x0;var _0x1f0e77=_0x2ff5[_0x4c6547];return _0x1f0e77;};'use strict';var Sequelize=require(_0x52ff('0x0'));module[_0x52ff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x52ff('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x52ff('0x3')](_0x52ff('0x4'),_0x52ff('0x5'),_0x52ff('0x6'))}}; \ No newline at end of file +var _0x8c86=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2493a3,_0x24ba04){var _0x50ad43=function(_0x1dbc38){while(--_0x1dbc38){_0x2493a3['push'](_0x2493a3['shift']());}};_0x50ad43(++_0x24ba04);}(_0x8c86,0x17b));var _0x68c8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8c86[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x68c8('0x0'));module[_0x68c8('0x1')]={'name':{'type':Sequelize[_0x68c8('0x2')],'unique':_0x68c8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68c8('0x2')]},'timeout':{'type':Sequelize[_0x68c8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68c8('0x5')](_0x68c8('0x6'),_0x68c8('0x7'),_0x68c8('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index dddc5cb..2ee8b0b 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 _0x4b17=['removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','get','UserProfileResource','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','show','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','map','options','User','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','length','pick','ids','voicePause','interface','sequelize','transaction','addTeams','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','Agents','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value'];(function(_0x233738,_0x1891b4){var _0x1815d6=function(_0x557ec8){while(--_0x557ec8){_0x233738['push'](_0x233738['shift']());}};_0x1815d6(++_0x1891b4);}(_0x4b17,0x7f));var _0x74b1=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x4b17[_0x466af7];return _0x348c96;};'use strict';var BPromise=require(_0x74b1('0x0'));var util=require(_0x74b1('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x74b1('0x2'));var qs=require(_0x74b1('0x3'));var logger=require('../../config/logger')(_0x74b1('0x4'));var config=require(_0x74b1('0x5'));var db=require(_0x74b1('0x6'))['db'];config[_0x74b1('0x7')]=_[_0x74b1('0x8')](config[_0x74b1('0x7')],{'host':_0x74b1('0x9'),'port':0x18eb});var socket=require(_0x74b1('0xa'))(new Redis(config['redis']));require(_0x74b1('0xb'))[_0x74b1('0xc')](socket);function respondWithStatusCode(_0x3176d7,_0x290c59){_0x290c59=_0x290c59||0xcc;return function(_0x554f1f){if(_0x554f1f){return _0x3176d7[_0x74b1('0xd')](_0x290c59);}return _0x3176d7[_0x74b1('0xe')](_0x290c59)[_0x74b1('0xf')]();};}function respondWithResult(_0x67e17a,_0x5409d8){_0x5409d8=_0x5409d8||0xc8;return function(_0x1e499f){if(_0x1e499f){return _0x67e17a[_0x74b1('0xe')](_0x5409d8)['json'](_0x1e499f);}};}function respondWithFilteredResult(_0x1868b9,_0x2f3391){return function(_0x47ae0b){if(_0x47ae0b){var _0x5c03a1=typeof _0x2f3391['offset']===_0x74b1('0x10')&&typeof _0x2f3391[_0x74b1('0x11')]===_0x74b1('0x10');var _0x1ac62e=_0x47ae0b[_0x74b1('0x12')];var _0x1fdf1a=_0x5c03a1?0x0:_0x2f3391[_0x74b1('0x13')];var _0x648164=_0x5c03a1?_0x47ae0b[_0x74b1('0x12')]:_0x2f3391[_0x74b1('0x13')]+_0x2f3391[_0x74b1('0x11')];var _0xe766c8;if(_0x648164>=_0x1ac62e){_0x648164=_0x1ac62e;_0xe766c8=0xc8;}else{_0xe766c8=0xce;}_0x1868b9[_0x74b1('0xe')](_0xe766c8);return _0x1868b9[_0x74b1('0x14')](_0x74b1('0x15'),_0x1fdf1a+'-'+_0x648164+'/'+_0x1ac62e)[_0x74b1('0x16')](_0x47ae0b);}return null;};}function saveUpdates(_0x4fda98){return function(_0x50db34){if(_0x50db34){return _0x50db34[_0x74b1('0x17')](_0x4fda98)[_0x74b1('0x18')](function(_0x469a72){return _0x469a72;});}return null;};}function removeEntity(_0x5e4593){return function(_0x2edeac){if(_0x2edeac){return _0x2edeac[_0x74b1('0x19')]()[_0x74b1('0x18')](function(){var _0x47f25f=_0x2edeac[_0x74b1('0x1a')]({'plain':!![]});var _0x20d118='OpenchannelQueues';return db[_0x74b1('0x1b')][_0x74b1('0x19')]({'where':{'type':_0x20d118,'resourceId':_0x47f25f['id']}})[_0x74b1('0x18')](function(){return _0x2edeac;});})['then'](function(){_0x5e4593[_0x74b1('0xe')](0xcc)[_0x74b1('0xf')]();});}};}function handleEntityNotFound(_0x409443){return function(_0x584823){if(!_0x584823){_0x409443[_0x74b1('0xd')](0x194);}return _0x584823;};}function handleError(_0x9dae15,_0x1aad0e){_0x1aad0e=_0x1aad0e||0x1f4;return function(_0x24cb07){logger['error'](_0x24cb07['stack']);if(_0x24cb07['name']){delete _0x24cb07[_0x74b1('0x1c')];}_0x9dae15[_0x74b1('0xe')](_0x1aad0e)[_0x74b1('0x1d')](_0x24cb07);};}exports[_0x74b1('0x1e')]=function(_0x2c68d4,_0xfb7990){var _0x2efe59={};var _0x2a3111={'count':0x0,'rows':[]};var _0x587059=_['map'](db[_0x74b1('0x1f')][_0x74b1('0x20')],function(_0x165d06){return{'name':_0x165d06[_0x74b1('0x21')],'type':_0x165d06['type'][_0x74b1('0x22')]};});_0x2efe59=qs[_0x74b1('0x23')](_0x587059,_0x2c68d4);var _0x3846f8={'where':_0x2efe59[_0x74b1('0x24')]};return db[_0x74b1('0x1f')][_0x74b1('0x12')](_0x3846f8)[_0x74b1('0x18')](function(_0x462ec4){_0x2a3111[_0x74b1('0x12')]=_0x462ec4;_0x2efe59[_0x74b1('0x25')]=qs[_0x74b1('0x25')](_0x2c68d4[_0x74b1('0x26')]);return db['OpenchannelQueue'][_0x74b1('0x27')](_0x2efe59);})['then'](function(_0x5f4d7a){_0x2a3111[_0x74b1('0x28')]=_0x5f4d7a;return _0x2a3111;})['then'](respondWithFilteredResult(_0xfb7990,_0x2efe59))['catch'](handleError(_0xfb7990,null));};exports[_0x74b1('0x29')]=function(_0x1dc353,_0x5ea86e){var _0x4b841e={'raw':!![],'where':{'id':_0x1dc353[_0x74b1('0x2a')]['id']}},_0x3eee9c={};_0x3eee9c['model']=_[_0x74b1('0x2b')](db[_0x74b1('0x1f')][_0x74b1('0x20')]);_0x3eee9c['query']=_[_0x74b1('0x2b')](_0x1dc353[_0x74b1('0x26')]);_0x3eee9c[_0x74b1('0x2c')]=_[_0x74b1('0x2d')](_0x3eee9c[_0x74b1('0x2e')],_0x3eee9c[_0x74b1('0x26')]);_0x4b841e[_0x74b1('0x2f')]=_[_0x74b1('0x2d')](_0x3eee9c['model'],qs[_0x74b1('0x30')](_0x1dc353['query']['fields']));_0x4b841e[_0x74b1('0x2f')]=_0x4b841e['attributes']['length']?_0x4b841e['attributes']:_0x3eee9c['model'];if(_0x1dc353[_0x74b1('0x26')][_0x74b1('0x31')]){_0x4b841e[_0x74b1('0x25')]=[{'all':!![]}];}_0x4b841e=_[_0x74b1('0x32')]({},_0x4b841e,_0x1dc353['options']);return db[_0x74b1('0x1f')][_0x74b1('0x33')](_0x4b841e)[_0x74b1('0x18')](handleEntityNotFound(_0x5ea86e,null))[_0x74b1('0x18')](respondWithResult(_0x5ea86e,null))[_0x74b1('0x34')](handleError(_0x5ea86e,null));};exports['create']=function(_0xd45611,_0x568d2c){return db['OpenchannelQueue']['create'](_0xd45611[_0x74b1('0x35')],{})[_0x74b1('0x18')](function(_0x3d717d){var _0x322d7b=_0xd45611[_0x74b1('0x36')][_0x74b1('0x1a')]({'plain':!![]});if(!_0x322d7b)throw new Error(_0x74b1('0x37'));if(_0x322d7b[_0x74b1('0x38')]===_0x74b1('0x36')){var _0x3fdc40=_0x3d717d[_0x74b1('0x1a')]({'plain':!![]});var _0x10d6f9=_0x74b1('0x39');return db[_0x74b1('0x3a')]['find']({'where':{'name':_0x10d6f9,'userProfileId':_0x322d7b['userProfileId']},'raw':!![]})[_0x74b1('0x18')](function(_0x3db7df){if(_0x3db7df&&_0x3db7df[_0x74b1('0x3b')]===0x0){return db[_0x74b1('0x1b')][_0x74b1('0x3c')]({'name':_0x3fdc40[_0x74b1('0x1c')],'resourceId':_0x3fdc40['id'],'type':_0x3db7df[_0x74b1('0x1c')],'sectionId':_0x3db7df['id']},{})[_0x74b1('0x18')](function(){return _0x3d717d;});}else{return _0x3d717d;}})[_0x74b1('0x34')](function(_0x58e8a5){logger['error'](_0x74b1('0x3d'),_0x58e8a5);throw _0x58e8a5;});}return _0x3d717d;})[_0x74b1('0x18')](respondWithResult(_0x568d2c,0xc9))[_0x74b1('0x34')](handleError(_0x568d2c,null));};exports[_0x74b1('0x17')]=function(_0x5806e0,_0x402c15){if(_0x5806e0[_0x74b1('0x35')]['id']){delete _0x5806e0['body']['id'];}return db[_0x74b1('0x1f')][_0x74b1('0x33')]({'where':{'id':_0x5806e0[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0x402c15,null))[_0x74b1('0x18')](saveUpdates(_0x5806e0[_0x74b1('0x35')],null))[_0x74b1('0x18')](respondWithResult(_0x402c15,null))[_0x74b1('0x34')](handleError(_0x402c15,null));};exports[_0x74b1('0x19')]=function(_0x1e4fa1,_0x4dd84c){return db['OpenchannelQueue'][_0x74b1('0x33')]({'where':{'id':_0x1e4fa1[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0x4dd84c,null))[_0x74b1('0x18')](removeEntity(_0x4dd84c,null))[_0x74b1('0x34')](handleError(_0x4dd84c,null));};exports[_0x74b1('0x3e')]=function(_0x173b27,_0x35aa7d){return db[_0x74b1('0x1f')]['describe']()['then'](respondWithResult(_0x35aa7d,null))[_0x74b1('0x34')](handleError(_0x35aa7d,null));};exports[_0x74b1('0x3f')]=function(_0x26cb98,_0xd8400){var _0x346dc0={'raw':!![],'where':{}},_0x483b9d={},_0x1ba690;return db[_0x74b1('0x1f')][_0x74b1('0x40')]({'where':{'id':_0x26cb98['params']['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0xd8400,null))[_0x74b1('0x18')](function(_0xb4b7b5){if(_0xb4b7b5){_0x1ba690=_0xb4b7b5['get']({'plain':!![]});_0x483b9d[_0x74b1('0x2e')]=_[_0x74b1('0x2b')](db[_0x74b1('0x41')][_0x74b1('0x20')]);_0x483b9d[_0x74b1('0x26')]=_['keys'](_0x26cb98[_0x74b1('0x26')]);_0x483b9d[_0x74b1('0x2c')]=_[_0x74b1('0x2d')](_0x483b9d['model'],_0x483b9d['query']);_0x346dc0[_0x74b1('0x2f')]=_[_0x74b1('0x2d')](_0x483b9d['model'],qs[_0x74b1('0x30')](_0x26cb98[_0x74b1('0x26')][_0x74b1('0x30')]));_0x346dc0[_0x74b1('0x2f')]=_0x346dc0['attributes']['length']?_0x346dc0['attributes']:_0x483b9d[_0x74b1('0x2e')];if(!_0x26cb98[_0x74b1('0x26')][_0x74b1('0x42')](_0x74b1('0x43'))){_0x346dc0[_0x74b1('0x11')]=qs['limit'](_0x26cb98[_0x74b1('0x26')][_0x74b1('0x11')]);_0x346dc0['offset']=qs[_0x74b1('0x13')](_0x26cb98['query']['offset']);}_0x346dc0[_0x74b1('0x44')]=qs[_0x74b1('0x45')](_0x26cb98[_0x74b1('0x26')][_0x74b1('0x45')]);_0x346dc0[_0x74b1('0x24')]=qs['filters'](_['pick'](_0x26cb98[_0x74b1('0x26')],_0x483b9d['filters']));_0x346dc0[_0x74b1('0x24')][_0x74b1('0x46')]=_0xb4b7b5['id'];if(_0x26cb98[_0x74b1('0x26')][_0x74b1('0x47')]){_0x346dc0[_0x74b1('0x24')]=_['merge'](_0x346dc0[_0x74b1('0x24')],{'$or':_[_0x74b1('0x48')](_0x346dc0['attributes'],function(_0x49eefa){var _0x43ca4f={};_0x43ca4f[_0x49eefa]={'$like':'%'+_0x26cb98[_0x74b1('0x26')]['filter']+'%'};return _0x43ca4f;})});}_0x346dc0=_[_0x74b1('0x32')]({},_0x346dc0,_0x26cb98[_0x74b1('0x49')]);return db[_0x74b1('0x41')][_0x74b1('0x27')](_0x346dc0);}})[_0x74b1('0x18')](function(_0x17e5ae){if(_0x17e5ae){return db[_0x74b1('0x4a')]['findAndCountAll']({'where':{'id':_[_0x74b1('0x48')](_0x17e5ae,'UserId'),'role':_0x74b1('0x4b')},'attributes':['id',_0x74b1('0x1c'),_0x74b1('0x4c'),_0x74b1('0x4d'),_0x74b1('0x4e')]});}})[_0x74b1('0x18')](function(_0x54fab0){if(_0x54fab0){return{'count':_0x54fab0[_0x74b1('0x12')],'rows':_[_0x74b1('0x48')](_0x54fab0['rows'],function(_0x1e55fa){return{'membername':_0x1e55fa['name'],'UserId':_0x1e55fa['id'],'queue_name':_0x1ba690['name'],'OpenchannelQueueId':_0x1ba690['id'],'interface':util['format'](_0x74b1('0x4f'),_0x74b1('0x50'),_0x1e55fa[_0x74b1('0x1c')]),'penalty':0x0,'paused':_0x1e55fa[_0x74b1('0x4c')],'createdAt':_0x1e55fa[_0x74b1('0x4e')],'updatedAt':_0x1e55fa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x74b1('0x18')](respondWithFilteredResult(_0xd8400,_0x346dc0))[_0x74b1('0x34')](handleError(_0xd8400,null));};exports[_0x74b1('0x51')]=function(_0x386228,_0x110ba9){var _0x4fe8a3={};var _0x1707a2={};var _0x569e59;var _0x16e479;return db[_0x74b1('0x1f')][_0x74b1('0x40')]({'where':{'id':_0x386228[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0x110ba9,null))[_0x74b1('0x18')](function(_0x2e708a){if(_0x2e708a){_0x569e59=_0x2e708a;_0x1707a2[_0x74b1('0x2e')]=_['keys'](db[_0x74b1('0x52')][_0x74b1('0x20')]);_0x1707a2[_0x74b1('0x26')]=_[_0x74b1('0x2b')](_0x386228['query']);_0x1707a2['filters']=_['intersection'](_0x1707a2['model'],_0x1707a2[_0x74b1('0x26')]);_0x4fe8a3[_0x74b1('0x2f')]=_[_0x74b1('0x2d')](_0x1707a2[_0x74b1('0x2e')],qs['fields'](_0x386228[_0x74b1('0x26')][_0x74b1('0x30')]));_0x4fe8a3[_0x74b1('0x2f')]=_0x4fe8a3[_0x74b1('0x2f')][_0x74b1('0x53')]?_0x4fe8a3[_0x74b1('0x2f')]:_0x1707a2[_0x74b1('0x2e')];_0x4fe8a3[_0x74b1('0x44')]=qs[_0x74b1('0x45')](_0x386228[_0x74b1('0x26')][_0x74b1('0x45')]);_0x4fe8a3[_0x74b1('0x24')]=qs[_0x74b1('0x2c')](_[_0x74b1('0x54')](_0x386228[_0x74b1('0x26')],_0x1707a2[_0x74b1('0x2c')]));if(_0x386228[_0x74b1('0x26')][_0x74b1('0x47')]){_0x4fe8a3[_0x74b1('0x24')]=_[_0x74b1('0x32')](_0x4fe8a3[_0x74b1('0x24')],{'$or':_['map'](_0x4fe8a3[_0x74b1('0x2f')],function(_0x1ae279){var _0x1d0c7b={};_0x1d0c7b[_0x1ae279]={'$like':'%'+_0x386228[_0x74b1('0x26')][_0x74b1('0x47')]+'%'};return _0x1d0c7b;})});}_0x4fe8a3=_[_0x74b1('0x32')]({},_0x4fe8a3,_0x386228[_0x74b1('0x49')]);return _0x569e59[_0x74b1('0x51')](_0x4fe8a3);}})[_0x74b1('0x18')](function(_0x35645e){if(_0x35645e){_0x16e479=_0x35645e['length'];if(!_0x386228[_0x74b1('0x26')][_0x74b1('0x42')](_0x74b1('0x43'))){_0x4fe8a3[_0x74b1('0x11')]=qs[_0x74b1('0x11')](_0x386228[_0x74b1('0x26')][_0x74b1('0x11')]);_0x4fe8a3['offset']=qs[_0x74b1('0x13')](_0x386228['query']['offset']);}return _0x569e59[_0x74b1('0x51')](_0x4fe8a3);}})['then'](function(_0x1c78fc){if(_0x1c78fc){return _0x1c78fc?{'count':_0x16e479,'rows':_0x1c78fc}:null;}})['then'](respondWithResult(_0x110ba9,null))[_0x74b1('0x34')](handleError(_0x110ba9,null));};exports['addTeams']=function(_0x5b3176,_0x1217d8){var _0x301058=_0x5b3176[_0x74b1('0x35')][_0x74b1('0x55')];return db[_0x74b1('0x52')][_0x74b1('0x27')]({'where':{'id':_0x301058},'attributes':['id'],'include':[{'model':db[_0x74b1('0x4a')],'as':'Agents','attributes':['id',_0x74b1('0x1c'),'online',_0x74b1('0x56'),_0x74b1('0x57')],'raw':!![]}]})[_0x74b1('0x18')](function(_0x40a58d){if(_0x40a58d){var _0x3011a9=_['flatMap'](_0x40a58d,function(_0x2103c2){var _0x14aa14=_0x2103c2[_0x74b1('0x1a')]({'plain':!![]});return _0x14aa14['Agents'];});return db[_0x74b1('0x1f')][_0x74b1('0x33')]({'where':{'id':_0x5b3176[_0x74b1('0x2a')]['id']}})['then'](function(_0x1933e8){return db[_0x74b1('0x58')][_0x74b1('0x59')](function(_0x291762){return _0x1933e8[_0x74b1('0x5a')](_0x301058,{'transaction':_0x291762})[_0x74b1('0x18')](function(){return BPromise['each'](_0x3011a9,function(_0x118699){return db[_0x74b1('0x41')][_0x74b1('0x5b')]({'where':{'UserId':_0x118699['id'],'OpenchannelQueueId':_0x5b3176[_0x74b1('0x2a')]['id']},'transaction':_0x291762});});})['then'](function(){_0x3011a9[_0x74b1('0x5c')](function(_0x370f40){socket['emit'](_0x74b1('0x5d'),{'UserId':_0x370f40['id'],'OpenchannelQueueId':_0x1933e8['id']});});});});});}})['then'](respondWithStatusCode(_0x1217d8,null))['catch'](handleError(_0x1217d8,null));};exports[_0x74b1('0x5e')]=function(_0x31b8a4,_0x5480b4){return db['Team'][_0x74b1('0x27')]({'where':{'id':_0x31b8a4['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x74b1('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x74b1('0x18')](handleEntityNotFound(_0x5480b4,null))[_0x74b1('0x18')](function(_0x46c6ea){var _0x1c3db9=_[_0x74b1('0x48')](_0x46c6ea,'id');var _0x398658=[];var _0x39e93a=[];var _0x26ff94=squel[_0x74b1('0x60')]();_0x26ff94[_0x74b1('0x61')](_0x74b1('0x62'))['from']('team_has_openchannel_queues','tq')[_0x74b1('0x63')](_0x74b1('0x64'),'ut',_0x74b1('0x65'))[_0x74b1('0x24')](_0x74b1('0x66'),_0x31b8a4[_0x74b1('0x2a')]['id']);for(var _0x5b462c=0x0;_0x5b462c<_0x46c6ea['length'];_0x5b462c+=0x1){let _0x47eb36=_0x46c6ea[_0x5b462c];for(var _0x17fc8b=0x0;_0x17fc8b<_0x47eb36[_0x74b1('0x5f')]['length'];_0x17fc8b+=0x1){let _0x5b00eb=_0x47eb36[_0x74b1('0x5f')][_0x17fc8b];var _0x4dbc8f=_0x26ff94[_0x74b1('0x67')]();_0x4dbc8f['where']('ut.UserId\x20=\x20?',_0x5b00eb['id']);_0x39e93a[_0x74b1('0x68')](db[_0x74b1('0x58')][_0x74b1('0x26')](_0x4dbc8f[_0x74b1('0x69')](),{'type':db['sequelize'][_0x74b1('0x6a')][_0x74b1('0x6b')]})[_0x74b1('0x18')](function(_0x4a1670){if(_0x4a1670['length']===0x1){return _0x5b00eb['id'];}else{var _0x78758b=_['every'](_[_0x74b1('0x48')](_0x4a1670,_0x74b1('0x6c')),function(_0x31f1a4){return _[_0x74b1('0x6d')](_0x1c3db9,_0x31f1a4);});if(_0x78758b){return _0x5b00eb['id'];}}}));}}return BPromise[_0x74b1('0x6e')](_0x39e93a)[_0x74b1('0x18')](function(_0x158b90){_0x398658=_(_0x398658)[_0x74b1('0x6f')](_0x158b90)['compact']()[_0x74b1('0x70')]();return db[_0x74b1('0x1f')][_0x74b1('0x33')]({'where':{'id':_0x31b8a4[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](function(_0x522041){return db[_0x74b1('0x58')][_0x74b1('0x59')](function(_0x1623f5){return _0x522041[_0x74b1('0x5e')](_0x31b8a4[_0x74b1('0x26')][_0x74b1('0x55')],{'transaction':_0x1623f5})[_0x74b1('0x18')](function(){if(!_['isEmpty'](_0x398658)){return _0x522041[_0x74b1('0x71')](_0x398658,{'transaction':_0x1623f5});}})['then'](function(){_0x398658[_0x74b1('0x5c')](function(_0x78eee2){socket[_0x74b1('0x72')](_0x74b1('0x73'),{'UserId':_0x78eee2,'OpenchannelQueueId':_0x522041['id']});});});});});});})[_0x74b1('0x18')](respondWithStatusCode(_0x5480b4,null))[_0x74b1('0x34')](handleError(_0x5480b4,null));};exports[_0x74b1('0x74')]=function(_0x50c6cf,_0x50dfc4){return db[_0x74b1('0x1f')][_0x74b1('0x33')]({'where':{'id':_0x50c6cf[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0x50dfc4,null))[_0x74b1('0x18')](function(_0x555ab4){if(_0x555ab4){return _0x555ab4[_0x74b1('0x74')](_0x50c6cf['body']['ids'],_['omit'](_0x50c6cf[_0x74b1('0x35')],[_0x74b1('0x55'),'id'])||{})[_0x74b1('0x75')](function(_0x1e1e00){for(var _0x1456a9=0x0;_0x1456a9<_0x50c6cf[_0x74b1('0x35')]['ids']['length'];_0x1456a9+=0x1){socket[_0x74b1('0x72')](_0x74b1('0x5d'),{'UserId':Number(_0x50c6cf[_0x74b1('0x35')][_0x74b1('0x55')][_0x1456a9]),'OpenchannelQueueId':Number(_0x50c6cf[_0x74b1('0x2a')]['id'])});}return _0x1e1e00;});}})[_0x74b1('0x18')](respondWithResult(_0x50dfc4,null))[_0x74b1('0x34')](handleError(_0x50dfc4,null));};exports[_0x74b1('0x71')]=function(_0xec4f30,_0x4ba6cc){return db['OpenchannelQueue'][_0x74b1('0x33')]({'where':{'id':_0xec4f30[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0x4ba6cc,null))[_0x74b1('0x18')](function(_0x2c1742){if(_0x2c1742){return _0x2c1742[_0x74b1('0x71')](_0xec4f30[_0x74b1('0x26')]['ids'])[_0x74b1('0x18')](function(){if(_[_0x74b1('0x76')](_0xec4f30['query'][_0x74b1('0x55')])){for(var _0x590cb5=0x0;_0x590cb5<_0xec4f30[_0x74b1('0x26')][_0x74b1('0x55')][_0x74b1('0x53')];_0x590cb5+=0x1){socket[_0x74b1('0x72')](_0x74b1('0x73'),{'UserId':Number(_0xec4f30[_0x74b1('0x26')][_0x74b1('0x55')][_0x590cb5]),'OpenchannelQueueId':Number(_0xec4f30[_0x74b1('0x2a')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xec4f30['query'][_0x74b1('0x55')]),'OpenchannelQueueId':Number(_0xec4f30[_0x74b1('0x2a')]['id'])});}});}})[_0x74b1('0x18')](respondWithStatusCode(_0x4ba6cc,null))[_0x74b1('0x34')](handleError(_0x4ba6cc,null));};exports[_0x74b1('0x77')]=function(_0x424005,_0x1fcbfd){var _0x5698e2={};var _0x258d46={};var _0x3ef7b3;var _0x330d33;return db[_0x74b1('0x1f')][_0x74b1('0x40')]({'where':{'id':_0x424005[_0x74b1('0x2a')]['id']}})[_0x74b1('0x18')](handleEntityNotFound(_0x1fcbfd,null))['then'](function(_0x559879){if(_0x559879){_0x3ef7b3=_0x559879;_0x258d46[_0x74b1('0x2e')]=_[_0x74b1('0x2b')](db[_0x74b1('0x4a')]['rawAttributes']);_0x258d46[_0x74b1('0x26')]=_[_0x74b1('0x2b')](_0x424005[_0x74b1('0x26')]);_0x258d46[_0x74b1('0x2c')]=_[_0x74b1('0x2d')](_0x258d46['model'],_0x258d46[_0x74b1('0x26')]);_0x5698e2['attributes']=_[_0x74b1('0x2d')](_0x258d46['model'],qs['fields'](_0x424005[_0x74b1('0x26')][_0x74b1('0x30')]));_0x5698e2['attributes']=_0x5698e2['attributes'][_0x74b1('0x53')]?_0x5698e2[_0x74b1('0x2f')]:_0x258d46[_0x74b1('0x2e')];_0x5698e2[_0x74b1('0x44')]=qs[_0x74b1('0x45')](_0x424005['query']['sort']);_0x5698e2[_0x74b1('0x24')]=qs[_0x74b1('0x2c')](_[_0x74b1('0x54')](_0x424005['query'],_0x258d46[_0x74b1('0x2c')]));if(_0x424005[_0x74b1('0x26')][_0x74b1('0x47')]){_0x5698e2[_0x74b1('0x24')]=_['merge'](_0x5698e2[_0x74b1('0x24')],{'$or':_['map'](_0x5698e2[_0x74b1('0x2f')],function(_0x474d4b){var _0x1e1178={};_0x1e1178[_0x474d4b]={'$like':'%'+_0x424005[_0x74b1('0x26')][_0x74b1('0x47')]+'%'};return _0x1e1178;})});}_0x5698e2=_[_0x74b1('0x32')]({},_0x5698e2,_0x424005[_0x74b1('0x49')]);return _0x3ef7b3['getAgents'](_0x5698e2);}})[_0x74b1('0x18')](function(_0x1d3bca){if(_0x1d3bca){_0x330d33=_0x1d3bca[_0x74b1('0x53')];if(!_0x424005[_0x74b1('0x26')][_0x74b1('0x42')](_0x74b1('0x43'))){_0x5698e2[_0x74b1('0x11')]=qs['limit'](_0x424005[_0x74b1('0x26')]['limit']);_0x5698e2[_0x74b1('0x13')]=qs['offset'](_0x424005[_0x74b1('0x26')]['offset']);}return _0x3ef7b3['getAgents'](_0x5698e2);}})[_0x74b1('0x18')](function(_0x2c9066){if(_0x2c9066){return _0x2c9066?{'count':_0x330d33,'rows':_0x2c9066}:null;}})[_0x74b1('0x18')](respondWithResult(_0x1fcbfd,null))['catch'](handleError(_0x1fcbfd,null));}; \ No newline at end of file +var _0x4d1a=['role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','order','sort','pick','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','interface','Agents','each','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','sequelize','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','OpenchannelQueue','include','findAll','catch','show','params','keys','query','filters','intersection','model','fields','attributes','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x4d1a,0xb3));var _0xa4d1=function(_0x178f8d,_0x26e72d){_0x178f8d=_0x178f8d-0x0;var _0xa25d2e=_0x4d1a[_0x178f8d];return _0xa25d2e;};'use strict';var BPromise=require(_0xa4d1('0x0'));var util=require(_0xa4d1('0x1'));var _=require(_0xa4d1('0x2'));var squel=require('squel');var Redis=require(_0xa4d1('0x3'));var qs=require(_0xa4d1('0x4'));var logger=require('../../config/logger')(_0xa4d1('0x5'));var config=require(_0xa4d1('0x6'));var db=require(_0xa4d1('0x7'))['db'];config[_0xa4d1('0x8')]=_['defaults'](config[_0xa4d1('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4d1('0x9'))(new Redis(config[_0xa4d1('0x8')]));require(_0xa4d1('0xa'))[_0xa4d1('0xb')](socket);function respondWithStatusCode(_0x31dcd7,_0x426021){_0x426021=_0x426021||0xcc;return function(_0x3e5892){if(_0x3e5892){return _0x31dcd7[_0xa4d1('0xc')](_0x426021);}return _0x31dcd7[_0xa4d1('0xd')](_0x426021)[_0xa4d1('0xe')]();};}function respondWithResult(_0x3ed918,_0x117277){_0x117277=_0x117277||0xc8;return function(_0x34e6a1){if(_0x34e6a1){return _0x3ed918[_0xa4d1('0xd')](_0x117277)[_0xa4d1('0xf')](_0x34e6a1);}};}function respondWithFilteredResult(_0x104c45,_0x2e637c){return function(_0x32309d){if(_0x32309d){var _0x22c778=typeof _0x2e637c[_0xa4d1('0x10')]===_0xa4d1('0x11')&&typeof _0x2e637c[_0xa4d1('0x12')]===_0xa4d1('0x11');var _0x4589f9=_0x32309d[_0xa4d1('0x13')];var _0x1b554b=_0x22c778?0x0:_0x2e637c[_0xa4d1('0x10')];var _0x2966a9=_0x22c778?_0x32309d[_0xa4d1('0x13')]:_0x2e637c[_0xa4d1('0x10')]+_0x2e637c[_0xa4d1('0x12')];var _0x30aabd;if(_0x2966a9>=_0x4589f9){_0x2966a9=_0x4589f9;_0x30aabd=0xc8;}else{_0x30aabd=0xce;}_0x104c45[_0xa4d1('0xd')](_0x30aabd);return _0x104c45[_0xa4d1('0x14')](_0xa4d1('0x15'),_0x1b554b+'-'+_0x2966a9+'/'+_0x4589f9)['json'](_0x32309d);}return null;};}function saveUpdates(_0x37520c){return function(_0x5c8f46){if(_0x5c8f46){return _0x5c8f46[_0xa4d1('0x16')](_0x37520c)[_0xa4d1('0x17')](function(_0x32bc9e){return _0x32bc9e;});}return null;};}function removeEntity(_0x38807f){return function(_0x48696d){if(_0x48696d){return _0x48696d[_0xa4d1('0x18')]()[_0xa4d1('0x17')](function(){var _0x4fbb1a=_0x48696d['get']({'plain':!![]});var _0x1688c8=_0xa4d1('0x19');return db['UserProfileResource'][_0xa4d1('0x18')]({'where':{'type':_0x1688c8,'resourceId':_0x4fbb1a['id']}})[_0xa4d1('0x17')](function(){return _0x48696d;});})[_0xa4d1('0x17')](function(){_0x38807f[_0xa4d1('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc446){return function(_0x37fee6){if(!_0x37fee6){_0x1cc446[_0xa4d1('0xc')](0x194);}return _0x37fee6;};}function handleError(_0x2522ae,_0x22779c){_0x22779c=_0x22779c||0x1f4;return function(_0x4886f5){logger[_0xa4d1('0x1a')](_0x4886f5[_0xa4d1('0x1b')]);if(_0x4886f5['name']){delete _0x4886f5[_0xa4d1('0x1c')];}_0x2522ae[_0xa4d1('0xd')](_0x22779c)[_0xa4d1('0x1d')](_0x4886f5);};}exports[_0xa4d1('0x1e')]=function(_0x1918c1,_0x4cb13e){var _0x190009={};var _0xed0810={'count':0x0,'rows':[]};var _0xedf137=_[_0xa4d1('0x1f')](db['OpenchannelQueue'][_0xa4d1('0x20')],function(_0x1f5e23){return{'name':_0x1f5e23[_0xa4d1('0x21')],'type':_0x1f5e23[_0xa4d1('0x22')][_0xa4d1('0x23')]};});_0x190009=qs[_0xa4d1('0x24')](_0xedf137,_0x1918c1);var _0x21610c={'where':_0x190009[_0xa4d1('0x25')]};return db[_0xa4d1('0x26')][_0xa4d1('0x13')](_0x21610c)[_0xa4d1('0x17')](function(_0x3aba64){_0xed0810['count']=_0x3aba64;_0x190009[_0xa4d1('0x27')]=qs[_0xa4d1('0x27')](_0x1918c1['query']);return db[_0xa4d1('0x26')][_0xa4d1('0x28')](_0x190009);})[_0xa4d1('0x17')](function(_0x1a37d5){_0xed0810['rows']=_0x1a37d5;return _0xed0810;})[_0xa4d1('0x17')](respondWithFilteredResult(_0x4cb13e,_0x190009))[_0xa4d1('0x29')](handleError(_0x4cb13e,null));};exports[_0xa4d1('0x2a')]=function(_0x17bebb,_0x529c62){var _0x497a5e={'raw':!![],'where':{'id':_0x17bebb[_0xa4d1('0x2b')]['id']}},_0x895969={};_0x895969['model']=_[_0xa4d1('0x2c')](db[_0xa4d1('0x26')][_0xa4d1('0x20')]);_0x895969[_0xa4d1('0x2d')]=_['keys'](_0x17bebb[_0xa4d1('0x2d')]);_0x895969[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x895969[_0xa4d1('0x30')],_0x895969['query']);_0x497a5e['attributes']=_[_0xa4d1('0x2f')](_0x895969['model'],qs[_0xa4d1('0x31')](_0x17bebb[_0xa4d1('0x2d')][_0xa4d1('0x31')]));_0x497a5e[_0xa4d1('0x32')]=_0x497a5e['attributes']['length']?_0x497a5e[_0xa4d1('0x32')]:_0x895969[_0xa4d1('0x30')];if(_0x17bebb[_0xa4d1('0x2d')]['includeAll']){_0x497a5e[_0xa4d1('0x27')]=[{'all':!![]}];}_0x497a5e=_[_0xa4d1('0x33')]({},_0x497a5e,_0x17bebb[_0xa4d1('0x34')]);return db[_0xa4d1('0x26')]['find'](_0x497a5e)[_0xa4d1('0x17')](handleEntityNotFound(_0x529c62,null))[_0xa4d1('0x17')](respondWithResult(_0x529c62,null))[_0xa4d1('0x29')](handleError(_0x529c62,null));};exports[_0xa4d1('0x35')]=function(_0x58bc34,_0x4180c2){return db['OpenchannelQueue'][_0xa4d1('0x35')](_0x58bc34[_0xa4d1('0x36')],{})[_0xa4d1('0x17')](function(_0xd3011e){var _0x5196f4=_0x58bc34[_0xa4d1('0x37')]['get']({'plain':!![]});if(!_0x5196f4)throw new Error(_0xa4d1('0x38'));if(_0x5196f4[_0xa4d1('0x39')]===_0xa4d1('0x37')){var _0x517695=_0xd3011e[_0xa4d1('0x3a')]({'plain':!![]});var _0x134457=_0xa4d1('0x19');return db[_0xa4d1('0x3b')][_0xa4d1('0x3c')]({'where':{'name':_0x134457,'userProfileId':_0x5196f4[_0xa4d1('0x3d')]},'raw':!![]})[_0xa4d1('0x17')](function(_0x5e09a7){if(_0x5e09a7&&_0x5e09a7[_0xa4d1('0x3e')]===0x0){return db[_0xa4d1('0x3f')]['create']({'name':_0x517695[_0xa4d1('0x1c')],'resourceId':_0x517695['id'],'type':_0x5e09a7['name'],'sectionId':_0x5e09a7['id']},{})[_0xa4d1('0x17')](function(){return _0xd3011e;});}else{return _0xd3011e;}})[_0xa4d1('0x29')](function(_0x4ff34c){logger[_0xa4d1('0x1a')](_0xa4d1('0x40'),_0x4ff34c);throw _0x4ff34c;});}return _0xd3011e;})['then'](respondWithResult(_0x4180c2,0xc9))['catch'](handleError(_0x4180c2,null));};exports[_0xa4d1('0x16')]=function(_0x3b12c1,_0x393e27){if(_0x3b12c1[_0xa4d1('0x36')]['id']){delete _0x3b12c1[_0xa4d1('0x36')]['id'];}return db[_0xa4d1('0x26')][_0xa4d1('0x3c')]({'where':{'id':_0x3b12c1[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x393e27,null))['then'](saveUpdates(_0x3b12c1['body'],null))[_0xa4d1('0x17')](respondWithResult(_0x393e27,null))[_0xa4d1('0x29')](handleError(_0x393e27,null));};exports[_0xa4d1('0x18')]=function(_0x5621ae,_0x15264d){return db['OpenchannelQueue'][_0xa4d1('0x3c')]({'where':{'id':_0x5621ae[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x15264d,null))['then'](removeEntity(_0x15264d,null))[_0xa4d1('0x29')](handleError(_0x15264d,null));};exports[_0xa4d1('0x41')]=function(_0x50c5de,_0x308cb6){return db[_0xa4d1('0x26')][_0xa4d1('0x41')]()[_0xa4d1('0x17')](respondWithResult(_0x308cb6,null))[_0xa4d1('0x29')](handleError(_0x308cb6,null));};exports[_0xa4d1('0x42')]=function(_0xd9bd27,_0x183bce){var _0x2d15a6={'raw':!![],'where':{}},_0x3f026a={},_0x3c4cf9;return db[_0xa4d1('0x26')][_0xa4d1('0x43')]({'where':{'id':_0xd9bd27[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x183bce,null))[_0xa4d1('0x17')](function(_0x26c620){if(_0x26c620){_0x3c4cf9=_0x26c620['get']({'plain':!![]});_0x3f026a[_0xa4d1('0x30')]=_['keys'](db[_0xa4d1('0x44')][_0xa4d1('0x20')]);_0x3f026a['query']=_[_0xa4d1('0x2c')](_0xd9bd27[_0xa4d1('0x2d')]);_0x3f026a[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x3f026a['model'],_0x3f026a[_0xa4d1('0x2d')]);_0x2d15a6[_0xa4d1('0x32')]=_[_0xa4d1('0x2f')](_0x3f026a[_0xa4d1('0x30')],qs[_0xa4d1('0x31')](_0xd9bd27[_0xa4d1('0x2d')]['fields']));_0x2d15a6[_0xa4d1('0x32')]=_0x2d15a6[_0xa4d1('0x32')][_0xa4d1('0x45')]?_0x2d15a6[_0xa4d1('0x32')]:_0x3f026a[_0xa4d1('0x30')];if(!_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x46')]('nolimit')){_0x2d15a6['limit']=qs[_0xa4d1('0x12')](_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x12')]);_0x2d15a6['offset']=qs[_0xa4d1('0x10')](_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x10')]);}_0x2d15a6[_0xa4d1('0x47')]=qs[_0xa4d1('0x48')](_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x48')]);_0x2d15a6[_0xa4d1('0x25')]=qs['filters'](_[_0xa4d1('0x49')](_0xd9bd27[_0xa4d1('0x2d')],_0x3f026a[_0xa4d1('0x2e')]));_0x2d15a6[_0xa4d1('0x25')]['OpenchannelQueueId']=_0x26c620['id'];if(_0xd9bd27['query'][_0xa4d1('0x4a')]){_0x2d15a6[_0xa4d1('0x25')]=_[_0xa4d1('0x33')](_0x2d15a6[_0xa4d1('0x25')],{'$or':_[_0xa4d1('0x1f')](_0x2d15a6[_0xa4d1('0x32')],function(_0x2fa65f){var _0x515122={};_0x515122[_0x2fa65f]={'$like':'%'+_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x4a')]+'%'};return _0x515122;})});}_0x2d15a6=_[_0xa4d1('0x33')]({},_0x2d15a6,_0xd9bd27['options']);return db[_0xa4d1('0x44')][_0xa4d1('0x28')](_0x2d15a6);}})[_0xa4d1('0x17')](function(_0x64626e){if(_0x64626e){return db[_0xa4d1('0x4b')][_0xa4d1('0x4c')]({'where':{'id':_['map'](_0x64626e,_0xa4d1('0x4d')),'role':_0xa4d1('0x4e')},'attributes':['id',_0xa4d1('0x1c'),_0xa4d1('0x4f'),_0xa4d1('0x50'),_0xa4d1('0x51')]});}})[_0xa4d1('0x17')](function(_0x235305){if(_0x235305){return{'count':_0x235305[_0xa4d1('0x13')],'rows':_[_0xa4d1('0x1f')](_0x235305['rows'],function(_0x549915){return{'membername':_0x549915['name'],'UserId':_0x549915['id'],'queue_name':_0x3c4cf9[_0xa4d1('0x1c')],'OpenchannelQueueId':_0x3c4cf9['id'],'interface':util['format']('%s/%s',_0xa4d1('0x52'),_0x549915[_0xa4d1('0x1c')]),'penalty':0x0,'paused':_0x549915[_0xa4d1('0x4f')],'createdAt':_0x549915['createdAt'],'updatedAt':_0x549915['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa4d1('0x17')](respondWithFilteredResult(_0x183bce,_0x2d15a6))[_0xa4d1('0x29')](handleError(_0x183bce,null));};exports[_0xa4d1('0x53')]=function(_0x3fe8eb,_0x53f1ec){var _0x1e4a57={};var _0x27e970={};var _0x56c7ea;var _0x220dca;return db[_0xa4d1('0x26')][_0xa4d1('0x43')]({'where':{'id':_0x3fe8eb[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x53f1ec,null))['then'](function(_0x556508){if(_0x556508){_0x56c7ea=_0x556508;_0x27e970[_0xa4d1('0x30')]=_[_0xa4d1('0x2c')](db[_0xa4d1('0x54')][_0xa4d1('0x20')]);_0x27e970[_0xa4d1('0x2d')]=_[_0xa4d1('0x2c')](_0x3fe8eb['query']);_0x27e970[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x27e970['model'],_0x27e970['query']);_0x1e4a57['attributes']=_[_0xa4d1('0x2f')](_0x27e970[_0xa4d1('0x30')],qs['fields'](_0x3fe8eb[_0xa4d1('0x2d')]['fields']));_0x1e4a57[_0xa4d1('0x32')]=_0x1e4a57['attributes'][_0xa4d1('0x45')]?_0x1e4a57[_0xa4d1('0x32')]:_0x27e970[_0xa4d1('0x30')];_0x1e4a57[_0xa4d1('0x47')]=qs[_0xa4d1('0x48')](_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x48')]);_0x1e4a57[_0xa4d1('0x25')]=qs[_0xa4d1('0x2e')](_[_0xa4d1('0x49')](_0x3fe8eb[_0xa4d1('0x2d')],_0x27e970[_0xa4d1('0x2e')]));if(_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x4a')]){_0x1e4a57[_0xa4d1('0x25')]=_['merge'](_0x1e4a57[_0xa4d1('0x25')],{'$or':_[_0xa4d1('0x1f')](_0x1e4a57['attributes'],function(_0x5eea2a){var _0x4fef87={};_0x4fef87[_0x5eea2a]={'$like':'%'+_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x4a')]+'%'};return _0x4fef87;})});}_0x1e4a57=_[_0xa4d1('0x33')]({},_0x1e4a57,_0x3fe8eb[_0xa4d1('0x34')]);return _0x56c7ea[_0xa4d1('0x53')](_0x1e4a57);}})['then'](function(_0x34ad6d){if(_0x34ad6d){_0x220dca=_0x34ad6d[_0xa4d1('0x45')];if(!_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x46')](_0xa4d1('0x55'))){_0x1e4a57['limit']=qs[_0xa4d1('0x12')](_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x12')]);_0x1e4a57['offset']=qs['offset'](_0x3fe8eb['query'][_0xa4d1('0x10')]);}return _0x56c7ea[_0xa4d1('0x53')](_0x1e4a57);}})['then'](function(_0x26cd65){if(_0x26cd65){return _0x26cd65?{'count':_0x220dca,'rows':_0x26cd65}:null;}})[_0xa4d1('0x17')](respondWithResult(_0x53f1ec,null))['catch'](handleError(_0x53f1ec,null));};exports[_0xa4d1('0x56')]=function(_0x354106,_0x1c3c75){var _0x1e7ade=_0x354106[_0xa4d1('0x36')][_0xa4d1('0x57')];return db[_0xa4d1('0x54')][_0xa4d1('0x28')]({'where':{'id':_0x1e7ade},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa4d1('0x1c'),_0xa4d1('0x58'),'voicePause',_0xa4d1('0x59')],'raw':!![]}]})[_0xa4d1('0x17')](function(_0x2d1bf5){if(_0x2d1bf5){var _0x2bd678=_['flatMap'](_0x2d1bf5,function(_0x442c40){var _0x5f371a=_0x442c40[_0xa4d1('0x3a')]({'plain':!![]});return _0x5f371a[_0xa4d1('0x5a')];});return db[_0xa4d1('0x26')][_0xa4d1('0x3c')]({'where':{'id':_0x354106['params']['id']}})['then'](function(_0x297686){return db['sequelize']['transaction'](function(_0xa4ec38){return _0x297686[_0xa4d1('0x56')](_0x1e7ade,{'transaction':_0xa4ec38})[_0xa4d1('0x17')](function(){return BPromise[_0xa4d1('0x5b')](_0x2bd678,function(_0x383af2){return db[_0xa4d1('0x44')]['findOrCreate']({'where':{'UserId':_0x383af2['id'],'OpenchannelQueueId':_0x354106[_0xa4d1('0x2b')]['id']},'transaction':_0xa4ec38});});})[_0xa4d1('0x17')](function(){_0x2bd678['forEach'](function(_0x220e46){socket[_0xa4d1('0x5c')](_0xa4d1('0x5d'),{'UserId':_0x220e46['id'],'OpenchannelQueueId':_0x297686['id']});});});});});}})[_0xa4d1('0x17')](respondWithStatusCode(_0x1c3c75,null))[_0xa4d1('0x29')](handleError(_0x1c3c75,null));};exports[_0xa4d1('0x5e')]=function(_0x113703,_0xf3dc60){return db[_0xa4d1('0x54')]['findAll']({'where':{'id':_0x113703[_0xa4d1('0x2d')][_0xa4d1('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa4d1('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf3dc60,null))['then'](function(_0x1c503e){var _0x4f03a4=_['map'](_0x1c503e,'id');var _0x147c0b=[];var _0x581221=[];var _0x4c49a0=squel[_0xa4d1('0x5f')]();_0x4c49a0[_0xa4d1('0x60')](_0xa4d1('0x61'))['from'](_0xa4d1('0x62'),'tq')['join'](_0xa4d1('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa4d1('0x25')](_0xa4d1('0x64'),_0x113703[_0xa4d1('0x2b')]['id']);for(var _0x5f1a71=0x0;_0x5f1a71<_0x1c503e[_0xa4d1('0x45')];_0x5f1a71+=0x1){let _0x503c12=_0x1c503e[_0x5f1a71];for(var _0x40b0f8=0x0;_0x40b0f8<_0x503c12[_0xa4d1('0x5a')][_0xa4d1('0x45')];_0x40b0f8+=0x1){let _0x16ef12=_0x503c12[_0xa4d1('0x5a')][_0x40b0f8];var _0x85a995=_0x4c49a0[_0xa4d1('0x65')]();_0x85a995[_0xa4d1('0x25')]('ut.UserId\x20=\x20?',_0x16ef12['id']);_0x581221['push'](db['sequelize']['query'](_0x85a995['toString'](),{'type':db[_0xa4d1('0x66')]['QueryTypes'][_0xa4d1('0x67')]})['then'](function(_0x3faa99){if(_0x3faa99['length']===0x1){return _0x16ef12['id'];}else{var _0x4a555b=_[_0xa4d1('0x68')](_[_0xa4d1('0x1f')](_0x3faa99,_0xa4d1('0x69')),function(_0x38dd0d){return _[_0xa4d1('0x6a')](_0x4f03a4,_0x38dd0d);});if(_0x4a555b){return _0x16ef12['id'];}}}));}}return BPromise['all'](_0x581221)[_0xa4d1('0x17')](function(_0x116e63){_0x147c0b=_(_0x147c0b)[_0xa4d1('0x6b')](_0x116e63)[_0xa4d1('0x6c')]()[_0xa4d1('0x6d')]();return db['OpenchannelQueue'][_0xa4d1('0x3c')]({'where':{'id':_0x113703[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](function(_0x14a156){return db[_0xa4d1('0x66')][_0xa4d1('0x6e')](function(_0x32b87b){return _0x14a156[_0xa4d1('0x5e')](_0x113703[_0xa4d1('0x2d')][_0xa4d1('0x57')],{'transaction':_0x32b87b})[_0xa4d1('0x17')](function(){if(!_[_0xa4d1('0x6f')](_0x147c0b)){return _0x14a156[_0xa4d1('0x70')](_0x147c0b,{'transaction':_0x32b87b});}})[_0xa4d1('0x17')](function(){_0x147c0b['forEach'](function(_0x49780d){socket[_0xa4d1('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x49780d,'OpenchannelQueueId':_0x14a156['id']});});});});});});})[_0xa4d1('0x17')](respondWithStatusCode(_0xf3dc60,null))[_0xa4d1('0x29')](handleError(_0xf3dc60,null));};exports[_0xa4d1('0x71')]=function(_0x4381ed,_0x42a0e9){return db['OpenchannelQueue'][_0xa4d1('0x3c')]({'where':{'id':_0x4381ed[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x42a0e9,null))[_0xa4d1('0x17')](function(_0x323d3d){if(_0x323d3d){return _0x323d3d['addAgents'](_0x4381ed[_0xa4d1('0x36')][_0xa4d1('0x57')],_[_0xa4d1('0x72')](_0x4381ed[_0xa4d1('0x36')],[_0xa4d1('0x57'),'id'])||{})[_0xa4d1('0x73')](function(_0x18096f){for(var _0xc2322=0x0;_0xc2322<_0x4381ed[_0xa4d1('0x36')]['ids'][_0xa4d1('0x45')];_0xc2322+=0x1){socket['emit'](_0xa4d1('0x5d'),{'UserId':Number(_0x4381ed[_0xa4d1('0x36')][_0xa4d1('0x57')][_0xc2322]),'OpenchannelQueueId':Number(_0x4381ed[_0xa4d1('0x2b')]['id'])});}return _0x18096f;});}})[_0xa4d1('0x17')](respondWithResult(_0x42a0e9,null))['catch'](handleError(_0x42a0e9,null));};exports[_0xa4d1('0x70')]=function(_0x1a72d5,_0x1f192f){return db[_0xa4d1('0x26')][_0xa4d1('0x3c')]({'where':{'id':_0x1a72d5[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x1f192f,null))[_0xa4d1('0x17')](function(_0x2426b2){if(_0x2426b2){return _0x2426b2['removeAgents'](_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')])[_0xa4d1('0x17')](function(){if(_['isArray'](_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')])){for(var _0x3ef8c1=0x0;_0x3ef8c1<_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')][_0xa4d1('0x45')];_0x3ef8c1+=0x1){socket[_0xa4d1('0x5c')](_0xa4d1('0x74'),{'UserId':Number(_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')][_0x3ef8c1]),'OpenchannelQueueId':Number(_0x1a72d5[_0xa4d1('0x2b')]['id'])});}}else{socket[_0xa4d1('0x5c')](_0xa4d1('0x74'),{'UserId':Number(_0x1a72d5[_0xa4d1('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x1a72d5['params']['id'])});}});}})[_0xa4d1('0x17')](respondWithStatusCode(_0x1f192f,null))[_0xa4d1('0x29')](handleError(_0x1f192f,null));};exports[_0xa4d1('0x75')]=function(_0x275688,_0x34b435){var _0x5f12c8={};var _0x14d8fc={};var _0x58484b;var _0x3fc018;return db[_0xa4d1('0x26')][_0xa4d1('0x43')]({'where':{'id':_0x275688[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x34b435,null))[_0xa4d1('0x17')](function(_0x8b058a){if(_0x8b058a){_0x58484b=_0x8b058a;_0x14d8fc[_0xa4d1('0x30')]=_[_0xa4d1('0x2c')](db['User'][_0xa4d1('0x20')]);_0x14d8fc[_0xa4d1('0x2d')]=_[_0xa4d1('0x2c')](_0x275688['query']);_0x14d8fc[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x14d8fc['model'],_0x14d8fc['query']);_0x5f12c8[_0xa4d1('0x32')]=_[_0xa4d1('0x2f')](_0x14d8fc[_0xa4d1('0x30')],qs['fields'](_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x31')]));_0x5f12c8[_0xa4d1('0x32')]=_0x5f12c8[_0xa4d1('0x32')][_0xa4d1('0x45')]?_0x5f12c8['attributes']:_0x14d8fc[_0xa4d1('0x30')];_0x5f12c8[_0xa4d1('0x47')]=qs['sort'](_0x275688['query'][_0xa4d1('0x48')]);_0x5f12c8[_0xa4d1('0x25')]=qs[_0xa4d1('0x2e')](_['pick'](_0x275688[_0xa4d1('0x2d')],_0x14d8fc['filters']));if(_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x4a')]){_0x5f12c8[_0xa4d1('0x25')]=_[_0xa4d1('0x33')](_0x5f12c8['where'],{'$or':_[_0xa4d1('0x1f')](_0x5f12c8[_0xa4d1('0x32')],function(_0x35ed77){var _0x445f18={};_0x445f18[_0x35ed77]={'$like':'%'+_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x4a')]+'%'};return _0x445f18;})});}_0x5f12c8=_[_0xa4d1('0x33')]({},_0x5f12c8,_0x275688[_0xa4d1('0x34')]);return _0x58484b[_0xa4d1('0x75')](_0x5f12c8);}})['then'](function(_0xcf6b26){if(_0xcf6b26){_0x3fc018=_0xcf6b26[_0xa4d1('0x45')];if(!_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x46')](_0xa4d1('0x55'))){_0x5f12c8[_0xa4d1('0x12')]=qs[_0xa4d1('0x12')](_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x12')]);_0x5f12c8[_0xa4d1('0x10')]=qs['offset'](_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x10')]);}return _0x58484b[_0xa4d1('0x75')](_0x5f12c8);}})[_0xa4d1('0x17')](function(_0x5b7e2c){if(_0x5b7e2c){return _0x5b7e2c?{'count':_0x3fc018,'rows':_0x5b7e2c}:null;}})[_0xa4d1('0x17')](respondWithResult(_0x34b435,null))[_0xa4d1('0x29')](handleError(_0x34b435,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 99d1c9f..11b243c 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 _0x46e2=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x3f1f17,_0x11b202){var _0x243871=function(_0x2206cd){while(--_0x2206cd){_0x3f1f17['push'](_0x3f1f17['shift']());}};_0x243871(++_0x11b202);}(_0x46e2,0x114));var _0x246e=function(_0x34d1f1,_0x4dd805){_0x34d1f1=_0x34d1f1-0x0;var _0x2d2109=_0x46e2[_0x34d1f1];return _0x2d2109;};'use strict';var EventEmitter=require(_0x246e('0x0'));var OpenchannelQueue=require(_0x246e('0x1'))['db'][_0x246e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x246e('0x3'),'afterUpdate':'update','afterDestroy':_0x246e('0x4')};function emitEvent(_0x309048){return function(_0x3d0cb1,_0x5ca82a,_0x383e2c){OpenchannelQueueEvents[_0x246e('0x5')](_0x309048+':'+_0x3d0cb1['id'],_0x3d0cb1);OpenchannelQueueEvents['emit'](_0x309048,_0x3d0cb1);_0x383e2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x246e('0x6')](e,emitEvent(event));}}module[_0x246e('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0e14=['hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','emit','hasOwnProperty'];(function(_0x432ddf,_0x2b599f){var _0x2895b8=function(_0x3d77cf){while(--_0x3d77cf){_0x432ddf['push'](_0x432ddf['shift']());}};_0x2895b8(++_0x2b599f);}(_0x0e14,0x119));var _0x40e1=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x0e14[_0xf71120];return _0xbe2fd3;};'use strict';var EventEmitter=require(_0x40e1('0x0'));var OpenchannelQueue=require(_0x40e1('0x1'))['db'][_0x40e1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x40e1('0x3'),'afterUpdate':_0x40e1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x30e516){return function(_0x38c58c,_0x127ea5,_0x46fc20){OpenchannelQueueEvents['emit'](_0x30e516+':'+_0x38c58c['id'],_0x38c58c);OpenchannelQueueEvents[_0x40e1('0x5')](_0x30e516,_0x38c58c);_0x46fc20(null);};}for(var e in events){if(events[_0x40e1('0x6')](e)){var event=events[e];OpenchannelQueue[_0x40e1('0x7')](e,emitEvent(event));}}module[_0x40e1('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9861a03..5d5ac2e 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 _0xdf46=['define','openchannel_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x35f910,_0x1eeaf3){var _0x27d878=function(_0x20bdec){while(--_0x20bdec){_0x35f910['push'](_0x35f910['shift']());}};_0x27d878(++_0x1eeaf3);}(_0xdf46,0x1e6));var _0x6df4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdf46[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x6df4('0x0'));var logger=require(_0x6df4('0x1'))('api');var moment=require(_0x6df4('0x2'));var BPromise=require(_0x6df4('0x3'));var rp=require(_0x6df4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6df4('0x5'));var config=require(_0x6df4('0x6'));var attributes=require(_0x6df4('0x7'));module[_0x6df4('0x8')]=function(_0x36bd19,_0x2ec5d3){return _0x36bd19[_0x6df4('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x6df4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x151c=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','openchannel_queues','util'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0x151c,0xf9));var _0xc151=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x151c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc151('0x0'));var logger=require(_0xc151('0x1'))(_0xc151('0x2'));var moment=require('moment');var BPromise=require(_0xc151('0x3'));var rp=require(_0xc151('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc151('0x5'));var config=require(_0xc151('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xc151('0x7')]=function(_0x4d8655,_0x10b218){return _0x4d8655[_0xc151('0x8')]('OpenchannelQueue',attributes,{'tableName':_0xc151('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 5e3b751..c349885 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 _0x1f22=['result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes','ShowOpenchannelQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5a7c8d,_0xbd9fad){var _0x99b50=function(_0x8c2ee5){while(--_0x8c2ee5){_0x5a7c8d['push'](_0x5a7c8d['shift']());}};_0x99b50(++_0xbd9fad);}(_0x1f22,0x18a));var _0x21f2=function(_0x5915a5,_0x4d29bb){_0x5915a5=_0x5915a5-0x0;var _0x100a75=_0x1f22[_0x5915a5];return _0x100a75;};'use strict';var _=require('lodash');var util=require(_0x21f2('0x0'));var moment=require(_0x21f2('0x1'));var BPromise=require(_0x21f2('0x2'));var rs=require(_0x21f2('0x3'));var fs=require('fs');var Redis=require(_0x21f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x21f2('0x5'));var logger=require(_0x21f2('0x6'))('rpc');var config=require(_0x21f2('0x7'));var jayson=require(_0x21f2('0x8'));var client=jayson[_0x21f2('0x9')]['http']({'port':0x232a});config[_0x21f2('0xa')]=_[_0x21f2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x21f2('0xc'))(new Redis(config[_0x21f2('0xa')]));require(_0x21f2('0xd'))[_0x21f2('0xe')](socket);function respondWithRpcPromise(_0x1f2e0d,_0x532c0a,_0x46e0e2){return new BPromise(function(_0x57a50a,_0x3b854f){return client['request'](_0x1f2e0d,_0x46e0e2)[_0x21f2('0xf')](function(_0x21bb2e){logger[_0x21f2('0x10')](_0x21f2('0x11'),_0x532c0a,'request\x20sent');logger['debug'](_0x21f2('0x12'),_0x532c0a,_0x21f2('0x13'),JSON[_0x21f2('0x14')](_0x21bb2e));if(_0x21bb2e[_0x21f2('0x15')]){if(_0x21bb2e[_0x21f2('0x15')][_0x21f2('0x16')]===0x1f4){logger[_0x21f2('0x15')](_0x21f2('0x11'),_0x532c0a,_0x21bb2e['error'][_0x21f2('0x17')]);return _0x3b854f(_0x21bb2e[_0x21f2('0x15')]['message']);}logger[_0x21f2('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x532c0a,_0x21bb2e[_0x21f2('0x15')][_0x21f2('0x17')]);return _0x57a50a(_0x21bb2e[_0x21f2('0x15')][_0x21f2('0x17')]);}else{logger[_0x21f2('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x532c0a,_0x21f2('0x13'));_0x57a50a(_0x21bb2e[_0x21f2('0x18')]['message']);}})[_0x21f2('0x19')](function(_0x28dfa8){logger[_0x21f2('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x532c0a,_0x28dfa8);_0x3b854f(_0x28dfa8);});});}exports[_0x21f2('0x1a')]=function(_0x565fa1){var _0x3d6585=this;return new Promise(function(_0x51a457,_0x1f494f){return db[_0x21f2('0x1b')]['findAll']({'raw':_0x565fa1['options']?_0x565fa1[_0x21f2('0x1c')][_0x21f2('0x1d')]===undefined?!![]:![]:!![],'where':_0x565fa1[_0x21f2('0x1c')]?_0x565fa1[_0x21f2('0x1c')][_0x21f2('0x1e')]||null:null,'attributes':_0x565fa1[_0x21f2('0x1c')]?_0x565fa1[_0x21f2('0x1c')]['attributes']||null:null,'limit':_0x565fa1['options']?_0x565fa1[_0x21f2('0x1c')][_0x21f2('0x1f')]||null:null,'include':_0x565fa1['options']?_0x565fa1['options'][_0x21f2('0x20')]?_[_0x21f2('0x21')](_0x565fa1[_0x21f2('0x1c')][_0x21f2('0x20')],function(_0x473304){return{'model':db[_0x473304[_0x21f2('0x22')]],'as':_0x473304['as'],'attributes':_0x473304[_0x21f2('0x23')],'include':_0x473304[_0x21f2('0x20')]?_[_0x21f2('0x21')](_0x473304[_0x21f2('0x20')],function(_0x4c5ade){return{'model':db[_0x4c5ade[_0x21f2('0x22')]],'as':_0x4c5ade['as'],'attributes':_0x4c5ade[_0x21f2('0x23')],'include':_0x4c5ade['include']?_[_0x21f2('0x21')](_0x4c5ade[_0x21f2('0x20')],function(_0x4c3462){return{'model':db[_0x4c3462[_0x21f2('0x22')]],'as':_0x4c3462['as'],'attributes':_0x4c3462[_0x21f2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x21f2('0xf')](function(_0x3aae0a){logger[_0x21f2('0x10')](_0x21f2('0x1a'),_0x565fa1);logger['debug']('GetOpenchannelQueue',_0x565fa1,JSON['stringify'](_0x3aae0a));_0x51a457(_0x3aae0a);})[_0x21f2('0x19')](function(_0x47f7bb){logger[_0x21f2('0x15')](_0x21f2('0x1a'),_0x47f7bb['message'],_0x565fa1);_0x1f494f(_0x3d6585[_0x21f2('0x15')](0x1f4,_0x47f7bb[_0x21f2('0x17')]));});});};exports[_0x21f2('0x24')]=function(_0x497e62){var _0x5d9950=this;return new Promise(function(_0x2a2a2a,_0x35cd8b){return db[_0x21f2('0x1b')][_0x21f2('0x25')]({'raw':_0x497e62[_0x21f2('0x1c')]?_0x497e62[_0x21f2('0x1c')][_0x21f2('0x1d')]===undefined?!![]:![]:!![],'where':_0x497e62['options']?_0x497e62[_0x21f2('0x1c')][_0x21f2('0x1e')]||null:null,'attributes':_0x497e62['options']?_0x497e62[_0x21f2('0x1c')][_0x21f2('0x23')]||null:null,'include':_0x497e62['options']?_0x497e62[_0x21f2('0x1c')][_0x21f2('0x20')]?_[_0x21f2('0x21')](_0x497e62[_0x21f2('0x1c')][_0x21f2('0x20')],function(_0x4089a3){return{'model':db[_0x4089a3[_0x21f2('0x22')]],'as':_0x4089a3['as'],'attributes':_0x4089a3[_0x21f2('0x23')],'include':_0x4089a3[_0x21f2('0x20')]?_[_0x21f2('0x21')](_0x4089a3[_0x21f2('0x20')],function(_0x43fc54){return{'model':db[_0x43fc54[_0x21f2('0x22')]],'as':_0x43fc54['as'],'attributes':_0x43fc54[_0x21f2('0x23')],'include':_0x43fc54['include']?_[_0x21f2('0x21')](_0x43fc54[_0x21f2('0x20')],function(_0x321c82){return{'model':db[_0x321c82['model']],'as':_0x321c82['as'],'attributes':_0x321c82[_0x21f2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x21f2('0xf')](function(_0x187a7a){logger[_0x21f2('0x10')](_0x21f2('0x24'),_0x497e62);logger['debug']('ShowOpenchannelQueue',_0x497e62,JSON[_0x21f2('0x14')](_0x187a7a));_0x2a2a2a(_0x187a7a);})[_0x21f2('0x19')](function(_0xa07f8d){logger[_0x21f2('0x15')](_0x21f2('0x24'),_0xa07f8d[_0x21f2('0x17')],_0x497e62);_0x35cd8b(_0x5d9950[_0x21f2('0x15')](0x1f4,_0xa07f8d['message']));});});}; \ No newline at end of file +var _0x3fbd=['then','debug','ShowOpenchannelQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model'];(function(_0x4801a0,_0x252c24){var _0x338e26=function(_0x1599c2){while(--_0x1599c2){_0x4801a0['push'](_0x4801a0['shift']());}};_0x338e26(++_0x252c24);}(_0x3fbd,0xf5));var _0xd3fb=function(_0xfb7c03,_0x426640){_0xfb7c03=_0xfb7c03-0x0;var _0x8324d5=_0x3fbd[_0xfb7c03];return _0x8324d5;};'use strict';var _=require(_0xd3fb('0x0'));var util=require(_0xd3fb('0x1'));var moment=require(_0xd3fb('0x2'));var BPromise=require(_0xd3fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3fb('0x4'));var db=require(_0xd3fb('0x5'))['db'];var utils=require(_0xd3fb('0x6'));var logger=require('../../config/logger')(_0xd3fb('0x7'));var config=require(_0xd3fb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3fb('0x9')]({'port':0x232a});config['redis']=_[_0xd3fb('0xa')](config[_0xd3fb('0xb')],{'host':_0xd3fb('0xc'),'port':0x18eb});var socket=require(_0xd3fb('0xd'))(new Redis(config[_0xd3fb('0xb')]));require(_0xd3fb('0xe'))[_0xd3fb('0xf')](socket);function respondWithRpcPromise(_0x4c2602,_0x4bf6e4,_0x324b00){return new BPromise(function(_0x3246fb,_0xaf9c19){return client['request'](_0x4c2602,_0x324b00)['then'](function(_0x528489){logger[_0xd3fb('0x10')](_0xd3fb('0x11'),_0x4bf6e4,_0xd3fb('0x12'));logger['debug'](_0xd3fb('0x13'),_0x4bf6e4,_0xd3fb('0x12'),JSON[_0xd3fb('0x14')](_0x528489));if(_0x528489[_0xd3fb('0x15')]){if(_0x528489['error'][_0xd3fb('0x16')]===0x1f4){logger[_0xd3fb('0x15')](_0xd3fb('0x11'),_0x4bf6e4,_0x528489['error'][_0xd3fb('0x17')]);return _0xaf9c19(_0x528489[_0xd3fb('0x15')][_0xd3fb('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4bf6e4,_0x528489[_0xd3fb('0x15')][_0xd3fb('0x17')]);return _0x3246fb(_0x528489[_0xd3fb('0x15')][_0xd3fb('0x17')]);}else{logger[_0xd3fb('0x10')](_0xd3fb('0x11'),_0x4bf6e4,_0xd3fb('0x12'));_0x3246fb(_0x528489[_0xd3fb('0x18')][_0xd3fb('0x17')]);}})[_0xd3fb('0x19')](function(_0x10934a){logger[_0xd3fb('0x15')](_0xd3fb('0x11'),_0x4bf6e4,_0x10934a);_0xaf9c19(_0x10934a);});});}exports[_0xd3fb('0x1a')]=function(_0x197483){var _0x3ae4e0=this;return new Promise(function(_0x330116,_0x299375){return db[_0xd3fb('0x1b')]['findAll']({'raw':_0x197483['options']?_0x197483[_0xd3fb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x197483[_0xd3fb('0x1c')]?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x1d')]||null:null,'attributes':_0x197483[_0xd3fb('0x1c')]?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x1e')]||null:null,'limit':_0x197483['options']?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x1f')]||null:null,'include':_0x197483[_0xd3fb('0x1c')]?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x197483[_0xd3fb('0x1c')]['include'],function(_0x2bbe38){return{'model':db[_0x2bbe38[_0xd3fb('0x22')]],'as':_0x2bbe38['as'],'attributes':_0x2bbe38[_0xd3fb('0x1e')],'include':_0x2bbe38[_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x2bbe38[_0xd3fb('0x20')],function(_0x34be6b){return{'model':db[_0x34be6b[_0xd3fb('0x22')]],'as':_0x34be6b['as'],'attributes':_0x34be6b[_0xd3fb('0x1e')],'include':_0x34be6b[_0xd3fb('0x20')]?_['map'](_0x34be6b[_0xd3fb('0x20')],function(_0x402f0b){return{'model':db[_0x402f0b[_0xd3fb('0x22')]],'as':_0x402f0b['as'],'attributes':_0x402f0b[_0xd3fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3fb('0x23')](function(_0x1dc531){logger[_0xd3fb('0x10')]('GetOpenchannelQueue',_0x197483);logger[_0xd3fb('0x24')]('GetOpenchannelQueue',_0x197483,JSON['stringify'](_0x1dc531));_0x330116(_0x1dc531);})['catch'](function(_0x483602){logger[_0xd3fb('0x15')]('GetOpenchannelQueue',_0x483602[_0xd3fb('0x17')],_0x197483);_0x299375(_0x3ae4e0['error'](0x1f4,_0x483602[_0xd3fb('0x17')]));});});};exports[_0xd3fb('0x25')]=function(_0xbe0022){var _0x4fa863=this;return new Promise(function(_0xf25c74,_0x39c1a7){return db[_0xd3fb('0x1b')][_0xd3fb('0x26')]({'raw':_0xbe0022['options']?_0xbe0022[_0xd3fb('0x1c')][_0xd3fb('0x27')]===undefined?!![]:![]:!![],'where':_0xbe0022['options']?_0xbe0022[_0xd3fb('0x1c')][_0xd3fb('0x1d')]||null:null,'attributes':_0xbe0022[_0xd3fb('0x1c')]?_0xbe0022['options'][_0xd3fb('0x1e')]||null:null,'include':_0xbe0022[_0xd3fb('0x1c')]?_0xbe0022[_0xd3fb('0x1c')][_0xd3fb('0x20')]?_['map'](_0xbe0022['options']['include'],function(_0x640f75){return{'model':db[_0x640f75[_0xd3fb('0x22')]],'as':_0x640f75['as'],'attributes':_0x640f75['attributes'],'include':_0x640f75[_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x640f75[_0xd3fb('0x20')],function(_0x3ff51f){return{'model':db[_0x3ff51f[_0xd3fb('0x22')]],'as':_0x3ff51f['as'],'attributes':_0x3ff51f[_0xd3fb('0x1e')],'include':_0x3ff51f[_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x3ff51f[_0xd3fb('0x20')],function(_0x4a7cc9){return{'model':db[_0x4a7cc9[_0xd3fb('0x22')]],'as':_0x4a7cc9['as'],'attributes':_0x4a7cc9[_0xd3fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3fb('0x23')](function(_0x3cfc0b){logger[_0xd3fb('0x10')]('ShowOpenchannelQueue',_0xbe0022);logger[_0xd3fb('0x24')](_0xd3fb('0x25'),_0xbe0022,JSON[_0xd3fb('0x14')](_0x3cfc0b));_0xf25c74(_0x3cfc0b);})[_0xd3fb('0x19')](function(_0x388bb7){logger['error'](_0xd3fb('0x25'),_0x388bb7[_0xd3fb('0x17')],_0xbe0022);_0x39c1a7(_0x4fa863['error'](0x1f4,_0x388bb7[_0xd3fb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f22c1b9..31854db 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 _0xe8b4=['save','remove','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0xad59ed,_0x4d89ce){var _0x269ee0=function(_0x24b53c){while(--_0x24b53c){_0xad59ed['push'](_0xad59ed['shift']());}};_0x269ee0(++_0x4d89ce);}(_0xe8b4,0x187));var _0x4e8b=function(_0x181a15,_0x438f66){_0x181a15=_0x181a15-0x0;var _0x4513a3=_0xe8b4[_0x181a15];return _0x4513a3;};'use strict';var OpenchannelQueueEvents=require(_0x4e8b('0x0'));var events=[_0x4e8b('0x1'),_0x4e8b('0x2'),'update'];function createListener(_0x595cb1,_0x319b12){return function(_0xdc8b4e){_0x319b12[_0x4e8b('0x3')](_0x595cb1,_0xdc8b4e);};}function removeListener(_0x38b378,_0x253587){return function(){OpenchannelQueueEvents[_0x4e8b('0x4')](_0x38b378,_0x253587);};}exports[_0x4e8b('0x5')]=function(_0x3d7934){for(var _0x5d1265=0x0,_0x341a4a=events[_0x4e8b('0x6')];_0x5d1265<_0x341a4a;_0x5d1265++){var _0x2ac506=events[_0x5d1265];var _0x58beb5=createListener(_0x4e8b('0x7')+_0x2ac506,_0x3d7934);OpenchannelQueueEvents['on'](_0x2ac506,_0x58beb5);}}; \ No newline at end of file +var _0x0b76=['./openchannelQueue.events','save','remove','update','removeListener','register','length'];(function(_0x260da4,_0x28125){var _0x1b031a=function(_0x171622){while(--_0x171622){_0x260da4['push'](_0x260da4['shift']());}};_0x1b031a(++_0x28125);}(_0x0b76,0x77));var _0x60b7=function(_0x2e536f,_0x3190be){_0x2e536f=_0x2e536f-0x0;var _0x156b71=_0x0b76[_0x2e536f];return _0x156b71;};'use strict';var OpenchannelQueueEvents=require(_0x60b7('0x0'));var events=[_0x60b7('0x1'),_0x60b7('0x2'),_0x60b7('0x3')];function createListener(_0x2c68db,_0x43bc6a){return function(_0x62618e){_0x43bc6a['emit'](_0x2c68db,_0x62618e);};}function removeListener(_0x248583,_0x409578){return function(){OpenchannelQueueEvents[_0x60b7('0x4')](_0x248583,_0x409578);};}exports[_0x60b7('0x5')]=function(_0x1b4a82){for(var _0x2397fa=0x0,_0x13dff8=events[_0x60b7('0x6')];_0x2397fa<_0x13dff8;_0x2397fa++){var _0x252362=events[_0x2397fa];var _0x1e8896=createListener('openchannelQueue:'+_0x252362,_0x1b4a82);OpenchannelQueueEvents['on'](_0x252362,_0x1e8896);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index eec17b1..d15e9ad 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 _0x1623=['/describe','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','isAuthenticated','index'];(function(_0x39f927,_0x33c6ce){var _0x55d445=function(_0x3ca236){while(--_0x3ca236){_0x39f927['push'](_0x39f927['shift']());}};_0x55d445(++_0x33c6ce);}(_0x1623,0xab));var _0x3162=function(_0x4cc2a8,_0x282c02){_0x4cc2a8=_0x4cc2a8-0x0;var _0x29dc2b=_0x1623[_0x4cc2a8];return _0x29dc2b;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0xf')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0x11')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);module[_0x3162('0x13')]=router; \ No newline at end of file +var _0xd421=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x2881ce,_0x410186){var _0x3c6fb3=function(_0x5174a4){while(--_0x5174a4){_0x2881ce['push'](_0x2881ce['shift']());}};_0x3c6fb3(++_0x410186);}(_0xd421,0x10a));var _0x1d42=function(_0x2d1386,_0x47a6c0){_0x2d1386=_0x2d1386-0x0;var _0x253c8e=_0xd421[_0x2d1386];return _0x253c8e;};'use strict';var multer=require(_0x1d42('0x0'));var util=require(_0x1d42('0x1'));var path=require('path');var timeout=require(_0x1d42('0x2'));var express=require(_0x1d42('0x3'));var router=express[_0x1d42('0x4')]();var fs_extra=require(_0x1d42('0x5'));var auth=require(_0x1d42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d42('0x7'));var controller=require(_0x1d42('0x8'));router['get']('/',auth[_0x1d42('0x9')](),controller[_0x1d42('0xa')]);router[_0x1d42('0xb')](_0x1d42('0xc'),auth[_0x1d42('0x9')](),controller[_0x1d42('0xd')]);router[_0x1d42('0xb')](_0x1d42('0xe'),auth['isAuthenticated'](),controller[_0x1d42('0xf')]);router[_0x1d42('0x10')]('/',auth[_0x1d42('0x9')](),controller[_0x1d42('0x11')]);router[_0x1d42('0x12')](_0x1d42('0xe'),auth[_0x1d42('0x9')](),controller['update']);router[_0x1d42('0x13')](_0x1d42('0xe'),auth[_0x1d42('0x9')](),controller[_0x1d42('0x14')]);module[_0x1d42('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 848f126..4a0771a 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 _0xbfac=['STRING','DATE','sequelize','exports'];(function(_0x1fd1b4,_0x13dfcb){var _0x2fe681=function(_0x2a0fdd){while(--_0x2a0fdd){_0x1fd1b4['push'](_0x1fd1b4['shift']());}};_0x2fe681(++_0x13dfcb);}(_0xbfac,0x86));var _0xcbfa=function(_0x3a7cd4,_0x3e8374){_0x3a7cd4=_0x3a7cd4-0x0;var _0x58bb88=_0xbfac[_0x3a7cd4];return _0x58bb88;};'use strict';var moment=require('moment');var Sequelize=require(_0xcbfa('0x0'));module[_0xcbfa('0x1')]={'uniqueid':{'type':Sequelize[_0xcbfa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcbfa('0x2')]},'joinAt':{'type':Sequelize[_0xcbfa('0x3')]},'leaveAt':{'type':Sequelize[_0xcbfa('0x3')]},'acceptAt':{'type':Sequelize[_0xcbfa('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcbfa('0x2')]}}; \ No newline at end of file +var _0x4677=['DATE','moment','sequelize','exports','STRING'];(function(_0x1c3169,_0x180ec1){var _0x1116c9=function(_0x46c425){while(--_0x46c425){_0x1c3169['push'](_0x1c3169['shift']());}};_0x1116c9(++_0x180ec1);}(_0x4677,0x105));var _0x7467=function(_0x1d85c3,_0x45771d){_0x1d85c3=_0x1d85c3-0x0;var _0x10598a=_0x4677[_0x1d85c3];return _0x10598a;};'use strict';var moment=require(_0x7467('0x0'));var Sequelize=require(_0x7467('0x1'));module[_0x7467('0x2')]={'uniqueid':{'type':Sequelize[_0x7467('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7467('0x3')]},'joinAt':{'type':Sequelize[_0x7467('0x4')]},'leaveAt':{'type':Sequelize[_0x7467('0x4')]},'acceptAt':{'type':Sequelize[_0x7467('0x4')]},'exitAt':{'type':Sequelize[_0x7467('0x4')]},'reason':{'type':Sequelize[_0x7467('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3165f33..c978048 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 _0x0f8e=['count','limit','set','apply','reject','update','destroy','then','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','findAll','rows','show','include','options','find','catch','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x373a0d,_0x57f241){var _0x295c01=function(_0x1943bd){while(--_0x1943bd){_0x373a0d['push'](_0x373a0d['shift']());}};_0x295c01(++_0x57f241);}(_0x0f8e,0x106));var _0xe0f8=function(_0x1e9992,_0x24a7db){_0x1e9992=_0x1e9992-0x0;var _0x4204e2=_0x0f8e[_0x1e9992];return _0x4204e2;};'use strict';var emlformat=require(_0xe0f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe0f8('0x1'));var rp=require(_0xe0f8('0x2'));var moment=require(_0xe0f8('0x3'));var BPromise=require(_0xe0f8('0x4'));var Mustache=require(_0xe0f8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe0f8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0f8('0x7'));var squel=require('squel');var crypto=require(_0xe0f8('0x8'));var jsforce=require(_0xe0f8('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe0f8('0xa'));var Papa=require('papaparse');var Redis=require(_0xe0f8('0xb'));var authService=require(_0xe0f8('0xc'));var qs=require(_0xe0f8('0xd'));var as=require(_0xe0f8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0f8('0xf'))(_0xe0f8('0x10'));var utils=require(_0xe0f8('0x11'));var config=require(_0xe0f8('0x12'));var licenseUtil=require(_0xe0f8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333751,_0x1e308a){_0x1e308a=_0x1e308a||0xcc;return function(_0x3b8f2c){if(_0x3b8f2c){return _0x333751[_0xe0f8('0x14')](_0x1e308a);}return _0x333751[_0xe0f8('0x15')](_0x1e308a)[_0xe0f8('0x16')]();};}function respondWithResult(_0x1b2d16,_0x1e8a6f){_0x1e8a6f=_0x1e8a6f||0xc8;return function(_0x2695e6){if(_0x2695e6){return _0x1b2d16['status'](_0x1e8a6f)[_0xe0f8('0x17')](_0x2695e6);}};}function respondWithFilteredResult(_0x259fa5,_0x3df178){return function(_0x15889d){if(_0x15889d){var _0xb515da=typeof _0x3df178[_0xe0f8('0x18')]===_0xe0f8('0x19')&&typeof _0x3df178['limit']===_0xe0f8('0x19');var _0x718d30=_0x15889d[_0xe0f8('0x1a')];var _0x3d15d5=_0xb515da?0x0:_0x3df178['offset'];var _0x4d1d04=_0xb515da?_0x15889d[_0xe0f8('0x1a')]:_0x3df178[_0xe0f8('0x18')]+_0x3df178[_0xe0f8('0x1b')];var _0x29fefc;if(_0x4d1d04>=_0x718d30){_0x4d1d04=_0x718d30;_0x29fefc=0xc8;}else{_0x29fefc=0xce;}_0x259fa5[_0xe0f8('0x15')](_0x29fefc);return _0x259fa5[_0xe0f8('0x1c')]('Content-Range',_0x3d15d5+'-'+_0x4d1d04+'/'+_0x718d30)['json'](_0x15889d);}return null;};}function patchUpdates(_0x2f4377){return function(_0x4dd857){try{jsonpatch[_0xe0f8('0x1d')](_0x4dd857,_0x2f4377,!![]);}catch(_0xb05b8e){return BPromise[_0xe0f8('0x1e')](_0xb05b8e);}return _0x4dd857['save']();};}function saveUpdates(_0x483a69,_0x1cc032){return function(_0x513103){if(_0x513103){return _0x513103[_0xe0f8('0x1f')](_0x483a69)['then'](function(_0x3fec2c){return _0x3fec2c;});}return null;};}function removeEntity(_0x27cc03,_0x4f0299){return function(_0x56ecf9){if(_0x56ecf9){return _0x56ecf9[_0xe0f8('0x20')]()[_0xe0f8('0x21')](function(){_0x27cc03[_0xe0f8('0x15')](0xcc)[_0xe0f8('0x16')]();});}};}function handleEntityNotFound(_0x2e6b71,_0x4962f6){return function(_0x3783e1){if(!_0x3783e1){_0x2e6b71[_0xe0f8('0x14')](0x194);}return _0x3783e1;};}function handleError(_0x2fe699,_0x27bc21){_0x27bc21=_0x27bc21||0x1f4;return function(_0x6b78f7){logger[_0xe0f8('0x22')](_0x6b78f7[_0xe0f8('0x23')]);if(_0x6b78f7['name']){delete _0x6b78f7[_0xe0f8('0x24')];}_0x2fe699[_0xe0f8('0x15')](_0x27bc21)['send'](_0x6b78f7);};}exports[_0xe0f8('0x25')]=function(_0x45697f,_0x5b1b04){var _0x20d5ba={},_0xb13381={},_0x44f1e4={'count':0x0,'rows':[]};var _0x57048c=_[_0xe0f8('0x26')](db[_0xe0f8('0x27')][_0xe0f8('0x28')],function(_0x450f34){return{'name':_0x450f34['fieldName'],'type':_0x450f34[_0xe0f8('0x29')][_0xe0f8('0x2a')]};});_0xb13381['model']=_[_0xe0f8('0x26')](_0x57048c,'name');_0xb13381[_0xe0f8('0x2b')]=_[_0xe0f8('0x2c')](_0x45697f['query']);_0xb13381['filters']=_[_0xe0f8('0x2d')](_0xb13381[_0xe0f8('0x2e')],_0xb13381[_0xe0f8('0x2b')]);_0x20d5ba['attributes']=_[_0xe0f8('0x2d')](_0xb13381[_0xe0f8('0x2e')],qs[_0xe0f8('0x2f')](_0x45697f[_0xe0f8('0x2b')][_0xe0f8('0x2f')]));_0x20d5ba['attributes']=_0x20d5ba[_0xe0f8('0x30')][_0xe0f8('0x31')]?_0x20d5ba['attributes']:_0xb13381['model'];if(!_0x45697f['query'][_0xe0f8('0x32')](_0xe0f8('0x33'))){_0x20d5ba['limit']=qs[_0xe0f8('0x1b')](_0x45697f[_0xe0f8('0x2b')]['limit']);_0x20d5ba[_0xe0f8('0x18')]=qs['offset'](_0x45697f[_0xe0f8('0x2b')]['offset']);}_0x20d5ba[_0xe0f8('0x34')]=qs['sort'](_0x45697f[_0xe0f8('0x2b')][_0xe0f8('0x35')]);_0x20d5ba[_0xe0f8('0x36')]=qs['filters'](_[_0xe0f8('0x37')](_0x45697f[_0xe0f8('0x2b')],_0xb13381[_0xe0f8('0x38')]),_0x57048c);if(_0x45697f['query'][_0xe0f8('0x39')]){_0x20d5ba['where']=_['merge'](_0x20d5ba['where'],{'$or':_[_0xe0f8('0x26')](_0x57048c,function(_0x2e7499){if(_0x2e7499[_0xe0f8('0x29')]!==_0xe0f8('0x3a')){var _0x41dcbe={};_0x41dcbe[_0x2e7499[_0xe0f8('0x24')]]={'$like':'%'+_0x45697f[_0xe0f8('0x2b')][_0xe0f8('0x39')]+'%'};return _0x41dcbe;}})});}_0x20d5ba=_[_0xe0f8('0x3b')]({},_0x20d5ba,_0x45697f['options']);var _0x4cbc45={'where':_0x20d5ba['where']};return db[_0xe0f8('0x27')][_0xe0f8('0x1a')](_0x4cbc45)[_0xe0f8('0x21')](function(_0x36433f){_0x44f1e4['count']=_0x36433f;if(_0x45697f[_0xe0f8('0x2b')][_0xe0f8('0x3c')]){_0x20d5ba['include']=[{'all':!![]}];}return db[_0xe0f8('0x27')][_0xe0f8('0x3d')](_0x20d5ba);})[_0xe0f8('0x21')](function(_0x4bcf93){_0x44f1e4[_0xe0f8('0x3e')]=_0x4bcf93;return _0x44f1e4;})[_0xe0f8('0x21')](respondWithFilteredResult(_0x5b1b04,_0x20d5ba))['catch'](handleError(_0x5b1b04,null));};exports[_0xe0f8('0x3f')]=function(_0x2a6995,_0x59a9c1){var _0x39161b={'raw':!![],'where':{'id':_0x2a6995['params']['id']}},_0x46810e={};_0x46810e[_0xe0f8('0x2e')]=_[_0xe0f8('0x2c')](db[_0xe0f8('0x27')][_0xe0f8('0x28')]);_0x46810e['query']=_[_0xe0f8('0x2c')](_0x2a6995['query']);_0x46810e['filters']=_[_0xe0f8('0x2d')](_0x46810e[_0xe0f8('0x2e')],_0x46810e[_0xe0f8('0x2b')]);_0x39161b[_0xe0f8('0x30')]=_[_0xe0f8('0x2d')](_0x46810e['model'],qs[_0xe0f8('0x2f')](_0x2a6995[_0xe0f8('0x2b')]['fields']));_0x39161b[_0xe0f8('0x30')]=_0x39161b[_0xe0f8('0x30')][_0xe0f8('0x31')]?_0x39161b[_0xe0f8('0x30')]:_0x46810e[_0xe0f8('0x2e')];if(_0x2a6995[_0xe0f8('0x2b')][_0xe0f8('0x3c')]){_0x39161b[_0xe0f8('0x40')]=[{'all':!![]}];}_0x39161b=_['merge']({},_0x39161b,_0x2a6995[_0xe0f8('0x41')]);return db[_0xe0f8('0x27')][_0xe0f8('0x42')](_0x39161b)[_0xe0f8('0x21')](handleEntityNotFound(_0x59a9c1,null))['then'](respondWithResult(_0x59a9c1,null))[_0xe0f8('0x43')](handleError(_0x59a9c1,null));};exports[_0xe0f8('0x44')]=function(_0x4f54b4,_0x2ed87e){return db[_0xe0f8('0x27')][_0xe0f8('0x44')](_0x4f54b4[_0xe0f8('0x45')],{})[_0xe0f8('0x21')](respondWithResult(_0x2ed87e,0xc9))[_0xe0f8('0x43')](handleError(_0x2ed87e,null));};exports['update']=function(_0x2c8685,_0x121af0){if(_0x2c8685['body']['id']){delete _0x2c8685[_0xe0f8('0x45')]['id'];}return db[_0xe0f8('0x27')]['find']({'where':{'id':_0x2c8685[_0xe0f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x121af0,null))[_0xe0f8('0x21')](saveUpdates(_0x2c8685[_0xe0f8('0x45')],null))[_0xe0f8('0x21')](respondWithResult(_0x121af0,null))[_0xe0f8('0x43')](handleError(_0x121af0,null));};exports[_0xe0f8('0x20')]=function(_0x2fd757,_0x577804){return db[_0xe0f8('0x27')][_0xe0f8('0x42')]({'where':{'id':_0x2fd757['params']['id']}})[_0xe0f8('0x21')](handleEntityNotFound(_0x577804,null))[_0xe0f8('0x21')](removeEntity(_0x577804,null))[_0xe0f8('0x43')](handleError(_0x577804,null));};exports[_0xe0f8('0x47')]=function(_0x350dc5,_0x123a7e){return db['OpenchannelQueueReport'][_0xe0f8('0x47')]()[_0xe0f8('0x21')](respondWithResult(_0x123a7e,null))[_0xe0f8('0x43')](handleError(_0x123a7e,null));}; \ No newline at end of file +var _0x1e2d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x28e424,_0x4d6508){var _0x25ab59=function(_0x3ff7b4){while(--_0x3ff7b4){_0x28e424['push'](_0x28e424['shift']());}};_0x25ab59(++_0x4d6508);}(_0x1e2d,0x10b));var _0xd1e2=function(_0x2a2c50,_0x3f863e){_0x2a2c50=_0x2a2c50-0x0;var _0x11457a=_0x1e2d[_0x2a2c50];return _0x11457a;};'use strict';var emlformat=require(_0xd1e2('0x0'));var rimraf=require(_0xd1e2('0x1'));var zipdir=require(_0xd1e2('0x2'));var jsonpatch=require(_0xd1e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd1e2('0x4'));var Mustache=require(_0xd1e2('0x5'));var util=require(_0xd1e2('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(_0xd1e2('0x7'));var _=require(_0xd1e2('0x8'));var squel=require(_0xd1e2('0x9'));var crypto=require('crypto');var jsforce=require(_0xd1e2('0xa'));var deskjs=require(_0xd1e2('0xb'));var toCsv=require(_0xd1e2('0xc'));var querystring=require(_0xd1e2('0xd'));var Papa=require(_0xd1e2('0xe'));var Redis=require(_0xd1e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd1e2('0x10'));var as=require(_0xd1e2('0x11'));var hardwareService=require(_0xd1e2('0x12'));var logger=require('../../config/logger')(_0xd1e2('0x13'));var utils=require('../../config/utils');var config=require(_0xd1e2('0x14'));var licenseUtil=require(_0xd1e2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3a5fa,_0x18cb2c){_0x18cb2c=_0x18cb2c||0xcc;return function(_0x310c2e){if(_0x310c2e){return _0xb3a5fa[_0xd1e2('0x16')](_0x18cb2c);}return _0xb3a5fa[_0xd1e2('0x17')](_0x18cb2c)['end']();};}function respondWithResult(_0x1606b4,_0x398a02){_0x398a02=_0x398a02||0xc8;return function(_0x2bba29){if(_0x2bba29){return _0x1606b4[_0xd1e2('0x17')](_0x398a02)[_0xd1e2('0x18')](_0x2bba29);}};}function respondWithFilteredResult(_0x4e95b5,_0x2cc911){return function(_0x4df0c4){if(_0x4df0c4){var _0xbb7cab=typeof _0x2cc911[_0xd1e2('0x19')]===_0xd1e2('0x1a')&&typeof _0x2cc911[_0xd1e2('0x1b')]===_0xd1e2('0x1a');var _0x2cedad=_0x4df0c4[_0xd1e2('0x1c')];var _0x59af72=_0xbb7cab?0x0:_0x2cc911[_0xd1e2('0x19')];var _0x32db44=_0xbb7cab?_0x4df0c4['count']:_0x2cc911[_0xd1e2('0x19')]+_0x2cc911['limit'];var _0x82f642;if(_0x32db44>=_0x2cedad){_0x32db44=_0x2cedad;_0x82f642=0xc8;}else{_0x82f642=0xce;}_0x4e95b5[_0xd1e2('0x17')](_0x82f642);return _0x4e95b5[_0xd1e2('0x1d')]('Content-Range',_0x59af72+'-'+_0x32db44+'/'+_0x2cedad)['json'](_0x4df0c4);}return null;};}function patchUpdates(_0x3de61f){return function(_0x4990f6){try{jsonpatch[_0xd1e2('0x1e')](_0x4990f6,_0x3de61f,!![]);}catch(_0x1dc8b9){return BPromise[_0xd1e2('0x1f')](_0x1dc8b9);}return _0x4990f6[_0xd1e2('0x20')]();};}function saveUpdates(_0x1cbd8a,_0x513eed){return function(_0x52ae4d){if(_0x52ae4d){return _0x52ae4d[_0xd1e2('0x21')](_0x1cbd8a)[_0xd1e2('0x22')](function(_0x63031b){return _0x63031b;});}return null;};}function removeEntity(_0x51cd42,_0x416e39){return function(_0x1baedd){if(_0x1baedd){return _0x1baedd[_0xd1e2('0x23')]()[_0xd1e2('0x22')](function(){_0x51cd42[_0xd1e2('0x17')](0xcc)[_0xd1e2('0x24')]();});}};}function handleEntityNotFound(_0x292da1,_0x123207){return function(_0x33334e){if(!_0x33334e){_0x292da1[_0xd1e2('0x16')](0x194);}return _0x33334e;};}function handleError(_0x4eb5ad,_0x88384b){_0x88384b=_0x88384b||0x1f4;return function(_0x2dae68){logger[_0xd1e2('0x25')](_0x2dae68[_0xd1e2('0x26')]);if(_0x2dae68[_0xd1e2('0x27')]){delete _0x2dae68[_0xd1e2('0x27')];}_0x4eb5ad[_0xd1e2('0x17')](_0x88384b)[_0xd1e2('0x28')](_0x2dae68);};}exports['index']=function(_0x1cf3a1,_0x25da0d){var _0x5ea171={},_0x2e942c={},_0x5984b2={'count':0x0,'rows':[]};var _0x55db4e=_[_0xd1e2('0x29')](db[_0xd1e2('0x2a')][_0xd1e2('0x2b')],function(_0x16cd5d){return{'name':_0x16cd5d[_0xd1e2('0x2c')],'type':_0x16cd5d[_0xd1e2('0x2d')]['key']};});_0x2e942c['model']=_[_0xd1e2('0x29')](_0x55db4e,_0xd1e2('0x27'));_0x2e942c['query']=_[_0xd1e2('0x2e')](_0x1cf3a1[_0xd1e2('0x2f')]);_0x2e942c[_0xd1e2('0x30')]=_[_0xd1e2('0x31')](_0x2e942c['model'],_0x2e942c[_0xd1e2('0x2f')]);_0x5ea171[_0xd1e2('0x32')]=_[_0xd1e2('0x31')](_0x2e942c[_0xd1e2('0x33')],qs[_0xd1e2('0x34')](_0x1cf3a1[_0xd1e2('0x2f')]['fields']));_0x5ea171['attributes']=_0x5ea171[_0xd1e2('0x32')][_0xd1e2('0x35')]?_0x5ea171['attributes']:_0x2e942c[_0xd1e2('0x33')];if(!_0x1cf3a1['query']['hasOwnProperty'](_0xd1e2('0x36'))){_0x5ea171['limit']=qs[_0xd1e2('0x1b')](_0x1cf3a1[_0xd1e2('0x2f')]['limit']);_0x5ea171[_0xd1e2('0x19')]=qs[_0xd1e2('0x19')](_0x1cf3a1['query'][_0xd1e2('0x19')]);}_0x5ea171['order']=qs[_0xd1e2('0x37')](_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x37')]);_0x5ea171[_0xd1e2('0x38')]=qs['filters'](_[_0xd1e2('0x39')](_0x1cf3a1[_0xd1e2('0x2f')],_0x2e942c['filters']),_0x55db4e);if(_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x3a')]){_0x5ea171['where']=_[_0xd1e2('0x3b')](_0x5ea171[_0xd1e2('0x38')],{'$or':_['map'](_0x55db4e,function(_0xdcca88){if(_0xdcca88['type']!=='VIRTUAL'){var _0xf03fc7={};_0xf03fc7[_0xdcca88[_0xd1e2('0x27')]]={'$like':'%'+_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x3a')]+'%'};return _0xf03fc7;}})});}_0x5ea171=_[_0xd1e2('0x3b')]({},_0x5ea171,_0x1cf3a1[_0xd1e2('0x3c')]);var _0x70783f={'where':_0x5ea171[_0xd1e2('0x38')]};return db[_0xd1e2('0x2a')][_0xd1e2('0x1c')](_0x70783f)[_0xd1e2('0x22')](function(_0x3b9af1){_0x5984b2['count']=_0x3b9af1;if(_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x3d')]){_0x5ea171[_0xd1e2('0x3e')]=[{'all':!![]}];}return db[_0xd1e2('0x2a')][_0xd1e2('0x3f')](_0x5ea171);})[_0xd1e2('0x22')](function(_0x19ad7e){_0x5984b2['rows']=_0x19ad7e;return _0x5984b2;})[_0xd1e2('0x22')](respondWithFilteredResult(_0x25da0d,_0x5ea171))[_0xd1e2('0x40')](handleError(_0x25da0d,null));};exports[_0xd1e2('0x41')]=function(_0xcbded6,_0x374bae){var _0x301138={'raw':!![],'where':{'id':_0xcbded6[_0xd1e2('0x42')]['id']}},_0x51f10b={};_0x51f10b['model']=_['keys'](db[_0xd1e2('0x2a')][_0xd1e2('0x2b')]);_0x51f10b['query']=_['keys'](_0xcbded6['query']);_0x51f10b[_0xd1e2('0x30')]=_[_0xd1e2('0x31')](_0x51f10b[_0xd1e2('0x33')],_0x51f10b['query']);_0x301138[_0xd1e2('0x32')]=_[_0xd1e2('0x31')](_0x51f10b['model'],qs[_0xd1e2('0x34')](_0xcbded6[_0xd1e2('0x2f')][_0xd1e2('0x34')]));_0x301138['attributes']=_0x301138['attributes'][_0xd1e2('0x35')]?_0x301138['attributes']:_0x51f10b[_0xd1e2('0x33')];if(_0xcbded6['query'][_0xd1e2('0x3d')]){_0x301138['include']=[{'all':!![]}];}_0x301138=_['merge']({},_0x301138,_0xcbded6[_0xd1e2('0x3c')]);return db['OpenchannelQueueReport']['find'](_0x301138)[_0xd1e2('0x22')](handleEntityNotFound(_0x374bae,null))[_0xd1e2('0x22')](respondWithResult(_0x374bae,null))[_0xd1e2('0x40')](handleError(_0x374bae,null));};exports[_0xd1e2('0x43')]=function(_0x22928e,_0xa21bb4){return db[_0xd1e2('0x2a')][_0xd1e2('0x43')](_0x22928e[_0xd1e2('0x44')],{})[_0xd1e2('0x22')](respondWithResult(_0xa21bb4,0xc9))['catch'](handleError(_0xa21bb4,null));};exports[_0xd1e2('0x21')]=function(_0x241897,_0x568cb2){if(_0x241897[_0xd1e2('0x44')]['id']){delete _0x241897[_0xd1e2('0x44')]['id'];}return db[_0xd1e2('0x2a')][_0xd1e2('0x45')]({'where':{'id':_0x241897['params']['id']}})[_0xd1e2('0x22')](handleEntityNotFound(_0x568cb2,null))[_0xd1e2('0x22')](saveUpdates(_0x241897[_0xd1e2('0x44')],null))['then'](respondWithResult(_0x568cb2,null))[_0xd1e2('0x40')](handleError(_0x568cb2,null));};exports[_0xd1e2('0x23')]=function(_0x5a9ade,_0xd1bdcb){return db['OpenchannelQueueReport'][_0xd1e2('0x45')]({'where':{'id':_0x5a9ade[_0xd1e2('0x42')]['id']}})[_0xd1e2('0x22')](handleEntityNotFound(_0xd1bdcb,null))[_0xd1e2('0x22')](removeEntity(_0xd1bdcb,null))[_0xd1e2('0x40')](handleError(_0xd1bdcb,null));};exports[_0xd1e2('0x46')]=function(_0x187614,_0x971bb2){return db[_0xd1e2('0x2a')][_0xd1e2('0x46')]()[_0xd1e2('0x22')](respondWithResult(_0x971bb2,null))[_0xd1e2('0x40')](handleError(_0x971bb2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c93147a..40b2e4d 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x814b,0x1a2));var _0xb814=function(_0x3284cd,_0x2e10a2){_0x3284cd=_0x3284cd-0x0;var _0xe92280=_0x814b[_0x3284cd];return _0xe92280;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x388a90,_0x4f7927){var _0x26699d=function(_0x46b97a){while(--_0x46b97a){_0x388a90['push'](_0x388a90['shift']());}};_0x26699d(++_0x4f7927);}(_0x7a54,0x106));var _0x47a5=function(_0x23bdf2,_0x402cdc){_0x23bdf2=_0x23bdf2-0x0;var _0x136760=_0x7a54[_0x23bdf2];return _0x136760;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 225a093..fe0e296 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 _0xaa5e=['UpdateOpenchannelQueueReport','update','body','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','debug','catch'];(function(_0x3f515d,_0x25004d){var _0x28aac3=function(_0x51fce3){while(--_0x51fce3){_0x3f515d['push'](_0x3f515d['shift']());}};_0x28aac3(++_0x25004d);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x9c0544,_0x25306){_0x9c0544=_0x9c0544-0x0;var _0x1b2cbe=_0xaa5e[_0x9c0544];return _0x1b2cbe;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});}exports['CreateOpenchannelQueueReport']=function(_0x1877a6){var _0x50256a=this;return new Promise(function(_0x222da7,_0x85fb44){return db[_0xeaa5('0x14')][_0xeaa5('0x15')](_0x1877a6['body'],{'raw':_0x1877a6[_0xeaa5('0x16')]?_0x1877a6[_0xeaa5('0x16')][_0xeaa5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x11ace2){logger[_0xeaa5('0x13')](_0xeaa5('0x18'),_0x1877a6);logger[_0xeaa5('0x19')](_0xeaa5('0x18'),_0x1877a6,JSON['stringify'](_0x11ace2));_0x222da7(_0x11ace2);})[_0xeaa5('0x1a')](function(_0x5f2d83){logger[_0xeaa5('0x10')](_0xeaa5('0x18'),_0x5f2d83[_0xeaa5('0x12')],_0x1877a6);_0x85fb44(_0x50256a[_0xeaa5('0x10')](0x1f4,_0x5f2d83[_0xeaa5('0x12')]));});});};exports[_0xeaa5('0x1b')]=function(_0x355dbd){var _0xee844c=this;return new Promise(function(_0xebce8c,_0x2c4003){return db[_0xeaa5('0x14')][_0xeaa5('0x1c')](_0x355dbd[_0xeaa5('0x1d')],{'raw':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['where']||null:null,'attributes':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')][_0xeaa5('0x1e')]||null:null,'limit':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['limit']||null:null})[_0xeaa5('0x1f')](function(_0x592fe1){logger[_0xeaa5('0x13')](_0xeaa5('0x1b'),_0x355dbd);logger[_0xeaa5('0x19')](_0xeaa5('0x1b'),_0x355dbd,JSON[_0xeaa5('0xf')](_0x592fe1));_0xebce8c(_0x592fe1);})[_0xeaa5('0x1a')](function(_0x5121b6){logger[_0xeaa5('0x10')](_0xeaa5('0x1b'),_0x5121b6['message'],_0x355dbd);_0x2c4003(_0xee844c[_0xeaa5('0x10')](0x1f4,_0x5121b6['message']));});});}; \ No newline at end of file +var _0x8580=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','attributes','limit','then','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8580,0x1c7));var _0x0858=function(_0x420e57,_0x1ac7fc){_0x420e57=_0x420e57-0x0;var _0x32e16f=_0x8580[_0x420e57];return _0x32e16f;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3515b4,_0x38e3f7,_0x4981a7){return new BPromise(function(_0x9c611c,_0x3ae92b){return client[_0x0858('0x8')](_0x3515b4,_0x4981a7)['then'](function(_0x4ceffb){logger[_0x0858('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x38e3f7,_0x0858('0xa'));logger[_0x0858('0xb')](_0x0858('0xc'),_0x38e3f7,_0x0858('0xa'),JSON[_0x0858('0xd')](_0x4ceffb));if(_0x4ceffb[_0x0858('0xe')]){if(_0x4ceffb[_0x0858('0xe')][_0x0858('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x38e3f7,_0x4ceffb[_0x0858('0xe')]['message']);return _0x3ae92b(_0x4ceffb['error']['message']);}logger[_0x0858('0xe')](_0x0858('0x10'),_0x38e3f7,_0x4ceffb['error'][_0x0858('0x11')]);return _0x9c611c(_0x4ceffb[_0x0858('0xe')][_0x0858('0x11')]);}else{logger[_0x0858('0x9')](_0x0858('0x10'),_0x38e3f7,_0x0858('0xa'));_0x9c611c(_0x4ceffb[_0x0858('0x12')][_0x0858('0x11')]);}})[_0x0858('0x13')](function(_0x39e967){logger[_0x0858('0xe')](_0x0858('0x10'),_0x38e3f7,_0x39e967);_0x3ae92b(_0x39e967);});});}exports['CreateOpenchannelQueueReport']=function(_0x2b73c2){var _0x4d376b=this;return new Promise(function(_0x284ebd,_0x37f90b){return db[_0x0858('0x14')][_0x0858('0x15')](_0x2b73c2[_0x0858('0x16')],{'raw':_0x2b73c2['options']?_0x2b73c2[_0x0858('0x17')][_0x0858('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1ea1a7){logger['info']('CreateOpenchannelQueueReport',_0x2b73c2);logger[_0x0858('0xb')](_0x0858('0x19'),_0x2b73c2,JSON[_0x0858('0xd')](_0x1ea1a7));_0x284ebd(_0x1ea1a7);})[_0x0858('0x13')](function(_0x29ac2b){logger['error'](_0x0858('0x19'),_0x29ac2b['message'],_0x2b73c2);_0x37f90b(_0x4d376b[_0x0858('0xe')](0x1f4,_0x29ac2b['message']));});});};exports[_0x0858('0x1a')]=function(_0x425745){var _0x32d21d=this;return new Promise(function(_0xdd5116,_0x4fe016){return db[_0x0858('0x14')][_0x0858('0x1b')](_0x425745[_0x0858('0x16')],{'raw':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x1c')]||null:null,'attributes':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x1d')]||null:null,'limit':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x1e')]||null:null})[_0x0858('0x1f')](function(_0x2607c1){logger[_0x0858('0x9')]('UpdateOpenchannelQueueReport',_0x425745);logger[_0x0858('0xb')](_0x0858('0x1a'),_0x425745,JSON[_0x0858('0xd')](_0x2607c1));_0xdd5116(_0x2607c1);})[_0x0858('0x13')](function(_0xdcbd78){logger[_0x0858('0xe')](_0x0858('0x1a'),_0xdcbd78[_0x0858('0x11')],_0x425745);_0x4fe016(_0x32d21d['error'](0x1f4,_0xdcbd78[_0x0858('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e0ca50e..38397dc 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 _0x0f67=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x292751,_0x753c01){var _0x557016=function(_0x50eb5e){while(--_0x50eb5e){_0x292751['push'](_0x292751['shift']());}};_0x557016(++_0x753c01);}(_0x0f67,0x1bb));var _0x70f6=function(_0x5d3b5d,_0x1b89b5){_0x5d3b5d=_0x5d3b5d-0x0;var _0x2589fa=_0x0f67[_0x5d3b5d];return _0x2589fa;};'use strict';var multer=require(_0x70f6('0x0'));var util=require(_0x70f6('0x1'));var path=require(_0x70f6('0x2'));var timeout=require(_0x70f6('0x3'));var express=require(_0x70f6('0x4'));var router=express[_0x70f6('0x5')]();var fs_extra=require(_0x70f6('0x6'));var auth=require(_0x70f6('0x7'));var interaction=require(_0x70f6('0x8'));var config=require(_0x70f6('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0x70f6('0xa')]('/',auth['isAuthenticated'](),controller[_0x70f6('0xb')]);router[_0x70f6('0xa')]('/describe',auth[_0x70f6('0xc')](),controller[_0x70f6('0xd')]);router['get'](_0x70f6('0xe'),auth[_0x70f6('0xc')](),controller[_0x70f6('0xf')]);router[_0x70f6('0x10')]('/',auth[_0x70f6('0xc')](),controller[_0x70f6('0x11')]);router[_0x70f6('0x12')](_0x70f6('0xe'),auth[_0x70f6('0xc')](),controller[_0x70f6('0x13')]);router[_0x70f6('0x14')](_0x70f6('0xe'),auth[_0x70f6('0xc')](),controller['destroy']);module[_0x70f6('0x15')]=router; \ No newline at end of file +var _0x5df1=['fs-extra','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','/describe','get','show','post','create','put','update','destroy','path','connect-timeout'];(function(_0x50e702,_0x59c34f){var _0xbd3476=function(_0x24caad){while(--_0x24caad){_0x50e702['push'](_0x50e702['shift']());}};_0xbd3476(++_0x59c34f);}(_0x5df1,0x148));var _0x15df=function(_0xc26fbd,_0x79092c){_0xc26fbd=_0xc26fbd-0x0;var _0x35ad07=_0x5df1[_0xc26fbd];return _0x35ad07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x15df('0x0'));var timeout=require(_0x15df('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x15df('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x15df('0x3'));var controller=require(_0x15df('0x4'));router['get']('/',auth[_0x15df('0x5')](),controller[_0x15df('0x6')]);router['get'](_0x15df('0x7'),auth[_0x15df('0x5')](),controller['describe']);router[_0x15df('0x8')]('/:id',auth[_0x15df('0x5')](),controller[_0x15df('0x9')]);router[_0x15df('0xa')]('/',auth[_0x15df('0x5')](),controller[_0x15df('0xb')]);router[_0x15df('0xc')]('/:id',auth[_0x15df('0x5')](),controller[_0x15df('0xd')]);router['delete']('/:id',auth[_0x15df('0x5')](),controller[_0x15df('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 571c90b..4a5d6cb 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x36c407,_0x3be9bc){var _0x3d0b7e=function(_0xc753b3){while(--_0xc753b3){_0x36c407['push'](_0x36c407['shift']());}};_0x3d0b7e(++_0x3be9bc);}(_0xaa88,0x137));var _0x8aa8=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0xaa88[_0x4c70c4];return _0x437865;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2bc4b6,_0x452461){_0x2bc4b6=_0x2bc4b6-0x0;var _0x22b4e3=_0xb43b[_0x2bc4b6];return _0x22b4e3;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index dbf3aee..3c00399 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 _0xb73f=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','catch','params','find','create','body','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb73f,0x1ec));var _0xfb73=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xb73f[_0x1c2051];return _0x2b58a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb73('0x0'));var jsonpatch=require(_0xfb73('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb73('0x2'));var Mustache=require(_0xfb73('0x3'));var util=require(_0xfb73('0x4'));var path=require(_0xfb73('0x5'));var sox=require(_0xfb73('0x6'));var csv=require(_0xfb73('0x7'));var ejs=require(_0xfb73('0x8'));var fs=require('fs');var fs_extra=require(_0xfb73('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfb73('0xa'));var deskjs=require(_0xfb73('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfb73('0xc'));var Papa=require(_0xfb73('0xd'));var Redis=require(_0xfb73('0xe'));var authService=require(_0xfb73('0xf'));var qs=require(_0xfb73('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb73('0x11'));var logger=require(_0xfb73('0x12'))('api');var utils=require(_0xfb73('0x13'));var config=require(_0xfb73('0x14'));var licenseUtil=require(_0xfb73('0x15'));var db=require(_0xfb73('0x16'))['db'];function respondWithStatusCode(_0x1716ab,_0x2dd930){_0x2dd930=_0x2dd930||0xcc;return function(_0x58617f){if(_0x58617f){return _0x1716ab[_0xfb73('0x17')](_0x2dd930);}return _0x1716ab[_0xfb73('0x18')](_0x2dd930)['end']();};}function respondWithResult(_0x36f605,_0x3c1110){_0x3c1110=_0x3c1110||0xc8;return function(_0x5c1ab6){if(_0x5c1ab6){return _0x36f605['status'](_0x3c1110)[_0xfb73('0x19')](_0x5c1ab6);}};}function respondWithFilteredResult(_0xd150c6,_0x22bccd){return function(_0x365875){if(_0x365875){var _0x24b0dd=typeof _0x22bccd['offset']===_0xfb73('0x1a')&&typeof _0x22bccd[_0xfb73('0x1b')]===_0xfb73('0x1a');var _0x5a2cdf=_0x365875[_0xfb73('0x1c')];var _0xc6c64e=_0x24b0dd?0x0:_0x22bccd[_0xfb73('0x1d')];var _0x2de317=_0x24b0dd?_0x365875['count']:_0x22bccd[_0xfb73('0x1d')]+_0x22bccd[_0xfb73('0x1b')];var _0x3d3b4f;if(_0x2de317>=_0x5a2cdf){_0x2de317=_0x5a2cdf;_0x3d3b4f=0xc8;}else{_0x3d3b4f=0xce;}_0xd150c6[_0xfb73('0x18')](_0x3d3b4f);return _0xd150c6[_0xfb73('0x1e')](_0xfb73('0x1f'),_0xc6c64e+'-'+_0x2de317+'/'+_0x5a2cdf)[_0xfb73('0x19')](_0x365875);}return null;};}function patchUpdates(_0x533581){return function(_0x1a9cd1){try{jsonpatch[_0xfb73('0x20')](_0x1a9cd1,_0x533581,!![]);}catch(_0x5b64df){return BPromise['reject'](_0x5b64df);}return _0x1a9cd1[_0xfb73('0x21')]();};}function saveUpdates(_0x1da7f5,_0x2527aa){return function(_0x2ff107){if(_0x2ff107){return _0x2ff107[_0xfb73('0x22')](_0x1da7f5)[_0xfb73('0x23')](function(_0x15fecd){return _0x15fecd;});}return null;};}function removeEntity(_0x263068,_0x192763){return function(_0x3fd77f){if(_0x3fd77f){return _0x3fd77f[_0xfb73('0x24')]()['then'](function(){_0x263068[_0xfb73('0x18')](0xcc)[_0xfb73('0x25')]();});}};}function handleEntityNotFound(_0x501afc,_0x5142ca){return function(_0xde12a0){if(!_0xde12a0){_0x501afc[_0xfb73('0x17')](0x194);}return _0xde12a0;};}function handleError(_0x4707a6,_0xdcf48a){_0xdcf48a=_0xdcf48a||0x1f4;return function(_0x30065a){logger[_0xfb73('0x26')](_0x30065a[_0xfb73('0x27')]);if(_0x30065a[_0xfb73('0x28')]){delete _0x30065a[_0xfb73('0x28')];}_0x4707a6[_0xfb73('0x18')](_0xdcf48a)['send'](_0x30065a);};}exports[_0xfb73('0x29')]=function(_0x33fc8e,_0x3d4bea){var _0x4fa13d={},_0x188867={},_0x430e71={'count':0x0,'rows':[]};var _0x45dc4e=_[_0xfb73('0x2a')](db[_0xfb73('0x2b')][_0xfb73('0x2c')],function(_0x4e0696){return{'name':_0x4e0696['fieldName'],'type':_0x4e0696[_0xfb73('0x2d')][_0xfb73('0x2e')]};});_0x188867[_0xfb73('0x2f')]=_['map'](_0x45dc4e,_0xfb73('0x28'));_0x188867[_0xfb73('0x30')]=_[_0xfb73('0x31')](_0x33fc8e[_0xfb73('0x30')]);_0x188867['filters']=_[_0xfb73('0x32')](_0x188867[_0xfb73('0x2f')],_0x188867['query']);_0x4fa13d[_0xfb73('0x33')]=_[_0xfb73('0x32')](_0x188867[_0xfb73('0x2f')],qs[_0xfb73('0x34')](_0x33fc8e[_0xfb73('0x30')][_0xfb73('0x34')]));_0x4fa13d[_0xfb73('0x33')]=_0x4fa13d['attributes'][_0xfb73('0x35')]?_0x4fa13d[_0xfb73('0x33')]:_0x188867[_0xfb73('0x2f')];if(!_0x33fc8e[_0xfb73('0x30')][_0xfb73('0x36')](_0xfb73('0x37'))){_0x4fa13d[_0xfb73('0x1b')]=qs[_0xfb73('0x1b')](_0x33fc8e[_0xfb73('0x30')][_0xfb73('0x1b')]);_0x4fa13d[_0xfb73('0x1d')]=qs[_0xfb73('0x1d')](_0x33fc8e[_0xfb73('0x30')][_0xfb73('0x1d')]);}_0x4fa13d[_0xfb73('0x38')]=qs['sort'](_0x33fc8e['query'][_0xfb73('0x39')]);_0x4fa13d[_0xfb73('0x3a')]=qs[_0xfb73('0x3b')](_[_0xfb73('0x3c')](_0x33fc8e['query'],_0x188867[_0xfb73('0x3b')]),_0x45dc4e);if(_0x33fc8e['query']['filter']){_0x4fa13d[_0xfb73('0x3a')]=_[_0xfb73('0x3d')](_0x4fa13d[_0xfb73('0x3a')],{'$or':_[_0xfb73('0x2a')](_0x45dc4e,function(_0x16898f){if(_0x16898f[_0xfb73('0x2d')]!==_0xfb73('0x3e')){var _0x4aeb3e={};_0x4aeb3e[_0x16898f['name']]={'$like':'%'+_0x33fc8e[_0xfb73('0x30')][_0xfb73('0x3f')]+'%'};return _0x4aeb3e;}})});}_0x4fa13d=_[_0xfb73('0x3d')]({},_0x4fa13d,_0x33fc8e[_0xfb73('0x40')]);var _0x52cd78={'where':_0x4fa13d[_0xfb73('0x3a')]};return db[_0xfb73('0x2b')]['count'](_0x52cd78)[_0xfb73('0x23')](function(_0x41a827){_0x430e71[_0xfb73('0x1c')]=_0x41a827;if(_0x33fc8e[_0xfb73('0x30')]['includeAll']){_0x4fa13d[_0xfb73('0x41')]=[{'all':!![]}];}return db[_0xfb73('0x2b')][_0xfb73('0x42')](_0x4fa13d);})[_0xfb73('0x23')](function(_0x41e8ae){_0x430e71['rows']=_0x41e8ae;return _0x430e71;})['then'](respondWithFilteredResult(_0x3d4bea,_0x4fa13d))[_0xfb73('0x43')](handleError(_0x3d4bea,null));};exports['show']=function(_0x56c0ef,_0x3461a2){var _0x1cf54b={'raw':!![],'where':{'id':_0x56c0ef[_0xfb73('0x44')]['id']}},_0x57052d={};_0x57052d[_0xfb73('0x2f')]=_[_0xfb73('0x31')](db[_0xfb73('0x2b')][_0xfb73('0x2c')]);_0x57052d[_0xfb73('0x30')]=_[_0xfb73('0x31')](_0x56c0ef[_0xfb73('0x30')]);_0x57052d[_0xfb73('0x3b')]=_[_0xfb73('0x32')](_0x57052d['model'],_0x57052d[_0xfb73('0x30')]);_0x1cf54b[_0xfb73('0x33')]=_[_0xfb73('0x32')](_0x57052d[_0xfb73('0x2f')],qs[_0xfb73('0x34')](_0x56c0ef[_0xfb73('0x30')][_0xfb73('0x34')]));_0x1cf54b[_0xfb73('0x33')]=_0x1cf54b[_0xfb73('0x33')][_0xfb73('0x35')]?_0x1cf54b['attributes']:_0x57052d[_0xfb73('0x2f')];if(_0x56c0ef[_0xfb73('0x30')]['includeAll']){_0x1cf54b['include']=[{'all':!![]}];}_0x1cf54b=_['merge']({},_0x1cf54b,_0x56c0ef[_0xfb73('0x40')]);return db['OpenchannelTransferReport'][_0xfb73('0x45')](_0x1cf54b)[_0xfb73('0x23')](handleEntityNotFound(_0x3461a2,null))[_0xfb73('0x23')](respondWithResult(_0x3461a2,null))['catch'](handleError(_0x3461a2,null));};exports[_0xfb73('0x46')]=function(_0x415107,_0x4172aa){return db[_0xfb73('0x2b')][_0xfb73('0x46')](_0x415107['body'],{})[_0xfb73('0x23')](respondWithResult(_0x4172aa,0xc9))[_0xfb73('0x43')](handleError(_0x4172aa,null));};exports[_0xfb73('0x22')]=function(_0x2d81f5,_0x5b3c96){if(_0x2d81f5[_0xfb73('0x47')]['id']){delete _0x2d81f5['body']['id'];}return db[_0xfb73('0x2b')][_0xfb73('0x45')]({'where':{'id':_0x2d81f5['params']['id']}})[_0xfb73('0x23')](handleEntityNotFound(_0x5b3c96,null))[_0xfb73('0x23')](saveUpdates(_0x2d81f5[_0xfb73('0x47')],null))['then'](respondWithResult(_0x5b3c96,null))[_0xfb73('0x43')](handleError(_0x5b3c96,null));};exports[_0xfb73('0x24')]=function(_0x4e2cbd,_0x5a18c7){return db[_0xfb73('0x2b')]['find']({'where':{'id':_0x4e2cbd[_0xfb73('0x44')]['id']}})[_0xfb73('0x23')](handleEntityNotFound(_0x5a18c7,null))[_0xfb73('0x23')](removeEntity(_0x5a18c7,null))['catch'](handleError(_0x5a18c7,null));};exports['describe']=function(_0xc37529,_0x3af979){return db[_0xfb73('0x2b')]['describe']()[_0xfb73('0x23')](respondWithResult(_0x3af979,null))['catch'](handleError(_0x3af979,null));}; \ No newline at end of file +var _0x5d76=['filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','save','update','then','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys'];(function(_0x47ecd0,_0x5f315f){var _0x916089=function(_0x5a442a){while(--_0x5a442a){_0x47ecd0['push'](_0x47ecd0['shift']());}};_0x916089(++_0x5f315f);}(_0x5d76,0x196));var _0x65d7=function(_0x21188f,_0x5427d3){_0x21188f=_0x21188f-0x0;var _0x5c57ce=_0x5d76[_0x21188f];return _0x5c57ce;};'use strict';var emlformat=require(_0x65d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65d7('0x1'));var jsonpatch=require(_0x65d7('0x2'));var rp=require('request-promise');var moment=require(_0x65d7('0x3'));var BPromise=require(_0x65d7('0x4'));var Mustache=require('mustache');var util=require(_0x65d7('0x5'));var path=require(_0x65d7('0x6'));var sox=require(_0x65d7('0x7'));var csv=require(_0x65d7('0x8'));var ejs=require(_0x65d7('0x9'));var fs=require('fs');var fs_extra=require(_0x65d7('0xa'));var _=require(_0x65d7('0xb'));var squel=require(_0x65d7('0xc'));var crypto=require(_0x65d7('0xd'));var jsforce=require(_0x65d7('0xe'));var deskjs=require(_0x65d7('0xf'));var toCsv=require(_0x65d7('0x8'));var querystring=require(_0x65d7('0x10'));var Papa=require(_0x65d7('0x11'));var Redis=require(_0x65d7('0x12'));var authService=require(_0x65d7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x65d7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d7('0x15'))(_0x65d7('0x16'));var utils=require(_0x65d7('0x17'));var config=require(_0x65d7('0x18'));var licenseUtil=require(_0x65d7('0x19'));var db=require(_0x65d7('0x1a'))['db'];function respondWithStatusCode(_0x28eb00,_0x294bac){_0x294bac=_0x294bac||0xcc;return function(_0xa8d5b4){if(_0xa8d5b4){return _0x28eb00['sendStatus'](_0x294bac);}return _0x28eb00[_0x65d7('0x1b')](_0x294bac)[_0x65d7('0x1c')]();};}function respondWithResult(_0x9c6596,_0x2d4e84){_0x2d4e84=_0x2d4e84||0xc8;return function(_0x45f995){if(_0x45f995){return _0x9c6596[_0x65d7('0x1b')](_0x2d4e84)[_0x65d7('0x1d')](_0x45f995);}};}function respondWithFilteredResult(_0x521f1d,_0x34bbae){return function(_0x2d17de){if(_0x2d17de){var _0x41981b=typeof _0x34bbae[_0x65d7('0x1e')]===_0x65d7('0x1f')&&typeof _0x34bbae['limit']===_0x65d7('0x1f');var _0xf2e2f8=_0x2d17de[_0x65d7('0x20')];var _0x511890=_0x41981b?0x0:_0x34bbae[_0x65d7('0x1e')];var _0x338391=_0x41981b?_0x2d17de[_0x65d7('0x20')]:_0x34bbae[_0x65d7('0x1e')]+_0x34bbae['limit'];var _0x5a6af8;if(_0x338391>=_0xf2e2f8){_0x338391=_0xf2e2f8;_0x5a6af8=0xc8;}else{_0x5a6af8=0xce;}_0x521f1d[_0x65d7('0x1b')](_0x5a6af8);return _0x521f1d['set'](_0x65d7('0x21'),_0x511890+'-'+_0x338391+'/'+_0xf2e2f8)['json'](_0x2d17de);}return null;};}function patchUpdates(_0x177926){return function(_0x8a4e7c){try{jsonpatch['apply'](_0x8a4e7c,_0x177926,!![]);}catch(_0x8463a6){return BPromise['reject'](_0x8463a6);}return _0x8a4e7c[_0x65d7('0x22')]();};}function saveUpdates(_0x1be6ed,_0x174304){return function(_0x674c76){if(_0x674c76){return _0x674c76[_0x65d7('0x23')](_0x1be6ed)[_0x65d7('0x24')](function(_0x77bdb2){return _0x77bdb2;});}return null;};}function removeEntity(_0x1da5ef,_0x83b208){return function(_0x4ad389){if(_0x4ad389){return _0x4ad389['destroy']()[_0x65d7('0x24')](function(){_0x1da5ef[_0x65d7('0x1b')](0xcc)[_0x65d7('0x1c')]();});}};}function handleEntityNotFound(_0x3c135b,_0x4d4908){return function(_0x1d161f){if(!_0x1d161f){_0x3c135b[_0x65d7('0x25')](0x194);}return _0x1d161f;};}function handleError(_0x10a64f,_0xc3b9bc){_0xc3b9bc=_0xc3b9bc||0x1f4;return function(_0x3ece4d){logger[_0x65d7('0x26')](_0x3ece4d['stack']);if(_0x3ece4d['name']){delete _0x3ece4d[_0x65d7('0x27')];}_0x10a64f[_0x65d7('0x1b')](_0xc3b9bc)[_0x65d7('0x28')](_0x3ece4d);};}exports[_0x65d7('0x29')]=function(_0x21f899,_0xb95b88){var _0x214421={},_0x16b5b9={},_0x4a13e4={'count':0x0,'rows':[]};var _0x2a3e63=_[_0x65d7('0x2a')](db[_0x65d7('0x2b')][_0x65d7('0x2c')],function(_0x6670e0){return{'name':_0x6670e0[_0x65d7('0x2d')],'type':_0x6670e0['type'][_0x65d7('0x2e')]};});_0x16b5b9[_0x65d7('0x2f')]=_[_0x65d7('0x2a')](_0x2a3e63,_0x65d7('0x27'));_0x16b5b9[_0x65d7('0x30')]=_[_0x65d7('0x31')](_0x21f899[_0x65d7('0x30')]);_0x16b5b9[_0x65d7('0x32')]=_[_0x65d7('0x33')](_0x16b5b9[_0x65d7('0x2f')],_0x16b5b9[_0x65d7('0x30')]);_0x214421['attributes']=_[_0x65d7('0x33')](_0x16b5b9['model'],qs[_0x65d7('0x34')](_0x21f899['query'][_0x65d7('0x34')]));_0x214421['attributes']=_0x214421['attributes'][_0x65d7('0x35')]?_0x214421[_0x65d7('0x36')]:_0x16b5b9[_0x65d7('0x2f')];if(!_0x21f899['query'][_0x65d7('0x37')](_0x65d7('0x38'))){_0x214421[_0x65d7('0x39')]=qs[_0x65d7('0x39')](_0x21f899[_0x65d7('0x30')][_0x65d7('0x39')]);_0x214421[_0x65d7('0x1e')]=qs[_0x65d7('0x1e')](_0x21f899[_0x65d7('0x30')][_0x65d7('0x1e')]);}_0x214421['order']=qs['sort'](_0x21f899['query'][_0x65d7('0x3a')]);_0x214421['where']=qs[_0x65d7('0x32')](_[_0x65d7('0x3b')](_0x21f899[_0x65d7('0x30')],_0x16b5b9[_0x65d7('0x32')]),_0x2a3e63);if(_0x21f899[_0x65d7('0x30')][_0x65d7('0x3c')]){_0x214421[_0x65d7('0x3d')]=_[_0x65d7('0x3e')](_0x214421[_0x65d7('0x3d')],{'$or':_[_0x65d7('0x2a')](_0x2a3e63,function(_0x2636e2){if(_0x2636e2[_0x65d7('0x3f')]!==_0x65d7('0x40')){var _0x2a4842={};_0x2a4842[_0x2636e2[_0x65d7('0x27')]]={'$like':'%'+_0x21f899[_0x65d7('0x30')][_0x65d7('0x3c')]+'%'};return _0x2a4842;}})});}_0x214421=_[_0x65d7('0x3e')]({},_0x214421,_0x21f899[_0x65d7('0x41')]);var _0x26159f={'where':_0x214421[_0x65d7('0x3d')]};return db[_0x65d7('0x2b')]['count'](_0x26159f)['then'](function(_0x58e4d8){_0x4a13e4[_0x65d7('0x20')]=_0x58e4d8;if(_0x21f899[_0x65d7('0x30')]['includeAll']){_0x214421[_0x65d7('0x42')]=[{'all':!![]}];}return db[_0x65d7('0x2b')][_0x65d7('0x43')](_0x214421);})[_0x65d7('0x24')](function(_0x9fdff9){_0x4a13e4[_0x65d7('0x44')]=_0x9fdff9;return _0x4a13e4;})[_0x65d7('0x24')](respondWithFilteredResult(_0xb95b88,_0x214421))[_0x65d7('0x45')](handleError(_0xb95b88,null));};exports[_0x65d7('0x46')]=function(_0x4970f7,_0x1e560a){var _0x2601c4={'raw':!![],'where':{'id':_0x4970f7[_0x65d7('0x47')]['id']}},_0x5aabc7={};_0x5aabc7['model']=_[_0x65d7('0x31')](db[_0x65d7('0x2b')][_0x65d7('0x2c')]);_0x5aabc7['query']=_[_0x65d7('0x31')](_0x4970f7[_0x65d7('0x30')]);_0x5aabc7[_0x65d7('0x32')]=_[_0x65d7('0x33')](_0x5aabc7[_0x65d7('0x2f')],_0x5aabc7[_0x65d7('0x30')]);_0x2601c4[_0x65d7('0x36')]=_[_0x65d7('0x33')](_0x5aabc7[_0x65d7('0x2f')],qs['fields'](_0x4970f7[_0x65d7('0x30')][_0x65d7('0x34')]));_0x2601c4['attributes']=_0x2601c4[_0x65d7('0x36')][_0x65d7('0x35')]?_0x2601c4[_0x65d7('0x36')]:_0x5aabc7[_0x65d7('0x2f')];if(_0x4970f7[_0x65d7('0x30')]['includeAll']){_0x2601c4[_0x65d7('0x42')]=[{'all':!![]}];}_0x2601c4=_[_0x65d7('0x3e')]({},_0x2601c4,_0x4970f7[_0x65d7('0x41')]);return db[_0x65d7('0x2b')]['find'](_0x2601c4)[_0x65d7('0x24')](handleEntityNotFound(_0x1e560a,null))[_0x65d7('0x24')](respondWithResult(_0x1e560a,null))['catch'](handleError(_0x1e560a,null));};exports['create']=function(_0x3641c4,_0x5cfb28){return db[_0x65d7('0x2b')]['create'](_0x3641c4[_0x65d7('0x48')],{})[_0x65d7('0x24')](respondWithResult(_0x5cfb28,0xc9))[_0x65d7('0x45')](handleError(_0x5cfb28,null));};exports[_0x65d7('0x23')]=function(_0x450baa,_0x84c333){if(_0x450baa[_0x65d7('0x48')]['id']){delete _0x450baa['body']['id'];}return db[_0x65d7('0x2b')]['find']({'where':{'id':_0x450baa[_0x65d7('0x47')]['id']}})[_0x65d7('0x24')](handleEntityNotFound(_0x84c333,null))[_0x65d7('0x24')](saveUpdates(_0x450baa[_0x65d7('0x48')],null))[_0x65d7('0x24')](respondWithResult(_0x84c333,null))[_0x65d7('0x45')](handleError(_0x84c333,null));};exports[_0x65d7('0x49')]=function(_0x2a4ce3,_0x2acde2){return db['OpenchannelTransferReport'][_0x65d7('0x4a')]({'where':{'id':_0x2a4ce3[_0x65d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2acde2,null))['then'](removeEntity(_0x2acde2,null))['catch'](handleError(_0x2acde2,null));};exports['describe']=function(_0x1dd31f,_0x18e813){return db['OpenchannelTransferReport'][_0x65d7('0x4b')]()[_0x65d7('0x24')](respondWithResult(_0x18e813,null))[_0x65d7('0x45')](handleError(_0x18e813,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6f13c6f..6190dd6 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 _0x4404=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4404,0x10d));var _0x4440=function(_0x194d60,_0x1c4efa){_0x194d60=_0x194d60-0x0;var _0x2cec22=_0x4404[_0x194d60];return _0x2cec22;};'use strict';var _=require('lodash');var util=require(_0x4440('0x0'));var logger=require(_0x4440('0x1'))(_0x4440('0x2'));var moment=require(_0x4440('0x3'));var BPromise=require(_0x4440('0x4'));var rp=require(_0x4440('0x5'));var fs=require('fs');var path=require(_0x4440('0x6'));var rimraf=require(_0x4440('0x7'));var config=require(_0x4440('0x8'));var attributes=require(_0x4440('0x9'));module[_0x4440('0xa')]=function(_0x9af670,_0x234581){return _0x9af670[_0x4440('0xb')](_0x4440('0xc'),attributes,{'tableName':_0x4440('0xd'),'paranoid':![],'indexes':[{'name':_0x4440('0xe'),'fields':[_0x4440('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ba2=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x35fcd8,_0x5ba4a0){var _0x526766=function(_0x558075){while(--_0x558075){_0x35fcd8['push'](_0x35fcd8['shift']());}};_0x526766(++_0x5ba4a0);}(_0x9ba2,0xe4));var _0x29ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9ba2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x29ba('0x0'));var logger=require(_0x29ba('0x1'))(_0x29ba('0x2'));var moment=require('moment');var BPromise=require(_0x29ba('0x3'));var rp=require(_0x29ba('0x4'));var fs=require('fs');var path=require(_0x29ba('0x5'));var rimraf=require(_0x29ba('0x6'));var config=require(_0x29ba('0x7'));var attributes=require(_0x29ba('0x8'));module[_0x29ba('0x9')]=function(_0x46a4fc,_0x213ddb){return _0x46a4fc[_0x29ba('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x29ba('0xb'),'paranoid':![],'indexes':[{'name':_0x29ba('0xc'),'fields':[_0x29ba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index f555883..7f02e8a 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 _0x5a5a=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2783e8,_0xe19e10){var _0x4e06bc=function(_0x3bd925){while(--_0x3bd925){_0x2783e8['push'](_0x2783e8['shift']());}};_0x4e06bc(++_0xe19e10);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x409d34,_0x400f1d){_0x409d34=_0x409d34-0x0;var _0x1a38bc=_0x5a5a[_0x409d34];return _0x1a38bc;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var moment=require(_0xa5a5('0x1'));var BPromise=require(_0xa5a5('0x2'));var rs=require(_0xa5a5('0x3'));var fs=require('fs');var Redis=require(_0xa5a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a5('0x5'));var logger=require(_0xa5a5('0x6'))(_0xa5a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa5a5('0x8')][_0xa5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5691f1,_0x3ea00f,_0xf2ea20){return new BPromise(function(_0x1234c2,_0x3a23f4){return client[_0xa5a5('0xa')](_0x5691f1,_0xf2ea20)['then'](function(_0x158a80){logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));logger[_0xa5a5('0xe')](_0xa5a5('0xf'),_0x3ea00f,_0xa5a5('0xd'),JSON[_0xa5a5('0x10')](_0x158a80));if(_0x158a80[_0xa5a5('0x11')]){if(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x12')]===0x1f4){logger[_0xa5a5('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3ea00f,_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);return _0x3a23f4(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x158a80['error'][_0xa5a5('0x13')]);return _0x1234c2(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}else{logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));_0x1234c2(_0x158a80[_0xa5a5('0x14')][_0xa5a5('0x13')]);}})['catch'](function(_0x3ef56e){logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x3ef56e);_0x3a23f4(_0x3ef56e);});});} \ No newline at end of file +var _0x2fed=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2fed,0x7c));var _0xd2fe=function(_0x45da43,_0x4657f3){_0x45da43=_0x45da43-0x0;var _0x4ce941=_0x2fed[_0x45da43];return _0x4ce941;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var moment=require(_0xd2fe('0x2'));var BPromise=require(_0xd2fe('0x3'));var rs=require(_0xd2fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2fe('0x5'))['db'];var utils=require(_0xd2fe('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd2fe('0x7'));var jayson=require(_0xd2fe('0x8'));var client=jayson[_0xd2fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7bf5,_0x44e015,_0x3b6591){return new BPromise(function(_0x42a8fb,_0x47996a){return client[_0xd2fe('0xa')](_0x2f7bf5,_0x3b6591)[_0xd2fe('0xb')](function(_0x815784){logger[_0xd2fe('0xc')](_0xd2fe('0xd'),_0x44e015,_0xd2fe('0xe'));logger[_0xd2fe('0xf')](_0xd2fe('0x10'),_0x44e015,_0xd2fe('0xe'),JSON[_0xd2fe('0x11')](_0x815784));if(_0x815784[_0xd2fe('0x12')]){if(_0x815784[_0xd2fe('0x12')][_0xd2fe('0x13')]===0x1f4){logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')][_0xd2fe('0x14')]);return _0x47996a(_0x815784[_0xd2fe('0x12')]['message']);}logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')]['message']);return _0x42a8fb(_0x815784['error']['message']);}else{logger[_0xd2fe('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x44e015,_0xd2fe('0xe'));_0x42a8fb(_0x815784[_0xd2fe('0x15')][_0xd2fe('0x14')]);}})[_0xd2fe('0x16')](function(_0x303ca2){logger[_0xd2fe('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x44e015,_0x303ca2);_0x47996a(_0x303ca2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index fd53fed..fa38ffd 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 _0xb6e6=['Router','../../components/auth/service','./pause.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x15a346,_0x46d825){var _0x275a0f=function(_0x3df115){while(--_0x3df115){_0x15a346['push'](_0x15a346['shift']());}};_0x275a0f(++_0x46d825);}(_0xb6e6,0xc8));var _0x6b6e=function(_0x4f9b2c,_0x20c33a){_0x4f9b2c=_0x4f9b2c-0x0;var _0x21c4cb=_0xb6e6[_0x4f9b2c];return _0x21c4cb;};'use strict';var multer=require(_0x6b6e('0x0'));var util=require('util');var path=require(_0x6b6e('0x1'));var timeout=require(_0x6b6e('0x2'));var express=require(_0x6b6e('0x3'));var router=express[_0x6b6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6b6e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b6e('0x6'));router['get']('/',auth[_0x6b6e('0x7')](),controller[_0x6b6e('0x8')]);router[_0x6b6e('0x9')](_0x6b6e('0xa'),auth[_0x6b6e('0x7')](),controller['show']);router['post']('/',auth[_0x6b6e('0x7')](),controller[_0x6b6e('0xb')]);router[_0x6b6e('0xc')](_0x6b6e('0xa'),auth[_0x6b6e('0x7')](),controller[_0x6b6e('0xd')]);router[_0x6b6e('0xe')]('/:id',auth[_0x6b6e('0x7')](),controller[_0x6b6e('0xf')]);module[_0x6b6e('0x10')]=router; \ No newline at end of file +var _0xb05e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xb05e,0x83));var _0xeb05=function(_0x4b9a62,_0x528ba3){_0x4b9a62=_0x4b9a62-0x0;var _0x45c582=_0xb05e[_0x4b9a62];return _0x45c582;};'use strict';var multer=require(_0xeb05('0x0'));var util=require(_0xeb05('0x1'));var path=require(_0xeb05('0x2'));var timeout=require(_0xeb05('0x3'));var express=require(_0xeb05('0x4'));var router=express[_0xeb05('0x5')]();var fs_extra=require(_0xeb05('0x6'));var auth=require(_0xeb05('0x7'));var interaction=require(_0xeb05('0x8'));var config=require(_0xeb05('0x9'));var controller=require(_0xeb05('0xa'));router['get']('/',auth[_0xeb05('0xb')](),controller[_0xeb05('0xc')]);router[_0xeb05('0xd')](_0xeb05('0xe'),auth['isAuthenticated'](),controller[_0xeb05('0xf')]);router['post']('/',auth[_0xeb05('0xb')](),controller[_0xeb05('0x10')]);router[_0xeb05('0x11')](_0xeb05('0xe'),auth[_0xeb05('0xb')](),controller[_0xeb05('0x12')]);router[_0xeb05('0x13')](_0xeb05('0xe'),auth[_0xeb05('0xb')](),controller[_0xeb05('0x14')]);module[_0xeb05('0x15')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index cff6225..b55a80a 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 _0x2e66=['exports','STRING','name','sequelize'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x2e66,0x14f));var _0x62e6=function(_0x19d11c,_0x285b34){_0x19d11c=_0x19d11c-0x0;var _0x933487=_0x2e66[_0x19d11c];return _0x933487;};'use strict';var Sequelize=require(_0x62e6('0x0'));module[_0x62e6('0x1')]={'name':{'type':Sequelize[_0x62e6('0x2')],'unique':_0x62e6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x62e6('0x2')]}}; \ No newline at end of file +var _0x2405=['sequelize','exports','STRING'];(function(_0xacb225,_0xcd502d){var _0x2684df=function(_0x154c38){while(--_0x154c38){_0xacb225['push'](_0xacb225['shift']());}};_0x2684df(++_0xcd502d);}(_0x2405,0xf3));var _0x5240=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x2405[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require(_0x5240('0x0'));module[_0x5240('0x1')]={'name':{'type':Sequelize[_0x5240('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f32cb31..0d029f0 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 _0x9f4e=['sox','to-csv','fs-extra','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','Pause','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','include','create','get','role','Pauses','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','eml-format','zip-dir','fast-json-patch','mustache','util','path'];(function(_0x4d627a,_0x1bb450){var _0x1c5635=function(_0x568f0a){while(--_0x568f0a){_0x4d627a['push'](_0x4d627a['shift']());}};_0x1c5635(++_0x1bb450);}(_0x9f4e,0x92));var _0xe9f4=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9f4e[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0xe9f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9f4('0x1'));var jsonpatch=require(_0xe9f4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f4('0x3'));var util=require(_0xe9f4('0x4'));var path=require(_0xe9f4('0x5'));var sox=require(_0xe9f4('0x6'));var csv=require(_0xe9f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9f4('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe9f4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe9f4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9f4('0xa'));var authService=require(_0xe9f4('0xb'));var qs=require(_0xe9f4('0xc'));var as=require(_0xe9f4('0xd'));var hardwareService=require(_0xe9f4('0xe'));var logger=require(_0xe9f4('0xf'))(_0xe9f4('0x10'));var utils=require(_0xe9f4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe9f4('0x12'));var db=require(_0xe9f4('0x13'))['db'];function respondWithStatusCode(_0x1f320f,_0x17d0f1){_0x17d0f1=_0x17d0f1||0xcc;return function(_0x5ee24d){if(_0x5ee24d){return _0x1f320f['sendStatus'](_0x17d0f1);}return _0x1f320f[_0xe9f4('0x14')](_0x17d0f1)[_0xe9f4('0x15')]();};}function respondWithResult(_0x513574,_0x4ed92c){_0x4ed92c=_0x4ed92c||0xc8;return function(_0x37e009){if(_0x37e009){return _0x513574[_0xe9f4('0x14')](_0x4ed92c)['json'](_0x37e009);}};}function respondWithFilteredResult(_0x13dba9,_0x4de971){return function(_0x14c6db){if(_0x14c6db){var _0x18f8d6=typeof _0x4de971[_0xe9f4('0x16')]===_0xe9f4('0x17')&&typeof _0x4de971[_0xe9f4('0x18')]===_0xe9f4('0x17');var _0x28f8df=_0x14c6db[_0xe9f4('0x19')];var _0x10db8f=_0x18f8d6?0x0:_0x4de971[_0xe9f4('0x16')];var _0xedad3a=_0x18f8d6?_0x14c6db['count']:_0x4de971['offset']+_0x4de971['limit'];var _0x4a57f6;if(_0xedad3a>=_0x28f8df){_0xedad3a=_0x28f8df;_0x4a57f6=0xc8;}else{_0x4a57f6=0xce;}_0x13dba9[_0xe9f4('0x14')](_0x4a57f6);return _0x13dba9[_0xe9f4('0x1a')]('Content-Range',_0x10db8f+'-'+_0xedad3a+'/'+_0x28f8df)[_0xe9f4('0x1b')](_0x14c6db);}return null;};}function patchUpdates(_0x24164b){return function(_0x3cb297){try{jsonpatch[_0xe9f4('0x1c')](_0x3cb297,_0x24164b,!![]);}catch(_0x1b3506){return BPromise[_0xe9f4('0x1d')](_0x1b3506);}return _0x3cb297[_0xe9f4('0x1e')]();};}function saveUpdates(_0x50d3af,_0x4e8358){return function(_0x1bab4a){if(_0x1bab4a){return _0x1bab4a[_0xe9f4('0x1f')](_0x50d3af)[_0xe9f4('0x20')](function(_0x6a5fc5){return _0x6a5fc5;});}return null;};}function removeEntity(_0x3535cc,_0x51b60c){return function(_0x143b2f){if(_0x143b2f){return _0x143b2f['destroy']()[_0xe9f4('0x20')](function(){var _0x281a90=_0x143b2f['get']({'plain':!![]});var _0x388361='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0x388361,'resourceId':_0x281a90['id']}})[_0xe9f4('0x20')](function(){return _0x143b2f;});})[_0xe9f4('0x20')](function(){_0x3535cc[_0xe9f4('0x14')](0xcc)[_0xe9f4('0x15')]();});}};}function handleEntityNotFound(_0x540649,_0x51f8fe){return function(_0x2fe97b){if(!_0x2fe97b){_0x540649[_0xe9f4('0x21')](0x194);}return _0x2fe97b;};}function handleError(_0x1b3cc5,_0x83c62e){_0x83c62e=_0x83c62e||0x1f4;return function(_0x36366b){logger[_0xe9f4('0x22')](_0x36366b[_0xe9f4('0x23')]);if(_0x36366b[_0xe9f4('0x24')]){delete _0x36366b[_0xe9f4('0x24')];}_0x1b3cc5[_0xe9f4('0x14')](_0x83c62e)['send'](_0x36366b);};}exports[_0xe9f4('0x25')]=function(_0x29d94d,_0x354049){var _0x450d4f={},_0x554de8={},_0x1f4966={'count':0x0,'rows':[]};var _0x3ae625=_[_0xe9f4('0x26')](db[_0xe9f4('0x27')]['rawAttributes'],function(_0x42abca){return{'name':_0x42abca[_0xe9f4('0x28')],'type':_0x42abca['type'][_0xe9f4('0x29')]};});_0x554de8['model']=_[_0xe9f4('0x26')](_0x3ae625,_0xe9f4('0x24'));_0x554de8['query']=_[_0xe9f4('0x2a')](_0x29d94d[_0xe9f4('0x2b')]);_0x554de8[_0xe9f4('0x2c')]=_[_0xe9f4('0x2d')](_0x554de8[_0xe9f4('0x2e')],_0x554de8[_0xe9f4('0x2b')]);_0x450d4f[_0xe9f4('0x2f')]=_['intersection'](_0x554de8[_0xe9f4('0x2e')],qs[_0xe9f4('0x30')](_0x29d94d[_0xe9f4('0x2b')][_0xe9f4('0x30')]));_0x450d4f[_0xe9f4('0x2f')]=_0x450d4f['attributes'][_0xe9f4('0x31')]?_0x450d4f[_0xe9f4('0x2f')]:_0x554de8[_0xe9f4('0x2e')];if(!_0x29d94d[_0xe9f4('0x2b')][_0xe9f4('0x32')]('nolimit')){_0x450d4f[_0xe9f4('0x18')]=qs[_0xe9f4('0x18')](_0x29d94d[_0xe9f4('0x2b')][_0xe9f4('0x18')]);_0x450d4f['offset']=qs[_0xe9f4('0x16')](_0x29d94d['query'][_0xe9f4('0x16')]);}_0x450d4f['order']=qs[_0xe9f4('0x33')](_0x29d94d['query'][_0xe9f4('0x33')]);_0x450d4f[_0xe9f4('0x34')]=qs[_0xe9f4('0x2c')](_[_0xe9f4('0x35')](_0x29d94d[_0xe9f4('0x2b')],_0x554de8[_0xe9f4('0x2c')]),_0x3ae625);if(_0x29d94d[_0xe9f4('0x2b')]['filter']){_0x450d4f[_0xe9f4('0x34')]=_[_0xe9f4('0x36')](_0x450d4f[_0xe9f4('0x34')],{'$or':_[_0xe9f4('0x26')](_0x3ae625,function(_0x3c00ad){if(_0x3c00ad[_0xe9f4('0x37')]!==_0xe9f4('0x38')){var _0x56a032={};_0x56a032[_0x3c00ad[_0xe9f4('0x24')]]={'$like':'%'+_0x29d94d[_0xe9f4('0x2b')][_0xe9f4('0x39')]+'%'};return _0x56a032;}})});}_0x450d4f=_[_0xe9f4('0x36')]({},_0x450d4f,_0x29d94d[_0xe9f4('0x3a')]);var _0x59233b={'where':_0x450d4f[_0xe9f4('0x34')]};return db[_0xe9f4('0x27')][_0xe9f4('0x19')](_0x59233b)[_0xe9f4('0x20')](function(_0x440085){_0x1f4966[_0xe9f4('0x19')]=_0x440085;if(_0x29d94d[_0xe9f4('0x2b')]['includeAll']){_0x450d4f['include']=[{'all':!![]}];}return db[_0xe9f4('0x27')][_0xe9f4('0x3b')](_0x450d4f);})[_0xe9f4('0x20')](function(_0x196935){_0x1f4966[_0xe9f4('0x3c')]=_0x196935;return _0x1f4966;})['then'](respondWithFilteredResult(_0x354049,_0x450d4f))[_0xe9f4('0x3d')](handleError(_0x354049,null));};exports[_0xe9f4('0x3e')]=function(_0x23b93b,_0x379bae){var _0xf6cc88={'raw':!![],'where':{'id':_0x23b93b['params']['id']}},_0x386663={};_0x386663[_0xe9f4('0x2e')]=_[_0xe9f4('0x2a')](db[_0xe9f4('0x27')]['rawAttributes']);_0x386663[_0xe9f4('0x2b')]=_[_0xe9f4('0x2a')](_0x23b93b[_0xe9f4('0x2b')]);_0x386663[_0xe9f4('0x2c')]=_[_0xe9f4('0x2d')](_0x386663[_0xe9f4('0x2e')],_0x386663['query']);_0xf6cc88[_0xe9f4('0x2f')]=_[_0xe9f4('0x2d')](_0x386663[_0xe9f4('0x2e')],qs[_0xe9f4('0x30')](_0x23b93b[_0xe9f4('0x2b')][_0xe9f4('0x30')]));_0xf6cc88[_0xe9f4('0x2f')]=_0xf6cc88['attributes'][_0xe9f4('0x31')]?_0xf6cc88[_0xe9f4('0x2f')]:_0x386663[_0xe9f4('0x2e')];if(_0x23b93b[_0xe9f4('0x2b')]['includeAll']){_0xf6cc88[_0xe9f4('0x3f')]=[{'all':!![]}];}_0xf6cc88=_[_0xe9f4('0x36')]({},_0xf6cc88,_0x23b93b[_0xe9f4('0x3a')]);return db[_0xe9f4('0x27')]['find'](_0xf6cc88)[_0xe9f4('0x20')](handleEntityNotFound(_0x379bae,null))[_0xe9f4('0x20')](respondWithResult(_0x379bae,null))[_0xe9f4('0x3d')](handleError(_0x379bae,null));};exports[_0xe9f4('0x40')]=function(_0x1b31d3,_0x40ab6){return db[_0xe9f4('0x27')][_0xe9f4('0x40')](_0x1b31d3['body'],{})[_0xe9f4('0x20')](function(_0x32c523){var _0xbf50cc=_0x1b31d3['user'][_0xe9f4('0x41')]({'plain':!![]});if(!_0xbf50cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbf50cc[_0xe9f4('0x42')]==='user'){var _0x4242fb=_0x32c523[_0xe9f4('0x41')]({'plain':!![]});var _0x1f4eb5=_0xe9f4('0x43');return db[_0xe9f4('0x44')][_0xe9f4('0x45')]({'where':{'name':_0x1f4eb5,'userProfileId':_0xbf50cc[_0xe9f4('0x46')]},'raw':!![]})['then'](function(_0x3ec1b2){if(_0x3ec1b2&&_0x3ec1b2[_0xe9f4('0x47')]===0x0){return db['UserProfileResource'][_0xe9f4('0x40')]({'name':_0x4242fb[_0xe9f4('0x24')],'resourceId':_0x4242fb['id'],'type':_0x3ec1b2['name'],'sectionId':_0x3ec1b2['id']},{})[_0xe9f4('0x20')](function(){return _0x32c523;});}else{return _0x32c523;}})[_0xe9f4('0x3d')](function(_0x2e0887){logger[_0xe9f4('0x22')](_0xe9f4('0x48'),_0x2e0887);throw _0x2e0887;});}return _0x32c523;})[_0xe9f4('0x20')](respondWithResult(_0x40ab6,0xc9))[_0xe9f4('0x3d')](handleError(_0x40ab6,null));};exports[_0xe9f4('0x1f')]=function(_0x9288dd,_0x19fb62){if(_0x9288dd[_0xe9f4('0x49')]['id']){delete _0x9288dd[_0xe9f4('0x49')]['id'];}return db['Pause'][_0xe9f4('0x45')]({'where':{'id':_0x9288dd[_0xe9f4('0x4a')]['id']}})[_0xe9f4('0x20')](handleEntityNotFound(_0x19fb62,null))[_0xe9f4('0x20')](saveUpdates(_0x9288dd[_0xe9f4('0x49')],null))[_0xe9f4('0x20')](respondWithResult(_0x19fb62,null))[_0xe9f4('0x3d')](handleError(_0x19fb62,null));};exports[_0xe9f4('0x4b')]=function(_0x3bfe5f,_0x370c59){return db['Pause'][_0xe9f4('0x45')]({'where':{'id':_0x3bfe5f[_0xe9f4('0x4a')]['id']}})[_0xe9f4('0x20')](handleEntityNotFound(_0x370c59,null))['then'](removeEntity(_0x370c59,null))[_0xe9f4('0x3d')](handleError(_0x370c59,null));}; \ No newline at end of file +var _0xde32=['../../config/environment','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','error','name','send','map','Pause','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xde32,0x11f));var _0x2de3=function(_0x43a5a8,_0x3501da){_0x43a5a8=_0x43a5a8-0x0;var _0xd8e926=_0xde32[_0x43a5a8];return _0xd8e926;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2de3('0x0'));var jsonpatch=require(_0x2de3('0x1'));var rp=require(_0x2de3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2de3('0x3'));var sox=require(_0x2de3('0x4'));var csv=require(_0x2de3('0x5'));var ejs=require(_0x2de3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2de3('0x7'));var squel=require(_0x2de3('0x8'));var crypto=require(_0x2de3('0x9'));var jsforce=require(_0x2de3('0xa'));var deskjs=require(_0x2de3('0xb'));var toCsv=require(_0x2de3('0x5'));var querystring=require(_0x2de3('0xc'));var Papa=require(_0x2de3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2de3('0xe'));var hardwareService=require(_0x2de3('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x2de3('0x10'));var config=require(_0x2de3('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b2fed,_0x117794){_0x117794=_0x117794||0xcc;return function(_0x3ba630){if(_0x3ba630){return _0x3b2fed[_0x2de3('0x12')](_0x117794);}return _0x3b2fed['status'](_0x117794)[_0x2de3('0x13')]();};}function respondWithResult(_0x5f3906,_0x5a0a43){_0x5a0a43=_0x5a0a43||0xc8;return function(_0x436b60){if(_0x436b60){return _0x5f3906[_0x2de3('0x14')](_0x5a0a43)[_0x2de3('0x15')](_0x436b60);}};}function respondWithFilteredResult(_0x38c932,_0x5bfde8){return function(_0x7635cc){if(_0x7635cc){var _0x3b9c5b=typeof _0x5bfde8['offset']===_0x2de3('0x16')&&typeof _0x5bfde8['limit']===_0x2de3('0x16');var _0x4c486f=_0x7635cc[_0x2de3('0x17')];var _0x3fc6d4=_0x3b9c5b?0x0:_0x5bfde8[_0x2de3('0x18')];var _0xa48ca2=_0x3b9c5b?_0x7635cc['count']:_0x5bfde8[_0x2de3('0x18')]+_0x5bfde8[_0x2de3('0x19')];var _0x13afbe;if(_0xa48ca2>=_0x4c486f){_0xa48ca2=_0x4c486f;_0x13afbe=0xc8;}else{_0x13afbe=0xce;}_0x38c932['status'](_0x13afbe);return _0x38c932['set'](_0x2de3('0x1a'),_0x3fc6d4+'-'+_0xa48ca2+'/'+_0x4c486f)['json'](_0x7635cc);}return null;};}function patchUpdates(_0x478174){return function(_0x35250a){try{jsonpatch[_0x2de3('0x1b')](_0x35250a,_0x478174,!![]);}catch(_0x16e0c6){return BPromise[_0x2de3('0x1c')](_0x16e0c6);}return _0x35250a[_0x2de3('0x1d')]();};}function saveUpdates(_0x211a7d,_0x1a6bd9){return function(_0x50e1b9){if(_0x50e1b9){return _0x50e1b9['update'](_0x211a7d)[_0x2de3('0x1e')](function(_0x123c79){return _0x123c79;});}return null;};}function removeEntity(_0x30e57b,_0xb43bea){return function(_0xc62dd6){if(_0xc62dd6){return _0xc62dd6[_0x2de3('0x1f')]()[_0x2de3('0x1e')](function(){var _0xbe4d52=_0xc62dd6['get']({'plain':!![]});var _0x1d990f=_0x2de3('0x20');return db[_0x2de3('0x21')][_0x2de3('0x1f')]({'where':{'type':_0x1d990f,'resourceId':_0xbe4d52['id']}})[_0x2de3('0x1e')](function(){return _0xc62dd6;});})[_0x2de3('0x1e')](function(){_0x30e57b[_0x2de3('0x14')](0xcc)[_0x2de3('0x13')]();});}};}function handleEntityNotFound(_0x293c67,_0x42a7d9){return function(_0x2b9f6d){if(!_0x2b9f6d){_0x293c67[_0x2de3('0x12')](0x194);}return _0x2b9f6d;};}function handleError(_0x48a132,_0x4a186b){_0x4a186b=_0x4a186b||0x1f4;return function(_0x2e4132){logger[_0x2de3('0x22')](_0x2e4132['stack']);if(_0x2e4132[_0x2de3('0x23')]){delete _0x2e4132[_0x2de3('0x23')];}_0x48a132[_0x2de3('0x14')](_0x4a186b)[_0x2de3('0x24')](_0x2e4132);};}exports['index']=function(_0x30595a,_0x203765){var _0xd1ac5f={},_0x256a05={},_0x4389ea={'count':0x0,'rows':[]};var _0x480a2b=_[_0x2de3('0x25')](db[_0x2de3('0x26')][_0x2de3('0x27')],function(_0x31c1c8){return{'name':_0x31c1c8['fieldName'],'type':_0x31c1c8[_0x2de3('0x28')][_0x2de3('0x29')]};});_0x256a05[_0x2de3('0x2a')]=_[_0x2de3('0x25')](_0x480a2b,_0x2de3('0x23'));_0x256a05[_0x2de3('0x2b')]=_[_0x2de3('0x2c')](_0x30595a[_0x2de3('0x2b')]);_0x256a05['filters']=_[_0x2de3('0x2d')](_0x256a05[_0x2de3('0x2a')],_0x256a05[_0x2de3('0x2b')]);_0xd1ac5f[_0x2de3('0x2e')]=_[_0x2de3('0x2d')](_0x256a05[_0x2de3('0x2a')],qs[_0x2de3('0x2f')](_0x30595a[_0x2de3('0x2b')]['fields']));_0xd1ac5f[_0x2de3('0x2e')]=_0xd1ac5f['attributes'][_0x2de3('0x30')]?_0xd1ac5f['attributes']:_0x256a05['model'];if(!_0x30595a[_0x2de3('0x2b')][_0x2de3('0x31')](_0x2de3('0x32'))){_0xd1ac5f[_0x2de3('0x19')]=qs[_0x2de3('0x19')](_0x30595a['query']['limit']);_0xd1ac5f['offset']=qs[_0x2de3('0x18')](_0x30595a[_0x2de3('0x2b')][_0x2de3('0x18')]);}_0xd1ac5f['order']=qs[_0x2de3('0x33')](_0x30595a[_0x2de3('0x2b')][_0x2de3('0x33')]);_0xd1ac5f['where']=qs[_0x2de3('0x34')](_[_0x2de3('0x35')](_0x30595a[_0x2de3('0x2b')],_0x256a05['filters']),_0x480a2b);if(_0x30595a[_0x2de3('0x2b')][_0x2de3('0x36')]){_0xd1ac5f['where']=_['merge'](_0xd1ac5f[_0x2de3('0x37')],{'$or':_[_0x2de3('0x25')](_0x480a2b,function(_0x3c82cb){if(_0x3c82cb['type']!==_0x2de3('0x38')){var _0x147bcd={};_0x147bcd[_0x3c82cb[_0x2de3('0x23')]]={'$like':'%'+_0x30595a['query']['filter']+'%'};return _0x147bcd;}})});}_0xd1ac5f=_['merge']({},_0xd1ac5f,_0x30595a[_0x2de3('0x39')]);var _0x524d16={'where':_0xd1ac5f[_0x2de3('0x37')]};return db[_0x2de3('0x26')][_0x2de3('0x17')](_0x524d16)[_0x2de3('0x1e')](function(_0x521e73){_0x4389ea['count']=_0x521e73;if(_0x30595a[_0x2de3('0x2b')][_0x2de3('0x3a')]){_0xd1ac5f[_0x2de3('0x3b')]=[{'all':!![]}];}return db[_0x2de3('0x26')]['findAll'](_0xd1ac5f);})[_0x2de3('0x1e')](function(_0x45cda3){_0x4389ea[_0x2de3('0x3c')]=_0x45cda3;return _0x4389ea;})[_0x2de3('0x1e')](respondWithFilteredResult(_0x203765,_0xd1ac5f))['catch'](handleError(_0x203765,null));};exports[_0x2de3('0x3d')]=function(_0x5a233f,_0x59a31f){var _0x1553c9={'raw':!![],'where':{'id':_0x5a233f[_0x2de3('0x3e')]['id']}},_0x4a2145={};_0x4a2145['model']=_[_0x2de3('0x2c')](db[_0x2de3('0x26')][_0x2de3('0x27')]);_0x4a2145[_0x2de3('0x2b')]=_[_0x2de3('0x2c')](_0x5a233f[_0x2de3('0x2b')]);_0x4a2145[_0x2de3('0x34')]=_[_0x2de3('0x2d')](_0x4a2145[_0x2de3('0x2a')],_0x4a2145[_0x2de3('0x2b')]);_0x1553c9['attributes']=_['intersection'](_0x4a2145['model'],qs[_0x2de3('0x2f')](_0x5a233f[_0x2de3('0x2b')][_0x2de3('0x2f')]));_0x1553c9[_0x2de3('0x2e')]=_0x1553c9['attributes'][_0x2de3('0x30')]?_0x1553c9[_0x2de3('0x2e')]:_0x4a2145[_0x2de3('0x2a')];if(_0x5a233f[_0x2de3('0x2b')]['includeAll']){_0x1553c9[_0x2de3('0x3b')]=[{'all':!![]}];}_0x1553c9=_[_0x2de3('0x3f')]({},_0x1553c9,_0x5a233f[_0x2de3('0x39')]);return db['Pause'][_0x2de3('0x40')](_0x1553c9)[_0x2de3('0x1e')](handleEntityNotFound(_0x59a31f,null))[_0x2de3('0x1e')](respondWithResult(_0x59a31f,null))['catch'](handleError(_0x59a31f,null));};exports[_0x2de3('0x41')]=function(_0x55942c,_0xd42102){return db['Pause'][_0x2de3('0x41')](_0x55942c[_0x2de3('0x42')],{})[_0x2de3('0x1e')](function(_0x54dd32){var _0x53f7ff=_0x55942c['user'][_0x2de3('0x43')]({'plain':!![]});if(!_0x53f7ff)throw new Error(_0x2de3('0x44'));if(_0x53f7ff[_0x2de3('0x45')]==='user'){var _0x454b81=_0x54dd32[_0x2de3('0x43')]({'plain':!![]});var _0x3c574f='Pauses';return db[_0x2de3('0x46')][_0x2de3('0x40')]({'where':{'name':_0x3c574f,'userProfileId':_0x53f7ff[_0x2de3('0x47')]},'raw':!![]})[_0x2de3('0x1e')](function(_0x2ff9f0){if(_0x2ff9f0&&_0x2ff9f0[_0x2de3('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x454b81['name'],'resourceId':_0x454b81['id'],'type':_0x2ff9f0[_0x2de3('0x23')],'sectionId':_0x2ff9f0['id']},{})[_0x2de3('0x1e')](function(){return _0x54dd32;});}else{return _0x54dd32;}})[_0x2de3('0x49')](function(_0x2662c0){logger[_0x2de3('0x22')](_0x2de3('0x4a'),_0x2662c0);throw _0x2662c0;});}return _0x54dd32;})[_0x2de3('0x1e')](respondWithResult(_0xd42102,0xc9))['catch'](handleError(_0xd42102,null));};exports[_0x2de3('0x4b')]=function(_0x539d9f,_0x1316f0){if(_0x539d9f['body']['id']){delete _0x539d9f['body']['id'];}return db[_0x2de3('0x26')][_0x2de3('0x40')]({'where':{'id':_0x539d9f[_0x2de3('0x3e')]['id']}})[_0x2de3('0x1e')](handleEntityNotFound(_0x1316f0,null))[_0x2de3('0x1e')](saveUpdates(_0x539d9f[_0x2de3('0x42')],null))[_0x2de3('0x1e')](respondWithResult(_0x1316f0,null))[_0x2de3('0x49')](handleError(_0x1316f0,null));};exports[_0x2de3('0x1f')]=function(_0x3f95d4,_0x5491a0){return db[_0x2de3('0x26')][_0x2de3('0x40')]({'where':{'id':_0x3f95d4[_0x2de3('0x3e')]['id']}})[_0x2de3('0x1e')](handleEntityNotFound(_0x5491a0,null))['then'](removeEntity(_0x5491a0,null))[_0x2de3('0x49')](handleError(_0x5491a0,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 1abf757..d193f61 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x7217,0x19e));var _0x7721=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x7217[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f6c39f2..41a4605 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(_0x48d29f,_0x547bd5){var _0x54849f=function(_0x3fcc24){while(--_0x3fcc24){_0x48d29f['push'](_0x48d29f['shift']());}};_0x54849f(++_0x547bd5);}(_0x7a54,0x106));var _0x47a5=function(_0x31279d,_0x5e1e67){_0x31279d=_0x31279d-0x0;var _0x4f64f0=_0x7a54[_0x31279d];return _0x4f64f0;};'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(_0x2ad648,_0x2db2be){var _0x57b907=function(_0x17800d){while(--_0x17800d){_0x2ad648['push'](_0x2ad648['shift']());}};_0x57b907(++_0x2db2be);}(_0x7a54,0x106));var _0x47a5=function(_0x28ee6d,_0x58aa5c){_0x28ee6d=_0x28ee6d-0x0;var _0x429971=_0x7a54[_0x28ee6d];return _0x429971;};'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 c726fed..e49b68f 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 _0x8d0e=['basename','extname','now','post','file','upload','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/plugins','originalname','replace'];(function(_0x37ba9d,_0x562a9c){var _0x2a3d6f=function(_0x1fe0c4){while(--_0x1fe0c4){_0x37ba9d['push'](_0x37ba9d['shift']());}};_0x2a3d6f(++_0x562a9c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x39f36f,_0x2db91e){_0x39f36f=_0x39f36f-0x0;var _0x21781f=_0x8d0e[_0x39f36f];return _0x21781f;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xb')](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x10')]);router['get'](_0xe8d0('0x11'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x580aab,_0x42e0c2,_0x25e6b8){_0x25e6b8(null,path[_0xe8d0('0x13')](config[_0xe8d0('0x14')],_0xe8d0('0x15')));},'filename':function(_0x41de69,_0x5934b2,_0x38fac0){_0x5934b2[_0xe8d0('0x16')]=_0x5934b2['originalname'][_0xe8d0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38fac0(null,util['format']('%s-%s%s',path[_0xe8d0('0x18')](_0x5934b2[_0xe8d0('0x16')],path[_0xe8d0('0x19')](_0x5934b2[_0xe8d0('0x16')])),Date[_0xe8d0('0x1a')](),path[_0xe8d0('0x19')](_0x5934b2['originalname'])));}})});router[_0xe8d0('0x1b')]('/',upload['single'](_0xe8d0('0x1c')),controller[_0xe8d0('0x1d')]);router[_0xe8d0('0x1b')]('/webhook',controller['webhookPost']);router['put'](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x1e')]);router[_0xe8d0('0x1f')](_0xe8d0('0xe'),auth['isAuthenticated'](),controller[_0xe8d0('0x1f')]);module[_0xe8d0('0x20')]=router; \ No newline at end of file +var _0x54ef=['show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','extname','post','upload','webhookPost','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','get','/webhook','isAuthenticated'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x54ef,0x112));var _0xf54e=function(_0x2604c2,_0x2689af){_0x2604c2=_0x2604c2-0x0;var _0x1be0c0=_0x54ef[_0x2604c2];return _0x1be0c0;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),controller['webhookGet']);router[_0xf54e('0xb')]('/:id',auth[_0xf54e('0xd')](),controller[_0xf54e('0xe')]);router['get'](_0xf54e('0xf'),auth[_0xf54e('0xd')](),controller[_0xf54e('0x10')]);var upload=multer({'storage':multer[_0xf54e('0x11')]({'destination':function(_0x5f232a,_0x558502,_0xc939ab){_0xc939ab(null,path[_0xf54e('0x12')](config[_0xf54e('0x13')],'server/files/plugins'));},'filename':function(_0x358c88,_0x4b0ee1,_0x4bd828){_0x4b0ee1[_0xf54e('0x14')]=_0x4b0ee1[_0xf54e('0x14')][_0xf54e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd828(null,util[_0xf54e('0x16')]('%s-%s%s',path[_0xf54e('0x17')](_0x4b0ee1[_0xf54e('0x14')],path[_0xf54e('0x18')](_0x4b0ee1[_0xf54e('0x14')])),Date['now'](),path[_0xf54e('0x18')](_0x4b0ee1[_0xf54e('0x14')])));}})});router[_0xf54e('0x19')]('/',upload['single']('file'),controller[_0xf54e('0x1a')]);router[_0xf54e('0x19')](_0xf54e('0xc'),controller[_0xf54e('0x1b')]);router[_0xf54e('0x1c')](_0xf54e('0x1d'),auth[_0xf54e('0xd')](),controller[_0xf54e('0x1e')]);router[_0xf54e('0x1f')](_0xf54e('0x1d'),auth[_0xf54e('0xd')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 66d068d..9a5e733 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 _0xdb01=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdb01,0x1b8));var _0x1db0=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0xdb01[_0x529f1c];return _0x4d57ab;};'use strict';var Sequelize=require(_0x1db0('0x0'));module['exports']={'name':{'type':Sequelize[_0x1db0('0x1')]},'type':{'type':Sequelize[_0x1db0('0x2')](_0x1db0('0x3'),_0x1db0('0x4'))},'description':{'type':Sequelize[_0x1db0('0x5')]},'version':{'type':Sequelize[_0x1db0('0x5')]},'path':{'type':Sequelize[_0x1db0('0x1')],'comment':_0x1db0('0x6')},'active':{'type':Sequelize[_0x1db0('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x1db0('0x2')](_0x1db0('0x8'),_0x1db0('0x9'),_0x1db0('0xa'),_0x1db0('0xb')),'defaultValue':_0x1db0('0xa'),'comment':_0x1db0('0xc')},'icon':{'type':Sequelize[_0x1db0('0x1')]},'adminUrl':{'type':Sequelize[_0x1db0('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1db0('0x1')]}}; \ No newline at end of file +var _0x43b0=['sequelize','STRING','ENUM','html','script','TEXT','BOOLEAN','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x24d0ed,_0x15735a){var _0x5ca169=function(_0x21a028){while(--_0x21a028){_0x24d0ed['push'](_0x24d0ed['shift']());}};_0x5ca169(++_0x15735a);}(_0x43b0,0x11e));var _0x043b=function(_0x3a5fba,_0x120224){_0x3a5fba=_0x3a5fba-0x0;var _0x291753=_0x43b0[_0x3a5fba];return _0x291753;};'use strict';var Sequelize=require(_0x043b('0x0'));module['exports']={'name':{'type':Sequelize[_0x043b('0x1')]},'type':{'type':Sequelize[_0x043b('0x2')](_0x043b('0x3'),_0x043b('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x043b('0x5')]},'path':{'type':Sequelize[_0x043b('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x043b('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x043b('0x2')]('adminOnly',_0x043b('0x7'),_0x043b('0x8'),_0x043b('0x9')),'defaultValue':_0x043b('0x8'),'comment':_0x043b('0xa')},'icon':{'type':Sequelize[_0x043b('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x043b('0x1')]},'scriptPath':{'type':Sequelize[_0x043b('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9055739..d8cc94a 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 _0xf2e5=['Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','plugins','agent','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','count','set','Content-Range','apply','save','update','get','Plugins','destroy','then','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','download','find','join','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','length','some','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','parameters','scriptName'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0xf2e5,0x18b));var _0x5f2e=function(_0x411631,_0x5cc5c3){_0x411631=_0x411631-0x0;var _0x490190=_0xf2e5[_0x411631];return _0x490190;};'use strict';var emlformat=require(_0x5f2e('0x0'));var rimraf=require(_0x5f2e('0x1'));var zipdir=require(_0x5f2e('0x2'));var jsonpatch=require(_0x5f2e('0x3'));var rp=require('request-promise');var moment=require(_0x5f2e('0x4'));var BPromise=require(_0x5f2e('0x5'));var Mustache=require(_0x5f2e('0x6'));var util=require(_0x5f2e('0x7'));var path=require(_0x5f2e('0x8'));var sox=require(_0x5f2e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f2e('0xa'));var _=require(_0x5f2e('0xb'));var squel=require(_0x5f2e('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f2e('0xd'));var deskjs=require(_0x5f2e('0xe'));var toCsv=require(_0x5f2e('0xf'));var querystring=require('querystring');var Papa=require(_0x5f2e('0x10'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x5f2e('0x11'));var Redis=require(_0x5f2e('0x12'));var authService=require(_0x5f2e('0x13'));var qs=require(_0x5f2e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f2e('0x15'));var logger=require(_0x5f2e('0x16'))('api');var utils=require(_0x5f2e('0x17'));var config=require(_0x5f2e('0x18'));var licenseUtil=require(_0x5f2e('0x19'));var db=require(_0x5f2e('0x1a'))['db'];config[_0x5f2e('0x1b')]=_[_0x5f2e('0x1c')](config[_0x5f2e('0x1b')],{'host':_0x5f2e('0x1d'),'port':0x18eb});var socket=require(_0x5f2e('0x1e'))(new Redis(config[_0x5f2e('0x1b')]));require(_0x5f2e('0x1f'))[_0x5f2e('0x20')](socket);function respondWithStatusCode(_0x177ebb,_0x5db886){_0x5db886=_0x5db886||0xcc;return function(_0x51d588){if(_0x51d588){return _0x177ebb[_0x5f2e('0x21')](_0x5db886);}return _0x177ebb[_0x5f2e('0x22')](_0x5db886)[_0x5f2e('0x23')]();};}function respondWithResult(_0x29b6c5,_0x5a4c72){_0x5a4c72=_0x5a4c72||0xc8;return function(_0x58ecfc){if(_0x58ecfc){return _0x29b6c5[_0x5f2e('0x22')](_0x5a4c72)[_0x5f2e('0x24')](_0x58ecfc);}};}function respondWithFilteredResult(_0x56b77b,_0x56b419){return function(_0x419cc9){if(_0x419cc9){var _0x4d5720=typeof _0x56b419[_0x5f2e('0x25')]==='undefined'&&typeof _0x56b419['limit']==='undefined';var _0x54c410=_0x419cc9[_0x5f2e('0x26')];var _0x937b65=_0x4d5720?0x0:_0x56b419[_0x5f2e('0x25')];var _0x442873=_0x4d5720?_0x419cc9[_0x5f2e('0x26')]:_0x56b419[_0x5f2e('0x25')]+_0x56b419['limit'];var _0x1e86ce;if(_0x442873>=_0x54c410){_0x442873=_0x54c410;_0x1e86ce=0xc8;}else{_0x1e86ce=0xce;}_0x56b77b[_0x5f2e('0x22')](_0x1e86ce);return _0x56b77b[_0x5f2e('0x27')](_0x5f2e('0x28'),_0x937b65+'-'+_0x442873+'/'+_0x54c410)[_0x5f2e('0x24')](_0x419cc9);}return null;};}function patchUpdates(_0x16e1ba){return function(_0x24522c){try{jsonpatch[_0x5f2e('0x29')](_0x24522c,_0x16e1ba,!![]);}catch(_0x36c8a1){return BPromise['reject'](_0x36c8a1);}return _0x24522c[_0x5f2e('0x2a')]();};}function saveUpdates(_0x545af8,_0x4a2f07){return function(_0x4bded0){if(_0x4bded0){return _0x4bded0[_0x5f2e('0x2b')](_0x545af8)['then'](function(_0x17d6b0){return _0x17d6b0;});}return null;};}function removeEntity(_0x5ae8df,_0x1f8a2c){return function(_0x45cb92){if(_0x45cb92){return _0x45cb92['destroy']()['then'](function(){var _0x1a3ba1=_0x45cb92[_0x5f2e('0x2c')]({'plain':!![]});var _0x22ae3e=_0x5f2e('0x2d');return db['UserProfileResource'][_0x5f2e('0x2e')]({'where':{'type':_0x22ae3e,'resourceId':_0x1a3ba1['id']}})['then'](function(){return _0x45cb92;});})[_0x5f2e('0x2f')](function(){_0x5ae8df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae2fc,_0xd01fb5){return function(_0x18ad7a){if(!_0x18ad7a){_0x2ae2fc[_0x5f2e('0x21')](0x194);}return _0x18ad7a;};}function handleError(_0x50c4c2,_0x3aa192){_0x3aa192=_0x3aa192||0x1f4;return function(_0x54033d){logger[_0x5f2e('0x30')](_0x54033d[_0x5f2e('0x31')]);if(_0x54033d[_0x5f2e('0x32')]){delete _0x54033d['name'];}_0x50c4c2[_0x5f2e('0x22')](_0x3aa192)['send'](_0x54033d);};}exports[_0x5f2e('0x33')]=function(_0x3a16a4,_0x23a9ce){var _0x22e6e1={},_0x5179c9={},_0x3b7595={'count':0x0,'rows':[]};var _0x130eeb=_[_0x5f2e('0x34')](db[_0x5f2e('0x35')][_0x5f2e('0x36')],function(_0x14c2a2){return{'name':_0x14c2a2[_0x5f2e('0x37')],'type':_0x14c2a2[_0x5f2e('0x38')][_0x5f2e('0x39')]};});_0x5179c9[_0x5f2e('0x3a')]=_[_0x5f2e('0x34')](_0x130eeb,_0x5f2e('0x32'));_0x5179c9[_0x5f2e('0x3b')]=_[_0x5f2e('0x3c')](_0x3a16a4[_0x5f2e('0x3b')]);_0x5179c9[_0x5f2e('0x3d')]=_[_0x5f2e('0x3e')](_0x5179c9[_0x5f2e('0x3a')],_0x5179c9[_0x5f2e('0x3b')]);_0x22e6e1[_0x5f2e('0x3f')]=_[_0x5f2e('0x3e')](_0x5179c9[_0x5f2e('0x3a')],qs[_0x5f2e('0x40')](_0x3a16a4[_0x5f2e('0x3b')][_0x5f2e('0x40')]));_0x22e6e1['attributes']=_0x22e6e1[_0x5f2e('0x3f')]['length']?_0x22e6e1[_0x5f2e('0x3f')]:_0x5179c9[_0x5f2e('0x3a')];if(!_0x3a16a4['query'][_0x5f2e('0x41')](_0x5f2e('0x42'))){_0x22e6e1[_0x5f2e('0x43')]=qs[_0x5f2e('0x43')](_0x3a16a4[_0x5f2e('0x3b')]['limit']);_0x22e6e1[_0x5f2e('0x25')]=qs['offset'](_0x3a16a4[_0x5f2e('0x3b')][_0x5f2e('0x25')]);}_0x22e6e1[_0x5f2e('0x44')]=qs[_0x5f2e('0x45')](_0x3a16a4['query'][_0x5f2e('0x45')]);_0x22e6e1[_0x5f2e('0x46')]=qs[_0x5f2e('0x3d')](_[_0x5f2e('0x47')](_0x3a16a4[_0x5f2e('0x3b')],_0x5179c9[_0x5f2e('0x3d')]),_0x130eeb);if(_0x3a16a4['query'][_0x5f2e('0x48')]){_0x22e6e1[_0x5f2e('0x46')]=_[_0x5f2e('0x49')](_0x22e6e1['where'],{'$or':_[_0x5f2e('0x34')](_0x130eeb,function(_0x211d3c){if(_0x211d3c[_0x5f2e('0x38')]!==_0x5f2e('0x4a')){var _0x50d7b3={};_0x50d7b3[_0x211d3c[_0x5f2e('0x32')]]={'$like':'%'+_0x3a16a4[_0x5f2e('0x3b')][_0x5f2e('0x48')]+'%'};return _0x50d7b3;}})});}_0x22e6e1=_[_0x5f2e('0x49')]({},_0x22e6e1,_0x3a16a4[_0x5f2e('0x4b')]);var _0x9d482e={'where':_0x22e6e1[_0x5f2e('0x46')]};return db[_0x5f2e('0x35')][_0x5f2e('0x26')](_0x9d482e)['then'](function(_0x41c2b3){_0x3b7595[_0x5f2e('0x26')]=_0x41c2b3;if(_0x3a16a4[_0x5f2e('0x3b')][_0x5f2e('0x4c')]){_0x22e6e1[_0x5f2e('0x4d')]=[{'all':!![]}];}return db[_0x5f2e('0x35')][_0x5f2e('0x4e')](_0x22e6e1);})[_0x5f2e('0x2f')](function(_0x240298){_0x3b7595[_0x5f2e('0x4f')]=_0x240298;return _0x3b7595;})[_0x5f2e('0x2f')](respondWithFilteredResult(_0x23a9ce,_0x22e6e1))[_0x5f2e('0x50')](handleError(_0x23a9ce,null));};exports[_0x5f2e('0x51')]=function(_0x142b20,_0x3c1c5f){var _0x5f141d={'raw':!![],'where':{'id':_0x142b20[_0x5f2e('0x52')]['id']}},_0x292087={};_0x292087['model']=_[_0x5f2e('0x3c')](db[_0x5f2e('0x35')]['rawAttributes']);_0x292087[_0x5f2e('0x3b')]=_[_0x5f2e('0x3c')](_0x142b20[_0x5f2e('0x3b')]);_0x292087['filters']=_['intersection'](_0x292087[_0x5f2e('0x3a')],_0x292087['query']);_0x5f141d[_0x5f2e('0x3f')]=_[_0x5f2e('0x3e')](_0x292087[_0x5f2e('0x3a')],qs[_0x5f2e('0x40')](_0x142b20[_0x5f2e('0x3b')][_0x5f2e('0x40')]));_0x5f141d[_0x5f2e('0x3f')]=_0x5f141d[_0x5f2e('0x3f')]['length']?_0x5f141d['attributes']:_0x292087[_0x5f2e('0x3a')];if(_0x142b20[_0x5f2e('0x3b')][_0x5f2e('0x4c')]){_0x5f141d['include']=[{'all':!![]}];}_0x5f141d=_[_0x5f2e('0x49')]({},_0x5f141d,_0x142b20[_0x5f2e('0x4b')]);return db['Plugin']['find'](_0x5f141d)[_0x5f2e('0x2f')](handleEntityNotFound(_0x3c1c5f,null))[_0x5f2e('0x2f')](respondWithResult(_0x3c1c5f,null))[_0x5f2e('0x50')](handleError(_0x3c1c5f,null));};exports[_0x5f2e('0x53')]=function(_0x1fa74a,_0x4bac43,_0x2ad7d0){return db[_0x5f2e('0x35')][_0x5f2e('0x54')]({'where':{'id':_0x1fa74a[_0x5f2e('0x52')]['id']},'attributes':[_0x5f2e('0x32'),_0x5f2e('0x8')],'raw':!![]})[_0x5f2e('0x2f')](handleEntityNotFound(_0x4bac43,null))[_0x5f2e('0x2f')](function(_0x47c42b){if(_0x47c42b){var _0x317226=path[_0x5f2e('0x55')](config['root'],_0x5f2e('0x56'),util['format'](_0x5f2e('0x57'),path[_0x5f2e('0x58')](_0x47c42b[_0x5f2e('0x8')])));var _0x493226=fs[_0x5f2e('0x59')](_0x317226);var _0x376573=archiver(_0x5f2e('0x5a'),{'zlib':{'level':0x9}});_0x376573['on'](_0x5f2e('0x5b'),function(_0x503e73){if(_0x503e73[_0x5f2e('0x5c')]==='ENOENT'){logger[_0x5f2e('0x30')](_0x503e73);}else{throw new db[(_0x5f2e('0x5d'))][(_0x5f2e('0x5e'))](_0x5f2e('0x5f'));}});_0x376573['on'](_0x5f2e('0x30'),function(_0xac66b3){throw new db[(_0x5f2e('0x5d'))]['Error'](_0x5f2e('0x5f'));});_0x376573[_0x5f2e('0x60')](_0x493226);_0x376573[_0x5f2e('0x61')](_0x5f2e('0x62'),{'cwd':path[_0x5f2e('0x55')](config['root'],_0x5f2e('0x56'),path[_0x5f2e('0x63')](_0x47c42b[_0x5f2e('0x8')])),'ignore':[path[_0x5f2e('0x55')](path[_0x5f2e('0x58')](_0x47c42b[_0x5f2e('0x8')]),_0x5f2e('0x64')),path[_0x5f2e('0x55')](path[_0x5f2e('0x58')](_0x47c42b['path']),'attachments/**/*')],'nodir':!![]})[_0x5f2e('0x65')]();_0x493226['on']('close',function(){if(!fs[_0x5f2e('0x66')](_0x317226)){throw new db[(_0x5f2e('0x5d'))][(_0x5f2e('0x5e'))](_0x5f2e('0x67'));}return _0x4bac43[_0x5f2e('0x53')](_0x317226,util['format'](_0x5f2e('0x57'),path[_0x5f2e('0x58')](_0x47c42b[_0x5f2e('0x8')])),function(_0xe1214b){if(_0xe1214b){throw new db[(_0x5f2e('0x5d'))]['Error'](_0x5f2e('0x68'));}fs[_0x5f2e('0x69')](_0x317226);logger[_0x5f2e('0x6a')]('Download\x20completed');logger[_0x5f2e('0x6a')](_0x5f2e('0x6b'));});});}return null;})[_0x5f2e('0x50')](handleError(_0x4bac43,null));};exports[_0x5f2e('0x6c')]=function(_0x3be0f6,_0x5252b3,_0x3fa7c2){var _0xfecd90=path[_0x5f2e('0x58')](_0x3be0f6[_0x5f2e('0x6d')][_0x5f2e('0x6e')],path[_0x5f2e('0x6f')](_0x3be0f6[_0x5f2e('0x6d')][_0x5f2e('0x6e')]));var _0xb0ce53=path[_0x5f2e('0x55')](config['root'],_0x5f2e('0x56'),_0x3be0f6[_0x5f2e('0x6d')][_0x5f2e('0x6e')]);var _0x291f27=path[_0x5f2e('0x55')](config[_0x5f2e('0x70')],'server/files/plugins',_0xfecd90);logger[_0x5f2e('0x6a')](_0x5f2e('0x71'),_0xb0ce53);logger['info'](_0x5f2e('0x72'),_0x291f27);try{fs[_0x5f2e('0x73')](_0xb0ce53,parseInt(_0x5f2e('0x74'),0x8));extract(_0xb0ce53,{'dir':_0x291f27},function(_0x167430){if(_0x167430){logger[_0x5f2e('0x30')](_0x167430);handleError(_0x167430,!![]);};var _0x3527c3=fs[_0x5f2e('0x75')](_0x291f27);if(_0x3527c3['length']>0x1){removeReferences(_0xb0ce53,_0x291f27);logger[_0x5f2e('0x30')](_0x5f2e('0x76'));return _0x3fa7c2(new Error('Invalid\x20plugin\x20structure'));}var _0x6997ff=fs['lstatSync'](path[_0x5f2e('0x55')](_0x291f27,_0x3527c3[0x0]));if(_0x6997ff[_0x5f2e('0x77')]()){removeReferences(_0xb0ce53,_0x291f27);logger[_0x5f2e('0x30')](_0x5f2e('0x76'));return _0x3fa7c2(new Error(_0x5f2e('0x76')));}if(_0x6997ff['isDirectory']()){var _0x345595=fs['readdirSync'](path[_0x5f2e('0x55')](_0x291f27,_0x3527c3[0x0]));if(_0x345595[_0x5f2e('0x78')]===0x0){removeReferences(_0xb0ce53,_0x291f27);logger[_0x5f2e('0x30')](_0x5f2e('0x76'));return _0x3fa7c2(new Error(_0x5f2e('0x76')));}var _0x3670cf=_0x345595[_0x5f2e('0x79')](function(_0x26ed59){return _0x26ed59==='manifest.json';});if(!_0x3670cf){return _0x3fa7c2(new Error('Plugin\x20manifest\x20missing'));}var _0x540584=fs[_0x5f2e('0x7a')](path[_0x5f2e('0x55')](_0x291f27,_0x3527c3[0x0],_0x5f2e('0x7b')));var _0x2657de=JSON[_0x5f2e('0x7c')](_0x540584);if(_0x5f2e('0x7d')==typeof _0x2657de[_0x5f2e('0x32')]){return _0x3fa7c2(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x5f2e('0x7d')==typeof _0x2657de[_0x5f2e('0x38')]){return _0x3fa7c2(new Error(_0x5f2e('0x7e')));}if(_0x5f2e('0x7d')==typeof _0x2657de[_0x5f2e('0x7f')]){return _0x3fa7c2(new Error(_0x5f2e('0x80')));}if(_0x5f2e('0x7d')==typeof _0x2657de['parameters']){return _0x3fa7c2(new Error(_0x5f2e('0x81')));}if(_0x2657de[_0x5f2e('0x38')]===_0x5f2e('0x82')){if('undefined'==typeof _0x2657de['parameters'][_0x5f2e('0x83')]){return _0x3fa7c2(new Error(_0x5f2e('0x84')));}if(_0x5f2e('0x7d')==typeof _0x2657de['parameters']['views'][_0x5f2e('0x85')]&&'undefined'==typeof _0x2657de['parameters'][_0x5f2e('0x83')]['agent']){return _0x3fa7c2(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x2657de[_0x5f2e('0x38')]==='script'){if(_0x5f2e('0x7d')==typeof _0x2657de[_0x5f2e('0x86')][_0x5f2e('0x87')]){return _0x3fa7c2(new Error(_0x5f2e('0x88')));}if(_0x5f2e('0x7d')==typeof _0x2657de[_0x5f2e('0x86')][_0x5f2e('0x89')]){return _0x3fa7c2(new Error(_0x5f2e('0x8a')));}}else{return _0x3fa7c2(new Error(_0x5f2e('0x8b')));}var _0x2dcfdf=_0x2657de[_0x5f2e('0x32')];var _0x1dbf72=_0x2657de[_0x5f2e('0x8c')];var _0xd65527=_0x2657de[_0x5f2e('0x38')];var _0x4eb083=_0x2657de[_0x5f2e('0x8d')]?_0x2657de['sidebar']:_0x5f2e('0x8e');var _0x392686=_0x2657de[_0x5f2e('0x8f')]?_0x2657de[_0x5f2e('0x8f')]:'icon-apps';var _0x1833f2='';var _0x56d4eb='';var _0x5e9ef3='';var _0xc1ebd9='';var _0x7746fe=_0x2657de['version'];if(_0xd65527==='html'){if('undefined'!=typeof _0x2657de[_0x5f2e('0x86')][_0x5f2e('0x83')][_0x5f2e('0x85')]){var _0x35ea75=_0x2657de[_0x5f2e('0x86')]['views'][_0x5f2e('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x35ea75)){_0x1833f2=path[_0x5f2e('0x55')](_0x5f2e('0x90'),_0xfecd90,_0x3527c3[0x0],_0x35ea75);}else{_0x1833f2=_0x35ea75;}}else{logger[_0x5f2e('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x5f2e('0x7d')!=typeof _0x2657de[_0x5f2e('0x86')][_0x5f2e('0x83')][_0x5f2e('0x91')]){var _0x13aa24=_0x2657de[_0x5f2e('0x86')][_0x5f2e('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x5f2e('0x92')](_0x13aa24)){_0x56d4eb=path[_0x5f2e('0x55')](_0x5f2e('0x90'),_0xfecd90,_0x3527c3[0x0],_0x13aa24);}else{_0x56d4eb=_0x13aa24;}}else{logger['info'](_0x5f2e('0x93'));}}else if(_0xd65527==='script'){_0x5e9ef3=_0x2657de[_0x5f2e('0x86')][_0x5f2e('0x87')];_0xc1ebd9=_0x2657de[_0x5f2e('0x86')][_0x5f2e('0x89')];if(_0x5f2e('0x7d')!=typeof _0x2657de['parameters'][_0x5f2e('0x83')]){if(_0x5f2e('0x7d')!=typeof _0x2657de[_0x5f2e('0x86')][_0x5f2e('0x83')][_0x5f2e('0x85')]){var _0x35ea75=_0x2657de[_0x5f2e('0x86')][_0x5f2e('0x83')][_0x5f2e('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x5f2e('0x92')](_0x35ea75)){_0x1833f2=path['join'](_0x5f2e('0x90'),_0xfecd90,_0x3527c3[0x0],_0x35ea75);}else{_0x1833f2=_0x35ea75;}}if('undefined'!=typeof _0x2657de[_0x5f2e('0x86')]['views'][_0x5f2e('0x91')]){var _0x13aa24=_0x2657de['parameters'][_0x5f2e('0x83')][_0x5f2e('0x91')];if(!/^(f|ht)tps?:\/\//i[_0x5f2e('0x92')](_0x13aa24)){_0x56d4eb=path[_0x5f2e('0x55')](_0x5f2e('0x90'),_0xfecd90,_0x3527c3[0x0],_0x13aa24);}else{_0x56d4eb=_0x13aa24;}}}}var _0x61d60c={'name':_0x2dcfdf,'description':_0x1dbf72,'path':path[_0x5f2e('0x55')](_0xfecd90,_0x3527c3[0x0]),'type':_0xd65527,'sidebar':_0x4eb083,'icon':_0x392686,'adminUrl':_0x1833f2,'agentUrl':_0x56d4eb,'scriptName':_0x5e9ef3,'scriptPath':_0xc1ebd9,'version':_0x7746fe};removeReferences(_0xb0ce53,null);return db[_0x5f2e('0x35')][_0x5f2e('0x94')](_0x61d60c)[_0x5f2e('0x2f')](function(_0x23794b){var _0x529b01={'role':_0x3be0f6[_0x5f2e('0x95')][_0x5f2e('0x96')],'userProfileId':_0x3be0f6[_0x5f2e('0x95')][_0x5f2e('0x97')]};if(!_0x529b01)throw new Error(_0x5f2e('0x98'));if(_0x529b01[_0x5f2e('0x96')]===_0x5f2e('0x99')){var _0x1e6bd4=_0x23794b[_0x5f2e('0x2c')]({'plain':!![]});return db[_0x5f2e('0x9a')][_0x5f2e('0x54')]({'where':{'name':_0x5f2e('0x2d'),'userProfileId':_0x529b01[_0x5f2e('0x97')]},'raw':!![]})[_0x5f2e('0x2f')](function(_0xd1973c){if(_0xd1973c&&_0xd1973c[_0x5f2e('0x9b')]===0x0){return db[_0x5f2e('0x9c')][_0x5f2e('0x94')]({'name':_0x1e6bd4['name'],'resourceId':_0x1e6bd4['id'],'type':_0xd1973c['name'],'sectionId':_0xd1973c['id']},{})[_0x5f2e('0x2f')](function(){return _0x23794b;});}else{return _0x23794b;}})[_0x5f2e('0x50')](function(_0x1f8e5b){logger['error'](_0x5f2e('0x9d'),_0x1f8e5b);throw _0x1f8e5b;});}return _0x23794b;})['then'](respondWithResult(_0x5252b3,null))[_0x5f2e('0x50')](handleError(_0x5252b3,null));}});}catch(_0xb22b63){_0x5252b3[_0x5f2e('0x22')](0x1f4)[_0x5f2e('0x9e')](_0xb22b63);}};function removeReferences(_0x6ea3e3,_0x21ef87){try{if(_0x6ea3e3){fs[_0x5f2e('0x69')](_0x6ea3e3);logger[_0x5f2e('0x6a')](_0x5f2e('0x9f'));}if(_0x21ef87){rimraf(_0x21ef87,function(){});logger['info'](_0x5f2e('0xa0'));}}catch(_0xbb6804){logger[_0x5f2e('0x30')](_0xbb6804);}}exports['update']=function(_0x32909c,_0x285fa1,_0x3280a9){return db[_0x5f2e('0x35')][_0x5f2e('0x54')]({'where':{'id':_0x32909c['params']['id']}})[_0x5f2e('0x2f')](handleEntityNotFound(_0x285fa1,null))[_0x5f2e('0x2f')](saveUpdates(_0x32909c[_0x5f2e('0x95')],null))[_0x5f2e('0x2f')](respondWithResult(_0x285fa1,null))[_0x5f2e('0x50')](handleError(_0x285fa1,null));};exports['delete']=function(_0x58e6c7,_0x241d11,_0x44107f){return db['Plugin'][_0x5f2e('0x54')]({'where':{'id':_0x58e6c7[_0x5f2e('0x52')]['id']}})[_0x5f2e('0x2f')](function(_0x70c499){if(_0x70c499){return _0x70c499['destroy']();}})['then'](function(_0x45c679){rimraf(path[_0x5f2e('0x55')](config[_0x5f2e('0x70')],_0x5f2e('0x56'),path['dirname'](_0x45c679[_0x5f2e('0x8')])),function(){});return _0x45c679;})['then'](handleEntityNotFound(_0x241d11,null))[_0x5f2e('0x2f')](respondWithStatusCode(_0x241d11,null))['catch'](handleError(_0x241d11,null));};exports['webhookGet']=function(_0x45fb55,_0x2a3559,_0x2e0355){return BPromise[_0x5f2e('0xa1')]()[_0x5f2e('0x2f')](function(){if(!_0x45fb55['query'][_0x5f2e('0x8')]){throw new Error(_0x5f2e('0xa2'));}if(!_0x45fb55[_0x5f2e('0x3b')][_0x5f2e('0xa3')]){throw new Error(_0x5f2e('0xa4'));}var _0x2c852b=_0x45fb55[_0x5f2e('0x3b')][_0x5f2e('0xa5')]?_0x45fb55['query'][_0x5f2e('0xa5')]+':'+_0x45fb55[_0x5f2e('0x3b')][_0x5f2e('0xa3')]:'http://localhost:'+_0x45fb55['query'][_0x5f2e('0xa3')];var _0x200a41=_0x45fb55['query']['json']?_0x45fb55[_0x5f2e('0x3b')][_0x5f2e('0x24')]:!![];var _0x14abb2=_0x45fb55['query'][_0x5f2e('0xa6')]?_0x45fb55['query'][_0x5f2e('0xa6')]:null;var _0x4ddc18={'method':_0x45fb55[_0x5f2e('0xa7')],'uri':util[_0x5f2e('0xa8')](_0x5f2e('0xa9'),_0x2c852b,_0x45fb55[_0x5f2e('0x3b')][_0x5f2e('0x8')]),'json':_0x200a41,'resolveWithFullResponse':!![],'encoding':_0x14abb2,'qs':_0x45fb55['query']};if(_0x45fb55[_0x5f2e('0xaa')]){_0x4ddc18[_0x5f2e('0xaa')]=_0x45fb55[_0x5f2e('0xaa')];if(_0x4ddc18[_0x5f2e('0xaa')]['content-length']){delete _0x4ddc18[_0x5f2e('0xaa')][_0x5f2e('0xab')];}}if(_0x4ddc18[_0x5f2e('0xaa')][_0x5f2e('0xac')]){delete _0x4ddc18['headers'][_0x5f2e('0xac')];}return rp(_0x4ddc18);})[_0x5f2e('0x2f')](function(_0x5d2e07){if(_0x5d2e07){_0x2a3559['set'](_0x5d2e07[_0x5f2e('0xaa')]);logger[_0x5f2e('0x6a')](_0x5d2e07[_0x5f2e('0x95')]);if(_[_0x5f2e('0xad')](_0x45fb55['query'][_0x5f2e('0x8')],'download')&&_0x5d2e07[_0x5f2e('0xae')]==0x1f4){return _0x2a3559[_0x5f2e('0x21')](_0x5d2e07[_0x5f2e('0xae')]);}else{return _0x2a3559[_0x5f2e('0x22')](_0x5d2e07[_0x5f2e('0xae')])['send'](_0x5d2e07[_0x5f2e('0x95')]);}}else{return _0x2a3559['sendStatus'](0xc8);}})[_0x5f2e('0x50')](handleError(_0x2a3559,null));};exports[_0x5f2e('0xaf')]=function(_0x18b1a6,_0x1d9446,_0x2b1773){return BPromise[_0x5f2e('0xa1')]()['then'](function(){if(!_0x18b1a6[_0x5f2e('0x3b')][_0x5f2e('0x8')]){throw new Error(_0x5f2e('0xa2'));}if(!_0x18b1a6[_0x5f2e('0x3b')][_0x5f2e('0xa3')]){throw new Error(_0x5f2e('0xa4'));}var _0x293166=_0x18b1a6[_0x5f2e('0x3b')][_0x5f2e('0xa5')]?_0x18b1a6[_0x5f2e('0x3b')][_0x5f2e('0xa5')]+':'+_0x18b1a6['query']['port']:_0x5f2e('0xb0')+_0x18b1a6['query'][_0x5f2e('0xa3')];var _0x1eb23a=_0x18b1a6[_0x5f2e('0x3b')][_0x5f2e('0x24')]?_0x18b1a6[_0x5f2e('0x3b')]['json']:!![];var _0x1960ae=_0x18b1a6['query'][_0x5f2e('0xa6')]?_0x18b1a6['query']['encoding']:null;var _0x3d8ce2={'method':_0x18b1a6[_0x5f2e('0xa7')],'uri':util[_0x5f2e('0xa8')](_0x5f2e('0xa9'),_0x293166,_0x18b1a6[_0x5f2e('0x3b')][_0x5f2e('0x8')]),'json':_0x1eb23a,'resolveWithFullResponse':!![],'encoding':_0x1960ae,'body':_0x18b1a6[_0x5f2e('0x95')]};if(_0x18b1a6['headers']){_0x3d8ce2[_0x5f2e('0xaa')]=_0x18b1a6['headers'];if(_0x3d8ce2['headers'][_0x5f2e('0xab')]){delete _0x3d8ce2['headers'][_0x5f2e('0xab')];}}if(_0x3d8ce2['headers']['content-type']){delete _0x3d8ce2[_0x5f2e('0xaa')]['content-type'];}return rp(_0x3d8ce2);})[_0x5f2e('0x2f')](function(_0x2e08be){if(_0x2e08be){_0x1d9446[_0x5f2e('0x27')](_0x2e08be['headers']);logger[_0x5f2e('0x6a')](_0x2e08be[_0x5f2e('0x95')]);return _0x1d9446[_0x5f2e('0x22')](_0x2e08be[_0x5f2e('0xae')])[_0x5f2e('0x9e')](_0x2e08be[_0x5f2e('0x95')]);}else{return _0x1d9446[_0x5f2e('0x21')](0xc8);}})[_0x5f2e('0x50')](handleError(_0x1d9446,null));}; \ No newline at end of file +var _0xf733=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','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','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','params','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','basename','node_modules/**/*','join','close','existsSync','download','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Zip\x20archive\x20removed','dirname','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','sendStatus','webhookPost','resolve','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv'];(function(_0xefe23d,_0xed34c1){var _0x27a83b=function(_0x35d774){while(--_0x35d774){_0xefe23d['push'](_0xefe23d['shift']());}};_0x27a83b(++_0xed34c1);}(_0xf733,0x9d));var _0x3f73=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0xf733[_0x19a90e];return _0xa49b11;};'use strict';var emlformat=require(_0x3f73('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f73('0x1'));var rp=require(_0x3f73('0x2'));var moment=require('moment');var BPromise=require(_0x3f73('0x3'));var Mustache=require('mustache');var util=require(_0x3f73('0x4'));var path=require(_0x3f73('0x5'));var sox=require(_0x3f73('0x6'));var csv=require(_0x3f73('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f73('0x8'));var _=require('lodash');var squel=require(_0x3f73('0x9'));var crypto=require(_0x3f73('0xa'));var jsforce=require(_0x3f73('0xb'));var deskjs=require(_0x3f73('0xc'));var toCsv=require(_0x3f73('0x7'));var querystring=require(_0x3f73('0xd'));var Papa=require(_0x3f73('0xe'));var extract=require(_0x3f73('0xf'));var rimraf=require(_0x3f73('0x10'));var archiver=require(_0x3f73('0x11'));var Redis=require(_0x3f73('0x12'));var authService=require(_0x3f73('0x13'));var qs=require(_0x3f73('0x14'));var as=require(_0x3f73('0x15'));var hardwareService=require(_0x3f73('0x16'));var logger=require('../../config/logger')(_0x3f73('0x17'));var utils=require(_0x3f73('0x18'));var config=require(_0x3f73('0x19'));var licenseUtil=require(_0x3f73('0x1a'));var db=require(_0x3f73('0x1b'))['db'];config[_0x3f73('0x1c')]=_[_0x3f73('0x1d')](config['redis'],{'host':_0x3f73('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x2d23cc,_0x267942){_0x267942=_0x267942||0xcc;return function(_0x38a004){if(_0x38a004){return _0x2d23cc['sendStatus'](_0x267942);}return _0x2d23cc[_0x3f73('0x1f')](_0x267942)[_0x3f73('0x20')]();};}function respondWithResult(_0x50b5b7,_0x84a561){_0x84a561=_0x84a561||0xc8;return function(_0x11f406){if(_0x11f406){return _0x50b5b7[_0x3f73('0x1f')](_0x84a561)[_0x3f73('0x21')](_0x11f406);}};}function respondWithFilteredResult(_0x1a84cb,_0x41ae46){return function(_0x58f388){if(_0x58f388){var _0x117a10=typeof _0x41ae46[_0x3f73('0x22')]===_0x3f73('0x23')&&typeof _0x41ae46['limit']===_0x3f73('0x23');var _0x1ae0d4=_0x58f388[_0x3f73('0x24')];var _0x5c5b68=_0x117a10?0x0:_0x41ae46[_0x3f73('0x22')];var _0x302b14=_0x117a10?_0x58f388['count']:_0x41ae46[_0x3f73('0x22')]+_0x41ae46[_0x3f73('0x25')];var _0x38bc3a;if(_0x302b14>=_0x1ae0d4){_0x302b14=_0x1ae0d4;_0x38bc3a=0xc8;}else{_0x38bc3a=0xce;}_0x1a84cb[_0x3f73('0x1f')](_0x38bc3a);return _0x1a84cb['set'](_0x3f73('0x26'),_0x5c5b68+'-'+_0x302b14+'/'+_0x1ae0d4)[_0x3f73('0x21')](_0x58f388);}return null;};}function patchUpdates(_0x42581b){return function(_0x45c19c){try{jsonpatch[_0x3f73('0x27')](_0x45c19c,_0x42581b,!![]);}catch(_0x55019b){return BPromise[_0x3f73('0x28')](_0x55019b);}return _0x45c19c[_0x3f73('0x29')]();};}function saveUpdates(_0x2223ee,_0x34a468){return function(_0x7d7120){if(_0x7d7120){return _0x7d7120[_0x3f73('0x2a')](_0x2223ee)['then'](function(_0x253678){return _0x253678;});}return null;};}function removeEntity(_0x4725ed,_0x570ec9){return function(_0x243620){if(_0x243620){return _0x243620[_0x3f73('0x2b')]()[_0x3f73('0x2c')](function(){var _0x15033c=_0x243620[_0x3f73('0x2d')]({'plain':!![]});var _0xb55e7c=_0x3f73('0x2e');return db[_0x3f73('0x2f')]['destroy']({'where':{'type':_0xb55e7c,'resourceId':_0x15033c['id']}})['then'](function(){return _0x243620;});})[_0x3f73('0x2c')](function(){_0x4725ed[_0x3f73('0x1f')](0xcc)[_0x3f73('0x20')]();});}};}function handleEntityNotFound(_0x1bb9fd,_0x28de4e){return function(_0x7e2409){if(!_0x7e2409){_0x1bb9fd['sendStatus'](0x194);}return _0x7e2409;};}function handleError(_0x4326f3,_0x2ebe37){_0x2ebe37=_0x2ebe37||0x1f4;return function(_0x9db78a){logger[_0x3f73('0x30')](_0x9db78a[_0x3f73('0x31')]);if(_0x9db78a[_0x3f73('0x32')]){delete _0x9db78a['name'];}_0x4326f3[_0x3f73('0x1f')](_0x2ebe37)[_0x3f73('0x33')](_0x9db78a);};}exports[_0x3f73('0x34')]=function(_0x19117a,_0x255bb3){var _0x1d649c={},_0x11ffbf={},_0x314f14={'count':0x0,'rows':[]};var _0x5b3df7=_[_0x3f73('0x35')](db[_0x3f73('0x36')][_0x3f73('0x37')],function(_0x3ba808){return{'name':_0x3ba808[_0x3f73('0x38')],'type':_0x3ba808['type'][_0x3f73('0x39')]};});_0x11ffbf[_0x3f73('0x3a')]=_[_0x3f73('0x35')](_0x5b3df7,'name');_0x11ffbf[_0x3f73('0x3b')]=_['keys'](_0x19117a['query']);_0x11ffbf[_0x3f73('0x3c')]=_[_0x3f73('0x3d')](_0x11ffbf[_0x3f73('0x3a')],_0x11ffbf[_0x3f73('0x3b')]);_0x1d649c['attributes']=_[_0x3f73('0x3d')](_0x11ffbf['model'],qs[_0x3f73('0x3e')](_0x19117a[_0x3f73('0x3b')][_0x3f73('0x3e')]));_0x1d649c[_0x3f73('0x3f')]=_0x1d649c['attributes'][_0x3f73('0x40')]?_0x1d649c[_0x3f73('0x3f')]:_0x11ffbf[_0x3f73('0x3a')];if(!_0x19117a['query'][_0x3f73('0x41')](_0x3f73('0x42'))){_0x1d649c['limit']=qs[_0x3f73('0x25')](_0x19117a[_0x3f73('0x3b')][_0x3f73('0x25')]);_0x1d649c[_0x3f73('0x22')]=qs['offset'](_0x19117a[_0x3f73('0x3b')][_0x3f73('0x22')]);}_0x1d649c[_0x3f73('0x43')]=qs[_0x3f73('0x44')](_0x19117a[_0x3f73('0x3b')]['sort']);_0x1d649c[_0x3f73('0x45')]=qs['filters'](_[_0x3f73('0x46')](_0x19117a[_0x3f73('0x3b')],_0x11ffbf[_0x3f73('0x3c')]),_0x5b3df7);if(_0x19117a[_0x3f73('0x3b')][_0x3f73('0x47')]){_0x1d649c['where']=_['merge'](_0x1d649c['where'],{'$or':_[_0x3f73('0x35')](_0x5b3df7,function(_0x371b4c){if(_0x371b4c[_0x3f73('0x48')]!==_0x3f73('0x49')){var _0x21370a={};_0x21370a[_0x371b4c[_0x3f73('0x32')]]={'$like':'%'+_0x19117a[_0x3f73('0x3b')][_0x3f73('0x47')]+'%'};return _0x21370a;}})});}_0x1d649c=_[_0x3f73('0x4a')]({},_0x1d649c,_0x19117a['options']);var _0x282942={'where':_0x1d649c[_0x3f73('0x45')]};return db['Plugin'][_0x3f73('0x24')](_0x282942)[_0x3f73('0x2c')](function(_0x1dda9c){_0x314f14[_0x3f73('0x24')]=_0x1dda9c;if(_0x19117a[_0x3f73('0x3b')][_0x3f73('0x4b')]){_0x1d649c['include']=[{'all':!![]}];}return db[_0x3f73('0x36')][_0x3f73('0x4c')](_0x1d649c);})[_0x3f73('0x2c')](function(_0x56e366){_0x314f14[_0x3f73('0x4d')]=_0x56e366;return _0x314f14;})['then'](respondWithFilteredResult(_0x255bb3,_0x1d649c))[_0x3f73('0x4e')](handleError(_0x255bb3,null));};exports[_0x3f73('0x4f')]=function(_0x1bef52,_0x21d0ec){var _0x5f300e={'raw':!![],'where':{'id':_0x1bef52['params']['id']}},_0x2c8bae={};_0x2c8bae[_0x3f73('0x3a')]=_[_0x3f73('0x50')](db[_0x3f73('0x36')]['rawAttributes']);_0x2c8bae[_0x3f73('0x3b')]=_[_0x3f73('0x50')](_0x1bef52[_0x3f73('0x3b')]);_0x2c8bae['filters']=_[_0x3f73('0x3d')](_0x2c8bae['model'],_0x2c8bae[_0x3f73('0x3b')]);_0x5f300e[_0x3f73('0x3f')]=_[_0x3f73('0x3d')](_0x2c8bae[_0x3f73('0x3a')],qs[_0x3f73('0x3e')](_0x1bef52[_0x3f73('0x3b')][_0x3f73('0x3e')]));_0x5f300e[_0x3f73('0x3f')]=_0x5f300e[_0x3f73('0x3f')][_0x3f73('0x40')]?_0x5f300e[_0x3f73('0x3f')]:_0x2c8bae['model'];if(_0x1bef52[_0x3f73('0x3b')][_0x3f73('0x4b')]){_0x5f300e[_0x3f73('0x51')]=[{'all':!![]}];}_0x5f300e=_[_0x3f73('0x4a')]({},_0x5f300e,_0x1bef52[_0x3f73('0x52')]);return db['Plugin'][_0x3f73('0x53')](_0x5f300e)[_0x3f73('0x2c')](handleEntityNotFound(_0x21d0ec,null))[_0x3f73('0x2c')](respondWithResult(_0x21d0ec,null))[_0x3f73('0x4e')](handleError(_0x21d0ec,null));};exports['download']=function(_0x3f31a1,_0x46e498,_0x520a83){return db['Plugin'][_0x3f73('0x53')]({'where':{'id':_0x3f31a1[_0x3f73('0x54')]['id']},'attributes':['name','path'],'raw':!![]})[_0x3f73('0x2c')](handleEntityNotFound(_0x46e498,null))[_0x3f73('0x2c')](function(_0x871123){if(_0x871123){var _0x2de0c5=path['join'](config[_0x3f73('0x55')],_0x3f73('0x56'),util[_0x3f73('0x57')](_0x3f73('0x58'),path['basename'](_0x871123[_0x3f73('0x5')])));var _0x59862b=fs[_0x3f73('0x59')](_0x2de0c5);var _0x5c6df9=archiver(_0x3f73('0x5a'),{'zlib':{'level':0x9}});_0x5c6df9['on'](_0x3f73('0x5b'),function(_0x118e14){if(_0x118e14[_0x3f73('0x5c')]==='ENOENT'){logger['error'](_0x118e14);}else{throw new db[(_0x3f73('0x5d'))][(_0x3f73('0x5e'))](_0x3f73('0x5f'));}});_0x5c6df9['on'](_0x3f73('0x30'),function(_0x21d9c0){throw new db[(_0x3f73('0x5d'))]['Error'](_0x3f73('0x5f'));});_0x5c6df9['pipe'](_0x59862b);_0x5c6df9['glob']('**/*',{'cwd':path['join'](config[_0x3f73('0x55')],'server/files/plugins',path['dirname'](_0x871123[_0x3f73('0x5')])),'ignore':[path['join'](path[_0x3f73('0x60')](_0x871123['path']),_0x3f73('0x61')),path[_0x3f73('0x62')](path[_0x3f73('0x60')](_0x871123[_0x3f73('0x5')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x59862b['on'](_0x3f73('0x63'),function(){if(!fs[_0x3f73('0x64')](_0x2de0c5)){throw new db[(_0x3f73('0x5d'))][(_0x3f73('0x5e'))]('Plugin\x20not\x20found');}return _0x46e498[_0x3f73('0x65')](_0x2de0c5,util[_0x3f73('0x57')](_0x3f73('0x58'),path[_0x3f73('0x60')](_0x871123[_0x3f73('0x5')])),function(_0x52e723){if(_0x52e723){throw new db[(_0x3f73('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x2de0c5);logger['info'](_0x3f73('0x66'));logger['info'](_0x3f73('0x67'));});});}return null;})['catch'](handleError(_0x46e498,null));};exports[_0x3f73('0x68')]=function(_0x3e0619,_0x2f9c36,_0x4751cd){var _0x31a043=path[_0x3f73('0x60')](_0x3e0619['file'][_0x3f73('0x69')],path[_0x3f73('0x6a')](_0x3e0619[_0x3f73('0x6b')][_0x3f73('0x69')]));var _0x442f7e=path[_0x3f73('0x62')](config[_0x3f73('0x55')],_0x3f73('0x56'),_0x3e0619['file']['filename']);var _0x4073f3=path[_0x3f73('0x62')](config[_0x3f73('0x55')],_0x3f73('0x56'),_0x31a043);logger[_0x3f73('0x6c')](_0x3f73('0x6d'),_0x442f7e);logger[_0x3f73('0x6c')](_0x3f73('0x6e'),_0x4073f3);try{fs[_0x3f73('0x6f')](_0x442f7e,parseInt(_0x3f73('0x70'),0x8));extract(_0x442f7e,{'dir':_0x4073f3},function(_0x10e727){if(_0x10e727){logger[_0x3f73('0x30')](_0x10e727);handleError(_0x10e727,!![]);};var _0xf64a2a=fs[_0x3f73('0x71')](_0x4073f3);if(_0xf64a2a[_0x3f73('0x40')]>0x1){removeReferences(_0x442f7e,_0x4073f3);logger[_0x3f73('0x30')](_0x3f73('0x72'));return _0x4751cd(new Error(_0x3f73('0x72')));}var _0x270f11=fs[_0x3f73('0x73')](path[_0x3f73('0x62')](_0x4073f3,_0xf64a2a[0x0]));if(_0x270f11['isFile']()){removeReferences(_0x442f7e,_0x4073f3);logger[_0x3f73('0x30')]('Invalid\x20plugin\x20structure');return _0x4751cd(new Error(_0x3f73('0x72')));}if(_0x270f11['isDirectory']()){var _0x3abda1=fs['readdirSync'](path[_0x3f73('0x62')](_0x4073f3,_0xf64a2a[0x0]));if(_0x3abda1['length']===0x0){removeReferences(_0x442f7e,_0x4073f3);logger[_0x3f73('0x30')](_0x3f73('0x72'));return _0x4751cd(new Error(_0x3f73('0x72')));}var _0x52c331=_0x3abda1[_0x3f73('0x74')](function(_0xfa35c3){return _0xfa35c3==='manifest.json';});if(!_0x52c331){return _0x4751cd(new Error(_0x3f73('0x75')));}var _0x333c4b=fs[_0x3f73('0x76')](path[_0x3f73('0x62')](_0x4073f3,_0xf64a2a[0x0],'manifest.json'));var _0x32d2eb=JSON['parse'](_0x333c4b);if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x32')]){return _0x4751cd(new Error(_0x3f73('0x77')));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x48')]){return _0x4751cd(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x78')]){return _0x4751cd(new Error(_0x3f73('0x79')));}if('undefined'==typeof _0x32d2eb[_0x3f73('0x7a')]){return _0x4751cd(new Error(_0x3f73('0x7b')));}if(_0x32d2eb[_0x3f73('0x48')]===_0x3f73('0x7c')){if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')]){return _0x4751cd(new Error(_0x3f73('0x7e')));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x7f')]&&_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')]['agent']){return _0x4751cd(new Error(_0x3f73('0x80')));}}else if(_0x32d2eb[_0x3f73('0x48')]===_0x3f73('0x81')){if('undefined'==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x82')]){return _0x4751cd(new Error(_0x3f73('0x83')));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')]['scriptPath']){return _0x4751cd(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4751cd(new Error(_0x3f73('0x84')));}var _0x25cff1=_0x32d2eb[_0x3f73('0x32')];var _0x27da3d=_0x32d2eb['description'];var _0x11e8b5=_0x32d2eb[_0x3f73('0x48')];var _0x48da73=_0x32d2eb[_0x3f73('0x85')]?_0x32d2eb[_0x3f73('0x85')]:_0x3f73('0x86');var _0x4ae785=_0x32d2eb[_0x3f73('0x87')]?_0x32d2eb['icon']:_0x3f73('0x88');var _0x14f5dc='';var _0x173721='';var _0x4cdf2c='';var _0x27bd13='';var _0x14fc13=_0x32d2eb[_0x3f73('0x78')];if(_0x11e8b5===_0x3f73('0x7c')){if(_0x3f73('0x23')!=typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x7f')]){var _0x3032dd=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0x3032dd)){_0x14f5dc=path[_0x3f73('0x62')]('plugins',_0x31a043,_0xf64a2a[0x0],_0x3032dd);}else{_0x14f5dc=_0x3032dd;}}else{logger[_0x3f73('0x6c')](_0x3f73('0x8a'));}if(_0x3f73('0x23')!=typeof _0x32d2eb['parameters']['views'][_0x3f73('0x8b')]){var _0xb651bb=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0xb651bb)){_0x173721=path[_0x3f73('0x62')](_0x3f73('0x8c'),_0x31a043,_0xf64a2a[0x0],_0xb651bb);}else{_0x173721=_0xb651bb;}}else{logger[_0x3f73('0x6c')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x11e8b5==='script'){_0x4cdf2c=_0x32d2eb['parameters'][_0x3f73('0x82')];_0x27bd13=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x8d')];if(_0x3f73('0x23')!=typeof _0x32d2eb[_0x3f73('0x7a')]['views']){if('undefined'!=typeof _0x32d2eb[_0x3f73('0x7a')]['views'][_0x3f73('0x7f')]){var _0x3032dd=_0x32d2eb[_0x3f73('0x7a')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0x3032dd)){_0x14f5dc=path[_0x3f73('0x62')](_0x3f73('0x8c'),_0x31a043,_0xf64a2a[0x0],_0x3032dd);}else{_0x14f5dc=_0x3032dd;}}if('undefined'!=typeof _0x32d2eb['parameters'][_0x3f73('0x7d')]['agent']){var _0xb651bb=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0xb651bb)){_0x173721=path[_0x3f73('0x62')]('plugins',_0x31a043,_0xf64a2a[0x0],_0xb651bb);}else{_0x173721=_0xb651bb;}}}}var _0x8044c6={'name':_0x25cff1,'description':_0x27da3d,'path':path[_0x3f73('0x62')](_0x31a043,_0xf64a2a[0x0]),'type':_0x11e8b5,'sidebar':_0x48da73,'icon':_0x4ae785,'adminUrl':_0x14f5dc,'agentUrl':_0x173721,'scriptName':_0x4cdf2c,'scriptPath':_0x27bd13,'version':_0x14fc13};removeReferences(_0x442f7e,null);return db[_0x3f73('0x36')][_0x3f73('0x8e')](_0x8044c6)[_0x3f73('0x2c')](function(_0x366337){var _0x509193={'role':_0x3e0619[_0x3f73('0x8f')][_0x3f73('0x90')],'userProfileId':_0x3e0619['body'][_0x3f73('0x91')]};if(!_0x509193)throw new Error(_0x3f73('0x92'));if(_0x509193[_0x3f73('0x90')]===_0x3f73('0x93')){var _0x2fe050=_0x366337['get']({'plain':!![]});return db['UserProfileSection'][_0x3f73('0x53')]({'where':{'name':_0x3f73('0x2e'),'userProfileId':_0x509193['userProfileId']},'raw':!![]})['then'](function(_0x2aeba5){if(_0x2aeba5&&_0x2aeba5['autoAssociation']===0x0){return db[_0x3f73('0x2f')][_0x3f73('0x8e')]({'name':_0x2fe050['name'],'resourceId':_0x2fe050['id'],'type':_0x2aeba5[_0x3f73('0x32')],'sectionId':_0x2aeba5['id']},{})['then'](function(){return _0x366337;});}else{return _0x366337;}})[_0x3f73('0x4e')](function(_0x4a431d){logger[_0x3f73('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a431d);throw _0x4a431d;});}return _0x366337;})[_0x3f73('0x2c')](respondWithResult(_0x2f9c36,null))['catch'](handleError(_0x2f9c36,null));}});}catch(_0x465e9f){_0x2f9c36[_0x3f73('0x1f')](0x1f4)[_0x3f73('0x33')](_0x465e9f);}};function removeReferences(_0x481a07,_0x2fd083){try{if(_0x481a07){fs['unlinkSync'](_0x481a07);logger[_0x3f73('0x6c')](_0x3f73('0x94'));}if(_0x2fd083){rimraf(_0x2fd083,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x2d619c){logger[_0x3f73('0x30')](_0x2d619c);}}exports[_0x3f73('0x2a')]=function(_0x170c28,_0x3ed10d,_0x5d591a){return db['Plugin']['find']({'where':{'id':_0x170c28['params']['id']}})[_0x3f73('0x2c')](handleEntityNotFound(_0x3ed10d,null))[_0x3f73('0x2c')](saveUpdates(_0x170c28[_0x3f73('0x8f')],null))[_0x3f73('0x2c')](respondWithResult(_0x3ed10d,null))[_0x3f73('0x4e')](handleError(_0x3ed10d,null));};exports['delete']=function(_0x3b0f12,_0x20d475,_0x4bd475){return db[_0x3f73('0x36')][_0x3f73('0x53')]({'where':{'id':_0x3b0f12[_0x3f73('0x54')]['id']}})[_0x3f73('0x2c')](function(_0x3dfd60){if(_0x3dfd60){return _0x3dfd60[_0x3f73('0x2b')]();}})[_0x3f73('0x2c')](function(_0x3e59d4){rimraf(path[_0x3f73('0x62')](config[_0x3f73('0x55')],_0x3f73('0x56'),path[_0x3f73('0x95')](_0x3e59d4[_0x3f73('0x5')])),function(){});return _0x3e59d4;})[_0x3f73('0x2c')](handleEntityNotFound(_0x20d475,null))['then'](respondWithStatusCode(_0x20d475,null))[_0x3f73('0x4e')](handleError(_0x20d475,null));};exports['webhookGet']=function(_0x44ac34,_0x1b9db5,_0x5c2b48){return BPromise['resolve']()[_0x3f73('0x2c')](function(){if(!_0x44ac34[_0x3f73('0x3b')]['path']){throw new Error(_0x3f73('0x96'));}if(!_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x97')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x38c878=_0x44ac34[_0x3f73('0x3b')]['hostname']?_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x98')]+':'+_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x97')]:'http://localhost:'+_0x44ac34[_0x3f73('0x3b')]['port'];var _0x4ebd76=_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x21')]?_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x21')]:!![];var _0x2d033a=_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x99')]?_0x44ac34['query'][_0x3f73('0x99')]:null;var _0x32abfa={'method':_0x44ac34[_0x3f73('0x9a')],'uri':util[_0x3f73('0x57')](_0x3f73('0x9b'),_0x38c878,_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x5')]),'json':_0x4ebd76,'resolveWithFullResponse':!![],'encoding':_0x2d033a,'qs':_0x44ac34[_0x3f73('0x3b')]};if(_0x44ac34[_0x3f73('0x9c')]){_0x32abfa[_0x3f73('0x9c')]=_0x44ac34[_0x3f73('0x9c')];if(_0x32abfa[_0x3f73('0x9c')][_0x3f73('0x9d')]){delete _0x32abfa[_0x3f73('0x9c')][_0x3f73('0x9d')];}}if(_0x32abfa[_0x3f73('0x9c')][_0x3f73('0x9e')]){delete _0x32abfa[_0x3f73('0x9c')]['content-type'];}return rp(_0x32abfa);})['then'](function(_0x436d19){if(_0x436d19){_0x1b9db5[_0x3f73('0x9f')](_0x436d19[_0x3f73('0x9c')]);logger['info'](_0x436d19[_0x3f73('0x8f')]);if(_[_0x3f73('0xa0')](_0x44ac34['query'][_0x3f73('0x5')],'download')&&_0x436d19[_0x3f73('0xa1')]==0x1f4){return _0x1b9db5[_0x3f73('0xa2')](_0x436d19[_0x3f73('0xa1')]);}else{return _0x1b9db5[_0x3f73('0x1f')](_0x436d19[_0x3f73('0xa1')])[_0x3f73('0x33')](_0x436d19[_0x3f73('0x8f')]);}}else{return _0x1b9db5[_0x3f73('0xa2')](0xc8);}})[_0x3f73('0x4e')](handleError(_0x1b9db5,null));};exports[_0x3f73('0xa3')]=function(_0xebf16b,_0x1f069a,_0x41c04d){return BPromise[_0x3f73('0xa4')]()['then'](function(){if(!_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xebf16b['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3ada28=_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x98')]?_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x98')]+':'+_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x97')]:'http://localhost:'+_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x97')];var _0xaf80af=_0xebf16b['query'][_0x3f73('0x21')]?_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x21')]:!![];var _0x394c95=_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x99')]?_0xebf16b['query'][_0x3f73('0x99')]:null;var _0x277f62={'method':_0xebf16b['method'],'uri':util['format']('%s%s',_0x3ada28,_0xebf16b[_0x3f73('0x3b')]['path']),'json':_0xaf80af,'resolveWithFullResponse':!![],'encoding':_0x394c95,'body':_0xebf16b['body']};if(_0xebf16b[_0x3f73('0x9c')]){_0x277f62[_0x3f73('0x9c')]=_0xebf16b['headers'];if(_0x277f62[_0x3f73('0x9c')]['content-length']){delete _0x277f62[_0x3f73('0x9c')][_0x3f73('0x9d')];}}if(_0x277f62[_0x3f73('0x9c')][_0x3f73('0x9e')]){delete _0x277f62['headers']['content-type'];}return rp(_0x277f62);})[_0x3f73('0x2c')](function(_0x410971){if(_0x410971){_0x1f069a[_0x3f73('0x9f')](_0x410971[_0x3f73('0x9c')]);logger[_0x3f73('0x6c')](_0x410971[_0x3f73('0x8f')]);return _0x1f069a[_0x3f73('0x1f')](_0x410971[_0x3f73('0xa1')])[_0x3f73('0x33')](_0x410971[_0x3f73('0x8f')]);}else{return _0x1f069a[_0x3f73('0xa2')](0xc8);}})[_0x3f73('0x4e')](handleError(_0x1f069a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 98b8986..4c8910a 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 _0x0295=['remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x197df5,_0x3789c1){var _0x2ee0b2=function(_0x39c1b9){while(--_0x39c1b9){_0x197df5['push'](_0x197df5['shift']());}};_0x2ee0b2(++_0x3789c1);}(_0x0295,0x1f0));var _0x5029=function(_0x36782c,_0x38c321){_0x36782c=_0x36782c-0x0;var _0xd4e417=_0x0295[_0x36782c];return _0xd4e417;};'use strict';var EventEmitter=require(_0x5029('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5029('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5029('0x2')};function emitEvent(_0x36335d){return function(_0x157a4f,_0x3d0af1,_0x170504){PluginEvents[_0x5029('0x3')](_0x36335d+':'+_0x157a4f['id'],_0x157a4f);PluginEvents[_0x5029('0x3')](_0x36335d,_0x157a4f);_0x170504(null);};}for(var e in events){if(events[_0x5029('0x4')](e)){var event=events[e];Plugin[_0x5029('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x5655=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x38d105,_0x11b3f2){var _0xb1e4e2=function(_0x5c532e){while(--_0x5c532e){_0x38d105['push'](_0x38d105['shift']());}};_0xb1e4e2(++_0x11b3f2);}(_0x5655,0x15e));var _0x5565=function(_0x20a8e1,_0x4be9a8){_0x20a8e1=_0x20a8e1-0x0;var _0x589cfd=_0x5655[_0x20a8e1];return _0x589cfd;};'use strict';var EventEmitter=require(_0x5565('0x0'));var Plugin=require(_0x5565('0x1'))['db'][_0x5565('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5565('0x3')](0x0);var events={'afterCreate':_0x5565('0x4'),'afterUpdate':_0x5565('0x5'),'afterDestroy':'remove'};function emitEvent(_0x480b69){return function(_0x307c01,_0x58e4f5,_0x247aa3){PluginEvents[_0x5565('0x6')](_0x480b69+':'+_0x307c01['id'],_0x307c01);PluginEvents[_0x5565('0x6')](_0x480b69,_0x307c01);_0x247aa3(null);};}for(var e in events){if(events[_0x5565('0x7')](e)){var event=events[e];Plugin[_0x5565('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5ae3afd..a276185 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 _0xf2f7=['./plugin.attributes','define','Plugin','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0xf2f7,0xa3));var _0x7f2f=function(_0x522f42,_0xd5aace){_0x522f42=_0x522f42-0x0;var _0x496385=_0xf2f7[_0x522f42];return _0x496385;};'use strict';var _=require(_0x7f2f('0x0'));var util=require('util');var logger=require(_0x7f2f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7f2f('0x2'));var rp=require(_0x7f2f('0x3'));var fs=require('fs');var path=require(_0x7f2f('0x4'));var rimraf=require(_0x7f2f('0x5'));var config=require(_0x7f2f('0x6'));var attributes=require(_0x7f2f('0x7'));module['exports']=function(_0x4b788c,_0x30c93c){return _0x4b788c[_0x7f2f('0x8')](_0x7f2f('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeac6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util','../../config/logger'];(function(_0x108126,_0x54af88){var _0x33bb4c=function(_0x2d229d){while(--_0x2d229d){_0x108126['push'](_0x108126['shift']());}};_0x33bb4c(++_0x54af88);}(_0xeac6,0xc0));var _0x6eac=function(_0x165001,_0x5b4c14){_0x165001=_0x165001-0x0;var _0x3d0acd=_0xeac6[_0x165001];return _0x3d0acd;};'use strict';var _=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var logger=require(_0x6eac('0x2'))('api');var moment=require(_0x6eac('0x3'));var BPromise=require(_0x6eac('0x4'));var rp=require(_0x6eac('0x5'));var fs=require('fs');var path=require(_0x6eac('0x6'));var rimraf=require(_0x6eac('0x7'));var config=require(_0x6eac('0x8'));var attributes=require(_0x6eac('0x9'));module[_0x6eac('0xa')]=function(_0xebef33,_0x429b19){return _0xebef33[_0x6eac('0xb')](_0x6eac('0xc'),attributes,{'tableName':'plugins','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 28e784e..8443497 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 _0xcdbf=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','create','body','options','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./plugin.socket','request'];(function(_0x1efb29,_0x41cd3b){var _0xae79e9=function(_0x59c502){while(--_0x59c502){_0x1efb29['push'](_0x1efb29['shift']());}};_0xae79e9(++_0x41cd3b);}(_0xcdbf,0xc0));var _0xfcdb=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xcdbf[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xfcdb('0x0'));var util=require(_0xfcdb('0x1'));var moment=require(_0xfcdb('0x2'));var BPromise=require(_0xfcdb('0x3'));var rs=require(_0xfcdb('0x4'));var fs=require('fs');var Redis=require(_0xfcdb('0x5'));var db=require(_0xfcdb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcdb('0x7'))(_0xfcdb('0x8'));var config=require(_0xfcdb('0x9'));var jayson=require(_0xfcdb('0xa'));var client=jayson[_0xfcdb('0xb')][_0xfcdb('0xc')]({'port':0x232a});config['redis']=_[_0xfcdb('0xd')](config['redis'],{'host':_0xfcdb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfcdb('0xf')]));require(_0xfcdb('0x10'))['register'](socket);function respondWithRpcPromise(_0x44a255,_0x5769e5,_0xcb88f2){return new BPromise(function(_0x1fd1ee,_0x5795ec){return client[_0xfcdb('0x11')](_0x44a255,_0xcb88f2)['then'](function(_0x3804d6){logger[_0xfcdb('0x12')](_0xfcdb('0x13'),_0x5769e5,_0xfcdb('0x14'));logger[_0xfcdb('0x15')](_0xfcdb('0x16'),_0x5769e5,_0xfcdb('0x14'),JSON['stringify'](_0x3804d6));if(_0x3804d6['error']){if(_0x3804d6[_0xfcdb('0x17')][_0xfcdb('0x18')]===0x1f4){logger[_0xfcdb('0x17')](_0xfcdb('0x13'),_0x5769e5,_0x3804d6[_0xfcdb('0x17')][_0xfcdb('0x19')]);return _0x5795ec(_0x3804d6[_0xfcdb('0x17')][_0xfcdb('0x19')]);}logger[_0xfcdb('0x17')](_0xfcdb('0x13'),_0x5769e5,_0x3804d6[_0xfcdb('0x17')][_0xfcdb('0x19')]);return _0x1fd1ee(_0x3804d6[_0xfcdb('0x17')]['message']);}else{logger[_0xfcdb('0x12')]('Plugin,\x20%s,\x20%s',_0x5769e5,_0xfcdb('0x14'));_0x1fd1ee(_0x3804d6[_0xfcdb('0x1a')]['message']);}})['catch'](function(_0x48c875){logger[_0xfcdb('0x17')]('Plugin,\x20%s,\x20%s',_0x5769e5,_0x48c875);_0x5795ec(_0x48c875);});});}exports[_0xfcdb('0x1b')]=function(_0xe65612){var _0x579b2d=this;return new Promise(function(_0x1ba399,_0xfc238f){return db['Plugin'][_0xfcdb('0x1c')](_0xe65612[_0xfcdb('0x1d')],{'raw':_0xe65612[_0xfcdb('0x1e')]?_0xe65612[_0xfcdb('0x1e')][_0xfcdb('0x1f')]===undefined?!![]:![]:!![]})[_0xfcdb('0x20')](function(_0x4aebb1){logger[_0xfcdb('0x12')](_0xfcdb('0x1b'),_0xe65612);logger[_0xfcdb('0x15')](_0xfcdb('0x1b'),_0xe65612,JSON[_0xfcdb('0x21')](_0x4aebb1));_0x1ba399(_0x4aebb1);})[_0xfcdb('0x22')](function(_0x2cab33){logger[_0xfcdb('0x17')]('CreatePlugin',_0x2cab33['message'],_0xe65612);_0xfc238f(_0x579b2d['error'](0x1f4,_0x2cab33['message']));});});}; \ No newline at end of file +var _0x34f6=['error','code','message','info','result','catch','CreatePlugin','Plugin','create','options','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2146bf,_0x2085ab){var _0x2cbb04=function(_0x278cc8){while(--_0x278cc8){_0x2146bf['push'](_0x2146bf['shift']());}};_0x2cbb04(++_0x2085ab);}(_0x34f6,0x8e));var _0x634f=function(_0x4fbae4,_0x35f842){_0x4fbae4=_0x4fbae4-0x0;var _0x1a291b=_0x34f6[_0x4fbae4];return _0x1a291b;};'use strict';var _=require(_0x634f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x634f('0x1'));var rs=require(_0x634f('0x2'));var fs=require('fs');var Redis=require(_0x634f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x634f('0x4'));var logger=require(_0x634f('0x5'))(_0x634f('0x6'));var config=require('../../config/environment');var jayson=require(_0x634f('0x7'));var client=jayson[_0x634f('0x8')][_0x634f('0x9')]({'port':0x232a});config[_0x634f('0xa')]=_[_0x634f('0xb')](config[_0x634f('0xa')],{'host':_0x634f('0xc'),'port':0x18eb});var socket=require(_0x634f('0xd'))(new Redis(config[_0x634f('0xa')]));require(_0x634f('0xe'))[_0x634f('0xf')](socket);function respondWithRpcPromise(_0x1ebb19,_0x5a3b0d,_0x4979fe){return new BPromise(function(_0x53250d,_0x465c46){return client[_0x634f('0x10')](_0x1ebb19,_0x4979fe)[_0x634f('0x11')](function(_0x17c3b8){logger['info'](_0x634f('0x12'),_0x5a3b0d,_0x634f('0x13'));logger[_0x634f('0x14')](_0x634f('0x15'),_0x5a3b0d,_0x634f('0x13'),JSON[_0x634f('0x16')](_0x17c3b8));if(_0x17c3b8[_0x634f('0x17')]){if(_0x17c3b8[_0x634f('0x17')][_0x634f('0x18')]===0x1f4){logger[_0x634f('0x17')](_0x634f('0x12'),_0x5a3b0d,_0x17c3b8[_0x634f('0x17')][_0x634f('0x19')]);return _0x465c46(_0x17c3b8['error'][_0x634f('0x19')]);}logger[_0x634f('0x17')](_0x634f('0x12'),_0x5a3b0d,_0x17c3b8[_0x634f('0x17')][_0x634f('0x19')]);return _0x53250d(_0x17c3b8['error']['message']);}else{logger[_0x634f('0x1a')](_0x634f('0x12'),_0x5a3b0d,_0x634f('0x13'));_0x53250d(_0x17c3b8[_0x634f('0x1b')][_0x634f('0x19')]);}})[_0x634f('0x1c')](function(_0x40a59d){logger[_0x634f('0x17')](_0x634f('0x12'),_0x5a3b0d,_0x40a59d);_0x465c46(_0x40a59d);});});}exports[_0x634f('0x1d')]=function(_0x427d53){var _0x2c08e4=this;return new Promise(function(_0x85de5a,_0x4648c9){return db[_0x634f('0x1e')][_0x634f('0x1f')](_0x427d53['body'],{'raw':_0x427d53[_0x634f('0x20')]?_0x427d53['options']['raw']===undefined?!![]:![]:!![]})[_0x634f('0x11')](function(_0xf0698a){logger[_0x634f('0x1a')](_0x634f('0x1d'),_0x427d53);logger['debug'](_0x634f('0x1d'),_0x427d53,JSON[_0x634f('0x16')](_0xf0698a));_0x85de5a(_0xf0698a);})[_0x634f('0x1c')](function(_0x24857c){logger[_0x634f('0x17')]('CreatePlugin',_0x24857c[_0x634f('0x19')],_0x427d53);_0x4648c9(_0x2c08e4[_0x634f('0x17')](0x1f4,_0x24857c[_0x634f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9db826b..f8560ea 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 _0x4205=['save','remove','update','emit','register','length','plugin:','./plugin.events'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x4205,0x19f));var _0x5420=function(_0x2edbb7,_0x35e27f){_0x2edbb7=_0x2edbb7-0x0;var _0x6ce7d8=_0x4205[_0x2edbb7];return _0x6ce7d8;};'use strict';var PluginEvents=require(_0x5420('0x0'));var events=[_0x5420('0x1'),_0x5420('0x2'),_0x5420('0x3')];function createListener(_0x19d9e5,_0x52c874){return function(_0x185eb5){_0x52c874[_0x5420('0x4')](_0x19d9e5,_0x185eb5);};}function removeListener(_0x31359b,_0x2f6cc9){return function(){PluginEvents['removeListener'](_0x31359b,_0x2f6cc9);};}exports[_0x5420('0x5')]=function(_0x582609){for(var _0x15137e=0x0,_0x121cbd=events[_0x5420('0x6')];_0x15137e<_0x121cbd;_0x15137e++){var _0x1256c5=events[_0x15137e];var _0x3a9822=createListener(_0x5420('0x7')+_0x1256c5,_0x582609);PluginEvents['on'](_0x1256c5,_0x3a9822);}}; \ No newline at end of file +var _0x546e=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x26404d,_0xdab8ab){var _0x40eaa8=function(_0x4dc899){while(--_0x4dc899){_0x26404d['push'](_0x26404d['shift']());}};_0x40eaa8(++_0xdab8ab);}(_0x546e,0x160));var _0xe546=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x546e[_0x1b828b];return _0x98da1a;};'use strict';var PluginEvents=require(_0xe546('0x0'));var events=[_0xe546('0x1'),_0xe546('0x2'),_0xe546('0x3')];function createListener(_0x5dc385,_0x2bb36e){return function(_0x4106b2){_0x2bb36e[_0xe546('0x4')](_0x5dc385,_0x4106b2);};}function removeListener(_0x58b2d8,_0x1d8aaf){return function(){PluginEvents[_0xe546('0x5')](_0x58b2d8,_0x1d8aaf);};}exports[_0xe546('0x6')]=function(_0xb03715){for(var _0x25e31c=0x0,_0x20df31=events[_0xe546('0x7')];_0x25e31c<_0x20df31;_0x25e31c++){var _0x4ec517=events[_0x25e31c];var _0x1cfdf8=createListener(_0xe546('0x8')+_0x4ec517,_0xb03715);PluginEvents['on'](_0x4ec517,_0x1cfdf8);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 35396dd..6a333a2 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(_0x3b37d6,_0x33cf2d){var _0x5e10a8=function(_0x359552){while(--_0x359552){_0x3b37d6['push'](_0x3b37d6['shift']());}};_0x5e10a8(++_0x33cf2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x227542,_0x1e5faf){var _0x400ef9=function(_0x7e57e5){while(--_0x7e57e5){_0x227542['push'](_0x227542['shift']());}};_0x400ef9(++_0x1e5faf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 665f444..e804b16 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 _0xcea2=['then','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','update','restart','stop','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','status','json','stack','name','send','npm\x20install','info','index','list'];(function(_0xe96931,_0x2f59d7){var _0x332f08=function(_0x400f8c){while(--_0x400f8c){_0xe96931['push'](_0xe96931['shift']());}};_0x332f08(++_0x2f59d7);}(_0xcea2,0x15a));var _0x2cea=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcea2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2cea('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x2cea('0x1'))('api');var path=require(_0x2cea('0x2'));var exec=require(_0x2cea('0x3'))[_0x2cea('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3ff73f,_0x46060b){return function(_0x11596e){if(!_0x11596e){_0x3ff73f['sendStatus'](0x194);;}return _0x11596e;};}function respondWithResult(_0x34f0f2,_0x485c26){_0x485c26=_0x485c26||0xc8;return function(_0x2d69ff){if(_0x2d69ff){return _0x34f0f2[_0x2cea('0x5')](_0x485c26)[_0x2cea('0x6')](_0x2d69ff);}return null;};}function handleError(_0x160cca,_0x11c5c0){_0x11c5c0=_0x11c5c0||0x1f4;return function(_0x1519f6){logger['error'](_0x1519f6[_0x2cea('0x7')]);if(_0x1519f6[_0x2cea('0x8')]){delete _0x1519f6[_0x2cea('0x8')];}_0x160cca[_0x2cea('0x5')](_0x11c5c0)[_0x2cea('0x9')](_0x1519f6);};}function execChildProcess(){return new BPromise(function(_0x439c4d,_0x4298a4){exec(_0x2cea('0xa'),function(_0x58a102,_0x5724b0,_0x2fe9cd){logger[_0x2cea('0xb')](_0x5724b0);logger['info'](_0x2fe9cd);if(_0x58a102){logger['error'](_0x58a102);return _0x4298a4(_0x58a102);}return _0x439c4d(_0x5724b0);});});}exports[_0x2cea('0xc')]=function(_0x4e0da7,_0xa4ce3d){return pm2[_0x2cea('0xd')]()[_0x2cea('0xe')](function(_0x5cf805){if(_0x5cf805){var _0x4d7f8b=_['reject'](_0x5cf805,function(_0x369c72){return _0x369c72['name']===_0x2cea('0xf')||_0x369c72[_0x2cea('0x8')]===_0x2cea('0x10');});return{'rows':_0x4d7f8b,'count':_0x4d7f8b[_0x2cea('0x11')]};}return null;})[_0x2cea('0xe')](respondWithResult(_0xa4ce3d,null))[_0x2cea('0x12')](handleError(_0xa4ce3d,null));};exports[_0x2cea('0x13')]=function(_0x1ead4c,_0x5eee09){return pm2[_0x2cea('0x14')](_0x1ead4c[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](respondWithResult(_0x5eee09,null))[_0x2cea('0xe')](handleEntityNotFound(_0x5eee09,null))[_0x2cea('0x12')](handleError(_0x5eee09,null));};exports[_0x2cea('0x16')]=function(_0x5d75c4,_0x27375b){if(_0x5d75c4['body'][_0x2cea('0x8')]&&_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x18')]){var _0x4fd3d5=path[_0x2cea('0x19')](__dirname,_0x2cea('0x1a'),_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x18')]);var _0x3246bc=process[_0x2cea('0x1b')]();process[_0x2cea('0x1c')](path['dirname'](_0x4fd3d5));return execChildProcess()[_0x2cea('0xe')](function(_0x5e5b46){process[_0x2cea('0x1c')](_0x3246bc);return pm2['start']({'name':_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x8')],'script':_0x4fd3d5});})['then'](function(_0x41d272){pm2[_0x2cea('0x1d')]();return _0x41d272[0x0];})[_0x2cea('0xe')](respondWithResult(_0x27375b,0xc9))[_0x2cea('0x12')](handleError(_0x27375b,null));}else{return _0x27375b[_0x2cea('0x5')](0x1f4)[_0x2cea('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2cea('0x1e')]=function(_0x32b6a3,_0x2bbe9b){if(_0x32b6a3[_0x2cea('0x17')]['id']){delete _0x32b6a3[_0x2cea('0x17')]['id'];}var _0x3ea40c={'online':_0x2cea('0x1f'),'stopped':_0x2cea('0x20')};if(_0x3ea40c['hasOwnProperty'](_0x32b6a3[_0x2cea('0x17')][_0x2cea('0x5')])){return pm2[_0x3ea40c[_0x32b6a3['body'][_0x2cea('0x5')]]](_0x32b6a3[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](respondWithResult(_0x2bbe9b,0xc8))[_0x2cea('0x12')](handleError(_0x2bbe9b,null));}else{return _0x2bbe9b['status'](0x1f4)[_0x2cea('0x9')]({'message':_0x2cea('0x21')});}};exports['destroy']=function(_0x2bf4e9,_0x2e3d44){if(_0x2bf4e9[_0x2cea('0x17')]['id']){delete _0x2bf4e9[_0x2cea('0x17')]['id'];}if(_0x2bf4e9[_0x2cea('0x15')]['id']){return pm2[_0x2cea('0x22')](_0x2bf4e9[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](function(_0x2e1cd6){pm2[_0x2cea('0x1d')]();return _0x2e1cd6[0x0];})[_0x2cea('0xe')](respondWithResult(_0x2e3d44,null))['catch'](handleError(_0x2e3d44,null));}else{return _0x2e3d44[_0x2cea('0x5')](0x1f4)[_0x2cea('0x9')]({'message':_0x2cea('0x23')});}}; \ No newline at end of file +var _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xde2c,0x7f));var _0xcde2=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xde2c[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 7868d56..51efa42 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 _0x7ff8=['get','/agents','/queues','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x8745ea,_0x335ac7){var _0x36323c=function(_0x319617){while(--_0x319617){_0x8745ea['push'](_0x8745ea['shift']());}};_0x36323c(++_0x335ac7);}(_0x7ff8,0x1aa));var _0x87ff=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x7ff8[_0x5cb97e];return _0x1714b4;};'use strict';var express=require(_0x87ff('0x0'));var router=express[_0x87ff('0x1')]();var auth=require(_0x87ff('0x2'));var controller=require(_0x87ff('0x3'));router[_0x87ff('0x4')](_0x87ff('0x5'),auth['isAuthenticated'](),controller['getAgents']);router[_0x87ff('0x4')](_0x87ff('0x6'),auth[_0x87ff('0x7')](),controller[_0x87ff('0x8')]);module[_0x87ff('0x9')]=router; \ No newline at end of file +var _0x3c1d=['isAuthenticated','getAgents','get','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','/agents'];(function(_0x5bb508,_0x22b021){var _0x20d3ff=function(_0x19c3a3){while(--_0x19c3a3){_0x5bb508['push'](_0x5bb508['shift']());}};_0x20d3ff(++_0x22b021);}(_0x3c1d,0x171));var _0xd3c1=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3c1d[_0xa148b7];return _0x51efd3;};'use strict';var express=require(_0xd3c1('0x0'));var router=express[_0xd3c1('0x1')]();var auth=require(_0xd3c1('0x2'));var controller=require(_0xd3c1('0x3'));router['get'](_0xd3c1('0x4'),auth[_0xd3c1('0x5')](),controller[_0xd3c1('0x6')]);router[_0xd3c1('0x7')](_0xd3c1('0x8'),auth[_0xd3c1('0x5')](),controller[_0xd3c1('0x9')]);module[_0xd3c1('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 723fe97..fba1c2a 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 _0x3291=['online','extraQueryConditions','assign','omit','UserProfile','findAndCountAll','find','globalStatus','getAgentStatus','talking','voiceStatus','sortAgentsByStatus','rows','pick','catch','getQueues','format','name','voice','outbound','dialActive','QueueCampaigns','Queues','filter','getResources','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','sort','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','map','User','fieldName','type','key','role','getOptions','raw','length','sequelize','literal','FIELD(id,','forEach','*pause','push','Pause','where','merge','user','userProfileId','Agents'];(function(_0x560cae,_0x33c770){var _0x4e3c5d=function(_0xf12a74){while(--_0xf12a74){_0x560cae['push'](_0x560cae['shift']());}};_0x4e3c5d(++_0x33c770);}(_0x3291,0x163));var _0x1329=function(_0x4e833b,_0x375f60){_0x4e833b=_0x4e833b-0x0;var _0x278ea5=_0x3291[_0x4e833b];return _0x278ea5;};'use strict';var _=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var rta=require(_0x1329('0x2'));var rtq=require(_0x1329('0x3'));var qs=require(_0x1329('0x4'));var utils=require(_0x1329('0x5'));var db=require(_0x1329('0x6'))['db'];var APIBadRequestError=require(_0x1329('0x7'))[_0x1329('0x8')];var APIHandleError=require(_0x1329('0x7'))[_0x1329('0x9')];function respondWithFilteredResult(_0x1ba2c4,_0x5337c4){return function(_0x2fe1f7){if(_0x2fe1f7){var _0x535c51=typeof _0x5337c4[_0x1329('0xa')]===_0x1329('0xb')&&typeof _0x5337c4[_0x1329('0xc')]===_0x1329('0xb');var _0x15a1b7=_0x2fe1f7[_0x1329('0xd')];var _0x4ba5c4=_0x535c51?0x0:_0x5337c4['offset'];var _0xdf8cb8=_0x535c51?_0x2fe1f7[_0x1329('0xd')]:_0x5337c4[_0x1329('0xa')]+_0x5337c4[_0x1329('0xc')];var _0x313ca7;if(_0xdf8cb8>=_0x15a1b7){_0xdf8cb8=_0x15a1b7;_0x313ca7=0xc8;}else{_0x313ca7=0xce;}_0x1ba2c4[_0x1329('0xe')](_0x313ca7);return _0x1ba2c4['set'](_0x1329('0xf'),_0x4ba5c4+'-'+_0xdf8cb8+'/'+_0x15a1b7)[_0x1329('0x10')](_0x2fe1f7);}return null;};}exports[_0x1329('0x11')]=function(_0x52677c,_0xe8d1f4){var _0x2ef340={'count':0x0,'rows':[]};var _0x4c7001={};var _0x4da60b;var _0x9befc9=utils[_0x1329('0x12')]();var _0x554645;var _0x57bbe3;var _0x41497b=_0x52677c[_0x1329('0x13')][_0x1329('0x14')];var _0x1334b1=_0x52677c[_0x1329('0x13')][_0x1329('0x15')];var _0x252c39=_0x52677c[_0x1329('0x13')][_0x1329('0x16')];var _0x20b790=_0x1334b1===_0x1329('0x17')||_0x1334b1==='*pause'?!![]:![];var _0x4c3277=[];var _0x25b877;var _0x159759;Promise[_0x1329('0x18')]()[_0x1329('0x19')](function(){if(_0x52677c[_0x1329('0x13')]['channel']){if(!utils['isValidChannel'](_0x52677c[_0x1329('0x13')][_0x1329('0x1a')])){throw new APIBadRequestError(util['format'](_0x1329('0x1b'),_0x52677c[_0x1329('0x13')]['channel']));}_0x4da60b=_0x52677c[_0x1329('0x13')][_0x1329('0x1a')]['toLowerCase']();}if(!_0x52677c[_0x1329('0x13')][_0x1329('0x1c')]||!_0x52677c[_0x1329('0x13')][_0x1329('0x1c')]['includes']('globalStatus')){_0x52677c['query'][_0x1329('0x1c')]=rta['validateSortParameter'](_0x52677c[_0x1329('0x13')][_0x1329('0x1c')]);return;}var _0x156e11=rta[_0x1329('0x1d')](_0x52677c['query'][_0x1329('0x1c')]);_0x52677c[_0x1329('0x13')]['sort']=_0x156e11[_0x1329('0x1e')][_0x1329('0x1f')](',');_0x25b877=_0x156e11[_0x1329('0x20')];})[_0x1329('0x19')](function(){if(!_0x41497b){return[];}return rta['getAgentIdsByQueues'](_0x41497b,_0x4da60b);})[_0x1329('0x19')](function(_0x7e79a6){_0x4c3277=_0x7e79a6;return rta[_0x1329('0x21')]();})[_0x1329('0x19')](function(_0x389cdd){_0x57bbe3=_0x389cdd['rows'];if((!_0x1334b1||_0x20b790)&&!_0x25b877){return _0x4c3277;}if(_0x25b877&&!_0x1334b1){return rta['getSortedAgentsIdsByStatus'](_0x57bbe3,_0x4c3277,_0x25b877);}else{return rta['getAgentIdsByStatus'](_0x57bbe3,_0x4c3277,_0x1334b1);}})[_0x1329('0x19')](function(_0x15093c){_0x4c3277=_0x15093c;var _0x50cb9a=![];if(_0x4c3277['length']===0x0){if(_0x41497b||_0x1334b1){_0x50cb9a=!![];}if(_0x20b790){_0x50cb9a=![];}}if(_0x50cb9a){return _0x2ef340;}var _0x3e7914=_[_0x1329('0x22')](db[_0x1329('0x23')]['rawAttributes'],function(_0x2d847b){return{'name':_0x2d847b[_0x1329('0x24')],'type':_0x2d847b[_0x1329('0x25')][_0x1329('0x26')]};});_0x52677c[_0x1329('0x13')][_0x1329('0x27')]='agent';_0x4c7001=qs[_0x1329('0x28')](_0x3e7914,_0x52677c);_0x4c7001[_0x1329('0x29')]=!![];var _0x303cac=[];if(_0x4c3277[_0x1329('0x2a')]>0x0){_0x303cac['push']({'id':{'$in':_0x4c3277}});if(_0x25b877&&!_0x1334b1){_0x159759=[db[_0x1329('0x2b')][_0x1329('0x2c')](_0x1329('0x2d')+_0x4c3277+')')];_0x4c7001[_0x1329('0x20')]=_0x159759;}}if(_0x20b790){_0x9befc9[_0x1329('0x2e')](function(_0x4e22da){var _0x4590e5=!![];if(_0x1334b1===_0x1329('0x2f')&&_0x4da60b!==_0x4e22da){_0x4590e5=![];}_0x303cac[_0x1329('0x30')]({[_0x4e22da+_0x1329('0x31')]:_0x4590e5});});if(_0x252c39){_0x303cac[_0x1329('0x30')]({'pauseType':_0x252c39});}}else if(_0x1334b1){_0x9befc9[_0x1329('0x2e')](function(_0x3807a9){_0x303cac[_0x1329('0x30')]({[_0x3807a9+_0x1329('0x31')]:![]});});}_0x4c7001[_0x1329('0x32')]=_[_0x1329('0x33')](_0x4c7001[_0x1329('0x32')],{'$and':_0x303cac});if(_0x52677c['user'][_0x1329('0x27')]===_0x1329('0x34')){var _0x2c894c={'params':{'id':_0x52677c[_0x1329('0x34')][_0x1329('0x35')]},'query':{'section':_0x1329('0x36'),'role':'agent','raw':!![],'ids':_0x4c3277,'customSorting':_0x159759}};if(_0x52677c[_0x1329('0x13')][_0x1329('0x37')]){_0x2c894c[_0x1329('0x13')]['online']=!![];}if(_0x20b790){_0x2c894c[_0x1329('0x13')][_0x1329('0x38')]=_0x303cac;}_0x2c894c[_0x1329('0x13')]=Object[_0x1329('0x39')](_0x2c894c['query'],_[_0x1329('0x3a')](_0x52677c['query'],'id'));return db[_0x1329('0x3b')]['getResources'](_0x2c894c);}return db['User'][_0x1329('0x3c')](_0x4c7001);})[_0x1329('0x19')](function(_0x50558c){_0x2ef340[_0x1329('0xd')]=_0x50558c['count'];_0x554645=_0x50558c['rows'];return _0x554645['map'](function(_0x502934){var _0x6e9781=_[_0x1329('0x3d')](_0x57bbe3,['id',_0x502934['id']]);if(_0x6e9781){var _0x44775d=rta['filterAgentAttributes'](_0x6e9781);_['merge'](_0x502934,_0x44775d);}_0x502934[_0x1329('0x3e')]=rta[_0x1329('0x3f')](_0x502934);if(_0x502934['globalStatus']['includes'](_0x1329('0x17'))){_0x9befc9[_0x1329('0x2e')](function(_0x212bea){if(_0x502934[_0x212bea+'Pause']){if(_0x212bea==='voice'){if(_0x502934['voiceStatus']!==_0x1329('0x40')){_0x502934[_0x1329('0x41')]='pause';}}else{_0x502934[_0x212bea+'Status']=_0x1329('0x17');}}});}return _0x502934;});})[_0x1329('0x19')](function(_0x14b2fc){if(!_0x25b877||_0x159759){return _0x14b2fc;}return rta[_0x1329('0x42')](_0x14b2fc,_0x25b877);})['then'](function(_0x57fe24){var _0x3fbd4e=rta['getRealtimeAgentsQueryFields']();_0x2ef340[_0x1329('0x43')]=_0x57fe24[_0x1329('0x22')](function(_0x4a6b86){return _[_0x1329('0x44')](_0x4a6b86,_0x3fbd4e);});return _0x2ef340;})[_0x1329('0x19')](respondWithFilteredResult(_0xe8d1f4,_0x4c7001))[_0x1329('0x45')](APIHandleError(_0xe8d1f4));};exports[_0x1329('0x46')]=function(_0x521d64,_0x5bfa51){var _0x2c14db={'count':0x0,'rows':[]};var _0x1d3751={};var _0x3ea52a;var _0x25f8dd;var _0x31cb00;Promise[_0x1329('0x18')]()['then'](function(){if(_0x521d64[_0x1329('0x13')][_0x1329('0x1a')]){if(!utils['isValidChannel'](_0x521d64[_0x1329('0x13')][_0x1329('0x1a')])){throw new APIBadRequestError(util[_0x1329('0x47')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x521d64[_0x1329('0x13')][_0x1329('0x1a')]));}_0x3ea52a=_0x521d64['query']['channel']['toLowerCase']();}var _0x1b6ca4=_['startCase'](_0x3ea52a)+'Queue';var _0x1d41bb=_[_0x1329('0x22')](db[_0x1b6ca4]['rawAttributes'],function(_0x143a81){return{'name':_0x143a81[_0x1329('0x24')],'type':_0x143a81[_0x1329('0x25')][_0x1329('0x26')]};});if(!_0x521d64[_0x1329('0x13')]['fields']){var _0x2533ad=['id',_0x1329('0x48')];if(_0x3ea52a===_0x1329('0x49')){_0x2533ad[_0x1329('0x30')](_0x1329('0x25'));if(_0x521d64[_0x1329('0x13')][_0x1329('0x25')]===_0x1329('0x4a')){_0x2533ad[_0x1329('0x30')]([_0x1329('0x4b'),'dialMethod']);}}_0x521d64[_0x1329('0x13')][_0x1329('0x1e')]=_0x2533ad[_0x1329('0x1f')](',');}_0x1d3751=qs[_0x1329('0x28')](_0x1d41bb,_0x521d64);if(_0x521d64[_0x1329('0x34')][_0x1329('0x27')]===_0x1329('0x34')){var _0x5234f6={'params':{'id':_0x521d64[_0x1329('0x34')][_0x1329('0x35')]},'query':{'section':_0x3ea52a===_0x1329('0x49')&&_0x521d64[_0x1329('0x13')][_0x1329('0x25')]===_0x1329('0x4a')?_0x1329('0x4c'):_['startCase'](_0x3ea52a)+_0x1329('0x4d'),'type':_0x521d64[_0x1329('0x13')][_0x1329('0x25')],'nolimit':!![],'sort':_0x1329('0x48'),'filter':_0x521d64[_0x1329('0x13')][_0x1329('0x4e')]}};_0x5234f6['query']=Object['assign'](_0x5234f6[_0x1329('0x13')],_0x521d64[_0x1329('0x13')]);delete _0x5234f6[_0x1329('0x13')]['id'];return db[_0x1329('0x3b')][_0x1329('0x4f')](_0x5234f6);}return db[_0x1b6ca4][_0x1329('0x3c')](_0x1d3751);})[_0x1329('0x19')](function(_0x12ceb5){_0x2c14db['count']=_0x12ceb5[_0x1329('0xd')];_0x25f8dd=_0x12ceb5[_0x1329('0x43')];return rtq[_0x1329('0x50')](_0x521d64,_0x3ea52a);})[_0x1329('0x19')](function(_0x5e6776){_0x31cb00=_0x5e6776['rows'];return rtq[_0x1329('0x51')](_0x25f8dd,_0x31cb00,_0x3ea52a,_0x521d64['query'][_0x1329('0x25')]);})[_0x1329('0x19')](function(_0x5ec17b){_0x2c14db['rows']=_0x5ec17b;return _0x2c14db;})[_0x1329('0x19')](respondWithFilteredResult(_0x5bfa51,_0x1d3751))['catch'](APIHandleError(_0x5bfa51));}; \ No newline at end of file +var _0xa294=['format','Queue','type','fields','name','voice','outbound','dialActive','dialMethod','QueueCampaigns','startCase','Queues','filter','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','rows','getAgentIdsByStatus','map','User','rawAttributes','fieldName','key','role','getOptions','raw','length','sequelize','literal','FIELD(id,','forEach','push','Pause','merge','where','user','userProfileId','Agents','agent','online','extraQueryConditions','assign','omit','getResources','findAndCountAll','find','filterAgentAttributes','globalStatus','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel'];(function(_0x27a125,_0x330c0e){var _0x36eac1=function(_0x49265f){while(--_0x49265f){_0x27a125['push'](_0x27a125['shift']());}};_0x36eac1(++_0x330c0e);}(_0xa294,0x176));var _0x4a29=function(_0x14b835,_0x4c7e96){_0x14b835=_0x14b835-0x0;var _0x49a0f8=_0xa294[_0x14b835];return _0x49a0f8;};'use strict';var _=require(_0x4a29('0x0'));var util=require(_0x4a29('0x1'));var rta=require(_0x4a29('0x2'));var rtq=require(_0x4a29('0x3'));var qs=require(_0x4a29('0x4'));var utils=require(_0x4a29('0x5'));var db=require(_0x4a29('0x6'))['db'];var APIBadRequestError=require(_0x4a29('0x7'))['APIBadRequestError'];var APIHandleError=require(_0x4a29('0x7'))[_0x4a29('0x8')];function respondWithFilteredResult(_0x4a3ef7,_0x64470b){return function(_0x360af0){if(_0x360af0){var _0x1bbfbb=typeof _0x64470b[_0x4a29('0x9')]===_0x4a29('0xa')&&typeof _0x64470b[_0x4a29('0xb')]===_0x4a29('0xa');var _0x1fd79d=_0x360af0[_0x4a29('0xc')];var _0x1b38b0=_0x1bbfbb?0x0:_0x64470b['offset'];var _0x36387e=_0x1bbfbb?_0x360af0['count']:_0x64470b[_0x4a29('0x9')]+_0x64470b[_0x4a29('0xb')];var _0x344f24;if(_0x36387e>=_0x1fd79d){_0x36387e=_0x1fd79d;_0x344f24=0xc8;}else{_0x344f24=0xce;}_0x4a3ef7[_0x4a29('0xd')](_0x344f24);return _0x4a3ef7[_0x4a29('0xe')](_0x4a29('0xf'),_0x1b38b0+'-'+_0x36387e+'/'+_0x1fd79d)['json'](_0x360af0);}return null;};}exports['getAgents']=function(_0x4e8a33,_0x59c75c){var _0xb0d507={'count':0x0,'rows':[]};var _0x551a10={};var _0x32049e;var _0x4a3ba2=utils[_0x4a29('0x10')]();var _0x34cb00;var _0x1abdd2;var _0x2d869d=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x12')];var _0x2f06ac=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x13')];var _0x5ebd4d=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x14')];var _0x1b0abc=_0x2f06ac===_0x4a29('0x15')||_0x2f06ac===_0x4a29('0x16')?!![]:![];var _0x14fd15=[];var _0x2a23a6;var _0x145e9a;Promise['resolve']()[_0x4a29('0x17')](function(){if(_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x18')]){if(!utils['isValidChannel'](_0x4e8a33[_0x4a29('0x11')]['channel'])){throw new APIBadRequestError(util['format'](_0x4a29('0x19'),_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x18')]));}_0x32049e=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x18')][_0x4a29('0x1a')]();}if(!_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x1b')]||!_0x4e8a33[_0x4a29('0x11')]['sort'][_0x4a29('0x1c')]('globalStatus')){_0x4e8a33['query'][_0x4a29('0x1b')]=rta[_0x4a29('0x1d')](_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x1b')]);return;}var _0x89106=rta[_0x4a29('0x1e')](_0x4e8a33['query'][_0x4a29('0x1b')]);_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x1b')]=_0x89106['fields'][_0x4a29('0x1f')](',');_0x2a23a6=_0x89106[_0x4a29('0x20')];})[_0x4a29('0x17')](function(){if(!_0x2d869d){return[];}return rta[_0x4a29('0x21')](_0x2d869d,_0x32049e);})['then'](function(_0x27b385){_0x14fd15=_0x27b385;return rta['getRealtimeAgents']();})[_0x4a29('0x17')](function(_0x58ef4f){_0x1abdd2=_0x58ef4f[_0x4a29('0x22')];if((!_0x2f06ac||_0x1b0abc)&&!_0x2a23a6){return _0x14fd15;}if(_0x2a23a6&&!_0x2f06ac){return rta['getSortedAgentsIdsByStatus'](_0x1abdd2,_0x14fd15,_0x2a23a6);}else{return rta[_0x4a29('0x23')](_0x1abdd2,_0x14fd15,_0x2f06ac);}})[_0x4a29('0x17')](function(_0x28c116){_0x14fd15=_0x28c116;var _0x49ac30=![];if(_0x14fd15['length']===0x0){if(_0x2d869d||_0x2f06ac){_0x49ac30=!![];}if(_0x1b0abc){_0x49ac30=![];}}if(_0x49ac30){return _0xb0d507;}var _0x280149=_[_0x4a29('0x24')](db[_0x4a29('0x25')][_0x4a29('0x26')],function(_0x9ffe3c){return{'name':_0x9ffe3c[_0x4a29('0x27')],'type':_0x9ffe3c['type'][_0x4a29('0x28')]};});_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x29')]='agent';_0x551a10=qs[_0x4a29('0x2a')](_0x280149,_0x4e8a33);_0x551a10[_0x4a29('0x2b')]=!![];var _0x56ea79=[];if(_0x14fd15[_0x4a29('0x2c')]>0x0){_0x56ea79['push']({'id':{'$in':_0x14fd15}});if(_0x2a23a6&&!_0x2f06ac){_0x145e9a=[db[_0x4a29('0x2d')][_0x4a29('0x2e')](_0x4a29('0x2f')+_0x14fd15+')')];_0x551a10['order']=_0x145e9a;}}if(_0x1b0abc){_0x4a3ba2[_0x4a29('0x30')](function(_0x3020c2){var _0x1dd1b0=!![];if(_0x2f06ac===_0x4a29('0x16')&&_0x32049e!==_0x3020c2){_0x1dd1b0=![];}_0x56ea79['push']({[_0x3020c2+'Pause']:_0x1dd1b0});});if(_0x5ebd4d){_0x56ea79['push']({'pauseType':_0x5ebd4d});}}else if(_0x2f06ac){_0x4a3ba2[_0x4a29('0x30')](function(_0x32c7d2){_0x56ea79[_0x4a29('0x31')]({[_0x32c7d2+_0x4a29('0x32')]:![]});});}_0x551a10['where']=_[_0x4a29('0x33')](_0x551a10[_0x4a29('0x34')],{'$and':_0x56ea79});if(_0x4e8a33['user'][_0x4a29('0x29')]===_0x4a29('0x35')){var _0x2414c6={'params':{'id':_0x4e8a33[_0x4a29('0x35')][_0x4a29('0x36')]},'query':{'section':_0x4a29('0x37'),'role':_0x4a29('0x38'),'raw':!![],'ids':_0x14fd15,'customSorting':_0x145e9a}};if(_0x4e8a33['query']['online']){_0x2414c6[_0x4a29('0x11')][_0x4a29('0x39')]=!![];}if(_0x1b0abc){_0x2414c6['query'][_0x4a29('0x3a')]=_0x56ea79;}_0x2414c6[_0x4a29('0x11')]=Object[_0x4a29('0x3b')](_0x2414c6[_0x4a29('0x11')],_[_0x4a29('0x3c')](_0x4e8a33['query'],'id'));return db['UserProfile'][_0x4a29('0x3d')](_0x2414c6);}return db[_0x4a29('0x25')][_0x4a29('0x3e')](_0x551a10);})['then'](function(_0x353a4f){_0xb0d507[_0x4a29('0xc')]=_0x353a4f[_0x4a29('0xc')];_0x34cb00=_0x353a4f[_0x4a29('0x22')];return _0x34cb00[_0x4a29('0x24')](function(_0x3ab705){var _0x2b6a3c=_[_0x4a29('0x3f')](_0x1abdd2,['id',_0x3ab705['id']]);if(_0x2b6a3c){var _0x6b96ad=rta[_0x4a29('0x40')](_0x2b6a3c);_[_0x4a29('0x33')](_0x3ab705,_0x6b96ad);}_0x3ab705[_0x4a29('0x41')]=rta[_0x4a29('0x42')](_0x3ab705);if(_0x3ab705[_0x4a29('0x41')][_0x4a29('0x1c')](_0x4a29('0x15'))){_0x4a3ba2[_0x4a29('0x30')](function(_0x2f9957){if(_0x3ab705[_0x2f9957+_0x4a29('0x32')]){if(_0x2f9957==='voice'){if(_0x3ab705[_0x4a29('0x43')]!==_0x4a29('0x44')){_0x3ab705[_0x4a29('0x43')]=_0x4a29('0x15');}}else{_0x3ab705[_0x2f9957+_0x4a29('0x45')]=_0x4a29('0x15');}}});}return _0x3ab705;});})['then'](function(_0x583b0b){if(!_0x2a23a6||_0x145e9a){return _0x583b0b;}return rta[_0x4a29('0x46')](_0x583b0b,_0x2a23a6);})[_0x4a29('0x17')](function(_0x4962ec){var _0x5a740c=rta[_0x4a29('0x47')]();_0xb0d507[_0x4a29('0x22')]=_0x4962ec[_0x4a29('0x24')](function(_0x3e97cd){return _[_0x4a29('0x48')](_0x3e97cd,_0x5a740c);});return _0xb0d507;})[_0x4a29('0x17')](respondWithFilteredResult(_0x59c75c,_0x551a10))[_0x4a29('0x49')](APIHandleError(_0x59c75c));};exports[_0x4a29('0x4a')]=function(_0xec88bd,_0x3c5db3){var _0x100219={'count':0x0,'rows':[]};var _0x2bc7ed={};var _0x5b5251;var _0x1e2647;var _0x491b3d;Promise['resolve']()[_0x4a29('0x17')](function(){if(_0xec88bd[_0x4a29('0x11')][_0x4a29('0x18')]){if(!utils[_0x4a29('0x4b')](_0xec88bd[_0x4a29('0x11')][_0x4a29('0x18')])){throw new APIBadRequestError(util[_0x4a29('0x4c')](_0x4a29('0x19'),_0xec88bd['query'][_0x4a29('0x18')]));}_0x5b5251=_0xec88bd[_0x4a29('0x11')]['channel'][_0x4a29('0x1a')]();}var _0x178c14=_['startCase'](_0x5b5251)+_0x4a29('0x4d');var _0x174c97=_[_0x4a29('0x24')](db[_0x178c14][_0x4a29('0x26')],function(_0x554cc0){return{'name':_0x554cc0[_0x4a29('0x27')],'type':_0x554cc0[_0x4a29('0x4e')][_0x4a29('0x28')]};});if(!_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4f')]){var _0x3eda58=['id',_0x4a29('0x50')];if(_0x5b5251===_0x4a29('0x51')){_0x3eda58[_0x4a29('0x31')](_0x4a29('0x4e'));if(_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')]===_0x4a29('0x52')){_0x3eda58['push']([_0x4a29('0x53'),_0x4a29('0x54')]);}}_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4f')]=_0x3eda58['join'](',');}_0x2bc7ed=qs[_0x4a29('0x2a')](_0x174c97,_0xec88bd);if(_0xec88bd[_0x4a29('0x35')][_0x4a29('0x29')]==='user'){var _0x4a7cd9={'params':{'id':_0xec88bd['user']['userProfileId']},'query':{'section':_0x5b5251==='voice'&&_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')]===_0x4a29('0x52')?_0x4a29('0x55'):_[_0x4a29('0x56')](_0x5b5251)+_0x4a29('0x57'),'type':_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')],'nolimit':!![],'sort':'name','filter':_0xec88bd[_0x4a29('0x11')][_0x4a29('0x58')]}};_0x4a7cd9[_0x4a29('0x11')]=Object[_0x4a29('0x3b')](_0x4a7cd9[_0x4a29('0x11')],_0xec88bd['query']);delete _0x4a7cd9['query']['id'];return db['UserProfile'][_0x4a29('0x3d')](_0x4a7cd9);}return db[_0x178c14][_0x4a29('0x3e')](_0x2bc7ed);})[_0x4a29('0x17')](function(_0x5f4b62){_0x100219['count']=_0x5f4b62[_0x4a29('0xc')];_0x1e2647=_0x5f4b62['rows'];return rtq[_0x4a29('0x59')](_0xec88bd,_0x5b5251);})[_0x4a29('0x17')](function(_0x238ef3){_0x491b3d=_0x238ef3[_0x4a29('0x22')];return rtq['initializeQueues'](_0x1e2647,_0x491b3d,_0x5b5251,_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')]);})[_0x4a29('0x17')](function(_0x868d6e){_0x100219[_0x4a29('0x22')]=_0x868d6e;return _0x100219;})[_0x4a29('0x17')](respondWithFilteredResult(_0x3c5db3,_0x2bc7ed))[_0x4a29('0x49')](APIHandleError(_0x3c5db3));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 96aaa10..a217d0c 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x35be1c,_0x45a7ef){var _0x1d99e1=function(_0x4e8004){while(--_0x4e8004){_0x35be1c['push'](_0x35be1c['shift']());}};_0x1d99e1(++_0x45a7ef);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x199bdd,_0x5f09e2){var _0x5c4f2f=function(_0xac4ba8){while(--_0xac4ba8){_0x199bdd['push'](_0x199bdd['shift']());}};_0x5c4f2f(++_0x5f09e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2d007b4..13ab58a 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 _0x3b74=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x178625,_0x26aaf8){var _0x6320de=function(_0x193175){while(--_0x193175){_0x178625['push'](_0x178625['shift']());}};_0x6320de(++_0x26aaf8);}(_0x3b74,0x80));var _0x43b7=function(_0x4e4d5c,_0x25dd3a){_0x4e4d5c=_0x4e4d5c-0x0;var _0x56854a=_0x3b74[_0x4e4d5c];return _0x56854a;};'use strict';var Sequelize=require(_0x43b7('0x0'));module[_0x43b7('0x1')]={'state':{'type':Sequelize[_0x43b7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x43b7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x43b7('0x3')]},'starttime':{'type':Sequelize[_0x43b7('0x4')]},'responsetime':{'type':Sequelize[_0x43b7('0x4')]},'ringtime':{'type':Sequelize[_0x43b7('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x43b7('0x3')]},'membername':{'type':Sequelize[_0x43b7('0x3')]}}; \ No newline at end of file +var _0x565f=['exports','INTEGER','STRING','DATE'];(function(_0x33ac75,_0x4953e3){var _0x34d5f2=function(_0x4c2b4a){while(--_0x4c2b4a){_0x33ac75['push'](_0x33ac75['shift']());}};_0x34d5f2(++_0x4953e3);}(_0x565f,0x68));var _0xf565=function(_0x3887a3,_0x5155c6){_0x3887a3=_0x3887a3-0x0;var _0x155e10=_0x565f[_0x3887a3];return _0x155e10;};'use strict';var Sequelize=require('sequelize');module[_0xf565('0x0')]={'state':{'type':Sequelize[_0xf565('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf565('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xf565('0x2')]},'starttime':{'type':Sequelize[_0xf565('0x3')]},'responsetime':{'type':Sequelize[_0xf565('0x3')]},'ringtime':{'type':Sequelize[_0xf565('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf565('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7a481a2..b366fc2 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 _0x7c04=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7c04,0xa0));var _0x47c0=function(_0x214983,_0xe60f53){_0x214983=_0x214983-0x0;var _0x2feb34=_0x7c04[_0x214983];return _0x2feb34;};'use strict';var _=require(_0x47c0('0x0'));var util=require(_0x47c0('0x1'));var logger=require(_0x47c0('0x2'))(_0x47c0('0x3'));var moment=require(_0x47c0('0x4'));var BPromise=require('bluebird');var rp=require(_0x47c0('0x5'));var fs=require('fs');var path=require(_0x47c0('0x6'));var rimraf=require(_0x47c0('0x7'));var config=require(_0x47c0('0x8'));var attributes=require(_0x47c0('0x9'));module['exports']=function(_0x3aaebb,_0x168f20){return _0x3aaebb['define']('ReportAgentPreview',attributes,{'tableName':_0x47c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ce=['../../config/logger','api','moment','request-promise','path','rimraf','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x5ddcff,_0x3df8ef){var _0x55a734=function(_0xbbaf39){while(--_0xbbaf39){_0x5ddcff['push'](_0x5ddcff['shift']());}};_0x55a734(++_0x3df8ef);}(_0xe1ce,0x18a));var _0xee1c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xe1ce[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xee1c('0x0'));var util=require(_0xee1c('0x1'));var logger=require(_0xee1c('0x2'))(_0xee1c('0x3'));var moment=require(_0xee1c('0x4'));var BPromise=require('bluebird');var rp=require(_0xee1c('0x5'));var fs=require('fs');var path=require(_0xee1c('0x6'));var rimraf=require(_0xee1c('0x7'));var config=require('../../config/environment');var attributes=require(_0xee1c('0x8'));module['exports']=function(_0x3fccc4,_0x52f16e){return _0x3fccc4['define'](_0xee1c('0x9'),attributes,{'tableName':_0xee1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c12ded3..dc0f148 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 _0xf58e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','CreateReportAgentPreview','create','body','options','debug','stringify','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf58e,0x11f));var _0xef58=function(_0x5d4b55,_0x379c7f){_0x5d4b55=_0x5d4b55-0x0;var _0x2ab53c=_0xf58e[_0x5d4b55];return _0x2ab53c;};'use strict';var _=require(_0xef58('0x0'));var util=require(_0xef58('0x1'));var moment=require(_0xef58('0x2'));var BPromise=require(_0xef58('0x3'));var rs=require(_0xef58('0x4'));var fs=require('fs');var Redis=require(_0xef58('0x5'));var db=require(_0xef58('0x6'))['db'];var utils=require(_0xef58('0x7'));var logger=require('../../config/logger')(_0xef58('0x8'));var config=require(_0xef58('0x9'));var jayson=require(_0xef58('0xa'));var client=jayson[_0xef58('0xb')][_0xef58('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f2560,_0xe98cf0,_0x34c31f){return new BPromise(function(_0x4898f5,_0x1308af){return client[_0xef58('0xd')](_0x4f2560,_0x34c31f)[_0xef58('0xe')](function(_0x29220c){logger['info'](_0xef58('0xf'),_0xe98cf0,_0xef58('0x10'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xe98cf0,'request\x20sent',JSON['stringify'](_0x29220c));if(_0x29220c['error']){if(_0x29220c['error'][_0xef58('0x11')]===0x1f4){logger[_0xef58('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xe98cf0,_0x29220c[_0xef58('0x12')][_0xef58('0x13')]);return _0x1308af(_0x29220c[_0xef58('0x12')]['message']);}logger[_0xef58('0x12')](_0xef58('0xf'),_0xe98cf0,_0x29220c[_0xef58('0x12')][_0xef58('0x13')]);return _0x4898f5(_0x29220c[_0xef58('0x12')][_0xef58('0x13')]);}else{logger[_0xef58('0x14')](_0xef58('0xf'),_0xe98cf0,_0xef58('0x10'));_0x4898f5(_0x29220c[_0xef58('0x15')][_0xef58('0x13')]);}})[_0xef58('0x16')](function(_0x2dd6c0){logger[_0xef58('0x12')](_0xef58('0xf'),_0xe98cf0,_0x2dd6c0);_0x1308af(_0x2dd6c0);});});}exports[_0xef58('0x17')]=function(_0xc42ac5){var _0x1bfb23=this;return new Promise(function(_0x257f4b,_0x17cfc3){return db['ReportAgentPreview'][_0xef58('0x18')](_0xc42ac5[_0xef58('0x19')],{'raw':_0xc42ac5['options']?_0xc42ac5[_0xef58('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x10b6cb){logger['info'](_0xef58('0x17'),_0xc42ac5);logger[_0xef58('0x1b')](_0xef58('0x17'),_0xc42ac5,JSON[_0xef58('0x1c')](_0x10b6cb));_0x257f4b(_0x10b6cb);})[_0xef58('0x16')](function(_0x16ea8c){logger[_0xef58('0x12')](_0xef58('0x17'),_0x16ea8c['message'],_0xc42ac5);_0x17cfc3(_0x1bfb23[_0xef58('0x12')](0x1f4,_0x16ea8c['message']));});});}; \ No newline at end of file +var _0xecfb=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x4731bb,_0x1a560c){var _0x1bab17=function(_0x4f8bd8){while(--_0x4f8bd8){_0x4731bb['push'](_0x4731bb['shift']());}};_0x1bab17(++_0x1a560c);}(_0xecfb,0x139));var _0xbecf=function(_0x5d98e4,_0x377619){_0x5d98e4=_0x5d98e4-0x0;var _0x36157d=_0xecfb[_0x5d98e4];return _0x36157d;};'use strict';var _=require(_0xbecf('0x0'));var util=require(_0xbecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbecf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbecf('0x3'));var logger=require(_0xbecf('0x4'))(_0xbecf('0x5'));var config=require(_0xbecf('0x6'));var jayson=require(_0xbecf('0x7'));var client=jayson[_0xbecf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7b7ff,_0x26946c,_0x219838){return new BPromise(function(_0x3391cf,_0x1fc6e9){return client['request'](_0xb7b7ff,_0x219838)[_0xbecf('0x9')](function(_0x5ddec8){logger[_0xbecf('0xa')](_0xbecf('0xb'),_0x26946c,'request\x20sent');logger[_0xbecf('0xc')](_0xbecf('0xd'),_0x26946c,_0xbecf('0xe'),JSON[_0xbecf('0xf')](_0x5ddec8));if(_0x5ddec8[_0xbecf('0x10')]){if(_0x5ddec8[_0xbecf('0x10')]['code']===0x1f4){logger[_0xbecf('0x10')](_0xbecf('0xb'),_0x26946c,_0x5ddec8[_0xbecf('0x10')][_0xbecf('0x11')]);return _0x1fc6e9(_0x5ddec8[_0xbecf('0x10')]['message']);}logger[_0xbecf('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x26946c,_0x5ddec8[_0xbecf('0x10')][_0xbecf('0x11')]);return _0x3391cf(_0x5ddec8[_0xbecf('0x10')][_0xbecf('0x11')]);}else{logger[_0xbecf('0xa')](_0xbecf('0xb'),_0x26946c,_0xbecf('0xe'));_0x3391cf(_0x5ddec8[_0xbecf('0x12')]['message']);}})[_0xbecf('0x13')](function(_0x1b403d){logger[_0xbecf('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x26946c,_0x1b403d);_0x1fc6e9(_0x1b403d);});});}exports['CreateReportAgentPreview']=function(_0x54cae7){var _0x49bff1=this;return new Promise(function(_0x2a995a,_0x5bf997){return db[_0xbecf('0x14')][_0xbecf('0x15')](_0x54cae7[_0xbecf('0x16')],{'raw':_0x54cae7['options']?_0x54cae7[_0xbecf('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbecf('0x9')](function(_0x197e34){logger[_0xbecf('0xa')](_0xbecf('0x18'),_0x54cae7);logger[_0xbecf('0xc')](_0xbecf('0x18'),_0x54cae7,JSON[_0xbecf('0xf')](_0x197e34));_0x2a995a(_0x197e34);})[_0xbecf('0x13')](function(_0x187ebc){logger['error'](_0xbecf('0x18'),_0x187ebc[_0xbecf('0x11')],_0x54cae7);_0x5bf997(_0x49bff1[_0xbecf('0x10')](0x1f4,_0x187ebc[_0xbecf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 463af06..d7caf2d 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 _0xcc82=['/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcc82,0x189));var _0x2cc8=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xcc82[_0x28b0a1];return _0x21470c;};'use strict';var multer=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var path=require(_0x2cc8('0x2'));var express=require(_0x2cc8('0x3'));var router=express[_0x2cc8('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x2cc8('0x5'));router['get'](_0x2cc8('0x6'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x8')]);router[_0x2cc8('0x9')](_0x2cc8('0xa'),auth['isAuthenticated'](),controller[_0x2cc8('0xb')]);router[_0x2cc8('0x9')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x2cc8('0xc')]);router[_0x2cc8('0x9')]('/voice/queues',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0xd')]);router[_0x2cc8('0x9')](_0x2cc8('0xe'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0xf')]);router[_0x2cc8('0x9')](_0x2cc8('0x10'),auth[_0x2cc8('0x7')](),controller['mailQueues']);router['get']('/mail/accounts',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x11')]);router[_0x2cc8('0x9')](_0x2cc8('0x12'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x13')]);router[_0x2cc8('0x9')]('/sms/queues',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x14')]);router['get'](_0x2cc8('0x15'),auth['isAuthenticated'](),controller[_0x2cc8('0x16')]);router[_0x2cc8('0x9')](_0x2cc8('0x17'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x18')]);router['get'](_0x2cc8('0x19'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x1a')]);router[_0x2cc8('0x9')](_0x2cc8('0x1b'),auth['isAuthenticated'](),controller[_0x2cc8('0x1c')]);router[_0x2cc8('0x9')](_0x2cc8('0x1d'),auth['isAuthenticated'](),controller[_0x2cc8('0x1e')]);router[_0x2cc8('0x9')](_0x2cc8('0x1f'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x20')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x2cc8('0x21')]);router[_0x2cc8('0x9')](_0x2cc8('0x22'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x23')]);router[_0x2cc8('0x24')](_0x2cc8('0x22'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x25')]);router['get'](_0x2cc8('0x26'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x27')]);router['get'](_0x2cc8('0x28'),auth[_0x2cc8('0x7')](),controller['outboundChannels']);router[_0x2cc8('0x9')](_0x2cc8('0x29'),auth['isAuthenticated'](),controller[_0x2cc8('0x2a')]);router[_0x2cc8('0x24')](_0x2cc8('0x2b'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x2c')]);router['get'](_0x2cc8('0x2d'),auth['isAuthenticated'](),controller[_0x2cc8('0x2e')]);router[_0x2cc8('0x9')](_0x2cc8('0x2f'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x30')]);router['get'](_0x2cc8('0x31'),auth['isAuthenticated'](),controller[_0x2cc8('0x32')]);router['get'](_0x2cc8('0x33'),auth['isAuthenticated'](),controller[_0x2cc8('0x34')]);router['get'](_0x2cc8('0x35'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x36')]);router[_0x2cc8('0x9')]('/mail/queues/waitinginteractions',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x37')]);router['get'](_0x2cc8('0x38'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2cc8('0x9')](_0x2cc8('0x39'),auth['isAuthenticated'](),controller[_0x2cc8('0x3a')]);router[_0x2cc8('0x9')]('/sms/queues/waitinginteractions',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x3b')]);router[_0x2cc8('0x9')](_0x2cc8('0x3c'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x3d')]);router[_0x2cc8('0x9')](_0x2cc8('0x3e'),auth[_0x2cc8('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x2cc8('0x3f')](_0x2cc8('0x40'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x41')](_0x2cc8('0x42')));router[_0x2cc8('0x9')](_0x2cc8('0x43'),auth['isAuthenticated'](),controller[_0x2cc8('0x44')]);router[_0x2cc8('0x3f')](_0x2cc8('0x45'),auth[_0x2cc8('0x7')](),controller['queueNotify'](_0x2cc8('0x46')));router[_0x2cc8('0x9')]('/chat/queues/:id',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x47')]);router['post'](_0x2cc8('0x48'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x41')]('fax'));router[_0x2cc8('0x9')](_0x2cc8('0x49'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x4a')]);router[_0x2cc8('0x3f')](_0x2cc8('0x4b'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x41')](_0x2cc8('0x4c')));router['get']('/openchannel/queues/:id',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x4d')]);router[_0x2cc8('0x3f')](_0x2cc8('0x4e'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x41')](_0x2cc8('0x4f')));router[_0x2cc8('0x3f')](_0x2cc8('0x50'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x41')](_0x2cc8('0x51')));router['get'](_0x2cc8('0x52'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x53')]);router[_0x2cc8('0x9')](_0x2cc8('0x54'),auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x55')]);router['post']('/agents/:id/notify',auth[_0x2cc8('0x7')](),controller[_0x2cc8('0x56')]);module[_0x2cc8('0x57')]=router; \ No newline at end of file +var _0xa7d2=['sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xa7d2,0xa9));var _0x2a7d=function(_0x17ace6,_0x152f16){_0x17ace6=_0x17ace6-0x0;var _0x3e87fa=_0xa7d2[_0x17ace6];return _0x3e87fa;};'use strict';var multer=require(_0x2a7d('0x0'));var util=require(_0x2a7d('0x1'));var path=require(_0x2a7d('0x2'));var express=require(_0x2a7d('0x3'));var router=express[_0x2a7d('0x4')]();var auth=require(_0x2a7d('0x5'));var controller=require(_0x2a7d('0x6'));router[_0x2a7d('0x7')](_0x2a7d('0x8'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x2a7d('0x7')](_0x2a7d('0x9'),auth[_0x2a7d('0xa')](),controller['voiceChannelMixMonitor']);router[_0x2a7d('0x7')](_0x2a7d('0xb'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0xc')]);router[_0x2a7d('0x7')](_0x2a7d('0xd'),auth['isAuthenticated'](),controller[_0x2a7d('0xe')]);router[_0x2a7d('0x7')]('/chat/queues',auth['isAuthenticated'](),controller[_0x2a7d('0xf')]);router[_0x2a7d('0x7')](_0x2a7d('0x10'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x11')]);router['get']('/mail/accounts',auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x12')]);router[_0x2a7d('0x7')](_0x2a7d('0x13'),auth[_0x2a7d('0xa')](),controller['openchannelQueues']);router[_0x2a7d('0x7')](_0x2a7d('0x14'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x15')]);router[_0x2a7d('0x7')](_0x2a7d('0x16'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x17')]);router['get'](_0x2a7d('0x18'),auth['isAuthenticated'](),controller[_0x2a7d('0x19')]);router[_0x2a7d('0x7')](_0x2a7d('0x1a'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x1b')]);router['get'](_0x2a7d('0x1c'),auth['isAuthenticated'](),controller[_0x2a7d('0x1d')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x2a7d('0xa')](),controller['voiceQueuesChannel']);router[_0x2a7d('0x7')](_0x2a7d('0x1e'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x1f')]);router[_0x2a7d('0x7')](_0x2a7d('0x20'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x21')]);router['get'](_0x2a7d('0x22'),auth['isAuthenticated'](),controller[_0x2a7d('0x23')]);router[_0x2a7d('0x24')](_0x2a7d('0x22'),auth[_0x2a7d('0xa')](),controller['updateVoiceQueue']);router[_0x2a7d('0x7')](_0x2a7d('0x25'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x26')]);router[_0x2a7d('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x2a7d('0x27')]);router['get'](_0x2a7d('0x28'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x29')]);router[_0x2a7d('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x2a7d('0x2a')]);router['get'](_0x2a7d('0x2b'),auth['isAuthenticated'](),controller[_0x2a7d('0x2c')]);router[_0x2a7d('0x7')](_0x2a7d('0x2d'),auth['isAuthenticated'](),controller[_0x2a7d('0x2e')]);router[_0x2a7d('0x7')](_0x2a7d('0x2f'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x30')]);router[_0x2a7d('0x7')](_0x2a7d('0x31'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x32')]);router[_0x2a7d('0x7')](_0x2a7d('0x33'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x34')]);router[_0x2a7d('0x7')](_0x2a7d('0x35'),auth['isAuthenticated'](),controller[_0x2a7d('0x36')]);router['get'](_0x2a7d('0x37'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2a7d('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2a7d('0x7')](_0x2a7d('0x38'),auth[_0x2a7d('0xa')](),controller['smsQueuesWaitingInteractions']);router['get'](_0x2a7d('0x39'),auth[_0x2a7d('0xa')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth[_0x2a7d('0xa')](),controller['faxQueuesWaitingInteractions']);router[_0x2a7d('0x3a')](_0x2a7d('0x3b'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x3c')]('mail'));router['get'](_0x2a7d('0x3d'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x3e')]);router[_0x2a7d('0x3a')](_0x2a7d('0x3f'),auth['isAuthenticated'](),controller[_0x2a7d('0x3c')](_0x2a7d('0x40')));router[_0x2a7d('0x7')]('/chat/queues/:id',auth[_0x2a7d('0xa')](),controller['showChatQueues']);router[_0x2a7d('0x3a')](_0x2a7d('0x41'),auth[_0x2a7d('0xa')](),controller['queueNotify'](_0x2a7d('0x42')));router[_0x2a7d('0x7')](_0x2a7d('0x43'),auth['isAuthenticated'](),controller[_0x2a7d('0x44')]);router[_0x2a7d('0x3a')](_0x2a7d('0x45'),auth['isAuthenticated'](),controller[_0x2a7d('0x3c')](_0x2a7d('0x46')));router[_0x2a7d('0x7')](_0x2a7d('0x47'),auth['isAuthenticated'](),controller[_0x2a7d('0x48')]);router[_0x2a7d('0x3a')](_0x2a7d('0x49'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x3c')](_0x2a7d('0x4a')));router['post'](_0x2a7d('0x4b'),auth['isAuthenticated'](),controller[_0x2a7d('0x3c')]('whatsapp'));router[_0x2a7d('0x7')](_0x2a7d('0x4c'),auth[_0x2a7d('0xa')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x4d')]);router['post'](_0x2a7d('0x4e'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x4f')]);module[_0x2a7d('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9dc04cd..0a303aa 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x239d43,_0x144586){var _0x263a18=function(_0x1a89cb){while(--_0x1a89cb){_0x239d43['push'](_0x239d43['shift']());}};_0x263a18(++_0x144586);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x561ef0,_0x3488b0){var _0x3b60dc=function(_0x2dfcca){while(--_0x2dfcca){_0x561ef0['push'](_0x561ef0['shift']());}};_0x3b60dc(++_0x3488b0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 2af0a36..8750833 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 _0x4d17=['exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/run','run','post','create','put','/:id','delete','destroy'];(function(_0x351897,_0x46dda5){var _0x5639b4=function(_0x197f73){while(--_0x197f73){_0x351897['push'](_0x351897['shift']());}};_0x5639b4(++_0x46dda5);}(_0x4d17,0xde));var _0x74d1=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0x4d17[_0x5da27f];return _0x54a3fb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74d1('0x0'));var router=express[_0x74d1('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x74d1('0x2'));var interaction=require(_0x74d1('0x3'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x74d1('0x4')]('/',auth[_0x74d1('0x5')](),controller[_0x74d1('0x6')]);router[_0x74d1('0x4')]('/:id',auth[_0x74d1('0x5')](),controller[_0x74d1('0x7')]);router[_0x74d1('0x4')](_0x74d1('0x8'),auth[_0x74d1('0x5')](),controller[_0x74d1('0x9')]);router[_0x74d1('0xa')]('/',auth[_0x74d1('0x5')](),controller[_0x74d1('0xb')]);router[_0x74d1('0xc')](_0x74d1('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x74d1('0xe')](_0x74d1('0xd'),auth[_0x74d1('0x5')](),controller[_0x74d1('0xf')]);module[_0x74d1('0x10')]=router; \ No newline at end of file +var _0x9728=['post','create','put','update','delete','util','connect-timeout','express','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x30572e,_0x447a6a){var _0x4a7742=function(_0x1275b3){while(--_0x1275b3){_0x30572e['push'](_0x30572e['shift']());}};_0x4a7742(++_0x447a6a);}(_0x9728,0x104));var _0x8972=function(_0x476c7a,_0x20c6e8){_0x476c7a=_0x476c7a-0x0;var _0x181dc9=_0x9728[_0x476c7a];return _0x181dc9;};'use strict';var multer=require('multer');var util=require(_0x8972('0x0'));var path=require('path');var timeout=require(_0x8972('0x1'));var express=require(_0x8972('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8972('0x3'));var config=require('../../config/environment');var controller=require(_0x8972('0x4'));router[_0x8972('0x5')]('/',auth[_0x8972('0x6')](),controller[_0x8972('0x7')]);router[_0x8972('0x5')](_0x8972('0x8'),auth[_0x8972('0x6')](),controller[_0x8972('0x9')]);router[_0x8972('0x5')](_0x8972('0xa'),auth[_0x8972('0x6')](),controller[_0x8972('0xb')]);router[_0x8972('0xc')]('/',auth['isAuthenticated'](),controller[_0x8972('0xd')]);router[_0x8972('0xe')](_0x8972('0x8'),auth[_0x8972('0x6')](),controller[_0x8972('0xf')]);router[_0x8972('0x10')](_0x8972('0x8'),auth[_0x8972('0x6')](),controller['destroy']);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 1903fb5..7abbdd4 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 _0x33f4=['default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','custom'];(function(_0x41f889,_0x3709b1){var _0x2c4397=function(_0x2386f0){while(--_0x2386f0){_0x41f889['push'](_0x41f889['shift']());}};_0x2c4397(++_0x3709b1);}(_0x33f4,0x19a));var _0x433f=function(_0x7028ad,_0x1dfd87){_0x7028ad=_0x7028ad-0x0;var _0x53a80d=_0x33f4[_0x7028ad];return _0x53a80d;};'use strict';var Sequelize=require('sequelize');module[_0x433f('0x0')]={'name':{'type':Sequelize[_0x433f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x433f('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x433f('0x1')],'allowNull':![],'defaultValue':_0x433f('0x3')},'startAt':{'type':Sequelize[_0x433f('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x433f('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x433f('0x6')](_0x433f('0x7'),_0x433f('0x8'),_0x433f('0x9'),'weeks',_0x433f('0xa'),_0x433f('0xb'),_0x433f('0xc')),'allowNull':![],'defaultValue':_0x433f('0xa')},'output':{'type':Sequelize[_0x433f('0x6')](_0x433f('0xd'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x433f('0xd')},'type':{'type':Sequelize['ENUM'](_0x433f('0xe'),_0x433f('0xf')),'allowNull':![],'defaultValue':_0x433f('0xe')},'sendMail':{'type':Sequelize[_0x433f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x433f('0x1')]},'cc':{'type':Sequelize[_0x433f('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x433f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x17a6=['weeks','days','minutes','csv','xlsx','default','custom','TEXT','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0xde42f3,_0x3bd1ed){var _0x1c0215=function(_0x43c02a){while(--_0x43c02a){_0xde42f3['push'](_0xde42f3['shift']());}};_0x1c0215(++_0x3bd1ed);}(_0x17a6,0x98));var _0x617a=function(_0xd60ff2,_0x1f31cd){_0xd60ff2=_0xd60ff2-0x0;var _0x5befdc=_0x17a6[_0xd60ff2];return _0x5befdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x617a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x617a('0x0')]},'active':{'type':Sequelize[_0x617a('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x617a('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x617a('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x617a('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x617a('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x617a('0x4')](_0x617a('0x5'),_0x617a('0x6'),_0x617a('0x7'),_0x617a('0x8'),_0x617a('0x9'),'hours',_0x617a('0xa')),'allowNull':![],'defaultValue':_0x617a('0x9')},'output':{'type':Sequelize[_0x617a('0x4')](_0x617a('0xb'),'pdf',_0x617a('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x617a('0x4')]('custom',_0x617a('0xd')),'allowNull':![],'defaultValue':_0x617a('0xe')},'sendMail':{'type':Sequelize[_0x617a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x617a('0x0')]},'cc':{'type':Sequelize[_0x617a('0xf')]},'bcc':{'type':Sequelize[_0x617a('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 05ca29d..495084a 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 _0xa24a=['zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Scheduler','UserProfileResource','destroy','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','where','filter','merge','options','Schedule','includeAll','catch','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','find','eml-format'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0xa24a,0x1df));var _0xaa24=function(_0x2bf12a,_0x1df75f){_0x2bf12a=_0x2bf12a-0x0;var _0x54296e=_0xa24a[_0x2bf12a];return _0x54296e;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa24('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa24('0x2'));var moment=require(_0xaa24('0x3'));var BPromise=require(_0xaa24('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaa24('0x5'));var sox=require(_0xaa24('0x6'));var csv=require(_0xaa24('0x7'));var ejs=require(_0xaa24('0x8'));var fs=require('fs');var fs_extra=require(_0xaa24('0x9'));var _=require(_0xaa24('0xa'));var squel=require(_0xaa24('0xb'));var crypto=require(_0xaa24('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaa24('0x7'));var querystring=require(_0xaa24('0xd'));var Papa=require(_0xaa24('0xe'));var Redis=require(_0xaa24('0xf'));var authService=require(_0xaa24('0x10'));var qs=require(_0xaa24('0x11'));var as=require(_0xaa24('0x12'));var hardwareService=require(_0xaa24('0x13'));var logger=require('../../config/logger')(_0xaa24('0x14'));var utils=require(_0xaa24('0x15'));var config=require(_0xaa24('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa24('0x17'))['db'];function respondWithStatusCode(_0x314833,_0x50206d){_0x50206d=_0x50206d||0xcc;return function(_0xe01d19){if(_0xe01d19){return _0x314833['sendStatus'](_0x50206d);}return _0x314833['status'](_0x50206d)['end']();};}function respondWithResult(_0x16f9f1,_0x52f30e){_0x52f30e=_0x52f30e||0xc8;return function(_0x457340){if(_0x457340){return _0x16f9f1[_0xaa24('0x18')](_0x52f30e)[_0xaa24('0x19')](_0x457340);}};}function respondWithFilteredResult(_0x382b2f,_0xe471a4){return function(_0xf844f9){if(_0xf844f9){var _0x1710a0=typeof _0xe471a4[_0xaa24('0x1a')]===_0xaa24('0x1b')&&typeof _0xe471a4[_0xaa24('0x1c')]===_0xaa24('0x1b');var _0x38ad92=_0xf844f9['count'];var _0x50575a=_0x1710a0?0x0:_0xe471a4[_0xaa24('0x1a')];var _0x3bbdb5=_0x1710a0?_0xf844f9[_0xaa24('0x1d')]:_0xe471a4['offset']+_0xe471a4['limit'];var _0x107c1f;if(_0x3bbdb5>=_0x38ad92){_0x3bbdb5=_0x38ad92;_0x107c1f=0xc8;}else{_0x107c1f=0xce;}_0x382b2f[_0xaa24('0x18')](_0x107c1f);return _0x382b2f[_0xaa24('0x1e')](_0xaa24('0x1f'),_0x50575a+'-'+_0x3bbdb5+'/'+_0x38ad92)['json'](_0xf844f9);}return null;};}function patchUpdates(_0x28ec6c){return function(_0x1dbd76){try{jsonpatch[_0xaa24('0x20')](_0x1dbd76,_0x28ec6c,!![]);}catch(_0x32ccd9){return BPromise[_0xaa24('0x21')](_0x32ccd9);}return _0x1dbd76['save']();};}function saveUpdates(_0x12d4ee,_0x4b7693){return function(_0xeb612e){if(_0xeb612e){return _0xeb612e[_0xaa24('0x22')](_0x12d4ee)[_0xaa24('0x23')](function(_0x47b476){return _0x47b476;});}return null;};}function removeEntity(_0x2611e9,_0x8c2a19){return function(_0x246b09){if(_0x246b09){return _0x246b09['destroy']()[_0xaa24('0x23')](function(){var _0x3f0ca4=_0x246b09[_0xaa24('0x24')]({'plain':!![]});var _0x38a6de=_0xaa24('0x25');return db[_0xaa24('0x26')][_0xaa24('0x27')]({'where':{'type':_0x38a6de,'resourceId':_0x3f0ca4['id']}})[_0xaa24('0x23')](function(){return _0x246b09;});})[_0xaa24('0x23')](function(){_0x2611e9[_0xaa24('0x18')](0xcc)[_0xaa24('0x28')]();});}};}function handleEntityNotFound(_0x29d26b,_0x5cd7e6){return function(_0x7fc014){if(!_0x7fc014){_0x29d26b[_0xaa24('0x29')](0x194);}return _0x7fc014;};}function handleError(_0x1e77a9,_0x2ba534){_0x2ba534=_0x2ba534||0x1f4;return function(_0x2e4af2){logger[_0xaa24('0x2a')](_0x2e4af2['stack']);if(_0x2e4af2[_0xaa24('0x2b')]){delete _0x2e4af2[_0xaa24('0x2b')];}_0x1e77a9[_0xaa24('0x18')](_0x2ba534)[_0xaa24('0x2c')](_0x2e4af2);};}exports[_0xaa24('0x2d')]=function(_0x51c88a,_0x34fe46){var _0x1815af={},_0x230033={},_0x5e19c4={'count':0x0,'rows':[]};var _0x92272c=_['map'](db['Schedule'][_0xaa24('0x2e')],function(_0x3c6140){return{'name':_0x3c6140[_0xaa24('0x2f')],'type':_0x3c6140[_0xaa24('0x30')][_0xaa24('0x31')]};});_0x230033[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x92272c,'name');_0x230033['query']=_[_0xaa24('0x34')](_0x51c88a[_0xaa24('0x35')]);_0x230033[_0xaa24('0x36')]=_[_0xaa24('0x37')](_0x230033[_0xaa24('0x32')],_0x230033[_0xaa24('0x35')]);_0x1815af[_0xaa24('0x38')]=_[_0xaa24('0x37')](_0x230033[_0xaa24('0x32')],qs[_0xaa24('0x39')](_0x51c88a[_0xaa24('0x35')][_0xaa24('0x39')]));_0x1815af['attributes']=_0x1815af[_0xaa24('0x38')]['length']?_0x1815af[_0xaa24('0x38')]:_0x230033[_0xaa24('0x32')];if(!_0x51c88a[_0xaa24('0x35')]['hasOwnProperty'](_0xaa24('0x3a'))){_0x1815af[_0xaa24('0x1c')]=qs[_0xaa24('0x1c')](_0x51c88a[_0xaa24('0x35')][_0xaa24('0x1c')]);_0x1815af[_0xaa24('0x1a')]=qs[_0xaa24('0x1a')](_0x51c88a[_0xaa24('0x35')][_0xaa24('0x1a')]);}_0x1815af['order']=qs['sort'](_0x51c88a['query']['sort']);_0x1815af[_0xaa24('0x3b')]=qs[_0xaa24('0x36')](_['pick'](_0x51c88a[_0xaa24('0x35')],_0x230033[_0xaa24('0x36')]),_0x92272c);if(_0x51c88a[_0xaa24('0x35')][_0xaa24('0x3c')]){_0x1815af[_0xaa24('0x3b')]=_[_0xaa24('0x3d')](_0x1815af[_0xaa24('0x3b')],{'$or':_[_0xaa24('0x33')](_0x92272c,function(_0xdecd57){if(_0xdecd57[_0xaa24('0x30')]!=='VIRTUAL'){var _0x4af8ba={};_0x4af8ba[_0xdecd57[_0xaa24('0x2b')]]={'$like':'%'+_0x51c88a[_0xaa24('0x35')][_0xaa24('0x3c')]+'%'};return _0x4af8ba;}})});}_0x1815af=_[_0xaa24('0x3d')]({},_0x1815af,_0x51c88a[_0xaa24('0x3e')]);var _0x267e91={'where':_0x1815af[_0xaa24('0x3b')]};return db[_0xaa24('0x3f')]['count'](_0x267e91)[_0xaa24('0x23')](function(_0x296aea){_0x5e19c4[_0xaa24('0x1d')]=_0x296aea;if(_0x51c88a[_0xaa24('0x35')][_0xaa24('0x40')]){_0x1815af['include']=[{'all':!![]}];}return db[_0xaa24('0x3f')]['findAll'](_0x1815af);})['then'](function(_0xb39a4d){_0x5e19c4['rows']=_0xb39a4d;return _0x5e19c4;})[_0xaa24('0x23')](respondWithFilteredResult(_0x34fe46,_0x1815af))[_0xaa24('0x41')](handleError(_0x34fe46,null));};exports[_0xaa24('0x42')]=function(_0x5efb45,_0x182881){var _0x3c5ad1={'raw':![],'where':{'id':_0x5efb45[_0xaa24('0x43')]['id']}},_0x401219={};_0x401219[_0xaa24('0x32')]=_[_0xaa24('0x34')](db[_0xaa24('0x3f')][_0xaa24('0x2e')]);_0x401219[_0xaa24('0x35')]=_[_0xaa24('0x34')](_0x5efb45[_0xaa24('0x35')]);_0x401219[_0xaa24('0x36')]=_[_0xaa24('0x37')](_0x401219[_0xaa24('0x32')],_0x401219[_0xaa24('0x35')]);_0x3c5ad1[_0xaa24('0x38')]=_[_0xaa24('0x37')](_0x401219[_0xaa24('0x32')],qs[_0xaa24('0x39')](_0x5efb45[_0xaa24('0x35')][_0xaa24('0x39')]));_0x3c5ad1[_0xaa24('0x38')]=_0x3c5ad1['attributes'][_0xaa24('0x44')]?_0x3c5ad1[_0xaa24('0x38')]:_0x401219[_0xaa24('0x32')];if(_0x5efb45['query'][_0xaa24('0x40')]){_0x3c5ad1[_0xaa24('0x45')]=[{'all':!![]}];}_0x3c5ad1=_[_0xaa24('0x3d')]({},_0x3c5ad1,_0x5efb45['options']);return db['Schedule']['find'](_0x3c5ad1)['then'](handleEntityNotFound(_0x182881,null))['then'](respondWithResult(_0x182881,null))[_0xaa24('0x41')](handleError(_0x182881,null));};exports['create']=function(_0x525182,_0x556183){return db['Schedule'][_0xaa24('0x46')](_0x525182[_0xaa24('0x47')],{})[_0xaa24('0x23')](function(_0x580b8e){var _0x4b857d=_0x525182[_0xaa24('0x48')][_0xaa24('0x24')]({'plain':!![]});if(!_0x4b857d)throw new Error(_0xaa24('0x49'));if(_0x4b857d['role']===_0xaa24('0x48')){var _0x2b2aad=_0x580b8e['get']({'plain':!![]});var _0x21359e=_0xaa24('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x21359e,'userProfileId':_0x4b857d[_0xaa24('0x4a')]},'raw':!![]})[_0xaa24('0x23')](function(_0xeef4c8){if(_0xeef4c8&&_0xeef4c8[_0xaa24('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b2aad[_0xaa24('0x2b')],'resourceId':_0x2b2aad['id'],'type':_0xeef4c8[_0xaa24('0x2b')],'sectionId':_0xeef4c8['id']},{})[_0xaa24('0x23')](function(){return _0x580b8e;});}else{return _0x580b8e;}})[_0xaa24('0x41')](function(_0x47f777){logger[_0xaa24('0x2a')](_0xaa24('0x4c'),_0x47f777);throw _0x47f777;});}return _0x580b8e;})['then'](respondWithResult(_0x556183,0xc9))[_0xaa24('0x41')](handleError(_0x556183,null));};exports[_0xaa24('0x22')]=function(_0x3dc7af,_0x6557f0){if(_0x3dc7af[_0xaa24('0x47')]['id']){delete _0x3dc7af['body']['id'];}return db[_0xaa24('0x3f')]['find']({'where':{'id':_0x3dc7af[_0xaa24('0x43')]['id']}})[_0xaa24('0x23')](handleEntityNotFound(_0x6557f0,null))['then'](saveUpdates(_0x3dc7af[_0xaa24('0x47')],null))[_0xaa24('0x23')](respondWithResult(_0x6557f0,null))[_0xaa24('0x41')](handleError(_0x6557f0,null));};exports[_0xaa24('0x27')]=function(_0x8bbb6d,_0x2f92fa){return db[_0xaa24('0x3f')]['find']({'where':{'id':_0x8bbb6d[_0xaa24('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f92fa,null))[_0xaa24('0x23')](removeEntity(_0x2f92fa,null))[_0xaa24('0x41')](handleError(_0x2f92fa,null));};exports[_0xaa24('0x4d')]=function(_0x11d683,_0x17e1ac,_0x381df9){var _0x57bf7b=require(_0xaa24('0x4e'));return db[_0xaa24('0x3f')][_0xaa24('0x4f')]({'where':{'id':_0x11d683[_0xaa24('0x43')]['id']},'raw':!![]})[_0xaa24('0x23')](handleEntityNotFound(_0x17e1ac,null))[_0xaa24('0x23')](function(){_0x57bf7b['run'](_0x11d683[_0xaa24('0x43')]['id']);})[_0xaa24('0x23')](respondWithStatusCode(_0x17e1ac,null))[_0xaa24('0x41')](handleError(_0x17e1ac,null));}; \ No newline at end of file +var _0x5c5e=['UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4a2268,_0x2c6a30){var _0x57f41a=function(_0x19274e){while(--_0x19274e){_0x4a2268['push'](_0x4a2268['shift']());}};_0x57f41a(++_0x2c6a30);}(_0x5c5e,0xb4));var _0xe5c5=function(_0x47f1d4,_0x493e60){_0x47f1d4=_0x47f1d4-0x0;var _0x9cfd29=_0x5c5e[_0x47f1d4];return _0x9cfd29;};'use strict';var emlformat=require(_0xe5c5('0x0'));var rimraf=require(_0xe5c5('0x1'));var zipdir=require(_0xe5c5('0x2'));var jsonpatch=require(_0xe5c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5c5('0x4'));var Mustache=require(_0xe5c5('0x5'));var util=require(_0xe5c5('0x6'));var path=require(_0xe5c5('0x7'));var sox=require(_0xe5c5('0x8'));var csv=require(_0xe5c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5c5('0xa'));var _=require('lodash');var squel=require(_0xe5c5('0xb'));var crypto=require(_0xe5c5('0xc'));var jsforce=require(_0xe5c5('0xd'));var deskjs=require(_0xe5c5('0xe'));var toCsv=require(_0xe5c5('0x9'));var querystring=require(_0xe5c5('0xf'));var Papa=require(_0xe5c5('0x10'));var Redis=require(_0xe5c5('0x11'));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(_0xe5c5('0x12'))(_0xe5c5('0x13'));var utils=require(_0xe5c5('0x14'));var config=require(_0xe5c5('0x15'));var licenseUtil=require(_0xe5c5('0x16'));var db=require(_0xe5c5('0x17'))['db'];function respondWithStatusCode(_0x2e04d9,_0x1d61aa){_0x1d61aa=_0x1d61aa||0xcc;return function(_0x287383){if(_0x287383){return _0x2e04d9['sendStatus'](_0x1d61aa);}return _0x2e04d9[_0xe5c5('0x18')](_0x1d61aa)[_0xe5c5('0x19')]();};}function respondWithResult(_0x23234a,_0x61f837){_0x61f837=_0x61f837||0xc8;return function(_0xe111a8){if(_0xe111a8){return _0x23234a[_0xe5c5('0x18')](_0x61f837)[_0xe5c5('0x1a')](_0xe111a8);}};}function respondWithFilteredResult(_0x3316a1,_0x451cc3){return function(_0x2e5037){if(_0x2e5037){var _0x2d1e2e=typeof _0x451cc3['offset']===_0xe5c5('0x1b')&&typeof _0x451cc3[_0xe5c5('0x1c')]===_0xe5c5('0x1b');var _0x3f0de8=_0x2e5037[_0xe5c5('0x1d')];var _0x11ba8c=_0x2d1e2e?0x0:_0x451cc3[_0xe5c5('0x1e')];var _0x4b314a=_0x2d1e2e?_0x2e5037[_0xe5c5('0x1d')]:_0x451cc3[_0xe5c5('0x1e')]+_0x451cc3[_0xe5c5('0x1c')];var _0x5d988c;if(_0x4b314a>=_0x3f0de8){_0x4b314a=_0x3f0de8;_0x5d988c=0xc8;}else{_0x5d988c=0xce;}_0x3316a1[_0xe5c5('0x18')](_0x5d988c);return _0x3316a1['set'](_0xe5c5('0x1f'),_0x11ba8c+'-'+_0x4b314a+'/'+_0x3f0de8)[_0xe5c5('0x1a')](_0x2e5037);}return null;};}function patchUpdates(_0x593b89){return function(_0x5de981){try{jsonpatch['apply'](_0x5de981,_0x593b89,!![]);}catch(_0x509316){return BPromise[_0xe5c5('0x20')](_0x509316);}return _0x5de981['save']();};}function saveUpdates(_0x31a177,_0x432212){return function(_0x1f24cb){if(_0x1f24cb){return _0x1f24cb[_0xe5c5('0x21')](_0x31a177)[_0xe5c5('0x22')](function(_0x33c20c){return _0x33c20c;});}return null;};}function removeEntity(_0x4b4333,_0x34be04){return function(_0x283062){if(_0x283062){return _0x283062[_0xe5c5('0x23')]()[_0xe5c5('0x22')](function(){var _0x46d680=_0x283062[_0xe5c5('0x24')]({'plain':!![]});var _0x53bb6f=_0xe5c5('0x25');return db[_0xe5c5('0x26')]['destroy']({'where':{'type':_0x53bb6f,'resourceId':_0x46d680['id']}})['then'](function(){return _0x283062;});})[_0xe5c5('0x22')](function(){_0x4b4333[_0xe5c5('0x18')](0xcc)[_0xe5c5('0x19')]();});}};}function handleEntityNotFound(_0x234ec7,_0x22bef){return function(_0x3567f4){if(!_0x3567f4){_0x234ec7[_0xe5c5('0x27')](0x194);}return _0x3567f4;};}function handleError(_0x5f3a5a,_0x44feab){_0x44feab=_0x44feab||0x1f4;return function(_0x23f84b){logger['error'](_0x23f84b['stack']);if(_0x23f84b['name']){delete _0x23f84b[_0xe5c5('0x28')];}_0x5f3a5a[_0xe5c5('0x18')](_0x44feab)[_0xe5c5('0x29')](_0x23f84b);};}exports[_0xe5c5('0x2a')]=function(_0x2fdeb9,_0x11cade){var _0x4e0095={},_0x4b754c={},_0x416b69={'count':0x0,'rows':[]};var _0x2cbde5=_[_0xe5c5('0x2b')](db[_0xe5c5('0x2c')][_0xe5c5('0x2d')],function(_0x4b0820){return{'name':_0x4b0820[_0xe5c5('0x2e')],'type':_0x4b0820[_0xe5c5('0x2f')][_0xe5c5('0x30')]};});_0x4b754c[_0xe5c5('0x31')]=_['map'](_0x2cbde5,_0xe5c5('0x28'));_0x4b754c[_0xe5c5('0x32')]=_[_0xe5c5('0x33')](_0x2fdeb9[_0xe5c5('0x32')]);_0x4b754c[_0xe5c5('0x34')]=_[_0xe5c5('0x35')](_0x4b754c['model'],_0x4b754c[_0xe5c5('0x32')]);_0x4e0095['attributes']=_[_0xe5c5('0x35')](_0x4b754c[_0xe5c5('0x31')],qs[_0xe5c5('0x36')](_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x36')]));_0x4e0095[_0xe5c5('0x37')]=_0x4e0095[_0xe5c5('0x37')][_0xe5c5('0x38')]?_0x4e0095['attributes']:_0x4b754c['model'];if(!_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x39')](_0xe5c5('0x3a'))){_0x4e0095[_0xe5c5('0x1c')]=qs[_0xe5c5('0x1c')](_0x2fdeb9[_0xe5c5('0x32')]['limit']);_0x4e0095['offset']=qs['offset'](_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x1e')]);}_0x4e0095[_0xe5c5('0x3b')]=qs[_0xe5c5('0x3c')](_0x2fdeb9['query'][_0xe5c5('0x3c')]);_0x4e0095[_0xe5c5('0x3d')]=qs[_0xe5c5('0x34')](_[_0xe5c5('0x3e')](_0x2fdeb9[_0xe5c5('0x32')],_0x4b754c[_0xe5c5('0x34')]),_0x2cbde5);if(_0x2fdeb9['query'][_0xe5c5('0x3f')]){_0x4e0095[_0xe5c5('0x3d')]=_[_0xe5c5('0x40')](_0x4e0095[_0xe5c5('0x3d')],{'$or':_[_0xe5c5('0x2b')](_0x2cbde5,function(_0x5056af){if(_0x5056af[_0xe5c5('0x2f')]!==_0xe5c5('0x41')){var _0x892e99={};_0x892e99[_0x5056af[_0xe5c5('0x28')]]={'$like':'%'+_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x3f')]+'%'};return _0x892e99;}})});}_0x4e0095=_['merge']({},_0x4e0095,_0x2fdeb9[_0xe5c5('0x42')]);var _0xebc5e3={'where':_0x4e0095[_0xe5c5('0x3d')]};return db[_0xe5c5('0x2c')]['count'](_0xebc5e3)[_0xe5c5('0x22')](function(_0x3c719a){_0x416b69['count']=_0x3c719a;if(_0x2fdeb9[_0xe5c5('0x32')]['includeAll']){_0x4e0095[_0xe5c5('0x43')]=[{'all':!![]}];}return db[_0xe5c5('0x2c')][_0xe5c5('0x44')](_0x4e0095);})['then'](function(_0x4f3aff){_0x416b69[_0xe5c5('0x45')]=_0x4f3aff;return _0x416b69;})[_0xe5c5('0x22')](respondWithFilteredResult(_0x11cade,_0x4e0095))[_0xe5c5('0x46')](handleError(_0x11cade,null));};exports[_0xe5c5('0x47')]=function(_0x10bd1c,_0x1050b0){var _0x57b818={'raw':![],'where':{'id':_0x10bd1c[_0xe5c5('0x48')]['id']}},_0x5de79d={};_0x5de79d[_0xe5c5('0x31')]=_[_0xe5c5('0x33')](db[_0xe5c5('0x2c')][_0xe5c5('0x2d')]);_0x5de79d[_0xe5c5('0x32')]=_[_0xe5c5('0x33')](_0x10bd1c[_0xe5c5('0x32')]);_0x5de79d['filters']=_[_0xe5c5('0x35')](_0x5de79d[_0xe5c5('0x31')],_0x5de79d[_0xe5c5('0x32')]);_0x57b818[_0xe5c5('0x37')]=_[_0xe5c5('0x35')](_0x5de79d['model'],qs[_0xe5c5('0x36')](_0x10bd1c[_0xe5c5('0x32')]['fields']));_0x57b818[_0xe5c5('0x37')]=_0x57b818[_0xe5c5('0x37')]['length']?_0x57b818['attributes']:_0x5de79d[_0xe5c5('0x31')];if(_0x10bd1c['query']['includeAll']){_0x57b818[_0xe5c5('0x43')]=[{'all':!![]}];}_0x57b818=_[_0xe5c5('0x40')]({},_0x57b818,_0x10bd1c['options']);return db[_0xe5c5('0x2c')]['find'](_0x57b818)[_0xe5c5('0x22')](handleEntityNotFound(_0x1050b0,null))['then'](respondWithResult(_0x1050b0,null))[_0xe5c5('0x46')](handleError(_0x1050b0,null));};exports[_0xe5c5('0x49')]=function(_0x3e7857,_0x14f309){return db[_0xe5c5('0x2c')][_0xe5c5('0x49')](_0x3e7857[_0xe5c5('0x4a')],{})[_0xe5c5('0x22')](function(_0x1565b4){var _0x5d91e2=_0x3e7857[_0xe5c5('0x4b')][_0xe5c5('0x24')]({'plain':!![]});if(!_0x5d91e2)throw new Error(_0xe5c5('0x4c'));if(_0x5d91e2[_0xe5c5('0x4d')]===_0xe5c5('0x4b')){var _0x27c7c3=_0x1565b4['get']({'plain':!![]});var _0x443d99='Scheduler';return db[_0xe5c5('0x4e')][_0xe5c5('0x4f')]({'where':{'name':_0x443d99,'userProfileId':_0x5d91e2[_0xe5c5('0x50')]},'raw':!![]})[_0xe5c5('0x22')](function(_0x3802c6){if(_0x3802c6&&_0x3802c6[_0xe5c5('0x51')]===0x0){return db[_0xe5c5('0x26')][_0xe5c5('0x49')]({'name':_0x27c7c3['name'],'resourceId':_0x27c7c3['id'],'type':_0x3802c6[_0xe5c5('0x28')],'sectionId':_0x3802c6['id']},{})[_0xe5c5('0x22')](function(){return _0x1565b4;});}else{return _0x1565b4;}})[_0xe5c5('0x46')](function(_0x297a86){logger[_0xe5c5('0x52')](_0xe5c5('0x53'),_0x297a86);throw _0x297a86;});}return _0x1565b4;})[_0xe5c5('0x22')](respondWithResult(_0x14f309,0xc9))[_0xe5c5('0x46')](handleError(_0x14f309,null));};exports[_0xe5c5('0x21')]=function(_0x2ff7cb,_0x1641cd){if(_0x2ff7cb['body']['id']){delete _0x2ff7cb[_0xe5c5('0x4a')]['id'];}return db[_0xe5c5('0x2c')][_0xe5c5('0x4f')]({'where':{'id':_0x2ff7cb['params']['id']}})[_0xe5c5('0x22')](handleEntityNotFound(_0x1641cd,null))['then'](saveUpdates(_0x2ff7cb[_0xe5c5('0x4a')],null))[_0xe5c5('0x22')](respondWithResult(_0x1641cd,null))[_0xe5c5('0x46')](handleError(_0x1641cd,null));};exports[_0xe5c5('0x23')]=function(_0x544015,_0x36a560){return db['Schedule'][_0xe5c5('0x4f')]({'where':{'id':_0x544015['params']['id']}})[_0xe5c5('0x22')](handleEntityNotFound(_0x36a560,null))[_0xe5c5('0x22')](removeEntity(_0x36a560,null))[_0xe5c5('0x46')](handleError(_0x36a560,null));};exports[_0xe5c5('0x54')]=function(_0x18cf53,_0x4fa760,_0x251b4e){var _0x31654d=require(_0xe5c5('0x55'));return db[_0xe5c5('0x2c')][_0xe5c5('0x4f')]({'where':{'id':_0x18cf53[_0xe5c5('0x48')]['id']},'raw':!![]})[_0xe5c5('0x22')](handleEntityNotFound(_0x4fa760,null))[_0xe5c5('0x22')](function(){_0x31654d[_0xe5c5('0x54')](_0x18cf53['params']['id']);})[_0xe5c5('0x22')](respondWithStatusCode(_0x4fa760,null))[_0xe5c5('0x46')](handleError(_0x4fa760,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6473f48..74e7c89 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 _0x9515=['tools_schedules','lodash','util','../../config/logger','api','request-promise','path','./schedule.attributes','exports','define'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x9515,0x8d));var _0x5951=function(_0x4b507f,_0x1b6c83){_0x4b507f=_0x4b507f-0x0;var _0x47c889=_0x9515[_0x4b507f];return _0x47c889;};'use strict';var _=require(_0x5951('0x0'));var util=require(_0x5951('0x1'));var logger=require(_0x5951('0x2'))(_0x5951('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5951('0x4'));var fs=require('fs');var path=require(_0x5951('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5951('0x6'));module[_0x5951('0x7')]=function(_0x37e008,_0x4b6cb0){return _0x37e008[_0x5951('0x8')]('Schedule',attributes,{'tableName':_0x5951('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe765=['Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x15c4df,_0x1e3d1f){var _0xe7cb8=function(_0x57203f){while(--_0x57203f){_0x15c4df['push'](_0x15c4df['shift']());}};_0xe7cb8(++_0x1e3d1f);}(_0xe765,0x17b));var _0x5e76=function(_0x3f44e8,_0x2157b2){_0x3f44e8=_0x3f44e8-0x0;var _0x388071=_0xe765[_0x3f44e8];return _0x388071;};'use strict';var _=require(_0x5e76('0x0'));var util=require(_0x5e76('0x1'));var logger=require(_0x5e76('0x2'))(_0x5e76('0x3'));var moment=require(_0x5e76('0x4'));var BPromise=require(_0x5e76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e76('0x6'));var rimraf=require(_0x5e76('0x7'));var config=require(_0x5e76('0x8'));var attributes=require('./schedule.attributes');module[_0x5e76('0x9')]=function(_0x5e6066,_0x11c0a6){return _0x5e6066[_0x5e76('0xa')](_0x5e76('0xb'),attributes,{'tableName':_0x5e76('0xc'),'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 0bbc989..69f4a53 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 _0xe421=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe421,0xaf));var _0x1e42=function(_0x41b81e,_0x3ad078){_0x41b81e=_0x41b81e-0x0;var _0x4bb004=_0xe421[_0x41b81e];return _0x4bb004;};'use strict';var _=require(_0x1e42('0x0'));var util=require(_0x1e42('0x1'));var moment=require('moment');var BPromise=require(_0x1e42('0x2'));var rs=require(_0x1e42('0x3'));var fs=require('fs');var Redis=require(_0x1e42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e42('0x5'));var logger=require(_0x1e42('0x6'))(_0x1e42('0x7'));var config=require(_0x1e42('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e71bd,_0x2576ca,_0x5260a5){return new BPromise(function(_0x5065d2,_0x4f566d){return client[_0x1e42('0xa')](_0x4e71bd,_0x5260a5)['then'](function(_0x181cec){logger[_0x1e42('0xb')](_0x1e42('0xc'),_0x2576ca,'request\x20sent');logger[_0x1e42('0xd')](_0x1e42('0xe'),_0x2576ca,_0x1e42('0xf'),JSON[_0x1e42('0x10')](_0x181cec));if(_0x181cec[_0x1e42('0x11')]){if(_0x181cec[_0x1e42('0x11')][_0x1e42('0x12')]===0x1f4){logger[_0x1e42('0x11')](_0x1e42('0xc'),_0x2576ca,_0x181cec['error'][_0x1e42('0x13')]);return _0x4f566d(_0x181cec[_0x1e42('0x11')]['message']);}logger['error'](_0x1e42('0xc'),_0x2576ca,_0x181cec[_0x1e42('0x11')]['message']);return _0x5065d2(_0x181cec[_0x1e42('0x11')][_0x1e42('0x13')]);}else{logger[_0x1e42('0xb')](_0x1e42('0xc'),_0x2576ca,_0x1e42('0xf'));_0x5065d2(_0x181cec[_0x1e42('0x14')][_0x1e42('0x13')]);}})[_0x1e42('0x15')](function(_0x4139d7){logger[_0x1e42('0x11')](_0x1e42('0xc'),_0x2576ca,_0x4139d7);_0x4f566d(_0x4139d7);});});} \ No newline at end of file +var _0x7fca=['../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x17485b,_0x26a84b){var _0x2532d3=function(_0x5a6629){while(--_0x5a6629){_0x17485b['push'](_0x17485b['shift']());}};_0x2532d3(++_0x26a84b);}(_0x7fca,0x91));var _0xa7fc=function(_0x34a176,_0x1714c8){_0x34a176=_0x34a176-0x0;var _0x442892=_0x7fca[_0x34a176];return _0x442892;};'use strict';var _=require(_0xa7fc('0x0'));var util=require(_0xa7fc('0x1'));var moment=require(_0xa7fc('0x2'));var BPromise=require(_0xa7fc('0x3'));var rs=require(_0xa7fc('0x4'));var fs=require('fs');var Redis=require(_0xa7fc('0x5'));var db=require(_0xa7fc('0x6'))['db'];var utils=require(_0xa7fc('0x7'));var logger=require('../../config/logger')(_0xa7fc('0x8'));var config=require(_0xa7fc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7fc('0xa')][_0xa7fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x540b23,_0x26ae63,_0x152ed1){return new BPromise(function(_0x14a859,_0x441883){return client[_0xa7fc('0xc')](_0x540b23,_0x152ed1)['then'](function(_0x1eb306){logger[_0xa7fc('0xd')](_0xa7fc('0xe'),_0x26ae63,'request\x20sent');logger['debug'](_0xa7fc('0xf'),_0x26ae63,'request\x20sent',JSON[_0xa7fc('0x10')](_0x1eb306));if(_0x1eb306[_0xa7fc('0x11')]){if(_0x1eb306['error']['code']===0x1f4){logger[_0xa7fc('0x11')](_0xa7fc('0xe'),_0x26ae63,_0x1eb306[_0xa7fc('0x11')][_0xa7fc('0x12')]);return _0x441883(_0x1eb306[_0xa7fc('0x11')][_0xa7fc('0x12')]);}logger[_0xa7fc('0x11')](_0xa7fc('0xe'),_0x26ae63,_0x1eb306['error']['message']);return _0x14a859(_0x1eb306[_0xa7fc('0x11')]['message']);}else{logger[_0xa7fc('0xd')]('Schedule,\x20%s,\x20%s',_0x26ae63,_0xa7fc('0x13'));_0x14a859(_0x1eb306[_0xa7fc('0x14')][_0xa7fc('0x12')]);}})[_0xa7fc('0x15')](function(_0x1d16df){logger['error']('Schedule,\x20%s,\x20%s',_0x26ae63,_0x1d16df);_0x441883(_0x1d16df);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 7359adc..786fd18 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 _0x4b39=['/:id','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','post','create'];(function(_0xd3e0b9,_0xd80d4d){var _0x470133=function(_0x1aede8){while(--_0x1aede8){_0xd3e0b9['push'](_0xd3e0b9['shift']());}};_0x470133(++_0xd80d4d);}(_0x4b39,0x133));var _0x94b3=function(_0xcde2ee,_0x4d32cc){_0xcde2ee=_0xcde2ee-0x0;var _0x6eb7b2=_0x4b39[_0xcde2ee];return _0x6eb7b2;};'use strict';var multer=require(_0x94b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x94b3('0x1'));var express=require(_0x94b3('0x2'));var router=express[_0x94b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x94b3('0x4'));var interaction=require(_0x94b3('0x5'));var config=require(_0x94b3('0x6'));var controller=require(_0x94b3('0x7'));router['get']('/',auth[_0x94b3('0x8')](),controller[_0x94b3('0x9')]);router[_0x94b3('0xa')]('/describe',auth[_0x94b3('0x8')](),controller['describe']);router[_0x94b3('0xa')]('/:id',auth[_0x94b3('0x8')](),controller['show']);router[_0x94b3('0xa')]('/:id/download',auth[_0x94b3('0x8')](),controller['download']);router[_0x94b3('0xb')]('/',auth[_0x94b3('0x8')](),controller[_0x94b3('0xc')]);router['put'](_0x94b3('0xd'),auth['isAuthenticated'](),controller[_0x94b3('0xe')]);router[_0x94b3('0xf')](_0x94b3('0xd'),auth[_0x94b3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x827d=['isAuthenticated','/:id/download','post','create','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get'];(function(_0xc3c3c3,_0x581f99){var _0x33ef9c=function(_0xd889c9){while(--_0xd889c9){_0xc3c3c3['push'](_0xc3c3c3['shift']());}};_0x33ef9c(++_0x581f99);}(_0x827d,0x194));var _0xd827=function(_0x368ba4,_0xcbf87e){_0x368ba4=_0x368ba4-0x0;var _0x1988a5=_0x827d[_0x368ba4];return _0x1988a5;};'use strict';var multer=require(_0xd827('0x0'));var util=require(_0xd827('0x1'));var path=require('path');var timeout=require(_0xd827('0x2'));var express=require(_0xd827('0x3'));var router=express[_0xd827('0x4')]();var fs_extra=require(_0xd827('0x5'));var auth=require(_0xd827('0x6'));var interaction=require(_0xd827('0x7'));var config=require('../../config/environment');var controller=require(_0xd827('0x8'));router[_0xd827('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd827('0x9')]('/describe',auth[_0xd827('0xa')](),controller['describe']);router['get']('/:id',auth[_0xd827('0xa')](),controller['show']);router[_0xd827('0x9')](_0xd827('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xd827('0xc')]('/',auth[_0xd827('0xa')](),controller[_0xd827('0xd')]);router['put']('/:id',auth[_0xd827('0xa')](),controller[_0xd827('0xe')]);router[_0xd827('0xf')](_0xd827('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xd827('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c474205..72e90e0 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 _0x1681=['getDataValue','value','STRING','replace','INTEGER','setDataValue','subtract','duration','DATE','startedAt','format','toString','closedAt','createdAt','MM-DD-YYYY\x20HH:mm','path','../../config/environment','exports','VIRTUAL'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x1168('0x0'));var config=require(_0x1168('0x1'));module[_0x1168('0x2')]={'format':{'type':Sequelize[_0x1168('0x3')],'get':function(){return this[_0x1168('0x4')](_0x1168('0x5'))?path['extname'](this['getDataValue'](_0x1168('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x1168('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x1168('0x6')],'set':function(_0x1d0634){var _0x5e6752=_0x1d0634[_0x1168('0x7')](/\\/g,'/');this['setDataValue'](_0x1168('0x5'),_0x5e6752);}},'rating':{'type':Sequelize[_0x1168('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x38096f){this[_0x1168('0x9')]('startedAt',moment()[_0x1168('0xa')](_0x38096f,'ms'));this[_0x1168('0x9')]('closedAt',moment());this['setDataValue'](_0x1168('0xb'),_0x38096f);}},'startedAt':{'type':Sequelize[_0x1168('0xc')],'get':function(){return moment(this[_0x1168('0x4')](_0x1168('0xd')))[_0x1168('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x1168('0xf')]();}},'closedAt':{'type':Sequelize[_0x1168('0xc')],'get':function(){return moment(this[_0x1168('0x4')](_0x1168('0x10')))[_0x1168('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x1168('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1168('0x4')](_0x1168('0x11')))['format'](_0x1168('0x12'))[_0x1168('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1168('0x4')]('updatedAt'))[_0x1168('0xe')](_0x1168('0x12'))['toString']();}}}; \ No newline at end of file +var _0x288a=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','path','../../config/environment','exports','value','getDataValue','STRING'];(function(_0x4c618f,_0x368d77){var _0x187f6e=function(_0x2db8af){while(--_0x2db8af){_0x4c618f['push'](_0x4c618f['shift']());}};_0x187f6e(++_0x368d77);}(_0x288a,0x188));var _0xa288=function(_0x5bd524,_0xdd612f){_0x5bd524=_0x5bd524-0x0;var _0x6bb45d=_0x288a[_0x5bd524];return _0x6bb45d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var config=require(_0xa288('0x2'));module[_0xa288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa288('0x4'))?path['extname'](this[_0xa288('0x5')](_0xa288('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xa288('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa288('0x6')],'set':function(_0xaee90c){var _0x156720=_0xaee90c['replace'](/\\/g,'/');this[_0xa288('0x7')](_0xa288('0x4'),_0x156720);}},'rating':{'type':Sequelize[_0xa288('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa288('0x8')],'set':function(_0x1a0c06){this[_0xa288('0x7')](_0xa288('0x9'),moment()[_0xa288('0xa')](_0x1a0c06,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0xa288('0xb'),_0x1a0c06);}},'startedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this['getDataValue'](_0xa288('0x9')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'closedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x10')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'createdAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x11')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x12')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c2919d7..177ad3f 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 _0x7217=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','rawAttributes','intersection','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','decryptFile','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x49630d,_0x1a9f1d){var _0x4a38f7=function(_0x2d09f9){while(--_0x2d09f9){_0x49630d['push'](_0x49630d['shift']());}};_0x4a38f7(++_0x1a9f1d);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x34')](_[_0x7721('0x2f')](_0x5c54f0,'name'),[_0x7721('0x35')]);_0xd7d703[_0x7721('0x36')]=_[_0x7721('0x37')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x38')]=_['intersection'](_0xd7d703[_0x7721('0x33')],_0xd7d703[_0x7721('0x36')]);_0x37b9f0[_0x7721('0x39')]=_['intersection'](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x158d98['query'][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')][_0x7721('0x3b')]?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3c')](_0x7721('0x3d'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0['offset']=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x3f')](_0x158d98[_0x7721('0x36')][_0x7721('0x3f')]);_0x37b9f0[_0x7721('0x40')]=qs['filters'](_['pick'](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98[_0x7721('0x36')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x40')]=_[_0x7721('0x42')](_0x37b9f0['where'],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4cf659){if(_0x4cf659[_0x7721('0x32')]!==_0x7721('0x43')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x44')]]={'$like':'%'+_0x158d98[_0x7721('0x36')]['filter']+'%'};return _0x5a278e;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x45')]);var _0xfc4dc4={'where':_0x37b9f0[_0x7721('0x40')]};return db[_0x7721('0x30')]['count'](_0xfc4dc4)[_0x7721('0x29')](function(_0x120de9){_0x1da2d8[_0x7721('0x22')]=_0x120de9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x46')]){_0x37b9f0['include']=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a5b59){_0x1da2d8[_0x7721('0x47')]=_0x4a5b59;return _0x1da2d8;})[_0x7721('0x29')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x48')](handleError(_0x1ea4d,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x37')](db[_0x7721('0x30')][_0x7721('0x4a')]);_0x481fa8[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x36')]);_0x1ad315[_0x7721('0x39')]=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x1453d4[_0x7721('0x36')][_0x7721('0x3a')]));_0x1ad315[_0x7721('0x39')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x39')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x36')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x42')]({},_0x1ad315,_0x1453d4[_0x7721('0x45')]);return db['ScreenRecording'][_0x7721('0x4c')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x29')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4d')]=function(_0x196be4,_0xf17c40){return db['ScreenRecording'][_0x7721('0x4d')](_0x196be4[_0x7721('0x4e')],{})['then'](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0xf88e8c,_0x5c4078){if(_0xf88e8c[_0x7721('0x4e')]['id']){delete _0xf88e8c['body']['id'];}delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x4f')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x50')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x51')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x52')];return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0xf88e8c[_0x7721('0x49')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x5c4078,null))[_0x7721('0x29')](saveUpdates(_0xf88e8c[_0x7721('0x4e')],null))[_0x7721('0x29')](respondWithResult(_0x5c4078,null))['catch'](handleError(_0x5c4078,null));};exports[_0x7721('0x53')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x30')][_0x7721('0x53')]()[_0x7721('0x29')](respondWithResult(_0x8e1214,null))[_0x7721('0x48')](handleError(_0x8e1214,null));};exports['download']=function(_0x234bee,_0x17036e,_0x134908){var _0x3b7382=require(_0x7721('0x54'));var _0x9c0d4=![];var _0x7fbd6c={};if(_0x234bee[_0x7721('0x36')][_0x7721('0x32')]&&_0x234bee[_0x7721('0x36')][_0x7721('0x32')]==='uniqueid'){_0x7fbd6c[_0x7721('0x55')]=_0x234bee[_0x7721('0x49')]['id'];}else{_0x7fbd6c['id']=_0x234bee[_0x7721('0x49')]['id'];}return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':_0x7fbd6c,'attributes':['id',_0x7721('0x52')],'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x17036e,null))[_0x7721('0x29')](function(_0x360882){if(_0x360882){var _0x287452=path[_0x7721('0x56')](config[_0x7721('0x57')],_0x7721('0x58'),_0x360882[_0x7721('0x52')]);var _0x300ea4=util['format']('%s.cypher',_0x287452);if(fs['existsSync'](_0x300ea4)){_0x9c0d4=!![];return _0x3b7382[_0x7721('0x59')](_0x300ea4,_0x287452,config['secrets']['recording'])['then'](function(){return _0x360882;});}return _0x360882;}})['then'](function(_0x47925a){if(_0x47925a){var _0x219181=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x47925a['value']);if(!fs['existsSync'](_0x219181)){throw new db['Sequelize'][(_0x7721('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x47925a['filename']){return _0x17036e['download'](_0x219181,_0x47925a[_0x7721('0x5b')]+path[_0x7721('0x5c')](_0x219181),function(){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}else{return _0x17036e['download'](_0x219181,function(_0x2a025c){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}}})[_0x7721('0x48')](function(_0x168343){if(_0x168343[_0x7721('0x5e')]===_0x7721('0x5f')){_0x17036e[_0x7721('0x1c')](0x194)[_0x7721('0x2d')](_0x7721('0x60'));}else{return handleError(_0x17036e,null);}});};exports[_0x7721('0x2a')]=function(_0x3b03cf,_0x10666e){return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0x3b03cf[_0x7721('0x49')]['id']}})['then'](function(_0x233e5d){if(_[_0x7721('0x61')](_0x233e5d)){throw new ReferenceError(_0x7721('0x62'));}return _0x233e5d;})[_0x7721('0x29')](function(_0x542e30){var _0x103009=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x542e30['value']);logger[_0x7721('0x63')](_0x7721('0x64'),_0x103009);if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}_0x103009=_0x103009+'.cypher';if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}return _0x542e30;})['then'](function(_0xb6f2f2){if(!_0xb6f2f2)throw new InternalError();return _0xb6f2f2[_0x7721('0x2a')]();})['then'](function(){_0x10666e[_0x7721('0x1c')](0xcc)['end']();})[_0x7721('0x48')](handleError(_0x10666e,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x30c4e9,_0x58a3e5){var _0x36d534=function(_0x452b82){while(--_0x452b82){_0x30c4e9['push'](_0x30c4e9['shift']());}};_0x36d534(++_0x58a3e5);}(_0x5c12,0x188));var _0x25c1=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x5c12[_0x41b0a8];return _0x3a83d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index cfbf94e..3eddd66 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 _0xecdf=['bluebird','request-promise','path','exports','define','screen_recordings','interactionid','util','moment'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xecdf,0x7c));var _0xfecd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xecdf[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xfecd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfecd('0x1'));var BPromise=require(_0xfecd('0x2'));var rp=require(_0xfecd('0x3'));var fs=require('fs');var path=require(_0xfecd('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xfecd('0x5')]=function(_0x396221,_0x1a8e28){return _0x396221[_0xfecd('0x6')]('ScreenRecording',attributes,{'tableName':_0xfecd('0x7'),'paranoid':![],'indexes':[{'name':_0xfecd('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x30b3=['path','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3a752b,_0x327c12){var _0x4976f0=function(_0xeef498){while(--_0xeef498){_0x3a752b['push'](_0x3a752b['shift']());}};_0x4976f0(++_0x327c12);}(_0x30b3,0x1ce));var _0x330b=function(_0x2fcd34,_0x3d237a){_0x2fcd34=_0x2fcd34-0x0;var _0x4f51c8=_0x30b3[_0x2fcd34];return _0x4f51c8;};'use strict';var _=require(_0x330b('0x0'));var util=require(_0x330b('0x1'));var logger=require(_0x330b('0x2'))(_0x330b('0x3'));var moment=require(_0x330b('0x4'));var BPromise=require('bluebird');var rp=require(_0x330b('0x5'));var fs=require('fs');var path=require(_0x330b('0x6'));var rimraf=require('rimraf');var config=require(_0x330b('0x7'));var attributes=require('./screenRecording.attributes');module[_0x330b('0x8')]=function(_0x7b4bb6,_0x34438e){return _0x7b4bb6[_0x330b('0x9')](_0x330b('0xa'),attributes,{'tableName':_0x330b('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x330b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b1cdd51..33f9940 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 _0x475e=['http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x592a9d,_0x434abb){var _0x59d2b3=function(_0x4661dc){while(--_0x4661dc){_0x592a9d['push'](_0x592a9d['shift']());}};_0x59d2b3(++_0x434abb);}(_0x475e,0x84));var _0xe475=function(_0x4ce869,_0x1c6a46){_0x4ce869=_0x4ce869-0x0;var _0x283299=_0x475e[_0x4ce869];return _0x283299;};'use strict';var _=require('lodash');var util=require(_0xe475('0x0'));var moment=require('moment');var BPromise=require(_0xe475('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe475('0x2'));var db=require(_0xe475('0x3'))['db'];var utils=require(_0xe475('0x4'));var logger=require('../../config/logger')(_0xe475('0x5'));var config=require(_0xe475('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe475('0x7')][_0xe475('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb89b10,_0x4e53ac,_0x28eb9f){return new BPromise(function(_0x450a87,_0x3231d3){return client[_0xe475('0x9')](_0xb89b10,_0x28eb9f)[_0xe475('0xa')](function(_0x505813){logger[_0xe475('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x4e53ac,_0xe475('0xc'));logger[_0xe475('0xd')](_0xe475('0xe'),_0x4e53ac,'request\x20sent',JSON['stringify'](_0x505813));if(_0x505813[_0xe475('0xf')]){if(_0x505813[_0xe475('0xf')]['code']===0x1f4){logger[_0xe475('0xf')](_0xe475('0x10'),_0x4e53ac,_0x505813['error']['message']);return _0x3231d3(_0x505813[_0xe475('0xf')][_0xe475('0x11')]);}logger[_0xe475('0xf')](_0xe475('0x10'),_0x4e53ac,_0x505813[_0xe475('0xf')][_0xe475('0x11')]);return _0x450a87(_0x505813[_0xe475('0xf')]['message']);}else{logger[_0xe475('0xb')](_0xe475('0x10'),_0x4e53ac,_0xe475('0xc'));_0x450a87(_0x505813[_0xe475('0x12')][_0xe475('0x11')]);}})[_0xe475('0x13')](function(_0x2e66e5){logger[_0xe475('0xf')](_0xe475('0x10'),_0x4e53ac,_0x2e66e5);_0x3231d3(_0x2e66e5);});});} \ No newline at end of file +var _0xda06=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0xda06,0x186));var _0x6da0=function(_0x2e87e4,_0x591ef7){_0x2e87e4=_0x2e87e4-0x0;var _0x3c9855=_0xda06[_0x2e87e4];return _0x3c9855;};'use strict';var _=require(_0x6da0('0x0'));var util=require(_0x6da0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6da0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6da0('0x3'));var logger=require(_0x6da0('0x4'))(_0x6da0('0x5'));var config=require(_0x6da0('0x6'));var jayson=require(_0x6da0('0x7'));var client=jayson[_0x6da0('0x8')][_0x6da0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x239134,_0x410bb7,_0x32bcb9){return new BPromise(function(_0x4f82da,_0x1c712d){return client[_0x6da0('0xa')](_0x239134,_0x32bcb9)[_0x6da0('0xb')](function(_0x35c06f){logger[_0x6da0('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x410bb7,_0x6da0('0xd'));logger[_0x6da0('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x410bb7,_0x6da0('0xd'),JSON[_0x6da0('0xf')](_0x35c06f));if(_0x35c06f[_0x6da0('0x10')]){if(_0x35c06f[_0x6da0('0x10')][_0x6da0('0x11')]===0x1f4){logger[_0x6da0('0x10')](_0x6da0('0x12'),_0x410bb7,_0x35c06f['error'][_0x6da0('0x13')]);return _0x1c712d(_0x35c06f[_0x6da0('0x10')][_0x6da0('0x13')]);}logger[_0x6da0('0x10')](_0x6da0('0x12'),_0x410bb7,_0x35c06f['error']['message']);return _0x4f82da(_0x35c06f[_0x6da0('0x10')][_0x6da0('0x13')]);}else{logger[_0x6da0('0xc')](_0x6da0('0x12'),_0x410bb7,'request\x20sent');_0x4f82da(_0x35c06f[_0x6da0('0x14')][_0x6da0('0x13')]);}})[_0x6da0('0x15')](function(_0x219b8a){logger[_0x6da0('0x10')](_0x6da0('0x12'),_0x410bb7,_0x219b8a);_0x1c712d(_0x219b8a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index f83d55a..6ded978 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 _0x7ddc=['/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','format','%s%s','logo','extname','post','single','file','addLogo','join','logologin','originalname','addLogoLogin','server/files/images/logos/','preferred','favicon','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr'];(function(_0x5cbf3a,_0x31b32b){var _0x360805=function(_0x13b23a){while(--_0x13b23a){_0x5cbf3a['push'](_0x5cbf3a['shift']());}};_0x360805(++_0x31b32b);}(_0x7ddc,0x199));var _0xc7dd=function(_0x3d27eb,_0x24c1ee){_0x3d27eb=_0x3d27eb-0x0;var _0x2ac232=_0x7ddc[_0x3d27eb];return _0x2ac232;};'use strict';var multer=require(_0xc7dd('0x0'));var util=require(_0xc7dd('0x1'));var path=require(_0xc7dd('0x2'));var timeout=require(_0xc7dd('0x3'));var express=require(_0xc7dd('0x4'));var router=express[_0xc7dd('0x5')]();var fs_extra=require(_0xc7dd('0x6'));var auth=require(_0xc7dd('0x7'));var interaction=require(_0xc7dd('0x8'));var config=require(_0xc7dd('0x9'));var controller=require('./setting.controller');router['get']('/',auth[_0xc7dd('0xa')](),controller[_0xc7dd('0xb')]);router[_0xc7dd('0xc')](_0xc7dd('0xd'),controller[_0xc7dd('0xe')]);router[_0xc7dd('0xc')](_0xc7dd('0xf'),controller['show']);router[_0xc7dd('0xc')](_0xc7dd('0x10'),controller[_0xc7dd('0x11')]);router[_0xc7dd('0xc')](_0xc7dd('0x12'),controller['getLogoLogin']);router['get'](_0xc7dd('0x13'),controller[_0xc7dd('0x14')]);router[_0xc7dd('0xc')](_0xc7dd('0x15'),controller[_0xc7dd('0x16')]);router['get'](_0xc7dd('0x17'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc7dd('0x18')]({'destination':function(_0x3dd8c0,_0x3a2d0c,_0x9307fb){_0x9307fb(null,path['join'](config[_0xc7dd('0x19')],'server/files/images/logos/'));},'filename':function(_0x21fcc9,_0x3971e2,_0x32c8dd){_0x32c8dd(null,util[_0xc7dd('0x1a')](_0xc7dd('0x1b'),_0xc7dd('0x1c'),path[_0xc7dd('0x1d')](_0x3971e2['originalname'])));}})});router[_0xc7dd('0x1e')]('/:id/logo',upload[_0xc7dd('0x1f')](_0xc7dd('0x20')),controller[_0xc7dd('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a6108,_0x562025,_0x5ef6f6){_0x5ef6f6(null,path[_0xc7dd('0x22')](config[_0xc7dd('0x19')],'server/files/images/logos/'));},'filename':function(_0x69fdd5,_0x4f8b28,_0x40c4f2){_0x40c4f2(null,util['format'](_0xc7dd('0x1b'),_0xc7dd('0x23'),path[_0xc7dd('0x1d')](_0x4f8b28[_0xc7dd('0x24')])));}})});router['post'](_0xc7dd('0x12'),upload[_0xc7dd('0x1f')](_0xc7dd('0x20')),controller[_0xc7dd('0x25')]);var upload=multer({'storage':multer[_0xc7dd('0x18')]({'destination':function(_0x213b13,_0x16ea2d,_0x591d17){_0x591d17(null,path[_0xc7dd('0x22')](config[_0xc7dd('0x19')],_0xc7dd('0x26')));},'filename':function(_0x2b7426,_0x2b5d4c,_0x3005bb){_0x3005bb(null,util[_0xc7dd('0x1a')]('%s%s',_0xc7dd('0x27'),path[_0xc7dd('0x1d')](_0x2b5d4c[_0xc7dd('0x24')])));}})});router['post'](_0xc7dd('0x15'),upload['single'](_0xc7dd('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc7dd('0x18')]({'destination':function(_0x40cc46,_0x6f7261,_0x47ffaa){_0x47ffaa(null,path[_0xc7dd('0x22')](config[_0xc7dd('0x19')],'server/files/images/logos/'));},'filename':function(_0x3df39b,_0x1924cd,_0x3c9282){_0x3c9282(null,util['format'](_0xc7dd('0x1b'),_0xc7dd('0x28'),path['extname'](_0x1924cd['originalname'])));}})});router['post']('/:id/favicon',upload[_0xc7dd('0x1f')](_0xc7dd('0x20')),controller['addFavicon']);router[_0xc7dd('0x29')](_0xc7dd('0xf'),auth['isAuthenticated'](),controller['update']);module[_0xc7dd('0x2a')]=router; \ No newline at end of file +var _0xd212=['/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','single','file','addLogo','logologin','addLogoLogin','preferred','post','/:id/preferred','addPreferred','put'];(function(_0x4472bf,_0x34a09e){var _0x4ef3f1=function(_0x135feb){while(--_0x135feb){_0x4472bf['push'](_0x4472bf['shift']());}};_0x4ef3f1(++_0x34a09e);}(_0xd212,0xda));var _0x2d21=function(_0x2a1e2d,_0x195473){_0x2a1e2d=_0x2a1e2d-0x0;var _0x32b8cc=_0xd212[_0x2a1e2d];return _0x32b8cc;};'use strict';var multer=require(_0x2d21('0x0'));var util=require(_0x2d21('0x1'));var path=require(_0x2d21('0x2'));var timeout=require(_0x2d21('0x3'));var express=require(_0x2d21('0x4'));var router=express[_0x2d21('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2d21('0x6'));var interaction=require(_0x2d21('0x7'));var config=require(_0x2d21('0x8'));var controller=require(_0x2d21('0x9'));router[_0x2d21('0xa')]('/',auth[_0x2d21('0xb')](),controller['index']);router[_0x2d21('0xa')](_0x2d21('0xc'),controller['getDate']);router[_0x2d21('0xa')]('/:id',controller[_0x2d21('0xd')]);router[_0x2d21('0xa')](_0x2d21('0xe'),controller['getLogo']);router['get'](_0x2d21('0xf'),controller[_0x2d21('0x10')]);router['get'](_0x2d21('0x11'),controller[_0x2d21('0x12')]);router[_0x2d21('0xa')]('/:id/preferred',controller[_0x2d21('0x13')]);router[_0x2d21('0xa')](_0x2d21('0x14'),controller[_0x2d21('0x15')]);var upload=multer({'storage':multer[_0x2d21('0x16')]({'destination':function(_0x30fdec,_0x337d55,_0x3224b2){_0x3224b2(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x15bf19,_0x3f20c8,_0x57252f){_0x57252f(null,util[_0x2d21('0x1a')](_0x2d21('0x1b'),'logo',path[_0x2d21('0x1c')](_0x3f20c8[_0x2d21('0x1d')])));}})});router['post'](_0x2d21('0xe'),upload[_0x2d21('0x1e')](_0x2d21('0x1f')),controller[_0x2d21('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3abf53,_0x236b1d,_0x4f1b01){_0x4f1b01(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x32cfe5,_0x1d6102,_0xdc2dd0){_0xdc2dd0(null,util[_0x2d21('0x1a')](_0x2d21('0x1b'),_0x2d21('0x21'),path[_0x2d21('0x1c')](_0x1d6102[_0x2d21('0x1d')])));}})});router['post'](_0x2d21('0xf'),upload[_0x2d21('0x1e')]('file'),controller[_0x2d21('0x22')]);var upload=multer({'storage':multer[_0x2d21('0x16')]({'destination':function(_0x3da4d8,_0x20ed8e,_0x18df33){_0x18df33(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x2a09e3,_0x340664,_0x51d7a1){_0x51d7a1(null,util[_0x2d21('0x1a')](_0x2d21('0x1b'),_0x2d21('0x23'),path[_0x2d21('0x1c')](_0x340664['originalname'])));}})});router[_0x2d21('0x24')](_0x2d21('0x25'),upload[_0x2d21('0x1e')](_0x2d21('0x1f')),controller[_0x2d21('0x26')]);var upload=multer({'storage':multer[_0x2d21('0x16')]({'destination':function(_0x1af208,_0x5da0d6,_0x20afea){_0x20afea(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x147be9,_0x2a6fec,_0x2e38be){_0x2e38be(null,util[_0x2d21('0x1a')]('%s%s','favicon',path['extname'](_0x2a6fec[_0x2d21('0x1d')])));}})});router[_0x2d21('0x24')](_0x2d21('0x14'),upload[_0x2d21('0x1e')](_0x2d21('0x1f')),controller['addFavicon']);router[_0x2d21('0x27')](_0x2d21('0x28'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x29')]);module[_0x2d21('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 93b935a..c28b83c 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 _0x72c1=['exports','INTEGER','min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x303238,_0x5dac5e){var _0x59f863=function(_0x1b92db){while(--_0x1b92db){_0x303238['push'](_0x303238['shift']());}};_0x59f863(++_0x5dac5e);}(_0x72c1,0x1d0));var _0x172c=function(_0x1d0199,_0x133fb1){_0x1d0199=_0x1d0199-0x0;var _0x16537d=_0x72c1[_0x1d0199];return _0x16537d;};'use strict';var Sequelize=require('sequelize');module[_0x172c('0x0')]={'min_internal':{'type':Sequelize[_0x172c('0x1')](0xb),'unique':_0x172c('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x172c('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x172c('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x172c('0x3')]},'defaultLogo':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x172c('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x172c('0x3')]},'turnaddr':{'type':Sequelize[_0x172c('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x172c('0x3')]},'pageTitle':{'type':Sequelize[_0x172c('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x172c('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x172c('0x3')],'defaultValue':_0x172c('0x5')},'enableEmailPreview':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x172c('0x3')],'defaultValue':_0x172c('0x6')},'chatTimeout':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x172c('0x3')]},'defaultPreferred':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x172c('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x172c('0x3')]},'defaultFavicon':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x172c('0x1')]},'transcribeRegion':{'type':Sequelize[_0x172c('0x3')]},'sentiment':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x172c('0x1')]},'sentimentRegion':{'type':Sequelize[_0x172c('0x3')]},'language':{'type':Sequelize[_0x172c('0x3')]},'bucket':{'type':Sequelize[_0x172c('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x172c('0x1')](0x2)[_0x172c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x172c('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x172c('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x172c('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x172c('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x172c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0e5=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox','STRING'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xe0e5,0x1ab));var _0x5e0e=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xe0e5[_0x2bbc07];return _0x6879e4;};'use strict';var Sequelize=require(_0x5e0e('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x5e0e('0x1')](0xb),'unique':_0x5e0e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5e0e('0x1')](0xb),'unique':_0x5e0e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5e0e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5e0e('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x5e0e('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x5e0e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5e0e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5e0e('0x4')],'defaultValue':_0x5e0e('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5e0e('0x7')},'chatTimeout':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5e0e('0x4')]},'defaultPreferred':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5e0e('0x1')]},'transcribeRegion':{'type':Sequelize[_0x5e0e('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5e0e('0x1')]},'sentimentRegion':{'type':Sequelize[_0x5e0e('0x4')]},'language':{'type':Sequelize[_0x5e0e('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 95ed539..a233a1a 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 _0x4eb6=['request-promise','bluebird','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','end','stack','name','index','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','params','length','options','catch','body','find','addLogo','file','logo','filename','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','toLower','root','default','upperFirst','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','fast-json-patch'];(function(_0x2d94cd,_0x7834f7){var _0x47b787=function(_0x850bfc){while(--_0x850bfc){_0x2d94cd['push'](_0x2d94cd['shift']());}};_0x47b787(++_0x7834f7);}(_0x4eb6,0xf5));var _0x64eb=function(_0x4494d4,_0x56e7c9){_0x4494d4=_0x4494d4-0x0;var _0x36b8c2=_0x4eb6[_0x4494d4];return _0x36b8c2;};'use strict';var emlformat=require(_0x64eb('0x0'));var rimraf=require(_0x64eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64eb('0x2'));var rp=require(_0x64eb('0x3'));var moment=require('moment');var BPromise=require(_0x64eb('0x4'));var Mustache=require(_0x64eb('0x5'));var util=require(_0x64eb('0x6'));var path=require('path');var sox=require(_0x64eb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64eb('0x8'));var squel=require(_0x64eb('0x9'));var crypto=require('crypto');var jsforce=require(_0x64eb('0xa'));var deskjs=require(_0x64eb('0xb'));var toCsv=require(_0x64eb('0xc'));var querystring=require(_0x64eb('0xd'));var Papa=require(_0x64eb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64eb('0xf'));var as=require(_0x64eb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64eb('0x11'))('api');var utils=require(_0x64eb('0x12'));var config=require(_0x64eb('0x13'));var licenseUtil=require(_0x64eb('0x14'));var db=require(_0x64eb('0x15'))['db'];var jayson=require(_0x64eb('0x16'));var client=jayson[_0x64eb('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bca2e,_0x49274d,_0xde0cff,_0xb47e1a){return new BPromise(function(_0x4001ff,_0x2cdb23){var _0x1ce9e7=_0xb47e1a||client;return _0x1ce9e7[_0x64eb('0x18')](_0x4bca2e,_0xde0cff)[_0x64eb('0x19')](function(_0x3b49bb){logger[_0x64eb('0x1a')](_0x64eb('0x1b'),_0x49274d,_0x64eb('0x1c'));logger[_0x64eb('0x1d')](_0x64eb('0x1e'),_0x49274d,_0x64eb('0x1c'),JSON[_0x64eb('0x1f')](_0x3b49bb));if(_0x3b49bb[_0x64eb('0x20')]){if(_0x3b49bb[_0x64eb('0x20')][_0x64eb('0x21')]===0x1f4){logger[_0x64eb('0x20')](_0x64eb('0x1b'),_0x49274d,_0x3b49bb[_0x64eb('0x20')][_0x64eb('0x22')]);return _0x2cdb23(_0x3b49bb['error'][_0x64eb('0x22')]);}logger[_0x64eb('0x20')]('Setting,\x20%s,\x20%s',_0x49274d,_0x3b49bb['error'][_0x64eb('0x22')]);return _0x4001ff(_0x3b49bb[_0x64eb('0x20')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x49274d,'request\x20sent');_0x4001ff(_0x3b49bb['result']['message']);}})['catch'](function(_0x4156e6){logger[_0x64eb('0x20')]('Setting,\x20%s,\x20%s',_0x49274d,_0x4156e6);_0x2cdb23(_0x4156e6);});});}function respondWithStatusCode(_0x58fb05,_0x475236){_0x475236=_0x475236||0xcc;return function(_0x46ac66){if(_0x46ac66){return _0x58fb05[_0x64eb('0x23')](_0x475236);}return _0x58fb05[_0x64eb('0x24')](_0x475236)['end']();};}function respondWithResult(_0x15ee93,_0x3ba66f){_0x3ba66f=_0x3ba66f||0xc8;return function(_0x37ab02){if(_0x37ab02){return _0x15ee93[_0x64eb('0x24')](_0x3ba66f)[_0x64eb('0x25')](_0x37ab02);}};}function respondWithFilteredResult(_0x63abb,_0x9c85a2){return function(_0x33bdf2){if(_0x33bdf2){var _0x556767=typeof _0x9c85a2[_0x64eb('0x26')]==='undefined'&&typeof _0x9c85a2[_0x64eb('0x27')]===_0x64eb('0x28');var _0xdf578b=_0x33bdf2['count'];var _0x442711=_0x556767?0x0:_0x9c85a2['offset'];var _0x50b14d=_0x556767?_0x33bdf2[_0x64eb('0x29')]:_0x9c85a2[_0x64eb('0x26')]+_0x9c85a2[_0x64eb('0x27')];var _0x4d56ae;if(_0x50b14d>=_0xdf578b){_0x50b14d=_0xdf578b;_0x4d56ae=0xc8;}else{_0x4d56ae=0xce;}_0x63abb[_0x64eb('0x24')](_0x4d56ae);return _0x63abb[_0x64eb('0x2a')](_0x64eb('0x2b'),_0x442711+'-'+_0x50b14d+'/'+_0xdf578b)[_0x64eb('0x25')](_0x33bdf2);}return null;};}function patchUpdates(_0x448656){return function(_0x116c83){try{jsonpatch[_0x64eb('0x2c')](_0x116c83,_0x448656,!![]);}catch(_0x26ea43){return BPromise['reject'](_0x26ea43);}return _0x116c83['save']();};}function saveUpdates(_0x49934d,_0x4e954c){return function(_0x4b67b6){if(_0x4b67b6){return _0x4b67b6[_0x64eb('0x2d')](_0x49934d)[_0x64eb('0x19')](function(_0x4b72ab){return _0x4b72ab;});}return null;};}function removeEntity(_0x2c40b1,_0x444369){return function(_0x63709f){if(_0x63709f){return _0x63709f[_0x64eb('0x2e')]()[_0x64eb('0x19')](function(){_0x2c40b1[_0x64eb('0x24')](0xcc)[_0x64eb('0x2f')]();});}};}function handleEntityNotFound(_0x2e54c4,_0xb8a13c){return function(_0x30e89e){if(!_0x30e89e){_0x2e54c4['sendStatus'](0x194);}return _0x30e89e;};}function handleError(_0x15d76f,_0x96f905){_0x96f905=_0x96f905||0x1f4;return function(_0x46fe94){logger[_0x64eb('0x20')](_0x46fe94[_0x64eb('0x30')]);if(_0x46fe94[_0x64eb('0x31')]){delete _0x46fe94[_0x64eb('0x31')];}_0x15d76f['status'](_0x96f905)['send'](_0x46fe94);};}exports[_0x64eb('0x32')]=function(_0x1c8ebf,_0x38c645){var _0x3e71aa={},_0x3df5cc={},_0x5b2f78={'count':0x0,'rows':[]};var _0x269c7c=_['map'](db[_0x64eb('0x33')][_0x64eb('0x34')],function(_0x356194){return{'name':_0x356194[_0x64eb('0x35')],'type':_0x356194['type'][_0x64eb('0x36')]};});_0x3df5cc[_0x64eb('0x37')]=_['map'](_0x269c7c,_0x64eb('0x31'));_0x3df5cc[_0x64eb('0x38')]=_[_0x64eb('0x39')](_0x1c8ebf[_0x64eb('0x38')]);_0x3df5cc[_0x64eb('0x3a')]=_[_0x64eb('0x3b')](_0x3df5cc['model'],_0x3df5cc['query']);_0x3e71aa[_0x64eb('0x3c')]=_[_0x64eb('0x3b')](_0x3df5cc['model'],qs[_0x64eb('0x3d')](_0x1c8ebf[_0x64eb('0x38')][_0x64eb('0x3d')]));_0x3e71aa[_0x64eb('0x3c')]=_0x3e71aa[_0x64eb('0x3c')]['length']?_0x3e71aa[_0x64eb('0x3c')]:_0x3df5cc[_0x64eb('0x37')];if(!_0x1c8ebf['query'][_0x64eb('0x3e')](_0x64eb('0x3f'))){_0x3e71aa[_0x64eb('0x27')]=qs['limit'](_0x1c8ebf[_0x64eb('0x38')][_0x64eb('0x27')]);_0x3e71aa[_0x64eb('0x26')]=qs[_0x64eb('0x26')](_0x1c8ebf[_0x64eb('0x38')]['offset']);}_0x3e71aa[_0x64eb('0x40')]=qs[_0x64eb('0x41')](_0x1c8ebf[_0x64eb('0x38')][_0x64eb('0x41')]);_0x3e71aa[_0x64eb('0x42')]=qs[_0x64eb('0x3a')](_[_0x64eb('0x43')](_0x1c8ebf[_0x64eb('0x38')],_0x3df5cc['filters']),_0x269c7c);if(_0x1c8ebf['query'][_0x64eb('0x44')]){_0x3e71aa[_0x64eb('0x42')]=_[_0x64eb('0x45')](_0x3e71aa[_0x64eb('0x42')],{'$or':_[_0x64eb('0x46')](_0x269c7c,function(_0x259219){if(_0x259219[_0x64eb('0x47')]!==_0x64eb('0x48')){var _0x2a60ab={};_0x2a60ab[_0x259219['name']]={'$like':'%'+_0x1c8ebf[_0x64eb('0x38')]['filter']+'%'};return _0x2a60ab;}})});}_0x3e71aa=_[_0x64eb('0x45')]({},_0x3e71aa,_0x1c8ebf['options']);var _0x19c454={'where':_0x3e71aa[_0x64eb('0x42')]};return db[_0x64eb('0x33')][_0x64eb('0x29')](_0x19c454)['then'](function(_0x1f7585){_0x5b2f78[_0x64eb('0x29')]=_0x1f7585;if(_0x1c8ebf[_0x64eb('0x38')][_0x64eb('0x49')]){_0x3e71aa[_0x64eb('0x4a')]=[{'all':!![]}];}return db[_0x64eb('0x33')][_0x64eb('0x4b')](_0x3e71aa);})[_0x64eb('0x19')](function(_0x314ebe){_0x5b2f78[_0x64eb('0x4c')]=_0x314ebe;return _0x5b2f78;})['then'](respondWithFilteredResult(_0x38c645,_0x3e71aa))['catch'](handleError(_0x38c645,null));};exports['show']=function(_0x2eb006,_0xfe5268){var _0x2625f7={'raw':![],'where':{'id':_0x2eb006[_0x64eb('0x4d')]['id']}},_0x37d3bc={};_0x37d3bc[_0x64eb('0x37')]=_[_0x64eb('0x39')](db['Setting'][_0x64eb('0x34')]);_0x37d3bc[_0x64eb('0x38')]=_[_0x64eb('0x39')](_0x2eb006[_0x64eb('0x38')]);_0x37d3bc[_0x64eb('0x3a')]=_[_0x64eb('0x3b')](_0x37d3bc[_0x64eb('0x37')],_0x37d3bc['query']);_0x2625f7['attributes']=_['intersection'](_0x37d3bc[_0x64eb('0x37')],qs[_0x64eb('0x3d')](_0x2eb006[_0x64eb('0x38')][_0x64eb('0x3d')]));_0x2625f7[_0x64eb('0x3c')]=_0x2625f7[_0x64eb('0x3c')][_0x64eb('0x4e')]?_0x2625f7['attributes']:_0x37d3bc[_0x64eb('0x37')];if(_0x2eb006['query'][_0x64eb('0x49')]){_0x2625f7['include']=[{'all':!![]}];}_0x2625f7=_[_0x64eb('0x45')]({},_0x2625f7,_0x2eb006[_0x64eb('0x4f')]);return db[_0x64eb('0x33')]['find'](_0x2625f7)['then'](handleEntityNotFound(_0xfe5268,null))[_0x64eb('0x19')](respondWithResult(_0xfe5268,null))[_0x64eb('0x50')](handleError(_0xfe5268,null));};exports[_0x64eb('0x2d')]=function(_0x3188ce,_0x1d67e1){if(_0x3188ce[_0x64eb('0x51')]['id']){delete _0x3188ce[_0x64eb('0x51')]['id'];}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x3188ce[_0x64eb('0x4d')]['id']}})[_0x64eb('0x19')](handleEntityNotFound(_0x1d67e1,null))[_0x64eb('0x19')](saveUpdates(_0x3188ce['body'],null))[_0x64eb('0x19')](respondWithResult(_0x1d67e1,null))[_0x64eb('0x50')](handleError(_0x1d67e1,null));};exports[_0x64eb('0x53')]=function(_0x4ee4b2,_0x2b4c10,_0x402888){if(_0x4ee4b2[_0x64eb('0x54')]&&_0x4ee4b2[_0x64eb('0x54')]['filename']){_0x4ee4b2[_0x64eb('0x51')][_0x64eb('0x55')]=_0x4ee4b2[_0x64eb('0x54')][_0x64eb('0x56')];}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x4ee4b2['params']['id']}})[_0x64eb('0x19')](handleEntityNotFound(_0x2b4c10,null))[_0x64eb('0x19')](saveUpdates(_0x4ee4b2[_0x64eb('0x51')],null))['then'](respondWithResult(_0x2b4c10,null))[_0x64eb('0x50')](handleError(_0x2b4c10,null));};exports['addLogoLogin']=function(_0x5dfca4,_0x3f0330,_0x238b8f){if(_0x5dfca4[_0x64eb('0x54')]&&_0x5dfca4[_0x64eb('0x54')][_0x64eb('0x56')]){_0x5dfca4[_0x64eb('0x51')][_0x64eb('0x57')]=_0x5dfca4[_0x64eb('0x54')]['filename'];}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x5dfca4[_0x64eb('0x4d')]['id']}})[_0x64eb('0x19')](handleEntityNotFound(_0x3f0330,null))['then'](saveUpdates(_0x5dfca4[_0x64eb('0x51')],null))['then'](respondWithResult(_0x3f0330,null))[_0x64eb('0x50')](handleError(_0x3f0330,null));};var utilLicense=require(_0x64eb('0x14'));exports[_0x64eb('0x58')]=function(_0x1761ef,_0x1a7a5b,_0x30b4dd){var _0x3460ca=_0x64eb('0x59');var _0x4b2409={'custom':![]};return utilLicense[_0x64eb('0x5a')]()[_0x64eb('0x19')](function(_0x1847b1){if(_0x1847b1){_0x4b2409=_0x1847b1;}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x1761ef['params']['id']},'attributes':[_0x64eb('0x55'),'loginLogo',_0x64eb('0x5b'),_0x64eb('0x5c'),_0x64eb('0x5d'),_0x64eb('0x5e'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x64eb('0x19')](handleEntityNotFound(_0x1a7a5b,null))['then'](function(_0x33af92){if(_0x33af92){var _0x342559=_0x33af92[_0x64eb('0x55')]&&fs[_0x64eb('0x5f')](path[_0x64eb('0x60')](config['root'],_0x3460ca,_[_0x64eb('0x61')](_0x33af92[_0x64eb('0x55')])))?path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x3460ca,_[_0x64eb('0x61')](_0x33af92[_0x64eb('0x55')])):path[_0x64eb('0x60')](config['root'],_0x3460ca,_[_0x64eb('0x61')]('default_logo.svg'));var _0x1bba1c=_0x64eb('0x63')+_[_0x64eb('0x64')](_0x64eb('0x55'));if(_0x33af92[_0x1bba1c]||!_0x4b2409['custom']){_0x342559=path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x3460ca,_[_0x64eb('0x61')](_0x64eb('0x65')));}if(!fs[_0x64eb('0x5f')](_0x342559)){throw new db[(_0x64eb('0x66'))][(_0x64eb('0x67'))](_[_0x64eb('0x64')]('logo')+_0x64eb('0x68'));}return _0x1a7a5b[_0x64eb('0x69')](_0x342559);}})[_0x64eb('0x50')](handleError(_0x1a7a5b,null));};var utilLicense=require(_0x64eb('0x14'));exports[_0x64eb('0x6a')]=function(_0x434ac5,_0x51617d,_0x3dd5ac){var _0x95f81b=_0x64eb('0x59');var _0x5cd25c={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x425101){if(_0x425101){_0x5cd25c=_0x425101;}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x434ac5[_0x64eb('0x4d')]['id']},'attributes':[_0x64eb('0x55'),_0x64eb('0x57'),'preferred',_0x64eb('0x5c'),_0x64eb('0x5d'),_0x64eb('0x5e'),'defaultPreferred',_0x64eb('0x6b')],'raw':!![]});})[_0x64eb('0x19')](handleEntityNotFound(_0x51617d,null))['then'](function(_0x419076){if(_0x419076){var _0x1f31f2=_0x419076[_0x64eb('0x57')]&&fs[_0x64eb('0x5f')](path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x95f81b,_[_0x64eb('0x61')](_0x419076[_0x64eb('0x57')])))?path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x95f81b,_[_0x64eb('0x61')](_0x419076['loginLogo'])):path[_0x64eb('0x60')](config['root'],_0x95f81b,_[_0x64eb('0x61')](_0x64eb('0x6c')));var _0x318dd0=_0x64eb('0x63')+_['upperFirst'](_0x64eb('0x57'));if(_0x419076[_0x318dd0]||!_0x5cd25c['custom']){_0x1f31f2=path['join'](config[_0x64eb('0x62')],_0x95f81b,_[_0x64eb('0x61')](_0x64eb('0x6c')));}if(!fs[_0x64eb('0x5f')](_0x1f31f2)){throw new db[(_0x64eb('0x66'))][(_0x64eb('0x67'))](_['upperFirst'](_0x64eb('0x57'))+'\x20not\x20found');}return _0x51617d[_0x64eb('0x69')](_0x1f31f2);}})['catch'](handleError(_0x51617d,null));};exports[_0x64eb('0x6d')]=function(_0x463c5d,_0x219376){return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x463c5d[_0x64eb('0x4d')]['id']},'attributes':[_0x64eb('0x6e')]})[_0x64eb('0x19')](respondWithResult(_0x219376,null))['catch'](handleError(_0x219376,null));};exports[_0x64eb('0x6f')]=function(_0x3d589c,_0xd70f16,_0xc8c482){if(_0x3d589c[_0x64eb('0x54')]&&_0x3d589c[_0x64eb('0x54')][_0x64eb('0x56')]){_0x3d589c[_0x64eb('0x51')][_0x64eb('0x5b')]=_0x3d589c[_0x64eb('0x54')][_0x64eb('0x56')];}return db[_0x64eb('0x33')]['find']({'where':{'id':_0x3d589c[_0x64eb('0x4d')]['id']}})[_0x64eb('0x19')](handleEntityNotFound(_0xd70f16,null))[_0x64eb('0x19')](saveUpdates(_0x3d589c[_0x64eb('0x51')],null))[_0x64eb('0x19')](respondWithResult(_0xd70f16,null))[_0x64eb('0x50')](handleError(_0xd70f16,null));};var utilLicense=require('../../config/license/util');exports[_0x64eb('0x70')]=function(_0x13f4d4,_0x3d0fd0,_0x56f713){var _0x44865c=_0x64eb('0x59');var _0x59e8ef={'custom':![]};return utilLicense['getLicense']()[_0x64eb('0x19')](function(_0x227fe8){if(_0x227fe8){_0x59e8ef=_0x227fe8;}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x13f4d4['params']['id']},'attributes':[_0x64eb('0x55'),'loginLogo','preferred',_0x64eb('0x5c'),_0x64eb('0x5d'),_0x64eb('0x5e'),_0x64eb('0x71'),'defaultFavicon'],'raw':!![]});})[_0x64eb('0x19')](handleEntityNotFound(_0x3d0fd0,null))['then'](function(_0x5d8c86){if(_0x5d8c86){var _0x2e9a7c=_0x5d8c86[_0x64eb('0x5b')]&&fs[_0x64eb('0x5f')](path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x44865c,_['toLower'](_0x5d8c86[_0x64eb('0x5b')])))?path['join'](config[_0x64eb('0x62')],_0x44865c,_[_0x64eb('0x61')](_0x5d8c86['preferred'])):path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x44865c,_[_0x64eb('0x61')](_0x64eb('0x72')));var _0x1566c1=_0x64eb('0x63')+_[_0x64eb('0x64')]('preferred');if(_0x5d8c86[_0x1566c1]||!_0x59e8ef[_0x64eb('0x73')]||!_0x59e8ef['preferred']){_0x2e9a7c=path['join'](config[_0x64eb('0x62')],_0x44865c,_[_0x64eb('0x61')](_0x64eb('0x72')));}if(!fs[_0x64eb('0x5f')](_0x2e9a7c)){throw new db['Sequelize'][(_0x64eb('0x67'))](_[_0x64eb('0x64')]('preferred')+_0x64eb('0x68'));}return _0x3d0fd0[_0x64eb('0x69')](_0x2e9a7c);}})[_0x64eb('0x50')](handleError(_0x3d0fd0,null));};exports[_0x64eb('0x74')]=function(_0x49af20,_0x5cbf79,_0x426137){if(_0x49af20[_0x64eb('0x54')]&&_0x49af20['file'][_0x64eb('0x56')]){_0x49af20[_0x64eb('0x51')][_0x64eb('0x5c')]=_0x49af20['file'][_0x64eb('0x56')];}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x49af20['params']['id']}})['then'](handleEntityNotFound(_0x5cbf79,null))['then'](saveUpdates(_0x49af20['body'],null))['then'](respondWithResult(_0x5cbf79,null))['catch'](handleError(_0x5cbf79,null));};var utilLicense=require(_0x64eb('0x14'));exports[_0x64eb('0x75')]=function(_0x32cdf8,_0x2d5bf5,_0x3328af){var _0x1a8f80=_0x64eb('0x59');var _0x576fe0={'custom':![]};return utilLicense[_0x64eb('0x5a')]()[_0x64eb('0x19')](function(_0x37f02d){if(_0x37f02d){_0x576fe0=_0x37f02d;}return db[_0x64eb('0x33')][_0x64eb('0x52')]({'where':{'id':_0x32cdf8[_0x64eb('0x4d')]['id']},'attributes':[_0x64eb('0x55'),'loginLogo',_0x64eb('0x5b'),_0x64eb('0x5c'),'defaultLogo',_0x64eb('0x5e'),_0x64eb('0x71'),_0x64eb('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x2d5bf5,null))[_0x64eb('0x19')](function(_0x519603){if(_0x519603){var _0x10b851=_0x519603[_0x64eb('0x5c')]&&fs[_0x64eb('0x5f')](path['join'](config['root'],_0x1a8f80,_['toLower'](_0x519603[_0x64eb('0x5c')])))?path['join'](config['root'],_0x1a8f80,_['toLower'](_0x519603[_0x64eb('0x5c')])):path[_0x64eb('0x60')](config[_0x64eb('0x62')],_0x1a8f80,_[_0x64eb('0x61')](_0x64eb('0x76')));var _0x13db07=_0x64eb('0x63')+_[_0x64eb('0x64')](_0x64eb('0x5c'));if(_0x519603[_0x13db07]||!_0x576fe0[_0x64eb('0x73')]){_0x10b851=path['join'](config['root'],_0x1a8f80,_[_0x64eb('0x61')](_0x64eb('0x76')));}if(!fs[_0x64eb('0x5f')](_0x10b851)){throw new db[(_0x64eb('0x66'))][(_0x64eb('0x67'))](_['upperFirst'](_0x64eb('0x5c'))+'\x20not\x20found');}return _0x2d5bf5[_0x64eb('0x69')](_0x10b851);}})[_0x64eb('0x50')](handleError(_0x2d5bf5,null));};exports[_0x64eb('0x77')]=function(_0x46f4e8,_0x38f1e0){var _0x6705d3={'offset':moment()['utcOffset']()};_0x6705d3['now']=moment()[_0x64eb('0x78')](_0x6705d3['offset'])[_0x64eb('0x79')](_0x64eb('0x7a'));return _0x38f1e0['status'](0xc8)[_0x64eb('0x7b')](_0x6705d3);}; \ No newline at end of file +var _0x2e0a=['show','params','body','addLogo','file','logo','filename','find','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','../../config/license/util','getLogoLogin','defaultPreferred','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','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','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','rows'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x19770a,_0x463fc6){_0x19770a=_0x19770a-0x0;var _0x22b295=_0x2e0a[_0x19770a];return _0x22b295;};'use strict';var emlformat=require(_0xa2e0('0x0'));var rimraf=require(_0xa2e0('0x1'));var zipdir=require(_0xa2e0('0x2'));var jsonpatch=require(_0xa2e0('0x3'));var rp=require(_0xa2e0('0x4'));var moment=require(_0xa2e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa2e0('0x6'));var util=require(_0xa2e0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa2e0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa2e0('0x9'));var crypto=require(_0xa2e0('0xa'));var jsforce=require(_0xa2e0('0xb'));var deskjs=require(_0xa2e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa2e0('0xd'));var Papa=require(_0xa2e0('0xe'));var Redis=require(_0xa2e0('0xf'));var authService=require(_0xa2e0('0x10'));var qs=require(_0xa2e0('0x11'));var as=require(_0xa2e0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2e0('0x13'))(_0xa2e0('0x14'));var utils=require(_0xa2e0('0x15'));var config=require(_0xa2e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2e0('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab239,_0x2d2b7e,_0x483cdd,_0x5cea98){return new BPromise(function(_0x1ed54f,_0x4bc6e6){var _0x5e8840=_0x5cea98||client;return _0x5e8840['request'](_0x2ab239,_0x483cdd)['then'](function(_0xae9f0c){logger['info'](_0xa2e0('0x18'),_0x2d2b7e,_0xa2e0('0x19'));logger[_0xa2e0('0x1a')]('Setting,\x20%s,\x20%s,\x20%s',_0x2d2b7e,_0xa2e0('0x19'),JSON[_0xa2e0('0x1b')](_0xae9f0c));if(_0xae9f0c[_0xa2e0('0x1c')]){if(_0xae9f0c[_0xa2e0('0x1c')][_0xa2e0('0x1d')]===0x1f4){logger[_0xa2e0('0x1c')](_0xa2e0('0x18'),_0x2d2b7e,_0xae9f0c['error'][_0xa2e0('0x1e')]);return _0x4bc6e6(_0xae9f0c[_0xa2e0('0x1c')][_0xa2e0('0x1e')]);}logger[_0xa2e0('0x1c')](_0xa2e0('0x18'),_0x2d2b7e,_0xae9f0c[_0xa2e0('0x1c')][_0xa2e0('0x1e')]);return _0x1ed54f(_0xae9f0c[_0xa2e0('0x1c')]['message']);}else{logger['info'](_0xa2e0('0x18'),_0x2d2b7e,_0xa2e0('0x19'));_0x1ed54f(_0xae9f0c['result'][_0xa2e0('0x1e')]);}})[_0xa2e0('0x1f')](function(_0x4b6ed8){logger['error'](_0xa2e0('0x18'),_0x2d2b7e,_0x4b6ed8);_0x4bc6e6(_0x4b6ed8);});});}function respondWithStatusCode(_0x373da3,_0x51eac9){_0x51eac9=_0x51eac9||0xcc;return function(_0x2f39c3){if(_0x2f39c3){return _0x373da3[_0xa2e0('0x20')](_0x51eac9);}return _0x373da3[_0xa2e0('0x21')](_0x51eac9)[_0xa2e0('0x22')]();};}function respondWithResult(_0x3e8415,_0x371e85){_0x371e85=_0x371e85||0xc8;return function(_0x102558){if(_0x102558){return _0x3e8415['status'](_0x371e85)[_0xa2e0('0x23')](_0x102558);}};}function respondWithFilteredResult(_0x558302,_0x35f44d){return function(_0x5b6d3b){if(_0x5b6d3b){var _0x16920f=typeof _0x35f44d['offset']===_0xa2e0('0x24')&&typeof _0x35f44d['limit']==='undefined';var _0x47cbf3=_0x5b6d3b[_0xa2e0('0x25')];var _0x292488=_0x16920f?0x0:_0x35f44d[_0xa2e0('0x26')];var _0x3dec41=_0x16920f?_0x5b6d3b['count']:_0x35f44d['offset']+_0x35f44d['limit'];var _0x1cd242;if(_0x3dec41>=_0x47cbf3){_0x3dec41=_0x47cbf3;_0x1cd242=0xc8;}else{_0x1cd242=0xce;}_0x558302[_0xa2e0('0x21')](_0x1cd242);return _0x558302[_0xa2e0('0x27')](_0xa2e0('0x28'),_0x292488+'-'+_0x3dec41+'/'+_0x47cbf3)['json'](_0x5b6d3b);}return null;};}function patchUpdates(_0x1927e9){return function(_0x40c007){try{jsonpatch[_0xa2e0('0x29')](_0x40c007,_0x1927e9,!![]);}catch(_0x2b2ca4){return BPromise['reject'](_0x2b2ca4);}return _0x40c007[_0xa2e0('0x2a')]();};}function saveUpdates(_0x549f80,_0x2957e2){return function(_0x1a94c0){if(_0x1a94c0){return _0x1a94c0[_0xa2e0('0x2b')](_0x549f80)[_0xa2e0('0x2c')](function(_0x7f1798){return _0x7f1798;});}return null;};}function removeEntity(_0x3f9c76,_0x1401a4){return function(_0x31c748){if(_0x31c748){return _0x31c748['destroy']()[_0xa2e0('0x2c')](function(){_0x3f9c76[_0xa2e0('0x21')](0xcc)[_0xa2e0('0x22')]();});}};}function handleEntityNotFound(_0x3cf812,_0x509194){return function(_0x15d4fc){if(!_0x15d4fc){_0x3cf812[_0xa2e0('0x20')](0x194);}return _0x15d4fc;};}function handleError(_0x3819ee,_0x486725){_0x486725=_0x486725||0x1f4;return function(_0x2fe4a2){logger['error'](_0x2fe4a2[_0xa2e0('0x2d')]);if(_0x2fe4a2[_0xa2e0('0x2e')]){delete _0x2fe4a2[_0xa2e0('0x2e')];}_0x3819ee[_0xa2e0('0x21')](_0x486725)[_0xa2e0('0x2f')](_0x2fe4a2);};}exports[_0xa2e0('0x30')]=function(_0x3eda29,_0x338ec7){var _0x274db3={},_0x59a21e={},_0x1caa7a={'count':0x0,'rows':[]};var _0x4f8ce5=_['map'](db[_0xa2e0('0x31')][_0xa2e0('0x32')],function(_0x5eb919){return{'name':_0x5eb919[_0xa2e0('0x33')],'type':_0x5eb919[_0xa2e0('0x34')][_0xa2e0('0x35')]};});_0x59a21e[_0xa2e0('0x36')]=_[_0xa2e0('0x37')](_0x4f8ce5,_0xa2e0('0x2e'));_0x59a21e[_0xa2e0('0x38')]=_['keys'](_0x3eda29[_0xa2e0('0x38')]);_0x59a21e[_0xa2e0('0x39')]=_[_0xa2e0('0x3a')](_0x59a21e[_0xa2e0('0x36')],_0x59a21e[_0xa2e0('0x38')]);_0x274db3[_0xa2e0('0x3b')]=_[_0xa2e0('0x3a')](_0x59a21e[_0xa2e0('0x36')],qs[_0xa2e0('0x3c')](_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x3c')]));_0x274db3['attributes']=_0x274db3[_0xa2e0('0x3b')][_0xa2e0('0x3d')]?_0x274db3['attributes']:_0x59a21e[_0xa2e0('0x36')];if(!_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x3e')]('nolimit')){_0x274db3[_0xa2e0('0x3f')]=qs[_0xa2e0('0x3f')](_0x3eda29['query'][_0xa2e0('0x3f')]);_0x274db3['offset']=qs[_0xa2e0('0x26')](_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x26')]);}_0x274db3[_0xa2e0('0x40')]=qs[_0xa2e0('0x41')](_0x3eda29['query'][_0xa2e0('0x41')]);_0x274db3['where']=qs[_0xa2e0('0x39')](_[_0xa2e0('0x42')](_0x3eda29['query'],_0x59a21e[_0xa2e0('0x39')]),_0x4f8ce5);if(_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x43')]){_0x274db3[_0xa2e0('0x44')]=_['merge'](_0x274db3[_0xa2e0('0x44')],{'$or':_['map'](_0x4f8ce5,function(_0x25eeeb){if(_0x25eeeb[_0xa2e0('0x34')]!=='VIRTUAL'){var _0x4a413c={};_0x4a413c[_0x25eeeb[_0xa2e0('0x2e')]]={'$like':'%'+_0x3eda29['query']['filter']+'%'};return _0x4a413c;}})});}_0x274db3=_[_0xa2e0('0x45')]({},_0x274db3,_0x3eda29[_0xa2e0('0x46')]);var _0x43dd83={'where':_0x274db3[_0xa2e0('0x44')]};return db[_0xa2e0('0x31')][_0xa2e0('0x25')](_0x43dd83)[_0xa2e0('0x2c')](function(_0x1260f4){_0x1caa7a[_0xa2e0('0x25')]=_0x1260f4;if(_0x3eda29['query'][_0xa2e0('0x47')]){_0x274db3['include']=[{'all':!![]}];}return db[_0xa2e0('0x31')]['findAll'](_0x274db3);})['then'](function(_0x540019){_0x1caa7a[_0xa2e0('0x48')]=_0x540019;return _0x1caa7a;})[_0xa2e0('0x2c')](respondWithFilteredResult(_0x338ec7,_0x274db3))['catch'](handleError(_0x338ec7,null));};exports[_0xa2e0('0x49')]=function(_0x13ef4c,_0x5ce143){var _0x5037f0={'raw':![],'where':{'id':_0x13ef4c[_0xa2e0('0x4a')]['id']}},_0x1bc048={};_0x1bc048[_0xa2e0('0x36')]=_['keys'](db[_0xa2e0('0x31')][_0xa2e0('0x32')]);_0x1bc048['query']=_['keys'](_0x13ef4c['query']);_0x1bc048[_0xa2e0('0x39')]=_['intersection'](_0x1bc048['model'],_0x1bc048[_0xa2e0('0x38')]);_0x5037f0[_0xa2e0('0x3b')]=_[_0xa2e0('0x3a')](_0x1bc048[_0xa2e0('0x36')],qs[_0xa2e0('0x3c')](_0x13ef4c[_0xa2e0('0x38')][_0xa2e0('0x3c')]));_0x5037f0['attributes']=_0x5037f0[_0xa2e0('0x3b')]['length']?_0x5037f0[_0xa2e0('0x3b')]:_0x1bc048[_0xa2e0('0x36')];if(_0x13ef4c[_0xa2e0('0x38')][_0xa2e0('0x47')]){_0x5037f0['include']=[{'all':!![]}];}_0x5037f0=_[_0xa2e0('0x45')]({},_0x5037f0,_0x13ef4c[_0xa2e0('0x46')]);return db['Setting']['find'](_0x5037f0)[_0xa2e0('0x2c')](handleEntityNotFound(_0x5ce143,null))['then'](respondWithResult(_0x5ce143,null))['catch'](handleError(_0x5ce143,null));};exports[_0xa2e0('0x2b')]=function(_0x52aa69,_0x3a4b75){if(_0x52aa69[_0xa2e0('0x4b')]['id']){delete _0x52aa69['body']['id'];}return db[_0xa2e0('0x31')]['find']({'where':{'id':_0x52aa69['params']['id']}})['then'](handleEntityNotFound(_0x3a4b75,null))[_0xa2e0('0x2c')](saveUpdates(_0x52aa69[_0xa2e0('0x4b')],null))[_0xa2e0('0x2c')](respondWithResult(_0x3a4b75,null))[_0xa2e0('0x1f')](handleError(_0x3a4b75,null));};exports[_0xa2e0('0x4c')]=function(_0x14d1e5,_0x10071b,_0x22d4a6){if(_0x14d1e5[_0xa2e0('0x4d')]&&_0x14d1e5[_0xa2e0('0x4d')]['filename']){_0x14d1e5['body'][_0xa2e0('0x4e')]=_0x14d1e5[_0xa2e0('0x4d')][_0xa2e0('0x4f')];}return db[_0xa2e0('0x31')][_0xa2e0('0x50')]({'where':{'id':_0x14d1e5[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x10071b,null))[_0xa2e0('0x2c')](saveUpdates(_0x14d1e5[_0xa2e0('0x4b')],null))['then'](respondWithResult(_0x10071b,null))[_0xa2e0('0x1f')](handleError(_0x10071b,null));};exports[_0xa2e0('0x51')]=function(_0x17aa9b,_0x1bd413,_0x22b593){if(_0x17aa9b[_0xa2e0('0x4d')]&&_0x17aa9b[_0xa2e0('0x4d')][_0xa2e0('0x4f')]){_0x17aa9b[_0xa2e0('0x4b')][_0xa2e0('0x52')]=_0x17aa9b[_0xa2e0('0x4d')][_0xa2e0('0x4f')];}return db['Setting']['find']({'where':{'id':_0x17aa9b[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x1bd413,null))[_0xa2e0('0x2c')](saveUpdates(_0x17aa9b['body'],null))[_0xa2e0('0x2c')](respondWithResult(_0x1bd413,null))[_0xa2e0('0x1f')](handleError(_0x1bd413,null));};var utilLicense=require('../../config/license/util');exports[_0xa2e0('0x53')]=function(_0x3b7579,_0x4d4be6,_0xf2d292){var _0x1d4b76=_0xa2e0('0x54');var _0x1b09c5={'custom':![]};return utilLicense[_0xa2e0('0x55')]()[_0xa2e0('0x2c')](function(_0xa47463){if(_0xa47463){_0x1b09c5=_0xa47463;}return db[_0xa2e0('0x31')][_0xa2e0('0x50')]({'where':{'id':_0x3b7579[_0xa2e0('0x4a')]['id']},'attributes':[_0xa2e0('0x4e'),_0xa2e0('0x52'),_0xa2e0('0x56'),_0xa2e0('0x57'),_0xa2e0('0x58'),_0xa2e0('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0x4d4be6,null))[_0xa2e0('0x2c')](function(_0x2f46c9){if(_0x2f46c9){var _0x343628=_0x2f46c9[_0xa2e0('0x4e')]&&fs[_0xa2e0('0x5a')](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1d4b76,_[_0xa2e0('0x5d')](_0x2f46c9[_0xa2e0('0x4e')])))?path['join'](config[_0xa2e0('0x5c')],_0x1d4b76,_[_0xa2e0('0x5d')](_0x2f46c9['logo'])):path[_0xa2e0('0x5b')](config['root'],_0x1d4b76,_['toLower']('default_logo.svg'));var _0x361497=_0xa2e0('0x5e')+_['upperFirst'](_0xa2e0('0x4e'));if(_0x2f46c9[_0x361497]||!_0x1b09c5[_0xa2e0('0x5f')]){_0x343628=path[_0xa2e0('0x5b')](config['root'],_0x1d4b76,_['toLower'](_0xa2e0('0x60')));}if(!fs[_0xa2e0('0x5a')](_0x343628)){throw new db[(_0xa2e0('0x61'))][(_0xa2e0('0x62'))](_[_0xa2e0('0x63')](_0xa2e0('0x4e'))+_0xa2e0('0x64'));}return _0x4d4be6['download'](_0x343628);}})[_0xa2e0('0x1f')](handleError(_0x4d4be6,null));};var utilLicense=require(_0xa2e0('0x65'));exports[_0xa2e0('0x66')]=function(_0xbc5d8,_0x42a3b3,_0x5a7ef9){var _0x1bfc40=_0xa2e0('0x54');var _0x37fef2={'custom':![]};return utilLicense[_0xa2e0('0x55')]()['then'](function(_0x13ef52){if(_0x13ef52){_0x37fef2=_0x13ef52;}return db[_0xa2e0('0x31')]['find']({'where':{'id':_0xbc5d8[_0xa2e0('0x4a')]['id']},'attributes':[_0xa2e0('0x4e'),_0xa2e0('0x52'),_0xa2e0('0x56'),'favicon',_0xa2e0('0x58'),'defaultLoginLogo',_0xa2e0('0x67'),'defaultFavicon'],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0x42a3b3,null))[_0xa2e0('0x2c')](function(_0x474f29){if(_0x474f29){var _0x5a7d3a=_0x474f29[_0xa2e0('0x52')]&&fs[_0xa2e0('0x5a')](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_['toLower'](_0x474f29['loginLogo'])))?path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_[_0xa2e0('0x5d')](_0x474f29[_0xa2e0('0x52')])):path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_['toLower'](_0xa2e0('0x68')));var _0x53bccf='default'+_[_0xa2e0('0x63')](_0xa2e0('0x52'));if(_0x474f29[_0x53bccf]||!_0x37fef2[_0xa2e0('0x5f')]){_0x5a7d3a=path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_['toLower'](_0xa2e0('0x68')));}if(!fs[_0xa2e0('0x5a')](_0x5a7d3a)){throw new db['Sequelize'][(_0xa2e0('0x62'))](_[_0xa2e0('0x63')]('loginLogo')+'\x20not\x20found');}return _0x42a3b3[_0xa2e0('0x69')](_0x5a7d3a);}})[_0xa2e0('0x1f')](handleError(_0x42a3b3,null));};exports[_0xa2e0('0x6a')]=function(_0x296f03,_0x1f1d39){return db['Setting'][_0xa2e0('0x50')]({'where':{'id':_0x296f03['params']['id']},'attributes':[_0xa2e0('0x6b')]})['then'](respondWithResult(_0x1f1d39,null))['catch'](handleError(_0x1f1d39,null));};exports[_0xa2e0('0x6c')]=function(_0x1b860c,_0x277993,_0x3c75dc){if(_0x1b860c['file']&&_0x1b860c[_0xa2e0('0x4d')][_0xa2e0('0x4f')]){_0x1b860c[_0xa2e0('0x4b')][_0xa2e0('0x56')]=_0x1b860c['file'][_0xa2e0('0x4f')];}return db[_0xa2e0('0x31')][_0xa2e0('0x50')]({'where':{'id':_0x1b860c[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x277993,null))[_0xa2e0('0x2c')](saveUpdates(_0x1b860c[_0xa2e0('0x4b')],null))[_0xa2e0('0x2c')](respondWithResult(_0x277993,null))[_0xa2e0('0x1f')](handleError(_0x277993,null));};var utilLicense=require(_0xa2e0('0x65'));exports[_0xa2e0('0x6d')]=function(_0x2521bd,_0x3968d9,_0x1d73a1){var _0xde2f76=_0xa2e0('0x54');var _0x25863f={'custom':![]};return utilLicense[_0xa2e0('0x55')]()['then'](function(_0x594108){if(_0x594108){_0x25863f=_0x594108;}return db['Setting'][_0xa2e0('0x50')]({'where':{'id':_0x2521bd[_0xa2e0('0x4a')]['id']},'attributes':[_0xa2e0('0x4e'),_0xa2e0('0x52'),'preferred',_0xa2e0('0x57'),'defaultLogo',_0xa2e0('0x59'),_0xa2e0('0x67'),_0xa2e0('0x6e')],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0x3968d9,null))['then'](function(_0x4629f1){if(_0x4629f1){var _0x4bf10d=_0x4629f1[_0xa2e0('0x56')]&&fs['existsSync'](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')](_0x4629f1[_0xa2e0('0x56')])))?path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')](_0x4629f1[_0xa2e0('0x56')])):path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')]('default_preferred.png'));var _0x11fefa='default'+_['upperFirst'](_0xa2e0('0x56'));if(_0x4629f1[_0x11fefa]||!_0x25863f[_0xa2e0('0x5f')]||!_0x25863f[_0xa2e0('0x56')]){_0x4bf10d=path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')](_0xa2e0('0x6f')));}if(!fs[_0xa2e0('0x5a')](_0x4bf10d)){throw new db[(_0xa2e0('0x61'))][(_0xa2e0('0x62'))](_[_0xa2e0('0x63')](_0xa2e0('0x56'))+_0xa2e0('0x64'));}return _0x3968d9[_0xa2e0('0x69')](_0x4bf10d);}})[_0xa2e0('0x1f')](handleError(_0x3968d9,null));};exports[_0xa2e0('0x70')]=function(_0x4fe81a,_0x24f23d,_0x41b624){if(_0x4fe81a[_0xa2e0('0x4d')]&&_0x4fe81a[_0xa2e0('0x4d')][_0xa2e0('0x4f')]){_0x4fe81a[_0xa2e0('0x4b')][_0xa2e0('0x57')]=_0x4fe81a['file'][_0xa2e0('0x4f')];}return db['Setting']['find']({'where':{'id':_0x4fe81a[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x24f23d,null))[_0xa2e0('0x2c')](saveUpdates(_0x4fe81a[_0xa2e0('0x4b')],null))['then'](respondWithResult(_0x24f23d,null))['catch'](handleError(_0x24f23d,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x598746,_0xd6718f,_0x58f915){var _0x26fbce=_0xa2e0('0x54');var _0x2deb4d={'custom':![]};return utilLicense[_0xa2e0('0x55')]()[_0xa2e0('0x2c')](function(_0xf2d5d8){if(_0xf2d5d8){_0x2deb4d=_0xf2d5d8;}return db['Setting'][_0xa2e0('0x50')]({'where':{'id':_0x598746[_0xa2e0('0x4a')]['id']},'attributes':['logo',_0xa2e0('0x52'),_0xa2e0('0x56'),_0xa2e0('0x57'),'defaultLogo',_0xa2e0('0x59'),'defaultPreferred',_0xa2e0('0x6e')],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0xd6718f,null))['then'](function(_0x1d2483){if(_0x1d2483){var _0x3a9e5b=_0x1d2483[_0xa2e0('0x57')]&&fs[_0xa2e0('0x5a')](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x26fbce,_['toLower'](_0x1d2483[_0xa2e0('0x57')])))?path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x26fbce,_['toLower'](_0x1d2483[_0xa2e0('0x57')])):path[_0xa2e0('0x5b')](config['root'],_0x26fbce,_[_0xa2e0('0x5d')](_0xa2e0('0x71')));var _0x2167ae='default'+_[_0xa2e0('0x63')](_0xa2e0('0x57'));if(_0x1d2483[_0x2167ae]||!_0x2deb4d[_0xa2e0('0x5f')]){_0x3a9e5b=path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x26fbce,_[_0xa2e0('0x5d')](_0xa2e0('0x71')));}if(!fs[_0xa2e0('0x5a')](_0x3a9e5b)){throw new db['Sequelize'][(_0xa2e0('0x62'))](_['upperFirst'](_0xa2e0('0x57'))+_0xa2e0('0x64'));}return _0xd6718f[_0xa2e0('0x69')](_0x3a9e5b);}})[_0xa2e0('0x1f')](handleError(_0xd6718f,null));};exports['getDate']=function(_0x3394c5,_0x4475ca){var _0x23d7f0={'offset':moment()[_0xa2e0('0x72')]()};_0x23d7f0[_0xa2e0('0x73')]=moment()[_0xa2e0('0x72')](_0x23d7f0[_0xa2e0('0x26')])[_0xa2e0('0x74')](_0xa2e0('0x75'));return _0x4475ca[_0xa2e0('0x21')](0xc8)[_0xa2e0('0x2f')](_0x23d7f0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c51b602..796dd30 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x55ca,0x126));var _0xa55c=function(_0x309b09,_0xe4c181){_0x309b09=_0x309b09-0x0;var _0x7b38d7=_0x55ca[_0x309b09];return _0x7b38d7;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1a1c9e,_0x45c857){var _0x1e4125=function(_0x4b9811){while(--_0x4b9811){_0x1a1c9e['push'](_0x1a1c9e['shift']());}};_0x1e4125(++_0x45c857);}(_0xe14b,0x93));var _0xbe14=function(_0x444562,_0x37a025){_0x444562=_0x444562-0x0;var _0x229872=_0xe14b[_0x444562];return _0x229872;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 71d9d52..2b7a972 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 _0x4d4f=['then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','ShowSetting','find','options','where','include','model','attributes','map','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x9d4439,_0xd292b5){var _0xcc23ed=function(_0x473b5e){while(--_0x473b5e){_0x9d4439['push'](_0x9d4439['shift']());}};_0xcc23ed(++_0xd292b5);}(_0x4d4f,0x1e2));var _0xf4d4=function(_0x3d2ec1,_0x46360d){_0x3d2ec1=_0x3d2ec1-0x0;var _0x3a026a=_0x4d4f[_0x3d2ec1];return _0x3a026a;};'use strict';var _=require(_0xf4d4('0x0'));var util=require(_0xf4d4('0x1'));var moment=require(_0xf4d4('0x2'));var BPromise=require(_0xf4d4('0x3'));var rs=require(_0xf4d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4d4('0x5'))['db'];var utils=require(_0xf4d4('0x6'));var logger=require(_0xf4d4('0x7'))(_0xf4d4('0x8'));var config=require(_0xf4d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf4d4('0xa')][_0xf4d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fb4a7,_0x480b46,_0x197ffc){return new BPromise(function(_0x567215,_0x249314){return client[_0xf4d4('0xc')](_0x2fb4a7,_0x197ffc)[_0xf4d4('0xd')](function(_0x39f9f5){logger[_0xf4d4('0xe')]('Setting,\x20%s,\x20%s',_0x480b46,_0xf4d4('0xf'));logger[_0xf4d4('0x10')](_0xf4d4('0x11'),_0x480b46,'request\x20sent',JSON[_0xf4d4('0x12')](_0x39f9f5));if(_0x39f9f5[_0xf4d4('0x13')]){if(_0x39f9f5[_0xf4d4('0x13')][_0xf4d4('0x14')]===0x1f4){logger[_0xf4d4('0x13')]('Setting,\x20%s,\x20%s',_0x480b46,_0x39f9f5[_0xf4d4('0x13')][_0xf4d4('0x15')]);return _0x249314(_0x39f9f5[_0xf4d4('0x13')]['message']);}logger['error'](_0xf4d4('0x16'),_0x480b46,_0x39f9f5[_0xf4d4('0x13')][_0xf4d4('0x15')]);return _0x567215(_0x39f9f5[_0xf4d4('0x13')][_0xf4d4('0x15')]);}else{logger[_0xf4d4('0xe')](_0xf4d4('0x16'),_0x480b46,_0xf4d4('0xf'));_0x567215(_0x39f9f5[_0xf4d4('0x17')][_0xf4d4('0x15')]);}})['catch'](function(_0x3171be){logger[_0xf4d4('0x13')](_0xf4d4('0x16'),_0x480b46,_0x3171be);_0x249314(_0x3171be);});});}exports[_0xf4d4('0x18')]=function(_0x2a45da){var _0x1171f8=this;return new Promise(function(_0x1e6aef,_0x5c8048){return db['Setting'][_0xf4d4('0x19')]({'raw':_0x2a45da[_0xf4d4('0x1a')]?_0x2a45da[_0xf4d4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2a45da['options']?_0x2a45da[_0xf4d4('0x1a')][_0xf4d4('0x1b')]||null:null,'attributes':_0x2a45da[_0xf4d4('0x1a')]?_0x2a45da['options']['attributes']||null:null,'include':_0x2a45da[_0xf4d4('0x1a')]?_0x2a45da['options'][_0xf4d4('0x1c')]?_['map'](_0x2a45da['options'][_0xf4d4('0x1c')],function(_0x198937){return{'model':db[_0x198937[_0xf4d4('0x1d')]],'as':_0x198937['as'],'attributes':_0x198937[_0xf4d4('0x1e')],'include':_0x198937[_0xf4d4('0x1c')]?_[_0xf4d4('0x1f')](_0x198937['include'],function(_0x299dd2){return{'model':db[_0x299dd2[_0xf4d4('0x1d')]],'as':_0x299dd2['as'],'attributes':_0x299dd2['attributes'],'include':_0x299dd2[_0xf4d4('0x1c')]?_[_0xf4d4('0x1f')](_0x299dd2[_0xf4d4('0x1c')],function(_0x24a917){return{'model':db[_0x24a917[_0xf4d4('0x1d')]],'as':_0x24a917['as'],'attributes':_0x24a917[_0xf4d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf4d4('0xd')](function(_0x18de93){logger[_0xf4d4('0xe')](_0xf4d4('0x18'),_0x2a45da);logger[_0xf4d4('0x10')](_0xf4d4('0x18'),_0x2a45da,JSON[_0xf4d4('0x12')](_0x18de93));_0x1e6aef(_0x18de93);})[_0xf4d4('0x20')](function(_0x4aa6cf){logger[_0xf4d4('0x13')](_0xf4d4('0x18'),_0x4aa6cf[_0xf4d4('0x15')],_0x2a45da);_0x5c8048(_0x1171f8['error'](0x1f4,_0x4aa6cf['message']));});});}; \ No newline at end of file +var _0x4ada=['map','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','options','raw','where','attributes','include','model'];(function(_0x378841,_0x2998e6){var _0x192cce=function(_0xf62ce8){while(--_0xf62ce8){_0x378841['push'](_0x378841['shift']());}};_0x192cce(++_0x2998e6);}(_0x4ada,0xfb));var _0xa4ad=function(_0x2a08ad,_0xc2ee20){_0x2a08ad=_0x2a08ad-0x0;var _0x4050c1=_0x4ada[_0x2a08ad];return _0x4050c1;};'use strict';var _=require(_0xa4ad('0x0'));var util=require(_0xa4ad('0x1'));var moment=require(_0xa4ad('0x2'));var BPromise=require(_0xa4ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4ad('0x4'));var db=require(_0xa4ad('0x5'))['db'];var utils=require(_0xa4ad('0x6'));var logger=require(_0xa4ad('0x7'))(_0xa4ad('0x8'));var config=require(_0xa4ad('0x9'));var jayson=require(_0xa4ad('0xa'));var client=jayson['client'][_0xa4ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10885b,_0x980449,_0x484b16){return new BPromise(function(_0x356711,_0x4bcfcd){return client['request'](_0x10885b,_0x484b16)['then'](function(_0x39c9b3){logger[_0xa4ad('0xc')](_0xa4ad('0xd'),_0x980449,_0xa4ad('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x980449,_0xa4ad('0xe'),JSON[_0xa4ad('0xf')](_0x39c9b3));if(_0x39c9b3[_0xa4ad('0x10')]){if(_0x39c9b3['error'][_0xa4ad('0x11')]===0x1f4){logger['error'](_0xa4ad('0xd'),_0x980449,_0x39c9b3[_0xa4ad('0x10')][_0xa4ad('0x12')]);return _0x4bcfcd(_0x39c9b3[_0xa4ad('0x10')]['message']);}logger[_0xa4ad('0x10')](_0xa4ad('0xd'),_0x980449,_0x39c9b3[_0xa4ad('0x10')]['message']);return _0x356711(_0x39c9b3[_0xa4ad('0x10')][_0xa4ad('0x12')]);}else{logger[_0xa4ad('0xc')]('Setting,\x20%s,\x20%s',_0x980449,_0xa4ad('0xe'));_0x356711(_0x39c9b3[_0xa4ad('0x13')][_0xa4ad('0x12')]);}})[_0xa4ad('0x14')](function(_0x7273a7){logger[_0xa4ad('0x10')]('Setting,\x20%s,\x20%s',_0x980449,_0x7273a7);_0x4bcfcd(_0x7273a7);});});}exports[_0xa4ad('0x15')]=function(_0x32da3b){var _0x126fe3=this;return new Promise(function(_0x103373,_0xaaf7c6){return db['Setting']['find']({'raw':_0x32da3b[_0xa4ad('0x16')]?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x17')]===undefined?!![]:![]:!![],'where':_0x32da3b['options']?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x18')]||null:null,'attributes':_0x32da3b[_0xa4ad('0x16')]?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x19')]||null:null,'include':_0x32da3b[_0xa4ad('0x16')]?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x1a')]?_['map'](_0x32da3b['options'][_0xa4ad('0x1a')],function(_0x4ac3ac){return{'model':db[_0x4ac3ac[_0xa4ad('0x1b')]],'as':_0x4ac3ac['as'],'attributes':_0x4ac3ac[_0xa4ad('0x19')],'include':_0x4ac3ac[_0xa4ad('0x1a')]?_[_0xa4ad('0x1c')](_0x4ac3ac[_0xa4ad('0x1a')],function(_0x5d59ae){return{'model':db[_0x5d59ae['model']],'as':_0x5d59ae['as'],'attributes':_0x5d59ae[_0xa4ad('0x19')],'include':_0x5d59ae['include']?_['map'](_0x5d59ae['include'],function(_0x169079){return{'model':db[_0x169079[_0xa4ad('0x1b')]],'as':_0x169079['as'],'attributes':_0x169079[_0xa4ad('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa4ad('0x1d')](function(_0x13565f){logger[_0xa4ad('0xc')]('ShowSetting',_0x32da3b);logger[_0xa4ad('0x1e')]('ShowSetting',_0x32da3b,JSON['stringify'](_0x13565f));_0x103373(_0x13565f);})['catch'](function(_0x4a74ce){logger[_0xa4ad('0x10')](_0xa4ad('0x15'),_0x4a74ce[_0xa4ad('0x12')],_0x32da3b);_0xaaf7c6(_0x126fe3[_0xa4ad('0x10')](0x1f4,_0x4a74ce['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d5dc966..cd82ec2 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x192f26,_0x30c21f){var _0x9631ad=function(_0x414346){while(--_0x414346){_0x192f26['push'](_0x192f26['shift']());}};_0x9631ad(++_0x30c21f);}(_0x7a54,0x106));var _0x47a5=function(_0x1e5983,_0x415012){_0x1e5983=_0x1e5983-0x0;var _0x1ee4e2=_0x7a54[_0x1e5983];return _0x1ee4e2;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x47c9d1,_0x2bb28c){var _0x5d54f3=function(_0x3352c6){while(--_0x3352c6){_0x47c9d1['push'](_0x47c9d1['shift']());}};_0x5d54f3(++_0x2bb28c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f00561c..d5c42c1 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 _0x834c=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER'];(function(_0x5cbf61,_0x572128){var _0x30680a=function(_0x19faba){while(--_0x19faba){_0x5cbf61['push'](_0x5cbf61['shift']());}};_0x30680a(++_0x572128);}(_0x834c,0x109));var _0xc834=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x834c[_0x4e90e3];return _0x295e5b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xc834('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc834('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xc834('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc834('0x2')],'defaultValue':function(){return rs[_0xc834('0x3')]();}},'phone':{'type':Sequelize[_0xc834('0x2')]},'type':{'type':Sequelize[_0xc834('0x4')](_0xc834('0x5'),_0xc834('0x6'),_0xc834('0x7'),'clicksend','plivo',_0xc834('0x8'),_0xc834('0x9'),_0xc834('0xa'),_0xc834('0xb'),_0xc834('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc834('0x2')]},'password':{'type':Sequelize[_0xc834('0x2')]},'apiKey':{'type':Sequelize[_0xc834('0x2')]},'applicationId':{'type':Sequelize[_0xc834('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xc834('0x2')]},'deliveryReport':{'type':Sequelize[_0xc834('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xc834('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc834('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc834('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc834('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc834('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc834('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc834('0xe')],'comment':_0xc834('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xc834('0xd')],'defaultValue':![],'comment':_0xc834('0x10'),'set':function(_0x5148c2){if(!_0x5148c2)this[_0xc834('0x11')](_0xc834('0x12'),null);this[_0xc834('0x11')](_0xc834('0x13'),_0x5148c2);}}}; \ No newline at end of file +var _0x5ebc=['STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','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','randomstring','exports'];(function(_0x5b4716,_0x4b7a3b){var _0xd1fcf3=function(_0x2a8410){while(--_0x2a8410){_0x5b4716['push'](_0x5b4716['shift']());}};_0xd1fcf3(++_0x4b7a3b);}(_0x5ebc,0xe4));var _0xc5eb=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5ebc[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc5eb('0x0'));module[_0xc5eb('0x1')]={'name':{'type':Sequelize[_0xc5eb('0x2')],'unique':_0xc5eb('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc5eb('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc5eb('0x2')],'defaultValue':function(){return rs[_0xc5eb('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc5eb('0x5')](_0xc5eb('0x6'),'skebby',_0xc5eb('0x7'),_0xc5eb('0x8'),_0xc5eb('0x9'),_0xc5eb('0xa'),_0xc5eb('0xb'),_0xc5eb('0xc'),_0xc5eb('0xd'),_0xc5eb('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xc5eb('0x2')]},'authToken':{'type':Sequelize[_0xc5eb('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc5eb('0x2')]},'password':{'type':Sequelize[_0xc5eb('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xc5eb('0x2')]},'accountId':{'type':Sequelize[_0xc5eb('0x2')]},'senderString':{'type':Sequelize[_0xc5eb('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc5eb('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc5eb('0xf')],'defaultValue':function(){return _0xc5eb('0x10');}},'notificationSound':{'type':Sequelize[_0xc5eb('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc5eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc5eb('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc5eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc5eb('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5eb('0x12')],'comment':_0xc5eb('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc5eb('0x14'),'set':function(_0x2a9f5e){if(!_0x2a9f5e)this[_0xc5eb('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xc5eb('0x16'),_0x2a9f5e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6ba18ec..5631326 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 _0x07fa=['push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','queueId','SmsQueue','unshift','queue','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','priority','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','defaults','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','csc','message-id','state','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','save','update','destroy','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','ListId','mobile','from','Body','messageId','MessageSid','sender','text','plivo','From','Text','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x07fa,0x132));var _0xa07f=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x07fa[_0x176329];return _0x31997c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa07f('0x0'));var zipdir=require(_0xa07f('0x1'));var jsonpatch=require(_0xa07f('0x2'));var rp=require('request-promise');var moment=require(_0xa07f('0x3'));var BPromise=require(_0xa07f('0x4'));var Mustache=require(_0xa07f('0x5'));var util=require(_0xa07f('0x6'));var path=require(_0xa07f('0x7'));var sox=require(_0xa07f('0x8'));var csv=require(_0xa07f('0x9'));var ejs=require(_0xa07f('0xa'));var fs=require('fs');var fs_extra=require(_0xa07f('0xb'));var _=require(_0xa07f('0xc'));var squel=require(_0xa07f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa07f('0xe'));var toCsv=require(_0xa07f('0x9'));var querystring=require('querystring');var Papa=require(_0xa07f('0xf'));var Redis=require(_0xa07f('0x10'));var authService=require(_0xa07f('0x11'));var qs=require(_0xa07f('0x12'));var as=require(_0xa07f('0x13'));var hardwareService=require(_0xa07f('0x14'));var logger=require(_0xa07f('0x15'))(_0xa07f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa07f('0x17'));var db=require(_0xa07f('0x18'))['db'];config['redis']=_['defaults'](config[_0xa07f('0x19')],{'host':_0xa07f('0x1a'),'port':0x18eb});var socket=require(_0xa07f('0x1b'))(new Redis(config['redis']));require(_0xa07f('0x1c'))['register'](socket);var jayson=require(_0xa07f('0x1d'));var client=jayson[_0xa07f('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x359db5,_0x48d40a,_0x313534,_0x117f29){return new BPromise(function(_0x5677aa,_0x3263ee){var _0x4c8708=_0x117f29||client;return _0x4c8708[_0xa07f('0x1f')](_0x359db5,_0x313534)[_0xa07f('0x20')](function(_0xbceb90){logger[_0xa07f('0x21')](_0xa07f('0x22'),_0x48d40a,_0xa07f('0x23'));logger[_0xa07f('0x24')](_0xa07f('0x25'),_0x48d40a,_0xa07f('0x23'),JSON['stringify'](_0xbceb90));if(_0xbceb90['error']){if(_0xbceb90[_0xa07f('0x26')]['code']===0x1f4){logger[_0xa07f('0x26')]('SmsAccount,\x20%s,\x20%s',_0x48d40a,_0xbceb90['error'][_0xa07f('0x27')]);return _0x3263ee(_0xbceb90[_0xa07f('0x26')]['message']);}logger[_0xa07f('0x26')](_0xa07f('0x22'),_0x48d40a,_0xbceb90['error'][_0xa07f('0x27')]);return _0x5677aa(_0xbceb90['error'][_0xa07f('0x27')]);}else{logger[_0xa07f('0x21')]('SmsAccount,\x20%s,\x20%s',_0x48d40a,_0xa07f('0x23'));_0x5677aa(_0xbceb90[_0xa07f('0x28')][_0xa07f('0x27')]);}})[_0xa07f('0x29')](function(_0x3e565e){logger[_0xa07f('0x26')](_0xa07f('0x22'),_0x48d40a,_0x3e565e);_0x3263ee(_0x3e565e);});});}function respondWithStatusCode(_0x376171,_0xdd19a3){_0xdd19a3=_0xdd19a3||0xcc;return function(_0x21fcd8){if(_0x21fcd8){return _0x376171[_0xa07f('0x2a')](_0xdd19a3);}return _0x376171['status'](_0xdd19a3)[_0xa07f('0x2b')]();};}function respondWithResult(_0x5d2c96,_0x25575b){_0x25575b=_0x25575b||0xc8;return function(_0x4627e9){if(_0x4627e9){return _0x5d2c96[_0xa07f('0x2c')](_0x25575b)[_0xa07f('0x2d')](_0x4627e9);}};}function respondWithFilteredResult(_0x3aac51,_0x11d9c7){return function(_0x28fc9f){if(_0x28fc9f){var _0x2d00e7=typeof _0x11d9c7['offset']==='undefined'&&typeof _0x11d9c7[_0xa07f('0x2e')]==='undefined';var _0x5eefb7=_0x28fc9f[_0xa07f('0x2f')];var _0x5d34f4=_0x2d00e7?0x0:_0x11d9c7[_0xa07f('0x30')];var _0x50d611=_0x2d00e7?_0x28fc9f[_0xa07f('0x2f')]:_0x11d9c7['offset']+_0x11d9c7[_0xa07f('0x2e')];var _0x28eaa7;if(_0x50d611>=_0x5eefb7){_0x50d611=_0x5eefb7;_0x28eaa7=0xc8;}else{_0x28eaa7=0xce;}_0x3aac51[_0xa07f('0x2c')](_0x28eaa7);return _0x3aac51[_0xa07f('0x31')](_0xa07f('0x32'),_0x5d34f4+'-'+_0x50d611+'/'+_0x5eefb7)[_0xa07f('0x2d')](_0x28fc9f);}return null;};}function patchUpdates(_0x586b92){return function(_0x181e97){try{jsonpatch[_0xa07f('0x33')](_0x181e97,_0x586b92,!![]);}catch(_0x1e431e){return BPromise['reject'](_0x1e431e);}return _0x181e97[_0xa07f('0x34')]();};}function saveUpdates(_0x486e3e,_0x6d07d7){return function(_0xe903a5){if(_0xe903a5){return _0xe903a5[_0xa07f('0x35')](_0x486e3e)[_0xa07f('0x20')](function(_0x109b48){return _0x109b48;});}return null;};}function removeEntity(_0x5e5ae3,_0x553219){return function(_0x41dc54){if(_0x41dc54){return _0x41dc54[_0xa07f('0x36')]()[_0xa07f('0x20')](function(){var _0x35bd14=_0x41dc54['get']({'plain':!![]});var _0x2c4202=_0xa07f('0x37');return db[_0xa07f('0x38')][_0xa07f('0x36')]({'where':{'type':_0x2c4202,'resourceId':_0x35bd14['id']}})['then'](function(){return _0x41dc54;});})[_0xa07f('0x20')](function(){_0x5e5ae3[_0xa07f('0x2c')](0xcc)[_0xa07f('0x2b')]();});}};}function handleEntityNotFound(_0x5dd37b,_0x57f41c){return function(_0x39048f){if(!_0x39048f){_0x5dd37b[_0xa07f('0x2a')](0x194);}return _0x39048f;};}function handleError(_0x5271fc,_0x446a9a){_0x446a9a=_0x446a9a||0x1f4;return function(_0x3a19f6){logger['error'](_0x3a19f6['stack']);if(_0x3a19f6[_0xa07f('0x39')]){delete _0x3a19f6[_0xa07f('0x39')];}_0x5271fc[_0xa07f('0x2c')](_0x446a9a)[_0xa07f('0x3a')](_0x3a19f6);};}exports['index']=function(_0x2da37e,_0x5409d7){var _0x46ce47={'include':[{'model':db[_0xa07f('0x3b')],'as':_0xa07f('0x3c')}]},_0x1fbc42={},_0x3df883={'count':0x0,'rows':[]};var _0x407236=_[_0xa07f('0x3d')](db[_0xa07f('0x3e')][_0xa07f('0x3f')],function(_0x2608a6){return{'name':_0x2608a6[_0xa07f('0x40')],'type':_0x2608a6[_0xa07f('0x41')][_0xa07f('0x42')]};});_0x1fbc42[_0xa07f('0x43')]=_[_0xa07f('0x3d')](_0x407236,_0xa07f('0x39'));_0x1fbc42[_0xa07f('0x44')]=_[_0xa07f('0x45')](_0x2da37e[_0xa07f('0x44')]);_0x1fbc42[_0xa07f('0x46')]=_[_0xa07f('0x47')](_0x1fbc42[_0xa07f('0x43')],_0x1fbc42[_0xa07f('0x44')]);_0x46ce47['attributes']=_['intersection'](_0x1fbc42[_0xa07f('0x43')],qs[_0xa07f('0x48')](_0x2da37e[_0xa07f('0x44')][_0xa07f('0x48')]));_0x46ce47['attributes']=_0x46ce47['attributes'][_0xa07f('0x49')]?_0x46ce47[_0xa07f('0x4a')]:_0x1fbc42[_0xa07f('0x43')];if(!_0x2da37e[_0xa07f('0x44')][_0xa07f('0x4b')](_0xa07f('0x4c'))){_0x46ce47[_0xa07f('0x2e')]=qs[_0xa07f('0x2e')](_0x2da37e['query'][_0xa07f('0x2e')]);_0x46ce47[_0xa07f('0x30')]=qs[_0xa07f('0x30')](_0x2da37e[_0xa07f('0x44')][_0xa07f('0x30')]);}_0x46ce47[_0xa07f('0x4d')]=qs[_0xa07f('0x4e')](_0x2da37e['query'][_0xa07f('0x4e')]);_0x46ce47[_0xa07f('0x4f')]=qs[_0xa07f('0x46')](_[_0xa07f('0x50')](_0x2da37e[_0xa07f('0x44')],_0x1fbc42[_0xa07f('0x46')]),_0x407236);if(_0x2da37e[_0xa07f('0x44')][_0xa07f('0x51')]){_0x46ce47[_0xa07f('0x4f')]=_[_0xa07f('0x52')](_0x46ce47['where'],{'$or':_[_0xa07f('0x3d')](_0x407236,function(_0xefd0f3){if(_0xefd0f3[_0xa07f('0x41')]!=='VIRTUAL'){var _0x3f3eca={};_0x3f3eca[_0xefd0f3[_0xa07f('0x39')]]={'$like':'%'+_0x2da37e[_0xa07f('0x44')][_0xa07f('0x51')]+'%'};return _0x3f3eca;}})});}_0x46ce47=_['merge']({},_0x46ce47,_0x2da37e[_0xa07f('0x53')]);var _0x530f22={'where':_0x46ce47['where']};return db[_0xa07f('0x3e')][_0xa07f('0x2f')](_0x530f22)[_0xa07f('0x20')](function(_0x59d622){_0x3df883[_0xa07f('0x2f')]=_0x59d622;if(_0x2da37e['query'][_0xa07f('0x54')]){_0x46ce47['include']=[{'all':!![]}];}return db[_0xa07f('0x3e')][_0xa07f('0x55')](_0x46ce47);})[_0xa07f('0x20')](function(_0x50e058){_0x3df883[_0xa07f('0x56')]=_0x50e058;return _0x3df883;})[_0xa07f('0x20')](respondWithFilteredResult(_0x5409d7,_0x46ce47))[_0xa07f('0x29')](handleError(_0x5409d7,null));};exports[_0xa07f('0x57')]=function(_0x28aa18,_0x366570){var _0x4614f3={'raw':![],'where':{'id':_0x28aa18[_0xa07f('0x58')]['id']},'include':[{'model':db[_0xa07f('0x3b')],'as':'mandatoryDispositionPause'}]},_0xba67ee={};_0xba67ee[_0xa07f('0x43')]=_['keys'](db[_0xa07f('0x3e')][_0xa07f('0x3f')]);_0xba67ee[_0xa07f('0x44')]=_[_0xa07f('0x45')](_0x28aa18[_0xa07f('0x44')]);_0xba67ee[_0xa07f('0x46')]=_['intersection'](_0xba67ee[_0xa07f('0x43')],_0xba67ee[_0xa07f('0x44')]);_0x4614f3[_0xa07f('0x4a')]=_['intersection'](_0xba67ee[_0xa07f('0x43')],qs['fields'](_0x28aa18[_0xa07f('0x44')]['fields']));_0x4614f3[_0xa07f('0x4a')]=_0x4614f3[_0xa07f('0x4a')][_0xa07f('0x49')]?_0x4614f3['attributes']:_0xba67ee[_0xa07f('0x43')];if(_0x28aa18[_0xa07f('0x44')][_0xa07f('0x54')]){_0x4614f3[_0xa07f('0x59')]=[{'all':!![]}];}_0x4614f3=_[_0xa07f('0x52')]({},_0x4614f3,_0x28aa18[_0xa07f('0x53')]);return db[_0xa07f('0x3e')][_0xa07f('0x5a')](_0x4614f3)[_0xa07f('0x20')](handleEntityNotFound(_0x366570,null))[_0xa07f('0x20')](respondWithResult(_0x366570,null))[_0xa07f('0x29')](handleError(_0x366570,null));};exports[_0xa07f('0x5b')]=function(_0x46cc9e,_0x346637){return db[_0xa07f('0x3e')]['create'](_0x46cc9e['body'],{})[_0xa07f('0x20')](function(_0x24fa58){var _0x834887=_0x46cc9e[_0xa07f('0x5c')][_0xa07f('0x5d')]({'plain':!![]});if(!_0x834887)throw new Error(_0xa07f('0x5e'));if(_0x834887[_0xa07f('0x5f')]===_0xa07f('0x5c')){var _0x214d8f=_0x24fa58[_0xa07f('0x5d')]({'plain':!![]});var _0x5c79b4=_0xa07f('0x37');return db[_0xa07f('0x60')][_0xa07f('0x5a')]({'where':{'name':_0x5c79b4,'userProfileId':_0x834887[_0xa07f('0x61')]},'raw':!![]})[_0xa07f('0x20')](function(_0x24c93a){if(_0x24c93a&&_0x24c93a[_0xa07f('0x62')]===0x0){return db['UserProfileResource'][_0xa07f('0x5b')]({'name':_0x214d8f[_0xa07f('0x39')],'resourceId':_0x214d8f['id'],'type':_0x24c93a[_0xa07f('0x39')],'sectionId':_0x24c93a['id']},{})[_0xa07f('0x20')](function(){return _0x24fa58;});}else{return _0x24fa58;}})['catch'](function(_0x3be916){logger[_0xa07f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3be916);throw _0x3be916;});}return _0x24fa58;})[_0xa07f('0x20')](respondWithResult(_0x346637,0xc9))[_0xa07f('0x29')](handleError(_0x346637,null));};exports['update']=function(_0x2210ab,_0x12a66c){if(_0x2210ab[_0xa07f('0x63')]['id']){delete _0x2210ab[_0xa07f('0x63')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2210ab[_0xa07f('0x58')]['id']},'include':[{'model':db[_0xa07f('0x3b')],'as':_0xa07f('0x3c')}]})[_0xa07f('0x20')](handleEntityNotFound(_0x12a66c,null))['then'](saveUpdates(_0x2210ab[_0xa07f('0x63')],null))[_0xa07f('0x20')](respondWithResult(_0x12a66c,null))['catch'](handleError(_0x12a66c,null));};exports[_0xa07f('0x36')]=function(_0x10c6e2,_0x17308d){return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0x10c6e2['params']['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x17308d,null))[_0xa07f('0x20')](removeEntity(_0x17308d,null))[_0xa07f('0x29')](handleError(_0x17308d,null));};exports['describe']=function(_0x50b7b4,_0x30ca28){return db[_0xa07f('0x3e')][_0xa07f('0x64')]()[_0xa07f('0x20')](respondWithResult(_0x30ca28,null))[_0xa07f('0x29')](handleError(_0x30ca28,null));};exports[_0xa07f('0x65')]=function(_0x1eb776,_0x2f3add,_0x107706){if(_0x1eb776['body']['id']){delete _0x1eb776['body']['id'];}return db['SmsAccount'][_0xa07f('0x5a')]({'where':{'id':_0x1eb776['params']['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x2f3add,null))[_0xa07f('0x20')](function(_0x4c0300){if(_0x4c0300){_0x1eb776[_0xa07f('0x63')][_0xa07f('0x66')]=_0x4c0300['id'];return db['Disposition'][_0xa07f('0x5b')](_0x1eb776[_0xa07f('0x63')]);}})[_0xa07f('0x20')](respondWithResult(_0x2f3add,null))[_0xa07f('0x29')](handleError(_0x2f3add,null));};exports[_0xa07f('0x67')]=function(_0x5d0e83,_0x877d1d,_0x1db5b0){var _0xb69a84={'raw':![],'where':{}};var _0x51612b={};var _0x51db5e={'count':0x0,'rows':[]};return db[_0xa07f('0x3e')][_0xa07f('0x68')]({'where':{'id':_0x5d0e83[_0xa07f('0x58')]['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x877d1d,null))[_0xa07f('0x20')](function(_0xa60021){if(_0xa60021){_0x51612b[_0xa07f('0x43')]=_[_0xa07f('0x45')](db[_0xa07f('0x69')]['rawAttributes']);_0x51612b['query']=_[_0xa07f('0x45')](_0x5d0e83[_0xa07f('0x44')]);_0x51612b['filters']=_[_0xa07f('0x47')](_0x51612b['model'],_0x51612b[_0xa07f('0x44')]);_0xb69a84[_0xa07f('0x4a')]=_[_0xa07f('0x47')](_0x51612b[_0xa07f('0x43')],qs['fields'](_0x5d0e83[_0xa07f('0x44')][_0xa07f('0x48')]));_0xb69a84[_0xa07f('0x4a')]=_0xb69a84[_0xa07f('0x4a')]['length']?_0xb69a84[_0xa07f('0x4a')]:_0x51612b[_0xa07f('0x43')];if(!_0x5d0e83[_0xa07f('0x44')][_0xa07f('0x4b')](_0xa07f('0x4c'))){_0xb69a84[_0xa07f('0x2e')]=qs[_0xa07f('0x2e')](_0x5d0e83[_0xa07f('0x44')]['limit']);_0xb69a84[_0xa07f('0x30')]=qs[_0xa07f('0x30')](_0x5d0e83[_0xa07f('0x44')][_0xa07f('0x30')]);}_0xb69a84['order']=qs[_0xa07f('0x4e')](_0x5d0e83[_0xa07f('0x44')][_0xa07f('0x4e')]);_0xb69a84[_0xa07f('0x4f')]=qs[_0xa07f('0x46')](_[_0xa07f('0x50')](_0x5d0e83[_0xa07f('0x44')],_0x51612b[_0xa07f('0x46')]));_0xb69a84[_0xa07f('0x4f')][_0xa07f('0x66')]=_0xa60021['id'];if(_0x5d0e83[_0xa07f('0x44')][_0xa07f('0x51')]){_0xb69a84[_0xa07f('0x4f')]=_[_0xa07f('0x52')](_0xb69a84[_0xa07f('0x4f')],{'$or':_[_0xa07f('0x3d')](_0xb69a84['attributes'],function(_0x2131d9){var _0x48fd09={};_0x48fd09[_0x2131d9]={'$like':'%'+_0x5d0e83[_0xa07f('0x44')][_0xa07f('0x51')]+'%'};return _0x48fd09;})});}_0xb69a84=_[_0xa07f('0x52')]({},_0xb69a84,_0x5d0e83[_0xa07f('0x53')]);return db[_0xa07f('0x69')]['count']({'where':_0xb69a84[_0xa07f('0x4f')]})[_0xa07f('0x20')](function(_0x2179b9){_0x51db5e[_0xa07f('0x2f')]=_0x2179b9;if(_0x5d0e83['query'][_0xa07f('0x54')]){_0xb69a84[_0xa07f('0x59')]=[{'all':!![]}];}return db[_0xa07f('0x69')][_0xa07f('0x55')](_0xb69a84);})[_0xa07f('0x20')](function(_0x3b6ef2){_0x51db5e[_0xa07f('0x56')]=_0x3b6ef2;return _0x51db5e;});}})[_0xa07f('0x20')](respondWithFilteredResult(_0x877d1d,_0xb69a84))[_0xa07f('0x29')](handleError(_0x877d1d,null));};exports[_0xa07f('0x6a')]=function(_0x1f91f5,_0x572d6a,_0x21a8e2){return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0x1f91f5[_0xa07f('0x58')]['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x572d6a,null))[_0xa07f('0x20')](function(_0x9cb215){if(_0x9cb215){return _0x9cb215[_0xa07f('0x6a')](_0x1f91f5[_0xa07f('0x44')][_0xa07f('0x6b')]);}})[_0xa07f('0x20')](respondWithStatusCode(_0x572d6a,null))[_0xa07f('0x29')](handleError(_0x572d6a,null));};exports[_0xa07f('0x6c')]=function(_0x57cc65,_0x5e7d45,_0x295681){if(_0x57cc65[_0xa07f('0x63')]['id']){delete _0x57cc65[_0xa07f('0x63')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x57cc65[_0xa07f('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e7d45,null))[_0xa07f('0x20')](function(_0x4f1e65){if(_0x4f1e65){_0x57cc65[_0xa07f('0x63')]['SmsAccountId']=_0x4f1e65['id'];return db[_0xa07f('0x6d')][_0xa07f('0x5b')](_0x57cc65[_0xa07f('0x63')]);}})[_0xa07f('0x20')](respondWithResult(_0x5e7d45,null))['catch'](handleError(_0x5e7d45,null));};exports[_0xa07f('0x6e')]=function(_0x42c45d,_0x2533a8,_0x45769e){var _0x3e7e49={'raw':![],'where':{}};var _0x3c9a2b={};var _0x2e3bc6={'count':0x0,'rows':[]};return db[_0xa07f('0x3e')]['findOne']({'where':{'id':_0x42c45d[_0xa07f('0x58')]['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x2533a8,null))[_0xa07f('0x20')](function(_0x24dac8){if(_0x24dac8){_0x3c9a2b[_0xa07f('0x43')]=_[_0xa07f('0x45')](db['CannedAnswer']['rawAttributes']);_0x3c9a2b[_0xa07f('0x44')]=_[_0xa07f('0x45')](_0x42c45d[_0xa07f('0x44')]);_0x3c9a2b[_0xa07f('0x46')]=_[_0xa07f('0x47')](_0x3c9a2b[_0xa07f('0x43')],_0x3c9a2b['query']);_0x3e7e49[_0xa07f('0x4a')]=_['intersection'](_0x3c9a2b[_0xa07f('0x43')],qs[_0xa07f('0x48')](_0x42c45d[_0xa07f('0x44')][_0xa07f('0x48')]));_0x3e7e49['attributes']=_0x3e7e49[_0xa07f('0x4a')]['length']?_0x3e7e49[_0xa07f('0x4a')]:_0x3c9a2b['model'];if(!_0x42c45d[_0xa07f('0x44')][_0xa07f('0x4b')]('nolimit')){_0x3e7e49[_0xa07f('0x2e')]=qs[_0xa07f('0x2e')](_0x42c45d['query'][_0xa07f('0x2e')]);_0x3e7e49['offset']=qs[_0xa07f('0x30')](_0x42c45d['query']['offset']);}_0x3e7e49[_0xa07f('0x4d')]=qs['sort'](_0x42c45d[_0xa07f('0x44')]['sort']);_0x3e7e49['where']=qs[_0xa07f('0x46')](_[_0xa07f('0x50')](_0x42c45d['query'],_0x3c9a2b['filters']));_0x3e7e49[_0xa07f('0x4f')]['SmsAccountId']=_0x24dac8['id'];if(_0x42c45d[_0xa07f('0x44')][_0xa07f('0x51')]){_0x3e7e49[_0xa07f('0x4f')]=_['merge'](_0x3e7e49[_0xa07f('0x4f')],{'$or':_[_0xa07f('0x3d')](_0x3e7e49[_0xa07f('0x4a')],function(_0x448628){var _0x1ab123={};_0x1ab123[_0x448628]={'$like':'%'+_0x42c45d[_0xa07f('0x44')]['filter']+'%'};return _0x1ab123;})});}_0x3e7e49=_[_0xa07f('0x52')]({},_0x3e7e49,_0x42c45d[_0xa07f('0x53')]);return db['CannedAnswer'][_0xa07f('0x2f')]({'where':_0x3e7e49[_0xa07f('0x4f')]})[_0xa07f('0x20')](function(_0x1a6b10){_0x2e3bc6[_0xa07f('0x2f')]=_0x1a6b10;if(_0x42c45d[_0xa07f('0x44')]['includeAll']){_0x3e7e49['include']=[{'all':!![]}];}return db[_0xa07f('0x6d')]['findAll'](_0x3e7e49);})[_0xa07f('0x20')](function(_0x9eb7ed){_0x2e3bc6[_0xa07f('0x56')]=_0x9eb7ed;return _0x2e3bc6;});}})[_0xa07f('0x20')](respondWithFilteredResult(_0x2533a8,_0x3e7e49))[_0xa07f('0x29')](handleError(_0x2533a8,null));};exports[_0xa07f('0x6f')]=function(_0x221ae3,_0x4d4b41,_0x321efc){return db['SmsAccount'][_0xa07f('0x5a')]({'where':{'id':_0x221ae3[_0xa07f('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d4b41,null))[_0xa07f('0x20')](function(_0x4b83ed){if(_0x4b83ed){return _0x4b83ed[_0xa07f('0x6f')](_0x221ae3['query'][_0xa07f('0x6b')]);}})[_0xa07f('0x20')](respondWithStatusCode(_0x4d4b41,null))[_0xa07f('0x29')](handleError(_0x4d4b41,null));};exports[_0xa07f('0x70')]=function(_0xe7ecbc,_0x3d6a39,_0x2e0460){var _0x5ab61a={'channel':_0xa07f('0x71')};var _0x111902=[];var _0x32de4f=[];var _0x47bc83={};return db['SmsAccount']['find']({'where':{'id':_0xe7ecbc['params']['id']},'include':[{'model':db[_0xa07f('0x72')],'as':_0xa07f('0x73')}]})[_0xa07f('0x20')](handleEntityNotFound(_0x3d6a39,null))[_0xa07f('0x20')](function(_0x5b24db){_0x5ab61a[_0xa07f('0x74')]=_0x5b24db;_0x5ab61a[_0xa07f('0x75')]=_[_0xa07f('0x76')](_0x5b24db['Applications'],['priority'],['asc']);if(_0x5ab61a[_0xa07f('0x74')]['Applications']){delete _0x5ab61a['account']['Applications'];}return db[_0xa07f('0x77')]['describe']();})[_0xa07f('0x20')](function(_0x3bea17){if(!_0x3bea17){throw new db[(_0xa07f('0x78'))][(_0xa07f('0x79'))]('no\x20available\x20attributes');}_0x111902=_[_0xa07f('0x7a')](_[_0xa07f('0x45')](_0x3bea17),['createdAt',_0xa07f('0x7b')]);_0x32de4f=_[_0xa07f('0x7a')](_[_0xa07f('0x45')](_0x3bea17),[_0xa07f('0x7c'),'updatedAt','CompanyId',_0xa07f('0x7d')]);_0x5ab61a[_0xa07f('0x63')]={'mapKey':_0xa07f('0x7e')};if(_0x5ab61a[_0xa07f('0x74')][_0xa07f('0x41')]){switch(_0x5ab61a[_0xa07f('0x74')][_0xa07f('0x41')]){case'twilio':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]=_0xe7ecbc[_0xa07f('0x63')]['From'];_0x5ab61a[_0xa07f('0x63')]['body']=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x80')];_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x81')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x82')];break;case'skebby':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]='+'+_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x83')];_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x63')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x84')];break;case'connectel':_0x5ab61a['body'][_0xa07f('0x7f')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x7f')];_0x5ab61a['body'][_0xa07f('0x63')]=_0xe7ecbc[_0xa07f('0x63')]['message'];break;case'clicksend':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x7f')];_0x5ab61a['body']['body']=_0xe7ecbc['body'][_0xa07f('0x63')];_0x5ab61a[_0xa07f('0x63')]['messageId']=_0xe7ecbc[_0xa07f('0x63')]['message_id'];break;case _0xa07f('0x85'):_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x86')];_0x5ab61a[_0xa07f('0x63')]['body']=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x87')];_0x5ab61a['body'][_0xa07f('0x81')]=_0xe7ecbc[_0xa07f('0x63')]['MessageUUID'];break;case _0xa07f('0x88'):_0x5ab61a[_0xa07f('0x63')]['from']='+'+_0xe7ecbc[_0xa07f('0x63')]['results'][0x0][_0xa07f('0x7f')];_0x5ab61a['body']['body']=_0xe7ecbc['body'][_0xa07f('0x89')][0x0]['text'];_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x81')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x89')][0x0][_0xa07f('0x81')];break;case'csc':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x8a')];_0x5ab61a['body'][_0xa07f('0x63')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x8b')]['message'];break;case _0xa07f('0x8c'):_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]=_0xe7ecbc['body'][_0xa07f('0x8d')];_0x5ab61a['body']['body']=_0xe7ecbc['body'][_0xa07f('0x84')];_0x5ab61a['body'][_0xa07f('0x81')]=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x8e')];break;case _0xa07f('0x8f'):_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x81')]=_0xe7ecbc[_0xa07f('0x63')][0x0][_0xa07f('0x27')]['id'];_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')]=_0xe7ecbc[_0xa07f('0x63')][0x0][_0xa07f('0x27')][_0xa07f('0x7f')];_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x63')]=_0xe7ecbc['body'][0x0][_0xa07f('0x27')][_0xa07f('0x84')];break;case _0xa07f('0x90'):_0x5ab61a['body'][_0xa07f('0x7f')]=_0xe7ecbc['body']['from'];_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x63')]=_0xe7ecbc[_0xa07f('0x63')]['message'];_0x5ab61a[_0xa07f('0x63')]['messageId']=_0xe7ecbc[_0xa07f('0x63')][_0xa07f('0x91')];break;}}if(_0x5ab61a['body']['id']){delete _0x5ab61a['body']['id'];}if(_[_0xa07f('0x92')](_0x5ab61a[_0xa07f('0x63')]['from'])){throw new db['Sequelize'][(_0xa07f('0x79'))](_0xa07f('0x93'));}if(_[_0xa07f('0x92')](_0x5ab61a[_0xa07f('0x63')]['body'])||_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x63')]===''){throw new db['Sequelize'][(_0xa07f('0x79'))](_0xa07f('0x94'));}if(_[_0xa07f('0x92')](_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x95')])){throw new db[(_0xa07f('0x78'))][(_0xa07f('0x79'))](_0xa07f('0x96')+_0x32de4f);}if(!_[_0xa07f('0x97')](_0x32de4f,_0x5ab61a[_0xa07f('0x63')]['mapKey'])){throw new db[(_0xa07f('0x78'))][(_0xa07f('0x79'))](_0xa07f('0x98')+_0x32de4f);}_0x47bc83[_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x95')]]=_0x5ab61a[_0xa07f('0x63')]['from'];return db[_0xa07f('0x99')][_0xa07f('0x5a')]({'where':{'id':_0x5ab61a[_0xa07f('0x74')][_0xa07f('0x7d')]},'include':[{'model':db[_0xa07f('0x77')],'as':_0xa07f('0x9a'),'where':_0x47bc83,'limit':0x1,'order':[[_0xa07f('0x7b'),_0xa07f('0x9b')]]}]});})['then'](handleEntityNotFound(_0x3d6a39,null))[_0xa07f('0x20')](function(_0x31355f){if(_0x31355f){_0x5ab61a['list']=_['omit'](_0x31355f,[_0xa07f('0x9a')]);if(_0x31355f[_0xa07f('0x9a')][_0xa07f('0x49')]){return _0x31355f['Contacts'][0x0];}var _0x4703cb=_['defaults'](_0x5ab61a[_0xa07f('0x63')],{'firstName':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')],'ListId':_0x31355f['id']});_0x4703cb[_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x95')]]=_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')];return db[_0xa07f('0x77')]['create'](_0x4703cb,{'fields':_0x111902,'raw':!![]});}})[_0xa07f('0x20')](handleEntityNotFound(_0x3d6a39,null))[_0xa07f('0x20')](function(_0x2c9dd5){if(_0x2c9dd5){_0x5ab61a[_0xa07f('0x9c')]=_0x2c9dd5;var _0x42c691={'ContactId':_0x2c9dd5['id'],'phone':_0x5ab61a['body'][_0xa07f('0x7f')],'SmsAccountId':_0xe7ecbc[_0xa07f('0x58')]['id']};var _0x1fc30e={'ContactId':_0x2c9dd5['id'],'SmsAccountId':_0xe7ecbc[_0xa07f('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0xa07f('0x5a')]({'where':_0x1fc30e})[_0xa07f('0x20')](function(_0x16746c){if(_0x16746c){return[_0x16746c,![]];}return db[_0xa07f('0x9d')]['create'](_0x42c691)[_0xa07f('0x20')](function(_0x523196){return[_0x523196,!![]];});});}})[_0xa07f('0x9e')](function(_0x3ecb3f,_0x178690){_0x5ab61a[_0xa07f('0x9f')]=_0x3ecb3f[_0xa07f('0x5d')]({'plain':!![]});_0x5ab61a[_0xa07f('0x9f')][_0xa07f('0xa0')]=![];if(_0x178690){if(_0x5ab61a['account'][_0xa07f('0xa1')]){_0x5ab61a[_0xa07f('0x75')][_0xa07f('0xa2')]({'id':0x0,'priority':_0x5ab61a['applications'][_0xa07f('0x49')]+0x1,'app':_0xa07f('0xa3'),'appdata':_0xa07f('0xa4'),'interval':_0xa07f('0xa5')});}_0x5ab61a[_0xa07f('0x9f')][_0xa07f('0xa0')]=!![];}return db[_0xa07f('0xa6')][_0xa07f('0x5b')]({'phone':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x7f')],'messageId':_0x5ab61a[_0xa07f('0x63')][_0xa07f('0x81')],'body':_0x5ab61a[_0xa07f('0x63')]['body'],'SmsAccountId':_0xe7ecbc['params']['id'],'SmsInteractionId':_0x3ecb3f['id'],'direction':'in','ContactId':_0x3ecb3f[_0xa07f('0xa7')],'AttachmentId':_0x5ab61a['body'][_0xa07f('0xa8')]});})[_0xa07f('0x20')](function(_0x5c81b8){_0x5ab61a[_0xa07f('0x27')]=_0x5c81b8;if(!_0x5ab61a[_0xa07f('0x9f')][_0xa07f('0xa9')])return;return db[_0xa07f('0xaa')]['find']({'attributes':['id',_0xa07f('0x39')],'where':{'id':_0x5ab61a[_0xa07f('0x9f')][_0xa07f('0xa9')]}});})[_0xa07f('0x20')](function(_0x1e11a4){if(_0x1e11a4){_0x5ab61a[_0xa07f('0x75')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e11a4[_0xa07f('0x39')]+','+(_0x5ab61a['account'][_0xa07f('0xab')]||0xa),'interval':'*,*,*,*'});}if(!_0x5ab61a['interaction'][_0xa07f('0xac')])return;return db[_0xa07f('0xad')][_0xa07f('0x5a')]({'attributes':['id','name'],'where':{'id':_0x5ab61a[_0xa07f('0x9f')][_0xa07f('0xac')]}});})['then'](function(_0xc16d3a){if(_0xc16d3a){_0x5ab61a[_0xa07f('0x75')][_0xa07f('0xae')]({'id':0x0,'priority':0x1,'app':_0xa07f('0xaf'),'appdata':_0xc16d3a[_0xa07f('0x39')]+','+(_0x5ab61a[_0xa07f('0x74')]['waitForTheAssignedQueue']||0x12c),'interval':_0xa07f('0xa5')});}return respondWithRpcPromise('Start','startRouting',_0x5ab61a);})[_0xa07f('0x20')](function(_0x3ec986){if(_0x3ec986){var _0x597ed1=0xc8;var _0x53e1a4=_0xa07f('0xb0');logger[_0xa07f('0x21')](_0xa07f('0x25'),_0x53e1a4,_0x597ed1,_0xa07f('0xb1'));logger[_0xa07f('0x24')](_0xa07f('0xb2'),_0x53e1a4,_0x597ed1,_0xa07f('0xb1'),JSON[_0xa07f('0xb3')](_0x3ec986));if(_0x5ab61a['account'][_0xa07f('0x41')]==='twilio'){return _0x3d6a39['status'](_0x597ed1)[_0xa07f('0x31')](_0xa07f('0xb4'),_0xa07f('0xb5'))[_0xa07f('0x3a')]('\x0a');}else{return _0x3d6a39[_0xa07f('0x2c')](_0x597ed1)['json'](_0x3ec986);}}})[_0xa07f('0x29')](handleError(_0x3d6a39,null));};exports[_0xa07f('0xb6')]=function(_0xf19f69,_0x608e19){var _0xe9aa25=_0xf19f69[_0xa07f('0x58')]['id'];var _0x3c3653=_0xf19f69[_0xa07f('0x63')];var _0x51c8ee=0xc8;var _0x31216d=null;return db[_0xa07f('0xb7')][_0xa07f('0xb8')]({'isolationLevel':db[_0xa07f('0xb7')][_0xa07f('0xb9')][_0xa07f('0xba')][_0xa07f('0xbb')]},function(_0x33aee2){return db[_0xa07f('0x3e')]['findOne']({'where':{'id':_0xe9aa25},'transaction':_0x33aee2})[_0xa07f('0x20')](function(_0x59ae47){if(_0x59ae47){return db[_0xa07f('0x72')]['destroy']({'where':{'SmsAccountId':_0xe9aa25},'transaction':_0x33aee2})[_0xa07f('0x20')](function(){var _0x2ba85a=_[_0xa07f('0x3d')](_0x3c3653,function(_0x51a3a8){_0x51a3a8['SmsAccountId']=_0xe9aa25;return _0x51a3a8;});return db[_0xa07f('0x72')]['bulkCreate'](_0x2ba85a,{'transaction':_0x33aee2});});}else{_0x51c8ee=0x194;_0x31216d=[];}});})[_0xa07f('0x20')](function(){if(_0x51c8ee!==0x194){return db[_0xa07f('0x72')]['findAndCountAll']({'where':{'SmsAccountId':_0xe9aa25},'order':_0xa07f('0xbc')})[_0xa07f('0x20')](function(_0xac5f28){_0x31216d=_0xac5f28;});}})['catch'](function(_0x3c3eee){_0x51c8ee=0x1f4;logger[_0xa07f('0x26')](_0x3c3eee[_0xa07f('0xbd')]);if(_0x3c3eee[_0xa07f('0x39')]){delete _0x3c3eee[_0xa07f('0x39')];}_0x31216d=_0x3c3eee;})[_0xa07f('0xbe')](function(){if(_0x31216d===null){_0x608e19[_0xa07f('0x2a')](_0x51c8ee);}else{if(_0x51c8ee===0x1f4){_0x608e19['status'](_0x51c8ee)[_0xa07f('0x3a')](_0x31216d);}else{_0x608e19['status'](_0x51c8ee)[_0xa07f('0x2d')](_0x31216d);}}});};exports[_0xa07f('0xbf')]=function(_0x5618c1,_0x308fa3,_0x489afe){var _0x44eda6={};var _0x44f7f8={};var _0x5a59b9;var _0x465aac;return db[_0xa07f('0x3e')]['findOne']({'where':{'id':_0x5618c1[_0xa07f('0x58')]['id']}})['then'](handleEntityNotFound(_0x308fa3,null))[_0xa07f('0x20')](function(_0x51a4ca){if(_0x51a4ca){_0x5a59b9=_0x51a4ca;_0x44f7f8[_0xa07f('0x43')]=_[_0xa07f('0x45')](db[_0xa07f('0x72')][_0xa07f('0x3f')]);_0x44f7f8[_0xa07f('0x44')]=_[_0xa07f('0x45')](_0x5618c1['query']);_0x44f7f8[_0xa07f('0x46')]=_[_0xa07f('0x47')](_0x44f7f8[_0xa07f('0x43')],_0x44f7f8[_0xa07f('0x44')]);_0x44eda6[_0xa07f('0x4a')]=_['intersection'](_0x44f7f8[_0xa07f('0x43')],qs[_0xa07f('0x48')](_0x5618c1[_0xa07f('0x44')]['fields']));_0x44eda6[_0xa07f('0x4a')]=_0x44eda6[_0xa07f('0x4a')][_0xa07f('0x49')]?_0x44eda6[_0xa07f('0x4a')]:_0x44f7f8['model'];_0x44eda6[_0xa07f('0x4d')]=qs[_0xa07f('0x4e')](_0x5618c1[_0xa07f('0x44')][_0xa07f('0x4e')]);_0x44eda6[_0xa07f('0x4f')]=qs[_0xa07f('0x46')](_['pick'](_0x5618c1[_0xa07f('0x44')],_0x44f7f8[_0xa07f('0x46')]));if(_0x5618c1[_0xa07f('0x44')][_0xa07f('0x51')]){_0x44eda6[_0xa07f('0x4f')]=_['merge'](_0x44eda6[_0xa07f('0x4f')],{'$or':_[_0xa07f('0x3d')](_0x44eda6['attributes'],function(_0x2e10a1){var _0x2ad5b4={};_0x2ad5b4[_0x2e10a1]={'$like':'%'+_0x5618c1[_0xa07f('0x44')][_0xa07f('0x51')]+'%'};return _0x2ad5b4;})});}_0x44eda6=_[_0xa07f('0x52')]({},_0x44eda6,_0x5618c1[_0xa07f('0x53')]);return _0x5a59b9[_0xa07f('0xbf')](_0x44eda6);}})['then'](function(_0x2343b9){if(_0x2343b9){_0x465aac=_0x2343b9[_0xa07f('0x49')];if(!_0x5618c1['query'][_0xa07f('0x4b')]('nolimit')){_0x44eda6['limit']=qs[_0xa07f('0x2e')](_0x5618c1[_0xa07f('0x44')][_0xa07f('0x2e')]);_0x44eda6[_0xa07f('0x30')]=qs['offset'](_0x5618c1[_0xa07f('0x44')][_0xa07f('0x30')]);}return _0x5a59b9[_0xa07f('0xbf')](_0x44eda6);}})[_0xa07f('0x20')](function(_0x15003e){if(_0x15003e){return _0x15003e?{'count':_0x465aac,'rows':_0x15003e}:null;}})[_0xa07f('0x20')](respondWithResult(_0x308fa3,null))['catch'](handleError(_0x308fa3,null));};exports[_0xa07f('0xc0')]=function(_0x15e9cc,_0x579249,_0x2d1824){var _0x535935={'raw':![],'where':{}};var _0x119830={};var _0x14ea52={'count':0x0,'rows':[]};return db[_0xa07f('0x3e')]['findOne']({'where':{'id':_0x15e9cc[_0xa07f('0x58')]['id']}})['then'](handleEntityNotFound(_0x579249,null))[_0xa07f('0x20')](function(_0x884ab4){if(_0x884ab4){_0x119830[_0xa07f('0x43')]=_['keys'](db[_0xa07f('0x9d')]['rawAttributes']);_0x119830[_0xa07f('0x44')]=_[_0xa07f('0x45')](_0x15e9cc['query']);_0x119830[_0xa07f('0x46')]=_[_0xa07f('0x47')](_0x119830['model'],_0x119830[_0xa07f('0x44')]);_0x535935[_0xa07f('0x4a')]=_['intersection'](_0x119830[_0xa07f('0x43')],qs[_0xa07f('0x48')](_0x15e9cc[_0xa07f('0x44')][_0xa07f('0x48')]));_0x535935[_0xa07f('0x4a')]=_0x535935[_0xa07f('0x4a')][_0xa07f('0x49')]?_0x535935[_0xa07f('0x4a')]:_0x119830[_0xa07f('0x43')];if(!_0x15e9cc[_0xa07f('0x44')][_0xa07f('0x4b')](_0xa07f('0x4c'))){_0x535935[_0xa07f('0x2e')]=qs[_0xa07f('0x2e')](_0x15e9cc['query'][_0xa07f('0x2e')]);_0x535935[_0xa07f('0x30')]=qs[_0xa07f('0x30')](_0x15e9cc['query'][_0xa07f('0x30')]);}_0x535935['order']=qs[_0xa07f('0x4e')](_0x15e9cc[_0xa07f('0x44')][_0xa07f('0x4e')]);_0x535935['where']=qs[_0xa07f('0x46')](_[_0xa07f('0x50')](_0x15e9cc['query'],_0x119830[_0xa07f('0x46')]));_0x535935[_0xa07f('0x4f')][_0xa07f('0x66')]=_0x884ab4['id'];if(_0x15e9cc[_0xa07f('0x44')][_0xa07f('0x51')]){_0x535935['where']=_[_0xa07f('0x52')](_0x535935['where'],{'$or':_[_0xa07f('0x3d')](_0x535935[_0xa07f('0x4a')],function(_0x2c7be9){var _0x54258a={};_0x54258a[_0x2c7be9]={'$like':'%'+_0x15e9cc[_0xa07f('0x44')][_0xa07f('0x51')]+'%'};return _0x54258a;})});}_0x535935=_[_0xa07f('0x52')]({},_0x535935,_0x15e9cc[_0xa07f('0x53')]);return db[_0xa07f('0x9d')][_0xa07f('0x2f')]({'where':_0x535935[_0xa07f('0x4f')]})[_0xa07f('0x20')](function(_0x5d7817){_0x14ea52['count']=_0x5d7817;if(_0x15e9cc['query']['includeAll']){_0x535935['include']=[{'model':db[_0xa07f('0x77')],'as':_0xa07f('0xc1'),'required':![]},{'model':db[_0xa07f('0xaa')],'as':_0xa07f('0xc2'),'attributes':[_0xa07f('0x39'),_0xa07f('0xc3'),_0xa07f('0xc4')],'required':![]},{'model':db[_0xa07f('0xc5')],'as':_0xa07f('0xc6'),'attributes':['id','name','color'],'where':_0x15e9cc[_0xa07f('0x44')][_0xa07f('0xc7')]?{'id':_0x15e9cc['query'][_0xa07f('0xc7')]}:undefined,'required':_0x15e9cc['query'][_0xa07f('0xc7')]?!![]:![]}];}return db[_0xa07f('0x9d')][_0xa07f('0x55')](_0x535935);})['then'](function(_0x5010ec){_0x14ea52[_0xa07f('0x56')]=_0x5010ec;return _0x14ea52;});}})['then'](respondWithFilteredResult(_0x579249,_0x535935))[_0xa07f('0x29')](handleError(_0x579249,null));};exports[_0xa07f('0x3a')]=function(_0x8b589c,_0x559a7b,_0x4e6cad){var _0x23a42f,_0x18a807,_0x3d1c55;if(_[_0xa07f('0x92')](_0x8b589c[_0xa07f('0x63')][_0xa07f('0x63')])||_0x8b589c[_0xa07f('0x63')][_0xa07f('0x63')]===''){throw new db['Sequelize'][(_0xa07f('0x79'))](_0xa07f('0x94'));}if(_[_0xa07f('0x92')](_0x8b589c['body']['to'])){throw new db[(_0xa07f('0x78'))]['ValidationError'](_0xa07f('0xc8'));}_0x23a42f=_0x8b589c[_0xa07f('0x63')]['to'];return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0x8b589c['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa07f('0x77')],'as':_0xa07f('0x9a'),'where':{'mobile':_0x23a42f},'limit':0x1,'order':[[_0xa07f('0x7b'),_0xa07f('0x9b')]]}]}]})[_0xa07f('0x20')](handleEntityNotFound(_0x559a7b,null))[_0xa07f('0x20')](function(_0x1a0d53){if(_0x1a0d53&&_0x1a0d53[_0xa07f('0xc9')]){_0x18a807=_0x1a0d53[_0xa07f('0x5d')]({'plain':!![]});if(_0x18a807[_0xa07f('0xc9')]&&_0x18a807['List'][_0xa07f('0x9a')]['length']){return _0x18a807['List'][_0xa07f('0x9a')][0x0];}return db[_0xa07f('0x77')][_0xa07f('0x5b')](_[_0xa07f('0xca')](_0x8b589c['body'],{'firstName':_0x23a42f,'mobile':_0x23a42f,'phone':_0x23a42f,'ListId':_0x18a807['ListId']}));}})['then'](handleEntityNotFound(_0x559a7b,null))['then'](function(_0x5f6b6){if(_0x5f6b6){_0x3d1c55=_0x5f6b6;return db[_0xa07f('0x9d')][_0xa07f('0x5a')]({'where':{'ContactId':_0x3d1c55['id'],'closed':![],'SmsAccountId':_0x18a807['id']}})[_0xa07f('0x20')](function(_0x2cf3eb){if(_0x2cf3eb){return[_0x2cf3eb,![]];}return db[_0xa07f('0x9d')]['create']({'UserId':_0x8b589c[_0xa07f('0x5c')]['id'],'ContactId':_0x3d1c55['id'],'SmsAccountId':_0x18a807['id'],'phone':_0x23a42f,'firstMsgDirection':_0xa07f('0xcb'),'Messages':[_[_0xa07f('0x52')](_0x8b589c[_0xa07f('0x63')],{'read':![],'body':_0x8b589c[_0xa07f('0x63')][_0xa07f('0x63')],'phone':_0x23a42f,'SmsAccountId':_0x18a807['id'],'UserId':_0x8b589c[_0xa07f('0x5c')]['id'],'ContactId':_0x3d1c55['id']})]},{'include':[{'model':db[_0xa07f('0xa6')],'as':'Messages'}]})['then'](function(_0x2f6448){return[_0x2f6448,!![]];});});}})[_0xa07f('0x9e')](function(_0x40db79,_0x47689e){if(_0x47689e){return _0x40db79;}return db[_0xa07f('0xa6')][_0xa07f('0x5b')](_['merge'](_0x8b589c[_0xa07f('0x63')],{'read':![],'body':_0x8b589c[_0xa07f('0x63')]['body'],'phone':_0x23a42f,'SmsAccountId':_0x18a807['id'],'SmsInteractionId':_0x40db79['id'],'UserId':_0x8b589c[_0xa07f('0x5c')]['id'],'ContactId':_0x3d1c55['id']}))[_0xa07f('0x20')](function(_0x30e7e8){_0x40db79[_0xa07f('0xcc')][_0xa07f('0xcd')]=[];_0x40db79[_0xa07f('0xcc')][_0xa07f('0xcd')][_0xa07f('0xa2')](_0x30e7e8[_0xa07f('0xcc')]);return _0x40db79;});})['then'](respondWithResult(_0x559a7b,null))['catch'](handleError(_0x559a7b,null));};exports[_0xa07f('0x2c')]=function(_0x37c3f3,_0xe24862,_0x14616a){if(_0x37c3f3[_0xa07f('0x63')]['id']){delete _0x37c3f3['body']['id'];}var _0x2a58dc,_0x26d48e,_0x406616;return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0x37c3f3[_0xa07f('0x58')]['id']}})['then'](handleEntityNotFound(_0xe24862,null))[_0xa07f('0x20')](function(_0x552f64){if(_0x552f64){_0x406616=_0x552f64;logger['debug'](_0xa07f('0x25'),'status',_0xa07f('0xce'),_0x552f64['type'],util[_0xa07f('0xcf')](_0x37c3f3[_0xa07f('0x63')],{'showHidden':![],'depth':null}));switch(_0x552f64[_0xa07f('0x41')]){case _0xa07f('0xd0'):if(_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xd1')]&&_0x37c3f3['body'][_0xa07f('0x2c')]){_0x26d48e=_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x2c')];return db[_0xa07f('0xa6')]['find']({'where':{'messageId':_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xd1')]}});}break;case _0xa07f('0xd2'):if(_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xd3')]&&_0x37c3f3[_0xa07f('0x63')]['statusInt']){_0x26d48e=_0x37c3f3['body'][_0xa07f('0xd4')];return db[_0xa07f('0xa6')][_0xa07f('0x5a')]({'where':{'messageId':_0x37c3f3[_0xa07f('0x63')]['requestid']}});}break;case _0xa07f('0xd5'):if(_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xd6')]&&_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xd7')]){_0x26d48e=_0x37c3f3['body'][_0xa07f('0xd7')];return db[_0xa07f('0xa6')][_0xa07f('0x5a')]({'where':{'messageId':_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xd6')]}});}break;case _0xa07f('0x88'):var _0x49d1b1=_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x89')][0x0];if(_0x49d1b1['messageId']&&_0x49d1b1[_0xa07f('0x2c')][_0xa07f('0xd8')]===_0xa07f('0xd9')){_0x26d48e=_0x49d1b1[_0xa07f('0x2c')][_0xa07f('0xd8')];return db['SmsMessage'][_0xa07f('0x5a')]({'where':{'messageId':_0x49d1b1[_0xa07f('0x81')]}});}break;case _0xa07f('0x8c'):if(_0x37c3f3[_0xa07f('0x63')]['messageId']&&_0x37c3f3[_0xa07f('0x63')]['status']){_0x26d48e=_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x81')]}});}break;case _0xa07f('0x8f'):if(_0x37c3f3[_0xa07f('0x63')][0x0]['message']['id']){_0x26d48e=_0x37c3f3['body'][0x0]['type'];return db[_0xa07f('0xa6')][_0xa07f('0x5a')]({'where':{'messageId':_0x37c3f3[_0xa07f('0x63')][0x0]['message']['id']}});}break;case _0xa07f('0x90'):if(_0x37c3f3[_0xa07f('0x63')]['redif']&&_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x2c')]){_0x26d48e=_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x2c')];return db[_0xa07f('0xa6')]['find']({'where':{'messageId':_0x37c3f3[_0xa07f('0x63')][_0xa07f('0xda')]}});}break;}}})[_0xa07f('0x20')](handleEntityNotFound(_0xe24862,null))[_0xa07f('0x20')](function(_0x5ab148){if(_0x5ab148){_0x2a58dc=_0x5ab148;switch(_0x406616[_0xa07f('0x41')]){case _0xa07f('0xd0'):if(_0x26d48e==='DELIVERED'){return _0x2a58dc[_0xa07f('0x35')]({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),_0xa07f('0x2c'),_0xa07f('0xd0'),util['inspect'](_0x37c3f3[_0xa07f('0x63')],{'showHidden':![],'depth':null}));}break;case _0xa07f('0xd2'):if(_0x26d48e==='1'){return _0x2a58dc[_0xa07f('0x35')]({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),_0xa07f('0x2c'),'skebby',util[_0xa07f('0xcf')](_0x37c3f3[_0xa07f('0x63')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x37c3f3['body'][_0xa07f('0xdb')]&&_0x26d48e>=0xc8&&_0x26d48e<=0xce){return _0x2a58dc['update']({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),_0xa07f('0x2c'),_0xa07f('0xd5'),util[_0xa07f('0xcf')](_0x37c3f3[_0xa07f('0x63')],{'showHidden':![],'depth':null}));}break;case _0xa07f('0x88'):var _0x2b4220=_0x37c3f3[_0xa07f('0x63')][_0xa07f('0x89')][0x0];if(_0x2b4220[_0xa07f('0x2c')][_0xa07f('0xd8')]===_0xa07f('0xd9')){return _0x2a58dc[_0xa07f('0x35')]({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),_0xa07f('0x2c'),'infobip',util[_0xa07f('0xcf')](_0x37c3f3[_0xa07f('0x63')],{'showHidden':![],'depth':null}));}break;case _0xa07f('0x8c'):if(_0x26d48e=='DELIVERED_TO_GATEWAY'||_0x26d48e==_0xa07f('0xdc')){return _0x2a58dc[_0xa07f('0x35')]({'read':!![]});}else{logger['error'](_0xa07f('0x25'),_0xa07f('0x2c'),_0xa07f('0x8c'),util[_0xa07f('0xcf')](_0x37c3f3[_0xa07f('0x63')],{'showHidden':![],'depth':null}));}break;case _0xa07f('0x8f'):if(_0x26d48e==_0xa07f('0xdd')){return _0x2a58dc['update']({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),_0xa07f('0x2c'),_0xa07f('0x8f'),util[_0xa07f('0xcf')](_0x37c3f3['body'],{'showHidden':![],'depth':null}));}break;case _0xa07f('0x90'):if(_0x26d48e==='DELIVRD'||_0x26d48e===_0xa07f('0xde')){return _0x2a58dc['update']({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),_0xa07f('0x2c'),_0xa07f('0x90'),util[_0xa07f('0xcf')](_0x37c3f3['body'],{'showHidden':![],'depth':null}));}break;}return _0x2a58dc;}})[_0xa07f('0x20')](respondWithResult(_0xe24862,null))[_0xa07f('0x29')](handleError(_0xe24862,null));};exports[_0xa07f('0xdf')]=function(_0x267e1d,_0x41076,_0x797488){var _0x40adc4,_0x59ffc7,_0x3387bf;return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0x267e1d[_0xa07f('0x58')]['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x41076,null))[_0xa07f('0x20')](function(_0x68d8cf){if(_0x68d8cf){_0x3387bf=_0x68d8cf;logger[_0xa07f('0x24')](_0xa07f('0x25'),'status',_0xa07f('0xce'),_0x68d8cf[_0xa07f('0x41')],util[_0xa07f('0xcf')](_0x267e1d[_0xa07f('0x44')],{'showHidden':![],'depth':null}));switch(_0x68d8cf[_0xa07f('0x41')]){case _0xa07f('0xe0'):if(_0x267e1d['query'][_0xa07f('0xe1')]&&_0x267e1d[_0xa07f('0x44')][_0xa07f('0xe2')]){_0x59ffc7=_0x267e1d['query'][_0xa07f('0xe2')];return db['SmsMessage'][_0xa07f('0x5a')]({'where':{'messageId':_0x267e1d[_0xa07f('0x44')]['message-id']}});}break;}}})[_0xa07f('0x20')](handleEntityNotFound(_0x41076,null))['then'](function(_0x21e239){if(_0x21e239){_0x40adc4=_0x21e239;switch(_0x3387bf['type']){case _0xa07f('0xe0'):if(_0x59ffc7==='2'||_0x59ffc7==='6'){return _0x40adc4[_0xa07f('0x35')]({'read':!![]});}else{logger[_0xa07f('0x26')](_0xa07f('0x25'),'status',_0xa07f('0xe0'),util[_0xa07f('0xcf')](_0x267e1d[_0xa07f('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x40adc4;}})[_0xa07f('0x20')](respondWithResult(_0x41076,null))[_0xa07f('0x29')](handleError(_0x41076,null));};exports[_0xa07f('0xe3')]=function(_0x2fa786,_0x2f3b49,_0x1cd4ef){return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0x2fa786[_0xa07f('0x58')]['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x2f3b49,null))[_0xa07f('0x20')](function(_0x29cba7){if(_0x29cba7){return _0x29cba7[_0xa07f('0xe3')](_0x2fa786[_0xa07f('0x63')][_0xa07f('0x6b')],_[_0xa07f('0xe4')](_0x2fa786['body'],[_0xa07f('0x6b'),'id'])||{})[_0xa07f('0x9e')](function(_0x52d0c7){for(var _0x1bd7ab=0x0;_0x1bd7ab<_0x2fa786[_0xa07f('0x63')][_0xa07f('0x6b')][_0xa07f('0x49')];_0x1bd7ab+=0x1){socket[_0xa07f('0xe5')]('userSmsAccount:save',{'UserId':Number(_0x2fa786['body']['ids'][_0x1bd7ab]),'SmsAccountId':Number(_0x2fa786[_0xa07f('0x58')]['id'])});}return _0x52d0c7;});}})[_0xa07f('0x20')](respondWithResult(_0x2f3b49,null))['catch'](handleError(_0x2f3b49,null));};exports[_0xa07f('0xe6')]=function(_0xfb0485,_0x3beb3f,_0x230385){return db[_0xa07f('0x3e')][_0xa07f('0x5a')]({'where':{'id':_0xfb0485[_0xa07f('0x58')]['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x3beb3f,null))[_0xa07f('0x20')](function(_0x2fb32f){if(_0x2fb32f){return _0x2fb32f['removeAgents'](_0xfb0485[_0xa07f('0x44')][_0xa07f('0x6b')])[_0xa07f('0x20')](function(){if(_[_0xa07f('0xe7')](_0xfb0485['query'][_0xa07f('0x6b')])){for(var _0x47a017=0x0;_0x47a017<_0xfb0485[_0xa07f('0x44')][_0xa07f('0x6b')]['length'];_0x47a017+=0x1){socket['emit'](_0xa07f('0xe8'),{'UserId':Number(_0xfb0485[_0xa07f('0x44')]['ids'][_0x47a017]),'SmsAccountId':Number(_0xfb0485[_0xa07f('0x58')]['id'])});}}else{socket['emit'](_0xa07f('0xe8'),{'UserId':Number(_0xfb0485['query']['ids']),'SmsAccountId':Number(_0xfb0485[_0xa07f('0x58')]['id'])});}});}})[_0xa07f('0x20')](respondWithStatusCode(_0x3beb3f,null))['catch'](handleError(_0x3beb3f,null));};exports[_0xa07f('0xe9')]=function(_0x950c1c,_0x4ec748,_0x44b555){var _0xc09354={};var _0x2384f0={};var _0x73fc22;var _0x2f6ab0;return db[_0xa07f('0x3e')][_0xa07f('0x68')]({'where':{'id':_0x950c1c['params']['id']}})[_0xa07f('0x20')](handleEntityNotFound(_0x4ec748,null))[_0xa07f('0x20')](function(_0x9c02cd){if(_0x9c02cd){_0x73fc22=_0x9c02cd;_0x2384f0[_0xa07f('0x43')]=_[_0xa07f('0x45')](db[_0xa07f('0xaa')][_0xa07f('0x3f')]);_0x2384f0[_0xa07f('0x44')]=_[_0xa07f('0x45')](_0x950c1c[_0xa07f('0x44')]);_0x2384f0[_0xa07f('0x46')]=_[_0xa07f('0x47')](_0x2384f0[_0xa07f('0x43')],_0x2384f0['query']);_0xc09354[_0xa07f('0x4a')]=_[_0xa07f('0x47')](_0x2384f0[_0xa07f('0x43')],qs[_0xa07f('0x48')](_0x950c1c[_0xa07f('0x44')][_0xa07f('0x48')]));_0xc09354['attributes']=_0xc09354[_0xa07f('0x4a')][_0xa07f('0x49')]?_0xc09354[_0xa07f('0x4a')]:_0x2384f0[_0xa07f('0x43')];_0xc09354['order']=qs[_0xa07f('0x4e')](_0x950c1c[_0xa07f('0x44')][_0xa07f('0x4e')]);_0xc09354[_0xa07f('0x4f')]=qs['filters'](_[_0xa07f('0x50')](_0x950c1c[_0xa07f('0x44')],_0x2384f0[_0xa07f('0x46')]));if(_0x950c1c[_0xa07f('0x44')][_0xa07f('0x51')]){_0xc09354[_0xa07f('0x4f')]=_[_0xa07f('0x52')](_0xc09354[_0xa07f('0x4f')],{'$or':_[_0xa07f('0x3d')](_0xc09354[_0xa07f('0x4a')],function(_0x5b3db0){var _0x23232f={};_0x23232f[_0x5b3db0]={'$like':'%'+_0x950c1c['query'][_0xa07f('0x51')]+'%'};return _0x23232f;})});}_0xc09354=_[_0xa07f('0x52')]({},_0xc09354,_0x950c1c[_0xa07f('0x53')]);return _0x73fc22[_0xa07f('0xe9')](_0xc09354);}})[_0xa07f('0x20')](function(_0x40b22e){if(_0x40b22e){_0x2f6ab0=_0x40b22e[_0xa07f('0x49')];if(!_0x950c1c[_0xa07f('0x44')][_0xa07f('0x4b')](_0xa07f('0x4c'))){_0xc09354['limit']=qs[_0xa07f('0x2e')](_0x950c1c[_0xa07f('0x44')][_0xa07f('0x2e')]);_0xc09354['offset']=qs['offset'](_0x950c1c[_0xa07f('0x44')][_0xa07f('0x30')]);}return _0x73fc22['getAgents'](_0xc09354);}})[_0xa07f('0x20')](function(_0x19d756){if(_0x19d756){return _0x19d756?{'count':_0x2f6ab0,'rows':_0x19d756}:null;}})[_0xa07f('0x20')](respondWithResult(_0x4ec748,null))[_0xa07f('0x29')](handleError(_0x4ec748,null));}; \ No newline at end of file +var _0xe8c0=['rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','Pause','length','options','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','hasOwnProperty','nolimit','map','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','orderBy','Applications','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','text','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','User','UserId','agent','waitForTheAssignedAgent','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','json','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','undefined','limit','count','offset','apply','save','update','destroy','get','SmsAccounts','name','index','mandatoryDispositionPause','SmsAccount'];(function(_0x1bafea,_0x1b5f28){var _0x2f65b7=function(_0x296ed5){while(--_0x296ed5){_0x1bafea['push'](_0x1bafea['shift']());}};_0x2f65b7(++_0x1b5f28);}(_0xe8c0,0xac));var _0x0e8c=function(_0x2eeb63,_0x5c5c09){_0x2eeb63=_0x2eeb63-0x0;var _0x2a251c=_0xe8c0[_0x2eeb63];return _0x2a251c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e8c('0x0'));var zipdir=require(_0x0e8c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e8c('0x2'));var moment=require(_0x0e8c('0x3'));var BPromise=require(_0x0e8c('0x4'));var Mustache=require(_0x0e8c('0x5'));var util=require(_0x0e8c('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e8c('0x7'));var fs=require('fs');var fs_extra=require(_0x0e8c('0x8'));var _=require('lodash');var squel=require(_0x0e8c('0x9'));var crypto=require('crypto');var jsforce=require(_0x0e8c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e8c('0xb'));var Papa=require(_0x0e8c('0xc'));var Redis=require(_0x0e8c('0xd'));var authService=require(_0x0e8c('0xe'));var qs=require(_0x0e8c('0xf'));var as=require(_0x0e8c('0x10'));var hardwareService=require(_0x0e8c('0x11'));var logger=require('../../config/logger')(_0x0e8c('0x12'));var utils=require('../../config/utils');var config=require(_0x0e8c('0x13'));var licenseUtil=require(_0x0e8c('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0e8c('0x15')](config[_0x0e8c('0x16')],{'host':_0x0e8c('0x17'),'port':0x18eb});var socket=require(_0x0e8c('0x18'))(new Redis(config[_0x0e8c('0x16')]));require('./smsAccount.socket')[_0x0e8c('0x19')](socket);var jayson=require(_0x0e8c('0x1a'));var client=jayson[_0x0e8c('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x45f648,_0x4796b1,_0x4bd7e6,_0x33c316){return new BPromise(function(_0x2e0f43,_0x3345a3){var _0x194a0f=_0x33c316||client;return _0x194a0f['request'](_0x45f648,_0x4bd7e6)[_0x0e8c('0x1c')](function(_0x1482dd){logger[_0x0e8c('0x1d')](_0x0e8c('0x1e'),_0x4796b1,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4796b1,_0x0e8c('0x1f'),JSON[_0x0e8c('0x20')](_0x1482dd));if(_0x1482dd[_0x0e8c('0x21')]){if(_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x22')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4796b1,_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x23')]);return _0x3345a3(_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x23')]);}logger[_0x0e8c('0x21')](_0x0e8c('0x1e'),_0x4796b1,_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x23')]);return _0x2e0f43(_0x1482dd['error']['message']);}else{logger[_0x0e8c('0x1d')](_0x0e8c('0x1e'),_0x4796b1,_0x0e8c('0x1f'));_0x2e0f43(_0x1482dd['result']['message']);}})[_0x0e8c('0x24')](function(_0x3c7fbb){logger[_0x0e8c('0x21')](_0x0e8c('0x1e'),_0x4796b1,_0x3c7fbb);_0x3345a3(_0x3c7fbb);});});}function respondWithStatusCode(_0x40f401,_0x3ef2a0){_0x3ef2a0=_0x3ef2a0||0xcc;return function(_0x430b59){if(_0x430b59){return _0x40f401[_0x0e8c('0x25')](_0x3ef2a0);}return _0x40f401[_0x0e8c('0x26')](_0x3ef2a0)[_0x0e8c('0x27')]();};}function respondWithResult(_0x389bf2,_0x29adc0){_0x29adc0=_0x29adc0||0xc8;return function(_0x41fe1b){if(_0x41fe1b){return _0x389bf2[_0x0e8c('0x26')](_0x29adc0)['json'](_0x41fe1b);}};}function respondWithFilteredResult(_0x2a1602,_0x4bd6ed){return function(_0x325631){if(_0x325631){var _0x2bb2b5=typeof _0x4bd6ed['offset']===_0x0e8c('0x28')&&typeof _0x4bd6ed[_0x0e8c('0x29')]===_0x0e8c('0x28');var _0x3c5a53=_0x325631[_0x0e8c('0x2a')];var _0x122838=_0x2bb2b5?0x0:_0x4bd6ed[_0x0e8c('0x2b')];var _0xfa3b89=_0x2bb2b5?_0x325631[_0x0e8c('0x2a')]:_0x4bd6ed[_0x0e8c('0x2b')]+_0x4bd6ed[_0x0e8c('0x29')];var _0x24b9a2;if(_0xfa3b89>=_0x3c5a53){_0xfa3b89=_0x3c5a53;_0x24b9a2=0xc8;}else{_0x24b9a2=0xce;}_0x2a1602[_0x0e8c('0x26')](_0x24b9a2);return _0x2a1602['set']('Content-Range',_0x122838+'-'+_0xfa3b89+'/'+_0x3c5a53)['json'](_0x325631);}return null;};}function patchUpdates(_0xd7007c){return function(_0x19c15c){try{jsonpatch[_0x0e8c('0x2c')](_0x19c15c,_0xd7007c,!![]);}catch(_0x3c497b){return BPromise['reject'](_0x3c497b);}return _0x19c15c[_0x0e8c('0x2d')]();};}function saveUpdates(_0x247c66,_0x1d4215){return function(_0x579049){if(_0x579049){return _0x579049[_0x0e8c('0x2e')](_0x247c66)['then'](function(_0x235312){return _0x235312;});}return null;};}function removeEntity(_0x1b3fac,_0x391bd1){return function(_0x313db3){if(_0x313db3){return _0x313db3[_0x0e8c('0x2f')]()[_0x0e8c('0x1c')](function(){var _0x14138c=_0x313db3[_0x0e8c('0x30')]({'plain':!![]});var _0x54d8f3=_0x0e8c('0x31');return db['UserProfileResource'][_0x0e8c('0x2f')]({'where':{'type':_0x54d8f3,'resourceId':_0x14138c['id']}})[_0x0e8c('0x1c')](function(){return _0x313db3;});})[_0x0e8c('0x1c')](function(){_0x1b3fac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1682f1,_0x3bd9ab){return function(_0x47eb36){if(!_0x47eb36){_0x1682f1['sendStatus'](0x194);}return _0x47eb36;};}function handleError(_0x4e9d9f,_0x19d7b5){_0x19d7b5=_0x19d7b5||0x1f4;return function(_0x1fd385){logger[_0x0e8c('0x21')](_0x1fd385['stack']);if(_0x1fd385[_0x0e8c('0x32')]){delete _0x1fd385[_0x0e8c('0x32')];}_0x4e9d9f[_0x0e8c('0x26')](_0x19d7b5)['send'](_0x1fd385);};}exports[_0x0e8c('0x33')]=function(_0x3a7b9e,_0x5d6cdd){var _0x5f161c={'include':[{'model':db['Pause'],'as':_0x0e8c('0x34')}]},_0x23370c={},_0x1fbfdf={'count':0x0,'rows':[]};var _0x2a97ad=_['map'](db[_0x0e8c('0x35')][_0x0e8c('0x36')],function(_0x2d8170){return{'name':_0x2d8170[_0x0e8c('0x37')],'type':_0x2d8170[_0x0e8c('0x38')][_0x0e8c('0x39')]};});_0x23370c[_0x0e8c('0x3a')]=_['map'](_0x2a97ad,_0x0e8c('0x32'));_0x23370c[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x3a7b9e['query']);_0x23370c['filters']=_['intersection'](_0x23370c[_0x0e8c('0x3a')],_0x23370c[_0x0e8c('0x3b')]);_0x5f161c[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x23370c[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x3a7b9e[_0x0e8c('0x3b')]['fields']));_0x5f161c[_0x0e8c('0x3d')]=_0x5f161c['attributes']['length']?_0x5f161c[_0x0e8c('0x3d')]:_0x23370c[_0x0e8c('0x3a')];if(!_0x3a7b9e['query']['hasOwnProperty']('nolimit')){_0x5f161c[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x3a7b9e[_0x0e8c('0x3b')]['limit']);_0x5f161c[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0x5f161c[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x5f161c[_0x0e8c('0x42')]=qs['filters'](_[_0x0e8c('0x43')](_0x3a7b9e[_0x0e8c('0x3b')],_0x23370c[_0x0e8c('0x44')]),_0x2a97ad);if(_0x3a7b9e[_0x0e8c('0x3b')]['filter']){_0x5f161c[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0x5f161c['where'],{'$or':_['map'](_0x2a97ad,function(_0x187f3e){if(_0x187f3e[_0x0e8c('0x38')]!==_0x0e8c('0x46')){var _0x2878fa={};_0x2878fa[_0x187f3e[_0x0e8c('0x32')]]={'$like':'%'+_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x2878fa;}})});}_0x5f161c=_[_0x0e8c('0x45')]({},_0x5f161c,_0x3a7b9e['options']);var _0x4015e6={'where':_0x5f161c[_0x0e8c('0x42')]};return db[_0x0e8c('0x35')][_0x0e8c('0x2a')](_0x4015e6)[_0x0e8c('0x1c')](function(_0x1ca70d){_0x1fbfdf[_0x0e8c('0x2a')]=_0x1ca70d;if(_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x48')]){_0x5f161c[_0x0e8c('0x49')]=[{'all':!![]}];}return db[_0x0e8c('0x35')][_0x0e8c('0x4a')](_0x5f161c);})['then'](function(_0x417343){_0x1fbfdf['rows']=_0x417343;return _0x1fbfdf;})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x5d6cdd,_0x5f161c))[_0x0e8c('0x24')](handleError(_0x5d6cdd,null));};exports[_0x0e8c('0x4b')]=function(_0x234aed,_0x2d59c3){var _0x12e55a={'raw':![],'where':{'id':_0x234aed[_0x0e8c('0x4c')]['id']},'include':[{'model':db[_0x0e8c('0x4d')],'as':_0x0e8c('0x34')}]},_0x157963={};_0x157963[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x35')]['rawAttributes']);_0x157963['query']=_[_0x0e8c('0x3c')](_0x234aed[_0x0e8c('0x3b')]);_0x157963[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x157963['model'],_0x157963['query']);_0x12e55a[_0x0e8c('0x3d')]=_['intersection'](_0x157963['model'],qs[_0x0e8c('0x3f')](_0x234aed[_0x0e8c('0x3b')][_0x0e8c('0x3f')]));_0x12e55a['attributes']=_0x12e55a[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x12e55a[_0x0e8c('0x3d')]:_0x157963[_0x0e8c('0x3a')];if(_0x234aed[_0x0e8c('0x3b')]['includeAll']){_0x12e55a['include']=[{'all':!![]}];}_0x12e55a=_['merge']({},_0x12e55a,_0x234aed[_0x0e8c('0x4f')]);return db[_0x0e8c('0x35')][_0x0e8c('0x50')](_0x12e55a)[_0x0e8c('0x1c')](handleEntityNotFound(_0x2d59c3,null))[_0x0e8c('0x1c')](respondWithResult(_0x2d59c3,null))['catch'](handleError(_0x2d59c3,null));};exports[_0x0e8c('0x51')]=function(_0x2cb523,_0x3ba669){return db[_0x0e8c('0x35')][_0x0e8c('0x51')](_0x2cb523[_0x0e8c('0x52')],{})['then'](function(_0x576b8b){var _0x5a3eda=_0x2cb523[_0x0e8c('0x53')][_0x0e8c('0x30')]({'plain':!![]});if(!_0x5a3eda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a3eda[_0x0e8c('0x54')]===_0x0e8c('0x53')){var _0x3fd100=_0x576b8b[_0x0e8c('0x30')]({'plain':!![]});var _0x37cecf=_0x0e8c('0x31');return db[_0x0e8c('0x55')][_0x0e8c('0x50')]({'where':{'name':_0x37cecf,'userProfileId':_0x5a3eda[_0x0e8c('0x56')]},'raw':!![]})['then'](function(_0x525060){if(_0x525060&&_0x525060['autoAssociation']===0x0){return db[_0x0e8c('0x57')][_0x0e8c('0x51')]({'name':_0x3fd100[_0x0e8c('0x32')],'resourceId':_0x3fd100['id'],'type':_0x525060[_0x0e8c('0x32')],'sectionId':_0x525060['id']},{})[_0x0e8c('0x1c')](function(){return _0x576b8b;});}else{return _0x576b8b;}})['catch'](function(_0x1a89d2){logger[_0x0e8c('0x21')](_0x0e8c('0x58'),_0x1a89d2);throw _0x1a89d2;});}return _0x576b8b;})[_0x0e8c('0x1c')](respondWithResult(_0x3ba669,0xc9))[_0x0e8c('0x24')](handleError(_0x3ba669,null));};exports[_0x0e8c('0x2e')]=function(_0x166d8f,_0x17d4a8){if(_0x166d8f[_0x0e8c('0x52')]['id']){delete _0x166d8f[_0x0e8c('0x52')]['id'];}return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x166d8f[_0x0e8c('0x4c')]['id']},'include':[{'model':db[_0x0e8c('0x4d')],'as':_0x0e8c('0x34')}]})['then'](handleEntityNotFound(_0x17d4a8,null))[_0x0e8c('0x1c')](saveUpdates(_0x166d8f[_0x0e8c('0x52')],null))['then'](respondWithResult(_0x17d4a8,null))['catch'](handleError(_0x17d4a8,null));};exports[_0x0e8c('0x2f')]=function(_0x40001a,_0x13b1d6){return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x40001a['params']['id']}})['then'](handleEntityNotFound(_0x13b1d6,null))[_0x0e8c('0x1c')](removeEntity(_0x13b1d6,null))['catch'](handleError(_0x13b1d6,null));};exports[_0x0e8c('0x59')]=function(_0x3d6ea4,_0x4c5cfe){return db[_0x0e8c('0x35')][_0x0e8c('0x59')]()['then'](respondWithResult(_0x4c5cfe,null))[_0x0e8c('0x24')](handleError(_0x4c5cfe,null));};exports[_0x0e8c('0x5a')]=function(_0x34fb19,_0x102071,_0x129000){if(_0x34fb19[_0x0e8c('0x52')]['id']){delete _0x34fb19['body']['id'];}return db[_0x0e8c('0x35')]['find']({'where':{'id':_0x34fb19['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x102071,null))['then'](function(_0x226499){if(_0x226499){_0x34fb19[_0x0e8c('0x52')][_0x0e8c('0x5b')]=_0x226499['id'];return db[_0x0e8c('0x5c')][_0x0e8c('0x51')](_0x34fb19[_0x0e8c('0x52')]);}})['then'](respondWithResult(_0x102071,null))[_0x0e8c('0x24')](handleError(_0x102071,null));};exports['getDispositions']=function(_0xd41d9e,_0x278dab,_0x4b76d1){var _0xc912da={'raw':![],'where':{}};var _0x153023={};var _0x5ab76c={'count':0x0,'rows':[]};return db[_0x0e8c('0x35')]['findOne']({'where':{'id':_0xd41d9e[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x278dab,null))[_0x0e8c('0x1c')](function(_0x58c36e){if(_0x58c36e){_0x153023[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x5c')]['rawAttributes']);_0x153023[_0x0e8c('0x3b')]=_['keys'](_0xd41d9e['query']);_0x153023[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x153023[_0x0e8c('0x3a')],_0x153023[_0x0e8c('0x3b')]);_0xc912da[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x153023[_0x0e8c('0x3a')],qs['fields'](_0xd41d9e['query']['fields']));_0xc912da[_0x0e8c('0x3d')]=_0xc912da[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0xc912da[_0x0e8c('0x3d')]:_0x153023[_0x0e8c('0x3a')];if(!_0xd41d9e['query'][_0x0e8c('0x5d')](_0x0e8c('0x5e'))){_0xc912da[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x29')]);_0xc912da[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0xc912da[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0xc912da[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0xd41d9e[_0x0e8c('0x3b')],_0x153023[_0x0e8c('0x44')]));_0xc912da[_0x0e8c('0x42')]['SmsAccountId']=_0x58c36e['id'];if(_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x47')]){_0xc912da[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0xc912da[_0x0e8c('0x42')],{'$or':_[_0x0e8c('0x5f')](_0xc912da[_0x0e8c('0x3d')],function(_0x3ac5e0){var _0x553d18={};_0x553d18[_0x3ac5e0]={'$like':'%'+_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x553d18;})});}_0xc912da=_[_0x0e8c('0x45')]({},_0xc912da,_0xd41d9e[_0x0e8c('0x4f')]);return db[_0x0e8c('0x5c')][_0x0e8c('0x2a')]({'where':_0xc912da[_0x0e8c('0x42')]})[_0x0e8c('0x1c')](function(_0x4cebb6){_0x5ab76c[_0x0e8c('0x2a')]=_0x4cebb6;if(_0xd41d9e[_0x0e8c('0x3b')]['includeAll']){_0xc912da['include']=[{'all':!![]}];}return db['Disposition'][_0x0e8c('0x4a')](_0xc912da);})['then'](function(_0x411776){_0x5ab76c[_0x0e8c('0x60')]=_0x411776;return _0x5ab76c;});}})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x278dab,_0xc912da))[_0x0e8c('0x24')](handleError(_0x278dab,null));};exports[_0x0e8c('0x61')]=function(_0x4616ee,_0xc22339,_0x34d242){return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x4616ee['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0xc22339,null))[_0x0e8c('0x1c')](function(_0x27339c){if(_0x27339c){return _0x27339c[_0x0e8c('0x61')](_0x4616ee[_0x0e8c('0x3b')]['ids']);}})[_0x0e8c('0x1c')](respondWithStatusCode(_0xc22339,null))['catch'](handleError(_0xc22339,null));};exports[_0x0e8c('0x62')]=function(_0x371052,_0x59ec2e,_0x76865c){if(_0x371052['body']['id']){delete _0x371052[_0x0e8c('0x52')]['id'];}return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x371052['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x59ec2e,null))['then'](function(_0x3a318f){if(_0x3a318f){_0x371052[_0x0e8c('0x52')][_0x0e8c('0x5b')]=_0x3a318f['id'];return db[_0x0e8c('0x63')][_0x0e8c('0x51')](_0x371052[_0x0e8c('0x52')]);}})[_0x0e8c('0x1c')](respondWithResult(_0x59ec2e,null))[_0x0e8c('0x24')](handleError(_0x59ec2e,null));};exports[_0x0e8c('0x64')]=function(_0x14d962,_0x1eb660,_0x41fd13){var _0x4a74ef={'raw':![],'where':{}};var _0x2c5683={};var _0x4f7171={'count':0x0,'rows':[]};return db[_0x0e8c('0x35')]['findOne']({'where':{'id':_0x14d962[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x1eb660,null))[_0x0e8c('0x1c')](function(_0x12b8fe){if(_0x12b8fe){_0x2c5683[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x63')]['rawAttributes']);_0x2c5683[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x14d962[_0x0e8c('0x3b')]);_0x2c5683[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x2c5683['model'],_0x2c5683[_0x0e8c('0x3b')]);_0x4a74ef['attributes']=_[_0x0e8c('0x3e')](_0x2c5683[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x3f')]));_0x4a74ef[_0x0e8c('0x3d')]=_0x4a74ef[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x4a74ef['attributes']:_0x2c5683[_0x0e8c('0x3a')];if(!_0x14d962['query'][_0x0e8c('0x5d')](_0x0e8c('0x5e'))){_0x4a74ef[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x14d962['query'][_0x0e8c('0x29')]);_0x4a74ef[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0x4a74ef[_0x0e8c('0x40')]=qs['sort'](_0x14d962[_0x0e8c('0x3b')]['sort']);_0x4a74ef['where']=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x14d962[_0x0e8c('0x3b')],_0x2c5683[_0x0e8c('0x44')]));_0x4a74ef[_0x0e8c('0x42')][_0x0e8c('0x5b')]=_0x12b8fe['id'];if(_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x47')]){_0x4a74ef[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0x4a74ef[_0x0e8c('0x42')],{'$or':_[_0x0e8c('0x5f')](_0x4a74ef[_0x0e8c('0x3d')],function(_0x2e87b8){var _0x2b1fde={};_0x2b1fde[_0x2e87b8]={'$like':'%'+_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x2b1fde;})});}_0x4a74ef=_[_0x0e8c('0x45')]({},_0x4a74ef,_0x14d962[_0x0e8c('0x4f')]);return db[_0x0e8c('0x63')][_0x0e8c('0x2a')]({'where':_0x4a74ef[_0x0e8c('0x42')]})['then'](function(_0x319c8e){_0x4f7171[_0x0e8c('0x2a')]=_0x319c8e;if(_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x48')]){_0x4a74ef[_0x0e8c('0x49')]=[{'all':!![]}];}return db[_0x0e8c('0x63')][_0x0e8c('0x4a')](_0x4a74ef);})[_0x0e8c('0x1c')](function(_0x5c6d16){_0x4f7171[_0x0e8c('0x60')]=_0x5c6d16;return _0x4f7171;});}})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x1eb660,_0x4a74ef))[_0x0e8c('0x24')](handleError(_0x1eb660,null));};exports[_0x0e8c('0x65')]=function(_0x52039e,_0x763606,_0x25e393){return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x52039e['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x763606,null))[_0x0e8c('0x1c')](function(_0x30aea7){if(_0x30aea7){return _0x30aea7[_0x0e8c('0x65')](_0x52039e[_0x0e8c('0x3b')][_0x0e8c('0x66')]);}})[_0x0e8c('0x1c')](respondWithStatusCode(_0x763606,null))[_0x0e8c('0x24')](handleError(_0x763606,null));};exports[_0x0e8c('0x67')]=function(_0x4d7302,_0x40f583,_0x5de5d4){var _0x4c7e64={'channel':_0x0e8c('0x68')};var _0xc82e48=[];var _0x172c76=[];var _0x427e9c={};return db[_0x0e8c('0x35')]['find']({'where':{'id':_0x4d7302[_0x0e8c('0x4c')]['id']},'include':[{'model':db[_0x0e8c('0x69')],'as':'Applications'}]})[_0x0e8c('0x1c')](handleEntityNotFound(_0x40f583,null))[_0x0e8c('0x1c')](function(_0x3ab7ff){_0x4c7e64['account']=_0x3ab7ff;_0x4c7e64['applications']=_[_0x0e8c('0x6a')](_0x3ab7ff[_0x0e8c('0x6b')],[_0x0e8c('0x6c')],[_0x0e8c('0x6d')]);if(_0x4c7e64['account']['Applications']){delete _0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x6b')];}return db[_0x0e8c('0x6f')]['describe']();})[_0x0e8c('0x1c')](function(_0x251e44){if(!_0x251e44){throw new db[(_0x0e8c('0x70'))]['ValidationError'](_0x0e8c('0x71'));}_0xc82e48=_[_0x0e8c('0x72')](_[_0x0e8c('0x3c')](_0x251e44),['createdAt',_0x0e8c('0x73')]);_0x172c76=_[_0x0e8c('0x72')](_['keys'](_0x251e44),[_0x0e8c('0x74'),_0x0e8c('0x73'),_0x0e8c('0x75'),_0x0e8c('0x76')]);_0x4c7e64[_0x0e8c('0x52')]={'mapKey':_0x0e8c('0x77')};if(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x38')]){switch(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x38')]){case _0x0e8c('0x78'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7a')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7b')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7d')];break;case _0x0e8c('0x7e'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]='+'+_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7f')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['text'];break;case _0x0e8c('0x80'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302['body']['from'];_0x4c7e64['body'][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x23')];break;case _0x0e8c('0x81'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302['body']['from'];_0x4c7e64['body'][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x52')];_0x4c7e64[_0x0e8c('0x52')]['messageId']=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x82')];break;case _0x0e8c('0x83'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')]['From'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['Text'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x84')];break;case _0x0e8c('0x85'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]='+'+_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0][_0x0e8c('0x79')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['results'][0x0][_0x0e8c('0x87')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0]['messageId'];break;case'csc':_0x4c7e64['body']['from']=_0x4d7302[_0x0e8c('0x52')]['originatingAddress'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['segmentedMessage'][_0x0e8c('0x23')];break;case _0x0e8c('0x88'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x89')];_0x4c7e64['body'][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x87')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x8a')];break;case _0x0e8c('0x8b'):_0x4c7e64[_0x0e8c('0x52')]['messageId']=_0x4d7302['body'][0x0][_0x0e8c('0x23')]['id'];_0x4c7e64[_0x0e8c('0x52')]['from']=_0x4d7302[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')][_0x0e8c('0x79')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')][_0x0e8c('0x87')];break;case _0x0e8c('0x8c'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')]['from'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x23')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302['body'][_0x0e8c('0x8d')];break;}}if(_0x4c7e64[_0x0e8c('0x52')]['id']){delete _0x4c7e64[_0x0e8c('0x52')]['id'];}if(_[_0x0e8c('0x8e')](_0x4c7e64[_0x0e8c('0x52')]['from'])){throw new db['Sequelize'][(_0x0e8c('0x8f'))](_0x0e8c('0x90'));}if(_[_0x0e8c('0x8e')](_0x4c7e64['body']['body'])||_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]===''){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0e8c('0x8e')](_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x91')])){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))](_0x0e8c('0x92')+_0x172c76);}if(!_[_0x0e8c('0x93')](_0x172c76,_0x4c7e64[_0x0e8c('0x52')]['mapKey'])){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))](_0x0e8c('0x94')+_0x172c76);}_0x427e9c[_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x91')]]=_0x4c7e64[_0x0e8c('0x52')]['from'];return db[_0x0e8c('0x95')][_0x0e8c('0x50')]({'where':{'id':_0x4c7e64['account']['ListId']},'include':[{'model':db[_0x0e8c('0x6f')],'as':_0x0e8c('0x96'),'where':_0x427e9c,'limit':0x1,'order':[[_0x0e8c('0x73'),_0x0e8c('0x97')]]}]});})[_0x0e8c('0x1c')](handleEntityNotFound(_0x40f583,null))['then'](function(_0x5e9840){if(_0x5e9840){_0x4c7e64[_0x0e8c('0x98')]=_[_0x0e8c('0x99')](_0x5e9840,['Contacts']);if(_0x5e9840[_0x0e8c('0x96')][_0x0e8c('0x4e')]){return _0x5e9840[_0x0e8c('0x96')][0x0];}var _0x5679f7=_[_0x0e8c('0x15')](_0x4c7e64[_0x0e8c('0x52')],{'firstName':_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')],'ListId':_0x5e9840['id']});_0x5679f7[_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x91')]]=_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')];return db[_0x0e8c('0x6f')][_0x0e8c('0x51')](_0x5679f7,{'fields':_0xc82e48,'raw':!![]});}})['then'](handleEntityNotFound(_0x40f583,null))['then'](function(_0x48f90e){if(_0x48f90e){_0x4c7e64[_0x0e8c('0x9a')]=_0x48f90e;var _0x2e8ede={'ContactId':_0x48f90e['id'],'phone':_0x4c7e64['body'][_0x0e8c('0x79')],'SmsAccountId':_0x4d7302[_0x0e8c('0x4c')]['id']};var _0x5be97a={'ContactId':_0x48f90e['id'],'SmsAccountId':_0x4d7302['params']['id'],'closed':![]};return db[_0x0e8c('0x9b')]['find']({'where':_0x5be97a})[_0x0e8c('0x1c')](function(_0x156d19){if(_0x156d19){return[_0x156d19,![]];}return db[_0x0e8c('0x9b')][_0x0e8c('0x51')](_0x2e8ede)[_0x0e8c('0x1c')](function(_0x5c9b03){return[_0x5c9b03,!![]];});});}})[_0x0e8c('0x9c')](function(_0x430ae4,_0x5ba27b){_0x4c7e64[_0x0e8c('0x9d')]=_0x430ae4[_0x0e8c('0x30')]({'plain':!![]});_0x4c7e64[_0x0e8c('0x9d')][_0x0e8c('0x9e')]=![];if(_0x5ba27b){if(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x9f')]){_0x4c7e64['applications']['push']({'id':0x0,'priority':_0x4c7e64[_0x0e8c('0xa0')]['length']+0x1,'app':_0x0e8c('0xa1'),'appdata':_0x0e8c('0xa2'),'interval':_0x0e8c('0xa3')});}_0x4c7e64[_0x0e8c('0x9d')][_0x0e8c('0x9e')]=!![];}return db[_0x0e8c('0xa4')]['create']({'phone':_0x4c7e64[_0x0e8c('0x52')]['from'],'messageId':_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')],'body':_0x4c7e64[_0x0e8c('0x52')]['body'],'SmsAccountId':_0x4d7302[_0x0e8c('0x4c')]['id'],'SmsInteractionId':_0x430ae4['id'],'direction':'in','ContactId':_0x430ae4[_0x0e8c('0xa5')],'AttachmentId':_0x4c7e64[_0x0e8c('0x52')]['AttachmentId']});})[_0x0e8c('0x1c')](function(_0x42b682){_0x4c7e64[_0x0e8c('0x23')]=_0x42b682;if(!_0x4c7e64['interaction']['UserId'])return;return db[_0x0e8c('0xa6')][_0x0e8c('0x50')]({'attributes':['id',_0x0e8c('0x32')],'where':{'id':_0x4c7e64[_0x0e8c('0x9d')][_0x0e8c('0xa7')]}});})['then'](function(_0x21f1aa){if(_0x21f1aa){_0x4c7e64[_0x0e8c('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0e8c('0xa8'),'appdata':_0x21f1aa[_0x0e8c('0x32')]+','+(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0xa9')]||0xa),'interval':_0x0e8c('0xa3')});}if(!_0x4c7e64['interaction']['queueId'])return;return db[_0x0e8c('0xaa')][_0x0e8c('0x50')]({'attributes':['id',_0x0e8c('0x32')],'where':{'id':_0x4c7e64[_0x0e8c('0x9d')]['queueId']}});})['then'](function(_0xc2f879){if(_0xc2f879){_0x4c7e64[_0x0e8c('0xa0')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0e8c('0xab'),'appdata':_0xc2f879['name']+','+(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0xac')]||0x12c),'interval':_0x0e8c('0xa3')});}return respondWithRpcPromise('Start',_0x0e8c('0xad'),_0x4c7e64);})['then'](function(_0x520b34){if(_0x520b34){var _0xf549e6=0xc8;var _0x39408f=_0x0e8c('0xae');logger[_0x0e8c('0x1d')](_0x0e8c('0xaf'),_0x39408f,_0xf549e6,_0x0e8c('0xb0'));logger[_0x0e8c('0xb1')](_0x0e8c('0xb2'),_0x39408f,_0xf549e6,_0x0e8c('0xb0'),JSON[_0x0e8c('0x20')](_0x520b34));if(_0x4c7e64[_0x0e8c('0x6e')]['type']===_0x0e8c('0x78')){return _0x40f583[_0x0e8c('0x26')](_0xf549e6)[_0x0e8c('0xb3')](_0x0e8c('0xb4'),_0x0e8c('0xb5'))[_0x0e8c('0xb6')]('\x0a');}else{return _0x40f583[_0x0e8c('0x26')](_0xf549e6)[_0x0e8c('0xb7')](_0x520b34);}}})[_0x0e8c('0x24')](handleError(_0x40f583,null));};exports[_0x0e8c('0xb8')]=function(_0x2c6dd4,_0x35a0e9){var _0x1ac446=_0x2c6dd4[_0x0e8c('0x4c')]['id'];var _0x13edac=_0x2c6dd4[_0x0e8c('0x52')];var _0x51c472=0xc8;var _0x47881b=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0e8c('0xb9')][_0x0e8c('0xba')][_0x0e8c('0xbb')][_0x0e8c('0xbc')]},function(_0xd2f972){return db[_0x0e8c('0x35')][_0x0e8c('0xbd')]({'where':{'id':_0x1ac446},'transaction':_0xd2f972})[_0x0e8c('0x1c')](function(_0x4149b0){if(_0x4149b0){return db[_0x0e8c('0x69')][_0x0e8c('0x2f')]({'where':{'SmsAccountId':_0x1ac446},'transaction':_0xd2f972})[_0x0e8c('0x1c')](function(){var _0x42e896=_[_0x0e8c('0x5f')](_0x13edac,function(_0x271133){_0x271133[_0x0e8c('0x5b')]=_0x1ac446;return _0x271133;});return db[_0x0e8c('0x69')][_0x0e8c('0xbe')](_0x42e896,{'transaction':_0xd2f972});});}else{_0x51c472=0x194;_0x47881b=[];}});})[_0x0e8c('0x1c')](function(){if(_0x51c472!==0x194){return db[_0x0e8c('0x69')]['findAndCountAll']({'where':{'SmsAccountId':_0x1ac446},'order':_0x0e8c('0x6c')})[_0x0e8c('0x1c')](function(_0x82095d){_0x47881b=_0x82095d;});}})[_0x0e8c('0x24')](function(_0xd500a0){_0x51c472=0x1f4;logger[_0x0e8c('0x21')](_0xd500a0['stack']);if(_0xd500a0[_0x0e8c('0x32')]){delete _0xd500a0[_0x0e8c('0x32')];}_0x47881b=_0xd500a0;})[_0x0e8c('0xbf')](function(){if(_0x47881b===null){_0x35a0e9[_0x0e8c('0x25')](_0x51c472);}else{if(_0x51c472===0x1f4){_0x35a0e9[_0x0e8c('0x26')](_0x51c472)[_0x0e8c('0xb6')](_0x47881b);}else{_0x35a0e9[_0x0e8c('0x26')](_0x51c472)['json'](_0x47881b);}}});};exports[_0x0e8c('0xc0')]=function(_0x31cacf,_0x3fbcc8,_0x4393d2){var _0x151276={};var _0x248c5f={};var _0x2d96c2;var _0x4a9ac3;return db['SmsAccount'][_0x0e8c('0xbd')]({'where':{'id':_0x31cacf[_0x0e8c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3fbcc8,null))[_0x0e8c('0x1c')](function(_0x186baa){if(_0x186baa){_0x2d96c2=_0x186baa;_0x248c5f['model']=_['keys'](db[_0x0e8c('0x69')][_0x0e8c('0x36')]);_0x248c5f['query']=_['keys'](_0x31cacf['query']);_0x248c5f[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x248c5f[_0x0e8c('0x3a')],_0x248c5f['query']);_0x151276[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x248c5f[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x31cacf['query']['fields']));_0x151276[_0x0e8c('0x3d')]=_0x151276[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x151276['attributes']:_0x248c5f['model'];_0x151276[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0x31cacf[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x151276[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x31cacf[_0x0e8c('0x3b')],_0x248c5f[_0x0e8c('0x44')]));if(_0x31cacf[_0x0e8c('0x3b')]['filter']){_0x151276[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0x151276[_0x0e8c('0x42')],{'$or':_['map'](_0x151276[_0x0e8c('0x3d')],function(_0x44ffac){var _0x164a79={};_0x164a79[_0x44ffac]={'$like':'%'+_0x31cacf[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x164a79;})});}_0x151276=_[_0x0e8c('0x45')]({},_0x151276,_0x31cacf['options']);return _0x2d96c2[_0x0e8c('0xc0')](_0x151276);}})[_0x0e8c('0x1c')](function(_0x40bb17){if(_0x40bb17){_0x4a9ac3=_0x40bb17['length'];if(!_0x31cacf[_0x0e8c('0x3b')][_0x0e8c('0x5d')](_0x0e8c('0x5e'))){_0x151276[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x31cacf[_0x0e8c('0x3b')]['limit']);_0x151276[_0x0e8c('0x2b')]=qs['offset'](_0x31cacf[_0x0e8c('0x3b')]['offset']);}return _0x2d96c2[_0x0e8c('0xc0')](_0x151276);}})['then'](function(_0x139983){if(_0x139983){return _0x139983?{'count':_0x4a9ac3,'rows':_0x139983}:null;}})[_0x0e8c('0x1c')](respondWithResult(_0x3fbcc8,null))[_0x0e8c('0x24')](handleError(_0x3fbcc8,null));};exports[_0x0e8c('0xc1')]=function(_0x29d480,_0x1d5b8b,_0x54d516){var _0x377fda={'raw':![],'where':{}};var _0x4c70e5={};var _0x3a3374={'count':0x0,'rows':[]};return db[_0x0e8c('0x35')][_0x0e8c('0xbd')]({'where':{'id':_0x29d480[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x1d5b8b,null))[_0x0e8c('0x1c')](function(_0xc527ac){if(_0xc527ac){_0x4c70e5[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x9b')]['rawAttributes']);_0x4c70e5[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x29d480[_0x0e8c('0x3b')]);_0x4c70e5[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x4c70e5['model'],_0x4c70e5[_0x0e8c('0x3b')]);_0x377fda[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x4c70e5['model'],qs['fields'](_0x29d480['query'][_0x0e8c('0x3f')]));_0x377fda[_0x0e8c('0x3d')]=_0x377fda[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x377fda['attributes']:_0x4c70e5[_0x0e8c('0x3a')];if(!_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x5d')]('nolimit')){_0x377fda[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x29')]);_0x377fda[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0x377fda[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x377fda[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x29d480[_0x0e8c('0x3b')],_0x4c70e5['filters']));_0x377fda['where']['SmsAccountId']=_0xc527ac['id'];if(_0x29d480[_0x0e8c('0x3b')]['filter']){_0x377fda[_0x0e8c('0x42')]=_['merge'](_0x377fda[_0x0e8c('0x42')],{'$or':_['map'](_0x377fda['attributes'],function(_0x19a8e6){var _0x565f26={};_0x565f26[_0x19a8e6]={'$like':'%'+_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x565f26;})});}_0x377fda=_[_0x0e8c('0x45')]({},_0x377fda,_0x29d480[_0x0e8c('0x4f')]);return db['SmsInteraction']['count']({'where':_0x377fda['where']})[_0x0e8c('0x1c')](function(_0x1518e4){_0x3a3374[_0x0e8c('0x2a')]=_0x1518e4;if(_0x29d480[_0x0e8c('0x3b')]['includeAll']){_0x377fda[_0x0e8c('0x49')]=[{'model':db[_0x0e8c('0x6f')],'as':'Contact','required':![]},{'model':db[_0x0e8c('0xa6')],'as':_0x0e8c('0xc2'),'attributes':['name',_0x0e8c('0xc3'),_0x0e8c('0xc4')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x0e8c('0xc5')],'where':_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0xc6')]?{'id':_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0xc6')]}:undefined,'required':_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0xc6')]?!![]:![]}];}return db[_0x0e8c('0x9b')][_0x0e8c('0x4a')](_0x377fda);})[_0x0e8c('0x1c')](function(_0x2f28cf){_0x3a3374['rows']=_0x2f28cf;return _0x3a3374;});}})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x1d5b8b,_0x377fda))['catch'](handleError(_0x1d5b8b,null));};exports['send']=function(_0x276c78,_0x278106,_0x531e9a){var _0x2a2cfa,_0x2fba83,_0x18c0d0;if(_[_0x0e8c('0x8e')](_0x276c78[_0x0e8c('0x52')]['body'])||_0x276c78['body'][_0x0e8c('0x52')]===''){throw new db[(_0x0e8c('0x70'))]['ValidationError'](_0x0e8c('0xc7'));}if(_[_0x0e8c('0x8e')](_0x276c78['body']['to'])){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))]('to\x20is\x20mandatory');}_0x2a2cfa=_0x276c78[_0x0e8c('0x52')]['to'];return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x276c78['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0e8c('0x6f')],'as':_0x0e8c('0x96'),'where':{'mobile':_0x2a2cfa},'limit':0x1,'order':[[_0x0e8c('0x73'),_0x0e8c('0x97')]]}]}]})[_0x0e8c('0x1c')](handleEntityNotFound(_0x278106,null))[_0x0e8c('0x1c')](function(_0xef926c){if(_0xef926c&&_0xef926c[_0x0e8c('0xc8')]){_0x2fba83=_0xef926c[_0x0e8c('0x30')]({'plain':!![]});if(_0x2fba83[_0x0e8c('0xc8')]&&_0x2fba83[_0x0e8c('0xc8')]['Contacts'][_0x0e8c('0x4e')]){return _0x2fba83['List']['Contacts'][0x0];}return db[_0x0e8c('0x6f')][_0x0e8c('0x51')](_[_0x0e8c('0x15')](_0x276c78['body'],{'firstName':_0x2a2cfa,'mobile':_0x2a2cfa,'phone':_0x2a2cfa,'ListId':_0x2fba83[_0x0e8c('0x76')]}));}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x278106,null))[_0x0e8c('0x1c')](function(_0x4861ea){if(_0x4861ea){_0x18c0d0=_0x4861ea;return db[_0x0e8c('0x9b')][_0x0e8c('0x50')]({'where':{'ContactId':_0x18c0d0['id'],'closed':![],'SmsAccountId':_0x2fba83['id']}})[_0x0e8c('0x1c')](function(_0x1f12f2){if(_0x1f12f2){return[_0x1f12f2,![]];}return db['SmsInteraction'][_0x0e8c('0x51')]({'UserId':_0x276c78[_0x0e8c('0x53')]['id'],'ContactId':_0x18c0d0['id'],'SmsAccountId':_0x2fba83['id'],'phone':_0x2a2cfa,'firstMsgDirection':'out','Messages':[_[_0x0e8c('0x45')](_0x276c78[_0x0e8c('0x52')],{'read':![],'body':_0x276c78[_0x0e8c('0x52')][_0x0e8c('0x52')],'phone':_0x2a2cfa,'SmsAccountId':_0x2fba83['id'],'UserId':_0x276c78[_0x0e8c('0x53')]['id'],'ContactId':_0x18c0d0['id']})]},{'include':[{'model':db[_0x0e8c('0xa4')],'as':_0x0e8c('0xc9')}]})[_0x0e8c('0x1c')](function(_0x390611){return[_0x390611,!![]];});});}})[_0x0e8c('0x9c')](function(_0x1ba45c,_0x9c1e59){if(_0x9c1e59){return _0x1ba45c;}return db[_0x0e8c('0xa4')]['create'](_[_0x0e8c('0x45')](_0x276c78['body'],{'read':![],'body':_0x276c78[_0x0e8c('0x52')]['body'],'phone':_0x2a2cfa,'SmsAccountId':_0x2fba83['id'],'SmsInteractionId':_0x1ba45c['id'],'UserId':_0x276c78[_0x0e8c('0x53')]['id'],'ContactId':_0x18c0d0['id']}))[_0x0e8c('0x1c')](function(_0x53f038){_0x1ba45c[_0x0e8c('0xca')][_0x0e8c('0xc9')]=[];_0x1ba45c[_0x0e8c('0xca')][_0x0e8c('0xc9')]['push'](_0x53f038[_0x0e8c('0xca')]);return _0x1ba45c;});})[_0x0e8c('0x1c')](respondWithResult(_0x278106,null))[_0x0e8c('0x24')](handleError(_0x278106,null));};exports[_0x0e8c('0x26')]=function(_0x2094d4,_0x41abea,_0x2b7adb){if(_0x2094d4[_0x0e8c('0x52')]['id']){delete _0x2094d4['body']['id'];}var _0x4d8b95,_0xd37f4f,_0x383c04;return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x2094d4[_0x0e8c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41abea,null))[_0x0e8c('0x1c')](function(_0x471a9b){if(_0x471a9b){_0x383c04=_0x471a9b;logger[_0x0e8c('0xb1')](_0x0e8c('0xaf'),_0x0e8c('0x26'),'received\x20delivery\x20report\x20from',_0x471a9b['type'],util[_0x0e8c('0xcb')](_0x2094d4['body'],{'showHidden':![],'depth':null}));switch(_0x471a9b[_0x0e8c('0x38')]){case _0x0e8c('0x7e'):if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xcc')]&&_0x2094d4[_0x0e8c('0x52')]['status']){_0xd37f4f=_0x2094d4['body'][_0x0e8c('0x26')];return db[_0x0e8c('0xa4')]['find']({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')]['skebby_dispatch_id']}});}break;case _0x0e8c('0x80'):if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xcd')]&&_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xce')]){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xce')];return db[_0x0e8c('0xa4')][_0x0e8c('0x50')]({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xcd')]}});}break;case _0x0e8c('0x81'):if(_0x2094d4['body'][_0x0e8c('0x82')]&&_0x2094d4[_0x0e8c('0x52')]['status_code']){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')]['status_code'];return db['SmsMessage'][_0x0e8c('0x50')]({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x82')]}});}break;case _0x0e8c('0x85'):var _0x46dd6d=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0];if(_0x46dd6d['messageId']&&_0x46dd6d[_0x0e8c('0x26')][_0x0e8c('0xcf')]===_0x0e8c('0xd0')){_0xd37f4f=_0x46dd6d[_0x0e8c('0x26')][_0x0e8c('0xcf')];return db[_0x0e8c('0xa4')][_0x0e8c('0x50')]({'where':{'messageId':_0x46dd6d[_0x0e8c('0x7c')]}});}break;case _0x0e8c('0x88'):if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x7c')]&&_0x2094d4['body'][_0x0e8c('0x26')]){_0xd37f4f=_0x2094d4['body'][_0x0e8c('0x26')];return db[_0x0e8c('0xa4')][_0x0e8c('0x50')]({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x7c')]}});}break;case _0x0e8c('0x8b'):if(_0x2094d4[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')]['id']){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')][0x0]['type'];return db[_0x0e8c('0xa4')]['find']({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')]['id']}});}break;case'intelepeer':if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xd1')]&&_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x26')]){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x26')];return db[_0x0e8c('0xa4')]['find']({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xd1')]}});}break;}}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x41abea,null))[_0x0e8c('0x1c')](function(_0x41adc6){if(_0x41adc6){_0x4d8b95=_0x41adc6;switch(_0x383c04[_0x0e8c('0x38')]){case'skebby':if(_0xd37f4f===_0x0e8c('0xd0')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger['error'](_0x0e8c('0xaf'),'status',_0x0e8c('0x7e'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case _0x0e8c('0x80'):if(_0xd37f4f==='1'){return _0x4d8b95['update']({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),'status','skebby',util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case _0x0e8c('0x81'):if(!_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xd2')]&&_0xd37f4f>=0xc8&&_0xd37f4f<=0xce){return _0x4d8b95['update']({'read':!![]});}else{logger[_0x0e8c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e8c('0x26'),'clicksend',util[_0x0e8c('0xcb')](_0x2094d4['body'],{'showHidden':![],'depth':null}));}break;case _0x0e8c('0x85'):var _0x362c1e=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0];if(_0x362c1e[_0x0e8c('0x26')]['groupName']===_0x0e8c('0xd0')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),_0x0e8c('0x26'),_0x0e8c('0x85'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xd37f4f==_0x0e8c('0xd3')||_0xd37f4f==_0x0e8c('0xd4')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),_0x0e8c('0x26'),_0x0e8c('0x88'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xd37f4f=='message-delivered'){return _0x4d8b95['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0e8c('0x8b'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xd37f4f===_0x0e8c('0xd5')||_0xd37f4f===_0x0e8c('0xd6')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),_0x0e8c('0x26'),'intelepeer',util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x4d8b95;}})[_0x0e8c('0x1c')](respondWithResult(_0x41abea,null))['catch'](handleError(_0x41abea,null));};exports[_0x0e8c('0xd7')]=function(_0x1bf31a,_0x3eb50f,_0xf1c716){var _0x3b6fe8,_0x2257d6,_0x5aa4af;return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x1bf31a['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x3eb50f,null))['then'](function(_0x39858d){if(_0x39858d){_0x5aa4af=_0x39858d;logger[_0x0e8c('0xb1')](_0x0e8c('0xaf'),'status',_0x0e8c('0xd8'),_0x39858d[_0x0e8c('0x38')],util[_0x0e8c('0xcb')](_0x1bf31a[_0x0e8c('0x3b')],{'showHidden':![],'depth':null}));switch(_0x39858d['type']){case _0x0e8c('0xd9'):if(_0x1bf31a[_0x0e8c('0x3b')][_0x0e8c('0xda')]&&_0x1bf31a[_0x0e8c('0x3b')][_0x0e8c('0xdb')]){_0x2257d6=_0x1bf31a['query'][_0x0e8c('0xdb')];return db['SmsMessage']['find']({'where':{'messageId':_0x1bf31a[_0x0e8c('0x3b')][_0x0e8c('0xda')]}});}break;}}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x3eb50f,null))[_0x0e8c('0x1c')](function(_0x496e00){if(_0x496e00){_0x3b6fe8=_0x496e00;switch(_0x5aa4af[_0x0e8c('0x38')]){case _0x0e8c('0xd9'):if(_0x2257d6==='2'||_0x2257d6==='6'){return _0x3b6fe8['update']({'read':!![]});}else{logger[_0x0e8c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e8c('0x26'),'csc',util[_0x0e8c('0xcb')](_0x1bf31a['query'],{'showHidden':![],'depth':null}));};break;}return _0x3b6fe8;}})[_0x0e8c('0x1c')](respondWithResult(_0x3eb50f,null))['catch'](handleError(_0x3eb50f,null));};exports[_0x0e8c('0xdc')]=function(_0x458b9d,_0x1e5e81,_0x183e4d){return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x458b9d['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x1e5e81,null))['then'](function(_0x1a806){if(_0x1a806){return _0x1a806[_0x0e8c('0xdc')](_0x458b9d[_0x0e8c('0x52')][_0x0e8c('0x66')],_['omit'](_0x458b9d[_0x0e8c('0x52')],['ids','id'])||{})[_0x0e8c('0x9c')](function(_0x51b9df){for(var _0x48883d=0x0;_0x48883d<_0x458b9d[_0x0e8c('0x52')][_0x0e8c('0x66')][_0x0e8c('0x4e')];_0x48883d+=0x1){socket[_0x0e8c('0xdd')](_0x0e8c('0xde'),{'UserId':Number(_0x458b9d['body'][_0x0e8c('0x66')][_0x48883d]),'SmsAccountId':Number(_0x458b9d[_0x0e8c('0x4c')]['id'])});}return _0x51b9df;});}})[_0x0e8c('0x1c')](respondWithResult(_0x1e5e81,null))[_0x0e8c('0x24')](handleError(_0x1e5e81,null));};exports[_0x0e8c('0xdf')]=function(_0x2aefa3,_0x120296,_0x123a8a){return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x2aefa3[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x120296,null))['then'](function(_0x5e96ee){if(_0x5e96ee){return _0x5e96ee[_0x0e8c('0xdf')](_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')])[_0x0e8c('0x1c')](function(){if(_['isArray'](_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')])){for(var _0x49e21c=0x0;_0x49e21c<_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')][_0x0e8c('0x4e')];_0x49e21c+=0x1){socket[_0x0e8c('0xdd')](_0x0e8c('0xe0'),{'UserId':Number(_0x2aefa3['query'][_0x0e8c('0x66')][_0x49e21c]),'SmsAccountId':Number(_0x2aefa3[_0x0e8c('0x4c')]['id'])});}}else{socket[_0x0e8c('0xdd')](_0x0e8c('0xe0'),{'UserId':Number(_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')]),'SmsAccountId':Number(_0x2aefa3[_0x0e8c('0x4c')]['id'])});}});}})[_0x0e8c('0x1c')](respondWithStatusCode(_0x120296,null))['catch'](handleError(_0x120296,null));};exports[_0x0e8c('0xe1')]=function(_0x2f2bb0,_0x187547,_0x4dd8ab){var _0x3b5aab={};var _0xf3d419={};var _0x236b24;var _0x21dd1d;return db['SmsAccount'][_0x0e8c('0xbd')]({'where':{'id':_0x2f2bb0[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x187547,null))[_0x0e8c('0x1c')](function(_0x280bc6){if(_0x280bc6){_0x236b24=_0x280bc6;_0xf3d419[_0x0e8c('0x3a')]=_['keys'](db[_0x0e8c('0xa6')]['rawAttributes']);_0xf3d419[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x2f2bb0[_0x0e8c('0x3b')]);_0xf3d419[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0xf3d419[_0x0e8c('0x3a')],_0xf3d419['query']);_0x3b5aab[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0xf3d419[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x3f')]));_0x3b5aab[_0x0e8c('0x3d')]=_0x3b5aab['attributes']['length']?_0x3b5aab[_0x0e8c('0x3d')]:_0xf3d419[_0x0e8c('0x3a')];_0x3b5aab[_0x0e8c('0x40')]=qs['sort'](_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x3b5aab[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x2f2bb0['query'],_0xf3d419[_0x0e8c('0x44')]));if(_0x2f2bb0[_0x0e8c('0x3b')]['filter']){_0x3b5aab['where']=_[_0x0e8c('0x45')](_0x3b5aab[_0x0e8c('0x42')],{'$or':_[_0x0e8c('0x5f')](_0x3b5aab[_0x0e8c('0x3d')],function(_0x4a5fba){var _0x1350aa={};_0x1350aa[_0x4a5fba]={'$like':'%'+_0x2f2bb0[_0x0e8c('0x3b')]['filter']+'%'};return _0x1350aa;})});}_0x3b5aab=_[_0x0e8c('0x45')]({},_0x3b5aab,_0x2f2bb0[_0x0e8c('0x4f')]);return _0x236b24['getAgents'](_0x3b5aab);}})['then'](function(_0x1133b6){if(_0x1133b6){_0x21dd1d=_0x1133b6['length'];if(!_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x5d')]('nolimit')){_0x3b5aab['limit']=qs[_0x0e8c('0x29')](_0x2f2bb0['query'][_0x0e8c('0x29')]);_0x3b5aab[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}return _0x236b24[_0x0e8c('0xe1')](_0x3b5aab);}})[_0x0e8c('0x1c')](function(_0x1f7456){if(_0x1f7456){return _0x1f7456?{'count':_0x21dd1d,'rows':_0x1f7456}:null;}})[_0x0e8c('0x1c')](respondWithResult(_0x187547,null))['catch'](handleError(_0x187547,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 85aab50..b6fc56b 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 _0xef00=['emit','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x4bd127,_0x5dec0a){var _0x54e870=function(_0x31d453){while(--_0x31d453){_0x4bd127['push'](_0x4bd127['shift']());}};_0x54e870(++_0x5dec0a);}(_0xef00,0x80));var _0x0ef0=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xef00[_0x346737];return _0x1ade2e;};'use strict';var EventEmitter=require(_0x0ef0('0x0'));var SmsAccount=require(_0x0ef0('0x1'))['db'][_0x0ef0('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0ef0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e7028){return function(_0x127a91,_0x9a4bd9,_0x5c2ed7){SmsAccountEvents[_0x0ef0('0x4')](_0x1e7028+':'+_0x127a91['id'],_0x127a91);SmsAccountEvents['emit'](_0x1e7028,_0x127a91);_0x5c2ed7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x0ef0('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0x29a8=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4d058e,_0x3949a3){var _0x8a4b55=function(_0x5a52dd){while(--_0x5a52dd){_0x4d058e['push'](_0x4d058e['shift']());}};_0x8a4b55(++_0x3949a3);}(_0x29a8,0x105));var _0x829a=function(_0x4f13f8,_0x5e13c5){_0x4f13f8=_0x4f13f8-0x0;var _0x1e6b83=_0x29a8[_0x4f13f8];return _0x1e6b83;};'use strict';var EventEmitter=require(_0x829a('0x0'));var SmsAccount=require(_0x829a('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x829a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x829a('0x3')};function emitEvent(_0x57e3ed){return function(_0x31c83b,_0xf26d59,_0x1e81b9){SmsAccountEvents[_0x829a('0x4')](_0x57e3ed+':'+_0x31c83b['id'],_0x31c83b);SmsAccountEvents[_0x829a('0x4')](_0x57e3ed,_0x31c83b);_0x1e81b9(null);};}for(var e in events){if(events[_0x829a('0x5')](e)){var event=events[e];SmsAccount[_0x829a('0x6')](e,emitEvent(event));}}module[_0x829a('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c487e0c..f63e907 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 _0xa89f=['sms_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xa89f,0x7f));var _0xfa89=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0xa89f[_0x57fa33];return _0x12e724;};'use strict';var _=require('lodash');var util=require(_0xfa89('0x0'));var logger=require(_0xfa89('0x1'))(_0xfa89('0x2'));var moment=require(_0xfa89('0x3'));var BPromise=require(_0xfa89('0x4'));var rp=require(_0xfa89('0x5'));var fs=require('fs');var path=require(_0xfa89('0x6'));var rimraf=require(_0xfa89('0x7'));var config=require(_0xfa89('0x8'));var attributes=require(_0xfa89('0x9'));module[_0xfa89('0xa')]=function(_0xcc7886,_0x461a0e){return _0xcc7886[_0xfa89('0xb')](_0xfa89('0xc'),attributes,{'tableName':_0xfa89('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b3=['api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','lodash','util'];(function(_0x44c37d,_0x19119f){var _0x29e087=function(_0x327fca){while(--_0x327fca){_0x44c37d['push'](_0x44c37d['shift']());}};_0x29e087(++_0x19119f);}(_0xc2b3,0xf0));var _0x3c2b=function(_0x46abd9,_0x470c14){_0x46abd9=_0x46abd9-0x0;var _0x20e6ac=_0xc2b3[_0x46abd9];return _0x20e6ac;};'use strict';var _=require(_0x3c2b('0x0'));var util=require(_0x3c2b('0x1'));var logger=require('../../config/logger')(_0x3c2b('0x2'));var moment=require(_0x3c2b('0x3'));var BPromise=require(_0x3c2b('0x4'));var rp=require(_0x3c2b('0x5'));var fs=require('fs');var path=require(_0x3c2b('0x6'));var rimraf=require('rimraf');var config=require(_0x3c2b('0x7'));var attributes=require(_0x3c2b('0x8'));module['exports']=function(_0x10ddff,_0x18e153){return _0x10ddff[_0x3c2b('0x9')](_0x3c2b('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 3b18378..05e96c5 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 _0xd1b5=['options','where','attributes','include','map','model','debug','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ShowSmsAccount','SmsAccount','find','raw'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd1b5,0x19f));var _0x5d1b=function(_0x23b2b5,_0x418537){_0x23b2b5=_0x23b2b5-0x0;var _0x1031da=_0xd1b5[_0x23b2b5];return _0x1031da;};'use strict';var _=require('lodash');var util=require(_0x5d1b('0x0'));var moment=require('moment');var BPromise=require(_0x5d1b('0x1'));var rs=require(_0x5d1b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5d1b('0x3'));var logger=require(_0x5d1b('0x4'))(_0x5d1b('0x5'));var config=require(_0x5d1b('0x6'));var jayson=require(_0x5d1b('0x7'));var client=jayson[_0x5d1b('0x8')][_0x5d1b('0x9')]({'port':0x232a});config['redis']=_[_0x5d1b('0xa')](config['redis'],{'host':_0x5d1b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d1b('0xc')]));require('./smsAccount.socket')[_0x5d1b('0xd')](socket);function respondWithRpcPromise(_0x4b29df,_0x668e5a,_0x131bf8){return new BPromise(function(_0x1f603a,_0x378aae){return client[_0x5d1b('0xe')](_0x4b29df,_0x131bf8)[_0x5d1b('0xf')](function(_0xfd40ff){logger[_0x5d1b('0x10')](_0x5d1b('0x11'),_0x668e5a,_0x5d1b('0x12'));logger['debug'](_0x5d1b('0x13'),_0x668e5a,_0x5d1b('0x12'),JSON[_0x5d1b('0x14')](_0xfd40ff));if(_0xfd40ff[_0x5d1b('0x15')]){if(_0xfd40ff['error']['code']===0x1f4){logger[_0x5d1b('0x15')](_0x5d1b('0x11'),_0x668e5a,_0xfd40ff['error'][_0x5d1b('0x16')]);return _0x378aae(_0xfd40ff[_0x5d1b('0x15')]['message']);}logger['error'](_0x5d1b('0x11'),_0x668e5a,_0xfd40ff[_0x5d1b('0x15')][_0x5d1b('0x16')]);return _0x1f603a(_0xfd40ff[_0x5d1b('0x15')][_0x5d1b('0x16')]);}else{logger[_0x5d1b('0x10')](_0x5d1b('0x11'),_0x668e5a,_0x5d1b('0x12'));_0x1f603a(_0xfd40ff['result'][_0x5d1b('0x16')]);}})['catch'](function(_0x51a9fc){logger[_0x5d1b('0x15')]('SmsAccount,\x20%s,\x20%s',_0x668e5a,_0x51a9fc);_0x378aae(_0x51a9fc);});});}exports[_0x5d1b('0x17')]=function(_0x2b6895){var _0xcfa9d1=this;return new Promise(function(_0x41a135,_0x16f05d){return db[_0x5d1b('0x18')][_0x5d1b('0x19')]({'raw':_0x2b6895['options']?_0x2b6895['options'][_0x5d1b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b6895[_0x5d1b('0x1b')]?_0x2b6895[_0x5d1b('0x1b')][_0x5d1b('0x1c')]||null:null,'attributes':_0x2b6895[_0x5d1b('0x1b')]?_0x2b6895[_0x5d1b('0x1b')][_0x5d1b('0x1d')]||null:null,'include':_0x2b6895[_0x5d1b('0x1b')]?_0x2b6895[_0x5d1b('0x1b')][_0x5d1b('0x1e')]?_[_0x5d1b('0x1f')](_0x2b6895['options'][_0x5d1b('0x1e')],function(_0x188e1b){return{'model':db[_0x188e1b[_0x5d1b('0x20')]],'as':_0x188e1b['as'],'attributes':_0x188e1b[_0x5d1b('0x1d')],'include':_0x188e1b[_0x5d1b('0x1e')]?_[_0x5d1b('0x1f')](_0x188e1b[_0x5d1b('0x1e')],function(_0x14c68a){return{'model':db[_0x14c68a[_0x5d1b('0x20')]],'as':_0x14c68a['as'],'attributes':_0x14c68a[_0x5d1b('0x1d')],'include':_0x14c68a[_0x5d1b('0x1e')]?_[_0x5d1b('0x1f')](_0x14c68a[_0x5d1b('0x1e')],function(_0x4f41c3){return{'model':db[_0x4f41c3[_0x5d1b('0x20')]],'as':_0x4f41c3['as'],'attributes':_0x4f41c3[_0x5d1b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5d1b('0xf')](function(_0x4a2863){logger[_0x5d1b('0x10')](_0x5d1b('0x17'),_0x2b6895);logger[_0x5d1b('0x21')](_0x5d1b('0x17'),_0x2b6895,JSON[_0x5d1b('0x14')](_0x4a2863));_0x41a135(_0x4a2863);})['catch'](function(_0x207836){logger['error'](_0x5d1b('0x17'),_0x207836[_0x5d1b('0x16')],_0x2b6895);_0x16f05d(_0xcfa9d1[_0x5d1b('0x15')](0x1f4,_0x207836[_0x5d1b('0x16')]));});});}; \ No newline at end of file +var _0x6fbd=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6fbd,0x16b));var _0xd6fb=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x6fbd[_0x3df9dd];return _0x4f11e4;};'use strict';var _=require(_0xd6fb('0x0'));var util=require('util');var moment=require(_0xd6fb('0x1'));var BPromise=require('bluebird');var rs=require(_0xd6fb('0x2'));var fs=require('fs');var Redis=require(_0xd6fb('0x3'));var db=require(_0xd6fb('0x4'))['db'];var utils=require(_0xd6fb('0x5'));var logger=require('../../config/logger')(_0xd6fb('0x6'));var config=require('../../config/environment');var jayson=require(_0xd6fb('0x7'));var client=jayson[_0xd6fb('0x8')][_0xd6fb('0x9')]({'port':0x232a});config[_0xd6fb('0xa')]=_[_0xd6fb('0xb')](config[_0xd6fb('0xa')],{'host':_0xd6fb('0xc'),'port':0x18eb});var socket=require(_0xd6fb('0xd'))(new Redis(config[_0xd6fb('0xa')]));require(_0xd6fb('0xe'))[_0xd6fb('0xf')](socket);function respondWithRpcPromise(_0x1782aa,_0x266672,_0x5c72c2){return new BPromise(function(_0x35a662,_0x1ac657){return client[_0xd6fb('0x10')](_0x1782aa,_0x5c72c2)[_0xd6fb('0x11')](function(_0x1fc8c7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x266672,_0xd6fb('0x12'));logger[_0xd6fb('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x266672,_0xd6fb('0x12'),JSON[_0xd6fb('0x14')](_0x1fc8c7));if(_0x1fc8c7[_0xd6fb('0x15')]){if(_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x16')]===0x1f4){logger[_0xd6fb('0x15')](_0xd6fb('0x17'),_0x266672,_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x18')]);return _0x1ac657(_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x18')]);}logger[_0xd6fb('0x15')](_0xd6fb('0x17'),_0x266672,_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x18')]);return _0x35a662(_0x1fc8c7['error'][_0xd6fb('0x18')]);}else{logger[_0xd6fb('0x19')](_0xd6fb('0x17'),_0x266672,_0xd6fb('0x12'));_0x35a662(_0x1fc8c7[_0xd6fb('0x1a')]['message']);}})[_0xd6fb('0x1b')](function(_0x404f22){logger['error'](_0xd6fb('0x17'),_0x266672,_0x404f22);_0x1ac657(_0x404f22);});});}exports[_0xd6fb('0x1c')]=function(_0x36d222){var _0x346609=this;return new Promise(function(_0x4e41b7,_0x549ec9){return db[_0xd6fb('0x1d')][_0xd6fb('0x1e')]({'raw':_0x36d222[_0xd6fb('0x1f')]?_0x36d222['options'][_0xd6fb('0x20')]===undefined?!![]:![]:!![],'where':_0x36d222[_0xd6fb('0x1f')]?_0x36d222[_0xd6fb('0x1f')]['where']||null:null,'attributes':_0x36d222[_0xd6fb('0x1f')]?_0x36d222['options'][_0xd6fb('0x21')]||null:null,'include':_0x36d222[_0xd6fb('0x1f')]?_0x36d222[_0xd6fb('0x1f')][_0xd6fb('0x22')]?_['map'](_0x36d222[_0xd6fb('0x1f')][_0xd6fb('0x22')],function(_0x4911fa){return{'model':db[_0x4911fa[_0xd6fb('0x23')]],'as':_0x4911fa['as'],'attributes':_0x4911fa[_0xd6fb('0x21')],'include':_0x4911fa['include']?_[_0xd6fb('0x24')](_0x4911fa['include'],function(_0x31a446){return{'model':db[_0x31a446['model']],'as':_0x31a446['as'],'attributes':_0x31a446[_0xd6fb('0x21')],'include':_0x31a446[_0xd6fb('0x22')]?_[_0xd6fb('0x24')](_0x31a446['include'],function(_0x2818ef){return{'model':db[_0x2818ef['model']],'as':_0x2818ef['as'],'attributes':_0x2818ef[_0xd6fb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd6fb('0x11')](function(_0x4c7972){logger[_0xd6fb('0x19')]('ShowSmsAccount',_0x36d222);logger[_0xd6fb('0x13')](_0xd6fb('0x1c'),_0x36d222,JSON[_0xd6fb('0x14')](_0x4c7972));_0x4e41b7(_0x4c7972);})[_0xd6fb('0x1b')](function(_0x218c0b){logger['error'](_0xd6fb('0x1c'),_0x218c0b[_0xd6fb('0x18')],_0x36d222);_0x549ec9(_0x346609['error'](0x1f4,_0x218c0b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 755e13c..f5bd360 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 3cc1b4e..56ad2e2 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3b154f,_0x14fd22){var _0xe53d42=function(_0x408d23){while(--_0x408d23){_0x3b154f['push'](_0x3b154f['shift']());}};_0xe53d42(++_0x14fd22);}(_0x3e74,0x175));var _0x43e7=function(_0x5f49cc,_0x2011d3){_0x5f49cc=_0x5f49cc-0x0;var _0x569927=_0x3e74[_0x5f49cc];return _0x569927;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x212668,_0x4bb833){var _0x11c9e1=function(_0x531c93){while(--_0x531c93){_0x212668['push'](_0x212668['shift']());}};_0x11c9e1(++_0x4bb833);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index dd89866..54f67bf 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 _0x8270=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4ee09b,_0x27ca3f){var _0x4bc9f8=function(_0x1f0754){while(--_0x1f0754){_0x4ee09b['push'](_0x4ee09b['shift']());}};_0x4bc9f8(++_0x27ca3f);}(_0x8270,0xce));var _0x0827=function(_0x273969,_0x343043){_0x273969=_0x273969-0x0;var _0x10a284=_0x8270[_0x273969];return _0x10a284;};'use strict';var Sequelize=require(_0x0827('0x0'));module[_0x0827('0x1')]={'priority':{'type':Sequelize[_0x0827('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0827('0x3')],'allowNull':![],'defaultValue':_0x0827('0x4')},'appdata':{'type':Sequelize[_0x0827('0x5')]()},'description':{'type':Sequelize[_0x0827('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0827('0x6')}}; \ No newline at end of file +var _0x7457=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0xd0a7c4,_0x41dd01){var _0x23f1d2=function(_0x1a55f7){while(--_0x1a55f7){_0xd0a7c4['push'](_0xd0a7c4['shift']());}};_0x23f1d2(++_0x41dd01);}(_0x7457,0x159));var _0x7745=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x7457[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require(_0x7745('0x0'));module[_0x7745('0x1')]={'priority':{'type':Sequelize[_0x7745('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7745('0x3')},'appdata':{'type':Sequelize[_0x7745('0x4')]()},'description':{'type':Sequelize[_0x7745('0x5')]},'interval':{'type':Sequelize[_0x7745('0x5')],'defaultValue':_0x7745('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index eaa15b4..90a97ec 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 _0xcd79=['end','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','error','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x12ead1,_0x1dd6d3){var _0xb8e16b=function(_0x3479d8){while(--_0x3479d8){_0x12ead1['push'](_0x12ead1['shift']());}};_0xb8e16b(++_0x1dd6d3);}(_0xcd79,0x1e4));var _0x9cd7=function(_0x583437,_0x5d5f78){_0x583437=_0x583437-0x0;var _0x3c8232=_0xcd79[_0x583437];return _0x3c8232;};'use strict';var emlformat=require(_0x9cd7('0x0'));var rimraf=require(_0x9cd7('0x1'));var zipdir=require(_0x9cd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cd7('0x3'));var moment=require(_0x9cd7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9cd7('0x5'));var util=require(_0x9cd7('0x6'));var path=require(_0x9cd7('0x7'));var sox=require(_0x9cd7('0x8'));var csv=require(_0x9cd7('0x9'));var ejs=require(_0x9cd7('0xa'));var fs=require('fs');var fs_extra=require(_0x9cd7('0xb'));var _=require(_0x9cd7('0xc'));var squel=require(_0x9cd7('0xd'));var crypto=require(_0x9cd7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9cd7('0xf'));var toCsv=require(_0x9cd7('0x9'));var querystring=require(_0x9cd7('0x10'));var Papa=require(_0x9cd7('0x11'));var Redis=require(_0x9cd7('0x12'));var authService=require(_0x9cd7('0x13'));var qs=require(_0x9cd7('0x14'));var as=require(_0x9cd7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9cd7('0x16'));var utils=require('../../config/utils');var config=require(_0x9cd7('0x17'));var licenseUtil=require(_0x9cd7('0x18'));var db=require(_0x9cd7('0x19'))['db'];function respondWithStatusCode(_0x6b5526,_0x8104ef){_0x8104ef=_0x8104ef||0xcc;return function(_0x56f4a9){if(_0x56f4a9){return _0x6b5526['sendStatus'](_0x8104ef);}return _0x6b5526[_0x9cd7('0x1a')](_0x8104ef)[_0x9cd7('0x1b')]();};}function respondWithResult(_0xddf90f,_0x2f382a){_0x2f382a=_0x2f382a||0xc8;return function(_0x45af16){if(_0x45af16){return _0xddf90f[_0x9cd7('0x1a')](_0x2f382a)['json'](_0x45af16);}};}function respondWithFilteredResult(_0x1cd3f3,_0x37a3dc){return function(_0xd0a5e7){if(_0xd0a5e7){var _0x118a75=typeof _0x37a3dc[_0x9cd7('0x1c')]===_0x9cd7('0x1d')&&typeof _0x37a3dc[_0x9cd7('0x1e')]===_0x9cd7('0x1d');var _0x140207=_0xd0a5e7[_0x9cd7('0x1f')];var _0x300db2=_0x118a75?0x0:_0x37a3dc[_0x9cd7('0x1c')];var _0x478ef1=_0x118a75?_0xd0a5e7['count']:_0x37a3dc[_0x9cd7('0x1c')]+_0x37a3dc[_0x9cd7('0x1e')];var _0x488854;if(_0x478ef1>=_0x140207){_0x478ef1=_0x140207;_0x488854=0xc8;}else{_0x488854=0xce;}_0x1cd3f3['status'](_0x488854);return _0x1cd3f3[_0x9cd7('0x20')]('Content-Range',_0x300db2+'-'+_0x478ef1+'/'+_0x140207)['json'](_0xd0a5e7);}return null;};}function patchUpdates(_0x4a2af9){return function(_0x3e3f74){try{jsonpatch['apply'](_0x3e3f74,_0x4a2af9,!![]);}catch(_0x528c1d){return BPromise[_0x9cd7('0x21')](_0x528c1d);}return _0x3e3f74[_0x9cd7('0x22')]();};}function saveUpdates(_0x5c35f9,_0x4bc6ec){return function(_0x1a4179){if(_0x1a4179){return _0x1a4179['update'](_0x5c35f9)[_0x9cd7('0x23')](function(_0x3df815){return _0x3df815;});}return null;};}function removeEntity(_0x284688,_0x4ae19a){return function(_0x1d998b){if(_0x1d998b){return _0x1d998b[_0x9cd7('0x24')]()[_0x9cd7('0x23')](function(){_0x284688[_0x9cd7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x185231,_0x322d64){return function(_0xb89b13){if(!_0xb89b13){_0x185231[_0x9cd7('0x25')](0x194);}return _0xb89b13;};}function handleError(_0x2e6c62,_0x124932){_0x124932=_0x124932||0x1f4;return function(_0x23271f){logger[_0x9cd7('0x26')](_0x23271f['stack']);if(_0x23271f[_0x9cd7('0x27')]){delete _0x23271f[_0x9cd7('0x27')];}_0x2e6c62[_0x9cd7('0x1a')](_0x124932)[_0x9cd7('0x28')](_0x23271f);};}exports['index']=function(_0x443e85,_0x359f4a){var _0x16b894={},_0x53e209={},_0x527a62={'count':0x0,'rows':[]};var _0x1bf103=_[_0x9cd7('0x29')](db[_0x9cd7('0x2a')][_0x9cd7('0x2b')],function(_0x5dac2f){return{'name':_0x5dac2f[_0x9cd7('0x2c')],'type':_0x5dac2f['type'][_0x9cd7('0x2d')]};});_0x53e209[_0x9cd7('0x2e')]=_[_0x9cd7('0x29')](_0x1bf103,_0x9cd7('0x27'));_0x53e209[_0x9cd7('0x2f')]=_[_0x9cd7('0x30')](_0x443e85['query']);_0x53e209['filters']=_[_0x9cd7('0x31')](_0x53e209[_0x9cd7('0x2e')],_0x53e209[_0x9cd7('0x2f')]);_0x16b894[_0x9cd7('0x32')]=_['intersection'](_0x53e209[_0x9cd7('0x2e')],qs[_0x9cd7('0x33')](_0x443e85[_0x9cd7('0x2f')][_0x9cd7('0x33')]));_0x16b894['attributes']=_0x16b894[_0x9cd7('0x32')][_0x9cd7('0x34')]?_0x16b894[_0x9cd7('0x32')]:_0x53e209[_0x9cd7('0x2e')];if(!_0x443e85['query']['hasOwnProperty']('nolimit')){_0x16b894[_0x9cd7('0x1e')]=qs[_0x9cd7('0x1e')](_0x443e85[_0x9cd7('0x2f')][_0x9cd7('0x1e')]);_0x16b894[_0x9cd7('0x1c')]=qs[_0x9cd7('0x1c')](_0x443e85[_0x9cd7('0x2f')][_0x9cd7('0x1c')]);}_0x16b894[_0x9cd7('0x35')]=qs['sort'](_0x443e85[_0x9cd7('0x2f')][_0x9cd7('0x36')]);_0x16b894[_0x9cd7('0x37')]=qs[_0x9cd7('0x38')](_[_0x9cd7('0x39')](_0x443e85[_0x9cd7('0x2f')],_0x53e209['filters']),_0x1bf103);if(_0x443e85[_0x9cd7('0x2f')][_0x9cd7('0x3a')]){_0x16b894[_0x9cd7('0x37')]=_[_0x9cd7('0x3b')](_0x16b894[_0x9cd7('0x37')],{'$or':_[_0x9cd7('0x29')](_0x1bf103,function(_0x2f6234){if(_0x2f6234[_0x9cd7('0x3c')]!==_0x9cd7('0x3d')){var _0x40b6ae={};_0x40b6ae[_0x2f6234[_0x9cd7('0x27')]]={'$like':'%'+_0x443e85['query'][_0x9cd7('0x3a')]+'%'};return _0x40b6ae;}})});}_0x16b894=_[_0x9cd7('0x3b')]({},_0x16b894,_0x443e85[_0x9cd7('0x3e')]);var _0x18774b={'where':_0x16b894[_0x9cd7('0x37')]};return db[_0x9cd7('0x2a')][_0x9cd7('0x1f')](_0x18774b)[_0x9cd7('0x23')](function(_0x3161fd){_0x527a62[_0x9cd7('0x1f')]=_0x3161fd;if(_0x443e85[_0x9cd7('0x2f')][_0x9cd7('0x3f')]){_0x16b894[_0x9cd7('0x40')]=[{'all':!![]}];}return db[_0x9cd7('0x2a')][_0x9cd7('0x41')](_0x16b894);})[_0x9cd7('0x23')](function(_0x570286){_0x527a62['rows']=_0x570286;return _0x527a62;})['then'](respondWithFilteredResult(_0x359f4a,_0x16b894))['catch'](handleError(_0x359f4a,null));};exports[_0x9cd7('0x42')]=function(_0x49149e,_0x274ea8){var _0xa954ff={'raw':!![],'where':{'id':_0x49149e['params']['id']}},_0x2107e1={};_0x2107e1[_0x9cd7('0x2e')]=_[_0x9cd7('0x30')](db[_0x9cd7('0x2a')][_0x9cd7('0x2b')]);_0x2107e1[_0x9cd7('0x2f')]=_[_0x9cd7('0x30')](_0x49149e[_0x9cd7('0x2f')]);_0x2107e1[_0x9cd7('0x38')]=_[_0x9cd7('0x31')](_0x2107e1[_0x9cd7('0x2e')],_0x2107e1[_0x9cd7('0x2f')]);_0xa954ff[_0x9cd7('0x32')]=_['intersection'](_0x2107e1[_0x9cd7('0x2e')],qs[_0x9cd7('0x33')](_0x49149e['query'][_0x9cd7('0x33')]));_0xa954ff['attributes']=_0xa954ff[_0x9cd7('0x32')][_0x9cd7('0x34')]?_0xa954ff[_0x9cd7('0x32')]:_0x2107e1[_0x9cd7('0x2e')];if(_0x49149e[_0x9cd7('0x2f')][_0x9cd7('0x3f')]){_0xa954ff[_0x9cd7('0x40')]=[{'all':!![]}];}_0xa954ff=_[_0x9cd7('0x3b')]({},_0xa954ff,_0x49149e[_0x9cd7('0x3e')]);return db[_0x9cd7('0x2a')][_0x9cd7('0x43')](_0xa954ff)[_0x9cd7('0x23')](handleEntityNotFound(_0x274ea8,null))[_0x9cd7('0x23')](respondWithResult(_0x274ea8,null))[_0x9cd7('0x44')](handleError(_0x274ea8,null));};exports[_0x9cd7('0x45')]=function(_0x3ea1f2,_0x15c0cb){return db[_0x9cd7('0x2a')][_0x9cd7('0x45')](_0x3ea1f2[_0x9cd7('0x46')],{})[_0x9cd7('0x23')](respondWithResult(_0x15c0cb,0xc9))['catch'](handleError(_0x15c0cb,null));};exports[_0x9cd7('0x47')]=function(_0x52b3cf,_0x5c2049){if(_0x52b3cf['body']['id']){delete _0x52b3cf['body']['id'];}return db['SmsApplication'][_0x9cd7('0x43')]({'where':{'id':_0x52b3cf['params']['id']}})['then'](handleEntityNotFound(_0x5c2049,null))[_0x9cd7('0x23')](saveUpdates(_0x52b3cf['body'],null))[_0x9cd7('0x23')](respondWithResult(_0x5c2049,null))[_0x9cd7('0x44')](handleError(_0x5c2049,null));};exports[_0x9cd7('0x24')]=function(_0x25dd8f,_0xd5382c){return db[_0x9cd7('0x2a')][_0x9cd7('0x43')]({'where':{'id':_0x25dd8f[_0x9cd7('0x48')]['id']}})['then'](handleEntityNotFound(_0xd5382c,null))['then'](removeEntity(_0xd5382c,null))[_0x9cd7('0x44')](handleError(_0xd5382c,null));}; \ No newline at end of file +var _0xe090=['limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','SmsApplication','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x1f9bf7,_0x559dcf){var _0x3fd8f5=function(_0x5c1c07){while(--_0x5c1c07){_0x1f9bf7['push'](_0x1f9bf7['shift']());}};_0x3fd8f5(++_0x559dcf);}(_0xe090,0x77));var _0x0e09=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xe090[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e09('0x0'));var zipdir=require(_0x0e09('0x1'));var jsonpatch=require(_0x0e09('0x2'));var rp=require(_0x0e09('0x3'));var moment=require(_0x0e09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e09('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0e09('0x6'));var csv=require(_0x0e09('0x7'));var ejs=require(_0x0e09('0x8'));var fs=require('fs');var fs_extra=require(_0x0e09('0x9'));var _=require(_0x0e09('0xa'));var squel=require(_0x0e09('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e09('0xc'));var deskjs=require(_0x0e09('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0e09('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e09('0xf'));var authService=require(_0x0e09('0x10'));var qs=require(_0x0e09('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e09('0x12'));var logger=require(_0x0e09('0x13'))(_0x0e09('0x14'));var utils=require('../../config/utils');var config=require(_0x0e09('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e09('0x16'))['db'];function respondWithStatusCode(_0x3933be,_0x850990){_0x850990=_0x850990||0xcc;return function(_0x2ce74b){if(_0x2ce74b){return _0x3933be[_0x0e09('0x17')](_0x850990);}return _0x3933be[_0x0e09('0x18')](_0x850990)[_0x0e09('0x19')]();};}function respondWithResult(_0x429d4d,_0x58ff94){_0x58ff94=_0x58ff94||0xc8;return function(_0x46d376){if(_0x46d376){return _0x429d4d[_0x0e09('0x18')](_0x58ff94)[_0x0e09('0x1a')](_0x46d376);}};}function respondWithFilteredResult(_0x25872c,_0x1568a3){return function(_0x38d108){if(_0x38d108){var _0x13b233=typeof _0x1568a3[_0x0e09('0x1b')]===_0x0e09('0x1c')&&typeof _0x1568a3[_0x0e09('0x1d')]===_0x0e09('0x1c');var _0x11ca7e=_0x38d108['count'];var _0x2fca4c=_0x13b233?0x0:_0x1568a3[_0x0e09('0x1b')];var _0x1f61ad=_0x13b233?_0x38d108[_0x0e09('0x1e')]:_0x1568a3[_0x0e09('0x1b')]+_0x1568a3['limit'];var _0x567cbe;if(_0x1f61ad>=_0x11ca7e){_0x1f61ad=_0x11ca7e;_0x567cbe=0xc8;}else{_0x567cbe=0xce;}_0x25872c[_0x0e09('0x18')](_0x567cbe);return _0x25872c[_0x0e09('0x1f')](_0x0e09('0x20'),_0x2fca4c+'-'+_0x1f61ad+'/'+_0x11ca7e)[_0x0e09('0x1a')](_0x38d108);}return null;};}function patchUpdates(_0x40fdcb){return function(_0x239841){try{jsonpatch[_0x0e09('0x21')](_0x239841,_0x40fdcb,!![]);}catch(_0x18d51b){return BPromise['reject'](_0x18d51b);}return _0x239841[_0x0e09('0x22')]();};}function saveUpdates(_0x97daab,_0x290010){return function(_0x63e868){if(_0x63e868){return _0x63e868['update'](_0x97daab)['then'](function(_0xe026fe){return _0xe026fe;});}return null;};}function removeEntity(_0x22ac59,_0x378feb){return function(_0xa752c4){if(_0xa752c4){return _0xa752c4[_0x0e09('0x23')]()[_0x0e09('0x24')](function(){_0x22ac59[_0x0e09('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aa90b,_0x20fdfb){return function(_0x2347bb){if(!_0x2347bb){_0x2aa90b['sendStatus'](0x194);}return _0x2347bb;};}function handleError(_0xb34635,_0x5b2217){_0x5b2217=_0x5b2217||0x1f4;return function(_0x298049){logger[_0x0e09('0x25')](_0x298049[_0x0e09('0x26')]);if(_0x298049[_0x0e09('0x27')]){delete _0x298049[_0x0e09('0x27')];}_0xb34635[_0x0e09('0x18')](_0x5b2217)[_0x0e09('0x28')](_0x298049);};}exports[_0x0e09('0x29')]=function(_0x17f7cc,_0x21bc21){var _0x24ada1={},_0x220e05={},_0x2979e5={'count':0x0,'rows':[]};var _0x13c9cd=_['map'](db[_0x0e09('0x2a')]['rawAttributes'],function(_0x3e25a2){return{'name':_0x3e25a2[_0x0e09('0x2b')],'type':_0x3e25a2['type'][_0x0e09('0x2c')]};});_0x220e05[_0x0e09('0x2d')]=_['map'](_0x13c9cd,_0x0e09('0x27'));_0x220e05[_0x0e09('0x2e')]=_[_0x0e09('0x2f')](_0x17f7cc[_0x0e09('0x2e')]);_0x220e05[_0x0e09('0x30')]=_[_0x0e09('0x31')](_0x220e05[_0x0e09('0x2d')],_0x220e05[_0x0e09('0x2e')]);_0x24ada1[_0x0e09('0x32')]=_[_0x0e09('0x31')](_0x220e05[_0x0e09('0x2d')],qs[_0x0e09('0x33')](_0x17f7cc['query'][_0x0e09('0x33')]));_0x24ada1[_0x0e09('0x32')]=_0x24ada1[_0x0e09('0x32')]['length']?_0x24ada1[_0x0e09('0x32')]:_0x220e05[_0x0e09('0x2d')];if(!_0x17f7cc['query'][_0x0e09('0x34')](_0x0e09('0x35'))){_0x24ada1[_0x0e09('0x1d')]=qs['limit'](_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x1d')]);_0x24ada1[_0x0e09('0x1b')]=qs[_0x0e09('0x1b')](_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x1b')]);}_0x24ada1['order']=qs[_0x0e09('0x36')](_0x17f7cc['query']['sort']);_0x24ada1[_0x0e09('0x37')]=qs['filters'](_['pick'](_0x17f7cc[_0x0e09('0x2e')],_0x220e05[_0x0e09('0x30')]),_0x13c9cd);if(_0x17f7cc['query'][_0x0e09('0x38')]){_0x24ada1[_0x0e09('0x37')]=_[_0x0e09('0x39')](_0x24ada1[_0x0e09('0x37')],{'$or':_[_0x0e09('0x3a')](_0x13c9cd,function(_0x3b2f18){if(_0x3b2f18[_0x0e09('0x3b')]!==_0x0e09('0x3c')){var _0xc9e9ed={};_0xc9e9ed[_0x3b2f18['name']]={'$like':'%'+_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x38')]+'%'};return _0xc9e9ed;}})});}_0x24ada1=_[_0x0e09('0x39')]({},_0x24ada1,_0x17f7cc['options']);var _0x5061ca={'where':_0x24ada1['where']};return db['SmsApplication'][_0x0e09('0x1e')](_0x5061ca)['then'](function(_0x633354){_0x2979e5['count']=_0x633354;if(_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x3d')]){_0x24ada1[_0x0e09('0x3e')]=[{'all':!![]}];}return db[_0x0e09('0x2a')][_0x0e09('0x3f')](_0x24ada1);})[_0x0e09('0x24')](function(_0x4c05bd){_0x2979e5[_0x0e09('0x40')]=_0x4c05bd;return _0x2979e5;})['then'](respondWithFilteredResult(_0x21bc21,_0x24ada1))[_0x0e09('0x41')](handleError(_0x21bc21,null));};exports[_0x0e09('0x42')]=function(_0x29c51e,_0x1170cd){var _0xe5549c={'raw':!![],'where':{'id':_0x29c51e['params']['id']}},_0x172d3a={};_0x172d3a[_0x0e09('0x2d')]=_['keys'](db[_0x0e09('0x2a')]['rawAttributes']);_0x172d3a[_0x0e09('0x2e')]=_['keys'](_0x29c51e[_0x0e09('0x2e')]);_0x172d3a[_0x0e09('0x30')]=_[_0x0e09('0x31')](_0x172d3a['model'],_0x172d3a[_0x0e09('0x2e')]);_0xe5549c[_0x0e09('0x32')]=_[_0x0e09('0x31')](_0x172d3a[_0x0e09('0x2d')],qs[_0x0e09('0x33')](_0x29c51e[_0x0e09('0x2e')][_0x0e09('0x33')]));_0xe5549c['attributes']=_0xe5549c[_0x0e09('0x32')][_0x0e09('0x43')]?_0xe5549c[_0x0e09('0x32')]:_0x172d3a[_0x0e09('0x2d')];if(_0x29c51e[_0x0e09('0x2e')]['includeAll']){_0xe5549c['include']=[{'all':!![]}];}_0xe5549c=_['merge']({},_0xe5549c,_0x29c51e[_0x0e09('0x44')]);return db[_0x0e09('0x2a')][_0x0e09('0x45')](_0xe5549c)[_0x0e09('0x24')](handleEntityNotFound(_0x1170cd,null))[_0x0e09('0x24')](respondWithResult(_0x1170cd,null))['catch'](handleError(_0x1170cd,null));};exports[_0x0e09('0x46')]=function(_0x57ac90,_0x37dd3c){return db[_0x0e09('0x2a')][_0x0e09('0x46')](_0x57ac90['body'],{})[_0x0e09('0x24')](respondWithResult(_0x37dd3c,0xc9))[_0x0e09('0x41')](handleError(_0x37dd3c,null));};exports[_0x0e09('0x47')]=function(_0x11cae3,_0x229623){if(_0x11cae3[_0x0e09('0x48')]['id']){delete _0x11cae3[_0x0e09('0x48')]['id'];}return db[_0x0e09('0x2a')][_0x0e09('0x45')]({'where':{'id':_0x11cae3[_0x0e09('0x49')]['id']}})['then'](handleEntityNotFound(_0x229623,null))[_0x0e09('0x24')](saveUpdates(_0x11cae3[_0x0e09('0x48')],null))['then'](respondWithResult(_0x229623,null))[_0x0e09('0x41')](handleError(_0x229623,null));};exports[_0x0e09('0x23')]=function(_0x42c005,_0x4be11a){return db[_0x0e09('0x2a')][_0x0e09('0x45')]({'where':{'id':_0x42c005[_0x0e09('0x49')]['id']}})[_0x0e09('0x24')](handleEntityNotFound(_0x4be11a,null))[_0x0e09('0x24')](removeEntity(_0x4be11a,null))[_0x0e09('0x41')](handleError(_0x4be11a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index da337f1..755d11d 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 _0xde79=['../../config/environment','exports','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x5697e1,_0x5eb7d8){var _0x3eb42d=function(_0x5965d2){while(--_0x5965d2){_0x5697e1['push'](_0x5697e1['shift']());}};_0x3eb42d(++_0x5eb7d8);}(_0xde79,0x10d));var _0x9de7=function(_0x56c511,_0x119083){_0x56c511=_0x56c511-0x0;var _0x3dd699=_0xde79[_0x56c511];return _0x3dd699;};'use strict';var _=require(_0x9de7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9de7('0x1'));var BPromise=require(_0x9de7('0x2'));var rp=require(_0x9de7('0x3'));var fs=require('fs');var path=require(_0x9de7('0x4'));var rimraf=require(_0x9de7('0x5'));var config=require(_0x9de7('0x6'));var attributes=require('./smsApplication.attributes');module[_0x9de7('0x7')]=function(_0x4df9e0,_0x333f09){return _0x4df9e0['define'](_0x9de7('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9de7('0x9'),'collate':_0x9de7('0xa')});}; \ No newline at end of file +var _0xb50e=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','sms_applications'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xb50e,0xc6));var _0xeb50=function(_0x4c9cc4,_0x1b6528){_0x4c9cc4=_0x4c9cc4-0x0;var _0x4384fb=_0xb50e[_0x4c9cc4];return _0x4384fb;};'use strict';var _=require(_0xeb50('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb50('0x1'));var moment=require(_0xeb50('0x2'));var BPromise=require(_0xeb50('0x3'));var rp=require(_0xeb50('0x4'));var fs=require('fs');var path=require(_0xeb50('0x5'));var rimraf=require('rimraf');var config=require(_0xeb50('0x6'));var attributes=require('./smsApplication.attributes');module[_0xeb50('0x7')]=function(_0x4f254e,_0x5ed529){return _0x4f254e['define']('SmsApplication',attributes,{'tableName':_0xeb50('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d6e5e9e..3289d1f 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 _0xd0da=['jayson/promise','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ffa11,_0x120051){var _0x1f669d=function(_0x44b3ab){while(--_0x44b3ab){_0x4ffa11['push'](_0x4ffa11['shift']());}};_0x1f669d(++_0x120051);}(_0xd0da,0x1b1));var _0xad0d=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xd0da[_0x19babd];return _0x314eaf;};'use strict';var _=require(_0xad0d('0x0'));var util=require(_0xad0d('0x1'));var moment=require(_0xad0d('0x2'));var BPromise=require(_0xad0d('0x3'));var rs=require(_0xad0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad0d('0x5'))['db'];var utils=require(_0xad0d('0x6'));var logger=require(_0xad0d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad0d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc14f42,_0xa95863,_0xcc6f55){return new BPromise(function(_0xc7e517,_0x5b99a9){return client[_0xad0d('0x9')](_0xc14f42,_0xcc6f55)[_0xad0d('0xa')](function(_0x40e717){logger[_0xad0d('0xb')](_0xad0d('0xc'),_0xa95863,_0xad0d('0xd'));logger[_0xad0d('0xe')](_0xad0d('0xf'),_0xa95863,_0xad0d('0xd'),JSON[_0xad0d('0x10')](_0x40e717));if(_0x40e717[_0xad0d('0x11')]){if(_0x40e717[_0xad0d('0x11')][_0xad0d('0x12')]===0x1f4){logger['error'](_0xad0d('0xc'),_0xa95863,_0x40e717[_0xad0d('0x11')]['message']);return _0x5b99a9(_0x40e717[_0xad0d('0x11')][_0xad0d('0x13')]);}logger['error'](_0xad0d('0xc'),_0xa95863,_0x40e717[_0xad0d('0x11')]['message']);return _0xc7e517(_0x40e717[_0xad0d('0x11')][_0xad0d('0x13')]);}else{logger['info'](_0xad0d('0xc'),_0xa95863,'request\x20sent');_0xc7e517(_0x40e717['result'][_0xad0d('0x13')]);}})[_0xad0d('0x14')](function(_0x1cde0d){logger['error'](_0xad0d('0xc'),_0xa95863,_0x1cde0d);_0x5b99a9(_0x1cde0d);});});} \ No newline at end of file +var _0x556a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x46a7b2,_0x3fb9ed){var _0x4ff6e6=function(_0x4ceba4){while(--_0x4ceba4){_0x46a7b2['push'](_0x46a7b2['shift']());}};_0x4ff6e6(++_0x3fb9ed);}(_0x556a,0x1dd));var _0xa556=function(_0x4f2aad,_0x46faac){_0x4f2aad=_0x4f2aad-0x0;var _0x296ac8=_0x556a[_0x4f2aad];return _0x296ac8;};'use strict';var _=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var moment=require(_0xa556('0x2'));var BPromise=require(_0xa556('0x3'));var rs=require(_0xa556('0x4'));var fs=require('fs');var Redis=require(_0xa556('0x5'));var db=require(_0xa556('0x6'))['db'];var utils=require(_0xa556('0x7'));var logger=require(_0xa556('0x8'))('rpc');var config=require(_0xa556('0x9'));var jayson=require(_0xa556('0xa'));var client=jayson[_0xa556('0xb')][_0xa556('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x358b8c,_0x5a745c,_0x2c9a0c){return new BPromise(function(_0x644538,_0x17c2c2){return client[_0xa556('0xd')](_0x358b8c,_0x2c9a0c)['then'](function(_0x44ea8e){logger[_0xa556('0xe')](_0xa556('0xf'),_0x5a745c,_0xa556('0x10'));logger[_0xa556('0x11')](_0xa556('0x12'),_0x5a745c,_0xa556('0x10'),JSON[_0xa556('0x13')](_0x44ea8e));if(_0x44ea8e['error']){if(_0x44ea8e[_0xa556('0x14')]['code']===0x1f4){logger[_0xa556('0x14')]('SmsApplication,\x20%s,\x20%s',_0x5a745c,_0x44ea8e['error'][_0xa556('0x15')]);return _0x17c2c2(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}logger[_0xa556('0x14')]('SmsApplication,\x20%s,\x20%s',_0x5a745c,_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);return _0x644538(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}else{logger[_0xa556('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5a745c,'request\x20sent');_0x644538(_0x44ea8e[_0xa556('0x16')][_0xa556('0x15')]);}})['catch'](function(_0x3f8bd7){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5a745c,_0x3f8bd7);_0x17c2c2(_0x3f8bd7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 999e48e..bd1ea32 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 _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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda3f,0xec));var _0xfda3=function(_0x39d7d4,_0x1b65bc){_0x39d7d4=_0x39d7d4-0x0;var _0x54c56e=_0xda3f[_0x39d7d4];return _0x54c56e;};'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 +var _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x59178d,_0x43efe1){var _0x162c0c=function(_0x5b11d2){while(--_0x5b11d2){_0x59178d['push'](_0x59178d['shift']());}};_0x162c0c(++_0x43efe1);}(_0x6324,0x142));var _0x4632=function(_0x1a2ef3,_0x21186c){_0x1a2ef3=_0x1a2ef3-0x0;var _0x34f4a4=_0x6324[_0x1a2ef3];return _0x34f4a4;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e6f853d..6329f64 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 _0x5a13=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0xf492cb,_0x4eab00){var _0x5c94a8=function(_0x3c4dc3){while(--_0x3c4dc3){_0xf492cb['push'](_0xf492cb['shift']());}};_0x5c94a8(++_0x4eab00);}(_0x5a13,0x145));var _0x35a1=function(_0x274589,_0x3a63fd){_0x274589=_0x274589-0x0;var _0x2c7a87=_0x5a13[_0x274589];return _0x2c7a87;};'use strict';var Sequelize=require(_0x35a1('0x0'));var moment=require(_0x35a1('0x1'));module['exports']={'closed':{'type':Sequelize[_0x35a1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35a1('0x3')]},'disposition':{'type':Sequelize[_0x35a1('0x4')]},'secondDisposition':{'type':Sequelize[_0x35a1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x35a1('0x4')]},'note':{'type':Sequelize[_0x35a1('0x4')]},'phone':{'type':Sequelize[_0x35a1('0x4')]},'read1stAt':{'type':Sequelize[_0x35a1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x35a1('0x5')]('in',_0x35a1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x35a1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x35a1('0x5')]('in',_0x35a1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x35a1('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1867=['moment','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x1867,0xb5));var _0x7186=function(_0x339876,_0x2abd00){_0x339876=_0x339876-0x0;var _0x374ffb=_0x1867[_0x339876];return _0x374ffb;};'use strict';var Sequelize=require(_0x7186('0x0'));var moment=require(_0x7186('0x1'));module['exports']={'closed':{'type':Sequelize[_0x7186('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7186('0x3')]},'secondDisposition':{'type':Sequelize[_0x7186('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7186('0x3')]},'note':{'type':Sequelize[_0x7186('0x3')]},'phone':{'type':Sequelize[_0x7186('0x3')]},'read1stAt':{'type':Sequelize[_0x7186('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7186('0x5')]('in',_0x7186('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7186('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7186('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7186('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9a258f1..ad208e5 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 _0x0816=['getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','transcript-%d-%s.zip','join','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','out','value','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','keys','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','SmsInteraction','body','describe','addMessage','SmsMessage','ids'];(function(_0x19129e,_0x2b51e6){var _0x1d6a7f=function(_0x40549b){while(--_0x40549b){_0x19129e['push'](_0x19129e['shift']());}};_0x1d6a7f(++_0x2b51e6);}(_0x0816,0x1ac));var _0x6081=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x0816[_0x1c4409];return _0x356d8f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x6081('0x0'));var moment=require(_0x6081('0x1'));var BPromise=require(_0x6081('0x2'));var util=require(_0x6081('0x3'));var path=require(_0x6081('0x4'));var ejs=require(_0x6081('0x5'));var fs=require('fs');var _=require(_0x6081('0x6'));var Redis=require(_0x6081('0x7'));var interaction=require(_0x6081('0x8'));var qs=require(_0x6081('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x6081('0xa'))(_0x6081('0xb'));var config=require(_0x6081('0xc'));var db=require(_0x6081('0xd'))['db'];config[_0x6081('0xe')]=_['defaults'](config['redis'],{'host':_0x6081('0xf'),'port':0x18eb});var socket=require(_0x6081('0x10'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x6081('0x11')](socket);function respondWithStatusCode(_0x595476,_0x45150c){_0x45150c=_0x45150c||0xcc;return function(_0x1e8444){if(_0x1e8444){return _0x595476[_0x6081('0x12')](_0x45150c);}return _0x595476[_0x6081('0x13')](_0x45150c)[_0x6081('0x14')]();};}function respondWithResult(_0x402f41,_0x2131fe){_0x2131fe=_0x2131fe||0xc8;return function(_0x121e6a){if(_0x121e6a){return _0x402f41[_0x6081('0x13')](_0x2131fe)[_0x6081('0x15')](_0x121e6a);}};}function respondWithFilteredResult(_0x2c8cb7,_0x12a424){return function(_0x342562){if(_0x342562){var _0x35287c=typeof _0x12a424[_0x6081('0x16')]===_0x6081('0x17')&&typeof _0x12a424[_0x6081('0x18')]===_0x6081('0x17');var _0x3c2d42=_0x342562[_0x6081('0x19')];var _0x50b99d=_0x35287c?0x0:_0x12a424[_0x6081('0x16')];var _0x18649d=_0x35287c?_0x342562[_0x6081('0x19')]:_0x12a424['offset']+_0x12a424[_0x6081('0x18')];var _0x36c30c;if(_0x18649d>=_0x3c2d42){_0x18649d=_0x3c2d42;_0x36c30c=0xc8;}else{_0x36c30c=0xce;}_0x2c8cb7[_0x6081('0x13')](_0x36c30c);return _0x2c8cb7[_0x6081('0x1a')]('Content-Range',_0x50b99d+'-'+_0x18649d+'/'+_0x3c2d42)[_0x6081('0x15')](_0x342562);}return null;};}function saveUpdates(_0x4c98b1){return function(_0x194e74){if(_0x194e74){return _0x194e74[_0x6081('0x1b')](_0x4c98b1)['then'](function(_0x7b3dda){return _0x7b3dda;});}return null;};}function removeEntity(_0x5eb4fb){return function(_0x35d8ea){if(_0x35d8ea){return _0x35d8ea[_0x6081('0x1c')]()[_0x6081('0x1d')](function(){_0x5eb4fb[_0x6081('0x13')](0xcc)[_0x6081('0x14')]();});}};}function handleEntityNotFound(_0x1fcc2e){return function(_0x22f6a4){if(!_0x22f6a4){_0x1fcc2e[_0x6081('0x12')](0x194);}return _0x22f6a4;};}function handleError(_0xd22eee,_0x361b7c){_0x361b7c=_0x361b7c||0x1f4;return function(_0x48a0b7){logger['error'](_0x48a0b7[_0x6081('0x1e')]);if(_0x48a0b7['name']){delete _0x48a0b7[_0x6081('0x1f')];}_0xd22eee['status'](_0x361b7c)[_0x6081('0x20')](_0x48a0b7);};}exports[_0x6081('0x21')]=function(_0x5a8d1a,_0xff063b){var _0x5155b9={};var _0x5ed3d8=_[_0x6081('0x22')](db['SmsInteraction'][_0x6081('0x23')],function(_0x4b1a9b){return{'name':_0x4b1a9b[_0x6081('0x24')],'type':_0x4b1a9b[_0x6081('0x25')][_0x6081('0x26')]};});_0x5155b9=qs[_0x6081('0x27')](_0x5ed3d8,_0x5a8d1a);return interaction[_0x6081('0x28')](_0x6081('0x29'),_0x5a8d1a[_0x6081('0x2a')],_0x5a8d1a['user'],_0x5155b9,_0x5ed3d8)[_0x6081('0x1d')](respondWithFilteredResult(_0xff063b,_0x5155b9))[_0x6081('0x2b')](handleError(_0xff063b,null));};exports[_0x6081('0x2c')]=function(_0xe39e70,_0x542982){var _0x591cc3={'raw':![],'where':{'id':_0xe39e70[_0x6081('0x2d')]['id']}},_0x208369={};_0x208369['model']=_[_0x6081('0x2e')](db['SmsInteraction']['rawAttributes']);_0x208369[_0x6081('0x2a')]=_[_0x6081('0x2e')](_0xe39e70['query']);_0x208369['filters']=_[_0x6081('0x2f')](_0x208369['model'],_0x208369['query']);_0x591cc3[_0x6081('0x30')]=_[_0x6081('0x2f')](_0x208369[_0x6081('0x31')],qs[_0x6081('0x32')](_0xe39e70[_0x6081('0x2a')][_0x6081('0x32')]));_0x591cc3[_0x6081('0x30')]=_0x591cc3['attributes'][_0x6081('0x33')]?_0x591cc3[_0x6081('0x30')]:_0x208369[_0x6081('0x31')];if(_0xe39e70['query'][_0x6081('0x34')]){_0x591cc3[_0x6081('0x35')]=[{'all':!![]}];}_0x591cc3=_[_0x6081('0x36')]({},_0x591cc3,_0xe39e70[_0x6081('0x37')]);return db['SmsInteraction'][_0x6081('0x38')](_0x591cc3)['then'](handleEntityNotFound(_0x542982,null))[_0x6081('0x1d')](respondWithResult(_0x542982,null))[_0x6081('0x2b')](handleError(_0x542982,null));};exports[_0x6081('0x39')]=function(_0x2ec434,_0x1e060c){return db[_0x6081('0x3a')]['create'](_0x2ec434[_0x6081('0x3b')],{})[_0x6081('0x1d')](respondWithResult(_0x1e060c,0xc9))[_0x6081('0x2b')](handleError(_0x1e060c,null));};exports[_0x6081('0x1b')]=function(_0x25e7f2,_0x3ca23f){if(_0x25e7f2[_0x6081('0x3b')]['id']){delete _0x25e7f2[_0x6081('0x3b')]['id'];}return db[_0x6081('0x3a')][_0x6081('0x38')]({'where':{'id':_0x25e7f2[_0x6081('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3ca23f,null))[_0x6081('0x1d')](saveUpdates(_0x25e7f2['body'],null))['then'](respondWithResult(_0x3ca23f,null))[_0x6081('0x2b')](handleError(_0x3ca23f,null));};exports[_0x6081('0x1c')]=function(_0x10f5fe,_0x31a88e){return db['SmsInteraction'][_0x6081('0x38')]({'where':{'id':_0x10f5fe[_0x6081('0x2d')]['id']}})[_0x6081('0x1d')](handleEntityNotFound(_0x31a88e,null))[_0x6081('0x1d')](removeEntity(_0x31a88e,null))['catch'](handleError(_0x31a88e,null));};exports[_0x6081('0x3c')]=function(_0x3fb57f,_0x26e782){return db[_0x6081('0x3a')][_0x6081('0x3c')]()['then'](respondWithResult(_0x26e782,null))[_0x6081('0x2b')](handleError(_0x26e782,null));};exports[_0x6081('0x3d')]=function(_0x221b5c,_0x3af66d){return db[_0x6081('0x3e')]['find']({'where':{'id':_0x221b5c[_0x6081('0x2d')]['id']}})[_0x6081('0x1d')](handleEntityNotFound(_0x3af66d,null))['then'](function(_0xf0a443){if(_0xf0a443){return _0xf0a443[_0x6081('0x3d')](_0x221b5c['body'][_0x6081('0x3f')],_['omit'](_0x221b5c[_0x6081('0x3b')],[_0x6081('0x3f'),'id'])||{});}})[_0x6081('0x1d')](respondWithResult(_0x3af66d,null))[_0x6081('0x2b')](handleError(_0x3af66d,null));};exports[_0x6081('0x40')]=function(_0x422925,_0x3170ca){var _0x51ff9e={'raw':![],'where':{}};var _0x279214={};var _0x18ca88={'count':0x0,'rows':[]};return db[_0x6081('0x3a')][_0x6081('0x41')]({'where':{'id':_0x422925[_0x6081('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3170ca,null))[_0x6081('0x1d')](function(_0x5a0d01){if(_0x5a0d01){_0x279214['model']=_[_0x6081('0x2e')](db[_0x6081('0x3e')][_0x6081('0x23')]);_0x279214[_0x6081('0x2a')]=_[_0x6081('0x2e')](_0x422925[_0x6081('0x2a')]);_0x279214[_0x6081('0x42')]=_[_0x6081('0x2f')](_0x279214[_0x6081('0x31')],_0x279214[_0x6081('0x2a')]);_0x51ff9e[_0x6081('0x30')]=_[_0x6081('0x2f')](_0x279214[_0x6081('0x31')],qs[_0x6081('0x32')](_0x422925[_0x6081('0x2a')][_0x6081('0x32')]));_0x51ff9e[_0x6081('0x30')]=_0x51ff9e['attributes'][_0x6081('0x33')]?_0x51ff9e['attributes']:_0x279214[_0x6081('0x31')];if(!_0x422925[_0x6081('0x2a')][_0x6081('0x43')](_0x6081('0x44'))){_0x51ff9e[_0x6081('0x18')]=qs['limit'](_0x422925[_0x6081('0x2a')][_0x6081('0x18')]);_0x51ff9e[_0x6081('0x16')]=qs[_0x6081('0x16')](_0x422925[_0x6081('0x2a')][_0x6081('0x16')]);}_0x51ff9e[_0x6081('0x45')]=qs[_0x6081('0x46')](_0x422925[_0x6081('0x2a')]['sort']);_0x51ff9e[_0x6081('0x47')]=qs['filters'](_[_0x6081('0x48')](_0x422925[_0x6081('0x2a')],_0x279214[_0x6081('0x42')]));_0x51ff9e['where'][_0x6081('0x49')]=_0x5a0d01['id'];if(_0x422925[_0x6081('0x2a')][_0x6081('0x4a')]){_0x51ff9e['where']=_[_0x6081('0x36')](_0x51ff9e[_0x6081('0x47')],{'$or':_[_0x6081('0x22')](_0x51ff9e[_0x6081('0x30')],function(_0x38fdf4){var _0x2d9e99={};_0x2d9e99[_0x38fdf4]={'$like':'%'+_0x422925[_0x6081('0x2a')][_0x6081('0x4a')]+'%'};return _0x2d9e99;})});}if(_0x422925[_0x6081('0x2a')][_0x6081('0x4b')]){var _0x3edf73=_0x422925[_0x6081('0x2a')]['$gte']['split'](',');var _0x1e40e5={};_0x1e40e5[_0x3edf73[0x0]]={'$gte':moment(_0x3edf73[0x1])[_0x6081('0x4c')](_0x6081('0x4d'))};_0x51ff9e[_0x6081('0x47')]=_['merge'](_0x51ff9e[_0x6081('0x47')],_0x1e40e5);}_0x51ff9e=_[_0x6081('0x36')]({},_0x51ff9e,_0x422925[_0x6081('0x37')]);return db[_0x6081('0x3e')][_0x6081('0x19')]({'where':_0x51ff9e[_0x6081('0x47')]})[_0x6081('0x1d')](function(_0x180048){_0x18ca88[_0x6081('0x19')]=_0x180048;if(_0x422925['query'][_0x6081('0x34')]){_0x51ff9e['include']=[{'all':!![]}];}return db[_0x6081('0x3e')]['findAll'](_0x51ff9e);})[_0x6081('0x1d')](function(_0x591cb8){_0x18ca88[_0x6081('0x4e')]=_0x591cb8;return _0x18ca88;});}})[_0x6081('0x1d')](respondWithFilteredResult(_0x3170ca,_0x51ff9e))[_0x6081('0x2b')](handleError(_0x3170ca,null));};exports[_0x6081('0x4f')]=function(_0x2134fb,_0x5b14b5){return db[_0x6081('0x3a')][_0x6081('0x38')]({'where':{'id':_0x2134fb[_0x6081('0x2d')]['id']}})[_0x6081('0x1d')](handleEntityNotFound(_0x5b14b5,null))[_0x6081('0x1d')](function(_0x1cb683){if(_0x1cb683){return _0x1cb683['setTags'](_0x2134fb[_0x6081('0x3b')][_0x6081('0x3f')],_[_0x6081('0x50')](_0x2134fb['body'],['ids','id'])||{})[_0x6081('0x51')](function(){return db[_0x6081('0x52')]['findAll']({'attributes':['id',_0x6081('0x1f'),'color'],'where':{'id':_0x2134fb['body'][_0x6081('0x3f')]}});})['then'](function(_0x1b7f6f){socket[_0x6081('0x53')](_0x6081('0x54'),{'id':Number(_0x2134fb[_0x6081('0x2d')]['id']),'tags':_0x1b7f6f||[]});return{'id':Number(_0x2134fb[_0x6081('0x2d')]['id']),'tags':_0x1b7f6f||[]};});}})[_0x6081('0x1d')](respondWithResult(_0x5b14b5,null))[_0x6081('0x2b')](handleError(_0x5b14b5,null));};exports[_0x6081('0x55')]=function(_0x2223a0,_0x445053){return db[_0x6081('0x3a')]['find']({'where':{'id':_0x2223a0[_0x6081('0x2d')]['id']}})[_0x6081('0x1d')](handleEntityNotFound(_0x445053,null))['then'](function(_0x3d0173){if(_0x3d0173){return _0x3d0173['removeTags'](_0x2223a0['query']['ids']);}})['then'](respondWithStatusCode(_0x445053,null))[_0x6081('0x2b')](handleError(_0x445053,null));};exports[_0x6081('0x56')]=function(_0x456714,_0x3525bd){var _0x2b5d68=moment()[_0x6081('0x57')]()[_0x6081('0x58')]();var _0x253e7e=path['join'](config[_0x6081('0x59')],'server',_0x6081('0x5a'),_0x6081('0x5b'));var _0x55256d=path['join'](_0x253e7e,_0x2b5d68);var _0x58d7d4=util['format'](_0x6081('0x5c'),_0x456714[_0x6081('0x2d')]['id'],_0x2b5d68);var _0x212da5=path[_0x6081('0x5d')](_0x253e7e,_0x58d7d4);var _0x2ef329=[];_0x2ef329['push']({'model':db[_0x6081('0x5e')],'as':_0x6081('0x5e'),'attributes':['id',_0x6081('0x5f')],'raw':!![]});_0x2ef329[_0x6081('0x60')]({'model':db[_0x6081('0x61')],'as':_0x6081('0x62'),'attributes':['id',_0x6081('0x63'),_0x6081('0x64')],'raw':!![]});var _0x32beac=[{'model':db['SmsMessage'],'as':_0x6081('0x65'),'attributes':['id',_0x6081('0x3b'),_0x6081('0x66'),_0x6081('0x67'),_0x6081('0x68'),_0x6081('0x69')],'include':_0x2ef329}];_0x32beac[_0x6081('0x60')]({'model':db[_0x6081('0x6a')],'as':_0x6081('0x6b'),'attributes':['id',_0x6081('0x1f')]});_0x32beac[_0x6081('0x60')]({'model':db[_0x6081('0x5e')],'as':_0x6081('0x6c'),'attributes':['id',_0x6081('0x5f')]});return db['SmsInteraction']['find']({'where':{'id':_0x456714[_0x6081('0x2d')]['id']},'include':_0x32beac})[_0x6081('0x1d')](handleEntityNotFound(_0x3525bd,null))['then'](function(_0x40f14d){if(_0x40f14d){var _0x5dce97=_0x40f14d[_0x6081('0x6d')]({'plain':!![]});fs[_0x6081('0x6e')](_0x55256d);var _0x1e1185={'channel':_0x6081('0x6f'),'account':_0x5dce97[_0x6081('0x6b')][_0x6081('0x1f')],'agent':_0x5dce97[_0x6081('0x6c')]?_0x5dce97[_0x6081('0x6c')][_0x6081('0x5f')]:_0x6081('0x70'),'createdAt':moment(_0x5dce97[_0x6081('0x66')])['format'](_0x6081('0x4d'))[_0x6081('0x58')](),'closedAt':_0x5dce97['closed']?moment(_0x5dce97[_0x6081('0x71')])['format'](_0x6081('0x4d'))['toString']():'','disposition':_0x5dce97['disposition'],'messages':_(_0x5dce97[_0x6081('0x65')])['filter']({'secret':![]})[_0x6081('0x22')](function(_0x3bc58c){return{'date':moment(_0x3bc58c[_0x6081('0x66')])[_0x6081('0x4c')](_0x6081('0x4d'))['toString'](),'sender':_0x3bc58c[_0x6081('0x67')]===_0x6081('0x72')?_0x3bc58c[_0x6081('0x5e')]?_0x3bc58c[_0x6081('0x5e')][_0x6081('0x5f')]:'System':_0x3bc58c[_0x6081('0x62')][_0x6081('0x63')]+(_0x3bc58c[_0x6081('0x62')]['lastName']?'\x20'+_0x3bc58c[_0x6081('0x62')]['lastName']:''),'body':_0x3bc58c[_0x6081('0x3b')],'direction':_0x3bc58c[_0x6081('0x67')]==='out'?'A':'C','secret':_0x3bc58c[_0x6081('0x68')],'read':_0x3bc58c[_0x6081('0x69')]};})[_0x6081('0x73')]()};return ejs[_0x6081('0x74')](path[_0x6081('0x5d')](config[_0x6081('0x59')],_0x6081('0x75'),_0x6081('0x76'),_0x6081('0x77')),{'interaction':_0x1e1185})[_0x6081('0x1d')](function(_0x2b3497){var _0x113d3c=path[_0x6081('0x5d')](_0x55256d,'transcript-'+_0x5dce97['id']+'-'+_0x2b5d68+_0x6081('0x78'));var _0xeeba9c={'path':_0x113d3c,'channel':_0x6081('0x6f'),'interactionId':_0x5dce97['id']};return pdf[_0x6081('0x79')](_0x2b3497,_0xeeba9c);})[_0x6081('0x1d')](function(){return new BPromise(function(_0x1ddf19,_0x2f021c){zipdir(_0x55256d,{'saveTo':_0x212da5},function(_0xfcf158,_0x123bed){if(_0xfcf158)return _0x2f021c(_0xfcf158);return _0x1ddf19(_0x123bed);});})[_0x6081('0x1d')](function(){return new BPromise(function(_0xf2f36c,_0x5f1dda){rimraf(_0x55256d,function(_0x45545d){if(_0x45545d)_0x5f1dda(_0x45545d);return _0xf2f36c();});});})[_0x6081('0x1d')](function(){return _0x3525bd[_0x6081('0x56')](_0x212da5,_0x58d7d4,function(_0x3e340a){if(_0x3e340a){console[_0x6081('0x7a')]('err',_0x3e340a);}else{fs['unlinkSync'](_0x212da5);}});});});}else{return _0x3525bd[_0x6081('0x12')](0xc8);}})[_0x6081('0x2b')](handleError(_0x3525bd,null));}; \ No newline at end of file +var _0x09f3=['type','key','findAll','sms','user','show','keys','query','intersection','model','attributes','fields','include','merge','options','catch','create','update','body','params','SmsInteraction','find','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','pick','SmsInteractionId','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','server','files','transcript-%d-%s.zip','join','User','fullname','push','Contact','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','Messages','out','System','firstName','lastName','value','renderFile','root','views','transcript-','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','stack','name','send','map','rawAttributes'];(function(_0x2bcd42,_0x946248){var _0x34d7fd=function(_0x5e3413){while(--_0x5e3413){_0x2bcd42['push'](_0x2bcd42['shift']());}};_0x34d7fd(++_0x946248);}(_0x09f3,0x1c5));var _0x309f=function(_0x455555,_0x2147fd){_0x455555=_0x455555-0x0;var _0x3cb183=_0x09f3[_0x455555];return _0x3cb183;};'use strict';var rimraf=require(_0x309f('0x0'));var zipdir=require(_0x309f('0x1'));var moment=require(_0x309f('0x2'));var BPromise=require(_0x309f('0x3'));var util=require(_0x309f('0x4'));var path=require(_0x309f('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x309f('0x6'));var Redis=require('ioredis');var interaction=require(_0x309f('0x7'));var qs=require(_0x309f('0x8'));var pdf=require(_0x309f('0x9'));var logger=require(_0x309f('0xa'))(_0x309f('0xb'));var config=require(_0x309f('0xc'));var db=require(_0x309f('0xd'))['db'];config['redis']=_[_0x309f('0xe')](config[_0x309f('0xf')],{'host':_0x309f('0x10'),'port':0x18eb});var socket=require(_0x309f('0x11'))(new Redis(config[_0x309f('0xf')]));require('./smsInteraction.socket')[_0x309f('0x12')](socket);function respondWithStatusCode(_0x246e07,_0x1a5dcc){_0x1a5dcc=_0x1a5dcc||0xcc;return function(_0x4e3915){if(_0x4e3915){return _0x246e07['sendStatus'](_0x1a5dcc);}return _0x246e07[_0x309f('0x13')](_0x1a5dcc)['end']();};}function respondWithResult(_0x4b3d39,_0x2def3c){_0x2def3c=_0x2def3c||0xc8;return function(_0x23795a){if(_0x23795a){return _0x4b3d39[_0x309f('0x13')](_0x2def3c)[_0x309f('0x14')](_0x23795a);}};}function respondWithFilteredResult(_0x1c6c3b,_0xb58aa4){return function(_0x162274){if(_0x162274){var _0x3f01e6=typeof _0xb58aa4[_0x309f('0x15')]===_0x309f('0x16')&&typeof _0xb58aa4[_0x309f('0x17')]==='undefined';var _0x5a9ca4=_0x162274[_0x309f('0x18')];var _0x4ee5da=_0x3f01e6?0x0:_0xb58aa4[_0x309f('0x15')];var _0xe7817c=_0x3f01e6?_0x162274['count']:_0xb58aa4[_0x309f('0x15')]+_0xb58aa4[_0x309f('0x17')];var _0x4817c4;if(_0xe7817c>=_0x5a9ca4){_0xe7817c=_0x5a9ca4;_0x4817c4=0xc8;}else{_0x4817c4=0xce;}_0x1c6c3b[_0x309f('0x13')](_0x4817c4);return _0x1c6c3b[_0x309f('0x19')](_0x309f('0x1a'),_0x4ee5da+'-'+_0xe7817c+'/'+_0x5a9ca4)[_0x309f('0x14')](_0x162274);}return null;};}function saveUpdates(_0x1233b3){return function(_0x4676b3){if(_0x4676b3){return _0x4676b3['update'](_0x1233b3)['then'](function(_0x593e65){return _0x593e65;});}return null;};}function removeEntity(_0x5aa51c){return function(_0x30b551){if(_0x30b551){return _0x30b551[_0x309f('0x1b')]()[_0x309f('0x1c')](function(){_0x5aa51c[_0x309f('0x13')](0xcc)[_0x309f('0x1d')]();});}};}function handleEntityNotFound(_0x32de93){return function(_0x212e6e){if(!_0x212e6e){_0x32de93['sendStatus'](0x194);}return _0x212e6e;};}function handleError(_0x52cb35,_0x1049a4){_0x1049a4=_0x1049a4||0x1f4;return function(_0x57716f){logger['error'](_0x57716f[_0x309f('0x1e')]);if(_0x57716f[_0x309f('0x1f')]){delete _0x57716f[_0x309f('0x1f')];}_0x52cb35['status'](_0x1049a4)[_0x309f('0x20')](_0x57716f);};}exports['index']=function(_0x40d1aa,_0x2fc570){var _0xe8c0d0={};var _0x59bb84=_[_0x309f('0x21')](db['SmsInteraction'][_0x309f('0x22')],function(_0x5dd63f){return{'name':_0x5dd63f['fieldName'],'type':_0x5dd63f[_0x309f('0x23')][_0x309f('0x24')]};});_0xe8c0d0=qs['getOptions'](_0x59bb84,_0x40d1aa);return interaction[_0x309f('0x25')](_0x309f('0x26'),_0x40d1aa['query'],_0x40d1aa[_0x309f('0x27')],_0xe8c0d0,_0x59bb84)[_0x309f('0x1c')](respondWithFilteredResult(_0x2fc570,_0xe8c0d0))['catch'](handleError(_0x2fc570,null));};exports[_0x309f('0x28')]=function(_0x12806a,_0x1cd5de){var _0x56cd95={'raw':![],'where':{'id':_0x12806a['params']['id']}},_0x996029={};_0x996029['model']=_[_0x309f('0x29')](db['SmsInteraction'][_0x309f('0x22')]);_0x996029['query']=_[_0x309f('0x29')](_0x12806a[_0x309f('0x2a')]);_0x996029['filters']=_[_0x309f('0x2b')](_0x996029[_0x309f('0x2c')],_0x996029[_0x309f('0x2a')]);_0x56cd95[_0x309f('0x2d')]=_[_0x309f('0x2b')](_0x996029[_0x309f('0x2c')],qs[_0x309f('0x2e')](_0x12806a[_0x309f('0x2a')][_0x309f('0x2e')]));_0x56cd95[_0x309f('0x2d')]=_0x56cd95[_0x309f('0x2d')]['length']?_0x56cd95[_0x309f('0x2d')]:_0x996029[_0x309f('0x2c')];if(_0x12806a[_0x309f('0x2a')]['includeAll']){_0x56cd95[_0x309f('0x2f')]=[{'all':!![]}];}_0x56cd95=_[_0x309f('0x30')]({},_0x56cd95,_0x12806a[_0x309f('0x31')]);return db['SmsInteraction']['find'](_0x56cd95)[_0x309f('0x1c')](handleEntityNotFound(_0x1cd5de,null))[_0x309f('0x1c')](respondWithResult(_0x1cd5de,null))[_0x309f('0x32')](handleError(_0x1cd5de,null));};exports[_0x309f('0x33')]=function(_0x40d4bd,_0x554c53){return db['SmsInteraction'][_0x309f('0x33')](_0x40d4bd['body'],{})[_0x309f('0x1c')](respondWithResult(_0x554c53,0xc9))['catch'](handleError(_0x554c53,null));};exports[_0x309f('0x34')]=function(_0x59bfda,_0x42c391){if(_0x59bfda[_0x309f('0x35')]['id']){delete _0x59bfda[_0x309f('0x35')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x59bfda[_0x309f('0x36')]['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x42c391,null))['then'](saveUpdates(_0x59bfda[_0x309f('0x35')],null))[_0x309f('0x1c')](respondWithResult(_0x42c391,null))[_0x309f('0x32')](handleError(_0x42c391,null));};exports['destroy']=function(_0x1e8110,_0x20498a){return db[_0x309f('0x37')][_0x309f('0x38')]({'where':{'id':_0x1e8110['params']['id']}})['then'](handleEntityNotFound(_0x20498a,null))[_0x309f('0x1c')](removeEntity(_0x20498a,null))['catch'](handleError(_0x20498a,null));};exports['describe']=function(_0x1ef63a,_0x5b14f7){return db[_0x309f('0x37')]['describe']()[_0x309f('0x1c')](respondWithResult(_0x5b14f7,null))['catch'](handleError(_0x5b14f7,null));};exports[_0x309f('0x39')]=function(_0x4aa6b7,_0x238d95){return db[_0x309f('0x3a')][_0x309f('0x38')]({'where':{'id':_0x4aa6b7['params']['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x238d95,null))['then'](function(_0x26a3ee){if(_0x26a3ee){return _0x26a3ee[_0x309f('0x39')](_0x4aa6b7['body'][_0x309f('0x3b')],_[_0x309f('0x3c')](_0x4aa6b7[_0x309f('0x35')],[_0x309f('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x238d95,null))[_0x309f('0x32')](handleError(_0x238d95,null));};exports[_0x309f('0x3d')]=function(_0x1e8a9b,_0x41b598){var _0x51b006={'raw':![],'where':{}};var _0x2453af={};var _0x31f2ef={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x309f('0x3e')]({'where':{'id':_0x1e8a9b['params']['id']}})['then'](handleEntityNotFound(_0x41b598,null))[_0x309f('0x1c')](function(_0x2d3b11){if(_0x2d3b11){_0x2453af[_0x309f('0x2c')]=_[_0x309f('0x29')](db[_0x309f('0x3a')][_0x309f('0x22')]);_0x2453af['query']=_['keys'](_0x1e8a9b[_0x309f('0x2a')]);_0x2453af[_0x309f('0x3f')]=_['intersection'](_0x2453af[_0x309f('0x2c')],_0x2453af['query']);_0x51b006[_0x309f('0x2d')]=_['intersection'](_0x2453af[_0x309f('0x2c')],qs[_0x309f('0x2e')](_0x1e8a9b[_0x309f('0x2a')]['fields']));_0x51b006[_0x309f('0x2d')]=_0x51b006[_0x309f('0x2d')][_0x309f('0x40')]?_0x51b006['attributes']:_0x2453af['model'];if(!_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x41')](_0x309f('0x42'))){_0x51b006['limit']=qs[_0x309f('0x17')](_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x17')]);_0x51b006[_0x309f('0x15')]=qs[_0x309f('0x15')](_0x1e8a9b[_0x309f('0x2a')]['offset']);}_0x51b006[_0x309f('0x43')]=qs[_0x309f('0x44')](_0x1e8a9b['query'][_0x309f('0x44')]);_0x51b006['where']=qs[_0x309f('0x3f')](_[_0x309f('0x45')](_0x1e8a9b[_0x309f('0x2a')],_0x2453af[_0x309f('0x3f')]));_0x51b006['where'][_0x309f('0x46')]=_0x2d3b11['id'];if(_0x1e8a9b[_0x309f('0x2a')]['filter']){_0x51b006[_0x309f('0x47')]=_[_0x309f('0x30')](_0x51b006['where'],{'$or':_[_0x309f('0x21')](_0x51b006[_0x309f('0x2d')],function(_0x3a5e0a){var _0x11f529={};_0x11f529[_0x3a5e0a]={'$like':'%'+_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x48')]+'%'};return _0x11f529;})});}if(_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x49')]){var _0x1974c6=_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x49')][_0x309f('0x4a')](',');var _0x497e8c={};_0x497e8c[_0x1974c6[0x0]]={'$gte':moment(_0x1974c6[0x1])[_0x309f('0x4b')](_0x309f('0x4c'))};_0x51b006['where']=_[_0x309f('0x30')](_0x51b006[_0x309f('0x47')],_0x497e8c);}_0x51b006=_[_0x309f('0x30')]({},_0x51b006,_0x1e8a9b[_0x309f('0x31')]);return db['SmsMessage'][_0x309f('0x18')]({'where':_0x51b006[_0x309f('0x47')]})[_0x309f('0x1c')](function(_0x95f302){_0x31f2ef['count']=_0x95f302;if(_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x4d')]){_0x51b006[_0x309f('0x2f')]=[{'all':!![]}];}return db['SmsMessage'][_0x309f('0x25')](_0x51b006);})[_0x309f('0x1c')](function(_0x1e84f6){_0x31f2ef['rows']=_0x1e84f6;return _0x31f2ef;});}})[_0x309f('0x1c')](respondWithFilteredResult(_0x41b598,_0x51b006))[_0x309f('0x32')](handleError(_0x41b598,null));};exports[_0x309f('0x4e')]=function(_0x190cfb,_0x418856){return db[_0x309f('0x37')]['find']({'where':{'id':_0x190cfb['params']['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x418856,null))['then'](function(_0x6e2ec4){if(_0x6e2ec4){return _0x6e2ec4[_0x309f('0x4f')](_0x190cfb['body'][_0x309f('0x3b')],_[_0x309f('0x3c')](_0x190cfb[_0x309f('0x35')],['ids','id'])||{})['spread'](function(){return db[_0x309f('0x50')][_0x309f('0x25')]({'attributes':['id',_0x309f('0x1f'),_0x309f('0x51')],'where':{'id':_0x190cfb[_0x309f('0x35')]['ids']}});})[_0x309f('0x1c')](function(_0x50a565){socket['emit'](_0x309f('0x52'),{'id':Number(_0x190cfb['params']['id']),'tags':_0x50a565||[]});return{'id':Number(_0x190cfb[_0x309f('0x36')]['id']),'tags':_0x50a565||[]};});}})[_0x309f('0x1c')](respondWithResult(_0x418856,null))[_0x309f('0x32')](handleError(_0x418856,null));};exports[_0x309f('0x53')]=function(_0x4c24d2,_0x3d56ad){return db[_0x309f('0x37')][_0x309f('0x38')]({'where':{'id':_0x4c24d2['params']['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x3d56ad,null))['then'](function(_0x1ad5a0){if(_0x1ad5a0){return _0x1ad5a0[_0x309f('0x53')](_0x4c24d2[_0x309f('0x2a')]['ids']);}})['then'](respondWithStatusCode(_0x3d56ad,null))[_0x309f('0x32')](handleError(_0x3d56ad,null));};exports[_0x309f('0x54')]=function(_0x5a1d93,_0x3273ae){var _0xb1c894=moment()[_0x309f('0x55')]()[_0x309f('0x56')]();var _0x44b4e2=path['join'](config['root'],_0x309f('0x57'),_0x309f('0x58'),'tmp');var _0x34b624=path['join'](_0x44b4e2,_0xb1c894);var _0x1543a8=util['format'](_0x309f('0x59'),_0x5a1d93['params']['id'],_0xb1c894);var _0x27142a=path[_0x309f('0x5a')](_0x44b4e2,_0x1543a8);var _0x5a519c=[];_0x5a519c['push']({'model':db[_0x309f('0x5b')],'as':_0x309f('0x5b'),'attributes':['id',_0x309f('0x5c')],'raw':!![]});_0x5a519c[_0x309f('0x5d')]({'model':db['CmContact'],'as':_0x309f('0x5e'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x4ea683=[{'model':db[_0x309f('0x3a')],'as':'Messages','attributes':['id',_0x309f('0x35'),_0x309f('0x5f'),_0x309f('0x60'),_0x309f('0x61'),_0x309f('0x62')],'include':_0x5a519c}];_0x4ea683[_0x309f('0x5d')]({'model':db[_0x309f('0x63')],'as':_0x309f('0x64'),'attributes':['id',_0x309f('0x1f')]});_0x4ea683[_0x309f('0x5d')]({'model':db[_0x309f('0x5b')],'as':_0x309f('0x65'),'attributes':['id',_0x309f('0x5c')]});return db[_0x309f('0x37')][_0x309f('0x38')]({'where':{'id':_0x5a1d93[_0x309f('0x36')]['id']},'include':_0x4ea683})[_0x309f('0x1c')](handleEntityNotFound(_0x3273ae,null))[_0x309f('0x1c')](function(_0x4ca847){if(_0x4ca847){var _0xbda934=_0x4ca847[_0x309f('0x66')]({'plain':!![]});fs[_0x309f('0x67')](_0x34b624);var _0x5b07b9={'channel':_0x309f('0x68'),'account':_0xbda934['Account'][_0x309f('0x1f')],'agent':_0xbda934['Owner']?_0xbda934['Owner'][_0x309f('0x5c')]:_0x309f('0x69'),'createdAt':moment(_0xbda934[_0x309f('0x5f')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x309f('0x56')](),'closedAt':_0xbda934[_0x309f('0x6a')]?moment(_0xbda934[_0x309f('0x6b')])[_0x309f('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x309f('0x56')]():'','disposition':_0xbda934[_0x309f('0x6c')],'messages':_(_0xbda934[_0x309f('0x6d')])[_0x309f('0x48')]({'secret':![]})[_0x309f('0x21')](function(_0x53af10){return{'date':moment(_0x53af10[_0x309f('0x5f')])['format'](_0x309f('0x4c'))[_0x309f('0x56')](),'sender':_0x53af10[_0x309f('0x60')]===_0x309f('0x6e')?_0x53af10[_0x309f('0x5b')]?_0x53af10[_0x309f('0x5b')][_0x309f('0x5c')]:_0x309f('0x6f'):_0x53af10['Contact'][_0x309f('0x70')]+(_0x53af10[_0x309f('0x5e')][_0x309f('0x71')]?'\x20'+_0x53af10[_0x309f('0x5e')][_0x309f('0x71')]:''),'body':_0x53af10[_0x309f('0x35')],'direction':_0x53af10['direction']==='out'?'A':'C','secret':_0x53af10[_0x309f('0x61')],'read':_0x53af10[_0x309f('0x62')]};})[_0x309f('0x72')]()};return ejs[_0x309f('0x73')](path[_0x309f('0x5a')](config[_0x309f('0x74')],'server',_0x309f('0x75'),'downloadInteraction.ejs'),{'interaction':_0x5b07b9})[_0x309f('0x1c')](function(_0x4f3558){var _0xfc2408=path['join'](_0x34b624,_0x309f('0x76')+_0xbda934['id']+'-'+_0xb1c894+'.pdf');var _0x5d623c={'path':_0xfc2408,'channel':_0x309f('0x68'),'interactionId':_0xbda934['id']};return pdf[_0x309f('0x77')](_0x4f3558,_0x5d623c);})['then'](function(){return new BPromise(function(_0x4c3472,_0x4fcc98){zipdir(_0x34b624,{'saveTo':_0x27142a},function(_0x2920d1,_0x53ed99){if(_0x2920d1)return _0x4fcc98(_0x2920d1);return _0x4c3472(_0x53ed99);});})[_0x309f('0x1c')](function(){return new BPromise(function(_0x1f2a2c,_0x22cca7){rimraf(_0x34b624,function(_0xc0a970){if(_0xc0a970)_0x22cca7(_0xc0a970);return _0x1f2a2c();});});})[_0x309f('0x1c')](function(){return _0x3273ae[_0x309f('0x54')](_0x27142a,_0x1543a8,function(_0x587b76){if(_0x587b76){console[_0x309f('0x78')]('err',_0x587b76);}else{fs[_0x309f('0x79')](_0x27142a);}});});});}else{return _0x3273ae['sendStatus'](0xc8);}})[_0x309f('0x32')](handleError(_0x3273ae,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index acad932..1e646e9 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f2=['update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28f2,0x193));var _0x228f=function(_0x492275,_0x33dbcf){_0x492275=_0x492275-0x0;var _0x642f99=_0x28f2[_0x492275];return _0x642f99;};'use strict';var EventEmitter=require(_0x228f('0x0'));var SmsInteraction=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var SmsMessage=require(_0x228f('0x1'))['db'][_0x228f('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':_0x228f('0x5'),'afterDestroy':_0x228f('0x6')};function emitEvent(_0x4303c3){return function(_0x2bb7d7,_0x3439f5,_0x32c5c3){_0x2bb7d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x228f('0x7')](function(_0x4a4a44){_0x2bb7d7[_0x228f('0x8')](_0x228f('0x9'),_0x4a4a44[_0x228f('0xa')](function(_0x5f406c){return{'id':_0x5f406c['id']};}));return SmsMessage[_0x228f('0xb')]({'where':{'SmsInteractionId':_0x2bb7d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x212c90){_0x2bb7d7[_0x228f('0x8')]('unreadMessages',_0x212c90[_0x228f('0xc')]);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3+':'+_0x2bb7d7['id'],_0x2bb7d7);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3,_0x2bb7d7);_0x32c5c3(null);})[_0x228f('0xe')](_0x32c5c3(null));};}for(var e in events){if(events[_0x228f('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x228f('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x63a5=['hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4f3da5,_0x442069){var _0x259a2d=function(_0x15ecc0){while(--_0x15ecc0){_0x4f3da5['push'](_0x4f3da5['shift']());}};_0x259a2d(++_0x442069);}(_0x63a5,0x18e));var _0x563a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x63a5[_0xa148b7];return _0x51efd3;};'use strict';var EventEmitter=require(_0x563a('0x0'));var SmsInteraction=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x563a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x4'),'afterUpdate':_0x563a('0x5'),'afterDestroy':_0x563a('0x6')};function emitEvent(_0x37e617){return function(_0x5c2a8d,_0x4cc9e5,_0x1fdcb0){_0x5c2a8d['getUsers']({'attributes':['id'],'raw':!![]})[_0x563a('0x7')](function(_0x4f89b4){_0x5c2a8d['setDataValue']('Users',_0x4f89b4[_0x563a('0x8')](function(_0x32bf51){return{'id':_0x32bf51['id']};}));return SmsMessage[_0x563a('0x9')]({'where':{'SmsInteractionId':_0x5c2a8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x563a('0x7')](function(_0x255922){_0x5c2a8d[_0x563a('0xa')](_0x563a('0xb'),_0x255922[_0x563a('0xc')]);SmsInteractionEvents[_0x563a('0xd')](_0x37e617+':'+_0x5c2a8d['id'],_0x5c2a8d);SmsInteractionEvents[_0x563a('0xd')](_0x37e617,_0x5c2a8d);_0x1fdcb0(null);})[_0x563a('0xe')](_0x1fdcb0(null));};}for(var e in events){if(events[_0x563a('0xf')](e)){var event=events[e];SmsInteraction[_0x563a('0x10')](e,emitEvent(event));}}module[_0x563a('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ebadca2..5cc496f 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 _0x8cee=['request-promise','path','./smsInteraction.attributes','exports','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3798d1,_0x50d6de){var _0x3512a8=function(_0x48b576){while(--_0x48b576){_0x3798d1['push'](_0x3798d1['shift']());}};_0x3512a8(++_0x50d6de);}(_0x8cee,0x166));var _0xe8ce=function(_0x2c7003,_0x27ff40){_0x2c7003=_0x2c7003-0x0;var _0x287c26=_0x8cee[_0x2c7003];return _0x287c26;};'use strict';var _=require(_0xe8ce('0x0'));var util=require(_0xe8ce('0x1'));var logger=require(_0xe8ce('0x2'))(_0xe8ce('0x3'));var moment=require(_0xe8ce('0x4'));var BPromise=require(_0xe8ce('0x5'));var rp=require(_0xe8ce('0x6'));var fs=require('fs');var path=require(_0xe8ce('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8ce('0x8'));module[_0xe8ce('0x9')]=function(_0x5a0054,_0x371871){return _0x5a0054['define']('SmsInteraction',attributes,{'tableName':_0xe8ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50fcd3,_0x5787bd,_0x13766e){if(_0x50fcd3[_0xe8ce('0xb')]('closed')){_0x50fcd3[_0xe8ce('0xc')]=moment()['format'](_0xe8ce('0xd'));}_0x13766e(null,_0x50fcd3);}}});}; \ No newline at end of file +var _0xee30=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x5b0216,_0x5622ba){var _0x4351cc=function(_0x4d26df){while(--_0x4d26df){_0x5b0216['push'](_0x5b0216['shift']());}};_0x4351cc(++_0x5622ba);}(_0xee30,0x158));var _0x0ee3=function(_0x4f7252,_0x57b66e){_0x4f7252=_0x4f7252-0x0;var _0x908b58=_0xee30[_0x4f7252];return _0x908b58;};'use strict';var _=require(_0x0ee3('0x0'));var util=require(_0x0ee3('0x1'));var logger=require(_0x0ee3('0x2'))(_0x0ee3('0x3'));var moment=require(_0x0ee3('0x4'));var BPromise=require(_0x0ee3('0x5'));var rp=require(_0x0ee3('0x6'));var fs=require('fs');var path=require(_0x0ee3('0x7'));var rimraf=require(_0x0ee3('0x8'));var config=require('../../config/environment');var attributes=require(_0x0ee3('0x9'));module[_0x0ee3('0xa')]=function(_0x348a9c,_0x51b376){return _0x348a9c[_0x0ee3('0xb')](_0x0ee3('0xc'),attributes,{'tableName':_0x0ee3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x200afe,_0x2672ca,_0x3a4138){if(_0x200afe[_0x0ee3('0xe')](_0x0ee3('0xf'))){_0x200afe[_0x0ee3('0x10')]=moment()[_0x0ee3('0x11')](_0x0ee3('0x12'));}_0x3a4138(null,_0x200afe);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5f26d31..5785ee2 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 _0xb15a=['redis','localhost','socket.io-emitter','./smsInteraction.socket','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsInteraction','options','raw','where','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4e3f34,_0x331c99){var _0x1f4e98=function(_0x235d31){while(--_0x235d31){_0x4e3f34['push'](_0x4e3f34['shift']());}};_0x1f4e98(++_0x331c99);}(_0xb15a,0x177));var _0xab15=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0xb15a[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0xab15('0x0'));var util=require(_0xab15('0x1'));var moment=require(_0xab15('0x2'));var BPromise=require(_0xab15('0x3'));var rs=require(_0xab15('0x4'));var fs=require('fs');var Redis=require(_0xab15('0x5'));var db=require(_0xab15('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xab15('0x7'))(_0xab15('0x8'));var config=require(_0xab15('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xab15('0xa')][_0xab15('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xab15('0xc')],{'host':_0xab15('0xd'),'port':0x18eb});var socket=require(_0xab15('0xe'))(new Redis(config[_0xab15('0xc')]));require(_0xab15('0xf'))['register'](socket);function respondWithRpcPromise(_0x4645f6,_0xa10789,_0x313c51){return new BPromise(function(_0x3768da,_0x11e23b){return client[_0xab15('0x10')](_0x4645f6,_0x313c51)['then'](function(_0x75b11c){logger['info'](_0xab15('0x11'),_0xa10789,_0xab15('0x12'));logger[_0xab15('0x13')](_0xab15('0x14'),_0xa10789,_0xab15('0x12'),JSON[_0xab15('0x15')](_0x75b11c));if(_0x75b11c[_0xab15('0x16')]){if(_0x75b11c[_0xab15('0x16')][_0xab15('0x17')]===0x1f4){logger[_0xab15('0x16')](_0xab15('0x11'),_0xa10789,_0x75b11c[_0xab15('0x16')]['message']);return _0x11e23b(_0x75b11c[_0xab15('0x16')][_0xab15('0x18')]);}logger[_0xab15('0x16')](_0xab15('0x11'),_0xa10789,_0x75b11c[_0xab15('0x16')][_0xab15('0x18')]);return _0x3768da(_0x75b11c[_0xab15('0x16')][_0xab15('0x18')]);}else{logger[_0xab15('0x19')](_0xab15('0x11'),_0xa10789,_0xab15('0x12'));_0x3768da(_0x75b11c[_0xab15('0x1a')][_0xab15('0x18')]);}})[_0xab15('0x1b')](function(_0x1b68b6){logger[_0xab15('0x16')]('SmsInteraction,\x20%s,\x20%s',_0xa10789,_0x1b68b6);_0x11e23b(_0x1b68b6);});});}exports['UpdateSmsInteraction']=function(_0x45fe5f){var _0x25982a=this;return new Promise(function(_0x5e8b5e,_0x2a3012){return db[_0xab15('0x1c')]['update'](_0x45fe5f['body'],{'raw':_0x45fe5f[_0xab15('0x1d')]?_0x45fe5f[_0xab15('0x1d')][_0xab15('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45fe5f[_0xab15('0x1d')]?_0x45fe5f[_0xab15('0x1d')][_0xab15('0x1f')]||null:null,'attributes':_0x45fe5f[_0xab15('0x1d')]?_0x45fe5f['options']['attributes']||null:null,'limit':_0x45fe5f[_0xab15('0x1d')]?_0x45fe5f[_0xab15('0x1d')][_0xab15('0x20')]||null:null})[_0xab15('0x21')](function(_0x34e32f){logger[_0xab15('0x19')](_0xab15('0x22'),_0x45fe5f);logger[_0xab15('0x13')]('UpdateSmsInteraction',_0x45fe5f,JSON[_0xab15('0x15')](_0x34e32f));_0x5e8b5e(_0x34e32f);})['catch'](function(_0x298eba){logger[_0xab15('0x16')](_0xab15('0x22'),_0x298eba[_0xab15('0x18')],_0x45fe5f);_0x2a3012(_0x25982a[_0xab15('0x16')](0x1f4,_0x298eba[_0xab15('0x18')]));});});};exports[_0xab15('0x23')]=function(_0x4f927f){return new Promise(function(_0x129118,_0x1f31ee){return db[_0xab15('0x1c')][_0xab15('0x24')]({'where':_0x4f927f[_0xab15('0x1d')]?_0x4f927f[_0xab15('0x1d')][_0xab15('0x1f')]||null:null})[_0xab15('0x21')](function(_0x3fea29){if(_0x3fea29){return _0x3fea29[_0xab15('0x25')](_0x4f927f[_0xab15('0x26')][_0xab15('0x27')],_[_0xab15('0x28')](_0x4f927f[_0xab15('0x26')],[_0xab15('0x27'),'id'])||{});}})[_0xab15('0x29')](function(_0x533161){logger[_0xab15('0x19')](_0xab15('0x2a'),_0x4f927f);logger[_0xab15('0x13')](_0xab15('0x2a'),_0x4f927f,JSON['stringify'](_0x533161));_0x129118(_0x533161);})[_0xab15('0x1b')](function(_0x261c2b){logger[_0xab15('0x16')](_0xab15('0x2a'),_0x261c2b['message'],_0x4f927f);_0x1f31ee(_this['error'](0x1f4,_0x261c2b[_0xab15('0x18')]));});});}; \ No newline at end of file +var _0x90a7=['./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2996e7,_0x560c2a){var _0x332248=function(_0x269994){while(--_0x269994){_0x2996e7['push'](_0x2996e7['shift']());}};_0x332248(++_0x560c2a);}(_0x90a7,0xff));var _0x790a=function(_0x252594,_0x2dec0c){_0x252594=_0x252594-0x0;var _0x1053b7=_0x90a7[_0x252594];return _0x1053b7;};'use strict';var _=require(_0x790a('0x0'));var util=require('util');var moment=require(_0x790a('0x1'));var BPromise=require(_0x790a('0x2'));var rs=require(_0x790a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x790a('0x4'))['db'];var utils=require(_0x790a('0x5'));var logger=require('../../config/logger')(_0x790a('0x6'));var config=require(_0x790a('0x7'));var jayson=require(_0x790a('0x8'));var client=jayson[_0x790a('0x9')][_0x790a('0xa')]({'port':0x232a});config[_0x790a('0xb')]=_[_0x790a('0xc')](config[_0x790a('0xb')],{'host':_0x790a('0xd'),'port':0x18eb});var socket=require(_0x790a('0xe'))(new Redis(config[_0x790a('0xb')]));require(_0x790a('0xf'))[_0x790a('0x10')](socket);function respondWithRpcPromise(_0x4e23a7,_0x183daa,_0x5b88ca){return new BPromise(function(_0x4166ff,_0xac7009){return client[_0x790a('0x11')](_0x4e23a7,_0x5b88ca)[_0x790a('0x12')](function(_0x38b255){logger[_0x790a('0x13')](_0x790a('0x14'),_0x183daa,_0x790a('0x15'));logger[_0x790a('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x183daa,_0x790a('0x15'),JSON[_0x790a('0x17')](_0x38b255));if(_0x38b255[_0x790a('0x18')]){if(_0x38b255['error'][_0x790a('0x19')]===0x1f4){logger['error'](_0x790a('0x14'),_0x183daa,_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);return _0xac7009(_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);}logger[_0x790a('0x18')](_0x790a('0x14'),_0x183daa,_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);return _0x4166ff(_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);}else{logger[_0x790a('0x13')](_0x790a('0x14'),_0x183daa,_0x790a('0x15'));_0x4166ff(_0x38b255[_0x790a('0x1b')][_0x790a('0x1a')]);}})[_0x790a('0x1c')](function(_0xd5eff0){logger[_0x790a('0x18')](_0x790a('0x14'),_0x183daa,_0xd5eff0);_0xac7009(_0xd5eff0);});});}exports[_0x790a('0x1d')]=function(_0x3c602f){var _0x2e08d5=this;return new Promise(function(_0x2f7a41,_0x4e9119){return db[_0x790a('0x1e')][_0x790a('0x1f')](_0x3c602f[_0x790a('0x20')],{'raw':_0x3c602f[_0x790a('0x21')]?_0x3c602f[_0x790a('0x21')][_0x790a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c602f[_0x790a('0x21')]?_0x3c602f[_0x790a('0x21')][_0x790a('0x23')]||null:null,'attributes':_0x3c602f['options']?_0x3c602f['options'][_0x790a('0x24')]||null:null,'limit':_0x3c602f[_0x790a('0x21')]?_0x3c602f['options'][_0x790a('0x25')]||null:null})[_0x790a('0x12')](function(_0x4d674b){logger[_0x790a('0x13')]('UpdateSmsInteraction',_0x3c602f);logger[_0x790a('0x16')](_0x790a('0x1d'),_0x3c602f,JSON['stringify'](_0x4d674b));_0x2f7a41(_0x4d674b);})[_0x790a('0x1c')](function(_0x5c7d8f){logger[_0x790a('0x18')]('UpdateSmsInteraction',_0x5c7d8f['message'],_0x3c602f);_0x4e9119(_0x2e08d5[_0x790a('0x18')](0x1f4,_0x5c7d8f[_0x790a('0x1a')]));});});};exports[_0x790a('0x26')]=function(_0x233416){return new Promise(function(_0x5c6bf7,_0xd5e141){return db[_0x790a('0x1e')][_0x790a('0x27')]({'where':_0x233416[_0x790a('0x21')]?_0x233416[_0x790a('0x21')][_0x790a('0x23')]||null:null})['then'](function(_0xe3a20){if(_0xe3a20){return _0xe3a20[_0x790a('0x28')](_0x233416[_0x790a('0x20')][_0x790a('0x29')],_[_0x790a('0x2a')](_0x233416['body'],[_0x790a('0x29'),'id'])||{});}})[_0x790a('0x2b')](function(_0x4aea9d){logger[_0x790a('0x13')](_0x790a('0x2c'),_0x233416);logger[_0x790a('0x16')](_0x790a('0x2c'),_0x233416,JSON[_0x790a('0x17')](_0x4aea9d));_0x5c6bf7(_0x4aea9d);})[_0x790a('0x1c')](function(_0x1bba9b){logger['error'](_0x790a('0x2c'),_0x1bba9b[_0x790a('0x1a')],_0x233416);_0xd5e141(_this[_0x790a('0x18')](0x1f4,_0x1bba9b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a7ee822..16eed05 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 _0x8a36=['removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove','update'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x8a36,0x10c));var _0x68a3=function(_0x5d31ee,_0x183e43){_0x5d31ee=_0x5d31ee-0x0;var _0x21c2e6=_0x8a36[_0x5d31ee];return _0x21c2e6;};'use strict';var SmsInteractionEvents=require(_0x68a3('0x0'));var events=[_0x68a3('0x1'),_0x68a3('0x2'),_0x68a3('0x3')];function createListener(_0x284b78,_0x1d9088){return function(_0x4e1e66){_0x1d9088['emit'](_0x284b78,_0x4e1e66);};}function removeListener(_0xaac528,_0x3803f3){return function(){SmsInteractionEvents[_0x68a3('0x4')](_0xaac528,_0x3803f3);};}exports[_0x68a3('0x5')]=function(_0xd0c492){for(var _0x351396=0x0,_0x383d03=events[_0x68a3('0x6')];_0x351396<_0x383d03;_0x351396++){var _0x242e4f=events[_0x351396];var _0x3443f6=createListener(_0x68a3('0x7')+_0x242e4f,_0xd0c492);SmsInteractionEvents['on'](_0x242e4f,_0x3443f6);}}; \ No newline at end of file +var _0x5d21=['length','./smsInteraction.events','save','update','emit'];(function(_0x1cc779,_0xefcc6c){var _0x167bed=function(_0x41d8ba){while(--_0x41d8ba){_0x1cc779['push'](_0x1cc779['shift']());}};_0x167bed(++_0xefcc6c);}(_0x5d21,0x79));var _0x15d2=function(_0x4aa297,_0x2b21de){_0x4aa297=_0x4aa297-0x0;var _0x3f70a3=_0x5d21[_0x4aa297];return _0x3f70a3;};'use strict';var SmsInteractionEvents=require(_0x15d2('0x0'));var events=[_0x15d2('0x1'),'remove',_0x15d2('0x2')];function createListener(_0x5e4b0c,_0x36ca1b){return function(_0x8ff887){_0x36ca1b[_0x15d2('0x3')](_0x5e4b0c,_0x8ff887);};}function removeListener(_0x30eb05,_0x2afdcc){return function(){SmsInteractionEvents['removeListener'](_0x30eb05,_0x2afdcc);};}exports['register']=function(_0x4bdbea){for(var _0x48293c=0x0,_0x500086=events[_0x15d2('0x4')];_0x48293c<_0x500086;_0x48293c++){var _0x1cc6e9=events[_0x48293c];var _0x1b5039=createListener('smsInteraction:'+_0x1cc6e9,_0x4bdbea);SmsInteractionEvents['on'](_0x1cc6e9,_0x1b5039);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1fb2e8c..4e21e94 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 _0x762c=['show','sms','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x4ed365,_0x41a88e){var _0x42af37=function(_0x21987d){while(--_0x21987d){_0x4ed365['push'](_0x4ed365['shift']());}};_0x42af37(++_0x41a88e);}(_0x762c,0x1d2));var _0xc762=function(_0x482f12,_0x20c7e9){_0x482f12=_0x482f12-0x0;var _0x278200=_0x762c[_0x482f12];return _0x278200;};'use strict';var multer=require(_0xc762('0x0'));var util=require(_0xc762('0x1'));var path=require(_0xc762('0x2'));var timeout=require(_0xc762('0x3'));var express=require('express');var router=express[_0xc762('0x4')]();var fs_extra=require(_0xc762('0x5'));var auth=require(_0xc762('0x6'));var interaction=require(_0xc762('0x7'));var config=require(_0xc762('0x8'));var controller=require('./smsMessage.controller');router[_0xc762('0x9')]('/',auth['isAuthenticated'](),controller[_0xc762('0xa')]);router['get']('/describe',auth[_0xc762('0xb')](),controller[_0xc762('0xc')]);router[_0xc762('0x9')](_0xc762('0xd'),auth['isAuthenticated'](),controller[_0xc762('0xe')]);router['post']('/',auth[_0xc762('0xb')](),interaction['tracked'](_0xc762('0xf'),'smsmessage:create'),controller['create']);router['post']('/:id/status',controller[_0xc762('0x10')]);router[_0xc762('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc762('0x12')]);router[_0xc762('0x11')](_0xc762('0x13'),auth[_0xc762('0xb')](),controller[_0xc762('0x14')]);router[_0xc762('0x11')](_0xc762('0x15'),auth['isAuthenticated'](),controller[_0xc762('0x16')]);router[_0xc762('0x17')](_0xc762('0xd'),auth[_0xc762('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3e22=['index','get','isAuthenticated','/:id','post','tracked','sms','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller'];(function(_0x347b25,_0x44fd7d){var _0x5002d4=function(_0x2c262d){while(--_0x2c262d){_0x347b25['push'](_0x347b25['shift']());}};_0x5002d4(++_0x44fd7d);}(_0x3e22,0xd7));var _0x23e2=function(_0x39681e,_0x3109ba){_0x39681e=_0x39681e-0x0;var _0x79eb6e=_0x3e22[_0x39681e];return _0x79eb6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x23e2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x23e2('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x23e2('0x2'));var interaction=require(_0x23e2('0x3'));var config=require('../../config/environment');var controller=require(_0x23e2('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x23e2('0x5')]);router[_0x23e2('0x6')]('/describe',auth[_0x23e2('0x7')](),controller['describe']);router[_0x23e2('0x6')](_0x23e2('0x8'),auth[_0x23e2('0x7')](),controller['show']);router[_0x23e2('0x9')]('/',auth[_0x23e2('0x7')](),interaction[_0x23e2('0xa')](_0x23e2('0xb'),'smsmessage:create'),controller['create']);router['post'](_0x23e2('0xc'),controller[_0x23e2('0xd')]);router[_0x23e2('0xe')]('/:id',auth[_0x23e2('0x7')](),controller[_0x23e2('0xf')]);router['put'](_0x23e2('0x10'),auth[_0x23e2('0x7')](),controller[_0x23e2('0x11')]);router[_0x23e2('0xe')](_0x23e2('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0x23e2('0x13')](_0x23e2('0x8'),auth[_0x23e2('0x7')](),controller[_0x23e2('0x14')]);module[_0x23e2('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 449083f..c2a87f4 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 _0x8cce=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8cce,0xee));var _0xe8cc=function(_0x8b8d4b,_0x20d768){_0x8b8d4b=_0x8b8d4b-0x0;var _0x5bc9c7=_0x8cce[_0x8b8d4b];return _0x5bc9c7;};'use strict';var Sequelize=require(_0xe8cc('0x0'));module[_0xe8cc('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe8cc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe8cc('0x3')]('in',_0xe8cc('0x4')),'defaultValue':_0xe8cc('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe8cc('0x5')](0xbe)},'phone':{'type':Sequelize[_0xe8cc('0x5')]},'readAt':{'type':Sequelize[_0xe8cc('0x6')]},'secret':{'type':Sequelize[_0xe8cc('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe8cc('0x5')]},'providerResponse':{'type':Sequelize[_0xe8cc('0x7')]}}; \ No newline at end of file +var _0xde64=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x105a3e,_0x47885a){var _0x5f30e0=function(_0x35a200){while(--_0x35a200){_0x105a3e['push'](_0x105a3e['shift']());}};_0x5f30e0(++_0x47885a);}(_0xde64,0x17c));var _0x4de6=function(_0x31050d,_0x21e6a2){_0x31050d=_0x31050d-0x0;var _0x3bb5b7=_0xde64[_0x31050d];return _0x3bb5b7;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'body':{'type':Sequelize[_0x4de6('0x2')](_0x4de6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4de6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4de6('0x5')]('in','out'),'defaultValue':_0x4de6('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4de6('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x4de6('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4de6('0x7')]},'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 cfba30b..68caf4a 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 _0xb875=['rows','show','params','rawAttributes','find','create','body','describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','email','manual','interface','channel','motionChannel','EventManager','acceptmessage','sms-interactions','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT','contact','fullname','internal','SIP/%s','event','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','destroy','stack','name','send','index','map','SmsMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x1e8f08,_0x3f2eef){var _0x335bf4=function(_0x14d593){while(--_0x14d593){_0x1e8f08['push'](_0x1e8f08['shift']());}};_0x335bf4(++_0x3f2eef);}(_0xb875,0x167));var _0x5b87=function(_0x14b86b,_0x2ef86e){_0x14b86b=_0x14b86b-0x0;var _0x36bd79=_0xb875[_0x14b86b];return _0x36bd79;};'use strict';var emlformat=require(_0x5b87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b87('0x1'));var moment=require('moment');var BPromise=require(_0x5b87('0x2'));var Mustache=require(_0x5b87('0x3'));var util=require('util');var path=require(_0x5b87('0x4'));var sox=require(_0x5b87('0x5'));var csv=require(_0x5b87('0x6'));var ejs=require(_0x5b87('0x7'));var fs=require('fs');var fs_extra=require(_0x5b87('0x8'));var _=require(_0x5b87('0x9'));var squel=require(_0x5b87('0xa'));var crypto=require(_0x5b87('0xb'));var jsforce=require(_0x5b87('0xc'));var deskjs=require(_0x5b87('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5b87('0xe'));var Papa=require('papaparse');var Redis=require(_0x5b87('0xf'));var authService=require(_0x5b87('0x10'));var qs=require(_0x5b87('0x11'));var as=require(_0x5b87('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5b87('0x13'));var utils=require(_0x5b87('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5b87('0x15'));var db=require(_0x5b87('0x16'))['db'];config[_0x5b87('0x17')]=_[_0x5b87('0x18')](config[_0x5b87('0x17')],{'host':_0x5b87('0x19'),'port':0x18eb});var socket=require(_0x5b87('0x1a'))(new Redis(config[_0x5b87('0x17')]));require(_0x5b87('0x1b'))['register'](socket);var jayson=require(_0x5b87('0x1c'));var client=jayson['client'][_0x5b87('0x1d')]({'port':0x232c});var client9002=jayson[_0x5b87('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59bf2b,_0x2f9003,_0x539659,_0x971dd9){return new BPromise(function(_0x175452,_0x126371){var _0x13cb13=_0x971dd9||client;return _0x13cb13[_0x5b87('0x1f')](_0x59bf2b,_0x539659)[_0x5b87('0x20')](function(_0x384289){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2f9003,'request\x20sent');logger['debug'](_0x5b87('0x21'),_0x2f9003,_0x5b87('0x22'),JSON[_0x5b87('0x23')](_0x384289));if(_0x384289[_0x5b87('0x24')]){if(_0x384289[_0x5b87('0x24')]['code']===0x1f4){logger[_0x5b87('0x24')]('SmsMessage,\x20%s,\x20%s',_0x2f9003,_0x384289['error'][_0x5b87('0x25')]);return _0x126371(_0x384289[_0x5b87('0x24')]['message']);}logger[_0x5b87('0x24')](_0x5b87('0x26'),_0x2f9003,_0x384289[_0x5b87('0x24')][_0x5b87('0x25')]);return _0x175452(_0x384289[_0x5b87('0x24')][_0x5b87('0x25')]);}else{logger[_0x5b87('0x27')](_0x5b87('0x26'),_0x2f9003,_0x5b87('0x22'));_0x175452(_0x384289[_0x5b87('0x28')]['message']);}})[_0x5b87('0x29')](function(_0x250dec){logger[_0x5b87('0x24')](_0x5b87('0x26'),_0x2f9003,_0x250dec);_0x126371(_0x250dec);});});}function respondWithStatusCode(_0x1cfb4b,_0x1368e1){_0x1368e1=_0x1368e1||0xcc;return function(_0x2d8edf){if(_0x2d8edf){return _0x1cfb4b[_0x5b87('0x2a')](_0x1368e1);}return _0x1cfb4b[_0x5b87('0x2b')](_0x1368e1)[_0x5b87('0x2c')]();};}function respondWithResult(_0x1b5ebd,_0x5a9f77){_0x5a9f77=_0x5a9f77||0xc8;return function(_0x490200){if(_0x490200){return _0x1b5ebd[_0x5b87('0x2b')](_0x5a9f77)['json'](_0x490200);}};}function respondWithFilteredResult(_0x706a59,_0x369fac){return function(_0x5806b0){if(_0x5806b0){var _0x49f639=typeof _0x369fac[_0x5b87('0x2d')]===_0x5b87('0x2e')&&typeof _0x369fac[_0x5b87('0x2f')]===_0x5b87('0x2e');var _0xa87aad=_0x5806b0['count'];var _0x945992=_0x49f639?0x0:_0x369fac[_0x5b87('0x2d')];var _0x48ed7b=_0x49f639?_0x5806b0[_0x5b87('0x30')]:_0x369fac['offset']+_0x369fac[_0x5b87('0x2f')];var _0x23649e;if(_0x48ed7b>=_0xa87aad){_0x48ed7b=_0xa87aad;_0x23649e=0xc8;}else{_0x23649e=0xce;}_0x706a59[_0x5b87('0x2b')](_0x23649e);return _0x706a59['set'](_0x5b87('0x31'),_0x945992+'-'+_0x48ed7b+'/'+_0xa87aad)[_0x5b87('0x32')](_0x5806b0);}return null;};}function patchUpdates(_0x218752){return function(_0x1f96c7){try{jsonpatch['apply'](_0x1f96c7,_0x218752,!![]);}catch(_0x53cd7a){return BPromise['reject'](_0x53cd7a);}return _0x1f96c7[_0x5b87('0x33')]();};}function saveUpdates(_0x4caa9b,_0x101522){return function(_0x5061ec){if(_0x5061ec){return _0x5061ec[_0x5b87('0x34')](_0x4caa9b)[_0x5b87('0x20')](function(_0x4798ad){return _0x4798ad;});}return null;};}function removeEntity(_0x2b9a2a,_0xe379a4){return function(_0x16e143){if(_0x16e143){return _0x16e143[_0x5b87('0x35')]()['then'](function(){_0x2b9a2a[_0x5b87('0x2b')](0xcc)[_0x5b87('0x2c')]();});}};}function handleEntityNotFound(_0x304e5e,_0x3d50f0){return function(_0x308819){if(!_0x308819){_0x304e5e[_0x5b87('0x2a')](0x194);}return _0x308819;};}function handleError(_0x136624,_0x3afa0d){_0x3afa0d=_0x3afa0d||0x1f4;return function(_0x2c5360){logger[_0x5b87('0x24')](_0x2c5360[_0x5b87('0x36')]);if(_0x2c5360['name']){delete _0x2c5360[_0x5b87('0x37')];}_0x136624['status'](_0x3afa0d)[_0x5b87('0x38')](_0x2c5360);};}exports[_0x5b87('0x39')]=function(_0x3e8a70,_0x4e03fd){var _0x74bdcc={},_0x3c7575={},_0x17b264={'count':0x0,'rows':[]};var _0x213a9c=_[_0x5b87('0x3a')](db[_0x5b87('0x3b')]['rawAttributes'],function(_0x2ddd6a){return{'name':_0x2ddd6a[_0x5b87('0x3c')],'type':_0x2ddd6a['type'][_0x5b87('0x3d')]};});_0x3c7575[_0x5b87('0x3e')]=_[_0x5b87('0x3a')](_0x213a9c,_0x5b87('0x37'));_0x3c7575[_0x5b87('0x3f')]=_['keys'](_0x3e8a70[_0x5b87('0x3f')]);_0x3c7575[_0x5b87('0x40')]=_[_0x5b87('0x41')](_0x3c7575['model'],_0x3c7575[_0x5b87('0x3f')]);_0x74bdcc[_0x5b87('0x42')]=_['intersection'](_0x3c7575[_0x5b87('0x3e')],qs[_0x5b87('0x43')](_0x3e8a70[_0x5b87('0x3f')][_0x5b87('0x43')]));_0x74bdcc['attributes']=_0x74bdcc[_0x5b87('0x42')][_0x5b87('0x44')]?_0x74bdcc[_0x5b87('0x42')]:_0x3c7575[_0x5b87('0x3e')];if(!_0x3e8a70[_0x5b87('0x3f')]['hasOwnProperty'](_0x5b87('0x45'))){_0x74bdcc[_0x5b87('0x2f')]=qs[_0x5b87('0x2f')](_0x3e8a70[_0x5b87('0x3f')][_0x5b87('0x2f')]);_0x74bdcc[_0x5b87('0x2d')]=qs['offset'](_0x3e8a70[_0x5b87('0x3f')][_0x5b87('0x2d')]);}_0x74bdcc['order']=qs[_0x5b87('0x46')](_0x3e8a70[_0x5b87('0x3f')][_0x5b87('0x46')]);_0x74bdcc['where']=qs[_0x5b87('0x40')](_[_0x5b87('0x47')](_0x3e8a70[_0x5b87('0x3f')],_0x3c7575[_0x5b87('0x40')]),_0x213a9c);if(_0x3e8a70[_0x5b87('0x3f')]['filter']){_0x74bdcc[_0x5b87('0x48')]=_[_0x5b87('0x49')](_0x74bdcc[_0x5b87('0x48')],{'$or':_[_0x5b87('0x3a')](_0x213a9c,function(_0x30c188){if(_0x30c188['type']!==_0x5b87('0x4a')){var _0x319502={};_0x319502[_0x30c188[_0x5b87('0x37')]]={'$like':'%'+_0x3e8a70[_0x5b87('0x3f')]['filter']+'%'};return _0x319502;}})});}_0x74bdcc=_[_0x5b87('0x49')]({},_0x74bdcc,_0x3e8a70[_0x5b87('0x4b')]);var _0x2d63ac={'where':_0x74bdcc['where']};return db['SmsMessage'][_0x5b87('0x30')](_0x2d63ac)[_0x5b87('0x20')](function(_0x2970ef){_0x17b264['count']=_0x2970ef;if(_0x3e8a70[_0x5b87('0x3f')][_0x5b87('0x4c')]){_0x74bdcc[_0x5b87('0x4d')]=[{'all':!![]}];}return db[_0x5b87('0x3b')][_0x5b87('0x4e')](_0x74bdcc);})[_0x5b87('0x20')](function(_0xf4edb0){_0x17b264[_0x5b87('0x4f')]=_0xf4edb0;return _0x17b264;})[_0x5b87('0x20')](respondWithFilteredResult(_0x4e03fd,_0x74bdcc))[_0x5b87('0x29')](handleError(_0x4e03fd,null));};exports[_0x5b87('0x50')]=function(_0x290714,_0x582f48){var _0x54e1d6={'raw':!![],'where':{'id':_0x290714[_0x5b87('0x51')]['id']}},_0x5004f5={};_0x5004f5[_0x5b87('0x3e')]=_['keys'](db['SmsMessage'][_0x5b87('0x52')]);_0x5004f5[_0x5b87('0x3f')]=_['keys'](_0x290714[_0x5b87('0x3f')]);_0x5004f5[_0x5b87('0x40')]=_[_0x5b87('0x41')](_0x5004f5[_0x5b87('0x3e')],_0x5004f5[_0x5b87('0x3f')]);_0x54e1d6[_0x5b87('0x42')]=_['intersection'](_0x5004f5['model'],qs[_0x5b87('0x43')](_0x290714['query'][_0x5b87('0x43')]));_0x54e1d6[_0x5b87('0x42')]=_0x54e1d6[_0x5b87('0x42')][_0x5b87('0x44')]?_0x54e1d6[_0x5b87('0x42')]:_0x5004f5[_0x5b87('0x3e')];if(_0x290714[_0x5b87('0x3f')]['includeAll']){_0x54e1d6[_0x5b87('0x4d')]=[{'all':!![]}];}_0x54e1d6=_[_0x5b87('0x49')]({},_0x54e1d6,_0x290714['options']);return db[_0x5b87('0x3b')][_0x5b87('0x53')](_0x54e1d6)[_0x5b87('0x20')](handleEntityNotFound(_0x582f48,null))['then'](respondWithResult(_0x582f48,null))[_0x5b87('0x29')](handleError(_0x582f48,null));};exports[_0x5b87('0x54')]=function(_0x310ac7,_0x15bff3){return db[_0x5b87('0x3b')][_0x5b87('0x54')](_0x310ac7['body'],{})[_0x5b87('0x20')](respondWithResult(_0x15bff3,0xc9))['catch'](handleError(_0x15bff3,null));};exports[_0x5b87('0x34')]=function(_0x17b178,_0x5bb874){if(_0x17b178[_0x5b87('0x55')]['id']){delete _0x17b178[_0x5b87('0x55')]['id'];}return db[_0x5b87('0x3b')]['find']({'where':{'id':_0x17b178[_0x5b87('0x51')]['id']}})['then'](handleEntityNotFound(_0x5bb874,null))[_0x5b87('0x20')](saveUpdates(_0x17b178[_0x5b87('0x55')],null))[_0x5b87('0x20')](respondWithResult(_0x5bb874,null))[_0x5b87('0x29')](handleError(_0x5bb874,null));};exports[_0x5b87('0x35')]=function(_0x52ad3d,_0x1bd031){return db[_0x5b87('0x3b')][_0x5b87('0x53')]({'where':{'id':_0x52ad3d[_0x5b87('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bd031,null))[_0x5b87('0x20')](removeEntity(_0x1bd031,null))[_0x5b87('0x29')](handleError(_0x1bd031,null));};exports[_0x5b87('0x56')]=function(_0x3f9f10,_0x3c58a5){return db[_0x5b87('0x3b')][_0x5b87('0x56')]()[_0x5b87('0x20')](respondWithResult(_0x3c58a5,null))[_0x5b87('0x29')](handleError(_0x3c58a5,null));};var interaction_log=require(_0x5b87('0x57'))('sms-interactions');exports[_0x5b87('0x58')]=function(_0x5e879c,_0x4c2228,_0x3eec53){var _0x3603e9={'agent':{},'channel':'sms'};if(_0x5e879c[_0x5b87('0x55')]['id']){delete _0x5e879c[_0x5b87('0x55')]['id'];}_0x5e879c[_0x5b87('0x55')][_0x5b87('0x59')]=!![];_0x5e879c['body'][_0x5b87('0x5a')]=moment()[_0x5b87('0x5b')](_0x5b87('0x5c'));_0x5e879c[_0x5b87('0x55')][_0x5b87('0x5d')]=_0x5e879c[_0x5b87('0x55')][_0x5b87('0x5d')]||_0x5e879c['user']['id'];_0x3603e9[_0x5b87('0x5e')]['id']=_0x5e879c[_0x5b87('0x55')][_0x5b87('0x5d')];return db[_0x5b87('0x3b')][_0x5b87('0x53')]({'where':{'id':_0x5e879c[_0x5b87('0x51')]['id'],'UserId':null}})[_0x5b87('0x20')](handleEntityNotFound(_0x4c2228,null))['then'](saveUpdates(_0x5e879c['body'],null))[_0x5b87('0x20')](function(_0x53191e){if(_0x53191e){_0x3603e9[_0x5b87('0x25')]=_0x53191e[_0x5b87('0x5f')]({'plain':!![]});return db['SmsInteraction'][_0x5b87('0x53')]({'where':{'id':_0x53191e[_0x5b87('0x60')]}});}return null;})[_0x5b87('0x20')](handleEntityNotFound(_0x4c2228,null))[_0x5b87('0x20')](function(_0x352a04){if(_0x352a04){return _0x352a04[_0x5b87('0x34')]({'UserId':_0x5e879c[_0x5b87('0x55')][_0x5b87('0x5d')],'read1stAt':_[_0x5b87('0x61')](_0x352a04[_0x5b87('0x62')])?moment()[_0x5b87('0x5b')](_0x5b87('0x5c')):undefined});}return null;})[_0x5b87('0x20')](function(_0x1962c5){if(_0x1962c5){_0x3603e9[_0x5b87('0x63')]=_0x1962c5['get']({'plain':!![]});interaction_log[_0x5b87('0x27')](_0x5b87('0x64'),_0x5e879c['user']['id'],_0x5e879c['user'][_0x5b87('0x37')],_0x5e879c[_0x5b87('0x65')]['role'],_0x3603e9[_0x5b87('0x63')]['id'],_0x5e879c[_0x5b87('0x55')]?JSON[_0x5b87('0x23')](_0x5e879c[_0x5b87('0x55')]):_0x5b87('0x66'));return respondWithRpcPromise(_0x5b87('0x67'),_0x5b87('0x68'),_0x3603e9);}return null;})['then'](function(_0x14fbfa){var _0x52a443=_0x5b87('0x69')+_0x14fbfa[_0x5b87('0x25')][_0x5b87('0x6a')];return db[_0x5b87('0x6b')][_0x5b87('0x3f')](_0x52a443,{'type':db['Sequelize'][_0x5b87('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x32d0a1){return _0x32d0a1;});})[_0x5b87('0x20')](function(_0x1b5153){if(_0x1b5153){_0x3603e9[_0x5b87('0x25')]['contact']=_0x1b5153[0x0];if(!_0x5e879c[_0x5b87('0x55')][_0x5b87('0x5d')])return;return db['User']['find']({'where':{'id':_0x5e879c[_0x5b87('0x55')][_0x5b87('0x5d')],'role':_0x5b87('0x5e')},'attributes':['id',_0x5b87('0x37'),'fullname',_0x5b87('0x6d'),'internal'],'raw':!![]});}return null;})[_0x5b87('0x20')](function(_0x3baf41){if(!_0x3baf41)return null;_0x3603e9[_0x5b87('0x25')][_0x5b87('0x5e')]=_0x3baf41;return _0x3603e9;})[_0x5b87('0x20')](function(_0x52e61b){if(_0x52e61b){if(_0x5e879c['body'][_0x5b87('0x6e')]){_0x3603e9[_0x5b87('0x25')][_0x5b87('0x6f')]=util['format']('SIP/%s',_0x5e879c['user']['name']);_0x3603e9[_0x5b87('0x25')][_0x5b87('0x70')]=_0x3603e9[_0x5b87('0x70')];_0x3603e9['message'][_0x5b87('0x71')]=_0x3603e9['channel'];_0x3603e9[_0x5b87('0x25')]['event']=_0x5b87('0x58');return respondWithRpcPromise('EventManager',_0x5b87('0x72'),{'event':_0x5b87('0x73'),'message':_0x3603e9[_0x5b87('0x25')]},client9002)[_0x5b87('0x20')](function(){return _0x3603e9;});}return _0x3603e9;}return null;})[_0x5b87('0x20')](respondWithResult(_0x4c2228,null))[_0x5b87('0x29')](handleError(_0x4c2228,null));};var interaction_log=require(_0x5b87('0x57'))(_0x5b87('0x74'));exports[_0x5b87('0x75')]=function(_0x5d9066,_0xa8886e,_0xd9ae9c){var _0xe61525={'agent':{},'channel':_0x5b87('0x76')};if(_0x5d9066[_0x5b87('0x55')]['id']){delete _0x5d9066[_0x5b87('0x55')]['id'];}_0x5d9066['body'][_0x5b87('0x5d')]=_0x5d9066[_0x5b87('0x55')][_0x5b87('0x5d')]||_0x5d9066[_0x5b87('0x65')]['id'];_0xe61525[_0x5b87('0x5e')]['id']=_0x5d9066[_0x5b87('0x55')][_0x5b87('0x5d')];return db['SmsMessage'][_0x5b87('0x53')]({'where':{'id':_0x5d9066[_0x5b87('0x51')]['id'],'UserId':null}})[_0x5b87('0x20')](handleEntityNotFound(_0xa8886e,null))[_0x5b87('0x20')](function(_0x168afc){if(_0x168afc){_0xe61525[_0x5b87('0x25')]=_0x168afc['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x168afc['SmsInteractionId']}});}return null;})[_0x5b87('0x20')](handleEntityNotFound(_0xa8886e,null))[_0x5b87('0x20')](function(_0x589237){if(_0x589237){_0xe61525[_0x5b87('0x63')]=_0x589237['get']({'plain':!![]});interaction_log[_0x5b87('0x27')](_0x5b87('0x77'),_0x5d9066['user']['id'],_0x5d9066['user'][_0x5b87('0x37')],_0x5d9066[_0x5b87('0x65')][_0x5b87('0x78')],_0xe61525['interaction']['id'],_0x5d9066[_0x5b87('0x55')]?JSON[_0x5b87('0x23')](_0x5d9066[_0x5b87('0x55')]):_0x5b87('0x66'));return respondWithRpcPromise(_0x5b87('0x79'),_0x5b87('0x7a'),_0xe61525);}return null;})[_0x5b87('0x20')](function(_0x51e5ed){var _0x450879=_0x5b87('0x69')+_0x51e5ed['message'][_0x5b87('0x6a')];return db[_0x5b87('0x6b')]['query'](_0x450879,{'type':db['Sequelize']['QueryTypes'][_0x5b87('0x7b')],'raw':!![]})[_0x5b87('0x20')](function(_0xae397){return _0xae397;});})['then'](function(_0x330ba9){if(_0x330ba9){_0xe61525[_0x5b87('0x25')][_0x5b87('0x7c')]=_0x330ba9[0x0];if(!_0x5d9066['body'][_0x5b87('0x5d')])return;return db['User'][_0x5b87('0x53')]({'where':{'id':_0x5d9066['body'][_0x5b87('0x5d')],'role':_0x5b87('0x5e')},'attributes':['id','name',_0x5b87('0x7d'),_0x5b87('0x6d'),_0x5b87('0x7e')],'raw':!![]});}return null;})[_0x5b87('0x20')](function(_0x414faf){if(!_0x414faf)return null;_0xe61525[_0x5b87('0x25')][_0x5b87('0x5e')]=_0x414faf;return _0xe61525;})['then'](function(_0xaf289e){if(_0xaf289e){_0xaf289e[_0x5b87('0x25')][_0x5b87('0x6f')]=util['format'](_0x5b87('0x7f'),_0x5d9066[_0x5b87('0x65')][_0x5b87('0x37')]);_0xaf289e[_0x5b87('0x25')][_0x5b87('0x70')]=_0xe61525[_0x5b87('0x70')];_0xaf289e['message']['motionChannel']=_0xe61525[_0x5b87('0x70')];_0xaf289e['message'][_0x5b87('0x80')]=_0x5b87('0x75');respondWithRpcPromise('EventManager',_0x5b87('0x72'),{'event':'rejectmessage','message':_0xaf289e[_0x5b87('0x25')]},client9002);return _0xe61525;}return null;})[_0x5b87('0x20')](respondWithResult(_0xa8886e,null))[_0x5b87('0x29')](handleError(_0xa8886e,null));};exports[_0x5b87('0x2b')]=function(_0x158e99,_0x27f889,_0x3f4ea6){if(_0x158e99['body']['id']){delete _0x158e99[_0x5b87('0x55')]['id'];}var _0xdafc68;return db[_0x5b87('0x3b')][_0x5b87('0x53')]({'where':{'id':_0x158e99[_0x5b87('0x51')]['id']}})[_0x5b87('0x20')](handleEntityNotFound(_0x27f889,null))['then'](function(_0x40b941){if(_0x40b941){_0xdafc68=_0x40b941;return db[_0x5b87('0x81')]['find']({'where':{'id':_0x40b941[_0x5b87('0x82')]}});}})[_0x5b87('0x20')](handleEntityNotFound(_0x27f889,null))[_0x5b87('0x20')](function(_0x559086){if(_0x559086){logger[_0x5b87('0x83')](_0x5b87('0x21'),_0x5b87('0x2b'),_0x5b87('0x84'),_0x559086[_0x5b87('0x85')],util[_0x5b87('0x86')](_0x158e99['body'],{'showHidden':![],'depth':null}));switch(_0x559086[_0x5b87('0x85')]){case'twilio':if(_0x158e99[_0x5b87('0x55')][_0x5b87('0x87')]&&_0x158e99['body'][_0x5b87('0x87')]===_0xdafc68[_0x5b87('0x88')]){return _0xdafc68[_0x5b87('0x34')]({'read':!![]});}else{logger[_0x5b87('0x24')](_0x5b87('0x89'),'status',_0x5b87('0x8a'),util[_0x5b87('0x86')](_0x158e99[_0x5b87('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5b87('0x8b'):if(_0x158e99[_0x5b87('0x55')][_0x5b87('0x8c')]&&_0x158e99[_0x5b87('0x55')][_0x5b87('0x8c')]===_0xdafc68[_0x5b87('0x88')]&&_[_0x5b87('0x8d')]([_0x5b87('0x8e'),'delivered'],_0x158e99['body'][_0x5b87('0x8f')])>=0x0){return _0xdafc68[_0x5b87('0x34')]({'read':!![]});}else{logger[_0x5b87('0x24')](_0x5b87('0x89'),'status',_0x5b87('0x90'),util['inspect'](_0x158e99[_0x5b87('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5b87('0x91'):var _0x5c49b4=_0x158e99['body']['results'][0x0];if(_0x5c49b4['status']['groupName']==='DELIVERED'){return _0xdafc68['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b87('0x2b'),'infobip',util[_0x5b87('0x86')](_0x158e99['body'],{'showHidden':![],'depth':null}));}break;}return _0xdafc68;}})[_0x5b87('0x20')](respondWithResult(_0x27f889,null))['catch'](handleError(_0x27f889,null));}; \ No newline at end of file +var _0x363a=['plivo','MessageUUID','messageId','indexOf','sent','groupName','DELIVERED','infobip','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','stack','name','send','index','SmsMessage','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','params','length','create','body','update','find','describe','../../config/logger','accept','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','internal','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5b6bcb,_0x833e11){var _0x36eea7=function(_0x4e13b3){while(--_0x4e13b3){_0x5b6bcb['push'](_0x5b6bcb['shift']());}};_0x36eea7(++_0x833e11);}(_0x363a,0x97));var _0xa363=function(_0x51276e,_0x28b616){_0x51276e=_0x51276e-0x0;var _0x1f5f30=_0x363a[_0x51276e];return _0x1f5f30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa363('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa363('0x1'));var rp=require('request-promise');var moment=require(_0xa363('0x2'));var BPromise=require(_0xa363('0x3'));var Mustache=require('mustache');var util=require(_0xa363('0x4'));var path=require(_0xa363('0x5'));var sox=require(_0xa363('0x6'));var csv=require('to-csv');var ejs=require(_0xa363('0x7'));var fs=require('fs');var fs_extra=require(_0xa363('0x8'));var _=require(_0xa363('0x9'));var squel=require(_0xa363('0xa'));var crypto=require(_0xa363('0xb'));var jsforce=require(_0xa363('0xc'));var deskjs=require(_0xa363('0xd'));var toCsv=require(_0xa363('0xe'));var querystring=require('querystring');var Papa=require(_0xa363('0xf'));var Redis=require(_0xa363('0x10'));var authService=require(_0xa363('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa363('0x12'));var logger=require('../../config/logger')(_0xa363('0x13'));var utils=require('../../config/utils');var config=require(_0xa363('0x14'));var licenseUtil=require(_0xa363('0x15'));var db=require('../../mysqldb')['db'];config[_0xa363('0x16')]=_[_0xa363('0x17')](config[_0xa363('0x16')],{'host':_0xa363('0x18'),'port':0x18eb});var socket=require(_0xa363('0x19'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xa363('0x1a')](socket);var jayson=require(_0xa363('0x1b'));var client=jayson[_0xa363('0x1c')][_0xa363('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d5ef9,_0x324e21,_0x2147a0,_0x12e61b){return new BPromise(function(_0x246d12,_0x4efbde){var _0x4e19ff=_0x12e61b||client;return _0x4e19ff[_0xa363('0x1e')](_0x1d5ef9,_0x2147a0)[_0xa363('0x1f')](function(_0x36e683){logger['info']('SmsMessage,\x20%s,\x20%s',_0x324e21,_0xa363('0x20'));logger[_0xa363('0x21')](_0xa363('0x22'),_0x324e21,_0xa363('0x20'),JSON[_0xa363('0x23')](_0x36e683));if(_0x36e683[_0xa363('0x24')]){if(_0x36e683[_0xa363('0x24')][_0xa363('0x25')]===0x1f4){logger['error'](_0xa363('0x26'),_0x324e21,_0x36e683[_0xa363('0x24')]['message']);return _0x4efbde(_0x36e683[_0xa363('0x24')]['message']);}logger['error'](_0xa363('0x26'),_0x324e21,_0x36e683['error']['message']);return _0x246d12(_0x36e683[_0xa363('0x24')][_0xa363('0x27')]);}else{logger['info'](_0xa363('0x26'),_0x324e21,_0xa363('0x20'));_0x246d12(_0x36e683['result'][_0xa363('0x27')]);}})[_0xa363('0x28')](function(_0x2146d8){logger[_0xa363('0x24')](_0xa363('0x26'),_0x324e21,_0x2146d8);_0x4efbde(_0x2146d8);});});}function respondWithStatusCode(_0x521d74,_0x487b79){_0x487b79=_0x487b79||0xcc;return function(_0x2bf989){if(_0x2bf989){return _0x521d74[_0xa363('0x29')](_0x487b79);}return _0x521d74[_0xa363('0x2a')](_0x487b79)[_0xa363('0x2b')]();};}function respondWithResult(_0x2bc213,_0x1d245b){_0x1d245b=_0x1d245b||0xc8;return function(_0x5ca224){if(_0x5ca224){return _0x2bc213[_0xa363('0x2a')](_0x1d245b)[_0xa363('0x2c')](_0x5ca224);}};}function respondWithFilteredResult(_0x3498d7,_0x27e61c){return function(_0x166403){if(_0x166403){var _0x262078=typeof _0x27e61c[_0xa363('0x2d')]===_0xa363('0x2e')&&typeof _0x27e61c[_0xa363('0x2f')]===_0xa363('0x2e');var _0x49edad=_0x166403[_0xa363('0x30')];var _0xdb778f=_0x262078?0x0:_0x27e61c[_0xa363('0x2d')];var _0x53bb7b=_0x262078?_0x166403['count']:_0x27e61c[_0xa363('0x2d')]+_0x27e61c[_0xa363('0x2f')];var _0x276294;if(_0x53bb7b>=_0x49edad){_0x53bb7b=_0x49edad;_0x276294=0xc8;}else{_0x276294=0xce;}_0x3498d7[_0xa363('0x2a')](_0x276294);return _0x3498d7[_0xa363('0x31')](_0xa363('0x32'),_0xdb778f+'-'+_0x53bb7b+'/'+_0x49edad)['json'](_0x166403);}return null;};}function patchUpdates(_0x1cbe00){return function(_0x4af171){try{jsonpatch[_0xa363('0x33')](_0x4af171,_0x1cbe00,!![]);}catch(_0x3e87ec){return BPromise['reject'](_0x3e87ec);}return _0x4af171['save']();};}function saveUpdates(_0x4605b3,_0x3c70fc){return function(_0x2772dd){if(_0x2772dd){return _0x2772dd['update'](_0x4605b3)[_0xa363('0x1f')](function(_0xb142e){return _0xb142e;});}return null;};}function removeEntity(_0x3a71b1,_0x3f0568){return function(_0x3d1aea){if(_0x3d1aea){return _0x3d1aea[_0xa363('0x34')]()[_0xa363('0x1f')](function(){_0x3a71b1[_0xa363('0x2a')](0xcc)[_0xa363('0x2b')]();});}};}function handleEntityNotFound(_0x242a44,_0x541443){return function(_0x232f72){if(!_0x232f72){_0x242a44[_0xa363('0x29')](0x194);}return _0x232f72;};}function handleError(_0x5d4bbd,_0x4a44e3){_0x4a44e3=_0x4a44e3||0x1f4;return function(_0x354e9c){logger['error'](_0x354e9c[_0xa363('0x35')]);if(_0x354e9c[_0xa363('0x36')]){delete _0x354e9c[_0xa363('0x36')];}_0x5d4bbd[_0xa363('0x2a')](_0x4a44e3)[_0xa363('0x37')](_0x354e9c);};}exports[_0xa363('0x38')]=function(_0x2f87ab,_0x1e97ba){var _0x3efe30={},_0x1430ab={},_0x8f7379={'count':0x0,'rows':[]};var _0x5cab45=_['map'](db[_0xa363('0x39')]['rawAttributes'],function(_0x49f51d){return{'name':_0x49f51d['fieldName'],'type':_0x49f51d[_0xa363('0x3a')][_0xa363('0x3b')]};});_0x1430ab[_0xa363('0x3c')]=_[_0xa363('0x3d')](_0x5cab45,_0xa363('0x36'));_0x1430ab[_0xa363('0x3e')]=_[_0xa363('0x3f')](_0x2f87ab[_0xa363('0x3e')]);_0x1430ab[_0xa363('0x40')]=_[_0xa363('0x41')](_0x1430ab[_0xa363('0x3c')],_0x1430ab[_0xa363('0x3e')]);_0x3efe30[_0xa363('0x42')]=_[_0xa363('0x41')](_0x1430ab['model'],qs[_0xa363('0x43')](_0x2f87ab[_0xa363('0x3e')]['fields']));_0x3efe30[_0xa363('0x42')]=_0x3efe30[_0xa363('0x42')]['length']?_0x3efe30[_0xa363('0x42')]:_0x1430ab[_0xa363('0x3c')];if(!_0x2f87ab[_0xa363('0x3e')][_0xa363('0x44')](_0xa363('0x45'))){_0x3efe30[_0xa363('0x2f')]=qs[_0xa363('0x2f')](_0x2f87ab[_0xa363('0x3e')]['limit']);_0x3efe30[_0xa363('0x2d')]=qs[_0xa363('0x2d')](_0x2f87ab['query'][_0xa363('0x2d')]);}_0x3efe30[_0xa363('0x46')]=qs[_0xa363('0x47')](_0x2f87ab[_0xa363('0x3e')][_0xa363('0x47')]);_0x3efe30['where']=qs[_0xa363('0x40')](_[_0xa363('0x48')](_0x2f87ab[_0xa363('0x3e')],_0x1430ab['filters']),_0x5cab45);if(_0x2f87ab[_0xa363('0x3e')][_0xa363('0x49')]){_0x3efe30[_0xa363('0x4a')]=_['merge'](_0x3efe30[_0xa363('0x4a')],{'$or':_[_0xa363('0x3d')](_0x5cab45,function(_0x3762b4){if(_0x3762b4[_0xa363('0x3a')]!==_0xa363('0x4b')){var _0x13bb1e={};_0x13bb1e[_0x3762b4[_0xa363('0x36')]]={'$like':'%'+_0x2f87ab[_0xa363('0x3e')][_0xa363('0x49')]+'%'};return _0x13bb1e;}})});}_0x3efe30=_['merge']({},_0x3efe30,_0x2f87ab[_0xa363('0x4c')]);var _0x29bd55={'where':_0x3efe30['where']};return db[_0xa363('0x39')]['count'](_0x29bd55)[_0xa363('0x1f')](function(_0x4d860e){_0x8f7379[_0xa363('0x30')]=_0x4d860e;if(_0x2f87ab[_0xa363('0x3e')][_0xa363('0x4d')]){_0x3efe30[_0xa363('0x4e')]=[{'all':!![]}];}return db[_0xa363('0x39')]['findAll'](_0x3efe30);})[_0xa363('0x1f')](function(_0x21cdaf){_0x8f7379['rows']=_0x21cdaf;return _0x8f7379;})[_0xa363('0x1f')](respondWithFilteredResult(_0x1e97ba,_0x3efe30))[_0xa363('0x28')](handleError(_0x1e97ba,null));};exports['show']=function(_0x37c0b4,_0xd701a4){var _0x5ebbee={'raw':!![],'where':{'id':_0x37c0b4[_0xa363('0x4f')]['id']}},_0x1b6ddd={};_0x1b6ddd['model']=_[_0xa363('0x3f')](db[_0xa363('0x39')]['rawAttributes']);_0x1b6ddd[_0xa363('0x3e')]=_[_0xa363('0x3f')](_0x37c0b4['query']);_0x1b6ddd['filters']=_[_0xa363('0x41')](_0x1b6ddd[_0xa363('0x3c')],_0x1b6ddd[_0xa363('0x3e')]);_0x5ebbee[_0xa363('0x42')]=_[_0xa363('0x41')](_0x1b6ddd['model'],qs[_0xa363('0x43')](_0x37c0b4[_0xa363('0x3e')][_0xa363('0x43')]));_0x5ebbee['attributes']=_0x5ebbee[_0xa363('0x42')][_0xa363('0x50')]?_0x5ebbee[_0xa363('0x42')]:_0x1b6ddd['model'];if(_0x37c0b4['query']['includeAll']){_0x5ebbee[_0xa363('0x4e')]=[{'all':!![]}];}_0x5ebbee=_['merge']({},_0x5ebbee,_0x37c0b4[_0xa363('0x4c')]);return db[_0xa363('0x39')]['find'](_0x5ebbee)[_0xa363('0x1f')](handleEntityNotFound(_0xd701a4,null))[_0xa363('0x1f')](respondWithResult(_0xd701a4,null))['catch'](handleError(_0xd701a4,null));};exports[_0xa363('0x51')]=function(_0x466026,_0x3e77f5){return db[_0xa363('0x39')][_0xa363('0x51')](_0x466026[_0xa363('0x52')],{})[_0xa363('0x1f')](respondWithResult(_0x3e77f5,0xc9))[_0xa363('0x28')](handleError(_0x3e77f5,null));};exports[_0xa363('0x53')]=function(_0x34c686,_0x1ce4e7){if(_0x34c686[_0xa363('0x52')]['id']){delete _0x34c686[_0xa363('0x52')]['id'];}return db[_0xa363('0x39')][_0xa363('0x54')]({'where':{'id':_0x34c686[_0xa363('0x4f')]['id']}})[_0xa363('0x1f')](handleEntityNotFound(_0x1ce4e7,null))[_0xa363('0x1f')](saveUpdates(_0x34c686[_0xa363('0x52')],null))[_0xa363('0x1f')](respondWithResult(_0x1ce4e7,null))[_0xa363('0x28')](handleError(_0x1ce4e7,null));};exports[_0xa363('0x34')]=function(_0x205a95,_0x58a97e){return db['SmsMessage'][_0xa363('0x54')]({'where':{'id':_0x205a95[_0xa363('0x4f')]['id']}})[_0xa363('0x1f')](handleEntityNotFound(_0x58a97e,null))[_0xa363('0x1f')](removeEntity(_0x58a97e,null))['catch'](handleError(_0x58a97e,null));};exports[_0xa363('0x55')]=function(_0x3261e8,_0x72fe26){return db['SmsMessage'][_0xa363('0x55')]()[_0xa363('0x1f')](respondWithResult(_0x72fe26,null))[_0xa363('0x28')](handleError(_0x72fe26,null));};var interaction_log=require(_0xa363('0x56'))('sms-interactions');exports[_0xa363('0x57')]=function(_0x20de92,_0x29d36e,_0x40412b){var _0x24884a={'agent':{},'channel':'sms'};if(_0x20de92['body']['id']){delete _0x20de92['body']['id'];}_0x20de92[_0xa363('0x52')][_0xa363('0x58')]=!![];_0x20de92[_0xa363('0x52')][_0xa363('0x59')]=moment()[_0xa363('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x20de92[_0xa363('0x52')]['UserId']=_0x20de92[_0xa363('0x52')][_0xa363('0x5b')]||_0x20de92[_0xa363('0x5c')]['id'];_0x24884a[_0xa363('0x5d')]['id']=_0x20de92['body']['UserId'];return db[_0xa363('0x39')][_0xa363('0x54')]({'where':{'id':_0x20de92[_0xa363('0x4f')]['id'],'UserId':null}})[_0xa363('0x1f')](handleEntityNotFound(_0x29d36e,null))['then'](saveUpdates(_0x20de92[_0xa363('0x52')],null))[_0xa363('0x1f')](function(_0x3fe520){if(_0x3fe520){_0x24884a[_0xa363('0x27')]=_0x3fe520[_0xa363('0x5e')]({'plain':!![]});return db[_0xa363('0x5f')][_0xa363('0x54')]({'where':{'id':_0x3fe520[_0xa363('0x60')]}});}return null;})[_0xa363('0x1f')](handleEntityNotFound(_0x29d36e,null))['then'](function(_0x54f77f){if(_0x54f77f){return _0x54f77f[_0xa363('0x53')]({'UserId':_0x20de92['body'][_0xa363('0x5b')],'read1stAt':_[_0xa363('0x61')](_0x54f77f[_0xa363('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1b28fa){if(_0x1b28fa){_0x24884a['interaction']=_0x1b28fa['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20de92['user']['id'],_0x20de92[_0xa363('0x5c')][_0xa363('0x36')],_0x20de92[_0xa363('0x5c')][_0xa363('0x63')],_0x24884a[_0xa363('0x64')]['id'],_0x20de92[_0xa363('0x52')]?JSON[_0xa363('0x23')](_0x20de92['body']):_0xa363('0x65'));return respondWithRpcPromise(_0xa363('0x66'),_0xa363('0x67'),_0x24884a);}return null;})[_0xa363('0x1f')](function(_0x42c877){var _0x50eee9=_0xa363('0x68')+_0x42c877[_0xa363('0x27')][_0xa363('0x69')];return db['sequelize'][_0xa363('0x3e')](_0x50eee9,{'type':db[_0xa363('0x6a')][_0xa363('0x6b')][_0xa363('0x6c')],'raw':!![]})[_0xa363('0x1f')](function(_0x40b711){return _0x40b711;});})[_0xa363('0x1f')](function(_0x119ef4){if(_0x119ef4){_0x24884a[_0xa363('0x27')][_0xa363('0x6d')]=_0x119ef4[0x0];if(!_0x20de92['body'][_0xa363('0x5b')])return;return db[_0xa363('0x6e')][_0xa363('0x54')]({'where':{'id':_0x20de92[_0xa363('0x52')][_0xa363('0x5b')],'role':_0xa363('0x5d')},'attributes':['id','name',_0xa363('0x6f'),_0xa363('0x70'),'internal'],'raw':!![]});}return null;})[_0xa363('0x1f')](function(_0x27a11f){if(!_0x27a11f)return null;_0x24884a[_0xa363('0x27')][_0xa363('0x5d')]=_0x27a11f;return _0x24884a;})[_0xa363('0x1f')](function(_0x5b2d6c){if(_0x5b2d6c){if(_0x20de92[_0xa363('0x52')][_0xa363('0x71')]){_0x24884a[_0xa363('0x27')][_0xa363('0x72')]=util[_0xa363('0x5a')](_0xa363('0x73'),_0x20de92[_0xa363('0x5c')]['name']);_0x24884a[_0xa363('0x27')][_0xa363('0x74')]=_0x24884a[_0xa363('0x74')];_0x24884a[_0xa363('0x27')][_0xa363('0x75')]=_0x24884a['channel'];_0x24884a[_0xa363('0x27')][_0xa363('0x76')]='accept';return respondWithRpcPromise(_0xa363('0x77'),_0xa363('0x77'),{'event':_0xa363('0x78'),'message':_0x24884a[_0xa363('0x27')]},client9002)[_0xa363('0x1f')](function(){return _0x24884a;});}return _0x24884a;}return null;})[_0xa363('0x1f')](respondWithResult(_0x29d36e,null))['catch'](handleError(_0x29d36e,null));};var interaction_log=require(_0xa363('0x56'))(_0xa363('0x79'));exports[_0xa363('0x7a')]=function(_0x69a1d6,_0x350957,_0x4f7de2){var _0x42c11e={'agent':{},'channel':_0xa363('0x7b')};if(_0x69a1d6[_0xa363('0x52')]['id']){delete _0x69a1d6[_0xa363('0x52')]['id'];}_0x69a1d6[_0xa363('0x52')][_0xa363('0x5b')]=_0x69a1d6[_0xa363('0x52')]['UserId']||_0x69a1d6['user']['id'];_0x42c11e[_0xa363('0x5d')]['id']=_0x69a1d6[_0xa363('0x52')][_0xa363('0x5b')];return db[_0xa363('0x39')]['find']({'where':{'id':_0x69a1d6[_0xa363('0x4f')]['id'],'UserId':null}})[_0xa363('0x1f')](handleEntityNotFound(_0x350957,null))[_0xa363('0x1f')](function(_0x38973b){if(_0x38973b){_0x42c11e[_0xa363('0x27')]=_0x38973b['get']({'plain':!![]});return db[_0xa363('0x5f')][_0xa363('0x54')]({'where':{'id':_0x38973b['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x350957,null))['then'](function(_0x57ecba){if(_0x57ecba){_0x42c11e[_0xa363('0x64')]=_0x57ecba['get']({'plain':!![]});interaction_log['info'](_0xa363('0x7c'),_0x69a1d6[_0xa363('0x5c')]['id'],_0x69a1d6[_0xa363('0x5c')][_0xa363('0x36')],_0x69a1d6[_0xa363('0x5c')][_0xa363('0x63')],_0x42c11e[_0xa363('0x64')]['id'],_0x69a1d6[_0xa363('0x52')]?JSON[_0xa363('0x23')](_0x69a1d6[_0xa363('0x52')]):_0xa363('0x65'));return respondWithRpcPromise(_0xa363('0x7d'),_0xa363('0x7e'),_0x42c11e);}return null;})[_0xa363('0x1f')](function(_0x50b4d0){var _0x449ae5=_0xa363('0x68')+_0x50b4d0[_0xa363('0x27')]['ContactId'];return db[_0xa363('0x7f')][_0xa363('0x3e')](_0x449ae5,{'type':db['Sequelize'][_0xa363('0x6b')]['SELECT'],'raw':!![]})[_0xa363('0x1f')](function(_0x309a0c){return _0x309a0c;});})[_0xa363('0x1f')](function(_0x15c407){if(_0x15c407){_0x42c11e[_0xa363('0x27')][_0xa363('0x6d')]=_0x15c407[0x0];if(!_0x69a1d6[_0xa363('0x52')]['UserId'])return;return db[_0xa363('0x6e')][_0xa363('0x54')]({'where':{'id':_0x69a1d6[_0xa363('0x52')][_0xa363('0x5b')],'role':_0xa363('0x5d')},'attributes':['id',_0xa363('0x36'),_0xa363('0x6f'),_0xa363('0x70'),_0xa363('0x80')],'raw':!![]});}return null;})[_0xa363('0x1f')](function(_0x35d23d){if(!_0x35d23d)return null;_0x42c11e[_0xa363('0x27')][_0xa363('0x5d')]=_0x35d23d;return _0x42c11e;})[_0xa363('0x1f')](function(_0x4f40c5){if(_0x4f40c5){_0x4f40c5[_0xa363('0x27')][_0xa363('0x72')]=util[_0xa363('0x5a')]('SIP/%s',_0x69a1d6['user'][_0xa363('0x36')]);_0x4f40c5[_0xa363('0x27')][_0xa363('0x74')]=_0x42c11e[_0xa363('0x74')];_0x4f40c5[_0xa363('0x27')]['motionChannel']=_0x42c11e[_0xa363('0x74')];_0x4f40c5[_0xa363('0x27')][_0xa363('0x76')]=_0xa363('0x7a');respondWithRpcPromise(_0xa363('0x77'),_0xa363('0x77'),{'event':'rejectmessage','message':_0x4f40c5[_0xa363('0x27')]},client9002);return _0x42c11e;}return null;})[_0xa363('0x1f')](respondWithResult(_0x350957,null))[_0xa363('0x28')](handleError(_0x350957,null));};exports[_0xa363('0x2a')]=function(_0x5c7dc4,_0x277176,_0x2005f9){if(_0x5c7dc4['body']['id']){delete _0x5c7dc4[_0xa363('0x52')]['id'];}var _0x52ddbf;return db[_0xa363('0x39')][_0xa363('0x54')]({'where':{'id':_0x5c7dc4[_0xa363('0x4f')]['id']}})['then'](handleEntityNotFound(_0x277176,null))[_0xa363('0x1f')](function(_0xa71e68){if(_0xa71e68){_0x52ddbf=_0xa71e68;return db[_0xa363('0x81')]['find']({'where':{'id':_0xa71e68['SmsAccountId']}});}})[_0xa363('0x1f')](handleEntityNotFound(_0x277176,null))[_0xa363('0x1f')](function(_0x350244){if(_0x350244){logger['debug'](_0xa363('0x22'),'status',_0xa363('0x82'),_0x350244[_0xa363('0x3a')],util[_0xa363('0x83')](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));switch(_0x350244[_0xa363('0x3a')]){case _0xa363('0x84'):if(_0x5c7dc4[_0xa363('0x52')]['MessageSid']&&_0x5c7dc4[_0xa363('0x52')][_0xa363('0x85')]===_0x52ddbf['messageId']){return _0x52ddbf['update']({'read':!![]});}else{logger[_0xa363('0x24')](_0xa363('0x86'),'status','twilio',util['inspect'](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));}break;case _0xa363('0x87'):if(_0x5c7dc4[_0xa363('0x52')][_0xa363('0x88')]&&_0x5c7dc4[_0xa363('0x52')][_0xa363('0x88')]===_0x52ddbf[_0xa363('0x89')]&&_[_0xa363('0x8a')]([_0xa363('0x8b'),'delivered'],_0x5c7dc4['body']['Status'])>=0x0){return _0x52ddbf[_0xa363('0x53')]({'read':!![]});}else{logger[_0xa363('0x24')](_0xa363('0x86'),'status','plivio',util[_0xa363('0x83')](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1395a9=_0x5c7dc4[_0xa363('0x52')]['results'][0x0];if(_0x1395a9['status'][_0xa363('0x8c')]===_0xa363('0x8d')){return _0x52ddbf[_0xa363('0x53')]({'read':!![]});}else{logger[_0xa363('0x24')](_0xa363('0x86'),_0xa363('0x2a'),_0xa363('0x8e'),util[_0xa363('0x83')](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x52ddbf;}})[_0xa363('0x1f')](respondWithResult(_0x277176,null))[_0xa363('0x28')](handleError(_0x277176,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 205a637..3b4c6b8 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 _0xe4bd=['hook','exports','events','SmsMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x486421,_0x4dea53){var _0x3b5c35=function(_0x4a8564){while(--_0x4a8564){_0x486421['push'](_0x486421['shift']());}};_0x3b5c35(++_0x4dea53);}(_0xe4bd,0xf2));var _0xde4b=function(_0x593d67,_0xbe6ab){_0x593d67=_0x593d67-0x0;var _0x27043a=_0xe4bd[_0x593d67];return _0x27043a;};'use strict';var EventEmitter=require(_0xde4b('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xde4b('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xde4b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xde4b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5ebcd6){return function(_0x43a831,_0x3a30c0,_0x222d67){SmsMessageEvents[_0xde4b('0x4')](_0x5ebcd6+':'+_0x43a831['id'],_0x43a831);SmsMessageEvents[_0xde4b('0x4')](_0x5ebcd6,_0x43a831);_0x222d67(null);};}for(var e in events){if(events[_0xde4b('0x5')](e)){var event=events[e];SmsMessage[_0xde4b('0x6')](e,emitEvent(event));}}module[_0xde4b('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xff59=['hook','exports','events','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0xff59,0x122));var _0x9ff5=function(_0x2ca923,_0x2ee32d){_0x2ca923=_0x2ca923-0x0;var _0x47436b=_0xff59[_0x2ca923];return _0x47436b;};'use strict';var EventEmitter=require(_0x9ff5('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x9ff5('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9ff5('0x2')](0x0);var events={'afterCreate':_0x9ff5('0x3'),'afterUpdate':_0x9ff5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x212feb){return function(_0x5188b4,_0x16c0e8,_0x1810ba){SmsMessageEvents[_0x9ff5('0x5')](_0x212feb+':'+_0x5188b4['id'],_0x5188b4);SmsMessageEvents[_0x9ff5('0x5')](_0x212feb,_0x5188b4);_0x1810ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x9ff5('0x6')](e,emitEvent(event));}}module[_0x9ff5('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2d1dd8b..f85e4f8 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 _0x2e75=['sender','login?username=','username','&password=','password','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','senderString','base64','message_uuid','/auth/1/session','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','sort','length','createHash','md5','hex','signature=','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod'];(function(_0x27e9d9,_0x3eed72){var _0xa82482=function(_0x2f8393){while(--_0x2f8393){_0x27e9d9['push'](_0x27e9d9['shift']());}};_0xa82482(++_0x3eed72);}(_0x2e75,0x13e));var _0x52e7=function(_0x6414a2,_0x4ab075){_0x6414a2=_0x6414a2-0x0;var _0x3c4614=_0x2e75[_0x6414a2];return _0x3c4614;};'use strict';var _=require(_0x52e7('0x0'));var util=require(_0x52e7('0x1'));var logger=require('../../config/logger')(_0x52e7('0x2'));var moment=require(_0x52e7('0x3'));var BPromise=require(_0x52e7('0x4'));var rp=require(_0x52e7('0x5'));var fs=require('fs');var path=require(_0x52e7('0x6'));var rimraf=require(_0x52e7('0x7'));var config=require(_0x52e7('0x8'));var attributes=require(_0x52e7('0x9'));module[_0x52e7('0xa')]=function(_0x4a9f9d,_0x5da767){return _0x4a9f9d['define']('SmsMessage',attributes,{'tableName':_0x52e7('0xb'),'paranoid':![],'indexes':[{'name':_0x52e7('0xc'),'fields':['messageId']},{'name':_0x52e7('0xd'),'fields':[_0x52e7('0xe')],'type':_0x52e7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40f087,_0x4109b3,_0x576a8d){var _0x2db70d=_0x4a9f9d['models'];var _0x2141a1=_0x40f087[_0x52e7('0x10')]({'plain':!![]});if(_0x2141a1[_0x52e7('0x11')][_0x52e7('0x12')]()==='in'||_0x2141a1[_0x52e7('0x11')][_0x52e7('0x12')]()===_0x52e7('0x13')&&!_0x2141a1[_0x52e7('0x14')]&&!_[_0x52e7('0x15')](_0x2141a1[_0x52e7('0x16')])&&!_[_0x52e7('0x15')](_0x2141a1[_0x52e7('0x17')])){_0x2db70d[_0x52e7('0x18')][_0x52e7('0x19')]({'where':{'id':_0x2141a1['SmsInteractionId']}})['then'](function(_0x4b82e5){if(_0x4b82e5){_0x4b82e5[_0x52e7('0x1a')]({'lastMsgAt':_0x2141a1[_0x52e7('0x1b')],'lastMsgDirection':_0x2141a1[_0x52e7('0x11')][_0x52e7('0x12')]()});}})[_0x52e7('0x1c')](function(_0xa3d98d){console[_0x52e7('0x1d')](_0xa3d98d);});}if(_0x2141a1[_0x52e7('0x11')]===_0x52e7('0x13')&&!_0x2141a1['secret']){var _0x57b31d;_0x2db70d[_0x52e7('0x1e')][_0x52e7('0x1f')]({'where':{'id':_0x2141a1[_0x52e7('0x20')]},'raw':!![]})[_0x52e7('0x21')](function(_0x3eb068){_0x57b31d=_0x3eb068;if(_0x57b31d&&_0x57b31d['type']){switch(_0x57b31d[_0x52e7('0x22')]){case'twilio':var _0x594cc0=require(_0x52e7('0x23'));if(_0x57b31d['accountSid']&&_0x57b31d[_0x52e7('0x24')]&&_0x57b31d[_0x52e7('0x25')]){var _0x303669=new _0x594cc0(_0x57b31d['accountSid'],_0x57b31d['authToken']);_0x303669[_0x52e7('0x26')][_0x52e7('0x27')]({'body':_0x2141a1[_0x52e7('0xe')],'to':_0x2141a1[_0x52e7('0x25')],'from':_0x57b31d[_0x52e7('0x25')],'statusCallback':_0x57b31d[_0x52e7('0x28')]+_0x52e7('0x29')+_0x2141a1['id']+_0x52e7('0x2a')+_0x57b31d[_0x52e7('0x2b')]})[_0x52e7('0x21')](function(_0x4fc115){if(_0x4fc115[_0x52e7('0x2c')]){return _0x40f087[_0x52e7('0x1a')]({'messageId':_0x4fc115['sid']});}})[_0x52e7('0x1c')](function(_0x1fe40b){logger[_0x52e7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x52e7('0x2d'),_0x52e7('0x23'),util[_0x52e7('0x2e')](_0x1fe40b,{'showHidden':![],'depth':null}));});}else{logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x23'),_0x52e7('0x30'));}break;case _0x52e7('0x31'):var _0x4a1930='https://api.skebby.it/API/v1.0/REST/';if(_0x57b31d['username']&&_0x57b31d['password']){var _0x41b3e5={'recipient':[_0x2141a1[_0x52e7('0x25')]],'message':_0x2141a1[_0x52e7('0xe')],'message_type':_0x57b31d['smsMethod']};if(_0x57b31d[_0x52e7('0x32')]&&_0x57b31d[_0x52e7('0x32')]!=='SI'){_0x41b3e5[_0x52e7('0x33')]=_0x57b31d[_0x52e7('0x25')];}var _0x32c799={'url':_0x4a1930+_0x52e7('0x34')+_0x57b31d[_0x52e7('0x35')]+_0x52e7('0x36')+_0x57b31d[_0x52e7('0x37')],'method':_0x52e7('0x38')};rp(_0x32c799)[_0x52e7('0x21')](function(_0x200912){var _0x15d21d=_0x200912[_0x52e7('0x39')](';');var _0x319d4d={'user_key':_0x15d21d[0x0],'session_key':_0x15d21d[0x1]};_0x32c799={'url':_0x4a1930+_0x52e7('0x3a'),'method':_0x52e7('0x3b'),'headers':{'user_key':_0x319d4d[_0x52e7('0x3c')],'Session_key':_0x319d4d['session_key']},'json':!![],'body':_0x41b3e5};return rp(_0x32c799);})[_0x52e7('0x21')](function(_0x4fd7a1){if(_0x4fd7a1[_0x52e7('0x3d')]>=0x1){var _0x52d430={'messageId':_0x4fd7a1[_0x52e7('0x3e')]};if(_0x57b31d[_0x52e7('0x32')]!=='GP'||!_0x57b31d[_0x52e7('0x3f')]){_0x52d430[_0x52e7('0x40')]=!![];}return _0x40f087[_0x52e7('0x1a')](_0x52d430);}else{return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'skebby',util[_0x52e7('0x2e')](_0x4fd7a1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x12693b){return logger['error'](_0x52e7('0x2f'),'afterCreate',_0x52e7('0x31'),util[_0x52e7('0x2e')](_0x12693b,{'showHidden':![],'depth':null}));});}else{logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'skebby',_0x52e7('0x41'));}break;case _0x52e7('0x42'):if(_0x57b31d[_0x52e7('0x24')]){var _0xd41892={'recipient':_0x2141a1['phone'],'message':_0x2141a1['body'],'sender':_0x57b31d['senderString']||_0x57b31d[_0x52e7('0x25')],'authorization':_0x57b31d[_0x52e7('0x24')]};var _0x4109b3={'method':_0x52e7('0x3b'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xd41892,'json':!![]};rp(_0x4109b3)[_0x52e7('0x21')](function(_0x159c12){var _0x6207de={'messageId':_0x159c12[_0x52e7('0x43')]};if(!_0x57b31d[_0x52e7('0x3f')]){_0x6207de['read']=!![];}return _0x40f087[_0x52e7('0x1a')](_0x6207de);})[_0x52e7('0x1c')](function(_0x347910){logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'connectel',util[_0x52e7('0x2e')](_0x347910,{'showHidden':![],'depth':null}));});}else{logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'connectel',_0x52e7('0x44'));}break;case _0x52e7('0x45'):if(_0x57b31d[_0x52e7('0x35')]&&_0x57b31d[_0x52e7('0x37')]){var _0xd41892={'messages':[{'source':'xCALLY\x20Motion','to':_0x2141a1['phone'],'body':_0x2141a1[_0x52e7('0xe')],'from':_0x57b31d['senderString']||_0x57b31d[_0x52e7('0x25')]}]};var _0x461bef=util[_0x52e7('0x46')](_0x52e7('0x47'),_0x57b31d[_0x52e7('0x35')],_0x57b31d[_0x52e7('0x37')]);var _0x4109b3={'method':'POST','uri':_0x52e7('0x48'),'body':_0xd41892,'headers':{'Authorization':util[_0x52e7('0x46')](_0x52e7('0x49'),new Buffer(_0x461bef)[_0x52e7('0x4a')]('base64'))},'json':!![]};rp(_0x4109b3)[_0x52e7('0x21')](function(_0x2fbecd){if(_0x2fbecd[_0x52e7('0x4b')]>=0xc8&&_0x2fbecd['http_code']<=0xce){if(_0x2fbecd[_0x52e7('0x4c')]&&_0x2fbecd[_0x52e7('0x4c')][_0x52e7('0x4d')]>0x0){var _0x51da2b=_[_0x52e7('0x4e')](_0x2fbecd[_0x52e7('0x4c')][_0x52e7('0x26')]);var _0x1e83d7={'messageId':_0x51da2b[_0x52e7('0x4f')]};if(!_0x57b31d[_0x52e7('0x3f')]){_0x1e83d7[_0x52e7('0x40')]=!![];}return _0x40f087['update'](_0x1e83d7);}else{logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x50'),util[_0x52e7('0x2e')](_0x2fbecd,{'showHidden':![],'depth':null}));}}else{logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x50'),util['inspect'](_0x2fbecd,{'showHidden':![],'depth':null}));}})[_0x52e7('0x1c')](function(_0x51904f){logger[_0x52e7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x52e7('0x50'),util[_0x52e7('0x2e')](_0x51904f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x52e7('0x2d'),_0x52e7('0x50'),_0x52e7('0x41'));}break;case _0x52e7('0x51'):if(_0x57b31d[_0x52e7('0x52')]&&_0x57b31d[_0x52e7('0x24')]){var _0xd41892={'dst':_0x2141a1[_0x52e7('0x25')],'text':_0x2141a1['body'],'src':_0x57b31d[_0x52e7('0x53')]||_0x57b31d[_0x52e7('0x25')],'url':_0x57b31d[_0x52e7('0x28')]+_0x52e7('0x29')+_0x2141a1['id']+_0x52e7('0x2a')+_0x57b31d['token']};var _0x461bef=util['format'](_0x52e7('0x47'),_0x57b31d[_0x52e7('0x52')],_0x57b31d[_0x52e7('0x24')]);var _0x4109b3={'method':_0x52e7('0x3b'),'uri':util[_0x52e7('0x46')]('https://api.plivo.com/v1/Account/%s/Message/',_0x57b31d[_0x52e7('0x52')]),'body':_0xd41892,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x461bef)[_0x52e7('0x4a')](_0x52e7('0x54')))},'json':!![]};rp(_0x4109b3)['then'](function(_0x1f5f23){var _0x5b5091={'messageId':_0x1f5f23[_0x52e7('0x55')][0x0]};return _0x40f087['update'](_0x5b5091);})[_0x52e7('0x1c')](function(_0x18a59c){logger[_0x52e7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x52e7('0x2d'),_0x52e7('0x51'),util[_0x52e7('0x2e')](_0x18a59c,{'showHidden':![],'depth':null}));});}else{logger[_0x52e7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x52e7('0x51'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x57b31d[_0x52e7('0x35')]&&_0x57b31d[_0x52e7('0x37')]){if(_0x57b31d['baseUrl']){var _0x568ea1={'method':'POST','uri':_0x57b31d['baseUrl']+_0x52e7('0x56'),'body':{'username':_0x57b31d[_0x52e7('0x35')],'password':_0x57b31d[_0x52e7('0x37')]},'json':!![]};return rp(_0x568ea1)[_0x52e7('0x21')](function(_0x20f17a){var _0x26f2e1={'method':_0x52e7('0x3b'),'uri':_0x57b31d[_0x52e7('0x57')]+_0x52e7('0x58'),'body':{'messages':[{'from':_0x57b31d[_0x52e7('0x25')],'destinations':[{'to':_0x2141a1[_0x52e7('0x25')]}],'text':_0x2141a1[_0x52e7('0xe')],'notifyUrl':_0x57b31d[_0x52e7('0x28')]+_0x52e7('0x29')+_0x2141a1['id']+_0x52e7('0x2a')+_0x57b31d[_0x52e7('0x2b')],'notifyContentType':'application/json','callbackData':_0x57b31d[_0x52e7('0x25')]+';'+_0x2141a1[_0x52e7('0xe')]}]},'headers':{'Authorization':_0x52e7('0x59')+_0x20f17a[_0x52e7('0x2b')]},'json':!![]};return rp(_0x26f2e1)[_0x52e7('0x21')](function(_0x535938){if(_0x535938[_0x52e7('0x26')]){var _0x22c5a5={'messageId':_0x535938[_0x52e7('0x26')][0x0][_0x52e7('0xc')]};if(!_0x57b31d[_0x52e7('0x3f')]){_0x22c5a5[_0x52e7('0x40')]=!![];}return _0x40f087['update'](_0x22c5a5);}else{return logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x5a'),util[_0x52e7('0x2e')](_0x535938,{'showHidden':![],'depth':null}));}});})[_0x52e7('0x1c')](function(_0x351e6b){return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'infobip',util['inspect'](_0x351e6b,{'showHidden':![],'depth':null}));});}else{logger[_0x52e7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x52e7('0x2d'),_0x52e7('0x5a'),_0x52e7('0x5b'));}}else{logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x5a'),_0x52e7('0x41'));}break;case _0x52e7('0x5c'):var _0x5d1e7a=require(_0x52e7('0x5d'));if(_0x57b31d[_0x52e7('0x5e')]){var _0x2538ef={};_0x2538ef[_0x52e7('0x5f')]=_0x57b31d[_0x52e7('0x35')];_0x2538ef[_0x52e7('0x25')]=_0x2141a1['phone'];_0x2538ef[_0x52e7('0x33')]=_0x57b31d[_0x52e7('0x25')];_0x2538ef[_0x52e7('0x60')]=_0x2141a1['body'];_0x2538ef['timestamp']=+new Date();var _0x41fd6b='';var _0x2b698b='';var _0x2c8893=Object['keys'](_0x2538ef);_0x2c8893[_0x52e7('0x61')]();for(var _0x47640e=0x0;_0x47640e<_0x2c8893[_0x52e7('0x62')];_0x47640e++){if(_0x41fd6b!=''){_0x41fd6b+='&';}_0x41fd6b+=_0x2c8893[_0x47640e]+'='+encodeURIComponent(_0x2538ef[_0x2c8893[_0x47640e]]);_0x2b698b+=_0x2538ef[_0x2c8893[_0x47640e]];}_0x2b698b+=_0x57b31d[_0x52e7('0x5e')];_0x2b698b=_0x5d1e7a[_0x52e7('0x63')](_0x52e7('0x64'))[_0x52e7('0x1a')](_0x2b698b)['digest'](_0x52e7('0x65'));if(_0x41fd6b!==''){_0x41fd6b+='&';}_0x41fd6b+=_0x52e7('0x66')+_0x2b698b;var _0x32c799={'method':'GET','uri':_0x57b31d[_0x52e7('0x57')]+'/external/get/send.php?'+_0x41fd6b,'json':!![]};return rp(_0x32c799)[_0x52e7('0x21')](function(_0x4a4a44){var _0x52824d=Object['keys'](_0x4a4a44);if(_0x4a4a44[_0x52824d[0x0]][_0x52e7('0x1d')]&&parseInt(_0x4a4a44[_0x52824d[0x0]][_0x52e7('0x1d')])===0x0){var _0x4628dc={'messageId':_0x4a4a44[_0x52824d[0x0]]['id_sms']};if(!_0x57b31d[_0x52e7('0x3f')]){_0x4628dc[_0x52e7('0x40')]=!![];}return _0x40f087[_0x52e7('0x1a')](_0x4628dc);}else{return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),'afterCreate','csc',util[_0x52e7('0x2e')](_0x4a4a44[_0x52e7('0x1d')],{'showHidden':![],'depth':null}));}})[_0x52e7('0x1c')](function(_0x2ff76a){return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'csc',util[_0x52e7('0x2e')](_0x2ff76a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x5c'),_0x52e7('0x67'));}break;case _0x52e7('0x68'):if(_0x57b31d[_0x52e7('0x5e')]){var _0x508c75={'method':_0x52e7('0x3b'),'uri':_0x52e7('0x69'),'headers':{'Authorization':_0x57b31d[_0x52e7('0x5e')]},'body':{'content':_0x2141a1[_0x52e7('0xe')],'to':[_0x2141a1[_0x52e7('0x25')]],'from':_0x57b31d['phone'],'binary':![],'clientMessageId':_0x52e7('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x508c75)[_0x52e7('0x21')](function(_0x46c445){if(!_0x46c445['error']){var _0x1d2487={'messageId':_0x46c445[_0x52e7('0x26')][0x0][_0x52e7('0x6b')]};if(!_0x57b31d['deliveryReport']){_0x1d2487[_0x52e7('0x40')]=!![];}return _0x40f087[_0x52e7('0x1a')](_0x1d2487);}else{return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),'afterCreate',_0x52e7('0x68'),util[_0x52e7('0x2e')](_0x46c445['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5775b2){return logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x68'),util[_0x52e7('0x2e')](_0x5775b2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x68'),_0x52e7('0x67'));}break;case'bandwidth':if(_0x57b31d['username']&&_0x57b31d[_0x52e7('0x37')]){var _0x461bef=util['format'](_0x52e7('0x47'),_0x57b31d['username'],_0x57b31d[_0x52e7('0x37')]);var _0x4109b3={'method':_0x52e7('0x3b'),'uri':_0x52e7('0x6c')+_0x57b31d[_0x52e7('0x6d')]+_0x52e7('0x6e'),'body':{'to':[_0x2141a1['phone']],'text':_0x2141a1[_0x52e7('0xe')],'from':_0x57b31d[_0x52e7('0x25')],'applicationId':_0x57b31d[_0x52e7('0x6f')]},'headers':{'Authorization':util[_0x52e7('0x46')](_0x52e7('0x49'),new Buffer(_0x461bef)[_0x52e7('0x4a')]('base64'))},'json':!![]};rp(_0x4109b3)[_0x52e7('0x21')](function(_0x140379){if(_0x140379['id']){var _0x59ffd4={'messageId':_0x140379['id']};return _0x40f087[_0x52e7('0x1a')](_0x59ffd4);}else{logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x70'),util[_0x52e7('0x2e')](_0x140379,{'showHidden':![],'depth':null}));}})[_0x52e7('0x1c')](function(_0x18907b){logger['error'](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x70'),util[_0x52e7('0x2e')](_0x18907b,{'showHidden':![],'depth':null}));});}else{logger[_0x52e7('0x1d')](_0x52e7('0x2f'),'afterCreate',_0x52e7('0x70'),_0x52e7('0x41'));}break;case _0x52e7('0x71'):if(_0x57b31d['apiKey']){var _0x3e233a={};var _0x32c799={'method':_0x52e7('0x3b'),'uri':_0x52e7('0x72'),'headers':{'Authorization':_0x52e7('0x73')+_0x57b31d['apiKey'],'Content-Type':_0x52e7('0x74')},'body':{'from':_0x57b31d[_0x52e7('0x25')],'to':_0x2141a1[_0x52e7('0x25')],'text':_0x2141a1[_0x52e7('0xe')]},'json':!![]};return rp(_0x32c799)['then'](function(_0x355d5e){if(_0x355d5e['code']==0xca){_0x3e233a['message']=_0x355d5e;var _0x24ebee={'method':_0x52e7('0x3b'),'uri':_0x52e7('0x75'),'headers':{'Authorization':_0x52e7('0x73')+_0x57b31d[_0x52e7('0x5e')],'Content-Type':_0x52e7('0x74')},'body':{'refid':_0x3e233a[_0x52e7('0x76')][_0x52e7('0x77')]},'json':!![]};return rp(_0x24ebee)[_0x52e7('0x21')](function(_0x385244){_0x3e233a['status']=_0x385244;var _0x2380c2={'messageId':_0x3e233a[_0x52e7('0x76')][_0x52e7('0x77')],'read':!![]};return _0x40f087[_0x52e7('0x1a')](_0x2380c2);});}else{return logger[_0x52e7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x52e7('0x2d'),_0x52e7('0x71'),util[_0x52e7('0x2e')](_0x355d5e,{'showHidden':![],'depth':null}));}})[_0x52e7('0x1c')](function(_0x5975e3){return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),'intelepeer',util[_0x52e7('0x2e')](_0x5975e3,{'showHidden':![],'depth':null}));});}else{return logger[_0x52e7('0x1d')](_0x52e7('0x2f'),_0x52e7('0x2d'),_0x52e7('0x71'),'Token\x20not\x20received');}break;}}})[_0x52e7('0x78')](function(){_0x576a8d();});}else{_0x576a8d();}}},'charset':_0x52e7('0x79'),'collate':_0x52e7('0x7a')});}; \ No newline at end of file +var _0x4671=['https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','toString','base64','http_code','data','message_id','clickSend','plivo','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','csc','clickatell','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Bearer\x20','message','refid','status','intelepeer','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x4671,0x13f));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1467('0x0'));var util=require(_0x1467('0x1'));var logger=require(_0x1467('0x2'))('api');var moment=require(_0x1467('0x3'));var BPromise=require(_0x1467('0x4'));var rp=require(_0x1467('0x5'));var fs=require('fs');var path=require(_0x1467('0x6'));var rimraf=require(_0x1467('0x7'));var config=require(_0x1467('0x8'));var attributes=require(_0x1467('0x9'));module[_0x1467('0xa')]=function(_0x157186,_0xf405b5){return _0x157186[_0x1467('0xb')](_0x1467('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x1467('0xd'),'fields':['messageId']},{'name':_0x1467('0xe'),'fields':[_0x1467('0xf')],'type':_0x1467('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f06a2,_0x5bd4e7,_0x25ab31){var _0x53bea1=_0x157186[_0x1467('0x11')];var _0x8501b7=_0x1f06a2[_0x1467('0x12')]({'plain':!![]});if(_0x8501b7[_0x1467('0x13')]['toLowerCase']()==='in'||_0x8501b7[_0x1467('0x13')]['toLowerCase']()===_0x1467('0x14')&&!_0x8501b7[_0x1467('0x15')]&&!_[_0x1467('0x16')](_0x8501b7[_0x1467('0x17')])&&!_[_0x1467('0x16')](_0x8501b7['SmsInteractionId'])){_0x53bea1[_0x1467('0x18')]['findOne']({'where':{'id':_0x8501b7[_0x1467('0x19')]}})[_0x1467('0x1a')](function(_0x94bc9b){if(_0x94bc9b){_0x94bc9b['update']({'lastMsgAt':_0x8501b7[_0x1467('0x1b')],'lastMsgDirection':_0x8501b7['direction']['toLowerCase']()});}})[_0x1467('0x1c')](function(_0x163a96){console[_0x1467('0x1d')](_0x163a96);});}if(_0x8501b7[_0x1467('0x13')]==='out'&&!_0x8501b7['secret']){var _0x54f272;_0x53bea1['SmsAccount'][_0x1467('0x1e')]({'where':{'id':_0x8501b7[_0x1467('0x1f')]},'raw':!![]})['then'](function(_0x58639c){_0x54f272=_0x58639c;if(_0x54f272&&_0x54f272['type']){switch(_0x54f272[_0x1467('0x20')]){case _0x1467('0x21'):var _0x3bdc5f=require(_0x1467('0x21'));if(_0x54f272['accountSid']&&_0x54f272[_0x1467('0x22')]&&_0x54f272[_0x1467('0x23')]){var _0x542a7e=new _0x3bdc5f(_0x54f272[_0x1467('0x24')],_0x54f272[_0x1467('0x22')]);_0x542a7e[_0x1467('0x25')][_0x1467('0x26')]({'body':_0x8501b7[_0x1467('0xf')],'to':_0x8501b7['phone'],'from':_0x54f272['phone'],'statusCallback':_0x54f272['remote']+_0x1467('0x27')+_0x8501b7['id']+_0x1467('0x28')+_0x54f272[_0x1467('0x29')]})[_0x1467('0x1a')](function(_0xea0f0f){if(_0xea0f0f[_0x1467('0x2a')]){return _0x1f06a2[_0x1467('0x2b')]({'messageId':_0xea0f0f['sid']});}})[_0x1467('0x1c')](function(_0x2978ac){logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x21'),util[_0x1467('0x2e')](_0x2978ac,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x1a6e16=_0x1467('0x2f');if(_0x54f272[_0x1467('0x30')]&&_0x54f272[_0x1467('0x31')]){var _0x29a569={'recipient':[_0x8501b7[_0x1467('0x23')]],'message':_0x8501b7[_0x1467('0xf')],'message_type':_0x54f272['smsMethod']};if(_0x54f272[_0x1467('0x32')]&&_0x54f272['smsMethod']!=='SI'){_0x29a569['sender']=_0x54f272[_0x1467('0x23')];}var _0x427371={'url':_0x1a6e16+_0x1467('0x33')+_0x54f272[_0x1467('0x30')]+_0x1467('0x34')+_0x54f272[_0x1467('0x31')],'method':'GET'};rp(_0x427371)[_0x1467('0x1a')](function(_0x5d5b36){var _0xdf15b6=_0x5d5b36[_0x1467('0x35')](';');var _0x31f920={'user_key':_0xdf15b6[0x0],'session_key':_0xdf15b6[0x1]};_0x427371={'url':_0x1a6e16+_0x1467('0x36'),'method':_0x1467('0x37'),'headers':{'user_key':_0x31f920[_0x1467('0x38')],'Session_key':_0x31f920[_0x1467('0x39')]},'json':!![],'body':_0x29a569};return rp(_0x427371);})['then'](function(_0x85b324){if(_0x85b324['total_sent']>=0x1){var _0x4a0da3={'messageId':_0x85b324[_0x1467('0x3a')]};if(_0x54f272[_0x1467('0x32')]!=='GP'||!_0x54f272[_0x1467('0x3b')]){_0x4a0da3[_0x1467('0x3c')]=!![];}return _0x1f06a2[_0x1467('0x2b')](_0x4a0da3);}else{return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate','skebby',util['inspect'](_0x85b324,{'showHidden':![],'depth':null}));}})['catch'](function(_0x49b726){return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x3d'),util[_0x1467('0x2e')](_0x49b726,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),'afterCreate',_0x1467('0x3d'),_0x1467('0x3e'));}break;case _0x1467('0x3f'):if(_0x54f272[_0x1467('0x22')]){var _0x4b2163={'recipient':_0x8501b7[_0x1467('0x23')],'message':_0x8501b7[_0x1467('0xf')],'sender':_0x54f272[_0x1467('0x40')]||_0x54f272[_0x1467('0x23')],'authorization':_0x54f272['authToken']};var _0x5bd4e7={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4b2163,'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x21f43f){var _0x38c922={'messageId':_0x21f43f[_0x1467('0x41')]};if(!_0x54f272[_0x1467('0x3b')]){_0x38c922[_0x1467('0x3c')]=!![];}return _0x1f06a2['update'](_0x38c922);})[_0x1467('0x1c')](function(_0xa725dc){logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1467('0x3f'),util['inspect'](_0xa725dc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),'afterCreate','connectel',_0x1467('0x42'));}break;case _0x1467('0x43'):if(_0x54f272[_0x1467('0x30')]&&_0x54f272[_0x1467('0x31')]){var _0x4b2163={'messages':[{'source':'xCALLY\x20Motion','to':_0x8501b7[_0x1467('0x23')],'body':_0x8501b7[_0x1467('0xf')],'from':_0x54f272[_0x1467('0x40')]||_0x54f272['phone']}]};var _0x134f4b=util[_0x1467('0x44')](_0x1467('0x45'),_0x54f272[_0x1467('0x30')],_0x54f272[_0x1467('0x31')]);var _0x5bd4e7={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4b2163,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x134f4b)[_0x1467('0x46')](_0x1467('0x47')))},'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x121cc7){if(_0x121cc7['http_code']>=0xc8&&_0x121cc7[_0x1467('0x48')]<=0xce){if(_0x121cc7[_0x1467('0x49')]&&_0x121cc7[_0x1467('0x49')]['queued_count']>0x0){var _0x142462=_['head'](_0x121cc7[_0x1467('0x49')][_0x1467('0x25')]);var _0x21d356={'messageId':_0x142462[_0x1467('0x4a')]};if(!_0x54f272[_0x1467('0x3b')]){_0x21d356[_0x1467('0x3c')]=!![];}return _0x1f06a2[_0x1467('0x2b')](_0x21d356);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),_0x1467('0x4b'),util[_0x1467('0x2e')](_0x121cc7,{'showHidden':![],'depth':null}));}}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x4b'),util['inspect'](_0x121cc7,{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x41dfc2){logger['error'](_0x1467('0x2c'),'afterCreate',_0x1467('0x4b'),util[_0x1467('0x2e')](_0x41dfc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x4b'),_0x1467('0x3e'));}break;case _0x1467('0x4c'):if(_0x54f272['authId']&&_0x54f272[_0x1467('0x22')]){var _0x4b2163={'dst':_0x8501b7['phone'],'text':_0x8501b7['body'],'src':_0x54f272['senderString']||_0x54f272[_0x1467('0x23')],'url':_0x54f272[_0x1467('0x4d')]+_0x1467('0x27')+_0x8501b7['id']+'/status?token='+_0x54f272[_0x1467('0x29')]};var _0x134f4b=util[_0x1467('0x44')](_0x1467('0x45'),_0x54f272[_0x1467('0x4e')],_0x54f272[_0x1467('0x22')]);var _0x5bd4e7={'method':_0x1467('0x37'),'uri':util[_0x1467('0x44')](_0x1467('0x4f'),_0x54f272[_0x1467('0x4e')]),'body':_0x4b2163,'headers':{'Authorization':util[_0x1467('0x44')](_0x1467('0x50'),new Buffer(_0x134f4b)[_0x1467('0x46')](_0x1467('0x47')))},'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x561bde){var _0x2e6bc9={'messageId':_0x561bde[_0x1467('0x51')][0x0]};return _0x1f06a2[_0x1467('0x2b')](_0x2e6bc9);})[_0x1467('0x1c')](function(_0x5a55a1){logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),'plivo',util[_0x1467('0x2e')](_0x5a55a1,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x4c'),_0x1467('0x52'));}break;case _0x1467('0x53'):if(_0x54f272['username']&&_0x54f272['password']){if(_0x54f272['baseUrl']){var _0x4204bd={'method':_0x1467('0x37'),'uri':_0x54f272[_0x1467('0x54')]+_0x1467('0x55'),'body':{'username':_0x54f272['username'],'password':_0x54f272[_0x1467('0x31')]},'json':!![]};return rp(_0x4204bd)[_0x1467('0x1a')](function(_0x5d74af){var _0x37312b={'method':'POST','uri':_0x54f272[_0x1467('0x54')]+_0x1467('0x56'),'body':{'messages':[{'from':_0x54f272[_0x1467('0x23')],'destinations':[{'to':_0x8501b7[_0x1467('0x23')]}],'text':_0x8501b7[_0x1467('0xf')],'notifyUrl':_0x54f272[_0x1467('0x4d')]+'/api/sms/messages/'+_0x8501b7['id']+_0x1467('0x28')+_0x54f272[_0x1467('0x29')],'notifyContentType':_0x1467('0x57'),'callbackData':_0x54f272[_0x1467('0x23')]+';'+_0x8501b7[_0x1467('0xf')]}]},'headers':{'Authorization':_0x1467('0x58')+_0x5d74af[_0x1467('0x29')]},'json':!![]};return rp(_0x37312b)[_0x1467('0x1a')](function(_0x336c9a){if(_0x336c9a[_0x1467('0x25')]){var _0xa4c945={'messageId':_0x336c9a[_0x1467('0x25')][0x0][_0x1467('0xd')]};if(!_0x54f272[_0x1467('0x3b')]){_0xa4c945['read']=!![];}return _0x1f06a2[_0x1467('0x2b')](_0xa4c945);}else{return logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x53'),util[_0x1467('0x2e')](_0x336c9a,{'showHidden':![],'depth':null}));}});})[_0x1467('0x1c')](function(_0x1cefe6){return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x53'),util[_0x1467('0x2e')](_0x1cefe6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x53'),_0x1467('0x59'));}}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x53'),_0x1467('0x3e'));}break;case'csc':var _0x5c1f50=require(_0x1467('0x5a'));if(_0x54f272[_0x1467('0x5b')]){var _0x212673={};_0x212673[_0x1467('0x5c')]=_0x54f272['username'];_0x212673['phone']=_0x8501b7['phone'];_0x212673[_0x1467('0x5d')]=_0x54f272[_0x1467('0x23')];_0x212673['text']=_0x8501b7[_0x1467('0xf')];_0x212673[_0x1467('0x5e')]=+new Date();var _0x5e128f='';var _0x566cbe='';var _0x25255d=Object[_0x1467('0x5f')](_0x212673);_0x25255d[_0x1467('0x60')]();for(var _0x38c21a=0x0;_0x38c21a<_0x25255d[_0x1467('0x61')];_0x38c21a++){if(_0x5e128f!=''){_0x5e128f+='&';}_0x5e128f+=_0x25255d[_0x38c21a]+'='+encodeURIComponent(_0x212673[_0x25255d[_0x38c21a]]);_0x566cbe+=_0x212673[_0x25255d[_0x38c21a]];}_0x566cbe+=_0x54f272[_0x1467('0x5b')];_0x566cbe=_0x5c1f50[_0x1467('0x62')](_0x1467('0x63'))[_0x1467('0x2b')](_0x566cbe)[_0x1467('0x64')](_0x1467('0x65'));if(_0x5e128f!==''){_0x5e128f+='&';}_0x5e128f+=_0x1467('0x66')+_0x566cbe;var _0x427371={'method':'GET','uri':_0x54f272[_0x1467('0x54')]+_0x1467('0x67')+_0x5e128f,'json':!![]};return rp(_0x427371)[_0x1467('0x1a')](function(_0xcc1c2a){var _0x3cb56c=Object[_0x1467('0x5f')](_0xcc1c2a);if(_0xcc1c2a[_0x3cb56c[0x0]][_0x1467('0x1d')]&&parseInt(_0xcc1c2a[_0x3cb56c[0x0]][_0x1467('0x1d')])===0x0){var _0x1130a6={'messageId':_0xcc1c2a[_0x3cb56c[0x0]][_0x1467('0x68')]};if(!_0x54f272['deliveryReport']){_0x1130a6['read']=!![];}return _0x1f06a2['update'](_0x1130a6);}else{return logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),_0x1467('0x69'),util[_0x1467('0x2e')](_0xcc1c2a[_0x1467('0x1d')],{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x3110df){return logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x69'),util[_0x1467('0x2e')](_0x3110df,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),_0x1467('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0x1467('0x6a'):if(_0x54f272[_0x1467('0x5b')]){var _0x29385f={'method':_0x1467('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x54f272[_0x1467('0x5b')]},'body':{'content':_0x8501b7[_0x1467('0xf')],'to':[_0x8501b7['phone']],'from':_0x54f272[_0x1467('0x23')],'binary':![],'clientMessageId':_0x1467('0x6b'),'charset':_0x1467('0x6c')},'json':!![]};rp(_0x29385f)['then'](function(_0x457863){if(!_0x457863[_0x1467('0x1d')]){var _0x1ae521={'messageId':_0x457863['messages'][0x0][_0x1467('0x6d')]};if(!_0x54f272[_0x1467('0x3b')]){_0x1ae521[_0x1467('0x3c')]=!![];}return _0x1f06a2[_0x1467('0x2b')](_0x1ae521);}else{return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x6a'),util[_0x1467('0x2e')](_0x457863[_0x1467('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x366135){return logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x1467('0x2e')](_0x366135,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x6a'),_0x1467('0x6e'));}break;case _0x1467('0x6f'):if(_0x54f272['username']&&_0x54f272[_0x1467('0x31')]){var _0x134f4b=util[_0x1467('0x44')]('%s:%s',_0x54f272[_0x1467('0x30')],_0x54f272[_0x1467('0x31')]);var _0x5bd4e7={'method':_0x1467('0x37'),'uri':_0x1467('0x70')+_0x54f272[_0x1467('0x71')]+_0x1467('0x72'),'body':{'to':[_0x8501b7[_0x1467('0x23')]],'text':_0x8501b7['body'],'from':_0x54f272['phone'],'applicationId':_0x54f272[_0x1467('0x73')]},'headers':{'Authorization':util[_0x1467('0x44')](_0x1467('0x50'),new Buffer(_0x134f4b)[_0x1467('0x46')](_0x1467('0x47')))},'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x524068){if(_0x524068['id']){var _0x80ee2a={'messageId':_0x524068['id']};return _0x1f06a2[_0x1467('0x2b')](_0x80ee2a);}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x6f'),util[_0x1467('0x2e')](_0x524068,{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x2afcfa){logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x6f'),util[_0x1467('0x2e')](_0x2afcfa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),'bandwidth',_0x1467('0x3e'));}break;case'intelepeer':if(_0x54f272['apiKey']){var _0x3f2ea7={};var _0x427371={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x1467('0x74')+_0x54f272['apiKey'],'Content-Type':_0x1467('0x57')},'body':{'from':_0x54f272['phone'],'to':_0x8501b7[_0x1467('0x23')],'text':_0x8501b7[_0x1467('0xf')]},'json':!![]};return rp(_0x427371)[_0x1467('0x1a')](function(_0x2572e9){if(_0x2572e9['code']==0xca){_0x3f2ea7[_0x1467('0x75')]=_0x2572e9;var _0x440b0c={'method':_0x1467('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1467('0x74')+_0x54f272[_0x1467('0x5b')],'Content-Type':_0x1467('0x57')},'body':{'refid':_0x3f2ea7[_0x1467('0x75')][_0x1467('0x76')]},'json':!![]};return rp(_0x440b0c)[_0x1467('0x1a')](function(_0x2e3f67){_0x3f2ea7[_0x1467('0x77')]=_0x2e3f67;var _0x18e2eb={'messageId':_0x3f2ea7['message'][_0x1467('0x76')],'read':!![]};return _0x1f06a2['update'](_0x18e2eb);});}else{return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x78'),util[_0x1467('0x2e')](_0x2572e9,{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x4d9325){return logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x78'),util[_0x1467('0x2e')](_0x4d9325,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x25ab31();});}else{_0x25ab31();}}},'charset':_0x1467('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ee41bdc..df4ed1e 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 _0xe247=['lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','catch','CreateSmsMessage','SmsMessage','options','raw'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0xe247,0xae));var _0x7e24=function(_0x5a3af5,_0x313102){_0x5a3af5=_0x5a3af5-0x0;var _0x151e22=_0xe247[_0x5a3af5];return _0x151e22;};'use strict';var _=require(_0x7e24('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7e24('0x1'));var fs=require('fs');var Redis=require(_0x7e24('0x2'));var db=require(_0x7e24('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e24('0x4'))('rpc');var config=require(_0x7e24('0x5'));var jayson=require(_0x7e24('0x6'));var client=jayson[_0x7e24('0x7')][_0x7e24('0x8')]({'port':0x232a});config[_0x7e24('0x9')]=_[_0x7e24('0xa')](config[_0x7e24('0x9')],{'host':_0x7e24('0xb'),'port':0x18eb});var socket=require(_0x7e24('0xc'))(new Redis(config[_0x7e24('0x9')]));require(_0x7e24('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d909f,_0x50c0b9,_0xb98e5b){return new BPromise(function(_0x58243a,_0x400213){return client[_0x7e24('0xe')](_0x2d909f,_0xb98e5b)[_0x7e24('0xf')](function(_0x2bba60){logger['info']('SmsMessage,\x20%s,\x20%s',_0x50c0b9,_0x7e24('0x10'));logger[_0x7e24('0x11')](_0x7e24('0x12'),_0x50c0b9,_0x7e24('0x10'),JSON[_0x7e24('0x13')](_0x2bba60));if(_0x2bba60[_0x7e24('0x14')]){if(_0x2bba60['error']['code']===0x1f4){logger[_0x7e24('0x14')](_0x7e24('0x15'),_0x50c0b9,_0x2bba60[_0x7e24('0x14')][_0x7e24('0x16')]);return _0x400213(_0x2bba60['error'][_0x7e24('0x16')]);}logger[_0x7e24('0x14')](_0x7e24('0x15'),_0x50c0b9,_0x2bba60[_0x7e24('0x14')][_0x7e24('0x16')]);return _0x58243a(_0x2bba60['error']['message']);}else{logger[_0x7e24('0x17')](_0x7e24('0x15'),_0x50c0b9,'request\x20sent');_0x58243a(_0x2bba60['result'][_0x7e24('0x16')]);}})[_0x7e24('0x18')](function(_0x1f2d8c){logger[_0x7e24('0x14')]('SmsMessage,\x20%s,\x20%s',_0x50c0b9,_0x1f2d8c);_0x400213(_0x1f2d8c);});});}exports[_0x7e24('0x19')]=function(_0x58c74c){var _0x360cf4=this;return new Promise(function(_0x357de9,_0x26efa9){return db[_0x7e24('0x1a')]['create'](_0x58c74c['body'],{'raw':_0x58c74c['options']?_0x58c74c[_0x7e24('0x1b')][_0x7e24('0x1c')]===undefined?!![]:![]:!![]})[_0x7e24('0xf')](function(_0x19bc31){logger['info'](_0x7e24('0x19'),_0x58c74c);logger[_0x7e24('0x11')]('CreateSmsMessage',_0x58c74c,JSON[_0x7e24('0x13')](_0x19bc31));_0x357de9(_0x19bc31);})['catch'](function(_0x8ffc50){logger['error'](_0x7e24('0x19'),_0x8ffc50[_0x7e24('0x16')],_0x58c74c);_0x26efa9(_0x360cf4[_0x7e24('0x14')](0x1f4,_0x8ffc50[_0x7e24('0x16')]));});});}; \ No newline at end of file +var _0xa204=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','request\x20sent','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage','create','raw','then','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xa204,0xa0));var _0x4a20=function(_0x55f3b2,_0x533f6d){_0x55f3b2=_0x55f3b2-0x0;var _0x35da7a=_0xa204[_0x55f3b2];return _0x35da7a;};'use strict';var _=require(_0x4a20('0x0'));var util=require(_0x4a20('0x1'));var moment=require(_0x4a20('0x2'));var BPromise=require(_0x4a20('0x3'));var rs=require(_0x4a20('0x4'));var fs=require('fs');var Redis=require(_0x4a20('0x5'));var db=require(_0x4a20('0x6'))['db'];var utils=require(_0x4a20('0x7'));var logger=require('../../config/logger')(_0x4a20('0x8'));var config=require(_0x4a20('0x9'));var jayson=require(_0x4a20('0xa'));var client=jayson[_0x4a20('0xb')][_0x4a20('0xc')]({'port':0x232a});config[_0x4a20('0xd')]=_[_0x4a20('0xe')](config['redis'],{'host':_0x4a20('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a20('0xd')]));require('./smsMessage.socket')[_0x4a20('0x10')](socket);function respondWithRpcPromise(_0x201260,_0x283a95,_0x2b1066){return new BPromise(function(_0xebf9dd,_0x1f629b){return client[_0x4a20('0x11')](_0x201260,_0x2b1066)['then'](function(_0x4e46b3){logger[_0x4a20('0x12')]('SmsMessage,\x20%s,\x20%s',_0x283a95,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x283a95,_0x4a20('0x13'),JSON['stringify'](_0x4e46b3));if(_0x4e46b3[_0x4a20('0x14')]){if(_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x15')]===0x1f4){logger[_0x4a20('0x14')]('SmsMessage,\x20%s,\x20%s',_0x283a95,_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x16')]);return _0x1f629b(_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x16')]);}logger[_0x4a20('0x14')]('SmsMessage,\x20%s,\x20%s',_0x283a95,_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x16')]);return _0xebf9dd(_0x4e46b3['error'][_0x4a20('0x16')]);}else{logger[_0x4a20('0x12')](_0x4a20('0x17'),_0x283a95,_0x4a20('0x13'));_0xebf9dd(_0x4e46b3[_0x4a20('0x18')][_0x4a20('0x16')]);}})[_0x4a20('0x19')](function(_0xdcf79b){logger[_0x4a20('0x14')](_0x4a20('0x17'),_0x283a95,_0xdcf79b);_0x1f629b(_0xdcf79b);});});}exports[_0x4a20('0x1a')]=function(_0x605c6){var _0x299d7e=this;return new Promise(function(_0x8ab856,_0xb7870){return db[_0x4a20('0x1b')][_0x4a20('0x1c')](_0x605c6['body'],{'raw':_0x605c6['options']?_0x605c6['options'][_0x4a20('0x1d')]===undefined?!![]:![]:!![]})[_0x4a20('0x1e')](function(_0x270011){logger[_0x4a20('0x12')]('CreateSmsMessage',_0x605c6);logger[_0x4a20('0x1f')](_0x4a20('0x1a'),_0x605c6,JSON[_0x4a20('0x20')](_0x270011));_0x8ab856(_0x270011);})[_0x4a20('0x19')](function(_0x1b08d6){logger['error'](_0x4a20('0x1a'),_0x1b08d6[_0x4a20('0x16')],_0x605c6);_0xb7870(_0x299d7e['error'](0x1f4,_0x1b08d6[_0x4a20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 04dad9b..d42de93 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 _0x843d=['register','length','smsMessage:','./smsMessage.events','remove','update','removeListener'];(function(_0x4356d1,_0x2123bb){var _0x5c814b=function(_0x462924){while(--_0x462924){_0x4356d1['push'](_0x4356d1['shift']());}};_0x5c814b(++_0x2123bb);}(_0x843d,0x96));var _0xd843=function(_0x407055,_0x38e761){_0x407055=_0x407055-0x0;var _0x5c2b9b=_0x843d[_0x407055];return _0x5c2b9b;};'use strict';var SmsMessageEvents=require(_0xd843('0x0'));var events=['save',_0xd843('0x1'),_0xd843('0x2')];function createListener(_0x3fd885,_0x45bdf9){return function(_0x10fe66){_0x45bdf9['emit'](_0x3fd885,_0x10fe66);};}function removeListener(_0x176105,_0x9d2455){return function(){SmsMessageEvents[_0xd843('0x3')](_0x176105,_0x9d2455);};}exports[_0xd843('0x4')]=function(_0x126ef2){for(var _0x519d8f=0x0,_0x35ebff=events[_0xd843('0x5')];_0x519d8f<_0x35ebff;_0x519d8f++){var _0x224920=events[_0x519d8f];var _0x1b2ff7=createListener(_0xd843('0x6')+_0x224920,_0x126ef2);SmsMessageEvents['on'](_0x224920,_0x1b2ff7);}}; \ No newline at end of file +var _0xcee8=['save','removeListener','length'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xcee8,0xcf));var _0x8cee=function(_0x4edf07,_0x145026){_0x4edf07=_0x4edf07-0x0;var _0x2a6c20=_0xcee8[_0x4edf07];return _0x2a6c20;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8cee('0x0'),'remove','update'];function createListener(_0x5cbd3f,_0x5701fd){return function(_0x104698){_0x5701fd['emit'](_0x5cbd3f,_0x104698);};}function removeListener(_0x39dff0,_0x359560){return function(){SmsMessageEvents[_0x8cee('0x1')](_0x39dff0,_0x359560);};}exports['register']=function(_0x5da31b){for(var _0x240ce2=0x0,_0x3d1569=events[_0x8cee('0x2')];_0x240ce2<_0x3d1569;_0x240ce2++){var _0x20ee70=events[_0x240ce2];var _0x54dbcb=createListener('smsMessage:'+_0x20ee70,_0x5da31b);SmsMessageEvents['on'](_0x20ee70,_0x54dbcb);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index db50332..f9d2857 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 _0x0add=['addAgents','put','update','delete','removeTeams','exports','multer','util','path','Router','fs-extra','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x2e3d63,_0xb43a9b){var _0x105946=function(_0x466785){while(--_0x466785){_0x2e3d63['push'](_0x2e3d63['shift']());}};_0x105946(++_0xb43a9b);}(_0x0add,0xde));var _0xd0ad=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x0add[_0xac151d];return _0x111dba;};'use strict';var multer=require(_0xd0ad('0x0'));var util=require(_0xd0ad('0x1'));var path=require(_0xd0ad('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd0ad('0x3')]();var fs_extra=require(_0xd0ad('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd0ad('0x5'));var controller=require(_0xd0ad('0x6'));router[_0xd0ad('0x7')]('/',auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x9')]);router['get'](_0xd0ad('0xa'),auth['isAuthenticated'](),controller[_0xd0ad('0xb')]);router['get'](_0xd0ad('0xc'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0xd')]);router['get']('/:id/members',auth[_0xd0ad('0x8')](),controller[_0xd0ad('0xe')]);router['get'](_0xd0ad('0xf'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x10')]);router['get'](_0xd0ad('0x11'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x12')]);router[_0xd0ad('0x13')]('/',auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x14')]);router[_0xd0ad('0x13')](_0xd0ad('0xf'),auth[_0xd0ad('0x8')](),controller['addTeams']);router[_0xd0ad('0x13')](_0xd0ad('0x11'),auth['isAuthenticated'](),controller[_0xd0ad('0x15')]);router[_0xd0ad('0x16')](_0xd0ad('0xc'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x17')]);router[_0xd0ad('0x18')]('/:id',auth[_0xd0ad('0x8')](),controller['destroy']);router[_0xd0ad('0x18')](_0xd0ad('0xf'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x19')]);router[_0xd0ad('0x18')]('/:id/users',auth[_0xd0ad('0x8')](),controller['removeAgents']);module[_0xd0ad('0x1a')]=router; \ No newline at end of file +var _0x3e47=['addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','get','/:id','getMembers','/:id/teams','getAgents','post'];(function(_0xdb6969,_0x2eb0c1){var _0x59cf85=function(_0x504bf4){while(--_0x504bf4){_0xdb6969['push'](_0xdb6969['shift']());}};_0x59cf85(++_0x2eb0c1);}(_0x3e47,0x183));var _0x73e4=function(_0x459963,_0x5a366a){_0x459963=_0x459963-0x0;var _0xbe84e3=_0x3e47[_0x459963];return _0xbe84e3;};'use strict';var multer=require('multer');var util=require(_0x73e4('0x0'));var path=require(_0x73e4('0x1'));var timeout=require(_0x73e4('0x2'));var express=require(_0x73e4('0x3'));var router=express[_0x73e4('0x4')]();var fs_extra=require(_0x73e4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73e4('0x6'));var config=require(_0x73e4('0x7'));var controller=require(_0x73e4('0x8'));router['get']('/',auth[_0x73e4('0x9')](),controller[_0x73e4('0xa')]);router['get'](_0x73e4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x73e4('0xc')](_0x73e4('0xd'),auth[_0x73e4('0x9')](),controller['show']);router[_0x73e4('0xc')]('/:id/members',auth[_0x73e4('0x9')](),controller[_0x73e4('0xe')]);router[_0x73e4('0xc')](_0x73e4('0xf'),auth[_0x73e4('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x73e4('0x9')](),controller[_0x73e4('0x10')]);router[_0x73e4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x73e4('0xf'),auth['isAuthenticated'](),controller[_0x73e4('0x12')]);router[_0x73e4('0x11')](_0x73e4('0x13'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x14')]);router['put'](_0x73e4('0xd'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x15')]);router[_0x73e4('0x16')](_0x73e4('0xd'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x17')]);router[_0x73e4('0x16')](_0x73e4('0xf'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x18')]);router[_0x73e4('0x16')](_0x73e4('0x13'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x19')]);module[_0x73e4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c18b8df..f981cff 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 _0x8e74=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x4c8e37,_0x4a57c5){var _0x3dc248=function(_0x530635){while(--_0x530635){_0x4c8e37['push'](_0x4c8e37['shift']());}};_0x3dc248(++_0x4a57c5);}(_0x8e74,0x15a));var _0x48e7=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x8e74[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require('sequelize');module[_0x48e7('0x0')]={'name':{'type':Sequelize[_0x48e7('0x1')],'unique':_0x48e7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x48e7('0x1')]},'timeout':{'type':Sequelize[_0x48e7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48e7('0x4')](_0x48e7('0x5'),_0x48e7('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x0912=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x1d5a18,_0x585dc8){var _0x411450=function(_0x3f4ad8){while(--_0x3f4ad8){_0x1d5a18['push'](_0x1d5a18['shift']());}};_0x411450(++_0x585dc8);}(_0x0912,0x75));var _0x2091=function(_0x51556f,_0x297118){_0x51556f=_0x51556f-0x0;var _0x15140d=_0x0912[_0x51556f];return _0x15140d;};'use strict';var Sequelize=require(_0x2091('0x0'));module['exports']={'name':{'type':Sequelize[_0x2091('0x1')],'unique':_0x2091('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2091('0x1')]},'timeout':{'type':Sequelize[_0x2091('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2091('0x4'),_0x2091('0x5'),_0x2091('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ff00bf5..4ffc46b 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x4dce6e,_0x475c52){var _0x2bc2b4=function(_0x59208){while(--_0x59208){_0x4dce6e['push'](_0x4dce6e['shift']());}};_0x2bc2b4(++_0x475c52);}(_0xdb28,0x106));var _0x8db2=function(_0x5d733c,_0x4f49aa){_0x5d733c=_0x5d733c-0x0;var _0x2c76b8=_0xdb28[_0x5d733c];return _0x2c76b8;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x14462a,_0x4735b0){var _0x27e0ed=function(_0x14a1da){while(--_0x14a1da){_0x14462a['push'](_0x14462a['shift']());}};_0x27e0ed(++_0x4735b0);}(_0xdb28,0x106));var _0x8db2=function(_0x5732eb,_0xb2a38c){_0x5732eb=_0x5732eb-0x0;var _0x3ca5ce=_0xdb28[_0x5732eb];return _0x3ca5ce;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d35b914..298df84 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 _0x84f9=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x4f3751,_0x4d56c0){var _0x3e14a1=function(_0x2652b3){while(--_0x2652b3){_0x4f3751['push'](_0x4f3751['shift']());}};_0x3e14a1(++_0x4d56c0);}(_0x84f9,0xb7));var _0x984f=function(_0x11cfca,_0x4f3bc6){_0x11cfca=_0x11cfca-0x0;var _0x2c8cd6=_0x84f9[_0x11cfca];return _0x2c8cd6;};'use strict';var EventEmitter=require(_0x984f('0x0'));var SmsQueue=require(_0x984f('0x1'))['db'][_0x984f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x984f('0x3')](0x0);var events={'afterCreate':_0x984f('0x4'),'afterUpdate':_0x984f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4fcd28){return function(_0x1f9251,_0x5dd9d0,_0x4cd60b){SmsQueueEvents[_0x984f('0x6')](_0x4fcd28+':'+_0x1f9251['id'],_0x1f9251);SmsQueueEvents['emit'](_0x4fcd28,_0x1f9251);_0x4cd60b(null);};}for(var e in events){if(events[_0x984f('0x7')](e)){var event=events[e];SmsQueue[_0x984f('0x8')](e,emitEvent(event));}}module[_0x984f('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x252c=['exports','events','SmsQueue','setMaxListeners','update','emit','hook'];(function(_0x284173,_0x5714e2){var _0x4aa650=function(_0x15e485){while(--_0x15e485){_0x284173['push'](_0x284173['shift']());}};_0x4aa650(++_0x5714e2);}(_0x252c,0x151));var _0xc252=function(_0x404cfe,_0x519699){_0x404cfe=_0x404cfe-0x0;var _0x6b8223=_0x252c[_0x404cfe];return _0x6b8223;};'use strict';var EventEmitter=require(_0xc252('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc252('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc252('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc252('0x3'),'afterDestroy':'remove'};function emitEvent(_0x156fee){return function(_0x5787af,_0x3cfe3d,_0xdd6e06){SmsQueueEvents['emit'](_0x156fee+':'+_0x5787af['id'],_0x5787af);SmsQueueEvents[_0xc252('0x4')](_0x156fee,_0x5787af);_0xdd6e06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc252('0x5')](e,emitEvent(event));}}module[_0xc252('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 84a6d5c..6150991 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 _0xe367=['request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','api','moment','bluebird'];(function(_0x5889da,_0x384532){var _0x5e49af=function(_0x2551ad){while(--_0x2551ad){_0x5889da['push'](_0x5889da['shift']());}};_0x5e49af(++_0x384532);}(_0xe367,0xeb));var _0x7e36=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe367[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x7e36('0x0'));var util=require(_0x7e36('0x1'));var logger=require('../../config/logger')(_0x7e36('0x2'));var moment=require(_0x7e36('0x3'));var BPromise=require(_0x7e36('0x4'));var rp=require(_0x7e36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e36('0x6'));var config=require(_0x7e36('0x7'));var attributes=require(_0x7e36('0x8'));module[_0x7e36('0x9')]=function(_0x40c451,_0x2a36a3){return _0x40c451[_0x7e36('0xa')](_0x7e36('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3320=['sms_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x3320,0x169));var _0x0332=function(_0x325052,_0x54d125){_0x325052=_0x325052-0x0;var _0x1add5b=_0x3320[_0x325052];return _0x1add5b;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var logger=require('../../config/logger')(_0x0332('0x2'));var moment=require(_0x0332('0x3'));var BPromise=require(_0x0332('0x4'));var rp=require(_0x0332('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0332('0x6'));var config=require(_0x0332('0x7'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x30a5ca,_0x3a1667){return _0x30a5ca[_0x0332('0x8')]('SmsQueue',attributes,{'tableName':_0x0332('0x9'),'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 d670938..7728f0c 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 _0x4c85=['localhost','socket.io-emitter','./smsQueue.socket','register','request','then','request\x20sent','debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x56cfe2,_0x3f4980){var _0x173b3c=function(_0x4705b3){while(--_0x4705b3){_0x56cfe2['push'](_0x56cfe2['shift']());}};_0x173b3c(++_0x3f4980);}(_0x4c85,0x16d));var _0x54c8=function(_0x439d48,_0x44da6f){_0x439d48=_0x439d48-0x0;var _0x174b58=_0x4c85[_0x439d48];return _0x174b58;};'use strict';var _=require(_0x54c8('0x0'));var util=require(_0x54c8('0x1'));var moment=require(_0x54c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x54c8('0x3'));var fs=require('fs');var Redis=require(_0x54c8('0x4'));var db=require(_0x54c8('0x5'))['db'];var utils=require(_0x54c8('0x6'));var logger=require(_0x54c8('0x7'))('rpc');var config=require(_0x54c8('0x8'));var jayson=require(_0x54c8('0x9'));var client=jayson['client'][_0x54c8('0xa')]({'port':0x232a});config[_0x54c8('0xb')]=_[_0x54c8('0xc')](config[_0x54c8('0xb')],{'host':_0x54c8('0xd'),'port':0x18eb});var socket=require(_0x54c8('0xe'))(new Redis(config[_0x54c8('0xb')]));require(_0x54c8('0xf'))[_0x54c8('0x10')](socket);function respondWithRpcPromise(_0x234896,_0x3f9a82,_0xfbf18c){return new BPromise(function(_0x19564a,_0x47281e){return client[_0x54c8('0x11')](_0x234896,_0xfbf18c)[_0x54c8('0x12')](function(_0x574b45){logger['info']('SmsQueue,\x20%s,\x20%s',_0x3f9a82,_0x54c8('0x13'));logger[_0x54c8('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3f9a82,_0x54c8('0x13'),JSON[_0x54c8('0x15')](_0x574b45));if(_0x574b45[_0x54c8('0x16')]){if(_0x574b45['error'][_0x54c8('0x17')]===0x1f4){logger[_0x54c8('0x16')](_0x54c8('0x18'),_0x3f9a82,_0x574b45[_0x54c8('0x16')][_0x54c8('0x19')]);return _0x47281e(_0x574b45[_0x54c8('0x16')][_0x54c8('0x19')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x3f9a82,_0x574b45[_0x54c8('0x16')][_0x54c8('0x19')]);return _0x19564a(_0x574b45[_0x54c8('0x16')][_0x54c8('0x19')]);}else{logger[_0x54c8('0x1a')](_0x54c8('0x18'),_0x3f9a82,'request\x20sent');_0x19564a(_0x574b45[_0x54c8('0x1b')]['message']);}})[_0x54c8('0x1c')](function(_0x452915){logger[_0x54c8('0x16')](_0x54c8('0x18'),_0x3f9a82,_0x452915);_0x47281e(_0x452915);});});}exports[_0x54c8('0x1d')]=function(_0x39dbc9){var _0x5bbb8a=this;return new Promise(function(_0x5840b8,_0x34641c){return db[_0x54c8('0x1e')][_0x54c8('0x1f')]({'raw':_0x39dbc9[_0x54c8('0x20')]?_0x39dbc9['options'][_0x54c8('0x21')]===undefined?!![]:![]:!![],'where':_0x39dbc9['options']?_0x39dbc9['options'][_0x54c8('0x22')]||null:null,'attributes':_0x39dbc9[_0x54c8('0x20')]?_0x39dbc9[_0x54c8('0x20')][_0x54c8('0x23')]||null:null,'limit':_0x39dbc9[_0x54c8('0x20')]?_0x39dbc9['options'][_0x54c8('0x24')]||null:null,'include':_0x39dbc9[_0x54c8('0x20')]?_0x39dbc9[_0x54c8('0x20')][_0x54c8('0x25')]?_[_0x54c8('0x26')](_0x39dbc9['options']['include'],function(_0x584842){return{'model':db[_0x584842[_0x54c8('0x27')]],'as':_0x584842['as'],'attributes':_0x584842[_0x54c8('0x23')],'include':_0x584842['include']?_['map'](_0x584842[_0x54c8('0x25')],function(_0x27596f){return{'model':db[_0x27596f['model']],'as':_0x27596f['as'],'attributes':_0x27596f[_0x54c8('0x23')],'include':_0x27596f[_0x54c8('0x25')]?_['map'](_0x27596f[_0x54c8('0x25')],function(_0x55feff){return{'model':db[_0x55feff[_0x54c8('0x27')]],'as':_0x55feff['as'],'attributes':_0x55feff[_0x54c8('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xac9046){logger[_0x54c8('0x1a')]('GetSmsQueue',_0x39dbc9);logger[_0x54c8('0x14')](_0x54c8('0x1d'),_0x39dbc9,JSON[_0x54c8('0x15')](_0xac9046));_0x5840b8(_0xac9046);})['catch'](function(_0x5e721){logger[_0x54c8('0x16')](_0x54c8('0x1d'),_0x5e721[_0x54c8('0x19')],_0x39dbc9);_0x34641c(_0x5bbb8a[_0x54c8('0x16')](0x1f4,_0x5e721['message']));});});};exports[_0x54c8('0x28')]=function(_0x3d1d9d){var _0x4aae45=this;return new Promise(function(_0x11ff50,_0x51e50c){return db[_0x54c8('0x1e')][_0x54c8('0x29')]({'raw':_0x3d1d9d['options']?_0x3d1d9d['options'][_0x54c8('0x21')]===undefined?!![]:![]:!![],'where':_0x3d1d9d[_0x54c8('0x20')]?_0x3d1d9d['options']['where']||null:null,'attributes':_0x3d1d9d[_0x54c8('0x20')]?_0x3d1d9d['options'][_0x54c8('0x23')]||null:null,'include':_0x3d1d9d[_0x54c8('0x20')]?_0x3d1d9d[_0x54c8('0x20')]['include']?_[_0x54c8('0x26')](_0x3d1d9d['options'][_0x54c8('0x25')],function(_0x548390){return{'model':db[_0x548390['model']],'as':_0x548390['as'],'attributes':_0x548390[_0x54c8('0x23')],'include':_0x548390[_0x54c8('0x25')]?_[_0x54c8('0x26')](_0x548390['include'],function(_0x1ce2b2){return{'model':db[_0x1ce2b2[_0x54c8('0x27')]],'as':_0x1ce2b2['as'],'attributes':_0x1ce2b2[_0x54c8('0x23')],'include':_0x1ce2b2['include']?_[_0x54c8('0x26')](_0x1ce2b2[_0x54c8('0x25')],function(_0xadf463){return{'model':db[_0xadf463[_0x54c8('0x27')]],'as':_0xadf463['as'],'attributes':_0xadf463[_0x54c8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x54c8('0x12')](function(_0x2f9a9c){logger[_0x54c8('0x1a')]('ShowSmsQueue',_0x3d1d9d);logger['debug']('ShowSmsQueue',_0x3d1d9d,JSON[_0x54c8('0x15')](_0x2f9a9c));_0x11ff50(_0x2f9a9c);})[_0x54c8('0x1c')](function(_0x14d2af){logger['error'](_0x54c8('0x28'),_0x14d2af[_0x54c8('0x19')],_0x3d1d9d);_0x51e50c(_0x4aae45[_0x54c8('0x16')](0x1f4,_0x14d2af[_0x54c8('0x19')]));});});}; \ No newline at end of file +var _0x65c3=['./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowSmsQueue','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x31fb8c,_0x35a04c){var _0x7e5090=function(_0x1d6c44){while(--_0x1d6c44){_0x31fb8c['push'](_0x31fb8c['shift']());}};_0x7e5090(++_0x35a04c);}(_0x65c3,0x88));var _0x365c=function(_0x1cf618,_0x489ef2){_0x1cf618=_0x1cf618-0x0;var _0x344c1b=_0x65c3[_0x1cf618];return _0x344c1b;};'use strict';var _=require(_0x365c('0x0'));var util=require(_0x365c('0x1'));var moment=require(_0x365c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x365c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x365c('0x4'))(_0x365c('0x5'));var config=require(_0x365c('0x6'));var jayson=require(_0x365c('0x7'));var client=jayson['client'][_0x365c('0x8')]({'port':0x232a});config[_0x365c('0x9')]=_[_0x365c('0xa')](config[_0x365c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x365c('0xb'))(new Redis(config[_0x365c('0x9')]));require(_0x365c('0xc'))[_0x365c('0xd')](socket);function respondWithRpcPromise(_0x36d5e3,_0xaac05f,_0x5c52a6){return new BPromise(function(_0xb9da70,_0x315c23){return client[_0x365c('0xe')](_0x36d5e3,_0x5c52a6)[_0x365c('0xf')](function(_0x4112b9){logger[_0x365c('0x10')]('SmsQueue,\x20%s,\x20%s',_0xaac05f,_0x365c('0x11'));logger[_0x365c('0x12')](_0x365c('0x13'),_0xaac05f,'request\x20sent',JSON[_0x365c('0x14')](_0x4112b9));if(_0x4112b9[_0x365c('0x15')]){if(_0x4112b9[_0x365c('0x15')]['code']===0x1f4){logger['error'](_0x365c('0x16'),_0xaac05f,_0x4112b9['error'][_0x365c('0x17')]);return _0x315c23(_0x4112b9[_0x365c('0x15')][_0x365c('0x17')]);}logger[_0x365c('0x15')](_0x365c('0x16'),_0xaac05f,_0x4112b9[_0x365c('0x15')][_0x365c('0x17')]);return _0xb9da70(_0x4112b9['error'][_0x365c('0x17')]);}else{logger[_0x365c('0x10')](_0x365c('0x16'),_0xaac05f,_0x365c('0x11'));_0xb9da70(_0x4112b9['result'][_0x365c('0x17')]);}})['catch'](function(_0x5e3781){logger['error']('SmsQueue,\x20%s,\x20%s',_0xaac05f,_0x5e3781);_0x315c23(_0x5e3781);});});}exports[_0x365c('0x18')]=function(_0x55a6e3){var _0xb6ddd9=this;return new Promise(function(_0x41b5bb,_0x4d1f50){return db[_0x365c('0x19')][_0x365c('0x1a')]({'raw':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1c')]===undefined?!![]:![]:!![],'where':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1d')]||null:null,'attributes':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')]['attributes']||null:null,'limit':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1e')]||null:null,'include':_0x55a6e3['options']?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1f')]?_[_0x365c('0x20')](_0x55a6e3['options'][_0x365c('0x1f')],function(_0x3e523b){return{'model':db[_0x3e523b[_0x365c('0x21')]],'as':_0x3e523b['as'],'attributes':_0x3e523b[_0x365c('0x22')],'include':_0x3e523b[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x3e523b[_0x365c('0x1f')],function(_0x1c3cd0){return{'model':db[_0x1c3cd0[_0x365c('0x21')]],'as':_0x1c3cd0['as'],'attributes':_0x1c3cd0[_0x365c('0x22')],'include':_0x1c3cd0[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x1c3cd0[_0x365c('0x1f')],function(_0x556cfe){return{'model':db[_0x556cfe['model']],'as':_0x556cfe['as'],'attributes':_0x556cfe[_0x365c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x365c('0xf')](function(_0x2c3837){logger[_0x365c('0x10')]('GetSmsQueue',_0x55a6e3);logger[_0x365c('0x12')]('GetSmsQueue',_0x55a6e3,JSON[_0x365c('0x14')](_0x2c3837));_0x41b5bb(_0x2c3837);})[_0x365c('0x23')](function(_0x3b8d49){logger[_0x365c('0x15')](_0x365c('0x18'),_0x3b8d49['message'],_0x55a6e3);_0x4d1f50(_0xb6ddd9[_0x365c('0x15')](0x1f4,_0x3b8d49['message']));});});};exports['ShowSmsQueue']=function(_0x2d86b7){var _0x376ec9=this;return new Promise(function(_0x156992,_0x34b169){return db[_0x365c('0x19')]['find']({'raw':_0x2d86b7['options']?_0x2d86b7[_0x365c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d86b7['options']?_0x2d86b7[_0x365c('0x1b')][_0x365c('0x1d')]||null:null,'attributes':_0x2d86b7[_0x365c('0x1b')]?_0x2d86b7[_0x365c('0x1b')]['attributes']||null:null,'include':_0x2d86b7[_0x365c('0x1b')]?_0x2d86b7[_0x365c('0x1b')]['include']?_['map'](_0x2d86b7[_0x365c('0x1b')][_0x365c('0x1f')],function(_0x327ad7){return{'model':db[_0x327ad7[_0x365c('0x21')]],'as':_0x327ad7['as'],'attributes':_0x327ad7['attributes'],'include':_0x327ad7[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x327ad7[_0x365c('0x1f')],function(_0x2b3fc0){return{'model':db[_0x2b3fc0[_0x365c('0x21')]],'as':_0x2b3fc0['as'],'attributes':_0x2b3fc0['attributes'],'include':_0x2b3fc0[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x2b3fc0[_0x365c('0x1f')],function(_0x34f78c){return{'model':db[_0x34f78c[_0x365c('0x21')]],'as':_0x34f78c['as'],'attributes':_0x34f78c['attributes']};}):[]};}):[]};}):[]:[]})[_0x365c('0xf')](function(_0x434b62){logger[_0x365c('0x10')](_0x365c('0x24'),_0x2d86b7);logger['debug'](_0x365c('0x24'),_0x2d86b7,JSON[_0x365c('0x14')](_0x434b62));_0x156992(_0x434b62);})[_0x365c('0x23')](function(_0xcc0cf5){logger['error'](_0x365c('0x24'),_0xcc0cf5['message'],_0x2d86b7);_0x34b169(_0x376ec9['error'](0x1f4,_0xcc0cf5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index bd1436c..74a6a65 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 _0x8332=['smsQueue:','./smsQueue.events','save','removeListener','register'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8332,0x10a));var _0x2833=function(_0x48079a,_0x530039){_0x48079a=_0x48079a-0x0;var _0x555e4a=_0x8332[_0x48079a];return _0x555e4a;};'use strict';var SmsQueueEvents=require(_0x2833('0x0'));var events=[_0x2833('0x1'),'remove','update'];function createListener(_0x56b475,_0xbf729d){return function(_0x3eb6a4){_0xbf729d['emit'](_0x56b475,_0x3eb6a4);};}function removeListener(_0x5b8a9c,_0x4216b3){return function(){SmsQueueEvents[_0x2833('0x2')](_0x5b8a9c,_0x4216b3);};}exports[_0x2833('0x3')]=function(_0x45ee36){for(var _0x1b1418=0x0,_0x1869c0=events['length'];_0x1b1418<_0x1869c0;_0x1b1418++){var _0x40ddb4=events[_0x1b1418];var _0x20cc05=createListener(_0x2833('0x4')+_0x40ddb4,_0x45ee36);SmsQueueEvents['on'](_0x40ddb4,_0x20cc05);}}; \ No newline at end of file +var _0x20c8=['save','update','emit','removeListener','length','smsQueue:','./smsQueue.events'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x20c8,0x16b));var _0x820c=function(_0x10a387,_0x4283b5){_0x10a387=_0x10a387-0x0;var _0x37749d=_0x20c8[_0x10a387];return _0x37749d;};'use strict';var SmsQueueEvents=require(_0x820c('0x0'));var events=[_0x820c('0x1'),'remove',_0x820c('0x2')];function createListener(_0x54e8e5,_0x2679d7){return function(_0x101697){_0x2679d7[_0x820c('0x3')](_0x54e8e5,_0x101697);};}function removeListener(_0x290339,_0x4ac9be){return function(){SmsQueueEvents[_0x820c('0x4')](_0x290339,_0x4ac9be);};}exports['register']=function(_0x2d3601){for(var _0x2e1d08=0x0,_0x2cbda0=events[_0x820c('0x5')];_0x2e1d08<_0x2cbda0;_0x2e1d08++){var _0x51085f=events[_0x2e1d08];var _0x1004e6=createListener(_0x820c('0x6')+_0x51085f,_0x2d3601);SmsQueueEvents['on'](_0x51085f,_0x1004e6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 7b6fb53..083fbb9 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 _0x02b1=['/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3a5c29,_0x1688c0){var _0x16ece8=function(_0x4fcc32){while(--_0x4fcc32){_0x3a5c29['push'](_0x3a5c29['shift']());}};_0x16ece8(++_0x1688c0);}(_0x02b1,0x7f));var _0x102b=function(_0x5dd2ef,_0x5b6f5b){_0x5dd2ef=_0x5dd2ef-0x0;var _0x19eaa8=_0x02b1[_0x5dd2ef];return _0x19eaa8;};'use strict';var multer=require(_0x102b('0x0'));var util=require(_0x102b('0x1'));var path=require(_0x102b('0x2'));var timeout=require(_0x102b('0x3'));var express=require(_0x102b('0x4'));var router=express['Router']();var fs_extra=require(_0x102b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x102b('0x6'));var controller=require(_0x102b('0x7'));router[_0x102b('0x8')]('/',auth[_0x102b('0x9')](),controller[_0x102b('0xa')]);router['get'](_0x102b('0xb'),auth[_0x102b('0x9')](),controller[_0x102b('0xc')]);router[_0x102b('0x8')](_0x102b('0xd'),auth[_0x102b('0x9')](),controller[_0x102b('0xe')]);router['post']('/',auth[_0x102b('0x9')](),controller[_0x102b('0xf')]);router[_0x102b('0x10')](_0x102b('0xd'),auth['isAuthenticated'](),controller[_0x102b('0x11')]);router['delete'](_0x102b('0xd'),auth[_0x102b('0x9')](),controller[_0x102b('0x12')]);module[_0x102b('0x13')]=router; \ No newline at end of file +var _0x806b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util'];(function(_0x11058d,_0x3e6bb1){var _0x26e7e4=function(_0x5c7650){while(--_0x5c7650){_0x11058d['push'](_0x11058d['shift']());}};_0x26e7e4(++_0x3e6bb1);}(_0x806b,0x163));var _0xb806=function(_0x19fa2a,_0x23ee0d){_0x19fa2a=_0x19fa2a-0x0;var _0x926ddf=_0x806b[_0x19fa2a];return _0x926ddf;};'use strict';var multer=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var path=require(_0xb806('0x2'));var timeout=require(_0xb806('0x3'));var express=require(_0xb806('0x4'));var router=express[_0xb806('0x5')]();var fs_extra=require(_0xb806('0x6'));var auth=require(_0xb806('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb806('0x8'));var controller=require(_0xb806('0x9'));router[_0xb806('0xa')]('/',auth[_0xb806('0xb')](),controller['index']);router[_0xb806('0xa')](_0xb806('0xc'),auth['isAuthenticated'](),controller[_0xb806('0xd')]);router[_0xb806('0xa')](_0xb806('0xe'),auth[_0xb806('0xb')](),controller['show']);router[_0xb806('0xf')]('/',auth['isAuthenticated'](),controller[_0xb806('0x10')]);router['put'](_0xb806('0xe'),auth['isAuthenticated'](),controller[_0xb806('0x11')]);router[_0xb806('0x12')](_0xb806('0xe'),auth['isAuthenticated'](),controller[_0xb806('0x13')]);module[_0xb806('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a85bb9e..a74f913 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 _0x7560=['DATE','moment','sequelize','exports','STRING'];(function(_0x4ffeca,_0x227fc4){var _0x453b13=function(_0x3069a0){while(--_0x3069a0){_0x4ffeca['push'](_0x4ffeca['shift']());}};_0x453b13(++_0x227fc4);}(_0x7560,0x18c));var _0x0756=function(_0x3030a9,_0x3e7be2){_0x3030a9=_0x3030a9-0x0;var _0x5e6b29=_0x7560[_0x3030a9];return _0x5e6b29;};'use strict';var moment=require(_0x0756('0x0'));var Sequelize=require(_0x0756('0x1'));module[_0x0756('0x2')]={'uniqueid':{'type':Sequelize[_0x0756('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0756('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0756('0x4')]},'exitAt':{'type':Sequelize[_0x0756('0x4')]},'reason':{'type':Sequelize[_0x0756('0x3')]}}; \ No newline at end of file +var _0xd7a3=['DATE','moment','sequelize','exports','STRING'];(function(_0x545dd8,_0x404f75){var _0x44cd80=function(_0xec3ca3){while(--_0xec3ca3){_0x545dd8['push'](_0x545dd8['shift']());}};_0x44cd80(++_0x404f75);}(_0xd7a3,0x6a));var _0x3d7a=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd7a3[_0x33032e];return _0x13316b;};'use strict';var moment=require(_0x3d7a('0x0'));var Sequelize=require(_0x3d7a('0x1'));module[_0x3d7a('0x2')]={'uniqueid':{'type':Sequelize[_0x3d7a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3d7a('0x3')]},'joinAt':{'type':Sequelize[_0x3d7a('0x4')]},'leaveAt':{'type':Sequelize[_0x3d7a('0x4')]},'acceptAt':{'type':Sequelize[_0x3d7a('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3d7a('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9d34b02..3ed2e18 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 _0x1b1b=['end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1b1b,0x158));var _0xb1b1=function(_0x56739b,_0x2d2cc9){_0x56739b=_0x56739b-0x0;var _0x1c752f=_0x1b1b[_0x56739b];return _0x1c752f;};'use strict';var emlformat=require(_0xb1b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1b1('0x1'));var jsonpatch=require(_0xb1b1('0x2'));var rp=require(_0xb1b1('0x3'));var moment=require('moment');var BPromise=require(_0xb1b1('0x4'));var Mustache=require(_0xb1b1('0x5'));var util=require(_0xb1b1('0x6'));var path=require(_0xb1b1('0x7'));var sox=require(_0xb1b1('0x8'));var csv=require(_0xb1b1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1b1('0xa'));var _=require(_0xb1b1('0xb'));var squel=require(_0xb1b1('0xc'));var crypto=require(_0xb1b1('0xd'));var jsforce=require(_0xb1b1('0xe'));var deskjs=require(_0xb1b1('0xf'));var toCsv=require(_0xb1b1('0x9'));var querystring=require(_0xb1b1('0x10'));var Papa=require(_0xb1b1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb1b1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1b1('0x13'))(_0xb1b1('0x14'));var utils=require(_0xb1b1('0x15'));var config=require(_0xb1b1('0x16'));var licenseUtil=require(_0xb1b1('0x17'));var db=require(_0xb1b1('0x18'))['db'];function respondWithStatusCode(_0x4d6ad4,_0x572757){_0x572757=_0x572757||0xcc;return function(_0x39d684){if(_0x39d684){return _0x4d6ad4['sendStatus'](_0x572757);}return _0x4d6ad4[_0xb1b1('0x19')](_0x572757)[_0xb1b1('0x1a')]();};}function respondWithResult(_0x131195,_0x238fa1){_0x238fa1=_0x238fa1||0xc8;return function(_0x8701a7){if(_0x8701a7){return _0x131195['status'](_0x238fa1)[_0xb1b1('0x1b')](_0x8701a7);}};}function respondWithFilteredResult(_0xe0c494,_0x547759){return function(_0x5f3dc2){if(_0x5f3dc2){var _0x3fffac=typeof _0x547759[_0xb1b1('0x1c')]===_0xb1b1('0x1d')&&typeof _0x547759['limit']==='undefined';var _0x539cff=_0x5f3dc2[_0xb1b1('0x1e')];var _0x59bd9f=_0x3fffac?0x0:_0x547759[_0xb1b1('0x1c')];var _0x54c73b=_0x3fffac?_0x5f3dc2[_0xb1b1('0x1e')]:_0x547759[_0xb1b1('0x1c')]+_0x547759[_0xb1b1('0x1f')];var _0x5b046a;if(_0x54c73b>=_0x539cff){_0x54c73b=_0x539cff;_0x5b046a=0xc8;}else{_0x5b046a=0xce;}_0xe0c494['status'](_0x5b046a);return _0xe0c494[_0xb1b1('0x20')]('Content-Range',_0x59bd9f+'-'+_0x54c73b+'/'+_0x539cff)[_0xb1b1('0x1b')](_0x5f3dc2);}return null;};}function patchUpdates(_0x30d0bc){return function(_0x5ab179){try{jsonpatch[_0xb1b1('0x21')](_0x5ab179,_0x30d0bc,!![]);}catch(_0x25ccf4){return BPromise[_0xb1b1('0x22')](_0x25ccf4);}return _0x5ab179[_0xb1b1('0x23')]();};}function saveUpdates(_0x470e7b,_0x2918c6){return function(_0x156be6){if(_0x156be6){return _0x156be6[_0xb1b1('0x24')](_0x470e7b)[_0xb1b1('0x25')](function(_0x5566d7){return _0x5566d7;});}return null;};}function removeEntity(_0x2d6859,_0x5e8c1a){return function(_0xd8881c){if(_0xd8881c){return _0xd8881c[_0xb1b1('0x26')]()[_0xb1b1('0x25')](function(){_0x2d6859['status'](0xcc)[_0xb1b1('0x1a')]();});}};}function handleEntityNotFound(_0x5e932c,_0x51782a){return function(_0x2b2fd1){if(!_0x2b2fd1){_0x5e932c[_0xb1b1('0x27')](0x194);}return _0x2b2fd1;};}function handleError(_0x10d0d1,_0xc7718e){_0xc7718e=_0xc7718e||0x1f4;return function(_0x28321e){logger[_0xb1b1('0x28')](_0x28321e[_0xb1b1('0x29')]);if(_0x28321e['name']){delete _0x28321e[_0xb1b1('0x2a')];}_0x10d0d1['status'](_0xc7718e)['send'](_0x28321e);};}exports[_0xb1b1('0x2b')]=function(_0x3c07d8,_0x31ae8a){var _0x36d0a4={},_0x3205d5={},_0xc8159b={'count':0x0,'rows':[]};var _0x4c917b=_[_0xb1b1('0x2c')](db[_0xb1b1('0x2d')][_0xb1b1('0x2e')],function(_0x1b0815){return{'name':_0x1b0815['fieldName'],'type':_0x1b0815['type'][_0xb1b1('0x2f')]};});_0x3205d5[_0xb1b1('0x30')]=_['map'](_0x4c917b,_0xb1b1('0x2a'));_0x3205d5[_0xb1b1('0x31')]=_[_0xb1b1('0x32')](_0x3c07d8[_0xb1b1('0x31')]);_0x3205d5[_0xb1b1('0x33')]=_[_0xb1b1('0x34')](_0x3205d5[_0xb1b1('0x30')],_0x3205d5[_0xb1b1('0x31')]);_0x36d0a4[_0xb1b1('0x35')]=_[_0xb1b1('0x34')](_0x3205d5[_0xb1b1('0x30')],qs['fields'](_0x3c07d8[_0xb1b1('0x31')][_0xb1b1('0x36')]));_0x36d0a4[_0xb1b1('0x35')]=_0x36d0a4[_0xb1b1('0x35')][_0xb1b1('0x37')]?_0x36d0a4[_0xb1b1('0x35')]:_0x3205d5[_0xb1b1('0x30')];if(!_0x3c07d8[_0xb1b1('0x31')][_0xb1b1('0x38')]('nolimit')){_0x36d0a4[_0xb1b1('0x1f')]=qs[_0xb1b1('0x1f')](_0x3c07d8[_0xb1b1('0x31')][_0xb1b1('0x1f')]);_0x36d0a4['offset']=qs[_0xb1b1('0x1c')](_0x3c07d8[_0xb1b1('0x31')][_0xb1b1('0x1c')]);}_0x36d0a4[_0xb1b1('0x39')]=qs[_0xb1b1('0x3a')](_0x3c07d8[_0xb1b1('0x31')]['sort']);_0x36d0a4[_0xb1b1('0x3b')]=qs[_0xb1b1('0x33')](_['pick'](_0x3c07d8[_0xb1b1('0x31')],_0x3205d5[_0xb1b1('0x33')]),_0x4c917b);if(_0x3c07d8[_0xb1b1('0x31')][_0xb1b1('0x3c')]){_0x36d0a4['where']=_[_0xb1b1('0x3d')](_0x36d0a4['where'],{'$or':_[_0xb1b1('0x2c')](_0x4c917b,function(_0x22949a){if(_0x22949a[_0xb1b1('0x3e')]!==_0xb1b1('0x3f')){var _0x32cd6d={};_0x32cd6d[_0x22949a[_0xb1b1('0x2a')]]={'$like':'%'+_0x3c07d8[_0xb1b1('0x31')]['filter']+'%'};return _0x32cd6d;}})});}_0x36d0a4=_['merge']({},_0x36d0a4,_0x3c07d8[_0xb1b1('0x40')]);var _0x238fca={'where':_0x36d0a4['where']};return db['SmsQueueReport'][_0xb1b1('0x1e')](_0x238fca)[_0xb1b1('0x25')](function(_0x4903f7){_0xc8159b['count']=_0x4903f7;if(_0x3c07d8[_0xb1b1('0x31')][_0xb1b1('0x41')]){_0x36d0a4[_0xb1b1('0x42')]=[{'all':!![]}];}return db[_0xb1b1('0x2d')]['findAll'](_0x36d0a4);})[_0xb1b1('0x25')](function(_0x2d1be8){_0xc8159b[_0xb1b1('0x43')]=_0x2d1be8;return _0xc8159b;})[_0xb1b1('0x25')](respondWithFilteredResult(_0x31ae8a,_0x36d0a4))[_0xb1b1('0x44')](handleError(_0x31ae8a,null));};exports['show']=function(_0x2b98ab,_0x2b31e3){var _0x5bba6d={'raw':!![],'where':{'id':_0x2b98ab[_0xb1b1('0x45')]['id']}},_0x2ef2e0={};_0x2ef2e0[_0xb1b1('0x30')]=_[_0xb1b1('0x32')](db[_0xb1b1('0x2d')][_0xb1b1('0x2e')]);_0x2ef2e0[_0xb1b1('0x31')]=_[_0xb1b1('0x32')](_0x2b98ab[_0xb1b1('0x31')]);_0x2ef2e0['filters']=_['intersection'](_0x2ef2e0['model'],_0x2ef2e0[_0xb1b1('0x31')]);_0x5bba6d[_0xb1b1('0x35')]=_[_0xb1b1('0x34')](_0x2ef2e0[_0xb1b1('0x30')],qs[_0xb1b1('0x36')](_0x2b98ab[_0xb1b1('0x31')][_0xb1b1('0x36')]));_0x5bba6d[_0xb1b1('0x35')]=_0x5bba6d[_0xb1b1('0x35')]['length']?_0x5bba6d[_0xb1b1('0x35')]:_0x2ef2e0[_0xb1b1('0x30')];if(_0x2b98ab[_0xb1b1('0x31')][_0xb1b1('0x41')]){_0x5bba6d[_0xb1b1('0x42')]=[{'all':!![]}];}_0x5bba6d=_[_0xb1b1('0x3d')]({},_0x5bba6d,_0x2b98ab[_0xb1b1('0x40')]);return db[_0xb1b1('0x2d')]['find'](_0x5bba6d)[_0xb1b1('0x25')](handleEntityNotFound(_0x2b31e3,null))['then'](respondWithResult(_0x2b31e3,null))[_0xb1b1('0x44')](handleError(_0x2b31e3,null));};exports[_0xb1b1('0x46')]=function(_0x591e21,_0x30148f){return db[_0xb1b1('0x2d')][_0xb1b1('0x46')](_0x591e21[_0xb1b1('0x47')],{})[_0xb1b1('0x25')](respondWithResult(_0x30148f,0xc9))[_0xb1b1('0x44')](handleError(_0x30148f,null));};exports[_0xb1b1('0x24')]=function(_0x868453,_0xfc9741){if(_0x868453[_0xb1b1('0x47')]['id']){delete _0x868453[_0xb1b1('0x47')]['id'];}return db[_0xb1b1('0x2d')][_0xb1b1('0x48')]({'where':{'id':_0x868453[_0xb1b1('0x45')]['id']}})['then'](handleEntityNotFound(_0xfc9741,null))[_0xb1b1('0x25')](saveUpdates(_0x868453[_0xb1b1('0x47')],null))[_0xb1b1('0x25')](respondWithResult(_0xfc9741,null))[_0xb1b1('0x44')](handleError(_0xfc9741,null));};exports[_0xb1b1('0x26')]=function(_0x1d0ffd,_0x2053ac){return db[_0xb1b1('0x2d')][_0xb1b1('0x48')]({'where':{'id':_0x1d0ffd['params']['id']}})[_0xb1b1('0x25')](handleEntityNotFound(_0x2053ac,null))[_0xb1b1('0x25')](removeEntity(_0x2053ac,null))[_0xb1b1('0x44')](handleError(_0x2053ac,null));};exports[_0xb1b1('0x49')]=function(_0x33d38d,_0x248c10){return db[_0xb1b1('0x2d')][_0xb1b1('0x49')]()['then'](respondWithResult(_0x248c10,null))[_0xb1b1('0x44')](handleError(_0x248c10,null));}; \ No newline at end of file +var _0xbb08=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsQueueReport','include','findAll','rows','show','params','includeAll','find','catch','create','update','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x22ba1e,_0x4b25fd){var _0x3b42e4=function(_0x3e4a78){while(--_0x3e4a78){_0x22ba1e['push'](_0x22ba1e['shift']());}};_0x3b42e4(++_0x4b25fd);}(_0xbb08,0xd0));var _0x8bb0=function(_0x5bfd24,_0x553ba3){_0x5bfd24=_0x5bfd24-0x0;var _0x3b28f1=_0xbb08[_0x5bfd24];return _0x3b28f1;};'use strict';var emlformat=require(_0x8bb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bb0('0x1'));var jsonpatch=require(_0x8bb0('0x2'));var rp=require('request-promise');var moment=require(_0x8bb0('0x3'));var BPromise=require(_0x8bb0('0x4'));var Mustache=require(_0x8bb0('0x5'));var util=require('util');var path=require(_0x8bb0('0x6'));var sox=require(_0x8bb0('0x7'));var csv=require('to-csv');var ejs=require(_0x8bb0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bb0('0x9'));var squel=require(_0x8bb0('0xa'));var crypto=require(_0x8bb0('0xb'));var jsforce=require(_0x8bb0('0xc'));var deskjs=require(_0x8bb0('0xd'));var toCsv=require(_0x8bb0('0xe'));var querystring=require(_0x8bb0('0xf'));var Papa=require(_0x8bb0('0x10'));var Redis=require(_0x8bb0('0x11'));var authService=require(_0x8bb0('0x12'));var qs=require(_0x8bb0('0x13'));var as=require(_0x8bb0('0x14'));var hardwareService=require(_0x8bb0('0x15'));var logger=require('../../config/logger')(_0x8bb0('0x16'));var utils=require(_0x8bb0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8bb0('0x18'));var db=require(_0x8bb0('0x19'))['db'];function respondWithStatusCode(_0x3e2e87,_0x1422d){_0x1422d=_0x1422d||0xcc;return function(_0x990956){if(_0x990956){return _0x3e2e87[_0x8bb0('0x1a')](_0x1422d);}return _0x3e2e87[_0x8bb0('0x1b')](_0x1422d)[_0x8bb0('0x1c')]();};}function respondWithResult(_0x1eb2d4,_0x3d06cb){_0x3d06cb=_0x3d06cb||0xc8;return function(_0x309293){if(_0x309293){return _0x1eb2d4[_0x8bb0('0x1b')](_0x3d06cb)[_0x8bb0('0x1d')](_0x309293);}};}function respondWithFilteredResult(_0x34f244,_0x18f9ff){return function(_0x218d85){if(_0x218d85){var _0x48a36d=typeof _0x18f9ff['offset']===_0x8bb0('0x1e')&&typeof _0x18f9ff[_0x8bb0('0x1f')]===_0x8bb0('0x1e');var _0x304790=_0x218d85[_0x8bb0('0x20')];var _0x4531ac=_0x48a36d?0x0:_0x18f9ff[_0x8bb0('0x21')];var _0x4a6ffe=_0x48a36d?_0x218d85['count']:_0x18f9ff[_0x8bb0('0x21')]+_0x18f9ff['limit'];var _0x4e8272;if(_0x4a6ffe>=_0x304790){_0x4a6ffe=_0x304790;_0x4e8272=0xc8;}else{_0x4e8272=0xce;}_0x34f244[_0x8bb0('0x1b')](_0x4e8272);return _0x34f244[_0x8bb0('0x22')](_0x8bb0('0x23'),_0x4531ac+'-'+_0x4a6ffe+'/'+_0x304790)[_0x8bb0('0x1d')](_0x218d85);}return null;};}function patchUpdates(_0x5bcb16){return function(_0x49c504){try{jsonpatch[_0x8bb0('0x24')](_0x49c504,_0x5bcb16,!![]);}catch(_0x1c3f39){return BPromise[_0x8bb0('0x25')](_0x1c3f39);}return _0x49c504[_0x8bb0('0x26')]();};}function saveUpdates(_0x5f046e,_0x4f9735){return function(_0x32b0fb){if(_0x32b0fb){return _0x32b0fb['update'](_0x5f046e)[_0x8bb0('0x27')](function(_0x4ddb2e){return _0x4ddb2e;});}return null;};}function removeEntity(_0x2b7891,_0x5e4eb0){return function(_0x56c013){if(_0x56c013){return _0x56c013[_0x8bb0('0x28')]()[_0x8bb0('0x27')](function(){_0x2b7891[_0x8bb0('0x1b')](0xcc)[_0x8bb0('0x1c')]();});}};}function handleEntityNotFound(_0x397d5b,_0x3dd5c3){return function(_0x4e9fce){if(!_0x4e9fce){_0x397d5b[_0x8bb0('0x1a')](0x194);}return _0x4e9fce;};}function handleError(_0x1a95ff,_0x510ba0){_0x510ba0=_0x510ba0||0x1f4;return function(_0x25ee8f){logger['error'](_0x25ee8f[_0x8bb0('0x29')]);if(_0x25ee8f[_0x8bb0('0x2a')]){delete _0x25ee8f['name'];}_0x1a95ff[_0x8bb0('0x1b')](_0x510ba0)['send'](_0x25ee8f);};}exports[_0x8bb0('0x2b')]=function(_0x837265,_0x2e1d1c){var _0x3ed2de={},_0x659398={},_0x5bda87={'count':0x0,'rows':[]};var _0x131ca1=_[_0x8bb0('0x2c')](db['SmsQueueReport'][_0x8bb0('0x2d')],function(_0x4390e1){return{'name':_0x4390e1[_0x8bb0('0x2e')],'type':_0x4390e1[_0x8bb0('0x2f')]['key']};});_0x659398[_0x8bb0('0x30')]=_[_0x8bb0('0x2c')](_0x131ca1,_0x8bb0('0x2a'));_0x659398[_0x8bb0('0x31')]=_[_0x8bb0('0x32')](_0x837265[_0x8bb0('0x31')]);_0x659398['filters']=_[_0x8bb0('0x33')](_0x659398['model'],_0x659398[_0x8bb0('0x31')]);_0x3ed2de['attributes']=_['intersection'](_0x659398[_0x8bb0('0x30')],qs[_0x8bb0('0x34')](_0x837265[_0x8bb0('0x31')][_0x8bb0('0x34')]));_0x3ed2de[_0x8bb0('0x35')]=_0x3ed2de['attributes'][_0x8bb0('0x36')]?_0x3ed2de[_0x8bb0('0x35')]:_0x659398[_0x8bb0('0x30')];if(!_0x837265['query']['hasOwnProperty'](_0x8bb0('0x37'))){_0x3ed2de[_0x8bb0('0x1f')]=qs[_0x8bb0('0x1f')](_0x837265['query'][_0x8bb0('0x1f')]);_0x3ed2de[_0x8bb0('0x21')]=qs[_0x8bb0('0x21')](_0x837265[_0x8bb0('0x31')][_0x8bb0('0x21')]);}_0x3ed2de[_0x8bb0('0x38')]=qs[_0x8bb0('0x39')](_0x837265[_0x8bb0('0x31')]['sort']);_0x3ed2de[_0x8bb0('0x3a')]=qs[_0x8bb0('0x3b')](_['pick'](_0x837265[_0x8bb0('0x31')],_0x659398[_0x8bb0('0x3b')]),_0x131ca1);if(_0x837265[_0x8bb0('0x31')][_0x8bb0('0x3c')]){_0x3ed2de['where']=_[_0x8bb0('0x3d')](_0x3ed2de[_0x8bb0('0x3a')],{'$or':_['map'](_0x131ca1,function(_0x25f06e){if(_0x25f06e[_0x8bb0('0x2f')]!==_0x8bb0('0x3e')){var _0x28835f={};_0x28835f[_0x25f06e[_0x8bb0('0x2a')]]={'$like':'%'+_0x837265[_0x8bb0('0x31')][_0x8bb0('0x3c')]+'%'};return _0x28835f;}})});}_0x3ed2de=_[_0x8bb0('0x3d')]({},_0x3ed2de,_0x837265[_0x8bb0('0x3f')]);var _0xe7c51={'where':_0x3ed2de[_0x8bb0('0x3a')]};return db[_0x8bb0('0x40')][_0x8bb0('0x20')](_0xe7c51)[_0x8bb0('0x27')](function(_0x56df07){_0x5bda87[_0x8bb0('0x20')]=_0x56df07;if(_0x837265['query']['includeAll']){_0x3ed2de[_0x8bb0('0x41')]=[{'all':!![]}];}return db[_0x8bb0('0x40')][_0x8bb0('0x42')](_0x3ed2de);})[_0x8bb0('0x27')](function(_0x5392a1){_0x5bda87[_0x8bb0('0x43')]=_0x5392a1;return _0x5bda87;})[_0x8bb0('0x27')](respondWithFilteredResult(_0x2e1d1c,_0x3ed2de))['catch'](handleError(_0x2e1d1c,null));};exports[_0x8bb0('0x44')]=function(_0x4c7033,_0x448930){var _0x31e4c4={'raw':!![],'where':{'id':_0x4c7033[_0x8bb0('0x45')]['id']}},_0x3f8851={};_0x3f8851[_0x8bb0('0x30')]=_[_0x8bb0('0x32')](db['SmsQueueReport'][_0x8bb0('0x2d')]);_0x3f8851['query']=_[_0x8bb0('0x32')](_0x4c7033[_0x8bb0('0x31')]);_0x3f8851[_0x8bb0('0x3b')]=_['intersection'](_0x3f8851['model'],_0x3f8851[_0x8bb0('0x31')]);_0x31e4c4[_0x8bb0('0x35')]=_[_0x8bb0('0x33')](_0x3f8851[_0x8bb0('0x30')],qs[_0x8bb0('0x34')](_0x4c7033[_0x8bb0('0x31')][_0x8bb0('0x34')]));_0x31e4c4['attributes']=_0x31e4c4['attributes'][_0x8bb0('0x36')]?_0x31e4c4[_0x8bb0('0x35')]:_0x3f8851[_0x8bb0('0x30')];if(_0x4c7033[_0x8bb0('0x31')][_0x8bb0('0x46')]){_0x31e4c4[_0x8bb0('0x41')]=[{'all':!![]}];}_0x31e4c4=_[_0x8bb0('0x3d')]({},_0x31e4c4,_0x4c7033[_0x8bb0('0x3f')]);return db[_0x8bb0('0x40')][_0x8bb0('0x47')](_0x31e4c4)[_0x8bb0('0x27')](handleEntityNotFound(_0x448930,null))[_0x8bb0('0x27')](respondWithResult(_0x448930,null))[_0x8bb0('0x48')](handleError(_0x448930,null));};exports[_0x8bb0('0x49')]=function(_0x5cb048,_0x5828b1){return db['SmsQueueReport'][_0x8bb0('0x49')](_0x5cb048['body'],{})[_0x8bb0('0x27')](respondWithResult(_0x5828b1,0xc9))[_0x8bb0('0x48')](handleError(_0x5828b1,null));};exports[_0x8bb0('0x4a')]=function(_0x24996f,_0x56a161){if(_0x24996f[_0x8bb0('0x4b')]['id']){delete _0x24996f['body']['id'];}return db[_0x8bb0('0x40')][_0x8bb0('0x47')]({'where':{'id':_0x24996f[_0x8bb0('0x45')]['id']}})[_0x8bb0('0x27')](handleEntityNotFound(_0x56a161,null))[_0x8bb0('0x27')](saveUpdates(_0x24996f[_0x8bb0('0x4b')],null))[_0x8bb0('0x27')](respondWithResult(_0x56a161,null))[_0x8bb0('0x48')](handleError(_0x56a161,null));};exports['destroy']=function(_0x20d775,_0x6b2f2d){return db[_0x8bb0('0x40')][_0x8bb0('0x47')]({'where':{'id':_0x20d775[_0x8bb0('0x45')]['id']}})[_0x8bb0('0x27')](handleEntityNotFound(_0x6b2f2d,null))[_0x8bb0('0x27')](removeEntity(_0x6b2f2d,null))['catch'](handleError(_0x6b2f2d,null));};exports[_0x8bb0('0x4c')]=function(_0x4010db,_0x2a997b){return db[_0x8bb0('0x40')][_0x8bb0('0x4c')]()[_0x8bb0('0x27')](respondWithResult(_0x2a997b,null))[_0x8bb0('0x48')](handleError(_0x2a997b,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ef1809a..be7c515 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x5a1f39,_0x261ffd){var _0x49093a=function(_0x3e1a3a){while(--_0x3e1a3a){_0x5a1f39['push'](_0x5a1f39['shift']());}};_0x49093a(++_0x261ffd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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 +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x565cea,_0x5aa812){var _0x42e271=function(_0x2ba44b){while(--_0x2ba44b){_0x565cea['push'](_0x565cea['shift']());}};_0x42e271(++_0x5aa812);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c7d31d8..715b9d0 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 _0xa9af=['client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3e5006,_0x38060f){var _0x579370=function(_0x1ece5a){while(--_0x1ece5a){_0x3e5006['push'](_0x3e5006['shift']());}};_0x579370(++_0x38060f);}(_0xa9af,0xee));var _0xfa9a=function(_0x26e963,_0x47a5b6){_0x26e963=_0x26e963-0x0;var _0x40494e=_0xa9af[_0x26e963];return _0x40494e;};'use strict';var _=require(_0xfa9a('0x0'));var util=require(_0xfa9a('0x1'));var moment=require(_0xfa9a('0x2'));var BPromise=require(_0xfa9a('0x3'));var rs=require(_0xfa9a('0x4'));var fs=require('fs');var Redis=require(_0xfa9a('0x5'));var db=require(_0xfa9a('0x6'))['db'];var utils=require(_0xfa9a('0x7'));var logger=require('../../config/logger')(_0xfa9a('0x8'));var config=require(_0xfa9a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfa9a('0xa')][_0xfa9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10a9b0,_0x2cc0d5,_0x5b20d1){return new BPromise(function(_0x2fea66,_0x5a8628){return client[_0xfa9a('0xc')](_0x10a9b0,_0x5b20d1)[_0xfa9a('0xd')](function(_0x249d0d){logger[_0xfa9a('0xe')](_0xfa9a('0xf'),_0x2cc0d5,_0xfa9a('0x10'));logger[_0xfa9a('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2cc0d5,'request\x20sent',JSON[_0xfa9a('0x12')](_0x249d0d));if(_0x249d0d[_0xfa9a('0x13')]){if(_0x249d0d[_0xfa9a('0x13')]['code']===0x1f4){logger['error'](_0xfa9a('0xf'),_0x2cc0d5,_0x249d0d[_0xfa9a('0x13')]['message']);return _0x5a8628(_0x249d0d[_0xfa9a('0x13')][_0xfa9a('0x14')]);}logger[_0xfa9a('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x2cc0d5,_0x249d0d['error'][_0xfa9a('0x14')]);return _0x2fea66(_0x249d0d[_0xfa9a('0x13')][_0xfa9a('0x14')]);}else{logger['info'](_0xfa9a('0xf'),_0x2cc0d5,_0xfa9a('0x10'));_0x2fea66(_0x249d0d[_0xfa9a('0x15')][_0xfa9a('0x14')]);}})[_0xfa9a('0x16')](function(_0x6ae201){logger[_0xfa9a('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x2cc0d5,_0x6ae201);_0x5a8628(_0x6ae201);});});}exports['CreateSmsQueueReport']=function(_0x116ff3){var _0xde8a96=this;return new Promise(function(_0x259d5c,_0x19ad1e){return db['SmsQueueReport']['create'](_0x116ff3[_0xfa9a('0x17')],{'raw':_0x116ff3[_0xfa9a('0x18')]?_0x116ff3[_0xfa9a('0x18')][_0xfa9a('0x19')]===undefined?!![]:![]:!![]})[_0xfa9a('0xd')](function(_0x145e0d){logger[_0xfa9a('0xe')]('CreateSmsQueueReport',_0x116ff3);logger['debug'](_0xfa9a('0x1a'),_0x116ff3,JSON[_0xfa9a('0x12')](_0x145e0d));_0x259d5c(_0x145e0d);})[_0xfa9a('0x16')](function(_0x4a5751){logger[_0xfa9a('0x13')](_0xfa9a('0x1a'),_0x4a5751[_0xfa9a('0x14')],_0x116ff3);_0x19ad1e(_0xde8a96[_0xfa9a('0x13')](0x1f4,_0x4a5751[_0xfa9a('0x14')]));});});};exports[_0xfa9a('0x1b')]=function(_0x54294d){var _0x4898d1=this;return new Promise(function(_0x80e9a0,_0x4fc27e){return db[_0xfa9a('0x1c')][_0xfa9a('0x1d')](_0x54294d['body'],{'raw':_0x54294d[_0xfa9a('0x18')]?_0x54294d[_0xfa9a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54294d[_0xfa9a('0x18')]?_0x54294d[_0xfa9a('0x18')][_0xfa9a('0x1e')]||null:null,'attributes':_0x54294d[_0xfa9a('0x18')]?_0x54294d[_0xfa9a('0x18')]['attributes']||null:null,'limit':_0x54294d[_0xfa9a('0x18')]?_0x54294d['options']['limit']||null:null})['then'](function(_0x48dfb8){logger['info'](_0xfa9a('0x1b'),_0x54294d);logger[_0xfa9a('0x11')](_0xfa9a('0x1b'),_0x54294d,JSON[_0xfa9a('0x12')](_0x48dfb8));_0x80e9a0(_0x48dfb8);})[_0xfa9a('0x16')](function(_0x548a82){logger[_0xfa9a('0x13')](_0xfa9a('0x1b'),_0x548a82[_0xfa9a('0x14')],_0x54294d);_0x4fc27e(_0x4898d1['error'](0x1f4,_0x548a82[_0xfa9a('0x14')]));});});}; \ No newline at end of file +var _0x9bf8=['result','catch','SmsQueueReport','create','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','message','SmsQueueReport,\x20%s,\x20%s'];(function(_0x12aa98,_0x39916d){var _0x42935f=function(_0x37d922){while(--_0x37d922){_0x12aa98['push'](_0x12aa98['shift']());}};_0x42935f(++_0x39916d);}(_0x9bf8,0x1e2));var _0x89bf=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9bf8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x89bf('0x0'));var util=require(_0x89bf('0x1'));var moment=require(_0x89bf('0x2'));var BPromise=require(_0x89bf('0x3'));var rs=require(_0x89bf('0x4'));var fs=require('fs');var Redis=require(_0x89bf('0x5'));var db=require(_0x89bf('0x6'))['db'];var utils=require(_0x89bf('0x7'));var logger=require(_0x89bf('0x8'))(_0x89bf('0x9'));var config=require(_0x89bf('0xa'));var jayson=require(_0x89bf('0xb'));var client=jayson[_0x89bf('0xc')][_0x89bf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x52efe7,_0x320357,_0x2901da){return new BPromise(function(_0xad6bbb,_0x4290d1){return client[_0x89bf('0xe')](_0x52efe7,_0x2901da)['then'](function(_0x90241e){logger[_0x89bf('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x320357,_0x89bf('0x10'));logger[_0x89bf('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x320357,'request\x20sent',JSON[_0x89bf('0x12')](_0x90241e));if(_0x90241e['error']){if(_0x90241e[_0x89bf('0x13')]['code']===0x1f4){logger[_0x89bf('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x320357,_0x90241e[_0x89bf('0x13')]['message']);return _0x4290d1(_0x90241e[_0x89bf('0x13')][_0x89bf('0x14')]);}logger[_0x89bf('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x320357,_0x90241e['error'][_0x89bf('0x14')]);return _0xad6bbb(_0x90241e[_0x89bf('0x13')][_0x89bf('0x14')]);}else{logger['info'](_0x89bf('0x15'),_0x320357,_0x89bf('0x10'));_0xad6bbb(_0x90241e[_0x89bf('0x16')]['message']);}})[_0x89bf('0x17')](function(_0x29b253){logger[_0x89bf('0x13')](_0x89bf('0x15'),_0x320357,_0x29b253);_0x4290d1(_0x29b253);});});}exports['CreateSmsQueueReport']=function(_0x4973dd){var _0x419a71=this;return new Promise(function(_0x6986a8,_0x90f4d0){return db[_0x89bf('0x18')][_0x89bf('0x19')](_0x4973dd['body'],{'raw':_0x4973dd[_0x89bf('0x1a')]?_0x4973dd[_0x89bf('0x1a')][_0x89bf('0x1b')]===undefined?!![]:![]:!![]})[_0x89bf('0x1c')](function(_0x2eebd3){logger[_0x89bf('0xf')](_0x89bf('0x1d'),_0x4973dd);logger[_0x89bf('0x11')]('CreateSmsQueueReport',_0x4973dd,JSON[_0x89bf('0x12')](_0x2eebd3));_0x6986a8(_0x2eebd3);})['catch'](function(_0x4baeaf){logger[_0x89bf('0x13')](_0x89bf('0x1d'),_0x4baeaf[_0x89bf('0x14')],_0x4973dd);_0x90f4d0(_0x419a71[_0x89bf('0x13')](0x1f4,_0x4baeaf['message']));});});};exports[_0x89bf('0x1e')]=function(_0x4caff5){var _0x31710f=this;return new Promise(function(_0x54b2c5,_0x140418){return db[_0x89bf('0x18')][_0x89bf('0x1f')](_0x4caff5[_0x89bf('0x20')],{'raw':_0x4caff5[_0x89bf('0x1a')]?_0x4caff5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4caff5[_0x89bf('0x1a')]?_0x4caff5[_0x89bf('0x1a')][_0x89bf('0x21')]||null:null,'attributes':_0x4caff5['options']?_0x4caff5[_0x89bf('0x1a')][_0x89bf('0x22')]||null:null,'limit':_0x4caff5[_0x89bf('0x1a')]?_0x4caff5[_0x89bf('0x1a')][_0x89bf('0x23')]||null:null})['then'](function(_0x5e608d){logger[_0x89bf('0xf')](_0x89bf('0x1e'),_0x4caff5);logger[_0x89bf('0x11')]('UpdateSmsQueueReport',_0x4caff5,JSON[_0x89bf('0x12')](_0x5e608d));_0x54b2c5(_0x5e608d);})[_0x89bf('0x17')](function(_0x321b83){logger[_0x89bf('0x13')](_0x89bf('0x1e'),_0x321b83[_0x89bf('0x14')],_0x4caff5);_0x140418(_0x31710f[_0x89bf('0x13')](0x1f4,_0x321b83[_0x89bf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c5223e8..ccf51d4 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 _0xc818=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0xeb901,_0x3e292e){var _0x645bad=function(_0x46961b){while(--_0x46961b){_0xeb901['push'](_0xeb901['shift']());}};_0x645bad(++_0x3e292e);}(_0xc818,0x1e3));var _0x8c81=function(_0x17fec8,_0x76aa0b){_0x17fec8=_0x17fec8-0x0;var _0x30d9a0=_0xc818[_0x17fec8];return _0x30d9a0;};'use strict';var multer=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var path=require(_0x8c81('0x2'));var timeout=require(_0x8c81('0x3'));var express=require('express');var router=express[_0x8c81('0x4')]();var fs_extra=require(_0x8c81('0x5'));var auth=require(_0x8c81('0x6'));var interaction=require(_0x8c81('0x7'));var config=require(_0x8c81('0x8'));var controller=require(_0x8c81('0x9'));router[_0x8c81('0xa')]('/',auth['isAuthenticated'](),controller[_0x8c81('0xb')]);router[_0x8c81('0xa')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller['describe']);router[_0x8c81('0xa')](_0x8c81('0xe'),auth[_0x8c81('0xd')](),controller[_0x8c81('0xf')]);router[_0x8c81('0x10')]('/',auth[_0x8c81('0xd')](),controller[_0x8c81('0x11')]);router['put'](_0x8c81('0xe'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x12')]);router[_0x8c81('0x13')]('/:id',auth[_0x8c81('0xd')](),controller[_0x8c81('0x14')]);module[_0x8c81('0x15')]=router; \ No newline at end of file +var _0xcb81=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xcb81,0x154));var _0x1cb8=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xcb81[_0x4704dc];return _0x254d81;};'use strict';var multer=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var path=require('path');var timeout=require(_0x1cb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1cb8('0x3'));var interaction=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var controller=require(_0x1cb8('0x6'));router[_0x1cb8('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb8('0x8')]);router[_0x1cb8('0x7')]('/describe',auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xa')]);router[_0x1cb8('0x7')]('/:id',auth[_0x1cb8('0x9')](),controller['show']);router['post']('/',auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xb')]);router[_0x1cb8('0xc')](_0x1cb8('0xd'),auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xe')]);router[_0x1cb8('0xf')](_0x1cb8('0xd'),auth['isAuthenticated'](),controller[_0x1cb8('0x10')]);module[_0x1cb8('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 09ab099..f44f5c0 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x48e751,_0x18b8db){var _0x42829b=function(_0x16f31b){while(--_0x16f31b){_0x48e751['push'](_0x48e751['shift']());}};_0x42829b(++_0x18b8db);}(_0xedd9,0xfc));var _0x9edd=function(_0x21839a,_0x23a1f8){_0x21839a=_0x21839a-0x0;var _0x390574=_0xedd9[_0x21839a];return _0x390574;};'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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1d9d12,_0x2c7d98){var _0x4f680e=function(_0x4e1bbb){while(--_0x4e1bbb){_0x1d9d12['push'](_0x1d9d12['shift']());}};_0x4f680e(++_0x2c7d98);}(_0x008c,0x188));var _0xc008=function(_0x5dbb3e,_0x4b494d){_0x5dbb3e=_0x5dbb3e-0x0;var _0x138d23=_0x008c[_0x5dbb3e];return _0x138d23;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 160e0b7..f3f7bb6 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 _0xbd3c=['show','params','filters','include','options','find','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','count','includeAll','rows','catch'];(function(_0x4340e9,_0xcf25f9){var _0x28cf0d=function(_0x2759c1){while(--_0x2759c1){_0x4340e9['push'](_0x4340e9['shift']());}};_0x28cf0d(++_0xcf25f9);}(_0xbd3c,0x1b8));var _0xcbd3=function(_0x5e379b,_0xfdf4c0){_0x5e379b=_0x5e379b-0x0;var _0x5aff66=_0xbd3c[_0x5e379b];return _0x5aff66;};'use strict';var emlformat=require(_0xcbd3('0x0'));var rimraf=require(_0xcbd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcbd3('0x2'));var BPromise=require(_0xcbd3('0x3'));var Mustache=require(_0xcbd3('0x4'));var util=require(_0xcbd3('0x5'));var path=require(_0xcbd3('0x6'));var sox=require(_0xcbd3('0x7'));var csv=require(_0xcbd3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbd3('0x9'));var _=require('lodash');var squel=require(_0xcbd3('0xa'));var crypto=require('crypto');var jsforce=require(_0xcbd3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcbd3('0x8'));var querystring=require('querystring');var Papa=require(_0xcbd3('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcbd3('0xd'));var as=require(_0xcbd3('0xe'));var hardwareService=require(_0xcbd3('0xf'));var logger=require('../../config/logger')(_0xcbd3('0x10'));var utils=require(_0xcbd3('0x11'));var config=require(_0xcbd3('0x12'));var licenseUtil=require(_0xcbd3('0x13'));var db=require(_0xcbd3('0x14'))['db'];function respondWithStatusCode(_0x4b7a70,_0x36134e){_0x36134e=_0x36134e||0xcc;return function(_0x349101){if(_0x349101){return _0x4b7a70[_0xcbd3('0x15')](_0x36134e);}return _0x4b7a70['status'](_0x36134e)['end']();};}function respondWithResult(_0x33b603,_0x332c9b){_0x332c9b=_0x332c9b||0xc8;return function(_0x4ac6d6){if(_0x4ac6d6){return _0x33b603[_0xcbd3('0x16')](_0x332c9b)[_0xcbd3('0x17')](_0x4ac6d6);}};}function respondWithFilteredResult(_0x30cf92,_0x2abb86){return function(_0x18aaa3){if(_0x18aaa3){var _0x4a21e7=typeof _0x2abb86[_0xcbd3('0x18')]===_0xcbd3('0x19')&&typeof _0x2abb86[_0xcbd3('0x1a')]==='undefined';var _0x48c74c=_0x18aaa3['count'];var _0x195f46=_0x4a21e7?0x0:_0x2abb86['offset'];var _0x3dae92=_0x4a21e7?_0x18aaa3['count']:_0x2abb86[_0xcbd3('0x18')]+_0x2abb86[_0xcbd3('0x1a')];var _0x190860;if(_0x3dae92>=_0x48c74c){_0x3dae92=_0x48c74c;_0x190860=0xc8;}else{_0x190860=0xce;}_0x30cf92[_0xcbd3('0x16')](_0x190860);return _0x30cf92[_0xcbd3('0x1b')](_0xcbd3('0x1c'),_0x195f46+'-'+_0x3dae92+'/'+_0x48c74c)[_0xcbd3('0x17')](_0x18aaa3);}return null;};}function patchUpdates(_0x41c3fd){return function(_0x45e5c8){try{jsonpatch[_0xcbd3('0x1d')](_0x45e5c8,_0x41c3fd,!![]);}catch(_0x130b5e){return BPromise[_0xcbd3('0x1e')](_0x130b5e);}return _0x45e5c8[_0xcbd3('0x1f')]();};}function saveUpdates(_0x23718d,_0x28c6e5){return function(_0x3c3d5e){if(_0x3c3d5e){return _0x3c3d5e['update'](_0x23718d)[_0xcbd3('0x20')](function(_0x477daf){return _0x477daf;});}return null;};}function removeEntity(_0xe18099,_0x7f87ec){return function(_0x140ae4){if(_0x140ae4){return _0x140ae4[_0xcbd3('0x21')]()['then'](function(){_0xe18099[_0xcbd3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd328,_0x34e427){return function(_0x21367e){if(!_0x21367e){_0x2fd328[_0xcbd3('0x15')](0x194);}return _0x21367e;};}function handleError(_0x420a2a,_0x419ad3){_0x419ad3=_0x419ad3||0x1f4;return function(_0x158ede){logger[_0xcbd3('0x22')](_0x158ede[_0xcbd3('0x23')]);if(_0x158ede[_0xcbd3('0x24')]){delete _0x158ede['name'];}_0x420a2a[_0xcbd3('0x16')](_0x419ad3)[_0xcbd3('0x25')](_0x158ede);};}exports['index']=function(_0x28b829,_0x1888f3){var _0x5411df={},_0x2562ec={},_0x3a73d5={'count':0x0,'rows':[]};var _0x2a60c9=_['map'](db[_0xcbd3('0x26')][_0xcbd3('0x27')],function(_0x46278a){return{'name':_0x46278a[_0xcbd3('0x28')],'type':_0x46278a['type'][_0xcbd3('0x29')]};});_0x2562ec[_0xcbd3('0x2a')]=_['map'](_0x2a60c9,_0xcbd3('0x24'));_0x2562ec[_0xcbd3('0x2b')]=_[_0xcbd3('0x2c')](_0x28b829[_0xcbd3('0x2b')]);_0x2562ec['filters']=_[_0xcbd3('0x2d')](_0x2562ec[_0xcbd3('0x2a')],_0x2562ec[_0xcbd3('0x2b')]);_0x5411df[_0xcbd3('0x2e')]=_[_0xcbd3('0x2d')](_0x2562ec['model'],qs[_0xcbd3('0x2f')](_0x28b829['query']['fields']));_0x5411df[_0xcbd3('0x2e')]=_0x5411df[_0xcbd3('0x2e')][_0xcbd3('0x30')]?_0x5411df[_0xcbd3('0x2e')]:_0x2562ec[_0xcbd3('0x2a')];if(!_0x28b829[_0xcbd3('0x2b')][_0xcbd3('0x31')](_0xcbd3('0x32'))){_0x5411df[_0xcbd3('0x1a')]=qs[_0xcbd3('0x1a')](_0x28b829[_0xcbd3('0x2b')]['limit']);_0x5411df['offset']=qs[_0xcbd3('0x18')](_0x28b829[_0xcbd3('0x2b')]['offset']);}_0x5411df[_0xcbd3('0x33')]=qs['sort'](_0x28b829[_0xcbd3('0x2b')][_0xcbd3('0x34')]);_0x5411df[_0xcbd3('0x35')]=qs['filters'](_[_0xcbd3('0x36')](_0x28b829[_0xcbd3('0x2b')],_0x2562ec['filters']),_0x2a60c9);if(_0x28b829['query'][_0xcbd3('0x37')]){_0x5411df[_0xcbd3('0x35')]=_[_0xcbd3('0x38')](_0x5411df[_0xcbd3('0x35')],{'$or':_[_0xcbd3('0x39')](_0x2a60c9,function(_0x21e272){if(_0x21e272[_0xcbd3('0x3a')]!==_0xcbd3('0x3b')){var _0x393fd8={};_0x393fd8[_0x21e272[_0xcbd3('0x24')]]={'$like':'%'+_0x28b829[_0xcbd3('0x2b')][_0xcbd3('0x37')]+'%'};return _0x393fd8;}})});}_0x5411df=_['merge']({},_0x5411df,_0x28b829['options']);var _0x4bb5ab={'where':_0x5411df['where']};return db['SmsTransferReport'][_0xcbd3('0x3c')](_0x4bb5ab)[_0xcbd3('0x20')](function(_0x423c6b){_0x3a73d5['count']=_0x423c6b;if(_0x28b829['query'][_0xcbd3('0x3d')]){_0x5411df['include']=[{'all':!![]}];}return db[_0xcbd3('0x26')]['findAll'](_0x5411df);})[_0xcbd3('0x20')](function(_0x310bb4){_0x3a73d5[_0xcbd3('0x3e')]=_0x310bb4;return _0x3a73d5;})[_0xcbd3('0x20')](respondWithFilteredResult(_0x1888f3,_0x5411df))[_0xcbd3('0x3f')](handleError(_0x1888f3,null));};exports[_0xcbd3('0x40')]=function(_0x2952a5,_0x2c31e2){var _0x4d82f7={'raw':!![],'where':{'id':_0x2952a5[_0xcbd3('0x41')]['id']}},_0x5f2d1b={};_0x5f2d1b['model']=_[_0xcbd3('0x2c')](db[_0xcbd3('0x26')][_0xcbd3('0x27')]);_0x5f2d1b[_0xcbd3('0x2b')]=_[_0xcbd3('0x2c')](_0x2952a5[_0xcbd3('0x2b')]);_0x5f2d1b[_0xcbd3('0x42')]=_[_0xcbd3('0x2d')](_0x5f2d1b[_0xcbd3('0x2a')],_0x5f2d1b[_0xcbd3('0x2b')]);_0x4d82f7['attributes']=_[_0xcbd3('0x2d')](_0x5f2d1b['model'],qs[_0xcbd3('0x2f')](_0x2952a5[_0xcbd3('0x2b')][_0xcbd3('0x2f')]));_0x4d82f7[_0xcbd3('0x2e')]=_0x4d82f7[_0xcbd3('0x2e')][_0xcbd3('0x30')]?_0x4d82f7[_0xcbd3('0x2e')]:_0x5f2d1b[_0xcbd3('0x2a')];if(_0x2952a5[_0xcbd3('0x2b')][_0xcbd3('0x3d')]){_0x4d82f7[_0xcbd3('0x43')]=[{'all':!![]}];}_0x4d82f7=_[_0xcbd3('0x38')]({},_0x4d82f7,_0x2952a5[_0xcbd3('0x44')]);return db[_0xcbd3('0x26')][_0xcbd3('0x45')](_0x4d82f7)[_0xcbd3('0x20')](handleEntityNotFound(_0x2c31e2,null))[_0xcbd3('0x20')](respondWithResult(_0x2c31e2,null))['catch'](handleError(_0x2c31e2,null));};exports['create']=function(_0x126692,_0x1257dd){return db[_0xcbd3('0x26')]['create'](_0x126692[_0xcbd3('0x46')],{})[_0xcbd3('0x20')](respondWithResult(_0x1257dd,0xc9))[_0xcbd3('0x3f')](handleError(_0x1257dd,null));};exports['update']=function(_0x2c4a1d,_0x37c301){if(_0x2c4a1d[_0xcbd3('0x46')]['id']){delete _0x2c4a1d[_0xcbd3('0x46')]['id'];}return db[_0xcbd3('0x26')][_0xcbd3('0x45')]({'where':{'id':_0x2c4a1d['params']['id']}})[_0xcbd3('0x20')](handleEntityNotFound(_0x37c301,null))[_0xcbd3('0x20')](saveUpdates(_0x2c4a1d['body'],null))['then'](respondWithResult(_0x37c301,null))['catch'](handleError(_0x37c301,null));};exports[_0xcbd3('0x21')]=function(_0x4e29a3,_0x28c219){return db[_0xcbd3('0x26')]['find']({'where':{'id':_0x4e29a3[_0xcbd3('0x41')]['id']}})['then'](handleEntityNotFound(_0x28c219,null))['then'](removeEntity(_0x28c219,null))[_0xcbd3('0x3f')](handleError(_0x28c219,null));};exports[_0xcbd3('0x47')]=function(_0x35465f,_0x4d295a){return db[_0xcbd3('0x26')][_0xcbd3('0x47')]()[_0xcbd3('0x20')](respondWithResult(_0x4d295a,null))[_0xcbd3('0x3f')](handleError(_0x4d295a,null));}; \ No newline at end of file +var _0x342f=['length','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','index','map','rawAttributes','type','name','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','SmsTransferReport','includeAll','include','rows','catch','show','params','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x342f,0xdd));var _0xf342=function(_0xcb0117,_0x169260){_0xcb0117=_0xcb0117-0x0;var _0x3c5e05=_0x342f[_0xcb0117];return _0x3c5e05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf342('0x0'));var zipdir=require(_0xf342('0x1'));var jsonpatch=require(_0xf342('0x2'));var rp=require('request-promise');var moment=require(_0xf342('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf342('0x4'));var util=require('util');var path=require(_0xf342('0x5'));var sox=require(_0xf342('0x6'));var csv=require(_0xf342('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf342('0x8'));var _=require('lodash');var squel=require(_0xf342('0x9'));var crypto=require(_0xf342('0xa'));var jsforce=require(_0xf342('0xb'));var deskjs=require(_0xf342('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf342('0xd'));var Papa=require(_0xf342('0xe'));var Redis=require(_0xf342('0xf'));var authService=require(_0xf342('0x10'));var qs=require(_0xf342('0x11'));var as=require(_0xf342('0x12'));var hardwareService=require(_0xf342('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf342('0x14'));var config=require(_0xf342('0x15'));var licenseUtil=require(_0xf342('0x16'));var db=require(_0xf342('0x17'))['db'];function respondWithStatusCode(_0x548869,_0x94446e){_0x94446e=_0x94446e||0xcc;return function(_0x2edb91){if(_0x2edb91){return _0x548869[_0xf342('0x18')](_0x94446e);}return _0x548869['status'](_0x94446e)['end']();};}function respondWithResult(_0x2c46aa,_0x12b44c){_0x12b44c=_0x12b44c||0xc8;return function(_0x3c30dd){if(_0x3c30dd){return _0x2c46aa['status'](_0x12b44c)[_0xf342('0x19')](_0x3c30dd);}};}function respondWithFilteredResult(_0x1dd8e9,_0x30551e){return function(_0x12f876){if(_0x12f876){var _0x285cce=typeof _0x30551e[_0xf342('0x1a')]===_0xf342('0x1b')&&typeof _0x30551e[_0xf342('0x1c')]===_0xf342('0x1b');var _0x349842=_0x12f876[_0xf342('0x1d')];var _0x53edc9=_0x285cce?0x0:_0x30551e[_0xf342('0x1a')];var _0x510036=_0x285cce?_0x12f876[_0xf342('0x1d')]:_0x30551e[_0xf342('0x1a')]+_0x30551e[_0xf342('0x1c')];var _0x4ea9ca;if(_0x510036>=_0x349842){_0x510036=_0x349842;_0x4ea9ca=0xc8;}else{_0x4ea9ca=0xce;}_0x1dd8e9[_0xf342('0x1e')](_0x4ea9ca);return _0x1dd8e9[_0xf342('0x1f')](_0xf342('0x20'),_0x53edc9+'-'+_0x510036+'/'+_0x349842)['json'](_0x12f876);}return null;};}function patchUpdates(_0x3e050d){return function(_0x6c828e){try{jsonpatch[_0xf342('0x21')](_0x6c828e,_0x3e050d,!![]);}catch(_0x5e82d9){return BPromise[_0xf342('0x22')](_0x5e82d9);}return _0x6c828e[_0xf342('0x23')]();};}function saveUpdates(_0x10645b,_0x3e2b9e){return function(_0x3c7965){if(_0x3c7965){return _0x3c7965[_0xf342('0x24')](_0x10645b)[_0xf342('0x25')](function(_0x1c6570){return _0x1c6570;});}return null;};}function removeEntity(_0x8a7a8,_0x24eb53){return function(_0x5d95a0){if(_0x5d95a0){return _0x5d95a0[_0xf342('0x26')]()[_0xf342('0x25')](function(){_0x8a7a8['status'](0xcc)[_0xf342('0x27')]();});}};}function handleEntityNotFound(_0x5642e0,_0x2c5296){return function(_0x2b2235){if(!_0x2b2235){_0x5642e0['sendStatus'](0x194);}return _0x2b2235;};}function handleError(_0x2d7950,_0x56d8ee){_0x56d8ee=_0x56d8ee||0x1f4;return function(_0x580fc0){logger[_0xf342('0x28')](_0x580fc0['stack']);if(_0x580fc0['name']){delete _0x580fc0['name'];}_0x2d7950[_0xf342('0x1e')](_0x56d8ee)['send'](_0x580fc0);};}exports[_0xf342('0x29')]=function(_0x57efbf,_0x5718a8){var _0x3eb691={},_0x5579d5={},_0x2f3d71={'count':0x0,'rows':[]};var _0x2c91a1=_[_0xf342('0x2a')](db['SmsTransferReport'][_0xf342('0x2b')],function(_0x10342a){return{'name':_0x10342a['fieldName'],'type':_0x10342a[_0xf342('0x2c')]['key']};});_0x5579d5['model']=_['map'](_0x2c91a1,_0xf342('0x2d'));_0x5579d5['query']=_['keys'](_0x57efbf[_0xf342('0x2e')]);_0x5579d5[_0xf342('0x2f')]=_[_0xf342('0x30')](_0x5579d5[_0xf342('0x31')],_0x5579d5[_0xf342('0x2e')]);_0x3eb691[_0xf342('0x32')]=_[_0xf342('0x30')](_0x5579d5[_0xf342('0x31')],qs[_0xf342('0x33')](_0x57efbf['query']['fields']));_0x3eb691[_0xf342('0x32')]=_0x3eb691['attributes']['length']?_0x3eb691['attributes']:_0x5579d5[_0xf342('0x31')];if(!_0x57efbf[_0xf342('0x2e')]['hasOwnProperty'](_0xf342('0x34'))){_0x3eb691[_0xf342('0x1c')]=qs[_0xf342('0x1c')](_0x57efbf[_0xf342('0x2e')][_0xf342('0x1c')]);_0x3eb691[_0xf342('0x1a')]=qs['offset'](_0x57efbf[_0xf342('0x2e')]['offset']);}_0x3eb691[_0xf342('0x35')]=qs[_0xf342('0x36')](_0x57efbf['query'][_0xf342('0x36')]);_0x3eb691[_0xf342('0x37')]=qs[_0xf342('0x2f')](_[_0xf342('0x38')](_0x57efbf[_0xf342('0x2e')],_0x5579d5[_0xf342('0x2f')]),_0x2c91a1);if(_0x57efbf[_0xf342('0x2e')][_0xf342('0x39')]){_0x3eb691[_0xf342('0x37')]=_[_0xf342('0x3a')](_0x3eb691[_0xf342('0x37')],{'$or':_[_0xf342('0x2a')](_0x2c91a1,function(_0x512143){if(_0x512143[_0xf342('0x2c')]!=='VIRTUAL'){var _0x2ba772={};_0x2ba772[_0x512143[_0xf342('0x2d')]]={'$like':'%'+_0x57efbf[_0xf342('0x2e')]['filter']+'%'};return _0x2ba772;}})});}_0x3eb691=_['merge']({},_0x3eb691,_0x57efbf['options']);var _0xf20bea={'where':_0x3eb691['where']};return db[_0xf342('0x3b')]['count'](_0xf20bea)[_0xf342('0x25')](function(_0x2d287d){_0x2f3d71[_0xf342('0x1d')]=_0x2d287d;if(_0x57efbf['query'][_0xf342('0x3c')]){_0x3eb691[_0xf342('0x3d')]=[{'all':!![]}];}return db[_0xf342('0x3b')]['findAll'](_0x3eb691);})[_0xf342('0x25')](function(_0xba2ac6){_0x2f3d71[_0xf342('0x3e')]=_0xba2ac6;return _0x2f3d71;})[_0xf342('0x25')](respondWithFilteredResult(_0x5718a8,_0x3eb691))[_0xf342('0x3f')](handleError(_0x5718a8,null));};exports[_0xf342('0x40')]=function(_0x259e7b,_0x3045bf){var _0x5fc95c={'raw':!![],'where':{'id':_0x259e7b[_0xf342('0x41')]['id']}},_0x58de07={};_0x58de07['model']=_[_0xf342('0x42')](db[_0xf342('0x3b')][_0xf342('0x2b')]);_0x58de07[_0xf342('0x2e')]=_[_0xf342('0x42')](_0x259e7b[_0xf342('0x2e')]);_0x58de07[_0xf342('0x2f')]=_[_0xf342('0x30')](_0x58de07[_0xf342('0x31')],_0x58de07['query']);_0x5fc95c[_0xf342('0x32')]=_['intersection'](_0x58de07[_0xf342('0x31')],qs[_0xf342('0x33')](_0x259e7b[_0xf342('0x2e')][_0xf342('0x33')]));_0x5fc95c[_0xf342('0x32')]=_0x5fc95c[_0xf342('0x32')][_0xf342('0x43')]?_0x5fc95c[_0xf342('0x32')]:_0x58de07['model'];if(_0x259e7b[_0xf342('0x2e')][_0xf342('0x3c')]){_0x5fc95c['include']=[{'all':!![]}];}_0x5fc95c=_[_0xf342('0x3a')]({},_0x5fc95c,_0x259e7b['options']);return db[_0xf342('0x3b')]['find'](_0x5fc95c)['then'](handleEntityNotFound(_0x3045bf,null))['then'](respondWithResult(_0x3045bf,null))['catch'](handleError(_0x3045bf,null));};exports['create']=function(_0x4b4be,_0x22e5dc){return db[_0xf342('0x3b')][_0xf342('0x44')](_0x4b4be[_0xf342('0x45')],{})[_0xf342('0x25')](respondWithResult(_0x22e5dc,0xc9))[_0xf342('0x3f')](handleError(_0x22e5dc,null));};exports[_0xf342('0x24')]=function(_0x56f633,_0x14af45){if(_0x56f633[_0xf342('0x45')]['id']){delete _0x56f633['body']['id'];}return db[_0xf342('0x3b')][_0xf342('0x46')]({'where':{'id':_0x56f633[_0xf342('0x41')]['id']}})['then'](handleEntityNotFound(_0x14af45,null))[_0xf342('0x25')](saveUpdates(_0x56f633[_0xf342('0x45')],null))[_0xf342('0x25')](respondWithResult(_0x14af45,null))[_0xf342('0x3f')](handleError(_0x14af45,null));};exports[_0xf342('0x26')]=function(_0x55d320,_0x4272ff){return db['SmsTransferReport'][_0xf342('0x46')]({'where':{'id':_0x55d320[_0xf342('0x41')]['id']}})['then'](handleEntityNotFound(_0x4272ff,null))['then'](removeEntity(_0x4272ff,null))[_0xf342('0x3f')](handleError(_0x4272ff,null));};exports[_0xf342('0x47')]=function(_0x11baa9,_0x42291f){return db[_0xf342('0x3b')]['describe']()['then'](respondWithResult(_0x42291f,null))[_0xf342('0x3f')](handleError(_0x42291f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 70132f4..53ab463 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 _0x09b0=['define','SmsTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x57e73c,_0x256531){var _0xd298b3=function(_0x20e22e){while(--_0x20e22e){_0x57e73c['push'](_0x57e73c['shift']());}};_0xd298b3(++_0x256531);}(_0x09b0,0xed));var _0x009b=function(_0x43033b,_0x37a281){_0x43033b=_0x43033b-0x0;var _0x246100=_0x09b0[_0x43033b];return _0x246100;};'use strict';var _=require('lodash');var util=require(_0x009b('0x0'));var logger=require(_0x009b('0x1'))(_0x009b('0x2'));var moment=require(_0x009b('0x3'));var BPromise=require(_0x009b('0x4'));var rp=require(_0x009b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x009b('0x6'));var config=require(_0x009b('0x7'));var attributes=require(_0x009b('0x8'));module[_0x009b('0x9')]=function(_0x51f681,_0x39d9ec){return _0x51f681[_0x009b('0xa')](_0x009b('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x009b('0xc'),'fields':[_0x009b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb78f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xb78f,0x134));var _0xfb78=function(_0x359956,_0x45292d){_0x359956=_0x359956-0x0;var _0x3921cf=_0xb78f[_0x359956];return _0x3921cf;};'use strict';var _=require(_0xfb78('0x0'));var util=require(_0xfb78('0x1'));var logger=require(_0xfb78('0x2'))(_0xfb78('0x3'));var moment=require(_0xfb78('0x4'));var BPromise=require(_0xfb78('0x5'));var rp=require(_0xfb78('0x6'));var fs=require('fs');var path=require(_0xfb78('0x7'));var rimraf=require('rimraf');var config=require(_0xfb78('0x8'));var attributes=require(_0xfb78('0x9'));module[_0xfb78('0xa')]=function(_0x5e965c,_0x77615d){return _0x5e965c[_0xfb78('0xb')](_0xfb78('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xfb78('0xd'),'fields':[_0xfb78('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e87d407..9643cad 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 _0xfd7b=['SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xfd7b[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x4ec9f9,_0x4751e8){var _0x13b41f=function(_0x43f635){while(--_0x43f635){_0x4ec9f9['push'](_0x4ec9f9['shift']());}};_0x13b41f(++_0x4751e8);}(_0x3e74,0x175));var _0x43e7=function(_0x51f047,_0x1dd144){_0x51f047=_0x51f047-0x0;var _0x1843ac=_0x3e74[_0x51f047];return _0x1843ac;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3d3ddeb..e2b2f03 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 _0xe307=['%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','originalname','format'];(function(_0x6fb2ac,_0x3b0592){var _0x5c7ab2=function(_0x1d1ed1){while(--_0x1d1ed1){_0x6fb2ac['push'](_0x6fb2ac['shift']());}};_0x5c7ab2(++_0x3b0592);}(_0xe307,0x6f));var _0x7e30=function(_0x29867e,_0x3c990d){_0x29867e=_0x29867e-0x0;var _0x8ba3b7=_0xe307[_0x29867e];return _0x8ba3b7;};'use strict';var multer=require(_0x7e30('0x0'));var util=require(_0x7e30('0x1'));var path=require(_0x7e30('0x2'));var timeout=require(_0x7e30('0x3'));var express=require(_0x7e30('0x4'));var router=express[_0x7e30('0x5')]();var fs_extra=require(_0x7e30('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7e30('0x7'));var config=require(_0x7e30('0x8'));var controller=require(_0x7e30('0x9'));router[_0x7e30('0xa')]('/',auth[_0x7e30('0xb')](),controller['index']);router[_0x7e30('0xa')](_0x7e30('0xc'),auth['isAuthenticated'](),controller[_0x7e30('0xd')]);router[_0x7e30('0xa')](_0x7e30('0xe'),auth[_0x7e30('0xb')](),controller[_0x7e30('0xf')]);var upload=multer({'storage':multer[_0x7e30('0x10')]({'destination':function(_0x1daa2c,_0x5b8493,_0x20e381){_0x20e381(null,path[_0x7e30('0x11')](config[_0x7e30('0x12')],'server/files/sounds/original/'));},'filename':function(_0x1ce981,_0x4151dc,_0xfd3fe3){_0x4151dc[_0x7e30('0x13')]=_0x4151dc[_0x7e30('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xfd3fe3(null,util[_0x7e30('0x14')](_0x7e30('0x15'),path[_0x7e30('0x16')](_0x4151dc[_0x7e30('0x13')],path[_0x7e30('0x17')](_0x4151dc['originalname'])),Date[_0x7e30('0x18')](),path['extname'](_0x4151dc[_0x7e30('0x13')])));}})});router[_0x7e30('0x19')]('/',upload[_0x7e30('0x1a')](_0x7e30('0x1b')),controller[_0x7e30('0x1c')]);router[_0x7e30('0x1d')](_0x7e30('0xc'),auth[_0x7e30('0xb')](),controller[_0x7e30('0x1e')]);router[_0x7e30('0x1f')](_0x7e30('0xc'),auth['isAuthenticated'](),controller[_0x7e30('0x1f')]);module[_0x7e30('0x20')]=router; \ No newline at end of file +var _0x6c00=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','delete','exports','multer','util','path'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0x6c00,0x102));var _0x06c0=function(_0x1c88f9,_0x211646){_0x1c88f9=_0x1c88f9-0x0;var _0x1779f7=_0x6c00[_0x1c88f9];return _0x1779f7;};'use strict';var multer=require(_0x06c0('0x0'));var util=require(_0x06c0('0x1'));var path=require(_0x06c0('0x2'));var timeout=require(_0x06c0('0x3'));var express=require(_0x06c0('0x4'));var router=express[_0x06c0('0x5')]();var fs_extra=require(_0x06c0('0x6'));var auth=require(_0x06c0('0x7'));var interaction=require(_0x06c0('0x8'));var config=require(_0x06c0('0x9'));var controller=require(_0x06c0('0xa'));router[_0x06c0('0xb')]('/',auth[_0x06c0('0xc')](),controller['index']);router['get'](_0x06c0('0xd'),auth['isAuthenticated'](),controller[_0x06c0('0xe')]);router[_0x06c0('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x06c0('0xf')]);var upload=multer({'storage':multer[_0x06c0('0x10')]({'destination':function(_0xf2d44f,_0x1ae37c,_0x275da3){_0x275da3(null,path['join'](config[_0x06c0('0x11')],'server/files/sounds/original/'));},'filename':function(_0x476889,_0x3e85cf,_0x42fe74){_0x3e85cf[_0x06c0('0x12')]=_0x3e85cf[_0x06c0('0x12')][_0x06c0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42fe74(null,util[_0x06c0('0x14')](_0x06c0('0x15'),path[_0x06c0('0x16')](_0x3e85cf[_0x06c0('0x12')],path[_0x06c0('0x17')](_0x3e85cf[_0x06c0('0x12')])),Date['now'](),path[_0x06c0('0x17')](_0x3e85cf[_0x06c0('0x12')])));}})});router[_0x06c0('0x18')]('/',upload[_0x06c0('0x19')](_0x06c0('0x1a')),controller['create']);router['put'](_0x06c0('0xd'),auth[_0x06c0('0xc')](),controller['update']);router[_0x06c0('0x1b')](_0x06c0('0xd'),auth[_0x06c0('0xc')](),controller[_0x06c0('0x1b')]);module[_0x06c0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 13bb92d..5b92559 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 _0x7fe2=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x46b838,_0x2fea63){var _0x218789=function(_0x338370){while(--_0x338370){_0x46b838['push'](_0x46b838['shift']());}};_0x218789(++_0x2fea63);}(_0x7fe2,0x82));var _0x27fe=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x7fe2[_0x3a0c4f];return _0x247049;};'use strict';var Sequelize=require(_0x27fe('0x0'));module[_0x27fe('0x1')]={'name':{'type':Sequelize[_0x27fe('0x2')],'unique':_0x27fe('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x27fe('0x2')]},'display_name':{'type':Sequelize[_0x27fe('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x27fe('0x4')]},'original_sampleCount':{'type':Sequelize[_0x27fe('0x5')]},'original_channelCount':{'type':Sequelize[_0x27fe('0x6')]},'original_bitRate':{'type':Sequelize[_0x27fe('0x5')]},'original_sampleRate':{'type':Sequelize[_0x27fe('0x6')]},'converted_format':{'type':Sequelize[_0x27fe('0x2')]},'converted_duration':{'type':Sequelize[_0x27fe('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x27fe('0x5')]},'converted_channelCount':{'type':Sequelize[_0x27fe('0x6')]},'converted_bitRate':{'type':Sequelize[_0x27fe('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x27fe('0x6')]}}; \ No newline at end of file +var _0xb7e1=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x48df90,_0x1c443e){var _0x29ed1f=function(_0x4f7728){while(--_0x4f7728){_0x48df90['push'](_0x48df90['shift']());}};_0x29ed1f(++_0x1c443e);}(_0xb7e1,0x96));var _0x1b7e=function(_0x4c6eb0,_0x3301b0){_0x4c6eb0=_0x4c6eb0-0x0;var _0x417e51=_0xb7e1[_0x4c6eb0];return _0x417e51;};'use strict';var Sequelize=require(_0x1b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b7e('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x1b7e('0x1')]},'display_name':{'type':Sequelize[_0x1b7e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1b7e('0x1')]},'original_format':{'type':Sequelize[_0x1b7e('0x1')]},'original_duration':{'type':Sequelize[_0x1b7e('0x2')]},'original_sampleCount':{'type':Sequelize[_0x1b7e('0x3')]},'original_channelCount':{'type':Sequelize[_0x1b7e('0x4')]},'original_bitRate':{'type':Sequelize[_0x1b7e('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x1b7e('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1b7e('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x1b7e('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1193b5f..7068651 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 _0x26f7=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','update','then','get','Sounds','UserProfileResource','destroy','stack','name','index','map','Sound','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','options','download','find','save_name','existsSync','join','Sequelize','ValidationError','Sound\x20not\x20found','root','server/files/sounds/converted','format','%s.%s','converted_format','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','send','src','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','body','userProfileId','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','description','delete','original_format','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x405f31,_0x50fe60){var _0x36e095=function(_0x57e2e4){while(--_0x57e2e4){_0x405f31['push'](_0x405f31['shift']());}};_0x36e095(++_0x50fe60);}(_0x26f7,0xe7));var _0x726f=function(_0x45e9e2,_0x3e14c1){_0x45e9e2=_0x45e9e2-0x0;var _0x3253d9=_0x26f7[_0x45e9e2];return _0x3253d9;};'use strict';var emlformat=require(_0x726f('0x0'));var rimraf=require(_0x726f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x726f('0x2'));var moment=require('moment');var BPromise=require(_0x726f('0x3'));var Mustache=require(_0x726f('0x4'));var util=require(_0x726f('0x5'));var path=require(_0x726f('0x6'));var sox=require(_0x726f('0x7'));var csv=require(_0x726f('0x8'));var ejs=require(_0x726f('0x9'));var fs=require('fs');var fs_extra=require(_0x726f('0xa'));var _=require('lodash');var squel=require(_0x726f('0xb'));var crypto=require(_0x726f('0xc'));var jsforce=require(_0x726f('0xd'));var deskjs=require(_0x726f('0xe'));var toCsv=require(_0x726f('0x8'));var querystring=require(_0x726f('0xf'));var Papa=require(_0x726f('0x10'));var Redis=require(_0x726f('0x11'));var authService=require(_0x726f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x726f('0x13'));var hardwareService=require(_0x726f('0x14'));var logger=require(_0x726f('0x15'))(_0x726f('0x16'));var utils=require(_0x726f('0x17'));var config=require(_0x726f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x726f('0x19'))['db'];function respondWithStatusCode(_0x108c57,_0x98bb39){_0x98bb39=_0x98bb39||0xcc;return function(_0x2326af){if(_0x2326af){return _0x108c57[_0x726f('0x1a')](_0x98bb39);}return _0x108c57[_0x726f('0x1b')](_0x98bb39)[_0x726f('0x1c')]();};}function respondWithResult(_0x1bc2cb,_0x43dfd1){_0x43dfd1=_0x43dfd1||0xc8;return function(_0xbbf27){if(_0xbbf27){return _0x1bc2cb[_0x726f('0x1b')](_0x43dfd1)[_0x726f('0x1d')](_0xbbf27);}};}function respondWithFilteredResult(_0x32dd5e,_0x4916bc){return function(_0x364815){if(_0x364815){var _0x5218d5=typeof _0x4916bc[_0x726f('0x1e')]===_0x726f('0x1f')&&typeof _0x4916bc['limit']===_0x726f('0x1f');var _0x2508fd=_0x364815[_0x726f('0x20')];var _0x2adf5c=_0x5218d5?0x0:_0x4916bc[_0x726f('0x1e')];var _0x57f03c=_0x5218d5?_0x364815[_0x726f('0x20')]:_0x4916bc[_0x726f('0x1e')]+_0x4916bc[_0x726f('0x21')];var _0x4ee30c;if(_0x57f03c>=_0x2508fd){_0x57f03c=_0x2508fd;_0x4ee30c=0xc8;}else{_0x4ee30c=0xce;}_0x32dd5e[_0x726f('0x1b')](_0x4ee30c);return _0x32dd5e['set']('Content-Range',_0x2adf5c+'-'+_0x57f03c+'/'+_0x2508fd)[_0x726f('0x1d')](_0x364815);}return null;};}function patchUpdates(_0x530d5e){return function(_0x178322){try{jsonpatch['apply'](_0x178322,_0x530d5e,!![]);}catch(_0x17af6d){return BPromise[_0x726f('0x22')](_0x17af6d);}return _0x178322['save']();};}function saveUpdates(_0x1fb909,_0x2bba65){return function(_0x3db3d9){if(_0x3db3d9){return _0x3db3d9[_0x726f('0x23')](_0x1fb909)['then'](function(_0x379b8e){return _0x379b8e;});}return null;};}function removeEntity(_0x18b13d,_0x59d206){return function(_0x5b9896){if(_0x5b9896){return _0x5b9896['destroy']()[_0x726f('0x24')](function(){var _0x1b795a=_0x5b9896[_0x726f('0x25')]({'plain':!![]});var _0x2a34c5=_0x726f('0x26');return db[_0x726f('0x27')][_0x726f('0x28')]({'where':{'type':_0x2a34c5,'resourceId':_0x1b795a['id']}})[_0x726f('0x24')](function(){return _0x5b9896;});})[_0x726f('0x24')](function(){_0x18b13d[_0x726f('0x1b')](0xcc)[_0x726f('0x1c')]();});}};}function handleEntityNotFound(_0x59f7d1,_0x25ea63){return function(_0x562692){if(!_0x562692){_0x59f7d1['sendStatus'](0x194);}return _0x562692;};}function handleError(_0x357b34,_0x33ffd5){_0x33ffd5=_0x33ffd5||0x1f4;return function(_0x4997d6){logger['error'](_0x4997d6[_0x726f('0x29')]);if(_0x4997d6['name']){delete _0x4997d6[_0x726f('0x2a')];}_0x357b34[_0x726f('0x1b')](_0x33ffd5)['send'](_0x4997d6);};}exports[_0x726f('0x2b')]=function(_0x4d55ba,_0xabfaba){var _0x35666c={},_0x59e237={},_0x5dc47d={'count':0x0,'rows':[]};var _0x406f6e=_[_0x726f('0x2c')](db[_0x726f('0x2d')][_0x726f('0x2e')],function(_0x26529b){return{'name':_0x26529b[_0x726f('0x2f')],'type':_0x26529b[_0x726f('0x30')]['key']};});_0x59e237['model']=_[_0x726f('0x2c')](_0x406f6e,_0x726f('0x2a'));_0x59e237[_0x726f('0x31')]=_[_0x726f('0x32')](_0x4d55ba[_0x726f('0x31')]);_0x59e237[_0x726f('0x33')]=_['intersection'](_0x59e237['model'],_0x59e237['query']);_0x35666c[_0x726f('0x34')]=_[_0x726f('0x35')](_0x59e237['model'],qs[_0x726f('0x36')](_0x4d55ba[_0x726f('0x31')]['fields']));_0x35666c[_0x726f('0x34')]=_0x35666c[_0x726f('0x34')][_0x726f('0x37')]?_0x35666c[_0x726f('0x34')]:_0x59e237[_0x726f('0x38')];if(!_0x4d55ba[_0x726f('0x31')][_0x726f('0x39')](_0x726f('0x3a'))){_0x35666c[_0x726f('0x21')]=qs[_0x726f('0x21')](_0x4d55ba[_0x726f('0x31')][_0x726f('0x21')]);_0x35666c['offset']=qs[_0x726f('0x1e')](_0x4d55ba[_0x726f('0x31')][_0x726f('0x1e')]);}_0x35666c[_0x726f('0x3b')]=qs[_0x726f('0x3c')](_0x4d55ba[_0x726f('0x31')][_0x726f('0x3c')]);_0x35666c[_0x726f('0x3d')]=qs['filters'](_[_0x726f('0x3e')](_0x4d55ba['query'],_0x59e237['filters']),_0x406f6e);if(_0x4d55ba[_0x726f('0x31')][_0x726f('0x3f')]){_0x35666c[_0x726f('0x3d')]=_['merge'](_0x35666c[_0x726f('0x3d')],{'$or':_[_0x726f('0x2c')](_0x406f6e,function(_0x4f5f22){if(_0x4f5f22[_0x726f('0x30')]!==_0x726f('0x40')){var _0x2b0467={};_0x2b0467[_0x4f5f22[_0x726f('0x2a')]]={'$like':'%'+_0x4d55ba[_0x726f('0x31')]['filter']+'%'};return _0x2b0467;}})});}_0x35666c=_[_0x726f('0x41')]({},_0x35666c,_0x4d55ba['options']);var _0x7012ca={'where':_0x35666c['where']};return db[_0x726f('0x2d')][_0x726f('0x20')](_0x7012ca)[_0x726f('0x24')](function(_0x4ee1bc){_0x5dc47d[_0x726f('0x20')]=_0x4ee1bc;if(_0x4d55ba['query'][_0x726f('0x42')]){_0x35666c[_0x726f('0x43')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x35666c);})['then'](function(_0x1cfde6){_0x5dc47d[_0x726f('0x44')]=_0x1cfde6;return _0x5dc47d;})[_0x726f('0x24')](respondWithFilteredResult(_0xabfaba,_0x35666c))[_0x726f('0x45')](handleError(_0xabfaba,null));};exports[_0x726f('0x46')]=function(_0x18c1b7,_0x3ea9d4){var _0x4a8f5a={'raw':!![],'where':{'id':_0x18c1b7['params']['id']}},_0x52ff1c={};_0x52ff1c[_0x726f('0x38')]=_[_0x726f('0x32')](db[_0x726f('0x2d')][_0x726f('0x2e')]);_0x52ff1c[_0x726f('0x31')]=_[_0x726f('0x32')](_0x18c1b7[_0x726f('0x31')]);_0x52ff1c[_0x726f('0x33')]=_['intersection'](_0x52ff1c['model'],_0x52ff1c[_0x726f('0x31')]);_0x4a8f5a[_0x726f('0x34')]=_[_0x726f('0x35')](_0x52ff1c[_0x726f('0x38')],qs[_0x726f('0x36')](_0x18c1b7[_0x726f('0x31')][_0x726f('0x36')]));_0x4a8f5a['attributes']=_0x4a8f5a[_0x726f('0x34')][_0x726f('0x37')]?_0x4a8f5a[_0x726f('0x34')]:_0x52ff1c[_0x726f('0x38')];if(_0x18c1b7[_0x726f('0x31')]['includeAll']){_0x4a8f5a[_0x726f('0x43')]=[{'all':!![]}];}_0x4a8f5a=_[_0x726f('0x41')]({},_0x4a8f5a,_0x18c1b7[_0x726f('0x47')]);return db[_0x726f('0x2d')]['find'](_0x4a8f5a)['then'](handleEntityNotFound(_0x3ea9d4,null))[_0x726f('0x24')](respondWithResult(_0x3ea9d4,null))[_0x726f('0x45')](handleError(_0x3ea9d4,null));};exports[_0x726f('0x48')]=function(_0x55ec98,_0x39f3cf,_0x5d013a){return db[_0x726f('0x2d')][_0x726f('0x49')]({'where':{'id':_0x55ec98['params']['id']},'attributes':[_0x726f('0x2a'),_0x726f('0x4a'),'converted_format'],'raw':!![]})[_0x726f('0x24')](handleEntityNotFound(_0x39f3cf,null))['then'](function(_0x8227c8){if(_0x8227c8){if(!fs[_0x726f('0x4b')](path[_0x726f('0x4c')](config['root'],'server/files/sounds/converted',_0x8227c8[_0x726f('0x4a')]+'.'+_0x8227c8['converted_format']))){throw new db[(_0x726f('0x4d'))][(_0x726f('0x4e'))](_0x726f('0x4f'));}return _0x39f3cf[_0x726f('0x48')](path[_0x726f('0x4c')](config[_0x726f('0x50')],_0x726f('0x51'),util[_0x726f('0x52')](_0x726f('0x53'),_0x8227c8[_0x726f('0x4a')],_0x8227c8[_0x726f('0x54')])),util[_0x726f('0x52')](_0x726f('0x53'),_0x8227c8[_0x726f('0x2a')],_0x8227c8[_0x726f('0x54')]));}return null;})[_0x726f('0x45')](handleError(_0x39f3cf,null));};exports[_0x726f('0x55')]=function(_0x4642fa,_0x4c4a1d,_0x52aa1d){var _0x335129={'name':path[_0x726f('0x56')](_0x4642fa[_0x726f('0x57')]['originalname'],path[_0x726f('0x58')](_0x4642fa['file'][_0x726f('0x59')])),'save_name':path['basename'](_0x4642fa[_0x726f('0x57')][_0x726f('0x5a')],path['extname'](_0x4642fa[_0x726f('0x57')][_0x726f('0x5a')])),'original_format':path[_0x726f('0x58')](_0x4642fa[_0x726f('0x57')][_0x726f('0x59')])[_0x726f('0x5b')](0x1),'converted_format':_0x726f('0x5c')};var _0xb285b3=path[_0x726f('0x4c')](config[_0x726f('0x50')],_0x726f('0x5d'),_0x4642fa[_0x726f('0x57')][_0x726f('0x5a')]);var _0x509699=path['join'](config['root'],_0x726f('0x51'),util[_0x726f('0x52')](_0x726f('0x53'),path[_0x726f('0x56')](_0x4642fa['file']['filename'],path[_0x726f('0x58')](_0x4642fa[_0x726f('0x57')][_0x726f('0x5a')])),_0x335129[_0x726f('0x54')]));logger[_0x726f('0x5e')](_0x726f('0x5f'),_0xb285b3);logger[_0x726f('0x5e')](_0x726f('0x60'),_0x509699);try{fs[_0x726f('0x61')](_0xb285b3,parseInt(_0x726f('0x62'),0x8));var _0x22ab3a=sox[_0x726f('0x63')](_0xb285b3,_0x509699,{'sampleRate':0x1f40,'format':_0x726f('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x22ab3a['on'](_0x726f('0x64'),function(_0x1d1c16){fs[_0x726f('0x65')](_0xb285b3);_0x4c4a1d[_0x726f('0x1b')](0x1f4)[_0x726f('0x66')](_0x1d1c16);});_0x22ab3a['on'](_0x726f('0x67'),function(_0x1db6a7){_0x335129['original_duration']=isNaN(_0x1db6a7[_0x726f('0x68')])?null:_0x1db6a7['duration']*0x3e8;_0x335129['original_sampleCount']=isNaN(_0x1db6a7[_0x726f('0x69')])?null:_0x1db6a7[_0x726f('0x69')];_0x335129['original_channelCount']=isNaN(_0x1db6a7['channelCount'])?null:_0x1db6a7[_0x726f('0x6a')];_0x335129[_0x726f('0x6b')]=isNaN(_0x1db6a7[_0x726f('0x6c')])?null:_0x1db6a7[_0x726f('0x6c')];_0x335129[_0x726f('0x6d')]=isNaN(_0x1db6a7[_0x726f('0x6e')])?null:_0x1db6a7[_0x726f('0x6e')];});_0x22ab3a['on'](_0x726f('0x6f'),function(_0x2c4714){_0x335129[_0x726f('0x70')]=isNaN(_0x2c4714[_0x726f('0x68')])?null:_0x2c4714['duration']*0x3e8;_0x335129['converted_sampleCount']=isNaN(_0x2c4714['sampleCount'])?null:_0x2c4714[_0x726f('0x69')];_0x335129['converted_channelCount']=isNaN(_0x2c4714[_0x726f('0x6a')])?null:_0x2c4714[_0x726f('0x6a')];_0x335129[_0x726f('0x71')]=isNaN(_0x2c4714[_0x726f('0x6c')])?null:_0x2c4714[_0x726f('0x6c')];_0x335129['converted_sampleRate']=isNaN(_0x2c4714[_0x726f('0x6e')])?null:_0x2c4714[_0x726f('0x6e')];});_0x22ab3a['on'](_0x726f('0x1c'),function(){fs[_0x726f('0x61')](_0x509699,parseInt(_0x726f('0x62'),0x8));return db['Sound'][_0x726f('0x55')](_0x335129)[_0x726f('0x24')](function(_0x22c444){var _0x1e48f6={'role':_0x4642fa[_0x726f('0x72')]['role'],'userProfileId':_0x4642fa['body'][_0x726f('0x73')]};if(!_0x1e48f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e48f6[_0x726f('0x74')]==='user'){var _0x53ab27=_0x22c444[_0x726f('0x25')]({'plain':!![]});return db[_0x726f('0x75')][_0x726f('0x49')]({'where':{'name':_0x726f('0x26'),'userProfileId':_0x1e48f6['userProfileId']},'raw':!![]})[_0x726f('0x24')](function(_0x398032){if(_0x398032&&_0x398032[_0x726f('0x76')]===0x0){return db['UserProfileResource'][_0x726f('0x55')]({'name':_0x53ab27['name'],'resourceId':_0x53ab27['id'],'type':_0x398032['name'],'sectionId':_0x398032['id']},{})['then'](function(){return _0x22c444;});}else{return _0x22c444;}})[_0x726f('0x45')](function(_0x29337b){logger[_0x726f('0x64')](_0x726f('0x77'),_0x29337b);throw _0x29337b;});}return _0x22c444;})[_0x726f('0x24')](respondWithResult(_0x4c4a1d,null))[_0x726f('0x45')](handleError(_0x4c4a1d,null));});_0x22ab3a[_0x726f('0x78')]();}catch(_0x1255ec){_0x4c4a1d[_0x726f('0x1b')](0x1f4)[_0x726f('0x66')](_0x1255ec);}};exports[_0x726f('0x23')]=function(_0x16db41,_0x4b14bd,_0xb0792){return db[_0x726f('0x2d')][_0x726f('0x49')]({'where':{'id':_0x16db41[_0x726f('0x79')]['id']}})[_0x726f('0x24')](handleEntityNotFound(_0x4b14bd,null))[_0x726f('0x24')](saveUpdates(_[_0x726f('0x3e')](_0x16db41[_0x726f('0x72')],['name',_0x726f('0x7a')]),null))[_0x726f('0x24')](respondWithResult(_0x4b14bd,null))['catch'](handleError(_0x4b14bd,null));};exports[_0x726f('0x7b')]=function(_0x40c0b9,_0x50cd20,_0x5a51bf){return db['Sound'][_0x726f('0x49')]({'where':{'id':_0x40c0b9[_0x726f('0x79')]['id']}})['then'](function(_0x2703c8){if(_0x2703c8){return _0x2703c8[_0x726f('0x28')]();}})[_0x726f('0x24')](function(_0x30d113){var _0x5b82ac=path['join'](config[_0x726f('0x50')],'server/files/sounds/original',util[_0x726f('0x52')](_0x726f('0x53'),_0x30d113[_0x726f('0x4a')],_0x30d113[_0x726f('0x7c')]));var _0x3ee9ed=path[_0x726f('0x4c')](config['root'],_0x726f('0x51'),util[_0x726f('0x52')](_0x726f('0x53'),_0x30d113[_0x726f('0x4a')],_0x30d113[_0x726f('0x54')]));fs[_0x726f('0x65')](_0x5b82ac);fs[_0x726f('0x65')](_0x3ee9ed);return _0x30d113;})[_0x726f('0x24')](function(_0x329ba0){if(_0x329ba0){return _0x50cd20['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x50cd20,null))[_0x726f('0x45')](handleError(_0x50cd20,null));}; \ No newline at end of file +var _0x2e5f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','get','Sounds','UserProfileResource','then','error','name','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','eml-format'];(function(_0x1c4b30,_0x21d23b){var _0x536864=function(_0x5e7768){while(--_0x5e7768){_0x1c4b30['push'](_0x1c4b30['shift']());}};_0x536864(++_0x21d23b);}(_0x2e5f,0x107));var _0xf2e5=function(_0x296b65,_0x24b072){_0x296b65=_0x296b65-0x0;var _0x1e822b=_0x2e5f[_0x296b65];return _0x1e822b;};'use strict';var emlformat=require(_0xf2e5('0x0'));var rimraf=require(_0xf2e5('0x1'));var zipdir=require(_0xf2e5('0x2'));var jsonpatch=require(_0xf2e5('0x3'));var rp=require(_0xf2e5('0x4'));var moment=require(_0xf2e5('0x5'));var BPromise=require(_0xf2e5('0x6'));var Mustache=require(_0xf2e5('0x7'));var util=require(_0xf2e5('0x8'));var path=require(_0xf2e5('0x9'));var sox=require(_0xf2e5('0xa'));var csv=require('to-csv');var ejs=require(_0xf2e5('0xb'));var fs=require('fs');var fs_extra=require(_0xf2e5('0xc'));var _=require('lodash');var squel=require(_0xf2e5('0xd'));var crypto=require(_0xf2e5('0xe'));var jsforce=require(_0xf2e5('0xf'));var deskjs=require(_0xf2e5('0x10'));var toCsv=require(_0xf2e5('0x11'));var querystring=require(_0xf2e5('0x12'));var Papa=require(_0xf2e5('0x13'));var Redis=require(_0xf2e5('0x14'));var authService=require(_0xf2e5('0x15'));var qs=require(_0xf2e5('0x16'));var as=require(_0xf2e5('0x17'));var hardwareService=require(_0xf2e5('0x18'));var logger=require(_0xf2e5('0x19'))(_0xf2e5('0x1a'));var utils=require(_0xf2e5('0x1b'));var config=require(_0xf2e5('0x1c'));var licenseUtil=require(_0xf2e5('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28de90,_0x39d408){_0x39d408=_0x39d408||0xcc;return function(_0x182a72){if(_0x182a72){return _0x28de90[_0xf2e5('0x1e')](_0x39d408);}return _0x28de90[_0xf2e5('0x1f')](_0x39d408)[_0xf2e5('0x20')]();};}function respondWithResult(_0xff3192,_0x15905c){_0x15905c=_0x15905c||0xc8;return function(_0x4bc234){if(_0x4bc234){return _0xff3192[_0xf2e5('0x1f')](_0x15905c)['json'](_0x4bc234);}};}function respondWithFilteredResult(_0x4153a8,_0x1d7ee8){return function(_0x3cea7b){if(_0x3cea7b){var _0x2a330b=typeof _0x1d7ee8[_0xf2e5('0x21')]==='undefined'&&typeof _0x1d7ee8[_0xf2e5('0x22')]===_0xf2e5('0x23');var _0x47b73e=_0x3cea7b[_0xf2e5('0x24')];var _0x3c91b3=_0x2a330b?0x0:_0x1d7ee8[_0xf2e5('0x21')];var _0x4fcc05=_0x2a330b?_0x3cea7b[_0xf2e5('0x24')]:_0x1d7ee8['offset']+_0x1d7ee8[_0xf2e5('0x22')];var _0x4f7029;if(_0x4fcc05>=_0x47b73e){_0x4fcc05=_0x47b73e;_0x4f7029=0xc8;}else{_0x4f7029=0xce;}_0x4153a8['status'](_0x4f7029);return _0x4153a8['set'](_0xf2e5('0x25'),_0x3c91b3+'-'+_0x4fcc05+'/'+_0x47b73e)[_0xf2e5('0x26')](_0x3cea7b);}return null;};}function patchUpdates(_0x5e7955){return function(_0x4ebdc2){try{jsonpatch[_0xf2e5('0x27')](_0x4ebdc2,_0x5e7955,!![]);}catch(_0x1c524f){return BPromise[_0xf2e5('0x28')](_0x1c524f);}return _0x4ebdc2[_0xf2e5('0x29')]();};}function saveUpdates(_0x279773,_0x249329){return function(_0x1f5c96){if(_0x1f5c96){return _0x1f5c96[_0xf2e5('0x2a')](_0x279773)['then'](function(_0x37759e){return _0x37759e;});}return null;};}function removeEntity(_0x5becfd,_0x10d96d){return function(_0x12a02e){if(_0x12a02e){return _0x12a02e[_0xf2e5('0x2b')]()['then'](function(){var _0x4614d8=_0x12a02e[_0xf2e5('0x2c')]({'plain':!![]});var _0x2bb661=_0xf2e5('0x2d');return db[_0xf2e5('0x2e')][_0xf2e5('0x2b')]({'where':{'type':_0x2bb661,'resourceId':_0x4614d8['id']}})['then'](function(){return _0x12a02e;});})[_0xf2e5('0x2f')](function(){_0x5becfd['status'](0xcc)[_0xf2e5('0x20')]();});}};}function handleEntityNotFound(_0x4f375c,_0x25398b){return function(_0x3756cd){if(!_0x3756cd){_0x4f375c[_0xf2e5('0x1e')](0x194);}return _0x3756cd;};}function handleError(_0x297244,_0x5ebdc9){_0x5ebdc9=_0x5ebdc9||0x1f4;return function(_0x57107a){logger[_0xf2e5('0x30')](_0x57107a['stack']);if(_0x57107a['name']){delete _0x57107a[_0xf2e5('0x31')];}_0x297244[_0xf2e5('0x1f')](_0x5ebdc9)['send'](_0x57107a);};}exports['index']=function(_0x160594,_0x14bfe7){var _0x26e1fa={},_0x3aca67={},_0x41ff58={'count':0x0,'rows':[]};var _0xf5e80d=_[_0xf2e5('0x32')](db[_0xf2e5('0x33')]['rawAttributes'],function(_0x4a191f){return{'name':_0x4a191f[_0xf2e5('0x34')],'type':_0x4a191f[_0xf2e5('0x35')][_0xf2e5('0x36')]};});_0x3aca67[_0xf2e5('0x37')]=_[_0xf2e5('0x32')](_0xf5e80d,'name');_0x3aca67[_0xf2e5('0x38')]=_[_0xf2e5('0x39')](_0x160594[_0xf2e5('0x38')]);_0x3aca67[_0xf2e5('0x3a')]=_[_0xf2e5('0x3b')](_0x3aca67[_0xf2e5('0x37')],_0x3aca67[_0xf2e5('0x38')]);_0x26e1fa[_0xf2e5('0x3c')]=_[_0xf2e5('0x3b')](_0x3aca67[_0xf2e5('0x37')],qs[_0xf2e5('0x3d')](_0x160594['query'][_0xf2e5('0x3d')]));_0x26e1fa[_0xf2e5('0x3c')]=_0x26e1fa['attributes'][_0xf2e5('0x3e')]?_0x26e1fa[_0xf2e5('0x3c')]:_0x3aca67[_0xf2e5('0x37')];if(!_0x160594[_0xf2e5('0x38')][_0xf2e5('0x3f')](_0xf2e5('0x40'))){_0x26e1fa['limit']=qs[_0xf2e5('0x22')](_0x160594[_0xf2e5('0x38')][_0xf2e5('0x22')]);_0x26e1fa[_0xf2e5('0x21')]=qs[_0xf2e5('0x21')](_0x160594[_0xf2e5('0x38')]['offset']);}_0x26e1fa[_0xf2e5('0x41')]=qs[_0xf2e5('0x42')](_0x160594[_0xf2e5('0x38')][_0xf2e5('0x42')]);_0x26e1fa[_0xf2e5('0x43')]=qs[_0xf2e5('0x3a')](_[_0xf2e5('0x44')](_0x160594[_0xf2e5('0x38')],_0x3aca67[_0xf2e5('0x3a')]),_0xf5e80d);if(_0x160594[_0xf2e5('0x38')][_0xf2e5('0x45')]){_0x26e1fa[_0xf2e5('0x43')]=_[_0xf2e5('0x46')](_0x26e1fa[_0xf2e5('0x43')],{'$or':_[_0xf2e5('0x32')](_0xf5e80d,function(_0x287c56){if(_0x287c56['type']!==_0xf2e5('0x47')){var _0x487bfd={};_0x487bfd[_0x287c56[_0xf2e5('0x31')]]={'$like':'%'+_0x160594[_0xf2e5('0x38')][_0xf2e5('0x45')]+'%'};return _0x487bfd;}})});}_0x26e1fa=_[_0xf2e5('0x46')]({},_0x26e1fa,_0x160594['options']);var _0x4cc0ba={'where':_0x26e1fa[_0xf2e5('0x43')]};return db['Sound'][_0xf2e5('0x24')](_0x4cc0ba)[_0xf2e5('0x2f')](function(_0x594b69){_0x41ff58['count']=_0x594b69;if(_0x160594[_0xf2e5('0x38')][_0xf2e5('0x48')]){_0x26e1fa['include']=[{'all':!![]}];}return db[_0xf2e5('0x33')][_0xf2e5('0x49')](_0x26e1fa);})[_0xf2e5('0x2f')](function(_0x10c44a){_0x41ff58[_0xf2e5('0x4a')]=_0x10c44a;return _0x41ff58;})[_0xf2e5('0x2f')](respondWithFilteredResult(_0x14bfe7,_0x26e1fa))[_0xf2e5('0x4b')](handleError(_0x14bfe7,null));};exports[_0xf2e5('0x4c')]=function(_0x8e87d2,_0x38868d){var _0x4184f2={'raw':!![],'where':{'id':_0x8e87d2[_0xf2e5('0x4d')]['id']}},_0x302484={};_0x302484[_0xf2e5('0x37')]=_[_0xf2e5('0x39')](db[_0xf2e5('0x33')][_0xf2e5('0x4e')]);_0x302484[_0xf2e5('0x38')]=_[_0xf2e5('0x39')](_0x8e87d2[_0xf2e5('0x38')]);_0x302484[_0xf2e5('0x3a')]=_[_0xf2e5('0x3b')](_0x302484['model'],_0x302484[_0xf2e5('0x38')]);_0x4184f2[_0xf2e5('0x3c')]=_[_0xf2e5('0x3b')](_0x302484[_0xf2e5('0x37')],qs[_0xf2e5('0x3d')](_0x8e87d2[_0xf2e5('0x38')]['fields']));_0x4184f2[_0xf2e5('0x3c')]=_0x4184f2[_0xf2e5('0x3c')][_0xf2e5('0x3e')]?_0x4184f2[_0xf2e5('0x3c')]:_0x302484[_0xf2e5('0x37')];if(_0x8e87d2[_0xf2e5('0x38')]['includeAll']){_0x4184f2[_0xf2e5('0x4f')]=[{'all':!![]}];}_0x4184f2=_[_0xf2e5('0x46')]({},_0x4184f2,_0x8e87d2[_0xf2e5('0x50')]);return db[_0xf2e5('0x33')][_0xf2e5('0x51')](_0x4184f2)[_0xf2e5('0x2f')](handleEntityNotFound(_0x38868d,null))[_0xf2e5('0x2f')](respondWithResult(_0x38868d,null))['catch'](handleError(_0x38868d,null));};exports[_0xf2e5('0x52')]=function(_0x361a2d,_0x58cd93,_0x5232f6){return db[_0xf2e5('0x33')][_0xf2e5('0x51')]({'where':{'id':_0x361a2d['params']['id']},'attributes':[_0xf2e5('0x31'),_0xf2e5('0x53'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x58cd93,null))[_0xf2e5('0x2f')](function(_0x3f16b9){if(_0x3f16b9){if(!fs[_0xf2e5('0x54')](path[_0xf2e5('0x55')](config[_0xf2e5('0x56')],_0xf2e5('0x57'),_0x3f16b9['save_name']+'.'+_0x3f16b9[_0xf2e5('0x58')]))){throw new db[(_0xf2e5('0x59'))][(_0xf2e5('0x5a'))](_0xf2e5('0x5b'));}return _0x58cd93[_0xf2e5('0x52')](path[_0xf2e5('0x55')](config['root'],_0xf2e5('0x57'),util['format'](_0xf2e5('0x5c'),_0x3f16b9[_0xf2e5('0x53')],_0x3f16b9[_0xf2e5('0x58')])),util[_0xf2e5('0x5d')](_0xf2e5('0x5c'),_0x3f16b9[_0xf2e5('0x31')],_0x3f16b9[_0xf2e5('0x58')]));}return null;})['catch'](handleError(_0x58cd93,null));};exports[_0xf2e5('0x5e')]=function(_0x5ceb14,_0x56d5ff,_0x352edc){var _0x2c9ada={'name':path[_0xf2e5('0x5f')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x61')],path[_0xf2e5('0x62')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x61')])),'save_name':path['basename'](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')],path[_0xf2e5('0x62')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')])),'original_format':path[_0xf2e5('0x62')](_0x5ceb14[_0xf2e5('0x60')]['originalname'])['substring'](0x1),'converted_format':_0xf2e5('0x64')};var _0x3c6c7a=path[_0xf2e5('0x55')](config[_0xf2e5('0x56')],_0xf2e5('0x65'),_0x5ceb14[_0xf2e5('0x60')]['filename']);var _0x45ac31=path[_0xf2e5('0x55')](config[_0xf2e5('0x56')],_0xf2e5('0x57'),util[_0xf2e5('0x5d')](_0xf2e5('0x5c'),path[_0xf2e5('0x5f')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')],path['extname'](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')])),_0x2c9ada[_0xf2e5('0x58')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x3c6c7a);logger[_0xf2e5('0x66')]('Sound\x20upload\x20destination:\x20%s',_0x45ac31);try{fs[_0xf2e5('0x67')](_0x3c6c7a,parseInt(_0xf2e5('0x68'),0x8));var _0x4351fb=sox[_0xf2e5('0x69')](_0x3c6c7a,_0x45ac31,{'sampleRate':0x1f40,'format':_0xf2e5('0x64'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4351fb['on']('error',function(_0x15b51b){fs[_0xf2e5('0x6a')](_0x3c6c7a);_0x56d5ff[_0xf2e5('0x1f')](0x1f4)['send'](_0x15b51b);});_0x4351fb['on']('src',function(_0x17b8cc){_0x2c9ada[_0xf2e5('0x6b')]=isNaN(_0x17b8cc[_0xf2e5('0x6c')])?null:_0x17b8cc[_0xf2e5('0x6c')]*0x3e8;_0x2c9ada[_0xf2e5('0x6d')]=isNaN(_0x17b8cc[_0xf2e5('0x6e')])?null:_0x17b8cc[_0xf2e5('0x6e')];_0x2c9ada[_0xf2e5('0x6f')]=isNaN(_0x17b8cc[_0xf2e5('0x70')])?null:_0x17b8cc[_0xf2e5('0x70')];_0x2c9ada[_0xf2e5('0x71')]=isNaN(_0x17b8cc['bitRate'])?null:_0x17b8cc[_0xf2e5('0x72')];_0x2c9ada[_0xf2e5('0x73')]=isNaN(_0x17b8cc[_0xf2e5('0x74')])?null:_0x17b8cc[_0xf2e5('0x74')];});_0x4351fb['on'](_0xf2e5('0x75'),function(_0x4f3227){_0x2c9ada[_0xf2e5('0x76')]=isNaN(_0x4f3227[_0xf2e5('0x6c')])?null:_0x4f3227[_0xf2e5('0x6c')]*0x3e8;_0x2c9ada[_0xf2e5('0x77')]=isNaN(_0x4f3227['sampleCount'])?null:_0x4f3227[_0xf2e5('0x6e')];_0x2c9ada['converted_channelCount']=isNaN(_0x4f3227[_0xf2e5('0x70')])?null:_0x4f3227['channelCount'];_0x2c9ada[_0xf2e5('0x78')]=isNaN(_0x4f3227[_0xf2e5('0x72')])?null:_0x4f3227['bitRate'];_0x2c9ada[_0xf2e5('0x79')]=isNaN(_0x4f3227[_0xf2e5('0x74')])?null:_0x4f3227[_0xf2e5('0x74')];});_0x4351fb['on'](_0xf2e5('0x20'),function(){fs[_0xf2e5('0x67')](_0x45ac31,parseInt(_0xf2e5('0x68'),0x8));return db[_0xf2e5('0x33')][_0xf2e5('0x5e')](_0x2c9ada)[_0xf2e5('0x2f')](function(_0x51764c){var _0x39bee6={'role':_0x5ceb14[_0xf2e5('0x7a')][_0xf2e5('0x7b')],'userProfileId':_0x5ceb14[_0xf2e5('0x7a')][_0xf2e5('0x7c')]};if(!_0x39bee6)throw new Error(_0xf2e5('0x7d'));if(_0x39bee6[_0xf2e5('0x7b')]==='user'){var _0x774133=_0x51764c[_0xf2e5('0x2c')]({'plain':!![]});return db[_0xf2e5('0x7e')][_0xf2e5('0x51')]({'where':{'name':_0xf2e5('0x2d'),'userProfileId':_0x39bee6['userProfileId']},'raw':!![]})[_0xf2e5('0x2f')](function(_0x1a29b4){if(_0x1a29b4&&_0x1a29b4[_0xf2e5('0x7f')]===0x0){return db['UserProfileResource'][_0xf2e5('0x5e')]({'name':_0x774133[_0xf2e5('0x31')],'resourceId':_0x774133['id'],'type':_0x1a29b4[_0xf2e5('0x31')],'sectionId':_0x1a29b4['id']},{})['then'](function(){return _0x51764c;});}else{return _0x51764c;}})[_0xf2e5('0x4b')](function(_0x197e2f){logger[_0xf2e5('0x30')](_0xf2e5('0x80'),_0x197e2f);throw _0x197e2f;});}return _0x51764c;})[_0xf2e5('0x2f')](respondWithResult(_0x56d5ff,null))['catch'](handleError(_0x56d5ff,null));});_0x4351fb[_0xf2e5('0x81')]();}catch(_0x223ba3){_0x56d5ff['status'](0x1f4)[_0xf2e5('0x82')](_0x223ba3);}};exports['update']=function(_0x43d2d8,_0x969384,_0x59036f){return db['Sound'][_0xf2e5('0x51')]({'where':{'id':_0x43d2d8[_0xf2e5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x969384,null))[_0xf2e5('0x2f')](saveUpdates(_[_0xf2e5('0x44')](_0x43d2d8['body'],[_0xf2e5('0x31'),_0xf2e5('0x83')]),null))[_0xf2e5('0x2f')](respondWithResult(_0x969384,null))[_0xf2e5('0x4b')](handleError(_0x969384,null));};exports['delete']=function(_0x295033,_0x2f3b5a,_0x53230c){return db[_0xf2e5('0x33')]['find']({'where':{'id':_0x295033['params']['id']}})[_0xf2e5('0x2f')](function(_0x2d7a7e){if(_0x2d7a7e){return _0x2d7a7e[_0xf2e5('0x2b')]();}})[_0xf2e5('0x2f')](function(_0x20138f){var _0x17b295=path[_0xf2e5('0x55')](config['root'],'server/files/sounds/original',util[_0xf2e5('0x5d')](_0xf2e5('0x5c'),_0x20138f[_0xf2e5('0x53')],_0x20138f['original_format']));var _0x1151ba=path['join'](config[_0xf2e5('0x56')],'server/files/sounds/converted',util['format'](_0xf2e5('0x5c'),_0x20138f[_0xf2e5('0x53')],_0x20138f[_0xf2e5('0x58')]));fs['unlinkSync'](_0x17b295);fs[_0xf2e5('0x6a')](_0x1151ba);return _0x20138f;})['then'](function(_0x15a3de){if(_0x15a3de){return _0x2f3b5a[_0xf2e5('0x1f')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2f3b5a,null))[_0xf2e5('0x4b')](handleError(_0x2f3b5a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ef9292c..94d89af 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 _0xa321=['Sound','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./sound.attributes','exports','define'];(function(_0x4d2bdd,_0x10007a){var _0x5a8262=function(_0x2f614c){while(--_0x2f614c){_0x4d2bdd['push'](_0x4d2bdd['shift']());}};_0x5a8262(++_0x10007a);}(_0xa321,0xfe));var _0x1a32=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0xa321[_0x539fb2];return _0x4d583d;};'use strict';var _=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var logger=require(_0x1a32('0x2'))('api');var moment=require(_0x1a32('0x3'));var BPromise=require(_0x1a32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a32('0x5'));var rimraf=require('rimraf');var config=require(_0x1a32('0x6'));var attributes=require(_0x1a32('0x7'));module[_0x1a32('0x8')]=function(_0x28b6ab,_0x2585cf){return _0x28b6ab[_0x1a32('0x9')](_0x1a32('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5950=['util','api','moment','bluebird','path','../../config/environment','./sound.attributes','exports','Sound','lodash'];(function(_0x50f63f,_0x3be855){var _0xa38248=function(_0x19061b){while(--_0x19061b){_0x50f63f['push'](_0x50f63f['shift']());}};_0xa38248(++_0x3be855);}(_0x5950,0x149));var _0x0595=function(_0x1bfdd6,_0x189a46){_0x1bfdd6=_0x1bfdd6-0x0;var _0x512f81=_0x5950[_0x1bfdd6];return _0x512f81;};'use strict';var _=require(_0x0595('0x0'));var util=require(_0x0595('0x1'));var logger=require('../../config/logger')(_0x0595('0x2'));var moment=require(_0x0595('0x3'));var BPromise=require(_0x0595('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0595('0x5'));var rimraf=require('rimraf');var config=require(_0x0595('0x6'));var attributes=require(_0x0595('0x7'));module[_0x0595('0x8')]=function(_0x422d26,_0x20acb7){return _0x422d26['define'](_0x0595('0x9'),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 03ba514..0df4b0c 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 _0x3d21=['find','options','where','attributes','include','map','model','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','ShowSound','Sound'];(function(_0x2b814b,_0x53fd31){var _0x3e67e1=function(_0x433e4b){while(--_0x433e4b){_0x2b814b['push'](_0x2b814b['shift']());}};_0x3e67e1(++_0x53fd31);}(_0x3d21,0x12b));var _0x13d2=function(_0x20148f,_0x184cf7){_0x20148f=_0x20148f-0x0;var _0x29f338=_0x3d21[_0x20148f];return _0x29f338;};'use strict';var _=require('lodash');var util=require(_0x13d2('0x0'));var moment=require(_0x13d2('0x1'));var BPromise=require(_0x13d2('0x2'));var rs=require(_0x13d2('0x3'));var fs=require('fs');var Redis=require(_0x13d2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13d2('0x5'));var logger=require(_0x13d2('0x6'))(_0x13d2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13d2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149c81,_0x413925,_0x15011a){return new BPromise(function(_0x34cd48,_0x10a322){return client['request'](_0x149c81,_0x15011a)[_0x13d2('0x9')](function(_0x344934){logger[_0x13d2('0xa')](_0x13d2('0xb'),_0x413925,'request\x20sent');logger[_0x13d2('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x413925,_0x13d2('0xd'),JSON['stringify'](_0x344934));if(_0x344934[_0x13d2('0xe')]){if(_0x344934['error'][_0x13d2('0xf')]===0x1f4){logger['error'](_0x13d2('0xb'),_0x413925,_0x344934[_0x13d2('0xe')][_0x13d2('0x10')]);return _0x10a322(_0x344934[_0x13d2('0xe')][_0x13d2('0x10')]);}logger[_0x13d2('0xe')](_0x13d2('0xb'),_0x413925,_0x344934[_0x13d2('0xe')]['message']);return _0x34cd48(_0x344934[_0x13d2('0xe')]['message']);}else{logger[_0x13d2('0xa')]('Sound,\x20%s,\x20%s',_0x413925,_0x13d2('0xd'));_0x34cd48(_0x344934[_0x13d2('0x11')]['message']);}})['catch'](function(_0x2161c5){logger[_0x13d2('0xe')](_0x13d2('0xb'),_0x413925,_0x2161c5);_0x10a322(_0x2161c5);});});}exports[_0x13d2('0x12')]=function(_0x2f61e9){var _0x3ced5a=this;return new Promise(function(_0x31d080,_0x567beb){return db[_0x13d2('0x13')][_0x13d2('0x14')]({'raw':_0x2f61e9['options']?_0x2f61e9[_0x13d2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2f61e9[_0x13d2('0x15')]?_0x2f61e9['options'][_0x13d2('0x16')]||null:null,'attributes':_0x2f61e9[_0x13d2('0x15')]?_0x2f61e9[_0x13d2('0x15')][_0x13d2('0x17')]||null:null,'include':_0x2f61e9[_0x13d2('0x15')]?_0x2f61e9['options']['include']?_['map'](_0x2f61e9['options'][_0x13d2('0x18')],function(_0x4c2aa4){return{'model':db[_0x4c2aa4['model']],'as':_0x4c2aa4['as'],'attributes':_0x4c2aa4[_0x13d2('0x17')],'include':_0x4c2aa4['include']?_[_0x13d2('0x19')](_0x4c2aa4[_0x13d2('0x18')],function(_0x58efd2){return{'model':db[_0x58efd2[_0x13d2('0x1a')]],'as':_0x58efd2['as'],'attributes':_0x58efd2[_0x13d2('0x17')],'include':_0x58efd2[_0x13d2('0x18')]?_[_0x13d2('0x19')](_0x58efd2[_0x13d2('0x18')],function(_0x38fce9){return{'model':db[_0x38fce9[_0x13d2('0x1a')]],'as':_0x38fce9['as'],'attributes':_0x38fce9['attributes']};}):[]};}):[]};}):[]:[]})[_0x13d2('0x9')](function(_0x514fdb){logger[_0x13d2('0xa')](_0x13d2('0x12'),_0x2f61e9);logger[_0x13d2('0xc')](_0x13d2('0x12'),_0x2f61e9,JSON[_0x13d2('0x1b')](_0x514fdb));_0x31d080(_0x514fdb);})[_0x13d2('0x1c')](function(_0x3a4cef){logger[_0x13d2('0xe')](_0x13d2('0x12'),_0x3a4cef['message'],_0x2f61e9);_0x567beb(_0x3ced5a[_0x13d2('0xe')](0x1f4,_0x3a4cef[_0x13d2('0x10')]));});});}; \ No newline at end of file +var _0x6712=['result','catch','find','options','raw','attributes','map','include','model','ShowSound','stringify','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x6712,0xa1));var _0x2671=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6712[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x2671('0x0'));var moment=require(_0x2671('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2671('0x2'))['db'];var utils=require(_0x2671('0x3'));var logger=require(_0x2671('0x4'))(_0x2671('0x5'));var config=require(_0x2671('0x6'));var jayson=require(_0x2671('0x7'));var client=jayson['client'][_0x2671('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54538c,_0x56165d,_0x47229a){return new BPromise(function(_0x5a53e0,_0x49dee1){return client[_0x2671('0x9')](_0x54538c,_0x47229a)[_0x2671('0xa')](function(_0x5ac42b){logger[_0x2671('0xb')](_0x2671('0xc'),_0x56165d,_0x2671('0xd'));logger[_0x2671('0xe')](_0x2671('0xf'),_0x56165d,_0x2671('0xd'),JSON['stringify'](_0x5ac42b));if(_0x5ac42b[_0x2671('0x10')]){if(_0x5ac42b['error'][_0x2671('0x11')]===0x1f4){logger[_0x2671('0x10')](_0x2671('0xc'),_0x56165d,_0x5ac42b[_0x2671('0x10')][_0x2671('0x12')]);return _0x49dee1(_0x5ac42b[_0x2671('0x10')]['message']);}logger[_0x2671('0x10')](_0x2671('0xc'),_0x56165d,_0x5ac42b[_0x2671('0x10')][_0x2671('0x12')]);return _0x5a53e0(_0x5ac42b[_0x2671('0x10')][_0x2671('0x12')]);}else{logger[_0x2671('0xb')](_0x2671('0xc'),_0x56165d,_0x2671('0xd'));_0x5a53e0(_0x5ac42b[_0x2671('0x13')][_0x2671('0x12')]);}})[_0x2671('0x14')](function(_0x4d5ca3){logger['error'](_0x2671('0xc'),_0x56165d,_0x4d5ca3);_0x49dee1(_0x4d5ca3);});});}exports['ShowSound']=function(_0x4142cf){var _0x23b5b7=this;return new Promise(function(_0x3bff52,_0x2f1c38){return db['Sound'][_0x2671('0x15')]({'raw':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')][_0x2671('0x17')]===undefined?!![]:![]:!![],'where':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')]['where']||null:null,'attributes':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')][_0x2671('0x18')]||null:null,'include':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')]['include']?_[_0x2671('0x19')](_0x4142cf[_0x2671('0x16')][_0x2671('0x1a')],function(_0x4fe7d1){return{'model':db[_0x4fe7d1['model']],'as':_0x4fe7d1['as'],'attributes':_0x4fe7d1[_0x2671('0x18')],'include':_0x4fe7d1[_0x2671('0x1a')]?_[_0x2671('0x19')](_0x4fe7d1['include'],function(_0x4018ec){return{'model':db[_0x4018ec[_0x2671('0x1b')]],'as':_0x4018ec['as'],'attributes':_0x4018ec['attributes'],'include':_0x4018ec[_0x2671('0x1a')]?_[_0x2671('0x19')](_0x4018ec['include'],function(_0x2e0208){return{'model':db[_0x2e0208['model']],'as':_0x2e0208['as'],'attributes':_0x2e0208[_0x2671('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2671('0xa')](function(_0x56dc43){logger[_0x2671('0xb')](_0x2671('0x1c'),_0x4142cf);logger[_0x2671('0xe')]('ShowSound',_0x4142cf,JSON[_0x2671('0x1d')](_0x56dc43));_0x3bff52(_0x56dc43);})[_0x2671('0x14')](function(_0x444e3e){logger['error'](_0x2671('0x1c'),_0x444e3e[_0x2671('0x12')],_0x4142cf);_0x2f1c38(_0x23b5b7[_0x2671('0x10')](0x1f4,_0x444e3e[_0x2671('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6620132..b4b2d8f 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x312484,_0x2605e6){var _0x5035e8=function(_0x5b4330){while(--_0x5b4330){_0x312484['push'](_0x312484['shift']());}};_0x5035e8(++_0x2605e6);}(_0xda2d,0x102));var _0xdda2=function(_0x16c8e6,_0x1d97d2){_0x16c8e6=_0x16c8e6-0x0;var _0x5b6217=_0xda2d[_0x16c8e6];return _0x5b6217;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x2c2dff,_0x302e28){var _0x1177a4=function(_0x2fa930){while(--_0x2fa930){_0x2c2dff['push'](_0x2c2dff['shift']());}};_0x1177a4(++_0x302e28);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ef2ef7c..aef5105 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 _0xae8c=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x3c9fc8,_0x57ff11){var _0x8b104c=function(_0x12ac5f){while(--_0x12ac5f){_0x3c9fc8['push'](_0x3c9fc8['shift']());}};_0x8b104c(++_0x57ff11);}(_0xae8c,0x1bb));var _0xcae8=function(_0x66e2cf,_0x58eae6){_0x66e2cf=_0x66e2cf-0x0;var _0x2c7c91=_0xae8c[_0x66e2cf];return _0x2c7c91;};'use strict';var Sequelize=require(_0xcae8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xcae8('0x1')]},'body':{'type':Sequelize[_0xcae8('0x2')](_0xcae8('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xcae8('0x4')]('in',_0xcae8('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xcae8('0x1')]},'providerResponse':{'type':Sequelize[_0xcae8('0x2')]}}; \ No newline at end of file +var _0x767a=['out','STRING','TEXT','ENUM'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0x767a,0x89));var _0xa767=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x767a[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa767('0x0')]},'body':{'type':Sequelize[_0xa767('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xa767('0x2')]('in',_0xa767('0x3')),'defaultValue':_0xa767('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xa767('0x0')]},'providerResponse':{'type':Sequelize[_0xa767('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c6585e9..65af46d 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 _0x093c=['eml-format','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update'];(function(_0x24a78d,_0xc41cbe){var _0x2358e8=function(_0x24ad57){while(--_0x24ad57){_0x24a78d['push'](_0x24a78d['shift']());}};_0x2358e8(++_0xc41cbe);}(_0x093c,0xde));var _0xc093=function(_0x4be164,_0x108aa2){_0x4be164=_0x4be164-0x0;var _0x3cab51=_0x093c[_0x4be164];return _0x3cab51;};'use strict';var emlformat=require(_0xc093('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc093('0x1'));var rp=require(_0xc093('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc093('0x3'));var path=require(_0xc093('0x4'));var sox=require('sox');var csv=require(_0xc093('0x5'));var ejs=require(_0xc093('0x6'));var fs=require('fs');var fs_extra=require(_0xc093('0x7'));var _=require(_0xc093('0x8'));var squel=require(_0xc093('0x9'));var crypto=require(_0xc093('0xa'));var jsforce=require(_0xc093('0xb'));var deskjs=require(_0xc093('0xc'));var toCsv=require(_0xc093('0x5'));var querystring=require(_0xc093('0xd'));var Papa=require(_0xc093('0xe'));var Redis=require(_0xc093('0xf'));var authService=require(_0xc093('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc093('0x11'));var logger=require(_0xc093('0x12'))(_0xc093('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc093('0x14'))['db'];function respondWithStatusCode(_0x1b73f2,_0x31cd4b){_0x31cd4b=_0x31cd4b||0xcc;return function(_0x41e980){if(_0x41e980){return _0x1b73f2[_0xc093('0x15')](_0x31cd4b);}return _0x1b73f2[_0xc093('0x16')](_0x31cd4b)[_0xc093('0x17')]();};}function respondWithResult(_0x706bb4,_0x55d0bf){_0x55d0bf=_0x55d0bf||0xc8;return function(_0x42fd09){if(_0x42fd09){return _0x706bb4[_0xc093('0x16')](_0x55d0bf)[_0xc093('0x18')](_0x42fd09);}};}function respondWithFilteredResult(_0x2cc73a,_0x198b6a){return function(_0x2f8768){if(_0x2f8768){var _0x1e1082=typeof _0x198b6a[_0xc093('0x19')]===_0xc093('0x1a')&&typeof _0x198b6a[_0xc093('0x1b')]===_0xc093('0x1a');var _0x471e37=_0x2f8768[_0xc093('0x1c')];var _0x5ed0a7=_0x1e1082?0x0:_0x198b6a[_0xc093('0x19')];var _0x338215=_0x1e1082?_0x2f8768[_0xc093('0x1c')]:_0x198b6a['offset']+_0x198b6a['limit'];var _0x330cda;if(_0x338215>=_0x471e37){_0x338215=_0x471e37;_0x330cda=0xc8;}else{_0x330cda=0xce;}_0x2cc73a[_0xc093('0x16')](_0x330cda);return _0x2cc73a[_0xc093('0x1d')](_0xc093('0x1e'),_0x5ed0a7+'-'+_0x338215+'/'+_0x471e37)[_0xc093('0x18')](_0x2f8768);}return null;};}function patchUpdates(_0x5c32bb){return function(_0x8edd76){try{jsonpatch[_0xc093('0x1f')](_0x8edd76,_0x5c32bb,!![]);}catch(_0x1f607f){return BPromise[_0xc093('0x20')](_0x1f607f);}return _0x8edd76[_0xc093('0x21')]();};}function saveUpdates(_0xf68a90,_0x4220a1){return function(_0x4ce502){if(_0x4ce502){return _0x4ce502['update'](_0xf68a90)[_0xc093('0x22')](function(_0xb77f34){return _0xb77f34;});}return null;};}function removeEntity(_0x440ccc,_0x9d0e9c){return function(_0x49f7ee){if(_0x49f7ee){return _0x49f7ee[_0xc093('0x23')]()[_0xc093('0x22')](function(){_0x440ccc[_0xc093('0x16')](0xcc)[_0xc093('0x17')]();});}};}function handleEntityNotFound(_0x14cf84,_0x1efa12){return function(_0x560522){if(!_0x560522){_0x14cf84['sendStatus'](0x194);}return _0x560522;};}function handleError(_0x3b2440,_0x5c1665){_0x5c1665=_0x5c1665||0x1f4;return function(_0x20a700){logger[_0xc093('0x24')](_0x20a700[_0xc093('0x25')]);if(_0x20a700['name']){delete _0x20a700[_0xc093('0x26')];}_0x3b2440['status'](_0x5c1665)['send'](_0x20a700);};}exports[_0xc093('0x27')]=function(_0x1f7a89,_0x1e4665){var _0x465b62={},_0x38eb9c={},_0x58fb70={'count':0x0,'rows':[]};var _0x260dd7=_[_0xc093('0x28')](db[_0xc093('0x29')][_0xc093('0x2a')],function(_0x319f17){return{'name':_0x319f17[_0xc093('0x2b')],'type':_0x319f17[_0xc093('0x2c')][_0xc093('0x2d')]};});_0x38eb9c[_0xc093('0x2e')]=_[_0xc093('0x28')](_0x260dd7,_0xc093('0x26'));_0x38eb9c[_0xc093('0x2f')]=_[_0xc093('0x30')](_0x1f7a89['query']);_0x38eb9c['filters']=_['intersection'](_0x38eb9c[_0xc093('0x2e')],_0x38eb9c[_0xc093('0x2f')]);_0x465b62['attributes']=_['intersection'](_0x38eb9c[_0xc093('0x2e')],qs[_0xc093('0x31')](_0x1f7a89[_0xc093('0x2f')][_0xc093('0x31')]));_0x465b62[_0xc093('0x32')]=_0x465b62[_0xc093('0x32')][_0xc093('0x33')]?_0x465b62[_0xc093('0x32')]:_0x38eb9c[_0xc093('0x2e')];if(!_0x1f7a89['query'][_0xc093('0x34')](_0xc093('0x35'))){_0x465b62['limit']=qs[_0xc093('0x1b')](_0x1f7a89[_0xc093('0x2f')][_0xc093('0x1b')]);_0x465b62[_0xc093('0x19')]=qs[_0xc093('0x19')](_0x1f7a89['query'][_0xc093('0x19')]);}_0x465b62[_0xc093('0x36')]=qs[_0xc093('0x37')](_0x1f7a89['query']['sort']);_0x465b62['where']=qs[_0xc093('0x38')](_[_0xc093('0x39')](_0x1f7a89[_0xc093('0x2f')],_0x38eb9c['filters']),_0x260dd7);if(_0x1f7a89[_0xc093('0x2f')][_0xc093('0x3a')]){_0x465b62[_0xc093('0x3b')]=_[_0xc093('0x3c')](_0x465b62[_0xc093('0x3b')],{'$or':_[_0xc093('0x28')](_0x260dd7,function(_0x519227){if(_0x519227[_0xc093('0x2c')]!==_0xc093('0x3d')){var _0x2db79e={};_0x2db79e[_0x519227[_0xc093('0x26')]]={'$like':'%'+_0x1f7a89[_0xc093('0x2f')]['filter']+'%'};return _0x2db79e;}})});}_0x465b62=_[_0xc093('0x3c')]({},_0x465b62,_0x1f7a89[_0xc093('0x3e')]);var _0x1b51a4={'where':_0x465b62[_0xc093('0x3b')]};return db[_0xc093('0x29')][_0xc093('0x1c')](_0x1b51a4)[_0xc093('0x22')](function(_0x2c4e34){_0x58fb70[_0xc093('0x1c')]=_0x2c4e34;if(_0x1f7a89[_0xc093('0x2f')][_0xc093('0x3f')]){_0x465b62[_0xc093('0x40')]=[{'all':!![]}];}return db[_0xc093('0x29')][_0xc093('0x41')](_0x465b62);})[_0xc093('0x22')](function(_0x63b0ee){_0x58fb70[_0xc093('0x42')]=_0x63b0ee;return _0x58fb70;})[_0xc093('0x22')](respondWithFilteredResult(_0x1e4665,_0x465b62))[_0xc093('0x43')](handleError(_0x1e4665,null));};exports[_0xc093('0x44')]=function(_0x20d918,_0x471d67){var _0x186591={'raw':!![],'where':{'id':_0x20d918[_0xc093('0x45')]['id']}},_0x3c4f00={};_0x3c4f00[_0xc093('0x2e')]=_['keys'](db[_0xc093('0x29')][_0xc093('0x2a')]);_0x3c4f00[_0xc093('0x2f')]=_[_0xc093('0x30')](_0x20d918['query']);_0x3c4f00['filters']=_['intersection'](_0x3c4f00['model'],_0x3c4f00[_0xc093('0x2f')]);_0x186591[_0xc093('0x32')]=_['intersection'](_0x3c4f00[_0xc093('0x2e')],qs[_0xc093('0x31')](_0x20d918[_0xc093('0x2f')][_0xc093('0x31')]));_0x186591[_0xc093('0x32')]=_0x186591[_0xc093('0x32')][_0xc093('0x33')]?_0x186591[_0xc093('0x32')]:_0x3c4f00[_0xc093('0x2e')];if(_0x20d918[_0xc093('0x2f')][_0xc093('0x3f')]){_0x186591[_0xc093('0x40')]=[{'all':!![]}];}_0x186591=_[_0xc093('0x3c')]({},_0x186591,_0x20d918[_0xc093('0x3e')]);return db[_0xc093('0x29')][_0xc093('0x46')](_0x186591)[_0xc093('0x22')](handleEntityNotFound(_0x471d67,null))['then'](respondWithResult(_0x471d67,null))[_0xc093('0x43')](handleError(_0x471d67,null));};exports[_0xc093('0x47')]=function(_0x3a9b58,_0x54dc6f){return db[_0xc093('0x29')][_0xc093('0x47')](_0x3a9b58[_0xc093('0x48')],{})[_0xc093('0x22')](respondWithResult(_0x54dc6f,0xc9))[_0xc093('0x43')](handleError(_0x54dc6f,null));};exports[_0xc093('0x49')]=function(_0x50b859,_0x34eaa8){if(_0x50b859[_0xc093('0x48')]['id']){delete _0x50b859[_0xc093('0x48')]['id'];}return db['SquareMessage'][_0xc093('0x46')]({'where':{'id':_0x50b859[_0xc093('0x45')]['id']}})[_0xc093('0x22')](handleEntityNotFound(_0x34eaa8,null))[_0xc093('0x22')](saveUpdates(_0x50b859[_0xc093('0x48')],null))[_0xc093('0x22')](respondWithResult(_0x34eaa8,null))[_0xc093('0x43')](handleError(_0x34eaa8,null));};exports[_0xc093('0x23')]=function(_0x25fbaf,_0x2394be){return db['SquareMessage'][_0xc093('0x46')]({'where':{'id':_0x25fbaf[_0xc093('0x45')]['id']}})[_0xc093('0x22')](handleEntityNotFound(_0x2394be,null))[_0xc093('0x22')](removeEntity(_0x2394be,null))[_0xc093('0x43')](handleError(_0x2394be,null));}; \ No newline at end of file +var _0xa7b5=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','error','name','index','map','SquareMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x508bde,_0x979512){_0x508bde=_0x508bde-0x0;var _0x18bf9d=_0xa7b5[_0x508bde];return _0x18bf9d;};'use strict';var emlformat=require(_0x5a7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a7b('0x2'));var moment=require(_0x5a7b('0x3'));var BPromise=require(_0x5a7b('0x4'));var Mustache=require(_0x5a7b('0x5'));var util=require(_0x5a7b('0x6'));var path=require(_0x5a7b('0x7'));var sox=require(_0x5a7b('0x8'));var csv=require(_0x5a7b('0x9'));var ejs=require(_0x5a7b('0xa'));var fs=require('fs');var fs_extra=require(_0x5a7b('0xb'));var _=require(_0x5a7b('0xc'));var squel=require(_0x5a7b('0xd'));var crypto=require(_0x5a7b('0xe'));var jsforce=require(_0x5a7b('0xf'));var deskjs=require(_0x5a7b('0x10'));var toCsv=require(_0x5a7b('0x9'));var querystring=require(_0x5a7b('0x11'));var Papa=require(_0x5a7b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a7b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a7b('0x14'));var logger=require(_0x5a7b('0x15'))(_0x5a7b('0x16'));var utils=require(_0x5a7b('0x17'));var config=require(_0x5a7b('0x18'));var licenseUtil=require(_0x5a7b('0x19'));var db=require(_0x5a7b('0x1a'))['db'];function respondWithStatusCode(_0x156031,_0x11ac57){_0x11ac57=_0x11ac57||0xcc;return function(_0x388176){if(_0x388176){return _0x156031[_0x5a7b('0x1b')](_0x11ac57);}return _0x156031['status'](_0x11ac57)[_0x5a7b('0x1c')]();};}function respondWithResult(_0x43f889,_0x1a217e){_0x1a217e=_0x1a217e||0xc8;return function(_0x292a44){if(_0x292a44){return _0x43f889['status'](_0x1a217e)[_0x5a7b('0x1d')](_0x292a44);}};}function respondWithFilteredResult(_0x2ca1d6,_0x599bb8){return function(_0x3e922e){if(_0x3e922e){var _0x4d2e57=typeof _0x599bb8[_0x5a7b('0x1e')]==='undefined'&&typeof _0x599bb8[_0x5a7b('0x1f')]===_0x5a7b('0x20');var _0x2fc1fa=_0x3e922e['count'];var _0x33b996=_0x4d2e57?0x0:_0x599bb8['offset'];var _0x192009=_0x4d2e57?_0x3e922e[_0x5a7b('0x21')]:_0x599bb8[_0x5a7b('0x1e')]+_0x599bb8[_0x5a7b('0x1f')];var _0x550b9a;if(_0x192009>=_0x2fc1fa){_0x192009=_0x2fc1fa;_0x550b9a=0xc8;}else{_0x550b9a=0xce;}_0x2ca1d6[_0x5a7b('0x22')](_0x550b9a);return _0x2ca1d6[_0x5a7b('0x23')](_0x5a7b('0x24'),_0x33b996+'-'+_0x192009+'/'+_0x2fc1fa)['json'](_0x3e922e);}return null;};}function patchUpdates(_0x4126a5){return function(_0x6695e1){try{jsonpatch['apply'](_0x6695e1,_0x4126a5,!![]);}catch(_0x49a892){return BPromise[_0x5a7b('0x25')](_0x49a892);}return _0x6695e1[_0x5a7b('0x26')]();};}function saveUpdates(_0x2ebf51,_0x8b05ef){return function(_0x285369){if(_0x285369){return _0x285369['update'](_0x2ebf51)['then'](function(_0x1ad9cc){return _0x1ad9cc;});}return null;};}function removeEntity(_0x342a23,_0x26442f){return function(_0x2a0550){if(_0x2a0550){return _0x2a0550['destroy']()['then'](function(){_0x342a23['status'](0xcc)[_0x5a7b('0x1c')]();});}};}function handleEntityNotFound(_0x3fbff6,_0x11223d){return function(_0x3e572a){if(!_0x3e572a){_0x3fbff6[_0x5a7b('0x1b')](0x194);}return _0x3e572a;};}function handleError(_0x5673b9,_0x2d8001){_0x2d8001=_0x2d8001||0x1f4;return function(_0x55724d){logger[_0x5a7b('0x27')](_0x55724d['stack']);if(_0x55724d[_0x5a7b('0x28')]){delete _0x55724d[_0x5a7b('0x28')];}_0x5673b9[_0x5a7b('0x22')](_0x2d8001)['send'](_0x55724d);};}exports[_0x5a7b('0x29')]=function(_0x449cc7,_0x169762){var _0x54f1c6={},_0x36b90e={},_0x3172a8={'count':0x0,'rows':[]};var _0x27b2cf=_[_0x5a7b('0x2a')](db[_0x5a7b('0x2b')]['rawAttributes'],function(_0x2032d3){return{'name':_0x2032d3[_0x5a7b('0x2c')],'type':_0x2032d3[_0x5a7b('0x2d')][_0x5a7b('0x2e')]};});_0x36b90e[_0x5a7b('0x2f')]=_[_0x5a7b('0x2a')](_0x27b2cf,'name');_0x36b90e[_0x5a7b('0x30')]=_['keys'](_0x449cc7[_0x5a7b('0x30')]);_0x36b90e['filters']=_[_0x5a7b('0x31')](_0x36b90e[_0x5a7b('0x2f')],_0x36b90e[_0x5a7b('0x30')]);_0x54f1c6[_0x5a7b('0x32')]=_[_0x5a7b('0x31')](_0x36b90e[_0x5a7b('0x2f')],qs[_0x5a7b('0x33')](_0x449cc7['query'][_0x5a7b('0x33')]));_0x54f1c6['attributes']=_0x54f1c6[_0x5a7b('0x32')][_0x5a7b('0x34')]?_0x54f1c6[_0x5a7b('0x32')]:_0x36b90e[_0x5a7b('0x2f')];if(!_0x449cc7['query'][_0x5a7b('0x35')](_0x5a7b('0x36'))){_0x54f1c6[_0x5a7b('0x1f')]=qs[_0x5a7b('0x1f')](_0x449cc7['query'][_0x5a7b('0x1f')]);_0x54f1c6[_0x5a7b('0x1e')]=qs[_0x5a7b('0x1e')](_0x449cc7['query'][_0x5a7b('0x1e')]);}_0x54f1c6[_0x5a7b('0x37')]=qs[_0x5a7b('0x38')](_0x449cc7[_0x5a7b('0x30')]['sort']);_0x54f1c6[_0x5a7b('0x39')]=qs['filters'](_[_0x5a7b('0x3a')](_0x449cc7[_0x5a7b('0x30')],_0x36b90e[_0x5a7b('0x3b')]),_0x27b2cf);if(_0x449cc7['query'][_0x5a7b('0x3c')]){_0x54f1c6[_0x5a7b('0x39')]=_[_0x5a7b('0x3d')](_0x54f1c6[_0x5a7b('0x39')],{'$or':_[_0x5a7b('0x2a')](_0x27b2cf,function(_0x3bc002){if(_0x3bc002[_0x5a7b('0x2d')]!==_0x5a7b('0x3e')){var _0x2d1ea0={};_0x2d1ea0[_0x3bc002[_0x5a7b('0x28')]]={'$like':'%'+_0x449cc7['query']['filter']+'%'};return _0x2d1ea0;}})});}_0x54f1c6=_['merge']({},_0x54f1c6,_0x449cc7[_0x5a7b('0x3f')]);var _0x4e2708={'where':_0x54f1c6[_0x5a7b('0x39')]};return db['SquareMessage'][_0x5a7b('0x21')](_0x4e2708)[_0x5a7b('0x40')](function(_0x16c186){_0x3172a8[_0x5a7b('0x21')]=_0x16c186;if(_0x449cc7[_0x5a7b('0x30')]['includeAll']){_0x54f1c6[_0x5a7b('0x41')]=[{'all':!![]}];}return db[_0x5a7b('0x2b')][_0x5a7b('0x42')](_0x54f1c6);})['then'](function(_0x959137){_0x3172a8[_0x5a7b('0x43')]=_0x959137;return _0x3172a8;})[_0x5a7b('0x40')](respondWithFilteredResult(_0x169762,_0x54f1c6))[_0x5a7b('0x44')](handleError(_0x169762,null));};exports[_0x5a7b('0x45')]=function(_0x170838,_0x52f808){var _0x2a7ea9={'raw':!![],'where':{'id':_0x170838[_0x5a7b('0x46')]['id']}},_0x56aeca={};_0x56aeca['model']=_[_0x5a7b('0x47')](db['SquareMessage'][_0x5a7b('0x48')]);_0x56aeca[_0x5a7b('0x30')]=_['keys'](_0x170838['query']);_0x56aeca[_0x5a7b('0x3b')]=_['intersection'](_0x56aeca[_0x5a7b('0x2f')],_0x56aeca['query']);_0x2a7ea9['attributes']=_['intersection'](_0x56aeca[_0x5a7b('0x2f')],qs[_0x5a7b('0x33')](_0x170838[_0x5a7b('0x30')]['fields']));_0x2a7ea9[_0x5a7b('0x32')]=_0x2a7ea9[_0x5a7b('0x32')]['length']?_0x2a7ea9[_0x5a7b('0x32')]:_0x56aeca['model'];if(_0x170838[_0x5a7b('0x30')]['includeAll']){_0x2a7ea9['include']=[{'all':!![]}];}_0x2a7ea9=_[_0x5a7b('0x3d')]({},_0x2a7ea9,_0x170838[_0x5a7b('0x3f')]);return db[_0x5a7b('0x2b')][_0x5a7b('0x49')](_0x2a7ea9)[_0x5a7b('0x40')](handleEntityNotFound(_0x52f808,null))['then'](respondWithResult(_0x52f808,null))[_0x5a7b('0x44')](handleError(_0x52f808,null));};exports[_0x5a7b('0x4a')]=function(_0x1d64a2,_0x256a08){return db['SquareMessage']['create'](_0x1d64a2[_0x5a7b('0x4b')],{})['then'](respondWithResult(_0x256a08,0xc9))[_0x5a7b('0x44')](handleError(_0x256a08,null));};exports[_0x5a7b('0x4c')]=function(_0x34bd82,_0x52759c){if(_0x34bd82['body']['id']){delete _0x34bd82[_0x5a7b('0x4b')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x34bd82[_0x5a7b('0x46')]['id']}})[_0x5a7b('0x40')](handleEntityNotFound(_0x52759c,null))['then'](saveUpdates(_0x34bd82['body'],null))['then'](respondWithResult(_0x52759c,null))[_0x5a7b('0x44')](handleError(_0x52759c,null));};exports[_0x5a7b('0x4d')]=function(_0x5968bb,_0x207e7d){return db[_0x5a7b('0x2b')]['find']({'where':{'id':_0x5968bb[_0x5a7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x207e7d,null))[_0x5a7b('0x40')](removeEntity(_0x207e7d,null))[_0x5a7b('0x44')](handleError(_0x207e7d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6bca306..3735479 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 _0x14d0=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./squareMessage.attributes','define'];(function(_0x37bc10,_0x528f6f){var _0x10fff1=function(_0x295057){while(--_0x295057){_0x37bc10['push'](_0x37bc10['shift']());}};_0x10fff1(++_0x528f6f);}(_0x14d0,0x9c));var _0x014d=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x14d0[_0x2becba];return _0x90b5dd;};'use strict';var _=require(_0x014d('0x0'));var util=require(_0x014d('0x1'));var logger=require(_0x014d('0x2'))(_0x014d('0x3'));var moment=require(_0x014d('0x4'));var BPromise=require('bluebird');var rp=require(_0x014d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x014d('0x6'));var attributes=require(_0x014d('0x7'));module['exports']=function(_0x254451,_0x3f764b){return _0x254451[_0x014d('0x8')](_0x014d('0x9'),attributes,{'tableName':_0x014d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8884=['../../config/environment','./squareMessage.attributes','exports','SquareMessage','lodash','bluebird','request-promise','path','rimraf'];(function(_0x4fd95a,_0xec956c){var _0x290975=function(_0x5677ad){while(--_0x5677ad){_0x4fd95a['push'](_0x4fd95a['shift']());}};_0x290975(++_0xec956c);}(_0x8884,0x16c));var _0x4888=function(_0x2797a2,_0x18903c){_0x2797a2=_0x2797a2-0x0;var _0x4d1ea7=_0x8884[_0x2797a2];return _0x4d1ea7;};'use strict';var _=require(_0x4888('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4888('0x1'));var rp=require(_0x4888('0x2'));var fs=require('fs');var path=require(_0x4888('0x3'));var rimraf=require(_0x4888('0x4'));var config=require(_0x4888('0x5'));var attributes=require(_0x4888('0x6'));module[_0x4888('0x7')]=function(_0x3a8de7,_0x56ba77){return _0x3a8de7['define'](_0x4888('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 4d93242..89d7736 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 _0xaa4d=['options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','SquareMessage','create','body'];(function(_0x5e2144,_0x5ca2b3){var _0x891873=function(_0x2d6703){while(--_0x2d6703){_0x5e2144['push'](_0x5e2144['shift']());}};_0x891873(++_0x5ca2b3);}(_0xaa4d,0xfc));var _0xdaa4=function(_0x154a2b,_0x253064){_0x154a2b=_0x154a2b-0x0;var _0x3bdb5f=_0xaa4d[_0x154a2b];return _0x3bdb5f;};'use strict';var _=require(_0xdaa4('0x0'));var util=require(_0xdaa4('0x1'));var moment=require(_0xdaa4('0x2'));var BPromise=require(_0xdaa4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaa4('0x4'));var db=require(_0xdaa4('0x5'))['db'];var utils=require(_0xdaa4('0x6'));var logger=require(_0xdaa4('0x7'))(_0xdaa4('0x8'));var config=require('../../config/environment');var jayson=require(_0xdaa4('0x9'));var client=jayson[_0xdaa4('0xa')][_0xdaa4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x357699,_0x5969d3,_0x5ab5e7){return new BPromise(function(_0x2eeda4,_0x4a4b67){return client[_0xdaa4('0xc')](_0x357699,_0x5ab5e7)[_0xdaa4('0xd')](function(_0xb25198){logger[_0xdaa4('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5969d3,_0xdaa4('0xf'));logger[_0xdaa4('0x10')](_0xdaa4('0x11'),_0x5969d3,_0xdaa4('0xf'),JSON['stringify'](_0xb25198));if(_0xb25198[_0xdaa4('0x12')]){if(_0xb25198['error'][_0xdaa4('0x13')]===0x1f4){logger['error'](_0xdaa4('0x14'),_0x5969d3,_0xb25198['error'][_0xdaa4('0x15')]);return _0x4a4b67(_0xb25198[_0xdaa4('0x12')][_0xdaa4('0x15')]);}logger[_0xdaa4('0x12')](_0xdaa4('0x14'),_0x5969d3,_0xb25198[_0xdaa4('0x12')]['message']);return _0x2eeda4(_0xb25198[_0xdaa4('0x12')][_0xdaa4('0x15')]);}else{logger[_0xdaa4('0xe')](_0xdaa4('0x14'),_0x5969d3,_0xdaa4('0xf'));_0x2eeda4(_0xb25198[_0xdaa4('0x16')]['message']);}})['catch'](function(_0xc2c15c){logger['error'](_0xdaa4('0x14'),_0x5969d3,_0xc2c15c);_0x4a4b67(_0xc2c15c);});});}exports[_0xdaa4('0x17')]=function(_0x24c0d7){var _0x69b41e=this;return new Promise(function(_0x522363,_0x5c70ef){return db[_0xdaa4('0x18')][_0xdaa4('0x19')](_0x24c0d7[_0xdaa4('0x1a')],{'raw':_0x24c0d7[_0xdaa4('0x1b')]?_0x24c0d7[_0xdaa4('0x1b')][_0xdaa4('0x1c')]===undefined?!![]:![]:!![]})[_0xdaa4('0xd')](function(_0xf81e78){logger[_0xdaa4('0xe')](_0xdaa4('0x17'),_0x24c0d7);logger[_0xdaa4('0x10')](_0xdaa4('0x17'),_0x24c0d7,JSON[_0xdaa4('0x1d')](_0xf81e78));_0x522363(_0xf81e78);})[_0xdaa4('0x1e')](function(_0x5b0b11){logger[_0xdaa4('0x12')](_0xdaa4('0x17'),_0x5b0b11['message'],_0x24c0d7);_0x5c70ef(_0x69b41e[_0xdaa4('0x12')](0x1f4,_0x5b0b11[_0xdaa4('0x15')]));});});}; \ No newline at end of file +var _0xcaac=['rpc','../../config/environment','client','http','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4fba84,_0x25ac8f){var _0x25de57=function(_0x30c784){while(--_0x30c784){_0x4fba84['push'](_0x4fba84['shift']());}};_0x25de57(++_0x25ac8f);}(_0xcaac,0xfe));var _0xccaa=function(_0x4193fd,_0x240d67){_0x4193fd=_0x4193fd-0x0;var _0x1dd0de=_0xcaac[_0x4193fd];return _0x1dd0de;};'use strict';var _=require(_0xccaa('0x0'));var util=require(_0xccaa('0x1'));var moment=require(_0xccaa('0x2'));var BPromise=require(_0xccaa('0x3'));var rs=require(_0xccaa('0x4'));var fs=require('fs');var Redis=require(_0xccaa('0x5'));var db=require(_0xccaa('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xccaa('0x7'));var config=require(_0xccaa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xccaa('0x9')][_0xccaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4336,_0x5b65c5,_0x1389d6){return new BPromise(function(_0x5e44fe,_0x987f51){return client[_0xccaa('0xb')](_0x2e4336,_0x1389d6)['then'](function(_0x240c8c){logger['info'](_0xccaa('0xc'),_0x5b65c5,'request\x20sent');logger[_0xccaa('0xd')](_0xccaa('0xe'),_0x5b65c5,_0xccaa('0xf'),JSON[_0xccaa('0x10')](_0x240c8c));if(_0x240c8c[_0xccaa('0x11')]){if(_0x240c8c[_0xccaa('0x11')]['code']===0x1f4){logger[_0xccaa('0x11')](_0xccaa('0xc'),_0x5b65c5,_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);return _0x987f51(_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);}logger[_0xccaa('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5b65c5,_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);return _0x5e44fe(_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);}else{logger[_0xccaa('0x13')](_0xccaa('0xc'),_0x5b65c5,'request\x20sent');_0x5e44fe(_0x240c8c[_0xccaa('0x14')][_0xccaa('0x12')]);}})[_0xccaa('0x15')](function(_0x18153b){logger['error'](_0xccaa('0xc'),_0x5b65c5,_0x18153b);_0x987f51(_0x18153b);});});}exports[_0xccaa('0x16')]=function(_0x3fb3b3){var _0x2c7a66=this;return new Promise(function(_0x1b76be,_0x10580c){return db[_0xccaa('0x17')][_0xccaa('0x18')](_0x3fb3b3[_0xccaa('0x19')],{'raw':_0x3fb3b3['options']?_0x3fb3b3[_0xccaa('0x1a')][_0xccaa('0x1b')]===undefined?!![]:![]:!![]})[_0xccaa('0x1c')](function(_0x54556d){logger[_0xccaa('0x13')](_0xccaa('0x16'),_0x3fb3b3);logger[_0xccaa('0xd')](_0xccaa('0x16'),_0x3fb3b3,JSON[_0xccaa('0x10')](_0x54556d));_0x1b76be(_0x54556d);})[_0xccaa('0x15')](function(_0x3c279d){logger[_0xccaa('0x11')](_0xccaa('0x16'),_0x3c279d[_0xccaa('0x12')],_0x3fb3b3);_0x10580c(_0x2c7a66[_0xccaa('0x11')](0x1f4,_0x3c279d[_0xccaa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 039ef5e..8b0005e 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 _0x563d=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','15s','test','post','create','put'];(function(_0x1dc2ab,_0x215934){var _0x392640=function(_0x118c73){while(--_0x118c73){_0x1dc2ab['push'](_0x1dc2ab['shift']());}};_0x392640(++_0x215934);}(_0x563d,0x9f));var _0xd563=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x563d[_0x1b6311];return _0x25aab6;};'use strict';var multer=require(_0xd563('0x0'));var util=require('util');var path=require(_0xd563('0x1'));var timeout=require(_0xd563('0x2'));var express=require(_0xd563('0x3'));var router=express[_0xd563('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd563('0x5'));var config=require(_0xd563('0x6'));var controller=require(_0xd563('0x7'));router[_0xd563('0x8')]('/',auth[_0xd563('0x9')](),controller['index']);router[_0xd563('0x8')]('/:id',auth[_0xd563('0x9')](),controller[_0xd563('0xa')]);router[_0xd563('0x8')](_0xd563('0xb'),auth[_0xd563('0x9')](),timeout(_0xd563('0xc')),controller[_0xd563('0xd')]);router[_0xd563('0xe')]('/',auth[_0xd563('0x9')](),controller[_0xd563('0xf')]);router[_0xd563('0x10')](_0xd563('0x11'),auth[_0xd563('0x9')](),controller[_0xd563('0x12')]);router[_0xd563('0x13')]('/:id',auth[_0xd563('0x9')](),controller[_0xd563('0x14')]);module[_0xd563('0x15')]=router; \ No newline at end of file +var _0x00d7=['fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','get','/:id/test','15s','test','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x593bce,_0x484075){var _0x4f56c9=function(_0x583a02){while(--_0x583a02){_0x593bce['push'](_0x593bce['shift']());}};_0x4f56c9(++_0x484075);}(_0x00d7,0x7f));var _0x700d=function(_0xa6be5f,_0x279bea){_0xa6be5f=_0xa6be5f-0x0;var _0x3f88e6=_0x00d7[_0xa6be5f];return _0x3f88e6;};'use strict';var multer=require(_0x700d('0x0'));var util=require(_0x700d('0x1'));var path=require(_0x700d('0x2'));var timeout=require(_0x700d('0x3'));var express=require('express');var router=express[_0x700d('0x4')]();var fs_extra=require(_0x700d('0x5'));var auth=require(_0x700d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x700d('0x7'));var controller=require(_0x700d('0x8'));router['get']('/',auth[_0x700d('0x9')](),controller[_0x700d('0xa')]);router['get'](_0x700d('0xb'),auth[_0x700d('0x9')](),controller['show']);router[_0x700d('0xc')](_0x700d('0xd'),auth[_0x700d('0x9')](),timeout(_0x700d('0xe')),controller[_0x700d('0xf')]);router[_0x700d('0x10')]('/',auth['isAuthenticated'](),controller[_0x700d('0x11')]);router[_0x700d('0x12')](_0x700d('0xb'),auth[_0x700d('0x9')](),controller['update']);router[_0x700d('0x13')](_0x700d('0xb'),auth[_0x700d('0x9')](),controller[_0x700d('0x14')]);module[_0x700d('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 89155db..356853f 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 _0x982e=['STRING','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x982e,0x139));var _0xe982=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x982e[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0xe982('0x0')]={'name':{'type':Sequelize[_0xe982('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xe982('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf274=['exports','STRING','sequelize'];(function(_0x48c06c,_0x4a9cc7){var _0x3f6e36=function(_0x487a5f){while(--_0x487a5f){_0x48c06c['push'](_0x48c06c['shift']());}};_0x3f6e36(++_0x4a9cc7);}(_0xf274,0x1f4));var _0x4f27=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf274[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x4f27('0x0'));module[_0x4f27('0x1')]={'name':{'type':Sequelize[_0x4f27('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x4f27('0x2')]},'description':{'type':Sequelize[_0x4f27('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0e2722c..81b163f 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 _0x0ea9=['filter','options','includeAll','include','SquareOdbc','findAll','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','type','VIRTUAL'];(function(_0x44fb56,_0x2eeed5){var _0x1727ba=function(_0x305a47){while(--_0x305a47){_0x44fb56['push'](_0x44fb56['shift']());}};_0x1727ba(++_0x2eeed5);}(_0x0ea9,0x6e));var _0x90ea=function(_0xe0ed82,_0x2a75f2){_0xe0ed82=_0xe0ed82-0x0;var _0x3da705=_0x0ea9[_0xe0ed82];return _0x3da705;};'use strict';var emlformat=require(_0x90ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90ea('0x2'));var moment=require('moment');var BPromise=require(_0x90ea('0x3'));var Mustache=require(_0x90ea('0x4'));var util=require(_0x90ea('0x5'));var path=require(_0x90ea('0x6'));var sox=require(_0x90ea('0x7'));var csv=require(_0x90ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90ea('0x9'));var _=require(_0x90ea('0xa'));var squel=require(_0x90ea('0xb'));var crypto=require(_0x90ea('0xc'));var jsforce=require(_0x90ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x90ea('0x8'));var querystring=require(_0x90ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x90ea('0xf'));var authService=require(_0x90ea('0x10'));var qs=require(_0x90ea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90ea('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x90ea('0x13'));var config=require(_0x90ea('0x14'));var licenseUtil=require(_0x90ea('0x15'));var db=require(_0x90ea('0x16'))['db'];function respondWithStatusCode(_0x5947cb,_0x3aa972){_0x3aa972=_0x3aa972||0xcc;return function(_0x18d380){if(_0x18d380){return _0x5947cb[_0x90ea('0x17')](_0x3aa972);}return _0x5947cb[_0x90ea('0x18')](_0x3aa972)[_0x90ea('0x19')]();};}function respondWithResult(_0x4ea048,_0x402b0f){_0x402b0f=_0x402b0f||0xc8;return function(_0x240125){if(_0x240125){return _0x4ea048[_0x90ea('0x18')](_0x402b0f)[_0x90ea('0x1a')](_0x240125);}};}function respondWithFilteredResult(_0x2afbc2,_0x43a749){return function(_0x4db663){if(_0x4db663){var _0x146a39=typeof _0x43a749[_0x90ea('0x1b')]===_0x90ea('0x1c')&&typeof _0x43a749['limit']===_0x90ea('0x1c');var _0x48eedd=_0x4db663[_0x90ea('0x1d')];var _0x5a4029=_0x146a39?0x0:_0x43a749[_0x90ea('0x1b')];var _0xee9d30=_0x146a39?_0x4db663[_0x90ea('0x1d')]:_0x43a749[_0x90ea('0x1b')]+_0x43a749['limit'];var _0x610193;if(_0xee9d30>=_0x48eedd){_0xee9d30=_0x48eedd;_0x610193=0xc8;}else{_0x610193=0xce;}_0x2afbc2[_0x90ea('0x18')](_0x610193);return _0x2afbc2[_0x90ea('0x1e')](_0x90ea('0x1f'),_0x5a4029+'-'+_0xee9d30+'/'+_0x48eedd)[_0x90ea('0x1a')](_0x4db663);}return null;};}function patchUpdates(_0x3e9689){return function(_0x1bc326){try{jsonpatch['apply'](_0x1bc326,_0x3e9689,!![]);}catch(_0x128293){return BPromise[_0x90ea('0x20')](_0x128293);}return _0x1bc326[_0x90ea('0x21')]();};}function saveUpdates(_0x50fd50,_0xb695e2){return function(_0x439866){if(_0x439866){return _0x439866[_0x90ea('0x22')](_0x50fd50)[_0x90ea('0x23')](function(_0x248c0a){return _0x248c0a;});}return null;};}function removeEntity(_0x4a9a71,_0x587809){return function(_0x507d7a){if(_0x507d7a){return _0x507d7a['destroy']()[_0x90ea('0x23')](function(){var _0x5449fa=_0x507d7a[_0x90ea('0x24')]({'plain':!![]});var _0x24e695='ODBC';return db[_0x90ea('0x25')]['destroy']({'where':{'type':_0x24e695,'resourceId':_0x5449fa['id']}})[_0x90ea('0x23')](function(){return _0x507d7a;});})[_0x90ea('0x23')](function(){_0x4a9a71[_0x90ea('0x18')](0xcc)[_0x90ea('0x19')]();});}};}function handleEntityNotFound(_0x30a624,_0x1a88a9){return function(_0x1c97f4){if(!_0x1c97f4){_0x30a624[_0x90ea('0x17')](0x194);}return _0x1c97f4;};}function handleError(_0x1c54c5,_0xfd5756){_0xfd5756=_0xfd5756||0x1f4;return function(_0x1f9247){logger[_0x90ea('0x26')](_0x1f9247[_0x90ea('0x27')]);if(_0x1f9247[_0x90ea('0x28')]){delete _0x1f9247[_0x90ea('0x28')];}_0x1c54c5['status'](_0xfd5756)[_0x90ea('0x29')](_0x1f9247);};}exports[_0x90ea('0x2a')]=function(_0x10926a,_0x535082){var _0x551f61={},_0x69ff7f={},_0x2081aa={'count':0x0,'rows':[]};var _0x1813ad=_['map'](db['SquareOdbc'][_0x90ea('0x2b')],function(_0x3caefb){return{'name':_0x3caefb['fieldName'],'type':_0x3caefb['type'][_0x90ea('0x2c')]};});_0x69ff7f[_0x90ea('0x2d')]=_[_0x90ea('0x2e')](_0x1813ad,'name');_0x69ff7f[_0x90ea('0x2f')]=_[_0x90ea('0x30')](_0x10926a['query']);_0x69ff7f['filters']=_['intersection'](_0x69ff7f[_0x90ea('0x2d')],_0x69ff7f[_0x90ea('0x2f')]);_0x551f61['attributes']=_[_0x90ea('0x31')](_0x69ff7f[_0x90ea('0x2d')],qs[_0x90ea('0x32')](_0x10926a['query']['fields']));_0x551f61[_0x90ea('0x33')]=_0x551f61['attributes'][_0x90ea('0x34')]?_0x551f61[_0x90ea('0x33')]:_0x69ff7f[_0x90ea('0x2d')];if(!_0x10926a['query'][_0x90ea('0x35')](_0x90ea('0x36'))){_0x551f61['limit']=qs[_0x90ea('0x37')](_0x10926a[_0x90ea('0x2f')][_0x90ea('0x37')]);_0x551f61[_0x90ea('0x1b')]=qs[_0x90ea('0x1b')](_0x10926a['query'][_0x90ea('0x1b')]);}_0x551f61[_0x90ea('0x38')]=qs['sort'](_0x10926a[_0x90ea('0x2f')][_0x90ea('0x39')]);_0x551f61['where']=qs[_0x90ea('0x3a')](_[_0x90ea('0x3b')](_0x10926a[_0x90ea('0x2f')],_0x69ff7f[_0x90ea('0x3a')]),_0x1813ad);if(_0x10926a['query']['filter']){_0x551f61[_0x90ea('0x3c')]=_[_0x90ea('0x3d')](_0x551f61[_0x90ea('0x3c')],{'$or':_[_0x90ea('0x2e')](_0x1813ad,function(_0x4830d4){if(_0x4830d4[_0x90ea('0x3e')]!==_0x90ea('0x3f')){var _0x651481={};_0x651481[_0x4830d4[_0x90ea('0x28')]]={'$like':'%'+_0x10926a[_0x90ea('0x2f')][_0x90ea('0x40')]+'%'};return _0x651481;}})});}_0x551f61=_[_0x90ea('0x3d')]({},_0x551f61,_0x10926a[_0x90ea('0x41')]);var _0x10ee3d={'where':_0x551f61[_0x90ea('0x3c')]};return db['SquareOdbc'][_0x90ea('0x1d')](_0x10ee3d)[_0x90ea('0x23')](function(_0x4b40e1){_0x2081aa['count']=_0x4b40e1;if(_0x10926a[_0x90ea('0x2f')][_0x90ea('0x42')]){_0x551f61[_0x90ea('0x43')]=[{'all':!![]}];}return db[_0x90ea('0x44')][_0x90ea('0x45')](_0x551f61);})[_0x90ea('0x23')](function(_0x33003b){_0x2081aa[_0x90ea('0x46')]=_0x33003b;return _0x2081aa;})[_0x90ea('0x23')](respondWithFilteredResult(_0x535082,_0x551f61))[_0x90ea('0x47')](handleError(_0x535082,null));};exports[_0x90ea('0x48')]=function(_0x5a19b9,_0xa601c9){var _0x27f19d={'raw':!![],'where':{'id':_0x5a19b9[_0x90ea('0x49')]['id']}},_0x2d8241={};_0x2d8241[_0x90ea('0x2d')]=_[_0x90ea('0x30')](db[_0x90ea('0x44')][_0x90ea('0x2b')]);_0x2d8241[_0x90ea('0x2f')]=_['keys'](_0x5a19b9[_0x90ea('0x2f')]);_0x2d8241[_0x90ea('0x3a')]=_[_0x90ea('0x31')](_0x2d8241[_0x90ea('0x2d')],_0x2d8241[_0x90ea('0x2f')]);_0x27f19d['attributes']=_[_0x90ea('0x31')](_0x2d8241[_0x90ea('0x2d')],qs[_0x90ea('0x32')](_0x5a19b9[_0x90ea('0x2f')][_0x90ea('0x32')]));_0x27f19d[_0x90ea('0x33')]=_0x27f19d[_0x90ea('0x33')]['length']?_0x27f19d[_0x90ea('0x33')]:_0x2d8241[_0x90ea('0x2d')];if(_0x5a19b9[_0x90ea('0x2f')][_0x90ea('0x42')]){_0x27f19d[_0x90ea('0x43')]=[{'all':!![]}];}_0x27f19d=_[_0x90ea('0x3d')]({},_0x27f19d,_0x5a19b9['options']);return db['SquareOdbc'][_0x90ea('0x4a')](_0x27f19d)[_0x90ea('0x23')](handleEntityNotFound(_0xa601c9,null))[_0x90ea('0x23')](respondWithResult(_0xa601c9,null))[_0x90ea('0x47')](handleError(_0xa601c9,null));};exports['create']=function(_0x4fa752,_0x175150){return db[_0x90ea('0x44')][_0x90ea('0x4b')](_0x4fa752['body'],{})[_0x90ea('0x23')](function(_0x13da3f){var _0x1d84dc=_0x4fa752[_0x90ea('0x4c')][_0x90ea('0x24')]({'plain':!![]});if(!_0x1d84dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d84dc['role']===_0x90ea('0x4c')){var _0x5e58b6=_0x13da3f[_0x90ea('0x24')]({'plain':!![]});var _0x62e60c='ODBC';return db[_0x90ea('0x4d')][_0x90ea('0x4a')]({'where':{'name':_0x62e60c,'userProfileId':_0x1d84dc[_0x90ea('0x4e')]},'raw':!![]})[_0x90ea('0x23')](function(_0x56a51e){if(_0x56a51e&&_0x56a51e[_0x90ea('0x4f')]===0x0){return db[_0x90ea('0x25')][_0x90ea('0x4b')]({'name':_0x5e58b6['name'],'resourceId':_0x5e58b6['id'],'type':_0x56a51e[_0x90ea('0x28')],'sectionId':_0x56a51e['id']},{})[_0x90ea('0x23')](function(){return _0x13da3f;});}else{return _0x13da3f;}})[_0x90ea('0x47')](function(_0x496e25){logger[_0x90ea('0x26')](_0x90ea('0x50'),_0x496e25);throw _0x496e25;});}return _0x13da3f;})[_0x90ea('0x23')](respondWithResult(_0x175150,0xc9))['catch'](handleError(_0x175150,null));};exports[_0x90ea('0x22')]=function(_0x3252a9,_0x5113f7){if(_0x3252a9[_0x90ea('0x51')]['id']){delete _0x3252a9['body']['id'];}return db[_0x90ea('0x44')][_0x90ea('0x4a')]({'where':{'id':_0x3252a9[_0x90ea('0x49')]['id']}})[_0x90ea('0x23')](handleEntityNotFound(_0x5113f7,null))[_0x90ea('0x23')](saveUpdates(_0x3252a9[_0x90ea('0x51')],null))[_0x90ea('0x23')](respondWithResult(_0x5113f7,null))[_0x90ea('0x47')](handleError(_0x5113f7,null));};exports['destroy']=function(_0x23176c,_0x28f0a2){return db['SquareOdbc'][_0x90ea('0x4a')]({'where':{'id':_0x23176c['params']['id']}})[_0x90ea('0x23')](handleEntityNotFound(_0x28f0a2,null))[_0x90ea('0x23')](removeEntity(_0x28f0a2,null))[_0x90ea('0x47')](handleError(_0x28f0a2,null));};exports[_0x90ea('0x52')]=function(_0x24d26e,_0x463511,_0x45b41b){var _0xa10380;return db[_0x90ea('0x44')][_0x90ea('0x4a')]({'where':{'id':_0x24d26e[_0x90ea('0x49')]['id']},'attributes':['id',_0x90ea('0x53')]})[_0x90ea('0x23')](handleEntityNotFound(_0x463511,null))[_0x90ea('0x23')](function(_0x48dd2a){if(_0x48dd2a){var _0x4c281c=require(_0x90ea('0x54'))();_0x4c281c[_0x90ea('0x55')](_0x48dd2a[_0x90ea('0x53')]);_0x4c281c[_0x90ea('0x56')]();return _0x48dd2a;}})[_0x90ea('0x23')](respondWithResult(_0x463511,null))[_0x90ea('0x47')](handleError(_0x463511,null));}; \ No newline at end of file +var _0x3e44=['set','Content-Range','apply','update','then','destroy','get','ODBC','error','stack','name','send','map','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x2f0bed,_0x4911f1){var _0x31fa87=function(_0x1de2fc){while(--_0x1de2fc){_0x2f0bed['push'](_0x2f0bed['shift']());}};_0x31fa87(++_0x4911f1);}(_0x3e44,0x91));var _0x43e4=function(_0xbabd64,_0x141131){_0xbabd64=_0xbabd64-0x0;var _0xc95730=_0x3e44[_0xbabd64];return _0xc95730;};'use strict';var emlformat=require(_0x43e4('0x0'));var rimraf=require(_0x43e4('0x1'));var zipdir=require(_0x43e4('0x2'));var jsonpatch=require(_0x43e4('0x3'));var rp=require('request-promise');var moment=require(_0x43e4('0x4'));var BPromise=require(_0x43e4('0x5'));var Mustache=require(_0x43e4('0x6'));var util=require('util');var path=require(_0x43e4('0x7'));var sox=require(_0x43e4('0x8'));var csv=require(_0x43e4('0x9'));var ejs=require(_0x43e4('0xa'));var fs=require('fs');var fs_extra=require(_0x43e4('0xb'));var _=require('lodash');var squel=require(_0x43e4('0xc'));var crypto=require(_0x43e4('0xd'));var jsforce=require(_0x43e4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x43e4('0x9'));var querystring=require(_0x43e4('0xf'));var Papa=require('papaparse');var Redis=require(_0x43e4('0x10'));var authService=require(_0x43e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x43e4('0x12'));var hardwareService=require(_0x43e4('0x13'));var logger=require(_0x43e4('0x14'))(_0x43e4('0x15'));var utils=require(_0x43e4('0x16'));var config=require(_0x43e4('0x17'));var licenseUtil=require(_0x43e4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c33e,_0xbdcd3d){_0xbdcd3d=_0xbdcd3d||0xcc;return function(_0x526c67){if(_0x526c67){return _0x14c33e[_0x43e4('0x19')](_0xbdcd3d);}return _0x14c33e[_0x43e4('0x1a')](_0xbdcd3d)[_0x43e4('0x1b')]();};}function respondWithResult(_0x2622b4,_0x5073a9){_0x5073a9=_0x5073a9||0xc8;return function(_0x3ab2a9){if(_0x3ab2a9){return _0x2622b4[_0x43e4('0x1a')](_0x5073a9)[_0x43e4('0x1c')](_0x3ab2a9);}};}function respondWithFilteredResult(_0x4d4652,_0x15693f){return function(_0x2275c7){if(_0x2275c7){var _0x4eef31=typeof _0x15693f[_0x43e4('0x1d')]==='undefined'&&typeof _0x15693f[_0x43e4('0x1e')]===_0x43e4('0x1f');var _0x589ad5=_0x2275c7[_0x43e4('0x20')];var _0x1ecd74=_0x4eef31?0x0:_0x15693f['offset'];var _0xb6274b=_0x4eef31?_0x2275c7[_0x43e4('0x20')]:_0x15693f[_0x43e4('0x1d')]+_0x15693f[_0x43e4('0x1e')];var _0x44a51a;if(_0xb6274b>=_0x589ad5){_0xb6274b=_0x589ad5;_0x44a51a=0xc8;}else{_0x44a51a=0xce;}_0x4d4652['status'](_0x44a51a);return _0x4d4652[_0x43e4('0x21')](_0x43e4('0x22'),_0x1ecd74+'-'+_0xb6274b+'/'+_0x589ad5)[_0x43e4('0x1c')](_0x2275c7);}return null;};}function patchUpdates(_0x4daa9e){return function(_0x286914){try{jsonpatch[_0x43e4('0x23')](_0x286914,_0x4daa9e,!![]);}catch(_0x25676f){return BPromise['reject'](_0x25676f);}return _0x286914['save']();};}function saveUpdates(_0x4f6c33,_0x1639ae){return function(_0x54e065){if(_0x54e065){return _0x54e065[_0x43e4('0x24')](_0x4f6c33)[_0x43e4('0x25')](function(_0xdc2ca1){return _0xdc2ca1;});}return null;};}function removeEntity(_0x56d32a,_0x446c80){return function(_0x2b6356){if(_0x2b6356){return _0x2b6356[_0x43e4('0x26')]()[_0x43e4('0x25')](function(){var _0x4cca0c=_0x2b6356[_0x43e4('0x27')]({'plain':!![]});var _0x530b4=_0x43e4('0x28');return db['UserProfileResource'][_0x43e4('0x26')]({'where':{'type':_0x530b4,'resourceId':_0x4cca0c['id']}})[_0x43e4('0x25')](function(){return _0x2b6356;});})[_0x43e4('0x25')](function(){_0x56d32a[_0x43e4('0x1a')](0xcc)[_0x43e4('0x1b')]();});}};}function handleEntityNotFound(_0x58a24d,_0x17feb1){return function(_0x4aa945){if(!_0x4aa945){_0x58a24d[_0x43e4('0x19')](0x194);}return _0x4aa945;};}function handleError(_0xc05e95,_0x5a46f4){_0x5a46f4=_0x5a46f4||0x1f4;return function(_0x111014){logger[_0x43e4('0x29')](_0x111014[_0x43e4('0x2a')]);if(_0x111014[_0x43e4('0x2b')]){delete _0x111014[_0x43e4('0x2b')];}_0xc05e95[_0x43e4('0x1a')](_0x5a46f4)[_0x43e4('0x2c')](_0x111014);};}exports['index']=function(_0x56cee6,_0x2d9e5f){var _0x2177e4={},_0x12ae15={},_0x36cf42={'count':0x0,'rows':[]};var _0x5c0f31=_[_0x43e4('0x2d')](db['SquareOdbc']['rawAttributes'],function(_0x3eae9f){return{'name':_0x3eae9f[_0x43e4('0x2e')],'type':_0x3eae9f[_0x43e4('0x2f')][_0x43e4('0x30')]};});_0x12ae15[_0x43e4('0x31')]=_[_0x43e4('0x2d')](_0x5c0f31,'name');_0x12ae15['query']=_['keys'](_0x56cee6[_0x43e4('0x32')]);_0x12ae15['filters']=_[_0x43e4('0x33')](_0x12ae15[_0x43e4('0x31')],_0x12ae15[_0x43e4('0x32')]);_0x2177e4['attributes']=_[_0x43e4('0x33')](_0x12ae15['model'],qs[_0x43e4('0x34')](_0x56cee6[_0x43e4('0x32')][_0x43e4('0x34')]));_0x2177e4['attributes']=_0x2177e4[_0x43e4('0x35')][_0x43e4('0x36')]?_0x2177e4[_0x43e4('0x35')]:_0x12ae15['model'];if(!_0x56cee6[_0x43e4('0x32')][_0x43e4('0x37')](_0x43e4('0x38'))){_0x2177e4[_0x43e4('0x1e')]=qs[_0x43e4('0x1e')](_0x56cee6['query'][_0x43e4('0x1e')]);_0x2177e4['offset']=qs['offset'](_0x56cee6[_0x43e4('0x32')][_0x43e4('0x1d')]);}_0x2177e4[_0x43e4('0x39')]=qs['sort'](_0x56cee6[_0x43e4('0x32')][_0x43e4('0x3a')]);_0x2177e4[_0x43e4('0x3b')]=qs[_0x43e4('0x3c')](_[_0x43e4('0x3d')](_0x56cee6['query'],_0x12ae15[_0x43e4('0x3c')]),_0x5c0f31);if(_0x56cee6[_0x43e4('0x32')][_0x43e4('0x3e')]){_0x2177e4[_0x43e4('0x3b')]=_['merge'](_0x2177e4[_0x43e4('0x3b')],{'$or':_[_0x43e4('0x2d')](_0x5c0f31,function(_0x4cfb82){if(_0x4cfb82[_0x43e4('0x2f')]!==_0x43e4('0x3f')){var _0x552896={};_0x552896[_0x4cfb82[_0x43e4('0x2b')]]={'$like':'%'+_0x56cee6[_0x43e4('0x32')][_0x43e4('0x3e')]+'%'};return _0x552896;}})});}_0x2177e4=_[_0x43e4('0x40')]({},_0x2177e4,_0x56cee6[_0x43e4('0x41')]);var _0x543740={'where':_0x2177e4[_0x43e4('0x3b')]};return db[_0x43e4('0x42')][_0x43e4('0x20')](_0x543740)[_0x43e4('0x25')](function(_0x4b55b9){_0x36cf42[_0x43e4('0x20')]=_0x4b55b9;if(_0x56cee6['query'][_0x43e4('0x43')]){_0x2177e4[_0x43e4('0x44')]=[{'all':!![]}];}return db[_0x43e4('0x42')][_0x43e4('0x45')](_0x2177e4);})[_0x43e4('0x25')](function(_0x421ab5){_0x36cf42[_0x43e4('0x46')]=_0x421ab5;return _0x36cf42;})[_0x43e4('0x25')](respondWithFilteredResult(_0x2d9e5f,_0x2177e4))[_0x43e4('0x47')](handleError(_0x2d9e5f,null));};exports[_0x43e4('0x48')]=function(_0x105d26,_0x14eaab){var _0x190651={'raw':!![],'where':{'id':_0x105d26['params']['id']}},_0x59bb2e={};_0x59bb2e[_0x43e4('0x31')]=_[_0x43e4('0x49')](db['SquareOdbc']['rawAttributes']);_0x59bb2e[_0x43e4('0x32')]=_[_0x43e4('0x49')](_0x105d26[_0x43e4('0x32')]);_0x59bb2e['filters']=_['intersection'](_0x59bb2e[_0x43e4('0x31')],_0x59bb2e['query']);_0x190651[_0x43e4('0x35')]=_[_0x43e4('0x33')](_0x59bb2e[_0x43e4('0x31')],qs[_0x43e4('0x34')](_0x105d26[_0x43e4('0x32')][_0x43e4('0x34')]));_0x190651[_0x43e4('0x35')]=_0x190651['attributes'][_0x43e4('0x36')]?_0x190651['attributes']:_0x59bb2e[_0x43e4('0x31')];if(_0x105d26[_0x43e4('0x32')][_0x43e4('0x43')]){_0x190651['include']=[{'all':!![]}];}_0x190651=_[_0x43e4('0x40')]({},_0x190651,_0x105d26['options']);return db[_0x43e4('0x42')][_0x43e4('0x4a')](_0x190651)[_0x43e4('0x25')](handleEntityNotFound(_0x14eaab,null))['then'](respondWithResult(_0x14eaab,null))[_0x43e4('0x47')](handleError(_0x14eaab,null));};exports[_0x43e4('0x4b')]=function(_0x1937f3,_0x36b4c2){return db['SquareOdbc'][_0x43e4('0x4b')](_0x1937f3['body'],{})['then'](function(_0x47e548){var _0x33054b=_0x1937f3[_0x43e4('0x4c')]['get']({'plain':!![]});if(!_0x33054b)throw new Error(_0x43e4('0x4d'));if(_0x33054b['role']===_0x43e4('0x4c')){var _0x78dad5=_0x47e548['get']({'plain':!![]});var _0x4b4ab0=_0x43e4('0x28');return db['UserProfileSection'][_0x43e4('0x4a')]({'where':{'name':_0x4b4ab0,'userProfileId':_0x33054b[_0x43e4('0x4e')]},'raw':!![]})['then'](function(_0x5e491a){if(_0x5e491a&&_0x5e491a[_0x43e4('0x4f')]===0x0){return db[_0x43e4('0x50')][_0x43e4('0x4b')]({'name':_0x78dad5[_0x43e4('0x2b')],'resourceId':_0x78dad5['id'],'type':_0x5e491a['name'],'sectionId':_0x5e491a['id']},{})[_0x43e4('0x25')](function(){return _0x47e548;});}else{return _0x47e548;}})[_0x43e4('0x47')](function(_0x4024f9){logger[_0x43e4('0x29')](_0x43e4('0x51'),_0x4024f9);throw _0x4024f9;});}return _0x47e548;})[_0x43e4('0x25')](respondWithResult(_0x36b4c2,0xc9))[_0x43e4('0x47')](handleError(_0x36b4c2,null));};exports[_0x43e4('0x24')]=function(_0x49b66e,_0x2fd7bf){if(_0x49b66e['body']['id']){delete _0x49b66e[_0x43e4('0x52')]['id'];}return db[_0x43e4('0x42')]['find']({'where':{'id':_0x49b66e[_0x43e4('0x53')]['id']}})['then'](handleEntityNotFound(_0x2fd7bf,null))[_0x43e4('0x25')](saveUpdates(_0x49b66e[_0x43e4('0x52')],null))[_0x43e4('0x25')](respondWithResult(_0x2fd7bf,null))['catch'](handleError(_0x2fd7bf,null));};exports['destroy']=function(_0x5842bf,_0x5d7f9e){return db[_0x43e4('0x42')][_0x43e4('0x4a')]({'where':{'id':_0x5842bf[_0x43e4('0x53')]['id']}})[_0x43e4('0x25')](handleEntityNotFound(_0x5d7f9e,null))['then'](removeEntity(_0x5d7f9e,null))['catch'](handleError(_0x5d7f9e,null));};exports[_0x43e4('0x54')]=function(_0x46ade6,_0xe25861,_0x242cae){var _0x3b2eea;return db[_0x43e4('0x42')][_0x43e4('0x4a')]({'where':{'id':_0x46ade6[_0x43e4('0x53')]['id']},'attributes':['id','dsn']})[_0x43e4('0x25')](handleEntityNotFound(_0xe25861,null))[_0x43e4('0x25')](function(_0x18cfdb){if(_0x18cfdb){var _0x301073=require(_0x43e4('0x55'))();_0x301073[_0x43e4('0x56')](_0x18cfdb[_0x43e4('0x57')]);_0x301073[_0x43e4('0x58')]();return _0x18cfdb;}})[_0x43e4('0x25')](respondWithResult(_0xe25861,null))[_0x43e4('0x47')](handleError(_0xe25861,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9659caa..2af1d09 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 _0x200b=['request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x22d750,_0x336355){var _0x4ed6be=function(_0x5eda57){while(--_0x5eda57){_0x22d750['push'](_0x22d750['shift']());}};_0x4ed6be(++_0x336355);}(_0x200b,0x159));var _0xb200=function(_0x72d025,_0x5eecc8){_0x72d025=_0x72d025-0x0;var _0x2d5e53=_0x200b[_0x72d025];return _0x2d5e53;};'use strict';var _=require(_0xb200('0x0'));var util=require(_0xb200('0x1'));var logger=require(_0xb200('0x2'))(_0xb200('0x3'));var moment=require(_0xb200('0x4'));var BPromise=require(_0xb200('0x5'));var rp=require(_0xb200('0x6'));var fs=require('fs');var path=require(_0xb200('0x7'));var rimraf=require('rimraf');var config=require(_0xb200('0x8'));var attributes=require(_0xb200('0x9'));module[_0xb200('0xa')]=function(_0x1c036c,_0x44b6aa){return _0x1c036c[_0xb200('0xb')](_0xb200('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79cf=['api','bluebird','request-promise','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x1f6e13,_0x20443d){var _0x59955b=function(_0x1987ad){while(--_0x1987ad){_0x1f6e13['push'](_0x1f6e13['shift']());}};_0x59955b(++_0x20443d);}(_0x79cf,0x101));var _0xf79c=function(_0x3b3840,_0x438322){_0x3b3840=_0x3b3840-0x0;var _0x1f604c=_0x79cf[_0x3b3840];return _0x1f604c;};'use strict';var _=require(_0xf79c('0x0'));var util=require(_0xf79c('0x1'));var logger=require(_0xf79c('0x2'))(_0xf79c('0x3'));var moment=require('moment');var BPromise=require(_0xf79c('0x4'));var rp=require(_0xf79c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xf79c('0x6')]=function(_0x6e80de,_0x57a364){return _0x6e80de[_0xf79c('0x7')](_0xf79c('0x8'),attributes,{'tableName':_0xf79c('0x9'),'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 e598b1f..bd4440e 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 _0x1984=['message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x29f5b4,_0x2ca4fb){var _0x41a06f=function(_0x519336){while(--_0x519336){_0x29f5b4['push'](_0x29f5b4['shift']());}};_0x41a06f(++_0x2ca4fb);}(_0x1984,0xf4));var _0x4198=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1984[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x4198('0x0'));var moment=require(_0x4198('0x1'));var BPromise=require(_0x4198('0x2'));var rs=require(_0x4198('0x3'));var fs=require('fs');var Redis=require(_0x4198('0x4'));var db=require(_0x4198('0x5'))['db'];var utils=require(_0x4198('0x6'));var logger=require(_0x4198('0x7'))(_0x4198('0x8'));var config=require(_0x4198('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4198('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3d40,_0x7ecdd,_0x4ccd3e){return new BPromise(function(_0x441618,_0x2e9b4b){return client[_0x4198('0xb')](_0x1d3d40,_0x4ccd3e)['then'](function(_0x46f0c4){logger[_0x4198('0xc')](_0x4198('0xd'),_0x7ecdd,'request\x20sent');logger['debug'](_0x4198('0xe'),_0x7ecdd,_0x4198('0xf'),JSON['stringify'](_0x46f0c4));if(_0x46f0c4[_0x4198('0x10')]){if(_0x46f0c4[_0x4198('0x10')]['code']===0x1f4){logger[_0x4198('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x7ecdd,_0x46f0c4[_0x4198('0x10')][_0x4198('0x11')]);return _0x2e9b4b(_0x46f0c4[_0x4198('0x10')][_0x4198('0x11')]);}logger['error'](_0x4198('0xd'),_0x7ecdd,_0x46f0c4['error']['message']);return _0x441618(_0x46f0c4[_0x4198('0x10')]['message']);}else{logger[_0x4198('0xc')](_0x4198('0xd'),_0x7ecdd,_0x4198('0xf'));_0x441618(_0x46f0c4['result'][_0x4198('0x11')]);}})[_0x4198('0x12')](function(_0x4036e5){logger[_0x4198('0x10')](_0x4198('0xd'),_0x7ecdd,_0x4036e5);_0x2e9b4b(_0x4036e5);});});}exports[_0x4198('0x13')]=function(_0x5d84ab){var _0x3fb22b=this;return new Promise(function(_0x1902d8,_0x1dc5e6){return db[_0x4198('0x14')][_0x4198('0x15')]({'raw':_0x5d84ab[_0x4198('0x16')]?_0x5d84ab[_0x4198('0x16')][_0x4198('0x17')]===undefined?!![]:![]:!![],'where':_0x5d84ab[_0x4198('0x16')]?_0x5d84ab['options']['where']||null:null,'attributes':_0x5d84ab[_0x4198('0x16')]?_0x5d84ab[_0x4198('0x16')][_0x4198('0x18')]||null:null,'include':_0x5d84ab[_0x4198('0x16')]?_0x5d84ab['options'][_0x4198('0x19')]?_[_0x4198('0x1a')](_0x5d84ab[_0x4198('0x16')]['include'],function(_0xd5eb35){return{'model':db[_0xd5eb35['model']],'as':_0xd5eb35['as'],'attributes':_0xd5eb35['attributes'],'include':_0xd5eb35[_0x4198('0x19')]?_[_0x4198('0x1a')](_0xd5eb35[_0x4198('0x19')],function(_0x607b29){return{'model':db[_0x607b29['model']],'as':_0x607b29['as'],'attributes':_0x607b29['attributes'],'include':_0x607b29[_0x4198('0x19')]?_['map'](_0x607b29[_0x4198('0x19')],function(_0x28fd73){return{'model':db[_0x28fd73[_0x4198('0x1b')]],'as':_0x28fd73['as'],'attributes':_0x28fd73[_0x4198('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x241cdc){logger['info'](_0x4198('0x13'),_0x5d84ab);logger['debug']('ShowSquareOdbc',_0x5d84ab,JSON[_0x4198('0x1c')](_0x241cdc));_0x1902d8(_0x241cdc);})[_0x4198('0x12')](function(_0x597782){logger['error'](_0x4198('0x13'),_0x597782[_0x4198('0x11')],_0x5d84ab);_0x1dc5e6(_0x3fb22b[_0x4198('0x10')](0x1f4,_0x597782[_0x4198('0x11')]));});});}; \ No newline at end of file +var _0xf4a1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','find','options','raw','include','map','attributes','model','ShowSquareOdbc','catch'];(function(_0x2c44fa,_0x115d44){var _0x503b36=function(_0x1bd31e){while(--_0x1bd31e){_0x2c44fa['push'](_0x2c44fa['shift']());}};_0x503b36(++_0x115d44);}(_0xf4a1,0xf8));var _0x1f4a=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xf4a1[_0x238671];return _0x474844;};'use strict';var _=require(_0x1f4a('0x0'));var util=require(_0x1f4a('0x1'));var moment=require(_0x1f4a('0x2'));var BPromise=require(_0x1f4a('0x3'));var rs=require(_0x1f4a('0x4'));var fs=require('fs');var Redis=require(_0x1f4a('0x5'));var db=require(_0x1f4a('0x6'))['db'];var utils=require(_0x1f4a('0x7'));var logger=require(_0x1f4a('0x8'))(_0x1f4a('0x9'));var config=require(_0x1f4a('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34efca,_0xa6eb14,_0x2b1f16){return new BPromise(function(_0x310970,_0x561f58){return client[_0x1f4a('0xc')](_0x34efca,_0x2b1f16)[_0x1f4a('0xd')](function(_0x130210){logger['info'](_0x1f4a('0xe'),_0xa6eb14,_0x1f4a('0xf'));logger[_0x1f4a('0x10')](_0x1f4a('0x11'),_0xa6eb14,'request\x20sent',JSON['stringify'](_0x130210));if(_0x130210[_0x1f4a('0x12')]){if(_0x130210['error'][_0x1f4a('0x13')]===0x1f4){logger['error'](_0x1f4a('0xe'),_0xa6eb14,_0x130210['error'][_0x1f4a('0x14')]);return _0x561f58(_0x130210['error'][_0x1f4a('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0xa6eb14,_0x130210['error']['message']);return _0x310970(_0x130210[_0x1f4a('0x12')]['message']);}else{logger[_0x1f4a('0x15')](_0x1f4a('0xe'),_0xa6eb14,_0x1f4a('0xf'));_0x310970(_0x130210['result'][_0x1f4a('0x14')]);}})['catch'](function(_0x44ae2b){logger['error'](_0x1f4a('0xe'),_0xa6eb14,_0x44ae2b);_0x561f58(_0x44ae2b);});});}exports['ShowSquareOdbc']=function(_0x143dc3){var _0x1b2ec5=this;return new Promise(function(_0x4b726e,_0x196739){return db['SquareOdbc'][_0x1f4a('0x16')]({'raw':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')][_0x1f4a('0x18')]===undefined?!![]:![]:!![],'where':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')]['where']||null:null,'attributes':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')]['attributes']||null:null,'include':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')][_0x1f4a('0x19')]?_[_0x1f4a('0x1a')](_0x143dc3[_0x1f4a('0x17')][_0x1f4a('0x19')],function(_0x147b79){return{'model':db[_0x147b79['model']],'as':_0x147b79['as'],'attributes':_0x147b79[_0x1f4a('0x1b')],'include':_0x147b79[_0x1f4a('0x19')]?_[_0x1f4a('0x1a')](_0x147b79[_0x1f4a('0x19')],function(_0x52ae35){return{'model':db[_0x52ae35[_0x1f4a('0x1c')]],'as':_0x52ae35['as'],'attributes':_0x52ae35[_0x1f4a('0x1b')],'include':_0x52ae35['include']?_[_0x1f4a('0x1a')](_0x52ae35['include'],function(_0x30659d){return{'model':db[_0x30659d['model']],'as':_0x30659d['as'],'attributes':_0x30659d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f4a('0xd')](function(_0x218c62){logger[_0x1f4a('0x15')](_0x1f4a('0x1d'),_0x143dc3);logger[_0x1f4a('0x10')]('ShowSquareOdbc',_0x143dc3,JSON['stringify'](_0x218c62));_0x4b726e(_0x218c62);})[_0x1f4a('0x1e')](function(_0x1cb6d6){logger[_0x1f4a('0x12')](_0x1f4a('0x1d'),_0x1cb6d6[_0x1f4a('0x14')],_0x143dc3);_0x196739(_0x1b2ec5['error'](0x1f4,_0x1cb6d6[_0x1f4a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e160d1c..2d73991 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 _0x5a80=['create','put','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x4fabb6,_0xa8c4cc){var _0xf3874c=function(_0x201770){while(--_0x201770){_0x4fabb6['push'](_0x4fabb6['shift']());}};_0xf3874c(++_0xa8c4cc);}(_0x5a80,0x1b4));var _0x05a8=function(_0xc070a5,_0x176419){_0xc070a5=_0xc070a5-0x0;var _0x47b439=_0x5a80[_0xc070a5];return _0x47b439;};'use strict';var multer=require('multer');var util=require(_0x05a8('0x0'));var path=require('path');var timeout=require(_0x05a8('0x1'));var express=require(_0x05a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x05a8('0x3'));var interaction=require(_0x05a8('0x4'));var config=require(_0x05a8('0x5'));var controller=require('./squareProject.controller');router[_0x05a8('0x6')]('/',auth[_0x05a8('0x7')](),controller[_0x05a8('0x8')]);router[_0x05a8('0x6')](_0x05a8('0x9'),auth[_0x05a8('0x7')](),controller[_0x05a8('0xa')]);router[_0x05a8('0xb')]('/',auth[_0x05a8('0x7')](),controller[_0x05a8('0xc')]);router[_0x05a8('0xd')](_0x05a8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x05a8('0xe')](_0x05a8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x05a8('0xf')]=router; \ No newline at end of file +var _0x30e5=['./squareProject.controller','isAuthenticated','get','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e88c,_0x1e04f6){var _0x398929=function(_0x499e4c){while(--_0x499e4c){_0x2e88c['push'](_0x2e88c['shift']());}};_0x398929(++_0x1e04f6);}(_0x30e5,0xb6));var _0x530e=function(_0xd74a23,_0x78aeae){_0xd74a23=_0xd74a23-0x0;var _0x228d19=_0x30e5[_0xd74a23];return _0x228d19;};'use strict';var multer=require(_0x530e('0x0'));var util=require(_0x530e('0x1'));var path=require(_0x530e('0x2'));var timeout=require(_0x530e('0x3'));var express=require(_0x530e('0x4'));var router=express[_0x530e('0x5')]();var fs_extra=require(_0x530e('0x6'));var auth=require(_0x530e('0x7'));var interaction=require(_0x530e('0x8'));var config=require(_0x530e('0x9'));var controller=require(_0x530e('0xa'));router['get']('/',auth[_0x530e('0xb')](),controller['index']);router[_0x530e('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x530e('0xb')](),controller['create']);router['put'](_0x530e('0xd'),auth[_0x530e('0xb')](),controller[_0x530e('0xe')]);router['delete']('/:id',auth[_0x530e('0xb')](),controller[_0x530e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0f8eca1..6a37c49 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 _0x6958=['preproduction','toString','long','production','utf8','DATE','sequelize','exports','STRING','TEXT','BLOB','getDataValue'];(function(_0x174bf0,_0x259bb7){var _0x1ad2fd=function(_0x4afa80){while(--_0x4afa80){_0x174bf0['push'](_0x174bf0['shift']());}};_0x1ad2fd(++_0x259bb7);}(_0x6958,0x11a));var _0x8695=function(_0x4237bb,_0x179a65){_0x4237bb=_0x4237bb-0x0;var _0x3482a5=_0x6958[_0x4237bb];return _0x3482a5;};'use strict';var Sequelize=require(_0x8695('0x0'));module[_0x8695('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8695('0x2')]},'notes':{'type':Sequelize[_0x8695('0x3')]},'preproduction':{'type':Sequelize[_0x8695('0x4')]('long'),'get':function(){if(this[_0x8695('0x5')](_0x8695('0x6'))){return this[_0x8695('0x5')](_0x8695('0x6'))[_0x8695('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x8695('0x4')](_0x8695('0x8')),'get':function(){if(this['getDataValue'](_0x8695('0x9'))){return this[_0x8695('0x5')](_0x8695('0x9'))[_0x8695('0x7')](_0x8695('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x8695('0xb')]}}; \ No newline at end of file +var _0xa8dd=['TEXT','long','preproduction','toString','utf8','BLOB','getDataValue','production','DATE','sequelize','name','STRING'];(function(_0x35a764,_0x3837da){var _0x18a9cd=function(_0x5a49c1){while(--_0x5a49c1){_0x35a764['push'](_0x35a764['shift']());}};_0x18a9cd(++_0x3837da);}(_0xa8dd,0x1dd));var _0xda8d=function(_0x52f1f9,_0x171046){_0x52f1f9=_0x52f1f9-0x0;var _0x178fc2=_0xa8dd[_0x52f1f9];return _0x178fc2;};'use strict';var Sequelize=require(_0xda8d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xda8d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xda8d('0x2')]},'notes':{'type':Sequelize[_0xda8d('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xda8d('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0xda8d('0x5'))[_0xda8d('0x6')](_0xda8d('0x7'));}}},'production':{'type':Sequelize[_0xda8d('0x8')](_0xda8d('0x4')),'get':function(){if(this[_0xda8d('0x9')]('production')){return this[_0xda8d('0x9')](_0xda8d('0xa'))[_0xda8d('0x6')](_0xda8d('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xda8d('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 507ea9e..d4fe4ca 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 _0xaaeb=['include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x15a08a,_0x51d9cb){var _0x5135ba=function(_0x1108f2){while(--_0x1108f2){_0x15a08a['push'](_0x15a08a['shift']());}};_0x5135ba(++_0x51d9cb);}(_0xaaeb,0x173));var _0xbaae=function(_0x4b9abc,_0x25bb42){_0x4b9abc=_0x4b9abc-0x0;var _0x568162=_0xaaeb[_0x4b9abc];return _0x568162;};'use strict';var _=require('lodash');var Redis=require(_0xbaae('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbaae('0x1'))(_0xbaae('0x2'));var config=require(_0xbaae('0x3'));var db=require('../../mysqldb')['db'];config[_0xbaae('0x4')]=_[_0xbaae('0x5')](config['redis'],{'host':_0xbaae('0x6'),'port':0x18eb});var socket=require(_0xbaae('0x7'))(new Redis(config['redis']));require(_0xbaae('0x8'))[_0xbaae('0x9')](socket);function respondWithResult(_0x303c40,_0xba8ca0){_0xba8ca0=_0xba8ca0||0xc8;return function(_0x348f42){if(_0x348f42){return _0x303c40[_0xbaae('0xa')](_0xba8ca0)[_0xbaae('0xb')](_0x348f42);}};}function respondWithFilteredResult(_0x47640f,_0x1eaa1b){return function(_0x4c2303){if(_0x4c2303){var _0x411bac=typeof _0x1eaa1b[_0xbaae('0xc')]==='undefined'&&typeof _0x1eaa1b[_0xbaae('0xd')]===_0xbaae('0xe');var _0x12e1f7=_0x4c2303[_0xbaae('0xf')];var _0xaec86c=_0x411bac?0x0:_0x1eaa1b[_0xbaae('0xc')];var _0x3c60c7=_0x411bac?_0x4c2303[_0xbaae('0xf')]:_0x1eaa1b[_0xbaae('0xc')]+_0x1eaa1b[_0xbaae('0xd')];var _0x5268f4;if(_0x3c60c7>=_0x12e1f7){_0x3c60c7=_0x12e1f7;_0x5268f4=0xc8;}else{_0x5268f4=0xce;}_0x47640f['status'](_0x5268f4);return _0x47640f[_0xbaae('0x10')](_0xbaae('0x11'),_0xaec86c+'-'+_0x3c60c7+'/'+_0x12e1f7)[_0xbaae('0xb')](_0x4c2303);}return null;};}function saveUpdates(_0x438e7b){return function(_0x1544dd){if(_0x1544dd){return _0x1544dd[_0xbaae('0x12')](_0x438e7b)[_0xbaae('0x13')](function(_0x4f5995){return _0x4f5995;});}return null;};}function removeEntity(_0x4df80f){return function(_0x6179f){if(_0x6179f){return _0x6179f[_0xbaae('0x14')]()[_0xbaae('0x13')](function(){var _0x5c9bbb=_0x6179f[_0xbaae('0x15')]({'plain':!![]});var _0x2667e5=_0xbaae('0x16');return db[_0xbaae('0x17')][_0xbaae('0x14')]({'where':{'type':_0x2667e5,'resourceId':_0x5c9bbb['id']}})[_0xbaae('0x13')](function(){return _0x6179f;});})[_0xbaae('0x13')](function(){var _0x3eee52=new Redis(config[_0xbaae('0x4')]);_0x3eee52[_0xbaae('0x18')](_0xbaae('0x19'),JSON[_0xbaae('0x1a')]({'id':_0x6179f['id'],'deleted':!![]}));})['then'](function(){_0x4df80f[_0xbaae('0xa')](0xcc)[_0xbaae('0x1b')]();});}};}function handleEntityNotFound(_0x1b3248){return function(_0x14032c){if(!_0x14032c){_0x1b3248[_0xbaae('0x1c')](0x194);}return _0x14032c;};}function handleError(_0x4d8c6b,_0x1ffed5){_0x1ffed5=_0x1ffed5||0x1f4;return function(_0x4023e2){logger['error'](_0x4023e2[_0xbaae('0x1d')]);if(_0x4023e2[_0xbaae('0x1e')]){delete _0x4023e2[_0xbaae('0x1e')];}_0x4d8c6b[_0xbaae('0xa')](_0x1ffed5)[_0xbaae('0x1f')](_0x4023e2);};}exports[_0xbaae('0x20')]=function(_0x39ce8d,_0x3b7806){var _0x29ad89={},_0x248e5e={},_0x2ffee8={'count':0x0,'rows':[]};var _0x4cc34e=_[_0xbaae('0x21')](db[_0xbaae('0x22')][_0xbaae('0x23')],function(_0x4e92a5){return{'name':_0x4e92a5[_0xbaae('0x24')],'type':_0x4e92a5[_0xbaae('0x25')]['key']};});_0x248e5e[_0xbaae('0x26')]=_[_0xbaae('0x21')](_0x4cc34e,'name');_0x248e5e[_0xbaae('0x27')]=_['keys'](_0x39ce8d[_0xbaae('0x27')]);_0x248e5e['filters']=_[_0xbaae('0x28')](_0x248e5e['model'],_0x248e5e['query']);_0x29ad89[_0xbaae('0x29')]=_['intersection'](_0x248e5e[_0xbaae('0x26')],qs['fields'](_0x39ce8d[_0xbaae('0x27')][_0xbaae('0x2a')]));_0x29ad89[_0xbaae('0x29')]=_0x29ad89[_0xbaae('0x29')][_0xbaae('0x2b')]?_0x29ad89['attributes']:_0x248e5e['model'];if(!_0x39ce8d[_0xbaae('0x27')]['hasOwnProperty'](_0xbaae('0x2c'))){_0x29ad89['limit']=qs[_0xbaae('0xd')](_0x39ce8d[_0xbaae('0x27')][_0xbaae('0xd')]);_0x29ad89[_0xbaae('0xc')]=qs['offset'](_0x39ce8d[_0xbaae('0x27')]['offset']);}_0x29ad89[_0xbaae('0x2d')]=qs[_0xbaae('0x2e')](_0x39ce8d['query']['sort']);_0x29ad89[_0xbaae('0x2f')]=qs[_0xbaae('0x30')](_[_0xbaae('0x31')](_0x39ce8d['query'],_0x248e5e[_0xbaae('0x30')]),_0x4cc34e);if(_0x39ce8d[_0xbaae('0x27')][_0xbaae('0x32')]){_0x29ad89[_0xbaae('0x2f')]=_[_0xbaae('0x33')](_0x29ad89['where'],{'$or':_['map'](_0x4cc34e,function(_0x460be1){if(_0x460be1[_0xbaae('0x25')]!==_0xbaae('0x34')){var _0x4bbd0f={};_0x4bbd0f[_0x460be1[_0xbaae('0x1e')]]={'$like':'%'+_0x39ce8d['query'][_0xbaae('0x32')]+'%'};return _0x4bbd0f;}})});}_0x29ad89=_[_0xbaae('0x33')]({},_0x29ad89,_0x39ce8d[_0xbaae('0x35')]);var _0x535fea={'where':_0x29ad89['where']};return db[_0xbaae('0x22')][_0xbaae('0xf')](_0x535fea)[_0xbaae('0x13')](function(_0x1c8d48){_0x2ffee8['count']=_0x1c8d48;if(_0x39ce8d[_0xbaae('0x27')][_0xbaae('0x36')]){_0x29ad89[_0xbaae('0x37')]=[{'all':!![]}];}return db[_0xbaae('0x22')][_0xbaae('0x38')](_0x29ad89);})[_0xbaae('0x13')](function(_0x11927b){_0x2ffee8[_0xbaae('0x39')]=_0x11927b;return _0x2ffee8;})['then'](respondWithFilteredResult(_0x3b7806,_0x29ad89))[_0xbaae('0x3a')](handleError(_0x3b7806,null));};exports['show']=function(_0x26d1db,_0x3c1af9){var _0x4986a4={'raw':![],'where':{'id':_0x26d1db[_0xbaae('0x3b')]['id']}},_0x38df1b={};_0x38df1b[_0xbaae('0x26')]=_[_0xbaae('0x3c')](db['SquareProject'][_0xbaae('0x23')]);_0x38df1b['query']=_[_0xbaae('0x3c')](_0x26d1db[_0xbaae('0x27')]);_0x38df1b['filters']=_['intersection'](_0x38df1b['model'],_0x38df1b[_0xbaae('0x27')]);_0x4986a4['attributes']=_['intersection'](_0x38df1b[_0xbaae('0x26')],qs['fields'](_0x26d1db[_0xbaae('0x27')][_0xbaae('0x2a')]));_0x4986a4[_0xbaae('0x29')]=_0x4986a4[_0xbaae('0x29')][_0xbaae('0x2b')]?_0x4986a4['attributes']:_0x38df1b[_0xbaae('0x26')];if(_0x26d1db[_0xbaae('0x27')]['includeAll']){_0x4986a4['include']=[{'all':!![]}];}_0x4986a4=_[_0xbaae('0x33')]({},_0x4986a4,_0x26d1db[_0xbaae('0x35')]);return db['SquareProject'][_0xbaae('0x3d')](_0x4986a4)['then'](handleEntityNotFound(_0x3c1af9,null))[_0xbaae('0x13')](respondWithResult(_0x3c1af9,null))[_0xbaae('0x3a')](handleError(_0x3c1af9,null));};exports[_0xbaae('0x3e')]=function(_0x1ab1bd,_0x5947b1){return db[_0xbaae('0x22')][_0xbaae('0x3e')](_0x1ab1bd[_0xbaae('0x3f')],{})[_0xbaae('0x13')](function(_0x302874){var _0x284650=_0x1ab1bd[_0xbaae('0x40')][_0xbaae('0x15')]({'plain':!![]});if(!_0x284650)throw new Error(_0xbaae('0x41'));if(_0x284650[_0xbaae('0x42')]===_0xbaae('0x40')){var _0x58a272=_0x302874[_0xbaae('0x15')]({'plain':!![]});var _0x59bed1='SquareProjects';return db[_0xbaae('0x43')][_0xbaae('0x3d')]({'where':{'name':_0x59bed1,'userProfileId':_0x284650[_0xbaae('0x44')]},'raw':!![]})[_0xbaae('0x13')](function(_0x40e332){if(_0x40e332&&_0x40e332[_0xbaae('0x45')]===0x0){return db[_0xbaae('0x17')][_0xbaae('0x3e')]({'name':_0x58a272[_0xbaae('0x1e')],'resourceId':_0x58a272['id'],'type':_0x40e332[_0xbaae('0x1e')],'sectionId':_0x40e332['id']},{})[_0xbaae('0x13')](function(){return _0x302874;});}else{return _0x302874;}})['catch'](function(_0xb66703){logger[_0xbaae('0x46')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb66703);throw _0xb66703;});}return _0x302874;})[_0xbaae('0x13')](respondWithResult(_0x5947b1,0xc9))[_0xbaae('0x3a')](handleError(_0x5947b1,null));};exports[_0xbaae('0x12')]=function(_0x5e2a9c,_0xc3f352){if(_0x5e2a9c[_0xbaae('0x3f')]['id']){delete _0x5e2a9c[_0xbaae('0x3f')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x5e2a9c['params']['id']}})['then'](handleEntityNotFound(_0xc3f352,null))[_0xbaae('0x13')](saveUpdates(_0x5e2a9c[_0xbaae('0x3f')],null))['then'](function(_0x3da4ff){if(!_0x3da4ff)return;var _0x53e064=_0x3da4ff[_0xbaae('0x15')]({'plain':!![]});return _0x53e064;})['then'](function(_0x378850){var _0x3f5af0=new Redis(config[_0xbaae('0x4')]);_0x3f5af0[_0xbaae('0x18')](_0xbaae('0x19'),JSON[_0xbaae('0x1a')](_[_0xbaae('0x31')](_0x378850,['id','name','production'])));return _0x378850;})[_0xbaae('0x13')](respondWithResult(_0xc3f352,null))[_0xbaae('0x3a')](handleError(_0xc3f352,null));};exports[_0xbaae('0x14')]=function(_0x31af23,_0x302be3){return db['SquareProject'][_0xbaae('0x3d')]({'where':{'id':_0x31af23[_0xbaae('0x3b')]['id']}})[_0xbaae('0x13')](handleEntityNotFound(_0x302be3,null))['then'](removeEntity(_0x302be3,null))[_0xbaae('0x3a')](handleError(_0x302be3,null));}; \ No newline at end of file +var _0xb3a8=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','UserProfileResource','publish','agi','stringify','sendStatus','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','SquareProject','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','SquareProjects','UserProfileSection','userProfileId'];(function(_0x4ad4d7,_0x4e7bff){var _0x4000e0=function(_0x5405be){while(--_0x5405be){_0x4ad4d7['push'](_0x4ad4d7['shift']());}};_0x4000e0(++_0x4e7bff);}(_0xb3a8,0x89));var _0x8b3a=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xb3a8[_0x13137e];return _0x346261;};'use strict';var _=require(_0x8b3a('0x0'));var Redis=require(_0x8b3a('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x8b3a('0x2'));var db=require('../../mysqldb')['db'];config[_0x8b3a('0x3')]=_[_0x8b3a('0x4')](config['redis'],{'host':_0x8b3a('0x5'),'port':0x18eb});var socket=require(_0x8b3a('0x6'))(new Redis(config[_0x8b3a('0x3')]));require(_0x8b3a('0x7'))['register'](socket);function respondWithResult(_0x5a2227,_0x239939){_0x239939=_0x239939||0xc8;return function(_0x28599f){if(_0x28599f){return _0x5a2227[_0x8b3a('0x8')](_0x239939)[_0x8b3a('0x9')](_0x28599f);}};}function respondWithFilteredResult(_0x20a22f,_0x2820ab){return function(_0xe99a83){if(_0xe99a83){var _0x2cf38b=typeof _0x2820ab[_0x8b3a('0xa')]===_0x8b3a('0xb')&&typeof _0x2820ab[_0x8b3a('0xc')]==='undefined';var _0x1e5ce3=_0xe99a83['count'];var _0x258b00=_0x2cf38b?0x0:_0x2820ab[_0x8b3a('0xa')];var _0x30d8ab=_0x2cf38b?_0xe99a83[_0x8b3a('0xd')]:_0x2820ab[_0x8b3a('0xa')]+_0x2820ab[_0x8b3a('0xc')];var _0x1f357a;if(_0x30d8ab>=_0x1e5ce3){_0x30d8ab=_0x1e5ce3;_0x1f357a=0xc8;}else{_0x1f357a=0xce;}_0x20a22f['status'](_0x1f357a);return _0x20a22f[_0x8b3a('0xe')](_0x8b3a('0xf'),_0x258b00+'-'+_0x30d8ab+'/'+_0x1e5ce3)[_0x8b3a('0x9')](_0xe99a83);}return null;};}function saveUpdates(_0x5c4310){return function(_0x1ea76d){if(_0x1ea76d){return _0x1ea76d[_0x8b3a('0x10')](_0x5c4310)[_0x8b3a('0x11')](function(_0x3c0056){return _0x3c0056;});}return null;};}function removeEntity(_0x1b8eb7){return function(_0x3397bf){if(_0x3397bf){return _0x3397bf[_0x8b3a('0x12')]()[_0x8b3a('0x11')](function(){var _0x551975=_0x3397bf['get']({'plain':!![]});var _0xf54238='SquareProjects';return db[_0x8b3a('0x13')][_0x8b3a('0x12')]({'where':{'type':_0xf54238,'resourceId':_0x551975['id']}})[_0x8b3a('0x11')](function(){return _0x3397bf;});})['then'](function(){var _0x51298a=new Redis(config[_0x8b3a('0x3')]);_0x51298a[_0x8b3a('0x14')](_0x8b3a('0x15'),JSON[_0x8b3a('0x16')]({'id':_0x3397bf['id'],'deleted':!![]}));})[_0x8b3a('0x11')](function(){_0x1b8eb7[_0x8b3a('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x574f27){return function(_0x175a00){if(!_0x175a00){_0x574f27[_0x8b3a('0x17')](0x194);}return _0x175a00;};}function handleError(_0x422da0,_0x3a24a3){_0x3a24a3=_0x3a24a3||0x1f4;return function(_0x3df6cf){logger['error'](_0x3df6cf['stack']);if(_0x3df6cf[_0x8b3a('0x18')]){delete _0x3df6cf[_0x8b3a('0x18')];}_0x422da0[_0x8b3a('0x8')](_0x3a24a3)[_0x8b3a('0x19')](_0x3df6cf);};}exports['index']=function(_0x20ebbb,_0x2e3ab8){var _0x21e3c1={},_0xbbc09e={},_0x29e17c={'count':0x0,'rows':[]};var _0x1ce78e=_[_0x8b3a('0x1a')](db['SquareProject'][_0x8b3a('0x1b')],function(_0x44608d){return{'name':_0x44608d['fieldName'],'type':_0x44608d[_0x8b3a('0x1c')][_0x8b3a('0x1d')]};});_0xbbc09e[_0x8b3a('0x1e')]=_[_0x8b3a('0x1a')](_0x1ce78e,_0x8b3a('0x18'));_0xbbc09e[_0x8b3a('0x1f')]=_[_0x8b3a('0x20')](_0x20ebbb[_0x8b3a('0x1f')]);_0xbbc09e['filters']=_['intersection'](_0xbbc09e[_0x8b3a('0x1e')],_0xbbc09e[_0x8b3a('0x1f')]);_0x21e3c1['attributes']=_[_0x8b3a('0x21')](_0xbbc09e[_0x8b3a('0x1e')],qs[_0x8b3a('0x22')](_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x22')]));_0x21e3c1[_0x8b3a('0x23')]=_0x21e3c1[_0x8b3a('0x23')][_0x8b3a('0x24')]?_0x21e3c1[_0x8b3a('0x23')]:_0xbbc09e[_0x8b3a('0x1e')];if(!_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x25')](_0x8b3a('0x26'))){_0x21e3c1['limit']=qs['limit'](_0x20ebbb['query']['limit']);_0x21e3c1[_0x8b3a('0xa')]=qs[_0x8b3a('0xa')](_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0xa')]);}_0x21e3c1[_0x8b3a('0x27')]=qs[_0x8b3a('0x28')](_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x28')]);_0x21e3c1[_0x8b3a('0x29')]=qs[_0x8b3a('0x2a')](_[_0x8b3a('0x2b')](_0x20ebbb[_0x8b3a('0x1f')],_0xbbc09e[_0x8b3a('0x2a')]),_0x1ce78e);if(_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x2c')]){_0x21e3c1[_0x8b3a('0x29')]=_[_0x8b3a('0x2d')](_0x21e3c1[_0x8b3a('0x29')],{'$or':_['map'](_0x1ce78e,function(_0x5e6ee1){if(_0x5e6ee1['type']!==_0x8b3a('0x2e')){var _0x52e918={};_0x52e918[_0x5e6ee1['name']]={'$like':'%'+_0x20ebbb[_0x8b3a('0x1f')]['filter']+'%'};return _0x52e918;}})});}_0x21e3c1=_[_0x8b3a('0x2d')]({},_0x21e3c1,_0x20ebbb[_0x8b3a('0x2f')]);var _0x2ccd02={'where':_0x21e3c1['where']};return db['SquareProject'][_0x8b3a('0xd')](_0x2ccd02)[_0x8b3a('0x11')](function(_0x20c0e7){_0x29e17c[_0x8b3a('0xd')]=_0x20c0e7;if(_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x30')]){_0x21e3c1[_0x8b3a('0x31')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x21e3c1);})[_0x8b3a('0x11')](function(_0x33c452){_0x29e17c[_0x8b3a('0x32')]=_0x33c452;return _0x29e17c;})[_0x8b3a('0x11')](respondWithFilteredResult(_0x2e3ab8,_0x21e3c1))[_0x8b3a('0x33')](handleError(_0x2e3ab8,null));};exports[_0x8b3a('0x34')]=function(_0x173da2,_0x3d8549){var _0x12bc3f={'raw':![],'where':{'id':_0x173da2[_0x8b3a('0x35')]['id']}},_0x527bfb={};_0x527bfb[_0x8b3a('0x1e')]=_[_0x8b3a('0x20')](db[_0x8b3a('0x36')]['rawAttributes']);_0x527bfb[_0x8b3a('0x1f')]=_['keys'](_0x173da2[_0x8b3a('0x1f')]);_0x527bfb[_0x8b3a('0x2a')]=_[_0x8b3a('0x21')](_0x527bfb[_0x8b3a('0x1e')],_0x527bfb[_0x8b3a('0x1f')]);_0x12bc3f[_0x8b3a('0x23')]=_[_0x8b3a('0x21')](_0x527bfb[_0x8b3a('0x1e')],qs[_0x8b3a('0x22')](_0x173da2[_0x8b3a('0x1f')][_0x8b3a('0x22')]));_0x12bc3f[_0x8b3a('0x23')]=_0x12bc3f[_0x8b3a('0x23')][_0x8b3a('0x24')]?_0x12bc3f[_0x8b3a('0x23')]:_0x527bfb[_0x8b3a('0x1e')];if(_0x173da2[_0x8b3a('0x1f')][_0x8b3a('0x30')]){_0x12bc3f['include']=[{'all':!![]}];}_0x12bc3f=_[_0x8b3a('0x2d')]({},_0x12bc3f,_0x173da2['options']);return db['SquareProject'][_0x8b3a('0x37')](_0x12bc3f)[_0x8b3a('0x11')](handleEntityNotFound(_0x3d8549,null))[_0x8b3a('0x11')](respondWithResult(_0x3d8549,null))[_0x8b3a('0x33')](handleError(_0x3d8549,null));};exports[_0x8b3a('0x38')]=function(_0x3f03b3,_0x18c7e1){return db[_0x8b3a('0x36')][_0x8b3a('0x38')](_0x3f03b3[_0x8b3a('0x39')],{})[_0x8b3a('0x11')](function(_0x2d9b4c){var _0xafa137=_0x3f03b3[_0x8b3a('0x3a')]['get']({'plain':!![]});if(!_0xafa137)throw new Error(_0x8b3a('0x3b'));if(_0xafa137['role']==='user'){var _0x1e9218=_0x2d9b4c[_0x8b3a('0x3c')]({'plain':!![]});var _0x482b80=_0x8b3a('0x3d');return db[_0x8b3a('0x3e')][_0x8b3a('0x37')]({'where':{'name':_0x482b80,'userProfileId':_0xafa137[_0x8b3a('0x3f')]},'raw':!![]})[_0x8b3a('0x11')](function(_0x3ee23a){if(_0x3ee23a&&_0x3ee23a[_0x8b3a('0x40')]===0x0){return db[_0x8b3a('0x13')][_0x8b3a('0x38')]({'name':_0x1e9218[_0x8b3a('0x18')],'resourceId':_0x1e9218['id'],'type':_0x3ee23a[_0x8b3a('0x18')],'sectionId':_0x3ee23a['id']},{})['then'](function(){return _0x2d9b4c;});}else{return _0x2d9b4c;}})[_0x8b3a('0x33')](function(_0x25d362){logger[_0x8b3a('0x41')](_0x8b3a('0x42'),_0x25d362);throw _0x25d362;});}return _0x2d9b4c;})[_0x8b3a('0x11')](respondWithResult(_0x18c7e1,0xc9))['catch'](handleError(_0x18c7e1,null));};exports[_0x8b3a('0x10')]=function(_0x1a7c93,_0x361ac5){if(_0x1a7c93[_0x8b3a('0x39')]['id']){delete _0x1a7c93[_0x8b3a('0x39')]['id'];}return db[_0x8b3a('0x36')][_0x8b3a('0x37')]({'where':{'id':_0x1a7c93['params']['id']}})['then'](handleEntityNotFound(_0x361ac5,null))[_0x8b3a('0x11')](saveUpdates(_0x1a7c93[_0x8b3a('0x39')],null))[_0x8b3a('0x11')](function(_0x555085){if(!_0x555085)return;var _0x1addf8=_0x555085[_0x8b3a('0x3c')]({'plain':!![]});return _0x1addf8;})[_0x8b3a('0x11')](function(_0x5e898d){var _0x4f8720=new Redis(config[_0x8b3a('0x3')]);_0x4f8720['publish'](_0x8b3a('0x15'),JSON[_0x8b3a('0x16')](_[_0x8b3a('0x2b')](_0x5e898d,['id',_0x8b3a('0x18'),'production'])));return _0x5e898d;})[_0x8b3a('0x11')](respondWithResult(_0x361ac5,null))[_0x8b3a('0x33')](handleError(_0x361ac5,null));};exports[_0x8b3a('0x12')]=function(_0x3a8342,_0x2f6829){return db['SquareProject'][_0x8b3a('0x37')]({'where':{'id':_0x3a8342[_0x8b3a('0x35')]['id']}})[_0x8b3a('0x11')](handleEntityNotFound(_0x2f6829,null))[_0x8b3a('0x11')](removeEntity(_0x2f6829,null))[_0x8b3a('0x33')](handleError(_0x2f6829,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 61f8636..912197c 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 _0x5c02=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x528e4b,_0x3a52da){var _0x106ab4=function(_0x36c796){while(--_0x36c796){_0x528e4b['push'](_0x528e4b['shift']());}};_0x106ab4(++_0x3a52da);}(_0x5c02,0xf5));var _0x25c0=function(_0x4845bc,_0x25e144){_0x4845bc=_0x4845bc-0x0;var _0x82713d=_0x5c02[_0x4845bc];return _0x82713d;};'use strict';var EventEmitter=require(_0x25c0('0x0'));var SquareProject=require(_0x25c0('0x1'))['db'][_0x25c0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x25c0('0x3')](0x0);var events={'afterCreate':_0x25c0('0x4'),'afterUpdate':'update','afterDestroy':_0x25c0('0x5')};function emitEvent(_0x5ef2ef){return function(_0x115e8c,_0x42b35c,_0x34c8eb){SquareProjectEvents[_0x25c0('0x6')](_0x5ef2ef+':'+_0x115e8c['id'],_0x115e8c);SquareProjectEvents['emit'](_0x5ef2ef,_0x115e8c);_0x34c8eb(null);};}for(var e in events){if(events[_0x25c0('0x7')](e)){var event=events[e];SquareProject[_0x25c0('0x8')](e,emitEvent(event));}}module[_0x25c0('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xed0d=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xed0d,0x7e));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xded0('0x0'));var SquareProject=require(_0xded0('0x1'))['db'][_0xded0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xded0('0x3')](0x0);var events={'afterCreate':_0xded0('0x4'),'afterUpdate':_0xded0('0x5'),'afterDestroy':_0xded0('0x6')};function emitEvent(_0x5c23ef){return function(_0x5ebd9d,_0x24581b,_0x553b0e){SquareProjectEvents['emit'](_0x5c23ef+':'+_0x5ebd9d['id'],_0x5ebd9d);SquareProjectEvents['emit'](_0x5c23ef,_0x5ebd9d);_0x553b0e(null);};}for(var e in events){if(events[_0xded0('0x7')](e)){var event=events[e];SquareProject[_0xded0('0x8')](e,emitEvent(event));}}module[_0xded0('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 8dce6f4..579a53f 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 _0xcdc2=['path','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3308bd,_0x32c150){var _0x3003de=function(_0x325772){while(--_0x325772){_0x3308bd['push'](_0x3308bd['shift']());}};_0x3003de(++_0x32c150);}(_0xcdc2,0xa0));var _0x2cdc=function(_0x514ea7,_0x57303d){_0x514ea7=_0x514ea7-0x0;var _0xac32d9=_0xcdc2[_0x514ea7];return _0xac32d9;};'use strict';var _=require('lodash');var util=require(_0x2cdc('0x0'));var logger=require(_0x2cdc('0x1'))('api');var moment=require(_0x2cdc('0x2'));var BPromise=require(_0x2cdc('0x3'));var rp=require(_0x2cdc('0x4'));var fs=require('fs');var path=require(_0x2cdc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module['exports']=function(_0x4e9acd,_0x26d3c8){return _0x4e9acd[_0x2cdc('0x6')](_0x2cdc('0x7'),attributes,{'tableName':_0x2cdc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52aa0b,_0x8b3d5f,_0x18b6ba){if(_0x52aa0b[_0x2cdc('0x9')](_0x2cdc('0xa'))){_0x52aa0b[_0x2cdc('0xb')]=moment()['format'](_0x2cdc('0xc'));}if(_0x52aa0b[_0x2cdc('0x9')](_0x2cdc('0xd'))){_0x52aa0b['publishedAt']=moment()[_0x2cdc('0xe')](_0x2cdc('0xc'));}_0x18b6ba(null,_0x52aa0b);}}});}; \ No newline at end of file +var _0xb7e8=['publishedAt','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x5e9eb2,_0x267063){var _0x3c9857=function(_0xcad365){while(--_0xcad365){_0x5e9eb2['push'](_0x5e9eb2['shift']());}};_0x3c9857(++_0x267063);}(_0xb7e8,0x155));var _0x8b7e=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xb7e8[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x8b7e('0x0'));var util=require(_0x8b7e('0x1'));var logger=require(_0x8b7e('0x2'))(_0x8b7e('0x3'));var moment=require(_0x8b7e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b7e('0x5'));var fs=require('fs');var path=require(_0x8b7e('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7e('0x7'));var attributes=require('./squareProject.attributes');module[_0x8b7e('0x8')]=function(_0x3bc631,_0x436b57){return _0x3bc631[_0x8b7e('0x9')]('SquareProject',attributes,{'tableName':_0x8b7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13b172,_0x4aa1a2,_0x5b00ba){if(_0x13b172[_0x8b7e('0xb')]('preproduction')){_0x13b172[_0x8b7e('0xc')]=moment()[_0x8b7e('0xd')](_0x8b7e('0xe'));}if(_0x13b172[_0x8b7e('0xb')](_0x8b7e('0xf'))){_0x13b172[_0x8b7e('0x10')]=moment()['format'](_0x8b7e('0xe'));}_0x5b00ba(null,_0x13b172);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 79caaef..60cfd21 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 _0x5a95=['stringify','catch','message','error','ShowSquareProject','SquareProject','lodash','ioredis','../../mysqldb','rpc','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','findAll','options','where','attributes','include','map','model','then','info','debug'];(function(_0x3f8a06,_0x47e280){var _0x3177f3=function(_0x20d999){while(--_0x20d999){_0x3f8a06['push'](_0x3f8a06['shift']());}};_0x3177f3(++_0x47e280);}(_0x5a95,0x18c));var _0x55a9=function(_0x2192c8,_0x39bf70){_0x2192c8=_0x2192c8-0x0;var _0x48c891=_0x5a95[_0x2192c8];return _0x48c891;};'use strict';var _=require(_0x55a9('0x0'));var Redis=require(_0x55a9('0x1'));var db=require(_0x55a9('0x2'))['db'];var logger=require('../../config/logger')(_0x55a9('0x3'));var config=require('../../config/environment');config['redis']=_[_0x55a9('0x4')](config[_0x55a9('0x5')],{'host':_0x55a9('0x6'),'port':0x18eb});var socket=require(_0x55a9('0x7'))(new Redis(config['redis']));require(_0x55a9('0x8'))['register'](socket);exports[_0x55a9('0x9')]=function(_0x3df770){var _0x59dae9=this;return new Promise(function(_0x39707,_0x622ca5){return db['SquareProject'][_0x55a9('0xa')]({'raw':_0x3df770['options']?_0x3df770[_0x55a9('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x3df770[_0x55a9('0xb')]?_0x3df770['options'][_0x55a9('0xc')]||null:null,'attributes':_0x3df770[_0x55a9('0xb')]?_0x3df770[_0x55a9('0xb')][_0x55a9('0xd')]||null:null,'limit':_0x3df770[_0x55a9('0xb')]?_0x3df770[_0x55a9('0xb')]['limit']||null:null,'include':_0x3df770[_0x55a9('0xb')]?_0x3df770[_0x55a9('0xb')][_0x55a9('0xe')]?_['map'](_0x3df770[_0x55a9('0xb')][_0x55a9('0xe')],function(_0x39ae3d){return{'model':db[_0x39ae3d['model']],'as':_0x39ae3d['as'],'attributes':_0x39ae3d[_0x55a9('0xd')],'include':_0x39ae3d[_0x55a9('0xe')]?_[_0x55a9('0xf')](_0x39ae3d[_0x55a9('0xe')],function(_0x22277a){return{'model':db[_0x22277a['model']],'as':_0x22277a['as'],'attributes':_0x22277a[_0x55a9('0xd')],'include':_0x22277a[_0x55a9('0xe')]?_[_0x55a9('0xf')](_0x22277a[_0x55a9('0xe')],function(_0x153db9){return{'model':db[_0x153db9[_0x55a9('0x10')]],'as':_0x153db9['as'],'attributes':_0x153db9[_0x55a9('0xd')]};}):[]};}):[]};}):[]:[]})[_0x55a9('0x11')](function(_0x424546){logger[_0x55a9('0x12')]('GetSquareProjects',_0x3df770);logger[_0x55a9('0x13')](_0x55a9('0x9'),_0x3df770,JSON[_0x55a9('0x14')](_0x424546));_0x39707(_0x424546);})[_0x55a9('0x15')](function(_0x4c1f59){logger['error'](_0x55a9('0x9'),_0x4c1f59[_0x55a9('0x16')],_0x3df770);_0x622ca5(_0x59dae9[_0x55a9('0x17')](0x1f4,_0x4c1f59[_0x55a9('0x16')]));});});};exports[_0x55a9('0x18')]=function(_0x35ae42){var _0x43f435=this;return new Promise(function(_0x2f0846,_0x4990f7){return db[_0x55a9('0x19')]['find']({'raw':_0x35ae42[_0x55a9('0xb')]?_0x35ae42[_0x55a9('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x35ae42[_0x55a9('0xb')]?_0x35ae42[_0x55a9('0xb')][_0x55a9('0xc')]||null:null,'attributes':_0x35ae42[_0x55a9('0xb')]?_0x35ae42['options'][_0x55a9('0xd')]||null:null,'include':_0x35ae42[_0x55a9('0xb')]?_0x35ae42['options'][_0x55a9('0xe')]?_[_0x55a9('0xf')](_0x35ae42['options'][_0x55a9('0xe')],function(_0x47a07c){return{'model':db[_0x47a07c['model']],'as':_0x47a07c['as'],'attributes':_0x47a07c[_0x55a9('0xd')],'include':_0x47a07c[_0x55a9('0xe')]?_[_0x55a9('0xf')](_0x47a07c[_0x55a9('0xe')],function(_0xa1c4a2){return{'model':db[_0xa1c4a2[_0x55a9('0x10')]],'as':_0xa1c4a2['as'],'attributes':_0xa1c4a2['attributes'],'include':_0xa1c4a2[_0x55a9('0xe')]?_[_0x55a9('0xf')](_0xa1c4a2[_0x55a9('0xe')],function(_0x3faa49){return{'model':db[_0x3faa49[_0x55a9('0x10')]],'as':_0x3faa49['as'],'attributes':_0x3faa49[_0x55a9('0xd')]};}):[]};}):[]};}):[]:[]})[_0x55a9('0x11')](function(_0x35d0d9){logger[_0x55a9('0x12')](_0x55a9('0x18'),_0x35ae42);logger[_0x55a9('0x13')](_0x55a9('0x18'),_0x35ae42,JSON[_0x55a9('0x14')](_0x35d0d9));_0x2f0846(_0x35d0d9);})['catch'](function(_0x8e5f1f){logger[_0x55a9('0x17')](_0x55a9('0x18'),_0x8e5f1f[_0x55a9('0x16')],_0x35ae42);_0x4990f7(_0x43f435[_0x55a9('0x17')](0x1f4,_0x8e5f1f[_0x55a9('0x16')]));});});}; \ No newline at end of file +var _0xae26=['GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','raw','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','SquareProject','options','where','attributes','limit','include','model','map','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae26,0xe8));var _0x6ae2=function(_0x40ea18,_0x1b4b71){_0x40ea18=_0x40ea18-0x0;var _0x23af1a=_0xae26[_0x40ea18];return _0x23af1a;};'use strict';var _=require(_0x6ae2('0x0'));var Redis=require(_0x6ae2('0x1'));var db=require(_0x6ae2('0x2'))['db'];var logger=require(_0x6ae2('0x3'))(_0x6ae2('0x4'));var config=require(_0x6ae2('0x5'));config['redis']=_[_0x6ae2('0x6')](config[_0x6ae2('0x7')],{'host':_0x6ae2('0x8'),'port':0x18eb});var socket=require(_0x6ae2('0x9'))(new Redis(config[_0x6ae2('0x7')]));require('./squareProject.socket')[_0x6ae2('0xa')](socket);exports['GetSquareProjects']=function(_0xa6d87e){var _0x17f904=this;return new Promise(function(_0x19f895,_0x1b82fa){return db[_0x6ae2('0xb')]['findAll']({'raw':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0xd')]||null:null,'attributes':_0xa6d87e['options']?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0xe')]||null:null,'limit':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0xf')]||null:null,'include':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0x10')]?_['map'](_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0x10')],function(_0x426b5d){return{'model':db[_0x426b5d[_0x6ae2('0x11')]],'as':_0x426b5d['as'],'attributes':_0x426b5d['attributes'],'include':_0x426b5d[_0x6ae2('0x10')]?_[_0x6ae2('0x12')](_0x426b5d[_0x6ae2('0x10')],function(_0x5255fc){return{'model':db[_0x5255fc[_0x6ae2('0x11')]],'as':_0x5255fc['as'],'attributes':_0x5255fc[_0x6ae2('0xe')],'include':_0x5255fc[_0x6ae2('0x10')]?_[_0x6ae2('0x12')](_0x5255fc[_0x6ae2('0x10')],function(_0x73004f){return{'model':db[_0x73004f[_0x6ae2('0x11')]],'as':_0x73004f['as'],'attributes':_0x73004f[_0x6ae2('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f0fb5){logger[_0x6ae2('0x13')](_0x6ae2('0x14'),_0xa6d87e);logger[_0x6ae2('0x15')](_0x6ae2('0x14'),_0xa6d87e,JSON[_0x6ae2('0x16')](_0x1f0fb5));_0x19f895(_0x1f0fb5);})[_0x6ae2('0x17')](function(_0xe1d0e7){logger[_0x6ae2('0x18')]('GetSquareProjects',_0xe1d0e7[_0x6ae2('0x19')],_0xa6d87e);_0x1b82fa(_0x17f904[_0x6ae2('0x18')](0x1f4,_0xe1d0e7['message']));});});};exports[_0x6ae2('0x1a')]=function(_0x39402b){var _0x4619c2=this;return new Promise(function(_0x4b88f1,_0x4234c3){return db[_0x6ae2('0xb')]['find']({'raw':_0x39402b[_0x6ae2('0xc')]?_0x39402b['options'][_0x6ae2('0x1b')]===undefined?!![]:![]:!![],'where':_0x39402b[_0x6ae2('0xc')]?_0x39402b[_0x6ae2('0xc')]['where']||null:null,'attributes':_0x39402b[_0x6ae2('0xc')]?_0x39402b[_0x6ae2('0xc')][_0x6ae2('0xe')]||null:null,'include':_0x39402b['options']?_0x39402b[_0x6ae2('0xc')][_0x6ae2('0x10')]?_['map'](_0x39402b[_0x6ae2('0xc')][_0x6ae2('0x10')],function(_0x1396ae){return{'model':db[_0x1396ae[_0x6ae2('0x11')]],'as':_0x1396ae['as'],'attributes':_0x1396ae[_0x6ae2('0xe')],'include':_0x1396ae['include']?_[_0x6ae2('0x12')](_0x1396ae[_0x6ae2('0x10')],function(_0x4d1ec7){return{'model':db[_0x4d1ec7[_0x6ae2('0x11')]],'as':_0x4d1ec7['as'],'attributes':_0x4d1ec7['attributes'],'include':_0x4d1ec7[_0x6ae2('0x10')]?_[_0x6ae2('0x12')](_0x4d1ec7[_0x6ae2('0x10')],function(_0x164248){return{'model':db[_0x164248['model']],'as':_0x164248['as'],'attributes':_0x164248[_0x6ae2('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e191e){logger['info']('ShowSquareProject',_0x39402b);logger[_0x6ae2('0x15')]('ShowSquareProject',_0x39402b,JSON[_0x6ae2('0x16')](_0x3e191e));_0x4b88f1(_0x3e191e);})[_0x6ae2('0x17')](function(_0x112f0b){logger['error']('ShowSquareProject',_0x112f0b[_0x6ae2('0x19')],_0x39402b);_0x4234c3(_0x4619c2[_0x6ae2('0x18')](0x1f4,_0x112f0b[_0x6ae2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b115cbb..db65801 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 _0x0bcd=['squareProject:','./squareProject.events','update','removeListener','register'];(function(_0x15a740,_0x2a9df8){var _0xd6ab34=function(_0x56a0f5){while(--_0x56a0f5){_0x15a740['push'](_0x15a740['shift']());}};_0xd6ab34(++_0x2a9df8);}(_0x0bcd,0x65));var _0xd0bc=function(_0xbe5791,_0x2557f1){_0xbe5791=_0xbe5791-0x0;var _0x25c12c=_0x0bcd[_0xbe5791];return _0x25c12c;};'use strict';var SquareProjectEvents=require(_0xd0bc('0x0'));var events=['save','remove',_0xd0bc('0x1')];function createListener(_0x2cd25e,_0x47aec9){return function(_0x43d326){_0x47aec9['emit'](_0x2cd25e,_0x43d326);};}function removeListener(_0x410f10,_0x59ecf4){return function(){SquareProjectEvents[_0xd0bc('0x2')](_0x410f10,_0x59ecf4);};}exports[_0xd0bc('0x3')]=function(_0x5776da){for(var _0x1260bd=0x0,_0x357621=events['length'];_0x1260bd<_0x357621;_0x1260bd++){var _0x47f886=events[_0x1260bd];var _0x53d646=createListener(_0xd0bc('0x4')+_0x47f886,_0x5776da);SquareProjectEvents['on'](_0x47f886,_0x53d646);}}; \ No newline at end of file +var _0x1ebd=['update','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x129321,_0x3b4aaf){var _0x59ee6d=function(_0x57fbb4){while(--_0x57fbb4){_0x129321['push'](_0x129321['shift']());}};_0x59ee6d(++_0x3b4aaf);}(_0x1ebd,0x1a5));var _0xd1eb=function(_0x5c5793,_0x1290c0){_0x5c5793=_0x5c5793-0x0;var _0x5c1caa=_0x1ebd[_0x5c5793];return _0x5c1caa;};'use strict';var SquareProjectEvents=require(_0xd1eb('0x0'));var events=[_0xd1eb('0x1'),_0xd1eb('0x2'),_0xd1eb('0x3')];function createListener(_0x249181,_0x4f84e5){return function(_0x23e7a4){_0x4f84e5['emit'](_0x249181,_0x23e7a4);};}function removeListener(_0x5a8901,_0x4c1ea3){return function(){SquareProjectEvents[_0xd1eb('0x4')](_0x5a8901,_0x4c1ea3);};}exports[_0xd1eb('0x5')]=function(_0x4a7311){for(var _0x21cf33=0x0,_0x925b3f=events[_0xd1eb('0x6')];_0x21cf33<_0x925b3f;_0x21cf33++){var _0x3e4ae9=events[_0x21cf33];var _0x36126d=createListener(_0xd1eb('0x7')+_0x3e4ae9,_0x4a7311);SquareProjectEvents['on'](_0x3e4ae9,_0x36126d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ce7e4f6..a58f787 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x47979d,_0x5de4be){var _0x55dbaf=function(_0x263e98){while(--_0x263e98){_0x47979d['push'](_0x47979d['shift']());}};_0x55dbaf(++_0x5de4be);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5d1df9,_0x4a95bf){_0x5d1df9=_0x5d1df9-0x0;var _0x5d4feb=_0x7fbe[_0x5d1df9];return _0x5d4feb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x4ce31b,_0x16f87f){var _0x8fa278=function(_0x2d019d){while(--_0x2d019d){_0x4ce31b['push'](_0x4ce31b['shift']());}};_0x8fa278(++_0x16f87f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 604a2a6..e341920 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 _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x2bf1fb,_0x10022d){var _0x5e7e68=function(_0x287fbb){while(--_0x287fbb){_0x2bf1fb['push'](_0x2bf1fb['shift']());}};_0x5e7e68(++_0x10022d);}(_0x6aa7,0x178));var _0x76aa=function(_0x2f08de,_0x4a625c){_0x2f08de=_0x2f08de-0x0;var _0x2927b8=_0x6aa7[_0x2f08de];return _0x2927b8;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file +var _0x1cb9=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0x32ee6a,_0x37200b){var _0x36f59e=function(_0x478fed){while(--_0x478fed){_0x32ee6a['push'](_0x32ee6a['shift']());}};_0x36f59e(++_0x37200b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x78c2a3,_0x276927){_0x78c2a3=_0x78c2a3-0x0;var _0x990f71=_0x1cb9[_0x78c2a3];return _0x990f71;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'callerid':{'type':Sequelize[_0x91cb('0x1')]},'calleridname':{'type':Sequelize[_0x91cb('0x1')]},'context':{'type':Sequelize[_0x91cb('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x91cb('0x1')]},'accountcode':{'type':Sequelize[_0x91cb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x91cb('0x1')]},'saveName':{'type':Sequelize[_0x91cb('0x1')]},'filename':{'type':Sequelize[_0x91cb('0x1')]},'savePath':{'type':Sequelize[_0x91cb('0x1')]},'format':{'type':Sequelize[_0x91cb('0x2')],'get':function(){var _0x8f8a3b='';var _0x4c1f56=this[_0x91cb('0x3')]('savePath');if(_0x4c1f56){_0x8f8a3b=_0x4c1f56[_0x91cb('0x4')](_0x4c1f56['lastIndexOf']('.'));}return _0x8f8a3b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1954b1a..183bad4 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 _0xdaa9=['nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','update','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x6e23b9,_0x53be36){var _0x204e06=function(_0x1bfba1){while(--_0x1bfba1){_0x6e23b9['push'](_0x6e23b9['shift']());}};_0x204e06(++_0x53be36);}(_0xdaa9,0x14c));var _0x9daa=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xdaa9[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x9daa('0x0'));var rimraf=require(_0x9daa('0x1'));var zipdir=require(_0x9daa('0x2'));var jsonpatch=require(_0x9daa('0x3'));var rp=require(_0x9daa('0x4'));var moment=require('moment');var BPromise=require(_0x9daa('0x5'));var Mustache=require(_0x9daa('0x6'));var util=require('util');var path=require(_0x9daa('0x7'));var sox=require(_0x9daa('0x8'));var csv=require(_0x9daa('0x9'));var ejs=require(_0x9daa('0xa'));var fs=require('fs');var fs_extra=require(_0x9daa('0xb'));var _=require('lodash');var squel=require(_0x9daa('0xc'));var crypto=require(_0x9daa('0xd'));var jsforce=require(_0x9daa('0xe'));var deskjs=require(_0x9daa('0xf'));var toCsv=require(_0x9daa('0x9'));var querystring=require(_0x9daa('0x10'));var Papa=require('papaparse');var Redis=require(_0x9daa('0x11'));var authService=require(_0x9daa('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9daa('0x13'));var logger=require(_0x9daa('0x14'))(_0x9daa('0x15'));var utils=require(_0x9daa('0x16'));var config=require(_0x9daa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x312050,_0x5572eb){_0x5572eb=_0x5572eb||0xcc;return function(_0x4db780){if(_0x4db780){return _0x312050[_0x9daa('0x18')](_0x5572eb);}return _0x312050['status'](_0x5572eb)['end']();};}function respondWithResult(_0x445d8c,_0x411b64){_0x411b64=_0x411b64||0xc8;return function(_0x14e483){if(_0x14e483){return _0x445d8c[_0x9daa('0x19')](_0x411b64)['json'](_0x14e483);}};}function respondWithFilteredResult(_0x49457d,_0x35daa2){return function(_0x368a3e){if(_0x368a3e){var _0x258a39=typeof _0x35daa2[_0x9daa('0x1a')]==='undefined'&&typeof _0x35daa2[_0x9daa('0x1b')]==='undefined';var _0x396054=_0x368a3e[_0x9daa('0x1c')];var _0x37adb8=_0x258a39?0x0:_0x35daa2[_0x9daa('0x1a')];var _0x13525b=_0x258a39?_0x368a3e[_0x9daa('0x1c')]:_0x35daa2[_0x9daa('0x1a')]+_0x35daa2[_0x9daa('0x1b')];var _0x36bcd9;if(_0x13525b>=_0x396054){_0x13525b=_0x396054;_0x36bcd9=0xc8;}else{_0x36bcd9=0xce;}_0x49457d[_0x9daa('0x19')](_0x36bcd9);return _0x49457d[_0x9daa('0x1d')](_0x9daa('0x1e'),_0x37adb8+'-'+_0x13525b+'/'+_0x396054)['json'](_0x368a3e);}return null;};}function patchUpdates(_0x5ae217){return function(_0x13c0ae){try{jsonpatch[_0x9daa('0x1f')](_0x13c0ae,_0x5ae217,!![]);}catch(_0x12d797){return BPromise[_0x9daa('0x20')](_0x12d797);}return _0x13c0ae[_0x9daa('0x21')]();};}function saveUpdates(_0x4f7716,_0x248a22){return function(_0xde67b){if(_0xde67b){return _0xde67b[_0x9daa('0x22')](_0x4f7716)['then'](function(_0x117053){return _0x117053;});}return null;};}function removeEntity(_0x59b716,_0x7e8d01){return function(_0x16c5e6){if(_0x16c5e6){return _0x16c5e6['destroy']()['then'](function(){_0x59b716[_0x9daa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353959,_0x947d31){return function(_0x1e770b){if(!_0x1e770b){_0x353959[_0x9daa('0x18')](0x194);}return _0x1e770b;};}function handleError(_0x25a2bc,_0x25a9c7){_0x25a9c7=_0x25a9c7||0x1f4;return function(_0x16b53a){logger[_0x9daa('0x23')](_0x16b53a['stack']);if(_0x16b53a[_0x9daa('0x24')]){delete _0x16b53a[_0x9daa('0x24')];}_0x25a2bc[_0x9daa('0x19')](_0x25a9c7)[_0x9daa('0x25')](_0x16b53a);};}exports[_0x9daa('0x26')]=function(_0xc04748,_0x4bc757){var _0x42c995={},_0x2b362a={},_0x24c761={'count':0x0,'rows':[]};var _0x346d90=_[_0x9daa('0x27')](db[_0x9daa('0x28')][_0x9daa('0x29')],function(_0x5e0aa2){return{'name':_0x5e0aa2[_0x9daa('0x2a')],'type':_0x5e0aa2[_0x9daa('0x2b')]['key']};});_0x2b362a[_0x9daa('0x2c')]=_[_0x9daa('0x27')](_0x346d90,_0x9daa('0x24'));_0x2b362a[_0x9daa('0x2d')]=_[_0x9daa('0x2e')](_0xc04748[_0x9daa('0x2d')]);_0x2b362a['filters']=_['intersection'](_0x2b362a[_0x9daa('0x2c')],_0x2b362a[_0x9daa('0x2d')]);_0x42c995[_0x9daa('0x2f')]=_[_0x9daa('0x30')](_0x2b362a[_0x9daa('0x2c')],qs[_0x9daa('0x31')](_0xc04748[_0x9daa('0x2d')][_0x9daa('0x31')]));_0x42c995[_0x9daa('0x2f')]=_0x42c995[_0x9daa('0x2f')][_0x9daa('0x32')]?_0x42c995[_0x9daa('0x2f')]:_0x2b362a[_0x9daa('0x2c')];if(!_0xc04748[_0x9daa('0x2d')][_0x9daa('0x33')](_0x9daa('0x34'))){_0x42c995[_0x9daa('0x1b')]=qs[_0x9daa('0x1b')](_0xc04748[_0x9daa('0x2d')][_0x9daa('0x1b')]);_0x42c995[_0x9daa('0x1a')]=qs[_0x9daa('0x1a')](_0xc04748[_0x9daa('0x2d')][_0x9daa('0x1a')]);}_0x42c995[_0x9daa('0x35')]=qs[_0x9daa('0x36')](_0xc04748['query'][_0x9daa('0x36')]);_0x42c995['where']=qs[_0x9daa('0x37')](_[_0x9daa('0x38')](_0xc04748[_0x9daa('0x2d')],_0x2b362a[_0x9daa('0x37')]),_0x346d90);if(_0xc04748[_0x9daa('0x2d')][_0x9daa('0x39')]){_0x42c995[_0x9daa('0x3a')]=_['merge'](_0x42c995[_0x9daa('0x3a')],{'$or':_[_0x9daa('0x27')](_0x346d90,function(_0x5434b8){if(_0x5434b8[_0x9daa('0x2b')]!==_0x9daa('0x3b')){var _0x2a0a28={};_0x2a0a28[_0x5434b8[_0x9daa('0x24')]]={'$like':'%'+_0xc04748[_0x9daa('0x2d')][_0x9daa('0x39')]+'%'};return _0x2a0a28;}})});}_0x42c995=_[_0x9daa('0x3c')]({},_0x42c995,_0xc04748[_0x9daa('0x3d')]);var _0xe3e9eb={'where':_0x42c995['where']};return db['SquareRecording'][_0x9daa('0x1c')](_0xe3e9eb)[_0x9daa('0x3e')](function(_0x1248b7){_0x24c761[_0x9daa('0x1c')]=_0x1248b7;if(_0xc04748[_0x9daa('0x2d')][_0x9daa('0x3f')]){_0x42c995[_0x9daa('0x40')]=[{'all':!![]}];}return db[_0x9daa('0x28')][_0x9daa('0x41')](_0x42c995);})[_0x9daa('0x3e')](function(_0x3c2deb){_0x24c761[_0x9daa('0x42')]=_0x3c2deb;return _0x24c761;})['then'](respondWithFilteredResult(_0x4bc757,_0x42c995))[_0x9daa('0x43')](handleError(_0x4bc757,null));};exports[_0x9daa('0x44')]=function(_0x563b81,_0x3a2b9b){var _0x29fd74={'raw':!![],'where':{'id':_0x563b81[_0x9daa('0x45')]['id']}},_0x4287d0={};_0x4287d0['model']=_[_0x9daa('0x2e')](db[_0x9daa('0x28')][_0x9daa('0x29')]);_0x4287d0[_0x9daa('0x2d')]=_[_0x9daa('0x2e')](_0x563b81[_0x9daa('0x2d')]);_0x4287d0[_0x9daa('0x37')]=_['intersection'](_0x4287d0[_0x9daa('0x2c')],_0x4287d0[_0x9daa('0x2d')]);_0x29fd74[_0x9daa('0x2f')]=_[_0x9daa('0x30')](_0x4287d0[_0x9daa('0x2c')],qs[_0x9daa('0x31')](_0x563b81[_0x9daa('0x2d')][_0x9daa('0x31')]));_0x29fd74[_0x9daa('0x2f')]=_0x29fd74[_0x9daa('0x2f')][_0x9daa('0x32')]?_0x29fd74[_0x9daa('0x2f')]:_0x4287d0['model'];if(_0x563b81[_0x9daa('0x2d')]['includeAll']){_0x29fd74[_0x9daa('0x40')]=[{'all':!![]}];}_0x29fd74=_[_0x9daa('0x3c')]({},_0x29fd74,_0x563b81[_0x9daa('0x3d')]);return db[_0x9daa('0x28')][_0x9daa('0x46')](_0x29fd74)[_0x9daa('0x3e')](handleEntityNotFound(_0x3a2b9b,null))['then'](respondWithResult(_0x3a2b9b,null))['catch'](handleError(_0x3a2b9b,null));};exports[_0x9daa('0x47')]=function(_0x2baebc,_0x41c3ff){return db[_0x9daa('0x28')][_0x9daa('0x47')](_0x2baebc[_0x9daa('0x48')],{})[_0x9daa('0x3e')](respondWithResult(_0x41c3ff,0xc9))['catch'](handleError(_0x41c3ff,null));};exports['update']=function(_0x43a919,_0x4df14a){if(_0x43a919['body']['id']){delete _0x43a919['body']['id'];}return db[_0x9daa('0x28')][_0x9daa('0x46')]({'where':{'id':_0x43a919[_0x9daa('0x45')]['id']}})['then'](handleEntityNotFound(_0x4df14a,null))[_0x9daa('0x3e')](saveUpdates(_0x43a919['body'],null))[_0x9daa('0x3e')](respondWithResult(_0x4df14a,null))['catch'](handleError(_0x4df14a,null));};exports[_0x9daa('0x49')]=function(_0x1b18ab,_0x5c3ffc,_0x1d06b1){var _0x234761=require(_0x9daa('0x4a'));var _0x161552=![];var _0x4b2d2c={};if(_0x1b18ab[_0x9daa('0x2d')]['type']&&_0x1b18ab['query'][_0x9daa('0x2b')]===_0x9daa('0x4b')){_0x4b2d2c[_0x9daa('0x4b')]=_0x1b18ab[_0x9daa('0x45')]['id'];}else{_0x4b2d2c['id']=_0x1b18ab[_0x9daa('0x45')]['id'];}return db[_0x9daa('0x28')][_0x9daa('0x46')]({'where':_0x4b2d2c,'attributes':['id',_0x9daa('0x4c'),_0x9daa('0x4d')],'raw':!![]})[_0x9daa('0x3e')](handleEntityNotFound(_0x5c3ffc,null))[_0x9daa('0x3e')](function(_0x5f17ed){if(_0x5f17ed){var _0x9dd341=_0x5f17ed['savePath'];var _0x4fc137=util[_0x9daa('0x4e')](_0x9daa('0x4f'),_0x9dd341);if(fs['existsSync'](_0x4fc137)){_0x161552=!![];return _0x234761[_0x9daa('0x50')](_0x4fc137,_0x9dd341,config[_0x9daa('0x51')]['recording'])[_0x9daa('0x3e')](function(){return _0x5f17ed;});}return _0x5f17ed;}})['then'](function(_0x353ef4){if(_0x353ef4){var _0x1094b2=_0x353ef4[_0x9daa('0x4c')];if(!fs[_0x9daa('0x52')](_0x1094b2)){throw new db[(_0x9daa('0x53'))]['ValidationError'](_0x9daa('0x54'));}if(_0x353ef4[_0x9daa('0x4d')]){return _0x5c3ffc['download'](_0x1094b2,_0x353ef4[_0x9daa('0x4d')]+path[_0x9daa('0x55')](_0x1094b2),function(){if(_0x161552){fs['unlink'](_0x1094b2);}});}else{return _0x5c3ffc[_0x9daa('0x49')](_0x1094b2,function(_0x56b8a5){if(_0x161552){fs[_0x9daa('0x56')](_0x1094b2);}});}}})['catch'](function(_0x11e0f0){if(_0x11e0f0[_0x9daa('0x57')]==='SquareRecording\x20not\x20found'){_0x5c3ffc[_0x9daa('0x19')](0x194)['send'](_0x9daa('0x58'));}else{return handleError(_0x5c3ffc,null);}});};exports['destroy']=function(_0x4723df,_0x2e57e5){return db[_0x9daa('0x28')][_0x9daa('0x46')]({'where':{'id':_0x4723df[_0x9daa('0x45')]['id']}})['then'](function(_0x33430c){if(_[_0x9daa('0x59')](_0x33430c)){throw new ReferenceError(_0x9daa('0x5a'));}return _0x33430c;})[_0x9daa('0x3e')](function(_0xe2cb68){var _0x20e3e2=_0xe2cb68['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x20e3e2);if(!_['isNil'](_0xe2cb68[_0x9daa('0x4c')])&&fs[_0x9daa('0x52')](_0x20e3e2)){logger['info'](_0x9daa('0x5b')+_0x20e3e2+_0x9daa('0x5c'));fs['unlinkSync'](_0x20e3e2);}_0x20e3e2=_0x20e3e2+_0x9daa('0x5d');if(!_[_0x9daa('0x59')](_0xe2cb68[_0x9daa('0x4c')])&&fs[_0x9daa('0x52')](_0x20e3e2)){logger['info'](_0x9daa('0x5b')+_0x20e3e2+_0x9daa('0x5c'));fs[_0x9daa('0x5e')](_0x20e3e2);}return _0xe2cb68;})[_0x9daa('0x3e')](function(_0x48afdf){if(!_0x48afdf)throw new InternalError();return _0x48afdf['destroy']();})[_0x9daa('0x3e')](function(){_0x2e57e5[_0x9daa('0x19')](0xcc)[_0x9daa('0x5f')]();})[_0x9daa('0x43')](handleError(_0x2e57e5,null));}; \ No newline at end of file +var _0xbce5=['decryptFile','recording','existsSync','SquareRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','SquareRecording','type','model','map','query','intersection','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','fields','length','find','create','body','download','uniqueid','savePath'];(function(_0x49c5a2,_0x4b170c){var _0x450efa=function(_0x94bdea){while(--_0x94bdea){_0x49c5a2['push'](_0x49c5a2['shift']());}};_0x450efa(++_0x4b170c);}(_0xbce5,0x116));var _0x5bce=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0xbce5[_0x1306f3];return _0xc1c7bf;};'use strict';var emlformat=require(_0x5bce('0x0'));var rimraf=require(_0x5bce('0x1'));var zipdir=require(_0x5bce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5bce('0x4'));var util=require(_0x5bce('0x5'));var path=require(_0x5bce('0x6'));var sox=require(_0x5bce('0x7'));var csv=require('to-csv');var ejs=require(_0x5bce('0x8'));var fs=require('fs');var fs_extra=require(_0x5bce('0x9'));var _=require(_0x5bce('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5bce('0xb'));var deskjs=require(_0x5bce('0xc'));var toCsv=require(_0x5bce('0xd'));var querystring=require('querystring');var Papa=require(_0x5bce('0xe'));var Redis=require(_0x5bce('0xf'));var authService=require(_0x5bce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5bce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5bce('0x12'));var config=require(_0x5bce('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414ef4,_0x21896e){_0x21896e=_0x21896e||0xcc;return function(_0x54eebb){if(_0x54eebb){return _0x414ef4[_0x5bce('0x14')](_0x21896e);}return _0x414ef4[_0x5bce('0x15')](_0x21896e)[_0x5bce('0x16')]();};}function respondWithResult(_0x1f48ea,_0x3ed510){_0x3ed510=_0x3ed510||0xc8;return function(_0x516086){if(_0x516086){return _0x1f48ea[_0x5bce('0x15')](_0x3ed510)['json'](_0x516086);}};}function respondWithFilteredResult(_0x31bee8,_0x1cfc4d){return function(_0x1bb14a){if(_0x1bb14a){var _0x581de4=typeof _0x1cfc4d[_0x5bce('0x17')]===_0x5bce('0x18')&&typeof _0x1cfc4d[_0x5bce('0x19')]===_0x5bce('0x18');var _0x329180=_0x1bb14a[_0x5bce('0x1a')];var _0x590104=_0x581de4?0x0:_0x1cfc4d[_0x5bce('0x17')];var _0x3498ca=_0x581de4?_0x1bb14a['count']:_0x1cfc4d[_0x5bce('0x17')]+_0x1cfc4d[_0x5bce('0x19')];var _0xa74a62;if(_0x3498ca>=_0x329180){_0x3498ca=_0x329180;_0xa74a62=0xc8;}else{_0xa74a62=0xce;}_0x31bee8[_0x5bce('0x15')](_0xa74a62);return _0x31bee8['set'](_0x5bce('0x1b'),_0x590104+'-'+_0x3498ca+'/'+_0x329180)[_0x5bce('0x1c')](_0x1bb14a);}return null;};}function patchUpdates(_0x3a0397){return function(_0xb5202f){try{jsonpatch[_0x5bce('0x1d')](_0xb5202f,_0x3a0397,!![]);}catch(_0x58d9ab){return BPromise[_0x5bce('0x1e')](_0x58d9ab);}return _0xb5202f[_0x5bce('0x1f')]();};}function saveUpdates(_0x50099d,_0x705c29){return function(_0x458dac){if(_0x458dac){return _0x458dac[_0x5bce('0x20')](_0x50099d)[_0x5bce('0x21')](function(_0x24b697){return _0x24b697;});}return null;};}function removeEntity(_0x17b160,_0x588460){return function(_0x526fd1){if(_0x526fd1){return _0x526fd1[_0x5bce('0x22')]()[_0x5bce('0x21')](function(){_0x17b160['status'](0xcc)[_0x5bce('0x16')]();});}};}function handleEntityNotFound(_0x46e6df,_0x5a6eae){return function(_0x5641a2){if(!_0x5641a2){_0x46e6df[_0x5bce('0x14')](0x194);}return _0x5641a2;};}function handleError(_0xd3b6d4,_0x225b64){_0x225b64=_0x225b64||0x1f4;return function(_0x519f91){logger[_0x5bce('0x23')](_0x519f91[_0x5bce('0x24')]);if(_0x519f91[_0x5bce('0x25')]){delete _0x519f91[_0x5bce('0x25')];}_0xd3b6d4['status'](_0x225b64)['send'](_0x519f91);};}exports['index']=function(_0x42987f,_0x3c9a40){var _0x422538={},_0x52a860={},_0x5b8c99={'count':0x0,'rows':[]};var _0x540f5a=_['map'](db[_0x5bce('0x26')]['rawAttributes'],function(_0x2027eb){return{'name':_0x2027eb['fieldName'],'type':_0x2027eb[_0x5bce('0x27')]['key']};});_0x52a860[_0x5bce('0x28')]=_[_0x5bce('0x29')](_0x540f5a,_0x5bce('0x25'));_0x52a860[_0x5bce('0x2a')]=_['keys'](_0x42987f[_0x5bce('0x2a')]);_0x52a860['filters']=_[_0x5bce('0x2b')](_0x52a860['model'],_0x52a860[_0x5bce('0x2a')]);_0x422538['attributes']=_[_0x5bce('0x2b')](_0x52a860[_0x5bce('0x28')],qs['fields'](_0x42987f[_0x5bce('0x2a')]['fields']));_0x422538[_0x5bce('0x2c')]=_0x422538['attributes']['length']?_0x422538[_0x5bce('0x2c')]:_0x52a860['model'];if(!_0x42987f[_0x5bce('0x2a')]['hasOwnProperty'](_0x5bce('0x2d'))){_0x422538[_0x5bce('0x19')]=qs[_0x5bce('0x19')](_0x42987f['query'][_0x5bce('0x19')]);_0x422538[_0x5bce('0x17')]=qs[_0x5bce('0x17')](_0x42987f[_0x5bce('0x2a')][_0x5bce('0x17')]);}_0x422538[_0x5bce('0x2e')]=qs[_0x5bce('0x2f')](_0x42987f[_0x5bce('0x2a')][_0x5bce('0x2f')]);_0x422538[_0x5bce('0x30')]=qs[_0x5bce('0x31')](_[_0x5bce('0x32')](_0x42987f[_0x5bce('0x2a')],_0x52a860['filters']),_0x540f5a);if(_0x42987f[_0x5bce('0x2a')]['filter']){_0x422538[_0x5bce('0x30')]=_[_0x5bce('0x33')](_0x422538[_0x5bce('0x30')],{'$or':_['map'](_0x540f5a,function(_0xcd50df){if(_0xcd50df[_0x5bce('0x27')]!==_0x5bce('0x34')){var _0x31b8b2={};_0x31b8b2[_0xcd50df[_0x5bce('0x25')]]={'$like':'%'+_0x42987f[_0x5bce('0x2a')][_0x5bce('0x35')]+'%'};return _0x31b8b2;}})});}_0x422538=_['merge']({},_0x422538,_0x42987f[_0x5bce('0x36')]);var _0x57470c={'where':_0x422538[_0x5bce('0x30')]};return db['SquareRecording'][_0x5bce('0x1a')](_0x57470c)[_0x5bce('0x21')](function(_0x1702a2){_0x5b8c99[_0x5bce('0x1a')]=_0x1702a2;if(_0x42987f[_0x5bce('0x2a')][_0x5bce('0x37')]){_0x422538['include']=[{'all':!![]}];}return db[_0x5bce('0x26')][_0x5bce('0x38')](_0x422538);})[_0x5bce('0x21')](function(_0x52e078){_0x5b8c99[_0x5bce('0x39')]=_0x52e078;return _0x5b8c99;})['then'](respondWithFilteredResult(_0x3c9a40,_0x422538))[_0x5bce('0x3a')](handleError(_0x3c9a40,null));};exports['show']=function(_0xfec4c6,_0x21442c){var _0x34437a={'raw':!![],'where':{'id':_0xfec4c6[_0x5bce('0x3b')]['id']}},_0x59c2d3={};_0x59c2d3['model']=_[_0x5bce('0x3c')](db[_0x5bce('0x26')][_0x5bce('0x3d')]);_0x59c2d3[_0x5bce('0x2a')]=_[_0x5bce('0x3c')](_0xfec4c6[_0x5bce('0x2a')]);_0x59c2d3['filters']=_[_0x5bce('0x2b')](_0x59c2d3[_0x5bce('0x28')],_0x59c2d3[_0x5bce('0x2a')]);_0x34437a[_0x5bce('0x2c')]=_[_0x5bce('0x2b')](_0x59c2d3[_0x5bce('0x28')],qs[_0x5bce('0x3e')](_0xfec4c6[_0x5bce('0x2a')][_0x5bce('0x3e')]));_0x34437a[_0x5bce('0x2c')]=_0x34437a['attributes'][_0x5bce('0x3f')]?_0x34437a['attributes']:_0x59c2d3[_0x5bce('0x28')];if(_0xfec4c6['query']['includeAll']){_0x34437a['include']=[{'all':!![]}];}_0x34437a=_['merge']({},_0x34437a,_0xfec4c6[_0x5bce('0x36')]);return db[_0x5bce('0x26')][_0x5bce('0x40')](_0x34437a)['then'](handleEntityNotFound(_0x21442c,null))['then'](respondWithResult(_0x21442c,null))[_0x5bce('0x3a')](handleError(_0x21442c,null));};exports[_0x5bce('0x41')]=function(_0xda69e7,_0x1ac760){return db[_0x5bce('0x26')][_0x5bce('0x41')](_0xda69e7[_0x5bce('0x42')],{})[_0x5bce('0x21')](respondWithResult(_0x1ac760,0xc9))[_0x5bce('0x3a')](handleError(_0x1ac760,null));};exports[_0x5bce('0x20')]=function(_0x2f7fb7,_0x2e9e9f){if(_0x2f7fb7['body']['id']){delete _0x2f7fb7[_0x5bce('0x42')]['id'];}return db[_0x5bce('0x26')]['find']({'where':{'id':_0x2f7fb7[_0x5bce('0x3b')]['id']}})[_0x5bce('0x21')](handleEntityNotFound(_0x2e9e9f,null))[_0x5bce('0x21')](saveUpdates(_0x2f7fb7['body'],null))[_0x5bce('0x21')](respondWithResult(_0x2e9e9f,null))[_0x5bce('0x3a')](handleError(_0x2e9e9f,null));};exports[_0x5bce('0x43')]=function(_0x411f2f,_0x517e39,_0x547e21){var _0xbcc340=require('../../components/encryptor');var _0xecf90b=![];var _0x2c9d4f={};if(_0x411f2f['query'][_0x5bce('0x27')]&&_0x411f2f[_0x5bce('0x2a')]['type']==='uniqueid'){_0x2c9d4f[_0x5bce('0x44')]=_0x411f2f['params']['id'];}else{_0x2c9d4f['id']=_0x411f2f[_0x5bce('0x3b')]['id'];}return db[_0x5bce('0x26')]['find']({'where':_0x2c9d4f,'attributes':['id',_0x5bce('0x45'),'filename'],'raw':!![]})[_0x5bce('0x21')](handleEntityNotFound(_0x517e39,null))[_0x5bce('0x21')](function(_0x3fd4d1){if(_0x3fd4d1){var _0x31ca88=_0x3fd4d1[_0x5bce('0x45')];var _0x4dab52=util['format']('%s.cypher',_0x31ca88);if(fs['existsSync'](_0x4dab52)){_0xecf90b=!![];return _0xbcc340[_0x5bce('0x46')](_0x4dab52,_0x31ca88,config['secrets'][_0x5bce('0x47')])['then'](function(){return _0x3fd4d1;});}return _0x3fd4d1;}})[_0x5bce('0x21')](function(_0x585d6b){if(_0x585d6b){var _0x4e285b=_0x585d6b[_0x5bce('0x45')];if(!fs[_0x5bce('0x48')](_0x4e285b)){throw new db['Sequelize']['ValidationError'](_0x5bce('0x49'));}if(_0x585d6b[_0x5bce('0x4a')]){return _0x517e39['download'](_0x4e285b,_0x585d6b[_0x5bce('0x4a')]+path[_0x5bce('0x4b')](_0x4e285b),function(){if(_0xecf90b){fs[_0x5bce('0x4c')](_0x4e285b);}});}else{return _0x517e39[_0x5bce('0x43')](_0x4e285b,function(_0x3c16fc){if(_0xecf90b){fs[_0x5bce('0x4c')](_0x4e285b);}});}}})['catch'](function(_0x43ed7d){if(_0x43ed7d[_0x5bce('0x4d')]===_0x5bce('0x49')){_0x517e39['status'](0x194)[_0x5bce('0x4e')](_0x5bce('0x4f'));}else{return handleError(_0x517e39,null);}});};exports['destroy']=function(_0xde15db,_0x337a85){return db['SquareRecording'][_0x5bce('0x40')]({'where':{'id':_0xde15db[_0x5bce('0x3b')]['id']}})['then'](function(_0x3c7679){if(_[_0x5bce('0x50')](_0x3c7679)){throw new ReferenceError(_0x5bce('0x51'));}return _0x3c7679;})[_0x5bce('0x21')](function(_0x3a10ad){var _0xbe8ecd=_0x3a10ad[_0x5bce('0x45')];logger[_0x5bce('0x52')](_0x5bce('0x53'),_0xbe8ecd);if(!_[_0x5bce('0x50')](_0x3a10ad[_0x5bce('0x45')])&&fs[_0x5bce('0x48')](_0xbe8ecd)){logger[_0x5bce('0x52')]('File:\x20\x22'+_0xbe8ecd+_0x5bce('0x54'));fs['unlinkSync'](_0xbe8ecd);}_0xbe8ecd=_0xbe8ecd+'.cypher';if(!_[_0x5bce('0x50')](_0x3a10ad[_0x5bce('0x45')])&&fs['existsSync'](_0xbe8ecd)){logger[_0x5bce('0x52')](_0x5bce('0x55')+_0xbe8ecd+_0x5bce('0x54'));fs[_0x5bce('0x56')](_0xbe8ecd);}return _0x3a10ad;})[_0x5bce('0x21')](function(_0x44ceb6){if(!_0x44ceb6)throw new InternalError();return _0x44ceb6[_0x5bce('0x22')]();})[_0x5bce('0x21')](function(){_0x337a85['status'](0xcc)[_0x5bce('0x16')]();})[_0x5bce('0x3a')](handleError(_0x337a85,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 9ed4ad0..6a37574 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 _0x5324=['./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x217a47,_0x387610){var _0xd84cb4=function(_0x5bb18f){while(--_0x5bb18f){_0x217a47['push'](_0x217a47['shift']());}};_0xd84cb4(++_0x387610);}(_0x5324,0x154));var _0x4532=function(_0x230866,_0x2f08ef){_0x230866=_0x230866-0x0;var _0xc79053=_0x5324[_0x230866];return _0xc79053;};'use strict';var _=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var logger=require(_0x4532('0x2'))(_0x4532('0x3'));var moment=require('moment');var BPromise=require(_0x4532('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4532('0x5'));var rimraf=require(_0x4532('0x6'));var config=require(_0x4532('0x7'));var attributes=require(_0x4532('0x8'));module[_0x4532('0x9')]=function(_0x3f68e2,_0x2672ec){return _0x3f68e2[_0x4532('0xa')]('SquareRecording',attributes,{'tableName':_0x4532('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59ac=['path','../../config/environment','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x59ac,0x73));var _0xc59a=function(_0x2cdbdd,_0x518c1d){_0x2cdbdd=_0x2cdbdd-0x0;var _0x1e4c99=_0x59ac[_0x2cdbdd];return _0x1e4c99;};'use strict';var _=require(_0xc59a('0x0'));var util=require(_0xc59a('0x1'));var logger=require(_0xc59a('0x2'))(_0xc59a('0x3'));var moment=require(_0xc59a('0x4'));var BPromise=require('bluebird');var rp=require(_0xc59a('0x5'));var fs=require('fs');var path=require(_0xc59a('0x6'));var rimraf=require('rimraf');var config=require(_0xc59a('0x7'));var attributes=require(_0xc59a('0x8'));module[_0xc59a('0x9')]=function(_0x25cd8e,_0x204832){return _0x25cd8e['define'](_0xc59a('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 1fd9a01..fb1e56f 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 _0xd8ea=['options','CreateSquareRecording','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','SquareRecording,\x20%s,\x20%s','message','catch','create','body'];(function(_0x1ff385,_0x2f30bb){var _0x563380=function(_0x1022dc){while(--_0x1022dc){_0x1ff385['push'](_0x1ff385['shift']());}};_0x563380(++_0x2f30bb);}(_0xd8ea,0x12f));var _0xad8e=function(_0x399338,_0x11496b){_0x399338=_0x399338-0x0;var _0x3c4485=_0xd8ea[_0x399338];return _0x3c4485;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var moment=require(_0xad8e('0x2'));var BPromise=require(_0xad8e('0x3'));var rs=require(_0xad8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad8e('0x5'))['db'];var utils=require(_0xad8e('0x6'));var logger=require('../../config/logger')(_0xad8e('0x7'));var config=require('../../config/environment');var jayson=require(_0xad8e('0x8'));var client=jayson[_0xad8e('0x9')][_0xad8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x392367,_0x37d993,_0x57731e){return new BPromise(function(_0x325fd6,_0x4e33d4){return client[_0xad8e('0xb')](_0x392367,_0x57731e)[_0xad8e('0xc')](function(_0x42d78d){logger[_0xad8e('0xd')]('SquareRecording,\x20%s,\x20%s',_0x37d993,_0xad8e('0xe'));logger[_0xad8e('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x37d993,_0xad8e('0xe'),JSON['stringify'](_0x42d78d));if(_0x42d78d[_0xad8e('0x10')]){if(_0x42d78d[_0xad8e('0x10')]['code']===0x1f4){logger[_0xad8e('0x10')](_0xad8e('0x11'),_0x37d993,_0x42d78d[_0xad8e('0x10')][_0xad8e('0x12')]);return _0x4e33d4(_0x42d78d[_0xad8e('0x10')]['message']);}logger[_0xad8e('0x10')](_0xad8e('0x11'),_0x37d993,_0x42d78d[_0xad8e('0x10')][_0xad8e('0x12')]);return _0x325fd6(_0x42d78d[_0xad8e('0x10')][_0xad8e('0x12')]);}else{logger[_0xad8e('0xd')]('SquareRecording,\x20%s,\x20%s',_0x37d993,_0xad8e('0xe'));_0x325fd6(_0x42d78d['result'][_0xad8e('0x12')]);}})[_0xad8e('0x13')](function(_0x45e956){logger[_0xad8e('0x10')](_0xad8e('0x11'),_0x37d993,_0x45e956);_0x4e33d4(_0x45e956);});});}exports['CreateSquareRecording']=function(_0x3279ac){var _0x729e62=this;return new Promise(function(_0x4fe32d,_0x1ce9a0){return db['SquareRecording'][_0xad8e('0x14')](_0x3279ac[_0xad8e('0x15')],{'raw':_0x3279ac[_0xad8e('0x16')]?_0x3279ac[_0xad8e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xad8e('0xc')](function(_0x2d9f65){logger[_0xad8e('0xd')]('CreateSquareRecording',_0x3279ac);logger[_0xad8e('0xf')](_0xad8e('0x17'),_0x3279ac,JSON[_0xad8e('0x18')](_0x2d9f65));_0x4fe32d(_0x2d9f65);})[_0xad8e('0x13')](function(_0x39d798){logger['error'](_0xad8e('0x17'),_0x39d798['message'],_0x3279ac);_0x1ce9a0(_0x729e62['error'](0x1f4,_0x39d798[_0xad8e('0x12')]));});});}; \ No newline at end of file +var _0xfe01=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x14dca3,_0xf5b6bb){var _0x741f71=function(_0x33bbfb){while(--_0x33bbfb){_0x14dca3['push'](_0x14dca3['shift']());}};_0x741f71(++_0xf5b6bb);}(_0xfe01,0x92));var _0x1fe0=function(_0x1cdc07,_0x23dcbe){_0x1cdc07=_0x1cdc07-0x0;var _0xc00e00=_0xfe01[_0x1cdc07];return _0xc00e00;};'use strict';var _=require(_0x1fe0('0x0'));var util=require(_0x1fe0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1fe0('0x2'));var fs=require('fs');var Redis=require(_0x1fe0('0x3'));var db=require(_0x1fe0('0x4'))['db'];var utils=require(_0x1fe0('0x5'));var logger=require(_0x1fe0('0x6'))(_0x1fe0('0x7'));var config=require(_0x1fe0('0x8'));var jayson=require(_0x1fe0('0x9'));var client=jayson[_0x1fe0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9919,_0x55c63d,_0x1d68cf){return new BPromise(function(_0x42b069,_0x3ef066){return client[_0x1fe0('0xb')](_0x1f9919,_0x1d68cf)[_0x1fe0('0xc')](function(_0x1aafa1){logger[_0x1fe0('0xd')]('SquareRecording,\x20%s,\x20%s',_0x55c63d,_0x1fe0('0xe'));logger[_0x1fe0('0xf')](_0x1fe0('0x10'),_0x55c63d,_0x1fe0('0xe'),JSON[_0x1fe0('0x11')](_0x1aafa1));if(_0x1aafa1[_0x1fe0('0x12')]){if(_0x1aafa1[_0x1fe0('0x12')][_0x1fe0('0x13')]===0x1f4){logger[_0x1fe0('0x12')](_0x1fe0('0x14'),_0x55c63d,_0x1aafa1[_0x1fe0('0x12')]['message']);return _0x3ef066(_0x1aafa1[_0x1fe0('0x12')][_0x1fe0('0x15')]);}logger[_0x1fe0('0x12')](_0x1fe0('0x14'),_0x55c63d,_0x1aafa1[_0x1fe0('0x12')]['message']);return _0x42b069(_0x1aafa1[_0x1fe0('0x12')][_0x1fe0('0x15')]);}else{logger[_0x1fe0('0xd')]('SquareRecording,\x20%s,\x20%s',_0x55c63d,_0x1fe0('0xe'));_0x42b069(_0x1aafa1['result'][_0x1fe0('0x15')]);}})['catch'](function(_0x47c047){logger[_0x1fe0('0x12')](_0x1fe0('0x14'),_0x55c63d,_0x47c047);_0x3ef066(_0x47c047);});});}exports[_0x1fe0('0x16')]=function(_0x2fe014){var _0x1f4c8a=this;return new Promise(function(_0x16865b,_0x1697f5){return db[_0x1fe0('0x17')]['create'](_0x2fe014[_0x1fe0('0x18')],{'raw':_0x2fe014['options']?_0x2fe014[_0x1fe0('0x19')][_0x1fe0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5859c8){logger[_0x1fe0('0xd')](_0x1fe0('0x16'),_0x2fe014);logger[_0x1fe0('0xf')]('CreateSquareRecording',_0x2fe014,JSON[_0x1fe0('0x11')](_0x5859c8));_0x16865b(_0x5859c8);})['catch'](function(_0x23a04a){logger[_0x1fe0('0x12')](_0x1fe0('0x16'),_0x23a04a[_0x1fe0('0x15')],_0x2fe014);_0x1697f5(_0x1f4c8a[_0x1fe0('0x12')](0x1f4,_0x23a04a[_0x1fe0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 15c75d8..38db920 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1ca4b5,_0x208ac5){var _0x18332c=function(_0x9f1a27){while(--_0x9f1a27){_0x1ca4b5['push'](_0x1ca4b5['shift']());}};_0x18332c(++_0x208ac5);}(_0xb10b,0x12a));var _0xbb10=function(_0x533990,_0x21fe8d){_0x533990=_0x533990-0x0;var _0x5a5e2a=_0xb10b[_0x533990];return _0x5a5e2a;};'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 _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(_0x12263b,_0x5655fa){var _0x54d782=function(_0x452539){while(--_0x452539){_0x12263b['push'](_0x12263b['shift']());}};_0x54d782(++_0x5655fa);}(_0xe706,0xa3));var _0x6e70=function(_0x487f15,_0x1cf5fb){_0x487f15=_0x487f15-0x0;var _0x32c8a1=_0xe706[_0x487f15];return _0x32c8a1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3b4f60b..4eae728 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 _0x838a=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x31ddea,_0x40de6d){var _0x12539b=function(_0x1d353b){while(--_0x1d353b){_0x31ddea['push'](_0x31ddea['shift']());}};_0x12539b(++_0x40de6d);}(_0x838a,0xc2));var _0xa838=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x838a[_0x14f458];return _0x4ff2da;};'use strict';var Sequelize=require(_0xa838('0x0'));module[_0xa838('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa838('0x2')]},'language':{'type':Sequelize[_0xa838('0x2')]},'type':{'type':Sequelize[_0xa838('0x2')]},'uniqueid':{'type':Sequelize[_0xa838('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa838('0x2')]},'calleridname':{'type':Sequelize[_0xa838('0x2')]},'callingpres':{'type':Sequelize[_0xa838('0x2')]},'callingani2':{'type':Sequelize[_0xa838('0x2')]},'callington':{'type':Sequelize[_0xa838('0x2')]},'callingtns':{'type':Sequelize[_0xa838('0x2')]},'dnid':{'type':Sequelize[_0xa838('0x2')]},'rdnis':{'type':Sequelize[_0xa838('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa838('0x2')]},'enhanced':{'type':Sequelize[_0xa838('0x2')]},'accountcode':{'type':Sequelize[_0xa838('0x2')]},'threadid':{'type':Sequelize[_0xa838('0x2')]},'project_name':{'type':Sequelize[_0xa838('0x2')]},'joinAt':{'type':Sequelize[_0xa838('0x3')]},'leaveAt':{'type':Sequelize[_0xa838('0x3')]},'bot':{'type':Sequelize[_0xa838('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x56c7=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x5cc839,_0x2b177c){var _0x58a54a=function(_0x426390){while(--_0x426390){_0x5cc839['push'](_0x5cc839['shift']());}};_0x58a54a(++_0x2b177c);}(_0x56c7,0x169));var _0x756c=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x56c7[_0x888385];return _0x22d5c2;};'use strict';var Sequelize=require(_0x756c('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x756c('0x1')]},'request':{'type':Sequelize[_0x756c('0x1')]},'channel':{'type':Sequelize[_0x756c('0x1')]},'language':{'type':Sequelize[_0x756c('0x1')]},'type':{'type':Sequelize[_0x756c('0x1')]},'uniqueid':{'type':Sequelize[_0x756c('0x1')]},'version':{'type':Sequelize[_0x756c('0x1')]},'callerid':{'type':Sequelize[_0x756c('0x1')]},'calleridname':{'type':Sequelize[_0x756c('0x1')]},'callingpres':{'type':Sequelize[_0x756c('0x1')]},'callingani2':{'type':Sequelize[_0x756c('0x1')]},'callington':{'type':Sequelize[_0x756c('0x1')]},'callingtns':{'type':Sequelize[_0x756c('0x1')]},'dnid':{'type':Sequelize[_0x756c('0x1')]},'rdnis':{'type':Sequelize[_0x756c('0x1')]},'context':{'type':Sequelize[_0x756c('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x756c('0x1')]},'enhanced':{'type':Sequelize[_0x756c('0x1')]},'accountcode':{'type':Sequelize[_0x756c('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x756c('0x1')]},'joinAt':{'type':Sequelize[_0x756c('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x756c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3709996..979d6fb 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 _0x8d49=['params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body'];(function(_0xe2ff4b,_0x37695e){var _0x2290c4=function(_0x88cdac){while(--_0x88cdac){_0xe2ff4b['push'](_0xe2ff4b['shift']());}};_0x2290c4(++_0x37695e);}(_0x8d49,0x136));var _0x98d4=function(_0x4ed925,_0x5242bb){_0x4ed925=_0x4ed925-0x0;var _0x12db7b=_0x8d49[_0x4ed925];return _0x12db7b;};'use strict';var emlformat=require(_0x98d4('0x0'));var rimraf=require(_0x98d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98d4('0x2'));var moment=require(_0x98d4('0x3'));var BPromise=require(_0x98d4('0x4'));var Mustache=require(_0x98d4('0x5'));var util=require(_0x98d4('0x6'));var path=require(_0x98d4('0x7'));var sox=require('sox');var csv=require(_0x98d4('0x8'));var ejs=require(_0x98d4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98d4('0xa'));var squel=require(_0x98d4('0xb'));var crypto=require(_0x98d4('0xc'));var jsforce=require(_0x98d4('0xd'));var deskjs=require(_0x98d4('0xe'));var toCsv=require(_0x98d4('0x8'));var querystring=require(_0x98d4('0xf'));var Papa=require(_0x98d4('0x10'));var Redis=require(_0x98d4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x98d4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98d4('0x13'));var logger=require(_0x98d4('0x14'))(_0x98d4('0x15'));var utils=require('../../config/utils');var config=require(_0x98d4('0x16'));var licenseUtil=require(_0x98d4('0x17'));var db=require(_0x98d4('0x18'))['db'];function respondWithStatusCode(_0x1a0a0a,_0x2ad77f){_0x2ad77f=_0x2ad77f||0xcc;return function(_0x3ee752){if(_0x3ee752){return _0x1a0a0a[_0x98d4('0x19')](_0x2ad77f);}return _0x1a0a0a['status'](_0x2ad77f)[_0x98d4('0x1a')]();};}function respondWithResult(_0x1d3625,_0x1a24e7){_0x1a24e7=_0x1a24e7||0xc8;return function(_0x598da3){if(_0x598da3){return _0x1d3625['status'](_0x1a24e7)['json'](_0x598da3);}};}function respondWithFilteredResult(_0x4d6a07,_0x4610c4){return function(_0xf34dd8){if(_0xf34dd8){var _0x266e08=typeof _0x4610c4[_0x98d4('0x1b')]==='undefined'&&typeof _0x4610c4[_0x98d4('0x1c')]===_0x98d4('0x1d');var _0x47b472=_0xf34dd8[_0x98d4('0x1e')];var _0x17484d=_0x266e08?0x0:_0x4610c4[_0x98d4('0x1b')];var _0x24a96b=_0x266e08?_0xf34dd8['count']:_0x4610c4[_0x98d4('0x1b')]+_0x4610c4[_0x98d4('0x1c')];var _0x2cf6ee;if(_0x24a96b>=_0x47b472){_0x24a96b=_0x47b472;_0x2cf6ee=0xc8;}else{_0x2cf6ee=0xce;}_0x4d6a07[_0x98d4('0x1f')](_0x2cf6ee);return _0x4d6a07['set'](_0x98d4('0x20'),_0x17484d+'-'+_0x24a96b+'/'+_0x47b472)[_0x98d4('0x21')](_0xf34dd8);}return null;};}function patchUpdates(_0x28979e){return function(_0x2840e9){try{jsonpatch[_0x98d4('0x22')](_0x2840e9,_0x28979e,!![]);}catch(_0x5d96c1){return BPromise['reject'](_0x5d96c1);}return _0x2840e9[_0x98d4('0x23')]();};}function saveUpdates(_0x34b5d5,_0x4f769d){return function(_0x4bbd9e){if(_0x4bbd9e){return _0x4bbd9e[_0x98d4('0x24')](_0x34b5d5)[_0x98d4('0x25')](function(_0x189cce){return _0x189cce;});}return null;};}function removeEntity(_0x369469,_0x2f2282){return function(_0x45e87f){if(_0x45e87f){return _0x45e87f[_0x98d4('0x26')]()['then'](function(){_0x369469[_0x98d4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfdb346,_0x24c1a9){return function(_0x3ce8e1){if(!_0x3ce8e1){_0xfdb346[_0x98d4('0x19')](0x194);}return _0x3ce8e1;};}function handleError(_0x580120,_0x54c832){_0x54c832=_0x54c832||0x1f4;return function(_0x43b699){logger[_0x98d4('0x27')](_0x43b699[_0x98d4('0x28')]);if(_0x43b699['name']){delete _0x43b699[_0x98d4('0x29')];}_0x580120['status'](_0x54c832)[_0x98d4('0x2a')](_0x43b699);};}exports[_0x98d4('0x2b')]=function(_0x126196,_0xaf2b22){var _0x4e3593={},_0x444d44={},_0x2cd7b8={'count':0x0,'rows':[]};var _0x2d5e80=_['map'](db[_0x98d4('0x2c')][_0x98d4('0x2d')],function(_0x494b15){return{'name':_0x494b15[_0x98d4('0x2e')],'type':_0x494b15['type'][_0x98d4('0x2f')]};});_0x444d44[_0x98d4('0x30')]=_[_0x98d4('0x31')](_0x2d5e80,_0x98d4('0x29'));_0x444d44['query']=_[_0x98d4('0x32')](_0x126196[_0x98d4('0x33')]);_0x444d44['filters']=_[_0x98d4('0x34')](_0x444d44[_0x98d4('0x30')],_0x444d44[_0x98d4('0x33')]);_0x4e3593[_0x98d4('0x35')]=_[_0x98d4('0x34')](_0x444d44[_0x98d4('0x30')],qs['fields'](_0x126196[_0x98d4('0x33')]['fields']));_0x4e3593[_0x98d4('0x35')]=_0x4e3593[_0x98d4('0x35')]['length']?_0x4e3593[_0x98d4('0x35')]:_0x444d44[_0x98d4('0x30')];if(!_0x126196[_0x98d4('0x33')][_0x98d4('0x36')](_0x98d4('0x37'))){_0x4e3593[_0x98d4('0x1c')]=qs[_0x98d4('0x1c')](_0x126196[_0x98d4('0x33')][_0x98d4('0x1c')]);_0x4e3593[_0x98d4('0x1b')]=qs[_0x98d4('0x1b')](_0x126196[_0x98d4('0x33')][_0x98d4('0x1b')]);}_0x4e3593[_0x98d4('0x38')]=qs[_0x98d4('0x39')](_0x126196[_0x98d4('0x33')][_0x98d4('0x39')]);_0x4e3593[_0x98d4('0x3a')]=qs[_0x98d4('0x3b')](_[_0x98d4('0x3c')](_0x126196[_0x98d4('0x33')],_0x444d44[_0x98d4('0x3b')]),_0x2d5e80);if(_0x126196[_0x98d4('0x33')][_0x98d4('0x3d')]){_0x4e3593[_0x98d4('0x3a')]=_[_0x98d4('0x3e')](_0x4e3593['where'],{'$or':_[_0x98d4('0x31')](_0x2d5e80,function(_0x1d0244){if(_0x1d0244[_0x98d4('0x3f')]!==_0x98d4('0x40')){var _0x3c21b9={};_0x3c21b9[_0x1d0244[_0x98d4('0x29')]]={'$like':'%'+_0x126196[_0x98d4('0x33')][_0x98d4('0x3d')]+'%'};return _0x3c21b9;}})});}_0x4e3593=_['merge']({},_0x4e3593,_0x126196[_0x98d4('0x41')]);var _0x2eeb04={'where':_0x4e3593[_0x98d4('0x3a')]};return db[_0x98d4('0x2c')]['count'](_0x2eeb04)[_0x98d4('0x25')](function(_0x4a04ca){_0x2cd7b8[_0x98d4('0x1e')]=_0x4a04ca;if(_0x126196[_0x98d4('0x33')][_0x98d4('0x42')]){_0x4e3593[_0x98d4('0x43')]=[{'all':!![]}];}return db[_0x98d4('0x2c')]['findAll'](_0x4e3593);})[_0x98d4('0x25')](function(_0x1e1a51){_0x2cd7b8[_0x98d4('0x44')]=_0x1e1a51;return _0x2cd7b8;})[_0x98d4('0x25')](respondWithFilteredResult(_0xaf2b22,_0x4e3593))[_0x98d4('0x45')](handleError(_0xaf2b22,null));};exports[_0x98d4('0x46')]=function(_0x515a08,_0x4ed16e){var _0x4a335e={'raw':!![],'where':{'id':_0x515a08['params']['id']}},_0x384ed6={};_0x384ed6[_0x98d4('0x30')]=_[_0x98d4('0x32')](db['SquareReport'][_0x98d4('0x2d')]);_0x384ed6['query']=_[_0x98d4('0x32')](_0x515a08['query']);_0x384ed6[_0x98d4('0x3b')]=_[_0x98d4('0x34')](_0x384ed6[_0x98d4('0x30')],_0x384ed6[_0x98d4('0x33')]);_0x4a335e['attributes']=_[_0x98d4('0x34')](_0x384ed6[_0x98d4('0x30')],qs[_0x98d4('0x47')](_0x515a08[_0x98d4('0x33')]['fields']));_0x4a335e[_0x98d4('0x35')]=_0x4a335e[_0x98d4('0x35')]['length']?_0x4a335e['attributes']:_0x384ed6['model'];if(_0x515a08[_0x98d4('0x33')][_0x98d4('0x42')]){_0x4a335e[_0x98d4('0x43')]=[{'all':!![]}];}_0x4a335e=_[_0x98d4('0x3e')]({},_0x4a335e,_0x515a08['options']);return db[_0x98d4('0x2c')][_0x98d4('0x48')](_0x4a335e)['then'](handleEntityNotFound(_0x4ed16e,null))[_0x98d4('0x25')](respondWithResult(_0x4ed16e,null))[_0x98d4('0x45')](handleError(_0x4ed16e,null));};exports[_0x98d4('0x49')]=function(_0x17d7a2,_0x2dc34c){return db['SquareReport']['create'](_0x17d7a2[_0x98d4('0x4a')],{})[_0x98d4('0x25')](respondWithResult(_0x2dc34c,0xc9))['catch'](handleError(_0x2dc34c,null));};exports[_0x98d4('0x24')]=function(_0x5ef58,_0x37430a){if(_0x5ef58['body']['id']){delete _0x5ef58['body']['id'];}return db[_0x98d4('0x2c')][_0x98d4('0x48')]({'where':{'id':_0x5ef58[_0x98d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37430a,null))['then'](saveUpdates(_0x5ef58[_0x98d4('0x4a')],null))[_0x98d4('0x25')](respondWithResult(_0x37430a,null))['catch'](handleError(_0x37430a,null));};exports[_0x98d4('0x26')]=function(_0x18339e,_0x16e929){return db[_0x98d4('0x2c')][_0x98d4('0x48')]({'where':{'id':_0x18339e[_0x98d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16e929,null))['then'](removeEntity(_0x16e929,null))[_0x98d4('0x45')](handleError(_0x16e929,null));};exports[_0x98d4('0x4c')]=function(_0x3062c9,_0x316fd8){return db['SquareReport']['describe']()['then'](respondWithResult(_0x316fd8,null))[_0x98d4('0x45')](handleError(_0x316fd8,null));}; \ No newline at end of file +var _0x8d6d=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0x8d6d,0x8a));var _0xd8d6=function(_0x4b355b,_0x107149){_0x4b355b=_0x4b355b-0x0;var _0x225dc7=_0x8d6d[_0x4b355b];return _0x225dc7;};'use strict';var emlformat=require(_0xd8d6('0x0'));var rimraf=require(_0xd8d6('0x1'));var zipdir=require(_0xd8d6('0x2'));var jsonpatch=require(_0xd8d6('0x3'));var rp=require(_0xd8d6('0x4'));var moment=require(_0xd8d6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8d6('0x6'));var path=require(_0xd8d6('0x7'));var sox=require(_0xd8d6('0x8'));var csv=require(_0xd8d6('0x9'));var ejs=require(_0xd8d6('0xa'));var fs=require('fs');var fs_extra=require(_0xd8d6('0xb'));var _=require(_0xd8d6('0xc'));var squel=require(_0xd8d6('0xd'));var crypto=require(_0xd8d6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd8d6('0xf'));var toCsv=require(_0xd8d6('0x9'));var querystring=require(_0xd8d6('0x10'));var Papa=require(_0xd8d6('0x11'));var Redis=require(_0xd8d6('0x12'));var authService=require(_0xd8d6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd8d6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd8d6('0x15'));var utils=require(_0xd8d6('0x16'));var config=require(_0xd8d6('0x17'));var licenseUtil=require(_0xd8d6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x156a85,_0x1adefc){_0x1adefc=_0x1adefc||0xcc;return function(_0x4f8649){if(_0x4f8649){return _0x156a85[_0xd8d6('0x19')](_0x1adefc);}return _0x156a85[_0xd8d6('0x1a')](_0x1adefc)[_0xd8d6('0x1b')]();};}function respondWithResult(_0x4cca65,_0x5374fd){_0x5374fd=_0x5374fd||0xc8;return function(_0x506be6){if(_0x506be6){return _0x4cca65[_0xd8d6('0x1a')](_0x5374fd)[_0xd8d6('0x1c')](_0x506be6);}};}function respondWithFilteredResult(_0x36720c,_0x448e4b){return function(_0x1b3383){if(_0x1b3383){var _0x585db7=typeof _0x448e4b[_0xd8d6('0x1d')]===_0xd8d6('0x1e')&&typeof _0x448e4b['limit']===_0xd8d6('0x1e');var _0x3f1f1d=_0x1b3383[_0xd8d6('0x1f')];var _0x4ebda8=_0x585db7?0x0:_0x448e4b[_0xd8d6('0x1d')];var _0xc30efc=_0x585db7?_0x1b3383['count']:_0x448e4b[_0xd8d6('0x1d')]+_0x448e4b[_0xd8d6('0x20')];var _0x4eacb3;if(_0xc30efc>=_0x3f1f1d){_0xc30efc=_0x3f1f1d;_0x4eacb3=0xc8;}else{_0x4eacb3=0xce;}_0x36720c['status'](_0x4eacb3);return _0x36720c[_0xd8d6('0x21')]('Content-Range',_0x4ebda8+'-'+_0xc30efc+'/'+_0x3f1f1d)[_0xd8d6('0x1c')](_0x1b3383);}return null;};}function patchUpdates(_0x27d8df){return function(_0x45169){try{jsonpatch['apply'](_0x45169,_0x27d8df,!![]);}catch(_0x5b1466){return BPromise[_0xd8d6('0x22')](_0x5b1466);}return _0x45169['save']();};}function saveUpdates(_0x100455,_0x4206f5){return function(_0x8ed902){if(_0x8ed902){return _0x8ed902['update'](_0x100455)[_0xd8d6('0x23')](function(_0x2a2262){return _0x2a2262;});}return null;};}function removeEntity(_0x143ed8,_0xe98937){return function(_0x49f484){if(_0x49f484){return _0x49f484[_0xd8d6('0x24')]()[_0xd8d6('0x23')](function(){_0x143ed8[_0xd8d6('0x1a')](0xcc)[_0xd8d6('0x1b')]();});}};}function handleEntityNotFound(_0x53f4f7,_0x1b4144){return function(_0x3a030c){if(!_0x3a030c){_0x53f4f7[_0xd8d6('0x19')](0x194);}return _0x3a030c;};}function handleError(_0x2e3986,_0x5aafe0){_0x5aafe0=_0x5aafe0||0x1f4;return function(_0x5908ff){logger[_0xd8d6('0x25')](_0x5908ff[_0xd8d6('0x26')]);if(_0x5908ff[_0xd8d6('0x27')]){delete _0x5908ff[_0xd8d6('0x27')];}_0x2e3986[_0xd8d6('0x1a')](_0x5aafe0)[_0xd8d6('0x28')](_0x5908ff);};}exports[_0xd8d6('0x29')]=function(_0xbf5d50,_0x1a161e){var _0x1fd6b5={},_0x4c8673={},_0x3dc371={'count':0x0,'rows':[]};var _0x1e747e=_['map'](db[_0xd8d6('0x2a')][_0xd8d6('0x2b')],function(_0x2d6183){return{'name':_0x2d6183[_0xd8d6('0x2c')],'type':_0x2d6183['type'][_0xd8d6('0x2d')]};});_0x4c8673[_0xd8d6('0x2e')]=_[_0xd8d6('0x2f')](_0x1e747e,'name');_0x4c8673[_0xd8d6('0x30')]=_['keys'](_0xbf5d50['query']);_0x4c8673['filters']=_['intersection'](_0x4c8673[_0xd8d6('0x2e')],_0x4c8673[_0xd8d6('0x30')]);_0x1fd6b5[_0xd8d6('0x31')]=_['intersection'](_0x4c8673[_0xd8d6('0x2e')],qs[_0xd8d6('0x32')](_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x32')]));_0x1fd6b5[_0xd8d6('0x31')]=_0x1fd6b5[_0xd8d6('0x31')]['length']?_0x1fd6b5[_0xd8d6('0x31')]:_0x4c8673[_0xd8d6('0x2e')];if(!_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x33')](_0xd8d6('0x34'))){_0x1fd6b5[_0xd8d6('0x20')]=qs['limit'](_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x20')]);_0x1fd6b5['offset']=qs[_0xd8d6('0x1d')](_0xbf5d50['query'][_0xd8d6('0x1d')]);}_0x1fd6b5[_0xd8d6('0x35')]=qs[_0xd8d6('0x36')](_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x36')]);_0x1fd6b5[_0xd8d6('0x37')]=qs[_0xd8d6('0x38')](_[_0xd8d6('0x39')](_0xbf5d50[_0xd8d6('0x30')],_0x4c8673[_0xd8d6('0x38')]),_0x1e747e);if(_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x3a')]){_0x1fd6b5[_0xd8d6('0x37')]=_[_0xd8d6('0x3b')](_0x1fd6b5[_0xd8d6('0x37')],{'$or':_[_0xd8d6('0x2f')](_0x1e747e,function(_0x4fb839){if(_0x4fb839[_0xd8d6('0x3c')]!==_0xd8d6('0x3d')){var _0x119e32={};_0x119e32[_0x4fb839[_0xd8d6('0x27')]]={'$like':'%'+_0xbf5d50['query'][_0xd8d6('0x3a')]+'%'};return _0x119e32;}})});}_0x1fd6b5=_['merge']({},_0x1fd6b5,_0xbf5d50[_0xd8d6('0x3e')]);var _0x38fe64={'where':_0x1fd6b5[_0xd8d6('0x37')]};return db[_0xd8d6('0x2a')]['count'](_0x38fe64)[_0xd8d6('0x23')](function(_0x5f0fdc){_0x3dc371['count']=_0x5f0fdc;if(_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x3f')]){_0x1fd6b5[_0xd8d6('0x40')]=[{'all':!![]}];}return db[_0xd8d6('0x2a')][_0xd8d6('0x41')](_0x1fd6b5);})['then'](function(_0x365e4b){_0x3dc371[_0xd8d6('0x42')]=_0x365e4b;return _0x3dc371;})['then'](respondWithFilteredResult(_0x1a161e,_0x1fd6b5))[_0xd8d6('0x43')](handleError(_0x1a161e,null));};exports[_0xd8d6('0x44')]=function(_0x1352fc,_0x2f0317){var _0x25bfd6={'raw':!![],'where':{'id':_0x1352fc[_0xd8d6('0x45')]['id']}},_0xee18c3={};_0xee18c3[_0xd8d6('0x2e')]=_['keys'](db[_0xd8d6('0x2a')][_0xd8d6('0x2b')]);_0xee18c3[_0xd8d6('0x30')]=_[_0xd8d6('0x46')](_0x1352fc[_0xd8d6('0x30')]);_0xee18c3['filters']=_['intersection'](_0xee18c3[_0xd8d6('0x2e')],_0xee18c3['query']);_0x25bfd6[_0xd8d6('0x31')]=_['intersection'](_0xee18c3[_0xd8d6('0x2e')],qs[_0xd8d6('0x32')](_0x1352fc[_0xd8d6('0x30')][_0xd8d6('0x32')]));_0x25bfd6['attributes']=_0x25bfd6[_0xd8d6('0x31')][_0xd8d6('0x47')]?_0x25bfd6[_0xd8d6('0x31')]:_0xee18c3[_0xd8d6('0x2e')];if(_0x1352fc[_0xd8d6('0x30')][_0xd8d6('0x3f')]){_0x25bfd6[_0xd8d6('0x40')]=[{'all':!![]}];}_0x25bfd6=_[_0xd8d6('0x3b')]({},_0x25bfd6,_0x1352fc[_0xd8d6('0x3e')]);return db[_0xd8d6('0x2a')][_0xd8d6('0x48')](_0x25bfd6)[_0xd8d6('0x23')](handleEntityNotFound(_0x2f0317,null))['then'](respondWithResult(_0x2f0317,null))[_0xd8d6('0x43')](handleError(_0x2f0317,null));};exports[_0xd8d6('0x49')]=function(_0x30987e,_0x496b10){return db[_0xd8d6('0x2a')][_0xd8d6('0x49')](_0x30987e[_0xd8d6('0x4a')],{})[_0xd8d6('0x23')](respondWithResult(_0x496b10,0xc9))[_0xd8d6('0x43')](handleError(_0x496b10,null));};exports[_0xd8d6('0x4b')]=function(_0x343cfc,_0x34f0cf){if(_0x343cfc['body']['id']){delete _0x343cfc[_0xd8d6('0x4a')]['id'];}return db['SquareReport'][_0xd8d6('0x48')]({'where':{'id':_0x343cfc[_0xd8d6('0x45')]['id']}})[_0xd8d6('0x23')](handleEntityNotFound(_0x34f0cf,null))['then'](saveUpdates(_0x343cfc[_0xd8d6('0x4a')],null))['then'](respondWithResult(_0x34f0cf,null))[_0xd8d6('0x43')](handleError(_0x34f0cf,null));};exports[_0xd8d6('0x24')]=function(_0x918a01,_0x268191){return db[_0xd8d6('0x2a')][_0xd8d6('0x48')]({'where':{'id':_0x918a01[_0xd8d6('0x45')]['id']}})[_0xd8d6('0x23')](handleEntityNotFound(_0x268191,null))[_0xd8d6('0x23')](removeEntity(_0x268191,null))[_0xd8d6('0x43')](handleError(_0x268191,null));};exports[_0xd8d6('0x4c')]=function(_0x2526de,_0x224e14){return db[_0xd8d6('0x2a')]['describe']()[_0xd8d6('0x23')](respondWithResult(_0x224e14,null))[_0xd8d6('0x43')](handleError(_0x224e14,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 714c68c..4aa10a1 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 _0xdd33=['path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x295b0d,_0x57f9a3){var _0xb9edf4=function(_0x31fa83){while(--_0x31fa83){_0x295b0d['push'](_0x295b0d['shift']());}};_0xb9edf4(++_0x57f9a3);}(_0xdd33,0xfa));var _0x3dd3=function(_0xd2a9f7,_0x148259){_0xd2a9f7=_0xd2a9f7-0x0;var _0x4d9bff=_0xdd33[_0xd2a9f7];return _0x4d9bff;};'use strict';var _=require(_0x3dd3('0x0'));var util=require(_0x3dd3('0x1'));var logger=require(_0x3dd3('0x2'))(_0x3dd3('0x3'));var moment=require(_0x3dd3('0x4'));var BPromise=require(_0x3dd3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dd3('0x6'));var rimraf=require(_0x3dd3('0x7'));var config=require(_0x3dd3('0x8'));var attributes=require(_0x3dd3('0x9'));module['exports']=function(_0x4cbb84,_0xb0e5a1){return _0x4cbb84[_0x3dd3('0xa')](_0x3dd3('0xb'),attributes,{'tableName':_0x3dd3('0xc'),'paranoid':![],'indexes':[{'name':_0x3dd3('0xd'),'fields':['uniqueid',_0x3dd3('0xe')]},{'name':_0x3dd3('0xf'),'fields':[_0x3dd3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x337b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0xd76edb,_0x1583c4){var _0x528c9b=function(_0x2ef8c2){while(--_0x2ef8c2){_0xd76edb['push'](_0xd76edb['shift']());}};_0x528c9b(++_0x1583c4);}(_0x337b,0xd7));var _0xb337=function(_0x1b60cf,_0x1bce5f){_0x1b60cf=_0x1b60cf-0x0;var _0x43264f=_0x337b[_0x1b60cf];return _0x43264f;};'use strict';var _=require(_0xb337('0x0'));var util=require(_0xb337('0x1'));var logger=require(_0xb337('0x2'))('api');var moment=require(_0xb337('0x3'));var BPromise=require(_0xb337('0x4'));var rp=require(_0xb337('0x5'));var fs=require('fs');var path=require(_0xb337('0x6'));var rimraf=require(_0xb337('0x7'));var config=require(_0xb337('0x8'));var attributes=require(_0xb337('0x9'));module[_0xb337('0xa')]=function(_0xeb8507,_0x38518b){return _0xeb8507[_0xb337('0xb')](_0xb337('0xc'),attributes,{'tableName':_0xb337('0xd'),'paranoid':![],'indexes':[{'name':_0xb337('0xe'),'fields':[_0xb337('0xf'),_0xb337('0x10')]},{'name':_0xb337('0x11'),'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 02203be..ea578ac 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 _0x7533=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareReport','create','body','options','CreateSquareReport','debug','UpdateSquareReport','update','raw','where','attributes','limit','stringify'];(function(_0x174b54,_0x4cf10c){var _0x1d40b0=function(_0x13fe5c){while(--_0x13fe5c){_0x174b54['push'](_0x174b54['shift']());}};_0x1d40b0(++_0x4cf10c);}(_0x7533,0x180));var _0x3753=function(_0x4626f6,_0x81baa4){_0x4626f6=_0x4626f6-0x0;var _0x36e955=_0x7533[_0x4626f6];return _0x36e955;};'use strict';var _=require('lodash');var util=require(_0x3753('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3753('0x1'));var db=require(_0x3753('0x2'))['db'];var utils=require(_0x3753('0x3'));var logger=require(_0x3753('0x4'))(_0x3753('0x5'));var config=require(_0x3753('0x6'));var jayson=require(_0x3753('0x7'));var client=jayson[_0x3753('0x8')][_0x3753('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bbaa7,_0x4d8062,_0x4bd95e){return new BPromise(function(_0x24d403,_0x2c72a1){return client['request'](_0x1bbaa7,_0x4bd95e)[_0x3753('0xa')](function(_0x333170){logger[_0x3753('0xb')](_0x3753('0xc'),_0x4d8062,_0x3753('0xd'));logger['debug'](_0x3753('0xe'),_0x4d8062,_0x3753('0xd'),JSON['stringify'](_0x333170));if(_0x333170[_0x3753('0xf')]){if(_0x333170[_0x3753('0xf')][_0x3753('0x10')]===0x1f4){logger['error'](_0x3753('0xc'),_0x4d8062,_0x333170[_0x3753('0xf')]['message']);return _0x2c72a1(_0x333170[_0x3753('0xf')]['message']);}logger[_0x3753('0xf')]('SquareReport,\x20%s,\x20%s',_0x4d8062,_0x333170[_0x3753('0xf')][_0x3753('0x11')]);return _0x24d403(_0x333170['error'][_0x3753('0x11')]);}else{logger['info'](_0x3753('0xc'),_0x4d8062,_0x3753('0xd'));_0x24d403(_0x333170['result'][_0x3753('0x11')]);}})[_0x3753('0x12')](function(_0x26d7b5){logger[_0x3753('0xf')](_0x3753('0xc'),_0x4d8062,_0x26d7b5);_0x2c72a1(_0x26d7b5);});});}exports['CreateSquareReport']=function(_0x19ada7){var _0x3b9be1=this;return new Promise(function(_0x5e5f82,_0x3e3e23){return db[_0x3753('0x13')][_0x3753('0x14')](_0x19ada7[_0x3753('0x15')],{'raw':_0x19ada7['options']?_0x19ada7[_0x3753('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x3753('0xa')](function(_0x1df383){logger['info'](_0x3753('0x17'),_0x19ada7);logger[_0x3753('0x18')](_0x3753('0x17'),_0x19ada7,JSON['stringify'](_0x1df383));_0x5e5f82(_0x1df383);})[_0x3753('0x12')](function(_0x43e012){logger[_0x3753('0xf')](_0x3753('0x17'),_0x43e012[_0x3753('0x11')],_0x19ada7);_0x3e3e23(_0x3b9be1[_0x3753('0xf')](0x1f4,_0x43e012['message']));});});};exports[_0x3753('0x19')]=function(_0x292cde){var _0x134d20=this;return new Promise(function(_0x2f8121,_0x316d59){return db[_0x3753('0x13')][_0x3753('0x1a')](_0x292cde[_0x3753('0x15')],{'raw':_0x292cde[_0x3753('0x16')]?_0x292cde['options'][_0x3753('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292cde[_0x3753('0x16')]?_0x292cde[_0x3753('0x16')][_0x3753('0x1c')]||null:null,'attributes':_0x292cde['options']?_0x292cde[_0x3753('0x16')][_0x3753('0x1d')]||null:null,'limit':_0x292cde[_0x3753('0x16')]?_0x292cde[_0x3753('0x16')][_0x3753('0x1e')]||null:null})[_0x3753('0xa')](function(_0x4aca06){logger[_0x3753('0xb')](_0x3753('0x19'),_0x292cde);logger[_0x3753('0x18')](_0x3753('0x19'),_0x292cde,JSON[_0x3753('0x1f')](_0x4aca06));_0x2f8121(_0x4aca06);})[_0x3753('0x12')](function(_0x3acb33){logger[_0x3753('0xf')](_0x3753('0x19'),_0x3acb33[_0x3753('0x11')],_0x292cde);_0x316d59(_0x134d20[_0x3753('0xf')](0x1f4,_0x3acb33['message']));});});}; \ No newline at end of file +var _0xcc9d=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','options','raw','catch','UpdateSquareReport','body','where','attributes','limit','then','moment','bluebird','randomstring','../../mysqldb'];(function(_0x22a828,_0x4c2a81){var _0xe7dfbe=function(_0x56f36a){while(--_0x56f36a){_0x22a828['push'](_0x22a828['shift']());}};_0xe7dfbe(++_0x4c2a81);}(_0xcc9d,0x17c));var _0xdcc9=function(_0x45d23c,_0x5ddff2){_0x45d23c=_0x45d23c-0x0;var _0x5932a9=_0xcc9d[_0x45d23c];return _0x5932a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdcc9('0x0'));var BPromise=require(_0xdcc9('0x1'));var rs=require(_0xdcc9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcc9('0x3'))['db'];var utils=require(_0xdcc9('0x4'));var logger=require(_0xdcc9('0x5'))(_0xdcc9('0x6'));var config=require(_0xdcc9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdcc9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x340f02,_0xaf3a40,_0x87f1e0){return new BPromise(function(_0x39e94d,_0xaacb74){return client[_0xdcc9('0x9')](_0x340f02,_0x87f1e0)['then'](function(_0x54535d){logger[_0xdcc9('0xa')](_0xdcc9('0xb'),_0xaf3a40,_0xdcc9('0xc'));logger[_0xdcc9('0xd')](_0xdcc9('0xe'),_0xaf3a40,_0xdcc9('0xc'),JSON[_0xdcc9('0xf')](_0x54535d));if(_0x54535d[_0xdcc9('0x10')]){if(_0x54535d[_0xdcc9('0x10')][_0xdcc9('0x11')]===0x1f4){logger[_0xdcc9('0x10')](_0xdcc9('0xb'),_0xaf3a40,_0x54535d[_0xdcc9('0x10')]['message']);return _0xaacb74(_0x54535d[_0xdcc9('0x10')]['message']);}logger[_0xdcc9('0x10')](_0xdcc9('0xb'),_0xaf3a40,_0x54535d[_0xdcc9('0x10')][_0xdcc9('0x12')]);return _0x39e94d(_0x54535d[_0xdcc9('0x10')][_0xdcc9('0x12')]);}else{logger[_0xdcc9('0xa')]('SquareReport,\x20%s,\x20%s',_0xaf3a40,'request\x20sent');_0x39e94d(_0x54535d[_0xdcc9('0x13')][_0xdcc9('0x12')]);}})['catch'](function(_0x1eae3f){logger['error'](_0xdcc9('0xb'),_0xaf3a40,_0x1eae3f);_0xaacb74(_0x1eae3f);});});}exports[_0xdcc9('0x14')]=function(_0x376d59){var _0x41201e=this;return new Promise(function(_0x1cc9b8,_0x3d4aad){return db[_0xdcc9('0x15')][_0xdcc9('0x16')](_0x376d59['body'],{'raw':_0x376d59[_0xdcc9('0x17')]?_0x376d59[_0xdcc9('0x17')][_0xdcc9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1d5d92){logger[_0xdcc9('0xa')](_0xdcc9('0x14'),_0x376d59);logger[_0xdcc9('0xd')]('CreateSquareReport',_0x376d59,JSON[_0xdcc9('0xf')](_0x1d5d92));_0x1cc9b8(_0x1d5d92);})[_0xdcc9('0x19')](function(_0x18df92){logger[_0xdcc9('0x10')](_0xdcc9('0x14'),_0x18df92[_0xdcc9('0x12')],_0x376d59);_0x3d4aad(_0x41201e[_0xdcc9('0x10')](0x1f4,_0x18df92['message']));});});};exports[_0xdcc9('0x1a')]=function(_0xecb0bb){var _0xb203cb=this;return new Promise(function(_0x12827d,_0x10e513){return db[_0xdcc9('0x15')]['update'](_0xecb0bb[_0xdcc9('0x1b')],{'raw':_0xecb0bb[_0xdcc9('0x17')]?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xecb0bb[_0xdcc9('0x17')]?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x1c')]||null:null,'attributes':_0xecb0bb[_0xdcc9('0x17')]?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x1d')]||null:null,'limit':_0xecb0bb['options']?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x1e')]||null:null})[_0xdcc9('0x1f')](function(_0x42f259){logger[_0xdcc9('0xa')](_0xdcc9('0x1a'),_0xecb0bb);logger[_0xdcc9('0xd')]('UpdateSquareReport',_0xecb0bb,JSON[_0xdcc9('0xf')](_0x42f259));_0x12827d(_0x42f259);})[_0xdcc9('0x19')](function(_0x3e6d0a){logger[_0xdcc9('0x10')]('UpdateSquareReport',_0x3e6d0a[_0xdcc9('0x12')],_0xecb0bb);_0x10e513(_0xb203cb[_0xdcc9('0x10')](0x1f4,_0x3e6d0a[_0xdcc9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e44d0e5..0dbb9f1 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 _0x6ec8=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe'];(function(_0x2d9232,_0x5acf05){var _0x846971=function(_0x23c4fc){while(--_0x23c4fc){_0x2d9232['push'](_0x2d9232['shift']());}};_0x846971(++_0x5acf05);}(_0x6ec8,0x13d));var _0x86ec=function(_0x5c264f,_0x571dfa){_0x5c264f=_0x5c264f-0x0;var _0x57455c=_0x6ec8[_0x5c264f];return _0x57455c;};'use strict';var multer=require(_0x86ec('0x0'));var util=require(_0x86ec('0x1'));var path=require(_0x86ec('0x2'));var timeout=require(_0x86ec('0x3'));var express=require('express');var router=express[_0x86ec('0x4')]();var fs_extra=require(_0x86ec('0x5'));var auth=require(_0x86ec('0x6'));var interaction=require(_0x86ec('0x7'));var config=require(_0x86ec('0x8'));var controller=require(_0x86ec('0x9'));router[_0x86ec('0xa')]('/',auth[_0x86ec('0xb')](),controller['index']);router['get'](_0x86ec('0xc'),auth[_0x86ec('0xb')](),controller['describe']);router['get'](_0x86ec('0xd'),auth[_0x86ec('0xb')](),controller[_0x86ec('0xe')]);router[_0x86ec('0xf')]('/',auth[_0x86ec('0xb')](),controller[_0x86ec('0x10')]);router[_0x86ec('0x11')](_0x86ec('0xd'),auth['isAuthenticated'](),controller[_0x86ec('0x12')]);router[_0x86ec('0x13')](_0x86ec('0xd'),auth[_0x86ec('0xb')](),controller[_0x86ec('0x14')]);module[_0x86ec('0x15')]=router; \ No newline at end of file +var _0xdabd=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports'];(function(_0x39e53c,_0x5df21f){var _0x17a3b1=function(_0x14b558){while(--_0x14b558){_0x39e53c['push'](_0x39e53c['shift']());}};_0x17a3b1(++_0x5df21f);}(_0xdabd,0x8c));var _0xddab=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xdabd[_0x5cc8b9];return _0x58892e;};'use strict';var multer=require(_0xddab('0x0'));var util=require('util');var path=require(_0xddab('0x1'));var timeout=require('connect-timeout');var express=require(_0xddab('0x2'));var router=express[_0xddab('0x3')]();var fs_extra=require(_0xddab('0x4'));var auth=require(_0xddab('0x5'));var interaction=require(_0xddab('0x6'));var config=require('../../config/environment');var controller=require(_0xddab('0x7'));router[_0xddab('0x8')]('/',auth[_0xddab('0x9')](),controller[_0xddab('0xa')]);router[_0xddab('0x8')](_0xddab('0xb'),auth[_0xddab('0x9')](),controller[_0xddab('0xc')]);router['get']('/:id',auth[_0xddab('0x9')](),controller[_0xddab('0xd')]);router['post']('/',auth[_0xddab('0x9')](),controller[_0xddab('0xe')]);router[_0xddab('0xf')](_0xddab('0x10'),auth[_0xddab('0x9')](),controller[_0xddab('0x11')]);router['delete'](_0xddab('0x10'),auth[_0xddab('0x9')](),controller[_0xddab('0x12')]);module[_0xddab('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index d214341..78dc88f 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 _0x60b5=['TEXT','sequelize','STRING'];(function(_0x2b6d7c,_0x2bfbf4){var _0x4151b4=function(_0x1cc163){while(--_0x1cc163){_0x2b6d7c['push'](_0x2b6d7c['shift']());}};_0x4151b4(++_0x2bfbf4);}(_0x60b5,0x142));var _0x560b=function(_0x312d98,_0x33ef18){_0x312d98=_0x312d98-0x0;var _0x19669b=_0x60b5[_0x312d98];return _0x19669b;};'use strict';var Sequelize=require(_0x560b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x560b('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x560b('0x1')]},'data':{'type':Sequelize[_0x560b('0x2')]},'project_name':{'type':Sequelize[_0x560b('0x1')]},'callerid':{'type':Sequelize[_0x560b('0x1')]}}; \ No newline at end of file +var _0x2361=['exports','STRING','sequelize'];(function(_0x487a08,_0x5b68d1){var _0x4ca795=function(_0x118602){while(--_0x118602){_0x487a08['push'](_0x487a08['shift']());}};_0x4ca795(++_0x5b68d1);}(_0x2361,0x1ca));var _0x1236=function(_0x46c297,_0x13d386){_0x46c297=_0x46c297-0x0;var _0x4274f3=_0x2361[_0x46c297];return _0x4274f3;};'use strict';var Sequelize=require(_0x1236('0x0'));module[_0x1236('0x1')]={'uniqueid':{'type':Sequelize[_0x1236('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1236('0x2')]},'callerid':{'type':Sequelize[_0x1236('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1ae0064..15ec50b 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 _0xaf3a=['sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','SquareDetailsReport','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','fields','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xaf3a,0x148));var _0xaaf3=function(_0x4c378e,_0x286afb){_0x4c378e=_0x4c378e-0x0;var _0xf41ce7=_0xaf3a[_0x4c378e];return _0xf41ce7;};'use strict';var emlformat=require(_0xaaf3('0x0'));var rimraf=require(_0xaaf3('0x1'));var zipdir=require(_0xaaf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaaf3('0x3'));var BPromise=require(_0xaaf3('0x4'));var Mustache=require(_0xaaf3('0x5'));var util=require(_0xaaf3('0x6'));var path=require(_0xaaf3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaaf3('0x8'));var jsforce=require(_0xaaf3('0x9'));var deskjs=require(_0xaaf3('0xa'));var toCsv=require(_0xaaf3('0xb'));var querystring=require(_0xaaf3('0xc'));var Papa=require(_0xaaf3('0xd'));var Redis=require('ioredis');var authService=require(_0xaaf3('0xe'));var qs=require(_0xaaf3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaf3('0x10'));var logger=require(_0xaaf3('0x11'))(_0xaaf3('0x12'));var utils=require(_0xaaf3('0x13'));var config=require(_0xaaf3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaaf3('0x15'))['db'];function respondWithStatusCode(_0x1f6087,_0x3e9a75){_0x3e9a75=_0x3e9a75||0xcc;return function(_0x4d53d2){if(_0x4d53d2){return _0x1f6087[_0xaaf3('0x16')](_0x3e9a75);}return _0x1f6087['status'](_0x3e9a75)[_0xaaf3('0x17')]();};}function respondWithResult(_0x123a32,_0x4ae063){_0x4ae063=_0x4ae063||0xc8;return function(_0x4155b3){if(_0x4155b3){return _0x123a32[_0xaaf3('0x18')](_0x4ae063)[_0xaaf3('0x19')](_0x4155b3);}};}function respondWithFilteredResult(_0x4c6a17,_0x2e7350){return function(_0x4cd0d7){if(_0x4cd0d7){var _0x1c415e=typeof _0x2e7350[_0xaaf3('0x1a')]==='undefined'&&typeof _0x2e7350[_0xaaf3('0x1b')]===_0xaaf3('0x1c');var _0x38c467=_0x4cd0d7[_0xaaf3('0x1d')];var _0x469855=_0x1c415e?0x0:_0x2e7350[_0xaaf3('0x1a')];var _0x5d63b6=_0x1c415e?_0x4cd0d7[_0xaaf3('0x1d')]:_0x2e7350[_0xaaf3('0x1a')]+_0x2e7350[_0xaaf3('0x1b')];var _0x3ea629;if(_0x5d63b6>=_0x38c467){_0x5d63b6=_0x38c467;_0x3ea629=0xc8;}else{_0x3ea629=0xce;}_0x4c6a17[_0xaaf3('0x18')](_0x3ea629);return _0x4c6a17[_0xaaf3('0x1e')](_0xaaf3('0x1f'),_0x469855+'-'+_0x5d63b6+'/'+_0x38c467)['json'](_0x4cd0d7);}return null;};}function patchUpdates(_0x4b3339){return function(_0x3c793a){try{jsonpatch[_0xaaf3('0x20')](_0x3c793a,_0x4b3339,!![]);}catch(_0x281857){return BPromise[_0xaaf3('0x21')](_0x281857);}return _0x3c793a['save']();};}function saveUpdates(_0x54e500,_0xf35f7e){return function(_0x1ad89d){if(_0x1ad89d){return _0x1ad89d[_0xaaf3('0x22')](_0x54e500)[_0xaaf3('0x23')](function(_0x5daa0e){return _0x5daa0e;});}return null;};}function removeEntity(_0x97851,_0xeee64c){return function(_0x370655){if(_0x370655){return _0x370655[_0xaaf3('0x24')]()[_0xaaf3('0x23')](function(){_0x97851[_0xaaf3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccf2f,_0x503b44){return function(_0x159600){if(!_0x159600){_0x2ccf2f[_0xaaf3('0x16')](0x194);}return _0x159600;};}function handleError(_0x585093,_0x37787e){_0x37787e=_0x37787e||0x1f4;return function(_0x2e38a7){logger['error'](_0x2e38a7[_0xaaf3('0x25')]);if(_0x2e38a7[_0xaaf3('0x26')]){delete _0x2e38a7['name'];}_0x585093[_0xaaf3('0x18')](_0x37787e)['send'](_0x2e38a7);};}exports[_0xaaf3('0x27')]=function(_0x381999,_0x39fa55){var _0x202b61={},_0x4b961b={},_0x260427={'count':0x0,'rows':[]};var _0x3f76d4=_[_0xaaf3('0x28')](db[_0xaaf3('0x29')]['rawAttributes'],function(_0x347793){return{'name':_0x347793['fieldName'],'type':_0x347793[_0xaaf3('0x2a')]['key']};});_0x4b961b[_0xaaf3('0x2b')]=_[_0xaaf3('0x28')](_0x3f76d4,_0xaaf3('0x26'));_0x4b961b[_0xaaf3('0x2c')]=_[_0xaaf3('0x2d')](_0x381999[_0xaaf3('0x2c')]);_0x4b961b[_0xaaf3('0x2e')]=_[_0xaaf3('0x2f')](_0x4b961b['model'],_0x4b961b[_0xaaf3('0x2c')]);_0x202b61[_0xaaf3('0x30')]=_[_0xaaf3('0x2f')](_0x4b961b['model'],qs['fields'](_0x381999[_0xaaf3('0x2c')]['fields']));_0x202b61[_0xaaf3('0x30')]=_0x202b61[_0xaaf3('0x30')][_0xaaf3('0x31')]?_0x202b61[_0xaaf3('0x30')]:_0x4b961b['model'];if(!_0x381999['query']['hasOwnProperty'](_0xaaf3('0x32'))){_0x202b61[_0xaaf3('0x1b')]=qs['limit'](_0x381999['query'][_0xaaf3('0x1b')]);_0x202b61['offset']=qs[_0xaaf3('0x1a')](_0x381999[_0xaaf3('0x2c')][_0xaaf3('0x1a')]);}_0x202b61[_0xaaf3('0x33')]=qs['sort'](_0x381999[_0xaaf3('0x2c')][_0xaaf3('0x34')]);_0x202b61['where']=qs[_0xaaf3('0x2e')](_[_0xaaf3('0x35')](_0x381999[_0xaaf3('0x2c')],_0x4b961b['filters']),_0x3f76d4);if(_0x381999[_0xaaf3('0x2c')][_0xaaf3('0x36')]){_0x202b61[_0xaaf3('0x37')]=_[_0xaaf3('0x38')](_0x202b61[_0xaaf3('0x37')],{'$or':_['map'](_0x3f76d4,function(_0x212d69){if(_0x212d69['type']!==_0xaaf3('0x39')){var _0x25fbbe={};_0x25fbbe[_0x212d69[_0xaaf3('0x26')]]={'$like':'%'+_0x381999[_0xaaf3('0x2c')][_0xaaf3('0x36')]+'%'};return _0x25fbbe;}})});}_0x202b61=_['merge']({},_0x202b61,_0x381999['options']);var _0x618b8f={'where':_0x202b61[_0xaaf3('0x37')]};return db['SquareDetailsReport'][_0xaaf3('0x1d')](_0x618b8f)[_0xaaf3('0x23')](function(_0x173431){_0x260427[_0xaaf3('0x1d')]=_0x173431;if(_0x381999[_0xaaf3('0x2c')]['includeAll']){_0x202b61[_0xaaf3('0x3a')]=[{'all':!![]}];}return db[_0xaaf3('0x29')][_0xaaf3('0x3b')](_0x202b61);})[_0xaaf3('0x23')](function(_0x31d6f3){_0x260427['rows']=_0x31d6f3;return _0x260427;})[_0xaaf3('0x23')](respondWithFilteredResult(_0x39fa55,_0x202b61))[_0xaaf3('0x3c')](handleError(_0x39fa55,null));};exports[_0xaaf3('0x3d')]=function(_0x509601,_0xe7274d){var _0x319c0a={'raw':!![],'where':{'id':_0x509601[_0xaaf3('0x3e')]['id']}},_0x1736ca={};_0x1736ca['model']=_[_0xaaf3('0x2d')](db['SquareDetailsReport'][_0xaaf3('0x3f')]);_0x1736ca['query']=_['keys'](_0x509601[_0xaaf3('0x2c')]);_0x1736ca[_0xaaf3('0x2e')]=_[_0xaaf3('0x2f')](_0x1736ca[_0xaaf3('0x2b')],_0x1736ca['query']);_0x319c0a['attributes']=_[_0xaaf3('0x2f')](_0x1736ca['model'],qs['fields'](_0x509601[_0xaaf3('0x2c')][_0xaaf3('0x40')]));_0x319c0a[_0xaaf3('0x30')]=_0x319c0a['attributes']['length']?_0x319c0a[_0xaaf3('0x30')]:_0x1736ca[_0xaaf3('0x2b')];if(_0x509601['query'][_0xaaf3('0x41')]){_0x319c0a[_0xaaf3('0x3a')]=[{'all':!![]}];}_0x319c0a=_['merge']({},_0x319c0a,_0x509601['options']);return db[_0xaaf3('0x29')]['find'](_0x319c0a)['then'](handleEntityNotFound(_0xe7274d,null))[_0xaaf3('0x23')](respondWithResult(_0xe7274d,null))['catch'](handleError(_0xe7274d,null));};exports[_0xaaf3('0x42')]=function(_0x299d6b,_0x2b2632){return db['SquareDetailsReport'][_0xaaf3('0x42')](_0x299d6b[_0xaaf3('0x43')],{})[_0xaaf3('0x23')](respondWithResult(_0x2b2632,0xc9))['catch'](handleError(_0x2b2632,null));};exports[_0xaaf3('0x22')]=function(_0x36d205,_0x6c7b47){if(_0x36d205[_0xaaf3('0x43')]['id']){delete _0x36d205['body']['id'];}return db[_0xaaf3('0x29')][_0xaaf3('0x44')]({'where':{'id':_0x36d205[_0xaaf3('0x3e')]['id']}})[_0xaaf3('0x23')](handleEntityNotFound(_0x6c7b47,null))[_0xaaf3('0x23')](saveUpdates(_0x36d205[_0xaaf3('0x43')],null))['then'](respondWithResult(_0x6c7b47,null))['catch'](handleError(_0x6c7b47,null));};exports[_0xaaf3('0x24')]=function(_0xfc46a8,_0x4ece77){return db[_0xaaf3('0x29')][_0xaaf3('0x44')]({'where':{'id':_0xfc46a8[_0xaaf3('0x3e')]['id']}})[_0xaaf3('0x23')](handleEntityNotFound(_0x4ece77,null))['then'](removeEntity(_0x4ece77,null))[_0xaaf3('0x3c')](handleError(_0x4ece77,null));};exports[_0xaaf3('0x45')]=function(_0x3b67ef,_0x5c7376){return db[_0xaaf3('0x29')][_0xaaf3('0x45')]()[_0xaaf3('0x23')](respondWithResult(_0x5c7376,null))['catch'](handleError(_0x5c7376,null));}; \ No newline at end of file +var _0x8c12=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x3bc83a,_0x163221){var _0x309771=function(_0x5eeb70){while(--_0x5eeb70){_0x3bc83a['push'](_0x3bc83a['shift']());}};_0x309771(++_0x163221);}(_0x8c12,0x1f2));var _0x28c1=function(_0x206ea7,_0x20772b){_0x206ea7=_0x206ea7-0x0;var _0xfe6504=_0x8c12[_0x206ea7];return _0xfe6504;};'use strict';var emlformat=require(_0x28c1('0x0'));var rimraf=require(_0x28c1('0x1'));var zipdir=require(_0x28c1('0x2'));var jsonpatch=require(_0x28c1('0x3'));var rp=require(_0x28c1('0x4'));var moment=require(_0x28c1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x28c1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28c1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28c1('0x8'));var squel=require('squel');var crypto=require(_0x28c1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x28c1('0xa'));var toCsv=require(_0x28c1('0xb'));var querystring=require(_0x28c1('0xc'));var Papa=require(_0x28c1('0xd'));var Redis=require(_0x28c1('0xe'));var authService=require(_0x28c1('0xf'));var qs=require(_0x28c1('0x10'));var as=require(_0x28c1('0x11'));var hardwareService=require(_0x28c1('0x12'));var logger=require(_0x28c1('0x13'))(_0x28c1('0x14'));var utils=require('../../config/utils');var config=require(_0x28c1('0x15'));var licenseUtil=require(_0x28c1('0x16'));var db=require(_0x28c1('0x17'))['db'];function respondWithStatusCode(_0x2cd1f1,_0x4e6317){_0x4e6317=_0x4e6317||0xcc;return function(_0x41cfb0){if(_0x41cfb0){return _0x2cd1f1[_0x28c1('0x18')](_0x4e6317);}return _0x2cd1f1['status'](_0x4e6317)['end']();};}function respondWithResult(_0x52cd54,_0x3a32c5){_0x3a32c5=_0x3a32c5||0xc8;return function(_0x125fa4){if(_0x125fa4){return _0x52cd54[_0x28c1('0x19')](_0x3a32c5)['json'](_0x125fa4);}};}function respondWithFilteredResult(_0x41fc4b,_0x5a959c){return function(_0x52dfc2){if(_0x52dfc2){var _0x22d9ec=typeof _0x5a959c[_0x28c1('0x1a')]===_0x28c1('0x1b')&&typeof _0x5a959c[_0x28c1('0x1c')]===_0x28c1('0x1b');var _0x26914c=_0x52dfc2[_0x28c1('0x1d')];var _0x323758=_0x22d9ec?0x0:_0x5a959c[_0x28c1('0x1a')];var _0x2891cd=_0x22d9ec?_0x52dfc2[_0x28c1('0x1d')]:_0x5a959c['offset']+_0x5a959c[_0x28c1('0x1c')];var _0x580162;if(_0x2891cd>=_0x26914c){_0x2891cd=_0x26914c;_0x580162=0xc8;}else{_0x580162=0xce;}_0x41fc4b[_0x28c1('0x19')](_0x580162);return _0x41fc4b[_0x28c1('0x1e')](_0x28c1('0x1f'),_0x323758+'-'+_0x2891cd+'/'+_0x26914c)[_0x28c1('0x20')](_0x52dfc2);}return null;};}function patchUpdates(_0x51a48f){return function(_0x477f8c){try{jsonpatch[_0x28c1('0x21')](_0x477f8c,_0x51a48f,!![]);}catch(_0x45ed80){return BPromise[_0x28c1('0x22')](_0x45ed80);}return _0x477f8c[_0x28c1('0x23')]();};}function saveUpdates(_0x4fc5e2,_0x11cbed){return function(_0x5a394b){if(_0x5a394b){return _0x5a394b[_0x28c1('0x24')](_0x4fc5e2)[_0x28c1('0x25')](function(_0x16dd60){return _0x16dd60;});}return null;};}function removeEntity(_0x1a8efc,_0x5e0834){return function(_0x4f3436){if(_0x4f3436){return _0x4f3436[_0x28c1('0x26')]()[_0x28c1('0x25')](function(){_0x1a8efc[_0x28c1('0x19')](0xcc)[_0x28c1('0x27')]();});}};}function handleEntityNotFound(_0x1a8ea3,_0x26c20a){return function(_0x264d83){if(!_0x264d83){_0x1a8ea3[_0x28c1('0x18')](0x194);}return _0x264d83;};}function handleError(_0x16eb77,_0x56adea){_0x56adea=_0x56adea||0x1f4;return function(_0x8a22e3){logger[_0x28c1('0x28')](_0x8a22e3['stack']);if(_0x8a22e3[_0x28c1('0x29')]){delete _0x8a22e3[_0x28c1('0x29')];}_0x16eb77[_0x28c1('0x19')](_0x56adea)[_0x28c1('0x2a')](_0x8a22e3);};}exports[_0x28c1('0x2b')]=function(_0x4e39dc,_0x542f00){var _0x741237={},_0x12a18c={},_0x3d6618={'count':0x0,'rows':[]};var _0x330792=_[_0x28c1('0x2c')](db[_0x28c1('0x2d')][_0x28c1('0x2e')],function(_0x2eccfd){return{'name':_0x2eccfd[_0x28c1('0x2f')],'type':_0x2eccfd['type']['key']};});_0x12a18c[_0x28c1('0x30')]=_['map'](_0x330792,_0x28c1('0x29'));_0x12a18c[_0x28c1('0x31')]=_[_0x28c1('0x32')](_0x4e39dc[_0x28c1('0x31')]);_0x12a18c[_0x28c1('0x33')]=_[_0x28c1('0x34')](_0x12a18c[_0x28c1('0x30')],_0x12a18c[_0x28c1('0x31')]);_0x741237[_0x28c1('0x35')]=_[_0x28c1('0x34')](_0x12a18c[_0x28c1('0x30')],qs[_0x28c1('0x36')](_0x4e39dc['query'][_0x28c1('0x36')]));_0x741237[_0x28c1('0x35')]=_0x741237['attributes']['length']?_0x741237[_0x28c1('0x35')]:_0x12a18c[_0x28c1('0x30')];if(!_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x37')]('nolimit')){_0x741237[_0x28c1('0x1c')]=qs['limit'](_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x1c')]);_0x741237[_0x28c1('0x1a')]=qs['offset'](_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x1a')]);}_0x741237[_0x28c1('0x38')]=qs[_0x28c1('0x39')](_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x39')]);_0x741237[_0x28c1('0x3a')]=qs['filters'](_[_0x28c1('0x3b')](_0x4e39dc[_0x28c1('0x31')],_0x12a18c['filters']),_0x330792);if(_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x3c')]){_0x741237['where']=_[_0x28c1('0x3d')](_0x741237[_0x28c1('0x3a')],{'$or':_[_0x28c1('0x2c')](_0x330792,function(_0x1eb064){if(_0x1eb064[_0x28c1('0x3e')]!=='VIRTUAL'){var _0x5d2bf5={};_0x5d2bf5[_0x1eb064[_0x28c1('0x29')]]={'$like':'%'+_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x3c')]+'%'};return _0x5d2bf5;}})});}_0x741237=_[_0x28c1('0x3d')]({},_0x741237,_0x4e39dc[_0x28c1('0x3f')]);var _0x329143={'where':_0x741237[_0x28c1('0x3a')]};return db[_0x28c1('0x2d')][_0x28c1('0x1d')](_0x329143)[_0x28c1('0x25')](function(_0x4051a4){_0x3d6618[_0x28c1('0x1d')]=_0x4051a4;if(_0x4e39dc['query'][_0x28c1('0x40')]){_0x741237[_0x28c1('0x41')]=[{'all':!![]}];}return db[_0x28c1('0x2d')][_0x28c1('0x42')](_0x741237);})[_0x28c1('0x25')](function(_0xc1c298){_0x3d6618[_0x28c1('0x43')]=_0xc1c298;return _0x3d6618;})[_0x28c1('0x25')](respondWithFilteredResult(_0x542f00,_0x741237))[_0x28c1('0x44')](handleError(_0x542f00,null));};exports['show']=function(_0x333a7a,_0x4adbb2){var _0x140eeb={'raw':!![],'where':{'id':_0x333a7a[_0x28c1('0x45')]['id']}},_0x1221d1={};_0x1221d1[_0x28c1('0x30')]=_[_0x28c1('0x32')](db[_0x28c1('0x2d')]['rawAttributes']);_0x1221d1[_0x28c1('0x31')]=_['keys'](_0x333a7a[_0x28c1('0x31')]);_0x1221d1[_0x28c1('0x33')]=_[_0x28c1('0x34')](_0x1221d1['model'],_0x1221d1['query']);_0x140eeb[_0x28c1('0x35')]=_[_0x28c1('0x34')](_0x1221d1[_0x28c1('0x30')],qs['fields'](_0x333a7a[_0x28c1('0x31')][_0x28c1('0x36')]));_0x140eeb[_0x28c1('0x35')]=_0x140eeb[_0x28c1('0x35')][_0x28c1('0x46')]?_0x140eeb['attributes']:_0x1221d1['model'];if(_0x333a7a[_0x28c1('0x31')][_0x28c1('0x40')]){_0x140eeb[_0x28c1('0x41')]=[{'all':!![]}];}_0x140eeb=_[_0x28c1('0x3d')]({},_0x140eeb,_0x333a7a['options']);return db['SquareDetailsReport'][_0x28c1('0x47')](_0x140eeb)['then'](handleEntityNotFound(_0x4adbb2,null))['then'](respondWithResult(_0x4adbb2,null))['catch'](handleError(_0x4adbb2,null));};exports[_0x28c1('0x48')]=function(_0x3eecf2,_0x3ee7b1){return db[_0x28c1('0x2d')][_0x28c1('0x48')](_0x3eecf2[_0x28c1('0x49')],{})[_0x28c1('0x25')](respondWithResult(_0x3ee7b1,0xc9))[_0x28c1('0x44')](handleError(_0x3ee7b1,null));};exports[_0x28c1('0x24')]=function(_0xd8f098,_0x38f170){if(_0xd8f098[_0x28c1('0x49')]['id']){delete _0xd8f098[_0x28c1('0x49')]['id'];}return db[_0x28c1('0x2d')]['find']({'where':{'id':_0xd8f098[_0x28c1('0x45')]['id']}})[_0x28c1('0x25')](handleEntityNotFound(_0x38f170,null))[_0x28c1('0x25')](saveUpdates(_0xd8f098[_0x28c1('0x49')],null))[_0x28c1('0x25')](respondWithResult(_0x38f170,null))[_0x28c1('0x44')](handleError(_0x38f170,null));};exports['destroy']=function(_0x1412e6,_0x34b6bc){return db['SquareDetailsReport'][_0x28c1('0x47')]({'where':{'id':_0x1412e6[_0x28c1('0x45')]['id']}})[_0x28c1('0x25')](handleEntityNotFound(_0x34b6bc,null))['then'](removeEntity(_0x34b6bc,null))['catch'](handleError(_0x34b6bc,null));};exports[_0x28c1('0x4a')]=function(_0x3a8a32,_0x1b31d7){return db[_0x28c1('0x2d')][_0x28c1('0x4a')]()[_0x28c1('0x25')](respondWithResult(_0x1b31d7,null))[_0x28c1('0x44')](handleError(_0x1b31d7,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ad08c47..2f28cb5 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 _0x125e=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x125e,0x1a5));var _0xe125=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x125e[_0x284a61];return _0x220e3c;};'use strict';var _=require(_0xe125('0x0'));var util=require(_0xe125('0x1'));var logger=require('../../config/logger')(_0xe125('0x2'));var moment=require('moment');var BPromise=require(_0xe125('0x3'));var rp=require(_0xe125('0x4'));var fs=require('fs');var path=require(_0xe125('0x5'));var rimraf=require(_0xe125('0x6'));var config=require(_0xe125('0x7'));var attributes=require(_0xe125('0x8'));module[_0xe125('0x9')]=function(_0x227aea,_0x20e374){return _0x227aea[_0xe125('0xa')](_0xe125('0xb'),attributes,{'tableName':_0xe125('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21c5=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0xa9de90,_0x3f2c76){var _0x452b90=function(_0x105298){while(--_0x105298){_0xa9de90['push'](_0xa9de90['shift']());}};_0x452b90(++_0x3f2c76);}(_0x21c5,0xed));var _0x521c=function(_0x5114ba,_0x2dc0a5){_0x5114ba=_0x5114ba-0x0;var _0x4cd233=_0x21c5[_0x5114ba];return _0x4cd233;};'use strict';var _=require(_0x521c('0x0'));var util=require(_0x521c('0x1'));var logger=require(_0x521c('0x2'))(_0x521c('0x3'));var moment=require(_0x521c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x521c('0x5'));var rimraf=require(_0x521c('0x6'));var config=require(_0x521c('0x7'));var attributes=require(_0x521c('0x8'));module[_0x521c('0x9')]=function(_0x4357a1,_0xc0b919){return _0x4357a1['define']('SquareDetailsReport',attributes,{'tableName':_0x521c('0xa'),'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 7359bfa..6ef2f9e 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 _0x8580=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x5dc190,_0x2fbdaf){var _0x384c15=function(_0x2b01e6){while(--_0x2b01e6){_0x5dc190['push'](_0x5dc190['shift']());}};_0x384c15(++_0x2fbdaf);}(_0x8580,0x1c7));var _0x0858=function(_0xb45dff,_0x2840ae){_0xb45dff=_0xb45dff-0x0;var _0x180cf5=_0x8580[_0xb45dff];return _0x180cf5;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3515b4,_0x38e3f7,_0x4981a7){return new BPromise(function(_0x9c611c,_0x3ae92b){return client[_0x0858('0x8')](_0x3515b4,_0x4981a7)['then'](function(_0x4ceffb){logger[_0x0858('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x38e3f7,_0x0858('0xa'));logger[_0x0858('0xb')](_0x0858('0xc'),_0x38e3f7,_0x0858('0xa'),JSON[_0x0858('0xd')](_0x4ceffb));if(_0x4ceffb[_0x0858('0xe')]){if(_0x4ceffb[_0x0858('0xe')][_0x0858('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x38e3f7,_0x4ceffb[_0x0858('0xe')]['message']);return _0x3ae92b(_0x4ceffb['error']['message']);}logger[_0x0858('0xe')](_0x0858('0x10'),_0x38e3f7,_0x4ceffb['error'][_0x0858('0x11')]);return _0x9c611c(_0x4ceffb[_0x0858('0xe')][_0x0858('0x11')]);}else{logger[_0x0858('0x9')](_0x0858('0x10'),_0x38e3f7,_0x0858('0xa'));_0x9c611c(_0x4ceffb[_0x0858('0x12')][_0x0858('0x11')]);}})[_0x0858('0x13')](function(_0x39e967){logger[_0x0858('0xe')](_0x0858('0x10'),_0x38e3f7,_0x39e967);_0x3ae92b(_0x39e967);});});}exports['CreateSquareDetailsReport']=function(_0x2b73c2){var _0x4d376b=this;return new Promise(function(_0x284ebd,_0x37f90b){return db[_0x0858('0x14')][_0x0858('0x15')](_0x2b73c2[_0x0858('0x16')],{'raw':_0x2b73c2['options']?_0x2b73c2[_0x0858('0x17')][_0x0858('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1ea1a7){logger['info']('CreateSquareDetailsReport',_0x2b73c2);logger[_0x0858('0xb')](_0x0858('0x19'),_0x2b73c2,JSON[_0x0858('0xd')](_0x1ea1a7));_0x284ebd(_0x1ea1a7);})[_0x0858('0x13')](function(_0x29ac2b){logger['error'](_0x0858('0x19'),_0x29ac2b['message'],_0x2b73c2);_0x37f90b(_0x4d376b[_0x0858('0xe')](0x1f4,_0x29ac2b['message']));});});}; \ No newline at end of file +var _0xb9be=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x240d52,_0x5a5b55){var _0x2910e0=function(_0x34ed38){while(--_0x34ed38){_0x240d52['push'](_0x240d52['shift']());}};_0x2910e0(++_0x5a5b55);}(_0xb9be,0xc5));var _0xeb9b=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xb9be[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')](_0x21aca6[_0xeb9b('0x1b')],{'raw':_0x21aca6[_0xeb9b('0x1c')]?_0x21aca6['options'][_0xeb9b('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5d5f54){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x5d5f54));_0x3cbe3e(_0x5d5f54);})[_0xeb9b('0x17')](function(_0x37d7e0){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x37d7e0[_0xeb9b('0x16')],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x37d7e0[_0xeb9b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5046a07..1a7f5c6 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 _0x29e6=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x5e5826,_0x3b7bf3){var _0x4a58d4=function(_0x5a3868){while(--_0x5a3868){_0x5e5826['push'](_0x5e5826['shift']());}};_0x4a58d4(++_0x3b7bf3);}(_0x29e6,0xd7));var _0x629e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x29e6[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x629e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x629e('0x1'));router[_0x629e('0x2')]('/',auth[_0x629e('0x3')](),controller[_0x629e('0x4')]);router[_0x629e('0x2')](_0x629e('0x5'),auth['isAuthenticated'](),controller[_0x629e('0x6')]);module[_0x629e('0x7')]=router; \ No newline at end of file +var _0x1314=['./system.controller','get','isAuthenticated','index','exports','express'];(function(_0x2d67d,_0x540bef){var _0x1423cb=function(_0x188e7f){while(--_0x188e7f){_0x2d67d['push'](_0x2d67d['shift']());}};_0x1423cb(++_0x540bef);}(_0x1314,0x17f));var _0x4131=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x1314[_0xf55e73];return _0x116b99;};'use strict';var express=require(_0x4131('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4131('0x1'));router[_0x4131('0x2')]('/',auth[_0x4131('0x3')](),controller[_0x4131('0x4')]);router[_0x4131('0x2')]('/process/:pid/kill',auth[_0x4131('0x3')](),controller['killProcess']);module[_0x4131('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index a19b37d..db921bb 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 _0xe318=['util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','index','getAllData','then','status','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','params','SIGINT','catch','killProcess','systeminformation','child_process','exec','../../config/logger','api'];(function(_0x59ef1f,_0x503ed1){var _0x4d5788=function(_0x2d47ae){while(--_0x2d47ae){_0x59ef1f['push'](_0x59ef1f['shift']());}};_0x4d5788(++_0x503ed1);}(_0xe318,0x181));var _0x8e31=function(_0x26f388,_0x26355a){_0x26f388=_0x26f388-0x0;var _0x18895e=_0xe318[_0x26f388];return _0x18895e;};'use strict';var info=require(_0x8e31('0x0'));var exec=require(_0x8e31('0x1'))[_0x8e31('0x2')];var logger=require(_0x8e31('0x3'))(_0x8e31('0x4'));var util=require(_0x8e31('0x5'));var BPromise=require(_0x8e31('0x6'));var _=require(_0x8e31('0x7'));function handleError(_0x84821f,_0x7c778d,_0x5f5a8b){_0x7c778d=_0x7c778d||0x1f4;return function(_0x4ac8aa){logger[_0x8e31('0x8')](_0x8e31('0x9'),_0x5f5a8b,_0x7c778d,util[_0x8e31('0xa')](_0x4ac8aa,{'showHidden':![],'depth':null}));delete _0x4ac8aa['name'];_0x84821f['status'](_0x7c778d)[_0x8e31('0xb')](_0x4ac8aa);};}exports[_0x8e31('0xc')]=function(_0x447111,_0xbcaba7){return info[_0x8e31('0xd')]()[_0x8e31('0xe')](function(_0x182731){return _0xbcaba7[_0x8e31('0xf')](0xc8)[_0x8e31('0x10')](_0x182731);})['catch'](function(_0x4213ee){return _0xbcaba7[_0x8e31('0xf')](0x1f4)['json'](_0x4213ee);});};exports['killProcess']=function(_0x1fed38,_0x11f8f3){var _0x30d795=[_0x8e31('0x11')];return new BPromise(function(_0xa04ff1,_0x4db952){return exec(util[_0x8e31('0x12')](_0x8e31('0x13'),_0x1fed38['params']['pid']),function(_0x1d1c18,_0x4d5de9,_0x4431d2){if(_0x1d1c18){return _0x4db952(_0x1d1c18);}return _0xa04ff1(_0x4d5de9);});})[_0x8e31('0xe')](function(_0xf71b8a){var _0x199b0c=![];var _0x5a7ba4=_0xf71b8a[_0x8e31('0x14')](/\n/);for(var _0x2bf194=0x0,_0x52c330=_0x30d795[_0x8e31('0x15')];_0x2bf194<_0x52c330,_0x199b0c===![];_0x2bf194+=0x1){if(_0xf71b8a[_0x8e31('0x16')](_0x30d795[_0x2bf194])>=0x0){_0x199b0c=!![];}}if(!_0x199b0c){throw new Error(util[_0x8e31('0x12')](_0x8e31('0x17'),_0x1fed38['params'][_0x8e31('0x18')]));}process[_0x8e31('0x19')](_0x1fed38[_0x8e31('0x1a')]['pid'],_0x8e31('0x1b'));return _0x11f8f3[_0x8e31('0xf')](0xc8)[_0x8e31('0x10')]({'message':util[_0x8e31('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1fed38[_0x8e31('0x1a')]['pid'])});})[_0x8e31('0x1c')](handleError(_0x11f8f3,null,_0x8e31('0x1d')));}; \ No newline at end of file +var _0x8a41=['error','inspect','name','status','index','getAllData','json','killProcess','params','pid','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','../../config/logger','util','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8a41,0x1bd));var _0x18a4=function(_0x1f3fb0,_0x190378){_0x1f3fb0=_0x1f3fb0-0x0;var _0x252315=_0x8a41[_0x1f3fb0];return _0x252315;};'use strict';var info=require(_0x18a4('0x0'));var exec=require(_0x18a4('0x1'))['exec'];var logger=require(_0x18a4('0x2'))('api');var util=require(_0x18a4('0x3'));var BPromise=require('bluebird');var _=require(_0x18a4('0x4'));function handleError(_0x16b745,_0x2f29ee,_0x363551){_0x2f29ee=_0x2f29ee||0x1f4;return function(_0x10e3f6){logger[_0x18a4('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x363551,_0x2f29ee,util[_0x18a4('0x6')](_0x10e3f6,{'showHidden':![],'depth':null}));delete _0x10e3f6[_0x18a4('0x7')];_0x16b745[_0x18a4('0x8')](_0x2f29ee)['send'](_0x10e3f6);};}exports[_0x18a4('0x9')]=function(_0x597274,_0x2aff3c){return info[_0x18a4('0xa')]()['then'](function(_0x42f883){return _0x2aff3c[_0x18a4('0x8')](0xc8)[_0x18a4('0xb')](_0x42f883);})['catch'](function(_0x3a7f29){return _0x2aff3c[_0x18a4('0x8')](0x1f4)[_0x18a4('0xb')](_0x3a7f29);});};exports[_0x18a4('0xc')]=function(_0x2c839b,_0x38524c){var _0x246a7c=['components/import/cm'];return new BPromise(function(_0x41622b,_0x2b8ca6){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2c839b[_0x18a4('0xd')][_0x18a4('0xe')]),function(_0x173a6e,_0x5e7173,_0x564292){if(_0x173a6e){return _0x2b8ca6(_0x173a6e);}return _0x41622b(_0x5e7173);});})[_0x18a4('0xf')](function(_0x28b175){var _0x580b0e=![];var _0x383be4=_0x28b175[_0x18a4('0x10')](/\n/);for(var _0x50fa12=0x0,_0x3f2629=_0x246a7c[_0x18a4('0x11')];_0x50fa12<_0x3f2629,_0x580b0e===![];_0x50fa12+=0x1){if(_0x28b175[_0x18a4('0x12')](_0x246a7c[_0x50fa12])>=0x0){_0x580b0e=!![];}}if(!_0x580b0e){throw new Error(util[_0x18a4('0x13')](_0x18a4('0x14'),_0x2c839b[_0x18a4('0xd')][_0x18a4('0xe')]));}process[_0x18a4('0x15')](_0x2c839b[_0x18a4('0xd')]['pid'],_0x18a4('0x16'));return _0x38524c[_0x18a4('0x8')](0xc8)[_0x18a4('0xb')]({'message':util[_0x18a4('0x13')](_0x18a4('0x17'),_0x2c839b[_0x18a4('0xd')][_0x18a4('0xe')])});})[_0x18a4('0x18')](handleError(_0x38524c,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4bab2aa..e42ad32 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller'];(function(_0x2ab69e,_0x3c79c7){var _0xe8363b=function(_0x41a6f7){while(--_0x41a6f7){_0x2ab69e['push'](_0x2ab69e['shift']());}};_0xe8363b(++_0x3c79c7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xcb91[_0x547456];return _0xc1fd7b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb43b=['../../components/interaction/service','../../config/environment','./tag.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x218830,_0x52ad5e){var _0x479d57=function(_0x383d89){while(--_0x383d89){_0x218830['push'](_0x218830['shift']());}};_0x479d57(++_0x52ad5e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30e93b,_0x314904){_0x30e93b=_0x30e93b-0x0;var _0x1d749c=_0xb43b[_0x30e93b];return _0x1d749c;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9e64016..47cf09c 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 _0xb7aa=['name','#0091EA','sequelize','exports','STRING'];(function(_0x3c8be3,_0x18a7c3){var _0x3e90bc=function(_0x2a1c46){while(--_0x2a1c46){_0x3c8be3['push'](_0x3c8be3['shift']());}};_0x3e90bc(++_0x18a7c3);}(_0xb7aa,0x11a));var _0xab7a=function(_0x19f688,_0x73aa1b){_0x19f688=_0x19f688-0x0;var _0x5d03bc=_0xb7aa[_0x19f688];return _0x5d03bc;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'name':{'type':Sequelize[_0xab7a('0x2')],'unique':_0xab7a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':_0xab7a('0x4')},'description':{'type':Sequelize[_0xab7a('0x2')]}}; \ No newline at end of file +var _0x2fee=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fee,0x11a));var _0xe2fe=function(_0x439f45,_0x542c73){_0x439f45=_0x439f45-0x0;var _0x6aa2e3=_0x2fee[_0x439f45];return _0x6aa2e3;};'use strict';var Sequelize=require(_0xe2fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2fe('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe2fe('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xe2fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f795a64..6ad1fc9 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 _0xef2c=['reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','user','role','autoAssociation','UserProfileResource','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply'];(function(_0x3714f5,_0x2a8307){var _0x240413=function(_0x413dc5){while(--_0x413dc5){_0x3714f5['push'](_0x3714f5['shift']());}};_0x240413(++_0x2a8307);}(_0xef2c,0x177));var _0xcef2=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0xef2c[_0x786e9];return _0x1f891b;};'use strict';var emlformat=require(_0xcef2('0x0'));var rimraf=require(_0xcef2('0x1'));var zipdir=require(_0xcef2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcef2('0x3'));var BPromise=require(_0xcef2('0x4'));var Mustache=require(_0xcef2('0x5'));var util=require(_0xcef2('0x6'));var path=require(_0xcef2('0x7'));var sox=require(_0xcef2('0x8'));var csv=require(_0xcef2('0x9'));var ejs=require(_0xcef2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcef2('0xb'));var squel=require(_0xcef2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcef2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcef2('0xe'));var authService=require(_0xcef2('0xf'));var qs=require(_0xcef2('0x10'));var as=require(_0xcef2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcef2('0x12'));var utils=require(_0xcef2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcef2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29404d,_0x3ac41e){_0x3ac41e=_0x3ac41e||0xcc;return function(_0x4527ed){if(_0x4527ed){return _0x29404d[_0xcef2('0x15')](_0x3ac41e);}return _0x29404d[_0xcef2('0x16')](_0x3ac41e)[_0xcef2('0x17')]();};}function respondWithResult(_0x38cae6,_0x1da842){_0x1da842=_0x1da842||0xc8;return function(_0x1567eb){if(_0x1567eb){return _0x38cae6[_0xcef2('0x16')](_0x1da842)[_0xcef2('0x18')](_0x1567eb);}};}function respondWithFilteredResult(_0x3df183,_0x54963c){return function(_0x1e6c7a){if(_0x1e6c7a){var _0x3c42a6=typeof _0x54963c['offset']===_0xcef2('0x19')&&typeof _0x54963c[_0xcef2('0x1a')]===_0xcef2('0x19');var _0x30df0f=_0x1e6c7a[_0xcef2('0x1b')];var _0x466f14=_0x3c42a6?0x0:_0x54963c['offset'];var _0x34eec9=_0x3c42a6?_0x1e6c7a[_0xcef2('0x1b')]:_0x54963c[_0xcef2('0x1c')]+_0x54963c[_0xcef2('0x1a')];var _0x2ef257;if(_0x34eec9>=_0x30df0f){_0x34eec9=_0x30df0f;_0x2ef257=0xc8;}else{_0x2ef257=0xce;}_0x3df183[_0xcef2('0x16')](_0x2ef257);return _0x3df183['set']('Content-Range',_0x466f14+'-'+_0x34eec9+'/'+_0x30df0f)[_0xcef2('0x18')](_0x1e6c7a);}return null;};}function patchUpdates(_0x212ae7){return function(_0x49f315){try{jsonpatch[_0xcef2('0x1d')](_0x49f315,_0x212ae7,!![]);}catch(_0x24de35){return BPromise[_0xcef2('0x1e')](_0x24de35);}return _0x49f315[_0xcef2('0x1f')]();};}function saveUpdates(_0x585230,_0x30dcfe){return function(_0x5a5974){if(_0x5a5974){return _0x5a5974[_0xcef2('0x20')](_0x585230)[_0xcef2('0x21')](function(_0x37f3b7){return _0x37f3b7;});}return null;};}function removeEntity(_0x2faa4a,_0x27094b){return function(_0xdcf3e7){if(_0xdcf3e7){return _0xdcf3e7[_0xcef2('0x22')]()[_0xcef2('0x21')](function(){var _0xe0af60=_0xdcf3e7[_0xcef2('0x23')]({'plain':!![]});var _0x3d827b=_0xcef2('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d827b,'resourceId':_0xe0af60['id']}})['then'](function(){return _0xdcf3e7;});})[_0xcef2('0x21')](function(){_0x2faa4a[_0xcef2('0x16')](0xcc)[_0xcef2('0x17')]();});}};}function handleEntityNotFound(_0x512eed,_0x311471){return function(_0x38342e){if(!_0x38342e){_0x512eed[_0xcef2('0x15')](0x194);}return _0x38342e;};}function handleError(_0x578693,_0x3df9e1){_0x3df9e1=_0x3df9e1||0x1f4;return function(_0x1c079b){logger[_0xcef2('0x25')](_0x1c079b[_0xcef2('0x26')]);if(_0x1c079b[_0xcef2('0x27')]){delete _0x1c079b[_0xcef2('0x27')];}_0x578693[_0xcef2('0x16')](_0x3df9e1)[_0xcef2('0x28')](_0x1c079b);};}exports[_0xcef2('0x29')]=function(_0x3724ee,_0x2f5253){var _0x8b71fd={},_0x29448b={},_0x35442a={'count':0x0,'rows':[]};var _0x95ae7c=_[_0xcef2('0x2a')](db[_0xcef2('0x2b')][_0xcef2('0x2c')],function(_0x1d0187){return{'name':_0x1d0187[_0xcef2('0x2d')],'type':_0x1d0187[_0xcef2('0x2e')][_0xcef2('0x2f')]};});_0x29448b[_0xcef2('0x30')]=_[_0xcef2('0x2a')](_0x95ae7c,'name');_0x29448b[_0xcef2('0x31')]=_['keys'](_0x3724ee[_0xcef2('0x31')]);_0x29448b[_0xcef2('0x32')]=_[_0xcef2('0x33')](_0x29448b[_0xcef2('0x30')],_0x29448b[_0xcef2('0x31')]);_0x8b71fd[_0xcef2('0x34')]=_[_0xcef2('0x33')](_0x29448b['model'],qs[_0xcef2('0x35')](_0x3724ee[_0xcef2('0x31')][_0xcef2('0x35')]));_0x8b71fd[_0xcef2('0x34')]=_0x8b71fd[_0xcef2('0x34')][_0xcef2('0x36')]?_0x8b71fd[_0xcef2('0x34')]:_0x29448b['model'];if(!_0x3724ee[_0xcef2('0x31')][_0xcef2('0x37')](_0xcef2('0x38'))){_0x8b71fd[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x3724ee[_0xcef2('0x31')][_0xcef2('0x1a')]);_0x8b71fd[_0xcef2('0x1c')]=qs[_0xcef2('0x1c')](_0x3724ee['query']['offset']);}_0x8b71fd[_0xcef2('0x39')]=qs[_0xcef2('0x3a')](_0x3724ee[_0xcef2('0x31')][_0xcef2('0x3a')]);_0x8b71fd['where']=qs[_0xcef2('0x32')](_[_0xcef2('0x3b')](_0x3724ee[_0xcef2('0x31')],_0x29448b[_0xcef2('0x32')]),_0x95ae7c);if(_0x3724ee[_0xcef2('0x31')][_0xcef2('0x3c')]){_0x8b71fd[_0xcef2('0x3d')]=_['merge'](_0x8b71fd['where'],{'$or':_['map'](_0x95ae7c,function(_0x35d71c){if(_0x35d71c[_0xcef2('0x2e')]!==_0xcef2('0x3e')){var _0x3eca82={};_0x3eca82[_0x35d71c[_0xcef2('0x27')]]={'$like':'%'+_0x3724ee['query']['filter']+'%'};return _0x3eca82;}})});}_0x8b71fd=_['merge']({},_0x8b71fd,_0x3724ee[_0xcef2('0x3f')]);var _0x41af68={'where':_0x8b71fd[_0xcef2('0x3d')]};return db[_0xcef2('0x2b')][_0xcef2('0x1b')](_0x41af68)['then'](function(_0x473940){_0x35442a['count']=_0x473940;if(_0x3724ee[_0xcef2('0x31')][_0xcef2('0x40')]){_0x8b71fd[_0xcef2('0x41')]=[{'all':!![]}];}return db[_0xcef2('0x2b')][_0xcef2('0x42')](_0x8b71fd);})[_0xcef2('0x21')](function(_0x14f63a){_0x35442a[_0xcef2('0x43')]=_0x14f63a;return _0x35442a;})[_0xcef2('0x21')](respondWithFilteredResult(_0x2f5253,_0x8b71fd))[_0xcef2('0x44')](handleError(_0x2f5253,null));};exports[_0xcef2('0x45')]=function(_0x1a5a30,_0x5d2573){var _0x1116a2={'raw':!![],'where':{'id':_0x1a5a30[_0xcef2('0x46')]['id']}},_0x8a00bb={};_0x8a00bb[_0xcef2('0x30')]=_[_0xcef2('0x47')](db[_0xcef2('0x2b')]['rawAttributes']);_0x8a00bb['query']=_[_0xcef2('0x47')](_0x1a5a30[_0xcef2('0x31')]);_0x8a00bb[_0xcef2('0x32')]=_[_0xcef2('0x33')](_0x8a00bb[_0xcef2('0x30')],_0x8a00bb[_0xcef2('0x31')]);_0x1116a2[_0xcef2('0x34')]=_[_0xcef2('0x33')](_0x8a00bb[_0xcef2('0x30')],qs[_0xcef2('0x35')](_0x1a5a30['query'][_0xcef2('0x35')]));_0x1116a2[_0xcef2('0x34')]=_0x1116a2['attributes'][_0xcef2('0x36')]?_0x1116a2[_0xcef2('0x34')]:_0x8a00bb['model'];if(_0x1a5a30['query'][_0xcef2('0x40')]){_0x1116a2[_0xcef2('0x41')]=[{'all':!![]}];}_0x1116a2=_[_0xcef2('0x48')]({},_0x1116a2,_0x1a5a30[_0xcef2('0x3f')]);return db[_0xcef2('0x2b')][_0xcef2('0x49')](_0x1116a2)[_0xcef2('0x21')](handleEntityNotFound(_0x5d2573,null))[_0xcef2('0x21')](respondWithResult(_0x5d2573,null))[_0xcef2('0x44')](handleError(_0x5d2573,null));};exports[_0xcef2('0x4a')]=function(_0x320315,_0x92bf59){return db[_0xcef2('0x2b')][_0xcef2('0x4a')](_0x320315[_0xcef2('0x4b')],{})['then'](function(_0x1b0838){var _0x1ab9ab=_0x320315[_0xcef2('0x4c')][_0xcef2('0x23')]({'plain':!![]});if(!_0x1ab9ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ab9ab[_0xcef2('0x4d')]===_0xcef2('0x4c')){var _0x2c4ccf=_0x1b0838[_0xcef2('0x23')]({'plain':!![]});var _0xd8c6e4='Tags';return db['UserProfileSection'][_0xcef2('0x49')]({'where':{'name':_0xd8c6e4,'userProfileId':_0x1ab9ab['userProfileId']},'raw':!![]})[_0xcef2('0x21')](function(_0x185ea8){if(_0x185ea8&&_0x185ea8[_0xcef2('0x4e')]===0x0){return db[_0xcef2('0x4f')][_0xcef2('0x4a')]({'name':_0x2c4ccf[_0xcef2('0x27')],'resourceId':_0x2c4ccf['id'],'type':_0x185ea8[_0xcef2('0x27')],'sectionId':_0x185ea8['id']},{})[_0xcef2('0x21')](function(){return _0x1b0838;});}else{return _0x1b0838;}})['catch'](function(_0xfd2728){logger[_0xcef2('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfd2728);throw _0xfd2728;});}return _0x1b0838;})['then'](respondWithResult(_0x92bf59,0xc9))[_0xcef2('0x44')](handleError(_0x92bf59,null));};exports[_0xcef2('0x20')]=function(_0x4efcec,_0x5dd51d){if(_0x4efcec[_0xcef2('0x4b')]['id']){delete _0x4efcec[_0xcef2('0x4b')]['id'];}return db[_0xcef2('0x2b')][_0xcef2('0x49')]({'where':{'id':_0x4efcec['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x5dd51d,null))[_0xcef2('0x21')](saveUpdates(_0x4efcec['body'],null))['then'](respondWithResult(_0x5dd51d,null))['catch'](handleError(_0x5dd51d,null));};exports['destroy']=function(_0x4b0547,_0x425c7c){return db[_0xcef2('0x2b')][_0xcef2('0x49')]({'where':{'id':_0x4b0547[_0xcef2('0x46')]['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x425c7c,null))[_0xcef2('0x21')](removeEntity(_0x425c7c,null))[_0xcef2('0x44')](handleError(_0x425c7c,null));};exports[_0xcef2('0x50')]=function(_0x975820,_0x2d5d03){return db['Tag'][_0xcef2('0x50')]()['then'](respondWithResult(_0x2d5d03,null))[_0xcef2('0x44')](handleError(_0x2d5d03,null));}; \ No newline at end of file +var _0x5d87=['stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','filters','filter','where','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','update','then','destroy','get','Tags'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5d87,0x1b0));var _0x75d8=function(_0x53882e,_0x28f754){_0x53882e=_0x53882e-0x0;var _0x1f7edd=_0x5d87[_0x53882e];return _0x1f7edd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75d8('0x0'));var zipdir=require(_0x75d8('0x1'));var jsonpatch=require(_0x75d8('0x2'));var rp=require(_0x75d8('0x3'));var moment=require(_0x75d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d8('0x5'));var util=require(_0x75d8('0x6'));var path=require('path');var sox=require(_0x75d8('0x7'));var csv=require(_0x75d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d8('0x9'));var _=require(_0x75d8('0xa'));var squel=require(_0x75d8('0xb'));var crypto=require(_0x75d8('0xc'));var jsforce=require(_0x75d8('0xd'));var deskjs=require(_0x75d8('0xe'));var toCsv=require(_0x75d8('0x8'));var querystring=require(_0x75d8('0xf'));var Papa=require(_0x75d8('0x10'));var Redis=require(_0x75d8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x75d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75d8('0x13'));var logger=require(_0x75d8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x75d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x75d8('0x16'))['db'];function respondWithStatusCode(_0x4558c4,_0x4453cb){_0x4453cb=_0x4453cb||0xcc;return function(_0xa9764b){if(_0xa9764b){return _0x4558c4[_0x75d8('0x17')](_0x4453cb);}return _0x4558c4[_0x75d8('0x18')](_0x4453cb)[_0x75d8('0x19')]();};}function respondWithResult(_0x323960,_0x5027c4){_0x5027c4=_0x5027c4||0xc8;return function(_0x9d61a0){if(_0x9d61a0){return _0x323960['status'](_0x5027c4)[_0x75d8('0x1a')](_0x9d61a0);}};}function respondWithFilteredResult(_0x48f23e,_0xa82b5c){return function(_0xb269b1){if(_0xb269b1){var _0x12ba5a=typeof _0xa82b5c[_0x75d8('0x1b')]===_0x75d8('0x1c')&&typeof _0xa82b5c['limit']===_0x75d8('0x1c');var _0x4504d0=_0xb269b1[_0x75d8('0x1d')];var _0x320352=_0x12ba5a?0x0:_0xa82b5c['offset'];var _0x58e4ae=_0x12ba5a?_0xb269b1['count']:_0xa82b5c[_0x75d8('0x1b')]+_0xa82b5c['limit'];var _0x4eacf8;if(_0x58e4ae>=_0x4504d0){_0x58e4ae=_0x4504d0;_0x4eacf8=0xc8;}else{_0x4eacf8=0xce;}_0x48f23e['status'](_0x4eacf8);return _0x48f23e['set'](_0x75d8('0x1e'),_0x320352+'-'+_0x58e4ae+'/'+_0x4504d0)[_0x75d8('0x1a')](_0xb269b1);}return null;};}function patchUpdates(_0x421d1c){return function(_0x205b63){try{jsonpatch['apply'](_0x205b63,_0x421d1c,!![]);}catch(_0xb2bd8b){return BPromise['reject'](_0xb2bd8b);}return _0x205b63['save']();};}function saveUpdates(_0x309160,_0x5873ad){return function(_0xf5b0ca){if(_0xf5b0ca){return _0xf5b0ca[_0x75d8('0x1f')](_0x309160)[_0x75d8('0x20')](function(_0x9c1005){return _0x9c1005;});}return null;};}function removeEntity(_0x1c90af,_0x403fad){return function(_0x147a84){if(_0x147a84){return _0x147a84[_0x75d8('0x21')]()[_0x75d8('0x20')](function(){var _0x2f8a5a=_0x147a84[_0x75d8('0x22')]({'plain':!![]});var _0x259b7d=_0x75d8('0x23');return db['UserProfileResource'][_0x75d8('0x21')]({'where':{'type':_0x259b7d,'resourceId':_0x2f8a5a['id']}})['then'](function(){return _0x147a84;});})[_0x75d8('0x20')](function(){_0x1c90af['status'](0xcc)[_0x75d8('0x19')]();});}};}function handleEntityNotFound(_0x1d9b9d,_0x171c3c){return function(_0x48cb47){if(!_0x48cb47){_0x1d9b9d[_0x75d8('0x17')](0x194);}return _0x48cb47;};}function handleError(_0x29108e,_0x227904){_0x227904=_0x227904||0x1f4;return function(_0x9593ef){logger['error'](_0x9593ef[_0x75d8('0x24')]);if(_0x9593ef['name']){delete _0x9593ef[_0x75d8('0x25')];}_0x29108e[_0x75d8('0x18')](_0x227904)[_0x75d8('0x26')](_0x9593ef);};}exports[_0x75d8('0x27')]=function(_0x31c943,_0x2ee889){var _0x527641={},_0x122bfc={},_0xc4b7d8={'count':0x0,'rows':[]};var _0x47606b=_[_0x75d8('0x28')](db[_0x75d8('0x29')][_0x75d8('0x2a')],function(_0x3627f1){return{'name':_0x3627f1[_0x75d8('0x2b')],'type':_0x3627f1[_0x75d8('0x2c')][_0x75d8('0x2d')]};});_0x122bfc[_0x75d8('0x2e')]=_['map'](_0x47606b,_0x75d8('0x25'));_0x122bfc[_0x75d8('0x2f')]=_[_0x75d8('0x30')](_0x31c943[_0x75d8('0x2f')]);_0x122bfc['filters']=_['intersection'](_0x122bfc[_0x75d8('0x2e')],_0x122bfc['query']);_0x527641[_0x75d8('0x31')]=_[_0x75d8('0x32')](_0x122bfc[_0x75d8('0x2e')],qs[_0x75d8('0x33')](_0x31c943['query'][_0x75d8('0x33')]));_0x527641[_0x75d8('0x31')]=_0x527641[_0x75d8('0x31')][_0x75d8('0x34')]?_0x527641[_0x75d8('0x31')]:_0x122bfc[_0x75d8('0x2e')];if(!_0x31c943[_0x75d8('0x2f')]['hasOwnProperty'](_0x75d8('0x35'))){_0x527641['limit']=qs['limit'](_0x31c943[_0x75d8('0x2f')][_0x75d8('0x36')]);_0x527641[_0x75d8('0x1b')]=qs[_0x75d8('0x1b')](_0x31c943[_0x75d8('0x2f')][_0x75d8('0x1b')]);}_0x527641[_0x75d8('0x37')]=qs['sort'](_0x31c943[_0x75d8('0x2f')][_0x75d8('0x38')]);_0x527641['where']=qs['filters'](_['pick'](_0x31c943[_0x75d8('0x2f')],_0x122bfc[_0x75d8('0x39')]),_0x47606b);if(_0x31c943[_0x75d8('0x2f')][_0x75d8('0x3a')]){_0x527641[_0x75d8('0x3b')]=_[_0x75d8('0x3c')](_0x527641['where'],{'$or':_['map'](_0x47606b,function(_0x52d595){if(_0x52d595[_0x75d8('0x2c')]!=='VIRTUAL'){var _0x40041c={};_0x40041c[_0x52d595[_0x75d8('0x25')]]={'$like':'%'+_0x31c943[_0x75d8('0x2f')][_0x75d8('0x3a')]+'%'};return _0x40041c;}})});}_0x527641=_[_0x75d8('0x3c')]({},_0x527641,_0x31c943[_0x75d8('0x3d')]);var _0x5895e4={'where':_0x527641[_0x75d8('0x3b')]};return db[_0x75d8('0x29')][_0x75d8('0x1d')](_0x5895e4)[_0x75d8('0x20')](function(_0x321947){_0xc4b7d8[_0x75d8('0x1d')]=_0x321947;if(_0x31c943[_0x75d8('0x2f')][_0x75d8('0x3e')]){_0x527641[_0x75d8('0x3f')]=[{'all':!![]}];}return db[_0x75d8('0x29')]['findAll'](_0x527641);})[_0x75d8('0x20')](function(_0x42b542){_0xc4b7d8['rows']=_0x42b542;return _0xc4b7d8;})['then'](respondWithFilteredResult(_0x2ee889,_0x527641))[_0x75d8('0x40')](handleError(_0x2ee889,null));};exports[_0x75d8('0x41')]=function(_0x42bfee,_0x4e8ddd){var _0x5e28ad={'raw':!![],'where':{'id':_0x42bfee[_0x75d8('0x42')]['id']}},_0xc99cf2={};_0xc99cf2['model']=_['keys'](db[_0x75d8('0x29')][_0x75d8('0x2a')]);_0xc99cf2[_0x75d8('0x2f')]=_[_0x75d8('0x30')](_0x42bfee[_0x75d8('0x2f')]);_0xc99cf2[_0x75d8('0x39')]=_[_0x75d8('0x32')](_0xc99cf2[_0x75d8('0x2e')],_0xc99cf2['query']);_0x5e28ad[_0x75d8('0x31')]=_[_0x75d8('0x32')](_0xc99cf2[_0x75d8('0x2e')],qs[_0x75d8('0x33')](_0x42bfee[_0x75d8('0x2f')][_0x75d8('0x33')]));_0x5e28ad[_0x75d8('0x31')]=_0x5e28ad[_0x75d8('0x31')][_0x75d8('0x34')]?_0x5e28ad[_0x75d8('0x31')]:_0xc99cf2[_0x75d8('0x2e')];if(_0x42bfee[_0x75d8('0x2f')][_0x75d8('0x3e')]){_0x5e28ad[_0x75d8('0x3f')]=[{'all':!![]}];}_0x5e28ad=_[_0x75d8('0x3c')]({},_0x5e28ad,_0x42bfee['options']);return db[_0x75d8('0x29')][_0x75d8('0x43')](_0x5e28ad)[_0x75d8('0x20')](handleEntityNotFound(_0x4e8ddd,null))[_0x75d8('0x20')](respondWithResult(_0x4e8ddd,null))['catch'](handleError(_0x4e8ddd,null));};exports[_0x75d8('0x44')]=function(_0x1c4269,_0x436582){return db[_0x75d8('0x29')][_0x75d8('0x44')](_0x1c4269[_0x75d8('0x45')],{})[_0x75d8('0x20')](function(_0x16b485){var _0x2e7aec=_0x1c4269[_0x75d8('0x46')]['get']({'plain':!![]});if(!_0x2e7aec)throw new Error(_0x75d8('0x47'));if(_0x2e7aec[_0x75d8('0x48')]===_0x75d8('0x46')){var _0x5789a2=_0x16b485[_0x75d8('0x22')]({'plain':!![]});var _0x2c9c55=_0x75d8('0x23');return db[_0x75d8('0x49')][_0x75d8('0x43')]({'where':{'name':_0x2c9c55,'userProfileId':_0x2e7aec['userProfileId']},'raw':!![]})[_0x75d8('0x20')](function(_0x518f6c){if(_0x518f6c&&_0x518f6c[_0x75d8('0x4a')]===0x0){return db['UserProfileResource'][_0x75d8('0x44')]({'name':_0x5789a2['name'],'resourceId':_0x5789a2['id'],'type':_0x518f6c[_0x75d8('0x25')],'sectionId':_0x518f6c['id']},{})[_0x75d8('0x20')](function(){return _0x16b485;});}else{return _0x16b485;}})[_0x75d8('0x40')](function(_0x27a921){logger[_0x75d8('0x4b')](_0x75d8('0x4c'),_0x27a921);throw _0x27a921;});}return _0x16b485;})[_0x75d8('0x20')](respondWithResult(_0x436582,0xc9))[_0x75d8('0x40')](handleError(_0x436582,null));};exports[_0x75d8('0x1f')]=function(_0x1cef4a,_0x34f66e){if(_0x1cef4a[_0x75d8('0x45')]['id']){delete _0x1cef4a['body']['id'];}return db[_0x75d8('0x29')]['find']({'where':{'id':_0x1cef4a[_0x75d8('0x42')]['id']}})[_0x75d8('0x20')](handleEntityNotFound(_0x34f66e,null))[_0x75d8('0x20')](saveUpdates(_0x1cef4a[_0x75d8('0x45')],null))[_0x75d8('0x20')](respondWithResult(_0x34f66e,null))[_0x75d8('0x40')](handleError(_0x34f66e,null));};exports[_0x75d8('0x21')]=function(_0x2152c9,_0x4cea06){return db[_0x75d8('0x29')][_0x75d8('0x43')]({'where':{'id':_0x2152c9[_0x75d8('0x42')]['id']}})[_0x75d8('0x20')](handleEntityNotFound(_0x4cea06,null))['then'](removeEntity(_0x4cea06,null))[_0x75d8('0x40')](handleError(_0x4cea06,null));};exports[_0x75d8('0x4d')]=function(_0x43d147,_0x221e05){return db[_0x75d8('0x29')]['describe']()['then'](respondWithResult(_0x221e05,null))[_0x75d8('0x40')](handleError(_0x221e05,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b510d79..11ecb1d 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 _0x910b=['request-promise','rimraf','../../config/environment','exports','tools_tags','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x323eec,_0x46c57d){var _0x19b7cc=function(_0x292de9){while(--_0x292de9){_0x323eec['push'](_0x323eec['shift']());}};_0x19b7cc(++_0x46c57d);}(_0x910b,0x1a7));var _0xb910=function(_0x496e51,_0x101f30){_0x496e51=_0x496e51-0x0;var _0x1d143f=_0x910b[_0x496e51];return _0x1d143f;};'use strict';var _=require(_0xb910('0x0'));var util=require(_0xb910('0x1'));var logger=require(_0xb910('0x2'))(_0xb910('0x3'));var moment=require(_0xb910('0x4'));var BPromise=require(_0xb910('0x5'));var rp=require(_0xb910('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb910('0x7'));var config=require(_0xb910('0x8'));var attributes=require('./tag.attributes');module[_0xb910('0x9')]=function(_0x399dae,_0x5eba48){return _0x399dae['define']('Tag',attributes,{'tableName':_0xb910('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef75=['rimraf','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2469c5,_0x2e9dde){var _0x29deaa=function(_0x1c7bf7){while(--_0x1c7bf7){_0x2469c5['push'](_0x2469c5['shift']());}};_0x29deaa(++_0x2e9dde);}(_0xef75,0x125));var _0x5ef7=function(_0x30ab20,_0x4471d3){_0x30ab20=_0x30ab20-0x0;var _0x4a4aac=_0xef75[_0x30ab20];return _0x4a4aac;};'use strict';var _=require(_0x5ef7('0x0'));var util=require(_0x5ef7('0x1'));var logger=require(_0x5ef7('0x2'))(_0x5ef7('0x3'));var moment=require(_0x5ef7('0x4'));var BPromise=require(_0x5ef7('0x5'));var rp=require(_0x5ef7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ef7('0x7'));var config=require('../../config/environment');var attributes=require(_0x5ef7('0x8'));module[_0x5ef7('0x9')]=function(_0x4dbe1c,_0x3ddc2e){return _0x4dbe1c[_0x5ef7('0xa')](_0x5ef7('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 279773a..e1b65d9 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 _0x5c12=['../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x5c12,0x188));var _0x25c1=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x5c12[_0x45c981];return _0x4f62c8;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('Tag,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('Tag,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file +var _0x0fda=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x5b94c9,_0x5668e6){_0x5b94c9=_0x5b94c9-0x0;var _0x565928=_0x0fda[_0x5b94c9];return _0x565928;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x868183,_0x62b109,_0x1aab41){return new BPromise(function(_0x248cca,_0x5d996b){return client[_0xa0fd('0x9')](_0x868183,_0x1aab41)[_0xa0fd('0xa')](function(_0x231ca4){logger[_0xa0fd('0xb')]('Tag,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));logger[_0xa0fd('0xd')](_0xa0fd('0xe'),_0x62b109,'request\x20sent',JSON[_0xa0fd('0xf')](_0x231ca4));if(_0x231ca4[_0xa0fd('0x10')]){if(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x11')]===0x1f4){logger[_0xa0fd('0x10')]('Tag,\x20%s,\x20%s',_0x62b109,_0x231ca4['error'][_0xa0fd('0x12')]);return _0x5d996b(_0x231ca4[_0xa0fd('0x10')]['message']);}logger[_0xa0fd('0x10')](_0xa0fd('0x13'),_0x62b109,_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);return _0x248cca(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);}else{logger[_0xa0fd('0xb')]('Tag,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));_0x248cca(_0x231ca4[_0xa0fd('0x14')]['message']);}})['catch'](function(_0x205506){logger[_0xa0fd('0x10')]('Tag,\x20%s,\x20%s',_0x62b109,_0x205506);_0x5d996b(_0x205506);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0b052d1..aa6a45f 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 751011d..b4cc326 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(_0x12c1bd,_0x26feac){var _0x36befd=function(_0x2fae2a){while(--_0x2fae2a){_0x12c1bd['push'](_0x12c1bd['shift']());}};_0x36befd(++_0x26feac);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x3f48e9,_0x42932b){var _0x1ad3aa=function(_0x1ceec8){while(--_0x1ceec8){_0x3f48e9['push'](_0x3f48e9['shift']());}};_0x1ad3aa(++_0x42932b);}(_0xb10b,0x12a));var _0xbb10=function(_0x77a933,_0x1cdd24){_0x77a933=_0x77a933-0x0;var _0x9df572=_0xb10b[_0x77a933];return _0x9df572;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 64f27b3..b294f27 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 _0x13e0=['Mail','Sms','Fax','Openchannel','Whatsapp','Voice','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','online','voicePause','UserVoiceQueueRt','upsert','interface','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','Queue:remove','getAgents','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','Team','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','show','params','rawAttributes','intersection','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','Teams','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','add','ids','removeQueues','remove','Queues','isArray','Chat'];(function(_0x520742,_0xead82f){var _0x47dba2=function(_0x572c6d){while(--_0x572c6d){_0x520742['push'](_0x520742['shift']());}};_0x47dba2(++_0xead82f);}(_0x13e0,0x14e));var _0x013e=function(_0x3d91aa,_0x42b929){_0x3d91aa=_0x3d91aa-0x0;var _0x442eed=_0x13e0[_0x3d91aa];return _0x442eed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x013e('0x0'));var zipdir=require(_0x013e('0x1'));var jsonpatch=require(_0x013e('0x2'));var rp=require(_0x013e('0x3'));var moment=require(_0x013e('0x4'));var BPromise=require(_0x013e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x013e('0x6'));var csv=require(_0x013e('0x7'));var ejs=require(_0x013e('0x8'));var fs=require('fs');var fs_extra=require(_0x013e('0x9'));var _=require(_0x013e('0xa'));var squel=require(_0x013e('0xb'));var crypto=require(_0x013e('0xc'));var jsforce=require(_0x013e('0xd'));var deskjs=require(_0x013e('0xe'));var toCsv=require(_0x013e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x013e('0xf'));var qs=require(_0x013e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x013e('0x11'));var logger=require(_0x013e('0x12'))(_0x013e('0x13'));var utils=require('../../config/utils');var config=require(_0x013e('0x14'));var licenseUtil=require(_0x013e('0x15'));var db=require(_0x013e('0x16'))['db'];config['redis']=_[_0x013e('0x17')](config[_0x013e('0x18')],{'host':_0x013e('0x19'),'port':0x18eb});var socket=require(_0x013e('0x1a'))(new Redis(config[_0x013e('0x18')]));require(_0x013e('0x1b'))[_0x013e('0x1c')](socket);function respondWithStatusCode(_0x4b15e4,_0x1ed369){_0x1ed369=_0x1ed369||0xcc;return function(_0x327523){if(_0x327523){return _0x4b15e4[_0x013e('0x1d')](_0x1ed369);}return _0x4b15e4[_0x013e('0x1e')](_0x1ed369)[_0x013e('0x1f')]();};}function respondWithResult(_0x2f152e,_0x4db7a2){_0x4db7a2=_0x4db7a2||0xc8;return function(_0x3b3b06){if(_0x3b3b06){return _0x2f152e['status'](_0x4db7a2)[_0x013e('0x20')](_0x3b3b06);}};}function respondWithFilteredResult(_0x350137,_0x1ddfe6){return function(_0x1dc163){if(_0x1dc163){var _0x2f16a9=typeof _0x1ddfe6[_0x013e('0x21')]==='undefined'&&typeof _0x1ddfe6[_0x013e('0x22')]==='undefined';var _0x40f3ad=_0x1dc163[_0x013e('0x23')];var _0x1c74e3=_0x2f16a9?0x0:_0x1ddfe6[_0x013e('0x21')];var _0x5bf301=_0x2f16a9?_0x1dc163[_0x013e('0x23')]:_0x1ddfe6[_0x013e('0x21')]+_0x1ddfe6['limit'];var _0x46d4bd;if(_0x5bf301>=_0x40f3ad){_0x5bf301=_0x40f3ad;_0x46d4bd=0xc8;}else{_0x46d4bd=0xce;}_0x350137[_0x013e('0x1e')](_0x46d4bd);return _0x350137[_0x013e('0x24')](_0x013e('0x25'),_0x1c74e3+'-'+_0x5bf301+'/'+_0x40f3ad)[_0x013e('0x20')](_0x1dc163);}return null;};}function patchUpdates(_0x41d859){return function(_0x2e6c79){try{jsonpatch[_0x013e('0x26')](_0x2e6c79,_0x41d859,!![]);}catch(_0x2e3824){return BPromise[_0x013e('0x27')](_0x2e3824);}return _0x2e6c79[_0x013e('0x28')]();};}function saveUpdates(_0x31e2b9,_0x3b0499){return function(_0x411a2c){if(_0x411a2c){return _0x411a2c[_0x013e('0x29')](_0x31e2b9)[_0x013e('0x2a')](function(_0xeb8255){return _0xeb8255;});}return null;};}function handleEntityNotFound(_0x50e562,_0x567d23){return function(_0xfa70d5){if(!_0xfa70d5){_0x50e562[_0x013e('0x1d')](0x194);}return _0xfa70d5;};}function handleError(_0x4264b5,_0x579353){_0x579353=_0x579353||0x1f4;return function(_0x44bfbc){logger[_0x013e('0x2b')](_0x44bfbc[_0x013e('0x2c')]);if(_0x44bfbc[_0x013e('0x2d')]){delete _0x44bfbc[_0x013e('0x2d')];}_0x4264b5[_0x013e('0x1e')](_0x579353)['send'](_0x44bfbc);};}exports[_0x013e('0x2e')]=function(_0x302b05,_0x5dc1e9){var _0x5d5476={},_0x2f9898={},_0xb133cb={'count':0x0,'rows':[]};var _0x3f96a2=_[_0x013e('0x2f')](db[_0x013e('0x30')]['rawAttributes'],function(_0x57ad54){return{'name':_0x57ad54['fieldName'],'type':_0x57ad54[_0x013e('0x31')][_0x013e('0x32')]};});_0x2f9898[_0x013e('0x33')]=_['map'](_0x3f96a2,'name');_0x2f9898['query']=_[_0x013e('0x34')](_0x302b05[_0x013e('0x35')]);_0x2f9898[_0x013e('0x36')]=_['intersection'](_0x2f9898[_0x013e('0x33')],_0x2f9898[_0x013e('0x35')]);_0x5d5476[_0x013e('0x37')]=_['intersection'](_0x2f9898[_0x013e('0x33')],qs[_0x013e('0x38')](_0x302b05[_0x013e('0x35')][_0x013e('0x38')]));_0x5d5476[_0x013e('0x37')]=_0x5d5476[_0x013e('0x37')][_0x013e('0x39')]?_0x5d5476[_0x013e('0x37')]:_0x2f9898['model'];if(!_0x302b05[_0x013e('0x35')][_0x013e('0x3a')](_0x013e('0x3b'))){_0x5d5476[_0x013e('0x22')]=qs[_0x013e('0x22')](_0x302b05[_0x013e('0x35')][_0x013e('0x22')]);_0x5d5476[_0x013e('0x21')]=qs[_0x013e('0x21')](_0x302b05[_0x013e('0x35')][_0x013e('0x21')]);}_0x5d5476[_0x013e('0x3c')]=qs['sort'](_0x302b05[_0x013e('0x35')][_0x013e('0x3d')]);_0x5d5476[_0x013e('0x3e')]=qs[_0x013e('0x36')](_[_0x013e('0x3f')](_0x302b05['query'],_0x2f9898[_0x013e('0x36')]),_0x3f96a2);if(_0x302b05[_0x013e('0x35')]['filter']){_0x5d5476[_0x013e('0x3e')]=_[_0x013e('0x40')](_0x5d5476[_0x013e('0x3e')],{'$or':_[_0x013e('0x2f')](_0x3f96a2,function(_0x3770ff){if(_0x3770ff[_0x013e('0x31')]!==_0x013e('0x41')){var _0x289ca1={};_0x289ca1[_0x3770ff[_0x013e('0x2d')]]={'$like':'%'+_0x302b05[_0x013e('0x35')]['filter']+'%'};return _0x289ca1;}})});}_0x5d5476=_[_0x013e('0x40')]({},_0x5d5476,_0x302b05['options']);var _0x595d1a={'where':_0x5d5476['where']};return db['Team'][_0x013e('0x23')](_0x595d1a)[_0x013e('0x2a')](function(_0x3dfe5d){_0xb133cb[_0x013e('0x23')]=_0x3dfe5d;if(_0x302b05[_0x013e('0x35')]['includeAll']){_0x5d5476['include']=[{'all':!![]}];}return db[_0x013e('0x30')]['findAll'](_0x5d5476);})[_0x013e('0x2a')](function(_0x2243fa){_0xb133cb[_0x013e('0x42')]=_0x2243fa;return _0xb133cb;})[_0x013e('0x2a')](respondWithFilteredResult(_0x5dc1e9,_0x5d5476))['catch'](handleError(_0x5dc1e9,null));};exports[_0x013e('0x43')]=function(_0x2f4606,_0x57b7e5){var _0x46569d={'raw':![],'where':{'id':_0x2f4606[_0x013e('0x44')]['id']}},_0x20eeed={};_0x20eeed[_0x013e('0x33')]=_['keys'](db[_0x013e('0x30')][_0x013e('0x45')]);_0x20eeed['query']=_[_0x013e('0x34')](_0x2f4606['query']);_0x20eeed[_0x013e('0x36')]=_[_0x013e('0x46')](_0x20eeed[_0x013e('0x33')],_0x20eeed[_0x013e('0x35')]);_0x46569d['attributes']=_[_0x013e('0x46')](_0x20eeed[_0x013e('0x33')],qs[_0x013e('0x38')](_0x2f4606[_0x013e('0x35')][_0x013e('0x38')]));_0x46569d[_0x013e('0x37')]=_0x46569d[_0x013e('0x37')][_0x013e('0x39')]?_0x46569d[_0x013e('0x37')]:_0x20eeed['model'];if(_0x2f4606[_0x013e('0x35')][_0x013e('0x47')]){_0x46569d['include']=[{'all':!![]}];}_0x46569d=_[_0x013e('0x40')]({},_0x46569d,_0x2f4606[_0x013e('0x48')]);return db['Team'][_0x013e('0x49')](_0x46569d)[_0x013e('0x2a')](handleEntityNotFound(_0x57b7e5,null))[_0x013e('0x2a')](respondWithResult(_0x57b7e5,null))[_0x013e('0x4a')](handleError(_0x57b7e5,null));};exports[_0x013e('0x4b')]=function(_0x387d40,_0x1bfd78){return db['Team']['create'](_0x387d40[_0x013e('0x4c')],{})[_0x013e('0x2a')](function(_0x5f2182){var _0x3ad80d=_0x387d40[_0x013e('0x4d')]['get']({'plain':!![]});if(!_0x3ad80d)throw new Error(_0x013e('0x4e'));if(_0x3ad80d[_0x013e('0x4f')]===_0x013e('0x4d')){var _0x19f39c=_0x5f2182[_0x013e('0x50')]({'plain':!![]});var _0x33c99d='Teams';return db['UserProfileSection'][_0x013e('0x49')]({'where':{'name':_0x33c99d,'userProfileId':_0x3ad80d[_0x013e('0x51')]},'raw':!![]})['then'](function(_0x5ae8fe){if(_0x5ae8fe&&_0x5ae8fe[_0x013e('0x52')]===0x0){return db[_0x013e('0x53')]['create']({'name':_0x19f39c[_0x013e('0x2d')],'resourceId':_0x19f39c['id'],'type':_0x5ae8fe[_0x013e('0x2d')],'sectionId':_0x5ae8fe['id']},{})['then'](function(){return _0x5f2182;});}else{return _0x5f2182;}})[_0x013e('0x4a')](function(_0x1c12b2){logger[_0x013e('0x2b')](_0x013e('0x54'),_0x1c12b2);throw _0x1c12b2;});}return _0x5f2182;})[_0x013e('0x2a')](respondWithResult(_0x1bfd78,0xc9))['catch'](handleError(_0x1bfd78,null));};exports['update']=function(_0x2a67ac,_0x2f6545){if(_0x2a67ac[_0x013e('0x4c')]['id']){delete _0x2a67ac[_0x013e('0x4c')]['id'];}return db[_0x013e('0x30')][_0x013e('0x49')]({'where':{'id':_0x2a67ac['params']['id']}})[_0x013e('0x2a')](handleEntityNotFound(_0x2f6545,null))[_0x013e('0x2a')](saveUpdates(_0x2a67ac['body'],null))['then'](respondWithResult(_0x2f6545,null))[_0x013e('0x4a')](handleError(_0x2f6545,null));};exports[_0x013e('0x55')]=function(_0x410d99,_0x5862f1){var _0x94ac62=_0x410d99['params']['id'];var _0x36ca60=[];return db['sequelize'][_0x013e('0x56')](function(_0xbbf6){var _0x55a9ab='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x94ac62;return db['sequelize']['query'](_0x55a9ab,{'type':db[_0x013e('0x57')][_0x013e('0x58')]['SELECT'],'raw':!![],'transaction':_0xbbf6})[_0x013e('0x2a')](function(_0x3b1074){_0x36ca60=_[_0x013e('0x2f')](_0x3b1074,function(_0x85f42c){return Number(_0x85f42c[_0x013e('0x59')]);});})[_0x013e('0x2a')](function(){var _0x29bff8=_0x013e('0x5a')+_0x94ac62;return db[_0x013e('0x5b')][_0x013e('0x35')](_0x29bff8,{'type':db[_0x013e('0x57')]['QueryTypes'][_0x013e('0x5c')],'raw':!![],'transaction':_0xbbf6});})[_0x013e('0x2a')](function(_0x30d299){var _0x1b2234=_[_0x013e('0x2f')](_0x30d299,function(_0x470913){return Number(_0x470913[_0x013e('0x5d')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x36ca60},'VoiceQueueId':{'$in':_0x1b2234}},'transaction':_0xbbf6});})[_0x013e('0x2a')](function(){var _0x213549=_0x013e('0x5e')+_0x94ac62;return db[_0x013e('0x5b')][_0x013e('0x35')](_0x213549,{'type':db['Sequelize'][_0x013e('0x58')][_0x013e('0x5c')],'raw':!![],'transaction':_0xbbf6});})[_0x013e('0x2a')](function(_0x12dd2c){var _0x17cb79=_[_0x013e('0x2f')](_0x12dd2c,function(_0x56d0ec){return Number(_0x56d0ec['MailQueueId']);});return db['UserMailQueue'][_0x013e('0x55')]({'where':{'UserId':{'$in':_0x36ca60},'MailQueueId':{'$in':_0x17cb79}},'transaction':_0xbbf6});})['then'](function(){var _0x176f19=_0x013e('0x5f')+_0x94ac62;return db[_0x013e('0x5b')]['query'](_0x176f19,{'type':db[_0x013e('0x57')][_0x013e('0x58')][_0x013e('0x5c')],'raw':!![],'transaction':_0xbbf6});})['then'](function(_0x5b6e49){var _0x3ea12b=_[_0x013e('0x2f')](_0x5b6e49,function(_0x1b5e7f){return Number(_0x1b5e7f[_0x013e('0x60')]);});return db[_0x013e('0x61')][_0x013e('0x55')]({'where':{'UserId':{'$in':_0x36ca60},'SmsQueueId':{'$in':_0x3ea12b}},'transaction':_0xbbf6});})[_0x013e('0x2a')](function(){var _0x37534a=_0x013e('0x62')+_0x94ac62;return db['sequelize'][_0x013e('0x35')](_0x37534a,{'type':db[_0x013e('0x57')][_0x013e('0x58')][_0x013e('0x5c')],'raw':!![],'transaction':_0xbbf6});})[_0x013e('0x2a')](function(_0x21b373){var _0x373051=_[_0x013e('0x2f')](_0x21b373,function(_0x58687a){return Number(_0x58687a['ChatQueueId']);});return db[_0x013e('0x63')]['destroy']({'where':{'UserId':{'$in':_0x36ca60},'ChatQueueId':{'$in':_0x373051}},'transaction':_0xbbf6});})[_0x013e('0x2a')](function(){var _0x5bfbab=_0x013e('0x64')+_0x94ac62;return db[_0x013e('0x5b')][_0x013e('0x35')](_0x5bfbab,{'type':db['Sequelize'][_0x013e('0x58')][_0x013e('0x5c')],'raw':!![],'transaction':_0xbbf6});})[_0x013e('0x2a')](function(_0x460cd2){var _0x5d241e=_[_0x013e('0x2f')](_0x460cd2,function(_0x37ddd1){return Number(_0x37ddd1['FaxQueueId']);});return db[_0x013e('0x65')][_0x013e('0x55')]({'where':{'UserId':{'$in':_0x36ca60},'FaxQueueId':{'$in':_0x5d241e}},'transaction':_0xbbf6});})[_0x013e('0x2a')](function(){var _0xab7ada='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x94ac62;return db[_0x013e('0x5b')]['query'](_0xab7ada,{'type':db[_0x013e('0x57')]['QueryTypes'][_0x013e('0x5c')],'raw':!![],'transaction':_0xbbf6});})[_0x013e('0x2a')](function(_0x22ecf4){var _0x34c924=_['map'](_0x22ecf4,function(_0x41fdfb){return Number(_0x41fdfb[_0x013e('0x66')]);});return db['UserOpenchannelQueue'][_0x013e('0x55')]({'where':{'UserId':{'$in':_0x36ca60},'OpenchannelQueueId':{'$in':_0x34c924}},'transaction':_0xbbf6});})[_0x013e('0x2a')](function(){var _0x252486='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x94ac62;return db[_0x013e('0x5b')]['query'](_0x252486,{'type':db[_0x013e('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xbbf6});})['then'](function(_0x3444b5){var _0xab972b=_[_0x013e('0x2f')](_0x3444b5,function(_0x147f36){return Number(_0x147f36[_0x013e('0x67')]);});return db[_0x013e('0x68')]['destroy']({'where':{'UserId':{'$in':_0x36ca60},'WhatsappQueueId':{'$in':_0xab972b}},'transaction':_0xbbf6});})[_0x013e('0x2a')](function(){return db[_0x013e('0x69')]['find']({'where':{'TeamId':_0x94ac62}});})['then'](function(_0x20383b){if(_0x20383b===null){return;}return db['UserVoicePrefix'][_0x013e('0x55')]({'where':{'UserId':{'$in':_0x36ca60},'VoicePrefixId':_0x20383b[_0x013e('0x6a')]},'transaction':_0xbbf6});})['then'](function(){return db[_0x013e('0x30')][_0x013e('0x55')]({'where':{'id':_0x94ac62},'cascade':!![],'transaction':_0xbbf6});})[_0x013e('0x2a')](function(_0x3bc3b8){if(_0x3bc3b8===0x0){_0x5862f1[_0x013e('0x1d')](0x194);}else{return db[_0x013e('0x53')]['destroy']({'where':{'type':_0x013e('0x6b'),'resourceId':_0x94ac62},'cascade':!![],'transaction':_0xbbf6})[_0x013e('0x2a')](function(){_0x5862f1['status'](0xcc)['end']();});}})[_0x013e('0x4a')](function(_0x57ff88){_0x5862f1[_0x013e('0x1e')](0x1f4)[_0x013e('0x6c')](_0x57ff88);});});};exports[_0x013e('0x6d')]=function(_0xc52589,_0x241c88,_0x5bc6ed){return db[_0x013e('0x30')][_0x013e('0x6e')]({'where':{'id':_0xc52589[_0x013e('0x44')]['id']}})[_0x013e('0x2a')](handleEntityNotFound(_0x241c88,null))[_0x013e('0x2a')](function(_0x58146f){if(!_0xc52589[_0x013e('0x35')][_0x013e('0x6f')]||!utils[_0x013e('0x70')](_0xc52589['query'][_0x013e('0x6f')])){throw new db[(_0x013e('0x57'))][(_0x013e('0x71'))](_0x013e('0x72'));}var _0x41985c={};var _0x47eff1={};_0x47eff1[_0x013e('0x33')]=_[_0x013e('0x34')](db[_[_0x013e('0x73')](_0xc52589[_0x013e('0x35')]['channel'][_0x013e('0x74')]())+_0x013e('0x75')][_0x013e('0x45')]);_0x47eff1['query']=_[_0x013e('0x34')](_0xc52589['query']);_0x47eff1[_0x013e('0x36')]=_[_0x013e('0x46')](_0x47eff1[_0x013e('0x33')],_0x47eff1[_0x013e('0x35')]);_0x41985c[_0x013e('0x37')]=_[_0x013e('0x46')](_0x47eff1[_0x013e('0x33')],qs[_0x013e('0x38')](_0xc52589[_0x013e('0x35')]['fields']));_0x41985c[_0x013e('0x37')]=_0x41985c[_0x013e('0x37')]['length']?_0x41985c[_0x013e('0x37')]:_0x47eff1['model'];_0x41985c[_0x013e('0x22')]=qs[_0x013e('0x22')](_0xc52589['query']['limit']);_0x41985c['offset']=qs[_0x013e('0x21')](_0xc52589[_0x013e('0x35')][_0x013e('0x21')]);_0x41985c[_0x013e('0x3c')]=qs[_0x013e('0x3d')](_0xc52589[_0x013e('0x35')]['sort']);_0x41985c['where']=qs[_0x013e('0x36')](_[_0x013e('0x3f')](_0xc52589['query'],_0x47eff1[_0x013e('0x36')]));_0x41985c=_[_0x013e('0x40')]({},_0x41985c,_0xc52589[_0x013e('0x48')]);return _0x58146f[_0x013e('0x50')+_[_0x013e('0x73')](_0xc52589[_0x013e('0x35')][_0x013e('0x6f')]['toLowerCase']())+'Queues'](_0x41985c);})[_0x013e('0x2a')](respondWithResult(_0x241c88,null))[_0x013e('0x4a')](handleError(_0x241c88,null));};exports['addQueues']=function(_0x2969f4,_0x4acdfe,_0x4d9e84){return db[_0x013e('0x30')]['findOne']({'where':{'id':_0x2969f4[_0x013e('0x44')]['id']}})[_0x013e('0x2a')](function(_0x8daceb){if(_0x8daceb){if(!_0x2969f4[_0x013e('0x4c')][_0x013e('0x6f')]||!utils[_0x013e('0x70')](_0x2969f4[_0x013e('0x4c')][_0x013e('0x6f')])){throw new db[(_0x013e('0x57'))]['ValidationError'](_0x013e('0x72'));}return _0x8daceb[_0x013e('0x76')+_[_0x013e('0x73')](_0x2969f4[_0x013e('0x4c')][_0x013e('0x6f')][_0x013e('0x74')]())+'Queues'](_0x2969f4[_0x013e('0x4c')][_0x013e('0x77')]);}return null;})[_0x013e('0x2a')](handleEntityNotFound(_0x4acdfe,null))[_0x013e('0x2a')](respondWithStatusCode(_0x4acdfe,null))[_0x013e('0x4a')](handleError(_0x4acdfe,null));};exports[_0x013e('0x78')]=function(_0x1af02a,_0x1a461f,_0x51191f){return db[_0x013e('0x30')][_0x013e('0x6e')]({'where':{'id':_0x1af02a[_0x013e('0x44')]['id']}})['then'](function(_0x4858f9){if(_0x4858f9){if(!_0x1af02a[_0x013e('0x35')]['channel']||!utils[_0x013e('0x70')](_0x1af02a['query']['channel'])){throw new db[(_0x013e('0x57'))][(_0x013e('0x71'))](_0x013e('0x72'));}return _0x4858f9[_0x013e('0x79')+_[_0x013e('0x73')](_0x1af02a[_0x013e('0x35')]['channel'][_0x013e('0x74')]())+_0x013e('0x7a')](_0x1af02a[_0x013e('0x35')]['ids']);}return null;})[_0x013e('0x2a')](handleEntityNotFound(_0x1a461f,null))[_0x013e('0x2a')](respondWithStatusCode(_0x1a461f,null))[_0x013e('0x4a')](handleError(_0x1a461f,null));};exports['addAgents']=function(_0x4debcf,_0x1acc59){var _0x65fcf=_[_0x013e('0x7b')](_0x4debcf[_0x013e('0x4c')][_0x013e('0x77')])?_0x4debcf[_0x013e('0x4c')][_0x013e('0x77')]:[_0x4debcf[_0x013e('0x4c')][_0x013e('0x77')]];var _0x300dbb=_0x4debcf[_0x013e('0x44')]['id'];return db[_0x013e('0x30')]['find']({'where':{'id':_0x300dbb}})[_0x013e('0x2a')](handleEntityNotFound(_0x1acc59,null))['then'](function(_0x5ec1f6){if(_0x5ec1f6){var _0x2c0255=['Voice',_0x013e('0x7c'),_0x013e('0x7d'),_0x013e('0x7e'),_0x013e('0x7f'),_0x013e('0x80'),_0x013e('0x81')];return db[_0x013e('0x5b')]['transaction'](function(_0x4cd5cf){var _0x40992c=_[_0x013e('0x2f')](_0x2c0255,function(_0x1af741){var _0x12dcb5={'attributes':['id',_0x013e('0x2d')]};if(_0x1af741===_0x013e('0x82')){_0x12dcb5['through']={'attributes':[_0x013e('0x83')]};}return _0x5ec1f6['get'+_0x1af741+_0x013e('0x7a')](_0x12dcb5)['then'](function(_0x2e71b4){var _0x9e659d=_[_0x013e('0x2f')](_0x2e71b4,function(_0x2709c5){var _0x3705aa=_[_0x013e('0x2f')](_0x65fcf,function(_0x296030){var _0x4133c2={'where':{'UserId':_0x296030,[_0x1af741+_0x013e('0x84')]:_0x2709c5['id']},'transaction':_0x4cd5cf};if(_0x1af741===_0x013e('0x82')){_0x4133c2[_0x013e('0x17')]={'penalty':_0x2709c5[_0x013e('0x85')][_0x013e('0x83')]};}return db[_0x013e('0x86')+_0x1af741+_0x013e('0x75')][_0x013e('0x87')](_0x4133c2)[_0x013e('0x2a')](function(){socket[_0x013e('0x88')](_0x013e('0x4d')+_0x1af741+_0x013e('0x89'),{'UserId':_0x296030,[_0x1af741+_0x013e('0x84')]:_0x2709c5['id']});if(_0x1af741!==_0x013e('0x82')){return;}return db[_0x013e('0x86')][_0x013e('0x8a')]({'where':{'id':_0x65fcf,'online':0x1},'attributes':['id',_0x013e('0x2d'),_0x013e('0x8b'),_0x013e('0x8c'),'interface'],'raw':!![]})[_0x013e('0x2a')](function(_0x2a53c6){var _0x5a3deb=_['map'](_0x2a53c6,function(_0x4feda2){return db[_0x013e('0x8d')][_0x013e('0x8e')]({'membername':_0x4feda2[_0x013e('0x2d')],'UserId':_0x4feda2['id'],'queue_name':_0x2709c5[_0x013e('0x2d')],'VoiceQueueId':_0x2709c5['id'],'interface':_['isNil'](_0x4feda2[_0x013e('0x8f')])?util['format'](_0x013e('0x90'),_0x4feda2[_0x013e('0x2d')]):_0x4feda2[_0x013e('0x8f')],'paused':_0x4feda2[_0x013e('0x8c')]||![],'penalty':_0x2709c5[_0x013e('0x85')]['penalty']},{'transaction':_0x4cd5cf});});return Promise['all'](_0x5a3deb);});});});return Promise[_0x013e('0x91')](_0x3705aa);});return Promise[_0x013e('0x91')](_0x9e659d);})['then'](function(){return db[_0x013e('0x69')][_0x013e('0x6e')]({'where':{'teamId':_0x300dbb}})[_0x013e('0x2a')](function(_0x4ee2bc){if(_0x4ee2bc){var _0x3294d3=_[_0x013e('0x2f')](_0x65fcf,function(_0x18db82){db[_0x013e('0x92')][_0x013e('0x8e')]({'UserId':_0x18db82,'VoicePrefixId':_0x4ee2bc[_0x013e('0x6a')]});});return Promise[_0x013e('0x91')](_0x3294d3);}});});});return Promise[_0x013e('0x91')](_0x40992c)[_0x013e('0x2a')](function(){return _0x5ec1f6[_0x013e('0x93')](_0x65fcf,{'transaction':_0x4cd5cf})[_0x013e('0x94')](function(_0x19f1d0){return _0x19f1d0;});});});}})[_0x013e('0x2a')](respondWithResult(_0x1acc59,null))[_0x013e('0x4a')](handleError(_0x1acc59,null));};exports['removeAgents']=function(_0x47d32a,_0x3f28e1){var _0x334194=_[_0x013e('0x7b')](_0x47d32a[_0x013e('0x35')][_0x013e('0x77')])?_0x47d32a['query']['ids']:[_0x47d32a[_0x013e('0x35')][_0x013e('0x77')]];var _0x25f4e5=_0x47d32a['params']['id'];return db[_0x013e('0x30')][_0x013e('0x49')]({'where':{'id':_0x25f4e5}})[_0x013e('0x2a')](handleEntityNotFound(_0x3f28e1,null))[_0x013e('0x2a')](function(_0x855d4d){if(_0x855d4d){var _0x1c196b=['Voice','Chat','Mail','Sms',_0x013e('0x7f'),'Openchannel',_0x013e('0x81')];return db['sequelize']['transaction'](function(_0x3b0fd3){var _0x1bf7b8=_['map'](_0x1c196b,function(_0x22d689){var _0xb54aac={'attributes':['id','name']};return _0x855d4d[_0x013e('0x50')+_0x22d689+_0x013e('0x7a')](_0xb54aac)[_0x013e('0x2a')](function(_0x5467e3){var _0x2b5149=_['map'](_0x5467e3,function(_0x590c7b){return _0x590c7b[_0x013e('0x95')](_0x334194,{'transaction':_0x3b0fd3})['then'](function(){var _0x1e2beb=_['map'](_0x334194,function(_0x37113d){socket[_0x013e('0x88')]('user'+_0x22d689+_0x013e('0x96'),{'UserId':Number(_0x37113d),[_0x22d689+_0x013e('0x84')]:_0x590c7b['id']});if(_0x22d689!==_0x013e('0x82')){return;}return db[_0x013e('0x8d')][_0x013e('0x55')]({'where':{'VoiceQueueId':_0x590c7b['id'],'UserId':_0x37113d},'transaction':_0x3b0fd3});});return Promise[_0x013e('0x91')](_0x1e2beb);});});return Promise['all'](_0x2b5149);});});return Promise[_0x013e('0x91')](_0x1bf7b8)['then'](function(){return _0x855d4d['removeAgents'](_0x334194,{'transaction':_0x3b0fd3});})[_0x013e('0x2a')](function(){return db[_0x013e('0x69')][_0x013e('0x6e')]({'where':{'teamId':_0x25f4e5}})['then'](function(_0xb4a479){if(_0xb4a479){var _0x438ca4=_[_0x013e('0x2f')](_0x334194,function(_0x322ad3){db[_0x013e('0x92')][_0x013e('0x55')]({'where':{'UserId':_0x322ad3,'VoicePrefixId':_0xb4a479[_0x013e('0x6a')]}});});return Promise[_0x013e('0x91')](_0x438ca4);}});});});}})[_0x013e('0x2a')](respondWithStatusCode(_0x3f28e1,null))[_0x013e('0x4a')](handleError(_0x3f28e1,null));};exports[_0x013e('0x97')]=function(_0x52beb7,_0x48cf1c,_0x5c3844){var _0x37e6e1={};var _0x37acfb={};var _0x1945f4;var _0x59082e;return db['Team']['findOne']({'where':{'id':_0x52beb7[_0x013e('0x44')]['id']}})['then'](handleEntityNotFound(_0x48cf1c,null))[_0x013e('0x2a')](function(_0x391d11){if(_0x391d11){_0x1945f4=_0x391d11;_0x37acfb[_0x013e('0x33')]=_[_0x013e('0x34')](db[_0x013e('0x86')][_0x013e('0x45')]);_0x37acfb['query']=_[_0x013e('0x34')](_0x52beb7['query']);_0x37acfb[_0x013e('0x36')]=_[_0x013e('0x46')](_0x37acfb[_0x013e('0x33')],_0x37acfb[_0x013e('0x35')]);_0x37e6e1[_0x013e('0x37')]=_[_0x013e('0x46')](_0x37acfb['model'],qs[_0x013e('0x38')](_0x52beb7['query'][_0x013e('0x38')]));_0x37e6e1[_0x013e('0x37')]=_0x37e6e1[_0x013e('0x37')]['length']?_0x37e6e1[_0x013e('0x37')]:_0x37acfb[_0x013e('0x33')];_0x37e6e1[_0x013e('0x3c')]=qs[_0x013e('0x3d')](_0x52beb7[_0x013e('0x35')][_0x013e('0x3d')]);_0x37e6e1[_0x013e('0x3e')]=qs['filters'](_['pick'](_0x52beb7[_0x013e('0x35')],_0x37acfb[_0x013e('0x36')]));if(_0x52beb7['query'][_0x013e('0x98')]){_0x37e6e1[_0x013e('0x3e')]=_[_0x013e('0x40')](_0x37e6e1[_0x013e('0x3e')],{'$or':_[_0x013e('0x2f')](_0x37e6e1[_0x013e('0x37')],function(_0x20d0be){var _0x13ba83={};_0x13ba83[_0x20d0be]={'$like':'%'+_0x52beb7[_0x013e('0x35')]['filter']+'%'};return _0x13ba83;})});}_0x37e6e1=_[_0x013e('0x40')]({},_0x37e6e1,_0x52beb7[_0x013e('0x48')]);return _0x1945f4[_0x013e('0x97')](_0x37e6e1);}})[_0x013e('0x2a')](function(_0x3a2913){if(_0x3a2913){_0x59082e=_0x3a2913[_0x013e('0x39')];if(!_0x52beb7[_0x013e('0x35')][_0x013e('0x3a')]('nolimit')){_0x37e6e1[_0x013e('0x22')]=qs[_0x013e('0x22')](_0x52beb7[_0x013e('0x35')][_0x013e('0x22')]);_0x37e6e1[_0x013e('0x21')]=qs[_0x013e('0x21')](_0x52beb7['query'][_0x013e('0x21')]);}return _0x1945f4[_0x013e('0x97')](_0x37e6e1);}})['then'](function(_0x27911b){if(_0x27911b){return _0x27911b?{'count':_0x59082e,'rows':_0x27911b}:null;}})['then'](respondWithResult(_0x48cf1c,null))[_0x013e('0x4a')](handleError(_0x48cf1c,null));}; \ No newline at end of file +var _0x33fe=['WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','findOne','add','ids','removeQueues','Voice','Chat','Sms','Fax','Openchannel','through','QueueId','penalty','User','findOrCreate','emit','Queue:save','voicePause','UserVoiceQueueRt','isNil','interface','TeamVoiceQueue','all','VoicePrefixId','addAgents','removeAgents','Mail','Whatsapp','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','error','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','role','Teams','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x7d4f1c,_0x5b633a){var _0x45f7d9=function(_0x493067){while(--_0x493067){_0x7d4f1c['push'](_0x7d4f1c['shift']());}};_0x45f7d9(++_0x5b633a);}(_0x33fe,0x14f));var _0xe33f=function(_0x1699c1,_0x170443){_0x1699c1=_0x1699c1-0x0;var _0x427a73=_0x33fe[_0x1699c1];return _0x427a73;};'use strict';var emlformat=require(_0xe33f('0x0'));var rimraf=require(_0xe33f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe33f('0x2'));var moment=require('moment');var BPromise=require(_0xe33f('0x3'));var Mustache=require(_0xe33f('0x4'));var util=require(_0xe33f('0x5'));var path=require('path');var sox=require(_0xe33f('0x6'));var csv=require(_0xe33f('0x7'));var ejs=require(_0xe33f('0x8'));var fs=require('fs');var fs_extra=require(_0xe33f('0x9'));var _=require(_0xe33f('0xa'));var squel=require(_0xe33f('0xb'));var crypto=require('crypto');var jsforce=require(_0xe33f('0xc'));var deskjs=require(_0xe33f('0xd'));var toCsv=require(_0xe33f('0x7'));var querystring=require(_0xe33f('0xe'));var Papa=require(_0xe33f('0xf'));var Redis=require('ioredis');var authService=require(_0xe33f('0x10'));var qs=require(_0xe33f('0x11'));var as=require(_0xe33f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe33f('0x13'))(_0xe33f('0x14'));var utils=require('../../config/utils');var config=require(_0xe33f('0x15'));var licenseUtil=require(_0xe33f('0x16'));var db=require('../../mysqldb')['db'];config[_0xe33f('0x17')]=_[_0xe33f('0x18')](config['redis'],{'host':_0xe33f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe33f('0x17')]));require('./team.socket')[_0xe33f('0x1a')](socket);function respondWithStatusCode(_0x493d4d,_0x5c3608){_0x5c3608=_0x5c3608||0xcc;return function(_0x15a6f3){if(_0x15a6f3){return _0x493d4d[_0xe33f('0x1b')](_0x5c3608);}return _0x493d4d[_0xe33f('0x1c')](_0x5c3608)[_0xe33f('0x1d')]();};}function respondWithResult(_0x1dbe18,_0x5b2709){_0x5b2709=_0x5b2709||0xc8;return function(_0x3fbb9d){if(_0x3fbb9d){return _0x1dbe18[_0xe33f('0x1c')](_0x5b2709)[_0xe33f('0x1e')](_0x3fbb9d);}};}function respondWithFilteredResult(_0x1967dd,_0x352774){return function(_0x4aa834){if(_0x4aa834){var _0x133513=typeof _0x352774[_0xe33f('0x1f')]===_0xe33f('0x20')&&typeof _0x352774['limit']===_0xe33f('0x20');var _0x17935f=_0x4aa834[_0xe33f('0x21')];var _0xbd338=_0x133513?0x0:_0x352774[_0xe33f('0x1f')];var _0x321864=_0x133513?_0x4aa834['count']:_0x352774['offset']+_0x352774['limit'];var _0x54b39c;if(_0x321864>=_0x17935f){_0x321864=_0x17935f;_0x54b39c=0xc8;}else{_0x54b39c=0xce;}_0x1967dd[_0xe33f('0x1c')](_0x54b39c);return _0x1967dd[_0xe33f('0x22')](_0xe33f('0x23'),_0xbd338+'-'+_0x321864+'/'+_0x17935f)[_0xe33f('0x1e')](_0x4aa834);}return null;};}function patchUpdates(_0x1e8bc5){return function(_0x13d129){try{jsonpatch['apply'](_0x13d129,_0x1e8bc5,!![]);}catch(_0x2066e0){return BPromise[_0xe33f('0x24')](_0x2066e0);}return _0x13d129['save']();};}function saveUpdates(_0x584d8d,_0x29b8bd){return function(_0x314e02){if(_0x314e02){return _0x314e02[_0xe33f('0x25')](_0x584d8d)['then'](function(_0x5b4ce9){return _0x5b4ce9;});}return null;};}function handleEntityNotFound(_0x3a7198,_0x434dca){return function(_0x579b83){if(!_0x579b83){_0x3a7198['sendStatus'](0x194);}return _0x579b83;};}function handleError(_0x3e01d0,_0x38b980){_0x38b980=_0x38b980||0x1f4;return function(_0x38c583){logger[_0xe33f('0x26')](_0x38c583['stack']);if(_0x38c583['name']){delete _0x38c583[_0xe33f('0x27')];}_0x3e01d0[_0xe33f('0x1c')](_0x38b980)[_0xe33f('0x28')](_0x38c583);};}exports[_0xe33f('0x29')]=function(_0x21773a,_0x2bf4c3){var _0x2db16c={},_0xc99d1f={},_0x9d3515={'count':0x0,'rows':[]};var _0x406c24=_[_0xe33f('0x2a')](db[_0xe33f('0x2b')]['rawAttributes'],function(_0x4fa6ca){return{'name':_0x4fa6ca[_0xe33f('0x2c')],'type':_0x4fa6ca[_0xe33f('0x2d')][_0xe33f('0x2e')]};});_0xc99d1f[_0xe33f('0x2f')]=_[_0xe33f('0x2a')](_0x406c24,'name');_0xc99d1f[_0xe33f('0x30')]=_[_0xe33f('0x31')](_0x21773a[_0xe33f('0x30')]);_0xc99d1f[_0xe33f('0x32')]=_[_0xe33f('0x33')](_0xc99d1f['model'],_0xc99d1f['query']);_0x2db16c[_0xe33f('0x34')]=_[_0xe33f('0x33')](_0xc99d1f[_0xe33f('0x2f')],qs[_0xe33f('0x35')](_0x21773a[_0xe33f('0x30')][_0xe33f('0x35')]));_0x2db16c[_0xe33f('0x34')]=_0x2db16c['attributes'][_0xe33f('0x36')]?_0x2db16c[_0xe33f('0x34')]:_0xc99d1f[_0xe33f('0x2f')];if(!_0x21773a[_0xe33f('0x30')]['hasOwnProperty']('nolimit')){_0x2db16c[_0xe33f('0x37')]=qs['limit'](_0x21773a[_0xe33f('0x30')][_0xe33f('0x37')]);_0x2db16c[_0xe33f('0x1f')]=qs[_0xe33f('0x1f')](_0x21773a[_0xe33f('0x30')][_0xe33f('0x1f')]);}_0x2db16c['order']=qs[_0xe33f('0x38')](_0x21773a['query'][_0xe33f('0x38')]);_0x2db16c[_0xe33f('0x39')]=qs[_0xe33f('0x32')](_[_0xe33f('0x3a')](_0x21773a[_0xe33f('0x30')],_0xc99d1f[_0xe33f('0x32')]),_0x406c24);if(_0x21773a[_0xe33f('0x30')][_0xe33f('0x3b')]){_0x2db16c[_0xe33f('0x39')]=_[_0xe33f('0x3c')](_0x2db16c[_0xe33f('0x39')],{'$or':_['map'](_0x406c24,function(_0x9d0ad2){if(_0x9d0ad2[_0xe33f('0x2d')]!==_0xe33f('0x3d')){var _0x4fcaa6={};_0x4fcaa6[_0x9d0ad2[_0xe33f('0x27')]]={'$like':'%'+_0x21773a[_0xe33f('0x30')][_0xe33f('0x3b')]+'%'};return _0x4fcaa6;}})});}_0x2db16c=_[_0xe33f('0x3c')]({},_0x2db16c,_0x21773a[_0xe33f('0x3e')]);var _0x32f257={'where':_0x2db16c['where']};return db['Team'][_0xe33f('0x21')](_0x32f257)[_0xe33f('0x3f')](function(_0x59b7d7){_0x9d3515[_0xe33f('0x21')]=_0x59b7d7;if(_0x21773a['query']['includeAll']){_0x2db16c['include']=[{'all':!![]}];}return db['Team'][_0xe33f('0x40')](_0x2db16c);})['then'](function(_0x1415d1){_0x9d3515[_0xe33f('0x41')]=_0x1415d1;return _0x9d3515;})[_0xe33f('0x3f')](respondWithFilteredResult(_0x2bf4c3,_0x2db16c))['catch'](handleError(_0x2bf4c3,null));};exports[_0xe33f('0x42')]=function(_0x240b13,_0x319135){var _0x358e80={'raw':![],'where':{'id':_0x240b13['params']['id']}},_0x26512c={};_0x26512c[_0xe33f('0x2f')]=_[_0xe33f('0x31')](db[_0xe33f('0x2b')][_0xe33f('0x43')]);_0x26512c[_0xe33f('0x30')]=_['keys'](_0x240b13['query']);_0x26512c[_0xe33f('0x32')]=_['intersection'](_0x26512c[_0xe33f('0x2f')],_0x26512c['query']);_0x358e80[_0xe33f('0x34')]=_['intersection'](_0x26512c[_0xe33f('0x2f')],qs[_0xe33f('0x35')](_0x240b13['query'][_0xe33f('0x35')]));_0x358e80[_0xe33f('0x34')]=_0x358e80[_0xe33f('0x34')]['length']?_0x358e80[_0xe33f('0x34')]:_0x26512c[_0xe33f('0x2f')];if(_0x240b13[_0xe33f('0x30')][_0xe33f('0x44')]){_0x358e80['include']=[{'all':!![]}];}_0x358e80=_[_0xe33f('0x3c')]({},_0x358e80,_0x240b13['options']);return db[_0xe33f('0x2b')]['find'](_0x358e80)[_0xe33f('0x3f')](handleEntityNotFound(_0x319135,null))['then'](respondWithResult(_0x319135,null))[_0xe33f('0x45')](handleError(_0x319135,null));};exports[_0xe33f('0x46')]=function(_0x433d78,_0x10f568){return db[_0xe33f('0x2b')]['create'](_0x433d78[_0xe33f('0x47')],{})[_0xe33f('0x3f')](function(_0x3b367c){var _0x306db3=_0x433d78[_0xe33f('0x48')][_0xe33f('0x49')]({'plain':!![]});if(!_0x306db3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x306db3[_0xe33f('0x4a')]==='user'){var _0x156d0c=_0x3b367c[_0xe33f('0x49')]({'plain':!![]});var _0x445ee9=_0xe33f('0x4b');return db[_0xe33f('0x4c')][_0xe33f('0x4d')]({'where':{'name':_0x445ee9,'userProfileId':_0x306db3[_0xe33f('0x4e')]},'raw':!![]})['then'](function(_0x6ea2ee){if(_0x6ea2ee&&_0x6ea2ee['autoAssociation']===0x0){return db[_0xe33f('0x4f')][_0xe33f('0x46')]({'name':_0x156d0c[_0xe33f('0x27')],'resourceId':_0x156d0c['id'],'type':_0x6ea2ee[_0xe33f('0x27')],'sectionId':_0x6ea2ee['id']},{})['then'](function(){return _0x3b367c;});}else{return _0x3b367c;}})[_0xe33f('0x45')](function(_0x4ae909){logger[_0xe33f('0x26')](_0xe33f('0x50'),_0x4ae909);throw _0x4ae909;});}return _0x3b367c;})[_0xe33f('0x3f')](respondWithResult(_0x10f568,0xc9))[_0xe33f('0x45')](handleError(_0x10f568,null));};exports['update']=function(_0x159012,_0x36f76a){if(_0x159012[_0xe33f('0x47')]['id']){delete _0x159012['body']['id'];}return db[_0xe33f('0x2b')][_0xe33f('0x4d')]({'where':{'id':_0x159012[_0xe33f('0x51')]['id']}})[_0xe33f('0x3f')](handleEntityNotFound(_0x36f76a,null))[_0xe33f('0x3f')](saveUpdates(_0x159012[_0xe33f('0x47')],null))[_0xe33f('0x3f')](respondWithResult(_0x36f76a,null))[_0xe33f('0x45')](handleError(_0x36f76a,null));};exports[_0xe33f('0x52')]=function(_0x23c5e6,_0x1dc2f7){var _0x4394ac=_0x23c5e6[_0xe33f('0x51')]['id'];var _0x35f877=[];return db['sequelize'][_0xe33f('0x53')](function(_0xca12f8){var _0x16ae3c=_0xe33f('0x54')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x16ae3c,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8})[_0xe33f('0x3f')](function(_0x3e0cf8){_0x35f877=_[_0xe33f('0x2a')](_0x3e0cf8,function(_0x589eae){return Number(_0x589eae[_0xe33f('0x59')]);});})[_0xe33f('0x3f')](function(){var _0x37ab5a='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4394ac;return db['sequelize']['query'](_0x37ab5a,{'type':db[_0xe33f('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xca12f8});})['then'](function(_0x3c3474){var _0x42c9bd=_['map'](_0x3c3474,function(_0x1c6b42){return Number(_0x1c6b42[_0xe33f('0x5a')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x35f877},'VoiceQueueId':{'$in':_0x42c9bd}},'transaction':_0xca12f8});})['then'](function(){var _0x2f3a76=_0xe33f('0x5b')+_0x4394ac;return db['sequelize']['query'](_0x2f3a76,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')]['SELECT'],'raw':!![],'transaction':_0xca12f8});})['then'](function(_0xe60690){var _0x188cdc=_[_0xe33f('0x2a')](_0xe60690,function(_0x29ac75){return Number(_0x29ac75[_0xe33f('0x5c')]);});return db[_0xe33f('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x35f877},'MailQueueId':{'$in':_0x188cdc}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){var _0x25f850=_0xe33f('0x5e')+_0x4394ac;return db['sequelize'][_0xe33f('0x30')](_0x25f850,{'type':db['Sequelize'][_0xe33f('0x57')][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x3cc728){var _0x5cc375=_[_0xe33f('0x2a')](_0x3cc728,function(_0x593583){return Number(_0x593583['SmsQueueId']);});return db[_0xe33f('0x5f')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'SmsQueueId':{'$in':_0x5cc375}},'transaction':_0xca12f8});})['then'](function(){var _0x51b5a2=_0xe33f('0x60')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x51b5a2,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})['then'](function(_0x180501){var _0x5943fc=_[_0xe33f('0x2a')](_0x180501,function(_0xb2552b){return Number(_0xb2552b[_0xe33f('0x61')]);});return db[_0xe33f('0x62')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'ChatQueueId':{'$in':_0x5943fc}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){var _0x56adf7=_0xe33f('0x63')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x56adf7,{'type':db[_0xe33f('0x56')]['QueryTypes'][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x932101){var _0x3abb55=_[_0xe33f('0x2a')](_0x932101,function(_0x201e79){return Number(_0x201e79[_0xe33f('0x64')]);});return db[_0xe33f('0x65')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'FaxQueueId':{'$in':_0x3abb55}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){var _0x248a05=_0xe33f('0x66')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x248a05,{'type':db[_0xe33f('0x56')]['QueryTypes'][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x123867){var _0xa8589f=_[_0xe33f('0x2a')](_0x123867,function(_0x511756){return Number(_0x511756[_0xe33f('0x67')]);});return db[_0xe33f('0x68')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'OpenchannelQueueId':{'$in':_0xa8589f}},'transaction':_0xca12f8});})['then'](function(){var _0x6437cd=_0xe33f('0x69')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x6437cd,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')]['SELECT'],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x39ef87){var _0x251a34=_['map'](_0x39ef87,function(_0x1ec4c4){return Number(_0x1ec4c4[_0xe33f('0x6a')]);});return db['UserWhatsappQueue'][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'WhatsappQueueId':{'$in':_0x251a34}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){return db[_0xe33f('0x6b')]['find']({'where':{'TeamId':_0x4394ac}});})['then'](function(_0x2ea437){if(_0x2ea437===null){return;}return db[_0xe33f('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x35f877},'VoicePrefixId':_0x2ea437['VoicePrefixId']},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){return db[_0xe33f('0x2b')]['destroy']({'where':{'id':_0x4394ac},'cascade':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x45c0f0){if(_0x45c0f0===0x0){_0x1dc2f7[_0xe33f('0x1b')](0x194);}else{return db[_0xe33f('0x4f')][_0xe33f('0x52')]({'where':{'type':'Teams','resourceId':_0x4394ac},'cascade':!![],'transaction':_0xca12f8})[_0xe33f('0x3f')](function(){_0x1dc2f7['status'](0xcc)[_0xe33f('0x1d')]();});}})['catch'](function(_0x3652ba){_0x1dc2f7[_0xe33f('0x1c')](0x1f4)[_0xe33f('0x28')](_0x3652ba);});});};exports['getQueues']=function(_0x393f40,_0x12fb8b,_0x5e5e77){return db['Team']['findOne']({'where':{'id':_0x393f40[_0xe33f('0x51')]['id']}})['then'](handleEntityNotFound(_0x12fb8b,null))[_0xe33f('0x3f')](function(_0x31a4e0){if(!_0x393f40[_0xe33f('0x30')]['channel']||!utils[_0xe33f('0x6d')](_0x393f40[_0xe33f('0x30')][_0xe33f('0x6e')])){throw new db[(_0xe33f('0x56'))][(_0xe33f('0x6f'))](_0xe33f('0x70'));}var _0x15a435={};var _0x49a18b={};_0x49a18b[_0xe33f('0x2f')]=_[_0xe33f('0x31')](db[_['capitalize'](_0x393f40[_0xe33f('0x30')]['channel'][_0xe33f('0x71')]())+'Queue'][_0xe33f('0x43')]);_0x49a18b['query']=_[_0xe33f('0x31')](_0x393f40['query']);_0x49a18b['filters']=_['intersection'](_0x49a18b[_0xe33f('0x2f')],_0x49a18b[_0xe33f('0x30')]);_0x15a435[_0xe33f('0x34')]=_[_0xe33f('0x33')](_0x49a18b[_0xe33f('0x2f')],qs['fields'](_0x393f40[_0xe33f('0x30')][_0xe33f('0x35')]));_0x15a435[_0xe33f('0x34')]=_0x15a435[_0xe33f('0x34')][_0xe33f('0x36')]?_0x15a435['attributes']:_0x49a18b[_0xe33f('0x2f')];_0x15a435[_0xe33f('0x37')]=qs['limit'](_0x393f40['query'][_0xe33f('0x37')]);_0x15a435[_0xe33f('0x1f')]=qs[_0xe33f('0x1f')](_0x393f40[_0xe33f('0x30')][_0xe33f('0x1f')]);_0x15a435['order']=qs[_0xe33f('0x38')](_0x393f40[_0xe33f('0x30')][_0xe33f('0x38')]);_0x15a435['where']=qs['filters'](_[_0xe33f('0x3a')](_0x393f40[_0xe33f('0x30')],_0x49a18b[_0xe33f('0x32')]));_0x15a435=_[_0xe33f('0x3c')]({},_0x15a435,_0x393f40[_0xe33f('0x3e')]);return _0x31a4e0[_0xe33f('0x49')+_[_0xe33f('0x72')](_0x393f40[_0xe33f('0x30')]['channel'][_0xe33f('0x71')]())+_0xe33f('0x73')](_0x15a435);})['then'](respondWithResult(_0x12fb8b,null))[_0xe33f('0x45')](handleError(_0x12fb8b,null));};exports[_0xe33f('0x74')]=function(_0x5e515e,_0x270381,_0x373390){return db[_0xe33f('0x2b')][_0xe33f('0x75')]({'where':{'id':_0x5e515e[_0xe33f('0x51')]['id']}})[_0xe33f('0x3f')](function(_0x1832f9){if(_0x1832f9){if(!_0x5e515e[_0xe33f('0x47')][_0xe33f('0x6e')]||!utils['isValidChannel'](_0x5e515e['body']['channel'])){throw new db['Sequelize'][(_0xe33f('0x6f'))](_0xe33f('0x70'));}return _0x1832f9[_0xe33f('0x76')+_['capitalize'](_0x5e515e['body'][_0xe33f('0x6e')][_0xe33f('0x71')]())+_0xe33f('0x73')](_0x5e515e[_0xe33f('0x47')][_0xe33f('0x77')]);}return null;})[_0xe33f('0x3f')](handleEntityNotFound(_0x270381,null))['then'](respondWithStatusCode(_0x270381,null))[_0xe33f('0x45')](handleError(_0x270381,null));};exports[_0xe33f('0x78')]=function(_0x8c94b7,_0x2f9f9a,_0x25bae3){return db[_0xe33f('0x2b')][_0xe33f('0x75')]({'where':{'id':_0x8c94b7['params']['id']}})[_0xe33f('0x3f')](function(_0x497b8e){if(_0x497b8e){if(!_0x8c94b7[_0xe33f('0x30')]['channel']||!utils[_0xe33f('0x6d')](_0x8c94b7[_0xe33f('0x30')][_0xe33f('0x6e')])){throw new db[(_0xe33f('0x56'))][(_0xe33f('0x6f'))]('Unknown\x20channel');}return _0x497b8e['remove'+_[_0xe33f('0x72')](_0x8c94b7[_0xe33f('0x30')][_0xe33f('0x6e')]['toLowerCase']())+'Queues'](_0x8c94b7['query'][_0xe33f('0x77')]);}return null;})[_0xe33f('0x3f')](handleEntityNotFound(_0x2f9f9a,null))['then'](respondWithStatusCode(_0x2f9f9a,null))[_0xe33f('0x45')](handleError(_0x2f9f9a,null));};exports['addAgents']=function(_0x2286dc,_0x4f2765){var _0x57ccb1=_['isArray'](_0x2286dc[_0xe33f('0x47')][_0xe33f('0x77')])?_0x2286dc['body'][_0xe33f('0x77')]:[_0x2286dc[_0xe33f('0x47')]['ids']];var _0x34fe92=_0x2286dc[_0xe33f('0x51')]['id'];return db[_0xe33f('0x2b')][_0xe33f('0x4d')]({'where':{'id':_0x34fe92}})['then'](handleEntityNotFound(_0x4f2765,null))[_0xe33f('0x3f')](function(_0x1a4f57){if(_0x1a4f57){var _0x1939ec=[_0xe33f('0x79'),_0xe33f('0x7a'),'Mail',_0xe33f('0x7b'),_0xe33f('0x7c'),_0xe33f('0x7d'),'Whatsapp'];return db[_0xe33f('0x55')][_0xe33f('0x53')](function(_0x206b71){var _0x32f3e3=_[_0xe33f('0x2a')](_0x1939ec,function(_0x4e1757){var _0x289068={'attributes':['id',_0xe33f('0x27')]};if(_0x4e1757===_0xe33f('0x79')){_0x289068[_0xe33f('0x7e')]={'attributes':['penalty']};}return _0x1a4f57['get'+_0x4e1757+'Queues'](_0x289068)[_0xe33f('0x3f')](function(_0x13f83f){var _0xdac234=_[_0xe33f('0x2a')](_0x13f83f,function(_0x550c80){var _0x3ee48c=_[_0xe33f('0x2a')](_0x57ccb1,function(_0x4076d0){var _0xb274a3={'where':{'UserId':_0x4076d0,[_0x4e1757+_0xe33f('0x7f')]:_0x550c80['id']},'transaction':_0x206b71};if(_0x4e1757===_0xe33f('0x79')){_0xb274a3['defaults']={'penalty':_0x550c80['TeamVoiceQueue'][_0xe33f('0x80')]};}return db[_0xe33f('0x81')+_0x4e1757+'Queue'][_0xe33f('0x82')](_0xb274a3)['then'](function(){socket[_0xe33f('0x83')](_0xe33f('0x48')+_0x4e1757+_0xe33f('0x84'),{'UserId':_0x4076d0,[_0x4e1757+_0xe33f('0x7f')]:_0x550c80['id']});if(_0x4e1757!==_0xe33f('0x79')){return;}return db[_0xe33f('0x81')][_0xe33f('0x40')]({'where':{'id':_0x57ccb1,'online':0x1},'attributes':['id',_0xe33f('0x27'),'online',_0xe33f('0x85'),'interface'],'raw':!![]})[_0xe33f('0x3f')](function(_0x4e5eaa){var _0x236a56=_[_0xe33f('0x2a')](_0x4e5eaa,function(_0x4d8efd){return db[_0xe33f('0x86')]['upsert']({'membername':_0x4d8efd[_0xe33f('0x27')],'UserId':_0x4d8efd['id'],'queue_name':_0x550c80[_0xe33f('0x27')],'VoiceQueueId':_0x550c80['id'],'interface':_[_0xe33f('0x87')](_0x4d8efd[_0xe33f('0x88')])?util['format']('SIP/%s',_0x4d8efd[_0xe33f('0x27')]):_0x4d8efd[_0xe33f('0x88')],'paused':_0x4d8efd['voicePause']||![],'penalty':_0x550c80[_0xe33f('0x89')][_0xe33f('0x80')]},{'transaction':_0x206b71});});return Promise[_0xe33f('0x8a')](_0x236a56);});});});return Promise['all'](_0x3ee48c);});return Promise['all'](_0xdac234);})['then'](function(){return db[_0xe33f('0x6b')][_0xe33f('0x75')]({'where':{'teamId':_0x34fe92}})[_0xe33f('0x3f')](function(_0x1cef3a){if(_0x1cef3a){var _0x2f5725=_['map'](_0x57ccb1,function(_0x18cb4d){db[_0xe33f('0x6c')]['upsert']({'UserId':_0x18cb4d,'VoicePrefixId':_0x1cef3a[_0xe33f('0x8b')]});});return Promise[_0xe33f('0x8a')](_0x2f5725);}});});});return Promise[_0xe33f('0x8a')](_0x32f3e3)[_0xe33f('0x3f')](function(){return _0x1a4f57[_0xe33f('0x8c')](_0x57ccb1,{'transaction':_0x206b71})['spread'](function(_0x13ab5e){return _0x13ab5e;});});});}})[_0xe33f('0x3f')](respondWithResult(_0x4f2765,null))[_0xe33f('0x45')](handleError(_0x4f2765,null));};exports[_0xe33f('0x8d')]=function(_0x108f0c,_0x5d041e){var _0x133ff0=_['isArray'](_0x108f0c['query'][_0xe33f('0x77')])?_0x108f0c[_0xe33f('0x30')]['ids']:[_0x108f0c[_0xe33f('0x30')][_0xe33f('0x77')]];var _0xab9512=_0x108f0c[_0xe33f('0x51')]['id'];return db[_0xe33f('0x2b')]['find']({'where':{'id':_0xab9512}})[_0xe33f('0x3f')](handleEntityNotFound(_0x5d041e,null))[_0xe33f('0x3f')](function(_0x319234){if(_0x319234){var _0x18c59b=[_0xe33f('0x79'),_0xe33f('0x7a'),_0xe33f('0x8e'),'Sms',_0xe33f('0x7c'),_0xe33f('0x7d'),_0xe33f('0x8f')];return db[_0xe33f('0x55')][_0xe33f('0x53')](function(_0x4795f1){var _0x21cba8=_[_0xe33f('0x2a')](_0x18c59b,function(_0x448352){var _0x39dc18={'attributes':['id',_0xe33f('0x27')]};return _0x319234[_0xe33f('0x49')+_0x448352+_0xe33f('0x73')](_0x39dc18)[_0xe33f('0x3f')](function(_0x1c1c76){var _0xaccf94=_[_0xe33f('0x2a')](_0x1c1c76,function(_0x46cfdc){return _0x46cfdc[_0xe33f('0x8d')](_0x133ff0,{'transaction':_0x4795f1})[_0xe33f('0x3f')](function(){var _0x3da5b8=_[_0xe33f('0x2a')](_0x133ff0,function(_0x2378de){socket[_0xe33f('0x83')]('user'+_0x448352+'Queue:remove',{'UserId':Number(_0x2378de),[_0x448352+_0xe33f('0x7f')]:_0x46cfdc['id']});if(_0x448352!=='Voice'){return;}return db[_0xe33f('0x86')]['destroy']({'where':{'VoiceQueueId':_0x46cfdc['id'],'UserId':_0x2378de},'transaction':_0x4795f1});});return Promise[_0xe33f('0x8a')](_0x3da5b8);});});return Promise[_0xe33f('0x8a')](_0xaccf94);});});return Promise[_0xe33f('0x8a')](_0x21cba8)[_0xe33f('0x3f')](function(){return _0x319234[_0xe33f('0x8d')](_0x133ff0,{'transaction':_0x4795f1});})[_0xe33f('0x3f')](function(){return db[_0xe33f('0x6b')][_0xe33f('0x75')]({'where':{'teamId':_0xab9512}})[_0xe33f('0x3f')](function(_0x1cd64e){if(_0x1cd64e){var _0x393349=_[_0xe33f('0x2a')](_0x133ff0,function(_0x4661a8){db[_0xe33f('0x6c')][_0xe33f('0x52')]({'where':{'UserId':_0x4661a8,'VoicePrefixId':_0x1cd64e[_0xe33f('0x8b')]}});});return Promise[_0xe33f('0x8a')](_0x393349);}});});});}})[_0xe33f('0x3f')](respondWithStatusCode(_0x5d041e,null))[_0xe33f('0x45')](handleError(_0x5d041e,null));};exports[_0xe33f('0x90')]=function(_0x56f57a,_0x2c32c4,_0x58b1a4){var _0x330cec={};var _0x259f4d={};var _0xa72571;var _0x5df74a;return db[_0xe33f('0x2b')][_0xe33f('0x75')]({'where':{'id':_0x56f57a[_0xe33f('0x51')]['id']}})[_0xe33f('0x3f')](handleEntityNotFound(_0x2c32c4,null))[_0xe33f('0x3f')](function(_0x26a8b8){if(_0x26a8b8){_0xa72571=_0x26a8b8;_0x259f4d[_0xe33f('0x2f')]=_[_0xe33f('0x31')](db['User'][_0xe33f('0x43')]);_0x259f4d[_0xe33f('0x30')]=_[_0xe33f('0x31')](_0x56f57a[_0xe33f('0x30')]);_0x259f4d[_0xe33f('0x32')]=_[_0xe33f('0x33')](_0x259f4d[_0xe33f('0x2f')],_0x259f4d[_0xe33f('0x30')]);_0x330cec['attributes']=_['intersection'](_0x259f4d[_0xe33f('0x2f')],qs[_0xe33f('0x35')](_0x56f57a[_0xe33f('0x30')][_0xe33f('0x35')]));_0x330cec['attributes']=_0x330cec[_0xe33f('0x34')][_0xe33f('0x36')]?_0x330cec[_0xe33f('0x34')]:_0x259f4d[_0xe33f('0x2f')];_0x330cec['order']=qs[_0xe33f('0x38')](_0x56f57a[_0xe33f('0x30')][_0xe33f('0x38')]);_0x330cec['where']=qs[_0xe33f('0x32')](_[_0xe33f('0x3a')](_0x56f57a['query'],_0x259f4d[_0xe33f('0x32')]));if(_0x56f57a['query'][_0xe33f('0x3b')]){_0x330cec[_0xe33f('0x39')]=_[_0xe33f('0x3c')](_0x330cec[_0xe33f('0x39')],{'$or':_[_0xe33f('0x2a')](_0x330cec[_0xe33f('0x34')],function(_0x29b417){var _0x370bc0={};_0x370bc0[_0x29b417]={'$like':'%'+_0x56f57a[_0xe33f('0x30')][_0xe33f('0x3b')]+'%'};return _0x370bc0;})});}_0x330cec=_[_0xe33f('0x3c')]({},_0x330cec,_0x56f57a['options']);return _0xa72571[_0xe33f('0x90')](_0x330cec);}})['then'](function(_0x3cd642){if(_0x3cd642){_0x5df74a=_0x3cd642[_0xe33f('0x36')];if(!_0x56f57a[_0xe33f('0x30')][_0xe33f('0x91')](_0xe33f('0x92'))){_0x330cec['limit']=qs[_0xe33f('0x37')](_0x56f57a[_0xe33f('0x30')]['limit']);_0x330cec[_0xe33f('0x1f')]=qs['offset'](_0x56f57a['query'][_0xe33f('0x1f')]);}return _0xa72571[_0xe33f('0x90')](_0x330cec);}})['then'](function(_0xe27065){if(_0xe27065){return _0xe27065?{'count':_0x5df74a,'rows':_0xe27065}:null;}})[_0xe33f('0x3f')](respondWithResult(_0x2c32c4,null))[_0xe33f('0x45')](handleError(_0x2c32c4,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f0e0250..2faf7e1 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 _0xc6a4=['setMaxListeners','save','emit','hasOwnProperty','exports','Team'];(function(_0x291355,_0x453377){var _0x1e389a=function(_0x404c7e){while(--_0x404c7e){_0x291355['push'](_0x291355['shift']());}};_0x1e389a(++_0x453377);}(_0xc6a4,0x173));var _0x4c6a=function(_0x3486dd,_0x14cc41){_0x3486dd=_0x3486dd-0x0;var _0x1ab27b=_0xc6a4[_0x3486dd];return _0x1ab27b;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x4c6a('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x4c6a('0x1')](0x0);var events={'afterCreate':_0x4c6a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5d0d78){return function(_0x41a73b,_0x23aa14,_0x36040e){TeamEvents[_0x4c6a('0x3')](_0x5d0d78+':'+_0x41a73b['id'],_0x41a73b);TeamEvents[_0x4c6a('0x3')](_0x5d0d78,_0x41a73b);_0x36040e(null);};}for(var e in events){if(events[_0x4c6a('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x4c6a('0x5')]=TeamEvents; \ No newline at end of file +var _0xd98b=['remove','emit','hasOwnProperty','exports','events','Team','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd98b,0x14c));var _0xbd98=function(_0x39b07e,_0x33b057){_0x39b07e=_0x39b07e-0x0;var _0x591dae=_0xd98b[_0x39b07e];return _0x591dae;};'use strict';var EventEmitter=require(_0xbd98('0x0'));var Team=require('../../mysqldb')['db'][_0xbd98('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd98('0x2'),'afterUpdate':_0xbd98('0x3'),'afterDestroy':_0xbd98('0x4')};function emitEvent(_0x2b532f){return function(_0x13a30d,_0xb2b2b7,_0x1de353){TeamEvents['emit'](_0x2b532f+':'+_0x13a30d['id'],_0x13a30d);TeamEvents[_0xbd98('0x5')](_0x2b532f,_0x13a30d);_0x1de353(null);};}for(var e in events){if(events[_0xbd98('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xbd98('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 a8adf8b..43b610f 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 _0x9d3e=['Openchannel','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports','define','Chat','Fax'];(function(_0x4e7b20,_0x2934e8){var _0x1e16d4=function(_0x515aab){while(--_0x515aab){_0x4e7b20['push'](_0x4e7b20['shift']());}};_0x1e16d4(++_0x2934e8);}(_0x9d3e,0xc4));var _0xe9d3=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x9d3e[_0x27bcf5];return _0x4ce4cf;};'use strict';var _=require(_0xe9d3('0x0'));var attributes=require(_0xe9d3('0x1'));function getQueuesByChannel(_0x116bdb,_0x148d80){var _0x2b1b92=_0xe9d3('0x2')+_0x148d80+_0xe9d3('0x3');return _0x116bdb[_0x2b1b92]()[_0xe9d3('0x4')](function(_0x284525){return _[_0xe9d3('0x5')](_0x284525,function(_0x98cf48){_0x98cf48[_0xe9d3('0x6')]('channel',_0x148d80);return _0x98cf48;});})[_0xe9d3('0x7')](function(_0x522be9){throw _0x522be9;});}module[_0xe9d3('0x8')]=function(_0x420aa6){return _0x420aa6[_0xe9d3('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4f15c5=this;var _0xda442f=[_0xe9d3('0xa'),_0xe9d3('0xb'),'Mail',_0xe9d3('0xc'),'Sms',_0xe9d3('0xd'),_0xe9d3('0xe')];return Promise['resolve']()['then'](function(){var _0xebd0a5=_[_0xe9d3('0x5')](_0xda442f,function(_0x462253){return getQueuesByChannel(_0x4f15c5,_0x462253);});return Promise[_0xe9d3('0xf')](_0xebd0a5);})[_0xe9d3('0x7')](function(_0x241792){throw _0x241792;});}}});}; \ No newline at end of file +var _0xccd4=['teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','./team.attributes','Queues','then','map','setDataValue','catch','exports','define'];(function(_0x5c683b,_0x2f913e){var _0x4da8f1=function(_0x1b130f){while(--_0x1b130f){_0x5c683b['push'](_0x5c683b['shift']());}};_0x4da8f1(++_0x2f913e);}(_0xccd4,0x119));var _0x4ccd=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xccd4[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var attributes=require(_0x4ccd('0x0'));function getQueuesByChannel(_0x47d25a,_0x593df2){var _0x5d7eac='get'+_0x593df2+_0x4ccd('0x1');return _0x47d25a[_0x5d7eac]()[_0x4ccd('0x2')](function(_0x4a7bae){return _[_0x4ccd('0x3')](_0x4a7bae,function(_0x40bdeb){_0x40bdeb[_0x4ccd('0x4')]('channel',_0x593df2);return _0x40bdeb;});})[_0x4ccd('0x5')](function(_0x16e899){throw _0x16e899;});}module[_0x4ccd('0x6')]=function(_0x594fe4){return _0x594fe4[_0x4ccd('0x7')]('Team',attributes,{'tableName':_0x4ccd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x54d1eb=this;var _0x4a6c2e=[_0x4ccd('0x9'),_0x4ccd('0xa'),_0x4ccd('0xb'),_0x4ccd('0xc'),_0x4ccd('0xd'),_0x4ccd('0xe'),'Whatsapp'];return Promise[_0x4ccd('0xf')]()[_0x4ccd('0x2')](function(){var _0x34a1e7=_['map'](_0x4a6c2e,function(_0x263705){return getQueuesByChannel(_0x54d1eb,_0x263705);});return Promise[_0x4ccd('0x10')](_0x34a1e7);})[_0x4ccd('0x5')](function(_0x5ddd71){throw _0x5ddd71;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3d8b942..8d38059 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 _0x36a7=['./team.socket','register','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','localhost','redis'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x36a7,0x182));var _0x736a=function(_0x2f7d3d,_0x2d821e){_0x2f7d3d=_0x2f7d3d-0x0;var _0x102553=_0x36a7[_0x2f7d3d];return _0x102553;};'use strict';var _=require(_0x736a('0x0'));var util=require(_0x736a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x736a('0x2'));var fs=require('fs');var Redis=require(_0x736a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x736a('0x4'));var logger=require('../../config/logger')(_0x736a('0x5'));var config=require('../../config/environment');var jayson=require(_0x736a('0x6'));var client=jayson[_0x736a('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x736a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x736a('0x9')]));require(_0x736a('0xa'))[_0x736a('0xb')](socket);function respondWithRpcPromise(_0x15f44f,_0x253a87,_0x438c26){return new BPromise(function(_0x2287af,_0x9863e1){return client[_0x736a('0xc')](_0x15f44f,_0x438c26)['then'](function(_0x32688c){logger['info'](_0x736a('0xd'),_0x253a87,_0x736a('0xe'));logger[_0x736a('0xf')](_0x736a('0x10'),_0x253a87,_0x736a('0xe'),JSON[_0x736a('0x11')](_0x32688c));if(_0x32688c[_0x736a('0x12')]){if(_0x32688c[_0x736a('0x12')][_0x736a('0x13')]===0x1f4){logger[_0x736a('0x12')](_0x736a('0xd'),_0x253a87,_0x32688c[_0x736a('0x12')][_0x736a('0x14')]);return _0x9863e1(_0x32688c[_0x736a('0x12')][_0x736a('0x14')]);}logger[_0x736a('0x12')](_0x736a('0xd'),_0x253a87,_0x32688c[_0x736a('0x12')][_0x736a('0x14')]);return _0x2287af(_0x32688c[_0x736a('0x12')][_0x736a('0x14')]);}else{logger[_0x736a('0x15')](_0x736a('0xd'),_0x253a87,'request\x20sent');_0x2287af(_0x32688c['result']['message']);}})['catch'](function(_0x48f1a3){logger[_0x736a('0x12')]('Team,\x20%s,\x20%s',_0x253a87,_0x48f1a3);_0x9863e1(_0x48f1a3);});});} \ No newline at end of file +var _0xdc56=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdc56,0x18a));var _0x6dc5=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xdc56[_0x37cc52];return _0x2b4a90;};'use strict';var _=require('lodash');var util=require(_0x6dc5('0x0'));var moment=require(_0x6dc5('0x1'));var BPromise=require(_0x6dc5('0x2'));var rs=require(_0x6dc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dc5('0x5'))(_0x6dc5('0x6'));var config=require(_0x6dc5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6dc5('0x8')][_0x6dc5('0x9')]({'port':0x232a});config[_0x6dc5('0xa')]=_[_0x6dc5('0xb')](config[_0x6dc5('0xa')],{'host':_0x6dc5('0xc'),'port':0x18eb});var socket=require(_0x6dc5('0xd'))(new Redis(config[_0x6dc5('0xa')]));require('./team.socket')[_0x6dc5('0xe')](socket);function respondWithRpcPromise(_0x23ec10,_0x123bbb,_0x1ce619){return new BPromise(function(_0x102ac9,_0x32b829){return client[_0x6dc5('0xf')](_0x23ec10,_0x1ce619)[_0x6dc5('0x10')](function(_0x2a0c94){logger[_0x6dc5('0x11')](_0x6dc5('0x12'),_0x123bbb,_0x6dc5('0x13'));logger[_0x6dc5('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x123bbb,_0x6dc5('0x13'),JSON[_0x6dc5('0x15')](_0x2a0c94));if(_0x2a0c94[_0x6dc5('0x16')]){if(_0x2a0c94['error']['code']===0x1f4){logger['error'](_0x6dc5('0x12'),_0x123bbb,_0x2a0c94[_0x6dc5('0x16')][_0x6dc5('0x17')]);return _0x32b829(_0x2a0c94['error']['message']);}logger[_0x6dc5('0x16')](_0x6dc5('0x12'),_0x123bbb,_0x2a0c94[_0x6dc5('0x16')][_0x6dc5('0x17')]);return _0x102ac9(_0x2a0c94[_0x6dc5('0x16')][_0x6dc5('0x17')]);}else{logger[_0x6dc5('0x11')](_0x6dc5('0x12'),_0x123bbb,_0x6dc5('0x13'));_0x102ac9(_0x2a0c94[_0x6dc5('0x18')][_0x6dc5('0x17')]);}})['catch'](function(_0x57a2bc){logger[_0x6dc5('0x16')](_0x6dc5('0x12'),_0x123bbb,_0x57a2bc);_0x32b829(_0x57a2bc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bbc5bfd..5dd50d8 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 _0x4014=['save','remove','emit','register','team:','./team.events'];(function(_0x2886e2,_0x95fe23){var _0x267ec6=function(_0x539da4){while(--_0x539da4){_0x2886e2['push'](_0x2886e2['shift']());}};_0x267ec6(++_0x95fe23);}(_0x4014,0x1b5));var _0x4401=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x4014[_0x47a349];return _0x18ab75;};'use strict';var TeamEvents=require(_0x4401('0x0'));var events=[_0x4401('0x1'),_0x4401('0x2'),'update'];function createListener(_0x2fa854,_0x2dab1f){return function(_0x381bc3){_0x2dab1f[_0x4401('0x3')](_0x2fa854,_0x381bc3);};}function removeListener(_0x2a9328,_0x422550){return function(){TeamEvents['removeListener'](_0x2a9328,_0x422550);};}exports[_0x4401('0x4')]=function(_0x4efc82){for(var _0xa4d54e=0x0,_0x213318=events['length'];_0xa4d54e<_0x213318;_0xa4d54e++){var _0x72929d=events[_0xa4d54e];var _0x57e151=createListener(_0x4401('0x5')+_0x72929d,_0x4efc82);TeamEvents['on'](_0x72929d,_0x57e151);}}; \ No newline at end of file +var _0x4ba0=['remove','emit','length','team:','./team.events'];(function(_0x1e7bdd,_0x216b81){var _0xcd343d=function(_0x5203cd){while(--_0x5203cd){_0x1e7bdd['push'](_0x1e7bdd['shift']());}};_0xcd343d(++_0x216b81);}(_0x4ba0,0xe0));var _0x04ba=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4ba0[_0x1deb03];return _0x189fe7;};'use strict';var TeamEvents=require(_0x04ba('0x0'));var events=['save',_0x04ba('0x1'),'update'];function createListener(_0x2353a5,_0x1cf1e2){return function(_0x133126){_0x1cf1e2[_0x04ba('0x2')](_0x2353a5,_0x133126);};}function removeListener(_0x5c87c2,_0x438657){return function(){TeamEvents['removeListener'](_0x5c87c2,_0x438657);};}exports['register']=function(_0x17959f){for(var _0x5b7994=0x0,_0x1ae533=events[_0x04ba('0x3')];_0x5b7994<_0x1ae533;_0x5b7994++){var _0x1e9dc8=events[_0x5b7994];var _0x37821a=createListener(_0x04ba('0x4')+_0x1e9dc8,_0x17959f);TeamEvents['on'](_0x1e9dc8,_0x37821a);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index baf6816..39ecf5a 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 _0x5cd8=['sequelize','INTEGER'];(function(_0x5e5222,_0x2af94d){var _0xdf673d=function(_0x3ec827){while(--_0x3ec827){_0x5e5222['push'](_0x5e5222['shift']());}};_0xdf673d(++_0x2af94d);}(_0x5cd8,0x1d2));var _0x85cd=function(_0xaee35f,_0x1ca790){_0xaee35f=_0xaee35f-0x0;var _0x3454fc=_0x5cd8[_0xaee35f];return _0x3454fc;};'use strict';var Sequelize=require(_0x85cd('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x85cd('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x85cd('0x1')]}}; \ No newline at end of file +var _0x8f37=['INTEGER','sequelize','exports'];(function(_0x156cfe,_0x26e5a4){var _0x58f776=function(_0x28950f){while(--_0x28950f){_0x156cfe['push'](_0x156cfe['shift']());}};_0x58f776(++_0x26e5a4);}(_0x8f37,0x190));var _0x78f3=function(_0xf4e004,_0x46b454){_0xf4e004=_0xf4e004-0x0;var _0x3b0b33=_0x8f37[_0xf4e004];return _0x3b0b33;};'use strict';var Sequelize=require(_0x78f3('0x0'));module[_0x78f3('0x1')]={'TeamId':{'type':Sequelize[_0x78f3('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f5252f2..81cb9fa 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 _0x7fce=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x7fce,0xdc));var _0xe7fc=function(_0x291141,_0x43f163){_0x291141=_0x291141-0x0;var _0x439aec=_0x7fce[_0x291141];return _0x439aec;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var logger=require(_0xe7fc('0x2'))('api');var moment=require(_0xe7fc('0x3'));var BPromise=require('bluebird');var rp=require(_0xe7fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x223d07,_0x51c63b){return _0x223d07[_0xe7fc('0x7')](_0xe7fc('0x8'),attributes,{'tableName':_0xe7fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9861=['TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x9861,0x176));var _0x1986=function(_0x57d879,_0x244e47){_0x57d879=_0x57d879-0x0;var _0x5b686c=_0x9861[_0x57d879];return _0x5b686c;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1c42fdf..6761a87 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xbe4549,_0x44fb56){var _0x407fe6=function(_0x517835){while(--_0x517835){_0xbe4549['push'](_0xbe4549['shift']());}};_0x407fe6(++_0x44fb56);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb91[_0x58547b];return _0x1d3fd2;};'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(_0x3efa54,_0x1be78d){var _0x59407f=function(_0x2f15e4){while(--_0x2f15e4){_0x3efa54['push'](_0x3efa54['shift']());}};_0x59407f(++_0x1be78d);}(_0x70e0,0x17b));var _0x070e=function(_0xd22ddf,_0x3aceeb){_0xd22ddf=_0xd22ddf-0x0;var _0x20ec6d=_0x70e0[_0xd22ddf];return _0x20ec6d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 44072c5..56689be 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 _0x14ef=['sequelize','exports'];(function(_0x1f0c9e,_0x387f50){var _0x4ba930=function(_0x50645e){while(--_0x50645e){_0x1f0c9e['push'](_0x1f0c9e['shift']());}};_0x4ba930(++_0x387f50);}(_0x14ef,0xf8));var _0xf14e=function(_0x53e297,_0x53189b){_0x53e297=_0x53e297-0x0;var _0x4380ff=_0x14ef[_0x53e297];return _0x4380ff;};'use strict';var Sequelize=require(_0xf14e('0x0'));module[_0xf14e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x54b4=['exports','INTEGER'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x54b4,0x132));var _0x454b=function(_0x54ac01,_0x1db85c){_0x54ac01=_0x54ac01-0x0;var _0x3784fd=_0x54b4[_0x54ac01];return _0x3784fd;};'use strict';var Sequelize=require('sequelize');module[_0x454b('0x0')]={'penalty':{'type':Sequelize[_0x454b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 1b1bc97..2724f1f 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 _0xff96=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5632b8,_0x2b5f85){var _0x5373e1=function(_0x375ccb){while(--_0x375ccb){_0x5632b8['push'](_0x5632b8['shift']());}};_0x5373e1(++_0x2b5f85);}(_0xff96,0x179));var _0x6ff9=function(_0x198fc6,_0x5eaee9){_0x198fc6=_0x198fc6-0x0;var _0x4376bb=_0xff96[_0x198fc6];return _0x4376bb;};'use strict';var _=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var logger=require(_0x6ff9('0x2'))(_0x6ff9('0x3'));var moment=require(_0x6ff9('0x4'));var BPromise=require(_0x6ff9('0x5'));var rp=require(_0x6ff9('0x6'));var fs=require('fs');var path=require(_0x6ff9('0x7'));var rimraf=require(_0x6ff9('0x8'));var config=require(_0x6ff9('0x9'));var attributes=require(_0x6ff9('0xa'));module[_0x6ff9('0xb')]=function(_0x4adb77,_0x3efaff){return _0x4adb77['define']('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d8=['../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x5aaef7,_0x16da8d){var _0x57f857=function(_0x479ff1){while(--_0x479ff1){_0x5aaef7['push'](_0x5aaef7['shift']());}};_0x57f857(++_0x16da8d);}(_0x79d8,0x67));var _0x879d=function(_0x1a4537,_0x4d0be5){_0x1a4537=_0x1a4537-0x0;var _0x377e3c=_0x79d8[_0x1a4537];return _0x377e3c;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var logger=require(_0x879d('0x2'))(_0x879d('0x3'));var moment=require('moment');var BPromise=require(_0x879d('0x4'));var rp=require(_0x879d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x879d('0x6'));var config=require(_0x879d('0x7'));var attributes=require(_0x879d('0x8'));module['exports']=function(_0x2d578e,_0x46ed21){return _0x2d578e[_0x879d('0x9')](_0x879d('0xa'),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 9ea46ed..d5ba883 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 _0xf9fd=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x327160,_0x23077b){var _0x5b11da=function(_0x43a05){while(--_0x43a05){_0x327160['push'](_0x327160['shift']());}};_0x5b11da(++_0x23077b);}(_0xf9fd,0x118));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf9f('0x3'));var fs=require('fs');var Redis=require(_0xdf9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf9f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdf9f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdf9f('0x7')][_0xdf9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x482a4c,_0xaa634a,_0x2a0de2){return new BPromise(function(_0x5ed355,_0x2540cc){return client[_0xdf9f('0x9')](_0x482a4c,_0x2a0de2)['then'](function(_0x135ad5){logger[_0xdf9f('0xa')](_0xdf9f('0xb'),_0xaa634a,'request\x20sent');logger[_0xdf9f('0xc')](_0xdf9f('0xd'),_0xaa634a,_0xdf9f('0xe'),JSON[_0xdf9f('0xf')](_0x135ad5));if(_0x135ad5[_0xdf9f('0x10')]){if(_0x135ad5[_0xdf9f('0x10')][_0xdf9f('0x11')]===0x1f4){logger[_0xdf9f('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0xaa634a,_0x135ad5[_0xdf9f('0x10')]['message']);return _0x2540cc(_0x135ad5[_0xdf9f('0x10')][_0xdf9f('0x12')]);}logger[_0xdf9f('0x10')](_0xdf9f('0xb'),_0xaa634a,_0x135ad5[_0xdf9f('0x10')][_0xdf9f('0x12')]);return _0x5ed355(_0x135ad5[_0xdf9f('0x10')]['message']);}else{logger[_0xdf9f('0xa')](_0xdf9f('0xb'),_0xaa634a,_0xdf9f('0xe'));_0x5ed355(_0x135ad5[_0xdf9f('0x13')]['message']);}})[_0xdf9f('0x14')](function(_0x4885d4){logger[_0xdf9f('0x10')](_0xdf9f('0xb'),_0xaa634a,_0x4885d4);_0x2540cc(_0x4885d4);});});} \ No newline at end of file +var _0x5636=['code','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5636,0x102));var _0x6563=function(_0x1f3570,_0x1cf0a1){_0x1f3570=_0x1f3570-0x0;var _0x39d4cd=_0x5636[_0x1f3570];return _0x39d4cd;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d9ae08c..f1d5ca4 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 _0x39d2=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x39d2,0xf5));var _0x239d=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x39d2[_0x3b19ea];return _0x40ece9;};'use strict';var multer=require(_0x239d('0x0'));var util=require('util');var path=require(_0x239d('0x1'));var timeout=require(_0x239d('0x2'));var express=require(_0x239d('0x3'));var router=express[_0x239d('0x4')]();var fs_extra=require(_0x239d('0x5'));var auth=require(_0x239d('0x6'));var interaction=require(_0x239d('0x7'));var config=require(_0x239d('0x8'));var controller=require(_0x239d('0x9'));router[_0x239d('0xa')]('/',auth[_0x239d('0xb')](),controller[_0x239d('0xc')]);router[_0x239d('0xa')]('/:id',auth[_0x239d('0xb')](),controller[_0x239d('0xd')]);router[_0x239d('0xe')]('/',auth[_0x239d('0xb')](),controller[_0x239d('0xf')]);router[_0x239d('0x10')](_0x239d('0x11'),auth[_0x239d('0xb')](),controller[_0x239d('0x12')]);router[_0x239d('0x13')](_0x239d('0x11'),auth[_0x239d('0xb')](),controller[_0x239d('0x14')]);module[_0x239d('0x15')]=router; \ No newline at end of file +var _0x24bb=['./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','path','express','Router','../../components/auth/service'];(function(_0x40f9dd,_0x2d92c1){var _0x34d3f0=function(_0x568948){while(--_0x568948){_0x40f9dd['push'](_0x40f9dd['shift']());}};_0x34d3f0(++_0x2d92c1);}(_0x24bb,0x19f));var _0xb24b=function(_0x2e084f,_0x1f542b){_0x2e084f=_0x2e084f-0x0;var _0x32116b=_0x24bb[_0x2e084f];return _0x32116b;};'use strict';var multer=require(_0xb24b('0x0'));var util=require('util');var path=require(_0xb24b('0x1'));var timeout=require('connect-timeout');var express=require(_0xb24b('0x2'));var router=express[_0xb24b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb24b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb24b('0x5'));router[_0xb24b('0x6')]('/',auth[_0xb24b('0x7')](),controller['index']);router['get'](_0xb24b('0x8'),auth[_0xb24b('0x7')](),controller[_0xb24b('0x9')]);router[_0xb24b('0xa')]('/',auth[_0xb24b('0x7')](),controller[_0xb24b('0xb')]);router[_0xb24b('0xc')](_0xb24b('0x8'),auth['isAuthenticated'](),controller[_0xb24b('0xd')]);router[_0xb24b('0xe')](_0xb24b('0x8'),auth[_0xb24b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 20549dd..97fb425 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 _0xd435=['exports','STRING','sequelize'];(function(_0x118765,_0x44aca2){var _0x4af8d7=function(_0x11c76f){while(--_0x11c76f){_0x118765['push'](_0x118765['shift']());}};_0x4af8d7(++_0x44aca2);}(_0xd435,0x164));var _0x5d43=function(_0x25a8ed,_0x1c7c1f){_0x25a8ed=_0x25a8ed-0x0;var _0x215959=_0xd435[_0x25a8ed];return _0x215959;};'use strict';var Sequelize=require(_0x5d43('0x0'));module[_0x5d43('0x1')]={'name':{'type':Sequelize[_0x5d43('0x2')]},'description':{'type':Sequelize[_0x5d43('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd645=['TEXT','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd645,0x131));var _0x5d64=function(_0x4e41be,_0xe2d52c){_0x4e41be=_0x4e41be-0x0;var _0x214049=_0xd645[_0x4e41be];return _0x214049;};'use strict';var Sequelize=require(_0x5d64('0x0'));module[_0x5d64('0x1')]={'name':{'type':Sequelize[_0x5d64('0x2')]},'description':{'type':Sequelize[_0x5d64('0x2')]},'html':{'type':Sequelize[_0x5d64('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1549ce9..42d0054 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 _0xcba0=['filters','pick','merge','map','filter','options','Template','count','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','undefined','limit','offset','status','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2bf5f2,_0x36b1cb){var _0x24335a=function(_0x157c5f){while(--_0x157c5f){_0x2bf5f2['push'](_0x2bf5f2['shift']());}};_0x24335a(++_0x36b1cb);}(_0xcba0,0xc6));var _0x0cba=function(_0x10f05d,_0xb017e3){_0x10f05d=_0x10f05d-0x0;var _0x132944=_0xcba0[_0x10f05d];return _0x132944;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cba('0x0'));var jsonpatch=require(_0x0cba('0x1'));var rp=require('request-promise');var moment=require(_0x0cba('0x2'));var BPromise=require(_0x0cba('0x3'));var Mustache=require('mustache');var util=require(_0x0cba('0x4'));var path=require(_0x0cba('0x5'));var sox=require(_0x0cba('0x6'));var csv=require(_0x0cba('0x7'));var ejs=require(_0x0cba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cba('0x9'));var squel=require(_0x0cba('0xa'));var crypto=require(_0x0cba('0xb'));var jsforce=require(_0x0cba('0xc'));var deskjs=require(_0x0cba('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0cba('0xe'));var Papa=require(_0x0cba('0xf'));var Redis=require(_0x0cba('0x10'));var authService=require(_0x0cba('0x11'));var qs=require(_0x0cba('0x12'));var as=require(_0x0cba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cba('0x14'))(_0x0cba('0x15'));var utils=require(_0x0cba('0x16'));var config=require(_0x0cba('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da94c,_0x40c395){_0x40c395=_0x40c395||0xcc;return function(_0xa89c0d){if(_0xa89c0d){return _0x1da94c[_0x0cba('0x18')](_0x40c395);}return _0x1da94c['status'](_0x40c395)['end']();};}function respondWithResult(_0x1943a,_0x139da6){_0x139da6=_0x139da6||0xc8;return function(_0x519537){if(_0x519537){return _0x1943a['status'](_0x139da6)[_0x0cba('0x19')](_0x519537);}};}function respondWithFilteredResult(_0x24b40a,_0x3c513a){return function(_0x1391f5){if(_0x1391f5){var _0x1de40f=typeof _0x3c513a['offset']===_0x0cba('0x1a')&&typeof _0x3c513a[_0x0cba('0x1b')]==='undefined';var _0x1e86db=_0x1391f5['count'];var _0x3fd2d9=_0x1de40f?0x0:_0x3c513a[_0x0cba('0x1c')];var _0x5a6ec8=_0x1de40f?_0x1391f5['count']:_0x3c513a[_0x0cba('0x1c')]+_0x3c513a[_0x0cba('0x1b')];var _0x4e2717;if(_0x5a6ec8>=_0x1e86db){_0x5a6ec8=_0x1e86db;_0x4e2717=0xc8;}else{_0x4e2717=0xce;}_0x24b40a[_0x0cba('0x1d')](_0x4e2717);return _0x24b40a['set'](_0x0cba('0x1e'),_0x3fd2d9+'-'+_0x5a6ec8+'/'+_0x1e86db)['json'](_0x1391f5);}return null;};}function patchUpdates(_0x10d065){return function(_0x13a8c3){try{jsonpatch['apply'](_0x13a8c3,_0x10d065,!![]);}catch(_0x53fdee){return BPromise[_0x0cba('0x1f')](_0x53fdee);}return _0x13a8c3[_0x0cba('0x20')]();};}function saveUpdates(_0x5df6ea,_0x27662c){return function(_0x1de4f8){if(_0x1de4f8){return _0x1de4f8[_0x0cba('0x21')](_0x5df6ea)[_0x0cba('0x22')](function(_0x517095){return _0x517095;});}return null;};}function removeEntity(_0x5c2c1f,_0x4d01e1){return function(_0xd4a3ee){if(_0xd4a3ee){return _0xd4a3ee[_0x0cba('0x23')]()[_0x0cba('0x22')](function(){var _0x301193=_0xd4a3ee[_0x0cba('0x24')]({'plain':!![]});var _0x5489d3=_0x0cba('0x25');return db[_0x0cba('0x26')][_0x0cba('0x23')]({'where':{'type':_0x5489d3,'resourceId':_0x301193['id']}})[_0x0cba('0x22')](function(){return _0xd4a3ee;});})[_0x0cba('0x22')](function(){_0x5c2c1f[_0x0cba('0x1d')](0xcc)[_0x0cba('0x27')]();});}};}function handleEntityNotFound(_0x4781de,_0x340410){return function(_0x15fd4e){if(!_0x15fd4e){_0x4781de[_0x0cba('0x18')](0x194);}return _0x15fd4e;};}function handleError(_0x13fbaa,_0x101c58){_0x101c58=_0x101c58||0x1f4;return function(_0xafb210){logger[_0x0cba('0x28')](_0xafb210[_0x0cba('0x29')]);if(_0xafb210[_0x0cba('0x2a')]){delete _0xafb210[_0x0cba('0x2a')];}_0x13fbaa[_0x0cba('0x1d')](_0x101c58)[_0x0cba('0x2b')](_0xafb210);};}exports[_0x0cba('0x2c')]=function(_0x572ccd,_0x144717){var _0x110a87={},_0x2edaf9={},_0xc882ea={'count':0x0,'rows':[]};var _0x566697=_['map'](db['Template']['rawAttributes'],function(_0x465540){return{'name':_0x465540[_0x0cba('0x2d')],'type':_0x465540[_0x0cba('0x2e')][_0x0cba('0x2f')]};});_0x2edaf9[_0x0cba('0x30')]=_['map'](_0x566697,_0x0cba('0x2a'));_0x2edaf9[_0x0cba('0x31')]=_[_0x0cba('0x32')](_0x572ccd[_0x0cba('0x31')]);_0x2edaf9['filters']=_[_0x0cba('0x33')](_0x2edaf9[_0x0cba('0x30')],_0x2edaf9[_0x0cba('0x31')]);_0x110a87[_0x0cba('0x34')]=_[_0x0cba('0x33')](_0x2edaf9['model'],qs[_0x0cba('0x35')](_0x572ccd[_0x0cba('0x31')]['fields']));_0x110a87[_0x0cba('0x34')]=_0x110a87[_0x0cba('0x34')][_0x0cba('0x36')]?_0x110a87[_0x0cba('0x34')]:_0x2edaf9[_0x0cba('0x30')];if(!_0x572ccd[_0x0cba('0x31')][_0x0cba('0x37')](_0x0cba('0x38'))){_0x110a87[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x572ccd[_0x0cba('0x31')][_0x0cba('0x1b')]);_0x110a87['offset']=qs[_0x0cba('0x1c')](_0x572ccd['query'][_0x0cba('0x1c')]);}_0x110a87[_0x0cba('0x39')]=qs[_0x0cba('0x3a')](_0x572ccd[_0x0cba('0x31')][_0x0cba('0x3a')]);_0x110a87[_0x0cba('0x3b')]=qs[_0x0cba('0x3c')](_[_0x0cba('0x3d')](_0x572ccd[_0x0cba('0x31')],_0x2edaf9[_0x0cba('0x3c')]),_0x566697);if(_0x572ccd['query']['filter']){_0x110a87[_0x0cba('0x3b')]=_[_0x0cba('0x3e')](_0x110a87[_0x0cba('0x3b')],{'$or':_[_0x0cba('0x3f')](_0x566697,function(_0x4d5683){if(_0x4d5683[_0x0cba('0x2e')]!=='VIRTUAL'){var _0x35f1d0={};_0x35f1d0[_0x4d5683[_0x0cba('0x2a')]]={'$like':'%'+_0x572ccd[_0x0cba('0x31')][_0x0cba('0x40')]+'%'};return _0x35f1d0;}})});}_0x110a87=_[_0x0cba('0x3e')]({},_0x110a87,_0x572ccd[_0x0cba('0x41')]);var _0x3f411b={'where':_0x110a87[_0x0cba('0x3b')]};return db[_0x0cba('0x42')]['count'](_0x3f411b)[_0x0cba('0x22')](function(_0x211dae){_0xc882ea[_0x0cba('0x43')]=_0x211dae;if(_0x572ccd['query'][_0x0cba('0x44')]){_0x110a87[_0x0cba('0x45')]=[{'all':!![]}];}return db[_0x0cba('0x42')][_0x0cba('0x46')](_0x110a87);})[_0x0cba('0x22')](function(_0x354d1b){_0xc882ea[_0x0cba('0x47')]=_0x354d1b;return _0xc882ea;})[_0x0cba('0x22')](respondWithFilteredResult(_0x144717,_0x110a87))['catch'](handleError(_0x144717,null));};exports[_0x0cba('0x48')]=function(_0x1e918e,_0x12e3c6){var _0x2fb867={'raw':!![],'where':{'id':_0x1e918e['params']['id']}},_0x444bd1={};_0x444bd1[_0x0cba('0x30')]=_['keys'](db[_0x0cba('0x42')][_0x0cba('0x49')]);_0x444bd1['query']=_['keys'](_0x1e918e[_0x0cba('0x31')]);_0x444bd1[_0x0cba('0x3c')]=_[_0x0cba('0x33')](_0x444bd1['model'],_0x444bd1[_0x0cba('0x31')]);_0x2fb867[_0x0cba('0x34')]=_['intersection'](_0x444bd1[_0x0cba('0x30')],qs['fields'](_0x1e918e['query'][_0x0cba('0x35')]));_0x2fb867['attributes']=_0x2fb867[_0x0cba('0x34')]['length']?_0x2fb867['attributes']:_0x444bd1[_0x0cba('0x30')];if(_0x1e918e[_0x0cba('0x31')]['includeAll']){_0x2fb867['include']=[{'all':!![]}];}_0x2fb867=_['merge']({},_0x2fb867,_0x1e918e[_0x0cba('0x41')]);return db[_0x0cba('0x42')][_0x0cba('0x4a')](_0x2fb867)[_0x0cba('0x22')](handleEntityNotFound(_0x12e3c6,null))[_0x0cba('0x22')](respondWithResult(_0x12e3c6,null))[_0x0cba('0x4b')](handleError(_0x12e3c6,null));};exports['create']=function(_0x2f6b9e,_0x1ec2db){return db['Template'][_0x0cba('0x4c')](_0x2f6b9e[_0x0cba('0x4d')],{})['then'](function(_0x2c4beb){var _0x41ed7a=_0x2f6b9e['user']['get']({'plain':!![]});if(!_0x41ed7a)throw new Error(_0x0cba('0x4e'));if(_0x41ed7a[_0x0cba('0x4f')]===_0x0cba('0x50')){var _0x3d1328=_0x2c4beb['get']({'plain':!![]});var _0x539bc2=_0x0cba('0x25');return db[_0x0cba('0x51')][_0x0cba('0x4a')]({'where':{'name':_0x539bc2,'userProfileId':_0x41ed7a[_0x0cba('0x52')]},'raw':!![]})[_0x0cba('0x22')](function(_0x2c1913){if(_0x2c1913&&_0x2c1913[_0x0cba('0x53')]===0x0){return db[_0x0cba('0x26')][_0x0cba('0x4c')]({'name':_0x3d1328[_0x0cba('0x2a')],'resourceId':_0x3d1328['id'],'type':_0x2c1913[_0x0cba('0x2a')],'sectionId':_0x2c1913['id']},{})[_0x0cba('0x22')](function(){return _0x2c4beb;});}else{return _0x2c4beb;}})['catch'](function(_0x551184){logger['error'](_0x0cba('0x54'),_0x551184);throw _0x551184;});}return _0x2c4beb;})[_0x0cba('0x22')](respondWithResult(_0x1ec2db,0xc9))[_0x0cba('0x4b')](handleError(_0x1ec2db,null));};exports[_0x0cba('0x21')]=function(_0x2725e0,_0x1c9179){if(_0x2725e0[_0x0cba('0x4d')]['id']){delete _0x2725e0[_0x0cba('0x4d')]['id'];}return db[_0x0cba('0x42')]['find']({'where':{'id':_0x2725e0[_0x0cba('0x55')]['id']}})['then'](handleEntityNotFound(_0x1c9179,null))[_0x0cba('0x22')](saveUpdates(_0x2725e0[_0x0cba('0x4d')],null))[_0x0cba('0x22')](respondWithResult(_0x1c9179,null))['catch'](handleError(_0x1c9179,null));};exports[_0x0cba('0x23')]=function(_0x262ce4,_0x423279){return db['Template']['find']({'where':{'id':_0x262ce4[_0x0cba('0x55')]['id']}})[_0x0cba('0x22')](handleEntityNotFound(_0x423279,null))[_0x0cba('0x22')](removeEntity(_0x423279,null))['catch'](handleError(_0x423279,null));}; \ No newline at end of file +var _0x049d=['request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','sendStatus','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','pick','where','merge','map','options','count','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3638a6,_0xfd0fd4){var _0x16f9ea=function(_0x322c92){while(--_0x322c92){_0x3638a6['push'](_0x3638a6['shift']());}};_0x16f9ea(++_0xfd0fd4);}(_0x049d,0xa2));var _0xd049=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x049d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd049('0x0'));var rimraf=require(_0xd049('0x1'));var zipdir=require(_0xd049('0x2'));var jsonpatch=require(_0xd049('0x3'));var rp=require(_0xd049('0x4'));var moment=require(_0xd049('0x5'));var BPromise=require(_0xd049('0x6'));var Mustache=require(_0xd049('0x7'));var util=require(_0xd049('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd049('0x9'));var ejs=require(_0xd049('0xa'));var fs=require('fs');var fs_extra=require(_0xd049('0xb'));var _=require(_0xd049('0xc'));var squel=require('squel');var crypto=require(_0xd049('0xd'));var jsforce=require(_0xd049('0xe'));var deskjs=require(_0xd049('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd049('0x10'));var Papa=require('papaparse');var Redis=require(_0xd049('0x11'));var authService=require(_0xd049('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd049('0x13'));var hardwareService=require(_0xd049('0x14'));var logger=require(_0xd049('0x15'))(_0xd049('0x16'));var utils=require(_0xd049('0x17'));var config=require(_0xd049('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd049('0x19'))['db'];function respondWithStatusCode(_0x52cbf3,_0x45f200){_0x45f200=_0x45f200||0xcc;return function(_0x185569){if(_0x185569){return _0x52cbf3['sendStatus'](_0x45f200);}return _0x52cbf3[_0xd049('0x1a')](_0x45f200)['end']();};}function respondWithResult(_0x4f6bbe,_0x50b0dd){_0x50b0dd=_0x50b0dd||0xc8;return function(_0x41d654){if(_0x41d654){return _0x4f6bbe['status'](_0x50b0dd)[_0xd049('0x1b')](_0x41d654);}};}function respondWithFilteredResult(_0x43e26f,_0x4de12b){return function(_0x595156){if(_0x595156){var _0x210745=typeof _0x4de12b[_0xd049('0x1c')]==='undefined'&&typeof _0x4de12b[_0xd049('0x1d')]===_0xd049('0x1e');var _0x27b9aa=_0x595156['count'];var _0x305fbb=_0x210745?0x0:_0x4de12b[_0xd049('0x1c')];var _0x28ce69=_0x210745?_0x595156['count']:_0x4de12b[_0xd049('0x1c')]+_0x4de12b['limit'];var _0x588924;if(_0x28ce69>=_0x27b9aa){_0x28ce69=_0x27b9aa;_0x588924=0xc8;}else{_0x588924=0xce;}_0x43e26f['status'](_0x588924);return _0x43e26f['set'](_0xd049('0x1f'),_0x305fbb+'-'+_0x28ce69+'/'+_0x27b9aa)[_0xd049('0x1b')](_0x595156);}return null;};}function patchUpdates(_0x3f0ea1){return function(_0x2773e1){try{jsonpatch[_0xd049('0x20')](_0x2773e1,_0x3f0ea1,!![]);}catch(_0x264437){return BPromise[_0xd049('0x21')](_0x264437);}return _0x2773e1[_0xd049('0x22')]();};}function saveUpdates(_0x221fbe,_0x24bfc0){return function(_0xa452b3){if(_0xa452b3){return _0xa452b3[_0xd049('0x23')](_0x221fbe)[_0xd049('0x24')](function(_0x3992dc){return _0x3992dc;});}return null;};}function removeEntity(_0x1b484f,_0x261a52){return function(_0x140b91){if(_0x140b91){return _0x140b91[_0xd049('0x25')]()[_0xd049('0x24')](function(){var _0x1586ab=_0x140b91[_0xd049('0x26')]({'plain':!![]});var _0x519db0=_0xd049('0x27');return db[_0xd049('0x28')][_0xd049('0x25')]({'where':{'type':_0x519db0,'resourceId':_0x1586ab['id']}})['then'](function(){return _0x140b91;});})[_0xd049('0x24')](function(){_0x1b484f[_0xd049('0x1a')](0xcc)[_0xd049('0x29')]();});}};}function handleEntityNotFound(_0x4ed973,_0x73e3b6){return function(_0x24cddc){if(!_0x24cddc){_0x4ed973[_0xd049('0x2a')](0x194);}return _0x24cddc;};}function handleError(_0x346bce,_0x48dd96){_0x48dd96=_0x48dd96||0x1f4;return function(_0xe2a912){logger[_0xd049('0x2b')](_0xe2a912[_0xd049('0x2c')]);if(_0xe2a912[_0xd049('0x2d')]){delete _0xe2a912[_0xd049('0x2d')];}_0x346bce[_0xd049('0x1a')](_0x48dd96)[_0xd049('0x2e')](_0xe2a912);};}exports[_0xd049('0x2f')]=function(_0x24c5a7,_0x1b00ae){var _0x2d1690={},_0x4ef190={},_0x20e964={'count':0x0,'rows':[]};var _0x2259b7=_['map'](db[_0xd049('0x30')][_0xd049('0x31')],function(_0x3b170c){return{'name':_0x3b170c[_0xd049('0x32')],'type':_0x3b170c[_0xd049('0x33')][_0xd049('0x34')]};});_0x4ef190[_0xd049('0x35')]=_['map'](_0x2259b7,_0xd049('0x2d'));_0x4ef190['query']=_[_0xd049('0x36')](_0x24c5a7['query']);_0x4ef190[_0xd049('0x37')]=_[_0xd049('0x38')](_0x4ef190[_0xd049('0x35')],_0x4ef190['query']);_0x2d1690[_0xd049('0x39')]=_[_0xd049('0x38')](_0x4ef190[_0xd049('0x35')],qs['fields'](_0x24c5a7[_0xd049('0x3a')][_0xd049('0x3b')]));_0x2d1690[_0xd049('0x39')]=_0x2d1690[_0xd049('0x39')][_0xd049('0x3c')]?_0x2d1690['attributes']:_0x4ef190[_0xd049('0x35')];if(!_0x24c5a7['query']['hasOwnProperty'](_0xd049('0x3d'))){_0x2d1690[_0xd049('0x1d')]=qs[_0xd049('0x1d')](_0x24c5a7[_0xd049('0x3a')][_0xd049('0x1d')]);_0x2d1690['offset']=qs[_0xd049('0x1c')](_0x24c5a7[_0xd049('0x3a')][_0xd049('0x1c')]);}_0x2d1690[_0xd049('0x3e')]=qs[_0xd049('0x3f')](_0x24c5a7[_0xd049('0x3a')]['sort']);_0x2d1690['where']=qs['filters'](_[_0xd049('0x40')](_0x24c5a7[_0xd049('0x3a')],_0x4ef190[_0xd049('0x37')]),_0x2259b7);if(_0x24c5a7[_0xd049('0x3a')]['filter']){_0x2d1690[_0xd049('0x41')]=_[_0xd049('0x42')](_0x2d1690[_0xd049('0x41')],{'$or':_[_0xd049('0x43')](_0x2259b7,function(_0x335c01){if(_0x335c01[_0xd049('0x33')]!=='VIRTUAL'){var _0x41bdcf={};_0x41bdcf[_0x335c01[_0xd049('0x2d')]]={'$like':'%'+_0x24c5a7[_0xd049('0x3a')]['filter']+'%'};return _0x41bdcf;}})});}_0x2d1690=_[_0xd049('0x42')]({},_0x2d1690,_0x24c5a7[_0xd049('0x44')]);var _0x26fa3c={'where':_0x2d1690[_0xd049('0x41')]};return db[_0xd049('0x30')][_0xd049('0x45')](_0x26fa3c)[_0xd049('0x24')](function(_0x45864a){_0x20e964[_0xd049('0x45')]=_0x45864a;if(_0x24c5a7['query'][_0xd049('0x46')]){_0x2d1690['include']=[{'all':!![]}];}return db['Template'][_0xd049('0x47')](_0x2d1690);})[_0xd049('0x24')](function(_0x4a1723){_0x20e964[_0xd049('0x48')]=_0x4a1723;return _0x20e964;})['then'](respondWithFilteredResult(_0x1b00ae,_0x2d1690))[_0xd049('0x49')](handleError(_0x1b00ae,null));};exports['show']=function(_0x4fdc20,_0x371c7d){var _0x311a0c={'raw':!![],'where':{'id':_0x4fdc20[_0xd049('0x4a')]['id']}},_0x2bc912={};_0x2bc912[_0xd049('0x35')]=_['keys'](db[_0xd049('0x30')]['rawAttributes']);_0x2bc912[_0xd049('0x3a')]=_['keys'](_0x4fdc20[_0xd049('0x3a')]);_0x2bc912[_0xd049('0x37')]=_[_0xd049('0x38')](_0x2bc912[_0xd049('0x35')],_0x2bc912[_0xd049('0x3a')]);_0x311a0c[_0xd049('0x39')]=_[_0xd049('0x38')](_0x2bc912['model'],qs[_0xd049('0x3b')](_0x4fdc20[_0xd049('0x3a')][_0xd049('0x3b')]));_0x311a0c[_0xd049('0x39')]=_0x311a0c[_0xd049('0x39')]['length']?_0x311a0c[_0xd049('0x39')]:_0x2bc912[_0xd049('0x35')];if(_0x4fdc20['query'][_0xd049('0x46')]){_0x311a0c[_0xd049('0x4b')]=[{'all':!![]}];}_0x311a0c=_[_0xd049('0x42')]({},_0x311a0c,_0x4fdc20[_0xd049('0x44')]);return db['Template'][_0xd049('0x4c')](_0x311a0c)[_0xd049('0x24')](handleEntityNotFound(_0x371c7d,null))[_0xd049('0x24')](respondWithResult(_0x371c7d,null))[_0xd049('0x49')](handleError(_0x371c7d,null));};exports[_0xd049('0x4d')]=function(_0x2f6a88,_0x4c6404){return db[_0xd049('0x30')][_0xd049('0x4d')](_0x2f6a88[_0xd049('0x4e')],{})[_0xd049('0x24')](function(_0x7ed624){var _0x249b5a=_0x2f6a88[_0xd049('0x4f')]['get']({'plain':!![]});if(!_0x249b5a)throw new Error(_0xd049('0x50'));if(_0x249b5a['role']===_0xd049('0x4f')){var _0x30be70=_0x7ed624['get']({'plain':!![]});var _0x44280c=_0xd049('0x27');return db['UserProfileSection'][_0xd049('0x4c')]({'where':{'name':_0x44280c,'userProfileId':_0x249b5a[_0xd049('0x51')]},'raw':!![]})['then'](function(_0xfd5510){if(_0xfd5510&&_0xfd5510[_0xd049('0x52')]===0x0){return db[_0xd049('0x28')]['create']({'name':_0x30be70[_0xd049('0x2d')],'resourceId':_0x30be70['id'],'type':_0xfd5510[_0xd049('0x2d')],'sectionId':_0xfd5510['id']},{})[_0xd049('0x24')](function(){return _0x7ed624;});}else{return _0x7ed624;}})[_0xd049('0x49')](function(_0x2ceabd){logger[_0xd049('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ceabd);throw _0x2ceabd;});}return _0x7ed624;})[_0xd049('0x24')](respondWithResult(_0x4c6404,0xc9))[_0xd049('0x49')](handleError(_0x4c6404,null));};exports[_0xd049('0x23')]=function(_0x5309f3,_0x5500a6){if(_0x5309f3[_0xd049('0x4e')]['id']){delete _0x5309f3[_0xd049('0x4e')]['id'];}return db[_0xd049('0x30')][_0xd049('0x4c')]({'where':{'id':_0x5309f3[_0xd049('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5500a6,null))['then'](saveUpdates(_0x5309f3[_0xd049('0x4e')],null))['then'](respondWithResult(_0x5500a6,null))[_0xd049('0x49')](handleError(_0x5500a6,null));};exports[_0xd049('0x25')]=function(_0x55b797,_0x405cd4){return db[_0xd049('0x30')][_0xd049('0x4c')]({'where':{'id':_0x55b797[_0xd049('0x4a')]['id']}})[_0xd049('0x24')](handleEntityNotFound(_0x405cd4,null))[_0xd049('0x24')](removeEntity(_0x405cd4,null))[_0xd049('0x49')](handleError(_0x405cd4,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 38f9aa9..38da56b 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 _0x7efe=['rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2b5f75,_0x5632e1){var _0x53fe28=function(_0x5a9800){while(--_0x5a9800){_0x2b5f75['push'](_0x2b5f75['shift']());}};_0x53fe28(++_0x5632e1);}(_0x7efe,0xaf));var _0xe7ef=function(_0x155b11,_0x75f2b2){_0x155b11=_0x155b11-0x0;var _0x72481=_0x7efe[_0x155b11];return _0x72481;};'use strict';var _=require(_0xe7ef('0x0'));var util=require(_0xe7ef('0x1'));var logger=require('../../config/logger')(_0xe7ef('0x2'));var moment=require(_0xe7ef('0x3'));var BPromise=require(_0xe7ef('0x4'));var rp=require(_0xe7ef('0x5'));var fs=require('fs');var path=require(_0xe7ef('0x6'));var rimraf=require(_0xe7ef('0x7'));var config=require(_0xe7ef('0x8'));var attributes=require(_0xe7ef('0x9'));module[_0xe7ef('0xa')]=function(_0xdd51e2,_0x190510){return _0xdd51e2[_0xe7ef('0xb')]('Template',attributes,{'tableName':_0xe7ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc47=['exports','define','Template','tools_templates','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2391cf,_0x2593e9){var _0x11f9e5=function(_0xed220d){while(--_0xed220d){_0x2391cf['push'](_0x2391cf['shift']());}};_0x11f9e5(++_0x2593e9);}(_0xcc47,0x64));var _0x7cc4=function(_0x5b5257,_0x446661){_0x5b5257=_0x5b5257-0x0;var _0x34e3fa=_0xcc47[_0x5b5257];return _0x34e3fa;};'use strict';var _=require(_0x7cc4('0x0'));var util=require(_0x7cc4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cc4('0x2'));var BPromise=require(_0x7cc4('0x3'));var rp=require(_0x7cc4('0x4'));var fs=require('fs');var path=require(_0x7cc4('0x5'));var rimraf=require(_0x7cc4('0x6'));var config=require(_0x7cc4('0x7'));var attributes=require('./template.attributes');module[_0x7cc4('0x8')]=function(_0x3461a4,_0x493e68){return _0x3461a4[_0x7cc4('0x9')](_0x7cc4('0xa'),attributes,{'tableName':_0x7cc4('0xb'),'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 4a44d84..43c09f9 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 _0x0c74=['http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','findAll','options','attributes','map','include','model','GetTemplate','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x0c74,0x72));var _0x40c7=function(_0x3150ab,_0x5645da){_0x3150ab=_0x3150ab-0x0;var _0x1d30d8=_0x0c74[_0x3150ab];return _0x1d30d8;};'use strict';var _=require(_0x40c7('0x0'));var util=require(_0x40c7('0x1'));var moment=require('moment');var BPromise=require(_0x40c7('0x2'));var rs=require(_0x40c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x40c7('0x4'));var logger=require(_0x40c7('0x5'))(_0x40c7('0x6'));var config=require(_0x40c7('0x7'));var jayson=require(_0x40c7('0x8'));var client=jayson[_0x40c7('0x9')][_0x40c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b5144,_0x1b4e59,_0x3f168b){return new BPromise(function(_0x44be34,_0x460fc7){return client['request'](_0x7b5144,_0x3f168b)[_0x40c7('0xb')](function(_0x1d1f40){logger[_0x40c7('0xc')](_0x40c7('0xd'),_0x1b4e59,'request\x20sent');logger[_0x40c7('0xe')](_0x40c7('0xf'),_0x1b4e59,_0x40c7('0x10'),JSON[_0x40c7('0x11')](_0x1d1f40));if(_0x1d1f40[_0x40c7('0x12')]){if(_0x1d1f40[_0x40c7('0x12')][_0x40c7('0x13')]===0x1f4){logger[_0x40c7('0x12')]('Template,\x20%s,\x20%s',_0x1b4e59,_0x1d1f40[_0x40c7('0x12')][_0x40c7('0x14')]);return _0x460fc7(_0x1d1f40[_0x40c7('0x12')][_0x40c7('0x14')]);}logger['error'](_0x40c7('0xd'),_0x1b4e59,_0x1d1f40[_0x40c7('0x12')][_0x40c7('0x14')]);return _0x44be34(_0x1d1f40[_0x40c7('0x12')]['message']);}else{logger['info'](_0x40c7('0xd'),_0x1b4e59,_0x40c7('0x10'));_0x44be34(_0x1d1f40[_0x40c7('0x15')][_0x40c7('0x14')]);}})[_0x40c7('0x16')](function(_0xd01d2a){logger[_0x40c7('0x12')](_0x40c7('0xd'),_0x1b4e59,_0xd01d2a);_0x460fc7(_0xd01d2a);});});}exports['GetTemplate']=function(_0x50a2d6){var _0x5ad2a4=this;return new Promise(function(_0x228198,_0x106dbb){return db[_0x40c7('0x17')][_0x40c7('0x18')]({'raw':_0x50a2d6[_0x40c7('0x19')]?_0x50a2d6[_0x40c7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x50a2d6[_0x40c7('0x19')]?_0x50a2d6['options']['where']||null:null,'attributes':_0x50a2d6[_0x40c7('0x19')]?_0x50a2d6[_0x40c7('0x19')][_0x40c7('0x1a')]||null:null,'limit':_0x50a2d6[_0x40c7('0x19')]?_0x50a2d6[_0x40c7('0x19')]['limit']||null:null,'include':_0x50a2d6[_0x40c7('0x19')]?_0x50a2d6[_0x40c7('0x19')]['include']?_[_0x40c7('0x1b')](_0x50a2d6[_0x40c7('0x19')][_0x40c7('0x1c')],function(_0x238c4d){return{'model':db[_0x238c4d['model']],'as':_0x238c4d['as'],'attributes':_0x238c4d[_0x40c7('0x1a')],'include':_0x238c4d[_0x40c7('0x1c')]?_['map'](_0x238c4d['include'],function(_0x3e96b4){return{'model':db[_0x3e96b4[_0x40c7('0x1d')]],'as':_0x3e96b4['as'],'attributes':_0x3e96b4['attributes'],'include':_0x3e96b4[_0x40c7('0x1c')]?_[_0x40c7('0x1b')](_0x3e96b4['include'],function(_0x57b804){return{'model':db[_0x57b804[_0x40c7('0x1d')]],'as':_0x57b804['as'],'attributes':_0x57b804[_0x40c7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x40c7('0xb')](function(_0x4db6b3){logger[_0x40c7('0xc')](_0x40c7('0x1e'),_0x50a2d6);logger['debug'](_0x40c7('0x1e'),_0x50a2d6,JSON[_0x40c7('0x11')](_0x4db6b3));_0x228198(_0x4db6b3);})[_0x40c7('0x16')](function(_0x3d43b2){logger['error'](_0x40c7('0x1e'),_0x3d43b2[_0x40c7('0x14')],_0x50a2d6);_0x106dbb(_0x5ad2a4[_0x40c7('0x12')](0x1f4,_0x3d43b2[_0x40c7('0x14')]));});});}; \ No newline at end of file +var _0x35c8=['Template','findAll','options','where','attributes','include','map','model','then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetTemplate'];(function(_0x48d44a,_0x3f0003){var _0x4d4fe6=function(_0x33a7f5){while(--_0x33a7f5){_0x48d44a['push'](_0x48d44a['shift']());}};_0x4d4fe6(++_0x3f0003);}(_0x35c8,0xdc));var _0x835c=function(_0x2ed8f5,_0x233b9e){_0x2ed8f5=_0x2ed8f5-0x0;var _0x123bfe=_0x35c8[_0x2ed8f5];return _0x123bfe;};'use strict';var _=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var moment=require(_0x835c('0x2'));var BPromise=require(_0x835c('0x3'));var rs=require(_0x835c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x835c('0x5'))['db'];var utils=require(_0x835c('0x6'));var logger=require('../../config/logger')(_0x835c('0x7'));var config=require(_0x835c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x835c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44f63f,_0x1557c3,_0x4cdb33){return new BPromise(function(_0x4ab07b,_0x5873db){return client[_0x835c('0xa')](_0x44f63f,_0x4cdb33)['then'](function(_0x100f8b){logger[_0x835c('0xb')](_0x835c('0xc'),_0x1557c3,_0x835c('0xd'));logger[_0x835c('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x1557c3,_0x835c('0xd'),JSON[_0x835c('0xf')](_0x100f8b));if(_0x100f8b['error']){if(_0x100f8b[_0x835c('0x10')]['code']===0x1f4){logger[_0x835c('0x10')](_0x835c('0xc'),_0x1557c3,_0x100f8b['error']['message']);return _0x5873db(_0x100f8b['error'][_0x835c('0x11')]);}logger[_0x835c('0x10')](_0x835c('0xc'),_0x1557c3,_0x100f8b[_0x835c('0x10')][_0x835c('0x11')]);return _0x4ab07b(_0x100f8b[_0x835c('0x10')][_0x835c('0x11')]);}else{logger[_0x835c('0xb')]('Template,\x20%s,\x20%s',_0x1557c3,_0x835c('0xd'));_0x4ab07b(_0x100f8b[_0x835c('0x12')]['message']);}})['catch'](function(_0x356e77){logger[_0x835c('0x10')](_0x835c('0xc'),_0x1557c3,_0x356e77);_0x5873db(_0x356e77);});});}exports[_0x835c('0x13')]=function(_0xaa8951){var _0x4e3270=this;return new Promise(function(_0x3e718b,_0x6398e){return db[_0x835c('0x14')][_0x835c('0x15')]({'raw':_0xaa8951[_0x835c('0x16')]?_0xaa8951['options']['raw']===undefined?!![]:![]:!![],'where':_0xaa8951['options']?_0xaa8951['options'][_0x835c('0x17')]||null:null,'attributes':_0xaa8951[_0x835c('0x16')]?_0xaa8951[_0x835c('0x16')][_0x835c('0x18')]||null:null,'limit':_0xaa8951[_0x835c('0x16')]?_0xaa8951[_0x835c('0x16')]['limit']||null:null,'include':_0xaa8951['options']?_0xaa8951[_0x835c('0x16')][_0x835c('0x19')]?_[_0x835c('0x1a')](_0xaa8951['options'][_0x835c('0x19')],function(_0x5ba1de){return{'model':db[_0x5ba1de['model']],'as':_0x5ba1de['as'],'attributes':_0x5ba1de['attributes'],'include':_0x5ba1de[_0x835c('0x19')]?_[_0x835c('0x1a')](_0x5ba1de[_0x835c('0x19')],function(_0x6cf8b9){return{'model':db[_0x6cf8b9[_0x835c('0x1b')]],'as':_0x6cf8b9['as'],'attributes':_0x6cf8b9[_0x835c('0x18')],'include':_0x6cf8b9[_0x835c('0x19')]?_[_0x835c('0x1a')](_0x6cf8b9[_0x835c('0x19')],function(_0x2a6442){return{'model':db[_0x2a6442[_0x835c('0x1b')]],'as':_0x2a6442['as'],'attributes':_0x2a6442[_0x835c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x835c('0x1c')](function(_0x43d95b){logger[_0x835c('0xb')](_0x835c('0x13'),_0xaa8951);logger[_0x835c('0xe')](_0x835c('0x13'),_0xaa8951,JSON[_0x835c('0xf')](_0x43d95b));_0x3e718b(_0x43d95b);})[_0x835c('0x1d')](function(_0x4fedbd){logger[_0x835c('0x10')](_0x835c('0x13'),_0x4fedbd[_0x835c('0x11')],_0xaa8951);_0x6398e(_0x4e3270[_0x835c('0x10')](0x1f4,_0x4fedbd[_0x835c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 617a3fa..8f75de7 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 _0x948c=['update','delete','/:id','destroy','exports','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x948c,0x123));var _0xc948=function(_0x4baa11,_0x7c6290){_0x4baa11=_0x4baa11-0x0;var _0x219273=_0x948c[_0x4baa11];return _0x219273;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc948('0x0'));var express=require(_0xc948('0x1'));var router=express['Router']();var fs_extra=require(_0xc948('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc948('0x3'));var config=require(_0xc948('0x4'));var controller=require(_0xc948('0x5'));router[_0xc948('0x6')]('/',auth[_0xc948('0x7')](),controller[_0xc948('0x8')]);router[_0xc948('0x6')]('/:id',auth[_0xc948('0x7')](),controller[_0xc948('0x9')]);router[_0xc948('0x6')]('/:id/all_conditions',auth[_0xc948('0x7')](),controller['getAllConditions']);router[_0xc948('0x6')](_0xc948('0xa'),auth[_0xc948('0x7')](),controller[_0xc948('0xb')]);router[_0xc948('0x6')](_0xc948('0xc'),auth[_0xc948('0x7')](),controller[_0xc948('0xd')]);router[_0xc948('0xe')]('/',auth[_0xc948('0x7')](),controller[_0xc948('0xf')]);router['post'](_0xc948('0x10'),auth['isAuthenticated'](),controller[_0xc948('0x11')]);router[_0xc948('0xe')]('/:id/any_conditions',auth[_0xc948('0x7')](),controller[_0xc948('0x12')]);router['post'](_0xc948('0xc'),auth[_0xc948('0x7')](),controller[_0xc948('0x13')]);router[_0xc948('0x14')]('/:id',auth[_0xc948('0x7')](),controller[_0xc948('0x15')]);router[_0xc948('0x16')](_0xc948('0x17'),auth[_0xc948('0x7')](),controller[_0xc948('0x18')]);module[_0xc948('0x19')]=router; \ No newline at end of file +var _0x8ae2=['getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','put','/:id','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ae2,0x143));var _0x28ae=function(_0x217b01,_0x487a10){_0x217b01=_0x217b01-0x0;var _0x3a570b=_0x8ae2[_0x217b01];return _0x3a570b;};'use strict';var multer=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var path=require('path');var timeout=require(_0x28ae('0x2'));var express=require('express');var router=express[_0x28ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x28ae('0x4'));var interaction=require(_0x28ae('0x5'));var config=require(_0x28ae('0x6'));var controller=require('./trigger.controller');router['get']('/',auth[_0x28ae('0x7')](),controller[_0x28ae('0x8')]);router[_0x28ae('0x9')]('/:id',auth[_0x28ae('0x7')](),controller['show']);router[_0x28ae('0x9')](_0x28ae('0xa'),auth[_0x28ae('0x7')](),controller[_0x28ae('0xb')]);router[_0x28ae('0x9')](_0x28ae('0xc'),auth[_0x28ae('0x7')](),controller[_0x28ae('0xd')]);router['get'](_0x28ae('0xe'),auth[_0x28ae('0x7')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x28ae('0xf')]);router[_0x28ae('0x10')](_0x28ae('0xa'),auth['isAuthenticated'](),controller[_0x28ae('0x11')]);router[_0x28ae('0x10')]('/:id/any_conditions',auth[_0x28ae('0x7')](),controller[_0x28ae('0x12')]);router['post'](_0x28ae('0xe'),auth['isAuthenticated'](),controller[_0x28ae('0x13')]);router[_0x28ae('0x14')](_0x28ae('0x15'),auth[_0x28ae('0x7')](),controller['update']);router[_0x28ae('0x16')]('/:id',auth[_0x28ae('0x7')](),controller['destroy']);module[_0x28ae('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 37456b1..862544a 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 _0xf49d=['STRING','BOOLEAN','sequelize'];(function(_0x3c455a,_0x379320){var _0x5e27bd=function(_0x3d1984){while(--_0x3d1984){_0x3c455a['push'](_0x3c455a['shift']());}};_0x5e27bd(++_0x379320);}(_0xf49d,0x191));var _0xdf49=function(_0x525633,_0x2bbb9b){_0x525633=_0x525633-0x0;var _0x1de40b=_0xf49d[_0x525633];return _0x1de40b;};'use strict';var Sequelize=require(_0xdf49('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf49('0x1')]},'channel':{'type':Sequelize[_0xdf49('0x1')]},'description':{'type':Sequelize[_0xdf49('0x1')]},'status':{'type':Sequelize[_0xdf49('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x659c=['exports','STRING','BOOLEAN'];(function(_0x11821a,_0x16b4c7){var _0x180a11=function(_0x45690d){while(--_0x45690d){_0x11821a['push'](_0x11821a['shift']());}};_0x180a11(++_0x16b4c7);}(_0x659c,0x171));var _0xc659=function(_0x27973c,_0x2d8b16){_0x27973c=_0x27973c-0x0;var _0x2ef123=_0x659c[_0x27973c];return _0x2ef123;};'use strict';var Sequelize=require('sequelize');module[_0xc659('0x0')]={'name':{'type':Sequelize[_0xc659('0x1')]},'channel':{'type':Sequelize[_0xc659('0x1')]},'description':{'type':Sequelize[_0xc659('0x1')]},'status':{'type':Sequelize[_0xc659('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 913a77f..d914973 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 _0xb4de=['nolimit','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','Trigger','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','hasOwnProperty'];(function(_0x505915,_0x450c76){var _0x5031ad=function(_0x3ad01a){while(--_0x3ad01a){_0x505915['push'](_0x505915['shift']());}};_0x5031ad(++_0x450c76);}(_0xb4de,0xb3));var _0xeb4d=function(_0x3107a7,_0x538b7e){_0x3107a7=_0x3107a7-0x0;var _0x209244=_0xb4de[_0x3107a7];return _0x209244;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb4d('0x0'));var zipdir=require(_0xeb4d('0x1'));var jsonpatch=require(_0xeb4d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeb4d('0x3'));var Mustache=require(_0xeb4d('0x4'));var util=require(_0xeb4d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xeb4d('0x6'));var ejs=require(_0xeb4d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb4d('0x8'));var squel=require(_0xeb4d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb4d('0x6'));var querystring=require(_0xeb4d('0xa'));var Papa=require(_0xeb4d('0xb'));var Redis=require(_0xeb4d('0xc'));var authService=require(_0xeb4d('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb4d('0xe'))(_0xeb4d('0xf'));var utils=require(_0xeb4d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xeb4d('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151379,_0x467773){_0x467773=_0x467773||0xcc;return function(_0x3f8e9d){if(_0x3f8e9d){return _0x151379[_0xeb4d('0x12')](_0x467773);}return _0x151379['status'](_0x467773)[_0xeb4d('0x13')]();};}function respondWithResult(_0x514c1e,_0x1360ba){_0x1360ba=_0x1360ba||0xc8;return function(_0x2c8d82){if(_0x2c8d82){return _0x514c1e[_0xeb4d('0x14')](_0x1360ba)['json'](_0x2c8d82);}};}function respondWithFilteredResult(_0x1006f7,_0x4929b9){return function(_0x416669){if(_0x416669){var _0x45c106=typeof _0x4929b9[_0xeb4d('0x15')]===_0xeb4d('0x16')&&typeof _0x4929b9[_0xeb4d('0x17')]===_0xeb4d('0x16');var _0x31b4a4=_0x416669[_0xeb4d('0x18')];var _0x8cb45a=_0x45c106?0x0:_0x4929b9[_0xeb4d('0x15')];var _0x2da493=_0x45c106?_0x416669[_0xeb4d('0x18')]:_0x4929b9[_0xeb4d('0x15')]+_0x4929b9[_0xeb4d('0x17')];var _0x3f6646;if(_0x2da493>=_0x31b4a4){_0x2da493=_0x31b4a4;_0x3f6646=0xc8;}else{_0x3f6646=0xce;}_0x1006f7[_0xeb4d('0x14')](_0x3f6646);return _0x1006f7[_0xeb4d('0x19')]('Content-Range',_0x8cb45a+'-'+_0x2da493+'/'+_0x31b4a4)[_0xeb4d('0x1a')](_0x416669);}return null;};}function patchUpdates(_0xa87620){return function(_0x3b71d0){try{jsonpatch[_0xeb4d('0x1b')](_0x3b71d0,_0xa87620,!![]);}catch(_0x1e521f){return BPromise[_0xeb4d('0x1c')](_0x1e521f);}return _0x3b71d0['save']();};}function saveUpdates(_0x12838e,_0x2bc10a){return function(_0x2daf18){if(_0x2daf18){return _0x2daf18[_0xeb4d('0x1d')](_0x12838e)[_0xeb4d('0x1e')](function(_0x460bc1){return _0x460bc1;});}return null;};}function removeEntity(_0x18bff5,_0x555008){return function(_0x3ba42c){if(_0x3ba42c){return _0x3ba42c['destroy']()[_0xeb4d('0x1e')](function(){var _0x1565e7=_0x3ba42c[_0xeb4d('0x1f')]({'plain':!![]});var _0x20b5f1=_0xeb4d('0x20');return db[_0xeb4d('0x21')][_0xeb4d('0x22')]({'where':{'type':_0x20b5f1,'resourceId':_0x1565e7['id']}})['then'](function(){return _0x3ba42c;});})[_0xeb4d('0x1e')](function(){_0x18bff5['status'](0xcc)[_0xeb4d('0x13')]();});}};}function handleEntityNotFound(_0x664fba,_0x1e0960){return function(_0x2d43d7){if(!_0x2d43d7){_0x664fba[_0xeb4d('0x12')](0x194);}return _0x2d43d7;};}function handleError(_0x450b70,_0x388d9b){_0x388d9b=_0x388d9b||0x1f4;return function(_0x3d8ad7){logger[_0xeb4d('0x23')](_0x3d8ad7[_0xeb4d('0x24')]);if(_0x3d8ad7[_0xeb4d('0x25')]){delete _0x3d8ad7[_0xeb4d('0x25')];}_0x450b70[_0xeb4d('0x14')](_0x388d9b)[_0xeb4d('0x26')](_0x3d8ad7);};}exports['index']=function(_0x4954de,_0x4fec54){var _0x21eb7d={},_0x5adce6={},_0x4b0101={'count':0x0,'rows':[]};var _0x14ac35=_['map'](db[_0xeb4d('0x27')][_0xeb4d('0x28')],function(_0x456fc2){return{'name':_0x456fc2[_0xeb4d('0x29')],'type':_0x456fc2[_0xeb4d('0x2a')]['key']};});_0x5adce6[_0xeb4d('0x2b')]=_[_0xeb4d('0x2c')](_0x14ac35,_0xeb4d('0x25'));_0x5adce6[_0xeb4d('0x2d')]=_[_0xeb4d('0x2e')](_0x4954de[_0xeb4d('0x2d')]);_0x5adce6[_0xeb4d('0x2f')]=_['intersection'](_0x5adce6[_0xeb4d('0x2b')],_0x5adce6['query']);_0x21eb7d[_0xeb4d('0x30')]=_['intersection'](_0x5adce6[_0xeb4d('0x2b')],qs[_0xeb4d('0x31')](_0x4954de[_0xeb4d('0x2d')][_0xeb4d('0x31')]));_0x21eb7d[_0xeb4d('0x30')]=_0x21eb7d[_0xeb4d('0x30')][_0xeb4d('0x32')]?_0x21eb7d[_0xeb4d('0x30')]:_0x5adce6['model'];if(!_0x4954de[_0xeb4d('0x2d')]['hasOwnProperty']('nolimit')){_0x21eb7d['limit']=qs['limit'](_0x4954de[_0xeb4d('0x2d')][_0xeb4d('0x17')]);_0x21eb7d[_0xeb4d('0x15')]=qs[_0xeb4d('0x15')](_0x4954de[_0xeb4d('0x2d')]['offset']);}_0x21eb7d[_0xeb4d('0x33')]=qs[_0xeb4d('0x34')](_0x4954de[_0xeb4d('0x2d')][_0xeb4d('0x34')]);_0x21eb7d['where']=qs['filters'](_[_0xeb4d('0x35')](_0x4954de[_0xeb4d('0x2d')],_0x5adce6[_0xeb4d('0x2f')]),_0x14ac35);if(_0x4954de['query'][_0xeb4d('0x36')]){_0x21eb7d[_0xeb4d('0x37')]=_[_0xeb4d('0x38')](_0x21eb7d[_0xeb4d('0x37')],{'$or':_[_0xeb4d('0x2c')](_0x14ac35,function(_0x5d0afe){if(_0x5d0afe['type']!==_0xeb4d('0x39')){var _0x2049c4={};_0x2049c4[_0x5d0afe['name']]={'$like':'%'+_0x4954de[_0xeb4d('0x2d')][_0xeb4d('0x36')]+'%'};return _0x2049c4;}})});}_0x21eb7d=_['merge']({},_0x21eb7d,_0x4954de[_0xeb4d('0x3a')]);var _0x660c0d={'where':_0x21eb7d[_0xeb4d('0x37')]};return db[_0xeb4d('0x27')]['count'](_0x660c0d)[_0xeb4d('0x1e')](function(_0x51be74){_0x4b0101[_0xeb4d('0x18')]=_0x51be74;if(_0x4954de[_0xeb4d('0x2d')]['includeAll']){_0x21eb7d[_0xeb4d('0x3b')]=[{'all':!![]}];}return db[_0xeb4d('0x27')]['findAll'](_0x21eb7d);})[_0xeb4d('0x1e')](function(_0x44309d){_0x4b0101[_0xeb4d('0x3c')]=_0x44309d;return _0x4b0101;})[_0xeb4d('0x1e')](respondWithFilteredResult(_0x4fec54,_0x21eb7d))['catch'](handleError(_0x4fec54,null));};exports[_0xeb4d('0x3d')]=function(_0x5b898d,_0x142373){var _0x7c63c7={'raw':![],'where':{'id':_0x5b898d[_0xeb4d('0x3e')]['id']}},_0x530845={};_0x530845[_0xeb4d('0x2b')]=_[_0xeb4d('0x2e')](db['Trigger'][_0xeb4d('0x28')]);_0x530845[_0xeb4d('0x2d')]=_['keys'](_0x5b898d['query']);_0x530845['filters']=_[_0xeb4d('0x3f')](_0x530845[_0xeb4d('0x2b')],_0x530845['query']);_0x7c63c7['attributes']=_[_0xeb4d('0x3f')](_0x530845[_0xeb4d('0x2b')],qs['fields'](_0x5b898d[_0xeb4d('0x2d')][_0xeb4d('0x31')]));_0x7c63c7[_0xeb4d('0x30')]=_0x7c63c7[_0xeb4d('0x30')]['length']?_0x7c63c7[_0xeb4d('0x30')]:_0x530845[_0xeb4d('0x2b')];if(_0x5b898d[_0xeb4d('0x2d')]['includeAll']){_0x7c63c7[_0xeb4d('0x3b')]=[{'all':!![]}];}_0x7c63c7=_[_0xeb4d('0x38')]({},_0x7c63c7,_0x5b898d[_0xeb4d('0x3a')]);return db['Trigger']['find'](_0x7c63c7)[_0xeb4d('0x1e')](handleEntityNotFound(_0x142373,null))['then'](respondWithResult(_0x142373,null))[_0xeb4d('0x40')](handleError(_0x142373,null));};exports['create']=function(_0xacc744,_0x469b2e){return db[_0xeb4d('0x27')][_0xeb4d('0x41')](_0xacc744[_0xeb4d('0x42')],{})['then'](function(_0x16c69d){var _0x579ed6=_0xacc744[_0xeb4d('0x43')][_0xeb4d('0x1f')]({'plain':!![]});if(!_0x579ed6)throw new Error(_0xeb4d('0x44'));if(_0x579ed6[_0xeb4d('0x45')]==='user'){var _0x2c8720=_0x16c69d['get']({'plain':!![]});var _0x571a43='Triggers';return db['UserProfileSection'][_0xeb4d('0x46')]({'where':{'name':_0x571a43,'userProfileId':_0x579ed6[_0xeb4d('0x47')]},'raw':!![]})[_0xeb4d('0x1e')](function(_0x57026d){if(_0x57026d&&_0x57026d[_0xeb4d('0x48')]===0x0){return db[_0xeb4d('0x21')][_0xeb4d('0x41')]({'name':_0x2c8720['name'],'resourceId':_0x2c8720['id'],'type':_0x57026d['name'],'sectionId':_0x57026d['id']},{})[_0xeb4d('0x1e')](function(){return _0x16c69d;});}else{return _0x16c69d;}})['catch'](function(_0x4f66cc){logger['error'](_0xeb4d('0x49'),_0x4f66cc);throw _0x4f66cc;});}return _0x16c69d;})['then'](respondWithResult(_0x469b2e,0xc9))[_0xeb4d('0x40')](handleError(_0x469b2e,null));};exports['update']=function(_0x40eee5,_0x5466d0){if(_0x40eee5[_0xeb4d('0x42')]['id']){delete _0x40eee5[_0xeb4d('0x42')]['id'];}return db[_0xeb4d('0x27')][_0xeb4d('0x46')]({'where':{'id':_0x40eee5[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0x5466d0,null))[_0xeb4d('0x1e')](saveUpdates(_0x40eee5[_0xeb4d('0x42')],null))[_0xeb4d('0x1e')](respondWithResult(_0x5466d0,null))[_0xeb4d('0x40')](handleError(_0x5466d0,null));};exports[_0xeb4d('0x22')]=function(_0x41b93b,_0x1afadb){return db['Trigger'][_0xeb4d('0x46')]({'where':{'id':_0x41b93b[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0x1afadb,null))[_0xeb4d('0x1e')](removeEntity(_0x1afadb,null))[_0xeb4d('0x40')](handleError(_0x1afadb,null));};exports[_0xeb4d('0x4a')]=function(_0x5755b1,_0x69bbc7,_0x2499ee){if(_0x5755b1['body']['id']){delete _0x5755b1[_0xeb4d('0x42')]['id'];}return db[_0xeb4d('0x27')][_0xeb4d('0x46')]({'where':{'id':_0x5755b1[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0x69bbc7,null))['then'](function(_0x49278a){if(_0x49278a){_0x5755b1[_0xeb4d('0x42')][_0xeb4d('0x4b')]=_0x49278a['id'];return db['Condition'][_0xeb4d('0x41')](_0x5755b1[_0xeb4d('0x42')]);}})[_0xeb4d('0x1e')](respondWithResult(_0x69bbc7,null))[_0xeb4d('0x40')](handleError(_0x69bbc7,null));};exports[_0xeb4d('0x4c')]=function(_0x10467b,_0x112fb0,_0x3f58f6){if(_0x10467b[_0xeb4d('0x42')]['id']){delete _0x10467b[_0xeb4d('0x42')]['id'];}return db[_0xeb4d('0x27')][_0xeb4d('0x46')]({'where':{'id':_0x10467b[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0x112fb0,null))['then'](function(_0x122fbd){if(_0x122fbd){_0x10467b[_0xeb4d('0x42')][_0xeb4d('0x4d')]=_0x122fbd['id'];return db[_0xeb4d('0x4e')][_0xeb4d('0x41')](_0x10467b[_0xeb4d('0x42')]);}})[_0xeb4d('0x1e')](respondWithResult(_0x112fb0,null))[_0xeb4d('0x40')](handleError(_0x112fb0,null));};exports[_0xeb4d('0x4f')]=function(_0x1a31c3,_0xb7ab2c,_0x6efbaf){var _0x28be1b={};var _0x549ac2={};var _0x13fe80;var _0xf886a0;return db[_0xeb4d('0x27')][_0xeb4d('0x50')]({'where':{'id':_0x1a31c3[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0xb7ab2c,null))['then'](function(_0x270590){if(_0x270590){_0x13fe80=_0x270590;_0x549ac2[_0xeb4d('0x2b')]=_[_0xeb4d('0x2e')](db[_0xeb4d('0x4e')][_0xeb4d('0x28')]);_0x549ac2[_0xeb4d('0x2d')]=_[_0xeb4d('0x2e')](_0x1a31c3[_0xeb4d('0x2d')]);_0x549ac2[_0xeb4d('0x2f')]=_[_0xeb4d('0x3f')](_0x549ac2[_0xeb4d('0x2b')],_0x549ac2[_0xeb4d('0x2d')]);_0x28be1b[_0xeb4d('0x30')]=_[_0xeb4d('0x3f')](_0x549ac2[_0xeb4d('0x2b')],qs['fields'](_0x1a31c3[_0xeb4d('0x2d')][_0xeb4d('0x31')]));_0x28be1b['attributes']=_0x28be1b['attributes']['length']?_0x28be1b[_0xeb4d('0x30')]:_0x549ac2[_0xeb4d('0x2b')];_0x28be1b[_0xeb4d('0x33')]=qs[_0xeb4d('0x34')](_0x1a31c3[_0xeb4d('0x2d')][_0xeb4d('0x34')]);_0x28be1b[_0xeb4d('0x37')]=qs['filters'](_[_0xeb4d('0x35')](_0x1a31c3[_0xeb4d('0x2d')],_0x549ac2['filters']));if(_0x1a31c3[_0xeb4d('0x2d')][_0xeb4d('0x36')]){_0x28be1b[_0xeb4d('0x37')]=_[_0xeb4d('0x38')](_0x28be1b[_0xeb4d('0x37')],{'$or':_[_0xeb4d('0x2c')](_0x28be1b[_0xeb4d('0x30')],function(_0x3eb2c6){var _0x20b32e={};_0x20b32e[_0x3eb2c6]={'$like':'%'+_0x1a31c3['query'][_0xeb4d('0x36')]+'%'};return _0x20b32e;})});}_0x28be1b=_[_0xeb4d('0x38')]({},_0x28be1b,_0x1a31c3['options']);return _0x13fe80[_0xeb4d('0x4f')](_0x28be1b);}})['then'](function(_0x4b433b){if(_0x4b433b){_0xf886a0=_0x4b433b['length'];if(!_0x1a31c3[_0xeb4d('0x2d')][_0xeb4d('0x51')](_0xeb4d('0x52'))){_0x28be1b['limit']=qs[_0xeb4d('0x17')](_0x1a31c3[_0xeb4d('0x2d')][_0xeb4d('0x17')]);_0x28be1b['offset']=qs[_0xeb4d('0x15')](_0x1a31c3['query'][_0xeb4d('0x15')]);}return _0x13fe80[_0xeb4d('0x4f')](_0x28be1b);}})[_0xeb4d('0x1e')](function(_0x299159){if(_0x299159){return _0x299159?{'count':_0xf886a0,'rows':_0x299159}:null;}})[_0xeb4d('0x1e')](respondWithResult(_0xb7ab2c,null))['catch'](handleError(_0xb7ab2c,null));};exports['getAnyConditions']=function(_0x1787d2,_0x337916,_0x5467ff){var _0x1b91d0={};var _0x30c2c0={};var _0x29887d;var _0x2541d6;return db['Trigger'][_0xeb4d('0x50')]({'where':{'id':_0x1787d2[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0x337916,null))[_0xeb4d('0x1e')](function(_0x17089d){if(_0x17089d){_0x29887d=_0x17089d;_0x30c2c0[_0xeb4d('0x2b')]=_[_0xeb4d('0x2e')](db[_0xeb4d('0x4e')][_0xeb4d('0x28')]);_0x30c2c0[_0xeb4d('0x2d')]=_[_0xeb4d('0x2e')](_0x1787d2[_0xeb4d('0x2d')]);_0x30c2c0['filters']=_[_0xeb4d('0x3f')](_0x30c2c0[_0xeb4d('0x2b')],_0x30c2c0[_0xeb4d('0x2d')]);_0x1b91d0[_0xeb4d('0x30')]=_[_0xeb4d('0x3f')](_0x30c2c0[_0xeb4d('0x2b')],qs[_0xeb4d('0x31')](_0x1787d2[_0xeb4d('0x2d')][_0xeb4d('0x31')]));_0x1b91d0['attributes']=_0x1b91d0[_0xeb4d('0x30')][_0xeb4d('0x32')]?_0x1b91d0['attributes']:_0x30c2c0['model'];_0x1b91d0['order']=qs[_0xeb4d('0x34')](_0x1787d2['query']['sort']);_0x1b91d0['where']=qs[_0xeb4d('0x2f')](_['pick'](_0x1787d2[_0xeb4d('0x2d')],_0x30c2c0[_0xeb4d('0x2f')]));if(_0x1787d2[_0xeb4d('0x2d')][_0xeb4d('0x36')]){_0x1b91d0[_0xeb4d('0x37')]=_['merge'](_0x1b91d0[_0xeb4d('0x37')],{'$or':_[_0xeb4d('0x2c')](_0x1b91d0['attributes'],function(_0x13f952){var _0x2c403a={};_0x2c403a[_0x13f952]={'$like':'%'+_0x1787d2[_0xeb4d('0x2d')][_0xeb4d('0x36')]+'%'};return _0x2c403a;})});}_0x1b91d0=_[_0xeb4d('0x38')]({},_0x1b91d0,_0x1787d2[_0xeb4d('0x3a')]);return _0x29887d[_0xeb4d('0x53')](_0x1b91d0);}})[_0xeb4d('0x1e')](function(_0x1d247a){if(_0x1d247a){_0x2541d6=_0x1d247a[_0xeb4d('0x32')];if(!_0x1787d2[_0xeb4d('0x2d')][_0xeb4d('0x51')](_0xeb4d('0x52'))){_0x1b91d0[_0xeb4d('0x17')]=qs[_0xeb4d('0x17')](_0x1787d2['query'][_0xeb4d('0x17')]);_0x1b91d0[_0xeb4d('0x15')]=qs[_0xeb4d('0x15')](_0x1787d2[_0xeb4d('0x2d')][_0xeb4d('0x15')]);}return _0x29887d[_0xeb4d('0x53')](_0x1b91d0);}})[_0xeb4d('0x1e')](function(_0x4eb9b6){if(_0x4eb9b6){return _0x4eb9b6?{'count':_0x2541d6,'rows':_0x4eb9b6}:null;}})[_0xeb4d('0x1e')](respondWithResult(_0x337916,null))[_0xeb4d('0x40')](handleError(_0x337916,null));};exports['addAction']=function(_0x1612ab,_0x76f33f,_0xebd4df){if(_0x1612ab[_0xeb4d('0x42')]['id']){delete _0x1612ab[_0xeb4d('0x42')]['id'];}return db[_0xeb4d('0x27')][_0xeb4d('0x46')]({'where':{'id':_0x1612ab[_0xeb4d('0x3e')]['id']}})[_0xeb4d('0x1e')](handleEntityNotFound(_0x76f33f,null))[_0xeb4d('0x1e')](function(_0x51155){if(_0x51155){_0x1612ab['body'][_0xeb4d('0x54')]=_0x51155['id'];return db[_0xeb4d('0x55')][_0xeb4d('0x41')](_0x1612ab[_0xeb4d('0x42')]);}})['then'](respondWithResult(_0x76f33f,null))[_0xeb4d('0x40')](handleError(_0x76f33f,null));};exports[_0xeb4d('0x56')]=function(_0x1da28c,_0x158e5e,_0x1bb9ed){var _0x4d8b0e={};var _0x24f5d4={};var _0x1b59b2;var _0x5fe48e;return db[_0xeb4d('0x27')][_0xeb4d('0x50')]({'where':{'id':_0x1da28c['params']['id']}})['then'](handleEntityNotFound(_0x158e5e,null))['then'](function(_0x3db5c7){if(_0x3db5c7){_0x1b59b2=_0x3db5c7;_0x24f5d4[_0xeb4d('0x2b')]=_[_0xeb4d('0x2e')](db['Action']['rawAttributes']);_0x24f5d4[_0xeb4d('0x2d')]=_[_0xeb4d('0x2e')](_0x1da28c[_0xeb4d('0x2d')]);_0x24f5d4[_0xeb4d('0x2f')]=_['intersection'](_0x24f5d4[_0xeb4d('0x2b')],_0x24f5d4['query']);_0x4d8b0e[_0xeb4d('0x30')]=_[_0xeb4d('0x3f')](_0x24f5d4[_0xeb4d('0x2b')],qs[_0xeb4d('0x31')](_0x1da28c[_0xeb4d('0x2d')][_0xeb4d('0x31')]));_0x4d8b0e[_0xeb4d('0x30')]=_0x4d8b0e[_0xeb4d('0x30')][_0xeb4d('0x32')]?_0x4d8b0e[_0xeb4d('0x30')]:_0x24f5d4[_0xeb4d('0x2b')];_0x4d8b0e['order']=qs[_0xeb4d('0x34')](_0x1da28c[_0xeb4d('0x2d')]['sort']);_0x4d8b0e[_0xeb4d('0x37')]=qs[_0xeb4d('0x2f')](_[_0xeb4d('0x35')](_0x1da28c[_0xeb4d('0x2d')],_0x24f5d4['filters']));if(_0x1da28c[_0xeb4d('0x2d')][_0xeb4d('0x36')]){_0x4d8b0e[_0xeb4d('0x37')]=_['merge'](_0x4d8b0e[_0xeb4d('0x37')],{'$or':_[_0xeb4d('0x2c')](_0x4d8b0e[_0xeb4d('0x30')],function(_0x19dce1){var _0x9051ec={};_0x9051ec[_0x19dce1]={'$like':'%'+_0x1da28c[_0xeb4d('0x2d')]['filter']+'%'};return _0x9051ec;})});}_0x4d8b0e=_[_0xeb4d('0x38')]({},_0x4d8b0e,_0x1da28c['options']);return _0x1b59b2[_0xeb4d('0x56')](_0x4d8b0e);}})[_0xeb4d('0x1e')](function(_0x1f696a){if(_0x1f696a){_0x5fe48e=_0x1f696a[_0xeb4d('0x32')];if(!_0x1da28c['query']['hasOwnProperty']('nolimit')){_0x4d8b0e[_0xeb4d('0x17')]=qs[_0xeb4d('0x17')](_0x1da28c['query'][_0xeb4d('0x17')]);_0x4d8b0e[_0xeb4d('0x15')]=qs[_0xeb4d('0x15')](_0x1da28c[_0xeb4d('0x2d')][_0xeb4d('0x15')]);}return _0x1b59b2[_0xeb4d('0x56')](_0x4d8b0e);}})[_0xeb4d('0x1e')](function(_0x45882f){if(_0x45882f){return _0x45882f?{'count':_0x5fe48e,'rows':_0x45882f}:null;}})[_0xeb4d('0x1e')](respondWithResult(_0x158e5e,null))['catch'](handleError(_0x158e5e,null));}; \ No newline at end of file +var _0xe7be=['send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Triggers','end','error','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7be,0x1ae));var _0xee7b=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0xe7be[_0x5ec9db];return _0xfc7061;};'use strict';var emlformat=require(_0xee7b('0x0'));var rimraf=require(_0xee7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee7b('0x2'));var rp=require('request-promise');var moment=require(_0xee7b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee7b('0x4'));var util=require('util');var path=require(_0xee7b('0x5'));var sox=require(_0xee7b('0x6'));var csv=require(_0xee7b('0x7'));var ejs=require(_0xee7b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee7b('0x9'));var crypto=require(_0xee7b('0xa'));var jsforce=require(_0xee7b('0xb'));var deskjs=require(_0xee7b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee7b('0xd'));var Redis=require('ioredis');var authService=require(_0xee7b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xee7b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7b('0x10'))(_0xee7b('0x11'));var utils=require(_0xee7b('0x12'));var config=require(_0xee7b('0x13'));var licenseUtil=require(_0xee7b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5676ec,_0x4c7048){_0x4c7048=_0x4c7048||0xcc;return function(_0x20a41c){if(_0x20a41c){return _0x5676ec[_0xee7b('0x15')](_0x4c7048);}return _0x5676ec[_0xee7b('0x16')](_0x4c7048)['end']();};}function respondWithResult(_0x5cc005,_0x70c9d6){_0x70c9d6=_0x70c9d6||0xc8;return function(_0x492131){if(_0x492131){return _0x5cc005[_0xee7b('0x16')](_0x70c9d6)['json'](_0x492131);}};}function respondWithFilteredResult(_0x2508db,_0x51a90e){return function(_0x57962e){if(_0x57962e){var _0x7e93cb=typeof _0x51a90e['offset']===_0xee7b('0x17')&&typeof _0x51a90e[_0xee7b('0x18')]===_0xee7b('0x17');var _0x1025cb=_0x57962e['count'];var _0x18c9c9=_0x7e93cb?0x0:_0x51a90e['offset'];var _0x37173f=_0x7e93cb?_0x57962e['count']:_0x51a90e[_0xee7b('0x19')]+_0x51a90e[_0xee7b('0x18')];var _0x22320e;if(_0x37173f>=_0x1025cb){_0x37173f=_0x1025cb;_0x22320e=0xc8;}else{_0x22320e=0xce;}_0x2508db[_0xee7b('0x16')](_0x22320e);return _0x2508db[_0xee7b('0x1a')](_0xee7b('0x1b'),_0x18c9c9+'-'+_0x37173f+'/'+_0x1025cb)[_0xee7b('0x1c')](_0x57962e);}return null;};}function patchUpdates(_0xea641b){return function(_0x54cfd8){try{jsonpatch[_0xee7b('0x1d')](_0x54cfd8,_0xea641b,!![]);}catch(_0x6f2df6){return BPromise['reject'](_0x6f2df6);}return _0x54cfd8[_0xee7b('0x1e')]();};}function saveUpdates(_0x120c57,_0x1c0b42){return function(_0x530b37){if(_0x530b37){return _0x530b37[_0xee7b('0x1f')](_0x120c57)[_0xee7b('0x20')](function(_0x2de2ea){return _0x2de2ea;});}return null;};}function removeEntity(_0x1b578c,_0xb2dff9){return function(_0x5ec0e7){if(_0x5ec0e7){return _0x5ec0e7[_0xee7b('0x21')]()[_0xee7b('0x20')](function(){var _0x37b83c=_0x5ec0e7[_0xee7b('0x22')]({'plain':!![]});var _0x2dce41=_0xee7b('0x23');return db['UserProfileResource'][_0xee7b('0x21')]({'where':{'type':_0x2dce41,'resourceId':_0x37b83c['id']}})['then'](function(){return _0x5ec0e7;});})[_0xee7b('0x20')](function(){_0x1b578c[_0xee7b('0x16')](0xcc)[_0xee7b('0x24')]();});}};}function handleEntityNotFound(_0x48f241,_0x33adb){return function(_0x5104fc){if(!_0x5104fc){_0x48f241[_0xee7b('0x15')](0x194);}return _0x5104fc;};}function handleError(_0x3add99,_0x21045c){_0x21045c=_0x21045c||0x1f4;return function(_0x30c6e0){logger[_0xee7b('0x25')](_0x30c6e0[_0xee7b('0x26')]);if(_0x30c6e0[_0xee7b('0x27')]){delete _0x30c6e0[_0xee7b('0x27')];}_0x3add99[_0xee7b('0x16')](_0x21045c)[_0xee7b('0x28')](_0x30c6e0);};}exports[_0xee7b('0x29')]=function(_0x4096f6,_0x4e12c2){var _0xc8f7be={},_0x455e1a={},_0x462fc7={'count':0x0,'rows':[]};var _0x5304b5=_['map'](db['Trigger']['rawAttributes'],function(_0x48fc11){return{'name':_0x48fc11[_0xee7b('0x2a')],'type':_0x48fc11[_0xee7b('0x2b')][_0xee7b('0x2c')]};});_0x455e1a[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x5304b5,_0xee7b('0x27'));_0x455e1a[_0xee7b('0x2f')]=_[_0xee7b('0x30')](_0x4096f6[_0xee7b('0x2f')]);_0x455e1a[_0xee7b('0x31')]=_[_0xee7b('0x32')](_0x455e1a[_0xee7b('0x2d')],_0x455e1a[_0xee7b('0x2f')]);_0xc8f7be[_0xee7b('0x33')]=_[_0xee7b('0x32')](_0x455e1a['model'],qs[_0xee7b('0x34')](_0x4096f6[_0xee7b('0x2f')]['fields']));_0xc8f7be[_0xee7b('0x33')]=_0xc8f7be[_0xee7b('0x33')][_0xee7b('0x35')]?_0xc8f7be[_0xee7b('0x33')]:_0x455e1a[_0xee7b('0x2d')];if(!_0x4096f6['query'][_0xee7b('0x36')]('nolimit')){_0xc8f7be[_0xee7b('0x18')]=qs[_0xee7b('0x18')](_0x4096f6['query'][_0xee7b('0x18')]);_0xc8f7be[_0xee7b('0x19')]=qs['offset'](_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x19')]);}_0xc8f7be[_0xee7b('0x37')]=qs[_0xee7b('0x38')](_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x38')]);_0xc8f7be[_0xee7b('0x39')]=qs[_0xee7b('0x31')](_[_0xee7b('0x3a')](_0x4096f6[_0xee7b('0x2f')],_0x455e1a[_0xee7b('0x31')]),_0x5304b5);if(_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x3b')]){_0xc8f7be['where']=_[_0xee7b('0x3c')](_0xc8f7be['where'],{'$or':_[_0xee7b('0x2e')](_0x5304b5,function(_0x4b7d27){if(_0x4b7d27[_0xee7b('0x2b')]!==_0xee7b('0x3d')){var _0x304d03={};_0x304d03[_0x4b7d27[_0xee7b('0x27')]]={'$like':'%'+_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x3b')]+'%'};return _0x304d03;}})});}_0xc8f7be=_[_0xee7b('0x3c')]({},_0xc8f7be,_0x4096f6[_0xee7b('0x3e')]);var _0x48be9f={'where':_0xc8f7be[_0xee7b('0x39')]};return db[_0xee7b('0x3f')][_0xee7b('0x40')](_0x48be9f)[_0xee7b('0x20')](function(_0xa30ef2){_0x462fc7[_0xee7b('0x40')]=_0xa30ef2;if(_0x4096f6['query'][_0xee7b('0x41')]){_0xc8f7be[_0xee7b('0x42')]=[{'all':!![]}];}return db[_0xee7b('0x3f')][_0xee7b('0x43')](_0xc8f7be);})[_0xee7b('0x20')](function(_0x56ea61){_0x462fc7[_0xee7b('0x44')]=_0x56ea61;return _0x462fc7;})[_0xee7b('0x20')](respondWithFilteredResult(_0x4e12c2,_0xc8f7be))[_0xee7b('0x45')](handleError(_0x4e12c2,null));};exports[_0xee7b('0x46')]=function(_0x1cfb2c,_0x28fe65){var _0x5d66f1={'raw':![],'where':{'id':_0x1cfb2c[_0xee7b('0x47')]['id']}},_0x19933a={};_0x19933a['model']=_[_0xee7b('0x30')](db[_0xee7b('0x3f')][_0xee7b('0x48')]);_0x19933a[_0xee7b('0x2f')]=_['keys'](_0x1cfb2c['query']);_0x19933a['filters']=_['intersection'](_0x19933a['model'],_0x19933a[_0xee7b('0x2f')]);_0x5d66f1[_0xee7b('0x33')]=_['intersection'](_0x19933a[_0xee7b('0x2d')],qs[_0xee7b('0x34')](_0x1cfb2c[_0xee7b('0x2f')][_0xee7b('0x34')]));_0x5d66f1[_0xee7b('0x33')]=_0x5d66f1[_0xee7b('0x33')][_0xee7b('0x35')]?_0x5d66f1[_0xee7b('0x33')]:_0x19933a[_0xee7b('0x2d')];if(_0x1cfb2c[_0xee7b('0x2f')]['includeAll']){_0x5d66f1[_0xee7b('0x42')]=[{'all':!![]}];}_0x5d66f1=_[_0xee7b('0x3c')]({},_0x5d66f1,_0x1cfb2c['options']);return db[_0xee7b('0x3f')]['find'](_0x5d66f1)['then'](handleEntityNotFound(_0x28fe65,null))['then'](respondWithResult(_0x28fe65,null))[_0xee7b('0x45')](handleError(_0x28fe65,null));};exports[_0xee7b('0x49')]=function(_0x6956a,_0x4159ae){return db[_0xee7b('0x3f')][_0xee7b('0x49')](_0x6956a[_0xee7b('0x4a')],{})['then'](function(_0x184ba4){var _0x3c6287=_0x6956a[_0xee7b('0x4b')][_0xee7b('0x22')]({'plain':!![]});if(!_0x3c6287)throw new Error(_0xee7b('0x4c'));if(_0x3c6287[_0xee7b('0x4d')]===_0xee7b('0x4b')){var _0x174032=_0x184ba4[_0xee7b('0x22')]({'plain':!![]});var _0x4a6358=_0xee7b('0x23');return db[_0xee7b('0x4e')]['find']({'where':{'name':_0x4a6358,'userProfileId':_0x3c6287[_0xee7b('0x4f')]},'raw':!![]})['then'](function(_0x12a225){if(_0x12a225&&_0x12a225[_0xee7b('0x50')]===0x0){return db['UserProfileResource'][_0xee7b('0x49')]({'name':_0x174032[_0xee7b('0x27')],'resourceId':_0x174032['id'],'type':_0x12a225[_0xee7b('0x27')],'sectionId':_0x12a225['id']},{})[_0xee7b('0x20')](function(){return _0x184ba4;});}else{return _0x184ba4;}})[_0xee7b('0x45')](function(_0x474d4b){logger[_0xee7b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474d4b);throw _0x474d4b;});}return _0x184ba4;})[_0xee7b('0x20')](respondWithResult(_0x4159ae,0xc9))[_0xee7b('0x45')](handleError(_0x4159ae,null));};exports['update']=function(_0x3e1543,_0x18abb8){if(_0x3e1543[_0xee7b('0x4a')]['id']){delete _0x3e1543['body']['id'];}return db['Trigger'][_0xee7b('0x51')]({'where':{'id':_0x3e1543[_0xee7b('0x47')]['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x18abb8,null))['then'](saveUpdates(_0x3e1543[_0xee7b('0x4a')],null))[_0xee7b('0x20')](respondWithResult(_0x18abb8,null))[_0xee7b('0x45')](handleError(_0x18abb8,null));};exports[_0xee7b('0x21')]=function(_0x23511c,_0xc78ca0){return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x23511c[_0xee7b('0x47')]['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0xc78ca0,null))[_0xee7b('0x20')](removeEntity(_0xc78ca0,null))[_0xee7b('0x45')](handleError(_0xc78ca0,null));};exports[_0xee7b('0x52')]=function(_0x225f02,_0x4bd59d,_0x206598){if(_0x225f02[_0xee7b('0x4a')]['id']){delete _0x225f02[_0xee7b('0x4a')]['id'];}return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x225f02[_0xee7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bd59d,null))['then'](function(_0x107f29){if(_0x107f29){_0x225f02['body'][_0xee7b('0x53')]=_0x107f29['id'];return db[_0xee7b('0x54')][_0xee7b('0x49')](_0x225f02[_0xee7b('0x4a')]);}})[_0xee7b('0x20')](respondWithResult(_0x4bd59d,null))[_0xee7b('0x45')](handleError(_0x4bd59d,null));};exports[_0xee7b('0x55')]=function(_0x5a428d,_0x27d2f8,_0x52236c){if(_0x5a428d['body']['id']){delete _0x5a428d[_0xee7b('0x4a')]['id'];}return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x5a428d['params']['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x27d2f8,null))[_0xee7b('0x20')](function(_0x185f8f){if(_0x185f8f){_0x5a428d['body'][_0xee7b('0x56')]=_0x185f8f['id'];return db[_0xee7b('0x54')][_0xee7b('0x49')](_0x5a428d[_0xee7b('0x4a')]);}})[_0xee7b('0x20')](respondWithResult(_0x27d2f8,null))[_0xee7b('0x45')](handleError(_0x27d2f8,null));};exports[_0xee7b('0x57')]=function(_0x2c4a17,_0x262398,_0x409728){var _0x2ab65e={};var _0x1cb825={};var _0x19e255;var _0x432d4c;return db[_0xee7b('0x3f')]['findOne']({'where':{'id':_0x2c4a17['params']['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x262398,null))['then'](function(_0x4244fe){if(_0x4244fe){_0x19e255=_0x4244fe;_0x1cb825[_0xee7b('0x2d')]=_[_0xee7b('0x30')](db['Condition'][_0xee7b('0x48')]);_0x1cb825[_0xee7b('0x2f')]=_['keys'](_0x2c4a17['query']);_0x1cb825['filters']=_[_0xee7b('0x32')](_0x1cb825[_0xee7b('0x2d')],_0x1cb825['query']);_0x2ab65e[_0xee7b('0x33')]=_[_0xee7b('0x32')](_0x1cb825[_0xee7b('0x2d')],qs['fields'](_0x2c4a17['query'][_0xee7b('0x34')]));_0x2ab65e[_0xee7b('0x33')]=_0x2ab65e['attributes'][_0xee7b('0x35')]?_0x2ab65e['attributes']:_0x1cb825[_0xee7b('0x2d')];_0x2ab65e[_0xee7b('0x37')]=qs[_0xee7b('0x38')](_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x38')]);_0x2ab65e[_0xee7b('0x39')]=qs[_0xee7b('0x31')](_[_0xee7b('0x3a')](_0x2c4a17['query'],_0x1cb825[_0xee7b('0x31')]));if(_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x3b')]){_0x2ab65e[_0xee7b('0x39')]=_[_0xee7b('0x3c')](_0x2ab65e[_0xee7b('0x39')],{'$or':_[_0xee7b('0x2e')](_0x2ab65e['attributes'],function(_0x512442){var _0x149b80={};_0x149b80[_0x512442]={'$like':'%'+_0x2c4a17['query'][_0xee7b('0x3b')]+'%'};return _0x149b80;})});}_0x2ab65e=_[_0xee7b('0x3c')]({},_0x2ab65e,_0x2c4a17[_0xee7b('0x3e')]);return _0x19e255[_0xee7b('0x57')](_0x2ab65e);}})[_0xee7b('0x20')](function(_0x2c2d74){if(_0x2c2d74){_0x432d4c=_0x2c2d74[_0xee7b('0x35')];if(!_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x36')]('nolimit')){_0x2ab65e[_0xee7b('0x18')]=qs['limit'](_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x18')]);_0x2ab65e[_0xee7b('0x19')]=qs[_0xee7b('0x19')](_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x19')]);}return _0x19e255[_0xee7b('0x57')](_0x2ab65e);}})[_0xee7b('0x20')](function(_0x1e7a2d){if(_0x1e7a2d){return _0x1e7a2d?{'count':_0x432d4c,'rows':_0x1e7a2d}:null;}})[_0xee7b('0x20')](respondWithResult(_0x262398,null))[_0xee7b('0x45')](handleError(_0x262398,null));};exports['getAnyConditions']=function(_0x1e9390,_0x4db9b3,_0x468ae6){var _0x144193={};var _0x3bcb39={};var _0x2f75ed;var _0x38a835;return db['Trigger'][_0xee7b('0x58')]({'where':{'id':_0x1e9390[_0xee7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4db9b3,null))[_0xee7b('0x20')](function(_0x26b156){if(_0x26b156){_0x2f75ed=_0x26b156;_0x3bcb39[_0xee7b('0x2d')]=_[_0xee7b('0x30')](db[_0xee7b('0x54')][_0xee7b('0x48')]);_0x3bcb39['query']=_[_0xee7b('0x30')](_0x1e9390[_0xee7b('0x2f')]);_0x3bcb39['filters']=_['intersection'](_0x3bcb39['model'],_0x3bcb39[_0xee7b('0x2f')]);_0x144193[_0xee7b('0x33')]=_[_0xee7b('0x32')](_0x3bcb39[_0xee7b('0x2d')],qs['fields'](_0x1e9390['query']['fields']));_0x144193[_0xee7b('0x33')]=_0x144193[_0xee7b('0x33')][_0xee7b('0x35')]?_0x144193[_0xee7b('0x33')]:_0x3bcb39[_0xee7b('0x2d')];_0x144193[_0xee7b('0x37')]=qs['sort'](_0x1e9390['query'][_0xee7b('0x38')]);_0x144193[_0xee7b('0x39')]=qs['filters'](_[_0xee7b('0x3a')](_0x1e9390[_0xee7b('0x2f')],_0x3bcb39[_0xee7b('0x31')]));if(_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x3b')]){_0x144193[_0xee7b('0x39')]=_[_0xee7b('0x3c')](_0x144193['where'],{'$or':_[_0xee7b('0x2e')](_0x144193[_0xee7b('0x33')],function(_0x35f97a){var _0x1fd164={};_0x1fd164[_0x35f97a]={'$like':'%'+_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x3b')]+'%'};return _0x1fd164;})});}_0x144193=_[_0xee7b('0x3c')]({},_0x144193,_0x1e9390[_0xee7b('0x3e')]);return _0x2f75ed['getAnyConditions'](_0x144193);}})[_0xee7b('0x20')](function(_0x5055c6){if(_0x5055c6){_0x38a835=_0x5055c6[_0xee7b('0x35')];if(!_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x36')](_0xee7b('0x59'))){_0x144193['limit']=qs['limit'](_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x18')]);_0x144193[_0xee7b('0x19')]=qs[_0xee7b('0x19')](_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x19')]);}return _0x2f75ed['getAnyConditions'](_0x144193);}})[_0xee7b('0x20')](function(_0x23343e){if(_0x23343e){return _0x23343e?{'count':_0x38a835,'rows':_0x23343e}:null;}})[_0xee7b('0x20')](respondWithResult(_0x4db9b3,null))[_0xee7b('0x45')](handleError(_0x4db9b3,null));};exports[_0xee7b('0x5a')]=function(_0x2412a9,_0x4ec3b1,_0x2703bd){if(_0x2412a9[_0xee7b('0x4a')]['id']){delete _0x2412a9[_0xee7b('0x4a')]['id'];}return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x2412a9[_0xee7b('0x47')]['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x4ec3b1,null))[_0xee7b('0x20')](function(_0x49f8e1){if(_0x49f8e1){_0x2412a9[_0xee7b('0x4a')][_0xee7b('0x5b')]=_0x49f8e1['id'];return db[_0xee7b('0x5c')][_0xee7b('0x49')](_0x2412a9[_0xee7b('0x4a')]);}})[_0xee7b('0x20')](respondWithResult(_0x4ec3b1,null))['catch'](handleError(_0x4ec3b1,null));};exports[_0xee7b('0x5d')]=function(_0x30fa88,_0x38a615,_0x57a186){var _0x5464fc={};var _0x38bdaa={};var _0x2a2dea;var _0x4d086d;return db[_0xee7b('0x3f')][_0xee7b('0x58')]({'where':{'id':_0x30fa88[_0xee7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x38a615,null))[_0xee7b('0x20')](function(_0x2d1b5b){if(_0x2d1b5b){_0x2a2dea=_0x2d1b5b;_0x38bdaa[_0xee7b('0x2d')]=_[_0xee7b('0x30')](db[_0xee7b('0x5c')][_0xee7b('0x48')]);_0x38bdaa['query']=_[_0xee7b('0x30')](_0x30fa88[_0xee7b('0x2f')]);_0x38bdaa['filters']=_[_0xee7b('0x32')](_0x38bdaa[_0xee7b('0x2d')],_0x38bdaa[_0xee7b('0x2f')]);_0x5464fc[_0xee7b('0x33')]=_['intersection'](_0x38bdaa['model'],qs[_0xee7b('0x34')](_0x30fa88[_0xee7b('0x2f')][_0xee7b('0x34')]));_0x5464fc[_0xee7b('0x33')]=_0x5464fc[_0xee7b('0x33')][_0xee7b('0x35')]?_0x5464fc['attributes']:_0x38bdaa['model'];_0x5464fc[_0xee7b('0x37')]=qs['sort'](_0x30fa88['query'][_0xee7b('0x38')]);_0x5464fc[_0xee7b('0x39')]=qs['filters'](_[_0xee7b('0x3a')](_0x30fa88[_0xee7b('0x2f')],_0x38bdaa[_0xee7b('0x31')]));if(_0x30fa88[_0xee7b('0x2f')]['filter']){_0x5464fc[_0xee7b('0x39')]=_[_0xee7b('0x3c')](_0x5464fc[_0xee7b('0x39')],{'$or':_[_0xee7b('0x2e')](_0x5464fc[_0xee7b('0x33')],function(_0x97a3c6){var _0x1883f6={};_0x1883f6[_0x97a3c6]={'$like':'%'+_0x30fa88['query'][_0xee7b('0x3b')]+'%'};return _0x1883f6;})});}_0x5464fc=_[_0xee7b('0x3c')]({},_0x5464fc,_0x30fa88['options']);return _0x2a2dea[_0xee7b('0x5d')](_0x5464fc);}})[_0xee7b('0x20')](function(_0x34f7eb){if(_0x34f7eb){_0x4d086d=_0x34f7eb['length'];if(!_0x30fa88[_0xee7b('0x2f')]['hasOwnProperty'](_0xee7b('0x59'))){_0x5464fc[_0xee7b('0x18')]=qs[_0xee7b('0x18')](_0x30fa88['query'][_0xee7b('0x18')]);_0x5464fc[_0xee7b('0x19')]=qs[_0xee7b('0x19')](_0x30fa88[_0xee7b('0x2f')][_0xee7b('0x19')]);}return _0x2a2dea[_0xee7b('0x5d')](_0x5464fc);}})[_0xee7b('0x20')](function(_0x1cb422){if(_0x1cb422){return _0x1cb422?{'count':_0x4d086d,'rows':_0x1cb422}:null;}})[_0xee7b('0x20')](respondWithResult(_0x38a615,null))[_0xee7b('0x45')](handleError(_0x38a615,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f73978d..3f8185a 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 _0xf8b2=['util','../../config/logger','api','moment','bluebird','request-promise','path','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x4a02e5,_0x2cdf02){_0x4a02e5=_0x4a02e5-0x0;var _0x2e75b9=_0xf8b2[_0x4a02e5];return _0x2e75b9;};'use strict';var _=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var logger=require(_0x2f8b('0x2'))(_0x2f8b('0x3'));var moment=require(_0x2f8b('0x4'));var BPromise=require(_0x2f8b('0x5'));var rp=require(_0x2f8b('0x6'));var fs=require('fs');var path=require(_0x2f8b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f8b('0x8'));module[_0x2f8b('0x9')]=function(_0x3c6838,_0x1d133a){return _0x3c6838[_0x2f8b('0xa')](_0x2f8b('0xb'),attributes,{'tableName':_0x2f8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2b=['../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x58bc83,_0x20292c){_0x58bc83=_0x58bc83-0x0;var _0x15ca1c=_0xfa2b[_0x58bc83];return _0x15ca1c;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var attributes=require(_0xbfa2('0xa'));module[_0xbfa2('0xb')]=function(_0x12d71e,_0x237a99){return _0x12d71e[_0xbfa2('0xc')](_0xbfa2('0xd'),attributes,{'tableName':'tools_triggers','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 e14ecce..a7b188f 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 _0x2964=['include','model','debug','stringify','ShowTrigger','find','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2964,0x138));var _0x4296=function(_0x3d9bd6,_0x40c016){_0x3d9bd6=_0x3d9bd6-0x0;var _0x3c1654=_0x2964[_0x3d9bd6];return _0x3c1654;};'use strict';var _=require('lodash');var util=require(_0x4296('0x0'));var moment=require(_0x4296('0x1'));var BPromise=require('bluebird');var rs=require(_0x4296('0x2'));var fs=require('fs');var Redis=require(_0x4296('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4296('0x4'));var logger=require(_0x4296('0x5'))(_0x4296('0x6'));var config=require(_0x4296('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4296('0x8')][_0x4296('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2beea6,_0x4b42da,_0x52f997){return new BPromise(function(_0x1c9b88,_0x38c472){return client[_0x4296('0xa')](_0x2beea6,_0x52f997)[_0x4296('0xb')](function(_0xaad536){logger[_0x4296('0xc')](_0x4296('0xd'),_0x4b42da,_0x4296('0xe'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x4b42da,'request\x20sent',JSON['stringify'](_0xaad536));if(_0xaad536[_0x4296('0xf')]){if(_0xaad536[_0x4296('0xf')][_0x4296('0x10')]===0x1f4){logger[_0x4296('0xf')](_0x4296('0xd'),_0x4b42da,_0xaad536['error']['message']);return _0x38c472(_0xaad536[_0x4296('0xf')][_0x4296('0x11')]);}logger[_0x4296('0xf')](_0x4296('0xd'),_0x4b42da,_0xaad536[_0x4296('0xf')][_0x4296('0x11')]);return _0x1c9b88(_0xaad536[_0x4296('0xf')][_0x4296('0x11')]);}else{logger[_0x4296('0xc')](_0x4296('0xd'),_0x4b42da,'request\x20sent');_0x1c9b88(_0xaad536[_0x4296('0x12')][_0x4296('0x11')]);}})['catch'](function(_0x2cbba8){logger[_0x4296('0xf')](_0x4296('0xd'),_0x4b42da,_0x2cbba8);_0x38c472(_0x2cbba8);});});}exports[_0x4296('0x13')]=function(_0x360278){var _0x4fb7e7=this;return new Promise(function(_0x35c79a,_0x4c29db){return db[_0x4296('0x14')][_0x4296('0x15')]({'raw':_0x360278[_0x4296('0x16')]?_0x360278[_0x4296('0x16')][_0x4296('0x17')]===undefined?!![]:![]:!![],'where':_0x360278[_0x4296('0x16')]?_0x360278[_0x4296('0x16')][_0x4296('0x18')]||null:null,'attributes':_0x360278['options']?_0x360278[_0x4296('0x16')][_0x4296('0x19')]||null:null,'limit':_0x360278[_0x4296('0x16')]?_0x360278['options'][_0x4296('0x1a')]||null:null,'include':_0x360278['options']?_0x360278['options']['include']?_[_0x4296('0x1b')](_0x360278['options'][_0x4296('0x1c')],function(_0x83e2ff){return{'model':db[_0x83e2ff[_0x4296('0x1d')]],'as':_0x83e2ff['as'],'attributes':_0x83e2ff[_0x4296('0x19')],'include':_0x83e2ff[_0x4296('0x1c')]?_['map'](_0x83e2ff[_0x4296('0x1c')],function(_0x5effb8){return{'model':db[_0x5effb8[_0x4296('0x1d')]],'as':_0x5effb8['as'],'attributes':_0x5effb8[_0x4296('0x19')],'include':_0x5effb8[_0x4296('0x1c')]?_[_0x4296('0x1b')](_0x5effb8[_0x4296('0x1c')],function(_0x2c428c){return{'model':db[_0x2c428c[_0x4296('0x1d')]],'as':_0x2c428c['as'],'attributes':_0x2c428c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x245bb1){logger[_0x4296('0xc')](_0x4296('0x13'),_0x360278);logger[_0x4296('0x1e')]('GetTrigger',_0x360278,JSON[_0x4296('0x1f')](_0x245bb1));_0x35c79a(_0x245bb1);})['catch'](function(_0x1604ac){logger['error']('GetTrigger',_0x1604ac[_0x4296('0x11')],_0x360278);_0x4c29db(_0x4fb7e7[_0x4296('0xf')](0x1f4,_0x1604ac[_0x4296('0x11')]));});});};exports[_0x4296('0x20')]=function(_0x3fb00e){var _0x51e776=this;return new Promise(function(_0x337aad,_0x26b703){return db[_0x4296('0x14')][_0x4296('0x21')]({'raw':_0x3fb00e[_0x4296('0x16')]?_0x3fb00e[_0x4296('0x16')][_0x4296('0x17')]===undefined?!![]:![]:!![],'where':_0x3fb00e[_0x4296('0x16')]?_0x3fb00e[_0x4296('0x16')][_0x4296('0x18')]||null:null,'attributes':_0x3fb00e[_0x4296('0x16')]?_0x3fb00e[_0x4296('0x16')][_0x4296('0x19')]||null:null,'include':_0x3fb00e[_0x4296('0x16')]?_0x3fb00e[_0x4296('0x16')][_0x4296('0x1c')]?_['map'](_0x3fb00e['options']['include'],function(_0x144689){return{'model':db[_0x144689[_0x4296('0x1d')]],'as':_0x144689['as'],'attributes':_0x144689[_0x4296('0x19')],'include':_0x144689['include']?_[_0x4296('0x1b')](_0x144689['include'],function(_0x2fddb7){return{'model':db[_0x2fddb7['model']],'as':_0x2fddb7['as'],'attributes':_0x2fddb7[_0x4296('0x19')],'include':_0x2fddb7[_0x4296('0x1c')]?_['map'](_0x2fddb7['include'],function(_0x1683d8){return{'model':db[_0x1683d8[_0x4296('0x1d')]],'as':_0x1683d8['as'],'attributes':_0x1683d8[_0x4296('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4296('0xb')](function(_0x23ddd1){logger[_0x4296('0xc')](_0x4296('0x20'),_0x3fb00e);logger['debug'](_0x4296('0x20'),_0x3fb00e,JSON[_0x4296('0x1f')](_0x23ddd1));_0x337aad(_0x23ddd1);})['catch'](function(_0x480e69){logger[_0x4296('0xf')](_0x4296('0x20'),_0x480e69[_0x4296('0x11')],_0x3fb00e);_0x26b703(_0x51e776['error'](0x1f4,_0x480e69[_0x4296('0x11')]));});});}; \ No newline at end of file +var _0x8781=['options','raw','where','attributes','limit','map','include','model','then','ShowTrigger','find','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll'];(function(_0x2ae5f5,_0x43969f){var _0x49a40d=function(_0x255d17){while(--_0x255d17){_0x2ae5f5['push'](_0x2ae5f5['shift']());}};_0x49a40d(++_0x43969f);}(_0x8781,0xab));var _0x1878=function(_0x3f6d1a,_0x210c8a){_0x3f6d1a=_0x3f6d1a-0x0;var _0x2fb808=_0x8781[_0x3f6d1a];return _0x2fb808;};'use strict';var _=require('lodash');var util=require(_0x1878('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1878('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1878('0x2'))['db'];var utils=require(_0x1878('0x3'));var logger=require('../../config/logger')(_0x1878('0x4'));var config=require(_0x1878('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1878('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x176276,_0x1f5546,_0xc7a798){return new BPromise(function(_0x29ad65,_0x489b01){return client[_0x1878('0x7')](_0x176276,_0xc7a798)['then'](function(_0x2fd2cf){logger[_0x1878('0x8')](_0x1878('0x9'),_0x1f5546,_0x1878('0xa'));logger[_0x1878('0xb')](_0x1878('0xc'),_0x1f5546,_0x1878('0xa'),JSON[_0x1878('0xd')](_0x2fd2cf));if(_0x2fd2cf[_0x1878('0xe')]){if(_0x2fd2cf[_0x1878('0xe')][_0x1878('0xf')]===0x1f4){logger[_0x1878('0xe')](_0x1878('0x9'),_0x1f5546,_0x2fd2cf['error'][_0x1878('0x10')]);return _0x489b01(_0x2fd2cf[_0x1878('0xe')][_0x1878('0x10')]);}logger[_0x1878('0xe')](_0x1878('0x9'),_0x1f5546,_0x2fd2cf[_0x1878('0xe')][_0x1878('0x10')]);return _0x29ad65(_0x2fd2cf[_0x1878('0xe')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x1f5546,_0x1878('0xa'));_0x29ad65(_0x2fd2cf['result'][_0x1878('0x10')]);}})[_0x1878('0x11')](function(_0x53a63a){logger[_0x1878('0xe')]('Trigger,\x20%s,\x20%s',_0x1f5546,_0x53a63a);_0x489b01(_0x53a63a);});});}exports[_0x1878('0x12')]=function(_0x2068b5){var _0x2f5f14=this;return new Promise(function(_0x5004f2,_0x271705){return db[_0x1878('0x13')][_0x1878('0x14')]({'raw':_0x2068b5[_0x1878('0x15')]?_0x2068b5[_0x1878('0x15')][_0x1878('0x16')]===undefined?!![]:![]:!![],'where':_0x2068b5[_0x1878('0x15')]?_0x2068b5[_0x1878('0x15')][_0x1878('0x17')]||null:null,'attributes':_0x2068b5[_0x1878('0x15')]?_0x2068b5[_0x1878('0x15')][_0x1878('0x18')]||null:null,'limit':_0x2068b5[_0x1878('0x15')]?_0x2068b5['options'][_0x1878('0x19')]||null:null,'include':_0x2068b5['options']?_0x2068b5[_0x1878('0x15')]['include']?_[_0x1878('0x1a')](_0x2068b5[_0x1878('0x15')][_0x1878('0x1b')],function(_0x1fa9d9){return{'model':db[_0x1fa9d9['model']],'as':_0x1fa9d9['as'],'attributes':_0x1fa9d9[_0x1878('0x18')],'include':_0x1fa9d9[_0x1878('0x1b')]?_[_0x1878('0x1a')](_0x1fa9d9['include'],function(_0x2d5418){return{'model':db[_0x2d5418[_0x1878('0x1c')]],'as':_0x2d5418['as'],'attributes':_0x2d5418[_0x1878('0x18')],'include':_0x2d5418[_0x1878('0x1b')]?_['map'](_0x2d5418[_0x1878('0x1b')],function(_0x2403c2){return{'model':db[_0x2403c2[_0x1878('0x1c')]],'as':_0x2403c2['as'],'attributes':_0x2403c2[_0x1878('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1878('0x1d')](function(_0x16aace){logger['info'](_0x1878('0x12'),_0x2068b5);logger[_0x1878('0xb')](_0x1878('0x12'),_0x2068b5,JSON['stringify'](_0x16aace));_0x5004f2(_0x16aace);})[_0x1878('0x11')](function(_0xdfa9d0){logger['error']('GetTrigger',_0xdfa9d0[_0x1878('0x10')],_0x2068b5);_0x271705(_0x2f5f14[_0x1878('0xe')](0x1f4,_0xdfa9d0[_0x1878('0x10')]));});});};exports[_0x1878('0x1e')]=function(_0x4250db){var _0x2fc050=this;return new Promise(function(_0xc58ed,_0x356e58){return db[_0x1878('0x13')][_0x1878('0x1f')]({'raw':_0x4250db[_0x1878('0x15')]?_0x4250db[_0x1878('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4250db[_0x1878('0x15')]?_0x4250db[_0x1878('0x15')][_0x1878('0x17')]||null:null,'attributes':_0x4250db[_0x1878('0x15')]?_0x4250db['options'][_0x1878('0x18')]||null:null,'include':_0x4250db[_0x1878('0x15')]?_0x4250db[_0x1878('0x15')]['include']?_[_0x1878('0x1a')](_0x4250db[_0x1878('0x15')][_0x1878('0x1b')],function(_0x55fa76){return{'model':db[_0x55fa76[_0x1878('0x1c')]],'as':_0x55fa76['as'],'attributes':_0x55fa76[_0x1878('0x18')],'include':_0x55fa76[_0x1878('0x1b')]?_[_0x1878('0x1a')](_0x55fa76[_0x1878('0x1b')],function(_0x5c326e){return{'model':db[_0x5c326e['model']],'as':_0x5c326e['as'],'attributes':_0x5c326e['attributes'],'include':_0x5c326e[_0x1878('0x1b')]?_[_0x1878('0x1a')](_0x5c326e[_0x1878('0x1b')],function(_0x33b552){return{'model':db[_0x33b552[_0x1878('0x1c')]],'as':_0x33b552['as'],'attributes':_0x33b552['attributes']};}):[]};}):[]};}):[]:[]})[_0x1878('0x1d')](function(_0x29898d){logger[_0x1878('0x8')](_0x1878('0x1e'),_0x4250db);logger[_0x1878('0xb')](_0x1878('0x1e'),_0x4250db,JSON[_0x1878('0xd')](_0x29898d));_0xc58ed(_0x29898d);})[_0x1878('0x11')](function(_0x1dd88e){logger[_0x1878('0xe')]('ShowTrigger',_0x1dd88e[_0x1878('0x10')],_0x4250db);_0x356e58(_0x2fc050['error'](0x1f4,_0x1dd88e[_0x1878('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ffb2983..b46b6be 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 _0xc68b=['get','isAuthenticated','show','post','/:id/clone','clone','create','put','/:id','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x178ac0,_0x440117){var _0x326bb8=function(_0x98cb11){while(--_0x98cb11){_0x178ac0['push'](_0x178ac0['shift']());}};_0x326bb8(++_0x440117);}(_0xc68b,0xc9));var _0xbc68=function(_0x1ff44e,_0x1cff29){_0x1ff44e=_0x1ff44e-0x0;var _0x387ae1=_0xc68b[_0x1ff44e];return _0x387ae1;};'use strict';var multer=require('multer');var util=require(_0xbc68('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc68('0x1'));var router=express[_0xbc68('0x2')]();var fs_extra=require(_0xbc68('0x3'));var auth=require(_0xbc68('0x4'));var interaction=require(_0xbc68('0x5'));var config=require(_0xbc68('0x6'));var controller=require(_0xbc68('0x7'));router[_0xbc68('0x8')]('/',auth[_0xbc68('0x9')](),controller['index']);router[_0xbc68('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbc68('0xa')]);router[_0xbc68('0xb')](_0xbc68('0xc'),auth['isAuthenticated'](),controller[_0xbc68('0xd')]);router['post']('/',auth[_0xbc68('0x9')](),controller[_0xbc68('0xe')]);router[_0xbc68('0xf')](_0xbc68('0x10'),auth[_0xbc68('0x9')](),controller['update']);router['delete'](_0xbc68('0x10'),auth[_0xbc68('0x9')](),controller[_0xbc68('0x11')]);module[_0xbc68('0x12')]=router; \ No newline at end of file +var _0x5c3e=['fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','post','isAuthenticated','clone','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x41769b,_0x1b5cd3){var _0xfe6115=function(_0x207cf1){while(--_0x207cf1){_0x41769b['push'](_0x41769b['shift']());}};_0xfe6115(++_0x1b5cd3);}(_0x5c3e,0x1d8));var _0xe5c3=function(_0x5975d6,_0x36c521){_0x5975d6=_0x5975d6-0x0;var _0x16d3a2=_0x5c3e[_0x5975d6];return _0x16d3a2;};'use strict';var multer=require('multer');var util=require(_0xe5c3('0x0'));var path=require(_0xe5c3('0x1'));var timeout=require(_0xe5c3('0x2'));var express=require(_0xe5c3('0x3'));var router=express['Router']();var fs_extra=require(_0xe5c3('0x4'));var auth=require(_0xe5c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe5c3('0x6'));var controller=require('./trunk.controller');router[_0xe5c3('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5c3('0x8')]);router[_0xe5c3('0x7')](_0xe5c3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe5c3('0xa')]('/:id/clone',auth[_0xe5c3('0xb')](),controller[_0xe5c3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe5c3('0xd')](_0xe5c3('0x9'),auth[_0xe5c3('0xb')](),controller[_0xe5c3('0xe')]);router[_0xe5c3('0xf')](_0xe5c3('0x9'),auth[_0xe5c3('0xb')](),controller['destroy']);module[_0xe5c3('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8067f90..2f0224c 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 _0x7564=['outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','exports','name','friend','user','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x7564,0x158));var _0x4756=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x7564[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x4756('0x0'));module[_0x4756('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4756('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x4756('0x3'),_0x4756('0x4'),'peer'),'allowNull':![],'defaultValue':_0x4756('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x6'),_0x4756('0x7'),_0x4756('0x8'),_0x4756('0x9'),_0x4756('0xa'),_0x4756('0xb'),_0x4756('0xc'),_0x4756('0xd'))},'deny':{'type':Sequelize[_0x4756('0xe')]},'permit':{'type':Sequelize[_0x4756('0xe')]},'secret':{'type':Sequelize[_0x4756('0xe')]},'md5secret':{'type':Sequelize[_0x4756('0xe')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x4756('0xe')],'defaultValue':_0x4756('0xf'),'set':function(_0x541aee){this['setDataValue'](_0x4756('0x10'),_0x541aee?_0x541aee['join'](','):null);},'get':function(){return this[_0x4756('0x11')](_0x4756('0x10'))?this[_0x4756('0x11')]('transport')[_0x4756('0x12')](','):null;},'comment':_0x4756('0x13')},'dtmfmode':{'type':Sequelize[_0x4756('0x5')]('rfc2833',_0x4756('0x14'),_0x4756('0x15'),_0x4756('0x16'),_0x4756('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no',_0x4756('0x19'),_0x4756('0x1a'),_0x4756('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4756('0xe')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x4756('0x1c'),'set':function(_0x4e92b7){this['setDataValue'](_0x4756('0x1d'),_0x4e92b7?_0x4e92b7[_0x4756('0x1e')](','):null);},'get':function(){return this[_0x4756('0x11')](_0x4756('0x1d'))?this[_0x4756('0x11')](_0x4756('0x1d'))[_0x4756('0x12')](','):null;},'comment':_0x4756('0x1f')},'callgroup':{'type':Sequelize[_0x4756('0xe')]},'namedcallgroup':{'type':Sequelize[_0x4756('0xe')]},'pickupgroup':{'type':Sequelize[_0x4756('0xe')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4756('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4756('0xe')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4756('0xe')],'defaultValue':_0x4756('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x9e752c){this['setDataValue'](_0x4756('0x21'),_0x9e752c?_0x9e752c[_0x4756('0x1e')](';'):_0x4756('0x22'));},'get':function(){return this[_0x4756('0x11')](_0x4756('0x21'))?this[_0x4756('0x11')](_0x4756('0x21'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x4756('0xe')],'defaultValue':_0x4756('0x23'),'set':function(_0x5e1d38){this[_0x4756('0x24')]('insecure',_0x5e1d38?_0x5e1d38[_0x4756('0x1e')](','):null);},'get':function(){return this['getDataValue'](_0x4756('0x25'))?this[_0x4756('0x11')](_0x4756('0x25'))[_0x4756('0x12')](','):null;},'comment':_0x4756('0x26')},'trustrpid':{'type':Sequelize[_0x4756('0x5')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x4756('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4756('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x4756('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4756('0xe')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x4756('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x4756('0x5')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x4756('0xe')]},'template':{'type':Sequelize[_0x4756('0xe')]},'videosupport':{'type':Sequelize['ENUM'](_0x4756('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4756('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x4756('0x29'),'refuse',_0x4756('0x2a'))},'session_expires':{'type':Sequelize[_0x4756('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x4756('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x4756('0x2b'),'uas'),'defaultValue':_0x4756('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x4756('0xe')]},'regexten':{'type':Sequelize[_0x4756('0xe')]},'fromdomain':{'type':Sequelize[_0x4756('0xe')]},'fromuser':{'type':Sequelize[_0x4756('0xe')]},'port':{'type':Sequelize[_0x4756('0x28')](0x5)},'qualify':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no'),'defaultValue':_0x4756('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x4756('0xe')]},'defaultuser':{'type':Sequelize[_0x4756('0xe')]},'rtptimeout':{'type':Sequelize[_0x4756('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4756('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4756('0x28')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x4756('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x4756('0xe')]},'timert1':{'type':Sequelize[_0x4756('0x28')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x4756('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x4756('0xe')]},'contactacl':{'type':Sequelize[_0x4756('0xe')]},'unsolicited_mailbox':{'type':Sequelize[_0x4756('0xe')]},'use_q850_reason':{'type':Sequelize[_0x4756('0xe')]},'maxforwards':{'type':Sequelize[_0x4756('0x28')](0xb)},'encryption':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'force_avp':{'type':Sequelize[_0x4756('0x5')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x4756('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x4756('0x5')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no',_0x4756('0x2e'),_0x4756('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x4756('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4756('0xe')]},'dtlsprivatekey':{'type':Sequelize[_0x4756('0xe')]},'dtlscipher':{'type':Sequelize[_0x4756('0xe')]},'dtlscafile':{'type':Sequelize[_0x4756('0xe')]},'dtlscapath':{'type':Sequelize[_0x4756('0xe')]},'dtlssetup':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x30'),_0x4756('0x31'),_0x4756('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4756('0xe')]},'usereqphone':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x4756('0xe')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x4756('0x5')](_0x4756('0x18'),'no')},'vmexten':{'type':Sequelize[_0x4756('0xe')]},'mohinterpret':{'type':Sequelize[_0x4756('0xe')]},'mohsuggest':{'type':Sequelize[_0x4756('0xe')]},'parkinglot':{'type':Sequelize[_0x4756('0xe')]},'description':{'type':Sequelize[_0x4756('0xe')]},'host':{'type':Sequelize[_0x4756('0xe')],'defaultValue':_0x4756('0x33')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x4756('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4756('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xd29d=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','originate','INTEGER','uac','uas','pai','certificate','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED'];(function(_0x260271,_0x4c19e2){var _0xd285c3=function(_0x1a32b6){while(--_0x1a32b6){_0x260271['push'](_0x260271['shift']());}};_0xd285c3(++_0x4c19e2);}(_0xd29d,0x16f));var _0xdd29=function(_0x20891f,_0xea64a0){_0x20891f=_0x20891f-0x0;var _0xf1b071=_0xd29d[_0x20891f];return _0xf1b071;};'use strict';var Sequelize=require(_0xdd29('0x0'));module[_0xdd29('0x1')]={'name':{'type':Sequelize[_0xdd29('0x2')],'allowNull':![],'unique':_0xdd29('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0xdd29('0x5')},'context':{'type':Sequelize[_0xdd29('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xdd29('0x6'),_0xdd29('0x7'),'ALLOWED_FAILED_SCREEN',_0xdd29('0x8'),_0xdd29('0x9'),_0xdd29('0xa'),_0xdd29('0xb'),_0xdd29('0xc'))},'deny':{'type':Sequelize[_0xdd29('0x2')]},'permit':{'type':Sequelize[_0xdd29('0x2')]},'secret':{'type':Sequelize[_0xdd29('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':'udp','set':function(_0xa578a){this['setDataValue'](_0xdd29('0xd'),_0xa578a?_0xa578a[_0xdd29('0xe')](','):null);},'get':function(){return this[_0xdd29('0xf')](_0xdd29('0xd'))?this[_0xdd29('0xf')](_0xdd29('0xd'))[_0xdd29('0x10')](','):null;},'comment':_0xdd29('0x11')},'dtmfmode':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x12'),'info',_0xdd29('0x13'),'inband',_0xdd29('0x14')),'defaultValue':_0xdd29('0x12')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xdd29('0x15'),_0xdd29('0x16'),_0xdd29('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdd29('0x2')]},'directmediadeny':{'type':Sequelize[_0xdd29('0x2')]},'nat':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x19'),'set':function(_0x5a9fe0){this[_0xdd29('0x1a')]('nat',_0x5a9fe0?_0x5a9fe0['join'](','):null);},'get':function(){return this[_0xdd29('0xf')]('nat')?this[_0xdd29('0xf')]('nat')[_0xdd29('0x10')](','):null;},'comment':_0xdd29('0x1b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdd29('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xdd29('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd29('0x1d'),'set':function(_0x40322d){this['setDataValue'](_0xdd29('0x1e'),_0x40322d?_0x40322d[_0xdd29('0xe')](';'):_0xdd29('0x1d'));},'get':function(){return this[_0xdd29('0xf')](_0xdd29('0x1e'))?this[_0xdd29('0xf')](_0xdd29('0x1e'))[_0xdd29('0x10')](';'):null;},'comment':_0xdd29('0x1f')},'autoframing':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xdd29('0x20'),'set':function(_0x4c122a){this[_0xdd29('0x1a')](_0xdd29('0x21'),_0x4c122a?_0x4c122a[_0xdd29('0xe')](','):null);},'get':function(){return this[_0xdd29('0xf')](_0xdd29('0x21'))?this[_0xdd29('0xf')]('insecure')[_0xdd29('0x10')](','):null;},'comment':_0xdd29('0x22')},'trustrpid':{'type':Sequelize[_0xdd29('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xdd29('0x2')]},'callerid':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':_0xdd29('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xdd29('0x2')]},'videosupport':{'type':Sequelize[_0xdd29('0x4')]('yes','no',_0xdd29('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xdd29('0x25'),'refuse',_0xdd29('0x26'))},'session_expires':{'type':Sequelize[_0xdd29('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x28'),_0xdd29('0x29')),'defaultValue':_0xdd29('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xdd29('0x2')]},'fromdomain':{'type':Sequelize[_0xdd29('0x2')]},'fromuser':{'type':Sequelize[_0xdd29('0x2')]},'port':{'type':Sequelize[_0xdd29('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdd29('0x18'),'no'),'defaultValue':_0xdd29('0x18')},'keepalive':{'type':Sequelize[_0xdd29('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xdd29('0x2')]},'defaultuser':{'type':Sequelize[_0xdd29('0x2')]},'rtptimeout':{'type':Sequelize[_0xdd29('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdd29('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdd29('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xdd29('0x18'),'no',_0xdd29('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xdd29('0x2')]},'timert1':{'type':Sequelize[_0xdd29('0x27')](0xb)},'timerb':{'type':Sequelize[_0xdd29('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdd29('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xdd29('0x2')]},'contactdeny':{'type':Sequelize[_0xdd29('0x2')]},'contactacl':{'type':Sequelize[_0xdd29('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xdd29('0x2')]},'use_q850_reason':{'type':Sequelize[_0xdd29('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'force_avp':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xdd29('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xdd29('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xdd29('0x2')]},'dtlscipher':{'type':Sequelize[_0xdd29('0x2')]},'dtlscafile':{'type':Sequelize[_0xdd29('0x2')]},'dtlscapath':{'type':Sequelize[_0xdd29('0x2')]},'dtlssetup':{'type':Sequelize[_0xdd29('0x4')]('active','passive',_0xdd29('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdd29('0x2')]},'usereqphone':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdd29('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xdd29('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xdd29('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xdd29('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xdd29('0x2')]},'parkinglot':{'type':Sequelize[_0xdd29('0x2')]},'description':{'type':Sequelize[_0xdd29('0x2')]},'host':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x2d')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xdd29('0x15'),_0xdd29('0x16'),_0xdd29('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdd29('0x2')]},'otherFields':{'type':Sequelize[_0xdd29('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index be69473..c9345b8 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x81bd,0x7c));var _0xd81b=function(_0x48fff1,_0x50c537){_0x48fff1=_0x48fff1-0x0;var _0x127a1d=_0x81bd[_0x48fff1];return _0x127a1d;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x28a26e,_0x4559aa){var _0xa77c6=function(_0xa90f0a){while(--_0xa90f0a){_0x28a26e['push'](_0x28a26e['shift']());}};_0xa77c6(++_0x4559aa);}(_0x6aa7,0x178));var _0x76aa=function(_0x36375c,_0x5f0384){_0x36375c=_0x36375c-0x0;var _0x1f5325=_0x6aa7[_0x36375c];return _0x1f5325;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3639c6d..3f93f50 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 _0x6190=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x296d93,_0x27ee37){var _0xba3f66=function(_0x4ff475){while(--_0x4ff475){_0x296d93['push'](_0x296d93['shift']());}};_0xba3f66(++_0x27ee37);}(_0x6190,0x1d4));var _0x0619=function(_0x4cdae0,_0x1f1ca4){_0x4cdae0=_0x4cdae0-0x0;var _0x2dc710=_0x6190[_0x4cdae0];return _0x2dc710;};'use strict';var _=require('lodash');var util=require(_0x0619('0x0'));var logger=require(_0x0619('0x1'))(_0x0619('0x2'));var moment=require(_0x0619('0x3'));var BPromise=require(_0x0619('0x4'));var rp=require(_0x0619('0x5'));var fs=require('fs');var path=require(_0x0619('0x6'));var rimraf=require('rimraf');var config=require(_0x0619('0x7'));var attributes=require(_0x0619('0x8'));module[_0x0619('0x9')]=function(_0x9b5b88,_0xe42ffe){return _0x9b5b88[_0x0619('0xa')](_0x0619('0xb'),attributes,{'tableName':_0x0619('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3445=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x1c7d4b,_0xc5ec31){var _0x3bf611=function(_0x50f998){while(--_0x50f998){_0x1c7d4b['push'](_0x1c7d4b['shift']());}};_0x3bf611(++_0xc5ec31);}(_0x3445,0xcf));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require(_0x5344('0x2'))(_0x5344('0x3'));var moment=require(_0x5344('0x4'));var BPromise=require(_0x5344('0x5'));var rp=require(_0x5344('0x6'));var fs=require('fs');var path=require(_0x5344('0x7'));var rimraf=require(_0x5344('0x8'));var config=require(_0x5344('0x9'));var attributes=require('./trunk.attributes');module[_0x5344('0xa')]=function(_0x4220a6,_0xd90dc1){return _0x4220a6[_0x5344('0xb')](_0x5344('0xc'),attributes,{'tableName':_0x5344('0xd'),'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 491c10c..0cec7d9 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 _0x7fc7=['options','attributes','limit','map','include','model','catch','find','raw','where','ShowTrunk','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTrunk','Trunk','findAll'];(function(_0xba0da5,_0x2ac024){var _0x3a5f98=function(_0x3bc47b){while(--_0x3bc47b){_0xba0da5['push'](_0xba0da5['shift']());}};_0x3a5f98(++_0x2ac024);}(_0x7fc7,0x7d));var _0x77fc=function(_0x14e135,_0x1ca9e6){_0x14e135=_0x14e135-0x0;var _0x27d8d7=_0x7fc7[_0x14e135];return _0x27d8d7;};'use strict';var _=require(_0x77fc('0x0'));var util=require(_0x77fc('0x1'));var moment=require('moment');var BPromise=require(_0x77fc('0x2'));var rs=require(_0x77fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77fc('0x4'))['db'];var utils=require(_0x77fc('0x5'));var logger=require(_0x77fc('0x6'))(_0x77fc('0x7'));var config=require(_0x77fc('0x8'));var jayson=require(_0x77fc('0x9'));var client=jayson[_0x77fc('0xa')][_0x77fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3185ed,_0x51a47a,_0x292c3d){return new BPromise(function(_0x1fd6e9,_0x11952f){return client[_0x77fc('0xc')](_0x3185ed,_0x292c3d)[_0x77fc('0xd')](function(_0x2553a2){logger['info'](_0x77fc('0xe'),_0x51a47a,_0x77fc('0xf'));logger[_0x77fc('0x10')](_0x77fc('0x11'),_0x51a47a,_0x77fc('0xf'),JSON[_0x77fc('0x12')](_0x2553a2));if(_0x2553a2[_0x77fc('0x13')]){if(_0x2553a2[_0x77fc('0x13')][_0x77fc('0x14')]===0x1f4){logger[_0x77fc('0x13')]('Trunk,\x20%s,\x20%s',_0x51a47a,_0x2553a2['error']['message']);return _0x11952f(_0x2553a2[_0x77fc('0x13')][_0x77fc('0x15')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x51a47a,_0x2553a2[_0x77fc('0x13')]['message']);return _0x1fd6e9(_0x2553a2[_0x77fc('0x13')]['message']);}else{logger[_0x77fc('0x16')]('Trunk,\x20%s,\x20%s',_0x51a47a,'request\x20sent');_0x1fd6e9(_0x2553a2[_0x77fc('0x17')]['message']);}})['catch'](function(_0x4efdcd){logger[_0x77fc('0x13')]('Trunk,\x20%s,\x20%s',_0x51a47a,_0x4efdcd);_0x11952f(_0x4efdcd);});});}exports[_0x77fc('0x18')]=function(_0x252d2b){var _0x3e46ae=this;return new Promise(function(_0x58363f,_0x21a6bb){return db[_0x77fc('0x19')][_0x77fc('0x1a')]({'raw':_0x252d2b[_0x77fc('0x1b')]?_0x252d2b[_0x77fc('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x252d2b[_0x77fc('0x1b')]?_0x252d2b[_0x77fc('0x1b')]['where']||null:null,'attributes':_0x252d2b[_0x77fc('0x1b')]?_0x252d2b['options'][_0x77fc('0x1c')]||null:null,'limit':_0x252d2b[_0x77fc('0x1b')]?_0x252d2b[_0x77fc('0x1b')][_0x77fc('0x1d')]||null:null,'include':_0x252d2b['options']?_0x252d2b[_0x77fc('0x1b')]['include']?_[_0x77fc('0x1e')](_0x252d2b['options'][_0x77fc('0x1f')],function(_0x2a3c9a){return{'model':db[_0x2a3c9a[_0x77fc('0x20')]],'as':_0x2a3c9a['as'],'attributes':_0x2a3c9a['attributes'],'include':_0x2a3c9a[_0x77fc('0x1f')]?_['map'](_0x2a3c9a[_0x77fc('0x1f')],function(_0x33c9f0){return{'model':db[_0x33c9f0[_0x77fc('0x20')]],'as':_0x33c9f0['as'],'attributes':_0x33c9f0[_0x77fc('0x1c')],'include':_0x33c9f0[_0x77fc('0x1f')]?_[_0x77fc('0x1e')](_0x33c9f0[_0x77fc('0x1f')],function(_0x440192){return{'model':db[_0x440192[_0x77fc('0x20')]],'as':_0x440192['as'],'attributes':_0x440192['attributes']};}):[]};}):[]};}):[]:[]})[_0x77fc('0xd')](function(_0x4d948d){logger['info']('GetTrunk',_0x252d2b);logger[_0x77fc('0x10')]('GetTrunk',_0x252d2b,JSON['stringify'](_0x4d948d));_0x58363f(_0x4d948d);})[_0x77fc('0x21')](function(_0x53472e){logger['error'](_0x77fc('0x18'),_0x53472e[_0x77fc('0x15')],_0x252d2b);_0x21a6bb(_0x3e46ae[_0x77fc('0x13')](0x1f4,_0x53472e[_0x77fc('0x15')]));});});};exports['ShowTrunk']=function(_0x36e2b3){var _0x419171=this;return new Promise(function(_0xfd1229,_0x5ef7b0){return db[_0x77fc('0x19')][_0x77fc('0x22')]({'raw':_0x36e2b3[_0x77fc('0x1b')]?_0x36e2b3[_0x77fc('0x1b')][_0x77fc('0x23')]===undefined?!![]:![]:!![],'where':_0x36e2b3[_0x77fc('0x1b')]?_0x36e2b3[_0x77fc('0x1b')][_0x77fc('0x24')]||null:null,'attributes':_0x36e2b3[_0x77fc('0x1b')]?_0x36e2b3[_0x77fc('0x1b')][_0x77fc('0x1c')]||null:null,'include':_0x36e2b3['options']?_0x36e2b3[_0x77fc('0x1b')][_0x77fc('0x1f')]?_['map'](_0x36e2b3['options'][_0x77fc('0x1f')],function(_0x54cb28){return{'model':db[_0x54cb28[_0x77fc('0x20')]],'as':_0x54cb28['as'],'attributes':_0x54cb28[_0x77fc('0x1c')],'include':_0x54cb28['include']?_[_0x77fc('0x1e')](_0x54cb28[_0x77fc('0x1f')],function(_0x1af444){return{'model':db[_0x1af444['model']],'as':_0x1af444['as'],'attributes':_0x1af444[_0x77fc('0x1c')],'include':_0x1af444[_0x77fc('0x1f')]?_[_0x77fc('0x1e')](_0x1af444[_0x77fc('0x1f')],function(_0x2ef371){return{'model':db[_0x2ef371[_0x77fc('0x20')]],'as':_0x2ef371['as'],'attributes':_0x2ef371[_0x77fc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x77fc('0xd')](function(_0x46cc3c){logger[_0x77fc('0x16')](_0x77fc('0x25'),_0x36e2b3);logger[_0x77fc('0x10')](_0x77fc('0x25'),_0x36e2b3,JSON['stringify'](_0x46cc3c));_0xfd1229(_0x46cc3c);})[_0x77fc('0x21')](function(_0x5e908d){logger[_0x77fc('0x13')]('ShowTrunk',_0x5e908d['message'],_0x36e2b3);_0x5ef7b0(_0x419171['error'](0x1f4,_0x5e908d[_0x77fc('0x15')]));});});}; \ No newline at end of file +var _0xfda8=['include','map','model','attributes','ShowTrunk','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','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','catch','GetTrunk','Trunk','options','raw','where','limit'];(function(_0x63054d,_0x2b4813){var _0x15c48d=function(_0x262b00){while(--_0x262b00){_0x63054d['push'](_0x63054d['shift']());}};_0x15c48d(++_0x2b4813);}(_0xfda8,0x185));var _0x8fda=function(_0x2ba918,_0x4cdeb1){_0x2ba918=_0x2ba918-0x0;var _0x508956=_0xfda8[_0x2ba918];return _0x508956;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8fda('0x0'));var BPromise=require(_0x8fda('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fda('0x2'));var db=require(_0x8fda('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8fda('0x4'));var jayson=require(_0x8fda('0x5'));var client=jayson[_0x8fda('0x6')][_0x8fda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3311dc,_0x20b57b,_0x60b0f8){return new BPromise(function(_0xf60cea,_0x4f058a){return client[_0x8fda('0x8')](_0x3311dc,_0x60b0f8)[_0x8fda('0x9')](function(_0x7f3f70){logger[_0x8fda('0xa')](_0x8fda('0xb'),_0x20b57b,_0x8fda('0xc'));logger[_0x8fda('0xd')](_0x8fda('0xe'),_0x20b57b,_0x8fda('0xc'),JSON[_0x8fda('0xf')](_0x7f3f70));if(_0x7f3f70[_0x8fda('0x10')]){if(_0x7f3f70[_0x8fda('0x10')][_0x8fda('0x11')]===0x1f4){logger[_0x8fda('0x10')](_0x8fda('0xb'),_0x20b57b,_0x7f3f70[_0x8fda('0x10')][_0x8fda('0x12')]);return _0x4f058a(_0x7f3f70[_0x8fda('0x10')][_0x8fda('0x12')]);}logger['error'](_0x8fda('0xb'),_0x20b57b,_0x7f3f70['error'][_0x8fda('0x12')]);return _0xf60cea(_0x7f3f70[_0x8fda('0x10')]['message']);}else{logger[_0x8fda('0xa')](_0x8fda('0xb'),_0x20b57b,'request\x20sent');_0xf60cea(_0x7f3f70[_0x8fda('0x13')]['message']);}})[_0x8fda('0x14')](function(_0x2e7e3b){logger[_0x8fda('0x10')](_0x8fda('0xb'),_0x20b57b,_0x2e7e3b);_0x4f058a(_0x2e7e3b);});});}exports[_0x8fda('0x15')]=function(_0x13ac83){var _0x43e9eb=this;return new Promise(function(_0x902db0,_0x5712e5){return db[_0x8fda('0x16')]['findAll']({'raw':_0x13ac83[_0x8fda('0x17')]?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x18')]===undefined?!![]:![]:!![],'where':_0x13ac83['options']?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x19')]||null:null,'attributes':_0x13ac83['options']?_0x13ac83['options']['attributes']||null:null,'limit':_0x13ac83[_0x8fda('0x17')]?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x1a')]||null:null,'include':_0x13ac83[_0x8fda('0x17')]?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x1b')]?_[_0x8fda('0x1c')](_0x13ac83[_0x8fda('0x17')][_0x8fda('0x1b')],function(_0x2dc5ca){return{'model':db[_0x2dc5ca[_0x8fda('0x1d')]],'as':_0x2dc5ca['as'],'attributes':_0x2dc5ca[_0x8fda('0x1e')],'include':_0x2dc5ca[_0x8fda('0x1b')]?_['map'](_0x2dc5ca['include'],function(_0x42f847){return{'model':db[_0x42f847[_0x8fda('0x1d')]],'as':_0x42f847['as'],'attributes':_0x42f847['attributes'],'include':_0x42f847[_0x8fda('0x1b')]?_[_0x8fda('0x1c')](_0x42f847['include'],function(_0x3ea496){return{'model':db[_0x3ea496[_0x8fda('0x1d')]],'as':_0x3ea496['as'],'attributes':_0x3ea496[_0x8fda('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fda('0x9')](function(_0x1e76e1){logger['info'](_0x8fda('0x15'),_0x13ac83);logger[_0x8fda('0xd')](_0x8fda('0x15'),_0x13ac83,JSON[_0x8fda('0xf')](_0x1e76e1));_0x902db0(_0x1e76e1);})[_0x8fda('0x14')](function(_0x281041){logger[_0x8fda('0x10')]('GetTrunk',_0x281041['message'],_0x13ac83);_0x5712e5(_0x43e9eb[_0x8fda('0x10')](0x1f4,_0x281041['message']));});});};exports['ShowTrunk']=function(_0x355703){var _0x5f10a7=this;return new Promise(function(_0x11249c,_0x9dce4f){return db[_0x8fda('0x16')]['find']({'raw':_0x355703[_0x8fda('0x17')]?_0x355703[_0x8fda('0x17')][_0x8fda('0x18')]===undefined?!![]:![]:!![],'where':_0x355703['options']?_0x355703[_0x8fda('0x17')][_0x8fda('0x19')]||null:null,'attributes':_0x355703[_0x8fda('0x17')]?_0x355703['options']['attributes']||null:null,'include':_0x355703[_0x8fda('0x17')]?_0x355703['options'][_0x8fda('0x1b')]?_['map'](_0x355703['options'][_0x8fda('0x1b')],function(_0x19a2f5){return{'model':db[_0x19a2f5[_0x8fda('0x1d')]],'as':_0x19a2f5['as'],'attributes':_0x19a2f5[_0x8fda('0x1e')],'include':_0x19a2f5['include']?_['map'](_0x19a2f5[_0x8fda('0x1b')],function(_0x52e853){return{'model':db[_0x52e853['model']],'as':_0x52e853['as'],'attributes':_0x52e853['attributes'],'include':_0x52e853['include']?_[_0x8fda('0x1c')](_0x52e853['include'],function(_0x40c401){return{'model':db[_0x40c401[_0x8fda('0x1d')]],'as':_0x40c401['as'],'attributes':_0x40c401['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fda('0x9')](function(_0x5739d7){logger[_0x8fda('0xa')](_0x8fda('0x1f'),_0x355703);logger[_0x8fda('0xd')](_0x8fda('0x1f'),_0x355703,JSON['stringify'](_0x5739d7));_0x11249c(_0x5739d7);})[_0x8fda('0x14')](function(_0x470d34){logger['error'](_0x8fda('0x1f'),_0x470d34[_0x8fda('0x12')],_0x355703);_0x9dce4f(_0x5f10a7['error'](0x1f4,_0x470d34[_0x8fda('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bb530ed..edf0b3c 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7ef=['Router','../../components/auth/service','./user-setting.controller','/:id','exports','express'];(function(_0x478f9d,_0x5db8f6){var _0x51683e=function(_0x318245){while(--_0x318245){_0x478f9d['push'](_0x478f9d['shift']());}};_0x51683e(++_0x5db8f6);}(_0xc7ef,0x1e5));var _0xfc7e=function(_0x2445be,_0x246faa){_0x2445be=_0x2445be-0x0;var _0x30528e=_0xc7ef[_0x2445be];return _0x30528e;};'use strict';var express=require(_0xfc7e('0x0'));var router=express[_0xfc7e('0x1')]();var auth=require(_0xfc7e('0x2'));var controller=require(_0xfc7e('0x3'));router['put'](_0xfc7e('0x4'),auth['isAuthenticated'](),controller['update']);module[_0xfc7e('0x5')]=router; \ No newline at end of file +var _0x50c9=['./user-setting.controller','put','isAuthenticated','update','exports','express','Router'];(function(_0x4d2877,_0x311683){var _0xfe1bb2=function(_0x5f4183){while(--_0x5f4183){_0x4d2877['push'](_0x4d2877['shift']());}};_0xfe1bb2(++_0x311683);}(_0x50c9,0x83));var _0x950c=function(_0x540320,_0x55ac12){_0x540320=_0x540320-0x0;var _0x105bdb=_0x50c9[_0x540320];return _0x105bdb;};'use strict';var express=require(_0x950c('0x0'));var router=express[_0x950c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x950c('0x2'));router[_0x950c('0x3')]('/:id',auth[_0x950c('0x4')](),controller[_0x950c('0x5')]);module[_0x950c('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5054cfa..c41ef3b 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb93f=['warning','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb93f,0x106));var _0xfb93=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xb93f[_0xbf5e16];return _0x5975a5;};'use strict';var Sequelize=require(_0xfb93('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfb93('0x1'),_0xfb93('0x2'),'info',_0xfb93('0x3')];module[_0xfb93('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfb93('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfb93('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfb93('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfb93('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfb93('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfb93('0x9')],'unique':_0xfb93('0xa')}}; \ No newline at end of file +var _0x9b69=['INTEGER','warning','info','debug','ENUM','BOOLEAN','DATE'];(function(_0x36097f,_0x36e587){var _0x2d9106=function(_0x10d6c9){while(--_0x10d6c9){_0x36097f['push'](_0x36097f['shift']());}};_0x2d9106(++_0x36e587);}(_0x9b69,0x94));var _0x99b6=function(_0xce3849,_0x1ff4db){_0xce3849=_0xce3849-0x0;var _0x1c0fa2=_0x9b69[_0xce3849];return _0x1c0fa2;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x99b6('0x0'),_0x99b6('0x1'),_0x99b6('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x99b6('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x99b6('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x99b6('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x99b6('0x6')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 76dc504..826c550 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb32d=['admin','Unauthorized','params','UserSetting','find','catch','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x3eb8a5,_0x33cba7){var _0x281142=function(_0x4be519){while(--_0x4be519){_0x3eb8a5['push'](_0x3eb8a5['shift']());}};_0x281142(++_0x33cba7);}(_0xb32d,0x1da));var _0xdb32=function(_0xe397b4,_0x37f1c0){_0xe397b4=_0xe397b4-0x0;var _0x384f1e=_0xb32d[_0xe397b4];return _0x384f1e;};'use strict';var _=require(_0xdb32('0x0'));var Redis=require(_0xdb32('0x1'));var logger=require(_0xdb32('0x2'))(_0xdb32('0x3'));var config=require(_0xdb32('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xdb32('0x5')]));require(_0xdb32('0x6'))['register'](socket);config[_0xdb32('0x5')]=_[_0xdb32('0x7')](config[_0xdb32('0x5')],{'host':_0xdb32('0x8'),'port':0x18eb});function respondWithResult(_0x6f4af0,_0x386309){_0x386309=_0x386309||0xc8;return function(_0x5bb076){if(_0x5bb076){return _0x6f4af0[_0xdb32('0x9')](_0x386309)[_0xdb32('0xa')](_0x5bb076);}};}function saveUpdates(_0xbe779d){return function(_0x1deacb){if(_0x1deacb){return _0x1deacb[_0xdb32('0xb')](_0xbe779d)[_0xdb32('0xc')](function(_0x112db6){return _0x112db6;});}return null;};}function handleEntityNotFound(_0x3ddfc6){return function(_0x251443){if(!_0x251443){_0x3ddfc6[_0xdb32('0xd')](0x194);}return _0x251443;};}function handleError(_0x296482,_0x2c3355){_0x2c3355=_0x2c3355||0x1f4;return function(_0x91be02){logger[_0xdb32('0xe')](_0x91be02[_0xdb32('0xf')]);if(_0x91be02[_0xdb32('0x10')]){delete _0x91be02[_0xdb32('0x10')];}_0x296482[_0xdb32('0x9')](_0x2c3355)[_0xdb32('0x11')](_0x91be02);};}exports[_0xdb32('0xb')]=function(_0x410b23,_0x5e4377){if(_0x410b23[_0xdb32('0x12')][_0xdb32('0x13')]!==_0xdb32('0x14'))throw new Error(_0xdb32('0x15'));if(isNaN(Number(_0x410b23[_0xdb32('0x16')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xdb32('0x17')][_0xdb32('0x18')]({'where':{'id':_0x410b23[_0xdb32('0x16')]['id']}})['then'](handleEntityNotFound(_0x5e4377,null))['then'](saveUpdates(_0x410b23['body'],null))['then'](respondWithResult(_0x5e4377,null))[_0xdb32('0x19')](handleError(_0x5e4377,null));}; \ No newline at end of file +var _0x0cd6=['redis','defaults','status','json','update','then','sendStatus','stack','name','send','user','admin','params','Invalid\x20user\x20setting\x20id','catch','lodash','ioredis','api','../../config/environment','socket.io-emitter'];(function(_0x4ebf6a,_0xfd0a40){var _0x1e7a72=function(_0x5978e8){while(--_0x5978e8){_0x4ebf6a['push'](_0x4ebf6a['shift']());}};_0x1e7a72(++_0xfd0a40);}(_0x0cd6,0x113));var _0x60cd=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x0cd6[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x60cd('0x0'));var Redis=require(_0x60cd('0x1'));var logger=require('../../config/logger')(_0x60cd('0x2'));var config=require(_0x60cd('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x60cd('0x4'))(new Redis(config[_0x60cd('0x5')]));require('./user-setting.socket')['register'](socket);config[_0x60cd('0x5')]=_[_0x60cd('0x6')](config[_0x60cd('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x381044,_0x4b66cd){_0x4b66cd=_0x4b66cd||0xc8;return function(_0x1249cb){if(_0x1249cb){return _0x381044[_0x60cd('0x7')](_0x4b66cd)[_0x60cd('0x8')](_0x1249cb);}};}function saveUpdates(_0xad38c6){return function(_0x260260){if(_0x260260){return _0x260260[_0x60cd('0x9')](_0xad38c6)[_0x60cd('0xa')](function(_0x316912){return _0x316912;});}return null;};}function handleEntityNotFound(_0x374baa){return function(_0x5d82b7){if(!_0x5d82b7){_0x374baa[_0x60cd('0xb')](0x194);}return _0x5d82b7;};}function handleError(_0x214e75,_0x516c6a){_0x516c6a=_0x516c6a||0x1f4;return function(_0xc240d8){logger['error'](_0xc240d8[_0x60cd('0xc')]);if(_0xc240d8[_0x60cd('0xd')]){delete _0xc240d8['name'];}_0x214e75[_0x60cd('0x7')](_0x516c6a)[_0x60cd('0xe')](_0xc240d8);};}exports[_0x60cd('0x9')]=function(_0x59810e,_0x14076c){if(_0x59810e[_0x60cd('0xf')]['role']!==_0x60cd('0x10'))throw new Error('Unauthorized');if(isNaN(Number(_0x59810e[_0x60cd('0x11')]['id'])))throw new Error(_0x60cd('0x12'));return db['UserSetting']['find']({'where':{'id':_0x59810e[_0x60cd('0x11')]['id']}})[_0x60cd('0xa')](handleEntityNotFound(_0x14076c,null))[_0x60cd('0xa')](saveUpdates(_0x59810e['body'],null))[_0x60cd('0xa')](respondWithResult(_0x14076c,null))[_0x60cd('0x13')](handleError(_0x14076c,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index cb721a6..aa9e69a 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf019=['UserSetting','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x27c0ea,_0x5132de){var _0x307403=function(_0x220691){while(--_0x220691){_0x27c0ea['push'](_0x27c0ea['shift']());}};_0x307403(++_0x5132de);}(_0xf019,0xad));var _0x9f01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf019[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x9f01('0x0'));var UserSetting=require(_0x9f01('0x1'))['db'][_0x9f01('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f01('0x3'),'afterDestroy':_0x9f01('0x4')};function emitEvent(_0xa5475b){return function(_0x50b02e,_0x4aaf97,_0x4b24a8){UserSettingEvents[_0x9f01('0x5')](_0xa5475b+':'+_0x50b02e['id'],_0x50b02e);UserSettingEvents[_0x9f01('0x5')](_0xa5475b,_0x50b02e);_0x4b24a8(null);};}for(var e in events){if(events[_0x9f01('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xdc11=['hook','events','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x3c78f1,_0x352f1a){var _0x518acc=function(_0x3ca12f){while(--_0x3ca12f){_0x3c78f1['push'](_0x3c78f1['shift']());}};_0x518acc(++_0x352f1a);}(_0xdc11,0x191));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1dc1('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x1dc1('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1dc1('0x2')](0x0);var events={'afterCreate':_0x1dc1('0x3'),'afterUpdate':_0x1dc1('0x4'),'afterDestroy':_0x1dc1('0x5')};function emitEvent(_0x361520){return function(_0x17b094,_0x474d7b,_0x295d57){UserSettingEvents[_0x1dc1('0x6')](_0x361520+':'+_0x17b094['id'],_0x17b094);UserSettingEvents[_0x1dc1('0x6')](_0x361520,_0x17b094);_0x295d57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1dc1('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index ff18181..90f33bb 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a1d=['exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x825645,_0x593460){var _0x216069=function(_0x4628cd){while(--_0x4628cd){_0x825645['push'](_0x825645['shift']());}};_0x216069(++_0x593460);}(_0x4a1d,0x77));var _0xd4a1=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x4a1d[_0x1a36a5];return _0x746243;};'use strict';var attributes=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]=function(_0x213963){return _0x213963[_0xd4a1('0x2')](_0xd4a1('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ae3f){if(!_0x43ae3f[_0xd4a1('0x4')])_0x43ae3f[_0xd4a1('0x5')]=null;else if(_0x43ae3f[_0xd4a1('0x5')]===null)_0x43ae3f[_0xd4a1('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x4e81=['./user-setting.attributes','exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x2bf8f2,_0x27c758){var _0x1ba2fa=function(_0x1439f8){while(--_0x1439f8){_0x2bf8f2['push'](_0x2bf8f2['shift']());}};_0x1ba2fa(++_0x27c758);}(_0x4e81,0x1bc));var _0x14e8=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x4e81[_0x3a73bc];return _0x32891b;};'use strict';var attributes=require(_0x14e8('0x0'));module[_0x14e8('0x1')]=function(_0x354aac){return _0x354aac['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2184fc){if(!_0x2184fc[_0x14e8('0x2')])_0x2184fc[_0x14e8('0x3')]=null;else if(_0x2184fc[_0x14e8('0x3')]===null)_0x2184fc[_0x14e8('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index d46e4b3..7b99ffc 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x744c=['update','emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save'];(function(_0x199b12,_0x325017){var _0x4a9041=function(_0x2b6d6f){while(--_0x2b6d6f){_0x199b12['push'](_0x199b12['shift']());}};_0x4a9041(++_0x325017);}(_0x744c,0x193));var _0xc744=function(_0x2de482,_0x54cc18){_0x2de482=_0x2de482-0x0;var _0xddcce6=_0x744c[_0x2de482];return _0xddcce6;};'use strict';var UserSettingEvents=require(_0xc744('0x0'));var events=[_0xc744('0x1'),'remove',_0xc744('0x2')];function createListener(_0x34a602,_0x7c1c21){return function(_0x43b2f8){_0x7c1c21[_0xc744('0x3')](_0x34a602,_0x43b2f8);if(_0x34a602==='user-setting:update'){_0x7c1c21[_0xc744('0x3')](_0xc744('0x4')+_0x43b2f8[_0xc744('0x5')],_0x43b2f8);}};}exports[_0xc744('0x6')]=function(_0x513723){for(var _0x326a66=0x0,_0x1df320=events[_0xc744('0x7')];_0x326a66<_0x1df320;_0x326a66++){var _0x265273=events[_0x326a66];var _0x35250a=createListener(_0xc744('0x8')+_0x265273,_0x513723);UserSettingEvents['on'](_0x265273,_0x35250a);}}; \ No newline at end of file +var _0x4628=['emit','register','length','user-setting:','save','user-setting:update'];(function(_0x491d44,_0x5918ea){var _0x157fb1=function(_0x546768){while(--_0x546768){_0x491d44['push'](_0x491d44['shift']());}};_0x157fb1(++_0x5918ea);}(_0x4628,0x70));var _0x8462=function(_0xc8c103,_0x285701){_0xc8c103=_0xc8c103-0x0;var _0x5c72ef=_0x4628[_0xc8c103];return _0x5c72ef;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x8462('0x0'),'remove','update'];function createListener(_0x46dc23,_0x4fbbfb){return function(_0x3c1852){_0x4fbbfb['emit'](_0x46dc23,_0x3c1852);if(_0x46dc23===_0x8462('0x1')){_0x4fbbfb[_0x8462('0x2')]('user-setting:update:user-'+_0x3c1852['UserId'],_0x3c1852);}};}exports[_0x8462('0x3')]=function(_0x1864b5){for(var _0xc4c73a=0x0,_0x36a09d=events[_0x8462('0x4')];_0xc4c73a<_0x36a09d;_0xc4c73a++){var _0x578718=events[_0xc4c73a];var _0x1d4de9=createListener(_0x8462('0x5')+_0x578718,_0x1864b5);UserSettingEvents['on'](_0x578718,_0x1d4de9);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a426238..02c9ce9 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 _0x3914=['../../components/auth/service','../../components/interaction/service','./user.controller','get','index','/describe','describe','whoami','/presence','getPresence','/:id','isAuthenticated','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','file','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','/:id/teams','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3914,0xeb));var _0x4391=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x3914[_0x2555d0];return _0x3bb486;};'use strict';var multer=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var path=require('path');var timeout=require(_0x4391('0x2'));var express=require(_0x4391('0x3'));var router=express['Router']();var fs_extra=require(_0x4391('0x4'));var auth=require(_0x4391('0x5'));var interaction=require(_0x4391('0x6'));var config=require('../../config/environment');var controller=require(_0x4391('0x7'));router[_0x4391('0x8')]('/',auth['isAuthenticated'](),controller[_0x4391('0x9')]);router['get'](_0x4391('0xa'),auth['isAuthenticated'](),controller[_0x4391('0xb')]);router[_0x4391('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0x4391('0xc')]);router[_0x4391('0x8')](_0x4391('0xd'),auth['isAuthenticated'](),controller[_0x4391('0xe')]);router[_0x4391('0x8')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller['show']);router[_0x4391('0x8')](_0x4391('0x11'),controller[_0x4391('0x12')]);router[_0x4391('0x8')](_0x4391('0x13'),auth[_0x4391('0x10')](),controller[_0x4391('0x14')]);router[_0x4391('0x8')]('/:id/contacts',auth[_0x4391('0x10')](),controller[_0x4391('0x15')]);router[_0x4391('0x8')](_0x4391('0x16'),auth['isAuthenticated'](),controller[_0x4391('0x17')]);router['get'](_0x4391('0x18'),auth[_0x4391('0x10')](),controller[_0x4391('0x19')]);router[_0x4391('0x8')](_0x4391('0x1a'),auth[_0x4391('0x10')](),controller[_0x4391('0x1b')]);router[_0x4391('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x4391('0x1c')]);router['get'](_0x4391('0x1d'),auth[_0x4391('0x10')](),controller[_0x4391('0x1e')]);router[_0x4391('0x8')](_0x4391('0x1f'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x4391('0x8')](_0x4391('0x20'),auth[_0x4391('0x10')](),controller['getOpenchannelInteractions']);router[_0x4391('0x8')](_0x4391('0x21'),auth[_0x4391('0x10')](),controller[_0x4391('0x22')]);router['get'](_0x4391('0x23'),auth[_0x4391('0x10')](),controller[_0x4391('0x24')]);router[_0x4391('0x8')](_0x4391('0x25'),auth[_0x4391('0x10')](),controller['getFaxInteractions']);router[_0x4391('0x8')](_0x4391('0x26'),auth[_0x4391('0x10')](),controller[_0x4391('0x27')]);router['get']('/:id/teams',auth[_0x4391('0x10')](),controller[_0x4391('0x28')]);router[_0x4391('0x8')](_0x4391('0x29'),auth[_0x4391('0x10')](),controller['getLists']);router['get']('/:id/agents',auth['isAuthenticated'](),controller[_0x4391('0x2a')]);router[_0x4391('0x8')](_0x4391('0x2b'),auth[_0x4391('0x10')](),controller['getVoicePrefixes']);router[_0x4391('0x8')](_0x4391('0x2c'),auth[_0x4391('0x10')](),controller[_0x4391('0x2d')]);router[_0x4391('0x8')]('/:id/mail_accounts',auth[_0x4391('0x10')](),controller[_0x4391('0x2e')]);router[_0x4391('0x8')](_0x4391('0x2f'),auth[_0x4391('0x10')](),controller[_0x4391('0x30')]);router[_0x4391('0x8')](_0x4391('0x31'),auth[_0x4391('0x10')](),controller[_0x4391('0x32')]);router[_0x4391('0x8')]('/:id/chat_websites',auth[_0x4391('0x10')](),controller['getChatWebsites']);router[_0x4391('0x8')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x4391('0x33')]);router[_0x4391('0x8')](_0x4391('0x34'),auth[_0x4391('0x10')](),controller[_0x4391('0x35')]);router[_0x4391('0x8')](_0x4391('0x36'),auth['isAuthenticated'](),controller[_0x4391('0x37')]);router['post'](_0x4391('0x38'),auth['isAuthenticated'](),controller[_0x4391('0x39')]);router[_0x4391('0x3a')]('/',auth[_0x4391('0x10')](),controller[_0x4391('0x3b')]);router[_0x4391('0x3a')](_0x4391('0x3c'),auth[_0x4391('0x10')](),controller[_0x4391('0x3d')]);router[_0x4391('0x3a')](_0x4391('0x16'),auth[_0x4391('0x10')](),controller[_0x4391('0x3e')]);var upload=multer({'storage':multer[_0x4391('0x3f')]({'destination':function(_0x110484,_0x301865,_0x459415){_0x459415(null,path[_0x4391('0x40')](config[_0x4391('0x41')],'server/files/images/'));},'filename':function(_0x56a914,_0x7a2723,_0x3c0740){_0x3c0740(null,util[_0x4391('0x42')](_0x4391('0x43'),Date[_0x4391('0x44')](),_0x7a2723[_0x4391('0x45')]));}})});router[_0x4391('0x3a')](_0x4391('0x11'),upload['single'](_0x4391('0x46')),controller['addAvatar']);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x4391('0x47')]);router[_0x4391('0x3a')](_0x4391('0x48'),auth[_0x4391('0x10')](),controller['logout']);router['post'](_0x4391('0x49'),auth['isAuthenticated'](),controller[_0x4391('0x4a')]);router[_0x4391('0x3a')](_0x4391('0x4b'),auth[_0x4391('0x10')](),controller[_0x4391('0x4c')]);router[_0x4391('0x3a')]('/:id/teams',auth[_0x4391('0x10')](),controller[_0x4391('0x4d')]);router[_0x4391('0x3a')](_0x4391('0x4e'),auth[_0x4391('0x10')](),controller[_0x4391('0x4f')]);router[_0x4391('0x3a')]('/:id/mail_interactions',auth[_0x4391('0x10')](),controller[_0x4391('0x50')]);router[_0x4391('0x3a')](_0x4391('0x51'),auth[_0x4391('0x10')](),controller[_0x4391('0x52')]);router[_0x4391('0x3a')]('/:id/sms_interactions',auth[_0x4391('0x10')](),controller['addSmsInteractions']);router[_0x4391('0x3a')](_0x4391('0x53'),auth[_0x4391('0x10')](),controller[_0x4391('0x54')]);router[_0x4391('0x3a')](_0x4391('0x55'),auth[_0x4391('0x10')](),controller[_0x4391('0x56')]);router[_0x4391('0x3a')](_0x4391('0x2c'),auth[_0x4391('0x10')](),controller[_0x4391('0x57')]);router[_0x4391('0x3a')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x4391('0x58')]);router[_0x4391('0x3a')](_0x4391('0x2f'),auth[_0x4391('0x10')](),controller[_0x4391('0x59')]);router[_0x4391('0x3a')]('/:id/sms_accounts',auth[_0x4391('0x10')](),controller['addSmsAccounts']);router[_0x4391('0x3a')]('/:id/chat_websites',auth[_0x4391('0x10')](),controller[_0x4391('0x5a')]);router[_0x4391('0x3a')](_0x4391('0x5b'),auth[_0x4391('0x10')](),controller[_0x4391('0x5c')]);router['post'](_0x4391('0x36'),auth[_0x4391('0x10')](),controller[_0x4391('0x5d')]);router[_0x4391('0x5e')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller[_0x4391('0x5f')]);router[_0x4391('0x5e')](_0x4391('0x60'),auth[_0x4391('0x10')](),controller[_0x4391('0x61')]);router[_0x4391('0x62')](_0x4391('0x16'),auth['isAuthenticated'](),controller[_0x4391('0x63')]);router[_0x4391('0x62')](_0x4391('0x64'),auth['isAuthenticated'](),controller[_0x4391('0x65')]);router[_0x4391('0x62')](_0x4391('0xf'),auth['isAuthenticated'](),controller[_0x4391('0x66')]);router[_0x4391('0x62')]('/:id/chat_interactions',auth[_0x4391('0x10')](),controller[_0x4391('0x67')]);router[_0x4391('0x62')](_0x4391('0x68'),auth[_0x4391('0x10')](),controller[_0x4391('0x69')]);router[_0x4391('0x62')]('/:id/fax_interactions',auth[_0x4391('0x10')](),controller[_0x4391('0x6a')]);router[_0x4391('0x62')](_0x4391('0x6b'),auth[_0x4391('0x10')](),controller['removeSmsInteractions']);router[_0x4391('0x62')](_0x4391('0x53'),auth[_0x4391('0x10')](),controller[_0x4391('0x6c')]);router[_0x4391('0x62')](_0x4391('0x55'),auth['isAuthenticated'](),controller[_0x4391('0x6d')]);router['delete'](_0x4391('0x2c'),auth[_0x4391('0x10')](),controller['removeFaxAccounts']);router[_0x4391('0x62')](_0x4391('0x6e'),auth[_0x4391('0x10')](),controller[_0x4391('0x6f')]);router[_0x4391('0x62')](_0x4391('0x2f'),auth[_0x4391('0x10')](),controller[_0x4391('0x70')]);router['delete'](_0x4391('0x31'),auth[_0x4391('0x10')](),controller[_0x4391('0x71')]);router[_0x4391('0x62')](_0x4391('0x72'),auth[_0x4391('0x10')](),controller[_0x4391('0x73')]);router['delete'](_0x4391('0x5b'),auth[_0x4391('0x10')](),controller[_0x4391('0x74')]);router[_0x4391('0x62')](_0x4391('0x36'),auth[_0x4391('0x10')](),controller['removeApiKey']);router[_0x4391('0x3a')](_0x4391('0x75'),auth[_0x4391('0x10')](),controller[_0x4391('0x76')]);module[_0x4391('0x77')]=router; \ No newline at end of file +var _0xbc77=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','single','file','addAvatar','login','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','connect-timeout'];(function(_0x311a18,_0x267a78){var _0x209237=function(_0x1e14f1){while(--_0x1e14f1){_0x311a18['push'](_0x311a18['shift']());}};_0x209237(++_0x267a78);}(_0xbc77,0x15d));var _0x7bc7=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xbc77[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x7bc7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7bc7('0x1'));var express=require('express');var router=express[_0x7bc7('0x2')]();var fs_extra=require(_0x7bc7('0x3'));var auth=require(_0x7bc7('0x4'));var interaction=require(_0x7bc7('0x5'));var config=require('../../config/environment');var controller=require(_0x7bc7('0x6'));router[_0x7bc7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bc7('0x7')](_0x7bc7('0x8'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xa')]);router[_0x7bc7('0x7')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xc')]);router['get'](_0x7bc7('0xd'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xe')]);router['get'](_0x7bc7('0xf'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x10')]);router[_0x7bc7('0x7')](_0x7bc7('0x11'),controller[_0x7bc7('0x12')]);router['get'](_0x7bc7('0x13'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x14')]);router[_0x7bc7('0x7')](_0x7bc7('0x15'),auth['isAuthenticated'](),controller[_0x7bc7('0x16')]);router[_0x7bc7('0x7')](_0x7bc7('0x17'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x18')]);router[_0x7bc7('0x7')](_0x7bc7('0x19'),auth['isAuthenticated'](),controller[_0x7bc7('0x1a')]);router[_0x7bc7('0x7')](_0x7bc7('0x1b'),auth['isAuthenticated'](),controller[_0x7bc7('0x1c')]);router[_0x7bc7('0x7')](_0x7bc7('0x1d'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x1e')]);router['get'](_0x7bc7('0x1f'),auth['isAuthenticated'](),controller[_0x7bc7('0x20')]);router[_0x7bc7('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x7bc7('0x21')]);router[_0x7bc7('0x7')](_0x7bc7('0x22'),auth[_0x7bc7('0x9')](),controller['getOpenchannelInteractions']);router[_0x7bc7('0x7')](_0x7bc7('0x23'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x24')]);router[_0x7bc7('0x7')](_0x7bc7('0x25'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x26')]);router[_0x7bc7('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x7bc7('0x27')]);router['get'](_0x7bc7('0x28'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x29')]);router['get'](_0x7bc7('0x2a'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x2b')]);router[_0x7bc7('0x7')](_0x7bc7('0x2c'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x2d')]);router[_0x7bc7('0x7')](_0x7bc7('0x2e'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x2f')]);router[_0x7bc7('0x7')](_0x7bc7('0x30'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x31')]);router[_0x7bc7('0x7')](_0x7bc7('0x32'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x7bc7('0x7')](_0x7bc7('0x33'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x7bc7('0x7')](_0x7bc7('0x34'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x35')]);router[_0x7bc7('0x7')]('/:id/sms_accounts',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x36')]);router[_0x7bc7('0x7')]('/:id/chat_websites',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x37')]);router['get'](_0x7bc7('0x38'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x39')]);router[_0x7bc7('0x7')](_0x7bc7('0x3a'),auth[_0x7bc7('0x9')](),controller['getScheduledCalls']);router[_0x7bc7('0x7')](_0x7bc7('0x3b'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x3c')]);router['post'](_0x7bc7('0x15'),auth['isAuthenticated'](),controller[_0x7bc7('0x3d')]);router['post']('/',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x3e')]);router[_0x7bc7('0x3f')](_0x7bc7('0x40'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x41')]);router[_0x7bc7('0x3f')](_0x7bc7('0x17'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x42')]);var upload=multer({'storage':multer[_0x7bc7('0x43')]({'destination':function(_0xf0b5b2,_0xba1d88,_0x18190a){_0x18190a(null,path[_0x7bc7('0x44')](config[_0x7bc7('0x45')],_0x7bc7('0x46')));},'filename':function(_0x52684f,_0x587627,_0x3a4862){_0x3a4862(null,util['format'](_0x7bc7('0x47'),Date[_0x7bc7('0x48')](),_0x587627['originalname']));}})});router[_0x7bc7('0x3f')](_0x7bc7('0x11'),upload[_0x7bc7('0x49')](_0x7bc7('0x4a')),controller[_0x7bc7('0x4b')]);router[_0x7bc7('0x3f')]('/:id/login',auth['isAuthenticated'](),controller[_0x7bc7('0x4c')]);router[_0x7bc7('0x3f')]('/:id/logout',auth[_0x7bc7('0x9')](),controller['logout']);router[_0x7bc7('0x3f')]('/:id/pause',auth['isAuthenticated'](),controller[_0x7bc7('0x4d')]);router[_0x7bc7('0x3f')](_0x7bc7('0x4e'),auth['isAuthenticated'](),controller[_0x7bc7('0x4f')]);router[_0x7bc7('0x3f')](_0x7bc7('0x2a'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x50')]);router[_0x7bc7('0x3f')]('/:id/chat_interactions',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x51')]);router[_0x7bc7('0x3f')](_0x7bc7('0x52'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x53')]);router[_0x7bc7('0x3f')](_0x7bc7('0x54'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x55')]);router[_0x7bc7('0x3f')](_0x7bc7('0x56'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x57')]);router[_0x7bc7('0x3f')](_0x7bc7('0x58'),auth[_0x7bc7('0x9')](),controller['addOpenchannelInteractions']);router[_0x7bc7('0x3f')]('/:id/whatsapp_interactions',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x59')]);router[_0x7bc7('0x3f')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x7bc7('0x5a')]);router[_0x7bc7('0x3f')]('/:id/mail_accounts',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x5b')]);router[_0x7bc7('0x3f')](_0x7bc7('0x34'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x5c')]);router['post'](_0x7bc7('0x5d'),auth[_0x7bc7('0x9')](),controller['addSmsAccounts']);router[_0x7bc7('0x3f')](_0x7bc7('0x5e'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x5f')]);router[_0x7bc7('0x3f')](_0x7bc7('0x38'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x60')]);router[_0x7bc7('0x3f')](_0x7bc7('0x3b'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x61')]);router[_0x7bc7('0x62')](_0x7bc7('0xf'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x63')]);router[_0x7bc7('0x62')](_0x7bc7('0x64'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x65')]);router['delete'](_0x7bc7('0x17'),auth[_0x7bc7('0x9')](),controller['removeQueues']);router[_0x7bc7('0x66')]('/:id/teams',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x67')]);router[_0x7bc7('0x66')](_0x7bc7('0xf'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x68')]);router['delete'](_0x7bc7('0x69'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6a')]);router[_0x7bc7('0x66')](_0x7bc7('0x52'),auth[_0x7bc7('0x9')](),controller['removeMailInteractions']);router[_0x7bc7('0x66')](_0x7bc7('0x54'),auth[_0x7bc7('0x9')](),controller['removeFaxInteractions']);router[_0x7bc7('0x66')](_0x7bc7('0x56'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6b')]);router[_0x7bc7('0x66')](_0x7bc7('0x58'),auth[_0x7bc7('0x9')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6c')]);router[_0x7bc7('0x66')](_0x7bc7('0x32'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6d')]);router['delete'](_0x7bc7('0x33'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6e')]);router[_0x7bc7('0x66')](_0x7bc7('0x34'),auth[_0x7bc7('0x9')](),controller['removeOpenchannelAccounts']);router[_0x7bc7('0x66')](_0x7bc7('0x5d'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6f')]);router[_0x7bc7('0x66')](_0x7bc7('0x5e'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x70')]);router[_0x7bc7('0x66')](_0x7bc7('0x38'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x71')]);router[_0x7bc7('0x66')](_0x7bc7('0x3b'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x72')]);router['post'](_0x7bc7('0x73'),auth['isAuthenticated'](),controller[_0x7bc7('0x74')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d4d4fee..6a6188d 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 _0x5f93=['PROHIB_PASSED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','actpass','nonat','update,nonat','TEXT','get','wss','avpf','force_avp','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','false','blocked','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','setDataValue','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','callerid','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x54e217,_0x243297){var _0x590ead=function(_0x2f1d78){while(--_0x2f1d78){_0x54e217['push'](_0x54e217['shift']());}};_0x590ead(++_0x243297);}(_0x5f93,0x195));var _0x35f9=function(_0x503f1e,_0x10c031){_0x503f1e=_0x503f1e-0x0;var _0xfdd2a1=_0x5f93[_0x503f1e];return _0xfdd2a1;};'use strict';var Sequelize=require(_0x35f9('0x0'));var moment=require(_0x35f9('0x1'));var util=require(_0x35f9('0x2'));var _=require(_0x35f9('0x3'));module[_0x35f9('0x4')]={'name':{'type':Sequelize[_0x35f9('0x5')],'allowNull':![],'unique':_0x35f9('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4401e4){this['setDataValue'](_0x35f9('0x6'),_0x4401e4);this['setDataValue'](_0x35f9('0x7'),_0x4401e4);},'comment':_0x35f9('0x8')},'fullname':{'type':Sequelize[_0x35f9('0x5')],'allowNull':![],'set':function(_0x5e3c01){this[_0x35f9('0x9')](_0x35f9('0xa'),_0x5e3c01);this['setDataValue']('callerid',util[_0x35f9('0xb')](_0x35f9('0xc'),_0x5e3c01,this[_0x35f9('0xd')](_0x35f9('0xe'))));}},'alias':{'type':Sequelize[_0x35f9('0x5')]},'email':{'type':Sequelize[_0x35f9('0x5')],'allowNull':![],'unique':_0x35f9('0xf'),'validate':{'isEmail':!![]},'set':function(_0x52e382){if(_0x52e382){this[_0x35f9('0x9')]('email',_0x52e382[_0x35f9('0x10')]());}}},'role':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x12'),_0x35f9('0x13'),_0x35f9('0x14'),_0x35f9('0x15')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x35f9('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':![],'unique':'internal','set':function(_0x241478){this[_0x35f9('0x9')]('internal',_0x241478);this['setDataValue']('accountcode',_0x241478);this[_0x35f9('0x9')](_0x35f9('0x17'),util['format'](_0x35f9('0xc'),this[_0x35f9('0xd')](_0x35f9('0xa')),_0x241478));}},'salt':{'type':Sequelize[_0x35f9('0x5')]},'phone':{'type':Sequelize[_0x35f9('0x5')]},'mobile':{'type':Sequelize[_0x35f9('0x5')]},'address':{'type':Sequelize[_0x35f9('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x35f9('0x5')]},'country':{'type':Sequelize[_0x35f9('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x35f9('0x5')],'defaultValue':_0x35f9('0x19')},'lastPauseAt':{'type':Sequelize[_0x35f9('0x1a')]},'chatCapacity':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x35f9('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x35f9('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![],'defaultValue':_0x35f9('0x1b')},'ipaddr':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x35f9('0x11')]('friend',_0x35f9('0x13'),'peer'),'allowNull':!![],'defaultValue':_0x35f9('0x1c')},'context':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![],'defaultValue':_0x35f9('0x1d')},'callingpres':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x1e'),_0x35f9('0x1f'),_0x35f9('0x20'),_0x35f9('0x21'),_0x35f9('0x22'),_0x35f9('0x23'),'PROHIB_FAILED_SCREEN',_0x35f9('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![],'defaultValue':_0x35f9('0x25'),'set':function(_0x353ab6){this['setDataValue']('transport',_0x353ab6?_0x353ab6[_0x35f9('0x26')](','):null);},'get':function(){return this[_0x35f9('0xd')](_0x35f9('0x27'))?this['getDataValue']('transport')[_0x35f9('0x28')](','):null;},'comment':_0x35f9('0x29')},'dtmfmode':{'type':Sequelize['ENUM'](_0x35f9('0x2a'),'info',_0x35f9('0x2b'),_0x35f9('0x2c'),_0x35f9('0x2d')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no','nonat',_0x35f9('0x2f'),_0x35f9('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![],'defaultValue':_0x35f9('0x31'),'set':function(_0x81072c){this[_0x35f9('0x9')](_0x35f9('0x32'),_0x81072c?_0x81072c['join'](','):null);},'get':function(){return this[_0x35f9('0xd')]('nat')?this[_0x35f9('0xd')](_0x35f9('0x32'))[_0x35f9('0x28')](','):null;},'comment':_0x35f9('0x33')},'callgroup':{'type':Sequelize[_0x35f9('0x5')]},'namedcallgroup':{'type':Sequelize[_0x35f9('0x5')]},'pickupgroup':{'type':Sequelize[_0x35f9('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x35f9('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x35f9('0x5')]},'disallow':{'type':Sequelize[_0x35f9('0x5')],'allowNull':![],'defaultValue':_0x35f9('0x34')},'allow':{'type':Sequelize[_0x35f9('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2cd82b){this[_0x35f9('0x9')](_0x35f9('0x35'),_0x2cd82b?_0x2cd82b[_0x35f9('0x26')](';'):_0x35f9('0x36'));},'get':function(){return this[_0x35f9('0xd')](_0x35f9('0x35'))?this[_0x35f9('0xd')](_0x35f9('0x35'))['split'](';'):null;},'comment':_0x35f9('0x37')},'autoframing':{'type':Sequelize[_0x35f9('0x11')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![],'set':function(_0x577a45){this[_0x35f9('0x9')](_0x35f9('0x38'),_0x577a45?_0x577a45[_0x35f9('0x26')](','):null);},'get':function(){return this[_0x35f9('0xd')](_0x35f9('0x38'))?this[_0x35f9('0xd')](_0x35f9('0x38'))[_0x35f9('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x35f9('0x11')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![],'defaultValue':_0x35f9('0x39')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x35f9('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x35f9('0x11')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x35f9('0x11')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x35f9('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x35f9('0x11')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x3a'),_0x35f9('0x3b'),_0x35f9('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x3d'),_0x35f9('0x3e')),'allowNull':!![],'defaultValue':_0x35f9('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x35f9('0x2e')},'keepalive':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x35f9('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x35f9('0x11')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x35f9('0x2e'),'no',_0x35f9('0x3f'),_0x35f9('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x35f9('0x11')]('active','passive',_0x35f9('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x35f9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x35f9('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x35f9('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no',_0x35f9('0x42'),_0x35f9('0x2f'),_0x35f9('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x35f9('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x35f9('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x35f9('0x44')]},'showWebBar':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0,'set':function(_0x33c032){this[_0x35f9('0x9')]('showWebBar',_0x33c032);var _0x4ec0a8=this[_0x35f9('0x45')]({'plain':!![]});switch(_0x33c032){case 0x0:case 0x1:var _0x1c466f=_0x4ec0a8[_0x35f9('0x27')]?_['isArray'](_0x4ec0a8[_0x35f9('0x27')])?_0x4ec0a8[_0x35f9('0x27')][_0x35f9('0x26')]():_0x4ec0a8[_0x35f9('0x27')]:_0x35f9('0x25');if(_0x1c466f===_0x35f9('0x46')){_0x1c466f=_0x35f9('0x25');}this[_0x35f9('0x9')](_0x35f9('0x27'),_0x1c466f);this[_0x35f9('0x9')]('encryption','no');this[_0x35f9('0x9')](_0x35f9('0x47'),null);this['setDataValue'](_0x35f9('0x48'),null);this[_0x35f9('0x9')]('icesupport',null);this['setDataValue']('dtlsenable',null);this['setDataValue'](_0x35f9('0x49'),null);this[_0x35f9('0x9')]('dtlssetup',null);this[_0x35f9('0x9')](_0x35f9('0x4a'),null);this['setDataValue'](_0x35f9('0x4b'),null);this[_0x35f9('0x9')](_0x35f9('0x4c'),'no');break;case 0x2:this[_0x35f9('0x9')]('transport',_0x35f9('0x46'));this['setDataValue'](_0x35f9('0x4d'),_0x35f9('0x2e'));this[_0x35f9('0x9')](_0x35f9('0x47'),_0x35f9('0x2e'));this[_0x35f9('0x9')](_0x35f9('0x48'),_0x35f9('0x2e'));this[_0x35f9('0x9')](_0x35f9('0x4e'),'yes');this[_0x35f9('0x9')]('dtlsenable',_0x35f9('0x2e'));this[_0x35f9('0x9')](_0x35f9('0x49'),'no');this[_0x35f9('0x9')](_0x35f9('0x4f'),_0x35f9('0x41'));this[_0x35f9('0x9')](_0x35f9('0x4a'),_0x4ec0a8['dtlscertfile']||_0x35f9('0x50'));this[_0x35f9('0x9')](_0x35f9('0x4b'),_0x4ec0a8['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x35f9('0x4c'),_0x35f9('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x35f9('0x44')],'set':function(_0x78cbf6){this[_0x35f9('0x9')](_0x35f9('0x51'),_0x78cbf6?_0x78cbf6[_0x35f9('0x26')](','):[]);},'get':function(){return this[_0x35f9('0xd')](_0x35f9('0x51'))?_[_0x35f9('0x52')](this[_0x35f9('0xd')](_0x35f9('0x51'))[_0x35f9('0x28')](','),function(_0x377edd){return parseInt(_0x377edd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x35f9('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x35f9('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x35f9('0x11')](_0x35f9('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x35f9('0x53')],'get':function(){return this[_0x35f9('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0x35f9('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0x35f9('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x35f9('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x30eead){if(typeof _0x30eead==='string'){var _0x5eadab=_0x30eead==='1'?!![]:_0x30eead==='0'?![]:_0x30eead==='true'?!![]:_0x30eead===_0x35f9('0x54')?![]:![];this[_0x35f9('0x9')]('screenrecording',_0x5eadab);}else{this[_0x35f9('0x9')]('screenrecording',_0x30eead);}}},'blocked':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![],'set':function(_0x51b1d9){this['setDataValue'](_0x35f9('0x55'),_0x51b1d9);if(_0x51b1d9===!![]){this['setDataValue'](_0x35f9('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0x35f9('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x35f9('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x35f9('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x35f9('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x35f9('0x18')],'defaultValue':![]}}; \ No newline at end of file +var _0x8321=['\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','telephone','local','accountcode','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uac','uas','passive','DATE','get','isArray','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format'];(function(_0x4b2578,_0x2af6eb){var _0x48a117=function(_0x14b377){while(--_0x14b377){_0x4b2578['push'](_0x4b2578['shift']());}};_0x48a117(++_0x2af6eb);}(_0x8321,0xa1));var _0x1832=function(_0x1373cf,_0x281910){_0x1373cf=_0x1373cf-0x0;var _0x58f3f2=_0x8321[_0x1373cf];return _0x58f3f2;};'use strict';var Sequelize=require(_0x1832('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x1832('0x1'));module[_0x1832('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1832('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4ca4bb){this['setDataValue'](_0x1832('0x3'),_0x4ca4bb);this[_0x1832('0x4')](_0x1832('0x5'),_0x4ca4bb);},'comment':_0x1832('0x6')},'fullname':{'type':Sequelize[_0x1832('0x7')],'allowNull':![],'set':function(_0x3633b1){this[_0x1832('0x4')](_0x1832('0x8'),_0x3633b1);this['setDataValue'](_0x1832('0x9'),util[_0x1832('0xa')](_0x1832('0xb'),_0x3633b1,this[_0x1832('0xc')](_0x1832('0xd'))));}},'alias':{'type':Sequelize[_0x1832('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1832('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3d3075){if(_0x3d3075){this[_0x1832('0x4')]('email',_0x3d3075['toLowerCase']());}}},'role':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x10'),_0x1832('0x11'),'agent',_0x1832('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1832('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1832('0x7')],'defaultValue':_0x1832('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x1832('0xd'),'set':function(_0x10acc6){this[_0x1832('0x4')](_0x1832('0xd'),_0x10acc6);this[_0x1832('0x4')](_0x1832('0x14'),_0x10acc6);this['setDataValue'](_0x1832('0x9'),util[_0x1832('0xa')](_0x1832('0xb'),this[_0x1832('0xc')](_0x1832('0x8')),_0x10acc6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1832('0x7')]},'mobile':{'type':Sequelize[_0x1832('0x7')]},'address':{'type':Sequelize[_0x1832('0x7')]},'zipcode':{'type':Sequelize[_0x1832('0x7')]},'userpic':{'type':Sequelize[_0x1832('0x7')]},'city':{'type':Sequelize[_0x1832('0x7')]},'country':{'type':Sequelize[_0x1832('0x7')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1832('0x7')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1832('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1832('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':_0x1832('0x17')},'ipaddr':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x1832('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x18'),_0x1832('0x11'),_0x1832('0x19')),'allowNull':!![],'defaultValue':_0x1832('0x18')},'context':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':_0x1832('0x1a')},'callingpres':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x1b'),'ALLOWED_PASSED_SCREEN',_0x1832('0x1c'),'ALLOWED','PROHIB_NOT_SCREENED',_0x1832('0x1d'),'PROHIB_FAILED_SCREEN',_0x1832('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1832('0x1f'),'set':function(_0x496ece){this[_0x1832('0x4')](_0x1832('0x20'),_0x496ece?_0x496ece[_0x1832('0x21')](','):null);},'get':function(){return this[_0x1832('0xc')](_0x1832('0x20'))?this[_0x1832('0xc')](_0x1832('0x20'))[_0x1832('0x22')](','):null;},'comment':_0x1832('0x23')},'dtmfmode':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x24'),'info',_0x1832('0x25'),_0x1832('0x26'),'auto'),'allowNull':!![],'defaultValue':_0x1832('0x24')},'directmedia':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no',_0x1832('0x28'),_0x1832('0x29'),_0x1832('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':_0x1832('0x2b'),'set':function(_0xf30f98){this[_0x1832('0x4')](_0x1832('0x2c'),_0xf30f98?_0xf30f98[_0x1832('0x21')](','):null);},'get':function(){return this[_0x1832('0xc')](_0x1832('0x2c'))?this[_0x1832('0xc')]('nat')[_0x1832('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1832('0x7')]},'pickupgroup':{'type':Sequelize[_0x1832('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x1832('0x7')]},'language':{'type':Sequelize[_0x1832('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1832('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1832('0x2d')},'allow':{'type':Sequelize[_0x1832('0x7')],'allowNull':![],'defaultValue':_0x1832('0x2e'),'set':function(_0x314218){this[_0x1832('0x4')](_0x1832('0x2f'),_0x314218?_0x314218[_0x1832('0x21')](';'):_0x1832('0x2e'));},'get':function(){return this[_0x1832('0xc')]('allow')?this['getDataValue']('allow')[_0x1832('0x22')](';'):null;},'comment':_0x1832('0x30')},'autoframing':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x549e62){this[_0x1832('0x4')](_0x1832('0x31'),_0x549e62?_0x549e62[_0x1832('0x21')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x1832('0x22')](','):null;},'comment':_0x1832('0x32')},'trustrpid':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no',_0x1832('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1832('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no',_0x1832('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x35'),_0x1832('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x1832('0x37'),_0x1832('0x38')),'allowNull':!![],'defaultValue':_0x1832('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':_0x1832('0x27')},'keepalive':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1832('0xf')]('active',_0x1832('0x39'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1832('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x1832('0x3a')]},'passwordResetAt':{'type':Sequelize[_0x1832('0x3a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0,'set':function(_0x5ddfc9){this[_0x1832('0x4')]('showWebBar',_0x5ddfc9);var _0x167806=this[_0x1832('0x3b')]({'plain':!![]});switch(_0x5ddfc9){case 0x0:case 0x1:var _0x12daa9=_0x167806[_0x1832('0x20')]?_[_0x1832('0x3c')](_0x167806['transport'])?_0x167806[_0x1832('0x20')]['join']():_0x167806['transport']:'udp';if(_0x12daa9==='wss'){_0x12daa9='udp';}this['setDataValue'](_0x1832('0x20'),_0x12daa9);this[_0x1832('0x4')]('encryption','no');this['setDataValue'](_0x1832('0x3d'),null);this[_0x1832('0x4')]('force_avp',null);this[_0x1832('0x4')](_0x1832('0x3e'),null);this[_0x1832('0x4')]('dtlsenable',null);this[_0x1832('0x4')](_0x1832('0x3f'),null);this['setDataValue'](_0x1832('0x40'),null);this[_0x1832('0x4')](_0x1832('0x41'),null);this[_0x1832('0x4')](_0x1832('0x42'),null);this[_0x1832('0x4')](_0x1832('0x43'),'no');break;case 0x2:this['setDataValue'](_0x1832('0x20'),_0x1832('0x44'));this[_0x1832('0x4')]('encryption',_0x1832('0x27'));this[_0x1832('0x4')]('avpf',_0x1832('0x27'));this[_0x1832('0x4')](_0x1832('0x45'),'yes');this[_0x1832('0x4')](_0x1832('0x3e'),'yes');this[_0x1832('0x4')](_0x1832('0x46'),_0x1832('0x27'));this[_0x1832('0x4')](_0x1832('0x3f'),'no');this[_0x1832('0x4')]('dtlssetup',_0x1832('0x47'));this[_0x1832('0x4')]('dtlscertfile',_0x167806[_0x1832('0x41')]||_0x1832('0x48'));this[_0x1832('0x4')]('dtlsprivatekey',_0x167806[_0x1832('0x42')]||_0x1832('0x49'));this['setDataValue'](_0x1832('0x43'),_0x1832('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x1832('0x4a')],'set':function(_0x2d70b3){this[_0x1832('0x4')](_0x1832('0x4b'),_0x2d70b3?_0x2d70b3[_0x1832('0x21')](','):[]);},'get':function(){return this[_0x1832('0xc')](_0x1832('0x4b'))?_[_0x1832('0x4c')](this[_0x1832('0xc')]('permissions')[_0x1832('0x22')](','),function(_0x4dbebd){return parseInt(_0x4dbebd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1832('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1832('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1832('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1832('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1832('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x1832('0xc')](_0x1832('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x1832('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1ce663){if(typeof _0x1ce663===_0x1832('0x4e')){var _0x1a839a=_0x1ce663==='1'?!![]:_0x1ce663==='0'?![]:_0x1ce663===_0x1832('0x4f')?!![]:_0x1ce663===_0x1832('0x50')?![]:![];this[_0x1832('0x4')](_0x1832('0x51'),_0x1a839a);}else{this[_0x1832('0x4')](_0x1832('0x51'),_0x1ce663);}}},'blocked':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![],'set':function(_0x327fd7){this[_0x1832('0x4')](_0x1832('0x52'),_0x327fd7);if(_0x327fd7===!![]){this[_0x1832('0x4')]('blockedAt',moment());this[_0x1832('0x4')](_0x1832('0x53'),0x0);}else{this[_0x1832('0x4')](_0x1832('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1832('0x3a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1832('0x16')](0x5)[_0x1832('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1d12fc0..cfe5a04 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 _0x028e=['$contains','$contained','$any','firstName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','unknown','ringing','queues','inbound','getAgents','flatten','col','asc','desc','substring','orderBy','offline','pause','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','select','field','ui.','InteractionId','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','lodash','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','status','end','json','offset','count','limit','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','update','emit','userNotification:recalc:','get','role','admin','user','Agents','agent','Telephones','telephone','filter','map','value','includes','find','name','UserProfileResource','destroy','User','rawAttributes','type','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','query','include','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','fax','openchannel','whatsapp','show','params','getOptions','includeAll','options','mail','all','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','password','fullname','permissions','103','110','104','106','107','108','100','111','114','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','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','online','interface','format','SIP/%s','voicePause','upsert','removeQueues','isValidChannel','remove','isArray','Queue:remove','voice','UserVoiceQueueRt','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','server/files/images/','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','tag','getQueues','model','keys','Queue','intersection','fields','order','sort','where','filters','pick','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','loginInPause','isMiddleware','resolve','logout','QueuePause','PAUSE','updateAttributes','getChannels','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','getAssociatedQueues','Voice','TeamVoicePrefix','UserVoicePrefix','getDataValue','Queue:save','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','VoicePrefixId','getLists','values','addChatInteractions','omit','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$or','$gte','$lt','$lte','$eq','$not','$in','$like','$notLike','$iLike','$overlap'];(function(_0x54c24a,_0xac399){var _0x33b27b=function(_0x14ff69){while(--_0x14ff69){_0x54c24a['push'](_0x54c24a['shift']());}};_0x33b27b(++_0xac399);}(_0x028e,0x1be));var _0xe028=function(_0x241480,_0x47de78){_0x241480=_0x241480-0x0;var _0x181e8d=_0x028e[_0x241480];return _0x181e8d;};'use strict';var moment=require('moment');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xe028('0x0'));var squel=require('squel');var Redis=require(_0xe028('0x1'));var jayson=require('jayson/promise');var authService=require(_0xe028('0x2'));var contacts=require(_0xe028('0x3'));var qs=require(_0xe028('0x4'));var rta=require(_0xe028('0x5'));var logger=require(_0xe028('0x6'))(_0xe028('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe028('0x8'));var APIBadRequestError=require(_0xe028('0x9'))[_0xe028('0xa')];var APINotFoundError=require('../../errors/api')[_0xe028('0xb')];var APIForbiddenError=require(_0xe028('0x9'))[_0xe028('0xc')];var APIHandleError=require(_0xe028('0x9'))[_0xe028('0xd')];var db=require('../../mysqldb')['db'];var socket=require(_0xe028('0xe'))(new Redis(config[_0xe028('0xf')]));require(_0xe028('0x10'))[_0xe028('0x11')](socket);config['redis']=_[_0xe028('0x12')](config[_0xe028('0xf')],{'host':_0xe028('0x13'),'port':0x18eb});var amiClient=jayson[_0xe028('0x14')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0x5af233,_0x378e7d){_0x378e7d=_0x378e7d||0xcc;return function(_0x4be31f){if(_0x4be31f){return _0x5af233['sendStatus'](_0x378e7d);}return _0x5af233[_0xe028('0x15')](_0x378e7d)[_0xe028('0x16')]();};}function respondWithResult(_0x338477,_0x3169eb){_0x3169eb=_0x3169eb||0xc8;return function(_0x4150dc){if(_0x4150dc){return _0x338477[_0xe028('0x15')](_0x3169eb)[_0xe028('0x17')](_0x4150dc);}};}function respondWithFilteredResult(_0x231593,_0x53692d){return function(_0x35239e){if(_0x35239e){var _0x1a1a0a=typeof _0x53692d[_0xe028('0x18')]==='undefined'&&typeof _0x53692d['limit']==='undefined';var _0x3e4dc4=_0x35239e[_0xe028('0x19')];var _0x1d8f2c=_0x1a1a0a?0x0:_0x53692d[_0xe028('0x18')];var _0x109fee=_0x1a1a0a?_0x35239e[_0xe028('0x19')]:_0x53692d[_0xe028('0x18')]+_0x53692d[_0xe028('0x1a')];var _0x57355f;if(_0x109fee>=_0x3e4dc4){_0x109fee=_0x3e4dc4;_0x57355f=0xc8;}else{_0x57355f=0xce;}_0x231593['status'](_0x57355f);return _0x231593['set']('Content-Range',_0x1d8f2c+'-'+_0x109fee+'/'+_0x3e4dc4)['json'](_0x35239e);}return null;};}function respondWithRpcPromise(_0x50a02e,_0x388a10,_0x230874,_0x133817){return new Promise(function(_0x32a9da,_0x751524){var _0x5f1c59=_0x133817||amiClient;return _0x5f1c59[_0xe028('0x1b')](_0x50a02e,_0x230874)[_0xe028('0x1c')](function(_0x2c61ed){logger['info'](_0xe028('0x1d'),_0x388a10,_0xe028('0x1e'));logger[_0xe028('0x1f')]('User,\x20%s,\x20%s,\x20%s',_0x388a10,'request\x20sent',JSON[_0xe028('0x20')](_0x2c61ed));if(_0x2c61ed[_0xe028('0x21')]){if(_0x2c61ed[_0xe028('0x21')][_0xe028('0x22')]===0x1f4){logger[_0xe028('0x21')](_0xe028('0x1d'),_0x388a10,_0x2c61ed[_0xe028('0x21')][_0xe028('0x23')]);return _0x751524(_0x2c61ed[_0xe028('0x21')][_0xe028('0x23')]);}logger[_0xe028('0x21')](_0xe028('0x1d'),_0x388a10,_0x2c61ed['error'][_0xe028('0x23')]);return _0x32a9da(_0x2c61ed[_0xe028('0x21')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x388a10,_0xe028('0x1e'));_0x32a9da(_0x2c61ed[_0xe028('0x24')][_0xe028('0x23')]);}})[_0xe028('0x25')](function(_0x4f248a){logger[_0xe028('0x21')](_0xe028('0x1d'),_0x388a10,_0x4f248a);_0x751524(_0x4f248a);});});}function saveUpdates(_0x55f1ed){return function(_0x4da1ee){if(_0x4da1ee){return _0x4da1ee[_0xe028('0x26')](_0x55f1ed)[_0xe028('0x1c')](function(_0x4d04d6){if(_0x4d04d6['role']==='agent'){socket[_0xe028('0x27')](_0xe028('0x28')+_0x4d04d6['id'],_0x4d04d6);}return _0x4d04d6;});}return null;};}function removeEntity(_0x1bfb83,_0x3fa088){return function(_0x5f318b){if(_0x5f318b){return _0x5f318b['destroy']({'transaction':_0x3fa088})[_0xe028('0x1c')](function(){var _0x2395fc=_0x5f318b[_0xe028('0x29')]({'plain':!![]});if(_0x2395fc[_0xe028('0x2a')]===_0xe028('0x2b'))return;var _0x37d955=[{'name':'Users','value':_0xe028('0x2c'),'ignore':!![]},{'name':_0xe028('0x2d'),'value':_0xe028('0x2e'),'ignore':![]},{'name':_0xe028('0x2f'),'value':_0xe028('0x30'),'ignore':![]}];var _0x45314d=_(_0x37d955)[_0xe028('0x31')]('ignore')[_0xe028('0x32')](_0xe028('0x33'))['value']();if(_[_0xe028('0x34')](_0x45314d,_0x2395fc['role'])){return;}var _0x4da532=_[_0xe028('0x35')](_0x37d955,[_0xe028('0x33'),_0x2395fc['role']])[_0xe028('0x36')];return db[_0xe028('0x37')][_0xe028('0x38')]({'where':{'type':_0x4da532,'resourceId':_0x2395fc['id']},'transaction':_0x3fa088})[_0xe028('0x1c')](function(){return _0x5f318b;});})[_0xe028('0x1c')](function(){_0x1bfb83['status'](0xcc)[_0xe028('0x16')]();});}};}function handleEntityNotFound(_0x120bf0){return function(_0x312edd){if(!_0x312edd){_0x120bf0['sendStatus'](0x194);}return _0x312edd;};}function handleError(_0x558dcb,_0x216398){_0x216398=_0x216398||0x1f4;return function(_0x12868c){logger[_0xe028('0x21')](_0x12868c['stack']);if(_0x12868c['name']){delete _0x12868c['name'];}_0x558dcb['status'](_0x216398)['send'](_0x12868c);};}function getUserAttributes(){return _(db[_0xe028('0x39')][_0xe028('0x3a')])[_0xe028('0x32')](function(_0x30d89a){return{'name':_0x30d89a['fieldName'],'type':_0x30d89a[_0xe028('0x3b')][_0xe028('0x3c')]};})[_0xe028('0x31')](function(_0x39baad){return!['password',_0xe028('0x3d'),_0xe028('0x3e'),_0xe028('0x3f'),_0xe028('0x40'),_0xe028('0x41')][_0xe028('0x34')](_0x39baad[_0xe028('0x36')]);})[_0xe028('0x33')]();}exports[_0xe028('0x42')]=function(_0x383bc3,_0x553c75){var _0x3f2e57={},_0xf35681={'count':0x0,'rows':[]};var _0x47454c=getUserAttributes();_0x3f2e57=qs['getOptions'](_0x47454c,_0x383bc3);var _0x575ae9={'where':_0x3f2e57['where']};return db[_0xe028('0x39')][_0xe028('0x19')](_0x575ae9)[_0xe028('0x1c')](function(_0x14c18b){_0xf35681['count']=_0x14c18b;if(_0x383bc3[_0xe028('0x43')]['includeAll']){_0x3f2e57[_0xe028('0x44')]=[{'all':!![]}];}if(_0x383bc3[_0xe028('0x43')]['userSetting']===_0xe028('0x45')){_0x3f2e57['include']=[{'model':db[_0xe028('0x46')],'as':_0xe028('0x47')}];}if(!_[_0xe028('0x34')](_0x3f2e57[_0xe028('0x48')],'id')){_0x3f2e57['attributes'][_0xe028('0x49')]('id');}return db[_0xe028('0x39')][_0xe028('0x4a')](_0x3f2e57);})[_0xe028('0x1c')](function(_0x29a277){_0xf35681[_0xe028('0x4b')]=_0x29a277;if(_0x383bc3[_0xe028('0x43')][_0xe028('0x4c')]===_0xe028('0x45')){var _0x2ab163=[];for(var _0x46f286=0x0;_0x46f286<_0xf35681[_0xe028('0x4b')]['length'];_0x46f286++){_0x2ab163[_0xe028('0x49')](get_open_tabs(_0xe028('0x4d'),_0xf35681[_0xe028('0x4b')][_0x46f286][_0xe028('0x4e')]));_0x2ab163[_0xe028('0x49')](get_open_tabs(_0xe028('0x4f'),_0xf35681[_0xe028('0x4b')][_0x46f286][_0xe028('0x4e')]));_0x2ab163[_0xe028('0x49')](get_open_tabs(_0xe028('0x50'),_0xf35681[_0xe028('0x4b')][_0x46f286][_0xe028('0x4e')]));_0x2ab163[_0xe028('0x49')](get_open_tabs('mail',_0xf35681[_0xe028('0x4b')][_0x46f286][_0xe028('0x4e')]));_0x2ab163[_0xe028('0x49')](get_open_tabs(_0xe028('0x51'),_0xf35681['rows'][_0x46f286][_0xe028('0x4e')]));_0x2ab163[_0xe028('0x49')](get_open_tabs(_0xe028('0x52'),_0xf35681['rows'][_0x46f286]['dataValues']));}return Promise['all'](_0x2ab163)[_0xe028('0x1c')](function(){return _0xf35681;});}else{return _0xf35681;}})[_0xe028('0x1c')](respondWithFilteredResult(_0x553c75,_0x3f2e57))[_0xe028('0x25')](handleError(_0x553c75,null));};exports[_0xe028('0x53')]=function(_0x17096b,_0x9c120c){var _0x4505dc=getUserAttributes();_0x17096b[_0xe028('0x43')]['id']=_0x17096b[_0xe028('0x54')]['id'];var _0x269d3e=qs[_0xe028('0x55')](_0x4505dc,_0x17096b);if(_0x17096b[_0xe028('0x43')][_0xe028('0x56')]){_0x269d3e[_0xe028('0x44')]=[{'all':!![]}];}if(_0x17096b[_0xe028('0x43')][_0xe028('0x47')]===_0xe028('0x45')){_0x269d3e['include']=[{'model':db[_0xe028('0x46')],'as':'userSetting'}];}_0x269d3e=_['merge']({},_0x269d3e,_0x17096b[_0xe028('0x57')]);if(!_[_0xe028('0x34')](_0x269d3e[_0xe028('0x48')],'id')){_0x269d3e[_0xe028('0x48')][_0xe028('0x49')]('id');}return db[_0xe028('0x39')][_0xe028('0x35')](_0x269d3e)[_0xe028('0x1c')](handleEntityNotFound(_0x9c120c,null))[_0xe028('0x1c')](function(_0x5b6d72){var _0x4aa941=[];values=_0x5b6d72;if(_0x17096b['query'][_0xe028('0x4c')]===_0xe028('0x45')){_0x4aa941[_0xe028('0x49')](get_open_tabs(_0xe028('0x4d'),_0x5b6d72['dataValues']));_0x4aa941[_0xe028('0x49')](get_open_tabs(_0xe028('0x4f'),_0x5b6d72[_0xe028('0x4e')]));_0x4aa941['push'](get_open_tabs(_0xe028('0x51'),_0x5b6d72[_0xe028('0x4e')]));_0x4aa941['push'](get_open_tabs(_0xe028('0x52'),_0x5b6d72[_0xe028('0x4e')]));_0x4aa941['push'](get_open_tabs(_0xe028('0x50'),_0x5b6d72[_0xe028('0x4e')]));_0x4aa941[_0xe028('0x49')](get_open_tabs(_0xe028('0x58'),_0x5b6d72['dataValues']));return Promise[_0xe028('0x59')](_0x4aa941);}else{return values;}})['then'](function(){return values;})[_0xe028('0x1c')](respondWithResult(_0x9c120c,null))['catch'](handleError(_0x9c120c,null));};exports[_0xe028('0x26')]=function(_0x8010f3,_0x59ef76){if(_0x8010f3[_0xe028('0x5a')]['id']){delete _0x8010f3[_0xe028('0x5a')]['id'];}delete _0x8010f3[_0xe028('0x5a')][_0xe028('0x2a')];return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0x8010f3[_0xe028('0x54')]['id']}})['then'](handleEntityNotFound(_0x59ef76,null))['then'](saveUpdates(_0x8010f3['body'],null))[_0xe028('0x1c')](respondWithResult(_0x59ef76,null))[_0xe028('0x25')](handleError(_0x59ef76,null));};exports['describe']=function(_0x3bc1ea,_0x39ece5){return db[_0xe028('0x39')][_0xe028('0x5b')]()[_0xe028('0x1c')](respondWithResult(_0x39ece5,null))[_0xe028('0x25')](handleError(_0x39ece5,null));};exports[_0xe028('0x5c')]=function(_0x1bf5a7,_0x339317){return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0x1bf5a7[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x339317,null))[_0xe028('0x1c')](function(_0x45b05c){if(_0x45b05c){return _0x45b05c[_0xe028('0x5c')](_0x1bf5a7[_0xe028('0x5a')][_0xe028('0x5d')],_['omit'](_0x1bf5a7['body'],[_0xe028('0x5d'),'id'])||{});}})[_0xe028('0x1c')](respondWithResult(_0x339317,null))[_0xe028('0x25')](handleError(_0x339317,null));};function validateUser(_0x4d923a){return new Promise(function(_0x5df735,_0x57dab3){if(_0x4d923a[_0xe028('0x5e')])return _0x5df735(_0x4d923a);return db[_0xe028('0x5f')][_0xe028('0x60')](0x1)['then'](function(_0x34d1fd){if(_0x34d1fd[_0xe028('0x61')])authService[_0xe028('0x62')](_0x4d923a['password']);db[_0xe028('0x39')][_0xe028('0x63')](_0xe028('0x5e'))[_0xe028('0x1c')](function(_0x16f8f2){if(_[_0xe028('0x64')](_0x16f8f2)){_0x4d923a[_0xe028('0x5e')]=_0x34d1fd[_0xe028('0x65')]||0x1;return;}if(_[_0xe028('0x64')](_0x34d1fd[_0xe028('0x65')])||_0x34d1fd[_0xe028('0x65')]===_0x16f8f2){_0x4d923a[_0xe028('0x5e')]=_0x16f8f2+0x1;return;}if(_0x34d1fd[_0xe028('0x65')]>_0x16f8f2){_0x4d923a[_0xe028('0x5e')]=_0x34d1fd[_0xe028('0x65')];return;}return db[_0xe028('0x66')]['query'](_0xe028('0x67'),{'type':db[_0xe028('0x66')][_0xe028('0x68')][_0xe028('0x69')]})[_0xe028('0x1c')](function(_0x1f2d5b){if(_0x1f2d5b&&_0x1f2d5b[_0xe028('0x6a')]){for(var _0x5ac966=0x0,_0x2d8182=_0x1f2d5b[_0xe028('0x6a')];_0x5ac966<_0x2d8182&&_[_0xe028('0x64')](_0x4d923a[_0xe028('0x5e')]);_0x5ac966++){if(_0x34d1fd[_0xe028('0x65')]<=_0x1f2d5b[_0x5ac966][_0xe028('0x6b')]){_0x4d923a[_0xe028('0x5e')]=_0x1f2d5b[_0x5ac966][_0xe028('0x6b')];}else if(_0x34d1fd[_0xe028('0x65')]>_0x1f2d5b[_0x5ac966][_0xe028('0x6b')]&&_0x34d1fd[_0xe028('0x65')]<=_0x1f2d5b[_0x5ac966]['to']){_0x4d923a['internal']=_0x34d1fd[_0xe028('0x65')];}}}if(_[_0xe028('0x64')](_0x4d923a[_0xe028('0x5e')])){_0x4d923a['internal']=_0x16f8f2+0x1;}return _0x5df735(_0x4d923a);});});})[_0xe028('0x25')](function(_0x11bb80){_0x57dab3(_0x11bb80);});});}function updateUser(_0x15d69f){return new Promise(function(_0x3746b3,_0xd2ca22){try{if(_0x15d69f['voicemail']){_0x15d69f['mailbox']=_0x15d69f[_0xe028('0x5e')];_0x15d69f['VoiceMail']={'mailbox':_0x15d69f['internal'],'password':_0x15d69f[_0xe028('0x6c')],'fullname':_0x15d69f[_0xe028('0x6d')],'email':_0x15d69f['email']};}if(_0x15d69f[_0xe028('0x2a')]===_0xe028('0x2e')){if(!_0x15d69f['permissions'])_0x15d69f[_0xe028('0x6e')]=['101','102',_0xe028('0x6f'),'113',_0xe028('0x70'),_0xe028('0x71'),'105',_0xe028('0x72'),_0xe028('0x73'),_0xe028('0x74'),'109',_0xe028('0x75'),_0xe028('0x76'),_0xe028('0x77'),_0xe028('0x78')];}_0x3746b3(_0x15d69f);}catch(_0x1fc6e8){_0xd2ca22(_0x1fc6e8);}});}exports[_0xe028('0x79')]=function(_0x18db70,_0x1a0d66){if(_0x18db70[_0xe028('0x2c')][_0xe028('0x2a')]==='agent')throw new Error(_0xe028('0x7a'));if(_0x18db70[_0xe028('0x5a')][_0xe028('0x2a')]===_0xe028('0x2c')&&_0x18db70['user'][_0xe028('0x2a')]!==_0xe028('0x2b')){throw new Error(_0xe028('0x7b'));}if(_0x18db70[_0xe028('0x5a')]['role']==='admin'&&_0x18db70[_0xe028('0x2c')][_0xe028('0x2a')]!==_0xe028('0x2b')){throw new Error(_0xe028('0x7c'));}return licenseUtil['checkUserLimits']([_0x18db70[_0xe028('0x5a')]])['then'](function(){return validateUser(_0x18db70[_0xe028('0x5a')]);})[_0xe028('0x1c')](function(_0x266867){return updateUser(_0x266867)['then'](function(_0x2b2e0d){if(_0x2b2e0d[_0xe028('0x2a')]==='admin'){_0x2b2e0d[_0xe028('0x7d')]=_0x18db70['user'][_0xe028('0x7d')];delete _0x2b2e0d[_0xe028('0x7e')];}return _0x2b2e0d;});})['then'](function(_0x167716){return db[_0xe028('0x39')][_0xe028('0x79')](_0x167716,{'include':[{'model':db[_0xe028('0x7f')],'as':_0xe028('0x7f')}]});})[_0xe028('0x1c')](function(_0x5348de){if(_0x18db70['body'][_0xe028('0x2a')]==='user')return _0x5348de;if(_0x18db70[_0xe028('0x2c')][_0xe028('0x2a')]!==_0xe028('0x2c'))return _0x5348de;return db[_0xe028('0x80')][_0xe028('0x35')]({'where':{'name':_0x5348de['role']===_0xe028('0x2e')?_0xe028('0x2d'):_0xe028('0x2f'),'userProfileId':_0x18db70[_0xe028('0x2c')]['userProfileId']},'raw':!![]})[_0xe028('0x1c')](function(_0x40cd49){if(!_0x40cd49||_0x40cd49[_0xe028('0x81')]!=0x0)return _0x5348de;return db['UserProfileResource'][_0xe028('0x79')]({'name':_0x5348de[_0xe028('0x36')],'resourceId':_0x5348de['id'],'type':_0x40cd49['name'],'sectionId':_0x40cd49['id']},{})[_0xe028('0x1c')](function(){return _0x5348de;});})[_0xe028('0x25')](function(_0xf47065){logger[_0xe028('0x21')](_0xe028('0x82'),_0xf47065);throw _0xf47065;});})[_0xe028('0x1c')](respondWithResult(_0x1a0d66,0xc9))[_0xe028('0x25')](handleError(_0x1a0d66,null));};exports[_0xe028('0x83')]=function(_0x53399d,_0x162fd3){var _0x3dd876=_0x53399d[_0xe028('0x5a')];var _0x1f574b=[];if(_0x53399d[_0xe028('0x2c')][_0xe028('0x2a')]==='agent')throw new Error('Unauthorized');if(_[_0xe028('0x84')](_0x3dd876,[_0xe028('0x2a'),_0xe028('0x2c')])&&_0x53399d['user'][_0xe028('0x2a')]!=='admin'){throw new Error(_0xe028('0x7b'));}if(_[_0xe028('0x84')](_0x3dd876,[_0xe028('0x2a'),'admin'])&&_0x53399d[_0xe028('0x2c')][_0xe028('0x2a')]!==_0xe028('0x2b')){throw new Error(_0xe028('0x85'));}return licenseUtil[_0xe028('0x86')](_0x3dd876)['then'](function(){return validateUser(_0x3dd876[0x0]);})['then'](function(){for(var _0x1b70f1=0x1;_0x1b70f1<_0x3dd876[_0xe028('0x6a')];_0x1b70f1++){var _0x4d83cf=_0x3dd876[_0x1b70f1-0x1][_0xe028('0x5e')];if(!_0x3dd876[_0x1b70f1][_0xe028('0x5e')])_0x3dd876[_0x1b70f1][_0xe028('0x5e')]=_0x4d83cf+0x1;_0x1f574b['push'](validateUser(_0x3dd876[_0x1b70f1]));}return Promise[_0xe028('0x59')](_0x1f574b);})['then'](function(){_0x1f574b=[];for(var _0x5acc2b=0x0;_0x5acc2b<_0x3dd876[_0xe028('0x6a')];_0x5acc2b++){_0x1f574b[_0xe028('0x49')](updateUser(_0x3dd876[_0x5acc2b]));}return Promise['all'](_0x1f574b);})['then'](function(){_0x1f574b=_0x3dd876[_0xe028('0x32')](function(_0x1e7148){return db[_0xe028('0x39')]['create'](_0x1e7148,{'include':[{'model':db[_0xe028('0x7f')],'as':_0xe028('0x7f')}]})[_0xe028('0x1c')](function(_0x29b5ab){_0x1e7148['id']=_0x29b5ab['id'];return _0x1e7148;});});return Promise['all'](_0x1f574b);})[_0xe028('0x1c')](function(_0x332659){if(_0x53399d['body'][_0xe028('0x2a')]===_0xe028('0x2c'))return _0x332659;if(_0x53399d[_0xe028('0x2c')][_0xe028('0x2a')]!==_0xe028('0x2c'))return _0x332659;var _0x3f0a6b=_[_0xe028('0x84')](_0x332659,function(_0x1b3a94){return _0x1b3a94['role']==='agent'||_0x1b3a94['role']===_0xe028('0x30');});if(!_0x3f0a6b)return _0x332659;return db[_0xe028('0x80')][_0xe028('0x4a')]({'where':{'name':{'$or':['Agents',_0xe028('0x2f')]},'userProfileId':_0x53399d[_0xe028('0x2c')][_0xe028('0x7e')]},'raw':!![]})['then'](function(_0x25c615){if(_[_0xe028('0x87')](_0x25c615)||!_[_0xe028('0x84')](_0x25c615,[_0xe028('0x81'),0x0]))return _0x332659;_0x1f574b=[];var _0x1f61fe=_(_0x25c615)[_0xe028('0x32')](function(_0x3dad45){if(_0x3dad45['autoAssociation']===0x1)return;return _0x3dad45[_0xe028('0x36')]===_0xe028('0x2d')?'agent':_0xe028('0x30');})['compact']()['value']();for(var _0x5d2898=0x0;_0x5d2898<_0x332659[_0xe028('0x6a')];_0x5d2898++){if(!_[_0xe028('0x34')](_0x1f61fe,_0x332659[_0x5d2898]['role']))return;var _0x4b8758=_0x332659[_0x5d2898][_0xe028('0x2a')]===_0xe028('0x2e')?_0xe028('0x2d'):_0xe028('0x2f');_0x1f574b[_0xe028('0x49')](db[_0xe028('0x37')]['create']({'name':_0x332659[_0x5d2898][_0xe028('0x36')],'resourceId':_0x332659[_0x5d2898]['id'],'type':_0x4b8758,'sectionId':_[_0xe028('0x35')](_0x25c615,[_0xe028('0x36'),_0x4b8758])['id']},{}));}return Promise[_0xe028('0x59')](_0x1f574b);});})[_0xe028('0x1c')](respondWithResult(_0x162fd3,0xc9))[_0xe028('0x25')](handleError(_0x162fd3,null));};exports['changePassword']=function(_0xb156c,_0x5503c0){if(_0xb156c['body']['id']){delete _0xb156c[_0xe028('0x5a')]['id'];}return db['User'][_0xe028('0x35')]({'where':{'id':_0xb156c[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](function(_0x20bbfa){if(!_0x20bbfa)return null;if(_0x20bbfa['id']===_0xb156c[_0xe028('0x2c')]['id']){if(!_0xb156c[_0xe028('0x5a')][_0xe028('0x88')]||!_0xb156c[_0xe028('0x5a')][_0xe028('0x89')]){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))](_0xe028('0x8c'));}if(!_0x20bbfa['authenticate'](_0xb156c[_0xe028('0x5a')][_0xe028('0x88')])){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))](_0xe028('0x8d'));}if(_0xb156c[_0xe028('0x5a')][_0xe028('0x88')]===_0xb156c[_0xe028('0x5a')][_0xe028('0x89')]){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xb156c[_0xe028('0x2c')]['role']===_0xe028('0x2b')){if(!_0xb156c['body'][_0xe028('0x89')]){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))](_0xe028('0x8e'));}}else if(_0xb156c[_0xe028('0x2c')]['role']===_0xe028('0x2c')){if(!_0xb156c[_0xe028('0x5a')][_0xe028('0x89')]){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x20bbfa[_0xe028('0x2a')]!==_0xe028('0x2e')){throw new db['Sequelize'][(_0xe028('0x8b'))](_0xe028('0x7a'));}}else{throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))]('Unauthorized');}return _0x20bbfa;})[_0xe028('0x1c')](handleEntityNotFound(_0x5503c0,null))[_0xe028('0x1c')](function(_0x215710){return db[_0xe028('0x5f')]['findOne']({'attributes':['id',_0xe028('0x61'),_0xe028('0x8f'),_0xe028('0x90')]})[_0xe028('0x1c')](function(_0x435e70){if(_0x435e70[_0xe028('0x61')])authService['validatePasswordPattern'](_0xb156c[_0xe028('0x5a')]['newPassword']);if(!_0x435e70[_0xe028('0x8f')]||!_0x215710[_0xe028('0x3e')])return _0x215710;authService['validatePasswordHistory'](_0xb156c[_0xe028('0x5a')][_0xe028('0x89')],_0x215710[_0xe028('0x3e')],_0x435e70[_0xe028('0x90')]);return _0x215710;})['then'](saveUpdates({'password':_0xb156c[_0xe028('0x5a')][_0xe028('0x89')],'passwordResetAt':_0xb156c[_0xe028('0x2c')]['id']==_0xb156c['params']['id']?moment():null,'previousPasswords':authService[_0xe028('0x91')](_0xb156c[_0xe028('0x5a')][_0xe028('0x89')],_0x215710[_0xe028('0x3e')])},null));})[_0xe028('0x1c')](respondWithResult(_0x5503c0,null))[_0xe028('0x25')](handleError(_0x5503c0,null));};exports[_0xe028('0x92')]=function(_0xe5cf07,_0x2d7885){var _0x274b4b=_0xe5cf07[_0xe028('0x5a')][_0xe028('0x93')];return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0xe5cf07[_0xe028('0x54')]['id']},'attributes':['id',_0xe028('0x36'),_0xe028('0x2a'),'online','loginInPause','voicePause','interface']})[_0xe028('0x1c')](handleEntityNotFound(_0x2d7885,null))[_0xe028('0x1c')](function(_0x4afbfa){if(_0x4afbfa){if(!utils['isValidChannel'](_0x274b4b)){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))](_0xe028('0x94'));}return _0x4afbfa[_0xe028('0x95')+_[_0xe028('0x96')](_0x274b4b[_0xe028('0x97')]())+_0xe028('0x98')](_0xe5cf07[_0xe028('0x5a')][_0xe028('0x5d')],{'penalty':_0xe5cf07[_0xe028('0x5a')][_0xe028('0x99')]||0x0})['spread'](function(_0xedd8c9){for(var _0x446915=0x0;_0x446915<_0xe5cf07['body'][_0xe028('0x5d')]['length'];_0x446915+=0x1){var _0x151147={'UserId':Number(_0xe5cf07[_0xe028('0x54')]['id'])};_0x151147[_['capitalize'](_0x274b4b['toLowerCase']())+_0xe028('0x9a')]=Number(_0xe5cf07['body'][_0xe028('0x5d')][_0x446915]);socket[_0xe028('0x27')](_0xe028('0x2c')+_[_0xe028('0x96')](_0x274b4b[_0xe028('0x97')]())+'Queue:save',_0x151147);}return _0xedd8c9;})['then'](function(){if(_0x274b4b==='voice'){return db['VoiceQueue'][_0xe028('0x4a')]({'where':{'id':_0xe5cf07[_0xe028('0x5a')][_0xe028('0x5d')]||[]},'raw':!![],'attributes':['id',_0xe028('0x36')]});}})[_0xe028('0x1c')](function(_0x11e56a){var _0x47d7e1=_0x4afbfa[_0xe028('0x29')]({'plain':!![]});var _0x12fcbf=[];if(_0x274b4b==='voice'&&_0x47d7e1['role']==='agent'&&_0x47d7e1[_0xe028('0x9b')]){for(let _0xdfb07f=0x0;_0xdfb07f<_0x11e56a['length'];_0xdfb07f+=0x1){_0x12fcbf[_0xe028('0x49')]({'membername':_0x47d7e1[_0xe028('0x36')],'UserId':_0x47d7e1['id'],'queue_name':_0x11e56a[_0xdfb07f]['name'],'VoiceQueueId':_0x11e56a[_0xdfb07f]['id'],'interface':_['isNil'](_0x47d7e1[_0xe028('0x9c')])?util[_0xe028('0x9d')](_0xe028('0x9e'),_0x47d7e1[_0xe028('0x36')]):_0x47d7e1[_0xe028('0x9c')],'paused':_0x47d7e1[_0xe028('0x9f')]||![],'penalty':_0xe5cf07[_0xe028('0x5a')][_0xe028('0x99')]||0x0});}return Promise[_0xe028('0x59')](_0x12fcbf[_0xe028('0x32')](function(_0x50a86d){return db['UserVoiceQueueRt'][_0xe028('0xa0')](_0x50a86d);}));}return _0x4afbfa;});}})[_0xe028('0x1c')](respondWithStatusCode(_0x2d7885,null))['catch'](handleError(_0x2d7885,null));};exports[_0xe028('0xa1')]=function(_0x42d40d,_0x5c9ec9){var _0x377a9d,_0x4bd6f2;return db[_0xe028('0x39')]['find']({'where':{'id':_0x42d40d[_0xe028('0x54')]['id']},'attributes':['id',_0xe028('0x36'),_0xe028('0x2a')]})['then'](handleEntityNotFound(_0x5c9ec9,null))[_0xe028('0x1c')](function(_0x3c126b){if(_0x3c126b){_0x377a9d=_0x3c126b;if(!_0x42d40d[_0xe028('0x43')][_0xe028('0x93')]||!utils[_0xe028('0xa2')](_0x42d40d[_0xe028('0x43')][_0xe028('0x93')])){throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))](_0xe028('0x94'));}return _0x3c126b[_0xe028('0xa3')+_['capitalize'](_0x42d40d[_0xe028('0x43')]['channel'][_0xe028('0x97')]())+'Queues'](_0x42d40d[_0xe028('0x43')]['ids']);}})[_0xe028('0x1c')](function(_0x414882){if(_[_0xe028('0xa4')](_0x42d40d[_0xe028('0x43')][_0xe028('0x5d')])){for(var _0x34441a=0x0;_0x34441a<_0x42d40d[_0xe028('0x43')][_0xe028('0x5d')]['length'];_0x34441a+=0x1){_0x4bd6f2={'UserId':Number(_0x42d40d['params']['id'])};_0x4bd6f2[_['capitalize'](_0x42d40d[_0xe028('0x43')]['channel']['toLowerCase']())+_0xe028('0x9a')]=Number(_0x42d40d[_0xe028('0x43')][_0xe028('0x5d')][_0x34441a]);socket[_0xe028('0x27')]('user'+_['capitalize'](_0x42d40d['query']['channel'][_0xe028('0x97')]())+'Queue:remove',_0x4bd6f2);}}else{_0x4bd6f2={'UserId':Number(_0x42d40d[_0xe028('0x54')]['id'])};_0x4bd6f2[_['capitalize'](_0x42d40d[_0xe028('0x43')][_0xe028('0x93')][_0xe028('0x97')]())+'QueueId']=Number(_0x42d40d[_0xe028('0x43')][_0xe028('0x5d')]);socket[_0xe028('0x27')](_0xe028('0x2c')+_[_0xe028('0x96')](_0x42d40d['query'][_0xe028('0x93')]['toLowerCase']())+_0xe028('0xa5'),_0x4bd6f2);}return _0x414882;})['then'](function(){if(_0x42d40d['query'][_0xe028('0x93')]===_0xe028('0xa6')){return db[_0xe028('0xa7')]['destroy']({'where':{'UserId':_0x42d40d['params']['id'],'VoiceQueueId':_0x42d40d[_0xe028('0x43')]['ids']},'individualHooks':!![]})[_0xe028('0x1c')](function(){return _0x377a9d;});}return _0x377a9d;})['then'](respondWithStatusCode(_0x5c9ec9,null))['catch'](handleError(_0x5c9ec9,null));};exports[_0xe028('0xa8')]=function(_0x1b0000,_0xbdf070){_0x1b0000['body']['userpic']=_0x1b0000[_0xe028('0xa9')][_0xe028('0xaa')];return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0x1b0000[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0xbdf070,null))[_0xe028('0x1c')](saveUpdates(_0x1b0000[_0xe028('0x5a')],null))[_0xe028('0x1c')](respondWithResult(_0xbdf070,null))[_0xe028('0x25')](handleError(_0xbdf070,null));};exports[_0xe028('0xab')]=function(_0xd873da,_0x4be056){var _0x59331f=path[_0xe028('0xac')](config[_0xe028('0xad')],_0xe028('0xae'));return db[_0xe028('0x39')]['find']({'where':{'id':_0xd873da[_0xe028('0x54')]['id']},'attributes':['id',_0xe028('0xaf')],'raw':!![]})['then'](handleEntityNotFound(_0x4be056,null))[_0xe028('0x1c')](function(_0x3dcead){if(_0x3dcead){if(_[_0xe028('0x64')](_0x3dcead[_0xe028('0xaf')])){return _0x4be056[_0xe028('0xb0')](_0x59331f);}else{if(!fs['existsSync'](path['join'](config[_0xe028('0xad')],_0xe028('0xb1'),_0x3dcead['userpic']))){return _0x4be056[_0xe028('0xb0')](_0x59331f);}return _0x4be056['download'](path[_0xe028('0xac')](config[_0xe028('0xad')],_0xe028('0xb1'),_0x3dcead[_0xe028('0xaf')]));}}})[_0xe028('0x25')](handleError(_0x4be056,null));};exports['getOpenTabs']=function(_0xa17b3f,_0x2b7a48){return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0xa17b3f[_0xe028('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2b7a48,null))['then'](function(_0x303efd){var _0x5936d8=[];values=_0x303efd[_0xe028('0x4e')];_0x5936d8[_0xe028('0x49')](get_open_tabs(_0xe028('0x4d'),_0x303efd[_0xe028('0x4e')]));_0x5936d8[_0xe028('0x49')](get_open_tabs(_0xe028('0x4f'),_0x303efd['dataValues']));_0x5936d8['push'](get_open_tabs(_0xe028('0x51'),_0x303efd[_0xe028('0x4e')]));_0x5936d8[_0xe028('0x49')](get_open_tabs(_0xe028('0x52'),_0x303efd[_0xe028('0x4e')]));_0x5936d8[_0xe028('0x49')](get_open_tabs('fax',_0x303efd[_0xe028('0x4e')]));_0x5936d8[_0xe028('0x49')](get_open_tabs(_0xe028('0x58'),_0x303efd[_0xe028('0x4e')]));return Promise[_0xe028('0x59')](_0x5936d8);})[_0xe028('0x1c')](function(_0x3ecb50){if(_0x3ecb50){var _0x5bb4a4=_['map'](values[_0xe028('0xb2')],function(_0x5bc5a4){return{'channel':'CHAT','id':_0x5bc5a4['id'],'createdAt':_0x5bc5a4['createdAt']};});var _0x1137ab=_['map'](values[_0xe028('0xb3')],function(_0x649b85){return{'channel':_0xe028('0xb4'),'id':_0x649b85['id'],'createdAt':_0x649b85[_0xe028('0xb5')]};});var _0x2d02af=_[_0xe028('0x32')](values['OpenchannelOpenTabs'],function(_0x5425df){return{'channel':_0xe028('0xb6'),'id':_0x5425df['id'],'createdAt':_0x5425df[_0xe028('0xb5')]};});var _0x2cba2e=_[_0xe028('0x32')](values[_0xe028('0xb7')],function(_0x26c719){return{'channel':_0xe028('0xb8'),'id':_0x26c719['id'],'createdAt':_0x26c719['createdAt']};});var _0x382aa3=_['map'](values[_0xe028('0xb9')],function(_0x1e8fd2){return{'channel':_0xe028('0xba'),'id':_0x1e8fd2['id'],'createdAt':_0x1e8fd2[_0xe028('0xb5')]};});var _0x34544e=_['map'](values[_0xe028('0xbb')],function(_0x1abc59){return{'channel':_0xe028('0xbc'),'id':_0x1abc59['id'],'createdAt':_0x1abc59[_0xe028('0xb5')]};});var _0x125655=_[_0xe028('0xbd')](_0x5bb4a4,_0x1137ab,_0x2d02af,_0x2cba2e,_0x382aa3,_0x34544e);var _0x457e1a={'count':_0x125655['length'],'rows':_0x125655};return _0x457e1a;}else return null;})[_0xe028('0x1c')](respondWithResult(_0x2b7a48,null))[_0xe028('0x25')](handleError(_0x2b7a48,null));};exports[_0xe028('0xbe')]=function(_0x446cf0,_0x5302c1){var _0x360479={};return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x446cf0[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](function(_0xd8d8fe){if(!_0xd8d8fe){throw new APINotFoundError(util['format'](_0xe028('0xc0'),_0x446cf0[_0xe028('0x54')]['id']));}return contacts['describe']();})['then'](function(_0x5bf901){_0x446cf0['query'][_0xe028('0x39')]=_0x446cf0[_0xe028('0x54')]['id'];_0x360479=qs['getOptions'](_0x5bf901,_0x446cf0);if(_0x446cf0[_0xe028('0x43')][_0xe028('0xc1')](_0xe028('0x56'))){_0x360479[_0xe028('0x44')]=[{'model':db[_0xe028('0xc2')],'as':_0xe028('0xc3'),'required':![]},{'model':db[_0xe028('0xc4')],'as':_0xe028('0xc5'),'attributes':['id','name','color'],'where':_0x446cf0[_0xe028('0x43')][_0xe028('0xc6')]?{'id':_0x446cf0[_0xe028('0x43')][_0xe028('0xc6')]}:undefined,'required':_0x446cf0[_0xe028('0x43')]['tag']?!![]:![]}];}return contacts['findAll'](_0x446cf0['query'],_0x446cf0[_0xe028('0x2c')],_0x360479,_0x5bf901);})[_0xe028('0x1c')](respondWithFilteredResult(_0x5302c1,_0x360479))[_0xe028('0x25')](APIHandleError(_0x5302c1));};exports[_0xe028('0xc7')]=function(_0x151626,_0x41dfce){var _0x4f3685;var _0x4e8fbe={};var _0x31d339;return db[_0xe028('0x39')]['findOne']({'where':{'id':_0x151626[_0xe028('0x54')]['id']},'attributes':['id',_0xe028('0x36'),_0xe028('0x2a')]})[_0xe028('0x1c')](handleEntityNotFound(_0x41dfce,null))['then'](function(_0x5c80ff){if(!utils['isValidChannel'](_0x151626['query'][_0xe028('0x93')])){throw new db['Sequelize'][(_0xe028('0x8b'))](_0xe028('0x94'));}_0x4f3685=_0x5c80ff;var _0x5931f6={};_0x5931f6[_0xe028('0xc8')]=_[_0xe028('0xc9')](db[_[_0xe028('0x96')](_0x151626[_0xe028('0x43')][_0xe028('0x93')])+_0xe028('0xca')]['rawAttributes']);_0x5931f6[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x151626[_0xe028('0x43')]);_0x5931f6['filters']=_[_0xe028('0xcb')](_0x5931f6[_0xe028('0xc8')],_0x5931f6['query']);_0x4e8fbe[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x5931f6['model'],qs[_0xe028('0xcc')](_0x151626[_0xe028('0x43')][_0xe028('0xcc')]));_0x4e8fbe['attributes']=_0x4e8fbe[_0xe028('0x48')][_0xe028('0x6a')]?_0x4e8fbe['attributes']:_0x5931f6[_0xe028('0xc8')];_0x4e8fbe[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x151626[_0xe028('0x43')][_0xe028('0xce')]);_0x4e8fbe[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x151626[_0xe028('0x43')],_0x5931f6['filters']));if(_0x151626[_0xe028('0x43')][_0xe028('0x31')]){_0x4e8fbe[_0xe028('0xcf')]=_['merge'](_0x4e8fbe[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0x4e8fbe[_0xe028('0x48')],function(_0x4dbc35){var _0x164965={};_0x164965[_0x4dbc35]={'$like':'%'+_0x151626[_0xe028('0x43')]['filter']+'%'};return _0x164965;})});}_0x4e8fbe=_[_0xe028('0xd2')]({},_0x4e8fbe,_0x151626[_0xe028('0x57')]);switch(_0x4f3685['role']){case'admin':return db[_[_0xe028('0x96')](_0x151626['query']['channel'])+_0xe028('0xca')][_0xe028('0x4a')](_0x4e8fbe);case'user':case _0xe028('0x2e'):return _0x4f3685[_0xe028('0x29')+_['capitalize'](_0x151626['query']['channel'])+_0xe028('0x98')](_0x4e8fbe);default:throw new db[(_0xe028('0x8a'))][(_0xe028('0x8b'))](_0xe028('0xd3'));}})[_0xe028('0x1c')](function(_0x4b85d1){_0x31d339=_0x4b85d1[_0xe028('0x6a')];if(!_0x151626[_0xe028('0x43')]['hasOwnProperty'](_0xe028('0xd4'))){_0x4e8fbe[_0xe028('0x1a')]=qs[_0xe028('0x1a')](_0x151626[_0xe028('0x43')][_0xe028('0x1a')]);_0x4e8fbe['offset']=qs['offset'](_0x151626[_0xe028('0x43')][_0xe028('0x18')]);}switch(_0x4f3685['role']){case _0xe028('0x2b'):return db[_[_0xe028('0x96')](_0x151626[_0xe028('0x43')][_0xe028('0x93')])+_0xe028('0xca')]['findAll'](_0x4e8fbe);case _0xe028('0x2c'):case _0xe028('0x2e'):return _0x4f3685[_0xe028('0x29')+_[_0xe028('0x96')](_0x151626[_0xe028('0x43')][_0xe028('0x93')])+_0xe028('0x98')](_0x4e8fbe);}})[_0xe028('0x1c')](function(_0x3ca20f){return{'count':_0x31d339,'rows':_0x3ca20f};})[_0xe028('0x1c')](respondWithResult(_0x41dfce,null))[_0xe028('0x25')](handleError(_0x41dfce,null));};exports[_0xe028('0xd5')]=function(_0x270e78,_0x3b8dbb){var _0x102d5e={};var _0x2eb7f8={};var _0x2396f4;var _0x1844eb;return db[_0xe028('0x39')]['findOne']({'where':{'id':_0x270e78['params']['id']}})['then'](handleEntityNotFound(_0x3b8dbb,null))[_0xe028('0x1c')](function(_0x5bddc4){if(_0x5bddc4){_0x2396f4=_0x5bddc4;_0x2eb7f8[_0xe028('0xc8')]=_[_0xe028('0xc9')](db[_0xe028('0xa7')][_0xe028('0x3a')]);_0x2eb7f8[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x270e78[_0xe028('0x43')]);_0x2eb7f8['filters']=_['intersection'](_0x2eb7f8[_0xe028('0xc8')],_0x2eb7f8[_0xe028('0x43')]);_0x102d5e[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x2eb7f8['model'],qs['fields'](_0x270e78[_0xe028('0x43')][_0xe028('0xcc')]));_0x102d5e[_0xe028('0x48')]=_0x102d5e[_0xe028('0x48')][_0xe028('0x6a')]?_0x102d5e[_0xe028('0x48')]:_0x2eb7f8[_0xe028('0xc8')];_0x102d5e[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x270e78[_0xe028('0x43')][_0xe028('0xce')]);_0x102d5e[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_['pick'](_0x270e78[_0xe028('0x43')],_0x2eb7f8[_0xe028('0xd0')]));if(_0x270e78[_0xe028('0x43')][_0xe028('0x31')]){_0x102d5e['where']=_[_0xe028('0xd2')](_0x102d5e['where'],{'$or':_[_0xe028('0x32')](_0x102d5e['attributes'],function(_0x189e30){var _0x3cfe3c={};_0x3cfe3c[_0x189e30]={'$like':'%'+_0x270e78['query']['filter']+'%'};return _0x3cfe3c;})});}_0x102d5e=_['merge']({},_0x102d5e,_0x270e78[_0xe028('0x57')]);return _0x2396f4[_0xe028('0xd5')](_0x102d5e);}})['then'](function(_0x2d1910){if(_0x2d1910){_0x1844eb=_0x2d1910[_0xe028('0x6a')];if(!_0x270e78[_0xe028('0x43')][_0xe028('0xc1')](_0xe028('0xd4'))){_0x102d5e[_0xe028('0x1a')]=qs[_0xe028('0x1a')](_0x270e78['query']['limit']);_0x102d5e[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x270e78[_0xe028('0x43')][_0xe028('0x18')]);}return _0x2396f4['getVoiceQueuesRt'](_0x102d5e);}})[_0xe028('0x1c')](function(_0x35c3e3){if(_0x35c3e3){return _0x35c3e3?{'count':_0x1844eb,'rows':_0x35c3e3}:null;}})[_0xe028('0x1c')](respondWithResult(_0x3b8dbb,null))[_0xe028('0x25')](handleError(_0x3b8dbb,null));};exports['getGroups']=function(_0x51fcab,_0xbcb390){var _0x46b05d={};var _0x1aae19={};var _0x7c04c4;var _0x1f342d;return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x51fcab[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0xbcb390,null))[_0xe028('0x1c')](function(_0x3d8260){if(_0x3d8260){_0x7c04c4=_0x3d8260;_0x1aae19[_0xe028('0xc8')]=_['keys'](db[_0xe028('0xd6')][_0xe028('0x3a')]);_0x1aae19['query']=_[_0xe028('0xc9')](_0x51fcab[_0xe028('0x43')]);_0x1aae19[_0xe028('0xd0')]=_[_0xe028('0xcb')](_0x1aae19[_0xe028('0xc8')],_0x1aae19['query']);_0x46b05d[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x1aae19[_0xe028('0xc8')],qs[_0xe028('0xcc')](_0x51fcab['query'][_0xe028('0xcc')]));_0x46b05d[_0xe028('0x48')]=_0x46b05d[_0xe028('0x48')]['length']?_0x46b05d[_0xe028('0x48')]:_0x1aae19['model'];_0x46b05d[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x51fcab['query'][_0xe028('0xce')]);_0x46b05d[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x51fcab['query'],_0x1aae19['filters']));if(_0x51fcab[_0xe028('0x43')][_0xe028('0x31')]){_0x46b05d['where']=_[_0xe028('0xd2')](_0x46b05d[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0x46b05d[_0xe028('0x48')],function(_0x8e906c){var _0x27ceb5={};_0x27ceb5[_0x8e906c]={'$like':'%'+_0x51fcab['query'][_0xe028('0x31')]+'%'};return _0x27ceb5;})});}_0x46b05d=_[_0xe028('0xd2')]({},_0x46b05d,_0x51fcab[_0xe028('0x57')]);return _0x7c04c4[_0xe028('0xd7')](_0x46b05d);}})[_0xe028('0x1c')](function(_0x1e847a){if(_0x1e847a){_0x1f342d=_0x1e847a['length'];if(!_0x51fcab[_0xe028('0x43')]['hasOwnProperty'](_0xe028('0xd4'))){_0x46b05d['limit']=qs[_0xe028('0x1a')](_0x51fcab[_0xe028('0x43')]['limit']);_0x46b05d['offset']=qs[_0xe028('0x18')](_0x51fcab[_0xe028('0x43')]['offset']);}return _0x7c04c4[_0xe028('0xd7')](_0x46b05d);}})[_0xe028('0x1c')](function(_0x365e6d){if(_0x365e6d){return _0x365e6d?{'count':_0x1f342d,'rows':_0x365e6d}:null;}})[_0xe028('0x1c')](respondWithResult(_0xbcb390,null))[_0xe028('0x25')](handleError(_0xbcb390,null));};exports[_0xe028('0xd8')]=function(_0x5ada2a,_0x5b1f35){var _0x239932={'raw':!![],'where':{}};var _0x4fc7ac={};var _0x5932d5={'count':0x0,'rows':[]};return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x5ada2a['params']['id']}})['then'](handleEntityNotFound(_0x5b1f35,null))[_0xe028('0x1c')](function(_0x5a5509){if(_0x5a5509){_0x4fc7ac[_0xe028('0xc8')]=_[_0xe028('0xc9')](db['VoiceRecording'][_0xe028('0x3a')]);_0x4fc7ac[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x5ada2a[_0xe028('0x43')]);_0x4fc7ac['filters']=_['intersection'](_0x4fc7ac[_0xe028('0xc8')],_0x4fc7ac[_0xe028('0x43')]);_0x239932[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x4fc7ac['model'],qs['fields'](_0x5ada2a[_0xe028('0x43')][_0xe028('0xcc')]));_0x239932['attributes']=_0x239932[_0xe028('0x48')][_0xe028('0x6a')]?_0x239932[_0xe028('0x48')]:_0x4fc7ac[_0xe028('0xc8')];if(!_0x5ada2a[_0xe028('0x43')]['hasOwnProperty'](_0xe028('0xd4'))){_0x239932['limit']=qs[_0xe028('0x1a')](_0x5ada2a[_0xe028('0x43')][_0xe028('0x1a')]);_0x239932[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x5ada2a[_0xe028('0x43')]['offset']);}_0x239932['order']=qs[_0xe028('0xce')](_0x5ada2a[_0xe028('0x43')]['sort']);_0x239932[_0xe028('0xcf')]=qs['filters'](_[_0xe028('0xd1')](_0x5ada2a['query'],_0x4fc7ac[_0xe028('0xd0')]));_0x239932[_0xe028('0xcf')][_0xe028('0xd9')]=_0x5a5509['id'];if(_0x5ada2a[_0xe028('0x43')][_0xe028('0x31')]){_0x239932[_0xe028('0xcf')]=_[_0xe028('0xd2')](_0x239932[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0x239932['attributes'],function(_0x399cc8){var _0x579923={};_0x579923[_0x399cc8]={'$like':'%'+_0x5ada2a[_0xe028('0x43')]['filter']+'%'};return _0x579923;})});}_0x239932=_['merge']({},_0x239932,_0x5ada2a['options']);return db['VoiceRecording'][_0xe028('0x19')]({'where':_0x239932['where']})['then'](function(_0x35baea){_0x5932d5[_0xe028('0x19')]=_0x35baea;if(_0x5ada2a[_0xe028('0x43')]['includeAll']){_0x239932[_0xe028('0x44')]=[{'all':!![]}];}return db[_0xe028('0xda')]['findAll'](_0x239932);})[_0xe028('0x1c')](function(_0x12d11d){_0x5932d5[_0xe028('0x4b')]=_0x12d11d;return _0x5932d5;});}})['then'](respondWithFilteredResult(_0x5b1f35,_0x239932))[_0xe028('0x25')](handleError(_0x5b1f35,null));};exports[_0xe028('0xdb')]=function(_0x5a3cf7,_0x7e65f6){var _0x29bcda={'raw':!![],'where':{}};var _0x55924c={};var _0x24a56c={'count':0x0,'rows':[]};return db['User'][_0xe028('0xbf')]({'where':{'id':_0x5a3cf7[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x7e65f6,null))['then'](function(_0x15fc06){if(_0x15fc06){_0x55924c[_0xe028('0xc8')]=_[_0xe028('0xc9')](db[_0xe028('0xdc')]['rawAttributes']);_0x55924c['query']=_[_0xe028('0xc9')](_0x5a3cf7['query']);_0x55924c['filters']=_[_0xe028('0xcb')](_0x55924c[_0xe028('0xc8')],_0x55924c[_0xe028('0x43')]);_0x29bcda[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x55924c[_0xe028('0xc8')],qs[_0xe028('0xcc')](_0x5a3cf7['query'][_0xe028('0xcc')]));_0x29bcda[_0xe028('0x48')]=_0x29bcda[_0xe028('0x48')][_0xe028('0x6a')]?_0x29bcda[_0xe028('0x48')]:_0x55924c[_0xe028('0xc8')];if(!_0x5a3cf7[_0xe028('0x43')][_0xe028('0xc1')](_0xe028('0xd4'))){_0x29bcda[_0xe028('0x1a')]=qs[_0xe028('0x1a')](_0x5a3cf7[_0xe028('0x43')]['limit']);_0x29bcda[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x5a3cf7[_0xe028('0x43')][_0xe028('0x18')]);}_0x29bcda[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x5a3cf7[_0xe028('0x43')][_0xe028('0xce')]);_0x29bcda[_0xe028('0xcf')]=qs['filters'](_['pick'](_0x5a3cf7[_0xe028('0x43')],_0x55924c[_0xe028('0xd0')]));_0x29bcda[_0xe028('0xcf')][_0xe028('0xd9')]=_0x15fc06['id'];if(_0x5a3cf7[_0xe028('0x43')][_0xe028('0x31')]){_0x29bcda['where']=_[_0xe028('0xd2')](_0x29bcda['where'],{'$or':_[_0xe028('0x32')](_0x29bcda[_0xe028('0x48')],function(_0xe90def){var _0x4670a3={};_0x4670a3[_0xe90def]={'$like':'%'+_0x5a3cf7[_0xe028('0x43')]['filter']+'%'};return _0x4670a3;})});}_0x29bcda=_[_0xe028('0xd2')]({},_0x29bcda,_0x5a3cf7[_0xe028('0x57')]);return db['ScreenRecording']['count']({'where':_0x29bcda[_0xe028('0xcf')]})[_0xe028('0x1c')](function(_0x27fbbb){_0x24a56c[_0xe028('0x19')]=_0x27fbbb;if(_0x5a3cf7[_0xe028('0x43')][_0xe028('0x56')]){_0x29bcda[_0xe028('0x44')]=[{'all':!![]}];}return db[_0xe028('0xdc')][_0xe028('0x4a')](_0x29bcda);})[_0xe028('0x1c')](function(_0x18231a){_0x24a56c['rows']=_0x18231a;return _0x24a56c;});}})['then'](respondWithFilteredResult(_0x7e65f6,_0x29bcda))[_0xe028('0x25')](handleError(_0x7e65f6,null));};exports[_0xe028('0xdd')]=function(_0x206a3a,_0x1233fc){var _0x57ecde={};var _0x2ac635={};var _0x1a3de4;var _0x22fbb0;return db[_0xe028('0x39')]['findOne']({'where':{'id':_0x206a3a['params']['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x1233fc,null))[_0xe028('0x1c')](function(_0x2a9654){if(_0x2a9654){_0x1a3de4=_0x2a9654;_0x2ac635[_0xe028('0xc8')]=_[_0xe028('0xc9')](db[_0xe028('0xde')]['rawAttributes']);_0x2ac635[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x206a3a['query']);_0x2ac635[_0xe028('0xd0')]=_[_0xe028('0xcb')](_0x2ac635['model'],_0x2ac635[_0xe028('0x43')]);_0x57ecde[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x2ac635['model'],qs[_0xe028('0xcc')](_0x206a3a['query'][_0xe028('0xcc')]));_0x57ecde[_0xe028('0x48')]=_0x57ecde[_0xe028('0x48')][_0xe028('0x6a')]?_0x57ecde['attributes']:_0x2ac635['model'];_0x57ecde[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x206a3a[_0xe028('0x43')][_0xe028('0xce')]);_0x57ecde[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x206a3a[_0xe028('0x43')],_0x2ac635[_0xe028('0xd0')]));if(_0x206a3a[_0xe028('0x43')][_0xe028('0x31')]){_0x57ecde['where']=_[_0xe028('0xd2')](_0x57ecde['where'],{'$or':_[_0xe028('0x32')](_0x57ecde[_0xe028('0x48')],function(_0x55e275){var _0x4aff4e={};_0x4aff4e[_0x55e275]={'$like':'%'+_0x206a3a[_0xe028('0x43')][_0xe028('0x31')]+'%'};return _0x4aff4e;})});}_0x57ecde=_['merge']({},_0x57ecde,_0x206a3a[_0xe028('0x57')]);return _0x1a3de4[_0xe028('0xdd')](_0x57ecde);}})[_0xe028('0x1c')](function(_0x3c03db){if(_0x3c03db){_0x22fbb0=_0x3c03db[_0xe028('0x6a')];if(!_0x206a3a[_0xe028('0x43')][_0xe028('0xc1')](_0xe028('0xd4'))){_0x57ecde['limit']=qs[_0xe028('0x1a')](_0x206a3a[_0xe028('0x43')]['limit']);_0x57ecde[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x206a3a[_0xe028('0x43')][_0xe028('0x18')]);}return _0x1a3de4[_0xe028('0xdd')](_0x57ecde);}})['then'](function(_0xa500ba){if(_0xa500ba){return _0xa500ba?{'count':_0x22fbb0,'rows':_0xa500ba}:null;}})[_0xe028('0x1c')](respondWithResult(_0x1233fc,null))[_0xe028('0x25')](handleError(_0x1233fc,null));};exports[_0xe028('0xdf')]=function(_0x36154b,_0x4a981f){var _0x3514af={};var _0x3e5113={};var _0x5cc4b7;var _0x12dd80;return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x36154b[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x4a981f,null))[_0xe028('0x1c')](function(_0x57defd){if(_0x57defd){_0x5cc4b7=_0x57defd;_0x3e5113[_0xe028('0xc8')]=_[_0xe028('0xc9')](db[_0xe028('0xe0')]['rawAttributes']);_0x3e5113['query']=_['keys'](_0x36154b[_0xe028('0x43')]);_0x3e5113[_0xe028('0xd0')]=_['intersection'](_0x3e5113[_0xe028('0xc8')],_0x3e5113['query']);_0x3514af[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x3e5113[_0xe028('0xc8')],qs[_0xe028('0xcc')](_0x36154b[_0xe028('0x43')][_0xe028('0xcc')]));_0x3514af[_0xe028('0x48')]=_0x3514af[_0xe028('0x48')]['length']?_0x3514af[_0xe028('0x48')]:_0x3e5113[_0xe028('0xc8')];_0x3514af[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x36154b[_0xe028('0x43')]['sort']);_0x3514af['where']=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x36154b[_0xe028('0x43')],_0x3e5113[_0xe028('0xd0')]));if(_0x36154b[_0xe028('0x43')][_0xe028('0x31')]){_0x3514af[_0xe028('0xcf')]=_['merge'](_0x3514af['where'],{'$or':_[_0xe028('0x32')](_0x3514af['attributes'],function(_0x24c60e){var _0x192fb7={};_0x192fb7[_0x24c60e]={'$like':'%'+_0x36154b[_0xe028('0x43')][_0xe028('0x31')]+'%'};return _0x192fb7;})});}_0x3514af=_['merge']({},_0x3514af,_0x36154b['options']);return _0x5cc4b7[_0xe028('0xdf')](_0x3514af);}})[_0xe028('0x1c')](function(_0x43fe1d){if(_0x43fe1d){_0x12dd80=_0x43fe1d[_0xe028('0x6a')];if(!_0x36154b[_0xe028('0x43')]['hasOwnProperty'](_0xe028('0xd4'))){_0x3514af[_0xe028('0x1a')]=qs[_0xe028('0x1a')](_0x36154b['query'][_0xe028('0x1a')]);_0x3514af[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x36154b['query'][_0xe028('0x18')]);}return _0x5cc4b7[_0xe028('0xdf')](_0x3514af);}})[_0xe028('0x1c')](function(_0x5d40f){if(_0x5d40f){return _0x5d40f?{'count':_0x12dd80,'rows':_0x5d40f}:null;}})['then'](respondWithResult(_0x4a981f,null))[_0xe028('0x25')](handleError(_0x4a981f,null));};exports['getMailInteractions']=function(_0x24b1fe,_0x102908){var _0x11f39e={'raw':!![],'where':{}};var _0xbb710c={};var _0x3fa063={'count':0x0,'rows':[]};return db[_0xe028('0x39')]['findOne']({'where':{'id':_0x24b1fe[_0xe028('0x54')]['id']}})['then'](handleEntityNotFound(_0x102908,null))[_0xe028('0x1c')](function(_0x4828c0){if(_0x4828c0){_0xbb710c[_0xe028('0xc8')]=_[_0xe028('0xc9')](db[_0xe028('0xe1')][_0xe028('0x3a')]);_0xbb710c[_0xe028('0x43')]=_['keys'](_0x24b1fe[_0xe028('0x43')]);_0xbb710c[_0xe028('0xd0')]=_[_0xe028('0xcb')](_0xbb710c[_0xe028('0xc8')],_0xbb710c[_0xe028('0x43')]);_0x11f39e['attributes']=_[_0xe028('0xcb')](_0xbb710c[_0xe028('0xc8')],qs['fields'](_0x24b1fe[_0xe028('0x43')][_0xe028('0xcc')]));_0x11f39e[_0xe028('0x48')]=_0x11f39e[_0xe028('0x48')][_0xe028('0x6a')]?_0x11f39e['attributes']:_0xbb710c[_0xe028('0xc8')];if(!_0x24b1fe['query'][_0xe028('0xc1')](_0xe028('0xd4'))){_0x11f39e['limit']=qs['limit'](_0x24b1fe[_0xe028('0x43')][_0xe028('0x1a')]);_0x11f39e[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x24b1fe['query'][_0xe028('0x18')]);}_0x11f39e[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x24b1fe[_0xe028('0x43')][_0xe028('0xce')]);_0x11f39e[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x24b1fe['query'],_0xbb710c[_0xe028('0xd0')]));_0x11f39e[_0xe028('0xcf')][_0xe028('0xd9')]=_0x4828c0['id'];if(_0x24b1fe[_0xe028('0x43')]['filter']){_0x11f39e[_0xe028('0xcf')]=_['merge'](_0x11f39e[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0x11f39e[_0xe028('0x48')],function(_0x59709a){var _0x36bda6={};_0x36bda6[_0x59709a]={'$like':'%'+_0x24b1fe[_0xe028('0x43')][_0xe028('0x31')]+'%'};return _0x36bda6;})});}_0x11f39e=_['merge']({},_0x11f39e,_0x24b1fe[_0xe028('0x57')]);return db[_0xe028('0xe1')]['count']({'where':_0x11f39e[_0xe028('0xcf')]})['then'](function(_0x33e48c){_0x3fa063[_0xe028('0x19')]=_0x33e48c;if(_0x24b1fe[_0xe028('0x43')][_0xe028('0x56')]){_0x11f39e['include']=[{'all':!![]}];}return db[_0xe028('0xe1')][_0xe028('0x4a')](_0x11f39e);})[_0xe028('0x1c')](function(_0x2da834){_0x3fa063[_0xe028('0x4b')]=_0x2da834;return _0x3fa063;});}})[_0xe028('0x1c')](respondWithFilteredResult(_0x102908,_0x11f39e))[_0xe028('0x25')](handleError(_0x102908,null));};exports['getSmsInteractions']=function(_0xeff975,_0x4ed077){var _0x2dc8e1={};var _0x56f071={};var _0x1d1411;var _0x5b6f23;return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0xeff975[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x4ed077,null))[_0xe028('0x1c')](function(_0x1ef0fd){if(_0x1ef0fd){_0x1d1411=_0x1ef0fd;_0x56f071[_0xe028('0xc8')]=_['keys'](db[_0xe028('0xe2')]['rawAttributes']);_0x56f071['query']=_[_0xe028('0xc9')](_0xeff975[_0xe028('0x43')]);_0x56f071[_0xe028('0xd0')]=_[_0xe028('0xcb')](_0x56f071[_0xe028('0xc8')],_0x56f071['query']);_0x2dc8e1[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x56f071[_0xe028('0xc8')],qs[_0xe028('0xcc')](_0xeff975[_0xe028('0x43')][_0xe028('0xcc')]));_0x2dc8e1[_0xe028('0x48')]=_0x2dc8e1['attributes']['length']?_0x2dc8e1[_0xe028('0x48')]:_0x56f071[_0xe028('0xc8')];_0x2dc8e1['order']=qs[_0xe028('0xce')](_0xeff975[_0xe028('0x43')]['sort']);_0x2dc8e1[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0xeff975[_0xe028('0x43')],_0x56f071[_0xe028('0xd0')]));if(_0xeff975[_0xe028('0x43')]['filter']){_0x2dc8e1[_0xe028('0xcf')]=_[_0xe028('0xd2')](_0x2dc8e1['where'],{'$or':_[_0xe028('0x32')](_0x2dc8e1[_0xe028('0x48')],function(_0x4e2103){var _0x1b4248={};_0x1b4248[_0x4e2103]={'$like':'%'+_0xeff975['query'][_0xe028('0x31')]+'%'};return _0x1b4248;})});}_0x2dc8e1=_[_0xe028('0xd2')]({},_0x2dc8e1,_0xeff975[_0xe028('0x57')]);return _0x1d1411['getSmsInteractions'](_0x2dc8e1);}})[_0xe028('0x1c')](function(_0x2293ca){if(_0x2293ca){_0x5b6f23=_0x2293ca[_0xe028('0x6a')];if(!_0xeff975[_0xe028('0x43')][_0xe028('0xc1')](_0xe028('0xd4'))){_0x2dc8e1[_0xe028('0x1a')]=qs[_0xe028('0x1a')](_0xeff975[_0xe028('0x43')]['limit']);_0x2dc8e1['offset']=qs[_0xe028('0x18')](_0xeff975[_0xe028('0x43')][_0xe028('0x18')]);}return _0x1d1411[_0xe028('0xe3')](_0x2dc8e1);}})['then'](function(_0x488592){if(_0x488592){return _0x488592?{'count':_0x5b6f23,'rows':_0x488592}:null;}})[_0xe028('0x1c')](respondWithResult(_0x4ed077,null))[_0xe028('0x25')](handleError(_0x4ed077,null));};exports[_0xe028('0xe4')]=function(_0x37e8ac,_0xb60385){var _0x1ba56b={};var _0x2746dd={};var _0x26a381;var _0x34c301;return db[_0xe028('0x39')]['findOne']({'where':{'id':_0x37e8ac[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0xb60385,null))['then'](function(_0x38a60e){if(_0x38a60e){_0x26a381=_0x38a60e;_0x2746dd[_0xe028('0xc8')]=_['keys'](db[_0xe028('0xe5')][_0xe028('0x3a')]);_0x2746dd['query']=_[_0xe028('0xc9')](_0x37e8ac[_0xe028('0x43')]);_0x2746dd[_0xe028('0xd0')]=_['intersection'](_0x2746dd[_0xe028('0xc8')],_0x2746dd[_0xe028('0x43')]);_0x1ba56b[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x2746dd[_0xe028('0xc8')],qs['fields'](_0x37e8ac[_0xe028('0x43')][_0xe028('0xcc')]));_0x1ba56b[_0xe028('0x48')]=_0x1ba56b['attributes']['length']?_0x1ba56b[_0xe028('0x48')]:_0x2746dd[_0xe028('0xc8')];_0x1ba56b[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x37e8ac['query'][_0xe028('0xce')]);_0x1ba56b[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_['pick'](_0x37e8ac['query'],_0x2746dd[_0xe028('0xd0')]));if(_0x37e8ac[_0xe028('0x43')][_0xe028('0x31')]){_0x1ba56b['where']=_[_0xe028('0xd2')](_0x1ba56b[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0x1ba56b['attributes'],function(_0x5b2eec){var _0x2e15f9={};_0x2e15f9[_0x5b2eec]={'$like':'%'+_0x37e8ac[_0xe028('0x43')][_0xe028('0x31')]+'%'};return _0x2e15f9;})});}_0x1ba56b=_[_0xe028('0xd2')]({},_0x1ba56b,_0x37e8ac[_0xe028('0x57')]);return _0x26a381[_0xe028('0xe4')](_0x1ba56b);}})[_0xe028('0x1c')](function(_0x3bc8a0){if(_0x3bc8a0){_0x34c301=_0x3bc8a0[_0xe028('0x6a')];if(!_0x37e8ac['query']['hasOwnProperty'](_0xe028('0xd4'))){_0x1ba56b[_0xe028('0x1a')]=qs[_0xe028('0x1a')](_0x37e8ac['query'][_0xe028('0x1a')]);_0x1ba56b[_0xe028('0x18')]=qs['offset'](_0x37e8ac['query']['offset']);}return _0x26a381[_0xe028('0xe4')](_0x1ba56b);}})[_0xe028('0x1c')](function(_0x531959){if(_0x531959){return _0x531959?{'count':_0x34c301,'rows':_0x531959}:null;}})['then'](respondWithResult(_0xb60385,null))['catch'](handleError(_0xb60385,null));};exports[_0xe028('0xe6')]=function(_0x4965e6,_0x1e3a08){var _0x53e35e={};var _0x4ff535={};var _0x54e3cd;var _0xca385e;return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x4965e6['params']['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x1e3a08,null))['then'](function(_0xab869f){if(_0xab869f){_0x54e3cd=_0xab869f;_0x4ff535['model']=_[_0xe028('0xc9')](db[_0xe028('0xe7')]['rawAttributes']);_0x4ff535[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x4965e6[_0xe028('0x43')]);_0x4ff535[_0xe028('0xd0')]=_['intersection'](_0x4ff535[_0xe028('0xc8')],_0x4ff535[_0xe028('0x43')]);_0x53e35e[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x4ff535[_0xe028('0xc8')],qs['fields'](_0x4965e6['query'][_0xe028('0xcc')]));_0x53e35e[_0xe028('0x48')]=_0x53e35e[_0xe028('0x48')][_0xe028('0x6a')]?_0x53e35e[_0xe028('0x48')]:_0x4ff535[_0xe028('0xc8')];_0x53e35e[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x4965e6['query']['sort']);_0x53e35e['where']=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x4965e6[_0xe028('0x43')],_0x4ff535[_0xe028('0xd0')]));if(_0x4965e6[_0xe028('0x43')][_0xe028('0x31')]){_0x53e35e[_0xe028('0xcf')]=_[_0xe028('0xd2')](_0x53e35e['where'],{'$or':_[_0xe028('0x32')](_0x53e35e[_0xe028('0x48')],function(_0x162610){var _0x4c686e={};_0x4c686e[_0x162610]={'$like':'%'+_0x4965e6[_0xe028('0x43')][_0xe028('0x31')]+'%'};return _0x4c686e;})});}_0x53e35e=_[_0xe028('0xd2')]({},_0x53e35e,_0x4965e6[_0xe028('0x57')]);return _0x54e3cd[_0xe028('0xe6')](_0x53e35e);}})[_0xe028('0x1c')](function(_0x1499cc){if(_0x1499cc){_0xca385e=_0x1499cc[_0xe028('0x6a')];if(!_0x4965e6[_0xe028('0x43')][_0xe028('0xc1')](_0xe028('0xd4'))){_0x53e35e['limit']=qs['limit'](_0x4965e6[_0xe028('0x43')][_0xe028('0x1a')]);_0x53e35e['offset']=qs['offset'](_0x4965e6[_0xe028('0x43')][_0xe028('0x18')]);}return _0x54e3cd[_0xe028('0xe6')](_0x53e35e);}})[_0xe028('0x1c')](function(_0xe748ef){if(_0xe748ef){return _0xe748ef?{'count':_0xca385e,'rows':_0xe748ef}:null;}})[_0xe028('0x1c')](respondWithResult(_0x1e3a08,null))[_0xe028('0x25')](handleError(_0x1e3a08,null));};exports['login']=function(_0xd2a498,_0x3d8c6c,_0x1ddf4e){var _0x2dd38;var _0x3e4391;var _0x47f9e7;var _0x359d65=!_[_0xe028('0x64')](_0xd2a498[_0xe028('0x54')]['id'])?_0xd2a498[_0xe028('0x54')]['id']:!_[_0xe028('0x64')](_0xd2a498[_0xe028('0x2c')]['id'])?_0xd2a498[_0xe028('0x2c')]['id']:null;return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0x359d65,'role':{'$or':['admin',_0xe028('0x2c'),_0xe028('0x2e')]}},'attributes':['id','name',_0xe028('0xe8'),_0xe028('0xe9'),_0xe028('0x2a'),_0xe028('0x5e'),'loginInPause']})[_0xe028('0x1c')](function(_0x40cf7b){if(_0x40cf7b){if(_0x40cf7b['role']===_0xe028('0x2e')){_0x2dd38=_0x40cf7b;if(_0xd2a498[_0xe028('0x5a')][_0xe028('0x9c')]){_0x47f9e7=util[_0xe028('0x9d')]('LOCAL/%s@from-sip/n',_0x2dd38[_0xd2a498['body'][_0xe028('0x9c')]]);}else if(_0xd2a498[_0xe028('0x5a')][_0xe028('0xea')]){_0x47f9e7=util[_0xe028('0x9d')]('SIP/%s',_0xd2a498[_0xe028('0x5a')][_0xe028('0xea')]);}else{_0x47f9e7=util['format'](_0xe028('0x9e'),_0x2dd38[_0xe028('0x36')]);}socket['to'](util[_0xe028('0x9d')]('user:%s',_0x2dd38[_0xe028('0x36')]))['emit'](_0xe028('0xeb'),{'user':{'id':_0x2dd38['id'],'name':_0x2dd38[_0xe028('0x36')]},'ip':_0xd2a498[_0xe028('0xec')][_0xe028('0xed')]||_0xd2a498['connection'][_0xe028('0xee')]||_0xd2a498['socket']['remoteAddress']||_0xd2a498[_0xe028('0xef')][_0xe028('0xf0')]['remoteAddress']});return db[_0xe028('0xa7')][_0xe028('0x38')]({'where':{'membername':_0x2dd38[_0xe028('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0xe028('0x8a'))]['ValidationError'](_0xe028('0xf1'));}})[_0xe028('0x1c')](function(){if(_0x2dd38){return _0x2dd38[_0xe028('0xf2')]({'raw':!![]});}})[_0xe028('0x1c')](function(_0x264555){if(_0x2dd38){if(_0x264555){_0x3e4391=_0x264555;if(_0x3e4391[_0xe028('0x6a')]){var _0x4d8e57=_0x3e4391[_0xe028('0x32')](function(_0x262c0d){var _0x4db79d={'membername':_0x2dd38[_0xe028('0x36')],'UserId':_0x2dd38['id'],'queue_name':_0x262c0d[_0xe028('0x36')],'VoiceQueueId':_0x262c0d['id'],'interface':_0x47f9e7,'paused':_0x2dd38['loginInPause']||![],'penalty':_0x262c0d[_0xe028('0xf3')]||0x0};return db['UserVoiceQueueRt'][_0xe028('0xa0')](_0x4db79d);});return Promise['all'](_0x4d8e57);}}}})[_0xe028('0x1c')](function(){if(_0x2dd38){return db[_0xe028('0xf4')][_0xe028('0x4a')]({'where':{'membername':_0x2dd38[_0xe028('0x36')],'exitAt':null}});}})[_0xe028('0x1c')](function(_0x31a67f){if(_0x2dd38){var _0x58bf7d=[];_0x31a67f['forEach'](function(_0xe23f74){_0x58bf7d[_0xe028('0x49')](_0xe23f74[_0xe028('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe028('0x59')](_0x58bf7d);}})[_0xe028('0x1c')](function(){if(_0x2dd38){var _0x5c5698=[];var _0x1fda8a=[];var _0x140d1f=utils['getChannels']();var _0x52c1f6={'membername':_0x2dd38[_0xe028('0x36')],'interface':_0x47f9e7,'enterAt':moment()[_0xe028('0x9d')](_0xe028('0xf5')),'role':_0x2dd38[_0xe028('0x2a')],'internal':_0x2dd38[_0xe028('0x5e')]};_0x140d1f[_0xe028('0xf6')](function(_0x3df863){_0x5c5698[_0xe028('0x49')](_[_0xe028('0xd2')]({'channel':_0x3df863,'type':_0xe028('0xf7'),'data1':_0xd2a498[_0xe028('0x5a')]['device'],'data2':_0x47f9e7},_0x52c1f6));if(_0x2dd38[_0xe028('0xf8')]){_0x1fda8a[_0xe028('0x49')](_[_0xe028('0xd2')]({'channel':_0x3df863,'type':'PAUSE','data1':'LOGININPAUSE'},_0x52c1f6));}});return db['MemberReport'][_0xe028('0x83')](_0x5c5698['concat'](_0x1fda8a),{'individualHooks':!![]});}})['then'](function(){if(_0x2dd38){return _0x2dd38[_0xe028('0x26')]({'online':!![],'lastLoginAt':moment()[_0xe028('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2dd38[_0xe028('0xf8')]||![],'mailPause':_0x2dd38['loginInPause']||![],'chatPause':_0x2dd38['loginInPause']||![],'faxPause':_0x2dd38['loginInPause']||![],'smsPause':_0x2dd38[_0xe028('0xf8')]||![],'openchannelPause':_0x2dd38[_0xe028('0xf8')]||![],'whatsappPause':_0x2dd38[_0xe028('0xf8')]||![],'pauseType':_0x2dd38[_0xe028('0xf8')]?'LOGININPAUSE':null,'interface':_0x47f9e7,'lastPauseAt':moment()[_0xe028('0x9d')](_0xe028('0xf5'))});}})[_0xe028('0x1c')](function(_0x207d29){if(_0xd2a498[_0xe028('0xf9')]){return _0x1ddf4e();}else{return Promise[_0xe028('0xfa')](_0x207d29)[_0xe028('0x1c')](respondWithResult(_0x3d8c6c,null));}})[_0xe028('0x25')](handleError(_0x3d8c6c,null));};exports[_0xe028('0xfb')]=function(_0x274d17,_0xb83bb0){var _0x25a825;return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0x274d17[_0xe028('0x54')]['id'],'role':_0xe028('0x2e')},'attributes':['id',_0xe028('0x36'),_0xe028('0x2a')]})[_0xe028('0x1c')](handleEntityNotFound(_0xb83bb0,null))[_0xe028('0x1c')](function(_0xf9ecbb){if(_0xf9ecbb){_0x25a825=_0xf9ecbb;return db['UserVoiceQueueRt'][_0xe028('0x38')]({'where':{'membername':_0x25a825[_0xe028('0x36')]},'individualHooks':!![]});}})[_0xe028('0x1c')](function(){return db[_0xe028('0xf4')][_0xe028('0x4a')]({'where':{'membername':_0x25a825['name'],'exitAt':null}});})[_0xe028('0x1c')](function(_0x2f1c84){var _0x58b8f9=[];_0x2f1c84[_0xe028('0xf6')](function(_0x55d2e9){_0x58b8f9[_0xe028('0x49')](_0x55d2e9[_0xe028('0x26')]({'exitAt':moment()[_0xe028('0x9d')](_0xe028('0xf5'))}));});return Promise[_0xe028('0x59')](_0x58b8f9);})['then'](function(){return _0x25a825[_0xe028('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe028('0x1c')](respondWithResult(_0xb83bb0,null))['catch'](handleError(_0xb83bb0,null));};exports['pause']=function(_0x18c011,_0x58d62c){var _0x34d36a;return db['UserVoiceQueueRt'][_0xe028('0x26')]({'paused':0x1},{'where':{'UserId':_0x18c011[_0xe028('0x54')]['id']},'individualHooks':!![]})[_0xe028('0x1c')](function(){return db['User'][_0xe028('0x35')]({'where':{'id':_0x18c011['params']['id'],'role':_0xe028('0x2e')},'attributes':['id',_0xe028('0x36'),'role',_0xe028('0x5e'),'interface',_0xe028('0x9b')]});})['then'](handleEntityNotFound(_0x58d62c,null))[_0xe028('0x1c')](function(_0x4f4063){if(_0x4f4063){_0x34d36a=_0x4f4063;return respondWithRpcPromise(_0xe028('0xfc'),'pause',{'id':_0x34d36a['id'],'name':_0x34d36a[_0xe028('0x36')],'pause':!![]});}})[_0xe028('0x1c')](function(){if(_0x34d36a){return db[_0xe028('0xf4')][_0xe028('0x4a')]({'where':{'membername':_0x34d36a['name'],'type':_0xe028('0xfd'),'exitAt':null}});}})[_0xe028('0x1c')](function(_0x311a9a){if(_0x311a9a[_0xe028('0x6a')]){var _0x915983=moment()[_0xe028('0x9d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1fe73f=0x0,_0x57d3ed=_0x311a9a[_0xe028('0x6a')];_0x1fe73f<_0x57d3ed;_0x1fe73f++){_0x311a9a[_0x1fe73f][_0xe028('0xfe')]({'exitAt':_0x915983});}}})['then'](function(){var _0x53f827=[];var _0x74d7f4=utils[_0xe028('0xff')]();_0x74d7f4['forEach'](function(_0xd118bf){_0x53f827['push']({'channel':_0xd118bf,'membername':_0x34d36a[_0xe028('0x36')],'interface':_[_0xe028('0x64')](_0x34d36a[_0xe028('0x9c')])?util[_0xe028('0x9d')](_0xe028('0x9e'),_0x34d36a['name']):_0x34d36a[_0xe028('0x9c')],'type':_0xe028('0xfd'),'enterAt':moment()[_0xe028('0x9d')](_0xe028('0xf5')),'data1':_0x18c011[_0xe028('0x5a')][_0xe028('0x3b')]||_0xe028('0x100'),'role':_0x34d36a[_0xe028('0x2a')],'internal':_0x34d36a['internal']});});return db[_0xe028('0xf4')][_0xe028('0x83')](_0x53f827,{'individualHooks':!![]});})[_0xe028('0x1c')](function(){return _0x34d36a[_0xe028('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x18c011[_0xe028('0x5a')]['type']||_0xe028('0x100'),'lastPauseAt':moment()[_0xe028('0x9d')](_0xe028('0xf5'))});})[_0xe028('0x1c')](respondWithResult(_0x58d62c,null))[_0xe028('0x25')](handleError(_0x58d62c,null));};exports['unpause']=function(_0x25533b,_0x509216){if(_0x25533b[_0xe028('0x5a')][_0xe028('0x93')]&&!utils[_0xe028('0xa2')](_0x25533b[_0xe028('0x5a')][_0xe028('0x93')])){throw new APIBadRequestError(util['format'](_0xe028('0x101'),_0x25533b[_0xe028('0x5a')][_0xe028('0x93')]));}return db[_0xe028('0x39')][_0xe028('0x35')]({'where':{'id':_0x25533b[_0xe028('0x54')]['id']},'attributes':['id',_0xe028('0x36'),_0xe028('0x2a'),_0xe028('0x5e'),_0xe028('0x9c'),_0xe028('0x9b'),_0xe028('0x9f'),_0xe028('0x102'),_0xe028('0x103'),_0xe028('0x104'),_0xe028('0x105'),_0xe028('0x106'),'whatsappPause',_0xe028('0x107'),_0xe028('0x108')]})[_0xe028('0x1c')](function(_0x18e8c9){if(!_0x18e8c9){throw new APINotFoundError(util[_0xe028('0x9d')](_0xe028('0xc0'),_0x25533b['params']['id']));}return _0x18e8c9[_0xe028('0x109')](_0x25533b[_0xe028('0x5a')][_0xe028('0x93')]);})[_0xe028('0x1c')](respondWithResult(_0x509216,null))[_0xe028('0x25')](APIHandleError(_0x509216));};exports[_0xe028('0x10a')]=function(_0x3231c0,_0x458291){var _0xe8c782={};var _0x16e184={};var _0x1a8d85;var _0xc4e503;return db['User'][_0xe028('0xbf')]({'where':{'id':_0x3231c0[_0xe028('0x54')]['id']}})['then'](handleEntityNotFound(_0x458291,null))[_0xe028('0x1c')](function(_0x28b7a2){if(_0x28b7a2){_0x1a8d85=_0x28b7a2;_0x16e184[_0xe028('0xc8')]=_['keys'](db['Team']['rawAttributes']);_0x16e184[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x3231c0['query']);_0x16e184[_0xe028('0xd0')]=_[_0xe028('0xcb')](_0x16e184['model'],_0x16e184[_0xe028('0x43')]);_0xe8c782[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x16e184[_0xe028('0xc8')],qs[_0xe028('0xcc')](_0x3231c0['query'][_0xe028('0xcc')]));_0xe8c782[_0xe028('0x48')]=_0xe8c782[_0xe028('0x48')][_0xe028('0x6a')]?_0xe8c782[_0xe028('0x48')]:_0x16e184['model'];_0xe8c782[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x3231c0[_0xe028('0x43')]['sort']);_0xe8c782[_0xe028('0xcf')]=qs['filters'](_['pick'](_0x3231c0[_0xe028('0x43')],_0x16e184[_0xe028('0xd0')]));if(_0x3231c0[_0xe028('0x43')][_0xe028('0x31')]){_0xe8c782[_0xe028('0xcf')]=_[_0xe028('0xd2')](_0xe8c782[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0xe8c782[_0xe028('0x48')],function(_0x2b48e9){var _0x253d2a={};_0x253d2a[_0x2b48e9]={'$like':'%'+_0x3231c0['query']['filter']+'%'};return _0x253d2a;})});}_0xe8c782=_[_0xe028('0xd2')]({},_0xe8c782,_0x3231c0['options']);return _0x1a8d85[_0xe028('0x10a')](_0xe8c782);}})[_0xe028('0x1c')](function(_0x131348){if(_0x131348){_0xc4e503=_0x131348[_0xe028('0x6a')];if(!_0x3231c0['query'][_0xe028('0xc1')]('nolimit')){_0xe8c782['limit']=qs[_0xe028('0x1a')](_0x3231c0[_0xe028('0x43')][_0xe028('0x1a')]);_0xe8c782[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x3231c0['query'][_0xe028('0x18')]);}return _0x1a8d85[_0xe028('0x10a')](_0xe8c782);}})['then'](function(_0x2ec72e){if(_0x2ec72e){return _0x2ec72e?{'count':_0xc4e503,'rows':_0x2ec72e}:null;}})[_0xe028('0x1c')](respondWithResult(_0x458291,null))[_0xe028('0x25')](handleError(_0x458291,null));};exports[_0xe028('0x10b')]=function(_0x53841d,_0x95899e){var _0x40c537=_0x53841d[_0xe028('0x54')]['id'];var _0x3374b6=_0x53841d[_0xe028('0x5a')]?_0x53841d[_0xe028('0x5a')]['ids']:null;var _0x452536=[];return Promise[_0xe028('0xfa')]()[_0xe028('0x1c')](function(){if(!_0x3374b6)throw new APIBadRequestError(_0xe028('0x10c'));})[_0xe028('0x1c')](function(){return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x40c537}});})[_0xe028('0x1c')](function(_0x5246b3){if(!_0x5246b3)throw new APINotFoundError(util[_0xe028('0x9d')](_0xe028('0xc0'),_0x53841d['params']['id']));return db[_0xe028('0x66')][_0xe028('0x10d')](function(_0x9c8d77){return _0x5246b3[_0xe028('0x10b')](_0x3374b6,{'transaction':_0x9c8d77})['then'](function(){return db[_0xe028('0x10e')][_0xe028('0x4a')]({'where':{'id':{'$in':_0x3374b6}}});})[_0xe028('0x1c')](function(_0x4751de){var _0x459e79=_['map'](_0x4751de,function(_0x249f6b){return _0x249f6b[_0xe028('0x10f')]();});return Promise['all'](_0x459e79);})[_0xe028('0x1c')](function(_0x41d742){_0x452536=_['flattenDeep'](_0x41d742);var _0x6e45fd=_[_0xe028('0x32')](_0x452536,function(_0x461f4d){return _0x461f4d['addAgent'](_0x5246b3['id'],{'transaction':_0x9c8d77});});return Promise['all'](_0x6e45fd);})[_0xe028('0x1c')](function(){if(!_0x5246b3['online'])return;var _0x43265c=_[_0xe028('0x31')](_0x452536,function(_0x52f0f7){return _0x52f0f7['getDataValue']('channel')===_0xe028('0x110');});var _0x48f579=_['map'](_0x43265c,function(_0x526082){return db[_0xe028('0xa7')][_0xe028('0xa0')]({'membername':_0x5246b3[_0xe028('0x36')],'UserId':_0x5246b3['id'],'queue_name':_0x526082[_0xe028('0x36')],'VoiceQueueId':_0x526082['id'],'interface':_[_0xe028('0x64')](_0x5246b3[_0xe028('0x9c')])?util[_0xe028('0x9d')]('SIP/%s',_0x5246b3[_0xe028('0x36')]):_0x5246b3[_0xe028('0x9c')],'paused':_0x5246b3[_0xe028('0x9f')]||![],'penalty':_0x5246b3['penalty']},{'transaction':_0x9c8d77});});return Promise[_0xe028('0x59')](_0x48f579);})['then'](function(){return db[_0xe028('0x111')][_0xe028('0x4a')]({'where':{'teamId':{'$in':_0x3374b6}}});})[_0xe028('0x1c')](function(_0x10c899){var _0x5e6175=_[_0xe028('0x32')](_0x10c899,function(_0x4e5e66){return db[_0xe028('0x112')][_0xe028('0x79')]({'UserId':_0x5246b3['id'],'VoicePrefixId':_0x4e5e66['VoicePrefixId']},{'transaction':_0x9c8d77});});return Promise[_0xe028('0x59')](_0x5e6175);});});})[_0xe028('0x1c')](function(){for(var _0x463ed5=0x0;_0x463ed5<_0x452536[_0xe028('0x6a')];_0x463ed5++){var _0x159eda=_0x452536[_0x463ed5][_0xe028('0x113')](_0xe028('0x93'));var _0x5bfc65=_0x159eda+_0xe028('0x9a');socket['emit'](_0xe028('0x2c')+_0x159eda+_0xe028('0x114'),{'UserId':_0x40c537,['queueField']:_0x452536[_0x463ed5]['id']});}})['then'](respondWithStatusCode(_0x95899e,null))[_0xe028('0x25')](APIHandleError(_0x95899e));};exports['removeTeams']=function(_0x11f324,_0x518840){var _0x314cdd=_0x11f324[_0xe028('0x54')]['id'];var _0x204ce1=null;if(_0x11f324[_0xe028('0x43')]['ids']){_0x204ce1=_[_0xe028('0xa4')](_0x11f324[_0xe028('0x43')]['ids'])?_0x11f324['query'][_0xe028('0x5d')]:[_0x11f324[_0xe028('0x43')][_0xe028('0x5d')]];}var _0x585e1b=[];return Promise[_0xe028('0xfa')]()[_0xe028('0x1c')](function(){if(!_0x204ce1)throw new APIBadRequestError(_0xe028('0x115'));})[_0xe028('0x1c')](function(){return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x314cdd}});})['then'](function(_0x1886bd){if(!_0x1886bd)throw new APINotFoundError(util[_0xe028('0x9d')](_0xe028('0xc0'),_0x11f324[_0xe028('0x54')]['id']));return db[_0xe028('0x66')][_0xe028('0x10d')](function(_0x5fbc51){return _0x1886bd['removeTeams'](_0x204ce1,{'transaction':_0x5fbc51})[_0xe028('0x1c')](function(){return db[_0xe028('0x10e')]['findAll']({'where':{'id':{'$in':_0x204ce1}}});})[_0xe028('0x1c')](function(_0x5c0763){var _0x2308b7=_['map'](_0x5c0763,function(_0x527f16){return _0x527f16[_0xe028('0x10f')]();});return Promise[_0xe028('0x59')](_0x2308b7);})[_0xe028('0x1c')](function(_0x11d0f2){_0x585e1b=_[_0xe028('0x116')](_0x11d0f2);var _0x5420e1=_[_0xe028('0x32')](_0x585e1b,function(_0x5a49eb){return _0x5a49eb[_0xe028('0x117')](_0x1886bd['id'],{'transaction':_0x5fbc51});});return Promise[_0xe028('0x59')](_0x5420e1);})[_0xe028('0x1c')](function(){if(!_0x1886bd[_0xe028('0x9b')])return;var _0x89cc81=_[_0xe028('0x31')](_0x585e1b,function(_0x961042){return _0x961042[_0xe028('0x113')]('channel')==='Voice';});var _0x5cf8ac=_[_0xe028('0x32')](_0x89cc81,function(_0x1b3c87){return db[_0xe028('0xa7')][_0xe028('0x38')]({'where':{'VoiceQueueId':_0x1b3c87['id'],'UserId':_0x1886bd['id']},'transaction':_0x5fbc51});});return Promise[_0xe028('0x59')](_0x5cf8ac);})[_0xe028('0x1c')](function(){return db[_0xe028('0x111')][_0xe028('0x4a')]({'where':{'teamId':{'$in':_0x204ce1}}});})[_0xe028('0x1c')](function(_0x18f653){var _0x274ab7=_['map'](_0x18f653,function(_0x2c75cf){return db[_0xe028('0x112')][_0xe028('0x38')]({'where':{'UserId':_0x1886bd['id'],'VoicePrefixId':_0x2c75cf[_0xe028('0x118')]}},{'transaction':_0x5fbc51});});return Promise[_0xe028('0x59')](_0x274ab7);});});})[_0xe028('0x1c')](function(){for(var _0x10acd5=0x0;_0x10acd5<_0x585e1b['length'];_0x10acd5++){var _0x5a4028=_0x585e1b[_0x10acd5]['getDataValue'](_0xe028('0x93'));var _0x1c5edc=_0x5a4028+_0xe028('0x9a');socket['emit'](_0xe028('0x2c')+_0x5a4028+'Queue:remove',{'UserId':_0x314cdd,['queueField']:_0x585e1b[_0x10acd5]['id']});}})['then'](respondWithStatusCode(_0x518840,null))['catch'](APIHandleError(_0x518840));};exports[_0xe028('0x119')]=function(_0x4379c5,_0x450bdf){var _0x3d874c={};var _0x4a72c9={};var _0x5aa856;var _0x3c47d1;return db[_0xe028('0x39')][_0xe028('0xbf')]({'where':{'id':_0x4379c5[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x450bdf,null))[_0xe028('0x1c')](function(_0x2cdba0){if(_0x2cdba0){_0x5aa856=_0x2cdba0;_0x4a72c9['model']=_['keys'](db[_0xe028('0xc2')][_0xe028('0x3a')]);_0x4a72c9[_0xe028('0x43')]=_['keys'](_0x4379c5[_0xe028('0x43')]);_0x4a72c9[_0xe028('0xd0')]=_['intersection'](_0x4a72c9[_0xe028('0xc8')],_0x4a72c9[_0xe028('0x43')]);_0x3d874c[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x4a72c9[_0xe028('0xc8')],qs[_0xe028('0xcc')](_0x4379c5[_0xe028('0x43')][_0xe028('0xcc')]));_0x3d874c['attributes']=_0x3d874c[_0xe028('0x48')]['length']?_0x3d874c[_0xe028('0x48')]:_0x4a72c9[_0xe028('0xc8')];_0x3d874c[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x4379c5['query']['sort']);_0x3d874c[_0xe028('0xcf')]=qs[_0xe028('0xd0')](_[_0xe028('0xd1')](_0x4379c5[_0xe028('0x43')],_0x4a72c9[_0xe028('0xd0')]));if(_0x4379c5[_0xe028('0x43')][_0xe028('0x31')]){_0x3d874c[_0xe028('0xcf')]=_[_0xe028('0xd2')](_0x3d874c[_0xe028('0xcf')],{'$or':_['map'](_0x3d874c[_0xe028('0x48')],function(_0xffdd09){var _0xc9c5f7={};_0xc9c5f7[_0xffdd09]={'$like':'%'+_0x4379c5[_0xe028('0x43')][_0xe028('0x31')]+'%'};return _0xc9c5f7;})});}_0x3d874c=_[_0xe028('0xd2')]({},_0x3d874c,_0x4379c5[_0xe028('0x57')]);return _0x5aa856['getLists'](_0x3d874c);}})['then'](function(_0x42c7ee){if(_0x42c7ee){_0x3c47d1=_0x42c7ee[_0xe028('0x6a')];if(!_0x4379c5['query'][_0xe028('0xc1')](_0xe028('0xd4'))){_0x3d874c['limit']=qs['limit'](_0x4379c5[_0xe028('0x43')]['limit']);_0x3d874c[_0xe028('0x18')]=qs[_0xe028('0x18')](_0x4379c5[_0xe028('0x43')][_0xe028('0x18')]);}return _0x5aa856[_0xe028('0x119')](_0x3d874c);}})[_0xe028('0x1c')](function(_0x284b38){if(_0x284b38){return _0x284b38?{'count':_0x3c47d1,'rows':_0x284b38}:null;}})['then'](respondWithResult(_0x450bdf,null))[_0xe028('0x25')](handleError(_0x450bdf,null));};exports['getAgents']=function(_0x33d512,_0x50403a){var _0x11201c={};var _0x2eb828={};var _0x47cd5e;return db[_0xe028('0x39')]['findOne']({'where':{'id':_0x33d512[_0xe028('0x54')]['id']}})[_0xe028('0x1c')](handleEntityNotFound(_0x50403a,null))['then'](function(_0x22a7df){if(_0x22a7df){_0x47cd5e=_0x22a7df;_0x2eb828[_0xe028('0xc8')]=_['keys'](db['User'][_0xe028('0x3a')]);_0x2eb828[_0xe028('0x43')]=_[_0xe028('0xc9')](_0x33d512[_0xe028('0x43')]);_0x2eb828[_0xe028('0xd0')]=_[_0xe028('0xcb')](_0x2eb828[_0xe028('0xc8')],_0x2eb828[_0xe028('0x43')]);_0x11201c[_0xe028('0x48')]=_[_0xe028('0xcb')](_0x2eb828['model'],qs['fields'](_0x33d512[_0xe028('0x43')][_0xe028('0xcc')]));_0x11201c[_0xe028('0x48')]=_0x11201c[_0xe028('0x48')]['length']?_0x11201c[_0xe028('0x48')]:_0x2eb828[_0xe028('0xc8')];_0x11201c[_0xe028('0xcd')]=qs[_0xe028('0xce')](_0x33d512[_0xe028('0x43')][_0xe028('0xce')]);_0x11201c['where']=qs['filters'](_[_0xe028('0xd1')](_0x33d512[_0xe028('0x43')],_0x2eb828['filters']));if(_0x33d512[_0xe028('0x43')][_0xe028('0x31')]){_0x11201c['where']=_[_0xe028('0xd2')](_0x11201c[_0xe028('0xcf')],{'$or':_[_0xe028('0x32')](_0x11201c[_0xe028('0x48')],function(_0x206359){var _0x4743a8={};_0x4743a8[_0x206359]={'$like':'%'+_0x33d512[_0xe028('0x43')]['filter']+'%'};return _0x4743a8;})});}_0x11201c['model']=db[_0xe028('0x39')];_0x11201c['as']=_0xe028('0x2d');_0x11201c=_['merge']({},_0x11201c,_0x33d512[_0xe028('0x57')]);return _0x47cd5e[_0xe028('0xf2')]({'include':[_0x11201c]});}})[_0xe028('0x1c')](function(_0x2d9000){if(_0x2d9000){var _0x3b4f61={},_0x3ef844=[];for(var _0x14f507=0x0;_0x14f507<_0x2d9000[_0xe028('0x6a')];_0x14f507+=0x1){for(var _0x27e4b1=0x0,_0x442417;_0x27e4b1<_0x2d9000[_0x14f507][_0xe028('0x2d')]['length'];_0x27e4b1+=0x1){_0x442417=_0x2d9000[_0x14f507][_0xe028('0x2d')][_0x27e4b1][_0xe028('0x29')]({'plain':!![]});_0x3b4f61[_0x442417['id']]=_0x442417;}}_0x3b4f61=_[_0xe028('0x11a')](_0x3b4f61);for(var _0x13389e=qs[_0xe028('0x18')](_0x33d512[_0xe028('0x43')][_0xe028('0x18')]);_0x13389e<_0x3b4f61[_0xe028('0x6a')]&&_0x3ef844[_0xe028('0x6a')]=_0x548f69){_0x50d578=_0x548f69;_0x56d13c=0xc8;}else{_0x56d13c=0xce;}_0x320e57['status'](_0x56d13c);return _0x320e57[_0x9dce('0x1c')](_0x9dce('0x1d'),_0x18dd8c+'-'+_0x50d578+'/'+_0x548f69)[_0x9dce('0x17')](_0x332c92);}return null;};}function respondWithRpcPromise(_0x2db89e,_0x441b47,_0x37c97d,_0x3aedde){return new Promise(function(_0x36f1c8,_0x2061c3){var _0x5947de=_0x3aedde||amiClient;return _0x5947de[_0x9dce('0x1e')](_0x2db89e,_0x37c97d)[_0x9dce('0x1f')](function(_0x37372e){logger[_0x9dce('0x20')](_0x9dce('0x21'),_0x441b47,_0x9dce('0x22'));logger['debug'](_0x9dce('0x23'),_0x441b47,'request\x20sent',JSON['stringify'](_0x37372e));if(_0x37372e[_0x9dce('0x24')]){if(_0x37372e[_0x9dce('0x24')]['code']===0x1f4){logger[_0x9dce('0x24')]('User,\x20%s,\x20%s',_0x441b47,_0x37372e[_0x9dce('0x24')]['message']);return _0x2061c3(_0x37372e[_0x9dce('0x24')][_0x9dce('0x25')]);}logger[_0x9dce('0x24')](_0x9dce('0x21'),_0x441b47,_0x37372e[_0x9dce('0x24')][_0x9dce('0x25')]);return _0x36f1c8(_0x37372e['error'][_0x9dce('0x25')]);}else{logger[_0x9dce('0x20')]('User,\x20%s,\x20%s',_0x441b47,'request\x20sent');_0x36f1c8(_0x37372e[_0x9dce('0x26')][_0x9dce('0x25')]);}})['catch'](function(_0x13168a){logger['error'](_0x9dce('0x21'),_0x441b47,_0x13168a);_0x2061c3(_0x13168a);});});}function saveUpdates(_0xe17a06){return function(_0x356456){if(_0x356456){return _0x356456[_0x9dce('0x27')](_0xe17a06)[_0x9dce('0x1f')](function(_0x292336){if(_0x292336['role']==='agent'){socket[_0x9dce('0x28')]('userNotification:recalc:'+_0x292336['id'],_0x292336);}return _0x292336;});}return null;};}function removeEntity(_0x4e8bef,_0x796894){return function(_0x4eb64d){if(_0x4eb64d){return _0x4eb64d[_0x9dce('0x29')]({'transaction':_0x796894})['then'](function(){var _0x1343bb=_0x4eb64d[_0x9dce('0x2a')]({'plain':!![]});if(_0x1343bb[_0x9dce('0x2b')]===_0x9dce('0x2c'))return;var _0x35996d=[{'name':_0x9dce('0x2d'),'value':_0x9dce('0x2e'),'ignore':!![]},{'name':_0x9dce('0x2f'),'value':'agent','ignore':![]},{'name':_0x9dce('0x30'),'value':_0x9dce('0x31'),'ignore':![]}];var _0x22e589=_(_0x35996d)[_0x9dce('0x32')]('ignore')[_0x9dce('0x33')]('value')[_0x9dce('0x34')]();if(_['includes'](_0x22e589,_0x1343bb[_0x9dce('0x2b')])){return;}var _0x57ffc0=_[_0x9dce('0x35')](_0x35996d,[_0x9dce('0x34'),_0x1343bb[_0x9dce('0x2b')]])[_0x9dce('0x36')];return db[_0x9dce('0x37')][_0x9dce('0x29')]({'where':{'type':_0x57ffc0,'resourceId':_0x1343bb['id']},'transaction':_0x796894})['then'](function(){return _0x4eb64d;});})[_0x9dce('0x1f')](function(){_0x4e8bef['status'](0xcc)[_0x9dce('0x38')]();});}};}function handleEntityNotFound(_0x59aa35){return function(_0x3ea759){if(!_0x3ea759){_0x59aa35[_0x9dce('0x15')](0x194);}return _0x3ea759;};}function handleError(_0x1da0b3,_0x1d307e){_0x1d307e=_0x1d307e||0x1f4;return function(_0x5ee2be){logger[_0x9dce('0x24')](_0x5ee2be[_0x9dce('0x39')]);if(_0x5ee2be[_0x9dce('0x36')]){delete _0x5ee2be[_0x9dce('0x36')];}_0x1da0b3[_0x9dce('0x16')](_0x1d307e)[_0x9dce('0x3a')](_0x5ee2be);};}function getUserAttributes(){return _(db[_0x9dce('0x3b')][_0x9dce('0x3c')])['map'](function(_0x4cfdef){return{'name':_0x4cfdef[_0x9dce('0x3d')],'type':_0x4cfdef[_0x9dce('0x3e')][_0x9dce('0x3f')]};})[_0x9dce('0x32')](function(_0x1de442){return![_0x9dce('0x40'),'salt','previousPasswords',_0x9dce('0x41'),'resetPasswordExpires',_0x9dce('0x42')]['includes'](_0x1de442[_0x9dce('0x36')]);})[_0x9dce('0x34')]();}exports[_0x9dce('0x43')]=function(_0x272686,_0x364a72){var _0x2cabe5={},_0x114cc0={'count':0x0,'rows':[]};var _0x360ed7=getUserAttributes();_0x2cabe5=qs[_0x9dce('0x44')](_0x360ed7,_0x272686);var _0x65172e={'where':_0x2cabe5[_0x9dce('0x45')]};return db[_0x9dce('0x3b')][_0x9dce('0x1a')](_0x65172e)[_0x9dce('0x1f')](function(_0x38118f){_0x114cc0[_0x9dce('0x1a')]=_0x38118f;if(_0x272686[_0x9dce('0x46')]['includeAll']){_0x2cabe5[_0x9dce('0x47')]=[{'all':!![]}];}if(_0x272686[_0x9dce('0x46')][_0x9dce('0x48')]===_0x9dce('0x49')){_0x2cabe5[_0x9dce('0x47')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x9dce('0x4a')](_0x2cabe5[_0x9dce('0x4b')],'id')){_0x2cabe5[_0x9dce('0x4b')][_0x9dce('0x4c')]('id');}return db['User']['findAll'](_0x2cabe5);})['then'](function(_0x6a420b){_0x114cc0[_0x9dce('0x4d')]=_0x6a420b;if(_0x272686[_0x9dce('0x46')][_0x9dce('0x4e')]===_0x9dce('0x49')){var _0x523ed4=[];for(var _0x5431c6=0x0;_0x5431c6<_0x114cc0[_0x9dce('0x4d')][_0x9dce('0x4f')];_0x5431c6++){_0x523ed4[_0x9dce('0x4c')](get_open_tabs('chat',_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));_0x523ed4['push'](get_open_tabs(_0x9dce('0x51'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6]['dataValues']));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x52'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x53'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x54'),_0x114cc0['rows'][_0x5431c6][_0x9dce('0x50')]));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x55'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));}return Promise[_0x9dce('0x56')](_0x523ed4)['then'](function(){return _0x114cc0;});}else{return _0x114cc0;}})[_0x9dce('0x1f')](respondWithFilteredResult(_0x364a72,_0x2cabe5))['catch'](handleError(_0x364a72,null));};exports['show']=function(_0x1d6941,_0x176121){var _0x2485a6=getUserAttributes();_0x1d6941[_0x9dce('0x46')]['id']=_0x1d6941[_0x9dce('0x57')]['id'];var _0x154301=qs[_0x9dce('0x44')](_0x2485a6,_0x1d6941);if(_0x1d6941[_0x9dce('0x46')][_0x9dce('0x58')]){_0x154301['include']=[{'all':!![]}];}if(_0x1d6941[_0x9dce('0x46')]['userSetting']===_0x9dce('0x49')){_0x154301[_0x9dce('0x47')]=[{'model':db['UserSetting'],'as':_0x9dce('0x48')}];}_0x154301=_[_0x9dce('0x59')]({},_0x154301,_0x1d6941[_0x9dce('0x5a')]);if(!_['includes'](_0x154301[_0x9dce('0x4b')],'id')){_0x154301['attributes']['push']('id');}return db[_0x9dce('0x3b')][_0x9dce('0x35')](_0x154301)[_0x9dce('0x1f')](handleEntityNotFound(_0x176121,null))[_0x9dce('0x1f')](function(_0x5acb35){var _0x1073b3=[];values=_0x5acb35;if(_0x1d6941[_0x9dce('0x46')]['openTabs']===_0x9dce('0x49')){_0x1073b3[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x5b'),_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs('sms',_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs('openchannel',_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x55'),_0x5acb35['dataValues']));_0x1073b3[_0x9dce('0x4c')](get_open_tabs('fax',_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x53'),_0x5acb35['dataValues']));return Promise[_0x9dce('0x56')](_0x1073b3);}else{return values;}})[_0x9dce('0x1f')](function(){return values;})[_0x9dce('0x1f')](respondWithResult(_0x176121,null))[_0x9dce('0x5c')](handleError(_0x176121,null));};exports[_0x9dce('0x27')]=function(_0x6b2740,_0x52f232){if(_0x6b2740[_0x9dce('0x5d')]['id']){delete _0x6b2740[_0x9dce('0x5d')]['id'];}delete _0x6b2740[_0x9dce('0x5d')][_0x9dce('0x2b')];return db['User']['find']({'where':{'id':_0x6b2740[_0x9dce('0x57')]['id']}})['then'](handleEntityNotFound(_0x52f232,null))[_0x9dce('0x1f')](saveUpdates(_0x6b2740[_0x9dce('0x5d')],null))[_0x9dce('0x1f')](respondWithResult(_0x52f232,null))[_0x9dce('0x5c')](handleError(_0x52f232,null));};exports['describe']=function(_0x502841,_0x2dab6f){return db[_0x9dce('0x3b')][_0x9dce('0x5e')]()[_0x9dce('0x1f')](respondWithResult(_0x2dab6f,null))[_0x9dce('0x5c')](handleError(_0x2dab6f,null));};exports[_0x9dce('0x5f')]=function(_0x4b3940,_0x2fe126){return db[_0x9dce('0x3b')]['find']({'where':{'id':_0x4b3940['params']['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x2fe126,null))[_0x9dce('0x1f')](function(_0x5444d0){if(_0x5444d0){return _0x5444d0[_0x9dce('0x5f')](_0x4b3940[_0x9dce('0x5d')]['ids'],_['omit'](_0x4b3940[_0x9dce('0x5d')],[_0x9dce('0x60'),'id'])||{});}})[_0x9dce('0x1f')](respondWithResult(_0x2fe126,null))[_0x9dce('0x5c')](handleError(_0x2fe126,null));};function validateUser(_0xa58433){return new Promise(function(_0x5b8e30,_0x4694ec){if(_0xa58433[_0x9dce('0x61')])return _0x5b8e30(_0xa58433);return db[_0x9dce('0x62')][_0x9dce('0x63')](0x1)['then'](function(_0x330bc8){if(_0x330bc8[_0x9dce('0x64')])authService[_0x9dce('0x65')](_0xa58433[_0x9dce('0x40')]);db[_0x9dce('0x3b')][_0x9dce('0x66')](_0x9dce('0x61'))[_0x9dce('0x1f')](function(_0x1c8ed0){if(_[_0x9dce('0x67')](_0x1c8ed0)){_0xa58433['internal']=_0x330bc8[_0x9dce('0x68')]||0x1;return;}if(_['isNil'](_0x330bc8[_0x9dce('0x68')])||_0x330bc8[_0x9dce('0x68')]===_0x1c8ed0){_0xa58433['internal']=_0x1c8ed0+0x1;return;}if(_0x330bc8[_0x9dce('0x68')]>_0x1c8ed0){_0xa58433[_0x9dce('0x61')]=_0x330bc8[_0x9dce('0x68')];return;}return db[_0x9dce('0x69')][_0x9dce('0x46')](_0x9dce('0x6a'),{'type':db[_0x9dce('0x69')][_0x9dce('0x6b')]['SELECT']})[_0x9dce('0x1f')](function(_0x29eea3){if(_0x29eea3&&_0x29eea3[_0x9dce('0x4f')]){for(var _0x4f4a72=0x0,_0x34227f=_0x29eea3['length'];_0x4f4a72<_0x34227f&&_['isNil'](_0xa58433[_0x9dce('0x61')]);_0x4f4a72++){if(_0x330bc8[_0x9dce('0x68')]<=_0x29eea3[_0x4f4a72][_0x9dce('0x6c')]){_0xa58433[_0x9dce('0x61')]=_0x29eea3[_0x4f4a72]['from'];}else if(_0x330bc8['min_internal']>_0x29eea3[_0x4f4a72][_0x9dce('0x6c')]&&_0x330bc8[_0x9dce('0x68')]<=_0x29eea3[_0x4f4a72]['to']){_0xa58433[_0x9dce('0x61')]=_0x330bc8[_0x9dce('0x68')];}}}if(_['isNil'](_0xa58433[_0x9dce('0x61')])){_0xa58433[_0x9dce('0x61')]=_0x1c8ed0+0x1;}return _0x5b8e30(_0xa58433);});});})[_0x9dce('0x5c')](function(_0x2a3f2f){_0x4694ec(_0x2a3f2f);});});}function updateUser(_0x556452){return new Promise(function(_0x3ee9df,_0x313f77){try{if(_0x556452[_0x9dce('0x6d')]){_0x556452['mailbox']=_0x556452[_0x9dce('0x61')];_0x556452[_0x9dce('0x6e')]={'mailbox':_0x556452[_0x9dce('0x61')],'password':_0x556452[_0x9dce('0x40')],'fullname':_0x556452[_0x9dce('0x6f')],'email':_0x556452[_0x9dce('0x70')]};}if(_0x556452[_0x9dce('0x2b')]===_0x9dce('0x71')){if(!_0x556452[_0x9dce('0x72')])_0x556452[_0x9dce('0x72')]=[_0x9dce('0x73'),_0x9dce('0x74'),_0x9dce('0x75'),_0x9dce('0x76'),_0x9dce('0x77'),'104',_0x9dce('0x78'),_0x9dce('0x79'),_0x9dce('0x7a'),'108',_0x9dce('0x7b'),'100',_0x9dce('0x7c'),'114',_0x9dce('0x7d')];}_0x3ee9df(_0x556452);}catch(_0x3a7e19){_0x313f77(_0x3a7e19);}});}exports[_0x9dce('0x7e')]=function(_0x29b339,_0x50855d){if(_0x29b339[_0x9dce('0x2e')][_0x9dce('0x2b')]===_0x9dce('0x71'))throw new Error('Unauthorized');if(_0x29b339[_0x9dce('0x5d')][_0x9dce('0x2b')]===_0x9dce('0x2e')&&_0x29b339[_0x9dce('0x2e')][_0x9dce('0x2b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x29b339[_0x9dce('0x5d')][_0x9dce('0x2b')]===_0x9dce('0x2c')&&_0x29b339[_0x9dce('0x2e')][_0x9dce('0x2b')]!=='admin'){throw new Error(_0x9dce('0x7f'));}return licenseUtil[_0x9dce('0x80')]([_0x29b339['body']])['then'](function(){return validateUser(_0x29b339[_0x9dce('0x5d')]);})[_0x9dce('0x1f')](function(_0x34c8fc){return updateUser(_0x34c8fc)['then'](function(_0x4f4132){if(_0x4f4132['role']==='admin'){_0x4f4132[_0x9dce('0x81')]=_0x29b339['user'][_0x9dce('0x81')];delete _0x4f4132[_0x9dce('0x82')];}return _0x4f4132;});})[_0x9dce('0x1f')](function(_0x52fc9a){return db[_0x9dce('0x3b')]['create'](_0x52fc9a,{'include':[{'model':db[_0x9dce('0x6e')],'as':_0x9dce('0x6e')}]});})[_0x9dce('0x1f')](function(_0x50c756){if(_0x29b339[_0x9dce('0x5d')][_0x9dce('0x2b')]==='user')return _0x50c756;if(_0x29b339['user'][_0x9dce('0x2b')]!=='user')return _0x50c756;return db['UserProfileSection']['find']({'where':{'name':_0x50c756[_0x9dce('0x2b')]===_0x9dce('0x71')?'Agents':_0x9dce('0x30'),'userProfileId':_0x29b339[_0x9dce('0x2e')][_0x9dce('0x82')]},'raw':!![]})[_0x9dce('0x1f')](function(_0x405e49){if(!_0x405e49||_0x405e49['autoAssociation']!=0x0)return _0x50c756;return db[_0x9dce('0x37')]['create']({'name':_0x50c756[_0x9dce('0x36')],'resourceId':_0x50c756['id'],'type':_0x405e49[_0x9dce('0x36')],'sectionId':_0x405e49['id']},{})[_0x9dce('0x1f')](function(){return _0x50c756;});})[_0x9dce('0x5c')](function(_0x38c58c){logger[_0x9dce('0x24')](_0x9dce('0x83'),_0x38c58c);throw _0x38c58c;});})[_0x9dce('0x1f')](respondWithResult(_0x50855d,0xc9))[_0x9dce('0x5c')](handleError(_0x50855d,null));};exports['bulkCreate']=function(_0x46fea7,_0x19ae31){var _0x537399=_0x46fea7['body'];var _0x575cb3=[];if(_0x46fea7['user'][_0x9dce('0x2b')]===_0x9dce('0x71'))throw new Error('Unauthorized');if(_[_0x9dce('0x84')](_0x537399,[_0x9dce('0x2b'),_0x9dce('0x2e')])&&_0x46fea7[_0x9dce('0x2e')]['role']!==_0x9dce('0x2c')){throw new Error(_0x9dce('0x85'));}if(_[_0x9dce('0x84')](_0x537399,[_0x9dce('0x2b'),_0x9dce('0x2c')])&&_0x46fea7[_0x9dce('0x2e')][_0x9dce('0x2b')]!==_0x9dce('0x2c')){throw new Error(_0x9dce('0x86'));}return licenseUtil[_0x9dce('0x80')](_0x537399)[_0x9dce('0x1f')](function(){return validateUser(_0x537399[0x0]);})[_0x9dce('0x1f')](function(){for(var _0x3ed75f=0x1;_0x3ed75f<_0x537399[_0x9dce('0x4f')];_0x3ed75f++){var _0x31d27f=_0x537399[_0x3ed75f-0x1][_0x9dce('0x61')];if(!_0x537399[_0x3ed75f][_0x9dce('0x61')])_0x537399[_0x3ed75f]['internal']=_0x31d27f+0x1;_0x575cb3[_0x9dce('0x4c')](validateUser(_0x537399[_0x3ed75f]));}return Promise['all'](_0x575cb3);})[_0x9dce('0x1f')](function(){_0x575cb3=[];for(var _0x326442=0x0;_0x326442<_0x537399[_0x9dce('0x4f')];_0x326442++){_0x575cb3['push'](updateUser(_0x537399[_0x326442]));}return Promise[_0x9dce('0x56')](_0x575cb3);})[_0x9dce('0x1f')](function(){_0x575cb3=_0x537399[_0x9dce('0x33')](function(_0x518636){return db[_0x9dce('0x3b')][_0x9dce('0x7e')](_0x518636,{'include':[{'model':db[_0x9dce('0x6e')],'as':_0x9dce('0x6e')}]})[_0x9dce('0x1f')](function(_0x33600c){_0x518636['id']=_0x33600c['id'];return _0x518636;});});return Promise[_0x9dce('0x56')](_0x575cb3);})[_0x9dce('0x1f')](function(_0x139735){if(_0x46fea7[_0x9dce('0x5d')][_0x9dce('0x2b')]==='user')return _0x139735;if(_0x46fea7[_0x9dce('0x2e')]['role']!==_0x9dce('0x2e'))return _0x139735;var _0xa19c89=_['some'](_0x139735,function(_0x3e2438){return _0x3e2438['role']===_0x9dce('0x71')||_0x3e2438[_0x9dce('0x2b')]===_0x9dce('0x31');});if(!_0xa19c89)return _0x139735;return db[_0x9dce('0x87')][_0x9dce('0x88')]({'where':{'name':{'$or':[_0x9dce('0x2f'),_0x9dce('0x30')]},'userProfileId':_0x46fea7[_0x9dce('0x2e')][_0x9dce('0x82')]},'raw':!![]})[_0x9dce('0x1f')](function(_0x718f9b){if(_[_0x9dce('0x89')](_0x718f9b)||!_[_0x9dce('0x84')](_0x718f9b,[_0x9dce('0x8a'),0x0]))return _0x139735;_0x575cb3=[];var _0x19465b=_(_0x718f9b)[_0x9dce('0x33')](function(_0x42264d){if(_0x42264d['autoAssociation']===0x1)return;return _0x42264d[_0x9dce('0x36')]==='Agents'?_0x9dce('0x71'):_0x9dce('0x31');})[_0x9dce('0x8b')]()['value']();for(var _0xcd45d7=0x0;_0xcd45d7<_0x139735[_0x9dce('0x4f')];_0xcd45d7++){if(!_['includes'](_0x19465b,_0x139735[_0xcd45d7][_0x9dce('0x2b')]))return;var _0x38572d=_0x139735[_0xcd45d7][_0x9dce('0x2b')]==='agent'?_0x9dce('0x2f'):'Telephones';_0x575cb3[_0x9dce('0x4c')](db[_0x9dce('0x37')][_0x9dce('0x7e')]({'name':_0x139735[_0xcd45d7][_0x9dce('0x36')],'resourceId':_0x139735[_0xcd45d7]['id'],'type':_0x38572d,'sectionId':_[_0x9dce('0x35')](_0x718f9b,[_0x9dce('0x36'),_0x38572d])['id']},{}));}return Promise[_0x9dce('0x56')](_0x575cb3);});})[_0x9dce('0x1f')](respondWithResult(_0x19ae31,0xc9))[_0x9dce('0x5c')](handleError(_0x19ae31,null));};exports['changePassword']=function(_0x54df6b,_0x387538){if(_0x54df6b[_0x9dce('0x5d')]['id']){delete _0x54df6b['body']['id'];}return db['User'][_0x9dce('0x35')]({'where':{'id':_0x54df6b[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](function(_0x303747){if(!_0x303747)return null;if(_0x303747['id']===_0x54df6b[_0x9dce('0x2e')]['id']){if(!_0x54df6b['body'][_0x9dce('0x8c')]||!_0x54df6b['body'][_0x9dce('0x8d')]){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x303747[_0x9dce('0x90')](_0x54df6b['body']['oldPassword'])){throw new db[(_0x9dce('0x8e'))]['ValidationError'](_0x9dce('0x91'));}if(_0x54df6b['body'][_0x9dce('0x8c')]===_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')]){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0x92'));}}else if(_0x54df6b[_0x9dce('0x2e')][_0x9dce('0x2b')]===_0x9dce('0x2c')){if(!_0x54df6b[_0x9dce('0x5d')]['newPassword']){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0x93'));}}else if(_0x54df6b['user'][_0x9dce('0x2b')]==='user'){if(!_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')]){throw new db[(_0x9dce('0x8e'))]['ValidationError'](_0x9dce('0x93'));}if(_0x303747['role']!==_0x9dce('0x71')){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0x94'));}}else{throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))]('Unauthorized');}return _0x303747;})['then'](handleEntityNotFound(_0x387538,null))['then'](function(_0x3b5c2d){return db[_0x9dce('0x62')][_0x9dce('0x95')]({'attributes':['id',_0x9dce('0x64'),_0x9dce('0x96'),_0x9dce('0x97')]})['then'](function(_0x3d496c){if(_0x3d496c[_0x9dce('0x64')])authService['validatePasswordPattern'](_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')]);if(!_0x3d496c[_0x9dce('0x96')]||!_0x3b5c2d[_0x9dce('0x98')])return _0x3b5c2d;authService[_0x9dce('0x99')](_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')],_0x3b5c2d['previousPasswords'],_0x3d496c[_0x9dce('0x97')]);return _0x3b5c2d;})['then'](saveUpdates({'password':_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')],'passwordResetAt':_0x54df6b['user']['id']==_0x54df6b[_0x9dce('0x57')]['id']?moment():null,'previousPasswords':authService[_0x9dce('0x9a')](_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')],_0x3b5c2d['previousPasswords'])},null));})['then'](respondWithResult(_0x387538,null))[_0x9dce('0x5c')](handleError(_0x387538,null));};exports[_0x9dce('0x9b')]=function(_0x1a0abb,_0x17da07){var _0x118ace=_0x1a0abb[_0x9dce('0x5d')][_0x9dce('0x9c')];return db[_0x9dce('0x3b')]['find']({'where':{'id':_0x1a0abb[_0x9dce('0x57')]['id']},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b'),_0x9dce('0x9d'),_0x9dce('0x9e'),_0x9dce('0x9f'),_0x9dce('0xa0')]})['then'](handleEntityNotFound(_0x17da07,null))[_0x9dce('0x1f')](function(_0x22a97b){if(_0x22a97b){if(!utils[_0x9dce('0xa1')](_0x118ace)){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0xa2'));}return _0x22a97b[_0x9dce('0xa3')+_['capitalize'](_0x118ace['toLowerCase']())+_0x9dce('0xa4')](_0x1a0abb[_0x9dce('0x5d')]['ids'],{'penalty':_0x1a0abb[_0x9dce('0x5d')][_0x9dce('0xa5')]||0x0})[_0x9dce('0xa6')](function(_0x45d6e2){for(var _0x382a69=0x0;_0x382a69<_0x1a0abb['body'][_0x9dce('0x60')][_0x9dce('0x4f')];_0x382a69+=0x1){var _0xc7ffe9={'UserId':Number(_0x1a0abb[_0x9dce('0x57')]['id'])};_0xc7ffe9[_[_0x9dce('0xa7')](_0x118ace[_0x9dce('0xa8')]())+'QueueId']=Number(_0x1a0abb['body']['ids'][_0x382a69]);socket[_0x9dce('0x28')](_0x9dce('0x2e')+_[_0x9dce('0xa7')](_0x118ace[_0x9dce('0xa8')]())+_0x9dce('0xa9'),_0xc7ffe9);}return _0x45d6e2;})[_0x9dce('0x1f')](function(){if(_0x118ace===_0x9dce('0xaa')){return db[_0x9dce('0xab')][_0x9dce('0x88')]({'where':{'id':_0x1a0abb[_0x9dce('0x5d')]['ids']||[]},'raw':!![],'attributes':['id',_0x9dce('0x36')]});}})['then'](function(_0x4e8882){var _0x137a52=_0x22a97b[_0x9dce('0x2a')]({'plain':!![]});var _0x2c8fed=[];if(_0x118ace===_0x9dce('0xaa')&&_0x137a52[_0x9dce('0x2b')]===_0x9dce('0x71')&&_0x137a52[_0x9dce('0x9d')]){for(let _0x5221e9=0x0;_0x5221e9<_0x4e8882[_0x9dce('0x4f')];_0x5221e9+=0x1){_0x2c8fed['push']({'membername':_0x137a52['name'],'UserId':_0x137a52['id'],'queue_name':_0x4e8882[_0x5221e9][_0x9dce('0x36')],'VoiceQueueId':_0x4e8882[_0x5221e9]['id'],'interface':_[_0x9dce('0x67')](_0x137a52[_0x9dce('0xa0')])?util[_0x9dce('0xac')](_0x9dce('0xad'),_0x137a52[_0x9dce('0x36')]):_0x137a52[_0x9dce('0xa0')],'paused':_0x137a52[_0x9dce('0x9f')]||![],'penalty':_0x1a0abb[_0x9dce('0x5d')][_0x9dce('0xa5')]||0x0});}return Promise['all'](_0x2c8fed[_0x9dce('0x33')](function(_0x1ba007){return db[_0x9dce('0xae')][_0x9dce('0xaf')](_0x1ba007);}));}return _0x22a97b;});}})[_0x9dce('0x1f')](respondWithStatusCode(_0x17da07,null))[_0x9dce('0x5c')](handleError(_0x17da07,null));};exports[_0x9dce('0xb0')]=function(_0x1e82df,_0x5d5eee){var _0x5b01c2,_0x18c4da;return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x1e82df[_0x9dce('0x57')]['id']},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b')]})[_0x9dce('0x1f')](handleEntityNotFound(_0x5d5eee,null))[_0x9dce('0x1f')](function(_0x49bfe7){if(_0x49bfe7){_0x5b01c2=_0x49bfe7;if(!_0x1e82df['query'][_0x9dce('0x9c')]||!utils['isValidChannel'](_0x1e82df['query'][_0x9dce('0x9c')])){throw new db[(_0x9dce('0x8e'))]['ValidationError'](_0x9dce('0xa2'));}return _0x49bfe7[_0x9dce('0xb1')+_[_0x9dce('0xa7')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x9c')][_0x9dce('0xa8')]())+_0x9dce('0xa4')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')]);}})['then'](function(_0x1182c7){if(_[_0x9dce('0xb2')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')])){for(var _0x958002=0x0;_0x958002<_0x1e82df[_0x9dce('0x46')]['ids'][_0x9dce('0x4f')];_0x958002+=0x1){_0x18c4da={'UserId':Number(_0x1e82df[_0x9dce('0x57')]['id'])};_0x18c4da[_[_0x9dce('0xa7')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x9c')][_0x9dce('0xa8')]())+'QueueId']=Number(_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')][_0x958002]);socket[_0x9dce('0x28')]('user'+_['capitalize'](_0x1e82df['query'][_0x9dce('0x9c')][_0x9dce('0xa8')]())+_0x9dce('0xb3'),_0x18c4da);}}else{_0x18c4da={'UserId':Number(_0x1e82df['params']['id'])};_0x18c4da[_[_0x9dce('0xa7')](_0x1e82df[_0x9dce('0x46')]['channel'][_0x9dce('0xa8')]())+_0x9dce('0xb4')]=Number(_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')]);socket[_0x9dce('0x28')]('user'+_['capitalize'](_0x1e82df['query'][_0x9dce('0x9c')]['toLowerCase']())+'Queue:remove',_0x18c4da);}return _0x1182c7;})[_0x9dce('0x1f')](function(){if(_0x1e82df[_0x9dce('0x46')][_0x9dce('0x9c')]===_0x9dce('0xaa')){return db[_0x9dce('0xae')][_0x9dce('0x29')]({'where':{'UserId':_0x1e82df[_0x9dce('0x57')]['id'],'VoiceQueueId':_0x1e82df['query'][_0x9dce('0x60')]},'individualHooks':!![]})['then'](function(){return _0x5b01c2;});}return _0x5b01c2;})[_0x9dce('0x1f')](respondWithStatusCode(_0x5d5eee,null))[_0x9dce('0x5c')](handleError(_0x5d5eee,null));};exports['addAvatar']=function(_0x541592,_0x44a927){_0x541592[_0x9dce('0x5d')][_0x9dce('0xb5')]=_0x541592[_0x9dce('0xb6')][_0x9dce('0xb7')];return db['User'][_0x9dce('0x35')]({'where':{'id':_0x541592[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x44a927,null))[_0x9dce('0x1f')](saveUpdates(_0x541592['body'],null))['then'](respondWithResult(_0x44a927,null))[_0x9dce('0x5c')](handleError(_0x44a927,null));};exports[_0x9dce('0xb8')]=function(_0x8760b4,_0x4ac7c2){var _0x70b47d=path[_0x9dce('0xb9')](config[_0x9dce('0xba')],_0x9dce('0xbb'));return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x8760b4['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9dce('0x1f')](handleEntityNotFound(_0x4ac7c2,null))[_0x9dce('0x1f')](function(_0x458968){if(_0x458968){if(_['isNil'](_0x458968[_0x9dce('0xb5')])){return _0x4ac7c2[_0x9dce('0xbc')](_0x70b47d);}else{if(!fs[_0x9dce('0xbd')](path[_0x9dce('0xb9')](config[_0x9dce('0xba')],'server/files/images/',_0x458968['userpic']))){return _0x4ac7c2[_0x9dce('0xbc')](_0x70b47d);}return _0x4ac7c2[_0x9dce('0xbc')](path['join'](config['root'],'server/files/images/',_0x458968[_0x9dce('0xb5')]));}}})['catch'](handleError(_0x4ac7c2,null));};exports[_0x9dce('0xbe')]=function(_0x1045e7,_0x5eef82){return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x1045e7[_0x9dce('0x57')]['id']},'attributes':['id']})[_0x9dce('0x1f')](handleEntityNotFound(_0x5eef82,null))[_0x9dce('0x1f')](function(_0x4df965){var _0x14cdd9=[];values=_0x4df965['dataValues'];_0x14cdd9['push'](get_open_tabs('chat',_0x4df965['dataValues']));_0x14cdd9[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x51'),_0x4df965[_0x9dce('0x50')]));_0x14cdd9[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x54'),_0x4df965[_0x9dce('0x50')]));_0x14cdd9[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x55'),_0x4df965['dataValues']));_0x14cdd9['push'](get_open_tabs(_0x9dce('0x52'),_0x4df965[_0x9dce('0x50')]));_0x14cdd9['push'](get_open_tabs(_0x9dce('0x53'),_0x4df965['dataValues']));return Promise[_0x9dce('0x56')](_0x14cdd9);})[_0x9dce('0x1f')](function(_0x356288){if(_0x356288){var _0x3a13b3=_[_0x9dce('0x33')](values[_0x9dce('0xbf')],function(_0x1efcd1){return{'channel':_0x9dce('0xc0'),'id':_0x1efcd1['id'],'createdAt':_0x1efcd1[_0x9dce('0xc1')]};});var _0x1a1c25=_[_0x9dce('0x33')](values[_0x9dce('0xc2')],function(_0x12fde5){return{'channel':_0x9dce('0xc3'),'id':_0x12fde5['id'],'createdAt':_0x12fde5[_0x9dce('0xc1')]};});var _0x255a5f=_[_0x9dce('0x33')](values['OpenchannelOpenTabs'],function(_0x4a67a1){return{'channel':_0x9dce('0xc4'),'id':_0x4a67a1['id'],'createdAt':_0x4a67a1[_0x9dce('0xc1')]};});var _0x2a179c=_['map'](values[_0x9dce('0xc5')],function(_0x2104d){return{'channel':'MAIL','id':_0x2104d['id'],'createdAt':_0x2104d['createdAt']};});var _0x2f26a6=_[_0x9dce('0x33')](values['SmsOpenTabs'],function(_0x595bdc){return{'channel':_0x9dce('0xc6'),'id':_0x595bdc['id'],'createdAt':_0x595bdc[_0x9dce('0xc1')]};});var _0x21d40c=_[_0x9dce('0x33')](values[_0x9dce('0xc7')],function(_0xeb52cf){return{'channel':_0x9dce('0xc8'),'id':_0xeb52cf['id'],'createdAt':_0xeb52cf['createdAt']};});var _0xd3d3cf=_[_0x9dce('0xc9')](_0x3a13b3,_0x1a1c25,_0x255a5f,_0x2a179c,_0x2f26a6,_0x21d40c);var _0x34ffe6={'count':_0xd3d3cf[_0x9dce('0x4f')],'rows':_0xd3d3cf};return _0x34ffe6;}else return null;})['then'](respondWithResult(_0x5eef82,null))['catch'](handleError(_0x5eef82,null));};exports[_0x9dce('0xca')]=function(_0x5d5a4d,_0x20ab31){var _0x1377e5={};return db['User'][_0x9dce('0x95')]({'where':{'id':_0x5d5a4d['params']['id']}})[_0x9dce('0x1f')](function(_0x3be2b3){if(!_0x3be2b3){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x5d5a4d[_0x9dce('0x57')]['id']));}return contacts['describe']();})[_0x9dce('0x1f')](function(_0x30272d){_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0x3b')]=_0x5d5a4d[_0x9dce('0x57')]['id'];_0x1377e5=qs[_0x9dce('0x44')](_0x30272d,_0x5d5a4d);if(_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0x58'))){_0x1377e5[_0x9dce('0x47')]=[{'model':db[_0x9dce('0xcc')],'as':_0x9dce('0xcd'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9dce('0x36'),_0x9dce('0xce')],'where':_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcf')]?{'id':_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcf')]}:undefined,'required':_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcf')]?!![]:![]}];}return contacts[_0x9dce('0x88')](_0x5d5a4d[_0x9dce('0x46')],_0x5d5a4d[_0x9dce('0x2e')],_0x1377e5,_0x30272d);})[_0x9dce('0x1f')](respondWithFilteredResult(_0x20ab31,_0x1377e5))[_0x9dce('0x5c')](APIHandleError(_0x20ab31));};exports[_0x9dce('0xd0')]=function(_0x38aaa0,_0x59dc0c){var _0x5b6edd;var _0xcabb74={};var _0x568af1;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x38aaa0[_0x9dce('0x57')]['id']},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b')]})[_0x9dce('0x1f')](handleEntityNotFound(_0x59dc0c,null))[_0x9dce('0x1f')](function(_0x4a3345){if(!utils[_0x9dce('0xa1')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])){throw new db['Sequelize']['ValidationError'](_0x9dce('0xa2'));}_0x5b6edd=_0x4a3345;var _0x1b2f50={};_0x1b2f50['model']=_[_0x9dce('0xd1')](db[_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')]['channel'])+_0x9dce('0xd2')][_0x9dce('0x3c')]);_0x1b2f50[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x38aaa0[_0x9dce('0x46')]);_0x1b2f50[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x1b2f50[_0x9dce('0xd5')],_0x1b2f50[_0x9dce('0x46')]);_0xcabb74['attributes']=_[_0x9dce('0xd4')](_0x1b2f50[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0xd6')]));_0xcabb74[_0x9dce('0x4b')]=_0xcabb74[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0xcabb74['attributes']:_0x1b2f50['model'];_0xcabb74['order']=qs['sort'](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0xd7')]);_0xcabb74[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_['pick'](_0x38aaa0[_0x9dce('0x46')],_0x1b2f50[_0x9dce('0xd3')]));if(_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x32')]){_0xcabb74[_0x9dce('0x45')]=_['merge'](_0xcabb74[_0x9dce('0x45')],{'$or':_['map'](_0xcabb74['attributes'],function(_0x4156aa){var _0x12d077={};_0x12d077[_0x4156aa]={'$like':'%'+_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x12d077;})});}_0xcabb74=_[_0x9dce('0x59')]({},_0xcabb74,_0x38aaa0[_0x9dce('0x5a')]);switch(_0x5b6edd['role']){case _0x9dce('0x2c'):return db[_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])+'Queue'][_0x9dce('0x88')](_0xcabb74);case _0x9dce('0x2e'):case'agent':return _0x5b6edd[_0x9dce('0x2a')+_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])+'Queues'](_0xcabb74);default:throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0xd8'));}})[_0x9dce('0x1f')](function(_0x410d7f){_0x568af1=_0x410d7f[_0x9dce('0x4f')];if(!_0x38aaa0[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0xcabb74[_0x9dce('0x18')]=qs['limit'](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x18')]);_0xcabb74[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x38aaa0[_0x9dce('0x46')]['offset']);}switch(_0x5b6edd[_0x9dce('0x2b')]){case _0x9dce('0x2c'):return db[_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])+'Queue'][_0x9dce('0x88')](_0xcabb74);case _0x9dce('0x2e'):case _0x9dce('0x71'):return _0x5b6edd[_0x9dce('0x2a')+_['capitalize'](_0x38aaa0[_0x9dce('0x46')]['channel'])+_0x9dce('0xa4')](_0xcabb74);}})[_0x9dce('0x1f')](function(_0x12ca96){return{'count':_0x568af1,'rows':_0x12ca96};})[_0x9dce('0x1f')](respondWithResult(_0x59dc0c,null))[_0x9dce('0x5c')](handleError(_0x59dc0c,null));};exports['getVoiceQueuesRt']=function(_0x4bb509,_0x1c539e){var _0x3ef603={};var _0xa28d44={};var _0x25d355;var _0x26f5fe;return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x4bb509['params']['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x1c539e,null))[_0x9dce('0x1f')](function(_0xd4c6ab){if(_0xd4c6ab){_0x25d355=_0xd4c6ab;_0xa28d44[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['UserVoiceQueueRt'][_0x9dce('0x3c')]);_0xa28d44[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x4bb509[_0x9dce('0x46')]);_0xa28d44[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0xa28d44[_0x9dce('0xd5')],_0xa28d44[_0x9dce('0x46')]);_0x3ef603[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0xa28d44['model'],qs['fields'](_0x4bb509[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x3ef603[_0x9dce('0x4b')]=_0x3ef603[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x3ef603[_0x9dce('0x4b')]:_0xa28d44['model'];_0x3ef603[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x4bb509[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x3ef603[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x4bb509[_0x9dce('0x46')],_0xa28d44[_0x9dce('0xd3')]));if(_0x4bb509[_0x9dce('0x46')]['filter']){_0x3ef603[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x3ef603[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x3ef603[_0x9dce('0x4b')],function(_0x236a5c){var _0x1d455e={};_0x1d455e[_0x236a5c]={'$like':'%'+_0x4bb509[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x1d455e;})});}_0x3ef603=_['merge']({},_0x3ef603,_0x4bb509[_0x9dce('0x5a')]);return _0x25d355[_0x9dce('0xdc')](_0x3ef603);}})[_0x9dce('0x1f')](function(_0x21c27e){if(_0x21c27e){_0x26f5fe=_0x21c27e[_0x9dce('0x4f')];if(!_0x4bb509[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0x3ef603['limit']=qs[_0x9dce('0x18')](_0x4bb509['query'][_0x9dce('0x18')]);_0x3ef603['offset']=qs[_0x9dce('0x1b')](_0x4bb509[_0x9dce('0x46')]['offset']);}return _0x25d355['getVoiceQueuesRt'](_0x3ef603);}})['then'](function(_0x74c14b){if(_0x74c14b){return _0x74c14b?{'count':_0x26f5fe,'rows':_0x74c14b}:null;}})['then'](respondWithResult(_0x1c539e,null))[_0x9dce('0x5c')](handleError(_0x1c539e,null));};exports['getGroups']=function(_0x4d568b,_0xc1fbc8){var _0x28c350={};var _0x40aa86={};var _0x49fdfd;var _0x3494b3;return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x4d568b[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0xc1fbc8,null))[_0x9dce('0x1f')](function(_0x22cc68){if(_0x22cc68){_0x49fdfd=_0x22cc68;_0x40aa86[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db[_0x9dce('0xdd')][_0x9dce('0x3c')]);_0x40aa86[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x4d568b[_0x9dce('0x46')]);_0x40aa86['filters']=_[_0x9dce('0xd4')](_0x40aa86[_0x9dce('0xd5')],_0x40aa86[_0x9dce('0x46')]);_0x28c350['attributes']=_[_0x9dce('0xd4')](_0x40aa86[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x4d568b[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x28c350[_0x9dce('0x4b')]=_0x28c350[_0x9dce('0x4b')]['length']?_0x28c350[_0x9dce('0x4b')]:_0x40aa86['model'];_0x28c350[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x4d568b[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x28c350['where']=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x4d568b[_0x9dce('0x46')],_0x40aa86[_0x9dce('0xd3')]));if(_0x4d568b['query'][_0x9dce('0x32')]){_0x28c350[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x28c350['where'],{'$or':_[_0x9dce('0x33')](_0x28c350[_0x9dce('0x4b')],function(_0x510a1f){var _0x3fbc82={};_0x3fbc82[_0x510a1f]={'$like':'%'+_0x4d568b[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x3fbc82;})});}_0x28c350=_[_0x9dce('0x59')]({},_0x28c350,_0x4d568b[_0x9dce('0x5a')]);return _0x49fdfd[_0x9dce('0xde')](_0x28c350);}})[_0x9dce('0x1f')](function(_0x36a6b1){if(_0x36a6b1){_0x3494b3=_0x36a6b1[_0x9dce('0x4f')];if(!_0x4d568b[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x28c350[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x4d568b[_0x9dce('0x46')][_0x9dce('0x18')]);_0x28c350['offset']=qs[_0x9dce('0x1b')](_0x4d568b['query'][_0x9dce('0x1b')]);}return _0x49fdfd['getGroups'](_0x28c350);}})[_0x9dce('0x1f')](function(_0xfddb81){if(_0xfddb81){return _0xfddb81?{'count':_0x3494b3,'rows':_0xfddb81}:null;}})[_0x9dce('0x1f')](respondWithResult(_0xc1fbc8,null))['catch'](handleError(_0xc1fbc8,null));};exports[_0x9dce('0xdf')]=function(_0x25691e,_0x2e1fe0){var _0x458f17={'raw':!![],'where':{}};var _0x1f1d9b={};var _0x3f243c={'count':0x0,'rows':[]};return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x25691e['params']['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x2e1fe0,null))[_0x9dce('0x1f')](function(_0x3e7b0f){if(_0x3e7b0f){_0x1f1d9b[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['VoiceRecording'][_0x9dce('0x3c')]);_0x1f1d9b['query']=_[_0x9dce('0xd1')](_0x25691e[_0x9dce('0x46')]);_0x1f1d9b[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x1f1d9b[_0x9dce('0xd5')],_0x1f1d9b['query']);_0x458f17['attributes']=_[_0x9dce('0xd4')](_0x1f1d9b[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x25691e[_0x9dce('0x46')]['fields']));_0x458f17['attributes']=_0x458f17['attributes'][_0x9dce('0x4f')]?_0x458f17[_0x9dce('0x4b')]:_0x1f1d9b[_0x9dce('0xd5')];if(!_0x25691e[_0x9dce('0x46')][_0x9dce('0xcb')]('nolimit')){_0x458f17[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x25691e[_0x9dce('0x46')][_0x9dce('0x18')]);_0x458f17[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x25691e['query'][_0x9dce('0x1b')]);}_0x458f17[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x25691e[_0x9dce('0x46')]['sort']);_0x458f17['where']=qs['filters'](_[_0x9dce('0xdb')](_0x25691e['query'],_0x1f1d9b['filters']));_0x458f17['where'][_0x9dce('0xe0')]=_0x3e7b0f['id'];if(_0x25691e[_0x9dce('0x46')][_0x9dce('0x32')]){_0x458f17[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x458f17['where'],{'$or':_[_0x9dce('0x33')](_0x458f17[_0x9dce('0x4b')],function(_0x145b0e){var _0x3fe347={};_0x3fe347[_0x145b0e]={'$like':'%'+_0x25691e[_0x9dce('0x46')]['filter']+'%'};return _0x3fe347;})});}_0x458f17=_['merge']({},_0x458f17,_0x25691e['options']);return db[_0x9dce('0xe1')][_0x9dce('0x1a')]({'where':_0x458f17['where']})[_0x9dce('0x1f')](function(_0x2e8343){_0x3f243c[_0x9dce('0x1a')]=_0x2e8343;if(_0x25691e[_0x9dce('0x46')]['includeAll']){_0x458f17[_0x9dce('0x47')]=[{'all':!![]}];}return db[_0x9dce('0xe1')][_0x9dce('0x88')](_0x458f17);})[_0x9dce('0x1f')](function(_0x5001a5){_0x3f243c[_0x9dce('0x4d')]=_0x5001a5;return _0x3f243c;});}})['then'](respondWithFilteredResult(_0x2e1fe0,_0x458f17))['catch'](handleError(_0x2e1fe0,null));};exports['getScreenRecordings']=function(_0x4ae6bd,_0x23bf1b){var _0x5bcad5={'raw':!![],'where':{}};var _0x25d6a8={};var _0x517933={'count':0x0,'rows':[]};return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x4ae6bd[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x23bf1b,null))['then'](function(_0x1ce1b2){if(_0x1ce1b2){_0x25d6a8['model']=_['keys'](db[_0x9dce('0xe2')][_0x9dce('0x3c')]);_0x25d6a8[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x4ae6bd[_0x9dce('0x46')]);_0x25d6a8[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x25d6a8[_0x9dce('0xd5')],_0x25d6a8[_0x9dce('0x46')]);_0x5bcad5['attributes']=_[_0x9dce('0xd4')](_0x25d6a8['model'],qs[_0x9dce('0xd6')](_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x5bcad5[_0x9dce('0x4b')]=_0x5bcad5[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x5bcad5[_0x9dce('0x4b')]:_0x25d6a8[_0x9dce('0xd5')];if(!_0x4ae6bd['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x5bcad5['limit']=qs[_0x9dce('0x18')](_0x4ae6bd[_0x9dce('0x46')]['limit']);_0x5bcad5[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x1b')]);}_0x5bcad5['order']=qs['sort'](_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x5bcad5[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x4ae6bd['query'],_0x25d6a8[_0x9dce('0xd3')]));_0x5bcad5['where']['UserId']=_0x1ce1b2['id'];if(_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x32')]){_0x5bcad5[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x5bcad5['where'],{'$or':_[_0x9dce('0x33')](_0x5bcad5['attributes'],function(_0x45c68b){var _0x596a80={};_0x596a80[_0x45c68b]={'$like':'%'+_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x596a80;})});}_0x5bcad5=_[_0x9dce('0x59')]({},_0x5bcad5,_0x4ae6bd['options']);return db['ScreenRecording'][_0x9dce('0x1a')]({'where':_0x5bcad5[_0x9dce('0x45')]})[_0x9dce('0x1f')](function(_0x220586){_0x517933['count']=_0x220586;if(_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x58')]){_0x5bcad5[_0x9dce('0x47')]=[{'all':!![]}];}return db[_0x9dce('0xe2')]['findAll'](_0x5bcad5);})[_0x9dce('0x1f')](function(_0x31a5a7){_0x517933[_0x9dce('0x4d')]=_0x31a5a7;return _0x517933;});}})[_0x9dce('0x1f')](respondWithFilteredResult(_0x23bf1b,_0x5bcad5))[_0x9dce('0x5c')](handleError(_0x23bf1b,null));};exports[_0x9dce('0xe3')]=function(_0x367799,_0x31880d){var _0x4c7d5e={};var _0x5dcbc2={};var _0x56d6b5;var _0x5bf349;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x367799[_0x9dce('0x57')]['id']}})['then'](handleEntityNotFound(_0x31880d,null))[_0x9dce('0x1f')](function(_0x36c501){if(_0x36c501){_0x56d6b5=_0x36c501;_0x5dcbc2[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db[_0x9dce('0xe4')][_0x9dce('0x3c')]);_0x5dcbc2['query']=_[_0x9dce('0xd1')](_0x367799[_0x9dce('0x46')]);_0x5dcbc2[_0x9dce('0xd3')]=_['intersection'](_0x5dcbc2[_0x9dce('0xd5')],_0x5dcbc2[_0x9dce('0x46')]);_0x4c7d5e[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x5dcbc2[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x367799[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x4c7d5e[_0x9dce('0x4b')]=_0x4c7d5e['attributes'][_0x9dce('0x4f')]?_0x4c7d5e[_0x9dce('0x4b')]:_0x5dcbc2[_0x9dce('0xd5')];_0x4c7d5e['order']=qs[_0x9dce('0xd7')](_0x367799['query'][_0x9dce('0xd7')]);_0x4c7d5e[_0x9dce('0x45')]=qs['filters'](_[_0x9dce('0xdb')](_0x367799[_0x9dce('0x46')],_0x5dcbc2[_0x9dce('0xd3')]));if(_0x367799['query'][_0x9dce('0x32')]){_0x4c7d5e[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x4c7d5e[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x4c7d5e[_0x9dce('0x4b')],function(_0x118e9e){var _0x188832={};_0x188832[_0x118e9e]={'$like':'%'+_0x367799[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x188832;})});}_0x4c7d5e=_[_0x9dce('0x59')]({},_0x4c7d5e,_0x367799['options']);return _0x56d6b5[_0x9dce('0xe3')](_0x4c7d5e);}})[_0x9dce('0x1f')](function(_0x5df411){if(_0x5df411){_0x5bf349=_0x5df411[_0x9dce('0x4f')];if(!_0x367799[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x4c7d5e[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x367799[_0x9dce('0x46')][_0x9dce('0x18')]);_0x4c7d5e[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x367799[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x56d6b5[_0x9dce('0xe3')](_0x4c7d5e);}})['then'](function(_0x3d02b4){if(_0x3d02b4){return _0x3d02b4?{'count':_0x5bf349,'rows':_0x3d02b4}:null;}})['then'](respondWithResult(_0x31880d,null))[_0x9dce('0x5c')](handleError(_0x31880d,null));};exports[_0x9dce('0xe5')]=function(_0x304dff,_0x27c27a){var _0x159aa7={};var _0x5436ac={};var _0x66f36a;var _0x5cf29c;return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x304dff[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x27c27a,null))[_0x9dce('0x1f')](function(_0x48582a){if(_0x48582a){_0x66f36a=_0x48582a;_0x5436ac[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['OpenchannelInteraction']['rawAttributes']);_0x5436ac[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x304dff[_0x9dce('0x46')]);_0x5436ac[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x5436ac[_0x9dce('0xd5')],_0x5436ac[_0x9dce('0x46')]);_0x159aa7['attributes']=_['intersection'](_0x5436ac[_0x9dce('0xd5')],qs['fields'](_0x304dff['query']['fields']));_0x159aa7[_0x9dce('0x4b')]=_0x159aa7[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x159aa7[_0x9dce('0x4b')]:_0x5436ac[_0x9dce('0xd5')];_0x159aa7[_0x9dce('0xda')]=qs['sort'](_0x304dff[_0x9dce('0x46')]['sort']);_0x159aa7[_0x9dce('0x45')]=qs['filters'](_['pick'](_0x304dff[_0x9dce('0x46')],_0x5436ac[_0x9dce('0xd3')]));if(_0x304dff['query'][_0x9dce('0x32')]){_0x159aa7[_0x9dce('0x45')]=_['merge'](_0x159aa7[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x159aa7['attributes'],function(_0x8252d9){var _0x4d2833={};_0x4d2833[_0x8252d9]={'$like':'%'+_0x304dff['query'][_0x9dce('0x32')]+'%'};return _0x4d2833;})});}_0x159aa7=_[_0x9dce('0x59')]({},_0x159aa7,_0x304dff[_0x9dce('0x5a')]);return _0x66f36a['getOpenchannelInteractions'](_0x159aa7);}})['then'](function(_0x5bb345){if(_0x5bb345){_0x5cf29c=_0x5bb345[_0x9dce('0x4f')];if(!_0x304dff['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x159aa7[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x304dff[_0x9dce('0x46')][_0x9dce('0x18')]);_0x159aa7['offset']=qs['offset'](_0x304dff[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x66f36a[_0x9dce('0xe5')](_0x159aa7);}})[_0x9dce('0x1f')](function(_0x4fb5f2){if(_0x4fb5f2){return _0x4fb5f2?{'count':_0x5cf29c,'rows':_0x4fb5f2}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x27c27a,null))[_0x9dce('0x5c')](handleError(_0x27c27a,null));};exports[_0x9dce('0xe6')]=function(_0x5585d6,_0x40a661){var _0x11a263={'raw':!![],'where':{}};var _0x5bf695={};var _0x362dde={'count':0x0,'rows':[]};return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x5585d6[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x40a661,null))['then'](function(_0x147d12){if(_0x147d12){_0x5bf695['model']=_[_0x9dce('0xd1')](db[_0x9dce('0xe7')]['rawAttributes']);_0x5bf695[_0x9dce('0x46')]=_['keys'](_0x5585d6['query']);_0x5bf695[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x5bf695[_0x9dce('0xd5')],_0x5bf695[_0x9dce('0x46')]);_0x11a263[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x5bf695[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x5585d6[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x11a263[_0x9dce('0x4b')]=_0x11a263['attributes'][_0x9dce('0x4f')]?_0x11a263[_0x9dce('0x4b')]:_0x5bf695[_0x9dce('0xd5')];if(!_0x5585d6['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x11a263[_0x9dce('0x18')]=qs['limit'](_0x5585d6[_0x9dce('0x46')][_0x9dce('0x18')]);_0x11a263[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x5585d6[_0x9dce('0x46')]['offset']);}_0x11a263[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x5585d6['query'][_0x9dce('0xd7')]);_0x11a263[_0x9dce('0x45')]=qs['filters'](_[_0x9dce('0xdb')](_0x5585d6[_0x9dce('0x46')],_0x5bf695[_0x9dce('0xd3')]));_0x11a263[_0x9dce('0x45')][_0x9dce('0xe0')]=_0x147d12['id'];if(_0x5585d6[_0x9dce('0x46')]['filter']){_0x11a263[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x11a263[_0x9dce('0x45')],{'$or':_['map'](_0x11a263[_0x9dce('0x4b')],function(_0x303efb){var _0x1a4daa={};_0x1a4daa[_0x303efb]={'$like':'%'+_0x5585d6['query'][_0x9dce('0x32')]+'%'};return _0x1a4daa;})});}_0x11a263=_[_0x9dce('0x59')]({},_0x11a263,_0x5585d6[_0x9dce('0x5a')]);return db[_0x9dce('0xe7')][_0x9dce('0x1a')]({'where':_0x11a263['where']})['then'](function(_0x3c4f43){_0x362dde[_0x9dce('0x1a')]=_0x3c4f43;if(_0x5585d6[_0x9dce('0x46')]['includeAll']){_0x11a263['include']=[{'all':!![]}];}return db[_0x9dce('0xe7')][_0x9dce('0x88')](_0x11a263);})[_0x9dce('0x1f')](function(_0x1185a9){_0x362dde[_0x9dce('0x4d')]=_0x1185a9;return _0x362dde;});}})[_0x9dce('0x1f')](respondWithFilteredResult(_0x40a661,_0x11a263))[_0x9dce('0x5c')](handleError(_0x40a661,null));};exports['getSmsInteractions']=function(_0x5e259e,_0x2ac8dd){var _0x40ba15={};var _0x1bacbd={};var _0x3ddef6;var _0x56227f;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x5e259e[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x2ac8dd,null))[_0x9dce('0x1f')](function(_0x38bf16){if(_0x38bf16){_0x3ddef6=_0x38bf16;_0x1bacbd[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db[_0x9dce('0xe8')][_0x9dce('0x3c')]);_0x1bacbd[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x5e259e['query']);_0x1bacbd[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x1bacbd[_0x9dce('0xd5')],_0x1bacbd[_0x9dce('0x46')]);_0x40ba15[_0x9dce('0x4b')]=_['intersection'](_0x1bacbd[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x5e259e[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x40ba15[_0x9dce('0x4b')]=_0x40ba15[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x40ba15[_0x9dce('0x4b')]:_0x1bacbd['model'];_0x40ba15[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x5e259e[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x40ba15[_0x9dce('0x45')]=qs['filters'](_['pick'](_0x5e259e[_0x9dce('0x46')],_0x1bacbd[_0x9dce('0xd3')]));if(_0x5e259e[_0x9dce('0x46')][_0x9dce('0x32')]){_0x40ba15[_0x9dce('0x45')]=_['merge'](_0x40ba15['where'],{'$or':_[_0x9dce('0x33')](_0x40ba15['attributes'],function(_0x49eb30){var _0x5431e7={};_0x5431e7[_0x49eb30]={'$like':'%'+_0x5e259e['query'][_0x9dce('0x32')]+'%'};return _0x5431e7;})});}_0x40ba15=_[_0x9dce('0x59')]({},_0x40ba15,_0x5e259e[_0x9dce('0x5a')]);return _0x3ddef6['getSmsInteractions'](_0x40ba15);}})['then'](function(_0x222d63){if(_0x222d63){_0x56227f=_0x222d63[_0x9dce('0x4f')];if(!_0x5e259e[_0x9dce('0x46')][_0x9dce('0xcb')]('nolimit')){_0x40ba15[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x5e259e['query']['limit']);_0x40ba15[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x5e259e[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x3ddef6[_0x9dce('0xe9')](_0x40ba15);}})[_0x9dce('0x1f')](function(_0x44a58c){if(_0x44a58c){return _0x44a58c?{'count':_0x56227f,'rows':_0x44a58c}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x2ac8dd,null))[_0x9dce('0x5c')](handleError(_0x2ac8dd,null));};exports[_0x9dce('0xea')]=function(_0x44c47a,_0x527f0c){var _0x439be8={};var _0x30853d={};var _0xc4500e;var _0x4a0569;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x44c47a[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x527f0c,null))['then'](function(_0x358102){if(_0x358102){_0xc4500e=_0x358102;_0x30853d['model']=_[_0x9dce('0xd1')](db[_0x9dce('0xeb')]['rawAttributes']);_0x30853d[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x44c47a[_0x9dce('0x46')]);_0x30853d['filters']=_[_0x9dce('0xd4')](_0x30853d[_0x9dce('0xd5')],_0x30853d[_0x9dce('0x46')]);_0x439be8[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x30853d[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x44c47a[_0x9dce('0x46')]['fields']));_0x439be8[_0x9dce('0x4b')]=_0x439be8['attributes'][_0x9dce('0x4f')]?_0x439be8[_0x9dce('0x4b')]:_0x30853d[_0x9dce('0xd5')];_0x439be8[_0x9dce('0xda')]=qs['sort'](_0x44c47a['query']['sort']);_0x439be8[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x44c47a['query'],_0x30853d[_0x9dce('0xd3')]));if(_0x44c47a[_0x9dce('0x46')][_0x9dce('0x32')]){_0x439be8[_0x9dce('0x45')]=_['merge'](_0x439be8[_0x9dce('0x45')],{'$or':_['map'](_0x439be8[_0x9dce('0x4b')],function(_0x3aca68){var _0x1451ca={};_0x1451ca[_0x3aca68]={'$like':'%'+_0x44c47a[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x1451ca;})});}_0x439be8=_[_0x9dce('0x59')]({},_0x439be8,_0x44c47a[_0x9dce('0x5a')]);return _0xc4500e[_0x9dce('0xea')](_0x439be8);}})[_0x9dce('0x1f')](function(_0x248895){if(_0x248895){_0x4a0569=_0x248895[_0x9dce('0x4f')];if(!_0x44c47a[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0x439be8[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x44c47a['query'][_0x9dce('0x18')]);_0x439be8[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x44c47a['query'][_0x9dce('0x1b')]);}return _0xc4500e[_0x9dce('0xea')](_0x439be8);}})[_0x9dce('0x1f')](function(_0x55de21){if(_0x55de21){return _0x55de21?{'count':_0x4a0569,'rows':_0x55de21}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x527f0c,null))['catch'](handleError(_0x527f0c,null));};exports['getWhatsappInteractions']=function(_0x45d0a7,_0x463ef3){var _0x14f572={};var _0x3c6c40={};var _0x1982ab;var _0x161128;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x45d0a7[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x463ef3,null))[_0x9dce('0x1f')](function(_0x133a6a){if(_0x133a6a){_0x1982ab=_0x133a6a;_0x3c6c40['model']=_['keys'](db[_0x9dce('0xec')][_0x9dce('0x3c')]);_0x3c6c40[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x45d0a7[_0x9dce('0x46')]);_0x3c6c40[_0x9dce('0xd3')]=_['intersection'](_0x3c6c40[_0x9dce('0xd5')],_0x3c6c40[_0x9dce('0x46')]);_0x14f572[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x3c6c40[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x45d0a7[_0x9dce('0x46')]['fields']));_0x14f572['attributes']=_0x14f572[_0x9dce('0x4b')]['length']?_0x14f572[_0x9dce('0x4b')]:_0x3c6c40[_0x9dce('0xd5')];_0x14f572[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x45d0a7[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x14f572['where']=qs[_0x9dce('0xd3')](_['pick'](_0x45d0a7['query'],_0x3c6c40['filters']));if(_0x45d0a7[_0x9dce('0x46')][_0x9dce('0x32')]){_0x14f572[_0x9dce('0x45')]=_['merge'](_0x14f572[_0x9dce('0x45')],{'$or':_['map'](_0x14f572[_0x9dce('0x4b')],function(_0x116725){var _0x4a40f9={};_0x4a40f9[_0x116725]={'$like':'%'+_0x45d0a7[_0x9dce('0x46')]['filter']+'%'};return _0x4a40f9;})});}_0x14f572=_[_0x9dce('0x59')]({},_0x14f572,_0x45d0a7[_0x9dce('0x5a')]);return _0x1982ab['getWhatsappInteractions'](_0x14f572);}})[_0x9dce('0x1f')](function(_0x534e58){if(_0x534e58){_0x161128=_0x534e58[_0x9dce('0x4f')];if(!_0x45d0a7['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x14f572[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x45d0a7[_0x9dce('0x46')][_0x9dce('0x18')]);_0x14f572[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x45d0a7['query'][_0x9dce('0x1b')]);}return _0x1982ab[_0x9dce('0xed')](_0x14f572);}})['then'](function(_0x57c3e8){if(_0x57c3e8){return _0x57c3e8?{'count':_0x161128,'rows':_0x57c3e8}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x463ef3,null))[_0x9dce('0x5c')](handleError(_0x463ef3,null));};exports['login']=function(_0x581f6e,_0x2f7d19,_0x58f112){var _0x49d361;var _0x18680f;var _0x4a73da;var _0x4c0cff=!_[_0x9dce('0x67')](_0x581f6e[_0x9dce('0x57')]['id'])?_0x581f6e['params']['id']:!_[_0x9dce('0x67')](_0x581f6e[_0x9dce('0x2e')]['id'])?_0x581f6e[_0x9dce('0x2e')]['id']:null;return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x4c0cff,'role':{'$or':['admin','user',_0x9dce('0x71')]}},'attributes':['id','name','phone',_0x9dce('0xee'),_0x9dce('0x2b'),_0x9dce('0x61'),_0x9dce('0x9e')]})['then'](function(_0x140f7a){if(_0x140f7a){if(_0x140f7a[_0x9dce('0x2b')]===_0x9dce('0x71')){_0x49d361=_0x140f7a;if(_0x581f6e[_0x9dce('0x5d')]['interface']){_0x4a73da=util[_0x9dce('0xac')](_0x9dce('0xef'),_0x49d361[_0x581f6e[_0x9dce('0x5d')][_0x9dce('0xa0')]]);}else if(_0x581f6e[_0x9dce('0x5d')][_0x9dce('0xf0')]){_0x4a73da=util['format']('SIP/%s',_0x581f6e[_0x9dce('0x5d')][_0x9dce('0xf0')]);}else{_0x4a73da=util[_0x9dce('0xac')](_0x9dce('0xad'),_0x49d361[_0x9dce('0x36')]);}socket['to'](util[_0x9dce('0xac')]('user:%s',_0x49d361[_0x9dce('0x36')]))[_0x9dce('0x28')](_0x9dce('0xf1'),{'user':{'id':_0x49d361['id'],'name':_0x49d361['name']},'ip':_0x581f6e['headers'][_0x9dce('0xf2')]||_0x581f6e[_0x9dce('0xf3')]['remoteAddress']||_0x581f6e[_0x9dce('0xf4')][_0x9dce('0xf5')]||_0x581f6e['connection'][_0x9dce('0xf4')][_0x9dce('0xf5')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x49d361[_0x9dce('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0xf6'));}})[_0x9dce('0x1f')](function(){if(_0x49d361){return _0x49d361[_0x9dce('0xf7')]({'raw':!![]});}})[_0x9dce('0x1f')](function(_0x5437b2){if(_0x49d361){if(_0x5437b2){_0x18680f=_0x5437b2;if(_0x18680f[_0x9dce('0x4f')]){var _0x3c206d=_0x18680f[_0x9dce('0x33')](function(_0x482e19){var _0xc1ccf2={'membername':_0x49d361['name'],'UserId':_0x49d361['id'],'queue_name':_0x482e19[_0x9dce('0x36')],'VoiceQueueId':_0x482e19['id'],'interface':_0x4a73da,'paused':_0x49d361['loginInPause']||![],'penalty':_0x482e19[_0x9dce('0xf8')]||0x0};return db[_0x9dce('0xae')][_0x9dce('0xaf')](_0xc1ccf2);});return Promise['all'](_0x3c206d);}}}})[_0x9dce('0x1f')](function(){if(_0x49d361){return db['MemberReport'][_0x9dce('0x88')]({'where':{'membername':_0x49d361[_0x9dce('0x36')],'exitAt':null}});}})[_0x9dce('0x1f')](function(_0x5dcec4){if(_0x49d361){var _0x529766=[];_0x5dcec4[_0x9dce('0xf9')](function(_0x153df3){_0x529766[_0x9dce('0x4c')](_0x153df3[_0x9dce('0x27')]({'exitAt':moment()['format'](_0x9dce('0xfa'))}));});return Promise[_0x9dce('0x56')](_0x529766);}})[_0x9dce('0x1f')](function(){if(_0x49d361){var _0x6c7dcb=[];var _0x5f583d=[];var _0x4a2c6f=utils[_0x9dce('0xfb')]();var _0x58c740={'membername':_0x49d361['name'],'interface':_0x4a73da,'enterAt':moment()[_0x9dce('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x49d361[_0x9dce('0x2b')],'internal':_0x49d361[_0x9dce('0x61')]};_0x4a2c6f[_0x9dce('0xf9')](function(_0x317b01){_0x6c7dcb[_0x9dce('0x4c')](_[_0x9dce('0x59')]({'channel':_0x317b01,'type':_0x9dce('0xfc'),'data1':_0x581f6e['body'][_0x9dce('0xfd')],'data2':_0x4a73da},_0x58c740));if(_0x49d361['loginInPause']){_0x5f583d[_0x9dce('0x4c')](_[_0x9dce('0x59')]({'channel':_0x317b01,'type':'PAUSE','data1':_0x9dce('0xfe')},_0x58c740));}});return db['MemberReport']['bulkCreate'](_0x6c7dcb['concat'](_0x5f583d),{'individualHooks':!![]});}})[_0x9dce('0x1f')](function(){if(_0x49d361){return _0x49d361['update']({'online':!![],'lastLoginAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa')),'voicePause':_0x49d361[_0x9dce('0x9e')]||![],'mailPause':_0x49d361[_0x9dce('0x9e')]||![],'chatPause':_0x49d361[_0x9dce('0x9e')]||![],'faxPause':_0x49d361[_0x9dce('0x9e')]||![],'smsPause':_0x49d361[_0x9dce('0x9e')]||![],'openchannelPause':_0x49d361['loginInPause']||![],'whatsappPause':_0x49d361[_0x9dce('0x9e')]||![],'pauseType':_0x49d361['loginInPause']?'LOGININPAUSE':null,'interface':_0x4a73da,'lastPauseAt':moment()['format'](_0x9dce('0xfa'))});}})[_0x9dce('0x1f')](function(_0x5c3569){if(_0x581f6e[_0x9dce('0xff')]){return _0x58f112();}else{return Promise[_0x9dce('0x100')](_0x5c3569)[_0x9dce('0x1f')](respondWithResult(_0x2f7d19,null));}})['catch'](handleError(_0x2f7d19,null));};exports['logout']=function(_0x4ea020,_0xbcdabd){var _0x1a5f9e;return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x4ea020[_0x9dce('0x57')]['id'],'role':_0x9dce('0x71')},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b')]})[_0x9dce('0x1f')](handleEntityNotFound(_0xbcdabd,null))[_0x9dce('0x1f')](function(_0x42234f){if(_0x42234f){_0x1a5f9e=_0x42234f;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1a5f9e[_0x9dce('0x36')]},'individualHooks':!![]});}})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x101')][_0x9dce('0x88')]({'where':{'membername':_0x1a5f9e[_0x9dce('0x36')],'exitAt':null}});})[_0x9dce('0x1f')](function(_0x30af86){var _0xb99f4f=[];_0x30af86[_0x9dce('0xf9')](function(_0x2e940d){_0xb99f4f[_0x9dce('0x4c')](_0x2e940d[_0x9dce('0x27')]({'exitAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa'))}));});return Promise[_0x9dce('0x56')](_0xb99f4f);})[_0x9dce('0x1f')](function(){return _0x1a5f9e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9dce('0x1f')](respondWithResult(_0xbcdabd,null))['catch'](handleError(_0xbcdabd,null));};exports['pause']=function(_0x55befb,_0x3d5986){var _0x304ba9;return db[_0x9dce('0xae')][_0x9dce('0x27')]({'paused':0x1},{'where':{'UserId':_0x55befb['params']['id']},'individualHooks':!![]})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x55befb[_0x9dce('0x57')]['id'],'role':'agent'},'attributes':['id',_0x9dce('0x36'),'role',_0x9dce('0x61'),_0x9dce('0xa0'),_0x9dce('0x9d')]});})[_0x9dce('0x1f')](handleEntityNotFound(_0x3d5986,null))[_0x9dce('0x1f')](function(_0x3b3549){if(_0x3b3549){_0x304ba9=_0x3b3549;return respondWithRpcPromise('QueuePause',_0x9dce('0x102'),{'id':_0x304ba9['id'],'name':_0x304ba9[_0x9dce('0x36')],'pause':!![]});}})[_0x9dce('0x1f')](function(){if(_0x304ba9){return db[_0x9dce('0x101')][_0x9dce('0x88')]({'where':{'membername':_0x304ba9[_0x9dce('0x36')],'type':_0x9dce('0x103'),'exitAt':null}});}})[_0x9dce('0x1f')](function(_0xab22){if(_0xab22[_0x9dce('0x4f')]){var _0x3606f1=moment()[_0x9dce('0xac')](_0x9dce('0xfa'));for(var _0x4439bf=0x0,_0xa61e73=_0xab22['length'];_0x4439bf<_0xa61e73;_0x4439bf++){_0xab22[_0x4439bf]['updateAttributes']({'exitAt':_0x3606f1});}}})[_0x9dce('0x1f')](function(){var _0x4d3042=[];var _0x588e7a=utils[_0x9dce('0xfb')]();_0x588e7a['forEach'](function(_0x5bedf2){_0x4d3042['push']({'channel':_0x5bedf2,'membername':_0x304ba9['name'],'interface':_[_0x9dce('0x67')](_0x304ba9[_0x9dce('0xa0')])?util['format'](_0x9dce('0xad'),_0x304ba9['name']):_0x304ba9[_0x9dce('0xa0')],'type':_0x9dce('0x103'),'enterAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa')),'data1':_0x55befb['body'][_0x9dce('0x3e')]||_0x9dce('0x104'),'role':_0x304ba9[_0x9dce('0x2b')],'internal':_0x304ba9[_0x9dce('0x61')]});});return db[_0x9dce('0x101')]['bulkCreate'](_0x4d3042,{'individualHooks':!![]});})[_0x9dce('0x1f')](function(){return _0x304ba9[_0x9dce('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x55befb[_0x9dce('0x5d')][_0x9dce('0x3e')]||_0x9dce('0x104'),'lastPauseAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa'))});})[_0x9dce('0x1f')](respondWithResult(_0x3d5986,null))[_0x9dce('0x5c')](handleError(_0x3d5986,null));};exports[_0x9dce('0x105')]=function(_0x48df54,_0x42e173){if(_0x48df54[_0x9dce('0x5d')][_0x9dce('0x9c')]&&!utils[_0x9dce('0xa1')](_0x48df54['body'][_0x9dce('0x9c')])){throw new APIBadRequestError(util[_0x9dce('0xac')](_0x9dce('0x106'),_0x48df54[_0x9dce('0x5d')]['channel']));}return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x48df54['params']['id']},'attributes':['id',_0x9dce('0x36'),'role','internal',_0x9dce('0xa0'),_0x9dce('0x9d'),_0x9dce('0x9f'),_0x9dce('0x107'),_0x9dce('0x108'),_0x9dce('0x109'),'openchannelPause',_0x9dce('0x10a'),_0x9dce('0x10b'),_0x9dce('0x10c'),_0x9dce('0x10d')]})[_0x9dce('0x1f')](function(_0x240fa5){if(!_0x240fa5){throw new APINotFoundError(util[_0x9dce('0xac')](_0x9dce('0x10e'),_0x48df54[_0x9dce('0x57')]['id']));}return _0x240fa5[_0x9dce('0x105')](_0x48df54['body'][_0x9dce('0x9c')]);})['then'](respondWithResult(_0x42e173,null))[_0x9dce('0x5c')](APIHandleError(_0x42e173));};exports['getTeams']=function(_0x2e3db5,_0x151f93){var _0x345ea7={};var _0x3a7129={};var _0x466079;var _0x319699;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x2e3db5[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x151f93,null))['then'](function(_0x258f59){if(_0x258f59){_0x466079=_0x258f59;_0x3a7129['model']=_[_0x9dce('0xd1')](db[_0x9dce('0x10f')][_0x9dce('0x3c')]);_0x3a7129[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x2e3db5['query']);_0x3a7129[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x3a7129['model'],_0x3a7129[_0x9dce('0x46')]);_0x345ea7[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x3a7129['model'],qs['fields'](_0x2e3db5[_0x9dce('0x46')]['fields']));_0x345ea7[_0x9dce('0x4b')]=_0x345ea7[_0x9dce('0x4b')]['length']?_0x345ea7[_0x9dce('0x4b')]:_0x3a7129[_0x9dce('0xd5')];_0x345ea7[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x2e3db5['query'][_0x9dce('0xd7')]);_0x345ea7['where']=qs[_0x9dce('0xd3')](_['pick'](_0x2e3db5['query'],_0x3a7129[_0x9dce('0xd3')]));if(_0x2e3db5[_0x9dce('0x46')][_0x9dce('0x32')]){_0x345ea7[_0x9dce('0x45')]=_['merge'](_0x345ea7[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x345ea7[_0x9dce('0x4b')],function(_0x2ccceb){var _0x36a064={};_0x36a064[_0x2ccceb]={'$like':'%'+_0x2e3db5[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x36a064;})});}_0x345ea7=_[_0x9dce('0x59')]({},_0x345ea7,_0x2e3db5[_0x9dce('0x5a')]);return _0x466079[_0x9dce('0x110')](_0x345ea7);}})[_0x9dce('0x1f')](function(_0x39be1c){if(_0x39be1c){_0x319699=_0x39be1c[_0x9dce('0x4f')];if(!_0x2e3db5[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x345ea7[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x2e3db5['query']['limit']);_0x345ea7['offset']=qs[_0x9dce('0x1b')](_0x2e3db5[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x466079[_0x9dce('0x110')](_0x345ea7);}})[_0x9dce('0x1f')](function(_0x1d6517){if(_0x1d6517){return _0x1d6517?{'count':_0x319699,'rows':_0x1d6517}:null;}})['then'](respondWithResult(_0x151f93,null))[_0x9dce('0x5c')](handleError(_0x151f93,null));};exports[_0x9dce('0x111')]=function(_0x489ddf,_0x971343){var _0x38e849=_0x489ddf['params']['id'];var _0x4a7501=_0x489ddf[_0x9dce('0x5d')]?_0x489ddf[_0x9dce('0x5d')][_0x9dce('0x60')]:null;var _0x444aa1=[];return Promise[_0x9dce('0x100')]()[_0x9dce('0x1f')](function(){if(!_0x4a7501)throw new APIBadRequestError(_0x9dce('0x112'));})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x38e849}});})[_0x9dce('0x1f')](function(_0x179e61){if(!_0x179e61)throw new APINotFoundError(util[_0x9dce('0xac')](_0x9dce('0x10e'),_0x489ddf[_0x9dce('0x57')]['id']));return db['sequelize'][_0x9dce('0x113')](function(_0x47abc3){return _0x179e61[_0x9dce('0x111')](_0x4a7501,{'transaction':_0x47abc3})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x10f')][_0x9dce('0x88')]({'where':{'id':{'$in':_0x4a7501}}});})[_0x9dce('0x1f')](function(_0x267066){var _0x54258d=_[_0x9dce('0x33')](_0x267066,function(_0x159229){return _0x159229[_0x9dce('0x114')]();});return Promise[_0x9dce('0x56')](_0x54258d);})[_0x9dce('0x1f')](function(_0x4a651b){_0x444aa1=_[_0x9dce('0x115')](_0x4a651b);var _0xd03036=_[_0x9dce('0x33')](_0x444aa1,function(_0x329543){return _0x329543['addAgent'](_0x179e61['id'],{'transaction':_0x47abc3});});return Promise['all'](_0xd03036);})[_0x9dce('0x1f')](function(){if(!_0x179e61[_0x9dce('0x9d')])return;var _0x39964d=_[_0x9dce('0x32')](_0x444aa1,function(_0x44bea2){return _0x44bea2['getDataValue'](_0x9dce('0x9c'))==='Voice';});var _0x1afdde=_[_0x9dce('0x33')](_0x39964d,function(_0x4aa3d4){return db[_0x9dce('0xae')][_0x9dce('0xaf')]({'membername':_0x179e61[_0x9dce('0x36')],'UserId':_0x179e61['id'],'queue_name':_0x4aa3d4['name'],'VoiceQueueId':_0x4aa3d4['id'],'interface':_['isNil'](_0x179e61[_0x9dce('0xa0')])?util[_0x9dce('0xac')](_0x9dce('0xad'),_0x179e61['name']):_0x179e61[_0x9dce('0xa0')],'paused':_0x179e61[_0x9dce('0x9f')]||![],'penalty':_0x179e61['penalty']},{'transaction':_0x47abc3});});return Promise[_0x9dce('0x56')](_0x1afdde);})['then'](function(){return db[_0x9dce('0x116')][_0x9dce('0x88')]({'where':{'teamId':{'$in':_0x4a7501}}});})[_0x9dce('0x1f')](function(_0x26ba22){var _0x4ed813=_[_0x9dce('0x33')](_0x26ba22,function(_0xebabad){return db[_0x9dce('0x117')]['create']({'UserId':_0x179e61['id'],'VoicePrefixId':_0xebabad['VoicePrefixId']},{'transaction':_0x47abc3});});return Promise[_0x9dce('0x56')](_0x4ed813);});});})[_0x9dce('0x1f')](function(){for(var _0x48720f=0x0;_0x48720f<_0x444aa1[_0x9dce('0x4f')];_0x48720f++){var _0x21673e=_0x444aa1[_0x48720f][_0x9dce('0x118')](_0x9dce('0x9c'));var _0x201ca4=_0x21673e+_0x9dce('0xb4');socket['emit'](_0x9dce('0x2e')+_0x21673e+'Queue:save',{'UserId':_0x38e849,['queueField']:_0x444aa1[_0x48720f]['id']});}})[_0x9dce('0x1f')](respondWithStatusCode(_0x971343,null))['catch'](APIHandleError(_0x971343));};exports[_0x9dce('0x119')]=function(_0x4ff852,_0x246fa){var _0x1da246=_0x4ff852[_0x9dce('0x57')]['id'];var _0x296a3f=null;if(_0x4ff852['query'][_0x9dce('0x60')]){_0x296a3f=_[_0x9dce('0xb2')](_0x4ff852[_0x9dce('0x46')][_0x9dce('0x60')])?_0x4ff852[_0x9dce('0x46')][_0x9dce('0x60')]:[_0x4ff852[_0x9dce('0x46')]['ids']];}var _0x3446c2=[];return Promise[_0x9dce('0x100')]()[_0x9dce('0x1f')](function(){if(!_0x296a3f)throw new APIBadRequestError(_0x9dce('0x11a'));})['then'](function(){return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x1da246}});})[_0x9dce('0x1f')](function(_0x2cfdcb){if(!_0x2cfdcb)throw new APINotFoundError(util['format'](_0x9dce('0x10e'),_0x4ff852[_0x9dce('0x57')]['id']));return db[_0x9dce('0x69')][_0x9dce('0x113')](function(_0x11fb11){return _0x2cfdcb[_0x9dce('0x119')](_0x296a3f,{'transaction':_0x11fb11})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x10f')][_0x9dce('0x88')]({'where':{'id':{'$in':_0x296a3f}}});})[_0x9dce('0x1f')](function(_0x2ba1dc){var _0x4ab995=_['map'](_0x2ba1dc,function(_0x4dceec){return _0x4dceec[_0x9dce('0x114')]();});return Promise[_0x9dce('0x56')](_0x4ab995);})[_0x9dce('0x1f')](function(_0x143ae8){_0x3446c2=_[_0x9dce('0x115')](_0x143ae8);var _0x200ab2=_[_0x9dce('0x33')](_0x3446c2,function(_0x535d45){return _0x535d45['removeAgent'](_0x2cfdcb['id'],{'transaction':_0x11fb11});});return Promise['all'](_0x200ab2);})[_0x9dce('0x1f')](function(){if(!_0x2cfdcb[_0x9dce('0x9d')])return;var _0x155e19=_[_0x9dce('0x32')](_0x3446c2,function(_0x40534a){return _0x40534a['getDataValue'](_0x9dce('0x9c'))===_0x9dce('0x11b');});var _0x104e9a=_[_0x9dce('0x33')](_0x155e19,function(_0x29e643){return db[_0x9dce('0xae')]['destroy']({'where':{'VoiceQueueId':_0x29e643['id'],'UserId':_0x2cfdcb['id']},'transaction':_0x11fb11});});return Promise[_0x9dce('0x56')](_0x104e9a);})['then'](function(){return db['TeamVoicePrefix'][_0x9dce('0x88')]({'where':{'teamId':{'$in':_0x296a3f}}});})[_0x9dce('0x1f')](function(_0x1b6c9b){var _0x23c5a0=_[_0x9dce('0x33')](_0x1b6c9b,function(_0x5eb926){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2cfdcb['id'],'VoicePrefixId':_0x5eb926[_0x9dce('0x11c')]}},{'transaction':_0x11fb11});});return Promise['all'](_0x23c5a0);});});})[_0x9dce('0x1f')](function(){for(var _0x54f008=0x0;_0x54f008<_0x3446c2[_0x9dce('0x4f')];_0x54f008++){var _0x5b8939=_0x3446c2[_0x54f008][_0x9dce('0x118')]('channel');var _0x3fed28=_0x5b8939+'QueueId';socket[_0x9dce('0x28')](_0x9dce('0x2e')+_0x5b8939+_0x9dce('0xb3'),{'UserId':_0x1da246,['queueField']:_0x3446c2[_0x54f008]['id']});}})['then'](respondWithStatusCode(_0x246fa,null))[_0x9dce('0x5c')](APIHandleError(_0x246fa));};exports[_0x9dce('0x11d')]=function(_0x2be563,_0xc5fd95){var _0x41f27b={};var _0x128414={};var _0xe46357;var _0x38408f;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x2be563[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0xc5fd95,null))[_0x9dce('0x1f')](function(_0x23feda){if(_0x23feda){_0xe46357=_0x23feda;_0x128414[_0x9dce('0xd5')]=_['keys'](db[_0x9dce('0xcc')]['rawAttributes']);_0x128414[_0x9dce('0x46')]=_['keys'](_0x2be563[_0x9dce('0x46')]);_0x128414[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x128414['model'],_0x128414[_0x9dce('0x46')]);_0x41f27b['attributes']=_[_0x9dce('0xd4')](_0x128414['model'],qs['fields'](_0x2be563[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x41f27b['attributes']=_0x41f27b[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x41f27b[_0x9dce('0x4b')]:_0x128414['model'];_0x41f27b['order']=qs[_0x9dce('0xd7')](_0x2be563[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x41f27b[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x2be563[_0x9dce('0x46')],_0x128414[_0x9dce('0xd3')]));if(_0x2be563[_0x9dce('0x46')]['filter']){_0x41f27b[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x41f27b[_0x9dce('0x45')],{'$or':_['map'](_0x41f27b[_0x9dce('0x4b')],function(_0x73df50){var _0x540902={};_0x540902[_0x73df50]={'$like':'%'+_0x2be563[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x540902;})});}_0x41f27b=_['merge']({},_0x41f27b,_0x2be563['options']);return _0xe46357['getLists'](_0x41f27b);}})[_0x9dce('0x1f')](function(_0x26de41){if(_0x26de41){_0x38408f=_0x26de41[_0x9dce('0x4f')];if(!_0x2be563[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0x41f27b[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x2be563['query'][_0x9dce('0x18')]);_0x41f27b['offset']=qs['offset'](_0x2be563[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0xe46357[_0x9dce('0x11d')](_0x41f27b);}})[_0x9dce('0x1f')](function(_0x34c770){if(_0x34c770){return _0x34c770?{'count':_0x38408f,'rows':_0x34c770}:null;}})[_0x9dce('0x1f')](respondWithResult(_0xc5fd95,null))['catch'](handleError(_0xc5fd95,null));};exports[_0x9dce('0x11e')]=function(_0x528265,_0x3bcd5f){var _0x2f2e0a={};var _0x4c5bc5={};var _0x574835;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x528265[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x3bcd5f,null))[_0x9dce('0x1f')](function(_0x2ccc03){if(_0x2ccc03){_0x574835=_0x2ccc03;_0x4c5bc5[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['User'][_0x9dce('0x3c')]);_0x4c5bc5['query']=_['keys'](_0x528265[_0x9dce('0x46')]);_0x4c5bc5[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x4c5bc5[_0x9dce('0xd5')],_0x4c5bc5[_0x9dce('0x46')]);_0x2f2e0a['attributes']=_['intersection'](_0x4c5bc5['model'],qs[_0x9dce('0xd6')](_0x528265[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x2f2e0a['attributes']=_0x2f2e0a[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x2f2e0a[_0x9dce('0x4b')]:_0x4c5bc5[_0x9dce('0xd5')];_0x2f2e0a[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x528265['query'][_0x9dce('0xd7')]);_0x2f2e0a[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x528265[_0x9dce('0x46')],_0x4c5bc5[_0x9dce('0xd3')]));if(_0x528265[_0x9dce('0x46')][_0x9dce('0x32')]){_0x2f2e0a[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x2f2e0a[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x2f2e0a[_0x9dce('0x4b')],function(_0xcda9dc){var _0x3593e8={};_0x3593e8[_0xcda9dc]={'$like':'%'+_0x528265[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x3593e8;})});}_0x2f2e0a['model']=db[_0x9dce('0x3b')];_0x2f2e0a['as']='Agents';_0x2f2e0a=_[_0x9dce('0x59')]({},_0x2f2e0a,_0x528265[_0x9dce('0x5a')]);return _0x574835[_0x9dce('0xf7')]({'include':[_0x2f2e0a]});}})[_0x9dce('0x1f')](function(_0x48e9d3){if(_0x48e9d3){var _0x559846={},_0x5f20da=[];for(var _0x1073a6=0x0;_0x1073a6<_0x48e9d3[_0x9dce('0x4f')];_0x1073a6+=0x1){for(var _0x2fe3eb=0x0,_0x184df7;_0x2fe3eb<_0x48e9d3[_0x1073a6][_0x9dce('0x2f')]['length'];_0x2fe3eb+=0x1){_0x184df7=_0x48e9d3[_0x1073a6]['Agents'][_0x2fe3eb]['get']({'plain':!![]});_0x559846[_0x184df7['id']]=_0x184df7;}}_0x559846=_[_0x9dce('0x11f')](_0x559846);for(var _0x2a7c80=qs[_0x9dce('0x1b')](_0x528265['query'][_0x9dce('0x1b')]);_0x2a7c80<_0x559846[_0x9dce('0x4f')]&&_0x5f20da[_0x9dce('0x4f')]=_0x1377c5[_0x85df('0x4f')]){throw new Error(_0x85df('0x50'));}})[_0x85df('0x17')](function(){if(_0x20d50a){return db[_0x85df('0x45')]['destroy']({'where':{'membername':_0x20d50a[_0x85df('0x28')]},'individualHooks':!![]});}})[_0x85df('0x17')](function(){if(_0x20d50a){return _0x20d50a[_0x85df('0x51')]({'raw':!![]});}})[_0x85df('0x17')](function(_0xf74307){if(_0x20d50a){if(_0xf74307){var _0x3dfb37=[];_0x3cd5c1=_0xf74307;if(_0x3cd5c1['length']){for(var _0xffc053=0x0;_0xffc053<_0x3cd5c1[_0x85df('0x2c')];_0xffc053++){_0x3dfb37['push'](db[_0x85df('0x45')]['upsert']({'membername':_0x20d50a[_0x85df('0x28')],'UserId':_0x20d50a['id'],'queue_name':_0x3cd5c1[_0xffc053][_0x85df('0x28')],'VoiceQueueId':_0x3cd5c1[_0xffc053]['id'],'interface':_0x5a5ec2,'paused':_0x20d50a[_0x85df('0x4b')]||![],'penalty':_0x3cd5c1[_0xffc053][_0x85df('0x52')]||0x0}));}return BPromise['all'](_0x3dfb37);}}}})[_0x85df('0x17')](function(){if(_0x20d50a){return db[_0x85df('0x27')][_0x85df('0xe')]({'where':{'membername':_0x20d50a[_0x85df('0x28')],'exitAt':null}});}})[_0x85df('0x17')](function(_0x17c822){if(_0x20d50a){if(_0x17c822&&_0x17c822['length']){var _0x223730=[];_0x17c822[_0x85df('0x47')](function(_0x3b1c29){_0x223730[_0x85df('0x2e')](_0x3b1c29[_0x85df('0x26')]({'exitAt':moment()[_0x85df('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x223730);}}})[_0x85df('0x17')](function(){if(_0x20d50a){var _0x2d2d98=[];var _0x1afea7=[];var _0x4f2d90=utils[_0x85df('0x2d')]();var _0x2ed347={'membername':_0x20d50a['name'],'interface':_0x5a5ec2,'enterAt':moment()['format'](_0x85df('0x2b')),'role':_0x20d50a[_0x85df('0x21')],'internal':_0x20d50a[_0x85df('0x22')]};_0x4f2d90[_0x85df('0x47')](function(_0x4bad79){_0x2d2d98[_0x85df('0x2e')](_[_0x85df('0x53')]({'channel':_0x4bad79,'type':_0x85df('0x54'),'data1':_0x85df('0x55'),'data2':_0x5a5ec2},_0x2ed347));if(_0x20d50a[_0x85df('0x4b')]){_0x1afea7['push'](_[_0x85df('0x53')]({'channel':_0x4bad79,'type':_0x85df('0x29'),'data1':'LOGININPAUSE'},_0x2ed347));}});return db[_0x85df('0x27')]['bulkCreate'](_0x2d2d98[_0x85df('0x56')](_0x1afea7),{'individualHooks':!![]});}})[_0x85df('0x17')](function(){if(_0x20d50a){return _0x20d50a[_0x85df('0x26')]({'online':!![],'lastLoginAt':moment()[_0x85df('0x2a')](_0x85df('0x2b')),'voicePause':_0x20d50a[_0x85df('0x4b')]||![],'mailPause':_0x20d50a[_0x85df('0x4b')]||![],'chatPause':_0x20d50a[_0x85df('0x4b')]||![],'faxPause':_0x20d50a[_0x85df('0x4b')]||![],'smsPause':_0x20d50a[_0x85df('0x4b')]||![],'openchannelPause':_0x20d50a[_0x85df('0x4b')]||![],'pauseType':_0x20d50a[_0x85df('0x4b')]?_0x85df('0x57'):null,'lastPauseAt':moment()['format'](_0x85df('0x2b')),'interface':_0x5a5ec2});}})[_0x85df('0x17')](function(_0x1b370b){_0x3c43d0(_0x1b370b);})[_0x85df('0x1a')](function(_0x560841){_0x54dafe(_0x3a74eb[_0x85df('0x1c')](0x1f4,_0x560841['message']));});});}; \ No newline at end of file +var _0x623e=['merge','LOGININPAUSE','concat','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','socket.io-emitter','./user.socket','register','findAll','options','where','attributes','include','map','model','then','info','debug','GetUser','error','message','ShowUser','User','stringify','catch','PauseUser','find','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','body','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','LOGIN'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x623e,0xbb));var _0xe623=function(_0x496b57,_0x14e643){_0x496b57=_0x496b57-0x0;var _0x18e32d=_0x623e[_0x496b57];return _0x18e32d;};'use strict';var _=require(_0xe623('0x0'));var util=require(_0xe623('0x1'));var moment=require(_0xe623('0x2'));var BPromise=require('bluebird');var Redis=require(_0xe623('0x3'));var db=require(_0xe623('0x4'))['db'];var utils=require(_0xe623('0x5'));var logger=require('../../config/logger')(_0xe623('0x6'));var config=require(_0xe623('0x7'));config[_0xe623('0x8')]=_['defaults'](config[_0xe623('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe623('0x9'))(new Redis(config[_0xe623('0x8')]));require(_0xe623('0xa'))[_0xe623('0xb')](socket);exports['GetUser']=function(_0x3ae11a){var _0x48f4bb=this;return new Promise(function(_0x5e3109,_0xabab8d){return db['User'][_0xe623('0xc')]({'raw':_0x3ae11a[_0xe623('0xd')]?_0x3ae11a[_0xe623('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x3ae11a[_0xe623('0xd')]?_0x3ae11a[_0xe623('0xd')][_0xe623('0xe')]||null:null,'attributes':_0x3ae11a['options']?_0x3ae11a[_0xe623('0xd')][_0xe623('0xf')]||null:null,'limit':_0x3ae11a['options']?_0x3ae11a[_0xe623('0xd')]['limit']||null:null,'include':_0x3ae11a[_0xe623('0xd')]?_0x3ae11a[_0xe623('0xd')][_0xe623('0x10')]?_[_0xe623('0x11')](_0x3ae11a['options']['include'],function(_0xc357f0){return{'model':db[_0xc357f0['model']],'as':_0xc357f0['as'],'attributes':_0xc357f0['attributes'],'include':_0xc357f0[_0xe623('0x10')]?_['map'](_0xc357f0[_0xe623('0x10')],function(_0x59171a){return{'model':db[_0x59171a[_0xe623('0x12')]],'as':_0x59171a['as'],'attributes':_0x59171a[_0xe623('0xf')],'include':_0x59171a['include']?_[_0xe623('0x11')](_0x59171a['include'],function(_0xe9b8c2){return{'model':db[_0xe9b8c2[_0xe623('0x12')]],'as':_0xe9b8c2['as'],'attributes':_0xe9b8c2[_0xe623('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe623('0x13')](function(_0x500b00){logger[_0xe623('0x14')]('GetUser',_0x3ae11a);logger[_0xe623('0x15')](_0xe623('0x16'),_0x3ae11a,JSON['stringify'](_0x500b00));_0x5e3109(_0x500b00);})['catch'](function(_0x432f8e){logger[_0xe623('0x17')](_0xe623('0x16'),_0x432f8e[_0xe623('0x18')],_0x3ae11a);_0xabab8d(_0x48f4bb[_0xe623('0x17')](0x1f4,_0x432f8e[_0xe623('0x18')]));});});};exports[_0xe623('0x19')]=function(_0x29e285){var _0x3c9f4f=this;return new Promise(function(_0x87de38,_0x1894b2){return db[_0xe623('0x1a')]['find']({'raw':_0x29e285[_0xe623('0xd')]?_0x29e285[_0xe623('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x29e285[_0xe623('0xd')]?_0x29e285[_0xe623('0xd')]['where']||null:null,'attributes':_0x29e285[_0xe623('0xd')]?_0x29e285[_0xe623('0xd')][_0xe623('0xf')]||null:null,'include':_0x29e285['options']?_0x29e285[_0xe623('0xd')][_0xe623('0x10')]?_[_0xe623('0x11')](_0x29e285[_0xe623('0xd')][_0xe623('0x10')],function(_0x88b88a){return{'model':db[_0x88b88a[_0xe623('0x12')]],'as':_0x88b88a['as'],'attributes':_0x88b88a[_0xe623('0xf')],'include':_0x88b88a[_0xe623('0x10')]?_[_0xe623('0x11')](_0x88b88a[_0xe623('0x10')],function(_0x50ba72){return{'model':db[_0x50ba72[_0xe623('0x12')]],'as':_0x50ba72['as'],'attributes':_0x50ba72[_0xe623('0xf')],'include':_0x50ba72[_0xe623('0x10')]?_[_0xe623('0x11')](_0x50ba72[_0xe623('0x10')],function(_0x3a364f){return{'model':db[_0x3a364f[_0xe623('0x12')]],'as':_0x3a364f['as'],'attributes':_0x3a364f[_0xe623('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe623('0x13')](function(_0x33184c){logger['info'](_0xe623('0x19'),_0x29e285);logger[_0xe623('0x15')](_0xe623('0x19'),_0x29e285,JSON[_0xe623('0x1b')](_0x33184c));_0x87de38(_0x33184c);})[_0xe623('0x1c')](function(_0x4d2ffd){logger['error']('ShowUser',_0x4d2ffd[_0xe623('0x18')],_0x29e285);_0x1894b2(_0x3c9f4f[_0xe623('0x17')](0x1f4,_0x4d2ffd[_0xe623('0x18')]));});});};exports[_0xe623('0x1d')]=function(_0x44ea77){var _0x5385ad;return db[_0xe623('0x1a')][_0xe623('0x1e')]({'where':_0x44ea77[_0xe623('0xd')][_0xe623('0xe')]||{},'attributes':['id',_0xe623('0x1f'),_0xe623('0x20'),_0xe623('0x21'),_0xe623('0x22')]})['then'](function(_0x12e372){if(!_0x12e372){throw new Error(util[_0xe623('0x23')](_0xe623('0x24'),_0x44ea77[_0xe623('0x25')]['id']));}_0x5385ad=_0x12e372;return db[_0xe623('0x26')][_0xe623('0x27')]({'paused':0x1},{'where':{'UserId':_0x5385ad['id']},'individualHooks':!![]});})[_0xe623('0x13')](function(){return db[_0xe623('0x28')][_0xe623('0xc')]({'where':{'membername':_0x5385ad[_0xe623('0x1f')],'type':_0xe623('0x29'),'exitAt':null}});})[_0xe623('0x13')](function(_0x13a812){if(_0x13a812&&_0x13a812['length']){var _0x321640=moment()[_0xe623('0x23')](_0xe623('0x2a'));for(var _0x520904=0x0,_0x3fd096=_0x13a812[_0xe623('0x2b')];_0x520904<_0x3fd096;_0x520904++){_0x13a812[_0x520904][_0xe623('0x2c')]({'exitAt':_0x321640});}}})[_0xe623('0x13')](function(){var _0x3cf229=[];var _0x38efa7=utils[_0xe623('0x2d')]();_0x38efa7[_0xe623('0x2e')](function(_0x5f1b86){_0x3cf229[_0xe623('0x2f')]({'channel':_0x5f1b86,'membername':_0x5385ad[_0xe623('0x1f')],'interface':_[_0xe623('0x30')](_0x5385ad[_0xe623('0x22')])?util['format'](_0xe623('0x31'),_0x5385ad[_0xe623('0x1f')]):_0x5385ad[_0xe623('0x22')],'type':_0xe623('0x29'),'enterAt':moment()[_0xe623('0x23')](_0xe623('0x2a')),'data1':_0x44ea77['body'][_0xe623('0x32')]||_0xe623('0x33'),'role':_0x5385ad[_0xe623('0x20')],'internal':_0x5385ad['internal'],'uniqueid':_0x44ea77[_0xe623('0x34')]['uniqueid']||null});});return db[_0xe623('0x28')][_0xe623('0x35')](_0x3cf229,{'individualHooks':!![]});})[_0xe623('0x13')](function(){return _0x5385ad['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x44ea77[_0xe623('0x34')][_0xe623('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe623('0x23')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xe623('0x1c')](function(_0x38ec37){throw _0x38ec37;});};exports[_0xe623('0x36')]=function(_0x319029){return Promise[_0xe623('0x37')]()[_0xe623('0x13')](function(){if(_0x319029[_0xe623('0x34')][_0xe623('0x38')]&&!utils[_0xe623('0x39')](_0x319029[_0xe623('0x34')]['channel'])){throw new Error(util[_0xe623('0x23')](_0xe623('0x3a'),_0x319029[_0xe623('0x34')][_0xe623('0x38')]));}return db['User'][_0xe623('0x3b')]({'where':_0x319029[_0xe623('0xd')]['where']||{},'attributes':['id',_0xe623('0x1f'),_0xe623('0x20'),_0xe623('0x21'),'interface',_0xe623('0x3c'),_0xe623('0x3d'),_0xe623('0x3e'),_0xe623('0x3f'),_0xe623('0x40'),_0xe623('0x41'),_0xe623('0x42'),_0xe623('0x43'),_0xe623('0x44'),_0xe623('0x45')]});})[_0xe623('0x13')](function(_0x6e8a5f){if(!_0x6e8a5f){throw new Error(util[_0xe623('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x319029['params']['id']));}return _0x6e8a5f[_0xe623('0x46')](_0x319029['body'][_0xe623('0x38')],_0xe623('0x47'));})[_0xe623('0x1c')](function(_0x53ad78){throw _0x53ad78;});};exports[_0xe623('0x48')]=function(_0x3d7e64){var _0x6eef1f=this;return new Promise(function(_0x13c44e,_0x345c0e){var _0x558754;return db['User'][_0xe623('0x3b')]({'where':_0x3d7e64['options']['where']||{},'attributes':['id',_0xe623('0x1f')]})[_0xe623('0x13')](function(_0x2312f2){if(_0x2312f2){_0x558754=_0x2312f2;return db[_0xe623('0x26')][_0xe623('0x49')]({'where':{'membername':_0x558754[_0xe623('0x1f')]},'individualHooks':!![]});}})['then'](function(){if(_0x558754){return db[_0xe623('0x28')][_0xe623('0xc')]({'where':{'membername':_0x558754[_0xe623('0x1f')],'exitAt':null}});}})['then'](function(_0x597900){if(_0x558754){if(_0x597900&&_0x597900[_0xe623('0x2b')]){var _0x20bafa=[];_0x597900[_0xe623('0x2e')](function(_0x484197){_0x20bafa[_0xe623('0x2f')](_0x484197['update']({'exitAt':moment()[_0xe623('0x23')](_0xe623('0x2a'))}));});return BPromise[_0xe623('0x4a')](_0x20bafa);}}})[_0xe623('0x13')](function(){if(_0x558754){return _0x558754[_0xe623('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe623('0x13')](function(_0x19d45c){_0x13c44e(_0x19d45c);})[_0xe623('0x1c')](function(_0x34f529){_0x345c0e(_0x6eef1f[_0xe623('0x17')](0x1f4,_0x34f529[_0xe623('0x18')]));});});};exports[_0xe623('0x4b')]=function(_0x2cdda2){var _0x418e20=this;return new Promise(function(_0x471d8f,_0x2cd7f2){var _0x3e07aa;var _0x3ca29c;var _0x420cee;var _0xe93c9b;return db[_0xe623('0x1a')][_0xe623('0x3b')]({'where':_0x2cdda2[_0xe623('0xd')][_0xe623('0xe')]||{},'attributes':['id',_0xe623('0x1f'),_0xe623('0x20'),_0xe623('0x4c'),_0xe623('0x4d'),'internal','loginInPause',_0xe623('0x22')]})[_0xe623('0x13')](function(_0x29855a){if(_0x29855a){_0x3e07aa=_0x29855a;_0xe93c9b=_0x2cdda2['body'][_0xe623('0x22')]?_0x2cdda2[_0xe623('0x34')][_0xe623('0x22')]:util[_0xe623('0x23')](_0xe623('0x31'),_0x3e07aa[_0xe623('0x1f')]);return db[_0xe623('0x1a')][_0xe623('0x4e')]({'where':{'role':_0xe623('0x4f'),'online':!![],'id':{'$ne':_0x3e07aa['id']}}});}})[_0xe623('0x13')](function(_0x451880){if(_0x451880){_0x420cee=_0x451880;return require(_0xe623('0x50'))[_0xe623('0x51')]();}})[_0xe623('0x13')](function(_0x243923){if(_0x243923&&_0x243923[_0xe623('0x52')]&&_0x420cee>=_0x243923[_0xe623('0x52')]){throw new Error(_0xe623('0x53'));}})[_0xe623('0x13')](function(){if(_0x3e07aa){return db[_0xe623('0x26')][_0xe623('0x49')]({'where':{'membername':_0x3e07aa[_0xe623('0x1f')]},'individualHooks':!![]});}})[_0xe623('0x13')](function(){if(_0x3e07aa){return _0x3e07aa[_0xe623('0x54')]({'raw':!![]});}})['then'](function(_0x2f305e){if(_0x3e07aa){if(_0x2f305e){var _0x437f4a=[];_0x3ca29c=_0x2f305e;if(_0x3ca29c[_0xe623('0x2b')]){for(var _0x366f2b=0x0;_0x366f2b<_0x3ca29c[_0xe623('0x2b')];_0x366f2b++){_0x437f4a[_0xe623('0x2f')](db[_0xe623('0x26')][_0xe623('0x55')]({'membername':_0x3e07aa[_0xe623('0x1f')],'UserId':_0x3e07aa['id'],'queue_name':_0x3ca29c[_0x366f2b][_0xe623('0x1f')],'VoiceQueueId':_0x3ca29c[_0x366f2b]['id'],'interface':_0xe93c9b,'paused':_0x3e07aa[_0xe623('0x56')]||![],'penalty':_0x3ca29c[_0x366f2b][_0xe623('0x57')]||0x0}));}return BPromise['all'](_0x437f4a);}}}})[_0xe623('0x13')](function(){if(_0x3e07aa){return db[_0xe623('0x28')][_0xe623('0xc')]({'where':{'membername':_0x3e07aa['name'],'exitAt':null}});}})[_0xe623('0x13')](function(_0x357054){if(_0x3e07aa){if(_0x357054&&_0x357054[_0xe623('0x2b')]){var _0x823450=[];_0x357054[_0xe623('0x2e')](function(_0x14093b){_0x823450[_0xe623('0x2f')](_0x14093b[_0xe623('0x27')]({'exitAt':moment()[_0xe623('0x23')](_0xe623('0x2a'))}));});return BPromise['all'](_0x823450);}}})[_0xe623('0x13')](function(){if(_0x3e07aa){var _0x572db6=[];var _0x521045=[];var _0x25d9fb=utils[_0xe623('0x2d')]();var _0x192608={'membername':_0x3e07aa[_0xe623('0x1f')],'interface':_0xe93c9b,'enterAt':moment()['format'](_0xe623('0x2a')),'role':_0x3e07aa[_0xe623('0x20')],'internal':_0x3e07aa[_0xe623('0x21')]};_0x25d9fb[_0xe623('0x2e')](function(_0x257625){_0x572db6[_0xe623('0x2f')](_['merge']({'channel':_0x257625,'type':_0xe623('0x58'),'data1':'callysquare','data2':_0xe93c9b},_0x192608));if(_0x3e07aa[_0xe623('0x56')]){_0x521045[_0xe623('0x2f')](_[_0xe623('0x59')]({'channel':_0x257625,'type':'PAUSE','data1':_0xe623('0x5a')},_0x192608));}});return db[_0xe623('0x28')][_0xe623('0x35')](_0x572db6[_0xe623('0x5b')](_0x521045),{'individualHooks':!![]});}})['then'](function(){if(_0x3e07aa){return _0x3e07aa['update']({'online':!![],'lastLoginAt':moment()[_0xe623('0x23')](_0xe623('0x2a')),'voicePause':_0x3e07aa[_0xe623('0x56')]||![],'mailPause':_0x3e07aa[_0xe623('0x56')]||![],'chatPause':_0x3e07aa['loginInPause']||![],'faxPause':_0x3e07aa[_0xe623('0x56')]||![],'smsPause':_0x3e07aa['loginInPause']||![],'openchannelPause':_0x3e07aa['loginInPause']||![],'pauseType':_0x3e07aa[_0xe623('0x56')]?_0xe623('0x5a'):null,'lastPauseAt':moment()[_0xe623('0x23')](_0xe623('0x2a')),'interface':_0xe93c9b});}})[_0xe623('0x13')](function(_0x4af2c1){_0x471d8f(_0x4af2c1);})[_0xe623('0x1c')](function(_0x5aded7){_0x2cd7f2(_0x418e20['error'](0x1f4,_0x5aded7[_0xe623('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 80e2f71..a9d69a2 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 _0x21e5=['update','emit','register','length','./user.events','save','remove'];(function(_0x47503f,_0x5615c1){var _0x4ec92c=function(_0x490143){while(--_0x490143){_0x47503f['push'](_0x47503f['shift']());}};_0x4ec92c(++_0x5615c1);}(_0x21e5,0x1a1));var _0x521e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x21e5[_0x2d8fc2];return _0x3a9e53;};'use strict';var UserEvents=require(_0x521e('0x0'));var events=[_0x521e('0x1'),_0x521e('0x2'),_0x521e('0x3')];function createListener(_0x4efb93,_0x455e4a){return function(_0x45de2f){_0x455e4a[_0x521e('0x4')](_0x4efb93,_0x45de2f);};}function removeListener(_0x36736c,_0x261f75){return function(){UserEvents['removeListener'](_0x36736c,_0x261f75);};}exports[_0x521e('0x5')]=function(_0x50ba4e){for(var _0x4c15a5=0x0,_0x14d67d=events[_0x521e('0x6')];_0x4c15a5<_0x14d67d;_0x4c15a5++){var _0x5d11a0=events[_0x4c15a5];var _0x162e9a=createListener('user:'+_0x5d11a0,_0x50ba4e);UserEvents['on'](_0x5d11a0,_0x162e9a);}}; \ No newline at end of file +var _0x07e9=['save','remove','update','removeListener','register','length','user:'];(function(_0x4e3397,_0x20951a){var _0x4398c6=function(_0x187045){while(--_0x187045){_0x4e3397['push'](_0x4e3397['shift']());}};_0x4398c6(++_0x20951a);}(_0x07e9,0xaf));var _0x907e=function(_0x5a318e,_0x5e22c1){_0x5a318e=_0x5a318e-0x0;var _0xfc8c84=_0x07e9[_0x5a318e];return _0xfc8c84;};'use strict';var UserEvents=require('./user.events');var events=[_0x907e('0x0'),_0x907e('0x1'),_0x907e('0x2')];function createListener(_0x423786,_0x5c99da){return function(_0xb55c9e){_0x5c99da['emit'](_0x423786,_0xb55c9e);};}function removeListener(_0x60fb9e,_0x577dd1){return function(){UserEvents[_0x907e('0x3')](_0x60fb9e,_0x577dd1);};}exports[_0x907e('0x4')]=function(_0x505a7c){for(var _0x55af45=0x0,_0x25ddcd=events[_0x907e('0x5')];_0x55af45<_0x25ddcd;_0x55af45++){var _0x1b73e6=events[_0x55af45];var _0x1a348f=createListener(_0x907e('0x6')+_0x1b73e6,_0x505a7c);UserEvents['on'](_0x1b73e6,_0x1a348f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 577b77b..f6453d4 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a8a98,_0x2e4d29){var _0x57207b=function(_0x33a4c9){while(--_0x33a4c9){_0x2a8a98['push'](_0x2a8a98['shift']());}};_0x57207b(++_0x2e4d29);}(_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(_0x5adc68,_0x1a31b9){var _0x1b40f8=function(_0x4673c0){while(--_0x4673c0){_0x5adc68['push'](_0x5adc68['shift']());}};_0x1b40f8(++_0x1a31b9);}(_0x70e0,0x17b));var _0x070e=function(_0x55762b,_0x5d1748){_0x55762b=_0x55762b-0x0;var _0x566097=_0x70e0[_0x55762b];return _0x566097;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9305028..6a99949 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 _0x13fe=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13fe,0x138));var _0xe13f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x13fe[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe13f('0x0'));module[_0xe13f('0x1')]={'penalty':{'type':Sequelize[_0xe13f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x167b=['INTEGER','sequelize','exports'];(function(_0x52245c,_0x28e3a2){var _0x4ab58b=function(_0x3bfffe){while(--_0x3bfffe){_0x52245c['push'](_0x52245c['shift']());}};_0x4ab58b(++_0x28e3a2);}(_0x167b,0x163));var _0xb167=function(_0x3ee614,_0x5ed63e){_0x3ee614=_0x3ee614-0x0;var _0x17d484=_0x167b[_0x3ee614];return _0x17d484;};'use strict';var Sequelize=require(_0xb167('0x0'));module[_0xb167('0x1')]={'penalty':{'type':Sequelize[_0xb167('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 c9bf124..a80577b 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 _0xbbe7=['request-promise','path','rimraf','../../config/environment','exports','UserChatQueue','user_has_chat_queues','lodash','util','api'];(function(_0x396e83,_0x19a7b8){var _0x520bdb=function(_0xe42cfb){while(--_0xe42cfb){_0x396e83['push'](_0x396e83['shift']());}};_0x520bdb(++_0x19a7b8);}(_0xbbe7,0x151));var _0x7bbe=function(_0x2aaec6,_0x2bc669){_0x2aaec6=_0x2aaec6-0x0;var _0x1b5189=_0xbbe7[_0x2aaec6];return _0x1b5189;};'use strict';var _=require(_0x7bbe('0x0'));var util=require(_0x7bbe('0x1'));var logger=require('../../config/logger')(_0x7bbe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7bbe('0x3'));var fs=require('fs');var path=require(_0x7bbe('0x4'));var rimraf=require(_0x7bbe('0x5'));var config=require(_0x7bbe('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x7bbe('0x7')]=function(_0xbb064c,_0x56c1f3){return _0xbb064c['define'](_0x7bbe('0x8'),attributes,{'tableName':_0x7bbe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb363=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','../../config/environment','exports','define','UserChatQueue'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xb363,0x1cd));var _0x3b36=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xb363[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x3b36('0x0'));var util=require(_0x3b36('0x1'));var logger=require(_0x3b36('0x2'))(_0x3b36('0x3'));var moment=require('moment');var BPromise=require(_0x3b36('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b36('0x5'));var attributes=require('./userChatQueue.attributes');module[_0x3b36('0x6')]=function(_0x177d2,_0xa136cf){return _0x177d2[_0x3b36('0x7')](_0x3b36('0x8'),attributes,{'tableName':_0x3b36('0x9'),'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 c8bec80..2609431 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 _0x0dea=['UserChatQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0dea,0x1d2));var _0xa0de=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x0dea[_0x5e3a45];return _0x13419f;};'use strict';var _=require('lodash');var util=require(_0xa0de('0x0'));var moment=require(_0xa0de('0x1'));var BPromise=require(_0xa0de('0x2'));var rs=require(_0xa0de('0x3'));var fs=require('fs');var Redis=require(_0xa0de('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa0de('0x5'))(_0xa0de('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0de('0x7'));var client=jayson[_0xa0de('0x8')][_0xa0de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2814d1,_0xbc2a1a,_0x2f347e){return new BPromise(function(_0x3d8b53,_0x36ccd5){return client[_0xa0de('0xa')](_0x2814d1,_0x2f347e)[_0xa0de('0xb')](function(_0x463a40){logger[_0xa0de('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xbc2a1a,_0xa0de('0xd'));logger['debug'](_0xa0de('0xe'),_0xbc2a1a,'request\x20sent',JSON[_0xa0de('0xf')](_0x463a40));if(_0x463a40[_0xa0de('0x10')]){if(_0x463a40[_0xa0de('0x10')]['code']===0x1f4){logger['error'](_0xa0de('0x11'),_0xbc2a1a,_0x463a40[_0xa0de('0x10')][_0xa0de('0x12')]);return _0x36ccd5(_0x463a40['error']['message']);}logger['error'](_0xa0de('0x11'),_0xbc2a1a,_0x463a40[_0xa0de('0x10')]['message']);return _0x3d8b53(_0x463a40[_0xa0de('0x10')][_0xa0de('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0xbc2a1a,_0xa0de('0xd'));_0x3d8b53(_0x463a40[_0xa0de('0x13')][_0xa0de('0x12')]);}})[_0xa0de('0x14')](function(_0x749fd3){logger['error'](_0xa0de('0x11'),_0xbc2a1a,_0x749fd3);_0x36ccd5(_0x749fd3);});});} \ No newline at end of file +var _0xff67=['rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xff67,0xa1));var _0x7ff6=function(_0x27c3fe,_0x4bf81f){_0x27c3fe=_0x27c3fe-0x0;var _0x10020c=_0xff67[_0x27c3fe];return _0x10020c;};'use strict';var _=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var moment=require(_0x7ff6('0x2'));var BPromise=require(_0x7ff6('0x3'));var rs=require(_0x7ff6('0x4'));var fs=require('fs');var Redis=require(_0x7ff6('0x5'));var db=require(_0x7ff6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ff6('0x7'));var config=require(_0x7ff6('0x8'));var jayson=require(_0x7ff6('0x9'));var client=jayson[_0x7ff6('0xa')][_0x7ff6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x557b19,_0x4996c9,_0x69b0d1){return new BPromise(function(_0x2ed370,_0x2a52ee){return client['request'](_0x557b19,_0x69b0d1)[_0x7ff6('0xc')](function(_0x4c5ce0){logger[_0x7ff6('0xd')](_0x7ff6('0xe'),_0x4996c9,_0x7ff6('0xf'));logger[_0x7ff6('0x10')](_0x7ff6('0x11'),_0x4996c9,_0x7ff6('0xf'),JSON[_0x7ff6('0x12')](_0x4c5ce0));if(_0x4c5ce0['error']){if(_0x4c5ce0[_0x7ff6('0x13')][_0x7ff6('0x14')]===0x1f4){logger[_0x7ff6('0x13')](_0x7ff6('0xe'),_0x4996c9,_0x4c5ce0['error']['message']);return _0x2a52ee(_0x4c5ce0['error'][_0x7ff6('0x15')]);}logger[_0x7ff6('0x13')](_0x7ff6('0xe'),_0x4996c9,_0x4c5ce0[_0x7ff6('0x13')][_0x7ff6('0x15')]);return _0x2ed370(_0x4c5ce0[_0x7ff6('0x13')]['message']);}else{logger['info'](_0x7ff6('0xe'),_0x4996c9,_0x7ff6('0xf'));_0x2ed370(_0x4c5ce0[_0x7ff6('0x16')][_0x7ff6('0x15')]);}})[_0x7ff6('0x17')](function(_0x406525){logger['error'](_0x7ff6('0xe'),_0x4996c9,_0x406525);_0x2a52ee(_0x406525);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a1197bd..49ace53 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b1c1b,_0x1ae4ba){var _0x5e1cf8=function(_0x292b49){while(--_0x292b49){_0x2b1c1b['push'](_0x2b1c1b['shift']());}};_0x5e1cf8(++_0x1ae4ba);}(_0xe706,0xa3));var _0x6e70=function(_0x5df5e1,_0x3e0305){_0x5df5e1=_0x5df5e1-0x0;var _0x2fffd3=_0xe706[_0x5df5e1];return _0x2fffd3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x13a104,_0x184d79){var _0x51f3dc=function(_0x1c252c){while(--_0x1c252c){_0x13a104['push'](_0x13a104['shift']());}};_0x51f3dc(++_0x184d79);}(_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 a0b9875..adc28d4 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 _0x0461=['INTEGER','STRING','exports'];(function(_0xb3923,_0x17ded7){var _0x5c73b0=function(_0x287b3d){while(--_0x287b3d){_0xb3923['push'](_0xb3923['shift']());}};_0x5c73b0(++_0x17ded7);}(_0x0461,0x74));var _0x1046=function(_0x3a8e55,_0x324339){_0x3a8e55=_0x3a8e55-0x0;var _0x2505e7=_0x0461[_0x3a8e55];return _0x2505e7;};'use strict';var Sequelize=require('sequelize');module[_0x1046('0x0')]={'penalty':{'type':Sequelize[_0x1046('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1046('0x2')]}}; \ No newline at end of file +var _0x44f9=['STRING','sequelize','exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x44f9,0xf9));var _0x944f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x44f9[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x944f('0x0'));module[_0x944f('0x1')]={'penalty':{'type':Sequelize[_0x944f('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x944f('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 44a914e..141f3c3 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 _0x8d3b=['bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x3f6cf7,_0x2bdd1d){var _0x1ffbef=function(_0x34577f){while(--_0x34577f){_0x3f6cf7['push'](_0x3f6cf7['shift']());}};_0x1ffbef(++_0x2bdd1d);}(_0x8d3b,0xdf));var _0xb8d3=function(_0x25a0b5,_0x37499e){_0x25a0b5=_0x25a0b5-0x0;var _0x52da1b=_0x8d3b[_0x25a0b5];return _0x52da1b;};'use strict';var _=require(_0xb8d3('0x0'));var util=require(_0xb8d3('0x1'));var logger=require(_0xb8d3('0x2'))(_0xb8d3('0x3'));var moment=require(_0xb8d3('0x4'));var BPromise=require(_0xb8d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d3('0x6'));var rimraf=require(_0xb8d3('0x7'));var config=require(_0xb8d3('0x8'));var attributes=require(_0xb8d3('0x9'));module[_0xb8d3('0xa')]=function(_0xab9323,_0x497d66){return _0xab9323[_0xb8d3('0xb')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b64=['user_has_fax_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x5b64,0x90));var _0x45b6=function(_0x4744df,_0x4b1aa3){_0x4744df=_0x4744df-0x0;var _0x5d195f=_0x5b64[_0x4744df];return _0x5d195f;};'use strict';var _=require(_0x45b6('0x0'));var util=require('util');var logger=require(_0x45b6('0x1'))(_0x45b6('0x2'));var moment=require(_0x45b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x45b6('0x4'));var fs=require('fs');var path=require(_0x45b6('0x5'));var rimraf=require(_0x45b6('0x6'));var config=require(_0x45b6('0x7'));var attributes=require(_0x45b6('0x8'));module[_0x45b6('0x9')]=function(_0x1f5dde,_0x43234d){return _0x1f5dde[_0x45b6('0xa')](_0x45b6('0xb'),attributes,{'tableName':_0x45b6('0xc'),'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 89290ca..eb7d146 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 _0x328e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x328e,0xbe));var _0xe328=function(_0x28c3fc,_0x47ef1a){_0x28c3fc=_0x28c3fc-0x0;var _0x40a168=_0x328e[_0x28c3fc];return _0x40a168;};'use strict';var _=require(_0xe328('0x0'));var util=require(_0xe328('0x1'));var moment=require(_0xe328('0x2'));var BPromise=require(_0xe328('0x3'));var rs=require(_0xe328('0x4'));var fs=require('fs');var Redis=require(_0xe328('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe328('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe328('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe328('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac421,_0x5601b3,_0x4dc0a5){return new BPromise(function(_0x20c048,_0x1fc465){return client[_0xe328('0x9')](_0x2ac421,_0x4dc0a5)['then'](function(_0x4b4e29){logger[_0xe328('0xa')](_0xe328('0xb'),_0x5601b3,_0xe328('0xc'));logger[_0xe328('0xd')](_0xe328('0xe'),_0x5601b3,_0xe328('0xc'),JSON[_0xe328('0xf')](_0x4b4e29));if(_0x4b4e29[_0xe328('0x10')]){if(_0x4b4e29[_0xe328('0x10')][_0xe328('0x11')]===0x1f4){logger[_0xe328('0x10')](_0xe328('0xb'),_0x5601b3,_0x4b4e29[_0xe328('0x10')][_0xe328('0x12')]);return _0x1fc465(_0x4b4e29[_0xe328('0x10')][_0xe328('0x12')]);}logger[_0xe328('0x10')](_0xe328('0xb'),_0x5601b3,_0x4b4e29[_0xe328('0x10')]['message']);return _0x20c048(_0x4b4e29[_0xe328('0x10')][_0xe328('0x12')]);}else{logger['info'](_0xe328('0xb'),_0x5601b3,_0xe328('0xc'));_0x20c048(_0x4b4e29[_0xe328('0x13')]['message']);}})[_0xe328('0x14')](function(_0x12f317){logger['error'](_0xe328('0xb'),_0x5601b3,_0x12f317);_0x1fc465(_0x12f317);});});} \ No newline at end of file +var _0x7bba=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x34cde3,_0xf23917){var _0x3143b1=function(_0x191690){while(--_0x191690){_0x34cde3['push'](_0x34cde3['shift']());}};_0x3143b1(++_0xf23917);}(_0x7bba,0xa1));var _0xa7bb=function(_0x4b3d10,_0x3da823){_0x4b3d10=_0x4b3d10-0x0;var _0x3f62cc=_0x7bba[_0x4b3d10];return _0x3f62cc;};'use strict';var _=require(_0xa7bb('0x0'));var util=require(_0xa7bb('0x1'));var moment=require(_0xa7bb('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7bb('0x5'));var jayson=require(_0xa7bb('0x6'));var client=jayson[_0xa7bb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d0f7a,_0x1d0ab0,_0x27a446){return new BPromise(function(_0x55b5d5,_0x34c7b1){return client[_0xa7bb('0x8')](_0x5d0f7a,_0x27a446)[_0xa7bb('0x9')](function(_0x2cee3c){logger[_0xa7bb('0xa')](_0xa7bb('0xb'),_0x1d0ab0,_0xa7bb('0xc'));logger[_0xa7bb('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1d0ab0,_0xa7bb('0xc'),JSON[_0xa7bb('0xe')](_0x2cee3c));if(_0x2cee3c[_0xa7bb('0xf')]){if(_0x2cee3c['error'][_0xa7bb('0x10')]===0x1f4){logger[_0xa7bb('0xf')](_0xa7bb('0xb'),_0x1d0ab0,_0x2cee3c[_0xa7bb('0xf')]['message']);return _0x34c7b1(_0x2cee3c[_0xa7bb('0xf')][_0xa7bb('0x11')]);}logger[_0xa7bb('0xf')](_0xa7bb('0xb'),_0x1d0ab0,_0x2cee3c[_0xa7bb('0xf')][_0xa7bb('0x11')]);return _0x55b5d5(_0x2cee3c['error'][_0xa7bb('0x11')]);}else{logger[_0xa7bb('0xa')](_0xa7bb('0xb'),_0x1d0ab0,_0xa7bb('0xc'));_0x55b5d5(_0x2cee3c[_0xa7bb('0x12')][_0xa7bb('0x11')]);}})[_0xa7bb('0x13')](function(_0xfcb6a1){logger[_0xa7bb('0xf')](_0xa7bb('0xb'),_0x1d0ab0,_0xfcb6a1);_0x34c7b1(_0xfcb6a1);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e9a4540..dba2e70 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(_0x5c3304,_0x524fbc){var _0x2da2e4=function(_0x2bacb5){while(--_0x2bacb5){_0x5c3304['push'](_0x5c3304['shift']());}};_0x2da2e4(++_0x524fbc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xcb91[_0x5b7788];return _0x573871;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a73ee,_0x1c1b2a){var _0x42f95a=function(_0x161bab){while(--_0x161bab){_0x2a73ee['push'](_0x2a73ee['shift']());}};_0x42f95a(++_0x1c1b2a);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d41ce30..ee87abb 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 _0xb7a8=['exports','INTEGER'];(function(_0xf41ba4,_0x50670b){var _0x1f6df3=function(_0x3fb872){while(--_0x3fb872){_0xf41ba4['push'](_0xf41ba4['shift']());}};_0x1f6df3(++_0x50670b);}(_0xb7a8,0xec));var _0x8b7a=function(_0x39f522,_0x4877c4){_0x39f522=_0x39f522-0x0;var _0x191771=_0xb7a8[_0x39f522];return _0x191771;};'use strict';var Sequelize=require('sequelize');module[_0x8b7a('0x0')]={'penalty':{'type':Sequelize[_0x8b7a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2aca=['INTEGER','sequelize','exports'];(function(_0x9b149f,_0x3d1b4d){var _0x3195a4=function(_0x31a1a7){while(--_0x31a1a7){_0x9b149f['push'](_0x9b149f['shift']());}};_0x3195a4(++_0x3d1b4d);}(_0x2aca,0x166));var _0xa2ac=function(_0x119015,_0x350f09){_0x119015=_0x119015-0x0;var _0x568988=_0x2aca[_0x119015];return _0x568988;};'use strict';var Sequelize=require(_0xa2ac('0x0'));module[_0xa2ac('0x1')]={'penalty':{'type':Sequelize[_0xa2ac('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 5c88123..828827c 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 _0x4aba=['./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x93d943,_0x178766){var _0x325f5f=function(_0x1393ae){while(--_0x1393ae){_0x93d943['push'](_0x93d943['shift']());}};_0x325f5f(++_0x178766);}(_0x4aba,0x19c));var _0xa4ab=function(_0x29084f,_0xa56088){_0x29084f=_0x29084f-0x0;var _0x2e46c4=_0x4aba[_0x29084f];return _0x2e46c4;};'use strict';var _=require(_0xa4ab('0x0'));var util=require(_0xa4ab('0x1'));var logger=require(_0xa4ab('0x2'))(_0xa4ab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4ab('0x4'));var rimraf=require(_0xa4ab('0x5'));var config=require('../../config/environment');var attributes=require(_0xa4ab('0x6'));module[_0xa4ab('0x7')]=function(_0x5b0a4f,_0x4217f8){return _0x5b0a4f[_0xa4ab('0x8')](_0xa4ab('0x9'),attributes,{'tableName':_0xa4ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e56=['../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x182603,_0x41180e){var _0x3a93e7=function(_0x4150c6){while(--_0x4150c6){_0x182603['push'](_0x182603['shift']());}};_0x3a93e7(++_0x41180e);}(_0x7e56,0x19b));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x67e5('0x0'));var util=require('util');var logger=require(_0x67e5('0x1'))(_0x67e5('0x2'));var moment=require(_0x67e5('0x3'));var BPromise=require(_0x67e5('0x4'));var rp=require(_0x67e5('0x5'));var fs=require('fs');var path=require(_0x67e5('0x6'));var rimraf=require('rimraf');var config=require(_0x67e5('0x7'));var attributes=require(_0x67e5('0x8'));module['exports']=function(_0x5cf0f3,_0x24c041){return _0x5cf0f3[_0x67e5('0x9')]('UserMailQueue',attributes,{'tableName':_0x67e5('0xa'),'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 c147220..e33ec3a 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 _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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x008c,0x188));var _0xc008=function(_0x360d26,_0x700e92){_0x360d26=_0x360d26-0x0;var _0x180eef=_0x008c[_0x360d26];return _0x180eef;};'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 +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47b622,_0x207a7b){var _0x290b4d=function(_0x100769){while(--_0x100769){_0x47b622['push'](_0x47b622['shift']());}};_0x290b4d(++_0x207a7b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x41eb89,_0x4efc2a){_0x41eb89=_0x41eb89-0x0;var _0x5c08c7=_0x8ef6[_0x41eb89];return _0x5c08c7;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d283c84..87f979d 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 _0x6da6=['./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x28e8b6,_0x573a3c){var _0xc55ef8=function(_0x5acbe8){while(--_0x5acbe8){_0x28e8b6['push'](_0x28e8b6['shift']());}};_0xc55ef8(++_0x573a3c);}(_0x6da6,0xd6));var _0x66da=function(_0x4a2cc2,_0x1fbafa){_0x4a2cc2=_0x4a2cc2-0x0;var _0x3f5f5c=_0x6da6[_0x4a2cc2];return _0x3f5f5c;};'use strict';var multer=require(_0x66da('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x66da('0x1'));var express=require('express');var router=express[_0x66da('0x2')]();var fs_extra=require(_0x66da('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x66da('0x4'));var config=require(_0x66da('0x5'));var controller=require(_0x66da('0x6'));router[_0x66da('0x7')]('/',auth[_0x66da('0x8')](),controller[_0x66da('0x9')]);module['exports']=router; \ No newline at end of file +var _0x38dc=['./userNotification.controller','isAuthenticated','exports','multer','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x2207a0,_0x56f0d2){var _0x3f5e42=function(_0x30bb4d){while(--_0x30bb4d){_0x2207a0['push'](_0x2207a0['shift']());}};_0x3f5e42(++_0x56f0d2);}(_0x38dc,0x1cb));var _0xc38d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x38dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc38d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc38d('0x1'));var express=require(_0xc38d('0x2'));var router=express['Router']();var fs_extra=require(_0xc38d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc38d('0x4'));var controller=require(_0xc38d('0x5'));router['post']('/',auth[_0xc38d('0x6')](),controller['sendUserNotification']);module[_0xc38d('0x7')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 8b7f7b1..1b41a4e 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 _0xb59e=['STRING','TEXT','BOOLEAN','exports'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xb59e,0xc3));var _0xeb59=function(_0x3f3a29,_0x1ff7e2){_0x3f3a29=_0x3f3a29-0x0;var _0x212653=_0xb59e[_0x3f3a29];return _0x212653;};'use strict';var Sequelize=require('sequelize');module[_0xeb59('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xeb59('0x1')]},'recipientsId':{'type':Sequelize[_0xeb59('0x2')]},'recipientsDescription':{'type':Sequelize[_0xeb59('0x1')]},'beep':{'type':Sequelize[_0xeb59('0x3')]}}; \ No newline at end of file +var _0xdb36=['STRING','exports','TEXT'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xdb36,0xbe));var _0x6db3=function(_0xaa6fcb,_0x5b998){_0xaa6fcb=_0xaa6fcb-0x0;var _0x2e3029=_0xdb36[_0xaa6fcb];return _0x2e3029;};'use strict';var Sequelize=require('sequelize');module[_0x6db3('0x0')]={'body':{'type':Sequelize[_0x6db3('0x1')]},'senderName':{'type':Sequelize[_0x6db3('0x2')]},'recipientsId':{'type':Sequelize[_0x6db3('0x1')]},'recipientsDescription':{'type':Sequelize[_0x6db3('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 43d2185..445251f 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 _0xc2c0=['some','includes','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','view','startCase','User','union','ids','queue','replace','Queue','all','flatten','map','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','user'];(function(_0x327cac,_0x364d8b){var _0x23463d=function(_0x27532e){while(--_0x27532e){_0x327cac['push'](_0x327cac['shift']());}};_0x23463d(++_0x364d8b);}(_0xc2c0,0xdd));var _0x0c2c=function(_0x574e92,_0x5c61e8){_0x574e92=_0x574e92-0x0;var _0x32207c=_0xc2c0[_0x574e92];return _0x32207c;};'use strict';var emlformat=require(_0x0c2c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0c2c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c2c('0x2'));var Mustache=require(_0x0c2c('0x3'));var util=require(_0x0c2c('0x4'));var path=require(_0x0c2c('0x5'));var sox=require(_0x0c2c('0x6'));var csv=require(_0x0c2c('0x7'));var ejs=require(_0x0c2c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c2c('0x9'));var squel=require('squel');var crypto=require(_0x0c2c('0xa'));var jsforce=require(_0x0c2c('0xb'));var deskjs=require(_0x0c2c('0xc'));var toCsv=require(_0x0c2c('0x7'));var querystring=require(_0x0c2c('0xd'));var Papa=require(_0x0c2c('0xe'));var Redis=require(_0x0c2c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0c2c('0x10'));var as=require(_0x0c2c('0x11'));var hardwareService=require(_0x0c2c('0x12'));var logger=require(_0x0c2c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0c2c('0x14'));var licenseUtil=require(_0x0c2c('0x15'));var db=require('../../mysqldb')['db'];config[_0x0c2c('0x16')]=_[_0x0c2c('0x17')](config[_0x0c2c('0x16')],{'host':_0x0c2c('0x18'),'port':0x18eb});var socket=require(_0x0c2c('0x19'))(new Redis(config[_0x0c2c('0x16')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x14c7a5,_0x5a3d9a){_0x5a3d9a=_0x5a3d9a||0xcc;return function(_0x444675){if(_0x444675){return _0x14c7a5[_0x0c2c('0x1a')](_0x5a3d9a);}return _0x14c7a5[_0x0c2c('0x1b')](_0x5a3d9a)[_0x0c2c('0x1c')]();};}function respondWithResult(_0x22d505,_0x3d5dcd){_0x3d5dcd=_0x3d5dcd||0xc8;return function(_0x482875){if(_0x482875){return _0x22d505[_0x0c2c('0x1b')](_0x3d5dcd)[_0x0c2c('0x1d')](_0x482875);}};}function respondWithFilteredResult(_0x4d9075,_0x1d8643){return function(_0x1bbee2){if(_0x1bbee2){var _0x1f1fda=typeof _0x1d8643['offset']===_0x0c2c('0x1e')&&typeof _0x1d8643[_0x0c2c('0x1f')]===_0x0c2c('0x1e');var _0xab01ab=_0x1bbee2[_0x0c2c('0x20')];var _0x3a2045=_0x1f1fda?0x0:_0x1d8643['offset'];var _0x5ef88e=_0x1f1fda?_0x1bbee2[_0x0c2c('0x20')]:_0x1d8643[_0x0c2c('0x21')]+_0x1d8643['limit'];var _0x2c7783;if(_0x5ef88e>=_0xab01ab){_0x5ef88e=_0xab01ab;_0x2c7783=0xc8;}else{_0x2c7783=0xce;}_0x4d9075['status'](_0x2c7783);return _0x4d9075[_0x0c2c('0x22')](_0x0c2c('0x23'),_0x3a2045+'-'+_0x5ef88e+'/'+_0xab01ab)[_0x0c2c('0x1d')](_0x1bbee2);}return null;};}function patchUpdates(_0x2239ba){return function(_0x1308a6){try{jsonpatch[_0x0c2c('0x24')](_0x1308a6,_0x2239ba,!![]);}catch(_0x963248){return BPromise[_0x0c2c('0x25')](_0x963248);}return _0x1308a6[_0x0c2c('0x26')]();};}function saveUpdates(_0x144dee,_0x10da0f){return function(_0x2190b1){if(_0x2190b1){return _0x2190b1['update'](_0x144dee)['then'](function(_0x12562c){return _0x12562c;});}return null;};}function removeEntity(_0x51cd84,_0x40c24d){return function(_0x17c8fa){if(_0x17c8fa){return _0x17c8fa[_0x0c2c('0x27')]()[_0x0c2c('0x28')](function(){_0x51cd84[_0x0c2c('0x1b')](0xcc)[_0x0c2c('0x1c')]();});}};}function handleEntityNotFound(_0x43f051,_0x5749dd){return function(_0x1b291d){if(!_0x1b291d){_0x43f051['sendStatus'](0x194);}return _0x1b291d;};}function handleError(_0x4cd3a6,_0x1cc2a1){_0x1cc2a1=_0x1cc2a1||0x1f4;return function(_0x2149d2){logger['error'](_0x2149d2[_0x0c2c('0x29')]);if(_0x2149d2[_0x0c2c('0x2a')]){delete _0x2149d2[_0x0c2c('0x2a')];}_0x4cd3a6[_0x0c2c('0x1b')](_0x1cc2a1)['send'](_0x2149d2);};}exports[_0x0c2c('0x2b')]=function(_0x2c5583,_0x26b871,_0x572dc4){if(!_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x2d')]('text')&&!_0x2c5583[_0x0c2c('0x2c')]['hasOwnProperty']('TemplateId')){throw new db[(_0x0c2c('0x2e'))][(_0x0c2c('0x2f'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2c5583['body']['hasOwnProperty'](_0x0c2c('0x30'))&&!_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x2d')]('view')){throw new db[(_0x0c2c('0x2e'))][(_0x0c2c('0x2f'))](_0x0c2c('0x31'));}if(!_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x2d')](_0x0c2c('0x32'))){throw new db['Sequelize'][(_0x0c2c('0x2f'))](_0x0c2c('0x33'));}else{try{var _0x4e3e8f=JSON[_0x0c2c('0x34')](_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x32')]);}catch(_0xdd8471){logger[_0x0c2c('0x35')](_0xdd8471);throw new db[(_0x0c2c('0x2e'))][(_0x0c2c('0x2f'))](_0x0c2c('0x36'));}var _0x55de83=[_0x0c2c('0x37'),_0x0c2c('0x38'),_0x0c2c('0x39'),_0x0c2c('0x3a'),'smsqueue',_0x0c2c('0x3b'),'whatsappqueue','team',_0x0c2c('0x3c')];if(_[_0x0c2c('0x3d')](_0x4e3e8f,function(_0x4e6a89){return!_[_0x0c2c('0x3e')](_0x55de83,_0x4e6a89['model'][_0x0c2c('0x3f')]());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x285005={};_0x285005[_0x0c2c('0x40')]=_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x2d')](_0x0c2c('0x40'))?_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x40')]:_0x2c5583[_0x0c2c('0x3c')][_0x0c2c('0x41')];_0x285005[_0x0c2c('0x42')]=_[_0x0c2c('0x43')](_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x42')])?null:_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x42')];_0x285005[_0x0c2c('0x44')]=_0x2c5583[_0x0c2c('0x2c')][_0x0c2c('0x44')]||![];_0x285005[_0x0c2c('0x45')]=_0x2c5583[_0x0c2c('0x3c')]['id'];return getContent(_0x2c5583[_0x0c2c('0x2c')])['then'](function(_0x4fee20){_0x285005[_0x0c2c('0x2c')]=_0x4fee20;return getRecipients(_0x4e3e8f);})[_0x0c2c('0x28')](function(_0x3c605f){_0x285005[_0x0c2c('0x46')]=_['sortBy'](_0x3c605f)[_0x0c2c('0x47')](',');return db[_0x0c2c('0x48')]['transaction'](function(_0x241b3c){return db['UserNotification'][_0x0c2c('0x49')](_0x285005,{'raw':!![],'transaction':_0x241b3c})[_0x0c2c('0x28')](function(_0x1127bd){var _0x162cb2={'sender':_0x285005[_0x0c2c('0x40')],'description':_0x285005[_0x0c2c('0x42')],'content':_0x285005[_0x0c2c('0x2c')],'beep':_0x285005[_0x0c2c('0x44')]};_0x3c605f[_0x0c2c('0x4a')](function(_0x34a2e6){_0x162cb2[_0x0c2c('0x4b')]=_0x34a2e6;socket[_0x0c2c('0x4c')](_0x0c2c('0x4d'),_0x162cb2);});return _0x1127bd;});});})[_0x0c2c('0x28')](respondWithResult(_0x26b871,0xc9))[_0x0c2c('0x4e')](handleError(_0x26b871,null));};function getContent(_0x35695a){return new BPromise(function(_0x503009,_0xa51652){if(_0x35695a[_0x0c2c('0x4f')]){_0x503009(_0x35695a[_0x0c2c('0x4f')]);return;}return db[_0x0c2c('0x50')][_0x0c2c('0x51')]({'attributes':[_0x0c2c('0x52')],'where':{'id':_0x35695a[_0x0c2c('0x30')]},'raw':!![]})['then'](function(_0xc66646){if(!_0xc66646)throw new db[(_0x0c2c('0x2e'))][(_0x0c2c('0x2f'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x307942=Mustache['render'](_0xc66646['html'],_0x35695a[_0x0c2c('0x53')]);_0x503009(_0x307942);})[_0x0c2c('0x4e')](function(_0x4aa367){_0xa51652(_0x4aa367);});});}function getRecipients(_0x541a6c){return new BPromise(function(_0x166813,_0x18e895){var _0x9040e7=[];var _0x57e907=[];_0x541a6c[_0x0c2c('0x4a')](function(_0x41bfca){var _0x625c85=_[_0x0c2c('0x54')](_0x41bfca['model'][_0x0c2c('0x3f')]());if(_0x625c85===_0x0c2c('0x55')){_0x9040e7=_[_0x0c2c('0x56')](_0x9040e7,_0x41bfca[_0x0c2c('0x57')]);}else{if(_[_0x0c2c('0x3e')](_0x625c85,_0x0c2c('0x58')))_0x625c85=_0x625c85[_0x0c2c('0x59')](_0x0c2c('0x58'),_0x0c2c('0x5a'));_0x41bfca['ids']['forEach'](function(_0x298e93){_0x57e907['push'](getAgents(_0x625c85,_0x298e93));});}});return BPromise[_0x0c2c('0x5b')](_0x57e907)[_0x0c2c('0x28')](function(_0xbc8272){_0x9040e7=_['union'](_0x9040e7,_[_0x0c2c('0x5c')](_0xbc8272));_0x166813(_0x9040e7);})[_0x0c2c('0x4e')](function(_0x28ada2){_0x18e895(_0x28ada2);});});}function getAgents(_0x9a5185,_0x5e9311){return new BPromise(function(_0x514539,_0x397687){return db[_0x9a5185][_0x0c2c('0x51')]({'where':{'id':_0x5e9311}})[_0x0c2c('0x28')](function(_0x1c544b){return _0x1c544b['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1ce9c4){var _0x50d01b=_[_0x0c2c('0x5d')](_0x1ce9c4,'id');_0x514539(_0x50d01b);});})[_0x0c2c('0x4e')](function(_0x2cfa17){_0x397687(_0x2cfa17);});});} \ No newline at end of file +var _0xa67b=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','sequelize','UserNotification','forEach','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','model','User','union','ids','queue','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2ab47e,_0x2d89ea){var _0x4664e7=function(_0x12a435){while(--_0x12a435){_0x2ab47e['push'](_0x2ab47e['shift']());}};_0x4664e7(++_0x2d89ea);}(_0xa67b,0xb0));var _0xba67=function(_0x20b37f,_0x1f2dad){_0x20b37f=_0x20b37f-0x0;var _0x3edef1=_0xa67b[_0x20b37f];return _0x3edef1;};'use strict';var emlformat=require(_0xba67('0x0'));var rimraf=require(_0xba67('0x1'));var zipdir=require(_0xba67('0x2'));var jsonpatch=require(_0xba67('0x3'));var rp=require('request-promise');var moment=require(_0xba67('0x4'));var BPromise=require(_0xba67('0x5'));var Mustache=require(_0xba67('0x6'));var util=require(_0xba67('0x7'));var path=require(_0xba67('0x8'));var sox=require(_0xba67('0x9'));var csv=require(_0xba67('0xa'));var ejs=require(_0xba67('0xb'));var fs=require('fs');var fs_extra=require(_0xba67('0xc'));var _=require(_0xba67('0xd'));var squel=require(_0xba67('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba67('0xf'));var toCsv=require(_0xba67('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba67('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xba67('0x11'));var as=require(_0xba67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xba67('0x13'));var utils=require(_0xba67('0x14'));var config=require(_0xba67('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xba67('0x16')](config[_0xba67('0x17')],{'host':_0xba67('0x18'),'port':0x18eb});var socket=require(_0xba67('0x19'))(new Redis(config[_0xba67('0x17')]));require(_0xba67('0x1a'))[_0xba67('0x1b')](socket);function respondWithStatusCode(_0x397b09,_0x56393e){_0x56393e=_0x56393e||0xcc;return function(_0x3064ec){if(_0x3064ec){return _0x397b09[_0xba67('0x1c')](_0x56393e);}return _0x397b09[_0xba67('0x1d')](_0x56393e)[_0xba67('0x1e')]();};}function respondWithResult(_0x503391,_0x455ba5){_0x455ba5=_0x455ba5||0xc8;return function(_0x4af939){if(_0x4af939){return _0x503391[_0xba67('0x1d')](_0x455ba5)[_0xba67('0x1f')](_0x4af939);}};}function respondWithFilteredResult(_0x3dea84,_0x2517e9){return function(_0x172408){if(_0x172408){var _0x19530f=typeof _0x2517e9[_0xba67('0x20')]===_0xba67('0x21')&&typeof _0x2517e9[_0xba67('0x22')]===_0xba67('0x21');var _0x2bae5e=_0x172408[_0xba67('0x23')];var _0x3db530=_0x19530f?0x0:_0x2517e9['offset'];var _0x24d1da=_0x19530f?_0x172408[_0xba67('0x23')]:_0x2517e9[_0xba67('0x20')]+_0x2517e9[_0xba67('0x22')];var _0x5f4401;if(_0x24d1da>=_0x2bae5e){_0x24d1da=_0x2bae5e;_0x5f4401=0xc8;}else{_0x5f4401=0xce;}_0x3dea84[_0xba67('0x1d')](_0x5f4401);return _0x3dea84[_0xba67('0x24')](_0xba67('0x25'),_0x3db530+'-'+_0x24d1da+'/'+_0x2bae5e)[_0xba67('0x1f')](_0x172408);}return null;};}function patchUpdates(_0x4013b2){return function(_0x3430a4){try{jsonpatch[_0xba67('0x26')](_0x3430a4,_0x4013b2,!![]);}catch(_0x3284a1){return BPromise[_0xba67('0x27')](_0x3284a1);}return _0x3430a4[_0xba67('0x28')]();};}function saveUpdates(_0x51c67e,_0x394eea){return function(_0x550dc0){if(_0x550dc0){return _0x550dc0[_0xba67('0x29')](_0x51c67e)[_0xba67('0x2a')](function(_0x42ebd7){return _0x42ebd7;});}return null;};}function removeEntity(_0x5eb0ff,_0x77d448){return function(_0x9d05fb){if(_0x9d05fb){return _0x9d05fb['destroy']()[_0xba67('0x2a')](function(){_0x5eb0ff['status'](0xcc)[_0xba67('0x1e')]();});}};}function handleEntityNotFound(_0x391af7,_0x5cc0f8){return function(_0x5934d8){if(!_0x5934d8){_0x391af7[_0xba67('0x1c')](0x194);}return _0x5934d8;};}function handleError(_0x1ae8b4,_0xf344f3){_0xf344f3=_0xf344f3||0x1f4;return function(_0x36f2ac){logger[_0xba67('0x2b')](_0x36f2ac[_0xba67('0x2c')]);if(_0x36f2ac['name']){delete _0x36f2ac[_0xba67('0x2d')];}_0x1ae8b4[_0xba67('0x1d')](_0xf344f3)['send'](_0x36f2ac);};}exports[_0xba67('0x2e')]=function(_0x1df5e6,_0xc136e7,_0x243d65){if(!_0x1df5e6[_0xba67('0x2f')][_0xba67('0x30')](_0xba67('0x31'))&&!_0x1df5e6['body'][_0xba67('0x30')](_0xba67('0x32'))){throw new db['Sequelize'][(_0xba67('0x33'))](_0xba67('0x34'));}else{if(_0x1df5e6[_0xba67('0x2f')][_0xba67('0x30')](_0xba67('0x32'))&&!_0x1df5e6['body'][_0xba67('0x30')]('view')){throw new db[(_0xba67('0x35'))][(_0xba67('0x33'))](_0xba67('0x36'));}if(!_0x1df5e6[_0xba67('0x2f')][_0xba67('0x30')]('recipients')){throw new db['Sequelize']['ValidationError'](_0xba67('0x37'));}else{try{var _0x1d77b2=JSON['parse'](_0x1df5e6[_0xba67('0x2f')]['recipients']);}catch(_0x25efc3){logger[_0xba67('0x2b')](_0x25efc3);throw new db['Sequelize'][(_0xba67('0x33'))](_0xba67('0x38'));}var _0x394529=[_0xba67('0x39'),'faxqueue',_0xba67('0x3a'),'openchannelqueue',_0xba67('0x3b'),'voicequeue','whatsappqueue',_0xba67('0x3c'),_0xba67('0x3d')];if(_[_0xba67('0x3e')](_0x1d77b2,function(_0x4af102){return!_[_0xba67('0x3f')](_0x394529,_0x4af102['model'][_0xba67('0x40')]());})){throw new db['Sequelize']['ValidationError'](_0xba67('0x41'));}}}var _0x1b90f0={};_0x1b90f0[_0xba67('0x42')]=_0x1df5e6[_0xba67('0x2f')]['hasOwnProperty'](_0xba67('0x42'))?_0x1df5e6[_0xba67('0x2f')]['senderName']:_0x1df5e6[_0xba67('0x3d')][_0xba67('0x43')];_0x1b90f0[_0xba67('0x44')]=_['isEmpty'](_0x1df5e6[_0xba67('0x2f')][_0xba67('0x44')])?null:_0x1df5e6[_0xba67('0x2f')][_0xba67('0x44')];_0x1b90f0[_0xba67('0x45')]=_0x1df5e6[_0xba67('0x2f')][_0xba67('0x45')]||![];_0x1b90f0[_0xba67('0x46')]=_0x1df5e6['user']['id'];return getContent(_0x1df5e6['body'])['then'](function(_0x4b1a12){_0x1b90f0[_0xba67('0x2f')]=_0x4b1a12;return getRecipients(_0x1d77b2);})[_0xba67('0x2a')](function(_0x32dfbc){_0x1b90f0['recipientsId']=_['sortBy'](_0x32dfbc)['join'](',');return db[_0xba67('0x47')]['transaction'](function(_0xc5ef66){return db[_0xba67('0x48')]['create'](_0x1b90f0,{'raw':!![],'transaction':_0xc5ef66})[_0xba67('0x2a')](function(_0x70ded7){var _0x75f165={'sender':_0x1b90f0[_0xba67('0x42')],'description':_0x1b90f0[_0xba67('0x44')],'content':_0x1b90f0['body'],'beep':_0x1b90f0['beep']};_0x32dfbc[_0xba67('0x49')](function(_0x2454f0){_0x75f165['recipient']=_0x2454f0;socket[_0xba67('0x4a')]('userNotification:send',_0x75f165);});return _0x70ded7;});});})[_0xba67('0x2a')](respondWithResult(_0xc136e7,0xc9))[_0xba67('0x4b')](handleError(_0xc136e7,null));};function getContent(_0x1a6dc4){return new BPromise(function(_0x2d0b6e,_0x585f5b){if(_0x1a6dc4[_0xba67('0x31')]){_0x2d0b6e(_0x1a6dc4[_0xba67('0x31')]);return;}return db[_0xba67('0x4c')][_0xba67('0x4d')]({'attributes':[_0xba67('0x4e')],'where':{'id':_0x1a6dc4[_0xba67('0x32')]},'raw':!![]})['then'](function(_0x5466de){if(!_0x5466de)throw new db[(_0xba67('0x35'))][(_0xba67('0x33'))](_0xba67('0x4f'));var _0x267fe7=Mustache['render'](_0x5466de[_0xba67('0x4e')],_0x1a6dc4[_0xba67('0x50')]);_0x2d0b6e(_0x267fe7);})[_0xba67('0x4b')](function(_0x38c4c0){_0x585f5b(_0x38c4c0);});});}function getRecipients(_0x55decf){return new BPromise(function(_0x215b80,_0x36a36d){var _0x1c1de2=[];var _0x26bc9f=[];_0x55decf[_0xba67('0x49')](function(_0x54daa8){var _0x356c17=_[_0xba67('0x51')](_0x54daa8[_0xba67('0x52')][_0xba67('0x40')]());if(_0x356c17===_0xba67('0x53')){_0x1c1de2=_[_0xba67('0x54')](_0x1c1de2,_0x54daa8[_0xba67('0x55')]);}else{if(_['includes'](_0x356c17,_0xba67('0x56')))_0x356c17=_0x356c17['replace'](_0xba67('0x56'),'Queue');_0x54daa8['ids']['forEach'](function(_0x5ee28d){_0x26bc9f['push'](getAgents(_0x356c17,_0x5ee28d));});}});return BPromise[_0xba67('0x57')](_0x26bc9f)[_0xba67('0x2a')](function(_0x2ad546){_0x1c1de2=_[_0xba67('0x54')](_0x1c1de2,_[_0xba67('0x58')](_0x2ad546));_0x215b80(_0x1c1de2);})[_0xba67('0x4b')](function(_0x5bbc52){_0x36a36d(_0x5bbc52);});});}function getAgents(_0x48be48,_0x166b65){return new BPromise(function(_0x21d1e4,_0x4835c7){return db[_0x48be48][_0xba67('0x4d')]({'where':{'id':_0x166b65}})['then'](function(_0x33e4cc){return _0x33e4cc[_0xba67('0x59')]({'attributes':['id'],'raw':!![]})[_0xba67('0x2a')](function(_0x3c78b8){var _0x15e082=_[_0xba67('0x5a')](_0x3c78b8,'id');_0x21d1e4(_0x15e082);});})[_0xba67('0x4b')](function(_0x531ef9){_0x4835c7(_0x531ef9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index db85630..044e630 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 _0xd653=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x2f5453,_0x1b485e){var _0x3f68fe=function(_0x381c47){while(--_0x381c47){_0x2f5453['push'](_0x2f5453['shift']());}};_0x3f68fe(++_0x1b485e);}(_0xd653,0xe4));var _0x3d65=function(_0x1d3b9c,_0x459664){_0x1d3b9c=_0x1d3b9c-0x0;var _0x4813b5=_0xd653[_0x1d3b9c];return _0x4813b5;};'use strict';var EventEmitter=require(_0x3d65('0x0'));var UserNotification=require(_0x3d65('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3d65('0x2')](0x0);var events={'afterCreate':_0x3d65('0x3'),'afterUpdate':_0x3d65('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5121a4){return function(_0x45427f,_0x411449,_0x1b2d53){UserNotificationEvents[_0x3d65('0x5')](_0x5121a4+':'+_0x45427f['id'],_0x45427f);UserNotificationEvents[_0x3d65('0x5')](_0x5121a4,_0x45427f);_0x1b2d53(null);};}for(var e in events){if(events[_0x3d65('0x6')](e)){var event=events[e];UserNotification[_0x3d65('0x7')](e,emitEvent(event));}}module[_0x3d65('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x8782=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x5061ef,_0x38e3fd){var _0xab183a=function(_0x140464){while(--_0x140464){_0x5061ef['push'](_0x5061ef['shift']());}};_0xab183a(++_0x38e3fd);}(_0x8782,0x7e));var _0x2878=function(_0x97d7b9,_0x5a7f02){_0x97d7b9=_0x97d7b9-0x0;var _0x1284d1=_0x8782[_0x97d7b9];return _0x1284d1;};'use strict';var EventEmitter=require(_0x2878('0x0'));var UserNotification=require(_0x2878('0x1'))['db'][_0x2878('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2878('0x3')](0x0);var events={'afterCreate':_0x2878('0x4'),'afterUpdate':_0x2878('0x5'),'afterDestroy':_0x2878('0x6')};function emitEvent(_0x3c11bd){return function(_0x127675,_0x4a3e81,_0x198c40){UserNotificationEvents[_0x2878('0x7')](_0x3c11bd+':'+_0x127675['id'],_0x127675);UserNotificationEvents[_0x2878('0x7')](_0x3c11bd,_0x127675);_0x198c40(null);};}for(var e in events){if(events[_0x2878('0x8')](e)){var event=events[e];UserNotification[_0x2878('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 95b1390..e994e6a 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 _0x023b=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','UserNotification','userNotifications'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x023b,0x1d5));var _0xb023=function(_0x10a80f,_0x5aeb63){_0x10a80f=_0x10a80f-0x0;var _0xf68069=_0x023b[_0x10a80f];return _0xf68069;};'use strict';var _=require(_0xb023('0x0'));var util=require(_0xb023('0x1'));var logger=require(_0xb023('0x2'))('api');var moment=require(_0xb023('0x3'));var BPromise=require(_0xb023('0x4'));var rp=require(_0xb023('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb023('0x6'));var config=require(_0xb023('0x7'));var attributes=require(_0xb023('0x8'));module['exports']=function(_0x10cfdc,_0x3bc360){return _0x10cfdc['define'](_0xb023('0x9'),attributes,{'tableName':_0xb023('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb023('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6cf5=['moment','bluebird','request-promise','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x198af0,_0x592ba9){var _0x7732f9=function(_0x3a3895){while(--_0x3a3895){_0x198af0['push'](_0x198af0['shift']());}};_0x7732f9(++_0x592ba9);}(_0x6cf5,0x72));var _0x56cf=function(_0x437116,_0x3e15d8){_0x437116=_0x437116-0x0;var _0x172892=_0x6cf5[_0x437116];return _0x172892;};'use strict';var _=require(_0x56cf('0x0'));var util=require('util');var logger=require(_0x56cf('0x1'))(_0x56cf('0x2'));var moment=require(_0x56cf('0x3'));var BPromise=require(_0x56cf('0x4'));var rp=require(_0x56cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56cf('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x56cf('0x7')]=function(_0xa1abb1,_0x52623b){return _0xa1abb1[_0x56cf('0x8')](_0x56cf('0x9'),attributes,{'tableName':_0x56cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x56cf('0xb'),'collate':_0x56cf('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c07443a..de27091 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 _0xd34c=['rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','info','request\x20sent','debug','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5409b7,_0x492ceb){var _0x5be32a=function(_0x1462a8){while(--_0x1462a8){_0x5409b7['push'](_0x5409b7['shift']());}};_0x5be32a(++_0x492ceb);}(_0xd34c,0x103));var _0xcd34=function(_0x7aad15,_0x5e7f){_0x7aad15=_0x7aad15-0x0;var _0x420c7e=_0xd34c[_0x7aad15];return _0x420c7e;};'use strict';var _=require(_0xcd34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd34('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd34('0x2'))['db'];var utils=require(_0xcd34('0x3'));var logger=require(_0xcd34('0x4'))(_0xcd34('0x5'));var config=require(_0xcd34('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd34('0x7')]({'port':0x232a});config['redis']=_[_0xcd34('0x8')](config[_0xcd34('0x9')],{'host':_0xcd34('0xa'),'port':0x18eb});var socket=require(_0xcd34('0xb'))(new Redis(config['redis']));require(_0xcd34('0xc'))['register'](socket);function respondWithRpcPromise(_0x41e1d2,_0x869fb6,_0x11d41d){return new BPromise(function(_0x2e42ea,_0x3f0e5d){return client['request'](_0x41e1d2,_0x11d41d)['then'](function(_0x548b88){logger[_0xcd34('0xd')]('UserNotification,\x20%s,\x20%s',_0x869fb6,_0xcd34('0xe'));logger[_0xcd34('0xf')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x869fb6,'request\x20sent',JSON['stringify'](_0x548b88));if(_0x548b88[_0xcd34('0x10')]){if(_0x548b88[_0xcd34('0x10')][_0xcd34('0x11')]===0x1f4){logger['error'](_0xcd34('0x12'),_0x869fb6,_0x548b88[_0xcd34('0x10')][_0xcd34('0x13')]);return _0x3f0e5d(_0x548b88[_0xcd34('0x10')]['message']);}logger[_0xcd34('0x10')](_0xcd34('0x12'),_0x869fb6,_0x548b88[_0xcd34('0x10')][_0xcd34('0x13')]);return _0x2e42ea(_0x548b88[_0xcd34('0x10')][_0xcd34('0x13')]);}else{logger[_0xcd34('0xd')](_0xcd34('0x12'),_0x869fb6,_0xcd34('0xe'));_0x2e42ea(_0x548b88[_0xcd34('0x14')][_0xcd34('0x13')]);}})[_0xcd34('0x15')](function(_0x1c2b6e){logger[_0xcd34('0x10')](_0xcd34('0x12'),_0x869fb6,_0x1c2b6e);_0x3f0e5d(_0x1c2b6e);});});} \ No newline at end of file +var _0xb09e=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent'];(function(_0x2ef643,_0x3bca06){var _0x22e230=function(_0x3193c2){while(--_0x3193c2){_0x2ef643['push'](_0x2ef643['shift']());}};_0x22e230(++_0x3bca06);}(_0xb09e,0x11b));var _0xeb09=function(_0x5757e8,_0x232eef){_0x5757e8=_0x5757e8-0x0;var _0x42d6af=_0xb09e[_0x5757e8];return _0x42d6af;};'use strict';var _=require(_0xeb09('0x0'));var util=require(_0xeb09('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb09('0x2'));var fs=require('fs');var Redis=require(_0xeb09('0x3'));var db=require(_0xeb09('0x4'))['db'];var utils=require(_0xeb09('0x5'));var logger=require(_0xeb09('0x6'))(_0xeb09('0x7'));var config=require(_0xeb09('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xeb09('0x9')]=_[_0xeb09('0xa')](config[_0xeb09('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb09('0xb'))(new Redis(config[_0xeb09('0x9')]));require(_0xeb09('0xc'))[_0xeb09('0xd')](socket);function respondWithRpcPromise(_0x5ecb96,_0x5821f6,_0x2710bc){return new BPromise(function(_0xd5ec11,_0x4c899d){return client[_0xeb09('0xe')](_0x5ecb96,_0x2710bc)['then'](function(_0xedc730){logger[_0xeb09('0xf')]('UserNotification,\x20%s,\x20%s',_0x5821f6,_0xeb09('0x10'));logger['debug'](_0xeb09('0x11'),_0x5821f6,'request\x20sent',JSON[_0xeb09('0x12')](_0xedc730));if(_0xedc730[_0xeb09('0x13')]){if(_0xedc730[_0xeb09('0x13')][_0xeb09('0x14')]===0x1f4){logger[_0xeb09('0x13')](_0xeb09('0x15'),_0x5821f6,_0xedc730[_0xeb09('0x13')][_0xeb09('0x16')]);return _0x4c899d(_0xedc730[_0xeb09('0x13')][_0xeb09('0x16')]);}logger[_0xeb09('0x13')]('UserNotification,\x20%s,\x20%s',_0x5821f6,_0xedc730['error'][_0xeb09('0x16')]);return _0xd5ec11(_0xedc730[_0xeb09('0x13')][_0xeb09('0x16')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x5821f6,'request\x20sent');_0xd5ec11(_0xedc730[_0xeb09('0x17')][_0xeb09('0x16')]);}})[_0xeb09('0x18')](function(_0x4d33fe){logger[_0xeb09('0x13')](_0xeb09('0x15'),_0x5821f6,_0x4d33fe);_0x4c899d(_0x4d33fe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6ca1811..0cdc754 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 _0xcb09=['register','length','userNotification:','save','emit'];(function(_0x254e46,_0x4ee9b4){var _0x9928e5=function(_0x5a69b2){while(--_0x5a69b2){_0x254e46['push'](_0x254e46['shift']());}};_0x9928e5(++_0x4ee9b4);}(_0xcb09,0x1cf));var _0x9cb0=function(_0x2c1dfd,_0x4f39c7){_0x2c1dfd=_0x2c1dfd-0x0;var _0x32fafc=_0xcb09[_0x2c1dfd];return _0x32fafc;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x9cb0('0x0'),'remove','update'];function createListener(_0x449978,_0x5660f8){return function(_0x1d15a9){_0x5660f8[_0x9cb0('0x1')](_0x449978,_0x1d15a9);};}function removeListener(_0x11c8d0,_0x3145ee){return function(){UserNotificationEvents['removeListener'](_0x11c8d0,_0x3145ee);};}exports[_0x9cb0('0x2')]=function(_0x1de358){for(var _0x2782e0=0x0,_0x408ee5=events[_0x9cb0('0x3')];_0x2782e0<_0x408ee5;_0x2782e0++){var _0x4b32b2=events[_0x2782e0];var _0x510522=createListener(_0x9cb0('0x4')+_0x4b32b2,_0x1de358);UserNotificationEvents['on'](_0x4b32b2,_0x510522);}}; \ No newline at end of file +var _0x4410=['length','userNotification:','update','emit','removeListener','register'];(function(_0x3773b6,_0x879b5e){var _0x4240d4=function(_0x3eb1dd){while(--_0x3eb1dd){_0x3773b6['push'](_0x3773b6['shift']());}};_0x4240d4(++_0x879b5e);}(_0x4410,0x194));var _0x0441=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4410[_0xc4001c];return _0x49f7bc;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x0441('0x0')];function createListener(_0x29e653,_0x2c5f68){return function(_0x37460e){_0x2c5f68[_0x0441('0x1')](_0x29e653,_0x37460e);};}function removeListener(_0x375e9b,_0x4d1c15){return function(){UserNotificationEvents[_0x0441('0x2')](_0x375e9b,_0x4d1c15);};}exports[_0x0441('0x3')]=function(_0x1b76b6){for(var _0x9cb7d2=0x0,_0x1b891a=events[_0x0441('0x4')];_0x9cb7d2<_0x1b891a;_0x9cb7d2++){var _0x43a217=events[_0x9cb7d2];var _0x21bf7a=createListener(_0x0441('0x5')+_0x43a217,_0x1b76b6);UserNotificationEvents['on'](_0x43a217,_0x21bf7a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e379541..d418b5d 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x368bf4,_0x25c06f){var _0x3b65dd=function(_0x4d2727){while(--_0x4d2727){_0x368bf4['push'](_0x368bf4['shift']());}};_0x3b65dd(++_0x25c06f);}(_0x70e0,0x17b));var _0x070e=function(_0x5af008,_0x4f6c02){_0x5af008=_0x5af008-0x0;var _0x513ca6=_0x70e0[_0x5af008];return _0x513ca6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5ae350,_0x24edc7){var _0x4e3073=function(_0x22cfed){while(--_0x22cfed){_0x5ae350['push'](_0x5ae350['shift']());}};_0x4e3073(++_0x24edc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 91bcdd9..793976e 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 _0x6138=['exports','INTEGER'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x6138,0xbe));var _0x8613=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6138[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x8613('0x0')]={'penalty':{'type':Sequelize[_0x8613('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x49d7=['sequelize','exports'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0x49d7,0x78));var _0x749d=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x49d7[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0x749d('0x0'));module[_0x749d('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 067ca0a..18b90a7 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 _0xaa04=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xf442ef,_0x371451){var _0x288a57=function(_0x202c2d){while(--_0x202c2d){_0xf442ef['push'](_0xf442ef['shift']());}};_0x288a57(++_0x371451);}(_0xaa04,0xd6));var _0x4aa0=function(_0x57d3cf,_0x23cf22){_0x57d3cf=_0x57d3cf-0x0;var _0x12e1c2=_0xaa04[_0x57d3cf];return _0x12e1c2;};'use strict';var _=require('lodash');var util=require(_0x4aa0('0x0'));var logger=require(_0x4aa0('0x1'))(_0x4aa0('0x2'));var moment=require(_0x4aa0('0x3'));var BPromise=require(_0x4aa0('0x4'));var rp=require(_0x4aa0('0x5'));var fs=require('fs');var path=require(_0x4aa0('0x6'));var rimraf=require('rimraf');var config=require(_0x4aa0('0x7'));var attributes=require(_0x4aa0('0x8'));module[_0x4aa0('0x9')]=function(_0x57cdd9,_0x5d187b){return _0x57cdd9[_0x4aa0('0xa')](_0x4aa0('0xb'),attributes,{'tableName':_0x4aa0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5888=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4cc32c,_0x2f3921){var _0x23ef2c=function(_0x578a27){while(--_0x578a27){_0x4cc32c['push'](_0x4cc32c['shift']());}};_0x23ef2c(++_0x2f3921);}(_0x5888,0xbe));var _0x8588=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x5888[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x8588('0x0'));var util=require(_0x8588('0x1'));var logger=require(_0x8588('0x2'))('api');var moment=require(_0x8588('0x3'));var BPromise=require(_0x8588('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8588('0x5'));var rimraf=require(_0x8588('0x6'));var config=require(_0x8588('0x7'));var attributes=require(_0x8588('0x8'));module[_0x8588('0x9')]=function(_0x2df316,_0x1dd9a9){return _0x2df316[_0x8588('0xa')](_0x8588('0xb'),attributes,{'tableName':_0x8588('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 35cc47e..e59b9e8 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 _0x8fda=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x8fda,0xd6));var _0xa8fd=function(_0x1ebb7,_0x4b2af7){_0x1ebb7=_0x1ebb7-0x0;var _0x301f45=_0x8fda[_0x1ebb7];return _0x301f45;};'use strict';var _=require(_0xa8fd('0x0'));var util=require(_0xa8fd('0x1'));var moment=require(_0xa8fd('0x2'));var BPromise=require(_0xa8fd('0x3'));var rs=require(_0xa8fd('0x4'));var fs=require('fs');var Redis=require(_0xa8fd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8fd('0x6'));var logger=require('../../config/logger')(_0xa8fd('0x7'));var config=require(_0xa8fd('0x8'));var jayson=require(_0xa8fd('0x9'));var client=jayson['client'][_0xa8fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d0330,_0x39354d,_0x1cc222){return new BPromise(function(_0x3941d2,_0x115289){return client[_0xa8fd('0xb')](_0x4d0330,_0x1cc222)['then'](function(_0x241d7a){logger[_0xa8fd('0xc')](_0xa8fd('0xd'),_0x39354d,_0xa8fd('0xe'));logger[_0xa8fd('0xf')](_0xa8fd('0x10'),_0x39354d,'request\x20sent',JSON['stringify'](_0x241d7a));if(_0x241d7a['error']){if(_0x241d7a[_0xa8fd('0x11')]['code']===0x1f4){logger['error'](_0xa8fd('0xd'),_0x39354d,_0x241d7a[_0xa8fd('0x11')][_0xa8fd('0x12')]);return _0x115289(_0x241d7a[_0xa8fd('0x11')][_0xa8fd('0x12')]);}logger[_0xa8fd('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x39354d,_0x241d7a[_0xa8fd('0x11')][_0xa8fd('0x12')]);return _0x3941d2(_0x241d7a['error'][_0xa8fd('0x12')]);}else{logger[_0xa8fd('0xc')](_0xa8fd('0xd'),_0x39354d,_0xa8fd('0xe'));_0x3941d2(_0x241d7a['result'][_0xa8fd('0x12')]);}})[_0xa8fd('0x13')](function(_0x3aba95){logger[_0xa8fd('0x11')](_0xa8fd('0xd'),_0x39354d,_0x3aba95);_0x115289(_0x3aba95);});});} \ No newline at end of file +var _0x3e64=['code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xcd26a9,_0x512e77){var _0x3afcbc=function(_0x40e770){while(--_0x40e770){_0xcd26a9['push'](_0xcd26a9['shift']());}};_0x3afcbc(++_0x512e77);}(_0x3e64,0x1df));var _0x43e6=function(_0x370157,_0x11077f){_0x370157=_0x370157-0x0;var _0x5495c6=_0x3e64[_0x370157];return _0x5495c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43e6('0x0'));var BPromise=require(_0x43e6('0x1'));var rs=require(_0x43e6('0x2'));var fs=require('fs');var Redis=require(_0x43e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e6('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x43e6('0x5'));var client=jayson[_0x43e6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4512bf,_0x3b92f3,_0x4c1f11){return new BPromise(function(_0x34da6b,_0x280722){return client[_0x43e6('0x7')](_0x4512bf,_0x4c1f11)[_0x43e6('0x8')](function(_0x5b54a3){logger[_0x43e6('0x9')](_0x43e6('0xa'),_0x3b92f3,'request\x20sent');logger[_0x43e6('0xb')](_0x43e6('0xc'),_0x3b92f3,'request\x20sent',JSON[_0x43e6('0xd')](_0x5b54a3));if(_0x5b54a3[_0x43e6('0xe')]){if(_0x5b54a3[_0x43e6('0xe')][_0x43e6('0xf')]===0x1f4){logger[_0x43e6('0xe')](_0x43e6('0xa'),_0x3b92f3,_0x5b54a3['error'][_0x43e6('0x10')]);return _0x280722(_0x5b54a3[_0x43e6('0xe')]['message']);}logger['error'](_0x43e6('0xa'),_0x3b92f3,_0x5b54a3['error'][_0x43e6('0x10')]);return _0x34da6b(_0x5b54a3['error'][_0x43e6('0x10')]);}else{logger[_0x43e6('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3b92f3,_0x43e6('0x11'));_0x34da6b(_0x5b54a3[_0x43e6('0x12')][_0x43e6('0x10')]);}})['catch'](function(_0x3e276d){logger['error'](_0x43e6('0xa'),_0x3b92f3,_0x3e276d);_0x280722(_0x3e276d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9feabcd..bcebdbb 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 _0x636e=['post','addSections','addResources','put','/:id','delete','removeResources','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','/describe','describe','isAuthenticated','show','/:id/sections','/:id/resources','getResources','create'];(function(_0x1face4,_0x4df6e0){var _0x2fc712=function(_0xccff27){while(--_0xccff27){_0x1face4['push'](_0x1face4['shift']());}};_0x2fc712(++_0x4df6e0);}(_0x636e,0x11b));var _0xe636=function(_0x3556b2,_0x9949b7){_0x3556b2=_0x3556b2-0x0;var _0x76dc0d=_0x636e[_0x3556b2];return _0x76dc0d;};'use strict';var multer=require(_0xe636('0x0'));var util=require('util');var path=require(_0xe636('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe636('0x2')]();var fs_extra=require(_0xe636('0x3'));var auth=require(_0xe636('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe636('0x5'));var controller=require(_0xe636('0x6'));router[_0xe636('0x7')]('/',auth['isAuthenticated'](),controller[_0xe636('0x8')]);router['get'](_0xe636('0x9'),auth['isAuthenticated'](),controller[_0xe636('0xa')]);router[_0xe636('0x7')]('/:id',auth[_0xe636('0xb')](),controller[_0xe636('0xc')]);router[_0xe636('0x7')](_0xe636('0xd'),auth['isAuthenticated'](),controller['getSections']);router[_0xe636('0x7')](_0xe636('0xe'),auth[_0xe636('0xb')](),controller[_0xe636('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe636('0x10')]);router[_0xe636('0x11')]('/:id/clone',auth[_0xe636('0xb')](),controller['clone']);router['post'](_0xe636('0xd'),auth['isAuthenticated'](),controller[_0xe636('0x12')]);router[_0xe636('0x11')](_0xe636('0xe'),auth['isAuthenticated'](),controller[_0xe636('0x13')]);router[_0xe636('0x14')](_0xe636('0x15'),auth[_0xe636('0xb')](),controller['update']);router[_0xe636('0x16')](_0xe636('0x15'),auth[_0xe636('0xb')](),controller['destroy']);router[_0xe636('0x16')](_0xe636('0xd'),auth[_0xe636('0xb')](),controller['removeSections']);router['delete'](_0xe636('0xe'),auth['isAuthenticated'](),controller[_0xe636('0x17')]);module[_0xe636('0x18')]=router; \ No newline at end of file +var _0xb63f=['/:id/resources','getResources','create','post','clone','/:id/sections','addSections','addResources','put','update','delete','removeSections','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getSections'];(function(_0x1c45bb,_0x48f37e){var _0x10060c=function(_0x501e15){while(--_0x501e15){_0x1c45bb['push'](_0x1c45bb['shift']());}};_0x10060c(++_0x48f37e);}(_0xb63f,0x193));var _0xfb63=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0xb63f[_0x580b15];return _0x1adb1b;};'use strict';var multer=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var path=require('path');var timeout=require(_0xfb63('0x2'));var express=require(_0xfb63('0x3'));var router=express[_0xfb63('0x4')]();var fs_extra=require(_0xfb63('0x5'));var auth=require(_0xfb63('0x6'));var interaction=require(_0xfb63('0x7'));var config=require('../../config/environment');var controller=require(_0xfb63('0x8'));router[_0xfb63('0x9')]('/',auth[_0xfb63('0xa')](),controller[_0xfb63('0xb')]);router[_0xfb63('0x9')](_0xfb63('0xc'),auth[_0xfb63('0xa')](),controller[_0xfb63('0xd')]);router[_0xfb63('0x9')](_0xfb63('0xe'),auth[_0xfb63('0xa')](),controller[_0xfb63('0xf')]);router[_0xfb63('0x9')]('/:id/sections',auth[_0xfb63('0xa')](),controller[_0xfb63('0x10')]);router['get'](_0xfb63('0x11'),auth['isAuthenticated'](),controller[_0xfb63('0x12')]);router['post']('/',auth[_0xfb63('0xa')](),controller[_0xfb63('0x13')]);router[_0xfb63('0x14')]('/:id/clone',auth[_0xfb63('0xa')](),controller[_0xfb63('0x15')]);router[_0xfb63('0x14')](_0xfb63('0x16'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x17')]);router['post'](_0xfb63('0x11'),auth['isAuthenticated'](),controller[_0xfb63('0x18')]);router[_0xfb63('0x19')](_0xfb63('0xe'),auth['isAuthenticated'](),controller[_0xfb63('0x1a')]);router[_0xfb63('0x1b')]('/:id',auth[_0xfb63('0xa')](),controller['destroy']);router[_0xfb63('0x1b')](_0xfb63('0x16'),auth['isAuthenticated'](),controller[_0xfb63('0x1c')]);router[_0xfb63('0x1b')]('/:id/resources',auth[_0xfb63('0xa')](),controller['removeResources']);module[_0xfb63('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6df8e18..6e4291f 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 _0x2a22=['BOOLEAN','sequelize','exports','STRING','name','crudPermissions','getDataValue','split'];(function(_0x582735,_0x459b0f){var _0x3e9af1=function(_0x182bed){while(--_0x182bed){_0x582735['push'](_0x582735['shift']());}};_0x3e9af1(++_0x459b0f);}(_0x2a22,0x171));var _0x22a2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x2a22[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x22a2('0x0'));module[_0x22a2('0x1')]={'name':{'type':Sequelize[_0x22a2('0x2')],'allowNull':![],'unique':_0x22a2('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3b77d9){this['setDataValue'](_0x22a2('0x4'),_0x3b77d9?_0x3b77d9['join'](''):[]);},'get':function(){return this[_0x22a2('0x5')]('crudPermissions')?this[_0x22a2('0x5')]('crudPermissions')[_0x22a2('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x22a2('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x22a2('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x22a2('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x22a2('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x22a2('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x988d=['sequelize','exports','name','STRING','setDataValue','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x392358,_0x351ac6){var _0xee612f=function(_0x42bd93){while(--_0x42bd93){_0x392358['push'](_0x392358['shift']());}};_0xee612f(++_0x351ac6);}(_0x988d,0xc6));var _0xd988=function(_0x174718,_0x2c3e7b){_0x174718=_0x174718-0x0;var _0x54fe3b=_0x988d[_0x174718];return _0x54fe3b;};'use strict';var Sequelize=require(_0xd988('0x0'));module[_0xd988('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd988('0x2')},'crudPermissions':{'type':Sequelize[_0xd988('0x3')],'set':function(_0x3a293a){this[_0xd988('0x4')](_0xd988('0x5'),_0x3a293a?_0x3a293a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xd988('0x6')](_0xd988('0x5'))[_0xd988('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd988('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd988('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 132c630..55278f6 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 _0x3840=['get','omit','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','createdAt','updatedAt','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','push','getSections','enabled','isEmpty','subsections','includes','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','catch','params'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3840,0x8f));var _0x0384=function(_0x5e4088,_0x37c9d7){_0x5e4088=_0x5e4088-0x0;var _0x3d1cbe=_0x3840[_0x5e4088];return _0x3d1cbe;};'use strict';var emlformat=require(_0x0384('0x0'));var rimraf=require(_0x0384('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0384('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0384('0x3'));var Mustache=require(_0x0384('0x4'));var util=require(_0x0384('0x5'));var path=require('path');var sox=require(_0x0384('0x6'));var csv=require(_0x0384('0x7'));var ejs=require(_0x0384('0x8'));var fs=require('fs');var fs_extra=require(_0x0384('0x9'));var _=require(_0x0384('0xa'));var squel=require(_0x0384('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0384('0xc'));var toCsv=require(_0x0384('0x7'));var querystring=require(_0x0384('0xd'));var Papa=require(_0x0384('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0384('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0384('0x10'))(_0x0384('0x11'));var utils=require(_0x0384('0x12'));var config=require(_0x0384('0x13'));var licenseUtil=require(_0x0384('0x14'));var db=require('../../mysqldb')['db'];config[_0x0384('0x15')]=_['defaults'](config[_0x0384('0x15')],{'host':_0x0384('0x16'),'port':0x18eb});var socket=require(_0x0384('0x17'))(new Redis(config[_0x0384('0x15')]));require(_0x0384('0x18'))['register'](socket);function respondWithStatusCode(_0x2ae600,_0x3d44ce){_0x3d44ce=_0x3d44ce||0xcc;return function(_0x3c4e23){if(_0x3c4e23){return _0x2ae600[_0x0384('0x19')](_0x3d44ce);}return _0x2ae600[_0x0384('0x1a')](_0x3d44ce)[_0x0384('0x1b')]();};}function respondWithResult(_0x1f3566,_0x367e46){_0x367e46=_0x367e46||0xc8;return function(_0x2fae64){if(_0x2fae64){return _0x1f3566[_0x0384('0x1a')](_0x367e46)[_0x0384('0x1c')](_0x2fae64);}};}function respondWithFilteredResult(_0xfeaac1,_0x320f2c){return function(_0x548ce7){if(_0x548ce7){var _0x1274f5=typeof _0x320f2c['offset']===_0x0384('0x1d')&&typeof _0x320f2c[_0x0384('0x1e')]===_0x0384('0x1d');var _0x10fb79=_0x548ce7[_0x0384('0x1f')];var _0xa8c993=_0x1274f5?0x0:_0x320f2c['offset'];var _0x561524=_0x1274f5?_0x548ce7['count']:_0x320f2c[_0x0384('0x20')]+_0x320f2c[_0x0384('0x1e')];var _0x466d2e;if(_0x561524>=_0x10fb79){_0x561524=_0x10fb79;_0x466d2e=0xc8;}else{_0x466d2e=0xce;}_0xfeaac1['status'](_0x466d2e);return _0xfeaac1[_0x0384('0x21')](_0x0384('0x22'),_0xa8c993+'-'+_0x561524+'/'+_0x10fb79)[_0x0384('0x1c')](_0x548ce7);}return null;};}function patchUpdates(_0x18875a){return function(_0x122fd4){try{jsonpatch[_0x0384('0x23')](_0x122fd4,_0x18875a,!![]);}catch(_0x1a5e2f){return BPromise['reject'](_0x1a5e2f);}return _0x122fd4['save']();};}function saveUpdates(_0x503e2c,_0x189902){return function(_0x4f9afc){if(_0x4f9afc){return _0x4f9afc[_0x0384('0x24')](_0x503e2c)[_0x0384('0x25')](function(_0x4f11a3){return _0x4f11a3;});}return null;};}function removeEntity(_0x211b02,_0x115cf4){return function(_0x594208){if(_0x594208){return _0x594208[_0x0384('0x26')]()[_0x0384('0x25')](function(){_0x211b02[_0x0384('0x1a')](0xcc)[_0x0384('0x1b')]();});}};}function handleEntityNotFound(_0x1fbdd2,_0x3dcb16){return function(_0x496dcb){if(!_0x496dcb){_0x1fbdd2[_0x0384('0x19')](0x194);}return _0x496dcb;};}function handleError(_0x26ba15,_0x4e1f5){_0x4e1f5=_0x4e1f5||0x1f4;return function(_0x2763d1){logger['error'](_0x2763d1[_0x0384('0x27')]);if(_0x2763d1[_0x0384('0x28')]){delete _0x2763d1[_0x0384('0x28')];}_0x26ba15[_0x0384('0x1a')](_0x4e1f5)[_0x0384('0x29')](_0x2763d1);};}exports[_0x0384('0x2a')]=function(_0x4427c9,_0x4f227e){var _0x437406={},_0xe97450={},_0x56ac3a={'count':0x0,'rows':[]};var _0x4c16bf=_[_0x0384('0x2b')](db[_0x0384('0x2c')][_0x0384('0x2d')],function(_0x28fad0){return{'name':_0x28fad0[_0x0384('0x2e')],'type':_0x28fad0[_0x0384('0x2f')][_0x0384('0x30')]};});_0xe97450[_0x0384('0x31')]=_[_0x0384('0x2b')](_0x4c16bf,'name');_0xe97450[_0x0384('0x32')]=_[_0x0384('0x33')](_0x4427c9['query']);_0xe97450[_0x0384('0x34')]=_['intersection'](_0xe97450[_0x0384('0x31')],_0xe97450[_0x0384('0x32')]);_0x437406[_0x0384('0x35')]=_[_0x0384('0x36')](_0xe97450[_0x0384('0x31')],qs[_0x0384('0x37')](_0x4427c9[_0x0384('0x32')]['fields']));_0x437406['attributes']=_0x437406['attributes'][_0x0384('0x38')]?_0x437406['attributes']:_0xe97450[_0x0384('0x31')];if(!_0x4427c9[_0x0384('0x32')]['hasOwnProperty']('nolimit')){_0x437406[_0x0384('0x1e')]=qs['limit'](_0x4427c9[_0x0384('0x32')][_0x0384('0x1e')]);_0x437406[_0x0384('0x20')]=qs[_0x0384('0x20')](_0x4427c9[_0x0384('0x32')][_0x0384('0x20')]);}_0x437406[_0x0384('0x39')]=qs[_0x0384('0x3a')](_0x4427c9['query']['sort']);_0x437406[_0x0384('0x3b')]=qs['filters'](_[_0x0384('0x3c')](_0x4427c9[_0x0384('0x32')],_0xe97450[_0x0384('0x34')]),_0x4c16bf);if(_0x4427c9['query'][_0x0384('0x3d')]){_0x437406[_0x0384('0x3b')]=_[_0x0384('0x3e')](_0x437406['where'],{'$or':_[_0x0384('0x2b')](_0x4c16bf,function(_0x276ff6){if(_0x276ff6['type']!==_0x0384('0x3f')){var _0x3abad3={};_0x3abad3[_0x276ff6[_0x0384('0x28')]]={'$like':'%'+_0x4427c9[_0x0384('0x32')]['filter']+'%'};return _0x3abad3;}})});}_0x437406=_[_0x0384('0x3e')]({},_0x437406,_0x4427c9[_0x0384('0x40')]);var _0x4a747b={'where':_0x437406[_0x0384('0x3b')]};return db[_0x0384('0x2c')][_0x0384('0x1f')](_0x4a747b)[_0x0384('0x25')](function(_0x44da46){_0x56ac3a[_0x0384('0x1f')]=_0x44da46;if(_0x4427c9[_0x0384('0x32')][_0x0384('0x41')]){_0x437406[_0x0384('0x42')]=[{'all':!![]}];}return db[_0x0384('0x2c')][_0x0384('0x43')](_0x437406);})[_0x0384('0x25')](function(_0x47fe90){_0x56ac3a[_0x0384('0x44')]=_0x47fe90;return _0x56ac3a;})[_0x0384('0x25')](respondWithFilteredResult(_0x4f227e,_0x437406))['catch'](handleError(_0x4f227e,null));};exports['show']=function(_0x30cb5f,_0x30cf15){var _0xa1f3ed={'raw':![],'where':{'id':_0x30cb5f['params']['id']}},_0x5dc23e={};_0x5dc23e[_0x0384('0x31')]=_['keys'](db[_0x0384('0x2c')]['rawAttributes']);_0x5dc23e[_0x0384('0x32')]=_[_0x0384('0x33')](_0x30cb5f[_0x0384('0x32')]);_0x5dc23e[_0x0384('0x34')]=_[_0x0384('0x36')](_0x5dc23e[_0x0384('0x31')],_0x5dc23e[_0x0384('0x32')]);_0xa1f3ed[_0x0384('0x35')]=_[_0x0384('0x36')](_0x5dc23e['model'],qs['fields'](_0x30cb5f['query'][_0x0384('0x37')]));_0xa1f3ed[_0x0384('0x35')]=_0xa1f3ed[_0x0384('0x35')][_0x0384('0x38')]?_0xa1f3ed[_0x0384('0x35')]:_0x5dc23e[_0x0384('0x31')];if(_0x30cb5f[_0x0384('0x32')][_0x0384('0x41')]){_0xa1f3ed[_0x0384('0x42')]=[{'all':!![]}];}_0xa1f3ed=_[_0x0384('0x3e')]({},_0xa1f3ed,_0x30cb5f['options']);return db[_0x0384('0x2c')][_0x0384('0x45')](_0xa1f3ed)['then'](handleEntityNotFound(_0x30cf15,null))['then'](respondWithResult(_0x30cf15,null))['catch'](handleError(_0x30cf15,null));};exports[_0x0384('0x46')]=function(_0x567d39,_0x3c2f27){return db[_0x0384('0x2c')][_0x0384('0x46')](_0x567d39['body'],{})[_0x0384('0x25')](respondWithResult(_0x3c2f27,0xc9))[_0x0384('0x47')](handleError(_0x3c2f27,null));};exports['clone']=function(_0x25c9f3,_0x5d8ed3){var _0x1f5562={'where':{'id':_0x25c9f3[_0x0384('0x48')]['id']}},_0x483453={};_0x483453[_0x0384('0x31')]=_[_0x0384('0x33')](db[_0x0384('0x2c')][_0x0384('0x2d')]);_0x1f5562['attributes']=_['intersection'](_0x483453[_0x0384('0x31')],qs[_0x0384('0x37')](_0x25c9f3['query'][_0x0384('0x37')]));_0x1f5562['attributes']=_0x1f5562[_0x0384('0x35')][_0x0384('0x38')]?_0x1f5562[_0x0384('0x35')]:_0x483453[_0x0384('0x31')];if(_0x25c9f3[_0x0384('0x32')]['includeAll']){_0x1f5562['include']=[{'all':!![]}];}_0x1f5562=_['merge']({},_0x1f5562,_0x25c9f3[_0x0384('0x40')]);return db[_0x0384('0x2c')][_0x0384('0x45')](_0x1f5562)[_0x0384('0x25')](handleEntityNotFound(_0x5d8ed3,null))[_0x0384('0x25')](function(_0x2e9976){if(_0x2e9976){var _0x28b840=_0x2e9976[_0x0384('0x49')]({'plain':!![]});_0x28b840=qs[_0x0384('0x4a')](_0x28b840,['id','createdAt','updatedAt',_0x0384('0x4b')]);_0x25c9f3[_0x0384('0x4c')]=_[_0x0384('0x4a')](_0x25c9f3[_0x0384('0x4c')],['id','createdAt','updatedAt']);return db[_0x0384('0x4d')][_0x0384('0x4e')](function(_0x25a3fe){return db['UserProfile'][_0x0384('0x46')](_[_0x0384('0x3e')](_0x28b840,_0x25c9f3[_0x0384('0x4c')]),{'include':_0x25c9f3[_0x0384('0x32')][_0x0384('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x25a3fe})[_0x0384('0x25')](function(_0x25f713){var _0x1e09bf=_0x25f713[_0x0384('0x49')]({'plain':!![]});return db[_0x0384('0x4f')][_0x0384('0x43')]({'where':{'userProfileId':_0x25c9f3[_0x0384('0x48')]['id']},'raw':!![]})['then'](function(_0x261e5d){if(_0x261e5d){return BPromise[_0x0384('0x50')](_0x261e5d,function(_0x923997){return new BPromise(function(_0xf15744,_0x2f898f){if(_0x923997['autoAssociation']===null||_0x923997[_0x0384('0x51')]===0x1)_0xf15744(null);return db['UserProfileResource'][_0x0384('0x43')]({'where':{'sectionId':_0x923997['id']},'raw':!![]})[_0x0384('0x25')](function(_0x4058d4){var _0x54bb5e=_[_0x0384('0x2b')](_0x4058d4,function(_0x4cf15b){return qs[_0x0384('0x4a')](_0x4cf15b,['id',_0x0384('0x52'),_0x0384('0x53'),_0x0384('0x54')]);});_0xf15744(_0x54bb5e);})[_0x0384('0x47')](function(_0x3b1067){_0x2f898f(_0x3b1067);});})[_0x0384('0x25')](function(_0x125e05){var _0x201f03=qs['omit'](_0x923997,['id','createdAt',_0x0384('0x53')]);_0x201f03[_0x0384('0x55')]=_0x1e09bf['id'];if(_0x125e05)_0x201f03[_0x0384('0x56')]=_0x125e05;return _0x201f03;})['then'](function(_0x57e4a9){return db[_0x0384('0x4f')][_0x0384('0x46')](_0x57e4a9,{'include':[{'model':db[_0x0384('0x57')],'as':_0x0384('0x56')}],'raw':!![],'transaction':_0x25a3fe});});})[_0x0384('0x25')](function(){return _0x1e09bf;});}});});});}})['then'](respondWithResult(_0x5d8ed3,0xc9))[_0x0384('0x47')](handleError(_0x5d8ed3,null));};exports[_0x0384('0x24')]=function(_0xdcdc34,_0x3a8496){if(_0xdcdc34[_0x0384('0x4c')]['id']){delete _0xdcdc34[_0x0384('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0xdcdc34[_0x0384('0x48')]['id']}})[_0x0384('0x25')](handleEntityNotFound(_0x3a8496,null))['then'](saveUpdates(_0xdcdc34[_0x0384('0x4c')],null))[_0x0384('0x25')](respondWithResult(_0x3a8496,null))[_0x0384('0x47')](handleError(_0x3a8496,null));};exports[_0x0384('0x26')]=function(_0x3c58c7,_0x4859b1){return db[_0x0384('0x2c')]['find']({'where':{'id':_0x3c58c7['params']['id']}})[_0x0384('0x25')](handleEntityNotFound(_0x4859b1,null))[_0x0384('0x25')](removeEntity(_0x4859b1,null))[_0x0384('0x47')](handleError(_0x4859b1,null));};exports[_0x0384('0x58')]=function(_0x723aaf,_0x466c60){return db[_0x0384('0x2c')][_0x0384('0x58')]()[_0x0384('0x25')](respondWithResult(_0x466c60,null))[_0x0384('0x47')](handleError(_0x466c60,null));};exports[_0x0384('0x59')]=function(_0x17089e,_0x27a32f){var _0x32da9d=_0x17089e[_0x0384('0x4c')];return db[_0x0384('0x2c')]['find']({'where':{'id':_0x17089e['params']['id']}})['then'](handleEntityNotFound(_0x27a32f,null))[_0x0384('0x25')](function(_0x537a28){if(_0x537a28){return db['sequelize']['transaction'](function(_0x352c6a){return db[_0x0384('0x4f')][_0x0384('0x26')]({'where':{'userProfileId':_0x17089e['params']['id'],'sectionId':_[_0x0384('0x2b')](_0x32da9d,function(_0x1a933f){return _0x1a933f[_0x0384('0x54')];})},'transaction':_0x352c6a})[_0x0384('0x25')](function(){var _0xb18624=_[_0x0384('0x2b')](_0x32da9d,function(_0x49f522){_0x49f522[_0x0384('0x55')]=_0x17089e[_0x0384('0x48')]['id'];return _0x49f522;});var _0x45979b=[];return BPromise['each'](_0xb18624,function(_0xb41f03){return db[_0x0384('0x4f')][_0x0384('0x46')](_0xb41f03,{'include':[{'model':db[_0x0384('0x57')],'as':_0x0384('0x56')}],'raw':!![],'transaction':_0x352c6a})['then'](function(_0x1ea781){_0x45979b[_0x0384('0x5a')](_0x1ea781[_0x0384('0x49')]({'plain':!![]}));});})[_0x0384('0x25')](function(){return _0x45979b;});});});}})[_0x0384('0x25')](function(_0x174fc0){return _0x174fc0;})[_0x0384('0x25')](respondWithResult(_0x27a32f,null))['catch'](handleError(_0x27a32f,null));};exports['removeSections']=function(_0x1362cc,_0xef3957){var _0x56e871;return db['UserProfile'][_0x0384('0x45')]({'where':{'id':_0x1362cc['params']['id']},'attributes':['id',_0x0384('0x28')]})['then'](handleEntityNotFound(_0xef3957,null))[_0x0384('0x25')](function(_0x1b8364){if(_0x1b8364){_0x56e871=_0x1b8364;return db[_0x0384('0x4f')][_0x0384('0x26')]({'where':{'userProfileId':_0x1362cc[_0x0384('0x48')]['id'],'sectionId':_0x1362cc[_0x0384('0x32')]['ids']}});}})[_0x0384('0x25')](function(){return _0x56e871;})[_0x0384('0x25')](respondWithStatusCode(_0xef3957,null))[_0x0384('0x47')](handleError(_0xef3957,null));};exports[_0x0384('0x5b')]=function(_0x4ca05c,_0x34f251){var _0x53c291=[];var _0x54c79e=[];return db['UserProfileSection'][_0x0384('0x43')]({'where':{'userProfileId':_0x4ca05c['params']['id']},'raw':!![]})[_0x0384('0x25')](function(_0x58a4b8){_0x53c291=_[_0x0384('0x3d')](_0x58a4b8,function(_0x3fbcfe){return _0x3fbcfe[_0x0384('0x5c')]===0x1||_['includes']([0x3eb,0x709],_0x3fbcfe['sectionId']);});if(!_[_0x0384('0x5d')](_0x53c291)){return _[_0x0384('0x2b')](_0x53c291,function(_0x3b7bc3){return _0x3b7bc3[_0x0384('0x54')];});}else{return;}})['then'](function(_0x3d0185){if(_0x3d0185)_0x54c79e=_0x3d0185;if(_['includes'](_0x54c79e,0x64)){var _0xe3a6fd=_['find'](_0x53c291,{'sectionId':0x64});return hasDefaultDashboard(_0xe3a6fd)['then'](function(_0x4bd43d){return _[_0x0384('0x2b')](_0x53c291,function(_0x4fbb75){if(_0x4fbb75['sectionId']===0x64){_0x4fbb75[_0x0384('0x5e')]=_0x4bd43d;}return _0x4fbb75;});});}else{return;}})['then'](function(_0x54e9e0){if(_0x54e9e0)_0x53c291=_0x54e9e0;if(_[_0x0384('0x5f')](_0x54c79e,0x3eb)){var _0x2febe6=_[_0x0384('0x45')](_0x53c291,{'sectionId':0x3eb});return getCustomDashboards(_0x2febe6)[_0x0384('0x25')](function(_0x122665){return _[_0x0384('0x2b')](_0x53c291,function(_0x227f5a){if(_0x2febe6['enabled']){if(_0x227f5a['sectionId']===0x3eb){_0x227f5a[_0x0384('0x5e')]=_0x122665;}}else{if(_0x227f5a[_0x0384('0x54')]===0x64){if(!_0x227f5a[_0x0384('0x5e')]){_0x227f5a[_0x0384('0x5e')]=[];}_0x227f5a[_0x0384('0x5e')]=_0x227f5a[_0x0384('0x5e')][_0x0384('0x60')](_0x122665);}}return _0x227f5a;});});}else{return;}})[_0x0384('0x25')](function(_0x4fbf06){if(_0x4fbf06)_0x53c291=_0x4fbf06;if(_[_0x0384('0x5f')](_0x54c79e,0x709)){var _0x26be1b=_['find'](_0x53c291,{'sectionId':0x709});return getPlugins(_0x26be1b)[_0x0384('0x25')](function(_0x270cef){if(_0x26be1b[_0x0384('0x5c')]){return _[_0x0384('0x2b')](_0x53c291,function(_0x3e38fa){if(_0x3e38fa['sectionId']===0x709){_0x3e38fa['subsections']=_0x270cef;}return _0x3e38fa;});}else{var _0x19557c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x270cef};var _0x132ca3=_[_0x0384('0x2b')](_0x53c291);_0x132ca3[_0x0384('0x5a')](_0x19557c);return _0x132ca3;}});}else{return;}})[_0x0384('0x25')](function(_0xf15990){if(_0xf15990)_0x53c291=_0xf15990;return _['filter'](_0x53c291,[_0x0384('0x5c'),0x1]);})[_0x0384('0x25')](respondWithResult(_0x34f251,null))[_0x0384('0x47')](handleError(_0x34f251,null));};function hasDefaultDashboard(_0x11df90){var _0x2998de=[0x65];return new BPromise(function(_0x1a7df0,_0x9301b5){try{if(_0x11df90[_0x0384('0x51')]){_0x1a7df0(_0x2998de);}else{return db['UserProfileResource'][_0x0384('0x61')]({'where':{'sectionId':_0x11df90['id']},'raw':!![]})[_0x0384('0x25')](function(_0x4d61bc){_0x4d61bc?_0x1a7df0(_0x2998de):_0x1a7df0();});}}catch(_0x7c0e48){_0x9301b5(_0x7c0e48);}});}function getCustomDashboards(_0x216df0){var _0xaa8249=[];return new BPromise(function(_0x1574ad,_0x2a8d4a){try{if(_0x216df0[_0x0384('0x51')]){return db[_0x0384('0x62')][_0x0384('0x43')]({'raw':!![]})[_0x0384('0x25')](function(_0xdb2d3e){_0xdb2d3e['forEach'](function(_0x4cd46e){_0xaa8249['push'](_0x4cd46e['id']+0x1869f);});_0x1574ad(_0xaa8249);});}else{return db[_0x0384('0x57')][_0x0384('0x43')]({'where':{'sectionId':_0x216df0['id']},'raw':!![]})[_0x0384('0x25')](function(_0x407418){_0x407418[_0x0384('0x63')](function(_0x33714a){_0xaa8249[_0x0384('0x5a')](_0x33714a[_0x0384('0x64')]+0x1869f);});_0x1574ad(_0xaa8249);});}}catch(_0x490492){_0x2a8d4a(_0x490492);}});}function getPlugins(_0x216816){var _0x48370b=[];return new BPromise(function(_0x4c43d0,_0xcdd037){try{if(_0x216816['autoAssociation']){return db['Plugin'][_0x0384('0x43')]({'raw':!![]})[_0x0384('0x25')](function(_0x8384ac){_0x8384ac[_0x0384('0x63')](function(_0xf86b65){_0x48370b[_0x0384('0x5a')](_0xf86b65['id']+0x15b38);});_0x4c43d0(_0x48370b);});}else{return db[_0x0384('0x57')][_0x0384('0x43')]({'where':{'sectionId':_0x216816['id']},'raw':!![]})['then'](function(_0x13b5fc){_0x13b5fc['forEach'](function(_0x40fc48){_0x48370b[_0x0384('0x5a')](_0x40fc48[_0x0384('0x64')]+0x15b38);});_0x4c43d0(_0x48370b);});}}catch(_0x21aa7d){_0xcdd037(_0x21aa7d);}});}exports[_0x0384('0x65')]=function(_0x3f27ea,_0x3e46b9){return db[_0x0384('0x2c')]['find']({'where':{'id':_0x3f27ea[_0x0384('0x48')]['id']}})[_0x0384('0x25')](handleEntityNotFound(_0x3e46b9,null))[_0x0384('0x25')](function(_0x4dda4f){if(_0x4dda4f){return db[_0x0384('0x4d')]['transaction'](function(_0x1f20ec){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3f27ea['params']['id']},'attributes':['id'],'raw':!![]})[_0x0384('0x25')](function(_0x3458a5){if(_0x3458a5){return db['UserProfileSection'][_0x0384('0x26')]({'where':{'userProfileId':_0x3f27ea[_0x0384('0x48')]['id'],'id':_['map'](_0x3458a5,function(_0x2fa4ac){return _0x2fa4ac['id'];})},'transaction':_0x1f20ec});}})[_0x0384('0x25')](function(_0x2a460f){var _0x491282=_[_0x0384('0x2b')](_0x3f27ea[_0x0384('0x4c')],function(_0x627e46){_0x627e46[_0x0384('0x55')]=_0x3f27ea['params']['id'];return _0x627e46;});return db[_0x0384('0x4f')][_0x0384('0x66')](_0x491282,{'raw':!![],'transaction':_0x1f20ec});})['then'](function(_0x234291){var _0x5b6374=_[_0x0384('0x3d')](_[_0x0384('0x2b')](_0x234291,function(_0xaf2bc5){return _0xaf2bc5['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5b6374){return db[_0x0384('0x4f')]['findAll']({'where':{'userProfileId':_0x3f27ea[_0x0384('0x48')]['id'],'sectionId':_[_0x0384('0x2b')](_0x5b6374,function(_0x87c8d){return _0x87c8d['sectionId'];})},'attributes':['id',_0x0384('0x54')],'raw':!![]})[_0x0384('0x25')](function(_0x3f113b){var _0x2e9aea=_[_0x0384('0x2b')](_0x3f27ea[_0x0384('0x4c')],function(_0x3dca7d){_0x3dca7d['userProfileId']=_0x3f27ea[_0x0384('0x48')]['id'];return _0x3dca7d;});return db[_0x0384('0x57')]['bulkCreate'](_0x2e9aea,{'raw':!![],'transaction':_0x1f20ec});});}})['catch'](handleError(_0x3e46b9,null));});}})[_0x0384('0x25')](function(_0x120ad1){var _0x4576d1=_[_0x0384('0x2b')](_0x120ad1,function(_0x246fd2){return _0x246fd2['get']({'plain':!![]});});})[_0x0384('0x25')](respondWithResult(_0x3e46b9,null))[_0x0384('0x47')](handleError(_0x3e46b9,null));};exports['removeResources']=function(_0x34b4f1,_0x43244a,_0x22da52){return db[_0x0384('0x2c')][_0x0384('0x45')]({'where':{'id':_0x34b4f1[_0x0384('0x48')]['id']}})[_0x0384('0x25')](handleEntityNotFound(_0x43244a,null))[_0x0384('0x25')](function(_0x3d9039){if(_0x3d9039){return _0x3d9039[_0x0384('0x67')](_0x34b4f1[_0x0384('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x43244a,null))[_0x0384('0x47')](handleError(_0x43244a,null));};exports[_0x0384('0x68')]=function(_0x38cd4c,_0x5baea0){var _0x569797={};if(!_0x38cd4c['query']['section'])throw new Error(_0x0384('0x69'));if(!_0x38cd4c[_0x0384('0x32')][_0x0384('0x6a')]('nolimit')){_0x569797[_0x0384('0x1e')]=qs[_0x0384('0x1e')](_0x38cd4c[_0x0384('0x32')]['limit']);_0x569797[_0x0384('0x20')]=qs[_0x0384('0x20')](_0x38cd4c[_0x0384('0x32')][_0x0384('0x20')]);}return db[_0x0384('0x2c')]['find']({'where':{'id':_0x38cd4c[_0x0384('0x48')]['id']}})[_0x0384('0x25')](function(_0x2d6157){if(!_0x2d6157)throw new Error(_0x0384('0x6b')+_0x38cd4c['params']['id']);return db['UserProfile']['getResources'](_0x38cd4c);})[_0x0384('0x25')](respondWithFilteredResult(_0x5baea0,_0x569797))[_0x0384('0x47')](handleError(_0x5baea0,null));}; \ No newline at end of file +var _0x695b=['mustache','util','path','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','error','stack','name','index','map','UserProfile','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','length','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x695b,0x13d));var _0xb695=function(_0x300705,_0x2b4e90){_0x300705=_0x300705-0x0;var _0x5e27e6=_0x695b[_0x300705];return _0x5e27e6;};'use strict';var emlformat=require(_0xb695('0x0'));var rimraf=require(_0xb695('0x1'));var zipdir=require(_0xb695('0x2'));var jsonpatch=require(_0xb695('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb695('0x4'));var util=require(_0xb695('0x5'));var path=require(_0xb695('0x6'));var sox=require('sox');var csv=require(_0xb695('0x7'));var ejs=require(_0xb695('0x8'));var fs=require('fs');var fs_extra=require(_0xb695('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb695('0x7'));var querystring=require(_0xb695('0xa'));var Papa=require(_0xb695('0xb'));var Redis=require(_0xb695('0xc'));var authService=require(_0xb695('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb695('0xe'));var hardwareService=require(_0xb695('0xf'));var logger=require(_0xb695('0x10'))(_0xb695('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb695('0x12'));var db=require(_0xb695('0x13'))['db'];config[_0xb695('0x14')]=_[_0xb695('0x15')](config[_0xb695('0x14')],{'host':_0xb695('0x16'),'port':0x18eb});var socket=require(_0xb695('0x17'))(new Redis(config[_0xb695('0x14')]));require(_0xb695('0x18'))['register'](socket);function respondWithStatusCode(_0x27d6dc,_0x1e1f6a){_0x1e1f6a=_0x1e1f6a||0xcc;return function(_0xc9596c){if(_0xc9596c){return _0x27d6dc[_0xb695('0x19')](_0x1e1f6a);}return _0x27d6dc[_0xb695('0x1a')](_0x1e1f6a)[_0xb695('0x1b')]();};}function respondWithResult(_0x4e60f1,_0x1024e9){_0x1024e9=_0x1024e9||0xc8;return function(_0x171604){if(_0x171604){return _0x4e60f1[_0xb695('0x1a')](_0x1024e9)[_0xb695('0x1c')](_0x171604);}};}function respondWithFilteredResult(_0x47b198,_0x34e34a){return function(_0x4ed7dd){if(_0x4ed7dd){var _0xd92972=typeof _0x34e34a[_0xb695('0x1d')]===_0xb695('0x1e')&&typeof _0x34e34a['limit']===_0xb695('0x1e');var _0x48ce81=_0x4ed7dd[_0xb695('0x1f')];var _0x3258d7=_0xd92972?0x0:_0x34e34a[_0xb695('0x1d')];var _0x23d8a2=_0xd92972?_0x4ed7dd[_0xb695('0x1f')]:_0x34e34a[_0xb695('0x1d')]+_0x34e34a['limit'];var _0x13515a;if(_0x23d8a2>=_0x48ce81){_0x23d8a2=_0x48ce81;_0x13515a=0xc8;}else{_0x13515a=0xce;}_0x47b198['status'](_0x13515a);return _0x47b198[_0xb695('0x20')]('Content-Range',_0x3258d7+'-'+_0x23d8a2+'/'+_0x48ce81)[_0xb695('0x1c')](_0x4ed7dd);}return null;};}function patchUpdates(_0x4e4bdc){return function(_0x36f378){try{jsonpatch[_0xb695('0x21')](_0x36f378,_0x4e4bdc,!![]);}catch(_0x5eabb9){return BPromise[_0xb695('0x22')](_0x5eabb9);}return _0x36f378[_0xb695('0x23')]();};}function saveUpdates(_0x1a8332,_0x21a2f8){return function(_0x5aa96d){if(_0x5aa96d){return _0x5aa96d[_0xb695('0x24')](_0x1a8332)['then'](function(_0x53d10c){return _0x53d10c;});}return null;};}function removeEntity(_0x2e19ef,_0x370961){return function(_0x17f61a){if(_0x17f61a){return _0x17f61a[_0xb695('0x25')]()['then'](function(){_0x2e19ef[_0xb695('0x1a')](0xcc)[_0xb695('0x1b')]();});}};}function handleEntityNotFound(_0x543770,_0x27f8ef){return function(_0x47b9dc){if(!_0x47b9dc){_0x543770[_0xb695('0x19')](0x194);}return _0x47b9dc;};}function handleError(_0x469b6d,_0x394a9e){_0x394a9e=_0x394a9e||0x1f4;return function(_0x498714){logger[_0xb695('0x26')](_0x498714[_0xb695('0x27')]);if(_0x498714[_0xb695('0x28')]){delete _0x498714['name'];}_0x469b6d[_0xb695('0x1a')](_0x394a9e)['send'](_0x498714);};}exports[_0xb695('0x29')]=function(_0x8349bb,_0x5c0c53){var _0x1a9887={},_0x266688={},_0x18dfb8={'count':0x0,'rows':[]};var _0xf62fdc=_[_0xb695('0x2a')](db[_0xb695('0x2b')]['rawAttributes'],function(_0x10a2ee){return{'name':_0x10a2ee[_0xb695('0x2c')],'type':_0x10a2ee['type']['key']};});_0x266688[_0xb695('0x2d')]=_[_0xb695('0x2a')](_0xf62fdc,_0xb695('0x28'));_0x266688[_0xb695('0x2e')]=_[_0xb695('0x2f')](_0x8349bb[_0xb695('0x2e')]);_0x266688[_0xb695('0x30')]=_[_0xb695('0x31')](_0x266688[_0xb695('0x2d')],_0x266688[_0xb695('0x2e')]);_0x1a9887['attributes']=_[_0xb695('0x31')](_0x266688[_0xb695('0x2d')],qs[_0xb695('0x32')](_0x8349bb['query'][_0xb695('0x32')]));_0x1a9887[_0xb695('0x33')]=_0x1a9887[_0xb695('0x33')]['length']?_0x1a9887['attributes']:_0x266688[_0xb695('0x2d')];if(!_0x8349bb['query'][_0xb695('0x34')](_0xb695('0x35'))){_0x1a9887[_0xb695('0x36')]=qs[_0xb695('0x36')](_0x8349bb[_0xb695('0x2e')][_0xb695('0x36')]);_0x1a9887['offset']=qs['offset'](_0x8349bb[_0xb695('0x2e')][_0xb695('0x1d')]);}_0x1a9887[_0xb695('0x37')]=qs[_0xb695('0x38')](_0x8349bb[_0xb695('0x2e')]['sort']);_0x1a9887[_0xb695('0x39')]=qs[_0xb695('0x30')](_['pick'](_0x8349bb['query'],_0x266688[_0xb695('0x30')]),_0xf62fdc);if(_0x8349bb[_0xb695('0x2e')][_0xb695('0x3a')]){_0x1a9887['where']=_[_0xb695('0x3b')](_0x1a9887[_0xb695('0x39')],{'$or':_[_0xb695('0x2a')](_0xf62fdc,function(_0x6d1f37){if(_0x6d1f37['type']!==_0xb695('0x3c')){var _0x295fd8={};_0x295fd8[_0x6d1f37[_0xb695('0x28')]]={'$like':'%'+_0x8349bb[_0xb695('0x2e')][_0xb695('0x3a')]+'%'};return _0x295fd8;}})});}_0x1a9887=_[_0xb695('0x3b')]({},_0x1a9887,_0x8349bb['options']);var _0x592f90={'where':_0x1a9887[_0xb695('0x39')]};return db[_0xb695('0x2b')][_0xb695('0x1f')](_0x592f90)[_0xb695('0x3d')](function(_0x14e30f){_0x18dfb8[_0xb695('0x1f')]=_0x14e30f;if(_0x8349bb['query'][_0xb695('0x3e')]){_0x1a9887[_0xb695('0x3f')]=[{'all':!![]}];}return db[_0xb695('0x2b')][_0xb695('0x40')](_0x1a9887);})[_0xb695('0x3d')](function(_0x47ecac){_0x18dfb8['rows']=_0x47ecac;return _0x18dfb8;})['then'](respondWithFilteredResult(_0x5c0c53,_0x1a9887))[_0xb695('0x41')](handleError(_0x5c0c53,null));};exports['show']=function(_0x35f420,_0x43766e){var _0x1de9ab={'raw':![],'where':{'id':_0x35f420[_0xb695('0x42')]['id']}},_0x37ef22={};_0x37ef22['model']=_[_0xb695('0x2f')](db['UserProfile'][_0xb695('0x43')]);_0x37ef22[_0xb695('0x2e')]=_[_0xb695('0x2f')](_0x35f420[_0xb695('0x2e')]);_0x37ef22[_0xb695('0x30')]=_[_0xb695('0x31')](_0x37ef22['model'],_0x37ef22['query']);_0x1de9ab[_0xb695('0x33')]=_[_0xb695('0x31')](_0x37ef22[_0xb695('0x2d')],qs[_0xb695('0x32')](_0x35f420[_0xb695('0x2e')]['fields']));_0x1de9ab[_0xb695('0x33')]=_0x1de9ab[_0xb695('0x33')]['length']?_0x1de9ab['attributes']:_0x37ef22[_0xb695('0x2d')];if(_0x35f420[_0xb695('0x2e')][_0xb695('0x3e')]){_0x1de9ab['include']=[{'all':!![]}];}_0x1de9ab=_[_0xb695('0x3b')]({},_0x1de9ab,_0x35f420[_0xb695('0x44')]);return db[_0xb695('0x2b')]['find'](_0x1de9ab)['then'](handleEntityNotFound(_0x43766e,null))[_0xb695('0x3d')](respondWithResult(_0x43766e,null))[_0xb695('0x41')](handleError(_0x43766e,null));};exports[_0xb695('0x45')]=function(_0x3afdf3,_0x546420){return db[_0xb695('0x2b')][_0xb695('0x45')](_0x3afdf3[_0xb695('0x46')],{})[_0xb695('0x3d')](respondWithResult(_0x546420,0xc9))[_0xb695('0x41')](handleError(_0x546420,null));};exports['clone']=function(_0x154c87,_0x3b9b6a){var _0x41ec81={'where':{'id':_0x154c87[_0xb695('0x42')]['id']}},_0x487903={};_0x487903[_0xb695('0x2d')]=_['keys'](db['UserProfile'][_0xb695('0x43')]);_0x41ec81['attributes']=_['intersection'](_0x487903['model'],qs[_0xb695('0x32')](_0x154c87['query']['fields']));_0x41ec81['attributes']=_0x41ec81[_0xb695('0x33')][_0xb695('0x47')]?_0x41ec81[_0xb695('0x33')]:_0x487903[_0xb695('0x2d')];if(_0x154c87[_0xb695('0x2e')]['includeAll']){_0x41ec81[_0xb695('0x3f')]=[{'all':!![]}];}_0x41ec81=_[_0xb695('0x3b')]({},_0x41ec81,_0x154c87['options']);return db['UserProfile'][_0xb695('0x48')](_0x41ec81)[_0xb695('0x3d')](handleEntityNotFound(_0x3b9b6a,null))[_0xb695('0x3d')](function(_0x158075){if(_0x158075){var _0x3c7cdb=_0x158075[_0xb695('0x49')]({'plain':!![]});_0x3c7cdb=qs[_0xb695('0x4a')](_0x3c7cdb,['id',_0xb695('0x4b'),_0xb695('0x4c'),_0xb695('0x4d')]);_0x154c87[_0xb695('0x46')]=_[_0xb695('0x4a')](_0x154c87[_0xb695('0x46')],['id','createdAt',_0xb695('0x4c')]);return db[_0xb695('0x4e')][_0xb695('0x4f')](function(_0x5a2c8c){return db['UserProfile'][_0xb695('0x45')](_[_0xb695('0x3b')](_0x3c7cdb,_0x154c87[_0xb695('0x46')]),{'include':_0x154c87[_0xb695('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5a2c8c})[_0xb695('0x3d')](function(_0x43d93b){var _0x2991a5=_0x43d93b['get']({'plain':!![]});return db['UserProfileSection'][_0xb695('0x40')]({'where':{'userProfileId':_0x154c87[_0xb695('0x42')]['id']},'raw':!![]})[_0xb695('0x3d')](function(_0xa1707){if(_0xa1707){return BPromise[_0xb695('0x50')](_0xa1707,function(_0x4a10fa){return new BPromise(function(_0x15dfb7,_0x41ae72){if(_0x4a10fa[_0xb695('0x51')]===null||_0x4a10fa[_0xb695('0x51')]===0x1)_0x15dfb7(null);return db[_0xb695('0x52')][_0xb695('0x40')]({'where':{'sectionId':_0x4a10fa['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x4147c6){var _0x45ce01=_[_0xb695('0x2a')](_0x4147c6,function(_0x13dfcc){return qs['omit'](_0x13dfcc,['id',_0xb695('0x4b'),_0xb695('0x4c'),_0xb695('0x53')]);});_0x15dfb7(_0x45ce01);})['catch'](function(_0xf180a9){_0x41ae72(_0xf180a9);});})[_0xb695('0x3d')](function(_0x1b9351){var _0xb7ffc1=qs[_0xb695('0x4a')](_0x4a10fa,['id',_0xb695('0x4b'),_0xb695('0x4c')]);_0xb7ffc1[_0xb695('0x54')]=_0x2991a5['id'];if(_0x1b9351)_0xb7ffc1['Resources']=_0x1b9351;return _0xb7ffc1;})['then'](function(_0x59dd4f){return db[_0xb695('0x55')][_0xb695('0x45')](_0x59dd4f,{'include':[{'model':db[_0xb695('0x52')],'as':_0xb695('0x56')}],'raw':!![],'transaction':_0x5a2c8c});});})[_0xb695('0x3d')](function(){return _0x2991a5;});}});});});}})[_0xb695('0x3d')](respondWithResult(_0x3b9b6a,0xc9))[_0xb695('0x41')](handleError(_0x3b9b6a,null));};exports[_0xb695('0x24')]=function(_0x549193,_0x5560e5){if(_0x549193[_0xb695('0x46')]['id']){delete _0x549193['body']['id'];}return db[_0xb695('0x2b')]['find']({'where':{'id':_0x549193[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x5560e5,null))[_0xb695('0x3d')](saveUpdates(_0x549193[_0xb695('0x46')],null))[_0xb695('0x3d')](respondWithResult(_0x5560e5,null))[_0xb695('0x41')](handleError(_0x5560e5,null));};exports['destroy']=function(_0x16881d,_0x154253){return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x16881d[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x154253,null))[_0xb695('0x3d')](removeEntity(_0x154253,null))[_0xb695('0x41')](handleError(_0x154253,null));};exports[_0xb695('0x57')]=function(_0x928f1f,_0xc9dd37){return db[_0xb695('0x2b')][_0xb695('0x57')]()['then'](respondWithResult(_0xc9dd37,null))[_0xb695('0x41')](handleError(_0xc9dd37,null));};exports['addSections']=function(_0x4c0576,_0x377403){var _0x1db5ee=_0x4c0576[_0xb695('0x46')];return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x4c0576['params']['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x377403,null))['then'](function(_0x3634de){if(_0x3634de){return db[_0xb695('0x4e')][_0xb695('0x4f')](function(_0x5af0a7){return db[_0xb695('0x55')][_0xb695('0x25')]({'where':{'userProfileId':_0x4c0576[_0xb695('0x42')]['id'],'sectionId':_[_0xb695('0x2a')](_0x1db5ee,function(_0x2dffa2){return _0x2dffa2['sectionId'];})},'transaction':_0x5af0a7})['then'](function(){var _0x1706a4=_[_0xb695('0x2a')](_0x1db5ee,function(_0x1363b6){_0x1363b6[_0xb695('0x54')]=_0x4c0576[_0xb695('0x42')]['id'];return _0x1363b6;});var _0x3c8114=[];return BPromise[_0xb695('0x50')](_0x1706a4,function(_0x5e4cdb){return db['UserProfileSection'][_0xb695('0x45')](_0x5e4cdb,{'include':[{'model':db[_0xb695('0x52')],'as':_0xb695('0x56')}],'raw':!![],'transaction':_0x5af0a7})[_0xb695('0x3d')](function(_0x45da9e){_0x3c8114[_0xb695('0x58')](_0x45da9e['get']({'plain':!![]}));});})[_0xb695('0x3d')](function(){return _0x3c8114;});});});}})[_0xb695('0x3d')](function(_0x1efd65){return _0x1efd65;})[_0xb695('0x3d')](respondWithResult(_0x377403,null))[_0xb695('0x41')](handleError(_0x377403,null));};exports[_0xb695('0x59')]=function(_0xe0c793,_0x19c81d){var _0x9a38e0;return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0xe0c793[_0xb695('0x42')]['id']},'attributes':['id',_0xb695('0x28')]})[_0xb695('0x3d')](handleEntityNotFound(_0x19c81d,null))[_0xb695('0x3d')](function(_0x6319ea){if(_0x6319ea){_0x9a38e0=_0x6319ea;return db['UserProfileSection'][_0xb695('0x25')]({'where':{'userProfileId':_0xe0c793[_0xb695('0x42')]['id'],'sectionId':_0xe0c793[_0xb695('0x2e')][_0xb695('0x5a')]}});}})[_0xb695('0x3d')](function(){return _0x9a38e0;})[_0xb695('0x3d')](respondWithStatusCode(_0x19c81d,null))[_0xb695('0x41')](handleError(_0x19c81d,null));};exports[_0xb695('0x5b')]=function(_0x4c84c2,_0x4f6fef){var _0x48448e=[];var _0x2e7182=[];return db[_0xb695('0x55')]['findAll']({'where':{'userProfileId':_0x4c84c2[_0xb695('0x42')]['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x176aae){_0x48448e=_[_0xb695('0x3a')](_0x176aae,function(_0x2ada10){return _0x2ada10[_0xb695('0x5c')]===0x1||_[_0xb695('0x5d')]([0x3eb,0x709],_0x2ada10[_0xb695('0x53')]);});if(!_[_0xb695('0x5e')](_0x48448e)){return _[_0xb695('0x2a')](_0x48448e,function(_0x27c282){return _0x27c282[_0xb695('0x53')];});}else{return;}})['then'](function(_0x1e5c78){if(_0x1e5c78)_0x2e7182=_0x1e5c78;if(_[_0xb695('0x5d')](_0x2e7182,0x64)){var _0x4574c8=_[_0xb695('0x48')](_0x48448e,{'sectionId':0x64});return hasDefaultDashboard(_0x4574c8)['then'](function(_0x4fbdbc){return _[_0xb695('0x2a')](_0x48448e,function(_0x973087){if(_0x973087[_0xb695('0x53')]===0x64){_0x973087[_0xb695('0x5f')]=_0x4fbdbc;}return _0x973087;});});}else{return;}})[_0xb695('0x3d')](function(_0x4a74c1){if(_0x4a74c1)_0x48448e=_0x4a74c1;if(_[_0xb695('0x5d')](_0x2e7182,0x3eb)){var _0xbb6e8b=_[_0xb695('0x48')](_0x48448e,{'sectionId':0x3eb});return getCustomDashboards(_0xbb6e8b)[_0xb695('0x3d')](function(_0x4eef27){return _[_0xb695('0x2a')](_0x48448e,function(_0x1d350){if(_0xbb6e8b[_0xb695('0x5c')]){if(_0x1d350['sectionId']===0x3eb){_0x1d350[_0xb695('0x5f')]=_0x4eef27;}}else{if(_0x1d350[_0xb695('0x53')]===0x64){if(!_0x1d350[_0xb695('0x5f')]){_0x1d350[_0xb695('0x5f')]=[];}_0x1d350[_0xb695('0x5f')]=_0x1d350[_0xb695('0x5f')][_0xb695('0x60')](_0x4eef27);}}return _0x1d350;});});}else{return;}})[_0xb695('0x3d')](function(_0x4573d0){if(_0x4573d0)_0x48448e=_0x4573d0;if(_[_0xb695('0x5d')](_0x2e7182,0x709)){var _0x445b0d=_[_0xb695('0x48')](_0x48448e,{'sectionId':0x709});return getPlugins(_0x445b0d)[_0xb695('0x3d')](function(_0x268429){if(_0x445b0d[_0xb695('0x5c')]){return _[_0xb695('0x2a')](_0x48448e,function(_0x1633cf){if(_0x1633cf[_0xb695('0x53')]===0x709){_0x1633cf['subsections']=_0x268429;}return _0x1633cf;});}else{var _0x510293={'sectionId':0x76c,'enabled':0x1,'subsections':_0x268429};var _0x4eef11=_[_0xb695('0x2a')](_0x48448e);_0x4eef11[_0xb695('0x58')](_0x510293);return _0x4eef11;}});}else{return;}})[_0xb695('0x3d')](function(_0x4cd9ad){if(_0x4cd9ad)_0x48448e=_0x4cd9ad;return _[_0xb695('0x3a')](_0x48448e,['enabled',0x1]);})[_0xb695('0x3d')](respondWithResult(_0x4f6fef,null))['catch'](handleError(_0x4f6fef,null));};function hasDefaultDashboard(_0x4f57f8){var _0x215713=[0x65];return new BPromise(function(_0x4dfb9c,_0x3e39ba){try{if(_0x4f57f8['autoAssociation']){_0x4dfb9c(_0x215713);}else{return db[_0xb695('0x52')][_0xb695('0x61')]({'where':{'sectionId':_0x4f57f8['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x2d2ddc){_0x2d2ddc?_0x4dfb9c(_0x215713):_0x4dfb9c();});}}catch(_0x58d904){_0x3e39ba(_0x58d904);}});}function getCustomDashboards(_0x4c45d6){var _0x2d9844=[];return new BPromise(function(_0x805888,_0x357099){try{if(_0x4c45d6[_0xb695('0x51')]){return db[_0xb695('0x62')][_0xb695('0x40')]({'raw':!![]})[_0xb695('0x3d')](function(_0x4a80f1){_0x4a80f1['forEach'](function(_0x2a0695){_0x2d9844[_0xb695('0x58')](_0x2a0695['id']+0x1869f);});_0x805888(_0x2d9844);});}else{return db['UserProfileResource'][_0xb695('0x40')]({'where':{'sectionId':_0x4c45d6['id']},'raw':!![]})['then'](function(_0x5567c4){_0x5567c4[_0xb695('0x63')](function(_0x3f96bb){_0x2d9844[_0xb695('0x58')](_0x3f96bb[_0xb695('0x64')]+0x1869f);});_0x805888(_0x2d9844);});}}catch(_0x3d8c44){_0x357099(_0x3d8c44);}});}function getPlugins(_0x38874b){var _0x5164d3=[];return new BPromise(function(_0x188484,_0x34e606){try{if(_0x38874b['autoAssociation']){return db['Plugin'][_0xb695('0x40')]({'raw':!![]})[_0xb695('0x3d')](function(_0x221c65){_0x221c65[_0xb695('0x63')](function(_0x1bf5d3){_0x5164d3['push'](_0x1bf5d3['id']+0x15b38);});_0x188484(_0x5164d3);});}else{return db['UserProfileResource'][_0xb695('0x40')]({'where':{'sectionId':_0x38874b['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x2c2980){_0x2c2980[_0xb695('0x63')](function(_0x1c45a2){_0x5164d3['push'](_0x1c45a2[_0xb695('0x64')]+0x15b38);});_0x188484(_0x5164d3);});}}catch(_0x1d570f){_0x34e606(_0x1d570f);}});}exports[_0xb695('0x65')]=function(_0x514c0f,_0x203bc7){return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x514c0f['params']['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x203bc7,null))[_0xb695('0x3d')](function(_0x451f3e){if(_0x451f3e){return db[_0xb695('0x4e')][_0xb695('0x4f')](function(_0x4165f7){return db[_0xb695('0x55')][_0xb695('0x40')]({'where':{'userProfileId':_0x514c0f[_0xb695('0x42')]['id']},'attributes':['id'],'raw':!![]})[_0xb695('0x3d')](function(_0x542517){if(_0x542517){return db[_0xb695('0x55')]['destroy']({'where':{'userProfileId':_0x514c0f['params']['id'],'id':_[_0xb695('0x2a')](_0x542517,function(_0x57c8a4){return _0x57c8a4['id'];})},'transaction':_0x4165f7});}})[_0xb695('0x3d')](function(_0x55b8e8){var _0x5b8fa2=_[_0xb695('0x2a')](_0x514c0f[_0xb695('0x46')],function(_0x3d809d){_0x3d809d[_0xb695('0x54')]=_0x514c0f[_0xb695('0x42')]['id'];return _0x3d809d;});return db[_0xb695('0x55')][_0xb695('0x66')](_0x5b8fa2,{'raw':!![],'transaction':_0x4165f7});})[_0xb695('0x3d')](function(_0x93ecf1){var _0x48d593=_['filter'](_['map'](_0x93ecf1,function(_0x3f0791){return _0x3f0791[_0xb695('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x48d593){return db[_0xb695('0x55')][_0xb695('0x40')]({'where':{'userProfileId':_0x514c0f[_0xb695('0x42')]['id'],'sectionId':_['map'](_0x48d593,function(_0x19d8b8){return _0x19d8b8[_0xb695('0x53')];})},'attributes':['id',_0xb695('0x53')],'raw':!![]})[_0xb695('0x3d')](function(_0x2ce8d0){var _0x1dcd71=_['map'](_0x514c0f[_0xb695('0x46')],function(_0xe0b54c){_0xe0b54c['userProfileId']=_0x514c0f[_0xb695('0x42')]['id'];return _0xe0b54c;});return db[_0xb695('0x52')][_0xb695('0x66')](_0x1dcd71,{'raw':!![],'transaction':_0x4165f7});});}})[_0xb695('0x41')](handleError(_0x203bc7,null));});}})['then'](function(_0x414183){var _0x5ab081=_[_0xb695('0x2a')](_0x414183,function(_0x4f552b){return _0x4f552b[_0xb695('0x49')]({'plain':!![]});});})['then'](respondWithResult(_0x203bc7,null))[_0xb695('0x41')](handleError(_0x203bc7,null));};exports['removeResources']=function(_0x599d95,_0x1b6a3e,_0x4d7b02){return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x599d95[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x1b6a3e,null))[_0xb695('0x3d')](function(_0x54fc1b){if(_0x54fc1b){return _0x54fc1b[_0xb695('0x67')](_0x599d95[_0xb695('0x2e')][_0xb695('0x5a')]);}})[_0xb695('0x3d')](respondWithStatusCode(_0x1b6a3e,null))[_0xb695('0x41')](handleError(_0x1b6a3e,null));};exports[_0xb695('0x68')]=function(_0x5b219b,_0x3fb2c9){var _0x2ace66={};if(!_0x5b219b[_0xb695('0x2e')][_0xb695('0x69')])throw new Error(_0xb695('0x6a'));if(!_0x5b219b[_0xb695('0x2e')][_0xb695('0x34')](_0xb695('0x35'))){_0x2ace66['limit']=qs[_0xb695('0x36')](_0x5b219b['query']['limit']);_0x2ace66[_0xb695('0x1d')]=qs['offset'](_0x5b219b[_0xb695('0x2e')]['offset']);}return db[_0xb695('0x2b')]['find']({'where':{'id':_0x5b219b[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](function(_0x5d5b9e){if(!_0x5d5b9e)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5b219b['params']['id']);return db[_0xb695('0x2b')][_0xb695('0x68')](_0x5b219b);})['then'](respondWithFilteredResult(_0x3fb2c9,_0x2ace66))[_0xb695('0x41')](handleError(_0x3fb2c9,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 1b25f6d..9b6bfbc 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 _0x7f94=['save','update','emit','hasOwnProperty','exports','events','UserProfile','setMaxListeners'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0x7f94,0x65));var _0x47f9=function(_0x53c473,_0x385ee3){_0x53c473=_0x53c473-0x0;var _0x4af0d3=_0x7f94[_0x53c473];return _0x4af0d3;};'use strict';var EventEmitter=require(_0x47f9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x47f9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x47f9('0x2')](0x0);var events={'afterCreate':_0x47f9('0x3'),'afterUpdate':_0x47f9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ae182){return function(_0x1ecb98,_0x146950,_0x1dd1c1){UserProfileEvents[_0x47f9('0x5')](_0x1ae182+':'+_0x1ecb98['id'],_0x1ecb98);UserProfileEvents[_0x47f9('0x5')](_0x1ae182,_0x1ecb98);_0x1dd1c1(null);};}for(var e in events){if(events[_0x47f9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x47f9('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x2525=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x26982c,_0x599755){var _0x19ed79=function(_0x1a3bda){while(--_0x1a3bda){_0x26982c['push'](_0x26982c['shift']());}};_0x19ed79(++_0x599755);}(_0x2525,0x1f0));var _0x5252=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x2525[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x5252('0x0'));var UserProfile=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){UserProfileEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);UserProfileEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];UserProfile[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f273da2..0e2f9aa 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 _0x2f9a=['QueueCampaigns','outbound','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','all','union','length','ignore','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','options','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','true','rows','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','squel','filter','value','findAll','then','associatedResources','map','field','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x2f9a,0x8a));var _0xa2f9=function(_0xeb254a,_0x1c1fc9){_0xeb254a=_0xeb254a-0x0;var _0x78e431=_0x2f9a[_0xeb254a];return _0x78e431;};'use strict';var _=require(_0xa2f9('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0xa2f9('0x1'));module['exports']=function(_0x2d4689){var _0x15504b=_0x2d4689['models'];function _0x267787(_0x991620,_0x108260){return new Promise(function(_0x31d9c9,_0x2d6621){if(!_0x108260)return _0x31d9c9(null);var _0x45c604=_0x108260[_0xa2f9('0x2')]?{[_0x108260[_0xa2f9('0x2')]['field']]:_0x108260[_0xa2f9('0x2')][_0xa2f9('0x3')]}:undefined;return _0x15504b[_0x991620][_0xa2f9('0x4')]({'where':_0x45c604,'raw':!![]})[_0xa2f9('0x5')](function(_0x1b4889){_0x108260[_0xa2f9('0x6')]=_[_0xa2f9('0x7')](_0x1b4889,'id');_0x31d9c9(_0x108260);})['catch'](function(_0x295e81){_0x2d6621(_0x295e81);});});}function _0xca32ee(_0x4c4fa9,_0x289c3f){return new Promise(function(_0x4602cb,_0x9ab1fe){var _0x44ea2d=_0x4c4fa9[_0xa2f9('0x2')]?{[_0x4c4fa9[_0xa2f9('0x2')][_0xa2f9('0x8')]]:_0x4c4fa9[_0xa2f9('0x2')]['value']}:undefined;return _0x15504b[_0x4c4fa9['model']][_0xa2f9('0x4')]({'where':_0x44ea2d,'raw':!![]})[_0xa2f9('0x5')](function(_0xbb9073){_0x289c3f[_0xa2f9('0x6')]=_[_0xa2f9('0x7')](_0xbb9073,function(_0x3ddc14){return _0x3ddc14[_0xa2f9('0x9')];});_0x4602cb(_0x289c3f);})[_0xa2f9('0xa')](function(_0x78c06a){_0x9ab1fe(_0x78c06a);});});}function _0x2a939c(_0x1c6aaa,_0x3b6a5c,_0x3c3a55){if(!_0x3b6a5c)return Promise[_0xa2f9('0xb')](null);return new Promise(function(_0x520a6b,_0x113011){return _0x15504b[_0xa2f9('0xc')]['findAll']({'where':{'sectionId':_0x3b6a5c['id']},'raw':!![]})['then'](function(_0x4167d5){if(_0x1c6aaa[_0xa2f9('0x8')]&&_0x1c6aaa[_0xa2f9('0x8')]!=='id'){_0x3b6a5c[_0xa2f9('0x6')]=_['map'](_0x4167d5,function(_0x4ee2f7){return _0x4ee2f7[_0x1c6aaa[_0xa2f9('0x8')]];});}else{if(_0x3c3a55===_0xa2f9('0xd')){_0x3b6a5c[_0xa2f9('0x6')]=_[_0xa2f9('0x7')](_0x4167d5,function(_0x18af8f){return{'id':_0x18af8f[_0xa2f9('0xe')],'type':_0x18af8f[_0xa2f9('0xf')]};});}else{_0x3b6a5c[_0xa2f9('0x6')]=_[_0xa2f9('0x7')](_0x4167d5,function(_0x22bc5b){return _0x22bc5b[_0xa2f9('0xe')];});}}_0x520a6b(_0x3b6a5c);})['catch'](function(_0xfc130c){_0x113011(_0xfc130c);});});}function _0x14bd29(_0x5136c3,_0x2c44b7){var _0x2c5755={'parentSections':[]};switch(_0x5136c3[_0xa2f9('0x10')]()){case _0xa2f9('0x11'):_0x2c5755['childModel']=_0xa2f9('0x12');break;case _0xa2f9('0x13'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x15');break;case'squarerecordings':_0x2c5755['childModel']=_0xa2f9('0x16');_0x2c5755[_0xa2f9('0x17')]=[{'name':_0xa2f9('0x18'),'field':'name','foreignKey':_0xa2f9('0x19')}];break;case'projects':_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x1a');break;case _0xa2f9('0x1b'):_0x2c5755['childModel']=_0xa2f9('0x1c');_0x2c5755[_0xa2f9('0x17')]=[{'name':_0xa2f9('0x1d'),'field':'id','foreignKey':_0xa2f9('0x1e')}];break;case _0xa2f9('0x1f'):_0x2c5755['childModel']=_0xa2f9('0x20');break;case _0xa2f9('0x21'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x22');break;case _0xa2f9('0x23'):_0x2c5755[_0xa2f9('0x14')]='CmCustomField';break;case _0xa2f9('0x24'):_0x2c5755['childModel']=_0xa2f9('0x25');break;case'chatwebsites':_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x26');break;case _0xa2f9('0x27'):_0x2c5755['childModel']='FaxQueue';break;case _0xa2f9('0x28'):_0x2c5755[_0xa2f9('0x14')]='FaxAccount';break;case _0xa2f9('0x29'):case'internalroutes':case _0xa2f9('0x2a'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x2b');break;case _0xa2f9('0x2c'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x2d');break;case _0xa2f9('0x2e'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x2f');break;case'voicerecordings':_0x2c5755['childModel']='VoiceRecording';_0x2c5755[_0xa2f9('0x17')]=[{'name':'Agents','field':'name','foreignKey':'membername','model':_0xa2f9('0x30'),'filter':{'field':_0xa2f9('0x31'),'value':[_0xa2f9('0x32')]}},{'name':'Telephones','field':_0xa2f9('0x9'),'foreignKey':_0xa2f9('0x33'),'model':'User','filter':{'field':'role','value':[_0xa2f9('0x34')]}},{'name':_0xa2f9('0x35'),'field':_0xa2f9('0x9'),'foreignKey':_0xa2f9('0x36'),'model':_0xa2f9('0x37'),'filter':{'field':_0xa2f9('0xf'),'value':['inbound']}},{'name':_0xa2f9('0x38'),'field':_0xa2f9('0x9'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xa2f9('0x39')]}}];break;case'musiconholds':_0x2c5755[_0xa2f9('0x14')]='VoiceMusicOnHold';break;case _0xa2f9('0x3a'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x3b');break;case'voiceprefixes':_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x3c');break;case _0xa2f9('0x3d'):_0x2c5755['childModel']='Campaign';break;case _0xa2f9('0x3e'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x3f');break;case _0xa2f9('0x40'):_0x2c5755['childModel']=_0xa2f9('0x41');break;case'mailsubstatuses':_0x2c5755['childModel']='MailSubstatus';break;case _0xa2f9('0x42'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x43');break;case _0xa2f9('0x44'):_0x2c5755['childModel']=_0xa2f9('0x45');break;case'smsqueues':_0x2c5755[_0xa2f9('0x14')]='SmsQueue';break;case'smsaccounts':_0x2c5755[_0xa2f9('0x14')]='SmsAccount';break;case _0xa2f9('0x46'):_0x2c5755['childModel']=_0xa2f9('0x47');break;case _0xa2f9('0x48'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x49');break;case _0xa2f9('0x4a'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x4b');break;case'voicequeues':case _0xa2f9('0x4c'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x37');if(_0x2c44b7){_0x2c5755[_0xa2f9('0x17')]=[{'name':_0xa2f9('0x35')},{'name':'QueueCampaigns'}];}break;case _0xa2f9('0x4d'):case _0xa2f9('0x4e'):case _0xa2f9('0x4f'):_0x2c5755['childModel']=_0xa2f9('0x30');if(_0x2c44b7){_0x2c5755[_0xa2f9('0x17')]=[{'name':_0xa2f9('0x50'),'filter':{'field':_0xa2f9('0x31'),'value':[_0xa2f9('0x51'),_0xa2f9('0x52')]},'ignore':!![]},{'name':_0xa2f9('0x53')},{'name':_0xa2f9('0x54')}];}break;case _0xa2f9('0x55'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x56');break;case'salesforceaccounts':_0x2c5755['childModel']=_0xa2f9('0x57');break;case _0xa2f9('0x58'):_0x2c5755['childModel']=_0xa2f9('0x59');break;case _0xa2f9('0x5a'):_0x2c5755['childModel']=_0xa2f9('0x5b');break;case'deskaccounts':_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x5c');break;case _0xa2f9('0x5d'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x5e');break;case _0xa2f9('0x5f'):_0x2c5755['childModel']=_0xa2f9('0x30');break;case _0xa2f9('0x60'):_0x2c5755[_0xa2f9('0x14')]='CannedAnswer';break;case _0xa2f9('0x61'):_0x2c5755[_0xa2f9('0x14')]='Disposition';break;case _0xa2f9('0x62'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x63');break;case _0xa2f9('0x64'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x65');break;case _0xa2f9('0x66'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x67');break;case _0xa2f9('0x68'):_0x2c5755['childModel']='Schedule';break;case _0xa2f9('0x69'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x6a');break;case _0xa2f9('0x6b'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x6c');break;case _0xa2f9('0x6d'):_0x2c5755[_0xa2f9('0x14')]='Template';break;case _0xa2f9('0x6e'):_0x2c5755['childModel']=_0xa2f9('0x6f');break;case _0xa2f9('0x70'):_0x2c5755[_0xa2f9('0x14')]='Trunk';break;case'variables':_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x71');break;case _0xa2f9('0x72'):_0x2c5755[_0xa2f9('0x14')]=_0xa2f9('0x73');break;case _0xa2f9('0x74'):_0x2c5755[_0xa2f9('0x14')]='AnalyticExtractedReport';_0x2c5755['parentSections']=[{'name':_0xa2f9('0x75'),'field':'id','foreignKey':_0xa2f9('0x76')}];break;case _0xa2f9('0x77'):_0x2c5755['childModel']=_0xa2f9('0x78');break;}return _0x2c5755;}function _0x323b8e(_0x578da2,_0x2ea8ce){var _0x2e9726=_0x578da2['charAt'](0x0)[_0xa2f9('0x79')]()+_0x578da2['slice'](0x1);var _0x3605bb={'type':_0x15504b[_0xa2f9('0x7a')][_0xa2f9('0x7b')][_0xa2f9('0x7c')],'raw':!![]};return new Promise(function(_0x41454f,_0x29b909){var _0xf4c091=squel[_0xa2f9('0x7d')]()[_0xa2f9('0x8')]('ui.'+_0x2e9726+_0xa2f9('0x7e'),'id')[_0xa2f9('0x8')](_0xa2f9('0x7f'))[_0xa2f9('0x80')](_0xa2f9('0x81')+_0x578da2+_0xa2f9('0x82'),'ui')[_0xa2f9('0x83')](_0xa2f9('0x84'),_0x2ea8ce['id']);return _0x15504b[_0xa2f9('0x85')][_0xa2f9('0x86')](_0xf4c091[_0xa2f9('0x87')](),_0x3605bb)[_0xa2f9('0x5')](function(_0x17ed88){_0x2ea8ce[_0x2e9726+_0xa2f9('0x88')]=_0x17ed88;_0x41454f(_0x17ed88);})[_0xa2f9('0xa')](function(_0x3055a8){_0x29b909(_0x3055a8);});});}return _0x2d4689['define'](_0xa2f9('0x89'),attributes,{'tableName':_0xa2f9('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x255f28){var _0x3e05fb=require(_0xa2f9('0x8b'));var _0x20228a={'raw':_0x255f28[_0xa2f9('0x86')][_0xa2f9('0x8c')],'where':{}};var _0x5a0410={};var _0xb4b3b8={'count':0x0,'rows':[]};var _0x161580=_0x255f28['query'][_0xa2f9('0x8d')];var _0x3a6997=_0x255f28[_0xa2f9('0x86')][_0xa2f9('0x8e')]||![];var _0x289f35=_0x14bd29(_0x161580,_0x3a6997);if(!_0x289f35[_0xa2f9('0x14')])throw new Error(_0xa2f9('0x8f')+_0x161580+'\x27');var _0x7c6fb2=[{'name':_0x161580}];if(!_[_0xa2f9('0x90')](_0x289f35[_0xa2f9('0x17')]))_0x7c6fb2=_0x289f35[_0xa2f9('0x17')];var _0x2a59f0=[];for(var _0x59fded=0x0;_0x59fded<_0x7c6fb2['length'];_0x59fded++){_0x2a59f0[_0xa2f9('0x91')](_0x15504b[_0xa2f9('0x92')][_0xa2f9('0x93')]({'where':{'userProfileId':_0x255f28['params']['id'],'name':_0x7c6fb2[_0x59fded][_0xa2f9('0x9')]},'raw':!![]}));}return Promise[_0xa2f9('0x94')](_0x2a59f0)[_0xa2f9('0x5')](function(_0x3f953f){var _0x15d139=_[_0xa2f9('0x2')](_0x3f953f,function(_0x3582c8){return _0x3582c8?_0x3582c8:undefined;});var _0xaa44f1=_[_0xa2f9('0x2')](_0x7c6fb2,['ignore',!![]]);var _0x35a060=_[_0xa2f9('0x90')](_0x15d139)&&_[_0xa2f9('0x90')](_0xaa44f1)?null:_[_0xa2f9('0x95')](_0xaa44f1,_0x15d139);if(!_0x35a060)return null;var _0x362723=[];for(var _0x841f20=0x0;_0x841f20<_0x35a060[_0xa2f9('0x96')];_0x841f20++){var _0x55e77f=_[_0xa2f9('0x93')](_0x7c6fb2,function(_0x1fda7f){return _0x35a060[_0x841f20]?_0x1fda7f[_0xa2f9('0x9')]===_0x35a060[_0x841f20][_0xa2f9('0x9')]:null;});if(_0x55e77f){if(_0x35a060[_0x841f20][_0xa2f9('0x97')]){_0x362723[_0xa2f9('0x91')](_0x267787(_0x289f35[_0xa2f9('0x14')],_0x35a060[_0x841f20]));}else{if(!_0x35a060[_0x841f20][_0xa2f9('0x98')]){_0x362723[_0xa2f9('0x91')](_0x2a939c(_0x55e77f,_0x35a060[_0x841f20],_0x289f35[_0xa2f9('0x14')]));}else{if(_0x55e77f['model']){_0x362723[_0xa2f9('0x91')](_0xca32ee(_0x55e77f,_0x35a060[_0x841f20]));}}}}}return Promise[_0xa2f9('0x94')](_0x362723);})[_0xa2f9('0x5')](function(_0x291f20){var _0x2ab617=_0x291f20;var _0x3b3297=null;if(_0x2ab617){_0x3b3297=_0x2ab617[_0xa2f9('0x96')]===0x1?_0x2ab617[0x0]:null;}if(!_0x3b3297&&!_0x2ab617)return _0xb4b3b8;var _0x521e9c=_0x15504b[_0x289f35[_0xa2f9('0x14')]][_0xa2f9('0x99')];_0x5a0410[_0xa2f9('0x9a')]=_[_0xa2f9('0x9b')](_0x521e9c);_0x5a0410['query']=_['keys'](_0x255f28[_0xa2f9('0x86')]);_0x5a0410[_0xa2f9('0x9c')]=_[_0xa2f9('0x9d')](_0x5a0410[_0xa2f9('0x9a')],_0x5a0410[_0xa2f9('0x86')]);_0x20228a[_0xa2f9('0x9e')]=_[_0xa2f9('0x9d')](_0x5a0410['model'],_0x3e05fb[_0xa2f9('0x9f')](_0x255f28['query'][_0xa2f9('0x9f')]));_0x20228a['attributes']=_0x20228a[_0xa2f9('0x9e')][_0xa2f9('0x96')]?_0x20228a[_0xa2f9('0x9e')]:_0x5a0410['model'];if(!_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xa0')](_0xa2f9('0xa1'))){_0x20228a[_0xa2f9('0xa2')]=_0x3e05fb[_0xa2f9('0xa2')](_0x255f28['query']['limit']);_0x20228a[_0xa2f9('0xa3')]=_0x3e05fb[_0xa2f9('0xa3')](_0x255f28[_0xa2f9('0x86')]['offset']);}_0x20228a[_0xa2f9('0xa4')]=_0x3e05fb['sort'](_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xa5')]);_0x20228a[_0xa2f9('0x83')]=_0x3e05fb[_0xa2f9('0x9c')](_[_0xa2f9('0xa6')](_0x255f28[_0xa2f9('0x86')],_0x5a0410[_0xa2f9('0x9c')]));if(_0x255f28['query'][_0xa2f9('0x2')]){_0x20228a['where']=_[_0xa2f9('0xa7')](_0x20228a['where'],{'$or':_[_0xa2f9('0x7')](_0x521e9c,function(_0x121ec0){if(_0x121ec0['type'][_0xa2f9('0xa8')]!=='VIRTUAL'){var _0x6da1cf={};_0x6da1cf[_0x121ec0[_0xa2f9('0x8')]]={'$like':'%'+_0x255f28[_0xa2f9('0x86')][_0xa2f9('0x2')]+'%'};return _0x6da1cf;}})});}var _0x4a081c=[];var _0x244cdd=null;var _0x55cbdf={};if(_0x3b3297){_0x244cdd=_[_0xa2f9('0x93')](_0x7c6fb2,[_0xa2f9('0x9'),_0x3b3297['name']]);if(_0x244cdd[_0xa2f9('0x8')]){_0x55cbdf={};if(_0x289f35['childModel']===_0xa2f9('0xd')){_0x55cbdf[_0x244cdd[_0xa2f9('0xa9')]]=_['map'](_0x3b3297['associatedResources'],'id');}else{_0x55cbdf[_0x244cdd['foreignKey']]=_0x3b3297[_0xa2f9('0x6')];}_0x4a081c[_0xa2f9('0x91')](_0x55cbdf);}else{_0x20228a[_0xa2f9('0x83')]['id']=_0x3b3297[_0xa2f9('0x6')];}}else{for(var _0x8818d7=0x0;_0x8818d7<_0x2ab617[_0xa2f9('0x96')];_0x8818d7++){_0x244cdd=_[_0xa2f9('0x93')](_0x7c6fb2,[_0xa2f9('0x9'),_0x2ab617[_0x8818d7][_0xa2f9('0x9')]]);if(_0x244cdd['field']){_0x55cbdf={};_0x55cbdf[_0x244cdd[_0xa2f9('0xa9')]]=_0x2ab617[_0x8818d7][_0xa2f9('0x6')];_0x4a081c[_0xa2f9('0x91')](_0x55cbdf);}else{if(!_0x20228a[_0xa2f9('0x83')]['id'])_0x20228a['where']['id']=[];_0x2ab617[_0x8818d7][_0xa2f9('0x6')]['forEach'](function(_0x2868ae){_0x20228a['where']['id']['push'](_0x2868ae);});}}}if(!_[_0xa2f9('0x90')](_0x4a081c)){_0x20228a[_0xa2f9('0x83')]=_[_0xa2f9('0xa7')](_0x20228a[_0xa2f9('0x83')],{'$and':{'$or':_0x4a081c}});}_0x20228a=_[_0xa2f9('0xa7')]({},_0x20228a,_0x255f28[_0xa2f9('0xaa')]);if(_0x3b3297&&!_0x3b3297[_0xa2f9('0x98')]&&_0x289f35[_0xa2f9('0x14')]===_0xa2f9('0xd')){if(_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xab')]){_0x20228a[_0xa2f9('0xac')]=[{'all':!![]}];}return _0x15504b[_0x289f35[_0xa2f9('0x14')]][_0xa2f9('0x4')](_0x20228a)[_0xa2f9('0x5')](function(_0xe1fe78){var _0x54bba9=[];_0xe1fe78['forEach'](function(_0x235aba){var _0x3b8853;switch(_0x235aba[_0xa2f9('0xad')]){case'default':_0x3b8853=_[_0xa2f9('0x93')](_0x3b3297[_0xa2f9('0x6')],function(_0x56161a){return _0x56161a['id']===_0x235aba[_0xa2f9('0x76')]&&_0x56161a[_0xa2f9('0xf')]===_0xa2f9('0xae');});break;case _0xa2f9('0xaf'):_0x3b8853=_['find'](_0x3b3297[_0xa2f9('0x6')],function(_0x5218c1){return _0x5218c1['id']===_0x235aba[_0xa2f9('0x76')]&&_0x5218c1['type']===_0xa2f9('0xb0');});break;}if(_0x3b8853)_0x54bba9[_0xa2f9('0x91')](_0x235aba);});_0xb4b3b8[_0xa2f9('0xb1')]=_0x54bba9[_0xa2f9('0x96')];_0xb4b3b8['rows']=_0x54bba9;return _0xb4b3b8;});}else{if(!_['isEmpty'](_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xb2')])){_0x20228a[_0xa2f9('0x83')]['id']=_0x20228a['where']['id']?_[_0xa2f9('0x9d')](_0x20228a[_0xa2f9('0x83')]['id'],_0x255f28['query'][_0xa2f9('0xb2')]):_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xb2')];if(_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xb3')]){_0x20228a[_0xa2f9('0xa4')]=_0x255f28[_0xa2f9('0x86')]['customSorting'];}}if(_0x255f28['query']['extraQueryConditions']){_0x20228a[_0xa2f9('0x83')]=_[_0xa2f9('0xa7')](_0x20228a[_0xa2f9('0x83')],{'$and':_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xb4')]});}return _0x15504b[_0x289f35[_0xa2f9('0x14')]]['count']({'where':_0x20228a['where']})[_0xa2f9('0x5')](function(_0x2247a4){_0xb4b3b8[_0xa2f9('0xb1')]=_0x2247a4;if(_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xab')]){if(_0x289f35[_0xa2f9('0x14')]===_0xa2f9('0x1c')){_0x20228a[_0xa2f9('0xac')]=[{'model':_0x15504b[_0xa2f9('0x6c')],'as':_0xa2f9('0xb5'),'attributes':['id',_0xa2f9('0x9'),_0xa2f9('0xb6')],'required':_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xb7')]?!![]:![]},{'model':_0x15504b[_0xa2f9('0x6c')],'as':_0xa2f9('0xb8'),'attributes':['id',_0xa2f9('0x9'),_0xa2f9('0xb6')],'through':_0x255f28[_0xa2f9('0x86')]['tag']?{'attributes':[],'where':{'TagId':_0x255f28['query'][_0xa2f9('0xb7')]||undefined}}:{},'required':_0x255f28[_0xa2f9('0x86')][_0xa2f9('0xb7')]?!![]:![]}];}else{_0x20228a['include']=[{'all':!![]}];}}return _0x15504b[_0x289f35[_0xa2f9('0x14')]]['findAll'](_0x20228a);})[_0xa2f9('0x5')](function(_0x5ebc49){_0xb4b3b8['rows']=_0x5ebc49;if(_0x161580===_0xa2f9('0x53')&&_0x255f28[_0xa2f9('0x86')]['openTabs']===_0xa2f9('0xb9')){var _0x16f4bd=[];for(var _0x5249d0=0x0;_0x5249d0<_0xb4b3b8[_0xa2f9('0xba')][_0xa2f9('0x96')];_0x5249d0++){_0x16f4bd[_0xa2f9('0x91')](_0x323b8e(_0xa2f9('0xbb'),_0xb4b3b8[_0xa2f9('0xba')][_0x5249d0][_0xa2f9('0xbc')]));_0x16f4bd[_0xa2f9('0x91')](_0x323b8e(_0xa2f9('0xbd'),_0xb4b3b8[_0xa2f9('0xba')][_0x5249d0][_0xa2f9('0xbc')]));_0x16f4bd[_0xa2f9('0x91')](_0x323b8e(_0xa2f9('0xbe'),_0xb4b3b8[_0xa2f9('0xba')][_0x5249d0]['dataValues']));_0x16f4bd[_0xa2f9('0x91')](_0x323b8e(_0xa2f9('0xbf'),_0xb4b3b8[_0xa2f9('0xba')][_0x5249d0]['dataValues']));_0x16f4bd[_0xa2f9('0x91')](_0x323b8e(_0xa2f9('0xc0'),_0xb4b3b8[_0xa2f9('0xba')][_0x5249d0][_0xa2f9('0xbc')]));_0x16f4bd['push'](_0x323b8e(_0xa2f9('0xc1'),_0xb4b3b8[_0xa2f9('0xba')][_0x5249d0][_0xa2f9('0xbc')]));}return Promise[_0xa2f9('0x94')](_0x16f4bd)[_0xa2f9('0x5')](function(){return _0xb4b3b8;});}return _0xb4b3b8;});}});}}});}; \ No newline at end of file +var _0xd71b=['where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','all','ignore','isEmpty','union','find','rawAttributes','keys','intersection','fields','attributes','limit','offset','sort','pick','filters','merge','key','foreignKey','options','autoAssociation','includeAll','include','forEach','reportType','default','reportId','DefaultReports','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','CmContact','Tags','color','tag','openTabs','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','findAll','map','catch','value','model','then','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','name','projectName','projects','JscriptyProject','parentSections','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','agent','membername','telephone','VoiceQueue','inbound','QueueCampaigns','queue','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailAccount','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','pauses','Pause','Schedule','sounds','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','InteractionId','ui.createdAt','from','user_has_','_interactions'];(function(_0x4e175a,_0x2bae34){var _0x2ff2c4=function(_0x2849eb){while(--_0x2849eb){_0x4e175a['push'](_0x4e175a['shift']());}};_0x2ff2c4(++_0x2bae34);}(_0xd71b,0xfc));var _0xbd71=function(_0x2e9ac1,_0xdc520b){_0x2e9ac1=_0x2e9ac1-0x0;var _0x4befae=_0xd71b[_0x2e9ac1];return _0x4befae;};'use strict';var _=require(_0xbd71('0x0'));var attributes=require(_0xbd71('0x1'));var squel=require(_0xbd71('0x2'));module[_0xbd71('0x3')]=function(_0x276f98){var _0xcdf2d7=_0x276f98[_0xbd71('0x4')];function _0x321279(_0x357ac7,_0xb67a7f){return new Promise(function(_0x15b257,_0x3e362d){if(!_0xb67a7f)return _0x15b257(null);var _0x326e16=_0xb67a7f[_0xbd71('0x5')]?{[_0xb67a7f[_0xbd71('0x5')][_0xbd71('0x6')]]:_0xb67a7f[_0xbd71('0x5')]['value']}:undefined;return _0xcdf2d7[_0x357ac7][_0xbd71('0x7')]({'where':_0x326e16,'raw':!![]})['then'](function(_0x5de7ae){_0xb67a7f['associatedResources']=_[_0xbd71('0x8')](_0x5de7ae,'id');_0x15b257(_0xb67a7f);})[_0xbd71('0x9')](function(_0x490312){_0x3e362d(_0x490312);});});}function _0x31a87f(_0x5afe90,_0x524f9e){return new Promise(function(_0x34c8fe,_0x595366){var _0x5e13fb=_0x5afe90[_0xbd71('0x5')]?{[_0x5afe90[_0xbd71('0x5')]['field']]:_0x5afe90[_0xbd71('0x5')][_0xbd71('0xa')]}:undefined;return _0xcdf2d7[_0x5afe90[_0xbd71('0xb')]]['findAll']({'where':_0x5e13fb,'raw':!![]})[_0xbd71('0xc')](function(_0x2f7117){_0x524f9e[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x2f7117,function(_0x17d162){return _0x17d162['name'];});_0x34c8fe(_0x524f9e);})[_0xbd71('0x9')](function(_0x4e66f1){_0x595366(_0x4e66f1);});});}function _0x15fb32(_0x546b46,_0x48b58f,_0x3cfca3){if(!_0x48b58f)return Promise[_0xbd71('0xe')](null);return new Promise(function(_0x51527c,_0x1b1f86){return _0xcdf2d7[_0xbd71('0xf')][_0xbd71('0x7')]({'where':{'sectionId':_0x48b58f['id']},'raw':!![]})[_0xbd71('0xc')](function(_0x5da662){if(_0x546b46['field']&&_0x546b46[_0xbd71('0x6')]!=='id'){_0x48b58f[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x5da662,function(_0x15336a){return _0x15336a[_0x546b46[_0xbd71('0x6')]];});}else{if(_0x3cfca3===_0xbd71('0x10')){_0x48b58f[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x5da662,function(_0x144e15){return{'id':_0x144e15[_0xbd71('0x11')],'type':_0x144e15[_0xbd71('0x12')]};});}else{_0x48b58f[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x5da662,function(_0x2746c){return _0x2746c['resourceId'];});}}_0x51527c(_0x48b58f);})[_0xbd71('0x9')](function(_0x3c2de8){_0x1b1f86(_0x3c2de8);});});}function _0x1ff7c0(_0x4ff041,_0x46fdd5){var _0x10b49f={'parentSections':[]};switch(_0x4ff041['toLowerCase']()){case'squareprojects':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x14');break;case _0xbd71('0x15'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x16');break;case'squarerecordings':_0x10b49f['childModel']=_0xbd71('0x17');_0x10b49f['parentSections']=[{'name':_0xbd71('0x18'),'field':_0xbd71('0x19'),'foreignKey':_0xbd71('0x1a')}];break;case _0xbd71('0x1b'):_0x10b49f['childModel']=_0xbd71('0x1c');break;case'contacts':_0x10b49f['childModel']='CmContact';_0x10b49f[_0xbd71('0x1d')]=[{'name':_0xbd71('0x1e'),'field':'id','foreignKey':_0xbd71('0x1f')}];break;case'lists':_0x10b49f['childModel']=_0xbd71('0x20');break;case'companies':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x21');break;case _0xbd71('0x22'):_0x10b49f['childModel']=_0xbd71('0x23');break;case _0xbd71('0x24'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x25');break;case'chatwebsites':_0x10b49f[_0xbd71('0x13')]='ChatWebsite';break;case _0xbd71('0x26'):_0x10b49f[_0xbd71('0x13')]='FaxQueue';break;case _0xbd71('0x27'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x28');break;case _0xbd71('0x29'):case _0xbd71('0x2a'):case'outboundroutes':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x2b');break;case _0xbd71('0x2c'):_0x10b49f['childModel']=_0xbd71('0x2d');break;case _0xbd71('0x2e'):_0x10b49f[_0xbd71('0x13')]='VoiceMail';break;case _0xbd71('0x2f'):_0x10b49f[_0xbd71('0x13')]='VoiceRecording';_0x10b49f['parentSections']=[{'name':_0xbd71('0x30'),'field':_0xbd71('0x19'),'foreignKey':'membername','model':_0xbd71('0x31'),'filter':{'field':_0xbd71('0x32'),'value':[_0xbd71('0x33')]}},{'name':'Telephones','field':_0xbd71('0x19'),'foreignKey':_0xbd71('0x34'),'model':'User','filter':{'field':'role','value':[_0xbd71('0x35')]}},{'name':'VoiceQueues','field':'name','foreignKey':'queue','model':_0xbd71('0x36'),'filter':{'field':'type','value':[_0xbd71('0x37')]}},{'name':_0xbd71('0x38'),'field':'name','foreignKey':_0xbd71('0x39'),'model':_0xbd71('0x36'),'filter':{'field':_0xbd71('0x12'),'value':['outbound']}}];break;case'musiconholds':_0x10b49f['childModel']=_0xbd71('0x3a');break;case _0xbd71('0x3b'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x3c');break;case _0xbd71('0x3d'):_0x10b49f['childModel']=_0xbd71('0x3e');break;case'ivrcampaigns':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x3f');break;case _0xbd71('0x40'):_0x10b49f[_0xbd71('0x13')]='MailQueue';break;case'mailaccounts':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x41');break;case'mailsubstatuses':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x42');break;case'openchannelqueues':_0x10b49f['childModel']=_0xbd71('0x43');break;case'openchannelaccounts':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x44');break;case _0xbd71('0x45'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x46');break;case _0xbd71('0x47'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x48');break;case _0xbd71('0x49'):_0x10b49f['childModel']=_0xbd71('0x4a');break;case _0xbd71('0x4b'):_0x10b49f['childModel']=_0xbd71('0x4c');break;case _0xbd71('0x4d'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x4e');break;case'voicequeues':case _0xbd71('0x4f'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x36');if(_0x46fdd5){_0x10b49f[_0xbd71('0x1d')]=[{'name':_0xbd71('0x50')},{'name':'QueueCampaigns'}];}break;case _0xbd71('0x51'):case'agents':case _0xbd71('0x52'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x31');if(_0x46fdd5){_0x10b49f['parentSections']=[{'name':_0xbd71('0x53'),'filter':{'field':_0xbd71('0x32'),'value':[_0xbd71('0x54'),_0xbd71('0x55')]},'ignore':!![]},{'name':_0xbd71('0x30')},{'name':_0xbd71('0x56')}];}break;case _0xbd71('0x57'):_0x10b49f['childModel']=_0xbd71('0x58');break;case _0xbd71('0x59'):_0x10b49f[_0xbd71('0x13')]='SalesforceAccount';break;case _0xbd71('0x5a'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x5b');break;case _0xbd71('0x5c'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x5d');break;case _0xbd71('0x5e'):_0x10b49f[_0xbd71('0x13')]='DeskAccount';break;case _0xbd71('0x5f'):_0x10b49f[_0xbd71('0x13')]='ZohoAccount';break;case _0xbd71('0x60'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x31');break;case _0xbd71('0x61'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x62');break;case _0xbd71('0x63'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x64');break;case'customdashboards':_0x10b49f['childModel']=_0xbd71('0x65');break;case _0xbd71('0x66'):_0x10b49f[_0xbd71('0x13')]='Interval';break;case _0xbd71('0x67'):_0x10b49f['childModel']=_0xbd71('0x68');break;case'scheduler':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x69');break;case _0xbd71('0x6a'):_0x10b49f[_0xbd71('0x13')]='Sound';break;case'tags':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x6b');break;case _0xbd71('0x6c'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x6d');break;case _0xbd71('0x6e'):_0x10b49f['childModel']=_0xbd71('0x6f');break;case _0xbd71('0x70'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x71');break;case _0xbd71('0x72'):_0x10b49f['childModel']=_0xbd71('0x73');break;case _0xbd71('0x74'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x75');break;case _0xbd71('0x76'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x10');_0x10b49f[_0xbd71('0x1d')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xbd71('0x77'):_0x10b49f['childModel']=_0xbd71('0x78');break;}return _0x10b49f;}function _0x292c1a(_0x20ea13,_0x4fc67b){var _0x499e48=_0x20ea13['charAt'](0x0)['toUpperCase']()+_0x20ea13[_0xbd71('0x79')](0x1);var _0x12f958={'type':_0xcdf2d7[_0xbd71('0x7a')][_0xbd71('0x7b')][_0xbd71('0x7c')],'raw':!![]};return new Promise(function(_0x5b6760,_0x30892f){var _0x180a79=squel['select']()[_0xbd71('0x6')]('ui.'+_0x499e48+_0xbd71('0x7d'),'id')[_0xbd71('0x6')](_0xbd71('0x7e'))[_0xbd71('0x7f')](_0xbd71('0x80')+_0x20ea13+_0xbd71('0x81'),'ui')[_0xbd71('0x82')](_0xbd71('0x83'),_0x4fc67b['id']);return _0xcdf2d7[_0xbd71('0x84')][_0xbd71('0x85')](_0x180a79[_0xbd71('0x86')](),_0x12f958)[_0xbd71('0xc')](function(_0x2f7f71){_0x4fc67b[_0x499e48+_0xbd71('0x87')]=_0x2f7f71;_0x5b6760(_0x2f7f71);})['catch'](function(_0x376917){_0x30892f(_0x376917);});});}return _0x276f98[_0xbd71('0x88')](_0xbd71('0x89'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4b7358){var _0x2b434d=require(_0xbd71('0x8a'));var _0x45fdbd={'raw':_0x4b7358['query'][_0xbd71('0x8b')],'where':{}};var _0xc4d161={};var _0x1eb95a={'count':0x0,'rows':[]};var _0xa03d44=_0x4b7358[_0xbd71('0x85')][_0xbd71('0x8c')];var _0x1f74db=_0x4b7358[_0xbd71('0x85')][_0xbd71('0x8d')]||![];var _0x42db86=_0x1ff7c0(_0xa03d44,_0x1f74db);if(!_0x42db86[_0xbd71('0x13')])throw new Error(_0xbd71('0x8e')+_0xa03d44+'\x27');var _0x341099=[{'name':_0xa03d44}];if(!_['isEmpty'](_0x42db86[_0xbd71('0x1d')]))_0x341099=_0x42db86[_0xbd71('0x1d')];var _0x400767=[];for(var _0x36f2ec=0x0;_0x36f2ec<_0x341099[_0xbd71('0x8f')];_0x36f2ec++){_0x400767[_0xbd71('0x90')](_0xcdf2d7['UserProfileSection']['find']({'where':{'userProfileId':_0x4b7358['params']['id'],'name':_0x341099[_0x36f2ec][_0xbd71('0x19')]},'raw':!![]}));}return Promise[_0xbd71('0x91')](_0x400767)['then'](function(_0x261a31){var _0x54444f=_[_0xbd71('0x5')](_0x261a31,function(_0x3727ae){return _0x3727ae?_0x3727ae:undefined;});var _0x1307b3=_[_0xbd71('0x5')](_0x341099,[_0xbd71('0x92'),!![]]);var _0x4f4356=_[_0xbd71('0x93')](_0x54444f)&&_[_0xbd71('0x93')](_0x1307b3)?null:_[_0xbd71('0x94')](_0x1307b3,_0x54444f);if(!_0x4f4356)return null;var _0x399d29=[];for(var _0x1771a9=0x0;_0x1771a9<_0x4f4356[_0xbd71('0x8f')];_0x1771a9++){var _0xaca57f=_[_0xbd71('0x95')](_0x341099,function(_0x1682fa){return _0x4f4356[_0x1771a9]?_0x1682fa[_0xbd71('0x19')]===_0x4f4356[_0x1771a9][_0xbd71('0x19')]:null;});if(_0xaca57f){if(_0x4f4356[_0x1771a9][_0xbd71('0x92')]){_0x399d29[_0xbd71('0x90')](_0x321279(_0x42db86[_0xbd71('0x13')],_0x4f4356[_0x1771a9]));}else{if(!_0x4f4356[_0x1771a9]['autoAssociation']){_0x399d29['push'](_0x15fb32(_0xaca57f,_0x4f4356[_0x1771a9],_0x42db86[_0xbd71('0x13')]));}else{if(_0xaca57f[_0xbd71('0xb')]){_0x399d29[_0xbd71('0x90')](_0x31a87f(_0xaca57f,_0x4f4356[_0x1771a9]));}}}}}return Promise[_0xbd71('0x91')](_0x399d29);})[_0xbd71('0xc')](function(_0x564117){var _0x6c859e=_0x564117;var _0xeff7dd=null;if(_0x6c859e){_0xeff7dd=_0x6c859e[_0xbd71('0x8f')]===0x1?_0x6c859e[0x0]:null;}if(!_0xeff7dd&&!_0x6c859e)return _0x1eb95a;var _0x12d6a1=_0xcdf2d7[_0x42db86[_0xbd71('0x13')]][_0xbd71('0x96')];_0xc4d161[_0xbd71('0xb')]=_[_0xbd71('0x97')](_0x12d6a1);_0xc4d161[_0xbd71('0x85')]=_['keys'](_0x4b7358[_0xbd71('0x85')]);_0xc4d161['filters']=_['intersection'](_0xc4d161[_0xbd71('0xb')],_0xc4d161['query']);_0x45fdbd['attributes']=_[_0xbd71('0x98')](_0xc4d161[_0xbd71('0xb')],_0x2b434d[_0xbd71('0x99')](_0x4b7358['query']['fields']));_0x45fdbd[_0xbd71('0x9a')]=_0x45fdbd[_0xbd71('0x9a')][_0xbd71('0x8f')]?_0x45fdbd[_0xbd71('0x9a')]:_0xc4d161[_0xbd71('0xb')];if(!_0x4b7358[_0xbd71('0x85')]['hasOwnProperty']('nolimit')){_0x45fdbd['limit']=_0x2b434d[_0xbd71('0x9b')](_0x4b7358[_0xbd71('0x85')][_0xbd71('0x9b')]);_0x45fdbd[_0xbd71('0x9c')]=_0x2b434d[_0xbd71('0x9c')](_0x4b7358['query'][_0xbd71('0x9c')]);}_0x45fdbd['order']=_0x2b434d[_0xbd71('0x9d')](_0x4b7358[_0xbd71('0x85')][_0xbd71('0x9d')]);_0x45fdbd[_0xbd71('0x82')]=_0x2b434d['filters'](_[_0xbd71('0x9e')](_0x4b7358[_0xbd71('0x85')],_0xc4d161[_0xbd71('0x9f')]));if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0x5')]){_0x45fdbd[_0xbd71('0x82')]=_[_0xbd71('0xa0')](_0x45fdbd[_0xbd71('0x82')],{'$or':_[_0xbd71('0x8')](_0x12d6a1,function(_0x325707){if(_0x325707[_0xbd71('0x12')][_0xbd71('0xa1')]!=='VIRTUAL'){var _0x4a507b={};_0x4a507b[_0x325707['field']]={'$like':'%'+_0x4b7358[_0xbd71('0x85')][_0xbd71('0x5')]+'%'};return _0x4a507b;}})});}var _0x539c63=[];var _0x510bcf=null;var _0x46d4b={};if(_0xeff7dd){_0x510bcf=_[_0xbd71('0x95')](_0x341099,['name',_0xeff7dd[_0xbd71('0x19')]]);if(_0x510bcf['field']){_0x46d4b={};if(_0x42db86[_0xbd71('0x13')]===_0xbd71('0x10')){_0x46d4b[_0x510bcf[_0xbd71('0xa2')]]=_[_0xbd71('0x8')](_0xeff7dd['associatedResources'],'id');}else{_0x46d4b[_0x510bcf['foreignKey']]=_0xeff7dd['associatedResources'];}_0x539c63[_0xbd71('0x90')](_0x46d4b);}else{_0x45fdbd[_0xbd71('0x82')]['id']=_0xeff7dd[_0xbd71('0xd')];}}else{for(var _0x522d70=0x0;_0x522d70<_0x6c859e[_0xbd71('0x8f')];_0x522d70++){_0x510bcf=_[_0xbd71('0x95')](_0x341099,[_0xbd71('0x19'),_0x6c859e[_0x522d70][_0xbd71('0x19')]]);if(_0x510bcf[_0xbd71('0x6')]){_0x46d4b={};_0x46d4b[_0x510bcf[_0xbd71('0xa2')]]=_0x6c859e[_0x522d70][_0xbd71('0xd')];_0x539c63[_0xbd71('0x90')](_0x46d4b);}else{if(!_0x45fdbd[_0xbd71('0x82')]['id'])_0x45fdbd[_0xbd71('0x82')]['id']=[];_0x6c859e[_0x522d70]['associatedResources']['forEach'](function(_0x1b2a2b){_0x45fdbd['where']['id'][_0xbd71('0x90')](_0x1b2a2b);});}}}if(!_['isEmpty'](_0x539c63)){_0x45fdbd[_0xbd71('0x82')]=_[_0xbd71('0xa0')](_0x45fdbd[_0xbd71('0x82')],{'$and':{'$or':_0x539c63}});}_0x45fdbd=_[_0xbd71('0xa0')]({},_0x45fdbd,_0x4b7358[_0xbd71('0xa3')]);if(_0xeff7dd&&!_0xeff7dd[_0xbd71('0xa4')]&&_0x42db86[_0xbd71('0x13')]===_0xbd71('0x10')){if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xa5')]){_0x45fdbd[_0xbd71('0xa6')]=[{'all':!![]}];}return _0xcdf2d7[_0x42db86[_0xbd71('0x13')]][_0xbd71('0x7')](_0x45fdbd)['then'](function(_0x5d369c){var _0x21dda5=[];_0x5d369c[_0xbd71('0xa7')](function(_0x4480a9){var _0x49fb7f;switch(_0x4480a9[_0xbd71('0xa8')]){case _0xbd71('0xa9'):_0x49fb7f=_[_0xbd71('0x95')](_0xeff7dd['associatedResources'],function(_0x22b5be){return _0x22b5be['id']===_0x4480a9[_0xbd71('0xaa')]&&_0x22b5be[_0xbd71('0x12')]===_0xbd71('0xab');});break;case'custom':_0x49fb7f=_[_0xbd71('0x95')](_0xeff7dd[_0xbd71('0xd')],function(_0x591641){return _0x591641['id']===_0x4480a9[_0xbd71('0xaa')]&&_0x591641[_0xbd71('0x12')]===_0xbd71('0xac');});break;}if(_0x49fb7f)_0x21dda5[_0xbd71('0x90')](_0x4480a9);});_0x1eb95a[_0xbd71('0xad')]=_0x21dda5[_0xbd71('0x8f')];_0x1eb95a[_0xbd71('0xae')]=_0x21dda5;return _0x1eb95a;});}else{if(!_[_0xbd71('0x93')](_0x4b7358[_0xbd71('0x85')][_0xbd71('0xaf')])){_0x45fdbd[_0xbd71('0x82')]['id']=_0x45fdbd[_0xbd71('0x82')]['id']?_[_0xbd71('0x98')](_0x45fdbd[_0xbd71('0x82')]['id'],_0x4b7358['query'][_0xbd71('0xaf')]):_0x4b7358[_0xbd71('0x85')][_0xbd71('0xaf')];if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb0')]){_0x45fdbd[_0xbd71('0xb1')]=_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb0')];}}if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb2')]){_0x45fdbd[_0xbd71('0x82')]=_['merge'](_0x45fdbd['where'],{'$and':_0x4b7358[_0xbd71('0x85')]['extraQueryConditions']});}return _0xcdf2d7[_0x42db86['childModel']][_0xbd71('0xad')]({'where':_0x45fdbd[_0xbd71('0x82')]})['then'](function(_0x23276d){_0x1eb95a[_0xbd71('0xad')]=_0x23276d;if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xa5')]){if(_0x42db86[_0xbd71('0x13')]===_0xbd71('0xb3')){_0x45fdbd[_0xbd71('0xa6')]=[{'model':_0xcdf2d7['Tag'],'as':_0xbd71('0xb4'),'attributes':['id',_0xbd71('0x19'),'color'],'required':_0x4b7358['query']['tag']?!![]:![]},{'model':_0xcdf2d7[_0xbd71('0x6b')],'as':'ThroughTags','attributes':['id',_0xbd71('0x19'),_0xbd71('0xb5')],'through':_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb6')]?{'attributes':[],'where':{'TagId':_0x4b7358['query'][_0xbd71('0xb6')]||undefined}}:{},'required':_0x4b7358[_0xbd71('0x85')]['tag']?!![]:![]}];}else{_0x45fdbd[_0xbd71('0xa6')]=[{'all':!![]}];}}return _0xcdf2d7[_0x42db86[_0xbd71('0x13')]]['findAll'](_0x45fdbd);})[_0xbd71('0xc')](function(_0x486bf8){_0x1eb95a[_0xbd71('0xae')]=_0x486bf8;if(_0xa03d44===_0xbd71('0x30')&&_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb7')]==='true'){var _0x5818dd=[];for(var _0x29ef90=0x0;_0x29ef90<_0x1eb95a['rows'][_0xbd71('0x8f')];_0x29ef90++){_0x5818dd['push'](_0x292c1a(_0xbd71('0xb8'),_0x1eb95a['rows'][_0x29ef90]['dataValues']));_0x5818dd['push'](_0x292c1a(_0xbd71('0xb9'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90][_0xbd71('0xba')]));_0x5818dd[_0xbd71('0x90')](_0x292c1a(_0xbd71('0xbb'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90]['dataValues']));_0x5818dd[_0xbd71('0x90')](_0x292c1a(_0xbd71('0xbc'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90][_0xbd71('0xba')]));_0x5818dd[_0xbd71('0x90')](_0x292c1a(_0xbd71('0xbd'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90][_0xbd71('0xba')]));_0x5818dd['push'](_0x292c1a(_0xbd71('0xbe'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90]['dataValues']));}return Promise[_0xbd71('0x91')](_0x5818dd)[_0xbd71('0xc')](function(){return _0x1eb95a;});}return _0x1eb95a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2ce5f2d..078beca 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 _0x103f=['register','info','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x157ac7,_0x332e33){var _0x253f41=function(_0x16b64a){while(--_0x16b64a){_0x157ac7['push'](_0x157ac7['shift']());}};_0x253f41(++_0x332e33);}(_0x103f,0x13e));var _0xf103=function(_0x57274b,_0x2ff3f1){_0x57274b=_0x57274b-0x0;var _0x1fd10e=_0x103f[_0x57274b];return _0x1fd10e;};'use strict';var _=require(_0xf103('0x0'));var util=require(_0xf103('0x1'));var moment=require(_0xf103('0x2'));var BPromise=require(_0xf103('0x3'));var rs=require(_0xf103('0x4'));var fs=require('fs');var Redis=require(_0xf103('0x5'));var db=require(_0xf103('0x6'))['db'];var utils=require(_0xf103('0x7'));var logger=require(_0xf103('0x8'))(_0xf103('0x9'));var config=require('../../config/environment');var jayson=require(_0xf103('0xa'));var client=jayson[_0xf103('0xb')][_0xf103('0xc')]({'port':0x232a});config[_0xf103('0xd')]=_[_0xf103('0xe')](config[_0xf103('0xd')],{'host':_0xf103('0xf'),'port':0x18eb});var socket=require(_0xf103('0x10'))(new Redis(config[_0xf103('0xd')]));require(_0xf103('0x11'))[_0xf103('0x12')](socket);function respondWithRpcPromise(_0x267ec4,_0x47b71b,_0x228805){return new BPromise(function(_0x532559,_0x2aa8fd){return client['request'](_0x267ec4,_0x228805)['then'](function(_0xb3a849){logger[_0xf103('0x13')]('UserProfile,\x20%s,\x20%s',_0x47b71b,_0xf103('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x47b71b,'request\x20sent',JSON[_0xf103('0x15')](_0xb3a849));if(_0xb3a849['error']){if(_0xb3a849[_0xf103('0x16')][_0xf103('0x17')]===0x1f4){logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849[_0xf103('0x16')]['message']);return _0x2aa8fd(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849['error']['message']);return _0x532559(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}else{logger[_0xf103('0x13')](_0xf103('0x18'),_0x47b71b,_0xf103('0x14'));_0x532559(_0xb3a849[_0xf103('0x1a')]['message']);}})[_0xf103('0x1b')](function(_0x338a44){logger['error'](_0xf103('0x18'),_0x47b71b,_0x338a44);_0x2aa8fd(_0x338a44);});});} \ No newline at end of file +var _0x1a38=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1a38,0xb0));var _0x81a3=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x1a38[_0x2caaef];return _0xd011f8;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var moment=require(_0x81a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81a3('0x3'))['db'];var utils=require(_0x81a3('0x4'));var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));var config=require(_0x81a3('0x7'));var jayson=require(_0x81a3('0x8'));var client=jayson[_0x81a3('0x9')][_0x81a3('0xa')]({'port':0x232a});config[_0x81a3('0xb')]=_[_0x81a3('0xc')](config[_0x81a3('0xb')],{'host':_0x81a3('0xd'),'port':0x18eb});var socket=require(_0x81a3('0xe'))(new Redis(config['redis']));require(_0x81a3('0xf'))[_0x81a3('0x10')](socket);function respondWithRpcPromise(_0x3ece9a,_0x10f4c5,_0x3fd4fe){return new BPromise(function(_0x4a7f3a,_0xeef25e){return client[_0x81a3('0x11')](_0x3ece9a,_0x3fd4fe)[_0x81a3('0x12')](function(_0x516492){logger['info'](_0x81a3('0x13'),_0x10f4c5,_0x81a3('0x14'));logger[_0x81a3('0x15')](_0x81a3('0x16'),_0x10f4c5,_0x81a3('0x14'),JSON[_0x81a3('0x17')](_0x516492));if(_0x516492[_0x81a3('0x18')]){if(_0x516492[_0x81a3('0x18')][_0x81a3('0x19')]===0x1f4){logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x10f4c5,_0x516492[_0x81a3('0x18')]['message']);return _0xeef25e(_0x516492[_0x81a3('0x18')][_0x81a3('0x1a')]);}logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x10f4c5,_0x516492['error'][_0x81a3('0x1a')]);return _0x4a7f3a(_0x516492[_0x81a3('0x18')]['message']);}else{logger[_0x81a3('0x1b')]('UserProfile,\x20%s,\x20%s',_0x10f4c5,'request\x20sent');_0x4a7f3a(_0x516492[_0x81a3('0x1c')][_0x81a3('0x1a')]);}})[_0x81a3('0x1d')](function(_0x18c316){logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x10f4c5,_0x18c316);_0xeef25e(_0x18c316);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cd9ca72..5e26307 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 _0xf117=['./userProfile.events','remove','update','removeListener','register','length','userProfile:'];(function(_0x5b965e,_0x26aeaa){var _0x4693b4=function(_0xd92ea0){while(--_0xd92ea0){_0x5b965e['push'](_0x5b965e['shift']());}};_0x4693b4(++_0x26aeaa);}(_0xf117,0xb6));var _0x7f11=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xf117[_0x599f41];return _0x2e4d58;};'use strict';var UserProfileEvents=require(_0x7f11('0x0'));var events=['save',_0x7f11('0x1'),_0x7f11('0x2')];function createListener(_0x2d2b86,_0x4c4e2c){return function(_0xca9bc5){_0x4c4e2c['emit'](_0x2d2b86,_0xca9bc5);};}function removeListener(_0x4f4cec,_0x7fa87e){return function(){UserProfileEvents[_0x7f11('0x3')](_0x4f4cec,_0x7fa87e);};}exports[_0x7f11('0x4')]=function(_0x56e2df){for(var _0x2d3296=0x0,_0x28c361=events[_0x7f11('0x5')];_0x2d3296<_0x28c361;_0x2d3296++){var _0x14c858=events[_0x2d3296];var _0x80368d=createListener(_0x7f11('0x6')+_0x14c858,_0x56e2df);UserProfileEvents['on'](_0x14c858,_0x80368d);}}; \ No newline at end of file +var _0xdeac=['length','./userProfile.events','save','remove','removeListener','register'];(function(_0x20fcec,_0x33eb9b){var _0x346870=function(_0x378099){while(--_0x378099){_0x20fcec['push'](_0x20fcec['shift']());}};_0x346870(++_0x33eb9b);}(_0xdeac,0x1d5));var _0xcdea=function(_0x36cf60,_0x581c08){_0x36cf60=_0x36cf60-0x0;var _0x253cff=_0xdeac[_0x36cf60];return _0x253cff;};'use strict';var UserProfileEvents=require(_0xcdea('0x0'));var events=[_0xcdea('0x1'),_0xcdea('0x2'),'update'];function createListener(_0x213bf1,_0x8897f4){return function(_0x5e3f7d){_0x8897f4['emit'](_0x213bf1,_0x5e3f7d);};}function removeListener(_0x2a13f3,_0x2d8f29){return function(){UserProfileEvents[_0xcdea('0x3')](_0x2a13f3,_0x2d8f29);};}exports[_0xcdea('0x4')]=function(_0x547f41){for(var _0x28048a=0x0,_0xde8fb=events[_0xcdea('0x5')];_0x28048a<_0xde8fb;_0x28048a++){var _0xd523b=events[_0x28048a];var _0x80d3af=createListener('userProfile:'+_0xd523b,_0x547f41);UserProfileEvents['on'](_0xd523b,_0x80d3af);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7ea3d5f..c154acc 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 _0x6a3a=['/describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6a3a,0x1ad));var _0xa6a3=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x6a3a[_0x4b73a2];return _0x383c66;};'use strict';var multer=require(_0xa6a3('0x0'));var util=require(_0xa6a3('0x1'));var path=require(_0xa6a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa6a3('0x3'));var router=express[_0xa6a3('0x4')]();var fs_extra=require(_0xa6a3('0x5'));var auth=require(_0xa6a3('0x6'));var interaction=require(_0xa6a3('0x7'));var config=require(_0xa6a3('0x8'));var controller=require(_0xa6a3('0x9'));router[_0xa6a3('0xa')]('/',auth[_0xa6a3('0xb')](),controller['index']);router['get'](_0xa6a3('0xc'),auth[_0xa6a3('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa6a3('0xd')]('/',auth[_0xa6a3('0xb')](),controller[_0xa6a3('0xe')]);router[_0xa6a3('0xf')](_0xa6a3('0x10'),auth[_0xa6a3('0xb')](),controller[_0xa6a3('0x11')]);router[_0xa6a3('0x12')](_0xa6a3('0x10'),auth[_0xa6a3('0xb')](),controller[_0xa6a3('0x13')]);module[_0xa6a3('0x14')]=router; \ No newline at end of file +var _0xfd74=['update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x2682d9,_0x2c716d){var _0x35e49f=function(_0x1f9456){while(--_0x1f9456){_0x2682d9['push'](_0x2682d9['shift']());}};_0x35e49f(++_0x2c716d);}(_0xfd74,0x81));var _0x4fd7=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xfd74[_0x21de89];return _0x290b7e;};'use strict';var multer=require('multer');var util=require(_0x4fd7('0x0'));var path=require(_0x4fd7('0x1'));var timeout=require(_0x4fd7('0x2'));var express=require(_0x4fd7('0x3'));var router=express['Router']();var fs_extra=require(_0x4fd7('0x4'));var auth=require(_0x4fd7('0x5'));var interaction=require(_0x4fd7('0x6'));var config=require(_0x4fd7('0x7'));var controller=require(_0x4fd7('0x8'));router[_0x4fd7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4fd7('0x9')](_0x4fd7('0xa'),auth['isAuthenticated'](),controller[_0x4fd7('0xb')]);router[_0x4fd7('0x9')]('/:id',auth[_0x4fd7('0xc')](),controller[_0x4fd7('0xd')]);router[_0x4fd7('0xe')]('/',auth[_0x4fd7('0xc')](),controller[_0x4fd7('0xf')]);router[_0x4fd7('0x10')](_0x4fd7('0x11'),auth[_0x4fd7('0xc')](),controller[_0x4fd7('0x12')]);router['delete'](_0x4fd7('0x11'),auth[_0x4fd7('0xc')](),controller[_0x4fd7('0x13')]);module[_0x4fd7('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 745c15f..29ad7fb 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 _0xd209=['sequelize','exports','STRING','INTEGER'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0xd209,0xcc));var _0x9d20=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xd209[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x9d20('0x0'));module[_0x9d20('0x1')]={'name':{'type':Sequelize[_0x9d20('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9d20('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9d20('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbf72=['STRING','INTEGER','sequelize','exports'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0xbf72,0x1de));var _0x2bf7=function(_0x187d57,_0x15dcf2){_0x187d57=_0x187d57-0x0;var _0x4d92e3=_0xbf72[_0x187d57];return _0x4d92e3;};'use strict';var Sequelize=require(_0x2bf7('0x0'));module[_0x2bf7('0x1')]={'name':{'type':Sequelize[_0x2bf7('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2bf7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2bf7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index feb1d47..10c6c1f 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 _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x6343,0x168));var _0x3634=function(_0x269cb3,_0x55f94d){_0x269cb3=_0x269cb3-0x0;var _0x3c69f4=_0x6343[_0x269cb3];return _0x3c69f4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file +var _0x9582=['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','UserProfileResource','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','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x48fc39,_0x387dc6){var _0x16b2f7=function(_0x39b6a7){while(--_0x39b6a7){_0x48fc39['push'](_0x48fc39['shift']());}};_0x16b2f7(++_0x387dc6);}(_0x9582,0x95));var _0x2958=function(_0x14e7f7,_0xc433d8){_0x14e7f7=_0x14e7f7-0x0;var _0x467ebc=_0x9582[_0x14e7f7];return _0x467ebc;};'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('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 47ae22b..3ab568f 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 _0xe14e=['request-promise','path','rimraf','../../config/environment','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3ce9f4,_0x5733d5){var _0x5399fa=function(_0x281079){while(--_0x281079){_0x3ce9f4['push'](_0x3ce9f4['shift']());}};_0x5399fa(++_0x5733d5);}(_0xe14e,0xcd));var _0xee14=function(_0x3adc53,_0x282662){_0x3adc53=_0x3adc53-0x0;var _0x5db908=_0xe14e[_0x3adc53];return _0x5db908;};'use strict';var _=require(_0xee14('0x0'));var util=require(_0xee14('0x1'));var logger=require(_0xee14('0x2'))('api');var moment=require(_0xee14('0x3'));var BPromise=require(_0xee14('0x4'));var rp=require(_0xee14('0x5'));var fs=require('fs');var path=require(_0xee14('0x6'));var rimraf=require(_0xee14('0x7'));var config=require(_0xee14('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x3fa112,_0x44c694){return _0x3fa112[_0xee14('0x9')](_0xee14('0xa'),attributes,{'tableName':_0xee14('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xee14('0xc'),_0xee14('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7f2=['bluebird','request-promise','path','../../config/environment','exports','define','resourceId','lodash','util','api','moment'];(function(_0x6b3f9c,_0x433d66){var _0x4178e3=function(_0x13136f){while(--_0x13136f){_0x6b3f9c['push'](_0x6b3f9c['shift']());}};_0x4178e3(++_0x433d66);}(_0xa7f2,0x10f));var _0x2a7f=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0xa7f2[_0x2cd1e4];return _0x167374;};'use strict';var _=require(_0x2a7f('0x0'));var util=require(_0x2a7f('0x1'));var logger=require('../../config/logger')(_0x2a7f('0x2'));var moment=require(_0x2a7f('0x3'));var BPromise=require(_0x2a7f('0x4'));var rp=require(_0x2a7f('0x5'));var fs=require('fs');var path=require(_0x2a7f('0x6'));var rimraf=require('rimraf');var config=require(_0x2a7f('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x2a7f('0x8')]=function(_0x4bc1cb,_0xa85cdc){return _0x4bc1cb[_0x2a7f('0x9')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x2a7f('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 acdc574..538d1b1 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 _0x195c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x195c,0xe2));var _0xc195=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x195c[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0xc195('0x0'));var util=require(_0xc195('0x1'));var moment=require(_0xc195('0x2'));var BPromise=require(_0xc195('0x3'));var rs=require(_0xc195('0x4'));var fs=require('fs');var Redis=require(_0xc195('0x5'));var db=require(_0xc195('0x6'))['db'];var utils=require(_0xc195('0x7'));var logger=require(_0xc195('0x8'))(_0xc195('0x9'));var config=require(_0xc195('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc195('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b40b7,_0x14250a,_0x5a24cb){return new BPromise(function(_0x2b8610,_0x3bd3d9){return client[_0xc195('0xc')](_0x2b40b7,_0x5a24cb)[_0xc195('0xd')](function(_0x3cdcdc){logger[_0xc195('0xe')](_0xc195('0xf'),_0x14250a,_0xc195('0x10'));logger[_0xc195('0x11')](_0xc195('0x12'),_0x14250a,'request\x20sent',JSON[_0xc195('0x13')](_0x3cdcdc));if(_0x3cdcdc['error']){if(_0x3cdcdc['error'][_0xc195('0x14')]===0x1f4){logger['error'](_0xc195('0xf'),_0x14250a,_0x3cdcdc[_0xc195('0x15')]['message']);return _0x3bd3d9(_0x3cdcdc[_0xc195('0x15')][_0xc195('0x16')]);}logger['error'](_0xc195('0xf'),_0x14250a,_0x3cdcdc['error']['message']);return _0x2b8610(_0x3cdcdc[_0xc195('0x15')]['message']);}else{logger[_0xc195('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x14250a,_0xc195('0x10'));_0x2b8610(_0x3cdcdc[_0xc195('0x17')][_0xc195('0x16')]);}})[_0xc195('0x18')](function(_0x581a35){logger['error'](_0xc195('0xf'),_0x14250a,_0x581a35);_0x3bd3d9(_0x581a35);});});} \ No newline at end of file +var _0x786e=['jayson/promise','client','http','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x52faff,_0x2b0983){var _0x359b95=function(_0x191e08){while(--_0x191e08){_0x52faff['push'](_0x52faff['shift']());}};_0x359b95(++_0x2b0983);}(_0x786e,0x14f));var _0xe786=function(_0x578a78,_0xfdd763){_0x578a78=_0x578a78-0x0;var _0x5b517b=_0x786e[_0x578a78];return _0x5b517b;};'use strict';var _=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var moment=require('moment');var BPromise=require(_0xe786('0x2'));var rs=require(_0xe786('0x3'));var fs=require('fs');var Redis=require(_0xe786('0x4'));var db=require(_0xe786('0x5'))['db'];var utils=require(_0xe786('0x6'));var logger=require(_0xe786('0x7'))(_0xe786('0x8'));var config=require(_0xe786('0x9'));var jayson=require(_0xe786('0xa'));var client=jayson[_0xe786('0xb')][_0xe786('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x173713,_0x5af29e,_0x48d846){return new BPromise(function(_0x2b777f,_0x94f7ce){return client['request'](_0x173713,_0x48d846)['then'](function(_0x14bfa4){logger[_0xe786('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x5af29e,_0xe786('0xe'));logger[_0xe786('0xf')](_0xe786('0x10'),_0x5af29e,_0xe786('0xe'),JSON['stringify'](_0x14bfa4));if(_0x14bfa4['error']){if(_0x14bfa4[_0xe786('0x11')][_0xe786('0x12')]===0x1f4){logger['error'](_0xe786('0x13'),_0x5af29e,_0x14bfa4[_0xe786('0x11')][_0xe786('0x14')]);return _0x94f7ce(_0x14bfa4[_0xe786('0x11')][_0xe786('0x14')]);}logger[_0xe786('0x11')](_0xe786('0x13'),_0x5af29e,_0x14bfa4[_0xe786('0x11')]['message']);return _0x2b777f(_0x14bfa4[_0xe786('0x11')][_0xe786('0x14')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x5af29e,'request\x20sent');_0x2b777f(_0x14bfa4[_0xe786('0x15')][_0xe786('0x14')]);}})[_0xe786('0x16')](function(_0x39b127){logger[_0xe786('0x11')](_0xe786('0x13'),_0x5af29e,_0x39b127);_0x94f7ce(_0x39b127);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 21e88c1..7c2d7ac 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 _0x60ef=['index','get','/describe','/:id','show','post','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x4d2348,_0x2e597a){var _0x1a2dc4=function(_0x4b2785){while(--_0x4b2785){_0x4d2348['push'](_0x4d2348['shift']());}};_0x1a2dc4(++_0x2e597a);}(_0x60ef,0x64));var _0xf60e=function(_0x166c37,_0x3dd09d){_0x166c37=_0x166c37-0x0;var _0x16923d=_0x60ef[_0x166c37];return _0x16923d;};'use strict';var multer=require(_0xf60e('0x0'));var util=require('util');var path=require(_0xf60e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf60e('0x2')]();var fs_extra=require(_0xf60e('0x3'));var auth=require(_0xf60e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf60e('0x5'));var controller=require(_0xf60e('0x6'));router['get']('/',auth[_0xf60e('0x7')](),controller[_0xf60e('0x8')]);router[_0xf60e('0x9')](_0xf60e('0xa'),auth[_0xf60e('0x7')](),controller['describe']);router[_0xf60e('0x9')](_0xf60e('0xb'),auth['isAuthenticated'](),controller[_0xf60e('0xc')]);router[_0xf60e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf60e('0xe')](_0xf60e('0xb'),auth[_0xf60e('0x7')](),controller[_0xf60e('0xf')]);router[_0xf60e('0x10')](_0xf60e('0xb'),auth[_0xf60e('0x7')](),controller['destroy']);module[_0xf60e('0x11')]=router; \ No newline at end of file +var _0x6501=['connect-timeout','express','Router','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x28326c,_0x4ce18d){var _0x5b7724=function(_0x2c794f){while(--_0x2c794f){_0x28326c['push'](_0x28326c['shift']());}};_0x5b7724(++_0x4ce18d);}(_0x6501,0xdc));var _0x1650=function(_0x3de68c,_0x1904c0){_0x3de68c=_0x3de68c-0x0;var _0x7cf988=_0x6501[_0x3de68c];return _0x7cf988;};'use strict';var multer=require(_0x1650('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1650('0x1'));var express=require(_0x1650('0x2'));var router=express[_0x1650('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1650('0x4'));var controller=require(_0x1650('0x5'));router[_0x1650('0x6')]('/',auth[_0x1650('0x7')](),controller[_0x1650('0x8')]);router[_0x1650('0x6')](_0x1650('0x9'),auth[_0x1650('0x7')](),controller['describe']);router[_0x1650('0x6')](_0x1650('0xa'),auth[_0x1650('0x7')](),controller[_0x1650('0xb')]);router[_0x1650('0xc')]('/',auth['isAuthenticated'](),controller[_0x1650('0xd')]);router['put'](_0x1650('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1650('0xe')](_0x1650('0xa'),auth['isAuthenticated'](),controller[_0x1650('0xf')]);module[_0x1650('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c20b75f..81107d6 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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x20aa03,_0x396e2e){var _0x50341a=function(_0x362e51){while(--_0x362e51){_0x20aa03['push'](_0x20aa03['shift']());}};_0x50341a(++_0x396e2e);}(_0x6cb4,0xff));var _0x46cb=function(_0x420f45,_0x5aefd3){_0x420f45=_0x420f45-0x0;var _0xcb33bd=_0x6cb4[_0x420f45];return _0xcb33bd;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0x9354=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x9354,0x96));var _0x4935=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x9354[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4935('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4935('0x1')],'set':function(_0x5327fc){this[_0x4935('0x4')](_0x4935('0x5'),_0x5327fc?_0x5327fc[_0x4935('0x6')](''):[]);},'get':function(){return this[_0x4935('0x7')](_0x4935('0x5'))?this[_0x4935('0x7')](_0x4935('0x5'))[_0x4935('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 41178d1..b8eecc9 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 _0xb1b7=['params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','moment','bluebird','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','UserProfileSection','includeAll','include','findAll','rows','catch','show'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xb1b7,0x165));var _0x7b1b=function(_0x5f08fc,_0x4f314f){_0x5f08fc=_0x5f08fc-0x0;var _0x41e94d=_0xb1b7[_0x5f08fc];return _0x41e94d;};'use strict';var emlformat=require(_0x7b1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b1b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b1b('0x2'));var BPromise=require(_0x7b1b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7b1b('0x4'));var csv=require(_0x7b1b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b1b('0x6'));var _=require('lodash');var squel=require(_0x7b1b('0x7'));var crypto=require('crypto');var jsforce=require(_0x7b1b('0x8'));var deskjs=require(_0x7b1b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x7b1b('0xa'));var Papa=require(_0x7b1b('0xb'));var Redis=require(_0x7b1b('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b1b('0xd'));var hardwareService=require(_0x7b1b('0xe'));var logger=require(_0x7b1b('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x7b1b('0x10'));var licenseUtil=require(_0x7b1b('0x11'));var db=require(_0x7b1b('0x12'))['db'];function respondWithStatusCode(_0x577067,_0x3acdc0){_0x3acdc0=_0x3acdc0||0xcc;return function(_0x21a081){if(_0x21a081){return _0x577067[_0x7b1b('0x13')](_0x3acdc0);}return _0x577067[_0x7b1b('0x14')](_0x3acdc0)['end']();};}function respondWithResult(_0x27b99d,_0x27f521){_0x27f521=_0x27f521||0xc8;return function(_0x56f839){if(_0x56f839){return _0x27b99d[_0x7b1b('0x14')](_0x27f521)[_0x7b1b('0x15')](_0x56f839);}};}function respondWithFilteredResult(_0x33e07f,_0x26c01d){return function(_0x1a3b0a){if(_0x1a3b0a){var _0x365081=typeof _0x26c01d['offset']===_0x7b1b('0x16')&&typeof _0x26c01d[_0x7b1b('0x17')]===_0x7b1b('0x16');var _0x1a7e2d=_0x1a3b0a[_0x7b1b('0x18')];var _0x11c927=_0x365081?0x0:_0x26c01d[_0x7b1b('0x19')];var _0x306b24=_0x365081?_0x1a3b0a[_0x7b1b('0x18')]:_0x26c01d['offset']+_0x26c01d[_0x7b1b('0x17')];var _0x288042;if(_0x306b24>=_0x1a7e2d){_0x306b24=_0x1a7e2d;_0x288042=0xc8;}else{_0x288042=0xce;}_0x33e07f[_0x7b1b('0x14')](_0x288042);return _0x33e07f['set'](_0x7b1b('0x1a'),_0x11c927+'-'+_0x306b24+'/'+_0x1a7e2d)[_0x7b1b('0x15')](_0x1a3b0a);}return null;};}function patchUpdates(_0x312cba){return function(_0x1a05b6){try{jsonpatch['apply'](_0x1a05b6,_0x312cba,!![]);}catch(_0x5b8569){return BPromise['reject'](_0x5b8569);}return _0x1a05b6[_0x7b1b('0x1b')]();};}function saveUpdates(_0x5af643,_0x5e72f7){return function(_0x201d91){if(_0x201d91){return _0x201d91[_0x7b1b('0x1c')](_0x5af643)[_0x7b1b('0x1d')](function(_0xf3b7e7){return _0xf3b7e7;});}return null;};}function removeEntity(_0x3a9c20,_0x4b7237){return function(_0x241044){if(_0x241044){return _0x241044[_0x7b1b('0x1e')]()[_0x7b1b('0x1d')](function(){_0x3a9c20[_0x7b1b('0x14')](0xcc)[_0x7b1b('0x1f')]();});}};}function handleEntityNotFound(_0x549429,_0x5b7f44){return function(_0x2535e5){if(!_0x2535e5){_0x549429[_0x7b1b('0x13')](0x194);}return _0x2535e5;};}function handleError(_0x15c77a,_0x27bb75){_0x27bb75=_0x27bb75||0x1f4;return function(_0x21621c){logger[_0x7b1b('0x20')](_0x21621c[_0x7b1b('0x21')]);if(_0x21621c[_0x7b1b('0x22')]){delete _0x21621c['name'];}_0x15c77a[_0x7b1b('0x14')](_0x27bb75)[_0x7b1b('0x23')](_0x21621c);};}exports[_0x7b1b('0x24')]=function(_0x3429c4,_0x1534b8){var _0x4f5c56={},_0x4f1edb={},_0x42d256={'count':0x0,'rows':[]};var _0x3f47f2=_[_0x7b1b('0x25')](db['UserProfileSection']['rawAttributes'],function(_0x338b78){return{'name':_0x338b78[_0x7b1b('0x26')],'type':_0x338b78[_0x7b1b('0x27')]['key']};});_0x4f1edb[_0x7b1b('0x28')]=_[_0x7b1b('0x25')](_0x3f47f2,_0x7b1b('0x22'));_0x4f1edb[_0x7b1b('0x29')]=_[_0x7b1b('0x2a')](_0x3429c4[_0x7b1b('0x29')]);_0x4f1edb[_0x7b1b('0x2b')]=_[_0x7b1b('0x2c')](_0x4f1edb[_0x7b1b('0x28')],_0x4f1edb[_0x7b1b('0x29')]);_0x4f5c56[_0x7b1b('0x2d')]=_['intersection'](_0x4f1edb[_0x7b1b('0x28')],qs[_0x7b1b('0x2e')](_0x3429c4['query'][_0x7b1b('0x2e')]));_0x4f5c56[_0x7b1b('0x2d')]=_0x4f5c56[_0x7b1b('0x2d')][_0x7b1b('0x2f')]?_0x4f5c56['attributes']:_0x4f1edb[_0x7b1b('0x28')];if(!_0x3429c4[_0x7b1b('0x29')][_0x7b1b('0x30')](_0x7b1b('0x31'))){_0x4f5c56['limit']=qs[_0x7b1b('0x17')](_0x3429c4[_0x7b1b('0x29')]['limit']);_0x4f5c56['offset']=qs[_0x7b1b('0x19')](_0x3429c4[_0x7b1b('0x29')][_0x7b1b('0x19')]);}_0x4f5c56[_0x7b1b('0x32')]=qs[_0x7b1b('0x33')](_0x3429c4[_0x7b1b('0x29')][_0x7b1b('0x33')]);_0x4f5c56[_0x7b1b('0x34')]=qs[_0x7b1b('0x2b')](_[_0x7b1b('0x35')](_0x3429c4[_0x7b1b('0x29')],_0x4f1edb[_0x7b1b('0x2b')]),_0x3f47f2);if(_0x3429c4[_0x7b1b('0x29')][_0x7b1b('0x36')]){_0x4f5c56[_0x7b1b('0x34')]=_[_0x7b1b('0x37')](_0x4f5c56[_0x7b1b('0x34')],{'$or':_[_0x7b1b('0x25')](_0x3f47f2,function(_0x5ded2a){if(_0x5ded2a[_0x7b1b('0x27')]!=='VIRTUAL'){var _0x4d865b={};_0x4d865b[_0x5ded2a[_0x7b1b('0x22')]]={'$like':'%'+_0x3429c4[_0x7b1b('0x29')][_0x7b1b('0x36')]+'%'};return _0x4d865b;}})});}_0x4f5c56=_[_0x7b1b('0x37')]({},_0x4f5c56,_0x3429c4['options']);var _0x11961e={'where':_0x4f5c56[_0x7b1b('0x34')]};return db[_0x7b1b('0x38')][_0x7b1b('0x18')](_0x11961e)[_0x7b1b('0x1d')](function(_0x44720a){_0x42d256['count']=_0x44720a;if(_0x3429c4[_0x7b1b('0x29')][_0x7b1b('0x39')]){_0x4f5c56[_0x7b1b('0x3a')]=[{'all':!![]}];}return db[_0x7b1b('0x38')][_0x7b1b('0x3b')](_0x4f5c56);})[_0x7b1b('0x1d')](function(_0x21d51f){_0x42d256[_0x7b1b('0x3c')]=_0x21d51f;return _0x42d256;})['then'](respondWithFilteredResult(_0x1534b8,_0x4f5c56))[_0x7b1b('0x3d')](handleError(_0x1534b8,null));};exports[_0x7b1b('0x3e')]=function(_0x596263,_0x338419){var _0x1834d6={'raw':![],'where':{'id':_0x596263[_0x7b1b('0x3f')]['id']}},_0x61d7f6={};_0x61d7f6[_0x7b1b('0x28')]=_[_0x7b1b('0x2a')](db[_0x7b1b('0x38')][_0x7b1b('0x40')]);_0x61d7f6[_0x7b1b('0x29')]=_[_0x7b1b('0x2a')](_0x596263[_0x7b1b('0x29')]);_0x61d7f6[_0x7b1b('0x2b')]=_['intersection'](_0x61d7f6['model'],_0x61d7f6[_0x7b1b('0x29')]);_0x1834d6['attributes']=_[_0x7b1b('0x2c')](_0x61d7f6[_0x7b1b('0x28')],qs[_0x7b1b('0x2e')](_0x596263[_0x7b1b('0x29')]['fields']));_0x1834d6['attributes']=_0x1834d6[_0x7b1b('0x2d')][_0x7b1b('0x2f')]?_0x1834d6[_0x7b1b('0x2d')]:_0x61d7f6[_0x7b1b('0x28')];if(_0x596263['query']['includeAll']){_0x1834d6['include']=[{'all':!![]}];}_0x1834d6=_[_0x7b1b('0x37')]({},_0x1834d6,_0x596263[_0x7b1b('0x41')]);return db[_0x7b1b('0x38')][_0x7b1b('0x42')](_0x1834d6)[_0x7b1b('0x1d')](handleEntityNotFound(_0x338419,null))[_0x7b1b('0x1d')](respondWithResult(_0x338419,null))[_0x7b1b('0x3d')](handleError(_0x338419,null));};exports[_0x7b1b('0x43')]=function(_0x56fde8,_0x4867a0){return db['UserProfileSection']['create'](_0x56fde8['body'],{})['then'](respondWithResult(_0x4867a0,0xc9))[_0x7b1b('0x3d')](handleError(_0x4867a0,null));};exports['update']=function(_0x3ba0d0,_0x365922){if(_0x3ba0d0['body']['id']){delete _0x3ba0d0[_0x7b1b('0x44')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x3ba0d0['params']['id']}})[_0x7b1b('0x1d')](handleEntityNotFound(_0x365922,null))[_0x7b1b('0x1d')](saveUpdates(_0x3ba0d0['body'],null))['then'](respondWithResult(_0x365922,null))[_0x7b1b('0x3d')](handleError(_0x365922,null));};exports[_0x7b1b('0x1e')]=function(_0x502e82,_0x91c199){return db[_0x7b1b('0x38')][_0x7b1b('0x42')]({'where':{'id':_0x502e82[_0x7b1b('0x3f')]['id']}})[_0x7b1b('0x1d')](handleEntityNotFound(_0x91c199,null))[_0x7b1b('0x1d')](removeEntity(_0x91c199,null))[_0x7b1b('0x3d')](handleError(_0x91c199,null));};exports[_0x7b1b('0x45')]=function(_0x37b9e0,_0x5f1bc3){return db[_0x7b1b('0x38')][_0x7b1b('0x45')]()['then'](respondWithResult(_0x5f1bc3,null))[_0x7b1b('0x3d')](handleError(_0x5f1bc3,null));}; \ No newline at end of file +var _0xea70=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','filter','UserProfileSection','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x427105,_0x5b5d30){var _0x550f4a=function(_0x59682a){while(--_0x59682a){_0x427105['push'](_0x427105['shift']());}};_0x550f4a(++_0x5b5d30);}(_0xea70,0xec));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x0ea7('0x0'));var rimraf=require(_0x0ea7('0x1'));var zipdir=require(_0x0ea7('0x2'));var jsonpatch=require(_0x0ea7('0x3'));var rp=require(_0x0ea7('0x4'));var moment=require(_0x0ea7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ea7('0x6'));var util=require(_0x0ea7('0x7'));var path=require(_0x0ea7('0x8'));var sox=require(_0x0ea7('0x9'));var csv=require(_0x0ea7('0xa'));var ejs=require(_0x0ea7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ea7('0xc'));var squel=require('squel');var crypto=require(_0x0ea7('0xd'));var jsforce=require(_0x0ea7('0xe'));var deskjs=require(_0x0ea7('0xf'));var toCsv=require(_0x0ea7('0xa'));var querystring=require(_0x0ea7('0x10'));var Papa=require(_0x0ea7('0x11'));var Redis=require(_0x0ea7('0x12'));var authService=require(_0x0ea7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ea7('0x14'));var hardwareService=require(_0x0ea7('0x15'));var logger=require(_0x0ea7('0x16'))('api');var utils=require(_0x0ea7('0x17'));var config=require(_0x0ea7('0x18'));var licenseUtil=require(_0x0ea7('0x19'));var db=require(_0x0ea7('0x1a'))['db'];function respondWithStatusCode(_0x2efd3b,_0x4be1ce){_0x4be1ce=_0x4be1ce||0xcc;return function(_0x50a80c){if(_0x50a80c){return _0x2efd3b['sendStatus'](_0x4be1ce);}return _0x2efd3b[_0x0ea7('0x1b')](_0x4be1ce)[_0x0ea7('0x1c')]();};}function respondWithResult(_0x1275d8,_0x29016c){_0x29016c=_0x29016c||0xc8;return function(_0x2ef04d){if(_0x2ef04d){return _0x1275d8[_0x0ea7('0x1b')](_0x29016c)[_0x0ea7('0x1d')](_0x2ef04d);}};}function respondWithFilteredResult(_0xa5cbb2,_0x1abda6){return function(_0x5e419a){if(_0x5e419a){var _0x234a66=typeof _0x1abda6[_0x0ea7('0x1e')]===_0x0ea7('0x1f')&&typeof _0x1abda6['limit']==='undefined';var _0x421ccc=_0x5e419a[_0x0ea7('0x20')];var _0x122c73=_0x234a66?0x0:_0x1abda6[_0x0ea7('0x1e')];var _0x218820=_0x234a66?_0x5e419a[_0x0ea7('0x20')]:_0x1abda6[_0x0ea7('0x1e')]+_0x1abda6['limit'];var _0x4ae912;if(_0x218820>=_0x421ccc){_0x218820=_0x421ccc;_0x4ae912=0xc8;}else{_0x4ae912=0xce;}_0xa5cbb2['status'](_0x4ae912);return _0xa5cbb2[_0x0ea7('0x21')](_0x0ea7('0x22'),_0x122c73+'-'+_0x218820+'/'+_0x421ccc)['json'](_0x5e419a);}return null;};}function patchUpdates(_0x483567){return function(_0x5c0299){try{jsonpatch[_0x0ea7('0x23')](_0x5c0299,_0x483567,!![]);}catch(_0x384789){return BPromise[_0x0ea7('0x24')](_0x384789);}return _0x5c0299[_0x0ea7('0x25')]();};}function saveUpdates(_0xf21d87,_0x3298b2){return function(_0x202535){if(_0x202535){return _0x202535[_0x0ea7('0x26')](_0xf21d87)[_0x0ea7('0x27')](function(_0x48289b){return _0x48289b;});}return null;};}function removeEntity(_0x22965d,_0x32b0fe){return function(_0x4ce424){if(_0x4ce424){return _0x4ce424[_0x0ea7('0x28')]()[_0x0ea7('0x27')](function(){_0x22965d[_0x0ea7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5268b4,_0x2323d6){return function(_0x4ca4f0){if(!_0x4ca4f0){_0x5268b4['sendStatus'](0x194);}return _0x4ca4f0;};}function handleError(_0xf15560,_0x378634){_0x378634=_0x378634||0x1f4;return function(_0x51f210){logger[_0x0ea7('0x29')](_0x51f210[_0x0ea7('0x2a')]);if(_0x51f210['name']){delete _0x51f210['name'];}_0xf15560[_0x0ea7('0x1b')](_0x378634)[_0x0ea7('0x2b')](_0x51f210);};}exports[_0x0ea7('0x2c')]=function(_0xf32e8b,_0x26d531){var _0x483c75={},_0x215ff3={},_0x8ebc0b={'count':0x0,'rows':[]};var _0x476e09=_['map'](db['UserProfileSection'][_0x0ea7('0x2d')],function(_0x49208f){return{'name':_0x49208f[_0x0ea7('0x2e')],'type':_0x49208f['type'][_0x0ea7('0x2f')]};});_0x215ff3[_0x0ea7('0x30')]=_[_0x0ea7('0x31')](_0x476e09,_0x0ea7('0x32'));_0x215ff3['query']=_[_0x0ea7('0x33')](_0xf32e8b[_0x0ea7('0x34')]);_0x215ff3[_0x0ea7('0x35')]=_[_0x0ea7('0x36')](_0x215ff3['model'],_0x215ff3['query']);_0x483c75[_0x0ea7('0x37')]=_[_0x0ea7('0x36')](_0x215ff3['model'],qs['fields'](_0xf32e8b['query'][_0x0ea7('0x38')]));_0x483c75[_0x0ea7('0x37')]=_0x483c75[_0x0ea7('0x37')][_0x0ea7('0x39')]?_0x483c75['attributes']:_0x215ff3[_0x0ea7('0x30')];if(!_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x3a')](_0x0ea7('0x3b'))){_0x483c75[_0x0ea7('0x3c')]=qs[_0x0ea7('0x3c')](_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x3c')]);_0x483c75[_0x0ea7('0x1e')]=qs[_0x0ea7('0x1e')](_0xf32e8b[_0x0ea7('0x34')]['offset']);}_0x483c75[_0x0ea7('0x3d')]=qs[_0x0ea7('0x3e')](_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x3e')]);_0x483c75['where']=qs[_0x0ea7('0x35')](_[_0x0ea7('0x3f')](_0xf32e8b['query'],_0x215ff3['filters']),_0x476e09);if(_0xf32e8b['query']['filter']){_0x483c75[_0x0ea7('0x40')]=_[_0x0ea7('0x41')](_0x483c75[_0x0ea7('0x40')],{'$or':_[_0x0ea7('0x31')](_0x476e09,function(_0x4340db){if(_0x4340db[_0x0ea7('0x42')]!=='VIRTUAL'){var _0x18fb24={};_0x18fb24[_0x4340db[_0x0ea7('0x32')]]={'$like':'%'+_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x43')]+'%'};return _0x18fb24;}})});}_0x483c75=_[_0x0ea7('0x41')]({},_0x483c75,_0xf32e8b['options']);var _0x15f8f6={'where':_0x483c75[_0x0ea7('0x40')]};return db[_0x0ea7('0x44')][_0x0ea7('0x20')](_0x15f8f6)[_0x0ea7('0x27')](function(_0x18e1e0){_0x8ebc0b[_0x0ea7('0x20')]=_0x18e1e0;if(_0xf32e8b['query'][_0x0ea7('0x45')]){_0x483c75[_0x0ea7('0x46')]=[{'all':!![]}];}return db[_0x0ea7('0x44')]['findAll'](_0x483c75);})[_0x0ea7('0x27')](function(_0x3b3a5d){_0x8ebc0b[_0x0ea7('0x47')]=_0x3b3a5d;return _0x8ebc0b;})[_0x0ea7('0x27')](respondWithFilteredResult(_0x26d531,_0x483c75))[_0x0ea7('0x48')](handleError(_0x26d531,null));};exports[_0x0ea7('0x49')]=function(_0x5a26f3,_0x2b2fd6){var _0x13fff1={'raw':![],'where':{'id':_0x5a26f3[_0x0ea7('0x4a')]['id']}},_0x20c7f2={};_0x20c7f2[_0x0ea7('0x30')]=_[_0x0ea7('0x33')](db['UserProfileSection']['rawAttributes']);_0x20c7f2['query']=_[_0x0ea7('0x33')](_0x5a26f3['query']);_0x20c7f2[_0x0ea7('0x35')]=_[_0x0ea7('0x36')](_0x20c7f2[_0x0ea7('0x30')],_0x20c7f2[_0x0ea7('0x34')]);_0x13fff1[_0x0ea7('0x37')]=_['intersection'](_0x20c7f2[_0x0ea7('0x30')],qs[_0x0ea7('0x38')](_0x5a26f3[_0x0ea7('0x34')][_0x0ea7('0x38')]));_0x13fff1[_0x0ea7('0x37')]=_0x13fff1[_0x0ea7('0x37')][_0x0ea7('0x39')]?_0x13fff1[_0x0ea7('0x37')]:_0x20c7f2[_0x0ea7('0x30')];if(_0x5a26f3['query'][_0x0ea7('0x45')]){_0x13fff1[_0x0ea7('0x46')]=[{'all':!![]}];}_0x13fff1=_[_0x0ea7('0x41')]({},_0x13fff1,_0x5a26f3[_0x0ea7('0x4b')]);return db[_0x0ea7('0x44')][_0x0ea7('0x4c')](_0x13fff1)[_0x0ea7('0x27')](handleEntityNotFound(_0x2b2fd6,null))[_0x0ea7('0x27')](respondWithResult(_0x2b2fd6,null))[_0x0ea7('0x48')](handleError(_0x2b2fd6,null));};exports[_0x0ea7('0x4d')]=function(_0xa11fed,_0x4eed88){return db[_0x0ea7('0x44')][_0x0ea7('0x4d')](_0xa11fed[_0x0ea7('0x4e')],{})[_0x0ea7('0x27')](respondWithResult(_0x4eed88,0xc9))[_0x0ea7('0x48')](handleError(_0x4eed88,null));};exports[_0x0ea7('0x26')]=function(_0x56e758,_0x3920be){if(_0x56e758[_0x0ea7('0x4e')]['id']){delete _0x56e758['body']['id'];}return db['UserProfileSection'][_0x0ea7('0x4c')]({'where':{'id':_0x56e758[_0x0ea7('0x4a')]['id']}})[_0x0ea7('0x27')](handleEntityNotFound(_0x3920be,null))[_0x0ea7('0x27')](saveUpdates(_0x56e758['body'],null))[_0x0ea7('0x27')](respondWithResult(_0x3920be,null))['catch'](handleError(_0x3920be,null));};exports[_0x0ea7('0x28')]=function(_0x5afd71,_0x5a8cef){return db['UserProfileSection'][_0x0ea7('0x4c')]({'where':{'id':_0x5afd71[_0x0ea7('0x4a')]['id']}})[_0x0ea7('0x27')](handleEntityNotFound(_0x5a8cef,null))[_0x0ea7('0x27')](removeEntity(_0x5a8cef,null))['catch'](handleError(_0x5a8cef,null));};exports[_0x0ea7('0x4f')]=function(_0x24a5ab,_0x176b6f){return db[_0x0ea7('0x44')][_0x0ea7('0x4f')]()[_0x0ea7('0x27')](respondWithResult(_0x176b6f,null))['catch'](handleError(_0x176b6f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1984a61..0c4c0d6 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 _0xbed7=['bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api'];(function(_0x5ddeb9,_0x574794){var _0x5c0dc3=function(_0x18f6a5){while(--_0x18f6a5){_0x5ddeb9['push'](_0x5ddeb9['shift']());}};_0x5c0dc3(++_0x574794);}(_0xbed7,0xde));var _0x7bed=function(_0x21073e,_0x3928c3){_0x21073e=_0x21073e-0x0;var _0x55b8d7=_0xbed7[_0x21073e];return _0x55b8d7;};'use strict';var _=require('lodash');var util=require(_0x7bed('0x0'));var logger=require(_0x7bed('0x1'))(_0x7bed('0x2'));var moment=require('moment');var BPromise=require(_0x7bed('0x3'));var rp=require(_0x7bed('0x4'));var fs=require('fs');var path=require(_0x7bed('0x5'));var rimraf=require(_0x7bed('0x6'));var config=require('../../config/environment');var attributes=require(_0x7bed('0x7'));module[_0x7bed('0x8')]=function(_0x3bb1a7,_0x3de99d){return _0x3bb1a7[_0x7bed('0x9')](_0x7bed('0xa'),attributes,{'tableName':_0x7bed('0xb'),'paranoid':![],'indexes':[{'name':_0x7bed('0xc'),'fields':[_0x7bed('0xd'),_0x7bed('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdb4=['path','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xfdb4,0x133));var _0x4fdb=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xfdb4[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x4fdb('0x0'));var util=require('util');var logger=require(_0x4fdb('0x1'))('api');var moment=require(_0x4fdb('0x2'));var BPromise=require(_0x4fdb('0x3'));var rp=require(_0x4fdb('0x4'));var fs=require('fs');var path=require(_0x4fdb('0x5'));var rimraf=require('rimraf');var config=require(_0x4fdb('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x4fdb('0x7')]=function(_0x468520,_0x3d0815){return _0x468520[_0x4fdb('0x8')](_0x4fdb('0x9'),attributes,{'tableName':_0x4fdb('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x4fdb('0xb'),_0x4fdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e06becf..2212bfb 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 _0xf24b=['rpc','http','request','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f8b97,_0x1e98f5){var _0x1e77d2=function(_0x30f412){while(--_0x30f412){_0x1f8b97['push'](_0x1f8b97['shift']());}};_0x1e77d2(++_0x1e98f5);}(_0xf24b,0xff));var _0xbf24=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xf24b[_0x367a3d];return _0x460539;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require(_0xbf24('0x3'));var rs=require(_0xbf24('0x4'));var fs=require('fs');var Redis=require(_0xbf24('0x5'));var db=require(_0xbf24('0x6'))['db'];var utils=require(_0xbf24('0x7'));var logger=require(_0xbf24('0x8'))(_0xbf24('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55f652,_0x1f2205,_0x52693e){return new BPromise(function(_0x14b56a,_0x1b81b8){return client[_0xbf24('0xb')](_0x55f652,_0x52693e)[_0xbf24('0xc')](function(_0x5927e7){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1f2205,_0xbf24('0xd'));logger[_0xbf24('0xe')](_0xbf24('0xf'),_0x1f2205,_0xbf24('0xd'),JSON[_0xbf24('0x10')](_0x5927e7));if(_0x5927e7[_0xbf24('0x11')]){if(_0x5927e7['error'][_0xbf24('0x12')]===0x1f4){logger[_0xbf24('0x11')](_0xbf24('0x13'),_0x1f2205,_0x5927e7[_0xbf24('0x11')][_0xbf24('0x14')]);return _0x1b81b8(_0x5927e7['error'][_0xbf24('0x14')]);}logger['error'](_0xbf24('0x13'),_0x1f2205,_0x5927e7[_0xbf24('0x11')][_0xbf24('0x14')]);return _0x14b56a(_0x5927e7[_0xbf24('0x11')][_0xbf24('0x14')]);}else{logger[_0xbf24('0x15')](_0xbf24('0x13'),_0x1f2205,'request\x20sent');_0x14b56a(_0x5927e7[_0xbf24('0x16')][_0xbf24('0x14')]);}})[_0xbf24('0x17')](function(_0x499921){logger[_0xbf24('0x11')](_0xbf24('0x13'),_0x1f2205,_0x499921);_0x1b81b8(_0x499921);});});} \ No newline at end of file +var _0xd8fb=['info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x119e4a,_0x1c87aa){var _0xe18cb0=function(_0x4685f9){while(--_0x4685f9){_0x119e4a['push'](_0x119e4a['shift']());}};_0xe18cb0(++_0x1c87aa);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4ea7bf,_0x30a8f9){_0x4ea7bf=_0x4ea7bf-0x0;var _0x3f5afc=_0xd8fb[_0x4ea7bf];return _0x3f5afc;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1267a12..37f16e2 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x414c03,_0x4a93ec){var _0x4854ff=function(_0x288222){while(--_0x288222){_0x414c03['push'](_0x414c03['shift']());}};_0x4854ff(++_0x4a93ec);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b662d,_0x5b8058){var _0x3b9fd4=function(_0x326ed9){while(--_0x326ed9){_0x4b662d['push'](_0x4b662d['shift']());}};_0x3b9fd4(++_0x5b8058);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 1cf3055..e6dd2c0 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 _0xbbc2=['exports','INTEGER','sequelize'];(function(_0x1f41d4,_0x39ce4b){var _0x20132e=function(_0x4e9f03){while(--_0x4e9f03){_0x1f41d4['push'](_0x1f41d4['shift']());}};_0x20132e(++_0x39ce4b);}(_0xbbc2,0x14f));var _0x2bbc=function(_0x5aa1f4,_0x4d9d8e){_0x5aa1f4=_0x5aa1f4-0x0;var _0x4726ae=_0xbbc2[_0x5aa1f4];return _0x4726ae;};'use strict';var Sequelize=require(_0x2bbc('0x0'));module[_0x2bbc('0x1')]={'penalty':{'type':Sequelize[_0x2bbc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcf05=['sequelize'];(function(_0x586c3d,_0x2cc7bf){var _0x2243c4=function(_0x1aed6c){while(--_0x1aed6c){_0x586c3d['push'](_0x586c3d['shift']());}};_0x2243c4(++_0x2cc7bf);}(_0xcf05,0xf6));var _0x5cf0=function(_0x313fbb,_0x2baf87){_0x313fbb=_0x313fbb-0x0;var _0x58cfbf=_0xcf05[_0x313fbb];return _0x58cfbf;};'use strict';var Sequelize=require(_0x5cf0('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e1af7d0..5807d47 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 _0xc1c6=['moment','request-promise','path','rimraf','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x39506c,_0x4e7232){var _0x4cc619=function(_0x674229){while(--_0x674229){_0x39506c['push'](_0x39506c['shift']());}};_0x4cc619(++_0x4e7232);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x42d580,_0x5d8f96){_0x42d580=_0x42d580-0x0;var _0x3bb1cb=_0xc1c6[_0x42d580];return _0x3bb1cb;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c45=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird'];(function(_0x309ee3,_0x26c85f){var _0x2268e0=function(_0x330f5c){while(--_0x330f5c){_0x309ee3['push'](_0x309ee3['shift']());}};_0x2268e0(++_0x26c85f);}(_0x6c45,0xb1));var _0x56c4=function(_0x3e560b,_0x3933a9){_0x3e560b=_0x3e560b-0x0;var _0x448238=_0x6c45[_0x3e560b];return _0x448238;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var logger=require('../../config/logger')(_0x56c4('0x2'));var moment=require(_0x56c4('0x3'));var BPromise=require(_0x56c4('0x4'));var rp=require(_0x56c4('0x5'));var fs=require('fs');var path=require(_0x56c4('0x6'));var rimraf=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var attributes=require(_0x56c4('0x9'));module[_0x56c4('0xa')]=function(_0x3cc49e,_0x1fcb9e){return _0x3cc49e[_0x56c4('0xb')](_0x56c4('0xc'),attributes,{'tableName':_0x56c4('0xd'),'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 e92b00c..f4a2fd4 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 _0xf3c8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xe03722,_0x49df7c){var _0x1aefd3=function(_0x1b6f26){while(--_0x1b6f26){_0xe03722['push'](_0xe03722['shift']());}};_0x1aefd3(++_0x49df7c);}(_0xf3c8,0xd2));var _0x8f3c=function(_0x5d8a43,_0x7dc590){_0x5d8a43=_0x5d8a43-0x0;var _0xbe91d3=_0xf3c8[_0x5d8a43];return _0xbe91d3;};'use strict';var _=require(_0x8f3c('0x0'));var util=require('util');var moment=require(_0x8f3c('0x1'));var BPromise=require(_0x8f3c('0x2'));var rs=require(_0x8f3c('0x3'));var fs=require('fs');var Redis=require(_0x8f3c('0x4'));var db=require(_0x8f3c('0x5'))['db'];var utils=require(_0x8f3c('0x6'));var logger=require(_0x8f3c('0x7'))(_0x8f3c('0x8'));var config=require(_0x8f3c('0x9'));var jayson=require(_0x8f3c('0xa'));var client=jayson[_0x8f3c('0xb')][_0x8f3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd654,_0x4c12cc,_0x30525a){return new BPromise(function(_0x2892d8,_0x7c84e5){return client[_0x8f3c('0xd')](_0x4cd654,_0x30525a)['then'](function(_0x5602f5){logger[_0x8f3c('0xe')](_0x8f3c('0xf'),_0x4c12cc,'request\x20sent');logger['debug'](_0x8f3c('0x10'),_0x4c12cc,_0x8f3c('0x11'),JSON[_0x8f3c('0x12')](_0x5602f5));if(_0x5602f5['error']){if(_0x5602f5['error'][_0x8f3c('0x13')]===0x1f4){logger[_0x8f3c('0x14')](_0x8f3c('0xf'),_0x4c12cc,_0x5602f5['error']['message']);return _0x7c84e5(_0x5602f5['error']['message']);}logger[_0x8f3c('0x14')](_0x8f3c('0xf'),_0x4c12cc,_0x5602f5[_0x8f3c('0x14')][_0x8f3c('0x15')]);return _0x2892d8(_0x5602f5['error'][_0x8f3c('0x15')]);}else{logger[_0x8f3c('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4c12cc,_0x8f3c('0x11'));_0x2892d8(_0x5602f5[_0x8f3c('0x16')]['message']);}})[_0x8f3c('0x17')](function(_0x3beabc){logger[_0x8f3c('0x14')](_0x8f3c('0xf'),_0x4c12cc,_0x3beabc);_0x7c84e5(_0x3beabc);});});} \ No newline at end of file +var _0x51e6=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x12fb86,_0x86a352){var _0x533854=function(_0x416e79){while(--_0x416e79){_0x12fb86['push'](_0x12fb86['shift']());}};_0x533854(++_0x86a352);}(_0x51e6,0x1eb));var _0x651e=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x51e6[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require(_0x651e('0x0'));var moment=require(_0x651e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x651e('0x2'));var db=require(_0x651e('0x3'))['db'];var utils=require(_0x651e('0x4'));var logger=require(_0x651e('0x5'))(_0x651e('0x6'));var config=require(_0x651e('0x7'));var jayson=require(_0x651e('0x8'));var client=jayson[_0x651e('0x9')][_0x651e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c15a3,_0x1d8520,_0x1032a3){return new BPromise(function(_0x167b5d,_0x56eff0){return client['request'](_0x1c15a3,_0x1032a3)[_0x651e('0xb')](function(_0x3a6cc4){logger[_0x651e('0xc')](_0x651e('0xd'),_0x1d8520,_0x651e('0xe'));logger[_0x651e('0xf')](_0x651e('0x10'),_0x1d8520,_0x651e('0xe'),JSON[_0x651e('0x11')](_0x3a6cc4));if(_0x3a6cc4[_0x651e('0x12')]){if(_0x3a6cc4[_0x651e('0x12')][_0x651e('0x13')]===0x1f4){logger[_0x651e('0x12')](_0x651e('0xd'),_0x1d8520,_0x3a6cc4[_0x651e('0x12')][_0x651e('0x14')]);return _0x56eff0(_0x3a6cc4[_0x651e('0x12')]['message']);}logger[_0x651e('0x12')](_0x651e('0xd'),_0x1d8520,_0x3a6cc4[_0x651e('0x12')][_0x651e('0x14')]);return _0x167b5d(_0x3a6cc4[_0x651e('0x12')][_0x651e('0x14')]);}else{logger[_0x651e('0xc')](_0x651e('0xd'),_0x1d8520,_0x651e('0xe'));_0x167b5d(_0x3a6cc4['result'][_0x651e('0x14')]);}})[_0x651e('0x15')](function(_0x29dd14){logger[_0x651e('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x1d8520,_0x29dd14);_0x56eff0(_0x29dd14);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0e7c390..adfc9ed 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 _0xe02c=['INTEGER','exports'];(function(_0x205fbc,_0x40f5d5){var _0x11aaf9=function(_0x58c980){while(--_0x58c980){_0x205fbc['push'](_0x205fbc['shift']());}};_0x11aaf9(++_0x40f5d5);}(_0xe02c,0xa9));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xce02('0x0')]={'UserId':{'type':Sequelize[_0xce02('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xce02('0x1')]}}; \ No newline at end of file +var _0x1447=['INTEGER','sequelize','exports'];(function(_0x105a68,_0x5bc4d8){var _0x4544e4=function(_0x58a1c4){while(--_0x58a1c4){_0x105a68['push'](_0x105a68['shift']());}};_0x4544e4(++_0x5bc4d8);}(_0x1447,0x175));var _0x7144=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1447[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7144('0x0'));module[_0x7144('0x1')]={'UserId':{'type':Sequelize[_0x7144('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5412ffe..1141f5e 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(_0x554b4e,_0x27d986){var _0x1eaabb=function(_0x4025d3){while(--_0x4025d3){_0x554b4e['push'](_0x554b4e['shift']());}};_0x1eaabb(++_0x27d986);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x6a8802,_0xd63283){var _0x502fd0=function(_0x3cb8a){while(--_0x3cb8a){_0x6a8802['push'](_0x6a8802['shift']());}};_0x502fd0(++_0xd63283);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 1900605..4445866 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x54e856,_0x313d5c){var _0x124873=function(_0x48547e){while(--_0x48547e){_0x54e856['push'](_0x54e856['shift']());}};_0x124873(++_0x313d5c);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56d303,_0x4eb93c){var _0x1f9659=function(_0x3b8c66){while(--_0x3b8c66){_0x56d303['push'](_0x56d303['shift']());}};_0x1f9659(++_0x4eb93c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9cfe22e..a9a16e1 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 _0x556a=['INTEGER'];(function(_0x17c318,_0x26dabd){var _0x24ab65=function(_0x24af75){while(--_0x24af75){_0x17c318['push'](_0x17c318['shift']());}};_0x24ab65(++_0x26dabd);}(_0x556a,0x14e));var _0xa556=function(_0x4a0e66,_0x41fbed){_0x4a0e66=_0x4a0e66-0x0;var _0x2dd8f6=_0x556a[_0x4a0e66];return _0x2dd8f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xa556('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bae=['exports','INTEGER','sequelize'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));module[_0xe2ba('0x1')]={'penalty':{'type':Sequelize[_0xe2ba('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 9d11789..93ccb5a 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 _0xbd22=['bluebird','path','rimraf','../../config/environment','define','UserVoiceQueue','user_has_voice_queues','lodash','util','moment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xbd22,0x16f));var _0x2bd2=function(_0x4ddb8e,_0x1e98da){_0x4ddb8e=_0x4ddb8e-0x0;var _0x136b20=_0xbd22[_0x4ddb8e];return _0x136b20;};'use strict';var _=require(_0x2bd2('0x0'));var util=require(_0x2bd2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2bd2('0x2'));var BPromise=require(_0x2bd2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bd2('0x4'));var rimraf=require(_0x2bd2('0x5'));var config=require(_0x2bd2('0x6'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x439d69,_0x4ad8c1){return _0x439d69[_0x2bd2('0x7')](_0x2bd2('0x8'),attributes,{'tableName':_0x2bd2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58b6=['path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x58b6,0x14b));var _0x658b=function(_0x351644,_0x180b36){_0x351644=_0x351644-0x0;var _0x5409f6=_0x58b6[_0x351644];return _0x5409f6;};'use strict';var _=require(_0x658b('0x0'));var util=require(_0x658b('0x1'));var logger=require(_0x658b('0x2'))(_0x658b('0x3'));var moment=require(_0x658b('0x4'));var BPromise=require(_0x658b('0x5'));var rp=require(_0x658b('0x6'));var fs=require('fs');var path=require(_0x658b('0x7'));var rimraf=require('rimraf');var config=require(_0x658b('0x8'));var attributes=require(_0x658b('0x9'));module[_0x658b('0xa')]=function(_0x358902,_0x462e40){return _0x358902['define'](_0x658b('0xb'),attributes,{'tableName':_0x658b('0xc'),'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 447dd8a..26e8f88 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 _0xd10b=['../../config/environment','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x307cdd,_0x28c2fd){var _0x4c9403=function(_0x16c7b2){while(--_0x16c7b2){_0x307cdd['push'](_0x307cdd['shift']());}};_0x4c9403(++_0x28c2fd);}(_0xd10b,0x114));var _0xbd10=function(_0x1655d4,_0x52cf85){_0x1655d4=_0x1655d4-0x0;var _0x1c7ec7=_0xd10b[_0x1655d4];return _0x1c7ec7;};'use strict';var _=require(_0xbd10('0x0'));var util=require(_0xbd10('0x1'));var moment=require(_0xbd10('0x2'));var BPromise=require(_0xbd10('0x3'));var rs=require(_0xbd10('0x4'));var fs=require('fs');var Redis=require(_0xbd10('0x5'));var db=require(_0xbd10('0x6'))['db'];var utils=require(_0xbd10('0x7'));var logger=require(_0xbd10('0x8'))(_0xbd10('0x9'));var config=require(_0xbd10('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578d35,_0x2af53c,_0x6436e9){return new BPromise(function(_0x20976e,_0x19d0c3){return client['request'](_0x578d35,_0x6436e9)[_0xbd10('0xc')](function(_0x168d2d){logger['info'](_0xbd10('0xd'),_0x2af53c,_0xbd10('0xe'));logger[_0xbd10('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2af53c,'request\x20sent',JSON['stringify'](_0x168d2d));if(_0x168d2d[_0xbd10('0x10')]){if(_0x168d2d[_0xbd10('0x10')][_0xbd10('0x11')]===0x1f4){logger['error'](_0xbd10('0xd'),_0x2af53c,_0x168d2d[_0xbd10('0x10')][_0xbd10('0x12')]);return _0x19d0c3(_0x168d2d[_0xbd10('0x10')][_0xbd10('0x12')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2af53c,_0x168d2d[_0xbd10('0x10')][_0xbd10('0x12')]);return _0x20976e(_0x168d2d[_0xbd10('0x10')][_0xbd10('0x12')]);}else{logger[_0xbd10('0x13')](_0xbd10('0xd'),_0x2af53c,'request\x20sent');_0x20976e(_0x168d2d[_0xbd10('0x14')][_0xbd10('0x12')]);}})[_0xbd10('0x15')](function(_0x564fd1){logger[_0xbd10('0x10')](_0xbd10('0xd'),_0x2af53c,_0x564fd1);_0x19d0c3(_0x564fd1);});});} \ No newline at end of file +var _0x004c=['code','message','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x20ba04,_0x4ebf92){var _0x1434d3=function(_0x21f8dd){while(--_0x21f8dd){_0x20ba04['push'](_0x20ba04['shift']());}};_0x1434d3(++_0x4ebf92);}(_0x004c,0x159));var _0xc004=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x004c[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xc004('0x0'));var util=require('util');var moment=require(_0xc004('0x1'));var BPromise=require(_0xc004('0x2'));var rs=require(_0xc004('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc004('0x4'))(_0xc004('0x5'));var config=require(_0xc004('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc004('0x7')][_0xc004('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44eba6,_0x2dc31f,_0x11bebc){return new BPromise(function(_0x255481,_0x484afe){return client[_0xc004('0x9')](_0x44eba6,_0x11bebc)[_0xc004('0xa')](function(_0x4e0c88){logger[_0xc004('0xb')](_0xc004('0xc'),_0x2dc31f,_0xc004('0xd'));logger['debug'](_0xc004('0xe'),_0x2dc31f,_0xc004('0xd'),JSON['stringify'](_0x4e0c88));if(_0x4e0c88[_0xc004('0xf')]){if(_0x4e0c88['error'][_0xc004('0x10')]===0x1f4){logger['error'](_0xc004('0xc'),_0x2dc31f,_0x4e0c88['error'][_0xc004('0x11')]);return _0x484afe(_0x4e0c88['error'][_0xc004('0x11')]);}logger[_0xc004('0xf')](_0xc004('0xc'),_0x2dc31f,_0x4e0c88['error'][_0xc004('0x11')]);return _0x255481(_0x4e0c88[_0xc004('0xf')][_0xc004('0x11')]);}else{logger[_0xc004('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x2dc31f,_0xc004('0xd'));_0x255481(_0x4e0c88['result'][_0xc004('0x11')]);}})[_0xc004('0x12')](function(_0xa21608){logger[_0xc004('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x2dc31f,_0xa21608);_0x484afe(_0xa21608);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2507c30..32fb400 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2f3f97,_0x174602){var _0xfeb6ea=function(_0x8b68b3){while(--_0x8b68b3){_0x2f3f97['push'](_0x2f3f97['shift']());}};_0xfeb6ea(++_0x174602);}(_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(_0x4b2770,_0x48510b){var _0x5a8af7=function(_0x510856){while(--_0x510856){_0x4b2770['push'](_0x4b2770['shift']());}};_0x5a8af7(++_0x48510b);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2ad19cc..c96fe52 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 _0x4b5f=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0xf9843b,_0x236870){var _0x3c3282=function(_0x5247e8){while(--_0x5247e8){_0xf9843b['push'](_0xf9843b['shift']());}};_0x3c3282(++_0x236870);}(_0x4b5f,0x81));var _0xf4b5=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x4b5f[_0xeff2c3];return _0x2cade6;};'use strict';var Sequelize=require(_0xf4b5('0x0'));module[_0xf4b5('0x1')]={'uniqueid':{'type':Sequelize[_0xf4b5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'comment':_0xf4b5('0x4')},'UserId':{'type':Sequelize[_0xf4b5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'unique':_0xf4b5('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xf4b5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'unique':_0xf4b5('0x5'),'comment':_0xf4b5('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf4b5('0x4')},'paused':{'type':Sequelize[_0xf4b5('0x2')](0xb),'defaultValue':0x0,'comment':_0xf4b5('0x4')}}; \ No newline at end of file +var _0xea13=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xea13,0x188));var _0x3ea1=function(_0x3828de,_0x2efd3a){_0x3828de=_0x3828de-0x0;var _0x54da0d=_0xea13[_0x3828de];return _0x54da0d;};'use strict';var Sequelize=require(_0x3ea1('0x0'));module[_0x3ea1('0x1')]={'uniqueid':{'type':Sequelize[_0x3ea1('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3ea1('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x3ea1('0x3')},'UserId':{'type':Sequelize[_0x3ea1('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3ea1('0x4')],'allowNull':![],'unique':_0x3ea1('0x5'),'comment':_0x3ea1('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3ea1('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x3ea1('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x3ea1('0x3')},'penalty':{'type':Sequelize[_0x3ea1('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x3ea1('0x2')](0xb),'defaultValue':0x0,'comment':_0x3ea1('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a80780a..a729098 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 _0x0d8f=['hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5ab847,_0x124c13){var _0xf6db63=function(_0x440abd){while(--_0x440abd){_0x5ab847['push'](_0x5ab847['shift']());}};_0xf6db63(++_0x124c13);}(_0x0d8f,0x106));var _0xf0d8=function(_0x89bddd,_0x5c50e8){_0x89bddd=_0x89bddd-0x0;var _0x3a10e6=_0x0d8f[_0x89bddd];return _0x3a10e6;};'use strict';var EventEmitter=require(_0xf0d8('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xf0d8('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf0d8('0x2')](0x0);var events={'afterCreate':_0xf0d8('0x3'),'afterUpdate':_0xf0d8('0x4'),'afterDestroy':_0xf0d8('0x5')};function emitEvent(_0x1715b4){return function(_0x2d4da9,_0xea6544,_0x526dab){UserVoiceQueueRtEvents[_0xf0d8('0x6')](_0x1715b4+':'+_0x2d4da9['id'],_0x2d4da9);UserVoiceQueueRtEvents[_0xf0d8('0x6')](_0x1715b4,_0x2d4da9);_0x526dab(null);};}for(var e in events){if(events[_0xf0d8('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf0d8('0x8')](e,emitEvent(event));}}module[_0xf0d8('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xde69=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde69,0x92));var _0x9de6=function(_0x17ff84,_0x513e44){_0x17ff84=_0x17ff84-0x0;var _0x4d6138=_0xde69[_0x17ff84];return _0x4d6138;};'use strict';var EventEmitter=require(_0x9de6('0x0'));var UserVoiceQueueRt=require(_0x9de6('0x1'))['db'][_0x9de6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9de6('0x3')](0x0);var events={'afterCreate':_0x9de6('0x4'),'afterUpdate':_0x9de6('0x5'),'afterDestroy':_0x9de6('0x6')};function emitEvent(_0x57a5ca){return function(_0x5f08d5,_0x4a5517,_0x4f56a8){UserVoiceQueueRtEvents['emit'](_0x57a5ca+':'+_0x5f08d5['id'],_0x5f08d5);UserVoiceQueueRtEvents[_0x9de6('0x7')](_0x57a5ca,_0x5f08d5);_0x4f56a8(null);};}for(var e in events){if(events[_0x9de6('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9de6('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 147d027..94067d2 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 _0xa81a=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x48deab,_0x4f9c85){var _0x10a259=function(_0x1ae563){while(--_0x1ae563){_0x48deab['push'](_0x48deab['shift']());}};_0x10a259(++_0x4f9c85);}(_0xa81a,0xb0));var _0xaa81=function(_0x3b8fd2,_0x144c2b){_0x3b8fd2=_0x3b8fd2-0x0;var _0x327780=_0xa81a[_0x3b8fd2];return _0x327780;};'use strict';var _=require(_0xaa81('0x0'));var util=require(_0xaa81('0x1'));var logger=require(_0xaa81('0x2'))(_0xaa81('0x3'));var moment=require(_0xaa81('0x4'));var BPromise=require(_0xaa81('0x5'));var rp=require(_0xaa81('0x6'));var fs=require('fs');var path=require(_0xaa81('0x7'));var rimraf=require(_0xaa81('0x8'));var config=require(_0xaa81('0x9'));var attributes=require(_0xaa81('0xa'));module['exports']=function(_0x2fe79c,_0x2e64b0){return _0x2fe79c[_0xaa81('0xb')](_0xaa81('0xc'),attributes,{'tableName':_0xaa81('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25c5=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x4874e3,_0x1d9c94){var _0x437719=function(_0x186acb){while(--_0x186acb){_0x4874e3['push'](_0x4874e3['shift']());}};_0x437719(++_0x1d9c94);}(_0x25c5,0x1af));var _0x525c=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x25c5[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0x525c('0x0'));var util=require(_0x525c('0x1'));var logger=require('../../config/logger')(_0x525c('0x2'));var moment=require(_0x525c('0x3'));var BPromise=require(_0x525c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x525c('0x5'));var rimraf=require(_0x525c('0x6'));var config=require(_0x525c('0x7'));var attributes=require(_0x525c('0x8'));module[_0x525c('0x9')]=function(_0x1c20a8,_0x285126){return _0x1c20a8[_0x525c('0xa')](_0x525c('0xb'),attributes,{'tableName':_0x525c('0xc'),'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 77673f9..a609867 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 _0x74ba=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','options','where','sequelize','COUNT','outboundQueuePauses','then','lodash','util','moment'];(function(_0x98c1f7,_0x4bf2a6){var _0x1ca216=function(_0x1e04fb){while(--_0x1e04fb){_0x98c1f7['push'](_0x98c1f7['shift']());}};_0x1ca216(++_0x4bf2a6);}(_0x74ba,0x105));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa74b('0x0'));var util=require(_0xa74b('0x1'));var moment=require(_0xa74b('0x2'));var BPromise=require(_0xa74b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa74b('0x4'))['db'];var utils=require(_0xa74b('0x5'));var logger=require(_0xa74b('0x6'))('rpc');var config=require(_0xa74b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa74b('0x8')]({'port':0x232a});config[_0xa74b('0x9')]=_[_0xa74b('0xa')](config[_0xa74b('0x9')],{'host':_0xa74b('0xb'),'port':0x18eb});var socket=require(_0xa74b('0xc'))(new Redis(config[_0xa74b('0x9')]));require(_0xa74b('0xd'))[_0xa74b('0xe')](socket);function respondWithRpcPromise(_0xfd6a0,_0x1fbbdd,_0x369aa3){return new BPromise(function(_0x17b7d4,_0x57a980){return client[_0xa74b('0xf')](_0xfd6a0,_0x369aa3)['then'](function(_0x406646){logger[_0xa74b('0x10')](_0xa74b('0x11'),_0x1fbbdd,_0xa74b('0x12'));logger[_0xa74b('0x13')](_0xa74b('0x14'),_0x1fbbdd,_0xa74b('0x12'),JSON[_0xa74b('0x15')](_0x406646));if(_0x406646['error']){if(_0x406646[_0xa74b('0x16')][_0xa74b('0x17')]===0x1f4){logger['error'](_0xa74b('0x11'),_0x1fbbdd,_0x406646[_0xa74b('0x16')]['message']);return _0x57a980(_0x406646['error'][_0xa74b('0x18')]);}logger[_0xa74b('0x16')](_0xa74b('0x11'),_0x1fbbdd,_0x406646[_0xa74b('0x16')][_0xa74b('0x18')]);return _0x17b7d4(_0x406646['error'][_0xa74b('0x18')]);}else{logger[_0xa74b('0x10')](_0xa74b('0x11'),_0x1fbbdd,_0xa74b('0x12'));_0x17b7d4(_0x406646['result']['message']);}})[_0xa74b('0x19')](function(_0x2e3fa0){logger[_0xa74b('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1fbbdd,_0x2e3fa0);_0x57a980(_0x2e3fa0);});});}exports[_0xa74b('0x1a')]=function(_0x3aa7a1){var _0x554ecf=this;return new Promise(function(_0x6c2cc1,_0x3eed26){return db['UserVoiceQueueRt']['findAll']({'raw':_0x3aa7a1[_0xa74b('0x1b')]?_0x3aa7a1[_0xa74b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3aa7a1['options']?_0x3aa7a1[_0xa74b('0x1b')][_0xa74b('0x1c')]||null:null,'attributes':[[db[_0xa74b('0x1d')]['fn'](_0xa74b('0x1e'),db['sequelize']['fn']('IF',db[_0xa74b('0x1d')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xa74b('0x1f')]]})[_0xa74b('0x20')](function(_0x4a5459){logger['info'](_0xa74b('0x1a'),_0x3aa7a1);logger[_0xa74b('0x13')]('GetVoiceQueueRtPauses',_0x3aa7a1,JSON['stringify'](_0x4a5459));_0x6c2cc1(_0x4a5459);})[_0xa74b('0x19')](function(_0x25414d){logger['error'](_0xa74b('0x1a'),_0x25414d[_0xa74b('0x18')],_0x3aa7a1);_0x3eed26(_0x554ecf[_0xa74b('0x16')](0x1f4,_0x25414d[_0xa74b('0x18')]));});});}; \ No newline at end of file +var _0x8f2d=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceQueueRtPauses','findAll','options','raw','COUNT','sequelize','outboundQueuePauses','catch'];(function(_0x1aadba,_0x1b407){var _0x4e78da=function(_0x4eddce){while(--_0x4eddce){_0x1aadba['push'](_0x1aadba['shift']());}};_0x4e78da(++_0x1b407);}(_0x8f2d,0x174));var _0xd8f2=function(_0x655437,_0x338dbc){_0x655437=_0x655437-0x0;var _0x55d24f=_0x8f2d[_0x655437];return _0x55d24f;};'use strict';var _=require(_0xd8f2('0x0'));var util=require('util');var moment=require(_0xd8f2('0x1'));var BPromise=require(_0xd8f2('0x2'));var rs=require(_0xd8f2('0x3'));var fs=require('fs');var Redis=require(_0xd8f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8f2('0x5'))('rpc');var config=require(_0xd8f2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd8f2('0x7')][_0xd8f2('0x8')]({'port':0x232a});config[_0xd8f2('0x9')]=_[_0xd8f2('0xa')](config[_0xd8f2('0x9')],{'host':_0xd8f2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8f2('0x9')]));require('./userVoiceQueueRt.socket')[_0xd8f2('0xc')](socket);function respondWithRpcPromise(_0x42a866,_0x339e7b,_0x53a809){return new BPromise(function(_0x1bb223,_0x12e621){return client[_0xd8f2('0xd')](_0x42a866,_0x53a809)[_0xd8f2('0xe')](function(_0x9ab22a){logger[_0xd8f2('0xf')](_0xd8f2('0x10'),_0x339e7b,_0xd8f2('0x11'));logger[_0xd8f2('0x12')](_0xd8f2('0x13'),_0x339e7b,_0xd8f2('0x11'),JSON[_0xd8f2('0x14')](_0x9ab22a));if(_0x9ab22a[_0xd8f2('0x15')]){if(_0x9ab22a[_0xd8f2('0x15')]['code']===0x1f4){logger[_0xd8f2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x339e7b,_0x9ab22a[_0xd8f2('0x15')]['message']);return _0x12e621(_0x9ab22a['error'][_0xd8f2('0x16')]);}logger[_0xd8f2('0x15')](_0xd8f2('0x10'),_0x339e7b,_0x9ab22a[_0xd8f2('0x15')][_0xd8f2('0x16')]);return _0x1bb223(_0x9ab22a[_0xd8f2('0x15')][_0xd8f2('0x16')]);}else{logger[_0xd8f2('0xf')](_0xd8f2('0x10'),_0x339e7b,_0xd8f2('0x11'));_0x1bb223(_0x9ab22a['result'][_0xd8f2('0x16')]);}})['catch'](function(_0x43d599){logger['error'](_0xd8f2('0x10'),_0x339e7b,_0x43d599);_0x12e621(_0x43d599);});});}exports[_0xd8f2('0x17')]=function(_0x18be53){var _0x265d59=this;return new Promise(function(_0x59f0a3,_0x4076ee){return db['UserVoiceQueueRt'][_0xd8f2('0x18')]({'raw':_0x18be53[_0xd8f2('0x19')]?_0x18be53[_0xd8f2('0x19')][_0xd8f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x18be53['options']?_0x18be53[_0xd8f2('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xd8f2('0x1b'),db[_0xd8f2('0x1c')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xd8f2('0x1d')]]})['then'](function(_0x55e608){logger[_0xd8f2('0xf')](_0xd8f2('0x17'),_0x18be53);logger[_0xd8f2('0x12')]('GetVoiceQueueRtPauses',_0x18be53,JSON['stringify'](_0x55e608));_0x59f0a3(_0x55e608);})[_0xd8f2('0x1e')](function(_0x59ab45){logger['error'](_0xd8f2('0x17'),_0x59ab45[_0xd8f2('0x16')],_0x18be53);_0x4076ee(_0x265d59[_0xd8f2('0x15')](0x1f4,_0x59ab45['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 08a968e..dbd856b 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 _0x873a=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener','register'];(function(_0x2afe14,_0x44d428){var _0x226f93=function(_0x482a50){while(--_0x482a50){_0x2afe14['push'](_0x2afe14['shift']());}};_0x226f93(++_0x44d428);}(_0x873a,0x1c2));var _0xa873=function(_0x5108d5,_0x2fb326){_0x5108d5=_0x5108d5-0x0;var _0x30c1c0=_0x873a[_0x5108d5];return _0x30c1c0;};'use strict';var UserVoiceQueueRtEvents=require(_0xa873('0x0'));var events=[_0xa873('0x1'),_0xa873('0x2'),'update'];function createListener(_0x1de6be,_0x5733ee){return function(_0x52c086){_0x5733ee[_0xa873('0x3')](_0x1de6be,_0x52c086);};}function removeListener(_0x46971d,_0x5a0d23){return function(){UserVoiceQueueRtEvents[_0xa873('0x4')](_0x46971d,_0x5a0d23);};}exports[_0xa873('0x5')]=function(_0x5c0d74){for(var _0x370b8a=0x0,_0x56f262=events[_0xa873('0x6')];_0x370b8a<_0x56f262;_0x370b8a++){var _0x43247f=events[_0x370b8a];var _0x265c05=createListener(_0xa873('0x7')+_0x43247f,_0x5c0d74);UserVoiceQueueRtEvents['on'](_0x43247f,_0x265c05);}}; \ No newline at end of file +var _0xcfef=['update','removeListener','register','userVoiceQueueRt:','save','remove'];(function(_0x42bf94,_0x12e0a0){var _0x351b7f=function(_0x5bb77b){while(--_0x5bb77b){_0x42bf94['push'](_0x42bf94['shift']());}};_0x351b7f(++_0x12e0a0);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x964376,_0x4b6c36){_0x964376=_0x964376-0x0;var _0x222512=_0xcfef[_0x964376];return _0x222512;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xfcfe('0x0'),_0xfcfe('0x1'),_0xfcfe('0x2')];function createListener(_0x4c14ff,_0x5d6de0){return function(_0x4a029d){_0x5d6de0['emit'](_0x4c14ff,_0x4a029d);};}function removeListener(_0x1bee79,_0x21c122){return function(){UserVoiceQueueRtEvents[_0xfcfe('0x3')](_0x1bee79,_0x21c122);};}exports[_0xfcfe('0x4')]=function(_0x518bcd){for(var _0x531494=0x0,_0x2aecec=events['length'];_0x531494<_0x2aecec;_0x531494++){var _0x28fe66=events[_0x531494];var _0x1d7307=createListener(_0xfcfe('0x5')+_0x28fe66,_0x518bcd);UserVoiceQueueRtEvents['on'](_0x28fe66,_0x1d7307);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 210663b..d9e31dd 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x427787,_0xf1abc9){var _0x4f5f61=function(_0x6ff455){while(--_0x6ff455){_0x427787['push'](_0x427787['shift']());}};_0x4f5f61(++_0xf1abc9);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x520407,_0x24a4ce){var _0x45f7a1=function(_0x57ea00){while(--_0x57ea00){_0x520407['push'](_0x520407['shift']());}};_0x45f7a1(++_0x24a4ce);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 02de6b8..3b7aa28 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 _0x11d2=['exports','INTEGER','sequelize'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x11d2,0x1c4));var _0x211d=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x11d2[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0x211d('0x0'));module[_0x211d('0x1')]={'penalty':{'type':Sequelize[_0x211d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x836f=['INTEGER','sequelize'];(function(_0x1cd2ac,_0x718d01){var _0x50164a=function(_0x7218ba){while(--_0x7218ba){_0x1cd2ac['push'](_0x1cd2ac['shift']());}};_0x50164a(++_0x718d01);}(_0x836f,0x165));var _0xf836=function(_0x9be589,_0x3b7521){_0x9be589=_0x9be589-0x0;var _0x5f41a0=_0x836f[_0x9be589];return _0x5f41a0;};'use strict';var Sequelize=require(_0xf836('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf836('0x1')],'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 28b14d7..2e3a049 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 _0xc1e4=['../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x23afad,_0x39227e){var _0x346fb3=function(_0x2fa1f5){while(--_0x2fa1f5){_0x23afad['push'](_0x23afad['shift']());}};_0x346fb3(++_0x39227e);}(_0xc1e4,0x164));var _0x4c1e=function(_0x289ca9,_0x20e4cd){_0x289ca9=_0x289ca9-0x0;var _0x4ba47f=_0xc1e4[_0x289ca9];return _0x4ba47f;};'use strict';var _=require(_0x4c1e('0x0'));var util=require('util');var logger=require(_0x4c1e('0x1'))(_0x4c1e('0x2'));var moment=require(_0x4c1e('0x3'));var BPromise=require(_0x4c1e('0x4'));var rp=require(_0x4c1e('0x5'));var fs=require('fs');var path=require(_0x4c1e('0x6'));var rimraf=require(_0x4c1e('0x7'));var config=require(_0x4c1e('0x8'));var attributes=require(_0x4c1e('0x9'));module[_0x4c1e('0xa')]=function(_0x3bd59f,_0x567c7f){return _0x3bd59f[_0x4c1e('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x4c1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3756=['rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','path'];(function(_0x52c3e8,_0x31bc4f){var _0x36ee0a=function(_0x3485e8){while(--_0x3485e8){_0x52c3e8['push'](_0x52c3e8['shift']());}};_0x36ee0a(++_0x31bc4f);}(_0x3756,0x11c));var _0x6375=function(_0xba033e,_0x3eecce){_0xba033e=_0xba033e-0x0;var _0x1d105c=_0x3756[_0xba033e];return _0x1d105c;};'use strict';var _=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var logger=require(_0x6375('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6375('0x3'));var rimraf=require(_0x6375('0x4'));var config=require('../../config/environment');var attributes=require(_0x6375('0x5'));module[_0x6375('0x6')]=function(_0x578c,_0x44620f){return _0x578c[_0x6375('0x7')](_0x6375('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index b61efe4..c1d379c 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 _0x3b6b=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x56c5c6,_0x2a6beb){var _0x496380=function(_0x30e03d){while(--_0x30e03d){_0x56c5c6['push'](_0x56c5c6['shift']());}};_0x496380(++_0x2a6beb);}(_0x3b6b,0xb0));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb3b6('0x0'));var util=require(_0xb3b6('0x1'));var moment=require(_0xb3b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3b6('0x3'));var fs=require('fs');var Redis=require(_0xb3b6('0x4'));var db=require(_0xb3b6('0x5'))['db'];var utils=require(_0xb3b6('0x6'));var logger=require(_0xb3b6('0x7'))('rpc');var config=require(_0xb3b6('0x8'));var jayson=require(_0xb3b6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3168,_0x5cab78,_0x57165f){return new BPromise(function(_0x2325a8,_0x3b0bfb){return client[_0xb3b6('0xa')](_0x4b3168,_0x57165f)[_0xb3b6('0xb')](function(_0x3255e3){logger[_0xb3b6('0xc')](_0xb3b6('0xd'),_0x5cab78,'request\x20sent');logger[_0xb3b6('0xe')](_0xb3b6('0xf'),_0x5cab78,_0xb3b6('0x10'),JSON['stringify'](_0x3255e3));if(_0x3255e3[_0xb3b6('0x11')]){if(_0x3255e3[_0xb3b6('0x11')][_0xb3b6('0x12')]===0x1f4){logger[_0xb3b6('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5cab78,_0x3255e3[_0xb3b6('0x11')][_0xb3b6('0x13')]);return _0x3b0bfb(_0x3255e3[_0xb3b6('0x11')][_0xb3b6('0x13')]);}logger[_0xb3b6('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5cab78,_0x3255e3['error'][_0xb3b6('0x13')]);return _0x2325a8(_0x3255e3[_0xb3b6('0x11')][_0xb3b6('0x13')]);}else{logger[_0xb3b6('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5cab78,_0xb3b6('0x10'));_0x2325a8(_0x3255e3[_0xb3b6('0x14')]['message']);}})[_0xb3b6('0x15')](function(_0x3cfb48){logger[_0xb3b6('0x11')](_0xb3b6('0xd'),_0x5cab78,_0x3cfb48);_0x3b0bfb(_0x3cfb48);});});} \ No newline at end of file +var _0xa5a8=['code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa5a8,0x8f));var _0x8a5a=function(_0x3ad1ed,_0x14b441){_0x3ad1ed=_0x3ad1ed-0x0;var _0x2a4e6f=_0xa5a8[_0x3ad1ed];return _0x2a4e6f;};'use strict';var _=require(_0x8a5a('0x0'));var util=require(_0x8a5a('0x1'));var moment=require('moment');var BPromise=require(_0x8a5a('0x2'));var rs=require(_0x8a5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a5a('0x4'));var logger=require(_0x8a5a('0x5'))(_0x8a5a('0x6'));var config=require(_0x8a5a('0x7'));var jayson=require(_0x8a5a('0x8'));var client=jayson[_0x8a5a('0x9')][_0x8a5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c59f,_0x3ffa8a,_0x424b8d){return new BPromise(function(_0x5c73f5,_0x5ae6ae){return client['request'](_0x47c59f,_0x424b8d)[_0x8a5a('0xb')](function(_0x407178){logger[_0x8a5a('0xc')](_0x8a5a('0xd'),_0x3ffa8a,_0x8a5a('0xe'));logger[_0x8a5a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3ffa8a,_0x8a5a('0xe'),JSON['stringify'](_0x407178));if(_0x407178['error']){if(_0x407178[_0x8a5a('0x10')][_0x8a5a('0x11')]===0x1f4){logger[_0x8a5a('0x10')](_0x8a5a('0xd'),_0x3ffa8a,_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);return _0x5ae6ae(_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);}logger[_0x8a5a('0x10')](_0x8a5a('0xd'),_0x3ffa8a,_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);return _0x5c73f5(_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);}else{logger[_0x8a5a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3ffa8a,_0x8a5a('0xe'));_0x5c73f5(_0x407178[_0x8a5a('0x13')][_0x8a5a('0x12')]);}})['catch'](function(_0x38e2ff){logger['error'](_0x8a5a('0xd'),_0x3ffa8a,_0x38e2ff);_0x5ae6ae(_0x38e2ff);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0718d7d..f2e6674 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 _0x4016=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','util','path','fs-extra'];(function(_0x421463,_0x4b9c5c){var _0x5e6c80=function(_0x37b585){while(--_0x37b585){_0x421463['push'](_0x421463['shift']());}};_0x5e6c80(++_0x4b9c5c);}(_0x4016,0x131));var _0x6401=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4016[_0x5ddb1c];return _0x354adc;};'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('./variable.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 _0xf296=['../../config/environment','./variable.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0xf296,0x94));var _0x6f29=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0xf296[_0x1d5714];return _0x1b620e;};'use strict';var multer=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var path=require('path');var timeout=require(_0x6f29('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f29('0x3'));var auth=require(_0x6f29('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f29('0x5'));var controller=require(_0x6f29('0x6'));router[_0x6f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f29('0x8')]);router[_0x6f29('0x7')]('/:id',auth[_0x6f29('0x9')](),controller[_0x6f29('0xa')]);router[_0x6f29('0xb')]('/',auth[_0x6f29('0x9')](),controller[_0x6f29('0xc')]);router[_0x6f29('0xd')](_0x6f29('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6f29('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6f29('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index afe244b..55ce023 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 _0xcd06=['exports','STRING','name'];(function(_0x334a00,_0x2cb6d6){var _0xb77a90=function(_0x39fea8){while(--_0x39fea8){_0x334a00['push'](_0x334a00['shift']());}};_0xb77a90(++_0x2cb6d6);}(_0xcd06,0xa2));var _0x6cd0=function(_0x3094a9,_0x447bbb){_0x3094a9=_0x3094a9-0x0;var _0xad29dd=_0xcd06[_0x3094a9];return _0xad29dd;};'use strict';var Sequelize=require('sequelize');module[_0x6cd0('0x0')]={'name':{'type':Sequelize[_0x6cd0('0x1')],'unique':_0x6cd0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6cd0('0x1')]}}; \ No newline at end of file +var _0xabfc=['STRING','name','exports'];(function(_0x12f1e1,_0x565cd0){var _0x254085=function(_0x4b3e61){while(--_0x4b3e61){_0x12f1e1['push'](_0x12f1e1['shift']());}};_0x254085(++_0x565cd0);}(_0xabfc,0x1d9));var _0xcabf=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xabfc[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require('sequelize');module[_0xcabf('0x0')]={'name':{'type':Sequelize[_0xcabf('0x1')],'unique':_0xcabf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcabf('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 347c8fa..4163121 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 _0x57ef=['path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','get','Variables','error','stack','name','send','index','map','rawAttributes','type','key','query','model','attributes','intersection','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','Variable','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x57ef,0xa0));var _0xf57e=function(_0x4491f2,_0x5b7d9e){_0x4491f2=_0x4491f2-0x0;var _0x1d4b5a=_0x57ef[_0x4491f2];return _0x1d4b5a;};'use strict';var emlformat=require(_0xf57e('0x0'));var rimraf=require(_0xf57e('0x1'));var zipdir=require(_0xf57e('0x2'));var jsonpatch=require(_0xf57e('0x3'));var rp=require(_0xf57e('0x4'));var moment=require(_0xf57e('0x5'));var BPromise=require(_0xf57e('0x6'));var Mustache=require(_0xf57e('0x7'));var util=require('util');var path=require(_0xf57e('0x8'));var sox=require('sox');var csv=require(_0xf57e('0x9'));var ejs=require(_0xf57e('0xa'));var fs=require('fs');var fs_extra=require(_0xf57e('0xb'));var _=require('lodash');var squel=require(_0xf57e('0xc'));var crypto=require(_0xf57e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf57e('0xe'));var toCsv=require(_0xf57e('0x9'));var querystring=require(_0xf57e('0xf'));var Papa=require(_0xf57e('0x10'));var Redis=require(_0xf57e('0x11'));var authService=require(_0xf57e('0x12'));var qs=require(_0xf57e('0x13'));var as=require(_0xf57e('0x14'));var hardwareService=require(_0xf57e('0x15'));var logger=require(_0xf57e('0x16'))(_0xf57e('0x17'));var utils=require(_0xf57e('0x18'));var config=require(_0xf57e('0x19'));var licenseUtil=require(_0xf57e('0x1a'));var db=require(_0xf57e('0x1b'))['db'];function respondWithStatusCode(_0x9b8a6f,_0x4a3163){_0x4a3163=_0x4a3163||0xcc;return function(_0x415c82){if(_0x415c82){return _0x9b8a6f[_0xf57e('0x1c')](_0x4a3163);}return _0x9b8a6f[_0xf57e('0x1d')](_0x4a3163)[_0xf57e('0x1e')]();};}function respondWithResult(_0x274217,_0x55c749){_0x55c749=_0x55c749||0xc8;return function(_0x1645f2){if(_0x1645f2){return _0x274217[_0xf57e('0x1d')](_0x55c749)[_0xf57e('0x1f')](_0x1645f2);}};}function respondWithFilteredResult(_0xf2ce2c,_0x193998){return function(_0x7903c7){if(_0x7903c7){var _0x48c4c1=typeof _0x193998[_0xf57e('0x20')]==='undefined'&&typeof _0x193998[_0xf57e('0x21')]===_0xf57e('0x22');var _0x348744=_0x7903c7[_0xf57e('0x23')];var _0x392be3=_0x48c4c1?0x0:_0x193998[_0xf57e('0x20')];var _0x366be1=_0x48c4c1?_0x7903c7[_0xf57e('0x23')]:_0x193998[_0xf57e('0x20')]+_0x193998[_0xf57e('0x21')];var _0x57ee4e;if(_0x366be1>=_0x348744){_0x366be1=_0x348744;_0x57ee4e=0xc8;}else{_0x57ee4e=0xce;}_0xf2ce2c[_0xf57e('0x1d')](_0x57ee4e);return _0xf2ce2c['set'](_0xf57e('0x24'),_0x392be3+'-'+_0x366be1+'/'+_0x348744)['json'](_0x7903c7);}return null;};}function patchUpdates(_0x46b94e){return function(_0x54be25){try{jsonpatch[_0xf57e('0x25')](_0x54be25,_0x46b94e,!![]);}catch(_0x388aef){return BPromise['reject'](_0x388aef);}return _0x54be25['save']();};}function saveUpdates(_0x50f6b8,_0x496a84){return function(_0x1e8d24){if(_0x1e8d24){return _0x1e8d24['update'](_0x50f6b8)[_0xf57e('0x26')](function(_0x1e425c){return _0x1e425c;});}return null;};}function removeEntity(_0x10b095,_0xd06c84){return function(_0x4fbacf){if(_0x4fbacf){return _0x4fbacf[_0xf57e('0x27')]()[_0xf57e('0x26')](function(){var _0x35c68b=_0x4fbacf[_0xf57e('0x28')]({'plain':!![]});var _0x52fd13=_0xf57e('0x29');return db['UserProfileResource'][_0xf57e('0x27')]({'where':{'type':_0x52fd13,'resourceId':_0x35c68b['id']}})[_0xf57e('0x26')](function(){return _0x4fbacf;});})[_0xf57e('0x26')](function(){_0x10b095[_0xf57e('0x1d')](0xcc)[_0xf57e('0x1e')]();});}};}function handleEntityNotFound(_0x33273a,_0x40afc7){return function(_0x17259a){if(!_0x17259a){_0x33273a[_0xf57e('0x1c')](0x194);}return _0x17259a;};}function handleError(_0x48d547,_0x24c418){_0x24c418=_0x24c418||0x1f4;return function(_0x23b036){logger[_0xf57e('0x2a')](_0x23b036[_0xf57e('0x2b')]);if(_0x23b036[_0xf57e('0x2c')]){delete _0x23b036['name'];}_0x48d547['status'](_0x24c418)[_0xf57e('0x2d')](_0x23b036);};}exports[_0xf57e('0x2e')]=function(_0x39fc56,_0x5f31ca){var _0x3235fc={},_0x3d3085={},_0xbd3803={'count':0x0,'rows':[]};var _0x1b007b=_[_0xf57e('0x2f')](db['Variable'][_0xf57e('0x30')],function(_0x359fbd){return{'name':_0x359fbd['fieldName'],'type':_0x359fbd[_0xf57e('0x31')][_0xf57e('0x32')]};});_0x3d3085['model']=_[_0xf57e('0x2f')](_0x1b007b,_0xf57e('0x2c'));_0x3d3085['query']=_['keys'](_0x39fc56[_0xf57e('0x33')]);_0x3d3085['filters']=_['intersection'](_0x3d3085[_0xf57e('0x34')],_0x3d3085[_0xf57e('0x33')]);_0x3235fc[_0xf57e('0x35')]=_[_0xf57e('0x36')](_0x3d3085[_0xf57e('0x34')],qs['fields'](_0x39fc56['query']['fields']));_0x3235fc[_0xf57e('0x35')]=_0x3235fc[_0xf57e('0x35')]['length']?_0x3235fc[_0xf57e('0x35')]:_0x3d3085['model'];if(!_0x39fc56[_0xf57e('0x33')]['hasOwnProperty'](_0xf57e('0x37'))){_0x3235fc['limit']=qs['limit'](_0x39fc56[_0xf57e('0x33')][_0xf57e('0x21')]);_0x3235fc[_0xf57e('0x20')]=qs[_0xf57e('0x20')](_0x39fc56[_0xf57e('0x33')][_0xf57e('0x20')]);}_0x3235fc['order']=qs[_0xf57e('0x38')](_0x39fc56[_0xf57e('0x33')][_0xf57e('0x38')]);_0x3235fc[_0xf57e('0x39')]=qs[_0xf57e('0x3a')](_[_0xf57e('0x3b')](_0x39fc56[_0xf57e('0x33')],_0x3d3085[_0xf57e('0x3a')]),_0x1b007b);if(_0x39fc56[_0xf57e('0x33')]['filter']){_0x3235fc[_0xf57e('0x39')]=_[_0xf57e('0x3c')](_0x3235fc[_0xf57e('0x39')],{'$or':_['map'](_0x1b007b,function(_0x1ded54){if(_0x1ded54[_0xf57e('0x31')]!==_0xf57e('0x3d')){var _0x181c86={};_0x181c86[_0x1ded54[_0xf57e('0x2c')]]={'$like':'%'+_0x39fc56[_0xf57e('0x33')][_0xf57e('0x3e')]+'%'};return _0x181c86;}})});}_0x3235fc=_[_0xf57e('0x3c')]({},_0x3235fc,_0x39fc56['options']);var _0x9f064a={'where':_0x3235fc['where']};return db[_0xf57e('0x3f')]['count'](_0x9f064a)[_0xf57e('0x26')](function(_0x449a42){_0xbd3803[_0xf57e('0x23')]=_0x449a42;if(_0x39fc56[_0xf57e('0x33')][_0xf57e('0x40')]){_0x3235fc[_0xf57e('0x41')]=[{'all':!![]}];}return db[_0xf57e('0x3f')][_0xf57e('0x42')](_0x3235fc);})[_0xf57e('0x26')](function(_0x3e3667){_0xbd3803[_0xf57e('0x43')]=_0x3e3667;return _0xbd3803;})[_0xf57e('0x26')](respondWithFilteredResult(_0x5f31ca,_0x3235fc))[_0xf57e('0x44')](handleError(_0x5f31ca,null));};exports[_0xf57e('0x45')]=function(_0x27cd06,_0x413bd3){var _0x31bbfe={'raw':!![],'where':{'id':_0x27cd06[_0xf57e('0x46')]['id']}},_0x5dd427={};_0x5dd427[_0xf57e('0x34')]=_[_0xf57e('0x47')](db[_0xf57e('0x3f')]['rawAttributes']);_0x5dd427[_0xf57e('0x33')]=_['keys'](_0x27cd06[_0xf57e('0x33')]);_0x5dd427['filters']=_[_0xf57e('0x36')](_0x5dd427[_0xf57e('0x34')],_0x5dd427[_0xf57e('0x33')]);_0x31bbfe[_0xf57e('0x35')]=_[_0xf57e('0x36')](_0x5dd427['model'],qs[_0xf57e('0x48')](_0x27cd06[_0xf57e('0x33')]['fields']));_0x31bbfe[_0xf57e('0x35')]=_0x31bbfe[_0xf57e('0x35')][_0xf57e('0x49')]?_0x31bbfe['attributes']:_0x5dd427[_0xf57e('0x34')];if(_0x27cd06[_0xf57e('0x33')][_0xf57e('0x40')]){_0x31bbfe[_0xf57e('0x41')]=[{'all':!![]}];}_0x31bbfe=_['merge']({},_0x31bbfe,_0x27cd06[_0xf57e('0x4a')]);return db[_0xf57e('0x3f')]['find'](_0x31bbfe)['then'](handleEntityNotFound(_0x413bd3,null))['then'](respondWithResult(_0x413bd3,null))[_0xf57e('0x44')](handleError(_0x413bd3,null));};exports[_0xf57e('0x4b')]=function(_0x375e2c,_0x3f717e){return db[_0xf57e('0x3f')][_0xf57e('0x4b')](_0x375e2c['body'],{})['then'](function(_0x35aadc){var _0x3ede24=_0x375e2c['user'][_0xf57e('0x28')]({'plain':!![]});if(!_0x3ede24)throw new Error(_0xf57e('0x4c'));if(_0x3ede24['role']==='user'){var _0x25854b=_0x35aadc[_0xf57e('0x28')]({'plain':!![]});var _0x357b1d='Variables';return db[_0xf57e('0x4d')][_0xf57e('0x4e')]({'where':{'name':_0x357b1d,'userProfileId':_0x3ede24[_0xf57e('0x4f')]},'raw':!![]})[_0xf57e('0x26')](function(_0x2165df){if(_0x2165df&&_0x2165df['autoAssociation']===0x0){return db[_0xf57e('0x50')][_0xf57e('0x4b')]({'name':_0x25854b[_0xf57e('0x2c')],'resourceId':_0x25854b['id'],'type':_0x2165df[_0xf57e('0x2c')],'sectionId':_0x2165df['id']},{})['then'](function(){return _0x35aadc;});}else{return _0x35aadc;}})[_0xf57e('0x44')](function(_0x1a9e9c){logger[_0xf57e('0x2a')](_0xf57e('0x51'),_0x1a9e9c);throw _0x1a9e9c;});}return _0x35aadc;})[_0xf57e('0x26')](respondWithResult(_0x3f717e,0xc9))['catch'](handleError(_0x3f717e,null));};exports[_0xf57e('0x52')]=function(_0x167369,_0x3648e1){if(_0x167369[_0xf57e('0x53')]['id']){delete _0x167369['body']['id'];}return db[_0xf57e('0x3f')][_0xf57e('0x4e')]({'where':{'id':_0x167369[_0xf57e('0x46')]['id']}})[_0xf57e('0x26')](handleEntityNotFound(_0x3648e1,null))[_0xf57e('0x26')](saveUpdates(_0x167369[_0xf57e('0x53')],null))[_0xf57e('0x26')](respondWithResult(_0x3648e1,null))[_0xf57e('0x44')](handleError(_0x3648e1,null));};exports['destroy']=function(_0x25f731,_0x1f640a){return db[_0xf57e('0x3f')][_0xf57e('0x4e')]({'where':{'id':_0x25f731[_0xf57e('0x46')]['id']}})[_0xf57e('0x26')](handleEntityNotFound(_0x1f640a,null))[_0xf57e('0x26')](removeEntity(_0x1f640a,null))[_0xf57e('0x44')](handleError(_0x1f640a,null));}; \ No newline at end of file +var _0x79a8=['save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','name','send','index','Variable','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x115ebe,_0x3f8784){var _0x1a8218=function(_0x3cb15b){while(--_0x3cb15b){_0x115ebe['push'](_0x115ebe['shift']());}};_0x1a8218(++_0x3f8784);}(_0x79a8,0x129));var _0x879a=function(_0x4af43b,_0x46ddfc){_0x4af43b=_0x4af43b-0x0;var _0xb20e01=_0x79a8[_0x4af43b];return _0xb20e01;};'use strict';var emlformat=require(_0x879a('0x0'));var rimraf=require(_0x879a('0x1'));var zipdir=require(_0x879a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x879a('0x3'));var moment=require(_0x879a('0x4'));var BPromise=require(_0x879a('0x5'));var Mustache=require(_0x879a('0x6'));var util=require(_0x879a('0x7'));var path=require(_0x879a('0x8'));var sox=require(_0x879a('0x9'));var csv=require(_0x879a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x879a('0xb'));var squel=require(_0x879a('0xc'));var crypto=require(_0x879a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x879a('0xe'));var toCsv=require(_0x879a('0xa'));var querystring=require(_0x879a('0xf'));var Papa=require(_0x879a('0x10'));var Redis=require(_0x879a('0x11'));var authService=require(_0x879a('0x12'));var qs=require(_0x879a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x879a('0x14'));var logger=require(_0x879a('0x15'))(_0x879a('0x16'));var utils=require(_0x879a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x879a('0x18'));var db=require(_0x879a('0x19'))['db'];function respondWithStatusCode(_0x34e18a,_0x5b63ba){_0x5b63ba=_0x5b63ba||0xcc;return function(_0x23542a){if(_0x23542a){return _0x34e18a['sendStatus'](_0x5b63ba);}return _0x34e18a[_0x879a('0x1a')](_0x5b63ba)[_0x879a('0x1b')]();};}function respondWithResult(_0xe61b9d,_0x2c1914){_0x2c1914=_0x2c1914||0xc8;return function(_0x39be6b){if(_0x39be6b){return _0xe61b9d[_0x879a('0x1a')](_0x2c1914)['json'](_0x39be6b);}};}function respondWithFilteredResult(_0x565ec7,_0x12a2a6){return function(_0x5358ce){if(_0x5358ce){var _0x290238=typeof _0x12a2a6['offset']==='undefined'&&typeof _0x12a2a6['limit']===_0x879a('0x1c');var _0x437c23=_0x5358ce[_0x879a('0x1d')];var _0x10675f=_0x290238?0x0:_0x12a2a6[_0x879a('0x1e')];var _0x50547d=_0x290238?_0x5358ce[_0x879a('0x1d')]:_0x12a2a6['offset']+_0x12a2a6['limit'];var _0x4ff1bd;if(_0x50547d>=_0x437c23){_0x50547d=_0x437c23;_0x4ff1bd=0xc8;}else{_0x4ff1bd=0xce;}_0x565ec7[_0x879a('0x1a')](_0x4ff1bd);return _0x565ec7[_0x879a('0x1f')](_0x879a('0x20'),_0x10675f+'-'+_0x50547d+'/'+_0x437c23)['json'](_0x5358ce);}return null;};}function patchUpdates(_0x105091){return function(_0x24282b){try{jsonpatch[_0x879a('0x21')](_0x24282b,_0x105091,!![]);}catch(_0x4c7458){return BPromise[_0x879a('0x22')](_0x4c7458);}return _0x24282b[_0x879a('0x23')]();};}function saveUpdates(_0x3df989,_0x5c42b4){return function(_0x488fb7){if(_0x488fb7){return _0x488fb7[_0x879a('0x24')](_0x3df989)['then'](function(_0x3c0b2a){return _0x3c0b2a;});}return null;};}function removeEntity(_0x1005b9,_0x2f0f87){return function(_0x5b8e51){if(_0x5b8e51){return _0x5b8e51['destroy']()[_0x879a('0x25')](function(){var _0x3c8181=_0x5b8e51[_0x879a('0x26')]({'plain':!![]});var _0x517225=_0x879a('0x27');return db[_0x879a('0x28')][_0x879a('0x29')]({'where':{'type':_0x517225,'resourceId':_0x3c8181['id']}})[_0x879a('0x25')](function(){return _0x5b8e51;});})['then'](function(){_0x1005b9[_0x879a('0x1a')](0xcc)[_0x879a('0x1b')]();});}};}function handleEntityNotFound(_0x3cdbc8,_0x5acfb9){return function(_0x46808e){if(!_0x46808e){_0x3cdbc8[_0x879a('0x2a')](0x194);}return _0x46808e;};}function handleError(_0x40fb7b,_0x888244){_0x888244=_0x888244||0x1f4;return function(_0x3baf49){logger[_0x879a('0x2b')](_0x3baf49['stack']);if(_0x3baf49[_0x879a('0x2c')]){delete _0x3baf49[_0x879a('0x2c')];}_0x40fb7b[_0x879a('0x1a')](_0x888244)[_0x879a('0x2d')](_0x3baf49);};}exports[_0x879a('0x2e')]=function(_0x770885,_0x10e761){var _0xe08c10={},_0x55dffe={},_0x14ad2d={'count':0x0,'rows':[]};var _0x23e7a1=_['map'](db[_0x879a('0x2f')][_0x879a('0x30')],function(_0x39a277){return{'name':_0x39a277['fieldName'],'type':_0x39a277[_0x879a('0x31')][_0x879a('0x32')]};});_0x55dffe[_0x879a('0x33')]=_[_0x879a('0x34')](_0x23e7a1,_0x879a('0x2c'));_0x55dffe[_0x879a('0x35')]=_[_0x879a('0x36')](_0x770885[_0x879a('0x35')]);_0x55dffe[_0x879a('0x37')]=_['intersection'](_0x55dffe[_0x879a('0x33')],_0x55dffe[_0x879a('0x35')]);_0xe08c10['attributes']=_[_0x879a('0x38')](_0x55dffe[_0x879a('0x33')],qs['fields'](_0x770885[_0x879a('0x35')][_0x879a('0x39')]));_0xe08c10[_0x879a('0x3a')]=_0xe08c10[_0x879a('0x3a')][_0x879a('0x3b')]?_0xe08c10[_0x879a('0x3a')]:_0x55dffe['model'];if(!_0x770885['query']['hasOwnProperty'](_0x879a('0x3c'))){_0xe08c10['limit']=qs[_0x879a('0x3d')](_0x770885['query']['limit']);_0xe08c10['offset']=qs[_0x879a('0x1e')](_0x770885['query'][_0x879a('0x1e')]);}_0xe08c10[_0x879a('0x3e')]=qs['sort'](_0x770885['query'][_0x879a('0x3f')]);_0xe08c10['where']=qs[_0x879a('0x37')](_[_0x879a('0x40')](_0x770885['query'],_0x55dffe[_0x879a('0x37')]),_0x23e7a1);if(_0x770885[_0x879a('0x35')][_0x879a('0x41')]){_0xe08c10[_0x879a('0x42')]=_[_0x879a('0x43')](_0xe08c10['where'],{'$or':_['map'](_0x23e7a1,function(_0x353414){if(_0x353414[_0x879a('0x31')]!=='VIRTUAL'){var _0x5d28f6={};_0x5d28f6[_0x353414['name']]={'$like':'%'+_0x770885[_0x879a('0x35')][_0x879a('0x41')]+'%'};return _0x5d28f6;}})});}_0xe08c10=_[_0x879a('0x43')]({},_0xe08c10,_0x770885[_0x879a('0x44')]);var _0x6cb1fd={'where':_0xe08c10[_0x879a('0x42')]};return db[_0x879a('0x2f')][_0x879a('0x1d')](_0x6cb1fd)['then'](function(_0x42e42c){_0x14ad2d['count']=_0x42e42c;if(_0x770885[_0x879a('0x35')][_0x879a('0x45')]){_0xe08c10[_0x879a('0x46')]=[{'all':!![]}];}return db[_0x879a('0x2f')]['findAll'](_0xe08c10);})[_0x879a('0x25')](function(_0x33d0ed){_0x14ad2d[_0x879a('0x47')]=_0x33d0ed;return _0x14ad2d;})['then'](respondWithFilteredResult(_0x10e761,_0xe08c10))['catch'](handleError(_0x10e761,null));};exports['show']=function(_0x4ff3b0,_0x14b299){var _0x3eb6bc={'raw':!![],'where':{'id':_0x4ff3b0[_0x879a('0x48')]['id']}},_0x5c3234={};_0x5c3234[_0x879a('0x33')]=_[_0x879a('0x36')](db['Variable'][_0x879a('0x30')]);_0x5c3234[_0x879a('0x35')]=_[_0x879a('0x36')](_0x4ff3b0['query']);_0x5c3234['filters']=_[_0x879a('0x38')](_0x5c3234['model'],_0x5c3234[_0x879a('0x35')]);_0x3eb6bc[_0x879a('0x3a')]=_[_0x879a('0x38')](_0x5c3234[_0x879a('0x33')],qs[_0x879a('0x39')](_0x4ff3b0[_0x879a('0x35')][_0x879a('0x39')]));_0x3eb6bc[_0x879a('0x3a')]=_0x3eb6bc[_0x879a('0x3a')][_0x879a('0x3b')]?_0x3eb6bc[_0x879a('0x3a')]:_0x5c3234['model'];if(_0x4ff3b0[_0x879a('0x35')]['includeAll']){_0x3eb6bc[_0x879a('0x46')]=[{'all':!![]}];}_0x3eb6bc=_[_0x879a('0x43')]({},_0x3eb6bc,_0x4ff3b0['options']);return db['Variable'][_0x879a('0x49')](_0x3eb6bc)[_0x879a('0x25')](handleEntityNotFound(_0x14b299,null))[_0x879a('0x25')](respondWithResult(_0x14b299,null))[_0x879a('0x4a')](handleError(_0x14b299,null));};exports[_0x879a('0x4b')]=function(_0x270448,_0x296cfa){return db[_0x879a('0x2f')][_0x879a('0x4b')](_0x270448[_0x879a('0x4c')],{})['then'](function(_0x3a1292){var _0x2a9b37=_0x270448[_0x879a('0x4d')][_0x879a('0x26')]({'plain':!![]});if(!_0x2a9b37)throw new Error(_0x879a('0x4e'));if(_0x2a9b37[_0x879a('0x4f')]===_0x879a('0x4d')){var _0x3b5b98=_0x3a1292[_0x879a('0x26')]({'plain':!![]});var _0x1c5659='Variables';return db[_0x879a('0x50')][_0x879a('0x49')]({'where':{'name':_0x1c5659,'userProfileId':_0x2a9b37['userProfileId']},'raw':!![]})[_0x879a('0x25')](function(_0x43eb05){if(_0x43eb05&&_0x43eb05[_0x879a('0x51')]===0x0){return db[_0x879a('0x28')][_0x879a('0x4b')]({'name':_0x3b5b98['name'],'resourceId':_0x3b5b98['id'],'type':_0x43eb05[_0x879a('0x2c')],'sectionId':_0x43eb05['id']},{})[_0x879a('0x25')](function(){return _0x3a1292;});}else{return _0x3a1292;}})[_0x879a('0x4a')](function(_0x309417){logger[_0x879a('0x2b')](_0x879a('0x52'),_0x309417);throw _0x309417;});}return _0x3a1292;})[_0x879a('0x25')](respondWithResult(_0x296cfa,0xc9))['catch'](handleError(_0x296cfa,null));};exports[_0x879a('0x24')]=function(_0x307df7,_0xafff){if(_0x307df7['body']['id']){delete _0x307df7['body']['id'];}return db[_0x879a('0x2f')][_0x879a('0x49')]({'where':{'id':_0x307df7['params']['id']}})[_0x879a('0x25')](handleEntityNotFound(_0xafff,null))[_0x879a('0x25')](saveUpdates(_0x307df7[_0x879a('0x4c')],null))[_0x879a('0x25')](respondWithResult(_0xafff,null))[_0x879a('0x4a')](handleError(_0xafff,null));};exports[_0x879a('0x29')]=function(_0x1e7eb8,_0x1bad63){return db[_0x879a('0x2f')]['find']({'where':{'id':_0x1e7eb8[_0x879a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bad63,null))[_0x879a('0x25')](removeEntity(_0x1bad63,null))[_0x879a('0x4a')](handleError(_0x1bad63,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 84545c4..df2c9e2 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 _0xfa19=['tools_variables','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4f0a6a,_0x22a745){var _0xeeb394=function(_0x5ef5bf){while(--_0x5ef5bf){_0x4f0a6a['push'](_0x4f0a6a['shift']());}};_0xeeb394(++_0x22a745);}(_0xfa19,0x137));var _0x9fa1=function(_0xba461e,_0x467956){_0xba461e=_0xba461e-0x0;var _0x5903a2=_0xfa19[_0xba461e];return _0x5903a2;};'use strict';var _=require('lodash');var util=require(_0x9fa1('0x0'));var logger=require(_0x9fa1('0x1'))(_0x9fa1('0x2'));var moment=require(_0x9fa1('0x3'));var BPromise=require(_0x9fa1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fa1('0x5'));var rimraf=require(_0x9fa1('0x6'));var config=require(_0x9fa1('0x7'));var attributes=require('./variable.attributes');module[_0x9fa1('0x8')]=function(_0x17d426,_0x4ad116){return _0x17d426['define']('Variable',attributes,{'tableName':_0x9fa1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf2f=['../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x1bb0ab,_0x4ed620){var _0x13336d=function(_0x5e1ba8){while(--_0x5e1ba8){_0x1bb0ab['push'](_0x1bb0ab['shift']());}};_0x13336d(++_0x4ed620);}(_0xaf2f,0x125));var _0xfaf2=function(_0x5b09bf,_0xa6f27c){_0x5b09bf=_0x5b09bf-0x0;var _0x13d26b=_0xaf2f[_0x5b09bf];return _0x13d26b;};'use strict';var _=require(_0xfaf2('0x0'));var util=require(_0xfaf2('0x1'));var logger=require('../../config/logger')(_0xfaf2('0x2'));var moment=require(_0xfaf2('0x3'));var BPromise=require(_0xfaf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaf2('0x5'));var rimraf=require(_0xfaf2('0x6'));var config=require(_0xfaf2('0x7'));var attributes=require(_0xfaf2('0x8'));module['exports']=function(_0x50a423,_0x40f6fe){return _0x50a423[_0xfaf2('0x9')](_0xfaf2('0xa'),attributes,{'tableName':_0xfaf2('0xb'),'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 f540591..f40bc0b 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x158e0f,_0x41b0c3){_0x158e0f=_0x158e0f-0x0;var _0x4f633f=_0x1cb9[_0x158e0f];return _0x4f633f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x55b890,_0x25ebcd){var _0x145a3b=function(_0x38b805){while(--_0x38b805){_0x55b890['push'](_0x55b890['shift']());}};_0x145a3b(++_0x25ebcd);}(_0x6aa7,0x178));var _0x76aa=function(_0x1d2a74,_0x5ec11c){_0x1d2a74=_0x1d2a74-0x0;var _0x2c937a=_0x6aa7[_0x1d2a74];return _0x2c937a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 30ebf01..3aca254 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 _0x28fc=['migrations','exports','express','../../components/auth/service','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','restart','/migrations'];(function(_0x484c09,_0xa3398b){var _0x2c3113=function(_0x2073fc){while(--_0x2073fc){_0x484c09['push'](_0x484c09['shift']());}};_0x2c3113(++_0xa3398b);}(_0x28fc,0x1c4));var _0xc28f=function(_0x348fec,_0x486f87){_0x348fec=_0x348fec-0x0;var _0x5914c7=_0x28fc[_0x348fec];return _0x5914c7;};'use strict';var express=require(_0xc28f('0x0'));var router=express['Router']();var auth=require(_0xc28f('0x1'));var controller=require('./version.controller');router[_0xc28f('0x2')]('/',controller[_0xc28f('0x3')]);router[_0xc28f('0x2')](_0xc28f('0x4'),auth['isAuthenticated'](),auth[_0xc28f('0x5')](),controller[_0xc28f('0x6')]);router['get'](_0xc28f('0x7'),auth[_0xc28f('0x8')](),auth['canUpdate'](),controller['reset']);router[_0xc28f('0x2')](_0xc28f('0x9'),auth[_0xc28f('0x8')](),auth[_0xc28f('0x5')](),controller[_0xc28f('0xa')]);router['get']('/restart',auth[_0xc28f('0x8')](),controller[_0xc28f('0xb')]);router[_0xc28f('0x2')](_0xc28f('0xc'),controller[_0xc28f('0xd')]);module[_0xc28f('0xe')]=router; \ No newline at end of file +var _0x946e=['index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x946e,0x183));var _0xe946=function(_0x4dcb70,_0x1befe7){_0x4dcb70=_0x4dcb70-0x0;var _0x2941d5=_0x946e[_0x4dcb70];return _0x2941d5;};'use strict';var express=require(_0xe946('0x0'));var router=express[_0xe946('0x1')]();var auth=require(_0xe946('0x2'));var controller=require('./version.controller');router[_0xe946('0x3')]('/',controller[_0xe946('0x4')]);router[_0xe946('0x3')](_0xe946('0x5'),auth[_0xe946('0x6')](),auth[_0xe946('0x7')](),controller['fetch']);router[_0xe946('0x3')](_0xe946('0x8'),auth[_0xe946('0x6')](),auth[_0xe946('0x7')](),controller[_0xe946('0x9')]);router[_0xe946('0x3')](_0xe946('0xa'),auth[_0xe946('0x6')](),auth['canUpdate'](),controller[_0xe946('0xb')]);router[_0xe946('0x3')](_0xe946('0xc'),auth[_0xe946('0x6')](),controller[_0xe946('0xd')]);router[_0xe946('0x3')](_0xe946('0xe'),controller[_0xe946('0xf')]);module[_0xe946('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 869399e..a37492f 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 _0xe40c=['version','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','error','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe40c,0x91));var _0xce40=function(_0x1c4b31,_0x33f926){_0x1c4b31=_0x1c4b31-0x0;var _0x429be1=_0xe40c[_0x1c4b31];return _0x429be1;};'use strict';var Umzug=require(_0xce40('0x0'));var path=require(_0xce40('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xce40('0x2'));var exec=require('child_process')[_0xce40('0x3')];var db=require(_0xce40('0x4'))['db'];var config=require(_0xce40('0x5'));var pm2=require(_0xce40('0x6'));var logger=require(_0xce40('0x7'))('update');var git=require(_0xce40('0x8'))(config[_0xce40('0x9')]);exports[_0xce40('0xa')]=function(_0x4b68b8,_0x12c1ea){var _0x1c2f7f={'current':module['exports'][_0xce40('0xb')],'phonebar':0x2};if(_0x4b68b8[_0xce40('0xc')]&&_0x4b68b8[_0xce40('0xc')][_0xce40('0xd')]){return git[_0xce40('0xe')]()[_0xce40('0xf')](function(_0x9fa7d6,_0x14b396){_0x1c2f7f['latest']=(_0x9fa7d6?module[_0xce40('0x10')][_0xce40('0xb')]:_0x14b396['latest'])||_0xce40('0x11');return _0x12c1ea[_0xce40('0x12')](0xc8)[_0xce40('0x13')](_0x1c2f7f);});}else{return _0x12c1ea[_0xce40('0x12')](0xc8)[_0xce40('0x13')](_0x1c2f7f);}};exports[_0xce40('0xe')]=function(_0x5c938b,_0x3aab3f){return git[_0xce40('0xe')]([_0xce40('0x14'),_0xce40('0x15')],function(_0x30927f){if(_0x30927f){logger['error'](_0x30927f);return _0x3aab3f['status'](0x1f4)['json'](_0x30927f);}logger[_0xce40('0x16')](_0xce40('0x17'));return _0x3aab3f[_0xce40('0x12')](0xc8)[_0xce40('0x13')]({'output':_0xce40('0x18')});});};exports['reset']=function(_0x4a02e4,_0x29bf62){return git[_0xce40('0x19')](['--hard',_0xce40('0x1a')],function(_0x12852f){if(_0x12852f){logger['error'](_0x12852f);return _0x29bf62[_0xce40('0x12')](0x1f4)[_0xce40('0x13')](_0x12852f);}logger[_0xce40('0x16')](_0xce40('0x1b'));return _0x29bf62[_0xce40('0x12')](0xc8)[_0xce40('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0xce40('0x1c')]=function(_0x40ae52,_0x2d0706){exec(_0xce40('0x1d'),function(_0x47c8fb,_0x39af1f,_0x18de71){logger[_0xce40('0x16')](_0x39af1f);logger[_0xce40('0x16')](_0x18de71);if(_0x47c8fb){logger[_0xce40('0x1e')](_0x47c8fb);return _0x2d0706[_0xce40('0x12')](0x1f4)[_0xce40('0x13')](_0x47c8fb);}return _0x2d0706['status'](0xc8)[_0xce40('0x13')]({'output':_0x39af1f});});};exports[_0xce40('0x1f')]=function(_0xc89c98,_0x3e54e4){return pm2[_0xce40('0x1f')]('motion2')[_0xce40('0x20')](function(_0x37f114){logger[_0xce40('0x16')](_0xce40('0x21'),_0x37f114);return _0x3e54e4[_0xce40('0x12')](0xc8)[_0xce40('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xce40('0x22')](function(_0x223fe1){logger[_0xce40('0x1e')](_0x223fe1);return _0x3e54e4[_0xce40('0x12')](0x1f4)['json'](_0x223fe1);});};exports[_0xce40('0x23')]=function(_0x3e645a,_0x409124){var _0x4cb232=fs[_0xce40('0x24')](path['join'](config[_0xce40('0x9')],_0xce40('0x25'),_0xce40('0x23')));var _0xb63f72=[];for(var _0x45281c=0x0;_0x45281c<_0x4cb232[_0xce40('0x26')];_0x45281c++){var _0x30be6c=_0x4cb232[_0x45281c][_0xce40('0x27')](_0xce40('0x28'),'');if(compareVersions(module['exports']['version'],_0x30be6c)===-0x1){_0xb63f72[_0xce40('0x29')](_0x30be6c);}}if(_0xb63f72[_0xce40('0x26')]){var _0x1b885b=_0xb63f72[_0xce40('0x2a')](compareVersions);var _0x38813e=new Umzug({'storage':_0xce40('0x2b'),'storageOptions':{'model':db[_0xce40('0x2c')],'modelName':'Migration','columnName':_0xce40('0xb')},'migrations':{'params':[db[_0xce40('0x2b')][_0xce40('0x2d')](),db[_0xce40('0x2b')]['constructor'],function(){throw new Error(_0xce40('0x2e'));}],'path':path['join'](config[_0xce40('0x9')],_0xce40('0x25'),_0xce40('0x23')),'pattern':/\.js$/}});_0x38813e['up']({'migrations':_[_0xce40('0x2f')](_0x1b885b,function(_0x4f9e95){return _0x4f9e95+_0xce40('0x28');})})[_0xce40('0x20')](function(){return _0x409124[_0xce40('0x12')](0xc8)[_0xce40('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xce40('0x10')][_0xce40('0xb')]+_0xce40('0x30')+_['last'](_0x1b885b),'migrations':_[_0xce40('0x31')](_0x1b885b)});})['catch'](function(_0x384819){if(_0x384819 instanceof db[_0xce40('0x2b')][_0xce40('0x32')]){return _0x409124['status'](0xc8)[_0xce40('0x13')]({'output':_0xce40('0x33')});}else{return _0x409124['status'](0x1f4)[_0xce40('0x13')](_0x384819);}});}else{return _0x409124[_0xce40('0x12')](0xc8)['json']({'output':_0xce40('0x33')});}}; \ No newline at end of file +var _0x2878=['error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','index','version','query','fetch','latest','exports','status','json','origin','master'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2878,0x89));var _0x8287=function(_0x47f852,_0x106cdb){_0x47f852=_0x47f852-0x0;var _0xead19e=_0x2878[_0x47f852];return _0xead19e;};'use strict';var Umzug=require(_0x8287('0x0'));var path=require(_0x8287('0x1'));var fs=require('fs');var _=require(_0x8287('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x8287('0x3'));var exec=require('child_process')[_0x8287('0x4')];var db=require(_0x8287('0x5'))['db'];var config=require(_0x8287('0x6'));var pm2=require(_0x8287('0x7'));var logger=require(_0x8287('0x8'))('update');var git=require('simple-git')(config['root']);exports[_0x8287('0x9')]=function(_0x15f613,_0x23ba65){var _0x5f4f90={'current':module['exports'][_0x8287('0xa')],'phonebar':0x2};if(_0x15f613[_0x8287('0xb')]&&_0x15f613[_0x8287('0xb')]['latest']){return git[_0x8287('0xc')]()['tags'](function(_0x2bbdfe,_0x773672){_0x5f4f90[_0x8287('0xd')]=(_0x2bbdfe?module[_0x8287('0xe')]['version']:_0x773672[_0x8287('0xd')])||'2.0.0';return _0x23ba65[_0x8287('0xf')](0xc8)[_0x8287('0x10')](_0x5f4f90);});}else{return _0x23ba65[_0x8287('0xf')](0xc8)[_0x8287('0x10')](_0x5f4f90);}};exports[_0x8287('0xc')]=function(_0x54ae3d,_0x33e157){return git['fetch']([_0x8287('0x11'),_0x8287('0x12')],function(_0x1114a5){if(_0x1114a5){logger[_0x8287('0x13')](_0x1114a5);return _0x33e157['status'](0x1f4)[_0x8287('0x10')](_0x1114a5);}logger[_0x8287('0x14')](_0x8287('0x15'));return _0x33e157[_0x8287('0xf')](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x16')});});};exports[_0x8287('0x17')]=function(_0x534ef1,_0x25e36c){return git[_0x8287('0x17')]([_0x8287('0x18'),_0x8287('0x19')],function(_0x7d52df){if(_0x7d52df){logger[_0x8287('0x13')](_0x7d52df);return _0x25e36c[_0x8287('0xf')](0x1f4)[_0x8287('0x10')](_0x7d52df);}logger[_0x8287('0x14')](_0x8287('0x1a'));return _0x25e36c['status'](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x1b')});});};exports[_0x8287('0x1c')]=function(_0x58dc7b,_0x1e0c1e){exec(_0x8287('0x1d'),function(_0x53c991,_0x44d993,_0x30fbff){logger[_0x8287('0x14')](_0x44d993);logger[_0x8287('0x14')](_0x30fbff);if(_0x53c991){logger[_0x8287('0x13')](_0x53c991);return _0x1e0c1e[_0x8287('0xf')](0x1f4)['json'](_0x53c991);}return _0x1e0c1e[_0x8287('0xf')](0xc8)[_0x8287('0x10')]({'output':_0x44d993});});};exports['restart']=function(_0x249964,_0x3f0996){return pm2[_0x8287('0x1e')]('motion2')[_0x8287('0x1f')](function(_0xd0b9a0){logger[_0x8287('0x14')](_0x8287('0x20'),_0xd0b9a0);return _0x3f0996['status'](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x21')});})[_0x8287('0x22')](function(_0x3274ee){logger['error'](_0x3274ee);return _0x3f0996[_0x8287('0xf')](0x1f4)[_0x8287('0x10')](_0x3274ee);});};exports[_0x8287('0x23')]=function(_0x36a1af,_0xf21265){var _0x1ac6db=fs[_0x8287('0x24')](path[_0x8287('0x25')](config['root'],_0x8287('0x26'),_0x8287('0x23')));var _0x529cc0=[];for(var _0x1a7473=0x0;_0x1a7473<_0x1ac6db[_0x8287('0x27')];_0x1a7473++){var _0x3b197c=_0x1ac6db[_0x1a7473]['replace'](_0x8287('0x28'),'');if(compareVersions(module[_0x8287('0xe')][_0x8287('0xa')],_0x3b197c)===-0x1){_0x529cc0[_0x8287('0x29')](_0x3b197c);}}if(_0x529cc0[_0x8287('0x27')]){var _0x228390=_0x529cc0[_0x8287('0x2a')](compareVersions);var _0x21bccd=new Umzug({'storage':_0x8287('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x8287('0x2c'),'columnName':_0x8287('0xa')},'migrations':{'params':[db[_0x8287('0x2b')][_0x8287('0x2d')](),db[_0x8287('0x2b')][_0x8287('0x2e')],function(){throw new Error(_0x8287('0x2f'));}],'path':path[_0x8287('0x25')](config[_0x8287('0x30')],'server',_0x8287('0x23')),'pattern':/\.js$/}});_0x21bccd['up']({'migrations':_[_0x8287('0x31')](_0x228390,function(_0x14ef82){return _0x14ef82+_0x8287('0x28');})})[_0x8287('0x1f')](function(){return _0xf21265['status'](0xc8)[_0x8287('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x8287('0xa')]+_0x8287('0x32')+_['last'](_0x228390),'migrations':_[_0x8287('0x25')](_0x228390)});})[_0x8287('0x22')](function(_0x3b1ae4){if(_0x3b1ae4 instanceof db[_0x8287('0x2b')]['UniqueConstraintError']){return _0xf21265[_0x8287('0xf')](0xc8)['json']({'output':_0x8287('0x33')});}else{return _0xf21265[_0x8287('0xf')](0x1f4)[_0x8287('0x10')](_0x3b1ae4);}});}else{return _0xf21265[_0x8287('0xf')](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9de2362..b45ab30 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 _0x2910=['Router','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','express'];(function(_0x56cc28,_0x4a921e){var _0x1f5798=function(_0x45f7a5){while(--_0x45f7a5){_0x56cc28['push'](_0x56cc28['shift']());}};_0x1f5798(++_0x4a921e);}(_0x2910,0x11d));var _0x0291=function(_0x1ca907,_0x318ca2){_0x1ca907=_0x1ca907-0x0;var _0x4eb2c1=_0x2910[_0x1ca907];return _0x4eb2c1;};'use strict';var multer=require(_0x0291('0x0'));var util=require(_0x0291('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0291('0x2'));var router=express[_0x0291('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x0291('0x4')](),controller[_0x0291('0x5')]);router[_0x0291('0x6')](_0x0291('0x7'),auth['isAuthenticated'](),controller[_0x0291('0x8')]);router[_0x0291('0x6')](_0x0291('0x9'),auth[_0x0291('0x4')](),controller['show']);router[_0x0291('0xa')]('/',auth[_0x0291('0x4')](),controller[_0x0291('0xb')]);router[_0x0291('0xc')](_0x0291('0x9'),auth[_0x0291('0x4')](),controller['update']);router[_0x0291('0xd')](_0x0291('0x9'),auth[_0x0291('0x4')](),controller[_0x0291('0xe')]);module[_0x0291('0xf')]=router; \ No newline at end of file +var _0x4d5e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x155a36,_0x4bf39){var _0x3c99d0=function(_0x2ff601){while(--_0x2ff601){_0x155a36['push'](_0x155a36['shift']());}};_0x3c99d0(++_0x4bf39);}(_0x4d5e,0x15e));var _0xe4d5=function(_0x573365,_0x1538c8){_0x573365=_0x573365-0x0;var _0x232050=_0x4d5e[_0x573365];return _0x232050;};'use strict';var multer=require(_0xe4d5('0x0'));var util=require(_0xe4d5('0x1'));var path=require('path');var timeout=require(_0xe4d5('0x2'));var express=require(_0xe4d5('0x3'));var router=express[_0xe4d5('0x4')]();var fs_extra=require(_0xe4d5('0x5'));var auth=require(_0xe4d5('0x6'));var interaction=require(_0xe4d5('0x7'));var config=require(_0xe4d5('0x8'));var controller=require('./voiceAgentReport.controller');router[_0xe4d5('0x9')]('/',auth[_0xe4d5('0xa')](),controller[_0xe4d5('0xb')]);router[_0xe4d5('0x9')]('/describe',auth[_0xe4d5('0xa')](),controller[_0xe4d5('0xc')]);router[_0xe4d5('0x9')](_0xe4d5('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4d5('0xe')]('/',auth[_0xe4d5('0xa')](),controller[_0xe4d5('0xf')]);router[_0xe4d5('0x10')](_0xe4d5('0xd'),auth['isAuthenticated'](),controller[_0xe4d5('0x11')]);router[_0xe4d5('0x12')](_0xe4d5('0xd'),auth[_0xe4d5('0xa')](),controller[_0xe4d5('0x13')]);module[_0xe4d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 4717b5e..1a93fc6 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 _0x373d=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER'];(function(_0x384ee3,_0x543d6b){var _0x1d78fc=function(_0x3bf41c){while(--_0x3bf41c){_0x384ee3['push'](_0x384ee3['shift']());}};_0x1d78fc(++_0x543d6b);}(_0x373d,0x1e2));var _0xd373=function(_0x9a62de,_0x127f28){_0x9a62de=_0x9a62de-0x0;var _0x14d7b3=_0x373d[_0x9a62de];return _0x14d7b3;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'type':{'type':Sequelize[_0xd373('0x1')]},'uniqueid':{'type':Sequelize[_0xd373('0x1')]},'calleridnum':{'type':Sequelize[_0xd373('0x1')]},'calleridname':{'type':Sequelize[_0xd373('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd373('0x1')]},'membername':{'type':Sequelize[_0xd373('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd373('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd373('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd373('0x2')]},'holdtime':{'type':Sequelize[_0xd373('0x3')]},'agentcomplete':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd373('0x1')]},'lastevent':{'type':Sequelize[_0xd373('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd373('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd373('0x1')]},'accountcode':{'type':Sequelize[_0xd373('0x1')]},'context':{'type':Sequelize[_0xd373('0x1')]},'exten':{'type':Sequelize[_0xd373('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd373('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd373('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd373('0x1')]},'destlanguage':{'type':Sequelize[_0xd373('0x1')]},'destaccountcode':{'type':Sequelize[_0xd373('0x1')]},'destcontext':{'type':Sequelize[_0xd373('0x1')]},'destexten':{'type':Sequelize[_0xd373('0x1')]},'destpriority':{'type':Sequelize[_0xd373('0x1')]},'destuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd373('0x1')]},'transfer':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd373('0x1')],'comment':_0xd373('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd373('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6a2=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x179b80,_0x440291){var _0x1e8d03=function(_0x466a71){while(--_0x466a71){_0x179b80['push'](_0x179b80['shift']());}};_0x1e8d03(++_0x440291);}(_0xc6a2,0x69));var _0x2c6a=function(_0xc32101,_0xf70d3){_0xc32101=_0xc32101-0x0;var _0x562c60=_0xc6a2[_0xc32101];return _0x562c60;};'use strict';var Sequelize=require(_0x2c6a('0x0'));module[_0x2c6a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2c6a('0x2')]},'calleridnum':{'type':Sequelize[_0x2c6a('0x2')]},'calleridname':{'type':Sequelize[_0x2c6a('0x2')]},'queue':{'type':Sequelize[_0x2c6a('0x2')]},'interface':{'type':Sequelize[_0x2c6a('0x2')]},'membername':{'type':Sequelize[_0x2c6a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2c6a('0x3')]},'holdtime':{'type':Sequelize[_0x2c6a('0x4')]},'agentcomplete':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2c6a('0x4')]},'agentacw':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c6a('0x4')]},'reason':{'type':Sequelize[_0x2c6a('0x2')]},'lastevent':{'type':Sequelize[_0x2c6a('0x2')]},'channel':{'type':Sequelize[_0x2c6a('0x2')]},'channelstate':{'type':Sequelize[_0x2c6a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2c6a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2c6a('0x2')]},'accountcode':{'type':Sequelize[_0x2c6a('0x2')]},'context':{'type':Sequelize[_0x2c6a('0x2')]},'exten':{'type':Sequelize[_0x2c6a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2c6a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2c6a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2c6a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2c6a('0x2')]},'destaccountcode':{'type':Sequelize[_0x2c6a('0x2')]},'destcontext':{'type':Sequelize[_0x2c6a('0x2')]},'destexten':{'type':Sequelize[_0x2c6a('0x2')]},'destpriority':{'type':Sequelize[_0x2c6a('0x2')]},'destuniqueid':{'type':Sequelize[_0x2c6a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2c6a('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x2c6a('0x2')]},'transfer':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2c6a('0x6')},'transferexten':{'type':Sequelize[_0x2c6a('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x2c6a('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 d8e80c1..213b73f 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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 131870b..beb49e3 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 _0x7c09=['./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36cff4,_0x133430){var _0x48890a=function(_0x3501ed){while(--_0x3501ed){_0x36cff4['push'](_0x36cff4['shift']());}};_0x48890a(++_0x133430);}(_0x7c09,0x102));var _0x97c0=function(_0x17b78c,_0x1bb763){_0x17b78c=_0x17b78c-0x0;var _0xa8a172=_0x7c09[_0x17b78c];return _0xa8a172;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'fields':[_0x97c0('0xc'),_0x97c0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','destuniqueid'];(function(_0x22b202,_0x4006c8){var _0x3bc1a5=function(_0x6461c){while(--_0x6461c){_0x22b202['push'](_0x22b202['shift']());}};_0x3bc1a5(++_0x4006c8);}(_0x008c,0x188));var _0xc008=function(_0x458848,_0x2dcecd){_0x458848=_0x458848-0x0;var _0x20469e=_0x008c[_0x458848];return _0x20469e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceAgentReport',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc008('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 43737c5..b83ebf3 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 _0x7645=['options','raw','then','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','VoiceAgentReport','create','body'];(function(_0x2f7e39,_0x165135){var _0x466ee4=function(_0x49c8a7){while(--_0x49c8a7){_0x2f7e39['push'](_0x2f7e39['shift']());}};_0x466ee4(++_0x165135);}(_0x7645,0x145));var _0x5764=function(_0xf52166,_0x26e28e){_0xf52166=_0xf52166-0x0;var _0x40c7a1=_0x7645[_0xf52166];return _0x40c7a1;};'use strict';var _=require('lodash');var util=require(_0x5764('0x0'));var moment=require(_0x5764('0x1'));var BPromise=require(_0x5764('0x2'));var rs=require(_0x5764('0x3'));var fs=require('fs');var Redis=require(_0x5764('0x4'));var db=require(_0x5764('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5764('0x6'))(_0x5764('0x7'));var config=require(_0x5764('0x8'));var jayson=require(_0x5764('0x9'));var client=jayson[_0x5764('0xa')][_0x5764('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594023,_0x3b7fe9,_0x1b59f2){return new BPromise(function(_0x53291d,_0x57597c){return client[_0x5764('0xc')](_0x594023,_0x1b59f2)['then'](function(_0xbeacc5){logger[_0x5764('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x3b7fe9,_0x5764('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3b7fe9,_0x5764('0xe'),JSON[_0x5764('0xf')](_0xbeacc5));if(_0xbeacc5['error']){if(_0xbeacc5[_0x5764('0x10')][_0x5764('0x11')]===0x1f4){logger[_0x5764('0x10')](_0x5764('0x12'),_0x3b7fe9,_0xbeacc5[_0x5764('0x10')][_0x5764('0x13')]);return _0x57597c(_0xbeacc5[_0x5764('0x10')][_0x5764('0x13')]);}logger[_0x5764('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x3b7fe9,_0xbeacc5[_0x5764('0x10')][_0x5764('0x13')]);return _0x53291d(_0xbeacc5[_0x5764('0x10')][_0x5764('0x13')]);}else{logger[_0x5764('0xd')](_0x5764('0x12'),_0x3b7fe9,_0x5764('0xe'));_0x53291d(_0xbeacc5[_0x5764('0x14')][_0x5764('0x13')]);}})[_0x5764('0x15')](function(_0x216309){logger[_0x5764('0x10')](_0x5764('0x12'),_0x3b7fe9,_0x216309);_0x57597c(_0x216309);});});}exports['CreateVoiceAgentReport']=function(_0x5dd3da){var _0x2fe9d4=this;return new Promise(function(_0x39dd4c,_0x505457){return db[_0x5764('0x16')][_0x5764('0x17')](_0x5dd3da[_0x5764('0x18')],{'raw':_0x5dd3da[_0x5764('0x19')]?_0x5dd3da[_0x5764('0x19')][_0x5764('0x1a')]===undefined?!![]:![]:!![]})[_0x5764('0x1b')](function(_0x1a0412){logger[_0x5764('0xd')](_0x5764('0x1c'),_0x5dd3da);logger[_0x5764('0x1d')]('CreateVoiceAgentReport',_0x5dd3da,JSON[_0x5764('0xf')](_0x1a0412));_0x39dd4c(_0x1a0412);})[_0x5764('0x15')](function(_0x549cdf){logger['error'](_0x5764('0x1c'),_0x549cdf['message'],_0x5dd3da);_0x505457(_0x2fe9d4[_0x5764('0x10')](0x1f4,_0x549cdf[_0x5764('0x13')]));});});};exports[_0x5764('0x1e')]=function(_0x1930b6){var _0x367a7c=this;return new Promise(function(_0x55e0bd,_0x20fc21){return db[_0x5764('0x16')][_0x5764('0x1f')](_0x1930b6[_0x5764('0x18')],{'raw':_0x1930b6['options']?_0x1930b6['options'][_0x5764('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1930b6[_0x5764('0x19')]?_0x1930b6['options'][_0x5764('0x20')]||null:null,'attributes':_0x1930b6[_0x5764('0x19')]?_0x1930b6['options'][_0x5764('0x21')]||null:null,'limit':_0x1930b6[_0x5764('0x19')]?_0x1930b6['options'][_0x5764('0x22')]||null:null})['then'](function(_0x55b4b0){logger[_0x5764('0xd')](_0x5764('0x1e'),_0x1930b6);logger['debug'](_0x5764('0x1e'),_0x1930b6,JSON[_0x5764('0xf')](_0x55b4b0));_0x55e0bd(_0x55b4b0);})[_0x5764('0x15')](function(_0x18ef44){logger[_0x5764('0x10')](_0x5764('0x1e'),_0x18ef44[_0x5764('0x13')],_0x1930b6);_0x20fc21(_0x367a7c[_0x5764('0x10')](0x1f4,_0x18ef44[_0x5764('0x13')]));});});}; \ No newline at end of file +var _0xa057=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','limit','util'];(function(_0xb303a0,_0x4b75ae){var _0x5e8e40=function(_0x3aa03b){while(--_0x3aa03b){_0xb303a0['push'](_0xb303a0['shift']());}};_0x5e8e40(++_0x4b75ae);}(_0xa057,0x116));var _0x7a05=function(_0x3cfcf4,_0x51a565){_0x3cfcf4=_0x3cfcf4-0x0;var _0x36924e=_0xa057[_0x3cfcf4];return _0x36924e;};'use strict';var _=require('lodash');var util=require(_0x7a05('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7a05('0x1'));var fs=require('fs');var Redis=require(_0x7a05('0x2'));var db=require(_0x7a05('0x3'))['db'];var utils=require(_0x7a05('0x4'));var logger=require(_0x7a05('0x5'))(_0x7a05('0x6'));var config=require(_0x7a05('0x7'));var jayson=require(_0x7a05('0x8'));var client=jayson[_0x7a05('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e66c6,_0x128f98,_0x36c975){return new BPromise(function(_0x483327,_0x25e35d){return client[_0x7a05('0xa')](_0x1e66c6,_0x36c975)[_0x7a05('0xb')](function(_0x3b329d){logger[_0x7a05('0xc')](_0x7a05('0xd'),_0x128f98,_0x7a05('0xe'));logger[_0x7a05('0xf')](_0x7a05('0x10'),_0x128f98,_0x7a05('0xe'),JSON[_0x7a05('0x11')](_0x3b329d));if(_0x3b329d[_0x7a05('0x12')]){if(_0x3b329d[_0x7a05('0x12')][_0x7a05('0x13')]===0x1f4){logger[_0x7a05('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x128f98,_0x3b329d[_0x7a05('0x12')][_0x7a05('0x14')]);return _0x25e35d(_0x3b329d[_0x7a05('0x12')][_0x7a05('0x14')]);}logger[_0x7a05('0x12')](_0x7a05('0xd'),_0x128f98,_0x3b329d['error']['message']);return _0x483327(_0x3b329d[_0x7a05('0x12')]['message']);}else{logger[_0x7a05('0xc')](_0x7a05('0xd'),_0x128f98,_0x7a05('0xe'));_0x483327(_0x3b329d['result'][_0x7a05('0x14')]);}})[_0x7a05('0x15')](function(_0x4b0ff6){logger[_0x7a05('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x128f98,_0x4b0ff6);_0x25e35d(_0x4b0ff6);});});}exports['CreateVoiceAgentReport']=function(_0x53510f){var _0x3f4eb8=this;return new Promise(function(_0x241bf,_0x3e9626){return db[_0x7a05('0x16')][_0x7a05('0x17')](_0x53510f['body'],{'raw':_0x53510f[_0x7a05('0x18')]?_0x53510f[_0x7a05('0x18')][_0x7a05('0x19')]===undefined?!![]:![]:!![]})[_0x7a05('0xb')](function(_0x424ad0){logger[_0x7a05('0xc')](_0x7a05('0x1a'),_0x53510f);logger[_0x7a05('0xf')](_0x7a05('0x1a'),_0x53510f,JSON[_0x7a05('0x11')](_0x424ad0));_0x241bf(_0x424ad0);})['catch'](function(_0x676898){logger[_0x7a05('0x12')](_0x7a05('0x1a'),_0x676898[_0x7a05('0x14')],_0x53510f);_0x3e9626(_0x3f4eb8[_0x7a05('0x12')](0x1f4,_0x676898[_0x7a05('0x14')]));});});};exports[_0x7a05('0x1b')]=function(_0x52d2e4){var _0x5dbe5f=this;return new Promise(function(_0x3e02cf,_0x143782){return db['VoiceAgentReport'][_0x7a05('0x1c')](_0x52d2e4['body'],{'raw':_0x52d2e4['options']?_0x52d2e4[_0x7a05('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d2e4[_0x7a05('0x18')]?_0x52d2e4[_0x7a05('0x18')]['where']||null:null,'attributes':_0x52d2e4[_0x7a05('0x18')]?_0x52d2e4[_0x7a05('0x18')][_0x7a05('0x1d')]||null:null,'limit':_0x52d2e4[_0x7a05('0x18')]?_0x52d2e4[_0x7a05('0x18')][_0x7a05('0x1e')]||null:null})[_0x7a05('0xb')](function(_0x5986dd){logger['info'](_0x7a05('0x1b'),_0x52d2e4);logger['debug'](_0x7a05('0x1b'),_0x52d2e4,JSON[_0x7a05('0x11')](_0x5986dd));_0x3e02cf(_0x5986dd);})['catch'](function(_0x390801){logger['error'](_0x7a05('0x1b'),_0x390801[_0x7a05('0x14')],_0x52d2e4);_0x143782(_0x5dbe5f[_0x7a05('0x12')](0x1f4,_0x390801['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e92b81f..3ab1793 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 _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x893f35,_0x14c6f8){_0x893f35=_0x893f35-0x0;var _0x20a4c7=_0xdbf5[_0x893f35];return _0x20a4c7;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router; \ No newline at end of file +var _0x303a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports','multer','path'];(function(_0x2f46f8,_0x197276){var _0x36f656=function(_0x4e46a7){while(--_0x4e46a7){_0x2f46f8['push'](_0x2f46f8['shift']());}};_0x36f656(++_0x197276);}(_0x303a,0x1a0));var _0xa303=function(_0x5ec21d,_0x5d0772){_0x5ec21d=_0x5ec21d-0x0;var _0x43bde8=_0x303a[_0x5ec21d];return _0x43bde8;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller['show']);router[_0xa303('0xe')]('/',auth['isAuthenticated'](),controller[_0xa303('0xf')]);router['put'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller[_0xa303('0x10')]);router[_0xa303('0x11')]('/:id',auth[_0xa303('0xa')](),controller['destroy']);module[_0xa303('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 35ad856..ade0c01 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 _0xaebe=['internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xaebe,0xed));var _0xeaeb=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xaebe[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0xeaeb('0x0'));module[_0xeaeb('0x1')]={'uniqueid':{'type':Sequelize[_0xeaeb('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0xeaeb('0x3'),_0xeaeb('0x4'),_0xeaeb('0x5'),_0xeaeb('0x6'),'dialer')},'tag':{'type':Sequelize[_0xeaeb('0x2')]},'accountcode':{'type':Sequelize[_0xeaeb('0x2')]},'source':{'type':Sequelize[_0xeaeb('0x2')]},'destination':{'type':Sequelize[_0xeaeb('0x2')]},'destinationcontext':{'type':Sequelize[_0xeaeb('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeaeb('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xeaeb('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xeaeb('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xeaeb('0x8')]},'duration':{'type':Sequelize[_0xeaeb('0x9')]},'billableseconds':{'type':Sequelize[_0xeaeb('0x9')]},'mohtime':{'type':Sequelize[_0xeaeb('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xeaeb('0x2')]},'amaflags':{'type':Sequelize[_0xeaeb('0x2')]},'userfield':{'type':Sequelize[_0xeaeb('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xeaeb('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xeaeb('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xeaeb('0x2')]}}; \ No newline at end of file +var _0xe9b4=['outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe9b4,0x1f1));var _0x4e9b=function(_0x42f0b9,_0x410ade){_0x42f0b9=_0x42f0b9-0x0;var _0x29dc58=_0xe9b4[_0x42f0b9];return _0x29dc58;};'use strict';var Sequelize=require('sequelize');module[_0x4e9b('0x0')]={'uniqueid':{'type':Sequelize[_0x4e9b('0x1')]},'type':{'type':Sequelize[_0x4e9b('0x2')](_0x4e9b('0x3'),_0x4e9b('0x4'),_0x4e9b('0x5'),_0x4e9b('0x6'),_0x4e9b('0x7'),_0x4e9b('0x8'))},'tag':{'type':Sequelize[_0x4e9b('0x1')]},'accountcode':{'type':Sequelize[_0x4e9b('0x1')]},'source':{'type':Sequelize[_0x4e9b('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4e9b('0x1')]},'channel':{'type':Sequelize[_0x4e9b('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4e9b('0x1')]},'lastdata':{'type':Sequelize[_0x4e9b('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4e9b('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4e9b('0xa')]},'duration':{'type':Sequelize[_0x4e9b('0xb')]},'billableseconds':{'type':Sequelize[_0x4e9b('0xb')]},'mohtime':{'type':Sequelize[_0x4e9b('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4e9b('0x1')]},'amaflags':{'type':Sequelize[_0x4e9b('0x1')]},'userfield':{'type':Sequelize[_0x4e9b('0x1')]},'userDisposition':{'type':Sequelize[_0x4e9b('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x4e9b('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x4e9b('0x1')]},'note':{'type':Sequelize[_0x4e9b('0x1')]},'prefix':{'type':Sequelize[_0x4e9b('0x1')]},'routeid':{'type':Sequelize[_0x4e9b('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3277a78..c3cff79 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x57163b,_0x41db5f){var _0x13c1ea=function(_0x8a7f7){while(--_0x8a7f7){_0x57163b['push'](_0x57163b['shift']());}};_0x13c1ea(++_0x41db5f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x0b0e[_0x57f345];return _0x255e43;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _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(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0xadb5,0xad));var _0x5adb=function(_0x4bcc07,_0x5ce2b0){_0x4bcc07=_0x4bcc07-0x0;var _0x1766f6=_0xadb5[_0x4bcc07];return _0x1766f6;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1f4da2d..8d591d6 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 _0x7d4c=['define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','bluebird','rimraf','./voiceCallReport.attributes'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0x7d4c,0x1c5));var _0xc7d4=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x7d4c[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require(_0xc7d4('0x0'));var util=require(_0xc7d4('0x1'));var logger=require(_0xc7d4('0x2'))(_0xc7d4('0x3'));var moment=require('moment');var BPromise=require(_0xc7d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc7d4('0x5'));var config=require('../../config/environment');var attributes=require(_0xc7d4('0x6'));module['exports']=function(_0x1ff76f,_0x4a894c){return _0x1ff76f[_0xc7d4('0x7')](_0xc7d4('0x8'),attributes,{'tableName':_0xc7d4('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x372d=['uniqueid','lodash','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x1c4d99,_0x1f4246){var _0xffb0c9=function(_0x4e82b2){while(--_0x4e82b2){_0x1c4d99['push'](_0x1c4d99['shift']());}};_0xffb0c9(++_0x1f4246);}(_0x372d,0x182));var _0xd372=function(_0x370704,_0x3b111b){_0x370704=_0x370704-0x0;var _0x193d59=_0x372d[_0x370704];return _0x193d59;};'use strict';var _=require(_0xd372('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd372('0x1'));var moment=require(_0xd372('0x2'));var BPromise=require('bluebird');var rp=require(_0xd372('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd372('0x4'));var config=require(_0xd372('0x5'));var attributes=require(_0xd372('0x6'));module[_0xd372('0x7')]=function(_0x261e4a,_0x123838){return _0x261e4a['define'](_0xd372('0x8'),attributes,{'tableName':_0xd372('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd372('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 11fbfc3..ad3309a 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 _0x5a73=['debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3fbfd8,_0x50fd0f){var _0x2fe839=function(_0x4634d5){while(--_0x4634d5){_0x3fbfd8['push'](_0x3fbfd8['shift']());}};_0x2fe839(++_0x50fd0f);}(_0x5a73,0x1cf));var _0x35a7=function(_0x550d2d,_0x17e89b){_0x550d2d=_0x550d2d-0x0;var _0x8c4a8d=_0x5a73[_0x550d2d];return _0x8c4a8d;};'use strict';var _=require('lodash');var util=require(_0x35a7('0x0'));var moment=require(_0x35a7('0x1'));var BPromise=require(_0x35a7('0x2'));var rs=require(_0x35a7('0x3'));var fs=require('fs');var Redis=require(_0x35a7('0x4'));var db=require(_0x35a7('0x5'))['db'];var utils=require(_0x35a7('0x6'));var logger=require('../../config/logger')(_0x35a7('0x7'));var config=require(_0x35a7('0x8'));var jayson=require(_0x35a7('0x9'));var client=jayson[_0x35a7('0xa')][_0x35a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e467f,_0x9e3021,_0x3d53e6){return new BPromise(function(_0x29fd88,_0x30257b){return client[_0x35a7('0xc')](_0x1e467f,_0x3d53e6)[_0x35a7('0xd')](function(_0x4f5434){logger[_0x35a7('0xe')](_0x35a7('0xf'),_0x9e3021,_0x35a7('0x10'));logger[_0x35a7('0x11')](_0x35a7('0x12'),_0x9e3021,_0x35a7('0x10'),JSON[_0x35a7('0x13')](_0x4f5434));if(_0x4f5434[_0x35a7('0x14')]){if(_0x4f5434[_0x35a7('0x14')][_0x35a7('0x15')]===0x1f4){logger[_0x35a7('0x14')](_0x35a7('0xf'),_0x9e3021,_0x4f5434[_0x35a7('0x14')][_0x35a7('0x16')]);return _0x30257b(_0x4f5434[_0x35a7('0x14')][_0x35a7('0x16')]);}logger['error'](_0x35a7('0xf'),_0x9e3021,_0x4f5434[_0x35a7('0x14')][_0x35a7('0x16')]);return _0x29fd88(_0x4f5434[_0x35a7('0x14')][_0x35a7('0x16')]);}else{logger['info'](_0x35a7('0xf'),_0x9e3021,_0x35a7('0x10'));_0x29fd88(_0x4f5434['result']['message']);}})[_0x35a7('0x17')](function(_0x10a7db){logger['error'](_0x35a7('0xf'),_0x9e3021,_0x10a7db);_0x30257b(_0x10a7db);});});}exports[_0x35a7('0x18')]=function(_0x53680d){var _0x37d55a=this;return new Promise(function(_0x47ac1c,_0x21ba34){return db[_0x35a7('0x19')][_0x35a7('0x1a')]({'raw':_0x53680d['options']?_0x53680d['options'][_0x35a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x53680d[_0x35a7('0x1c')]?_0x53680d[_0x35a7('0x1c')][_0x35a7('0x1d')]||null:null,'attributes':_0x53680d['options']?_0x53680d[_0x35a7('0x1c')][_0x35a7('0x1e')]||null:null,'limit':_0x53680d['options']?_0x53680d[_0x35a7('0x1c')][_0x35a7('0x1f')]||null:null,'include':_0x53680d[_0x35a7('0x1c')]?_0x53680d['options']['include']?_['map'](_0x53680d['options'][_0x35a7('0x20')],function(_0x425834){return{'model':db[_0x425834['model']],'as':_0x425834['as'],'attributes':_0x425834[_0x35a7('0x1e')],'include':_0x425834[_0x35a7('0x20')]?_['map'](_0x425834[_0x35a7('0x20')],function(_0x3ea3d3){return{'model':db[_0x3ea3d3['model']],'as':_0x3ea3d3['as'],'attributes':_0x3ea3d3['attributes'],'include':_0x3ea3d3[_0x35a7('0x20')]?_[_0x35a7('0x21')](_0x3ea3d3['include'],function(_0x54f22a){return{'model':db[_0x54f22a[_0x35a7('0x22')]],'as':_0x54f22a['as'],'attributes':_0x54f22a['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a7('0xd')](function(_0x133f1c){logger[_0x35a7('0xe')]('GetVoiceCallReport',_0x53680d);logger['debug'](_0x35a7('0x18'),_0x53680d,JSON['stringify'](_0x133f1c));_0x47ac1c(_0x133f1c);})[_0x35a7('0x17')](function(_0x3ced69){logger[_0x35a7('0x14')](_0x35a7('0x18'),_0x3ced69[_0x35a7('0x16')],_0x53680d);_0x21ba34(_0x37d55a[_0x35a7('0x14')](0x1f4,_0x3ced69[_0x35a7('0x16')]));});});};exports[_0x35a7('0x23')]=function(_0x59a0d0){var _0x59716e=this;return new Promise(function(_0x2a3e7e,_0x225ae4){return db[_0x35a7('0x19')][_0x35a7('0x24')](_0x59a0d0['body'],{'raw':_0x59a0d0[_0x35a7('0x1c')]?_0x59a0d0['options'][_0x35a7('0x1b')]===undefined?!![]:![]:!![]})[_0x35a7('0xd')](function(_0x5d4df0){logger['info'](_0x35a7('0x23'),_0x59a0d0);logger[_0x35a7('0x11')](_0x35a7('0x23'),_0x59a0d0,JSON[_0x35a7('0x13')](_0x5d4df0));_0x2a3e7e(_0x5d4df0);})[_0x35a7('0x17')](function(_0x3ec574){logger[_0x35a7('0x14')](_0x35a7('0x23'),_0x3ec574[_0x35a7('0x16')],_0x59a0d0);_0x225ae4(_0x59716e[_0x35a7('0x14')](0x1f4,_0x3ec574['message']));});});};exports[_0x35a7('0x25')]=function(_0x5bf883){var _0x30e787=this;return new Promise(function(_0xe5ec8f,_0x3614db){return db[_0x35a7('0x19')][_0x35a7('0x26')](_0x5bf883[_0x35a7('0x27')],{'raw':_0x5bf883[_0x35a7('0x1c')]?_0x5bf883['options'][_0x35a7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf883['options']?_0x5bf883[_0x35a7('0x1c')][_0x35a7('0x1d')]||null:null,'attributes':_0x5bf883[_0x35a7('0x1c')]?_0x5bf883[_0x35a7('0x1c')][_0x35a7('0x1e')]||null:null,'limit':_0x5bf883['options']?_0x5bf883[_0x35a7('0x1c')]['limit']||null:null})[_0x35a7('0xd')](function(_0x172d06){logger['info'](_0x35a7('0x25'),_0x5bf883);logger[_0x35a7('0x11')](_0x35a7('0x25'),_0x5bf883,JSON[_0x35a7('0x13')](_0x172d06));_0xe5ec8f(_0x172d06);})[_0x35a7('0x17')](function(_0x5b003c){logger[_0x35a7('0x14')](_0x35a7('0x25'),_0x5b003c[_0x35a7('0x16')],_0x5bf883);_0x3614db(_0x30e787[_0x35a7('0x14')](0x1f4,_0x5b003c[_0x35a7('0x16')]));});});}; \ No newline at end of file +var _0xfa81=['VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetVoiceCallReport'];(function(_0x41805e,_0x3e14a0){var _0x17c141=function(_0x11a6a7){while(--_0x11a6a7){_0x41805e['push'](_0x41805e['shift']());}};_0x17c141(++_0x3e14a0);}(_0xfa81,0x112));var _0x1fa8=function(_0x2c6b4b,_0x260e7a){_0x2c6b4b=_0x2c6b4b-0x0;var _0x569863=_0xfa81[_0x2c6b4b];return _0x569863;};'use strict';var _=require(_0x1fa8('0x0'));var util=require(_0x1fa8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fa8('0x2'));var db=require(_0x1fa8('0x3'))['db'];var utils=require(_0x1fa8('0x4'));var logger=require(_0x1fa8('0x5'))(_0x1fa8('0x6'));var config=require(_0x1fa8('0x7'));var jayson=require(_0x1fa8('0x8'));var client=jayson[_0x1fa8('0x9')][_0x1fa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c719,_0x19ffdc,_0x11dca1){return new BPromise(function(_0x122750,_0x374a05){return client[_0x1fa8('0xb')](_0x58c719,_0x11dca1)[_0x1fa8('0xc')](function(_0x38407a){logger['info'](_0x1fa8('0xd'),_0x19ffdc,_0x1fa8('0xe'));logger[_0x1fa8('0xf')](_0x1fa8('0x10'),_0x19ffdc,_0x1fa8('0xe'),JSON['stringify'](_0x38407a));if(_0x38407a['error']){if(_0x38407a[_0x1fa8('0x11')]['code']===0x1f4){logger[_0x1fa8('0x11')](_0x1fa8('0xd'),_0x19ffdc,_0x38407a[_0x1fa8('0x11')][_0x1fa8('0x12')]);return _0x374a05(_0x38407a[_0x1fa8('0x11')][_0x1fa8('0x12')]);}logger['error'](_0x1fa8('0xd'),_0x19ffdc,_0x38407a[_0x1fa8('0x11')][_0x1fa8('0x12')]);return _0x122750(_0x38407a[_0x1fa8('0x11')]['message']);}else{logger[_0x1fa8('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x19ffdc,_0x1fa8('0xe'));_0x122750(_0x38407a['result'][_0x1fa8('0x12')]);}})[_0x1fa8('0x14')](function(_0x594df7){logger[_0x1fa8('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x19ffdc,_0x594df7);_0x374a05(_0x594df7);});});}exports[_0x1fa8('0x15')]=function(_0x3957fa){var _0x1e9bb5=this;return new Promise(function(_0x12e531,_0x27d260){return db[_0x1fa8('0x16')][_0x1fa8('0x17')]({'raw':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3957fa['options']?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x19')]||null:null,'attributes':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x1a')]||null:null,'limit':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x1b')]||null:null,'include':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x1c')]?_[_0x1fa8('0x1d')](_0x3957fa['options'][_0x1fa8('0x1c')],function(_0x34cd87){return{'model':db[_0x34cd87[_0x1fa8('0x1e')]],'as':_0x34cd87['as'],'attributes':_0x34cd87[_0x1fa8('0x1a')],'include':_0x34cd87[_0x1fa8('0x1c')]?_[_0x1fa8('0x1d')](_0x34cd87[_0x1fa8('0x1c')],function(_0x2b21db){return{'model':db[_0x2b21db[_0x1fa8('0x1e')]],'as':_0x2b21db['as'],'attributes':_0x2b21db[_0x1fa8('0x1a')],'include':_0x2b21db['include']?_[_0x1fa8('0x1d')](_0x2b21db[_0x1fa8('0x1c')],function(_0x49be73){return{'model':db[_0x49be73[_0x1fa8('0x1e')]],'as':_0x49be73['as'],'attributes':_0x49be73[_0x1fa8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1fa8('0xc')](function(_0x53768b){logger[_0x1fa8('0x13')](_0x1fa8('0x15'),_0x3957fa);logger['debug'](_0x1fa8('0x15'),_0x3957fa,JSON[_0x1fa8('0x1f')](_0x53768b));_0x12e531(_0x53768b);})[_0x1fa8('0x14')](function(_0x50e6d1){logger[_0x1fa8('0x11')]('GetVoiceCallReport',_0x50e6d1[_0x1fa8('0x12')],_0x3957fa);_0x27d260(_0x1e9bb5['error'](0x1f4,_0x50e6d1[_0x1fa8('0x12')]));});});};exports[_0x1fa8('0x20')]=function(_0x3c0b2f){var _0x2014aa=this;return new Promise(function(_0x68a692,_0x52187e){return db['VoiceCallReport'][_0x1fa8('0x21')](_0x3c0b2f[_0x1fa8('0x22')],{'raw':_0x3c0b2f['options']?_0x3c0b2f[_0x1fa8('0x18')][_0x1fa8('0x23')]===undefined?!![]:![]:!![]})[_0x1fa8('0xc')](function(_0x1e1686){logger[_0x1fa8('0x13')](_0x1fa8('0x20'),_0x3c0b2f);logger[_0x1fa8('0xf')](_0x1fa8('0x20'),_0x3c0b2f,JSON[_0x1fa8('0x1f')](_0x1e1686));_0x68a692(_0x1e1686);})[_0x1fa8('0x14')](function(_0x2ec91d){logger[_0x1fa8('0x11')]('CreateVoiceCallReport',_0x2ec91d['message'],_0x3c0b2f);_0x52187e(_0x2014aa[_0x1fa8('0x11')](0x1f4,_0x2ec91d[_0x1fa8('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x95e447){var _0x17345f=this;return new Promise(function(_0x1d6805,_0x26cddc){return db[_0x1fa8('0x16')]['update'](_0x95e447['body'],{'raw':_0x95e447[_0x1fa8('0x18')]?_0x95e447[_0x1fa8('0x18')][_0x1fa8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95e447[_0x1fa8('0x18')]?_0x95e447[_0x1fa8('0x18')][_0x1fa8('0x19')]||null:null,'attributes':_0x95e447['options']?_0x95e447[_0x1fa8('0x18')][_0x1fa8('0x1a')]||null:null,'limit':_0x95e447[_0x1fa8('0x18')]?_0x95e447['options'][_0x1fa8('0x1b')]||null:null})[_0x1fa8('0xc')](function(_0x4b122f){logger['info']('UpdateVoiceCallReport',_0x95e447);logger[_0x1fa8('0xf')]('UpdateVoiceCallReport',_0x95e447,JSON[_0x1fa8('0x1f')](_0x4b122f));_0x1d6805(_0x4b122f);})['catch'](function(_0x3d750f){logger[_0x1fa8('0x11')](_0x1fa8('0x24'),_0x3d750f[_0x1fa8('0x12')],_0x95e447);_0x26cddc(_0x17345f[_0x1fa8('0x11')](0x1f4,_0x3d750f[_0x1fa8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9bce549..f7627e2 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 _0x918a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x918a,0x1e0));var _0xa918=function(_0x50bca7,_0xd33575){_0x50bca7=_0x50bca7-0x0;var _0x727911=_0x918a[_0x50bca7];return _0x727911;};'use strict';var multer=require('multer');var util=require(_0xa918('0x0'));var path=require(_0xa918('0x1'));var timeout=require(_0xa918('0x2'));var express=require(_0xa918('0x3'));var router=express[_0xa918('0x4')]();var fs_extra=require(_0xa918('0x5'));var auth=require(_0xa918('0x6'));var interaction=require(_0xa918('0x7'));var config=require(_0xa918('0x8'));var controller=require(_0xa918('0x9'));router[_0xa918('0xa')]('/',auth[_0xa918('0xb')](),controller[_0xa918('0xc')]);router[_0xa918('0xa')](_0xa918('0xd'),auth[_0xa918('0xb')](),controller[_0xa918('0xe')]);router[_0xa918('0xf')]('/',auth[_0xa918('0xb')](),controller['create']);router[_0xa918('0x10')](_0xa918('0xd'),auth[_0xa918('0xb')](),controller['update']);router[_0xa918('0x11')](_0xa918('0xd'),auth[_0xa918('0xb')](),controller[_0xa918('0x12')]);module[_0xa918('0x13')]=router; \ No newline at end of file +var _0xe281=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xe281,0xfd));var _0x1e28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe281[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1e28('0x0'));var util=require(_0x1e28('0x1'));var path=require(_0x1e28('0x2'));var timeout=require(_0x1e28('0x3'));var express=require(_0x1e28('0x4'));var router=express[_0x1e28('0x5')]();var fs_extra=require(_0x1e28('0x6'));var auth=require(_0x1e28('0x7'));var interaction=require(_0x1e28('0x8'));var config=require('../../config/environment');var controller=require(_0x1e28('0x9'));router[_0x1e28('0xa')]('/',auth['isAuthenticated'](),controller[_0x1e28('0xb')]);router['get']('/:id',auth[_0x1e28('0xc')](),controller[_0x1e28('0xd')]);router[_0x1e28('0xe')]('/',auth[_0x1e28('0xc')](),controller['create']);router[_0x1e28('0xf')](_0x1e28('0x10'),auth['isAuthenticated'](),controller[_0x1e28('0x11')]);router[_0x1e28('0x12')](_0x1e28('0x10'),auth['isAuthenticated'](),controller[_0x1e28('0x13')]);module[_0x1e28('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 0d49524..b39c5bf 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 _0xc16d=['getDataValue','BOOLEAN','sequelize','exports','STRING','name','options','join'];(function(_0xfdc4b8,_0x5ab2fe){var _0x910764=function(_0x2d159e){while(--_0x2d159e){_0xfdc4b8['push'](_0xfdc4b8['shift']());}};_0x910764(++_0x5ab2fe);}(_0xc16d,0x8a));var _0xdc16=function(_0x4e0b6d,_0x2b0300){_0x4e0b6d=_0x4e0b6d-0x0;var _0x7dc2d5=_0xc16d[_0x4e0b6d];return _0x7dc2d5;};'use strict';var Sequelize=require(_0xdc16('0x0'));module[_0xdc16('0x1')]={'name':{'type':Sequelize[_0xdc16('0x2')]},'prefix':{'type':Sequelize[_0xdc16('0x2')],'unique':_0xdc16('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xdc16('0x2')],'set':function(_0x37a344){this['setDataValue'](_0xdc16('0x4'),_0x37a344?_0x37a344[_0xdc16('0x5')](''):[]);},'get':function(){return this[_0xdc16('0x6')](_0xdc16('0x4'))?this[_0xdc16('0x6')](_0xdc16('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0xdc16('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xdc16('0x2')]},'record':{'type':Sequelize[_0xdc16('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdc16('0x2')]}}; \ No newline at end of file +var _0x1ffe=['exports','name','STRING','setDataValue','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0x1ffe,0x1af));var _0xe1ff=function(_0x5c0e88,_0x33ed62){_0x5c0e88=_0x5c0e88-0x0;var _0x2b8713=_0x1ffe[_0x5c0e88];return _0x2b8713;};'use strict';var Sequelize=require(_0xe1ff('0x0'));module[_0xe1ff('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xe1ff('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xe1ff('0x3')],'set':function(_0xb7c499){this[_0xe1ff('0x4')](_0xe1ff('0x5'),_0xb7c499?_0xb7c499[_0xe1ff('0x6')](''):[]);},'get':function(){return this[_0xe1ff('0x7')]('options')?this[_0xe1ff('0x7')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xe1ff('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe1ff('0x3')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe1ff('0x3')]},'description':{'type':Sequelize[_0xe1ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 072c4c9..04df9a1 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 _0xbe31=['save','update','then','destroy','ChanSpies','UserProfileResource','error','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','options','VoiceChanSpy','includeAll','include','findAll','catch','show','params','rawAttributes','length','merge','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','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe31,0x83));var _0x1be3=function(_0x1f0214,_0x4f4f84){_0x1f0214=_0x1f0214-0x0;var _0x22650e=_0xbe31[_0x1f0214];return _0x22650e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1be3('0x0'));var zipdir=require(_0x1be3('0x1'));var jsonpatch=require(_0x1be3('0x2'));var rp=require(_0x1be3('0x3'));var moment=require(_0x1be3('0x4'));var BPromise=require(_0x1be3('0x5'));var Mustache=require(_0x1be3('0x6'));var util=require(_0x1be3('0x7'));var path=require(_0x1be3('0x8'));var sox=require('sox');var csv=require(_0x1be3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1be3('0xa'));var _=require(_0x1be3('0xb'));var squel=require(_0x1be3('0xc'));var crypto=require(_0x1be3('0xd'));var jsforce=require(_0x1be3('0xe'));var deskjs=require(_0x1be3('0xf'));var toCsv=require(_0x1be3('0x9'));var querystring=require(_0x1be3('0x10'));var Papa=require(_0x1be3('0x11'));var Redis=require(_0x1be3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1be3('0x13'));var as=require(_0x1be3('0x14'));var hardwareService=require(_0x1be3('0x15'));var logger=require(_0x1be3('0x16'))(_0x1be3('0x17'));var utils=require(_0x1be3('0x18'));var config=require(_0x1be3('0x19'));var licenseUtil=require(_0x1be3('0x1a'));var db=require(_0x1be3('0x1b'))['db'];function respondWithStatusCode(_0x50552d,_0x3601f7){_0x3601f7=_0x3601f7||0xcc;return function(_0x492f66){if(_0x492f66){return _0x50552d[_0x1be3('0x1c')](_0x3601f7);}return _0x50552d[_0x1be3('0x1d')](_0x3601f7)['end']();};}function respondWithResult(_0x26f888,_0x573684){_0x573684=_0x573684||0xc8;return function(_0xc7cc3){if(_0xc7cc3){return _0x26f888[_0x1be3('0x1d')](_0x573684)[_0x1be3('0x1e')](_0xc7cc3);}};}function respondWithFilteredResult(_0xd30cd,_0x1156bc){return function(_0x269ac3){if(_0x269ac3){var _0x567919=typeof _0x1156bc['offset']==='undefined'&&typeof _0x1156bc['limit']===_0x1be3('0x1f');var _0x4ebba6=_0x269ac3[_0x1be3('0x20')];var _0x6b7edf=_0x567919?0x0:_0x1156bc[_0x1be3('0x21')];var _0x1d0c2b=_0x567919?_0x269ac3[_0x1be3('0x20')]:_0x1156bc[_0x1be3('0x21')]+_0x1156bc[_0x1be3('0x22')];var _0x41c2af;if(_0x1d0c2b>=_0x4ebba6){_0x1d0c2b=_0x4ebba6;_0x41c2af=0xc8;}else{_0x41c2af=0xce;}_0xd30cd[_0x1be3('0x1d')](_0x41c2af);return _0xd30cd[_0x1be3('0x23')](_0x1be3('0x24'),_0x6b7edf+'-'+_0x1d0c2b+'/'+_0x4ebba6)[_0x1be3('0x1e')](_0x269ac3);}return null;};}function patchUpdates(_0x57c78c){return function(_0x49123f){try{jsonpatch[_0x1be3('0x25')](_0x49123f,_0x57c78c,!![]);}catch(_0x4cacb9){return BPromise[_0x1be3('0x26')](_0x4cacb9);}return _0x49123f[_0x1be3('0x27')]();};}function saveUpdates(_0x4366e8,_0x3bd167){return function(_0x3c0564){if(_0x3c0564){return _0x3c0564[_0x1be3('0x28')](_0x4366e8)[_0x1be3('0x29')](function(_0x57c192){return _0x57c192;});}return null;};}function removeEntity(_0x186b8a,_0x48862c){return function(_0x237a6c){if(_0x237a6c){return _0x237a6c[_0x1be3('0x2a')]()['then'](function(){var _0xe5346d=_0x237a6c['get']({'plain':!![]});var _0x134d79=_0x1be3('0x2b');return db[_0x1be3('0x2c')][_0x1be3('0x2a')]({'where':{'type':_0x134d79,'resourceId':_0xe5346d['id']}})['then'](function(){return _0x237a6c;});})[_0x1be3('0x29')](function(){_0x186b8a[_0x1be3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113cc4,_0x983a65){return function(_0x44da09){if(!_0x44da09){_0x113cc4[_0x1be3('0x1c')](0x194);}return _0x44da09;};}function handleError(_0x2ddac8,_0x38a6de){_0x38a6de=_0x38a6de||0x1f4;return function(_0x5d35cf){logger[_0x1be3('0x2d')](_0x5d35cf['stack']);if(_0x5d35cf[_0x1be3('0x2e')]){delete _0x5d35cf['name'];}_0x2ddac8[_0x1be3('0x1d')](_0x38a6de)[_0x1be3('0x2f')](_0x5d35cf);};}exports['index']=function(_0x5426aa,_0x49f780){var _0xf1b90={},_0x33eaa0={},_0x274660={'count':0x0,'rows':[]};var _0xc7fb9a=_[_0x1be3('0x30')](db['VoiceChanSpy']['rawAttributes'],function(_0x55c0cc){return{'name':_0x55c0cc['fieldName'],'type':_0x55c0cc[_0x1be3('0x31')][_0x1be3('0x32')]};});_0x33eaa0[_0x1be3('0x33')]=_[_0x1be3('0x30')](_0xc7fb9a,_0x1be3('0x2e'));_0x33eaa0[_0x1be3('0x34')]=_[_0x1be3('0x35')](_0x5426aa['query']);_0x33eaa0[_0x1be3('0x36')]=_[_0x1be3('0x37')](_0x33eaa0[_0x1be3('0x33')],_0x33eaa0[_0x1be3('0x34')]);_0xf1b90[_0x1be3('0x38')]=_[_0x1be3('0x37')](_0x33eaa0[_0x1be3('0x33')],qs['fields'](_0x5426aa[_0x1be3('0x34')][_0x1be3('0x39')]));_0xf1b90[_0x1be3('0x38')]=_0xf1b90['attributes']['length']?_0xf1b90[_0x1be3('0x38')]:_0x33eaa0[_0x1be3('0x33')];if(!_0x5426aa[_0x1be3('0x34')]['hasOwnProperty']('nolimit')){_0xf1b90['limit']=qs[_0x1be3('0x22')](_0x5426aa[_0x1be3('0x34')][_0x1be3('0x22')]);_0xf1b90['offset']=qs[_0x1be3('0x21')](_0x5426aa['query'][_0x1be3('0x21')]);}_0xf1b90[_0x1be3('0x3a')]=qs['sort'](_0x5426aa[_0x1be3('0x34')][_0x1be3('0x3b')]);_0xf1b90[_0x1be3('0x3c')]=qs[_0x1be3('0x36')](_[_0x1be3('0x3d')](_0x5426aa['query'],_0x33eaa0[_0x1be3('0x36')]),_0xc7fb9a);if(_0x5426aa[_0x1be3('0x34')][_0x1be3('0x3e')]){_0xf1b90['where']=_['merge'](_0xf1b90[_0x1be3('0x3c')],{'$or':_[_0x1be3('0x30')](_0xc7fb9a,function(_0x4f3db4){if(_0x4f3db4[_0x1be3('0x31')]!=='VIRTUAL'){var _0x2f254d={};_0x2f254d[_0x4f3db4[_0x1be3('0x2e')]]={'$like':'%'+_0x5426aa['query']['filter']+'%'};return _0x2f254d;}})});}_0xf1b90=_['merge']({},_0xf1b90,_0x5426aa[_0x1be3('0x3f')]);var _0x406e4f={'where':_0xf1b90[_0x1be3('0x3c')]};return db[_0x1be3('0x40')][_0x1be3('0x20')](_0x406e4f)['then'](function(_0x43b89d){_0x274660['count']=_0x43b89d;if(_0x5426aa[_0x1be3('0x34')][_0x1be3('0x41')]){_0xf1b90[_0x1be3('0x42')]=[{'all':!![]}];}return db[_0x1be3('0x40')][_0x1be3('0x43')](_0xf1b90);})['then'](function(_0x31ad7e){_0x274660['rows']=_0x31ad7e;return _0x274660;})[_0x1be3('0x29')](respondWithFilteredResult(_0x49f780,_0xf1b90))[_0x1be3('0x44')](handleError(_0x49f780,null));};exports[_0x1be3('0x45')]=function(_0x47c169,_0x267d59){var _0xceb4ed={'raw':![],'where':{'id':_0x47c169[_0x1be3('0x46')]['id']}},_0x3718c9={};_0x3718c9['model']=_['keys'](db[_0x1be3('0x40')][_0x1be3('0x47')]);_0x3718c9[_0x1be3('0x34')]=_[_0x1be3('0x35')](_0x47c169[_0x1be3('0x34')]);_0x3718c9['filters']=_[_0x1be3('0x37')](_0x3718c9['model'],_0x3718c9[_0x1be3('0x34')]);_0xceb4ed[_0x1be3('0x38')]=_['intersection'](_0x3718c9['model'],qs[_0x1be3('0x39')](_0x47c169['query']['fields']));_0xceb4ed[_0x1be3('0x38')]=_0xceb4ed[_0x1be3('0x38')][_0x1be3('0x48')]?_0xceb4ed[_0x1be3('0x38')]:_0x3718c9[_0x1be3('0x33')];if(_0x47c169['query'][_0x1be3('0x41')]){_0xceb4ed[_0x1be3('0x42')]=[{'all':!![]}];}_0xceb4ed=_[_0x1be3('0x49')]({},_0xceb4ed,_0x47c169['options']);return db[_0x1be3('0x40')][_0x1be3('0x4a')](_0xceb4ed)[_0x1be3('0x29')](handleEntityNotFound(_0x267d59,null))['then'](respondWithResult(_0x267d59,null))[_0x1be3('0x44')](handleError(_0x267d59,null));};exports[_0x1be3('0x4b')]=function(_0x5160b2,_0x495d2b){return db['VoiceChanSpy']['create'](_0x5160b2[_0x1be3('0x4c')],{})[_0x1be3('0x29')](function(_0x2c41a4){var _0x1a4485=_0x5160b2[_0x1be3('0x4d')][_0x1be3('0x4e')]({'plain':!![]});if(!_0x1a4485)throw new Error(_0x1be3('0x4f'));if(_0x1a4485[_0x1be3('0x50')]===_0x1be3('0x4d')){var _0x116c44=_0x2c41a4['get']({'plain':!![]});var _0x4578eb=_0x1be3('0x2b');return db[_0x1be3('0x51')][_0x1be3('0x4a')]({'where':{'name':_0x4578eb,'userProfileId':_0x1a4485[_0x1be3('0x52')]},'raw':!![]})[_0x1be3('0x29')](function(_0x4c6df3){if(_0x4c6df3&&_0x4c6df3[_0x1be3('0x53')]===0x0){return db['UserProfileResource'][_0x1be3('0x4b')]({'name':_0x116c44[_0x1be3('0x2e')],'resourceId':_0x116c44['id'],'type':_0x4c6df3[_0x1be3('0x2e')],'sectionId':_0x4c6df3['id']},{})[_0x1be3('0x29')](function(){return _0x2c41a4;});}else{return _0x2c41a4;}})['catch'](function(_0x537fd2){logger[_0x1be3('0x2d')](_0x1be3('0x54'),_0x537fd2);throw _0x537fd2;});}return _0x2c41a4;})[_0x1be3('0x29')](respondWithResult(_0x495d2b,0xc9))[_0x1be3('0x44')](handleError(_0x495d2b,null));};exports[_0x1be3('0x28')]=function(_0x4979d0,_0x2ba615){if(_0x4979d0[_0x1be3('0x4c')]['id']){delete _0x4979d0[_0x1be3('0x4c')]['id'];}return db[_0x1be3('0x40')][_0x1be3('0x4a')]({'where':{'id':_0x4979d0['params']['id']}})[_0x1be3('0x29')](handleEntityNotFound(_0x2ba615,null))['then'](saveUpdates(_0x4979d0[_0x1be3('0x4c')],null))[_0x1be3('0x29')](respondWithResult(_0x2ba615,null))[_0x1be3('0x44')](handleError(_0x2ba615,null));};exports['destroy']=function(_0x48b2db,_0xb40c79){return db[_0x1be3('0x40')][_0x1be3('0x4a')]({'where':{'id':_0x48b2db['params']['id']}})[_0x1be3('0x29')](handleEntityNotFound(_0xb40c79,null))[_0x1be3('0x29')](removeEntity(_0xb40c79,null))['catch'](handleError(_0xb40c79,null));}; \ No newline at end of file +var _0xda65=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xda65,0x1d0));var _0x5da6=function(_0x181f34,_0x4c7f0f){_0x181f34=_0x181f34-0x0;var _0x2e1921=_0xda65[_0x181f34];return _0x2e1921;};'use strict';var emlformat=require(_0x5da6('0x0'));var rimraf=require(_0x5da6('0x1'));var zipdir=require(_0x5da6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5da6('0x3'));var moment=require(_0x5da6('0x4'));var BPromise=require(_0x5da6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5da6('0x6'));var sox=require(_0x5da6('0x7'));var csv=require(_0x5da6('0x8'));var ejs=require(_0x5da6('0x9'));var fs=require('fs');var fs_extra=require(_0x5da6('0xa'));var _=require('lodash');var squel=require(_0x5da6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5da6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5da6('0xd'));var Papa=require(_0x5da6('0xe'));var Redis=require(_0x5da6('0xf'));var authService=require(_0x5da6('0x10'));var qs=require(_0x5da6('0x11'));var as=require(_0x5da6('0x12'));var hardwareService=require(_0x5da6('0x13'));var logger=require(_0x5da6('0x14'))('api');var utils=require(_0x5da6('0x15'));var config=require(_0x5da6('0x16'));var licenseUtil=require(_0x5da6('0x17'));var db=require(_0x5da6('0x18'))['db'];function respondWithStatusCode(_0x3500c6,_0x40ace1){_0x40ace1=_0x40ace1||0xcc;return function(_0x351340){if(_0x351340){return _0x3500c6[_0x5da6('0x19')](_0x40ace1);}return _0x3500c6[_0x5da6('0x1a')](_0x40ace1)['end']();};}function respondWithResult(_0x423665,_0x3e4dd6){_0x3e4dd6=_0x3e4dd6||0xc8;return function(_0xdb1066){if(_0xdb1066){return _0x423665[_0x5da6('0x1a')](_0x3e4dd6)[_0x5da6('0x1b')](_0xdb1066);}};}function respondWithFilteredResult(_0x47798b,_0x32a16a){return function(_0x1c28b7){if(_0x1c28b7){var _0x4f594e=typeof _0x32a16a[_0x5da6('0x1c')]==='undefined'&&typeof _0x32a16a['limit']===_0x5da6('0x1d');var _0x31b743=_0x1c28b7[_0x5da6('0x1e')];var _0x4c3b2d=_0x4f594e?0x0:_0x32a16a[_0x5da6('0x1c')];var _0x4b42e4=_0x4f594e?_0x1c28b7[_0x5da6('0x1e')]:_0x32a16a[_0x5da6('0x1c')]+_0x32a16a[_0x5da6('0x1f')];var _0x3c93e2;if(_0x4b42e4>=_0x31b743){_0x4b42e4=_0x31b743;_0x3c93e2=0xc8;}else{_0x3c93e2=0xce;}_0x47798b['status'](_0x3c93e2);return _0x47798b[_0x5da6('0x20')](_0x5da6('0x21'),_0x4c3b2d+'-'+_0x4b42e4+'/'+_0x31b743)[_0x5da6('0x1b')](_0x1c28b7);}return null;};}function patchUpdates(_0x24500d){return function(_0x747f9f){try{jsonpatch[_0x5da6('0x22')](_0x747f9f,_0x24500d,!![]);}catch(_0x163f8a){return BPromise[_0x5da6('0x23')](_0x163f8a);}return _0x747f9f['save']();};}function saveUpdates(_0x317cdb,_0x5ad81b){return function(_0x92171e){if(_0x92171e){return _0x92171e[_0x5da6('0x24')](_0x317cdb)[_0x5da6('0x25')](function(_0xdbaece){return _0xdbaece;});}return null;};}function removeEntity(_0x115098,_0x22b261){return function(_0x1d394e){if(_0x1d394e){return _0x1d394e[_0x5da6('0x26')]()['then'](function(){var _0x51a428=_0x1d394e[_0x5da6('0x27')]({'plain':!![]});var _0x256073='ChanSpies';return db['UserProfileResource'][_0x5da6('0x26')]({'where':{'type':_0x256073,'resourceId':_0x51a428['id']}})[_0x5da6('0x25')](function(){return _0x1d394e;});})[_0x5da6('0x25')](function(){_0x115098[_0x5da6('0x1a')](0xcc)[_0x5da6('0x28')]();});}};}function handleEntityNotFound(_0x495138,_0x471873){return function(_0x1bc214){if(!_0x1bc214){_0x495138[_0x5da6('0x19')](0x194);}return _0x1bc214;};}function handleError(_0x573b0c,_0x41dab8){_0x41dab8=_0x41dab8||0x1f4;return function(_0x2b3be1){logger['error'](_0x2b3be1[_0x5da6('0x29')]);if(_0x2b3be1[_0x5da6('0x2a')]){delete _0x2b3be1[_0x5da6('0x2a')];}_0x573b0c[_0x5da6('0x1a')](_0x41dab8)[_0x5da6('0x2b')](_0x2b3be1);};}exports[_0x5da6('0x2c')]=function(_0x26cb1a,_0x25e8ae){var _0x46541d={},_0x46ed01={},_0x24149d={'count':0x0,'rows':[]};var _0x19dc67=_[_0x5da6('0x2d')](db[_0x5da6('0x2e')]['rawAttributes'],function(_0x42af0d){return{'name':_0x42af0d[_0x5da6('0x2f')],'type':_0x42af0d[_0x5da6('0x30')]['key']};});_0x46ed01[_0x5da6('0x31')]=_[_0x5da6('0x2d')](_0x19dc67,_0x5da6('0x2a'));_0x46ed01[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x26cb1a[_0x5da6('0x32')]);_0x46ed01[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x46ed01[_0x5da6('0x31')],_0x46ed01['query']);_0x46541d['attributes']=_[_0x5da6('0x35')](_0x46ed01['model'],qs['fields'](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x36')]));_0x46541d['attributes']=_0x46541d['attributes'][_0x5da6('0x37')]?_0x46541d['attributes']:_0x46ed01['model'];if(!_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x38')]('nolimit')){_0x46541d[_0x5da6('0x1f')]=qs[_0x5da6('0x1f')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1f')]);_0x46541d['offset']=qs[_0x5da6('0x1c')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1c')]);}_0x46541d['order']=qs[_0x5da6('0x39')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x39')]);_0x46541d[_0x5da6('0x3a')]=qs[_0x5da6('0x34')](_[_0x5da6('0x3b')](_0x26cb1a['query'],_0x46ed01[_0x5da6('0x34')]),_0x19dc67);if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]){_0x46541d['where']=_['merge'](_0x46541d['where'],{'$or':_[_0x5da6('0x2d')](_0x19dc67,function(_0x4ffe15){if(_0x4ffe15[_0x5da6('0x30')]!=='VIRTUAL'){var _0x2afd1e={};_0x2afd1e[_0x4ffe15['name']]={'$like':'%'+_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]+'%'};return _0x2afd1e;}})});}_0x46541d=_['merge']({},_0x46541d,_0x26cb1a[_0x5da6('0x3d')]);var _0x4255ae={'where':_0x46541d[_0x5da6('0x3a')]};return db[_0x5da6('0x2e')][_0x5da6('0x1e')](_0x4255ae)[_0x5da6('0x25')](function(_0x2de3e7){_0x24149d[_0x5da6('0x1e')]=_0x2de3e7;if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x46541d[_0x5da6('0x3f')]=[{'all':!![]}];}return db[_0x5da6('0x2e')][_0x5da6('0x40')](_0x46541d);})[_0x5da6('0x25')](function(_0x9d38b0){_0x24149d[_0x5da6('0x41')]=_0x9d38b0;return _0x24149d;})[_0x5da6('0x25')](respondWithFilteredResult(_0x25e8ae,_0x46541d))['catch'](handleError(_0x25e8ae,null));};exports[_0x5da6('0x42')]=function(_0x313a24,_0xf9cfa5){var _0x3cac43={'raw':![],'where':{'id':_0x313a24[_0x5da6('0x43')]['id']}},_0x5e01d2={};_0x5e01d2[_0x5da6('0x31')]=_[_0x5da6('0x33')](db[_0x5da6('0x2e')]['rawAttributes']);_0x5e01d2[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x313a24[_0x5da6('0x32')]);_0x5e01d2[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x5e01d2[_0x5da6('0x31')],_0x5e01d2[_0x5da6('0x32')]);_0x3cac43[_0x5da6('0x44')]=_[_0x5da6('0x35')](_0x5e01d2['model'],qs[_0x5da6('0x36')](_0x313a24[_0x5da6('0x32')][_0x5da6('0x36')]));_0x3cac43['attributes']=_0x3cac43['attributes'][_0x5da6('0x37')]?_0x3cac43[_0x5da6('0x44')]:_0x5e01d2[_0x5da6('0x31')];if(_0x313a24[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x3cac43['include']=[{'all':!![]}];}_0x3cac43=_['merge']({},_0x3cac43,_0x313a24['options']);return db[_0x5da6('0x2e')][_0x5da6('0x45')](_0x3cac43)[_0x5da6('0x25')](handleEntityNotFound(_0xf9cfa5,null))[_0x5da6('0x25')](respondWithResult(_0xf9cfa5,null))[_0x5da6('0x46')](handleError(_0xf9cfa5,null));};exports[_0x5da6('0x47')]=function(_0x4a8da1,_0xce1fdc){return db[_0x5da6('0x2e')][_0x5da6('0x47')](_0x4a8da1['body'],{})['then'](function(_0xf77d73){var _0x375ea8=_0x4a8da1['user'][_0x5da6('0x27')]({'plain':!![]});if(!_0x375ea8)throw new Error(_0x5da6('0x48'));if(_0x375ea8[_0x5da6('0x49')]==='user'){var _0x2c90e2=_0xf77d73['get']({'plain':!![]});var _0xabf041=_0x5da6('0x4a');return db[_0x5da6('0x4b')][_0x5da6('0x45')]({'where':{'name':_0xabf041,'userProfileId':_0x375ea8[_0x5da6('0x4c')]},'raw':!![]})[_0x5da6('0x25')](function(_0x3e936a){if(_0x3e936a&&_0x3e936a[_0x5da6('0x4d')]===0x0){return db[_0x5da6('0x4e')][_0x5da6('0x47')]({'name':_0x2c90e2[_0x5da6('0x2a')],'resourceId':_0x2c90e2['id'],'type':_0x3e936a[_0x5da6('0x2a')],'sectionId':_0x3e936a['id']},{})['then'](function(){return _0xf77d73;});}else{return _0xf77d73;}})[_0x5da6('0x46')](function(_0x467b0e){logger['error'](_0x5da6('0x4f'),_0x467b0e);throw _0x467b0e;});}return _0xf77d73;})[_0x5da6('0x25')](respondWithResult(_0xce1fdc,0xc9))[_0x5da6('0x46')](handleError(_0xce1fdc,null));};exports[_0x5da6('0x24')]=function(_0x4d3141,_0x4bea76){if(_0x4d3141['body']['id']){delete _0x4d3141[_0x5da6('0x50')]['id'];}return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4d3141['params']['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x4bea76,null))[_0x5da6('0x25')](saveUpdates(_0x4d3141[_0x5da6('0x50')],null))[_0x5da6('0x25')](respondWithResult(_0x4bea76,null))[_0x5da6('0x46')](handleError(_0x4bea76,null));};exports[_0x5da6('0x26')]=function(_0x4bc620,_0x23fe40){return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4bc620[_0x5da6('0x43')]['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x23fe40,null))[_0x5da6('0x25')](removeEntity(_0x23fe40,null))[_0x5da6('0x46')](handleError(_0x23fe40,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 69f1ace..d00d311 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 _0x0787=['Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','options','join','internal','name','User','findAll','agent','then','models','define','VoiceChanSpy','length','bulkCreate','catch','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x0787,0xd8));var _0x7078=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x0787[_0x3df9dd];return _0x4f11e4;};'use strict';var _=require(_0x7078('0x0'));var util=require(_0x7078('0x1'));var BPromise=require(_0x7078('0x2'));var attributes=require(_0x7078('0x3'));var getUserApplications=function(_0x18c221,_0x1a7fa1,_0x3fd760){var _0x536ee1=0x1;var _0x3fb98a=[];var _0x28ae32={'context':_0x1a7fa1[_0x7078('0x4')]||_0x7078('0x5'),'exten':util[_0x7078('0x6')](_0x7078('0x7'),_0x18c221[_0x7078('0x8')],_0x3fd760),'type':_0x7078('0x9'),'isApp':![],'ChanSpyId':_0x18c221['id'],'UserId':_0x1a7fa1['id']};_0x3fb98a[_0x7078('0xa')](_[_0x7078('0xb')]({'app':_0x7078('0xc'),'appdata':util[_0x7078('0x6')](_0x7078('0xd'),_0x7078('0xe')),'priority':_0x536ee1++},_0x28ae32));if(_0x18c221[_0x7078('0xf')]){_0x3fb98a[_0x7078('0xa')](_[_0x7078('0xb')]({'app':_0x7078('0x10'),'appdata':util[_0x7078('0x6')]('${UNIQUEID}.%s,a',_0x18c221[_0x7078('0x11')]),'priority':_0x536ee1++},_0x28ae32));}if(_0x18c221[_0x7078('0x12')]){_0x3fb98a['push'](_[_0x7078('0xb')]({'app':_0x7078('0x13'),'appdata':_0x18c221[_0x7078('0x14')],'priority':_0x536ee1++},_0x28ae32));}_0x3fb98a[_0x7078('0xa')](_[_0x7078('0xb')]({'app':_0x7078('0x15'),'appdata':util['format']('SIP/%s,%s',_0x1a7fa1['name'],_0x18c221[_0x7078('0x16')]?_0x18c221[_0x7078('0x16')][_0x7078('0x17')](''):''),'priority':_0x536ee1++},_0x28ae32));if(_0x18c221[_0x7078('0xf')]){_0x3fb98a['push'](_['merge']({'app':'StopMixMonitor','priority':_0x536ee1++},_0x28ae32));}return _0x3fb98a;};var getChanSpyApplications=function(_0x43f426,_0x1ac1d1){var _0xc2858b=[];for(var _0x52fb7d=0x0,_0x55d851=0x1;_0x52fb7d<_0x1ac1d1['length'];_0x52fb7d++,_0x55d851=0x1){_0xc2858b=_0xc2858b['concat'](getUserApplications(_0x43f426,_0x1ac1d1[_0x52fb7d],_0x1ac1d1[_0x52fb7d][_0x7078('0x18')]));if(_0x1ac1d1[_0x52fb7d]['internal']!=_0x1ac1d1[_0x52fb7d][_0x7078('0x19')]){_0xc2858b=_0xc2858b['concat'](getUserApplications(_0x43f426,_0x1ac1d1[_0x52fb7d],_0x1ac1d1[_0x52fb7d][_0x7078('0x19')]));}}return _0xc2858b;};var getChanSpyPromise=function(_0x2a3f45,_0x9380b8){return new BPromise(function(_0x3ce5ef,_0x34d57b){return _0x2a3f45[_0x7078('0x1a')][_0x7078('0x1b')]({'attributes':['id','name',_0x7078('0x18')],'where':{'role':_0x7078('0x1c'),'chanspy':!![]},'raw':!![]})[_0x7078('0x1d')](function(_0x32f35b){if(_0x32f35b){return _0x3ce5ef(getChanSpyApplications(_0x9380b8,_0x32f35b));}return _0x3ce5ef([]);})['catch'](function(_0xd51631){_0x34d57b(_0xd51631);});});};module['exports']=function(_0x1591bf,_0x755f73){var _0x23ce8f=_0x1591bf[_0x7078('0x1e')];return _0x1591bf[_0x7078('0x1f')](_0x7078('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d301d,_0x344d49,_0x348a03){return getChanSpyPromise(_0x23ce8f,_0x1d301d)['then'](function(_0x44c8b6){if(_0x44c8b6&&_0x44c8b6[_0x7078('0x21')]){return _0x23ce8f['VoiceExtension'][_0x7078('0x22')](_0x44c8b6);}})[_0x7078('0x1d')](function(){_0x348a03();})[_0x7078('0x23')](function(_0x45b6eb){_0x348a03(_0x45b6eb);});},'afterUpdate':function(_0x282e2c,_0x52c934,_0x47b571){return _0x23ce8f[_0x7078('0x24')][_0x7078('0x25')]({'where':{'ChanSpyId':_0x282e2c['id']}})[_0x7078('0x1d')](function(){return getChanSpyPromise(_0x23ce8f,_0x282e2c);})[_0x7078('0x1d')](function(_0xe4ef31){if(_0xe4ef31&&_0xe4ef31[_0x7078('0x21')]){return _0x23ce8f['VoiceExtension'][_0x7078('0x22')](_0xe4ef31);}})[_0x7078('0x1d')](function(){_0x47b571();})[_0x7078('0x23')](function(_0x33cdc5){_0x47b571(_0x33cdc5);});},'afterDestroy':function(_0x25b07f,_0x3e8526,_0x2a865d){return _0x23ce8f[_0x7078('0x24')][_0x7078('0x25')]({'where':{'ChanSpyId':_0x25b07f['id']}})[_0x7078('0x1d')](function(){_0x2a865d();})['catch'](function(_0x599c19){_0x2a865d(_0x599c19);});}}});}; \ No newline at end of file +var _0x7820=['models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','concat','User','findAll','agent','then','catch','exports'];(function(_0x55d6ef,_0xaa2303){var _0x4968e9=function(_0x586fc9){while(--_0x586fc9){_0x55d6ef['push'](_0x55d6ef['shift']());}};_0x4968e9(++_0xaa2303);}(_0x7820,0xd5));var _0x0782=function(_0x2f3cb4,_0x206261){_0x2f3cb4=_0x2f3cb4-0x0;var _0x2e37fd=_0x7820[_0x2f3cb4];return _0x2e37fd;};'use strict';var _=require(_0x0782('0x0'));var util=require(_0x0782('0x1'));var BPromise=require(_0x0782('0x2'));var attributes=require(_0x0782('0x3'));var getUserApplications=function(_0x578bee,_0x16bbb2,_0x2a8388){var _0x2f43ec=0x1;var _0x40ba06=[];var _0x4a50b0={'context':_0x16bbb2[_0x0782('0x4')]||'from-sip','exten':util[_0x0782('0x5')](_0x0782('0x6'),_0x578bee[_0x0782('0x7')],_0x2a8388),'type':'system','isApp':![],'ChanSpyId':_0x578bee['id'],'UserId':_0x16bbb2['id']};_0x40ba06[_0x0782('0x8')](_[_0x0782('0x9')]({'app':_0x0782('0xa'),'appdata':util[_0x0782('0x5')]('CDR(type)=%s',_0x0782('0xb')),'priority':_0x2f43ec++},_0x4a50b0));if(_0x578bee[_0x0782('0xc')]){_0x40ba06[_0x0782('0x8')](_[_0x0782('0x9')]({'app':_0x0782('0xd'),'appdata':util[_0x0782('0x5')](_0x0782('0xe'),_0x578bee[_0x0782('0xf')]),'priority':_0x2f43ec++},_0x4a50b0));}if(_0x578bee[_0x0782('0x10')]){_0x40ba06['push'](_[_0x0782('0x9')]({'app':_0x0782('0x11'),'appdata':_0x578bee[_0x0782('0x12')],'priority':_0x2f43ec++},_0x4a50b0));}_0x40ba06[_0x0782('0x8')](_[_0x0782('0x9')]({'app':_0x0782('0x13'),'appdata':util[_0x0782('0x5')](_0x0782('0x14'),_0x16bbb2[_0x0782('0x15')],_0x578bee[_0x0782('0x16')]?_0x578bee[_0x0782('0x16')][_0x0782('0x17')](''):''),'priority':_0x2f43ec++},_0x4a50b0));if(_0x578bee[_0x0782('0xc')]){_0x40ba06[_0x0782('0x8')](_['merge']({'app':_0x0782('0x18'),'priority':_0x2f43ec++},_0x4a50b0));}return _0x40ba06;};var getChanSpyApplications=function(_0x4d3245,_0x1a47c5){var _0xbbae06=[];for(var _0x34c109=0x0,_0x5d8eb5=0x1;_0x34c109<_0x1a47c5['length'];_0x34c109++,_0x5d8eb5=0x1){_0xbbae06=_0xbbae06['concat'](getUserApplications(_0x4d3245,_0x1a47c5[_0x34c109],_0x1a47c5[_0x34c109][_0x0782('0x19')]));if(_0x1a47c5[_0x34c109][_0x0782('0x19')]!=_0x1a47c5[_0x34c109][_0x0782('0x15')]){_0xbbae06=_0xbbae06[_0x0782('0x1a')](getUserApplications(_0x4d3245,_0x1a47c5[_0x34c109],_0x1a47c5[_0x34c109][_0x0782('0x15')]));}}return _0xbbae06;};var getChanSpyPromise=function(_0x1c582f,_0x114c4b){return new BPromise(function(_0x3c8e07,_0x58b400){return _0x1c582f[_0x0782('0x1b')][_0x0782('0x1c')]({'attributes':['id',_0x0782('0x15'),_0x0782('0x19')],'where':{'role':_0x0782('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0782('0x1e')](function(_0x376435){if(_0x376435){return _0x3c8e07(getChanSpyApplications(_0x114c4b,_0x376435));}return _0x3c8e07([]);})[_0x0782('0x1f')](function(_0x4c0d34){_0x58b400(_0x4c0d34);});});};module[_0x0782('0x20')]=function(_0x468c70,_0x5acddb){var _0x1d6fec=_0x468c70[_0x0782('0x21')];return _0x468c70[_0x0782('0x22')](_0x0782('0x23'),attributes,{'tableName':_0x0782('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x382bc9,_0xb684f5,_0x43508e){return getChanSpyPromise(_0x1d6fec,_0x382bc9)['then'](function(_0x10b175){if(_0x10b175&&_0x10b175[_0x0782('0x25')]){return _0x1d6fec[_0x0782('0x26')][_0x0782('0x27')](_0x10b175);}})[_0x0782('0x1e')](function(){_0x43508e();})[_0x0782('0x1f')](function(_0x3231e3){_0x43508e(_0x3231e3);});},'afterUpdate':function(_0xcaa62c,_0x19f57c,_0x5c9806){return _0x1d6fec[_0x0782('0x26')][_0x0782('0x28')]({'where':{'ChanSpyId':_0xcaa62c['id']}})[_0x0782('0x1e')](function(){return getChanSpyPromise(_0x1d6fec,_0xcaa62c);})[_0x0782('0x1e')](function(_0x260ccf){if(_0x260ccf&&_0x260ccf[_0x0782('0x25')]){return _0x1d6fec[_0x0782('0x26')]['bulkCreate'](_0x260ccf);}})['then'](function(){_0x5c9806();})[_0x0782('0x1f')](function(_0x5ab76b){_0x5c9806(_0x5ab76b);});},'afterDestroy':function(_0x63138e,_0x3d9275,_0x1fdecd){return _0x1d6fec['VoiceExtension'][_0x0782('0x28')]({'where':{'ChanSpyId':_0x63138e['id']}})[_0x0782('0x1e')](function(){_0x1fdecd();})[_0x0782('0x1f')](function(_0x21d287){_0x1fdecd(_0x21d287);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 82d96ec..b8f9278 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x5b9b0e,_0x123974){var _0x4cd381=function(_0x2d7351){while(--_0x2d7351){_0x5b9b0e['push'](_0x5b9b0e['shift']());}};_0x4cd381(++_0x123974);}(_0xb821,0xa7));var _0x1b82=function(_0x2f9cf5,_0x29668c){_0x2f9cf5=_0x2f9cf5-0x0;var _0x2c24df=_0xb821[_0x2f9cf5];return _0x2c24df;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x7794=['randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x7794,0x7b));var _0x4779=function(_0x3f81ad,_0x3c6a39){_0x3f81ad=_0x3f81ad-0x0;var _0x546350=_0x7794[_0x3f81ad];return _0x546350;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1544a32..33a252e 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 _0x5cf1=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x57d45b,_0x4651d5){var _0x4ceefb=function(_0x1cb65f){while(--_0x1cb65f){_0x57d45b['push'](_0x57d45b['shift']());}};_0x4ceefb(++_0x4651d5);}(_0x5cf1,0x105));var _0x15cf=function(_0x326f81,_0x57c9d8){_0x326f81=_0x326f81-0x0;var _0x8a3c6e=_0x5cf1[_0x326f81];return _0x8a3c6e;};'use strict';var multer=require(_0x15cf('0x0'));var util=require(_0x15cf('0x1'));var path=require('path');var timeout=require(_0x15cf('0x2'));var express=require(_0x15cf('0x3'));var router=express[_0x15cf('0x4')]();var fs_extra=require(_0x15cf('0x5'));var auth=require(_0x15cf('0x6'));var interaction=require(_0x15cf('0x7'));var config=require('../../config/environment');var controller=require(_0x15cf('0x8'));router[_0x15cf('0x9')]('/',auth[_0x15cf('0xa')](),controller[_0x15cf('0xb')]);router[_0x15cf('0x9')](_0x15cf('0xc'),auth[_0x15cf('0xa')](),controller['show']);router[_0x15cf('0xd')]('/',auth[_0x15cf('0xa')](),controller[_0x15cf('0xe')]);router[_0x15cf('0xf')](_0x15cf('0xc'),auth[_0x15cf('0xa')](),controller[_0x15cf('0x10')]);router[_0x15cf('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x15cf('0x12')]);module[_0x15cf('0x13')]=router; \ No newline at end of file +var _0x0378=['../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','fs-extra'];(function(_0x54673c,_0x51ec11){var _0x1ca15b=function(_0x52ed71){while(--_0x52ed71){_0x54673c['push'](_0x54673c['shift']());}};_0x1ca15b(++_0x51ec11);}(_0x0378,0x19c));var _0x8037=function(_0x4ed48f,_0x47d140){_0x4ed48f=_0x4ed48f-0x0;var _0x438e51=_0x0378[_0x4ed48f];return _0x438e51;};'use strict';var multer=require(_0x8037('0x0'));var util=require('util');var path=require(_0x8037('0x1'));var timeout=require(_0x8037('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8037('0x3'));var auth=require(_0x8037('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8037('0x5'));var controller=require(_0x8037('0x6'));router[_0x8037('0x7')]('/',auth[_0x8037('0x8')](),controller['index']);router[_0x8037('0x7')](_0x8037('0x9'),auth[_0x8037('0x8')](),controller[_0x8037('0xa')]);router[_0x8037('0xb')]('/',auth[_0x8037('0x8')](),controller[_0x8037('0xc')]);router[_0x8037('0xd')](_0x8037('0x9'),auth['isAuthenticated'](),controller[_0x8037('0xe')]);router['delete'](_0x8037('0x9'),auth[_0x8037('0x8')](),controller['destroy']);module[_0x8037('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index b1f39af..7e3efae 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 _0xaabb=['sequelize'];(function(_0x32c3ff,_0x503b36){var _0x374568=function(_0x3bd217){while(--_0x3bd217){_0x32c3ff['push'](_0x32c3ff['shift']());}};_0x374568(++_0x503b36);}(_0xaabb,0x14b));var _0xbaab=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0xaabb[_0x1fa760];return _0xd8eda1;};'use strict';var Sequelize=require(_0xbaab('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2726=['sequelize','STRING','name','BOOLEAN'];(function(_0x1974c7,_0x45212a){var _0xe6c23c=function(_0x2144f7){while(--_0x2144f7){_0x1974c7['push'](_0x1974c7['shift']());}};_0xe6c23c(++_0x45212a);}(_0x2726,0x110));var _0x6272=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x2726[_0x14e9f0];return _0xa63f7e;};'use strict';var Sequelize=require(_0x6272('0x0'));module['exports']={'name':{'type':Sequelize[_0x6272('0x1')],'unique':_0x6272('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6272('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 1408ded..13780a5 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 _0xd242=['result','catch','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','sort','pick','filter','where','merge','map','options','VoiceContext','includeAll','rows','show','rawAttributes','include','create','body','readFileSync','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','utf8','render','findAll','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','VoiceContext,\x20%s,\x20%s'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xd242,0x1e1));var _0x2d24=function(_0x46b8f8,_0x3f9908){_0x46b8f8=_0x46b8f8-0x0;var _0x28eafe=_0xd242[_0x46b8f8];return _0x28eafe;};'use strict';var emlformat=require(_0x2d24('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d24('0x1'));var rp=require('request-promise');var moment=require(_0x2d24('0x2'));var BPromise=require(_0x2d24('0x3'));var Mustache=require(_0x2d24('0x4'));var util=require(_0x2d24('0x5'));var path=require('path');var sox=require(_0x2d24('0x6'));var csv=require(_0x2d24('0x7'));var ejs=require(_0x2d24('0x8'));var fs=require('fs');var fs_extra=require(_0x2d24('0x9'));var _=require('lodash');var squel=require(_0x2d24('0xa'));var crypto=require(_0x2d24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2d24('0xc'));var toCsv=require(_0x2d24('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2d24('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2d24('0xe'));var as=require(_0x2d24('0xf'));var hardwareService=require(_0x2d24('0x10'));var logger=require(_0x2d24('0x11'))(_0x2d24('0x12'));var utils=require(_0x2d24('0x13'));var config=require(_0x2d24('0x14'));var licenseUtil=require(_0x2d24('0x15'));var db=require(_0x2d24('0x16'))['db'];var jayson=require(_0x2d24('0x17'));var client=jayson[_0x2d24('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31e194,_0x361b13,_0x4b07b9,_0x3ffa74){return new BPromise(function(_0x31bc58,_0xc4e858){var _0x27f7c5=_0x3ffa74||client;return _0x27f7c5[_0x2d24('0x19')](_0x31e194,_0x4b07b9)[_0x2d24('0x1a')](function(_0x4a916b){logger[_0x2d24('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x361b13,_0x2d24('0x1c'));logger[_0x2d24('0x1d')](_0x2d24('0x1e'),_0x361b13,'request\x20sent',JSON['stringify'](_0x4a916b));if(_0x4a916b['error']){if(_0x4a916b[_0x2d24('0x1f')]['code']===0x1f4){logger[_0x2d24('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x361b13,_0x4a916b[_0x2d24('0x1f')]['message']);return _0xc4e858(_0x4a916b['error'][_0x2d24('0x20')]);}logger[_0x2d24('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x361b13,_0x4a916b[_0x2d24('0x1f')][_0x2d24('0x20')]);return _0x31bc58(_0x4a916b[_0x2d24('0x1f')][_0x2d24('0x20')]);}else{logger['info'](_0x2d24('0x21'),_0x361b13,_0x2d24('0x1c'));_0x31bc58(_0x4a916b[_0x2d24('0x22')][_0x2d24('0x20')]);}})[_0x2d24('0x23')](function(_0x3f0049){logger[_0x2d24('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x361b13,_0x3f0049);_0xc4e858(_0x3f0049);});});}function respondWithStatusCode(_0x529b98,_0x26ee5d){_0x26ee5d=_0x26ee5d||0xcc;return function(_0x1f7b27){if(_0x1f7b27){return _0x529b98['sendStatus'](_0x26ee5d);}return _0x529b98[_0x2d24('0x24')](_0x26ee5d)[_0x2d24('0x25')]();};}function respondWithResult(_0x302f37,_0x33a4ea){_0x33a4ea=_0x33a4ea||0xc8;return function(_0x12f2a9){if(_0x12f2a9){return _0x302f37[_0x2d24('0x24')](_0x33a4ea)['json'](_0x12f2a9);}};}function respondWithFilteredResult(_0x3653b7,_0x3dc599){return function(_0x5e703a){if(_0x5e703a){var _0x2e4429=typeof _0x3dc599[_0x2d24('0x26')]==='undefined'&&typeof _0x3dc599[_0x2d24('0x27')]===_0x2d24('0x28');var _0x5beafd=_0x5e703a[_0x2d24('0x29')];var _0x30c078=_0x2e4429?0x0:_0x3dc599['offset'];var _0x162ec9=_0x2e4429?_0x5e703a[_0x2d24('0x29')]:_0x3dc599['offset']+_0x3dc599[_0x2d24('0x27')];var _0x11a561;if(_0x162ec9>=_0x5beafd){_0x162ec9=_0x5beafd;_0x11a561=0xc8;}else{_0x11a561=0xce;}_0x3653b7[_0x2d24('0x24')](_0x11a561);return _0x3653b7[_0x2d24('0x2a')]('Content-Range',_0x30c078+'-'+_0x162ec9+'/'+_0x5beafd)['json'](_0x5e703a);}return null;};}function patchUpdates(_0x4b9584){return function(_0x1ccb39){try{jsonpatch[_0x2d24('0x2b')](_0x1ccb39,_0x4b9584,!![]);}catch(_0x39a5d6){return BPromise[_0x2d24('0x2c')](_0x39a5d6);}return _0x1ccb39[_0x2d24('0x2d')]();};}function saveUpdates(_0x1c3c8b,_0x5668cf){return function(_0x2f1def){if(_0x2f1def){return _0x2f1def[_0x2d24('0x2e')](_0x1c3c8b)[_0x2d24('0x1a')](function(_0x970c10){return _0x970c10;});}return null;};}function removeEntity(_0x4bf34a,_0x1f6036){return function(_0x50cefa){if(_0x50cefa){return _0x50cefa[_0x2d24('0x2f')]()[_0x2d24('0x1a')](function(){var _0x28aeaa=_0x50cefa['get']({'plain':!![]});var _0x3b6662=_0x2d24('0x30');return db[_0x2d24('0x31')][_0x2d24('0x2f')]({'where':{'type':_0x3b6662,'resourceId':_0x28aeaa['id']}})['then'](function(){return _0x50cefa;});})[_0x2d24('0x1a')](function(){_0x4bf34a[_0x2d24('0x24')](0xcc)[_0x2d24('0x25')]();});}};}function handleEntityNotFound(_0x5d6482,_0x2b334d){return function(_0x4f7dbb){if(!_0x4f7dbb){_0x5d6482['sendStatus'](0x194);}return _0x4f7dbb;};}function handleError(_0x4eb9d5,_0x335570){_0x335570=_0x335570||0x1f4;return function(_0x1e39df){logger[_0x2d24('0x1f')](_0x1e39df[_0x2d24('0x32')]);if(_0x1e39df['name']){delete _0x1e39df[_0x2d24('0x33')];}_0x4eb9d5[_0x2d24('0x24')](_0x335570)[_0x2d24('0x34')](_0x1e39df);};}exports[_0x2d24('0x35')]=function(_0xbab3a7,_0x5026fd){var _0x4f7dc4={},_0x4ed62d={},_0x2ed715={'count':0x0,'rows':[]};var _0x134332=_['map'](db['VoiceContext']['rawAttributes'],function(_0x45587e){return{'name':_0x45587e[_0x2d24('0x36')],'type':_0x45587e[_0x2d24('0x37')][_0x2d24('0x38')]};});_0x4ed62d[_0x2d24('0x39')]=_['map'](_0x134332,_0x2d24('0x33'));_0x4ed62d['query']=_[_0x2d24('0x3a')](_0xbab3a7['query']);_0x4ed62d[_0x2d24('0x3b')]=_[_0x2d24('0x3c')](_0x4ed62d[_0x2d24('0x39')],_0x4ed62d['query']);_0x4f7dc4[_0x2d24('0x3d')]=_['intersection'](_0x4ed62d[_0x2d24('0x39')],qs[_0x2d24('0x3e')](_0xbab3a7[_0x2d24('0x3f')][_0x2d24('0x3e')]));_0x4f7dc4['attributes']=_0x4f7dc4['attributes'][_0x2d24('0x40')]?_0x4f7dc4[_0x2d24('0x3d')]:_0x4ed62d[_0x2d24('0x39')];if(!_0xbab3a7[_0x2d24('0x3f')]['hasOwnProperty'](_0x2d24('0x41'))){_0x4f7dc4[_0x2d24('0x27')]=qs[_0x2d24('0x27')](_0xbab3a7[_0x2d24('0x3f')][_0x2d24('0x27')]);_0x4f7dc4['offset']=qs[_0x2d24('0x26')](_0xbab3a7[_0x2d24('0x3f')]['offset']);}_0x4f7dc4[_0x2d24('0x42')]=qs['sort'](_0xbab3a7[_0x2d24('0x3f')][_0x2d24('0x43')]);_0x4f7dc4['where']=qs[_0x2d24('0x3b')](_[_0x2d24('0x44')](_0xbab3a7[_0x2d24('0x3f')],_0x4ed62d[_0x2d24('0x3b')]),_0x134332);if(_0xbab3a7[_0x2d24('0x3f')][_0x2d24('0x45')]){_0x4f7dc4[_0x2d24('0x46')]=_[_0x2d24('0x47')](_0x4f7dc4['where'],{'$or':_[_0x2d24('0x48')](_0x134332,function(_0x3b1aa0){if(_0x3b1aa0[_0x2d24('0x37')]!=='VIRTUAL'){var _0x4133ec={};_0x4133ec[_0x3b1aa0[_0x2d24('0x33')]]={'$like':'%'+_0xbab3a7[_0x2d24('0x3f')]['filter']+'%'};return _0x4133ec;}})});}_0x4f7dc4=_['merge']({},_0x4f7dc4,_0xbab3a7[_0x2d24('0x49')]);var _0x43e006={'where':_0x4f7dc4[_0x2d24('0x46')]};return db[_0x2d24('0x4a')][_0x2d24('0x29')](_0x43e006)[_0x2d24('0x1a')](function(_0x540b55){_0x2ed715[_0x2d24('0x29')]=_0x540b55;if(_0xbab3a7[_0x2d24('0x3f')][_0x2d24('0x4b')]){_0x4f7dc4['include']=[{'all':!![]}];}return db[_0x2d24('0x4a')]['findAll'](_0x4f7dc4);})[_0x2d24('0x1a')](function(_0x5358cf){_0x2ed715[_0x2d24('0x4c')]=_0x5358cf;return _0x2ed715;})[_0x2d24('0x1a')](respondWithFilteredResult(_0x5026fd,_0x4f7dc4))[_0x2d24('0x23')](handleError(_0x5026fd,null));};exports[_0x2d24('0x4d')]=function(_0x40d455,_0x54e9e7){var _0x7454be={'raw':![],'where':{'id':_0x40d455['params']['id']}},_0xcaa347={};_0xcaa347[_0x2d24('0x39')]=_[_0x2d24('0x3a')](db[_0x2d24('0x4a')][_0x2d24('0x4e')]);_0xcaa347[_0x2d24('0x3f')]=_[_0x2d24('0x3a')](_0x40d455[_0x2d24('0x3f')]);_0xcaa347[_0x2d24('0x3b')]=_['intersection'](_0xcaa347['model'],_0xcaa347[_0x2d24('0x3f')]);_0x7454be[_0x2d24('0x3d')]=_[_0x2d24('0x3c')](_0xcaa347[_0x2d24('0x39')],qs[_0x2d24('0x3e')](_0x40d455[_0x2d24('0x3f')][_0x2d24('0x3e')]));_0x7454be[_0x2d24('0x3d')]=_0x7454be[_0x2d24('0x3d')]['length']?_0x7454be[_0x2d24('0x3d')]:_0xcaa347[_0x2d24('0x39')];if(_0x40d455['query']['includeAll']){_0x7454be[_0x2d24('0x4f')]=[{'all':!![]}];}_0x7454be=_[_0x2d24('0x47')]({},_0x7454be,_0x40d455[_0x2d24('0x49')]);return db[_0x2d24('0x4a')]['find'](_0x7454be)[_0x2d24('0x1a')](handleEntityNotFound(_0x54e9e7,null))['then'](respondWithResult(_0x54e9e7,null))[_0x2d24('0x23')](handleError(_0x54e9e7,null));};exports['create']=function(_0x4fbbf3,_0x52dba5,_0x2d86e7){var _0x13752a;return db[_0x2d24('0x4a')][_0x2d24('0x50')](_0x4fbbf3[_0x2d24('0x51')],{'raw':!![]})[_0x2d24('0x1a')](function(_0x4db828){_0x13752a=_0x4db828;return db[_0x2d24('0x4a')]['findAll']({'raw':!![]});})['then'](function(_0x29ea91){var _0x30e5ce=fs[_0x2d24('0x52')](path['join'](config[_0x2d24('0x53')],_0x2d24('0x54')),'utf8');var _0x51e94d=ejs['render'](_0x30e5ce,{'contexts':_0x29ea91||[]});fs[_0x2d24('0x55')](_0x2d24('0x56'),_0x51e94d);})[_0x2d24('0x1a')](function(){return respondWithRpcPromise(_0x2d24('0x57'),'create',{'module':_0x2d24('0x58')});})['then'](function(){var _0x20d2fd=_0x4fbbf3[_0x2d24('0x59')]['get']({'plain':!![]});if(!_0x20d2fd)throw new Error(_0x2d24('0x5a'));if(_0x20d2fd[_0x2d24('0x5b')]==='user'){var _0x13d739=_0x13752a[_0x2d24('0x5c')]({'plain':!![]});return db[_0x2d24('0x5d')][_0x2d24('0x5e')]({'where':{'name':_0x2d24('0x30'),'userProfileId':_0x20d2fd[_0x2d24('0x5f')]},'raw':!![]})['then'](function(_0xba2d2d){if(_0xba2d2d&&_0xba2d2d[_0x2d24('0x60')]===0x0){return db[_0x2d24('0x31')][_0x2d24('0x50')]({'name':_0x13d739['name'],'resourceId':_0x13d739['id'],'type':_0xba2d2d[_0x2d24('0x33')],'sectionId':_0xba2d2d['id']},{})[_0x2d24('0x1a')](function(){return _0x13752a;});}else{return _0x13752a;}})[_0x2d24('0x23')](function(_0x4d1842){logger[_0x2d24('0x1f')](_0x2d24('0x61'),_0x4d1842);throw _0x4d1842;});}return _0x13752a;})[_0x2d24('0x1a')](respondWithResult(_0x52dba5,0xc9))[_0x2d24('0x23')](handleError(_0x52dba5,null));};exports[_0x2d24('0x2e')]=function(_0x2c55e4,_0x4cebea,_0x2c82d5){var _0x1b3886;return db[_0x2d24('0x4a')][_0x2d24('0x5e')]({'where':{'id':_0x2c55e4[_0x2d24('0x62')]['id']}})[_0x2d24('0x1a')](handleEntityNotFound(_0x4cebea,null))['then'](saveUpdates(_0x2c55e4['body'],null))[_0x2d24('0x1a')](function(_0x401c2b){if(_0x401c2b){_0x1b3886=_0x401c2b;return db[_0x2d24('0x4a')]['findAll']({'raw':!![]});}})[_0x2d24('0x1a')](function(_0x3f1d7e){var _0xe747d=fs[_0x2d24('0x52')](path[_0x2d24('0x63')](config[_0x2d24('0x53')],_0x2d24('0x54')),_0x2d24('0x64'));var _0x4e4522=ejs[_0x2d24('0x65')](_0xe747d,{'contexts':_0x3f1d7e||[]});fs['writeFileSync'](_0x2d24('0x56'),_0x4e4522);})[_0x2d24('0x1a')](function(){return respondWithRpcPromise(_0x2d24('0x57'),_0x2d24('0x2e'),{'module':_0x2d24('0x58')});})[_0x2d24('0x1a')](function(){return _0x1b3886;})[_0x2d24('0x1a')](respondWithResult(_0x4cebea,null))[_0x2d24('0x23')](handleError(_0x4cebea,null));};exports[_0x2d24('0x2f')]=function(_0x233f4d,_0x4dd558,_0x3386e4){var _0x2f97fb;return db[_0x2d24('0x4a')][_0x2d24('0x5e')]({'where':{'id':_0x233f4d[_0x2d24('0x62')]['id']}})[_0x2d24('0x1a')](handleEntityNotFound(_0x4dd558,null))[_0x2d24('0x1a')](removeEntity(_0x4dd558,null))[_0x2d24('0x1a')](function(){return db['VoiceContext'][_0x2d24('0x66')]({'raw':!![]});})[_0x2d24('0x1a')](function(_0x3a4d29){var _0x593b1b=fs['readFileSync'](path[_0x2d24('0x63')](config[_0x2d24('0x53')],_0x2d24('0x54')),_0x2d24('0x64'));var _0x53658f=ejs['render'](_0x593b1b,{'contexts':_0x3a4d29});fs['writeFileSync'](_0x2d24('0x56'),_0x53658f);return respondWithRpcPromise(_0x2d24('0x57'),'destroy',{'module':_0x2d24('0x58')});})[_0x2d24('0x23')](handleError(_0x4dd558,null));}; \ No newline at end of file +var _0x19a0=['../../config/utils','../../config/license/util','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','readFileSync','join','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','utf8','render','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x258aa2,_0x5ba123){var _0x3a7d14=function(_0x23518d){while(--_0x23518d){_0x258aa2['push'](_0x258aa2['shift']());}};_0x3a7d14(++_0x5ba123);}(_0x19a0,0x118));var _0x019a=function(_0x493dec,_0x5a6c69){_0x493dec=_0x493dec-0x0;var _0xf39d01=_0x19a0[_0x493dec];return _0xf39d01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x019a('0x0'));var zipdir=require(_0x019a('0x1'));var jsonpatch=require(_0x019a('0x2'));var rp=require(_0x019a('0x3'));var moment=require(_0x019a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x019a('0x5'));var util=require(_0x019a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x019a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x019a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x019a('0x9'));var jsforce=require(_0x019a('0xa'));var deskjs=require(_0x019a('0xb'));var toCsv=require(_0x019a('0x7'));var querystring=require(_0x019a('0xc'));var Papa=require('papaparse');var Redis=require(_0x019a('0xd'));var authService=require(_0x019a('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x019a('0xf'));var logger=require(_0x019a('0x10'))('api');var utils=require(_0x019a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x019a('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x019a('0x13'));var client=jayson[_0x019a('0x14')][_0x019a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2d31ed,_0x51327d,_0x2d6bc9,_0x5b1885){return new BPromise(function(_0x5ef9b6,_0x4172bf){var _0x573502=_0x5b1885||client;return _0x573502['request'](_0x2d31ed,_0x2d6bc9)[_0x019a('0x16')](function(_0x19fa6a){logger[_0x019a('0x17')](_0x019a('0x18'),_0x51327d,_0x019a('0x19'));logger['debug'](_0x019a('0x1a'),_0x51327d,'request\x20sent',JSON[_0x019a('0x1b')](_0x19fa6a));if(_0x19fa6a[_0x019a('0x1c')]){if(_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1d')]===0x1f4){logger['error'](_0x019a('0x18'),_0x51327d,_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);return _0x4172bf(_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x51327d,_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);return _0x5ef9b6(_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);}else{logger[_0x019a('0x17')](_0x019a('0x18'),_0x51327d,_0x019a('0x19'));_0x5ef9b6(_0x19fa6a[_0x019a('0x1f')][_0x019a('0x1e')]);}})['catch'](function(_0x95ea4d){logger[_0x019a('0x1c')](_0x019a('0x18'),_0x51327d,_0x95ea4d);_0x4172bf(_0x95ea4d);});});}function respondWithStatusCode(_0x261448,_0x1ba8ae){_0x1ba8ae=_0x1ba8ae||0xcc;return function(_0x263266){if(_0x263266){return _0x261448[_0x019a('0x20')](_0x1ba8ae);}return _0x261448[_0x019a('0x21')](_0x1ba8ae)[_0x019a('0x22')]();};}function respondWithResult(_0x2a92b9,_0x393f1a){_0x393f1a=_0x393f1a||0xc8;return function(_0x397b0f){if(_0x397b0f){return _0x2a92b9['status'](_0x393f1a)[_0x019a('0x23')](_0x397b0f);}};}function respondWithFilteredResult(_0x49029d,_0x3f8c5a){return function(_0x453ff5){if(_0x453ff5){var _0x29cae8=typeof _0x3f8c5a['offset']===_0x019a('0x24')&&typeof _0x3f8c5a['limit']===_0x019a('0x24');var _0x3ef36c=_0x453ff5['count'];var _0x58492d=_0x29cae8?0x0:_0x3f8c5a[_0x019a('0x25')];var _0x5557cf=_0x29cae8?_0x453ff5[_0x019a('0x26')]:_0x3f8c5a[_0x019a('0x25')]+_0x3f8c5a[_0x019a('0x27')];var _0x424849;if(_0x5557cf>=_0x3ef36c){_0x5557cf=_0x3ef36c;_0x424849=0xc8;}else{_0x424849=0xce;}_0x49029d[_0x019a('0x21')](_0x424849);return _0x49029d[_0x019a('0x28')](_0x019a('0x29'),_0x58492d+'-'+_0x5557cf+'/'+_0x3ef36c)[_0x019a('0x23')](_0x453ff5);}return null;};}function patchUpdates(_0x443729){return function(_0x1fe7a8){try{jsonpatch[_0x019a('0x2a')](_0x1fe7a8,_0x443729,!![]);}catch(_0x5e2e40){return BPromise[_0x019a('0x2b')](_0x5e2e40);}return _0x1fe7a8['save']();};}function saveUpdates(_0x3a4f5b,_0x44a647){return function(_0x794f44){if(_0x794f44){return _0x794f44['update'](_0x3a4f5b)[_0x019a('0x16')](function(_0x3257c6){return _0x3257c6;});}return null;};}function removeEntity(_0x4e79be,_0x34d043){return function(_0x5ff6a8){if(_0x5ff6a8){return _0x5ff6a8[_0x019a('0x2c')]()[_0x019a('0x16')](function(){var _0x3c7512=_0x5ff6a8[_0x019a('0x2d')]({'plain':!![]});var _0x2c96d6=_0x019a('0x2e');return db[_0x019a('0x2f')][_0x019a('0x2c')]({'where':{'type':_0x2c96d6,'resourceId':_0x3c7512['id']}})['then'](function(){return _0x5ff6a8;});})[_0x019a('0x16')](function(){_0x4e79be[_0x019a('0x21')](0xcc)[_0x019a('0x22')]();});}};}function handleEntityNotFound(_0xdefe6,_0x103084){return function(_0x2212cc){if(!_0x2212cc){_0xdefe6['sendStatus'](0x194);}return _0x2212cc;};}function handleError(_0x27ed4e,_0x4b9a80){_0x4b9a80=_0x4b9a80||0x1f4;return function(_0xfe89ed){logger[_0x019a('0x1c')](_0xfe89ed[_0x019a('0x30')]);if(_0xfe89ed[_0x019a('0x31')]){delete _0xfe89ed[_0x019a('0x31')];}_0x27ed4e['status'](_0x4b9a80)[_0x019a('0x32')](_0xfe89ed);};}exports[_0x019a('0x33')]=function(_0x325729,_0x42342a){var _0x138da0={},_0x5457d3={},_0x567bf9={'count':0x0,'rows':[]};var _0x55c5d5=_[_0x019a('0x34')](db[_0x019a('0x35')][_0x019a('0x36')],function(_0x1dfd21){return{'name':_0x1dfd21[_0x019a('0x37')],'type':_0x1dfd21[_0x019a('0x38')][_0x019a('0x39')]};});_0x5457d3[_0x019a('0x3a')]=_['map'](_0x55c5d5,_0x019a('0x31'));_0x5457d3[_0x019a('0x3b')]=_[_0x019a('0x3c')](_0x325729['query']);_0x5457d3[_0x019a('0x3d')]=_[_0x019a('0x3e')](_0x5457d3[_0x019a('0x3a')],_0x5457d3[_0x019a('0x3b')]);_0x138da0[_0x019a('0x3f')]=_['intersection'](_0x5457d3[_0x019a('0x3a')],qs[_0x019a('0x40')](_0x325729['query'][_0x019a('0x40')]));_0x138da0['attributes']=_0x138da0[_0x019a('0x3f')]['length']?_0x138da0[_0x019a('0x3f')]:_0x5457d3[_0x019a('0x3a')];if(!_0x325729['query']['hasOwnProperty']('nolimit')){_0x138da0['limit']=qs['limit'](_0x325729[_0x019a('0x3b')]['limit']);_0x138da0[_0x019a('0x25')]=qs[_0x019a('0x25')](_0x325729['query'][_0x019a('0x25')]);}_0x138da0[_0x019a('0x41')]=qs[_0x019a('0x42')](_0x325729[_0x019a('0x3b')]['sort']);_0x138da0[_0x019a('0x43')]=qs[_0x019a('0x3d')](_[_0x019a('0x44')](_0x325729['query'],_0x5457d3['filters']),_0x55c5d5);if(_0x325729['query'][_0x019a('0x45')]){_0x138da0[_0x019a('0x43')]=_['merge'](_0x138da0['where'],{'$or':_[_0x019a('0x34')](_0x55c5d5,function(_0x17446d){if(_0x17446d['type']!==_0x019a('0x46')){var _0x8506bd={};_0x8506bd[_0x17446d['name']]={'$like':'%'+_0x325729[_0x019a('0x3b')]['filter']+'%'};return _0x8506bd;}})});}_0x138da0=_['merge']({},_0x138da0,_0x325729[_0x019a('0x47')]);var _0x362f31={'where':_0x138da0[_0x019a('0x43')]};return db[_0x019a('0x35')][_0x019a('0x26')](_0x362f31)[_0x019a('0x16')](function(_0x399e51){_0x567bf9['count']=_0x399e51;if(_0x325729['query'][_0x019a('0x48')]){_0x138da0[_0x019a('0x49')]=[{'all':!![]}];}return db[_0x019a('0x35')][_0x019a('0x4a')](_0x138da0);})[_0x019a('0x16')](function(_0x35a901){_0x567bf9[_0x019a('0x4b')]=_0x35a901;return _0x567bf9;})[_0x019a('0x16')](respondWithFilteredResult(_0x42342a,_0x138da0))[_0x019a('0x4c')](handleError(_0x42342a,null));};exports[_0x019a('0x4d')]=function(_0x5961fb,_0x348295){var _0x4fc9d9={'raw':![],'where':{'id':_0x5961fb[_0x019a('0x4e')]['id']}},_0x5f2250={};_0x5f2250[_0x019a('0x3a')]=_['keys'](db[_0x019a('0x35')]['rawAttributes']);_0x5f2250['query']=_[_0x019a('0x3c')](_0x5961fb['query']);_0x5f2250[_0x019a('0x3d')]=_[_0x019a('0x3e')](_0x5f2250[_0x019a('0x3a')],_0x5f2250[_0x019a('0x3b')]);_0x4fc9d9[_0x019a('0x3f')]=_['intersection'](_0x5f2250[_0x019a('0x3a')],qs['fields'](_0x5961fb[_0x019a('0x3b')][_0x019a('0x40')]));_0x4fc9d9['attributes']=_0x4fc9d9[_0x019a('0x3f')][_0x019a('0x4f')]?_0x4fc9d9['attributes']:_0x5f2250[_0x019a('0x3a')];if(_0x5961fb['query']['includeAll']){_0x4fc9d9[_0x019a('0x49')]=[{'all':!![]}];}_0x4fc9d9=_[_0x019a('0x50')]({},_0x4fc9d9,_0x5961fb[_0x019a('0x47')]);return db[_0x019a('0x35')][_0x019a('0x51')](_0x4fc9d9)[_0x019a('0x16')](handleEntityNotFound(_0x348295,null))[_0x019a('0x16')](respondWithResult(_0x348295,null))[_0x019a('0x4c')](handleError(_0x348295,null));};exports[_0x019a('0x52')]=function(_0x18a75a,_0x19fb50,_0x289b70){var _0x31c0cd;return db['VoiceContext'][_0x019a('0x52')](_0x18a75a[_0x019a('0x53')],{'raw':!![]})[_0x019a('0x16')](function(_0x3715d8){_0x31c0cd=_0x3715d8;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x4a4eb7){var _0x229ae2=fs[_0x019a('0x54')](path[_0x019a('0x55')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x542b98=ejs['render'](_0x229ae2,{'contexts':_0x4a4eb7||[]});fs[_0x019a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x542b98);})['then'](function(){return respondWithRpcPromise(_0x019a('0x57'),_0x019a('0x52'),{'module':_0x019a('0x58')});})['then'](function(){var _0x3fa90d=_0x18a75a['user'][_0x019a('0x2d')]({'plain':!![]});if(!_0x3fa90d)throw new Error(_0x019a('0x59'));if(_0x3fa90d[_0x019a('0x5a')]===_0x019a('0x5b')){var _0x265c38=_0x31c0cd[_0x019a('0x2d')]({'plain':!![]});return db[_0x019a('0x5c')][_0x019a('0x51')]({'where':{'name':_0x019a('0x2e'),'userProfileId':_0x3fa90d['userProfileId']},'raw':!![]})[_0x019a('0x16')](function(_0x26e925){if(_0x26e925&&_0x26e925[_0x019a('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x265c38[_0x019a('0x31')],'resourceId':_0x265c38['id'],'type':_0x26e925['name'],'sectionId':_0x26e925['id']},{})['then'](function(){return _0x31c0cd;});}else{return _0x31c0cd;}})[_0x019a('0x4c')](function(_0x2dbfb6){logger[_0x019a('0x1c')](_0x019a('0x5e'),_0x2dbfb6);throw _0x2dbfb6;});}return _0x31c0cd;})['then'](respondWithResult(_0x19fb50,0xc9))[_0x019a('0x4c')](handleError(_0x19fb50,null));};exports[_0x019a('0x5f')]=function(_0x1cf363,_0x15a71a,_0x49cdab){var _0x1ab3a5;return db[_0x019a('0x35')]['find']({'where':{'id':_0x1cf363[_0x019a('0x4e')]['id']}})[_0x019a('0x16')](handleEntityNotFound(_0x15a71a,null))[_0x019a('0x16')](saveUpdates(_0x1cf363[_0x019a('0x53')],null))[_0x019a('0x16')](function(_0x25d3a8){if(_0x25d3a8){_0x1ab3a5=_0x25d3a8;return db['VoiceContext'][_0x019a('0x4a')]({'raw':!![]});}})[_0x019a('0x16')](function(_0x4eaa6d){var _0x2fc5af=fs[_0x019a('0x54')](path[_0x019a('0x55')](config['root'],_0x019a('0x60')),'utf8');var _0x3ab648=ejs['render'](_0x2fc5af,{'contexts':_0x4eaa6d||[]});fs[_0x019a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ab648);})[_0x019a('0x16')](function(){return respondWithRpcPromise(_0x019a('0x57'),_0x019a('0x5f'),{'module':'chan_sip.so'});})[_0x019a('0x16')](function(){return _0x1ab3a5;})[_0x019a('0x16')](respondWithResult(_0x15a71a,null))[_0x019a('0x4c')](handleError(_0x15a71a,null));};exports[_0x019a('0x2c')]=function(_0x2f79a0,_0x14500c,_0x12a7ff){var _0x3e1989;return db[_0x019a('0x35')][_0x019a('0x51')]({'where':{'id':_0x2f79a0[_0x019a('0x4e')]['id']}})[_0x019a('0x16')](handleEntityNotFound(_0x14500c,null))['then'](removeEntity(_0x14500c,null))[_0x019a('0x16')](function(){return db[_0x019a('0x35')]['findAll']({'raw':!![]});})['then'](function(_0x2ad7c9){var _0x4adead=fs['readFileSync'](path['join'](config['root'],_0x019a('0x60')),_0x019a('0x61'));var _0xe38c0b=ejs[_0x019a('0x62')](_0x4adead,{'contexts':_0x2ad7c9});fs[_0x019a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xe38c0b);return respondWithRpcPromise(_0x019a('0x57'),'destroy',{'module':_0x019a('0x58')});})[_0x019a('0x4c')](handleError(_0x14500c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 812fa65..f95f0b6 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 _0xe4f6=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','VoiceContext','voice_contexts'];(function(_0x5781be,_0x221217){var _0x1e42f5=function(_0x87bd22){while(--_0x87bd22){_0x5781be['push'](_0x5781be['shift']());}};_0x1e42f5(++_0x221217);}(_0xe4f6,0x19a));var _0x6e4f=function(_0x26edc3,_0x2c2c05){_0x26edc3=_0x26edc3-0x0;var _0x361156=_0xe4f6[_0x26edc3];return _0x361156;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e4f('0x0'))(_0x6e4f('0x1'));var moment=require(_0x6e4f('0x2'));var BPromise=require(_0x6e4f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e4f('0x4'));var rimraf=require(_0x6e4f('0x5'));var config=require(_0x6e4f('0x6'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x547e1e,_0x49dd80){return _0x547e1e[_0x6e4f('0x7')](_0x6e4f('0x8'),attributes,{'tableName':_0x6e4f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaca0=['VoiceContext','voice_contexts','util','../../config/logger','path','../../config/environment','./voiceContext.attributes','exports'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0xaca0,0xd2));var _0x0aca=function(_0xd94a00,_0x3170b5){_0xd94a00=_0xd94a00-0x0;var _0x2d7678=_0xaca0[_0xd94a00];return _0x2d7678;};'use strict';var _=require('lodash');var util=require(_0x0aca('0x0'));var logger=require(_0x0aca('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aca('0x2'));var rimraf=require('rimraf');var config=require(_0x0aca('0x3'));var attributes=require(_0x0aca('0x4'));module[_0x0aca('0x5')]=function(_0x3447d9,_0x460470){return _0x3447d9['define'](_0x0aca('0x6'),attributes,{'tableName':_0x0aca('0x7'),'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 aec2cfc..ea30503 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 _0x1d0d=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x53a96c,_0x2d767f){var _0x275df5=function(_0x486e2b){while(--_0x486e2b){_0x53a96c['push'](_0x53a96c['shift']());}};_0x275df5(++_0x2d767f);}(_0x1d0d,0x183));var _0xd1d0=function(_0x1a853f,_0x8b6f21){_0x1a853f=_0x1a853f-0x0;var _0x21df8b=_0x1d0d[_0x1a853f];return _0x21df8b;};'use strict';var _=require('lodash');var util=require(_0xd1d0('0x0'));var moment=require(_0xd1d0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd1d0('0x2'));var logger=require(_0xd1d0('0x3'))(_0xd1d0('0x4'));var config=require(_0xd1d0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd1d0('0x6')][_0xd1d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18f081,_0xa70f9e,_0x439a3c){return new BPromise(function(_0x76e53f,_0x271c1a){return client['request'](_0x18f081,_0x439a3c)['then'](function(_0x4988a1){logger[_0xd1d0('0x8')]('VoiceContext,\x20%s,\x20%s',_0xa70f9e,_0xd1d0('0x9'));logger[_0xd1d0('0xa')](_0xd1d0('0xb'),_0xa70f9e,_0xd1d0('0x9'),JSON[_0xd1d0('0xc')](_0x4988a1));if(_0x4988a1[_0xd1d0('0xd')]){if(_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0xe')]===0x1f4){logger['error'](_0xd1d0('0xf'),_0xa70f9e,_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0x10')]);return _0x271c1a(_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0x10')]);}logger[_0xd1d0('0xd')](_0xd1d0('0xf'),_0xa70f9e,_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0x10')]);return _0x76e53f(_0x4988a1['error'][_0xd1d0('0x10')]);}else{logger[_0xd1d0('0x8')](_0xd1d0('0xf'),_0xa70f9e,'request\x20sent');_0x76e53f(_0x4988a1[_0xd1d0('0x11')]['message']);}})[_0xd1d0('0x12')](function(_0x4becb1){logger[_0xd1d0('0xd')](_0xd1d0('0xf'),_0xa70f9e,_0x4becb1);_0x271c1a(_0x4becb1);});});} \ No newline at end of file +var _0xeb3e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x88ae6c,_0x368fab){var _0x489e13=function(_0x3c85fb){while(--_0x3c85fb){_0x88ae6c['push'](_0x88ae6c['shift']());}};_0x489e13(++_0x368fab);}(_0xeb3e,0x106));var _0xeeb3=function(_0x329a33,_0x585897){_0x329a33=_0x329a33-0x0;var _0x2bef80=_0xeb3e[_0x329a33];return _0x2bef80;};'use strict';var _=require('lodash');var util=require(_0xeeb3('0x0'));var moment=require(_0xeeb3('0x1'));var BPromise=require(_0xeeb3('0x2'));var rs=require(_0xeeb3('0x3'));var fs=require('fs');var Redis=require(_0xeeb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeb3('0x5'));var logger=require(_0xeeb3('0x6'))(_0xeeb3('0x7'));var config=require('../../config/environment');var jayson=require(_0xeeb3('0x8'));var client=jayson['client'][_0xeeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93c82b,_0x2d1912,_0x435925){return new BPromise(function(_0x12be76,_0x959ad3){return client[_0xeeb3('0xa')](_0x93c82b,_0x435925)['then'](function(_0x5b751a){logger[_0xeeb3('0xb')](_0xeeb3('0xc'),_0x2d1912,_0xeeb3('0xd'));logger['debug'](_0xeeb3('0xe'),_0x2d1912,'request\x20sent',JSON['stringify'](_0x5b751a));if(_0x5b751a[_0xeeb3('0xf')]){if(_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x10')]===0x1f4){logger['error'](_0xeeb3('0xc'),_0x2d1912,_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x11')]);return _0x959ad3(_0x5b751a[_0xeeb3('0xf')]['message']);}logger['error'](_0xeeb3('0xc'),_0x2d1912,_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x11')]);return _0x12be76(_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x11')]);}else{logger[_0xeeb3('0xb')](_0xeeb3('0xc'),_0x2d1912,_0xeeb3('0xd'));_0x12be76(_0x5b751a[_0xeeb3('0x12')][_0xeeb3('0x11')]);}})[_0xeeb3('0x13')](function(_0x4f4f8b){logger[_0xeeb3('0xf')](_0xeeb3('0xc'),_0x2d1912,_0x4f4f8b);_0x959ad3(_0x4f4f8b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f4bf258..0f44670 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 _0x26c2=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','connect-timeout','express'];(function(_0x1ed46f,_0x7691d7){var _0x43b931=function(_0x5f2454){while(--_0x5f2454){_0x1ed46f['push'](_0x1ed46f['shift']());}};_0x43b931(++_0x7691d7);}(_0x26c2,0x130));var _0x226c=function(_0x4cd0ce,_0x46275a){_0x4cd0ce=_0x4cd0ce-0x0;var _0xfb9201=_0x26c2[_0x4cd0ce];return _0xfb9201;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x226c('0x0'));var express=require(_0x226c('0x1'));var router=express[_0x226c('0x2')]();var fs_extra=require(_0x226c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x226c('0x4'));var config=require(_0x226c('0x5'));var controller=require('./voiceDialReport.controller');router[_0x226c('0x6')]('/',auth[_0x226c('0x7')](),controller[_0x226c('0x8')]);router[_0x226c('0x6')](_0x226c('0x9'),auth['isAuthenticated'](),controller[_0x226c('0xa')]);router[_0x226c('0x6')](_0x226c('0xb'),auth[_0x226c('0x7')](),controller[_0x226c('0xc')]);router['post']('/',auth[_0x226c('0x7')](),controller[_0x226c('0xd')]);router['put']('/:id',auth[_0x226c('0x7')](),controller[_0x226c('0xe')]);router[_0x226c('0xf')](_0x226c('0xb'),auth[_0x226c('0x7')](),controller[_0x226c('0x10')]);module[_0x226c('0x11')]=router; \ No newline at end of file +var _0x4c95=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4c95,0x180));var _0x54c9=function(_0xac2868,_0x553923){_0xac2868=_0xac2868-0x0;var _0x43ed0d=_0x4c95[_0xac2868];return _0x43ed0d;};'use strict';var multer=require(_0x54c9('0x0'));var util=require(_0x54c9('0x1'));var path=require(_0x54c9('0x2'));var timeout=require(_0x54c9('0x3'));var express=require(_0x54c9('0x4'));var router=express[_0x54c9('0x5')]();var fs_extra=require(_0x54c9('0x6'));var auth=require(_0x54c9('0x7'));var interaction=require(_0x54c9('0x8'));var config=require(_0x54c9('0x9'));var controller=require('./voiceDialReport.controller');router[_0x54c9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x54c9('0xa')](_0x54c9('0xb'),auth[_0x54c9('0xc')](),controller[_0x54c9('0xd')]);router[_0x54c9('0xa')](_0x54c9('0xe'),auth[_0x54c9('0xc')](),controller['show']);router['post']('/',auth[_0x54c9('0xc')](),controller[_0x54c9('0xf')]);router[_0x54c9('0x10')](_0x54c9('0xe'),auth[_0x54c9('0xc')](),controller['update']);router[_0x54c9('0x11')](_0x54c9('0xe'),auth[_0x54c9('0xc')](),controller[_0x54c9('0x12')]);module[_0x54c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c523e9e..e3b8748 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x56b222,_0x43f86e){var _0x341af1=function(_0x566c0a){while(--_0x566c0a){_0x56b222['push'](_0x56b222['shift']());}};_0x341af1(++_0x43f86e);}(_0x9a19,0x114));var _0x99a1=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x9a19[_0x547add];return _0x2ed1f3;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x32405a,_0x2d7ff){var _0xd56cbe=function(_0x96f490){while(--_0x96f490){_0x32405a['push'](_0x32405a['shift']());}};_0xd56cbe(++_0x2d7ff);}(_0x55ca,0x126));var _0xa55c=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0x55ca[_0x1c6efd];return _0x53a918;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1207dbc..b87c326 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 _0x865c=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','VoiceDialReport','includeAll','findAll','catch','show','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x486876,_0x5dfa23){var _0x13523e=function(_0x2f05fb){while(--_0x2f05fb){_0x486876['push'](_0x486876['shift']());}};_0x13523e(++_0x5dfa23);}(_0x865c,0x194));var _0xc865=function(_0x38a7ff,_0x5239a4){_0x38a7ff=_0x38a7ff-0x0;var _0x1a0a57=_0x865c[_0x38a7ff];return _0x1a0a57;};'use strict';var emlformat=require(_0xc865('0x0'));var rimraf=require(_0xc865('0x1'));var zipdir=require(_0xc865('0x2'));var jsonpatch=require(_0xc865('0x3'));var rp=require(_0xc865('0x4'));var moment=require(_0xc865('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc865('0x6'));var util=require('util');var path=require(_0xc865('0x7'));var sox=require(_0xc865('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc865('0x9'));var squel=require('squel');var crypto=require(_0xc865('0xa'));var jsforce=require(_0xc865('0xb'));var deskjs=require(_0xc865('0xc'));var toCsv=require(_0xc865('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc865('0xe'));var authService=require(_0xc865('0xf'));var qs=require(_0xc865('0x10'));var as=require(_0xc865('0x11'));var hardwareService=require(_0xc865('0x12'));var logger=require(_0xc865('0x13'))(_0xc865('0x14'));var utils=require(_0xc865('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc865('0x16'));var db=require(_0xc865('0x17'))['db'];function respondWithStatusCode(_0x235404,_0x4387bd){_0x4387bd=_0x4387bd||0xcc;return function(_0x117e1b){if(_0x117e1b){return _0x235404[_0xc865('0x18')](_0x4387bd);}return _0x235404[_0xc865('0x19')](_0x4387bd)['end']();};}function respondWithResult(_0x4d9706,_0x15d216){_0x15d216=_0x15d216||0xc8;return function(_0x4d309f){if(_0x4d309f){return _0x4d9706[_0xc865('0x19')](_0x15d216)[_0xc865('0x1a')](_0x4d309f);}};}function respondWithFilteredResult(_0x14c7b4,_0x37b5c7){return function(_0x10e0bf){if(_0x10e0bf){var _0x49f08a=typeof _0x37b5c7['offset']==='undefined'&&typeof _0x37b5c7['limit']===_0xc865('0x1b');var _0x14e93c=_0x10e0bf[_0xc865('0x1c')];var _0x3b05e0=_0x49f08a?0x0:_0x37b5c7[_0xc865('0x1d')];var _0x171efc=_0x49f08a?_0x10e0bf['count']:_0x37b5c7[_0xc865('0x1d')]+_0x37b5c7[_0xc865('0x1e')];var _0x3b3027;if(_0x171efc>=_0x14e93c){_0x171efc=_0x14e93c;_0x3b3027=0xc8;}else{_0x3b3027=0xce;}_0x14c7b4[_0xc865('0x19')](_0x3b3027);return _0x14c7b4['set'](_0xc865('0x1f'),_0x3b05e0+'-'+_0x171efc+'/'+_0x14e93c)[_0xc865('0x1a')](_0x10e0bf);}return null;};}function patchUpdates(_0x17952e){return function(_0xc85b4c){try{jsonpatch[_0xc865('0x20')](_0xc85b4c,_0x17952e,!![]);}catch(_0x567a6b){return BPromise[_0xc865('0x21')](_0x567a6b);}return _0xc85b4c[_0xc865('0x22')]();};}function saveUpdates(_0x326da9,_0x370170){return function(_0xcaab0c){if(_0xcaab0c){return _0xcaab0c['update'](_0x326da9)[_0xc865('0x23')](function(_0x5bc09c){return _0x5bc09c;});}return null;};}function removeEntity(_0xb45c52,_0x2a16b5){return function(_0x3f0ee2){if(_0x3f0ee2){return _0x3f0ee2[_0xc865('0x24')]()[_0xc865('0x23')](function(){_0xb45c52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x532919,_0x1dcc2e){return function(_0x5f43bf){if(!_0x5f43bf){_0x532919[_0xc865('0x18')](0x194);}return _0x5f43bf;};}function handleError(_0x5babc6,_0x2adc6e){_0x2adc6e=_0x2adc6e||0x1f4;return function(_0x311772){logger[_0xc865('0x25')](_0x311772[_0xc865('0x26')]);if(_0x311772[_0xc865('0x27')]){delete _0x311772[_0xc865('0x27')];}_0x5babc6['status'](_0x2adc6e)[_0xc865('0x28')](_0x311772);};}exports[_0xc865('0x29')]=function(_0x3a7740,_0xc1e228){var _0x138107={},_0x3a3ad1={},_0x26b262={'count':0x0,'rows':[]};var _0x5cea70=_[_0xc865('0x2a')](db['VoiceDialReport'][_0xc865('0x2b')],function(_0x5d4d24){return{'name':_0x5d4d24[_0xc865('0x2c')],'type':_0x5d4d24[_0xc865('0x2d')][_0xc865('0x2e')]};});_0x3a3ad1[_0xc865('0x2f')]=_[_0xc865('0x2a')](_0x5cea70,_0xc865('0x27'));_0x3a3ad1[_0xc865('0x30')]=_[_0xc865('0x31')](_0x3a7740[_0xc865('0x30')]);_0x3a3ad1[_0xc865('0x32')]=_[_0xc865('0x33')](_0x3a3ad1[_0xc865('0x2f')],_0x3a3ad1[_0xc865('0x30')]);_0x138107[_0xc865('0x34')]=_[_0xc865('0x33')](_0x3a3ad1[_0xc865('0x2f')],qs[_0xc865('0x35')](_0x3a7740['query']['fields']));_0x138107[_0xc865('0x34')]=_0x138107['attributes'][_0xc865('0x36')]?_0x138107[_0xc865('0x34')]:_0x3a3ad1[_0xc865('0x2f')];if(!_0x3a7740[_0xc865('0x30')][_0xc865('0x37')](_0xc865('0x38'))){_0x138107[_0xc865('0x1e')]=qs[_0xc865('0x1e')](_0x3a7740[_0xc865('0x30')][_0xc865('0x1e')]);_0x138107[_0xc865('0x1d')]=qs[_0xc865('0x1d')](_0x3a7740[_0xc865('0x30')][_0xc865('0x1d')]);}_0x138107[_0xc865('0x39')]=qs[_0xc865('0x3a')](_0x3a7740[_0xc865('0x30')][_0xc865('0x3a')]);_0x138107['where']=qs[_0xc865('0x32')](_['pick'](_0x3a7740[_0xc865('0x30')],_0x3a3ad1['filters']),_0x5cea70);if(_0x3a7740[_0xc865('0x30')][_0xc865('0x3b')]){_0x138107[_0xc865('0x3c')]=_[_0xc865('0x3d')](_0x138107['where'],{'$or':_[_0xc865('0x2a')](_0x5cea70,function(_0x5dc275){if(_0x5dc275[_0xc865('0x2d')]!==_0xc865('0x3e')){var _0x52db8b={};_0x52db8b[_0x5dc275['name']]={'$like':'%'+_0x3a7740[_0xc865('0x30')][_0xc865('0x3b')]+'%'};return _0x52db8b;}})});}_0x138107=_[_0xc865('0x3d')]({},_0x138107,_0x3a7740[_0xc865('0x3f')]);var _0xad2b5e={'where':_0x138107[_0xc865('0x3c')]};return db[_0xc865('0x40')]['count'](_0xad2b5e)['then'](function(_0xf631f){_0x26b262[_0xc865('0x1c')]=_0xf631f;if(_0x3a7740[_0xc865('0x30')][_0xc865('0x41')]){_0x138107['include']=[{'all':!![]}];}return db[_0xc865('0x40')][_0xc865('0x42')](_0x138107);})[_0xc865('0x23')](function(_0x1bf5bd){_0x26b262['rows']=_0x1bf5bd;return _0x26b262;})[_0xc865('0x23')](respondWithFilteredResult(_0xc1e228,_0x138107))[_0xc865('0x43')](handleError(_0xc1e228,null));};exports[_0xc865('0x44')]=function(_0x5bf116,_0x371dc9){var _0x469306={'raw':!![],'where':{'id':_0x5bf116['params']['id']}},_0x114600={};_0x114600[_0xc865('0x2f')]=_[_0xc865('0x31')](db['VoiceDialReport']['rawAttributes']);_0x114600[_0xc865('0x30')]=_['keys'](_0x5bf116['query']);_0x114600['filters']=_[_0xc865('0x33')](_0x114600[_0xc865('0x2f')],_0x114600[_0xc865('0x30')]);_0x469306[_0xc865('0x34')]=_[_0xc865('0x33')](_0x114600[_0xc865('0x2f')],qs['fields'](_0x5bf116['query']['fields']));_0x469306[_0xc865('0x34')]=_0x469306[_0xc865('0x34')][_0xc865('0x36')]?_0x469306['attributes']:_0x114600[_0xc865('0x2f')];if(_0x5bf116[_0xc865('0x30')][_0xc865('0x41')]){_0x469306[_0xc865('0x45')]=[{'all':!![]}];}_0x469306=_[_0xc865('0x3d')]({},_0x469306,_0x5bf116['options']);return db[_0xc865('0x40')][_0xc865('0x46')](_0x469306)[_0xc865('0x23')](handleEntityNotFound(_0x371dc9,null))[_0xc865('0x23')](respondWithResult(_0x371dc9,null))[_0xc865('0x43')](handleError(_0x371dc9,null));};exports[_0xc865('0x47')]=function(_0x4cbb70,_0x3043ea){return db[_0xc865('0x40')]['create'](_0x4cbb70[_0xc865('0x48')],{})[_0xc865('0x23')](respondWithResult(_0x3043ea,0xc9))[_0xc865('0x43')](handleError(_0x3043ea,null));};exports[_0xc865('0x49')]=function(_0x2d288,_0x2ef7bd){if(_0x2d288['body']['id']){delete _0x2d288[_0xc865('0x48')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x2d288[_0xc865('0x4a')]['id']}})[_0xc865('0x23')](handleEntityNotFound(_0x2ef7bd,null))[_0xc865('0x23')](saveUpdates(_0x2d288['body'],null))[_0xc865('0x23')](respondWithResult(_0x2ef7bd,null))[_0xc865('0x43')](handleError(_0x2ef7bd,null));};exports[_0xc865('0x24')]=function(_0x1fa97d,_0x22f2a2){return db[_0xc865('0x40')][_0xc865('0x46')]({'where':{'id':_0x1fa97d['params']['id']}})[_0xc865('0x23')](handleEntityNotFound(_0x22f2a2,null))[_0xc865('0x23')](removeEntity(_0x22f2a2,null))[_0xc865('0x43')](handleError(_0x22f2a2,null));};exports[_0xc865('0x4b')]=function(_0x3b0c2c,_0xed111f){return db['VoiceDialReport'][_0xc865('0x4b')]()[_0xc865('0x23')](respondWithResult(_0xed111f,null))['catch'](handleError(_0xed111f,null));}; \ No newline at end of file +var _0x66db=['moment','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','map','VoiceDialReport','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x66db,0xc9));var _0xb66d=function(_0x31cd63,_0x40d133){_0x31cd63=_0x31cd63-0x0;var _0x5a0f97=_0x66db[_0x31cd63];return _0x5a0f97;};'use strict';var emlformat=require(_0xb66d('0x0'));var rimraf=require(_0xb66d('0x1'));var zipdir=require(_0xb66d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb66d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb66d('0x4'));var sox=require(_0xb66d('0x5'));var csv=require(_0xb66d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb66d('0x7'));var _=require('lodash');var squel=require(_0xb66d('0x8'));var crypto=require(_0xb66d('0x9'));var jsforce=require(_0xb66d('0xa'));var deskjs=require(_0xb66d('0xb'));var toCsv=require(_0xb66d('0x6'));var querystring=require(_0xb66d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb66d('0xd'));var qs=require(_0xb66d('0xe'));var as=require(_0xb66d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb66d('0x10'));var utils=require('../../config/utils');var config=require(_0xb66d('0x11'));var licenseUtil=require(_0xb66d('0x12'));var db=require(_0xb66d('0x13'))['db'];function respondWithStatusCode(_0x188f93,_0x1b346f){_0x1b346f=_0x1b346f||0xcc;return function(_0x2f945f){if(_0x2f945f){return _0x188f93[_0xb66d('0x14')](_0x1b346f);}return _0x188f93[_0xb66d('0x15')](_0x1b346f)['end']();};}function respondWithResult(_0xe8b100,_0x4ecc0c){_0x4ecc0c=_0x4ecc0c||0xc8;return function(_0x3f38a7){if(_0x3f38a7){return _0xe8b100[_0xb66d('0x15')](_0x4ecc0c)[_0xb66d('0x16')](_0x3f38a7);}};}function respondWithFilteredResult(_0x2fa729,_0x179253){return function(_0xfd7678){if(_0xfd7678){var _0x3481c3=typeof _0x179253[_0xb66d('0x17')]===_0xb66d('0x18')&&typeof _0x179253[_0xb66d('0x19')]===_0xb66d('0x18');var _0x252b21=_0xfd7678[_0xb66d('0x1a')];var _0x38d51d=_0x3481c3?0x0:_0x179253[_0xb66d('0x17')];var _0x317ed9=_0x3481c3?_0xfd7678[_0xb66d('0x1a')]:_0x179253['offset']+_0x179253[_0xb66d('0x19')];var _0x5fb37a;if(_0x317ed9>=_0x252b21){_0x317ed9=_0x252b21;_0x5fb37a=0xc8;}else{_0x5fb37a=0xce;}_0x2fa729[_0xb66d('0x15')](_0x5fb37a);return _0x2fa729[_0xb66d('0x1b')](_0xb66d('0x1c'),_0x38d51d+'-'+_0x317ed9+'/'+_0x252b21)[_0xb66d('0x16')](_0xfd7678);}return null;};}function patchUpdates(_0x48b7e5){return function(_0x30563c){try{jsonpatch[_0xb66d('0x1d')](_0x30563c,_0x48b7e5,!![]);}catch(_0x47daed){return BPromise[_0xb66d('0x1e')](_0x47daed);}return _0x30563c[_0xb66d('0x1f')]();};}function saveUpdates(_0x15a99d,_0x218246){return function(_0x276d24){if(_0x276d24){return _0x276d24[_0xb66d('0x20')](_0x15a99d)[_0xb66d('0x21')](function(_0x2e4a87){return _0x2e4a87;});}return null;};}function removeEntity(_0xa2422f,_0x4f3d57){return function(_0x444487){if(_0x444487){return _0x444487['destroy']()[_0xb66d('0x21')](function(){_0xa2422f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176525,_0x54da98){return function(_0x35997c){if(!_0x35997c){_0x176525[_0xb66d('0x14')](0x194);}return _0x35997c;};}function handleError(_0x68bd61,_0x3cf5d9){_0x3cf5d9=_0x3cf5d9||0x1f4;return function(_0x10555a){logger[_0xb66d('0x22')](_0x10555a['stack']);if(_0x10555a[_0xb66d('0x23')]){delete _0x10555a[_0xb66d('0x23')];}_0x68bd61['status'](_0x3cf5d9)['send'](_0x10555a);};}exports['index']=function(_0x1f0479,_0x143003){var _0x31efab={},_0x3c43f2={},_0x10df42={'count':0x0,'rows':[]};var _0x58e6fe=_[_0xb66d('0x24')](db[_0xb66d('0x25')]['rawAttributes'],function(_0x26b63e){return{'name':_0x26b63e[_0xb66d('0x26')],'type':_0x26b63e[_0xb66d('0x27')]['key']};});_0x3c43f2['model']=_[_0xb66d('0x24')](_0x58e6fe,_0xb66d('0x23'));_0x3c43f2[_0xb66d('0x28')]=_['keys'](_0x1f0479[_0xb66d('0x28')]);_0x3c43f2[_0xb66d('0x29')]=_['intersection'](_0x3c43f2[_0xb66d('0x2a')],_0x3c43f2['query']);_0x31efab[_0xb66d('0x2b')]=_[_0xb66d('0x2c')](_0x3c43f2[_0xb66d('0x2a')],qs[_0xb66d('0x2d')](_0x1f0479[_0xb66d('0x28')][_0xb66d('0x2d')]));_0x31efab['attributes']=_0x31efab[_0xb66d('0x2b')][_0xb66d('0x2e')]?_0x31efab[_0xb66d('0x2b')]:_0x3c43f2['model'];if(!_0x1f0479[_0xb66d('0x28')][_0xb66d('0x2f')]('nolimit')){_0x31efab[_0xb66d('0x19')]=qs[_0xb66d('0x19')](_0x1f0479[_0xb66d('0x28')]['limit']);_0x31efab[_0xb66d('0x17')]=qs['offset'](_0x1f0479[_0xb66d('0x28')][_0xb66d('0x17')]);}_0x31efab['order']=qs['sort'](_0x1f0479[_0xb66d('0x28')][_0xb66d('0x30')]);_0x31efab[_0xb66d('0x31')]=qs[_0xb66d('0x29')](_[_0xb66d('0x32')](_0x1f0479[_0xb66d('0x28')],_0x3c43f2['filters']),_0x58e6fe);if(_0x1f0479[_0xb66d('0x28')][_0xb66d('0x33')]){_0x31efab[_0xb66d('0x31')]=_[_0xb66d('0x34')](_0x31efab['where'],{'$or':_[_0xb66d('0x24')](_0x58e6fe,function(_0x3d9f05){if(_0x3d9f05[_0xb66d('0x27')]!==_0xb66d('0x35')){var _0x291131={};_0x291131[_0x3d9f05[_0xb66d('0x23')]]={'$like':'%'+_0x1f0479[_0xb66d('0x28')][_0xb66d('0x33')]+'%'};return _0x291131;}})});}_0x31efab=_[_0xb66d('0x34')]({},_0x31efab,_0x1f0479[_0xb66d('0x36')]);var _0x2e45eb={'where':_0x31efab['where']};return db[_0xb66d('0x25')][_0xb66d('0x1a')](_0x2e45eb)[_0xb66d('0x21')](function(_0x51c3f8){_0x10df42[_0xb66d('0x1a')]=_0x51c3f8;if(_0x1f0479[_0xb66d('0x28')][_0xb66d('0x37')]){_0x31efab[_0xb66d('0x38')]=[{'all':!![]}];}return db[_0xb66d('0x25')][_0xb66d('0x39')](_0x31efab);})[_0xb66d('0x21')](function(_0x458e8e){_0x10df42['rows']=_0x458e8e;return _0x10df42;})[_0xb66d('0x21')](respondWithFilteredResult(_0x143003,_0x31efab))[_0xb66d('0x3a')](handleError(_0x143003,null));};exports[_0xb66d('0x3b')]=function(_0x5b920c,_0x26584f){var _0x375fcc={'raw':!![],'where':{'id':_0x5b920c['params']['id']}},_0x38b5ff={};_0x38b5ff['model']=_[_0xb66d('0x3c')](db['VoiceDialReport'][_0xb66d('0x3d')]);_0x38b5ff['query']=_[_0xb66d('0x3c')](_0x5b920c[_0xb66d('0x28')]);_0x38b5ff['filters']=_[_0xb66d('0x2c')](_0x38b5ff[_0xb66d('0x2a')],_0x38b5ff[_0xb66d('0x28')]);_0x375fcc[_0xb66d('0x2b')]=_['intersection'](_0x38b5ff[_0xb66d('0x2a')],qs[_0xb66d('0x2d')](_0x5b920c[_0xb66d('0x28')][_0xb66d('0x2d')]));_0x375fcc[_0xb66d('0x2b')]=_0x375fcc[_0xb66d('0x2b')][_0xb66d('0x2e')]?_0x375fcc[_0xb66d('0x2b')]:_0x38b5ff[_0xb66d('0x2a')];if(_0x5b920c[_0xb66d('0x28')][_0xb66d('0x37')]){_0x375fcc[_0xb66d('0x38')]=[{'all':!![]}];}_0x375fcc=_[_0xb66d('0x34')]({},_0x375fcc,_0x5b920c[_0xb66d('0x36')]);return db[_0xb66d('0x25')][_0xb66d('0x3e')](_0x375fcc)['then'](handleEntityNotFound(_0x26584f,null))['then'](respondWithResult(_0x26584f,null))['catch'](handleError(_0x26584f,null));};exports[_0xb66d('0x3f')]=function(_0x428dad,_0x3eaa37){return db[_0xb66d('0x25')]['create'](_0x428dad['body'],{})[_0xb66d('0x21')](respondWithResult(_0x3eaa37,0xc9))[_0xb66d('0x3a')](handleError(_0x3eaa37,null));};exports[_0xb66d('0x20')]=function(_0x3d1d17,_0x5015f2){if(_0x3d1d17[_0xb66d('0x40')]['id']){delete _0x3d1d17['body']['id'];}return db[_0xb66d('0x25')][_0xb66d('0x3e')]({'where':{'id':_0x3d1d17[_0xb66d('0x41')]['id']}})[_0xb66d('0x21')](handleEntityNotFound(_0x5015f2,null))[_0xb66d('0x21')](saveUpdates(_0x3d1d17['body'],null))[_0xb66d('0x21')](respondWithResult(_0x5015f2,null))['catch'](handleError(_0x5015f2,null));};exports[_0xb66d('0x42')]=function(_0x3b5dd6,_0xcfde93){return db[_0xb66d('0x25')]['find']({'where':{'id':_0x3b5dd6['params']['id']}})['then'](handleEntityNotFound(_0xcfde93,null))[_0xb66d('0x21')](removeEntity(_0xcfde93,null))['catch'](handleError(_0xcfde93,null));};exports[_0xb66d('0x43')]=function(_0x527528,_0x26179e){return db[_0xb66d('0x25')]['describe']()[_0xb66d('0x21')](respondWithResult(_0x26179e,null))[_0xb66d('0x3a')](handleError(_0x26179e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1ecf852..d42d9e4 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 _0xd245=['rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x127833,_0x5f2a28){var _0x5bcb09=function(_0x5615b){while(--_0x5615b){_0x127833['push'](_0x127833['shift']());}};_0x5bcb09(++_0x5f2a28);}(_0xd245,0x1e8));var _0x5d24=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0xd245[_0xe1b5f6];return _0x44636e;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var logger=require(_0x5d24('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d24('0x3'));var rp=require(_0x5d24('0x4'));var fs=require('fs');var path=require(_0x5d24('0x5'));var rimraf=require(_0x5d24('0x6'));var config=require(_0x5d24('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x5d24('0x8')]=function(_0x7d2d9,_0x13930d){return _0x7d2d9[_0x5d24('0x9')](_0x5d24('0xa'),attributes,{'tableName':_0x5d24('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5d24('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1404=['exports','define','report_dial','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x42da61,_0x3e4fc2){var _0x40f5fa=function(_0x10cf63){while(--_0x10cf63){_0x42da61['push'](_0x42da61['shift']());}};_0x40f5fa(++_0x3e4fc2);}(_0x1404,0x1e3));var _0x4140=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1404[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x4140('0x0'));var util=require(_0x4140('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4140('0x2'));var BPromise=require(_0x4140('0x3'));var rp=require(_0x4140('0x4'));var fs=require('fs');var path=require(_0x4140('0x5'));var rimraf=require(_0x4140('0x6'));var config=require(_0x4140('0x7'));var attributes=require(_0x4140('0x8'));module[_0x4140('0x9')]=function(_0x378389,_0x145ee4){return _0x378389[_0x4140('0xa')]('VoiceDialReport',attributes,{'tableName':_0x4140('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2d3c84a..0f82d3a 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 _0x5df5=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','stringify','catch','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5df5,0x109));var _0x55df=function(_0x50619d,_0xb469ee){_0x50619d=_0x50619d-0x0;var _0xfe5f0e=_0x5df5[_0x50619d];return _0xfe5f0e;};'use strict';var _=require(_0x55df('0x0'));var util=require(_0x55df('0x1'));var moment=require(_0x55df('0x2'));var BPromise=require(_0x55df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55df('0x4'));var db=require(_0x55df('0x5'))['db'];var utils=require(_0x55df('0x6'));var logger=require(_0x55df('0x7'))(_0x55df('0x8'));var config=require(_0x55df('0x9'));var jayson=require(_0x55df('0xa'));var client=jayson[_0x55df('0xb')][_0x55df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12daca,_0x140885,_0x2b0a8f){return new BPromise(function(_0x54c53a,_0x4258b4){return client[_0x55df('0xd')](_0x12daca,_0x2b0a8f)['then'](function(_0x5e55ff){logger['info'](_0x55df('0xe'),_0x140885,_0x55df('0xf'));logger[_0x55df('0x10')](_0x55df('0x11'),_0x140885,_0x55df('0xf'),JSON['stringify'](_0x5e55ff));if(_0x5e55ff[_0x55df('0x12')]){if(_0x5e55ff[_0x55df('0x12')]['code']===0x1f4){logger[_0x55df('0x12')](_0x55df('0xe'),_0x140885,_0x5e55ff['error'][_0x55df('0x13')]);return _0x4258b4(_0x5e55ff[_0x55df('0x12')][_0x55df('0x13')]);}logger[_0x55df('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x140885,_0x5e55ff['error'][_0x55df('0x13')]);return _0x54c53a(_0x5e55ff[_0x55df('0x12')][_0x55df('0x13')]);}else{logger[_0x55df('0x14')](_0x55df('0xe'),_0x140885,_0x55df('0xf'));_0x54c53a(_0x5e55ff[_0x55df('0x15')][_0x55df('0x13')]);}})['catch'](function(_0x5815dc){logger['error'](_0x55df('0xe'),_0x140885,_0x5815dc);_0x4258b4(_0x5815dc);});});}exports[_0x55df('0x16')]=function(_0x1a425e){var _0xdf54f2=this;return new Promise(function(_0x2d1b34,_0x54f48d){return db[_0x55df('0x17')][_0x55df('0x18')](_0x1a425e[_0x55df('0x19')],{'raw':_0x1a425e[_0x55df('0x1a')]?_0x1a425e['options'][_0x55df('0x1b')]===undefined?!![]:![]:!![]})[_0x55df('0x1c')](function(_0x24af96){logger[_0x55df('0x14')](_0x55df('0x16'),_0x1a425e);logger['debug'](_0x55df('0x16'),_0x1a425e,JSON[_0x55df('0x1d')](_0x24af96));_0x2d1b34(_0x24af96);})[_0x55df('0x1e')](function(_0x2bc58d){logger['error'](_0x55df('0x16'),_0x2bc58d['message'],_0x1a425e);_0x54f48d(_0xdf54f2[_0x55df('0x12')](0x1f4,_0x2bc58d[_0x55df('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x56f24a){var _0x28f1bb=this;return new Promise(function(_0x3e5966,_0x6ca5e6){return db[_0x55df('0x17')]['update'](_0x56f24a[_0x55df('0x19')],{'raw':_0x56f24a['options']?_0x56f24a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56f24a[_0x55df('0x1a')]?_0x56f24a[_0x55df('0x1a')][_0x55df('0x1f')]||null:null,'attributes':_0x56f24a[_0x55df('0x1a')]?_0x56f24a['options'][_0x55df('0x20')]||null:null,'limit':_0x56f24a[_0x55df('0x1a')]?_0x56f24a[_0x55df('0x1a')][_0x55df('0x21')]||null:null})[_0x55df('0x1c')](function(_0x299d80){logger[_0x55df('0x14')](_0x55df('0x22'),_0x56f24a);logger[_0x55df('0x10')]('UpdateVoiceDialReport',_0x56f24a,JSON[_0x55df('0x1d')](_0x299d80));_0x3e5966(_0x299d80);})[_0x55df('0x1e')](function(_0x88bfb8){logger[_0x55df('0x12')](_0x55df('0x22'),_0x88bfb8[_0x55df('0x13')],_0x56f24a);_0x6ca5e6(_0x28f1bb[_0x55df('0x12')](0x1f4,_0x88bfb8['message']));});});}; \ No newline at end of file +var _0x8de4=['jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','VoiceDialReport','create','options','raw','then','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','body','where','attributes','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8de4,0x1ca));var _0x48de=function(_0x454434,_0x19d14f){_0x454434=_0x454434-0x0;var _0x4601f8=_0x8de4[_0x454434];return _0x4601f8;};'use strict';var _=require('lodash');var util=require(_0x48de('0x0'));var moment=require(_0x48de('0x1'));var BPromise=require('bluebird');var rs=require(_0x48de('0x2'));var fs=require('fs');var Redis=require(_0x48de('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48de('0x4'))(_0x48de('0x5'));var config=require(_0x48de('0x6'));var jayson=require(_0x48de('0x7'));var client=jayson[_0x48de('0x8')][_0x48de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384388,_0x31e670,_0x1ec6ce){return new BPromise(function(_0x38bb79,_0xab5557){return client[_0x48de('0xa')](_0x384388,_0x1ec6ce)['then'](function(_0x30f6d5){logger['info'](_0x48de('0xb'),_0x31e670,_0x48de('0xc'));logger[_0x48de('0xd')](_0x48de('0xe'),_0x31e670,_0x48de('0xc'),JSON['stringify'](_0x30f6d5));if(_0x30f6d5[_0x48de('0xf')]){if(_0x30f6d5[_0x48de('0xf')]['code']===0x1f4){logger[_0x48de('0xf')](_0x48de('0xb'),_0x31e670,_0x30f6d5[_0x48de('0xf')][_0x48de('0x10')]);return _0xab5557(_0x30f6d5[_0x48de('0xf')][_0x48de('0x10')]);}logger[_0x48de('0xf')](_0x48de('0xb'),_0x31e670,_0x30f6d5['error'][_0x48de('0x10')]);return _0x38bb79(_0x30f6d5[_0x48de('0xf')]['message']);}else{logger[_0x48de('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x31e670,_0x48de('0xc'));_0x38bb79(_0x30f6d5[_0x48de('0x12')][_0x48de('0x10')]);}})[_0x48de('0x13')](function(_0x9f5d81){logger[_0x48de('0xf')](_0x48de('0xb'),_0x31e670,_0x9f5d81);_0xab5557(_0x9f5d81);});});}exports['CreateVoiceDialReport']=function(_0x12d80d){var _0x1a8352=this;return new Promise(function(_0x1d1453,_0x5b9021){return db[_0x48de('0x14')][_0x48de('0x15')](_0x12d80d['body'],{'raw':_0x12d80d[_0x48de('0x16')]?_0x12d80d[_0x48de('0x16')][_0x48de('0x17')]===undefined?!![]:![]:!![]})[_0x48de('0x18')](function(_0x57bd25){logger[_0x48de('0x11')](_0x48de('0x19'),_0x12d80d);logger[_0x48de('0xd')]('CreateVoiceDialReport',_0x12d80d,JSON[_0x48de('0x1a')](_0x57bd25));_0x1d1453(_0x57bd25);})[_0x48de('0x13')](function(_0x49dc56){logger[_0x48de('0xf')](_0x48de('0x19'),_0x49dc56[_0x48de('0x10')],_0x12d80d);_0x5b9021(_0x1a8352[_0x48de('0xf')](0x1f4,_0x49dc56['message']));});});};exports[_0x48de('0x1b')]=function(_0x39804e){var _0x466198=this;return new Promise(function(_0x1137e8,_0x58de02){return db['VoiceDialReport']['update'](_0x39804e[_0x48de('0x1c')],{'raw':_0x39804e[_0x48de('0x16')]?_0x39804e[_0x48de('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39804e[_0x48de('0x16')]?_0x39804e[_0x48de('0x16')][_0x48de('0x1d')]||null:null,'attributes':_0x39804e[_0x48de('0x16')]?_0x39804e[_0x48de('0x16')][_0x48de('0x1e')]||null:null,'limit':_0x39804e[_0x48de('0x16')]?_0x39804e['options']['limit']||null:null})[_0x48de('0x18')](function(_0x219720){logger[_0x48de('0x11')](_0x48de('0x1b'),_0x39804e);logger[_0x48de('0xd')](_0x48de('0x1b'),_0x39804e,JSON[_0x48de('0x1a')](_0x219720));_0x1137e8(_0x219720);})['catch'](function(_0x287b0c){logger[_0x48de('0xf')](_0x48de('0x1b'),_0x287b0c[_0x48de('0x10')],_0x39804e);_0x58de02(_0x466198[_0x48de('0xf')](0x1f4,_0x287b0c[_0x48de('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index afc91c4..7b363ca 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 _0xf728=['create','/:id/applications','update','/:id','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','show','post'];(function(_0x4aabc6,_0x348818){var _0xf26471=function(_0x1416c6){while(--_0x1416c6){_0x4aabc6['push'](_0x4aabc6['shift']());}};_0xf26471(++_0x348818);}(_0xf728,0x19b));var _0x8f72=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xf728[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require('multer');var util=require(_0x8f72('0x0'));var path=require(_0x8f72('0x1'));var timeout=require(_0x8f72('0x2'));var express=require(_0x8f72('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8f72('0x4'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x8f72('0x5')]('/',auth[_0x8f72('0x6')](),controller['index']);router['get']('/:id',auth[_0x8f72('0x6')](),controller[_0x8f72('0x7')]);router[_0x8f72('0x8')]('/',auth[_0x8f72('0x6')](),controller[_0x8f72('0x9')]);router['post'](_0x8f72('0xa'),auth[_0x8f72('0x6')](),controller['addApplications']);router['put']('/:id',auth[_0x8f72('0x6')](),controller[_0x8f72('0xb')]);router['delete'](_0x8f72('0xc'),auth[_0x8f72('0x6')](),controller[_0x8f72('0xd')]);module[_0x8f72('0xe')]=router; \ No newline at end of file +var _0xa458=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','destroy','exports'];(function(_0x14e9bf,_0x4ae6af){var _0x3506fc=function(_0x44d6a5){while(--_0x44d6a5){_0x14e9bf['push'](_0x14e9bf['shift']());}};_0x3506fc(++_0x4ae6af);}(_0xa458,0x1c8));var _0x8a45=function(_0xabf37c,_0xef5053){_0xabf37c=_0xabf37c-0x0;var _0x547f02=_0xa458[_0xabf37c];return _0x547f02;};'use strict';var multer=require(_0x8a45('0x0'));var util=require(_0x8a45('0x1'));var path=require(_0x8a45('0x2'));var timeout=require(_0x8a45('0x3'));var express=require(_0x8a45('0x4'));var router=express[_0x8a45('0x5')]();var fs_extra=require(_0x8a45('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a45('0x7'));var controller=require(_0x8a45('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8a45('0x9')](_0x8a45('0xa'),auth[_0x8a45('0xb')](),controller[_0x8a45('0xc')]);router[_0x8a45('0xd')]('/',auth[_0x8a45('0xb')](),controller[_0x8a45('0xe')]);router['post'](_0x8a45('0xf'),auth[_0x8a45('0xb')](),controller[_0x8a45('0x10')]);router['put']('/:id',auth[_0x8a45('0xb')](),controller['update']);router['delete']('/:id',auth[_0x8a45('0xb')](),controller[_0x8a45('0x11')]);module[_0x8a45('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 94c8d41..7746e2b 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 _0xcb10=['INTEGER','BOOLEAN','getDataValue','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','outbound-fax','system','any','*,*,*,*'];(function(_0x293ef1,_0x18f14e){var _0x27bbb4=function(_0x29a36c){while(--_0x29a36c){_0x293ef1['push'](_0x293ef1['shift']());}};_0x27bbb4(++_0x18f14e);}(_0xcb10,0x145));var _0x0cb1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcb10[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x0cb1('0x0')]={'context':{'type':Sequelize[_0x0cb1('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0cb1('0x1')],'allowNull':![],'unique':_0x0cb1('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0cb1('0x2')},'tag':{'type':Sequelize[_0x0cb1('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0cb1('0x1')],'allowNull':![],'defaultValue':_0x0cb1('0x3')},'appdata':{'type':Sequelize[_0x0cb1('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0cb1('0x4')]('inbound',_0x0cb1('0x5'),_0x0cb1('0x6'),'inbound-fax',_0x0cb1('0x7'),_0x0cb1('0x8'),_0x0cb1('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0cb1('0x1')],'allowNull':![],'defaultValue':_0x0cb1('0xa')},'IntervalId':{'type':Sequelize[_0x0cb1('0xb')]},'isApp':{'type':Sequelize[_0x0cb1('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0cb1('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0cb1('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5519eb){return this[_0x0cb1('0xd')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf826=['ENUM','inbound','outbound','internal','outbound-fax','system','any','INTEGER','BOOLEAN','wav','getDataValue','exports','STRING','compositeIndex','NoOp'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0xf826,0xdd));var _0x6f82=function(_0x4e44f6,_0x17c136){_0x4e44f6=_0x4e44f6-0x0;var _0x461044=_0xf826[_0x4e44f6];return _0x461044;};'use strict';var Sequelize=require('sequelize');module[_0x6f82('0x0')]={'context':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'unique':_0x6f82('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x6f82('0x2')},'tag':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'defaultValue':_0x6f82('0x3')},'appdata':{'type':Sequelize[_0x6f82('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6f82('0x4')](_0x6f82('0x5'),_0x6f82('0x6'),_0x6f82('0x7'),'inbound-fax',_0x6f82('0x8'),_0x6f82('0x9'),_0x6f82('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x6f82('0xb')]},'isApp':{'type':Sequelize[_0x6f82('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x6f82('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x6f82('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6f82('0xb')]},'recordingFormat':{'type':Sequelize[_0x6f82('0x1')],'defaultValue':_0x6f82('0xd')},'answer':{'type':Sequelize[_0x6f82('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x45418a){return this[_0x6f82('0xe')]('exten');}},'alias':{'type':Sequelize[_0x6f82('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 6bbfca3..52dc312 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 _0x8ac6=['limit','count','offset','set','Content-Range','destroy','then','get','inbound','outbound','internal','filter','value','includes','type','find','name','UserProfileResource','end','error','stack','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','VoiceExtension','findAll','rows','catch','show','params','keys','options','create','body','exten','concat','user','OutboundRoutes','InternalRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','undefined'];(function(_0x247d93,_0x34ea80){var _0x2bb5f8=function(_0x226a1f){while(--_0x226a1f){_0x247d93['push'](_0x247d93['shift']());}};_0x2bb5f8(++_0x34ea80);}(_0x8ac6,0x108));var _0x68ac=function(_0xee5ba1,_0x5b8015){_0xee5ba1=_0xee5ba1-0x0;var _0x11c60d=_0x8ac6[_0xee5ba1];return _0x11c60d;};'use strict';var _=require(_0x68ac('0x0'));var Redis=require(_0x68ac('0x1'));var qs=require(_0x68ac('0x2'));var logger=require(_0x68ac('0x3'))(_0x68ac('0x4'));var config=require(_0x68ac('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x68ac('0x6')](config[_0x68ac('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x68ac('0x8'))(new Redis(config['redis']));require(_0x68ac('0x9'))[_0x68ac('0xa')](socket);function respondWithStatusCode(_0x2703b2,_0x56fc07){_0x56fc07=_0x56fc07||0xcc;return function(_0x1e3fbe){if(_0x1e3fbe){return _0x2703b2[_0x68ac('0xb')](_0x56fc07);}return _0x2703b2[_0x68ac('0xc')](_0x56fc07)['end']();};}function respondWithResult(_0x39d8f9,_0x45dd8c){_0x45dd8c=_0x45dd8c||0xc8;return function(_0x2dc520){if(_0x2dc520){return _0x39d8f9['status'](_0x45dd8c)[_0x68ac('0xd')](_0x2dc520);}};}function respondWithFilteredResult(_0x44a0c7,_0xf5129b){return function(_0x3781bc){if(_0x3781bc){var _0x54426e=typeof _0xf5129b['offset']===_0x68ac('0xe')&&typeof _0xf5129b[_0x68ac('0xf')]===_0x68ac('0xe');var _0x42a2ec=_0x3781bc[_0x68ac('0x10')];var _0x4d0767=_0x54426e?0x0:_0xf5129b[_0x68ac('0x11')];var _0xedd400=_0x54426e?_0x3781bc[_0x68ac('0x10')]:_0xf5129b[_0x68ac('0x11')]+_0xf5129b[_0x68ac('0xf')];var _0x547d09;if(_0xedd400>=_0x42a2ec){_0xedd400=_0x42a2ec;_0x547d09=0xc8;}else{_0x547d09=0xce;}_0x44a0c7['status'](_0x547d09);return _0x44a0c7[_0x68ac('0x12')](_0x68ac('0x13'),_0x4d0767+'-'+_0xedd400+'/'+_0x42a2ec)[_0x68ac('0xd')](_0x3781bc);}return null;};}function removeEntity(_0x4a727a){return function(_0x4c9a35){if(_0x4c9a35){return _0x4c9a35[_0x68ac('0x14')]()[_0x68ac('0x15')](function(){var _0x48972a=_0x4c9a35[_0x68ac('0x16')]({'plain':!![]});var _0x33e754=[{'name':'InboundRoutes','value':_0x68ac('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x68ac('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0x68ac('0x19'),'ignore':![]}];var _0x153191=_(_0x33e754)[_0x68ac('0x1a')]('ignore')['map'](_0x68ac('0x1b'))[_0x68ac('0x1b')]();if(_[_0x68ac('0x1c')](_0x153191,_0x48972a[_0x68ac('0x1d')])){return;}var _0x1a4f49=_[_0x68ac('0x1e')](_0x33e754,[_0x68ac('0x1b'),_0x48972a[_0x68ac('0x1d')]])[_0x68ac('0x1f')];return db[_0x68ac('0x20')][_0x68ac('0x14')]({'where':{'type':_0x1a4f49,'resourceId':_0x48972a['id']}})['then'](function(){return _0x4c9a35;});})[_0x68ac('0x15')](function(){_0x4a727a['status'](0xcc)[_0x68ac('0x21')]();});}};}function handleEntityNotFound(_0x38c708){return function(_0x467b81){if(!_0x467b81){_0x38c708[_0x68ac('0xb')](0x194);}return _0x467b81;};}function handleError(_0x1e5a27,_0x4bac9a){_0x4bac9a=_0x4bac9a||0x1f4;return function(_0x19b0ce){logger[_0x68ac('0x22')](_0x19b0ce[_0x68ac('0x23')]);if(_0x19b0ce['name']){delete _0x19b0ce[_0x68ac('0x1f')];}_0x1e5a27[_0x68ac('0xc')](_0x4bac9a)['send'](_0x19b0ce);};}exports[_0x68ac('0x24')]=function(_0x5de3c6,_0x3de514){var _0x23b399={},_0x1a175c={},_0x14d3e6={'count':0x0,'rows':[]};var _0x433bec=_[_0x68ac('0x25')](db['VoiceExtension'][_0x68ac('0x26')],function(_0x33e61d){return{'name':_0x33e61d[_0x68ac('0x27')],'type':_0x33e61d[_0x68ac('0x1d')][_0x68ac('0x28')]};});_0x1a175c[_0x68ac('0x29')]=_['map'](_0x433bec,_0x68ac('0x1f'));_0x1a175c[_0x68ac('0x2a')]=_['keys'](_0x5de3c6['query']);_0x1a175c['filters']=_[_0x68ac('0x2b')](_0x1a175c[_0x68ac('0x29')],_0x1a175c[_0x68ac('0x2a')]);_0x23b399[_0x68ac('0x2c')]=_[_0x68ac('0x2b')](_0x1a175c['model'],qs[_0x68ac('0x2d')](_0x5de3c6[_0x68ac('0x2a')][_0x68ac('0x2d')]));_0x23b399['attributes']=_0x23b399[_0x68ac('0x2c')][_0x68ac('0x2e')]?_0x23b399[_0x68ac('0x2c')]:_0x1a175c['model'];if(!_0x5de3c6[_0x68ac('0x2a')][_0x68ac('0x2f')](_0x68ac('0x30'))){_0x23b399[_0x68ac('0xf')]=qs[_0x68ac('0xf')](_0x5de3c6['query'][_0x68ac('0xf')]);_0x23b399['offset']=qs[_0x68ac('0x11')](_0x5de3c6[_0x68ac('0x2a')][_0x68ac('0x11')]);}_0x23b399[_0x68ac('0x31')]=qs[_0x68ac('0x32')](_0x5de3c6[_0x68ac('0x2a')]['sort']);_0x23b399[_0x68ac('0x33')]=qs[_0x68ac('0x34')](_[_0x68ac('0x35')](_0x5de3c6[_0x68ac('0x2a')],_0x1a175c[_0x68ac('0x34')]),_0x433bec);if(_0x5de3c6['query'][_0x68ac('0x1a')]){_0x23b399[_0x68ac('0x33')]=_['merge'](_0x23b399[_0x68ac('0x33')],{'$or':_['map'](_0x433bec,function(_0x46e2de){if(_0x46e2de['type']!==_0x68ac('0x36')){var _0x35aecd={};_0x35aecd[_0x46e2de[_0x68ac('0x1f')]]={'$like':'%'+_0x5de3c6[_0x68ac('0x2a')][_0x68ac('0x1a')]+'%'};return _0x35aecd;}})});}_0x23b399=_[_0x68ac('0x37')]({},_0x23b399,_0x5de3c6['options']);var _0x193dd4={'where':_0x23b399[_0x68ac('0x33')]};return db['VoiceExtension'][_0x68ac('0x10')](_0x193dd4)['then'](function(_0x35111a){_0x14d3e6['count']=_0x35111a;if(_0x5de3c6[_0x68ac('0x2a')][_0x68ac('0x38')]){_0x23b399[_0x68ac('0x39')]=[{'all':!![]}];}return db[_0x68ac('0x3a')][_0x68ac('0x3b')](_0x23b399);})[_0x68ac('0x15')](function(_0x29c90e){_0x14d3e6[_0x68ac('0x3c')]=_0x29c90e;return _0x14d3e6;})[_0x68ac('0x15')](respondWithFilteredResult(_0x3de514,_0x23b399))[_0x68ac('0x3d')](handleError(_0x3de514,null));};exports[_0x68ac('0x3e')]=function(_0xaaf1ec,_0xf6b26e){var _0xfb149b={'raw':![],'where':{'id':_0xaaf1ec[_0x68ac('0x3f')]['id']}},_0x11157c={};_0x11157c[_0x68ac('0x29')]=_['keys'](db['VoiceExtension']['rawAttributes']);_0x11157c[_0x68ac('0x2a')]=_[_0x68ac('0x40')](_0xaaf1ec[_0x68ac('0x2a')]);_0x11157c[_0x68ac('0x34')]=_[_0x68ac('0x2b')](_0x11157c[_0x68ac('0x29')],_0x11157c[_0x68ac('0x2a')]);_0xfb149b['attributes']=_[_0x68ac('0x2b')](_0x11157c[_0x68ac('0x29')],qs[_0x68ac('0x2d')](_0xaaf1ec[_0x68ac('0x2a')][_0x68ac('0x2d')]));_0xfb149b[_0x68ac('0x2c')]=_0xfb149b[_0x68ac('0x2c')][_0x68ac('0x2e')]?_0xfb149b['attributes']:_0x11157c[_0x68ac('0x29')];if(_0xaaf1ec[_0x68ac('0x2a')][_0x68ac('0x38')]){_0xfb149b[_0x68ac('0x39')]=[{'all':!![]}];}_0xfb149b=_[_0x68ac('0x37')]({},_0xfb149b,_0xaaf1ec[_0x68ac('0x41')]);return db[_0x68ac('0x3a')]['find'](_0xfb149b)[_0x68ac('0x15')](handleEntityNotFound(_0xf6b26e,null))[_0x68ac('0x15')](respondWithResult(_0xf6b26e,null))[_0x68ac('0x3d')](handleError(_0xf6b26e,null));};exports[_0x68ac('0x14')]=function(_0x20684a,_0x39a279){return db[_0x68ac('0x3a')][_0x68ac('0x1e')]({'where':{'id':_0x20684a[_0x68ac('0x3f')]['id']}})[_0x68ac('0x15')](handleEntityNotFound(_0x39a279,null))[_0x68ac('0x15')](removeEntity(_0x39a279,null))[_0x68ac('0x3d')](handleError(_0x39a279,null));};exports[_0x68ac('0x42')]=function(_0x2bdeb0,_0x102291){if(_0x2bdeb0[_0x68ac('0x43')]['type']===_0x68ac('0x18')&&!_['startsWith'](_0x2bdeb0[_0x68ac('0x43')][_0x68ac('0x44')],'_')){_0x2bdeb0[_0x68ac('0x43')]['exten']='_'[_0x68ac('0x45')](_0x2bdeb0[_0x68ac('0x43')][_0x68ac('0x44')]);}return db['VoiceExtension'][_0x68ac('0x42')](_0x2bdeb0[_0x68ac('0x43')],{'raw':![]})[_0x68ac('0x15')](function(_0x3adb75){var _0x2914d0=_0x2bdeb0[_0x68ac('0x46')][_0x68ac('0x16')]({'plain':!![]});if(!_0x2914d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2914d0['role']===_0x68ac('0x46')){var _0x2aa505=_0x3adb75[_0x68ac('0x16')]({'plain':!![]});var _0x51e8ad=[{'name':'InboundRoutes','value':_0x68ac('0x17')},{'name':_0x68ac('0x47'),'value':_0x68ac('0x18')},{'name':_0x68ac('0x48'),'value':_0x68ac('0x19')}];var _0x993d5=_[_0x68ac('0x1e')](_0x51e8ad,['value',_0x2aa505['type']])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x993d5,'userProfileId':_0x2914d0[_0x68ac('0x49')]},'raw':!![]})['then'](function(_0x1acc25){if(_0x1acc25&&_0x1acc25[_0x68ac('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x2aa505['name'],'resourceId':_0x2aa505['id'],'type':_0x1acc25['name'],'sectionId':_0x1acc25['id']},{})[_0x68ac('0x15')](function(){return _0x3adb75;});}else{return _0x3adb75;}})['catch'](function(_0x25a647){logger['error'](_0x68ac('0x4b'),_0x25a647);throw _0x25a647;});}return _0x3adb75;})[_0x68ac('0x15')](respondWithResult(_0x102291,0xc9))[_0x68ac('0x3d')](handleError(_0x102291,null));};exports[_0x68ac('0x4c')]=function(_0x3940eb,_0x18db32){if(_0x3940eb[_0x68ac('0x43')]['id']){delete _0x3940eb[_0x68ac('0x43')]['id'];}return db[_0x68ac('0x3a')]['find']({'where':{'id':_0x3940eb[_0x68ac('0x3f')]['id']}})[_0x68ac('0x15')](handleEntityNotFound(_0x18db32,null))['then'](function(_0x914f94){if(_0x914f94){return db[_0x68ac('0x3a')][_0x68ac('0x4c')](_[_0x68ac('0x35')](_0x3940eb[_0x68ac('0x43')],[_0x68ac('0x44'),_0x68ac('0x4d'),_0x68ac('0x4e'),_0x68ac('0x4f'),_0x68ac('0x50'),'mandatoryDisposition','alias']),{'where':{'context':_0x914f94[_0x68ac('0x4d')],'exten':_0x914f94[_0x68ac('0x44')]},'individualHooks':!![]})[_0x68ac('0x15')](function(_0x1df1b9){return _0x1df1b9;});}return null;})[_0x68ac('0x15')](respondWithStatusCode(_0x18db32,null))[_0x68ac('0x3d')](handleError(_0x18db32,null));};exports[_0x68ac('0x51')]=function(_0x3fd7f2,_0x2a4d07){var _0x4ba3a7=_0x3fd7f2[_0x68ac('0x3f')]['id'];var _0x1f275f=_0x3fd7f2['body'];var _0x412820=0xc8;var _0x5a7da9=null;return db['sequelize'][_0x68ac('0x52')]({'isolationLevel':db[_0x68ac('0x53')][_0x68ac('0x54')][_0x68ac('0x55')][_0x68ac('0x56')]},function(_0x515bbb){return db[_0x68ac('0x3a')][_0x68ac('0x57')]({'where':{'id':_0x4ba3a7},'transaction':_0x515bbb})[_0x68ac('0x15')](function(_0x57a26f){if(_0x57a26f){return db[_0x68ac('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x4ba3a7},'transaction':_0x515bbb})[_0x68ac('0x15')](function(){var _0x30f0a8=_[_0x68ac('0x25')](_0x1f275f,function(_0x488645){_0x488645[_0x68ac('0x58')]=_0x4ba3a7;_0x488645['isApp']=!![];return _0x488645;});return _0x57a26f[_0x68ac('0x59')](_0x30f0a8);})[_0x68ac('0x15')](function(_0x40c702){return db['VoiceExtension']['bulkCreate'](_0x40c702,{'transaction':_0x515bbb});});}else{_0x412820=0x194;_0x5a7da9=[];}});})['then'](function(){if(_0x412820!==0x194){return db[_0x68ac('0x3a')][_0x68ac('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4ba3a7},'order':_0x68ac('0x5b')})[_0x68ac('0x15')](function(_0x2a4326){_0x5a7da9=_0x2a4326;});}})[_0x68ac('0x3d')](function(_0x1264ae){_0x412820=0x1f4;logger[_0x68ac('0x22')](_0x1264ae['stack']);if(_0x1264ae[_0x68ac('0x1f')]){delete _0x1264ae[_0x68ac('0x1f')];}_0x5a7da9=_0x1264ae;})[_0x68ac('0x5c')](function(){if(_0x5a7da9===null){_0x2a4d07[_0x68ac('0xb')](_0x412820);}else{if(_0x412820===0x1f4){_0x2a4d07[_0x68ac('0xc')](_0x412820)['send'](_0x5a7da9);}else{_0x2a4d07[_0x68ac('0xc')](_0x412820)[_0x68ac('0xd')](_0x5a7da9);}}});}; \ No newline at end of file +var _0x739a=['count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','type','name','UserProfileResource','stack','send','VoiceExtension','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','findAll','catch','show','params','rawAttributes','includeAll','include','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x739a,0x10c));var _0xa739=function(_0x2484be,_0x12368d){_0x2484be=_0x2484be-0x0;var _0x2953f1=_0x739a[_0x2484be];return _0x2953f1;};'use strict';var _=require('lodash');var Redis=require(_0xa739('0x0'));var qs=require(_0xa739('0x1'));var logger=require(_0xa739('0x2'))(_0xa739('0x3'));var config=require(_0xa739('0x4'));var db=require('../../mysqldb')['db'];config[_0xa739('0x5')]=_[_0xa739('0x6')](config[_0xa739('0x5')],{'host':_0xa739('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa739('0x5')]));require(_0xa739('0x8'))[_0xa739('0x9')](socket);function respondWithStatusCode(_0x14b961,_0x545c5a){_0x545c5a=_0x545c5a||0xcc;return function(_0x46b212){if(_0x46b212){return _0x14b961[_0xa739('0xa')](_0x545c5a);}return _0x14b961[_0xa739('0xb')](_0x545c5a)[_0xa739('0xc')]();};}function respondWithResult(_0x1e24df,_0x11011c){_0x11011c=_0x11011c||0xc8;return function(_0x14d764){if(_0x14d764){return _0x1e24df[_0xa739('0xb')](_0x11011c)[_0xa739('0xd')](_0x14d764);}};}function respondWithFilteredResult(_0x992be6,_0x3d49ce){return function(_0x2909d1){if(_0x2909d1){var _0x37ea9a=typeof _0x3d49ce[_0xa739('0xe')]===_0xa739('0xf')&&typeof _0x3d49ce[_0xa739('0x10')]===_0xa739('0xf');var _0x1be258=_0x2909d1[_0xa739('0x11')];var _0x5c1caf=_0x37ea9a?0x0:_0x3d49ce[_0xa739('0xe')];var _0x11ead4=_0x37ea9a?_0x2909d1[_0xa739('0x11')]:_0x3d49ce[_0xa739('0xe')]+_0x3d49ce[_0xa739('0x10')];var _0x767866;if(_0x11ead4>=_0x1be258){_0x11ead4=_0x1be258;_0x767866=0xc8;}else{_0x767866=0xce;}_0x992be6['status'](_0x767866);return _0x992be6[_0xa739('0x12')]('Content-Range',_0x5c1caf+'-'+_0x11ead4+'/'+_0x1be258)[_0xa739('0xd')](_0x2909d1);}return null;};}function removeEntity(_0x90277f){return function(_0xdd053a){if(_0xdd053a){return _0xdd053a[_0xa739('0x13')]()[_0xa739('0x14')](function(){var _0x3c5bbe=_0xdd053a[_0xa739('0x15')]({'plain':!![]});var _0x5e58bf=[{'name':_0xa739('0x16'),'value':_0xa739('0x17'),'ignore':![]},{'name':_0xa739('0x18'),'value':_0xa739('0x19'),'ignore':![]},{'name':_0xa739('0x1a'),'value':_0xa739('0x1b'),'ignore':![]}];var _0x1989f7=_(_0x5e58bf)[_0xa739('0x1c')](_0xa739('0x1d'))[_0xa739('0x1e')]('value')[_0xa739('0x1f')]();if(_['includes'](_0x1989f7,_0x3c5bbe['type'])){return;}var _0x18a201=_[_0xa739('0x20')](_0x5e58bf,['value',_0x3c5bbe[_0xa739('0x21')]])[_0xa739('0x22')];return db[_0xa739('0x23')][_0xa739('0x13')]({'where':{'type':_0x18a201,'resourceId':_0x3c5bbe['id']}})[_0xa739('0x14')](function(){return _0xdd053a;});})[_0xa739('0x14')](function(){_0x90277f[_0xa739('0xb')](0xcc)[_0xa739('0xc')]();});}};}function handleEntityNotFound(_0x46f994){return function(_0x5117c7){if(!_0x5117c7){_0x46f994[_0xa739('0xa')](0x194);}return _0x5117c7;};}function handleError(_0x43f65c,_0x1b3a0b){_0x1b3a0b=_0x1b3a0b||0x1f4;return function(_0x10960a){logger['error'](_0x10960a[_0xa739('0x24')]);if(_0x10960a[_0xa739('0x22')]){delete _0x10960a[_0xa739('0x22')];}_0x43f65c[_0xa739('0xb')](_0x1b3a0b)[_0xa739('0x25')](_0x10960a);};}exports['index']=function(_0x56dbf1,_0x1f7e26){var _0x27750e={},_0x257771={},_0x5e5346={'count':0x0,'rows':[]};var _0x37c014=_[_0xa739('0x1e')](db[_0xa739('0x26')]['rawAttributes'],function(_0x3e6708){return{'name':_0x3e6708[_0xa739('0x27')],'type':_0x3e6708[_0xa739('0x21')]['key']};});_0x257771['model']=_[_0xa739('0x1e')](_0x37c014,_0xa739('0x22'));_0x257771[_0xa739('0x28')]=_[_0xa739('0x29')](_0x56dbf1['query']);_0x257771[_0xa739('0x2a')]=_['intersection'](_0x257771[_0xa739('0x2b')],_0x257771[_0xa739('0x28')]);_0x27750e[_0xa739('0x2c')]=_[_0xa739('0x2d')](_0x257771[_0xa739('0x2b')],qs[_0xa739('0x2e')](_0x56dbf1['query'][_0xa739('0x2e')]));_0x27750e['attributes']=_0x27750e['attributes'][_0xa739('0x2f')]?_0x27750e[_0xa739('0x2c')]:_0x257771[_0xa739('0x2b')];if(!_0x56dbf1[_0xa739('0x28')][_0xa739('0x30')](_0xa739('0x31'))){_0x27750e['limit']=qs[_0xa739('0x10')](_0x56dbf1[_0xa739('0x28')][_0xa739('0x10')]);_0x27750e['offset']=qs[_0xa739('0xe')](_0x56dbf1[_0xa739('0x28')][_0xa739('0xe')]);}_0x27750e[_0xa739('0x32')]=qs[_0xa739('0x33')](_0x56dbf1[_0xa739('0x28')][_0xa739('0x33')]);_0x27750e[_0xa739('0x34')]=qs[_0xa739('0x2a')](_[_0xa739('0x35')](_0x56dbf1[_0xa739('0x28')],_0x257771[_0xa739('0x2a')]),_0x37c014);if(_0x56dbf1['query']['filter']){_0x27750e[_0xa739('0x34')]=_['merge'](_0x27750e[_0xa739('0x34')],{'$or':_[_0xa739('0x1e')](_0x37c014,function(_0x1280d4){if(_0x1280d4[_0xa739('0x21')]!==_0xa739('0x36')){var _0x4d3938={};_0x4d3938[_0x1280d4['name']]={'$like':'%'+_0x56dbf1['query'][_0xa739('0x1c')]+'%'};return _0x4d3938;}})});}_0x27750e=_[_0xa739('0x37')]({},_0x27750e,_0x56dbf1[_0xa739('0x38')]);var _0x248911={'where':_0x27750e[_0xa739('0x34')]};return db[_0xa739('0x26')]['count'](_0x248911)[_0xa739('0x14')](function(_0x4d9afc){_0x5e5346[_0xa739('0x11')]=_0x4d9afc;if(_0x56dbf1[_0xa739('0x28')]['includeAll']){_0x27750e['include']=[{'all':!![]}];}return db[_0xa739('0x26')][_0xa739('0x39')](_0x27750e);})[_0xa739('0x14')](function(_0x244a98){_0x5e5346['rows']=_0x244a98;return _0x5e5346;})[_0xa739('0x14')](respondWithFilteredResult(_0x1f7e26,_0x27750e))[_0xa739('0x3a')](handleError(_0x1f7e26,null));};exports[_0xa739('0x3b')]=function(_0x54b836,_0x519f5f){var _0x50de78={'raw':![],'where':{'id':_0x54b836[_0xa739('0x3c')]['id']}},_0x4bed31={};_0x4bed31['model']=_['keys'](db[_0xa739('0x26')][_0xa739('0x3d')]);_0x4bed31[_0xa739('0x28')]=_[_0xa739('0x29')](_0x54b836[_0xa739('0x28')]);_0x4bed31[_0xa739('0x2a')]=_[_0xa739('0x2d')](_0x4bed31['model'],_0x4bed31[_0xa739('0x28')]);_0x50de78['attributes']=_[_0xa739('0x2d')](_0x4bed31['model'],qs[_0xa739('0x2e')](_0x54b836[_0xa739('0x28')][_0xa739('0x2e')]));_0x50de78[_0xa739('0x2c')]=_0x50de78[_0xa739('0x2c')][_0xa739('0x2f')]?_0x50de78[_0xa739('0x2c')]:_0x4bed31[_0xa739('0x2b')];if(_0x54b836[_0xa739('0x28')][_0xa739('0x3e')]){_0x50de78[_0xa739('0x3f')]=[{'all':!![]}];}_0x50de78=_[_0xa739('0x37')]({},_0x50de78,_0x54b836[_0xa739('0x38')]);return db['VoiceExtension']['find'](_0x50de78)[_0xa739('0x14')](handleEntityNotFound(_0x519f5f,null))['then'](respondWithResult(_0x519f5f,null))[_0xa739('0x3a')](handleError(_0x519f5f,null));};exports['destroy']=function(_0x2496ab,_0x49e4c0){return db['VoiceExtension']['find']({'where':{'id':_0x2496ab['params']['id']}})[_0xa739('0x14')](handleEntityNotFound(_0x49e4c0,null))[_0xa739('0x14')](removeEntity(_0x49e4c0,null))[_0xa739('0x3a')](handleError(_0x49e4c0,null));};exports[_0xa739('0x40')]=function(_0x4dc8cd,_0x6ee5b0){if(_0x4dc8cd[_0xa739('0x41')][_0xa739('0x21')]===_0xa739('0x19')&&!_[_0xa739('0x42')](_0x4dc8cd[_0xa739('0x41')][_0xa739('0x43')],'_')){_0x4dc8cd[_0xa739('0x41')]['exten']='_'['concat'](_0x4dc8cd['body']['exten']);}return db[_0xa739('0x26')][_0xa739('0x40')](_0x4dc8cd[_0xa739('0x41')],{'raw':![]})['then'](function(_0x2a253a){var _0x14da47=_0x4dc8cd['user']['get']({'plain':!![]});if(!_0x14da47)throw new Error(_0xa739('0x44'));if(_0x14da47[_0xa739('0x45')]===_0xa739('0x46')){var _0x205f87=_0x2a253a[_0xa739('0x15')]({'plain':!![]});var _0x5b5a99=[{'name':_0xa739('0x16'),'value':_0xa739('0x17')},{'name':_0xa739('0x18'),'value':'outbound'},{'name':_0xa739('0x1a'),'value':'internal'}];var _0x36348d=_[_0xa739('0x20')](_0x5b5a99,[_0xa739('0x1f'),_0x205f87['type']])['name'];return db[_0xa739('0x47')][_0xa739('0x20')]({'where':{'name':_0x36348d,'userProfileId':_0x14da47[_0xa739('0x48')]},'raw':!![]})['then'](function(_0x28f265){if(_0x28f265&&_0x28f265[_0xa739('0x49')]===0x0){return db[_0xa739('0x23')][_0xa739('0x40')]({'name':_0x205f87[_0xa739('0x22')],'resourceId':_0x205f87['id'],'type':_0x28f265[_0xa739('0x22')],'sectionId':_0x28f265['id']},{})[_0xa739('0x14')](function(){return _0x2a253a;});}else{return _0x2a253a;}})['catch'](function(_0x4cc082){logger[_0xa739('0x4a')](_0xa739('0x4b'),_0x4cc082);throw _0x4cc082;});}return _0x2a253a;})['then'](respondWithResult(_0x6ee5b0,0xc9))[_0xa739('0x3a')](handleError(_0x6ee5b0,null));};exports[_0xa739('0x4c')]=function(_0x4e5a1e,_0x45af1b){if(_0x4e5a1e[_0xa739('0x41')]['id']){delete _0x4e5a1e['body']['id'];}return db[_0xa739('0x26')][_0xa739('0x20')]({'where':{'id':_0x4e5a1e[_0xa739('0x3c')]['id']}})['then'](handleEntityNotFound(_0x45af1b,null))[_0xa739('0x14')](function(_0x59b8e4){if(_0x59b8e4){return db[_0xa739('0x26')]['update'](_[_0xa739('0x35')](_0x4e5a1e['body'],[_0xa739('0x43'),_0xa739('0x4d'),_0xa739('0x4e'),_0xa739('0x4f'),_0xa739('0x50'),_0xa739('0x51'),_0xa739('0x52')]),{'where':{'context':_0x59b8e4['context'],'exten':_0x59b8e4[_0xa739('0x43')]},'individualHooks':!![]})[_0xa739('0x14')](function(_0x440766){return _0x440766;});}return null;})[_0xa739('0x14')](respondWithStatusCode(_0x45af1b,null))[_0xa739('0x3a')](handleError(_0x45af1b,null));};exports[_0xa739('0x53')]=function(_0x1ef5ab,_0x24406c){var _0x38a2c3=_0x1ef5ab[_0xa739('0x3c')]['id'];var _0x2a7db7=_0x1ef5ab[_0xa739('0x41')];var _0x395583=0xc8;var _0x2d1e00=null;return db[_0xa739('0x54')][_0xa739('0x55')]({'isolationLevel':db[_0xa739('0x54')][_0xa739('0x56')][_0xa739('0x57')][_0xa739('0x58')]},function(_0x28b8d5){return db['VoiceExtension']['findOne']({'where':{'id':_0x38a2c3},'transaction':_0x28b8d5})[_0xa739('0x14')](function(_0x4f3a5d){if(_0x4f3a5d){return db[_0xa739('0x26')][_0xa739('0x13')]({'where':{'VoiceExtensionId':_0x38a2c3},'transaction':_0x28b8d5})[_0xa739('0x14')](function(){var _0x45f16d=_[_0xa739('0x1e')](_0x2a7db7,function(_0x5af110){_0x5af110[_0xa739('0x59')]=_0x38a2c3;_0x5af110[_0xa739('0x5a')]=!![];return _0x5af110;});return _0x4f3a5d[_0xa739('0x5b')](_0x45f16d);})[_0xa739('0x14')](function(_0x216535){return db[_0xa739('0x26')]['bulkCreate'](_0x216535,{'transaction':_0x28b8d5});});}else{_0x395583=0x194;_0x2d1e00=[];}});})[_0xa739('0x14')](function(){if(_0x395583!==0x194){return db['VoiceExtension'][_0xa739('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x38a2c3},'order':_0xa739('0x5d')})[_0xa739('0x14')](function(_0x49b2cb){_0x2d1e00=_0x49b2cb;});}})[_0xa739('0x3a')](function(_0x4f1da){_0x395583=0x1f4;logger['error'](_0x4f1da[_0xa739('0x24')]);if(_0x4f1da[_0xa739('0x22')]){delete _0x4f1da[_0xa739('0x22')];}_0x2d1e00=_0x4f1da;})[_0xa739('0x5e')](function(){if(_0x2d1e00===null){_0x24406c['sendStatus'](_0x395583);}else{if(_0x395583===0x1f4){_0x24406c[_0xa739('0xb')](_0x395583)[_0xa739('0x25')](_0x2d1e00);}else{_0x24406c['status'](_0x395583)[_0xa739('0xd')](_0x2d1e00);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f2e4126..e4cd2c8 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 _0x628d=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x17d79a,_0x5dc5cc){var _0x1b45e4=function(_0x9d0db7){while(--_0x9d0db7){_0x17d79a['push'](_0x17d79a['shift']());}};_0x1b45e4(++_0x5dc5cc);}(_0x628d,0xc6));var _0xd628=function(_0x1cab8b,_0x23433f){_0x1cab8b=_0x1cab8b-0x0;var _0x12f687=_0x628d[_0x1cab8b];return _0x12f687;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xd628('0x0'))['db'][_0xd628('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd628('0x2')](0x0);var events={'afterCreate':_0xd628('0x3'),'afterUpdate':_0xd628('0x4'),'afterDestroy':_0xd628('0x5')};function emitEvent(_0x40079f){return function(_0x26905b,_0x56610c,_0x5c0f10){VoiceExtensionEvents[_0xd628('0x6')](_0x40079f+':'+_0x26905b['id'],_0x26905b);VoiceExtensionEvents['emit'](_0x40079f,_0x26905b);_0x5c0f10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xd628('0x7')](e,emitEvent(event));}}module[_0xd628('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x88a8=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hook','exports'];(function(_0x52512f,_0x23c006){var _0x18ce1c=function(_0xb5fd6f){while(--_0xb5fd6f){_0x52512f['push'](_0x52512f['shift']());}};_0x18ce1c(++_0x23c006);}(_0x88a8,0x1b8));var _0x888a=function(_0x1e421d,_0x27b576){_0x1e421d=_0x1e421d-0x0;var _0x1538c4=_0x88a8[_0x1e421d];return _0x1538c4;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x888a('0x0'))['db'][_0x888a('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x888a('0x2')](0x0);var events={'afterCreate':_0x888a('0x3'),'afterUpdate':_0x888a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f72dd){return function(_0x33bbc8,_0x4634cb,_0x41ad47){VoiceExtensionEvents[_0x888a('0x5')](_0x3f72dd+':'+_0x33bbc8['id'],_0x33bbc8);VoiceExtensionEvents[_0x888a('0x5')](_0x3f72dd,_0x33bbc8);_0x41ad47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x888a('0x6')](e,emitEvent(event));}}module[_0x888a('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8e0e3f1..a23a24d 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 _0xea17=['map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','concat','last','catch','define','VoiceExtension','voice_extensions','get','priority','Hangup','lodash','./voiceExtension.attributes','exports','models','type','context','Set','NoOp','alias','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','hasOwnProperty','none','wav','timeout','options','split','length','trunk','param','phone','prefix','SIP','join','recordingFormat','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals'];(function(_0x286584,_0x2e13e9){var _0x4c3e4f=function(_0x3a2069){while(--_0x3a2069){_0x286584['push'](_0x286584['shift']());}};_0x4c3e4f(++_0x2e13e9);}(_0xea17,0x6c));var _0x7ea1=function(_0x181fc6,_0x68a2d4){_0x181fc6=_0x181fc6-0x0;var _0x3648c5=_0xea17[_0x181fc6];return _0x3648c5;};'use strict';var _=require(_0x7ea1('0x0'));var attributes=require(_0x7ea1('0x1'));module[_0x7ea1('0x2')]=function(_0x4521b2){var _0x36487c=_0x4521b2[_0x7ea1('0x3')];function _0x4ba9a2(_0x2f033a){var _0x468687=0x2;var _0x1e609e=[{'type':_0x2f033a['type'],'app':'Set','appdata':'CDR(type)='+_0x2f033a[_0x7ea1('0x4')],'context':_0x2f033a[_0x7ea1('0x5')],'exten':_0x2f033a['exten'],'priority':_0x468687++,'VoiceExtensionId':_0x2f033a['id']},{'type':_0x2f033a[_0x7ea1('0x4')],'app':_0x2f033a['alias']?_0x7ea1('0x6'):_0x7ea1('0x7'),'appdata':_0x2f033a[_0x7ea1('0x8')]?'CDR(routeAlias)='+_0x2f033a[_0x7ea1('0x8')]:_0x7ea1('0x9'),'context':_0x2f033a['context'],'exten':_0x2f033a[_0x7ea1('0xa')],'priority':_0x468687++,'VoiceExtensionId':_0x2f033a['id']}];if(_0x2f033a['type']===_0x7ea1('0xb')){_0x1e609e['push']({'type':_0x7ea1('0xb'),'app':_0x7ea1('0x6'),'appdata':'CDR(routeid)='+_0x2f033a['id'],'context':_0x2f033a[_0x7ea1('0x5')],'exten':_0x2f033a[_0x7ea1('0xa')],'priority':_0x468687++,'VoiceExtensionId':_0x2f033a['id']});}_0x1e609e[_0x7ea1('0xc')]({'type':_0x2f033a[_0x7ea1('0x4')],'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0xd'),'context':_0x2f033a[_0x7ea1('0x5')],'exten':_0x2f033a[_0x7ea1('0xa')],'priority':_0x468687++,'VoiceExtensionId':_0x2f033a['id']},{'type':_0x2f033a[_0x7ea1('0x4')],'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0xe'),'context':_0x2f033a['context'],'exten':_0x2f033a['exten'],'priority':_0x468687++,'VoiceExtensionId':_0x2f033a['id']},{'type':_0x2f033a['type'],'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0xf'),'context':_0x2f033a[_0x7ea1('0x5')],'exten':_0x2f033a[_0x7ea1('0xa')],'priority':_0x468687++,'VoiceExtensionId':_0x2f033a['id']});return _0x1e609e;}function _0x20d19f(_0x113159){var _0x3e56bb=0x2;var _0x1e1f00=[{'type':'outbound','app':_0x7ea1('0x6'),'appdata':_0x7ea1('0x10'),'context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159['exten'],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':_0x113159['alias']?_0x7ea1('0x6'):'NoOp','appdata':_0x113159[_0x7ea1('0x8')]?'CDR(routeAlias)='+_0x113159[_0x7ea1('0x8')]:'No\x20alias\x20set','context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159[_0x7ea1('0xa')],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':'Set','appdata':_0x7ea1('0x12')+(_0x113159[_0x7ea1('0x13')]?_0x7ea1('0x14')+_0x113159[_0x7ea1('0x13')]+'}':'${EXTEN}'),'context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159[_0x7ea1('0xa')],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0x15')+_0x113159['id'],'context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159['exten'],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':'outbound','app':_0x7ea1('0x16'),'appdata':_0x7ea1('0x17')+(_0x3e56bb+0x2)+_0x7ea1('0x18')+(_0x3e56bb+0x1)+')','context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159['exten'],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':'Set','appdata':_0x113159[_0x7ea1('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x113159[_0x7ea1('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159[_0x7ea1('0xa')],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0xd'),'context':_0x113159['context'],'exten':_0x113159[_0x7ea1('0xa')],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':'Set','appdata':_0x7ea1('0xe'),'context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159[_0x7ea1('0xa')],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0xf'),'context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159[_0x7ea1('0xa')],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':'outbound','app':_0x7ea1('0x6'),'appdata':'outboundrouteid='+_0x113159['id'],'context':_0x113159['context'],'exten':_0x113159['exten'],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']}];if(_0x113159[_0x7ea1('0x19')]('recordingFormat')&&_0x113159['recordingFormat']!==_0x7ea1('0x1a')){_0x1e1f00[_0x7ea1('0xc')]({'type':_0x7ea1('0x11'),'app':_0x7ea1('0x6'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x113159[_0x7ea1('0x5')],'exten':_0x113159['exten'],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']},{'type':_0x7ea1('0x11'),'app':_0x7ea1('0x6'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x113159['recordingFormat']||_0x7ea1('0x1b'),'context':_0x113159['context'],'exten':_0x113159['exten'],'priority':_0x3e56bb++,'VoiceExtensionId':_0x113159['id']});}return _0x1e1f00;}function _0x5ac830(_0x27d6ba,_0x31f9df){var _0xc0ca00=[{'name':'trunk','param':0x0},{'name':_0x7ea1('0x1c'),'param':0x1},{'name':_0x7ea1('0x1d'),'param':0x2},{'name':'url','param':0x3}];var _0x312b09={};var _0x180da2=_0x31f9df[_0x7ea1('0x1e')](',');var _0x5728ff=[];for(var _0x5b736d=0x0;_0x5b736d<_0xc0ca00[_0x7ea1('0x1f')];_0x5b736d++){switch(_0xc0ca00[_0x5b736d]['name']){case'trunk':_0x312b09[_0x7ea1('0x20')]=_0x180da2[_0xc0ca00[_0x5b736d][_0x7ea1('0x21')]]['split']('/')[0x1];_0x312b09[_0x7ea1('0x22')]=_0x180da2[_0xc0ca00[_0x5b736d]['param']][_0x7ea1('0x1e')]('/')[0x2];_0x312b09[_0x7ea1('0x23')]=_0x312b09['phone']?_0x312b09['phone']['split']('$')[0x0]:undefined;_0x312b09[_0x7ea1('0x22')]=_0x27d6ba['cutdigits']?(_0x312b09['prefix']||'')+_0x7ea1('0x14')+_0x27d6ba[_0x7ea1('0x13')]+'}':(_0x312b09[_0x7ea1('0x23')]||'')+'${EXTEN}';_0x5728ff[_0xc0ca00[_0x5b736d][_0x7ea1('0x21')]]=[_0x7ea1('0x24'),_0x312b09[_0x7ea1('0x20')],_0x312b09[_0x7ea1('0x22')]][_0x7ea1('0x25')]('/');break;case _0x7ea1('0x1d'):_0x312b09[_0x7ea1('0x1d')]=_0x180da2[_0xc0ca00[_0x5b736d][_0x7ea1('0x21')]];if(_0x27d6ba[_0x7ea1('0x26')]!==_0x7ea1('0x1a')){if(_0x312b09[_0x7ea1('0x1d')]['indexOf'](_0x7ea1('0x27'))<0x0){_0x312b09[_0x7ea1('0x1d')]+=_0x7ea1('0x27');}}else{_0x312b09['options']=_0x312b09[_0x7ea1('0x1d')][_0x7ea1('0x28')](_0x7ea1('0x27'),'');}_0x5728ff[_0xc0ca00[_0x5b736d][_0x7ea1('0x21')]]=_0x312b09[_0x7ea1('0x1d')];break;default:_0x5728ff[_0xc0ca00[_0x5b736d][_0x7ea1('0x21')]]=_0x180da2[_0xc0ca00[_0x5b736d][_0x7ea1('0x21')]];}}return _0x5728ff['join'](',');}function _0x3c4e11(_0x569974,_0x2ef9af,_0x258559){return new Promise(function(_0x33331f,_0x2344e2){var _0x38589d=[];if(_[_0x7ea1('0x29')](_0x2ef9af))return _0x33331f(_0x38589d);_0x36487c[_0x7ea1('0x2a')]['findAll']({'attributes':['id',_0x7ea1('0x2b'),_0x7ea1('0x2c')],'raw':!![]})[_0x7ea1('0x2d')](function(_0x53b502){for(var _0xab9d9e=0x0,_0x18ab28=0x0;_0xab9d9e<_0x2ef9af['length'];_0xab9d9e++,_0x18ab28=0x0){var _0x52b60d=_0x2ef9af[_0xab9d9e];var _0x4d748d=[];var _0x240c02=[];delete _0x52b60d['id'];if(_0x52b60d['interval']!==_0x7ea1('0x2e')){_0x52b60d[_0x7ea1('0x2f')]=[_0x52b60d['interval']];}else{_0x52b60d['intervals']=_0x52b60d['IntervalId']?_[_0x7ea1('0x30')](_['filter'](_0x53b502,{'IntervalId':_0x52b60d[_0x7ea1('0x2c')]}),_0x7ea1('0x2b')):[];}_0x52b60d[_0x7ea1('0x5')]=_0x569974[_0x7ea1('0x5')];_0x52b60d[_0x7ea1('0xa')]=_0x569974['exten'];if(_0x52b60d[_0x7ea1('0x4')])_0x52b60d['type']=_0x52b60d['type'][_0x7ea1('0x31')]();if(_0x569974[_0x7ea1('0x4')]===_0x7ea1('0x11')){if(_0x52b60d[_0x7ea1('0x19')](_0x7ea1('0x32'))&&_0x52b60d[_0x7ea1('0x32')]&&_0x52b60d[_0x7ea1('0x32')]!=='--'){_0x4d748d[_0x7ea1('0xc')]({'type':_0x52b60d['type']['toLowerCase'](),'app':_0x7ea1('0x6'),'appdata':'CDR(tag)='+_0x52b60d[_0x7ea1('0x32')],'context':_0x569974[_0x7ea1('0x5')],'exten':_0x569974[_0x7ea1('0xa')],'priority':_0x52b60d['intervals'][_0x7ea1('0x1f')]+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});}_0x4d748d[_0x7ea1('0xc')]({'type':_0x52b60d['type'][_0x7ea1('0x31')](),'app':_0x7ea1('0x16'),'appdata':_0x7ea1('0x33')+(_0x52b60d['callerID']?_0x7ea1('0x34')+_0x52b60d['callerID']+')':_0x7ea1('0x35')),'context':_0x569974[_0x7ea1('0x5')],'exten':_0x569974[_0x7ea1('0xa')],'priority':_0x52b60d['intervals'][_0x7ea1('0x1f')]+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});}else{if(_0x52b60d[_0x7ea1('0x19')]('answer')){if([_0x7ea1('0x36'),_0x7ea1('0x37')]['includes'](_0x52b60d[_0x7ea1('0x38')]['toLowerCase']())&&_0x52b60d[_0x7ea1('0x39')]!==_0x7ea1('0x3a')){if(_0x52b60d[_0x7ea1('0x3b')]){_0x4d748d['push']({'type':_0x52b60d[_0x7ea1('0x4')][_0x7ea1('0x31')](),'app':_0x7ea1('0x16'),'appdata':_0x7ea1('0x3c'),'context':_0x569974[_0x7ea1('0x5')],'exten':_0x569974['exten'],'priority':_0x52b60d[_0x7ea1('0x2f')][_0x7ea1('0x1f')]+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});_0x4d748d[_0x7ea1('0xc')]({'type':_0x52b60d[_0x7ea1('0x4')][_0x7ea1('0x31')](),'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0x3d'),'context':_0x569974[_0x7ea1('0x5')],'exten':_0x569974[_0x7ea1('0xa')],'priority':_0x52b60d[_0x7ea1('0x2f')]['length']+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});}else{_0x4d748d[_0x7ea1('0xc')]({'type':_0x52b60d[_0x7ea1('0x4')][_0x7ea1('0x31')](),'app':_0x7ea1('0x16'),'appdata':_0x7ea1('0x3e'),'context':_0x569974[_0x7ea1('0x5')],'exten':_0x569974[_0x7ea1('0xa')],'priority':_0x52b60d[_0x7ea1('0x2f')][_0x7ea1('0x1f')]+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});_0x4d748d[_0x7ea1('0xc')]({'type':_0x52b60d['type'][_0x7ea1('0x31')](),'app':_0x7ea1('0x6'),'appdata':_0x7ea1('0x3f'),'context':_0x569974['context'],'exten':_0x569974['exten'],'priority':_0x52b60d[_0x7ea1('0x2f')][_0x7ea1('0x1f')]+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});}}}}for(var _0x53cd08=0x0;_0x53cd08<_0x52b60d[_0x7ea1('0x2f')][_0x7ea1('0x1f')];_0x53cd08++){var _0x8997f0=_0x258559+_0x52b60d[_0x7ea1('0x2f')]['length'];var _0x35e261=_0x53cd08===_0x52b60d[_0x7ea1('0x2f')][_0x7ea1('0x1f')]-0x1?_0x258559+_0x4d748d[_0x7ea1('0x1f')]+_0x240c02[_0x7ea1('0x1f')]+0x2:_0x258559+_0x53cd08+0x1;_0x4d748d['splice'](_0x53cd08,0x0,{'type':_0x569974[_0x7ea1('0x4')],'app':_0x7ea1('0x40'),'appdata':_0x52b60d['intervals'][_0x53cd08]+'?'+_0x569974[_0x7ea1('0x5')]+_0x7ea1('0x41')+_0x8997f0+':'+_0x569974[_0x7ea1('0x5')]+_0x7ea1('0x41')+_0x35e261,'exten':_0x569974[_0x7ea1('0xa')],'context':_0x569974[_0x7ea1('0x5')],'priority':_0x258559+_0x53cd08,'VoiceExtensionId':_0x569974['id']});}if(_0x52b60d['appType']===_0x7ea1('0x42')){_0x52b60d['appdata']=_0x5ac830(_0x569974,_0x52b60d[_0x7ea1('0x43')]);}if(_0x52b60d[_0x7ea1('0x39')]===_0x7ea1('0x44')){_0x4d748d[_0x7ea1('0xc')]({'type':_0x52b60d['type']['toLowerCase'](),'app':_0x7ea1('0x6'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x569974[_0x7ea1('0x5')],'exten':_0x569974[_0x7ea1('0xa')],'priority':_0x52b60d[_0x7ea1('0x2f')][_0x7ea1('0x1f')]+_0x258559+_0x18ab28++,'VoiceExtensionId':_0x569974['id']});}_0x52b60d['priority']=_0x4d748d[_0x7ea1('0x1f')]?_['last'](_0x4d748d)['priority']+0x1:_0x258559;_0x38589d=_[_0x7ea1('0x45')](_0x38589d,_0x4d748d,[_0x52b60d],_0x240c02);_0x258559=_[_0x7ea1('0x46')](_0x38589d)['priority']+0x1;}return _0x33331f(_0x38589d);})[_0x7ea1('0x47')](function(_0x49417a){_0x2344e2(_0x49417a);});});}return _0x4521b2[_0x7ea1('0x48')](_0x7ea1('0x49'),attributes,{'tableName':_0x7ea1('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x34e067){var _0x1e0001=this[_0x7ea1('0x4b')]({'plain':!![]});var _0x3d3dbb=_0x1e0001[_0x7ea1('0x4')]===_0x7ea1('0x11')?_0x20d19f(_0x1e0001):_0x4ba9a2(_0x1e0001);return _0x3c4e11(_0x1e0001,_0x34e067,_[_0x7ea1('0x46')](_0x3d3dbb)[_0x7ea1('0x4c')]+0x1)['then'](function(_0x15d6ec){var _0x5d6bff=_[_0x7ea1('0x45')](_0x3d3dbb,_0x15d6ec);_0x5d6bff[_0x7ea1('0xc')]({'type':_0x1e0001['type'],'app':_0x7ea1('0x4d'),'exten':_0x1e0001[_0x7ea1('0xa')],'context':_0x1e0001[_0x7ea1('0x5')],'priority':_[_0x7ea1('0x46')](_0x5d6bff)['priority']+0x1,'VoiceExtensionId':_0x1e0001['id']});return _0x5d6bff;});}}});}; \ No newline at end of file +var _0x5489=['callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','length','name','split','phone','param','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','then','interval','intervals','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'];(function(_0x38ca0e,_0x212524){var _0x587b5e=function(_0x3fd84d){while(--_0x3fd84d){_0x38ca0e['push'](_0x38ca0e['shift']());}};_0x587b5e(++_0x212524);}(_0x5489,0x10a));var _0x9548=function(_0x3a99da,_0x19ecb5){_0x3a99da=_0x3a99da-0x0;var _0x100c13=_0x5489[_0x3a99da];return _0x100c13;};'use strict';var _=require(_0x9548('0x0'));var attributes=require(_0x9548('0x1'));module[_0x9548('0x2')]=function(_0x46c56c){var _0x164d0d=_0x46c56c[_0x9548('0x3')];function _0x155746(_0x59072c){var _0xb06c04=0x2;var _0x1969dc=[{'type':_0x59072c[_0x9548('0x4')],'app':_0x9548('0x5'),'appdata':_0x9548('0x6')+_0x59072c[_0x9548('0x4')],'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c['exten'],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']},{'type':_0x59072c['type'],'app':_0x59072c[_0x9548('0x8')]?'Set':'NoOp','appdata':_0x59072c['alias']?_0x9548('0x9')+_0x59072c[_0x9548('0x8')]:_0x9548('0xa'),'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']}];if(_0x59072c[_0x9548('0x4')]===_0x9548('0xc')){_0x1969dc['push']({'type':_0x9548('0xc'),'app':_0x9548('0x5'),'appdata':'CDR(routeid)='+_0x59072c['id'],'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']});}_0x1969dc[_0x9548('0xd')]({'type':_0x59072c['type'],'app':_0x9548('0x5'),'appdata':_0x9548('0xe'),'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']},{'type':_0x59072c[_0x9548('0x4')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c['exten'],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']},{'type':_0x59072c[_0x9548('0x4')],'app':_0x9548('0x5'),'appdata':_0x9548('0xf'),'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']});return _0x1969dc;}function _0x4148ef(_0x2a4c6c){var _0x1cf037=0x2;var _0x2d8d27=[{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x11'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':'outbound','app':_0x2a4c6c[_0x9548('0x8')]?_0x9548('0x5'):_0x9548('0x12'),'appdata':_0x2a4c6c[_0x9548('0x8')]?'CDR(routeAlias)='+_0x2a4c6c['alias']:_0x9548('0xa'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':'CDR(destination)='+(_0x2a4c6c[_0x9548('0x13')]?_0x9548('0x14')+_0x2a4c6c['cutdigits']+'}':_0x9548('0x15')),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':'outbound','app':_0x9548('0x5'),'appdata':_0x9548('0x16')+_0x2a4c6c['id'],'context':_0x2a4c6c['context'],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x17'),'appdata':_0x9548('0x18')+(_0x1cf037+0x2)+_0x9548('0x19')+(_0x1cf037+0x1)+')','context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x2a4c6c[_0x9548('0x13')]?_0x9548('0x1a')+_0x2a4c6c[_0x9548('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x2a4c6c['context'],'exten':_0x2a4c6c['exten'],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c['exten'],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2a4c6c['context'],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0xf'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x1b')+_0x2a4c6c['id'],'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']}];if(_0x2a4c6c[_0x9548('0x1c')](_0x9548('0x1d'))&&_0x2a4c6c[_0x9548('0x1d')]!==_0x9548('0x1e')){_0x2d8d27[_0x9548('0xd')]({'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x1f'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x20')+_0x2a4c6c[_0x9548('0x1d')]||_0x9548('0x21'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']});}return _0x2d8d27;}function _0x5d9ab6(_0x4e9e19,_0x5a6d00){var _0x49faf0=[{'name':_0x9548('0x22'),'param':0x0},{'name':_0x9548('0x23'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x355dab={};var _0x449fad=_0x5a6d00['split'](',');var _0x595eb2=[];for(var _0x2a7007=0x0;_0x2a7007<_0x49faf0[_0x9548('0x24')];_0x2a7007++){switch(_0x49faf0[_0x2a7007][_0x9548('0x25')]){case _0x9548('0x22'):_0x355dab[_0x9548('0x22')]=_0x449fad[_0x49faf0[_0x2a7007]['param']][_0x9548('0x26')]('/')[0x1];_0x355dab[_0x9548('0x27')]=_0x449fad[_0x49faf0[_0x2a7007][_0x9548('0x28')]][_0x9548('0x26')]('/')[0x2];_0x355dab['prefix']=_0x355dab[_0x9548('0x27')]?_0x355dab['phone']['split']('$')[0x0]:undefined;_0x355dab['phone']=_0x4e9e19[_0x9548('0x13')]?(_0x355dab[_0x9548('0x29')]||'')+_0x9548('0x14')+_0x4e9e19['cutdigits']+'}':(_0x355dab['prefix']||'')+'${EXTEN}';_0x595eb2[_0x49faf0[_0x2a7007][_0x9548('0x28')]]=[_0x9548('0x2a'),_0x355dab[_0x9548('0x22')],_0x355dab[_0x9548('0x27')]][_0x9548('0x2b')]('/');break;case _0x9548('0x2c'):_0x355dab[_0x9548('0x2c')]=_0x449fad[_0x49faf0[_0x2a7007][_0x9548('0x28')]];if(_0x4e9e19[_0x9548('0x1d')]!=='none'){if(_0x355dab[_0x9548('0x2c')][_0x9548('0x2d')](_0x9548('0x2e'))<0x0){_0x355dab[_0x9548('0x2c')]+='U(xcally-mixmonitor-context)';}}else{_0x355dab[_0x9548('0x2c')]=_0x355dab[_0x9548('0x2c')]['replace'](_0x9548('0x2e'),'');}_0x595eb2[_0x49faf0[_0x2a7007][_0x9548('0x28')]]=_0x355dab[_0x9548('0x2c')];break;default:_0x595eb2[_0x49faf0[_0x2a7007][_0x9548('0x28')]]=_0x449fad[_0x49faf0[_0x2a7007][_0x9548('0x28')]];}}return _0x595eb2[_0x9548('0x2b')](',');}function _0x30fcfc(_0x5800f1,_0x3f8930,_0x5c2a0b){return new Promise(function(_0x4c0ee2,_0x19c6e1){var _0x34c3d3=[];if(_[_0x9548('0x2f')](_0x3f8930))return _0x4c0ee2(_0x34c3d3);_0x164d0d[_0x9548('0x30')][_0x9548('0x31')]({'attributes':['id','interval',_0x9548('0x32')],'raw':!![]})[_0x9548('0x33')](function(_0xf99999){for(var _0x16bf0b=0x0,_0x5dbd5b=0x0;_0x16bf0b<_0x3f8930[_0x9548('0x24')];_0x16bf0b++,_0x5dbd5b=0x0){var _0x31e5ec=_0x3f8930[_0x16bf0b];var _0x573eca=[];var _0x350633=[];delete _0x31e5ec['id'];if(_0x31e5ec[_0x9548('0x34')]!=='*,*,*,*'){_0x31e5ec['intervals']=[_0x31e5ec[_0x9548('0x34')]];}else{_0x31e5ec[_0x9548('0x35')]=_0x31e5ec['IntervalId']?_['map'](_['filter'](_0xf99999,{'IntervalId':_0x31e5ec[_0x9548('0x32')]}),_0x9548('0x34')):[];}_0x31e5ec[_0x9548('0x7')]=_0x5800f1[_0x9548('0x7')];_0x31e5ec[_0x9548('0xb')]=_0x5800f1[_0x9548('0xb')];if(_0x31e5ec['type'])_0x31e5ec[_0x9548('0x4')]=_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')]();if(_0x5800f1[_0x9548('0x4')]===_0x9548('0x10')){if(_0x31e5ec['hasOwnProperty'](_0x9548('0x37'))&&_0x31e5ec[_0x9548('0x37')]&&_0x31e5ec[_0x9548('0x37')]!=='--'){_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':_0x9548('0x5'),'appdata':_0x9548('0x38')+_0x31e5ec[_0x9548('0x37')],'context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}_0x573eca['push']({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':_0x9548('0x17'),'appdata':_0x9548('0x39')+(_0x31e5ec[_0x9548('0x3a')]?_0x9548('0x3b')+_0x31e5ec[_0x9548('0x3a')]+')':_0x9548('0x3c')),'context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1['exten'],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}else{if(_0x31e5ec[_0x9548('0x1c')](_0x9548('0x3d'))){if([_0x9548('0x3e'),'playback']['includes'](_0x31e5ec[_0x9548('0x3f')][_0x9548('0x36')]())&&_0x31e5ec['appType']!=='custom'){if(_0x31e5ec[_0x9548('0x3d')]){_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':_0x9548('0x17'),'appdata':_0x9548('0x40'),'context':_0x5800f1['context'],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec['type'][_0x9548('0x36')](),'app':_0x9548('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec['intervals'][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}else{_0x573eca['push']({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':'ExecIf','appdata':_0x9548('0x41'),'context':_0x5800f1['context'],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')]['length']+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec['type'][_0x9548('0x36')](),'app':'Set','appdata':_0x9548('0x42'),'context':_0x5800f1['context'],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')]['length']+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}}}}for(var _0x55e8b3=0x0;_0x55e8b3<_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')];_0x55e8b3++){var _0x253906=_0x5c2a0b+_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')];var _0x3d72e6=_0x55e8b3===_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]-0x1?_0x5c2a0b+_0x573eca[_0x9548('0x24')]+_0x350633[_0x9548('0x24')]+0x2:_0x5c2a0b+_0x55e8b3+0x1;_0x573eca[_0x9548('0x43')](_0x55e8b3,0x0,{'type':_0x5800f1['type'],'app':'GotoIfTime','appdata':_0x31e5ec[_0x9548('0x35')][_0x55e8b3]+'?'+_0x5800f1['context']+_0x9548('0x44')+_0x253906+':'+_0x5800f1[_0x9548('0x7')]+_0x9548('0x44')+_0x3d72e6,'exten':_0x5800f1[_0x9548('0xb')],'context':_0x5800f1['context'],'priority':_0x5c2a0b+_0x55e8b3,'VoiceExtensionId':_0x5800f1['id']});}if(_0x31e5ec[_0x9548('0x45')]===_0x9548('0x46')){_0x31e5ec[_0x9548('0x47')]=_0x5d9ab6(_0x5800f1,_0x31e5ec[_0x9548('0x47')]);}if(_0x31e5ec[_0x9548('0x45')]===_0x9548('0x48')){_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec['type'][_0x9548('0x36')](),'app':_0x9548('0x5'),'appdata':_0x9548('0x49'),'context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}_0x31e5ec['priority']=_0x573eca[_0x9548('0x24')]?_['last'](_0x573eca)[_0x9548('0x4a')]+0x1:_0x5c2a0b;_0x34c3d3=_['concat'](_0x34c3d3,_0x573eca,[_0x31e5ec],_0x350633);_0x5c2a0b=_[_0x9548('0x4b')](_0x34c3d3)[_0x9548('0x4a')]+0x1;}return _0x4c0ee2(_0x34c3d3);})[_0x9548('0x4c')](function(_0x22e611){_0x19c6e1(_0x22e611);});});}return _0x46c56c[_0x9548('0x4d')](_0x9548('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4667ac){var _0x1e4b94=this[_0x9548('0x4f')]({'plain':!![]});var _0x2deeb7=_0x1e4b94[_0x9548('0x4')]===_0x9548('0x10')?_0x4148ef(_0x1e4b94):_0x155746(_0x1e4b94);return _0x30fcfc(_0x1e4b94,_0x4667ac,_[_0x9548('0x4b')](_0x2deeb7)[_0x9548('0x4a')]+0x1)['then'](function(_0x49f4d1){var _0x498a07=_['concat'](_0x2deeb7,_0x49f4d1);_0x498a07[_0x9548('0xd')]({'type':_0x1e4b94[_0x9548('0x4')],'app':_0x9548('0x50'),'exten':_0x1e4b94['exten'],'context':_0x1e4b94['context'],'priority':_[_0x9548('0x4b')](_0x498a07)[_0x9548('0x4a')]+0x1,'VoiceExtensionId':_0x1e4b94['id']});return _0x498a07;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 66e6231..31942b9 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 _0xfb82=['map','model','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','include'];(function(_0x46e79b,_0x51f63f){var _0x32647d=function(_0x406a58){while(--_0x406a58){_0x46e79b['push'](_0x46e79b['shift']());}};_0x32647d(++_0x51f63f);}(_0xfb82,0x17f));var _0x2fb8=function(_0x524a74,_0x422573){_0x524a74=_0x524a74-0x0;var _0x4bd1c1=_0xfb82[_0x524a74];return _0x4bd1c1;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var moment=require(_0x2fb8('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fb8('0x3'));var fs=require('fs');var Redis=require(_0x2fb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fb8('0x5'));var logger=require(_0x2fb8('0x6'))(_0x2fb8('0x7'));var config=require(_0x2fb8('0x8'));var jayson=require(_0x2fb8('0x9'));var client=jayson[_0x2fb8('0xa')][_0x2fb8('0xb')]({'port':0x232a});config[_0x2fb8('0xc')]=_[_0x2fb8('0xd')](config[_0x2fb8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2fb8('0xe'))(new Redis(config[_0x2fb8('0xc')]));require(_0x2fb8('0xf'))[_0x2fb8('0x10')](socket);function respondWithRpcPromise(_0x3f1637,_0x22824a,_0x207a10){return new BPromise(function(_0x2928ef,_0x154d92){return client[_0x2fb8('0x11')](_0x3f1637,_0x207a10)[_0x2fb8('0x12')](function(_0x55bcfc){logger[_0x2fb8('0x13')](_0x2fb8('0x14'),_0x22824a,_0x2fb8('0x15'));logger[_0x2fb8('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x22824a,'request\x20sent',JSON[_0x2fb8('0x17')](_0x55bcfc));if(_0x55bcfc['error']){if(_0x55bcfc[_0x2fb8('0x18')][_0x2fb8('0x19')]===0x1f4){logger['error'](_0x2fb8('0x14'),_0x22824a,_0x55bcfc[_0x2fb8('0x18')]['message']);return _0x154d92(_0x55bcfc['error'][_0x2fb8('0x1a')]);}logger[_0x2fb8('0x18')](_0x2fb8('0x14'),_0x22824a,_0x55bcfc[_0x2fb8('0x18')]['message']);return _0x2928ef(_0x55bcfc[_0x2fb8('0x18')][_0x2fb8('0x1a')]);}else{logger['info'](_0x2fb8('0x14'),_0x22824a,_0x2fb8('0x15'));_0x2928ef(_0x55bcfc[_0x2fb8('0x1b')]['message']);}})['catch'](function(_0x1bee80){logger[_0x2fb8('0x18')](_0x2fb8('0x14'),_0x22824a,_0x1bee80);_0x154d92(_0x1bee80);});});}exports[_0x2fb8('0x1c')]=function(_0x49396f){var _0x3327f3=this;return new Promise(function(_0xffd9ec,_0x1aa17e){return db[_0x2fb8('0x1d')][_0x2fb8('0x1e')]({'raw':_0x49396f['options']?_0x49396f[_0x2fb8('0x1f')][_0x2fb8('0x20')]===undefined?!![]:![]:!![],'where':_0x49396f[_0x2fb8('0x1f')]?_0x49396f['options']['where']||null:null,'attributes':_0x49396f[_0x2fb8('0x1f')]?_0x49396f[_0x2fb8('0x1f')][_0x2fb8('0x21')]||null:null,'limit':_0x49396f[_0x2fb8('0x1f')]?_0x49396f[_0x2fb8('0x1f')]['limit']||null:null,'include':_0x49396f[_0x2fb8('0x1f')]?_0x49396f[_0x2fb8('0x1f')][_0x2fb8('0x22')]?_[_0x2fb8('0x23')](_0x49396f[_0x2fb8('0x1f')][_0x2fb8('0x22')],function(_0x2babf4){return{'model':db[_0x2babf4['model']],'as':_0x2babf4['as'],'attributes':_0x2babf4[_0x2fb8('0x21')],'include':_0x2babf4['include']?_[_0x2fb8('0x23')](_0x2babf4[_0x2fb8('0x22')],function(_0x77bdc2){return{'model':db[_0x77bdc2[_0x2fb8('0x24')]],'as':_0x77bdc2['as'],'attributes':_0x77bdc2[_0x2fb8('0x21')],'include':_0x77bdc2[_0x2fb8('0x22')]?_[_0x2fb8('0x23')](_0x77bdc2[_0x2fb8('0x22')],function(_0x4f9adf){return{'model':db[_0x4f9adf[_0x2fb8('0x24')]],'as':_0x4f9adf['as'],'attributes':_0x4f9adf[_0x2fb8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2fb8('0x12')](function(_0x462937){logger[_0x2fb8('0x13')](_0x2fb8('0x1c'),_0x49396f);logger[_0x2fb8('0x16')]('GetVoiceExtension',_0x49396f,JSON['stringify'](_0x462937));_0xffd9ec(_0x462937);})[_0x2fb8('0x25')](function(_0x148418){logger['error']('GetVoiceExtension',_0x148418[_0x2fb8('0x1a')],_0x49396f);_0x1aa17e(_0x3327f3['error'](0x1f4,_0x148418['message']));});});}; \ No newline at end of file +var _0x1766=['then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x1f7c90,_0x23a49e){var _0x145a29=function(_0x3a49d7){while(--_0x3a49d7){_0x1f7c90['push'](_0x1f7c90['shift']());}};_0x145a29(++_0x23a49e);}(_0x1766,0x17d));var _0x6176=function(_0x16f5a3,_0x479984){_0x16f5a3=_0x16f5a3-0x0;var _0x3269af=_0x1766[_0x16f5a3];return _0x3269af;};'use strict';var _=require(_0x6176('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6176('0x1'));var rs=require(_0x6176('0x2'));var fs=require('fs');var Redis=require(_0x6176('0x3'));var db=require(_0x6176('0x4'))['db'];var utils=require(_0x6176('0x5'));var logger=require(_0x6176('0x6'))('rpc');var config=require(_0x6176('0x7'));var jayson=require(_0x6176('0x8'));var client=jayson['client'][_0x6176('0x9')]({'port':0x232a});config[_0x6176('0xa')]=_[_0x6176('0xb')](config[_0x6176('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6176('0xc'))(new Redis(config[_0x6176('0xa')]));require(_0x6176('0xd'))[_0x6176('0xe')](socket);function respondWithRpcPromise(_0x18e00d,_0x4eb9e0,_0x29570a){return new BPromise(function(_0x18a20b,_0x3da3c8){return client['request'](_0x18e00d,_0x29570a)[_0x6176('0xf')](function(_0x4ae0aa){logger[_0x6176('0x10')](_0x6176('0x11'),_0x4eb9e0,_0x6176('0x12'));logger[_0x6176('0x13')](_0x6176('0x14'),_0x4eb9e0,'request\x20sent',JSON[_0x6176('0x15')](_0x4ae0aa));if(_0x4ae0aa[_0x6176('0x16')]){if(_0x4ae0aa[_0x6176('0x16')][_0x6176('0x17')]===0x1f4){logger[_0x6176('0x16')](_0x6176('0x11'),_0x4eb9e0,_0x4ae0aa[_0x6176('0x16')]['message']);return _0x3da3c8(_0x4ae0aa[_0x6176('0x16')][_0x6176('0x18')]);}logger[_0x6176('0x16')](_0x6176('0x11'),_0x4eb9e0,_0x4ae0aa['error']['message']);return _0x18a20b(_0x4ae0aa['error'][_0x6176('0x18')]);}else{logger[_0x6176('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x4eb9e0,'request\x20sent');_0x18a20b(_0x4ae0aa[_0x6176('0x19')]['message']);}})['catch'](function(_0x3b97f9){logger[_0x6176('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x4eb9e0,_0x3b97f9);_0x3da3c8(_0x3b97f9);});});}exports[_0x6176('0x1a')]=function(_0x5a2c4f){var _0x3b44e2=this;return new Promise(function(_0x83f3e5,_0x540adf){return db['VoiceExtension'][_0x6176('0x1b')]({'raw':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a2c4f['options']?_0x5a2c4f[_0x6176('0x1c')]['where']||null:null,'attributes':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x1e')]||null:null,'limit':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x1f')]||null:null,'include':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x20')]?_[_0x6176('0x21')](_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x20')],function(_0x4d9be6){return{'model':db[_0x4d9be6[_0x6176('0x22')]],'as':_0x4d9be6['as'],'attributes':_0x4d9be6[_0x6176('0x1e')],'include':_0x4d9be6[_0x6176('0x20')]?_[_0x6176('0x21')](_0x4d9be6[_0x6176('0x20')],function(_0x20efab){return{'model':db[_0x20efab[_0x6176('0x22')]],'as':_0x20efab['as'],'attributes':_0x20efab[_0x6176('0x1e')],'include':_0x20efab[_0x6176('0x20')]?_[_0x6176('0x21')](_0x20efab[_0x6176('0x20')],function(_0x301a0d){return{'model':db[_0x301a0d[_0x6176('0x22')]],'as':_0x301a0d['as'],'attributes':_0x301a0d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6176('0xf')](function(_0x256583){logger[_0x6176('0x10')](_0x6176('0x1a'),_0x5a2c4f);logger['debug'](_0x6176('0x1a'),_0x5a2c4f,JSON[_0x6176('0x15')](_0x256583));_0x83f3e5(_0x256583);})[_0x6176('0x23')](function(_0x53618c){logger[_0x6176('0x16')]('GetVoiceExtension',_0x53618c[_0x6176('0x18')],_0x5a2c4f);_0x540adf(_0x3b44e2['error'](0x1f4,_0x53618c[_0x6176('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d7e1d12..ed340c0 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x5e1f26,_0x289f4b){var _0x425873=function(_0x169cc5){while(--_0x169cc5){_0x5e1f26['push'](_0x5e1f26['shift']());}};_0x425873(++_0x289f4b);}(_0x4975,0x86));var _0x5497=function(_0x5711c3,_0x3d451d){_0x5711c3=_0x5711c3-0x0;var _0x2e2835=_0x4975[_0x5711c3];return _0x2e2835;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x358502,_0x5a5a95){var _0x1915ab=function(_0x38192e){while(--_0x38192e){_0x358502['push'](_0x358502['shift']());}};_0x1915ab(++_0x5a5a95);}(_0x1261,0x144));var _0x1126=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x1261[_0x3a7e01];return _0x5b8398;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3ce5ec5..9a20a05 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 _0xf61e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','show','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x527a47,_0x1e38ab){var _0x4d09ae=function(_0x2cb779){while(--_0x2cb779){_0x527a47['push'](_0x527a47['shift']());}};_0x4d09ae(++_0x1e38ab);}(_0xf61e,0x191));var _0xef61=function(_0x381e67,_0x3516ea){_0x381e67=_0x381e67-0x0;var _0x1b6e5a=_0xf61e[_0x381e67];return _0x1b6e5a;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/:id',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')]('/',auth[_0xef61('0xd')](),controller[_0xef61('0x11')]);router[_0xef61('0x12')](_0xef61('0x13'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);router[_0xef61('0x15')](_0xef61('0x13'),auth[_0xef61('0xd')](),controller[_0xef61('0x16')]);module[_0xef61('0x17')]=router; \ No newline at end of file +var _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update'];(function(_0x7611ce,_0x4a4441){var _0x67d3ab=function(_0x1456d8){while(--_0x1456d8){_0x7611ce['push'](_0x7611ce['shift']());}};_0x67d3ab(++_0x4a4441);}(_0xadb5,0xad));var _0x5adb=function(_0x3be815,_0xe6932f){_0x3be815=_0x3be815-0x0;var _0xbc01f2=_0xadb5[_0x3be815];return _0xbc01f2;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./voiceMail.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a708343..5f520b0 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 _0xe58f=['central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim'];(function(_0x350a58,_0x1bed5e){var _0x486a60=function(_0x37a39c){while(--_0x37a39c){_0x350a58['push'](_0x350a58['shift']());}};_0x486a60(++_0x1bed5e);}(_0xe58f,0xf5));var _0xfe58=function(_0x231876,_0x30c77b){_0x231876=_0x231876-0x0;var _0x2f49e1=_0xe58f[_0x231876];return _0x2f49e1;};'use strict';var Sequelize=require(_0xfe58('0x0'));module[_0xfe58('0x1')]={'customer_id':{'type':Sequelize[_0xfe58('0x2')]},'context':{'type':Sequelize[_0xfe58('0x2')],'defaultValue':'from-voicemail','unique':_0xfe58('0x3')},'mailbox':{'type':Sequelize[_0xfe58('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfe58('0x2')]},'fullname':{'type':Sequelize[_0xfe58('0x2')]},'email':{'type':Sequelize[_0xfe58('0x2')],'validate':{'isEmail':!![]},'set':function(_0x18d0d6){this[_0xfe58('0x4')](_0xfe58('0x5'),typeof _0x18d0d6==='string'&&_0x18d0d6[_0xfe58('0x6')]()?_0x18d0d6[_0xfe58('0x6')]():null);}},'pager':{'type':Sequelize[_0xfe58('0x2')]},'tz':{'type':Sequelize[_0xfe58('0x2')],'defaultValue':_0xfe58('0x7')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xfe58('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfe58('0x9')]('yes','no'),'defaultValue':_0xfe58('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfe58('0x2')]},'callback':{'type':Sequelize[_0xfe58('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfe58('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfe58('0x9')](_0xfe58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfe58('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xfe58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xfe58('0x8'),'no'),'defaultValue':_0xfe58('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xfe58('0x9')](_0xfe58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfe58('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfe58('0x9')](_0xfe58('0x8'),'no'),'defaultValue':_0xfe58('0x8'),'allowNull':![]},'stamp':{'type':_0xfe58('0xb')},'emailsubject':{'type':Sequelize[_0xfe58('0x2')]},'emailbody':{'type':Sequelize[_0xfe58('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfe58('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfe58('0xd')],'get':function(){return this[_0xfe58('0xe')](_0xfe58('0xf'))+_0xfe58('0x10')+this['getDataValue'](_0xfe58('0x11'));}}}; \ No newline at end of file +var _0xa424=['trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0xe2ea05,_0x2e5d44){var _0x3ae10a=function(_0x1775a6){while(--_0x1775a6){_0xe2ea05['push'](_0xe2ea05['shift']());}};_0x3ae10a(++_0x2e5d44);}(_0xa424,0x14c));var _0x4a42=function(_0x4c8758,_0x1a42b6){_0x4c8758=_0x4c8758-0x0;var _0x2e6804=_0xa424[_0x4c8758];return _0x2e6804;};'use strict';var Sequelize=require(_0x4a42('0x0'));module[_0x4a42('0x1')]={'customer_id':{'type':Sequelize[_0x4a42('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x4a42('0x3'),'unique':_0x4a42('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x4a42('0x4')},'password':{'type':Sequelize[_0x4a42('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x4a42('0x2')],'validate':{'isEmail':!![]},'set':function(_0xb9eb55){this[_0x4a42('0x5')](_0x4a42('0x6'),typeof _0xb9eb55===_0x4a42('0x7')&&_0xb9eb55[_0x4a42('0x8')]()?_0xb9eb55[_0x4a42('0x8')]():null);}},'pager':{'type':Sequelize[_0x4a42('0x2')]},'tz':{'type':Sequelize[_0x4a42('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x4a42('0x9')]('yes','no'),'defaultValue':_0x4a42('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x4a42('0x2')]},'review':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4a42('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4a42('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4a42('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x4a42('0xa'),'no'),'defaultValue':_0x4a42('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4a42('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4a42('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4a42('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4a42('0xd')],'get':function(){return this[_0x4a42('0xe')](_0x4a42('0xf'))+_0x4a42('0x10')+this[_0x4a42('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 73b5e79..973ccd1 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 _0x39cb=['filter','merge','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','then','Voicemails','UserProfileResource','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39cb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb39c('0x0'));var zipdir=require(_0xb39c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x4'));var util=require(_0xb39c('0x5'));var path=require(_0xb39c('0x6'));var sox=require(_0xb39c('0x7'));var csv=require(_0xb39c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb39c('0x9'));var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0x8'));var querystring=require(_0xb39c('0xd'));var Papa=require(_0xb39c('0xe'));var Redis=require(_0xb39c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x10'));var logger=require(_0xb39c('0x11'))(_0xb39c('0x12'));var utils=require(_0xb39c('0x13'));var config=require(_0xb39c('0x14'));var licenseUtil=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];function respondWithStatusCode(_0x18d12e,_0x51ff24){_0x51ff24=_0x51ff24||0xcc;return function(_0x31e07e){if(_0x31e07e){return _0x18d12e[_0xb39c('0x17')](_0x51ff24);}return _0x18d12e[_0xb39c('0x18')](_0x51ff24)['end']();};}function respondWithResult(_0xf4662a,_0x40a6d3){_0x40a6d3=_0x40a6d3||0xc8;return function(_0x42a203){if(_0x42a203){return _0xf4662a[_0xb39c('0x18')](_0x40a6d3)[_0xb39c('0x19')](_0x42a203);}};}function respondWithFilteredResult(_0x27c22a,_0x8e9181){return function(_0x5277ce){if(_0x5277ce){var _0x316c9b=typeof _0x8e9181[_0xb39c('0x1a')]===_0xb39c('0x1b')&&typeof _0x8e9181[_0xb39c('0x1c')]===_0xb39c('0x1b');var _0x3b7fad=_0x5277ce[_0xb39c('0x1d')];var _0x4e02cf=_0x316c9b?0x0:_0x8e9181[_0xb39c('0x1a')];var _0x2eeae6=_0x316c9b?_0x5277ce['count']:_0x8e9181[_0xb39c('0x1a')]+_0x8e9181[_0xb39c('0x1c')];var _0x28bbe1;if(_0x2eeae6>=_0x3b7fad){_0x2eeae6=_0x3b7fad;_0x28bbe1=0xc8;}else{_0x28bbe1=0xce;}_0x27c22a[_0xb39c('0x18')](_0x28bbe1);return _0x27c22a['set'](_0xb39c('0x1e'),_0x4e02cf+'-'+_0x2eeae6+'/'+_0x3b7fad)[_0xb39c('0x19')](_0x5277ce);}return null;};}function patchUpdates(_0x5e4a0b){return function(_0x2d8e93){try{jsonpatch[_0xb39c('0x1f')](_0x2d8e93,_0x5e4a0b,!![]);}catch(_0x1d3e2d){return BPromise['reject'](_0x1d3e2d);}return _0x2d8e93['save']();};}function saveUpdates(_0x2789fd,_0x1a5b9d){return function(_0x3c8dfd){if(_0x3c8dfd){return _0x3c8dfd['update'](_0x2789fd)[_0xb39c('0x20')](function(_0x438207){return _0x438207;});}return null;};}function removeEntity(_0x1bb895,_0x16f3b0){return function(_0x3b03ed){if(_0x3b03ed){return _0x3b03ed['destroy']()[_0xb39c('0x20')](function(){var _0xbeab7e=_0x3b03ed['get']({'plain':!![]});var _0x1fd145=_0xb39c('0x21');return db[_0xb39c('0x22')][_0xb39c('0x23')]({'where':{'type':_0x1fd145,'resourceId':_0xbeab7e['id']}})[_0xb39c('0x20')](function(){return _0x3b03ed;});})['then'](function(){_0x1bb895[_0xb39c('0x18')](0xcc)[_0xb39c('0x24')]();});}};}function handleEntityNotFound(_0x132769,_0x4c06fa){return function(_0x41fff2){if(!_0x41fff2){_0x132769[_0xb39c('0x17')](0x194);}return _0x41fff2;};}function handleError(_0x52eb5e,_0x3d08e1){_0x3d08e1=_0x3d08e1||0x1f4;return function(_0x4b4458){logger[_0xb39c('0x25')](_0x4b4458['stack']);if(_0x4b4458[_0xb39c('0x26')]){delete _0x4b4458[_0xb39c('0x26')];}_0x52eb5e['status'](_0x3d08e1)[_0xb39c('0x27')](_0x4b4458);};}exports['index']=function(_0x8e2d7,_0x2d2743){var _0x309697={},_0x7339b4={},_0x17eb7b={'count':0x0,'rows':[]};var _0x52e642=_[_0xb39c('0x28')](db['VoiceMail'][_0xb39c('0x29')],function(_0x48a888){return{'name':_0x48a888[_0xb39c('0x2a')],'type':_0x48a888[_0xb39c('0x2b')][_0xb39c('0x2c')]};});_0x7339b4[_0xb39c('0x2d')]=_['map'](_0x52e642,'name');_0x7339b4[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x8e2d7['query']);_0x7339b4[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x7339b4[_0xb39c('0x2d')],_0x7339b4[_0xb39c('0x2e')]);_0x309697[_0xb39c('0x32')]=_[_0xb39c('0x31')](_0x7339b4[_0xb39c('0x2d')],qs[_0xb39c('0x33')](_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x309697[_0xb39c('0x32')]=_0x309697[_0xb39c('0x32')][_0xb39c('0x34')]?_0x309697[_0xb39c('0x32')]:_0x7339b4[_0xb39c('0x2d')];if(!_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x35')](_0xb39c('0x36'))){_0x309697[_0xb39c('0x1c')]=qs['limit'](_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x1c')]);_0x309697['offset']=qs['offset'](_0x8e2d7['query'][_0xb39c('0x1a')]);}_0x309697[_0xb39c('0x37')]=qs[_0xb39c('0x38')](_0x8e2d7['query'][_0xb39c('0x38')]);_0x309697[_0xb39c('0x39')]=qs[_0xb39c('0x30')](_[_0xb39c('0x3a')](_0x8e2d7[_0xb39c('0x2e')],_0x7339b4['filters']),_0x52e642);if(_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3b')]){_0x309697['where']=_[_0xb39c('0x3c')](_0x309697['where'],{'$or':_[_0xb39c('0x28')](_0x52e642,function(_0xc6e494){if(_0xc6e494[_0xb39c('0x2b')]!=='VIRTUAL'){var _0x406fc6={};_0x406fc6[_0xc6e494[_0xb39c('0x26')]]={'$like':'%'+_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3b')]+'%'};return _0x406fc6;}})});}_0x309697=_[_0xb39c('0x3c')]({},_0x309697,_0x8e2d7[_0xb39c('0x3d')]);var _0x17ed52={'where':_0x309697[_0xb39c('0x39')]};return db[_0xb39c('0x3e')][_0xb39c('0x1d')](_0x17ed52)[_0xb39c('0x20')](function(_0xd1136f){_0x17eb7b['count']=_0xd1136f;if(_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3f')]){_0x309697[_0xb39c('0x40')]=[{'all':!![]}];}return db[_0xb39c('0x3e')][_0xb39c('0x41')](_0x309697);})[_0xb39c('0x20')](function(_0x1db549){_0x17eb7b[_0xb39c('0x42')]=_0x1db549;return _0x17eb7b;})[_0xb39c('0x20')](respondWithFilteredResult(_0x2d2743,_0x309697))['catch'](handleError(_0x2d2743,null));};exports['show']=function(_0x2f88c9,_0x36d948){var _0x496da9={'raw':!![],'where':{'id':_0x2f88c9[_0xb39c('0x43')]['id']}},_0x4bc2be={};_0x4bc2be['model']=_[_0xb39c('0x2f')](db[_0xb39c('0x3e')][_0xb39c('0x29')]);_0x4bc2be[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x2f88c9['query']);_0x4bc2be[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x4bc2be['model'],_0x4bc2be['query']);_0x496da9[_0xb39c('0x32')]=_['intersection'](_0x4bc2be['model'],qs[_0xb39c('0x33')](_0x2f88c9[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x496da9[_0xb39c('0x32')]=_0x496da9[_0xb39c('0x32')][_0xb39c('0x34')]?_0x496da9[_0xb39c('0x32')]:_0x4bc2be[_0xb39c('0x2d')];if(_0x2f88c9[_0xb39c('0x2e')][_0xb39c('0x3f')]){_0x496da9['include']=[{'all':!![]}];}_0x496da9=_[_0xb39c('0x3c')]({},_0x496da9,_0x2f88c9[_0xb39c('0x3d')]);return db[_0xb39c('0x3e')][_0xb39c('0x44')](_0x496da9)[_0xb39c('0x20')](handleEntityNotFound(_0x36d948,null))[_0xb39c('0x20')](respondWithResult(_0x36d948,null))[_0xb39c('0x45')](handleError(_0x36d948,null));};exports[_0xb39c('0x46')]=function(_0x38bc36,_0x1ae2cb){return db[_0xb39c('0x3e')][_0xb39c('0x46')](_0x38bc36[_0xb39c('0x47')],{})[_0xb39c('0x20')](function(_0x17ad13){var _0x44b825=_0x38bc36['user'][_0xb39c('0x48')]({'plain':!![]});if(!_0x44b825)throw new Error(_0xb39c('0x49'));if(_0x44b825[_0xb39c('0x4a')]===_0xb39c('0x4b')){var _0xa50077=_0x17ad13[_0xb39c('0x48')]({'plain':!![]});var _0xd4f368=_0xb39c('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xd4f368,'userProfileId':_0x44b825[_0xb39c('0x4c')]},'raw':!![]})[_0xb39c('0x20')](function(_0x5a7e75){if(_0x5a7e75&&_0x5a7e75['autoAssociation']===0x0){return db[_0xb39c('0x22')][_0xb39c('0x46')]({'name':_0xa50077['name'],'resourceId':_0xa50077['id'],'type':_0x5a7e75[_0xb39c('0x26')],'sectionId':_0x5a7e75['id']},{})['then'](function(){return _0x17ad13;});}else{return _0x17ad13;}})['catch'](function(_0x2d88dd){logger['error'](_0xb39c('0x4d'),_0x2d88dd);throw _0x2d88dd;});}return _0x17ad13;})[_0xb39c('0x20')](respondWithResult(_0x1ae2cb,0xc9))[_0xb39c('0x45')](handleError(_0x1ae2cb,null));};exports[_0xb39c('0x4e')]=function(_0x2f2944,_0x97f170){if(_0x2f2944['body']['id']){delete _0x2f2944[_0xb39c('0x47')]['id'];}return db[_0xb39c('0x3e')][_0xb39c('0x44')]({'where':{'id':_0x2f2944[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x97f170,null))['then'](saveUpdates(_0x2f2944[_0xb39c('0x47')],null))['then'](respondWithResult(_0x97f170,null))[_0xb39c('0x45')](handleError(_0x97f170,null));};exports[_0xb39c('0x23')]=function(_0x131cb2,_0x9e4e89){return db[_0xb39c('0x3e')][_0xb39c('0x44')]({'where':{'id':_0x131cb2[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x9e4e89,null))[_0xb39c('0x20')](removeEntity(_0x9e4e89,null))[_0xb39c('0x45')](handleError(_0x9e4e89,null));};exports[_0xb39c('0x4f')]=function(_0x260fbf,_0x2620ee,_0x33c0c6){return db[_0xb39c('0x3e')][_0xb39c('0x50')]({'where':{'id':_0x260fbf[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x2620ee,null))[_0xb39c('0x20')](function(_0x49f118){var _0x57f2f4;var _0x1e9893={},_0x15534c={};_0x15534c['model']=_[_0xb39c('0x2f')](db[_0xb39c('0x51')]['rawAttributes']);_0x15534c[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x260fbf[_0xb39c('0x2e')]);_0x15534c[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x15534c[_0xb39c('0x2d')],_0x15534c['query']);_0x1e9893[_0xb39c('0x32')]=_[_0xb39c('0x31')](_0x15534c[_0xb39c('0x2d')],qs[_0xb39c('0x33')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x1e9893[_0xb39c('0x32')]=_0x1e9893['attributes'][_0xb39c('0x34')]?_0x1e9893[_0xb39c('0x32')]:_0x15534c[_0xb39c('0x2d')];if(!_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x35')]('nolimit')){_0x1e9893['limit']=qs[_0xb39c('0x1c')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x1c')]);_0x1e9893['offset']=qs[_0xb39c('0x1a')](_0x260fbf['query'][_0xb39c('0x1a')]);}_0x1e9893['order']=qs[_0xb39c('0x38')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x38')]);_0x1e9893['where']=qs[_0xb39c('0x30')](_[_0xb39c('0x3a')](_0x260fbf[_0xb39c('0x2e')],_0x15534c[_0xb39c('0x30')]));if(_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x3b')]){_0x1e9893[_0xb39c('0x39')]=_[_0xb39c('0x3c')](_0x1e9893[_0xb39c('0x39')],{'$or':_[_0xb39c('0x28')](_0x1e9893[_0xb39c('0x32')],function(_0x227152){var _0x3fb267={};_0x3fb267[_0x227152]={'$like':'%'+_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x3b')]+'%'};return _0x3fb267;})});}_0x1e9893[_0xb39c('0x39')]=_[_0xb39c('0x3c')](_0x1e9893['where'],{'mailboxuser':_0x49f118[_0xb39c('0x52')]});_0x1e9893=_[_0xb39c('0x3c')]({},_0x1e9893,_0x260fbf[_0xb39c('0x3d')]);return db['VoiceMailMessage'][_0xb39c('0x53')](_0x1e9893)['then'](respondWithFilteredResult(_0x2620ee,_0x1e9893));})['catch'](handleError(_0x2620ee,null));}; \ No newline at end of file +var _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xf4eb,0xec));var _0xbf4e=function(_0x50c79a,_0x4c9f8a){_0x50c79a=_0x50c79a-0x0;var _0x27eb34=_0xf4eb[_0x50c79a];return _0x27eb34;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9523fb3..5372589 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 _0x48ed=['./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d7d8d,_0x2d040f){var _0x1be7fc=function(_0x388a1f){while(--_0x388a1f){_0x5d7d8d['push'](_0x5d7d8d['shift']());}};_0x1be7fc(++_0x2d040f);}(_0x48ed,0xac));var _0xd48e=function(_0x301075,_0x33b785){_0x301075=_0x301075-0x0;var _0x1a04c5=_0x48ed[_0x301075];return _0x1a04c5;};'use strict';var _=require('lodash');var util=require(_0xd48e('0x0'));var logger=require(_0xd48e('0x1'))(_0xd48e('0x2'));var moment=require('moment');var BPromise=require(_0xd48e('0x3'));var rp=require(_0xd48e('0x4'));var fs=require('fs');var path=require(_0xd48e('0x5'));var rimraf=require(_0xd48e('0x6'));var config=require(_0xd48e('0x7'));var attributes=require(_0xd48e('0x8'));module[_0xd48e('0x9')]=function(_0x298e72,_0xaad31){return _0x298e72[_0xd48e('0xa')]('VoiceMail',attributes,{'tableName':_0xd48e('0xb'),'paranoid':![],'indexes':[{'name':_0xd48e('0xc'),'fields':[_0xd48e('0xd'),_0xd48e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd91a=['../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3b17ae,_0x54073e){var _0x4f6538=function(_0x1d20ce){while(--_0x1d20ce){_0x3b17ae['push'](_0x3b17ae['shift']());}};_0x4f6538(++_0x54073e);}(_0xd91a,0x133));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xad91('0x0'));var logger=require(_0xad91('0x1'))('api');var moment=require('moment');var BPromise=require(_0xad91('0x2'));var rp=require(_0xad91('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad91('0x4'));var config=require(_0xad91('0x5'));var attributes=require(_0xad91('0x6'));module[_0xad91('0x7')]=function(_0x333851,_0x351924){return _0x333851['define'](_0xad91('0x8'),attributes,{'tableName':_0xad91('0x9'),'paranoid':![],'indexes':[{'name':_0xad91('0xa'),'fields':[_0xad91('0xb'),_0xad91('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 5a057b3..643bd64 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 _0x5352=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x28b146,_0x55052b){var _0x598444=function(_0x2248a9){while(--_0x2248a9){_0x28b146['push'](_0x28b146['shift']());}};_0x598444(++_0x55052b);}(_0x5352,0x165));var _0x2535=function(_0x524fc0,_0x1544f6){_0x524fc0=_0x524fc0-0x0;var _0x2469f2=_0x5352[_0x524fc0];return _0x2469f2;};'use strict';var _=require(_0x2535('0x0'));var util=require('util');var moment=require(_0x2535('0x1'));var BPromise=require('bluebird');var rs=require(_0x2535('0x2'));var fs=require('fs');var Redis=require(_0x2535('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2535('0x4'));var logger=require(_0x2535('0x5'))(_0x2535('0x6'));var config=require(_0x2535('0x7'));var jayson=require(_0x2535('0x8'));var client=jayson[_0x2535('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x573971,_0x1063b2,_0x25605b){return new BPromise(function(_0x3b9ddf,_0x3bc419){return client[_0x2535('0xa')](_0x573971,_0x25605b)[_0x2535('0xb')](function(_0x366a00){logger[_0x2535('0xc')](_0x2535('0xd'),_0x1063b2,_0x2535('0xe'));logger[_0x2535('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1063b2,'request\x20sent',JSON[_0x2535('0x10')](_0x366a00));if(_0x366a00[_0x2535('0x11')]){if(_0x366a00[_0x2535('0x11')][_0x2535('0x12')]===0x1f4){logger[_0x2535('0x11')](_0x2535('0xd'),_0x1063b2,_0x366a00[_0x2535('0x11')][_0x2535('0x13')]);return _0x3bc419(_0x366a00['error'][_0x2535('0x13')]);}logger[_0x2535('0x11')](_0x2535('0xd'),_0x1063b2,_0x366a00[_0x2535('0x11')][_0x2535('0x13')]);return _0x3b9ddf(_0x366a00[_0x2535('0x11')]['message']);}else{logger[_0x2535('0xc')](_0x2535('0xd'),_0x1063b2,_0x2535('0xe'));_0x3b9ddf(_0x366a00['result'][_0x2535('0x13')]);}})[_0x2535('0x14')](function(_0x38716b){logger[_0x2535('0x11')](_0x2535('0xd'),_0x1063b2,_0x38716b);_0x3bc419(_0x38716b);});});} \ No newline at end of file +var _0x75c2=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x312428,_0x458f28){var _0x583514=function(_0x305d1d){while(--_0x305d1d){_0x312428['push'](_0x312428['shift']());}};_0x583514(++_0x458f28);}(_0x75c2,0x85));var _0x275c=function(_0x557e95,_0x3d9496){_0x557e95=_0x557e95-0x0;var _0x3e6b70=_0x75c2[_0x557e95];return _0x3e6b70;};'use strict';var _=require('lodash');var util=require(_0x275c('0x0'));var moment=require('moment');var BPromise=require(_0x275c('0x1'));var rs=require(_0x275c('0x2'));var fs=require('fs');var Redis=require(_0x275c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x275c('0x4'));var logger=require(_0x275c('0x5'))('rpc');var config=require(_0x275c('0x6'));var jayson=require(_0x275c('0x7'));var client=jayson[_0x275c('0x8')][_0x275c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5adb43,_0x9565a2,_0xd743fa){return new BPromise(function(_0x56f552,_0xb2a8e3){return client[_0x275c('0xa')](_0x5adb43,_0xd743fa)['then'](function(_0x5b4f9e){logger['info'](_0x275c('0xb'),_0x9565a2,_0x275c('0xc'));logger[_0x275c('0xd')](_0x275c('0xe'),_0x9565a2,_0x275c('0xc'),JSON[_0x275c('0xf')](_0x5b4f9e));if(_0x5b4f9e[_0x275c('0x10')]){if(_0x5b4f9e[_0x275c('0x10')][_0x275c('0x11')]===0x1f4){logger['error'](_0x275c('0xb'),_0x9565a2,_0x5b4f9e[_0x275c('0x10')][_0x275c('0x12')]);return _0xb2a8e3(_0x5b4f9e[_0x275c('0x10')][_0x275c('0x12')]);}logger[_0x275c('0x10')]('VoiceMail,\x20%s,\x20%s',_0x9565a2,_0x5b4f9e[_0x275c('0x10')][_0x275c('0x12')]);return _0x56f552(_0x5b4f9e['error'][_0x275c('0x12')]);}else{logger['info'](_0x275c('0xb'),_0x9565a2,'request\x20sent');_0x56f552(_0x5b4f9e[_0x275c('0x13')][_0x275c('0x12')]);}})[_0x275c('0x14')](function(_0x189756){logger['error']('VoiceMail,\x20%s,\x20%s',_0x9565a2,_0x189756);_0xb2a8e3(_0x189756);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 73db990..f373a04 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 _0x580f=['./voiceMailMessage.controller','get','index','/:id','show','/:id/download','isAuthenticated','post','create','put','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x580f,0x91));var _0xf580=function(_0x335403,_0x380b36){_0x335403=_0x335403-0x0;var _0x367690=_0x580f[_0x335403];return _0x367690;};'use strict';var multer=require(_0xf580('0x0'));var util=require(_0xf580('0x1'));var path=require(_0xf580('0x2'));var timeout=require('connect-timeout');var express=require(_0xf580('0x3'));var router=express['Router']();var fs_extra=require(_0xf580('0x4'));var auth=require(_0xf580('0x5'));var interaction=require(_0xf580('0x6'));var config=require('../../config/environment');var controller=require(_0xf580('0x7'));router[_0xf580('0x8')]('/',auth['isAuthenticated'](),controller[_0xf580('0x9')]);router['get'](_0xf580('0xa'),auth['isAuthenticated'](),controller[_0xf580('0xb')]);router['get'](_0xf580('0xc'),auth[_0xf580('0xd')](),controller['download']);router[_0xf580('0xe')]('/',auth[_0xf580('0xd')](),controller[_0xf580('0xf')]);router[_0xf580('0x10')](_0xf580('0xa'),auth[_0xf580('0xd')](),controller['update']);router['delete'](_0xf580('0xa'),auth[_0xf580('0xd')](),controller[_0xf580('0x11')]);module[_0xf580('0x12')]=router; \ No newline at end of file +var _0x75ed=['show','post','create','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id'];(function(_0x30df5a,_0x4af839){var _0x28127c=function(_0x27d13a){while(--_0x27d13a){_0x30df5a['push'](_0x30df5a['shift']());}};_0x28127c(++_0x4af839);}(_0x75ed,0x176));var _0xd75e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x75ed[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xd75e('0x0'));var path=require('path');var timeout=require(_0xd75e('0x1'));var express=require(_0xd75e('0x2'));var router=express[_0xd75e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd75e('0x4'));var interaction=require(_0xd75e('0x5'));var config=require('../../config/environment');var controller=require(_0xd75e('0x6'));router[_0xd75e('0x7')]('/',auth[_0xd75e('0x8')](),controller['index']);router['get'](_0xd75e('0x9'),auth[_0xd75e('0x8')](),controller[_0xd75e('0xa')]);router['get']('/:id/download',auth[_0xd75e('0x8')](),controller['download']);router[_0xd75e('0xb')]('/',auth[_0xd75e('0x8')](),controller[_0xd75e('0xc')]);router['put'](_0xd75e('0x9'),auth[_0xd75e('0x8')](),controller[_0xd75e('0xd')]);router['delete']('/:id',auth[_0xd75e('0x8')](),controller[_0xd75e('0xe')]);module[_0xd75e('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f33ae3e..fef9a58 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 _0x0f1e=['VIRTUAL','getDataValue','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x310951,_0x4cacfd){var _0x407d6a=function(_0x1d3540){while(--_0x1d3540){_0x310951['push'](_0x310951['shift']());}};_0x407d6a(++_0x4cacfd);}(_0x0f1e,0x166));var _0xe0f1=function(_0x527221,_0x3ad559){_0x527221=_0x527221-0x0;var _0xdd8990=_0x0f1e[_0x527221];return _0xdd8990;};'use strict';var Sequelize=require(_0xe0f1('0x0'));module[_0xe0f1('0x1')]={'name':{'type':Sequelize[_0xe0f1('0x2')],'get':function(_0x385e12){return this[_0xe0f1('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xe0f1('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe0f1('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe0f1('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe0f1('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xe0f1('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe0f1('0x4')],'defaultValue':''},'stamp':{'type':_0xe0f1('0x6'),'defaultValue':Sequelize['literal'](_0xe0f1('0x7'))}}; \ No newline at end of file +var _0xbb1d=['sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xbb1d,0x156));var _0xdbb1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb1d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdbb1('0x0'));module[_0xdbb1('0x1')]={'name':{'type':Sequelize[_0xdbb1('0x2')],'get':function(_0x4202ee){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xdbb1('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xdbb1('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'stamp':{'type':_0xdbb1('0x6'),'defaultValue':Sequelize[_0xdbb1('0x7')](_0xdbb1('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5a193a6..2f9990c 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 _0x4c28=['eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','options','VoiceMailMessage','includeAll','findAll','rows','catch','show','params','keys','include','find','body','destroy','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send'];(function(_0x38b0c4,_0x1afc81){var _0x52c964=function(_0xc60bb9){while(--_0xc60bb9){_0x38b0c4['push'](_0x38b0c4['shift']());}};_0x52c964(++_0x1afc81);}(_0x4c28,0xf9));var _0x84c2=function(_0x214e18,_0x13189b){_0x214e18=_0x214e18-0x0;var _0x323044=_0x4c28[_0x214e18];return _0x323044;};'use strict';var emlformat=require(_0x84c2('0x0'));var rimraf=require(_0x84c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84c2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x84c2('0x3'));var Mustache=require('mustache');var util=require(_0x84c2('0x4'));var path=require('path');var sox=require(_0x84c2('0x5'));var csv=require(_0x84c2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84c2('0x7'));var _=require(_0x84c2('0x8'));var squel=require('squel');var crypto=require(_0x84c2('0x9'));var jsforce=require(_0x84c2('0xa'));var deskjs=require(_0x84c2('0xb'));var toCsv=require(_0x84c2('0x6'));var querystring=require(_0x84c2('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x84c2('0xd'));var qs=require(_0x84c2('0xe'));var as=require(_0x84c2('0xf'));var hardwareService=require(_0x84c2('0x10'));var logger=require(_0x84c2('0x11'))(_0x84c2('0x12'));var utils=require('../../config/utils');var config=require(_0x84c2('0x13'));var licenseUtil=require(_0x84c2('0x14'));var db=require(_0x84c2('0x15'))['db'];function respondWithStatusCode(_0x2064af,_0x48d4e9){_0x48d4e9=_0x48d4e9||0xcc;return function(_0x16e821){if(_0x16e821){return _0x2064af[_0x84c2('0x16')](_0x48d4e9);}return _0x2064af['status'](_0x48d4e9)[_0x84c2('0x17')]();};}function respondWithResult(_0x26bcb0,_0x4e7545){_0x4e7545=_0x4e7545||0xc8;return function(_0x2b1eec){if(_0x2b1eec){return _0x26bcb0[_0x84c2('0x18')](_0x4e7545)[_0x84c2('0x19')](_0x2b1eec);}};}function respondWithFilteredResult(_0x255a21,_0x53176e){return function(_0x21fdc5){if(_0x21fdc5){var _0xb2c05e=typeof _0x53176e[_0x84c2('0x1a')]===_0x84c2('0x1b')&&typeof _0x53176e[_0x84c2('0x1c')]===_0x84c2('0x1b');var _0x1cc596=_0x21fdc5[_0x84c2('0x1d')];var _0x42f8e3=_0xb2c05e?0x0:_0x53176e['offset'];var _0x437df0=_0xb2c05e?_0x21fdc5[_0x84c2('0x1d')]:_0x53176e[_0x84c2('0x1a')]+_0x53176e[_0x84c2('0x1c')];var _0x5809c3;if(_0x437df0>=_0x1cc596){_0x437df0=_0x1cc596;_0x5809c3=0xc8;}else{_0x5809c3=0xce;}_0x255a21['status'](_0x5809c3);return _0x255a21[_0x84c2('0x1e')](_0x84c2('0x1f'),_0x42f8e3+'-'+_0x437df0+'/'+_0x1cc596)[_0x84c2('0x19')](_0x21fdc5);}return null;};}function patchUpdates(_0x1f0c2d){return function(_0x5184f3){try{jsonpatch[_0x84c2('0x20')](_0x5184f3,_0x1f0c2d,!![]);}catch(_0x326c1a){return BPromise[_0x84c2('0x21')](_0x326c1a);}return _0x5184f3['save']();};}function saveUpdates(_0x420264,_0x4734e9){return function(_0x1fb176){if(_0x1fb176){return _0x1fb176[_0x84c2('0x22')](_0x420264)['then'](function(_0xd80896){return _0xd80896;});}return null;};}function removeEntity(_0x477bbd,_0x79cd6f){return function(_0x5c39df){if(_0x5c39df){return _0x5c39df['destroy']()[_0x84c2('0x23')](function(){_0x477bbd['status'](0xcc)[_0x84c2('0x17')]();});}};}function handleEntityNotFound(_0x1134c3,_0x1a2dfd){return function(_0x26b55c){if(!_0x26b55c){_0x1134c3[_0x84c2('0x16')](0x194);}return _0x26b55c;};}function handleError(_0x12457a,_0x5f4fa6){_0x5f4fa6=_0x5f4fa6||0x1f4;return function(_0x3a193){logger[_0x84c2('0x24')](_0x3a193[_0x84c2('0x25')]);if(_0x3a193[_0x84c2('0x26')]){delete _0x3a193[_0x84c2('0x26')];}_0x12457a[_0x84c2('0x18')](_0x5f4fa6)['send'](_0x3a193);};}exports[_0x84c2('0x27')]=function(_0x43504b,_0x2c8ecd){var _0x149fc2={},_0x130bd6={},_0x1ba2b0={'count':0x0,'rows':[]};var _0x1dcc1d=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x264c93){return{'name':_0x264c93[_0x84c2('0x28')],'type':_0x264c93['type'][_0x84c2('0x29')]};});_0x130bd6[_0x84c2('0x2a')]=_[_0x84c2('0x2b')](_['map'](_0x1dcc1d,'name'),[_0x84c2('0x26')]);_0x130bd6[_0x84c2('0x2c')]=_['keys'](_0x43504b[_0x84c2('0x2c')]);_0x130bd6[_0x84c2('0x2d')]=_[_0x84c2('0x2e')](_0x130bd6[_0x84c2('0x2a')],_0x130bd6[_0x84c2('0x2c')]);_0x149fc2[_0x84c2('0x2f')]=_['intersection'](_0x130bd6[_0x84c2('0x2a')],qs['fields'](_0x43504b[_0x84c2('0x2c')][_0x84c2('0x30')]));_0x149fc2[_0x84c2('0x2f')]=_0x149fc2['attributes'][_0x84c2('0x31')]?_0x149fc2[_0x84c2('0x2f')]:_0x130bd6[_0x84c2('0x2a')];if(!_0x43504b['query'][_0x84c2('0x32')](_0x84c2('0x33'))){_0x149fc2[_0x84c2('0x1c')]=qs['limit'](_0x43504b[_0x84c2('0x2c')][_0x84c2('0x1c')]);_0x149fc2[_0x84c2('0x1a')]=qs[_0x84c2('0x1a')](_0x43504b[_0x84c2('0x2c')][_0x84c2('0x1a')]);}_0x149fc2[_0x84c2('0x34')]=qs[_0x84c2('0x35')](_0x43504b[_0x84c2('0x2c')][_0x84c2('0x35')]);_0x149fc2['where']=qs['filters'](_[_0x84c2('0x36')](_0x43504b[_0x84c2('0x2c')],_0x130bd6[_0x84c2('0x2d')]),_0x1dcc1d);if(_0x43504b[_0x84c2('0x2c')][_0x84c2('0x37')]){_0x149fc2[_0x84c2('0x38')]=_['merge'](_0x149fc2['where'],{'$or':_[_0x84c2('0x39')](_0x1dcc1d,function(_0x76aa11){if(_0x76aa11['type']!=='VIRTUAL'){var _0x54eb40={};_0x54eb40[_0x76aa11[_0x84c2('0x26')]]={'$like':'%'+_0x43504b[_0x84c2('0x2c')][_0x84c2('0x37')]+'%'};return _0x54eb40;}})});}_0x149fc2=_[_0x84c2('0x3a')]({},_0x149fc2,_0x43504b[_0x84c2('0x3b')]);var _0x139010={'where':_0x149fc2['where']};return db[_0x84c2('0x3c')]['count'](_0x139010)[_0x84c2('0x23')](function(_0x9639f8){_0x1ba2b0['count']=_0x9639f8;if(_0x43504b['query'][_0x84c2('0x3d')]){_0x149fc2['include']=[{'all':!![]}];}return db[_0x84c2('0x3c')][_0x84c2('0x3e')](_0x149fc2);})[_0x84c2('0x23')](function(_0x29656c){_0x1ba2b0[_0x84c2('0x3f')]=_0x29656c;return _0x1ba2b0;})['then'](respondWithFilteredResult(_0x2c8ecd,_0x149fc2))[_0x84c2('0x40')](handleError(_0x2c8ecd,null));};exports[_0x84c2('0x41')]=function(_0x1d2eb3,_0x167b2b){var _0x5ec0c3={'raw':!![],'where':{'id':_0x1d2eb3[_0x84c2('0x42')]['id']}},_0x592071={};_0x592071[_0x84c2('0x2a')]=_[_0x84c2('0x43')](db[_0x84c2('0x3c')]['rawAttributes']);_0x592071['query']=_[_0x84c2('0x43')](_0x1d2eb3[_0x84c2('0x2c')]);_0x592071['filters']=_[_0x84c2('0x2e')](_0x592071[_0x84c2('0x2a')],_0x592071[_0x84c2('0x2c')]);_0x5ec0c3[_0x84c2('0x2f')]=_[_0x84c2('0x2e')](_0x592071['model'],qs[_0x84c2('0x30')](_0x1d2eb3[_0x84c2('0x2c')][_0x84c2('0x30')]));_0x5ec0c3[_0x84c2('0x2f')]=_0x5ec0c3[_0x84c2('0x2f')][_0x84c2('0x31')]?_0x5ec0c3[_0x84c2('0x2f')]:_0x592071[_0x84c2('0x2a')];if(_0x1d2eb3['query'][_0x84c2('0x3d')]){_0x5ec0c3[_0x84c2('0x44')]=[{'all':!![]}];}_0x5ec0c3=_[_0x84c2('0x3a')]({},_0x5ec0c3,_0x1d2eb3['options']);return db[_0x84c2('0x3c')][_0x84c2('0x45')](_0x5ec0c3)[_0x84c2('0x23')](handleEntityNotFound(_0x167b2b,null))[_0x84c2('0x23')](respondWithResult(_0x167b2b,null))[_0x84c2('0x40')](handleError(_0x167b2b,null));};exports['create']=function(_0x2ae72d,_0x4b1834){return db[_0x84c2('0x3c')]['create'](_0x2ae72d[_0x84c2('0x46')],{})[_0x84c2('0x23')](respondWithResult(_0x4b1834,0xc9))['catch'](handleError(_0x4b1834,null));};exports[_0x84c2('0x22')]=function(_0x470b7d,_0x37892e){if(_0x470b7d[_0x84c2('0x46')]['id']){delete _0x470b7d['body']['id'];}return db[_0x84c2('0x3c')][_0x84c2('0x45')]({'where':{'id':_0x470b7d[_0x84c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x37892e,null))['then'](saveUpdates(_0x470b7d[_0x84c2('0x46')],null))[_0x84c2('0x23')](respondWithResult(_0x37892e,null))[_0x84c2('0x40')](handleError(_0x37892e,null));};exports[_0x84c2('0x47')]=function(_0x49901c,_0x77270f){return db[_0x84c2('0x3c')]['find']({'where':{'id':_0x49901c[_0x84c2('0x42')]['id']}})[_0x84c2('0x23')](handleEntityNotFound(_0x77270f,null))[_0x84c2('0x23')](removeEntity(_0x77270f,null))[_0x84c2('0x40')](handleError(_0x77270f,null));};exports[_0x84c2('0x48')]=function(_0x44136c,_0x2704f8,_0x49f8a7){return db['VoiceMailMessage'][_0x84c2('0x45')]({'where':{'id':_0x44136c[_0x84c2('0x42')]['id']},'attributes':['id',_0x84c2('0x49'),_0x84c2('0x4a')]})[_0x84c2('0x23')](handleEntityNotFound(_0x2704f8,null))[_0x84c2('0x23')](function(_0x4c878a){if(_0x4c878a){if(!_0x4c878a['recording']){throw new db[(_0x84c2('0x4b'))][(_0x84c2('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x5297ef={'Content-Type':_0x84c2('0x4d'),'Content-Disposition':_0x84c2('0x4e')};if(_0x4c878a[_0x84c2('0x4a')]){_0x5297ef[_0x84c2('0x4f')]=_0x84c2('0x50')+_0x4c878a[_0x84c2('0x4a')]+_0x84c2('0x51');}_0x2704f8['set'](_0x5297ef);return _0x2704f8[_0x84c2('0x52')](new Buffer(_0x4c878a[_0x84c2('0x49')]));}})[_0x84c2('0x40')](handleError(_0x2704f8,null));}; \ No newline at end of file +var _0x4a8d=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VoiceMailMessage','includeAll','include','rows','catch','find','create','body','params','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5923bd,_0x5b7a57){var _0x38aa20=function(_0x202a3d){while(--_0x202a3d){_0x5923bd['push'](_0x5923bd['shift']());}};_0x38aa20(++_0x5b7a57);}(_0x4a8d,0x9c));var _0xd4a8=function(_0x3a0deb,_0x2f868d){_0x3a0deb=_0x3a0deb-0x0;var _0xd1f46a=_0x4a8d[_0x3a0deb];return _0xd1f46a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd4a8('0x0'));var rp=require(_0xd4a8('0x1'));var moment=require(_0xd4a8('0x2'));var BPromise=require(_0xd4a8('0x3'));var Mustache=require(_0xd4a8('0x4'));var util=require(_0xd4a8('0x5'));var path=require(_0xd4a8('0x6'));var sox=require(_0xd4a8('0x7'));var csv=require(_0xd4a8('0x8'));var ejs=require(_0xd4a8('0x9'));var fs=require('fs');var fs_extra=require(_0xd4a8('0xa'));var _=require('lodash');var squel=require(_0xd4a8('0xb'));var crypto=require(_0xd4a8('0xc'));var jsforce=require(_0xd4a8('0xd'));var deskjs=require(_0xd4a8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd4a8('0xf'));var Papa=require(_0xd4a8('0x10'));var Redis=require(_0xd4a8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd4a8('0x12'));var hardwareService=require(_0xd4a8('0x13'));var logger=require(_0xd4a8('0x14'))(_0xd4a8('0x15'));var utils=require(_0xd4a8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18d0f1,_0xecc59a){_0xecc59a=_0xecc59a||0xcc;return function(_0x5e0ef3){if(_0x5e0ef3){return _0x18d0f1[_0xd4a8('0x17')](_0xecc59a);}return _0x18d0f1[_0xd4a8('0x18')](_0xecc59a)['end']();};}function respondWithResult(_0x159fb3,_0x312f1a){_0x312f1a=_0x312f1a||0xc8;return function(_0x140571){if(_0x140571){return _0x159fb3[_0xd4a8('0x18')](_0x312f1a)[_0xd4a8('0x19')](_0x140571);}};}function respondWithFilteredResult(_0x3c6af5,_0x1afe57){return function(_0xa33291){if(_0xa33291){var _0x3606f7=typeof _0x1afe57[_0xd4a8('0x1a')]==='undefined'&&typeof _0x1afe57[_0xd4a8('0x1b')]===_0xd4a8('0x1c');var _0x544967=_0xa33291[_0xd4a8('0x1d')];var _0xb9edba=_0x3606f7?0x0:_0x1afe57[_0xd4a8('0x1a')];var _0x4cd9b4=_0x3606f7?_0xa33291[_0xd4a8('0x1d')]:_0x1afe57['offset']+_0x1afe57['limit'];var _0x41d01b;if(_0x4cd9b4>=_0x544967){_0x4cd9b4=_0x544967;_0x41d01b=0xc8;}else{_0x41d01b=0xce;}_0x3c6af5[_0xd4a8('0x18')](_0x41d01b);return _0x3c6af5[_0xd4a8('0x1e')](_0xd4a8('0x1f'),_0xb9edba+'-'+_0x4cd9b4+'/'+_0x544967)[_0xd4a8('0x19')](_0xa33291);}return null;};}function patchUpdates(_0x1bc8be){return function(_0x4db09b){try{jsonpatch[_0xd4a8('0x20')](_0x4db09b,_0x1bc8be,!![]);}catch(_0x3b82da){return BPromise[_0xd4a8('0x21')](_0x3b82da);}return _0x4db09b['save']();};}function saveUpdates(_0x18f5bd,_0xd98fa){return function(_0x2e894c){if(_0x2e894c){return _0x2e894c[_0xd4a8('0x22')](_0x18f5bd)['then'](function(_0x4b6c33){return _0x4b6c33;});}return null;};}function removeEntity(_0x2de7e4,_0x395fc2){return function(_0x338965){if(_0x338965){return _0x338965['destroy']()[_0xd4a8('0x23')](function(){_0x2de7e4[_0xd4a8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d2fb,_0x3ac85c){return function(_0x386523){if(!_0x386523){_0x26d2fb[_0xd4a8('0x17')](0x194);}return _0x386523;};}function handleError(_0xb68d1b,_0x9e65d5){_0x9e65d5=_0x9e65d5||0x1f4;return function(_0x4abcd3){logger[_0xd4a8('0x24')](_0x4abcd3[_0xd4a8('0x25')]);if(_0x4abcd3[_0xd4a8('0x26')]){delete _0x4abcd3[_0xd4a8('0x26')];}_0xb68d1b[_0xd4a8('0x18')](_0x9e65d5)[_0xd4a8('0x27')](_0x4abcd3);};}exports[_0xd4a8('0x28')]=function(_0x1fc7a3,_0x314b6e){var _0x261acc={},_0x4153ce={},_0x3b1918={'count':0x0,'rows':[]};var _0x2561d9=_['map'](db['VoiceMailMessage'][_0xd4a8('0x29')],function(_0x37eac8){return{'name':_0x37eac8[_0xd4a8('0x2a')],'type':_0x37eac8[_0xd4a8('0x2b')]['key']};});_0x4153ce[_0xd4a8('0x2c')]=_['differenceBy'](_[_0xd4a8('0x2d')](_0x2561d9,_0xd4a8('0x26')),[_0xd4a8('0x26')]);_0x4153ce[_0xd4a8('0x2e')]=_[_0xd4a8('0x2f')](_0x1fc7a3[_0xd4a8('0x2e')]);_0x4153ce[_0xd4a8('0x30')]=_[_0xd4a8('0x31')](_0x4153ce[_0xd4a8('0x2c')],_0x4153ce['query']);_0x261acc[_0xd4a8('0x32')]=_['intersection'](_0x4153ce['model'],qs['fields'](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x33')]));_0x261acc[_0xd4a8('0x32')]=_0x261acc[_0xd4a8('0x32')][_0xd4a8('0x34')]?_0x261acc[_0xd4a8('0x32')]:_0x4153ce[_0xd4a8('0x2c')];if(!_0x1fc7a3[_0xd4a8('0x2e')]['hasOwnProperty'](_0xd4a8('0x35'))){_0x261acc[_0xd4a8('0x1b')]=qs[_0xd4a8('0x1b')](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x1b')]);_0x261acc[_0xd4a8('0x1a')]=qs[_0xd4a8('0x1a')](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x1a')]);}_0x261acc[_0xd4a8('0x36')]=qs[_0xd4a8('0x37')](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x37')]);_0x261acc[_0xd4a8('0x38')]=qs[_0xd4a8('0x30')](_[_0xd4a8('0x39')](_0x1fc7a3[_0xd4a8('0x2e')],_0x4153ce[_0xd4a8('0x30')]),_0x2561d9);if(_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x3a')]){_0x261acc[_0xd4a8('0x38')]=_[_0xd4a8('0x3b')](_0x261acc['where'],{'$or':_['map'](_0x2561d9,function(_0x37d637){if(_0x37d637['type']!=='VIRTUAL'){var _0x17986b={};_0x17986b[_0x37d637['name']]={'$like':'%'+_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x3a')]+'%'};return _0x17986b;}})});}_0x261acc=_['merge']({},_0x261acc,_0x1fc7a3[_0xd4a8('0x3c')]);var _0x3fef52={'where':_0x261acc[_0xd4a8('0x38')]};return db[_0xd4a8('0x3d')][_0xd4a8('0x1d')](_0x3fef52)['then'](function(_0x35c794){_0x3b1918['count']=_0x35c794;if(_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x3e')]){_0x261acc[_0xd4a8('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x261acc);})[_0xd4a8('0x23')](function(_0x38855c){_0x3b1918[_0xd4a8('0x40')]=_0x38855c;return _0x3b1918;})[_0xd4a8('0x23')](respondWithFilteredResult(_0x314b6e,_0x261acc))[_0xd4a8('0x41')](handleError(_0x314b6e,null));};exports['show']=function(_0x3ee637,_0x11a0c3){var _0x46b6e2={'raw':!![],'where':{'id':_0x3ee637['params']['id']}},_0x4a7d43={};_0x4a7d43[_0xd4a8('0x2c')]=_[_0xd4a8('0x2f')](db[_0xd4a8('0x3d')][_0xd4a8('0x29')]);_0x4a7d43['query']=_[_0xd4a8('0x2f')](_0x3ee637['query']);_0x4a7d43[_0xd4a8('0x30')]=_[_0xd4a8('0x31')](_0x4a7d43[_0xd4a8('0x2c')],_0x4a7d43[_0xd4a8('0x2e')]);_0x46b6e2['attributes']=_[_0xd4a8('0x31')](_0x4a7d43['model'],qs[_0xd4a8('0x33')](_0x3ee637[_0xd4a8('0x2e')]['fields']));_0x46b6e2[_0xd4a8('0x32')]=_0x46b6e2[_0xd4a8('0x32')][_0xd4a8('0x34')]?_0x46b6e2[_0xd4a8('0x32')]:_0x4a7d43['model'];if(_0x3ee637[_0xd4a8('0x2e')]['includeAll']){_0x46b6e2[_0xd4a8('0x3f')]=[{'all':!![]}];}_0x46b6e2=_['merge']({},_0x46b6e2,_0x3ee637[_0xd4a8('0x3c')]);return db[_0xd4a8('0x3d')][_0xd4a8('0x42')](_0x46b6e2)['then'](handleEntityNotFound(_0x11a0c3,null))[_0xd4a8('0x23')](respondWithResult(_0x11a0c3,null))[_0xd4a8('0x41')](handleError(_0x11a0c3,null));};exports['create']=function(_0x2bf78e,_0x3be91d){return db[_0xd4a8('0x3d')][_0xd4a8('0x43')](_0x2bf78e['body'],{})[_0xd4a8('0x23')](respondWithResult(_0x3be91d,0xc9))['catch'](handleError(_0x3be91d,null));};exports[_0xd4a8('0x22')]=function(_0x545d43,_0x246b48){if(_0x545d43['body']['id']){delete _0x545d43[_0xd4a8('0x44')]['id'];}return db['VoiceMailMessage'][_0xd4a8('0x42')]({'where':{'id':_0x545d43[_0xd4a8('0x45')]['id']}})[_0xd4a8('0x23')](handleEntityNotFound(_0x246b48,null))[_0xd4a8('0x23')](saveUpdates(_0x545d43['body'],null))[_0xd4a8('0x23')](respondWithResult(_0x246b48,null))['catch'](handleError(_0x246b48,null));};exports['destroy']=function(_0x188d68,_0x5fdfb8){return db[_0xd4a8('0x3d')]['find']({'where':{'id':_0x188d68[_0xd4a8('0x45')]['id']}})[_0xd4a8('0x23')](handleEntityNotFound(_0x5fdfb8,null))['then'](removeEntity(_0x5fdfb8,null))[_0xd4a8('0x41')](handleError(_0x5fdfb8,null));};exports[_0xd4a8('0x46')]=function(_0x3cc94c,_0x3234b3,_0x5877b6){return db[_0xd4a8('0x3d')]['find']({'where':{'id':_0x3cc94c[_0xd4a8('0x45')]['id']},'attributes':['id','recording',_0xd4a8('0x47')]})[_0xd4a8('0x23')](handleEntityNotFound(_0x3234b3,null))[_0xd4a8('0x23')](function(_0x4013d0){if(_0x4013d0){if(!_0x4013d0[_0xd4a8('0x48')]){throw new db[(_0xd4a8('0x49'))][(_0xd4a8('0x4a'))](_0xd4a8('0x4b'));}var _0x34a8f4={'Content-Type':_0xd4a8('0x4c'),'Content-Disposition':_0xd4a8('0x4d')};if(_0x4013d0['msg_id']){_0x34a8f4[_0xd4a8('0x4e')]=_0xd4a8('0x4f')+_0x4013d0['msg_id']+_0xd4a8('0x50');}_0x3234b3[_0xd4a8('0x1e')](_0x34a8f4);return _0x3234b3[_0xd4a8('0x27')](new Buffer(_0x4013d0[_0xd4a8('0x48')]));}})[_0xd4a8('0x41')](handleError(_0x3234b3,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c4d0540..559da48 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 _0x33ca=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','api','moment','request-promise'];(function(_0x49684e,_0x9a24fb){var _0x54062f=function(_0x4e410a){while(--_0x4e410a){_0x49684e['push'](_0x49684e['shift']());}};_0x54062f(++_0x9a24fb);}(_0x33ca,0xf9));var _0xa33c=function(_0x5264fd,_0x1cfed9){_0x5264fd=_0x5264fd-0x0;var _0x1f97c1=_0x33ca[_0x5264fd];return _0x1f97c1;};'use strict';var _=require(_0xa33c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa33c('0x1'));var moment=require(_0xa33c('0x2'));var BPromise=require('bluebird');var rp=require(_0xa33c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa33c('0x4'));var config=require(_0xa33c('0x5'));var attributes=require(_0xa33c('0x6'));module['exports']=function(_0x2c9afa,_0x12ad2b){return _0x2c9afa[_0xa33c('0x7')](_0xa33c('0x8'),attributes,{'tableName':_0xa33c('0x9'),'paranoid':![],'indexes':[{'name':_0xa33c('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xe270=['api','moment','bluebird','path','define','VoiceMailMessage','dir'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe270,0x165));var _0x0e27=function(_0x3d3e41,_0x225a72){_0x3d3e41=_0x3d3e41-0x0;var _0x1ad548=_0xe270[_0x3d3e41];return _0x1ad548;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0e27('0x0'));var moment=require(_0x0e27('0x1'));var BPromise=require(_0x0e27('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e27('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x572375,_0x1423bb){return _0x572375[_0x0e27('0x4')](_0x0e27('0x5'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0e27('0x6'),'fields':[_0x0e27('0x6')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 5c58463..19ce9f2 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 _0x7688=['code','VoiceMailMessage,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7688,0x1d2));var _0x8768=function(_0x182c72,_0x42c471){_0x182c72=_0x182c72-0x0;var _0x17e0d0=_0x7688[_0x182c72];return _0x17e0d0;};'use strict';var _=require('lodash');var util=require(_0x8768('0x0'));var moment=require(_0x8768('0x1'));var BPromise=require(_0x8768('0x2'));var rs=require(_0x8768('0x3'));var fs=require('fs');var Redis=require(_0x8768('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8768('0x5'));var logger=require(_0x8768('0x6'))(_0x8768('0x7'));var config=require(_0x8768('0x8'));var jayson=require(_0x8768('0x9'));var client=jayson[_0x8768('0xa')][_0x8768('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27cdc7,_0x51cbd3,_0x131ca1){return new BPromise(function(_0x181e5e,_0x2804fc){return client['request'](_0x27cdc7,_0x131ca1)[_0x8768('0xc')](function(_0x5dc48f){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x51cbd3,_0x8768('0xd'));logger[_0x8768('0xe')](_0x8768('0xf'),_0x51cbd3,_0x8768('0xd'),JSON[_0x8768('0x10')](_0x5dc48f));if(_0x5dc48f[_0x8768('0x11')]){if(_0x5dc48f[_0x8768('0x11')][_0x8768('0x12')]===0x1f4){logger['error'](_0x8768('0x13'),_0x51cbd3,_0x5dc48f['error'][_0x8768('0x14')]);return _0x2804fc(_0x5dc48f[_0x8768('0x11')][_0x8768('0x14')]);}logger[_0x8768('0x11')](_0x8768('0x13'),_0x51cbd3,_0x5dc48f[_0x8768('0x11')]['message']);return _0x181e5e(_0x5dc48f[_0x8768('0x11')][_0x8768('0x14')]);}else{logger['info'](_0x8768('0x13'),_0x51cbd3,'request\x20sent');_0x181e5e(_0x5dc48f[_0x8768('0x15')][_0x8768('0x14')]);}})['catch'](function(_0x11abb1){logger[_0x8768('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x51cbd3,_0x11abb1);_0x2804fc(_0x11abb1);});});} \ No newline at end of file +var _0x5bfe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMailMessage,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5bfe,0x72));var _0xe5bf=function(_0x28f2b9,_0x8a242b){_0x28f2b9=_0x28f2b9-0x0;var _0x3f7323=_0x5bfe[_0x28f2b9];return _0x3f7323;};'use strict';var _=require(_0xe5bf('0x0'));var util=require(_0xe5bf('0x1'));var moment=require(_0xe5bf('0x2'));var BPromise=require(_0xe5bf('0x3'));var rs=require(_0xe5bf('0x4'));var fs=require('fs');var Redis=require(_0xe5bf('0x5'));var db=require(_0xe5bf('0x6'))['db'];var utils=require(_0xe5bf('0x7'));var logger=require(_0xe5bf('0x8'))(_0xe5bf('0x9'));var config=require(_0xe5bf('0xa'));var jayson=require(_0xe5bf('0xb'));var client=jayson[_0xe5bf('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7d91,_0x29e018,_0x37e933){return new BPromise(function(_0x36e633,_0x441e53){return client[_0xe5bf('0xd')](_0x2f7d91,_0x37e933)[_0xe5bf('0xe')](function(_0xecef37){logger[_0xe5bf('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x29e018,_0xe5bf('0x10'));logger[_0xe5bf('0x11')](_0xe5bf('0x12'),_0x29e018,_0xe5bf('0x10'),JSON[_0xe5bf('0x13')](_0xecef37));if(_0xecef37[_0xe5bf('0x14')]){if(_0xecef37[_0xe5bf('0x14')]['code']===0x1f4){logger[_0xe5bf('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x29e018,_0xecef37['error'][_0xe5bf('0x15')]);return _0x441e53(_0xecef37['error'][_0xe5bf('0x15')]);}logger['error'](_0xe5bf('0x16'),_0x29e018,_0xecef37[_0xe5bf('0x14')][_0xe5bf('0x15')]);return _0x36e633(_0xecef37['error'][_0xe5bf('0x15')]);}else{logger[_0xe5bf('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x29e018,_0xe5bf('0x10'));_0x36e633(_0xecef37[_0xe5bf('0x17')][_0xe5bf('0x15')]);}})['catch'](function(_0xea7745){logger[_0xe5bf('0x14')](_0xe5bf('0x16'),_0x29e018,_0xea7745);_0x441e53(_0xea7745);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d682ab3..510c7cc 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 _0x6539=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x2feee6,_0x4402fe){var _0x5f0ffc=function(_0x3d394e){while(--_0x3d394e){_0x2feee6['push'](_0x2feee6['shift']());}};_0x5f0ffc(++_0x4402fe);}(_0x6539,0x19d));var _0x9653=function(_0xaae38d,_0x210317){_0xaae38d=_0xaae38d-0x0;var _0x308892=_0x6539[_0xaae38d];return _0x308892;};'use strict';var multer=require(_0x9653('0x0'));var util=require(_0x9653('0x1'));var path=require(_0x9653('0x2'));var timeout=require(_0x9653('0x3'));var express=require(_0x9653('0x4'));var router=express[_0x9653('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9653('0x6'));var config=require(_0x9653('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x9653('0x8')]('/',auth[_0x9653('0x9')](),controller[_0x9653('0xa')]);router[_0x9653('0x8')](_0x9653('0xb'),auth[_0x9653('0x9')](),controller[_0x9653('0xc')]);router['get'](_0x9653('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x9653('0xe')]('/',auth[_0x9653('0x9')](),controller[_0x9653('0xf')]);router[_0x9653('0xe')]('/:id/sounds',auth[_0x9653('0x9')](),controller[_0x9653('0x10')]);router[_0x9653('0x11')](_0x9653('0xb'),auth[_0x9653('0x9')](),controller['update']);router['delete'](_0x9653('0xb'),auth[_0x9653('0x9')](),controller[_0x9653('0x12')]);router[_0x9653('0x13')](_0x9653('0x14'),auth[_0x9653('0x9')](),controller[_0x9653('0x15')]);module[_0x9653('0x16')]=router; \ No newline at end of file +var _0x012f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','put','update','destroy','delete','/:id/sounds/:id2','exports','multer','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x012f,0x17d));var _0xf012=function(_0x1f800f,_0x359dd7){_0x1f800f=_0x1f800f-0x0;var _0x28e9cc=_0x012f[_0x1f800f];return _0x28e9cc;};'use strict';var multer=require(_0xf012('0x0'));var util=require('util');var path=require(_0xf012('0x1'));var timeout=require(_0xf012('0x2'));var express=require(_0xf012('0x3'));var router=express[_0xf012('0x4')]();var fs_extra=require(_0xf012('0x5'));var auth=require(_0xf012('0x6'));var interaction=require(_0xf012('0x7'));var config=require(_0xf012('0x8'));var controller=require(_0xf012('0x9'));router[_0xf012('0xa')]('/',auth[_0xf012('0xb')](),controller[_0xf012('0xc')]);router[_0xf012('0xa')](_0xf012('0xd'),auth[_0xf012('0xb')](),controller['show']);router[_0xf012('0xa')](_0xf012('0xe'),auth[_0xf012('0xb')](),controller[_0xf012('0xf')]);router[_0xf012('0x10')]('/',auth['isAuthenticated'](),controller[_0xf012('0x11')]);router['post'](_0xf012('0xe'),auth[_0xf012('0xb')](),controller['addSound']);router[_0xf012('0x12')](_0xf012('0xd'),auth['isAuthenticated'](),controller[_0xf012('0x13')]);router['delete'](_0xf012('0xd'),auth[_0xf012('0xb')](),controller[_0xf012('0x14')]);router[_0xf012('0x15')](_0xf012('0x16'),auth[_0xf012('0xb')](),controller['removeSound']);module[_0xf012('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 8115fa5..56ec34d 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 _0x5aed=['ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','exports','STRING'];(function(_0xbf3f20,_0x5bf459){var _0x4b8870=function(_0x59962d){while(--_0x59962d){_0xbf3f20['push'](_0xbf3f20['shift']());}};_0x4b8870(++_0x5bf459);}(_0x5aed,0xfb));var _0xd5ae=function(_0x2acd39,_0x33402c){_0x2acd39=_0x2acd39-0x0;var _0x50ba00=_0x5aed[_0x2acd39];return _0x50ba00;};'use strict';var Sequelize=require('sequelize');module[_0xd5ae('0x0')]={'name':{'type':Sequelize[_0xd5ae('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xd5ae('0x2')](_0xd5ae('0x3'),_0xd5ae('0x4'),_0xd5ae('0x5'),_0xd5ae('0x6'),_0xd5ae('0x7'),_0xd5ae('0x8')),'allowNull':!![],'defaultValue':_0xd5ae('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd5ae('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd5ae('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd5ae('0x1')],'allowNull':!![],'defaultValue':_0xd5ae('0x9')},'format':{'type':Sequelize[_0xd5ae('0x1')],'allowNull':!![]},'stamp':{'type':_0xd5ae('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7096=['BOOLEAN','sequelize','STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP'];(function(_0x21d6b4,_0x38eb36){var _0x1a1496=function(_0x2b14cf){while(--_0x2b14cf){_0x21d6b4['push'](_0x21d6b4['shift']());}};_0x1a1496(++_0x38eb36);}(_0x7096,0x83));var _0x6709=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7096[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x6709('0x0'));module['exports']={'name':{'type':Sequelize[_0x6709('0x1')],'allowNull':![],'unique':_0x6709('0x2')},'mode':{'type':Sequelize['ENUM'](_0x6709('0x3'),_0x6709('0x4'),_0x6709('0x5'),_0x6709('0x6'),_0x6709('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x6709('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x6709('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6709('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x6709('0x1')],'allowNull':!![]},'stamp':{'type':_0x6709('0x8')},'defaultEntry':{'type':Sequelize[_0x6709('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 9c9d637..1a1fdd8 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 _0x5341=['pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','mode','join','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','extname','server/files/moh','ValidationError','message','removeSound','id2','getSounds','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5f2c5f,_0x76561d){var _0x44cd63=function(_0x197bb5){while(--_0x197bb5){_0x5f2c5f['push'](_0x5f2c5f['shift']());}};_0x44cd63(++_0x76561d);}(_0x5341,0x117));var _0x1534=function(_0x447767,_0x214ec8){_0x447767=_0x447767-0x0;var _0x51f137=_0x5341[_0x447767];return _0x51f137;};'use strict';var emlformat=require(_0x1534('0x0'));var rimraf=require(_0x1534('0x1'));var zipdir=require(_0x1534('0x2'));var jsonpatch=require(_0x1534('0x3'));var rp=require(_0x1534('0x4'));var moment=require(_0x1534('0x5'));var BPromise=require(_0x1534('0x6'));var Mustache=require(_0x1534('0x7'));var util=require(_0x1534('0x8'));var path=require(_0x1534('0x9'));var sox=require(_0x1534('0xa'));var csv=require(_0x1534('0xb'));var ejs=require(_0x1534('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1534('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1534('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1534('0xf'));var Papa=require(_0x1534('0x10'));var Redis=require(_0x1534('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1534('0x12'));var as=require(_0x1534('0x13'));var hardwareService=require(_0x1534('0x14'));var logger=require(_0x1534('0x15'))(_0x1534('0x16'));var utils=require(_0x1534('0x17'));var config=require(_0x1534('0x18'));var licenseUtil=require(_0x1534('0x19'));var db=require(_0x1534('0x1a'))['db'];function respondWithStatusCode(_0x11ca94,_0x58764a){_0x58764a=_0x58764a||0xcc;return function(_0x1e95fa){if(_0x1e95fa){return _0x11ca94['sendStatus'](_0x58764a);}return _0x11ca94[_0x1534('0x1b')](_0x58764a)[_0x1534('0x1c')]();};}function respondWithResult(_0x55c319,_0x431339){_0x431339=_0x431339||0xc8;return function(_0x3bc4f5){if(_0x3bc4f5){return _0x55c319[_0x1534('0x1b')](_0x431339)[_0x1534('0x1d')](_0x3bc4f5);}};}function respondWithFilteredResult(_0x169a9b,_0x26af82){return function(_0xa3aaaf){if(_0xa3aaaf){var _0x2196ac=typeof _0x26af82[_0x1534('0x1e')]==='undefined'&&typeof _0x26af82[_0x1534('0x1f')]===_0x1534('0x20');var _0x3aa922=_0xa3aaaf[_0x1534('0x21')];var _0x45656a=_0x2196ac?0x0:_0x26af82[_0x1534('0x1e')];var _0x36bbd2=_0x2196ac?_0xa3aaaf['count']:_0x26af82[_0x1534('0x1e')]+_0x26af82['limit'];var _0x228dd1;if(_0x36bbd2>=_0x3aa922){_0x36bbd2=_0x3aa922;_0x228dd1=0xc8;}else{_0x228dd1=0xce;}_0x169a9b[_0x1534('0x1b')](_0x228dd1);return _0x169a9b[_0x1534('0x22')](_0x1534('0x23'),_0x45656a+'-'+_0x36bbd2+'/'+_0x3aa922)[_0x1534('0x1d')](_0xa3aaaf);}return null;};}function patchUpdates(_0x29b78d){return function(_0x311c7d){try{jsonpatch[_0x1534('0x24')](_0x311c7d,_0x29b78d,!![]);}catch(_0x2cddaa){return BPromise['reject'](_0x2cddaa);}return _0x311c7d[_0x1534('0x25')]();};}function saveUpdates(_0x5b8313,_0x222438){return function(_0x1c4f5a){if(_0x1c4f5a){return _0x1c4f5a[_0x1534('0x26')](_0x5b8313)[_0x1534('0x27')](function(_0x35e905){return _0x35e905;});}return null;};}function removeEntity(_0x32b7cf,_0x10f901){return function(_0x16921e){if(_0x16921e){return _0x16921e[_0x1534('0x28')]()[_0x1534('0x27')](function(){var _0x93fbc2=_0x16921e[_0x1534('0x29')]({'plain':!![]});var _0x452824=_0x1534('0x2a');return db['UserProfileResource'][_0x1534('0x28')]({'where':{'type':_0x452824,'resourceId':_0x93fbc2['id']}})[_0x1534('0x27')](function(){return _0x16921e;});})[_0x1534('0x27')](function(){_0x32b7cf[_0x1534('0x1b')](0xcc)[_0x1534('0x1c')]();});}};}function handleEntityNotFound(_0x2f9795,_0x5a2401){return function(_0x391860){if(!_0x391860){_0x2f9795[_0x1534('0x2b')](0x194);}return _0x391860;};}function handleError(_0x4bc194,_0x44cf9c){_0x44cf9c=_0x44cf9c||0x1f4;return function(_0x5d31b9){logger[_0x1534('0x2c')](_0x5d31b9[_0x1534('0x2d')]);if(_0x5d31b9[_0x1534('0x2e')]){delete _0x5d31b9['name'];}_0x4bc194['status'](_0x44cf9c)[_0x1534('0x2f')](_0x5d31b9);};}exports[_0x1534('0x30')]=function(_0x425a01,_0x5d5ac2){var _0x203b60={},_0x196450={},_0x1aedf9={'count':0x0,'rows':[]};var _0x2fb3ac=_['map'](db[_0x1534('0x31')][_0x1534('0x32')],function(_0x117b57){return{'name':_0x117b57[_0x1534('0x33')],'type':_0x117b57['type']['key']};});_0x196450[_0x1534('0x34')]=_[_0x1534('0x35')](_0x2fb3ac,_0x1534('0x2e'));_0x196450['query']=_[_0x1534('0x36')](_0x425a01[_0x1534('0x37')]);_0x196450[_0x1534('0x38')]=_[_0x1534('0x39')](_0x196450[_0x1534('0x34')],_0x196450[_0x1534('0x37')]);_0x203b60['attributes']=_[_0x1534('0x39')](_0x196450[_0x1534('0x34')],qs[_0x1534('0x3a')](_0x425a01['query']['fields']));_0x203b60[_0x1534('0x3b')]=_0x203b60[_0x1534('0x3b')][_0x1534('0x3c')]?_0x203b60[_0x1534('0x3b')]:_0x196450[_0x1534('0x34')];if(!_0x425a01[_0x1534('0x37')][_0x1534('0x3d')](_0x1534('0x3e'))){_0x203b60[_0x1534('0x1f')]=qs[_0x1534('0x1f')](_0x425a01[_0x1534('0x37')]['limit']);_0x203b60['offset']=qs[_0x1534('0x1e')](_0x425a01[_0x1534('0x37')][_0x1534('0x1e')]);}_0x203b60[_0x1534('0x3f')]=qs[_0x1534('0x40')](_0x425a01['query'][_0x1534('0x40')]);delete _0x425a01[_0x1534('0x37')][_0x1534('0x40')];_0x203b60[_0x1534('0x41')]=qs[_0x1534('0x38')](_[_0x1534('0x42')](_0x425a01[_0x1534('0x37')],_0x196450['filters']),_0x2fb3ac);if(_0x425a01[_0x1534('0x37')][_0x1534('0x43')]){_0x203b60['where']=_[_0x1534('0x44')](_0x203b60['where'],{'$or':_[_0x1534('0x35')](_0x2fb3ac,function(_0x2ef7de){if(_0x2ef7de['type']!=='VIRTUAL'){var _0x3c6335={};_0x3c6335[_0x2ef7de[_0x1534('0x2e')]]={'$like':'%'+_0x425a01[_0x1534('0x37')][_0x1534('0x43')]+'%'};return _0x3c6335;}})});}_0x203b60=_[_0x1534('0x44')]({},_0x203b60,_0x425a01['options']);var _0x57eee2={'where':_0x203b60[_0x1534('0x41')]};return db[_0x1534('0x31')]['count'](_0x57eee2)[_0x1534('0x27')](function(_0x46d2b8){_0x1aedf9[_0x1534('0x21')]=_0x46d2b8;if(_0x425a01[_0x1534('0x37')][_0x1534('0x45')]){_0x203b60[_0x1534('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1534('0x47')](_0x203b60);})[_0x1534('0x27')](function(_0x438d47){_0x1aedf9[_0x1534('0x48')]=_0x438d47;return _0x1aedf9;})[_0x1534('0x27')](respondWithFilteredResult(_0x5d5ac2,_0x203b60))[_0x1534('0x49')](handleError(_0x5d5ac2,null));};exports[_0x1534('0x4a')]=function(_0x44535a,_0xdc3929){var _0x5eb60c={'raw':![],'where':{'id':_0x44535a[_0x1534('0x4b')]['id']}},_0x7cfb1={};_0x7cfb1[_0x1534('0x34')]=_['keys'](db[_0x1534('0x31')][_0x1534('0x32')]);_0x7cfb1['query']=_['keys'](_0x44535a['query']);_0x7cfb1[_0x1534('0x38')]=_[_0x1534('0x39')](_0x7cfb1[_0x1534('0x34')],_0x7cfb1[_0x1534('0x37')]);_0x5eb60c['attributes']=_[_0x1534('0x39')](_0x7cfb1[_0x1534('0x34')],qs[_0x1534('0x3a')](_0x44535a[_0x1534('0x37')]['fields']));_0x5eb60c['attributes']=_0x5eb60c[_0x1534('0x3b')][_0x1534('0x3c')]?_0x5eb60c[_0x1534('0x3b')]:_0x7cfb1['model'];if(_0x44535a[_0x1534('0x37')]['includeAll']){_0x5eb60c['include']=[{'all':!![]}];}_0x5eb60c=_[_0x1534('0x44')]({},_0x5eb60c,_0x44535a['options']);return db[_0x1534('0x31')][_0x1534('0x4c')](_0x5eb60c)[_0x1534('0x27')](handleEntityNotFound(_0xdc3929,null))[_0x1534('0x27')](respondWithResult(_0xdc3929,null))['catch'](handleError(_0xdc3929,null));};exports['update']=function(_0x4c166e,_0x261e5c){if(_0x4c166e[_0x1534('0x4d')]['id']){delete _0x4c166e[_0x1534('0x4d')]['id'];}return db[_0x1534('0x31')]['find']({'where':{'id':_0x4c166e[_0x1534('0x4b')]['id']}})[_0x1534('0x27')](handleEntityNotFound(_0x261e5c,null))['then'](saveUpdates(_0x4c166e['body'],null))[_0x1534('0x27')](respondWithResult(_0x261e5c,null))[_0x1534('0x49')](handleError(_0x261e5c,null));};exports[_0x1534('0x4e')]=function(_0x4d07ab,_0x529600,_0xb379a6){return db[_0x1534('0x4f')][_0x1534('0x50')](function(_0x5f5467){if(_0x4d07ab['body'][_0x1534('0x51')]==='files'){_0x4d07ab[_0x1534('0x4d')]['directory']=path[_0x1534('0x52')](config['root'],'server/files/moh',_0x4d07ab[_0x1534('0x4d')][_0x1534('0x2e')]);}return db['VoiceMusicOnHold'][_0x1534('0x4e')](_0x4d07ab[_0x1534('0x4d')],{'transaction':_0x5f5467})[_0x1534('0x27')](function(_0x540b19){if(_0x4d07ab[_0x1534('0x4d')]['mode']==='files'){fs[_0x1534('0x53')](_0x540b19[_0x1534('0x54')],parseInt(_0x1534('0x55'),0x8));}var _0x144bce=_0x4d07ab['user'][_0x1534('0x29')]({'plain':!![]});if(!_0x144bce)throw new Error(_0x1534('0x56'));if(_0x144bce[_0x1534('0x57')]==='user'){var _0x4fc7c0=_0x540b19[_0x1534('0x29')]({'plain':!![]});return db[_0x1534('0x58')][_0x1534('0x4c')]({'where':{'name':_0x1534('0x2a'),'userProfileId':_0x144bce[_0x1534('0x59')]},'raw':!![]})[_0x1534('0x27')](function(_0x4bf766){if(_0x4bf766&&_0x4bf766[_0x1534('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fc7c0[_0x1534('0x2e')],'resourceId':_0x4fc7c0['id'],'type':_0x4bf766['name'],'sectionId':_0x4bf766['id']},{})[_0x1534('0x27')](function(){return _0x540b19;});}else{return _0x540b19;}})['catch'](function(_0x364aea){logger[_0x1534('0x2c')](_0x1534('0x5b'),_0x364aea);});}return _0x540b19;});})[_0x1534('0x27')](respondWithResult(_0x529600,0xc9))[_0x1534('0x49')](handleError(_0x529600,null));};exports['destroy']=function(_0x1db096,_0x2d7730,_0x179ea2){var _0x269269;return db[_0x1534('0x31')][_0x1534('0x4c')]({'where':{'id':_0x1db096[_0x1534('0x4b')]['id']}})[_0x1534('0x27')](function(_0x46e8a6){if(_0x46e8a6){return db['sequelize'][_0x1534('0x50')](function(_0x38e59a){return _0x46e8a6[_0x1534('0x28')]({'transaction':_0x38e59a,'raw':!![]})['then'](function(_0x120267){if(_0x120267['directory']){fs[_0x1534('0x5c')](_0x120267[_0x1534('0x54')])[_0x1534('0x5d')](function(_0x13dd91){fs[_0x1534('0x5e')](path[_0x1534('0x52')](_0x120267[_0x1534('0x54')],_0x13dd91));});fs[_0x1534('0x5f')](_0x120267[_0x1534('0x54')]);}return _0x120267;});})[_0x1534('0x49')](function(_0x9f5533){throw new db[(_0x1534('0x60'))]['ValidationError'](_0x9f5533['message']);});}})['then'](handleEntityNotFound(_0x2d7730,null))[_0x1534('0x27')](removeEntity(_0x2d7730,null))['catch'](handleError(_0x2d7730,null));};exports['addSound']=function(_0x4a37d7,_0x595404,_0x471a8c){return db[_0x1534('0x4f')][_0x1534('0x50')](function(_0x5db7e5){var _0x4328ca;return db[_0x1534('0x31')]['find']({'where':{'id':_0x4a37d7[_0x1534('0x4b')]['id']}})[_0x1534('0x27')](function(_0x241e1e){if(_0x241e1e){_0x4328ca=_0x241e1e;return _0x241e1e[_0x1534('0x61')](_0x4a37d7[_0x1534('0x4d')]['id'],{'transaction':_0x5db7e5});}})[_0x1534('0x27')](function(_0x11b719){if(_0x11b719){return db[_0x1534('0x62')][_0x1534('0x63')]({'where':{'id':_0x4a37d7[_0x1534('0x4d')]['id']},'attributes':['id',_0x1534('0x2e'),_0x1534('0x64'),_0x1534('0x65'),_0x1534('0x66')],'raw':!![]});}})[_0x1534('0x27')](function(_0x3345f5){if(_0x3345f5){var _0x353aad=path[_0x1534('0x52')](config[_0x1534('0x67')],_0x1534('0x68'),util[_0x1534('0x69')](_0x1534('0x6a'),path['basename'](_0x3345f5[_0x1534('0x64')],path[_0x1534('0x6b')](_0x3345f5[_0x1534('0x64')])),_0x3345f5['converted_format']));var _0x57e83f=path[_0x1534('0x52')](config[_0x1534('0x67')],_0x1534('0x6c'),_0x4328ca[_0x1534('0x2e')],util[_0x1534('0x69')](_0x1534('0x6a'),_0x3345f5[_0x1534('0x2e')],_0x3345f5[_0x1534('0x65')]));fs['symlinkSync'](_0x353aad,_0x57e83f);return _0x3345f5;}})[_0x1534('0x49')](function(_0xc4dcb){throw new db['Sequelize'][(_0x1534('0x6d'))](_0xc4dcb[_0x1534('0x6e')]);});})[_0x1534('0x27')](handleEntityNotFound(_0x595404,null))[_0x1534('0x27')](respondWithResult(_0x595404,0xc9))[_0x1534('0x49')](handleError(_0x595404,null));};exports[_0x1534('0x6f')]=function(_0x53d504,_0x33d197,_0x4cac7b){return db['sequelize'][_0x1534('0x50')](function(_0x10e669){var _0x40754a;return db[_0x1534('0x31')]['findOne']({'where':{'id':_0x53d504[_0x1534('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33d197,null))[_0x1534('0x27')](function(_0x4909fd){if(_0x4909fd){_0x40754a=_0x4909fd;return _0x4909fd[_0x1534('0x6f')](_0x53d504[_0x1534('0x4b')][_0x1534('0x70')]);}})[_0x1534('0x27')](function(_0x3c3cc1){if(_0x3c3cc1){return db[_0x1534('0x62')][_0x1534('0x63')]({'where':{'id':_0x53d504[_0x1534('0x4b')][_0x1534('0x70')]},'attributes':['id',_0x1534('0x2e'),_0x1534('0x64'),_0x1534('0x65'),_0x1534('0x66')],'raw':!![]});}})['then'](function(_0x2feec5){if(_0x2feec5){fs['unlinkSync'](path[_0x1534('0x52')](_0x40754a['directory'],util[_0x1534('0x69')](_0x1534('0x6a'),_0x2feec5[_0x1534('0x2e')],_0x2feec5[_0x1534('0x65')])));return _0x2feec5;}})[_0x1534('0x49')](function(_0x2a4cc5){throw new db[(_0x1534('0x60'))][(_0x1534('0x6d'))](_0x2a4cc5[_0x1534('0x6e')]);});})[_0x1534('0x27')](handleEntityNotFound(_0x33d197,null))[_0x1534('0x27')](respondWithStatusCode(_0x33d197,0xcc))[_0x1534('0x49')](handleError(_0x33d197,null));};exports[_0x1534('0x71')]=function(_0x279cf0,_0x146085,_0x3ddd86){var _0x2c848a={};var _0x85512c={};var _0x2a53dc;var _0x38e7f2;return db[_0x1534('0x31')][_0x1534('0x63')]({'where':{'id':_0x279cf0['params']['id']}})['then'](handleEntityNotFound(_0x146085,null))[_0x1534('0x27')](function(_0x293c6f){if(_0x293c6f){_0x2a53dc=_0x293c6f;_0x85512c[_0x1534('0x34')]=_[_0x1534('0x36')](db['Sound'][_0x1534('0x32')]);_0x85512c[_0x1534('0x37')]=_[_0x1534('0x36')](_0x279cf0[_0x1534('0x37')]);_0x85512c[_0x1534('0x38')]=_['intersection'](_0x85512c[_0x1534('0x34')],_0x85512c[_0x1534('0x37')]);_0x2c848a[_0x1534('0x3b')]=_[_0x1534('0x39')](_0x85512c[_0x1534('0x34')],qs[_0x1534('0x3a')](_0x279cf0['query']['fields']));_0x2c848a[_0x1534('0x3b')]=_0x2c848a[_0x1534('0x3b')][_0x1534('0x3c')]?_0x2c848a[_0x1534('0x3b')]:_0x85512c[_0x1534('0x34')];_0x2c848a[_0x1534('0x3f')]=qs[_0x1534('0x40')](_0x279cf0[_0x1534('0x37')]['sort']);_0x2c848a[_0x1534('0x41')]=qs['filters'](_[_0x1534('0x42')](_0x279cf0['query'],_0x85512c[_0x1534('0x38')]));if(_0x279cf0['query'][_0x1534('0x43')]){_0x2c848a[_0x1534('0x41')]=_[_0x1534('0x44')](_0x2c848a['where'],{'$or':_[_0x1534('0x35')](_0x2c848a[_0x1534('0x3b')],function(_0x1e8cc4){var _0x4b43be={};_0x4b43be[_0x1e8cc4]={'$like':'%'+_0x279cf0[_0x1534('0x37')]['filter']+'%'};return _0x4b43be;})});}_0x2c848a=_[_0x1534('0x44')]({},_0x2c848a,_0x279cf0[_0x1534('0x72')]);return _0x2a53dc[_0x1534('0x71')](_0x2c848a);}})[_0x1534('0x27')](function(_0xbdc8c2){if(_0xbdc8c2){_0x38e7f2=_0xbdc8c2[_0x1534('0x3c')];if(!_0x279cf0[_0x1534('0x37')][_0x1534('0x3d')](_0x1534('0x3e'))){_0x2c848a[_0x1534('0x1f')]=qs['limit'](_0x279cf0[_0x1534('0x37')][_0x1534('0x1f')]);_0x2c848a['offset']=qs['offset'](_0x279cf0[_0x1534('0x37')]['offset']);}return _0x2a53dc[_0x1534('0x71')](_0x2c848a);}})[_0x1534('0x27')](function(_0x331ed7){if(_0x331ed7){return _0x331ed7?{'count':_0x38e7f2,'rows':_0x331ed7}:null;}})[_0x1534('0x27')](respondWithResult(_0x146085,null))[_0x1534('0x49')](handleError(_0x146085,null));}; \ No newline at end of file +var _0x135a=['update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','body','create','transaction','files','join','root','server/files/moh','mode','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','Sequelize','ValidationError','message','addSound','Sound','findOne','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','converted_format','symlinkSync','removeSound','id2','createdAt','unlinkSync','getSounds','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','apply','save'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x135a,0xc0));var _0xa135=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x135a[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xa135('0x0'));var rimraf=require(_0xa135('0x1'));var zipdir=require(_0xa135('0x2'));var jsonpatch=require(_0xa135('0x3'));var rp=require(_0xa135('0x4'));var moment=require('moment');var BPromise=require(_0xa135('0x5'));var Mustache=require(_0xa135('0x6'));var util=require(_0xa135('0x7'));var path=require(_0xa135('0x8'));var sox=require(_0xa135('0x9'));var csv=require('to-csv');var ejs=require(_0xa135('0xa'));var fs=require('fs');var fs_extra=require(_0xa135('0xb'));var _=require(_0xa135('0xc'));var squel=require(_0xa135('0xd'));var crypto=require(_0xa135('0xe'));var jsforce=require(_0xa135('0xf'));var deskjs=require(_0xa135('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa135('0x11'));var Papa=require(_0xa135('0x12'));var Redis=require(_0xa135('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa135('0x14'));var as=require(_0xa135('0x15'));var hardwareService=require(_0xa135('0x16'));var logger=require('../../config/logger')(_0xa135('0x17'));var utils=require('../../config/utils');var config=require(_0xa135('0x18'));var licenseUtil=require(_0xa135('0x19'));var db=require(_0xa135('0x1a'))['db'];function respondWithStatusCode(_0x4038d7,_0xa97407){_0xa97407=_0xa97407||0xcc;return function(_0x37cd14){if(_0x37cd14){return _0x4038d7[_0xa135('0x1b')](_0xa97407);}return _0x4038d7[_0xa135('0x1c')](_0xa97407)['end']();};}function respondWithResult(_0x1863ff,_0x308916){_0x308916=_0x308916||0xc8;return function(_0xea613b){if(_0xea613b){return _0x1863ff[_0xa135('0x1c')](_0x308916)[_0xa135('0x1d')](_0xea613b);}};}function respondWithFilteredResult(_0x12e49d,_0x482260){return function(_0x1e1893){if(_0x1e1893){var _0xd30d88=typeof _0x482260['offset']===_0xa135('0x1e')&&typeof _0x482260[_0xa135('0x1f')]===_0xa135('0x1e');var _0x3ffc54=_0x1e1893[_0xa135('0x20')];var _0x30a83c=_0xd30d88?0x0:_0x482260['offset'];var _0x366d68=_0xd30d88?_0x1e1893[_0xa135('0x20')]:_0x482260['offset']+_0x482260['limit'];var _0x4e8de0;if(_0x366d68>=_0x3ffc54){_0x366d68=_0x3ffc54;_0x4e8de0=0xc8;}else{_0x4e8de0=0xce;}_0x12e49d[_0xa135('0x1c')](_0x4e8de0);return _0x12e49d[_0xa135('0x21')]('Content-Range',_0x30a83c+'-'+_0x366d68+'/'+_0x3ffc54)[_0xa135('0x1d')](_0x1e1893);}return null;};}function patchUpdates(_0x1d81d1){return function(_0x394d0d){try{jsonpatch[_0xa135('0x22')](_0x394d0d,_0x1d81d1,!![]);}catch(_0x5a0b7b){return BPromise['reject'](_0x5a0b7b);}return _0x394d0d[_0xa135('0x23')]();};}function saveUpdates(_0x18e5a9,_0x5699d3){return function(_0x3a0998){if(_0x3a0998){return _0x3a0998[_0xa135('0x24')](_0x18e5a9)[_0xa135('0x25')](function(_0x2dcd8c){return _0x2dcd8c;});}return null;};}function removeEntity(_0x2b756b,_0xd7edd5){return function(_0x14ddec){if(_0x14ddec){return _0x14ddec[_0xa135('0x26')]()[_0xa135('0x25')](function(){var _0x3ba22d=_0x14ddec[_0xa135('0x27')]({'plain':!![]});var _0x3bf494=_0xa135('0x28');return db[_0xa135('0x29')][_0xa135('0x26')]({'where':{'type':_0x3bf494,'resourceId':_0x3ba22d['id']}})[_0xa135('0x25')](function(){return _0x14ddec;});})['then'](function(){_0x2b756b['status'](0xcc)[_0xa135('0x2a')]();});}};}function handleEntityNotFound(_0x3e5f4d,_0x1c262a){return function(_0x2a7187){if(!_0x2a7187){_0x3e5f4d[_0xa135('0x1b')](0x194);}return _0x2a7187;};}function handleError(_0x1d9e10,_0x566710){_0x566710=_0x566710||0x1f4;return function(_0x5a073c){logger[_0xa135('0x2b')](_0x5a073c[_0xa135('0x2c')]);if(_0x5a073c[_0xa135('0x2d')]){delete _0x5a073c[_0xa135('0x2d')];}_0x1d9e10[_0xa135('0x1c')](_0x566710)[_0xa135('0x2e')](_0x5a073c);};}exports['index']=function(_0x174d03,_0x2eb6a5){var _0x2337ad={},_0x1afc81={},_0x4d3b6f={'count':0x0,'rows':[]};var _0x5ee68b=_[_0xa135('0x2f')](db[_0xa135('0x30')]['rawAttributes'],function(_0xee47aa){return{'name':_0xee47aa[_0xa135('0x31')],'type':_0xee47aa[_0xa135('0x32')][_0xa135('0x33')]};});_0x1afc81[_0xa135('0x34')]=_[_0xa135('0x2f')](_0x5ee68b,_0xa135('0x2d'));_0x1afc81[_0xa135('0x35')]=_[_0xa135('0x36')](_0x174d03[_0xa135('0x35')]);_0x1afc81['filters']=_[_0xa135('0x37')](_0x1afc81['model'],_0x1afc81[_0xa135('0x35')]);_0x2337ad[_0xa135('0x38')]=_[_0xa135('0x37')](_0x1afc81[_0xa135('0x34')],qs[_0xa135('0x39')](_0x174d03['query']['fields']));_0x2337ad[_0xa135('0x38')]=_0x2337ad['attributes']['length']?_0x2337ad[_0xa135('0x38')]:_0x1afc81[_0xa135('0x34')];if(!_0x174d03[_0xa135('0x35')][_0xa135('0x3a')](_0xa135('0x3b'))){_0x2337ad[_0xa135('0x1f')]=qs['limit'](_0x174d03[_0xa135('0x35')][_0xa135('0x1f')]);_0x2337ad[_0xa135('0x3c')]=qs[_0xa135('0x3c')](_0x174d03[_0xa135('0x35')][_0xa135('0x3c')]);}_0x2337ad[_0xa135('0x3d')]=qs['sort'](_0x174d03[_0xa135('0x35')][_0xa135('0x3e')]);delete _0x174d03[_0xa135('0x35')]['sort'];_0x2337ad[_0xa135('0x3f')]=qs['filters'](_[_0xa135('0x40')](_0x174d03[_0xa135('0x35')],_0x1afc81[_0xa135('0x41')]),_0x5ee68b);if(_0x174d03['query'][_0xa135('0x42')]){_0x2337ad['where']=_[_0xa135('0x43')](_0x2337ad['where'],{'$or':_['map'](_0x5ee68b,function(_0x367cae){if(_0x367cae[_0xa135('0x32')]!==_0xa135('0x44')){var _0x2cbf73={};_0x2cbf73[_0x367cae['name']]={'$like':'%'+_0x174d03[_0xa135('0x35')]['filter']+'%'};return _0x2cbf73;}})});}_0x2337ad=_[_0xa135('0x43')]({},_0x2337ad,_0x174d03['options']);var _0x4de64b={'where':_0x2337ad[_0xa135('0x3f')]};return db[_0xa135('0x30')][_0xa135('0x20')](_0x4de64b)['then'](function(_0x348f16){_0x4d3b6f[_0xa135('0x20')]=_0x348f16;if(_0x174d03['query'][_0xa135('0x45')]){_0x2337ad[_0xa135('0x46')]=[{'all':!![]}];}return db[_0xa135('0x30')][_0xa135('0x47')](_0x2337ad);})[_0xa135('0x25')](function(_0x3af3f){_0x4d3b6f['rows']=_0x3af3f;return _0x4d3b6f;})[_0xa135('0x25')](respondWithFilteredResult(_0x2eb6a5,_0x2337ad))[_0xa135('0x48')](handleError(_0x2eb6a5,null));};exports[_0xa135('0x49')]=function(_0x44de15,_0x32c8e7){var _0x2c6bab={'raw':![],'where':{'id':_0x44de15[_0xa135('0x4a')]['id']}},_0x7b2aad={};_0x7b2aad[_0xa135('0x34')]=_[_0xa135('0x36')](db[_0xa135('0x30')]['rawAttributes']);_0x7b2aad[_0xa135('0x35')]=_['keys'](_0x44de15['query']);_0x7b2aad[_0xa135('0x41')]=_['intersection'](_0x7b2aad[_0xa135('0x34')],_0x7b2aad['query']);_0x2c6bab[_0xa135('0x38')]=_[_0xa135('0x37')](_0x7b2aad[_0xa135('0x34')],qs['fields'](_0x44de15[_0xa135('0x35')]['fields']));_0x2c6bab[_0xa135('0x38')]=_0x2c6bab['attributes'][_0xa135('0x4b')]?_0x2c6bab[_0xa135('0x38')]:_0x7b2aad['model'];if(_0x44de15[_0xa135('0x35')]['includeAll']){_0x2c6bab[_0xa135('0x46')]=[{'all':!![]}];}_0x2c6bab=_[_0xa135('0x43')]({},_0x2c6bab,_0x44de15['options']);return db[_0xa135('0x30')][_0xa135('0x4c')](_0x2c6bab)[_0xa135('0x25')](handleEntityNotFound(_0x32c8e7,null))['then'](respondWithResult(_0x32c8e7,null))[_0xa135('0x48')](handleError(_0x32c8e7,null));};exports[_0xa135('0x24')]=function(_0x13dba0,_0x20fb08){if(_0x13dba0[_0xa135('0x4d')]['id']){delete _0x13dba0['body']['id'];}return db[_0xa135('0x30')][_0xa135('0x4c')]({'where':{'id':_0x13dba0[_0xa135('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20fb08,null))[_0xa135('0x25')](saveUpdates(_0x13dba0[_0xa135('0x4d')],null))[_0xa135('0x25')](respondWithResult(_0x20fb08,null))[_0xa135('0x48')](handleError(_0x20fb08,null));};exports[_0xa135('0x4e')]=function(_0x2d83d0,_0xc123dc,_0x473a7c){return db['sequelize'][_0xa135('0x4f')](function(_0x2729a2){if(_0x2d83d0[_0xa135('0x4d')]['mode']===_0xa135('0x50')){_0x2d83d0[_0xa135('0x4d')]['directory']=path[_0xa135('0x51')](config[_0xa135('0x52')],_0xa135('0x53'),_0x2d83d0['body'][_0xa135('0x2d')]);}return db['VoiceMusicOnHold'][_0xa135('0x4e')](_0x2d83d0[_0xa135('0x4d')],{'transaction':_0x2729a2})[_0xa135('0x25')](function(_0x5f5c11){if(_0x2d83d0[_0xa135('0x4d')][_0xa135('0x54')]===_0xa135('0x50')){fs['mkdirSync'](_0x5f5c11[_0xa135('0x55')],parseInt(_0xa135('0x56'),0x8));}var _0x37cc18=_0x2d83d0['user'][_0xa135('0x27')]({'plain':!![]});if(!_0x37cc18)throw new Error(_0xa135('0x57'));if(_0x37cc18['role']===_0xa135('0x58')){var _0x4d88c0=_0x5f5c11['get']({'plain':!![]});return db['UserProfileSection'][_0xa135('0x4c')]({'where':{'name':_0xa135('0x28'),'userProfileId':_0x37cc18[_0xa135('0x59')]},'raw':!![]})['then'](function(_0x3063fb){if(_0x3063fb&&_0x3063fb[_0xa135('0x5a')]===0x0){return db[_0xa135('0x29')][_0xa135('0x4e')]({'name':_0x4d88c0[_0xa135('0x2d')],'resourceId':_0x4d88c0['id'],'type':_0x3063fb['name'],'sectionId':_0x3063fb['id']},{})[_0xa135('0x25')](function(){return _0x5f5c11;});}else{return _0x5f5c11;}})[_0xa135('0x48')](function(_0x110efb){logger[_0xa135('0x2b')](_0xa135('0x5b'),_0x110efb);});}return _0x5f5c11;});})['then'](respondWithResult(_0xc123dc,0xc9))['catch'](handleError(_0xc123dc,null));};exports[_0xa135('0x26')]=function(_0x598a80,_0x552f27,_0x233ad4){var _0x2b8758;return db[_0xa135('0x30')][_0xa135('0x4c')]({'where':{'id':_0x598a80[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](function(_0x240f41){if(_0x240f41){return db[_0xa135('0x5c')][_0xa135('0x4f')](function(_0x117602){return _0x240f41[_0xa135('0x26')]({'transaction':_0x117602,'raw':!![]})[_0xa135('0x25')](function(_0x13db70){if(_0x13db70[_0xa135('0x55')]){fs['readdirSync'](_0x13db70[_0xa135('0x55')])[_0xa135('0x5d')](function(_0x4df359){fs['unlinkSync'](path['join'](_0x13db70['directory'],_0x4df359));});fs['rmdirSync'](_0x13db70[_0xa135('0x55')]);}return _0x13db70;});})[_0xa135('0x48')](function(_0x36a5ba){throw new db[(_0xa135('0x5e'))][(_0xa135('0x5f'))](_0x36a5ba[_0xa135('0x60')]);});}})[_0xa135('0x25')](handleEntityNotFound(_0x552f27,null))['then'](removeEntity(_0x552f27,null))[_0xa135('0x48')](handleError(_0x552f27,null));};exports[_0xa135('0x61')]=function(_0x145cca,_0x12dcac,_0x29d207){return db[_0xa135('0x5c')][_0xa135('0x4f')](function(_0x126ad4){var _0x2e8b8c;return db['VoiceMusicOnHold'][_0xa135('0x4c')]({'where':{'id':_0x145cca[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](function(_0x499b44){if(_0x499b44){_0x2e8b8c=_0x499b44;return _0x499b44[_0xa135('0x61')](_0x145cca['body']['id'],{'transaction':_0x126ad4});}})[_0xa135('0x25')](function(_0x70a8ab){if(_0x70a8ab){return db[_0xa135('0x62')][_0xa135('0x63')]({'where':{'id':_0x145cca[_0xa135('0x4d')]['id']},'attributes':['id',_0xa135('0x2d'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0xa135('0x25')](function(_0x573dcb){if(_0x573dcb){var _0x35f80d=path[_0xa135('0x51')](config[_0xa135('0x52')],_0xa135('0x64'),util[_0xa135('0x65')](_0xa135('0x66'),path[_0xa135('0x67')](_0x573dcb[_0xa135('0x68')],path[_0xa135('0x69')](_0x573dcb[_0xa135('0x68')])),_0x573dcb['converted_format']));var _0x43af15=path['join'](config[_0xa135('0x52')],_0xa135('0x53'),_0x2e8b8c['name'],util[_0xa135('0x65')](_0xa135('0x66'),_0x573dcb['name'],_0x573dcb[_0xa135('0x6a')]));fs[_0xa135('0x6b')](_0x35f80d,_0x43af15);return _0x573dcb;}})[_0xa135('0x48')](function(_0x270185){throw new db['Sequelize'][(_0xa135('0x5f'))](_0x270185[_0xa135('0x60')]);});})['then'](handleEntityNotFound(_0x12dcac,null))[_0xa135('0x25')](respondWithResult(_0x12dcac,0xc9))[_0xa135('0x48')](handleError(_0x12dcac,null));};exports['removeSound']=function(_0x4a0271,_0x4581e4,_0x1e86e2){return db[_0xa135('0x5c')][_0xa135('0x4f')](function(_0x5274a2){var _0x4161a3;return db[_0xa135('0x30')]['findOne']({'where':{'id':_0x4a0271[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](handleEntityNotFound(_0x4581e4,null))[_0xa135('0x25')](function(_0x42ca6d){if(_0x42ca6d){_0x4161a3=_0x42ca6d;return _0x42ca6d[_0xa135('0x6c')](_0x4a0271['params'][_0xa135('0x6d')]);}})[_0xa135('0x25')](function(_0x2eb3b9){if(_0x2eb3b9){return db[_0xa135('0x62')][_0xa135('0x63')]({'where':{'id':_0x4a0271[_0xa135('0x4a')][_0xa135('0x6d')]},'attributes':['id',_0xa135('0x2d'),_0xa135('0x68'),_0xa135('0x6a'),_0xa135('0x6e')],'raw':!![]});}})[_0xa135('0x25')](function(_0x2947e0){if(_0x2947e0){fs[_0xa135('0x6f')](path[_0xa135('0x51')](_0x4161a3[_0xa135('0x55')],util[_0xa135('0x65')](_0xa135('0x66'),_0x2947e0[_0xa135('0x2d')],_0x2947e0[_0xa135('0x6a')])));return _0x2947e0;}})[_0xa135('0x48')](function(_0x57e4d9){throw new db[(_0xa135('0x5e'))][(_0xa135('0x5f'))](_0x57e4d9[_0xa135('0x60')]);});})[_0xa135('0x25')](handleEntityNotFound(_0x4581e4,null))['then'](respondWithStatusCode(_0x4581e4,0xcc))[_0xa135('0x48')](handleError(_0x4581e4,null));};exports[_0xa135('0x70')]=function(_0x29c3f7,_0x2bab66,_0x1c41f2){var _0x5b0598={};var _0x34eb04={};var _0xc94492;var _0x507bcc;return db[_0xa135('0x30')][_0xa135('0x63')]({'where':{'id':_0x29c3f7[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](handleEntityNotFound(_0x2bab66,null))['then'](function(_0x230ca8){if(_0x230ca8){_0xc94492=_0x230ca8;_0x34eb04[_0xa135('0x34')]=_[_0xa135('0x36')](db[_0xa135('0x62')][_0xa135('0x71')]);_0x34eb04[_0xa135('0x35')]=_[_0xa135('0x36')](_0x29c3f7[_0xa135('0x35')]);_0x34eb04[_0xa135('0x41')]=_[_0xa135('0x37')](_0x34eb04['model'],_0x34eb04[_0xa135('0x35')]);_0x5b0598[_0xa135('0x38')]=_['intersection'](_0x34eb04[_0xa135('0x34')],qs[_0xa135('0x39')](_0x29c3f7[_0xa135('0x35')]['fields']));_0x5b0598[_0xa135('0x38')]=_0x5b0598[_0xa135('0x38')][_0xa135('0x4b')]?_0x5b0598[_0xa135('0x38')]:_0x34eb04[_0xa135('0x34')];_0x5b0598[_0xa135('0x3d')]=qs[_0xa135('0x3e')](_0x29c3f7[_0xa135('0x35')][_0xa135('0x3e')]);_0x5b0598[_0xa135('0x3f')]=qs[_0xa135('0x41')](_['pick'](_0x29c3f7[_0xa135('0x35')],_0x34eb04[_0xa135('0x41')]));if(_0x29c3f7[_0xa135('0x35')][_0xa135('0x42')]){_0x5b0598['where']=_['merge'](_0x5b0598[_0xa135('0x3f')],{'$or':_[_0xa135('0x2f')](_0x5b0598[_0xa135('0x38')],function(_0x3b387a){var _0x52852a={};_0x52852a[_0x3b387a]={'$like':'%'+_0x29c3f7[_0xa135('0x35')][_0xa135('0x42')]+'%'};return _0x52852a;})});}_0x5b0598=_['merge']({},_0x5b0598,_0x29c3f7['options']);return _0xc94492[_0xa135('0x70')](_0x5b0598);}})[_0xa135('0x25')](function(_0x416d69){if(_0x416d69){_0x507bcc=_0x416d69[_0xa135('0x4b')];if(!_0x29c3f7[_0xa135('0x35')][_0xa135('0x3a')]('nolimit')){_0x5b0598[_0xa135('0x1f')]=qs['limit'](_0x29c3f7[_0xa135('0x35')][_0xa135('0x1f')]);_0x5b0598[_0xa135('0x3c')]=qs['offset'](_0x29c3f7[_0xa135('0x35')][_0xa135('0x3c')]);}return _0xc94492[_0xa135('0x70')](_0x5b0598);}})['then'](function(_0x2fe22e){if(_0x2fe22e){return _0x2fe22e?{'count':_0x507bcc,'rows':_0x2fe22e}:null;}})[_0xa135('0x25')](respondWithResult(_0x2bab66,null))[_0xa135('0x48')](handleError(_0x2bab66,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 673311d..836e62b 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 _0x1c76=['bluebird','request-promise','path','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','util','../../config/logger','api','moment'];(function(_0x524663,_0x2ea595){var _0x23b548=function(_0x3aff0f){while(--_0x3aff0f){_0x524663['push'](_0x524663['shift']());}};_0x23b548(++_0x2ea595);}(_0x1c76,0x11a));var _0x61c7=function(_0x14af30,_0x16ad98){_0x14af30=_0x14af30-0x0;var _0x4eb38f=_0x1c76[_0x14af30];return _0x4eb38f;};'use strict';var _=require('lodash');var util=require(_0x61c7('0x0'));var logger=require(_0x61c7('0x1'))(_0x61c7('0x2'));var moment=require(_0x61c7('0x3'));var BPromise=require(_0x61c7('0x4'));var rp=require(_0x61c7('0x5'));var fs=require('fs');var path=require(_0x61c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61c7('0x7'));module[_0x61c7('0x8')]=function(_0x54c798,_0x2707a9){return _0x54c798[_0x61c7('0x9')](_0x61c7('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aa4=['VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x372c7f,_0xa064de){var _0x3b7370=function(_0x1ec118){while(--_0x1ec118){_0x372c7f['push'](_0x372c7f['shift']());}};_0x3b7370(++_0xa064de);}(_0x1aa4,0xaa));var _0x41aa=function(_0x3a8055,_0xdb678b){_0x3a8055=_0x3a8055-0x0;var _0x1c3fe4=_0x1aa4[_0x3a8055];return _0x1c3fe4;};'use strict';var _=require(_0x41aa('0x0'));var util=require(_0x41aa('0x1'));var logger=require('../../config/logger')(_0x41aa('0x2'));var moment=require(_0x41aa('0x3'));var BPromise=require(_0x41aa('0x4'));var rp=require(_0x41aa('0x5'));var fs=require('fs');var path=require(_0x41aa('0x6'));var rimraf=require(_0x41aa('0x7'));var config=require(_0x41aa('0x8'));var attributes=require(_0x41aa('0x9'));module[_0x41aa('0xa')]=function(_0x24f1ee,_0x56df6c){return _0x24f1ee[_0x41aa('0xb')](_0x41aa('0xc'),attributes,{'tableName':_0x41aa('0xd'),'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 55e723f..0d32d2f 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x357a04,_0x34d70a){var _0xec3d57=function(_0x219b0b){while(--_0x219b0b){_0x357a04['push'](_0x357a04['shift']());}};_0xec3d57(++_0x34d70a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xcb91[_0x54b283];return _0x2462b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1b777e,_0x4b2526){var _0x3f3011=function(_0x12a0e4){while(--_0x12a0e4){_0x1b777e['push'](_0x1b777e['shift']());}};_0x3f3011(++_0x4b2526);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e49cb10..cd7414b 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 _0xd0ee=['fs-extra','../../components/auth/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','addAgents','post','put','update','destroy','removeAgents','delete','exports','multer','util','path','express'];(function(_0x4b24cb,_0x59ce47){var _0x244be5=function(_0x52a1ab){while(--_0x52a1ab){_0x4b24cb['push'](_0x4b24cb['shift']());}};_0x244be5(++_0x59ce47);}(_0xd0ee,0x18c));var _0xed0e=function(_0x1a3329,_0x1b7e68){_0x1a3329=_0x1a3329-0x0;var _0x50f706=_0xd0ee[_0x1a3329];return _0x50f706;};'use strict';var multer=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var path=require(_0xed0e('0x2'));var timeout=require('connect-timeout');var express=require(_0xed0e('0x3'));var router=express['Router']();var fs_extra=require(_0xed0e('0x4'));var auth=require(_0xed0e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xed0e('0x6'));router['get']('/',auth[_0xed0e('0x7')](),controller[_0xed0e('0x8')]);router[_0xed0e('0x9')](_0xed0e('0xa'),auth['isAuthenticated'](),controller[_0xed0e('0xb')]);router[_0xed0e('0x9')](_0xed0e('0xc'),auth[_0xed0e('0x7')](),controller[_0xed0e('0xd')]);router[_0xed0e('0x9')](_0xed0e('0xe'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xed0e('0xf'),auth[_0xed0e('0x7')](),controller[_0xed0e('0x10')]);router['post']('/',auth[_0xed0e('0x7')](),controller['create']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xed0e('0x11')]);router[_0xed0e('0x12')]('/:id/teams',auth[_0xed0e('0x7')](),controller['addTeams']);router[_0xed0e('0x13')](_0xed0e('0xc'),auth[_0xed0e('0x7')](),controller[_0xed0e('0x14')]);router['delete'](_0xed0e('0xc'),auth[_0xed0e('0x7')](),controller[_0xed0e('0x15')]);router['delete'](_0xed0e('0xe'),auth[_0xed0e('0x7')](),controller[_0xed0e('0x16')]);router[_0xed0e('0x17')](_0xed0e('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xed0e('0x18')]=router; \ No newline at end of file +var _0x8832=['./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','/:id/teams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x49739d,_0x388796){var _0x5a4f98=function(_0x45b17d){while(--_0x45b17d){_0x49739d['push'](_0x49739d['shift']());}};_0x5a4f98(++_0x388796);}(_0x8832,0x1f4));var _0x2883=function(_0xdc7bb5,_0x5bbb57){_0xdc7bb5=_0xdc7bb5-0x0;var _0x27565d=_0x8832[_0xdc7bb5];return _0x27565d;};'use strict';var multer=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2883('0x2'));var router=express[_0x2883('0x3')]();var fs_extra=require(_0x2883('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2883('0x5'));var config=require('../../config/environment');var controller=require(_0x2883('0x6'));router[_0x2883('0x7')]('/',auth[_0x2883('0x8')](),controller['index']);router[_0x2883('0x7')]('/describe',auth[_0x2883('0x8')](),controller[_0x2883('0x9')]);router['get']('/:id',auth[_0x2883('0x8')](),controller[_0x2883('0xa')]);router[_0x2883('0x7')](_0x2883('0xb'),auth[_0x2883('0x8')](),controller['getAgents']);router['get'](_0x2883('0xc'),auth['isAuthenticated'](),controller['getTeams']);router['post']('/',auth[_0x2883('0x8')](),controller['create']);router[_0x2883('0xd')](_0x2883('0xb'),auth[_0x2883('0x8')](),controller[_0x2883('0xe')]);router[_0x2883('0xd')](_0x2883('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0x2883('0xf')](_0x2883('0x10'),auth['isAuthenticated'](),controller[_0x2883('0x11')]);router[_0x2883('0x12')](_0x2883('0x10'),auth[_0x2883('0x8')](),controller[_0x2883('0x13')]);router[_0x2883('0x12')](_0x2883('0xb'),auth[_0x2883('0x8')](),controller['removeAgents']);router[_0x2883('0x12')](_0x2883('0xc'),auth[_0x2883('0x8')](),controller[_0x2883('0x14')]);module[_0x2883('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6dd5dcb..a4d40a1 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 _0x4dbc=['exports','STRING','name','system-','getDataValue','INTEGER','sequelize'];(function(_0x2ee72d,_0xbd33ba){var _0x192095=function(_0x128eed){while(--_0x128eed){_0x2ee72d['push'](_0x2ee72d['shift']());}};_0x192095(++_0xbd33ba);}(_0x4dbc,0xca));var _0xc4db=function(_0x162723,_0x4357f4){_0x162723=_0x162723-0x0;var _0x24dc91=_0x4dbc[_0x162723];return _0x24dc91;};'use strict';var Sequelize=require(_0xc4db('0x0'));module[_0xc4db('0x1')]={'name':{'type':Sequelize[_0xc4db('0x2')],'allowNull':![],'unique':_0xc4db('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2dada1){return _0xc4db('0x4')+this[_0xc4db('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0xc4db('0x2')]},'callerIdAll':{'type':Sequelize[_0xc4db('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xc4db('0x6')]}}; \ No newline at end of file +var _0x0e83=['system-','STRING','sequelize','exports','name'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x0e83,0xe8));var _0x30e8=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x0e83[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x30e8('0x0'));module[_0x30e8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x30e8('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x16050c){return _0x30e8('0x3')+this['getDataValue'](_0x30e8('0x2'))+'-';}},'description':{'type':Sequelize[_0x30e8('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 09e6894..3ffa620 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 _0x93e9=['VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','${EXTEN:','length','charAt','body','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','options','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','catch','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','appdata','prefix','NoOp'];(function(_0x1ed609,_0xda1796){var _0x31931e=function(_0x389619){while(--_0x389619){_0x1ed609['push'](_0x1ed609['shift']());}};_0x31931e(++_0xda1796);}(_0x93e9,0xcc));var _0x993e=function(_0x3addef,_0x37deb2){_0x3addef=_0x3addef-0x0;var _0x3a2b8e=_0x93e9[_0x3addef];return _0x3a2b8e;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);function respondWithStatusCode(_0x34ddda,_0x20f32a){_0x20f32a=_0x20f32a||0xcc;return function(_0x2a184b){if(_0x2a184b){return _0x34ddda[_0x993e('0x1e')](_0x20f32a);}return _0x34ddda[_0x993e('0x1f')](_0x20f32a)[_0x993e('0x20')]();};}function respondWithResult(_0x3df0e7,_0x125322){_0x125322=_0x125322||0xc8;return function(_0x1f267f){if(_0x1f267f){return _0x3df0e7[_0x993e('0x1f')](_0x125322)[_0x993e('0x21')](_0x1f267f);}};}function respondWithFilteredResult(_0x526e06,_0x22f7cc){return function(_0x1acd21){if(_0x1acd21){var _0x3cc2b9=typeof _0x22f7cc[_0x993e('0x22')]===_0x993e('0x23')&&typeof _0x22f7cc[_0x993e('0x24')]==='undefined';var _0x11cd41=_0x1acd21[_0x993e('0x25')];var _0x1eaf57=_0x3cc2b9?0x0:_0x22f7cc[_0x993e('0x22')];var _0x130a8a=_0x3cc2b9?_0x1acd21[_0x993e('0x25')]:_0x22f7cc[_0x993e('0x22')]+_0x22f7cc[_0x993e('0x24')];var _0x4bbe9c;if(_0x130a8a>=_0x11cd41){_0x130a8a=_0x11cd41;_0x4bbe9c=0xc8;}else{_0x4bbe9c=0xce;}_0x526e06[_0x993e('0x1f')](_0x4bbe9c);return _0x526e06['set'](_0x993e('0x26'),_0x1eaf57+'-'+_0x130a8a+'/'+_0x11cd41)[_0x993e('0x21')](_0x1acd21);}return null;};}function patchUpdates(_0x32b09e){return function(_0x5ba2a1){try{jsonpatch[_0x993e('0x27')](_0x5ba2a1,_0x32b09e,!![]);}catch(_0x13db4e){return BPromise[_0x993e('0x28')](_0x13db4e);}return _0x5ba2a1[_0x993e('0x29')]();};}function saveUpdates(_0x3b45ef,_0x328d22){return function(_0xa1c83e){if(_0xa1c83e){return _0xa1c83e[_0x993e('0x2a')](_0x3b45ef)[_0x993e('0x2b')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){return _0x4fe471[_0x993e('0x2c')]()[_0x993e('0x2b')](function(){var _0x52b727=_0x4fe471[_0x993e('0x2d')]({'plain':!![]});var _0x4f5cc1=_0x993e('0x2e');return db[_0x993e('0x2f')][_0x993e('0x2c')]({'where':{'type':_0x4f5cc1,'resourceId':_0x52b727['id']}})[_0x993e('0x2b')](function(){return _0x4fe471;});})['then'](function(){_0x3fe099['status'](0xcc)[_0x993e('0x20')]();});}};}function handleEntityNotFound(_0x466d63,_0x4a4f00){return function(_0x223af0){if(!_0x223af0){_0x466d63[_0x993e('0x1e')](0x194);}return _0x223af0;};}function handleError(_0x248354,_0x4c5ee3){_0x4c5ee3=_0x4c5ee3||0x1f4;return function(_0x2495b7){logger[_0x993e('0x30')](_0x2495b7[_0x993e('0x31')]);if(_0x2495b7[_0x993e('0x32')]){delete _0x2495b7[_0x993e('0x32')];}_0x248354['status'](_0x4c5ee3)[_0x993e('0x33')](_0x2495b7);};}exports['index']=function(_0x782298,_0x5ba163){var _0x1da357={},_0x567ed4={},_0x3b9c3c={'count':0x0,'rows':[]};var _0x2ce5d5=_[_0x993e('0x34')](db[_0x993e('0x35')][_0x993e('0x36')],function(_0x360e2d){return{'name':_0x360e2d['fieldName'],'type':_0x360e2d[_0x993e('0x37')]['key']};});_0x567ed4['model']=_[_0x993e('0x34')](_0x2ce5d5,'name');_0x567ed4[_0x993e('0x38')]=_[_0x993e('0x39')](_0x782298[_0x993e('0x38')]);_0x567ed4[_0x993e('0x3a')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],_0x567ed4[_0x993e('0x38')]);_0x1da357[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x782298[_0x993e('0x38')][_0x993e('0x3e')]));_0x1da357[_0x993e('0x3d')]=_0x1da357[_0x993e('0x3d')]['length']?_0x1da357[_0x993e('0x3d')]:_0x567ed4[_0x993e('0x3c')];if(!_0x782298[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1da357[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x782298[_0x993e('0x38')][_0x993e('0x24')]);_0x1da357['offset']=qs[_0x993e('0x22')](_0x782298['query'][_0x993e('0x22')]);}_0x1da357[_0x993e('0x41')]=qs[_0x993e('0x42')](_0x782298[_0x993e('0x38')][_0x993e('0x42')]);_0x1da357[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x782298['query'],_0x567ed4[_0x993e('0x3a')]),_0x2ce5d5);if(_0x782298['query'][_0x993e('0x45')]){_0x1da357['where']=_[_0x993e('0x46')](_0x1da357[_0x993e('0x43')],{'$or':_[_0x993e('0x34')](_0x2ce5d5,function(_0x1f1327){if(_0x1f1327[_0x993e('0x37')]!==_0x993e('0x47')){var _0xb728cf={};_0xb728cf[_0x1f1327[_0x993e('0x32')]]={'$like':'%'+_0x782298['query'][_0x993e('0x45')]+'%'};return _0xb728cf;}})});}_0x1da357=_['merge']({},_0x1da357,_0x782298['options']);var _0x1a2712={'where':_0x1da357[_0x993e('0x43')]};return db[_0x993e('0x35')]['count'](_0x1a2712)[_0x993e('0x2b')](function(_0x40719d){_0x3b9c3c[_0x993e('0x25')]=_0x40719d;if(_0x782298['query']['includeAll']){_0x1da357['include']=[{'all':!![]}];}return db[_0x993e('0x35')][_0x993e('0x48')](_0x1da357);})[_0x993e('0x2b')](function(_0x539c9d){_0x3b9c3c[_0x993e('0x49')]=_0x539c9d;return _0x3b9c3c;})[_0x993e('0x2b')](respondWithFilteredResult(_0x5ba163,_0x1da357))['catch'](handleError(_0x5ba163,null));};exports[_0x993e('0x4a')]=function(_0x5f7563,_0x5074a6){var _0x258795={'raw':![],'where':{'id':_0x5f7563[_0x993e('0x4b')]['id']}},_0x576ea={};_0x576ea['model']=_['keys'](db['VoicePrefix'][_0x993e('0x36')]);_0x576ea[_0x993e('0x38')]=_[_0x993e('0x39')](_0x5f7563[_0x993e('0x38')]);_0x576ea['filters']=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],_0x576ea[_0x993e('0x38')]);_0x258795[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],qs['fields'](_0x5f7563['query'][_0x993e('0x3e')]));_0x258795[_0x993e('0x3d')]=_0x258795['attributes']['length']?_0x258795[_0x993e('0x3d')]:_0x576ea[_0x993e('0x3c')];if(_0x5f7563[_0x993e('0x38')][_0x993e('0x4c')]){_0x258795[_0x993e('0x4d')]=[{'all':!![]}];}_0x258795=_[_0x993e('0x46')]({},_0x258795,_0x5f7563['options']);return db[_0x993e('0x35')]['find'](_0x258795)[_0x993e('0x2b')](handleEntityNotFound(_0x5074a6,null))[_0x993e('0x2b')](respondWithResult(_0x5074a6,null))[_0x993e('0x4e')](handleError(_0x5074a6,null));};exports[_0x993e('0x2c')]=function(_0x2cba37,_0x276b99){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x2cba37['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x276b99,null))[_0x993e('0x2b')](removeEntity(_0x276b99,null))[_0x993e('0x4e')](handleError(_0x276b99,null));};exports['describe']=function(_0x355912,_0x53c1e9){return db[_0x993e('0x35')][_0x993e('0x50')]()['then'](respondWithResult(_0x53c1e9,null))[_0x993e('0x4e')](handleError(_0x53c1e9,null));};exports[_0x993e('0x51')]=function(_0x579c43,_0x3809ef){var _0x207e27;return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x2e368e){return db['VoicePrefix']['create'](_0x579c43['body'],{'transaction':_0x2e368e})[_0x993e('0x2b')](function(_0x29f8a5){_0x207e27=_0x29f8a5[_0x993e('0x2d')]({'plain':!![]});return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x207e27[_0x993e('0x55')]},'raw':!![]})['then'](function(_0x3a897d){return createVoicePrefixExtensions(_0x207e27,_0x3a897d,_0x2e368e);});});})[_0x993e('0x2b')](function(){var _0x15c8ed=_0x579c43['user'][_0x993e('0x2d')]({'plain':!![]});if(!_0x15c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c8ed['role']===_0x993e('0x56')){var _0x37d7b1=_0x207e27;return db['UserProfileSection'][_0x993e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x15c8ed[_0x993e('0x57')]},'raw':!![]})[_0x993e('0x2b')](function(_0x4a0dbd){if(_0x4a0dbd&&_0x4a0dbd['autoAssociation']===0x0){return db[_0x993e('0x2f')][_0x993e('0x51')]({'name':_0x37d7b1[_0x993e('0x32')],'resourceId':_0x37d7b1['id'],'type':_0x4a0dbd[_0x993e('0x32')],'sectionId':_0x4a0dbd['id']},{})[_0x993e('0x2b')](function(){return _0x207e27;});}else{return _0x207e27;}})[_0x993e('0x4e')](function(_0x4f9225){logger[_0x993e('0x30')](_0x993e('0x58'),_0x4f9225);throw _0x4f9225;});}return _0x207e27;})['then'](respondWithResult(_0x3809ef,null))[_0x993e('0x4e')](handleError(_0x3809ef,null));};function Extension(_0x473e00,_0x1b2113,_0x5ebaec,_0x426341){this[_0x993e('0x59')]=_0x993e('0x5a');this['exten']=_0x473e00;this[_0x993e('0x5b')]=_0x5ebaec;this[_0x993e('0x37')]=_0x993e('0x5c');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x1b2113;this[_0x993e('0x5d')]=_0x426341;}function createVoicePrefixExtensions(_0x98d16c,_0x3a3d29,_0x411484){return new BPromise(function(_0xc62106,_0x55a347){var _0x18367f=new Extension(formatPrefixName(_0x98d16c[_0x993e('0x5e')]),0x1,_0x993e('0x5f'),'Voice\x20Prefix');_0x18367f[_0x993e('0x60')]=_0x98d16c['id'];return db[_0x993e('0x54')][_0x993e('0x51')](_0x18367f,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x5e4ab1){var _0x54417b=_0x5e4ab1[_0x993e('0x2d')]({'plain':!![]});var _0x51cec9=_['map'](addVoicePrefixExtensions(_0x98d16c,_0x3a3d29),function(_0x17c7f7){_0x17c7f7[_0x993e('0x55')]=_0x54417b['id'];_0x17c7f7[_0x993e('0x60')]=_0x98d16c['id'];return _0x17c7f7;});return db[_0x993e('0x54')][_0x993e('0x61')](_0x51cec9,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x211204){if(!_0x211204){return _0x55a347(_0x993e('0x62'));}else{return _0xc62106(_0x211204);}})[_0x993e('0x4e')](function(_0x113395){return _0x55a347(_0x113395);});});;});};function addVoicePrefixExtensions(_0x300a93,_0x44def2){var _0x2ddc16=[];var _0x609430=formatPrefixName(_0x300a93[_0x993e('0x5e')]);_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x2,'Set',_0x993e('0x64')+_0x300a93[_0x993e('0x32')]));if(_0x300a93['callerIdAll']){_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'Set',_0x993e('0x65')+_0x300a93[_0x993e('0x66')]));}else{_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'NoOp',_0x993e('0x67')));}_0x2ddc16['push'](new Extension(_0x609430,0x4,'goto',_0x44def2[_0x993e('0x59')]+','+_0x993e('0x68')+(0x8+_0x300a93[_0x993e('0x32')][_0x993e('0x69')])+'}'+','+0x1));return _0x2ddc16;}function formatPrefixName(_0x2a243a){var _0x5194de='_';for(var _0x120d51=0x0;_0x120d51<_0x2a243a[_0x993e('0x69')];_0x120d51++){if(_0x2a243a[_0x993e('0x6a')](_0x120d51)=='-'){_0x5194de+=_0x2a243a['charAt'](_0x120d51);}else{_0x5194de+='['+_0x2a243a[_0x993e('0x6a')](_0x120d51)+']';}}_0x5194de+='.';return _0x5194de;}exports['update']=function(_0x1ab10e,_0x6ef96,_0x42288d){var _0x5afba1=_0x1ab10e[_0x993e('0x6b')];_0x5afba1[_0x993e('0x5e')]=_0x993e('0x6c')+_0x5afba1[_0x993e('0x32')]+'-';return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x108cad){return db[_0x993e('0x35')][_0x993e('0x2a')](_0x5afba1,{'where':{'id':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db['VoiceExtension'][_0x993e('0x2c')]({'where':{'VoicePrefixId':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x5afba1[_0x993e('0x55')]},'raw':!![]})[_0x993e('0x2b')](function(_0x282c53){return createVoicePrefixExtensions(_0x5afba1,_0x282c53,_0x108cad);});});});})[_0x993e('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5afba1['id']);})[_0x993e('0x2b')](respondWithResult(_0x6ef96,null))['catch'](handleError(_0x6ef96,null));};exports[_0x993e('0x6d')]=function(_0x444da6,_0x2ce913,_0x49788e){return db[_0x993e('0x35')]['find']({'where':{'id':_0x444da6[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x2ce913,null))[_0x993e('0x2b')](function(_0x40768a){if(_0x40768a){return _0x40768a[_0x993e('0x6d')](_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')],_[_0x993e('0x6f')](_0x444da6['body'],['ids','id'])||{})[_0x993e('0x70')](function(_0x5a70ff){for(var _0x2fb182=0x0;_0x2fb182<_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x993e('0x69')];_0x2fb182+=0x1){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':Number(_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x2fb182]),'VoicePrefixId':Number(_0x444da6[_0x993e('0x4b')]['id'])});}return _0x5a70ff;});}})[_0x993e('0x2b')](respondWithResult(_0x2ce913,null))['catch'](handleError(_0x2ce913,null));};exports[_0x993e('0x73')]=function(_0x14347f,_0x4a0002,_0x4742d9){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x14347f[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x4a0002,null))[_0x993e('0x2b')](function(_0x4157b6){if(_0x4157b6){return _0x4157b6[_0x993e('0x73')](_0x14347f[_0x993e('0x38')]['ids'])[_0x993e('0x2b')](function(){if(_[_0x993e('0x74')](_0x14347f[_0x993e('0x38')][_0x993e('0x6e')])){for(var _0x53ce16=0x0;_0x53ce16<_0x14347f['query'][_0x993e('0x6e')]['length'];_0x53ce16+=0x1){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')][_0x53ce16]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}}else{socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a0002,null))[_0x993e('0x4e')](handleError(_0x4a0002,null));};exports[_0x993e('0x76')]=function(_0x3abd3a,_0x278c2a,_0x3f6347){var _0x1a3967={};var _0x1079e7={};var _0x5c634a;var _0x47c3b6;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x3abd3a[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x278c2a,null))[_0x993e('0x2b')](function(_0x53b0c8){if(_0x53b0c8){_0x5c634a=_0x53b0c8;_0x1079e7['model']=_['keys'](db[_0x993e('0x78')][_0x993e('0x36')]);_0x1079e7[_0x993e('0x38')]=_[_0x993e('0x39')](_0x3abd3a[_0x993e('0x38')]);_0x1079e7['filters']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],_0x1079e7[_0x993e('0x38')]);_0x1a3967['attributes']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x3e')]));_0x1a3967[_0x993e('0x3d')]=_0x1a3967['attributes'][_0x993e('0x69')]?_0x1a3967['attributes']:_0x1079e7['model'];_0x1a3967['order']=qs['sort'](_0x3abd3a[_0x993e('0x38')][_0x993e('0x42')]);_0x1a3967[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x3abd3a[_0x993e('0x38')],_0x1079e7[_0x993e('0x3a')]));if(_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]){_0x1a3967['where']=_[_0x993e('0x46')](_0x1a3967['where'],{'$or':_[_0x993e('0x34')](_0x1a3967[_0x993e('0x3d')],function(_0x3e7793){var _0x65c6f0={};_0x65c6f0[_0x3e7793]={'$like':'%'+_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x65c6f0;})});}_0x1a3967=_[_0x993e('0x46')]({},_0x1a3967,_0x3abd3a['options']);return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})[_0x993e('0x2b')](function(_0x285c93){if(_0x285c93){_0x47c3b6=_0x285c93['length'];if(!_0x3abd3a[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1a3967['limit']=qs[_0x993e('0x24')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x24')]);_0x1a3967[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x22')]);}return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})['then'](function(_0x412d21){if(_0x412d21){return _0x412d21?{'count':_0x47c3b6,'rows':_0x412d21}:null;}})['then'](respondWithResult(_0x278c2a,null))[_0x993e('0x4e')](handleError(_0x278c2a,null));};exports[_0x993e('0x79')]=function(_0x4d6d94,_0x505f28,_0x4e2ccf){var _0x4506cb={};var _0x31e947={};var _0x7800d4;var _0x4e1fcf;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x4d6d94[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x505f28,null))['then'](function(_0xc35545){if(_0xc35545){_0x7800d4=_0xc35545;_0x31e947['model']=_[_0x993e('0x39')](db['Team']['rawAttributes']);_0x31e947[_0x993e('0x38')]=_[_0x993e('0x39')](_0x4d6d94[_0x993e('0x38')]);_0x31e947[_0x993e('0x3a')]=_['intersection'](_0x31e947['model'],_0x31e947['query']);_0x4506cb[_0x993e('0x3d')]=_['intersection'](_0x31e947[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x3e')]));_0x4506cb[_0x993e('0x3d')]=_0x4506cb['attributes'][_0x993e('0x69')]?_0x4506cb[_0x993e('0x3d')]:_0x31e947['model'];_0x4506cb[_0x993e('0x41')]=qs['sort'](_0x4d6d94[_0x993e('0x38')][_0x993e('0x42')]);_0x4506cb[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x4d6d94[_0x993e('0x38')],_0x31e947[_0x993e('0x3a')]));if(_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]){_0x4506cb['where']=_[_0x993e('0x46')](_0x4506cb['where'],{'$or':_[_0x993e('0x34')](_0x4506cb[_0x993e('0x3d')],function(_0x50dd66){var _0x48acd5={};_0x48acd5[_0x50dd66]={'$like':'%'+_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x48acd5;})});}_0x4506cb=_['merge']({},_0x4506cb,_0x4d6d94[_0x993e('0x7a')]);return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0xc56e5a){if(_0xc56e5a){_0x4e1fcf=_0xc56e5a['length'];if(!_0x4d6d94[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x4506cb[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x4d6d94['query'][_0x993e('0x24')]);_0x4506cb[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x22')]);}return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0x5d2b00){if(_0x5d2b00){return _0x5d2b00?{'count':_0x4e1fcf,'rows':_0x5d2b00}:null;}})[_0x993e('0x2b')](respondWithResult(_0x505f28,null))['catch'](handleError(_0x505f28,null));};exports[_0x993e('0x7b')]=function(_0x8dc65,_0x4a5755,_0x43b5c5){var _0x4d53d1=_0x8dc65['body'][_0x993e('0x6e')];var _0x371be2;return db['Team'][_0x993e('0x48')]({'where':{'id':_0x4d53d1},'attributes':['id'],'include':[{'model':db[_0x993e('0x78')],'as':_0x993e('0x7c'),'attributes':['id',_0x993e('0x32'),'online',_0x993e('0x7d'),'interface'],'raw':!![]}]})[_0x993e('0x2b')](function(_0x5c9960){if(_0x5c9960){_0x371be2=_0x5c9960;var _0x4286a0=_[_0x993e('0x7e')](_0x5c9960,function(_0x2540e4){var _0x56a23a=_0x2540e4['get']({'plain':!![]});return _0x56a23a[_0x993e('0x7c')];});return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x8dc65[_0x993e('0x4b')]['id']}})['then'](function(_0x37409f){return db['sequelize'][_0x993e('0x53')](function(_0xa16043){return _0x37409f[_0x993e('0x7b')](_0x4d53d1,{'transaction':_0xa16043})['then'](function(){return BPromise[_0x993e('0x7f')](_0x371be2,function(_0x30f7a3){return db[_0x993e('0x80')][_0x993e('0x81')]({'TeamId':_0x30f7a3['id'],'VoicePrefixId':_0x8dc65[_0x993e('0x4b')]['id']},{'transaction':_0xa16043});});})[_0x993e('0x2b')](function(){return BPromise[_0x993e('0x7f')](_0x4286a0,function(_0x3e61d2){return db[_0x993e('0x82')]['findOrCreate']({'where':{'UserId':_0x3e61d2['id'],'VoicePrefixId':_0x8dc65['params']['id']},'transaction':_0xa16043});});})['then'](function(){_0x4286a0[_0x993e('0x83')](function(_0x47c230){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':_0x47c230['id'],'VoicePrefixId':_0x37409f['id']});});});});});}})[_0x993e('0x2b')](respondWithStatusCode(_0x4a5755,null))[_0x993e('0x4e')](handleError(_0x4a5755,null));};exports['removeTeams']=function(_0x548dfb,_0x123dcd,_0x4e7340){return db[_0x993e('0x84')][_0x993e('0x48')]({'where':{'id':_0x548dfb[_0x993e('0x38')][_0x993e('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x993e('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x123dcd,null))['then'](function(_0x242374){var _0x1a3779=_[_0x993e('0x34')](_0x242374,'id');var _0x366809=[];var _0x11ba3a=[];var _0x1b2ca0=squel[_0x993e('0x85')]();_0x1b2ca0[_0x993e('0x86')](_0x993e('0x87'))[_0x993e('0x88')](_0x993e('0x89'),'tq')[_0x993e('0x8a')]('user_has_teams','ut',_0x993e('0x8b'))[_0x993e('0x43')](_0x993e('0x8c'),_0x548dfb[_0x993e('0x4b')]['id']);for(var _0x23ecf0=0x0;_0x23ecf0<_0x242374[_0x993e('0x69')];_0x23ecf0+=0x1){let _0x2fcfaa=_0x242374[_0x23ecf0];for(var _0x5303c9=0x0;_0x5303c9<_0x2fcfaa[_0x993e('0x7c')]['length'];_0x5303c9+=0x1){let _0x5d5dc8=_0x2fcfaa[_0x993e('0x7c')][_0x5303c9];var _0x102393=_0x1b2ca0[_0x993e('0x8d')]();_0x102393['where'](_0x993e('0x8e'),_0x5d5dc8['id']);_0x11ba3a[_0x993e('0x63')](db[_0x993e('0x52')][_0x993e('0x38')](_0x102393[_0x993e('0x8f')](),{'type':db[_0x993e('0x52')][_0x993e('0x90')]['SELECT']})[_0x993e('0x2b')](function(_0x6ee3c0){if(_0x6ee3c0['length']===0x1){return _0x5d5dc8['id'];}else{var _0x58fee1=_[_0x993e('0x91')](_[_0x993e('0x34')](_0x6ee3c0,_0x993e('0x92')),function(_0x2f0669){return _[_0x993e('0x93')](_0x1a3779,_0x2f0669);});if(_0x58fee1){return _0x5d5dc8['id'];}}}));}}return BPromise['all'](_0x11ba3a)[_0x993e('0x2b')](function(_0x3725b5){_0x366809=_(_0x366809)['union'](_0x3725b5)[_0x993e('0x94')]()['value']();return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x548dfb['params']['id']}})[_0x993e('0x2b')](function(_0x5ee2e0){return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x289772){return _0x5ee2e0['removeTeams'](_0x548dfb['query'][_0x993e('0x6e')],{'transaction':_0x289772})[_0x993e('0x2b')](function(){if(!_[_0x993e('0x95')](_0x366809)){return _0x5ee2e0[_0x993e('0x73')](_0x366809,{'transaction':_0x289772});}})[_0x993e('0x2b')](function(){_0x366809[_0x993e('0x83')](function(_0x366f8f){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':_0x366f8f,'VoicePrefixId':_0x5ee2e0['id']});});});});});});})['then'](respondWithStatusCode(_0x123dcd,null))[_0x993e('0x4e')](handleError(_0x123dcd,null));}; \ No newline at end of file +var _0xab40=['PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','omit','body','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','error','stack','name','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','catch','params','length','find','describe','create','sequelize','transaction','get','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','description','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll'];(function(_0x2f9005,_0x2a4281){var _0x1ef28a=function(_0x51bfdb){while(--_0x51bfdb){_0x2f9005['push'](_0x2f9005['shift']());}};_0x1ef28a(++_0x2a4281);}(_0xab40,0xcd));var _0x0ab4=function(_0x2f74aa,_0x102479){_0x2f74aa=_0x2f74aa-0x0;var _0xe303dd=_0xab40[_0x2f74aa];return _0xe303dd;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];config[_0x0ab4('0x15')]=_[_0x0ab4('0x16')](config[_0x0ab4('0x15')],{'host':_0x0ab4('0x17'),'port':0x18eb});var socket=require(_0x0ab4('0x18'))(new Redis(config[_0x0ab4('0x15')]));require(_0x0ab4('0x19'))[_0x0ab4('0x1a')](socket);function respondWithStatusCode(_0x3cb1df,_0x2033c8){_0x2033c8=_0x2033c8||0xcc;return function(_0x216a17){if(_0x216a17){return _0x3cb1df[_0x0ab4('0x1b')](_0x2033c8);}return _0x3cb1df[_0x0ab4('0x1c')](_0x2033c8)[_0x0ab4('0x1d')]();};}function respondWithResult(_0x2a83a8,_0x2403db){_0x2403db=_0x2403db||0xc8;return function(_0x283b15){if(_0x283b15){return _0x2a83a8[_0x0ab4('0x1c')](_0x2403db)['json'](_0x283b15);}};}function respondWithFilteredResult(_0x5000d4,_0x49634f){return function(_0x17422f){if(_0x17422f){var _0x30d5df=typeof _0x49634f[_0x0ab4('0x1e')]==='undefined'&&typeof _0x49634f[_0x0ab4('0x1f')]===_0x0ab4('0x20');var _0x212ebd=_0x17422f[_0x0ab4('0x21')];var _0x4e7852=_0x30d5df?0x0:_0x49634f['offset'];var _0xdb0797=_0x30d5df?_0x17422f['count']:_0x49634f[_0x0ab4('0x1e')]+_0x49634f[_0x0ab4('0x1f')];var _0x5bb1d0;if(_0xdb0797>=_0x212ebd){_0xdb0797=_0x212ebd;_0x5bb1d0=0xc8;}else{_0x5bb1d0=0xce;}_0x5000d4[_0x0ab4('0x1c')](_0x5bb1d0);return _0x5000d4[_0x0ab4('0x22')](_0x0ab4('0x23'),_0x4e7852+'-'+_0xdb0797+'/'+_0x212ebd)[_0x0ab4('0x24')](_0x17422f);}return null;};}function patchUpdates(_0x12d06d){return function(_0x52d7d3){try{jsonpatch['apply'](_0x52d7d3,_0x12d06d,!![]);}catch(_0x24b929){return BPromise[_0x0ab4('0x25')](_0x24b929);}return _0x52d7d3[_0x0ab4('0x26')]();};}function saveUpdates(_0x13c882,_0x4e4b80){return function(_0x42d2dd){if(_0x42d2dd){return _0x42d2dd[_0x0ab4('0x27')](_0x13c882)[_0x0ab4('0x28')](function(_0x4ea9aa){return _0x4ea9aa;});}return null;};}function removeEntity(_0x4c5caf,_0x176ff1){return function(_0x1c132c){if(_0x1c132c){return _0x1c132c[_0x0ab4('0x29')]()['then'](function(){var _0x519b23=_0x1c132c['get']({'plain':!![]});var _0x19ecc6='VoicePrefixes';return db[_0x0ab4('0x2a')][_0x0ab4('0x29')]({'where':{'type':_0x19ecc6,'resourceId':_0x519b23['id']}})['then'](function(){return _0x1c132c;});})['then'](function(){_0x4c5caf['status'](0xcc)[_0x0ab4('0x1d')]();});}};}function handleEntityNotFound(_0x183bac,_0x1cfdad){return function(_0x3f61cb){if(!_0x3f61cb){_0x183bac[_0x0ab4('0x1b')](0x194);}return _0x3f61cb;};}function handleError(_0x588e0d,_0x5b55c1){_0x5b55c1=_0x5b55c1||0x1f4;return function(_0x580d56){logger[_0x0ab4('0x2b')](_0x580d56[_0x0ab4('0x2c')]);if(_0x580d56[_0x0ab4('0x2d')]){delete _0x580d56[_0x0ab4('0x2d')];}_0x588e0d[_0x0ab4('0x1c')](_0x5b55c1)['send'](_0x580d56);};}exports['index']=function(_0x285a29,_0xe6682){var _0x361f7c={},_0x4819be={},_0x48e430={'count':0x0,'rows':[]};var _0x1b19db=_['map'](db[_0x0ab4('0x2e')][_0x0ab4('0x2f')],function(_0x263e5a){return{'name':_0x263e5a[_0x0ab4('0x30')],'type':_0x263e5a[_0x0ab4('0x31')][_0x0ab4('0x32')]};});_0x4819be['model']=_[_0x0ab4('0x33')](_0x1b19db,_0x0ab4('0x2d'));_0x4819be[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x285a29['query']);_0x4819be['filters']=_[_0x0ab4('0x36')](_0x4819be[_0x0ab4('0x37')],_0x4819be[_0x0ab4('0x34')]);_0x361f7c['attributes']=_['intersection'](_0x4819be['model'],qs[_0x0ab4('0x38')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x361f7c['attributes']=_0x361f7c['attributes']['length']?_0x361f7c[_0x0ab4('0x39')]:_0x4819be[_0x0ab4('0x37')];if(!_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x361f7c[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x1f')]);_0x361f7c[_0x0ab4('0x1e')]=qs['offset'](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x1e')]);}_0x361f7c[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3d')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x3d')]);_0x361f7c[_0x0ab4('0x3e')]=qs[_0x0ab4('0x3f')](_[_0x0ab4('0x40')](_0x285a29[_0x0ab4('0x34')],_0x4819be[_0x0ab4('0x3f')]),_0x1b19db);if(_0x285a29[_0x0ab4('0x34')]['filter']){_0x361f7c[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x361f7c[_0x0ab4('0x3e')],{'$or':_[_0x0ab4('0x33')](_0x1b19db,function(_0x589b46){if(_0x589b46[_0x0ab4('0x31')]!=='VIRTUAL'){var _0x43e5ba={};_0x43e5ba[_0x589b46[_0x0ab4('0x2d')]]={'$like':'%'+_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x42')]+'%'};return _0x43e5ba;}})});}_0x361f7c=_[_0x0ab4('0x41')]({},_0x361f7c,_0x285a29[_0x0ab4('0x43')]);var _0x5815d1={'where':_0x361f7c[_0x0ab4('0x3e')]};return db[_0x0ab4('0x2e')][_0x0ab4('0x21')](_0x5815d1)['then'](function(_0x395e0b){_0x48e430[_0x0ab4('0x21')]=_0x395e0b;if(_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x44')]){_0x361f7c[_0x0ab4('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x361f7c);})['then'](function(_0x2f54dd){_0x48e430[_0x0ab4('0x46')]=_0x2f54dd;return _0x48e430;})['then'](respondWithFilteredResult(_0xe6682,_0x361f7c))[_0x0ab4('0x47')](handleError(_0xe6682,null));};exports['show']=function(_0x2d1d87,_0x562262){var _0x365be1={'raw':![],'where':{'id':_0x2d1d87[_0x0ab4('0x48')]['id']}},_0x300fd8={};_0x300fd8[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x2e')]['rawAttributes']);_0x300fd8[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x2d1d87[_0x0ab4('0x34')]);_0x300fd8[_0x0ab4('0x3f')]=_[_0x0ab4('0x36')](_0x300fd8[_0x0ab4('0x37')],_0x300fd8['query']);_0x365be1[_0x0ab4('0x39')]=_['intersection'](_0x300fd8[_0x0ab4('0x37')],qs[_0x0ab4('0x38')](_0x2d1d87[_0x0ab4('0x34')]['fields']));_0x365be1[_0x0ab4('0x39')]=_0x365be1[_0x0ab4('0x39')][_0x0ab4('0x49')]?_0x365be1[_0x0ab4('0x39')]:_0x300fd8[_0x0ab4('0x37')];if(_0x2d1d87[_0x0ab4('0x34')]['includeAll']){_0x365be1[_0x0ab4('0x45')]=[{'all':!![]}];}_0x365be1=_[_0x0ab4('0x41')]({},_0x365be1,_0x2d1d87[_0x0ab4('0x43')]);return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')](_0x365be1)[_0x0ab4('0x28')](handleEntityNotFound(_0x562262,null))[_0x0ab4('0x28')](respondWithResult(_0x562262,null))[_0x0ab4('0x47')](handleError(_0x562262,null));};exports[_0x0ab4('0x29')]=function(_0x24bb13,_0x1a9675){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x24bb13['params']['id']}})[_0x0ab4('0x28')](handleEntityNotFound(_0x1a9675,null))[_0x0ab4('0x28')](removeEntity(_0x1a9675,null))['catch'](handleError(_0x1a9675,null));};exports[_0x0ab4('0x4b')]=function(_0x48efa4,_0x53d66f){return db[_0x0ab4('0x2e')][_0x0ab4('0x4b')]()[_0x0ab4('0x28')](respondWithResult(_0x53d66f,null))['catch'](handleError(_0x53d66f,null));};exports[_0x0ab4('0x4c')]=function(_0xb3bd1e,_0xeddaa1){var _0xaed2d;return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0x1eea3b){return db['VoicePrefix'][_0x0ab4('0x4c')](_0xb3bd1e['body'],{'transaction':_0x1eea3b})[_0x0ab4('0x28')](function(_0x55c073){_0xaed2d=_0x55c073[_0x0ab4('0x4f')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xaed2d[_0x0ab4('0x50')]},'raw':!![]})[_0x0ab4('0x28')](function(_0x433346){return createVoicePrefixExtensions(_0xaed2d,_0x433346,_0x1eea3b);});});})[_0x0ab4('0x28')](function(){var _0x4e2db5=_0xb3bd1e[_0x0ab4('0x51')][_0x0ab4('0x4f')]({'plain':!![]});if(!_0x4e2db5)throw new Error(_0x0ab4('0x52'));if(_0x4e2db5[_0x0ab4('0x53')]===_0x0ab4('0x51')){var _0x2354fa=_0xaed2d;return db[_0x0ab4('0x54')][_0x0ab4('0x4a')]({'where':{'name':_0x0ab4('0x55'),'userProfileId':_0x4e2db5[_0x0ab4('0x56')]},'raw':!![]})[_0x0ab4('0x28')](function(_0x355ba8){if(_0x355ba8&&_0x355ba8[_0x0ab4('0x57')]===0x0){return db[_0x0ab4('0x2a')][_0x0ab4('0x4c')]({'name':_0x2354fa[_0x0ab4('0x2d')],'resourceId':_0x2354fa['id'],'type':_0x355ba8[_0x0ab4('0x2d')],'sectionId':_0x355ba8['id']},{})[_0x0ab4('0x28')](function(){return _0xaed2d;});}else{return _0xaed2d;}})[_0x0ab4('0x47')](function(_0x59705f){logger[_0x0ab4('0x2b')](_0x0ab4('0x58'),_0x59705f);throw _0x59705f;});}return _0xaed2d;})[_0x0ab4('0x28')](respondWithResult(_0xeddaa1,null))[_0x0ab4('0x47')](handleError(_0xeddaa1,null));};function Extension(_0x32e38c,_0x3bcb90,_0x387619,_0x251e4d){this['context']=_0x0ab4('0x59');this[_0x0ab4('0x5a')]=_0x32e38c;this['app']=_0x387619;this['type']=_0x0ab4('0x5b');this[_0x0ab4('0x5c')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3bcb90;this[_0x0ab4('0x5d')]=_0x251e4d;}function createVoicePrefixExtensions(_0x5b4bbe,_0x597d26,_0x427b51){return new BPromise(function(_0x3cdedf,_0x12dccd){var _0x42cbcb=new Extension(formatPrefixName(_0x5b4bbe[_0x0ab4('0x5e')]),0x1,_0x0ab4('0x5f'),_0x0ab4('0x60'));_0x42cbcb['VoicePrefixId']=_0x5b4bbe['id'];return db[_0x0ab4('0x61')][_0x0ab4('0x4c')](_0x42cbcb,{'transaction':_0x427b51})[_0x0ab4('0x28')](function(_0x406df2){var _0x194733=_0x406df2[_0x0ab4('0x4f')]({'plain':!![]});var _0x4f1847=_[_0x0ab4('0x33')](addVoicePrefixExtensions(_0x5b4bbe,_0x597d26),function(_0x1b7925){_0x1b7925['VoiceExtensionId']=_0x194733['id'];_0x1b7925[_0x0ab4('0x62')]=_0x5b4bbe['id'];return _0x1b7925;});return db['VoiceExtension'][_0x0ab4('0x63')](_0x4f1847,{'transaction':_0x427b51})['then'](function(_0x268b23){if(!_0x268b23){return _0x12dccd(_0x0ab4('0x64'));}else{return _0x3cdedf(_0x268b23);}})[_0x0ab4('0x47')](function(_0x2e728f){return _0x12dccd(_0x2e728f);});});;});};function addVoicePrefixExtensions(_0x509611,_0x581547){var _0x10dd5b=[];var _0x4477ba=formatPrefixName(_0x509611['prefix']);_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x2,_0x0ab4('0x66'),_0x0ab4('0x67')+_0x509611['name']));if(_0x509611[_0x0ab4('0x68')]){_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x3,_0x0ab4('0x66'),_0x0ab4('0x69')+_0x509611[_0x0ab4('0x68')]));}else{_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x3,_0x0ab4('0x5f'),_0x0ab4('0x6a')));}_0x10dd5b['push'](new Extension(_0x4477ba,0x4,'goto',_0x581547[_0x0ab4('0x6b')]+','+_0x0ab4('0x6c')+(0x8+_0x509611[_0x0ab4('0x2d')][_0x0ab4('0x49')])+'}'+','+0x1));return _0x10dd5b;}function formatPrefixName(_0x58c611){var _0x417926='_';for(var _0x5256d4=0x0;_0x5256d4<_0x58c611[_0x0ab4('0x49')];_0x5256d4++){if(_0x58c611[_0x0ab4('0x6d')](_0x5256d4)=='-'){_0x417926+=_0x58c611[_0x0ab4('0x6d')](_0x5256d4);}else{_0x417926+='['+_0x58c611[_0x0ab4('0x6d')](_0x5256d4)+']';}}_0x417926+='.';return _0x417926;}exports[_0x0ab4('0x27')]=function(_0x41b65f,_0x46a008,_0xf42b98){var _0x29cf79=_0x41b65f['body'];_0x29cf79[_0x0ab4('0x5e')]='system-'+_0x29cf79[_0x0ab4('0x2d')]+'-';return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0x1481b2){return db[_0x0ab4('0x2e')][_0x0ab4('0x27')](_0x29cf79,{'where':{'id':_0x29cf79['id']},'transaction':_0x1481b2})[_0x0ab4('0x28')](function(){return db[_0x0ab4('0x61')][_0x0ab4('0x29')]({'where':{'VoicePrefixId':_0x29cf79['id']},'transaction':_0x1481b2})['then'](function(){return db[_0x0ab4('0x61')][_0x0ab4('0x4a')]({'where':{'id':_0x29cf79['VoiceExtensionId']},'raw':!![]})[_0x0ab4('0x28')](function(_0x2d4921){return createVoicePrefixExtensions(_0x29cf79,_0x2d4921,_0x1481b2);});});});})[_0x0ab4('0x28')](function(){return db['VoicePrefix'][_0x0ab4('0x6e')](_0x29cf79['id']);})[_0x0ab4('0x28')](respondWithResult(_0x46a008,null))[_0x0ab4('0x47')](handleError(_0x46a008,null));};exports[_0x0ab4('0x6f')]=function(_0x531a07,_0x5bf57e,_0x398b3e){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x531a07[_0x0ab4('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bf57e,null))[_0x0ab4('0x28')](function(_0xa0f095){if(_0xa0f095){return _0xa0f095[_0x0ab4('0x6f')](_0x531a07['body']['ids'],_[_0x0ab4('0x70')](_0x531a07[_0x0ab4('0x71')],[_0x0ab4('0x72'),'id'])||{})[_0x0ab4('0x73')](function(_0x46f69a){for(var _0x1c8965=0x0;_0x1c8965<_0x531a07[_0x0ab4('0x71')]['ids'][_0x0ab4('0x49')];_0x1c8965+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x531a07[_0x0ab4('0x71')]['ids'][_0x1c8965]),'VoicePrefixId':Number(_0x531a07[_0x0ab4('0x48')]['id'])});}return _0x46f69a;});}})[_0x0ab4('0x28')](respondWithResult(_0x5bf57e,null))[_0x0ab4('0x47')](handleError(_0x5bf57e,null));};exports[_0x0ab4('0x74')]=function(_0x1eec8e,_0x4bffd4,_0x586bd6){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x1eec8e['params']['id']}})['then'](handleEntityNotFound(_0x4bffd4,null))[_0x0ab4('0x28')](function(_0x3e3ded){if(_0x3e3ded){return _0x3e3ded['removeAgents'](_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')])[_0x0ab4('0x28')](function(){if(_['isArray'](_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')])){for(var _0x2033fc=0x0;_0x2033fc<_0x1eec8e[_0x0ab4('0x34')]['ids'][_0x0ab4('0x49')];_0x2033fc+=0x1){socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':Number(_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')][_0x2033fc]),'VoicePrefixId':Number(_0x1eec8e[_0x0ab4('0x48')]['id'])});}}else{socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':Number(_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')]),'VoicePrefixId':Number(_0x1eec8e['params']['id'])});}});}})[_0x0ab4('0x28')](respondWithStatusCode(_0x4bffd4,null))[_0x0ab4('0x47')](handleError(_0x4bffd4,null));};exports[_0x0ab4('0x77')]=function(_0x78c98e,_0xb803f2,_0x5adfaa){var _0x448fcb={};var _0x88676f={};var _0xd916e0;var _0x28a722;return db[_0x0ab4('0x2e')][_0x0ab4('0x78')]({'where':{'id':_0x78c98e[_0x0ab4('0x48')]['id']}})[_0x0ab4('0x28')](handleEntityNotFound(_0xb803f2,null))[_0x0ab4('0x28')](function(_0x23968d){if(_0x23968d){_0xd916e0=_0x23968d;_0x88676f[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x79')][_0x0ab4('0x2f')]);_0x88676f['query']=_[_0x0ab4('0x35')](_0x78c98e[_0x0ab4('0x34')]);_0x88676f[_0x0ab4('0x3f')]=_[_0x0ab4('0x36')](_0x88676f['model'],_0x88676f['query']);_0x448fcb[_0x0ab4('0x39')]=_[_0x0ab4('0x36')](_0x88676f['model'],qs[_0x0ab4('0x38')](_0x78c98e[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x448fcb[_0x0ab4('0x39')]=_0x448fcb[_0x0ab4('0x39')][_0x0ab4('0x49')]?_0x448fcb[_0x0ab4('0x39')]:_0x88676f['model'];_0x448fcb[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3d')](_0x78c98e[_0x0ab4('0x34')][_0x0ab4('0x3d')]);_0x448fcb[_0x0ab4('0x3e')]=qs[_0x0ab4('0x3f')](_[_0x0ab4('0x40')](_0x78c98e[_0x0ab4('0x34')],_0x88676f[_0x0ab4('0x3f')]));if(_0x78c98e['query'][_0x0ab4('0x42')]){_0x448fcb['where']=_[_0x0ab4('0x41')](_0x448fcb[_0x0ab4('0x3e')],{'$or':_[_0x0ab4('0x33')](_0x448fcb[_0x0ab4('0x39')],function(_0x12ee59){var _0x76fa2={};_0x76fa2[_0x12ee59]={'$like':'%'+_0x78c98e['query']['filter']+'%'};return _0x76fa2;})});}_0x448fcb=_[_0x0ab4('0x41')]({},_0x448fcb,_0x78c98e[_0x0ab4('0x43')]);return _0xd916e0['getAgents'](_0x448fcb);}})['then'](function(_0x21f0a2){if(_0x21f0a2){_0x28a722=_0x21f0a2[_0x0ab4('0x49')];if(!_0x78c98e['query'][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x448fcb[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x78c98e['query'][_0x0ab4('0x1f')]);_0x448fcb['offset']=qs['offset'](_0x78c98e[_0x0ab4('0x34')]['offset']);}return _0xd916e0[_0x0ab4('0x77')](_0x448fcb);}})[_0x0ab4('0x28')](function(_0xb1cac2){if(_0xb1cac2){return _0xb1cac2?{'count':_0x28a722,'rows':_0xb1cac2}:null;}})['then'](respondWithResult(_0xb803f2,null))[_0x0ab4('0x47')](handleError(_0xb803f2,null));};exports[_0x0ab4('0x7a')]=function(_0x840fc2,_0x2282d7,_0x2bf00c){var _0x37a592={};var _0x171969={};var _0x51f02a;var _0x2a25d5;return db['VoicePrefix'][_0x0ab4('0x78')]({'where':{'id':_0x840fc2['params']['id']}})['then'](handleEntityNotFound(_0x2282d7,null))[_0x0ab4('0x28')](function(_0x7ae8b2){if(_0x7ae8b2){_0x51f02a=_0x7ae8b2;_0x171969[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x7b')]['rawAttributes']);_0x171969['query']=_[_0x0ab4('0x35')](_0x840fc2[_0x0ab4('0x34')]);_0x171969['filters']=_[_0x0ab4('0x36')](_0x171969['model'],_0x171969[_0x0ab4('0x34')]);_0x37a592[_0x0ab4('0x39')]=_['intersection'](_0x171969[_0x0ab4('0x37')],qs[_0x0ab4('0x38')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x37a592['attributes']=_0x37a592['attributes'][_0x0ab4('0x49')]?_0x37a592[_0x0ab4('0x39')]:_0x171969[_0x0ab4('0x37')];_0x37a592['order']=qs[_0x0ab4('0x3d')](_0x840fc2['query'][_0x0ab4('0x3d')]);_0x37a592[_0x0ab4('0x3e')]=qs['filters'](_['pick'](_0x840fc2['query'],_0x171969[_0x0ab4('0x3f')]));if(_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x42')]){_0x37a592[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x37a592['where'],{'$or':_[_0x0ab4('0x33')](_0x37a592[_0x0ab4('0x39')],function(_0x5e43fe){var _0xde4e2c={};_0xde4e2c[_0x5e43fe]={'$like':'%'+_0x840fc2[_0x0ab4('0x34')]['filter']+'%'};return _0xde4e2c;})});}_0x37a592=_[_0x0ab4('0x41')]({},_0x37a592,_0x840fc2[_0x0ab4('0x43')]);return _0x51f02a['getTeams'](_0x37a592);}})[_0x0ab4('0x28')](function(_0x213828){if(_0x213828){_0x2a25d5=_0x213828[_0x0ab4('0x49')];if(!_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x37a592[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x1f')]);_0x37a592['offset']=qs[_0x0ab4('0x1e')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x1e')]);}return _0x51f02a[_0x0ab4('0x7a')](_0x37a592);}})[_0x0ab4('0x28')](function(_0x4a9e47){if(_0x4a9e47){return _0x4a9e47?{'count':_0x2a25d5,'rows':_0x4a9e47}:null;}})['then'](respondWithResult(_0x2282d7,null))[_0x0ab4('0x47')](handleError(_0x2282d7,null));};exports['addTeams']=function(_0x15e2f6,_0x3da0c1,_0x415e42){var _0x1effa7=_0x15e2f6['body'][_0x0ab4('0x72')];var _0x33c31a;return db[_0x0ab4('0x7b')][_0x0ab4('0x7c')]({'where':{'id':_0x1effa7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ab4('0x7d'),'attributes':['id',_0x0ab4('0x2d'),_0x0ab4('0x7e'),_0x0ab4('0x7f'),'interface'],'raw':!![]}]})['then'](function(_0x2c6284){if(_0x2c6284){_0x33c31a=_0x2c6284;var _0x272680=_[_0x0ab4('0x80')](_0x2c6284,function(_0x4e064a){var _0x29f715=_0x4e064a['get']({'plain':!![]});return _0x29f715[_0x0ab4('0x7d')];});return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x15e2f6['params']['id']}})['then'](function(_0x1d9644){return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0xa094f5){return _0x1d9644['addTeams'](_0x1effa7,{'transaction':_0xa094f5})[_0x0ab4('0x28')](function(){return BPromise[_0x0ab4('0x81')](_0x33c31a,function(_0x45d3fa){return db[_0x0ab4('0x82')][_0x0ab4('0x83')]({'TeamId':_0x45d3fa['id'],'VoicePrefixId':_0x15e2f6[_0x0ab4('0x48')]['id']},{'transaction':_0xa094f5});});})[_0x0ab4('0x28')](function(){return BPromise[_0x0ab4('0x81')](_0x272680,function(_0x1d74f9){return db[_0x0ab4('0x84')][_0x0ab4('0x85')]({'where':{'UserId':_0x1d74f9['id'],'VoicePrefixId':_0x15e2f6[_0x0ab4('0x48')]['id']},'transaction':_0xa094f5});});})[_0x0ab4('0x28')](function(){_0x272680['forEach'](function(_0x3984a2){socket[_0x0ab4('0x75')](_0x0ab4('0x86'),{'UserId':_0x3984a2['id'],'VoicePrefixId':_0x1d9644['id']});});});});});}})[_0x0ab4('0x28')](respondWithStatusCode(_0x3da0c1,null))[_0x0ab4('0x47')](handleError(_0x3da0c1,null));};exports[_0x0ab4('0x87')]=function(_0x2ad3a9,_0x29f866,_0x182dfa){return db[_0x0ab4('0x7b')][_0x0ab4('0x7c')]({'where':{'id':_0x2ad3a9['query'][_0x0ab4('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0ab4('0x79')],'as':_0x0ab4('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x0ab4('0x28')](handleEntityNotFound(_0x29f866,null))[_0x0ab4('0x28')](function(_0x50b719){var _0x2fbbec=_['map'](_0x50b719,'id');var _0x4379f1=[];var _0x175a2a=[];var _0x332b1c=squel[_0x0ab4('0x88')]();_0x332b1c[_0x0ab4('0x89')]('tq.TeamId')[_0x0ab4('0x8a')](_0x0ab4('0x8b'),'tq')[_0x0ab4('0x8c')](_0x0ab4('0x8d'),'ut',_0x0ab4('0x8e'))['where'](_0x0ab4('0x8f'),_0x2ad3a9[_0x0ab4('0x48')]['id']);for(var _0x3acf39=0x0;_0x3acf39<_0x50b719[_0x0ab4('0x49')];_0x3acf39+=0x1){let _0x28bc17=_0x50b719[_0x3acf39];for(var _0x927d5=0x0;_0x927d5<_0x28bc17[_0x0ab4('0x7d')][_0x0ab4('0x49')];_0x927d5+=0x1){let _0x43fde8=_0x28bc17[_0x0ab4('0x7d')][_0x927d5];var _0x3791e6=_0x332b1c[_0x0ab4('0x90')]();_0x3791e6[_0x0ab4('0x3e')](_0x0ab4('0x91'),_0x43fde8['id']);_0x175a2a['push'](db['sequelize']['query'](_0x3791e6['toString'](),{'type':db[_0x0ab4('0x4d')][_0x0ab4('0x92')]['SELECT']})[_0x0ab4('0x28')](function(_0x19e3f9){if(_0x19e3f9['length']===0x1){return _0x43fde8['id'];}else{var _0x58e215=_[_0x0ab4('0x93')](_['map'](_0x19e3f9,_0x0ab4('0x94')),function(_0x22fb42){return _['includes'](_0x2fbbec,_0x22fb42);});if(_0x58e215){return _0x43fde8['id'];}}}));}}return BPromise[_0x0ab4('0x95')](_0x175a2a)[_0x0ab4('0x28')](function(_0x17fed9){_0x4379f1=_(_0x4379f1)[_0x0ab4('0x96')](_0x17fed9)[_0x0ab4('0x97')]()[_0x0ab4('0x98')]();return db['VoicePrefix'][_0x0ab4('0x4a')]({'where':{'id':_0x2ad3a9[_0x0ab4('0x48')]['id']}})[_0x0ab4('0x28')](function(_0x4148dd){return db[_0x0ab4('0x4d')]['transaction'](function(_0x1a8f36){return _0x4148dd[_0x0ab4('0x87')](_0x2ad3a9['query'][_0x0ab4('0x72')],{'transaction':_0x1a8f36})[_0x0ab4('0x28')](function(){if(!_[_0x0ab4('0x99')](_0x4379f1)){return _0x4148dd[_0x0ab4('0x74')](_0x4379f1,{'transaction':_0x1a8f36});}})[_0x0ab4('0x28')](function(){_0x4379f1[_0x0ab4('0x9a')](function(_0x4bc8ff){socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':_0x4bc8ff,'VoicePrefixId':_0x4148dd['id']});});});});});});})[_0x0ab4('0x28')](respondWithStatusCode(_0x29f866,null))[_0x0ab4('0x47')](handleError(_0x29f866,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1f3533d..7f54ca7 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 _0x4dea=['remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dea,0x1f4));var _0xa4de=function(_0x3828cd,_0x5d8750){_0x3828cd=_0x3828cd-0x0;var _0x1fbcbb=_0x4dea[_0x3828cd];return _0x1fbcbb;};'use strict';var EventEmitter=require(_0xa4de('0x0'));var VoicePrefix=require(_0xa4de('0x1'))['db'][_0xa4de('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4de('0x3'),'afterDestroy':_0xa4de('0x4')};function emitEvent(_0x37371b){return function(_0x43ab2d,_0x521b89,_0x3c2013){VoicePrefixEvents[_0xa4de('0x5')](_0x37371b+':'+_0x43ab2d['id'],_0x43ab2d);VoicePrefixEvents[_0xa4de('0x5')](_0x37371b,_0x43ab2d);_0x3c2013(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xa4de('0x6')](e,emitEvent(event));}}module[_0xa4de('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xc719=['exports','events','../../mysqldb','VoicePrefix','update','emit','hook'];(function(_0xbe48c2,_0x3db103){var _0x39a679=function(_0x195d37){while(--_0x195d37){_0xbe48c2['push'](_0xbe48c2['shift']());}};_0x39a679(++_0x3db103);}(_0xc719,0x1eb));var _0x9c71=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xc719[_0x2ca9d4];return _0x258956;};'use strict';var EventEmitter=require(_0x9c71('0x0'));var VoicePrefix=require(_0x9c71('0x1'))['db'][_0x9c71('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c71('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4392d8){return function(_0x37c5bd,_0x626cce,_0x5a30f6){VoicePrefixEvents[_0x9c71('0x4')](_0x4392d8+':'+_0x37c5bd['id'],_0x37c5bd);VoicePrefixEvents[_0x9c71('0x4')](_0x4392d8,_0x37c5bd);_0x5a30f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x9c71('0x5')](e,emitEvent(event));}}module[_0x9c71('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index fd4792a..b53c8d7 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 _0x67c8=['api','moment','bluebird','request-promise','path','rimraf','exports','define','voice_prefixes','lodash','util'];(function(_0x31729e,_0x45944d){var _0x597280=function(_0x4279f8){while(--_0x4279f8){_0x31729e['push'](_0x31729e['shift']());}};_0x597280(++_0x45944d);}(_0x67c8,0x1d7));var _0x867c=function(_0x16e4ba,_0x11b645){_0x16e4ba=_0x16e4ba-0x0;var _0x327a71=_0x67c8[_0x16e4ba];return _0x327a71;};'use strict';var _=require(_0x867c('0x0'));var util=require(_0x867c('0x1'));var logger=require('../../config/logger')(_0x867c('0x2'));var moment=require(_0x867c('0x3'));var BPromise=require(_0x867c('0x4'));var rp=require(_0x867c('0x5'));var fs=require('fs');var path=require(_0x867c('0x6'));var rimraf=require(_0x867c('0x7'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x867c('0x8')]=function(_0x512cde,_0x35e383){return _0x512cde[_0x867c('0x9')]('VoicePrefix',attributes,{'tableName':_0x867c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e4e=['path','../../config/environment','exports','define','VoicePrefix','util','api','bluebird','request-promise'];(function(_0x14f902,_0x458963){var _0x1610a4=function(_0x3155d1){while(--_0x3155d1){_0x14f902['push'](_0x14f902['shift']());}};_0x1610a4(++_0x458963);}(_0x0e4e,0xcb));var _0xe0e4=function(_0x1f9179,_0x598964){_0x1f9179=_0x1f9179-0x0;var _0x2974c9=_0x0e4e[_0x1f9179];return _0x2974c9;};'use strict';var _=require('lodash');var util=require(_0xe0e4('0x0'));var logger=require('../../config/logger')(_0xe0e4('0x1'));var moment=require('moment');var BPromise=require(_0xe0e4('0x2'));var rp=require(_0xe0e4('0x3'));var fs=require('fs');var path=require(_0xe0e4('0x4'));var rimraf=require('rimraf');var config=require(_0xe0e4('0x5'));var attributes=require('./voicePrefix.attributes');module[_0xe0e4('0x6')]=function(_0x709535,_0x486bcd){return _0x709535[_0xe0e4('0x7')](_0xe0e4('0x8'),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 c7701f2..048030c 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 _0x2087=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x2087,0xf3));var _0x7208=function(_0x47d1fa,_0x35832e){_0x47d1fa=_0x47d1fa-0x0;var _0x5b7bd4=_0x2087[_0x47d1fa];return _0x5b7bd4;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var moment=require(_0x7208('0x2'));var BPromise=require(_0x7208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7208('0x4'));var db=require(_0x7208('0x5'))['db'];var utils=require(_0x7208('0x6'));var logger=require(_0x7208('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7208('0x8'));var client=jayson['client'][_0x7208('0x9')]({'port':0x232a});config['redis']=_[_0x7208('0xa')](config[_0x7208('0xb')],{'host':_0x7208('0xc'),'port':0x18eb});var socket=require(_0x7208('0xd'))(new Redis(config[_0x7208('0xb')]));require(_0x7208('0xe'))[_0x7208('0xf')](socket);function respondWithRpcPromise(_0x533d6a,_0x1949bc,_0x17e320){return new BPromise(function(_0x92a88e,_0x32db48){return client[_0x7208('0x10')](_0x533d6a,_0x17e320)[_0x7208('0x11')](function(_0x5b30f8){logger[_0x7208('0x12')](_0x7208('0x13'),_0x1949bc,_0x7208('0x14'));logger[_0x7208('0x15')](_0x7208('0x16'),_0x1949bc,_0x7208('0x14'),JSON['stringify'](_0x5b30f8));if(_0x5b30f8[_0x7208('0x17')]){if(_0x5b30f8[_0x7208('0x17')][_0x7208('0x18')]===0x1f4){logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);return _0x32db48(_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);}logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x5b30f8['error']['message']);return _0x92a88e(_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);}else{logger['info'](_0x7208('0x13'),_0x1949bc,_0x7208('0x14'));_0x92a88e(_0x5b30f8['result'][_0x7208('0x19')]);}})[_0x7208('0x1a')](function(_0x18f0e2){logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x18f0e2);_0x32db48(_0x18f0e2);});});} \ No newline at end of file +var _0x21b7=['request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voicePrefix.socket','register'];(function(_0x4f4f76,_0x2ed157){var _0x5899c2=function(_0x54f1a2){while(--_0x54f1a2){_0x4f4f76['push'](_0x4f4f76['shift']());}};_0x5899c2(++_0x2ed157);}(_0x21b7,0xef));var _0x721b=function(_0x407f48,_0x46893e){_0x407f48=_0x407f48-0x0;var _0x483228=_0x21b7[_0x407f48];return _0x483228;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x721b('0x0'));var rs=require(_0x721b('0x1'));var fs=require('fs');var Redis=require(_0x721b('0x2'));var db=require(_0x721b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x721b('0x4'));var config=require(_0x721b('0x5'));var jayson=require(_0x721b('0x6'));var client=jayson[_0x721b('0x7')][_0x721b('0x8')]({'port':0x232a});config[_0x721b('0x9')]=_['defaults'](config[_0x721b('0x9')],{'host':_0x721b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x721b('0xb'))[_0x721b('0xc')](socket);function respondWithRpcPromise(_0xe13699,_0x35f524,_0xfcc6d7){return new BPromise(function(_0x5e11e3,_0x302bfd){return client[_0x721b('0xd')](_0xe13699,_0xfcc6d7)[_0x721b('0xe')](function(_0x2c6f5a){logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x35f524,_0x721b('0x11'),JSON['stringify'](_0x2c6f5a));if(_0x2c6f5a[_0x721b('0x12')]){if(_0x2c6f5a[_0x721b('0x12')]['code']===0x1f4){logger['error'](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x302bfd(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x5e11e3(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}else{logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));_0x5e11e3(_0x2c6f5a['result'][_0x721b('0x13')]);}})[_0x721b('0x14')](function(_0x821d77){logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x821d77);_0x302bfd(_0x821d77);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index cedbb91..2ba5264 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 _0xbfa6=['register','length','./voicePrefix.events','save','emit','removeListener'];(function(_0xa81bc3,_0x2376a0){var _0x26f847=function(_0x182e63){while(--_0x182e63){_0xa81bc3['push'](_0xa81bc3['shift']());}};_0x26f847(++_0x2376a0);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0xbfa6[_0x35468d];return _0x30da52;};'use strict';var VoicePrefixEvents=require(_0x6bfa('0x0'));var events=[_0x6bfa('0x1'),'remove','update'];function createListener(_0x58e46d,_0x2cae45){return function(_0x10c0e2){_0x2cae45[_0x6bfa('0x2')](_0x58e46d,_0x10c0e2);};}function removeListener(_0x5eaacf,_0x3f77fa){return function(){VoicePrefixEvents[_0x6bfa('0x3')](_0x5eaacf,_0x3f77fa);};}exports[_0x6bfa('0x4')]=function(_0x39d9a3){for(var _0x3a3a1a=0x0,_0x41708e=events[_0x6bfa('0x5')];_0x3a3a1a<_0x41708e;_0x3a3a1a++){var _0x5b4337=events[_0x3a3a1a];var _0x1ad59f=createListener('voicePrefix:'+_0x5b4337,_0x39d9a3);VoicePrefixEvents['on'](_0x5b4337,_0x1ad59f);}}; \ No newline at end of file +var _0x1df5=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1baf4e,_0x2afd1c){var _0x4bd817=function(_0x29de52){while(--_0x29de52){_0x1baf4e['push'](_0x1baf4e['shift']());}};_0x4bd817(++_0x2afd1c);}(_0x1df5,0xfd));var _0x51df=function(_0x255536,_0x325896){_0x255536=_0x255536-0x0;var _0x1c17a4=_0x1df5[_0x255536];return _0x1c17a4;};'use strict';var VoicePrefixEvents=require(_0x51df('0x0'));var events=[_0x51df('0x1'),_0x51df('0x2'),_0x51df('0x3')];function createListener(_0x2d898c,_0x557d22){return function(_0x3439b4){_0x557d22[_0x51df('0x4')](_0x2d898c,_0x3439b4);};}function removeListener(_0x1c491f,_0x34fedd){return function(){VoicePrefixEvents[_0x51df('0x5')](_0x1c491f,_0x34fedd);};}exports[_0x51df('0x6')]=function(_0x15de76){for(var _0x239dbb=0x0,_0x50961e=events[_0x51df('0x7')];_0x239dbb<_0x50961e;_0x239dbb++){var _0x53b879=events[_0x239dbb];var _0x42a74a=createListener(_0x51df('0x8')+_0x53b879,_0x15de76);VoicePrefixEvents['on'](_0x53b879,_0x42a74a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7df10c6..fd31d3f 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4cfb8d,_0x3dbb01){var _0x3cf0b1=function(_0x582bcf){while(--_0x582bcf){_0x4cfb8d['push'](_0x4cfb8d['shift']());}};_0x3cf0b1(++_0x3dbb01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0xb10b,0x12a));var _0xbb10=function(_0x32be74,_0x1c6d78){_0x32be74=_0x32be74-0x0;var _0x59407f=_0xb10b[_0x32be74];return _0x59407f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 4378485..0633a45 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 _0xd160=['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)','#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','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','getDataValue','type','dialMethod','strategy','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','predictive','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue'];(function(_0x503a9e,_0x530be1){var _0x1353fd=function(_0x1434ff){while(--_0x1434ff){_0x503a9e['push'](_0x503a9e['shift']());}};_0x1353fd(++_0x530be1);}(_0xd160,0x1b9));var _0x0d16=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd160[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0x0d16('0x0'));module[_0x0d16('0x1')]={'name':{'type':Sequelize[_0x0d16('0x2')],'allowNull':![],'unique':_0x0d16('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x5'),_0x0d16('0x6')),'allowNull':![],'defaultValue':_0x0d16('0x5')},'musiconhold':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':_0x0d16('0x7')},'announce':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0d16('0x4')]('rr','ringall',_0x0d16('0x8'),_0x0d16('0x9'),_0x0d16('0xa'),_0x0d16('0xb'),_0x0d16('0xc'),_0x0d16('0xd'),_0x0d16('0xe')),'allowNull':![],'defaultValue':_0x0d16('0xf'),'set':function(_0x5b05a6){this[_0x0d16('0x10')]('strategy',_0x5b05a6?_0x5b05a6:'rrmemory');},'get':function(){var _0xf8ed85=this[_0x0d16('0x11')](_0x0d16('0x12'));var _0x199651=this[_0x0d16('0x11')](_0x0d16('0x13'));var _0x839760=this[_0x0d16('0x11')](_0x0d16('0x14'));if(_0xf8ed85===_0x0d16('0x6')){if(_0x199651==='preview'){return null;}if(_0x199651===_0x0d16('0x15')&&!['rrmemory',_0x0d16('0x16')][_0x0d16('0x17')](_0x839760)){this['setDataValue']('strategy',_0x0d16('0xb'));}}return _0x839760;}},'servicelevel':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0d16('0x18')](0xb)},'timeout':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0d16('0x2')]},'weight':{'type':Sequelize[_0x0d16('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':_0x0d16('0x19')},'autopause':{'type':Sequelize[_0x0d16('0x4')]('yes','no',_0x0d16('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0d16('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0d16('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0d16('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':_0x0d16('0x19')},'announce_holdtime':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no',_0x0d16('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0d16('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0d16('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0d16('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x0d16('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0d16('0x2')]},'queue_less_than':{'type':Sequelize[_0x0d16('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x530c42){this[_0x0d16('0x10')](_0x0d16('0x1c'),_0x530c42?_0x530c42[_0x0d16('0x1d')](','):[]);},'get':function(){return this[_0x0d16('0x11')]('periodic_announce')?this['getDataValue']('periodic_announce')[_0x0d16('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x0d16('0x19'),'set':function(_0x5e5d82){this[_0x0d16('0x10')](_0x0d16('0x1f'),_0x5e5d82?_0x5e5d82['join'](','):undefined);},'get':function(){return this[_0x0d16('0x11')]('joinempty')?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':'no','set':function(_0x2c2ca8){this[_0x0d16('0x10')]('leavewhenempty',_0x2c2ca8?_0x2c2ca8[_0x0d16('0x1d')](','):undefined);},'get':function(){return this[_0x0d16('0x11')](_0x0d16('0x20'))?this[_0x0d16('0x11')]('leavewhenempty')[_0x0d16('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x0d16('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0d16('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0d16('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0d16('0x2')]},'description':{'type':Sequelize[_0x0d16('0x2')]},'acw':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':0x0,'set':function(_0x3e75a8){this[_0x0d16('0x10')](_0x0d16('0x22'),_0x3e75a8);if(_0x3e75a8){if(this[_0x0d16('0x11')](_0x0d16('0x23'))<0x2){this[_0x0d16('0x10')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':0x0,'comment':_0x0d16('0x24')},'dialMethod':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x25'),_0x0d16('0x26'),_0x0d16('0x27'),_0x0d16('0x28'),'booked'),'defaultValue':_0x0d16('0x26'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x0d16('0x18')](0x4)[_0x0d16('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x0d16('0x18')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x0d16('0x2a')](0x2)[_0x0d16('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0d16('0x2b')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x0d16('0x2c'),_0x0d16('0x2d')),'defaultValue':_0x0d16('0x2d'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0d16('0x2a')](0x2)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0d16('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0d16('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0d16('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x30')},'dialQueueOptions':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':_0x0d16('0x31'),'comment':_0x0d16('0x32')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x33')},'dialQueueProject':{'type':Sequelize[_0x0d16('0x2')],'comment':_0x0d16('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0d16('0x18')](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0d16('0x37')},'dialTimezone':{'type':Sequelize[_0x0d16('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0d16('0x38'),_0x0d16('0x39'),_0x0d16('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':0x0,'comment':_0x0d16('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x0d16('0x18')](0x9)[_0x0d16('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0d16('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x0d16('0x18')](0x9)[_0x0d16('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0d16('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0d16('0x18')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0d16('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0d16('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0d16('0x29')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0d16('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0d16('0x18')](0x9)[_0x0d16('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0d16('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0d16('0x18')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0d16('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0d16('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0d16('0x18')](0x9)[_0x0d16('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d16('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x0d16('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0d16('0x43')},'dialRecallInQueue':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':0x0,'comment':_0x0d16('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0d16('0x4')](_0x0d16('0x45'),_0x0d16('0x46')),'defaultValue':_0x0d16('0x45')},'dialQueueProject2':{'type':Sequelize[_0x0d16('0x2')],'comment':_0x0d16('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d16('0x47')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0d16('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d16('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d16('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x0d16('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d16('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x4d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d16('0x4e')},'dialMachineMaxRetry':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0d16('0x18')](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d16('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d16('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d16('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d16('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d16('0x18')],'allowNull':!![],'comment':_0x0d16('0x52')},'mandatoryDisposition':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':![],'comment':_0x0d16('0x53'),'set':function(_0x167aed){if(!_0x167aed)this[_0x0d16('0x10')]('mandatoryDispositionPauseId',null);this[_0x0d16('0x10')](_0x0d16('0x54'),_0x167aed);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0d16('0x18')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0d16('0x18')](0x3)[_0x0d16('0x29')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x0d16('0x29')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0d16('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x7dd8=['wrapuptime','progressive','power','Dial\x20Method.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','dialMethod','preview','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x7dd8,0x78));var _0x87dd=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7dd8[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x87dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x87dd('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x3'),_0x87dd('0x4')),'allowNull':![],'defaultValue':_0x87dd('0x3')},'musiconhold':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':_0x87dd('0x5')},'announce':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x87dd('0x2')]('rr',_0x87dd('0x6'),_0x87dd('0x7'),_0x87dd('0x8'),_0x87dd('0x9'),'rrmemory','linear',_0x87dd('0xa'),_0x87dd('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x159e76){this[_0x87dd('0xc')](_0x87dd('0xd'),_0x159e76?_0x159e76:_0x87dd('0xe'));},'get':function(){var _0x74794f=this[_0x87dd('0xf')]('type');var _0x36b287=this[_0x87dd('0xf')](_0x87dd('0x10'));var _0x51b80a=this[_0x87dd('0xf')]('strategy');if(_0x74794f===_0x87dd('0x4')){if(_0x36b287===_0x87dd('0x11')){return null;}if(_0x36b287===_0x87dd('0x12')&&!['rrmemory','roundrobin'][_0x87dd('0x13')](_0x51b80a)){this[_0x87dd('0xc')](_0x87dd('0xd'),_0x87dd('0xe'));}}return _0x51b80a;}},'servicelevel':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x87dd('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x87dd('0x1')]},'weight':{'type':Sequelize[_0x87dd('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x87dd('0x2')]('yes','no'),'defaultValue':_0x87dd('0x15')},'autopause':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no',_0x87dd('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x87dd('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x87dd('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x87dd('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x87dd('0x15'),'no'),'defaultValue':_0x87dd('0x15')},'announce_holdtime':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no',_0x87dd('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x87dd('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x87dd('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x87dd('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x87dd('0x1')]},'queue_quantity2':{'type':Sequelize[_0x87dd('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x87dd('0x1')]},'periodic_announce':{'type':Sequelize[_0x87dd('0x18')],'set':function(_0x443276){this[_0x87dd('0xc')]('periodic_announce',_0x443276?_0x443276['join'](','):[]);},'get':function(){return this[_0x87dd('0xf')](_0x87dd('0x19'))?this[_0x87dd('0xf')](_0x87dd('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':_0x87dd('0x15'),'set':function(_0x2b45d5){this[_0x87dd('0xc')](_0x87dd('0x1a'),_0x2b45d5?_0x2b45d5[_0x87dd('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x87dd('0x1a'))?this[_0x87dd('0xf')]('joinempty')[_0x87dd('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':'no','set':function(_0x596d19){this[_0x87dd('0xc')](_0x87dd('0x1d'),_0x596d19?_0x596d19[_0x87dd('0x1b')](','):undefined);},'get':function(){return this[_0x87dd('0xf')](_0x87dd('0x1d'))?this[_0x87dd('0xf')](_0x87dd('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x87dd('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x87dd('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'set':function(_0xf86e15){this[_0x87dd('0xc')](_0x87dd('0x1f'),_0xf86e15);if(_0xf86e15){if(this[_0x87dd('0xf')]('wrapuptime')<0x2){this[_0x87dd('0xc')](_0x87dd('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x11'),_0x87dd('0x21'),_0x87dd('0x22'),'predictive','booked'),'defaultValue':'progressive','comment':_0x87dd('0x23')},'dialLimitChannel':{'type':Sequelize[_0x87dd('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x87dd('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x87dd('0x24')},'dialPowerLevel':{'type':Sequelize[_0x87dd('0x25')](0x2)[_0x87dd('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x87dd('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x28'),_0x87dd('0x29')),'defaultValue':_0x87dd('0x29'),'comment':_0x87dd('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x87dd('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x87dd('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x87dd('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x87dd('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x87dd('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x2e')},'dialQueueProject':{'type':Sequelize[_0x87dd('0x1')],'comment':_0x87dd('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'comment':_0x87dd('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':_0x87dd('0x34')},'dialPrefix':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x35'),_0x87dd('0x36'),'onlyIfOpen'),'defaultValue':_0x87dd('0x35')},'dialAMDActive':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'comment':_0x87dd('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x87dd('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x87dd('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x87dd('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x87dd('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x87dd('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x87dd('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x87dd('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x87dd('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x87dd('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x87dd('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x87dd('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x87dd('0x3e')),'defaultValue':_0x87dd('0x3f')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x87dd('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x87dd('0x40')},'dialCutDigit':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x87dd('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x87dd('0x14')],'allowNull':!![],'comment':_0x87dd('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5bd574){if(!_0x5bd574)this[_0x87dd('0xc')](_0x87dd('0x4a'),null);this[_0x87dd('0xc')](_0x87dd('0x4b'),_0x5bd574);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x87dd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x87dd('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f519f03..6faa39b 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 _0x55ca=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x45cd9c,_0x2ab2af){var _0x289061=function(_0x3e87c7){while(--_0x3e87c7){_0x45cd9c['push'](_0x45cd9c['shift']());}};_0x289061(++_0x2ab2af);}(_0x55ca,0x126));var _0xa55c=function(_0x551b1c,_0x3584f9){_0x551b1c=_0x551b1c-0x0;var _0x131273=_0x55ca[_0x551b1c];return _0x131273;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x235376,_0x9552cf){var _0x412e00=function(_0x55be7c){while(--_0x55be7c){_0x235376['push'](_0x235376['shift']());}};_0x412e00(++_0x9552cf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d645644..ed6572b 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 _0xebcc=['exports','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0xebcc,0x139));var _0xcebc=function(_0x569585,_0x3ab16b){_0x569585=_0x569585-0x0;var _0x34e62c=_0xebcc[_0x569585];return _0x34e62c;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xcebc('0x0'))['db'][_0xcebc('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcebc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcebc('0x3'),'afterDestroy':_0xcebc('0x4')};function emitEvent(_0x4400e6){return function(_0x1b493e,_0x1b6166,_0x30dc01){VoiceQueueEvents[_0xcebc('0x5')](_0x4400e6+':'+_0x1b493e['id'],_0x1b493e);VoiceQueueEvents['emit'](_0x4400e6,_0x1b493e);_0x30dc01(null);};}for(var e in events){if(events[_0xcebc('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xcebc('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x4f71=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit'];(function(_0x5098b8,_0x26aa52){var _0x536d73=function(_0x261ff3){while(--_0x261ff3){_0x5098b8['push'](_0x5098b8['shift']());}};_0x536d73(++_0x26aa52);}(_0x4f71,0x175));var _0x14f7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f71[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x14f7('0x0'));var VoiceQueue=require(_0x14f7('0x1'))['db'][_0x14f7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x14f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x14f7('0x4'),'afterDestroy':_0x14f7('0x5')};function emitEvent(_0x445aac){return function(_0x4b60db,_0x485eb3,_0x55f761){VoiceQueueEvents[_0x14f7('0x6')](_0x445aac+':'+_0x4b60db['id'],_0x4b60db);VoiceQueueEvents[_0x14f7('0x6')](_0x445aac,_0x4b60db);_0x55f761(null);};}for(var e in events){if(events[_0x14f7('0x7')](e)){var event=events[e];VoiceQueue[_0x14f7('0x8')](e,emitEvent(event));}}module[_0x14f7('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3d7f709..59cf814 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1c8d53,_0x1caba4){var _0x5c8c98=function(_0xb11d53){while(--_0xb11d53){_0x1c8d53['push'](_0x1c8d53['shift']());}};_0x5c8c98(++_0x1caba4);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x470b24,_0x58a01e){var _0xde9b3d=function(_0x445f8c){while(--_0x445f8c){_0x470b24['push'](_0x470b24['shift']());}};_0xde9b3d(++_0x58a01e);}(_0x008c,0x188));var _0xc008=function(_0x4e52b9,_0x3b39b2){_0x4e52b9=_0x4e52b9-0x0;var _0xca4e2a=_0x008c[_0x4e52b9];return _0xca4e2a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'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 9c2c0f0..79b69fd 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 _0x5347=['redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','options','raw','where','limit','include','map','model','attributes','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x3f2733,_0x118c92){var _0x123a94=function(_0x5e9507){while(--_0x5e9507){_0x3f2733['push'](_0x3f2733['shift']());}};_0x123a94(++_0x118c92);}(_0x5347,0x18e));var _0x7534=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0x5347[_0x328b40];return _0x556a56;};'use strict';var _=require(_0x7534('0x0'));var util=require(_0x7534('0x1'));var moment=require('moment');var BPromise=require(_0x7534('0x2'));var rs=require(_0x7534('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7534('0x4'))['db'];var utils=require(_0x7534('0x5'));var logger=require(_0x7534('0x6'))(_0x7534('0x7'));var config=require(_0x7534('0x8'));var jayson=require(_0x7534('0x9'));var client=jayson['client'][_0x7534('0xa')]({'port':0x232a});config['redis']=_[_0x7534('0xb')](config[_0x7534('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7534('0xd'))(new Redis(config[_0x7534('0xc')]));require(_0x7534('0xe'))[_0x7534('0xf')](socket);function respondWithRpcPromise(_0x9c1f24,_0x6403c6,_0x23851e){return new BPromise(function(_0x4df524,_0x41cc6b){return client[_0x7534('0x10')](_0x9c1f24,_0x23851e)[_0x7534('0x11')](function(_0x38f551){logger[_0x7534('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x6403c6,'request\x20sent');logger[_0x7534('0x13')](_0x7534('0x14'),_0x6403c6,_0x7534('0x15'),JSON[_0x7534('0x16')](_0x38f551));if(_0x38f551[_0x7534('0x17')]){if(_0x38f551['error'][_0x7534('0x18')]===0x1f4){logger[_0x7534('0x17')](_0x7534('0x19'),_0x6403c6,_0x38f551['error']['message']);return _0x41cc6b(_0x38f551[_0x7534('0x17')][_0x7534('0x1a')]);}logger[_0x7534('0x17')](_0x7534('0x19'),_0x6403c6,_0x38f551[_0x7534('0x17')][_0x7534('0x1a')]);return _0x4df524(_0x38f551[_0x7534('0x17')][_0x7534('0x1a')]);}else{logger[_0x7534('0x12')](_0x7534('0x19'),_0x6403c6,_0x7534('0x15'));_0x4df524(_0x38f551[_0x7534('0x1b')][_0x7534('0x1a')]);}})[_0x7534('0x1c')](function(_0x1eadca){logger[_0x7534('0x17')](_0x7534('0x19'),_0x6403c6,_0x1eadca);_0x41cc6b(_0x1eadca);});});}exports[_0x7534('0x1d')]=function(_0x37adf){var _0x5aed89=this;return new Promise(function(_0x84e2e4,_0x3fcb9c){return db['VoiceQueue']['findAll']({'raw':_0x37adf[_0x7534('0x1e')]?_0x37adf[_0x7534('0x1e')][_0x7534('0x1f')]===undefined?!![]:![]:!![],'where':_0x37adf['options']?_0x37adf[_0x7534('0x1e')][_0x7534('0x20')]||null:null,'attributes':_0x37adf[_0x7534('0x1e')]?_0x37adf['options']['attributes']||null:null,'limit':_0x37adf['options']?_0x37adf[_0x7534('0x1e')][_0x7534('0x21')]||null:null,'include':_0x37adf[_0x7534('0x1e')]?_0x37adf[_0x7534('0x1e')][_0x7534('0x22')]?_[_0x7534('0x23')](_0x37adf[_0x7534('0x1e')][_0x7534('0x22')],function(_0x22b405){return{'model':db[_0x22b405[_0x7534('0x24')]],'as':_0x22b405['as'],'attributes':_0x22b405[_0x7534('0x25')],'include':_0x22b405[_0x7534('0x22')]?_['map'](_0x22b405[_0x7534('0x22')],function(_0x23cc7e){return{'model':db[_0x23cc7e[_0x7534('0x24')]],'as':_0x23cc7e['as'],'attributes':_0x23cc7e[_0x7534('0x25')],'include':_0x23cc7e[_0x7534('0x22')]?_[_0x7534('0x23')](_0x23cc7e[_0x7534('0x22')],function(_0xde5ffc){return{'model':db[_0xde5ffc[_0x7534('0x24')]],'as':_0xde5ffc['as'],'attributes':_0xde5ffc[_0x7534('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7534('0x11')](function(_0x27fe23){logger[_0x7534('0x12')](_0x7534('0x1d'),_0x37adf);logger['debug'](_0x7534('0x1d'),_0x37adf,JSON[_0x7534('0x16')](_0x27fe23));_0x84e2e4(_0x27fe23);})[_0x7534('0x1c')](function(_0x43e75f){logger[_0x7534('0x17')](_0x7534('0x1d'),_0x43e75f[_0x7534('0x1a')],_0x37adf);_0x3fcb9c(_0x5aed89['error'](0x1f4,_0x43e75f[_0x7534('0x1a')]));});});};exports[_0x7534('0x26')]=function(_0x1c5224){var _0x41bd92=this;return new Promise(function(_0x196eac,_0x36a44e){return db[_0x7534('0x27')][_0x7534('0x28')]({'raw':_0x1c5224[_0x7534('0x1e')]?_0x1c5224[_0x7534('0x1e')][_0x7534('0x1f')]===undefined?!![]:![]:!![],'where':_0x1c5224[_0x7534('0x1e')]?_0x1c5224[_0x7534('0x1e')][_0x7534('0x20')]||null:null,'attributes':_0x1c5224[_0x7534('0x1e')]?_0x1c5224[_0x7534('0x1e')][_0x7534('0x25')]||null:null,'include':_0x1c5224[_0x7534('0x1e')]?_0x1c5224[_0x7534('0x1e')][_0x7534('0x22')]?_[_0x7534('0x23')](_0x1c5224[_0x7534('0x1e')][_0x7534('0x22')],function(_0x5bfd26){return{'model':db[_0x5bfd26[_0x7534('0x24')]],'as':_0x5bfd26['as'],'attributes':_0x5bfd26[_0x7534('0x25')],'include':_0x5bfd26[_0x7534('0x22')]?_[_0x7534('0x23')](_0x5bfd26[_0x7534('0x22')],function(_0x1f6119){return{'model':db[_0x1f6119[_0x7534('0x24')]],'as':_0x1f6119['as'],'attributes':_0x1f6119[_0x7534('0x25')],'include':_0x1f6119['include']?_[_0x7534('0x23')](_0x1f6119[_0x7534('0x22')],function(_0x4b359e){return{'model':db[_0x4b359e[_0x7534('0x24')]],'as':_0x4b359e['as'],'attributes':_0x4b359e[_0x7534('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7534('0x11')](function(_0x95b8cc){logger[_0x7534('0x12')](_0x7534('0x26'),_0x1c5224);logger[_0x7534('0x13')](_0x7534('0x26'),_0x1c5224,JSON[_0x7534('0x16')](_0x95b8cc));_0x196eac(_0x95b8cc);})[_0x7534('0x1c')](function(_0x38a440){logger['error'](_0x7534('0x26'),_0x38a440[_0x7534('0x1a')],_0x1c5224);_0x36a44e(_0x41bd92['error'](0x1f4,_0x38a440[_0x7534('0x1a')]));});});}; \ No newline at end of file +var _0x7896=['include','map','model','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','VoiceQueue','options','raw','attributes','limit'];(function(_0x109767,_0x151aa9){var _0x515859=function(_0x3ddbc1){while(--_0x3ddbc1){_0x109767['push'](_0x109767['shift']());}};_0x515859(++_0x151aa9);}(_0x7896,0x111));var _0x6789=function(_0x1551ed,_0x5cc3ce){_0x1551ed=_0x1551ed-0x0;var _0x499928=_0x7896[_0x1551ed];return _0x499928;};'use strict';var _=require(_0x6789('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6789('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6789('0x2'));var db=require(_0x6789('0x3'))['db'];var utils=require(_0x6789('0x4'));var logger=require(_0x6789('0x5'))('rpc');var config=require(_0x6789('0x6'));var jayson=require(_0x6789('0x7'));var client=jayson[_0x6789('0x8')][_0x6789('0x9')]({'port':0x232a});config['redis']=_[_0x6789('0xa')](config['redis'],{'host':_0x6789('0xb'),'port':0x18eb});var socket=require(_0x6789('0xc'))(new Redis(config[_0x6789('0xd')]));require(_0x6789('0xe'))[_0x6789('0xf')](socket);function respondWithRpcPromise(_0x1bbc64,_0x59caaa,_0x505d73){return new BPromise(function(_0x1106ef,_0x3a54d8){return client[_0x6789('0x10')](_0x1bbc64,_0x505d73)[_0x6789('0x11')](function(_0x4a56db){logger[_0x6789('0x12')](_0x6789('0x13'),_0x59caaa,'request\x20sent');logger[_0x6789('0x14')](_0x6789('0x15'),_0x59caaa,_0x6789('0x16'),JSON['stringify'](_0x4a56db));if(_0x4a56db[_0x6789('0x17')]){if(_0x4a56db[_0x6789('0x17')]['code']===0x1f4){logger[_0x6789('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x59caaa,_0x4a56db[_0x6789('0x17')][_0x6789('0x18')]);return _0x3a54d8(_0x4a56db[_0x6789('0x17')][_0x6789('0x18')]);}logger[_0x6789('0x17')](_0x6789('0x13'),_0x59caaa,_0x4a56db[_0x6789('0x17')][_0x6789('0x18')]);return _0x1106ef(_0x4a56db[_0x6789('0x17')]['message']);}else{logger['info'](_0x6789('0x13'),_0x59caaa,_0x6789('0x16'));_0x1106ef(_0x4a56db['result'][_0x6789('0x18')]);}})[_0x6789('0x19')](function(_0x1ca0f5){logger[_0x6789('0x17')](_0x6789('0x13'),_0x59caaa,_0x1ca0f5);_0x3a54d8(_0x1ca0f5);});});}exports['GetVoiceQueue']=function(_0x2ae8df){var _0x43fbf2=this;return new Promise(function(_0x4930a6,_0x4db029){return db[_0x6789('0x1a')]['findAll']({'raw':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df['options'][_0x6789('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df[_0x6789('0x1b')]['where']||null:null,'attributes':_0x2ae8df['options']?_0x2ae8df[_0x6789('0x1b')][_0x6789('0x1d')]||null:null,'limit':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df[_0x6789('0x1b')][_0x6789('0x1e')]||null:null,'include':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df[_0x6789('0x1b')][_0x6789('0x1f')]?_[_0x6789('0x20')](_0x2ae8df[_0x6789('0x1b')]['include'],function(_0x5c2d74){return{'model':db[_0x5c2d74[_0x6789('0x21')]],'as':_0x5c2d74['as'],'attributes':_0x5c2d74['attributes'],'include':_0x5c2d74[_0x6789('0x1f')]?_[_0x6789('0x20')](_0x5c2d74['include'],function(_0x14f7c6){return{'model':db[_0x14f7c6['model']],'as':_0x14f7c6['as'],'attributes':_0x14f7c6[_0x6789('0x1d')],'include':_0x14f7c6['include']?_[_0x6789('0x20')](_0x14f7c6['include'],function(_0x407372){return{'model':db[_0x407372[_0x6789('0x21')]],'as':_0x407372['as'],'attributes':_0x407372['attributes']};}):[]};}):[]};}):[]:[]})[_0x6789('0x11')](function(_0x2000e2){logger[_0x6789('0x12')](_0x6789('0x22'),_0x2ae8df);logger[_0x6789('0x14')]('GetVoiceQueue',_0x2ae8df,JSON[_0x6789('0x23')](_0x2000e2));_0x4930a6(_0x2000e2);})['catch'](function(_0x1dac1a){logger[_0x6789('0x17')](_0x6789('0x22'),_0x1dac1a[_0x6789('0x18')],_0x2ae8df);_0x4db029(_0x43fbf2['error'](0x1f4,_0x1dac1a['message']));});});};exports[_0x6789('0x24')]=function(_0x48e203){var _0x31a684=this;return new Promise(function(_0x927aa6,_0x533c21){return db[_0x6789('0x1a')][_0x6789('0x25')]({'raw':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')][_0x6789('0x1c')]===undefined?!![]:![]:!![],'where':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')]['where']||null:null,'attributes':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')]['attributes']||null:null,'include':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')]['include']?_[_0x6789('0x20')](_0x48e203['options'][_0x6789('0x1f')],function(_0x284fe3){return{'model':db[_0x284fe3[_0x6789('0x21')]],'as':_0x284fe3['as'],'attributes':_0x284fe3[_0x6789('0x1d')],'include':_0x284fe3['include']?_[_0x6789('0x20')](_0x284fe3[_0x6789('0x1f')],function(_0x319fd0){return{'model':db[_0x319fd0[_0x6789('0x21')]],'as':_0x319fd0['as'],'attributes':_0x319fd0[_0x6789('0x1d')],'include':_0x319fd0['include']?_[_0x6789('0x20')](_0x319fd0[_0x6789('0x1f')],function(_0x130288){return{'model':db[_0x130288[_0x6789('0x21')]],'as':_0x130288['as'],'attributes':_0x130288[_0x6789('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5abf86){logger[_0x6789('0x12')](_0x6789('0x24'),_0x48e203);logger[_0x6789('0x14')]('ShowVoiceQueue',_0x48e203,JSON[_0x6789('0x23')](_0x5abf86));_0x927aa6(_0x5abf86);})[_0x6789('0x19')](function(_0x42b1db){logger[_0x6789('0x17')](_0x6789('0x24'),_0x42b1db['message'],_0x48e203);_0x533c21(_0x31a684[_0x6789('0x17')](0x1f4,_0x42b1db['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7f54c50..bf8d4c9 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 _0x56a8=['length','save','remove','emit','register'];(function(_0x19db9c,_0x161aee){var _0x107a86=function(_0x17380b){while(--_0x17380b){_0x19db9c['push'](_0x19db9c['shift']());}};_0x107a86(++_0x161aee);}(_0x56a8,0x1dc));var _0x856a=function(_0x3314bd,_0x4ee919){_0x3314bd=_0x3314bd-0x0;var _0x2b601b=_0x56a8[_0x3314bd];return _0x2b601b;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x856a('0x0'),_0x856a('0x1'),'update'];function createListener(_0x5e6f44,_0x2caba9){return function(_0x20412b){_0x2caba9[_0x856a('0x2')](_0x5e6f44,_0x20412b);};}function removeListener(_0x629a82,_0x5278cc){return function(){VoiceQueueEvents['removeListener'](_0x629a82,_0x5278cc);};}exports[_0x856a('0x3')]=function(_0x5a2a52){for(var _0x2afef2=0x0,_0x461da2=events[_0x856a('0x4')];_0x2afef2<_0x461da2;_0x2afef2++){var _0x53a8f8=events[_0x2afef2];var _0xac8db3=createListener('voiceQueue:'+_0x53a8f8,_0x5a2a52);VoiceQueueEvents['on'](_0x53a8f8,_0xac8db3);}}; \ No newline at end of file +var _0xb6c4=['length','voiceQueue:','./voiceQueue.events','save','removeListener'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xb6c4,0x12e));var _0x4b6c=function(_0x4c6bd4,_0x303e38){_0x4c6bd4=_0x4c6bd4-0x0;var _0x2df3f2=_0xb6c4[_0x4c6bd4];return _0x2df3f2;};'use strict';var VoiceQueueEvents=require(_0x4b6c('0x0'));var events=[_0x4b6c('0x1'),'remove','update'];function createListener(_0x1ba12b,_0x591265){return function(_0x4945d9){_0x591265['emit'](_0x1ba12b,_0x4945d9);};}function removeListener(_0x4a92bd,_0x3277f2){return function(){VoiceQueueEvents[_0x4b6c('0x2')](_0x4a92bd,_0x3277f2);};}exports['register']=function(_0x4130f5){for(var _0x414e1a=0x0,_0x3d978e=events[_0x4b6c('0x3')];_0x414e1a<_0x3d978e;_0x414e1a++){var _0x312088=events[_0x414e1a];var _0x4bf2a8=createListener(_0x4b6c('0x4')+_0x312088,_0x4130f5);VoiceQueueEvents['on'](_0x312088,_0x4bf2a8);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 162d2d7..1746144 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 _0x834d=['get','isAuthenticated','/describe','/index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x14a10b,_0x4c770a){var _0x48cbb6=function(_0x4d2a66){while(--_0x4d2a66){_0x14a10b['push'](_0x14a10b['shift']());}};_0x48cbb6(++_0x4c770a);}(_0x834d,0x1c3));var _0xd834=function(_0x46cd85,_0x558df0){_0x46cd85=_0x46cd85-0x0;var _0x5ad61e=_0x834d[_0x46cd85];return _0x5ad61e;};'use strict';var multer=require(_0xd834('0x0'));var util=require(_0xd834('0x1'));var path=require(_0xd834('0x2'));var timeout=require(_0xd834('0x3'));var express=require(_0xd834('0x4'));var router=express[_0xd834('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd834('0x6'));var config=require(_0xd834('0x7'));var controller=require(_0xd834('0x8'));router[_0xd834('0x9')]('/',auth[_0xd834('0xa')](),controller['index']);router[_0xd834('0x9')](_0xd834('0xb'),auth[_0xd834('0xa')](),controller['describe']);router[_0xd834('0x9')](_0xd834('0xc'),auth[_0xd834('0xa')](),controller['getVoiceQueuesReport']);router[_0xd834('0x9')](_0xd834('0xd'),auth[_0xd834('0xa')](),controller[_0xd834('0xe')]);router[_0xd834('0xf')]('/',auth['isAuthenticated'](),controller[_0xd834('0x10')]);router[_0xd834('0x11')](_0xd834('0xd'),auth[_0xd834('0xa')](),controller[_0xd834('0x12')]);router[_0xd834('0x13')](_0xd834('0xd'),auth[_0xd834('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc664=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','exports','util','connect-timeout','Router','fs-extra'];(function(_0x4bce45,_0x306789){var _0x7424c6=function(_0x55a980){while(--_0x55a980){_0x4bce45['push'](_0x4bce45['shift']());}};_0x7424c6(++_0x306789);}(_0xc664,0x164));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4c66('0x0'));var path=require('path');var timeout=require(_0x4c66('0x1'));var express=require('express');var router=express[_0x4c66('0x2')]();var fs_extra=require(_0x4c66('0x3'));var auth=require(_0x4c66('0x4'));var interaction=require(_0x4c66('0x5'));var config=require(_0x4c66('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4c66('0x7')]);router[_0x4c66('0x8')](_0x4c66('0x9'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xb')]);router[_0x4c66('0x8')](_0x4c66('0xc'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xd')]);router[_0x4c66('0x8')](_0x4c66('0xe'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xf')]);router[_0x4c66('0x10')]('/',auth[_0x4c66('0xa')](),controller[_0x4c66('0x11')]);router[_0x4c66('0x12')](_0x4c66('0xe'),auth[_0x4c66('0xa')](),controller['update']);router['delete'](_0x4c66('0xe'),auth[_0x4c66('0xa')](),controller['destroy']);module[_0x4c66('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index eb45468..b5de226 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 _0x2800=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x5305a2,_0xd1483c){var _0x2a2064=function(_0x342406){while(--_0x342406){_0x5305a2['push'](_0x5305a2['shift']());}};_0x2a2064(++_0xd1483c);}(_0x2800,0x1e7));var _0x0280=function(_0x7139f2,_0x50e56c){_0x7139f2=_0x7139f2-0x0;var _0x58b220=_0x2800[_0x7139f2];return _0x58b220;};'use strict';var Sequelize=require(_0x0280('0x0'));var moment=require(_0x0280('0x1'));module[_0x0280('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0280('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0280('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x0280('0x4')],'set':function(_0x413eac){var _0x5e24b3=moment(_0x413eac);var _0x2e14a8=moment(this[_0x0280('0x5')](_0x0280('0x6')))[_0x0280('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5a6e49=_0x5e24b3[_0x0280('0x8')](_0x2e14a8,_0x0280('0x9'));this[_0x0280('0xa')](_0x0280('0xb'),_0x413eac);this[_0x0280('0xa')](_0x0280('0xc'),_0x5a6e49||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x0280('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0280('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x0280('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0280('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x0280('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0280('0x3')]},'connectedlinename':{'type':Sequelize[_0x0280('0x3')]},'accountcode':{'type':Sequelize[_0x0280('0x3')]},'context':{'type':Sequelize[_0x0280('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0280('0x3')]},'holdtime':{'type':Sequelize[_0x0280('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0280('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0280('0x3')]},'transfer':{'type':Sequelize[_0x0280('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0280('0x3')],'comment':_0x0280('0xf')},'transferexten':{'type':Sequelize[_0x0280('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0280('0x3')]},'disposition':{'type':Sequelize[_0x0280('0x3')]},'secondDisposition':{'type':Sequelize[_0x0280('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0280('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x0280('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x0280('0x3')]}}; \ No newline at end of file +var _0xe67f=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0xbbe263,_0x245e1b){var _0x573d3f=function(_0x23a165){while(--_0x23a165){_0xbbe263['push'](_0xbbe263['shift']());}};_0x573d3f(++_0x245e1b);}(_0xe67f,0xa0));var _0xfe67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe67f[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfe67('0x0'));module[_0xfe67('0x1')]={'type':{'type':Sequelize[_0xfe67('0x2')]},'uniqueid':{'type':Sequelize[_0xfe67('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfe67('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xfe67('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xfe67('0x3')],'set':function(_0x51cef1){var _0x23ee80=moment(_0x51cef1);var _0x291670=moment(this[_0xfe67('0x4')](_0xfe67('0x5')))[_0xfe67('0x6')](_0xfe67('0x7'));var _0x3166bb=_0x23ee80[_0xfe67('0x8')](_0x291670,_0xfe67('0x9'));this[_0xfe67('0xa')](_0xfe67('0xb'),_0x51cef1);this[_0xfe67('0xa')](_0xfe67('0xc'),_0x3166bb||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xfe67('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xfe67('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xfe67('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xfe67('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xfe67('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfe67('0x2')]},'connectedlinename':{'type':Sequelize[_0xfe67('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfe67('0x2')]},'exten':{'type':Sequelize[_0xfe67('0x2')]},'priority':{'type':Sequelize[_0xfe67('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xfe67('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xfe67('0x2')]},'transfer':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfe67('0x2')],'comment':_0xfe67('0x10')},'transferexten':{'type':Sequelize[_0xfe67('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xfe67('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xfe67('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b33cc56..14aa1ee 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 _0x389e=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','json','offset','undefined','limit','count','apply','save','update','then','destroy','status','end','error','stack','name','send','index','map','VoiceQueueReport','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','getVoiceQueuesReport','order','filter','findAll','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x389e,0x19b));var _0xe389=function(_0x4d62a4,_0x48f626){_0x4d62a4=_0x4d62a4-0x0;var _0x2ed9a1=_0x389e[_0x4d62a4];return _0x2ed9a1;};'use strict';var emlformat=require(_0xe389('0x0'));var rimraf=require(_0xe389('0x1'));var zipdir=require(_0xe389('0x2'));var jsonpatch=require(_0xe389('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe389('0x4'));var Mustache=require(_0xe389('0x5'));var util=require(_0xe389('0x6'));var path=require(_0xe389('0x7'));var sox=require(_0xe389('0x8'));var csv=require(_0xe389('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe389('0xa'));var _=require(_0xe389('0xb'));var squel=require(_0xe389('0xc'));var crypto=require(_0xe389('0xd'));var jsforce=require(_0xe389('0xe'));var deskjs=require(_0xe389('0xf'));var toCsv=require(_0xe389('0x9'));var querystring=require(_0xe389('0x10'));var Papa=require(_0xe389('0x11'));var Redis=require(_0xe389('0x12'));var authService=require(_0xe389('0x13'));var qs=require(_0xe389('0x14'));var as=require(_0xe389('0x15'));var hardwareService=require(_0xe389('0x16'));var logger=require(_0xe389('0x17'))('api');var utils=require(_0xe389('0x18'));var config=require(_0xe389('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe389('0x1a'))['db'];config[_0xe389('0x1b')]=_[_0xe389('0x1c')](config['redis'],{'host':_0xe389('0x1d'),'port':0x18eb});var socket=require(_0xe389('0x1e'))(new Redis(config[_0xe389('0x1b')]));require(_0xe389('0x1f'))[_0xe389('0x20')](socket);function respondWithStatusCode(_0x360bec,_0x3417d2){_0x3417d2=_0x3417d2||0xcc;return function(_0x6bdfe2){if(_0x6bdfe2){return _0x360bec[_0xe389('0x21')](_0x3417d2);}return _0x360bec['status'](_0x3417d2)['end']();};}function respondWithResult(_0x2dd201,_0x37aa1f){_0x37aa1f=_0x37aa1f||0xc8;return function(_0x16e38c){if(_0x16e38c){return _0x2dd201['status'](_0x37aa1f)[_0xe389('0x22')](_0x16e38c);}};}function respondWithFilteredResult(_0x38403c,_0x319a6c){return function(_0x5ac15d){if(_0x5ac15d){var _0x58bf47=typeof _0x319a6c[_0xe389('0x23')]===_0xe389('0x24')&&typeof _0x319a6c[_0xe389('0x25')]===_0xe389('0x24');var _0x4205cc=_0x5ac15d[_0xe389('0x26')];var _0x455c97=_0x58bf47?0x0:_0x319a6c[_0xe389('0x23')];var _0x28f842=_0x58bf47?_0x5ac15d['count']:_0x319a6c['offset']+_0x319a6c[_0xe389('0x25')];var _0x16b74e;if(_0x28f842>=_0x4205cc){_0x28f842=_0x4205cc;_0x16b74e=0xc8;}else{_0x16b74e=0xce;}_0x38403c['status'](_0x16b74e);return _0x38403c['set']('Content-Range',_0x455c97+'-'+_0x28f842+'/'+_0x4205cc)['json'](_0x5ac15d);}return null;};}function patchUpdates(_0x36e506){return function(_0xa829f4){try{jsonpatch[_0xe389('0x27')](_0xa829f4,_0x36e506,!![]);}catch(_0x30ccce){return BPromise['reject'](_0x30ccce);}return _0xa829f4[_0xe389('0x28')]();};}function saveUpdates(_0x49fc6d,_0x32920f){return function(_0x58585b){if(_0x58585b){return _0x58585b[_0xe389('0x29')](_0x49fc6d)[_0xe389('0x2a')](function(_0x4d8c27){return _0x4d8c27;});}return null;};}function removeEntity(_0x22ed3f,_0x4e5932){return function(_0x238016){if(_0x238016){return _0x238016[_0xe389('0x2b')]()[_0xe389('0x2a')](function(){_0x22ed3f[_0xe389('0x2c')](0xcc)[_0xe389('0x2d')]();});}};}function handleEntityNotFound(_0x5f9a8b,_0x1550f6){return function(_0x40554d){if(!_0x40554d){_0x5f9a8b[_0xe389('0x21')](0x194);}return _0x40554d;};}function handleError(_0xbc2c99,_0x2770ff){_0x2770ff=_0x2770ff||0x1f4;return function(_0x1e33d1){logger[_0xe389('0x2e')](_0x1e33d1[_0xe389('0x2f')]);if(_0x1e33d1[_0xe389('0x30')]){delete _0x1e33d1['name'];}_0xbc2c99[_0xe389('0x2c')](_0x2770ff)[_0xe389('0x31')](_0x1e33d1);};}exports[_0xe389('0x32')]=function(_0x8715d3,_0x131456){var _0x3f99bf={},_0x25bde3={},_0x5b0fe7={'count':0x0,'rows':[]};var _0x37ef84=_[_0xe389('0x33')](db[_0xe389('0x34')]['rawAttributes'],function(_0x16efda){return{'name':_0x16efda[_0xe389('0x35')],'type':_0x16efda['type'][_0xe389('0x36')]};});_0x25bde3['model']=_[_0xe389('0x33')](_0x37ef84,'name');_0x25bde3[_0xe389('0x37')]=_[_0xe389('0x38')](_0x8715d3[_0xe389('0x37')]);_0x25bde3[_0xe389('0x39')]=_[_0xe389('0x3a')](_0x25bde3['model'],_0x25bde3[_0xe389('0x37')]);_0x3f99bf[_0xe389('0x3b')]=_[_0xe389('0x3a')](_0x25bde3[_0xe389('0x3c')],qs[_0xe389('0x3d')](_0x8715d3[_0xe389('0x37')]['fields']));_0x3f99bf[_0xe389('0x3b')]=_0x3f99bf[_0xe389('0x3b')][_0xe389('0x3e')]?_0x3f99bf[_0xe389('0x3b')]:_0x25bde3[_0xe389('0x3c')];if(!_0x8715d3[_0xe389('0x37')][_0xe389('0x3f')](_0xe389('0x40'))){_0x3f99bf[_0xe389('0x25')]=qs[_0xe389('0x25')](_0x8715d3[_0xe389('0x37')][_0xe389('0x25')]);_0x3f99bf[_0xe389('0x23')]=qs[_0xe389('0x23')](_0x8715d3[_0xe389('0x37')][_0xe389('0x23')]);}_0x3f99bf['order']=qs[_0xe389('0x41')](_0x8715d3[_0xe389('0x37')][_0xe389('0x41')]);_0x3f99bf[_0xe389('0x42')]=qs[_0xe389('0x39')](_[_0xe389('0x43')](_0x8715d3[_0xe389('0x37')],_0x25bde3[_0xe389('0x39')]),_0x37ef84);if(_0x8715d3[_0xe389('0x37')]['filter']){_0x3f99bf[_0xe389('0x42')]=_['merge'](_0x3f99bf[_0xe389('0x42')],{'$or':_[_0xe389('0x33')](_0x37ef84,function(_0x59c8e8){if(_0x59c8e8['type']!=='VIRTUAL'){var _0x5d7f9f={};_0x5d7f9f[_0x59c8e8['name']]={'$like':'%'+_0x8715d3[_0xe389('0x37')]['filter']+'%'};return _0x5d7f9f;}})});}_0x3f99bf=_[_0xe389('0x44')]({},_0x3f99bf,_0x8715d3[_0xe389('0x45')]);var _0x43cb51={'where':_0x3f99bf[_0xe389('0x42')]};return db[_0xe389('0x34')]['count'](_0x43cb51)['then'](function(_0x282f76){_0x5b0fe7[_0xe389('0x26')]=_0x282f76;if(_0x8715d3[_0xe389('0x37')]['includeAll']){_0x3f99bf[_0xe389('0x46')]=[{'all':!![]}];}return db[_0xe389('0x34')]['findAll'](_0x3f99bf);})[_0xe389('0x2a')](function(_0x3884fc){_0x5b0fe7[_0xe389('0x47')]=_0x3884fc;return _0x5b0fe7;})[_0xe389('0x2a')](respondWithFilteredResult(_0x131456,_0x3f99bf))[_0xe389('0x48')](handleError(_0x131456,null));};exports[_0xe389('0x49')]=function(_0x547c08,_0x2a0878){var _0x4f9f7a={'raw':![],'where':{'id':_0x547c08[_0xe389('0x4a')]['id']}},_0xaf3fbe={};_0xaf3fbe[_0xe389('0x3c')]=_[_0xe389('0x38')](db['VoiceQueueReport'][_0xe389('0x4b')]);_0xaf3fbe[_0xe389('0x37')]=_['keys'](_0x547c08['query']);_0xaf3fbe['filters']=_[_0xe389('0x3a')](_0xaf3fbe['model'],_0xaf3fbe['query']);_0x4f9f7a['attributes']=_['intersection'](_0xaf3fbe[_0xe389('0x3c')],qs['fields'](_0x547c08['query']['fields']));_0x4f9f7a['attributes']=_0x4f9f7a['attributes']['length']?_0x4f9f7a[_0xe389('0x3b')]:_0xaf3fbe[_0xe389('0x3c')];if(_0x547c08[_0xe389('0x37')][_0xe389('0x4c')]){_0x4f9f7a[_0xe389('0x46')]=[{'all':!![]}];}_0x4f9f7a=_['merge']({},_0x4f9f7a,_0x547c08['options']);return db['VoiceQueueReport'][_0xe389('0x4d')](_0x4f9f7a)[_0xe389('0x2a')](handleEntityNotFound(_0x2a0878,null))[_0xe389('0x2a')](respondWithResult(_0x2a0878,null))[_0xe389('0x48')](handleError(_0x2a0878,null));};exports[_0xe389('0x4e')]=function(_0x39a0b6,_0xfac9cc){return db['VoiceQueueReport'][_0xe389('0x4e')](_0x39a0b6[_0xe389('0x4f')],{})['then'](respondWithResult(_0xfac9cc,0xc9))[_0xe389('0x48')](handleError(_0xfac9cc,null));};exports[_0xe389('0x29')]=function(_0x394b82,_0x491d38){if(_0x394b82[_0xe389('0x4f')]['id']){delete _0x394b82[_0xe389('0x4f')]['id'];}return db[_0xe389('0x34')]['find']({'where':{'id':_0x394b82[_0xe389('0x4a')]['id']}})['then'](handleEntityNotFound(_0x491d38,null))['then'](saveUpdates(_0x394b82[_0xe389('0x4f')],null))[_0xe389('0x2a')](respondWithResult(_0x491d38,null))[_0xe389('0x48')](handleError(_0x491d38,null));};exports['destroy']=function(_0x42f6f3,_0x5c7126){return db[_0xe389('0x34')][_0xe389('0x4d')]({'where':{'id':_0x42f6f3[_0xe389('0x4a')]['id']}})[_0xe389('0x2a')](handleEntityNotFound(_0x5c7126,null))['then'](removeEntity(_0x5c7126,null))[_0xe389('0x48')](handleError(_0x5c7126,null));};exports['describe']=function(_0x6e08b4,_0x46ed2c){return db['VoiceQueueReport'][_0xe389('0x50')]()[_0xe389('0x2a')](respondWithResult(_0x46ed2c,null))['catch'](handleError(_0x46ed2c,null));};exports[_0xe389('0x51')]=function(_0x3c831d,_0x30b3b8){var _0xe3439e={},_0x4aa5aa={},_0x4d87d4={'count':0x0,'rows':[]};_0x4aa5aa[_0xe389('0x3c')]=_[_0xe389('0x38')](db[_0xe389('0x34')][_0xe389('0x4b')]);_0x4aa5aa[_0xe389('0x37')]=_[_0xe389('0x38')](_0x3c831d[_0xe389('0x37')]);_0x4aa5aa['filters']=_[_0xe389('0x3a')](_0x4aa5aa[_0xe389('0x3c')],_0x4aa5aa['query']);_0xe3439e[_0xe389('0x3b')]=_[_0xe389('0x3a')](_0x4aa5aa['model'],qs[_0xe389('0x3d')](_0x3c831d[_0xe389('0x37')]['fields']));_0xe3439e[_0xe389('0x3b')]=_0xe3439e[_0xe389('0x3b')][_0xe389('0x3e')]?_0xe3439e[_0xe389('0x3b')]:_0x4aa5aa['model'];if(!_0x3c831d[_0xe389('0x37')]['hasOwnProperty']('nolimit')){_0xe3439e['limit']=qs[_0xe389('0x25')](_0x3c831d[_0xe389('0x37')]['limit']);_0xe3439e[_0xe389('0x23')]=qs[_0xe389('0x23')](_0x3c831d['query'][_0xe389('0x23')]);}_0xe3439e[_0xe389('0x52')]=qs[_0xe389('0x41')](_0x3c831d[_0xe389('0x37')][_0xe389('0x41')]);_0xe3439e[_0xe389('0x42')]=qs['filters'](_[_0xe389('0x43')](_0x3c831d[_0xe389('0x37')],_0x4aa5aa['filters']));if(_0x3c831d['query'][_0xe389('0x53')]){_0xe3439e[_0xe389('0x42')]=_['merge'](_0xe3439e[_0xe389('0x42')],{'$or':_[_0xe389('0x33')](_0xe3439e[_0xe389('0x3b')],function(_0x4c20b1){var _0x5deece={};_0x5deece[_0x4c20b1]={'$like':'%'+_0x3c831d[_0xe389('0x37')]['filter']+'%'};return _0x5deece;})});}_0xe3439e=_[_0xe389('0x44')]({},_0xe3439e,_0x3c831d[_0xe389('0x45')]);var _0x42112a={'where':_0xe3439e['where']};return db[_0xe389('0x34')][_0xe389('0x26')](_0x42112a)[_0xe389('0x2a')](function(_0x1232b4){_0x4d87d4['count']=_0x1232b4;if(_0x3c831d[_0xe389('0x37')][_0xe389('0x4c')]){_0xe3439e[_0xe389('0x46')]=[{'all':!![]}];}return db[_0xe389('0x34')][_0xe389('0x54')](_0xe3439e);})[_0xe389('0x2a')](function(_0x238141){_0x4d87d4[_0xe389('0x47')]=_0x238141;return _0x4d87d4;})[_0xe389('0x2a')](respondWithFilteredResult(_0x30b3b8,_0xe3439e,_0xe389('0x51')))['catch'](handleError(_0x30b3b8,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x932d=['body','catch','update','describe','getVoiceQueuesReport','hasOwnProperty','order','includeAll','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','squel','desk.js','to-csv','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','save','then','destroy','error','name','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','params','length','find','create'];(function(_0x41cba1,_0xd72d19){var _0x576aee=function(_0x414504){while(--_0x414504){_0x41cba1['push'](_0x41cba1['shift']());}};_0x576aee(++_0xd72d19);}(_0x932d,0x9a));var _0xd932=function(_0x3c73b9,_0x493d67){_0x3c73b9=_0x3c73b9-0x0;var _0x2782ab=_0x932d[_0x3c73b9];return _0x2782ab;};'use strict';var emlformat=require(_0xd932('0x0'));var rimraf=require(_0xd932('0x1'));var zipdir=require(_0xd932('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd932('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd932('0x4'));var util=require('util');var path=require(_0xd932('0x5'));var sox=require(_0xd932('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd932('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd932('0x8'));var toCsv=require(_0xd932('0x9'));var querystring=require(_0xd932('0xa'));var Papa=require('papaparse');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(_0xd932('0xb'));var logger=require(_0xd932('0xc'))(_0xd932('0xd'));var utils=require(_0xd932('0xe'));var config=require(_0xd932('0xf'));var licenseUtil=require(_0xd932('0x10'));var db=require(_0xd932('0x11'))['db'];config['redis']=_['defaults'](config[_0xd932('0x12')],{'host':_0xd932('0x13'),'port':0x18eb});var socket=require(_0xd932('0x14'))(new Redis(config['redis']));require(_0xd932('0x15'))[_0xd932('0x16')](socket);function respondWithStatusCode(_0x4790cb,_0x358d4c){_0x358d4c=_0x358d4c||0xcc;return function(_0x11cbd0){if(_0x11cbd0){return _0x4790cb[_0xd932('0x17')](_0x358d4c);}return _0x4790cb[_0xd932('0x18')](_0x358d4c)[_0xd932('0x19')]();};}function respondWithResult(_0x1b1cf4,_0x2d6d6e){_0x2d6d6e=_0x2d6d6e||0xc8;return function(_0x7dcdc9){if(_0x7dcdc9){return _0x1b1cf4[_0xd932('0x18')](_0x2d6d6e)[_0xd932('0x1a')](_0x7dcdc9);}};}function respondWithFilteredResult(_0x404b0d,_0x48bb8f){return function(_0x28c331){if(_0x28c331){var _0x3e1a5a=typeof _0x48bb8f['offset']===_0xd932('0x1b')&&typeof _0x48bb8f[_0xd932('0x1c')]===_0xd932('0x1b');var _0x36cf62=_0x28c331['count'];var _0x54f0f7=_0x3e1a5a?0x0:_0x48bb8f['offset'];var _0x1955fd=_0x3e1a5a?_0x28c331[_0xd932('0x1d')]:_0x48bb8f[_0xd932('0x1e')]+_0x48bb8f[_0xd932('0x1c')];var _0x51bbe7;if(_0x1955fd>=_0x36cf62){_0x1955fd=_0x36cf62;_0x51bbe7=0xc8;}else{_0x51bbe7=0xce;}_0x404b0d[_0xd932('0x18')](_0x51bbe7);return _0x404b0d['set']('Content-Range',_0x54f0f7+'-'+_0x1955fd+'/'+_0x36cf62)['json'](_0x28c331);}return null;};}function patchUpdates(_0x2aeb16){return function(_0x397942){try{jsonpatch['apply'](_0x397942,_0x2aeb16,!![]);}catch(_0x5cb3d4){return BPromise['reject'](_0x5cb3d4);}return _0x397942[_0xd932('0x1f')]();};}function saveUpdates(_0x3300e2,_0x576a91){return function(_0x38f2bb){if(_0x38f2bb){return _0x38f2bb['update'](_0x3300e2)[_0xd932('0x20')](function(_0x30953e){return _0x30953e;});}return null;};}function removeEntity(_0x2bd22e,_0xa41bed){return function(_0x1050a2){if(_0x1050a2){return _0x1050a2[_0xd932('0x21')]()[_0xd932('0x20')](function(){_0x2bd22e[_0xd932('0x18')](0xcc)[_0xd932('0x19')]();});}};}function handleEntityNotFound(_0x337319,_0x15af61){return function(_0x87324e){if(!_0x87324e){_0x337319[_0xd932('0x17')](0x194);}return _0x87324e;};}function handleError(_0x45c7c6,_0x394cc3){_0x394cc3=_0x394cc3||0x1f4;return function(_0x1d370a){logger[_0xd932('0x22')](_0x1d370a['stack']);if(_0x1d370a[_0xd932('0x23')]){delete _0x1d370a['name'];}_0x45c7c6['status'](_0x394cc3)['send'](_0x1d370a);};}exports[_0xd932('0x24')]=function(_0x27f2a3,_0x37b57a){var _0x4ccfc2={},_0x10cf11={},_0x44be3f={'count':0x0,'rows':[]};var _0x48cf33=_[_0xd932('0x25')](db[_0xd932('0x26')][_0xd932('0x27')],function(_0x129bf3){return{'name':_0x129bf3[_0xd932('0x28')],'type':_0x129bf3['type'][_0xd932('0x29')]};});_0x10cf11[_0xd932('0x2a')]=_[_0xd932('0x25')](_0x48cf33,_0xd932('0x23'));_0x10cf11[_0xd932('0x2b')]=_[_0xd932('0x2c')](_0x27f2a3['query']);_0x10cf11['filters']=_['intersection'](_0x10cf11[_0xd932('0x2a')],_0x10cf11['query']);_0x4ccfc2[_0xd932('0x2d')]=_[_0xd932('0x2e')](_0x10cf11[_0xd932('0x2a')],qs[_0xd932('0x2f')](_0x27f2a3[_0xd932('0x2b')][_0xd932('0x2f')]));_0x4ccfc2['attributes']=_0x4ccfc2['attributes']['length']?_0x4ccfc2[_0xd932('0x2d')]:_0x10cf11['model'];if(!_0x27f2a3['query']['hasOwnProperty'](_0xd932('0x30'))){_0x4ccfc2[_0xd932('0x1c')]=qs['limit'](_0x27f2a3[_0xd932('0x2b')][_0xd932('0x1c')]);_0x4ccfc2[_0xd932('0x1e')]=qs[_0xd932('0x1e')](_0x27f2a3['query'][_0xd932('0x1e')]);}_0x4ccfc2['order']=qs[_0xd932('0x31')](_0x27f2a3[_0xd932('0x2b')]['sort']);_0x4ccfc2['where']=qs['filters'](_[_0xd932('0x32')](_0x27f2a3[_0xd932('0x2b')],_0x10cf11[_0xd932('0x33')]),_0x48cf33);if(_0x27f2a3[_0xd932('0x2b')][_0xd932('0x34')]){_0x4ccfc2[_0xd932('0x35')]=_[_0xd932('0x36')](_0x4ccfc2['where'],{'$or':_[_0xd932('0x25')](_0x48cf33,function(_0xf4e7a){if(_0xf4e7a[_0xd932('0x37')]!==_0xd932('0x38')){var _0x1e05ff={};_0x1e05ff[_0xf4e7a['name']]={'$like':'%'+_0x27f2a3['query']['filter']+'%'};return _0x1e05ff;}})});}_0x4ccfc2=_['merge']({},_0x4ccfc2,_0x27f2a3[_0xd932('0x39')]);var _0x4d9c44={'where':_0x4ccfc2['where']};return db[_0xd932('0x26')][_0xd932('0x1d')](_0x4d9c44)['then'](function(_0x1f9d31){_0x44be3f[_0xd932('0x1d')]=_0x1f9d31;if(_0x27f2a3[_0xd932('0x2b')]['includeAll']){_0x4ccfc2[_0xd932('0x3a')]=[{'all':!![]}];}return db[_0xd932('0x26')][_0xd932('0x3b')](_0x4ccfc2);})[_0xd932('0x20')](function(_0x3f53c0){_0x44be3f[_0xd932('0x3c')]=_0x3f53c0;return _0x44be3f;})[_0xd932('0x20')](respondWithFilteredResult(_0x37b57a,_0x4ccfc2))['catch'](handleError(_0x37b57a,null));};exports['show']=function(_0x364efe,_0x2b2e3b){var _0x9de9a2={'raw':![],'where':{'id':_0x364efe[_0xd932('0x3d')]['id']}},_0x2323b1={};_0x2323b1[_0xd932('0x2a')]=_['keys'](db[_0xd932('0x26')][_0xd932('0x27')]);_0x2323b1[_0xd932('0x2b')]=_['keys'](_0x364efe[_0xd932('0x2b')]);_0x2323b1['filters']=_[_0xd932('0x2e')](_0x2323b1[_0xd932('0x2a')],_0x2323b1[_0xd932('0x2b')]);_0x9de9a2['attributes']=_[_0xd932('0x2e')](_0x2323b1['model'],qs['fields'](_0x364efe[_0xd932('0x2b')][_0xd932('0x2f')]));_0x9de9a2[_0xd932('0x2d')]=_0x9de9a2['attributes'][_0xd932('0x3e')]?_0x9de9a2[_0xd932('0x2d')]:_0x2323b1['model'];if(_0x364efe[_0xd932('0x2b')]['includeAll']){_0x9de9a2[_0xd932('0x3a')]=[{'all':!![]}];}_0x9de9a2=_[_0xd932('0x36')]({},_0x9de9a2,_0x364efe[_0xd932('0x39')]);return db[_0xd932('0x26')][_0xd932('0x3f')](_0x9de9a2)[_0xd932('0x20')](handleEntityNotFound(_0x2b2e3b,null))[_0xd932('0x20')](respondWithResult(_0x2b2e3b,null))['catch'](handleError(_0x2b2e3b,null));};exports['create']=function(_0x3388ff,_0x5d6814){return db[_0xd932('0x26')][_0xd932('0x40')](_0x3388ff[_0xd932('0x41')],{})[_0xd932('0x20')](respondWithResult(_0x5d6814,0xc9))[_0xd932('0x42')](handleError(_0x5d6814,null));};exports[_0xd932('0x43')]=function(_0x438b17,_0x44bd3f){if(_0x438b17['body']['id']){delete _0x438b17[_0xd932('0x41')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x438b17[_0xd932('0x3d')]['id']}})[_0xd932('0x20')](handleEntityNotFound(_0x44bd3f,null))['then'](saveUpdates(_0x438b17[_0xd932('0x41')],null))['then'](respondWithResult(_0x44bd3f,null))[_0xd932('0x42')](handleError(_0x44bd3f,null));};exports[_0xd932('0x21')]=function(_0x2347a5,_0x1fa982){return db[_0xd932('0x26')][_0xd932('0x3f')]({'where':{'id':_0x2347a5['params']['id']}})[_0xd932('0x20')](handleEntityNotFound(_0x1fa982,null))[_0xd932('0x20')](removeEntity(_0x1fa982,null))['catch'](handleError(_0x1fa982,null));};exports[_0xd932('0x44')]=function(_0x455213,_0x4fc5bc){return db[_0xd932('0x26')][_0xd932('0x44')]()['then'](respondWithResult(_0x4fc5bc,null))[_0xd932('0x42')](handleError(_0x4fc5bc,null));};exports[_0xd932('0x45')]=function(_0x2f0af0,_0x4e79aa){var _0x33b570={},_0x3c79eb={},_0x5d630d={'count':0x0,'rows':[]};_0x3c79eb[_0xd932('0x2a')]=_['keys'](db[_0xd932('0x26')]['rawAttributes']);_0x3c79eb[_0xd932('0x2b')]=_[_0xd932('0x2c')](_0x2f0af0[_0xd932('0x2b')]);_0x3c79eb[_0xd932('0x33')]=_[_0xd932('0x2e')](_0x3c79eb[_0xd932('0x2a')],_0x3c79eb[_0xd932('0x2b')]);_0x33b570[_0xd932('0x2d')]=_['intersection'](_0x3c79eb[_0xd932('0x2a')],qs['fields'](_0x2f0af0[_0xd932('0x2b')]['fields']));_0x33b570[_0xd932('0x2d')]=_0x33b570[_0xd932('0x2d')]['length']?_0x33b570['attributes']:_0x3c79eb[_0xd932('0x2a')];if(!_0x2f0af0[_0xd932('0x2b')][_0xd932('0x46')](_0xd932('0x30'))){_0x33b570[_0xd932('0x1c')]=qs[_0xd932('0x1c')](_0x2f0af0[_0xd932('0x2b')][_0xd932('0x1c')]);_0x33b570[_0xd932('0x1e')]=qs[_0xd932('0x1e')](_0x2f0af0[_0xd932('0x2b')][_0xd932('0x1e')]);}_0x33b570[_0xd932('0x47')]=qs['sort'](_0x2f0af0[_0xd932('0x2b')][_0xd932('0x31')]);_0x33b570['where']=qs[_0xd932('0x33')](_[_0xd932('0x32')](_0x2f0af0[_0xd932('0x2b')],_0x3c79eb[_0xd932('0x33')]));if(_0x2f0af0[_0xd932('0x2b')]['filter']){_0x33b570[_0xd932('0x35')]=_[_0xd932('0x36')](_0x33b570[_0xd932('0x35')],{'$or':_[_0xd932('0x25')](_0x33b570[_0xd932('0x2d')],function(_0x9a6171){var _0x3cd224={};_0x3cd224[_0x9a6171]={'$like':'%'+_0x2f0af0[_0xd932('0x2b')][_0xd932('0x34')]+'%'};return _0x3cd224;})});}_0x33b570=_[_0xd932('0x36')]({},_0x33b570,_0x2f0af0[_0xd932('0x39')]);var _0x58632e={'where':_0x33b570['where']};return db[_0xd932('0x26')][_0xd932('0x1d')](_0x58632e)[_0xd932('0x20')](function(_0x3c5fb3){_0x5d630d['count']=_0x3c5fb3;if(_0x2f0af0[_0xd932('0x2b')][_0xd932('0x48')]){_0x33b570['include']=[{'all':!![]}];}return db[_0xd932('0x26')][_0xd932('0x3b')](_0x33b570);})['then'](function(_0x1efcde){_0x5d630d[_0xd932('0x3c')]=_0x1efcde;return _0x5d630d;})['then'](respondWithFilteredResult(_0x4e79aa,_0x33b570,'getVoiceQueuesReport'))[_0xd932('0x42')](handleError(_0x4e79aa,null,_0xd932('0x45')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e040582..11d9a05 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 _0x8efe=['update','remove','emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8efe,0x1e2));var _0xe8ef=function(_0x5b0c71,_0x5e8546){_0x5b0c71=_0x5b0c71-0x0;var _0x1409e7=_0x8efe[_0x5b0c71];return _0x1409e7;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xe8ef('0x0'))['db'][_0xe8ef('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe8ef('0x2')](0x0);var events={'afterCreate':_0xe8ef('0x3'),'afterUpdate':_0xe8ef('0x4'),'afterDestroy':_0xe8ef('0x5')};function emitEvent(_0x34b61f){return function(_0x5dbfcf,_0x44c0d2,_0x4c376b){VoiceQueueReportEvents[_0xe8ef('0x6')](_0x34b61f+':'+_0x5dbfcf['id'],_0x5dbfcf);VoiceQueueReportEvents[_0xe8ef('0x6')](_0x34b61f,_0x5dbfcf);_0x4c376b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xe8ef('0x7')](e,emitEvent(event));}}module[_0xe8ef('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa50e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa50e,0x114));var _0xea50=function(_0x495b13,_0x552f7f){_0x495b13=_0x495b13-0x0;var _0xaabe33=_0xa50e[_0x495b13];return _0xaabe33;};'use strict';var EventEmitter=require(_0xea50('0x0'));var VoiceQueueReport=require(_0xea50('0x1'))['db'][_0xea50('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xea50('0x3')};function emitEvent(_0x4086d4){return function(_0x3d7aaf,_0x7df20c,_0x5124af){VoiceQueueReportEvents['emit'](_0x4086d4+':'+_0x3d7aaf['id'],_0x3d7aaf);VoiceQueueReportEvents[_0xea50('0x4')](_0x4086d4,_0x3d7aaf);_0x5124af(null);};}for(var e in events){if(events[_0xea50('0x5')](e)){var event=events[e];VoiceQueueReport[_0xea50('0x6')](e,emitEvent(event));}}module[_0xea50('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 2053053..cd7137a 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 _0x9135=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x30be8a,_0x47227d){var _0x464690=function(_0x384419){while(--_0x384419){_0x30be8a['push'](_0x30be8a['shift']());}};_0x464690(++_0x47227d);}(_0x9135,0xd9));var _0x5913=function(_0x6f2bc7,_0x1fc01b){_0x6f2bc7=_0x6f2bc7-0x0;var _0x2b3282=_0x9135[_0x6f2bc7];return _0x2b3282;};'use strict';var _=require('lodash');var util=require(_0x5913('0x0'));var logger=require(_0x5913('0x1'))(_0x5913('0x2'));var moment=require(_0x5913('0x3'));var BPromise=require('bluebird');var rp=require(_0x5913('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5913('0x5'));var config=require(_0x5913('0x6'));var attributes=require(_0x5913('0x7'));module[_0x5913('0x8')]=function(_0xc76c0a,_0x1bb71a){return _0xc76c0a[_0x5913('0x9')](_0x5913('0xa'),attributes,{'tableName':_0x5913('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5913('0xc')]},{'fields':[_0x5913('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bf2=['request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment'];(function(_0x5c9f5d,_0x283367){var _0x33be48=function(_0x314c1d){while(--_0x314c1d){_0x5c9f5d['push'](_0x5c9f5d['shift']());}};_0x33be48(++_0x283367);}(_0x6bf2,0x1e6));var _0x26bf=function(_0x4a176c,_0x373ec1){_0x4a176c=_0x4a176c-0x0;var _0x27ab25=_0x6bf2[_0x4a176c];return _0x27ab25;};'use strict';var _=require(_0x26bf('0x0'));var util=require('util');var logger=require(_0x26bf('0x1'))(_0x26bf('0x2'));var moment=require(_0x26bf('0x3'));var BPromise=require('bluebird');var rp=require(_0x26bf('0x4'));var fs=require('fs');var path=require(_0x26bf('0x5'));var rimraf=require(_0x26bf('0x6'));var config=require(_0x26bf('0x7'));var attributes=require(_0x26bf('0x8'));module[_0x26bf('0x9')]=function(_0x4b3d06,_0x1f792d){return _0x4b3d06[_0x26bf('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x26bf('0xb'),'paranoid':![],'indexes':[{'fields':[_0x26bf('0xc')]},{'fields':[_0x26bf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1364073..d9394bd 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 _0x74fe=['../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','where','lodash','util','moment','randomstring'];(function(_0x5b33ad,_0x2a7d55){var _0x16ec00=function(_0x1caf48){while(--_0x1caf48){_0x5b33ad['push'](_0x5b33ad['shift']());}};_0x16ec00(++_0x2a7d55);}(_0x74fe,0x71));var _0xe74f=function(_0x51bd9b,_0x3e5b1d){_0x51bd9b=_0x51bd9b-0x0;var _0x26ea7e=_0x74fe[_0x51bd9b];return _0x26ea7e;};'use strict';var _=require(_0xe74f('0x0'));var util=require(_0xe74f('0x1'));var moment=require(_0xe74f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe74f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe74f('0x4'))['db'];var utils=require(_0xe74f('0x5'));var logger=require('../../config/logger')(_0xe74f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe74f('0x7')][_0xe74f('0x8')]({'port':0x232a});config[_0xe74f('0x9')]=_['defaults'](config[_0xe74f('0x9')],{'host':_0xe74f('0xa'),'port':0x18eb});var socket=require(_0xe74f('0xb'))(new Redis(config['redis']));require(_0xe74f('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b8057,_0x4f63a8,_0x3bde46){return new BPromise(function(_0x262da1,_0x23fdd1){return client['request'](_0x5b8057,_0x3bde46)[_0xe74f('0xd')](function(_0x4ed058){logger[_0xe74f('0xe')](_0xe74f('0xf'),_0x4f63a8,_0xe74f('0x10'));logger[_0xe74f('0x11')](_0xe74f('0x12'),_0x4f63a8,_0xe74f('0x10'),JSON[_0xe74f('0x13')](_0x4ed058));if(_0x4ed058[_0xe74f('0x14')]){if(_0x4ed058['error'][_0xe74f('0x15')]===0x1f4){logger[_0xe74f('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4f63a8,_0x4ed058['error'][_0xe74f('0x16')]);return _0x23fdd1(_0x4ed058['error'][_0xe74f('0x16')]);}logger['error'](_0xe74f('0xf'),_0x4f63a8,_0x4ed058[_0xe74f('0x14')][_0xe74f('0x16')]);return _0x262da1(_0x4ed058[_0xe74f('0x14')][_0xe74f('0x16')]);}else{logger['info'](_0xe74f('0xf'),_0x4f63a8,_0xe74f('0x10'));_0x262da1(_0x4ed058[_0xe74f('0x17')][_0xe74f('0x16')]);}})[_0xe74f('0x18')](function(_0x5976ad){logger['error'](_0xe74f('0xf'),_0x4f63a8,_0x5976ad);_0x23fdd1(_0x5976ad);});});}exports[_0xe74f('0x19')]=function(_0xf8ce31){var _0x270d45=this;return new Promise(function(_0x5a341a,_0x3a4cf6){return db[_0xe74f('0x1a')][_0xe74f('0x1b')]({'raw':_0xf8ce31[_0xe74f('0x1c')]?_0xf8ce31[_0xe74f('0x1c')][_0xe74f('0x1d')]===undefined?!![]:![]:!![],'where':_0xf8ce31[_0xe74f('0x1c')]?_0xf8ce31[_0xe74f('0x1c')]['where']||null:null,'attributes':_0xf8ce31[_0xe74f('0x1c')]?_0xf8ce31[_0xe74f('0x1c')][_0xe74f('0x1e')]||null:null,'limit':_0xf8ce31['options']?_0xf8ce31[_0xe74f('0x1c')][_0xe74f('0x1f')]||null:null,'include':_0xf8ce31[_0xe74f('0x1c')]?_0xf8ce31[_0xe74f('0x1c')][_0xe74f('0x20')]?_[_0xe74f('0x21')](_0xf8ce31[_0xe74f('0x1c')][_0xe74f('0x20')],function(_0x47c1df){return{'model':db[_0x47c1df[_0xe74f('0x22')]],'as':_0x47c1df['as'],'attributes':_0x47c1df[_0xe74f('0x1e')],'include':_0x47c1df[_0xe74f('0x20')]?_['map'](_0x47c1df[_0xe74f('0x20')],function(_0x5649e4){return{'model':db[_0x5649e4[_0xe74f('0x22')]],'as':_0x5649e4['as'],'attributes':_0x5649e4[_0xe74f('0x1e')],'include':_0x5649e4[_0xe74f('0x20')]?_[_0xe74f('0x21')](_0x5649e4[_0xe74f('0x20')],function(_0x3f49b4){return{'model':db[_0x3f49b4[_0xe74f('0x22')]],'as':_0x3f49b4['as'],'attributes':_0x3f49b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe74f('0xd')](function(_0x4ed699){logger['info'](_0xe74f('0x19'),_0xf8ce31);logger[_0xe74f('0x11')](_0xe74f('0x19'),_0xf8ce31,JSON['stringify'](_0x4ed699));_0x5a341a(_0x4ed699);})[_0xe74f('0x18')](function(_0x5744b7){logger['error']('GetVoiceQueueReport',_0x5744b7['message'],_0xf8ce31);_0x3a4cf6(_0x270d45['error'](0x1f4,_0x5744b7[_0xe74f('0x16')]));});});};exports[_0xe74f('0x23')]=function(_0xf8e73b){var _0x3b0526=this;return new Promise(function(_0x595a67,_0x5c7af8){return db[_0xe74f('0x1a')]['create'](_0xf8e73b[_0xe74f('0x24')],{'raw':_0xf8e73b[_0xe74f('0x1c')]?_0xf8e73b['options']['raw']===undefined?!![]:![]:!![]})[_0xe74f('0xd')](function(_0x17a976){logger[_0xe74f('0xe')](_0xe74f('0x23'),_0xf8e73b);logger[_0xe74f('0x11')](_0xe74f('0x23'),_0xf8e73b,JSON[_0xe74f('0x13')](_0x17a976));_0x595a67(_0x17a976);})[_0xe74f('0x18')](function(_0x187092){logger[_0xe74f('0x14')](_0xe74f('0x23'),_0x187092[_0xe74f('0x16')],_0xf8e73b);_0x5c7af8(_0x3b0526[_0xe74f('0x14')](0x1f4,_0x187092[_0xe74f('0x16')]));});});};exports[_0xe74f('0x25')]=function(_0x8a526d){var _0x4f4dfd=this;return new Promise(function(_0x1b771c,_0x303caa){return db[_0xe74f('0x1a')]['update'](_0x8a526d['body'],{'raw':_0x8a526d[_0xe74f('0x1c')]?_0x8a526d[_0xe74f('0x1c')][_0xe74f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a526d[_0xe74f('0x1c')]?_0x8a526d['options'][_0xe74f('0x26')]||null:null,'attributes':_0x8a526d[_0xe74f('0x1c')]?_0x8a526d['options'][_0xe74f('0x1e')]||null:null,'limit':_0x8a526d[_0xe74f('0x1c')]?_0x8a526d['options'][_0xe74f('0x1f')]||null:null})['then'](function(_0x42bd5f){logger[_0xe74f('0xe')](_0xe74f('0x25'),_0x8a526d);logger[_0xe74f('0x11')]('UpdateVoiceQueueReport',_0x8a526d,JSON[_0xe74f('0x13')](_0x42bd5f));_0x1b771c(_0x42bd5f);})[_0xe74f('0x18')](function(_0x52e369){logger[_0xe74f('0x14')](_0xe74f('0x25'),_0x52e369[_0xe74f('0x16')],_0x8a526d);_0x303caa(_0x4f4dfd[_0xe74f('0x14')](0x1f4,_0x52e369[_0xe74f('0x16')]));});});}; \ No newline at end of file +var _0x9c34=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','stringify','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','where','UpdateVoiceQueueReport','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9c34,0xb0));var _0x49c3=function(_0x4595fd,_0x4aa9b2){_0x4595fd=_0x4595fd-0x0;var _0x1d41fe=_0x9c34[_0x4595fd];return _0x1d41fe;};'use strict';var _=require('lodash');var util=require(_0x49c3('0x0'));var moment=require('moment');var BPromise=require(_0x49c3('0x1'));var rs=require(_0x49c3('0x2'));var fs=require('fs');var Redis=require(_0x49c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x49c3('0x4'));var config=require(_0x49c3('0x5'));var jayson=require(_0x49c3('0x6'));var client=jayson['client'][_0x49c3('0x7')]({'port':0x232a});config[_0x49c3('0x8')]=_[_0x49c3('0x9')](config[_0x49c3('0x8')],{'host':_0x49c3('0xa'),'port':0x18eb});var socket=require(_0x49c3('0xb'))(new Redis(config['redis']));require(_0x49c3('0xc'))[_0x49c3('0xd')](socket);function respondWithRpcPromise(_0x566f4d,_0x32a7e5,_0x39760b){return new BPromise(function(_0x5d5bfc,_0x1f6670){return client[_0x49c3('0xe')](_0x566f4d,_0x39760b)[_0x49c3('0xf')](function(_0x49af72){logger[_0x49c3('0x10')](_0x49c3('0x11'),_0x32a7e5,'request\x20sent');logger[_0x49c3('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x32a7e5,'request\x20sent',JSON[_0x49c3('0x13')](_0x49af72));if(_0x49af72[_0x49c3('0x14')]){if(_0x49af72[_0x49c3('0x14')]['code']===0x1f4){logger[_0x49c3('0x14')](_0x49c3('0x11'),_0x32a7e5,_0x49af72[_0x49c3('0x14')]['message']);return _0x1f6670(_0x49af72[_0x49c3('0x14')][_0x49c3('0x15')]);}logger['error'](_0x49c3('0x11'),_0x32a7e5,_0x49af72['error'][_0x49c3('0x15')]);return _0x5d5bfc(_0x49af72[_0x49c3('0x14')][_0x49c3('0x15')]);}else{logger[_0x49c3('0x10')](_0x49c3('0x11'),_0x32a7e5,'request\x20sent');_0x5d5bfc(_0x49af72['result'][_0x49c3('0x15')]);}})[_0x49c3('0x16')](function(_0x1e45fc){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x32a7e5,_0x1e45fc);_0x1f6670(_0x1e45fc);});});}exports[_0x49c3('0x17')]=function(_0xab9b82){var _0x484ddb=this;return new Promise(function(_0x12d2cf,_0x2e851b){return db[_0x49c3('0x18')][_0x49c3('0x19')]({'raw':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1b')]===undefined?!![]:![]:!![],'where':_0xab9b82['options']?_0xab9b82[_0x49c3('0x1a')]['where']||null:null,'attributes':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1c')]||null:null,'limit':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1d')]||null:null,'include':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1e')]?_[_0x49c3('0x1f')](_0xab9b82['options'][_0x49c3('0x1e')],function(_0x2c3de4){return{'model':db[_0x2c3de4[_0x49c3('0x20')]],'as':_0x2c3de4['as'],'attributes':_0x2c3de4[_0x49c3('0x1c')],'include':_0x2c3de4[_0x49c3('0x1e')]?_[_0x49c3('0x1f')](_0x2c3de4['include'],function(_0x1bc27d){return{'model':db[_0x1bc27d[_0x49c3('0x20')]],'as':_0x1bc27d['as'],'attributes':_0x1bc27d[_0x49c3('0x1c')],'include':_0x1bc27d[_0x49c3('0x1e')]?_[_0x49c3('0x1f')](_0x1bc27d[_0x49c3('0x1e')],function(_0x4e1817){return{'model':db[_0x4e1817[_0x49c3('0x20')]],'as':_0x4e1817['as'],'attributes':_0x4e1817[_0x49c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x49c3('0xf')](function(_0xdc088a){logger[_0x49c3('0x10')](_0x49c3('0x17'),_0xab9b82);logger[_0x49c3('0x12')](_0x49c3('0x17'),_0xab9b82,JSON[_0x49c3('0x13')](_0xdc088a));_0x12d2cf(_0xdc088a);})['catch'](function(_0x458c4a){logger[_0x49c3('0x14')](_0x49c3('0x17'),_0x458c4a[_0x49c3('0x15')],_0xab9b82);_0x2e851b(_0x484ddb[_0x49c3('0x14')](0x1f4,_0x458c4a[_0x49c3('0x15')]));});});};exports[_0x49c3('0x21')]=function(_0x21ebfb){var _0x55b0d4=this;return new Promise(function(_0x31d1ee,_0x3f0c3d){return db[_0x49c3('0x18')][_0x49c3('0x22')](_0x21ebfb['body'],{'raw':_0x21ebfb[_0x49c3('0x1a')]?_0x21ebfb[_0x49c3('0x1a')][_0x49c3('0x1b')]===undefined?!![]:![]:!![]})[_0x49c3('0xf')](function(_0x39019e){logger[_0x49c3('0x10')]('CreateVoiceQueueReport',_0x21ebfb);logger['debug'](_0x49c3('0x21'),_0x21ebfb,JSON['stringify'](_0x39019e));_0x31d1ee(_0x39019e);})[_0x49c3('0x16')](function(_0xc81e5e){logger[_0x49c3('0x14')](_0x49c3('0x21'),_0xc81e5e['message'],_0x21ebfb);_0x3f0c3d(_0x55b0d4['error'](0x1f4,_0xc81e5e[_0x49c3('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x53926b){var _0x2557fd=this;return new Promise(function(_0x3e295c,_0x459254){return db[_0x49c3('0x18')]['update'](_0x53926b[_0x49c3('0x23')],{'raw':_0x53926b['options']?_0x53926b['options'][_0x49c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53926b['options']?_0x53926b[_0x49c3('0x1a')][_0x49c3('0x24')]||null:null,'attributes':_0x53926b['options']?_0x53926b['options']['attributes']||null:null,'limit':_0x53926b[_0x49c3('0x1a')]?_0x53926b[_0x49c3('0x1a')][_0x49c3('0x1d')]||null:null})[_0x49c3('0xf')](function(_0x326c55){logger[_0x49c3('0x10')](_0x49c3('0x25'),_0x53926b);logger[_0x49c3('0x12')]('UpdateVoiceQueueReport',_0x53926b,JSON[_0x49c3('0x13')](_0x326c55));_0x3e295c(_0x326c55);})['catch'](function(_0x54c4de){logger[_0x49c3('0x14')](_0x49c3('0x25'),_0x54c4de[_0x49c3('0x15')],_0x53926b);_0x459254(_0x2557fd[_0x49c3('0x14')](0x1f4,_0x54c4de[_0x49c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3c33442..13e5603 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 _0xb76d=['voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','removeListener','register','length'];(function(_0x2c7689,_0x5d61d9){var _0x58b15c=function(_0x187afc){while(--_0x187afc){_0x2c7689['push'](_0x2c7689['shift']());}};_0x58b15c(++_0x5d61d9);}(_0xb76d,0x119));var _0xdb76=function(_0x5b2ef9,_0x5baf4d){_0x5b2ef9=_0x5b2ef9-0x0;var _0x326aa4=_0xb76d[_0x5b2ef9];return _0x326aa4;};'use strict';var VoiceQueueReportEvents=require(_0xdb76('0x0'));var events=['save',_0xdb76('0x1'),_0xdb76('0x2')];function createListener(_0x3cd15e,_0x5376b1){return function(_0x2dca57){_0x5376b1[_0xdb76('0x3')](_0x3cd15e,_0x2dca57);};}function removeListener(_0x281c24,_0x371360){return function(){VoiceQueueReportEvents[_0xdb76('0x4')](_0x281c24,_0x371360);};}exports[_0xdb76('0x5')]=function(_0x5d80df){for(var _0xf1a18d=0x0,_0x39c442=events[_0xdb76('0x6')];_0xf1a18d<_0x39c442;_0xf1a18d++){var _0x3d80a0=events[_0xf1a18d];var _0x4e60dc=createListener(_0xdb76('0x7')+_0x3d80a0,_0x5d80df);VoiceQueueReportEvents['on'](_0x3d80a0,_0x4e60dc);}}; \ No newline at end of file +var _0x0ab2=['length','voiceQueueReport:','remove','removeListener'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0ab2,0x92));var _0x20ab=function(_0x546f5c,_0x2fc6f5){_0x546f5c=_0x546f5c-0x0;var _0x1c75d9=_0x0ab2[_0x546f5c];return _0x1c75d9;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x20ab('0x0'),'update'];function createListener(_0x226a0c,_0x1d5bee){return function(_0x4bdd70){_0x1d5bee['emit'](_0x226a0c,_0x4bdd70);};}function removeListener(_0x2aa2b9,_0x58f8d6){return function(){VoiceQueueReportEvents[_0x20ab('0x1')](_0x2aa2b9,_0x58f8d6);};}exports['register']=function(_0x44fdb2){for(var _0x259548=0x0,_0x30e71e=events[_0x20ab('0x2')];_0x259548<_0x30e71e;_0x259548++){var _0xf14695=events[_0x259548];var _0x11d689=createListener(_0x20ab('0x3')+_0xf14695,_0x44fdb2);VoiceQueueReportEvents['on'](_0xf14695,_0x11d689);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 47370a7..7f00bd9 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 _0x893d=['update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x893d,0x180));var _0xd893=function(_0x35aecf,_0xe3784d){_0x35aecf=_0x35aecf-0x0;var _0x2562c8=_0x893d[_0x35aecf];return _0x2562c8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd893('0x0'));var express=require(_0xd893('0x1'));var router=express[_0xd893('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd893('0x3'));var interaction=require(_0xd893('0x4'));var config=require(_0xd893('0x5'));var controller=require(_0xd893('0x6'));router[_0xd893('0x7')]('/',auth[_0xd893('0x8')](),controller[_0xd893('0x9')]);router[_0xd893('0x7')](_0xd893('0xa'),auth['isAuthenticated'](),controller[_0xd893('0xb')]);router[_0xd893('0xc')]('/',auth[_0xd893('0x8')](),controller[_0xd893('0xd')]);router[_0xd893('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd893('0xf')]);router[_0xd893('0x10')](_0xd893('0xa'),auth[_0xd893('0x8')](),controller[_0xd893('0x11')]);module[_0xd893('0x12')]=router; \ No newline at end of file +var _0xbae2=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x3e4667,_0x159f55){var _0x89df4e=function(_0x49fdf8){while(--_0x49fdf8){_0x3e4667['push'](_0x3e4667['shift']());}};_0x89df4e(++_0x159f55);}(_0xbae2,0x1da));var _0x2bae=function(_0x1bbc72,_0x103c1c){_0x1bbc72=_0x1bbc72-0x0;var _0x275b7a=_0xbae2[_0x1bbc72];return _0x275b7a;};'use strict';var multer=require('multer');var util=require(_0x2bae('0x0'));var path=require(_0x2bae('0x1'));var timeout=require(_0x2bae('0x2'));var express=require(_0x2bae('0x3'));var router=express['Router']();var fs_extra=require(_0x2bae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2bae('0x5'));var config=require(_0x2bae('0x6'));var controller=require(_0x2bae('0x7'));router[_0x2bae('0x8')]('/',auth[_0x2bae('0x9')](),controller['index']);router[_0x2bae('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2bae('0x9')](),controller[_0x2bae('0xa')]);router['put'](_0x2bae('0xb'),auth[_0x2bae('0x9')](),controller[_0x2bae('0xc')]);router[_0x2bae('0xd')](_0x2bae('0xb'),auth[_0x2bae('0x9')](),controller[_0x2bae('0xe')]);module[_0x2bae('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 40ea9c8..ea51957 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 _0x8735=['DATE','literal','sequelize','moment','exports','STRING'];(function(_0x485aa4,_0x4d0a37){var _0xed6d9b=function(_0x4674c9){while(--_0x4674c9){_0x485aa4['push'](_0x485aa4['shift']());}};_0xed6d9b(++_0x4d0a37);}(_0x8735,0x68));var _0x5873=function(_0x4e4115,_0x6a7a77){_0x4e4115=_0x4e4115-0x0;var _0x1d5329=_0x8735[_0x4e4115];return _0x1d5329;};'use strict';var Sequelize=require(_0x5873('0x0'));var moment=require(_0x5873('0x1'));module[_0x5873('0x2')]={'time':{'type':Sequelize[_0x5873('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5873('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5873('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5873('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5873('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5873('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5873('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5873('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x1986=['sequelize','moment','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x5abb9c,_0x32f2eb){var _0x33916e=function(_0x1f45ef){while(--_0x1f45ef){_0x5abb9c['push'](_0x5abb9c['shift']());}};_0x33916e(++_0x32f2eb);}(_0x1986,0x177));var _0x6198=function(_0x308404,_0x5dbabc){_0x308404=_0x308404-0x0;var _0x183539=_0x1986[_0x308404];return _0x183539;};'use strict';var Sequelize=require(_0x6198('0x0'));var moment=require(_0x6198('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x6198('0x3')](_0x6198('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a72b60c..4353556 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 _0x65ae=['count','offset','Content-Range','apply','reject','update','then','destroy','end','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','map','type','options','VoiceQueuesLog','include','findAll','catch','show','params','keys','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','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x22f58e,_0x2472de){var _0x470549=function(_0x5c8115){while(--_0x5c8115){_0x22f58e['push'](_0x22f58e['shift']());}};_0x470549(++_0x2472de);}(_0x65ae,0x149));var _0xe65a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65ae[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe65a('0x0'));var rimraf=require(_0xe65a('0x1'));var zipdir=require(_0xe65a('0x2'));var jsonpatch=require(_0xe65a('0x3'));var rp=require(_0xe65a('0x4'));var moment=require(_0xe65a('0x5'));var BPromise=require(_0xe65a('0x6'));var Mustache=require(_0xe65a('0x7'));var util=require(_0xe65a('0x8'));var path=require(_0xe65a('0x9'));var sox=require('sox');var csv=require(_0xe65a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe65a('0xb'));var _=require(_0xe65a('0xc'));var squel=require(_0xe65a('0xd'));var crypto=require(_0xe65a('0xe'));var jsforce=require(_0xe65a('0xf'));var deskjs=require(_0xe65a('0x10'));var toCsv=require(_0xe65a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe65a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe65a('0x12'));var as=require(_0xe65a('0x13'));var hardwareService=require(_0xe65a('0x14'));var logger=require(_0xe65a('0x15'))(_0xe65a('0x16'));var utils=require(_0xe65a('0x17'));var config=require(_0xe65a('0x18'));var licenseUtil=require(_0xe65a('0x19'));var db=require(_0xe65a('0x1a'))['db'];function respondWithStatusCode(_0x31ac23,_0x26a501){_0x26a501=_0x26a501||0xcc;return function(_0x3574d8){if(_0x3574d8){return _0x31ac23[_0xe65a('0x1b')](_0x26a501);}return _0x31ac23[_0xe65a('0x1c')](_0x26a501)['end']();};}function respondWithResult(_0x1b0dd5,_0x3ebdbb){_0x3ebdbb=_0x3ebdbb||0xc8;return function(_0x326cd8){if(_0x326cd8){return _0x1b0dd5[_0xe65a('0x1c')](_0x3ebdbb)['json'](_0x326cd8);}};}function respondWithFilteredResult(_0x4181b,_0x5910e0){return function(_0x1922e7){if(_0x1922e7){var _0x54664d=typeof _0x5910e0['offset']===_0xe65a('0x1d')&&typeof _0x5910e0[_0xe65a('0x1e')]===_0xe65a('0x1d');var _0x856325=_0x1922e7[_0xe65a('0x1f')];var _0x33d3d7=_0x54664d?0x0:_0x5910e0[_0xe65a('0x20')];var _0x5858fb=_0x54664d?_0x1922e7['count']:_0x5910e0[_0xe65a('0x20')]+_0x5910e0[_0xe65a('0x1e')];var _0x59b6e4;if(_0x5858fb>=_0x856325){_0x5858fb=_0x856325;_0x59b6e4=0xc8;}else{_0x59b6e4=0xce;}_0x4181b[_0xe65a('0x1c')](_0x59b6e4);return _0x4181b['set'](_0xe65a('0x21'),_0x33d3d7+'-'+_0x5858fb+'/'+_0x856325)['json'](_0x1922e7);}return null;};}function patchUpdates(_0x4cafa1){return function(_0x49ff40){try{jsonpatch[_0xe65a('0x22')](_0x49ff40,_0x4cafa1,!![]);}catch(_0x1165fc){return BPromise[_0xe65a('0x23')](_0x1165fc);}return _0x49ff40['save']();};}function saveUpdates(_0x4df8d7,_0x4e7691){return function(_0x3cca86){if(_0x3cca86){return _0x3cca86[_0xe65a('0x24')](_0x4df8d7)[_0xe65a('0x25')](function(_0x40144e){return _0x40144e;});}return null;};}function removeEntity(_0x5b4b2e,_0x5905da){return function(_0x4384b0){if(_0x4384b0){return _0x4384b0[_0xe65a('0x26')]()[_0xe65a('0x25')](function(){_0x5b4b2e[_0xe65a('0x1c')](0xcc)[_0xe65a('0x27')]();});}};}function handleEntityNotFound(_0x5c43ba,_0x5bfaa6){return function(_0x2cce77){if(!_0x2cce77){_0x5c43ba[_0xe65a('0x1b')](0x194);}return _0x2cce77;};}function handleError(_0x3e5a5d,_0x386c57){_0x386c57=_0x386c57||0x1f4;return function(_0x3ad765){logger['error'](_0x3ad765['stack']);if(_0x3ad765[_0xe65a('0x28')]){delete _0x3ad765[_0xe65a('0x28')];}_0x3e5a5d['status'](_0x386c57)[_0xe65a('0x29')](_0x3ad765);};}exports[_0xe65a('0x2a')]=function(_0x4510c9,_0x4225de){var _0x3e3595={},_0x17f8e3={},_0x268b34={'count':0x0,'rows':[]};var _0x1c0fb1=_['map'](db['VoiceQueuesLog'][_0xe65a('0x2b')],function(_0x475d3a){return{'name':_0x475d3a[_0xe65a('0x2c')],'type':_0x475d3a['type'][_0xe65a('0x2d')]};});_0x17f8e3[_0xe65a('0x2e')]=_['map'](_0x1c0fb1,_0xe65a('0x28'));_0x17f8e3[_0xe65a('0x2f')]=_['keys'](_0x4510c9['query']);_0x17f8e3[_0xe65a('0x30')]=_[_0xe65a('0x31')](_0x17f8e3[_0xe65a('0x2e')],_0x17f8e3['query']);_0x3e3595[_0xe65a('0x32')]=_['intersection'](_0x17f8e3[_0xe65a('0x2e')],qs['fields'](_0x4510c9[_0xe65a('0x2f')][_0xe65a('0x33')]));_0x3e3595[_0xe65a('0x32')]=_0x3e3595[_0xe65a('0x32')]['length']?_0x3e3595[_0xe65a('0x32')]:_0x17f8e3['model'];if(!_0x4510c9[_0xe65a('0x2f')]['hasOwnProperty'](_0xe65a('0x34'))){_0x3e3595[_0xe65a('0x1e')]=qs[_0xe65a('0x1e')](_0x4510c9[_0xe65a('0x2f')]['limit']);_0x3e3595[_0xe65a('0x20')]=qs[_0xe65a('0x20')](_0x4510c9[_0xe65a('0x2f')][_0xe65a('0x20')]);}_0x3e3595[_0xe65a('0x35')]=qs[_0xe65a('0x36')](_0x4510c9[_0xe65a('0x2f')][_0xe65a('0x36')]);_0x3e3595['where']=qs[_0xe65a('0x30')](_['pick'](_0x4510c9[_0xe65a('0x2f')],_0x17f8e3[_0xe65a('0x30')]),_0x1c0fb1);if(_0x4510c9['query'][_0xe65a('0x37')]){_0x3e3595[_0xe65a('0x38')]=_[_0xe65a('0x39')](_0x3e3595[_0xe65a('0x38')],{'$or':_[_0xe65a('0x3a')](_0x1c0fb1,function(_0x252716){if(_0x252716[_0xe65a('0x3b')]!=='VIRTUAL'){var _0x2c870a={};_0x2c870a[_0x252716[_0xe65a('0x28')]]={'$like':'%'+_0x4510c9[_0xe65a('0x2f')][_0xe65a('0x37')]+'%'};return _0x2c870a;}})});}_0x3e3595=_[_0xe65a('0x39')]({},_0x3e3595,_0x4510c9[_0xe65a('0x3c')]);var _0x1fcf99={'where':_0x3e3595[_0xe65a('0x38')]};return db[_0xe65a('0x3d')]['count'](_0x1fcf99)['then'](function(_0x4ae8cc){_0x268b34[_0xe65a('0x1f')]=_0x4ae8cc;if(_0x4510c9[_0xe65a('0x2f')]['includeAll']){_0x3e3595[_0xe65a('0x3e')]=[{'all':!![]}];}return db[_0xe65a('0x3d')][_0xe65a('0x3f')](_0x3e3595);})[_0xe65a('0x25')](function(_0x28d01a){_0x268b34['rows']=_0x28d01a;return _0x268b34;})[_0xe65a('0x25')](respondWithFilteredResult(_0x4225de,_0x3e3595))[_0xe65a('0x40')](handleError(_0x4225de,null));};exports[_0xe65a('0x41')]=function(_0x1ccf21,_0x5dc30f){var _0x2f290c={'raw':!![],'where':{'id':_0x1ccf21[_0xe65a('0x42')]['id']}},_0x43ea4d={};_0x43ea4d[_0xe65a('0x2e')]=_[_0xe65a('0x43')](db[_0xe65a('0x3d')][_0xe65a('0x2b')]);_0x43ea4d[_0xe65a('0x2f')]=_[_0xe65a('0x43')](_0x1ccf21[_0xe65a('0x2f')]);_0x43ea4d[_0xe65a('0x30')]=_['intersection'](_0x43ea4d[_0xe65a('0x2e')],_0x43ea4d[_0xe65a('0x2f')]);_0x2f290c[_0xe65a('0x32')]=_[_0xe65a('0x31')](_0x43ea4d[_0xe65a('0x2e')],qs[_0xe65a('0x33')](_0x1ccf21[_0xe65a('0x2f')]['fields']));_0x2f290c[_0xe65a('0x32')]=_0x2f290c[_0xe65a('0x32')]['length']?_0x2f290c[_0xe65a('0x32')]:_0x43ea4d[_0xe65a('0x2e')];if(_0x1ccf21[_0xe65a('0x2f')][_0xe65a('0x44')]){_0x2f290c[_0xe65a('0x3e')]=[{'all':!![]}];}_0x2f290c=_[_0xe65a('0x39')]({},_0x2f290c,_0x1ccf21['options']);return db[_0xe65a('0x3d')][_0xe65a('0x45')](_0x2f290c)[_0xe65a('0x25')](handleEntityNotFound(_0x5dc30f,null))[_0xe65a('0x25')](respondWithResult(_0x5dc30f,null))['catch'](handleError(_0x5dc30f,null));};exports['create']=function(_0x3605f,_0x38c54a){return db[_0xe65a('0x3d')][_0xe65a('0x46')](_0x3605f[_0xe65a('0x47')],{})[_0xe65a('0x25')](respondWithResult(_0x38c54a,0xc9))[_0xe65a('0x40')](handleError(_0x38c54a,null));};exports[_0xe65a('0x24')]=function(_0x5da77a,_0x5c5eb7){if(_0x5da77a[_0xe65a('0x47')]['id']){delete _0x5da77a['body']['id'];}return db[_0xe65a('0x3d')][_0xe65a('0x45')]({'where':{'id':_0x5da77a[_0xe65a('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c5eb7,null))[_0xe65a('0x25')](saveUpdates(_0x5da77a[_0xe65a('0x47')],null))[_0xe65a('0x25')](respondWithResult(_0x5c5eb7,null))[_0xe65a('0x40')](handleError(_0x5c5eb7,null));};exports[_0xe65a('0x26')]=function(_0x4ef7a0,_0xb7f388){return db['VoiceQueuesLog'][_0xe65a('0x45')]({'where':{'id':_0x4ef7a0[_0xe65a('0x42')]['id']}})[_0xe65a('0x25')](handleEntityNotFound(_0xb7f388,null))[_0xe65a('0x25')](removeEntity(_0xb7f388,null))['catch'](handleError(_0xb7f388,null));}; \ No newline at end of file +var _0xc3f4=['../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','VoiceQueuesLog','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','update','find','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc3f4,0x7c));var _0x4c3f=function(_0x379960,_0x5dc1ba){_0x379960=_0x379960-0x0;var _0x23abec=_0xc3f4[_0x379960];return _0x23abec;};'use strict';var emlformat=require(_0x4c3f('0x0'));var rimraf=require(_0x4c3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c3f('0x2'));var moment=require('moment');var BPromise=require(_0x4c3f('0x3'));var Mustache=require(_0x4c3f('0x4'));var util=require('util');var path=require(_0x4c3f('0x5'));var sox=require('sox');var csv=require(_0x4c3f('0x6'));var ejs=require(_0x4c3f('0x7'));var fs=require('fs');var fs_extra=require(_0x4c3f('0x8'));var _=require(_0x4c3f('0x9'));var squel=require('squel');var crypto=require(_0x4c3f('0xa'));var jsforce=require(_0x4c3f('0xb'));var deskjs=require(_0x4c3f('0xc'));var toCsv=require(_0x4c3f('0x6'));var querystring=require(_0x4c3f('0xd'));var Papa=require('papaparse');var Redis=require(_0x4c3f('0xe'));var authService=require(_0x4c3f('0xf'));var qs=require(_0x4c3f('0x10'));var as=require(_0x4c3f('0x11'));var hardwareService=require(_0x4c3f('0x12'));var logger=require('../../config/logger')(_0x4c3f('0x13'));var utils=require('../../config/utils');var config=require(_0x4c3f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38d2b1,_0x2289f1){_0x2289f1=_0x2289f1||0xcc;return function(_0x3becc7){if(_0x3becc7){return _0x38d2b1['sendStatus'](_0x2289f1);}return _0x38d2b1[_0x4c3f('0x15')](_0x2289f1)[_0x4c3f('0x16')]();};}function respondWithResult(_0x5618fd,_0x2da6ff){_0x2da6ff=_0x2da6ff||0xc8;return function(_0x3fc455){if(_0x3fc455){return _0x5618fd[_0x4c3f('0x15')](_0x2da6ff)[_0x4c3f('0x17')](_0x3fc455);}};}function respondWithFilteredResult(_0x5e062f,_0x464a62){return function(_0x42c349){if(_0x42c349){var _0x1e852c=typeof _0x464a62[_0x4c3f('0x18')]===_0x4c3f('0x19')&&typeof _0x464a62[_0x4c3f('0x1a')]===_0x4c3f('0x19');var _0x5e8b43=_0x42c349[_0x4c3f('0x1b')];var _0x4a0ae4=_0x1e852c?0x0:_0x464a62['offset'];var _0xdd89a1=_0x1e852c?_0x42c349[_0x4c3f('0x1b')]:_0x464a62['offset']+_0x464a62['limit'];var _0x34913a;if(_0xdd89a1>=_0x5e8b43){_0xdd89a1=_0x5e8b43;_0x34913a=0xc8;}else{_0x34913a=0xce;}_0x5e062f[_0x4c3f('0x15')](_0x34913a);return _0x5e062f[_0x4c3f('0x1c')](_0x4c3f('0x1d'),_0x4a0ae4+'-'+_0xdd89a1+'/'+_0x5e8b43)['json'](_0x42c349);}return null;};}function patchUpdates(_0x3024b1){return function(_0x2db1bf){try{jsonpatch[_0x4c3f('0x1e')](_0x2db1bf,_0x3024b1,!![]);}catch(_0x2de669){return BPromise[_0x4c3f('0x1f')](_0x2de669);}return _0x2db1bf[_0x4c3f('0x20')]();};}function saveUpdates(_0x44970c,_0x2d2da5){return function(_0x4570db){if(_0x4570db){return _0x4570db['update'](_0x44970c)[_0x4c3f('0x21')](function(_0xd6f406){return _0xd6f406;});}return null;};}function removeEntity(_0x5d3a34,_0x28c6c4){return function(_0x51939e){if(_0x51939e){return _0x51939e[_0x4c3f('0x22')]()[_0x4c3f('0x21')](function(){_0x5d3a34[_0x4c3f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491f2c,_0x28ae59){return function(_0x5f49b9){if(!_0x5f49b9){_0x491f2c[_0x4c3f('0x23')](0x194);}return _0x5f49b9;};}function handleError(_0x39d36d,_0x1a6d5e){_0x1a6d5e=_0x1a6d5e||0x1f4;return function(_0x510c69){logger['error'](_0x510c69[_0x4c3f('0x24')]);if(_0x510c69[_0x4c3f('0x25')]){delete _0x510c69[_0x4c3f('0x25')];}_0x39d36d[_0x4c3f('0x15')](_0x1a6d5e)[_0x4c3f('0x26')](_0x510c69);};}exports[_0x4c3f('0x27')]=function(_0x4dcad6,_0x5ae9f){var _0x3a8b3d={},_0x419ce0={},_0x438fbb={'count':0x0,'rows':[]};var _0x2f9ef1=_[_0x4c3f('0x28')](db[_0x4c3f('0x29')]['rawAttributes'],function(_0x2ac87b){return{'name':_0x2ac87b['fieldName'],'type':_0x2ac87b['type'][_0x4c3f('0x2a')]};});_0x419ce0['model']=_[_0x4c3f('0x28')](_0x2f9ef1,_0x4c3f('0x25'));_0x419ce0[_0x4c3f('0x2b')]=_[_0x4c3f('0x2c')](_0x4dcad6['query']);_0x419ce0['filters']=_[_0x4c3f('0x2d')](_0x419ce0[_0x4c3f('0x2e')],_0x419ce0[_0x4c3f('0x2b')]);_0x3a8b3d[_0x4c3f('0x2f')]=_[_0x4c3f('0x2d')](_0x419ce0[_0x4c3f('0x2e')],qs[_0x4c3f('0x30')](_0x4dcad6['query']['fields']));_0x3a8b3d[_0x4c3f('0x2f')]=_0x3a8b3d[_0x4c3f('0x2f')][_0x4c3f('0x31')]?_0x3a8b3d[_0x4c3f('0x2f')]:_0x419ce0[_0x4c3f('0x2e')];if(!_0x4dcad6['query'][_0x4c3f('0x32')](_0x4c3f('0x33'))){_0x3a8b3d[_0x4c3f('0x1a')]=qs[_0x4c3f('0x1a')](_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x1a')]);_0x3a8b3d[_0x4c3f('0x18')]=qs[_0x4c3f('0x18')](_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x18')]);}_0x3a8b3d[_0x4c3f('0x34')]=qs['sort'](_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x35')]);_0x3a8b3d[_0x4c3f('0x36')]=qs['filters'](_[_0x4c3f('0x37')](_0x4dcad6[_0x4c3f('0x2b')],_0x419ce0[_0x4c3f('0x38')]),_0x2f9ef1);if(_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x39')]){_0x3a8b3d[_0x4c3f('0x36')]=_[_0x4c3f('0x3a')](_0x3a8b3d[_0x4c3f('0x36')],{'$or':_[_0x4c3f('0x28')](_0x2f9ef1,function(_0xa26e96){if(_0xa26e96[_0x4c3f('0x3b')]!==_0x4c3f('0x3c')){var _0x1c1261={};_0x1c1261[_0xa26e96[_0x4c3f('0x25')]]={'$like':'%'+_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x39')]+'%'};return _0x1c1261;}})});}_0x3a8b3d=_[_0x4c3f('0x3a')]({},_0x3a8b3d,_0x4dcad6[_0x4c3f('0x3d')]);var _0x120d08={'where':_0x3a8b3d[_0x4c3f('0x36')]};return db[_0x4c3f('0x29')][_0x4c3f('0x1b')](_0x120d08)[_0x4c3f('0x21')](function(_0x43a09e){_0x438fbb[_0x4c3f('0x1b')]=_0x43a09e;if(_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x3e')]){_0x3a8b3d[_0x4c3f('0x3f')]=[{'all':!![]}];}return db[_0x4c3f('0x29')][_0x4c3f('0x40')](_0x3a8b3d);})[_0x4c3f('0x21')](function(_0x25e1d5){_0x438fbb['rows']=_0x25e1d5;return _0x438fbb;})['then'](respondWithFilteredResult(_0x5ae9f,_0x3a8b3d))[_0x4c3f('0x41')](handleError(_0x5ae9f,null));};exports[_0x4c3f('0x42')]=function(_0x45b249,_0x30c100){var _0x485561={'raw':!![],'where':{'id':_0x45b249[_0x4c3f('0x43')]['id']}},_0x19aa62={};_0x19aa62[_0x4c3f('0x2e')]=_[_0x4c3f('0x2c')](db['VoiceQueuesLog']['rawAttributes']);_0x19aa62[_0x4c3f('0x2b')]=_[_0x4c3f('0x2c')](_0x45b249['query']);_0x19aa62[_0x4c3f('0x38')]=_['intersection'](_0x19aa62[_0x4c3f('0x2e')],_0x19aa62[_0x4c3f('0x2b')]);_0x485561[_0x4c3f('0x2f')]=_[_0x4c3f('0x2d')](_0x19aa62[_0x4c3f('0x2e')],qs[_0x4c3f('0x30')](_0x45b249['query'][_0x4c3f('0x30')]));_0x485561[_0x4c3f('0x2f')]=_0x485561['attributes'][_0x4c3f('0x31')]?_0x485561[_0x4c3f('0x2f')]:_0x19aa62[_0x4c3f('0x2e')];if(_0x45b249[_0x4c3f('0x2b')][_0x4c3f('0x3e')]){_0x485561[_0x4c3f('0x3f')]=[{'all':!![]}];}_0x485561=_[_0x4c3f('0x3a')]({},_0x485561,_0x45b249[_0x4c3f('0x3d')]);return db[_0x4c3f('0x29')]['find'](_0x485561)[_0x4c3f('0x21')](handleEntityNotFound(_0x30c100,null))['then'](respondWithResult(_0x30c100,null))[_0x4c3f('0x41')](handleError(_0x30c100,null));};exports[_0x4c3f('0x44')]=function(_0x405a25,_0x2436eb){return db['VoiceQueuesLog']['create'](_0x405a25[_0x4c3f('0x45')],{})[_0x4c3f('0x21')](respondWithResult(_0x2436eb,0xc9))['catch'](handleError(_0x2436eb,null));};exports[_0x4c3f('0x46')]=function(_0x55d1af,_0x36e857){if(_0x55d1af[_0x4c3f('0x45')]['id']){delete _0x55d1af[_0x4c3f('0x45')]['id'];}return db[_0x4c3f('0x29')][_0x4c3f('0x47')]({'where':{'id':_0x55d1af[_0x4c3f('0x43')]['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x36e857,null))[_0x4c3f('0x21')](saveUpdates(_0x55d1af['body'],null))['then'](respondWithResult(_0x36e857,null))[_0x4c3f('0x41')](handleError(_0x36e857,null));};exports[_0x4c3f('0x22')]=function(_0x437a2d,_0x131936){return db[_0x4c3f('0x29')][_0x4c3f('0x47')]({'where':{'id':_0x437a2d[_0x4c3f('0x43')]['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x131936,null))[_0x4c3f('0x21')](removeEntity(_0x131936,null))[_0x4c3f('0x41')](handleError(_0x131936,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 85a1366..6a03b3c 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 _0xba78=['voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','VoiceQueuesLog'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba78,0x159));var _0x8ba7=function(_0x5c29d9,_0x4bdc02){_0x5c29d9=_0x5c29d9-0x0;var _0x5d8955=_0xba78[_0x5c29d9];return _0x5d8955;};'use strict';var _=require(_0x8ba7('0x0'));var util=require('util');var logger=require(_0x8ba7('0x1'))(_0x8ba7('0x2'));var moment=require('moment');var BPromise=require(_0x8ba7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8ba7('0x4'));var config=require(_0x8ba7('0x5'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x26fab5,_0x44c8d9){return _0x26fab5['define'](_0x8ba7('0x6'),attributes,{'tableName':_0x8ba7('0x7'),'paranoid':![],'indexes':[{'name':_0x8ba7('0x8'),'fields':[_0x8ba7('0x9'),_0x8ba7('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xaa2b=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm','util','../../config/logger','api','moment','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaa2b,0x1e7));var _0xbaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbaa2('0x0'));var logger=require(_0xbaa2('0x1'))(_0xbaa2('0x2'));var moment=require(_0xbaa2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaa2('0x4'));var rimraf=require('rimraf');var config=require(_0xbaa2('0x5'));var attributes=require(_0xbaa2('0x6'));module[_0xbaa2('0x7')]=function(_0x455ec7,_0x176d37){return _0x455ec7[_0xbaa2('0x8')](_0xbaa2('0x9'),attributes,{'tableName':_0xbaa2('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xbaa2('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b2e49f2..8431bab 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 _0x0298=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x406011,_0x56c84b){var _0x4a005c=function(_0xd13687){while(--_0xd13687){_0x406011['push'](_0x406011['shift']());}};_0x4a005c(++_0x56c84b);}(_0x0298,0x74));var _0x8029=function(_0x6a0cad,_0x24b832){_0x6a0cad=_0x6a0cad-0x0;var _0x5d2602=_0x0298[_0x6a0cad];return _0x5d2602;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var moment=require('moment');var BPromise=require(_0x8029('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8029('0x3'));var db=require(_0x8029('0x4'))['db'];var utils=require(_0x8029('0x5'));var logger=require(_0x8029('0x6'))(_0x8029('0x7'));var config=require(_0x8029('0x8'));var jayson=require(_0x8029('0x9'));var client=jayson[_0x8029('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd7497e,_0x24ddfa,_0x1ac95a){return new BPromise(function(_0xc61637,_0x29688f){return client[_0x8029('0xb')](_0xd7497e,_0x1ac95a)[_0x8029('0xc')](function(_0x5a0ddc){logger[_0x8029('0xd')](_0x8029('0xe'),_0x24ddfa,_0x8029('0xf'));logger[_0x8029('0x10')](_0x8029('0x11'),_0x24ddfa,_0x8029('0xf'),JSON[_0x8029('0x12')](_0x5a0ddc));if(_0x5a0ddc[_0x8029('0x13')]){if(_0x5a0ddc['error'][_0x8029('0x14')]===0x1f4){logger[_0x8029('0x13')](_0x8029('0xe'),_0x24ddfa,_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);return _0x29688f(_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x24ddfa,_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);return _0xc61637(_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);}else{logger['info'](_0x8029('0xe'),_0x24ddfa,_0x8029('0xf'));_0xc61637(_0x5a0ddc['result'][_0x8029('0x15')]);}})['catch'](function(_0xaa28da){logger[_0x8029('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x24ddfa,_0xaa28da);_0x29688f(_0xaa28da);});});} \ No newline at end of file +var _0xefdd=['http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x21dab8,_0x55c06d){var _0x4daa24=function(_0x280a67){while(--_0x280a67){_0x21dab8['push'](_0x21dab8['shift']());}};_0x4daa24(++_0x55c06d);}(_0xefdd,0x75));var _0xdefd=function(_0x4fd64a,_0x1740f4){_0x4fd64a=_0x4fd64a-0x0;var _0x54525d=_0xefdd[_0x4fd64a];return _0x54525d;};'use strict';var _=require(_0xdefd('0x0'));var util=require(_0xdefd('0x1'));var moment=require('moment');var BPromise=require(_0xdefd('0x2'));var rs=require(_0xdefd('0x3'));var fs=require('fs');var Redis=require(_0xdefd('0x4'));var db=require(_0xdefd('0x5'))['db'];var utils=require(_0xdefd('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdefd('0x7'));var client=jayson[_0xdefd('0x8')][_0xdefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x525fc9,_0x4a32db,_0x1d2823){return new BPromise(function(_0x522843,_0x83c14e){return client[_0xdefd('0xa')](_0x525fc9,_0x1d2823)['then'](function(_0x452a78){logger[_0xdefd('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a32db,_0xdefd('0xc'));logger[_0xdefd('0xd')](_0xdefd('0xe'),_0x4a32db,_0xdefd('0xc'),JSON[_0xdefd('0xf')](_0x452a78));if(_0x452a78[_0xdefd('0x10')]){if(_0x452a78['error']['code']===0x1f4){logger[_0xdefd('0x10')](_0xdefd('0x11'),_0x4a32db,_0x452a78['error'][_0xdefd('0x12')]);return _0x83c14e(_0x452a78['error'][_0xdefd('0x12')]);}logger[_0xdefd('0x10')](_0xdefd('0x11'),_0x4a32db,_0x452a78[_0xdefd('0x10')][_0xdefd('0x12')]);return _0x522843(_0x452a78[_0xdefd('0x10')]['message']);}else{logger[_0xdefd('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a32db,_0xdefd('0xc'));_0x522843(_0x452a78[_0xdefd('0x13')][_0xdefd('0x12')]);}})[_0xdefd('0x14')](function(_0x3dbdff){logger[_0xdefd('0x10')](_0xdefd('0x11'),_0x4a32db,_0x3dbdff);_0x83c14e(_0x3dbdff);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4660f02..adf43ff 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 _0x95dd=['/describe','describe','/:id','show','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index'];(function(_0x61ea7a,_0xda2e1a){var _0x392593=function(_0x1b2415){while(--_0x1b2415){_0x61ea7a['push'](_0x61ea7a['shift']());}};_0x392593(++_0xda2e1a);}(_0x95dd,0xd3));var _0xd95d=function(_0x27bfe0,_0x437ba7){_0x27bfe0=_0x27bfe0-0x0;var _0x5dd160=_0x95dd[_0x27bfe0];return _0x5dd160;};'use strict';var multer=require(_0xd95d('0x0'));var util=require(_0xd95d('0x1'));var path=require(_0xd95d('0x2'));var timeout=require(_0xd95d('0x3'));var express=require(_0xd95d('0x4'));var router=express['Router']();var fs_extra=require(_0xd95d('0x5'));var auth=require(_0xd95d('0x6'));var interaction=require(_0xd95d('0x7'));var config=require(_0xd95d('0x8'));var controller=require(_0xd95d('0x9'));router[_0xd95d('0xa')]('/',auth[_0xd95d('0xb')](),controller[_0xd95d('0xc')]);router[_0xd95d('0xa')](_0xd95d('0xd'),auth[_0xd95d('0xb')](),controller[_0xd95d('0xe')]);router[_0xd95d('0xa')](_0xd95d('0xf'),auth[_0xd95d('0xb')](),controller[_0xd95d('0x10')]);router[_0xd95d('0xa')]('/:id/download',auth[_0xd95d('0xb')](),controller[_0xd95d('0x11')]);router[_0xd95d('0xa')]('/:id/downloads',controller[_0xd95d('0x12')]);router[_0xd95d('0xa')](_0xd95d('0x13'),auth['isAuthenticated'](),controller[_0xd95d('0x14')]);router[_0xd95d('0x15')]('/',auth[_0xd95d('0xb')](),controller[_0xd95d('0x16')]);router[_0xd95d('0x15')](_0xd95d('0x13'),auth[_0xd95d('0xb')](),controller[_0xd95d('0x17')]);router[_0xd95d('0x18')]('/:id',auth[_0xd95d('0xb')](),controller[_0xd95d('0x19')]);router[_0xd95d('0x1a')](_0xd95d('0xf'),auth[_0xd95d('0xb')](),controller['destroy']);module[_0xd95d('0x1b')]=router; \ No newline at end of file +var _0xe6d1=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','runTranscribe','put','delete','destroy','exports','multer'];(function(_0x378192,_0x35c4b2){var _0x1419e5=function(_0x249ce9){while(--_0x249ce9){_0x378192['push'](_0x378192['shift']());}};_0x1419e5(++_0x35c4b2);}(_0xe6d1,0x1c7));var _0x1e6d=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xe6d1[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0x1e6d('0x0'));var util=require('util');var path=require(_0x1e6d('0x1'));var timeout=require(_0x1e6d('0x2'));var express=require('express');var router=express[_0x1e6d('0x3')]();var fs_extra=require(_0x1e6d('0x4'));var auth=require(_0x1e6d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1e6d('0x6'));var controller=require(_0x1e6d('0x7'));router[_0x1e6d('0x8')]('/',auth[_0x1e6d('0x9')](),controller['index']);router[_0x1e6d('0x8')](_0x1e6d('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1e6d('0x8')](_0x1e6d('0xb'),auth[_0x1e6d('0x9')](),controller['show']);router[_0x1e6d('0x8')](_0x1e6d('0xc'),auth['isAuthenticated'](),controller[_0x1e6d('0xd')]);router[_0x1e6d('0x8')](_0x1e6d('0xe'),controller[_0x1e6d('0xf')]);router[_0x1e6d('0x8')]('/:id/transcribe',auth[_0x1e6d('0x9')](),controller[_0x1e6d('0x10')]);router[_0x1e6d('0x11')]('/',auth['isAuthenticated'](),controller[_0x1e6d('0x12')]);router[_0x1e6d('0x11')]('/:id/transcribe',auth[_0x1e6d('0x9')](),controller[_0x1e6d('0x13')]);router[_0x1e6d('0x14')]('/:id',auth[_0x1e6d('0x9')](),controller['update']);router[_0x1e6d('0x15')](_0x1e6d('0xb'),auth['isAuthenticated'](),controller[_0x1e6d('0x16')]);module[_0x1e6d('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a8f2cab..302feef 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 ab35830..bf33a88 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 _0x6754=['IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','VoiceRecording','include','findAll','rows','catch','show','params','keys','create','body','describe','download','../../components/encryptor','uniqueid','find','value','existsSync','decryptFile','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','token','secrets','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','%s.cypher','Sequelize','Voice\x20Recording\x20not\x20found','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','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','NEW'];(function(_0x9b86,_0x4b95c1){var _0x6c4a09=function(_0x4d60d4){while(--_0x4d60d4){_0x9b86['push'](_0x9b86['shift']());}};_0x6c4a09(++_0x4b95c1);}(_0x6754,0x1d7));var _0x4675=function(_0x5356da,_0x2e4df2){_0x5356da=_0x5356da-0x0;var _0xa81bc0=_0x6754[_0x5356da];return _0xa81bc0;};'use strict';var emlformat=require(_0x4675('0x0'));var rimraf=require(_0x4675('0x1'));var zipdir=require(_0x4675('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4675('0x3'));var moment=require(_0x4675('0x4'));var BPromise=require(_0x4675('0x5'));var Mustache=require(_0x4675('0x6'));var util=require(_0x4675('0x7'));var path=require(_0x4675('0x8'));var sox=require(_0x4675('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4675('0xa'));var _=require(_0x4675('0xb'));var squel=require('squel');var crypto=require(_0x4675('0xc'));var jsforce=require(_0x4675('0xd'));var deskjs=require(_0x4675('0xe'));var toCsv=require(_0x4675('0xf'));var querystring=require(_0x4675('0x10'));var Papa=require(_0x4675('0x11'));var AWS=require('aws-sdk');var uuidv4=require(_0x4675('0x12'));var Redis=require(_0x4675('0x13'));var authService=require(_0x4675('0x14'));var qs=require(_0x4675('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4675('0x16'));var logger=require('../../config/logger')(_0x4675('0x17'));var utils=require(_0x4675('0x18'));var config=require(_0x4675('0x19'));var licenseUtil=require(_0x4675('0x1a'));var db=require(_0x4675('0x1b'))['db'];function respondWithStatusCode(_0x53a5be,_0x53ccc9){_0x53ccc9=_0x53ccc9||0xcc;return function(_0x242f9f){if(_0x242f9f){return _0x53a5be[_0x4675('0x1c')](_0x53ccc9);}return _0x53a5be[_0x4675('0x1d')](_0x53ccc9)[_0x4675('0x1e')]();};}function respondWithResult(_0x505541,_0x3a4695){_0x3a4695=_0x3a4695||0xc8;return function(_0x5cad4a){if(_0x5cad4a){return _0x505541[_0x4675('0x1d')](_0x3a4695)['json'](_0x5cad4a);}};}function respondWithFilteredResult(_0x14c8cf,_0x2c5a56){return function(_0x34fc8a){if(_0x34fc8a){var _0x59cbcd=typeof _0x2c5a56[_0x4675('0x1f')]===_0x4675('0x20')&&typeof _0x2c5a56[_0x4675('0x21')]===_0x4675('0x20');var _0x60abdd=_0x34fc8a[_0x4675('0x22')];var _0x4b080e=_0x59cbcd?0x0:_0x2c5a56[_0x4675('0x1f')];var _0x1d7698=_0x59cbcd?_0x34fc8a[_0x4675('0x22')]:_0x2c5a56[_0x4675('0x1f')]+_0x2c5a56[_0x4675('0x21')];var _0x47b150;if(_0x1d7698>=_0x60abdd){_0x1d7698=_0x60abdd;_0x47b150=0xc8;}else{_0x47b150=0xce;}_0x14c8cf[_0x4675('0x1d')](_0x47b150);return _0x14c8cf[_0x4675('0x23')](_0x4675('0x24'),_0x4b080e+'-'+_0x1d7698+'/'+_0x60abdd)[_0x4675('0x25')](_0x34fc8a);}return null;};}function patchUpdates(_0x55f6a1){return function(_0x27abcc){try{jsonpatch[_0x4675('0x26')](_0x27abcc,_0x55f6a1,!![]);}catch(_0xc348e2){return BPromise[_0x4675('0x27')](_0xc348e2);}return _0x27abcc[_0x4675('0x28')]();};}function saveUpdates(_0x3cf55a,_0x1c55c5){return function(_0x5404d0){if(_0x5404d0){return _0x5404d0[_0x4675('0x29')](_0x3cf55a)[_0x4675('0x2a')](function(_0x636b34){return _0x636b34;});}return null;};}function removeEntity(_0x4b4319,_0x47cd2d){return function(_0x1e7a34){if(_0x1e7a34){return _0x1e7a34[_0x4675('0x2b')]()[_0x4675('0x2a')](function(){_0x4b4319[_0x4675('0x1d')](0xcc)[_0x4675('0x1e')]();});}};}function handleEntityNotFound(_0x26c912,_0x4473b8){return function(_0xee4856){if(!_0xee4856){_0x26c912[_0x4675('0x1c')](0x194);}return _0xee4856;};}function handleError(_0x34632e,_0x450bdc){_0x450bdc=_0x450bdc||0x1f4;return function(_0x177605){logger['error'](_0x177605[_0x4675('0x2c')]);if(_0x177605['name']){delete _0x177605['name'];}_0x34632e[_0x4675('0x1d')](_0x450bdc)[_0x4675('0x2d')](_0x177605);};}exports[_0x4675('0x2e')]=function(_0xe1ee7e,_0x18d286){var _0x31e289={},_0xb65466={},_0x5ebda8={'count':0x0,'rows':[]};var _0x52b2d1=_[_0x4675('0x2f')](db['VoiceRecording'][_0x4675('0x30')],function(_0x4251c2){return{'name':_0x4251c2[_0x4675('0x31')],'type':_0x4251c2[_0x4675('0x32')][_0x4675('0x33')]};});_0xb65466[_0x4675('0x34')]=_[_0x4675('0x35')](_[_0x4675('0x2f')](_0x52b2d1,_0x4675('0x36')),[_0x4675('0x37')]);_0xb65466[_0x4675('0x38')]=_['keys'](_0xe1ee7e['query']);_0xb65466[_0x4675('0x39')]=_[_0x4675('0x3a')](_0xb65466['model'],_0xb65466[_0x4675('0x38')]);_0x31e289[_0x4675('0x3b')]=_[_0x4675('0x3a')](_0xb65466[_0x4675('0x34')],qs[_0x4675('0x3c')](_0xe1ee7e['query'][_0x4675('0x3c')]));_0x31e289[_0x4675('0x3b')]=_0x31e289[_0x4675('0x3b')][_0x4675('0x3d')]?_0x31e289[_0x4675('0x3b')]:_0xb65466[_0x4675('0x34')];if(!_0xe1ee7e[_0x4675('0x38')][_0x4675('0x3e')](_0x4675('0x3f'))){_0x31e289[_0x4675('0x21')]=qs[_0x4675('0x21')](_0xe1ee7e[_0x4675('0x38')]['limit']);_0x31e289[_0x4675('0x1f')]=qs['offset'](_0xe1ee7e[_0x4675('0x38')][_0x4675('0x1f')]);}_0x31e289['order']=qs[_0x4675('0x40')](_0xe1ee7e[_0x4675('0x38')][_0x4675('0x40')]);_0x31e289[_0x4675('0x41')]=qs[_0x4675('0x39')](_[_0x4675('0x42')](_0xe1ee7e['query'],_0xb65466[_0x4675('0x39')]),_0x52b2d1);if(_0xe1ee7e[_0x4675('0x38')]['filter']){_0x31e289[_0x4675('0x41')]=_['merge'](_0x31e289[_0x4675('0x41')],{'$or':_[_0x4675('0x2f')](_0x52b2d1,function(_0x3209da){if(_0x3209da[_0x4675('0x32')]!==_0x4675('0x43')){var _0x4a0619={};_0x4a0619[_0x3209da['name']]={'$like':'%'+_0xe1ee7e[_0x4675('0x38')]['filter']+'%'};return _0x4a0619;}})});}_0x31e289=_[_0x4675('0x44')]({},_0x31e289,_0xe1ee7e[_0x4675('0x45')]);var _0x3e3c6b={'where':_0x31e289[_0x4675('0x41')]};return db[_0x4675('0x46')][_0x4675('0x22')](_0x3e3c6b)[_0x4675('0x2a')](function(_0x4692d8){_0x5ebda8[_0x4675('0x22')]=_0x4692d8;if(_0xe1ee7e['query']['includeAll']){_0x31e289[_0x4675('0x47')]=[{'all':!![]}];}return db[_0x4675('0x46')][_0x4675('0x48')](_0x31e289);})['then'](function(_0x5d11f7){_0x5ebda8[_0x4675('0x49')]=_0x5d11f7;return _0x5ebda8;})[_0x4675('0x2a')](respondWithFilteredResult(_0x18d286,_0x31e289))[_0x4675('0x4a')](handleError(_0x18d286,null));};exports[_0x4675('0x4b')]=function(_0x55e625,_0xaacc09){var _0x49187f={'raw':![],'where':{'id':_0x55e625[_0x4675('0x4c')]['id']}},_0x3eb600={};_0x3eb600['model']=_[_0x4675('0x4d')](db[_0x4675('0x46')]['rawAttributes']);_0x3eb600[_0x4675('0x38')]=_['keys'](_0x55e625[_0x4675('0x38')]);_0x3eb600[_0x4675('0x39')]=_[_0x4675('0x3a')](_0x3eb600[_0x4675('0x34')],_0x3eb600['query']);_0x49187f[_0x4675('0x3b')]=_[_0x4675('0x3a')](_0x3eb600[_0x4675('0x34')],qs[_0x4675('0x3c')](_0x55e625[_0x4675('0x38')]['fields']));_0x49187f[_0x4675('0x3b')]=_0x49187f[_0x4675('0x3b')][_0x4675('0x3d')]?_0x49187f['attributes']:_0x3eb600['model'];if(_0x55e625['query']['includeAll']){_0x49187f[_0x4675('0x47')]=[{'all':!![]}];}_0x49187f=_[_0x4675('0x44')]({},_0x49187f,_0x55e625[_0x4675('0x45')]);return db[_0x4675('0x46')]['find'](_0x49187f)['then'](handleEntityNotFound(_0xaacc09,null))[_0x4675('0x2a')](respondWithResult(_0xaacc09,null))[_0x4675('0x4a')](handleError(_0xaacc09,null));};exports[_0x4675('0x4e')]=function(_0x15d722,_0x1400dc){return db['VoiceRecording']['create'](_0x15d722['body'],{})[_0x4675('0x2a')](respondWithResult(_0x1400dc,0xc9))[_0x4675('0x4a')](handleError(_0x1400dc,null));};exports[_0x4675('0x29')]=function(_0x3e904a,_0x30312c){if(_0x3e904a[_0x4675('0x4f')]['id']){delete _0x3e904a[_0x4675('0x4f')]['id'];}return db[_0x4675('0x46')]['find']({'where':{'id':_0x3e904a[_0x4675('0x4c')]['id']}})[_0x4675('0x2a')](handleEntityNotFound(_0x30312c,null))[_0x4675('0x2a')](saveUpdates(_0x3e904a[_0x4675('0x4f')],null))[_0x4675('0x2a')](respondWithResult(_0x30312c,null))[_0x4675('0x4a')](handleError(_0x30312c,null));};exports[_0x4675('0x50')]=function(_0x2d2df2,_0x5420aa){return db['VoiceRecording'][_0x4675('0x50')]()['then'](respondWithResult(_0x5420aa,null))[_0x4675('0x4a')](handleError(_0x5420aa,null));};exports[_0x4675('0x51')]=function(_0xda6369,_0xcf39af,_0x19d45f){var _0x2e0dea=require(_0x4675('0x52'));var _0x5149ee=![];var _0x459e6b={};if(_0xda6369[_0x4675('0x38')]['type']&&_0xda6369[_0x4675('0x38')][_0x4675('0x32')]===_0x4675('0x53')){_0x459e6b['uniqueid']=_0xda6369['params']['id'];}else{_0x459e6b['id']=_0xda6369[_0x4675('0x4c')]['id'];}return db[_0x4675('0x46')][_0x4675('0x54')]({'where':_0x459e6b,'attributes':['id',_0x4675('0x55')],'raw':!![]})[_0x4675('0x2a')](handleEntityNotFound(_0xcf39af,null))[_0x4675('0x2a')](function(_0x1f855a){if(_0x1f855a){var _0x3b8767=_0x1f855a[_0x4675('0x55')];var _0x4475a5=util[_0x4675('0x37')]('%s.cypher',_0x3b8767);if(fs[_0x4675('0x56')](_0x4475a5)){_0x5149ee=!![];return _0x2e0dea[_0x4675('0x57')](_0x4475a5,_0x3b8767,config['secrets'][_0x4675('0x58')])[_0x4675('0x2a')](function(){return _0x1f855a;});}return _0x1f855a;}})[_0x4675('0x2a')](function(_0x414483){if(_0x414483){var _0x4d06dc=_0x414483[_0x4675('0x55')];if(!fs[_0x4675('0x56')](_0x4d06dc)){throw new db['Sequelize']['ValidationError'](_0x4675('0x59'));}if(_0x414483[_0x4675('0x5a')]){return _0xcf39af[_0x4675('0x51')](_0x4d06dc,_0x414483[_0x4675('0x5a')]+path[_0x4675('0x5b')](_0x4d06dc),function(){if(_0x5149ee){fs['unlink'](_0x4d06dc);}});}else{return _0xcf39af[_0x4675('0x51')](_0x4d06dc,function(_0xc20f2d){if(_0x5149ee){fs[_0x4675('0x5c')](_0x4d06dc);}});}}})[_0x4675('0x4a')](function(_0x24d7cb){if(_0x24d7cb[_0x4675('0x5d')]==='VoiceRecording\x20not\x20found'){_0xcf39af[_0x4675('0x1d')](0x194)[_0x4675('0x2d')]('Not\x20found');}else{return handleError(_0xcf39af,null);}});};exports['downloads']=function(_0x2786ba,_0x292e50,_0x2426cb){var _0x35f141=require(_0x4675('0x52'));var _0x33a0cc=![];var _0x42f9c8={'$and':[db[_0x4675('0x5e')]['where'](db[_0x4675('0x5e')]['fn'](_0x4675('0x5f'),db[_0x4675('0x5e')]['col']('uniqueid')),_0x2786ba['query'][_0x4675('0x60')])]};if(_0x2786ba['query'][_0x4675('0x32')]&&_0x2786ba['query'][_0x4675('0x32')]==='uniqueid'){_0x42f9c8['$and']['push']({'uniqueid':_0x2786ba['params']['id']});}else{_0x42f9c8['$and']['push']({'id':_0x2786ba[_0x4675('0x4c')]['id']});}return db[_0x4675('0x46')][_0x4675('0x54')]({'where':_0x42f9c8,'attributes':['id',_0x4675('0x55')],'raw':!![]})[_0x4675('0x2a')](handleEntityNotFound(_0x292e50,null))[_0x4675('0x2a')](function(_0x5d8775){if(_0x5d8775){var _0x552305=util[_0x4675('0x37')]('%s.cypher',_0x5d8775[_0x4675('0x55')]);if(fs[_0x4675('0x56')](_0x552305)){_0x33a0cc=!![];return _0x35f141[_0x4675('0x57')](_0x552305,_0x5d8775['value'],config[_0x4675('0x61')][_0x4675('0x58')])[_0x4675('0x2a')](function(){return _0x5d8775;});}return _0x5d8775;}})[_0x4675('0x2a')](function(_0x4ab381){if(_0x4ab381){if(!fs['existsSync'](_0x4ab381[_0x4675('0x55')])){throw new db['Sequelize'][(_0x4675('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x4ab381['filename']){return _0x292e50[_0x4675('0x51')](_0x4ab381['value'],_0x4ab381['filename']+path[_0x4675('0x5b')](_0x4ab381[_0x4675('0x55')]),function(){if(_0x33a0cc){fs['unlink'](_0x4ab381[_0x4675('0x55')]);}});}else{return _0x292e50[_0x4675('0x51')](_0x4ab381[_0x4675('0x55')],function(_0x55ffda){if(_0x33a0cc){fs[_0x4675('0x5c')](_0x4ab381[_0x4675('0x55')]);}});}}})[_0x4675('0x4a')](handleError(_0x292e50,null));};exports['destroy']=function(_0x237b01,_0x57f1f1){return db[_0x4675('0x46')][_0x4675('0x54')]({'where':{'id':_0x237b01['params']['id']}})[_0x4675('0x2a')](function(_0x3f8858){if(_['isNil'](_0x3f8858)){throw new ReferenceError(_0x4675('0x63'));}return _0x3f8858;})['then'](function(_0x1623a4){var _0x4ad2f9=_0x1623a4[_0x4675('0x55')];logger[_0x4675('0x64')](_0x4675('0x65'),_0x4ad2f9);if(!_['isNil'](_0x1623a4['value'])&&fs[_0x4675('0x56')](_0x4ad2f9)){logger[_0x4675('0x64')](_0x4675('0x66')+_0x4ad2f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4675('0x67')](_0x4ad2f9);}_0x4ad2f9=_0x4ad2f9+_0x4675('0x68');if(!_[_0x4675('0x69')](_0x1623a4[_0x4675('0x55')])&&fs[_0x4675('0x56')](_0x4ad2f9)){logger['info'](_0x4675('0x66')+_0x4ad2f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4675('0x67')](_0x4ad2f9);}return _0x1623a4;})[_0x4675('0x2a')](function(_0x3348f9){if(!_0x3348f9)throw new InternalError();return _0x3348f9[_0x4675('0x2b')]();})['then'](function(){_0x57f1f1[_0x4675('0x1d')](0xcc)[_0x4675('0x1e')]();})[_0x4675('0x4a')](handleError(_0x57f1f1,null));};function getBucketslist(_0x18710f,_0x48b771,_0x3f6e13){return new Promise(function(_0x99dea9,_0x25ef6e){var _0x57c94d=new AWS['S3']({'accessKeyId':_0x48b771,'secretAccessKey':_0x18710f,'region':_0x3f6e13});_0x57c94d[_0x4675('0x6a')]({},function(_0xb1d241,_0x27d91e){if(_0xb1d241){return _0x25ef6e(_0xb1d241);}else{return _0x99dea9(_0x27d91e);}});});}function createBucket(_0x39a4aa,_0x3fce20,_0x41b94d,_0x6b979d){return new Promise(function(_0x198ddb,_0x3c92d7){var _0x4b2794=new AWS['S3']({'accessKeyId':_0x3fce20,'secretAccessKey':_0x39a4aa,'region':_0x41b94d});_0x4b2794[_0x4675('0x6b')]({'Bucket':_0x6b979d},function(_0x223c17,_0x2d6039){if(_0x223c17){return _0x3c92d7(_0x223c17);}else{return _0x198ddb(_0x2d6039);}});});}function uploadFile(_0x262d6e,_0x12375c,_0x50098e,_0x1bf3b2,_0x76f75a,_0x449b51){return new Promise(function(_0x2ae405,_0x6784ca){var _0x120bb2=new AWS['S3']({'accessKeyId':_0x12375c,'secretAccessKey':_0x262d6e,'region':_0x50098e});_0x120bb2[_0x4675('0x6c')]({'Bucket':_0x1bf3b2,'Key':_0x76f75a,'Body':_0x449b51},function(_0x3cf1c3,_0x412682){if(_0x3cf1c3){return _0x6784ca(_0x3cf1c3);}else{return _0x2ae405(_0x412682);}});});}function startTranscribe(_0x1731e6,_0x26790f,_0x17a3aa,_0x88f986,_0x8254c3,_0x354335){return new Promise(function(_0x3c0115,_0x64b786){var _0x2616ad=new AWS[(_0x4675('0x6d'))]({'accessKeyId':_0x26790f,'secretAccessKey':_0x1731e6,'region':_0x17a3aa});_0x2616ad[_0x4675('0x6e')]({'TranscriptionJobName':_0x88f986,'LanguageCode':_0x8254c3,'Media':{'MediaFileUri':_0x354335}},function(_0x19e870,_0x298d36){if(_0x19e870){return _0x64b786(_0x19e870);}else{return _0x3c0115(_0x298d36);}});});}function transcribe(_0x49c295,_0x59a847,_0x313386,_0xdb9a5d,_0x335564,_0x1d38ae,_0x1f1e22){return new Promise(function(_0x4e982b,_0x17a395){var _0x5aba86={};logger[_0x4675('0x64')](util[_0x4675('0x37')](_0x4675('0x6f'),_0x49c295,_0x335564));return uploadFile(_0x59a847,_0x313386,_0xdb9a5d,_0x335564,path[_0x4675('0x70')](_0x1d38ae),fs[_0x4675('0x71')](_0x1d38ae))[_0x4675('0x2a')](function(_0x58436f){logger[_0x4675('0x64')](util[_0x4675('0x37')](_0x4675('0x72'),_0x49c295,_0x335564,_0x58436f[_0x4675('0x73')]));_0x5aba86[_0x4675('0x74')]=_0x58436f['Bucket'];_0x5aba86[_0x4675('0x75')]=_0x58436f['Location'];logger[_0x4675('0x64')](util[_0x4675('0x37')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x49c295));return startTranscribe(_0x59a847,_0x313386,_0xdb9a5d,uuidv4(),_0x1f1e22,_0x58436f[_0x4675('0x73')]);})[_0x4675('0x2a')](function(_0x2261f4){logger[_0x4675('0x64')](util[_0x4675('0x37')](_0x4675('0x76'),_0x49c295,_0x2261f4[_0x4675('0x77')]['TranscriptionJobName']));_0x5aba86[_0x4675('0x78')]=_0x2261f4[_0x4675('0x77')][_0x4675('0x79')];_0x5aba86[_0x4675('0x7a')]=_0x2261f4[_0x4675('0x77')][_0x4675('0x7b')];return _0x4e982b(_0x5aba86);})[_0x4675('0x4a')](function(_0x50bf31){return _0x17a395(_0x50bf31);});});}exports['runTranscribe']=function(_0x5a1224,_0x4aa2ed,_0x26249d){var _0x3ca4ed;var _0x386284;var _0x3a639e;var _0x48fdbe=require('../../components/encryptor');return db[_0x4675('0x46')][_0x4675('0x7c')]({'where':{'id':_0x5a1224[_0x4675('0x4c')]['id']}})[_0x4675('0x2a')](function(_0x565724){if(_0x565724){var _0x565181=util[_0x4675('0x37')](_0x4675('0x7d'),_0x565724[_0x4675('0x55')]);if(fs[_0x4675('0x56')](_0x565181)){cypher=!![];return _0x48fdbe['decryptFile'](_0x565181,_0x565724[_0x4675('0x55')],config['secrets'][_0x4675('0x58')])[_0x4675('0x2a')](function(){return _0x565724;});}return _0x565724;}})[_0x4675('0x2a')](function(_0x1f9691){if(!_0x1f9691){throw new db[(_0x4675('0x7e'))][(_0x4675('0x62'))](_0x4675('0x7f'));}_0x386284=_0x1f9691;return db['Setting'][_0x4675('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4aa2ed,null))[_0x4675('0x2a')](function(_0x2fc1a0){if(_0x2fc1a0){_0x3ca4ed=_0x2fc1a0;if(!_0x3ca4ed['transcribe']||!_0x3ca4ed['transcribeAccountId']||!_0x3ca4ed[_0x4675('0x80')]||!_0x3ca4ed['language']||!_0x3ca4ed[_0x4675('0x74')]){throw new db[(_0x4675('0x7e'))][(_0x4675('0x62'))](_0x4675('0x81'));}if(_0x5a1224[_0x4675('0x4f')][_0x4675('0x82')]&&(!_0x3ca4ed['sentiment']||!_0x3ca4ed['sentimentAccountId']||!_0x3ca4ed[_0x4675('0x83')]||!_0x3ca4ed[_0x4675('0x84')]||!_0x3ca4ed['bucket'])){throw new db['Sequelize'][(_0x4675('0x62'))](_0x4675('0x85'));}return db[_0x4675('0x86')][_0x4675('0x7c')]({'where':{'id':_0x3ca4ed[_0x4675('0x87')]}});}})[_0x4675('0x2a')](function(_0x22aac4){if(!_0x22aac4){throw new db[(_0x4675('0x7e'))][(_0x4675('0x62'))](_0x4675('0x88'));}if(!_0x22aac4[_0x4675('0x89')]||!_0x22aac4[_0x4675('0x8a')]){throw new db[(_0x4675('0x7e'))][(_0x4675('0x62'))](_0x4675('0x8b'));}_0x3a639e=_0x22aac4;return getBucketslist(_0x3a639e[_0x4675('0x89')],_0x3a639e[_0x4675('0x8a')],_0x3ca4ed['transcribeRegion']);})[_0x4675('0x2a')](function(_0x4bec86){if(_0x4bec86&&_0x4bec86[_0x4675('0x8c')]){var _0x6201db=_[_0x4675('0x54')](_0x4bec86[_0x4675('0x8c')],function(_0x19d0f8){return _0x19d0f8[_0x4675('0x8d')]===_0x3ca4ed[_0x4675('0x74')];});if(!_0x6201db){logger[_0x4675('0x64')](util[_0x4675('0x37')](_0x4675('0x8e'),_0x5a1224['params']['id'],_0x3ca4ed[_0x4675('0x74')]));return createBucket(_0x3a639e['data1'],_0x3a639e[_0x4675('0x8a')],_0x3ca4ed['transcribeRegion'],_0x3ca4ed['bucket']);}logger[_0x4675('0x64')](util[_0x4675('0x37')](_0x4675('0x8f'),_0x5a1224[_0x4675('0x4c')]['id'],_0x3ca4ed[_0x4675('0x74')]));return;}})[_0x4675('0x2a')](function(_0x9272fa){if(_0x386284[_0x4675('0x7a')]===_0x4675('0x90')){return transcribe(_0x5a1224[_0x4675('0x4c')]['id'],_0x3a639e[_0x4675('0x89')],_0x3a639e[_0x4675('0x8a')],_0x3ca4ed[_0x4675('0x80')],_0x3ca4ed[_0x4675('0x74')],_0x386284[_0x4675('0x55')],_0x3ca4ed[_0x4675('0x84')]);}else{logger[_0x4675('0x64')](util[_0x4675('0x37')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5a1224[_0x4675('0x4c')]['id']));return{'transcribeStatus':_0x4675('0x91')};}})[_0x4675('0x2a')](function(_0xb83427){if(_0xb83427){_0xb83427[_0x4675('0x92')]=_0x5a1224[_0x4675('0x4f')][_0x4675('0x82')];return _0x386284[_0x4675('0x93')](_0xb83427);}})[_0x4675('0x2a')](respondWithResult(_0x4aa2ed,null))['catch'](handleError(_0x4aa2ed,null));};function writeFile(_0xad2a2d,_0x5aa65a){return new Promise(function(_0x7ea224,_0x5eb52d){fs['writeFile'](_0x5aa65a,_0xad2a2d,function(_0x3ab47d,_0x571273){if(_0x3ab47d){return _0x5eb52d(_0x3ab47d);}else{return _0x7ea224(_0x571273);}});});}exports[_0x4675('0x94')]=function(_0x80c901,_0x1c0921,_0x1e9e29){return db[_0x4675('0x46')][_0x4675('0x7c')]({'where':{'id':_0x80c901[_0x4675('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c0921))[_0x4675('0x2a')](function(_0x4c0ca8){if(_0x4c0ca8&&_0x4c0ca8[_0x4675('0x95')]){var _0x1bca35=_0x4c0ca8['fileText'];var _0x2c85d5=config[_0x4675('0x96')]+_0x4675('0x97')+_0x4c0ca8['id']+_0x4675('0x98');if(fs[_0x4675('0x56')](_0x2c85d5)){return _0x2c85d5;}return writeFile(_0x1bca35,_0x2c85d5)['then'](function(){return _0x2c85d5;});}else{throw new db[(_0x4675('0x7e'))][(_0x4675('0x62'))](_0x4675('0x99'));}})[_0x4675('0x2a')](function(_0x4c6535){return _0x1c0921['download'](_0x4c6535);})[_0x4675('0x4a')](handleError(_0x1c0921));}; \ No newline at end of file +var _0x1400=['Setting','findOne','transcribe','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','transcribeRegion','Buckets','Name','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','include','catch','show','params','keys','includeAll','options','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','send','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','decryptFile','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','location','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found'];(function(_0x504575,_0x1ad9e0){var _0x4484cc=function(_0xc4c2ea){while(--_0xc4c2ea){_0x504575['push'](_0x504575['shift']());}};_0x4484cc(++_0x1ad9e0);}(_0x1400,0xab));var _0x0140=function(_0x4de820,_0x488481){_0x4de820=_0x4de820-0x0;var _0xec2bcd=_0x1400[_0x4de820];return _0xec2bcd;};'use strict';var emlformat=require(_0x0140('0x0'));var rimraf=require(_0x0140('0x1'));var zipdir=require(_0x0140('0x2'));var jsonpatch=require(_0x0140('0x3'));var rp=require(_0x0140('0x4'));var moment=require(_0x0140('0x5'));var BPromise=require(_0x0140('0x6'));var Mustache=require('mustache');var util=require(_0x0140('0x7'));var path=require(_0x0140('0x8'));var sox=require(_0x0140('0x9'));var csv=require(_0x0140('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0140('0xb'));var _=require('lodash');var squel=require(_0x0140('0xc'));var crypto=require(_0x0140('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0140('0xa'));var querystring=require(_0x0140('0xe'));var Papa=require(_0x0140('0xf'));var AWS=require(_0x0140('0x10'));var uuidv4=require(_0x0140('0x11'));var Redis=require(_0x0140('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0140('0x13'));var hardwareService=require(_0x0140('0x14'));var logger=require(_0x0140('0x15'))(_0x0140('0x16'));var utils=require(_0x0140('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0140('0x18'));var db=require(_0x0140('0x19'))['db'];function respondWithStatusCode(_0x124573,_0x5afa8b){_0x5afa8b=_0x5afa8b||0xcc;return function(_0x143b36){if(_0x143b36){return _0x124573[_0x0140('0x1a')](_0x5afa8b);}return _0x124573[_0x0140('0x1b')](_0x5afa8b)['end']();};}function respondWithResult(_0x247225,_0x2d0312){_0x2d0312=_0x2d0312||0xc8;return function(_0x2fbc33){if(_0x2fbc33){return _0x247225['status'](_0x2d0312)[_0x0140('0x1c')](_0x2fbc33);}};}function respondWithFilteredResult(_0x472c53,_0x2edd4e){return function(_0x521204){if(_0x521204){var _0x4334e2=typeof _0x2edd4e[_0x0140('0x1d')]===_0x0140('0x1e')&&typeof _0x2edd4e['limit']==='undefined';var _0x3e2b88=_0x521204[_0x0140('0x1f')];var _0x2b8d76=_0x4334e2?0x0:_0x2edd4e[_0x0140('0x1d')];var _0x2a29bc=_0x4334e2?_0x521204[_0x0140('0x1f')]:_0x2edd4e[_0x0140('0x1d')]+_0x2edd4e[_0x0140('0x20')];var _0x5e8844;if(_0x2a29bc>=_0x3e2b88){_0x2a29bc=_0x3e2b88;_0x5e8844=0xc8;}else{_0x5e8844=0xce;}_0x472c53['status'](_0x5e8844);return _0x472c53[_0x0140('0x21')](_0x0140('0x22'),_0x2b8d76+'-'+_0x2a29bc+'/'+_0x3e2b88)['json'](_0x521204);}return null;};}function patchUpdates(_0x379767){return function(_0x52124f){try{jsonpatch[_0x0140('0x23')](_0x52124f,_0x379767,!![]);}catch(_0x242d81){return BPromise[_0x0140('0x24')](_0x242d81);}return _0x52124f['save']();};}function saveUpdates(_0x171a21,_0x263a0c){return function(_0x2fee94){if(_0x2fee94){return _0x2fee94[_0x0140('0x25')](_0x171a21)[_0x0140('0x26')](function(_0x570c08){return _0x570c08;});}return null;};}function removeEntity(_0x5b3f7f,_0x5d4777){return function(_0x29dda2){if(_0x29dda2){return _0x29dda2[_0x0140('0x27')]()['then'](function(){_0x5b3f7f[_0x0140('0x1b')](0xcc)[_0x0140('0x28')]();});}};}function handleEntityNotFound(_0x3636bb,_0xf93552){return function(_0x313729){if(!_0x313729){_0x3636bb['sendStatus'](0x194);}return _0x313729;};}function handleError(_0x5b5dfb,_0x36e136){_0x36e136=_0x36e136||0x1f4;return function(_0x1228fe){logger[_0x0140('0x29')](_0x1228fe[_0x0140('0x2a')]);if(_0x1228fe[_0x0140('0x2b')]){delete _0x1228fe[_0x0140('0x2b')];}_0x5b5dfb['status'](_0x36e136)['send'](_0x1228fe);};}exports['index']=function(_0x35d0fd,_0x4ad629){var _0x2e1def={},_0x146e48={},_0xebeeb1={'count':0x0,'rows':[]};var _0x1cc58b=_[_0x0140('0x2c')](db[_0x0140('0x2d')][_0x0140('0x2e')],function(_0x121d86){return{'name':_0x121d86[_0x0140('0x2f')],'type':_0x121d86[_0x0140('0x30')][_0x0140('0x31')]};});_0x146e48[_0x0140('0x32')]=_[_0x0140('0x33')](_[_0x0140('0x2c')](_0x1cc58b,_0x0140('0x2b')),[_0x0140('0x34')]);_0x146e48[_0x0140('0x35')]=_['keys'](_0x35d0fd['query']);_0x146e48[_0x0140('0x36')]=_[_0x0140('0x37')](_0x146e48['model'],_0x146e48[_0x0140('0x35')]);_0x2e1def['attributes']=_['intersection'](_0x146e48['model'],qs[_0x0140('0x38')](_0x35d0fd[_0x0140('0x35')][_0x0140('0x38')]));_0x2e1def[_0x0140('0x39')]=_0x2e1def['attributes'][_0x0140('0x3a')]?_0x2e1def[_0x0140('0x39')]:_0x146e48[_0x0140('0x32')];if(!_0x35d0fd[_0x0140('0x35')]['hasOwnProperty'](_0x0140('0x3b'))){_0x2e1def[_0x0140('0x20')]=qs['limit'](_0x35d0fd[_0x0140('0x35')]['limit']);_0x2e1def[_0x0140('0x1d')]=qs[_0x0140('0x1d')](_0x35d0fd[_0x0140('0x35')]['offset']);}_0x2e1def['order']=qs['sort'](_0x35d0fd[_0x0140('0x35')][_0x0140('0x3c')]);_0x2e1def['where']=qs[_0x0140('0x36')](_[_0x0140('0x3d')](_0x35d0fd['query'],_0x146e48[_0x0140('0x36')]),_0x1cc58b);if(_0x35d0fd['query'][_0x0140('0x3e')]){_0x2e1def['where']=_[_0x0140('0x3f')](_0x2e1def[_0x0140('0x40')],{'$or':_[_0x0140('0x2c')](_0x1cc58b,function(_0x59ed5c){if(_0x59ed5c[_0x0140('0x30')]!==_0x0140('0x41')){var _0x4ab75c={};_0x4ab75c[_0x59ed5c[_0x0140('0x2b')]]={'$like':'%'+_0x35d0fd[_0x0140('0x35')][_0x0140('0x3e')]+'%'};return _0x4ab75c;}})});}_0x2e1def=_[_0x0140('0x3f')]({},_0x2e1def,_0x35d0fd['options']);var _0x253fb5={'where':_0x2e1def[_0x0140('0x40')]};return db['VoiceRecording']['count'](_0x253fb5)[_0x0140('0x26')](function(_0x17591a){_0xebeeb1[_0x0140('0x1f')]=_0x17591a;if(_0x35d0fd[_0x0140('0x35')]['includeAll']){_0x2e1def[_0x0140('0x42')]=[{'all':!![]}];}return db[_0x0140('0x2d')]['findAll'](_0x2e1def);})[_0x0140('0x26')](function(_0x18359c){_0xebeeb1['rows']=_0x18359c;return _0xebeeb1;})['then'](respondWithFilteredResult(_0x4ad629,_0x2e1def))[_0x0140('0x43')](handleError(_0x4ad629,null));};exports[_0x0140('0x44')]=function(_0x3fb6d5,_0x5ba0a3){var _0x5182ba={'raw':![],'where':{'id':_0x3fb6d5[_0x0140('0x45')]['id']}},_0x197ea2={};_0x197ea2['model']=_[_0x0140('0x46')](db[_0x0140('0x2d')][_0x0140('0x2e')]);_0x197ea2['query']=_[_0x0140('0x46')](_0x3fb6d5[_0x0140('0x35')]);_0x197ea2[_0x0140('0x36')]=_['intersection'](_0x197ea2[_0x0140('0x32')],_0x197ea2['query']);_0x5182ba[_0x0140('0x39')]=_[_0x0140('0x37')](_0x197ea2[_0x0140('0x32')],qs[_0x0140('0x38')](_0x3fb6d5[_0x0140('0x35')][_0x0140('0x38')]));_0x5182ba[_0x0140('0x39')]=_0x5182ba[_0x0140('0x39')][_0x0140('0x3a')]?_0x5182ba[_0x0140('0x39')]:_0x197ea2['model'];if(_0x3fb6d5[_0x0140('0x35')][_0x0140('0x47')]){_0x5182ba[_0x0140('0x42')]=[{'all':!![]}];}_0x5182ba=_[_0x0140('0x3f')]({},_0x5182ba,_0x3fb6d5[_0x0140('0x48')]);return db['VoiceRecording']['find'](_0x5182ba)[_0x0140('0x26')](handleEntityNotFound(_0x5ba0a3,null))['then'](respondWithResult(_0x5ba0a3,null))[_0x0140('0x43')](handleError(_0x5ba0a3,null));};exports['create']=function(_0x1eb408,_0xeb7dbd){return db[_0x0140('0x2d')][_0x0140('0x49')](_0x1eb408[_0x0140('0x4a')],{})[_0x0140('0x26')](respondWithResult(_0xeb7dbd,0xc9))['catch'](handleError(_0xeb7dbd,null));};exports['update']=function(_0x5bbd30,_0x374049){if(_0x5bbd30[_0x0140('0x4a')]['id']){delete _0x5bbd30['body']['id'];}return db['VoiceRecording'][_0x0140('0x4b')]({'where':{'id':_0x5bbd30[_0x0140('0x45')]['id']}})[_0x0140('0x26')](handleEntityNotFound(_0x374049,null))['then'](saveUpdates(_0x5bbd30['body'],null))[_0x0140('0x26')](respondWithResult(_0x374049,null))[_0x0140('0x43')](handleError(_0x374049,null));};exports['describe']=function(_0x1cc8cb,_0x31fabb){return db[_0x0140('0x2d')][_0x0140('0x4c')]()[_0x0140('0x26')](respondWithResult(_0x31fabb,null))[_0x0140('0x43')](handleError(_0x31fabb,null));};exports['download']=function(_0x373aaa,_0x562fa7,_0x348084){var _0x376e24=require(_0x0140('0x4d'));var _0x4977dc=![];var _0x75053={};if(_0x373aaa[_0x0140('0x35')][_0x0140('0x30')]&&_0x373aaa[_0x0140('0x35')][_0x0140('0x30')]==='uniqueid'){_0x75053[_0x0140('0x4e')]=_0x373aaa[_0x0140('0x45')]['id'];}else{_0x75053['id']=_0x373aaa[_0x0140('0x45')]['id'];}return db[_0x0140('0x2d')]['find']({'where':_0x75053,'attributes':['id',_0x0140('0x4f')],'raw':!![]})[_0x0140('0x26')](handleEntityNotFound(_0x562fa7,null))[_0x0140('0x26')](function(_0x1d966a){if(_0x1d966a){var _0x27c835=_0x1d966a['value'];var _0x1e79c5=util[_0x0140('0x34')](_0x0140('0x50'),_0x27c835);if(fs[_0x0140('0x51')](_0x1e79c5)){_0x4977dc=!![];return _0x376e24['decryptFile'](_0x1e79c5,_0x27c835,config[_0x0140('0x52')][_0x0140('0x53')])[_0x0140('0x26')](function(){return _0x1d966a;});}return _0x1d966a;}})[_0x0140('0x26')](function(_0xc7aa1e){if(_0xc7aa1e){var _0x3a3c0b=_0xc7aa1e['value'];if(!fs[_0x0140('0x51')](_0x3a3c0b)){throw new db[(_0x0140('0x54'))][(_0x0140('0x55'))](_0x0140('0x56'));}if(_0xc7aa1e[_0x0140('0x57')]){return _0x562fa7[_0x0140('0x58')](_0x3a3c0b,_0xc7aa1e[_0x0140('0x57')]+path[_0x0140('0x59')](_0x3a3c0b),function(){if(_0x4977dc){fs[_0x0140('0x5a')](_0x3a3c0b);}});}else{return _0x562fa7[_0x0140('0x58')](_0x3a3c0b,function(_0x47404c){if(_0x4977dc){fs[_0x0140('0x5a')](_0x3a3c0b);}});}}})[_0x0140('0x43')](function(_0x5820e8){if(_0x5820e8['message']==='VoiceRecording\x20not\x20found'){_0x562fa7[_0x0140('0x1b')](0x194)[_0x0140('0x5b')](_0x0140('0x5c'));}else{return handleError(_0x562fa7,null);}});};exports[_0x0140('0x5d')]=function(_0x4545cc,_0x4466a2,_0x417eec){var _0x563066=require(_0x0140('0x4d'));var _0x2fc3ee=![];var _0xd0a145={'$and':[db[_0x0140('0x5e')]['where'](db['sequelize']['fn'](_0x0140('0x5f'),db[_0x0140('0x5e')][_0x0140('0x60')](_0x0140('0x4e'))),_0x4545cc[_0x0140('0x35')][_0x0140('0x61')])]};if(_0x4545cc[_0x0140('0x35')]['type']&&_0x4545cc[_0x0140('0x35')][_0x0140('0x30')]==='uniqueid'){_0xd0a145['$and'][_0x0140('0x62')]({'uniqueid':_0x4545cc[_0x0140('0x45')]['id']});}else{_0xd0a145[_0x0140('0x63')][_0x0140('0x62')]({'id':_0x4545cc[_0x0140('0x45')]['id']});}return db['VoiceRecording'][_0x0140('0x4b')]({'where':_0xd0a145,'attributes':['id',_0x0140('0x4f')],'raw':!![]})[_0x0140('0x26')](handleEntityNotFound(_0x4466a2,null))[_0x0140('0x26')](function(_0x2cc452){if(_0x2cc452){var _0xb8fe98=util[_0x0140('0x34')](_0x0140('0x50'),_0x2cc452[_0x0140('0x4f')]);if(fs[_0x0140('0x51')](_0xb8fe98)){_0x2fc3ee=!![];return _0x563066[_0x0140('0x64')](_0xb8fe98,_0x2cc452['value'],config[_0x0140('0x52')]['recording'])['then'](function(){return _0x2cc452;});}return _0x2cc452;}})['then'](function(_0x1611c0){if(_0x1611c0){if(!fs['existsSync'](_0x1611c0['value'])){throw new db['Sequelize']['ValidationError'](_0x0140('0x56'));}if(_0x1611c0[_0x0140('0x57')]){return _0x4466a2[_0x0140('0x58')](_0x1611c0[_0x0140('0x4f')],_0x1611c0[_0x0140('0x57')]+path[_0x0140('0x59')](_0x1611c0[_0x0140('0x4f')]),function(){if(_0x2fc3ee){fs[_0x0140('0x5a')](_0x1611c0[_0x0140('0x4f')]);}});}else{return _0x4466a2[_0x0140('0x58')](_0x1611c0[_0x0140('0x4f')],function(_0x4645ba){if(_0x2fc3ee){fs[_0x0140('0x5a')](_0x1611c0[_0x0140('0x4f')]);}});}}})[_0x0140('0x43')](handleError(_0x4466a2,null));};exports[_0x0140('0x27')]=function(_0x27c0fb,_0x2f5ccd){return db[_0x0140('0x2d')]['find']({'where':{'id':_0x27c0fb[_0x0140('0x45')]['id']}})[_0x0140('0x26')](function(_0x58f9fa){if(_[_0x0140('0x65')](_0x58f9fa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f9fa;})[_0x0140('0x26')](function(_0x475d83){var _0x2c4e11=_0x475d83[_0x0140('0x4f')];logger[_0x0140('0x66')](_0x0140('0x67'),_0x2c4e11);if(!_[_0x0140('0x65')](_0x475d83['value'])&&fs[_0x0140('0x51')](_0x2c4e11)){logger[_0x0140('0x66')](_0x0140('0x68')+_0x2c4e11+_0x0140('0x69'));fs[_0x0140('0x6a')](_0x2c4e11);}_0x2c4e11=_0x2c4e11+_0x0140('0x6b');if(!_['isNil'](_0x475d83['value'])&&fs[_0x0140('0x51')](_0x2c4e11)){logger[_0x0140('0x66')]('File:\x20\x22'+_0x2c4e11+_0x0140('0x69'));fs[_0x0140('0x6a')](_0x2c4e11);}return _0x475d83;})['then'](function(_0x4cd40e){if(!_0x4cd40e)throw new InternalError();return _0x4cd40e['destroy']();})[_0x0140('0x26')](function(){_0x2f5ccd[_0x0140('0x1b')](0xcc)['end']();})['catch'](handleError(_0x2f5ccd,null));};function getBucketslist(_0x3e7a78,_0x4cde0c,_0x10c428){return new Promise(function(_0x2d6b7b,_0x284fc8){var _0xbdd885=new AWS['S3']({'accessKeyId':_0x4cde0c,'secretAccessKey':_0x3e7a78,'region':_0x10c428});_0xbdd885['listBuckets']({},function(_0x1fb6f9,_0x47a598){if(_0x1fb6f9){return _0x284fc8(_0x1fb6f9);}else{return _0x2d6b7b(_0x47a598);}});});}function createBucket(_0x49c63e,_0x575749,_0x41f3db,_0x4aea5f){return new Promise(function(_0x163cda,_0x726f4f){var _0x128b74=new AWS['S3']({'accessKeyId':_0x575749,'secretAccessKey':_0x49c63e,'region':_0x41f3db});_0x128b74[_0x0140('0x6c')]({'Bucket':_0x4aea5f},function(_0x184898,_0xa62f38){if(_0x184898){return _0x726f4f(_0x184898);}else{return _0x163cda(_0xa62f38);}});});}function uploadFile(_0x270f7f,_0x4acd53,_0x41297e,_0x55833a,_0x50de96,_0x9ca06e){return new Promise(function(_0x57c85e,_0x40c461){var _0x5111e6=new AWS['S3']({'accessKeyId':_0x4acd53,'secretAccessKey':_0x270f7f,'region':_0x41297e});_0x5111e6['upload']({'Bucket':_0x55833a,'Key':_0x50de96,'Body':_0x9ca06e},function(_0xca2fde,_0x4f1d1d){if(_0xca2fde){return _0x40c461(_0xca2fde);}else{return _0x57c85e(_0x4f1d1d);}});});}function startTranscribe(_0x49be2e,_0x41a615,_0x4533d5,_0x5b8490,_0x28fe16,_0x44cbe1){return new Promise(function(_0x3154d9,_0x393694){var _0x64996d=new AWS[(_0x0140('0x6d'))]({'accessKeyId':_0x41a615,'secretAccessKey':_0x49be2e,'region':_0x4533d5});_0x64996d['startTranscriptionJob']({'TranscriptionJobName':_0x5b8490,'LanguageCode':_0x28fe16,'Media':{'MediaFileUri':_0x44cbe1}},function(_0x23e1bb,_0x58478f){if(_0x23e1bb){return _0x393694(_0x23e1bb);}else{return _0x3154d9(_0x58478f);}});});}function transcribe(_0xc45398,_0x357fd1,_0x243fdc,_0x4c1020,_0x1a44be,_0x54d414,_0x3374d1){return new Promise(function(_0x52b77f,_0x16a185){var _0x4ae671={};logger[_0x0140('0x66')](util['format'](_0x0140('0x6e'),_0xc45398,_0x1a44be));return uploadFile(_0x357fd1,_0x243fdc,_0x4c1020,_0x1a44be,path[_0x0140('0x6f')](_0x54d414),fs['readFileSync'](_0x54d414))['then'](function(_0x24e479){logger[_0x0140('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xc45398,_0x1a44be,_0x24e479[_0x0140('0x70')]));_0x4ae671['bucket']=_0x24e479[_0x0140('0x71')];_0x4ae671[_0x0140('0x72')]=_0x24e479[_0x0140('0x70')];logger[_0x0140('0x66')](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xc45398));return startTranscribe(_0x357fd1,_0x243fdc,_0x4c1020,uuidv4(),_0x3374d1,_0x24e479[_0x0140('0x70')]);})['then'](function(_0x7c7cbe){logger[_0x0140('0x66')](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xc45398,_0x7c7cbe[_0x0140('0x73')]['TranscriptionJobName']));_0x4ae671[_0x0140('0x74')]=_0x7c7cbe[_0x0140('0x73')][_0x0140('0x75')];_0x4ae671[_0x0140('0x76')]=_0x7c7cbe[_0x0140('0x73')][_0x0140('0x77')];return _0x52b77f(_0x4ae671);})[_0x0140('0x43')](function(_0x3230b9){return _0x16a185(_0x3230b9);});});}exports['runTranscribe']=function(_0x24334a,_0x2f29b8,_0x33f42d){var _0x5431bf;var _0x356f5e;var _0x4d2ad5;var _0x3273f4=require(_0x0140('0x4d'));return db[_0x0140('0x2d')]['findOne']({'where':{'id':_0x24334a[_0x0140('0x45')]['id']}})[_0x0140('0x26')](function(_0x306bf9){if(_0x306bf9){var _0x3abfae=util[_0x0140('0x34')](_0x0140('0x50'),_0x306bf9[_0x0140('0x4f')]);if(fs['existsSync'](_0x3abfae)){cypher=!![];return _0x3273f4[_0x0140('0x64')](_0x3abfae,_0x306bf9[_0x0140('0x4f')],config[_0x0140('0x52')][_0x0140('0x53')])[_0x0140('0x26')](function(){return _0x306bf9;});}return _0x306bf9;}})[_0x0140('0x26')](function(_0x5569fb){if(!_0x5569fb){throw new db[(_0x0140('0x54'))][(_0x0140('0x55'))](_0x0140('0x78'));}_0x356f5e=_0x5569fb;return db[_0x0140('0x79')][_0x0140('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2f29b8,null))[_0x0140('0x26')](function(_0x3a9121){if(_0x3a9121){_0x5431bf=_0x3a9121;if(!_0x5431bf[_0x0140('0x7b')]||!_0x5431bf['transcribeAccountId']||!_0x5431bf['transcribeRegion']||!_0x5431bf[_0x0140('0x7c')]||!_0x5431bf[_0x0140('0x7d')]){throw new db['Sequelize'][(_0x0140('0x55'))](_0x0140('0x7e'));}if(_0x24334a[_0x0140('0x4a')][_0x0140('0x7f')]&&(!_0x5431bf['sentiment']||!_0x5431bf[_0x0140('0x80')]||!_0x5431bf[_0x0140('0x81')]||!_0x5431bf[_0x0140('0x7c')]||!_0x5431bf[_0x0140('0x7d')])){throw new db['Sequelize']['ValidationError'](_0x0140('0x82'));}return db[_0x0140('0x83')][_0x0140('0x7a')]({'where':{'id':_0x5431bf['transcribeAccountId']}});}})[_0x0140('0x26')](function(_0x4f497d){if(!_0x4f497d){throw new db['Sequelize'][(_0x0140('0x55'))](_0x0140('0x84'));}if(!_0x4f497d['data1']||!_0x4f497d[_0x0140('0x85')]){throw new db[(_0x0140('0x54'))][(_0x0140('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x4d2ad5=_0x4f497d;return getBucketslist(_0x4d2ad5[_0x0140('0x86')],_0x4d2ad5[_0x0140('0x85')],_0x5431bf[_0x0140('0x87')]);})[_0x0140('0x26')](function(_0x29a11e){if(_0x29a11e&&_0x29a11e[_0x0140('0x88')]){var _0x2d56c9=_[_0x0140('0x4b')](_0x29a11e[_0x0140('0x88')],function(_0x58c2b7){return _0x58c2b7[_0x0140('0x89')]===_0x5431bf[_0x0140('0x7d')];});if(!_0x2d56c9){logger[_0x0140('0x66')](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x24334a['params']['id'],_0x5431bf[_0x0140('0x7d')]));return createBucket(_0x4d2ad5[_0x0140('0x86')],_0x4d2ad5['data2'],_0x5431bf[_0x0140('0x87')],_0x5431bf[_0x0140('0x7d')]);}logger['info'](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x24334a['params']['id'],_0x5431bf[_0x0140('0x7d')]));return;}})[_0x0140('0x26')](function(_0x3fd6bb){if(_0x356f5e[_0x0140('0x76')]===_0x0140('0x8a')){return transcribe(_0x24334a[_0x0140('0x45')]['id'],_0x4d2ad5['data1'],_0x4d2ad5[_0x0140('0x85')],_0x5431bf[_0x0140('0x87')],_0x5431bf[_0x0140('0x7d')],_0x356f5e['value'],_0x5431bf['language']);}else{logger[_0x0140('0x66')](util['format'](_0x0140('0x8b'),_0x24334a['params']['id']));return{'transcribeStatus':_0x0140('0x8c')};}})[_0x0140('0x26')](function(_0x2d79a6){if(_0x2d79a6){_0x2d79a6['tempSentiment']=_0x24334a[_0x0140('0x4a')]['runSentiment'];return _0x356f5e[_0x0140('0x8d')](_0x2d79a6);}})['then'](respondWithResult(_0x2f29b8,null))[_0x0140('0x43')](handleError(_0x2f29b8,null));};function writeFile(_0x54de81,_0x6874a5){return new Promise(function(_0x490739,_0x31c0e2){fs[_0x0140('0x8e')](_0x6874a5,_0x54de81,function(_0x4d1286,_0x5375a0){if(_0x4d1286){return _0x31c0e2(_0x4d1286);}else{return _0x490739(_0x5375a0);}});});}exports['downloadTranscribe']=function(_0x222c37,_0x1f8103,_0x36902d){return db[_0x0140('0x2d')][_0x0140('0x7a')]({'where':{'id':_0x222c37['params']['id']}})[_0x0140('0x26')](handleEntityNotFound(_0x1f8103))[_0x0140('0x26')](function(_0x1c255d){if(_0x1c255d&&_0x1c255d[_0x0140('0x8f')]){var _0x57b79b=_0x1c255d[_0x0140('0x8f')];var _0x2b6cd7=config['root']+_0x0140('0x90')+_0x1c255d['id']+'.txt';if(fs['existsSync'](_0x2b6cd7)){return _0x2b6cd7;}return writeFile(_0x57b79b,_0x2b6cd7)[_0x0140('0x26')](function(){return _0x2b6cd7;});}else{throw new db[(_0x0140('0x54'))]['ValidationError'](_0x0140('0x91'));}})['then'](function(_0x12e60c){return _0x1f8103[_0x0140('0x58')](_0x12e60c);})[_0x0140('0x43')](handleError(_0x1f8103));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 10433b8..906a80a 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 _0x89e8=['voice_recordings','uniqueid','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x89e8,0x74));var _0x889e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e8[_0x14add3];return _0x4a174f;};'use strict';var attributes=require(_0x889e('0x0'));module[_0x889e('0x1')]=function(_0xfc1dd0,_0x319ddb){return _0xfc1dd0[_0x889e('0x2')](_0x889e('0x3'),attributes,{'tableName':_0x889e('0x4'),'paranoid':![],'indexes':[{'name':_0x889e('0x5'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0328=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x11879c,_0x804353){var _0x4964c3=function(_0x2e8e43){while(--_0x2e8e43){_0x11879c['push'](_0x11879c['shift']());}};_0x4964c3(++_0x804353);}(_0x0328,0x172));var _0x8032=function(_0xe967ef,_0x444e7b){_0xe967ef=_0xe967ef-0x0;var _0x3e63d8=_0x0328[_0xe967ef];return _0x3e63d8;};'use strict';var attributes=require(_0x8032('0x0'));module[_0x8032('0x1')]=function(_0x2bdc4f,_0x3be376){return _0x2bdc4f[_0x8032('0x2')](_0x8032('0x3'),attributes,{'tableName':_0x8032('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8032('0x5')]},{'name':_0x8032('0x6'),'fields':[_0x8032('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index b467066..c98b793 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 _0x8ace=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x21d3d5,_0x38163c){_0x21d3d5=_0x21d3d5-0x0;var _0xf0057b=_0x8ace[_0x21d3d5];return _0xf0057b;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});}exports[_0xe8ac('0x19')]=function(_0x36759c){var _0x4892d0=this;return new Promise(function(_0x59df3d,_0x5f3433){return db[_0xe8ac('0x1a')][_0xe8ac('0x1b')](_0x36759c['body'],{'raw':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1e')]||null:null,'attributes':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')]||null:null,'limit':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')]['limit']||null:null})[_0xe8ac('0x20')](function(_0x3933d2){logger[_0xe8ac('0xf')](_0xe8ac('0x19'),_0x36759c);logger[_0xe8ac('0x12')](_0xe8ac('0x19'),_0x36759c,JSON[_0xe8ac('0x14')](_0x3933d2));_0x59df3d(_0x3933d2);})['catch'](function(_0x1c3ea4){logger[_0xe8ac('0x15')](_0xe8ac('0x19'),_0x1c3ea4[_0xe8ac('0x16')],_0x36759c);_0x5f3433(_0x4892d0[_0xe8ac('0x15')](0x1f4,_0x1c3ea4[_0xe8ac('0x16')]));});});};exports[_0xe8ac('0x21')]=function(_0x3e3fc2){var _0x44b07c=this;return new Promise(function(_0x562e44,_0x5a1b69){var _0x346dcb=require(_0xe8ac('0x22'));var _0x59512c;return db[_0xe8ac('0x23')][_0xe8ac('0x24')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f1e44){_0x59512c=_0x1f1e44;return db[_0xe8ac('0x1a')][_0xe8ac('0x25')](_0x3e3fc2[_0xe8ac('0x26')]);})[_0xe8ac('0x20')](function(_0x41ffe8){if(_0x59512c[_0xe8ac('0x27')]&&fs['existsSync'](_0x41ffe8[_0xe8ac('0x28')])){var _0x5459e5=util[_0xe8ac('0x29')]('%s.cypher',_0x41ffe8['value']);return _0x346dcb['encryptFile'](_0x41ffe8['value'],_0x5459e5,config[_0xe8ac('0x2a')][_0xe8ac('0x2b')])[_0xe8ac('0x20')](function(){fs[_0xe8ac('0x2c')](_0x41ffe8[_0xe8ac('0x28')]);logger[_0xe8ac('0xf')](_0xe8ac('0x2d'));return _0x41ffe8;});}return _0x41ffe8;})['then'](function(_0x1cacb0){logger['info']('CreateVoiceRecording',_0x3e3fc2);logger['debug'](_0xe8ac('0x21'),_0x3e3fc2,JSON[_0xe8ac('0x14')](_0x1cacb0));_0x562e44(_0x1cacb0);})[_0xe8ac('0x18')](function(_0x56feff){logger['error'](_0xe8ac('0x21'),_0x56feff[_0xe8ac('0x16')],_0x3e3fc2);_0x5a1b69(_0x44b07c[_0xe8ac('0x15')](0x1f4,_0x56feff[_0xe8ac('0x16')]));});});}; \ No newline at end of file +var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x3cb712,_0x5ab0cd){var _0x549c2a=function(_0x16a400){while(--_0x16a400){_0x3cb712['push'](_0x3cb712['shift']());}};_0x549c2a(++_0x5ab0cd);}(_0x66fa,0x117));var _0xa66f=function(_0x27d6ec,_0x3aa33c){_0x27d6ec=_0x27d6ec-0x0;var _0x4954da=_0x66fa[_0x27d6ec];return _0x4954da;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ac73dd9..85d58c2 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 _0x0efd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','delete','exports','multer','util'];(function(_0x2ac798,_0x25a0de){var _0x49d72b=function(_0x38cd83){while(--_0x38cd83){_0x2ac798['push'](_0x2ac798['shift']());}};_0x49d72b(++_0x25a0de);}(_0x0efd,0x18e));var _0xd0ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0efd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd0ef('0x0'));var util=require(_0xd0ef('0x1'));var path=require(_0xd0ef('0x2'));var timeout=require(_0xd0ef('0x3'));var express=require(_0xd0ef('0x4'));var router=express[_0xd0ef('0x5')]();var fs_extra=require(_0xd0ef('0x6'));var auth=require(_0xd0ef('0x7'));var interaction=require(_0xd0ef('0x8'));var config=require(_0xd0ef('0x9'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xd0ef('0xa')](),controller[_0xd0ef('0xb')]);router[_0xd0ef('0xc')]('/describe',auth[_0xd0ef('0xa')](),controller[_0xd0ef('0xd')]);router[_0xd0ef('0xc')](_0xd0ef('0xe'),auth[_0xd0ef('0xa')](),controller[_0xd0ef('0xf')]);router[_0xd0ef('0x10')]('/',auth['isAuthenticated'](),controller[_0xd0ef('0x11')]);router['put'](_0xd0ef('0xe'),auth[_0xd0ef('0xa')](),controller['update']);router[_0xd0ef('0x12')](_0xd0ef('0xe'),auth[_0xd0ef('0xa')](),controller['destroy']);module[_0xd0ef('0x13')]=router; \ No newline at end of file +var _0xfed7=['/:id','show','post','isAuthenticated','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index'];(function(_0x4183ce,_0x200d5f){var _0x156fb3=function(_0x54e706){while(--_0x54e706){_0x4183ce['push'](_0x4183ce['shift']());}};_0x156fb3(++_0x200d5f);}(_0xfed7,0xc6));var _0x7fed=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0xfed7[_0x16ecad];return _0x313ff7;};'use strict';var multer=require(_0x7fed('0x0'));var util=require(_0x7fed('0x1'));var path=require(_0x7fed('0x2'));var timeout=require(_0x7fed('0x3'));var express=require(_0x7fed('0x4'));var router=express[_0x7fed('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7fed('0x6'));var interaction=require(_0x7fed('0x7'));var config=require('../../config/environment');var controller=require(_0x7fed('0x8'));router[_0x7fed('0x9')]('/',auth['isAuthenticated'](),controller[_0x7fed('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7fed('0x9')](_0x7fed('0xb'),auth['isAuthenticated'](),controller[_0x7fed('0xc')]);router[_0x7fed('0xd')]('/',auth[_0x7fed('0xe')](),controller[_0x7fed('0xf')]);router[_0x7fed('0x10')](_0x7fed('0xb'),auth[_0x7fed('0xe')](),controller['update']);router['delete'](_0x7fed('0xb'),auth[_0x7fed('0xe')](),controller[_0x7fed('0x11')]);module[_0x7fed('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 8b4a530..e98a1ea 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 _0x6291=['moment','exports','ENUM','blind','attended','STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6291,0xd8));var _0x1629=function(_0x554db0,_0x4eda6b){_0x554db0=_0x554db0-0x0;var _0x2ac209=_0x6291[_0x554db0];return _0x2ac209;};'use strict';var Sequelize=require(_0x1629('0x0'));var moment=require(_0x1629('0x1'));module[_0x1629('0x2')]={'type':{'type':Sequelize[_0x1629('0x3')](_0x1629('0x4'),_0x1629('0x5'))},'result':{'type':Sequelize[_0x1629('0x6')]},'transfererchannel':{'type':Sequelize[_0x1629('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x1629('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1629('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x1629('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x1629('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x1629('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x1629('0x6')]},'transfereechannel':{'type':Sequelize[_0x1629('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x1629('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x1629('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1629('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1629('0x6')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x1629('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa575=['STRING','moment','exports','ENUM','blind','attended'];(function(_0x38b2cf,_0xd295cd){var _0x4db861=function(_0x28ddad){while(--_0x28ddad){_0x38b2cf['push'](_0x38b2cf['shift']());}};_0x4db861(++_0xd295cd);}(_0xa575,0x14b));var _0x5a57=function(_0x3c4e2f,_0x58fb74){_0x3c4e2f=_0x3c4e2f-0x0;var _0x598678=_0xa575[_0x3c4e2f];return _0x598678;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5a57('0x0'));module[_0x5a57('0x1')]={'type':{'type':Sequelize[_0x5a57('0x2')](_0x5a57('0x3'),_0x5a57('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x5a57('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x5a57('0x5')]},'transferercalleridname':{'type':Sequelize[_0x5a57('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5a57('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x5a57('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5a57('0x5')]},'transferercontext':{'type':Sequelize[_0x5a57('0x5')]},'transfererexten':{'type':Sequelize[_0x5a57('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x5a57('0x5')]},'transfereechannel':{'type':Sequelize[_0x5a57('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5a57('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5a57('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x5a57('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5a57('0x5')]},'transfereecontext':{'type':Sequelize[_0x5a57('0x5')]},'transfereeexten':{'type':Sequelize[_0x5a57('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x5a57('0x5')]},'isexternal':{'type':Sequelize[_0x5a57('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x5a57('0x5')]},'extension':{'type':Sequelize[_0x5a57('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 02e46c5..ae8d203 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 _0xcdc9=['filter','merge','options','findAll','show','params','includeAll','include','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x34ac64,_0x23f246){var _0xae8ae9=function(_0x34cdcd){while(--_0x34cdcd){_0x34ac64['push'](_0x34ac64['shift']());}};_0xae8ae9(++_0x23f246);}(_0xcdc9,0xeb));var _0x9cdc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcdc9[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x9cdc('0x0'));var rimraf=require(_0x9cdc('0x1'));var zipdir=require(_0x9cdc('0x2'));var jsonpatch=require(_0x9cdc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9cdc('0x4'));var Mustache=require(_0x9cdc('0x5'));var util=require(_0x9cdc('0x6'));var path=require('path');var sox=require(_0x9cdc('0x7'));var csv=require('to-csv');var ejs=require(_0x9cdc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cdc('0x9'));var squel=require(_0x9cdc('0xa'));var crypto=require(_0x9cdc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9cdc('0xc'));var toCsv=require(_0x9cdc('0xd'));var querystring=require(_0x9cdc('0xe'));var Papa=require(_0x9cdc('0xf'));var Redis=require('ioredis');var authService=require(_0x9cdc('0x10'));var qs=require(_0x9cdc('0x11'));var as=require(_0x9cdc('0x12'));var hardwareService=require(_0x9cdc('0x13'));var logger=require(_0x9cdc('0x14'))(_0x9cdc('0x15'));var utils=require(_0x9cdc('0x16'));var config=require(_0x9cdc('0x17'));var licenseUtil=require(_0x9cdc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19d574,_0x542694){_0x542694=_0x542694||0xcc;return function(_0x1864af){if(_0x1864af){return _0x19d574[_0x9cdc('0x19')](_0x542694);}return _0x19d574[_0x9cdc('0x1a')](_0x542694)[_0x9cdc('0x1b')]();};}function respondWithResult(_0x3d97c8,_0xb90d7a){_0xb90d7a=_0xb90d7a||0xc8;return function(_0x39d391){if(_0x39d391){return _0x3d97c8['status'](_0xb90d7a)['json'](_0x39d391);}};}function respondWithFilteredResult(_0x7cbb0d,_0x4f93bc){return function(_0x119c22){if(_0x119c22){var _0x384909=typeof _0x4f93bc[_0x9cdc('0x1c')]===_0x9cdc('0x1d')&&typeof _0x4f93bc['limit']===_0x9cdc('0x1d');var _0x3f302b=_0x119c22[_0x9cdc('0x1e')];var _0x3a3d84=_0x384909?0x0:_0x4f93bc[_0x9cdc('0x1c')];var _0x3e5619=_0x384909?_0x119c22[_0x9cdc('0x1e')]:_0x4f93bc[_0x9cdc('0x1c')]+_0x4f93bc[_0x9cdc('0x1f')];var _0x73abe0;if(_0x3e5619>=_0x3f302b){_0x3e5619=_0x3f302b;_0x73abe0=0xc8;}else{_0x73abe0=0xce;}_0x7cbb0d[_0x9cdc('0x1a')](_0x73abe0);return _0x7cbb0d[_0x9cdc('0x20')]('Content-Range',_0x3a3d84+'-'+_0x3e5619+'/'+_0x3f302b)['json'](_0x119c22);}return null;};}function patchUpdates(_0x24653d){return function(_0x58201a){try{jsonpatch[_0x9cdc('0x21')](_0x58201a,_0x24653d,!![]);}catch(_0x5cc77c){return BPromise[_0x9cdc('0x22')](_0x5cc77c);}return _0x58201a['save']();};}function saveUpdates(_0x429c86,_0x4b7578){return function(_0x51f647){if(_0x51f647){return _0x51f647['update'](_0x429c86)[_0x9cdc('0x23')](function(_0x31ec3b){return _0x31ec3b;});}return null;};}function removeEntity(_0x1a942d,_0x2f24f9){return function(_0x5d7a37){if(_0x5d7a37){return _0x5d7a37[_0x9cdc('0x24')]()['then'](function(){_0x1a942d[_0x9cdc('0x1a')](0xcc)[_0x9cdc('0x1b')]();});}};}function handleEntityNotFound(_0x4e418e,_0x5724c2){return function(_0x437f97){if(!_0x437f97){_0x4e418e[_0x9cdc('0x19')](0x194);}return _0x437f97;};}function handleError(_0x1e8173,_0x1be644){_0x1be644=_0x1be644||0x1f4;return function(_0x34bf94){logger[_0x9cdc('0x25')](_0x34bf94[_0x9cdc('0x26')]);if(_0x34bf94[_0x9cdc('0x27')]){delete _0x34bf94[_0x9cdc('0x27')];}_0x1e8173[_0x9cdc('0x1a')](_0x1be644)[_0x9cdc('0x28')](_0x34bf94);};}exports[_0x9cdc('0x29')]=function(_0x290ec4,_0xc8f632){var _0x2ca142={},_0x196b61={},_0x3e05fe={'count':0x0,'rows':[]};var _0x2b6d12=_[_0x9cdc('0x2a')](db[_0x9cdc('0x2b')][_0x9cdc('0x2c')],function(_0xa06def){return{'name':_0xa06def['fieldName'],'type':_0xa06def[_0x9cdc('0x2d')][_0x9cdc('0x2e')]};});_0x196b61['model']=_[_0x9cdc('0x2a')](_0x2b6d12,_0x9cdc('0x27'));_0x196b61['query']=_[_0x9cdc('0x2f')](_0x290ec4[_0x9cdc('0x30')]);_0x196b61[_0x9cdc('0x31')]=_['intersection'](_0x196b61[_0x9cdc('0x32')],_0x196b61[_0x9cdc('0x30')]);_0x2ca142['attributes']=_[_0x9cdc('0x33')](_0x196b61[_0x9cdc('0x32')],qs[_0x9cdc('0x34')](_0x290ec4[_0x9cdc('0x30')]['fields']));_0x2ca142[_0x9cdc('0x35')]=_0x2ca142[_0x9cdc('0x35')][_0x9cdc('0x36')]?_0x2ca142[_0x9cdc('0x35')]:_0x196b61[_0x9cdc('0x32')];if(!_0x290ec4[_0x9cdc('0x30')][_0x9cdc('0x37')](_0x9cdc('0x38'))){_0x2ca142[_0x9cdc('0x1f')]=qs[_0x9cdc('0x1f')](_0x290ec4[_0x9cdc('0x30')][_0x9cdc('0x1f')]);_0x2ca142[_0x9cdc('0x1c')]=qs[_0x9cdc('0x1c')](_0x290ec4[_0x9cdc('0x30')][_0x9cdc('0x1c')]);}_0x2ca142[_0x9cdc('0x39')]=qs[_0x9cdc('0x3a')](_0x290ec4[_0x9cdc('0x30')]['sort']);_0x2ca142[_0x9cdc('0x3b')]=qs[_0x9cdc('0x31')](_[_0x9cdc('0x3c')](_0x290ec4[_0x9cdc('0x30')],_0x196b61[_0x9cdc('0x31')]),_0x2b6d12);if(_0x290ec4['query'][_0x9cdc('0x3d')]){_0x2ca142[_0x9cdc('0x3b')]=_[_0x9cdc('0x3e')](_0x2ca142[_0x9cdc('0x3b')],{'$or':_['map'](_0x2b6d12,function(_0x29d000){if(_0x29d000[_0x9cdc('0x2d')]!=='VIRTUAL'){var _0x7be6ac={};_0x7be6ac[_0x29d000[_0x9cdc('0x27')]]={'$like':'%'+_0x290ec4[_0x9cdc('0x30')]['filter']+'%'};return _0x7be6ac;}})});}_0x2ca142=_[_0x9cdc('0x3e')]({},_0x2ca142,_0x290ec4[_0x9cdc('0x3f')]);var _0x252bb9={'where':_0x2ca142['where']};return db['VoiceTransferReport'][_0x9cdc('0x1e')](_0x252bb9)[_0x9cdc('0x23')](function(_0xedc9ce){_0x3e05fe[_0x9cdc('0x1e')]=_0xedc9ce;if(_0x290ec4[_0x9cdc('0x30')]['includeAll']){_0x2ca142['include']=[{'all':!![]}];}return db[_0x9cdc('0x2b')][_0x9cdc('0x40')](_0x2ca142);})[_0x9cdc('0x23')](function(_0x5eea29){_0x3e05fe['rows']=_0x5eea29;return _0x3e05fe;})['then'](respondWithFilteredResult(_0xc8f632,_0x2ca142))['catch'](handleError(_0xc8f632,null));};exports[_0x9cdc('0x41')]=function(_0xd4fdea,_0x501fd8){var _0x10d914={'raw':!![],'where':{'id':_0xd4fdea[_0x9cdc('0x42')]['id']}},_0x11089c={};_0x11089c['model']=_[_0x9cdc('0x2f')](db['VoiceTransferReport'][_0x9cdc('0x2c')]);_0x11089c[_0x9cdc('0x30')]=_[_0x9cdc('0x2f')](_0xd4fdea[_0x9cdc('0x30')]);_0x11089c[_0x9cdc('0x31')]=_['intersection'](_0x11089c[_0x9cdc('0x32')],_0x11089c[_0x9cdc('0x30')]);_0x10d914['attributes']=_[_0x9cdc('0x33')](_0x11089c[_0x9cdc('0x32')],qs[_0x9cdc('0x34')](_0xd4fdea[_0x9cdc('0x30')][_0x9cdc('0x34')]));_0x10d914[_0x9cdc('0x35')]=_0x10d914['attributes'][_0x9cdc('0x36')]?_0x10d914[_0x9cdc('0x35')]:_0x11089c[_0x9cdc('0x32')];if(_0xd4fdea[_0x9cdc('0x30')][_0x9cdc('0x43')]){_0x10d914[_0x9cdc('0x44')]=[{'all':!![]}];}_0x10d914=_[_0x9cdc('0x3e')]({},_0x10d914,_0xd4fdea[_0x9cdc('0x3f')]);return db[_0x9cdc('0x2b')]['find'](_0x10d914)['then'](handleEntityNotFound(_0x501fd8,null))[_0x9cdc('0x23')](respondWithResult(_0x501fd8,null))[_0x9cdc('0x45')](handleError(_0x501fd8,null));};exports[_0x9cdc('0x46')]=function(_0x61cb8,_0x1ae089){return db[_0x9cdc('0x2b')][_0x9cdc('0x46')](_0x61cb8[_0x9cdc('0x47')],{})[_0x9cdc('0x23')](respondWithResult(_0x1ae089,0xc9))[_0x9cdc('0x45')](handleError(_0x1ae089,null));};exports[_0x9cdc('0x48')]=function(_0x12fc3f,_0x54e99b){if(_0x12fc3f[_0x9cdc('0x47')]['id']){delete _0x12fc3f['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x12fc3f[_0x9cdc('0x42')]['id']}})[_0x9cdc('0x23')](handleEntityNotFound(_0x54e99b,null))['then'](saveUpdates(_0x12fc3f['body'],null))[_0x9cdc('0x23')](respondWithResult(_0x54e99b,null))[_0x9cdc('0x45')](handleError(_0x54e99b,null));};exports['destroy']=function(_0x2132ec,_0x551250){return db['VoiceTransferReport']['find']({'where':{'id':_0x2132ec[_0x9cdc('0x42')]['id']}})[_0x9cdc('0x23')](handleEntityNotFound(_0x551250,null))[_0x9cdc('0x23')](removeEntity(_0x551250,null))[_0x9cdc('0x45')](handleError(_0x551250,null));};exports[_0x9cdc('0x49')]=function(_0x155f75,_0x2e42b5){return db[_0x9cdc('0x2b')][_0x9cdc('0x49')]()['then'](respondWithResult(_0x2e42b5,null))[_0x9cdc('0x45')](handleError(_0x2e42b5,null));}; \ No newline at end of file +var _0xe1fb=['destroy','sendStatus','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','then','rows','catch','show','params','rawAttributes','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','limit','undefined','count','offset','set','apply','reject','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe1fb,0x188));var _0xbe1f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe1fb[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xbe1f('0x0'));var rimraf=require(_0xbe1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe1f('0x2'));var rp=require(_0xbe1f('0x3'));var moment=require(_0xbe1f('0x4'));var BPromise=require(_0xbe1f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe1f('0x6'));var sox=require(_0xbe1f('0x7'));var csv=require(_0xbe1f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe1f('0x9'));var squel=require(_0xbe1f('0xa'));var crypto=require('crypto');var jsforce=require(_0xbe1f('0xb'));var deskjs=require(_0xbe1f('0xc'));var toCsv=require(_0xbe1f('0x8'));var querystring=require('querystring');var Papa=require(_0xbe1f('0xd'));var Redis=require(_0xbe1f('0xe'));var authService=require(_0xbe1f('0xf'));var qs=require(_0xbe1f('0x10'));var as=require(_0xbe1f('0x11'));var hardwareService=require(_0xbe1f('0x12'));var logger=require(_0xbe1f('0x13'))(_0xbe1f('0x14'));var utils=require('../../config/utils');var config=require(_0xbe1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe1f('0x16'))['db'];function respondWithStatusCode(_0x348bb5,_0x3ee519){_0x3ee519=_0x3ee519||0xcc;return function(_0x90f4d7){if(_0x90f4d7){return _0x348bb5['sendStatus'](_0x3ee519);}return _0x348bb5['status'](_0x3ee519)[_0xbe1f('0x17')]();};}function respondWithResult(_0x450aeb,_0x5d315a){_0x5d315a=_0x5d315a||0xc8;return function(_0x153146){if(_0x153146){return _0x450aeb[_0xbe1f('0x18')](_0x5d315a)[_0xbe1f('0x19')](_0x153146);}};}function respondWithFilteredResult(_0x33be35,_0x409e6e){return function(_0x392c4d){if(_0x392c4d){var _0x7cd1f0=typeof _0x409e6e['offset']==='undefined'&&typeof _0x409e6e[_0xbe1f('0x1a')]===_0xbe1f('0x1b');var _0x50cb61=_0x392c4d[_0xbe1f('0x1c')];var _0x394ac2=_0x7cd1f0?0x0:_0x409e6e['offset'];var _0xac2de5=_0x7cd1f0?_0x392c4d[_0xbe1f('0x1c')]:_0x409e6e[_0xbe1f('0x1d')]+_0x409e6e[_0xbe1f('0x1a')];var _0x224543;if(_0xac2de5>=_0x50cb61){_0xac2de5=_0x50cb61;_0x224543=0xc8;}else{_0x224543=0xce;}_0x33be35[_0xbe1f('0x18')](_0x224543);return _0x33be35[_0xbe1f('0x1e')]('Content-Range',_0x394ac2+'-'+_0xac2de5+'/'+_0x50cb61)[_0xbe1f('0x19')](_0x392c4d);}return null;};}function patchUpdates(_0x30a323){return function(_0x6887da){try{jsonpatch[_0xbe1f('0x1f')](_0x6887da,_0x30a323,!![]);}catch(_0x5e8ec5){return BPromise[_0xbe1f('0x20')](_0x5e8ec5);}return _0x6887da['save']();};}function saveUpdates(_0x1c3fbf,_0x222d83){return function(_0x1a14c7){if(_0x1a14c7){return _0x1a14c7[_0xbe1f('0x21')](_0x1c3fbf)['then'](function(_0x1d3317){return _0x1d3317;});}return null;};}function removeEntity(_0x114da1,_0x22d284){return function(_0x574d6b){if(_0x574d6b){return _0x574d6b[_0xbe1f('0x22')]()['then'](function(){_0x114da1[_0xbe1f('0x18')](0xcc)[_0xbe1f('0x17')]();});}};}function handleEntityNotFound(_0x2253e9,_0x23a662){return function(_0x59efc0){if(!_0x59efc0){_0x2253e9[_0xbe1f('0x23')](0x194);}return _0x59efc0;};}function handleError(_0xe64d7a,_0x398f95){_0x398f95=_0x398f95||0x1f4;return function(_0x55a6cb){logger[_0xbe1f('0x24')](_0x55a6cb[_0xbe1f('0x25')]);if(_0x55a6cb[_0xbe1f('0x26')]){delete _0x55a6cb['name'];}_0xe64d7a[_0xbe1f('0x18')](_0x398f95)[_0xbe1f('0x27')](_0x55a6cb);};}exports[_0xbe1f('0x28')]=function(_0x1c7c34,_0x435e52){var _0x3e0966={},_0x1a4ff3={},_0x4d1502={'count':0x0,'rows':[]};var _0x5b2839=_['map'](db[_0xbe1f('0x29')]['rawAttributes'],function(_0x24dffa){return{'name':_0x24dffa[_0xbe1f('0x2a')],'type':_0x24dffa[_0xbe1f('0x2b')]['key']};});_0x1a4ff3[_0xbe1f('0x2c')]=_[_0xbe1f('0x2d')](_0x5b2839,_0xbe1f('0x26'));_0x1a4ff3[_0xbe1f('0x2e')]=_[_0xbe1f('0x2f')](_0x1c7c34[_0xbe1f('0x2e')]);_0x1a4ff3['filters']=_[_0xbe1f('0x30')](_0x1a4ff3[_0xbe1f('0x2c')],_0x1a4ff3[_0xbe1f('0x2e')]);_0x3e0966[_0xbe1f('0x31')]=_[_0xbe1f('0x30')](_0x1a4ff3[_0xbe1f('0x2c')],qs[_0xbe1f('0x32')](_0x1c7c34[_0xbe1f('0x2e')]['fields']));_0x3e0966[_0xbe1f('0x31')]=_0x3e0966[_0xbe1f('0x31')][_0xbe1f('0x33')]?_0x3e0966['attributes']:_0x1a4ff3[_0xbe1f('0x2c')];if(!_0x1c7c34[_0xbe1f('0x2e')]['hasOwnProperty']('nolimit')){_0x3e0966[_0xbe1f('0x1a')]=qs[_0xbe1f('0x1a')](_0x1c7c34[_0xbe1f('0x2e')][_0xbe1f('0x1a')]);_0x3e0966['offset']=qs[_0xbe1f('0x1d')](_0x1c7c34[_0xbe1f('0x2e')][_0xbe1f('0x1d')]);}_0x3e0966[_0xbe1f('0x34')]=qs[_0xbe1f('0x35')](_0x1c7c34[_0xbe1f('0x2e')][_0xbe1f('0x35')]);_0x3e0966['where']=qs[_0xbe1f('0x36')](_[_0xbe1f('0x37')](_0x1c7c34[_0xbe1f('0x2e')],_0x1a4ff3[_0xbe1f('0x36')]),_0x5b2839);if(_0x1c7c34['query'][_0xbe1f('0x38')]){_0x3e0966[_0xbe1f('0x39')]=_[_0xbe1f('0x3a')](_0x3e0966[_0xbe1f('0x39')],{'$or':_[_0xbe1f('0x2d')](_0x5b2839,function(_0x561cc9){if(_0x561cc9[_0xbe1f('0x2b')]!==_0xbe1f('0x3b')){var _0x4a2459={};_0x4a2459[_0x561cc9[_0xbe1f('0x26')]]={'$like':'%'+_0x1c7c34[_0xbe1f('0x2e')]['filter']+'%'};return _0x4a2459;}})});}_0x3e0966=_[_0xbe1f('0x3a')]({},_0x3e0966,_0x1c7c34[_0xbe1f('0x3c')]);var _0x16efcb={'where':_0x3e0966['where']};return db[_0xbe1f('0x29')][_0xbe1f('0x1c')](_0x16efcb)['then'](function(_0x238d7a){_0x4d1502['count']=_0x238d7a;if(_0x1c7c34[_0xbe1f('0x2e')]['includeAll']){_0x3e0966[_0xbe1f('0x3d')]=[{'all':!![]}];}return db[_0xbe1f('0x29')]['findAll'](_0x3e0966);})[_0xbe1f('0x3e')](function(_0x5f8416){_0x4d1502[_0xbe1f('0x3f')]=_0x5f8416;return _0x4d1502;})[_0xbe1f('0x3e')](respondWithFilteredResult(_0x435e52,_0x3e0966))[_0xbe1f('0x40')](handleError(_0x435e52,null));};exports[_0xbe1f('0x41')]=function(_0x8b4506,_0x1924d9){var _0x3123d8={'raw':!![],'where':{'id':_0x8b4506[_0xbe1f('0x42')]['id']}},_0x1d178a={};_0x1d178a[_0xbe1f('0x2c')]=_[_0xbe1f('0x2f')](db[_0xbe1f('0x29')][_0xbe1f('0x43')]);_0x1d178a[_0xbe1f('0x2e')]=_[_0xbe1f('0x2f')](_0x8b4506[_0xbe1f('0x2e')]);_0x1d178a[_0xbe1f('0x36')]=_[_0xbe1f('0x30')](_0x1d178a['model'],_0x1d178a[_0xbe1f('0x2e')]);_0x3123d8['attributes']=_[_0xbe1f('0x30')](_0x1d178a['model'],qs[_0xbe1f('0x32')](_0x8b4506[_0xbe1f('0x2e')][_0xbe1f('0x32')]));_0x3123d8['attributes']=_0x3123d8[_0xbe1f('0x31')]['length']?_0x3123d8['attributes']:_0x1d178a[_0xbe1f('0x2c')];if(_0x8b4506[_0xbe1f('0x2e')]['includeAll']){_0x3123d8['include']=[{'all':!![]}];}_0x3123d8=_[_0xbe1f('0x3a')]({},_0x3123d8,_0x8b4506['options']);return db['VoiceTransferReport'][_0xbe1f('0x44')](_0x3123d8)[_0xbe1f('0x3e')](handleEntityNotFound(_0x1924d9,null))[_0xbe1f('0x3e')](respondWithResult(_0x1924d9,null))[_0xbe1f('0x40')](handleError(_0x1924d9,null));};exports['create']=function(_0x20c3ee,_0x1f9538){return db[_0xbe1f('0x29')]['create'](_0x20c3ee[_0xbe1f('0x45')],{})[_0xbe1f('0x3e')](respondWithResult(_0x1f9538,0xc9))['catch'](handleError(_0x1f9538,null));};exports[_0xbe1f('0x21')]=function(_0x21c74f,_0x1a9e13){if(_0x21c74f['body']['id']){delete _0x21c74f[_0xbe1f('0x45')]['id'];}return db[_0xbe1f('0x29')][_0xbe1f('0x44')]({'where':{'id':_0x21c74f[_0xbe1f('0x42')]['id']}})[_0xbe1f('0x3e')](handleEntityNotFound(_0x1a9e13,null))[_0xbe1f('0x3e')](saveUpdates(_0x21c74f[_0xbe1f('0x45')],null))[_0xbe1f('0x3e')](respondWithResult(_0x1a9e13,null))[_0xbe1f('0x40')](handleError(_0x1a9e13,null));};exports[_0xbe1f('0x22')]=function(_0x141308,_0x512072){return db[_0xbe1f('0x29')][_0xbe1f('0x44')]({'where':{'id':_0x141308[_0xbe1f('0x42')]['id']}})[_0xbe1f('0x3e')](handleEntityNotFound(_0x512072,null))['then'](removeEntity(_0x512072,null))[_0xbe1f('0x40')](handleError(_0x512072,null));};exports['describe']=function(_0x6d1f3c,_0x2c6dac){return db['VoiceTransferReport'][_0xbe1f('0x46')]()[_0xbe1f('0x3e')](respondWithResult(_0x2c6dac,null))[_0xbe1f('0x40')](handleError(_0x2c6dac,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c815a60..1ee0f01 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 _0x0d46=['../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','util','api','moment','bluebird','rimraf'];(function(_0x3844d1,_0x3f751f){var _0x5c8b23=function(_0x5e1e3e){while(--_0x5e1e3e){_0x3844d1['push'](_0x3844d1['shift']());}};_0x5c8b23(++_0x3f751f);}(_0x0d46,0x1c6));var _0x60d4=function(_0xb04100,_0x47bf43){_0xb04100=_0xb04100-0x0;var _0x270a57=_0x0d46[_0xb04100];return _0x270a57;};'use strict';var _=require('lodash');var util=require(_0x60d4('0x0'));var logger=require('../../config/logger')(_0x60d4('0x1'));var moment=require(_0x60d4('0x2'));var BPromise=require(_0x60d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x60d4('0x4'));var config=require(_0x60d4('0x5'));var attributes=require(_0x60d4('0x6'));module[_0x60d4('0x7')]=function(_0x2f6fef,_0x4b2d00){return _0x2f6fef['define'](_0x60d4('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac69=['VoiceTransferReport','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x18971b,_0x2dfc23){var _0xb2c9e2=function(_0x331f58){while(--_0x331f58){_0x18971b['push'](_0x18971b['shift']());}};_0xb2c9e2(++_0x2dfc23);}(_0xac69,0x79));var _0x9ac6=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xac69[_0x2160a9];return _0xa88cf7;};'use strict';var _=require('lodash');var util=require(_0x9ac6('0x0'));var logger=require(_0x9ac6('0x1'))(_0x9ac6('0x2'));var moment=require(_0x9ac6('0x3'));var BPromise=require(_0x9ac6('0x4'));var rp=require(_0x9ac6('0x5'));var fs=require('fs');var path=require(_0x9ac6('0x6'));var rimraf=require('rimraf');var config=require(_0x9ac6('0x7'));var attributes=require(_0x9ac6('0x8'));module[_0x9ac6('0x9')]=function(_0xba0a7,_0x1d31d6){return _0xba0a7[_0x9ac6('0xa')](_0x9ac6('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index bc48a6a..7b2ae83 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 _0x2839=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x2f176f,_0x2e3968){var _0x5d5d70=function(_0x5b25e7){while(--_0x5b25e7){_0x2f176f['push'](_0x2f176f['shift']());}};_0x5d5d70(++_0x2e3968);}(_0x2839,0xd8));var _0x9283=function(_0x3a790d,_0x48764f){_0x3a790d=_0x3a790d-0x0;var _0x6db16=_0x2839[_0x3a790d];return _0x6db16;};'use strict';var _=require(_0x9283('0x0'));var util=require(_0x9283('0x1'));var moment=require(_0x9283('0x2'));var BPromise=require(_0x9283('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9283('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9283('0x5'));var logger=require(_0x9283('0x6'))(_0x9283('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9283('0x8')][_0x9283('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x148b91,_0x370a1b,_0x5d5318){return new BPromise(function(_0x77161d,_0x5301dc){return client[_0x9283('0xa')](_0x148b91,_0x5d5318)[_0x9283('0xb')](function(_0x2e476e){logger[_0x9283('0xc')](_0x9283('0xd'),_0x370a1b,_0x9283('0xe'));logger[_0x9283('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x370a1b,'request\x20sent',JSON[_0x9283('0x10')](_0x2e476e));if(_0x2e476e[_0x9283('0x11')]){if(_0x2e476e[_0x9283('0x11')][_0x9283('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x370a1b,_0x2e476e[_0x9283('0x11')]['message']);return _0x5301dc(_0x2e476e[_0x9283('0x11')][_0x9283('0x13')]);}logger[_0x9283('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x370a1b,_0x2e476e['error'][_0x9283('0x13')]);return _0x77161d(_0x2e476e[_0x9283('0x11')]['message']);}else{logger[_0x9283('0xc')](_0x9283('0xd'),_0x370a1b,_0x9283('0xe'));_0x77161d(_0x2e476e[_0x9283('0x14')]['message']);}})[_0x9283('0x15')](function(_0x19934a){logger[_0x9283('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x370a1b,_0x19934a);_0x5301dc(_0x19934a);});});}exports[_0x9283('0x16')]=function(_0x3ac938){var _0xb8b0a=this;return new Promise(function(_0x16eeac,_0x17a7de){return db[_0x9283('0x17')][_0x9283('0x18')](_0x3ac938[_0x9283('0x19')],{'raw':_0x3ac938[_0x9283('0x1a')]?_0x3ac938['options']['raw']===undefined?!![]:![]:!![]})[_0x9283('0xb')](function(_0x2f6a71){logger[_0x9283('0xc')](_0x9283('0x16'),_0x3ac938);logger['debug'](_0x9283('0x16'),_0x3ac938,JSON[_0x9283('0x10')](_0x2f6a71));_0x16eeac(_0x2f6a71);})['catch'](function(_0x435326){logger[_0x9283('0x11')](_0x9283('0x16'),_0x435326['message'],_0x3ac938);_0x17a7de(_0xb8b0a[_0x9283('0x11')](0x1f4,_0x435326[_0x9283('0x13')]));});});}; \ No newline at end of file +var _0xe2a2=['../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','stringify','util','moment','../../config/logger','rpc'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xe2a2,0xab));var _0x2e2a=function(_0x5d8488,_0x440326){_0x5d8488=_0x5d8488-0x0;var _0x52309a=_0xe2a2[_0x5d8488];return _0x52309a;};'use strict';var _=require('lodash');var util=require(_0x2e2a('0x0'));var moment=require(_0x2e2a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e2a('0x2'))(_0x2e2a('0x3'));var config=require(_0x2e2a('0x4'));var jayson=require(_0x2e2a('0x5'));var client=jayson[_0x2e2a('0x6')][_0x2e2a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a34fa,_0xc57e26,_0x3d8e60){return new BPromise(function(_0x923a3b,_0x5a3d04){return client['request'](_0x4a34fa,_0x3d8e60)[_0x2e2a('0x8')](function(_0x1aa03a){logger[_0x2e2a('0x9')](_0x2e2a('0xa'),_0xc57e26,_0x2e2a('0xb'));logger[_0x2e2a('0xc')](_0x2e2a('0xd'),_0xc57e26,_0x2e2a('0xb'),JSON['stringify'](_0x1aa03a));if(_0x1aa03a[_0x2e2a('0xe')]){if(_0x1aa03a['error'][_0x2e2a('0xf')]===0x1f4){logger[_0x2e2a('0xe')](_0x2e2a('0xa'),_0xc57e26,_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);return _0x5a3d04(_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);}logger[_0x2e2a('0xe')](_0x2e2a('0xa'),_0xc57e26,_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);return _0x923a3b(_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);}else{logger[_0x2e2a('0x9')](_0x2e2a('0xa'),_0xc57e26,'request\x20sent');_0x923a3b(_0x1aa03a[_0x2e2a('0x11')]['message']);}})[_0x2e2a('0x12')](function(_0x2a8b1b){logger['error'](_0x2e2a('0xa'),_0xc57e26,_0x2a8b1b);_0x5a3d04(_0x2a8b1b);});});}exports[_0x2e2a('0x13')]=function(_0x512868){var _0x4fdd7e=this;return new Promise(function(_0x35fde6,_0xcf97e2){return db[_0x2e2a('0x14')][_0x2e2a('0x15')](_0x512868[_0x2e2a('0x16')],{'raw':_0x512868[_0x2e2a('0x17')]?_0x512868[_0x2e2a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2e2a('0x8')](function(_0x9f1088){logger['info'](_0x2e2a('0x13'),_0x512868);logger[_0x2e2a('0xc')](_0x2e2a('0x13'),_0x512868,JSON[_0x2e2a('0x18')](_0x9f1088));_0x35fde6(_0x9f1088);})[_0x2e2a('0x12')](function(_0x5cabc0){logger[_0x2e2a('0xe')]('CreateVoiceTransferReport',_0x5cabc0['message'],_0x512868);_0xcf97e2(_0x4fdd7e[_0x2e2a('0xe')](0x1f4,_0x5cabc0[_0x2e2a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0035d9b..0104f84 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 _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0x109c49,_0x14466d){var _0x4471fb=function(_0x566c2d){while(--_0x566c2d){_0x109c49['push'](_0x109c49['shift']());}};_0x4471fb(++_0x14466d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./webbar.controller');router['post'](_0x0a9e('0x3'),auth['isAuthenticated'](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0x5')]);router[_0x0a9e('0x6')](_0x0a9e('0x7'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x6')](_0x0a9e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x0a9e('0xb')]);router['post']('/hold',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller['unhold']);router['post']('/calls',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x6')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file +var _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x2fcc10,_0x137917){var _0x3ca41c=function(_0x4293d1){while(--_0x4293d1){_0x2fcc10['push'](_0x2fcc10['shift']());}};_0x3ca41c(++_0x137917);}(_0x9f62,0x154));var _0x29f6=function(_0x5cfd2f,_0x2f5926){_0x5cfd2f=_0x5cfd2f-0x0;var _0x50c032=_0x9f62[_0x5cfd2f];return _0x50c032;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fbd1ac9..30fc5cf 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 _0xfd28=['all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','hangup\x20executed!','answer\x20fired:','userId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','status','NotFound','then','code','message','result','catch','User','findOne','agent'];(function(_0x2d20c6,_0x4d3590){var _0x42f461=function(_0x203489){while(--_0x203489){_0x2d20c6['push'](_0x2d20c6['shift']());}};_0x42f461(++_0x4d3590);}(_0xfd28,0x148));var _0x8fd2=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xfd28[_0x3ba924];return _0x4cc1df;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8fd2('0x0'));var db=require(_0x8fd2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var jayson=require(_0x8fd2('0x3'));var amiClient=jayson[_0x8fd2('0x4')][_0x8fd2('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x8fd2('0x6'));var Redis=require(_0x8fd2('0x7'));config[_0x8fd2('0x8')]=_[_0x8fd2('0x9')](config[_0x8fd2('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fd2('0x8')]));var Schema=require(_0x8fd2('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8fd2('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8fd2('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xe')]},'transferNumber':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x20daca,_0x5ef478,_0x4f0b17){logger['info'](_0x20daca,_0x5ef478,JSON[_0x8fd2('0x10')](_0x4f0b17));io['to'](_0x20daca)[_0x8fd2('0x11')](_0x5ef478,_0x4f0b17);}function handleError(_0x1ced10){return function(_0x12e8a3){console['log'](_0x8fd2('0x12'),_0x12e8a3,_0x12e8a3 instanceof RangeError);logger[_0x8fd2('0x13')](_0x12e8a3[_0x8fd2('0x14')]);if(_0x12e8a3 instanceof RangeError){if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3[_0x8fd2('0x15')];}_0x1ced10['status'](0x194)['send'](_0x12e8a3);}else{if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3['name'];}_0x1ced10[_0x8fd2('0x16')](0x1f4)['send'](_0x12e8a3);}};}function checkError(){return function(_0x1631c6){if(!_0x1631c6){throw new RangeError(_0x8fd2('0x17'));}return _0x1631c6;};}function respondWithRpcPromise(_0x4f81dc,_0x122b60){return new BPromise(function(_0x4c2be8,_0xd3981f){var _0x44ee7a=amiClient;return _0x44ee7a['request'](_0x4f81dc,_0x122b60)[_0x8fd2('0x18')](function(_0x2a9c3c){if(_0x2a9c3c[_0x8fd2('0x13')]){if(_0x2a9c3c['error'][_0x8fd2('0x19')]===0x1f4){return _0xd3981f(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}return _0x4c2be8(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}else{_0x4c2be8(_0x2a9c3c[_0x8fd2('0x1b')]);}})[_0x8fd2('0x1c')](function(_0x398925){_0xd3981f(_0x398925);});});}function getAgent(_0x1456b4){return db[_0x8fd2('0x1d')][_0x8fd2('0x1e')]({'where':{'id':_0x1456b4,'role':_0x8fd2('0x1f')}})[_0x8fd2('0x18')](checkError());}function getAgentCheckSession(_0x512e5a,_0x4c6af7){return new BPromise(function(_0x345bc3,_0x1858a9){var _0x288bcd=respondWithRpcPromise('VoiceChannels');var _0x2f26ae=getAgent(_0x512e5a);Promise[_0x8fd2('0x20')]([_0x288bcd,_0x2f26ae])[_0x8fd2('0x18')](function(_0x960869){var _0x119439=_0x960869[0x0];var _0x4745bf=_0x960869[0x1];var _0x332ab0=_['filter'](_0x119439[_0x8fd2('0x21')],function(_0x13c9b9){return _0x13c9b9[_0x8fd2('0x22')]==_0x4745bf['id']&&_0x13c9b9[_0x8fd2('0x23')]==_0x4c6af7;});if(_0x332ab0[_0x8fd2('0x24')]==0x1){_0x345bc3(_0x4745bf);}else{_0x1858a9(new RangeError(_0x8fd2('0x25')+_0x4c6af7+_0x8fd2('0x26')));}});});}exports['originate']=function(_0x5b992a,_0x5144ba){logger[_0x8fd2('0x27')](_0x8fd2('0x28'),_0x5b992a[_0x8fd2('0x29')]);var _0xe4987b=originateValidation['validate'](_0x5b992a['body']);if(_0xe4987b[_0x8fd2('0x24')]>0x0){return _0x5144ba[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0xe4987b);}var _0x18fe4e=_0x5b992a[_0x8fd2('0x29')]['userId'];var _0x328964=_0x5b992a['body'][_0x8fd2('0x2b')];var _0x4ade8c=_0x5b992a[_0x8fd2('0x29')]['callerId'];var _0x134420=_0x5b992a[_0x8fd2('0x29')][_0x8fd2('0x2c')];return getAgent(_0x18fe4e)['then'](function(_0x339291){logger['info'](_0x8fd2('0x2d'),_0x339291[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x339291[_0x8fd2('0x15')]),_0x8fd2('0x2f'),{'callNumber':_0x328964,'callerId':_0x4ade8c,'callbackUrl':_0x134420});return _0x5144ba[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x30')});})[_0x8fd2('0x1c')](handleError(_0x5144ba));};exports[_0x8fd2('0x31')]=function(_0x4adfa2,_0x37a24b){logger[_0x8fd2('0x27')]('hangup\x20fired:',_0x4adfa2[_0x8fd2('0x29')]);var _0x130072=hangupValidation[_0x8fd2('0xa')](_0x4adfa2[_0x8fd2('0x29')]);if(_0x130072[_0x8fd2('0x24')]>0x0){return _0x37a24b[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x130072);}var _0x5e6140=_0x4adfa2[_0x8fd2('0x29')]['userId'];var _0x566c9e=_0x4adfa2[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x5e6140)[_0x8fd2('0x18')](function(_0x2edcfd){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2edcfd['name']);emit(util['format'](_0x8fd2('0x32'),_0x2edcfd['name']),'webbar:hangup',{'sessionId':_0x566c9e});return _0x37a24b[_0x8fd2('0x16')](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x33')});})[_0x8fd2('0x1c')](handleError(_0x37a24b));};exports['answer']=function(_0x39cd8e,_0x1d5458){logger[_0x8fd2('0x27')](_0x8fd2('0x34'),_0x39cd8e[_0x8fd2('0x29')]);var _0x1de9aa=answerValidation[_0x8fd2('0xa')](_0x39cd8e['body']);if(_0x1de9aa[_0x8fd2('0x24')]>0x0){return _0x1d5458[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1de9aa);}var _0x70404e=_0x39cd8e[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40a572=_0x39cd8e['body'][_0x8fd2('0x23')];return getAgent(_0x70404e)[_0x8fd2('0x18')](function(_0x2abd80){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2abd80[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2abd80[_0x8fd2('0x15')]),'webbar:answer',{'sessionId':_0x40a572});return _0x1d5458[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x36')});})[_0x8fd2('0x1c')](handleError(_0x1d5458));};exports[_0x8fd2('0x37')]=function(_0x5c0632,_0x290467){logger[_0x8fd2('0x27')](_0x8fd2('0x38'),_0x5c0632['body']);var _0x3c65c4=holdValidation['validate'](_0x5c0632[_0x8fd2('0x29')]);if(_0x3c65c4[_0x8fd2('0x24')]>0x0){return _0x290467[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x3c65c4);}var _0xc62e9e=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x34ffed=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0xc62e9e)[_0x8fd2('0x18')](function(_0x34f3a2){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x34f3a2[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x34f3a2[_0x8fd2('0x15')]),_0x8fd2('0x39'),{'sessionId':_0x34ffed});return _0x290467['status'](0xc8)['json']({'error':![],'message':_0x8fd2('0x3a')});})[_0x8fd2('0x1c')](handleError(_0x290467));};exports[_0x8fd2('0x3b')]=function(_0x5d79c3,_0x4d5b81){logger[_0x8fd2('0x27')]('unhold\x20fired:',_0x5d79c3[_0x8fd2('0x29')]);var _0x1295c4=unholdValidation[_0x8fd2('0xa')](_0x5d79c3['body']);if(_0x1295c4[_0x8fd2('0x24')]>0x0){return _0x4d5b81[_0x8fd2('0x16')](0x190)['json'](_0x1295c4);}var _0x331ada=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x56050f=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x331ada)[_0x8fd2('0x18')](function(_0x2c5766){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2c5766['name']);emit(util['format'](_0x8fd2('0x32'),_0x2c5766[_0x8fd2('0x15')]),'webbar:unhold',{'sessionId':_0x56050f});return _0x4d5b81[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x8fd2('0x1c')](handleError(_0x4d5b81));};exports[_0x8fd2('0x3c')]=function(_0x337354,_0x29a00e){logger[_0x8fd2('0x27')](_0x8fd2('0x3d'),_0x29a00e['body']);var _0x2f4759=callsValidation[_0x8fd2('0xa')](_0x337354[_0x8fd2('0x29')]);if(_0x2f4759[_0x8fd2('0x24')]>0x0){return _0x29a00e[_0x8fd2('0x16')](0x190)['json'](_0x2f4759);}var _0x5cf641=_0x337354['body']['userId'];var _0x57b8f6=respondWithRpcPromise(_0x8fd2('0x3e'));var _0x382154=getAgent(_0x5cf641);return Promise[_0x8fd2('0x20')]([_0x57b8f6,_0x382154])[_0x8fd2('0x18')](function(_0x21696c){var _0x25abdc=_0x21696c[0x0];var _0x460f31=_0x21696c[0x1];var _0x4a81ab=_[_0x8fd2('0x3f')](_0x25abdc['rows'],function(_0x351cfe){return _0x351cfe[_0x8fd2('0x22')]==_0x460f31['id'];});return _0x29a00e['status'](0xc8)['json']({'count':_0x4a81ab[_0x8fd2('0x24')],'rows':_0x4a81ab});})[_0x8fd2('0x1c')](handleError(_0x29a00e));};exports[_0x8fd2('0x40')]=function(_0x30a952,_0x37ddfa){logger['info'](_0x8fd2('0x41'),_0x30a952[_0x8fd2('0x29')]);var _0x1b46d6=conferenceValidation[_0x8fd2('0xa')](_0x30a952['body']);if(_0x1b46d6[_0x8fd2('0x24')]>0x0){return _0x37ddfa[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1b46d6);}var _0x23c608=_0x30a952['body']['userId'];return getAgent(_0x23c608)['then'](function(_0x2e5693){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2e5693[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2e5693[_0x8fd2('0x15')]),_0x8fd2('0x42'));return _0x37ddfa['status'](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x43')});})[_0x8fd2('0x1c')](handleError(_0x37ddfa));};exports[_0x8fd2('0x44')]=function(_0x305d83,_0x5547c7){logger[_0x8fd2('0x27')](_0x8fd2('0x45'),_0x305d83[_0x8fd2('0x29')]);var _0x4606f7=transferValidation[_0x8fd2('0xa')](_0x305d83[_0x8fd2('0x29')]);if(_0x4606f7[_0x8fd2('0x24')]>0x0){return _0x5547c7[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x4606f7);}var _0x4680f0=_0x305d83[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40ffd5=_0x305d83['body'][_0x8fd2('0x23')];var _0x237756=_0x305d83['body']['transferNumber'];return getAgent(_0x4680f0)['then'](function(_0x2bd1d0){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2bd1d0[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x2bd1d0['name']),_0x8fd2('0x46'),{'sessionId':_0x40ffd5,'transferNumber':_0x237756});return _0x5547c7[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x47')});})['catch'](handleError(_0x5547c7));}; \ No newline at end of file +var _0xa25c=['unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','defaults','localhost','socket.io-emitter','redis','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','callNumber','callbackUrl','entityFound:','user:%s','originate\x20executed!','catch','hangup\x20fired:','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','answer\x20executed!','hold','webbar:hold','hold\x20executed!'];(function(_0xaa99fe,_0x358171){var _0x4bdc46=function(_0x591926){while(--_0x591926){_0xaa99fe['push'](_0xaa99fe['shift']());}};_0x4bdc46(++_0x358171);}(_0xa25c,0x13f));var _0xca25=function(_0xa57c50,_0x1c6754){_0xa57c50=_0xa57c50-0x0;var _0x2c55b4=_0xa25c[_0xa57c50];return _0x2c55b4;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xca25('0x0'));var db=require(_0xca25('0x1'))['db'];var config=require(_0xca25('0x2'));var util=require(_0xca25('0x3'));var BPromise=require(_0xca25('0x4'));var jayson=require(_0xca25('0x5'));var amiClient=jayson[_0xca25('0x6')][_0xca25('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xca25('0x8'));var Redis=require('ioredis');config['redis']=_[_0xca25('0x9')](config['redis'],{'host':_0xca25('0xa'),'port':0x18eb});var io=require(_0xca25('0xb'))(new Redis(config[_0xca25('0xc')]));var Schema=require(_0xca25('0xd'));var originateValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xca25('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xca25('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xca25('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xca25('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':_0xca25('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':_0xca25('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]}});function emit(_0x2b5cef,_0x587403,_0x3616c3){logger[_0xca25('0x12')](_0x2b5cef,_0x587403,JSON['stringify'](_0x3616c3));io['to'](_0x2b5cef)[_0xca25('0x13')](_0x587403,_0x3616c3);}function handleError(_0x2add52){return function(_0x3705a0){console[_0xca25('0x14')](_0xca25('0x15'),_0x3705a0,_0x3705a0 instanceof RangeError);logger['error'](_0x3705a0[_0xca25('0x16')]);if(_0x3705a0 instanceof RangeError){if(_0x3705a0[_0xca25('0x17')]){delete _0x3705a0[_0xca25('0x17')];}_0x2add52[_0xca25('0x18')](0x194)[_0xca25('0x19')](_0x3705a0);}else{if(_0x3705a0['name']){delete _0x3705a0[_0xca25('0x17')];}_0x2add52[_0xca25('0x18')](0x1f4)[_0xca25('0x19')](_0x3705a0);}};}function checkError(){return function(_0x1f69c6){if(!_0x1f69c6){throw new RangeError(_0xca25('0x1a'));}return _0x1f69c6;};}function respondWithRpcPromise(_0x38d6e6,_0x292c88){return new BPromise(function(_0x54c91a,_0x48fdf5){var _0x23f69a=amiClient;return _0x23f69a[_0xca25('0x1b')](_0x38d6e6,_0x292c88)[_0xca25('0x1c')](function(_0x1596dd){if(_0x1596dd[_0xca25('0x1d')]){if(_0x1596dd[_0xca25('0x1d')][_0xca25('0x1e')]===0x1f4){return _0x48fdf5(_0x1596dd[_0xca25('0x1d')][_0xca25('0x1f')]);}return _0x54c91a(_0x1596dd[_0xca25('0x1d')][_0xca25('0x1f')]);}else{_0x54c91a(_0x1596dd[_0xca25('0x20')]);}})['catch'](function(_0x1aa848){_0x48fdf5(_0x1aa848);});});}function getAgent(_0x359369){return db[_0xca25('0x21')][_0xca25('0x22')]({'where':{'id':_0x359369,'role':_0xca25('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x274de1,_0x41eb3a){return new BPromise(function(_0x3d7414,_0xd61524){var _0x2ae0e3=respondWithRpcPromise(_0xca25('0x24'));var _0xfd888c=getAgent(_0x274de1);Promise[_0xca25('0x25')]([_0x2ae0e3,_0xfd888c])[_0xca25('0x1c')](function(_0x7b67f4){var _0x190f27=_0x7b67f4[0x0];var _0x315f76=_0x7b67f4[0x1];var _0x5078e4=_[_0xca25('0x26')](_0x190f27[_0xca25('0x27')],function(_0x2433bb){return _0x2433bb[_0xca25('0x28')]==_0x315f76['id']&&_0x2433bb[_0xca25('0x29')]==_0x41eb3a;});if(_0x5078e4['length']==0x1){_0x3d7414(_0x315f76);}else{_0xd61524(new RangeError(_0xca25('0x2a')+_0x41eb3a+_0xca25('0x2b')));}});});}exports[_0xca25('0x2c')]=function(_0x566090,_0xe86982){logger[_0xca25('0x12')](_0xca25('0x2d'),_0x566090[_0xca25('0x2e')]);var _0x2c863b=originateValidation[_0xca25('0xd')](_0x566090['body']);if(_0x2c863b[_0xca25('0x2f')]>0x0){return _0xe86982['status'](0x190)[_0xca25('0x30')](_0x2c863b);}var _0xe41c26=_0x566090[_0xca25('0x2e')]['userId'];var _0xc3f6d0=_0x566090[_0xca25('0x2e')][_0xca25('0x31')];var _0x20cdd4=_0x566090[_0xca25('0x2e')]['callerId'];var _0x86a223=_0x566090[_0xca25('0x2e')][_0xca25('0x32')];return getAgent(_0xe41c26)[_0xca25('0x1c')](function(_0x29d1a0){logger[_0xca25('0x12')](_0xca25('0x33'),_0x29d1a0['name']);emit(util['format'](_0xca25('0x34'),_0x29d1a0[_0xca25('0x17')]),'webbar:originate',{'callNumber':_0xc3f6d0,'callerId':_0x20cdd4,'callbackUrl':_0x86a223});return _0xe86982['status'](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x35')});})[_0xca25('0x36')](handleError(_0xe86982));};exports['hangup']=function(_0x9c1ce3,_0x46c72f){logger[_0xca25('0x12')](_0xca25('0x37'),_0x9c1ce3[_0xca25('0x2e')]);var _0xd1d480=hangupValidation['validate'](_0x9c1ce3[_0xca25('0x2e')]);if(_0xd1d480['length']>0x0){return _0x46c72f[_0xca25('0x18')](0x190)[_0xca25('0x30')](_0xd1d480);}var _0x391beb=_0x9c1ce3[_0xca25('0x2e')][_0xca25('0x38')];var _0xe41645=_0x9c1ce3[_0xca25('0x2e')][_0xca25('0x29')];return getAgent(_0x391beb)[_0xca25('0x1c')](function(_0x513995){logger[_0xca25('0x12')]('entityFound:',_0x513995[_0xca25('0x17')]);emit(util['format'](_0xca25('0x34'),_0x513995[_0xca25('0x17')]),_0xca25('0x39'),{'sessionId':_0xe41645});return _0x46c72f[_0xca25('0x18')](0xc8)['json']({'error':![],'message':_0xca25('0x3a')});})['catch'](handleError(_0x46c72f));};exports[_0xca25('0x3b')]=function(_0x3c2d2b,_0x4bbbe5){logger[_0xca25('0x12')](_0xca25('0x3c'),_0x3c2d2b[_0xca25('0x2e')]);var _0x2ff9c2=answerValidation[_0xca25('0xd')](_0x3c2d2b[_0xca25('0x2e')]);if(_0x2ff9c2[_0xca25('0x2f')]>0x0){return _0x4bbbe5['status'](0x190)[_0xca25('0x30')](_0x2ff9c2);}var _0x300e20=_0x3c2d2b['body']['userId'];var _0x487710=_0x3c2d2b['body'][_0xca25('0x29')];return getAgent(_0x300e20)[_0xca25('0x1c')](function(_0x17d964){logger[_0xca25('0x12')]('entityFound:',_0x17d964[_0xca25('0x17')]);emit(util[_0xca25('0x3d')](_0xca25('0x34'),_0x17d964[_0xca25('0x17')]),'webbar:answer',{'sessionId':_0x487710});return _0x4bbbe5[_0xca25('0x18')](0xc8)['json']({'error':![],'message':_0xca25('0x3e')});})[_0xca25('0x36')](handleError(_0x4bbbe5));};exports[_0xca25('0x3f')]=function(_0x17748d,_0x47855b){logger[_0xca25('0x12')]('hold\x20fired:',_0x17748d[_0xca25('0x2e')]);var _0x25406a=holdValidation[_0xca25('0xd')](_0x17748d[_0xca25('0x2e')]);if(_0x25406a[_0xca25('0x2f')]>0x0){return _0x47855b[_0xca25('0x18')](0x190)[_0xca25('0x30')](_0x25406a);}var _0x352a17=_0x17748d[_0xca25('0x2e')][_0xca25('0x38')];var _0x2b393e=_0x17748d[_0xca25('0x2e')][_0xca25('0x29')];return getAgent(_0x352a17)[_0xca25('0x1c')](function(_0x3279e0){logger[_0xca25('0x12')](_0xca25('0x33'),_0x3279e0[_0xca25('0x17')]);emit(util['format'](_0xca25('0x34'),_0x3279e0[_0xca25('0x17')]),_0xca25('0x40'),{'sessionId':_0x2b393e});return _0x47855b[_0xca25('0x18')](0xc8)['json']({'error':![],'message':_0xca25('0x41')});})[_0xca25('0x36')](handleError(_0x47855b));};exports['unhold']=function(_0x2bc528,_0x10692f){logger[_0xca25('0x12')](_0xca25('0x42'),_0x2bc528['body']);var _0x42458c=unholdValidation['validate'](_0x2bc528[_0xca25('0x2e')]);if(_0x42458c['length']>0x0){return _0x10692f['status'](0x190)[_0xca25('0x30')](_0x42458c);}var _0x1523d5=_0x2bc528[_0xca25('0x2e')][_0xca25('0x38')];var _0x4f2545=_0x2bc528['body'][_0xca25('0x29')];return getAgent(_0x1523d5)['then'](function(_0x1a2104){logger[_0xca25('0x12')](_0xca25('0x33'),_0x1a2104[_0xca25('0x17')]);emit(util[_0xca25('0x3d')]('user:%s',_0x1a2104['name']),_0xca25('0x43'),{'sessionId':_0x4f2545});return _0x10692f[_0xca25('0x18')](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x44')});})[_0xca25('0x36')](handleError(_0x10692f));};exports[_0xca25('0x45')]=function(_0x57a0ec,_0x25ba04){logger[_0xca25('0x12')](_0xca25('0x46'),_0x25ba04[_0xca25('0x2e')]);var _0x86fc48=callsValidation[_0xca25('0xd')](_0x57a0ec[_0xca25('0x2e')]);if(_0x86fc48[_0xca25('0x2f')]>0x0){return _0x25ba04[_0xca25('0x18')](0x190)['json'](_0x86fc48);}var _0x25c761=_0x57a0ec[_0xca25('0x2e')][_0xca25('0x38')];var _0x229d10=respondWithRpcPromise(_0xca25('0x24'));var _0x12e593=getAgent(_0x25c761);return Promise[_0xca25('0x25')]([_0x229d10,_0x12e593])[_0xca25('0x1c')](function(_0x5e01e3){var _0x8f8666=_0x5e01e3[0x0];var _0x539e9d=_0x5e01e3[0x1];var _0x30ff33=_[_0xca25('0x26')](_0x8f8666[_0xca25('0x27')],function(_0x55ad12){return _0x55ad12['UserId']==_0x539e9d['id'];});return _0x25ba04['status'](0xc8)[_0xca25('0x30')]({'count':_0x30ff33[_0xca25('0x2f')],'rows':_0x30ff33});})[_0xca25('0x36')](handleError(_0x25ba04));};exports[_0xca25('0x47')]=function(_0x5a39f9,_0x3d1bed){logger[_0xca25('0x12')](_0xca25('0x48'),_0x5a39f9['body']);var _0x414209=conferenceValidation['validate'](_0x5a39f9['body']);if(_0x414209['length']>0x0){return _0x3d1bed[_0xca25('0x18')](0x190)[_0xca25('0x30')](_0x414209);}var _0x42e898=_0x5a39f9[_0xca25('0x2e')][_0xca25('0x38')];return getAgent(_0x42e898)[_0xca25('0x1c')](function(_0x4f3ef4){logger[_0xca25('0x12')](_0xca25('0x33'),_0x4f3ef4['name']);emit(util[_0xca25('0x3d')]('user:%s',_0x4f3ef4[_0xca25('0x17')]),'webbar:conference');return _0x3d1bed['status'](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x49')});})['catch'](handleError(_0x3d1bed));};exports['transfer']=function(_0x53e34b,_0x50b57e){logger['info'](_0xca25('0x4a'),_0x53e34b[_0xca25('0x2e')]);var _0x4b3af2=transferValidation['validate'](_0x53e34b['body']);if(_0x4b3af2['length']>0x0){return _0x50b57e[_0xca25('0x18')](0x190)['json'](_0x4b3af2);}var _0x4cc0b3=_0x53e34b[_0xca25('0x2e')][_0xca25('0x38')];var _0x29f7c3=_0x53e34b[_0xca25('0x2e')]['sessionId'];var _0x486f42=_0x53e34b[_0xca25('0x2e')]['transferNumber'];return getAgent(_0x4cc0b3)[_0xca25('0x1c')](function(_0x2c2ce7){logger['info'](_0xca25('0x33'),_0x2c2ce7[_0xca25('0x17')]);emit(util[_0xca25('0x3d')](_0xca25('0x34'),_0x2c2ce7[_0xca25('0x17')]),_0xca25('0x4b'),{'sessionId':_0x29f7c3,'transferNumber':_0x486f42});return _0x50b57e[_0xca25('0x18')](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x4c')});})['catch'](handleError(_0x50b57e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d166890..506f9e1 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 _0x6648=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','notify','send','put','delete','removeAnswers'];(function(_0x24d1c1,_0x365bf3){var _0x908781=function(_0x40eb3f){while(--_0x40eb3f){_0x24d1c1['push'](_0x24d1c1['shift']());}};_0x908781(++_0x365bf3);}(_0x6648,0x155));var _0x8664=function(_0x39c28d,_0x3a0f3e){_0x39c28d=_0x39c28d-0x0;var _0x3fde80=_0x6648[_0x39c28d];return _0x3fde80;};'use strict';var multer=require(_0x8664('0x0'));var util=require('util');var path=require(_0x8664('0x1'));var timeout=require(_0x8664('0x2'));var express=require(_0x8664('0x3'));var router=express[_0x8664('0x4')]();var fs_extra=require(_0x8664('0x5'));var auth=require(_0x8664('0x6'));var interaction=require(_0x8664('0x7'));var config=require('../../config/environment');var controller=require(_0x8664('0x8'));router[_0x8664('0x9')]('/',auth[_0x8664('0xa')](),controller[_0x8664('0xb')]);router['get'](_0x8664('0xc'),auth[_0x8664('0xa')](),controller['describe']);router['get'](_0x8664('0xd'),auth[_0x8664('0xa')](),controller[_0x8664('0xe')]);router[_0x8664('0x9')](_0x8664('0xf'),auth[_0x8664('0xa')](),controller['getDispositions']);router['get'](_0x8664('0x10'),auth[_0x8664('0xa')](),controller['getAnswers']);router[_0x8664('0x9')](_0x8664('0x11'),auth[_0x8664('0xa')](),controller[_0x8664('0x12')]);router[_0x8664('0x9')](_0x8664('0x13'),auth['isAuthenticated'](),controller[_0x8664('0x14')]);router[_0x8664('0x15')]('/',auth['isAuthenticated'](),controller[_0x8664('0x16')]);router[_0x8664('0x15')](_0x8664('0xf'),auth[_0x8664('0xa')](),controller[_0x8664('0x17')]);router[_0x8664('0x15')](_0x8664('0x10'),auth[_0x8664('0xa')](),controller[_0x8664('0x18')]);router[_0x8664('0x15')](_0x8664('0x11'),auth[_0x8664('0xa')](),controller['addAgents']);router[_0x8664('0x15')](_0x8664('0x13'),auth[_0x8664('0xa')](),controller[_0x8664('0x19')]);router[_0x8664('0x15')]('/:id/notify',controller[_0x8664('0x1a')]);router['post']('/:id/send',auth[_0x8664('0xa')](),controller[_0x8664('0x1b')]);router[_0x8664('0x1c')](_0x8664('0xd'),auth[_0x8664('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8664('0xa')](),controller['destroy']);router[_0x8664('0x1d')](_0x8664('0xf'),auth[_0x8664('0xa')](),controller['removeDispositions']);router[_0x8664('0x1d')]('/:id/canned_answers',auth[_0x8664('0xa')](),controller[_0x8664('0x1e')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5d38=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','send','put','update','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x3848ab,_0x910615){var _0x92433d=function(_0x273574){while(--_0x273574){_0x3848ab['push'](_0x3848ab['shift']());}};_0x92433d(++_0x910615);}(_0x5d38,0x7e));var _0x85d3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5d38[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require(_0x85d3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d3('0x1')]();var fs_extra=require(_0x85d3('0x2'));var auth=require(_0x85d3('0x3'));var interaction=require(_0x85d3('0x4'));var config=require(_0x85d3('0x5'));var controller=require(_0x85d3('0x6'));router[_0x85d3('0x7')]('/',auth[_0x85d3('0x8')](),controller[_0x85d3('0x9')]);router[_0x85d3('0x7')](_0x85d3('0xa'),auth['isAuthenticated'](),controller[_0x85d3('0xb')]);router[_0x85d3('0x7')](_0x85d3('0xc'),auth[_0x85d3('0x8')](),controller[_0x85d3('0xd')]);router[_0x85d3('0x7')](_0x85d3('0xe'),auth[_0x85d3('0x8')](),controller[_0x85d3('0xf')]);router[_0x85d3('0x7')](_0x85d3('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/users',auth[_0x85d3('0x8')](),controller[_0x85d3('0x11')]);router['get'](_0x85d3('0x12'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x13')]);router[_0x85d3('0x14')]('/',auth[_0x85d3('0x8')](),controller[_0x85d3('0x15')]);router[_0x85d3('0x14')](_0x85d3('0xe'),auth['isAuthenticated'](),controller[_0x85d3('0x16')]);router['post'](_0x85d3('0x10'),auth['isAuthenticated'](),controller[_0x85d3('0x17')]);router[_0x85d3('0x14')]('/:id/users',auth[_0x85d3('0x8')](),controller[_0x85d3('0x18')]);router[_0x85d3('0x14')](_0x85d3('0x12'),auth['isAuthenticated'](),controller['addApplications']);router[_0x85d3('0x14')]('/:id/notify',controller['notify']);router[_0x85d3('0x14')]('/:id/send',auth['isAuthenticated'](),controller[_0x85d3('0x19')]);router[_0x85d3('0x1a')](_0x85d3('0xc'),auth['isAuthenticated'](),controller[_0x85d3('0x1b')]);router['delete']('/:id',auth[_0x85d3('0x8')](),controller[_0x85d3('0x1c')]);router['delete'](_0x85d3('0xe'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x1d')]);router['delete'](_0x85d3('0x10'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x1e')]);router['delete'](_0x85d3('0x1f'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x20')]);module[_0x85d3('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6460e2f..31932ce 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 _0x4e03=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN'];(function(_0x3b7b47,_0x411888){var _0x4ea682=function(_0xe57c1e){while(--_0xe57c1e){_0x3b7b47['push'](_0x3b7b47['shift']());}};_0x4ea682(++_0x411888);}(_0x4e03,0x1e5));var _0x34e0=function(_0x5190a2,_0x484f48){_0x5190a2=_0x5190a2-0x0;var _0x271d07=_0x4e03[_0x5190a2];return _0x271d07;};'use strict';var Sequelize=require(_0x34e0('0x0'));var rs=require('randomstring');module[_0x34e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x34e0('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x34e0('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x34e0('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x34e0('0x3')],'defaultValue':function(){return rs[_0x34e0('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x34e0('0x5'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x34e0('0x3')]},'authToken':{'type':Sequelize[_0x34e0('0x3')]},'notificationTemplate':{'type':Sequelize[_0x34e0('0x6')],'defaultValue':function(){return _0x34e0('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x34e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x34e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x34e0('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x34e0('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x34e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x34e0('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x34e0('0x9')],'defaultValue':![],'comment':_0x34e0('0xb'),'set':function(_0x145f1d){if(!_0x145f1d){this[_0x34e0('0xc')](_0x34e0('0xd'),null);}this[_0x34e0('0xc')](_0x34e0('0xe'),_0x145f1d);}},'description':{'type':Sequelize[_0x34e0('0x3')]}}; \ No newline at end of file +var _0xd8ed=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2de5a1,_0x5b9802){var _0x2edfe0=function(_0x1e1083){while(--_0x1e1083){_0x2de5a1['push'](_0x2de5a1['shift']());}};_0x2edfe0(++_0x5b9802);}(_0xd8ed,0xe4));var _0xdd8e=function(_0x2d3a65,_0x57fe15){_0x2d3a65=_0x2d3a65-0x0;var _0x47065b=_0xd8ed[_0x2d3a65];return _0x47065b;};'use strict';var Sequelize=require(_0xdd8e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xdd8e('0x1')],'unique':_0xdd8e('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdd8e('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xdd8e('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xdd8e('0x1')]},'type':{'type':Sequelize[_0xdd8e('0x3')](_0xdd8e('0x4'),_0xdd8e('0x5'))},'accountSid':{'type':Sequelize[_0xdd8e('0x1')]},'baseUrl':{'type':Sequelize[_0xdd8e('0x1')]},'authToken':{'type':Sequelize[_0xdd8e('0x1')]},'notificationTemplate':{'type':Sequelize[_0xdd8e('0x6')],'defaultValue':function(){return _0xdd8e('0x7');}},'notificationSound':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdd8e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdd8e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd8e('0x9')],'comment':_0xdd8e('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![],'comment':_0xdd8e('0xb'),'set':function(_0x28554a){if(!_0x28554a){this[_0xdd8e('0xc')](_0xdd8e('0xd'),null);}this['setDataValue'](_0xdd8e('0xe'),_0x28554a);}},'description':{'type':Sequelize[_0xdd8e('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 294ebef..035b11c 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 _0x317b=['difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','DESC','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','get','WhatsappAccounts','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addDisposition','WhatsappAccountId','Disposition','findOne','nolimit','options','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','sendStatus','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','describe','no\x20available\x20attributes'];(function(_0x58cc99,_0x5708fb){var _0x5aab94=function(_0x4f74bf){while(--_0x4f74bf){_0x58cc99['push'](_0x58cc99['shift']());}};_0x5aab94(++_0x5708fb);}(_0x317b,0x1c7));var _0xb317=function(_0x5947b4,_0xa51f11){_0x5947b4=_0x5947b4-0x0;var _0x162caa=_0x317b[_0x5947b4];return _0x162caa;};'use strict';var emlformat=require(_0xb317('0x0'));var rimraf=require(_0xb317('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb317('0x2'));var rp=require(_0xb317('0x3'));var moment=require('moment');var BPromise=require(_0xb317('0x4'));var Mustache=require(_0xb317('0x5'));var util=require(_0xb317('0x6'));var path=require(_0xb317('0x7'));var sox=require(_0xb317('0x8'));var csv=require(_0xb317('0x9'));var ejs=require(_0xb317('0xa'));var fs=require('fs');var fs_extra=require(_0xb317('0xb'));var _=require(_0xb317('0xc'));var squel=require(_0xb317('0xd'));var crypto=require('crypto');var jsforce=require(_0xb317('0xe'));var deskjs=require(_0xb317('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb317('0x10'));var Papa=require(_0xb317('0x11'));var Redis=require(_0xb317('0x12'));var authService=require(_0xb317('0x13'));var qs=require(_0xb317('0x14'));var as=require(_0xb317('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb317('0x16'))(_0xb317('0x17'));var utils=require('../../config/utils');var config=require(_0xb317('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb317('0x19'))['db'];config[_0xb317('0x1a')]=_[_0xb317('0x1b')](config[_0xb317('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb317('0x1c'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xb317('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb317('0x1e')][_0xb317('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2ef2c6,_0x5f288e,_0x4ade83,_0x5f1f1d){return new BPromise(function(_0x46e95a,_0x48e812){var _0x266bdc=_0x5f1f1d||client;return _0x266bdc[_0xb317('0x20')](_0x2ef2c6,_0x4ade83)['then'](function(_0x477660){logger[_0xb317('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x5f288e,'request\x20sent');logger[_0xb317('0x22')](_0xb317('0x23'),_0x5f288e,_0xb317('0x24'),JSON[_0xb317('0x25')](_0x477660));if(_0x477660[_0xb317('0x26')]){if(_0x477660['error'][_0xb317('0x27')]===0x1f4){logger[_0xb317('0x26')](_0xb317('0x28'),_0x5f288e,_0x477660[_0xb317('0x26')][_0xb317('0x29')]);return _0x48e812(_0x477660[_0xb317('0x26')][_0xb317('0x29')]);}logger[_0xb317('0x26')](_0xb317('0x28'),_0x5f288e,_0x477660[_0xb317('0x26')][_0xb317('0x29')]);return _0x46e95a(_0x477660[_0xb317('0x26')][_0xb317('0x29')]);}else{logger[_0xb317('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x5f288e,_0xb317('0x24'));_0x46e95a(_0x477660['result'][_0xb317('0x29')]);}})[_0xb317('0x2a')](function(_0x3009fb){logger[_0xb317('0x26')](_0xb317('0x28'),_0x5f288e,_0x3009fb);_0x48e812(_0x3009fb);});});}function respondWithStatusCode(_0x1e32d4,_0x109189){_0x109189=_0x109189||0xcc;return function(_0x2fff27){if(_0x2fff27){return _0x1e32d4['sendStatus'](_0x109189);}return _0x1e32d4[_0xb317('0x2b')](_0x109189)[_0xb317('0x2c')]();};}function respondWithResult(_0x32fedb,_0x81db2f){_0x81db2f=_0x81db2f||0xc8;return function(_0x2960a8){if(_0x2960a8){return _0x32fedb[_0xb317('0x2b')](_0x81db2f)['json'](_0x2960a8);}};}function respondWithFilteredResult(_0x130c41,_0x35e446){return function(_0x5be03a){if(_0x5be03a){var _0x5c629c=typeof _0x35e446[_0xb317('0x2d')]===_0xb317('0x2e')&&typeof _0x35e446[_0xb317('0x2f')]==='undefined';var _0x79fbfb=_0x5be03a[_0xb317('0x30')];var _0xb475dd=_0x5c629c?0x0:_0x35e446[_0xb317('0x2d')];var _0x42f5a8=_0x5c629c?_0x5be03a['count']:_0x35e446[_0xb317('0x2d')]+_0x35e446['limit'];var _0x25f089;if(_0x42f5a8>=_0x79fbfb){_0x42f5a8=_0x79fbfb;_0x25f089=0xc8;}else{_0x25f089=0xce;}_0x130c41['status'](_0x25f089);return _0x130c41[_0xb317('0x31')](_0xb317('0x32'),_0xb475dd+'-'+_0x42f5a8+'/'+_0x79fbfb)[_0xb317('0x33')](_0x5be03a);}return null;};}function patchUpdates(_0x4a5857){return function(_0x2906e6){try{jsonpatch[_0xb317('0x34')](_0x2906e6,_0x4a5857,!![]);}catch(_0x1cf1e3){return BPromise['reject'](_0x1cf1e3);}return _0x2906e6['save']();};}function saveUpdates(_0x283e89,_0x4cf98a){return function(_0x4c0bc5){if(_0x4c0bc5){return _0x4c0bc5['update'](_0x283e89)[_0xb317('0x35')](function(_0x11ec74){return _0x11ec74;});}return null;};}function removeEntity(_0x3692cd,_0x401695){return function(_0x4f46ed){if(_0x4f46ed){return _0x4f46ed[_0xb317('0x36')]()[_0xb317('0x35')](function(){var _0x33b6eb=_0x4f46ed[_0xb317('0x37')]({'plain':!![]});var _0x5893b6=_0xb317('0x38');return db['UserProfileResource'][_0xb317('0x36')]({'where':{'type':_0x5893b6,'resourceId':_0x33b6eb['id']}})[_0xb317('0x35')](function(){return _0x4f46ed;});})[_0xb317('0x35')](function(){_0x3692cd[_0xb317('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24649a,_0x1aeee3){return function(_0x3bdd06){if(!_0x3bdd06){_0x24649a['sendStatus'](0x194);}return _0x3bdd06;};}function handleError(_0x1e5c26,_0x2aa6d8){_0x2aa6d8=_0x2aa6d8||0x1f4;return function(_0x3857fb){logger[_0xb317('0x26')](_0x3857fb['stack']);if(_0x3857fb[_0xb317('0x39')]){delete _0x3857fb[_0xb317('0x39')];}_0x1e5c26[_0xb317('0x2b')](_0x2aa6d8)[_0xb317('0x3a')](_0x3857fb);};}exports[_0xb317('0x3b')]=function(_0x319c11,_0xf3756e){var _0x502aa1={'include':[{'model':db[_0xb317('0x3c')],'as':_0xb317('0x3d')}]},_0x766c0a={},_0x5c2e8a={'count':0x0,'rows':[]};var _0x35ea1d=_['map'](db[_0xb317('0x3e')][_0xb317('0x3f')],function(_0x20a881){return{'name':_0x20a881[_0xb317('0x40')],'type':_0x20a881['type'][_0xb317('0x41')]};});_0x766c0a['model']=_[_0xb317('0x42')](_0x35ea1d,'name');_0x766c0a[_0xb317('0x43')]=_['keys'](_0x319c11[_0xb317('0x43')]);_0x766c0a['filters']=_[_0xb317('0x44')](_0x766c0a[_0xb317('0x45')],_0x766c0a[_0xb317('0x43')]);_0x502aa1['attributes']=_['intersection'](_0x766c0a[_0xb317('0x45')],qs[_0xb317('0x46')](_0x319c11['query'][_0xb317('0x46')]));_0x502aa1[_0xb317('0x47')]=_0x502aa1[_0xb317('0x47')][_0xb317('0x48')]?_0x502aa1[_0xb317('0x47')]:_0x766c0a['model'];if(!_0x319c11['query'][_0xb317('0x49')]('nolimit')){_0x502aa1[_0xb317('0x2f')]=qs[_0xb317('0x2f')](_0x319c11[_0xb317('0x43')][_0xb317('0x2f')]);_0x502aa1[_0xb317('0x2d')]=qs[_0xb317('0x2d')](_0x319c11[_0xb317('0x43')][_0xb317('0x2d')]);}_0x502aa1[_0xb317('0x4a')]=qs[_0xb317('0x4b')](_0x319c11[_0xb317('0x43')][_0xb317('0x4b')]);_0x502aa1[_0xb317('0x4c')]=qs['filters'](_[_0xb317('0x4d')](_0x319c11['query'],_0x766c0a[_0xb317('0x4e')]),_0x35ea1d);if(_0x319c11[_0xb317('0x43')][_0xb317('0x4f')]){_0x502aa1['where']=_['merge'](_0x502aa1[_0xb317('0x4c')],{'$or':_[_0xb317('0x42')](_0x35ea1d,function(_0x109ac8){if(_0x109ac8[_0xb317('0x50')]!==_0xb317('0x51')){var _0x4a8b59={};_0x4a8b59[_0x109ac8[_0xb317('0x39')]]={'$like':'%'+_0x319c11[_0xb317('0x43')][_0xb317('0x4f')]+'%'};return _0x4a8b59;}})});}_0x502aa1=_[_0xb317('0x52')]({},_0x502aa1,_0x319c11['options']);var _0xe343ba={'where':_0x502aa1[_0xb317('0x4c')]};return db[_0xb317('0x3e')][_0xb317('0x30')](_0xe343ba)[_0xb317('0x35')](function(_0x470b66){_0x5c2e8a['count']=_0x470b66;if(_0x319c11[_0xb317('0x43')][_0xb317('0x53')]){_0x502aa1[_0xb317('0x54')]=[{'all':!![]}];}return db[_0xb317('0x3e')][_0xb317('0x55')](_0x502aa1);})[_0xb317('0x35')](function(_0x27b7a5){_0x5c2e8a['rows']=_0x27b7a5;return _0x5c2e8a;})[_0xb317('0x35')](respondWithFilteredResult(_0xf3756e,_0x502aa1))[_0xb317('0x2a')](handleError(_0xf3756e,null));};exports[_0xb317('0x56')]=function(_0x25e5b3,_0x1e8505){var _0x3e7043={'raw':![],'where':{'id':_0x25e5b3['params']['id']},'include':[{'model':db[_0xb317('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4b6c3d={};_0x4b6c3d[_0xb317('0x45')]=_[_0xb317('0x57')](db[_0xb317('0x3e')][_0xb317('0x3f')]);_0x4b6c3d['query']=_[_0xb317('0x57')](_0x25e5b3['query']);_0x4b6c3d['filters']=_['intersection'](_0x4b6c3d[_0xb317('0x45')],_0x4b6c3d['query']);_0x3e7043['attributes']=_[_0xb317('0x44')](_0x4b6c3d[_0xb317('0x45')],qs[_0xb317('0x46')](_0x25e5b3[_0xb317('0x43')][_0xb317('0x46')]));_0x3e7043[_0xb317('0x47')]=_0x3e7043[_0xb317('0x47')][_0xb317('0x48')]?_0x3e7043[_0xb317('0x47')]:_0x4b6c3d[_0xb317('0x45')];if(_0x25e5b3[_0xb317('0x43')][_0xb317('0x53')]){_0x3e7043[_0xb317('0x54')]=[{'all':!![]}];}_0x3e7043=_[_0xb317('0x52')]({},_0x3e7043,_0x25e5b3['options']);return db[_0xb317('0x3e')][_0xb317('0x58')](_0x3e7043)[_0xb317('0x35')](handleEntityNotFound(_0x1e8505,null))[_0xb317('0x35')](respondWithResult(_0x1e8505,null))[_0xb317('0x2a')](handleError(_0x1e8505,null));};exports[_0xb317('0x59')]=function(_0x463e68,_0x59c961){return db[_0xb317('0x3e')][_0xb317('0x59')](_0x463e68[_0xb317('0x5a')],{})['then'](function(_0x2543b3){var _0x242ee8=_0x463e68[_0xb317('0x5b')][_0xb317('0x37')]({'plain':!![]});if(!_0x242ee8)throw new Error(_0xb317('0x5c'));if(_0x242ee8[_0xb317('0x5d')]==='user'){var _0x1ef67b=_0x2543b3[_0xb317('0x37')]({'plain':!![]});var _0x54b22e='WhatsappAccounts';return db[_0xb317('0x5e')][_0xb317('0x58')]({'where':{'name':_0x54b22e,'userProfileId':_0x242ee8[_0xb317('0x5f')]},'raw':!![]})[_0xb317('0x35')](function(_0x37b335){if(_0x37b335&&_0x37b335[_0xb317('0x60')]===0x0){return db[_0xb317('0x61')][_0xb317('0x59')]({'name':_0x1ef67b[_0xb317('0x39')],'resourceId':_0x1ef67b['id'],'type':_0x37b335[_0xb317('0x39')],'sectionId':_0x37b335['id']},{})[_0xb317('0x35')](function(){return _0x2543b3;});}else{return _0x2543b3;}})[_0xb317('0x2a')](function(_0x112751){logger[_0xb317('0x26')](_0xb317('0x62'),_0x112751);throw _0x112751;});}return _0x2543b3;})[_0xb317('0x35')](respondWithResult(_0x59c961,0xc9))[_0xb317('0x2a')](handleError(_0x59c961,null));};exports[_0xb317('0x63')]=function(_0xb602c5,_0x2546d4){if(_0xb602c5[_0xb317('0x5a')]['id']){delete _0xb602c5['body']['id'];}return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0xb602c5[_0xb317('0x64')]['id']},'include':[{'model':db[_0xb317('0x3c')],'as':_0xb317('0x3d')}]})[_0xb317('0x35')](handleEntityNotFound(_0x2546d4,null))[_0xb317('0x35')](saveUpdates(_0xb602c5[_0xb317('0x5a')],null))[_0xb317('0x35')](respondWithResult(_0x2546d4,null))['catch'](handleError(_0x2546d4,null));};exports[_0xb317('0x36')]=function(_0x52b10c,_0xb0831f){return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0x52b10c['params']['id']}})[_0xb317('0x35')](handleEntityNotFound(_0xb0831f,null))[_0xb317('0x35')](removeEntity(_0xb0831f,null))[_0xb317('0x2a')](handleError(_0xb0831f,null));};exports['describe']=function(_0x47eddd,_0x4dc031){return db[_0xb317('0x3e')]['describe']()['then'](respondWithResult(_0x4dc031,null))[_0xb317('0x2a')](handleError(_0x4dc031,null));};exports[_0xb317('0x65')]=function(_0x51f8eb,_0x2c38fe,_0x335776){if(_0x51f8eb[_0xb317('0x5a')]['id']){delete _0x51f8eb[_0xb317('0x5a')]['id'];}return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0x51f8eb['params']['id']}})[_0xb317('0x35')](handleEntityNotFound(_0x2c38fe,null))[_0xb317('0x35')](function(_0x1fb41c){if(_0x1fb41c){_0x51f8eb['body'][_0xb317('0x66')]=_0x1fb41c['id'];return db[_0xb317('0x67')][_0xb317('0x59')](_0x51f8eb[_0xb317('0x5a')]);}})['then'](respondWithResult(_0x2c38fe,null))['catch'](handleError(_0x2c38fe,null));};exports['getDispositions']=function(_0x4da015,_0x55678a,_0x5ab430){var _0x1dc2fa={'raw':![],'where':{}};var _0x527f9b={};var _0xad762a={'count':0x0,'rows':[]};return db[_0xb317('0x3e')][_0xb317('0x68')]({'where':{'id':_0x4da015[_0xb317('0x64')]['id']}})[_0xb317('0x35')](handleEntityNotFound(_0x55678a,null))[_0xb317('0x35')](function(_0x5861df){if(_0x5861df){_0x527f9b[_0xb317('0x45')]=_[_0xb317('0x57')](db['Disposition']['rawAttributes']);_0x527f9b[_0xb317('0x43')]=_[_0xb317('0x57')](_0x4da015[_0xb317('0x43')]);_0x527f9b[_0xb317('0x4e')]=_['intersection'](_0x527f9b[_0xb317('0x45')],_0x527f9b[_0xb317('0x43')]);_0x1dc2fa[_0xb317('0x47')]=_[_0xb317('0x44')](_0x527f9b[_0xb317('0x45')],qs[_0xb317('0x46')](_0x4da015[_0xb317('0x43')]['fields']));_0x1dc2fa[_0xb317('0x47')]=_0x1dc2fa[_0xb317('0x47')]['length']?_0x1dc2fa[_0xb317('0x47')]:_0x527f9b[_0xb317('0x45')];if(!_0x4da015[_0xb317('0x43')][_0xb317('0x49')](_0xb317('0x69'))){_0x1dc2fa[_0xb317('0x2f')]=qs[_0xb317('0x2f')](_0x4da015[_0xb317('0x43')][_0xb317('0x2f')]);_0x1dc2fa['offset']=qs[_0xb317('0x2d')](_0x4da015[_0xb317('0x43')][_0xb317('0x2d')]);}_0x1dc2fa[_0xb317('0x4a')]=qs[_0xb317('0x4b')](_0x4da015[_0xb317('0x43')][_0xb317('0x4b')]);_0x1dc2fa[_0xb317('0x4c')]=qs[_0xb317('0x4e')](_[_0xb317('0x4d')](_0x4da015[_0xb317('0x43')],_0x527f9b[_0xb317('0x4e')]));_0x1dc2fa[_0xb317('0x4c')][_0xb317('0x66')]=_0x5861df['id'];if(_0x4da015[_0xb317('0x43')][_0xb317('0x4f')]){_0x1dc2fa['where']=_[_0xb317('0x52')](_0x1dc2fa[_0xb317('0x4c')],{'$or':_[_0xb317('0x42')](_0x1dc2fa['attributes'],function(_0x5e97bd){var _0xf97468={};_0xf97468[_0x5e97bd]={'$like':'%'+_0x4da015[_0xb317('0x43')]['filter']+'%'};return _0xf97468;})});}_0x1dc2fa=_[_0xb317('0x52')]({},_0x1dc2fa,_0x4da015[_0xb317('0x6a')]);return db[_0xb317('0x67')][_0xb317('0x30')]({'where':_0x1dc2fa[_0xb317('0x4c')]})[_0xb317('0x35')](function(_0x5c0523){_0xad762a['count']=_0x5c0523;if(_0x4da015['query']['includeAll']){_0x1dc2fa['include']=[{'all':!![]}];}return db['Disposition'][_0xb317('0x55')](_0x1dc2fa);})[_0xb317('0x35')](function(_0x4d82d2){_0xad762a[_0xb317('0x6b')]=_0x4d82d2;return _0xad762a;});}})[_0xb317('0x35')](respondWithFilteredResult(_0x55678a,_0x1dc2fa))[_0xb317('0x2a')](handleError(_0x55678a,null));};exports[_0xb317('0x6c')]=function(_0x1d7dfc,_0x3ff607,_0x52ff00){return db[_0xb317('0x3e')]['find']({'where':{'id':_0x1d7dfc[_0xb317('0x64')]['id']}})['then'](handleEntityNotFound(_0x3ff607,null))[_0xb317('0x35')](function(_0x243eec){if(_0x243eec){return _0x243eec[_0xb317('0x6c')](_0x1d7dfc['query'][_0xb317('0x6d')]);}})['then'](respondWithStatusCode(_0x3ff607,null))['catch'](handleError(_0x3ff607,null));};exports['addAnswer']=function(_0x446394,_0x4919dd,_0x1cfea7){if(_0x446394[_0xb317('0x5a')]['id']){delete _0x446394[_0xb317('0x5a')]['id'];}return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0x446394[_0xb317('0x64')]['id']}})['then'](handleEntityNotFound(_0x4919dd,null))[_0xb317('0x35')](function(_0x1ab96f){if(_0x1ab96f){_0x446394[_0xb317('0x5a')][_0xb317('0x66')]=_0x1ab96f['id'];return db[_0xb317('0x6e')]['create'](_0x446394['body']);}})[_0xb317('0x35')](respondWithResult(_0x4919dd,null))[_0xb317('0x2a')](handleError(_0x4919dd,null));};exports[_0xb317('0x6f')]=function(_0x1f9ac3,_0x922f2e,_0x433e72){var _0x1de26a={'raw':![],'where':{}};var _0x2bb291={};var _0x5be820={'count':0x0,'rows':[]};return db[_0xb317('0x3e')][_0xb317('0x68')]({'where':{'id':_0x1f9ac3[_0xb317('0x64')]['id']}})[_0xb317('0x35')](handleEntityNotFound(_0x922f2e,null))[_0xb317('0x35')](function(_0x3f2eeb){if(_0x3f2eeb){_0x2bb291['model']=_[_0xb317('0x57')](db[_0xb317('0x6e')][_0xb317('0x3f')]);_0x2bb291[_0xb317('0x43')]=_[_0xb317('0x57')](_0x1f9ac3[_0xb317('0x43')]);_0x2bb291['filters']=_[_0xb317('0x44')](_0x2bb291[_0xb317('0x45')],_0x2bb291[_0xb317('0x43')]);_0x1de26a[_0xb317('0x47')]=_[_0xb317('0x44')](_0x2bb291[_0xb317('0x45')],qs[_0xb317('0x46')](_0x1f9ac3[_0xb317('0x43')][_0xb317('0x46')]));_0x1de26a[_0xb317('0x47')]=_0x1de26a[_0xb317('0x47')]['length']?_0x1de26a[_0xb317('0x47')]:_0x2bb291[_0xb317('0x45')];if(!_0x1f9ac3[_0xb317('0x43')][_0xb317('0x49')](_0xb317('0x69'))){_0x1de26a[_0xb317('0x2f')]=qs[_0xb317('0x2f')](_0x1f9ac3['query'][_0xb317('0x2f')]);_0x1de26a['offset']=qs['offset'](_0x1f9ac3[_0xb317('0x43')][_0xb317('0x2d')]);}_0x1de26a[_0xb317('0x4a')]=qs['sort'](_0x1f9ac3[_0xb317('0x43')]['sort']);_0x1de26a[_0xb317('0x4c')]=qs[_0xb317('0x4e')](_['pick'](_0x1f9ac3[_0xb317('0x43')],_0x2bb291[_0xb317('0x4e')]));_0x1de26a[_0xb317('0x4c')][_0xb317('0x66')]=_0x3f2eeb['id'];if(_0x1f9ac3[_0xb317('0x43')][_0xb317('0x4f')]){_0x1de26a[_0xb317('0x4c')]=_[_0xb317('0x52')](_0x1de26a[_0xb317('0x4c')],{'$or':_[_0xb317('0x42')](_0x1de26a[_0xb317('0x47')],function(_0x12a2fb){var _0x42b955={};_0x42b955[_0x12a2fb]={'$like':'%'+_0x1f9ac3['query']['filter']+'%'};return _0x42b955;})});}_0x1de26a=_[_0xb317('0x52')]({},_0x1de26a,_0x1f9ac3[_0xb317('0x6a')]);return db['CannedAnswer']['count']({'where':_0x1de26a[_0xb317('0x4c')]})[_0xb317('0x35')](function(_0x1dabe5){_0x5be820[_0xb317('0x30')]=_0x1dabe5;if(_0x1f9ac3[_0xb317('0x43')][_0xb317('0x53')]){_0x1de26a['include']=[{'all':!![]}];}return db[_0xb317('0x6e')][_0xb317('0x55')](_0x1de26a);})[_0xb317('0x35')](function(_0x50b722){_0x5be820[_0xb317('0x6b')]=_0x50b722;return _0x5be820;});}})[_0xb317('0x35')](respondWithFilteredResult(_0x922f2e,_0x1de26a))['catch'](handleError(_0x922f2e,null));};exports[_0xb317('0x70')]=function(_0x9c6c34,_0x1ce94f,_0x5d271d){return db[_0xb317('0x3e')]['find']({'where':{'id':_0x9c6c34[_0xb317('0x64')]['id']}})['then'](handleEntityNotFound(_0x1ce94f,null))['then'](function(_0x4740a4){if(_0x4740a4){return _0x4740a4[_0xb317('0x70')](_0x9c6c34[_0xb317('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x1ce94f,null))[_0xb317('0x2a')](handleError(_0x1ce94f,null));};exports['addAgents']=function(_0x2c23d4,_0x5a1b21,_0x190520){return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0x2c23d4[_0xb317('0x64')]['id']}})[_0xb317('0x35')](handleEntityNotFound(_0x5a1b21,null))['then'](function(_0x3812d9){if(_0x3812d9){return _0x3812d9[_0xb317('0x71')](_0x2c23d4['body']['ids'],_[_0xb317('0x72')](_0x2c23d4['body'],[_0xb317('0x6d'),'id'])||{})[_0xb317('0x73')](function(_0x1c35b7){for(var _0x3abaad=0x0;_0x3abaad<_0x2c23d4['body'][_0xb317('0x6d')][_0xb317('0x48')];_0x3abaad+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x2c23d4['body'][_0xb317('0x6d')][_0x3abaad]),'WhatsappAccountId':Number(_0x2c23d4[_0xb317('0x64')]['id'])});}return _0x1c35b7;});}})[_0xb317('0x35')](respondWithResult(_0x5a1b21,null))['catch'](handleError(_0x5a1b21,null));};exports['removeAgents']=function(_0x247dde,_0x31f618,_0x157f0c){return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0x247dde['params']['id']}})[_0xb317('0x35')](handleEntityNotFound(_0x31f618,null))['then'](function(_0xac1b73){if(_0xac1b73){return _0xac1b73[_0xb317('0x74')](_0x247dde[_0xb317('0x43')][_0xb317('0x6d')])[_0xb317('0x35')](function(){if(_['isArray'](_0x247dde['query'][_0xb317('0x6d')])){for(var _0x4878a7=0x0;_0x4878a7<_0x247dde[_0xb317('0x43')][_0xb317('0x6d')][_0xb317('0x48')];_0x4878a7+=0x1){socket[_0xb317('0x75')](_0xb317('0x76'),{'UserId':Number(_0x247dde[_0xb317('0x43')]['ids'][_0x4878a7]),'WhatsappAccountId':Number(_0x247dde[_0xb317('0x64')]['id'])});}}else{socket[_0xb317('0x75')](_0xb317('0x76'),{'UserId':Number(_0x247dde[_0xb317('0x43')]['ids']),'WhatsappAccountId':Number(_0x247dde[_0xb317('0x64')]['id'])});}});}})[_0xb317('0x35')](respondWithStatusCode(_0x31f618,null))[_0xb317('0x2a')](handleError(_0x31f618,null));};exports['getAgents']=function(_0x2a9284,_0x2f5f18,_0x48f280){var _0x4a5ec6={};var _0x10f33a={};var _0xf3abe3;var _0x15774e;return db[_0xb317('0x3e')][_0xb317('0x68')]({'where':{'id':_0x2a9284['params']['id']}})['then'](handleEntityNotFound(_0x2f5f18,null))[_0xb317('0x35')](function(_0x3ea2b8){if(_0x3ea2b8){_0xf3abe3=_0x3ea2b8;_0x10f33a[_0xb317('0x45')]=_[_0xb317('0x57')](db['User'][_0xb317('0x3f')]);_0x10f33a[_0xb317('0x43')]=_[_0xb317('0x57')](_0x2a9284[_0xb317('0x43')]);_0x10f33a['filters']=_[_0xb317('0x44')](_0x10f33a[_0xb317('0x45')],_0x10f33a['query']);_0x4a5ec6[_0xb317('0x47')]=_[_0xb317('0x44')](_0x10f33a[_0xb317('0x45')],qs['fields'](_0x2a9284[_0xb317('0x43')]['fields']));_0x4a5ec6['attributes']=_0x4a5ec6[_0xb317('0x47')]['length']?_0x4a5ec6[_0xb317('0x47')]:_0x10f33a['model'];_0x4a5ec6[_0xb317('0x4a')]=qs[_0xb317('0x4b')](_0x2a9284[_0xb317('0x43')][_0xb317('0x4b')]);_0x4a5ec6[_0xb317('0x4c')]=qs[_0xb317('0x4e')](_[_0xb317('0x4d')](_0x2a9284[_0xb317('0x43')],_0x10f33a[_0xb317('0x4e')]));if(_0x2a9284[_0xb317('0x43')][_0xb317('0x4f')]){_0x4a5ec6[_0xb317('0x4c')]=_[_0xb317('0x52')](_0x4a5ec6[_0xb317('0x4c')],{'$or':_[_0xb317('0x42')](_0x4a5ec6[_0xb317('0x47')],function(_0x431aad){var _0x35ab09={};_0x35ab09[_0x431aad]={'$like':'%'+_0x2a9284[_0xb317('0x43')][_0xb317('0x4f')]+'%'};return _0x35ab09;})});}_0x4a5ec6=_['merge']({},_0x4a5ec6,_0x2a9284[_0xb317('0x6a')]);return _0xf3abe3[_0xb317('0x77')](_0x4a5ec6);}})['then'](function(_0x31e856){if(_0x31e856){_0x15774e=_0x31e856[_0xb317('0x48')];if(!_0x2a9284[_0xb317('0x43')][_0xb317('0x49')](_0xb317('0x69'))){_0x4a5ec6[_0xb317('0x2f')]=qs[_0xb317('0x2f')](_0x2a9284[_0xb317('0x43')][_0xb317('0x2f')]);_0x4a5ec6[_0xb317('0x2d')]=qs['offset'](_0x2a9284[_0xb317('0x43')]['offset']);}return _0xf3abe3[_0xb317('0x77')](_0x4a5ec6);}})[_0xb317('0x35')](function(_0x4518eb){if(_0x4518eb){return _0x4518eb?{'count':_0x15774e,'rows':_0x4518eb}:null;}})[_0xb317('0x35')](respondWithResult(_0x2f5f18,null))[_0xb317('0x2a')](handleError(_0x2f5f18,null));};exports[_0xb317('0x78')]=function(_0x19a4bc,_0xc98271){var _0x10c20c=_0x19a4bc[_0xb317('0x64')]['id'];var _0x2a76cc=_0x19a4bc[_0xb317('0x5a')];var _0x45cbfc=0xc8;var _0x3e8cff=null;return db[_0xb317('0x79')][_0xb317('0x7a')]({'isolationLevel':db[_0xb317('0x79')]['Transaction'][_0xb317('0x7b')][_0xb317('0x7c')]},function(_0x167bde){return db[_0xb317('0x3e')][_0xb317('0x68')]({'where':{'id':_0x10c20c},'transaction':_0x167bde})['then'](function(_0x27d7b2){if(_0x27d7b2){return db[_0xb317('0x7d')][_0xb317('0x36')]({'where':{'WhatsappAccountId':_0x10c20c},'transaction':_0x167bde})[_0xb317('0x35')](function(){var _0x434318=_[_0xb317('0x42')](_0x2a76cc,function(_0x283348){_0x283348[_0xb317('0x66')]=_0x10c20c;return _0x283348;});return db[_0xb317('0x7d')]['bulkCreate'](_0x434318,{'transaction':_0x167bde});});}else{_0x45cbfc=0x194;_0x3e8cff=[];}});})[_0xb317('0x35')](function(){if(_0x45cbfc!==0x194){return db['WhatsappApplication'][_0xb317('0x7e')]({'where':{'WhatsappAccountId':_0x10c20c},'order':_0xb317('0x7f')})[_0xb317('0x35')](function(_0x2b6669){_0x3e8cff=_0x2b6669;});}})[_0xb317('0x2a')](function(_0x39e5f7){_0x45cbfc=0x1f4;logger[_0xb317('0x26')](_0x39e5f7[_0xb317('0x80')]);if(_0x39e5f7['name']){delete _0x39e5f7[_0xb317('0x39')];}_0x3e8cff=_0x39e5f7;})['finally'](function(){if(_0x3e8cff===null){_0xc98271[_0xb317('0x81')](_0x45cbfc);}else{if(_0x45cbfc===0x1f4){_0xc98271[_0xb317('0x2b')](_0x45cbfc)[_0xb317('0x3a')](_0x3e8cff);}else{_0xc98271[_0xb317('0x2b')](_0x45cbfc)[_0xb317('0x33')](_0x3e8cff);}}});};exports[_0xb317('0x82')]=function(_0x1c91f3,_0x5e0ea1,_0x16439c){var _0x5a585d={};var _0x44cff1={};var _0x28d751;var _0x4148cd;return db[_0xb317('0x3e')][_0xb317('0x68')]({'where':{'id':_0x1c91f3[_0xb317('0x64')]['id']}})[_0xb317('0x35')](handleEntityNotFound(_0x5e0ea1,null))['then'](function(_0x53b344){if(_0x53b344){_0x28d751=_0x53b344;_0x44cff1[_0xb317('0x45')]=_[_0xb317('0x57')](db['WhatsappApplication'][_0xb317('0x3f')]);_0x44cff1[_0xb317('0x43')]=_[_0xb317('0x57')](_0x1c91f3['query']);_0x44cff1[_0xb317('0x4e')]=_[_0xb317('0x44')](_0x44cff1[_0xb317('0x45')],_0x44cff1[_0xb317('0x43')]);_0x5a585d[_0xb317('0x47')]=_[_0xb317('0x44')](_0x44cff1[_0xb317('0x45')],qs[_0xb317('0x46')](_0x1c91f3['query'][_0xb317('0x46')]));_0x5a585d[_0xb317('0x47')]=_0x5a585d['attributes'][_0xb317('0x48')]?_0x5a585d[_0xb317('0x47')]:_0x44cff1[_0xb317('0x45')];_0x5a585d[_0xb317('0x4a')]=qs['sort'](_0x1c91f3[_0xb317('0x43')][_0xb317('0x4b')]);_0x5a585d[_0xb317('0x4c')]=qs[_0xb317('0x4e')](_['pick'](_0x1c91f3[_0xb317('0x43')],_0x44cff1[_0xb317('0x4e')]));if(_0x1c91f3[_0xb317('0x43')][_0xb317('0x4f')]){_0x5a585d['where']=_[_0xb317('0x52')](_0x5a585d['where'],{'$or':_['map'](_0x5a585d[_0xb317('0x47')],function(_0x8122f1){var _0x57052a={};_0x57052a[_0x8122f1]={'$like':'%'+_0x1c91f3['query'][_0xb317('0x4f')]+'%'};return _0x57052a;})});}_0x5a585d=_[_0xb317('0x52')]({},_0x5a585d,_0x1c91f3[_0xb317('0x6a')]);return _0x28d751['getApplications'](_0x5a585d);}})[_0xb317('0x35')](function(_0x592fd1){if(_0x592fd1){_0x4148cd=_0x592fd1[_0xb317('0x48')];if(!_0x1c91f3['query'][_0xb317('0x49')](_0xb317('0x69'))){_0x5a585d['limit']=qs['limit'](_0x1c91f3[_0xb317('0x43')][_0xb317('0x2f')]);_0x5a585d[_0xb317('0x2d')]=qs[_0xb317('0x2d')](_0x1c91f3[_0xb317('0x43')][_0xb317('0x2d')]);}return _0x28d751['getApplications'](_0x5a585d);}})[_0xb317('0x35')](function(_0x448136){if(_0x448136){return _0x448136?{'count':_0x4148cd,'rows':_0x448136}:null;}})[_0xb317('0x35')](respondWithResult(_0x5e0ea1,null))[_0xb317('0x2a')](handleError(_0x5e0ea1,null));};exports[_0xb317('0x83')]=function(_0x9214ea,_0xad067a,_0x32785c){var _0x5aafe6={'channel':_0xb317('0x84')};var _0x3cc88c=[];var _0x461fdb=[];var _0x576087={};return db[_0xb317('0x3e')][_0xb317('0x58')]({'where':{'id':_0x9214ea[_0xb317('0x64')]['id']},'include':[{'model':db[_0xb317('0x7d')],'as':_0xb317('0x85')}]})[_0xb317('0x35')](handleEntityNotFound(_0xad067a,null))[_0xb317('0x35')](function(_0xb58601){_0x5aafe6[_0xb317('0x86')]=_0xb58601;if(_0x5aafe6[_0xb317('0x86')]&&_0x5aafe6['account']['type']===_0xb317('0x87')&&_0x9214ea[_0xb317('0x5a')][_0xb317('0x88')]){if(_0x9214ea['body']['statuses'][_0xb317('0x48')]===0x0)return;if(_0x9214ea['body'][_0xb317('0x88')][0x0][_0xb317('0x89')]!==_0xb317('0x8a'))return;return db[_0xb317('0x8b')][_0xb317('0x63')]({'read':!![],'readAt':_0x9214ea[_0xb317('0x5a')][_0xb317('0x88')][0x0][_0xb317('0x8c')]},{'where':{'messageId':_0x9214ea[_0xb317('0x5a')][_0xb317('0x88')][0x0][_0xb317('0x8d')]},'individualHooks':!![]})[_0xb317('0x35')](function(_0xa5b820){return _0xad067a[_0xb317('0x2b')](0xc8)[_0xb317('0x33')](_0xa5b820);});}_0x5aafe6[_0xb317('0x8e')]=_[_0xb317('0x8f')](_0xb58601[_0xb317('0x85')],[_0xb317('0x7f')],[_0xb317('0x90')]);if(_0x5aafe6[_0xb317('0x86')][_0xb317('0x85')]){delete _0x5aafe6['account'][_0xb317('0x85')];}return db[_0xb317('0x91')][_0xb317('0x92')]()['then'](function(_0x54ef0c){if(!_0x54ef0c){throw new db['Sequelize']['ValidationError'](_0xb317('0x93'));}_0x3cc88c=_[_0xb317('0x94')](_[_0xb317('0x57')](_0x54ef0c),[_0xb317('0x95'),_0xb317('0x96')]);_0x461fdb=_[_0xb317('0x94')](_[_0xb317('0x57')](_0x54ef0c),[_0xb317('0x95'),'updatedAt',_0xb317('0x97'),_0xb317('0x98')]);_0x5aafe6[_0xb317('0x5a')]={'mapKey':_0xb317('0x99')};if(_0x5aafe6[_0xb317('0x86')]&&_0x5aafe6['account'][_0xb317('0x50')]===_0xb317('0x9a')){_0x5aafe6['body']['from']=_0x9214ea[_0xb317('0x5a')][_0xb317('0x9b')][_0xb317('0x9c')](_0xb317('0x9d'),'');_0x5aafe6[_0xb317('0x5a')][_0xb317('0x5a')]=_0x9214ea['body'][_0xb317('0x9e')];_0x5aafe6[_0xb317('0x5a')][_0xb317('0x9f')]=_0x9214ea[_0xb317('0x5a')][_0xb317('0xa0')];}if(_0x5aafe6['account']&&_0x5aafe6[_0xb317('0x86')][_0xb317('0x50')]===_0xb317('0x87')){_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa1')]=_0x9214ea[_0xb317('0x5a')]['notifications'][0x0][_0xb317('0xa1')];_0x5aafe6[_0xb317('0x5a')][_0xb317('0x5a')]=_0x9214ea[_0xb317('0x5a')]['notifications'][0x0]['message'][_0xb317('0x5a')];_0x5aafe6[_0xb317('0x5a')][_0xb317('0x9f')]=_0x9214ea[_0xb317('0x5a')]['notifications'][0x0][_0xb317('0x8d')];}if(_0x5aafe6[_0xb317('0x5a')]['id']){delete _0x5aafe6[_0xb317('0x5a')]['id'];}if(_[_0xb317('0xa2')](_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa1')])){throw new db[(_0xb317('0xa3'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xb317('0xa2')](_0x5aafe6[_0xb317('0x5a')]['body'])||_0x5aafe6[_0xb317('0x5a')]['body']===''){throw new db[(_0xb317('0xa3'))]['ValidationError'](_0xb317('0xa4'));}if(_[_0xb317('0xa2')](_0x5aafe6[_0xb317('0x5a')]['mapKey'])){throw new db[(_0xb317('0xa3'))][(_0xb317('0xa5'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x461fdb);}if(!_[_0xb317('0xa6')](_0x461fdb,_0x5aafe6[_0xb317('0x5a')]['mapKey'])){throw new db[(_0xb317('0xa3'))][(_0xb317('0xa5'))](_0xb317('0xa7')+_0x461fdb);}_0x576087[_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa8')]]=_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa1')];return db[_0xb317('0xa9')][_0xb317('0x58')]({'where':{'id':_0x5aafe6[_0xb317('0x86')][_0xb317('0x98')]},'include':[{'model':db[_0xb317('0x91')],'as':_0xb317('0xaa'),'where':_0x576087,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xb317('0x35')](handleEntityNotFound(_0xad067a,null))[_0xb317('0x35')](function(_0x43183a){if(_0x43183a){_0x5aafe6['list']=_[_0xb317('0x72')](_0x43183a,[_0xb317('0xaa')]);if(_0x43183a[_0xb317('0xaa')]['length']){return _0x43183a[_0xb317('0xaa')][0x0];}var _0x22331e=_[_0xb317('0x1b')](_0x5aafe6[_0xb317('0x5a')],{'firstName':_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa1')],'ListId':_0x43183a['id']});_0x22331e[_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa8')]]=_0x5aafe6[_0xb317('0x5a')]['from'];return db[_0xb317('0x91')][_0xb317('0x59')](_0x22331e,{'fields':_0x3cc88c,'raw':!![]});}})[_0xb317('0x35')](handleEntityNotFound(_0xad067a,null))['then'](function(_0x22e1cd){if(_0x22e1cd){_0x5aafe6[_0xb317('0xab')]=_0x22e1cd;var _0x4a9d35={'ContactId':_0x22e1cd['id'],'phone':_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa1')],'WhatsappAccountId':_0x9214ea['params']['id']};var _0x5d6d5={'ContactId':_0x22e1cd['id'],'WhatsappAccountId':_0x9214ea[_0xb317('0x64')]['id'],'closed':![]};return db[_0xb317('0xac')][_0xb317('0x58')]({'where':_0x5d6d5})[_0xb317('0x35')](function(_0x351b77){if(_0x351b77){return[_0x351b77,![]];}return db[_0xb317('0xac')]['create'](_0x4a9d35)[_0xb317('0x35')](function(_0x401c52){return[_0x401c52,!![]];});});}})['spread'](function(_0x3ab958,_0x1043de){_0x5aafe6[_0xb317('0xad')]=_0x3ab958['get']({'plain':!![]});_0x5aafe6[_0xb317('0xad')][_0xb317('0xae')]=![];if(_0x1043de){if(_0x5aafe6[_0xb317('0x86')][_0xb317('0xaf')]){_0x5aafe6[_0xb317('0x8e')][_0xb317('0xb0')]({'id':0x0,'priority':_0x5aafe6[_0xb317('0x8e')][_0xb317('0x48')]+0x1,'app':_0xb317('0xb1'),'appdata':_0xb317('0xb2'),'interval':'*,*,*,*'});}_0x5aafe6[_0xb317('0xad')]['created']=!![];}return db[_0xb317('0x8b')][_0xb317('0x59')]({'phone':_0x5aafe6[_0xb317('0x5a')][_0xb317('0xa1')],'messageId':_0x5aafe6['body'][_0xb317('0x9f')],'body':_0x5aafe6[_0xb317('0x5a')][_0xb317('0x5a')],'WhatsappAccountId':_0x9214ea['params']['id'],'WhatsappInteractionId':_0x3ab958['id'],'direction':'in','ContactId':_0x3ab958[_0xb317('0xb3')],'AttachmentId':_0x5aafe6[_0xb317('0x5a')][_0xb317('0xb4')]});})['then'](function(_0x19653e){_0x5aafe6[_0xb317('0x29')]=_0x19653e;if(!_0x5aafe6[_0xb317('0xad')]['UserId'])return;return db[_0xb317('0xb5')]['find']({'attributes':['id','name'],'where':{'id':_0x5aafe6[_0xb317('0xad')][_0xb317('0xb6')]}});})[_0xb317('0x35')](function(_0x128759){if(_0x128759){_0x5aafe6[_0xb317('0x8e')][_0xb317('0xb7')]({'id':0x0,'priority':0x0,'app':_0xb317('0xb8'),'appdata':_0x128759[_0xb317('0x39')]+','+(_0x5aafe6[_0xb317('0x86')][_0xb317('0xb9')]||0xa),'interval':'*,*,*,*'});}if(!_0x5aafe6['interaction'][_0xb317('0xba')])return;return db[_0xb317('0xbb')][_0xb317('0x58')]({'attributes':['id',_0xb317('0x39')],'where':{'id':_0x5aafe6['interaction']['queueId']}});})[_0xb317('0x35')](function(_0x383ed8){if(_0x383ed8){_0x5aafe6[_0xb317('0x8e')][_0xb317('0xb7')]({'id':0x0,'priority':0x1,'app':_0xb317('0xbc'),'appdata':_0x383ed8['name']+','+(_0x5aafe6[_0xb317('0x86')]['waitForTheAssignedQueue']||0x12c),'interval':_0xb317('0xbd')});}return respondWithRpcPromise(_0xb317('0xbe'),_0xb317('0xbf'),_0x5aafe6);})[_0xb317('0x35')](function(_0x22c180){if(_0x22c180){var _0x56ffd9=0xc8;var _0x3d496c=_0xb317('0xc0');logger[_0xb317('0x21')](_0xb317('0x23'),_0x3d496c,_0x56ffd9,'entity\x20found');logger[_0xb317('0x22')](_0xb317('0xc1'),_0x3d496c,_0x56ffd9,'entity\x20found',JSON[_0xb317('0x25')](_0x22c180));if(_0x5aafe6[_0xb317('0x86')]['type']===_0xb317('0x9a')){return _0xad067a[_0xb317('0x2b')](_0x56ffd9)[_0xb317('0x31')](_0xb317('0xc2'),_0xb317('0xc3'))[_0xb317('0x3a')](_0xb317('0xc4'));}else{return _0xad067a[_0xb317('0x2b')](_0x56ffd9)[_0xb317('0x33')](_0x22c180);}}});})[_0xb317('0x2a')](handleError(_0xad067a,null));};exports['send']=function(_0x579878,_0x11b6d4,_0x42dbe5){var _0x760a5c,_0x28b95b,_0x2e8231;if(_[_0xb317('0xa2')](_0x579878[_0xb317('0x5a')][_0xb317('0x5a')])||_0x579878[_0xb317('0x5a')][_0xb317('0x5a')]===''){throw new db[(_0xb317('0xa3'))]['ValidationError'](_0xb317('0xa4'));}if(_['isNil'](_0x579878[_0xb317('0x5a')]['to'])){throw new db[(_0xb317('0xa3'))][(_0xb317('0xa5'))]('to\x20is\x20mandatory');}_0x760a5c=_0x579878[_0xb317('0x5a')]['to'];return db[_0xb317('0x3e')]['find']({'where':{'id':_0x579878[_0xb317('0x64')]['id']},'include':[{'model':db[_0xb317('0xa9')],'as':_0xb317('0xc5'),'include':[{'model':db[_0xb317('0x91')],'as':'Contacts','where':{'mobile':_0x760a5c},'limit':0x1,'order':[[_0xb317('0x96'),_0xb317('0xc6')]]}]}]})[_0xb317('0x35')](handleEntityNotFound(_0x11b6d4,null))[_0xb317('0x35')](function(_0x1d7b54){if(_0x1d7b54&&_0x1d7b54['List']){_0x28b95b=_0x1d7b54[_0xb317('0x37')]({'plain':!![]});if(_0x28b95b[_0xb317('0xc5')]&&_0x28b95b[_0xb317('0xc5')][_0xb317('0xaa')][_0xb317('0x48')]){return _0x28b95b['List'][_0xb317('0xaa')][0x0];}return db[_0xb317('0x91')]['create'](_[_0xb317('0x1b')](_0x579878['body'],{'firstName':_0x760a5c,'mobile':_0x760a5c,'phone':_0x760a5c,'ListId':_0x28b95b[_0xb317('0x98')]}));}})[_0xb317('0x35')](handleEntityNotFound(_0x11b6d4,null))[_0xb317('0x35')](function(_0x4ea60d){if(_0x4ea60d){_0x2e8231=_0x4ea60d;return db[_0xb317('0xac')][_0xb317('0x58')]({'where':{'ContactId':_0x2e8231['id'],'closed':![],'WhatsappAccountId':_0x28b95b['id']}})[_0xb317('0x35')](function(_0x1c70e9){if(_0x1c70e9){return[_0x1c70e9,![]];}return db[_0xb317('0xac')]['create']({'UserId':_0x579878['user']['id'],'ContactId':_0x2e8231['id'],'WhatsappAccountId':_0x28b95b['id'],'phone':_0x760a5c,'firstMsgDirection':'out','Messages':[_[_0xb317('0x52')](_0x579878['body'],{'read':![],'body':_0x579878[_0xb317('0x5a')][_0xb317('0x5a')],'phone':_0x760a5c,'WhatsappAccountId':_0x28b95b['id'],'UserId':_0x579878['user']['id'],'ContactId':_0x2e8231['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xb317('0xc7')}]})[_0xb317('0x35')](function(_0x39868c){return[_0x39868c,!![]];});});}})[_0xb317('0x73')](function(_0x2ff957,_0x239932){if(_0x239932){return _0x2ff957;}return db[_0xb317('0x8b')][_0xb317('0x59')](_[_0xb317('0x52')](_0x579878[_0xb317('0x5a')],{'read':![],'body':_0x579878[_0xb317('0x5a')][_0xb317('0x5a')],'phone':_0x760a5c,'WhatsappAccountId':_0x28b95b['id'],'WhatsappInteractionId':_0x2ff957['id'],'UserId':_0x579878['user']['id'],'ContactId':_0x2e8231['id']}))[_0xb317('0x35')](function(_0x22b576){_0x2ff957[_0xb317('0xc8')][_0xb317('0xc7')]=[];_0x2ff957[_0xb317('0xc8')]['Messages'][_0xb317('0xb0')](_0x22b576[_0xb317('0xc8')]);return _0x2ff957;});})[_0xb317('0x35')](respondWithResult(_0x11b6d4,null))[_0xb317('0x2a')](handleError(_0x11b6d4,null));}; \ No newline at end of file +var _0x5e17=['*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','WhatsappQueue','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','count','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','hasOwnProperty','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','contact','WhatsappInteraction','interaction','created','push','unmanaged'];(function(_0x3b77a5,_0x374322){var _0x7d2226=function(_0x351c28){while(--_0x351c28){_0x3b77a5['push'](_0x3b77a5['shift']());}};_0x7d2226(++_0x374322);}(_0x5e17,0x1a0));var _0x75e1=function(_0x1339e6,_0x3a8a60){_0x1339e6=_0x1339e6-0x0;var _0x2c6767=_0x5e17[_0x1339e6];return _0x2c6767;};'use strict';var emlformat=require(_0x75e1('0x0'));var rimraf=require(_0x75e1('0x1'));var zipdir=require(_0x75e1('0x2'));var jsonpatch=require(_0x75e1('0x3'));var rp=require(_0x75e1('0x4'));var moment=require('moment');var BPromise=require(_0x75e1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x75e1('0x6'));var sox=require('sox');var csv=require(_0x75e1('0x7'));var ejs=require(_0x75e1('0x8'));var fs=require('fs');var fs_extra=require(_0x75e1('0x9'));var _=require(_0x75e1('0xa'));var squel=require(_0x75e1('0xb'));var crypto=require('crypto');var jsforce=require(_0x75e1('0xc'));var deskjs=require(_0x75e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x75e1('0xe'));var Papa=require(_0x75e1('0xf'));var Redis=require(_0x75e1('0x10'));var authService=require(_0x75e1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x75e1('0x12'));var hardwareService=require(_0x75e1('0x13'));var logger=require(_0x75e1('0x14'))(_0x75e1('0x15'));var utils=require(_0x75e1('0x16'));var config=require(_0x75e1('0x17'));var licenseUtil=require(_0x75e1('0x18'));var db=require(_0x75e1('0x19'))['db'];config[_0x75e1('0x1a')]=_[_0x75e1('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x75e1('0x1c'))(new Redis(config[_0x75e1('0x1a')]));require(_0x75e1('0x1d'))[_0x75e1('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x75e1('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x7e83a4,_0x5d2e41,_0x1e2ab0,_0x4959dc){return new BPromise(function(_0x305a83,_0x3a9b37){var _0x12ac7c=_0x4959dc||client;return _0x12ac7c[_0x75e1('0x20')](_0x7e83a4,_0x1e2ab0)[_0x75e1('0x21')](function(_0x53b5fc){logger[_0x75e1('0x22')](_0x75e1('0x23'),_0x5d2e41,'request\x20sent');logger['debug'](_0x75e1('0x24'),_0x5d2e41,_0x75e1('0x25'),JSON[_0x75e1('0x26')](_0x53b5fc));if(_0x53b5fc[_0x75e1('0x27')]){if(_0x53b5fc[_0x75e1('0x27')]['code']===0x1f4){logger[_0x75e1('0x27')](_0x75e1('0x23'),_0x5d2e41,_0x53b5fc[_0x75e1('0x27')][_0x75e1('0x28')]);return _0x3a9b37(_0x53b5fc[_0x75e1('0x27')][_0x75e1('0x28')]);}logger[_0x75e1('0x27')](_0x75e1('0x23'),_0x5d2e41,_0x53b5fc[_0x75e1('0x27')]['message']);return _0x305a83(_0x53b5fc[_0x75e1('0x27')][_0x75e1('0x28')]);}else{logger[_0x75e1('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x5d2e41,_0x75e1('0x25'));_0x305a83(_0x53b5fc['result'][_0x75e1('0x28')]);}})['catch'](function(_0x152b0c){logger[_0x75e1('0x27')](_0x75e1('0x23'),_0x5d2e41,_0x152b0c);_0x3a9b37(_0x152b0c);});});}function respondWithStatusCode(_0x4d3937,_0x40ae8a){_0x40ae8a=_0x40ae8a||0xcc;return function(_0x25a960){if(_0x25a960){return _0x4d3937[_0x75e1('0x29')](_0x40ae8a);}return _0x4d3937[_0x75e1('0x2a')](_0x40ae8a)[_0x75e1('0x2b')]();};}function respondWithResult(_0x36be1d,_0x343484){_0x343484=_0x343484||0xc8;return function(_0x5094dd){if(_0x5094dd){return _0x36be1d[_0x75e1('0x2a')](_0x343484)[_0x75e1('0x2c')](_0x5094dd);}};}function respondWithFilteredResult(_0x5667e0,_0x46d4e2){return function(_0x5375d7){if(_0x5375d7){var _0x16d836=typeof _0x46d4e2[_0x75e1('0x2d')]===_0x75e1('0x2e')&&typeof _0x46d4e2[_0x75e1('0x2f')]===_0x75e1('0x2e');var _0x478eca=_0x5375d7['count'];var _0x206dc9=_0x16d836?0x0:_0x46d4e2[_0x75e1('0x2d')];var _0x3dda64=_0x16d836?_0x5375d7['count']:_0x46d4e2['offset']+_0x46d4e2[_0x75e1('0x2f')];var _0x14a799;if(_0x3dda64>=_0x478eca){_0x3dda64=_0x478eca;_0x14a799=0xc8;}else{_0x14a799=0xce;}_0x5667e0[_0x75e1('0x2a')](_0x14a799);return _0x5667e0['set'](_0x75e1('0x30'),_0x206dc9+'-'+_0x3dda64+'/'+_0x478eca)[_0x75e1('0x2c')](_0x5375d7);}return null;};}function patchUpdates(_0x22b6f9){return function(_0x228195){try{jsonpatch[_0x75e1('0x31')](_0x228195,_0x22b6f9,!![]);}catch(_0xe32b7a){return BPromise[_0x75e1('0x32')](_0xe32b7a);}return _0x228195[_0x75e1('0x33')]();};}function saveUpdates(_0x5091de,_0x31c648){return function(_0x575069){if(_0x575069){return _0x575069['update'](_0x5091de)[_0x75e1('0x21')](function(_0x5e7dc2){return _0x5e7dc2;});}return null;};}function removeEntity(_0x5ad40a,_0x517a1d){return function(_0x53c829){if(_0x53c829){return _0x53c829[_0x75e1('0x34')]()[_0x75e1('0x21')](function(){var _0x3c717d=_0x53c829[_0x75e1('0x35')]({'plain':!![]});var _0x4cca43=_0x75e1('0x36');return db[_0x75e1('0x37')]['destroy']({'where':{'type':_0x4cca43,'resourceId':_0x3c717d['id']}})['then'](function(){return _0x53c829;});})['then'](function(){_0x5ad40a[_0x75e1('0x2a')](0xcc)[_0x75e1('0x2b')]();});}};}function handleEntityNotFound(_0x2d6fbf,_0x38ea0d){return function(_0x223f5b){if(!_0x223f5b){_0x2d6fbf['sendStatus'](0x194);}return _0x223f5b;};}function handleError(_0x141123,_0x41e27c){_0x41e27c=_0x41e27c||0x1f4;return function(_0x7d68bf){logger['error'](_0x7d68bf[_0x75e1('0x38')]);if(_0x7d68bf[_0x75e1('0x39')]){delete _0x7d68bf[_0x75e1('0x39')];}_0x141123[_0x75e1('0x2a')](_0x41e27c)[_0x75e1('0x3a')](_0x7d68bf);};}exports['index']=function(_0x32b705,_0x244909){var _0x3edf36={'include':[{'model':db[_0x75e1('0x3b')],'as':_0x75e1('0x3c')}]},_0x27b92d={},_0x4203d1={'count':0x0,'rows':[]};var _0x493b27=_[_0x75e1('0x3d')](db[_0x75e1('0x3e')][_0x75e1('0x3f')],function(_0x2cbbc3){return{'name':_0x2cbbc3[_0x75e1('0x40')],'type':_0x2cbbc3['type'][_0x75e1('0x41')]};});_0x27b92d[_0x75e1('0x42')]=_['map'](_0x493b27,_0x75e1('0x39'));_0x27b92d[_0x75e1('0x43')]=_['keys'](_0x32b705[_0x75e1('0x43')]);_0x27b92d[_0x75e1('0x44')]=_[_0x75e1('0x45')](_0x27b92d[_0x75e1('0x42')],_0x27b92d[_0x75e1('0x43')]);_0x3edf36['attributes']=_[_0x75e1('0x45')](_0x27b92d['model'],qs[_0x75e1('0x46')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x46')]));_0x3edf36[_0x75e1('0x47')]=_0x3edf36[_0x75e1('0x47')][_0x75e1('0x48')]?_0x3edf36['attributes']:_0x27b92d[_0x75e1('0x42')];if(!_0x32b705[_0x75e1('0x43')]['hasOwnProperty'](_0x75e1('0x49'))){_0x3edf36[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x2f')]);_0x3edf36[_0x75e1('0x2d')]=qs[_0x75e1('0x2d')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x2d')]);}_0x3edf36[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x3edf36[_0x75e1('0x4c')]=qs['filters'](_[_0x75e1('0x4d')](_0x32b705[_0x75e1('0x43')],_0x27b92d[_0x75e1('0x44')]),_0x493b27);if(_0x32b705['query']['filter']){_0x3edf36[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x3edf36[_0x75e1('0x4c')],{'$or':_[_0x75e1('0x3d')](_0x493b27,function(_0x55888b){if(_0x55888b[_0x75e1('0x4f')]!==_0x75e1('0x50')){var _0x40d672={};_0x40d672[_0x55888b[_0x75e1('0x39')]]={'$like':'%'+_0x32b705[_0x75e1('0x43')]['filter']+'%'};return _0x40d672;}})});}_0x3edf36=_[_0x75e1('0x4e')]({},_0x3edf36,_0x32b705[_0x75e1('0x51')]);var _0x8b534e={'where':_0x3edf36[_0x75e1('0x4c')]};return db[_0x75e1('0x3e')][_0x75e1('0x52')](_0x8b534e)[_0x75e1('0x21')](function(_0xfbbb07){_0x4203d1['count']=_0xfbbb07;if(_0x32b705[_0x75e1('0x43')]['includeAll']){_0x3edf36[_0x75e1('0x53')]=[{'all':!![]}];}return db[_0x75e1('0x3e')][_0x75e1('0x54')](_0x3edf36);})[_0x75e1('0x21')](function(_0x2f2f9c){_0x4203d1['rows']=_0x2f2f9c;return _0x4203d1;})[_0x75e1('0x21')](respondWithFilteredResult(_0x244909,_0x3edf36))[_0x75e1('0x55')](handleError(_0x244909,null));};exports[_0x75e1('0x56')]=function(_0x47eabc,_0x1224b2){var _0x2e8a47={'raw':![],'where':{'id':_0x47eabc[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0x3b')],'as':'mandatoryDispositionPause'}]},_0x24ee2c={};_0x24ee2c[_0x75e1('0x42')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x24ee2c[_0x75e1('0x43')]=_[_0x75e1('0x58')](_0x47eabc['query']);_0x24ee2c[_0x75e1('0x44')]=_['intersection'](_0x24ee2c[_0x75e1('0x42')],_0x24ee2c['query']);_0x2e8a47[_0x75e1('0x47')]=_[_0x75e1('0x45')](_0x24ee2c[_0x75e1('0x42')],qs[_0x75e1('0x46')](_0x47eabc[_0x75e1('0x43')][_0x75e1('0x46')]));_0x2e8a47[_0x75e1('0x47')]=_0x2e8a47[_0x75e1('0x47')]['length']?_0x2e8a47[_0x75e1('0x47')]:_0x24ee2c[_0x75e1('0x42')];if(_0x47eabc[_0x75e1('0x43')][_0x75e1('0x59')]){_0x2e8a47[_0x75e1('0x53')]=[{'all':!![]}];}_0x2e8a47=_['merge']({},_0x2e8a47,_0x47eabc['options']);return db[_0x75e1('0x3e')][_0x75e1('0x5a')](_0x2e8a47)['then'](handleEntityNotFound(_0x1224b2,null))[_0x75e1('0x21')](respondWithResult(_0x1224b2,null))[_0x75e1('0x55')](handleError(_0x1224b2,null));};exports[_0x75e1('0x5b')]=function(_0x4a8dda,_0x4ba27b){return db[_0x75e1('0x3e')][_0x75e1('0x5b')](_0x4a8dda[_0x75e1('0x5c')],{})['then'](function(_0x3783e7){var _0x1b420b=_0x4a8dda[_0x75e1('0x5d')][_0x75e1('0x35')]({'plain':!![]});if(!_0x1b420b)throw new Error(_0x75e1('0x5e'));if(_0x1b420b[_0x75e1('0x5f')]==='user'){var _0x44067a=_0x3783e7[_0x75e1('0x35')]({'plain':!![]});var _0x17e6d5=_0x75e1('0x36');return db['UserProfileSection'][_0x75e1('0x5a')]({'where':{'name':_0x17e6d5,'userProfileId':_0x1b420b['userProfileId']},'raw':!![]})[_0x75e1('0x21')](function(_0x1bbe25){if(_0x1bbe25&&_0x1bbe25[_0x75e1('0x60')]===0x0){return db[_0x75e1('0x37')][_0x75e1('0x5b')]({'name':_0x44067a[_0x75e1('0x39')],'resourceId':_0x44067a['id'],'type':_0x1bbe25[_0x75e1('0x39')],'sectionId':_0x1bbe25['id']},{})[_0x75e1('0x21')](function(){return _0x3783e7;});}else{return _0x3783e7;}})[_0x75e1('0x55')](function(_0x3d27bd){logger[_0x75e1('0x27')](_0x75e1('0x61'),_0x3d27bd);throw _0x3d27bd;});}return _0x3783e7;})[_0x75e1('0x21')](respondWithResult(_0x4ba27b,0xc9))[_0x75e1('0x55')](handleError(_0x4ba27b,null));};exports[_0x75e1('0x62')]=function(_0x104439,_0x1d0006){if(_0x104439[_0x75e1('0x5c')]['id']){delete _0x104439[_0x75e1('0x5c')]['id'];}return db[_0x75e1('0x3e')]['find']({'where':{'id':_0x104439[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0x3b')],'as':_0x75e1('0x3c')}]})['then'](handleEntityNotFound(_0x1d0006,null))['then'](saveUpdates(_0x104439['body'],null))[_0x75e1('0x21')](respondWithResult(_0x1d0006,null))[_0x75e1('0x55')](handleError(_0x1d0006,null));};exports[_0x75e1('0x34')]=function(_0x2de1fd,_0x8facca){return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x2de1fd['params']['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x8facca,null))[_0x75e1('0x21')](removeEntity(_0x8facca,null))['catch'](handleError(_0x8facca,null));};exports[_0x75e1('0x63')]=function(_0x25957a,_0x3868d9){return db[_0x75e1('0x3e')]['describe']()[_0x75e1('0x21')](respondWithResult(_0x3868d9,null))[_0x75e1('0x55')](handleError(_0x3868d9,null));};exports[_0x75e1('0x64')]=function(_0x4ff018,_0xe7313a,_0x578b97){if(_0x4ff018[_0x75e1('0x5c')]['id']){delete _0x4ff018[_0x75e1('0x5c')]['id'];}return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x4ff018[_0x75e1('0x57')]['id']}})['then'](handleEntityNotFound(_0xe7313a,null))[_0x75e1('0x21')](function(_0x118b65){if(_0x118b65){_0x4ff018[_0x75e1('0x5c')][_0x75e1('0x65')]=_0x118b65['id'];return db['Disposition'][_0x75e1('0x5b')](_0x4ff018['body']);}})[_0x75e1('0x21')](respondWithResult(_0xe7313a,null))[_0x75e1('0x55')](handleError(_0xe7313a,null));};exports['getDispositions']=function(_0x5952a6,_0x2ece33,_0x2178b6){var _0x4ee298={'raw':![],'where':{}};var _0x5e7985={};var _0x300dfd={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5952a6[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x2ece33,null))[_0x75e1('0x21')](function(_0x3c992b){if(_0x3c992b){_0x5e7985[_0x75e1('0x42')]=_['keys'](db['Disposition'][_0x75e1('0x3f')]);_0x5e7985[_0x75e1('0x43')]=_[_0x75e1('0x58')](_0x5952a6[_0x75e1('0x43')]);_0x5e7985[_0x75e1('0x44')]=_[_0x75e1('0x45')](_0x5e7985['model'],_0x5e7985['query']);_0x4ee298['attributes']=_[_0x75e1('0x45')](_0x5e7985[_0x75e1('0x42')],qs[_0x75e1('0x46')](_0x5952a6['query'][_0x75e1('0x46')]));_0x4ee298['attributes']=_0x4ee298['attributes'][_0x75e1('0x48')]?_0x4ee298[_0x75e1('0x47')]:_0x5e7985[_0x75e1('0x42')];if(!_0x5952a6['query'][_0x75e1('0x66')](_0x75e1('0x49'))){_0x4ee298[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x5952a6[_0x75e1('0x43')][_0x75e1('0x2f')]);_0x4ee298['offset']=qs[_0x75e1('0x2d')](_0x5952a6['query'][_0x75e1('0x2d')]);}_0x4ee298[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x5952a6[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x4ee298[_0x75e1('0x4c')]=qs[_0x75e1('0x44')](_[_0x75e1('0x4d')](_0x5952a6[_0x75e1('0x43')],_0x5e7985[_0x75e1('0x44')]));_0x4ee298[_0x75e1('0x4c')][_0x75e1('0x65')]=_0x3c992b['id'];if(_0x5952a6[_0x75e1('0x43')]['filter']){_0x4ee298[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x4ee298[_0x75e1('0x4c')],{'$or':_[_0x75e1('0x3d')](_0x4ee298[_0x75e1('0x47')],function(_0x197ce1){var _0x4c11d1={};_0x4c11d1[_0x197ce1]={'$like':'%'+_0x5952a6['query'][_0x75e1('0x67')]+'%'};return _0x4c11d1;})});}_0x4ee298=_['merge']({},_0x4ee298,_0x5952a6[_0x75e1('0x51')]);return db['Disposition']['count']({'where':_0x4ee298['where']})['then'](function(_0x9ef896){_0x300dfd[_0x75e1('0x52')]=_0x9ef896;if(_0x5952a6[_0x75e1('0x43')][_0x75e1('0x59')]){_0x4ee298[_0x75e1('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x75e1('0x54')](_0x4ee298);})[_0x75e1('0x21')](function(_0x3175b5){_0x300dfd[_0x75e1('0x68')]=_0x3175b5;return _0x300dfd;});}})['then'](respondWithFilteredResult(_0x2ece33,_0x4ee298))['catch'](handleError(_0x2ece33,null));};exports[_0x75e1('0x69')]=function(_0x2a6417,_0x30bb9c,_0x391a7b){return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x2a6417['params']['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x30bb9c,null))[_0x75e1('0x21')](function(_0x3f9f98){if(_0x3f9f98){return _0x3f9f98[_0x75e1('0x69')](_0x2a6417[_0x75e1('0x43')][_0x75e1('0x6a')]);}})[_0x75e1('0x21')](respondWithStatusCode(_0x30bb9c,null))[_0x75e1('0x55')](handleError(_0x30bb9c,null));};exports[_0x75e1('0x6b')]=function(_0x5c54ad,_0x3e4901,_0x60e47){if(_0x5c54ad[_0x75e1('0x5c')]['id']){delete _0x5c54ad[_0x75e1('0x5c')]['id'];}return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x5c54ad[_0x75e1('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e4901,null))['then'](function(_0x4bfe31){if(_0x4bfe31){_0x5c54ad[_0x75e1('0x5c')][_0x75e1('0x65')]=_0x4bfe31['id'];return db[_0x75e1('0x6c')]['create'](_0x5c54ad['body']);}})[_0x75e1('0x21')](respondWithResult(_0x3e4901,null))[_0x75e1('0x55')](handleError(_0x3e4901,null));};exports[_0x75e1('0x6d')]=function(_0x3b5707,_0x2c8c26,_0x119ede){var _0x1a5887={'raw':![],'where':{}};var _0x295ed5={};var _0x314582={'count':0x0,'rows':[]};return db[_0x75e1('0x3e')][_0x75e1('0x6e')]({'where':{'id':_0x3b5707[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x2c8c26,null))[_0x75e1('0x21')](function(_0x149b32){if(_0x149b32){_0x295ed5[_0x75e1('0x42')]=_[_0x75e1('0x58')](db[_0x75e1('0x6c')][_0x75e1('0x3f')]);_0x295ed5['query']=_[_0x75e1('0x58')](_0x3b5707[_0x75e1('0x43')]);_0x295ed5[_0x75e1('0x44')]=_['intersection'](_0x295ed5['model'],_0x295ed5[_0x75e1('0x43')]);_0x1a5887[_0x75e1('0x47')]=_['intersection'](_0x295ed5[_0x75e1('0x42')],qs[_0x75e1('0x46')](_0x3b5707['query']['fields']));_0x1a5887['attributes']=_0x1a5887['attributes'][_0x75e1('0x48')]?_0x1a5887[_0x75e1('0x47')]:_0x295ed5[_0x75e1('0x42')];if(!_0x3b5707['query'][_0x75e1('0x66')]('nolimit')){_0x1a5887[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x3b5707[_0x75e1('0x43')]['limit']);_0x1a5887['offset']=qs[_0x75e1('0x2d')](_0x3b5707['query']['offset']);}_0x1a5887[_0x75e1('0x4a')]=qs['sort'](_0x3b5707[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x1a5887['where']=qs['filters'](_[_0x75e1('0x4d')](_0x3b5707[_0x75e1('0x43')],_0x295ed5['filters']));_0x1a5887[_0x75e1('0x4c')]['WhatsappAccountId']=_0x149b32['id'];if(_0x3b5707[_0x75e1('0x43')][_0x75e1('0x67')]){_0x1a5887[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x1a5887[_0x75e1('0x4c')],{'$or':_['map'](_0x1a5887[_0x75e1('0x47')],function(_0x38e374){var _0x50f094={};_0x50f094[_0x38e374]={'$like':'%'+_0x3b5707['query'][_0x75e1('0x67')]+'%'};return _0x50f094;})});}_0x1a5887=_['merge']({},_0x1a5887,_0x3b5707[_0x75e1('0x51')]);return db['CannedAnswer']['count']({'where':_0x1a5887['where']})[_0x75e1('0x21')](function(_0x271b0d){_0x314582[_0x75e1('0x52')]=_0x271b0d;if(_0x3b5707['query'][_0x75e1('0x59')]){_0x1a5887[_0x75e1('0x53')]=[{'all':!![]}];}return db[_0x75e1('0x6c')][_0x75e1('0x54')](_0x1a5887);})['then'](function(_0x482886){_0x314582[_0x75e1('0x68')]=_0x482886;return _0x314582;});}})[_0x75e1('0x21')](respondWithFilteredResult(_0x2c8c26,_0x1a5887))[_0x75e1('0x55')](handleError(_0x2c8c26,null));};exports[_0x75e1('0x6f')]=function(_0x3d6f72,_0x1a706d,_0x173bcd){return db['WhatsappAccount'][_0x75e1('0x5a')]({'where':{'id':_0x3d6f72[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x1a706d,null))[_0x75e1('0x21')](function(_0xc7ca20){if(_0xc7ca20){return _0xc7ca20[_0x75e1('0x6f')](_0x3d6f72[_0x75e1('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x1a706d,null))[_0x75e1('0x55')](handleError(_0x1a706d,null));};exports[_0x75e1('0x70')]=function(_0x176c06,_0xdd2306,_0x52827b){return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x176c06[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0xdd2306,null))['then'](function(_0x8660a){if(_0x8660a){return _0x8660a[_0x75e1('0x70')](_0x176c06['body']['ids'],_[_0x75e1('0x71')](_0x176c06[_0x75e1('0x5c')],[_0x75e1('0x6a'),'id'])||{})[_0x75e1('0x72')](function(_0x35cda7){for(var _0x19bee9=0x0;_0x19bee9<_0x176c06['body']['ids'][_0x75e1('0x48')];_0x19bee9+=0x1){socket[_0x75e1('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x176c06['body'][_0x75e1('0x6a')][_0x19bee9]),'WhatsappAccountId':Number(_0x176c06['params']['id'])});}return _0x35cda7;});}})[_0x75e1('0x21')](respondWithResult(_0xdd2306,null))[_0x75e1('0x55')](handleError(_0xdd2306,null));};exports[_0x75e1('0x74')]=function(_0x3979e4,_0x40a7fb,_0x46d31e){return db[_0x75e1('0x3e')]['find']({'where':{'id':_0x3979e4[_0x75e1('0x57')]['id']}})['then'](handleEntityNotFound(_0x40a7fb,null))[_0x75e1('0x21')](function(_0x9e9b35){if(_0x9e9b35){return _0x9e9b35[_0x75e1('0x74')](_0x3979e4['query'][_0x75e1('0x6a')])[_0x75e1('0x21')](function(){if(_['isArray'](_0x3979e4[_0x75e1('0x43')][_0x75e1('0x6a')])){for(var _0x7c8725=0x0;_0x7c8725<_0x3979e4['query'][_0x75e1('0x6a')][_0x75e1('0x48')];_0x7c8725+=0x1){socket[_0x75e1('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x3979e4['query'][_0x75e1('0x6a')][_0x7c8725]),'WhatsappAccountId':Number(_0x3979e4['params']['id'])});}}else{socket['emit'](_0x75e1('0x75'),{'UserId':Number(_0x3979e4['query'][_0x75e1('0x6a')]),'WhatsappAccountId':Number(_0x3979e4[_0x75e1('0x57')]['id'])});}});}})[_0x75e1('0x21')](respondWithStatusCode(_0x40a7fb,null))[_0x75e1('0x55')](handleError(_0x40a7fb,null));};exports['getAgents']=function(_0x138e7b,_0x459227,_0x2d6bb9){var _0x13ade3={};var _0x17bd5b={};var _0x5361a0;var _0x433adb;return db['WhatsappAccount'][_0x75e1('0x6e')]({'where':{'id':_0x138e7b[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x459227,null))[_0x75e1('0x21')](function(_0x3fb39a){if(_0x3fb39a){_0x5361a0=_0x3fb39a;_0x17bd5b['model']=_['keys'](db[_0x75e1('0x76')][_0x75e1('0x3f')]);_0x17bd5b['query']=_['keys'](_0x138e7b[_0x75e1('0x43')]);_0x17bd5b[_0x75e1('0x44')]=_['intersection'](_0x17bd5b[_0x75e1('0x42')],_0x17bd5b['query']);_0x13ade3['attributes']=_['intersection'](_0x17bd5b['model'],qs[_0x75e1('0x46')](_0x138e7b['query'][_0x75e1('0x46')]));_0x13ade3[_0x75e1('0x47')]=_0x13ade3['attributes'][_0x75e1('0x48')]?_0x13ade3['attributes']:_0x17bd5b[_0x75e1('0x42')];_0x13ade3[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x138e7b[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x13ade3[_0x75e1('0x4c')]=qs[_0x75e1('0x44')](_[_0x75e1('0x4d')](_0x138e7b['query'],_0x17bd5b[_0x75e1('0x44')]));if(_0x138e7b[_0x75e1('0x43')][_0x75e1('0x67')]){_0x13ade3[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x13ade3[_0x75e1('0x4c')],{'$or':_[_0x75e1('0x3d')](_0x13ade3['attributes'],function(_0x3494c2){var _0x1fb3d2={};_0x1fb3d2[_0x3494c2]={'$like':'%'+_0x138e7b[_0x75e1('0x43')][_0x75e1('0x67')]+'%'};return _0x1fb3d2;})});}_0x13ade3=_[_0x75e1('0x4e')]({},_0x13ade3,_0x138e7b['options']);return _0x5361a0[_0x75e1('0x77')](_0x13ade3);}})[_0x75e1('0x21')](function(_0x119be2){if(_0x119be2){_0x433adb=_0x119be2[_0x75e1('0x48')];if(!_0x138e7b[_0x75e1('0x43')][_0x75e1('0x66')](_0x75e1('0x49'))){_0x13ade3['limit']=qs[_0x75e1('0x2f')](_0x138e7b['query'][_0x75e1('0x2f')]);_0x13ade3['offset']=qs[_0x75e1('0x2d')](_0x138e7b[_0x75e1('0x43')][_0x75e1('0x2d')]);}return _0x5361a0[_0x75e1('0x77')](_0x13ade3);}})['then'](function(_0x57e5d4){if(_0x57e5d4){return _0x57e5d4?{'count':_0x433adb,'rows':_0x57e5d4}:null;}})['then'](respondWithResult(_0x459227,null))[_0x75e1('0x55')](handleError(_0x459227,null));};exports[_0x75e1('0x78')]=function(_0x7213be,_0x25fe9d){var _0x3bb7d4=_0x7213be[_0x75e1('0x57')]['id'];var _0x1e4755=_0x7213be['body'];var _0x3d617d=0xc8;var _0x2131f7=null;return db[_0x75e1('0x79')][_0x75e1('0x7a')]({'isolationLevel':db[_0x75e1('0x79')][_0x75e1('0x7b')]['ISOLATION_LEVELS'][_0x75e1('0x7c')]},function(_0x1eca9b){return db['WhatsappAccount'][_0x75e1('0x6e')]({'where':{'id':_0x3bb7d4},'transaction':_0x1eca9b})[_0x75e1('0x21')](function(_0x241d81){if(_0x241d81){return db[_0x75e1('0x7d')][_0x75e1('0x34')]({'where':{'WhatsappAccountId':_0x3bb7d4},'transaction':_0x1eca9b})[_0x75e1('0x21')](function(){var _0x4f2015=_[_0x75e1('0x3d')](_0x1e4755,function(_0x5222e0){_0x5222e0[_0x75e1('0x65')]=_0x3bb7d4;return _0x5222e0;});return db[_0x75e1('0x7d')][_0x75e1('0x7e')](_0x4f2015,{'transaction':_0x1eca9b});});}else{_0x3d617d=0x194;_0x2131f7=[];}});})['then'](function(){if(_0x3d617d!==0x194){return db[_0x75e1('0x7d')][_0x75e1('0x7f')]({'where':{'WhatsappAccountId':_0x3bb7d4},'order':'priority'})[_0x75e1('0x21')](function(_0x714686){_0x2131f7=_0x714686;});}})[_0x75e1('0x55')](function(_0x40abd9){_0x3d617d=0x1f4;logger['error'](_0x40abd9['stack']);if(_0x40abd9[_0x75e1('0x39')]){delete _0x40abd9[_0x75e1('0x39')];}_0x2131f7=_0x40abd9;})['finally'](function(){if(_0x2131f7===null){_0x25fe9d[_0x75e1('0x29')](_0x3d617d);}else{if(_0x3d617d===0x1f4){_0x25fe9d['status'](_0x3d617d)[_0x75e1('0x3a')](_0x2131f7);}else{_0x25fe9d['status'](_0x3d617d)[_0x75e1('0x2c')](_0x2131f7);}}});};exports[_0x75e1('0x80')]=function(_0x191d7b,_0x1e241d,_0x17c506){var _0x14bea7={};var _0x208cb1={};var _0x1dda82;var _0x23c592;return db['WhatsappAccount'][_0x75e1('0x6e')]({'where':{'id':_0x191d7b[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x1e241d,null))['then'](function(_0x47ff46){if(_0x47ff46){_0x1dda82=_0x47ff46;_0x208cb1[_0x75e1('0x42')]=_['keys'](db[_0x75e1('0x7d')][_0x75e1('0x3f')]);_0x208cb1[_0x75e1('0x43')]=_[_0x75e1('0x58')](_0x191d7b[_0x75e1('0x43')]);_0x208cb1[_0x75e1('0x44')]=_['intersection'](_0x208cb1['model'],_0x208cb1['query']);_0x14bea7[_0x75e1('0x47')]=_[_0x75e1('0x45')](_0x208cb1[_0x75e1('0x42')],qs['fields'](_0x191d7b[_0x75e1('0x43')]['fields']));_0x14bea7['attributes']=_0x14bea7['attributes'][_0x75e1('0x48')]?_0x14bea7[_0x75e1('0x47')]:_0x208cb1[_0x75e1('0x42')];_0x14bea7[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x191d7b[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x14bea7['where']=qs[_0x75e1('0x44')](_['pick'](_0x191d7b[_0x75e1('0x43')],_0x208cb1[_0x75e1('0x44')]));if(_0x191d7b['query'][_0x75e1('0x67')]){_0x14bea7[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x14bea7['where'],{'$or':_[_0x75e1('0x3d')](_0x14bea7['attributes'],function(_0x55cf26){var _0x15b76e={};_0x15b76e[_0x55cf26]={'$like':'%'+_0x191d7b[_0x75e1('0x43')][_0x75e1('0x67')]+'%'};return _0x15b76e;})});}_0x14bea7=_[_0x75e1('0x4e')]({},_0x14bea7,_0x191d7b[_0x75e1('0x51')]);return _0x1dda82[_0x75e1('0x80')](_0x14bea7);}})[_0x75e1('0x21')](function(_0x45436c){if(_0x45436c){_0x23c592=_0x45436c[_0x75e1('0x48')];if(!_0x191d7b[_0x75e1('0x43')][_0x75e1('0x66')](_0x75e1('0x49'))){_0x14bea7[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x191d7b[_0x75e1('0x43')][_0x75e1('0x2f')]);_0x14bea7['offset']=qs[_0x75e1('0x2d')](_0x191d7b[_0x75e1('0x43')][_0x75e1('0x2d')]);}return _0x1dda82[_0x75e1('0x80')](_0x14bea7);}})[_0x75e1('0x21')](function(_0x3521fb){if(_0x3521fb){return _0x3521fb?{'count':_0x23c592,'rows':_0x3521fb}:null;}})['then'](respondWithResult(_0x1e241d,null))[_0x75e1('0x55')](handleError(_0x1e241d,null));};exports[_0x75e1('0x81')]=function(_0x3eacb9,_0x399e7d,_0x6bbce7){var _0xd7ef8={'channel':_0x75e1('0x82')};var _0x654f86=[];var _0x13e91d=[];var _0x2dd11f={};return db['WhatsappAccount'][_0x75e1('0x5a')]({'where':{'id':_0x3eacb9[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0x7d')],'as':_0x75e1('0x83')}]})[_0x75e1('0x21')](handleEntityNotFound(_0x399e7d,null))['then'](function(_0x36bf66){_0xd7ef8[_0x75e1('0x84')]=_0x36bf66;if(_0xd7ef8['account']&&_0xd7ef8[_0x75e1('0x84')][_0x75e1('0x4f')]==='sinch'&&_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')]){if(_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')][_0x75e1('0x48')]===0x0)return;if(_0x3eacb9['body'][_0x75e1('0x85')][0x0][_0x75e1('0x86')]!==_0x75e1('0x87'))return;return db[_0x75e1('0x88')]['update']({'read':!![],'readAt':_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')][0x0][_0x75e1('0x89')]},{'where':{'messageId':_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')][0x0][_0x75e1('0x8a')]},'individualHooks':!![]})[_0x75e1('0x21')](function(_0x81f89c){return _0x399e7d[_0x75e1('0x2a')](0xc8)[_0x75e1('0x2c')](_0x81f89c);});}_0xd7ef8[_0x75e1('0x8b')]=_[_0x75e1('0x8c')](_0x36bf66[_0x75e1('0x83')],[_0x75e1('0x8d')],[_0x75e1('0x8e')]);if(_0xd7ef8[_0x75e1('0x84')]['Applications']){delete _0xd7ef8['account'][_0x75e1('0x83')];}return db['CmContact'][_0x75e1('0x63')]()['then'](function(_0x1e485f){if(!_0x1e485f){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0x91'));}_0x654f86=_[_0x75e1('0x92')](_[_0x75e1('0x58')](_0x1e485f),[_0x75e1('0x93'),_0x75e1('0x94')]);_0x13e91d=_['difference'](_[_0x75e1('0x58')](_0x1e485f),['createdAt',_0x75e1('0x94'),'CompanyId',_0x75e1('0x95')]);_0xd7ef8[_0x75e1('0x5c')]={'mapKey':_0x75e1('0x96')};if(_0xd7ef8['account']&&_0xd7ef8['account'][_0x75e1('0x4f')]===_0x75e1('0x97')){_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')]=_0x3eacb9[_0x75e1('0x5c')]['From'][_0x75e1('0x99')](_0x75e1('0x9a'),'');_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9b')];_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x9c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9d')];}if(_0xd7ef8[_0x75e1('0x84')]&&_0xd7ef8[_0x75e1('0x84')]['type']==='sinch'){_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')]=_0x3eacb9['body'][_0x75e1('0x9e')][0x0][_0x75e1('0x98')];_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9e')][0x0][_0x75e1('0x28')]['body'];_0xd7ef8['body'][_0x75e1('0x9c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9e')][0x0][_0x75e1('0x8a')];}if(_0xd7ef8[_0x75e1('0x5c')]['id']){delete _0xd7ef8[_0x75e1('0x5c')]['id'];}if(_[_0x75e1('0x9f')](_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')])){throw new db['Sequelize'][(_0x75e1('0x90'))](_0x75e1('0xa0'));}if(_[_0x75e1('0x9f')](_0xd7ef8['body'][_0x75e1('0x5c')])||_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')]===''){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xa1'));}if(_[_0x75e1('0x9f')](_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0xa2')])){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13e91d);}if(!_[_0x75e1('0xa3')](_0x13e91d,_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0xa2')])){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xa4')+_0x13e91d);}_0x2dd11f[_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0xa2')]]=_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')];return db[_0x75e1('0xa5')][_0x75e1('0x5a')]({'where':{'id':_0xd7ef8[_0x75e1('0x84')]['ListId']},'include':[{'model':db[_0x75e1('0xa6')],'as':_0x75e1('0xa7'),'where':_0x2dd11f,'limit':0x1,'order':[[_0x75e1('0x94'),_0x75e1('0xa8')]]}]});})[_0x75e1('0x21')](handleEntityNotFound(_0x399e7d,null))['then'](function(_0x19891d){if(_0x19891d){_0xd7ef8['list']=_[_0x75e1('0x71')](_0x19891d,[_0x75e1('0xa7')]);if(_0x19891d[_0x75e1('0xa7')][_0x75e1('0x48')]){return _0x19891d[_0x75e1('0xa7')][0x0];}var _0x155981=_[_0x75e1('0x1b')](_0xd7ef8[_0x75e1('0x5c')],{'firstName':_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')],'ListId':_0x19891d['id']});_0x155981[_0xd7ef8['body'][_0x75e1('0xa2')]]=_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')];return db[_0x75e1('0xa6')][_0x75e1('0x5b')](_0x155981,{'fields':_0x654f86,'raw':!![]});}})[_0x75e1('0x21')](handleEntityNotFound(_0x399e7d,null))[_0x75e1('0x21')](function(_0x4a838c){if(_0x4a838c){_0xd7ef8[_0x75e1('0xa9')]=_0x4a838c;var _0x46eb3e={'ContactId':_0x4a838c['id'],'phone':_0xd7ef8['body'][_0x75e1('0x98')],'WhatsappAccountId':_0x3eacb9[_0x75e1('0x57')]['id']};var _0x5d80b7={'ContactId':_0x4a838c['id'],'WhatsappAccountId':_0x3eacb9['params']['id'],'closed':![]};return db[_0x75e1('0xaa')]['find']({'where':_0x5d80b7})[_0x75e1('0x21')](function(_0x3f30af){if(_0x3f30af){return[_0x3f30af,![]];}return db['WhatsappInteraction']['create'](_0x46eb3e)[_0x75e1('0x21')](function(_0x3171d3){return[_0x3171d3,!![]];});});}})[_0x75e1('0x72')](function(_0x1dea8c,_0x88ee7b){_0xd7ef8[_0x75e1('0xab')]=_0x1dea8c[_0x75e1('0x35')]({'plain':!![]});_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xac')]=![];if(_0x88ee7b){if(_0xd7ef8[_0x75e1('0x84')]['autoclose']){_0xd7ef8[_0x75e1('0x8b')][_0x75e1('0xad')]({'id':0x0,'priority':_0xd7ef8[_0x75e1('0x8b')]['length']+0x1,'app':'close','appdata':_0x75e1('0xae'),'interval':_0x75e1('0xaf')});}_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xac')]=!![];}return db[_0x75e1('0x88')][_0x75e1('0x5b')]({'phone':_0xd7ef8['body'][_0x75e1('0x98')],'messageId':_0xd7ef8['body'][_0x75e1('0x9c')],'body':_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')],'WhatsappAccountId':_0x3eacb9['params']['id'],'WhatsappInteractionId':_0x1dea8c['id'],'direction':'in','ContactId':_0x1dea8c[_0x75e1('0xb0')],'AttachmentId':_0xd7ef8[_0x75e1('0x5c')]['AttachmentId']});})['then'](function(_0x5bca4f){_0xd7ef8[_0x75e1('0x28')]=_0x5bca4f;if(!_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xb1')])return;return db[_0x75e1('0x76')][_0x75e1('0x5a')]({'attributes':['id',_0x75e1('0x39')],'where':{'id':_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xb1')]}});})[_0x75e1('0x21')](function(_0x334a6a){if(_0x334a6a){_0xd7ef8[_0x75e1('0x8b')][_0x75e1('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x334a6a['name']+','+(_0xd7ef8['account'][_0x75e1('0xb3')]||0xa),'interval':_0x75e1('0xaf')});}if(!_0xd7ef8[_0x75e1('0xab')]['queueId'])return;return db[_0x75e1('0xb4')]['find']({'attributes':['id',_0x75e1('0x39')],'where':{'id':_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xb5')]}});})[_0x75e1('0x21')](function(_0x5e6d7e){if(_0x5e6d7e){_0xd7ef8[_0x75e1('0x8b')][_0x75e1('0xb2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5e6d7e[_0x75e1('0x39')]+','+(_0xd7ef8[_0x75e1('0x84')][_0x75e1('0xb6')]||0x12c),'interval':_0x75e1('0xaf')});}return respondWithRpcPromise(_0x75e1('0xb7'),_0x75e1('0xb8'),_0xd7ef8);})[_0x75e1('0x21')](function(_0x75460e){if(_0x75460e){var _0x478797=0xc8;var _0x5d8610=_0x75e1('0xb9');logger[_0x75e1('0x22')](_0x75e1('0x24'),_0x5d8610,_0x478797,_0x75e1('0xba'));logger[_0x75e1('0xbb')](_0x75e1('0xbc'),_0x5d8610,_0x478797,'entity\x20found',JSON[_0x75e1('0x26')](_0x75460e));if(_0xd7ef8[_0x75e1('0x84')]['type']===_0x75e1('0x97')){return _0x399e7d['status'](_0x478797)['set'](_0x75e1('0xbd'),_0x75e1('0xbe'))['send'](_0x75e1('0xbf'));}else{return _0x399e7d['status'](_0x478797)[_0x75e1('0x2c')](_0x75460e);}}});})[_0x75e1('0x55')](handleError(_0x399e7d,null));};exports[_0x75e1('0x3a')]=function(_0x287387,_0x1222cd,_0xe162e1){var _0x49eb29,_0x3656f2,_0x494587;if(_[_0x75e1('0x9f')](_0x287387[_0x75e1('0x5c')]['body'])||_0x287387[_0x75e1('0x5c')][_0x75e1('0x5c')]===''){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xa1'));}if(_['isNil'](_0x287387[_0x75e1('0x5c')]['to'])){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xc0'));}_0x49eb29=_0x287387['body']['to'];return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x287387[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0xa5')],'as':'List','include':[{'model':db[_0x75e1('0xa6')],'as':_0x75e1('0xa7'),'where':{'mobile':_0x49eb29},'limit':0x1,'order':[[_0x75e1('0x94'),_0x75e1('0xa8')]]}]}]})[_0x75e1('0x21')](handleEntityNotFound(_0x1222cd,null))[_0x75e1('0x21')](function(_0x486daa){if(_0x486daa&&_0x486daa[_0x75e1('0xc1')]){_0x3656f2=_0x486daa['get']({'plain':!![]});if(_0x3656f2[_0x75e1('0xc1')]&&_0x3656f2['List'][_0x75e1('0xa7')][_0x75e1('0x48')]){return _0x3656f2[_0x75e1('0xc1')][_0x75e1('0xa7')][0x0];}return db['CmContact'][_0x75e1('0x5b')](_[_0x75e1('0x1b')](_0x287387[_0x75e1('0x5c')],{'firstName':_0x49eb29,'mobile':_0x49eb29,'phone':_0x49eb29,'ListId':_0x3656f2[_0x75e1('0x95')]}));}})['then'](handleEntityNotFound(_0x1222cd,null))['then'](function(_0x59fc6e){if(_0x59fc6e){_0x494587=_0x59fc6e;return db[_0x75e1('0xaa')][_0x75e1('0x5a')]({'where':{'ContactId':_0x494587['id'],'closed':![],'WhatsappAccountId':_0x3656f2['id']}})[_0x75e1('0x21')](function(_0x23d4f7){if(_0x23d4f7){return[_0x23d4f7,![]];}return db[_0x75e1('0xaa')][_0x75e1('0x5b')]({'UserId':_0x287387['user']['id'],'ContactId':_0x494587['id'],'WhatsappAccountId':_0x3656f2['id'],'phone':_0x49eb29,'firstMsgDirection':_0x75e1('0xc2'),'Messages':[_['merge'](_0x287387[_0x75e1('0x5c')],{'read':![],'body':_0x287387[_0x75e1('0x5c')][_0x75e1('0x5c')],'phone':_0x49eb29,'WhatsappAccountId':_0x3656f2['id'],'UserId':_0x287387[_0x75e1('0x5d')]['id'],'ContactId':_0x494587['id']})]},{'include':[{'model':db[_0x75e1('0x88')],'as':_0x75e1('0xc3')}]})[_0x75e1('0x21')](function(_0x2ed333){return[_0x2ed333,!![]];});});}})['spread'](function(_0x5355f7,_0x394113){if(_0x394113){return _0x5355f7;}return db['WhatsappMessage']['create'](_['merge'](_0x287387[_0x75e1('0x5c')],{'read':![],'body':_0x287387[_0x75e1('0x5c')][_0x75e1('0x5c')],'phone':_0x49eb29,'WhatsappAccountId':_0x3656f2['id'],'WhatsappInteractionId':_0x5355f7['id'],'UserId':_0x287387[_0x75e1('0x5d')]['id'],'ContactId':_0x494587['id']}))['then'](function(_0x56a38e){_0x5355f7[_0x75e1('0xc4')][_0x75e1('0xc3')]=[];_0x5355f7[_0x75e1('0xc4')][_0x75e1('0xc3')][_0x75e1('0xad')](_0x56a38e[_0x75e1('0xc4')]);return _0x5355f7;});})[_0x75e1('0x21')](respondWithResult(_0x1222cd,null))[_0x75e1('0x55')](handleError(_0x1222cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index cd2864a..c623008 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 _0x6b4f=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x2755a2,_0x2a1197){var _0x719d22=function(_0x2083f3){while(--_0x2083f3){_0x2755a2['push'](_0x2755a2['shift']());}};_0x719d22(++_0x2a1197);}(_0x6b4f,0x1e5));var _0xf6b4=function(_0x150659,_0x9aa67f){_0x150659=_0x150659-0x0;var _0x1d7480=_0x6b4f[_0x150659];return _0x1d7480;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf6b4('0x0'))['db'][_0xf6b4('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf6b4('0x2')](0x0);var events={'afterCreate':_0xf6b4('0x3'),'afterUpdate':_0xf6b4('0x4'),'afterDestroy':_0xf6b4('0x5')};function emitEvent(_0x5d84c6){return function(_0x182ea0,_0x46a868,_0x5926bf){WhatsappAccountEvents[_0xf6b4('0x6')](_0x5d84c6+':'+_0x182ea0['id'],_0x182ea0);WhatsappAccountEvents['emit'](_0x5d84c6,_0x182ea0);_0x5926bf(null);};}for(var e in events){if(events[_0xf6b4('0x7')](e)){var event=events[e];WhatsappAccount[_0xf6b4('0x8')](e,emitEvent(event));}}module[_0xf6b4('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x7d16=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save'];(function(_0x244f5d,_0x3c98c6){var _0x1a3886=function(_0x2bf049){while(--_0x2bf049){_0x244f5d['push'](_0x244f5d['shift']());}};_0x1a3886(++_0x3c98c6);}(_0x7d16,0x101));var _0x67d1=function(_0x100a33,_0x377f36){_0x100a33=_0x100a33-0x0;var _0x19172d=_0x7d16[_0x100a33];return _0x19172d;};'use strict';var EventEmitter=require(_0x67d1('0x0'));var WhatsappAccount=require(_0x67d1('0x1'))['db'][_0x67d1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x67d1('0x3'),'afterUpdate':'update','afterDestroy':_0x67d1('0x4')};function emitEvent(_0x23b403){return function(_0x5e293c,_0x59cfd4,_0x5afdee){WhatsappAccountEvents['emit'](_0x23b403+':'+_0x5e293c['id'],_0x5e293c);WhatsappAccountEvents[_0x67d1('0x5')](_0x23b403,_0x5e293c);_0x5afdee(null);};}for(var e in events){if(events[_0x67d1('0x6')](e)){var event=events[e];WhatsappAccount[_0x67d1('0x7')](e,emitEvent(event));}}module[_0x67d1('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 514d457..2eed95e 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 _0x308d=['path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','bluebird'];(function(_0x26c0c3,_0x48b2cf){var _0x26cefe=function(_0x5b5289){while(--_0x5b5289){_0x26c0c3['push'](_0x26c0c3['shift']());}};_0x26cefe(++_0x48b2cf);}(_0x308d,0xac));var _0xd308=function(_0x315f03,_0x5e8e84){_0x315f03=_0x315f03-0x0;var _0x2c8a1d=_0x308d[_0x315f03];return _0x2c8a1d;};'use strict';var _=require(_0xd308('0x0'));var util=require(_0xd308('0x1'));var logger=require('../../config/logger')(_0xd308('0x2'));var moment=require('moment');var BPromise=require(_0xd308('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd308('0x4'));var rimraf=require(_0xd308('0x5'));var config=require(_0xd308('0x6'));var attributes=require(_0xd308('0x7'));module['exports']=function(_0x390beb,_0x243502){return _0x390beb[_0xd308('0x8')](_0xd308('0x9'),attributes,{'tableName':_0xd308('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d3e=['define','WhatsappAccount','whatsapp_accounts','lodash','bluebird','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x2876a0,_0x5a09e3){var _0x5c4aae=function(_0x499cd2){while(--_0x499cd2){_0x2876a0['push'](_0x2876a0['shift']());}};_0x5c4aae(++_0x5a09e3);}(_0x3d3e,0x8a));var _0xe3d3=function(_0x24d45f,_0xf890c1){_0x24d45f=_0x24d45f-0x0;var _0x43bb07=_0x3d3e[_0x24d45f];return _0x43bb07;};'use strict';var _=require(_0xe3d3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe3d3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3d3('0x2'));var rimraf=require(_0xe3d3('0x3'));var config=require('../../config/environment');var attributes=require(_0xe3d3('0x4'));module[_0xe3d3('0x5')]=function(_0xdd7218,_0x1f4282){return _0xdd7218[_0xe3d3('0x6')](_0xe3d3('0x7'),attributes,{'tableName':_0xe3d3('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 75a38bf..2a67bdd 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 _0xc988=['where','include','model','attributes','map','ShowWhatsappAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','WhatsappAccount','find','options','raw'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xc988,0x12f));var _0x8c98=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc988[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x8c98('0x0'));var util=require(_0x8c98('0x1'));var moment=require(_0x8c98('0x2'));var BPromise=require(_0x8c98('0x3'));var rs=require(_0x8c98('0x4'));var fs=require('fs');var Redis=require(_0x8c98('0x5'));var db=require(_0x8c98('0x6'))['db'];var utils=require(_0x8c98('0x7'));var logger=require(_0x8c98('0x8'))(_0x8c98('0x9'));var config=require('../../config/environment');var jayson=require(_0x8c98('0xa'));var client=jayson[_0x8c98('0xb')]['http']({'port':0x232a});config[_0x8c98('0xc')]=_[_0x8c98('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c98('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x8c98('0xf')](socket);function respondWithRpcPromise(_0x286e2e,_0x1e2ec2,_0x3c0278){return new BPromise(function(_0x34bad6,_0x247acd){return client[_0x8c98('0x10')](_0x286e2e,_0x3c0278)[_0x8c98('0x11')](function(_0x161710){logger['info'](_0x8c98('0x12'),_0x1e2ec2,_0x8c98('0x13'));logger[_0x8c98('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1e2ec2,_0x8c98('0x13'),JSON['stringify'](_0x161710));if(_0x161710[_0x8c98('0x15')]){if(_0x161710['error'][_0x8c98('0x16')]===0x1f4){logger[_0x8c98('0x15')](_0x8c98('0x12'),_0x1e2ec2,_0x161710[_0x8c98('0x15')][_0x8c98('0x17')]);return _0x247acd(_0x161710[_0x8c98('0x15')][_0x8c98('0x17')]);}logger['error'](_0x8c98('0x12'),_0x1e2ec2,_0x161710[_0x8c98('0x15')]['message']);return _0x34bad6(_0x161710[_0x8c98('0x15')][_0x8c98('0x17')]);}else{logger[_0x8c98('0x18')](_0x8c98('0x12'),_0x1e2ec2,'request\x20sent');_0x34bad6(_0x161710['result'][_0x8c98('0x17')]);}})[_0x8c98('0x19')](function(_0x418b37){logger[_0x8c98('0x15')](_0x8c98('0x12'),_0x1e2ec2,_0x418b37);_0x247acd(_0x418b37);});});}exports['ShowWhatsappAccount']=function(_0x2020e9){var _0x49dd40=this;return new Promise(function(_0x2b6ff2,_0x1fa25b){return db[_0x8c98('0x1a')][_0x8c98('0x1b')]({'raw':_0x2020e9[_0x8c98('0x1c')]?_0x2020e9[_0x8c98('0x1c')][_0x8c98('0x1d')]===undefined?!![]:![]:!![],'where':_0x2020e9['options']?_0x2020e9[_0x8c98('0x1c')][_0x8c98('0x1e')]||null:null,'attributes':_0x2020e9['options']?_0x2020e9[_0x8c98('0x1c')]['attributes']||null:null,'include':_0x2020e9[_0x8c98('0x1c')]?_0x2020e9[_0x8c98('0x1c')][_0x8c98('0x1f')]?_['map'](_0x2020e9[_0x8c98('0x1c')][_0x8c98('0x1f')],function(_0x549356){return{'model':db[_0x549356[_0x8c98('0x20')]],'as':_0x549356['as'],'attributes':_0x549356[_0x8c98('0x21')],'include':_0x549356[_0x8c98('0x1f')]?_['map'](_0x549356[_0x8c98('0x1f')],function(_0x2062fb){return{'model':db[_0x2062fb['model']],'as':_0x2062fb['as'],'attributes':_0x2062fb[_0x8c98('0x21')],'include':_0x2062fb[_0x8c98('0x1f')]?_[_0x8c98('0x22')](_0x2062fb[_0x8c98('0x1f')],function(_0xeadec4){return{'model':db[_0xeadec4[_0x8c98('0x20')]],'as':_0xeadec4['as'],'attributes':_0xeadec4[_0x8c98('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8c98('0x11')](function(_0x1aad07){logger[_0x8c98('0x18')](_0x8c98('0x23'),_0x2020e9);logger['debug']('ShowWhatsappAccount',_0x2020e9,JSON[_0x8c98('0x24')](_0x1aad07));_0x2b6ff2(_0x1aad07);})[_0x8c98('0x19')](function(_0x4c4bd4){logger['error'](_0x8c98('0x23'),_0x4c4bd4[_0x8c98('0x17')],_0x2020e9);_0x1fa25b(_0x49dd40[_0x8c98('0x15')](0x1f4,_0x4c4bd4[_0x8c98('0x17')]));});});}; \ No newline at end of file +var _0x5bc9=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request'];(function(_0x155e04,_0x28cd61){var _0x4590d0=function(_0x3f685b){while(--_0x3f685b){_0x155e04['push'](_0x155e04['shift']());}};_0x4590d0(++_0x28cd61);}(_0x5bc9,0x1ac));var _0x95bc=function(_0x591bfb,_0x4b3895){_0x591bfb=_0x591bfb-0x0;var _0xf8811c=_0x5bc9[_0x591bfb];return _0xf8811c;};'use strict';var _=require('lodash');var util=require(_0x95bc('0x0'));var moment=require(_0x95bc('0x1'));var BPromise=require(_0x95bc('0x2'));var rs=require(_0x95bc('0x3'));var fs=require('fs');var Redis=require(_0x95bc('0x4'));var db=require(_0x95bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95bc('0x6'))(_0x95bc('0x7'));var config=require(_0x95bc('0x8'));var jayson=require(_0x95bc('0x9'));var client=jayson[_0x95bc('0xa')]['http']({'port':0x232a});config[_0x95bc('0xb')]=_['defaults'](config['redis'],{'host':_0x95bc('0xc'),'port':0x18eb});var socket=require(_0x95bc('0xd'))(new Redis(config['redis']));require(_0x95bc('0xe'))['register'](socket);function respondWithRpcPromise(_0x562df7,_0x4d2a1d,_0x521425){return new BPromise(function(_0x407785,_0x2e5660){return client[_0x95bc('0xf')](_0x562df7,_0x521425)['then'](function(_0x15e990){logger[_0x95bc('0x10')](_0x95bc('0x11'),_0x4d2a1d,_0x95bc('0x12'));logger[_0x95bc('0x13')](_0x95bc('0x14'),_0x4d2a1d,_0x95bc('0x12'),JSON[_0x95bc('0x15')](_0x15e990));if(_0x15e990[_0x95bc('0x16')]){if(_0x15e990['error'][_0x95bc('0x17')]===0x1f4){logger[_0x95bc('0x16')](_0x95bc('0x11'),_0x4d2a1d,_0x15e990[_0x95bc('0x16')][_0x95bc('0x18')]);return _0x2e5660(_0x15e990[_0x95bc('0x16')]['message']);}logger[_0x95bc('0x16')](_0x95bc('0x11'),_0x4d2a1d,_0x15e990[_0x95bc('0x16')]['message']);return _0x407785(_0x15e990[_0x95bc('0x16')][_0x95bc('0x18')]);}else{logger['info'](_0x95bc('0x11'),_0x4d2a1d,_0x95bc('0x12'));_0x407785(_0x15e990[_0x95bc('0x19')][_0x95bc('0x18')]);}})[_0x95bc('0x1a')](function(_0x213fe5){logger['error'](_0x95bc('0x11'),_0x4d2a1d,_0x213fe5);_0x2e5660(_0x213fe5);});});}exports[_0x95bc('0x1b')]=function(_0x37d219){var _0x3e9648=this;return new Promise(function(_0x18a681,_0x477af1){return db[_0x95bc('0x1c')][_0x95bc('0x1d')]({'raw':_0x37d219[_0x95bc('0x1e')]?_0x37d219[_0x95bc('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x37d219['options']?_0x37d219['options'][_0x95bc('0x1f')]||null:null,'attributes':_0x37d219['options']?_0x37d219[_0x95bc('0x1e')][_0x95bc('0x20')]||null:null,'include':_0x37d219['options']?_0x37d219['options'][_0x95bc('0x21')]?_[_0x95bc('0x22')](_0x37d219[_0x95bc('0x1e')][_0x95bc('0x21')],function(_0x11e415){return{'model':db[_0x11e415[_0x95bc('0x23')]],'as':_0x11e415['as'],'attributes':_0x11e415[_0x95bc('0x20')],'include':_0x11e415[_0x95bc('0x21')]?_[_0x95bc('0x22')](_0x11e415[_0x95bc('0x21')],function(_0x584d7b){return{'model':db[_0x584d7b[_0x95bc('0x23')]],'as':_0x584d7b['as'],'attributes':_0x584d7b[_0x95bc('0x20')],'include':_0x584d7b[_0x95bc('0x21')]?_['map'](_0x584d7b['include'],function(_0x368536){return{'model':db[_0x368536[_0x95bc('0x23')]],'as':_0x368536['as'],'attributes':_0x368536[_0x95bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x95bc('0x24')](function(_0x5e9779){logger[_0x95bc('0x10')](_0x95bc('0x1b'),_0x37d219);logger[_0x95bc('0x13')]('ShowWhatsappAccount',_0x37d219,JSON[_0x95bc('0x15')](_0x5e9779));_0x18a681(_0x5e9779);})[_0x95bc('0x1a')](function(_0x4af91f){logger[_0x95bc('0x16')](_0x95bc('0x1b'),_0x4af91f[_0x95bc('0x18')],_0x37d219);_0x477af1(_0x3e9648[_0x95bc('0x16')](0x1f4,_0x4af91f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0782126..94723fd 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 _0x28dc=['remove','update','emit','removeListener','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x26a6e2,_0x562b13){var _0xc0c708=function(_0x965f5a){while(--_0x965f5a){_0x26a6e2['push'](_0x26a6e2['shift']());}};_0xc0c708(++_0x562b13);}(_0x28dc,0xd0));var _0xc28d=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x28dc[_0x8afdd0];return _0x3de7ac;};'use strict';var WhatsappAccountEvents=require(_0xc28d('0x0'));var events=[_0xc28d('0x1'),_0xc28d('0x2'),_0xc28d('0x3')];function createListener(_0x166103,_0x2cc1c8){return function(_0x3bd14d){_0x2cc1c8[_0xc28d('0x4')](_0x166103,_0x3bd14d);};}function removeListener(_0x2f3a9d,_0x601c27){return function(){WhatsappAccountEvents[_0xc28d('0x5')](_0x2f3a9d,_0x601c27);};}exports['register']=function(_0x376cda){for(var _0x423efa=0x0,_0xcf7f08=events['length'];_0x423efa<_0xcf7f08;_0x423efa++){var _0x42d8fa=events[_0x423efa];var _0x31d9ae=createListener(_0xc28d('0x6')+_0x42d8fa,_0x376cda);WhatsappAccountEvents['on'](_0x42d8fa,_0x31d9ae);}}; \ No newline at end of file +var _0xf4ee=['length','whatsappAccount:','./whatsappAccount.events','save','update','emit'];(function(_0x47543d,_0xcd7c7d){var _0x392bd4=function(_0x233d4c){while(--_0x233d4c){_0x47543d['push'](_0x47543d['shift']());}};_0x392bd4(++_0xcd7c7d);}(_0xf4ee,0x158));var _0xef4e=function(_0x34fa9f,_0x4e95b8){_0x34fa9f=_0x34fa9f-0x0;var _0x1720c5=_0xf4ee[_0x34fa9f];return _0x1720c5;};'use strict';var WhatsappAccountEvents=require(_0xef4e('0x0'));var events=[_0xef4e('0x1'),'remove',_0xef4e('0x2')];function createListener(_0x58f8a5,_0x29236c){return function(_0x1eddc5){_0x29236c[_0xef4e('0x3')](_0x58f8a5,_0x1eddc5);};}function removeListener(_0x1b6200,_0x27d6e3){return function(){WhatsappAccountEvents['removeListener'](_0x1b6200,_0x27d6e3);};}exports['register']=function(_0x1e7f48){for(var _0x2c8e87=0x0,_0x26541a=events[_0xef4e('0x4')];_0x2c8e87<_0x26541a;_0x2c8e87++){var _0x352bf1=events[_0x2c8e87];var _0x48f028=createListener(_0xef4e('0x5')+_0x352bf1,_0x1e7f48);WhatsappAccountEvents['on'](_0x352bf1,_0x48f028);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ed77e5a..cecf0a7 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 _0x45e4=['express','fs-extra','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x45e4,0x161));var _0x445e=function(_0x52c651,_0x4c1f4e){_0x52c651=_0x52c651-0x0;var _0x525ceb=_0x45e4[_0x52c651];return _0x525ceb;};'use strict';var multer=require(_0x445e('0x0'));var util=require(_0x445e('0x1'));var path=require(_0x445e('0x2'));var timeout=require(_0x445e('0x3'));var express=require(_0x445e('0x4'));var router=express['Router']();var fs_extra=require(_0x445e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x445e('0x6'));var controller=require(_0x445e('0x7'));router['get']('/',auth[_0x445e('0x8')](),controller[_0x445e('0x9')]);router['get'](_0x445e('0xa'),auth[_0x445e('0x8')](),controller[_0x445e('0xb')]);router[_0x445e('0xc')]('/',auth[_0x445e('0x8')](),controller[_0x445e('0xd')]);router[_0x445e('0xe')]('/:id',auth[_0x445e('0x8')](),controller[_0x445e('0xf')]);router[_0x445e('0x10')](_0x445e('0xa'),auth[_0x445e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x35ba=['create','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x4bf3ef,_0x1f4737){var _0x10b82c=function(_0xbee6c8){while(--_0xbee6c8){_0x4bf3ef['push'](_0x4bf3ef['shift']());}};_0x10b82c(++_0x1f4737);}(_0x35ba,0xcf));var _0xa35b=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x35ba[_0x359377];return _0x8be18a;};'use strict';var multer=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var path=require('path');var timeout=require(_0xa35b('0x2'));var express=require(_0xa35b('0x3'));var router=express[_0xa35b('0x4')]();var fs_extra=require(_0xa35b('0x5'));var auth=require(_0xa35b('0x6'));var interaction=require(_0xa35b('0x7'));var config=require(_0xa35b('0x8'));var controller=require('./whatsappApplication.controller');router[_0xa35b('0x9')]('/',auth[_0xa35b('0xa')](),controller[_0xa35b('0xb')]);router['get'](_0xa35b('0xc'),auth[_0xa35b('0xa')](),controller['show']);router[_0xa35b('0xd')]('/',auth['isAuthenticated'](),controller[_0xa35b('0xe')]);router[_0xa35b('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa35b('0xc'),auth[_0xa35b('0xa')](),controller['destroy']);module[_0xa35b('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fd9f85a..a9c7a71 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 _0x28aa=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4ac3be,_0x43058d){var _0x42c41e=function(_0x38e815){while(--_0x38e815){_0x4ac3be['push'](_0x4ac3be['shift']());}};_0x42c41e(++_0x43058d);}(_0x28aa,0x148));var _0xa28a=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x28aa[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0xa28a('0x0'));module[_0xa28a('0x1')]={'priority':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa28a('0x3')],'allowNull':![],'defaultValue':_0xa28a('0x4')},'appdata':{'type':Sequelize[_0xa28a('0x5')]()},'description':{'type':Sequelize[_0xa28a('0x3')]},'interval':{'type':Sequelize[_0xa28a('0x3')],'defaultValue':_0xa28a('0x6')}}; \ No newline at end of file +var _0x2eac=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x311a67,_0x1956c1){var _0x107631=function(_0x15edd9){while(--_0x15edd9){_0x311a67['push'](_0x311a67['shift']());}};_0x107631(++_0x1956c1);}(_0x2eac,0x19f));var _0xc2ea=function(_0x177151,_0x432d3a){_0x177151=_0x177151-0x0;var _0x2bbf15=_0x2eac[_0x177151];return _0x2bbf15;};'use strict';var Sequelize=require('sequelize');module[_0xc2ea('0x0')]={'priority':{'type':Sequelize[_0xc2ea('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc2ea('0x2')],'allowNull':![],'defaultValue':_0xc2ea('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc2ea('0x2')]},'interval':{'type':Sequelize[_0xc2ea('0x2')],'defaultValue':_0xc2ea('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 336e01e..66ff2e3 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 _0x68b3=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','eml-format','rimraf'];(function(_0x1df0bb,_0x251c51){var _0x41a310=function(_0x4744c1){while(--_0x4744c1){_0x1df0bb['push'](_0x1df0bb['shift']());}};_0x41a310(++_0x251c51);}(_0x68b3,0x1d8));var _0x368b=function(_0x4728b0,_0x20218e){_0x4728b0=_0x4728b0-0x0;var _0x58e2a4=_0x68b3[_0x4728b0];return _0x58e2a4;};'use strict';var emlformat=require(_0x368b('0x0'));var rimraf=require(_0x368b('0x1'));var zipdir=require(_0x368b('0x2'));var jsonpatch=require(_0x368b('0x3'));var rp=require(_0x368b('0x4'));var moment=require('moment');var BPromise=require(_0x368b('0x5'));var Mustache=require(_0x368b('0x6'));var util=require(_0x368b('0x7'));var path=require(_0x368b('0x8'));var sox=require('sox');var csv=require(_0x368b('0x9'));var ejs=require(_0x368b('0xa'));var fs=require('fs');var fs_extra=require(_0x368b('0xb'));var _=require(_0x368b('0xc'));var squel=require(_0x368b('0xd'));var crypto=require(_0x368b('0xe'));var jsforce=require(_0x368b('0xf'));var deskjs=require(_0x368b('0x10'));var toCsv=require(_0x368b('0x9'));var querystring=require(_0x368b('0x11'));var Papa=require(_0x368b('0x12'));var Redis=require('ioredis');var authService=require(_0x368b('0x13'));var qs=require(_0x368b('0x14'));var as=require(_0x368b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x368b('0x16'))(_0x368b('0x17'));var utils=require(_0x368b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x368b('0x19'));var db=require(_0x368b('0x1a'))['db'];function respondWithStatusCode(_0x514dc7,_0x109a90){_0x109a90=_0x109a90||0xcc;return function(_0x250697){if(_0x250697){return _0x514dc7[_0x368b('0x1b')](_0x109a90);}return _0x514dc7[_0x368b('0x1c')](_0x109a90)[_0x368b('0x1d')]();};}function respondWithResult(_0x4fffe5,_0x2b326c){_0x2b326c=_0x2b326c||0xc8;return function(_0x40faa0){if(_0x40faa0){return _0x4fffe5['status'](_0x2b326c)[_0x368b('0x1e')](_0x40faa0);}};}function respondWithFilteredResult(_0x2aabb9,_0x30c245){return function(_0x515350){if(_0x515350){var _0x220cd5=typeof _0x30c245[_0x368b('0x1f')]===_0x368b('0x20')&&typeof _0x30c245['limit']===_0x368b('0x20');var _0x1b9e65=_0x515350[_0x368b('0x21')];var _0x540f57=_0x220cd5?0x0:_0x30c245['offset'];var _0x3e2e9f=_0x220cd5?_0x515350[_0x368b('0x21')]:_0x30c245[_0x368b('0x1f')]+_0x30c245[_0x368b('0x22')];var _0x1a4f20;if(_0x3e2e9f>=_0x1b9e65){_0x3e2e9f=_0x1b9e65;_0x1a4f20=0xc8;}else{_0x1a4f20=0xce;}_0x2aabb9['status'](_0x1a4f20);return _0x2aabb9[_0x368b('0x23')](_0x368b('0x24'),_0x540f57+'-'+_0x3e2e9f+'/'+_0x1b9e65)[_0x368b('0x1e')](_0x515350);}return null;};}function patchUpdates(_0x1c927f){return function(_0x23da8f){try{jsonpatch[_0x368b('0x25')](_0x23da8f,_0x1c927f,!![]);}catch(_0x397185){return BPromise[_0x368b('0x26')](_0x397185);}return _0x23da8f['save']();};}function saveUpdates(_0x13e750,_0x2f08d9){return function(_0x18869a){if(_0x18869a){return _0x18869a[_0x368b('0x27')](_0x13e750)[_0x368b('0x28')](function(_0x4c2fca){return _0x4c2fca;});}return null;};}function removeEntity(_0x286641,_0x1ca429){return function(_0x3a22bd){if(_0x3a22bd){return _0x3a22bd[_0x368b('0x29')]()[_0x368b('0x28')](function(){_0x286641[_0x368b('0x1c')](0xcc)[_0x368b('0x1d')]();});}};}function handleEntityNotFound(_0x11ea2d,_0x3123c1){return function(_0x3f7f89){if(!_0x3f7f89){_0x11ea2d[_0x368b('0x1b')](0x194);}return _0x3f7f89;};}function handleError(_0x344d8a,_0xceec4b){_0xceec4b=_0xceec4b||0x1f4;return function(_0x376e61){logger[_0x368b('0x2a')](_0x376e61[_0x368b('0x2b')]);if(_0x376e61[_0x368b('0x2c')]){delete _0x376e61[_0x368b('0x2c')];}_0x344d8a[_0x368b('0x1c')](_0xceec4b)[_0x368b('0x2d')](_0x376e61);};}exports[_0x368b('0x2e')]=function(_0xc12627,_0x107d2f){var _0x3c80b5={},_0x5db0b4={},_0x4af77a={'count':0x0,'rows':[]};var _0x381324=_[_0x368b('0x2f')](db[_0x368b('0x30')][_0x368b('0x31')],function(_0x5d6ebf){return{'name':_0x5d6ebf[_0x368b('0x32')],'type':_0x5d6ebf[_0x368b('0x33')][_0x368b('0x34')]};});_0x5db0b4[_0x368b('0x35')]=_[_0x368b('0x2f')](_0x381324,'name');_0x5db0b4[_0x368b('0x36')]=_[_0x368b('0x37')](_0xc12627[_0x368b('0x36')]);_0x5db0b4[_0x368b('0x38')]=_['intersection'](_0x5db0b4['model'],_0x5db0b4['query']);_0x3c80b5[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x5db0b4[_0x368b('0x35')],qs[_0x368b('0x3b')](_0xc12627[_0x368b('0x36')]['fields']));_0x3c80b5[_0x368b('0x39')]=_0x3c80b5[_0x368b('0x39')]['length']?_0x3c80b5[_0x368b('0x39')]:_0x5db0b4[_0x368b('0x35')];if(!_0xc12627['query'][_0x368b('0x3c')](_0x368b('0x3d'))){_0x3c80b5['limit']=qs[_0x368b('0x22')](_0xc12627['query']['limit']);_0x3c80b5['offset']=qs[_0x368b('0x1f')](_0xc12627[_0x368b('0x36')][_0x368b('0x1f')]);}_0x3c80b5[_0x368b('0x3e')]=qs[_0x368b('0x3f')](_0xc12627[_0x368b('0x36')][_0x368b('0x3f')]);_0x3c80b5[_0x368b('0x40')]=qs[_0x368b('0x38')](_[_0x368b('0x41')](_0xc12627['query'],_0x5db0b4[_0x368b('0x38')]),_0x381324);if(_0xc12627[_0x368b('0x36')]['filter']){_0x3c80b5[_0x368b('0x40')]=_[_0x368b('0x42')](_0x3c80b5[_0x368b('0x40')],{'$or':_[_0x368b('0x2f')](_0x381324,function(_0x248b2b){if(_0x248b2b['type']!==_0x368b('0x43')){var _0x4287c6={};_0x4287c6[_0x248b2b[_0x368b('0x2c')]]={'$like':'%'+_0xc12627[_0x368b('0x36')]['filter']+'%'};return _0x4287c6;}})});}_0x3c80b5=_['merge']({},_0x3c80b5,_0xc12627[_0x368b('0x44')]);var _0x3d00f9={'where':_0x3c80b5[_0x368b('0x40')]};return db[_0x368b('0x30')][_0x368b('0x21')](_0x3d00f9)[_0x368b('0x28')](function(_0x1d990c){_0x4af77a[_0x368b('0x21')]=_0x1d990c;if(_0xc12627[_0x368b('0x36')][_0x368b('0x45')]){_0x3c80b5['include']=[{'all':!![]}];}return db[_0x368b('0x30')][_0x368b('0x46')](_0x3c80b5);})['then'](function(_0x25e713){_0x4af77a[_0x368b('0x47')]=_0x25e713;return _0x4af77a;})[_0x368b('0x28')](respondWithFilteredResult(_0x107d2f,_0x3c80b5))[_0x368b('0x48')](handleError(_0x107d2f,null));};exports['show']=function(_0x490eb6,_0x151711){var _0x4a0275={'raw':!![],'where':{'id':_0x490eb6[_0x368b('0x49')]['id']}},_0x91bb0b={};_0x91bb0b[_0x368b('0x35')]=_['keys'](db[_0x368b('0x30')][_0x368b('0x31')]);_0x91bb0b[_0x368b('0x36')]=_['keys'](_0x490eb6['query']);_0x91bb0b[_0x368b('0x38')]=_[_0x368b('0x3a')](_0x91bb0b['model'],_0x91bb0b[_0x368b('0x36')]);_0x4a0275[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x91bb0b[_0x368b('0x35')],qs[_0x368b('0x3b')](_0x490eb6[_0x368b('0x36')][_0x368b('0x3b')]));_0x4a0275[_0x368b('0x39')]=_0x4a0275[_0x368b('0x39')][_0x368b('0x4a')]?_0x4a0275[_0x368b('0x39')]:_0x91bb0b[_0x368b('0x35')];if(_0x490eb6[_0x368b('0x36')]['includeAll']){_0x4a0275[_0x368b('0x4b')]=[{'all':!![]}];}_0x4a0275=_[_0x368b('0x42')]({},_0x4a0275,_0x490eb6[_0x368b('0x44')]);return db[_0x368b('0x30')][_0x368b('0x4c')](_0x4a0275)['then'](handleEntityNotFound(_0x151711,null))['then'](respondWithResult(_0x151711,null))[_0x368b('0x48')](handleError(_0x151711,null));};exports[_0x368b('0x4d')]=function(_0x1c8755,_0x5a9d70){return db[_0x368b('0x30')][_0x368b('0x4d')](_0x1c8755[_0x368b('0x4e')],{})[_0x368b('0x28')](respondWithResult(_0x5a9d70,0xc9))[_0x368b('0x48')](handleError(_0x5a9d70,null));};exports[_0x368b('0x27')]=function(_0x8f35b,_0x1174fa){if(_0x8f35b[_0x368b('0x4e')]['id']){delete _0x8f35b[_0x368b('0x4e')]['id'];}return db['WhatsappApplication'][_0x368b('0x4c')]({'where':{'id':_0x8f35b['params']['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x1174fa,null))['then'](saveUpdates(_0x8f35b[_0x368b('0x4e')],null))['then'](respondWithResult(_0x1174fa,null))[_0x368b('0x48')](handleError(_0x1174fa,null));};exports[_0x368b('0x29')]=function(_0x3b8a12,_0x458d9a){return db['WhatsappApplication'][_0x368b('0x4c')]({'where':{'id':_0x3b8a12[_0x368b('0x49')]['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x458d9a,null))[_0x368b('0x28')](removeEntity(_0x458d9a,null))[_0x368b('0x48')](handleError(_0x458d9a,null));}; \ No newline at end of file +var _0x9ab8=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0x9ab8,0x81));var _0x89ab=function(_0x28f1f5,_0x1f5c46){_0x28f1f5=_0x28f1f5-0x0;var _0xe2f863=_0x9ab8[_0x28f1f5];return _0xe2f863;};'use strict';var emlformat=require(_0x89ab('0x0'));var rimraf=require(_0x89ab('0x1'));var zipdir=require(_0x89ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x89ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89ab('0x4'));var util=require(_0x89ab('0x5'));var path=require('path');var sox=require(_0x89ab('0x6'));var csv=require(_0x89ab('0x7'));var ejs=require(_0x89ab('0x8'));var fs=require('fs');var fs_extra=require(_0x89ab('0x9'));var _=require(_0x89ab('0xa'));var squel=require(_0x89ab('0xb'));var crypto=require(_0x89ab('0xc'));var jsforce=require(_0x89ab('0xd'));var deskjs=require(_0x89ab('0xe'));var toCsv=require(_0x89ab('0x7'));var querystring=require(_0x89ab('0xf'));var Papa=require(_0x89ab('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(_0x89ab('0x11'))(_0x89ab('0x12'));var utils=require(_0x89ab('0x13'));var config=require(_0x89ab('0x14'));var licenseUtil=require(_0x89ab('0x15'));var db=require(_0x89ab('0x16'))['db'];function respondWithStatusCode(_0x9f2616,_0x55a2eb){_0x55a2eb=_0x55a2eb||0xcc;return function(_0x15e7bc){if(_0x15e7bc){return _0x9f2616[_0x89ab('0x17')](_0x55a2eb);}return _0x9f2616[_0x89ab('0x18')](_0x55a2eb)[_0x89ab('0x19')]();};}function respondWithResult(_0x6ac355,_0x5c8310){_0x5c8310=_0x5c8310||0xc8;return function(_0x2bcab1){if(_0x2bcab1){return _0x6ac355[_0x89ab('0x18')](_0x5c8310)['json'](_0x2bcab1);}};}function respondWithFilteredResult(_0x585cf8,_0x5d70d9){return function(_0x57037f){if(_0x57037f){var _0x4fd002=typeof _0x5d70d9['offset']===_0x89ab('0x1a')&&typeof _0x5d70d9[_0x89ab('0x1b')]===_0x89ab('0x1a');var _0xd486ae=_0x57037f[_0x89ab('0x1c')];var _0x141b86=_0x4fd002?0x0:_0x5d70d9[_0x89ab('0x1d')];var _0x2af38f=_0x4fd002?_0x57037f[_0x89ab('0x1c')]:_0x5d70d9['offset']+_0x5d70d9[_0x89ab('0x1b')];var _0x23395e;if(_0x2af38f>=_0xd486ae){_0x2af38f=_0xd486ae;_0x23395e=0xc8;}else{_0x23395e=0xce;}_0x585cf8['status'](_0x23395e);return _0x585cf8['set'](_0x89ab('0x1e'),_0x141b86+'-'+_0x2af38f+'/'+_0xd486ae)[_0x89ab('0x1f')](_0x57037f);}return null;};}function patchUpdates(_0x58a14c){return function(_0x96817){try{jsonpatch[_0x89ab('0x20')](_0x96817,_0x58a14c,!![]);}catch(_0x2a5b01){return BPromise[_0x89ab('0x21')](_0x2a5b01);}return _0x96817[_0x89ab('0x22')]();};}function saveUpdates(_0x419363,_0x1be6d9){return function(_0x251a70){if(_0x251a70){return _0x251a70[_0x89ab('0x23')](_0x419363)[_0x89ab('0x24')](function(_0x1a361b){return _0x1a361b;});}return null;};}function removeEntity(_0x418aa7,_0x257aec){return function(_0x1b9e75){if(_0x1b9e75){return _0x1b9e75[_0x89ab('0x25')]()[_0x89ab('0x24')](function(){_0x418aa7['status'](0xcc)[_0x89ab('0x19')]();});}};}function handleEntityNotFound(_0x548430,_0x13359b){return function(_0x599422){if(!_0x599422){_0x548430['sendStatus'](0x194);}return _0x599422;};}function handleError(_0xd22b9c,_0x539709){_0x539709=_0x539709||0x1f4;return function(_0x5c2c79){logger[_0x89ab('0x26')](_0x5c2c79[_0x89ab('0x27')]);if(_0x5c2c79[_0x89ab('0x28')]){delete _0x5c2c79[_0x89ab('0x28')];}_0xd22b9c['status'](_0x539709)[_0x89ab('0x29')](_0x5c2c79);};}exports[_0x89ab('0x2a')]=function(_0x1919ee,_0xf8a71){var _0x5246d7={},_0x407018={},_0x3dbd1b={'count':0x0,'rows':[]};var _0x772758=_[_0x89ab('0x2b')](db[_0x89ab('0x2c')][_0x89ab('0x2d')],function(_0x25c6d1){return{'name':_0x25c6d1[_0x89ab('0x2e')],'type':_0x25c6d1[_0x89ab('0x2f')][_0x89ab('0x30')]};});_0x407018[_0x89ab('0x31')]=_[_0x89ab('0x2b')](_0x772758,'name');_0x407018[_0x89ab('0x32')]=_[_0x89ab('0x33')](_0x1919ee['query']);_0x407018[_0x89ab('0x34')]=_['intersection'](_0x407018[_0x89ab('0x31')],_0x407018['query']);_0x5246d7[_0x89ab('0x35')]=_[_0x89ab('0x36')](_0x407018[_0x89ab('0x31')],qs[_0x89ab('0x37')](_0x1919ee['query'][_0x89ab('0x37')]));_0x5246d7[_0x89ab('0x35')]=_0x5246d7['attributes'][_0x89ab('0x38')]?_0x5246d7[_0x89ab('0x35')]:_0x407018['model'];if(!_0x1919ee[_0x89ab('0x32')][_0x89ab('0x39')](_0x89ab('0x3a'))){_0x5246d7[_0x89ab('0x1b')]=qs['limit'](_0x1919ee['query'][_0x89ab('0x1b')]);_0x5246d7[_0x89ab('0x1d')]=qs[_0x89ab('0x1d')](_0x1919ee['query'][_0x89ab('0x1d')]);}_0x5246d7['order']=qs[_0x89ab('0x3b')](_0x1919ee[_0x89ab('0x32')][_0x89ab('0x3b')]);_0x5246d7['where']=qs[_0x89ab('0x34')](_[_0x89ab('0x3c')](_0x1919ee[_0x89ab('0x32')],_0x407018[_0x89ab('0x34')]),_0x772758);if(_0x1919ee['query'][_0x89ab('0x3d')]){_0x5246d7[_0x89ab('0x3e')]=_[_0x89ab('0x3f')](_0x5246d7['where'],{'$or':_['map'](_0x772758,function(_0x537c92){if(_0x537c92['type']!==_0x89ab('0x40')){var _0x7df9ae={};_0x7df9ae[_0x537c92[_0x89ab('0x28')]]={'$like':'%'+_0x1919ee['query'][_0x89ab('0x3d')]+'%'};return _0x7df9ae;}})});}_0x5246d7=_[_0x89ab('0x3f')]({},_0x5246d7,_0x1919ee['options']);var _0x16b71c={'where':_0x5246d7[_0x89ab('0x3e')]};return db[_0x89ab('0x2c')][_0x89ab('0x1c')](_0x16b71c)[_0x89ab('0x24')](function(_0x2cca97){_0x3dbd1b[_0x89ab('0x1c')]=_0x2cca97;if(_0x1919ee[_0x89ab('0x32')]['includeAll']){_0x5246d7['include']=[{'all':!![]}];}return db[_0x89ab('0x2c')][_0x89ab('0x41')](_0x5246d7);})[_0x89ab('0x24')](function(_0x90fba7){_0x3dbd1b[_0x89ab('0x42')]=_0x90fba7;return _0x3dbd1b;})['then'](respondWithFilteredResult(_0xf8a71,_0x5246d7))[_0x89ab('0x43')](handleError(_0xf8a71,null));};exports[_0x89ab('0x44')]=function(_0x503af0,_0x1ce148){var _0x295834={'raw':!![],'where':{'id':_0x503af0[_0x89ab('0x45')]['id']}},_0x15b0c2={};_0x15b0c2[_0x89ab('0x31')]=_['keys'](db[_0x89ab('0x2c')]['rawAttributes']);_0x15b0c2[_0x89ab('0x32')]=_[_0x89ab('0x33')](_0x503af0[_0x89ab('0x32')]);_0x15b0c2[_0x89ab('0x34')]=_[_0x89ab('0x36')](_0x15b0c2[_0x89ab('0x31')],_0x15b0c2[_0x89ab('0x32')]);_0x295834[_0x89ab('0x35')]=_[_0x89ab('0x36')](_0x15b0c2[_0x89ab('0x31')],qs[_0x89ab('0x37')](_0x503af0[_0x89ab('0x32')][_0x89ab('0x37')]));_0x295834[_0x89ab('0x35')]=_0x295834[_0x89ab('0x35')][_0x89ab('0x38')]?_0x295834[_0x89ab('0x35')]:_0x15b0c2[_0x89ab('0x31')];if(_0x503af0[_0x89ab('0x32')]['includeAll']){_0x295834[_0x89ab('0x46')]=[{'all':!![]}];}_0x295834=_[_0x89ab('0x3f')]({},_0x295834,_0x503af0[_0x89ab('0x47')]);return db[_0x89ab('0x2c')][_0x89ab('0x48')](_0x295834)[_0x89ab('0x24')](handleEntityNotFound(_0x1ce148,null))[_0x89ab('0x24')](respondWithResult(_0x1ce148,null))[_0x89ab('0x43')](handleError(_0x1ce148,null));};exports['create']=function(_0xf99ce6,_0x37e163){return db['WhatsappApplication'][_0x89ab('0x49')](_0xf99ce6[_0x89ab('0x4a')],{})[_0x89ab('0x24')](respondWithResult(_0x37e163,0xc9))[_0x89ab('0x43')](handleError(_0x37e163,null));};exports['update']=function(_0x57bbff,_0x11bace){if(_0x57bbff[_0x89ab('0x4a')]['id']){delete _0x57bbff[_0x89ab('0x4a')]['id'];}return db[_0x89ab('0x2c')]['find']({'where':{'id':_0x57bbff[_0x89ab('0x45')]['id']}})[_0x89ab('0x24')](handleEntityNotFound(_0x11bace,null))[_0x89ab('0x24')](saveUpdates(_0x57bbff[_0x89ab('0x4a')],null))['then'](respondWithResult(_0x11bace,null))['catch'](handleError(_0x11bace,null));};exports[_0x89ab('0x25')]=function(_0x29862e,_0x464d6b){return db[_0x89ab('0x2c')][_0x89ab('0x48')]({'where':{'id':_0x29862e['params']['id']}})[_0x89ab('0x24')](handleEntityNotFound(_0x464d6b,null))[_0x89ab('0x24')](removeEntity(_0x464d6b,null))['catch'](handleError(_0x464d6b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2038f7a..9a41af7 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 _0x448a=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','util','../../config/logger','moment','path','rimraf'];(function(_0x1db72a,_0x22f6bc){var _0x1c7ee7=function(_0x1b4fe8){while(--_0x1b4fe8){_0x1db72a['push'](_0x1db72a['shift']());}};_0x1c7ee7(++_0x22f6bc);}(_0x448a,0x1ef));var _0xa448=function(_0x4a82cf,_0x5b6280){_0x4a82cf=_0x4a82cf-0x0;var _0x47f3cd=_0x448a[_0x4a82cf];return _0x47f3cd;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var logger=require(_0xa448('0x1'))('api');var moment=require(_0xa448('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa448('0x3'));var rimraf=require(_0xa448('0x4'));var config=require('../../config/environment');var attributes=require(_0xa448('0x5'));module[_0xa448('0x6')]=function(_0x343b79,_0x2c16e3){return _0x343b79[_0xa448('0x7')](_0xa448('0x8'),attributes,{'tableName':_0xa448('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x975f=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4'];(function(_0x42e7d0,_0x1fc27a){var _0x4a0d18=function(_0x141c30){while(--_0x141c30){_0x42e7d0['push'](_0x42e7d0['shift']());}};_0x4a0d18(++_0x1fc27a);}(_0x975f,0x109));var _0xf975=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x975f[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0xf975('0x0'));var util=require(_0xf975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf975('0x2'));var BPromise=require(_0xf975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf975('0x4'));var rimraf=require(_0xf975('0x5'));var config=require(_0xf975('0x6'));var attributes=require(_0xf975('0x7'));module['exports']=function(_0x356f71,_0x5a9aca){return _0x356f71[_0xf975('0x8')](_0xf975('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf975('0xa'),'collate':_0xf975('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 104d4bb..352c94f 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x3200d5,_0x525be3){var _0x2135ce=function(_0x1e60cc){while(--_0x1e60cc){_0x3200d5['push'](_0x3200d5['shift']());}};_0x2135ce(++_0x525be3);}(_0x207c,0x1e8));var _0xc207=function(_0xdc0e64,_0x38bf67){_0xdc0e64=_0xdc0e64-0x0;var _0xb04e82=_0x207c[_0xdc0e64];return _0xb04e82;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x42bc42,_0x116efe){var _0x5e5af2=function(_0x318a37){while(--_0x318a37){_0x42bc42['push'](_0x42bc42['shift']());}};_0x5e5af2(++_0x116efe);}(_0x668b,0x140));var _0xb668=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x668b[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fdef86f..67ffd5b 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 _0xeff8=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8c238b,_0x122813){var _0x5d054b=function(_0x1c0b1c){while(--_0x1c0b1c){_0x8c238b['push'](_0x8c238b['shift']());}};_0x5d054b(++_0x122813);}(_0xeff8,0x186));var _0x8eff=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xeff8[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['get'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router['get'](_0x8eff('0x11'),auth[_0x8eff('0x9')](),controller['download']);router[_0x8eff('0x12')]('/',auth[_0x8eff('0x9')](),controller['create']);router['post'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x13')]);router[_0x8eff('0x12')](_0x8eff('0x14'),auth['isAuthenticated'](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x17')),controller[_0x8eff('0x18')]);router[_0x8eff('0x19')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1a')),controller[_0x8eff('0x1b')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1c')),controller[_0x8eff('0x1d')]);router[_0x8eff('0x1e')](_0x8eff('0x14'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x1f')]);module[_0x8eff('0x20')]=router; \ No newline at end of file +var _0x446c=['describe','get','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0xa17e1f,_0x441b80){var _0x2e117b=function(_0x44c69d){while(--_0x44c69d){_0xa17e1f['push'](_0xa17e1f['shift']());}};_0x2e117b(++_0x441b80);}(_0x446c,0x156));var _0xc446=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x446c[_0xb5fc3e];return _0x2efc3c;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var fs_extra=require(_0xc446('0x5'));var auth=require(_0xc446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc446('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc446('0x8')](),controller[_0xc446('0x9')]);router['get']('/describe',auth[_0xc446('0x8')](),controller[_0xc446('0xa')]);router[_0xc446('0xb')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller['show']);router[_0xc446('0xb')](_0xc446('0xd'),auth[_0xc446('0x8')](),controller[_0xc446('0xe')]);router['get'](_0xc446('0xf'),auth[_0xc446('0x8')](),controller[_0xc446('0x10')]);router[_0xc446('0x11')]('/',auth[_0xc446('0x8')](),controller[_0xc446('0x12')]);router[_0xc446('0x11')](_0xc446('0xd'),auth[_0xc446('0x8')](),controller[_0xc446('0x13')]);router[_0xc446('0x11')](_0xc446('0x14'),auth[_0xc446('0x8')](),interaction[_0xc446('0x15')](_0xc446('0x16'),_0xc446('0x17')),controller[_0xc446('0x18')]);router[_0xc446('0x19')](_0xc446('0xc'),auth['isAuthenticated'](),interaction[_0xc446('0x15')](_0xc446('0x16'),_0xc446('0x1a')),controller[_0xc446('0x1b')]);router[_0xc446('0x1c')](_0xc446('0xc'),auth[_0xc446('0x8')](),interaction[_0xc446('0x15')](_0xc446('0x16'),_0xc446('0x1d')),controller['destroy']);router[_0xc446('0x1c')](_0xc446('0x14'),auth['isAuthenticated'](),controller[_0xc446('0x1e')]);module[_0xc446('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 22b9000..3b18370 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 _0x5987=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x329421,_0x414a49){var _0x5b31e8=function(_0x598ef4){while(--_0x598ef4){_0x329421['push'](_0x329421['shift']());}};_0x5b31e8(++_0x414a49);}(_0x5987,0x128));var _0x7598=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5987[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7598('0x0'));var moment=require(_0x7598('0x1'));module[_0x7598('0x2')]={'closed':{'type':Sequelize[_0x7598('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7598('0x4')]},'secondDisposition':{'type':Sequelize[_0x7598('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7598('0x4')]},'note':{'type':Sequelize[_0x7598('0x4')]},'phone':{'type':Sequelize[_0x7598('0x4')]},'read1stAt':{'type':Sequelize[_0x7598('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x7598('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7598('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7598('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7598('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7598('0x8')]}}; \ No newline at end of file +var _0x8af6=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3c98c1,_0x524e3c){var _0x45c21b=function(_0x1f8dd0){while(--_0x1f8dd0){_0x3c98c1['push'](_0x3c98c1['shift']());}};_0x45c21b(++_0x524e3c);}(_0x8af6,0x76));var _0x68af=function(_0x4b3dec,_0xaea2fd){_0x4b3dec=_0x4b3dec-0x0;var _0x5119c6=_0x8af6[_0x4b3dec];return _0x5119c6;};'use strict';var Sequelize=require(_0x68af('0x0'));var moment=require(_0x68af('0x1'));module[_0x68af('0x2')]={'closed':{'type':Sequelize[_0x68af('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x68af('0x4')]},'disposition':{'type':Sequelize[_0x68af('0x5')]},'secondDisposition':{'type':Sequelize[_0x68af('0x5')]},'thirdDisposition':{'type':Sequelize[_0x68af('0x5')]},'note':{'type':Sequelize[_0x68af('0x5')]},'phone':{'type':Sequelize[_0x68af('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x68af('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x68af('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x68af('0x6')]('in',_0x68af('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x68af('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x68af('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 7d9a6cd..e7d253b 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 _0xca41=['addTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','transcript-%d-%s.zip','join','push','User','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','fullname','N.A.','closed','disposition','basename','existsSync','createReadStream','createWriteStream','System','Contact','value','renderFile','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','error','name','index','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','catch','show','params','keys','intersection','attributes','model','fields','length','includeAll','include','merge','options','WhatsappInteraction','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows'];(function(_0x19141f,_0xfd8c50){var _0x347801=function(_0x241def){while(--_0x241def){_0x19141f['push'](_0x19141f['shift']());}};_0x347801(++_0xfd8c50);}(_0xca41,0x130));var _0x1ca4=function(_0x325217,_0x27b4d5){_0x325217=_0x325217-0x0;var _0x3712c6=_0xca41[_0x325217];return _0x3712c6;};'use strict';var rimraf=require(_0x1ca4('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1ca4('0x1'));var BPromise=require(_0x1ca4('0x2'));var util=require('util');var path=require(_0x1ca4('0x3'));var ejs=require(_0x1ca4('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1ca4('0x5'));var interaction=require(_0x1ca4('0x6'));var qs=require(_0x1ca4('0x7'));var pdf=require(_0x1ca4('0x8'));var logger=require(_0x1ca4('0x9'))(_0x1ca4('0xa'));var config=require(_0x1ca4('0xb'));var db=require(_0x1ca4('0xc'))['db'];config[_0x1ca4('0xd')]=_[_0x1ca4('0xe')](config[_0x1ca4('0xd')],{'host':_0x1ca4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ca4('0xd')]));require(_0x1ca4('0x10'))[_0x1ca4('0x11')](socket);function respondWithStatusCode(_0x4b487a,_0x53aad0){_0x53aad0=_0x53aad0||0xcc;return function(_0x78fef7){if(_0x78fef7){return _0x4b487a[_0x1ca4('0x12')](_0x53aad0);}return _0x4b487a[_0x1ca4('0x13')](_0x53aad0)[_0x1ca4('0x14')]();};}function respondWithResult(_0x41aa8e,_0x2ebada){_0x2ebada=_0x2ebada||0xc8;return function(_0x228c8e){if(_0x228c8e){return _0x41aa8e['status'](_0x2ebada)[_0x1ca4('0x15')](_0x228c8e);}};}function respondWithFilteredResult(_0x5540f7,_0x28ff70){return function(_0x2c7525){if(_0x2c7525){var _0x5db1b7=typeof _0x28ff70[_0x1ca4('0x16')]===_0x1ca4('0x17')&&typeof _0x28ff70[_0x1ca4('0x18')]===_0x1ca4('0x17');var _0x29f496=_0x2c7525[_0x1ca4('0x19')];var _0x438902=_0x5db1b7?0x0:_0x28ff70[_0x1ca4('0x16')];var _0x1c9636=_0x5db1b7?_0x2c7525[_0x1ca4('0x19')]:_0x28ff70['offset']+_0x28ff70[_0x1ca4('0x18')];var _0x255fb0;if(_0x1c9636>=_0x29f496){_0x1c9636=_0x29f496;_0x255fb0=0xc8;}else{_0x255fb0=0xce;}_0x5540f7[_0x1ca4('0x13')](_0x255fb0);return _0x5540f7['set']('Content-Range',_0x438902+'-'+_0x1c9636+'/'+_0x29f496)[_0x1ca4('0x15')](_0x2c7525);}return null;};}function saveUpdates(_0x2e6907){return function(_0x5ab9fe){if(_0x5ab9fe){return _0x5ab9fe[_0x1ca4('0x1a')](_0x2e6907)[_0x1ca4('0x1b')](function(_0x5140ca){return _0x5140ca;});}return null;};}function removeEntity(_0x29394d){return function(_0x351022){if(_0x351022){return _0x351022[_0x1ca4('0x1c')]()[_0x1ca4('0x1b')](function(){_0x29394d[_0x1ca4('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb926){return function(_0x38e756){if(!_0x38e756){_0x4fb926[_0x1ca4('0x12')](0x194);}return _0x38e756;};}function handleError(_0x434cce,_0x2c9b5a){_0x2c9b5a=_0x2c9b5a||0x1f4;return function(_0x519c44){logger[_0x1ca4('0x1d')](_0x519c44['stack']);if(_0x519c44[_0x1ca4('0x1e')]){delete _0x519c44[_0x1ca4('0x1e')];}_0x434cce['status'](_0x2c9b5a)['send'](_0x519c44);};}exports[_0x1ca4('0x1f')]=function(_0x59e285,_0x2496f5){var _0x34eff6={};var _0x4ce877=_['map'](db['WhatsappInteraction'][_0x1ca4('0x20')],function(_0x174a23){return{'name':_0x174a23[_0x1ca4('0x21')],'type':_0x174a23['type'][_0x1ca4('0x22')]};});_0x34eff6=qs[_0x1ca4('0x23')](_0x4ce877,_0x59e285);return interaction[_0x1ca4('0x24')](_0x1ca4('0x25'),_0x59e285[_0x1ca4('0x26')],_0x59e285[_0x1ca4('0x27')],_0x34eff6,_0x4ce877)[_0x1ca4('0x1b')](respondWithFilteredResult(_0x2496f5,_0x34eff6))[_0x1ca4('0x28')](handleError(_0x2496f5,null));};exports[_0x1ca4('0x29')]=function(_0x57c70a,_0x4b02af){var _0x5d9792={'raw':![],'where':{'id':_0x57c70a[_0x1ca4('0x2a')]['id']}},_0x5bfb5d={};_0x5bfb5d['model']=_[_0x1ca4('0x2b')](db['WhatsappInteraction'][_0x1ca4('0x20')]);_0x5bfb5d[_0x1ca4('0x26')]=_[_0x1ca4('0x2b')](_0x57c70a['query']);_0x5bfb5d['filters']=_[_0x1ca4('0x2c')](_0x5bfb5d['model'],_0x5bfb5d['query']);_0x5d9792[_0x1ca4('0x2d')]=_['intersection'](_0x5bfb5d[_0x1ca4('0x2e')],qs[_0x1ca4('0x2f')](_0x57c70a[_0x1ca4('0x26')]['fields']));_0x5d9792['attributes']=_0x5d9792[_0x1ca4('0x2d')][_0x1ca4('0x30')]?_0x5d9792[_0x1ca4('0x2d')]:_0x5bfb5d[_0x1ca4('0x2e')];if(_0x57c70a[_0x1ca4('0x26')][_0x1ca4('0x31')]){_0x5d9792[_0x1ca4('0x32')]=[{'all':!![]}];}_0x5d9792=_[_0x1ca4('0x33')]({},_0x5d9792,_0x57c70a[_0x1ca4('0x34')]);return db[_0x1ca4('0x35')]['find'](_0x5d9792)[_0x1ca4('0x1b')](handleEntityNotFound(_0x4b02af,null))[_0x1ca4('0x1b')](respondWithResult(_0x4b02af,null))[_0x1ca4('0x28')](handleError(_0x4b02af,null));};exports[_0x1ca4('0x36')]=function(_0x176956,_0x4d29d5){return db['WhatsappInteraction'][_0x1ca4('0x36')](_0x176956[_0x1ca4('0x37')],{})[_0x1ca4('0x1b')](respondWithResult(_0x4d29d5,0xc9))[_0x1ca4('0x28')](handleError(_0x4d29d5,null));};exports[_0x1ca4('0x1a')]=function(_0x108c4d,_0x152f70){if(_0x108c4d[_0x1ca4('0x37')]['id']){delete _0x108c4d[_0x1ca4('0x37')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x108c4d[_0x1ca4('0x2a')]['id']}})[_0x1ca4('0x1b')](handleEntityNotFound(_0x152f70,null))[_0x1ca4('0x1b')](saveUpdates(_0x108c4d[_0x1ca4('0x37')],null))[_0x1ca4('0x1b')](respondWithResult(_0x152f70,null))[_0x1ca4('0x28')](handleError(_0x152f70,null));};exports[_0x1ca4('0x1c')]=function(_0x1792ed,_0x37cb18){return db[_0x1ca4('0x35')][_0x1ca4('0x38')]({'where':{'id':_0x1792ed[_0x1ca4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x37cb18,null))[_0x1ca4('0x1b')](removeEntity(_0x37cb18,null))[_0x1ca4('0x28')](handleError(_0x37cb18,null));};exports[_0x1ca4('0x39')]=function(_0x581f22,_0x40336b){return db[_0x1ca4('0x35')][_0x1ca4('0x39')]()[_0x1ca4('0x1b')](respondWithResult(_0x40336b,null))[_0x1ca4('0x28')](handleError(_0x40336b,null));};exports[_0x1ca4('0x3a')]=function(_0x544b05,_0x5de8af){return db['WhatsappMessage']['find']({'where':{'id':_0x544b05[_0x1ca4('0x2a')]['id']}})[_0x1ca4('0x1b')](handleEntityNotFound(_0x5de8af,null))[_0x1ca4('0x1b')](function(_0x2344f5){if(_0x2344f5){return _0x2344f5['addMessage'](_0x544b05['body'][_0x1ca4('0x3b')],_[_0x1ca4('0x3c')](_0x544b05[_0x1ca4('0x37')],[_0x1ca4('0x3b'),'id'])||{});}})[_0x1ca4('0x1b')](respondWithResult(_0x5de8af,null))[_0x1ca4('0x28')](handleError(_0x5de8af,null));};exports[_0x1ca4('0x3d')]=function(_0x3ff6e2,_0x5bc921){var _0x27c03a={'raw':![],'where':{}};var _0x340ade={};var _0x4ee3f7={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1ca4('0x3e')]({'where':{'id':_0x3ff6e2[_0x1ca4('0x2a')]['id']}})[_0x1ca4('0x1b')](handleEntityNotFound(_0x5bc921,null))[_0x1ca4('0x1b')](function(_0x4a3cd5){if(_0x4a3cd5){_0x340ade[_0x1ca4('0x2e')]=_[_0x1ca4('0x2b')](db[_0x1ca4('0x3f')][_0x1ca4('0x20')]);_0x340ade['query']=_[_0x1ca4('0x2b')](_0x3ff6e2[_0x1ca4('0x26')]);_0x340ade[_0x1ca4('0x40')]=_[_0x1ca4('0x2c')](_0x340ade[_0x1ca4('0x2e')],_0x340ade[_0x1ca4('0x26')]);_0x27c03a[_0x1ca4('0x2d')]=_['intersection'](_0x340ade['model'],qs[_0x1ca4('0x2f')](_0x3ff6e2[_0x1ca4('0x26')]['fields']));_0x27c03a[_0x1ca4('0x2d')]=_0x27c03a[_0x1ca4('0x2d')][_0x1ca4('0x30')]?_0x27c03a[_0x1ca4('0x2d')]:_0x340ade['model'];if(!_0x3ff6e2[_0x1ca4('0x26')][_0x1ca4('0x41')](_0x1ca4('0x42'))){_0x27c03a[_0x1ca4('0x18')]=qs[_0x1ca4('0x18')](_0x3ff6e2[_0x1ca4('0x26')][_0x1ca4('0x18')]);_0x27c03a[_0x1ca4('0x16')]=qs[_0x1ca4('0x16')](_0x3ff6e2[_0x1ca4('0x26')]['offset']);}_0x27c03a['order']=qs[_0x1ca4('0x43')](_0x3ff6e2[_0x1ca4('0x26')]['sort']);_0x27c03a[_0x1ca4('0x44')]=qs[_0x1ca4('0x40')](_[_0x1ca4('0x45')](_0x3ff6e2['query'],_0x340ade['filters']));_0x27c03a[_0x1ca4('0x44')][_0x1ca4('0x46')]=_0x4a3cd5['id'];if(_0x3ff6e2[_0x1ca4('0x26')][_0x1ca4('0x47')]){_0x27c03a[_0x1ca4('0x44')]=_[_0x1ca4('0x33')](_0x27c03a[_0x1ca4('0x44')],{'$or':_[_0x1ca4('0x48')](_0x27c03a['attributes'],function(_0x496fd1){var _0x4139e0={};_0x4139e0[_0x496fd1]={'$like':'%'+_0x3ff6e2['query'][_0x1ca4('0x47')]+'%'};return _0x4139e0;})});}if(_0x3ff6e2[_0x1ca4('0x26')]['$gte']){var _0x4242a1=_0x3ff6e2['query'][_0x1ca4('0x49')]['split'](',');var _0x2fa81a={};_0x2fa81a[_0x4242a1[0x0]]={'$gte':moment(_0x4242a1[0x1])[_0x1ca4('0x4a')](_0x1ca4('0x4b'))};_0x27c03a[_0x1ca4('0x44')]=_['merge'](_0x27c03a[_0x1ca4('0x44')],_0x2fa81a);}_0x27c03a=_[_0x1ca4('0x33')]({},_0x27c03a,_0x3ff6e2[_0x1ca4('0x34')]);return db[_0x1ca4('0x3f')][_0x1ca4('0x19')]({'where':_0x27c03a[_0x1ca4('0x44')]})[_0x1ca4('0x1b')](function(_0x3106f1){_0x4ee3f7['count']=_0x3106f1;if(_0x3ff6e2[_0x1ca4('0x26')]['includeAll']){_0x27c03a[_0x1ca4('0x32')]=[{'all':!![]}];}return db[_0x1ca4('0x3f')]['findAll'](_0x27c03a);})[_0x1ca4('0x1b')](function(_0x3b0aa1){_0x4ee3f7[_0x1ca4('0x4c')]=_0x3b0aa1;return _0x4ee3f7;});}})[_0x1ca4('0x1b')](respondWithFilteredResult(_0x5bc921,_0x27c03a))['catch'](handleError(_0x5bc921,null));};exports[_0x1ca4('0x4d')]=function(_0xf59c1c,_0x52460a){return db[_0x1ca4('0x35')]['find']({'where':{'id':_0xf59c1c[_0x1ca4('0x2a')]['id']}})[_0x1ca4('0x1b')](handleEntityNotFound(_0x52460a,null))[_0x1ca4('0x1b')](function(_0x278dc1){if(_0x278dc1){return _0x278dc1['setTags'](_0xf59c1c['body'][_0x1ca4('0x3b')],_[_0x1ca4('0x3c')](_0xf59c1c['body'],[_0x1ca4('0x3b'),'id'])||{})[_0x1ca4('0x4e')](function(){return db[_0x1ca4('0x4f')]['findAll']({'attributes':['id',_0x1ca4('0x1e'),_0x1ca4('0x50')],'where':{'id':_0xf59c1c[_0x1ca4('0x37')][_0x1ca4('0x3b')]}});})['then'](function(_0x33b3da){socket[_0x1ca4('0x51')](_0x1ca4('0x52'),{'id':Number(_0xf59c1c['params']['id']),'tags':_0x33b3da||[]});return{'id':Number(_0xf59c1c[_0x1ca4('0x2a')]['id']),'tags':_0x33b3da||[]};});}})[_0x1ca4('0x1b')](respondWithResult(_0x52460a,null))[_0x1ca4('0x28')](handleError(_0x52460a,null));};exports[_0x1ca4('0x53')]=function(_0x58d6d2,_0x32618a){return db['WhatsappInteraction'][_0x1ca4('0x38')]({'where':{'id':_0x58d6d2[_0x1ca4('0x2a')]['id']}})[_0x1ca4('0x1b')](handleEntityNotFound(_0x32618a,null))['then'](function(_0x4e3bf8){if(_0x4e3bf8){return _0x4e3bf8[_0x1ca4('0x53')](_0x58d6d2[_0x1ca4('0x26')][_0x1ca4('0x3b')]);}})[_0x1ca4('0x1b')](respondWithStatusCode(_0x32618a,null))[_0x1ca4('0x28')](handleError(_0x32618a,null));};exports[_0x1ca4('0x54')]=function(_0x2adc29,_0x336714){var _0x17d94c=moment()[_0x1ca4('0x55')]()[_0x1ca4('0x56')]();var _0x3dabee=path['join'](config[_0x1ca4('0x57')],_0x1ca4('0x58'),_0x1ca4('0x59'),_0x1ca4('0x5a'));var _0x4cf6d5=path['join'](config['root'],_0x1ca4('0x58'),_0x1ca4('0x59'),_0x1ca4('0x5b'));var _0x49c8c4=path['join'](_0x3dabee,_0x17d94c);var _0x324e48=util['format'](_0x1ca4('0x5c'),_0x2adc29[_0x1ca4('0x2a')]['id'],_0x17d94c);var _0x58fbba=path[_0x1ca4('0x5d')](_0x3dabee,_0x324e48);var _0x3d8d0f=[];_0x3d8d0f[_0x1ca4('0x5e')]({'model':db[_0x1ca4('0x5f')],'as':_0x1ca4('0x5f'),'attributes':['id','fullname'],'raw':!![]});_0x3d8d0f[_0x1ca4('0x5e')]({'model':db[_0x1ca4('0x60')],'as':'Contact','attributes':['id',_0x1ca4('0x61'),_0x1ca4('0x62')],'raw':!![]});if(_0x2adc29[_0x1ca4('0x26')][_0x1ca4('0x5b')]){_0x3d8d0f[_0x1ca4('0x5e')]({'model':db[_0x1ca4('0x63')],'as':'Attachment','raw':!![]});}var _0x4552b0=[{'model':db['WhatsappMessage'],'as':_0x1ca4('0x64'),'attributes':['id',_0x1ca4('0x37'),_0x1ca4('0x65'),_0x1ca4('0x66'),_0x1ca4('0x67'),_0x1ca4('0x68')],'include':_0x3d8d0f}];_0x4552b0['push']({'model':db[_0x1ca4('0x69')],'as':_0x1ca4('0x6a'),'attributes':['id','name']});_0x4552b0[_0x1ca4('0x5e')]({'model':db['User'],'as':_0x1ca4('0x6b'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x1ca4('0x38')]({'where':{'id':_0x2adc29[_0x1ca4('0x2a')]['id']},'include':_0x4552b0})[_0x1ca4('0x1b')](handleEntityNotFound(_0x336714,null))[_0x1ca4('0x1b')](function(_0x15d064){if(_0x15d064){var _0x3cf561=_0x15d064[_0x1ca4('0x6c')]({'plain':!![]});fs[_0x1ca4('0x6d')](_0x49c8c4);var _0x11d70f={'channel':_0x1ca4('0x6e'),'account':_0x3cf561[_0x1ca4('0x6a')][_0x1ca4('0x1e')],'agent':_0x3cf561['Owner']?_0x3cf561[_0x1ca4('0x6b')][_0x1ca4('0x6f')]:_0x1ca4('0x70'),'createdAt':moment(_0x3cf561[_0x1ca4('0x65')])[_0x1ca4('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1ca4('0x56')](),'closedAt':_0x3cf561[_0x1ca4('0x71')]?moment(_0x3cf561['closedAt'])[_0x1ca4('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3cf561[_0x1ca4('0x72')],'messages':_(_0x3cf561[_0x1ca4('0x64')])[_0x1ca4('0x47')]({'secret':![]})[_0x1ca4('0x48')](function(_0x419fb7){if(_0x419fb7[_0x1ca4('0x63')]){var _0x23f70b=path[_0x1ca4('0x5d')](_0x4cf6d5,_0x419fb7[_0x1ca4('0x63')][_0x1ca4('0x73')]);if(fs[_0x1ca4('0x74')](_0x23f70b)){fs[_0x1ca4('0x75')](_0x23f70b)['pipe'](fs[_0x1ca4('0x76')](path['join'](_0x49c8c4,_0x419fb7['Attachment'][_0x1ca4('0x73')])));}}return{'date':moment(_0x419fb7[_0x1ca4('0x65')])[_0x1ca4('0x4a')](_0x1ca4('0x4b'))[_0x1ca4('0x56')](),'sender':_0x419fb7[_0x1ca4('0x66')]==='out'?_0x419fb7['User']?_0x419fb7[_0x1ca4('0x5f')][_0x1ca4('0x6f')]:_0x1ca4('0x77'):_0x419fb7[_0x1ca4('0x78')][_0x1ca4('0x61')]+(_0x419fb7[_0x1ca4('0x78')][_0x1ca4('0x62')]?'\x20'+_0x419fb7[_0x1ca4('0x78')]['lastName']:''),'body':_0x419fb7[_0x1ca4('0x63')]?_0x419fb7[_0x1ca4('0x63')]['basename']:_0x419fb7[_0x1ca4('0x37')],'direction':_0x419fb7[_0x1ca4('0x66')]==='out'?'A':'C','secret':_0x419fb7[_0x1ca4('0x67')],'read':_0x419fb7[_0x1ca4('0x68')],'attachment':_0x419fb7[_0x1ca4('0x63')]};})[_0x1ca4('0x79')]()};return ejs[_0x1ca4('0x7a')](path[_0x1ca4('0x5d')](config[_0x1ca4('0x57')],_0x1ca4('0x58'),'views','downloadInteraction.ejs'),{'interaction':_0x11d70f})['then'](function(_0xdd3ff6){var _0x4ffea0=path[_0x1ca4('0x5d')](_0x49c8c4,'transcript-'+_0x3cf561['id']+'-'+_0x17d94c+_0x1ca4('0x7b'));var _0x265edf={'path':_0x4ffea0,'channel':_0x1ca4('0x6e'),'interactionId':_0x3cf561['id']};return pdf[_0x1ca4('0x7c')](_0xdd3ff6,_0x265edf);})[_0x1ca4('0x1b')](function(){return new BPromise(function(_0x301267,_0x394eec){zipdir(_0x49c8c4,{'saveTo':_0x58fbba},function(_0x1be5d5,_0x557ffb){if(_0x1be5d5)return _0x394eec(_0x1be5d5);return _0x301267(_0x557ffb);});})[_0x1ca4('0x1b')](function(){return new BPromise(function(_0x2e4df6,_0x5a2baa){rimraf(_0x49c8c4,function(_0x4a91de){if(_0x4a91de)_0x5a2baa(_0x4a91de);return _0x2e4df6();});});})[_0x1ca4('0x1b')](function(){return _0x336714[_0x1ca4('0x54')](_0x58fbba,_0x324e48,function(_0x359f9a){if(_0x359f9a){console[_0x1ca4('0x7d')](_0x1ca4('0x7e'),_0x359f9a);}else{fs['unlinkSync'](_0x58fbba);}});});});}else{return _0x336714['sendStatus'](0xc8);}})[_0x1ca4('0x28')](handleError(_0x336714,null));}; \ No newline at end of file +var _0xbb8d=['whatsapp','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','destroy','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','where','pick','WhatsappInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','files','root','server','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','closed','closedAt','disposition','Messages','basename','existsSync','createWriteStream','System','out','read','value','views','Whatsapp','createPdfFromHTML','log','err','rimraf','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','error','name','index','map','WhatsappInteraction','rawAttributes','key'];(function(_0x692b08,_0x4ac401){var _0x501639=function(_0xbe2d7a){while(--_0xbe2d7a){_0x692b08['push'](_0x692b08['shift']());}};_0x501639(++_0x4ac401);}(_0xbb8d,0x146));var _0xdbb8=function(_0x5d44f7,_0x4aea33){_0x5d44f7=_0x5d44f7-0x0;var _0x569770=_0xbb8d[_0x5d44f7];return _0x569770;};'use strict';var rimraf=require(_0xdbb8('0x0'));var zipdir=require('zip-dir');var moment=require(_0xdbb8('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var ejs=require(_0xdbb8('0x2'));var fs=require('fs');var _=require(_0xdbb8('0x3'));var Redis=require(_0xdbb8('0x4'));var interaction=require(_0xdbb8('0x5'));var qs=require(_0xdbb8('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0xdbb8('0x7'))(_0xdbb8('0x8'));var config=require(_0xdbb8('0x9'));var db=require(_0xdbb8('0xa'))['db'];config['redis']=_[_0xdbb8('0xb')](config['redis'],{'host':_0xdbb8('0xc'),'port':0x18eb});var socket=require(_0xdbb8('0xd'))(new Redis(config['redis']));require(_0xdbb8('0xe'))[_0xdbb8('0xf')](socket);function respondWithStatusCode(_0x45c7af,_0x3113b8){_0x3113b8=_0x3113b8||0xcc;return function(_0x2eb417){if(_0x2eb417){return _0x45c7af[_0xdbb8('0x10')](_0x3113b8);}return _0x45c7af[_0xdbb8('0x11')](_0x3113b8)[_0xdbb8('0x12')]();};}function respondWithResult(_0x183187,_0x46e2fc){_0x46e2fc=_0x46e2fc||0xc8;return function(_0x51580d){if(_0x51580d){return _0x183187[_0xdbb8('0x11')](_0x46e2fc)[_0xdbb8('0x13')](_0x51580d);}};}function respondWithFilteredResult(_0x22596c,_0x20ade1){return function(_0x155480){if(_0x155480){var _0x3f5c48=typeof _0x20ade1[_0xdbb8('0x14')]===_0xdbb8('0x15')&&typeof _0x20ade1['limit']===_0xdbb8('0x15');var _0x510965=_0x155480[_0xdbb8('0x16')];var _0x2723c7=_0x3f5c48?0x0:_0x20ade1[_0xdbb8('0x14')];var _0x3180a7=_0x3f5c48?_0x155480[_0xdbb8('0x16')]:_0x20ade1['offset']+_0x20ade1[_0xdbb8('0x17')];var _0x5455c2;if(_0x3180a7>=_0x510965){_0x3180a7=_0x510965;_0x5455c2=0xc8;}else{_0x5455c2=0xce;}_0x22596c['status'](_0x5455c2);return _0x22596c[_0xdbb8('0x18')]('Content-Range',_0x2723c7+'-'+_0x3180a7+'/'+_0x510965)[_0xdbb8('0x13')](_0x155480);}return null;};}function saveUpdates(_0x1e6803){return function(_0x47253a){if(_0x47253a){return _0x47253a[_0xdbb8('0x19')](_0x1e6803)[_0xdbb8('0x1a')](function(_0x229277){return _0x229277;});}return null;};}function removeEntity(_0x2225b1){return function(_0x172786){if(_0x172786){return _0x172786['destroy']()['then'](function(){_0x2225b1[_0xdbb8('0x11')](0xcc)[_0xdbb8('0x12')]();});}};}function handleEntityNotFound(_0x36cfe6){return function(_0x1634b5){if(!_0x1634b5){_0x36cfe6[_0xdbb8('0x10')](0x194);}return _0x1634b5;};}function handleError(_0x1e6db4,_0x42dcf4){_0x42dcf4=_0x42dcf4||0x1f4;return function(_0x423ffb){logger[_0xdbb8('0x1b')](_0x423ffb['stack']);if(_0x423ffb[_0xdbb8('0x1c')]){delete _0x423ffb[_0xdbb8('0x1c')];}_0x1e6db4[_0xdbb8('0x11')](_0x42dcf4)['send'](_0x423ffb);};}exports[_0xdbb8('0x1d')]=function(_0x29ea69,_0x5411a5){var _0x124573={};var _0x4c3c14=_[_0xdbb8('0x1e')](db[_0xdbb8('0x1f')][_0xdbb8('0x20')],function(_0x365da0){return{'name':_0x365da0['fieldName'],'type':_0x365da0['type'][_0xdbb8('0x21')]};});_0x124573=qs['getOptions'](_0x4c3c14,_0x29ea69);return interaction['findAll'](_0xdbb8('0x22'),_0x29ea69[_0xdbb8('0x23')],_0x29ea69['user'],_0x124573,_0x4c3c14)['then'](respondWithFilteredResult(_0x5411a5,_0x124573))[_0xdbb8('0x24')](handleError(_0x5411a5,null));};exports[_0xdbb8('0x25')]=function(_0x4f2276,_0x2331e2){var _0xf7e4ee={'raw':![],'where':{'id':_0x4f2276[_0xdbb8('0x26')]['id']}},_0x43064d={};_0x43064d[_0xdbb8('0x27')]=_[_0xdbb8('0x28')](db[_0xdbb8('0x1f')][_0xdbb8('0x20')]);_0x43064d[_0xdbb8('0x23')]=_[_0xdbb8('0x28')](_0x4f2276[_0xdbb8('0x23')]);_0x43064d[_0xdbb8('0x29')]=_[_0xdbb8('0x2a')](_0x43064d[_0xdbb8('0x27')],_0x43064d['query']);_0xf7e4ee[_0xdbb8('0x2b')]=_[_0xdbb8('0x2a')](_0x43064d[_0xdbb8('0x27')],qs[_0xdbb8('0x2c')](_0x4f2276['query'][_0xdbb8('0x2c')]));_0xf7e4ee[_0xdbb8('0x2b')]=_0xf7e4ee[_0xdbb8('0x2b')][_0xdbb8('0x2d')]?_0xf7e4ee[_0xdbb8('0x2b')]:_0x43064d[_0xdbb8('0x27')];if(_0x4f2276[_0xdbb8('0x23')][_0xdbb8('0x2e')]){_0xf7e4ee[_0xdbb8('0x2f')]=[{'all':!![]}];}_0xf7e4ee=_['merge']({},_0xf7e4ee,_0x4f2276['options']);return db['WhatsappInteraction'][_0xdbb8('0x30')](_0xf7e4ee)[_0xdbb8('0x1a')](handleEntityNotFound(_0x2331e2,null))[_0xdbb8('0x1a')](respondWithResult(_0x2331e2,null))['catch'](handleError(_0x2331e2,null));};exports[_0xdbb8('0x31')]=function(_0x2c1947,_0x26659f){return db['WhatsappInteraction'][_0xdbb8('0x31')](_0x2c1947[_0xdbb8('0x32')],{})[_0xdbb8('0x1a')](respondWithResult(_0x26659f,0xc9))[_0xdbb8('0x24')](handleError(_0x26659f,null));};exports['update']=function(_0x2487f0,_0xd8e1ec){if(_0x2487f0[_0xdbb8('0x32')]['id']){delete _0x2487f0[_0xdbb8('0x32')]['id'];}return db[_0xdbb8('0x1f')][_0xdbb8('0x30')]({'where':{'id':_0x2487f0['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0xd8e1ec,null))[_0xdbb8('0x1a')](saveUpdates(_0x2487f0[_0xdbb8('0x32')],null))[_0xdbb8('0x1a')](respondWithResult(_0xd8e1ec,null))[_0xdbb8('0x24')](handleError(_0xd8e1ec,null));};exports[_0xdbb8('0x33')]=function(_0x5ba008,_0x58f05d){return db[_0xdbb8('0x1f')][_0xdbb8('0x30')]({'where':{'id':_0x5ba008['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x58f05d,null))[_0xdbb8('0x1a')](removeEntity(_0x58f05d,null))['catch'](handleError(_0x58f05d,null));};exports[_0xdbb8('0x34')]=function(_0x20d400,_0x675d00){return db['WhatsappInteraction'][_0xdbb8('0x34')]()[_0xdbb8('0x1a')](respondWithResult(_0x675d00,null))[_0xdbb8('0x24')](handleError(_0x675d00,null));};exports['addMessage']=function(_0x18ac07,_0x43caf1){return db[_0xdbb8('0x35')][_0xdbb8('0x30')]({'where':{'id':_0x18ac07[_0xdbb8('0x26')]['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x43caf1,null))[_0xdbb8('0x1a')](function(_0x448a54){if(_0x448a54){return _0x448a54[_0xdbb8('0x36')](_0x18ac07[_0xdbb8('0x32')][_0xdbb8('0x37')],_[_0xdbb8('0x38')](_0x18ac07['body'],[_0xdbb8('0x37'),'id'])||{});}})[_0xdbb8('0x1a')](respondWithResult(_0x43caf1,null))['catch'](handleError(_0x43caf1,null));};exports[_0xdbb8('0x39')]=function(_0x17f3d3,_0x50a2b4){var _0x167e72={'raw':![],'where':{}};var _0x192ffc={};var _0x3cac09={'count':0x0,'rows':[]};return db[_0xdbb8('0x1f')][_0xdbb8('0x3a')]({'where':{'id':_0x17f3d3[_0xdbb8('0x26')]['id']}})['then'](handleEntityNotFound(_0x50a2b4,null))[_0xdbb8('0x1a')](function(_0x19fea0){if(_0x19fea0){_0x192ffc[_0xdbb8('0x27')]=_[_0xdbb8('0x28')](db['WhatsappMessage'][_0xdbb8('0x20')]);_0x192ffc[_0xdbb8('0x23')]=_[_0xdbb8('0x28')](_0x17f3d3['query']);_0x192ffc['filters']=_[_0xdbb8('0x2a')](_0x192ffc[_0xdbb8('0x27')],_0x192ffc[_0xdbb8('0x23')]);_0x167e72[_0xdbb8('0x2b')]=_[_0xdbb8('0x2a')](_0x192ffc['model'],qs[_0xdbb8('0x2c')](_0x17f3d3[_0xdbb8('0x23')]['fields']));_0x167e72[_0xdbb8('0x2b')]=_0x167e72[_0xdbb8('0x2b')]['length']?_0x167e72[_0xdbb8('0x2b')]:_0x192ffc[_0xdbb8('0x27')];if(!_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x3b')]('nolimit')){_0x167e72['limit']=qs[_0xdbb8('0x17')](_0x17f3d3['query'][_0xdbb8('0x17')]);_0x167e72['offset']=qs['offset'](_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x14')]);}_0x167e72[_0xdbb8('0x3c')]=qs['sort'](_0x17f3d3[_0xdbb8('0x23')]['sort']);_0x167e72[_0xdbb8('0x3d')]=qs[_0xdbb8('0x29')](_[_0xdbb8('0x3e')](_0x17f3d3[_0xdbb8('0x23')],_0x192ffc['filters']));_0x167e72[_0xdbb8('0x3d')][_0xdbb8('0x3f')]=_0x19fea0['id'];if(_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x40')]){_0x167e72[_0xdbb8('0x3d')]=_[_0xdbb8('0x41')](_0x167e72[_0xdbb8('0x3d')],{'$or':_[_0xdbb8('0x1e')](_0x167e72[_0xdbb8('0x2b')],function(_0x589925){var _0x352ae3={};_0x352ae3[_0x589925]={'$like':'%'+_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x40')]+'%'};return _0x352ae3;})});}if(_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x42')]){var _0x400ae0=_0x17f3d3['query'][_0xdbb8('0x42')][_0xdbb8('0x43')](',');var _0x598dcc={};_0x598dcc[_0x400ae0[0x0]]={'$gte':moment(_0x400ae0[0x1])['format'](_0xdbb8('0x44'))};_0x167e72[_0xdbb8('0x3d')]=_[_0xdbb8('0x41')](_0x167e72[_0xdbb8('0x3d')],_0x598dcc);}_0x167e72=_[_0xdbb8('0x41')]({},_0x167e72,_0x17f3d3[_0xdbb8('0x45')]);return db[_0xdbb8('0x35')]['count']({'where':_0x167e72[_0xdbb8('0x3d')]})[_0xdbb8('0x1a')](function(_0x2180d9){_0x3cac09[_0xdbb8('0x16')]=_0x2180d9;if(_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x2e')]){_0x167e72[_0xdbb8('0x2f')]=[{'all':!![]}];}return db[_0xdbb8('0x35')][_0xdbb8('0x46')](_0x167e72);})[_0xdbb8('0x1a')](function(_0xc8f514){_0x3cac09[_0xdbb8('0x47')]=_0xc8f514;return _0x3cac09;});}})[_0xdbb8('0x1a')](respondWithFilteredResult(_0x50a2b4,_0x167e72))[_0xdbb8('0x24')](handleError(_0x50a2b4,null));};exports[_0xdbb8('0x48')]=function(_0x4ef493,_0x32e5a1){return db[_0xdbb8('0x1f')][_0xdbb8('0x30')]({'where':{'id':_0x4ef493['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x32e5a1,null))['then'](function(_0xc47949){if(_0xc47949){return _0xc47949[_0xdbb8('0x49')](_0x4ef493[_0xdbb8('0x32')][_0xdbb8('0x37')],_['omit'](_0x4ef493[_0xdbb8('0x32')],[_0xdbb8('0x37'),'id'])||{})[_0xdbb8('0x4a')](function(){return db[_0xdbb8('0x4b')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4ef493[_0xdbb8('0x32')][_0xdbb8('0x37')]}});})[_0xdbb8('0x1a')](function(_0x2d7642){socket[_0xdbb8('0x4c')](_0xdbb8('0x4d'),{'id':Number(_0x4ef493[_0xdbb8('0x26')]['id']),'tags':_0x2d7642||[]});return{'id':Number(_0x4ef493[_0xdbb8('0x26')]['id']),'tags':_0x2d7642||[]};});}})['then'](respondWithResult(_0x32e5a1,null))[_0xdbb8('0x24')](handleError(_0x32e5a1,null));};exports[_0xdbb8('0x4e')]=function(_0x294c3f,_0x3ef9a0){return db[_0xdbb8('0x1f')]['find']({'where':{'id':_0x294c3f['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x3ef9a0,null))[_0xdbb8('0x1a')](function(_0x2e1e0b){if(_0x2e1e0b){return _0x2e1e0b[_0xdbb8('0x4e')](_0x294c3f['query'][_0xdbb8('0x37')]);}})[_0xdbb8('0x1a')](respondWithStatusCode(_0x3ef9a0,null))['catch'](handleError(_0x3ef9a0,null));};exports[_0xdbb8('0x4f')]=function(_0x4c85c0,_0x3f0a46){var _0x1c1718=moment()[_0xdbb8('0x50')]()[_0xdbb8('0x51')]();var _0xd54db6=path[_0xdbb8('0x52')](config['root'],'server',_0xdbb8('0x53'),'tmp');var _0x1462a9=path[_0xdbb8('0x52')](config[_0xdbb8('0x54')],_0xdbb8('0x55'),'files','attachments');var _0x44451b=path[_0xdbb8('0x52')](_0xd54db6,_0x1c1718);var _0x5e04c8=util[_0xdbb8('0x56')](_0xdbb8('0x57'),_0x4c85c0[_0xdbb8('0x26')]['id'],_0x1c1718);var _0x316de4=path['join'](_0xd54db6,_0x5e04c8);var _0xcd9df8=[];_0xcd9df8[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x59')],'as':_0xdbb8('0x59'),'attributes':['id',_0xdbb8('0x5a')],'raw':!![]});_0xcd9df8[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x5b')],'as':_0xdbb8('0x5c'),'attributes':['id',_0xdbb8('0x5d'),_0xdbb8('0x5e')],'raw':!![]});if(_0x4c85c0['query'][_0xdbb8('0x5f')]){_0xcd9df8[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x60')],'as':_0xdbb8('0x60'),'raw':!![]});}var _0x5ead4a=[{'model':db[_0xdbb8('0x35')],'as':'Messages','attributes':['id',_0xdbb8('0x32'),_0xdbb8('0x61'),_0xdbb8('0x62'),_0xdbb8('0x63'),'read'],'include':_0xcd9df8}];_0x5ead4a[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x64')],'as':_0xdbb8('0x65'),'attributes':['id',_0xdbb8('0x1c')]});_0x5ead4a[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x59')],'as':_0xdbb8('0x66'),'attributes':['id','fullname']});return db[_0xdbb8('0x1f')]['find']({'where':{'id':_0x4c85c0[_0xdbb8('0x26')]['id']},'include':_0x5ead4a})[_0xdbb8('0x1a')](handleEntityNotFound(_0x3f0a46,null))[_0xdbb8('0x1a')](function(_0x5195c8){if(_0x5195c8){var _0x3aaa44=_0x5195c8[_0xdbb8('0x67')]({'plain':!![]});fs['mkdirSync'](_0x44451b);var _0x3f7ede={'channel':'Whatsapp','account':_0x3aaa44[_0xdbb8('0x65')][_0xdbb8('0x1c')],'agent':_0x3aaa44['Owner']?_0x3aaa44[_0xdbb8('0x66')][_0xdbb8('0x5a')]:'N.A.','createdAt':moment(_0x3aaa44[_0xdbb8('0x61')])[_0xdbb8('0x56')](_0xdbb8('0x44'))[_0xdbb8('0x51')](),'closedAt':_0x3aaa44[_0xdbb8('0x68')]?moment(_0x3aaa44[_0xdbb8('0x69')])[_0xdbb8('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbb8('0x51')]():'','disposition':_0x3aaa44[_0xdbb8('0x6a')],'messages':_(_0x3aaa44[_0xdbb8('0x6b')])[_0xdbb8('0x40')]({'secret':![]})['map'](function(_0x58dea5){if(_0x58dea5[_0xdbb8('0x60')]){var _0x1abd15=path[_0xdbb8('0x52')](_0x1462a9,_0x58dea5['Attachment'][_0xdbb8('0x6c')]);if(fs[_0xdbb8('0x6d')](_0x1abd15)){fs['createReadStream'](_0x1abd15)['pipe'](fs[_0xdbb8('0x6e')](path['join'](_0x44451b,_0x58dea5[_0xdbb8('0x60')][_0xdbb8('0x6c')])));}}return{'date':moment(_0x58dea5['createdAt'])[_0xdbb8('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbb8('0x51')](),'sender':_0x58dea5[_0xdbb8('0x62')]==='out'?_0x58dea5[_0xdbb8('0x59')]?_0x58dea5[_0xdbb8('0x59')]['fullname']:_0xdbb8('0x6f'):_0x58dea5['Contact'][_0xdbb8('0x5d')]+(_0x58dea5[_0xdbb8('0x5c')]['lastName']?'\x20'+_0x58dea5['Contact'][_0xdbb8('0x5e')]:''),'body':_0x58dea5[_0xdbb8('0x60')]?_0x58dea5['Attachment'][_0xdbb8('0x6c')]:_0x58dea5['body'],'direction':_0x58dea5[_0xdbb8('0x62')]===_0xdbb8('0x70')?'A':'C','secret':_0x58dea5[_0xdbb8('0x63')],'read':_0x58dea5[_0xdbb8('0x71')],'attachment':_0x58dea5[_0xdbb8('0x60')]};})[_0xdbb8('0x72')]()};return ejs['renderFile'](path[_0xdbb8('0x52')](config[_0xdbb8('0x54')],_0xdbb8('0x55'),_0xdbb8('0x73'),'downloadInteraction.ejs'),{'interaction':_0x3f7ede})[_0xdbb8('0x1a')](function(_0x50e473){var _0x17d1f6=path[_0xdbb8('0x52')](_0x44451b,'transcript-'+_0x3aaa44['id']+'-'+_0x1c1718+'.pdf');var _0x417cee={'path':_0x17d1f6,'channel':_0xdbb8('0x74'),'interactionId':_0x3aaa44['id']};return pdf[_0xdbb8('0x75')](_0x50e473,_0x417cee);})[_0xdbb8('0x1a')](function(){return new BPromise(function(_0x3b9fc9,_0x373271){zipdir(_0x44451b,{'saveTo':_0x316de4},function(_0x48eaf7,_0x2cfd31){if(_0x48eaf7)return _0x373271(_0x48eaf7);return _0x3b9fc9(_0x2cfd31);});})[_0xdbb8('0x1a')](function(){return new BPromise(function(_0x5c99cd,_0x205f38){rimraf(_0x44451b,function(_0x24a7f1){if(_0x24a7f1)_0x205f38(_0x24a7f1);return _0x5c99cd();});});})[_0xdbb8('0x1a')](function(){return _0x3f0a46[_0xdbb8('0x4f')](_0x316de4,_0x5e04c8,function(_0x4d6d81){if(_0x4d6d81){console[_0xdbb8('0x76')](_0xdbb8('0x77'),_0x4d6d81);}else{fs['unlinkSync'](_0x316de4);}});});});}else{return _0x3f0a46['sendStatus'](0xc8);}})[_0xdbb8('0x24')](handleError(_0x3f0a46,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4770cd4..5067c9a 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 _0x0bb5=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll','length'];(function(_0x229c4c,_0x3a8890){var _0x441127=function(_0x1f2be7){while(--_0x1f2be7){_0x229c4c['push'](_0x229c4c['shift']());}};_0x441127(++_0x3a8890);}(_0x0bb5,0x148));var _0x50bb=function(_0x4e1707,_0x203ab6){_0x4e1707=_0x4e1707-0x0;var _0xd1eec3=_0x0bb5[_0x4e1707];return _0xd1eec3;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var WhatsappInteraction=require(_0x50bb('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x50bb('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x50bb('0x3')](0x0);var events={'afterCreate':_0x50bb('0x4'),'afterUpdate':_0x50bb('0x5'),'afterDestroy':_0x50bb('0x6')};function emitEvent(_0xfdc9d4){return function(_0x451b4c,_0x33f2c5,_0x4e6093){_0x451b4c['getUsers']({'attributes':['id'],'raw':!![]})[_0x50bb('0x7')](function(_0x35de5d){_0x451b4c[_0x50bb('0x8')](_0x50bb('0x9'),_0x35de5d['map'](function(_0x4ab8d7){return{'id':_0x4ab8d7['id']};}));return WhatsappMessage[_0x50bb('0xa')]({'where':{'WhatsappInteractionId':_0x451b4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x50bb('0x7')](function(_0x3ae598){_0x451b4c[_0x50bb('0x8')]('unreadMessages',_0x3ae598[_0x50bb('0xb')]);WhatsappInteractionEvents[_0x50bb('0xc')](_0xfdc9d4+':'+_0x451b4c['id'],_0x451b4c);WhatsappInteractionEvents[_0x50bb('0xc')](_0xfdc9d4,_0x451b4c);_0x4e6093(null);})[_0x50bb('0xd')](_0x4e6093(null));};}for(var e in events){if(events[_0x50bb('0xe')](e)){var event=events[e];WhatsappInteraction[_0x50bb('0xf')](e,emitEvent(event));}}module[_0x50bb('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x41bb=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','setDataValue','Users','findAll','then','unreadMessages'];(function(_0x29bca5,_0x1ca891){var _0x2ffa57=function(_0xbf6602){while(--_0xbf6602){_0x29bca5['push'](_0x29bca5['shift']());}};_0x2ffa57(++_0x1ca891);}(_0x41bb,0xc5));var _0xb41b=function(_0x566189,_0x209c19){_0x566189=_0x566189-0x0;var _0x10c866=_0x41bb[_0x566189];return _0x10c866;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var WhatsappInteraction=require(_0xb41b('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb41b('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':_0xb41b('0x3'),'afterUpdate':_0xb41b('0x4'),'afterDestroy':_0xb41b('0x5')};function emitEvent(_0x4ee21b){return function(_0x12cea3,_0x2c9f9e,_0x2dbaa3){_0x12cea3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x497242){_0x12cea3[_0xb41b('0x6')](_0xb41b('0x7'),_0x497242['map'](function(_0x13d44e){return{'id':_0x13d44e['id']};}));return WhatsappMessage[_0xb41b('0x8')]({'where':{'WhatsappInteractionId':_0x12cea3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb41b('0x9')](function(_0xa2aa66){_0x12cea3[_0xb41b('0x6')](_0xb41b('0xa'),_0xa2aa66[_0xb41b('0xb')]);WhatsappInteractionEvents['emit'](_0x4ee21b+':'+_0x12cea3['id'],_0x12cea3);WhatsappInteractionEvents[_0xb41b('0xc')](_0x4ee21b,_0x12cea3);_0x2dbaa3(null);})['catch'](_0x2dbaa3(null));};}for(var e in events){if(events[_0xb41b('0xd')](e)){var event=events[e];WhatsappInteraction[_0xb41b('0xe')](e,emitEvent(event));}}module[_0xb41b('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f4a1068..ca78443 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 _0xa448=['closedAt','lodash','../../config/logger','api','moment','bluebird','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed'];(function(_0x376c18,_0x2bf6ba){var _0x4aee4c=function(_0x3b04d4){while(--_0x3b04d4){_0x376c18['push'](_0x376c18['shift']());}};_0x4aee4c(++_0x2bf6ba);}(_0xa448,0x1ae));var _0x8a44=function(_0x41826b,_0x446ce8){_0x41826b=_0x41826b-0x0;var _0x5dc7a8=_0xa448[_0x41826b];return _0x5dc7a8;};'use strict';var _=require(_0x8a44('0x0'));var util=require('util');var logger=require(_0x8a44('0x1'))(_0x8a44('0x2'));var moment=require(_0x8a44('0x3'));var BPromise=require(_0x8a44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a44('0x5'));var config=require('../../config/environment');var attributes=require(_0x8a44('0x6'));module[_0x8a44('0x7')]=function(_0x26f2e0,_0x50e60a){return _0x26f2e0[_0x8a44('0x8')](_0x8a44('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x450437,_0x297a2f,_0x123d0d){if(_0x450437[_0x8a44('0xa')](_0x8a44('0xb'))){_0x450437[_0x8a44('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x123d0d(null,_0x450437);}}});}; \ No newline at end of file +var _0xd296=['define','WhatsappInteraction','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','./whatsappInteraction.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd296,0xa2));var _0x6d29=function(_0x348734,_0x142eec){_0x348734=_0x348734-0x0;var _0x5a7dfe=_0xd296[_0x348734];return _0x5a7dfe;};'use strict';var _=require('lodash');var util=require(_0x6d29('0x0'));var logger=require('../../config/logger')(_0x6d29('0x1'));var moment=require(_0x6d29('0x2'));var BPromise=require(_0x6d29('0x3'));var rp=require(_0x6d29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d29('0x5'));module[_0x6d29('0x6')]=function(_0x29c34a,_0x1bc73a){return _0x29c34a[_0x6d29('0x7')](_0x6d29('0x8'),attributes,{'tableName':_0x6d29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x205f9d,_0x2e225b,_0xac4946){if(_0x205f9d[_0x6d29('0xa')]('closed')){_0x205f9d['closedAt']=moment()[_0x6d29('0xb')](_0x6d29('0xc'));}_0xac4946(null,_0x205f9d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6d780f7..5a3a3ca 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 _0x3630=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','body','options','raw','where','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3630,0xda));var _0x0363=function(_0x398866,_0x1e3bf6){_0x398866=_0x398866-0x0;var _0x4c2ca8=_0x3630[_0x398866];return _0x4c2ca8;};'use strict';var _=require('lodash');var util=require(_0x0363('0x0'));var moment=require(_0x0363('0x1'));var BPromise=require(_0x0363('0x2'));var rs=require(_0x0363('0x3'));var fs=require('fs');var Redis=require(_0x0363('0x4'));var db=require(_0x0363('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0363('0x6'))(_0x0363('0x7'));var config=require(_0x0363('0x8'));var jayson=require(_0x0363('0x9'));var client=jayson[_0x0363('0xa')][_0x0363('0xb')]({'port':0x232a});config['redis']=_[_0x0363('0xc')](config[_0x0363('0xd')],{'host':_0x0363('0xe'),'port':0x18eb});var socket=require(_0x0363('0xf'))(new Redis(config[_0x0363('0xd')]));require(_0x0363('0x10'))[_0x0363('0x11')](socket);function respondWithRpcPromise(_0x343392,_0x11ebb2,_0x574990){return new BPromise(function(_0x324505,_0x1ef975){return client['request'](_0x343392,_0x574990)[_0x0363('0x12')](function(_0x3b84ff){logger['info'](_0x0363('0x13'),_0x11ebb2,_0x0363('0x14'));logger[_0x0363('0x15')](_0x0363('0x16'),_0x11ebb2,'request\x20sent',JSON[_0x0363('0x17')](_0x3b84ff));if(_0x3b84ff[_0x0363('0x18')]){if(_0x3b84ff[_0x0363('0x18')][_0x0363('0x19')]===0x1f4){logger[_0x0363('0x18')](_0x0363('0x13'),_0x11ebb2,_0x3b84ff[_0x0363('0x18')][_0x0363('0x1a')]);return _0x1ef975(_0x3b84ff['error'][_0x0363('0x1a')]);}logger[_0x0363('0x18')](_0x0363('0x13'),_0x11ebb2,_0x3b84ff[_0x0363('0x18')]['message']);return _0x324505(_0x3b84ff[_0x0363('0x18')][_0x0363('0x1a')]);}else{logger[_0x0363('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x11ebb2,_0x0363('0x14'));_0x324505(_0x3b84ff[_0x0363('0x1c')]['message']);}})[_0x0363('0x1d')](function(_0x479ce8){logger[_0x0363('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x11ebb2,_0x479ce8);_0x1ef975(_0x479ce8);});});}exports['UpdateWhatsappInteraction']=function(_0x2d1c8b){var _0x49d4c8=this;return new Promise(function(_0x360551,_0x1c1199){return db['WhatsappInteraction']['update'](_0x2d1c8b[_0x0363('0x1e')],{'raw':_0x2d1c8b[_0x0363('0x1f')]?_0x2d1c8b['options'][_0x0363('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1c8b[_0x0363('0x1f')]?_0x2d1c8b[_0x0363('0x1f')][_0x0363('0x21')]||null:null,'attributes':_0x2d1c8b[_0x0363('0x1f')]?_0x2d1c8b[_0x0363('0x1f')]['attributes']||null:null,'limit':_0x2d1c8b[_0x0363('0x1f')]?_0x2d1c8b[_0x0363('0x1f')][_0x0363('0x22')]||null:null})[_0x0363('0x12')](function(_0x3f5e0c){logger[_0x0363('0x1b')]('UpdateWhatsappInteraction',_0x2d1c8b);logger[_0x0363('0x15')](_0x0363('0x23'),_0x2d1c8b,JSON[_0x0363('0x17')](_0x3f5e0c));_0x360551(_0x3f5e0c);})['catch'](function(_0x26a478){logger[_0x0363('0x18')]('UpdateWhatsappInteraction',_0x26a478[_0x0363('0x1a')],_0x2d1c8b);_0x1c1199(_0x49d4c8['error'](0x1f4,_0x26a478[_0x0363('0x1a')]));});});};exports[_0x0363('0x24')]=function(_0x11c5f1){return new Promise(function(_0x290a00,_0xfb664a){return db[_0x0363('0x25')][_0x0363('0x26')]({'where':_0x11c5f1[_0x0363('0x1f')]?_0x11c5f1[_0x0363('0x1f')]['where']||null:null})[_0x0363('0x12')](function(_0x46dbe0){if(_0x46dbe0){return _0x46dbe0[_0x0363('0x27')](_0x11c5f1[_0x0363('0x1e')][_0x0363('0x28')],_[_0x0363('0x29')](_0x11c5f1[_0x0363('0x1e')],[_0x0363('0x28'),'id'])||{});}})[_0x0363('0x2a')](function(_0x3b0c41){logger['info'](_0x0363('0x2b'),_0x11c5f1);logger[_0x0363('0x15')](_0x0363('0x2b'),_0x11c5f1,JSON[_0x0363('0x17')](_0x3b0c41));_0x290a00(_0x3b0c41);})[_0x0363('0x1d')](function(_0x51cc6f){logger[_0x0363('0x18')](_0x0363('0x2b'),_0x51cc6f['message'],_0x11c5f1);_0xfb664a(_this['error'](0x1f4,_0x51cc6f[_0x0363('0x1a')]));});});}; \ No newline at end of file +var _0xaea0=['error','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','update','options','where','stringify','catch','AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug'];(function(_0x2eeb0e,_0x32bb55){var _0x727f68=function(_0x2192fc){while(--_0x2192fc){_0x2eeb0e['push'](_0x2eeb0e['shift']());}};_0x727f68(++_0x32bb55);}(_0xaea0,0x114));var _0x0aea=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xaea0[_0x215dc8];return _0x583ea3;};'use strict';var _=require(_0x0aea('0x0'));var util=require('util');var moment=require(_0x0aea('0x1'));var BPromise=require(_0x0aea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aea('0x3'));var db=require(_0x0aea('0x4'))['db'];var utils=require(_0x0aea('0x5'));var logger=require(_0x0aea('0x6'))(_0x0aea('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0aea('0x8')][_0x0aea('0x9')]({'port':0x232a});config[_0x0aea('0xa')]=_[_0x0aea('0xb')](config[_0x0aea('0xa')],{'host':_0x0aea('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0aea('0xa')]));require(_0x0aea('0xd'))[_0x0aea('0xe')](socket);function respondWithRpcPromise(_0x1be048,_0x435710,_0x580cfd){return new BPromise(function(_0x523ff3,_0x52074f){return client[_0x0aea('0xf')](_0x1be048,_0x580cfd)[_0x0aea('0x10')](function(_0xc416e6){logger[_0x0aea('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x435710,_0x0aea('0x12'));logger[_0x0aea('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x435710,_0x0aea('0x12'),JSON['stringify'](_0xc416e6));if(_0xc416e6[_0x0aea('0x14')]){if(_0xc416e6[_0x0aea('0x14')]['code']===0x1f4){logger[_0x0aea('0x14')](_0x0aea('0x15'),_0x435710,_0xc416e6[_0x0aea('0x14')]['message']);return _0x52074f(_0xc416e6['error'][_0x0aea('0x16')]);}logger[_0x0aea('0x14')](_0x0aea('0x15'),_0x435710,_0xc416e6[_0x0aea('0x14')]['message']);return _0x523ff3(_0xc416e6[_0x0aea('0x14')][_0x0aea('0x16')]);}else{logger[_0x0aea('0x11')](_0x0aea('0x15'),_0x435710,_0x0aea('0x12'));_0x523ff3(_0xc416e6[_0x0aea('0x17')][_0x0aea('0x16')]);}})['catch'](function(_0x54e83f){logger[_0x0aea('0x14')](_0x0aea('0x15'),_0x435710,_0x54e83f);_0x52074f(_0x54e83f);});});}exports[_0x0aea('0x18')]=function(_0x3294cb){var _0x41b9d5=this;return new Promise(function(_0x5cddf3,_0x5c378e){return db['WhatsappInteraction'][_0x0aea('0x19')](_0x3294cb['body'],{'raw':_0x3294cb[_0x0aea('0x1a')]?_0x3294cb[_0x0aea('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3294cb['options']?_0x3294cb[_0x0aea('0x1a')][_0x0aea('0x1b')]||null:null,'attributes':_0x3294cb['options']?_0x3294cb[_0x0aea('0x1a')]['attributes']||null:null,'limit':_0x3294cb[_0x0aea('0x1a')]?_0x3294cb[_0x0aea('0x1a')]['limit']||null:null})[_0x0aea('0x10')](function(_0x38b944){logger[_0x0aea('0x11')](_0x0aea('0x18'),_0x3294cb);logger[_0x0aea('0x13')]('UpdateWhatsappInteraction',_0x3294cb,JSON[_0x0aea('0x1c')](_0x38b944));_0x5cddf3(_0x38b944);})[_0x0aea('0x1d')](function(_0xf51a42){logger[_0x0aea('0x14')](_0x0aea('0x18'),_0xf51a42['message'],_0x3294cb);_0x5c378e(_0x41b9d5[_0x0aea('0x14')](0x1f4,_0xf51a42[_0x0aea('0x16')]));});});};exports[_0x0aea('0x1e')]=function(_0x1df7f1){return new Promise(function(_0x1f9b02,_0x285529){return db['WhatsappInteraction'][_0x0aea('0x1f')]({'where':_0x1df7f1[_0x0aea('0x1a')]?_0x1df7f1[_0x0aea('0x1a')][_0x0aea('0x1b')]||null:null})[_0x0aea('0x10')](function(_0x5b6445){if(_0x5b6445){return _0x5b6445['addTags'](_0x1df7f1[_0x0aea('0x20')][_0x0aea('0x21')],_[_0x0aea('0x22')](_0x1df7f1[_0x0aea('0x20')],['ids','id'])||{});}})[_0x0aea('0x23')](function(_0x3ac6e1){logger[_0x0aea('0x11')](_0x0aea('0x24'),_0x1df7f1);logger[_0x0aea('0x13')]('AddTags',_0x1df7f1,JSON[_0x0aea('0x1c')](_0x3ac6e1));_0x1f9b02(_0x3ac6e1);})['catch'](function(_0x490816){logger['error'](_0x0aea('0x24'),_0x490816[_0x0aea('0x16')],_0x1df7f1);_0x285529(_this[_0x0aea('0x14')](0x1f4,_0x490816[_0x0aea('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d8e31d7..11c3a91 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 _0x2c11=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit','removeListener'];(function(_0x1eff83,_0x598a1c){var _0x20f2fa=function(_0x25a530){while(--_0x25a530){_0x1eff83['push'](_0x1eff83['shift']());}};_0x20f2fa(++_0x598a1c);}(_0x2c11,0x17b));var _0x12c1=function(_0x584b3f,_0x3b21a5){_0x584b3f=_0x584b3f-0x0;var _0x359088=_0x2c11[_0x584b3f];return _0x359088;};'use strict';var WhatsappInteractionEvents=require(_0x12c1('0x0'));var events=[_0x12c1('0x1'),'remove',_0x12c1('0x2')];function createListener(_0x23803b,_0x1b4e47){return function(_0x43a6a1){_0x1b4e47[_0x12c1('0x3')](_0x23803b,_0x43a6a1);};}function removeListener(_0x51146a,_0x5c4058){return function(){WhatsappInteractionEvents[_0x12c1('0x4')](_0x51146a,_0x5c4058);};}exports[_0x12c1('0x5')]=function(_0x514bd7){for(var _0x7a32f2=0x0,_0x31a406=events[_0x12c1('0x6')];_0x7a32f2<_0x31a406;_0x7a32f2++){var _0x169cc6=events[_0x7a32f2];var _0x45fb1a=createListener(_0x12c1('0x7')+_0x169cc6,_0x514bd7);WhatsappInteractionEvents['on'](_0x169cc6,_0x45fb1a);}}; \ No newline at end of file +var _0xa574=['remove','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x1b1d9e,_0x25dcb4){var _0x395d32=function(_0x4939d1){while(--_0x4939d1){_0x1b1d9e['push'](_0x1b1d9e['shift']());}};_0x395d32(++_0x25dcb4);}(_0xa574,0x1c6));var _0x4a57=function(_0x15204a,_0x25770e){_0x15204a=_0x15204a-0x0;var _0x24aa08=_0xa574[_0x15204a];return _0x24aa08;};'use strict';var WhatsappInteractionEvents=require(_0x4a57('0x0'));var events=[_0x4a57('0x1'),_0x4a57('0x2'),_0x4a57('0x3')];function createListener(_0xc4ac45,_0x98d2dd){return function(_0x1411a5){_0x98d2dd['emit'](_0xc4ac45,_0x1411a5);};}function removeListener(_0x11c0d1,_0x38a429){return function(){WhatsappInteractionEvents[_0x4a57('0x4')](_0x11c0d1,_0x38a429);};}exports[_0x4a57('0x5')]=function(_0x207dd8){for(var _0x1f7012=0x0,_0x47cb38=events[_0x4a57('0x6')];_0x1f7012<_0x47cb38;_0x1f7012++){var _0x5f2c16=events[_0x1f7012];var _0x5cdc1e=createListener(_0x4a57('0x7')+_0x5f2c16,_0x207dd8);WhatsappInteractionEvents['on'](_0x5f2c16,_0x5cdc1e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9b828de..a5d128a 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 _0xc7fb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','/:id/accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xc7fb,0x113));var _0xbc7f=function(_0x367df9,_0x251596){_0x367df9=_0x367df9-0x0;var _0x2bca29=_0xc7fb[_0x367df9];return _0x2bca29;};'use strict';var multer=require(_0xbc7f('0x0'));var util=require(_0xbc7f('0x1'));var path=require(_0xbc7f('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc7f('0x3'));var router=express[_0xbc7f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbc7f('0x5'));var interaction=require(_0xbc7f('0x6'));var config=require(_0xbc7f('0x7'));var controller=require(_0xbc7f('0x8'));router['get']('/',auth[_0xbc7f('0x9')](),controller[_0xbc7f('0xa')]);router[_0xbc7f('0xb')](_0xbc7f('0xc'),auth[_0xbc7f('0x9')](),controller[_0xbc7f('0xd')]);router[_0xbc7f('0xb')](_0xbc7f('0xe'),auth['isAuthenticated'](),controller[_0xbc7f('0xf')]);router['post']('/',auth[_0xbc7f('0x9')](),interaction[_0xbc7f('0x10')](_0xbc7f('0x11'),_0xbc7f('0x12')),controller[_0xbc7f('0x13')]);router[_0xbc7f('0x14')](_0xbc7f('0x15'),controller['status']);router['put'](_0xbc7f('0xe'),auth[_0xbc7f('0x9')](),controller['update']);router[_0xbc7f('0x16')](_0xbc7f('0x17'),auth[_0xbc7f('0x9')](),controller['accept']);router[_0xbc7f('0x16')](_0xbc7f('0x18'),auth[_0xbc7f('0x9')](),controller[_0xbc7f('0x19')]);router[_0xbc7f('0x1a')](_0xbc7f('0xe'),auth[_0xbc7f('0x9')](),controller['destroy']);module[_0xbc7f('0x1b')]=router; \ No newline at end of file +var _0x965e=['./whatsappMessage.controller','get','isAuthenticated','index','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','/:id/reject','reject','delete','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x965e,0x103));var _0xe965=function(_0x331298,_0x12341a){_0x331298=_0x331298-0x0;var _0x3824bc=_0x965e[_0x331298];return _0x3824bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe965('0x0'));var timeout=require(_0xe965('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe965('0x2'));var auth=require(_0xe965('0x3'));var interaction=require(_0xe965('0x4'));var config=require('../../config/environment');var controller=require(_0xe965('0x5'));router[_0xe965('0x6')]('/',auth[_0xe965('0x7')](),controller[_0xe965('0x8')]);router[_0xe965('0x6')]('/describe',auth[_0xe965('0x7')](),controller['describe']);router['get']('/:id',auth[_0xe965('0x7')](),controller[_0xe965('0x9')]);router[_0xe965('0xa')]('/',auth[_0xe965('0x7')](),interaction[_0xe965('0xb')](_0xe965('0xc'),_0xe965('0xd')),controller[_0xe965('0xe')]);router['post'](_0xe965('0xf'),controller['status']);router[_0xe965('0x10')](_0xe965('0x11'),auth[_0xe965('0x7')](),controller['update']);router[_0xe965('0x10')]('/:id/accept',auth[_0xe965('0x7')](),controller['accept']);router['put'](_0xe965('0x12'),auth[_0xe965('0x7')](),controller[_0xe965('0x13')]);router[_0xe965('0x14')](_0xe965('0x11'),auth[_0xe965('0x7')](),controller['destroy']);module[_0xe965('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4b12b77..fe3f54d 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 _0xd4bc=['out','DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x52641b,_0x31a477){var _0x599d9a=function(_0x31054b){while(--_0x31054b){_0x52641b['push'](_0x52641b['shift']());}};_0x599d9a(++_0x31a477);}(_0xd4bc,0x148));var _0xcd4b=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0xd4bc[_0x59befa];return _0x1dd63d;};'use strict';var Sequelize=require(_0xcd4b('0x0'));module[_0xcd4b('0x1')]={'body':{'type':Sequelize['TEXT'](_0xcd4b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd4b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd4b('0x4')]('in',_0xcd4b('0x5')),'defaultValue':_0xcd4b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xcd4b('0x6')]},'secret':{'type':Sequelize[_0xcd4b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd4b('0x7')]},'providerResponse':{'type':Sequelize[_0xcd4b('0x8')]}}; \ No newline at end of file +var _0x057f=['STRING','exports','TEXT','BOOLEAN','out','DATE'];(function(_0x5292d6,_0x3540b8){var _0x538cf3=function(_0xe4cb6d){while(--_0xe4cb6d){_0x5292d6['push'](_0x5292d6['shift']());}};_0x538cf3(++_0x3540b8);}(_0x057f,0x85));var _0xf057=function(_0x3ce140,_0x98f34b){_0x3ce140=_0x3ce140-0x0;var _0x37f098=_0x057f[_0x3ce140];return _0x37f098;};'use strict';var Sequelize=require('sequelize');module[_0xf057('0x0')]={'body':{'type':Sequelize[_0xf057('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf057('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf057('0x3')),'defaultValue':_0xf057('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf057('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf057('0x5')]},'providerResponse':{'type':Sequelize[_0xf057('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 93d8067..1a31ee7 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 _0x006a=['YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','fullname','rejectmessage','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','type','VIRTUAL','merge','includeAll','findAll','show','params','length','options','find','create','body','describe','../../config/logger','whatsapp-interactions','readAt','format'];(function(_0x5c16d1,_0x9c593f){var _0xed5002=function(_0x23e01f){while(--_0x23e01f){_0x5c16d1['push'](_0x5c16d1['shift']());}};_0xed5002(++_0x9c593f);}(_0x006a,0x1db));var _0xa006=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0x006a[_0x44f974];return _0x805dbd;};'use strict';var emlformat=require(_0xa006('0x0'));var rimraf=require(_0xa006('0x1'));var zipdir=require(_0xa006('0x2'));var jsonpatch=require(_0xa006('0x3'));var rp=require(_0xa006('0x4'));var moment=require('moment');var BPromise=require(_0xa006('0x5'));var Mustache=require(_0xa006('0x6'));var util=require(_0xa006('0x7'));var path=require(_0xa006('0x8'));var sox=require(_0xa006('0x9'));var csv=require('to-csv');var ejs=require(_0xa006('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa006('0xb'));var squel=require(_0xa006('0xc'));var crypto=require(_0xa006('0xd'));var jsforce=require(_0xa006('0xe'));var deskjs=require(_0xa006('0xf'));var toCsv=require(_0xa006('0x10'));var querystring=require(_0xa006('0x11'));var Papa=require(_0xa006('0x12'));var Redis=require(_0xa006('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa006('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa006('0x15'));var logger=require('../../config/logger')(_0xa006('0x16'));var utils=require('../../config/utils');var config=require(_0xa006('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa006('0x18'))['db'];config[_0xa006('0x19')]=_[_0xa006('0x1a')](config[_0xa006('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa006('0x1b'))(new Redis(config[_0xa006('0x19')]));require(_0xa006('0x1c'))[_0xa006('0x1d')](socket);var jayson=require(_0xa006('0x1e'));var client=jayson[_0xa006('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xa006('0x1f')][_0xa006('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x32f57c,_0x3ab817,_0x1b4f36,_0x48d5a7){return new BPromise(function(_0x182ce4,_0x8ffd3d){var _0x23f621=_0x48d5a7||client;return _0x23f621[_0xa006('0x21')](_0x32f57c,_0x1b4f36)[_0xa006('0x22')](function(_0x32a9d0){logger[_0xa006('0x23')](_0xa006('0x24'),_0x3ab817,_0xa006('0x25'));logger['debug'](_0xa006('0x26'),_0x3ab817,_0xa006('0x25'),JSON['stringify'](_0x32a9d0));if(_0x32a9d0[_0xa006('0x27')]){if(_0x32a9d0[_0xa006('0x27')][_0xa006('0x28')]===0x1f4){logger['error'](_0xa006('0x24'),_0x3ab817,_0x32a9d0['error'][_0xa006('0x29')]);return _0x8ffd3d(_0x32a9d0[_0xa006('0x27')][_0xa006('0x29')]);}logger[_0xa006('0x27')](_0xa006('0x24'),_0x3ab817,_0x32a9d0['error'][_0xa006('0x29')]);return _0x182ce4(_0x32a9d0[_0xa006('0x27')][_0xa006('0x29')]);}else{logger[_0xa006('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3ab817,_0xa006('0x25'));_0x182ce4(_0x32a9d0[_0xa006('0x2a')][_0xa006('0x29')]);}})[_0xa006('0x2b')](function(_0x480229){logger[_0xa006('0x27')](_0xa006('0x24'),_0x3ab817,_0x480229);_0x8ffd3d(_0x480229);});});}function respondWithStatusCode(_0x116cca,_0x4e702f){_0x4e702f=_0x4e702f||0xcc;return function(_0x38e79e){if(_0x38e79e){return _0x116cca['sendStatus'](_0x4e702f);}return _0x116cca[_0xa006('0x2c')](_0x4e702f)[_0xa006('0x2d')]();};}function respondWithResult(_0x201f53,_0x5e3216){_0x5e3216=_0x5e3216||0xc8;return function(_0x21fca5){if(_0x21fca5){return _0x201f53[_0xa006('0x2c')](_0x5e3216)[_0xa006('0x2e')](_0x21fca5);}};}function respondWithFilteredResult(_0x177f43,_0x34b173){return function(_0x3e8d25){if(_0x3e8d25){var _0x376572=typeof _0x34b173[_0xa006('0x2f')]==='undefined'&&typeof _0x34b173['limit']==='undefined';var _0x30840b=_0x3e8d25[_0xa006('0x30')];var _0x318a19=_0x376572?0x0:_0x34b173[_0xa006('0x2f')];var _0x57a295=_0x376572?_0x3e8d25['count']:_0x34b173[_0xa006('0x2f')]+_0x34b173['limit'];var _0x25e25d;if(_0x57a295>=_0x30840b){_0x57a295=_0x30840b;_0x25e25d=0xc8;}else{_0x25e25d=0xce;}_0x177f43[_0xa006('0x2c')](_0x25e25d);return _0x177f43[_0xa006('0x31')](_0xa006('0x32'),_0x318a19+'-'+_0x57a295+'/'+_0x30840b)[_0xa006('0x2e')](_0x3e8d25);}return null;};}function patchUpdates(_0x14a956){return function(_0x383d7a){try{jsonpatch[_0xa006('0x33')](_0x383d7a,_0x14a956,!![]);}catch(_0x33206b){return BPromise[_0xa006('0x34')](_0x33206b);}return _0x383d7a[_0xa006('0x35')]();};}function saveUpdates(_0x598ea8,_0x196a72){return function(_0x2ea36f){if(_0x2ea36f){return _0x2ea36f[_0xa006('0x36')](_0x598ea8)[_0xa006('0x22')](function(_0x1cff36){return _0x1cff36;});}return null;};}function removeEntity(_0x1c5942,_0x5f2e60){return function(_0x2ab83d){if(_0x2ab83d){return _0x2ab83d[_0xa006('0x37')]()[_0xa006('0x22')](function(){_0x1c5942[_0xa006('0x2c')](0xcc)[_0xa006('0x2d')]();});}};}function handleEntityNotFound(_0x4f1dcc,_0xf6b250){return function(_0x137713){if(!_0x137713){_0x4f1dcc[_0xa006('0x38')](0x194);}return _0x137713;};}function handleError(_0x42ce6e,_0x4ebf8c){_0x4ebf8c=_0x4ebf8c||0x1f4;return function(_0x87bd65){logger[_0xa006('0x27')](_0x87bd65[_0xa006('0x39')]);if(_0x87bd65[_0xa006('0x3a')]){delete _0x87bd65[_0xa006('0x3a')];}_0x42ce6e['status'](_0x4ebf8c)[_0xa006('0x3b')](_0x87bd65);};}exports[_0xa006('0x3c')]=function(_0xf1da3d,_0x40250e){var _0x5978b1={},_0x4453ca={},_0x15e25a={'count':0x0,'rows':[]};var _0x1c0b95=_[_0xa006('0x3d')](db[_0xa006('0x3e')][_0xa006('0x3f')],function(_0x3f771d){return{'name':_0x3f771d[_0xa006('0x40')],'type':_0x3f771d['type'][_0xa006('0x41')]};});_0x4453ca['model']=_['map'](_0x1c0b95,'name');_0x4453ca[_0xa006('0x42')]=_[_0xa006('0x43')](_0xf1da3d[_0xa006('0x42')]);_0x4453ca['filters']=_[_0xa006('0x44')](_0x4453ca[_0xa006('0x45')],_0x4453ca[_0xa006('0x42')]);_0x5978b1['attributes']=_[_0xa006('0x44')](_0x4453ca[_0xa006('0x45')],qs[_0xa006('0x46')](_0xf1da3d[_0xa006('0x42')][_0xa006('0x46')]));_0x5978b1[_0xa006('0x47')]=_0x5978b1[_0xa006('0x47')]['length']?_0x5978b1[_0xa006('0x47')]:_0x4453ca[_0xa006('0x45')];if(!_0xf1da3d['query'][_0xa006('0x48')](_0xa006('0x49'))){_0x5978b1['limit']=qs[_0xa006('0x4a')](_0xf1da3d['query'][_0xa006('0x4a')]);_0x5978b1['offset']=qs[_0xa006('0x2f')](_0xf1da3d[_0xa006('0x42')][_0xa006('0x2f')]);}_0x5978b1['order']=qs[_0xa006('0x4b')](_0xf1da3d[_0xa006('0x42')][_0xa006('0x4b')]);_0x5978b1['where']=qs[_0xa006('0x4c')](_[_0xa006('0x4d')](_0xf1da3d[_0xa006('0x42')],_0x4453ca[_0xa006('0x4c')]),_0x1c0b95);if(_0xf1da3d[_0xa006('0x42')][_0xa006('0x4e')]){_0x5978b1[_0xa006('0x4f')]=_['merge'](_0x5978b1[_0xa006('0x4f')],{'$or':_[_0xa006('0x3d')](_0x1c0b95,function(_0x1c11be){if(_0x1c11be[_0xa006('0x50')]!==_0xa006('0x51')){var _0x1b47cb={};_0x1b47cb[_0x1c11be[_0xa006('0x3a')]]={'$like':'%'+_0xf1da3d[_0xa006('0x42')][_0xa006('0x4e')]+'%'};return _0x1b47cb;}})});}_0x5978b1=_[_0xa006('0x52')]({},_0x5978b1,_0xf1da3d['options']);var _0x38c43e={'where':_0x5978b1[_0xa006('0x4f')]};return db[_0xa006('0x3e')]['count'](_0x38c43e)[_0xa006('0x22')](function(_0x7f991e){_0x15e25a[_0xa006('0x30')]=_0x7f991e;if(_0xf1da3d[_0xa006('0x42')][_0xa006('0x53')]){_0x5978b1['include']=[{'all':!![]}];}return db[_0xa006('0x3e')][_0xa006('0x54')](_0x5978b1);})[_0xa006('0x22')](function(_0x81b849){_0x15e25a['rows']=_0x81b849;return _0x15e25a;})['then'](respondWithFilteredResult(_0x40250e,_0x5978b1))[_0xa006('0x2b')](handleError(_0x40250e,null));};exports[_0xa006('0x55')]=function(_0x5f4bb4,_0x1a5c6c){var _0x4644fe={'raw':!![],'where':{'id':_0x5f4bb4[_0xa006('0x56')]['id']}},_0x39b872={};_0x39b872[_0xa006('0x45')]=_[_0xa006('0x43')](db[_0xa006('0x3e')][_0xa006('0x3f')]);_0x39b872[_0xa006('0x42')]=_['keys'](_0x5f4bb4[_0xa006('0x42')]);_0x39b872['filters']=_[_0xa006('0x44')](_0x39b872[_0xa006('0x45')],_0x39b872[_0xa006('0x42')]);_0x4644fe[_0xa006('0x47')]=_[_0xa006('0x44')](_0x39b872['model'],qs[_0xa006('0x46')](_0x5f4bb4[_0xa006('0x42')][_0xa006('0x46')]));_0x4644fe[_0xa006('0x47')]=_0x4644fe[_0xa006('0x47')][_0xa006('0x57')]?_0x4644fe[_0xa006('0x47')]:_0x39b872[_0xa006('0x45')];if(_0x5f4bb4[_0xa006('0x42')][_0xa006('0x53')]){_0x4644fe['include']=[{'all':!![]}];}_0x4644fe=_[_0xa006('0x52')]({},_0x4644fe,_0x5f4bb4[_0xa006('0x58')]);return db[_0xa006('0x3e')][_0xa006('0x59')](_0x4644fe)['then'](handleEntityNotFound(_0x1a5c6c,null))[_0xa006('0x22')](respondWithResult(_0x1a5c6c,null))['catch'](handleError(_0x1a5c6c,null));};exports[_0xa006('0x5a')]=function(_0x1a1ab5,_0x2cf402){return db[_0xa006('0x3e')][_0xa006('0x5a')](_0x1a1ab5[_0xa006('0x5b')],{})[_0xa006('0x22')](respondWithResult(_0x2cf402,0xc9))['catch'](handleError(_0x2cf402,null));};exports['update']=function(_0x2b5a60,_0x5391d1){if(_0x2b5a60[_0xa006('0x5b')]['id']){delete _0x2b5a60[_0xa006('0x5b')]['id'];}return db[_0xa006('0x3e')]['find']({'where':{'id':_0x2b5a60['params']['id']}})['then'](handleEntityNotFound(_0x5391d1,null))[_0xa006('0x22')](saveUpdates(_0x2b5a60[_0xa006('0x5b')],null))[_0xa006('0x22')](respondWithResult(_0x5391d1,null))[_0xa006('0x2b')](handleError(_0x5391d1,null));};exports[_0xa006('0x37')]=function(_0x9831c8,_0x548d9a){return db[_0xa006('0x3e')][_0xa006('0x59')]({'where':{'id':_0x9831c8[_0xa006('0x56')]['id']}})[_0xa006('0x22')](handleEntityNotFound(_0x548d9a,null))[_0xa006('0x22')](removeEntity(_0x548d9a,null))['catch'](handleError(_0x548d9a,null));};exports['describe']=function(_0x334da6,_0x29df50){return db[_0xa006('0x3e')][_0xa006('0x5c')]()[_0xa006('0x22')](respondWithResult(_0x29df50,null))[_0xa006('0x2b')](handleError(_0x29df50,null));};var interaction_log=require(_0xa006('0x5d'))(_0xa006('0x5e'));exports['accept']=function(_0xeea449,_0x540e24,_0x1972e6){var _0x40ed57={'agent':{},'channel':'whatsapp'};if(_0xeea449['body']['id']){delete _0xeea449[_0xa006('0x5b')]['id'];}_0xeea449[_0xa006('0x5b')]['read']=!![];_0xeea449['body'][_0xa006('0x5f')]=moment()[_0xa006('0x60')](_0xa006('0x61'));_0xeea449['body'][_0xa006('0x62')]=_0xeea449['body']['UserId']||_0xeea449['user']['id'];_0x40ed57[_0xa006('0x63')]['id']=_0xeea449[_0xa006('0x5b')]['UserId'];return db[_0xa006('0x3e')]['find']({'where':{'id':_0xeea449[_0xa006('0x56')]['id'],'UserId':null}})[_0xa006('0x22')](handleEntityNotFound(_0x540e24,null))[_0xa006('0x22')](saveUpdates(_0xeea449[_0xa006('0x5b')],null))['then'](function(_0x39f092){if(_0x39f092){_0x40ed57[_0xa006('0x29')]=_0x39f092[_0xa006('0x64')]({'plain':!![]});return db[_0xa006('0x65')][_0xa006('0x59')]({'where':{'id':_0x39f092['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x540e24,null))[_0xa006('0x22')](function(_0x4fd8cf){if(_0x4fd8cf){return _0x4fd8cf[_0xa006('0x36')]({'UserId':_0xeea449[_0xa006('0x5b')][_0xa006('0x62')],'read1stAt':_[_0xa006('0x66')](_0x4fd8cf[_0xa006('0x67')])?moment()[_0xa006('0x60')](_0xa006('0x61')):undefined});}return null;})[_0xa006('0x22')](function(_0x16e301){if(_0x16e301){_0x40ed57[_0xa006('0x68')]=_0x16e301[_0xa006('0x64')]({'plain':!![]});interaction_log['info'](_0xa006('0x69'),_0xeea449[_0xa006('0x6a')]['id'],_0xeea449['user'][_0xa006('0x3a')],_0xeea449[_0xa006('0x6a')][_0xa006('0x6b')],_0x40ed57[_0xa006('0x68')]['id'],_0xeea449[_0xa006('0x5b')]?JSON[_0xa006('0x6c')](_0xeea449['body']):'null');return respondWithRpcPromise(_0xa006('0x6d'),'acceptMessage',_0x40ed57);}return null;})['then'](function(_0x2a4ae5){var _0x41a5b6=_0xa006('0x6e')+_0x2a4ae5['message'][_0xa006('0x6f')];return db['sequelize'][_0xa006('0x42')](_0x41a5b6,{'type':db[_0xa006('0x70')][_0xa006('0x71')]['SELECT'],'raw':!![]})[_0xa006('0x22')](function(_0x15c1fe){return _0x15c1fe;});})[_0xa006('0x22')](function(_0x152360){if(_0x152360){_0x40ed57[_0xa006('0x29')]['contact']=_0x152360[0x0];if(!_0xeea449['body'][_0xa006('0x62')])return;return db[_0xa006('0x72')][_0xa006('0x59')]({'where':{'id':_0xeea449[_0xa006('0x5b')][_0xa006('0x62')],'role':_0xa006('0x63')},'attributes':['id','name','fullname',_0xa006('0x73'),_0xa006('0x74')],'raw':!![]});}return null;})['then'](function(_0xd5fd19){if(!_0xd5fd19)return null;_0x40ed57[_0xa006('0x29')][_0xa006('0x63')]=_0xd5fd19;return _0x40ed57;})[_0xa006('0x22')](function(_0x5d7e77){if(_0x5d7e77){if(_0xeea449['body'][_0xa006('0x75')]){_0x40ed57[_0xa006('0x29')][_0xa006('0x76')]=util[_0xa006('0x60')](_0xa006('0x77'),_0xeea449[_0xa006('0x6a')][_0xa006('0x3a')]);_0x40ed57[_0xa006('0x29')][_0xa006('0x78')]=_0x40ed57[_0xa006('0x78')];_0x40ed57['message'][_0xa006('0x79')]=_0x40ed57[_0xa006('0x78')];_0x40ed57[_0xa006('0x29')][_0xa006('0x7a')]=_0xa006('0x7b');return respondWithRpcPromise(_0xa006('0x7c'),_0xa006('0x7c'),{'event':_0xa006('0x7d'),'message':_0x40ed57[_0xa006('0x29')]},client9002)[_0xa006('0x22')](function(){return _0x40ed57;});}return _0x40ed57;}return null;})['then'](respondWithResult(_0x540e24,null))[_0xa006('0x2b')](handleError(_0x540e24,null));};var interaction_log=require(_0xa006('0x5d'))('whatsapp-interactions');exports[_0xa006('0x34')]=function(_0x438534,_0x492b07,_0x21c776){var _0x2fe1c6={'agent':{},'channel':_0xa006('0x7e')};if(_0x438534[_0xa006('0x5b')]['id']){delete _0x438534[_0xa006('0x5b')]['id'];}_0x438534['body'][_0xa006('0x62')]=_0x438534['body'][_0xa006('0x62')]||_0x438534[_0xa006('0x6a')]['id'];_0x2fe1c6['agent']['id']=_0x438534[_0xa006('0x5b')][_0xa006('0x62')];return db[_0xa006('0x3e')][_0xa006('0x59')]({'where':{'id':_0x438534[_0xa006('0x56')]['id'],'UserId':null}})[_0xa006('0x22')](handleEntityNotFound(_0x492b07,null))['then'](function(_0x364101){if(_0x364101){_0x2fe1c6[_0xa006('0x29')]=_0x364101['get']({'plain':!![]});return db[_0xa006('0x65')][_0xa006('0x59')]({'where':{'id':_0x364101['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x492b07,null))[_0xa006('0x22')](function(_0x192c18){if(_0x192c18){_0x2fe1c6['interaction']=_0x192c18[_0xa006('0x64')]({'plain':!![]});interaction_log[_0xa006('0x23')](_0xa006('0x7f'),_0x438534['user']['id'],_0x438534['user']['name'],_0x438534[_0xa006('0x6a')][_0xa006('0x6b')],_0x2fe1c6[_0xa006('0x68')]['id'],_0x438534['body']?JSON[_0xa006('0x6c')](_0x438534[_0xa006('0x5b')]):'null');return respondWithRpcPromise(_0xa006('0x80'),_0xa006('0x81'),_0x2fe1c6);}return null;})[_0xa006('0x22')](function(_0x3bdf3f){var _0x17a4fa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3bdf3f[_0xa006('0x29')]['ContactId'];return db[_0xa006('0x82')][_0xa006('0x42')](_0x17a4fa,{'type':db[_0xa006('0x70')][_0xa006('0x71')][_0xa006('0x83')],'raw':!![]})[_0xa006('0x22')](function(_0x4cdf72){return _0x4cdf72;});})[_0xa006('0x22')](function(_0x510967){if(_0x510967){_0x2fe1c6[_0xa006('0x29')]['contact']=_0x510967[0x0];if(!_0x438534[_0xa006('0x5b')][_0xa006('0x62')])return;return db[_0xa006('0x72')]['find']({'where':{'id':_0x438534[_0xa006('0x5b')][_0xa006('0x62')],'role':_0xa006('0x63')},'attributes':['id',_0xa006('0x3a'),_0xa006('0x84'),_0xa006('0x73'),'internal'],'raw':!![]});}return null;})[_0xa006('0x22')](function(_0x368c4c){if(!_0x368c4c)return null;_0x2fe1c6['message'][_0xa006('0x63')]=_0x368c4c;return _0x2fe1c6;})['then'](function(_0x30df88){if(_0x30df88){_0x30df88[_0xa006('0x29')][_0xa006('0x76')]=util[_0xa006('0x60')](_0xa006('0x77'),_0x438534[_0xa006('0x6a')]['name']);_0x30df88['message'][_0xa006('0x78')]=_0x2fe1c6[_0xa006('0x78')];_0x30df88[_0xa006('0x29')][_0xa006('0x79')]=_0x2fe1c6[_0xa006('0x78')];_0x30df88[_0xa006('0x29')][_0xa006('0x7a')]=_0xa006('0x34');respondWithRpcPromise(_0xa006('0x7c'),_0xa006('0x7c'),{'event':_0xa006('0x85'),'message':_0x30df88['message']},client9002);return _0x2fe1c6;}return null;})[_0xa006('0x22')](respondWithResult(_0x492b07,null))[_0xa006('0x2b')](handleError(_0x492b07,null));};exports['status']=function(_0x142dcc,_0x3629f4,_0xadf551){if(_0x142dcc[_0xa006('0x5b')]['id']){delete _0x142dcc[_0xa006('0x5b')]['id'];}var _0x451795;return db[_0xa006('0x3e')][_0xa006('0x59')]({'where':{'id':_0x142dcc[_0xa006('0x56')]['id']}})['then'](handleEntityNotFound(_0x3629f4,null))[_0xa006('0x22')](function(_0x401240){if(_0x401240){_0x451795=_0x401240;return db['WhatsappAccount'][_0xa006('0x59')]({'where':{'id':_0x401240['WhatsappAccountId']}});}})[_0xa006('0x22')](handleEntityNotFound(_0x3629f4,null))[_0xa006('0x22')](function(_0x59df68){if(_0x59df68){logger[_0xa006('0x86')](_0xa006('0x87'),_0xa006('0x2c'),'received\x20delivery\x20report\x20from',_0x59df68['type'],util[_0xa006('0x88')](_0x142dcc[_0xa006('0x5b')],{'showHidden':![],'depth':null}));switch(_0x59df68[_0xa006('0x50')]){case _0xa006('0x89'):if(_0x142dcc[_0xa006('0x5b')][_0xa006('0x8a')]&&_0x142dcc[_0xa006('0x5b')][_0xa006('0x8a')]===_0x451795[_0xa006('0x8b')]&&_0x142dcc[_0xa006('0x5b')][_0xa006('0x8c')]&&_0x142dcc['body'][_0xa006('0x8c')]===_0xa006('0x8d')){return _0x451795[_0xa006('0x36')]({'read':!![]});}else{logger[_0xa006('0x27')](_0xa006('0x8e'),_0xa006('0x2c'),_0xa006('0x89'),util['inspect'](_0x142dcc['body'],{'showHidden':![],'depth':null}));}break;}return _0x451795;}})[_0xa006('0x22')](respondWithResult(_0x3629f4,null))['catch'](handleError(_0x3629f4,null));}; \ No newline at end of file +var _0x2573=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','Sequelize','SELECT','contact','SIP/%s','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x42ddc1,_0x3c05e4){var _0x12187f=function(_0x103844){while(--_0x103844){_0x42ddc1['push'](_0x42ddc1['shift']());}};_0x12187f(++_0x3c05e4);}(_0x2573,0x109));var _0x3257=function(_0x1f1c04,_0x2dcdef){_0x1f1c04=_0x1f1c04-0x0;var _0x252d80=_0x2573[_0x1f1c04];return _0x252d80;};'use strict';var emlformat=require(_0x3257('0x0'));var rimraf=require(_0x3257('0x1'));var zipdir=require(_0x3257('0x2'));var jsonpatch=require(_0x3257('0x3'));var rp=require(_0x3257('0x4'));var moment=require(_0x3257('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3257('0x6'));var util=require(_0x3257('0x7'));var path=require(_0x3257('0x8'));var sox=require(_0x3257('0x9'));var csv=require(_0x3257('0xa'));var ejs=require(_0x3257('0xb'));var fs=require('fs');var fs_extra=require(_0x3257('0xc'));var _=require(_0x3257('0xd'));var squel=require('squel');var crypto=require(_0x3257('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3257('0xf'));var toCsv=require(_0x3257('0xa'));var querystring=require(_0x3257('0x10'));var Papa=require('papaparse');var Redis=require(_0x3257('0x11'));var authService=require(_0x3257('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3257('0x13'));var hardwareService=require(_0x3257('0x14'));var logger=require(_0x3257('0x15'))(_0x3257('0x16'));var utils=require(_0x3257('0x17'));var config=require(_0x3257('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3257('0x19'))['db'];config[_0x3257('0x1a')]=_[_0x3257('0x1b')](config[_0x3257('0x1a')],{'host':_0x3257('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3257('0x1a')]));require('./whatsappMessage.socket')[_0x3257('0x1d')](socket);var jayson=require(_0x3257('0x1e'));var client=jayson['client'][_0x3257('0x1f')]({'port':0x232c});var client9002=jayson[_0x3257('0x20')][_0x3257('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x391c5d,_0x3d2442,_0x5d4fa7,_0x22ae54){return new BPromise(function(_0x2cc861,_0xbea351){var _0x2617da=_0x22ae54||client;return _0x2617da[_0x3257('0x21')](_0x391c5d,_0x5d4fa7)[_0x3257('0x22')](function(_0x401042){logger[_0x3257('0x23')](_0x3257('0x24'),_0x3d2442,'request\x20sent');logger[_0x3257('0x25')](_0x3257('0x26'),_0x3d2442,_0x3257('0x27'),JSON[_0x3257('0x28')](_0x401042));if(_0x401042[_0x3257('0x29')]){if(_0x401042[_0x3257('0x29')]['code']===0x1f4){logger[_0x3257('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x3d2442,_0x401042[_0x3257('0x29')]['message']);return _0xbea351(_0x401042['error'][_0x3257('0x2a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3d2442,_0x401042[_0x3257('0x29')][_0x3257('0x2a')]);return _0x2cc861(_0x401042[_0x3257('0x29')][_0x3257('0x2a')]);}else{logger['info'](_0x3257('0x24'),_0x3d2442,_0x3257('0x27'));_0x2cc861(_0x401042[_0x3257('0x2b')][_0x3257('0x2a')]);}})[_0x3257('0x2c')](function(_0x5edbf5){logger[_0x3257('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x3d2442,_0x5edbf5);_0xbea351(_0x5edbf5);});});}function respondWithStatusCode(_0x4d2def,_0x1f961c){_0x1f961c=_0x1f961c||0xcc;return function(_0x2f541f){if(_0x2f541f){return _0x4d2def['sendStatus'](_0x1f961c);}return _0x4d2def[_0x3257('0x2d')](_0x1f961c)[_0x3257('0x2e')]();};}function respondWithResult(_0x15b6e0,_0x21833b){_0x21833b=_0x21833b||0xc8;return function(_0x3f9718){if(_0x3f9718){return _0x15b6e0[_0x3257('0x2d')](_0x21833b)[_0x3257('0x2f')](_0x3f9718);}};}function respondWithFilteredResult(_0x5e6f24,_0x1e99d8){return function(_0x102f13){if(_0x102f13){var _0x75d6ef=typeof _0x1e99d8[_0x3257('0x30')]===_0x3257('0x31')&&typeof _0x1e99d8[_0x3257('0x32')]===_0x3257('0x31');var _0x127bc3=_0x102f13[_0x3257('0x33')];var _0x27967a=_0x75d6ef?0x0:_0x1e99d8['offset'];var _0x5510f5=_0x75d6ef?_0x102f13[_0x3257('0x33')]:_0x1e99d8[_0x3257('0x30')]+_0x1e99d8[_0x3257('0x32')];var _0x744f64;if(_0x5510f5>=_0x127bc3){_0x5510f5=_0x127bc3;_0x744f64=0xc8;}else{_0x744f64=0xce;}_0x5e6f24[_0x3257('0x2d')](_0x744f64);return _0x5e6f24['set'](_0x3257('0x34'),_0x27967a+'-'+_0x5510f5+'/'+_0x127bc3)[_0x3257('0x2f')](_0x102f13);}return null;};}function patchUpdates(_0x33e7c9){return function(_0x1605cb){try{jsonpatch[_0x3257('0x35')](_0x1605cb,_0x33e7c9,!![]);}catch(_0x494d67){return BPromise[_0x3257('0x36')](_0x494d67);}return _0x1605cb[_0x3257('0x37')]();};}function saveUpdates(_0x37cb63,_0x50b1f8){return function(_0x33d876){if(_0x33d876){return _0x33d876[_0x3257('0x38')](_0x37cb63)[_0x3257('0x22')](function(_0x42a8fc){return _0x42a8fc;});}return null;};}function removeEntity(_0x4090fa,_0x2ad17c){return function(_0xf2a9cc){if(_0xf2a9cc){return _0xf2a9cc[_0x3257('0x39')]()[_0x3257('0x22')](function(){_0x4090fa[_0x3257('0x2d')](0xcc)[_0x3257('0x2e')]();});}};}function handleEntityNotFound(_0x48f40b,_0x5be1a4){return function(_0xf267ad){if(!_0xf267ad){_0x48f40b['sendStatus'](0x194);}return _0xf267ad;};}function handleError(_0x52a124,_0x15f3b1){_0x15f3b1=_0x15f3b1||0x1f4;return function(_0x2bb6a7){logger[_0x3257('0x29')](_0x2bb6a7[_0x3257('0x3a')]);if(_0x2bb6a7[_0x3257('0x3b')]){delete _0x2bb6a7[_0x3257('0x3b')];}_0x52a124[_0x3257('0x2d')](_0x15f3b1)[_0x3257('0x3c')](_0x2bb6a7);};}exports[_0x3257('0x3d')]=function(_0x23493d,_0x21d9a5){var _0x26fc5c={},_0x22c529={},_0x2ccfee={'count':0x0,'rows':[]};var _0x116246=_[_0x3257('0x3e')](db['WhatsappMessage'][_0x3257('0x3f')],function(_0x530ca0){return{'name':_0x530ca0[_0x3257('0x40')],'type':_0x530ca0[_0x3257('0x41')][_0x3257('0x42')]};});_0x22c529['model']=_[_0x3257('0x3e')](_0x116246,_0x3257('0x3b'));_0x22c529[_0x3257('0x43')]=_[_0x3257('0x44')](_0x23493d['query']);_0x22c529['filters']=_[_0x3257('0x45')](_0x22c529[_0x3257('0x46')],_0x22c529['query']);_0x26fc5c['attributes']=_['intersection'](_0x22c529['model'],qs[_0x3257('0x47')](_0x23493d[_0x3257('0x43')][_0x3257('0x47')]));_0x26fc5c[_0x3257('0x48')]=_0x26fc5c['attributes'][_0x3257('0x49')]?_0x26fc5c[_0x3257('0x48')]:_0x22c529[_0x3257('0x46')];if(!_0x23493d[_0x3257('0x43')][_0x3257('0x4a')](_0x3257('0x4b'))){_0x26fc5c['limit']=qs[_0x3257('0x32')](_0x23493d[_0x3257('0x43')][_0x3257('0x32')]);_0x26fc5c[_0x3257('0x30')]=qs[_0x3257('0x30')](_0x23493d[_0x3257('0x43')][_0x3257('0x30')]);}_0x26fc5c[_0x3257('0x4c')]=qs['sort'](_0x23493d[_0x3257('0x43')][_0x3257('0x4d')]);_0x26fc5c['where']=qs[_0x3257('0x4e')](_[_0x3257('0x4f')](_0x23493d['query'],_0x22c529[_0x3257('0x4e')]),_0x116246);if(_0x23493d['query'][_0x3257('0x50')]){_0x26fc5c[_0x3257('0x51')]=_[_0x3257('0x52')](_0x26fc5c[_0x3257('0x51')],{'$or':_[_0x3257('0x3e')](_0x116246,function(_0xf66146){if(_0xf66146['type']!=='VIRTUAL'){var _0xa4a499={};_0xa4a499[_0xf66146['name']]={'$like':'%'+_0x23493d['query']['filter']+'%'};return _0xa4a499;}})});}_0x26fc5c=_[_0x3257('0x52')]({},_0x26fc5c,_0x23493d[_0x3257('0x53')]);var _0xc80848={'where':_0x26fc5c[_0x3257('0x51')]};return db[_0x3257('0x54')][_0x3257('0x33')](_0xc80848)[_0x3257('0x22')](function(_0x1f4554){_0x2ccfee['count']=_0x1f4554;if(_0x23493d['query'][_0x3257('0x55')]){_0x26fc5c[_0x3257('0x56')]=[{'all':!![]}];}return db[_0x3257('0x54')][_0x3257('0x57')](_0x26fc5c);})[_0x3257('0x22')](function(_0xf9cacf){_0x2ccfee[_0x3257('0x58')]=_0xf9cacf;return _0x2ccfee;})[_0x3257('0x22')](respondWithFilteredResult(_0x21d9a5,_0x26fc5c))[_0x3257('0x2c')](handleError(_0x21d9a5,null));};exports[_0x3257('0x59')]=function(_0x2473b,_0x1cb61b){var _0x291819={'raw':!![],'where':{'id':_0x2473b[_0x3257('0x5a')]['id']}},_0x3a4683={};_0x3a4683['model']=_[_0x3257('0x44')](db[_0x3257('0x54')]['rawAttributes']);_0x3a4683['query']=_[_0x3257('0x44')](_0x2473b[_0x3257('0x43')]);_0x3a4683[_0x3257('0x4e')]=_[_0x3257('0x45')](_0x3a4683[_0x3257('0x46')],_0x3a4683[_0x3257('0x43')]);_0x291819[_0x3257('0x48')]=_[_0x3257('0x45')](_0x3a4683['model'],qs[_0x3257('0x47')](_0x2473b[_0x3257('0x43')][_0x3257('0x47')]));_0x291819[_0x3257('0x48')]=_0x291819['attributes']['length']?_0x291819['attributes']:_0x3a4683[_0x3257('0x46')];if(_0x2473b['query'][_0x3257('0x55')]){_0x291819[_0x3257('0x56')]=[{'all':!![]}];}_0x291819=_[_0x3257('0x52')]({},_0x291819,_0x2473b[_0x3257('0x53')]);return db['WhatsappMessage'][_0x3257('0x5b')](_0x291819)[_0x3257('0x22')](handleEntityNotFound(_0x1cb61b,null))['then'](respondWithResult(_0x1cb61b,null))[_0x3257('0x2c')](handleError(_0x1cb61b,null));};exports[_0x3257('0x5c')]=function(_0x238465,_0x3e33b4){return db[_0x3257('0x54')]['create'](_0x238465[_0x3257('0x5d')],{})[_0x3257('0x22')](respondWithResult(_0x3e33b4,0xc9))[_0x3257('0x2c')](handleError(_0x3e33b4,null));};exports[_0x3257('0x38')]=function(_0x15f0d8,_0x2d99f0){if(_0x15f0d8[_0x3257('0x5d')]['id']){delete _0x15f0d8[_0x3257('0x5d')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x15f0d8['params']['id']}})[_0x3257('0x22')](handleEntityNotFound(_0x2d99f0,null))[_0x3257('0x22')](saveUpdates(_0x15f0d8[_0x3257('0x5d')],null))[_0x3257('0x22')](respondWithResult(_0x2d99f0,null))[_0x3257('0x2c')](handleError(_0x2d99f0,null));};exports[_0x3257('0x39')]=function(_0x18ebdd,_0x497449){return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0x18ebdd[_0x3257('0x5a')]['id']}})[_0x3257('0x22')](handleEntityNotFound(_0x497449,null))[_0x3257('0x22')](removeEntity(_0x497449,null))[_0x3257('0x2c')](handleError(_0x497449,null));};exports[_0x3257('0x5e')]=function(_0x5a91d2,_0x531794){return db[_0x3257('0x54')][_0x3257('0x5e')]()[_0x3257('0x22')](respondWithResult(_0x531794,null))[_0x3257('0x2c')](handleError(_0x531794,null));};var interaction_log=require(_0x3257('0x15'))(_0x3257('0x5f'));exports['accept']=function(_0xd56603,_0x51535a,_0xd1d13d){var _0x3be870={'agent':{},'channel':_0x3257('0x60')};if(_0xd56603[_0x3257('0x5d')]['id']){delete _0xd56603[_0x3257('0x5d')]['id'];}_0xd56603['body'][_0x3257('0x61')]=!![];_0xd56603[_0x3257('0x5d')][_0x3257('0x62')]=moment()[_0x3257('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0xd56603[_0x3257('0x5d')]['UserId']=_0xd56603[_0x3257('0x5d')][_0x3257('0x64')]||_0xd56603[_0x3257('0x65')]['id'];_0x3be870[_0x3257('0x66')]['id']=_0xd56603[_0x3257('0x5d')]['UserId'];return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0xd56603['params']['id'],'UserId':null}})[_0x3257('0x22')](handleEntityNotFound(_0x51535a,null))[_0x3257('0x22')](saveUpdates(_0xd56603[_0x3257('0x5d')],null))[_0x3257('0x22')](function(_0x1eb0c2){if(_0x1eb0c2){_0x3be870['message']=_0x1eb0c2[_0x3257('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1eb0c2[_0x3257('0x68')]}});}return null;})[_0x3257('0x22')](handleEntityNotFound(_0x51535a,null))['then'](function(_0x204e7b){if(_0x204e7b){return _0x204e7b['update']({'UserId':_0xd56603[_0x3257('0x5d')]['UserId'],'read1stAt':_[_0x3257('0x69')](_0x204e7b[_0x3257('0x6a')])?moment()[_0x3257('0x63')](_0x3257('0x6b')):undefined});}return null;})[_0x3257('0x22')](function(_0x176c98){if(_0x176c98){_0x3be870[_0x3257('0x6c')]=_0x176c98[_0x3257('0x67')]({'plain':!![]});interaction_log['info'](_0x3257('0x6d'),_0xd56603[_0x3257('0x65')]['id'],_0xd56603[_0x3257('0x65')][_0x3257('0x3b')],_0xd56603[_0x3257('0x65')]['role'],_0x3be870[_0x3257('0x6c')]['id'],_0xd56603[_0x3257('0x5d')]?JSON[_0x3257('0x28')](_0xd56603[_0x3257('0x5d')]):'null');return respondWithRpcPromise(_0x3257('0x6e'),_0x3257('0x6f'),_0x3be870);}return null;})[_0x3257('0x22')](function(_0x73e99d){var _0x1f8874='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x73e99d[_0x3257('0x2a')][_0x3257('0x70')];return db[_0x3257('0x71')][_0x3257('0x43')](_0x1f8874,{'type':db['Sequelize'][_0x3257('0x72')]['SELECT'],'raw':!![]})[_0x3257('0x22')](function(_0x120152){return _0x120152;});})[_0x3257('0x22')](function(_0x56cf99){if(_0x56cf99){_0x3be870[_0x3257('0x2a')]['contact']=_0x56cf99[0x0];if(!_0xd56603[_0x3257('0x5d')][_0x3257('0x64')])return;return db[_0x3257('0x73')][_0x3257('0x5b')]({'where':{'id':_0xd56603[_0x3257('0x5d')][_0x3257('0x64')],'role':_0x3257('0x66')},'attributes':['id',_0x3257('0x3b'),_0x3257('0x74'),_0x3257('0x75'),_0x3257('0x76')],'raw':!![]});}return null;})['then'](function(_0x5a2186){if(!_0x5a2186)return null;_0x3be870[_0x3257('0x2a')]['agent']=_0x5a2186;return _0x3be870;})[_0x3257('0x22')](function(_0x43fc3c){if(_0x43fc3c){if(_0xd56603[_0x3257('0x5d')][_0x3257('0x77')]){_0x3be870[_0x3257('0x2a')][_0x3257('0x78')]=util[_0x3257('0x63')]('SIP/%s',_0xd56603[_0x3257('0x65')][_0x3257('0x3b')]);_0x3be870[_0x3257('0x2a')][_0x3257('0x79')]=_0x3be870['channel'];_0x3be870['message']['motionChannel']=_0x3be870[_0x3257('0x79')];_0x3be870['message']['event']='accept';return respondWithRpcPromise(_0x3257('0x7a'),_0x3257('0x7a'),{'event':_0x3257('0x7b'),'message':_0x3be870[_0x3257('0x2a')]},client9002)[_0x3257('0x22')](function(){return _0x3be870;});}return _0x3be870;}return null;})['then'](respondWithResult(_0x51535a,null))[_0x3257('0x2c')](handleError(_0x51535a,null));};var interaction_log=require(_0x3257('0x15'))('whatsapp-interactions');exports[_0x3257('0x36')]=function(_0x10a360,_0x1f08eb,_0x229c7d){var _0x54f655={'agent':{},'channel':'whatsapp'};if(_0x10a360['body']['id']){delete _0x10a360['body']['id'];}_0x10a360['body'][_0x3257('0x64')]=_0x10a360[_0x3257('0x5d')][_0x3257('0x64')]||_0x10a360[_0x3257('0x65')]['id'];_0x54f655[_0x3257('0x66')]['id']=_0x10a360[_0x3257('0x5d')][_0x3257('0x64')];return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0x10a360[_0x3257('0x5a')]['id'],'UserId':null}})[_0x3257('0x22')](handleEntityNotFound(_0x1f08eb,null))[_0x3257('0x22')](function(_0x38fca8){if(_0x38fca8){_0x54f655[_0x3257('0x2a')]=_0x38fca8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x3257('0x5b')]({'where':{'id':_0x38fca8[_0x3257('0x68')]}});}return null;})[_0x3257('0x22')](handleEntityNotFound(_0x1f08eb,null))[_0x3257('0x22')](function(_0x585c2c){if(_0x585c2c){_0x54f655[_0x3257('0x6c')]=_0x585c2c[_0x3257('0x67')]({'plain':!![]});interaction_log[_0x3257('0x23')](_0x3257('0x7c'),_0x10a360[_0x3257('0x65')]['id'],_0x10a360[_0x3257('0x65')][_0x3257('0x3b')],_0x10a360[_0x3257('0x65')][_0x3257('0x7d')],_0x54f655[_0x3257('0x6c')]['id'],_0x10a360[_0x3257('0x5d')]?JSON['stringify'](_0x10a360[_0x3257('0x5d')]):_0x3257('0x7e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x54f655);}return null;})[_0x3257('0x22')](function(_0x5ba756){var _0x4c0fc8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ba756[_0x3257('0x2a')]['ContactId'];return db[_0x3257('0x71')]['query'](_0x4c0fc8,{'type':db[_0x3257('0x7f')][_0x3257('0x72')][_0x3257('0x80')],'raw':!![]})['then'](function(_0x429205){return _0x429205;});})['then'](function(_0x2cdc82){if(_0x2cdc82){_0x54f655[_0x3257('0x2a')][_0x3257('0x81')]=_0x2cdc82[0x0];if(!_0x10a360[_0x3257('0x5d')][_0x3257('0x64')])return;return db['User']['find']({'where':{'id':_0x10a360[_0x3257('0x5d')]['UserId'],'role':_0x3257('0x66')},'attributes':['id',_0x3257('0x3b'),_0x3257('0x74'),_0x3257('0x75'),_0x3257('0x76')],'raw':!![]});}return null;})[_0x3257('0x22')](function(_0x429b1e){if(!_0x429b1e)return null;_0x54f655[_0x3257('0x2a')][_0x3257('0x66')]=_0x429b1e;return _0x54f655;})[_0x3257('0x22')](function(_0x48b94){if(_0x48b94){_0x48b94['message'][_0x3257('0x78')]=util['format'](_0x3257('0x82'),_0x10a360[_0x3257('0x65')][_0x3257('0x3b')]);_0x48b94[_0x3257('0x2a')][_0x3257('0x79')]=_0x54f655[_0x3257('0x79')];_0x48b94['message']['motionChannel']=_0x54f655[_0x3257('0x79')];_0x48b94[_0x3257('0x2a')]['event']=_0x3257('0x36');respondWithRpcPromise(_0x3257('0x7a'),_0x3257('0x7a'),{'event':_0x3257('0x83'),'message':_0x48b94[_0x3257('0x2a')]},client9002);return _0x54f655;}return null;})[_0x3257('0x22')](respondWithResult(_0x1f08eb,null))['catch'](handleError(_0x1f08eb,null));};exports[_0x3257('0x2d')]=function(_0x3f5cd4,_0x4642a5,_0x4a4ba9){if(_0x3f5cd4[_0x3257('0x5d')]['id']){delete _0x3f5cd4[_0x3257('0x5d')]['id'];}var _0x1fbd01;return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0x3f5cd4[_0x3257('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4642a5,null))[_0x3257('0x22')](function(_0x105103){if(_0x105103){_0x1fbd01=_0x105103;return db[_0x3257('0x84')][_0x3257('0x5b')]({'where':{'id':_0x105103['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x4642a5,null))[_0x3257('0x22')](function(_0x376b49){if(_0x376b49){logger['debug'](_0x3257('0x85'),'status','received\x20delivery\x20report\x20from',_0x376b49['type'],util[_0x3257('0x86')](_0x3f5cd4[_0x3257('0x5d')],{'showHidden':![],'depth':null}));switch(_0x376b49['type']){case _0x3257('0x87'):if(_0x3f5cd4['body'][_0x3257('0x88')]&&_0x3f5cd4['body'][_0x3257('0x88')]===_0x1fbd01[_0x3257('0x89')]&&_0x3f5cd4[_0x3257('0x5d')][_0x3257('0x8a')]&&_0x3f5cd4['body']['MessageStatus']==='read'){return _0x1fbd01['update']({'read':!![]});}else{logger[_0x3257('0x29')](_0x3257('0x8b'),_0x3257('0x2d'),_0x3257('0x87'),util['inspect'](_0x3f5cd4[_0x3257('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1fbd01;}})['then'](respondWithResult(_0x4642a5,null))[_0x3257('0x2c')](handleError(_0x4642a5,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 01fed09..7ca7b5d 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 _0xa478=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x56ddb6,_0x1f46bc){var _0x2e0bb5=function(_0x4a31c9){while(--_0x4a31c9){_0x56ddb6['push'](_0x56ddb6['shift']());}};_0x2e0bb5(++_0x1f46bc);}(_0xa478,0x136));var _0x8a47=function(_0xed6f46,_0x1c9006){_0xed6f46=_0xed6f46-0x0;var _0x5b267c=_0xa478[_0xed6f46];return _0x5b267c;};'use strict';var EventEmitter=require(_0x8a47('0x0'));var WhatsappMessage=require(_0x8a47('0x1'))['db'][_0x8a47('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8a47('0x3')](0x0);var events={'afterCreate':_0x8a47('0x4'),'afterUpdate':_0x8a47('0x5'),'afterDestroy':_0x8a47('0x6')};function emitEvent(_0x37a882){return function(_0x2b3110,_0x256550,_0x6e2ab5){WhatsappMessageEvents[_0x8a47('0x7')](_0x37a882+':'+_0x2b3110['id'],_0x2b3110);WhatsappMessageEvents['emit'](_0x37a882,_0x2b3110);_0x6e2ab5(null);};}for(var e in events){if(events[_0x8a47('0x8')](e)){var event=events[e];WhatsappMessage[_0x8a47('0x9')](e,emitEvent(event));}}module[_0x8a47('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x96cc=['remove','emit','hook','exports','events','WhatsappMessage','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x4e5d57,_0x742e0f){_0x4e5d57=_0x4e5d57-0x0;var _0x160d0a=_0x96cc[_0x4e5d57];return _0x160d0a;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc96c('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){WhatsappMessageEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);WhatsappMessageEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 185962c..307935c 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 _0xaa7c=['findOne','WhatsappInteractionId','update','createdAt','error','WhatsappAccount','then','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction'];(function(_0x58e1b3,_0x3879a8){var _0x572981=function(_0x25620d){while(--_0x25620d){_0x58e1b3['push'](_0x58e1b3['shift']());}};_0x572981(++_0x3879a8);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x48291e,_0x2e2e2e){_0x48291e=_0x48291e-0x0;var _0x4da3d3=_0xaa7c[_0x48291e];return _0x4da3d3;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaa7('0x1'));var rp=require(_0xcaa7('0x2'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xcaa7('0x3'));var rimraf=require(_0xcaa7('0x4'));var config=require(_0xcaa7('0x5'));var attributes=require(_0xcaa7('0x6'));module[_0xcaa7('0x7')]=function(_0x5a3674,_0x4b9df0){return _0x5a3674['define']('WhatsappMessage',attributes,{'tableName':_0xcaa7('0x8'),'paranoid':![],'indexes':[{'name':_0xcaa7('0x9'),'fields':[_0xcaa7('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0xcaa7('0xa')],'type':_0xcaa7('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcffcb0,_0x38a42d,_0x330e9a){var _0x4c2bf8=_0x5a3674[_0xcaa7('0xc')];var _0x39d53a=_0xcffcb0[_0xcaa7('0xd')]({'plain':!![]});if(_0x39d53a[_0xcaa7('0xe')][_0xcaa7('0xf')]()==='in'||_0x39d53a[_0xcaa7('0xe')]['toLowerCase']()===_0xcaa7('0x10')&&!_0x39d53a[_0xcaa7('0x11')]&&!_[_0xcaa7('0x12')](_0x39d53a[_0xcaa7('0x13')])){_0x4c2bf8[_0xcaa7('0x14')][_0xcaa7('0x15')]({'where':{'id':_0x39d53a[_0xcaa7('0x16')]}})['then'](function(_0x48de99){if(_0x48de99){_0x48de99[_0xcaa7('0x17')]({'lastMsgAt':_0x39d53a[_0xcaa7('0x18')],'lastMsgDirection':_0x39d53a[_0xcaa7('0xe')][_0xcaa7('0xf')]()});}})['catch'](function(_0x98c3e2){console[_0xcaa7('0x19')](_0x98c3e2);});}if(_0x39d53a[_0xcaa7('0xe')]===_0xcaa7('0x10')&&!_0x39d53a[_0xcaa7('0x11')]){var _0xc46e37;_0x4c2bf8[_0xcaa7('0x1a')]['find']({'where':{'id':_0x39d53a['WhatsappAccountId']},'raw':!![]})[_0xcaa7('0x1b')](function(_0x4491d1){_0xc46e37=_0x4491d1;if(_0xc46e37&&_0xc46e37[_0xcaa7('0x1c')]){switch(_0xc46e37[_0xcaa7('0x1c')]){case _0xcaa7('0x1d'):var _0x2a0416=require(_0xcaa7('0x1d'));if(_0xc46e37['accountSid']&&_0xc46e37[_0xcaa7('0x1e')]&&_0xc46e37[_0xcaa7('0x1f')]){var _0x1aa4d2=new _0x2a0416(_0xc46e37[_0xcaa7('0x20')],_0xc46e37[_0xcaa7('0x1e')]);_0x1aa4d2[_0xcaa7('0x21')][_0xcaa7('0x22')]({'body':_0x39d53a[_0xcaa7('0xa')],'to':_0xcaa7('0x23')+_0x39d53a[_0xcaa7('0x1f')],'from':_0xcaa7('0x23')+_0xc46e37[_0xcaa7('0x1f')],'statusCallback':_0xc46e37[_0xcaa7('0x24')]+'/api/whatsapp/messages/'+_0x39d53a['id']+_0xcaa7('0x25')+_0xc46e37[_0xcaa7('0x26')]})['then'](function(_0x3f0eb2){if(_0x3f0eb2[_0xcaa7('0x27')]){return _0xcffcb0[_0xcaa7('0x17')]({'messageId':_0x3f0eb2[_0xcaa7('0x27')]});}})['catch'](function(_0x5d4e7e){logger[_0xcaa7('0x19')](_0xcaa7('0x28'),_0xcaa7('0x29'),_0xcaa7('0x1d'),util[_0xcaa7('0x2a')](_0x5d4e7e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcaa7('0x28'),'afterCreate','twilio',_0xcaa7('0x2b'));}break;case'sinch':var _0x34a30d=_0xc46e37[_0xcaa7('0x20')];var _0x748bda=_0xc46e37[_0xcaa7('0x1e')];var _0x248ca5=_0xc46e37[_0xcaa7('0x2c')]+_0xcaa7('0x2d')+_0x34a30d+_0xcaa7('0x2e');var _0x492843={'to':[_0x39d53a[_0xcaa7('0x1f')]],'message':{'type':_0xcaa7('0x2f'),'text':_0x39d53a[_0xcaa7('0xa')]}};var _0x3b2c4c={'method':_0xcaa7('0x30'),'uri':_0x248ca5,'headers':{'Authorization':'Bearer\x20'+_0x748bda,'Content-Type':_0xcaa7('0x31')},'body':_0x492843,'json':!![]};rp(_0x3b2c4c)[_0xcaa7('0x1b')](function(_0xcbeb84){if(_0xcbeb84[_0xcaa7('0x32')][0x0][_0xcaa7('0x33')]){return _0xcffcb0['update']({'messageId':_0xcbeb84[_0xcaa7('0x32')][0x0]['message_id']});}})[_0xcaa7('0x34')](function(_0x5b9b7f){logger[_0xcaa7('0x35')]('WhatsappMessage,\x20%s',_0x5b9b7f);});break;}}})[_0xcaa7('0x36')](function(){_0x330e9a();});}else{_0x330e9a();}}},'charset':_0xcaa7('0x37'),'collate':_0xcaa7('0x38')});}; \ No newline at end of file +var _0x503c=['whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','secret','WhatsappAccount','find','type','twilio','authToken','accountSid','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','message_id','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','define','WhatsappMessage'];(function(_0x136466,_0x8f2309){var _0x1b0aea=function(_0x14283c){while(--_0x14283c){_0x136466['push'](_0x136466['shift']());}};_0x1b0aea(++_0x8f2309);}(_0x503c,0x146));var _0xc503=function(_0x44124b,_0x2b2b32){_0x44124b=_0x44124b-0x0;var _0xafe8bf=_0x503c[_0x44124b];return _0xafe8bf;};'use strict';var _=require('lodash');var util=require(_0xc503('0x0'));var logger=require('../../config/logger')(_0xc503('0x1'));var moment=require(_0xc503('0x2'));var BPromise=require(_0xc503('0x3'));var rp=require(_0xc503('0x4'));var fetch=require(_0xc503('0x5'));var fs=require('fs');var path=require(_0xc503('0x6'));var rimraf=require(_0xc503('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x254429,_0x539ed8){return _0x254429[_0xc503('0x8')](_0xc503('0x9'),attributes,{'tableName':_0xc503('0xa'),'paranoid':![],'indexes':[{'name':_0xc503('0xb'),'fields':[_0xc503('0xb')]},{'name':_0xc503('0xc'),'fields':[_0xc503('0xd')],'type':_0xc503('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x332f87,_0x59f15a,_0x166e7a){var _0x50af0a=_0x254429[_0xc503('0xf')];var _0x473e9a=_0x332f87[_0xc503('0x10')]({'plain':!![]});if(_0x473e9a[_0xc503('0x11')][_0xc503('0x12')]()==='in'||_0x473e9a[_0xc503('0x11')][_0xc503('0x12')]()==='out'&&!_0x473e9a['secret']&&!_[_0xc503('0x13')](_0x473e9a[_0xc503('0x14')])){_0x50af0a[_0xc503('0x15')][_0xc503('0x16')]({'where':{'id':_0x473e9a[_0xc503('0x17')]}})[_0xc503('0x18')](function(_0x4a11fe){if(_0x4a11fe){_0x4a11fe[_0xc503('0x19')]({'lastMsgAt':_0x473e9a[_0xc503('0x1a')],'lastMsgDirection':_0x473e9a[_0xc503('0x11')][_0xc503('0x12')]()});}})[_0xc503('0x1b')](function(_0x1750df){console['error'](_0x1750df);});}if(_0x473e9a[_0xc503('0x11')]==='out'&&!_0x473e9a[_0xc503('0x1c')]){var _0x31ca52;_0x50af0a[_0xc503('0x1d')][_0xc503('0x1e')]({'where':{'id':_0x473e9a['WhatsappAccountId']},'raw':!![]})[_0xc503('0x18')](function(_0x3f46bb){_0x31ca52=_0x3f46bb;if(_0x31ca52&&_0x31ca52[_0xc503('0x1f')]){switch(_0x31ca52['type']){case _0xc503('0x20'):var _0x1cbda1=require(_0xc503('0x20'));if(_0x31ca52['accountSid']&&_0x31ca52[_0xc503('0x21')]&&_0x31ca52['phone']){var _0x49e6f3=new _0x1cbda1(_0x31ca52[_0xc503('0x22')],_0x31ca52['authToken']);_0x49e6f3['messages'][_0xc503('0x23')]({'body':_0x473e9a['body'],'to':_0xc503('0x24')+_0x473e9a[_0xc503('0x25')],'from':_0xc503('0x24')+_0x31ca52[_0xc503('0x25')],'statusCallback':_0x31ca52[_0xc503('0x26')]+_0xc503('0x27')+_0x473e9a['id']+_0xc503('0x28')+_0x31ca52[_0xc503('0x29')]})['then'](function(_0x5d312e){if(_0x5d312e[_0xc503('0x2a')]){return _0x332f87[_0xc503('0x19')]({'messageId':_0x5d312e[_0xc503('0x2a')]});}})[_0xc503('0x1b')](function(_0x3273bb){logger['error'](_0xc503('0x2b'),_0xc503('0x2c'),_0xc503('0x20'),util['inspect'](_0x3273bb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc503('0x2b'),_0xc503('0x2c'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc503('0x2d'):var _0x309dfa=_0x31ca52['accountSid'];var _0x3b2082=_0x31ca52['authToken'];var _0x5c9aa7=_0x31ca52[_0xc503('0x2e')]+_0xc503('0x2f')+_0x309dfa+_0xc503('0x30');var _0x3f7146={'to':[_0x473e9a['phone']],'message':{'type':_0xc503('0x31'),'text':_0x473e9a[_0xc503('0xd')]}};var _0x253177={'method':_0xc503('0x32'),'uri':_0x5c9aa7,'headers':{'Authorization':'Bearer\x20'+_0x3b2082,'Content-Type':_0xc503('0x33')},'body':_0x3f7146,'json':!![]};rp(_0x253177)[_0xc503('0x18')](function(_0x5e1a70){if(_0x5e1a70['statuses'][0x0][_0xc503('0x34')]){return _0x332f87[_0xc503('0x19')]({'messageId':_0x5e1a70['statuses'][0x0]['message_id']});}})[_0xc503('0x1b')](function(_0x534439){logger['err'](_0xc503('0x35'),_0x534439);});break;}}})[_0xc503('0x36')](function(){_0x166e7a();});}else{_0x166e7a();}}},'charset':'utf8mb4','collate':_0xc503('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e9e6916..212d929 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 _0xb596=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','CreateWhatsappMessage','create','body','options','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb596,0x134));var _0x6b59=function(_0x3f682a,_0x2cb26d){_0x3f682a=_0x3f682a-0x0;var _0x49d1ed=_0xb596[_0x3f682a];return _0x49d1ed;};'use strict';var _=require(_0x6b59('0x0'));var util=require(_0x6b59('0x1'));var moment=require('moment');var BPromise=require(_0x6b59('0x2'));var rs=require(_0x6b59('0x3'));var fs=require('fs');var Redis=require(_0x6b59('0x4'));var db=require(_0x6b59('0x5'))['db'];var utils=require(_0x6b59('0x6'));var logger=require('../../config/logger')(_0x6b59('0x7'));var config=require(_0x6b59('0x8'));var jayson=require(_0x6b59('0x9'));var client=jayson[_0x6b59('0xa')][_0x6b59('0xb')]({'port':0x232a});config[_0x6b59('0xc')]=_[_0x6b59('0xd')](config['redis'],{'host':_0x6b59('0xe'),'port':0x18eb});var socket=require(_0x6b59('0xf'))(new Redis(config['redis']));require(_0x6b59('0x10'))['register'](socket);function respondWithRpcPromise(_0x20858f,_0x548ef3,_0x4fb4b3){return new BPromise(function(_0x33230d,_0x37ab53){return client[_0x6b59('0x11')](_0x20858f,_0x4fb4b3)['then'](function(_0x4ef819){logger[_0x6b59('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x548ef3,_0x6b59('0x13'));logger[_0x6b59('0x14')](_0x6b59('0x15'),_0x548ef3,_0x6b59('0x13'),JSON[_0x6b59('0x16')](_0x4ef819));if(_0x4ef819[_0x6b59('0x17')]){if(_0x4ef819[_0x6b59('0x17')][_0x6b59('0x18')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x548ef3,_0x4ef819['error'][_0x6b59('0x19')]);return _0x37ab53(_0x4ef819[_0x6b59('0x17')]['message']);}logger[_0x6b59('0x17')](_0x6b59('0x1a'),_0x548ef3,_0x4ef819[_0x6b59('0x17')]['message']);return _0x33230d(_0x4ef819[_0x6b59('0x17')][_0x6b59('0x19')]);}else{logger[_0x6b59('0x12')](_0x6b59('0x1a'),_0x548ef3,_0x6b59('0x13'));_0x33230d(_0x4ef819['result'][_0x6b59('0x19')]);}})['catch'](function(_0x3e1c36){logger[_0x6b59('0x17')](_0x6b59('0x1a'),_0x548ef3,_0x3e1c36);_0x37ab53(_0x3e1c36);});});}exports[_0x6b59('0x1b')]=function(_0x1e3a85){var _0x2ba071=this;return new Promise(function(_0x5bae79,_0x28a702){return db['WhatsappMessage'][_0x6b59('0x1c')](_0x1e3a85[_0x6b59('0x1d')],{'raw':_0x1e3a85[_0x6b59('0x1e')]?_0x1e3a85['options']['raw']===undefined?!![]:![]:!![]})[_0x6b59('0x1f')](function(_0x17c29f){logger[_0x6b59('0x12')](_0x6b59('0x1b'),_0x1e3a85);logger[_0x6b59('0x14')](_0x6b59('0x1b'),_0x1e3a85,JSON['stringify'](_0x17c29f));_0x5bae79(_0x17c29f);})['catch'](function(_0x3f31f8){logger[_0x6b59('0x17')](_0x6b59('0x1b'),_0x3f31f8['message'],_0x1e3a85);_0x28a702(_0x2ba071['error'](0x1f4,_0x3f31f8['message']));});});}; \ No newline at end of file +var _0xd864=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','catch','body','options','raw','CreateWhatsappMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2966de,_0xc756d5){var _0x4e75a2=function(_0x15b554){while(--_0x15b554){_0x2966de['push'](_0x2966de['shift']());}};_0x4e75a2(++_0xc756d5);}(_0xd864,0x162));var _0x4d86=function(_0x259c64,_0x1630fc){_0x259c64=_0x259c64-0x0;var _0x784745=_0xd864[_0x259c64];return _0x784745;};'use strict';var _=require(_0x4d86('0x0'));var util=require(_0x4d86('0x1'));var moment=require(_0x4d86('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d86('0x3'));var fs=require('fs');var Redis=require(_0x4d86('0x4'));var db=require(_0x4d86('0x5'))['db'];var utils=require(_0x4d86('0x6'));var logger=require(_0x4d86('0x7'))(_0x4d86('0x8'));var config=require(_0x4d86('0x9'));var jayson=require(_0x4d86('0xa'));var client=jayson['client'][_0x4d86('0xb')]({'port':0x232a});config[_0x4d86('0xc')]=_[_0x4d86('0xd')](config[_0x4d86('0xc')],{'host':_0x4d86('0xe'),'port':0x18eb});var socket=require(_0x4d86('0xf'))(new Redis(config[_0x4d86('0xc')]));require(_0x4d86('0x10'))[_0x4d86('0x11')](socket);function respondWithRpcPromise(_0x42f349,_0x20ae72,_0x1bb4ad){return new BPromise(function(_0x41e889,_0x15fb64){return client[_0x4d86('0x12')](_0x42f349,_0x1bb4ad)['then'](function(_0x51c64b){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x4d86('0x13'));logger[_0x4d86('0x14')](_0x4d86('0x15'),_0x20ae72,_0x4d86('0x13'),JSON[_0x4d86('0x16')](_0x51c64b));if(_0x51c64b[_0x4d86('0x17')]){if(_0x51c64b[_0x4d86('0x17')][_0x4d86('0x18')]===0x1f4){logger[_0x4d86('0x17')](_0x4d86('0x19'),_0x20ae72,_0x51c64b['error']['message']);return _0x15fb64(_0x51c64b[_0x4d86('0x17')][_0x4d86('0x1a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x51c64b[_0x4d86('0x17')][_0x4d86('0x1a')]);return _0x41e889(_0x51c64b[_0x4d86('0x17')][_0x4d86('0x1a')]);}else{logger[_0x4d86('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x4d86('0x13'));_0x41e889(_0x51c64b['result'][_0x4d86('0x1a')]);}})[_0x4d86('0x1c')](function(_0x27f15c){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x27f15c);_0x15fb64(_0x27f15c);});});}exports['CreateWhatsappMessage']=function(_0x351dbc){var _0x1db32c=this;return new Promise(function(_0x314f62,_0x5dfa41){return db['WhatsappMessage']['create'](_0x351dbc[_0x4d86('0x1d')],{'raw':_0x351dbc['options']?_0x351dbc[_0x4d86('0x1e')][_0x4d86('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x395391){logger[_0x4d86('0x1b')](_0x4d86('0x20'),_0x351dbc);logger['debug']('CreateWhatsappMessage',_0x351dbc,JSON[_0x4d86('0x16')](_0x395391));_0x314f62(_0x395391);})[_0x4d86('0x1c')](function(_0x3454d3){logger['error'](_0x4d86('0x20'),_0x3454d3[_0x4d86('0x1a')],_0x351dbc);_0x5dfa41(_0x1db32c[_0x4d86('0x17')](0x1f4,_0x3454d3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3ddfc9c..5747542 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 _0xf48b=['./whatsappMessage.events','save','remove','update','emit','whatsappMessage:'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0xf48b,0x84));var _0xbf48=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf48b[_0x59ee6f];return _0x4c0979;};'use strict';var WhatsappMessageEvents=require(_0xbf48('0x0'));var events=[_0xbf48('0x1'),_0xbf48('0x2'),_0xbf48('0x3')];function createListener(_0x5a1fdb,_0x481baf){return function(_0x504d16){_0x481baf[_0xbf48('0x4')](_0x5a1fdb,_0x504d16);};}function removeListener(_0x396dd9,_0x53c562){return function(){WhatsappMessageEvents['removeListener'](_0x396dd9,_0x53c562);};}exports['register']=function(_0x563cdf){for(var _0x225fe4=0x0,_0x2f464f=events['length'];_0x225fe4<_0x2f464f;_0x225fe4++){var _0xaaa652=events[_0x225fe4];var _0x49fcef=createListener(_0xbf48('0x5')+_0xaaa652,_0x563cdf);WhatsappMessageEvents['on'](_0xaaa652,_0x49fcef);}}; \ No newline at end of file +var _0x01ea=['save','update','emit','removeListener','whatsappMessage:'];(function(_0x1055ca,_0x3b213b){var _0x422554=function(_0x65673e){while(--_0x65673e){_0x1055ca['push'](_0x1055ca['shift']());}};_0x422554(++_0x3b213b);}(_0x01ea,0x14a));var _0xa01e=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x01ea[_0x4bb66f];return _0xf2772f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa01e('0x0'),'remove',_0xa01e('0x1')];function createListener(_0x1f3ac1,_0xf2a95d){return function(_0x5a8521){_0xf2a95d[_0xa01e('0x2')](_0x1f3ac1,_0x5a8521);};}function removeListener(_0xecbbd0,_0x146d5c){return function(){WhatsappMessageEvents[_0xa01e('0x3')](_0xecbbd0,_0x146d5c);};}exports['register']=function(_0x21bd55){for(var _0x19fde7=0x0,_0x856377=events['length'];_0x19fde7<_0x856377;_0x19fde7++){var _0x3d634b=events[_0x19fde7];var _0x1eca6b=createListener(_0xa01e('0x4')+_0x3d634b,_0x21bd55);WhatsappMessageEvents['on'](_0x3d634b,_0x1eca6b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d6c6b0e..88ae66b 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 _0x9f33=['removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete'];(function(_0x1861ab,_0x5c374e){var _0x17fddf=function(_0x35cf47){while(--_0x35cf47){_0x1861ab['push'](_0x1861ab['shift']());}};_0x17fddf(++_0x5c374e);}(_0x9f33,0x147));var _0x39f3=function(_0x20734f,_0x2bcce2){_0x20734f=_0x20734f-0x0;var _0x56aa79=_0x9f33[_0x20734f];return _0x56aa79;};'use strict';var multer=require(_0x39f3('0x0'));var util=require(_0x39f3('0x1'));var path=require(_0x39f3('0x2'));var timeout=require(_0x39f3('0x3'));var express=require(_0x39f3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x39f3('0x5'));var interaction=require(_0x39f3('0x6'));var config=require(_0x39f3('0x7'));var controller=require(_0x39f3('0x8'));router['get']('/',auth[_0x39f3('0x9')](),controller['index']);router[_0x39f3('0xa')]('/describe',auth[_0x39f3('0x9')](),controller[_0x39f3('0xb')]);router[_0x39f3('0xa')](_0x39f3('0xc'),auth[_0x39f3('0x9')](),controller['show']);router[_0x39f3('0xa')]('/:id/members',auth[_0x39f3('0x9')](),controller[_0x39f3('0xd')]);router[_0x39f3('0xa')](_0x39f3('0xe'),auth['isAuthenticated'](),controller[_0x39f3('0xf')]);router['get'](_0x39f3('0x10'),auth[_0x39f3('0x9')](),controller[_0x39f3('0x11')]);router[_0x39f3('0x12')]('/',auth[_0x39f3('0x9')](),controller['create']);router['post']('/:id/teams',auth[_0x39f3('0x9')](),controller['addTeams']);router[_0x39f3('0x12')](_0x39f3('0x10'),auth[_0x39f3('0x9')](),controller[_0x39f3('0x13')]);router[_0x39f3('0x14')](_0x39f3('0xc'),auth[_0x39f3('0x9')](),controller[_0x39f3('0x15')]);router[_0x39f3('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x39f3('0x16')](_0x39f3('0xe'),auth[_0x39f3('0x9')](),controller['removeTeams']);router[_0x39f3('0x16')](_0x39f3('0x10'),auth[_0x39f3('0x9')](),controller[_0x39f3('0x17')]);module[_0x39f3('0x18')]=router; \ No newline at end of file +var _0x2295=['index','get','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x57db01,_0xeacf14){var _0x32b855=function(_0x415783){while(--_0x415783){_0x57db01['push'](_0x57db01['shift']());}};_0x32b855(++_0xeacf14);}(_0x2295,0x16e));var _0x5229=function(_0x2755ae,_0x553183){_0x2755ae=_0x2755ae-0x0;var _0x3e3a6c=_0x2295[_0x2755ae];return _0x3e3a6c;};'use strict';var multer=require(_0x5229('0x0'));var util=require(_0x5229('0x1'));var path=require('path');var timeout=require(_0x5229('0x2'));var express=require(_0x5229('0x3'));var router=express[_0x5229('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5229('0x5'));var interaction=require(_0x5229('0x6'));var config=require(_0x5229('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x5229('0x8')](),controller[_0x5229('0x9')]);router['get']('/describe',auth[_0x5229('0x8')](),controller['describe']);router[_0x5229('0xa')](_0x5229('0xb'),auth[_0x5229('0x8')](),controller['show']);router['get'](_0x5229('0xc'),auth['isAuthenticated'](),controller[_0x5229('0xd')]);router[_0x5229('0xa')](_0x5229('0xe'),auth['isAuthenticated'](),controller[_0x5229('0xf')]);router['get'](_0x5229('0x10'),auth['isAuthenticated'](),controller[_0x5229('0x11')]);router[_0x5229('0x12')]('/',auth[_0x5229('0x8')](),controller[_0x5229('0x13')]);router['post'](_0x5229('0xe'),auth[_0x5229('0x8')](),controller[_0x5229('0x14')]);router[_0x5229('0x12')](_0x5229('0x10'),auth[_0x5229('0x8')](),controller[_0x5229('0x15')]);router['put'](_0x5229('0xb'),auth[_0x5229('0x8')](),controller[_0x5229('0x16')]);router[_0x5229('0x17')](_0x5229('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x5229('0xe'),auth[_0x5229('0x8')](),controller[_0x5229('0x18')]);router['delete']('/:id/users',auth[_0x5229('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2c2eab3..0601a45 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 _0xc7e9=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc7e9[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c7e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9c7e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c7e('0x4')]('rrmemory',_0x9c7e('0x5'),_0x9c7e('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc112=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xc112,0xec));var _0x2c11=function(_0xf730e3,_0x58a6c9){_0xf730e3=_0xf730e3-0x0;var _0x5dec7a=_0xc112[_0xf730e3];return _0x5dec7a;};'use strict';var Sequelize=require(_0x2c11('0x0'));module[_0x2c11('0x1')]={'name':{'type':Sequelize[_0x2c11('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2c11('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2c11('0x4')](_0x2c11('0x5'),_0x2c11('0x6'),_0x2c11('0x7'))},'description':{'type':Sequelize[_0x2c11('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index dc18846..f509a12 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 _0xb969=['tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','query','WhatsappQueue','findAll','rows','catch','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','hasOwnProperty','nolimit','sort','pick','filter','options','UserWhatsappQueue','User','findAndCountAll','agent','updatedAt','format','%s/%s','SIP','whatsappPause','Team','order','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb969,0x196));var _0x9b96=function(_0x493380,_0x3aca28){_0x493380=_0x493380-0x0;var _0x267aa2=_0xb969[_0x493380];return _0x267aa2;};'use strict';var BPromise=require(_0x9b96('0x0'));var util=require(_0x9b96('0x1'));var _=require('lodash');var squel=require(_0x9b96('0x2'));var Redis=require(_0x9b96('0x3'));var qs=require(_0x9b96('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x9b96('0x5'));var db=require('../../mysqldb')['db'];config[_0x9b96('0x6')]=_[_0x9b96('0x7')](config['redis'],{'host':_0x9b96('0x8'),'port':0x18eb});var socket=require(_0x9b96('0x9'))(new Redis(config[_0x9b96('0x6')]));require(_0x9b96('0xa'))[_0x9b96('0xb')](socket);function respondWithStatusCode(_0x477e81,_0x1e5e8b){_0x1e5e8b=_0x1e5e8b||0xcc;return function(_0x578765){if(_0x578765){return _0x477e81['sendStatus'](_0x1e5e8b);}return _0x477e81[_0x9b96('0xc')](_0x1e5e8b)[_0x9b96('0xd')]();};}function respondWithResult(_0x4a9b07,_0x47f7b9){_0x47f7b9=_0x47f7b9||0xc8;return function(_0x194b18){if(_0x194b18){return _0x4a9b07[_0x9b96('0xc')](_0x47f7b9)['json'](_0x194b18);}};}function respondWithFilteredResult(_0x4b3a46,_0x17dc8a){return function(_0x59fd05){if(_0x59fd05){var _0x1d183d=typeof _0x17dc8a[_0x9b96('0xe')]===_0x9b96('0xf')&&typeof _0x17dc8a[_0x9b96('0x10')]===_0x9b96('0xf');var _0x3a3ec8=_0x59fd05['count'];var _0x3fb7b8=_0x1d183d?0x0:_0x17dc8a['offset'];var _0x5cda02=_0x1d183d?_0x59fd05[_0x9b96('0x11')]:_0x17dc8a['offset']+_0x17dc8a[_0x9b96('0x10')];var _0x348b6e;if(_0x5cda02>=_0x3a3ec8){_0x5cda02=_0x3a3ec8;_0x348b6e=0xc8;}else{_0x348b6e=0xce;}_0x4b3a46[_0x9b96('0xc')](_0x348b6e);return _0x4b3a46[_0x9b96('0x12')](_0x9b96('0x13'),_0x3fb7b8+'-'+_0x5cda02+'/'+_0x3a3ec8)['json'](_0x59fd05);}return null;};}function saveUpdates(_0x12a898){return function(_0x577d56){if(_0x577d56){return _0x577d56[_0x9b96('0x14')](_0x12a898)[_0x9b96('0x15')](function(_0x56c628){return _0x56c628;});}return null;};}function removeEntity(_0x34c3af){return function(_0x513e3d){if(_0x513e3d){return _0x513e3d[_0x9b96('0x16')]()[_0x9b96('0x15')](function(){var _0x150720=_0x513e3d[_0x9b96('0x17')]({'plain':!![]});var _0x499699='WhatsappQueues';return db[_0x9b96('0x18')][_0x9b96('0x16')]({'where':{'type':_0x499699,'resourceId':_0x150720['id']}})[_0x9b96('0x15')](function(){return _0x513e3d;});})[_0x9b96('0x15')](function(){_0x34c3af[_0x9b96('0xc')](0xcc)[_0x9b96('0xd')]();});}};}function handleEntityNotFound(_0x28f97f){return function(_0x4b65fe){if(!_0x4b65fe){_0x28f97f[_0x9b96('0x19')](0x194);}return _0x4b65fe;};}function handleError(_0x1ece9d,_0x2ff887){_0x2ff887=_0x2ff887||0x1f4;return function(_0x2dd553){logger[_0x9b96('0x1a')](_0x2dd553[_0x9b96('0x1b')]);if(_0x2dd553['name']){delete _0x2dd553[_0x9b96('0x1c')];}_0x1ece9d[_0x9b96('0xc')](_0x2ff887)[_0x9b96('0x1d')](_0x2dd553);};}exports[_0x9b96('0x1e')]=function(_0x158f9e,_0x1a1c40){var _0x36272c={};var _0x3f5691={'count':0x0,'rows':[]};var _0x3d8f66=_[_0x9b96('0x1f')](db['WhatsappQueue'][_0x9b96('0x20')],function(_0x32b67d){return{'name':_0x32b67d[_0x9b96('0x21')],'type':_0x32b67d[_0x9b96('0x22')][_0x9b96('0x23')]};});_0x36272c=qs[_0x9b96('0x24')](_0x3d8f66,_0x158f9e);var _0x475696={'where':_0x36272c[_0x9b96('0x25')]};return db['WhatsappQueue']['count'](_0x475696)[_0x9b96('0x15')](function(_0x28a737){_0x3f5691[_0x9b96('0x11')]=_0x28a737;_0x36272c[_0x9b96('0x26')]=qs['include'](_0x158f9e[_0x9b96('0x27')]);return db[_0x9b96('0x28')][_0x9b96('0x29')](_0x36272c);})['then'](function(_0x2e9978){_0x3f5691[_0x9b96('0x2a')]=_0x2e9978;return _0x3f5691;})['then'](respondWithFilteredResult(_0x1a1c40,_0x36272c))[_0x9b96('0x2b')](handleError(_0x1a1c40,null));};exports['show']=function(_0x50a651,_0x56e02c){var _0x29eed2={'raw':!![],'where':{'id':_0x50a651['params']['id']}},_0x51f02b={};_0x51f02b[_0x9b96('0x2c')]=_[_0x9b96('0x2d')](db[_0x9b96('0x28')][_0x9b96('0x20')]);_0x51f02b['query']=_['keys'](_0x50a651[_0x9b96('0x27')]);_0x51f02b[_0x9b96('0x2e')]=_[_0x9b96('0x2f')](_0x51f02b['model'],_0x51f02b[_0x9b96('0x27')]);_0x29eed2[_0x9b96('0x30')]=_[_0x9b96('0x2f')](_0x51f02b[_0x9b96('0x2c')],qs[_0x9b96('0x31')](_0x50a651['query']['fields']));_0x29eed2[_0x9b96('0x30')]=_0x29eed2[_0x9b96('0x30')][_0x9b96('0x32')]?_0x29eed2[_0x9b96('0x30')]:_0x51f02b[_0x9b96('0x2c')];if(_0x50a651[_0x9b96('0x27')][_0x9b96('0x33')]){_0x29eed2[_0x9b96('0x26')]=[{'all':!![]}];}_0x29eed2=_[_0x9b96('0x34')]({},_0x29eed2,_0x50a651['options']);return db['WhatsappQueue'][_0x9b96('0x35')](_0x29eed2)[_0x9b96('0x15')](handleEntityNotFound(_0x56e02c,null))[_0x9b96('0x15')](respondWithResult(_0x56e02c,null))['catch'](handleError(_0x56e02c,null));};exports['create']=function(_0x4d7e81,_0x17ab0d){return db[_0x9b96('0x28')][_0x9b96('0x36')](_0x4d7e81[_0x9b96('0x37')],{})[_0x9b96('0x15')](function(_0x2d4c52){var _0x17f2e8=_0x4d7e81[_0x9b96('0x38')][_0x9b96('0x17')]({'plain':!![]});if(!_0x17f2e8)throw new Error(_0x9b96('0x39'));if(_0x17f2e8[_0x9b96('0x3a')]===_0x9b96('0x38')){var _0x370aac=_0x2d4c52['get']({'plain':!![]});var _0x5f3ad2=_0x9b96('0x3b');return db[_0x9b96('0x3c')]['find']({'where':{'name':_0x5f3ad2,'userProfileId':_0x17f2e8[_0x9b96('0x3d')]},'raw':!![]})[_0x9b96('0x15')](function(_0x87e924){if(_0x87e924&&_0x87e924['autoAssociation']===0x0){return db[_0x9b96('0x18')][_0x9b96('0x36')]({'name':_0x370aac[_0x9b96('0x1c')],'resourceId':_0x370aac['id'],'type':_0x87e924[_0x9b96('0x1c')],'sectionId':_0x87e924['id']},{})[_0x9b96('0x15')](function(){return _0x2d4c52;});}else{return _0x2d4c52;}})[_0x9b96('0x2b')](function(_0x2be81c){logger[_0x9b96('0x1a')](_0x9b96('0x3e'),_0x2be81c);throw _0x2be81c;});}return _0x2d4c52;})[_0x9b96('0x15')](respondWithResult(_0x17ab0d,0xc9))[_0x9b96('0x2b')](handleError(_0x17ab0d,null));};exports['update']=function(_0x48d4bd,_0x4af845){if(_0x48d4bd[_0x9b96('0x37')]['id']){delete _0x48d4bd[_0x9b96('0x37')]['id'];}return db[_0x9b96('0x28')][_0x9b96('0x35')]({'where':{'id':_0x48d4bd[_0x9b96('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4af845,null))['then'](saveUpdates(_0x48d4bd['body'],null))['then'](respondWithResult(_0x4af845,null))[_0x9b96('0x2b')](handleError(_0x4af845,null));};exports[_0x9b96('0x16')]=function(_0x2e72e2,_0xc78e74){return db['WhatsappQueue'][_0x9b96('0x35')]({'where':{'id':_0x2e72e2[_0x9b96('0x3f')]['id']}})[_0x9b96('0x15')](handleEntityNotFound(_0xc78e74,null))['then'](removeEntity(_0xc78e74,null))[_0x9b96('0x2b')](handleError(_0xc78e74,null));};exports['describe']=function(_0xbf084a,_0x731ae7){return db[_0x9b96('0x28')]['describe']()[_0x9b96('0x15')](respondWithResult(_0x731ae7,null))['catch'](handleError(_0x731ae7,null));};exports[_0x9b96('0x40')]=function(_0xbc4831,_0x9139a2){var _0x4ef623={'raw':!![],'where':{}},_0x7fc150={},_0x5e1fcf;return db['WhatsappQueue'][_0x9b96('0x41')]({'where':{'id':_0xbc4831['params']['id']}})['then'](handleEntityNotFound(_0x9139a2,null))[_0x9b96('0x15')](function(_0x18d5ea){if(_0x18d5ea){_0x5e1fcf=_0x18d5ea[_0x9b96('0x17')]({'plain':!![]});_0x7fc150[_0x9b96('0x2c')]=_[_0x9b96('0x2d')](db['UserWhatsappQueue'][_0x9b96('0x20')]);_0x7fc150['query']=_['keys'](_0xbc4831[_0x9b96('0x27')]);_0x7fc150['filters']=_['intersection'](_0x7fc150['model'],_0x7fc150[_0x9b96('0x27')]);_0x4ef623[_0x9b96('0x30')]=_[_0x9b96('0x2f')](_0x7fc150[_0x9b96('0x2c')],qs[_0x9b96('0x31')](_0xbc4831['query']['fields']));_0x4ef623[_0x9b96('0x30')]=_0x4ef623[_0x9b96('0x30')][_0x9b96('0x32')]?_0x4ef623['attributes']:_0x7fc150[_0x9b96('0x2c')];if(!_0xbc4831[_0x9b96('0x27')][_0x9b96('0x42')](_0x9b96('0x43'))){_0x4ef623[_0x9b96('0x10')]=qs[_0x9b96('0x10')](_0xbc4831[_0x9b96('0x27')][_0x9b96('0x10')]);_0x4ef623[_0x9b96('0xe')]=qs[_0x9b96('0xe')](_0xbc4831[_0x9b96('0x27')][_0x9b96('0xe')]);}_0x4ef623['order']=qs['sort'](_0xbc4831[_0x9b96('0x27')][_0x9b96('0x44')]);_0x4ef623[_0x9b96('0x25')]=qs[_0x9b96('0x2e')](_[_0x9b96('0x45')](_0xbc4831[_0x9b96('0x27')],_0x7fc150[_0x9b96('0x2e')]));_0x4ef623[_0x9b96('0x25')]['WhatsappQueueId']=_0x18d5ea['id'];if(_0xbc4831['query'][_0x9b96('0x46')]){_0x4ef623['where']=_[_0x9b96('0x34')](_0x4ef623[_0x9b96('0x25')],{'$or':_[_0x9b96('0x1f')](_0x4ef623[_0x9b96('0x30')],function(_0x35aad3){var _0x587f73={};_0x587f73[_0x35aad3]={'$like':'%'+_0xbc4831[_0x9b96('0x27')][_0x9b96('0x46')]+'%'};return _0x587f73;})});}_0x4ef623=_['merge']({},_0x4ef623,_0xbc4831[_0x9b96('0x47')]);return db[_0x9b96('0x48')][_0x9b96('0x29')](_0x4ef623);}})[_0x9b96('0x15')](function(_0x2a78b0){if(_0x2a78b0){return db[_0x9b96('0x49')][_0x9b96('0x4a')]({'where':{'id':_['map'](_0x2a78b0,'UserId'),'role':_0x9b96('0x4b')},'attributes':['id','name','whatsappPause',_0x9b96('0x4c'),'createdAt']});}})['then'](function(_0x194df2){if(_0x194df2){return{'count':_0x194df2[_0x9b96('0x11')],'rows':_[_0x9b96('0x1f')](_0x194df2['rows'],function(_0x2c6870){return{'membername':_0x2c6870[_0x9b96('0x1c')],'UserId':_0x2c6870['id'],'queue_name':_0x5e1fcf[_0x9b96('0x1c')],'WhatsappQueueId':_0x5e1fcf['id'],'interface':util[_0x9b96('0x4d')](_0x9b96('0x4e'),_0x9b96('0x4f'),_0x2c6870[_0x9b96('0x1c')]),'penalty':0x0,'paused':_0x2c6870[_0x9b96('0x50')],'createdAt':_0x2c6870['createdAt'],'updatedAt':_0x2c6870['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9b96('0x15')](respondWithFilteredResult(_0x9139a2,_0x4ef623))['catch'](handleError(_0x9139a2,null));};exports['getTeams']=function(_0x3fba5f,_0x385719){var _0x23ae8f={};var _0x2f545c={};var _0x2aea60;var _0x58e7fc;return db[_0x9b96('0x28')][_0x9b96('0x41')]({'where':{'id':_0x3fba5f[_0x9b96('0x3f')]['id']}})[_0x9b96('0x15')](handleEntityNotFound(_0x385719,null))[_0x9b96('0x15')](function(_0x25f24a){if(_0x25f24a){_0x2aea60=_0x25f24a;_0x2f545c[_0x9b96('0x2c')]=_['keys'](db[_0x9b96('0x51')]['rawAttributes']);_0x2f545c[_0x9b96('0x27')]=_[_0x9b96('0x2d')](_0x3fba5f[_0x9b96('0x27')]);_0x2f545c[_0x9b96('0x2e')]=_[_0x9b96('0x2f')](_0x2f545c['model'],_0x2f545c['query']);_0x23ae8f[_0x9b96('0x30')]=_[_0x9b96('0x2f')](_0x2f545c[_0x9b96('0x2c')],qs[_0x9b96('0x31')](_0x3fba5f[_0x9b96('0x27')][_0x9b96('0x31')]));_0x23ae8f[_0x9b96('0x30')]=_0x23ae8f[_0x9b96('0x30')][_0x9b96('0x32')]?_0x23ae8f[_0x9b96('0x30')]:_0x2f545c[_0x9b96('0x2c')];_0x23ae8f[_0x9b96('0x52')]=qs[_0x9b96('0x44')](_0x3fba5f[_0x9b96('0x27')][_0x9b96('0x44')]);_0x23ae8f['where']=qs[_0x9b96('0x2e')](_[_0x9b96('0x45')](_0x3fba5f[_0x9b96('0x27')],_0x2f545c[_0x9b96('0x2e')]));if(_0x3fba5f[_0x9b96('0x27')][_0x9b96('0x46')]){_0x23ae8f['where']=_[_0x9b96('0x34')](_0x23ae8f[_0x9b96('0x25')],{'$or':_[_0x9b96('0x1f')](_0x23ae8f[_0x9b96('0x30')],function(_0x2819ee){var _0x2400de={};_0x2400de[_0x2819ee]={'$like':'%'+_0x3fba5f['query'][_0x9b96('0x46')]+'%'};return _0x2400de;})});}_0x23ae8f=_['merge']({},_0x23ae8f,_0x3fba5f[_0x9b96('0x47')]);return _0x2aea60[_0x9b96('0x53')](_0x23ae8f);}})[_0x9b96('0x15')](function(_0x395375){if(_0x395375){_0x58e7fc=_0x395375[_0x9b96('0x32')];if(!_0x3fba5f[_0x9b96('0x27')][_0x9b96('0x42')]('nolimit')){_0x23ae8f['limit']=qs[_0x9b96('0x10')](_0x3fba5f[_0x9b96('0x27')]['limit']);_0x23ae8f['offset']=qs[_0x9b96('0xe')](_0x3fba5f['query']['offset']);}return _0x2aea60['getTeams'](_0x23ae8f);}})[_0x9b96('0x15')](function(_0x57e6d0){if(_0x57e6d0){return _0x57e6d0?{'count':_0x58e7fc,'rows':_0x57e6d0}:null;}})['then'](respondWithResult(_0x385719,null))['catch'](handleError(_0x385719,null));};exports[_0x9b96('0x54')]=function(_0x595c56,_0x2199b8){var _0x37f177=_0x595c56[_0x9b96('0x37')][_0x9b96('0x55')];return db[_0x9b96('0x51')][_0x9b96('0x29')]({'where':{'id':_0x37f177},'attributes':['id'],'include':[{'model':db[_0x9b96('0x49')],'as':'Agents','attributes':['id',_0x9b96('0x1c'),'online',_0x9b96('0x56'),_0x9b96('0x57')],'raw':!![]}]})[_0x9b96('0x15')](function(_0x1fd609){if(_0x1fd609){var _0x16a71e=_[_0x9b96('0x58')](_0x1fd609,function(_0x560484){var _0x3e2757=_0x560484['get']({'plain':!![]});return _0x3e2757[_0x9b96('0x59')];});return db[_0x9b96('0x28')][_0x9b96('0x35')]({'where':{'id':_0x595c56[_0x9b96('0x3f')]['id']}})[_0x9b96('0x15')](function(_0x1ac03a){return db['sequelize']['transaction'](function(_0x199f00){return _0x1ac03a[_0x9b96('0x54')](_0x37f177,{'transaction':_0x199f00})[_0x9b96('0x15')](function(){return BPromise[_0x9b96('0x5a')](_0x16a71e,function(_0x16e49e){return db[_0x9b96('0x48')][_0x9b96('0x5b')]({'where':{'UserId':_0x16e49e['id'],'WhatsappQueueId':_0x595c56[_0x9b96('0x3f')]['id']},'transaction':_0x199f00});});})[_0x9b96('0x15')](function(){_0x16a71e[_0x9b96('0x5c')](function(_0x3b547e){socket[_0x9b96('0x5d')](_0x9b96('0x5e'),{'UserId':_0x3b547e['id'],'WhatsappQueueId':_0x1ac03a['id']});});});});});}})[_0x9b96('0x15')](respondWithStatusCode(_0x2199b8,null))[_0x9b96('0x2b')](handleError(_0x2199b8,null));};exports[_0x9b96('0x5f')]=function(_0x36d85d,_0x5b3d2c){return db['Team'][_0x9b96('0x29')]({'where':{'id':_0x36d85d[_0x9b96('0x27')][_0x9b96('0x55')]},'attributes':['id'],'include':[{'model':db[_0x9b96('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9b96('0x15')](handleEntityNotFound(_0x5b3d2c,null))[_0x9b96('0x15')](function(_0x57dc96){var _0x54d9ff=_[_0x9b96('0x1f')](_0x57dc96,'id');var _0x28c995=[];var _0x5c380e=[];var _0x299fe3=squel[_0x9b96('0x60')]();_0x299fe3[_0x9b96('0x61')](_0x9b96('0x62'))[_0x9b96('0x63')](_0x9b96('0x64'),'tq')[_0x9b96('0x65')](_0x9b96('0x66'),'ut',_0x9b96('0x67'))[_0x9b96('0x25')]('WhatsappQueueId\x20=\x20?',_0x36d85d[_0x9b96('0x3f')]['id']);for(var _0x4af4cb=0x0;_0x4af4cb<_0x57dc96[_0x9b96('0x32')];_0x4af4cb+=0x1){let _0x19745f=_0x57dc96[_0x4af4cb];for(var _0x23d6f3=0x0;_0x23d6f3<_0x19745f[_0x9b96('0x59')]['length'];_0x23d6f3+=0x1){let _0x1f5a90=_0x19745f[_0x9b96('0x59')][_0x23d6f3];var _0x46c1e8=_0x299fe3[_0x9b96('0x68')]();_0x46c1e8[_0x9b96('0x25')](_0x9b96('0x69'),_0x1f5a90['id']);_0x5c380e[_0x9b96('0x6a')](db[_0x9b96('0x6b')]['query'](_0x46c1e8[_0x9b96('0x6c')](),{'type':db[_0x9b96('0x6b')][_0x9b96('0x6d')][_0x9b96('0x6e')]})[_0x9b96('0x15')](function(_0x48f1fb){if(_0x48f1fb[_0x9b96('0x32')]===0x1){return _0x1f5a90['id'];}else{var _0x399f08=_[_0x9b96('0x6f')](_[_0x9b96('0x1f')](_0x48f1fb,_0x9b96('0x70')),function(_0x2bc29a){return _['includes'](_0x54d9ff,_0x2bc29a);});if(_0x399f08){return _0x1f5a90['id'];}}}));}}return BPromise[_0x9b96('0x71')](_0x5c380e)[_0x9b96('0x15')](function(_0x492481){_0x28c995=_(_0x28c995)[_0x9b96('0x72')](_0x492481)[_0x9b96('0x73')]()[_0x9b96('0x74')]();return db['WhatsappQueue']['find']({'where':{'id':_0x36d85d[_0x9b96('0x3f')]['id']}})[_0x9b96('0x15')](function(_0xf042b0){return db[_0x9b96('0x6b')][_0x9b96('0x75')](function(_0xdfaefa){return _0xf042b0['removeTeams'](_0x36d85d[_0x9b96('0x27')][_0x9b96('0x55')],{'transaction':_0xdfaefa})[_0x9b96('0x15')](function(){if(!_[_0x9b96('0x76')](_0x28c995)){return _0xf042b0['removeAgents'](_0x28c995,{'transaction':_0xdfaefa});}})[_0x9b96('0x15')](function(){_0x28c995[_0x9b96('0x5c')](function(_0x5d7524){socket[_0x9b96('0x5d')](_0x9b96('0x77'),{'UserId':_0x5d7524,'WhatsappQueueId':_0xf042b0['id']});});});});});});})['then'](respondWithStatusCode(_0x5b3d2c,null))[_0x9b96('0x2b')](handleError(_0x5b3d2c,null));};exports[_0x9b96('0x78')]=function(_0x3cdc42,_0x52a71c){return db[_0x9b96('0x28')]['find']({'where':{'id':_0x3cdc42[_0x9b96('0x3f')]['id']}})[_0x9b96('0x15')](handleEntityNotFound(_0x52a71c,null))['then'](function(_0xefa1cb){if(_0xefa1cb){return _0xefa1cb[_0x9b96('0x78')](_0x3cdc42[_0x9b96('0x37')][_0x9b96('0x55')],_[_0x9b96('0x79')](_0x3cdc42[_0x9b96('0x37')],[_0x9b96('0x55'),'id'])||{})[_0x9b96('0x7a')](function(_0x2a94cc){for(var _0x48a77e=0x0;_0x48a77e<_0x3cdc42[_0x9b96('0x37')][_0x9b96('0x55')][_0x9b96('0x32')];_0x48a77e+=0x1){socket[_0x9b96('0x5d')](_0x9b96('0x5e'),{'UserId':Number(_0x3cdc42[_0x9b96('0x37')][_0x9b96('0x55')][_0x48a77e]),'WhatsappQueueId':Number(_0x3cdc42[_0x9b96('0x3f')]['id'])});}return _0x2a94cc;});}})[_0x9b96('0x15')](respondWithResult(_0x52a71c,null))[_0x9b96('0x2b')](handleError(_0x52a71c,null));};exports['removeAgents']=function(_0x59eef8,_0x1adfa8){return db[_0x9b96('0x28')]['find']({'where':{'id':_0x59eef8['params']['id']}})['then'](handleEntityNotFound(_0x1adfa8,null))[_0x9b96('0x15')](function(_0x311796){if(_0x311796){return _0x311796[_0x9b96('0x7b')](_0x59eef8[_0x9b96('0x27')][_0x9b96('0x55')])[_0x9b96('0x15')](function(){if(_[_0x9b96('0x7c')](_0x59eef8[_0x9b96('0x27')][_0x9b96('0x55')])){for(var _0x53055d=0x0;_0x53055d<_0x59eef8[_0x9b96('0x27')][_0x9b96('0x55')][_0x9b96('0x32')];_0x53055d+=0x1){socket['emit'](_0x9b96('0x77'),{'UserId':Number(_0x59eef8[_0x9b96('0x27')]['ids'][_0x53055d]),'WhatsappQueueId':Number(_0x59eef8['params']['id'])});}}else{socket[_0x9b96('0x5d')](_0x9b96('0x77'),{'UserId':Number(_0x59eef8[_0x9b96('0x27')][_0x9b96('0x55')]),'WhatsappQueueId':Number(_0x59eef8[_0x9b96('0x3f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1adfa8,null))[_0x9b96('0x2b')](handleError(_0x1adfa8,null));};exports[_0x9b96('0x7d')]=function(_0x12d540,_0x5372bc){var _0x45945e={};var _0x5c6e2a={};var _0x534b4f;var _0x58bfe8;return db['WhatsappQueue'][_0x9b96('0x41')]({'where':{'id':_0x12d540['params']['id']}})[_0x9b96('0x15')](handleEntityNotFound(_0x5372bc,null))[_0x9b96('0x15')](function(_0x1e7a18){if(_0x1e7a18){_0x534b4f=_0x1e7a18;_0x5c6e2a['model']=_[_0x9b96('0x2d')](db[_0x9b96('0x49')][_0x9b96('0x20')]);_0x5c6e2a[_0x9b96('0x27')]=_[_0x9b96('0x2d')](_0x12d540[_0x9b96('0x27')]);_0x5c6e2a[_0x9b96('0x2e')]=_['intersection'](_0x5c6e2a['model'],_0x5c6e2a[_0x9b96('0x27')]);_0x45945e[_0x9b96('0x30')]=_['intersection'](_0x5c6e2a['model'],qs[_0x9b96('0x31')](_0x12d540[_0x9b96('0x27')][_0x9b96('0x31')]));_0x45945e['attributes']=_0x45945e[_0x9b96('0x30')][_0x9b96('0x32')]?_0x45945e[_0x9b96('0x30')]:_0x5c6e2a[_0x9b96('0x2c')];_0x45945e[_0x9b96('0x52')]=qs['sort'](_0x12d540['query']['sort']);_0x45945e['where']=qs[_0x9b96('0x2e')](_['pick'](_0x12d540[_0x9b96('0x27')],_0x5c6e2a[_0x9b96('0x2e')]));if(_0x12d540[_0x9b96('0x27')][_0x9b96('0x46')]){_0x45945e['where']=_[_0x9b96('0x34')](_0x45945e[_0x9b96('0x25')],{'$or':_['map'](_0x45945e[_0x9b96('0x30')],function(_0x166c18){var _0x5d3b0c={};_0x5d3b0c[_0x166c18]={'$like':'%'+_0x12d540[_0x9b96('0x27')][_0x9b96('0x46')]+'%'};return _0x5d3b0c;})});}_0x45945e=_['merge']({},_0x45945e,_0x12d540[_0x9b96('0x47')]);return _0x534b4f['getAgents'](_0x45945e);}})['then'](function(_0x160df6){if(_0x160df6){_0x58bfe8=_0x160df6[_0x9b96('0x32')];if(!_0x12d540[_0x9b96('0x27')][_0x9b96('0x42')]('nolimit')){_0x45945e[_0x9b96('0x10')]=qs['limit'](_0x12d540['query'][_0x9b96('0x10')]);_0x45945e[_0x9b96('0xe')]=qs[_0x9b96('0xe')](_0x12d540['query'][_0x9b96('0xe')]);}return _0x534b4f['getAgents'](_0x45945e);}})[_0x9b96('0x15')](function(_0x370604){if(_0x370604){return _0x370604?{'count':_0x58bfe8,'rows':_0x370604}:null;}})[_0x9b96('0x15')](respondWithResult(_0x5372bc,null))[_0x9b96('0x2b')](handleError(_0x5372bc,null));}; \ No newline at end of file +var _0xcd99=['api','../../config/environment','../../mysqldb','defaults','redis','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','params','model','keys','intersection','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','filters','fields','hasOwnProperty','nolimit','sort','WhatsappQueueId','filter','options','User','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','order','pick','addTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','includes','all','union','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs'];(function(_0x3fd7f4,_0x5ddc3b){var _0x14ed1b=function(_0x349d18){while(--_0x349d18){_0x3fd7f4['push'](_0x3fd7f4['shift']());}};_0x14ed1b(++_0x5ddc3b);}(_0xcd99,0xed));var _0x9cd9=function(_0x234614,_0x4d8038){_0x234614=_0x234614-0x0;var _0x39fed1=_0xcd99[_0x234614];return _0x39fed1;};'use strict';var BPromise=require('bluebird');var util=require(_0x9cd9('0x0'));var _=require(_0x9cd9('0x1'));var squel=require(_0x9cd9('0x2'));var Redis=require(_0x9cd9('0x3'));var qs=require(_0x9cd9('0x4'));var logger=require('../../config/logger')(_0x9cd9('0x5'));var config=require(_0x9cd9('0x6'));var db=require(_0x9cd9('0x7'))['db'];config['redis']=_[_0x9cd9('0x8')](config[_0x9cd9('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9cd9('0x9')]));require(_0x9cd9('0xa'))[_0x9cd9('0xb')](socket);function respondWithStatusCode(_0x5896e9,_0x31f2e5){_0x31f2e5=_0x31f2e5||0xcc;return function(_0x1e9205){if(_0x1e9205){return _0x5896e9[_0x9cd9('0xc')](_0x31f2e5);}return _0x5896e9[_0x9cd9('0xd')](_0x31f2e5)[_0x9cd9('0xe')]();};}function respondWithResult(_0x416d44,_0x1b8223){_0x1b8223=_0x1b8223||0xc8;return function(_0x2986e2){if(_0x2986e2){return _0x416d44[_0x9cd9('0xd')](_0x1b8223)['json'](_0x2986e2);}};}function respondWithFilteredResult(_0x154350,_0x2581b0){return function(_0x4e3320){if(_0x4e3320){var _0x5a45a1=typeof _0x2581b0[_0x9cd9('0xf')]===_0x9cd9('0x10')&&typeof _0x2581b0[_0x9cd9('0x11')]===_0x9cd9('0x10');var _0x50ebc9=_0x4e3320[_0x9cd9('0x12')];var _0x2d5d1c=_0x5a45a1?0x0:_0x2581b0[_0x9cd9('0xf')];var _0xd42744=_0x5a45a1?_0x4e3320[_0x9cd9('0x12')]:_0x2581b0[_0x9cd9('0xf')]+_0x2581b0[_0x9cd9('0x11')];var _0x2d91ee;if(_0xd42744>=_0x50ebc9){_0xd42744=_0x50ebc9;_0x2d91ee=0xc8;}else{_0x2d91ee=0xce;}_0x154350[_0x9cd9('0xd')](_0x2d91ee);return _0x154350[_0x9cd9('0x13')]('Content-Range',_0x2d5d1c+'-'+_0xd42744+'/'+_0x50ebc9)[_0x9cd9('0x14')](_0x4e3320);}return null;};}function saveUpdates(_0x1afa9d){return function(_0x24fb9){if(_0x24fb9){return _0x24fb9['update'](_0x1afa9d)[_0x9cd9('0x15')](function(_0x2cea2f){return _0x2cea2f;});}return null;};}function removeEntity(_0x4d7f62){return function(_0x106a0c){if(_0x106a0c){return _0x106a0c['destroy']()['then'](function(){var _0x2728a9=_0x106a0c[_0x9cd9('0x16')]({'plain':!![]});var _0x1002f2=_0x9cd9('0x17');return db[_0x9cd9('0x18')][_0x9cd9('0x19')]({'where':{'type':_0x1002f2,'resourceId':_0x2728a9['id']}})[_0x9cd9('0x15')](function(){return _0x106a0c;});})[_0x9cd9('0x15')](function(){_0x4d7f62[_0x9cd9('0xd')](0xcc)[_0x9cd9('0xe')]();});}};}function handleEntityNotFound(_0x2844e8){return function(_0x2fc576){if(!_0x2fc576){_0x2844e8[_0x9cd9('0xc')](0x194);}return _0x2fc576;};}function handleError(_0x48cd2d,_0x42be00){_0x42be00=_0x42be00||0x1f4;return function(_0x2e8d95){logger[_0x9cd9('0x1a')](_0x2e8d95[_0x9cd9('0x1b')]);if(_0x2e8d95['name']){delete _0x2e8d95['name'];}_0x48cd2d[_0x9cd9('0xd')](_0x42be00)[_0x9cd9('0x1c')](_0x2e8d95);};}exports[_0x9cd9('0x1d')]=function(_0x17c91d,_0x2e3223){var _0x1c11cc={};var _0x340c80={'count':0x0,'rows':[]};var _0x380b21=_[_0x9cd9('0x1e')](db[_0x9cd9('0x1f')][_0x9cd9('0x20')],function(_0x3077c2){return{'name':_0x3077c2[_0x9cd9('0x21')],'type':_0x3077c2[_0x9cd9('0x22')][_0x9cd9('0x23')]};});_0x1c11cc=qs[_0x9cd9('0x24')](_0x380b21,_0x17c91d);var _0x2aa438={'where':_0x1c11cc[_0x9cd9('0x25')]};return db['WhatsappQueue'][_0x9cd9('0x12')](_0x2aa438)['then'](function(_0x10d6be){_0x340c80[_0x9cd9('0x12')]=_0x10d6be;_0x1c11cc[_0x9cd9('0x26')]=qs['include'](_0x17c91d[_0x9cd9('0x27')]);return db['WhatsappQueue'][_0x9cd9('0x28')](_0x1c11cc);})['then'](function(_0x2db647){_0x340c80[_0x9cd9('0x29')]=_0x2db647;return _0x340c80;})[_0x9cd9('0x15')](respondWithFilteredResult(_0x2e3223,_0x1c11cc))[_0x9cd9('0x2a')](handleError(_0x2e3223,null));};exports['show']=function(_0x449440,_0x1587c1){var _0x5c7578={'raw':!![],'where':{'id':_0x449440[_0x9cd9('0x2b')]['id']}},_0xb4e448={};_0xb4e448[_0x9cd9('0x2c')]=_['keys'](db[_0x9cd9('0x1f')][_0x9cd9('0x20')]);_0xb4e448[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x449440['query']);_0xb4e448['filters']=_[_0x9cd9('0x2e')](_0xb4e448[_0x9cd9('0x2c')],_0xb4e448['query']);_0x5c7578[_0x9cd9('0x2f')]=_['intersection'](_0xb4e448[_0x9cd9('0x2c')],qs['fields'](_0x449440[_0x9cd9('0x27')]['fields']));_0x5c7578[_0x9cd9('0x2f')]=_0x5c7578[_0x9cd9('0x2f')][_0x9cd9('0x30')]?_0x5c7578[_0x9cd9('0x2f')]:_0xb4e448[_0x9cd9('0x2c')];if(_0x449440[_0x9cd9('0x27')][_0x9cd9('0x31')]){_0x5c7578[_0x9cd9('0x26')]=[{'all':!![]}];}_0x5c7578=_[_0x9cd9('0x32')]({},_0x5c7578,_0x449440['options']);return db[_0x9cd9('0x1f')][_0x9cd9('0x33')](_0x5c7578)[_0x9cd9('0x15')](handleEntityNotFound(_0x1587c1,null))['then'](respondWithResult(_0x1587c1,null))[_0x9cd9('0x2a')](handleError(_0x1587c1,null));};exports[_0x9cd9('0x34')]=function(_0x261d53,_0x371e75){return db[_0x9cd9('0x1f')][_0x9cd9('0x34')](_0x261d53[_0x9cd9('0x35')],{})[_0x9cd9('0x15')](function(_0x8cafd9){var _0x397a89=_0x261d53[_0x9cd9('0x36')][_0x9cd9('0x16')]({'plain':!![]});if(!_0x397a89)throw new Error(_0x9cd9('0x37'));if(_0x397a89['role']==='user'){var _0x394284=_0x8cafd9[_0x9cd9('0x16')]({'plain':!![]});var _0x150bc0='WhatsappQueues';return db[_0x9cd9('0x38')][_0x9cd9('0x33')]({'where':{'name':_0x150bc0,'userProfileId':_0x397a89['userProfileId']},'raw':!![]})['then'](function(_0x35f7d3){if(_0x35f7d3&&_0x35f7d3[_0x9cd9('0x39')]===0x0){return db[_0x9cd9('0x18')][_0x9cd9('0x34')]({'name':_0x394284[_0x9cd9('0x3a')],'resourceId':_0x394284['id'],'type':_0x35f7d3[_0x9cd9('0x3a')],'sectionId':_0x35f7d3['id']},{})[_0x9cd9('0x15')](function(){return _0x8cafd9;});}else{return _0x8cafd9;}})[_0x9cd9('0x2a')](function(_0x28994e){logger[_0x9cd9('0x1a')](_0x9cd9('0x3b'),_0x28994e);throw _0x28994e;});}return _0x8cafd9;})[_0x9cd9('0x15')](respondWithResult(_0x371e75,0xc9))['catch'](handleError(_0x371e75,null));};exports['update']=function(_0x138284,_0x19c587){if(_0x138284[_0x9cd9('0x35')]['id']){delete _0x138284[_0x9cd9('0x35')]['id'];}return db['WhatsappQueue'][_0x9cd9('0x33')]({'where':{'id':_0x138284['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x19c587,null))[_0x9cd9('0x15')](saveUpdates(_0x138284[_0x9cd9('0x35')],null))[_0x9cd9('0x15')](respondWithResult(_0x19c587,null))[_0x9cd9('0x2a')](handleError(_0x19c587,null));};exports[_0x9cd9('0x19')]=function(_0x2412b2,_0x45dc48){return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x2412b2['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x45dc48,null))[_0x9cd9('0x15')](removeEntity(_0x45dc48,null))[_0x9cd9('0x2a')](handleError(_0x45dc48,null));};exports[_0x9cd9('0x3c')]=function(_0x7bbdbb,_0x1b31d6){return db[_0x9cd9('0x1f')]['describe']()[_0x9cd9('0x15')](respondWithResult(_0x1b31d6,null))[_0x9cd9('0x2a')](handleError(_0x1b31d6,null));};exports[_0x9cd9('0x3d')]=function(_0x5485b6,_0x5950de){var _0x21dc40={'raw':!![],'where':{}},_0x215013={},_0x1d264d;return db['WhatsappQueue'][_0x9cd9('0x3e')]({'where':{'id':_0x5485b6[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x5950de,null))[_0x9cd9('0x15')](function(_0x26f736){if(_0x26f736){_0x1d264d=_0x26f736[_0x9cd9('0x16')]({'plain':!![]});_0x215013[_0x9cd9('0x2c')]=_[_0x9cd9('0x2d')](db[_0x9cd9('0x3f')][_0x9cd9('0x20')]);_0x215013[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x5485b6['query']);_0x215013[_0x9cd9('0x40')]=_['intersection'](_0x215013['model'],_0x215013[_0x9cd9('0x27')]);_0x21dc40[_0x9cd9('0x2f')]=_[_0x9cd9('0x2e')](_0x215013[_0x9cd9('0x2c')],qs[_0x9cd9('0x41')](_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0x41')]));_0x21dc40[_0x9cd9('0x2f')]=_0x21dc40[_0x9cd9('0x2f')][_0x9cd9('0x30')]?_0x21dc40[_0x9cd9('0x2f')]:_0x215013['model'];if(!_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0x42')](_0x9cd9('0x43'))){_0x21dc40[_0x9cd9('0x11')]=qs[_0x9cd9('0x11')](_0x5485b6['query'][_0x9cd9('0x11')]);_0x21dc40['offset']=qs[_0x9cd9('0xf')](_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0xf')]);}_0x21dc40['order']=qs[_0x9cd9('0x44')](_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0x44')]);_0x21dc40[_0x9cd9('0x25')]=qs['filters'](_['pick'](_0x5485b6['query'],_0x215013['filters']));_0x21dc40['where'][_0x9cd9('0x45')]=_0x26f736['id'];if(_0x5485b6[_0x9cd9('0x27')]['filter']){_0x21dc40[_0x9cd9('0x25')]=_['merge'](_0x21dc40[_0x9cd9('0x25')],{'$or':_[_0x9cd9('0x1e')](_0x21dc40[_0x9cd9('0x2f')],function(_0x1227b1){var _0x24dd24={};_0x24dd24[_0x1227b1]={'$like':'%'+_0x5485b6['query'][_0x9cd9('0x46')]+'%'};return _0x24dd24;})});}_0x21dc40=_[_0x9cd9('0x32')]({},_0x21dc40,_0x5485b6[_0x9cd9('0x47')]);return db[_0x9cd9('0x3f')][_0x9cd9('0x28')](_0x21dc40);}})['then'](function(_0x3b7219){if(_0x3b7219){return db[_0x9cd9('0x48')]['findAndCountAll']({'where':{'id':_[_0x9cd9('0x1e')](_0x3b7219,'UserId'),'role':_0x9cd9('0x49')},'attributes':['id',_0x9cd9('0x3a'),_0x9cd9('0x4a'),_0x9cd9('0x4b'),'createdAt']});}})[_0x9cd9('0x15')](function(_0x393b0a){if(_0x393b0a){return{'count':_0x393b0a[_0x9cd9('0x12')],'rows':_[_0x9cd9('0x1e')](_0x393b0a[_0x9cd9('0x29')],function(_0x5162ee){return{'membername':_0x5162ee[_0x9cd9('0x3a')],'UserId':_0x5162ee['id'],'queue_name':_0x1d264d['name'],'WhatsappQueueId':_0x1d264d['id'],'interface':util[_0x9cd9('0x4c')](_0x9cd9('0x4d'),_0x9cd9('0x4e'),_0x5162ee['name']),'penalty':0x0,'paused':_0x5162ee[_0x9cd9('0x4a')],'createdAt':_0x5162ee[_0x9cd9('0x4f')],'updatedAt':_0x5162ee['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9cd9('0x15')](respondWithFilteredResult(_0x5950de,_0x21dc40))['catch'](handleError(_0x5950de,null));};exports[_0x9cd9('0x50')]=function(_0x58dfbb,_0x9eadfa){var _0x532a5a={};var _0x37c286={};var _0x108930;var _0x48666f;return db[_0x9cd9('0x1f')][_0x9cd9('0x3e')]({'where':{'id':_0x58dfbb['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x9eadfa,null))[_0x9cd9('0x15')](function(_0x56bac3){if(_0x56bac3){_0x108930=_0x56bac3;_0x37c286[_0x9cd9('0x2c')]=_[_0x9cd9('0x2d')](db['Team'][_0x9cd9('0x20')]);_0x37c286[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x58dfbb[_0x9cd9('0x27')]);_0x37c286[_0x9cd9('0x40')]=_[_0x9cd9('0x2e')](_0x37c286[_0x9cd9('0x2c')],_0x37c286[_0x9cd9('0x27')]);_0x532a5a[_0x9cd9('0x2f')]=_['intersection'](_0x37c286[_0x9cd9('0x2c')],qs[_0x9cd9('0x41')](_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x41')]));_0x532a5a[_0x9cd9('0x2f')]=_0x532a5a[_0x9cd9('0x2f')][_0x9cd9('0x30')]?_0x532a5a['attributes']:_0x37c286['model'];_0x532a5a[_0x9cd9('0x51')]=qs[_0x9cd9('0x44')](_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x44')]);_0x532a5a[_0x9cd9('0x25')]=qs[_0x9cd9('0x40')](_[_0x9cd9('0x52')](_0x58dfbb[_0x9cd9('0x27')],_0x37c286[_0x9cd9('0x40')]));if(_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x46')]){_0x532a5a[_0x9cd9('0x25')]=_[_0x9cd9('0x32')](_0x532a5a[_0x9cd9('0x25')],{'$or':_[_0x9cd9('0x1e')](_0x532a5a[_0x9cd9('0x2f')],function(_0x4b59de){var _0x66df5a={};_0x66df5a[_0x4b59de]={'$like':'%'+_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x46')]+'%'};return _0x66df5a;})});}_0x532a5a=_[_0x9cd9('0x32')]({},_0x532a5a,_0x58dfbb[_0x9cd9('0x47')]);return _0x108930['getTeams'](_0x532a5a);}})['then'](function(_0x42172f){if(_0x42172f){_0x48666f=_0x42172f[_0x9cd9('0x30')];if(!_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x42')](_0x9cd9('0x43'))){_0x532a5a['limit']=qs['limit'](_0x58dfbb['query'][_0x9cd9('0x11')]);_0x532a5a[_0x9cd9('0xf')]=qs[_0x9cd9('0xf')](_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0xf')]);}return _0x108930['getTeams'](_0x532a5a);}})['then'](function(_0x85714f){if(_0x85714f){return _0x85714f?{'count':_0x48666f,'rows':_0x85714f}:null;}})[_0x9cd9('0x15')](respondWithResult(_0x9eadfa,null))['catch'](handleError(_0x9eadfa,null));};exports[_0x9cd9('0x53')]=function(_0x125120,_0xa92722){var _0x4bba9e=_0x125120[_0x9cd9('0x35')][_0x9cd9('0x54')];return db[_0x9cd9('0x55')][_0x9cd9('0x28')]({'where':{'id':_0x4bba9e},'attributes':['id'],'include':[{'model':db[_0x9cd9('0x48')],'as':_0x9cd9('0x56'),'attributes':['id',_0x9cd9('0x3a'),'online',_0x9cd9('0x57'),_0x9cd9('0x58')],'raw':!![]}]})[_0x9cd9('0x15')](function(_0x1b63ca){if(_0x1b63ca){var _0x279e9f=_[_0x9cd9('0x59')](_0x1b63ca,function(_0x1e4039){var _0x4a6243=_0x1e4039[_0x9cd9('0x16')]({'plain':!![]});return _0x4a6243['Agents'];});return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x125120[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](function(_0x2225fc){return db['sequelize'][_0x9cd9('0x5a')](function(_0x451eda){return _0x2225fc[_0x9cd9('0x53')](_0x4bba9e,{'transaction':_0x451eda})[_0x9cd9('0x15')](function(){return BPromise[_0x9cd9('0x5b')](_0x279e9f,function(_0x2167cc){return db['UserWhatsappQueue'][_0x9cd9('0x5c')]({'where':{'UserId':_0x2167cc['id'],'WhatsappQueueId':_0x125120[_0x9cd9('0x2b')]['id']},'transaction':_0x451eda});});})[_0x9cd9('0x15')](function(){_0x279e9f['forEach'](function(_0x261744){socket['emit'](_0x9cd9('0x5d'),{'UserId':_0x261744['id'],'WhatsappQueueId':_0x2225fc['id']});});});});});}})[_0x9cd9('0x15')](respondWithStatusCode(_0xa92722,null))[_0x9cd9('0x2a')](handleError(_0xa92722,null));};exports[_0x9cd9('0x5e')]=function(_0x5b763e,_0x1729e3){return db[_0x9cd9('0x55')]['findAll']({'where':{'id':_0x5b763e[_0x9cd9('0x27')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9cd9('0x56'),'attributes':['id'],'raw':!![]}]})[_0x9cd9('0x15')](handleEntityNotFound(_0x1729e3,null))[_0x9cd9('0x15')](function(_0x3d2c84){var _0x36b8d5=_['map'](_0x3d2c84,'id');var _0x2246fc=[];var _0x48d8e5=[];var _0x1dc91c=squel[_0x9cd9('0x5f')]();_0x1dc91c[_0x9cd9('0x60')](_0x9cd9('0x61'))[_0x9cd9('0x62')]('team_has_whatsapp_queues','tq')[_0x9cd9('0x63')](_0x9cd9('0x64'),'ut',_0x9cd9('0x65'))[_0x9cd9('0x25')](_0x9cd9('0x66'),_0x5b763e[_0x9cd9('0x2b')]['id']);for(var _0x45510b=0x0;_0x45510b<_0x3d2c84[_0x9cd9('0x30')];_0x45510b+=0x1){let _0x2f4814=_0x3d2c84[_0x45510b];for(var _0x33ddfd=0x0;_0x33ddfd<_0x2f4814[_0x9cd9('0x56')][_0x9cd9('0x30')];_0x33ddfd+=0x1){let _0x317190=_0x2f4814[_0x9cd9('0x56')][_0x33ddfd];var _0x284ceb=_0x1dc91c[_0x9cd9('0x67')]();_0x284ceb['where'](_0x9cd9('0x68'),_0x317190['id']);_0x48d8e5['push'](db[_0x9cd9('0x69')]['query'](_0x284ceb[_0x9cd9('0x6a')](),{'type':db['sequelize']['QueryTypes'][_0x9cd9('0x6b')]})[_0x9cd9('0x15')](function(_0x1609ce){if(_0x1609ce[_0x9cd9('0x30')]===0x1){return _0x317190['id'];}else{var _0x250802=_['every'](_['map'](_0x1609ce,'TeamId'),function(_0x469f09){return _[_0x9cd9('0x6c')](_0x36b8d5,_0x469f09);});if(_0x250802){return _0x317190['id'];}}}));}}return BPromise[_0x9cd9('0x6d')](_0x48d8e5)[_0x9cd9('0x15')](function(_0x2edf1f){_0x2246fc=_(_0x2246fc)[_0x9cd9('0x6e')](_0x2edf1f)['compact']()['value']();return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x5b763e[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](function(_0x182ff6){return db[_0x9cd9('0x69')][_0x9cd9('0x5a')](function(_0x58ab9b){return _0x182ff6['removeTeams'](_0x5b763e[_0x9cd9('0x27')][_0x9cd9('0x54')],{'transaction':_0x58ab9b})[_0x9cd9('0x15')](function(){if(!_[_0x9cd9('0x6f')](_0x2246fc)){return _0x182ff6[_0x9cd9('0x70')](_0x2246fc,{'transaction':_0x58ab9b});}})[_0x9cd9('0x15')](function(){_0x2246fc[_0x9cd9('0x71')](function(_0x3a0996){socket[_0x9cd9('0x72')](_0x9cd9('0x73'),{'UserId':_0x3a0996,'WhatsappQueueId':_0x182ff6['id']});});});});});});})[_0x9cd9('0x15')](respondWithStatusCode(_0x1729e3,null))['catch'](handleError(_0x1729e3,null));};exports[_0x9cd9('0x74')]=function(_0x55843b,_0xe211d7){return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x55843b[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0xe211d7,null))[_0x9cd9('0x15')](function(_0x256b07){if(_0x256b07){return _0x256b07[_0x9cd9('0x74')](_0x55843b[_0x9cd9('0x35')][_0x9cd9('0x54')],_[_0x9cd9('0x75')](_0x55843b[_0x9cd9('0x35')],[_0x9cd9('0x54'),'id'])||{})[_0x9cd9('0x76')](function(_0x18ee96){for(var _0x472fa5=0x0;_0x472fa5<_0x55843b[_0x9cd9('0x35')][_0x9cd9('0x54')][_0x9cd9('0x30')];_0x472fa5+=0x1){socket[_0x9cd9('0x72')](_0x9cd9('0x5d'),{'UserId':Number(_0x55843b[_0x9cd9('0x35')][_0x9cd9('0x54')][_0x472fa5]),'WhatsappQueueId':Number(_0x55843b['params']['id'])});}return _0x18ee96;});}})[_0x9cd9('0x15')](respondWithResult(_0xe211d7,null))['catch'](handleError(_0xe211d7,null));};exports[_0x9cd9('0x70')]=function(_0x5b1d7a,_0x4c4bd2){return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x5b1d7a['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x4c4bd2,null))[_0x9cd9('0x15')](function(_0x3f05a2){if(_0x3f05a2){return _0x3f05a2['removeAgents'](_0x5b1d7a['query'][_0x9cd9('0x54')])[_0x9cd9('0x15')](function(){if(_[_0x9cd9('0x77')](_0x5b1d7a['query'][_0x9cd9('0x54')])){for(var _0xf4d2=0x0;_0xf4d2<_0x5b1d7a[_0x9cd9('0x27')][_0x9cd9('0x54')]['length'];_0xf4d2+=0x1){socket[_0x9cd9('0x72')](_0x9cd9('0x73'),{'UserId':Number(_0x5b1d7a['query'][_0x9cd9('0x54')][_0xf4d2]),'WhatsappQueueId':Number(_0x5b1d7a[_0x9cd9('0x2b')]['id'])});}}else{socket[_0x9cd9('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x5b1d7a[_0x9cd9('0x27')]['ids']),'WhatsappQueueId':Number(_0x5b1d7a[_0x9cd9('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c4bd2,null))[_0x9cd9('0x2a')](handleError(_0x4c4bd2,null));};exports[_0x9cd9('0x78')]=function(_0x33c04d,_0x4010cc){var _0x38fa83={};var _0x1e171e={};var _0x2b9089;var _0xde71ee;return db[_0x9cd9('0x1f')][_0x9cd9('0x3e')]({'where':{'id':_0x33c04d[_0x9cd9('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4010cc,null))['then'](function(_0x3242c5){if(_0x3242c5){_0x2b9089=_0x3242c5;_0x1e171e[_0x9cd9('0x2c')]=_[_0x9cd9('0x2d')](db[_0x9cd9('0x48')][_0x9cd9('0x20')]);_0x1e171e[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x33c04d[_0x9cd9('0x27')]);_0x1e171e[_0x9cd9('0x40')]=_[_0x9cd9('0x2e')](_0x1e171e[_0x9cd9('0x2c')],_0x1e171e[_0x9cd9('0x27')]);_0x38fa83[_0x9cd9('0x2f')]=_[_0x9cd9('0x2e')](_0x1e171e['model'],qs[_0x9cd9('0x41')](_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x41')]));_0x38fa83[_0x9cd9('0x2f')]=_0x38fa83['attributes'][_0x9cd9('0x30')]?_0x38fa83['attributes']:_0x1e171e[_0x9cd9('0x2c')];_0x38fa83['order']=qs['sort'](_0x33c04d[_0x9cd9('0x27')]['sort']);_0x38fa83['where']=qs['filters'](_[_0x9cd9('0x52')](_0x33c04d['query'],_0x1e171e[_0x9cd9('0x40')]));if(_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x46')]){_0x38fa83[_0x9cd9('0x25')]=_[_0x9cd9('0x32')](_0x38fa83[_0x9cd9('0x25')],{'$or':_[_0x9cd9('0x1e')](_0x38fa83[_0x9cd9('0x2f')],function(_0x2c8fc8){var _0x3b8d89={};_0x3b8d89[_0x2c8fc8]={'$like':'%'+_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x46')]+'%'};return _0x3b8d89;})});}_0x38fa83=_[_0x9cd9('0x32')]({},_0x38fa83,_0x33c04d[_0x9cd9('0x47')]);return _0x2b9089[_0x9cd9('0x78')](_0x38fa83);}})[_0x9cd9('0x15')](function(_0x531d92){if(_0x531d92){_0xde71ee=_0x531d92[_0x9cd9('0x30')];if(!_0x33c04d[_0x9cd9('0x27')]['hasOwnProperty'](_0x9cd9('0x43'))){_0x38fa83[_0x9cd9('0x11')]=qs[_0x9cd9('0x11')](_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x11')]);_0x38fa83[_0x9cd9('0xf')]=qs[_0x9cd9('0xf')](_0x33c04d['query'][_0x9cd9('0xf')]);}return _0x2b9089['getAgents'](_0x38fa83);}})['then'](function(_0x55f720){if(_0x55f720){return _0x55f720?{'count':_0xde71ee,'rows':_0x55f720}:null;}})[_0x9cd9('0x15')](respondWithResult(_0x4010cc,null))[_0x9cd9('0x2a')](handleError(_0x4010cc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 698d366..b972652 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 _0x9107=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x266a84,_0x46d603){var _0x40e274=function(_0xd34942){while(--_0xd34942){_0x266a84['push'](_0x266a84['shift']());}};_0x40e274(++_0x46d603);}(_0x9107,0xaa));var _0x7910=function(_0x218012,_0x30830c){_0x218012=_0x218012-0x0;var _0x340628=_0x9107[_0x218012];return _0x340628;};'use strict';var EventEmitter=require(_0x7910('0x0'));var WhatsappQueue=require(_0x7910('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7910('0x2')](0x0);var events={'afterCreate':_0x7910('0x3'),'afterUpdate':_0x7910('0x4'),'afterDestroy':'remove'};function emitEvent(_0x998da1){return function(_0x227035,_0x12bb1a,_0x3e149d){WhatsappQueueEvents[_0x7910('0x5')](_0x998da1+':'+_0x227035['id'],_0x227035);WhatsappQueueEvents[_0x7910('0x5')](_0x998da1,_0x227035);_0x3e149d(null);};}for(var e in events){if(events[_0x7910('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7910('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9624=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x5563ae,_0x50bf6e){var _0x240e37=function(_0x5ce628){while(--_0x5ce628){_0x5563ae['push'](_0x5563ae['shift']());}};_0x240e37(++_0x50bf6e);}(_0x9624,0x19b));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4962('0x0'));var WhatsappQueue=require(_0x4962('0x1'))['db'][_0x4962('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4962('0x3')](0x0);var events={'afterCreate':_0x4962('0x4'),'afterUpdate':_0x4962('0x5'),'afterDestroy':_0x4962('0x6')};function emitEvent(_0x3b39ed){return function(_0x1966cb,_0x2264d7,_0xf0306){WhatsappQueueEvents[_0x4962('0x7')](_0x3b39ed+':'+_0x1966cb['id'],_0x1966cb);WhatsappQueueEvents[_0x4962('0x7')](_0x3b39ed,_0x1966cb);_0xf0306(null);};}for(var e in events){if(events[_0x4962('0x8')](e)){var event=events[e];WhatsappQueue[_0x4962('0x9')](e,emitEvent(event));}}module[_0x4962('0xa')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2cbee31..8547a85 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 _0x6836=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x2166a3,_0x237c50){var _0x260035=function(_0x2dbfa2){while(--_0x2dbfa2){_0x2166a3['push'](_0x2166a3['shift']());}};_0x260035(++_0x237c50);}(_0x6836,0x113));var _0x6683=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6836[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6683('0x0'))(_0x6683('0x1'));var moment=require(_0x6683('0x2'));var BPromise=require(_0x6683('0x3'));var rp=require(_0x6683('0x4'));var fs=require('fs');var path=require(_0x6683('0x5'));var rimraf=require(_0x6683('0x6'));var config=require(_0x6683('0x7'));var attributes=require(_0x6683('0x8'));module[_0x6683('0x9')]=function(_0x3fee01,_0x148423){return _0x3fee01[_0x6683('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9174=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','lodash','util','moment','bluebird'];(function(_0x3b17e0,_0x49ad47){var _0x399b36=function(_0x801169){while(--_0x801169){_0x3b17e0['push'](_0x3b17e0['shift']());}};_0x399b36(++_0x49ad47);}(_0x9174,0x1b4));var _0x4917=function(_0x43b35e,_0x9cc873){_0x43b35e=_0x43b35e-0x0;var _0x4295e1=_0x9174[_0x43b35e];return _0x4295e1;};'use strict';var _=require(_0x4917('0x0'));var util=require(_0x4917('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4917('0x2'));var BPromise=require(_0x4917('0x3'));var rp=require(_0x4917('0x4'));var fs=require('fs');var path=require(_0x4917('0x5'));var rimraf=require(_0x4917('0x6'));var config=require(_0x4917('0x7'));var attributes=require(_0x4917('0x8'));module['exports']=function(_0x413714,_0x12d191){return _0x413714[_0x4917('0x9')](_0x4917('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index a58e909..2480200 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 _0xa285=['request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','then','GetWhatsappQueue','ShowWhatsappQueue','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x4920d4,_0x392d82){var _0x453ee7=function(_0x4304e3){while(--_0x4304e3){_0x4920d4['push'](_0x4920d4['shift']());}};_0x453ee7(++_0x392d82);}(_0xa285,0x91));var _0x5a28=function(_0xbf4b32,_0x6b737d){_0xbf4b32=_0xbf4b32-0x0;var _0x5ebd3a=_0xa285[_0xbf4b32];return _0x5ebd3a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a28('0x0'));var BPromise=require(_0x5a28('0x1'));var rs=require(_0x5a28('0x2'));var fs=require('fs');var Redis=require(_0x5a28('0x3'));var db=require(_0x5a28('0x4'))['db'];var utils=require(_0x5a28('0x5'));var logger=require(_0x5a28('0x6'))(_0x5a28('0x7'));var config=require(_0x5a28('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5a28('0x9')][_0x5a28('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5a28('0xb'),'port':0x18eb});var socket=require(_0x5a28('0xc'))(new Redis(config[_0x5a28('0xd')]));require(_0x5a28('0xe'))[_0x5a28('0xf')](socket);function respondWithRpcPromise(_0x292015,_0x5ca4b0,_0x36d7d9){return new BPromise(function(_0x3dec53,_0x1bd843){return client[_0x5a28('0x10')](_0x292015,_0x36d7d9)['then'](function(_0x32b087){logger[_0x5a28('0x11')](_0x5a28('0x12'),_0x5ca4b0,_0x5a28('0x13'));logger[_0x5a28('0x14')](_0x5a28('0x15'),_0x5ca4b0,'request\x20sent',JSON[_0x5a28('0x16')](_0x32b087));if(_0x32b087[_0x5a28('0x17')]){if(_0x32b087[_0x5a28('0x17')][_0x5a28('0x18')]===0x1f4){logger[_0x5a28('0x17')](_0x5a28('0x12'),_0x5ca4b0,_0x32b087[_0x5a28('0x17')][_0x5a28('0x19')]);return _0x1bd843(_0x32b087[_0x5a28('0x17')][_0x5a28('0x19')]);}logger[_0x5a28('0x17')](_0x5a28('0x12'),_0x5ca4b0,_0x32b087[_0x5a28('0x17')]['message']);return _0x3dec53(_0x32b087['error'][_0x5a28('0x19')]);}else{logger[_0x5a28('0x11')](_0x5a28('0x12'),_0x5ca4b0,'request\x20sent');_0x3dec53(_0x32b087[_0x5a28('0x1a')][_0x5a28('0x19')]);}})[_0x5a28('0x1b')](function(_0x244b4b){logger[_0x5a28('0x17')](_0x5a28('0x12'),_0x5ca4b0,_0x244b4b);_0x1bd843(_0x244b4b);});});}exports['GetWhatsappQueue']=function(_0x54235c){var _0x2b38d5=this;return new Promise(function(_0x598eca,_0x295ce5){return db[_0x5a28('0x1c')][_0x5a28('0x1d')]({'raw':_0x54235c[_0x5a28('0x1e')]?_0x54235c[_0x5a28('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x54235c['options']?_0x54235c[_0x5a28('0x1e')][_0x5a28('0x1f')]||null:null,'attributes':_0x54235c[_0x5a28('0x1e')]?_0x54235c[_0x5a28('0x1e')][_0x5a28('0x20')]||null:null,'limit':_0x54235c[_0x5a28('0x1e')]?_0x54235c[_0x5a28('0x1e')][_0x5a28('0x21')]||null:null,'include':_0x54235c[_0x5a28('0x1e')]?_0x54235c['options'][_0x5a28('0x22')]?_[_0x5a28('0x23')](_0x54235c[_0x5a28('0x1e')][_0x5a28('0x22')],function(_0x2493c1){return{'model':db[_0x2493c1[_0x5a28('0x24')]],'as':_0x2493c1['as'],'attributes':_0x2493c1['attributes'],'include':_0x2493c1[_0x5a28('0x22')]?_['map'](_0x2493c1[_0x5a28('0x22')],function(_0x303d3c){return{'model':db[_0x303d3c[_0x5a28('0x24')]],'as':_0x303d3c['as'],'attributes':_0x303d3c[_0x5a28('0x20')],'include':_0x303d3c[_0x5a28('0x22')]?_[_0x5a28('0x23')](_0x303d3c[_0x5a28('0x22')],function(_0x446c50){return{'model':db[_0x446c50[_0x5a28('0x24')]],'as':_0x446c50['as'],'attributes':_0x446c50[_0x5a28('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5a28('0x25')](function(_0x49acd1){logger['info'](_0x5a28('0x26'),_0x54235c);logger['debug'](_0x5a28('0x26'),_0x54235c,JSON[_0x5a28('0x16')](_0x49acd1));_0x598eca(_0x49acd1);})['catch'](function(_0x350e8b){logger['error']('GetWhatsappQueue',_0x350e8b[_0x5a28('0x19')],_0x54235c);_0x295ce5(_0x2b38d5[_0x5a28('0x17')](0x1f4,_0x350e8b['message']));});});};exports[_0x5a28('0x27')]=function(_0x427f05){var _0x33c391=this;return new Promise(function(_0x3ba32b,_0xe6d968){return db['WhatsappQueue']['find']({'raw':_0x427f05[_0x5a28('0x1e')]?_0x427f05[_0x5a28('0x1e')][_0x5a28('0x28')]===undefined?!![]:![]:!![],'where':_0x427f05[_0x5a28('0x1e')]?_0x427f05['options']['where']||null:null,'attributes':_0x427f05[_0x5a28('0x1e')]?_0x427f05['options'][_0x5a28('0x20')]||null:null,'include':_0x427f05['options']?_0x427f05[_0x5a28('0x1e')][_0x5a28('0x22')]?_['map'](_0x427f05[_0x5a28('0x1e')][_0x5a28('0x22')],function(_0x547856){return{'model':db[_0x547856['model']],'as':_0x547856['as'],'attributes':_0x547856[_0x5a28('0x20')],'include':_0x547856[_0x5a28('0x22')]?_[_0x5a28('0x23')](_0x547856[_0x5a28('0x22')],function(_0x7930e2){return{'model':db[_0x7930e2['model']],'as':_0x7930e2['as'],'attributes':_0x7930e2[_0x5a28('0x20')],'include':_0x7930e2[_0x5a28('0x22')]?_[_0x5a28('0x23')](_0x7930e2[_0x5a28('0x22')],function(_0x4a7014){return{'model':db[_0x4a7014[_0x5a28('0x24')]],'as':_0x4a7014['as'],'attributes':_0x4a7014['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a28('0x25')](function(_0x45f3bb){logger[_0x5a28('0x11')]('ShowWhatsappQueue',_0x427f05);logger['debug'](_0x5a28('0x27'),_0x427f05,JSON[_0x5a28('0x16')](_0x45f3bb));_0x3ba32b(_0x45f3bb);})[_0x5a28('0x1b')](function(_0x3915ee){logger['error']('ShowWhatsappQueue',_0x3915ee[_0x5a28('0x19')],_0x427f05);_0xe6d968(_0x33c391[_0x5a28('0x17')](0x1f4,_0x3915ee[_0x5a28('0x19')]));});});}; \ No newline at end of file +var _0x3204=['code','message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x595d94,_0x42d49e){var _0x4784f4=function(_0x1c5f27){while(--_0x1c5f27){_0x595d94['push'](_0x595d94['shift']());}};_0x4784f4(++_0x42d49e);}(_0x3204,0x1de));var _0x4320=function(_0x9c438c,_0x4de904){_0x9c438c=_0x9c438c-0x0;var _0x49ed42=_0x3204[_0x9c438c];return _0x49ed42;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var moment=require(_0x4320('0x2'));var BPromise=require(_0x4320('0x3'));var rs=require(_0x4320('0x4'));var fs=require('fs');var Redis=require(_0x4320('0x5'));var db=require(_0x4320('0x6'))['db'];var utils=require(_0x4320('0x7'));var logger=require(_0x4320('0x8'))(_0x4320('0x9'));var config=require(_0x4320('0xa'));var jayson=require(_0x4320('0xb'));var client=jayson['client'][_0x4320('0xc')]({'port':0x232a});config[_0x4320('0xd')]=_['defaults'](config['redis'],{'host':_0x4320('0xe'),'port':0x18eb});var socket=require(_0x4320('0xf'))(new Redis(config['redis']));require(_0x4320('0x10'))[_0x4320('0x11')](socket);function respondWithRpcPromise(_0x52e60e,_0x3599b8,_0x1b5cec){return new BPromise(function(_0x442d4c,_0xf21e5f){return client[_0x4320('0x12')](_0x52e60e,_0x1b5cec)[_0x4320('0x13')](function(_0x4d69c2){logger[_0x4320('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3599b8,_0x4320('0x15'));logger[_0x4320('0x16')](_0x4320('0x17'),_0x3599b8,_0x4320('0x15'),JSON[_0x4320('0x18')](_0x4d69c2));if(_0x4d69c2[_0x4320('0x19')]){if(_0x4d69c2['error'][_0x4320('0x1a')]===0x1f4){logger[_0x4320('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x3599b8,_0x4d69c2['error'][_0x4320('0x1b')]);return _0xf21e5f(_0x4d69c2[_0x4320('0x19')]['message']);}logger[_0x4320('0x19')](_0x4320('0x1c'),_0x3599b8,_0x4d69c2['error'][_0x4320('0x1b')]);return _0x442d4c(_0x4d69c2[_0x4320('0x19')][_0x4320('0x1b')]);}else{logger[_0x4320('0x14')](_0x4320('0x1c'),_0x3599b8,_0x4320('0x15'));_0x442d4c(_0x4d69c2[_0x4320('0x1d')][_0x4320('0x1b')]);}})[_0x4320('0x1e')](function(_0x556229){logger['error'](_0x4320('0x1c'),_0x3599b8,_0x556229);_0xf21e5f(_0x556229);});});}exports[_0x4320('0x1f')]=function(_0x19c6e1){var _0x204ecd=this;return new Promise(function(_0xaa449c,_0x5d523f){return db[_0x4320('0x20')][_0x4320('0x21')]({'raw':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x23')]===undefined?!![]:![]:!![],'where':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')]['where']||null:null,'attributes':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x24')]||null:null,'limit':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x25')]||null:null,'include':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x26')]?_['map'](_0x19c6e1[_0x4320('0x22')][_0x4320('0x26')],function(_0x5e3765){return{'model':db[_0x5e3765['model']],'as':_0x5e3765['as'],'attributes':_0x5e3765[_0x4320('0x24')],'include':_0x5e3765['include']?_[_0x4320('0x27')](_0x5e3765['include'],function(_0xdb867){return{'model':db[_0xdb867[_0x4320('0x28')]],'as':_0xdb867['as'],'attributes':_0xdb867[_0x4320('0x24')],'include':_0xdb867[_0x4320('0x26')]?_[_0x4320('0x27')](_0xdb867[_0x4320('0x26')],function(_0x403b03){return{'model':db[_0x403b03['model']],'as':_0x403b03['as'],'attributes':_0x403b03[_0x4320('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4320('0x13')](function(_0x97aec0){logger[_0x4320('0x14')](_0x4320('0x1f'),_0x19c6e1);logger['debug'](_0x4320('0x1f'),_0x19c6e1,JSON['stringify'](_0x97aec0));_0xaa449c(_0x97aec0);})['catch'](function(_0x20ceb0){logger[_0x4320('0x19')](_0x4320('0x1f'),_0x20ceb0[_0x4320('0x1b')],_0x19c6e1);_0x5d523f(_0x204ecd[_0x4320('0x19')](0x1f4,_0x20ceb0[_0x4320('0x1b')]));});});};exports[_0x4320('0x29')]=function(_0x319ad4){var _0x1d6976=this;return new Promise(function(_0xaf02ec,_0x489d04){return db['WhatsappQueue']['find']({'raw':_0x319ad4[_0x4320('0x22')]?_0x319ad4[_0x4320('0x22')][_0x4320('0x23')]===undefined?!![]:![]:!![],'where':_0x319ad4['options']?_0x319ad4['options']['where']||null:null,'attributes':_0x319ad4[_0x4320('0x22')]?_0x319ad4[_0x4320('0x22')]['attributes']||null:null,'include':_0x319ad4[_0x4320('0x22')]?_0x319ad4[_0x4320('0x22')][_0x4320('0x26')]?_[_0x4320('0x27')](_0x319ad4[_0x4320('0x22')][_0x4320('0x26')],function(_0x1e4056){return{'model':db[_0x1e4056[_0x4320('0x28')]],'as':_0x1e4056['as'],'attributes':_0x1e4056[_0x4320('0x24')],'include':_0x1e4056[_0x4320('0x26')]?_[_0x4320('0x27')](_0x1e4056[_0x4320('0x26')],function(_0x529d2a){return{'model':db[_0x529d2a['model']],'as':_0x529d2a['as'],'attributes':_0x529d2a[_0x4320('0x24')],'include':_0x529d2a[_0x4320('0x26')]?_[_0x4320('0x27')](_0x529d2a['include'],function(_0x3ad9be){return{'model':db[_0x3ad9be[_0x4320('0x28')]],'as':_0x3ad9be['as'],'attributes':_0x3ad9be[_0x4320('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4320('0x13')](function(_0x57423d){logger['info'](_0x4320('0x29'),_0x319ad4);logger['debug'](_0x4320('0x29'),_0x319ad4,JSON[_0x4320('0x18')](_0x57423d));_0xaf02ec(_0x57423d);})['catch'](function(_0x52ef21){logger['error']('ShowWhatsappQueue',_0x52ef21[_0x4320('0x1b')],_0x319ad4);_0x489d04(_0x1d6976[_0x4320('0x19')](0x1f4,_0x52ef21['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4663333..8789a7e 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 _0x0669=['remove','update','emit','removeListener','register','length','save'];(function(_0x2ee974,_0x1cceb5){var _0x20c5fb=function(_0xc54e84){while(--_0xc54e84){_0x2ee974['push'](_0x2ee974['shift']());}};_0x20c5fb(++_0x1cceb5);}(_0x0669,0x1db));var _0x9066=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x0669[_0x3f25b2];return _0xd8caeb;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x9066('0x0'),_0x9066('0x1'),_0x9066('0x2')];function createListener(_0x27b33c,_0x5bd6c8){return function(_0x263a71){_0x5bd6c8[_0x9066('0x3')](_0x27b33c,_0x263a71);};}function removeListener(_0x104806,_0x3260fa){return function(){WhatsappQueueEvents[_0x9066('0x4')](_0x104806,_0x3260fa);};}exports[_0x9066('0x5')]=function(_0x5ce9ae){for(var _0x228af3=0x0,_0x20104d=events[_0x9066('0x6')];_0x228af3<_0x20104d;_0x228af3++){var _0x321872=events[_0x228af3];var _0x39f294=createListener('whatsappQueue:'+_0x321872,_0x5ce9ae);WhatsappQueueEvents['on'](_0x321872,_0x39f294);}}; \ No newline at end of file +var _0x94e0=['remove','update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x47207c,_0x542b00){var _0x1fed32=function(_0x4dacb9){while(--_0x4dacb9){_0x47207c['push'](_0x47207c['shift']());}};_0x1fed32(++_0x542b00);}(_0x94e0,0x1e6));var _0x094e=function(_0x408fa7,_0x303486){_0x408fa7=_0x408fa7-0x0;var _0x1bceea=_0x94e0[_0x408fa7];return _0x1bceea;};'use strict';var WhatsappQueueEvents=require(_0x094e('0x0'));var events=[_0x094e('0x1'),_0x094e('0x2'),_0x094e('0x3')];function createListener(_0x3a2197,_0x20f30d){return function(_0x4401b9){_0x20f30d['emit'](_0x3a2197,_0x4401b9);};}function removeListener(_0x28e493,_0x3c1bcf){return function(){WhatsappQueueEvents[_0x094e('0x4')](_0x28e493,_0x3c1bcf);};}exports[_0x094e('0x5')]=function(_0x3f7e8a){for(var _0x1da557=0x0,_0x134568=events[_0x094e('0x6')];_0x1da557<_0x134568;_0x1da557++){var _0x5c1fb1=events[_0x1da557];var _0x9fa110=createListener(_0x094e('0x7')+_0x5c1fb1,_0x3f7e8a);WhatsappQueueEvents['on'](_0x5c1fb1,_0x9fa110);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 972efdf..6de6b7c 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 _0x7816=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x17f403,_0x29c823){var _0x3c1404=function(_0x362255){while(--_0x362255){_0x17f403['push'](_0x17f403['shift']());}};_0x3c1404(++_0x29c823);}(_0x7816,0xba));var _0x6781=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x7816[_0x211632];return _0x5a1da1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6781('0x0'));var timeout=require(_0x6781('0x1'));var express=require(_0x6781('0x2'));var router=express[_0x6781('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6781('0x4'));var interaction=require(_0x6781('0x5'));var config=require(_0x6781('0x6'));var controller=require(_0x6781('0x7'));router[_0x6781('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6781('0x8')](_0x6781('0x9'),auth[_0x6781('0xa')](),controller[_0x6781('0xb')]);router[_0x6781('0x8')](_0x6781('0xc'),auth[_0x6781('0xa')](),controller[_0x6781('0xd')]);router[_0x6781('0xe')]('/',auth[_0x6781('0xa')](),controller['create']);router[_0x6781('0xf')](_0x6781('0xc'),auth[_0x6781('0xa')](),controller['update']);router[_0x6781('0x10')](_0x6781('0xc'),auth[_0x6781('0xa')](),controller[_0x6781('0x11')]);module[_0x6781('0x12')]=router; \ No newline at end of file +var _0xdf96=['create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x2ada6a,_0x49cece){var _0x42b8fa=function(_0x503f4f){while(--_0x503f4f){_0x2ada6a['push'](_0x2ada6a['shift']());}};_0x42b8fa(++_0x49cece);}(_0xdf96,0xfc));var _0x6df9=function(_0x100e6f,_0x268d1d){_0x100e6f=_0x100e6f-0x0;var _0x240425=_0xdf96[_0x100e6f];return _0x240425;};'use strict';var multer=require(_0x6df9('0x0'));var util=require(_0x6df9('0x1'));var path=require('path');var timeout=require(_0x6df9('0x2'));var express=require(_0x6df9('0x3'));var router=express['Router']();var fs_extra=require(_0x6df9('0x4'));var auth=require(_0x6df9('0x5'));var interaction=require(_0x6df9('0x6'));var config=require('../../config/environment');var controller=require(_0x6df9('0x7'));router[_0x6df9('0x8')]('/',auth[_0x6df9('0x9')](),controller[_0x6df9('0xa')]);router['get'](_0x6df9('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6df9('0x8')](_0x6df9('0xc'),auth[_0x6df9('0x9')](),controller['show']);router[_0x6df9('0xd')]('/',auth['isAuthenticated'](),controller[_0x6df9('0xe')]);router[_0x6df9('0xf')](_0x6df9('0xc'),auth[_0x6df9('0x9')](),controller[_0x6df9('0x10')]);router[_0x6df9('0x11')](_0x6df9('0xc'),auth[_0x6df9('0x9')](),controller[_0x6df9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 460041f..010d0e5 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2e24e1,_0x236f0e){var _0x3e949f=function(_0x2d0521){while(--_0x2d0521){_0x2e24e1['push'](_0x2e24e1['shift']());}};_0x3e949f(++_0x236f0e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xb7915c,_0x50cce1){var _0x1f340b=function(_0x1538c6){while(--_0x1538c6){_0xb7915c['push'](_0xb7915c['shift']());}};_0x1f340b(++_0x50cce1);}(_0x7a54,0x106));var _0x47a5=function(_0xa359fb,_0x4b726e){_0xa359fb=_0xa359fb-0x0;var _0x5e1a40=_0x7a54[_0xa359fb];return _0x5e1a40;};'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 a76b02e..7d7b271 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 _0x2547=['order','where','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../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','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2547,0x1cd));var _0x7254=function(_0x848e53,_0x5ac0e2){_0x848e53=_0x848e53-0x0;var _0x58d861=_0x2547[_0x848e53];return _0x58d861;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['WhatsappQueueReport'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['WhatsappQueueReport'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['WhatsappQueueReport'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));};exports['describe']=function(_0x5e66c6,_0x24c532){return db[_0x7254('0x40')][_0x7254('0x49')]()[_0x7254('0x25')](respondWithResult(_0x24c532,null))[_0x7254('0x44')](handleError(_0x24c532,null));}; \ No newline at end of file +var _0x282b=['intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x21e544,_0x4e547a){var _0x185c00=function(_0x19210c){while(--_0x19210c){_0x21e544['push'](_0x21e544['shift']());}};_0x185c00(++_0x4e547a);}(_0x282b,0xec));var _0xb282=function(_0x25b185,_0x48ce87){_0x25b185=_0x25b185-0x0;var _0xed7eee=_0x282b[_0x25b185];return _0xed7eee;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['index']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={},_0x433ad5={},_0x4cee93={'count':0x0,'rows':[]};var _0xfddd2e=_[_0xb282('0x29')](db['WhatsappQueueReport'][_0xb282('0x2a')],function(_0x1e2861){return{'name':_0x1e2861[_0xb282('0x2b')],'type':_0x1e2861[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x433ad5['model']=_[_0xb282('0x29')](_0xfddd2e,'name');_0x433ad5[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1520b1[_0xb282('0x2e')]);_0x433ad5['filters']=_[_0xb282('0x30')](_0x433ad5['model'],_0x433ad5[_0xb282('0x2e')]);_0xe337b8[_0xb282('0x31')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x32')],qs[_0xb282('0x33')](_0x1520b1[_0xb282('0x2e')]['fields']));_0xe337b8[_0xb282('0x31')]=_0xe337b8[_0xb282('0x31')]['length']?_0xe337b8['attributes']:_0x433ad5[_0xb282('0x32')];if(!_0x1520b1[_0xb282('0x2e')][_0xb282('0x34')]('nolimit')){_0xe337b8['limit']=qs['limit'](_0x1520b1[_0xb282('0x2e')][_0xb282('0x1b')]);_0xe337b8[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1520b1[_0xb282('0x2e')][_0xb282('0x19')]);}_0xe337b8[_0xb282('0x35')]=qs['sort'](_0x1520b1[_0xb282('0x2e')]['sort']);_0xe337b8[_0xb282('0x36')]=qs[_0xb282('0x37')](_[_0xb282('0x38')](_0x1520b1['query'],_0x433ad5[_0xb282('0x37')]),_0xfddd2e);if(_0x1520b1['query'][_0xb282('0x39')]){_0xe337b8[_0xb282('0x36')]=_[_0xb282('0x3a')](_0xe337b8[_0xb282('0x36')],{'$or':_['map'](_0xfddd2e,function(_0x5c86bb){if(_0x5c86bb[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x3791fd={};_0x3791fd[_0x5c86bb[_0xb282('0x27')]]={'$like':'%'+_0x1520b1['query'][_0xb282('0x39')]+'%'};return _0x3791fd;}})});}_0xe337b8=_['merge']({},_0xe337b8,_0x1520b1[_0xb282('0x3c')]);var _0x1a1b50={'where':_0xe337b8['where']};return db[_0xb282('0x3d')][_0xb282('0x1c')](_0x1a1b50)[_0xb282('0x23')](function(_0x2c988a){_0x4cee93[_0xb282('0x1c')]=_0x2c988a;if(_0x1520b1[_0xb282('0x2e')][_0xb282('0x3e')]){_0xe337b8[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x3d')][_0xb282('0x40')](_0xe337b8);})[_0xb282('0x23')](function(_0x91fe43){_0x4cee93[_0xb282('0x41')]=_0x91fe43;return _0x4cee93;})[_0xb282('0x23')](respondWithFilteredResult(_0x1fb89f,_0xe337b8))[_0xb282('0x42')](handleError(_0x1fb89f,null));};exports[_0xb282('0x43')]=function(_0x2416a4,_0x7332d2){var _0x573da7={'raw':!![],'where':{'id':_0x2416a4['params']['id']}},_0x310ad1={};_0x310ad1[_0xb282('0x32')]=_[_0xb282('0x2f')](db[_0xb282('0x3d')][_0xb282('0x2a')]);_0x310ad1[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x2416a4['query']);_0x310ad1['filters']=_[_0xb282('0x30')](_0x310ad1['model'],_0x310ad1[_0xb282('0x2e')]);_0x573da7[_0xb282('0x31')]=_['intersection'](_0x310ad1[_0xb282('0x32')],qs[_0xb282('0x33')](_0x2416a4[_0xb282('0x2e')]['fields']));_0x573da7['attributes']=_0x573da7[_0xb282('0x31')]['length']?_0x573da7[_0xb282('0x31')]:_0x310ad1[_0xb282('0x32')];if(_0x2416a4[_0xb282('0x2e')][_0xb282('0x3e')]){_0x573da7[_0xb282('0x3f')]=[{'all':!![]}];}_0x573da7=_[_0xb282('0x3a')]({},_0x573da7,_0x2416a4['options']);return db[_0xb282('0x3d')][_0xb282('0x44')](_0x573da7)[_0xb282('0x23')](handleEntityNotFound(_0x7332d2,null))['then'](respondWithResult(_0x7332d2,null))[_0xb282('0x42')](handleError(_0x7332d2,null));};exports['create']=function(_0x32fc1d,_0x4b0822){return db[_0xb282('0x3d')]['create'](_0x32fc1d['body'],{})['then'](respondWithResult(_0x4b0822,0xc9))[_0xb282('0x42')](handleError(_0x4b0822,null));};exports[_0xb282('0x22')]=function(_0x42d99f,_0x7a5aa4){if(_0x42d99f['body']['id']){delete _0x42d99f['body']['id'];}return db['WhatsappQueueReport'][_0xb282('0x44')]({'where':{'id':_0x42d99f[_0xb282('0x45')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x7a5aa4,null))[_0xb282('0x23')](saveUpdates(_0x42d99f['body'],null))[_0xb282('0x23')](respondWithResult(_0x7a5aa4,null))[_0xb282('0x42')](handleError(_0x7a5aa4,null));};exports['destroy']=function(_0x33bded,_0x9f4d79){return db[_0xb282('0x3d')][_0xb282('0x44')]({'where':{'id':_0x33bded[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f4d79,null))[_0xb282('0x23')](removeEntity(_0x9f4d79,null))[_0xb282('0x42')](handleError(_0x9f4d79,null));};exports[_0xb282('0x46')]=function(_0x22d129,_0x308aa8){return db[_0xb282('0x3d')]['describe']()[_0xb282('0x23')](respondWithResult(_0x308aa8,null))['catch'](handleError(_0x308aa8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c489335..4b73d56 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 _0xc1ea=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0xc1ea,0xad));var _0xac1e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc1ea[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xac1e('0x0'));var logger=require('../../config/logger')(_0xac1e('0x1'));var moment=require(_0xac1e('0x2'));var BPromise=require(_0xac1e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac1e('0x4'));var rimraf=require(_0xac1e('0x5'));var config=require(_0xac1e('0x6'));var attributes=require(_0xac1e('0x7'));module[_0xac1e('0x8')]=function(_0x3311e7,_0x3c6d77){return _0x3311e7[_0xac1e('0x9')](_0xac1e('0xa'),attributes,{'tableName':_0xac1e('0xb'),'paranoid':![],'indexes':[{'name':_0xac1e('0xc'),'fields':[_0xac1e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ad=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x4d8c6b,_0x480bd5){var _0x5ed0a1=function(_0x52d8f3){while(--_0x52d8f3){_0x4d8c6b['push'](_0x4d8c6b['shift']());}};_0x5ed0a1(++_0x480bd5);}(_0xa5ad,0x154));var _0xda5a=function(_0x2184cc,_0x196b48){_0x2184cc=_0x2184cc-0x0;var _0x4e7946=_0xa5ad[_0x2184cc];return _0x4e7946;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda5a('0x0'))('api');var moment=require(_0xda5a('0x1'));var BPromise=require('bluebird');var rp=require(_0xda5a('0x2'));var fs=require('fs');var path=require(_0xda5a('0x3'));var rimraf=require(_0xda5a('0x4'));var config=require(_0xda5a('0x5'));var attributes=require(_0xda5a('0x6'));module[_0xda5a('0x7')]=function(_0x30b42d,_0x31528f){return _0x30b42d[_0xda5a('0x8')](_0xda5a('0x9'),attributes,{'tableName':_0xda5a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xda5a('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 a1be630..50a43f6 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 _0x898b=['WhatsappQueueReport','create','body','options','stringify','update','attributes','limit','UpdateWhatsappQueueReport','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport'];(function(_0x46e9f2,_0xb8c5f9){var _0x2ff437=function(_0x231e71){while(--_0x231e71){_0x46e9f2['push'](_0x46e9f2['shift']());}};_0x2ff437(++_0xb8c5f9);}(_0x898b,0xa9));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb898('0x0'));var util=require(_0xb898('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb898('0x2'));var db=require(_0xb898('0x3'))['db'];var utils=require(_0xb898('0x4'));var logger=require(_0xb898('0x5'))(_0xb898('0x6'));var config=require('../../config/environment');var jayson=require(_0xb898('0x7'));var client=jayson[_0xb898('0x8')][_0xb898('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dcfbb,_0xf75c19,_0x44d5a8){return new BPromise(function(_0x24c680,_0x1e7ce0){return client[_0xb898('0xa')](_0x4dcfbb,_0x44d5a8)[_0xb898('0xb')](function(_0x17b91b){logger[_0xb898('0xc')](_0xb898('0xd'),_0xf75c19,_0xb898('0xe'));logger[_0xb898('0xf')](_0xb898('0x10'),_0xf75c19,'request\x20sent',JSON['stringify'](_0x17b91b));if(_0x17b91b[_0xb898('0x11')]){if(_0x17b91b[_0xb898('0x11')][_0xb898('0x12')]===0x1f4){logger[_0xb898('0x11')](_0xb898('0xd'),_0xf75c19,_0x17b91b['error']['message']);return _0x1e7ce0(_0x17b91b[_0xb898('0x11')]['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xf75c19,_0x17b91b['error'][_0xb898('0x13')]);return _0x24c680(_0x17b91b['error'][_0xb898('0x13')]);}else{logger[_0xb898('0xc')](_0xb898('0xd'),_0xf75c19,_0xb898('0xe'));_0x24c680(_0x17b91b[_0xb898('0x14')]['message']);}})[_0xb898('0x15')](function(_0x4be84f){logger['error'](_0xb898('0xd'),_0xf75c19,_0x4be84f);_0x1e7ce0(_0x4be84f);});});}exports[_0xb898('0x16')]=function(_0x2fed7a){var _0x514c1f=this;return new Promise(function(_0x3554c0,_0x3fe44c){return db[_0xb898('0x17')][_0xb898('0x18')](_0x2fed7a[_0xb898('0x19')],{'raw':_0x2fed7a['options']?_0x2fed7a[_0xb898('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb898('0xb')](function(_0x3cb4e7){logger[_0xb898('0xc')](_0xb898('0x16'),_0x2fed7a);logger[_0xb898('0xf')]('CreateWhatsappQueueReport',_0x2fed7a,JSON[_0xb898('0x1b')](_0x3cb4e7));_0x3554c0(_0x3cb4e7);})['catch'](function(_0xc0031b){logger[_0xb898('0x11')]('CreateWhatsappQueueReport',_0xc0031b['message'],_0x2fed7a);_0x3fe44c(_0x514c1f[_0xb898('0x11')](0x1f4,_0xc0031b[_0xb898('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x10d35e){var _0x8f0391=this;return new Promise(function(_0x31cb0b,_0x367373){return db[_0xb898('0x17')][_0xb898('0x1c')](_0x10d35e[_0xb898('0x19')],{'raw':_0x10d35e[_0xb898('0x1a')]?_0x10d35e[_0xb898('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10d35e[_0xb898('0x1a')]?_0x10d35e[_0xb898('0x1a')]['where']||null:null,'attributes':_0x10d35e[_0xb898('0x1a')]?_0x10d35e[_0xb898('0x1a')][_0xb898('0x1d')]||null:null,'limit':_0x10d35e['options']?_0x10d35e[_0xb898('0x1a')][_0xb898('0x1e')]||null:null})[_0xb898('0xb')](function(_0x368dea){logger[_0xb898('0xc')](_0xb898('0x1f'),_0x10d35e);logger[_0xb898('0xf')](_0xb898('0x1f'),_0x10d35e,JSON['stringify'](_0x368dea));_0x31cb0b(_0x368dea);})[_0xb898('0x15')](function(_0x464d17){logger[_0xb898('0x11')]('UpdateWhatsappQueueReport',_0x464d17['message'],_0x10d35e);_0x367373(_0x8f0391[_0xb898('0x11')](0x1f4,_0x464d17['message']));});});}; \ No newline at end of file +var _0x2de6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateWhatsappQueueReport','create','body','options','raw','then','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','limit','stringify','lodash','util'];(function(_0x562d6a,_0xab7601){var _0x5220f6=function(_0x367d10){while(--_0x367d10){_0x562d6a['push'](_0x562d6a['shift']());}};_0x5220f6(++_0xab7601);}(_0x2de6,0x15c));var _0x62de=function(_0x2c2b72,_0x2d442b){_0x2c2b72=_0x2c2b72-0x0;var _0x2cc253=_0x2de6[_0x2c2b72];return _0x2cc253;};'use strict';var _=require(_0x62de('0x0'));var util=require(_0x62de('0x1'));var moment=require(_0x62de('0x2'));var BPromise=require(_0x62de('0x3'));var rs=require(_0x62de('0x4'));var fs=require('fs');var Redis=require(_0x62de('0x5'));var db=require(_0x62de('0x6'))['db'];var utils=require(_0x62de('0x7'));var logger=require(_0x62de('0x8'))(_0x62de('0x9'));var config=require(_0x62de('0xa'));var jayson=require(_0x62de('0xb'));var client=jayson[_0x62de('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd2da5f,_0x51f98f,_0x20d01d){return new BPromise(function(_0x139619,_0x2526b3){return client[_0x62de('0xd')](_0xd2da5f,_0x20d01d)['then'](function(_0x33bf23){logger[_0x62de('0xe')](_0x62de('0xf'),_0x51f98f,_0x62de('0x10'));logger[_0x62de('0x11')](_0x62de('0x12'),_0x51f98f,'request\x20sent',JSON['stringify'](_0x33bf23));if(_0x33bf23[_0x62de('0x13')]){if(_0x33bf23[_0x62de('0x13')]['code']===0x1f4){logger[_0x62de('0x13')](_0x62de('0xf'),_0x51f98f,_0x33bf23[_0x62de('0x13')][_0x62de('0x14')]);return _0x2526b3(_0x33bf23[_0x62de('0x13')]['message']);}logger['error'](_0x62de('0xf'),_0x51f98f,_0x33bf23['error']['message']);return _0x139619(_0x33bf23[_0x62de('0x13')][_0x62de('0x14')]);}else{logger[_0x62de('0xe')](_0x62de('0xf'),_0x51f98f,_0x62de('0x10'));_0x139619(_0x33bf23[_0x62de('0x15')][_0x62de('0x14')]);}})['catch'](function(_0xbeaaf){logger[_0x62de('0x13')](_0x62de('0xf'),_0x51f98f,_0xbeaaf);_0x2526b3(_0xbeaaf);});});}exports[_0x62de('0x16')]=function(_0x4a3b21){var _0x4068a1=this;return new Promise(function(_0x139387,_0x2c0fd3){return db['WhatsappQueueReport'][_0x62de('0x17')](_0x4a3b21[_0x62de('0x18')],{'raw':_0x4a3b21[_0x62de('0x19')]?_0x4a3b21[_0x62de('0x19')][_0x62de('0x1a')]===undefined?!![]:![]:!![]})[_0x62de('0x1b')](function(_0x16b4d6){logger['info']('CreateWhatsappQueueReport',_0x4a3b21);logger[_0x62de('0x11')](_0x62de('0x16'),_0x4a3b21,JSON['stringify'](_0x16b4d6));_0x139387(_0x16b4d6);})[_0x62de('0x1c')](function(_0x41f780){logger[_0x62de('0x13')](_0x62de('0x16'),_0x41f780[_0x62de('0x14')],_0x4a3b21);_0x2c0fd3(_0x4068a1[_0x62de('0x13')](0x1f4,_0x41f780[_0x62de('0x14')]));});});};exports[_0x62de('0x1d')]=function(_0x9d5e7e){var _0x4f06a0=this;return new Promise(function(_0x2b95c7,_0x535d58){return db[_0x62de('0x1e')]['update'](_0x9d5e7e[_0x62de('0x18')],{'raw':_0x9d5e7e[_0x62de('0x19')]?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9d5e7e[_0x62de('0x19')]?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x1f')]||null:null,'attributes':_0x9d5e7e[_0x62de('0x19')]?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x20')]||null:null,'limit':_0x9d5e7e['options']?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x21')]||null:null})[_0x62de('0x1b')](function(_0x5a47a6){logger[_0x62de('0xe')](_0x62de('0x1d'),_0x9d5e7e);logger[_0x62de('0x11')]('UpdateWhatsappQueueReport',_0x9d5e7e,JSON[_0x62de('0x22')](_0x5a47a6));_0x2b95c7(_0x5a47a6);})[_0x62de('0x1c')](function(_0x317a8b){logger[_0x62de('0x13')](_0x62de('0x1d'),_0x317a8b[_0x62de('0x14')],_0x9d5e7e);_0x535d58(_0x4f06a0[_0x62de('0x13')](0x1f4,_0x317a8b[_0x62de('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 41ade05..8f1f816 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 _0xe077=['post','create','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1fa086,_0xeaf18f){var _0x31e681=function(_0x56a058){while(--_0x56a058){_0x1fa086['push'](_0x1fa086['shift']());}};_0x31e681(++_0xeaf18f);}(_0xe077,0x183));var _0x7e07=function(_0x54fd98,_0x1d96dc){_0x54fd98=_0x54fd98-0x0;var _0x365ccd=_0xe077[_0x54fd98];return _0x365ccd;};'use strict';var multer=require('multer');var util=require(_0x7e07('0x0'));var path=require(_0x7e07('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e07('0x2')]();var fs_extra=require(_0x7e07('0x3'));var auth=require(_0x7e07('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7e07('0x5'));var controller=require(_0x7e07('0x6'));router[_0x7e07('0x7')]('/',auth[_0x7e07('0x8')](),controller[_0x7e07('0x9')]);router[_0x7e07('0x7')](_0x7e07('0xa'),auth[_0x7e07('0x8')](),controller[_0x7e07('0xb')]);router[_0x7e07('0x7')](_0x7e07('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7e07('0xd')]('/',auth[_0x7e07('0x8')](),controller[_0x7e07('0xe')]);router[_0x7e07('0xf')](_0x7e07('0xc'),auth[_0x7e07('0x8')](),controller[_0x7e07('0x10')]);router[_0x7e07('0x11')](_0x7e07('0xc'),auth[_0x7e07('0x8')](),controller[_0x7e07('0x12')]);module[_0x7e07('0x13')]=router; \ No newline at end of file +var _0xfa6a=['show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x4e7334,_0x30576c){var _0x43c5af=function(_0x492d06){while(--_0x492d06){_0x4e7334['push'](_0x4e7334['shift']());}};_0x43c5af(++_0x30576c);}(_0xfa6a,0x1a5));var _0xafa6=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xfa6a[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0xafa6('0x0'));var util=require('util');var path=require(_0xafa6('0x1'));var timeout=require(_0xafa6('0x2'));var express=require(_0xafa6('0x3'));var router=express[_0xafa6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xafa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xafa6('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xafa6('0x7')]('/',auth[_0xafa6('0x8')](),controller['index']);router['get']('/describe',auth[_0xafa6('0x8')](),controller[_0xafa6('0x9')]);router[_0xafa6('0x7')](_0xafa6('0xa'),auth['isAuthenticated'](),controller[_0xafa6('0xb')]);router[_0xafa6('0xc')]('/',auth[_0xafa6('0x8')](),controller[_0xafa6('0xd')]);router[_0xafa6('0xe')](_0xafa6('0xa'),auth[_0xafa6('0x8')](),controller[_0xafa6('0xf')]);router[_0xafa6('0x10')](_0xafa6('0xa'),auth[_0xafa6('0x8')](),controller['destroy']);module[_0xafa6('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 ea80efe..6700482 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 _0x8c50=['DATE','exports','STRING','account','agent','queue'];(function(_0x4cdea0,_0x35e695){var _0x2c9aae=function(_0x91f6b4){while(--_0x91f6b4){_0x4cdea0['push'](_0x4cdea0['shift']());}};_0x2c9aae(++_0x35e695);}(_0x8c50,0xcd));var _0x08c5=function(_0x1139be,_0x484e17){_0x1139be=_0x1139be-0x0;var _0x2d1ec6=_0x8c50[_0x1139be];return _0x2d1ec6;};'use strict';var Sequelize=require('sequelize');module[_0x08c5('0x0')]={'uniqueid':{'type':Sequelize[_0x08c5('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x08c5('0x2'),_0x08c5('0x3'),_0x08c5('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x08c5('0x5')]}}; \ No newline at end of file +var _0xab40=['sequelize','exports','agent','queue','DATE'];(function(_0x4a212b,_0x49b345){var _0x3a4cfc=function(_0x4ebdeb){while(--_0x4ebdeb){_0x4a212b['push'](_0x4a212b['shift']());}};_0x3a4cfc(++_0x49b345);}(_0xab40,0xcd));var _0x0ab4=function(_0x293d78,_0x479abd){_0x293d78=_0x293d78-0x0;var _0x15bd7b=_0xab40[_0x293d78];return _0x15bd7b;};'use strict';var Sequelize=require(_0x0ab4('0x0'));module[_0x0ab4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x0ab4('0x2'),_0x0ab4('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0ab4('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2393239..efb14ee 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 _0x943a=['intersection','model','fields','attributes','length','order','sort','pick','filters','filter','where','merge','options','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','query','keys'];(function(_0x5b6744,_0x49c9c2){var _0x43d97a=function(_0x55633e){while(--_0x55633e){_0x5b6744['push'](_0x5b6744['shift']());}};_0x43d97a(++_0x49c9c2);}(_0x943a,0xa8));var _0xa943=function(_0x4d80a3,_0x1269ce){_0x4d80a3=_0x4d80a3-0x0;var _0xb2b961=_0x943a[_0x4d80a3];return _0xb2b961;};'use strict';var emlformat=require(_0xa943('0x0'));var rimraf=require(_0xa943('0x1'));var zipdir=require(_0xa943('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa943('0x3'));var moment=require(_0xa943('0x4'));var BPromise=require(_0xa943('0x5'));var Mustache=require(_0xa943('0x6'));var util=require(_0xa943('0x7'));var path=require(_0xa943('0x8'));var sox=require('sox');var csv=require(_0xa943('0x9'));var ejs=require(_0xa943('0xa'));var fs=require('fs');var fs_extra=require(_0xa943('0xb'));var _=require(_0xa943('0xc'));var squel=require(_0xa943('0xd'));var crypto=require(_0xa943('0xe'));var jsforce=require(_0xa943('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa943('0x9'));var querystring=require(_0xa943('0x10'));var Papa=require(_0xa943('0x11'));var Redis=require(_0xa943('0x12'));var authService=require(_0xa943('0x13'));var qs=require(_0xa943('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa943('0x15'));var logger=require('../../config/logger')(_0xa943('0x16'));var utils=require(_0xa943('0x17'));var config=require(_0xa943('0x18'));var licenseUtil=require(_0xa943('0x19'));var db=require(_0xa943('0x1a'))['db'];function respondWithStatusCode(_0xb17e95,_0x185410){_0x185410=_0x185410||0xcc;return function(_0x3d6e11){if(_0x3d6e11){return _0xb17e95[_0xa943('0x1b')](_0x185410);}return _0xb17e95[_0xa943('0x1c')](_0x185410)[_0xa943('0x1d')]();};}function respondWithResult(_0x2cb0af,_0x5352b8){_0x5352b8=_0x5352b8||0xc8;return function(_0x398886){if(_0x398886){return _0x2cb0af[_0xa943('0x1c')](_0x5352b8)[_0xa943('0x1e')](_0x398886);}};}function respondWithFilteredResult(_0x569790,_0x3b765e){return function(_0xaebd65){if(_0xaebd65){var _0xaa7b6c=typeof _0x3b765e[_0xa943('0x1f')]===_0xa943('0x20')&&typeof _0x3b765e['limit']===_0xa943('0x20');var _0x8855be=_0xaebd65[_0xa943('0x21')];var _0x15661b=_0xaa7b6c?0x0:_0x3b765e[_0xa943('0x1f')];var _0x14211e=_0xaa7b6c?_0xaebd65[_0xa943('0x21')]:_0x3b765e['offset']+_0x3b765e[_0xa943('0x22')];var _0x426510;if(_0x14211e>=_0x8855be){_0x14211e=_0x8855be;_0x426510=0xc8;}else{_0x426510=0xce;}_0x569790[_0xa943('0x1c')](_0x426510);return _0x569790[_0xa943('0x23')]('Content-Range',_0x15661b+'-'+_0x14211e+'/'+_0x8855be)[_0xa943('0x1e')](_0xaebd65);}return null;};}function patchUpdates(_0x335c53){return function(_0x2e72af){try{jsonpatch[_0xa943('0x24')](_0x2e72af,_0x335c53,!![]);}catch(_0x1c1c19){return BPromise[_0xa943('0x25')](_0x1c1c19);}return _0x2e72af[_0xa943('0x26')]();};}function saveUpdates(_0xbb9b3a,_0x560f37){return function(_0x503b6b){if(_0x503b6b){return _0x503b6b[_0xa943('0x27')](_0xbb9b3a)[_0xa943('0x28')](function(_0x123b57){return _0x123b57;});}return null;};}function removeEntity(_0x35ce35,_0x2349f2){return function(_0x2bfb39){if(_0x2bfb39){return _0x2bfb39['destroy']()['then'](function(){_0x35ce35[_0xa943('0x1c')](0xcc)[_0xa943('0x1d')]();});}};}function handleEntityNotFound(_0x1ec032,_0x1f9ae9){return function(_0x20b9b8){if(!_0x20b9b8){_0x1ec032[_0xa943('0x1b')](0x194);}return _0x20b9b8;};}function handleError(_0x2b1aee,_0x1b11d9){_0x1b11d9=_0x1b11d9||0x1f4;return function(_0x5896c1){logger['error'](_0x5896c1[_0xa943('0x29')]);if(_0x5896c1[_0xa943('0x2a')]){delete _0x5896c1[_0xa943('0x2a')];}_0x2b1aee[_0xa943('0x1c')](_0x1b11d9)[_0xa943('0x2b')](_0x5896c1);};}exports[_0xa943('0x2c')]=function(_0x1d4e66,_0x537efd){var _0x44ae37={},_0x565508={},_0x12872d={'count':0x0,'rows':[]};var _0x145f62=_[_0xa943('0x2d')](db[_0xa943('0x2e')][_0xa943('0x2f')],function(_0x1fe93f){return{'name':_0x1fe93f['fieldName'],'type':_0x1fe93f[_0xa943('0x30')]['key']};});_0x565508['model']=_[_0xa943('0x2d')](_0x145f62,'name');_0x565508[_0xa943('0x31')]=_[_0xa943('0x32')](_0x1d4e66[_0xa943('0x31')]);_0x565508['filters']=_[_0xa943('0x33')](_0x565508['model'],_0x565508[_0xa943('0x31')]);_0x44ae37['attributes']=_[_0xa943('0x33')](_0x565508[_0xa943('0x34')],qs[_0xa943('0x35')](_0x1d4e66['query'][_0xa943('0x35')]));_0x44ae37[_0xa943('0x36')]=_0x44ae37[_0xa943('0x36')][_0xa943('0x37')]?_0x44ae37[_0xa943('0x36')]:_0x565508[_0xa943('0x34')];if(!_0x1d4e66[_0xa943('0x31')]['hasOwnProperty']('nolimit')){_0x44ae37[_0xa943('0x22')]=qs[_0xa943('0x22')](_0x1d4e66[_0xa943('0x31')]['limit']);_0x44ae37[_0xa943('0x1f')]=qs[_0xa943('0x1f')](_0x1d4e66['query'][_0xa943('0x1f')]);}_0x44ae37[_0xa943('0x38')]=qs[_0xa943('0x39')](_0x1d4e66[_0xa943('0x31')]['sort']);_0x44ae37['where']=qs['filters'](_[_0xa943('0x3a')](_0x1d4e66[_0xa943('0x31')],_0x565508[_0xa943('0x3b')]),_0x145f62);if(_0x1d4e66[_0xa943('0x31')][_0xa943('0x3c')]){_0x44ae37[_0xa943('0x3d')]=_[_0xa943('0x3e')](_0x44ae37['where'],{'$or':_[_0xa943('0x2d')](_0x145f62,function(_0x3b5213){if(_0x3b5213[_0xa943('0x30')]!=='VIRTUAL'){var _0x4a5e15={};_0x4a5e15[_0x3b5213[_0xa943('0x2a')]]={'$like':'%'+_0x1d4e66[_0xa943('0x31')][_0xa943('0x3c')]+'%'};return _0x4a5e15;}})});}_0x44ae37=_['merge']({},_0x44ae37,_0x1d4e66[_0xa943('0x3f')]);var _0x1ea0b0={'where':_0x44ae37['where']};return db[_0xa943('0x2e')][_0xa943('0x21')](_0x1ea0b0)[_0xa943('0x28')](function(_0x54ee11){_0x12872d[_0xa943('0x21')]=_0x54ee11;if(_0x1d4e66[_0xa943('0x31')]['includeAll']){_0x44ae37[_0xa943('0x40')]=[{'all':!![]}];}return db[_0xa943('0x2e')]['findAll'](_0x44ae37);})['then'](function(_0x3ad315){_0x12872d[_0xa943('0x41')]=_0x3ad315;return _0x12872d;})[_0xa943('0x28')](respondWithFilteredResult(_0x537efd,_0x44ae37))[_0xa943('0x42')](handleError(_0x537efd,null));};exports[_0xa943('0x43')]=function(_0x4a1791,_0x20fd37){var _0x3ec0ed={'raw':!![],'where':{'id':_0x4a1791['params']['id']}},_0x549df5={};_0x549df5['model']=_['keys'](db[_0xa943('0x2e')]['rawAttributes']);_0x549df5[_0xa943('0x31')]=_[_0xa943('0x32')](_0x4a1791['query']);_0x549df5['filters']=_[_0xa943('0x33')](_0x549df5[_0xa943('0x34')],_0x549df5[_0xa943('0x31')]);_0x3ec0ed[_0xa943('0x36')]=_[_0xa943('0x33')](_0x549df5[_0xa943('0x34')],qs[_0xa943('0x35')](_0x4a1791['query'][_0xa943('0x35')]));_0x3ec0ed[_0xa943('0x36')]=_0x3ec0ed[_0xa943('0x36')][_0xa943('0x37')]?_0x3ec0ed[_0xa943('0x36')]:_0x549df5[_0xa943('0x34')];if(_0x4a1791[_0xa943('0x31')]['includeAll']){_0x3ec0ed[_0xa943('0x40')]=[{'all':!![]}];}_0x3ec0ed=_[_0xa943('0x3e')]({},_0x3ec0ed,_0x4a1791[_0xa943('0x3f')]);return db['WhatsappTransferReport'][_0xa943('0x44')](_0x3ec0ed)['then'](handleEntityNotFound(_0x20fd37,null))[_0xa943('0x28')](respondWithResult(_0x20fd37,null))[_0xa943('0x42')](handleError(_0x20fd37,null));};exports[_0xa943('0x45')]=function(_0x4315e0,_0x3a3593){return db[_0xa943('0x2e')]['create'](_0x4315e0[_0xa943('0x46')],{})[_0xa943('0x28')](respondWithResult(_0x3a3593,0xc9))[_0xa943('0x42')](handleError(_0x3a3593,null));};exports[_0xa943('0x27')]=function(_0x1bfaad,_0x4cf145){if(_0x1bfaad[_0xa943('0x46')]['id']){delete _0x1bfaad[_0xa943('0x46')]['id'];}return db[_0xa943('0x2e')]['find']({'where':{'id':_0x1bfaad['params']['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x4cf145,null))[_0xa943('0x28')](saveUpdates(_0x1bfaad[_0xa943('0x46')],null))[_0xa943('0x28')](respondWithResult(_0x4cf145,null))[_0xa943('0x42')](handleError(_0x4cf145,null));};exports['destroy']=function(_0x47933c,_0x11236f){return db[_0xa943('0x2e')][_0xa943('0x44')]({'where':{'id':_0x47933c[_0xa943('0x47')]['id']}})['then'](handleEntityNotFound(_0x11236f,null))['then'](removeEntity(_0x11236f,null))[_0xa943('0x42')](handleError(_0x11236f,null));};exports[_0xa943('0x48')]=function(_0x3bbdfd,_0x2a39e5){return db[_0xa943('0x2e')][_0xa943('0x48')]()[_0xa943('0x28')](respondWithResult(_0x2a39e5,null))[_0xa943('0x42')](handleError(_0x2a39e5,null));}; \ No newline at end of file +var _0x1409=['offset','limit','undefined','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','send','index','map','WhatsappTransferReport','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','merge','filter','include','findAll','show','params','fields','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1409,0x79));var _0x9140=function(_0x1c37bc,_0x4e75f6){_0x1c37bc=_0x1c37bc-0x0;var _0x121630=_0x1409[_0x1c37bc];return _0x121630;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9140('0x0'));var zipdir=require(_0x9140('0x1'));var jsonpatch=require(_0x9140('0x2'));var rp=require(_0x9140('0x3'));var moment=require(_0x9140('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9140('0x5'));var util=require(_0x9140('0x6'));var path=require(_0x9140('0x7'));var sox=require(_0x9140('0x8'));var csv=require(_0x9140('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9140('0xa'));var _=require(_0x9140('0xb'));var squel=require('squel');var crypto=require(_0x9140('0xc'));var jsforce=require(_0x9140('0xd'));var deskjs=require(_0x9140('0xe'));var toCsv=require(_0x9140('0x9'));var querystring=require('querystring');var Papa=require(_0x9140('0xf'));var Redis=require(_0x9140('0x10'));var authService=require(_0x9140('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9140('0x12'));var hardwareService=require(_0x9140('0x13'));var logger=require(_0x9140('0x14'))(_0x9140('0x15'));var utils=require(_0x9140('0x16'));var config=require(_0x9140('0x17'));var licenseUtil=require(_0x9140('0x18'));var db=require(_0x9140('0x19'))['db'];function respondWithStatusCode(_0x149bc3,_0x4a125c){_0x4a125c=_0x4a125c||0xcc;return function(_0x4d6996){if(_0x4d6996){return _0x149bc3['sendStatus'](_0x4a125c);}return _0x149bc3['status'](_0x4a125c)[_0x9140('0x1a')]();};}function respondWithResult(_0x371912,_0x4dcd3a){_0x4dcd3a=_0x4dcd3a||0xc8;return function(_0xe3e26){if(_0xe3e26){return _0x371912[_0x9140('0x1b')](_0x4dcd3a)[_0x9140('0x1c')](_0xe3e26);}};}function respondWithFilteredResult(_0x4746d9,_0x1d45c0){return function(_0x56bea4){if(_0x56bea4){var _0x56e5b2=typeof _0x1d45c0[_0x9140('0x1d')]==='undefined'&&typeof _0x1d45c0[_0x9140('0x1e')]===_0x9140('0x1f');var _0x21e9c2=_0x56bea4[_0x9140('0x20')];var _0x4102f5=_0x56e5b2?0x0:_0x1d45c0[_0x9140('0x1d')];var _0x628bc8=_0x56e5b2?_0x56bea4[_0x9140('0x20')]:_0x1d45c0['offset']+_0x1d45c0[_0x9140('0x1e')];var _0x54f915;if(_0x628bc8>=_0x21e9c2){_0x628bc8=_0x21e9c2;_0x54f915=0xc8;}else{_0x54f915=0xce;}_0x4746d9[_0x9140('0x1b')](_0x54f915);return _0x4746d9[_0x9140('0x21')](_0x9140('0x22'),_0x4102f5+'-'+_0x628bc8+'/'+_0x21e9c2)['json'](_0x56bea4);}return null;};}function patchUpdates(_0x2b6c76){return function(_0x1cdfb0){try{jsonpatch['apply'](_0x1cdfb0,_0x2b6c76,!![]);}catch(_0x4b5c03){return BPromise['reject'](_0x4b5c03);}return _0x1cdfb0[_0x9140('0x23')]();};}function saveUpdates(_0x10a815,_0x20ce47){return function(_0x2f36f3){if(_0x2f36f3){return _0x2f36f3[_0x9140('0x24')](_0x10a815)['then'](function(_0x3afc3b){return _0x3afc3b;});}return null;};}function removeEntity(_0x10dc94,_0x283e5c){return function(_0x436851){if(_0x436851){return _0x436851[_0x9140('0x25')]()[_0x9140('0x26')](function(){_0x10dc94[_0x9140('0x1b')](0xcc)[_0x9140('0x1a')]();});}};}function handleEntityNotFound(_0x5e7c5e,_0xc589fe){return function(_0x26d5b9){if(!_0x26d5b9){_0x5e7c5e[_0x9140('0x27')](0x194);}return _0x26d5b9;};}function handleError(_0x39ae5d,_0x39455a){_0x39455a=_0x39455a||0x1f4;return function(_0x3a0645){logger[_0x9140('0x28')](_0x3a0645[_0x9140('0x29')]);if(_0x3a0645['name']){delete _0x3a0645['name'];}_0x39ae5d[_0x9140('0x1b')](_0x39455a)[_0x9140('0x2a')](_0x3a0645);};}exports[_0x9140('0x2b')]=function(_0x312748,_0x58b483){var _0x2c255d={},_0xb3ea29={},_0x1cd721={'count':0x0,'rows':[]};var _0x271bd4=_[_0x9140('0x2c')](db[_0x9140('0x2d')][_0x9140('0x2e')],function(_0x425735){return{'name':_0x425735['fieldName'],'type':_0x425735[_0x9140('0x2f')][_0x9140('0x30')]};});_0xb3ea29['model']=_[_0x9140('0x2c')](_0x271bd4,_0x9140('0x31'));_0xb3ea29[_0x9140('0x32')]=_[_0x9140('0x33')](_0x312748['query']);_0xb3ea29[_0x9140('0x34')]=_[_0x9140('0x35')](_0xb3ea29[_0x9140('0x36')],_0xb3ea29[_0x9140('0x32')]);_0x2c255d['attributes']=_[_0x9140('0x35')](_0xb3ea29[_0x9140('0x36')],qs['fields'](_0x312748['query']['fields']));_0x2c255d['attributes']=_0x2c255d[_0x9140('0x37')][_0x9140('0x38')]?_0x2c255d[_0x9140('0x37')]:_0xb3ea29[_0x9140('0x36')];if(!_0x312748[_0x9140('0x32')][_0x9140('0x39')](_0x9140('0x3a'))){_0x2c255d['limit']=qs[_0x9140('0x1e')](_0x312748[_0x9140('0x32')][_0x9140('0x1e')]);_0x2c255d['offset']=qs[_0x9140('0x1d')](_0x312748[_0x9140('0x32')][_0x9140('0x1d')]);}_0x2c255d['order']=qs[_0x9140('0x3b')](_0x312748[_0x9140('0x32')][_0x9140('0x3b')]);_0x2c255d[_0x9140('0x3c')]=qs[_0x9140('0x34')](_['pick'](_0x312748[_0x9140('0x32')],_0xb3ea29[_0x9140('0x34')]),_0x271bd4);if(_0x312748['query']['filter']){_0x2c255d[_0x9140('0x3c')]=_[_0x9140('0x3d')](_0x2c255d[_0x9140('0x3c')],{'$or':_[_0x9140('0x2c')](_0x271bd4,function(_0x598e4a){if(_0x598e4a[_0x9140('0x2f')]!=='VIRTUAL'){var _0x4bb777={};_0x4bb777[_0x598e4a[_0x9140('0x31')]]={'$like':'%'+_0x312748[_0x9140('0x32')][_0x9140('0x3e')]+'%'};return _0x4bb777;}})});}_0x2c255d=_['merge']({},_0x2c255d,_0x312748['options']);var _0x1f3a87={'where':_0x2c255d[_0x9140('0x3c')]};return db['WhatsappTransferReport']['count'](_0x1f3a87)['then'](function(_0x5f08b5){_0x1cd721[_0x9140('0x20')]=_0x5f08b5;if(_0x312748[_0x9140('0x32')]['includeAll']){_0x2c255d[_0x9140('0x3f')]=[{'all':!![]}];}return db[_0x9140('0x2d')][_0x9140('0x40')](_0x2c255d);})[_0x9140('0x26')](function(_0x292fd2){_0x1cd721['rows']=_0x292fd2;return _0x1cd721;})[_0x9140('0x26')](respondWithFilteredResult(_0x58b483,_0x2c255d))['catch'](handleError(_0x58b483,null));};exports[_0x9140('0x41')]=function(_0x2c7f31,_0x5e648b){var _0x572fcb={'raw':!![],'where':{'id':_0x2c7f31[_0x9140('0x42')]['id']}},_0xc13fad={};_0xc13fad[_0x9140('0x36')]=_[_0x9140('0x33')](db['WhatsappTransferReport'][_0x9140('0x2e')]);_0xc13fad['query']=_[_0x9140('0x33')](_0x2c7f31['query']);_0xc13fad[_0x9140('0x34')]=_[_0x9140('0x35')](_0xc13fad[_0x9140('0x36')],_0xc13fad[_0x9140('0x32')]);_0x572fcb[_0x9140('0x37')]=_['intersection'](_0xc13fad[_0x9140('0x36')],qs[_0x9140('0x43')](_0x2c7f31[_0x9140('0x32')][_0x9140('0x43')]));_0x572fcb['attributes']=_0x572fcb[_0x9140('0x37')][_0x9140('0x38')]?_0x572fcb[_0x9140('0x37')]:_0xc13fad[_0x9140('0x36')];if(_0x2c7f31[_0x9140('0x32')][_0x9140('0x44')]){_0x572fcb['include']=[{'all':!![]}];}_0x572fcb=_['merge']({},_0x572fcb,_0x2c7f31[_0x9140('0x45')]);return db[_0x9140('0x2d')][_0x9140('0x46')](_0x572fcb)[_0x9140('0x26')](handleEntityNotFound(_0x5e648b,null))[_0x9140('0x26')](respondWithResult(_0x5e648b,null))[_0x9140('0x47')](handleError(_0x5e648b,null));};exports['create']=function(_0x343b23,_0x5c116a){return db[_0x9140('0x2d')][_0x9140('0x48')](_0x343b23[_0x9140('0x49')],{})['then'](respondWithResult(_0x5c116a,0xc9))[_0x9140('0x47')](handleError(_0x5c116a,null));};exports[_0x9140('0x24')]=function(_0x32f6e8,_0x59ec8a){if(_0x32f6e8[_0x9140('0x49')]['id']){delete _0x32f6e8[_0x9140('0x49')]['id'];}return db[_0x9140('0x2d')][_0x9140('0x46')]({'where':{'id':_0x32f6e8['params']['id']}})[_0x9140('0x26')](handleEntityNotFound(_0x59ec8a,null))[_0x9140('0x26')](saveUpdates(_0x32f6e8['body'],null))[_0x9140('0x26')](respondWithResult(_0x59ec8a,null))[_0x9140('0x47')](handleError(_0x59ec8a,null));};exports[_0x9140('0x25')]=function(_0x58793b,_0x334319){return db[_0x9140('0x2d')][_0x9140('0x46')]({'where':{'id':_0x58793b[_0x9140('0x42')]['id']}})[_0x9140('0x26')](handleEntityNotFound(_0x334319,null))[_0x9140('0x26')](removeEntity(_0x334319,null))[_0x9140('0x47')](handleError(_0x334319,null));};exports[_0x9140('0x4a')]=function(_0x3724cc,_0x3bad42){return db['WhatsappTransferReport']['describe']()[_0x9140('0x26')](respondWithResult(_0x3bad42,null))['catch'](handleError(_0x3bad42,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index b4d8e85..d123703 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 _0x2e99=['exports','define','WhatsappTransferReport','uniqueid','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x406e2c,_0x51b99d){var _0x3c666e=function(_0x3ac04b){while(--_0x3ac04b){_0x406e2c['push'](_0x406e2c['shift']());}};_0x3c666e(++_0x51b99d);}(_0x2e99,0x1d0));var _0x92e9=function(_0x12333b,_0x126d0a){_0x12333b=_0x12333b-0x0;var _0x4bd435=_0x2e99[_0x12333b];return _0x4bd435;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x92e9('0x0'))('api');var moment=require(_0x92e9('0x1'));var BPromise=require('bluebird');var rp=require(_0x92e9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92e9('0x3'));var config=require(_0x92e9('0x4'));var attributes=require(_0x92e9('0x5'));module[_0x92e9('0x6')]=function(_0x556347,_0x46c2d3){return _0x556347[_0x92e9('0x7')](_0x92e9('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x92e9('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ba7=['report_whatsapp_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport'];(function(_0x8b953b,_0x132acf){var _0x1943d5=function(_0xc250b9){while(--_0xc250b9){_0x8b953b['push'](_0x8b953b['shift']());}};_0x1943d5(++_0x132acf);}(_0x6ba7,0xc8));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x76ba('0x0'));var logger=require(_0x76ba('0x1'))('api');var moment=require(_0x76ba('0x2'));var BPromise=require(_0x76ba('0x3'));var rp=require(_0x76ba('0x4'));var fs=require('fs');var path=require(_0x76ba('0x5'));var rimraf=require('rimraf');var config=require(_0x76ba('0x6'));var attributes=require(_0x76ba('0x7'));module['exports']=function(_0x2c327f,_0x1d2e48){return _0x2c327f['define'](_0x76ba('0x8'),attributes,{'tableName':_0x76ba('0x9'),'paranoid':![],'indexes':[{'name':_0x76ba('0xa'),'fields':[_0x76ba('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 b7a1073..ebcc842 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 _0x4fb3=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x4fb3,0x13e));var _0x34fb=function(_0x20c500,_0x1b3291){_0x20c500=_0x20c500-0x0;var _0xd66d7=_0x4fb3[_0x20c500];return _0xd66d7;};'use strict';var _=require(_0x34fb('0x0'));var util=require(_0x34fb('0x1'));var moment=require(_0x34fb('0x2'));var BPromise=require(_0x34fb('0x3'));var rs=require(_0x34fb('0x4'));var fs=require('fs');var Redis=require(_0x34fb('0x5'));var db=require(_0x34fb('0x6'))['db'];var utils=require(_0x34fb('0x7'));var logger=require(_0x34fb('0x8'))(_0x34fb('0x9'));var config=require('../../config/environment');var jayson=require(_0x34fb('0xa'));var client=jayson[_0x34fb('0xb')][_0x34fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ff951,_0x210595,_0x1a5ee9){return new BPromise(function(_0x10e18a,_0x3db3cb){return client[_0x34fb('0xd')](_0x1ff951,_0x1a5ee9)[_0x34fb('0xe')](function(_0x24c9ca){logger[_0x34fb('0xf')](_0x34fb('0x10'),_0x210595,_0x34fb('0x11'));logger[_0x34fb('0x12')](_0x34fb('0x13'),_0x210595,_0x34fb('0x11'),JSON[_0x34fb('0x14')](_0x24c9ca));if(_0x24c9ca[_0x34fb('0x15')]){if(_0x24c9ca[_0x34fb('0x15')][_0x34fb('0x16')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x210595,_0x24c9ca['error'][_0x34fb('0x17')]);return _0x3db3cb(_0x24c9ca[_0x34fb('0x15')][_0x34fb('0x17')]);}logger[_0x34fb('0x15')](_0x34fb('0x10'),_0x210595,_0x24c9ca['error'][_0x34fb('0x17')]);return _0x10e18a(_0x24c9ca[_0x34fb('0x15')][_0x34fb('0x17')]);}else{logger[_0x34fb('0xf')](_0x34fb('0x10'),_0x210595,'request\x20sent');_0x10e18a(_0x24c9ca[_0x34fb('0x18')][_0x34fb('0x17')]);}})[_0x34fb('0x19')](function(_0x25da22){logger[_0x34fb('0x15')](_0x34fb('0x10'),_0x210595,_0x25da22);_0x3db3cb(_0x25da22);});});} \ No newline at end of file +var _0xb8fe=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x21820c,_0x5c0d13){var _0x5ddc95=function(_0x4d394c){while(--_0x4d394c){_0x21820c['push'](_0x21820c['shift']());}};_0x5ddc95(++_0x5c0d13);}(_0xb8fe,0x163));var _0xeb8f=function(_0x370c11,_0x32427f){_0x370c11=_0x370c11-0x0;var _0x42737d=_0xb8fe[_0x370c11];return _0x42737d;};'use strict';var _=require(_0xeb8f('0x0'));var util=require(_0xeb8f('0x1'));var moment=require(_0xeb8f('0x2'));var BPromise=require(_0xeb8f('0x3'));var rs=require(_0xeb8f('0x4'));var fs=require('fs');var Redis=require(_0xeb8f('0x5'));var db=require(_0xeb8f('0x6'))['db'];var utils=require(_0xeb8f('0x7'));var logger=require('../../config/logger')(_0xeb8f('0x8'));var config=require(_0xeb8f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb8f('0xa')][_0xeb8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25fe6d,_0x1086f8,_0x212a79){return new BPromise(function(_0x3cd963,_0x3cc4ba){return client[_0xeb8f('0xc')](_0x25fe6d,_0x212a79)[_0xeb8f('0xd')](function(_0x39be81){logger[_0xeb8f('0xe')](_0xeb8f('0xf'),_0x1086f8,'request\x20sent');logger['debug'](_0xeb8f('0x10'),_0x1086f8,_0xeb8f('0x11'),JSON[_0xeb8f('0x12')](_0x39be81));if(_0x39be81[_0xeb8f('0x13')]){if(_0x39be81[_0xeb8f('0x13')]['code']===0x1f4){logger[_0xeb8f('0x13')](_0xeb8f('0xf'),_0x1086f8,_0x39be81['error'][_0xeb8f('0x14')]);return _0x3cc4ba(_0x39be81['error'][_0xeb8f('0x14')]);}logger[_0xeb8f('0x13')](_0xeb8f('0xf'),_0x1086f8,_0x39be81[_0xeb8f('0x13')][_0xeb8f('0x14')]);return _0x3cd963(_0x39be81['error'][_0xeb8f('0x14')]);}else{logger['info'](_0xeb8f('0xf'),_0x1086f8,'request\x20sent');_0x3cd963(_0x39be81[_0xeb8f('0x15')][_0xeb8f('0x14')]);}})['catch'](function(_0x33e2e3){logger[_0xeb8f('0x13')](_0xeb8f('0xf'),_0x1086f8,_0x33e2e3);_0x3cc4ba(_0x33e2e3);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 493d449..cb2316c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe35c=['Online\x20apps:','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xe35c,0x146));var _0xce35=function(_0x51b936,_0x5b65d1){_0x51b936=_0x51b936-0x0;var _0x2c8f69=_0xe35c[_0x51b936];return _0x2c8f69;};'use strict';var _=require(_0xce35('0x0'));var db=require(_0xce35('0x1'))['db'];var seedDb=require(_0xce35('0x2'));var checkLicense=require(_0xce35('0x3'));var rpc=require(_0xce35('0x4'));var config=require(_0xce35('0x5'));var logger=require('./config/logger')('app');var pm2=require(_0xce35('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xce35('0x7'));var chat=require(_0xce35('0x8'));var whatsapp=require(_0xce35('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xce35('0xa'));function main(){return db[_0xce35('0xb')][_0xce35('0xc')]()[_0xce35('0xd')](function(){if(config['seedDB']){return seedDb[_0xce35('0xe')]();}})['then'](function(){return checkLicense['default']();})[_0xce35('0xd')](function(){return rpc['listen']();})['then'](function(_0x3bd7fc){logger[_0xce35('0xf')](_0x3bd7fc);return chat[_0xce35('0x10')]();})[_0xce35('0xd')](function(){return whatsapp[_0xce35('0x10')]();})['then'](function(){return schedule['start']();})[_0xce35('0xd')](function(){return transcribe[_0xce35('0x10')]();})[_0xce35('0xd')](function(){return provider[_0xce35('0x10')]();})[_0xce35('0xd')](function(_0x548956){logger['info'](_0x548956);return pm2[_0xce35('0x10')](pm2Config);})[_0xce35('0xd')](function(_0x55e36d){var _0x24a331=_0x55e36d[_0xce35('0x11')](function(_0x30fe18){return typeof _0x30fe18[_0xce35('0x12')]===_0xce35('0x13')&&_0x30fe18[_0xce35('0x12')]>=0x0;});if(_0x24a331[_0xce35('0x14')]>0x0){throw new Error(_0x24a331[_0xce35('0x14')]+_0xce35('0x15')+_[_0xce35('0x16')](_0x24a331,function(_0x36812b){return'\x22'+_0x36812b['pm2_env'][_0xce35('0x17')]+'\x22';}));}logger[_0xce35('0xf')](_0xce35('0x18'),_[_0xce35('0x16')](_[_0xce35('0x11')](_0x55e36d,{'status':'online'}),_0xce35('0x17'))[_0xce35('0x19')]());logger[_0xce35('0xf')](_0xce35('0x1a'),_[_0xce35('0x16')](_[_0xce35('0x11')](_0x55e36d,function(_0x18ff68){return _0x18ff68[_0xce35('0x1b')]!=='online';}),_0xce35('0x17'))[_0xce35('0x19')]()||_0xce35('0x1c'));console[_0xce35('0x1d')](_0xce35('0x1e'));})[_0xce35('0x1f')](function(_0x369df0){console[_0xce35('0x1d')](_0xce35('0x20'),_0x369df0);logger[_0xce35('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x369df0);process[_0xce35('0x22')](0x1);});}main(); \ No newline at end of file +var _0x39d9=['./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','online','join','status','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb'];(function(_0x58d198,_0x41bd05){var _0x2101c0=function(_0x14e51c){while(--_0x14e51c){_0x58d198['push'](_0x58d198['shift']());}};_0x2101c0(++_0x41bd05);}(_0x39d9,0x17f));var _0x939d=function(_0x36a08,_0x1fe46a){_0x36a08=_0x36a08-0x0;var _0x38c6bc=_0x39d9[_0x36a08];return _0x38c6bc;};'use strict';var _=require(_0x939d('0x0'));var db=require(_0x939d('0x1'))['db'];var seedDb=require(_0x939d('0x2'));var checkLicense=require(_0x939d('0x3'));var rpc=require(_0x939d('0x4'));var config=require(_0x939d('0x5'));var logger=require(_0x939d('0x6'))(_0x939d('0x7'));var pm2=require('./config/pm2');var pm2Config=require(_0x939d('0x8'));var schedule=require(_0x939d('0x9'));var chat=require(_0x939d('0xa'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x939d('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x939d('0xc')][_0x939d('0xd')]()[_0x939d('0xe')](function(){if(config[_0x939d('0xf')]){return seedDb[_0x939d('0x10')]();}})[_0x939d('0xe')](function(){return checkLicense[_0x939d('0x10')]();})['then'](function(){return rpc['listen']();})[_0x939d('0xe')](function(_0x2efa9e){logger[_0x939d('0x11')](_0x2efa9e);return chat[_0x939d('0x12')]();})[_0x939d('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x939d('0xe')](function(){return transcribe[_0x939d('0x12')]();})[_0x939d('0xe')](function(){return provider['start']();})[_0x939d('0xe')](function(_0x474de8){logger[_0x939d('0x11')](_0x474de8);return pm2[_0x939d('0x12')](pm2Config);})[_0x939d('0xe')](function(_0x2406aa){var _0x3d7db2=_0x2406aa[_0x939d('0x13')](function(_0x1b9d52){return typeof _0x1b9d52['exitCode']==='number'&&_0x1b9d52[_0x939d('0x14')]>=0x0;});if(_0x3d7db2['length']>0x0){throw new Error(_0x3d7db2[_0x939d('0x15')]+_0x939d('0x16')+_['map'](_0x3d7db2,function(_0x6bea18){return'\x22'+_0x6bea18[_0x939d('0x17')][_0x939d('0x18')]+'\x22';}));}logger['info'](_0x939d('0x19'),_[_0x939d('0x1a')](_[_0x939d('0x13')](_0x2406aa,{'status':_0x939d('0x1b')}),_0x939d('0x18'))[_0x939d('0x1c')]());logger['info']('Offline\x20apps:',_[_0x939d('0x1a')](_['filter'](_0x2406aa,function(_0x1034ad){return _0x1034ad[_0x939d('0x1d')]!==_0x939d('0x1b');}),'name')['join']()||_0x939d('0x1e'));console['log']('App\x20Ready!');})['catch'](function(_0x39ce7a){console[_0x939d('0x1f')](_0x939d('0x20'),_0x39ce7a);logger[_0x939d('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x39ce7a);process[_0x939d('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 341a214..5df75b3 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 _0xc085=['authorization','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','split','length','splice','encryptString','join','promisify','sign','secret','randomBytes','toString','hex','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','then','query','forceDownload','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','use','headers','Basic','User','pass','Wrong\x20credentials.','catch','startsWith'];(function(_0x577427,_0x2598b9){var _0x2d4789=function(_0x5bfe81){while(--_0x5bfe81){_0x577427['push'](_0x577427['shift']());}};_0x2d4789(++_0x2598b9);}(_0xc085,0xc2));var _0x5c08=function(_0x360061,_0x2f14e5){_0x360061=_0x360061-0x0;var _0x567662=_0xc085[_0x360061];return _0x567662;};'use strict';var db=require(_0x5c08('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x5c08('0x1'));var licenseUtil=require(_0x5c08('0x2'));var encryptor=require(_0x5c08('0x3'));var _=require(_0x5c08('0x4'));var jwt=require(_0x5c08('0x5'));var expressJwt=require(_0x5c08('0x6'));var compose=require(_0x5c08('0x7'));var basicAuth=require(_0x5c08('0x8'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x5c08('0x9')][_0x5c08('0xa')]});var userAttributes=['id',_0x5c08('0xb'),_0x5c08('0xc'),_0x5c08('0xd'),_0x5c08('0xe'),_0x5c08('0xf'),_0x5c08('0x10'),_0x5c08('0x11'),'md5secret',_0x5c08('0x12'),'chatPause',_0x5c08('0x13'),_0x5c08('0x14'),'smsPause',_0x5c08('0x15'),_0x5c08('0x16'),'showWebBar',_0x5c08('0x17'),_0x5c08('0x18'),_0x5c08('0x19'),_0x5c08('0x1a'),_0x5c08('0x1b'),_0x5c08('0x1c'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x5c08('0x1d'),_0x5c08('0x1e'),_0x5c08('0x1f'),_0x5c08('0x20'),_0x5c08('0x21'),_0x5c08('0x22'),_0x5c08('0x23'),_0x5c08('0x24'),_0x5c08('0x25'),_0x5c08('0x26'),'userProfileId',_0x5c08('0x27'),'settingsEnabled',_0x5c08('0x28'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x5c08('0x29'),_0x5c08('0x2a'),'selectRecallMeCampaign','chatAutoanswer',_0x5c08('0x2b'),_0x5c08('0x2c'),'emailAutoanswerDelay',_0x5c08('0x2d'),_0x5c08('0x2e'),_0x5c08('0x2f'),_0x5c08('0x30'),'faxAutoanswer',_0x5c08('0x31'),'whatsappAutoanswer',_0x5c08('0x32'),_0x5c08('0x33')];exports[_0x5c08('0x34')]=function(){return this[_0x5c08('0x35')](!![])['use'](function(_0x371a1c,_0x255b8f,_0x390fde){if(_0x371a1c[_0x5c08('0x36')]){_0x390fde();}else{return db[_0x5c08('0x37')][_0x5c08('0x38')]({'where':{'id':_0x371a1c[_0x5c08('0x39')]['id']},'attributes':['id',_0x5c08('0x3a'),'disposition'],'raw':!![]})[_0x5c08('0x3b')](function(_0x50d2c3){if(_0x50d2c3&&_0x50d2c3[_0x5c08('0x3a')]&&!_0x371a1c[_0x5c08('0x3c')][_0x5c08('0x3d')]){return _0x255b8f[_0x5c08('0x3e')](_0x50d2c3[_0x5c08('0x3f')]===_0x5c08('0x40')?0x195:0x193)[_0x5c08('0x41')]({'message':_0x50d2c3[_0x5c08('0x3f')]===_0x5c08('0x40')?_0x5c08('0x42'):_0x5c08('0x43')});}else{_0x390fde();}})['catch'](function(_0x3b5991){_0x390fde(_0x3b5991);});}});};exports[_0x5c08('0x35')]=function isAuthenticated(_0x4327f4){return compose()[_0x5c08('0x44')](function(_0x2cda49,_0x3561c8,_0x38c498){var _0xb3d6bc;if(_0x2cda49[_0x5c08('0x45')]['authorization']){if(_['startsWith'](_0x2cda49[_0x5c08('0x45')]['authorization'],_0x5c08('0x46'))){var _0x5eb1b9=basicAuth(_0x2cda49);db[_0x5c08('0x47')]['find']({'where':{'name':_0x5eb1b9[_0x5c08('0xd')]}})[_0x5c08('0x3b')](function(_0x558c76){if(!_0x558c76||!_0x558c76['authenticate'](_0x5eb1b9[_0x5c08('0x48')])){return _0x3561c8[_0x5c08('0x3e')](0x191)[_0x5c08('0x41')]({'message':_0x5c08('0x49')});}_0x2cda49[_0x5c08('0x36')]={'id':_0x558c76['id']};_0x38c498();})[_0x5c08('0x4a')](function(_0x4ea50c){_0x38c498(_0x4ea50c);});}else if(_[_0x5c08('0x4b')](_0x2cda49[_0x5c08('0x45')][_0x5c08('0x4c')],_0x5c08('0x4d'))){validateJwt(_0x2cda49,_0x3561c8,_0x38c498);}else{if(_0x4327f4){_0x38c498();}else{return _0x3561c8[_0x5c08('0x3e')](0x193)[_0x5c08('0x41')]({'message':_0x5c08('0x4e')});}}}else if(_0x2cda49['query'][_0x5c08('0x4f')]){try{var _0x399478={'audience':hardwareConf[_0x5c08('0x50')](),'issuer':hardwareConf[_0x5c08('0x50')]()};verifyJwt(_0x2cda49[_0x5c08('0x3c')][_0x5c08('0x4f')],_0x399478)[_0x5c08('0x3b')](function(_0x48ad99){return db[_0x5c08('0x47')][_0x5c08('0x51')]({'where':{'id':_0x48ad99[_0x5c08('0x52')]}})[_0x5c08('0x3b')](function(_0x4958b3){_0xb3d6bc=_0x4958b3;return db['Setting'][_0x5c08('0x38')]({'where':{'id':0x1},'attributes':[_0x5c08('0x53'),_0x5c08('0x54')],'raw':!![]});})[_0x5c08('0x3b')](function(_0x2c0029){if(!_0xb3d6bc||!_[_0x5c08('0x55')](_0xb3d6bc[_0x5c08('0x56')],_0x48ad99['nonce'])){return _0x3561c8['status'](0x191)[_0x5c08('0x41')]({'message':_0x5c08('0x57')});}if(_0xb3d6bc['disabled']){return _0x3561c8[_0x5c08('0x3e')](0x191)[_0x5c08('0x41')]({'message':_0x5c08('0x58')});}if(_0xb3d6bc[_0x5c08('0x59')]){if(_0x2c0029[_0x5c08('0x54')]>0x0){if(moment(_0xb3d6bc[_0x5c08('0x5a')])[_0x5c08('0x5b')](_0x2c0029[_0x5c08('0x54')],_0x5c08('0x5c'))>moment()){return _0x3561c8[_0x5c08('0x3e')](0x191)['json']({'message':_0x5c08('0x58')});}}else{return _0x3561c8[_0x5c08('0x3e')](0x191)[_0x5c08('0x41')]({'message':_0x5c08('0x58')});}}_0x2cda49[_0x5c08('0x36')]={'id':_0xb3d6bc['id']};_0x38c498();});})[_0x5c08('0x4a')](function(){return _0x3561c8[_0x5c08('0x3e')](0x191)[_0x5c08('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x21e99c){_0x38c498(_0x21e99c);}}else if(_0x4327f4){_0x38c498();}else{return _0x3561c8[_0x5c08('0x3e')](0x193)[_0x5c08('0x41')]({'message':_0x5c08('0x4e')});}})['use'](function(_0x3bded1,_0x5a22f4,_0x332261){if(_0x3bded1[_0x5c08('0x36')]){db['User'][_0x5c08('0x51')]({'where':{'id':_0x3bded1['user']['id']},'attributes':userAttributes})[_0x5c08('0x3b')](function(_0x400d52){if(!_0x400d52){return _0x5a22f4[_0x5c08('0x3e')](0x194)[_0x5c08('0x41')]({'message':'User\x20not\x20found.'});}_0x3bded1[_0x5c08('0x36')]=_0x400d52;_0x332261();})[_0x5c08('0x4a')](function(_0x1f96a8){_0x332261(_0x1f96a8);});}else if(_0x4327f4){_0x332261();}else{return _0x5a22f4[_0x5c08('0x3e')](0x194)['json']({'message':_0x5c08('0x5d')});}});};exports[_0x5c08('0x5e')]=function canUpdate(){return compose()[_0x5c08('0x44')](function(_0x28fadd,_0x136080,_0x53e711){return licenseUtil[_0x5c08('0x5f')]()[_0x5c08('0x3b')](function(_0x9f46d8){if(_0x9f46d8['update']){_0x53e711();}else{return _0x136080['status'](0x193)[_0x5c08('0x41')]({'message':_0x5c08('0x60')});}})['catch'](function(_0x4a0f25){_0x53e711(_0x4a0f25);});});};exports[_0x5c08('0x61')]=function isWebrtcLicence(){return compose()[_0x5c08('0x44')](function(_0x16f391,_0x16e236,_0x17712a){return licenseUtil['getLicense']()[_0x5c08('0x3b')](function(_0x1b69f3){if(_0x1b69f3[_0x5c08('0x62')]){_0x17712a();}else{return _0x16e236[_0x5c08('0x3e')](0x193)[_0x5c08('0x41')]({'message':_0x5c08('0x60')});}})['catch'](function(_0x1cf107){_0x17712a(_0x1cf107);});});};exports[_0x5c08('0x63')]=function(_0xcfc87e,_0xe7415e,_0xf5e9a2){_0xcfc87e[_0x5c08('0x63')]=!![];return _0xf5e9a2();};exports['signToken']=function signToken(_0x3f2a34){return signJwt(_0x3f2a34);};exports[_0x5c08('0x64')]=function(_0x569d41,_0x44259e){if(!_0x569d41[_0x5c08('0x36')]){return _0x44259e[_0x5c08('0x3e')](0x194)[_0x5c08('0x41')]({'message':_0x5c08('0x65')});}var _0x8d8347={'payload':{'id':_0x569d41[_0x5c08('0x36')]['id'],'role':_0x569d41[_0x5c08('0x36')][_0x5c08('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x8d8347)[_0x5c08('0x3b')](function(_0x42153a){_0x44259e[_0x5c08('0x66')](_0x5c08('0x67'),_0x42153a);_0x44259e[_0x5c08('0x68')](_0x5c08('0x69'));})[_0x5c08('0x4a')](function(_0x154699){return _0x44259e['status'](0x1f4)[_0x5c08('0x6a')](_0x154699);});};exports[_0x5c08('0x6b')]=function(_0x2bfac5){if(_[_0x5c08('0x6c')](_0x2bfac5[_0x5c08('0x56')])||_['isNil'](_0x2bfac5[_0x5c08('0x6d')])){return null;}else{return createJwt(_0x2bfac5);}};exports[_0x5c08('0x6e')]=function(_0x1d2867){_0x1d2867[_0x5c08('0x56')]=generateNonce();_0x1d2867['apiKeyIat']=generateIssuedAt();return createJwt(_0x1d2867);};exports[_0x5c08('0x6f')]=function(_0x328985,_0x479acd){var _0xf18d20=_0x328985[_0x5c08('0x3c')][_0x5c08('0x4f')];if(_0xf18d20){var _0x26e5a4={'nonce':_0x479acd['apiKeyNonce'],'iat':_0x479acd[_0x5c08('0x6d')],'audience':hardwareConf[_0x5c08('0x50')](),'issuer':hardwareConf[_0x5c08('0x50')]()};return verifyJwt(_0xf18d20,_0x26e5a4)[_0x5c08('0x3b')](function(){return generateApiKey(_0x479acd);});}else{throw{'message':_0x5c08('0x70')};}};exports[_0x5c08('0x71')]=function(_0x4e6da6){var _0x12fd02=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x12fd02[_0x5c08('0x72')](_0x4e6da6))throw new db[(_0x5c08('0x73'))][(_0x5c08('0x74'))](_0x5c08('0x75'));return;};exports[_0x5c08('0x76')]=function(_0x29dc0c,_0xd4abaf,_0x170621){var _0x2ec02f=encryptor[_0x5c08('0x77')](_0xd4abaf)['split'](',');for(var _0x32581a=0x0;_0x32581a<_0x170621;_0x32581a++){if(!_0x2ec02f[_0x32581a])break;if(_0x29dc0c[_0x5c08('0x78')]()===_0x2ec02f[_0x32581a]['toLowerCase']()){var _0x13b3bf=util[_0x5c08('0x79')](_0x5c08('0x7a'),_0x170621);if(_0x170621===0x1){_0x13b3bf='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x5c08('0x74'))](_0x13b3bf);}}return;};exports['updatePasswordsHistory']=function(_0x54503f,_0x2bda5d){var _0x6c82a1=_0x2bda5d?encryptor[_0x5c08('0x77')](_0x2bda5d)[_0x5c08('0x7b')](','):[];if(_0x6c82a1[_0x5c08('0x7c')]===0x5){_0x6c82a1[_0x5c08('0x7d')](-0x1,0x1);}_0x6c82a1['unshift'](_0x54503f);return encryptor[_0x5c08('0x7e')](_0x6c82a1[_0x5c08('0x7f')](','));};function signJwt(_0x5cb9df){var _0x3ae966=BPromise[_0x5c08('0x80')](jwt[_0x5c08('0x81')],{'context':jwt});var _0x1ada59=_0x5cb9df[_0x5c08('0x82')]||config[_0x5c08('0x9')]['session'];return new BPromise(function(_0x6de268,_0x555b86){_0x3ae966(_0x5cb9df['payload'],_0x1ada59,_0x5cb9df['options'])[_0x5c08('0x3b')](function(_0x2803bc){_0x6de268(_0x2803bc);})[_0x5c08('0x4a')](function(_0x180265){_0x555b86(_0x180265);});});}function verifyJwt(_0x210fb2,_0x19e222,_0x1a811c){var _0x4e9550=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x336bbc=_0x1a811c||config[_0x5c08('0x9')]['session'];return new BPromise(function(_0x2ad007,_0x37bfc7){_0x4e9550(_0x210fb2,_0x336bbc,_0x19e222)[_0x5c08('0x3b')](function(_0x4c6fc6){_0x2ad007(_0x4c6fc6);})[_0x5c08('0x4a')](function(_0x39bf25){_0x37bfc7(_0x39bf25);});});}function generateNonce(){return crypto[_0x5c08('0x83')](0x10)[_0x5c08('0x84')](_0x5c08('0x85'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x5c08('0x84')]();}function createJwt(_0x2dc085){var _0xf1ad06={'payload':{'iat':_0x2dc085['apiKeyIat'],'nonce':_0x2dc085[_0x5c08('0x56')]},'options':{'algorithm':_0x5c08('0x86'),'subject':_0x2dc085['id'][_0x5c08('0x84')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x5c08('0x50')]()}};return signJwt(_0xf1ad06)[_0x5c08('0x3b')](function(_0x34c1cb){return{'iat':_0x2dc085[_0x5c08('0x6d')],'nonce':_0x2dc085[_0x5c08('0x56')],'token':_0x34c1cb};});} \ No newline at end of file +var _0xe309=['isMiddleware','setTokenCookie','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','secret','payload','options','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/license/hardware','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','util','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','query','disposition','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','json','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','Forbidden','getLicense','webrtc'];(function(_0x1dd13a,_0x438646){var _0x42fdc6=function(_0x50b254){while(--_0x50b254){_0x1dd13a['push'](_0x1dd13a['shift']());}};_0x42fdc6(++_0x438646);}(_0xe309,0x133));var _0x9e30=function(_0x5af0cb,_0x3bebc7){_0x5af0cb=_0x5af0cb-0x0;var _0x3367ba=_0xe309[_0x5af0cb];return _0x3367ba;};'use strict';var db=require(_0x9e30('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x9e30('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x9e30('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x9e30('0x3'));var compose=require(_0x9e30('0x4'));var basicAuth=require(_0x9e30('0x5'));var crypto=require(_0x9e30('0x6'));var BPromise=require('bluebird');var util=require(_0x9e30('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x9e30('0x8')][_0x9e30('0x9')]});var userAttributes=['id',_0x9e30('0xa'),_0x9e30('0xb'),_0x9e30('0xc'),_0x9e30('0xd'),'email',_0x9e30('0xe'),_0x9e30('0xf'),_0x9e30('0x10'),_0x9e30('0x11'),'chatPause','mailPause',_0x9e30('0x12'),_0x9e30('0x13'),_0x9e30('0x14'),_0x9e30('0x15'),_0x9e30('0x16'),'lastLoginAt',_0x9e30('0x17'),_0x9e30('0x18'),_0x9e30('0x19'),_0x9e30('0x1a'),_0x9e30('0x1b'),_0x9e30('0x1c'),_0x9e30('0x1d'),_0x9e30('0x1e'),_0x9e30('0x1f'),_0x9e30('0x20'),_0x9e30('0x21'),_0x9e30('0x22'),_0x9e30('0x23'),_0x9e30('0x24'),_0x9e30('0x25'),'hotdesk',_0x9e30('0x26'),_0x9e30('0x27'),'privacyEnabled','settingsEnabled',_0x9e30('0x28'),_0x9e30('0x29'),_0x9e30('0x2a'),_0x9e30('0x2b'),_0x9e30('0x2c'),'selectRecallMeCampaign',_0x9e30('0x2d'),'chatAutoanswerDelay','emailAutoanswer',_0x9e30('0x2e'),_0x9e30('0x2f'),_0x9e30('0x30'),_0x9e30('0x31'),_0x9e30('0x32'),'faxAutoanswer','faxAutoanswerDelay',_0x9e30('0x33'),_0x9e30('0x34'),'messengerSoundNotification'];exports[_0x9e30('0x35')]=function(){return this[_0x9e30('0x36')](!![])[_0x9e30('0x37')](function(_0x59eb0b,_0x5d7530,_0x56cf3f){if(_0x59eb0b['user']){_0x56cf3f();}else{return db[_0x9e30('0x38')][_0x9e30('0x39')]({'where':{'id':_0x59eb0b[_0x9e30('0x3a')]['id']},'attributes':['id',_0x9e30('0x3b'),'disposition'],'raw':!![]})['then'](function(_0x3a94d7){if(_0x3a94d7&&_0x3a94d7[_0x9e30('0x3b')]&&!_0x59eb0b[_0x9e30('0x3c')]['forceDownload']){return _0x5d7530['status'](_0x3a94d7[_0x9e30('0x3d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x3a94d7[_0x9e30('0x3d')]==='unmanaged'?_0x9e30('0x3e'):_0x9e30('0x3f')});}else{_0x56cf3f();}})[_0x9e30('0x40')](function(_0x5a14ce){_0x56cf3f(_0x5a14ce);});}});};exports[_0x9e30('0x36')]=function isAuthenticated(_0xc0ad13){return compose()['use'](function(_0x3e4fbe,_0xc55305,_0x267b9a){var _0x5c924c;if(_0x3e4fbe['headers'][_0x9e30('0x41')]){if(_[_0x9e30('0x42')](_0x3e4fbe[_0x9e30('0x43')]['authorization'],_0x9e30('0x44'))){var _0x15d498=basicAuth(_0x3e4fbe);db[_0x9e30('0x45')][_0x9e30('0x46')]({'where':{'name':_0x15d498['name']}})['then'](function(_0x3a4c0d){if(!_0x3a4c0d||!_0x3a4c0d[_0x9e30('0x47')](_0x15d498[_0x9e30('0x48')])){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x4b')});}_0x3e4fbe[_0x9e30('0x4c')]={'id':_0x3a4c0d['id']};_0x267b9a();})[_0x9e30('0x40')](function(_0x388c01){_0x267b9a(_0x388c01);});}else if(_[_0x9e30('0x42')](_0x3e4fbe[_0x9e30('0x43')][_0x9e30('0x41')],_0x9e30('0x4d'))){validateJwt(_0x3e4fbe,_0xc55305,_0x267b9a);}else{if(_0xc0ad13){_0x267b9a();}else{return _0xc55305['status'](0x193)[_0x9e30('0x4a')]({'message':_0x9e30('0x4e')});}}}else if(_0x3e4fbe[_0x9e30('0x3c')][_0x9e30('0x4f')]){try{var _0x3066b8={'audience':hardwareConf[_0x9e30('0x50')](),'issuer':hardwareConf[_0x9e30('0x50')]()};verifyJwt(_0x3e4fbe[_0x9e30('0x3c')][_0x9e30('0x4f')],_0x3066b8)[_0x9e30('0x51')](function(_0x4b448f){return db['User'][_0x9e30('0x46')]({'where':{'id':_0x4b448f[_0x9e30('0x52')]}})[_0x9e30('0x51')](function(_0x5b8e76){_0x5c924c=_0x5b8e76;return db[_0x9e30('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x9e30('0x54'),_0x9e30('0x55')],'raw':!![]});})[_0x9e30('0x51')](function(_0xe8edaf){if(!_0x5c924c||!_[_0x9e30('0x56')](_0x5c924c[_0x9e30('0x57')],_0x4b448f[_0x9e30('0x58')])){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x59')});}if(_0x5c924c['disabled']){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x5a')});}if(_0x5c924c[_0x9e30('0x5b')]){if(_0xe8edaf[_0x9e30('0x55')]>0x0){if(moment(_0x5c924c[_0x9e30('0x5c')])[_0x9e30('0x5d')](_0xe8edaf[_0x9e30('0x55')],_0x9e30('0x5e'))>moment()){return _0xc55305[_0x9e30('0x49')](0x191)['json']({'message':_0x9e30('0x5a')});}}else{return _0xc55305['status'](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x5a')});}}_0x3e4fbe[_0x9e30('0x4c')]={'id':_0x5c924c['id']};_0x267b9a();});})[_0x9e30('0x40')](function(){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x5a')});});}catch(_0x379684){_0x267b9a(_0x379684);}}else if(_0xc0ad13){_0x267b9a();}else{return _0xc55305[_0x9e30('0x49')](0x193)[_0x9e30('0x4a')]({'message':'Unknown\x20authorization\x20format'});}})[_0x9e30('0x37')](function(_0x16614c,_0x4bd5aa,_0x509153){if(_0x16614c[_0x9e30('0x4c')]){db[_0x9e30('0x45')]['find']({'where':{'id':_0x16614c[_0x9e30('0x4c')]['id']},'attributes':userAttributes})[_0x9e30('0x51')](function(_0x2cdde2){if(!_0x2cdde2){return _0x4bd5aa[_0x9e30('0x49')](0x194)[_0x9e30('0x4a')]({'message':_0x9e30('0x5f')});}_0x16614c[_0x9e30('0x4c')]=_0x2cdde2;_0x509153();})[_0x9e30('0x40')](function(_0x355bea){_0x509153(_0x355bea);});}else if(_0xc0ad13){_0x509153();}else{return _0x4bd5aa[_0x9e30('0x49')](0x194)['json']({'message':_0x9e30('0x60')});}});};exports[_0x9e30('0x61')]=function canUpdate(){return compose()[_0x9e30('0x37')](function(_0x5be67c,_0x416607,_0x24e126){return licenseUtil['getLicense']()[_0x9e30('0x51')](function(_0x39eef0){if(_0x39eef0['update']){_0x24e126();}else{return _0x416607[_0x9e30('0x49')](0x193)[_0x9e30('0x4a')]({'message':_0x9e30('0x62')});}})[_0x9e30('0x40')](function(_0x497782){_0x24e126(_0x497782);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x9e30('0x37')](function(_0x57130b,_0x377d2e,_0x54c61a){return licenseUtil[_0x9e30('0x63')]()['then'](function(_0x193076){if(_0x193076[_0x9e30('0x64')]){_0x54c61a();}else{return _0x377d2e[_0x9e30('0x49')](0x193)[_0x9e30('0x4a')]({'message':_0x9e30('0x62')});}})[_0x9e30('0x40')](function(_0x3a95ee){_0x54c61a(_0x3a95ee);});});};exports[_0x9e30('0x65')]=function(_0x57aebb,_0x486678,_0x268c94){_0x57aebb[_0x9e30('0x65')]=!![];return _0x268c94();};exports['signToken']=function signToken(_0x412faf){return signJwt(_0x412faf);};exports[_0x9e30('0x66')]=function(_0x1d9cc4,_0x41d523){if(!_0x1d9cc4[_0x9e30('0x4c')]){return _0x41d523['status'](0x194)[_0x9e30('0x4a')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x462f6b={'payload':{'id':_0x1d9cc4[_0x9e30('0x4c')]['id'],'role':_0x1d9cc4['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x462f6b)['then'](function(_0x105f19){_0x41d523[_0x9e30('0x67')](_0x9e30('0x68'),_0x105f19);_0x41d523[_0x9e30('0x69')]('/dashboards/general');})['catch'](function(_0x192a6b){return _0x41d523[_0x9e30('0x49')](0x1f4)[_0x9e30('0x6a')](_0x192a6b);});};exports['retrieveApiKey']=function(_0x307870){if(_[_0x9e30('0x6b')](_0x307870['apiKeyNonce'])||_[_0x9e30('0x6b')](_0x307870[_0x9e30('0x6c')])){return null;}else{return createJwt(_0x307870);}};exports[_0x9e30('0x6d')]=function(_0x24a792){_0x24a792[_0x9e30('0x57')]=generateNonce();_0x24a792[_0x9e30('0x6c')]=generateIssuedAt();return createJwt(_0x24a792);};exports[_0x9e30('0x6e')]=function(_0xf5c3dc,_0x31ce60){var _0x5a9a40=_0xf5c3dc[_0x9e30('0x3c')][_0x9e30('0x4f')];if(_0x5a9a40){var _0x34caf7={'nonce':_0x31ce60[_0x9e30('0x57')],'iat':_0x31ce60['apiKeyIat'],'audience':hardwareConf[_0x9e30('0x50')](),'issuer':hardwareConf[_0x9e30('0x50')]()};return verifyJwt(_0x5a9a40,_0x34caf7)[_0x9e30('0x51')](function(){return generateApiKey(_0x31ce60);});}else{throw{'message':_0x9e30('0x6f')};}};exports[_0x9e30('0x70')]=function(_0x561842){var _0x33a45d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x33a45d['test'](_0x561842))throw new db[(_0x9e30('0x71'))][(_0x9e30('0x72'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x9e30('0x73')]=function(_0x158c2e,_0x5de3d3,_0x2ca09f){var _0x39b90e=encryptor[_0x9e30('0x74')](_0x5de3d3)[_0x9e30('0x75')](',');for(var _0x53b38a=0x0;_0x53b38a<_0x2ca09f;_0x53b38a++){if(!_0x39b90e[_0x53b38a])break;if(_0x158c2e['toLowerCase']()===_0x39b90e[_0x53b38a]['toLowerCase']()){var _0x5eece0=util[_0x9e30('0x76')](_0x9e30('0x77'),_0x2ca09f);if(_0x2ca09f===0x1){_0x5eece0=_0x9e30('0x78');}throw new db['Sequelize'][(_0x9e30('0x72'))](_0x5eece0);}}return;};exports[_0x9e30('0x79')]=function(_0x1cff76,_0x135779){var _0x1355e7=_0x135779?encryptor[_0x9e30('0x74')](_0x135779)[_0x9e30('0x75')](','):[];if(_0x1355e7[_0x9e30('0x7a')]===0x5){_0x1355e7[_0x9e30('0x7b')](-0x1,0x1);}_0x1355e7[_0x9e30('0x7c')](_0x1cff76);return encryptor['encryptString'](_0x1355e7[_0x9e30('0x7d')](','));};function signJwt(_0x3f2449){var _0x4d0de8=BPromise[_0x9e30('0x7e')](jwt[_0x9e30('0x7f')],{'context':jwt});var _0x281d1d=_0x3f2449[_0x9e30('0x80')]||config[_0x9e30('0x8')]['session'];return new BPromise(function(_0x56e611,_0x79c914){_0x4d0de8(_0x3f2449[_0x9e30('0x81')],_0x281d1d,_0x3f2449[_0x9e30('0x82')])[_0x9e30('0x51')](function(_0x3e71bf){_0x56e611(_0x3e71bf);})['catch'](function(_0x45d3a7){_0x79c914(_0x45d3a7);});});}function verifyJwt(_0x44295f,_0x4340aa,_0x4f0e5c){var _0x46914a=BPromise[_0x9e30('0x7e')](jwt['verify'],{'context':jwt});var _0x4a2239=_0x4f0e5c||config[_0x9e30('0x8')][_0x9e30('0x9')];return new BPromise(function(_0x3ad7b1,_0x1462e3){_0x46914a(_0x44295f,_0x4a2239,_0x4340aa)['then'](function(_0x5ba911){_0x3ad7b1(_0x5ba911);})['catch'](function(_0x1fc2cd){_0x1462e3(_0x1fc2cd);});});}function generateNonce(){return crypto[_0x9e30('0x83')](0x10)[_0x9e30('0x84')](_0x9e30('0x85'));}function generateIssuedAt(){return Math[_0x9e30('0x86')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x4845cc){var _0x5bf88e={'payload':{'iat':_0x4845cc['apiKeyIat'],'nonce':_0x4845cc['apiKeyNonce']},'options':{'algorithm':_0x9e30('0x87'),'subject':_0x4845cc['id'][_0x9e30('0x84')](),'issuer':hardwareConf[_0x9e30('0x50')](),'audience':hardwareConf[_0x9e30('0x50')]()}};return signJwt(_0x5bf88e)[_0x9e30('0x51')](function(_0x668100){return{'iat':_0x4845cc['apiKeyIat'],'nonce':_0x4845cc[_0x9e30('0x57')],'token':_0x668100};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index fe8771f..4033067 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d8d=['default','fields','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','catch','CmContact','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where'];(function(_0x4fc542,_0x24ba66){var _0x43118c=function(_0x2c4ffe){while(--_0x2c4ffe){_0x4fc542['push'](_0x4fc542['shift']());}};_0x43118c(++_0x24ba66);}(_0x9d8d,0xdf));var _0xd9d8=function(_0x1d982d,_0xfb3a79){_0x1d982d=_0x1d982d-0x0;var _0x2d24ba=_0x9d8d[_0x1d982d];return _0x2d24ba;};'use strict';var _=require(_0xd9d8('0x0'));var sqlUtils=require(_0xd9d8('0x1'));var db=require(_0xd9d8('0x2'))['db'];exports[_0xd9d8('0x3')]=function(_0x54a0b1,_0x100075,_0x2f69b9,_0x446694){var _0x2ca423={'count':0x0,'rows':[]};var _0x590f8c=sqlUtils[_0xd9d8('0x4')](_0x100075,_0x54a0b1);if(_0x590f8c){return Promise[_0xd9d8('0x5')](_0x2ca423);}var _0x3c926a=sqlUtils[_0xd9d8('0x6')]();var _0xbbae23={};var _0x51c3f4=![];var _0x3e8f51=![];return Promise[_0xd9d8('0x5')]()[_0xd9d8('0x7')](function(){if(_0x54a0b1[_0xd9d8('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x54a0b1[_0xd9d8('0x8')],_0x446694);}else{return sqlUtils[_0xd9d8('0x9')](_0x54a0b1,_0x446694);}})[_0xd9d8('0x7')](function(_0x3a723c){_0x3c926a[_0xd9d8('0xa')](_0x3a723c[_0xd9d8('0xb')]);_0x3c926a[_0xd9d8('0xa')](_0x3a723c[_0xd9d8('0xc')]);_0x3c926a[_0xd9d8('0xa')](_0x3a723c['filter']);_0x3c926a[_0xd9d8('0xa')](_0x3a723c[_0xd9d8('0xd')][_0xd9d8('0xe')]);_0xbbae23=_0x3a723c[_0xd9d8('0xf')];_0x3e8f51=_0x3a723c['user'][_0xd9d8('0x10')];return sqlUtils[_0xd9d8('0x11')](_0x100075,_0x54a0b1,_0x3e8f51);})[_0xd9d8('0x7')](function(_0x1e193b){_0x3c926a[_0xd9d8('0xa')](_0x1e193b);var _0x3bae71=_0x54a0b1[_0xd9d8('0x8')]?_0xbbae23[_0xd9d8('0x12')]:_0x54a0b1[_0xd9d8('0x13')];_0x51c3f4=_0x3bae71?!![]:![];return sqlUtils[_0xd9d8('0x14')](_0x3c926a,_0x3bae71);})['then'](function(_0x21dd48){_0x2ca423['count']=_0x21dd48;if(_0x2ca423[_0xd9d8('0x15')]===0x0){return;}if(_0x54a0b1[_0xd9d8('0x16')]){_0x3e8f51=!![];}return sqlUtils[_0xd9d8('0x17')](_0x3c926a,_0x54a0b1[_0xd9d8('0xc')],_0x2f69b9,_0x51c3f4,_0xbbae23[_0xd9d8('0xe')],_0x3e8f51);})[_0xd9d8('0x7')](function(_0x4f80dd){if(!_0x4f80dd){return[];}return sqlUtils['getFilteredContacts'](_0x4f80dd,_0x54a0b1,_0x2f69b9);})[_0xd9d8('0x7')](function(_0x41b677){_0x2ca423[_0xd9d8('0x18')]=_0x41b677;return _0x2ca423;})[_0xd9d8('0x19')](function(_0xde3032){throw _0xde3032;});};exports['describe']=function(){var _0x8b2538={};var _0x39a82e=[];return db[_0xd9d8('0x1a')]['describe']()[_0xd9d8('0x7')](function(_0x49a16f){_0x8b2538=_0x49a16f;var _0xe09252=Object[_0xd9d8('0x1b')](_0x8b2538)[_0xd9d8('0x1c')](function(_0x8e75f3){return _[_0xd9d8('0x1d')](_0x8e75f3,_0xd9d8('0x1e'))?_0x8e75f3:undefined;});var _0x5d7660=_0xe09252[_0xd9d8('0x1f')](function(_0x2c9498){return db[_0xd9d8('0x20')][_0xd9d8('0x21')]({'where':{'id':_0x2c9498[_0xd9d8('0x22')](0x3)},'raw':!![]});});return Promise[_0xd9d8('0x23')](_0x5d7660);})[_0xd9d8('0x7')](function(_0x4493ee){for(var _0x348deb=0x0;_0x348deb<_0x4493ee[_0xd9d8('0x24')];_0x348deb++){if(_0x4493ee[_0x348deb]){var _0x1ea398=_0xd9d8('0x1e')+_0x4493ee[_0x348deb]['id'];_0x8b2538[_0x1ea398][_0xd9d8('0x25')]=_0x4493ee[_0x348deb][_0xd9d8('0x26')];}}_0x39a82e=_['map'](Object[_0xd9d8('0x1b')](_0x8b2538),function(_0x1b28db){return{'name':_0x1b28db,'type':_0x8b2538[_0x1b28db][_0xd9d8('0x26')]};});return _0x39a82e;})[_0xd9d8('0x19')](function(_0x34fa8b){throw _0x34fa8b;});}; \ No newline at end of file +var _0x1df4=['all','fieldType','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','User','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x1df4,0x1bc));var _0x41df=function(_0x18352c,_0x602c26){_0x18352c=_0x18352c-0x0;var _0x1cf925=_0x1df4[_0x18352c];return _0x1cf925;};'use strict';var _=require('lodash');var sqlUtils=require(_0x41df('0x0'));var db=require(_0x41df('0x1'))['db'];exports[_0x41df('0x2')]=function(_0x3c46f6,_0x4a6b86,_0xe22617,_0x30d8b6){var _0x22249e={'count':0x0,'rows':[]};var _0x597b09=sqlUtils['skipContactsQuery'](_0x4a6b86,_0x3c46f6);if(_0x597b09){return Promise[_0x41df('0x3')](_0x22249e);}var _0x4afd5b=sqlUtils[_0x41df('0x4')]();var _0x373d35={};var _0x13669d=![];var _0x4d3817=![];return Promise[_0x41df('0x3')]()['then'](function(){if(_0x3c46f6[_0x41df('0x5')]){return sqlUtils[_0x41df('0x6')](_0x3c46f6[_0x41df('0x5')],_0x30d8b6);}else{return sqlUtils[_0x41df('0x7')](_0x3c46f6,_0x30d8b6);}})[_0x41df('0x8')](function(_0x254e5b){_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xa')]);_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xb')]);_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xc')]);_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xd')][_0x41df('0xe')]);_0x373d35=_0x254e5b[_0x41df('0xf')];_0x4d3817=_0x254e5b[_0x41df('0xd')][_0x41df('0x10')];return sqlUtils[_0x41df('0x11')](_0x4a6b86,_0x3c46f6,_0x4d3817);})[_0x41df('0x8')](function(_0x2095a4){_0x4afd5b[_0x41df('0x9')](_0x2095a4);var _0x26eb91=_0x3c46f6['search']?_0x373d35['ids']:_0x3c46f6[_0x41df('0x12')];_0x13669d=_0x26eb91?!![]:![];return sqlUtils[_0x41df('0x13')](_0x4afd5b,_0x26eb91);})[_0x41df('0x8')](function(_0x2f9ebd){_0x22249e['count']=_0x2f9ebd;if(_0x22249e['count']===0x0){return;}if(_0x3c46f6[_0x41df('0x14')]){_0x4d3817=!![];}return sqlUtils['buildContactsQuery'](_0x4afd5b,_0x3c46f6[_0x41df('0xb')],_0xe22617,_0x13669d,_0x373d35[_0x41df('0xe')],_0x4d3817);})['then'](function(_0x1ccb55){if(!_0x1ccb55){return[];}return sqlUtils[_0x41df('0x15')](_0x1ccb55,_0x3c46f6,_0xe22617);})[_0x41df('0x8')](function(_0x6c9773){_0x22249e[_0x41df('0x16')]=_0x6c9773;return _0x22249e;})[_0x41df('0x17')](function(_0xfb7ac3){throw _0xfb7ac3;});};exports[_0x41df('0x18')]=function(){var _0x4f6018={};var _0x466a0b=[];return db[_0x41df('0x19')][_0x41df('0x18')]()[_0x41df('0x8')](function(_0x3fca95){_0x4f6018=_0x3fca95;var _0x5e369f=Object[_0x41df('0x1a')](_0x4f6018)[_0x41df('0xc')](function(_0x145779){return _[_0x41df('0x1b')](_0x145779,_0x41df('0x1c'))?_0x145779:undefined;});var _0x161b24=_0x5e369f[_0x41df('0x1d')](function(_0x49e8dc){return db[_0x41df('0x1e')][_0x41df('0x1f')]({'where':{'id':_0x49e8dc['slice'](0x3)},'raw':!![]});});return Promise[_0x41df('0x20')](_0x161b24);})[_0x41df('0x8')](function(_0x38395e){for(var _0xffc529=0x0;_0xffc529<_0x38395e['length'];_0xffc529++){if(_0x38395e[_0xffc529]){var _0x247320=_0x41df('0x1c')+_0x38395e[_0xffc529]['id'];_0x4f6018[_0x247320][_0x41df('0x21')]=_0x38395e[_0xffc529]['type'];}}_0x466a0b=_[_0x41df('0x1d')](Object[_0x41df('0x1a')](_0x4f6018),function(_0x57a59f){return{'name':_0x57a59f,'type':_0x4f6018[_0x57a59f]['type']};});return _0x466a0b;})[_0x41df('0x17')](function(_0x482ff8){throw _0x482ff8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 2374691..ea72ffe 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17f3=['../parsers/advancedSearch','../interaction/utils','../../mysqldb','agent','search','ListId','true','from','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','fieldType','castTo','DATE','buildExpression','type','value','start','Tag','map','tags','clause','and','ids','user','uc.UserId\x20=\x20?','skip','keys','name','compact','User','concat','Contact','\x20=\x20?','resolve','then','fields','tag','filter','role','getLists','c.ListId\x20IN\x20?','attributes','select','c.id','limit','offset','group','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','where','t.id\x20IN\x20?','exports','lodash','squel'];(function(_0x23c802,_0xa6d62){var _0x5a39cd=function(_0x2bc0c6){while(--_0x2bc0c6){_0x23c802['push'](_0x23c802['shift']());}};_0x5a39cd(++_0xa6d62);}(_0x17f3,0x1b6));var _0x317f=function(_0xb51511,_0x45ea5e){_0xb51511=_0xb51511-0x0;var _0xe3b183=_0x17f3[_0xb51511];return _0xe3b183;};'use strict';var _=require(_0x317f('0x0'));var squel=require(_0x317f('0x1'));var as=require(_0x317f('0x2'));var qs=require('../parsers/qs');var utils=require(_0x317f('0x3'));var db=require(_0x317f('0x4'))['db'];function skipContactsQuery(_0x120428,_0x1a1f2e){var _0x1f638b=![];if(_0x120428['role']===_0x317f('0x5')&&!_0x1a1f2e[_0x317f('0x6')]&&!_0x1a1f2e[_0x317f('0x7')]&&_0x1a1f2e['autocomplete']!==_0x317f('0x8')){_0x1f638b=!![];}return _0x1f638b;}function getContactsSubquery(){return squel['select']()[_0x317f('0x9')]('cm_contacts','c')['where'](_0x317f('0xa'));}function applyJoinClauses(_0x4c51a9,_0x50af6c){var _0x37bc6a=_0x50af6c?'c':_0x317f('0xb');_0x4c51a9[_0x317f('0xc')](_0x317f('0xd'),'uc',_0x317f('0xe')+_0x37bc6a+'.id')[_0x317f('0xc')](_0x317f('0xf'),'ct',_0x317f('0x10')+_0x37bc6a+_0x317f('0x11'))[_0x317f('0xc')](_0x317f('0x12'),'t',_0x317f('0x13'));return _0x4c51a9;}function addFieldsToQuery(_0x5ad2d7,_0x362a65,_0x5151b9,_0x30faac,_0x41e61a){var _0x51a4ec=_0x41e61a?'c':_0x317f('0xb');if(!_0x362a65){_0x362a65=['id',_0x317f('0x14'),_0x317f('0x15'),_0x317f('0x16'),_0x317f('0x17'),_0x317f('0x18'),'email',_0x317f('0x7'),_0x317f('0x19'),_0x317f('0x1a'),_0x317f('0x1b'),_0x317f('0x1c'),'TagIds'];}else if(!_0x362a65[_0x317f('0x1d')]('id')){_0x362a65[_0x317f('0x1e')]('id');}var _0x34b6b7=_0x5151b9&&_0x41e61a||!_0x5151b9&&!_0x41e61a;if(_0x30faac){_0x34b6b7=_0x30faac&&_0x41e61a||!_0x30faac&&!_0x41e61a;}_0x362a65[_0x317f('0x1f')](function(_0x51fc82){if(_0x51fc82===_0x317f('0x20')){if(_0x34b6b7){_0x5ad2d7[_0x317f('0x21')](_0x317f('0x22'),_0x51fc82);}else if(_0x5151b9||_0x30faac){_0x5ad2d7[_0x317f('0x21')](_0x51a4ec+'.'+_0x51fc82);}}else{_0x5ad2d7[_0x317f('0x21')](_0x51a4ec+'.'+_0x51fc82);}});return _0x5ad2d7;}function getSqlClauses(){var _0x43aaa9={'default':squel[_0x317f('0x23')](),'fields':squel[_0x317f('0x23')](),'filter':squel[_0x317f('0x23')](),'tags':{'clause':squel[_0x317f('0x23')](),'ids':null},'user':{'clause':squel[_0x317f('0x23')](),'skip':![]}};return _0x43aaa9;}function parseTagParameter(_0x452665){var _0x1f4a40=squel['expr']();if(_0x452665){var _0x54c0bd=utils['getSelectedTags'](_0x452665);_0x54c0bd[_0x317f('0x1f')](function(_0xad6b01){_0x1f4a40['or'](_0x317f('0x24'),'%,'+_0xad6b01+',%');});}return _0x1f4a40;}function parseSearchFilter(_0x2a2e55){var _0x26ffb7=squel[_0x317f('0x23')]();if(_0x2a2e55){var _0x1a2b30=_0x2a2e55['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1a2b30[_0x317f('0x25')]('\x20')[_0x317f('0x26')]>0x1){_0x26ffb7['or'](_0x317f('0x27'),qs['getFullTextValue'](_0x1a2b30,!![]),null);}else{if(qs['isNumeric'](_0x1a2b30)){_0x26ffb7['or'](_0x317f('0x28'),_0x1a2b30+'%');_0x26ffb7['or'](_0x317f('0x29'),_0x1a2b30+'%');_0x26ffb7['or'](_0x317f('0x2a'),_0x1a2b30+'%');_0x26ffb7['or'](_0x317f('0x2b'),_0x1a2b30+'%');}else if(qs[_0x317f('0x2c')](_0x1a2b30)){_0x26ffb7['or'](_0x317f('0x2d'),_0x1a2b30+'%');}else{_0x26ffb7['or'](_0x317f('0x2e'),'%'+_0x1a2b30+'%');_0x26ffb7['or'](_0x317f('0x2f'),'%'+_0x1a2b30+'%');_0x26ffb7['or'](_0x317f('0x2d'),'%'+_0x1a2b30+'%');}}}return _0x26ffb7;}function parseAdvancedSearchFilter(_0x37abde,_0x3c4177){var _0x417851=getSqlClauses();var _0x421141=as[_0x317f('0x30')](_0x37abde);var _0x1892bc=_0x421141[_0x317f('0x31')];for(var _0x3e5b5a=0x0;_0x3e5b5a<_0x421141[_0x317f('0x32')]['length'];_0x3e5b5a++){var _0x2ae4d2=_0x421141[_0x317f('0x32')][_0x3e5b5a];var _0x29d19c='c';var _0x2e3e5f=_['find'](_0x3c4177,['name',_0x2ae4d2[_0x317f('0x21')]]);if(_0x2e3e5f){if(_0x2ae4d2['field']==='dateOfBirth'||_0x2e3e5f[_0x317f('0x33')]==='datetime'){_0x2ae4d2[_0x317f('0x34')]=_0x317f('0x35');}var _0x5effa7=as[_0x317f('0x36')](_0x29d19c,_0x2e3e5f[_0x317f('0x37')],_0x2ae4d2);_0x417851['default'][_0x1892bc](_0x5effa7['text'],_0x5effa7[_0x317f('0x38')][_0x317f('0x39')],_0x5effa7[_0x317f('0x38')]['end']);}else{if(_0x2ae4d2[_0x317f('0x21')]===_0x317f('0x3a')){var _0x9f8eb4=_0x2ae4d2[_0x317f('0x38')][_0x317f('0x25')](',')[_0x317f('0x3b')](function(_0x24d3ae){return Number(_0x24d3ae);});var _0x3fdbbd=parseTagParameter(_0x9f8eb4);_0x417851[_0x317f('0x3c')][_0x317f('0x3d')][_0x317f('0x3e')](_0x3fdbbd);_0x417851[_0x317f('0x3c')][_0x317f('0x3f')]=_0x9f8eb4;}else if(_0x2ae4d2[_0x317f('0x21')]==='User'){_0x417851[_0x317f('0x40')][_0x317f('0x3d')][_0x317f('0x3e')](_0x317f('0x41'),_0x2ae4d2[_0x317f('0x38')]);_0x417851[_0x317f('0x40')][_0x317f('0x42')]=!![];}}}return _0x417851;}function parseModelFields(_0x47035c,_0x40552e){var _0x46eab8=squel[_0x317f('0x23')]();var _0x475b8d=_(_0x47035c)[_0x317f('0x43')]()[_0x317f('0x3b')](function(_0x745953){return _['some'](_0x40552e,[_0x317f('0x44'),_0x745953])?_0x745953:undefined;})[_0x317f('0x45')]()['value']();if(_0x47035c['Contact']){_0x475b8d['push']('Contact');}if(_0x47035c[_0x317f('0x46')]){_0x475b8d[_0x317f('0x1e')]('User');}if(_0x475b8d[_0x317f('0x26')]>0x0){_0x475b8d[_0x317f('0x1f')](function(_0x2280f9){if(_0x2280f9===_0x317f('0x7')){_0x46eab8[_0x317f('0x3e')]('c.ListId\x20IN\x20?',[][_0x317f('0x47')](_0x47035c[_0x2280f9]));}else if(_0x2280f9===_0x317f('0x48')){var _0x2ee9bc='%'+_0x47035c[_0x2280f9]+'%';_0x46eab8['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x2ee9bc);}else if(_0x2280f9===_0x317f('0x46')){_0x46eab8['and']('uc.UserId\x20=\x20?',_0x47035c[_0x2280f9]);}else{_0x46eab8['and']('c.'+_0x2280f9+_0x317f('0x49'),_0x47035c[_0x2280f9]);}});}return _0x46eab8;}function parseQueryParameters(_0x4b9c57,_0x566d39){var _0x555984=getSqlClauses();return Promise[_0x317f('0x4a')]()[_0x317f('0x4b')](function(){return parseModelFields(_0x4b9c57,_0x566d39);})[_0x317f('0x4b')](function(_0x3b6c16){_0x555984[_0x317f('0x4c')][_0x317f('0x3e')](_0x3b6c16);return parseTagParameter(_0x4b9c57[_0x317f('0x4d')]);})['then'](function(_0x57def){_0x555984[_0x317f('0x3c')][_0x317f('0x3d')][_0x317f('0x3e')](_0x57def);return parseSearchFilter(_0x4b9c57[_0x317f('0x4e')]);})[_0x317f('0x4b')](function(_0x28a259){_0x555984[_0x317f('0x4e')]=_0x28a259;return _0x555984;});}function checkListsRestrictions(_0x1ed2cb,_0x432550,_0xf710e6){var _0x3b8f07=squel[_0x317f('0x23')]();return Promise[_0x317f('0x4a')]()['then'](function(){if(_0x432550[_0x317f('0x6')]&&_0x1ed2cb[_0x317f('0x4f')]==='agent'&&!_0xf710e6){return _0x1ed2cb[_0x317f('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x317f('0x4b')](function(_0x194fae){if(_0x194fae){if(_0x194fae[_0x317f('0x26')]===0x0){_0x3b8f07[_0x317f('0x3e')]('c.ListId\x20IS\x20NULL');}else{_0x3b8f07['and'](_0x317f('0x51'),_['map'](_0x194fae,'id'));}}})['then'](function(){return _0x3b8f07;});}function buildContactsQuery(_0x5c68fb,_0x152ef1,_0x593905,_0x20cad3,_0x2854e2,_0x489e57){if(_0x152ef1){_0x152ef1=_0x593905[_0x317f('0x52')];}_0x5c68fb=addFieldsToQuery(_0x5c68fb,_0x152ef1,_0x20cad3,_0x489e57,!![]);var _0x59761e=squel[_0x317f('0x53')]();_0x59761e=addFieldsToQuery(_0x59761e,_0x152ef1,_0x20cad3,_0x489e57,![]);if(_0x20cad3||_0x489e57){_0x5c68fb=applyJoinClauses(_0x5c68fb,!![]);_0x5c68fb['group'](_0x317f('0x54'));if(_0x593905[_0x317f('0x55')]){_0x59761e[_0x317f('0x55')](_0x593905[_0x317f('0x55')]);}if(_0x593905[_0x317f('0x56')]){_0x59761e[_0x317f('0x56')](_0x593905[_0x317f('0x56')]);}}else{_0x59761e=applyJoinClauses(_0x59761e,![]);_0x59761e[_0x317f('0x57')](_0x317f('0x58'));if(_0x593905[_0x317f('0x55')]){_0x5c68fb[_0x317f('0x55')](_0x593905[_0x317f('0x55')]);}if(_0x593905[_0x317f('0x56')]){_0x5c68fb['offset'](_0x593905[_0x317f('0x56')]);}}_0x59761e[_0x317f('0x59')](_0x2854e2);if(_0x593905[_0x317f('0x5a')]){_0x593905[_0x317f('0x5a')][_0x317f('0x1f')](function(_0x98c0e1){_0x5c68fb['order']('c.'+_0x98c0e1[0x0],_0x98c0e1[0x1]===_0x317f('0x5b')?![]:!![]);_0x59761e[_0x317f('0x5a')]('subqry.'+_0x98c0e1[0x0],_0x98c0e1[0x1]===_0x317f('0x5b')?![]:!![]);});}_0x59761e['from'](_0x5c68fb,_0x317f('0xb'));return _0x59761e;}function getFilteredContacts(_0x44ca18){var _0x4b56a1=[];return db['Tag'][_0x317f('0x5c')]({'attributes':['id',_0x317f('0x44'),_0x317f('0x5d')],'raw':!![]})[_0x317f('0x4b')](function(_0x2cec3f){_0x4b56a1=_[_0x317f('0x5e')](_0x2cec3f,'id');var _0x3c36e1={'type':db[_0x317f('0x5f')][_0x317f('0x60')][_0x317f('0x61')],'model':db[_0x317f('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x317f('0x63')][_0x317f('0x64')](_0x44ca18[_0x317f('0x65')](),_0x3c36e1);})[_0x317f('0x4b')](function(_0x1931fe){_0x1931fe[_0x317f('0x1f')](function(_0x275caf){if(_0x275caf[_0x317f('0x20')]){_0x275caf['Tags']=[];_0x275caf[_0x317f('0x20')][_0x317f('0x25')](',')['forEach'](function(_0x3b0357){_0x275caf[_0x317f('0x66')][_0x317f('0x1e')](_0x4b56a1[_0x3b0357]);});}delete _0x275caf[_0x317f('0x20')];});return _0x1931fe;});}function countFilteredContacts(_0x21d839,_0x4c11c2){var _0x273d50=_0x21d839[_0x317f('0x67')]();_0x273d50[_0x317f('0x21')](_0x317f('0x68'));_0x273d50=applyJoinClauses(_0x273d50,!![]);_0x21d839['group'](_0x317f('0x54'));var _0x3bf8aa=utils[_0x317f('0x69')](_0x4c11c2);if(!_[_0x317f('0x6a')](_0x3bf8aa)){_0x273d50[_0x317f('0x6b')](_0x317f('0x6c'),_0x3bf8aa);}var _0x3cd24b={'type':db['Sequelize']['QueryTypes'][_0x317f('0x61')],'raw':!![]};return db['sequelize'][_0x317f('0x64')](_0x273d50[_0x317f('0x65')](),_0x3cd24b)[_0x317f('0x4b')](function(_0x56725f){return _0x56725f[0x0][_0x317f('0x68')];});}module[_0x317f('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x0824=['find','dateOfBirth','fieldType','datetime','DATE','type','text','value','end','Tag','map','tags','and','ids','User','user','clause','uc.UserId\x20=\x20?','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','name','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','TagIds','Tags','isEmpty','t.id\x20IN\x20?','SELECT','exports','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','ListId','CompanyId','createdAt','updatedAt','deletedAt','includes','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions'];(function(_0x5d0004,_0x4bcb9a){var _0x4be732=function(_0x30e2f4){while(--_0x30e2f4){_0x5d0004['push'](_0x5d0004['shift']());}};_0x4be732(++_0x4bcb9a);}(_0x0824,0xab));var _0x4082=function(_0x5a7e2b,_0x14a856){_0x5a7e2b=_0x5a7e2b-0x0;var _0xe0ddc0=_0x0824[_0x5a7e2b];return _0xe0ddc0;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x4082('0x0'));var utils=require(_0x4082('0x1'));var db=require(_0x4082('0x2'))['db'];function skipContactsQuery(_0x5c9f2d,_0x15e9f4){var _0x53e0b3=![];if(_0x5c9f2d[_0x4082('0x3')]===_0x4082('0x4')&&!_0x15e9f4['search']&&!_0x15e9f4['ListId']&&_0x15e9f4[_0x4082('0x5')]!==_0x4082('0x6')){_0x53e0b3=!![];}return _0x53e0b3;}function getContactsSubquery(){return squel[_0x4082('0x7')]()[_0x4082('0x8')](_0x4082('0x9'),'c')[_0x4082('0xa')](_0x4082('0xb'));}function applyJoinClauses(_0x14088b,_0x324aa8){var _0x30f8c8=_0x324aa8?'c':_0x4082('0xc');_0x14088b[_0x4082('0xd')](_0x4082('0xe'),'uc',_0x4082('0xf')+_0x30f8c8+_0x4082('0x10'))[_0x4082('0xd')](_0x4082('0x11'),'ct',_0x4082('0x12')+_0x30f8c8+_0x4082('0x10'))[_0x4082('0xd')](_0x4082('0x13'),'t',_0x4082('0x14'));return _0x14088b;}function addFieldsToQuery(_0x21278f,_0x16de78,_0x5e26bf,_0x241ac1,_0x46d3aa){var _0xfdbaeb=_0x46d3aa?'c':'subqry';if(!_0x16de78){_0x16de78=['id',_0x4082('0x15'),'lastName',_0x4082('0x16'),_0x4082('0x17'),_0x4082('0x18'),'email',_0x4082('0x19'),_0x4082('0x1a'),_0x4082('0x1b'),_0x4082('0x1c'),_0x4082('0x1d'),'TagIds'];}else if(!_0x16de78[_0x4082('0x1e')]('id')){_0x16de78['push']('id');}var _0x4a237e=_0x5e26bf&&_0x46d3aa||!_0x5e26bf&&!_0x46d3aa;if(_0x241ac1){_0x4a237e=_0x241ac1&&_0x46d3aa||!_0x241ac1&&!_0x46d3aa;}_0x16de78['forEach'](function(_0x248f95){if(_0x248f95==='TagIds'){if(_0x4a237e){_0x21278f['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x248f95);}else if(_0x5e26bf||_0x241ac1){_0x21278f[_0x4082('0x1f')](_0xfdbaeb+'.'+_0x248f95);}}else{_0x21278f['field'](_0xfdbaeb+'.'+_0x248f95);}});return _0x21278f;}function getSqlClauses(){var _0x1dfe65={'default':squel[_0x4082('0x20')](),'fields':squel[_0x4082('0x20')](),'filter':squel[_0x4082('0x20')](),'tags':{'clause':squel[_0x4082('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1dfe65;}function parseTagParameter(_0x4fa448){var _0x345176=squel[_0x4082('0x20')]();if(_0x4fa448){var _0x9fbc21=utils[_0x4082('0x21')](_0x4fa448);_0x9fbc21[_0x4082('0x22')](function(_0x2d07ea){_0x345176['or'](_0x4082('0x23'),'%,'+_0x2d07ea+',%');});}return _0x345176;}function parseSearchFilter(_0x704352){var _0x387486=squel['expr']();if(_0x704352){var _0x7aa984=_0x704352['replace']('\x5c','\x5c\x5c')[_0x4082('0x24')](/'/g,'\x27\x27');if(_0x7aa984[_0x4082('0x25')]('\x20')[_0x4082('0x26')]>0x1){_0x387486['or'](_0x4082('0x27'),qs[_0x4082('0x28')](_0x7aa984,!![]),null);}else{if(qs[_0x4082('0x29')](_0x7aa984)){_0x387486['or'](_0x4082('0x2a'),_0x7aa984+'%');_0x387486['or'](_0x4082('0x2b'),_0x7aa984+'%');_0x387486['or'](_0x4082('0x2c'),_0x7aa984+'%');_0x387486['or'](_0x4082('0x2d'),_0x7aa984+'%');}else if(qs[_0x4082('0x2e')](_0x7aa984)){_0x387486['or'](_0x4082('0x2f'),_0x7aa984+'%');}else{_0x387486['or'](_0x4082('0x30'),'%'+_0x7aa984+'%');_0x387486['or'](_0x4082('0x31'),'%'+_0x7aa984+'%');_0x387486['or'](_0x4082('0x2f'),'%'+_0x7aa984+'%');}}}return _0x387486;}function parseAdvancedSearchFilter(_0x2493fc,_0x1940a7){var _0x300a45=getSqlClauses();var _0x217802=as[_0x4082('0x32')](_0x2493fc);var _0xf92029=_0x217802[_0x4082('0x33')];for(var _0x36a5ee=0x0;_0x36a5ee<_0x217802[_0x4082('0x34')][_0x4082('0x26')];_0x36a5ee++){var _0x4e57be=_0x217802[_0x4082('0x34')][_0x36a5ee];var _0x3da9eb='c';var _0x330916=_[_0x4082('0x35')](_0x1940a7,['name',_0x4e57be[_0x4082('0x1f')]]);if(_0x330916){if(_0x4e57be[_0x4082('0x1f')]===_0x4082('0x36')||_0x330916[_0x4082('0x37')]===_0x4082('0x38')){_0x4e57be['castTo']=_0x4082('0x39');}var _0x449814=as['buildExpression'](_0x3da9eb,_0x330916[_0x4082('0x3a')],_0x4e57be);_0x300a45['default'][_0xf92029](_0x449814[_0x4082('0x3b')],_0x449814[_0x4082('0x3c')]['start'],_0x449814[_0x4082('0x3c')][_0x4082('0x3d')]);}else{if(_0x4e57be[_0x4082('0x1f')]===_0x4082('0x3e')){var _0x442deb=_0x4e57be[_0x4082('0x3c')][_0x4082('0x25')](',')[_0x4082('0x3f')](function(_0x574641){return Number(_0x574641);});var _0x43f7a3=parseTagParameter(_0x442deb);_0x300a45[_0x4082('0x40')]['clause'][_0x4082('0x41')](_0x43f7a3);_0x300a45[_0x4082('0x40')][_0x4082('0x42')]=_0x442deb;}else if(_0x4e57be[_0x4082('0x1f')]===_0x4082('0x43')){_0x300a45[_0x4082('0x44')][_0x4082('0x45')]['and'](_0x4082('0x46'),_0x4e57be[_0x4082('0x3c')]);_0x300a45[_0x4082('0x44')]['skip']=!![];}}}return _0x300a45;}function parseModelFields(_0x4e211c,_0x57a861){var _0x18d660=squel[_0x4082('0x20')]();var _0xca1a76=_(_0x4e211c)[_0x4082('0x47')]()[_0x4082('0x3f')](function(_0x536162){return _[_0x4082('0x48')](_0x57a861,['name',_0x536162])?_0x536162:undefined;})['compact']()['value']();if(_0x4e211c[_0x4082('0x49')]){_0xca1a76[_0x4082('0x4a')](_0x4082('0x49'));}if(_0x4e211c[_0x4082('0x43')]){_0xca1a76[_0x4082('0x4a')](_0x4082('0x43'));}if(_0xca1a76[_0x4082('0x26')]>0x0){_0xca1a76['forEach'](function(_0x4b07ca){if(_0x4b07ca===_0x4082('0x19')){_0x18d660[_0x4082('0x41')](_0x4082('0x4b'),[][_0x4082('0x4c')](_0x4e211c[_0x4b07ca]));}else if(_0x4b07ca===_0x4082('0x49')){var _0x2f6d72='%'+_0x4e211c[_0x4b07ca]+'%';_0x18d660[_0x4082('0x41')](_0x4082('0x4d'),_0x2f6d72);}else if(_0x4b07ca===_0x4082('0x43')){_0x18d660['and'](_0x4082('0x46'),_0x4e211c[_0x4b07ca]);}else{_0x18d660[_0x4082('0x41')]('c.'+_0x4b07ca+_0x4082('0x4e'),_0x4e211c[_0x4b07ca]);}});}return _0x18d660;}function parseQueryParameters(_0x423f98,_0x3876dc){var _0x159e7f=getSqlClauses();return Promise[_0x4082('0x4f')]()[_0x4082('0x50')](function(){return parseModelFields(_0x423f98,_0x3876dc);})[_0x4082('0x50')](function(_0x321dc1){_0x159e7f[_0x4082('0x51')][_0x4082('0x41')](_0x321dc1);return parseTagParameter(_0x423f98[_0x4082('0x52')]);})['then'](function(_0x532bc7){_0x159e7f['tags'][_0x4082('0x45')][_0x4082('0x41')](_0x532bc7);return parseSearchFilter(_0x423f98[_0x4082('0x53')]);})['then'](function(_0x260353){_0x159e7f['filter']=_0x260353;return _0x159e7f;});}function checkListsRestrictions(_0x1540e5,_0x310d6c,_0x368976){var _0x452ecf=squel[_0x4082('0x20')]();return Promise[_0x4082('0x4f')]()[_0x4082('0x50')](function(){if(_0x310d6c[_0x4082('0x54')]&&_0x1540e5[_0x4082('0x3')]===_0x4082('0x4')&&!_0x368976){return _0x1540e5['getLists']({'attributes':['id'],'raw':!![]});}})[_0x4082('0x50')](function(_0x289632){if(_0x289632){if(_0x289632[_0x4082('0x26')]===0x0){_0x452ecf[_0x4082('0x41')](_0x4082('0x55'));}else{_0x452ecf[_0x4082('0x41')](_0x4082('0x4b'),_[_0x4082('0x3f')](_0x289632,'id'));}}})[_0x4082('0x50')](function(){return _0x452ecf;});}function buildContactsQuery(_0x152d22,_0x54b2e0,_0x565804,_0x2e593d,_0x56b51d,_0x3bd8c5){if(_0x54b2e0){_0x54b2e0=_0x565804[_0x4082('0x56')];}_0x152d22=addFieldsToQuery(_0x152d22,_0x54b2e0,_0x2e593d,_0x3bd8c5,!![]);var _0xe73601=squel[_0x4082('0x7')]();_0xe73601=addFieldsToQuery(_0xe73601,_0x54b2e0,_0x2e593d,_0x3bd8c5,![]);if(_0x2e593d||_0x3bd8c5){_0x152d22=applyJoinClauses(_0x152d22,!![]);_0x152d22[_0x4082('0x57')](_0x4082('0x58'));if(_0x565804['limit']){_0xe73601[_0x4082('0x59')](_0x565804['limit']);}if(_0x565804['offset']){_0xe73601[_0x4082('0x5a')](_0x565804[_0x4082('0x5a')]);}}else{_0xe73601=applyJoinClauses(_0xe73601,![]);_0xe73601[_0x4082('0x57')](_0x4082('0x5b'));if(_0x565804[_0x4082('0x59')]){_0x152d22[_0x4082('0x59')](_0x565804['limit']);}if(_0x565804[_0x4082('0x5a')]){_0x152d22['offset'](_0x565804[_0x4082('0x5a')]);}}_0xe73601[_0x4082('0x5c')](_0x56b51d);if(_0x565804[_0x4082('0x5d')]){_0x565804[_0x4082('0x5d')][_0x4082('0x22')](function(_0x558d09){_0x152d22[_0x4082('0x5d')]('c.'+_0x558d09[0x0],_0x558d09[0x1]===_0x4082('0x5e')?![]:!![]);_0xe73601['order'](_0x4082('0x5f')+_0x558d09[0x0],_0x558d09[0x1]===_0x4082('0x5e')?![]:!![]);});}_0xe73601[_0x4082('0x8')](_0x152d22,_0x4082('0xc'));return _0xe73601;}function getFilteredContacts(_0x43424b){var _0x2e60bb=[];return db['Tag'][_0x4082('0x60')]({'attributes':['id',_0x4082('0x61'),_0x4082('0x62')],'raw':!![]})[_0x4082('0x50')](function(_0x45cb00){_0x2e60bb=_[_0x4082('0x63')](_0x45cb00,'id');var _0x420de1={'type':db[_0x4082('0x64')][_0x4082('0x65')]['SELECT'],'model':db[_0x4082('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4082('0x67')][_0x4082('0x68')](_0x43424b[_0x4082('0x69')](),_0x420de1);})['then'](function(_0x7f0405){_0x7f0405[_0x4082('0x22')](function(_0x4ac274){if(_0x4ac274[_0x4082('0x6a')]){_0x4ac274[_0x4082('0x6b')]=[];_0x4ac274[_0x4082('0x6a')]['split'](',')['forEach'](function(_0x329f83){_0x4ac274[_0x4082('0x6b')][_0x4082('0x4a')](_0x2e60bb[_0x329f83]);});}delete _0x4ac274[_0x4082('0x6a')];});return _0x7f0405;});}function countFilteredContacts(_0x1b3956,_0x357c31){var _0x7a13fc=_0x1b3956['clone']();_0x7a13fc[_0x4082('0x1f')]('COUNT(*)');_0x7a13fc=applyJoinClauses(_0x7a13fc,!![]);_0x1b3956[_0x4082('0x57')](_0x4082('0x58'));var _0x3fa2db=utils['getSelectedTags'](_0x357c31);if(!_[_0x4082('0x6c')](_0x3fa2db)){_0x7a13fc['where'](_0x4082('0x6d'),_0x3fa2db);}var _0x3245be={'type':db[_0x4082('0x64')]['QueryTypes'][_0x4082('0x6e')],'raw':!![]};return db['sequelize'][_0x4082('0x68')](_0x7a13fc[_0x4082('0x69')](),_0x3245be)[_0x4082('0x50')](function(_0x23aed8){return _0x23aed8[0x0]['COUNT(*)'];});}module[_0x4082('0x6f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index bca1c40..fe34021 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 _0xc78e=['write','decryptFile','createDecipher','close','encryptString','secret','createCipher','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','end','final','binary'];(function(_0x32c25a,_0x5dad37){var _0x24eccf=function(_0xaab7fb){while(--_0xaab7fb){_0x32c25a['push'](_0x32c25a['shift']());}};_0x24eccf(++_0x5dad37);}(_0xc78e,0x76));var _0xec78=function(_0x33a5a5,_0x8c62a){_0x33a5a5=_0x33a5a5-0x0;var _0x33993a=_0xc78e[_0x33a5a5];return _0x33993a;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xec78('0x0'));var _=require(_0xec78('0x1'));var config=require(_0xec78('0x2'));var logger=require(_0xec78('0x3'))(_0xec78('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xec78('0x5')][_0xec78('0x6')],'algorithm':_0xec78('0x7')};const fileOptions={'algorithm':_0xec78('0x8')};if(config[_0xec78('0x9')]&&config[_0xec78('0x9')][_0xec78('0xa')]){var isSupported=isAlgorithmSupported(config[_0xec78('0x9')]['algorithm']);if(isSupported){fileOptions[_0xec78('0xa')]=config[_0xec78('0x9')][_0xec78('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xec78('0xb')](',\x20');logger[_0xec78('0xc')](config[_0xec78('0x9')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x933ba9){return AES_SUPPORTED_RX[_0xec78('0xd')](_0x933ba9);}function getSupportedCiphers(){return crypto[_0xec78('0xe')]()[_0xec78('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x3a301c){return getSupportedCiphers()[_0xec78('0x10')](_0x3a301c)>-0x1;}function combineOptions(_0xe85d17){var _0x370796={};for(var _0x461f16 in fileOptions){if(fileOptions[_0xec78('0x11')](_0x461f16)){_0x370796[_0x461f16]=fileOptions[_0x461f16];}}if(_0xe85d17){for(var _0x12b0b1 in _0xe85d17){if(_0xe85d17['hasOwnProperty'](_0x12b0b1)){_0x370796[_0x12b0b1]=_0xe85d17[_0x12b0b1];}}}return _0x370796;}exports[_0xec78('0x12')]=function(_0xe68b32,_0x405367,_0x13be53,_0x3c8607){return new BPromise(function(_0x4928c3,_0x4bfadc){_0x3c8607=combineOptions(_0x3c8607);var _0x591e63=new Buffer(_0x13be53);var _0x2d1ad1=fs[_0xec78('0x13')](_0xe68b32);var _0x31c1e1=fs[_0xec78('0x14')](_0x405367);var _0x2a0a5e=crypto['createCipher'](_0x3c8607[_0xec78('0xa')],_0x591e63);_0x2d1ad1['on'](_0xec78('0x15'),function(_0x32da8c){var _0x574874=new Buffer(_0x2a0a5e[_0xec78('0x16')](_0x32da8c),'binary');_0x31c1e1['write'](_0x574874);});_0x2d1ad1['on'](_0xec78('0x17'),function(){try{var _0x5ad625=new Buffer(_0x2a0a5e[_0xec78('0x18')](_0xec78('0x19')),_0xec78('0x19'));_0x31c1e1[_0xec78('0x1a')](_0x5ad625);_0x31c1e1['end']();_0x31c1e1['on']('close',function(){return _0x4928c3(_0x405367);});}catch(_0x1d88bf){fs['unlink'](_0x405367);return _0x4bfadc(_0x1d88bf);}});});};exports[_0xec78('0x1b')]=function(_0x46245f,_0x5c33de,_0x87c4ec,_0x7ac178){return new BPromise(function(_0x29ebe2,_0x2a6011){_0x7ac178=combineOptions(_0x7ac178);var _0x519ae9=new Buffer(_0x87c4ec);var _0x5b5216=fs[_0xec78('0x13')](_0x46245f);var _0x55c32d=fs[_0xec78('0x14')](_0x5c33de);var _0x25c071=crypto[_0xec78('0x1c')](_0x7ac178[_0xec78('0xa')],_0x519ae9);_0x5b5216['on'](_0xec78('0x15'),function(_0x5c2fde){var _0x4c89de=new Buffer(_0x25c071[_0xec78('0x16')](_0x5c2fde),_0xec78('0x19'));_0x55c32d['write'](_0x4c89de);});_0x5b5216['on'](_0xec78('0x17'),function(){try{var _0x45e69f=new Buffer(_0x25c071['final']('binary'),_0xec78('0x19'));_0x55c32d[_0xec78('0x1a')](_0x45e69f);_0x55c32d[_0xec78('0x17')]();_0x55c32d['on'](_0xec78('0x1d'),function(){return _0x29ebe2(_0x5c33de);});}catch(_0x55528d){fs['unlink'](_0x5c33de);return _0x2a6011(_0x55528d);}});});};exports[_0xec78('0x1e')]=function(_0x1898af,_0x148a53,_0x1e6ac8){var _0x424623=_0x1e6ac8||stringOptions[_0xec78('0xa')];var _0x5116d4=_0x148a53||stringOptions[_0xec78('0x1f')];var _0x43882a=crypto[_0xec78('0x20')](_0x424623,_0x5116d4);var _0x17b905=_0x43882a[_0xec78('0x16')](_0x1898af,_0xec78('0x21'),_0xec78('0x22'));_0x17b905+=_0x43882a[_0xec78('0x18')]('base64');return _0x17b905;};exports[_0xec78('0x23')]=function(_0x13117b,_0x35290f,_0x33aa81){var _0x18e839=_0x33aa81||stringOptions[_0xec78('0xa')];var _0x42aa58=_0x35290f||stringOptions['secret'];var _0x6ef6a6=crypto[_0xec78('0x1c')](_0x18e839,_0x42aa58);var _0x19b86f=_0x6ef6a6['update'](_0x13117b,_0xec78('0x22'),_0xec78('0x21'));_0x19b86f+=_0x6ef6a6[_0xec78('0x18')](_0xec78('0x21'));return _0x19b86f;}; \ No newline at end of file +var _0x7978=['update','close','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/logger','app','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','binary','write','end','final','unlink','decryptFile','createReadStream','createDecipher','data'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7978,0x1db));var _0x8797=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7978[_0x12f688];return _0x59c3de;};'use strict';var crypto=require(_0x8797('0x0'));var fs=require('fs');var BPromise=require(_0x8797('0x1'));var _=require(_0x8797('0x2'));var config=require('../../config/environment');var logger=require(_0x8797('0x3'))(_0x8797('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x8797('0x5')],'algorithm':_0x8797('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x8797('0x7')]&&config['encrypt'][_0x8797('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8797('0x7')]['algorithm']);if(isSupported){fileOptions[_0x8797('0x8')]=config['encrypt'][_0x8797('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8797('0x9')](',\x20');logger[_0x8797('0xa')](config[_0x8797('0x7')]['algorithm'],_0x8797('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x3b35ca){return AES_SUPPORTED_RX[_0x8797('0xc')](_0x3b35ca);}function getSupportedCiphers(){return crypto[_0x8797('0xd')]()[_0x8797('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x240464){return getSupportedCiphers()[_0x8797('0xf')](_0x240464)>-0x1;}function combineOptions(_0x20a247){var _0x344370={};for(var _0x4cbcbc in fileOptions){if(fileOptions[_0x8797('0x10')](_0x4cbcbc)){_0x344370[_0x4cbcbc]=fileOptions[_0x4cbcbc];}}if(_0x20a247){for(var _0x3dee83 in _0x20a247){if(_0x20a247[_0x8797('0x10')](_0x3dee83)){_0x344370[_0x3dee83]=_0x20a247[_0x3dee83];}}}return _0x344370;}exports[_0x8797('0x11')]=function(_0x42b24a,_0x457925,_0x4b6b5a,_0x406a30){return new BPromise(function(_0x54bb08,_0x4c95ac){_0x406a30=combineOptions(_0x406a30);var _0x1417b4=new Buffer(_0x4b6b5a);var _0x1c558a=fs['createReadStream'](_0x42b24a);var _0x2f7904=fs[_0x8797('0x12')](_0x457925);var _0x13732b=crypto[_0x8797('0x13')](_0x406a30['algorithm'],_0x1417b4);_0x1c558a['on']('data',function(_0x2315a6){var _0x1df193=new Buffer(_0x13732b['update'](_0x2315a6),_0x8797('0x14'));_0x2f7904[_0x8797('0x15')](_0x1df193);});_0x1c558a['on'](_0x8797('0x16'),function(){try{var _0x2e0843=new Buffer(_0x13732b[_0x8797('0x17')](_0x8797('0x14')),_0x8797('0x14'));_0x2f7904['write'](_0x2e0843);_0x2f7904[_0x8797('0x16')]();_0x2f7904['on']('close',function(){return _0x54bb08(_0x457925);});}catch(_0x3fac8f){fs[_0x8797('0x18')](_0x457925);return _0x4c95ac(_0x3fac8f);}});});};exports[_0x8797('0x19')]=function(_0x4c0700,_0x15f22a,_0x467dab,_0x43a62d){return new BPromise(function(_0x476582,_0x5eda44){_0x43a62d=combineOptions(_0x43a62d);var _0x1abad0=new Buffer(_0x467dab);var _0x11f1ae=fs[_0x8797('0x1a')](_0x4c0700);var _0x2a91aa=fs[_0x8797('0x12')](_0x15f22a);var _0x2e0ac4=crypto[_0x8797('0x1b')](_0x43a62d[_0x8797('0x8')],_0x1abad0);_0x11f1ae['on'](_0x8797('0x1c'),function(_0xdf1576){var _0x4ecb69=new Buffer(_0x2e0ac4[_0x8797('0x1d')](_0xdf1576),_0x8797('0x14'));_0x2a91aa[_0x8797('0x15')](_0x4ecb69);});_0x11f1ae['on'](_0x8797('0x16'),function(){try{var _0x3b0ac7=new Buffer(_0x2e0ac4[_0x8797('0x17')](_0x8797('0x14')),_0x8797('0x14'));_0x2a91aa[_0x8797('0x15')](_0x3b0ac7);_0x2a91aa[_0x8797('0x16')]();_0x2a91aa['on'](_0x8797('0x1e'),function(){return _0x476582(_0x15f22a);});}catch(_0x337fa1){fs['unlink'](_0x15f22a);return _0x5eda44(_0x337fa1);}});});};exports[_0x8797('0x1f')]=function(_0x45b035,_0x58fec7,_0x3adc1f){var _0x5ca3a5=_0x3adc1f||stringOptions[_0x8797('0x8')];var _0xa001bf=_0x58fec7||stringOptions[_0x8797('0x20')];var _0x56ccc2=crypto[_0x8797('0x13')](_0x5ca3a5,_0xa001bf);var _0x166355=_0x56ccc2['update'](_0x45b035,'utf8',_0x8797('0x21'));_0x166355+=_0x56ccc2[_0x8797('0x17')](_0x8797('0x21'));return _0x166355;};exports[_0x8797('0x22')]=function(_0x2f58b1,_0xd1a5d4,_0x1840a8){var _0x4a42b9=_0x1840a8||stringOptions['algorithm'];var _0x3c62ec=_0xd1a5d4||stringOptions[_0x8797('0x20')];var _0x2caeea=crypto['createDecipher'](_0x4a42b9,_0x3c62ec);var _0x38739c=_0x2caeea[_0x8797('0x1d')](_0x2f58b1,'base64',_0x8797('0x23'));_0x38739c+=_0x2caeea[_0x8797('0x17')](_0x8797('0x23'));return _0x38739c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c28d221..90cdeb5 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 _0x6696=['SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Failed','finally','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','QueryTypes','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x4d8190,_0x11b587){var _0x5a245e=function(_0x1b5334){while(--_0x1b5334){_0x4d8190['push'](_0x4d8190['shift']());}};_0x5a245e(++_0x11b587);}(_0x6696,0x1f2));var _0x6669=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x6696[_0x341e0f];return _0x59555a;};'use strict';var util=require('util');var path=require('path');var _=require(_0x6669('0x0'));var csv=require(_0x6669('0x1'));var fs=require('fs');var BPromise=require(_0x6669('0x2'));var zipdir=require(_0x6669('0x3'));var rimraf=require(_0x6669('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6669('0x5'))[_0x6669('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6669('0x7')][0x2]);var QUERY=process[_0x6669('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ac612,_0x534d81){var _0x4b3328={'status':_0x4ac612};var _0x3a2904={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x534d81){_0x4b3328[_0x6669('0x8')]=_0x534d81;}return db['AnalyticExtractedReport'][_0x6669('0x9')](_0x4b3328,_0x3a2904);}function main(){var _0x31adad=0x1388;var _0x235e54;logger[_0x6669('0xa')](util['format'](_0x6669('0xb'),EXTRACTED_REPORT_ID,_0x6669('0xc')));return db[_0x6669('0xd')][_0x6669('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6669('0xf'),_0x6669('0x10')]})[_0x6669('0x11')](function(_0x710e96){if(_0x710e96){_0x235e54=_0x710e96;_0x31adad=_0x235e54[_0x6669('0x10')]||0x1388;}})[_0x6669('0x11')](function(){return dbH[_0x6669('0x12')][_0x6669('0x13')](util[_0x6669('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6669('0x12')][_0x6669('0x15')]['SELECT']});})[_0x6669('0x11')](function(_0xa9e763){if(!_0xa9e763[0x0][_0x6669('0x16')]){return analyticExtractedReport(_0x6669('0x17'));}var _0x3fe347=[];var _0x21b201=0x0;if(_0x235e54[_0x6669('0xf')]){if(_0xa9e763&&_0xa9e763[_0x6669('0x18')]){var _0x5b1183=_[_0x6669('0x19')](_0xa9e763[0x0]['num']/_0x31adad);var _0x4be82d=Number[_0x6669('0x1a')](_0xa9e763[0x0][_0x6669('0x16')]/_0x31adad)?_0xa9e763[0x0][_0x6669('0x16')]%_0x31adad:0x0;_0x5b1183[_0x6669('0x1b')](function(_0x1c41f9){if(_0x1c41f9>0x0){_0x21b201+=_0x31adad;}_0x3fe347[_0x6669('0x1c')](dbH[_0x6669('0x12')][_0x6669('0x13')](util[_0x6669('0x14')](_0x6669('0x1d'),QUERY,_0x31adad,_0x21b201),{'type':dbH[_0x6669('0x12')][_0x6669('0x15')][_0x6669('0x1e')]}));});if(_0x4be82d>0x0){_0x21b201+=_0x31adad;_0x3fe347[_0x6669('0x1c')](dbH[_0x6669('0x12')][_0x6669('0x13')](util[_0x6669('0x14')](_0x6669('0x1d'),QUERY,_0x4be82d,_0x21b201),{'type':dbH[_0x6669('0x12')]['QueryTypes'][_0x6669('0x1e')]}));}}}else{_0x3fe347['push'](dbH['sequelize'][_0x6669('0x13')](QUERY,{'type':dbH[_0x6669('0x12')][_0x6669('0x15')]['SELECT']}));}var _0x45414a=path[_0x6669('0x1f')](PATH);var _0xb5a848=path[_0x6669('0x20')](PATH,_0x6669('0x21'));var _0x1b69d7=_0x235e54[_0x6669('0xf')]&&_0x3fe347[_0x6669('0x18')]>0x1;var _0x167845=[];if(!fs[_0x6669('0x22')](path[_0x6669('0x23')](_0x45414a,_0xb5a848))&&_0x1b69d7){fs[_0x6669('0x24')](path[_0x6669('0x23')](_0x45414a,_0xb5a848));}return BPromise[_0x6669('0x25')](_0x3fe347,function(_0x493b59){_0x167845[_0x6669('0x1c')](_0x493b59);})['then'](function(){for(var _0x336e69=0x0;_0x336e69<_0x167845[_0x6669('0x18')];_0x336e69+=0x1){var _0x3ba391;var _0x242fbd=_0x167845[_0x336e69];if(_0x1b69d7){_0x3ba391=path[_0x6669('0x23')](_0x45414a,_0xb5a848,util['format'](_0x6669('0x26'),_0xb5a848,_0x336e69,_0x6669('0x27')));}else{_0x3ba391=path[_0x6669('0x23')](_0x45414a,util['format']('%s.%s',_0xb5a848,_0x6669('0x27')));}fs['writeFileSync'](_0x3ba391,csv(_0x242fbd));}})[_0x6669('0x11')](function(){if(_0x1b69d7){return new Promise(function(_0x1279c5){zipdir(path[_0x6669('0x23')](_0x45414a,_0xb5a848),{'saveTo':path[_0x6669('0x23')](_0x45414a,util[_0x6669('0x14')]('%s.%s',_0xb5a848,_0x6669('0x28')))},function(_0x3bfbbb,_0x4ca1ad){rimraf(path[_0x6669('0x23')](_0x45414a,_0xb5a848),function(){});_0x1279c5(_0x6669('0x29'));});});}})[_0x6669('0x11')](function(){logger['info'](util[_0x6669('0x14')](_0x6669('0x2a'),EXTRACTED_REPORT_ID,_0x6669('0xc')));return analyticExtractedReport(_0x6669('0x2b'),_0x1b69d7?util[_0x6669('0x14')](_0x6669('0x2c'),_0xb5a848,_0x1b69d7?'zip':_0x6669('0x27')):null);});})[_0x6669('0x2d')](function(_0x2f56a4){logger[_0x6669('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2f56a4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6669('0x2e'));})[_0x6669('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x18ac=['%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','forEach'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x18ac,0x135));var _0xc18a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x18ac[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var path=require(_0xc18a('0x0'));var _=require('lodash');var csv=require(_0xc18a('0x1'));var fs=require('fs');var BPromise=require(_0xc18a('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xc18a('0x3'));var db=require(_0xc18a('0x4'))['db'];var dbH=require(_0xc18a('0x4'))[_0xc18a('0x5')];var logger=require(_0xc18a('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc18a('0x7')][0x2]);var QUERY=process[_0xc18a('0x7')][0x3];var PATH=process[_0xc18a('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c6383,_0xe59456){var _0x1097d6={'status':_0x2c6383};var _0x2b5151={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe59456){_0x1097d6['savename']=_0xe59456;}return db[_0xc18a('0x8')][_0xc18a('0x9')](_0x1097d6,_0x2b5151);}function main(){var _0x2c3402=0x1388;var _0x1336f7;logger[_0xc18a('0xa')](util[_0xc18a('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc18a('0xc')));return db[_0xc18a('0xd')][_0xc18a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc18a('0xf'),_0xc18a('0x10')]})[_0xc18a('0x11')](function(_0x2089eb){if(_0x2089eb){_0x1336f7=_0x2089eb;_0x2c3402=_0x1336f7[_0xc18a('0x10')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xc18a('0x12')](util[_0xc18a('0xb')](_0xc18a('0x13'),QUERY),{'type':dbH[_0xc18a('0x14')][_0xc18a('0x15')][_0xc18a('0x16')]});})[_0xc18a('0x11')](function(_0x52e441){if(!_0x52e441[0x0][_0xc18a('0x17')]){return analyticExtractedReport(_0xc18a('0x18'));}var _0x181092=[];var _0xc1c8fe=0x0;if(_0x1336f7[_0xc18a('0xf')]){if(_0x52e441&&_0x52e441[_0xc18a('0x19')]){var _0x14b8e9=_['range'](_0x52e441[0x0]['num']/_0x2c3402);var _0x3b85dd=Number['isInteger'](_0x52e441[0x0][_0xc18a('0x17')]/_0x2c3402)?_0x52e441[0x0]['num']%_0x2c3402:0x0;_0x14b8e9[_0xc18a('0x1a')](function(_0x4681b6){if(_0x4681b6>0x0){_0xc1c8fe+=_0x2c3402;}_0x181092['push'](dbH[_0xc18a('0x14')][_0xc18a('0x12')](util[_0xc18a('0xb')](_0xc18a('0x1b'),QUERY,_0x2c3402,_0xc1c8fe),{'type':dbH[_0xc18a('0x14')][_0xc18a('0x15')][_0xc18a('0x16')]}));});if(_0x3b85dd>0x0){_0xc1c8fe+=_0x2c3402;_0x181092[_0xc18a('0x1c')](dbH[_0xc18a('0x14')][_0xc18a('0x12')](util[_0xc18a('0xb')](_0xc18a('0x1b'),QUERY,_0x3b85dd,_0xc1c8fe),{'type':dbH[_0xc18a('0x14')][_0xc18a('0x15')][_0xc18a('0x16')]}));}}}else{_0x181092[_0xc18a('0x1c')](dbH[_0xc18a('0x14')]['query'](QUERY,{'type':dbH[_0xc18a('0x14')]['QueryTypes'][_0xc18a('0x16')]}));}var _0x349ed1=path['dirname'](PATH);var _0x2940cb=path[_0xc18a('0x1d')](PATH,_0xc18a('0x1e'));var _0x1ccffd=_0x1336f7[_0xc18a('0xf')]&&_0x181092[_0xc18a('0x19')]>0x1;var _0x571863=[];if(!fs[_0xc18a('0x1f')](path[_0xc18a('0x20')](_0x349ed1,_0x2940cb))&&_0x1ccffd){fs[_0xc18a('0x21')](path[_0xc18a('0x20')](_0x349ed1,_0x2940cb));}return BPromise[_0xc18a('0x22')](_0x181092,function(_0x5add7e){_0x571863['push'](_0x5add7e);})[_0xc18a('0x11')](function(){for(var _0x2e04e1=0x0;_0x2e04e1<_0x571863[_0xc18a('0x19')];_0x2e04e1+=0x1){var _0x3bdd66;var _0x2268e7=_0x571863[_0x2e04e1];if(_0x1ccffd){_0x3bdd66=path[_0xc18a('0x20')](_0x349ed1,_0x2940cb,util[_0xc18a('0xb')](_0xc18a('0x23'),_0x2940cb,_0x2e04e1,_0xc18a('0x24')));}else{_0x3bdd66=path[_0xc18a('0x20')](_0x349ed1,util[_0xc18a('0xb')](_0xc18a('0x25'),_0x2940cb,_0xc18a('0x24')));}fs['writeFileSync'](_0x3bdd66,csv(_0x2268e7));}})[_0xc18a('0x11')](function(){if(_0x1ccffd){return new Promise(function(_0x256ce2){zipdir(path['join'](_0x349ed1,_0x2940cb),{'saveTo':path[_0xc18a('0x20')](_0x349ed1,util[_0xc18a('0xb')](_0xc18a('0x25'),_0x2940cb,'zip'))},function(_0x12b998,_0x1cf295){rimraf(path[_0xc18a('0x20')](_0x349ed1,_0x2940cb),function(){});_0x256ce2(_0xc18a('0x26'));});});}})[_0xc18a('0x11')](function(){logger[_0xc18a('0xa')](util[_0xc18a('0xb')](_0xc18a('0x27'),EXTRACTED_REPORT_ID,_0xc18a('0xc')));return analyticExtractedReport(_0xc18a('0x28'),_0x1ccffd?util['format']('%s.%s',_0x2940cb,_0x1ccffd?_0xc18a('0x29'):_0xc18a('0x24')):null);});})[_0xc18a('0x2a')](function(_0x441370){logger[_0xc18a('0xa')](util[_0xc18a('0xb')](_0xc18a('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0xc18a('0x2c')](_0x441370,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc18a('0x2d'));})[_0xc18a('0x2e')](function(){process[_0xc18a('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0ae9a73..0927171 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 _0xa828=['../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Setting','find','split','then','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','error','end','createPdfFromHTML','util','path','html-to-pdfmake','zip-dir','jsdom','bluebird'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa828,0xa4));var _0x8a82=function(_0x38bc8d,_0x2a1c4f){_0x38bc8d=_0x38bc8d-0x0;var _0x3143a7=_0xa828[_0x38bc8d];return _0x3143a7;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x8a82('0x0'));var path=require(_0x8a82('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x8a82('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8a82('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0x8a82('0x4'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x8a82('0x5'));var db=require(_0x8a82('0x6'))['db'];var dbH=require(_0x8a82('0x6'))[_0x8a82('0x7')];var logger=require('../../config/logger')(_0x8a82('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x8a82('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8a82('0x9')][0x4];var NAME=process[_0x8a82('0x9')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xe89ff2,_0x43552b){var _0x2498fb={'status':_0xe89ff2};var _0x3e9234={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43552b){_0x2498fb['savename']=_0x43552b;}return db[_0x8a82('0xa')][_0x8a82('0xb')](_0x2498fb,_0x3e9234);}function getHeaders(_0x372563){return _[_0x8a82('0xc')](_0x372563,function(_0x2e4e58){return{'text':_0x2e4e58,'style':_0x8a82('0xd')};});}function getRows(_0x4fd566,_0x274347){return _[_0x8a82('0xc')](_0x274347,function(_0x559ac7){return _(_0x559ac7)[_0x8a82('0xe')](_0x4fd566)[_0x8a82('0xc')](function(_0x1fd19e){return _0x1fd19e?_[_0x8a82('0xf')](_0x1fd19e):'';})[_0x8a82('0x10')]();});}function createTable(_0x121a89,_0x390f78){var _0x2061dd={'widths':_['fill'](Array(_0x121a89['length']),0x91),'heights':function(_0x40781e){return _0x40781e===0x0?_0x8a82('0x11'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x39cba4=getHeaders(_0x121a89);_0x2061dd[_0x8a82('0x12')][_0x8a82('0x13')](_0x39cba4);var _0xc2ed08=getRows(_0x121a89,_0x390f78);_0x2061dd['body']=_0x2061dd[_0x8a82('0x12')][_0x8a82('0x14')](_0xc2ed08);return _0x2061dd;}function createTables(_0x57b9ea){var _0x42cc53=[];var _0x386a82=_[_0x8a82('0x15')](Object[_0x8a82('0x16')](_0x57b9ea[0x0]),0x5);_0x386a82[_0x8a82('0x17')](function(_0x5431ca){_0x42cc53[_0x8a82('0x13')](createTable(_0x5431ca,_0x57b9ea));});return _0x42cc53;}function getPDFDocDefinition(_0x5492b3){var _0x47f95a=util[_0x8a82('0x18')](_0x8a82('0x19'),NAME,EXTRACTED_REPORT[_0x8a82('0x1a')],moment(EXTRACTED_REPORT[_0x8a82('0x1b')])[_0x8a82('0x18')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8a82('0x18')](FORMAT));var _0x20c164=[];for(var _0x5e95c0=0x0;_0x5e95c0<_0x5492b3[_0x8a82('0x1c')];_0x5e95c0++){var _0x2c8e9a=[];if(_0x5e95c0===0x0){_0x2c8e9a[_0x8a82('0x13')]({'text':_0x47f95a,'style':_0x8a82('0x1d')});}var _0x1c46ce={'table':_0x5492b3[_0x5e95c0]};if(_0x5e95c0>0x0){_0x1c46ce[_0x8a82('0x1e')]=_0x8a82('0x1f');_0x1c46ce[_0x8a82('0x20')]=[0x0,0x46,0x0,0x0];}_0x2c8e9a['push'](_0x1c46ce);_0x20c164['push'](_0x2c8e9a);}return{'pageSize':'A4','pageOrientation':_0x8a82('0x21'),'content':_0x20c164,'footer':function(_0x3dca30,_0x2b491d){return{'text':_0x3dca30['toString']()+_0x8a82('0x22')+_0x2b491d,'style':_0x8a82('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8a82('0x24')},'footer':{'alignment':_0x8a82('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x37479b){var _0xc74451=0x1388;var _0x53cab3;if(!_0x37479b[0x0][_0x8a82('0x26')]){return analyticExtractedReport('Empty');}return db[_0x8a82('0x27')][_0x8a82('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8a82('0x29'),'splitSizePdf']})[_0x8a82('0x2a')](function(_0x259521){if(_0x259521){_0x53cab3=_0x259521;_0xc74451=_0x53cab3['splitSizePdf']||0x3e8;}})[_0x8a82('0x2a')](function(){var _0x2ba227=[];var _0x1b296f=0x0;if(_0x53cab3[_0x8a82('0x29')]){if(_0x37479b&&_0x37479b[_0x8a82('0x1c')]){var _0x248b1e=_[_0x8a82('0x2b')](_0x37479b[0x0][_0x8a82('0x26')]/_0xc74451);var _0x2c27ed=Number['isInteger'](_0x37479b[0x0][_0x8a82('0x26')]/_0xc74451)?_0x37479b[0x0][_0x8a82('0x26')]%_0xc74451:0x0;_0x248b1e[_0x8a82('0x17')](function(_0x286fad){if(_0x286fad>0x0){_0x1b296f+=_0xc74451;}_0x2ba227['push'](dbH[_0x8a82('0x2c')]['query'](util['format'](_0x8a82('0x2d'),QUERY,_0xc74451,_0x1b296f),{'type':dbH['sequelize'][_0x8a82('0x2e')][_0x8a82('0x2f')]}));});if(_0x2c27ed>0x0){_0x1b296f+=_0xc74451;_0x2ba227['push'](dbH[_0x8a82('0x2c')][_0x8a82('0x30')](util[_0x8a82('0x18')](_0x8a82('0x2d'),QUERY,_0x2c27ed,_0x1b296f),{'type':dbH[_0x8a82('0x2c')][_0x8a82('0x2e')][_0x8a82('0x2f')]}));}}}else{_0x2ba227[_0x8a82('0x13')](dbH[_0x8a82('0x2c')][_0x8a82('0x30')](QUERY,{'type':dbH[_0x8a82('0x2c')][_0x8a82('0x2e')][_0x8a82('0x2f')]}));}var _0x1acc85=path[_0x8a82('0x31')](PATH);var _0x4b658d=path[_0x8a82('0x32')](PATH,_0x8a82('0x33'));var _0x678704=_0x53cab3[_0x8a82('0x29')]&&_0x2ba227['length']>0x1;var _0x9aa06c=[];if(!fs[_0x8a82('0x34')](path[_0x8a82('0x35')](_0x1acc85,_0x4b658d))&&_0x678704){fs[_0x8a82('0x36')](path[_0x8a82('0x35')](_0x1acc85,_0x4b658d));}return BPromise[_0x8a82('0x37')](_0x2ba227,function(_0x3c516d){_0x9aa06c[_0x8a82('0x13')](_0x3c516d);})['then'](function(){var _0xac618=[];for(var _0x4f5332=0x0;_0x4f5332<_0x9aa06c[_0x8a82('0x1c')];_0x4f5332+=0x1){var _0x6fd413=_0x9aa06c[_0x4f5332];var _0x5526aa=createTables(_[_0x8a82('0x38')](_0x6fd413));var _0x512ef2;var _0x335f81=getPDFDocDefinition(_0x5526aa);var _0x2b96ca=getPDFPrinter();var _0x4e8daa=_0x2b96ca[_0x8a82('0x39')](_0x335f81);if(_0x678704){_0x512ef2=path[_0x8a82('0x35')](_0x1acc85,_0x4b658d,util['format']('%s%d.%s',_0x4b658d,_0x4f5332,_0x8a82('0x3a')));}else{_0x512ef2=path[_0x8a82('0x35')](_0x1acc85,util['format'](_0x8a82('0x3b'),_0x4b658d,_0x8a82('0x3a')));}_0xac618[_0x8a82('0x13')](writePDFDocument(_0x4e8daa,_0x512ef2));}return Promise[_0x8a82('0x3c')](_0xac618);})[_0x8a82('0x2a')](function(){if(_0x678704){return new Promise(function(_0x40aff0){zipdir(path[_0x8a82('0x35')](_0x1acc85,_0x4b658d),{'saveTo':path[_0x8a82('0x35')](_0x1acc85,util[_0x8a82('0x18')]('%s.%s',_0x4b658d,_0x8a82('0x3d')))},function(){rimraf(path[_0x8a82('0x35')](_0x1acc85,_0x4b658d),function(){});_0x40aff0(_0x8a82('0x3e'));});});}})[_0x8a82('0x2a')](function(){if(!_0x678704)return;rimraf(path[_0x8a82('0x35')](_0x1acc85,_0x4b658d),function(){});})[_0x8a82('0x2a')](function(){logger[_0x8a82('0x3f')](util[_0x8a82('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8a82('0x40')));return analyticExtractedReport(_0x8a82('0x41'),_0x678704?util[_0x8a82('0x18')]('%s.%s',_0x4b658d,_0x678704?_0x8a82('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8a82('0x3f')](util[_0x8a82('0x18')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a82('0x40')));return db[_0x8a82('0xa')][_0x8a82('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8a82('0x2a')](function(_0x1ae924){EXTRACTED_REPORT=_0x1ae924;return dbH['sequelize']['query'](util[_0x8a82('0x18')](_0x8a82('0x43'),QUERY),{'type':dbH[_0x8a82('0x2c')][_0x8a82('0x2e')][_0x8a82('0x2f')]});})[_0x8a82('0x2a')](extractReport)[_0x8a82('0x44')](function(_0x1d9ff9){logger['info'](util[_0x8a82('0x18')](_0x8a82('0x45'),EXTRACTED_REPORT_ID,'PDF'),util[_0x8a82('0x46')](_0x1d9ff9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8a82('0x47'));})[_0x8a82('0x48')](function(){process[_0x8a82('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x15c44f=new PdfPrinter({'Arial':{'normal':__dirname+_0x8a82('0x4a'),'bold':__dirname+_0x8a82('0x4b'),'italics':__dirname+_0x8a82('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x15c44f;}function getPDFDocDefinitionFromHTML(_0x22e3e9,_0x189a83){var _0x1c5390=util['format']('%s\x20#%d',_0x189a83[_0x8a82('0x4d')],_0x189a83['interactionId']);var _0x475bf2=moment()[_0x8a82('0x18')]('YYYY-MM-DD')[_0x8a82('0xf')]();var _0x3520a1=htmlToPdfmake(_0x22e3e9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3520a1],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8a82('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x8a82('0x4f'),'style':_0x8a82('0x1d')}];},'footer':function(_0x34ef4e,_0x480d61){return[{'text':util[_0x8a82('0x18')](_0x8a82('0x50'),_0x1c5390,_0x34ef4e,_0x480d61,_0x475bf2),'style':_0x8a82('0x23')}];}};}function writePDFDocument(_0x4d7387,_0x27cb2a){return new Promise(function(_0x491f8b,_0x161b14){var _0xa8239c=_0x4d7387['pipe'](fs[_0x8a82('0x51')](_0x27cb2a));_0xa8239c['on']('finish',function(){_0x491f8b('finish');});_0xa8239c['on'](_0x8a82('0x52'),function(_0x193b46){_0x161b14(_0x193b46);});_0x4d7387[_0x8a82('0x53')]();});}exports[_0x8a82('0x54')]=function(_0x55c28b,_0xdb9af4){var _0xb3200c=getPDFPrinter();var _0x2938bc=getPDFDocDefinitionFromHTML(_0x55c28b,_0xdb9af4);var _0x5dfbbc=_0xb3200c[_0x8a82('0x39')](_0x2938bc);return writePDFDocument(_0x5dfbbc,_0xdb9af4[_0x8a82('0x1')])[_0x8a82('0x44')](function(_0xf8d515){throw _0xf8d515;});}; \ No newline at end of file +var _0x0d36=['pdfmake/src/printer','JSDOM','bluebird','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','value','fill','length','auto','body','push','concat','keys','format','name','startDate','endDate','header','before','\x20/\x20','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','isInteger','forEach','sequelize','SELECT','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.pdf','join','mkdirSync','each','pdf','%s.%s','all','zip','PDF','info','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfKitDocument','lodash','util','path','moment'];(function(_0x250d2a,_0x2983be){var _0x5738fa=function(_0x3cbde0){while(--_0x3cbde0){_0x250d2a['push'](_0x250d2a['shift']());}};_0x5738fa(++_0x2983be);}(_0x0d36,0xa4));var _0x60d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x60d3('0x0'));var fs=require('fs');var util=require(_0x60d3('0x1'));var path=require(_0x60d3('0x2'));var moment=require(_0x60d3('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x60d3('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x60d3('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x60d3('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x60d3('0x7'))(_0x60d3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x60d3('0x9')][0x2]);var QUERY=process[_0x60d3('0x9')][0x3];var PATH=process[_0x60d3('0x9')][0x4];var NAME=process[_0x60d3('0x9')][0x5];var FORMAT=_0x60d3('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x12c50c,_0x4226e9){var _0xbc3e37={'status':_0x12c50c};var _0x352b67={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4226e9){_0xbc3e37[_0x60d3('0xb')]=_0x4226e9;}return db[_0x60d3('0xc')][_0x60d3('0xd')](_0xbc3e37,_0x352b67);}function getHeaders(_0x26cafb){return _[_0x60d3('0xe')](_0x26cafb,function(_0x1be861){return{'text':_0x1be861,'style':'tableHeader'};});}function getRows(_0x53e162,_0xb75962){return _[_0x60d3('0xe')](_0xb75962,function(_0x4357ed){return _(_0x4357ed)['pick'](_0x53e162)[_0x60d3('0xe')](function(_0xf3eeed){return _0xf3eeed?_['toString'](_0xf3eeed):'';})[_0x60d3('0xf')]();});}function createTable(_0x15760c,_0x12b9c0){var _0x19e4e1={'widths':_[_0x60d3('0x10')](Array(_0x15760c[_0x60d3('0x11')]),0x91),'heights':function(_0x864e92){return _0x864e92===0x0?_0x60d3('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x46d52a=getHeaders(_0x15760c);_0x19e4e1[_0x60d3('0x13')][_0x60d3('0x14')](_0x46d52a);var _0x40e0e1=getRows(_0x15760c,_0x12b9c0);_0x19e4e1[_0x60d3('0x13')]=_0x19e4e1[_0x60d3('0x13')][_0x60d3('0x15')](_0x40e0e1);return _0x19e4e1;}function createTables(_0x8ebf21){var _0x429238=[];var _0x54381f=_['chunk'](Object[_0x60d3('0x16')](_0x8ebf21[0x0]),0x5);_0x54381f['forEach'](function(_0x28e999){_0x429238['push'](createTable(_0x28e999,_0x8ebf21));});return _0x429238;}function getPDFDocDefinition(_0x4050da){var _0xbcb1bc=util[_0x60d3('0x17')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x60d3('0x18')],moment(EXTRACTED_REPORT[_0x60d3('0x19')])[_0x60d3('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0x60d3('0x1a')])['format'](FORMAT));var _0x18e0ee=[];for(var _0x4b1776=0x0;_0x4b1776<_0x4050da[_0x60d3('0x11')];_0x4b1776++){var _0x811154=[];if(_0x4b1776===0x0){_0x811154[_0x60d3('0x14')]({'text':_0xbcb1bc,'style':_0x60d3('0x1b')});}var _0x4ebfd5={'table':_0x4050da[_0x4b1776]};if(_0x4b1776>0x0){_0x4ebfd5['pageBreak']=_0x60d3('0x1c');_0x4ebfd5['margin']=[0x0,0x46,0x0,0x0];}_0x811154[_0x60d3('0x14')](_0x4ebfd5);_0x18e0ee[_0x60d3('0x14')](_0x811154);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x18e0ee,'footer':function(_0x6f1447,_0x42c732){return{'text':_0x6f1447['toString']()+_0x60d3('0x1d')+_0x42c732,'style':'footer'};},'defaultStyle':{'font':_0x60d3('0x1e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x60d3('0x1f')},'footer':{'alignment':_0x60d3('0x20'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3e6dfe){var _0x54fdf0=0x1388;var _0x29c092;if(!_0x3e6dfe[0x0][_0x60d3('0x21')]){return analyticExtractedReport(_0x60d3('0x22'));}return db[_0x60d3('0x23')][_0x60d3('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x60d3('0x25')]})[_0x60d3('0x26')](function(_0x468303){if(_0x468303){_0x29c092=_0x468303;_0x54fdf0=_0x29c092[_0x60d3('0x25')]||0x3e8;}})[_0x60d3('0x26')](function(){var _0x18efb5=[];var _0x230434=0x0;if(_0x29c092[_0x60d3('0x27')]){if(_0x3e6dfe&&_0x3e6dfe[_0x60d3('0x11')]){var _0x509a02=_['range'](_0x3e6dfe[0x0][_0x60d3('0x21')]/_0x54fdf0);var _0x3f2b85=Number[_0x60d3('0x28')](_0x3e6dfe[0x0][_0x60d3('0x21')]/_0x54fdf0)?_0x3e6dfe[0x0][_0x60d3('0x21')]%_0x54fdf0:0x0;_0x509a02[_0x60d3('0x29')](function(_0x5779e1){if(_0x5779e1>0x0){_0x230434+=_0x54fdf0;}_0x18efb5[_0x60d3('0x14')](dbH[_0x60d3('0x2a')]['query'](util[_0x60d3('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x54fdf0,_0x230434),{'type':dbH[_0x60d3('0x2a')]['QueryTypes'][_0x60d3('0x2b')]}));});if(_0x3f2b85>0x0){_0x230434+=_0x54fdf0;_0x18efb5[_0x60d3('0x14')](dbH[_0x60d3('0x2a')][_0x60d3('0x2c')](util[_0x60d3('0x17')](_0x60d3('0x2d'),QUERY,_0x3f2b85,_0x230434),{'type':dbH[_0x60d3('0x2a')][_0x60d3('0x2e')][_0x60d3('0x2b')]}));}}}else{_0x18efb5[_0x60d3('0x14')](dbH[_0x60d3('0x2a')]['query'](QUERY,{'type':dbH[_0x60d3('0x2a')][_0x60d3('0x2e')]['SELECT']}));}var _0x575dc6=path[_0x60d3('0x2f')](PATH);var _0x100d80=path[_0x60d3('0x30')](PATH,_0x60d3('0x31'));var _0x36fda9=_0x29c092[_0x60d3('0x27')]&&_0x18efb5['length']>0x1;var _0x44446a=[];if(!fs['existsSync'](path[_0x60d3('0x32')](_0x575dc6,_0x100d80))&&_0x36fda9){fs[_0x60d3('0x33')](path[_0x60d3('0x32')](_0x575dc6,_0x100d80));}return BPromise[_0x60d3('0x34')](_0x18efb5,function(_0x504a06){_0x44446a[_0x60d3('0x14')](_0x504a06);})[_0x60d3('0x26')](function(){var _0x2121e4=[];for(var _0x4d8fd2=0x0;_0x4d8fd2<_0x44446a['length'];_0x4d8fd2+=0x1){var _0x226862=_0x44446a[_0x4d8fd2];var _0x573682=createTables(_['flatten'](_0x226862));var _0x3bef95;var _0x3ffb02=getPDFDocDefinition(_0x573682);var _0x3a0231=getPDFPrinter();var _0x3a7b3f=_0x3a0231['createPdfKitDocument'](_0x3ffb02);if(_0x36fda9){_0x3bef95=path['join'](_0x575dc6,_0x100d80,util['format']('%s%d.%s',_0x100d80,_0x4d8fd2,_0x60d3('0x35')));}else{_0x3bef95=path[_0x60d3('0x32')](_0x575dc6,util[_0x60d3('0x17')](_0x60d3('0x36'),_0x100d80,'pdf'));}_0x2121e4[_0x60d3('0x14')](writePDFDocument(_0x3a7b3f,_0x3bef95));}return Promise[_0x60d3('0x37')](_0x2121e4);})[_0x60d3('0x26')](function(){if(_0x36fda9){return new Promise(function(_0x15fc7c){zipdir(path[_0x60d3('0x32')](_0x575dc6,_0x100d80),{'saveTo':path[_0x60d3('0x32')](_0x575dc6,util[_0x60d3('0x17')](_0x60d3('0x36'),_0x100d80,_0x60d3('0x38')))},function(){rimraf(path[_0x60d3('0x32')](_0x575dc6,_0x100d80),function(){});_0x15fc7c('zip\x20finished');});});}})[_0x60d3('0x26')](function(){if(!_0x36fda9)return;rimraf(path[_0x60d3('0x32')](_0x575dc6,_0x100d80),function(){});})[_0x60d3('0x26')](function(){logger['info'](util[_0x60d3('0x17')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x60d3('0x39')));return analyticExtractedReport('Completed',_0x36fda9?util[_0x60d3('0x17')]('%s.%s',_0x100d80,_0x36fda9?_0x60d3('0x38'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x60d3('0x3a')](util[_0x60d3('0x17')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x60d3('0x39')));return db[_0x60d3('0xc')][_0x60d3('0x3b')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x60d3('0x26')](function(_0x5dbd8d){EXTRACTED_REPORT=_0x5dbd8d;return dbH[_0x60d3('0x2a')][_0x60d3('0x2c')](util[_0x60d3('0x17')](_0x60d3('0x3c'),QUERY),{'type':dbH[_0x60d3('0x2a')][_0x60d3('0x2e')][_0x60d3('0x2b')]});})[_0x60d3('0x26')](extractReport)[_0x60d3('0x3d')](function(_0x3a2575){logger[_0x60d3('0x3a')](util['format'](_0x60d3('0x3e'),EXTRACTED_REPORT_ID,_0x60d3('0x39')),util[_0x60d3('0x3f')](_0x3a2575,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x60d3('0x40'));})[_0x60d3('0x41')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x28ffdc=new PdfPrinter({'Arial':{'normal':__dirname+_0x60d3('0x42'),'bold':__dirname+_0x60d3('0x43'),'italics':__dirname+_0x60d3('0x44'),'bolditalics':__dirname+_0x60d3('0x45')}});return _0x28ffdc;}function getPDFDocDefinitionFromHTML(_0x27a694,_0x59175d){var _0x4093e4=util['format'](_0x60d3('0x46'),_0x59175d[_0x60d3('0x47')],_0x59175d[_0x60d3('0x48')]);var _0x4f0165=moment()[_0x60d3('0x17')](_0x60d3('0x49'))[_0x60d3('0x4a')]();var _0xc41171=htmlToPdfmake(_0x27a694,{'window':window,'tableAutoSize':!![]});return{'content':[_0xc41171],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x60d3('0x4b'),'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':_0x60d3('0x4b')}},'header':function(){return[{'text':_0x60d3('0x4c'),'style':_0x60d3('0x1b')}];},'footer':function(_0xb06bc6,_0x4ae17f){return[{'text':util['format'](_0x60d3('0x4d'),_0x4093e4,_0xb06bc6,_0x4ae17f,_0x4f0165),'style':'footer'}];}};}function writePDFDocument(_0x44155c,_0x9761d9){return new Promise(function(_0x329a84,_0x85a19f){var _0x2226d5=_0x44155c[_0x60d3('0x4e')](fs[_0x60d3('0x4f')](_0x9761d9));_0x2226d5['on'](_0x60d3('0x50'),function(){_0x329a84(_0x60d3('0x50'));});_0x2226d5['on'](_0x60d3('0x51'),function(_0x4c06a8){_0x85a19f(_0x4c06a8);});_0x44155c[_0x60d3('0x52')]();});}exports['createPdfFromHTML']=function(_0x1564ff,_0x138a16){var _0x560283=getPDFPrinter();var _0x44ad1d=getPDFDocDefinitionFromHTML(_0x1564ff,_0x138a16);var _0xe3780c=_0x560283[_0x60d3('0x53')](_0x44ad1d);return writePDFDocument(_0xe3780c,_0x138a16['path'])['catch'](function(_0x2fa05e){throw _0x2fa05e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b5ea5dc..460860f 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 _0xbefc=['splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','length','existsSync','mkdirSync','each','join','%s%d.%s','%s.%s','binary','XLSX','Completed','zip','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xbefc,0x195));var _0xcbef=function(_0x2a0277,_0x2dad54){_0x2a0277=_0x2a0277-0x0;var _0xac79f8=_0xbefc[_0x2a0277];return _0xac79f8;};'use strict';var util=require('util');var path=require(_0xcbef('0x0'));var _=require(_0xcbef('0x1'));var fs=require('fs');var json2xls=require(_0xcbef('0x2'));var BPromise=require(_0xcbef('0x3'));var zipdir=require(_0xcbef('0x4'));var rimraf=require(_0xcbef('0x5'));var db=require(_0xcbef('0x6'))['db'];var dbH=require(_0xcbef('0x6'))[_0xcbef('0x7')];var logger=require(_0xcbef('0x8'))(_0xcbef('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xcbef('0xa')][0x2]);var QUERY=process[_0xcbef('0xa')][0x3];var PATH=process[_0xcbef('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3137a4,_0x36eae6){var _0x3c76cd={'status':_0x3137a4};var _0x10e840={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x36eae6){_0x3c76cd[_0xcbef('0xb')]=_0x36eae6;}return db[_0xcbef('0xc')][_0xcbef('0xd')](_0x3c76cd,_0x10e840);}function main(){var _0xeea55e=0x1388;var _0x559a65;logger[_0xcbef('0xe')](util[_0xcbef('0xf')](_0xcbef('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xcbef('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcbef('0x12'),_0xcbef('0x13')]})[_0xcbef('0x14')](function(_0x2fab8b){if(_0x2fab8b){_0x559a65=_0x2fab8b;_0xeea55e=_0x559a65[_0xcbef('0x13')]||0x1388;}})[_0xcbef('0x14')](function(){return dbH['sequelize'][_0xcbef('0x15')](util[_0xcbef('0xf')](_0xcbef('0x16'),QUERY),{'type':dbH[_0xcbef('0x17')][_0xcbef('0x18')][_0xcbef('0x19')]});})[_0xcbef('0x14')](function(_0x48f677){if(!_0x48f677[0x0]['num']){return analyticExtractedReport(_0xcbef('0x1a'));}var _0x202d25=[];var _0x38ddc2=0x0;if(_0x559a65['split']){if(_0x48f677&&_0x48f677['length']){var _0x79d2fb=_[_0xcbef('0x1b')](_0x48f677[0x0][_0xcbef('0x1c')]/_0xeea55e);var _0x5b02be=Number[_0xcbef('0x1d')](_0x48f677[0x0][_0xcbef('0x1c')]/_0xeea55e)?_0x48f677[0x0]['num']%_0xeea55e:0x0;_0x79d2fb[_0xcbef('0x1e')](function(_0x325cf6){if(_0x325cf6>0x0){_0x38ddc2+=_0xeea55e;}_0x202d25['push'](dbH['sequelize'][_0xcbef('0x15')](util[_0xcbef('0xf')](_0xcbef('0x1f'),QUERY,_0xeea55e,_0x38ddc2),{'type':dbH['sequelize'][_0xcbef('0x18')][_0xcbef('0x19')]}));});if(_0x5b02be>0x0){_0x38ddc2+=_0xeea55e;_0x202d25[_0xcbef('0x20')](dbH['sequelize'][_0xcbef('0x15')](util[_0xcbef('0xf')](_0xcbef('0x1f'),QUERY,_0x5b02be,_0x38ddc2),{'type':dbH['sequelize'][_0xcbef('0x18')][_0xcbef('0x19')]}));}}}else{_0x202d25[_0xcbef('0x20')](dbH[_0xcbef('0x17')][_0xcbef('0x15')](QUERY,{'type':dbH['sequelize'][_0xcbef('0x18')][_0xcbef('0x19')]}));}var _0x38be1f=path[_0xcbef('0x21')](PATH);var _0x119443=path['basename'](PATH,_0xcbef('0x22'));var _0x4e046c=_0x559a65[_0xcbef('0x12')]&&_0x202d25[_0xcbef('0x23')]>0x1;var _0xaaa05a=[];if(!fs[_0xcbef('0x24')](path['join'](_0x38be1f,_0x119443))&&_0x4e046c){fs[_0xcbef('0x25')](path['join'](_0x38be1f,_0x119443));}return BPromise[_0xcbef('0x26')](_0x202d25,function(_0x13f718){_0xaaa05a[_0xcbef('0x20')](_0x13f718);})[_0xcbef('0x14')](function(){for(var _0x5ef8ce=0x0;_0x5ef8ce<_0xaaa05a[_0xcbef('0x23')];_0x5ef8ce+=0x1){var _0x2ca2a7;var _0xd8a003=_0xaaa05a[_0x5ef8ce];if(_0x4e046c){_0x2ca2a7=path[_0xcbef('0x27')](_0x38be1f,_0x119443,util[_0xcbef('0xf')](_0xcbef('0x28'),_0x119443,_0x5ef8ce,'xlsx'));}else{_0x2ca2a7=path[_0xcbef('0x27')](_0x38be1f,util['format'](_0xcbef('0x29'),_0x119443,'xlsx'));}fs['writeFileSync'](_0x2ca2a7,json2xls(_0xd8a003),_0xcbef('0x2a'));}})[_0xcbef('0x14')](function(){if(_0x4e046c){return new Promise(function(_0x131a36){zipdir(path['join'](_0x38be1f,_0x119443),{'saveTo':path['join'](_0x38be1f,util[_0xcbef('0xf')](_0xcbef('0x29'),_0x119443,'zip'))},function(_0x2b53df,_0x55cb64){rimraf(path[_0xcbef('0x27')](_0x38be1f,_0x119443),function(){});_0x131a36('zip\x20finished');});});}})[_0xcbef('0x14')](function(){logger['info'](util[_0xcbef('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xcbef('0x2b')));return analyticExtractedReport(_0xcbef('0x2c'),_0x4e046c?util[_0xcbef('0xf')](_0xcbef('0x29'),_0x119443,_0x4e046c?_0xcbef('0x2d'):_0xcbef('0x2e')):null);});})[_0xcbef('0x2f')](function(_0x90d83f){logger[_0xcbef('0xe')](util['format'](_0xcbef('0x30'),EXTRACTED_REPORT_ID,_0xcbef('0x2b')),util[_0xcbef('0x31')](_0x90d83f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcbef('0x32'));})[_0xcbef('0x33')](function(){process[_0xcbef('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xce6b=['range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','length','existsSync','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','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','Failed','finally','exit','util','lodash','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty'];(function(_0x25fa80,_0x84a1b0){var _0x4e59b9=function(_0x58dc60){while(--_0x58dc60){_0x25fa80['push'](_0x25fa80['shift']());}};_0x4e59b9(++_0x84a1b0);}(_0xce6b,0x1d9));var _0xbce6=function(_0x505e28,_0x29391c){_0x505e28=_0x505e28-0x0;var _0x23aaa5=_0xce6b[_0x505e28];return _0x23aaa5;};'use strict';var util=require(_0xbce6('0x0'));var path=require('path');var _=require(_0xbce6('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xbce6('0x2'));var rimraf=require(_0xbce6('0x3'));var db=require(_0xbce6('0x4'))['db'];var dbH=require(_0xbce6('0x4'))[_0xbce6('0x5')];var logger=require('../../config/logger')(_0xbce6('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbce6('0x7')][0x2]);var QUERY=process[_0xbce6('0x7')][0x3];var PATH=process[_0xbce6('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d37f9,_0xa45808){var _0x157f2d={'status':_0x5d37f9};var _0x482b3c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa45808){_0x157f2d[_0xbce6('0x8')]=_0xa45808;}return db[_0xbce6('0x9')][_0xbce6('0xa')](_0x157f2d,_0x482b3c);}function main(){var _0x5f2b7b=0x1388;var _0x5a826b;logger[_0xbce6('0xb')](util[_0xbce6('0xc')](_0xbce6('0xd'),EXTRACTED_REPORT_ID,_0xbce6('0xe')));return db[_0xbce6('0xf')][_0xbce6('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbce6('0x11'),_0xbce6('0x12')]})['then'](function(_0x1f1e94){if(_0x1f1e94){_0x5a826b=_0x1f1e94;_0x5f2b7b=_0x5a826b['splitSizeXlsx']||0x1388;}})[_0xbce6('0x13')](function(){return dbH[_0xbce6('0x14')][_0xbce6('0x15')](util['format'](_0xbce6('0x16'),QUERY),{'type':dbH['sequelize'][_0xbce6('0x17')][_0xbce6('0x18')]});})[_0xbce6('0x13')](function(_0x4e2d03){if(!_0x4e2d03[0x0][_0xbce6('0x19')]){return analyticExtractedReport(_0xbce6('0x1a'));}var _0x372150=[];var _0x1e276f=0x0;if(_0x5a826b['split']){if(_0x4e2d03&&_0x4e2d03['length']){var _0x485fd0=_[_0xbce6('0x1b')](_0x4e2d03[0x0]['num']/_0x5f2b7b);var _0x383595=Number[_0xbce6('0x1c')](_0x4e2d03[0x0]['num']/_0x5f2b7b)?_0x4e2d03[0x0][_0xbce6('0x19')]%_0x5f2b7b:0x0;_0x485fd0['forEach'](function(_0x1bc7f2){if(_0x1bc7f2>0x0){_0x1e276f+=_0x5f2b7b;}_0x372150['push'](dbH[_0xbce6('0x14')][_0xbce6('0x15')](util[_0xbce6('0xc')](_0xbce6('0x1d'),QUERY,_0x5f2b7b,_0x1e276f),{'type':dbH['sequelize'][_0xbce6('0x17')][_0xbce6('0x18')]}));});if(_0x383595>0x0){_0x1e276f+=_0x5f2b7b;_0x372150[_0xbce6('0x1e')](dbH[_0xbce6('0x14')]['query'](util[_0xbce6('0xc')](_0xbce6('0x1d'),QUERY,_0x383595,_0x1e276f),{'type':dbH[_0xbce6('0x14')][_0xbce6('0x17')]['SELECT']}));}}}else{_0x372150[_0xbce6('0x1e')](dbH[_0xbce6('0x14')][_0xbce6('0x15')](QUERY,{'type':dbH['sequelize'][_0xbce6('0x17')][_0xbce6('0x18')]}));}var _0x4c7c87=path[_0xbce6('0x1f')](PATH);var _0x3eeeac=path['basename'](PATH,'.xlsx');var _0x200411=_0x5a826b[_0xbce6('0x11')]&&_0x372150[_0xbce6('0x20')]>0x1;var _0xc56a7=[];if(!fs[_0xbce6('0x21')](path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac))&&_0x200411){fs[_0xbce6('0x23')](path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac));}return BPromise['each'](_0x372150,function(_0x242a25){_0xc56a7[_0xbce6('0x1e')](_0x242a25);})[_0xbce6('0x13')](function(){for(var _0x566b45=0x0;_0x566b45<_0xc56a7[_0xbce6('0x20')];_0x566b45+=0x1){var _0x49d6df;var _0x5a1173=_0xc56a7[_0x566b45];if(_0x200411){_0x49d6df=path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac,util[_0xbce6('0xc')](_0xbce6('0x24'),_0x3eeeac,_0x566b45,_0xbce6('0x25')));}else{_0x49d6df=path[_0xbce6('0x22')](_0x4c7c87,util[_0xbce6('0xc')]('%s.%s',_0x3eeeac,_0xbce6('0x25')));}fs[_0xbce6('0x26')](_0x49d6df,json2xls(_0x5a1173),_0xbce6('0x27'));}})['then'](function(){if(_0x200411){return new Promise(function(_0x1e7bf1){zipdir(path['join'](_0x4c7c87,_0x3eeeac),{'saveTo':path[_0xbce6('0x22')](_0x4c7c87,util[_0xbce6('0xc')](_0xbce6('0x28'),_0x3eeeac,_0xbce6('0x29')))},function(_0x407454,_0x484d22){rimraf(path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac),function(){});_0x1e7bf1(_0xbce6('0x2a'));});});}})[_0xbce6('0x13')](function(){logger['info'](util[_0xbce6('0xc')](_0xbce6('0x2b'),EXTRACTED_REPORT_ID,_0xbce6('0xe')));return analyticExtractedReport(_0xbce6('0x2c'),_0x200411?util[_0xbce6('0xc')](_0xbce6('0x28'),_0x3eeeac,_0x200411?_0xbce6('0x29'):_0xbce6('0x25')):null);});})[_0xbce6('0x2d')](function(_0x11dcf4){logger['info'](util[_0xbce6('0xc')](_0xbce6('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x11dcf4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbce6('0x2f'));})[_0xbce6('0x30')](function(){process[_0xbce6('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7629dda..3d62571 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 _0x7043=['transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','hasOwnProperty','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','Hangup'];(function(_0x2fd8e2,_0x8cbd99){var _0x35bdb4=function(_0x5248af){while(--_0x5248af){_0x2fd8e2['push'](_0x2fd8e2['shift']());}};_0x35bdb4(++_0x8cbd99);}(_0x7043,0x179));var _0x3704=function(_0x425b3e,_0xa90a2e){_0x425b3e=_0x425b3e-0x0;var _0x36c129=_0x7043[_0x425b3e];return _0x36c129;};'use strict';var _=require(_0x3704('0x0'));var util=require(_0x3704('0x1'));function rewrite(_0x64076d,_0x201e2d){var _0x5d0300=this;return _0x64076d[_0x3704('0x2')][_0x3704('0x3')][_0x3704('0x4')]({'raw':!![]})['then'](function(_0x5e4ee6){_0x5d0300[_0x3704('0x5')]=_0x5e4ee6;return _0x64076d['models'][_0x3704('0x6')]['findAll']({'where':{'IntervalId':_0x201e2d['IntervalId']},'raw':!![]});})[_0x3704('0x7')](function(_0x39d911){return _0x64076d[_0x3704('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x3704('0x8')](_[_0x3704('0x9')](_0x39d911,_0x3704('0xa')))}},'order':[{'raw':_0x3704('0xb')}],'raw':!![]});})[_0x3704('0x7')](function(_0xe4d90f){var _0x156c5d=_[_0x3704('0xc')](_0xe4d90f,{'priority':'1'});var _0x4f3ac3=_['filter'](_0xe4d90f,{'isApp':0x1});var _0x3c7b47=_[_0x3704('0xd')](_0x4f3ac3,_0x3704('0xa'));var _0x57497d=[_0x3704('0xe'),_0x3704('0xf')];var _0x13e3cd=[];var _0xf5510d=[];for(var _0x184523 in _0x3c7b47){if(_0x3c7b47['hasOwnProperty'](_0x184523)){_0x5d0300[_0x3704('0x10')]=0x2;_0x5d0300[_0x3704('0x11')]=[];_0x5d0300[_0x3704('0x12')]=_[_0x3704('0x13')](_0x156c5d,{'exten':_0x3c7b47[_0x184523][0x0]['exten']});_0x5d0300['extensions'][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':util['format'](_0x3704('0x17'),_0x3c7b47[_0x184523][0x0][_0x3704('0x15')]),'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});if(_0x3c7b47[_0x184523][0x0][_0x3704('0x15')]===_0x3704('0x1a')){_0x5d0300[_0x3704('0x11')][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':'Set','appdata':_0x3704('0x1b')+_0x3c7b47[_0x184523][0x0][_0x3704('0x19')],'context':_0x3c7b47[_0x184523][0x0]['context'],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0]['VoiceExtensionId']});}else if(_0x3c7b47[_0x184523][0x0][_0x3704('0x15')]===_0x3704('0x1c')){if(_0x5d0300[_0x3704('0x12')]){_0x5d0300['extensions'][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':_0x3704('0x1d')+(_0x5d0300[_0x3704('0x12')][_0x3704('0x1e')]?_0x3704('0x1f')+_0x5d0300[_0x3704('0x12')][_0x3704('0x1e')]+'}':_0x3704('0x20')),'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300['priority']++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});}_0x5d0300[_0x3704('0x11')][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':_0x3704('0x1b')+_0x3c7b47[_0x184523][0x0]['VoiceExtensionId'],'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0]['exten'],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});var _0x526d93=_0x5d0300[_0x3704('0x10')]++;_0x5d0300[_0x3704('0x11')][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':'ExecIf','appdata':_0x3704('0x21')+(_0x526d93+0x2)+'):Goto('+(_0x526d93+0x1)+')','context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x526d93,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});if(_0x5d0300[_0x3704('0x12')]){_0x5d0300[_0x3704('0x11')]['push']({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':'Set','appdata':_0x5d0300[_0x3704('0x12')][_0x3704('0x1e')]?_0x3704('0x22')+_0x5d0300['extension'][_0x3704('0x1e')]+'}':_0x3704('0x23'),'context':_0x3c7b47[_0x184523][0x0]['context'],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});}_0x5d0300[_0x3704('0x11')]['push']({'type':_0x3c7b47[_0x184523][0x0]['type'],'app':_0x3704('0x16'),'appdata':_0x3704('0x24')+_0x3c7b47[_0x184523][0x0][_0x3704('0x19')],'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});if(_0x5d0300[_0x3704('0x12')]&&_0x5d0300[_0x3704('0x12')]['hasOwnProperty'](_0x3704('0x25'))&&_0x5d0300[_0x3704('0x12')]['recordingFormat']!==_0x3704('0x26')){_0x5d0300[_0x3704('0x11')][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':_0x3704('0x27'),'context':_0x3c7b47[_0x184523][0x0]['context'],'exten':_0x3c7b47[_0x184523][0x0]['exten'],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});_0x5d0300[_0x3704('0x11')][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':_0x3704('0x28')+_0x5d0300['extension'][_0x3704('0x25')]||'wav','context':_0x3c7b47[_0x184523][0x0]['context'],'exten':_0x3c7b47[_0x184523][0x0]['exten'],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});}}_0x5d0300['extensions']['push']({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':'Set','appdata':_0x3704('0x29'),'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});_0x5d0300[_0x3704('0x11')]['push']({'type':_0x3c7b47[_0x184523][0x0]['type'],'app':_0x3704('0x16'),'appdata':_0x3704('0x2a'),'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0]['VoiceExtensionId']});_0x5d0300[_0x3704('0x11')][_0x3704('0x14')]({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':_0x3704('0x2b'),'context':_0x3c7b47[_0x184523][0x0]['context'],'exten':_0x3c7b47[_0x184523][0x0][_0x3704('0xa')],'priority':_0x5d0300[_0x3704('0x10')]++,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});for(var _0x4fa5ce=0x0,_0x29a478=0x0;_0x4fa5ce<_0x3c7b47[_0x184523][_0x3704('0x2c')];_0x4fa5ce+=0x1,_0x29a478=0x0){var _0x23ff6b=_0x3c7b47[_0x184523][_0x4fa5ce];if(_0x23ff6b[_0x3704('0x15')]){_0x23ff6b['type']=_0x23ff6b['type'][_0x3704('0x2d')]();}var _0x5dd616=[];var _0x15f500=[];delete _0x23ff6b['id'];delete _0x23ff6b[_0x3704('0x2e')];delete _0x23ff6b['updatedAt'];var _0x454f6a=_0x23ff6b[_0x3704('0x2f')]!==_0x3704('0x30')?[_0x23ff6b[_0x3704('0x2f')]]:_0x23ff6b['IntervalId']?_[_0x3704('0x9')](_[_0x3704('0xc')](_0x5d0300['intervals'],{'IntervalId':_0x23ff6b[_0x3704('0x31')]}),'interval'):[];if(_0x23ff6b[_0x3704('0x32')](_0x3704('0x33'))){if(_0x23ff6b[_0x3704('0x33')]&&_0x23ff6b[_0x3704('0x33')]!=='--'){_0x5dd616[_0x3704('0x14')]({'type':_0x23ff6b[_0x3704('0x15')],'app':'Set','appdata':_0x3704('0x34')+_0x23ff6b['tag'],'context':_0x23ff6b[_0x3704('0x18')],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a[_0x3704('0x2c')]+_0x5d0300[_0x3704('0x10')]+_0x29a478++,'VoiceExtensionId':_0x23ff6b[_0x3704('0x19')]});}}if(_0x23ff6b[_0x3704('0x15')]===_0x3704('0x1c')&&_0x23ff6b['hasOwnProperty'](_0x3704('0x35'))){if(_0x23ff6b[_0x3704('0x35')]){_0x5dd616['push']({'type':_0x23ff6b['type'],'app':_0x3704('0x36'),'appdata':_0x3704('0x37')+_0x23ff6b[_0x3704('0x35')]+')','context':_0x23ff6b[_0x3704('0x18')],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a['length']+_0x5d0300[_0x3704('0x10')]+_0x29a478++,'VoiceExtensionId':_0x23ff6b['VoiceExtensionId']});}else{_0x5dd616[_0x3704('0x14')]({'type':_0x23ff6b[_0x3704('0x15')],'app':_0x3704('0x36'),'appdata':_0x3704('0x38'),'context':_0x23ff6b[_0x3704('0x18')],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a[_0x3704('0x2c')]+_0x5d0300[_0x3704('0x10')]+_0x29a478++,'VoiceExtensionId':_0x23ff6b[_0x3704('0x19')]});}}if(_0x23ff6b[_0x3704('0x32')](_0x3704('0x39'))){if(_0x57497d[_0x3704('0x3a')](_0x23ff6b['app'][_0x3704('0x2d')]())>=0x0&&_0x23ff6b['appType']!==_0x3704('0x3b')){if(_0x23ff6b[_0x3704('0x39')]){_0x5dd616[_0x3704('0x14')]({'type':_0x23ff6b['type'],'app':'ExecIf','appdata':_0x3704('0x3c'),'context':_0x23ff6b['context'],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a[_0x3704('0x2c')]+_0x5d0300['priority']+_0x29a478++,'VoiceExtensionId':_0x23ff6b[_0x3704('0x19')]});_0x5dd616['push']({'type':_0x23ff6b[_0x3704('0x15')],'app':_0x3704('0x16'),'appdata':_0x3704('0x3d'),'context':_0x23ff6b[_0x3704('0x18')],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a['length']+_0x5d0300[_0x3704('0x10')]+_0x29a478++,'VoiceExtensionId':_0x23ff6b['VoiceExtensionId']});}else{_0x5dd616[_0x3704('0x14')]({'type':_0x23ff6b[_0x3704('0x15')],'app':_0x3704('0x36'),'appdata':_0x3704('0x3e'),'context':_0x23ff6b[_0x3704('0x18')],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a[_0x3704('0x2c')]+_0x5d0300['priority']+_0x29a478++,'VoiceExtensionId':_0x23ff6b[_0x3704('0x19')]});_0x5dd616[_0x3704('0x14')]({'type':_0x23ff6b['type'],'app':_0x3704('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x23ff6b['context'],'exten':_0x23ff6b[_0x3704('0xa')],'priority':_0x454f6a[_0x3704('0x2c')]+_0x5d0300[_0x3704('0x10')]+_0x29a478++,'VoiceExtensionId':_0x23ff6b[_0x3704('0x19')]});}}}for(var _0x2bce70=0x0;_0x2bce70<_0x454f6a['length'];_0x2bce70+=0x1){var _0x27476e=_0x5d0300[_0x3704('0x10')]+_0x454f6a[_0x3704('0x2c')];var _0x3cc3b8=_0x2bce70===_0x454f6a[_0x3704('0x2c')]-0x1?_0x5d0300['priority']+_0x5dd616[_0x3704('0x2c')]+_0x15f500[_0x3704('0x2c')]+0x2:_0x5d0300[_0x3704('0x10')]+_0x2bce70+0x1;_0x5dd616['splice'](_0x2bce70,0x0,{'type':_0x23ff6b['type'],'app':'GotoIfTime','appdata':_0x454f6a[_0x2bce70]+'?'+_0x23ff6b[_0x3704('0x18')]+',${EXTEN},'+_0x27476e+':'+_0x23ff6b['context']+_0x3704('0x3f')+_0x3cc3b8,'exten':_0x23ff6b[_0x3704('0xa')],'context':_0x23ff6b[_0x3704('0x18')],'priority':_0x5d0300['priority']+_0x2bce70,'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});}_0x23ff6b[_0x3704('0x10')]=_0x5dd616[_0x3704('0x2c')]?_['last'](_0x5dd616)[_0x3704('0x10')]+0x1:_0x5d0300[_0x3704('0x10')];_0x5d0300[_0x3704('0x10')]=(_0x15f500['length']?_[_0x3704('0x40')](_0x15f500)[_0x3704('0x10')]:_0x23ff6b[_0x3704('0x10')])+0x1;_0x5d0300['extensions']=_[_0x3704('0x41')](_0x5d0300[_0x3704('0x11')],_0x5dd616,[_0x23ff6b],_0x15f500);}_0x5d0300[_0x3704('0x11')]['push']({'type':_0x3c7b47[_0x184523][0x0][_0x3704('0x15')],'app':_0x3704('0x42'),'exten':_0x3c7b47[_0x184523][0x0]['exten'],'context':_0x3c7b47[_0x184523][0x0][_0x3704('0x18')],'priority':_0x5d0300[_0x3704('0x10')],'VoiceExtensionId':_0x3c7b47[_0x184523][0x0][_0x3704('0x19')]});_0x13e3cd['push'](_0x3c7b47[_0x184523][0x0]['VoiceExtensionId']);_0xf5510d=_[_0x3704('0x41')](_0xf5510d,_0x5d0300[_0x3704('0x11')]);}}return _0x64076d[_0x3704('0x43')](function(_0x8781b3){return _0x64076d[_0x3704('0x2')][_0x3704('0x6')][_0x3704('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x13e3cd}},'transaction':_0x8781b3})[_0x3704('0x7')](function(_0x4b523a){return _0x64076d[_0x3704('0x2')]['VoiceExtension'][_0x3704('0x45')](_[_0x3704('0x46')](_0xf5510d,_0x3704('0x10')),{'transaction':_0x8781b3});});});})[_0x3704('0x47')](function(_0x1b60c5){console[_0x3704('0x48')](_0x1b60c5);});}exports[_0x3704('0x49')]=rewrite; \ No newline at end of file +var _0x26b6=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','bulkCreate','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom'];(function(_0x26eae1,_0x210fc9){var _0x459286=function(_0x47220c){while(--_0x47220c){_0x26eae1['push'](_0x26eae1['shift']());}};_0x459286(++_0x210fc9);}(_0x26b6,0x128));var _0x626b=function(_0x39ac05,_0x41ade5){_0x39ac05=_0x39ac05-0x0;var _0x3426f8=_0x26b6[_0x39ac05];return _0x3426f8;};'use strict';var _=require(_0x626b('0x0'));var util=require(_0x626b('0x1'));function rewrite(_0x1aa958,_0x273ed5){var _0x49512c=this;return _0x1aa958[_0x626b('0x2')][_0x626b('0x3')][_0x626b('0x4')]({'raw':!![]})[_0x626b('0x5')](function(_0x561e56){_0x49512c[_0x626b('0x6')]=_0x561e56;return _0x1aa958[_0x626b('0x2')][_0x626b('0x7')]['findAll']({'where':{'IntervalId':_0x273ed5[_0x626b('0x8')]},'raw':!![]});})[_0x626b('0x5')](function(_0xd4e0b3){return _0x1aa958[_0x626b('0x2')][_0x626b('0x7')][_0x626b('0x4')]({'where':{'exten':{'$in':_[_0x626b('0x9')](_[_0x626b('0xa')](_0xd4e0b3,_0x626b('0xb')))}},'order':[{'raw':_0x626b('0xc')}],'raw':!![]});})[_0x626b('0x5')](function(_0x2f4438){var _0x25dbd0=_[_0x626b('0xd')](_0x2f4438,{'priority':'1'});var _0x38f294=_[_0x626b('0xd')](_0x2f4438,{'isApp':0x1});var _0x39d11d=_['groupBy'](_0x38f294,_0x626b('0xb'));var _0x65752f=['queue',_0x626b('0xe')];var _0x41467e=[];var _0x32533c=[];for(var _0x151214 in _0x39d11d){if(_0x39d11d[_0x626b('0xf')](_0x151214)){_0x49512c[_0x626b('0x10')]=0x2;_0x49512c[_0x626b('0x11')]=[];_0x49512c[_0x626b('0x12')]=_[_0x626b('0x13')](_0x25dbd0,{'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')]});_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':util[_0x626b('0x17')]('CDR(type)=%s',_0x39d11d[_0x151214][0x0][_0x626b('0x15')]),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});if(_0x39d11d[_0x151214][0x0][_0x626b('0x15')]===_0x626b('0x1a')){_0x49512c['extensions'][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':'CDR(routeid)='+_0x39d11d[_0x151214][0x0][_0x626b('0x19')],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}else if(_0x39d11d[_0x151214][0x0]['type']===_0x626b('0x1b')){if(_0x49512c[_0x626b('0x12')]){_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x626b('0x1c')+(_0x49512c[_0x626b('0x12')]['cutdigits']?_0x626b('0x1d')+_0x49512c[_0x626b('0x12')]['cutdigits']+'}':_0x626b('0x1e')),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x1f')+_0x39d11d[_0x151214][0x0][_0x626b('0x19')],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0]['VoiceExtensionId']});var _0x1445e0=_0x49512c[_0x626b('0x10')]++;_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x20'),'appdata':_0x626b('0x21')+(_0x1445e0+0x2)+_0x626b('0x22')+(_0x1445e0+0x1)+')','context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x1445e0,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});if(_0x49512c['extension']){_0x49512c['extensions'][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x49512c[_0x626b('0x12')][_0x626b('0x23')]?_0x626b('0x24')+_0x49512c['extension'][_0x626b('0x23')]+'}':_0x626b('0x25'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x26')+_0x39d11d[_0x151214][0x0][_0x626b('0x19')],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});if(_0x49512c[_0x626b('0x12')]&&_0x49512c['extension']['hasOwnProperty']('recordingFormat')&&_0x49512c[_0x626b('0x12')][_0x626b('0x27')]!==_0x626b('0x28')){_0x49512c[_0x626b('0x11')]['push']({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x29'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c['priority']++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});_0x49512c[_0x626b('0x11')]['push']({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x49512c[_0x626b('0x12')][_0x626b('0x27')]||_0x626b('0x2a'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x2b'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c['priority']++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x626b('0x2c'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x626b('0x2d'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});for(var _0x85d0f9=0x0,_0x1669e5=0x0;_0x85d0f9<_0x39d11d[_0x151214]['length'];_0x85d0f9+=0x1,_0x1669e5=0x0){var _0x2412e4=_0x39d11d[_0x151214][_0x85d0f9];if(_0x2412e4['type']){_0x2412e4[_0x626b('0x15')]=_0x2412e4[_0x626b('0x15')]['toLowerCase']();}var _0xf64f38=[];var _0x2840c2=[];delete _0x2412e4['id'];delete _0x2412e4[_0x626b('0x2e')];delete _0x2412e4[_0x626b('0x2f')];var _0x1f3795=_0x2412e4[_0x626b('0x30')]!==_0x626b('0x31')?[_0x2412e4['interval']]:_0x2412e4[_0x626b('0x8')]?_[_0x626b('0xa')](_[_0x626b('0xd')](_0x49512c[_0x626b('0x6')],{'IntervalId':_0x2412e4['IntervalId']}),_0x626b('0x30')):[];if(_0x2412e4[_0x626b('0xf')](_0x626b('0x32'))){if(_0x2412e4[_0x626b('0x32')]&&_0x2412e4[_0x626b('0x32')]!=='--'){_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x2412e4[_0x626b('0x32')],'context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c['priority']+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}}if(_0x2412e4[_0x626b('0x15')]===_0x626b('0x1b')&&_0x2412e4['hasOwnProperty'](_0x626b('0x34'))){if(_0x2412e4[_0x626b('0x34')]){_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2412e4[_0x626b('0x34')]+')','context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}else{_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x20'),'appdata':_0x626b('0x35'),'context':_0x2412e4['context'],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}}if(_0x2412e4['hasOwnProperty'](_0x626b('0x36'))){if(_0x65752f[_0x626b('0x37')](_0x2412e4[_0x626b('0x38')]['toLowerCase']())>=0x0&&_0x2412e4[_0x626b('0x39')]!==_0x626b('0x3a')){if(_0x2412e4[_0x626b('0x36')]){_0xf64f38['push']({'type':_0x2412e4[_0x626b('0x15')],'app':'ExecIf','appdata':_0x626b('0x3b'),'context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4['exten'],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x3c'),'context':_0x2412e4['context'],'exten':_0x2412e4['exten'],'priority':_0x1f3795['length']+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4['VoiceExtensionId']});}else{_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4['type'],'app':_0x626b('0x20'),'appdata':_0x626b('0x3d'),'context':_0x2412e4['context'],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795['length']+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795['length']+_0x49512c['priority']+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}}}for(var _0x23512b=0x0;_0x23512b<_0x1f3795[_0x626b('0x33')];_0x23512b+=0x1){var _0x25bc62=_0x49512c[_0x626b('0x10')]+_0x1f3795[_0x626b('0x33')];var _0x5c1d08=_0x23512b===_0x1f3795['length']-0x1?_0x49512c[_0x626b('0x10')]+_0xf64f38[_0x626b('0x33')]+_0x2840c2[_0x626b('0x33')]+0x2:_0x49512c[_0x626b('0x10')]+_0x23512b+0x1;_0xf64f38[_0x626b('0x3e')](_0x23512b,0x0,{'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x3f'),'appdata':_0x1f3795[_0x23512b]+'?'+_0x2412e4[_0x626b('0x18')]+',${EXTEN},'+_0x25bc62+':'+_0x2412e4[_0x626b('0x18')]+_0x626b('0x40')+_0x5c1d08,'exten':_0x2412e4[_0x626b('0xb')],'context':_0x2412e4[_0x626b('0x18')],'priority':_0x49512c[_0x626b('0x10')]+_0x23512b,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}_0x2412e4[_0x626b('0x10')]=_0xf64f38[_0x626b('0x33')]?_['last'](_0xf64f38)[_0x626b('0x10')]+0x1:_0x49512c[_0x626b('0x10')];_0x49512c[_0x626b('0x10')]=(_0x2840c2['length']?_[_0x626b('0x41')](_0x2840c2)[_0x626b('0x10')]:_0x2412e4['priority'])+0x1;_0x49512c[_0x626b('0x11')]=_['concat'](_0x49512c[_0x626b('0x11')],_0xf64f38,[_0x2412e4],_0x2840c2);}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x42'),'exten':_0x39d11d[_0x151214][0x0]['exten'],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'priority':_0x49512c['priority'],'VoiceExtensionId':_0x39d11d[_0x151214][0x0]['VoiceExtensionId']});_0x41467e[_0x626b('0x14')](_0x39d11d[_0x151214][0x0][_0x626b('0x19')]);_0x32533c=_['concat'](_0x32533c,_0x49512c[_0x626b('0x11')]);}}return _0x1aa958[_0x626b('0x43')](function(_0x2bc10f){return _0x1aa958[_0x626b('0x2')][_0x626b('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x41467e}},'transaction':_0x2bc10f})[_0x626b('0x5')](function(_0x5ec5e7){return _0x1aa958[_0x626b('0x2')]['VoiceExtension'][_0x626b('0x44')](_['sortBy'](_0x32533c,'priority'),{'transaction':_0x2bc10f});});});})[_0x626b('0x45')](function(_0x5b46c0){console['error'](_0x5b46c0);});}exports[_0x626b('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f837128..3bb83ed 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 _0xe908=['VoiceQueueId','onlyIfOpen','all','get','Campaign','findAll','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','CompanyId','Duplicate\x20Contact','CmContact','create','keys','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','phone','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','createdAt','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_black','VoiceQueue','outbound','CmList','Lists','then','dialCheckDuplicateType','push','sequelize','query'];(function(_0x5a600a,_0xbdb5b7){var _0x35803c=function(_0xb61977){while(--_0xb61977){_0x5a600a['push'](_0x5a600a['shift']());}};_0x35803c(++_0xbdb5b7);}(_0xe908,0x175));var _0x8e90=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe908[_0x167cc1];return _0x10bc4b;};'use strict';var BPromise=require(_0x8e90('0x0'));var util=require(_0x8e90('0x1'));var _=require(_0x8e90('0x2'));var fs=require('fs');var squel=require(_0x8e90('0x3'));var Papa=require(_0x8e90('0x4'));var Redis=require(_0x8e90('0x5'));var db=require(_0x8e90('0x6'))['db'];var config=require(_0x8e90('0x7'));var logger=require(_0x8e90('0x8'))(_0x8e90('0x9'));config['redis']=_[_0x8e90('0xa')](config[_0x8e90('0xb')],{'host':_0x8e90('0xc'),'port':0x18eb});var socket=require(_0x8e90('0xd'))(new Redis(config['redis']));require(_0x8e90('0xe'))[_0x8e90('0xf')](socket);try{if(!process['argv'][0x2]||process[_0x8e90('0x10')][0x2]===_0x8e90('0x11')||process[_0x8e90('0x10')][0x2]==='null'){throw new Error(_0x8e90('0x12'));}var FILEPATH=process[_0x8e90('0x10')][0x2];if(!process['argv'][0x3]||process[_0x8e90('0x10')][0x3]===_0x8e90('0x11')||process[_0x8e90('0x10')][0x3]==='null'||!process[_0x8e90('0x10')][0x4]||process[_0x8e90('0x10')][0x4]==='undefined'||process[_0x8e90('0x10')][0x4]===_0x8e90('0x13')){throw new Error(_0x8e90('0x14'));}var FIELDS=_[_0x8e90('0x15')](process[_0x8e90('0x10')][0x3][_0x8e90('0x16')](','),process[_0x8e90('0x10')][0x4][_0x8e90('0x16')](','));if(!process[_0x8e90('0x10')][0x5]||process['argv'][0x5]==='undefined'||process[_0x8e90('0x10')][0x5]===_0x8e90('0x13')){throw new Error(_0x8e90('0x17'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x8e90('0x10')][0x6]&&process[_0x8e90('0x10')][0x6]!==_0x8e90('0x11')&&process[_0x8e90('0x10')][0x6]!==_0x8e90('0x13')?process[_0x8e90('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x8e90('0x10')][0x7]!==_0x8e90('0x13')?process['argv'][0x7]:null;if(!process[_0x8e90('0x10')][0x8]||process['argv'][0x8]===_0x8e90('0x11')||process[_0x8e90('0x10')][0x8]==='null'){throw new Error(_0x8e90('0x18'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2010c9){logger[_0x8e90('0x19')](_0x2010c9);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(_0x22127c,_0x4fa3e5,_0x268166,_0x4da41f){var _0x4f10c4={'message':_0x4fa3e5};_0x4f10c4[_0x22127c]=!![];if(_0x268166){_0x4f10c4[_0x8e90('0x1a')]=_0x268166;}if(_0x4da41f){_0x4f10c4[_0x8e90('0x1b')]=_0x4da41f;}return _0x4f10c4;}function isEmail(_0x142a40){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x142a40);}function checkRow(_0x57775f,_0x2bf178,_0xad0fb1){return new BPromise(function(_0x2eecdd,_0x162281){if(_[_0x8e90('0x1c')](_0x57775f)){return _0x162281(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xad0fb1));}if(_0x57775f[_0x8e90('0x1d')]&&_0x57775f[_0x8e90('0x1d')][_0x8e90('0x1e')]){var _0x4cbf46=_['map'](_0x57775f[_0x8e90('0x1d')],_0x8e90('0x1f'))[_0x8e90('0x20')](';');return _0x162281(handleCheckRowError(_0x8e90('0x19'),_0x4cbf46,null,_0xad0fb1));}var _0x23269a={};for(var _0x199d16 in FIELDS){if(FIELDS[_0x8e90('0x21')](_0x199d16)&&FIELDS[_0x199d16]){_0x23269a[_0x199d16]=_0x57775f[_0x8e90('0x22')][0x0][FIELDS[_0x199d16]]||_0x57775f[_0x8e90('0x22')][0x0]['\ufeff'+FIELDS[_0x199d16]];}}if(!_0x23269a[_0x8e90('0x23')]){return _0x162281(handleCheckRowError('error',_0x8e90('0x24'),null,_0xad0fb1));}if(!_0x23269a['phone']){return _0x162281(handleCheckRowError('error','phone\x20not\x20specified!',null,_0xad0fb1));}if(_0x23269a[_0x8e90('0x25')]){var _0x18ea6c=moment(_0x23269a['birthDate'],_0x8e90('0x26'));if(!_0x18ea6c[_0x8e90('0x27')]()){return _0x162281(handleCheckRowError(_0x8e90('0x19'),_0x8e90('0x28'),null,_0xad0fb1));}}if(_0x23269a['email']){if(!isEmail(_0x23269a['email'])){return _0x162281(handleCheckRowError(_0x8e90('0x19'),_0x8e90('0x29'),null,_0xad0fb1));}}_0x23269a['ListId']=LISTID;_0x23269a[_0x8e90('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8e90('0x1e')]&&_0x2bf178){var _0x16dada={};for(var _0x412867=0x0,_0x125f3f=DUPLICATES[_0x8e90('0x1e')];_0x412867<_0x125f3f;_0x412867+=0x1){_0x16dada[DUPLICATES[_0x412867]]=_0x23269a[DUPLICATES[_0x412867]];}var _0x3b4c8d=_['find'](_0x2bf178,_0x16dada);if(_0x3b4c8d){return _0x162281(handleCheckRowError('duplicate',_0x8e90('0x2b'),_0x3b4c8d,_0xad0fb1));}}return db[_0x8e90('0x2c')][_0x8e90('0x2d')](_0x23269a,{'raw':!![],'hooks':![],'fields':_[_0x8e90('0x2e')](_0x23269a)})['then'](function(_0x4bd683){if(DUPLICATES&&DUPLICATES[_0x8e90('0x1e')]&&_0x2bf178){_0x2bf178['push'](_['pick'](_0x23269a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4bd683['id'];return _0x2eecdd();})[_0x8e90('0x2f')](function(_0x4f1032){return _0x162281(handleCheckRowError(_0x8e90('0x19'),_0x8e90('0x30')+(_0x4f1032[_0x8e90('0x1f')]||JSON['stringify'](_0x4f1032)),null,_0xad0fb1));});});}function checkHopper(){function _0x2976ca(){return function(_0x3a9da1){logger[_0x8e90('0x19')](_0x8e90('0x31'),_0x8e90('0x32'),util[_0x8e90('0x33')](_0x3a9da1,{'showHidden':![],'depth':null}));};}var _0x54a69b=function(_0x5a85c1,_0x2080d4){var _0x2ddce6=squel[_0x8e90('0x34')]()[_0x8e90('0x35')](_0x8e90('0x36'))['fromQuery']([_0x8e90('0x37'),_0x8e90('0x38'),'ContactId','ListId',_0x2080d4,'createdAt',_0x8e90('0x39')],squel[_0x8e90('0x3a')]()[_0x8e90('0x3b')]('phone',_0x8e90('0x37'))[_0x8e90('0x3b')](_0x8e90('0x3c'),_0x8e90('0x38'))[_0x8e90('0x3b')]('id',_0x8e90('0x3d'))['field'](LISTID[_0x8e90('0x3e')](),'ListId')[_0x8e90('0x3b')](_0x5a85c1['id'][_0x8e90('0x3e')](),_0x2080d4)['field'](_0x8e90('0x3c'),_0x8e90('0x3f'))[_0x8e90('0x3b')]('NOW()',_0x8e90('0x39'))[_0x8e90('0x40')](_0x8e90('0x41'))[_0x8e90('0x42')]('deletedAt\x20IS\x20NULL')[_0x8e90('0x42')]('ListId\x20=\x20?',LISTID[_0x8e90('0x3e')]())[_0x8e90('0x42')](_0x8e90('0x43'))[_0x8e90('0x42')](_0x8e90('0x44'),squel[_0x8e90('0x3a')]()[_0x8e90('0x3b')](_0x8e90('0x37'))[_0x8e90('0x40')](_0x8e90('0x36'))['where'](_0x2080d4+_0x8e90('0x45'),_0x5a85c1['id'][_0x8e90('0x3e')]())))[_0x8e90('0x3e')]();return _0x2ddce6;};var _0xd6df77=function(_0x14eab3,_0x21b426){var _0x3176fc=squel['insert']()[_0x8e90('0x35')](_0x8e90('0x36'))[_0x8e90('0x46')]([_0x8e90('0x37'),_0x8e90('0x38'),'ContactId',_0x8e90('0x47'),_0x21b426,_0x8e90('0x3f'),_0x8e90('0x39')],squel[_0x8e90('0x3a')]()[_0x8e90('0x3b')](_0x8e90('0x37'),_0x8e90('0x37'))[_0x8e90('0x3b')](_0x8e90('0x3c'),'scheduledAt')[_0x8e90('0x3b')]('id',_0x8e90('0x3d'))['field'](LISTID[_0x8e90('0x3e')](),_0x8e90('0x47'))[_0x8e90('0x3b')](_0x14eab3['id']['toString'](),_0x21b426)[_0x8e90('0x3b')](_0x8e90('0x3c'),_0x8e90('0x3f'))['field'](_0x8e90('0x3c'),_0x8e90('0x39'))[_0x8e90('0x40')]('cm_contacts')[_0x8e90('0x42')](_0x8e90('0x48'))['where'](_0x8e90('0x49'),LISTID[_0x8e90('0x3e')]())[_0x8e90('0x42')](_0x8e90('0x4a'),squel[_0x8e90('0x4b')](hopperContacts))[_0x8e90('0x42')](_0x8e90('0x43'))[_0x8e90('0x42')](_0x8e90('0x44'),squel[_0x8e90('0x3a')]()['field'](_0x8e90('0x4c'))['from']('cm_hopper_final')[_0x8e90('0x42')](_0x21b426+_0x8e90('0x45'),_0x14eab3['id'][_0x8e90('0x3e')]()))[_0x8e90('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8e90('0x3a')]()['field'](_0x8e90('0x37'))[_0x8e90('0x40')](_0x8e90('0x36'))['where'](_0x21b426+'\x20=\x20?',_0x14eab3['id'][_0x8e90('0x3e')]())))[_0x8e90('0x3e')]();return _0x3176fc;};function _0x5ebf0d(_0x2649b1,_0x35f112){var _0x1d3143=squel[_0x8e90('0x34')]()[_0x8e90('0x35')]('cm_hopper')['fromQuery']([_0x8e90('0x37'),_0x8e90('0x38'),_0x8e90('0x3d'),'ListId',_0x35f112,'createdAt',_0x8e90('0x39')],squel[_0x8e90('0x3a')]()[_0x8e90('0x3b')]('phone','phone')[_0x8e90('0x3b')](_0x8e90('0x3c'),_0x8e90('0x38'))[_0x8e90('0x3b')]('id','ContactId')[_0x8e90('0x3b')](LISTID[_0x8e90('0x3e')](),_0x8e90('0x47'))[_0x8e90('0x3b')](_0x2649b1['id'][_0x8e90('0x3e')](),_0x35f112)[_0x8e90('0x3b')](_0x8e90('0x3c'),_0x8e90('0x3f'))[_0x8e90('0x3b')](_0x8e90('0x3c'),_0x8e90('0x39'))[_0x8e90('0x40')]('cm_contacts')[_0x8e90('0x42')](_0x8e90('0x48'))[_0x8e90('0x42')](_0x8e90('0x49'),LISTID['toString']())[_0x8e90('0x42')](_0x8e90('0x4a'),squel[_0x8e90('0x4b')](hopperContacts))[_0x8e90('0x42')](_0x8e90('0x43')))[_0x8e90('0x3e')]();return _0x1d3143;}function _0x5c2acd(_0x171d78,_0xf7c226){var _0x5721fa=squel[_0x8e90('0x34')]()[_0x8e90('0x35')](_0x8e90('0x4d'))[_0x8e90('0x46')](['phone',_0x8e90('0x3d'),_0x8e90('0x47'),_0xf7c226,_0x8e90('0x3f'),_0x8e90('0x39')],squel[_0x8e90('0x3a')]()[_0x8e90('0x3b')](_0x8e90('0x37'),_0x8e90('0x37'))[_0x8e90('0x3b')]('id','ContactId')[_0x8e90('0x3b')](LISTID[_0x8e90('0x3e')](),_0x8e90('0x47'))[_0x8e90('0x3b')](_0x171d78['id']['toString'](),_0xf7c226)[_0x8e90('0x3b')]('NOW()',_0x8e90('0x3f'))[_0x8e90('0x3b')]('NOW()',_0x8e90('0x39'))[_0x8e90('0x40')](_0x8e90('0x41'))[_0x8e90('0x42')](_0x8e90('0x48'))[_0x8e90('0x42')](_0x8e90('0x49'),LISTID['toString']())[_0x8e90('0x42')](_0x8e90('0x4a'),squel[_0x8e90('0x4b')](hopperContacts))[_0x8e90('0x42')](_0x8e90('0x43')))[_0x8e90('0x3e')]();return _0x5721fa;}return db[_0x8e90('0x4e')]['findAll']({'where':{'type':_0x8e90('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8e90('0x50')],'as':_0x8e90('0x51'),'where':{'id':LISTID}}]})[_0x8e90('0x52')](function(_0x55e1c0){var _0xfa7fbf=[];if(_0x55e1c0){var _0x1db48;for(var _0x48d691=0x0,_0xaebe20;_0x48d691<_0x55e1c0['length'];_0x48d691+=0x1){_0xaebe20=_0x55e1c0[_0x48d691]['get']({'plain':!![]});switch(_0xaebe20[_0x8e90('0x53')]){case'always':_0xfa7fbf[_0x8e90('0x54')](db[_0x8e90('0x55')][_0x8e90('0x56')](_0xd6df77(_0xaebe20,_0x8e90('0x57')))[_0x8e90('0x52')](function(){})[_0x8e90('0x2f')](_0x2976ca()));break;case _0x8e90('0x58'):_0xfa7fbf[_0x8e90('0x54')](db[_0x8e90('0x55')][_0x8e90('0x56')](_0x54a69b(_0xaebe20,'VoiceQueueId'))[_0x8e90('0x52')](function(){})['catch'](_0x2976ca()));break;default:_0xfa7fbf[_0x8e90('0x54')](db[_0x8e90('0x55')]['query'](_0x5ebf0d(_0xaebe20,_0x8e90('0x57')))['then'](function(){})[_0x8e90('0x2f')](_0x2976ca()));}}}return _0xfa7fbf;})[_0x8e90('0x59')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x8e90('0x4f')},'attributes':['id'],'include':[{'model':db[_0x8e90('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x8e90('0x52')](function(_0x5c2d81){var _0x80101c=[];if(_0x5c2d81){var _0x59bc1d;for(var _0x419b22=0x0,_0xeec26f;_0x419b22<_0x5c2d81[_0x8e90('0x1e')];_0x419b22+=0x1){_0xeec26f=_0x5c2d81[_0x419b22][_0x8e90('0x5a')]({'plain':!![]});_0x80101c[_0x8e90('0x54')](db[_0x8e90('0x55')][_0x8e90('0x56')](_0x5c2acd(_0xeec26f,_0x8e90('0x57')))['then'](function(){})[_0x8e90('0x2f')](_0x2976ca()));}}return _0x80101c;})['all']();})[_0x8e90('0x52')](function(){return db[_0x8e90('0x5b')][_0x8e90('0x5c')]({'attributes':['id',_0x8e90('0x53')],'include':[{'model':db[_0x8e90('0x50')],'as':_0x8e90('0x51'),'where':{'id':LISTID}}]})[_0x8e90('0x52')](function(_0x318221){var _0x3e51ef=[];if(_0x318221){for(var _0x433a3a=0x0,_0x5494b4;_0x433a3a<_0x318221[_0x8e90('0x1e')];_0x433a3a+=0x1){_0x5494b4=_0x318221[_0x433a3a]['get']({'plain':!![]});switch(_0x5494b4[_0x8e90('0x53')]){case _0x8e90('0x5d'):_0x3e51ef[_0x8e90('0x54')](db[_0x8e90('0x55')][_0x8e90('0x56')](_0xd6df77(_0x5494b4,_0x8e90('0x5e')))['then'](function(){})['catch'](_0x2976ca()));break;case'onlyIfOpen':_0x3e51ef[_0x8e90('0x54')](db[_0x8e90('0x55')][_0x8e90('0x56')](_0x54a69b(_0x5494b4,'CampaignId'))[_0x8e90('0x52')](function(){})[_0x8e90('0x2f')](_0x2976ca()));break;default:_0x3e51ef['push'](db[_0x8e90('0x55')][_0x8e90('0x56')](_0x5ebf0d(_0x5494b4,_0x8e90('0x5e')))['then'](function(){})[_0x8e90('0x2f')](_0x2976ca()));}}}return _0x3e51ef;})['all']();})[_0x8e90('0x52')](function(){return db[_0x8e90('0x5b')][_0x8e90('0x5c')]({'attributes':['id'],'include':[{'model':db[_0x8e90('0x50')],'as':_0x8e90('0x5f'),'where':{'id':LISTID}}]})['then'](function(_0x55c5d5){var _0x52406f=[];if(_0x55c5d5){for(var _0x54bae8=0x0,_0x20c4f3;_0x54bae8<_0x55c5d5[_0x8e90('0x1e')];_0x54bae8+=0x1){_0x20c4f3=_0x55c5d5[_0x54bae8][_0x8e90('0x5a')]({'plain':!![]});_0x52406f[_0x8e90('0x54')](db[_0x8e90('0x55')]['query'](_0x5c2acd(_0x20c4f3,_0x8e90('0x5e')))[_0x8e90('0x52')](function(){})[_0x8e90('0x2f')](_0x2976ca()));}}return _0x52406f;})['all']();})[_0x8e90('0x2f')](function(_0x53f499){logger[_0x8e90('0x19')](_0x8e90('0x60'),'generalCheckHopper',_0x53f499[_0x8e90('0x1f')]);});}var processPromises=function(_0x416ecd){return BPromise[_0x8e90('0x59')](promises)[_0x8e90('0x52')](function(_0x53eb0d){})[_0x8e90('0x2f')](function(_0x227076){logger[_0x8e90('0x19')](_0x8e90('0x61'),JSON[_0x8e90('0x62')](_0x227076));})[_0x8e90('0x63')](function(){socket[_0x8e90('0x64')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x416ecd){return _0x416ecd[_0x8e90('0x65')]();}});};var endCsv=function(){return BPromise[_0x8e90('0x66')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x8e90('0x52')](function(){socket[_0x8e90('0x64')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8e90('0x67')](FILEPATH);}catch(_0x72b908){logger[_0x8e90('0x19')](_0x8e90('0x68'),JSON[_0x8e90('0x62')](_0x72b908));}finally{process[_0x8e90('0x69')](0x0);}});};process['on'](_0x8e90('0x6a'),function(){logger['info'](_0x8e90('0x6b'));endCsv();});function main(){return BPromise[_0x8e90('0x66')]()[_0x8e90('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8e90('0x16')](',');return db['CmContact'][_0x8e90('0x5c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8e90('0x52')](function(_0x134e22){var _0x28ac82=fs[_0x8e90('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x28ac82,{'header':!![],'skipEmptyLines':!![],'step':function(_0x98dc6e,_0x32d7cc){total+=0x1;var _0x1a3943=total;promises[_0x8e90('0x54')](checkRow(_0x98dc6e,_0x134e22,_0x1a3943)[_0x8e90('0x52')](function(){success+=0x1;})[_0x8e90('0x2f')](function(_0x2413c8){if(_0x2413c8[_0x8e90('0x19')]){errors+=0x1;delete _0x2413c8[_0x8e90('0x19')];}else if(_0x2413c8[_0x8e90('0x6d')]){duplicates+=0x1;delete _0x2413c8[_0x8e90('0x6d')];}rows['push'](_0x2413c8);}));if(total%0xc8===0x0){_0x32d7cc[_0x8e90('0x6e')]();return processPromises(_0x32d7cc);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x8e90('0x6f'));endCsv();});},'error':function(_0x639a0f,_0x16fcb9){logger[_0x8e90('0x70')](_0x8e90('0x71'),JSON['stringify'](_0x639a0f));endCsv();}});})[_0x8e90('0x2f')](function(_0x58b577){logger[_0x8e90('0x19')](_0x8e90('0x72'),JSON[_0x8e90('0x62')](_0x58b577));});}main(); \ No newline at end of file +var _0xd01e=['exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','split','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','checkHopper','into','fromQuery','scheduledAt','createdAt','updatedAt','field','NOW()','ContactId','from','cm_contacts','where','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','insert','cm_hopper','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','then','get','sequelize','query','VoiceQueueId','all','outbound','Campaign','always','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0xd01e,0x1c1));var _0xed01=function(_0xbf5811,_0x497785){_0xbf5811=_0xbf5811-0x0;var _0x42d92c=_0xd01e[_0xbf5811];return _0x42d92c;};'use strict';var BPromise=require('bluebird');var util=require(_0xed01('0x0'));var _=require(_0xed01('0x1'));var fs=require('fs');var squel=require(_0xed01('0x2'));var Papa=require(_0xed01('0x3'));var Redis=require(_0xed01('0x4'));var db=require(_0xed01('0x5'))['db'];var config=require(_0xed01('0x6'));var logger=require('../../../config/logger')(_0xed01('0x7'));config[_0xed01('0x8')]=_['defaults'](config[_0xed01('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xed01('0x9'))(new Redis(config[_0xed01('0x8')]));require(_0xed01('0xa'))[_0xed01('0xb')](socket);try{if(!process[_0xed01('0xc')][0x2]||process['argv'][0x2]===_0xed01('0xd')||process['argv'][0x2]===_0xed01('0xe')){throw new Error(_0xed01('0xf'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xed01('0xd')||process[_0xed01('0xc')][0x3]==='null'||!process['argv'][0x4]||process[_0xed01('0xc')][0x4]===_0xed01('0xd')||process['argv'][0x4]==='null'){throw new Error(_0xed01('0x10'));}var FIELDS=_[_0xed01('0x11')](process[_0xed01('0xc')][0x3]['split'](','),process[_0xed01('0xc')][0x4]['split'](','));if(!process[_0xed01('0xc')][0x5]||process[_0xed01('0xc')][0x5]==='undefined'||process[_0xed01('0xc')][0x5]===_0xed01('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xed01('0xc')][0x5];var COMPANYID=process[_0xed01('0xc')][0x6]&&process['argv'][0x6]!==_0xed01('0xd')&&process[_0xed01('0xc')][0x6]!=='null'?process[_0xed01('0xc')][0x6]:null;var DUPLICATES=process[_0xed01('0xc')][0x7]&&process[_0xed01('0xc')][0x7]!=='undefined'&&process[_0xed01('0xc')][0x7]!==_0xed01('0xe')?process[_0xed01('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xed01('0xd')||process[_0xed01('0xc')][0x8]==='null'){throw new Error(_0xed01('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x12786e){logger[_0xed01('0x13')](_0x12786e);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(_0x56b868,_0x13ee88,_0x345140,_0x3010ad){var _0x3de009={'message':_0x13ee88};_0x3de009[_0x56b868]=!![];if(_0x345140){_0x3de009['contact']=_0x345140;}if(_0x3010ad){_0x3de009['index']=_0x3010ad;}return _0x3de009;}function isEmail(_0x58d800){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x58d800);}function checkRow(_0x1db380,_0x2bfc92,_0x569b85){return new BPromise(function(_0x46a603,_0x389a6c){if(_[_0xed01('0x14')](_0x1db380)){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x15'),null,_0x569b85));}if(_0x1db380['errors']&&_0x1db380[_0xed01('0x16')][_0xed01('0x17')]){var _0x331630=_[_0xed01('0x18')](_0x1db380['errors'],'message')[_0xed01('0x19')](';');return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0x331630,null,_0x569b85));}var _0x4cbcff={};for(var _0x4689fe in FIELDS){if(FIELDS['hasOwnProperty'](_0x4689fe)&&FIELDS[_0x4689fe]){_0x4cbcff[_0x4689fe]=_0x1db380[_0xed01('0x1a')][0x0][FIELDS[_0x4689fe]]||_0x1db380[_0xed01('0x1a')][0x0]['\ufeff'+FIELDS[_0x4689fe]];}}if(!_0x4cbcff[_0xed01('0x1b')]){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x1c'),null,_0x569b85));}if(!_0x4cbcff[_0xed01('0x1d')]){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x1e'),null,_0x569b85));}if(_0x4cbcff[_0xed01('0x1f')]){var _0x3fe920=moment(_0x4cbcff[_0xed01('0x1f')],_0xed01('0x20'));if(!_0x3fe920['isValid']()){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x21'),null,_0x569b85));}}if(_0x4cbcff[_0xed01('0x22')]){if(!isEmail(_0x4cbcff[_0xed01('0x22')])){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x23'),null,_0x569b85));}}_0x4cbcff[_0xed01('0x24')]=LISTID;_0x4cbcff['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xed01('0x17')]&&_0x2bfc92){var _0x549be8={};for(var _0x17d930=0x0,_0x935a5e=DUPLICATES[_0xed01('0x17')];_0x17d930<_0x935a5e;_0x17d930+=0x1){_0x549be8[DUPLICATES[_0x17d930]]=_0x4cbcff[DUPLICATES[_0x17d930]];}var _0x47e64c=_['find'](_0x2bfc92,_0x549be8);if(_0x47e64c){return _0x389a6c(handleCheckRowError(_0xed01('0x25'),_0xed01('0x26'),_0x47e64c,_0x569b85));}}return db['CmContact'][_0xed01('0x27')](_0x4cbcff,{'raw':!![],'hooks':![],'fields':_[_0xed01('0x28')](_0x4cbcff)})['then'](function(_0x15207){if(DUPLICATES&&DUPLICATES[_0xed01('0x17')]&&_0x2bfc92){_0x2bfc92[_0xed01('0x29')](_[_0xed01('0x2a')](_0x4cbcff,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15207['id'];return _0x46a603();})[_0xed01('0x2b')](function(_0x3fe63e){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x2c')+(_0x3fe63e[_0xed01('0x2d')]||JSON['stringify'](_0x3fe63e)),null,_0x569b85));});});}function checkHopper(){function _0x3cfbf1(){return function(_0x5b690e){logger[_0xed01('0x13')]('cmContact',_0xed01('0x2e'),util['inspect'](_0x5b690e,{'showHidden':![],'depth':null}));};}var _0x18d5df=function(_0x2f79d7,_0x1d65de){var _0x368b6c=squel['insert']()[_0xed01('0x2f')]('cm_hopper')[_0xed01('0x30')]([_0xed01('0x1d'),_0xed01('0x31'),'ContactId',_0xed01('0x24'),_0x1d65de,_0xed01('0x32'),_0xed01('0x33')],squel['select']()[_0xed01('0x34')](_0xed01('0x1d'),_0xed01('0x1d'))[_0xed01('0x34')](_0xed01('0x35'),_0xed01('0x31'))[_0xed01('0x34')]('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID['toString'](),_0xed01('0x24'))[_0xed01('0x34')](_0x2f79d7['id']['toString'](),_0x1d65de)['field']('NOW()',_0xed01('0x32'))['field'](_0xed01('0x35'),'updatedAt')[_0xed01('0x37')](_0xed01('0x38'))[_0xed01('0x39')]('deletedAt\x20IS\x20NULL')[_0xed01('0x39')]('ListId\x20=\x20?',LISTID[_0xed01('0x3a')]())[_0xed01('0x39')](_0xed01('0x3b'))[_0xed01('0x39')](_0xed01('0x3c'),squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x1d'))[_0xed01('0x37')]('cm_hopper')[_0xed01('0x39')](_0x1d65de+'\x20=\x20?',_0x2f79d7['id'][_0xed01('0x3a')]())))[_0xed01('0x3a')]();return _0x368b6c;};var _0x25964f=function(_0x483b16,_0x12d97d){var _0x12af2c=squel[_0xed01('0x3e')]()['into'](_0xed01('0x3f'))[_0xed01('0x30')](['phone',_0xed01('0x31'),_0xed01('0x36'),'ListId',_0x12d97d,_0xed01('0x32'),'updatedAt'],squel['select']()[_0xed01('0x34')](_0xed01('0x1d'),'phone')['field'](_0xed01('0x35'),'scheduledAt')['field']('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID[_0xed01('0x3a')](),_0xed01('0x24'))[_0xed01('0x34')](_0x483b16['id'][_0xed01('0x3a')](),_0x12d97d)[_0xed01('0x34')]('NOW()',_0xed01('0x32'))['field'](_0xed01('0x35'),_0xed01('0x33'))[_0xed01('0x37')]('cm_contacts')[_0xed01('0x39')](_0xed01('0x40'))[_0xed01('0x39')](_0xed01('0x41'),LISTID['toString']())[_0xed01('0x39')](_0xed01('0x42'),squel[_0xed01('0x43')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xed01('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x44'))[_0xed01('0x37')](_0xed01('0x45'))[_0xed01('0x39')](_0x12d97d+_0xed01('0x46'),_0x483b16['id'][_0xed01('0x3a')]()))['where'](_0xed01('0x3c'),squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x1d'))['from'](_0xed01('0x3f'))['where'](_0x12d97d+_0xed01('0x46'),_0x483b16['id'][_0xed01('0x3a')]())))[_0xed01('0x3a')]();return _0x12af2c;};function _0x3e01e6(_0x5ca582,_0x3be42b){var _0x28d0ff=squel[_0xed01('0x3e')]()[_0xed01('0x2f')](_0xed01('0x3f'))['fromQuery']([_0xed01('0x1d'),_0xed01('0x31'),_0xed01('0x36'),_0xed01('0x24'),_0x3be42b,_0xed01('0x32'),_0xed01('0x33')],squel[_0xed01('0x3d')]()['field'](_0xed01('0x1d'),_0xed01('0x1d'))[_0xed01('0x34')](_0xed01('0x35'),'scheduledAt')[_0xed01('0x34')]('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID[_0xed01('0x3a')](),_0xed01('0x24'))[_0xed01('0x34')](_0x5ca582['id'][_0xed01('0x3a')](),_0x3be42b)[_0xed01('0x34')](_0xed01('0x35'),_0xed01('0x32'))[_0xed01('0x34')](_0xed01('0x35'),'updatedAt')[_0xed01('0x37')](_0xed01('0x38'))[_0xed01('0x39')](_0xed01('0x40'))[_0xed01('0x39')](_0xed01('0x41'),LISTID[_0xed01('0x3a')]())[_0xed01('0x39')](_0xed01('0x42'),squel['str'](hopperContacts))['where'](_0xed01('0x3b')))['toString']();return _0x28d0ff;}function _0x1f45bc(_0x1ba812,_0x57f49c){var _0x4fb495=squel['insert']()[_0xed01('0x2f')](_0xed01('0x47'))['fromQuery']([_0xed01('0x1d'),_0xed01('0x36'),_0xed01('0x24'),_0x57f49c,'createdAt','updatedAt'],squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x1d'),_0xed01('0x1d'))[_0xed01('0x34')]('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID['toString'](),'ListId')['field'](_0x1ba812['id']['toString'](),_0x57f49c)[_0xed01('0x34')]('NOW()',_0xed01('0x32'))['field'](_0xed01('0x35'),_0xed01('0x33'))[_0xed01('0x37')](_0xed01('0x38'))[_0xed01('0x39')](_0xed01('0x40'))['where']('ListId\x20=\x20?',LISTID[_0xed01('0x3a')]())[_0xed01('0x39')](_0xed01('0x42'),squel[_0xed01('0x43')](hopperContacts))[_0xed01('0x39')](_0xed01('0x3b')))[_0xed01('0x3a')]();return _0x4fb495;}return db[_0xed01('0x48')][_0xed01('0x49')]({'where':{'type':'outbound'},'attributes':['id',_0xed01('0x4a')],'include':[{'model':db[_0xed01('0x4b')],'as':_0xed01('0x4c'),'where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x2da0c3){var _0x459e7e=[];if(_0x2da0c3){var _0x4c445e;for(var _0xcf7600=0x0,_0x231cc4;_0xcf7600<_0x2da0c3[_0xed01('0x17')];_0xcf7600+=0x1){_0x231cc4=_0x2da0c3[_0xcf7600][_0xed01('0x4e')]({'plain':!![]});switch(_0x231cc4[_0xed01('0x4a')]){case'always':_0x459e7e[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x25964f(_0x231cc4,_0xed01('0x51')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;case'onlyIfOpen':_0x459e7e[_0xed01('0x29')](db[_0xed01('0x4f')]['query'](_0x18d5df(_0x231cc4,_0xed01('0x51')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;default:_0x459e7e[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x3e01e6(_0x231cc4,_0xed01('0x51')))['then'](function(){})[_0xed01('0x2b')](_0x3cfbf1()));}}}return _0x459e7e;})[_0xed01('0x52')]()[_0xed01('0x4d')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xed01('0x53')},'attributes':['id'],'include':[{'model':db[_0xed01('0x4b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x1d9f8f){var _0x43d976=[];if(_0x1d9f8f){var _0x570e50;for(var _0x4f33a7=0x0,_0x372499;_0x4f33a7<_0x1d9f8f[_0xed01('0x17')];_0x4f33a7+=0x1){_0x372499=_0x1d9f8f[_0x4f33a7][_0xed01('0x4e')]({'plain':!![]});_0x43d976['push'](db[_0xed01('0x4f')][_0xed01('0x50')](_0x1f45bc(_0x372499,_0xed01('0x51')))['then'](function(){})[_0xed01('0x2b')](_0x3cfbf1()));}}return _0x43d976;})[_0xed01('0x52')]();})[_0xed01('0x4d')](function(){return db[_0xed01('0x54')][_0xed01('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xed01('0x4b')],'as':'Lists','where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x4610b3){var _0xcd45a9=[];if(_0x4610b3){for(var _0x1eb81c=0x0,_0x3691b5;_0x1eb81c<_0x4610b3[_0xed01('0x17')];_0x1eb81c+=0x1){_0x3691b5=_0x4610b3[_0x1eb81c]['get']({'plain':!![]});switch(_0x3691b5[_0xed01('0x4a')]){case _0xed01('0x55'):_0xcd45a9[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x25964f(_0x3691b5,_0xed01('0x56')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;case'onlyIfOpen':_0xcd45a9[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x18d5df(_0x3691b5,_0xed01('0x56')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;default:_0xcd45a9[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x3e01e6(_0x3691b5,_0xed01('0x56')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));}}}return _0xcd45a9;})['all']();})[_0xed01('0x4d')](function(){return db[_0xed01('0x54')][_0xed01('0x49')]({'attributes':['id'],'include':[{'model':db[_0xed01('0x4b')],'as':_0xed01('0x57'),'where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x6d58fc){var _0x104f41=[];if(_0x6d58fc){for(var _0x3000b1=0x0,_0x281116;_0x3000b1<_0x6d58fc[_0xed01('0x17')];_0x3000b1+=0x1){_0x281116=_0x6d58fc[_0x3000b1][_0xed01('0x4e')]({'plain':!![]});_0x104f41[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x1f45bc(_0x281116,_0xed01('0x56')))['then'](function(){})['catch'](_0x3cfbf1()));}}return _0x104f41;})['all']();})[_0xed01('0x2b')](function(_0x5a8014){logger['error']('cmContact,\x20%s,\x20%s',_0xed01('0x58'),_0x5a8014[_0xed01('0x2d')]);});}var processPromises=function(_0x2851e2){return BPromise[_0xed01('0x52')](promises)['then'](function(_0x8ae19a){})[_0xed01('0x2b')](function(_0x402bb7){logger['error'](_0xed01('0x59'),JSON[_0xed01('0x5a')](_0x402bb7));})[_0xed01('0x5b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2851e2){return _0x2851e2['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0xed01('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0xed01('0x4d')](function(){socket[_0xed01('0x5c')](_0xed01('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xed01('0x5e')](FILEPATH);}catch(_0x2a7513){logger[_0xed01('0x13')](_0xed01('0x5f'),JSON['stringify'](_0x2a7513));}finally{process[_0xed01('0x60')](0x0);}});};process['on'](_0xed01('0x61'),function(){logger[_0xed01('0x62')](_0xed01('0x63'));endCsv();});function main(){return BPromise[_0xed01('0x64')]()[_0xed01('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xed01('0x65')](',');return db[_0xed01('0x66')][_0xed01('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xed01('0x4d')](function(_0x106550){var _0x432019=fs[_0xed01('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xed01('0x68')](_0x432019,{'header':!![],'skipEmptyLines':!![],'step':function(_0x13e420,_0x48a731){total+=0x1;var _0x519607=total;promises['push'](checkRow(_0x13e420,_0x106550,_0x519607)[_0xed01('0x4d')](function(){success+=0x1;})[_0xed01('0x2b')](function(_0x167f60){if(_0x167f60[_0xed01('0x13')]){errors+=0x1;delete _0x167f60['error'];}else if(_0x167f60[_0xed01('0x25')]){duplicates+=0x1;delete _0x167f60[_0xed01('0x25')];}rows['push'](_0x167f60);}));if(total%0xc8===0x0){_0x48a731[_0xed01('0x69')]();return processPromises(_0x48a731);}},'complete':function(){return processPromises()[_0xed01('0x4d')](function(){logger[_0xed01('0x62')](_0xed01('0x6a'));endCsv();});},'error':function(_0x3e2992,_0x430bca){logger[_0xed01('0x62')](_0xed01('0x6b'),JSON['stringify'](_0x3e2992));endCsv();}});})[_0xed01('0x2b')](function(_0x301a07){logger['error'](_0xed01('0x6c'),JSON[_0xed01('0x5a')](_0x301a07));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0968ff3..4faec37 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 _0x60f0=['cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId','scheduledAt','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','dialTimezone','utcOffset','set','offset','main','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','findOne','updated','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','select','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','updatedAt','fields','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x60f0,0x113));var _0x060f=function(_0x375bfd,_0x7c9e97){_0x375bfd=_0x375bfd-0x0;var _0x5ae9af=_0x60f0[_0x375bfd];return _0x5ae9af;};'use strict';var fs=require('fs');var path=require(_0x060f('0x0'));var _=require('lodash');var Papa=require(_0x060f('0x1'));var util=require(_0x060f('0x2'));var BPromise=require(_0x060f('0x3'));var moment=require(_0x060f('0x4'));var squel=require(_0x060f('0x5'));var Redis=require(_0x060f('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x060f('0x7'));var logger=require(_0x060f('0x8'))(_0x060f('0x9'));config[_0x060f('0xa')]=_[_0x060f('0xb')](config[_0x060f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x060f('0xc'))(new Redis(config[_0x060f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x060f('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x060f('0xd')](_0x060f('0xe'));function isEmail(_0x4fe9f5){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))*$/[_0x060f('0xf')](_0x4fe9f5);}function selectNotIn(_0x6ce760,_0x151427,_0x2bcc6f,_0x5b74b3,_0x4c0653){return squel['select']()[_0x060f('0x10')](_0x060f('0x11'))['from'](_0x5b74b3)[_0x060f('0x12')](_0x151427,null,_0x151427+_0x060f('0x13')+_0x5b74b3+'.'+_0x2bcc6f)[_0x060f('0x14')](_0x5b74b3+'.'+_0x2bcc6f+'\x20=\x20'+_0x6ce760+'.'+_0x2bcc6f)[_0x060f('0x14')](_0x151427+_0x060f('0x15')+_0x4c0653[_0x060f('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x18785e,_0x27df0e){promisesAdditionalPhones=[];return db[_0x060f('0x16')][_0x060f('0x17')]({'raw':!![],'attributes':['id',_0x060f('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x060f('0x19')](function(_0x12aa3f){if(_0x12aa3f!==null){var _0x3d048c=[];for(var _0x567ec1=0x0;_0x567ec1<_0x12aa3f[_0x060f('0x1a')];_0x567ec1++){var _0x29e7a0=_0x12aa3f[_0x567ec1];_0x3d048c[_0x060f('0x1b')](insertAdditionalPhones(_0x29e7a0));}}Promise[_0x060f('0x1c')](_0x3d048c)[_0x060f('0x19')](function(){_0x18785e({'val':0x1});});});});}function insertAdditionalPhones(_0x51228d){return new Promise(function(_0x21c6d4,_0x9bad14){var _0x5c8387=_0x51228d[_0x060f('0x18')];var _0x4df297=_0x5c8387[_0x060f('0x1d')](';');var _0x13c3db=[];orderBy=0x0;for(var _0x3f48fb=0x0;_0x3f48fb<_0x4df297[_0x060f('0x1a')];_0x3f48fb++){_0x13c3db['push'](splitAdditionalPhone(_0x51228d['id'],_0x4df297[_0x3f48fb]));}Promise[_0x060f('0x1c')](_0x13c3db)['then'](function(){_0x21c6d4({'val':_0x4df297[_0x060f('0x1a')]});});});}function splitAdditionalPhone(_0xb608a1,_0x16c04d){return new Promise(function(_0x1fbba3,_0x5e9ca7){var _0x4b9578=_0x16c04d[_0x060f('0x1d')](':');var _0x1186a9=_0x4b9578[0x0];var _0x2a791d=_0x4b9578[0x1];if(!_[_0x060f('0x1e')](_0x2a791d)){var _0x485c83=_0x2a791d[_0x060f('0x1d')]('|');var _0x242bee=[];for(var _0x3b009a=0x0;_0x3b009a<_0x485c83[_0x060f('0x1a')];_0x3b009a++){if(_0x485c83[_0x3b009a]!==''){var _0x2ed491=_['filter'](promisesAdditionalPhones,{'contactId':_0xb608a1,'phone':_0x485c83[_0x3b009a]});if(_0x2ed491[_0x060f('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x060f('0x1b')]({'contactId':_0xb608a1,'contactTypeId':_0x1186a9,'phone':_0x485c83[_0x3b009a],'orderBy':orderBy});}}}_0x1fbba3({'ok':0x1});}else _0x1fbba3({'res':0x0});});}function createAdditionalPhone(_0x361b50,_0x34ef4f,_0x3c6210,_0x422f92){var _0x3f492b='';var _0x261d31='';var _0x3c01c3=_0x3c6210[_0x060f('0x1d')]('§');_0x3f492b=_0x3c01c3[0x0];if(_0x3c01c3['length']==0x2)_0x261d31=_0x3c01c3[0x1];return new Promise(function(_0x4fbbf4,_0x29c3e9){return db[_0x060f('0x1f')][_0x060f('0x20')]({'where':{'CmContactId':_0x361b50,'item':_0x3f492b}})[_0x060f('0x19')](function(_0x4a3635){if(_0x4a3635){return db[_0x060f('0x1f')]['update']({'ItemTypeId':_0x34ef4f,'description':_0x261d31,'OrderBy':_0x422f92},{'where':{'CmContactId':_0x361b50,'item':_0x3f492b}})[_0x060f('0x19')](function(_0xb9666e){_0x4fbbf4({'res':_0x060f('0x21')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x361b50,'item':_0x3f492b,'description':_0x261d31,'ItemTypeId':_0x34ef4f,'OrderBy':_0x422f92,'ItemClass':_0x060f('0x22')})[_0x060f('0x19')](function(_0x2cda12){_0x4fbbf4({'res':'inserted'});});}});});}function insertCmHopper(_0x141f80,_0x40b4e7,_0x4ecae6,_0x391cc4,_0x196a57){var _0x5054ba=[_0x060f('0x23'),_0x060f('0x24'),'cm_contacts.id','cm_contacts.ListId',_0x40b4e7+'.'+_0x391cc4,_0x060f('0x25'),'cm_contacts.updatedAt',_0x060f('0x26'),_0x060f('0x27'),'\x22'+_0x196a57+'\x22'];return squel[_0x060f('0x28')]()[_0x060f('0x29')](_0x060f('0x2a'))[_0x060f('0x2b')]([_0x060f('0x11'),_0x060f('0x2c'),_0x060f('0x2d'),_0x060f('0x2e'),_0x391cc4,_0x060f('0x2f'),'updatedAt',_0x060f('0x30'),_0x060f('0x31'),_0x060f('0x32')],squel[_0x060f('0x33')]()['fields'](_0x5054ba)[_0x060f('0x34')](_0x40b4e7)[_0x060f('0x12')](_0x060f('0x35'),null,_0x060f('0x36')+_0x40b4e7+_0x060f('0x37'))[_0x060f('0x12')](_0x4ecae6,null,_0x4ecae6+_0x060f('0x13')+_0x40b4e7+'.'+_0x391cc4)[_0x060f('0x14')](_0x40b4e7+'.CmListId\x20=\x20?',_0x141f80)[_0x060f('0x14')](_0x060f('0x38'),NOW)[_0x060f('0x14')](_0x060f('0x39'),selectNotIn(_0x40b4e7,_0x4ecae6,_0x391cc4,'cm_hopper',[_0x060f('0x3a'),'\x22onlyIfOpen\x22']))[_0x060f('0x14')](_0x060f('0x39'),selectNotIn(_0x40b4e7,_0x4ecae6,_0x391cc4,_0x060f('0x2a'),[_0x060f('0x3a')])))[_0x060f('0x3b')]();}function insertCmHopperBlack(_0x39d4dd,_0x35c6bd,_0x58a240,_0x43a4fd){var _0x2f7661=[_0x060f('0x23'),'cm_contacts.id',_0x060f('0x3c'),_0x35c6bd+'.'+_0x43a4fd,_0x060f('0x25'),_0x060f('0x3d')];return squel[_0x060f('0x28')]()['into'](_0x060f('0x3e'))[_0x060f('0x2b')]([_0x060f('0x11'),'ContactId',_0x060f('0x2e'),_0x43a4fd,'createdAt',_0x060f('0x3f')],squel[_0x060f('0x33')]()[_0x060f('0x40')](_0x2f7661)['from'](_0x35c6bd)[_0x060f('0x12')](_0x060f('0x35'),null,_0x060f('0x36')+_0x35c6bd+_0x060f('0x37'))['join'](_0x58a240,null,_0x58a240+_0x060f('0x13')+_0x35c6bd+'.'+_0x43a4fd)[_0x060f('0x14')](_0x35c6bd+_0x060f('0x41'),_0x39d4dd)[_0x060f('0x14')](_0x060f('0x38'),NOW)[_0x060f('0x14')](_0x060f('0x39'),squel['select']()[_0x060f('0x10')]('phone')['from'](_0x060f('0x3e'))[_0x060f('0x14')](_0x060f('0x42'),_0x39d4dd)[_0x060f('0x14')](_0x43a4fd+_0x060f('0x43')+_0x35c6bd+'.'+_0x43a4fd)))[_0x060f('0x3b')]();}function insertTzCmHopper(_0x20dd3b,_0x46e10e,_0x24a160,_0x1b378b,_0x2e7e1c,_0x4b9d60){var _0x3ffc7e=[_0x060f('0x23'),_0x060f('0x44')+_0x4b9d60+_0x060f('0x45'),_0x060f('0x46'),_0x060f('0x3c'),_0x46e10e+'.'+_0x1b378b,_0x060f('0x25'),_0x060f('0x3d'),_0x060f('0x26'),_0x060f('0x27'),'\x22'+_0x2e7e1c+'\x22'];var _0x1b1962=squel['insert']()[_0x060f('0x29')](_0x060f('0x2a'))[_0x060f('0x2b')]([_0x060f('0x11'),_0x060f('0x2c'),_0x060f('0x2d'),'ListId',_0x1b378b,_0x060f('0x2f'),_0x060f('0x3f'),_0x060f('0x30'),_0x060f('0x31'),'recallme'],squel[_0x060f('0x33')]()['fields'](_0x3ffc7e)[_0x060f('0x34')](_0x46e10e)['join'](_0x060f('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x46e10e+'.CmListId')[_0x060f('0x12')](_0x24a160,null,_0x24a160+_0x060f('0x13')+_0x46e10e+'.'+_0x1b378b)[_0x060f('0x12')](_0x4b9d60,null,_0x4b9d60+'.id\x20=\x20'+_0x46e10e+'.'+_0x1b378b)['where'](_0x46e10e+_0x060f('0x41'),_0x20dd3b)[_0x060f('0x14')](_0x060f('0x38'),NOW)[_0x060f('0x14')](_0x060f('0x39'),selectNotIn(_0x46e10e,_0x24a160,_0x1b378b,_0x060f('0x2a'),['\x22always\x22',_0x060f('0x47')]))[_0x060f('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46e10e,_0x24a160,_0x1b378b,'cm_hopper',[_0x060f('0x3a')])))['toString']();return _0x1b1962;}function insertTzCmHopperBlack(_0x1ef56b,_0x2a3699,_0x227c27,_0x14b5cd){var _0x44d1b1=[_0x060f('0x23'),_0x060f('0x46'),_0x060f('0x3c'),_0x2a3699+'.'+_0x14b5cd,_0x060f('0x25'),_0x060f('0x3d')];return squel[_0x060f('0x28')]()[_0x060f('0x29')](_0x060f('0x3e'))[_0x060f('0x2b')]([_0x060f('0x11'),_0x060f('0x2d'),'ListId',_0x14b5cd,_0x060f('0x2f'),'updatedAt'],squel[_0x060f('0x33')]()[_0x060f('0x40')](_0x44d1b1)[_0x060f('0x34')](_0x2a3699)[_0x060f('0x12')](_0x060f('0x35'),null,_0x060f('0x36')+_0x2a3699+_0x060f('0x37'))[_0x060f('0x12')](_0x227c27,null,_0x227c27+_0x060f('0x13')+_0x2a3699+'.'+_0x14b5cd)[_0x060f('0x14')](_0x2a3699+_0x060f('0x41'),_0x1ef56b)[_0x060f('0x14')](_0x060f('0x38'),NOW)[_0x060f('0x14')](_0x060f('0x39'),squel[_0x060f('0x33')]()[_0x060f('0x10')](_0x060f('0x11'))[_0x060f('0x34')](_0x060f('0x3e'))[_0x060f('0x14')](_0x060f('0x42'),_0x1ef56b)[_0x060f('0x14')](_0x14b5cd+'\x20=\x20'+_0x2a3699+'.'+_0x14b5cd)))[_0x060f('0x3b')]();}function insertCmHopperAdditionalPhones(_0x55acfc){var _0x46074b=[_0x060f('0x48'),_0x060f('0x49'),_0x060f('0x4a'),_0x060f('0x4b'),_0x060f('0x4c')];return squel[_0x060f('0x28')]()[_0x060f('0x29')](_0x060f('0x4d'))['fromQuery']([_0x060f('0x4e'),_0x060f('0x11'),_0x060f('0x4f'),_0x060f('0x2f'),_0x060f('0x3f')],squel['select']()[_0x060f('0x40')](_0x46074b)['from'](_0x060f('0x2a'))[_0x060f('0x12')](_0x060f('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x060f('0x50'),null,_0x060f('0x51'))['where']('cm_hopper.ListId\x20=\x20?',_0x55acfc)[_0x060f('0x14')](_0x060f('0x38'),NOW))[_0x060f('0x3b')]();}function insertCmContact(_0x2978c5,_0x4679ae,_0x54f186,_0x3420bc){var _0x599e4d=_[_0x060f('0x52')](_['keys'](_0x3420bc),[_0x060f('0x2e'),_0x060f('0x53'),_0x060f('0x2f'),_0x060f('0x3f'),_0x060f('0x54')]);return squel['insert']()[_0x060f('0x29')]('cm_contacts')[_0x060f('0x2b')](_0x599e4d,squel[_0x060f('0x33')]()['fields'](_0x599e4d)[_0x060f('0x34')](_0x4679ae)['where']('('+_0x54f186[_0x060f('0x12')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x54f186)[_0x060f('0x34')](_0x060f('0x35'))[_0x060f('0x14')](_0x060f('0x42'),_0x2978c5)['where']('deletedAt\x20IS\x20NULL'))[_0x060f('0x14')](_0x060f('0x55'),squel[_0x060f('0x33')]()['field'](_0x060f('0x56'),'min_id')['from'](_0x4679ae)[_0x060f('0x57')](_0x54f186[_0x060f('0x12')](','))))[_0x060f('0x3b')]();}function handleStop(){logger[_0x060f('0x58')](_0x060f('0x59'));stopped=!![];}function handleUncaughtException(_0x2b19ff){logger[_0x060f('0x5a')](_0x2b19ff[_0x060f('0x5b')]);process[_0x060f('0x5c')](0x1);}function handleError(_0x6d3867,_0x36bb09){stats[_0x060f('0x5d')][_0x060f('0x1b')]({'name':_0x36bb09[_0x060f('0x5e')],'message':_0x36bb09[_0x060f('0x5b')],'row':_0x6d3867});}function handleQuery(_0x451f10){logger[_0x060f('0x58')](_0x451f10);return db[_0x060f('0x5f')][_0x060f('0x60')](_0x451f10)[_0x060f('0x61')](function(_0x40064d){results[_0x060f('0x1b')](_0x40064d);})[_0x060f('0x62')](function(_0x23eda9){logger[_0x060f('0x5a')](_0x23eda9[_0x060f('0x5b')]);});}function updateTzCampaigns(_0x2f209e){return new Promise(function(_0xf568d5,_0x4b9faa){var _0x5c1373=squel[_0x060f('0x33')]()[_0x060f('0x40')]([_0x060f('0x63'),_0x060f('0x64')])['from'](_0x060f('0x65'))[_0x060f('0x12')](_0x060f('0x66'),null,_0x060f('0x67'))[_0x060f('0x14')](_0x060f('0x68')+_0x2f209e);db[_0x060f('0x5f')][_0x060f('0x60')](_0x5c1373[_0x060f('0x3b')]())['spread'](function(_0x23059c){var _0x2c1589=[];for(var _0x530bf9=0x0;_0x530bf9<_0x23059c[_0x060f('0x1a')];_0x530bf9++){_0x2c1589['push'](getTimezoneData(_0x23059c[_0x530bf9],tmp_campaigns));}BPromise[_0x060f('0x1c')](_0x2c1589)[_0x060f('0x19')](function(){_0xf568d5({'val':0x1});});})['catch'](function(_0x554ef5){logger[_0x060f('0x5a')](_0x554ef5[_0x060f('0x5b')]);_0xf568d5({'val':0x0});});});}function updateTzVoiceQueues(_0x38b641){return new Promise(function(_0x3ddd7a,_0x57e7e1){var _0x567146=squel[_0x060f('0x33')]()[_0x060f('0x40')]([_0x060f('0x69'),_0x060f('0x6a')])[_0x060f('0x34')](_0x060f('0x6b'))[_0x060f('0x12')](_0x060f('0x6c'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x060f('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x38b641);db[_0x060f('0x5f')]['query'](_0x567146['toString']())[_0x060f('0x61')](function(_0x5a3522){var _0x27be3e=[];for(var _0x218d21=0x0;_0x218d21<_0x5a3522[_0x060f('0x1a')];_0x218d21++){_0x27be3e[_0x060f('0x1b')](getTimezoneData(_0x5a3522[_0x218d21],tmp_voice_queues));}BPromise['all'](_0x27be3e)[_0x060f('0x19')](function(){_0x3ddd7a({'val':0x1});});})[_0x060f('0x62')](function(_0x284d84){logger['error'](_0x284d84[_0x060f('0x5b')]);_0x3ddd7a({'val':0x0});});});}function getTimezoneData(_0x4f756b,_0x4f8b79){return new Promise(function(_0x2a2705,_0xe4e578){var _0x102b13=shared[_0x060f('0x6d')];var _0xbfc7b2=_0x102b13[_0x4f756b[_0x060f('0x6e')]];if(_[_0x060f('0x1e')](_0xbfc7b2)){_0x2a2705({'ret':0x1});}else{var _0x2e740c=_0xbfc7b2[_0x060f('0x6f')];var _0x17992e=squel[_0x060f('0x28')]()[_0x060f('0x29')](_0x4f8b79)[_0x060f('0x70')]('id',_0x4f756b['id'])['set'](_0x060f('0x71'),_0x2e740c)[_0x060f('0x70')](_0x060f('0x6e'),_0x4f756b[_0x060f('0x6e')])[_0x060f('0x3b')]();return db['sequelize'][_0x060f('0x60')](_0x17992e)[_0x060f('0x61')](function(_0x41645e){_0x2a2705({'ret':0x1});})[_0x060f('0x62')](function(_0x1b1f0f){logger[_0x060f('0x5a')](_0x1b1f0f[_0x060f('0x5b')]);_0xe4e578({'ret':0x1});});}});}function handleTZQuery(_0x493eda){logger[_0x060f('0x58')](_0x493eda);return db['sequelize'][_0x060f('0x60')](_0x493eda)[_0x060f('0x61')](function(_0x557dde){})[_0x060f('0x62')](function(_0x345dba){logger['error'](_0x345dba['message']);});}function main(_0x37f8e3,_0x273808,_0x57afd7,_0x3c5012){logger['info'](_0x060f('0x72'),_0x37f8e3,JSON['stringify'](_0x273808));process['send'](_0x060f('0x73'));var _0x380e4d=_0x273808[_0x060f('0x74')];var _0x49ccff=_['clone'](_0x380e4d);var _0x1c9860=_0x273808[_0x060f('0x75')];var _0x2740e2=path[_0x060f('0x12')](config[_0x060f('0x76')],_0x060f('0x77'),_0x1c9860+_0x060f('0x78'));hasTZ=_['keys'](_0x380e4d)['includes'](_0x060f('0x6e'));var _0x3330f5=_[_0x060f('0x79')](_0x380e4d)[_0x060f('0x12')]();logger[_0x060f('0x58')](_0x060f('0x7a'),_0x3330f5);db['ContactItemType'][_0x060f('0x17')]({'raw':!![],'attributes':['id',_0x060f('0x7b')]})[_0x060f('0x19')](function(_0x267835){for(var _0x5b45ad=0x0;_0x5b45ad<_0x267835[_0x060f('0x1a')];_0x5b45ad++){if(_0x267835[_0x5b45ad][_0x060f('0x7b')]in _0x380e4d){contactItemTypes['push'](_0x267835[_0x5b45ad]);delete _0x49ccff[_0x267835[_0x5b45ad][_0x060f('0x7b')]];hasAdditionalPhones=!![];}for(var _0x390237 in _0x380e4d){if(_0x267835[_0x5b45ad][_0x060f('0x7b')]+_0x060f('0x7c')===_0x390237){phoneDescriptions[_0x060f('0x1b')]({'itemTypeId':_0x267835[_0x5b45ad]['id'],'description':_0x390237});delete _0x49ccff[_0x390237];}}}if(hasAdditionalPhones)_0x49ccff[_0x060f('0x18')]='';var _0x17dfa6=_[_0x060f('0x79')](_0x49ccff)[_0x060f('0x12')]();logger[_0x060f('0x58')]('header',_0x17dfa6);fs[_0x060f('0x7d')](_0x2740e2,_0x17dfa6+'\x0a');Papa[_0x060f('0x7e')](fs[_0x060f('0x7f')](_0x37f8e3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x371882,_0x541b8b){try{for(var _0x135033=0x0,_0x3aa551=[];_0x135033<_0x371882[_0x060f('0x80')][_0x060f('0x1a')];_0x135033++){stats[_0x060f('0x81')]+=0x1;if(_0x371882['errors'][_0x135033]){handleError(_0x371882['data'][_0x135033],_0x371882[_0x060f('0x5d')][_0x135033]);}else{var _0x27f5d6=[];var _0x2f6628=[];var _0x100222={};for(var _0x2208f5 in _0x380e4d){let _0x3a59cb=contactItemTypes[_0x060f('0x82')](_0x540ba3=>_0x540ba3[_0x060f('0x7b')]===_0x2208f5);let _0x309b74=contactItemTypes[_0x060f('0x82')](_0x579e88=>_0x579e88[_0x060f('0x7b')]+_0x060f('0x7c')===_0x2208f5);if(_[_0x060f('0x1e')](_0x3a59cb)&&_['isNil'](_0x309b74)){if(_0x380e4d[_0x060f('0x83')](_0x2208f5)){if(_0x371882[_0x060f('0x80')][_0x135033][_0x380e4d[_0x2208f5]]){var _0x3d0006=_['trim'](_0x371882[_0x060f('0x80')][_0x135033][_0x380e4d[_0x2208f5]][_0x060f('0x84')](/"/g,'\x27'));switch(_0x2208f5){case _0x060f('0x2c'):var _0x5cf5ae=moment(_0x3d0006,_0x060f('0xe'),!![]);if(_0x5cf5ae[_0x060f('0x85')]()){_0x3aa551[_0x060f('0x1b')]('\x22'+_0x3d0006+'\x22');}else{_0x27f5d6[_0x060f('0x1b')](_0x060f('0x86'));}break;case'priority':var _0x1188b0=parseInt(_0x3d0006);_0x3d0006=_[_0x060f('0x87')](_0x1188b0)||_0x1188b0<0x0||_0x1188b0>0x4?_0x3c5012?0x3:0x2:_0x1188b0;_0x3aa551[_0x060f('0x1b')]('\x22'+_0x3d0006+'\x22');break;case _0x060f('0x31'):var _0x2bf7f6=parseInt(_0x3d0006);if(_['isNumber'](_0x2bf7f6)&&_[_0x060f('0x88')](_0x57afd7,_0x2bf7f6)){_0x3aa551[_0x060f('0x1b')]('\x22'+_0x2bf7f6+'\x22');}else{_0x27f5d6[_0x060f('0x1b')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x3d0006)){_0x3aa551[_0x060f('0x1b')]('\x22'+_0x3d0006+'\x22');}else{_0x27f5d6[_0x060f('0x1b')](_0x060f('0x89'));}break;case'dateOfBirth':var _0x22712a=moment(_0x3d0006,_0x060f('0x8a'),!![]);if(_0x22712a[_0x060f('0x85')]()){_0x3aa551[_0x060f('0x1b')]('\x22'+_0x3d0006+'\x22');}else{_0x27f5d6[_0x060f('0x1b')](_0x060f('0x8b'));}break;case _0x060f('0x6e'):var _0x133af4=shared[_0x060f('0x6d')];var _0x48e438=_0x133af4[_0x3d0006];if(!_[_0x060f('0x1e')](_0x48e438)){var _0x591a18=_0x48e438[_0x060f('0x6f')];_0x3aa551[_0x060f('0x1b')]('\x22'+_0x3d0006+'\x22');_0x3aa551[_0x060f('0x1b')]('\x22'+_0x591a18+'\x22');}break;default:_0x3aa551[_0x060f('0x1b')]('\x22'+_0x3d0006+'\x22');}}else{switch(_0x2208f5){case _0x060f('0x8c'):case _0x060f('0x11'):_0x27f5d6[_0x060f('0x1b')](_0x2208f5+'\x20not\x20specified');break;default:_0x3aa551['push']('\x22\x22');}}}}else{var _0x45ae90='';if(!_['isNil'](_0x3a59cb)){if(!_0x100222[_0x060f('0x83')](_0x3a59cb['id'])){if(!_[_0x060f('0x1e')](_0x371882['data'][_0x135033][_0x380e4d[_0x2208f5]])){var _0x3d0006=_['trim'](_0x371882[_0x060f('0x80')][_0x135033][_0x380e4d[_0x2208f5]][_0x060f('0x84')](/"/g,'\x27'));var _0x43249b=phoneDescriptions[_0x060f('0x82')](_0x44fe1c=>_0x44fe1c[_0x060f('0x8d')]===_0x3a59cb['id']);if(!_['isNil'](_0x43249b)){var _0x5cecc2=_['trim'](_0x371882[_0x060f('0x80')][_0x135033][_0x380e4d[_0x43249b[_0x060f('0x8e')]]][_0x060f('0x84')](/"/g,'\x27'));if(!_['isNil'](_0x5cecc2))_0x3d0006=_0x3d0006+'§'+_0x5cecc2;}if(_0x45ae90=='')_0x45ae90=_0x3d0006;else _0x45ae90+='|'+_0x3d0006;}_0x2f6628[_0x060f('0x1b')](_0x3a59cb['id']+':'+_0x45ae90);_0x100222[_0x3a59cb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3aa551[_0x060f('0x1b')]('\x22'+_0x2f6628[_0x060f('0x12')](';')+'\x22');}if(_0x27f5d6[_0x060f('0x1a')]){handleError(_0x371882[_0x060f('0x80')][_0x135033],{'code':'SystemRow','message':_0x27f5d6['join']()});}else{fs[_0x060f('0x8f')](_0x2740e2,_0x3aa551[_0x060f('0x12')]()+'\x0a');}_0x3aa551=[];}if(!(stats[_0x060f('0x81')]%0xc8)){socket[_0x060f('0x90')](_0x060f('0x91')+_0x1c9860,stats);stats['errors']=[];}}if(stopped){logger[_0x060f('0x58')](_0x060f('0x92'));_0x541b8b[_0x060f('0x93')]();}}catch(_0x38eb25){handleError(_0x371882[_0x060f('0x80')][_0x135033],{'code':_0x060f('0x94'),'message':_0x38eb25[_0x060f('0x5b')]});logger[_0x060f('0x5a')]('step',_0x38eb25['message']);}},'complete':function(){try{var _0x3c727b=[];var _0x552345=[];var _0x52de59=_0x060f('0x35');if(_0x273808[_0x060f('0x95')]&&_0x273808[_0x060f('0x95')]['length']){_0x52de59=_0x060f('0x96')+_0x1c9860;_0x3c727b[_0x060f('0x1b')]('CREATE\x20TABLE\x20'+_0x52de59+_0x060f('0x97'));}tmp_campaigns=_0x060f('0x98')+_0x1c9860;tmp_voice_queues=_0x060f('0x99')+_0x1c9860;_0x552345['push'](_0x060f('0x9a')+tmp_campaigns+_0x060f('0x9b'));_0x552345[_0x060f('0x1b')](_0x060f('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x060f('0x9c')](_0x552345,handleTZQuery)['then'](function(_0x3606a3){updateTzCampaigns(_0x273808[_0x060f('0x2e')])[_0x060f('0x19')](function(_0x5f034e){updateTzVoiceQueues(_0x273808['ListId'])[_0x060f('0x19')](function(_0x4f3d3f){if(hasTZ)_0x17dfa6=_0x17dfa6[_0x060f('0x84')](_0x060f('0x6e'),_0x060f('0x9d'));var _0x1306e3=util[_0x060f('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2740e2,_0x52de59,_0x17dfa6,_0x273808[_0x060f('0x2e')],_0x273808[_0x060f('0x53')]||null,NOW,NOW);if(_[_0x060f('0x1e')](_0x380e4d[_0x060f('0x2c')])){_0x1306e3+=_0x060f('0x9e');}_0x3c727b[_0x060f('0x1b')](_0x1306e3);if(_0x273808[_0x060f('0x95')]&&_0x273808[_0x060f('0x95')]['length']){_0x3c727b[_0x060f('0x1b')](insertCmContact(_0x273808[_0x060f('0x2e')],_0x52de59,_0x273808[_0x060f('0x95')],_0x380e4d));_0x3c727b[_0x060f('0x1b')](_0x060f('0x9f')+_0x52de59+';');}BPromise[_0x060f('0x9c')](_0x3c727b,handleQuery)[_0x060f('0x19')](function(_0x64f57){BPromise[_0x060f('0x1c')]([handleAdditionalPhones()])[_0x060f('0x19')](function(){_0x3c727b=[];for(var _0x5d943a=0x0;_0x5d943a\x20\x20');}var _0x5f1cd6=path[_0x060f('0x12')](config[_0x060f('0x76')],_0x060f('0x77'),process[_0x060f('0xa8')][0x2]);if(!fs[_0x060f('0xa9')](_0x5f1cd6)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2718b5={};try{_0x2718b5=JSON[_0x060f('0x7e')](process[_0x060f('0xa8')][0x3]);if(!_0x2718b5[_0x060f('0x74')]){throw new Error(_0x060f('0xaa'));}if(!_0x2718b5[_0x060f('0x74')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2718b5[_0x060f('0x74')][_0x060f('0x8c')]){throw new Error(_0x060f('0xab'));}var _0x570b44=0x0;if(_0x2718b5[_0x060f('0x74')][_0x060f('0x31')]){_0x570b44=0x1;}if(!_0x2718b5[_0x060f('0x2e')]){throw new Error(_0x060f('0xac'));}}catch(_0x3152e6){throw new Error('body\x20id\x20mandatory');}var _0x48ff2a=[];try{_0x48ff2a=_[_0x060f('0xad')](JSON['parse'](process[_0x060f('0xa8')][0x4]),'id');}catch(_0x2587ff){logger[_0x060f('0x58')]('No\x20agent\x20available');}main(_0x5f1cd6,_0x2718b5,_0x48ff2a,_0x570b44);}validate();process['on'](_0x060f('0xae'),handleStop);process['on'](_0x060f('0xaf'),handleUncaughtException); \ No newline at end of file +var _0xc217=[')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','errors','sequelize','query','spread','catch','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','parse','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactTypeId','orderBy','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','affectedRows','unlink','exit','complete','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','argv','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','findAll','AdditionalPhones','length','push','then','split','all','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','insert','cm_hopper','scheduledat','priority','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt'];(function(_0x230594,_0x3c2e64){var _0x3173b9=function(_0x44554a){while(--_0x44554a){_0x230594['push'](_0x230594['shift']());}};_0x3173b9(++_0x3c2e64);}(_0xc217,0x69));var _0x7c21=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xc217[_0x470f24];return _0x2c6fc8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x7c21('0x0'));var BPromise=require(_0x7c21('0x1'));var moment=require(_0x7c21('0x2'));var squel=require(_0x7c21('0x3'));var Redis=require(_0x7c21('0x4'));var db=require(_0x7c21('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x7c21('0x6'));var logger=require(_0x7c21('0x7'))(_0x7c21('0x8'));config[_0x7c21('0x9')]=_[_0x7c21('0xa')](config['redis'],{'host':_0x7c21('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c21('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7c21('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7c21('0xc')](_0x7c21('0xd'));function isEmail(_0xf273a8){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))*$/[_0x7c21('0xe')](_0xf273a8);}function selectNotIn(_0x1daefc,_0x5efebc,_0x3cfeee,_0x3e6abf,_0x2eb87e){return squel[_0x7c21('0xf')]()[_0x7c21('0x10')](_0x7c21('0x11'))['from'](_0x3e6abf)[_0x7c21('0x12')](_0x5efebc,null,_0x5efebc+_0x7c21('0x13')+_0x3e6abf+'.'+_0x3cfeee)[_0x7c21('0x14')](_0x3e6abf+'.'+_0x3cfeee+_0x7c21('0x15')+_0x1daefc+'.'+_0x3cfeee)[_0x7c21('0x14')](_0x5efebc+'.dialCheckDuplicateType\x20IN\x20('+_0x2eb87e[_0x7c21('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5c107c,_0x2f7625){promisesAdditionalPhones=[];return db['CmContact'][_0x7c21('0x16')]({'raw':!![],'attributes':['id',_0x7c21('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x24ce1b){if(_0x24ce1b!==null){var _0x2926ab=[];for(var _0x3844e3=0x0;_0x3844e3<_0x24ce1b[_0x7c21('0x18')];_0x3844e3++){var _0x415b3d=_0x24ce1b[_0x3844e3];_0x2926ab[_0x7c21('0x19')](insertAdditionalPhones(_0x415b3d));}}Promise['all'](_0x2926ab)[_0x7c21('0x1a')](function(){_0x5c107c({'val':0x1});});});});}function insertAdditionalPhones(_0x2d78e9){return new Promise(function(_0x24e0cc,_0x3e6462){var _0x308019=_0x2d78e9[_0x7c21('0x17')];var _0xc54c3d=_0x308019[_0x7c21('0x1b')](';');var _0x1abaed=[];orderBy=0x0;for(var _0xabe387=0x0;_0xabe387<_0xc54c3d['length'];_0xabe387++){_0x1abaed[_0x7c21('0x19')](splitAdditionalPhone(_0x2d78e9['id'],_0xc54c3d[_0xabe387]));}Promise[_0x7c21('0x1c')](_0x1abaed)[_0x7c21('0x1a')](function(){_0x24e0cc({'val':_0xc54c3d['length']});});});}function splitAdditionalPhone(_0xb430a4,_0x408dd2){return new Promise(function(_0x569382,_0x2e4d20){var _0x11c5e2=_0x408dd2['split'](':');var _0x457b7c=_0x11c5e2[0x0];var _0x30b140=_0x11c5e2[0x1];if(!_[_0x7c21('0x1d')](_0x30b140)){var _0x31a96e=_0x30b140[_0x7c21('0x1b')]('|');var _0x3c79b4=[];for(var _0x5aaf3b=0x0;_0x5aaf3b<_0x31a96e['length'];_0x5aaf3b++){if(_0x31a96e[_0x5aaf3b]!==''){var _0x5dbfcc=_[_0x7c21('0x1e')](promisesAdditionalPhones,{'contactId':_0xb430a4,'phone':_0x31a96e[_0x5aaf3b]});if(_0x5dbfcc[_0x7c21('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x7c21('0x19')]({'contactId':_0xb430a4,'contactTypeId':_0x457b7c,'phone':_0x31a96e[_0x5aaf3b],'orderBy':orderBy});}}}_0x569382({'ok':0x1});}else _0x569382({'res':0x0});});}function createAdditionalPhone(_0x2aebcb,_0x1f158d,_0x3f587f,_0x3b819c){var _0x4c5d2b='';var _0x243f9a='';var _0x1ecf38=_0x3f587f[_0x7c21('0x1b')]('§');_0x4c5d2b=_0x1ecf38[0x0];if(_0x1ecf38[_0x7c21('0x18')]==0x2)_0x243f9a=_0x1ecf38[0x1];return new Promise(function(_0x567cf1,_0x32ec8f){return db[_0x7c21('0x1f')]['findOne']({'where':{'CmContactId':_0x2aebcb,'item':_0x4c5d2b}})[_0x7c21('0x1a')](function(_0x562c6e){if(_0x562c6e){return db[_0x7c21('0x1f')][_0x7c21('0x20')]({'ItemTypeId':_0x1f158d,'description':_0x243f9a,'OrderBy':_0x3b819c},{'where':{'CmContactId':_0x2aebcb,'item':_0x4c5d2b}})[_0x7c21('0x1a')](function(_0x7bd91a){_0x567cf1({'res':_0x7c21('0x21')});});}else{return db[_0x7c21('0x1f')][_0x7c21('0x22')]({'CmContactId':_0x2aebcb,'item':_0x4c5d2b,'description':_0x243f9a,'ItemTypeId':_0x1f158d,'OrderBy':_0x3b819c,'ItemClass':_0x7c21('0x23')})[_0x7c21('0x1a')](function(_0x36cb16){_0x567cf1({'res':_0x7c21('0x24')});});}});});}function insertCmHopper(_0x4a93e1,_0x21b3ff,_0x2d7323,_0xb759a1,_0x4ce559){var _0x32f124=[_0x7c21('0x25'),'cm_contacts.scheduledat',_0x7c21('0x26'),_0x7c21('0x27'),_0x21b3ff+'.'+_0xb759a1,_0x7c21('0x28'),_0x7c21('0x29'),_0x7c21('0x2a'),'cm_contacts.UserId','\x22'+_0x4ce559+'\x22'];return squel['insert']()[_0x7c21('0x2b')]('cm_hopper')[_0x7c21('0x2c')]([_0x7c21('0x11'),'scheduledat',_0x7c21('0x2d'),_0x7c21('0x2e'),_0xb759a1,_0x7c21('0x2f'),_0x7c21('0x30'),'priority',_0x7c21('0x31'),_0x7c21('0x32')],squel[_0x7c21('0xf')]()[_0x7c21('0x33')](_0x32f124)[_0x7c21('0x34')](_0x21b3ff)[_0x7c21('0x12')](_0x7c21('0x35'),null,_0x7c21('0x36')+_0x21b3ff+_0x7c21('0x37'))[_0x7c21('0x12')](_0x2d7323,null,_0x2d7323+_0x7c21('0x13')+_0x21b3ff+'.'+_0xb759a1)[_0x7c21('0x14')](_0x21b3ff+_0x7c21('0x38'),_0x4a93e1)[_0x7c21('0x14')](_0x7c21('0x39'),NOW)[_0x7c21('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x21b3ff,_0x2d7323,_0xb759a1,'cm_hopper',['\x22always\x22',_0x7c21('0x3a')]))['where'](_0x7c21('0x3b'),selectNotIn(_0x21b3ff,_0x2d7323,_0xb759a1,'cm_hopper',[_0x7c21('0x3c')])))[_0x7c21('0x3d')]();}function insertCmHopperBlack(_0x31e81b,_0x3e48c6,_0x7ab8b7,_0x43bfa4){var _0x4852f7=[_0x7c21('0x25'),_0x7c21('0x26'),_0x7c21('0x27'),_0x3e48c6+'.'+_0x43bfa4,_0x7c21('0x28'),_0x7c21('0x29')];return squel['insert']()[_0x7c21('0x2b')](_0x7c21('0x3e'))[_0x7c21('0x2c')]([_0x7c21('0x11'),'ContactId',_0x7c21('0x2e'),_0x43bfa4,_0x7c21('0x2f'),'updatedAt'],squel[_0x7c21('0xf')]()['fields'](_0x4852f7)['from'](_0x3e48c6)[_0x7c21('0x12')](_0x7c21('0x35'),null,_0x7c21('0x36')+_0x3e48c6+'.CmListId')[_0x7c21('0x12')](_0x7ab8b7,null,_0x7ab8b7+'.id\x20=\x20'+_0x3e48c6+'.'+_0x43bfa4)['where'](_0x3e48c6+_0x7c21('0x38'),_0x31e81b)[_0x7c21('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7c21('0x14')](_0x7c21('0x3b'),squel[_0x7c21('0xf')]()[_0x7c21('0x10')](_0x7c21('0x11'))[_0x7c21('0x34')]('cm_hopper_black')[_0x7c21('0x14')]('ListId\x20=\x20?',_0x31e81b)[_0x7c21('0x14')](_0x43bfa4+'\x20=\x20'+_0x3e48c6+'.'+_0x43bfa4)))['toString']();}function insertTzCmHopper(_0x825afc,_0x2d249d,_0x5d2a71,_0x18dae7,_0x35d50c,_0x1ca4ba){var _0x508ac8=[_0x7c21('0x25'),_0x7c21('0x3f')+_0x1ca4ba+_0x7c21('0x40'),_0x7c21('0x26'),_0x7c21('0x27'),_0x2d249d+'.'+_0x18dae7,'cm_contacts.createdAt',_0x7c21('0x29'),_0x7c21('0x2a'),_0x7c21('0x41'),'\x22'+_0x35d50c+'\x22'];var _0x333377=squel[_0x7c21('0x42')]()['into'](_0x7c21('0x43'))[_0x7c21('0x2c')]([_0x7c21('0x11'),_0x7c21('0x44'),_0x7c21('0x2d'),_0x7c21('0x2e'),_0x18dae7,_0x7c21('0x2f'),_0x7c21('0x30'),_0x7c21('0x45'),'UserId',_0x7c21('0x32')],squel[_0x7c21('0xf')]()[_0x7c21('0x33')](_0x508ac8)[_0x7c21('0x34')](_0x2d249d)[_0x7c21('0x12')](_0x7c21('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x2d249d+'.CmListId')[_0x7c21('0x12')](_0x5d2a71,null,_0x5d2a71+_0x7c21('0x13')+_0x2d249d+'.'+_0x18dae7)[_0x7c21('0x12')](_0x1ca4ba,null,_0x1ca4ba+_0x7c21('0x13')+_0x2d249d+'.'+_0x18dae7)[_0x7c21('0x14')](_0x2d249d+'.CmListId\x20=\x20?',_0x825afc)[_0x7c21('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x7c21('0x3b'),selectNotIn(_0x2d249d,_0x5d2a71,_0x18dae7,_0x7c21('0x43'),[_0x7c21('0x3c'),_0x7c21('0x3a')]))['where'](_0x7c21('0x3b'),selectNotIn(_0x2d249d,_0x5d2a71,_0x18dae7,_0x7c21('0x43'),[_0x7c21('0x3c')])))[_0x7c21('0x3d')]();return _0x333377;}function insertTzCmHopperBlack(_0x505d5e,_0x201750,_0x651e6b,_0x391fde){var _0x1d77d6=[_0x7c21('0x25'),_0x7c21('0x26'),_0x7c21('0x27'),_0x201750+'.'+_0x391fde,_0x7c21('0x28'),_0x7c21('0x29')];return squel['insert']()[_0x7c21('0x2b')](_0x7c21('0x3e'))['fromQuery'](['phone',_0x7c21('0x2d'),_0x7c21('0x2e'),_0x391fde,'createdAt',_0x7c21('0x30')],squel[_0x7c21('0xf')]()['fields'](_0x1d77d6)[_0x7c21('0x34')](_0x201750)[_0x7c21('0x12')](_0x7c21('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x201750+_0x7c21('0x37'))[_0x7c21('0x12')](_0x651e6b,null,_0x651e6b+_0x7c21('0x13')+_0x201750+'.'+_0x391fde)[_0x7c21('0x14')](_0x201750+_0x7c21('0x38'),_0x505d5e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7c21('0xf')]()[_0x7c21('0x10')]('phone')[_0x7c21('0x34')](_0x7c21('0x3e'))[_0x7c21('0x14')](_0x7c21('0x46'),_0x505d5e)[_0x7c21('0x14')](_0x391fde+_0x7c21('0x15')+_0x201750+'.'+_0x391fde)))[_0x7c21('0x3d')]();}function insertCmHopperAdditionalPhones(_0xce667c){var _0x2eec19=[_0x7c21('0x47'),_0x7c21('0x48'),_0x7c21('0x49'),_0x7c21('0x4a'),_0x7c21('0x4b')];return squel[_0x7c21('0x42')]()[_0x7c21('0x2b')](_0x7c21('0x4c'))[_0x7c21('0x2c')]([_0x7c21('0x4d'),'phone',_0x7c21('0x4e'),'createdAt',_0x7c21('0x30')],squel['select']()['fields'](_0x2eec19)[_0x7c21('0x34')](_0x7c21('0x43'))[_0x7c21('0x12')](_0x7c21('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x7c21('0x12')](_0x7c21('0x4f'),null,_0x7c21('0x50'))[_0x7c21('0x14')](_0x7c21('0x51'),_0xce667c)[_0x7c21('0x14')](_0x7c21('0x39'),NOW))['toString']();}function insertCmContact(_0x390294,_0x1fac90,_0x220e0f,_0x30675b){var _0x4cd355=_[_0x7c21('0x52')](_[_0x7c21('0x53')](_0x30675b),['ListId',_0x7c21('0x54'),_0x7c21('0x2f'),'updatedAt',_0x7c21('0x55')]);return squel['insert']()[_0x7c21('0x2b')](_0x7c21('0x35'))['fromQuery'](_0x4cd355,squel[_0x7c21('0xf')]()['fields'](_0x4cd355)[_0x7c21('0x34')](_0x1fac90)['where']('('+_0x220e0f['join'](',')+_0x7c21('0x56'),squel[_0x7c21('0xf')]()['fields'](_0x220e0f)['from'](_0x7c21('0x35'))['where'](_0x7c21('0x46'),_0x390294)[_0x7c21('0x14')](_0x7c21('0x57')))[_0x7c21('0x14')](_0x7c21('0x58'),squel[_0x7c21('0xf')]()[_0x7c21('0x10')]('MIN(id)',_0x7c21('0x59'))[_0x7c21('0x34')](_0x1fac90)[_0x7c21('0x5a')](_0x220e0f[_0x7c21('0x12')](','))))[_0x7c21('0x3d')]();}function handleStop(){logger[_0x7c21('0x5b')](_0x7c21('0x5c'));stopped=!![];}function handleUncaughtException(_0x13a847){logger[_0x7c21('0x5d')](_0x13a847[_0x7c21('0x5e')]);process['exit'](0x1);}function handleError(_0x9879b4,_0x4ecb3c){stats[_0x7c21('0x5f')][_0x7c21('0x19')]({'name':_0x4ecb3c['code'],'message':_0x4ecb3c[_0x7c21('0x5e')],'row':_0x9879b4});}function handleQuery(_0x444acd){logger[_0x7c21('0x5b')](_0x444acd);return db[_0x7c21('0x60')][_0x7c21('0x61')](_0x444acd)[_0x7c21('0x62')](function(_0x2f149f){results['push'](_0x2f149f);})[_0x7c21('0x63')](function(_0x514a47){logger[_0x7c21('0x5d')](_0x514a47[_0x7c21('0x5e')]);});}function updateTzCampaigns(_0x28d0a8){return new Promise(function(_0x4d38f7,_0x72b75d){var _0x5d03f5=squel['select']()['fields'](['campaigns.id','campaigns.dialTimezone'])[_0x7c21('0x34')](_0x7c21('0x64'))[_0x7c21('0x12')]('campaigns_has_cm_lists',null,_0x7c21('0x65'))[_0x7c21('0x14')](_0x7c21('0x66')+_0x28d0a8);db[_0x7c21('0x60')][_0x7c21('0x61')](_0x5d03f5[_0x7c21('0x3d')]())[_0x7c21('0x62')](function(_0x49bc97){var _0x3355db=[];for(var _0x26af11=0x0;_0x26af11<_0x49bc97[_0x7c21('0x18')];_0x26af11++){_0x3355db[_0x7c21('0x19')](getTimezoneData(_0x49bc97[_0x26af11],tmp_campaigns));}BPromise[_0x7c21('0x1c')](_0x3355db)['then'](function(){_0x4d38f7({'val':0x1});});})[_0x7c21('0x63')](function(_0x4464d8){logger[_0x7c21('0x5d')](_0x4464d8[_0x7c21('0x5e')]);_0x4d38f7({'val':0x0});});});}function updateTzVoiceQueues(_0x271c36){return new Promise(function(_0x3a780f,_0x3835f7){var _0x4f76b7=squel[_0x7c21('0xf')]()['fields']([_0x7c21('0x67'),_0x7c21('0x68')])[_0x7c21('0x34')]('voice_queues')[_0x7c21('0x12')](_0x7c21('0x69'),null,_0x7c21('0x6a'))[_0x7c21('0x14')](_0x7c21('0x6b')+_0x271c36);db[_0x7c21('0x60')]['query'](_0x4f76b7[_0x7c21('0x3d')]())[_0x7c21('0x62')](function(_0x26f563){var _0x289fea=[];for(var _0x198508=0x0;_0x198508<_0x26f563[_0x7c21('0x18')];_0x198508++){_0x289fea['push'](getTimezoneData(_0x26f563[_0x198508],tmp_voice_queues));}BPromise['all'](_0x289fea)['then'](function(){_0x3a780f({'val':0x1});});})[_0x7c21('0x63')](function(_0x7beb65){logger[_0x7c21('0x5d')](_0x7beb65['message']);_0x3a780f({'val':0x0});});});}function getTimezoneData(_0x4a6a0a,_0x12471a){return new Promise(function(_0x3b33a3,_0x21bc06){var _0x36fdd1=shared[_0x7c21('0x6c')];var _0x36bc9d=_0x36fdd1[_0x4a6a0a[_0x7c21('0x6d')]];if(_[_0x7c21('0x1d')](_0x36bc9d)){_0x3b33a3({'ret':0x1});}else{var _0x5b6331=_0x36bc9d['utcOffset'];var _0x553dce=squel['insert']()[_0x7c21('0x2b')](_0x12471a)[_0x7c21('0x6e')]('id',_0x4a6a0a['id'])['set'](_0x7c21('0x6f'),_0x5b6331)[_0x7c21('0x6e')](_0x7c21('0x6d'),_0x4a6a0a[_0x7c21('0x6d')])['toString']();return db['sequelize']['query'](_0x553dce)['spread'](function(_0x8999ba){_0x3b33a3({'ret':0x1});})[_0x7c21('0x63')](function(_0x5b562e){logger[_0x7c21('0x5d')](_0x5b562e[_0x7c21('0x5e')]);_0x21bc06({'ret':0x1});});}});}function handleTZQuery(_0x496c00){logger['info'](_0x496c00);return db['sequelize'][_0x7c21('0x61')](_0x496c00)[_0x7c21('0x62')](function(_0xf71cad){})[_0x7c21('0x63')](function(_0x472ec2){logger[_0x7c21('0x5d')](_0x472ec2[_0x7c21('0x5e')]);});}function main(_0x3221dd,_0x13cb43,_0x2326fe,_0x27d6cd){logger['info'](_0x7c21('0x70'),_0x3221dd,JSON[_0x7c21('0x71')](_0x13cb43));process[_0x7c21('0x72')](_0x7c21('0x73'));var _0x20d57c=_0x13cb43[_0x7c21('0x74')];var _0x203df7=_[_0x7c21('0x75')](_0x20d57c);var _0x4f365c=_0x13cb43[_0x7c21('0x76')];var _0x3ea25a=path[_0x7c21('0x12')](config['root'],_0x7c21('0x77'),_0x4f365c+_0x7c21('0x78'));hasTZ=_[_0x7c21('0x53')](_0x20d57c)[_0x7c21('0x79')](_0x7c21('0x6d'));var _0x4984b7=_[_0x7c21('0x53')](_0x20d57c)[_0x7c21('0x12')]();logger[_0x7c21('0x5b')](_0x7c21('0x7a'),_0x4984b7);db[_0x7c21('0x7b')][_0x7c21('0x16')]({'raw':!![],'attributes':['id',_0x7c21('0x7c')]})[_0x7c21('0x1a')](function(_0x4c64ed){for(var _0x85f973=0x0;_0x85f973<_0x4c64ed[_0x7c21('0x18')];_0x85f973++){if(_0x4c64ed[_0x85f973][_0x7c21('0x7c')]in _0x20d57c){contactItemTypes[_0x7c21('0x19')](_0x4c64ed[_0x85f973]);delete _0x203df7[_0x4c64ed[_0x85f973]['name']];hasAdditionalPhones=!![];}for(var _0xcdc28b in _0x20d57c){if(_0x4c64ed[_0x85f973][_0x7c21('0x7c')]+_0x7c21('0x7d')===_0xcdc28b){phoneDescriptions[_0x7c21('0x19')]({'itemTypeId':_0x4c64ed[_0x85f973]['id'],'description':_0xcdc28b});delete _0x203df7[_0xcdc28b];}}}if(hasAdditionalPhones)_0x203df7[_0x7c21('0x17')]='';var _0x2c79ff=_['keys'](_0x203df7)[_0x7c21('0x12')]();logger[_0x7c21('0x5b')](_0x7c21('0x7a'),_0x2c79ff);fs['writeFileSync'](_0x3ea25a,_0x2c79ff+'\x0a');Papa[_0x7c21('0x7e')](fs['createReadStream'](_0x3221dd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x270870,_0xe16d7d){try{for(var _0x584d15=0x0,_0x441d5c=[];_0x584d15<_0x270870[_0x7c21('0x7f')][_0x7c21('0x18')];_0x584d15++){stats[_0x7c21('0x80')]+=0x1;if(_0x270870[_0x7c21('0x5f')][_0x584d15]){handleError(_0x270870['data'][_0x584d15],_0x270870[_0x7c21('0x5f')][_0x584d15]);}else{var _0x5dab01=[];var _0x46b4b0=[];var _0x4ee4b4={};for(var _0x3bb400 in _0x20d57c){let _0x523a33=contactItemTypes[_0x7c21('0x81')](_0x258041=>_0x258041[_0x7c21('0x7c')]===_0x3bb400);let _0x3f187f=contactItemTypes[_0x7c21('0x81')](_0x4e4ceb=>_0x4e4ceb[_0x7c21('0x7c')]+_0x7c21('0x7d')===_0x3bb400);if(_[_0x7c21('0x1d')](_0x523a33)&&_['isNil'](_0x3f187f)){if(_0x20d57c['hasOwnProperty'](_0x3bb400)){if(_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]]){var _0x74deff=_[_0x7c21('0x82')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]]['replace'](/"/g,'\x27'));switch(_0x3bb400){case _0x7c21('0x44'):var _0x5485a2=moment(_0x74deff,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5485a2[_0x7c21('0x83')]()){_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}else{_0x5dab01[_0x7c21('0x19')](_0x7c21('0x84'));}break;case _0x7c21('0x45'):var _0x35c1b4=parseInt(_0x74deff);_0x74deff=_[_0x7c21('0x85')](_0x35c1b4)||_0x35c1b4<0x0||_0x35c1b4>0x4?_0x27d6cd?0x3:0x2:_0x35c1b4;_0x441d5c['push']('\x22'+_0x74deff+'\x22');break;case _0x7c21('0x31'):var _0x22552c=parseInt(_0x74deff);if(_[_0x7c21('0x86')](_0x22552c)&&_[_0x7c21('0x79')](_0x2326fe,_0x22552c)){_0x441d5c['push']('\x22'+_0x22552c+'\x22');}else{_0x5dab01['push'](_0x7c21('0x87'));}break;case _0x7c21('0x88'):if(isEmail(_0x74deff)){_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}else{_0x5dab01[_0x7c21('0x19')](_0x7c21('0x89'));}break;case _0x7c21('0x8a'):var _0x3d8122=moment(_0x74deff,'YYYY-MM-DD',!![]);if(_0x3d8122['isValid']()){_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}else{_0x5dab01[_0x7c21('0x19')](_0x7c21('0x8b'));}break;case _0x7c21('0x6d'):var _0x5eec84=shared[_0x7c21('0x6c')];var _0x511034=_0x5eec84[_0x74deff];if(!_['isNil'](_0x511034)){var _0x317bb9=_0x511034[_0x7c21('0x8c')];_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');_0x441d5c[_0x7c21('0x19')]('\x22'+_0x317bb9+'\x22');}break;default:_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}}else{switch(_0x3bb400){case _0x7c21('0x8d'):case _0x7c21('0x11'):_0x5dab01[_0x7c21('0x19')](_0x3bb400+_0x7c21('0x8e'));break;default:_0x441d5c[_0x7c21('0x19')]('\x22\x22');}}}}else{var _0x4196e9='';if(!_[_0x7c21('0x1d')](_0x523a33)){if(!_0x4ee4b4[_0x7c21('0x8f')](_0x523a33['id'])){if(!_[_0x7c21('0x1d')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]])){var _0x74deff=_[_0x7c21('0x82')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]][_0x7c21('0x90')](/"/g,'\x27'));var _0x2dc05f=phoneDescriptions[_0x7c21('0x81')](_0x1d0279=>_0x1d0279[_0x7c21('0x91')]===_0x523a33['id']);if(!_[_0x7c21('0x1d')](_0x2dc05f)){var _0x417449=_[_0x7c21('0x82')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x2dc05f[_0x7c21('0x92')]]][_0x7c21('0x90')](/"/g,'\x27'));if(!_['isNil'](_0x417449))_0x74deff=_0x74deff+'§'+_0x417449;}if(_0x4196e9=='')_0x4196e9=_0x74deff;else _0x4196e9+='|'+_0x74deff;}_0x46b4b0[_0x7c21('0x19')](_0x523a33['id']+':'+_0x4196e9);_0x4ee4b4[_0x523a33['id']]=0x1;}}}}if(hasAdditionalPhones){_0x441d5c['push']('\x22'+_0x46b4b0['join'](';')+'\x22');}if(_0x5dab01[_0x7c21('0x18')]){handleError(_0x270870[_0x7c21('0x7f')][_0x584d15],{'code':_0x7c21('0x93'),'message':_0x5dab01[_0x7c21('0x12')]()});}else{fs['appendFileSync'](_0x3ea25a,_0x441d5c[_0x7c21('0x12')]()+'\x0a');}_0x441d5c=[];}if(!(stats[_0x7c21('0x80')]%0xc8)){socket[_0x7c21('0x94')](_0x7c21('0x95')+_0x4f365c,stats);stats[_0x7c21('0x5f')]=[];}}if(stopped){logger[_0x7c21('0x5b')](_0x7c21('0x96'));_0xe16d7d[_0x7c21('0x97')]();}}catch(_0x43ff88){handleError(_0x270870[_0x7c21('0x7f')][_0x584d15],{'code':_0x7c21('0x98'),'message':_0x43ff88[_0x7c21('0x5e')]});logger[_0x7c21('0x5d')](_0x7c21('0x99'),_0x43ff88[_0x7c21('0x5e')]);}},'complete':function(){try{var _0x1dc2a8=[];var _0x55bcb5=[];var _0x49496d=_0x7c21('0x35');if(_0x13cb43[_0x7c21('0x9a')]&&_0x13cb43[_0x7c21('0x9a')][_0x7c21('0x18')]){_0x49496d=_0x7c21('0x9b')+_0x4f365c;_0x1dc2a8[_0x7c21('0x19')](_0x7c21('0x9c')+_0x49496d+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7c21('0x9d')+_0x4f365c;tmp_voice_queues=_0x7c21('0x9e')+_0x4f365c;_0x55bcb5[_0x7c21('0x19')](_0x7c21('0x9c')+tmp_campaigns+_0x7c21('0x9f'));_0x55bcb5[_0x7c21('0x19')](_0x7c21('0x9c')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x55bcb5,handleTZQuery)[_0x7c21('0x1a')](function(_0x2d5270){updateTzCampaigns(_0x13cb43[_0x7c21('0x2e')])['then'](function(_0x5c0430){updateTzVoiceQueues(_0x13cb43[_0x7c21('0x2e')])[_0x7c21('0x1a')](function(_0x1a3487){if(hasTZ)_0x2c79ff=_0x2c79ff[_0x7c21('0x90')](_0x7c21('0x6d'),_0x7c21('0xa0'));var _0xfa57de=util['format'](_0x7c21('0xa1'),_0x3ea25a,_0x49496d,_0x2c79ff,_0x13cb43[_0x7c21('0x2e')],_0x13cb43['CompanyId']||null,NOW,NOW);if(_[_0x7c21('0x1d')](_0x20d57c[_0x7c21('0x44')])){_0xfa57de+=_0x7c21('0xa2');}_0x1dc2a8[_0x7c21('0x19')](_0xfa57de);if(_0x13cb43[_0x7c21('0x9a')]&&_0x13cb43[_0x7c21('0x9a')][_0x7c21('0x18')]){_0x1dc2a8[_0x7c21('0x19')](insertCmContact(_0x13cb43[_0x7c21('0x2e')],_0x49496d,_0x13cb43[_0x7c21('0x9a')],_0x20d57c));_0x1dc2a8[_0x7c21('0x19')](_0x7c21('0xa3')+_0x49496d+';');}BPromise[_0x7c21('0xa4')](_0x1dc2a8,handleQuery)['then'](function(_0x2abb60){BPromise[_0x7c21('0x1c')]([handleAdditionalPhones()])[_0x7c21('0x1a')](function(){_0x1dc2a8=[];for(var _0x2ebd31=0x0;_0x2ebd31\x20\x20','existsSync','argv','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','field','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','toString','cm_contacts.ListId','insert','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','errors','code','main','stringify','send','start','binding','clone','root','server/files/tmp'];(function(_0x4c6140,_0x40b8ce){var _0x557c93=function(_0x21bb11){while(--_0x21bb11){_0x4c6140['push'](_0x4c6140['shift']());}};_0x557c93(++_0x40b8ce);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xfd7b[_0x3ea913];return _0x2b4f28;};'use strict';var fs=require('fs');var path=require(_0xbfd7('0x0'));var _=require(_0xbfd7('0x1'));var Papa=require(_0xbfd7('0x2'));var util=require('util');var BPromise=require(_0xbfd7('0x3'));var moment=require(_0xbfd7('0x4'));var squel=require(_0xbfd7('0x5'));var Redis=require('ioredis');var db=require(_0xbfd7('0x6'))['db'];var config=require(_0xbfd7('0x7'));var logger=require(_0xbfd7('0x8'))('import');config[_0xbfd7('0x9')]=_[_0xbfd7('0xa')](config['redis'],{'host':_0xbfd7('0xb'),'port':0x18eb});var socket=require(_0xbfd7('0xc'))(new Redis(config[_0xbfd7('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xbfd7('0xd'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0xbfd7('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x132bd8){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))*$/[_0xbfd7('0xf')](_0x132bd8);}function selectNotIn(_0xc4cfe9,_0x57a56c,_0x2cba60,_0x44b32c,_0x28bf56){return squel['select']()[_0xbfd7('0x10')](_0xbfd7('0x11'))['from'](_0x44b32c)[_0xbfd7('0x12')](_0x57a56c,null,_0x57a56c+_0xbfd7('0x13')+_0x44b32c+'.'+_0x2cba60)['where'](_0x44b32c+'.'+_0x2cba60+_0xbfd7('0x14')+_0xc4cfe9+'.'+_0x2cba60)[_0xbfd7('0x15')](_0x57a56c+_0xbfd7('0x16')+_0x28bf56[_0xbfd7('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2ba278,_0x3b6cf9){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbfd7('0x17')][_0xbfd7('0x18')](_0xbfd7('0x19')+tempTableName)[_0xbfd7('0x1a')](function(_0xdc8970){if(_0xdc8970!==null){var _0x465419=[];for(var _0x42b276=0x0;_0x42b276<_0xdc8970[_0xbfd7('0x1b')];_0x42b276++){var _0x28c092=_0xdc8970[_0x42b276];if(!_[_0xbfd7('0x1c')](_0x28c092[_0xbfd7('0x11')])){if(!_['isNil'](_0x28c092[_0xbfd7('0x1d')]))_0x465419[_0xbfd7('0x1e')](insertAdditionalPhones(_0x28c092));promisesContact[_0xbfd7('0x1e')]({'contact':_0x28c092});}}}Promise[_0xbfd7('0x1f')](_0x465419)[_0xbfd7('0x20')](function(){_0x2ba278({'val':0x1});});})[_0xbfd7('0x21')](function(_0x54f201){logger['error'](_0x54f201['message']);});});}function insertAdditionalPhones(_0x32dba8){return new Promise(function(_0x4a003b,_0x4bd787){var _0x448658=_0x32dba8[_0xbfd7('0x1d')];if(_[_0xbfd7('0x1c')](_0x448658))_0x4bd787({'val':0x0});else{var _0x3d0b8b=_0x448658[_0xbfd7('0x22')](';');var _0x492a5b=[];orderBy=0x0;for(var _0x1705b6=0x0;_0x1705b6<_0x3d0b8b[_0xbfd7('0x1b')];_0x1705b6++){_0x492a5b[_0xbfd7('0x1e')](splitAdditionalPhone(_0x32dba8['id'],_0x3d0b8b[_0x1705b6]));}Promise[_0xbfd7('0x1f')](_0x492a5b)[_0xbfd7('0x20')](function(){_0x4a003b({'val':_0x3d0b8b[_0xbfd7('0x1b')]});});}});}function splitAdditionalPhone(_0x31ecc9,_0x324ae1){return new Promise(function(_0x49fbf7,_0x25f44c){var _0x14189d=_0x324ae1[_0xbfd7('0x22')](':');var _0x49903e=_0x14189d[0x0];var _0x284cff=_0x14189d[0x1];if(_0x284cff!==''){var _0xd862e3=_0x284cff[_0xbfd7('0x22')]('|');var _0x4e539e=[];for(var _0x44ee2a=0x0;_0x44ee2a<_0xd862e3[_0xbfd7('0x1b')];_0x44ee2a++){if(_0xd862e3[_0x44ee2a]!==''){var _0x3c41d5=_[_0xbfd7('0x23')](promisesAdditionalPhones,{'contactId':_0x31ecc9,'phone':_0xd862e3[_0x44ee2a]});if(_0x3c41d5[_0xbfd7('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xbfd7('0x1e')]({'contactId':_0x31ecc9,'contactTypeId':_0x49903e,'phone':_0xd862e3[_0x44ee2a],'orderBy':orderBy});}}}_0x49fbf7({'ok':0x1});}else _0x49fbf7({'res':0x0});});}function createAdditionalPhone(_0x472fcb,_0x1bc032,_0x2766d,_0x64a409){var _0x263ee3='';var _0x2ff20f='';var _0x308259=_0x2766d['split']('§');_0x263ee3=_0x308259[0x0];if(_0x308259[_0xbfd7('0x1b')]==0x2)_0x2ff20f=_0x308259[0x1];return new Promise(function(_0x10663d,_0x132018){return db[_0xbfd7('0x24')]['findOne']({'where':{'CmContactId':_0x472fcb,'item':_0x263ee3}})['then'](function(_0x4b6794){if(_0x4b6794){return db[_0xbfd7('0x24')][_0xbfd7('0x25')]({'ItemTypeId':_0x1bc032,'description':_0x2ff20f,'OrderBy':_0x64a409},{'where':{'CmContactId':_0x472fcb,'item':_0x263ee3}})[_0xbfd7('0x20')](function(_0x5107e6){_0x10663d({'res':_0xbfd7('0x26')});});}else{return db[_0xbfd7('0x24')][_0xbfd7('0x27')]({'CmContactId':_0x472fcb,'item':_0x263ee3,'ItemTypeId':_0x1bc032,'description':_0x2ff20f,'OrderBy':_0x64a409,'ItemClass':_0xbfd7('0x28')})[_0xbfd7('0x20')](function(_0x4797de){_0x10663d({'res':_0xbfd7('0x29')});});}});});}function updateContact(_0x8f8234){return new Promise(function(_0x143d86,_0x44bb99){var _0x4debca=_0x8f8234['id'];delete _0x8f8234['id'];return db[_0xbfd7('0x2a')][_0xbfd7('0x25')](_0x8f8234,{'where':{'id':_0x4debca}})[_0xbfd7('0x20')](function(_0x4b1980){updatedRows+=0x1;return db[_0xbfd7('0x2b')][_0xbfd7('0x25')]({'phone':_0x8f8234[_0xbfd7('0x11')]},{'where':{'ContactId':_0x4debca}})['then'](function(_0x76ef1e){_0x143d86({'ret':'OK'});});});});}function insertCmHopper(_0x5a6b11,_0x34d3d0,_0x527357,_0x74281a,_0x1a3b06){var _0x23faf8=[_0xbfd7('0x2c'),_0xbfd7('0x2d'),_0xbfd7('0x2e'),'cm_contacts.ListId',_0x34d3d0+'.'+_0x74281a,_0xbfd7('0x2f'),_0xbfd7('0x30'),_0xbfd7('0x31'),_0xbfd7('0x32'),'\x22'+_0x1a3b06+'\x22'];return squel['insert']()[_0xbfd7('0x33')]('cm_hopper')[_0xbfd7('0x34')]([_0xbfd7('0x11'),'scheduledat',_0xbfd7('0x35'),_0xbfd7('0x36'),_0x74281a,_0xbfd7('0x37'),_0xbfd7('0x38'),_0xbfd7('0x39'),_0xbfd7('0x3a'),_0xbfd7('0x3b')],squel[_0xbfd7('0x3c')]()['fields'](_0x23faf8)[_0xbfd7('0x3d')](_0x34d3d0)[_0xbfd7('0x12')](_0xbfd7('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x34d3d0+_0xbfd7('0x3f'))['join'](_0x527357,null,_0x527357+_0xbfd7('0x13')+_0x34d3d0+'.'+_0x74281a)[_0xbfd7('0x15')](_0x34d3d0+_0xbfd7('0x40'),_0x5a6b11)['where'](_0xbfd7('0x41'),NOW)[_0xbfd7('0x15')](_0xbfd7('0x42'),selectNotIn(_0x34d3d0,_0x527357,_0x74281a,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0xbfd7('0x15')](_0xbfd7('0x42'),selectNotIn(_0x34d3d0,_0x527357,_0x74281a,_0xbfd7('0x43'),['\x22always\x22'])))[_0xbfd7('0x44')]();}function insertCmHopperBlack(_0x1ee33e,_0x26312a,_0x5dbdc2,_0x1af30e){var _0xbc59d7=[_0xbfd7('0x2c'),'cm_contacts.id',_0xbfd7('0x45'),_0x26312a+'.'+_0x1af30e,_0xbfd7('0x2f'),_0xbfd7('0x30')];return squel[_0xbfd7('0x46')]()[_0xbfd7('0x33')](_0xbfd7('0x47'))[_0xbfd7('0x34')]([_0xbfd7('0x11'),_0xbfd7('0x35'),_0xbfd7('0x36'),_0x1af30e,_0xbfd7('0x37'),_0xbfd7('0x38')],squel[_0xbfd7('0x3c')]()[_0xbfd7('0x48')](_0xbc59d7)[_0xbfd7('0x3d')](_0x26312a)[_0xbfd7('0x12')](_0xbfd7('0x3e'),null,_0xbfd7('0x49')+_0x26312a+_0xbfd7('0x3f'))['join'](_0x5dbdc2,null,_0x5dbdc2+_0xbfd7('0x13')+_0x26312a+'.'+_0x1af30e)[_0xbfd7('0x15')](_0x26312a+_0xbfd7('0x40'),_0x1ee33e)['where'](_0xbfd7('0x41'),NOW)[_0xbfd7('0x15')](_0xbfd7('0x42'),squel[_0xbfd7('0x3c')]()['field'](_0xbfd7('0x11'))[_0xbfd7('0x3d')]('cm_hopper_black')[_0xbfd7('0x15')](_0xbfd7('0x4a'),_0x1ee33e)['where'](_0x1af30e+'\x20=\x20?',_0x26312a+'.'+_0x1af30e)))[_0xbfd7('0x44')]();}function insertCmHopperAdditionalPhones(_0x7d3b38){var _0x5a4de4=[_0xbfd7('0x4b'),_0xbfd7('0x4c'),'cm_contact_has_items.OrderBy',_0xbfd7('0x4d'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xbfd7('0x33')](_0xbfd7('0x4e'))[_0xbfd7('0x34')]([_0xbfd7('0x4f'),_0xbfd7('0x11'),'OrderBy',_0xbfd7('0x37'),_0xbfd7('0x38')],squel[_0xbfd7('0x3c')]()[_0xbfd7('0x48')](_0x5a4de4)[_0xbfd7('0x3d')](_0xbfd7('0x43'))[_0xbfd7('0x12')]('cm_contacts',null,_0xbfd7('0x50'))[_0xbfd7('0x12')]('cm_contact_has_items',null,_0xbfd7('0x51'))[_0xbfd7('0x15')](_0xbfd7('0x52'),_0x7d3b38)[_0xbfd7('0x15')](_0xbfd7('0x41'),NOW))[_0xbfd7('0x44')]();}function insertCmContact(_0x162d45,_0x403d74,_0x14c84d,_0x2e9676){var _0x5de2c0=_['concat'](_[_0xbfd7('0x53')](_0x2e9676),[_0xbfd7('0x36'),_0xbfd7('0x54'),_0xbfd7('0x37'),_0xbfd7('0x38')]);return squel['insert']()[_0xbfd7('0x33')](_0xbfd7('0x3e'))['fromQuery'](_0x5de2c0,squel[_0xbfd7('0x3c')]()[_0xbfd7('0x48')](_0x5de2c0)[_0xbfd7('0x3d')](_0x403d74)[_0xbfd7('0x15')]('('+_0x14c84d[_0xbfd7('0x12')](',')+_0xbfd7('0x55'),squel['select']()['fields'](_0x14c84d)[_0xbfd7('0x3d')](_0xbfd7('0x3e'))[_0xbfd7('0x15')](_0xbfd7('0x4a'),_0x162d45))[_0xbfd7('0x15')](_0xbfd7('0x56'),squel[_0xbfd7('0x3c')]()[_0xbfd7('0x10')](_0xbfd7('0x57'),_0xbfd7('0x58'))['from'](_0x403d74)['group'](_0x14c84d[_0xbfd7('0x12')](','))))[_0xbfd7('0x44')]();}function handleStop(){logger[_0xbfd7('0x59')](_0xbfd7('0x5a'));stopped=!![];}function handleUncaughtException(_0x21692e){logger[_0xbfd7('0x5b')](_0x21692e[_0xbfd7('0x5c')]);process['exit'](0x1);}function handleError(_0x53698a,_0x5ed55c){stats[_0xbfd7('0x5d')][_0xbfd7('0x1e')]({'name':_0x5ed55c[_0xbfd7('0x5e')],'message':_0x5ed55c[_0xbfd7('0x5c')],'row':_0x53698a});}function handleQuery(_0xec38e5){logger[_0xbfd7('0x59')](_0xec38e5);return db[_0xbfd7('0x17')]['query'](_0xec38e5)[_0xbfd7('0x1a')](function(_0x4ef6b2){results['push'](_0x4ef6b2);})[_0xbfd7('0x21')](function(_0xed8b8a){logger['error'](_0xed8b8a[_0xbfd7('0x5c')]);});}function main(_0x34ea30,_0x5c7578,_0x45726e,_0x3a76f5){logger[_0xbfd7('0x59')](_0xbfd7('0x5f'),_0x34ea30,JSON[_0xbfd7('0x60')](_0x5c7578));process[_0xbfd7('0x61')](_0xbfd7('0x62'));var _0x21570c=_0x5c7578[_0xbfd7('0x63')];var _0x35b5f2=_[_0xbfd7('0x64')](_0x21570c);var _0x32d218=_0x5c7578['socket_timestamp'];var _0x24e0be=path['join'](config[_0xbfd7('0x65')],_0xbfd7('0x66'),_0x32d218+_0xbfd7('0x67'));logger[_0xbfd7('0x59')](_0xbfd7('0x68'),_0x5c7578);db[_0xbfd7('0x69')]['findAll']({'raw':!![],'attributes':['id',_0xbfd7('0x6a')]})[_0xbfd7('0x20')](function(_0x58f801){for(var _0x271107=0x0;_0x271107<_0x58f801[_0xbfd7('0x1b')];_0x271107++){if(_0x58f801[_0x271107][_0xbfd7('0x6a')]in _0x21570c){contactItemTypes['push'](_0x58f801[_0x271107]);delete _0x35b5f2[_0x58f801[_0x271107][_0xbfd7('0x6a')]];hasAdditionalPhones=!![];}for(var _0x3833a4 in _0x21570c){if(_0x58f801[_0x271107][_0xbfd7('0x6a')]+_0xbfd7('0x6b')===_0x3833a4){phoneDescriptions['push']({'itemTypeId':_0x58f801[_0x271107]['id'],'description':_0x3833a4});delete _0x35b5f2[_0x3833a4];}}}if(hasAdditionalPhones)_0x35b5f2[_0xbfd7('0x1d')]='';var _0xb0c9a2=_[_0xbfd7('0x53')](_0x35b5f2)['join']();logger[_0xbfd7('0x59')]('header',_0xb0c9a2);fs[_0xbfd7('0x6c')](_0x24e0be,_0xb0c9a2+'\x0a');Papa[_0xbfd7('0x6d')](fs[_0xbfd7('0x6e')](_0x34ea30),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1da7c7,_0x15db65){try{for(var _0x380bac=0x0,_0x3c40e4=[];_0x380bac<_0x1da7c7[_0xbfd7('0x6f')][_0xbfd7('0x1b')];_0x380bac++){stats['rows']+=0x1;if(_0x1da7c7[_0xbfd7('0x5d')][_0x380bac]){handleError(_0x1da7c7[_0xbfd7('0x6f')][_0x380bac],_0x1da7c7[_0xbfd7('0x5d')][_0x380bac]);}else{var _0x2f7e70=[];var _0x391be0=[];var _0x2bf68e={};for(var _0x168e5a in _0x21570c){let _0x20ccec=contactItemTypes[_0xbfd7('0x70')](_0x4f0264=>_0x4f0264[_0xbfd7('0x6a')]===_0x168e5a);let _0xdb5137=contactItemTypes[_0xbfd7('0x70')](_0x30bfb5=>_0x30bfb5[_0xbfd7('0x6a')]+'_description'===_0x168e5a);if(_[_0xbfd7('0x1c')](_0x20ccec)&&_[_0xbfd7('0x1c')](_0xdb5137)){if(_0x21570c[_0xbfd7('0x71')](_0x168e5a)){if(_0x1da7c7[_0xbfd7('0x6f')][_0x380bac][_0x21570c[_0x168e5a]]){var _0x4d449c=_[_0xbfd7('0x72')](_0x1da7c7[_0xbfd7('0x6f')][_0x380bac][_0x21570c[_0x168e5a]][_0xbfd7('0x73')](/"/g,'\x27'));switch(_0x168e5a){case'scheduledat':var _0x195fc9=moment(_0x4d449c,_0xbfd7('0xd'),!![]);if(_0x195fc9['isValid']()){_0x3c40e4['push']('\x22'+_0x4d449c+'\x22');}else{_0x2f7e70[_0xbfd7('0x1e')](_0xbfd7('0x74'));}break;case _0xbfd7('0x39'):var _0x268eaa=parseInt(_0x4d449c);_0x4d449c=_[_0xbfd7('0x75')](_0x268eaa)||_0x268eaa<0x0||_0x268eaa>0x4?_0x3a76f5?0x3:0x2:_0x268eaa;_0x3c40e4[_0xbfd7('0x1e')]('\x22'+_0x4d449c+'\x22');break;case _0xbfd7('0x3a'):var _0xac45aa=parseInt(_0x4d449c);if(_[_0xbfd7('0x76')](_0xac45aa)&&_[_0xbfd7('0x77')](_0x45726e,_0xac45aa)){_0x3c40e4[_0xbfd7('0x1e')]('\x22'+_0xac45aa+'\x22');}else{_0x2f7e70[_0xbfd7('0x1e')](_0xbfd7('0x78'));}break;case _0xbfd7('0x79'):if(isEmail(_0x4d449c)){_0x3c40e4[_0xbfd7('0x1e')]('\x22'+_0x4d449c+'\x22');}else{_0x2f7e70[_0xbfd7('0x1e')]('email\x20wrong\x20format');}break;case _0xbfd7('0x7a'):var _0x1da259=moment(_0x4d449c,_0xbfd7('0x7b'),!![]);if(_0x1da259['isValid']()){_0x3c40e4[_0xbfd7('0x1e')]('\x22'+_0x4d449c+'\x22');}else{_0x2f7e70['push'](_0xbfd7('0x7c'));}break;default:_0x3c40e4['push']('\x22'+_0x4d449c+'\x22');}}else{switch(_0x168e5a){case _0xbfd7('0x7d'):case _0xbfd7('0x11'):_0x2f7e70[_0xbfd7('0x1e')](_0x168e5a+_0xbfd7('0x7e'));break;default:_0x3c40e4[_0xbfd7('0x1e')]('\x22\x22');}}}}else{var _0x4fd7b6='';if(!_[_0xbfd7('0x1c')](_0x20ccec)){if(!_0x2bf68e[_0xbfd7('0x71')](_0x20ccec['id'])){for(var _0x49394c=0x0;_0x49394c<_0x21570c[_0x168e5a][_0xbfd7('0x1b')];_0x49394c++){var _0x4d449c=_[_0xbfd7('0x72')](_0x1da7c7['data'][_0x380bac][_0x21570c[_0x168e5a][_0x49394c]]['replace'](/"/g,'\x27'));var _0x4dcc24=phoneDescriptions[_0xbfd7('0x70')](_0x1aed58=>_0x1aed58['itemTypeId']===_0x20ccec['id']);if(!_[_0xbfd7('0x1c')](_0x4dcc24)){var _0x16bd7f=_[_0xbfd7('0x72')](_0x1da7c7['data'][_0x380bac][_0x21570c[_0x4dcc24['description']][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xbfd7('0x1c')](_0x16bd7f))_0x4d449c=_0x4d449c+'§'+_0x16bd7f;}if(_0x4fd7b6=='')_0x4fd7b6=_0x4d449c;else _0x4fd7b6+='|'+_0x4d449c;}_0x391be0[_0xbfd7('0x1e')](_0x20ccec['id']+':'+_0x4fd7b6);_0x2bf68e[_0x20ccec['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3c40e4[_0xbfd7('0x1e')]('\x22'+_0x391be0[_0xbfd7('0x12')](';')+'\x22');}if(_0x2f7e70[_0xbfd7('0x1b')]){handleError(_0x1da7c7['data'][_0x380bac],{'code':_0xbfd7('0x7f'),'message':_0x2f7e70[_0xbfd7('0x12')]()});}else{fs['appendFileSync'](_0x24e0be,_0x3c40e4[_0xbfd7('0x12')]()+'\x0a');}_0x3c40e4=[];}if(!(stats['rows']%0xc8)){socket[_0xbfd7('0x80')](_0xbfd7('0x81')+_0x32d218,stats);stats[_0xbfd7('0x5d')]=[];}}if(stopped){logger[_0xbfd7('0x59')]('Abort\x20parser');_0x15db65[_0xbfd7('0x82')]();}}catch(_0x1559d9){handleError(_0x1da7c7[_0xbfd7('0x6f')][_0x380bac],{'code':_0xbfd7('0x83'),'message':_0x1559d9['message']});logger[_0xbfd7('0x5b')]('step',_0x1559d9[_0xbfd7('0x5c')]);}},'complete':function(){try{var _0x3b44f2=[];var _0x34a9d1=tempTableName;_0x3b44f2[_0xbfd7('0x1e')](_0xbfd7('0x84')+_0x34a9d1+'\x20LIKE\x20cm_contacts;');logger[_0xbfd7('0x59')]('CIS\x20len',contactItemTypes[_0xbfd7('0x1b')]);var _0x42581d=util[_0xbfd7('0x85')](_0xbfd7('0x86'),_0x24e0be,_0x34a9d1,_0xb0c9a2,_0x5c7578[_0xbfd7('0x36')],_0x5c7578[_0xbfd7('0x54')]||null,NOW,NOW);if(_[_0xbfd7('0x1c')](_0x21570c[_0xbfd7('0x87')])){_0x42581d+=_0xbfd7('0x88');}_0x3b44f2['push'](_0x42581d);BPromise['each'](_0x3b44f2,handleQuery)['then'](function(_0x2da559){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x3b44f2=[];for(var _0x3f0bc9=0x0;_0x3f0bc9_0x5678b6[_0xd52e('0x6d')]===_0x4227d9);let _0x552f12=contactItemTypes[_0xd52e('0x76')](_0x56ce2b=>_0x56ce2b[_0xd52e('0x6d')]+'_description'===_0x4227d9);if(_[_0xd52e('0x1f')](_0x41ead1)&&_[_0xd52e('0x1f')](_0x552f12)){if(_0x301c73['hasOwnProperty'](_0x4227d9)){if(_0x595c41[_0xd52e('0x74')][_0x12b4c1][_0x301c73[_0x4227d9]]){var _0x25c16c=_[_0xd52e('0x77')](_0x595c41[_0xd52e('0x74')][_0x12b4c1][_0x301c73[_0x4227d9]][_0xd52e('0x78')](/"/g,'\x27'));switch(_0x4227d9){case'scheduledat':var _0x417311=moment(_0x25c16c,_0xd52e('0xd'),!![]);if(_0x417311[_0xd52e('0x79')]()){_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}else{_0x3f3ce2[_0xd52e('0x26')](_0xd52e('0x7a'));}break;case _0xd52e('0x41'):var _0x2e9bff=parseInt(_0x25c16c);_0x25c16c=_['isNaN'](_0x2e9bff)||_0x2e9bff<0x0||_0x2e9bff>0x4?_0x7be33d?0x3:0x2:_0x2e9bff;_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');break;case'UserId':var _0x19860e=parseInt(_0x25c16c);if(_[_0xd52e('0x7b')](_0x19860e)&&_[_0xd52e('0x7c')](_0x30b4fc,_0x19860e)){_0x56407c[_0xd52e('0x26')]('\x22'+_0x19860e+'\x22');}else{_0x3f3ce2['push'](_0xd52e('0x7d'));}break;case _0xd52e('0x7e'):if(isEmail(_0x25c16c)){_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}else{_0x3f3ce2[_0xd52e('0x26')](_0xd52e('0x7f'));}break;case _0xd52e('0x80'):var _0x3a0612=moment(_0x25c16c,_0xd52e('0x81'),!![]);if(_0x3a0612[_0xd52e('0x79')]()){_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}else{_0x3f3ce2['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}}else{switch(_0x4227d9){case _0xd52e('0x82'):case _0xd52e('0x14'):_0x3f3ce2[_0xd52e('0x26')](_0x4227d9+_0xd52e('0x83'));break;default:_0x56407c['push']('\x22\x22');}}}}else{var _0x1c137a='';if(!_[_0xd52e('0x1f')](_0x41ead1)){if(!_0x3b0458[_0xd52e('0x84')](_0x41ead1['id'])){for(var _0x145d06=0x0;_0x145d06<_0x301c73[_0x4227d9]['length'];_0x145d06++){var _0x25c16c=_[_0xd52e('0x77')](_0x595c41[_0xd52e('0x74')][_0x12b4c1][_0x301c73[_0x4227d9][_0x145d06]]['replace'](/"/g,'\x27'));var _0x10987d=phoneDescriptions['find'](_0x5b633c=>_0x5b633c[_0xd52e('0x85')]===_0x41ead1['id']);if(!_[_0xd52e('0x1f')](_0x10987d)){var _0x4b17c4=_[_0xd52e('0x77')](_0x595c41['data'][_0x12b4c1][_0x301c73[_0x10987d[_0xd52e('0x86')]][0x0]][_0xd52e('0x78')](/"/g,'\x27'));if(!_['isNil'](_0x4b17c4))_0x25c16c=_0x25c16c+'§'+_0x4b17c4;}if(_0x1c137a=='')_0x1c137a=_0x25c16c;else _0x1c137a+='|'+_0x25c16c;}_0x395ae9[_0xd52e('0x26')](_0x41ead1['id']+':'+_0x1c137a);_0x3b0458[_0x41ead1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56407c['push']('\x22'+_0x395ae9[_0xd52e('0x19')](';')+'\x22');}if(_0x3f3ce2[_0xd52e('0x1e')]){handleError(_0x595c41[_0xd52e('0x74')][_0x12b4c1],{'code':_0xd52e('0x87'),'message':_0x3f3ce2[_0xd52e('0x19')]()});}else{fs['appendFileSync'](_0x9c66d3,_0x56407c[_0xd52e('0x19')]()+'\x0a');}_0x56407c=[];}if(!(stats[_0xd52e('0x75')]%0xc8)){socket[_0xd52e('0x88')](_0xd52e('0x89')+_0x46eb89,stats);stats[_0xd52e('0x62')]=[];}}if(stopped){logger[_0xd52e('0x5f')]('Abort\x20parser');_0x5ed614[_0xd52e('0x8a')]();}}catch(_0x4fa72e){handleError(_0x595c41[_0xd52e('0x74')][_0x12b4c1],{'code':_0xd52e('0x8b'),'message':_0x4fa72e[_0xd52e('0x24')]});logger['error'](_0xd52e('0x8c'),_0x4fa72e[_0xd52e('0x24')]);}},'complete':function(){try{var _0x27e53d=[];var _0x4d091a=tempTableName;_0x27e53d[_0xd52e('0x26')]('CREATE\x20TABLE\x20'+_0x4d091a+'\x20LIKE\x20cm_contacts;');logger['info'](_0xd52e('0x8d'),contactItemTypes[_0xd52e('0x1e')]);var _0x59cff3=util['format'](_0xd52e('0x8e'),_0x9c66d3,_0x4d091a,_0x5da9df,_0x4d39d8[_0xd52e('0x3f')],_0x4d39d8[_0xd52e('0x5a')]||null,NOW,NOW);if(_['isNil'](_0x301c73['scheduledat'])){_0x59cff3+=_0xd52e('0x8f');}_0x27e53d[_0xd52e('0x26')](_0x59cff3);BPromise['each'](_0x27e53d,handleQuery)[_0xd52e('0x21')](function(_0x2b815c){BPromise[_0xd52e('0x27')]([handleAdditionalPhones()])[_0xd52e('0x21')](function(){_0x27e53d=[];for(var _0x19c889=0x0;_0x19c889\x20\x20');}var _0x589339=path[_0xd52e('0x19')](config[_0xd52e('0x6a')],_0xd52e('0x98'),process[_0xd52e('0x97')][0x2]);if(!fs['existsSync'](_0x589339)){throw new Error(_0xd52e('0x99'));}var _0xea828f={};try{_0xea828f=JSON[_0xd52e('0x72')](process['argv'][0x3]);if(!_0xea828f[_0xd52e('0x9a')]){throw new Error(_0xd52e('0x9b'));}var _0x293a8a=0x0;if(_0xea828f[_0xd52e('0x9a')][_0xd52e('0x42')]){_0x293a8a=0x1;}if(!_0xea828f[_0xd52e('0x3f')]){throw new Error(_0xd52e('0x9c'));}}catch(_0x515d9e){throw new Error(_0xd52e('0x9d'));}var _0x357c07=[];try{_0x357c07=_[_0xd52e('0x9e')](JSON[_0xd52e('0x72')](process[_0xd52e('0x97')][0x4]),'id');}catch(_0x1b9ecb){logger[_0xd52e('0x5f')]('No\x20agent\x20available');}main(_0x589339,_0xea828f,_0x357c07,_0x293a8a);}validate();process['on'](_0xd52e('0x9f'),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 c94cd36..59b2d07 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 _0x8089=['Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','destcalleridnum','Member\x20Name','membername','uniqueid','starttime','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','outbound','Outbound\x20Call','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8089,0x6f));var _0x9808=function(_0x229dcb,_0x5b926a){_0x229dcb=_0x229dcb-0x0;var _0x45c440=_0x8089[_0x229dcb];return _0x45c440;};'use strict';exports[_0x9808('0x0')]=function(_0xb0e74a,_0x1c337d){var _0x525f6a=[{'type':_0x9808('0x1'),'content':_0x9808('0x2'),'variableName':null}];switch(_0xb0e74a[_0x9808('0x3')]()){case'voice':switch(_0x1c337d[_0x9808('0x3')]()){case _0x9808('0x4'):_0x525f6a[_0x9808('0x5')]({'type':_0x9808('0x6'),'content':'','variableName':'queue'});_0x525f6a[_0x9808('0x5')]({'type':_0x9808('0x6'),'content':'','variableName':'calleridnum'});break;case _0x9808('0x7'):_0x525f6a['push']({'type':_0x9808('0x1'),'content':_0x9808('0x8'),'variableName':null});_0x525f6a[_0x9808('0x5')]({'type':_0x9808('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x525f6a;};exports['getDescriptions']=function(_0x209394,_0x3d4f93){var _0x4cf750=[];switch(_0x209394[_0x9808('0x3')]()){case _0x9808('0x9'):switch(_0x3d4f93[_0x9808('0x3')]()){case _0x9808('0x4'):_0x4cf750=[{'type':_0x9808('0x1'),'content':_0x9808('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0xc'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0xd')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0xe'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0xf')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x9808('0x6'),'variableName':'destexten'},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x10'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0x11')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x12'),'keyType':_0x9808('0x6'),'variableName':'uniqueid'},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x13'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0x14')},{'type':_0x9808('0x1'),'content':_0x9808('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x16'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0x17')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x18'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x9808('0x1'),'content':_0x9808('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x9808('0x6'),'variableName':_0x9808('0x14')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x1a'),'keyType':'variable','variableName':_0x9808('0x1b')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x1c'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0x1d')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x1e'),'keyType':_0x9808('0x6'),'variableName':_0x9808('0x1f')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x20'),'keyType':'variable','variableName':'talktime'}];break;case _0x9808('0x7'):_0x4cf750=[{'type':_0x9808('0x1'),'content':_0x9808('0xa'),'variableName':null},{'type':_0x9808('0xb'),'content':'','key':'Called\x20Number','keyType':_0x9808('0x6'),'keyContent':'','variableName':_0x9808('0x21')},{'type':'keyValue','content':'','key':_0x9808('0x22'),'keyType':'variable','keyContent':'','variableName':_0x9808('0x23')},{'type':_0x9808('0xb'),'content':'','key':'UniqueId','keyType':_0x9808('0x6'),'keyContent':'','variableName':_0x9808('0x24')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x13'),'keyType':_0x9808('0x6'),'keyContent':'','variableName':_0x9808('0x25')},{'type':_0x9808('0x1'),'content':_0x9808('0x19')},{'type':_0x9808('0xb'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x9808('0x26')},{'type':'keyValue','content':'','key':_0x9808('0x27'),'keyType':'variable','keyContent':'','variableName':_0x9808('0x28')},{'type':'keyValue','content':'','key':_0x9808('0x29'),'keyType':_0x9808('0x6'),'keyContent':'','variableName':_0x9808('0x2a')},{'type':_0x9808('0xb'),'content':'','key':_0x9808('0x2b'),'keyType':_0x9808('0x6'),'keyContent':'','variableName':_0x9808('0x2c')}];break;}}return _0x4cf750;}; \ No newline at end of file +var _0x409e=['Outbound\x20Call','destcalleridnum','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Member\x20Name','membername','starttime','Complete\x20Time','Duration','duration','Billable\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound'];(function(_0x4b2317,_0x1a8e70){var _0x8af23=function(_0x14b03b){while(--_0x14b03b){_0x4b2317['push'](_0x4b2317['shift']());}};_0x8af23(++_0x1a8e70);}(_0x409e,0x168));var _0xe409=function(_0x412f4e,_0x4bfe0a){_0x412f4e=_0x412f4e-0x0;var _0x4c57d1=_0x409e[_0x412f4e];return _0x4c57d1;};'use strict';exports['getSubjects']=function(_0x38f437,_0x11b7cd){var _0x26ce60=[{'type':_0xe409('0x0'),'content':_0xe409('0x1'),'variableName':null}];switch(_0x38f437[_0xe409('0x2')]()){case _0xe409('0x3'):switch(_0x11b7cd[_0xe409('0x2')]()){case _0xe409('0x4'):_0x26ce60[_0xe409('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x26ce60[_0xe409('0x5')]({'type':_0xe409('0x6'),'content':'','variableName':_0xe409('0x7')});break;case _0xe409('0x8'):_0x26ce60[_0xe409('0x5')]({'type':_0xe409('0x0'),'content':_0xe409('0x9'),'variableName':null});_0x26ce60[_0xe409('0x5')]({'type':_0xe409('0x6'),'content':'','variableName':_0xe409('0xa')});break;}}return _0x26ce60;};exports['getDescriptions']=function(_0x2554c0,_0x3ce86d){var _0x343dba=[];switch(_0x2554c0[_0xe409('0x2')]()){case _0xe409('0x3'):switch(_0x3ce86d[_0xe409('0x2')]()){case _0xe409('0x4'):_0x343dba=[{'type':_0xe409('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0xc'),'keyType':'variable','variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0xe409('0xd'),'keyType':'variable','variableName':_0xe409('0xe')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0xf'),'keyType':_0xe409('0x6'),'variableName':_0xe409('0x10')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x11'),'keyType':'variable','variableName':_0xe409('0x12')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x13'),'keyType':_0xe409('0x6'),'variableName':'uniqueid'},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x14'),'keyType':_0xe409('0x6'),'variableName':_0xe409('0x15')},{'type':_0xe409('0x0'),'content':_0xe409('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xe409('0x17'),'keyType':_0xe409('0x6'),'variableName':_0xe409('0x18')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x19'),'keyType':_0xe409('0x6'),'variableName':'destcalleridnum'},{'type':_0xe409('0x0'),'content':_0xe409('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x1b'),'keyType':_0xe409('0x6'),'variableName':'agentcalledAt'},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x1c'),'keyType':'variable','variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xe409('0x1d'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0xe409('0x1e'),'keyType':'variable','variableName':_0xe409('0x1f')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x20'),'keyType':_0xe409('0x6'),'variableName':'talktime'}];break;case _0xe409('0x8'):_0x343dba=[{'type':'string','content':_0xe409('0x21'),'variableName':null},{'type':_0xe409('0xb'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x22'),'keyType':_0xe409('0x6'),'keyContent':'','variableName':_0xe409('0x23')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x13'),'keyType':_0xe409('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x14'),'keyType':_0xe409('0x6'),'keyContent':'','variableName':_0xe409('0x24')},{'type':_0xe409('0x0'),'content':_0xe409('0x1a')},{'type':_0xe409('0xb'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x25'),'keyType':_0xe409('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x26'),'keyType':_0xe409('0x6'),'keyContent':'','variableName':_0xe409('0x27')},{'type':_0xe409('0xb'),'content':'','key':_0xe409('0x28'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x343dba;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9ed6d3a..dac59b6 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 _0x41f5=['html','phone','fax','updateUser','./utils','skipInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','body','contact','default','where','filter','user','tags','group','i.id','ids','tag','countFilteredInteractions','count','having','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','rows','catch','tracked','query'];(function(_0x1aee19,_0x39712f){var _0xb9e775=function(_0x1d0712){while(--_0x1d0712){_0x1aee19['push'](_0x1aee19['shift']());}};_0xb9e775(++_0x39712f);}(_0x41f5,0x148));var _0x541f=function(_0x17876c,_0x17c9e3){_0x17876c=_0x17876c-0x0;var _0x26844b=_0x41f5[_0x17876c];return _0x26844b;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var utils=require(_0x541f('0x0'));exports['findAll']=function(_0x2cff9f,_0x18c00b,_0x5525d1,_0x2a7b34,_0x20ae8b){var _0x43a245={'count':0x0,'rows':[]};var _0x1e4d40=sqlUtils[_0x541f('0x1')](_0x2cff9f,_0x5525d1,_0x18c00b);if(_0x1e4d40){return Promise['resolve'](_0x43a245);}var _0x3b95da=sqlUtils['getInteractionsQuery'](_0x2cff9f);var _0x4f1158={};return Promise[_0x541f('0x2')]()[_0x541f('0x3')](function(){if(_0x18c00b[_0x541f('0x4')]){return sqlUtils[_0x541f('0x5')](_0x18c00b[_0x541f('0x4')],_0x20ae8b);}else{return sqlUtils[_0x541f('0x6')](_0x2cff9f,_0x18c00b,_0x20ae8b);}})['then'](function(_0x2bd025){_0x3b95da['where'](_0x2bd025[_0x541f('0x7')]);_0x3b95da['where'](_0x2bd025[_0x541f('0x8')]);_0x3b95da['where'](_0x2bd025[_0x541f('0x9')]);_0x3b95da[_0x541f('0xa')](_0x2bd025['fields']);_0x3b95da['where'](_0x2bd025[_0x541f('0xb')]);_0x3b95da[_0x541f('0xa')](_0x2bd025[_0x541f('0xc')]);_0x3b95da['having'](_0x2bd025['read']);_0x4f1158=_0x2bd025[_0x541f('0xd')];return sqlUtils['checkAccountsRestrictions'](_0x2cff9f,_0x5525d1,_0x18c00b);})[_0x541f('0x3')](function(_0x521837){_0x3b95da[_0x541f('0xa')](_0x521837);_0x3b95da[_0x541f('0xe')](_0x541f('0xf'));var _0x27c4c9=_0x18c00b[_0x541f('0x4')]?_0x4f1158[_0x541f('0x10')]:_0x18c00b[_0x541f('0x11')];return sqlUtils[_0x541f('0x12')](_0x3b95da,_0x27c4c9);})['then'](function(_0x597e47){_0x43a245['count']=_0x597e47['length'];if(_0x43a245[_0x541f('0x13')]===0x0){return[];}_0x3b95da[_0x541f('0x14')](_0x4f1158[_0x541f('0x15')]);if(_0x2a7b34['order']){_0x2a7b34[_0x541f('0x16')][_0x541f('0x17')](function(_0x3db7a0){var _0x1a42c1=_0x3db7a0[0x0]===_0x541f('0x18')?_0x3db7a0[0x0]:'i.'+_0x3db7a0[0x0];_0x3b95da[_0x541f('0x16')](_0x1a42c1,_0x3db7a0[0x1]===_0x541f('0x19')?![]:!![]);if(_0x3db7a0[0x0]===_0x541f('0x1a')){var _0x313f61=sqlUtils['getClosedOrderClause'](_0x2cff9f,_0x18c00b);_0x3b95da['order'](_0x313f61,_0x3db7a0[0x1]===_0x541f('0x19')?![]:!![]);}});}return sqlUtils[_0x541f('0x1b')](_0x2cff9f,_0x3b95da,_0x18c00b,_0x2a7b34);})[_0x541f('0x3')](function(_0xeaa0ae){_0x43a245[_0x541f('0x1c')]=_0xeaa0ae;return _0x43a245;})[_0x541f('0x1d')](function(_0x835895){throw _0x835895;});};exports[_0x541f('0x1e')]=function(_0x367d64,_0x21ed5a){return function(_0x514c69,_0x379849,_0x3a8252){var _0x381c92=_0x514c69[_0x541f('0xc')];var _0x44ae7d={};var _0x4a86d2=_0x514c69[_0x541f('0x1f')];if(_0x44ae7d){_0x44ae7d=_['clone'](_0x514c69[_0x541f('0x7')]);_0x44ae7d=_['omit'](_0x44ae7d,[_0x541f('0x7'),_0x541f('0x20'),_0x541f('0x21'),_0x541f('0x22'),'mobile']);}utils[_0x541f('0x23')](_0x381c92,_0x44ae7d,_0x4a86d2,_0x367d64,_0x21ed5a);_0x3a8252(null);};}; \ No newline at end of file +var _0x2dd5=['omit','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','getInteractionsQuery','resolve','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','body','contact','default','fields','filter','user','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','count','length','having','order','DESC','rows','query'];(function(_0xaa4ec0,_0x5f313){var _0x2643fa=function(_0x1181f7){while(--_0x1181f7){_0xaa4ec0['push'](_0xaa4ec0['shift']());}};_0x2643fa(++_0x5f313);}(_0x2dd5,0x153));var _0x52dd=function(_0x2c4a70,_0x2196f2){_0x2c4a70=_0x2c4a70-0x0;var _0x420603=_0x2dd5[_0x2c4a70];return _0x420603;};'use strict';var _=require(_0x52dd('0x0'));var sqlUtils=require(_0x52dd('0x1'));var utils=require(_0x52dd('0x2'));exports[_0x52dd('0x3')]=function(_0x3869b9,_0x345140,_0x4d88aa,_0x2c6af7,_0x4e22f3){var _0x53c74c={'count':0x0,'rows':[]};var _0x263605=sqlUtils[_0x52dd('0x4')](_0x3869b9,_0x4d88aa,_0x345140);if(_0x263605){return Promise['resolve'](_0x53c74c);}var _0x55d47d=sqlUtils[_0x52dd('0x5')](_0x3869b9);var _0x9fe596={};return Promise[_0x52dd('0x6')]()[_0x52dd('0x7')](function(){if(_0x345140['search']){return sqlUtils[_0x52dd('0x8')](_0x345140[_0x52dd('0x9')],_0x4e22f3);}else{return sqlUtils[_0x52dd('0xa')](_0x3869b9,_0x345140,_0x4e22f3);}})['then'](function(_0x1bd508){_0x55d47d[_0x52dd('0xb')](_0x1bd508[_0x52dd('0xc')]);_0x55d47d[_0x52dd('0xb')](_0x1bd508[_0x52dd('0xd')]);_0x55d47d['where'](_0x1bd508[_0x52dd('0xe')]);_0x55d47d[_0x52dd('0xb')](_0x1bd508[_0x52dd('0xf')]);_0x55d47d[_0x52dd('0xb')](_0x1bd508[_0x52dd('0x10')]);_0x55d47d[_0x52dd('0xb')](_0x1bd508[_0x52dd('0x11')]);_0x55d47d['having'](_0x1bd508['read']);_0x9fe596=_0x1bd508[_0x52dd('0x12')];return sqlUtils[_0x52dd('0x13')](_0x3869b9,_0x4d88aa,_0x345140);})[_0x52dd('0x7')](function(_0x456f70){_0x55d47d[_0x52dd('0xb')](_0x456f70);_0x55d47d[_0x52dd('0x14')](_0x52dd('0x15'));var _0x14583a=_0x345140[_0x52dd('0x9')]?_0x9fe596['ids']:_0x345140[_0x52dd('0x16')];return sqlUtils[_0x52dd('0x17')](_0x55d47d,_0x14583a);})['then'](function(_0x2b0790){_0x53c74c[_0x52dd('0x18')]=_0x2b0790[_0x52dd('0x19')];if(_0x53c74c[_0x52dd('0x18')]===0x0){return[];}_0x55d47d[_0x52dd('0x1a')](_0x9fe596['clause']);if(_0x2c6af7[_0x52dd('0x1b')]){_0x2c6af7[_0x52dd('0x1b')]['forEach'](function(_0x48d28a){var _0x5dc8be=_0x48d28a[0x0]==='contactName'?_0x48d28a[0x0]:'i.'+_0x48d28a[0x0];_0x55d47d[_0x52dd('0x1b')](_0x5dc8be,_0x48d28a[0x1]==='DESC'?![]:!![]);if(_0x48d28a[0x0]==='closed'){var _0x48a37b=sqlUtils['getClosedOrderClause'](_0x3869b9,_0x345140);_0x55d47d['order'](_0x48a37b,_0x48d28a[0x1]===_0x52dd('0x1c')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x3869b9,_0x55d47d,_0x345140,_0x2c6af7);})[_0x52dd('0x7')](function(_0x3edf3b){_0x53c74c[_0x52dd('0x1d')]=_0x3edf3b;return _0x53c74c;})['catch'](function(_0x18edaa){throw _0x18edaa;});};exports['tracked']=function(_0x4bb70d,_0x2cf8c6){return function(_0x477a4a,_0x2fdd52,_0x25e43f){var _0x19f5de=_0x477a4a[_0x52dd('0x11')];var _0x2845c8={};var _0x1b1725=_0x477a4a[_0x52dd('0x1e')];if(_0x2845c8){_0x2845c8=_['clone'](_0x477a4a[_0x52dd('0xc')]);_0x2845c8=_[_0x52dd('0x1f')](_0x2845c8,['body',_0x52dd('0x20'),_0x52dd('0x21'),_0x52dd('0x22'),_0x52dd('0x23')]);}utils[_0x52dd('0x24')](_0x19f5de,_0x2845c8,_0x1b1725,_0x4bb70d,_0x2cf8c6);_0x25e43f(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index ccfbe28..0f70d73 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7c7=['getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getAccountFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','parseSearch','type','default','value','end','read','and','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','tags','clause','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','plainBody','some','compact','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','filter','capitalize','chat','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','Interaction','Sequelize','SELECT','query','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','Account.key','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','toString','groupBy','Setting','findOne','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','role','agent','search','select','field','name','color'];(function(_0x2afb67,_0x100c3e){var _0x51cd1e=function(_0x3772de){while(--_0x3772de){_0x2afb67['push'](_0x2afb67['shift']());}};_0x51cd1e(++_0x100c3e);}(_0xf7c7,0x1d5));var _0x7f7c=function(_0x5038b5,_0x33d198){_0x5038b5=_0x5038b5-0x0;var _0xfb1b35=_0xf7c7[_0x5038b5];return _0xfb1b35;};'use strict';var _=require(_0x7f7c('0x0'));var squel=require(_0x7f7c('0x1'));var as=require(_0x7f7c('0x2'));var qs=require(_0x7f7c('0x3'));var updateInteraction=require(_0x7f7c('0x4'))[_0x7f7c('0x5')];var utils=require('./utils');var db=require(_0x7f7c('0x6'))['db'];function skipInteractionsQuery(_0x5152dc,_0x2ced6e,_0x4cddda){var _0x308734=![];var _0x13f59d=utils['getAccountFK'](_0x5152dc);if(_0x2ced6e[_0x7f7c('0x7')]===_0x7f7c('0x8')&&!_0x4cddda[_0x7f7c('0x9')]&&!_0x4cddda[_0x13f59d]){_0x308734=!![];}return _0x308734;}function getTagsQuery(){return squel[_0x7f7c('0xa')]()[_0x7f7c('0xb')]('id')[_0x7f7c('0xb')](_0x7f7c('0xc'))[_0x7f7c('0xb')](_0x7f7c('0xd'))['from']('tools_tags');}function getUsersQuery(_0x2faa4b,_0x4bcc96){var _0x1724a0=utils[_0x7f7c('0xe')](_0x2faa4b);var _0xe8e50c=_0x7f7c('0xf')+_0x2faa4b+_0x7f7c('0x10');var _0x4d3878=squel['select']()[_0x7f7c('0xb')](_0x7f7c('0x11'))[_0x7f7c('0xb')](_0x7f7c('0x12'))[_0x7f7c('0xb')](_0x7f7c('0x13')+_0x1724a0)[_0x7f7c('0x14')](_0xe8e50c,'ui')[_0x7f7c('0x15')](_0x7f7c('0x16'),'u',_0x7f7c('0x17'));if(_0x4bcc96[_0x7f7c('0x18')]>0x0){_0x4d3878[_0x7f7c('0x19')](_0x7f7c('0x13')+_0x1724a0+_0x7f7c('0x1a'),_[_0x7f7c('0x1b')](_0x4bcc96,'id'));}return _0x4d3878;}function getInteractionsQuery(_0x4f12b5){var _0x438839=utils['getInteractionsTables'](_0x4f12b5);var _0x46b347=utils[_0x7f7c('0x1c')](_0x4f12b5);var _0x2d24e3=utils['getInteractionFK'](_0x4f12b5);return squel[_0x7f7c('0xa')]()[_0x7f7c('0x14')](_0x438839['interactions'],'i')[_0x7f7c('0x15')](_0x7f7c('0x1d'),'c',_0x7f7c('0x1e'))[_0x7f7c('0x15')]('users','o',_0x7f7c('0x1f'))[_0x7f7c('0x15')](_0x438839[_0x7f7c('0x20')],'a',_0x7f7c('0x21')+_0x46b347)[_0x7f7c('0x15')](_0x438839['messages'],'me',_0x7f7c('0x22')+_0x2d24e3+_0x7f7c('0x23'))[_0x7f7c('0x15')](_0x438839['interactionsTags'],'it',_0x7f7c('0x24')+_0x2d24e3+'\x20=\x20i.id')[_0x7f7c('0x15')](_0x7f7c('0x25'),'t',_0x7f7c('0x26'));}function getSqlClauses(){var _0xc44063={'body':squel[_0x7f7c('0x27')](),'contact':squel[_0x7f7c('0x27')](),'default':squel[_0x7f7c('0x27')](),'fields':squel[_0x7f7c('0x27')](),'filter':squel[_0x7f7c('0x27')](),'read':squel[_0x7f7c('0x27')](),'tags':{'clause':squel[_0x7f7c('0x27')](),'ids':null},'user':squel[_0x7f7c('0x27')]()};return _0xc44063;}function parseTagParameter(_0x17aabf){var _0x349923=squel[_0x7f7c('0x27')]();if(_0x17aabf){var _0x519848=utils[_0x7f7c('0x28')](_0x17aabf);_0x519848[_0x7f7c('0x29')](function(_0x3f548b){_0x349923['or'](_0x7f7c('0x2a'),'%,'+_0x3f548b+',%');});}return _0x349923;}function parseReadParameter(_0x4ea60a){var _0x2bc59d='';if(_0x4ea60a){_0x2bc59d=_0x7f7c('0x2b');if(_0x4ea60a==='1'){_0x2bc59d=_0x2bc59d[_0x7f7c('0x2c')](_0x7f7c('0x2d'),'=');}else{_0x2bc59d=_0x2bc59d[_0x7f7c('0x2c')](_0x7f7c('0x2d'),'>');}}return _0x2bc59d;}function parseSearchFilter(_0x1ccfbc,_0x7036a7){var _0x3133ac=squel['expr']();if(_0x7036a7){var _0x231992=_0x7036a7[_0x7f7c('0x2c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7f7c('0x2e')](_0x231992)){_0x3133ac['or']('i.id\x20LIKE\x20?',_0x231992+'%');if([_0x7f7c('0x2f'),_0x7f7c('0x30')][_0x7f7c('0x31')](_0x1ccfbc)){_0x3133ac['or'](_0x7f7c('0x32'),_0x231992+'%');}else if(_0x1ccfbc===_0x7f7c('0x33')){_0x3133ac['or'](_0x7f7c('0x34'),_0x231992+'%');}else if(_0x1ccfbc===_0x7f7c('0x35')){_0x3133ac['or'](_0x7f7c('0x36'),_0x231992+'%');}}else if(_0x1ccfbc===_0x7f7c('0x37')&&qs[_0x7f7c('0x38')](_0x231992)){_0x3133ac['or'](_0x7f7c('0x39'),_0x231992+'%');}else{if(_0x1ccfbc===_0x7f7c('0x37')){_0x3133ac['or'](_0x7f7c('0x3a'),qs['getFullTextValue'](_0x231992,!![]))['or'](_0x7f7c('0x3b'),qs[_0x7f7c('0x3c')](_0x231992));}else if(_0x1ccfbc!==_0x7f7c('0x33')){_0x3133ac['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7f7c('0x3c')](_0x231992));}_0x3133ac['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7f7c('0x3c')](_0x231992,!![]),null);}}return _0x3133ac;}function parseAdvancedSearchFilter(_0x4ab241,_0x1b0a89){var _0xf92ff1=getSqlClauses();var _0x33b5ee=as[_0x7f7c('0x3d')](_0x4ab241);var _0x1eaef9=_0x33b5ee['sqlOperator'];for(var _0x4b68fc=0x0;_0x4b68fc<_0x33b5ee['conditions'][_0x7f7c('0x18')];_0x4b68fc++){var _0x4660b2=_0x33b5ee['conditions'][_0x4b68fc];var _0x118412='i';var _0x57d712=_['find'](_0x1b0a89,[_0x7f7c('0xc'),_0x4660b2[_0x7f7c('0xb')]]);if(_0x57d712){var _0x1238f0=as['buildExpression'](_0x118412,_0x57d712[_0x7f7c('0x3e')],_0x4660b2);_0xf92ff1[_0x7f7c('0x3f')][_0x1eaef9](_0x1238f0['text'],_0x1238f0[_0x7f7c('0x40')]['start'],_0x1238f0[_0x7f7c('0x40')][_0x7f7c('0x41')]);}else{switch(_0x4660b2[_0x7f7c('0xb')]){case'unreadMessages':var _0x5687c3=parseReadParameter(_0x4660b2[_0x7f7c('0x40')]);_0xf92ff1[_0x7f7c('0x42')][_0x7f7c('0x43')](_0x5687c3);break;case'Contact':if(_0x4660b2[_0x7f7c('0x44')]===_0x7f7c('0x45')){if(_0x4660b2[_0x7f7c('0x40')]['split']('\x20')[_0x7f7c('0x18')]>0x1){_0xf92ff1['contact'][_0x1eaef9](_0x7f7c('0x46'),qs[_0x7f7c('0x3c')](_0x4660b2[_0x7f7c('0x40')],!![]),null);}else{var _0x5c281a='%'+_0x4660b2[_0x7f7c('0x40')]+'%';_0xf92ff1[_0x7f7c('0x47')][_0x1eaef9](_0x7f7c('0x48'),_0x5c281a,_0x5c281a,_0x5c281a);}}else{_0x57d712=_[_0x7f7c('0x49')](_0x1b0a89,[_0x7f7c('0xc'),'ContactId']);_0x4660b2[_0x7f7c('0xb')]=_0x7f7c('0x4a');_0x1238f0=as[_0x7f7c('0x4b')](_0x118412,_0x57d712['type'],_0x4660b2);_0xf92ff1[_0x7f7c('0x47')][_0x1eaef9](_0x1238f0[_0x7f7c('0x4c')],_0x1238f0[_0x7f7c('0x40')]['start'],_0x1238f0[_0x7f7c('0x40')]['end']);}break;case _0x7f7c('0x4d'):var _0x54af02=_0x4660b2[_0x7f7c('0x40')]['split'](',')[_0x7f7c('0x1b')](function(_0x535d48){return Number(_0x535d48);});var _0x1e8953=parseTagParameter(_0x54af02);_0xf92ff1[_0x7f7c('0x4e')][_0x7f7c('0x4f')]['and'](_0x1e8953);_0xf92ff1[_0x7f7c('0x4e')]['ids']=_0x54af02;break;case'User':if(_0x4660b2[_0x7f7c('0x44')]==='$substring'){_0xf92ff1[_0x7f7c('0x50')][_0x1eaef9](_0x7f7c('0x51'),'%'+_0x4660b2['value']+'%',null);}else{_0x57d712=_[_0x7f7c('0x49')](_0x1b0a89,[_0x7f7c('0xc'),'UserId']);_0x4660b2[_0x7f7c('0xb')]='UserId';_0x1238f0=as[_0x7f7c('0x4b')](_0x118412,_0x57d712['type'],_0x4660b2);_0xf92ff1[_0x7f7c('0x50')][_0x1eaef9](_0x1238f0[_0x7f7c('0x4c')],_0x1238f0[_0x7f7c('0x40')][_0x7f7c('0x52')],_0x1238f0[_0x7f7c('0x40')]['end']);}break;case _0x7f7c('0x53'):case _0x7f7c('0x54'):_0x1238f0=as[_0x7f7c('0x4b')]('me',null,_0x4660b2);_0xf92ff1[_0x7f7c('0x53')][_0x1eaef9](_0x1238f0['text'],_0x1238f0[_0x7f7c('0x40')][_0x7f7c('0x52')],_0x1238f0[_0x7f7c('0x40')]['end']);break;}}}return _0xf92ff1;}function parseModelFields(_0x59f325,_0x213e84,_0x342b04){var _0x12300b=utils[_0x7f7c('0x1c')](_0x59f325);var _0x15faff=squel[_0x7f7c('0x27')]();var _0x10e93d=_(_0x213e84)['keys']()[_0x7f7c('0x1b')](function(_0x4294b4){return _[_0x7f7c('0x55')](_0x342b04,[_0x7f7c('0xc'),_0x4294b4])?_0x4294b4:undefined;})[_0x7f7c('0x56')]()[_0x7f7c('0x40')]();if(_0x10e93d[_0x7f7c('0x18')]>0x0){_0x10e93d[_0x7f7c('0x29')](function(_0x584046){if(_0x584046===_0x12300b){_0x15faff['and']('i.'+_0x12300b+_0x7f7c('0x1a'),[][_0x7f7c('0x57')](_0x213e84[_0x584046]));}else if(_0x584046===_0x7f7c('0x58')){var _0x30cf04=JSON[_0x7f7c('0x59')](_0x213e84[_0x584046])[_0x7f7c('0x5a')];var _0x4dd2ed=JSON[_0x7f7c('0x59')](_0x213e84[_0x584046])['$lte'];_0x15faff[_0x7f7c('0x43')](_0x7f7c('0x5b'),_0x30cf04,_0x4dd2ed);}else{if(_0x213e84[_0x584046]===_0x7f7c('0x5c')){_0x15faff['and']('i.'+_0x584046+_0x7f7c('0x5d'));}else{_0x15faff[_0x7f7c('0x43')]('i.'+_0x584046+'\x20=\x20?',_0x213e84[_0x584046]);}}});}return _0x15faff;}function parseQueryParameters(_0x2ddfed,_0x3adf6f,_0x44098f){var _0x2fc3df=getSqlClauses();return Promise[_0x7f7c('0x5e')]()['then'](function(){return parseModelFields(_0x2ddfed,_0x3adf6f,_0x44098f);})[_0x7f7c('0x5f')](function(_0x4ab928){_0x2fc3df['fields']['and'](_0x4ab928);return parseReadParameter(_0x3adf6f[_0x7f7c('0x42')]);})[_0x7f7c('0x5f')](function(_0x151c6f){_0x2fc3df[_0x7f7c('0x42')][_0x7f7c('0x43')](_0x151c6f);return parseTagParameter(_0x3adf6f['tag']);})[_0x7f7c('0x5f')](function(_0xab2986){_0x2fc3df[_0x7f7c('0x4e')][_0x7f7c('0x4f')][_0x7f7c('0x43')](_0xab2986);return parseSearchFilter(_0x2ddfed,_0x3adf6f[_0x7f7c('0x60')]);})['then'](function(_0x488848){_0x2fc3df[_0x7f7c('0x60')]=_0x488848;return _0x2fc3df;});}function checkAccountsRestrictions(_0x5191a8,_0x545495,_0x260db0){var _0x19d686=utils[_0x7f7c('0x1c')](_0x5191a8);var _0x58a256='get'+_[_0x7f7c('0x61')](_0x5191a8)+(_0x5191a8===_0x7f7c('0x62')?'Websites':'Accounts');var _0x2900c4=squel[_0x7f7c('0x27')]();return Promise[_0x7f7c('0x5e')]()[_0x7f7c('0x5f')](function(){if(_0x260db0[_0x7f7c('0x9')]&&_0x545495[_0x7f7c('0x7')]===_0x7f7c('0x8')){return _0x545495[_0x58a256]({'attributes':['id'],'raw':!![]});}})[_0x7f7c('0x5f')](function(_0x2fd337){if(_0x2fd337){if(_0x2fd337[_0x7f7c('0x18')]===0x0){_0x2900c4[_0x7f7c('0x43')]('i.'+_0x19d686+_0x7f7c('0x5d'));}else{_0x2900c4[_0x7f7c('0x43')]('i.'+_0x19d686+_0x7f7c('0x1a'),_[_0x7f7c('0x1b')](_0x2fd337,'id'));}}else if(!_0x260db0[_0x19d686]){_0x2900c4[_0x7f7c('0x43')]('i.'+_0x19d686+_0x7f7c('0x63'));}})['then'](function(){return _0x2900c4;});}function getClosedOrderClause(_0x868098,_0x23faaf){var _0x5ce422='';var _0x452d1c=[_0x7f7c('0x64'),_0x7f7c('0x65'),_0x7f7c('0x66')];if(_0x868098==='mail'){_0x452d1c[_0x7f7c('0x67')]('i.substatus');}if(_0x23faaf['closed']==='0'&&_0x868098===_0x7f7c('0x37')){_0x5ce422=_0x7f7c('0x68');}else{if(_0x23faaf[_0x7f7c('0x69')]==='1'){_0x452d1c['shift']();}_0x5ce422='CONCAT_WS(\x27\x27,\x20'+_0x452d1c[_0x7f7c('0x6a')](',\x20')+')';}return _0x5ce422;}function getFilteredInteractions(_0x10d261,_0x5f2418,_0x2495a1,_0x4c91d0){var _0x58a572=utils[_0x7f7c('0xe')](_0x10d261);var _0x9182b9=_['capitalize'](_0x10d261)+_0x7f7c('0x6b');var _0x553c3c=[];var _0x1cff75=getTagsQuery();var _0x2a7133={'type':db[_0x7f7c('0x6c')]['QueryTypes'][_0x7f7c('0x6d')],'raw':!![]};var _0x472530=[];var _0x50c0d1=[];return db['sequelize'][_0x7f7c('0x6e')](_0x1cff75['toString'](),_0x2a7133)['then'](function(_0xce6dc1){_0x553c3c=_[_0x7f7c('0x6f')](_0xce6dc1,'id');_0x2a7133=_[_0x7f7c('0x70')](_0x2a7133,{'model':db[_0x9182b9],'mapToModel':!![],'nest':!![]});if(_0x2495a1[_0x7f7c('0x71')]){_0x4c91d0[_0x7f7c('0x72')]['forEach'](function(_0x139580){_0x5f2418[_0x7f7c('0xb')]('i.'+_0x139580);});}else{_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x73'),_0x7f7c('0x74'));_0x5f2418[_0x7f7c('0xb')]('a.key',_0x7f7c('0x75'));_0x5f2418[_0x7f7c('0xb')]('a.mandatoryDisposition',_0x7f7c('0x76'));if(_0x10d261===_0x7f7c('0x37')){_0x5f2418['field'](_0x7f7c('0x77'),'Account.email');_0x5f2418['field'](_0x7f7c('0x78'),_0x7f7c('0x79'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x7a'));_0x5f2418[_0x7f7c('0xb')]('i.createdAt');_0x5f2418[_0x7f7c('0xb')]('i.updatedAt');_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x7b'));_0x5f2418['field'](_0x7f7c('0x7c'));_0x5f2418['field'](_0x7f7c('0x7d'));_0x5f2418['field'](_0x7f7c('0x7e'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x7f'));_0x5f2418[_0x7f7c('0xb')]('i.subject');_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x66'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x65'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x64'));_0x5f2418['field'](_0x7f7c('0x68'));_0x5f2418['field'](_0x7f7c('0x80'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x81'));_0x5f2418['field']('i.MailAccountId');_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x82'));}else if(_0x10d261===_0x7f7c('0x35')){_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x83'),'contactName');}else{_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x84'),_0x7f7c('0x79'));}if(_0x10d261!=='mail'){_0x5f2418['field'](_0x7f7c('0x85'));}_0x5f2418['field']('c.firstName','Contact.firstName');_0x5f2418['field'](_0x7f7c('0x86'),_0x7f7c('0x87'));_0x5f2418[_0x7f7c('0xb')]('c.email',_0x7f7c('0x88'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x89'),_0x7f7c('0x8a'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x8b'),_0x7f7c('0x8c'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x8d'),_0x7f7c('0x8e'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x8f'),'Owner.fullname');_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x90'),_0x7f7c('0x91'));_0x5f2418[_0x7f7c('0xb')](_0x7f7c('0x92'),_0x7f7c('0x93'));}if(_0x4c91d0['limit']){_0x5f2418[_0x7f7c('0x94')](_0x4c91d0[_0x7f7c('0x94')]);}if(_0x4c91d0[_0x7f7c('0x95')]){_0x5f2418[_0x7f7c('0x95')](_0x4c91d0['offset']);}return db['sequelize'][_0x7f7c('0x6e')](_0x5f2418['toString'](),_0x2a7133);})[_0x7f7c('0x5f')](function(_0x32c852){_0x472530=_0x32c852;var _0x8e0604=getUsersQuery(_0x10d261,_0x472530);return db[_0x7f7c('0x96')][_0x7f7c('0x6e')](_0x8e0604[_0x7f7c('0x97')](),_0x2a7133);})['then'](function(_0x48336b){_0x50c0d1=_[_0x7f7c('0x98')](_0x48336b,_0x58a572);if(_0x10d261===_0x7f7c('0x37')){return db[_0x7f7c('0x99')][_0x7f7c('0x9a')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x7f7c('0x5f')](function(_0x18133e){var _0x472fc6=_0x18133e?_0x18133e[_0x7f7c('0x9b')]:undefined;var _0x2c6173=_0x472530[_0x7f7c('0x1b')](function(_0x18964c){return updateInteraction(_0x18964c,_0x553c3c,_0x50c0d1,_0x472fc6);});return Promise[_0x7f7c('0x9c')](_0x2c6173);});}function countFilteredInteractions(_0x357d9a,_0x2bde54){var _0x5b371c=_0x357d9a['clone']();_0x5b371c['field']('COUNT(*)');_0x5b371c['field'](_0x7f7c('0x73'),_0x7f7c('0x74'));var _0x13c879=utils[_0x7f7c('0x28')](_0x2bde54);if(!_[_0x7f7c('0x9d')](_0x13c879)){_0x5b371c[_0x7f7c('0x19')](_0x7f7c('0x9e'),_0x13c879);}var _0x11f299={'type':db[_0x7f7c('0x6c')][_0x7f7c('0x9f')][_0x7f7c('0x6d')],'raw':!![]};return db['sequelize'][_0x7f7c('0x6e')](_0x5b371c[_0x7f7c('0x97')](),_0x11f299);}module[_0x7f7c('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x2ac3=['MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','value','start','end','unreadMessages','read','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','tags','clause','and','ids','User','$substring','user','UserId','plainBody','body','some','compact','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','tag','filter','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','sequelize','query','keyBy','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.to','i.ContactId','i.UserId','openchannel','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','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','TagIds','limit','offset','toString','groupBy','Setting','enableEmailPreview','all','clone','getSelectedTags','isEmpty','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','from','getInteractionFK','user_has_','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0x2ac3,0x10f));var _0x32ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2ac3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x32ac('0x0'));var squel=require(_0x32ac('0x1'));var as=require(_0x32ac('0x2'));var qs=require(_0x32ac('0x3'));var updateInteraction=require('./update-interaction')[_0x32ac('0x4')];var utils=require(_0x32ac('0x5'));var db=require(_0x32ac('0x6'))['db'];function skipInteractionsQuery(_0x539146,_0x5de216,_0x38160a){var _0x416cf0=![];var _0x2f3714=utils[_0x32ac('0x7')](_0x539146);if(_0x5de216['role']===_0x32ac('0x8')&&!_0x38160a[_0x32ac('0x9')]&&!_0x38160a[_0x2f3714]){_0x416cf0=!![];}return _0x416cf0;}function getTagsQuery(){return squel[_0x32ac('0xa')]()[_0x32ac('0xb')]('id')[_0x32ac('0xb')](_0x32ac('0xc'))['field'](_0x32ac('0xd'))[_0x32ac('0xe')]('tools_tags');}function getUsersQuery(_0x4dce9d,_0xbd0b49){var _0x5b2e33=utils[_0x32ac('0xf')](_0x4dce9d);var _0x5a2d31=_0x32ac('0x10')+_0x4dce9d+'_interactions';var _0x1f2c5d=squel['select']()['field'](_0x32ac('0x11'))[_0x32ac('0xb')](_0x32ac('0x12'))[_0x32ac('0xb')](_0x32ac('0x13')+_0x5b2e33)['from'](_0x5a2d31,'ui')['left_join'](_0x32ac('0x14'),'u',_0x32ac('0x15'));if(_0xbd0b49[_0x32ac('0x16')]>0x0){_0x1f2c5d[_0x32ac('0x17')]('ui.'+_0x5b2e33+_0x32ac('0x18'),_[_0x32ac('0x19')](_0xbd0b49,'id'));}return _0x1f2c5d;}function getInteractionsQuery(_0x3ecc51){var _0x5f3ea8=utils['getInteractionsTables'](_0x3ecc51);var _0x380455=utils[_0x32ac('0x7')](_0x3ecc51);var _0x34bdb2=utils['getInteractionFK'](_0x3ecc51);return squel['select']()['from'](_0x5f3ea8[_0x32ac('0x1a')],'i')[_0x32ac('0x1b')](_0x32ac('0x1c'),'c',_0x32ac('0x1d'))['left_join'](_0x32ac('0x14'),'o',_0x32ac('0x1e'))['left_join'](_0x5f3ea8[_0x32ac('0x1f')],'a',_0x32ac('0x20')+_0x380455)[_0x32ac('0x1b')](_0x5f3ea8['messages'],'me',_0x32ac('0x21')+_0x34bdb2+_0x32ac('0x22'))[_0x32ac('0x1b')](_0x5f3ea8[_0x32ac('0x23')],'it',_0x32ac('0x24')+_0x34bdb2+_0x32ac('0x22'))[_0x32ac('0x1b')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0xb38631={'body':squel[_0x32ac('0x25')](),'contact':squel[_0x32ac('0x25')](),'default':squel[_0x32ac('0x25')](),'fields':squel[_0x32ac('0x25')](),'filter':squel[_0x32ac('0x25')](),'read':squel[_0x32ac('0x25')](),'tags':{'clause':squel[_0x32ac('0x25')](),'ids':null},'user':squel[_0x32ac('0x25')]()};return _0xb38631;}function parseTagParameter(_0x43e081){var _0x4d633a=squel[_0x32ac('0x25')]();if(_0x43e081){var _0x27ba85=utils['getSelectedTags'](_0x43e081);_0x27ba85[_0x32ac('0x26')](function(_0x1babb8){_0x4d633a['or'](_0x32ac('0x27'),'%,'+_0x1babb8+',%');});}return _0x4d633a;}function parseReadParameter(_0xab7d8c){var _0x4bb54c='';if(_0xab7d8c){_0x4bb54c=_0x32ac('0x28');if(_0xab7d8c==='1'){_0x4bb54c=_0x4bb54c[_0x32ac('0x29')](_0x32ac('0x2a'),'=');}else{_0x4bb54c=_0x4bb54c[_0x32ac('0x29')](_0x32ac('0x2a'),'>');}}return _0x4bb54c;}function parseSearchFilter(_0x495589,_0x9df2f1){var _0x5daef3=squel[_0x32ac('0x25')]();if(_0x9df2f1){var _0x18af96=_0x9df2f1[_0x32ac('0x29')]('\x5c','\x5c\x5c')[_0x32ac('0x29')](/'/g,'\x27\x27');if(qs[_0x32ac('0x2b')](_0x18af96)){_0x5daef3['or'](_0x32ac('0x2c'),_0x18af96+'%');if([_0x32ac('0x2d'),_0x32ac('0x2e')]['includes'](_0x495589)){_0x5daef3['or'](_0x32ac('0x2f'),_0x18af96+'%');}else if(_0x495589===_0x32ac('0x30')){_0x5daef3['or'](_0x32ac('0x31'),_0x18af96+'%');}else if(_0x495589==='openchannel'){_0x5daef3['or']('i.from\x20LIKE\x20?',_0x18af96+'%');}}else if(_0x495589===_0x32ac('0x32')&&qs['isEmail'](_0x18af96)){_0x5daef3['or']('c.email\x20LIKE\x20?',_0x18af96+'%');}else{if(_0x495589===_0x32ac('0x32')){_0x5daef3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x18af96,!![]))['or'](_0x32ac('0x33'),qs[_0x32ac('0x34')](_0x18af96));}else if(_0x495589!==_0x32ac('0x30')){_0x5daef3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x18af96));}_0x5daef3['or'](_0x32ac('0x35'),qs[_0x32ac('0x34')](_0x18af96,!![]),null);}}return _0x5daef3;}function parseAdvancedSearchFilter(_0x40b8e7,_0x2aa52c){var _0x27fa23=getSqlClauses();var _0x55e263=as[_0x32ac('0x36')](_0x40b8e7);var _0x2282c6=_0x55e263[_0x32ac('0x37')];for(var _0x57ec0b=0x0;_0x57ec0b<_0x55e263[_0x32ac('0x38')]['length'];_0x57ec0b++){var _0x4b4fc2=_0x55e263[_0x32ac('0x38')][_0x57ec0b];var _0x2c9980='i';var _0x5761ac=_[_0x32ac('0x39')](_0x2aa52c,[_0x32ac('0xc'),_0x4b4fc2['field']]);if(_0x5761ac){var _0x1ac90d=as[_0x32ac('0x3a')](_0x2c9980,_0x5761ac[_0x32ac('0x3b')],_0x4b4fc2);_0x27fa23[_0x32ac('0x3c')][_0x2282c6](_0x1ac90d['text'],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3f')]);}else{switch(_0x4b4fc2[_0x32ac('0xb')]){case _0x32ac('0x40'):var _0x88c06=parseReadParameter(_0x4b4fc2[_0x32ac('0x3d')]);_0x27fa23[_0x32ac('0x41')]['and'](_0x88c06);break;case _0x32ac('0x42'):if(_0x4b4fc2[_0x32ac('0x43')]==='$substring'){if(_0x4b4fc2[_0x32ac('0x3d')][_0x32ac('0x44')]('\x20')[_0x32ac('0x16')]>0x1){_0x27fa23[_0x32ac('0x45')][_0x2282c6](_0x32ac('0x35'),qs[_0x32ac('0x34')](_0x4b4fc2[_0x32ac('0x3d')],!![]),null);}else{var _0x365122='%'+_0x4b4fc2[_0x32ac('0x3d')]+'%';_0x27fa23[_0x32ac('0x45')][_0x2282c6](_0x32ac('0x46'),_0x365122,_0x365122,_0x365122);}}else{_0x5761ac=_[_0x32ac('0x39')](_0x2aa52c,[_0x32ac('0xc'),'ContactId']);_0x4b4fc2[_0x32ac('0xb')]=_0x32ac('0x47');_0x1ac90d=as[_0x32ac('0x3a')](_0x2c9980,_0x5761ac[_0x32ac('0x3b')],_0x4b4fc2);_0x27fa23['contact'][_0x2282c6](_0x1ac90d[_0x32ac('0x48')],_0x1ac90d['value'][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3f')]);}break;case _0x32ac('0x49'):var _0x80435=_0x4b4fc2[_0x32ac('0x3d')]['split'](',')['map'](function(_0x558c26){return Number(_0x558c26);});var _0x2fcf03=parseTagParameter(_0x80435);_0x27fa23[_0x32ac('0x4a')][_0x32ac('0x4b')][_0x32ac('0x4c')](_0x2fcf03);_0x27fa23[_0x32ac('0x4a')][_0x32ac('0x4d')]=_0x80435;break;case _0x32ac('0x4e'):if(_0x4b4fc2['operator']===_0x32ac('0x4f')){_0x27fa23[_0x32ac('0x50')][_0x2282c6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4b4fc2[_0x32ac('0x3d')]+'%',null);}else{_0x5761ac=_['find'](_0x2aa52c,[_0x32ac('0xc'),_0x32ac('0x51')]);_0x4b4fc2[_0x32ac('0xb')]=_0x32ac('0x51');_0x1ac90d=as['buildExpression'](_0x2c9980,_0x5761ac[_0x32ac('0x3b')],_0x4b4fc2);_0x27fa23[_0x32ac('0x50')][_0x2282c6](_0x1ac90d[_0x32ac('0x48')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')]['end']);}break;case'body':case _0x32ac('0x52'):_0x1ac90d=as[_0x32ac('0x3a')]('me',null,_0x4b4fc2);_0x27fa23[_0x32ac('0x53')][_0x2282c6](_0x1ac90d[_0x32ac('0x48')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3f')]);break;}}}return _0x27fa23;}function parseModelFields(_0x22ed85,_0x38ae53,_0x251d31){var _0xdc6008=utils[_0x32ac('0x7')](_0x22ed85);var _0x1eb93d=squel['expr']();var _0x352002=_(_0x38ae53)['keys']()[_0x32ac('0x19')](function(_0x4216c8){return _[_0x32ac('0x54')](_0x251d31,[_0x32ac('0xc'),_0x4216c8])?_0x4216c8:undefined;})[_0x32ac('0x55')]()['value']();if(_0x352002[_0x32ac('0x16')]>0x0){_0x352002[_0x32ac('0x26')](function(_0x58d2eb){if(_0x58d2eb===_0xdc6008){_0x1eb93d['and']('i.'+_0xdc6008+_0x32ac('0x18'),[][_0x32ac('0x56')](_0x38ae53[_0x58d2eb]));}else if(_0x58d2eb==='createdAt'){var _0x1e2d1e=JSON[_0x32ac('0x57')](_0x38ae53[_0x58d2eb])[_0x32ac('0x58')];var _0x4abda5=JSON[_0x32ac('0x57')](_0x38ae53[_0x58d2eb])[_0x32ac('0x59')];_0x1eb93d[_0x32ac('0x4c')](_0x32ac('0x5a'),_0x1e2d1e,_0x4abda5);}else{if(_0x38ae53[_0x58d2eb]===_0x32ac('0x5b')){_0x1eb93d['and']('i.'+_0x58d2eb+_0x32ac('0x5c'));}else{_0x1eb93d['and']('i.'+_0x58d2eb+'\x20=\x20?',_0x38ae53[_0x58d2eb]);}}});}return _0x1eb93d;}function parseQueryParameters(_0x5a2ef4,_0x5b6516,_0x5154a5){var _0x323fa1=getSqlClauses();return Promise[_0x32ac('0x5d')]()[_0x32ac('0x5e')](function(){return parseModelFields(_0x5a2ef4,_0x5b6516,_0x5154a5);})[_0x32ac('0x5e')](function(_0x5497dd){_0x323fa1['fields']['and'](_0x5497dd);return parseReadParameter(_0x5b6516[_0x32ac('0x41')]);})[_0x32ac('0x5e')](function(_0x1fe1ad){_0x323fa1[_0x32ac('0x41')][_0x32ac('0x4c')](_0x1fe1ad);return parseTagParameter(_0x5b6516[_0x32ac('0x5f')]);})[_0x32ac('0x5e')](function(_0x2f24df){_0x323fa1[_0x32ac('0x4a')][_0x32ac('0x4b')]['and'](_0x2f24df);return parseSearchFilter(_0x5a2ef4,_0x5b6516[_0x32ac('0x60')]);})[_0x32ac('0x5e')](function(_0x12f516){_0x323fa1[_0x32ac('0x60')]=_0x12f516;return _0x323fa1;});}function checkAccountsRestrictions(_0xfc5479,_0x1d89fa,_0x57ddb2){var _0x479c3b=utils['getAccountFK'](_0xfc5479);var _0x5aec53='get'+_['capitalize'](_0xfc5479)+(_0xfc5479===_0x32ac('0x61')?_0x32ac('0x62'):_0x32ac('0x63'));var _0x5f4c3b=squel[_0x32ac('0x25')]();return Promise['resolve']()[_0x32ac('0x5e')](function(){if(_0x57ddb2[_0x32ac('0x9')]&&_0x1d89fa[_0x32ac('0x64')]===_0x32ac('0x8')){return _0x1d89fa[_0x5aec53]({'attributes':['id'],'raw':!![]});}})[_0x32ac('0x5e')](function(_0x40439e){if(_0x40439e){if(_0x40439e[_0x32ac('0x16')]===0x0){_0x5f4c3b[_0x32ac('0x4c')]('i.'+_0x479c3b+'\x20IS\x20NULL');}else{_0x5f4c3b[_0x32ac('0x4c')]('i.'+_0x479c3b+_0x32ac('0x18'),_['map'](_0x40439e,'id'));}}else if(!_0x57ddb2[_0x479c3b]){_0x5f4c3b['and']('i.'+_0x479c3b+_0x32ac('0x65'));}})[_0x32ac('0x5e')](function(){return _0x5f4c3b;});}function getClosedOrderClause(_0x5cb63e,_0x17bae6){var _0x2f1f50='';var _0x57892d=[_0x32ac('0x66'),_0x32ac('0x67'),_0x32ac('0x68')];if(_0x5cb63e==='mail'){_0x57892d['unshift'](_0x32ac('0x69'));}if(_0x17bae6[_0x32ac('0x6a')]==='0'&&_0x5cb63e==='mail'){_0x2f1f50=_0x32ac('0x69');}else{if(_0x17bae6[_0x32ac('0x6a')]==='1'){_0x57892d[_0x32ac('0x6b')]();}_0x2f1f50=_0x32ac('0x6c')+_0x57892d[_0x32ac('0x6d')](',\x20')+')';}return _0x2f1f50;}function getFilteredInteractions(_0x4a12be,_0x585d21,_0x4c5a32,_0x5c4dd3){var _0x41e2d4=utils[_0x32ac('0xf')](_0x4a12be);var _0x123e8e=_['capitalize'](_0x4a12be)+_0x32ac('0x6e');var _0x518513=[];var _0x39f543=getTagsQuery();var _0x60985b={'type':db['Sequelize'][_0x32ac('0x6f')][_0x32ac('0x70')],'raw':!![]};var _0x3b6b08=[];var _0x3d5a45=[];return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x39f543['toString'](),_0x60985b)[_0x32ac('0x5e')](function(_0x33554d){_0x518513=_[_0x32ac('0x73')](_0x33554d,'id');_0x60985b=_['merge'](_0x60985b,{'model':db[_0x123e8e],'mapToModel':!![],'nest':!![]});if(_0x4c5a32[_0x32ac('0x74')]){_0x5c4dd3[_0x32ac('0x75')][_0x32ac('0x26')](function(_0x4fd4a1){_0x585d21[_0x32ac('0xb')]('i.'+_0x4fd4a1);});}else{_0x585d21[_0x32ac('0xb')](_0x32ac('0x76'),_0x32ac('0x40'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x77'),'Account.key');_0x585d21['field'](_0x32ac('0x78'),'Account.mandatoryDisposition');if(_0x4a12be===_0x32ac('0x32')){_0x585d21[_0x32ac('0xb')](_0x32ac('0x79'),_0x32ac('0x7a'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x7b'),'contactName');_0x585d21['field'](_0x32ac('0x7c'));_0x585d21[_0x32ac('0xb')]('i.createdAt');_0x585d21['field'](_0x32ac('0x7d'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x7e'));_0x585d21['field']('i.closedAt');_0x585d21['field'](_0x32ac('0x7f'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x80'));_0x585d21['field']('i.lastMsgDirection');_0x585d21[_0x32ac('0xb')](_0x32ac('0x81'));_0x585d21['field']('i.disposition');_0x585d21[_0x32ac('0xb')](_0x32ac('0x67'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x66'));_0x585d21[_0x32ac('0xb')]('i.substatus');_0x585d21[_0x32ac('0xb')](_0x32ac('0x82'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x83'));_0x585d21[_0x32ac('0xb')]('i.MailAccountId');_0x585d21['field'](_0x32ac('0x84'));}else if(_0x4a12be===_0x32ac('0x85')){_0x585d21[_0x32ac('0xb')](_0x32ac('0x86'),_0x32ac('0x87'));}else{_0x585d21['field'](_0x32ac('0x88'),_0x32ac('0x87'));}if(_0x4a12be!=='mail'){_0x585d21[_0x32ac('0xb')](_0x32ac('0x89'));}_0x585d21[_0x32ac('0xb')](_0x32ac('0x8a'),_0x32ac('0x8b'));_0x585d21[_0x32ac('0xb')]('c.lastName',_0x32ac('0x8c'));_0x585d21['field']('c.email','Contact.email');_0x585d21[_0x32ac('0xb')](_0x32ac('0x8d'),'Contact.phone');_0x585d21[_0x32ac('0xb')]('c.mobile',_0x32ac('0x8e'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x8f'),_0x32ac('0x90'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x91'),'Owner.fullname');_0x585d21['field'](_0x32ac('0x92'),_0x32ac('0x93'));_0x585d21[_0x32ac('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x32ac('0x94'));}if(_0x5c4dd3['limit']){_0x585d21['limit'](_0x5c4dd3[_0x32ac('0x95')]);}if(_0x5c4dd3[_0x32ac('0x96')]){_0x585d21[_0x32ac('0x96')](_0x5c4dd3['offset']);}return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x585d21[_0x32ac('0x97')](),_0x60985b);})[_0x32ac('0x5e')](function(_0x110282){_0x3b6b08=_0x110282;var _0x70a45e=getUsersQuery(_0x4a12be,_0x3b6b08);return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x70a45e[_0x32ac('0x97')](),_0x60985b);})['then'](function(_0x472ddb){_0x3d5a45=_[_0x32ac('0x98')](_0x472ddb,_0x41e2d4);if(_0x4a12be===_0x32ac('0x32')){return db[_0x32ac('0x99')]['findOne']({'attributes':[_0x32ac('0x9a')],'raw':!![]});}})[_0x32ac('0x5e')](function(_0xa57526){var _0x5cf8cd=_0xa57526?_0xa57526[_0x32ac('0x9a')]:undefined;var _0xc31554=_0x3b6b08['map'](function(_0x12640a){return updateInteraction(_0x12640a,_0x518513,_0x3d5a45,_0x5cf8cd);});return Promise[_0x32ac('0x9b')](_0xc31554);});}function countFilteredInteractions(_0x44ca72,_0x5d3b67){var _0x157d51=_0x44ca72[_0x32ac('0x9c')]();_0x157d51['field']('COUNT(*)');_0x157d51['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x32ac('0x40'));var _0x3160e9=utils[_0x32ac('0x9d')](_0x5d3b67);if(!_[_0x32ac('0x9e')](_0x3160e9)){_0x157d51[_0x32ac('0x17')]('t.id\x20IN\x20?',_0x3160e9);}var _0x37971c={'type':db[_0x32ac('0x9f')]['QueryTypes'][_0x32ac('0x70')],'raw':!![]};return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x157d51['toString'](),_0x37971c);}module[_0x32ac('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index f0bbc58..bce6442 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ebd=['TagIds','lodash','../../mysqldb','split','forEach','waiting','talking','answered','abandoned','closed','disposition','UserId','total','MailMessage','findOne','plainBody','then','catch'];(function(_0x483d2a,_0x4bffba){var _0x5ba5d5=function(_0x33e56a){while(--_0x33e56a){_0x483d2a['push'](_0x483d2a['shift']());}};_0x5ba5d5(++_0x4bffba);}(_0x3ebd,0x1d5));var _0xd3eb=function(_0x507e89,_0x15bdcf){_0x507e89=_0x507e89-0x0;var _0x4490c7=_0x3ebd[_0x507e89];return _0x4490c7;};'use strict';var _=require(_0xd3eb('0x0'));var db=require(_0xd3eb('0x1'))['db'];function getInteractionUsers(_0x191fcd,_0x33ebdb){return new Promise(function(_0x3a3b1a,_0x52df68){try{var _0x59cb20=[];if(_0x33ebdb[_0x191fcd]){_0x59cb20=_0x33ebdb[_0x191fcd]['map'](function(_0x5e2a8b){return{'id':_0x5e2a8b['id'],'fullname':_0x5e2a8b['fullname']};});}return _0x3a3b1a(_0x59cb20);}catch(_0x8d2676){_0x52df68(_0x8d2676);}});}function getInteractionTags(_0x4149a8,_0x16d6df){var _0x4d532e=[];if(_0x4149a8){_0x4149a8[_0xd3eb('0x2')](',')[_0xd3eb('0x3')](function(_0x2dd9c8){_0x4d532e['push'](_0x16d6df[_0x2dd9c8]);});}return _0x4d532e;}function updateWaitingCounter(_0x2fd5a7){if(_0x2fd5a7[_0xd3eb('0x4')]){_0x2fd5a7['waiting']-=0x1;}}function updateInteractionCounters(_0x4e3544){_0x4e3544[_0xd3eb('0x4')]=0x0;_0x4e3544[_0xd3eb('0x5')]=0x0;_0x4e3544[_0xd3eb('0x6')]=0x0;_0x4e3544['unmanaged']=0x0;_0x4e3544[_0xd3eb('0x7')]=0x0;_0x4e3544['total']=0x0;if(_0x4e3544[_0xd3eb('0x8')]){if(_0x4e3544[_0xd3eb('0x9')]===_0xd3eb('0x7')){_0x4e3544[_0xd3eb('0x7')]+=0x1;updateWaitingCounter(_0x4e3544);}if(_0x4e3544[_0xd3eb('0xa')]){_0x4e3544[_0xd3eb('0x6')]+=0x1;if(_0x4e3544['talking']){_0x4e3544[_0xd3eb('0x5')]-=0x1;}}else{if(_0x4e3544[_0xd3eb('0x9')]){_0x4e3544['unmanaged']+=0x1;updateWaitingCounter(_0x4e3544);}}}else{if(!_0x4e3544['UserId']){_0x4e3544[_0xd3eb('0x4')]+=0x1;}if(_0x4e3544[_0xd3eb('0xa')]){_0x4e3544['talking']+=0x1;updateWaitingCounter(_0x4e3544);}}_0x4e3544[_0xd3eb('0xb')]+=0x1;return _0x4e3544;}function getLastMessageText(_0x5e8cb2){return db[_0xd3eb('0xc')][_0xd3eb('0xd')]({'where':{'$and':[{'MailInteractionId':_0x5e8cb2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd3eb('0xe')],'order':'-id','raw':!![]})[_0xd3eb('0xf')](function(_0x298b9c){if(_0x298b9c&&_0x298b9c['plainBody']){_0x5e8cb2['lastMsgText']=_['trimStart'](_0x298b9c[_0xd3eb('0xe')]);}return _0x5e8cb2;})[_0xd3eb('0x10')](function(_0x20e096){throw _0x20e096;});}exports['updateInteraction']=function(_0x5ab19e,_0x4dda9d,_0x4d8880,_0x5bec4f){return new Promise(function(_0x3e071c,_0x227563){return getInteractionUsers(_0x5ab19e['id'],_0x4d8880)[_0xd3eb('0xf')](function(_0x5adfa5){_0x5ab19e['Users']=_0x5adfa5;return getInteractionTags(_0x5ab19e[_0xd3eb('0x11')],_0x4dda9d);})[_0xd3eb('0xf')](function(_0xa14c8d){_0x5ab19e['Tags']=_0xa14c8d;delete _0x5ab19e[_0xd3eb('0x11')];return updateInteractionCounters(_0x5ab19e);})[_0xd3eb('0xf')](function(_0x5a6d92){if(_0x5bec4f){return getLastMessageText(_0x5a6d92);}else{return _0x5a6d92;}})['then'](function(_0x18dbb1){_0x3e071c(_0x18dbb1);})[_0xd3eb('0x10')](function(_0x700bc7){_0x227563(_0x700bc7);});});}; \ No newline at end of file +var _0xf9fe=['catch','updateInteraction','TagIds','map','forEach','push','waiting','talking','answered','abandoned','closed','disposition','UserId','unmanaged','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart'];(function(_0x9ca556,_0xeb5ee){var _0x1c90f5=function(_0x3af5d4){while(--_0x3af5d4){_0x9ca556['push'](_0x9ca556['shift']());}};_0x1c90f5(++_0xeb5ee);}(_0xf9fe,0x179));var _0xef9f=function(_0x1c6294,_0x168adc){_0x1c6294=_0x1c6294-0x0;var _0x3e079b=_0xf9fe[_0x1c6294];return _0x3e079b;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2c17f7,_0x4c35fd){return new Promise(function(_0x534527,_0x5da239){try{var _0x382959=[];if(_0x4c35fd[_0x2c17f7]){_0x382959=_0x4c35fd[_0x2c17f7][_0xef9f('0x0')](function(_0x1a08d4){return{'id':_0x1a08d4['id'],'fullname':_0x1a08d4['fullname']};});}return _0x534527(_0x382959);}catch(_0xcab4af){_0x5da239(_0xcab4af);}});}function getInteractionTags(_0x28c849,_0x461022){var _0xa3895=[];if(_0x28c849){_0x28c849['split'](',')[_0xef9f('0x1')](function(_0x3ad8f9){_0xa3895[_0xef9f('0x2')](_0x461022[_0x3ad8f9]);});}return _0xa3895;}function updateWaitingCounter(_0x43d2ce){if(_0x43d2ce[_0xef9f('0x3')]){_0x43d2ce['waiting']-=0x1;}}function updateInteractionCounters(_0x5b4b8f){_0x5b4b8f[_0xef9f('0x3')]=0x0;_0x5b4b8f[_0xef9f('0x4')]=0x0;_0x5b4b8f[_0xef9f('0x5')]=0x0;_0x5b4b8f['unmanaged']=0x0;_0x5b4b8f[_0xef9f('0x6')]=0x0;_0x5b4b8f['total']=0x0;if(_0x5b4b8f[_0xef9f('0x7')]){if(_0x5b4b8f[_0xef9f('0x8')]===_0xef9f('0x6')){_0x5b4b8f[_0xef9f('0x6')]+=0x1;updateWaitingCounter(_0x5b4b8f);}if(_0x5b4b8f[_0xef9f('0x9')]){_0x5b4b8f['answered']+=0x1;if(_0x5b4b8f[_0xef9f('0x4')]){_0x5b4b8f['talking']-=0x1;}}else{if(_0x5b4b8f[_0xef9f('0x8')]){_0x5b4b8f[_0xef9f('0xa')]+=0x1;updateWaitingCounter(_0x5b4b8f);}}}else{if(!_0x5b4b8f[_0xef9f('0x9')]){_0x5b4b8f[_0xef9f('0x3')]+=0x1;}if(_0x5b4b8f['UserId']){_0x5b4b8f[_0xef9f('0x4')]+=0x1;updateWaitingCounter(_0x5b4b8f);}}_0x5b4b8f['total']+=0x1;return _0x5b4b8f;}function getLastMessageText(_0x153de2){return db[_0xef9f('0xb')][_0xef9f('0xc')]({'where':{'$and':[{'MailInteractionId':_0x153de2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xef9f('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xef9f('0xe')],'order':_0xef9f('0xf'),'raw':!![]})[_0xef9f('0x10')](function(_0x3c0370){if(_0x3c0370&&_0x3c0370[_0xef9f('0xe')]){_0x153de2[_0xef9f('0x11')]=_[_0xef9f('0x12')](_0x3c0370['plainBody']);}return _0x153de2;})[_0xef9f('0x13')](function(_0x535cf5){throw _0x535cf5;});}exports[_0xef9f('0x14')]=function(_0xb5451b,_0x21b9f1,_0xaa8e3e,_0x14c5ab){return new Promise(function(_0x1ec0f4,_0x1b404a){return getInteractionUsers(_0xb5451b['id'],_0xaa8e3e)['then'](function(_0x49c5b7){_0xb5451b['Users']=_0x49c5b7;return getInteractionTags(_0xb5451b[_0xef9f('0x15')],_0x21b9f1);})['then'](function(_0x318b6f){_0xb5451b['Tags']=_0x318b6f;delete _0xb5451b[_0xef9f('0x15')];return updateInteractionCounters(_0xb5451b);})['then'](function(_0x3f5f51){if(_0x14c5ab){return getLastMessageText(_0x3f5f51);}else{return _0x3f5f51;}})['then'](function(_0x106689){_0x1ec0f4(_0x106689);})[_0xef9f('0x13')](function(_0xb12e78){_0x1b404a(_0xb12e78);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4cb1e24..3485304 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaa3=['chat','Account','InteractionId','upperFirst','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','findOne','then','update','catch','error','exports','lodash','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions'];(function(_0x5aa58b,_0x330ab6){var _0x1f9d64=function(_0x4731c3){while(--_0x4731c3){_0x5aa58b['push'](_0x5aa58b['shift']());}};_0x1f9d64(++_0x330ab6);}(_0xfaa3,0x132));var _0x3faa=function(_0x224475,_0x47ac26){_0x224475=_0x224475-0x0;var _0x2c87b9=_0xfaa3[_0x224475];return _0x2c87b9;};'use strict';var _=require(_0x3faa('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x3faa('0x1'))('mail-interactions'),'fax':require(_0x3faa('0x1'))(_0x3faa('0x2')),'sms':require(_0x3faa('0x1'))(_0x3faa('0x3')),'chat':require(_0x3faa('0x1'))(_0x3faa('0x4')),'whatsapp':require(_0x3faa('0x1'))(_0x3faa('0x5'))};function getAccountFK(_0x2a20db){return _['capitalize'](_0x2a20db)+(_0x2a20db===_0x3faa('0x6')?'Website':_0x3faa('0x7'))+'Id';}function getInteractionFK(_0x38dfe6){return _['capitalize'](_0x38dfe6)+_0x3faa('0x8');}function getInteractionId(_0x28e5fb,_0x5956a6,_0x265b6){if(_0x28e5fb&&_0x28e5fb[_[_0x3faa('0x9')](_0x265b6)+'InteractionId']){return _0x28e5fb[_['upperFirst'](_0x265b6)+'InteractionId'];}else if(_0x28e5fb&&_0x28e5fb['id']){return _0x28e5fb['id'];}else if(_0x5956a6&&_0x5956a6['id']){return _0x5956a6['id'];}else{return _0x3faa('0xa');}}function getInteractionsTables(_0x1a4123){return{'accounts':_0x1a4123+'_'+(_0x1a4123===_0x3faa('0x6')?_0x3faa('0xb'):_0x3faa('0xc')),'interactions':_0x1a4123+'_interactions','interactionsTags':_0x1a4123+_0x3faa('0xd'),'messages':_0x1a4123+_0x3faa('0xe'),'userInteractions':_0x3faa('0xf')+_0x1a4123+_0x3faa('0x10')};}function getSelectedTags(_0x365165){var _0xeac6f9=[];if(_0x365165){_0xeac6f9=Array['isArray'](_0x365165)?_0x365165:[_0x365165];}return _0xeac6f9;}function log(_0x1aaf18,_0x2d5a62,_0x321b57,_0x34dc9d,_0x221f0a,_0x3bf056){loggers[_0x221f0a[_0x3faa('0x11')]()][_0x1aaf18](_0x3faa('0x12'),_0x3bf056['toUpperCase'](),_0x2d5a62?_0x2d5a62['id']:null,_0x2d5a62?_0x2d5a62['name']:null,_0x2d5a62?_0x2d5a62['role']:null,getInteractionId(_0x321b57,_0x34dc9d,_0x221f0a),_0x321b57?JSON[_0x3faa('0x13')](_0x321b57):'null');}function updateUser(_0x31e7c8,_0x6dd00d,_0x138e58,_0x1fe48d,_0x3ad85f){db[_[_0x3faa('0x9')](_0x1fe48d)+'Interaction'][_0x3faa('0x14')]({'where':{'id':getInteractionId(_0x6dd00d,_0x138e58,_0x1fe48d)}})[_0x3faa('0x15')](function(_0x5d9cb2){if(_0x5d9cb2){return _0x5d9cb2[_0x3faa('0x16')]({'UserId':_0x31e7c8?_0x31e7c8['id']:null});}})[_0x3faa('0x15')](function(_0x264dd4){if(_0x264dd4){log('info',_0x31e7c8,_0x6dd00d,_0x138e58,_0x1fe48d,_0x3ad85f);}})[_0x3faa('0x17')](function(){log(_0x3faa('0x18'),_0x31e7c8,_0x6dd00d,_0x138e58,_0x1fe48d,_0x3ad85f);});}module[_0x3faa('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x3fa5=['then','update','info','catch','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','accounts','_interactions','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','findOne'];(function(_0x37fb1c,_0x32c6cd){var _0x5483ac=function(_0x194ac6){while(--_0x194ac6){_0x37fb1c['push'](_0x37fb1c['shift']());}};_0x5483ac(++_0x32c6cd);}(_0x3fa5,0x113));var _0x53fa=function(_0x545a0b,_0x4d99aa){_0x545a0b=_0x545a0b-0x0;var _0xca241=_0x3fa5[_0x545a0b];return _0xca241;};'use strict';var _=require(_0x53fa('0x0'));var db=require(_0x53fa('0x1'))['db'];var loggers={'openchannel':require(_0x53fa('0x2'))(_0x53fa('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x53fa('0x4')),'sms':require(_0x53fa('0x2'))(_0x53fa('0x5')),'chat':require('../../config/logger')(_0x53fa('0x6')),'whatsapp':require(_0x53fa('0x2'))(_0x53fa('0x7'))};function getAccountFK(_0x3d1120){return _['capitalize'](_0x3d1120)+(_0x3d1120===_0x53fa('0x8')?_0x53fa('0x9'):_0x53fa('0xa'))+'Id';}function getInteractionFK(_0xba377b){return _[_0x53fa('0xb')](_0xba377b)+_0x53fa('0xc');}function getInteractionId(_0x2598fa,_0x5f3043,_0x12567a){if(_0x2598fa&&_0x2598fa[_[_0x53fa('0xd')](_0x12567a)+'InteractionId']){return _0x2598fa[_['upperFirst'](_0x12567a)+'InteractionId'];}else if(_0x2598fa&&_0x2598fa['id']){return _0x2598fa['id'];}else if(_0x5f3043&&_0x5f3043['id']){return _0x5f3043['id'];}else{return'unknown';}}function getInteractionsTables(_0x59833e){return{'accounts':_0x59833e+'_'+(_0x59833e===_0x53fa('0x8')?'websites':_0x53fa('0xe')),'interactions':_0x59833e+_0x53fa('0xf'),'interactionsTags':_0x59833e+_0x53fa('0x10'),'messages':_0x59833e+'_messages','userInteractions':'user_has_'+_0x59833e+_0x53fa('0xf')};}function getSelectedTags(_0x310cd1){var _0x57d631=[];if(_0x310cd1){_0x57d631=Array[_0x53fa('0x11')](_0x310cd1)?_0x310cd1:[_0x310cd1];}return _0x57d631;}function log(_0x424598,_0x33eebd,_0x363c6f,_0x28a746,_0x5e21d7,_0x1b0edc){loggers[_0x5e21d7[_0x53fa('0x12')]()][_0x424598](_0x53fa('0x13'),_0x1b0edc[_0x53fa('0x14')](),_0x33eebd?_0x33eebd['id']:null,_0x33eebd?_0x33eebd[_0x53fa('0x15')]:null,_0x33eebd?_0x33eebd[_0x53fa('0x16')]:null,getInteractionId(_0x363c6f,_0x28a746,_0x5e21d7),_0x363c6f?JSON[_0x53fa('0x17')](_0x363c6f):'null');}function updateUser(_0x6e82b3,_0x461921,_0x101e7e,_0x184e75,_0x529906){db[_[_0x53fa('0xd')](_0x184e75)+'Interaction'][_0x53fa('0x18')]({'where':{'id':getInteractionId(_0x461921,_0x101e7e,_0x184e75)}})[_0x53fa('0x19')](function(_0x828fd6){if(_0x828fd6){return _0x828fd6[_0x53fa('0x1a')]({'UserId':_0x6e82b3?_0x6e82b3['id']:null});}})[_0x53fa('0x19')](function(_0x5ee699){if(_0x5ee699){log(_0x53fa('0x1b'),_0x6e82b3,_0x461921,_0x101e7e,_0x184e75,_0x529906);}})[_0x53fa('0x1c')](function(){log('error',_0x6e82b3,_0x461921,_0x101e7e,_0x184e75,_0x529906);});}module[_0x53fa('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a9b7136..3ab1e28 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 _0x32eb=['data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','count','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment'];(function(_0x4049f9,_0x1c10e9){var _0x55a7de=function(_0x1a9bea){while(--_0x1a9bea){_0x4049f9['push'](_0x4049f9['shift']());}};_0x55a7de(++_0x1c10e9);}(_0x32eb,0x83));var _0xb32e=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x32eb[_0x5d30b4];return _0x1acfb8;};'use strict';var crypto=require(_0xb32e('0x0'));var util=require(_0xb32e('0x1'));var compose=require(_0xb32e('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xb32e('0x3'));function getValueFromLicense(_0x572e81,_0x11ff73){if(_0x572e81&&_0x11ff73){if(_0x11ff73[_0xb32e('0x4')]&&_0x11ff73['license']){var _0x1cea32=_0x11ff73[_0xb32e('0x4')];var _0x526fd3=_0x11ff73[_0xb32e('0x5')];var _0x376171=_0x1cea32[_0xb32e('0x6')]('-')[0x4];var _0x1e862c=_0x1cea32['split']('-')[0x0];var _0x5deb12=crypto['createDecipher'](_0xb32e('0x7'),util[_0xb32e('0x8')](_0xb32e('0x9'),_0x376171,_0x1cea32,_0x1e862c));var _0x3a16ec=_0x5deb12['update'](_0x526fd3,_0xb32e('0xa'),_0xb32e('0xb'));_0x3a16ec+=_0x5deb12[_0xb32e('0xc')](_0xb32e('0xb'));var _0x11bdd1=JSON[_0xb32e('0xd')](_0x3a16ec);return _0x11bdd1[_0xb32e('0xe')](_0x572e81)?_0x11bdd1[_0x572e81]:null;}}return null;}function isLimit(_0x57fc13,_0x50414e,_0x4d8206,_0x564d9e){var _0x53c248=_0x50414e;return compose()[_0xb32e('0xf')](function(_0x2ae6c1,_0x3dc58d,_0x44f8dd){return db['License'][_0xb32e('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xa4598d){var _0x33ea5f=getValueFromLicense(_0x57fc13,_0xa4598d);return _0x33ea5f?_0x33ea5f:_0x53c248;})['then'](function(_0x310f21){_0x53c248=_0x310f21;return _0x4d8206[_0xb32e('0x11')](_0x564d9e);})[_0xb32e('0x12')](function(_0x46687e){if(_0x46687e>=_0x53c248){return _0x3dc58d[_0xb32e('0x13')](0x193)[_0xb32e('0x14')]({'message':util[_0xb32e('0x8')](_0xb32e('0x15'),_0x57fc13)});}_0x44f8dd();})[_0xb32e('0x16')](function(_0x551923){_0x44f8dd(_0x551923);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xb32e('0x17')],{'where':{'$or':[{'role':_0xb32e('0x18')},{'role':_0xb32e('0x19')}]}});}exports[_0xb32e('0x1a')]=isUserLimit; \ No newline at end of file +var _0x73c5=['%s:%s:%s','base64','final','hasOwnProperty','use','License','findOne','then','count','status','format','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr'];(function(_0x4dafe8,_0x21a07a){var _0x3371b7=function(_0x183697){while(--_0x183697){_0x4dafe8['push'](_0x4dafe8['shift']());}};_0x3371b7(++_0x21a07a);}(_0x73c5,0x177));var _0x573c=function(_0x48a735,_0x41ed28){_0x48a735=_0x48a735-0x0;var _0x512ad5=_0x73c5[_0x48a735];return _0x512ad5;};'use strict';var crypto=require(_0x573c('0x0'));var util=require(_0x573c('0x1'));var compose=require(_0x573c('0x2'));var db=require(_0x573c('0x3'))['db'];var config=require(_0x573c('0x4'));function getValueFromLicense(_0xf3a467,_0x120319){if(_0xf3a467&&_0x120319){if(_0x120319['data1']&&_0x120319[_0x573c('0x5')]){var _0x2d719c=_0x120319['data1'];var _0x21cdde=_0x120319[_0x573c('0x5')];var _0x3d8d94=_0x2d719c[_0x573c('0x6')]('-')[0x4];var _0x800ca6=_0x2d719c[_0x573c('0x6')]('-')[0x0];var _0x5d474b=crypto[_0x573c('0x7')](_0x573c('0x8'),util['format'](_0x573c('0x9'),_0x3d8d94,_0x2d719c,_0x800ca6));var _0x456832=_0x5d474b['update'](_0x21cdde,_0x573c('0xa'),'utf8');_0x456832+=_0x5d474b[_0x573c('0xb')]('utf8');var _0x5067dc=JSON['parse'](_0x456832);return _0x5067dc[_0x573c('0xc')](_0xf3a467)?_0x5067dc[_0xf3a467]:null;}}return null;}function isLimit(_0x206c71,_0xcf7bf0,_0x2f78b4,_0x5ea932){var _0x1797a1=_0xcf7bf0;return compose()[_0x573c('0xd')](function(_0x1f1f08,_0x415975,_0x5eea06){return db[_0x573c('0xe')][_0x573c('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3fb6ec){var _0x1d465e=getValueFromLicense(_0x206c71,_0x3fb6ec);return _0x1d465e?_0x1d465e:_0x1797a1;})[_0x573c('0x10')](function(_0x5c0181){_0x1797a1=_0x5c0181;return _0x2f78b4[_0x573c('0x11')](_0x5ea932);})[_0x573c('0x10')](function(_0x4e74a4){if(_0x4e74a4>=_0x1797a1){return _0x415975[_0x573c('0x12')](0x193)['json']({'message':util[_0x573c('0x13')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x206c71)});}_0x5eea06();})['catch'](function(_0x143be6){_0x5eea06(_0x143be6);});});}function isUserLimit(){return isLimit(_0x573c('0x14'),0x1,db[_0x573c('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x573c('0x16')}]}});}exports[_0x573c('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index cfb7e87..4e57f76 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 _0xef0b=['hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','filter','map','conditions','push','DATE','$eq','operator','$between','value','includes','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$endsWith','LIKE\x20?','>\x20?','$lte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','add'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0xef0b,0xd2));var _0xbef0=function(_0x551c4b,_0x53c6a9){_0x551c4b=_0x551c4b-0x0;var _0x167cd5=_0xef0b[_0x551c4b];return _0x167cd5;};'use strict';var _=require(_0xbef0('0x0'));var moment=require(_0xbef0('0x1'));exports[_0xbef0('0x2')]=function(_0x57dea){var _0x1585f9={'conditions':[]};_0x1585f9[_0xbef0('0x3')]=_[_0xbef0('0x4')](_0x57dea,_0xbef0('0x5'))?'or':_0xbef0('0x6');var _0xb64e76=_0x57dea[_0xbef0('0x7')](_0xbef0('0x8'),'')[_0xbef0('0x7')](_0xbef0('0x5'),'')['split']('||');for(var _0x12f34c=0x0;_0x12f34c<_0xb64e76[_0xbef0('0x9')];_0x12f34c++){var _0x555ca0=_0xb64e76[_0x12f34c][_0xbef0('0xa')](':=');var _0x57e783=_0x555ca0[0x0];var _0x473a6e=_0x555ca0[_0xbef0('0xb')](0x1);_0x473a6e[_0xbef0('0xc')](function(_0x1a7e0e){var _0x4e10f5=_0x1a7e0e[_0xbef0('0xa')]('[')[_0xbef0('0xd')]();var _0x2c697d=_0x1a7e0e['match'](/\[(.*?)\]/g);_0x2c697d[_0xbef0('0xc')](function(_0x2e73d6){var _0x1d0d15=_0x2e73d6[_0xbef0('0xa')]('[')[_0xbef0('0xe')](function(_0x3884fe){return _0x3884fe['indexOf'](']')>-0x1;})[_0xbef0('0xf')](function(_0x44b2c1){return _0x44b2c1[_0xbef0('0xa')](']')[0x0];})[0x0];_0x1585f9[_0xbef0('0x10')][_0xbef0('0x11')]({'field':_0x57e783,'operator':_0x4e10f5,'value':_0x1d0d15});});});}return _0x1585f9;};exports['buildExpression']=function(_0x2fb5e8,_0x51e1d9,_0x1b61b2){var _0x1eb6ba={};if(_0x51e1d9===_0xbef0('0x12')){if(_0x1b61b2['operator']===_0xbef0('0x13')){_0x1b61b2[_0xbef0('0x14')]=_0xbef0('0x15');_0x1b61b2['value']+=','+_0x1b61b2[_0xbef0('0x16')];}else if(_[_0xbef0('0x17')](['$gt','$lte'],_0x1b61b2[_0xbef0('0x14')])){_0x1b61b2['value']=moment(_0x1b61b2[_0xbef0('0x16')])['add'](0x1,_0xbef0('0x18'))[_0xbef0('0x19')](_0xbef0('0x1a'));}}if(_0x1b61b2[_0xbef0('0x1b')]){_0x51e1d9=_0x1b61b2['castTo'];_0x1eb6ba[_0xbef0('0x1c')]='CAST('+_0x2fb5e8+'.'+_0x1b61b2[_0xbef0('0x1d')]+_0xbef0('0x1e')+_0x1b61b2[_0xbef0('0x1b')]+')\x20'+parseOperator(_0x1b61b2[_0xbef0('0x14')]);}else{_0x1eb6ba[_0xbef0('0x1c')]=_0x2fb5e8+'.'+_0x1b61b2[_0xbef0('0x1d')]+'\x20'+parseOperator(_0x1b61b2['operator']);}if(_[_0xbef0('0x17')]([_0xbef0('0x1f'),_0xbef0('0x20')],_0x1b61b2[_0xbef0('0x14')]))_0x1eb6ba[_0xbef0('0x1c')]='('+_0x1eb6ba[_0xbef0('0x1c')]+_0xbef0('0x21')+_0x2fb5e8+'.'+_0x1b61b2[_0xbef0('0x1d')]+_0xbef0('0x22');_0x1eb6ba['value']=parseValue(_0x51e1d9,_0x1b61b2['operator'],_0x1b61b2[_0xbef0('0x16')]);return _0x1eb6ba;};function parseOperator(_0x4ee4f5){var _0x396f30;switch(_0x4ee4f5){case _0xbef0('0x23'):_0x396f30=_0xbef0('0x24');break;case'$notIn':_0x396f30=_0xbef0('0x25');break;case _0xbef0('0x13'):_0x396f30=_0xbef0('0x26');break;case _0xbef0('0x1f'):_0x396f30='<>\x20?';break;case'$substring':case'$startsWith':case _0xbef0('0x27'):_0x396f30=_0xbef0('0x28');break;case'$lt':_0x396f30='<\x20?';break;case'$gt':_0x396f30=_0xbef0('0x29');break;case _0xbef0('0x2a'):_0x396f30='<=\x20?';break;case'$gte':_0x396f30=_0xbef0('0x2b');break;case _0xbef0('0x15'):_0x396f30=_0xbef0('0x2c');break;}return _0x396f30;}function parseValue(_0x591893,_0x40c4ba,_0x116de7){var _0x3a8fc6={'start':undefined,'end':undefined};switch(_0x40c4ba){case _0xbef0('0x23'):case _0xbef0('0x20'):_0x3a8fc6[_0xbef0('0x2d')]=_0x116de7[_0xbef0('0xa')](',');break;case _0xbef0('0x2e'):_0x3a8fc6[_0xbef0('0x2d')]='%'+_0x116de7+'%';break;case'$startsWith':_0x3a8fc6[_0xbef0('0x2d')]=_0x116de7+'%';break;case _0xbef0('0x27'):_0x3a8fc6[_0xbef0('0x2d')]='%'+_0x116de7;break;case _0xbef0('0x15'):var _0x1d8f79=_0x116de7['split'](',');var _0x116de7=_0x1d8f79[_0xbef0('0xd')]();var _0x5c5b27=_0x1d8f79[_0xbef0('0x2f')]();if(_0x591893===_0xbef0('0x12')){_0x116de7=moment(_0x116de7)['utcOffset'](0x0,!![])[_0xbef0('0x19')]();_0x5c5b27=moment(_0x5c5b27)[_0xbef0('0x30')](0x0,!![])[_0xbef0('0x31')](0x17,_0xbef0('0x32'))[_0xbef0('0x31')](0x3b,_0xbef0('0x33'))[_0xbef0('0x31')](0x3b,'seconds')[_0xbef0('0x19')]();}_0x3a8fc6={'start':_0x116de7,'end':_0x5c5b27};break;default:_0x3a8fc6[_0xbef0('0x2d')]=_0x116de7;break;}return _0x3a8fc6;} \ No newline at end of file +var _0xa93e=['$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$and]','replace','length','split','slice','forEach','shift','indexOf','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa93e,0x6e));var _0xea93=function(_0x4f9fce,_0x3d6c38){_0x4f9fce=_0x4f9fce-0x0;var _0x4591f6=_0xa93e[_0x4f9fce];return _0x4591f6;};'use strict';var _=require(_0xea93('0x0'));var moment=require(_0xea93('0x1'));exports[_0xea93('0x2')]=function(_0x3b540e){var _0x321317={'conditions':[]};_0x321317[_0xea93('0x3')]=_['startsWith'](_0x3b540e,'[$or]')?'or':'and';var _0x3d213a=_0x3b540e['replace'](_0xea93('0x4'),'')[_0xea93('0x5')]('[$or]','')['split']('||');for(var _0x1a697d=0x0;_0x1a697d<_0x3d213a[_0xea93('0x6')];_0x1a697d++){var _0x46b6aa=_0x3d213a[_0x1a697d][_0xea93('0x7')](':=');var _0x529578=_0x46b6aa[0x0];var _0x8132f2=_0x46b6aa[_0xea93('0x8')](0x1);_0x8132f2[_0xea93('0x9')](function(_0x2eb99f){var _0x591e09=_0x2eb99f[_0xea93('0x7')]('[')[_0xea93('0xa')]();var _0x3d67b8=_0x2eb99f['match'](/\[(.*?)\]/g);_0x3d67b8[_0xea93('0x9')](function(_0x5a315b){var _0x1590cd=_0x5a315b[_0xea93('0x7')]('[')['filter'](function(_0x3b9846){return _0x3b9846[_0xea93('0xb')](']')>-0x1;})['map'](function(_0x1f5e0a){return _0x1f5e0a[_0xea93('0x7')](']')[0x0];})[0x0];_0x321317['conditions']['push']({'field':_0x529578,'operator':_0x591e09,'value':_0x1590cd});});});}return _0x321317;};exports[_0xea93('0xc')]=function(_0x5b9d6d,_0x210afc,_0x74b9e){var _0x536097={};if(_0x210afc===_0xea93('0xd')){if(_0x74b9e[_0xea93('0xe')]==='$eq'){_0x74b9e['operator']=_0xea93('0xf');_0x74b9e[_0xea93('0x10')]+=','+_0x74b9e[_0xea93('0x10')];}else if(_[_0xea93('0x11')]([_0xea93('0x12'),_0xea93('0x13')],_0x74b9e[_0xea93('0xe')])){_0x74b9e['value']=moment(_0x74b9e[_0xea93('0x10')])[_0xea93('0x14')](0x1,_0xea93('0x15'))[_0xea93('0x16')](_0xea93('0x17'));}}if(_0x74b9e[_0xea93('0x18')]){_0x210afc=_0x74b9e[_0xea93('0x18')];_0x536097['text']=_0xea93('0x19')+_0x5b9d6d+'.'+_0x74b9e['field']+_0xea93('0x1a')+_0x74b9e[_0xea93('0x18')]+')\x20'+parseOperator(_0x74b9e['operator']);}else{_0x536097[_0xea93('0x1b')]=_0x5b9d6d+'.'+_0x74b9e[_0xea93('0x1c')]+'\x20'+parseOperator(_0x74b9e['operator']);}if(_[_0xea93('0x11')]([_0xea93('0x1d'),_0xea93('0x1e')],_0x74b9e['operator']))_0x536097[_0xea93('0x1b')]='('+_0x536097[_0xea93('0x1b')]+_0xea93('0x1f')+_0x5b9d6d+'.'+_0x74b9e['field']+_0xea93('0x20');_0x536097['value']=parseValue(_0x210afc,_0x74b9e[_0xea93('0xe')],_0x74b9e[_0xea93('0x10')]);return _0x536097;};function parseOperator(_0x596a34){var _0x1db467;switch(_0x596a34){case _0xea93('0x21'):_0x1db467=_0xea93('0x22');break;case _0xea93('0x1e'):_0x1db467='NOT\x20IN\x20?';break;case'$eq':_0x1db467=_0xea93('0x23');break;case'$ne':_0x1db467=_0xea93('0x24');break;case _0xea93('0x25'):case _0xea93('0x26'):case _0xea93('0x27'):_0x1db467=_0xea93('0x28');break;case _0xea93('0x29'):_0x1db467='<\x20?';break;case'$gt':_0x1db467=_0xea93('0x2a');break;case'$lte':_0x1db467='<=\x20?';break;case _0xea93('0x2b'):_0x1db467=_0xea93('0x2c');break;case'$between':_0x1db467=_0xea93('0x2d');break;}return _0x1db467;}function parseValue(_0x1e123e,_0x29bf4d,_0x3bccd9){var _0x56aab7={'start':undefined,'end':undefined};switch(_0x29bf4d){case _0xea93('0x21'):case _0xea93('0x1e'):_0x56aab7[_0xea93('0x2e')]=_0x3bccd9[_0xea93('0x7')](',');break;case _0xea93('0x25'):_0x56aab7[_0xea93('0x2e')]='%'+_0x3bccd9+'%';break;case _0xea93('0x26'):_0x56aab7[_0xea93('0x2e')]=_0x3bccd9+'%';break;case'$endsWith':_0x56aab7['start']='%'+_0x3bccd9;break;case _0xea93('0xf'):var _0x2c8e5c=_0x3bccd9['split'](',');var _0x3bccd9=_0x2c8e5c[_0xea93('0xa')]();var _0x17205d=_0x2c8e5c['pop']();if(_0x1e123e==='DATE'){_0x3bccd9=moment(_0x3bccd9)['utcOffset'](0x0,!![])[_0xea93('0x16')]();_0x17205d=moment(_0x17205d)[_0xea93('0x2f')](0x0,!![])[_0xea93('0x14')](0x17,_0xea93('0x30'))[_0xea93('0x14')](0x3b,_0xea93('0x31'))[_0xea93('0x14')](0x3b,_0xea93('0x32'))[_0xea93('0x16')]();}_0x56aab7={'start':_0x3bccd9,'end':_0x17205d};break;default:_0x56aab7[_0xea93('0x2e')]=_0x3bccd9;break;}return _0x56aab7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2cd589f..c131d17 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 _0x228c=['join','query','$id','filters','intersection','attributes','nolimit','sort','filter','object','columns','value','where','merge','lower','options','include','includeAll','sequelize','moment','keys','includes','parse','model','alias','raw','fields','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','map','priority','cast','unsigned','DESC','col','ASC','omit','isEmpty','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push'];(function(_0xd0bd0a,_0x365063){var _0x3984f5=function(_0xcacbeb){while(--_0xcacbeb){_0xd0bd0a['push'](_0xd0bd0a['shift']());}};_0x3984f5(++_0x365063);}(_0x228c,0x157));var _0xc228=function(_0x338f8f,_0xd22e48){_0x338f8f=_0x338f8f-0x0;var _0x1ae335=_0x228c[_0x338f8f];return _0x1ae335;};'use strict';var _=require('lodash');var sequelize=require(_0xc228('0x0'));var moment=require(_0xc228('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1443c9){var _0x463618=['ne'];try{var _0x4200ab=JSON['parse'](_0x1443c9);var _0x3667aa=Object[_0xc228('0x2')](_0x4200ab)[0x0];return _0x463618[_0xc228('0x3')](_0x3667aa);}catch(_0x4009a4){return![];}}function getOperatorValue(_0x191dcd){var _0x23455f=JSON[_0xc228('0x4')](_0x191dcd);var _0xa6f387=Object[_0xc228('0x2')](_0x23455f)[0x0];var _0x198b9c=_0x23455f[_0xa6f387];return{['$'+_0xa6f387]:_0x198b9c};}function parseIncludeModel(_0x1d07f2){var _0x5ee2c3=JSON[_0xc228('0x4')](_0x1d07f2);return{'model':db[_0x5ee2c3[_0xc228('0x5')]],'as':_0x5ee2c3[_0xc228('0x6')],'attributes':_0x5ee2c3['fields'],'raw':_0x5ee2c3[_0xc228('0x7')]};}exports[_0xc228('0x8')]=function(_0x140ccb){var _0x545c27=null;if(_0x140ccb){_0x545c27=_0x140ccb['split'](',');}return _0x545c27;};exports['filters']=function(_0x49faf5,_0x322fb7){var _0x55b1b3={};if(!_['isEmpty'](_0x49faf5)){_[_0xc228('0x9')](_0x49faf5,function(_0x1d4e07,_0x262509){try{if(_0x322fb7){var _0xee46c0=_[_0xc228('0xa')](_0x322fb7,{'name':_0x262509})||{};if(hasSequelizeOperator(_0x1d4e07)){_0x55b1b3[_0x262509]=getOperatorValue(_0x1d4e07);}else if(_0xee46c0[_0xc228('0xb')]==='DATE'&&_[_0xc228('0xc')](_0x1d4e07)){var _0x392e30=JSON[_0xc228('0x4')](_0x1d4e07);var _0x353e8d={'$gte':moment(moment(_0x392e30[_0xc228('0xd')])[_0xc228('0xe')](_0xc228('0xf')))[_0xc228('0x10')]()[_0xc228('0xe')](),'$lte':moment(moment(_0x392e30[_0xc228('0x11')])[_0xc228('0xe')](_0xc228('0xf')))['utc']()[_0xc228('0x12')](0x1,'s')[_0xc228('0xe')]()};_0x55b1b3[_0x262509]=_0x353e8d;}else if(_0xee46c0[_0xc228('0x13')]===_0xc228('0x14')){_0x55b1b3[_0x262509]=_0x1d4e07;}else{_0x55b1b3[_0x262509]=_['isArray'](_0x1d4e07)?_0x1d4e07:JSON[_0xc228('0x4')](_0x1d4e07);}}else{_0x55b1b3[_0x262509]=_[_0xc228('0x15')](_0x1d4e07)?_0x1d4e07:JSON[_0xc228('0x4')](_0x1d4e07);}}catch(_0x453a87){_0x55b1b3[_0x262509]=_0x1d4e07[_0xc228('0x16')](',');}});}return _0x55b1b3;};exports[_0xc228('0x17')]=function(_0x2c5587){_0x2c5587=parseInt(_0x2c5587,0xa);if(!_0x2c5587||_0x2c5587<0x0){_0x2c5587=LIMIT_VALUE;}return _0x2c5587;};exports[_0xc228('0x18')]=function(_0x78d3f0){_0x78d3f0=parseInt(_0x78d3f0,0xa);if(!_0x78d3f0||_0x78d3f0<0x0){_0x78d3f0=0x0;}return _0x78d3f0;};exports['sort']=function(_0x51552d){var _0x4d9d9a,_0x2aa0c3=null;if(_0x51552d){_0x4d9d9a=_0x51552d['split'](',');_0x2aa0c3=_[_0xc228('0x19')](_0x4d9d9a,function(_0x3480af){if(_0x3480af['indexOf']('-')===0x0){return[_0x3480af===_0xc228('0x1a')?sequelize[_0xc228('0x1b')](sequelize['col']('priority'),_0xc228('0x1c')):_0x3480af['substr'](0x1),_0xc228('0x1d')];}else{return[_0x3480af===_0xc228('0x1a')?sequelize[_0xc228('0x1b')](sequelize[_0xc228('0x1e')](_0xc228('0x1a')),_0xc228('0x1c')):_0x3480af,_0xc228('0x1f')];}});}return _0x2aa0c3;};exports[_0xc228('0x20')]=function(_0x2dd73c,_0x1ea162){if(_[_0xc228('0x21')](_0x2dd73c)){return _0x2dd73c;}if(_[_0xc228('0x15')](_0x2dd73c)){for(var _0x153e49=0x0;_0x153e49<_0x2dd73c['length'];_0x153e49+=0x1){_0x2dd73c[_0x153e49]=this[_0xc228('0x20')](_0x2dd73c[_0x153e49],_0x1ea162);}return _0x2dd73c;}if(!_['isObject'](_0x2dd73c)){return _0x2dd73c;}if(_[_0xc228('0x22')](_0x1ea162)){_0x1ea162=[_0x1ea162];}if(!_[_0xc228('0x15')](_0x1ea162)){return _0x2dd73c;}for(var _0x29b642=0x0;_0x29b642<_0x1ea162[_0xc228('0x23')];_0x29b642+=0x1){_[_0xc228('0x24')](_0x2dd73c,_0x1ea162[_0x29b642]);}for(var _0x39440a in _0x2dd73c){if(_0x2dd73c[_0xc228('0x25')](_0x39440a)){_0x2dd73c[_0x39440a]=this[_0xc228('0x20')](_0x2dd73c[_0x39440a],_0x1ea162);}}return _0x2dd73c;};exports[_0xc228('0x26')]=function(_0x5b396f){return _0x5b396f[_0xc228('0x27')](RegExp(_0xc228('0x28')))?!![]:![];};exports[_0xc228('0x29')]=function(_0x3b5865){return _0x3b5865[_0xc228('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xc228('0x2a')]=function(_0x492968,_0x229833){var _0x2d4393=[];var _0x537ce3=/[ `!@#$%^&*()_\-?~]/;var _0x1ffc1d=_0x229833?_0xc228('0x2b'):_0xc228('0x2c');_0x492968['split'](/[ ,]+/)[_0xc228('0x2d')](function(_0xad4fcc){_0xad4fcc=_0xad4fcc['replace'](/([^:]")"+/g,'$1');_0xad4fcc='+'+_0xad4fcc+'*';var _0x4bb3d6=_0xad4fcc[_0xc228('0x27')](_0x537ce3);if(_0x4bb3d6){_0xad4fcc='\x22'+_0xad4fcc+'\x22';}_0x2d4393[_0xc228('0x2e')](_0xad4fcc);});_0x1ffc1d=_0x1ffc1d['replace'](_0xc228('0x2c'),_0x2d4393[_0xc228('0x2f')]('\x20'));return _0x1ffc1d;};exports['getOptions']=function(_0x3d0c44,_0x5958b6,_0x2acfa3){var _0x3c4e76={},_0x423608={};if(_0x5958b6['query']['$id']){_0x5958b6[_0xc228('0x30')]['id']=_0x5958b6[_0xc228('0x30')][_0xc228('0x31')];delete _0x5958b6[_0xc228('0x30')][_0xc228('0x31')];}_0x3c4e76[_0xc228('0x5')]=_[_0xc228('0x19')](_0x3d0c44,_0xc228('0x13'));_0x3c4e76['query']=_[_0xc228('0x2')](_0x5958b6['query']);_0x3c4e76[_0xc228('0x32')]=_[_0xc228('0x33')](_0x3c4e76[_0xc228('0x5')],_0x3c4e76[_0xc228('0x30')]);_0x423608['attributes']=_[_0xc228('0x33')](_0x3c4e76[_0xc228('0x5')],this[_0xc228('0x8')](_0x5958b6[_0xc228('0x30')][_0xc228('0x8')]));_0x423608[_0xc228('0x34')]=_0x423608[_0xc228('0x34')][_0xc228('0x23')]?_0x423608[_0xc228('0x34')]:_0x3c4e76['model'];if(!_0x5958b6[_0xc228('0x30')][_0xc228('0x25')](_0xc228('0x35'))){_0x423608['limit']=this[_0xc228('0x17')](_0x5958b6[_0xc228('0x30')][_0xc228('0x17')]);_0x423608[_0xc228('0x18')]=this[_0xc228('0x18')](_0x5958b6[_0xc228('0x30')][_0xc228('0x18')]);}_0x423608['order']=this['sort'](_0x5958b6[_0xc228('0x30')][_0xc228('0x36')]);_0x423608['where']=this[_0xc228('0x32')](_['pick'](_0x5958b6[_0xc228('0x30')],_0x3c4e76['filters']),_0x3d0c44);if(_0x5958b6['query']['filter']){var _0x13188c=_0x3d0c44;var _0xc20717=_0x5958b6['query'][_0xc228('0x37')];if(typeof _0xc20717===_0xc228('0x38')){_0x13188c=_[_0xc228('0x37')](_0x3d0c44,function(_0x32884d){return _['includes'](_0xc20717[_0xc228('0x39')],_0x32884d[_0xc228('0x13')]);});_0xc20717=_0xc20717[_0xc228('0x3a')];}_0x423608[_0xc228('0x3b')]=_[_0xc228('0x3c')](_0x423608[_0xc228('0x3b')],{'$or':_[_0xc228('0x19')](_0x13188c,function(_0xceb44f){if(_0xceb44f['type']!=='VIRTUAL'){if(_0x2acfa3){return sequelize[_0xc228('0x3b')](sequelize['fn'](_0xc228('0x3d'),sequelize['col'](_0xceb44f[_0xc228('0x13')])),{'$like':sequelize['fn'](_0xc228('0x3d'),'%'+_0x5958b6[_0xc228('0x30')][_0xc228('0x37')]+'%')});}else{var _0xe2110={};_0xe2110[_0xceb44f[_0xc228('0x13')]]={'$like':'%'+_0x5958b6['query']['filter']+'%'};return _0xe2110;}}})});}_0x423608=_[_0xc228('0x3c')]({},_0x423608,_0x5958b6[_0xc228('0x3e')]);return _0x423608;};exports[_0xc228('0x3f')]=function(_0x209220){var _0x2c3955=[];if(_0x209220[_0xc228('0x40')]){_0x2c3955[_0xc228('0x2e')]({'all':!![]});}else if(_0x209220[_0xc228('0x3f')]){if(Array[_0xc228('0x15')](_0x209220[_0xc228('0x3f')])){_0x2c3955=Object['keys'](_0x209220[_0xc228('0x3f')])[_0xc228('0x19')](function(_0x65178e){return parseIncludeModel(_0x209220[_0xc228('0x3f')][_0x65178e]);});}else{var _0x1f2e72=parseIncludeModel(_0x209220[_0xc228('0x3f')]);_0x2c3955[_0xc228('0x2e')](_0x1f2e72);}}return _0x2c3955;}; \ No newline at end of file +var _0x2a77=['alias','fields','split','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','name','uniqueid','isArray','limit','cast','col','DESC','priority','unsigned','ASC','omit','isEmpty','isString','length','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','forEach','replace','{EXPR}','join','query','$id','map','filters','intersection','attributes','hasOwnProperty','nolimit','offset','sort','pick','filter','merge','type','where','lower','options','include','includeAll','push','lodash','moment','../../mysqldb','parse','keys','includes','model'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x2a77,0x1d1));var _0x72a7=function(_0x42a5e4,_0x2ccfb6){_0x42a5e4=_0x42a5e4-0x0;var _0xd56657=_0x2a77[_0x42a5e4];return _0xd56657;};'use strict';var _=require(_0x72a7('0x0'));var sequelize=require('sequelize');var moment=require(_0x72a7('0x1'));var db=require(_0x72a7('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x31202f){var _0x18e27d=['ne'];try{var _0x297296=JSON[_0x72a7('0x3')](_0x31202f);var _0x355521=Object[_0x72a7('0x4')](_0x297296)[0x0];return _0x18e27d[_0x72a7('0x5')](_0x355521);}catch(_0x26decf){return![];}}function getOperatorValue(_0x192e41){var _0x4d6961=JSON['parse'](_0x192e41);var _0x4dde3e=Object[_0x72a7('0x4')](_0x4d6961)[0x0];var _0x325018=_0x4d6961[_0x4dde3e];return{['$'+_0x4dde3e]:_0x325018};}function parseIncludeModel(_0x508a8b){var _0x5bbd70=JSON[_0x72a7('0x3')](_0x508a8b);return{'model':db[_0x5bbd70[_0x72a7('0x6')]],'as':_0x5bbd70[_0x72a7('0x7')],'attributes':_0x5bbd70[_0x72a7('0x8')],'raw':_0x5bbd70['raw']};}exports[_0x72a7('0x8')]=function(_0xbd6671){var _0x24db99=null;if(_0xbd6671){_0x24db99=_0xbd6671[_0x72a7('0x9')](',');}return _0x24db99;};exports['filters']=function(_0x214992,_0x446479){var _0x1df9f8={};if(!_['isEmpty'](_0x214992)){_['forOwn'](_0x214992,function(_0x4f4be8,_0x5248ab){try{if(_0x446479){var _0x229d6c=_['find'](_0x446479,{'name':_0x5248ab})||{};if(hasSequelizeOperator(_0x4f4be8)){_0x1df9f8[_0x5248ab]=getOperatorValue(_0x4f4be8);}else if(_0x229d6c['type']==='DATE'&&_[_0x72a7('0xa')](_0x4f4be8)){var _0xcdba8c=JSON[_0x72a7('0x3')](_0x4f4be8);var _0x1869ad={'$gte':moment(moment(_0xcdba8c[_0x72a7('0xb')])[_0x72a7('0xc')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0xcdba8c[_0x72a7('0xd')])[_0x72a7('0xc')](_0x72a7('0xe')))[_0x72a7('0xf')]()['subtract'](0x1,'s')[_0x72a7('0xc')]()};_0x1df9f8[_0x5248ab]=_0x1869ad;}else if(_0x229d6c[_0x72a7('0x10')]===_0x72a7('0x11')){_0x1df9f8[_0x5248ab]=_0x4f4be8;}else{_0x1df9f8[_0x5248ab]=_['isArray'](_0x4f4be8)?_0x4f4be8:JSON['parse'](_0x4f4be8);}}else{_0x1df9f8[_0x5248ab]=_[_0x72a7('0x12')](_0x4f4be8)?_0x4f4be8:JSON[_0x72a7('0x3')](_0x4f4be8);}}catch(_0x171ed6){_0x1df9f8[_0x5248ab]=_0x4f4be8[_0x72a7('0x9')](',');}});}return _0x1df9f8;};exports[_0x72a7('0x13')]=function(_0x3e9d9a){_0x3e9d9a=parseInt(_0x3e9d9a,0xa);if(!_0x3e9d9a||_0x3e9d9a<0x0){_0x3e9d9a=LIMIT_VALUE;}return _0x3e9d9a;};exports['offset']=function(_0x48fe0b){_0x48fe0b=parseInt(_0x48fe0b,0xa);if(!_0x48fe0b||_0x48fe0b<0x0){_0x48fe0b=0x0;}return _0x48fe0b;};exports['sort']=function(_0x3c8257){var _0x474962,_0x29838b=null;if(_0x3c8257){_0x474962=_0x3c8257[_0x72a7('0x9')](',');_0x29838b=_['map'](_0x474962,function(_0x345c77){if(_0x345c77['indexOf']('-')===0x0){return[_0x345c77==='priority'?sequelize[_0x72a7('0x14')](sequelize[_0x72a7('0x15')]('priority'),'unsigned'):_0x345c77['substr'](0x1),_0x72a7('0x16')];}else{return[_0x345c77===_0x72a7('0x17')?sequelize[_0x72a7('0x14')](sequelize['col'](_0x72a7('0x17')),_0x72a7('0x18')):_0x345c77,_0x72a7('0x19')];}});}return _0x29838b;};exports[_0x72a7('0x1a')]=function(_0x14b17a,_0x4a2bae){if(_[_0x72a7('0x1b')](_0x14b17a)){return _0x14b17a;}if(_[_0x72a7('0x12')](_0x14b17a)){for(var _0x37905a=0x0;_0x37905a<_0x14b17a['length'];_0x37905a+=0x1){_0x14b17a[_0x37905a]=this[_0x72a7('0x1a')](_0x14b17a[_0x37905a],_0x4a2bae);}return _0x14b17a;}if(!_['isObject'](_0x14b17a)){return _0x14b17a;}if(_[_0x72a7('0x1c')](_0x4a2bae)){_0x4a2bae=[_0x4a2bae];}if(!_[_0x72a7('0x12')](_0x4a2bae)){return _0x14b17a;}for(var _0x25987e=0x0;_0x25987e<_0x4a2bae[_0x72a7('0x1d')];_0x25987e+=0x1){_['unset'](_0x14b17a,_0x4a2bae[_0x25987e]);}for(var _0x13f1a7 in _0x14b17a){if(_0x14b17a['hasOwnProperty'](_0x13f1a7)){_0x14b17a[_0x13f1a7]=this[_0x72a7('0x1a')](_0x14b17a[_0x13f1a7],_0x4a2bae);}}return _0x14b17a;};exports['isNumeric']=function(_0x1e5281){return _0x1e5281['match'](RegExp(_0x72a7('0x1e')))?!![]:![];};exports[_0x72a7('0x1f')]=function(_0x3dd33b){return _0x3dd33b[_0x72a7('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x72a7('0x21')]=function(_0x5855ab,_0x56693f){var _0xd0de2f=[];var _0x367321=/[ `!@#$%^&*()_\-?~]/;var _0x526f5c=_0x56693f?_0x72a7('0x22'):'{EXPR}';_0x5855ab[_0x72a7('0x9')](/[ ,]+/)[_0x72a7('0x23')](function(_0x55306f){_0x55306f=_0x55306f[_0x72a7('0x24')](/([^:]")"+/g,'$1');_0x55306f='+'+_0x55306f+'*';var _0x385d47=_0x55306f[_0x72a7('0x20')](_0x367321);if(_0x385d47){_0x55306f='\x22'+_0x55306f+'\x22';}_0xd0de2f['push'](_0x55306f);});_0x526f5c=_0x526f5c[_0x72a7('0x24')](_0x72a7('0x25'),_0xd0de2f[_0x72a7('0x26')]('\x20'));return _0x526f5c;};exports['getOptions']=function(_0x411c5a,_0x36a551,_0x469475){var _0x39991d={},_0x236ec1={};if(_0x36a551[_0x72a7('0x27')][_0x72a7('0x28')]){_0x36a551[_0x72a7('0x27')]['id']=_0x36a551[_0x72a7('0x27')][_0x72a7('0x28')];delete _0x36a551[_0x72a7('0x27')][_0x72a7('0x28')];}_0x39991d['model']=_[_0x72a7('0x29')](_0x411c5a,_0x72a7('0x10'));_0x39991d[_0x72a7('0x27')]=_['keys'](_0x36a551[_0x72a7('0x27')]);_0x39991d[_0x72a7('0x2a')]=_[_0x72a7('0x2b')](_0x39991d[_0x72a7('0x6')],_0x39991d[_0x72a7('0x27')]);_0x236ec1[_0x72a7('0x2c')]=_[_0x72a7('0x2b')](_0x39991d['model'],this[_0x72a7('0x8')](_0x36a551[_0x72a7('0x27')][_0x72a7('0x8')]));_0x236ec1['attributes']=_0x236ec1['attributes'][_0x72a7('0x1d')]?_0x236ec1['attributes']:_0x39991d[_0x72a7('0x6')];if(!_0x36a551[_0x72a7('0x27')][_0x72a7('0x2d')](_0x72a7('0x2e'))){_0x236ec1[_0x72a7('0x13')]=this[_0x72a7('0x13')](_0x36a551[_0x72a7('0x27')][_0x72a7('0x13')]);_0x236ec1[_0x72a7('0x2f')]=this['offset'](_0x36a551['query'][_0x72a7('0x2f')]);}_0x236ec1['order']=this[_0x72a7('0x30')](_0x36a551[_0x72a7('0x27')]['sort']);_0x236ec1['where']=this[_0x72a7('0x2a')](_[_0x72a7('0x31')](_0x36a551[_0x72a7('0x27')],_0x39991d[_0x72a7('0x2a')]),_0x411c5a);if(_0x36a551[_0x72a7('0x27')][_0x72a7('0x32')]){var _0x58949d=_0x411c5a;var _0x12ced6=_0x36a551[_0x72a7('0x27')][_0x72a7('0x32')];if(typeof _0x12ced6==='object'){_0x58949d=_[_0x72a7('0x32')](_0x411c5a,function(_0x1e75e3){return _[_0x72a7('0x5')](_0x12ced6['columns'],_0x1e75e3[_0x72a7('0x10')]);});_0x12ced6=_0x12ced6['value'];}_0x236ec1['where']=_[_0x72a7('0x33')](_0x236ec1['where'],{'$or':_[_0x72a7('0x29')](_0x58949d,function(_0x3411fc){if(_0x3411fc[_0x72a7('0x34')]!=='VIRTUAL'){if(_0x469475){return sequelize[_0x72a7('0x35')](sequelize['fn']('lower',sequelize[_0x72a7('0x15')](_0x3411fc[_0x72a7('0x10')])),{'$like':sequelize['fn'](_0x72a7('0x36'),'%'+_0x36a551[_0x72a7('0x27')][_0x72a7('0x32')]+'%')});}else{var _0x5699bc={};_0x5699bc[_0x3411fc[_0x72a7('0x10')]]={'$like':'%'+_0x36a551['query'][_0x72a7('0x32')]+'%'};return _0x5699bc;}}})});}_0x236ec1=_['merge']({},_0x236ec1,_0x36a551[_0x72a7('0x37')]);return _0x236ec1;};exports[_0x72a7('0x38')]=function(_0x281f85){var _0x304af3=[];if(_0x281f85[_0x72a7('0x39')]){_0x304af3[_0x72a7('0x3a')]({'all':!![]});}else if(_0x281f85['include']){if(Array[_0x72a7('0x12')](_0x281f85[_0x72a7('0x38')])){_0x304af3=Object[_0x72a7('0x4')](_0x281f85[_0x72a7('0x38')])[_0x72a7('0x29')](function(_0x43e74b){return parseIncludeModel(_0x281f85[_0x72a7('0x38')][_0x43e74b]);});}else{var _0x1b2fa7=parseIncludeModel(_0x281f85['include']);_0x304af3[_0x72a7('0x3a')](_0x1b2fa7);}}return _0x304af3;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 53282b9..0f1f976 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['whatsappStatus','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','unknown','*pause','busy','isArray','startCase','Queue','map','getAgents','all','then','flatten','uniq','value','getAgentIdsByStatus','includes','User','findAll','chatPause','openchannelPause','pauseType','globalStatus','split','fields','order','DESC','fullname','indexOf','internal','validateSortParameter','pause','toLowerCase','sortAgentsByStatus','lastLoginAt','lastPauseAt','address','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','filterAgentAttributes','name','role','userpic','voiceStatusTime','whatsappStatusTime','openchannelCapacity','chatCurrentCapacity','smsCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','smsPause','whatsappPause','every','filter','length','idle','unavailable','ringing','isNil','voicePause','voiceStatus','chatStatus','faxStatus','openchannelStatus','smsStatus'];(function(_0x1768a7,_0x50ace3){var _0x456125=function(_0x2cee9f){while(--_0x2cee9f){_0x1768a7['push'](_0x1768a7['shift']());}};_0x456125(++_0x50ace3);}(_0x7da7,0x10d));var _0x77da=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x7da7[_0x2fe689];return _0x35ea44;};'use strict';var _=require(_0x77da('0x0'));var jayson=require(_0x77da('0x1'));var db=require(_0x77da('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x77da('0x3')][_0x77da('0x4')]({'port':0x232c});function isAgentPaused(_0x4f60c3,_0x3a9fa6){var _0x37b3d9=[_0x4f60c3['chatPause'],_0x4f60c3[_0x77da('0x5')],_0x4f60c3[_0x77da('0x6')],_0x4f60c3['openchannelPause'],_0x4f60c3[_0x77da('0x7')],_0x4f60c3['voicePause'],_0x4f60c3[_0x77da('0x8')]];if(!_0x3a9fa6)return _[_0x77da('0x9')](_0x37b3d9);var _0x37c5ab=_[_0x77da('0xa')](_0x37b3d9);return _0x37c5ab[_0x77da('0xb')]>0x0&&_0x37c5ab['length']<_0x37b3d9[_0x77da('0xb')]?!![]:![];}function isIdle(_0xb55827){return _0xb55827===_0x77da('0xc')||_0xb55827==='unknown'||_0xb55827===_0x77da('0xd')||_0xb55827===_0x77da('0xe')||_[_0x77da('0xf')](_0xb55827);}function isAgentIdle(_0x2a675a){if(_0x2a675a['voiceStatus']!==_0x77da('0xc')&&_0x2a675a[_0x77da('0x10')]){_0x2a675a[_0x77da('0x11')]='pause';return![];}return _['every']([_0x2a675a[_0x77da('0x12')],_0x2a675a[_0x77da('0x13')],_0x2a675a['mailStatus'],_0x2a675a[_0x77da('0x14')],_0x2a675a[_0x77da('0x15')],_0x2a675a[_0x77da('0x11')],_0x2a675a[_0x77da('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x77da('0x17'),{})['then'](function(_0x29cd7b){if(_0x29cd7b[_0x77da('0x18')]){throw new Error(_0x77da('0x19'));}var _0x4500c4=_0x29cd7b['result'];return routingClient['request']('Agents',{})['then'](function(_0x103e46){if(_0x103e46[_0x77da('0x18')]){throw new Error(_0x77da('0x1a'));}var _0x335dcb=_0x103e46[_0x77da('0x1b')];return _[_0x77da('0x1c')]({},_0x4500c4,_0x335dcb);});})[_0x77da('0x1d')](function(_0x3b6dde){throw _0x3b6dde;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x492063){var _0xd5a809=_0x77da('0x1e');if(isAgentPaused(_0x492063))_0xd5a809='pause';else if(isAgentPaused(_0x492063,!![]))_0xd5a809=_0x77da('0x1f');else if(isAgentIdle(_0x492063))_0xd5a809=_0x77da('0xc');else _0xd5a809=_0x77da('0x20');return _0xd5a809;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x58270c,_0x3e6cfe){var _0x58f6c1=_[_0x77da('0x21')](_0x58270c)?_0x58270c:[_0x58270c];var _0x1c27aa=_[_0x77da('0x22')](_0x3e6cfe)+_0x77da('0x23');var _0x10399a=_[_0x77da('0x24')](_0x58f6c1,function(_0x95b5db){return db[_0x1c27aa]['findOne']({'where':{'id':_0x95b5db}})['then'](function(_0xfd160){if(!_0xfd160)return[];return _0xfd160[_0x77da('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x77da('0x26')](_0x10399a)[_0x77da('0x27')](function(_0x545654){var _0x42240b=_(_0x545654)[_0x77da('0x28')]()[_0x77da('0x24')]('id')[_0x77da('0x29')]()[_0x77da('0x2a')]();return _0x42240b;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0xce24b8,_0x3e090d,_0x1f2279){try{if(_0x3e090d[_0x77da('0xb')]>0x0){_0xce24b8=_0xce24b8['filter'](function(_0x5b4638){return _0x3e090d['includes'](_0x5b4638['id']);});}var _0x2258e9=_0xce24b8[_0x77da('0xa')](function(_0x410d09){var _0x3394d6=_0x77da('0x20');if(isAgentIdle(_0x410d09)){_0x3394d6='idle';}return _0x3394d6===_0x1f2279;});return _[_0x77da('0x24')](_0x2258e9,'id');}catch(_0x26f5a0){throw _0x26f5a0;}}exports[_0x77da('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1d381b,_0x1e7853,_0x46e6b4){return Promise['resolve']()[_0x77da('0x27')](function(){if(_0x1e7853[_0x77da('0xb')]>0x0){_0x1d381b=_0x1d381b[_0x77da('0xa')](function(_0x38643a){return _0x1e7853[_0x77da('0x2c')](_0x38643a['id']);});}return _0x1d381b;})[_0x77da('0x27')](function(){return db[_0x77da('0x2d')][_0x77da('0x2e')]({'attributes':['id','name','fullname',_0x77da('0x2f'),_0x77da('0x5'),'mailPause',_0x77da('0x30'),_0x77da('0x7'),_0x77da('0x10'),_0x77da('0x8'),_0x77da('0x31')],'where':{'id':{'$in':_[_0x77da('0x24')](_0x1d381b,'id')}},'raw':!![]});})[_0x77da('0x27')](function(_0x5c4a03){return _0x5c4a03[_0x77da('0x24')](function(_0x4df4b9){var _0x54b7f2=_['find'](_0x1d381b,['id',_0x4df4b9['id']]);var _0x17d236=filterAgentAttributes(_0x54b7f2);_['merge'](_0x4df4b9,_0x17d236);_0x4df4b9[_0x77da('0x32')]=getAgentStatus(_0x4df4b9);return _0x4df4b9;});})[_0x77da('0x27')](function(_0xce9df2){var _0x3cc78b=sortAgentsByStatus(_0xce9df2,_0x46e6b4);return _[_0x77da('0x24')](_0x3cc78b,'id');})[_0x77da('0x1d')](function(_0x43c20a){throw _0x43c20a;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x297d49){var _0x467410={'fields':[],'order':null};var _0x1ca53a=_0x297d49[_0x77da('0x33')](',');_0x467410[_0x77da('0x34')]=_[_0x77da('0xa')](_0x1ca53a,function(_0x48fccc){if(!_0x48fccc[_0x77da('0x2c')](_0x77da('0x32'))){return!![];}_0x467410[_0x77da('0x35')]=_['startsWith'](_0x48fccc,'-')?_0x77da('0x36'):'ASC';return![];});return _0x467410;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x599e21){if(!_0x599e21){_0x599e21='fullname,internal';}if(_0x599e21[_0x77da('0x2c')](_0x77da('0x37'))&&!_0x599e21[_0x77da('0x2c')]('internal')){var _0x21d337=_0x599e21['substring'](0x0,_0x599e21[_0x77da('0x38')]('fullname'));_0x599e21+=','+_0x21d337+_0x77da('0x39');}return _0x599e21;}exports[_0x77da('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x290667,_0x1612b7){var _0x240bee=_0x290667['sort'](function(_0x759b86,_0x1f48bd){if(_0x759b86[_0x77da('0x32')]===_0x1f48bd[_0x77da('0x32')]){if(_0x759b86[_0x77da('0x32')]===_0x77da('0x3b')){if(_0x1612b7==='DESC'){return(_0x759b86[_0x77da('0x31')]||'')<(_0x1f48bd[_0x77da('0x31')]||'')||_0x759b86[_0x77da('0x37')][_0x77da('0x3c')]()>_0x1f48bd[_0x77da('0x37')][_0x77da('0x3c')]()?0x1:-0x1;}else{return(_0x759b86['pauseType']||'')<(_0x1f48bd[_0x77da('0x31')]||'')||_0x759b86['fullname'][_0x77da('0x3c')]()>_0x1f48bd[_0x77da('0x37')][_0x77da('0x3c')]()?-0x1:0x1;}}else{if(_0x1612b7==='DESC'){return _0x759b86[_0x77da('0x37')][_0x77da('0x3c')]()<_0x1f48bd[_0x77da('0x37')][_0x77da('0x3c')]()?0x1:-0x1;}else{return _0x759b86[_0x77da('0x37')][_0x77da('0x3c')]()<_0x1f48bd[_0x77da('0x37')][_0x77da('0x3c')]()?-0x1:0x1;}}}else{if(_0x1612b7===_0x77da('0x36')){return _0x759b86['globalStatus']<_0x1f48bd[_0x77da('0x32')]?0x1:-0x1;}else{return _0x759b86[_0x77da('0x32')]<_0x1f48bd[_0x77da('0x32')]?-0x1:0x1;}}});return _0x240bee;}exports[_0x77da('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x4644f3){var _0x2e3c38=['userpic','online',_0x77da('0x3e'),_0x77da('0x3f'),_0x77da('0x31'),_0x77da('0x3f'),_0x77da('0x39'),_0x77da('0x40'),'chatPause',_0x77da('0x30'),_0x77da('0x6'),_0x77da('0x7'),_0x77da('0x8'),'faxPause',_0x77da('0x10'),'chatCapacity','openchannelCapacity',_0x77da('0x41'),_0x77da('0x42'),_0x77da('0x43'),_0x77da('0x44'),'chatCurrentCapacity',_0x77da('0x45'),_0x77da('0x46'),'smsCurrentCapacity',_0x77da('0x47'),_0x77da('0x48'),'chatStatus',_0x77da('0x14'),_0x77da('0x49'),_0x77da('0x15'),_0x77da('0x16'),_0x77da('0x13'),_0x77da('0x11'),_0x77da('0x4a'),_0x77da('0x4b'),_0x77da('0x4c'),_0x77da('0x4d'),'whatsappStatusTime',_0x77da('0x4e'),'voiceStatusTime',_0x77da('0x4f'),_0x77da('0x50'),_0x77da('0x51'),_0x77da('0x52'),_0x77da('0x53'),_0x77da('0x54')];var _0x3a78d2=['chatPause',_0x77da('0x30'),_0x77da('0x6'),_0x77da('0x7'),_0x77da('0x8'),'faxPause',_0x77da('0x10'),_0x77da('0x55')];var _0x133b14=_(_0x4644f3)['omit'](_0x3a78d2)['pick'](_0x2e3c38)[_0x77da('0x2a')]();return _0x133b14;}exports[_0x77da('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x77da('0x57'),_0x77da('0x37'),_0x77da('0x58'),'internal','online',_0x77da('0x32'),_0x77da('0x59'),'lastLoginAt',_0x77da('0x31'),_0x77da('0x3f'),_0x77da('0x5'),'chatPause',_0x77da('0x6'),_0x77da('0x30'),'smsPause',_0x77da('0x10'),_0x77da('0x8'),_0x77da('0x12'),_0x77da('0x13'),_0x77da('0x49'),_0x77da('0x14'),_0x77da('0x15'),_0x77da('0x11'),_0x77da('0x16'),'chatStatusTime',_0x77da('0x4e'),_0x77da('0x4c'),_0x77da('0x4b'),_0x77da('0x4d'),_0x77da('0x5a'),_0x77da('0x5b'),'chatCapacity',_0x77da('0x44'),_0x77da('0x41'),_0x77da('0x5c'),'smsCapacity',_0x77da('0x43'),_0x77da('0x5d'),_0x77da('0x48'),_0x77da('0x46'),_0x77da('0x45'),_0x77da('0x5e'),_0x77da('0x47'),'phoneBarEnableScreenRecordingByAgent',_0x77da('0x53'),'destconnectedlinenum',_0x77da('0x5f'),_0x77da('0x4f'),_0x77da('0x54'),'screenrecording'];}exports[_0x77da('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf494=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','faxStatusTime','smsStatusTime','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unavailable','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','unknown','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','resolve','includes','User','findAll','name','fullname','whatsappPause'];(function(_0x58390b,_0x185845){var _0x5947f9=function(_0x540753){while(--_0x540753){_0x58390b['push'](_0x58390b['shift']());}};_0x5947f9(++_0x185845);}(_0xf494,0x1c6));var _0x4f49=function(_0x49171b,_0x572be3){_0x49171b=_0x49171b-0x0;var _0x48daab=_0xf494[_0x49171b];return _0x48daab;};'use strict';var _=require(_0x4f49('0x0'));var jayson=require(_0x4f49('0x1'));var db=require(_0x4f49('0x2'))['db'];var amiClient=jayson['client'][_0x4f49('0x3')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x4')][_0x4f49('0x3')]({'port':0x232c});function isAgentPaused(_0x25677c,_0x20c0d7){var _0x2a15fb=[_0x25677c[_0x4f49('0x5')],_0x25677c[_0x4f49('0x6')],_0x25677c[_0x4f49('0x7')],_0x25677c[_0x4f49('0x8')],_0x25677c[_0x4f49('0x9')],_0x25677c['voicePause'],_0x25677c['whatsappPause']];if(!_0x20c0d7)return _[_0x4f49('0xa')](_0x2a15fb);var _0x327bd5=_[_0x4f49('0xb')](_0x2a15fb);return _0x327bd5[_0x4f49('0xc')]>0x0&&_0x327bd5[_0x4f49('0xc')]<_0x2a15fb[_0x4f49('0xc')]?!![]:![];}function isIdle(_0x151d8c){return _0x151d8c===_0x4f49('0xd')||_0x151d8c==='unknown'||_0x151d8c===_0x4f49('0xe')||_0x151d8c===_0x4f49('0xf')||_['isNil'](_0x151d8c);}function isAgentIdle(_0x15e7a1){if(_0x15e7a1['voiceStatus']!=='idle'&&_0x15e7a1[_0x4f49('0x10')]){_0x15e7a1[_0x4f49('0x11')]='pause';return![];}return _[_0x4f49('0xa')]([_0x15e7a1[_0x4f49('0x12')],_0x15e7a1[_0x4f49('0x13')],_0x15e7a1[_0x4f49('0x14')],_0x15e7a1[_0x4f49('0x15')],_0x15e7a1[_0x4f49('0x16')],_0x15e7a1[_0x4f49('0x11')],_0x15e7a1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x4f49('0x17')](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x5878f4){if(_0x5878f4['error']){throw new Error(_0x4f49('0x1a'));}var _0x2ecaaa=_0x5878f4[_0x4f49('0x1b')];return routingClient['request'](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x4e85df){if(_0x4e85df['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x560592=_0x4e85df['result'];return _[_0x4f49('0x1c')]({},_0x2ecaaa,_0x560592);});})[_0x4f49('0x1d')](function(_0x1c2d70){throw _0x1c2d70;});}exports[_0x4f49('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5793ac){var _0x416893=_0x4f49('0x1f');if(isAgentPaused(_0x5793ac))_0x416893=_0x4f49('0x20');else if(isAgentPaused(_0x5793ac,!![]))_0x416893=_0x4f49('0x21');else if(isAgentIdle(_0x5793ac))_0x416893=_0x4f49('0xd');else _0x416893='busy';return _0x416893;}exports[_0x4f49('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x357446,_0x3ae590){var _0x53b57d=_[_0x4f49('0x23')](_0x357446)?_0x357446:[_0x357446];var _0x1d70a7=_[_0x4f49('0x24')](_0x3ae590)+_0x4f49('0x25');var _0x9d30aa=_[_0x4f49('0x26')](_0x53b57d,function(_0x559d98){return db[_0x1d70a7]['findOne']({'where':{'id':_0x559d98}})[_0x4f49('0x19')](function(_0x429de7){if(!_0x429de7)return[];return _0x429de7['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f49('0x27')](_0x9d30aa)[_0x4f49('0x19')](function(_0x35f8e0){var _0x525950=_(_0x35f8e0)[_0x4f49('0x28')]()[_0x4f49('0x26')]('id')[_0x4f49('0x29')]()[_0x4f49('0x2a')]();return _0x525950;});}exports[_0x4f49('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x122404,_0x4915af,_0x50c571){try{if(_0x4915af[_0x4f49('0xc')]>0x0){_0x122404=_0x122404[_0x4f49('0xb')](function(_0x605c91){return _0x4915af['includes'](_0x605c91['id']);});}var _0x3cbfbd=_0x122404[_0x4f49('0xb')](function(_0x43d8e3){var _0x506b20='busy';if(isAgentIdle(_0x43d8e3)){_0x506b20=_0x4f49('0xd');}return _0x506b20===_0x50c571;});return _[_0x4f49('0x26')](_0x3cbfbd,'id');}catch(_0x7a6ea0){throw _0x7a6ea0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1eaac6,_0x35aa33,_0x173657){return Promise[_0x4f49('0x2c')]()[_0x4f49('0x19')](function(){if(_0x35aa33[_0x4f49('0xc')]>0x0){_0x1eaac6=_0x1eaac6[_0x4f49('0xb')](function(_0x45ae19){return _0x35aa33[_0x4f49('0x2d')](_0x45ae19['id']);});}return _0x1eaac6;})[_0x4f49('0x19')](function(){return db[_0x4f49('0x2e')][_0x4f49('0x2f')]({'attributes':['id',_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'voicePause',_0x4f49('0x32'),_0x4f49('0x33')],'where':{'id':{'$in':_[_0x4f49('0x26')](_0x1eaac6,'id')}},'raw':!![]});})[_0x4f49('0x19')](function(_0x1c3af8){return _0x1c3af8[_0x4f49('0x26')](function(_0x2cbe4e){var _0x3ad6a7=_[_0x4f49('0x34')](_0x1eaac6,['id',_0x2cbe4e['id']]);var _0x338db8=filterAgentAttributes(_0x3ad6a7);_[_0x4f49('0x1c')](_0x2cbe4e,_0x338db8);_0x2cbe4e[_0x4f49('0x35')]=getAgentStatus(_0x2cbe4e);return _0x2cbe4e;});})[_0x4f49('0x19')](function(_0x4d2d57){var _0x371282=sortAgentsByStatus(_0x4d2d57,_0x173657);return _[_0x4f49('0x26')](_0x371282,'id');})[_0x4f49('0x1d')](function(_0x26014f){throw _0x26014f;});}exports[_0x4f49('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ee818){var _0xe1b662={'fields':[],'order':null};var _0x25fdf8=_0x3ee818[_0x4f49('0x37')](',');_0xe1b662[_0x4f49('0x38')]=_[_0x4f49('0xb')](_0x25fdf8,function(_0x141db){if(!_0x141db[_0x4f49('0x2d')](_0x4f49('0x35'))){return!![];}_0xe1b662['order']=_[_0x4f49('0x39')](_0x141db,'-')?_0x4f49('0x3a'):'ASC';return![];});return _0xe1b662;}exports[_0x4f49('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xbf05f3){if(!_0xbf05f3){_0xbf05f3='fullname,internal';}if(_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x31'))&&!_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x3c'))){var _0x3bfe7e=_0xbf05f3[_0x4f49('0x3d')](0x0,_0xbf05f3[_0x4f49('0x3e')]('fullname'));_0xbf05f3+=','+_0x3bfe7e+'internal';}return _0xbf05f3;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x15e4b3,_0x15b280){var _0x2e4355=_0x15e4b3[_0x4f49('0x3f')](function(_0x1053b2,_0x1ecf6c){if(_0x1053b2[_0x4f49('0x35')]===_0x1ecf6c[_0x4f49('0x35')]){if(_0x1053b2[_0x4f49('0x35')]==='pause'){if(_0x15b280==='DESC'){return(_0x1053b2[_0x4f49('0x33')]||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')]['toLowerCase']()>_0x1ecf6c[_0x4f49('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1053b2['pauseType']||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()>_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2['fullname'][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?-0x1:0x1;}}});return _0x2e4355;}exports[_0x4f49('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x356785){var _0x435192=[_0x4f49('0x42'),'online',_0x4f49('0x43'),_0x4f49('0x44'),'pauseType',_0x4f49('0x44'),'internal',_0x4f49('0x45'),_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),'smsPause',_0x4f49('0x32'),_0x4f49('0x6'),_0x4f49('0x10'),_0x4f49('0x46'),_0x4f49('0x47'),_0x4f49('0x48'),_0x4f49('0x49'),_0x4f49('0x4a'),_0x4f49('0x4b'),_0x4f49('0x4c'),_0x4f49('0x4d'),_0x4f49('0x4e'),_0x4f49('0x4f'),_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x12'),'openchannelStatus','mailStatus',_0x4f49('0x16'),_0x4f49('0x52'),_0x4f49('0x13'),_0x4f49('0x11'),_0x4f49('0x53'),_0x4f49('0x54'),_0x4f49('0x55'),'smsStatusTime',_0x4f49('0x56'),'faxStatusTime',_0x4f49('0x57'),_0x4f49('0x58'),_0x4f49('0x59'),_0x4f49('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0x4f49('0x5b'),'routealias'];var _0x52d18c=[_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),_0x4f49('0x9'),'whatsappPause','faxPause',_0x4f49('0x10'),_0x4f49('0x5c')];var _0x5cb187=_(_0x356785)[_0x4f49('0x5d')](_0x52d18c)['pick'](_0x435192)['value']();return _0x5cb187;}exports[_0x4f49('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x4f49('0x31'),'role',_0x4f49('0x3c'),_0x4f49('0x5c'),_0x4f49('0x35'),_0x4f49('0x42'),_0x4f49('0x43'),_0x4f49('0x33'),_0x4f49('0x44'),_0x4f49('0x6'),'chatPause',_0x4f49('0x7'),'openchannelPause',_0x4f49('0x9'),_0x4f49('0x10'),_0x4f49('0x32'),_0x4f49('0x12'),_0x4f49('0x13'),_0x4f49('0x14'),'openchannelStatus',_0x4f49('0x16'),_0x4f49('0x11'),'whatsappStatus','chatStatusTime',_0x4f49('0x5f'),_0x4f49('0x55'),_0x4f49('0x54'),_0x4f49('0x60'),_0x4f49('0x57'),'whatsappStatusTime',_0x4f49('0x46'),'faxCapacity',_0x4f49('0x48'),_0x4f49('0x47'),_0x4f49('0x49'),'whatsappCapacity',_0x4f49('0x4c'),_0x4f49('0x51'),_0x4f49('0x4e'),_0x4f49('0x4d'),'smsCurrentCapacity',_0x4f49('0x50'),_0x4f49('0x61'),'phoneBarEnableAutomaticScreenRecording',_0x4f49('0x59'),_0x4f49('0x62'),_0x4f49('0x58'),_0x4f49('0x63'),_0x4f49('0x5a')];}exports[_0x4f49('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index a52124b..44bd632 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc628=['ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','get','loggedInDb','voice','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc628,0x142));var _0x8c62=function(_0x3fad05,_0x5872a0){_0x3fad05=_0x3fad05-0x0;var _0xcfae80=_0xc628[_0x3fad05];return _0xcfae80;};'use strict';var _=require(_0x8c62('0x0'));var jayson=require(_0x8c62('0x1'));var util=require(_0x8c62('0x2'));var amiClient=jayson[_0x8c62('0x3')][_0x8c62('0x4')]({'port':0x232a});var routingClient=jayson[_0x8c62('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8c62('0x5'),_0x8c62('0x6'),_0x8c62('0x7'),_0x8c62('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x8c62('0x9'),_0x8c62('0xa'),_0x8c62('0xb'),'loggedInDb',_0x8c62('0xc'),_0x8c62('0xd'),_0x8c62('0xe'),_0x8c62('0xf'),_0x8c62('0x10'),'unavailable',_0x8c62('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8c62('0x12'),_0x8c62('0x13'),_0x8c62('0x14'),_0x8c62('0x15'),_0x8c62('0x16'),_0x8c62('0x17'),_0x8c62('0x18'),_0x8c62('0x19'),_0x8c62('0x1a'),'erlangCalls',_0x8c62('0x1b'),'erlangAbandonmentRate',_0x8c62('0x1c'),_0x8c62('0x1d'),_0x8c62('0x1e'),_0x8c62('0x1f'),_0x8c62('0x20'),_0x8c62('0x21'),_0x8c62('0x22'),'predictiveIntervalDroppedCallsTimeout',_0x8c62('0x23'),'predictiveIntervalAvgHoldtime',_0x8c62('0x24')];function getRealtimeQueues(_0x42f38e,_0x2db121){var _0xb0a8e0=_0x2db121==='voice'?amiClient:routingClient;return _0xb0a8e0[_0x8c62('0x25')](_[_0x8c62('0x26')](_0x2db121)+_0x8c62('0x27'),_0x42f38e)[_0x8c62('0x28')](function(_0x30fa47){if(_0x30fa47[_0x8c62('0x29')])throw new Error(util[_0x8c62('0x2a')](_0x8c62('0x2b'),_0x2db121));return _0x30fa47[_0x8c62('0x2c')];})['catch'](function(_0x471b4a){throw _0x471b4a;});}exports[_0x8c62('0x2d')]=getRealtimeQueues;function initializeQueues(_0x46e1dd,_0x19c729,_0x3f3220,_0x1695eb){var _0x4d1ff5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f3220==='voice'){if(_0x1695eb===_0x8c62('0x2e')){_0x4d1ff5=_0x4d1ff5[_0x8c62('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1695eb===_0x8c62('0x30')){_0x4d1ff5=_0x4d1ff5[_0x8c62('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x46e1dd['map'](function(_0x25950d){var _0x3eb130=_0x25950d[_0x8c62('0x31')]({'plain':!![]});_0x3eb130[_0x8c62('0x7')]=0x0;_0x3eb130[_0x8c62('0x32')]=0x0;_0x3eb130[_0x8c62('0x6')]=0x0;_0x3eb130[_0x8c62('0x5')]=0x0;_0x3eb130['waiting']=0x0;if(_0x3f3220===_0x8c62('0x33')){_0x3eb130[_0x8c62('0x10')]=0x0;_0x3eb130['busy']=0x0;if(_0x1695eb===_0x8c62('0x30')){_0x3eb130['pTalking']=0x0;_0x3eb130[_0x8c62('0x13')]=0x0;}}var _0x568639=_[_0x8c62('0x34')](_0x19c729,['id',_0x3eb130['id']]);if(_0x568639){_[_0x8c62('0x35')](_0x3eb130,_[_0x8c62('0x36')](_0x568639,_0x4d1ff5));}return _0x3eb130;});}exports[_0x8c62('0x37')]=initializeQueues; \ No newline at end of file +var _0xaecb=['map','find','merge','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unavailable','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound'];(function(_0x51c2a6,_0x3cbca9){var _0xddfb6e=function(_0x5738b5){while(--_0x5738b5){_0x51c2a6['push'](_0x51c2a6['shift']());}};_0xddfb6e(++_0x3cbca9);}(_0xaecb,0x1d0));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var jayson=require(_0xbaec('0x0'));var util=require(_0xbaec('0x1'));var amiClient=jayson[_0xbaec('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xbaec('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xbaec('0x4'),_0xbaec('0x5'),_0xbaec('0x6'),_0xbaec('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xbaec('0x8'),_0xbaec('0x9'),_0xbaec('0xa'),_0xbaec('0xb'),_0xbaec('0xc'),_0xbaec('0xd'),_0xbaec('0xe'),'ringInUse',_0xbaec('0xf'),_0xbaec('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xbaec('0x11'),_0xbaec('0x12'),'message',_0xbaec('0x13'),_0xbaec('0x14'),_0xbaec('0x15'),_0xbaec('0x16'),'startPredictive','startProgressive',_0xbaec('0x17'),'erlangCallToSecond',_0xbaec('0x18'),_0xbaec('0x19'),_0xbaec('0x1a'),_0xbaec('0x1b'),_0xbaec('0x1c'),_0xbaec('0x1d'),_0xbaec('0x1e'),_0xbaec('0x1f'),_0xbaec('0x20'),_0xbaec('0x21'),_0xbaec('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x9156d8,_0x45c87e){var _0x425ef5=_0x45c87e===_0xbaec('0x23')?amiClient:routingClient;return _0x425ef5['request'](_['startCase'](_0x45c87e)+_0xbaec('0x24'),_0x9156d8)[_0xbaec('0x25')](function(_0x38469e){if(_0x38469e['error'])throw new Error(util[_0xbaec('0x26')](_0xbaec('0x27'),_0x45c87e));return _0x38469e[_0xbaec('0x28')];})[_0xbaec('0x29')](function(_0x446809){throw _0x446809;});}exports[_0xbaec('0x2a')]=getRealtimeQueues;function initializeQueues(_0x26dc80,_0xaa3ec,_0x2abdd1,_0x2c1658){var _0x16cfc4=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2abdd1===_0xbaec('0x23')){if(_0x2c1658===_0xbaec('0x2b')){_0x16cfc4=_0x16cfc4[_0xbaec('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2c1658===_0xbaec('0x2d')){_0x16cfc4=_0x16cfc4[_0xbaec('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x26dc80[_0xbaec('0x2e')](function(_0x331e11){var _0x533a31=_0x331e11['get']({'plain':!![]});_0x533a31[_0xbaec('0x6')]=0x0;_0x533a31[_0xbaec('0xb')]=0x0;_0x533a31['loggedIn']=0x0;_0x533a31[_0xbaec('0x4')]=0x0;_0x533a31['waiting']=0x0;if(_0x2abdd1==='voice'){_0x533a31[_0xbaec('0xf')]=0x0;_0x533a31['busy']=0x0;if(_0x2c1658==='outbound'){_0x533a31[_0xbaec('0x11')]=0x0;_0x533a31[_0xbaec('0x12')]=0x0;}}var _0x42f35c=_[_0xbaec('0x2f')](_0xaa3ec,['id',_0x533a31['id']]);if(_0x42f35c){_[_0xbaec('0x30')](_0x533a31,_[_0xbaec('0x31')](_0x42f35c,_0x16cfc4));}return _0x533a31;});}exports[_0xbaec('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b6d2cc4..e10af5b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x119e6a,_0x12172a){var _0x1ec5d7=function(_0x2f6e9a){while(--_0x2f6e9a){_0x119e6a['push'](_0x119e6a['shift']());}};_0x1ec5d7(++_0x12172a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 038334f..f2fe4ab 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 _0x8d9b=['substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','length','filter','family','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','createHash','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex'];(function(_0x13857c,_0x57c3c9){var _0xe73673=function(_0x2970e2){while(--_0x2970e2){_0x13857c['push'](_0x13857c['shift']());}};_0xe73673(++_0x57c3c9);}(_0x8d9b,0x1a5));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var os=require('os');var crypto=require(_0xb8d9('0x1'));var machine=require(_0xb8d9('0x2'));var exec=require('child_process')[_0xb8d9('0x3')];var config=require(_0xb8d9('0x4'));function getInterfaces(){var _0x40865d=[];var _0x26a4ab=os[_0xb8d9('0x5')]();var _0x113134=_['orderBy'](_[_0xb8d9('0x6')](_0x26a4ab));for(var _0x35302f=0x0;_0x35302f<_0x113134[_0xb8d9('0x7')];_0x35302f++){var _0x6046a9=_0x26a4ab[_0x113134[_0x35302f]][_0xb8d9('0x8')](function(_0x3ce29b){return _0x3ce29b[_0xb8d9('0x9')]==='IPv4'&&_0x3ce29b['internal']===![];});_0x40865d=_0x40865d[_0xb8d9('0xa')](_0x6046a9);}return _0x40865d;}function getFirstInterface(){var _0x31b7b9=_['head'](getInterfaces());return{'macAddress':_0x31b7b9&&_0x31b7b9[_0xb8d9('0xb')]?_0x31b7b9['mac']:_0xb8d9('0xc'),'ipAddress':_0x31b7b9&&_0x31b7b9[_0xb8d9('0xd')]?_0x31b7b9[_0xb8d9('0xd')]:_0xb8d9('0xe')};}exports[_0xb8d9('0xf')]=getFirstInterface;function getCPUhash(){var _0x278fe1=_[_0xb8d9('0x10')](os[_0xb8d9('0x11')]()[_0xb8d9('0x12')](function(_0xfc9c56){return _0xfc9c56['model'];}))['join'](':');return crypto[_0xb8d9('0x13')]('md5')[_0xb8d9('0x14')](_0x278fe1)[_0xb8d9('0x15')]('hex');}exports[_0xb8d9('0x16')]=function(){var _0x35ef5f=os[_0xb8d9('0x17')]();var _0x2201ff=/[0-9a-f-]{36}/;if(config[_0xb8d9('0x18')]&&_0x2201ff[_0xb8d9('0x19')](config[_0xb8d9('0x18')])){return config['licenseToken'];}else if(_0x35ef5f===_0xb8d9('0x1a')){return exec(_0xb8d9('0x1b'),{'encoding':_0xb8d9('0x1c')})[_0xb8d9('0x1d')]('\x0d\x0a','');}else{var _0x40f1e5=getFirstInterface();var _0x25d203=getCPUhash();var _0x11a3ff=_0x25d203+'|'+os[_0xb8d9('0x1e')]()+'|'+_0x40f1e5[_0xb8d9('0x1f')]+'|'+_0x40f1e5[_0xb8d9('0x20')];var _0x313e79=crypto[_0xb8d9('0x13')]('md5')[_0xb8d9('0x14')](_0x11a3ff)['digest'](_0xb8d9('0x21'));return _0x313e79['substring'](0x0,0x8)+'-'+_0x313e79[_0xb8d9('0x22')](0x8,0xc)+'-'+_0x313e79[_0xb8d9('0x22')](0xc,0x10)+'-'+_0x313e79[_0xb8d9('0x22')](0x10,0x14)+'-'+_0x313e79['substring'](0x14);}}; \ No newline at end of file +var _0xd69c=['keys','length','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','update','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy'];(function(_0x293d81,_0x49fde4){var _0x450e85=function(_0x5241c6){while(--_0x5241c6){_0x293d81['push'](_0x293d81['shift']());}};_0x450e85(++_0x49fde4);}(_0xd69c,0x14f));var _0xcd69=function(_0x5171c5,_0x3f93dd){_0x5171c5=_0x5171c5-0x0;var _0x42affa=_0xd69c[_0x5171c5];return _0x42affa;};'use strict';var _=require(_0xcd69('0x0'));var os=require('os');var crypto=require(_0xcd69('0x1'));var machine=require(_0xcd69('0x2'));var exec=require(_0xcd69('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x1f6fa9=[];var _0xa3b499=os[_0xcd69('0x4')]();var _0x574a96=_[_0xcd69('0x5')](_[_0xcd69('0x6')](_0xa3b499));for(var _0x28b6c0=0x0;_0x28b6c0<_0x574a96[_0xcd69('0x7')];_0x28b6c0++){var _0x3590bf=_0xa3b499[_0x574a96[_0x28b6c0]]['filter'](function(_0x5483dc){return _0x5483dc[_0xcd69('0x8')]===_0xcd69('0x9')&&_0x5483dc[_0xcd69('0xa')]===![];});_0x1f6fa9=_0x1f6fa9[_0xcd69('0xb')](_0x3590bf);}return _0x1f6fa9;}function getFirstInterface(){var _0x25734a=_['head'](getInterfaces());return{'macAddress':_0x25734a&&_0x25734a[_0xcd69('0xc')]?_0x25734a[_0xcd69('0xc')]:_0xcd69('0xd'),'ipAddress':_0x25734a&&_0x25734a[_0xcd69('0xe')]?_0x25734a[_0xcd69('0xe')]:_0xcd69('0xf')};}exports[_0xcd69('0x10')]=getFirstInterface;function getCPUhash(){var _0x3af961=_[_0xcd69('0x5')](os[_0xcd69('0x11')]()['map'](function(_0x333c11){return _0x333c11[_0xcd69('0x12')];}))['join'](':');return crypto[_0xcd69('0x13')]('md5')[_0xcd69('0x14')](_0x3af961)[_0xcd69('0x15')](_0xcd69('0x16'));}exports[_0xcd69('0x17')]=function(){var _0x3380b6=os['platform']();var _0x209067=/[0-9a-f-]{36}/;if(config[_0xcd69('0x18')]&&_0x209067[_0xcd69('0x19')](config[_0xcd69('0x18')])){return config[_0xcd69('0x18')];}else if(_0x3380b6==='win32'){return exec(_0xcd69('0x1a'),{'encoding':_0xcd69('0x1b')})['replace']('\x0d\x0a','');}else{var _0x46e41b=getFirstInterface();var _0x40b4db=getCPUhash();var _0x417afc=_0x40b4db+'|'+os['hostname']()+'|'+_0x46e41b[_0xcd69('0x1c')]+'|'+_0x46e41b[_0xcd69('0x1d')];var _0x267c53=crypto['createHash']('md5')[_0xcd69('0x14')](_0x417afc)['digest']('hex');return _0x267c53[_0xcd69('0x1e')](0x0,0x8)+'-'+_0x267c53[_0xcd69('0x1e')](0x8,0xc)+'-'+_0x267c53[_0xcd69('0x1e')](0xc,0x10)+'-'+_0x267c53[_0xcd69('0x1e')](0x10,0x14)+'-'+_0x267c53[_0xcd69('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2d1eb02..af876cf 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 _0x76f6=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','then','error','finally','getUuid','License','spread','message','default','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0xa8e868,_0x3ce2b7){var _0x163f5a=function(_0x33e8b8){while(--_0x33e8b8){_0xa8e868['push'](_0xa8e868['shift']());}};_0x163f5a(++_0x3ce2b7);}(_0x76f6,0x1e4));var _0x676f=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x76f6[_0x4e9d3c];return _0x2d0825;};'use strict';var util=require('util');var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x676f('0x0'));var pkginfo=require(_0x676f('0x1'))(module,'version');var db=require(_0x676f('0x2'))['db'];var encryptor=require(_0x676f('0x3'));var hardware=require(_0x676f('0x4'));var logger=require(_0x676f('0x5'))(_0x676f('0x6'));var HOST=_0x676f('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x133d18){return new BPromise(function(_0x12ab85,_0x3fac63){var _0x475f72=util[_0x676f('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x133d18,module[_0x676f('0x9')][_0x676f('0xa')]);if(oldToken){_0x475f72=util['format'](_0x676f('0xb'),HOST,_0x133d18,module[_0x676f('0x9')][_0x676f('0xa')],oldToken);}var _0x384be4={'uri':_0x475f72,'method':_0x676f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x384be4)['then'](function(_0x4186f9){_0x12ab85(_0x4186f9);})[_0x676f('0xd')](function(_0x34e411){_0x3fac63(_0x34e411);});});}function manageLicense(_0x2632a6,_0x123158){var _0x112176=_0x123158[_0x676f('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x112176[_0x676f('0xf')]!==_0x2632a6&&!_0x112176[_0x676f('0x10')]){oldToken=_0x112176[_0x676f('0xf')];}httpRequest(_0x2632a6)['then'](function(_0x6fed14){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6fed14[_0x676f('0x11')]){isOldTokenSent=![];if(!_0x112176[_0x676f('0x6')]&&_0x112176[_0x676f('0x6')]!=_0x6fed14[_0x676f('0x6')]||_0x112176[_0x676f('0x6')]&&_0x112176[_0x676f('0x10')]){logger[_0x676f('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x112176[_0x676f('0x6')]&&!_0x112176[_0x676f('0x10')]&&_0x112176[_0x676f('0x6')]!=_0x6fed14[_0x676f('0x6')]){logger[_0x676f('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x112176[_0x676f('0x6')]&&!_0x112176[_0x676f('0x10')]&&_0x112176[_0x676f('0x6')]==_0x6fed14[_0x676f('0x6')]){return _0x123158;}return _0x123158[_0x676f('0x13')]({'data1':_0x2632a6,'data2':null,'license':_0x6fed14[_0x676f('0x6')]});}else{if(_0x6fed14[_0x676f('0x6')]||_0x112176[_0x676f('0x6')]){if(!_0x112176[_0x676f('0x10')]){if(_0x112176[_0x676f('0xf')]==_0x2632a6){GRAY_PERIOD_REASON=_0x676f('0x14');logger[_0x676f('0x12')](_0x676f('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x676f('0x12')](_0x676f('0x16'),_0x112176[_0x676f('0xf')],_0x2632a6);}logger[_0x676f('0x12')](_0x676f('0x17'),GRAY_PERIOD_REASON[_0x676f('0x18')](),moment()[_0x676f('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x123158['update']({'data2':encryptor[_0x676f('0x19')](moment()[_0x676f('0x8')](_0x676f('0x1a')))});}else{if(moment()[_0x676f('0x1b')](encryptor[_0x676f('0x1c')](_0x112176['data2']),_0x676f('0x1d'))>DAYS){logger[_0x676f('0x12')](_0x676f('0x1e'),moment()[_0x676f('0x8')](_0x676f('0x1a')));isOldTokenSent=![];return _0x123158['update']({'data1':_0x2632a6,'data2':null,'license':null});}}}else{if(_0x112176['data1']!=_0x2632a6){logger[_0x676f('0x12')](_0x676f('0x16'),_0x112176[_0x676f('0xf')],_0x2632a6);return _0x123158[_0x676f('0x13')]({'data1':_0x2632a6,'data2':null,'license':null});}}}return _0x123158;})[_0x676f('0x1f')](function(_0xf3bf7c){_0x123158=_0xf3bf7c;})[_0x676f('0xd')](function(_0x323c8c){logger[_0x676f('0x20')](_0x323c8c['message']);})[_0x676f('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x676f('0x22')](),_0x123158);},TIME);});}function defaultLicense(){var _0x4df0dd=hardware[_0x676f('0x22')]();if(_0x4df0dd){return db[_0x676f('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4df0dd}})[_0x676f('0x24')](function(_0x69b20,_0x4f352d){logger[_0x676f('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4df0dd);manageLicense(_0x4df0dd,_0x69b20);})[_0x676f('0xd')](function(_0x1923b7){logger[_0x676f('0x20')](_0x1923b7[_0x676f('0x25')]);});}}exports[_0x676f('0x26')]=defaultLicense; \ No newline at end of file +var _0x7df8=['get','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','data1','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch'];(function(_0x9961ba,_0x4c05ad){var _0x37cc24=function(_0x18e11d){while(--_0x18e11d){_0x9961ba['push'](_0x9961ba['shift']());}};_0x37cc24(++_0x4c05ad);}(_0x7df8,0xae));var _0x87df=function(_0x1d3acf,_0x4d73b4){_0x1d3acf=_0x1d3acf-0x0;var _0x429a35=_0x7df8[_0x1d3acf];return _0x429a35;};'use strict';var util=require(_0x87df('0x0'));var moment=require(_0x87df('0x1'));var rp=require(_0x87df('0x2'));var BPromise=require(_0x87df('0x3'));var pkginfo=require(_0x87df('0x4'))(module,_0x87df('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x87df('0x6'));var hardware=require(_0x87df('0x7'));var logger=require('../logger')('license');var HOST=_0x87df('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4a7ea7){return new BPromise(function(_0x3b4367,_0x3a9b2d){var _0x21fa49=util['format'](_0x87df('0x9'),HOST,_0x4a7ea7,module[_0x87df('0xa')][_0x87df('0x5')]);if(oldToken){_0x21fa49=util[_0x87df('0xb')](_0x87df('0xc'),HOST,_0x4a7ea7,module[_0x87df('0xa')]['version'],oldToken);}var _0x173271={'uri':_0x21fa49,'method':_0x87df('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x173271)[_0x87df('0xe')](function(_0x159445){_0x3b4367(_0x159445);})[_0x87df('0xf')](function(_0x50948f){_0x3a9b2d(_0x50948f);});});}function manageLicense(_0x4605bf,_0x2b2bfa){var _0x3a8be6=_0x2b2bfa[_0x87df('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3a8be6['data1']!==_0x4605bf&&!_0x3a8be6[_0x87df('0x11')]){oldToken=_0x3a8be6['data1'];}httpRequest(_0x4605bf)['then'](function(_0x617a1e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x617a1e[_0x87df('0x12')]){isOldTokenSent=![];if(!_0x3a8be6[_0x87df('0x13')]&&_0x3a8be6[_0x87df('0x13')]!=_0x617a1e[_0x87df('0x13')]||_0x3a8be6[_0x87df('0x13')]&&_0x3a8be6['data2']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3a8be6[_0x87df('0x13')]&&!_0x3a8be6[_0x87df('0x11')]&&_0x3a8be6[_0x87df('0x13')]!=_0x617a1e[_0x87df('0x13')]){logger['info'](_0x87df('0x14'));}if(_0x3a8be6[_0x87df('0x13')]&&!_0x3a8be6[_0x87df('0x11')]&&_0x3a8be6['license']==_0x617a1e[_0x87df('0x13')]){return _0x2b2bfa;}return _0x2b2bfa[_0x87df('0x15')]({'data1':_0x4605bf,'data2':null,'license':_0x617a1e[_0x87df('0x13')]});}else{if(_0x617a1e[_0x87df('0x13')]||_0x3a8be6[_0x87df('0x13')]){if(!_0x3a8be6[_0x87df('0x11')]){if(_0x3a8be6['data1']==_0x4605bf){GRAY_PERIOD_REASON=_0x87df('0x16');logger[_0x87df('0x17')](_0x87df('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x87df('0x17')](_0x87df('0x19'),_0x3a8be6['data1'],_0x4605bf);}logger[_0x87df('0x17')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x87df('0xb')](_0x87df('0x1a')));return _0x2b2bfa[_0x87df('0x15')]({'data2':encryptor[_0x87df('0x1b')](moment()[_0x87df('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x87df('0x1c')](encryptor['decryptString'](_0x3a8be6['data2']),_0x87df('0x1d'))>DAYS){logger[_0x87df('0x17')](_0x87df('0x1e'),moment()[_0x87df('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2b2bfa[_0x87df('0x15')]({'data1':_0x4605bf,'data2':null,'license':null});}}}else{if(_0x3a8be6[_0x87df('0x1f')]!=_0x4605bf){logger[_0x87df('0x17')](_0x87df('0x19'),_0x3a8be6['data1'],_0x4605bf);return _0x2b2bfa[_0x87df('0x15')]({'data1':_0x4605bf,'data2':null,'license':null});}}}return _0x2b2bfa;})[_0x87df('0xe')](function(_0x5cb4b1){_0x2b2bfa=_0x5cb4b1;})['catch'](function(_0x23e864){logger['error'](_0x23e864[_0x87df('0x20')]);})[_0x87df('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2b2bfa);},TIME);});}function defaultLicense(){var _0x251538=hardware['getUuid']();if(_0x251538){return db[_0x87df('0x22')][_0x87df('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x251538}})[_0x87df('0x24')](function(_0x686e00,_0x4cdf4e){logger[_0x87df('0x17')](_0x87df('0x25'),_0x251538);manageLicense(_0x251538,_0x686e00);})[_0x87df('0xf')](function(_0x30460a){logger['error'](_0x30460a[_0x87df('0x20')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9d11df9..5f1ac34 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 _0xfe4e=['License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','data1','license','isEmpty','split','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','gray','format','grayReason','changed','message','User','findAll','role','COUNT','sequelize','col','count','admin','user','users','telephones','forEach','catch','countBy','telephone'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfe4e,0x1f1));var _0xefe4=function(_0x2de630,_0x534adc){_0x2de630=_0x2de630-0x0;var _0x35259e=_0xfe4e[_0x2de630];return _0x35259e;};'use strict';var util=require(_0xefe4('0x0'));var _=require(_0xefe4('0x1'));var moment=require('moment');var BPromise=require(_0xefe4('0x2'));var hardware=require(_0xefe4('0x3'));var encryptor=require(_0xefe4('0x4'));var db=require(_0xefe4('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xefe4('0x6'),'machineUuid':hardware[_0xefe4('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xefe4('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xefe4('0x9'),'machineUuid':hardware[_0xefe4('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x598fe7){return new BPromise(function(_0x1bc24f,_0x5add79){return db[_0xefe4('0xa')][_0xefe4('0xb')](_['defaults'](_0x598fe7,{'raw':!![],'where':{'id':0x1}}))[_0xefe4('0xc')](function(_0x5a82d2){return checkLicense(_0x5a82d2,null);})['then'](function(_0x39692c){_0x1bc24f(_0x39692c);return;})['catch'](function(_0x6415d7){_0x5add79(_0x6415d7);});});}function checkLicense(_0x3d0341,_0x288e2c){if(!_0x3d0341){demoLicense['uuid']=_0x3d0341[_0xefe4('0xd')];return demoLicense;}try{var _0x5892db=_0x288e2c||_0x3d0341[_0xefe4('0xe')];if(_[_0xefe4('0xf')](_0x5892db)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x26aa90=_0x3d0341['data1'];var _0x4bdd22=_0x3d0341['data2'];var _0x77882=_0x26aa90[_0xefe4('0x10')]('-')[0x4];var _0xe97bca=_0x26aa90[_0xefe4('0x10')]('-')[0x0];var _0x2eb4cd=encryptor['decryptString'](_0x5892db,util['format'](_0xefe4('0x11'),_0x77882,_0x26aa90,_0xe97bca));var _0x5d9a83=JSON[_0xefe4('0x12')](_0x2eb4cd);_0x5d9a83[_0xefe4('0x13')]=![];_0x5d9a83[_0xefe4('0x14')]=_0x26aa90;_0x5d9a83[_0xefe4('0x15')]=hardware[_0xefe4('0x7')]();if(_0x4bdd22){var _0x5db1bf=encryptor[_0xefe4('0x16')](_0x4bdd22);_0x5d9a83[_0xefe4('0x17')]=_0x5db1bf;_0x5d9a83['deadline']=moment(_0x5db1bf)['add'](0x7,'days')[_0xefe4('0x18')]();_0x5d9a83[_0xefe4('0x19')]=_0x5d9a83['uuid']!=_0x5d9a83[_0xefe4('0x15')]?_0xefe4('0x1a'):'disabled';}return _0x5d9a83;}catch(_0x3a3b56){breakingLicense[_0xefe4('0x14')]=_0x3d0341[_0xefe4('0xd')];breakingLicense[_0xefe4('0x1b')]=_0x3a3b56['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x577f74,_0x7ebd1e){getLicense()[_0xefe4('0xc')](function(_0x5e3874){return db[_0xefe4('0x1c')][_0xefe4('0x1d')]({'attributes':[_0xefe4('0x1e'),[db['sequelize']['fn'](_0xefe4('0x1f'),db[_0xefe4('0x20')][_0xefe4('0x21')](_0xefe4('0x1e'))),_0xefe4('0x22')]],'group':_0xefe4('0x1e'),'where':{'role':{'$or':[_0xefe4('0x23'),_0xefe4('0x24'),'telephone']}},'raw':!![]})['then'](function(_0x3b176b){var _0x578ddb={'user':_0x5e3874[_0xefe4('0x25')]||0x0,'telephone':_0x5e3874[_0xefe4('0x26')]||0x0};_0x3b176b[_0xefe4('0x27')](function(_0x34458a){var _0x18ef47=_0x34458a[_0xefe4('0x1e')]===_0xefe4('0x23')?_0xefe4('0x24'):_0x34458a[_0xefe4('0x1e')];_0x578ddb[_0x18ef47]-=_0x34458a[_0xefe4('0x22')];if(_0x578ddb[_0x18ef47]<0x0)_0x578ddb[_0x18ef47]=0x0;});_0x577f74(_0x578ddb);return;});})[_0xefe4('0x28')](function(_0x11727c){_0x7ebd1e(_0x11727c);});});}function checkUserLimits(_0x104407){return new BPromise(function(_0x416684,_0x349650){getLimits()[_0xefe4('0xc')](function(_0x13bde6){var _0x4b2e7e=_['pick'](_[_0xefe4('0x29')](_0x104407,'role'),[_0xefe4('0x23'),_0xefe4('0x24'),_0xefe4('0x2a')]);var _0x53b5c6=(_0x4b2e7e[_0xefe4('0x23')]||0x0)+(_0x4b2e7e['user']||0x0);var _0x1e224f=_0x4b2e7e['telephone']||0x0;if(_0x53b5c6>_0x13bde6['user'])return _0x349650(_0xefe4('0x2b'));if(_0x1e224f>_0x13bde6[_0xefe4('0x2a')])return _0x349650('License\x20limit\x20reached\x20for\x20telephones');return _0x416684();})['catch'](function(_0x45eb34){_0x349650(_0x45eb34);});});}module[_0xefe4('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x64dc=['telephones','user','count','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','machineUuid','gray','days','format','grayReason','message','role','sequelize','COUNT','col','admin','telephone'];(function(_0x225229,_0x16a5e5){var _0x4398ed=function(_0x1e9cd7){while(--_0x1e9cd7){_0x225229['push'](_0x225229['shift']());}};_0x4398ed(++_0x16a5e5);}(_0x64dc,0x1ca));var _0xc64d=function(_0x46f386,_0x4b5e81){_0x46f386=_0x46f386-0x0;var _0x108742=_0x64dc[_0x46f386];return _0x108742;};'use strict';var util=require(_0xc64d('0x0'));var _=require(_0xc64d('0x1'));var moment=require(_0xc64d('0x2'));var BPromise=require('bluebird');var hardware=require(_0xc64d('0x3'));var encryptor=require(_0xc64d('0x4'));var db=require(_0xc64d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc64d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc64d('0x7'),'machineUuid':hardware[_0xc64d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc64d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc64d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4d4e6e){return new BPromise(function(_0x555c64,_0x670327){return db[_0xc64d('0x9')][_0xc64d('0xa')](_[_0xc64d('0xb')](_0x4d4e6e,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x361532){return checkLicense(_0x361532,null);})[_0xc64d('0xc')](function(_0x4387e2){_0x555c64(_0x4387e2);return;})[_0xc64d('0xd')](function(_0x4974fa){_0x670327(_0x4974fa);});});}function checkLicense(_0x221624,_0x295994){if(!_0x221624){demoLicense[_0xc64d('0xe')]=_0x221624[_0xc64d('0xf')];return demoLicense;}try{var _0x450573=_0x295994||_0x221624[_0xc64d('0x10')];if(_['isEmpty'](_0x450573)){throw new Error(_0xc64d('0x11'));}var _0x258e36=_0x221624[_0xc64d('0xf')];var _0x13c794=_0x221624[_0xc64d('0x12')];var _0x13cbc8=_0x258e36[_0xc64d('0x13')]('-')[0x4];var _0x13cbfe=_0x258e36[_0xc64d('0x13')]('-')[0x0];var _0x274543=encryptor[_0xc64d('0x14')](_0x450573,util['format'](_0xc64d('0x15'),_0x13cbc8,_0x258e36,_0x13cbfe));var _0xef2ac2=JSON['parse'](_0x274543);_0xef2ac2['demo']=![];_0xef2ac2[_0xc64d('0xe')]=_0x258e36;_0xef2ac2[_0xc64d('0x16')]=hardware[_0xc64d('0x8')]();if(_0x13c794){var _0x3cb477=encryptor[_0xc64d('0x14')](_0x13c794);_0xef2ac2[_0xc64d('0x17')]=_0x3cb477;_0xef2ac2['deadline']=moment(_0x3cb477)['add'](0x7,_0xc64d('0x18'))[_0xc64d('0x19')]();_0xef2ac2[_0xc64d('0x1a')]=_0xef2ac2[_0xc64d('0xe')]!=_0xef2ac2[_0xc64d('0x16')]?'changed':'disabled';}return _0xef2ac2;}catch(_0x216446){breakingLicense[_0xc64d('0xe')]=_0x221624[_0xc64d('0xf')];breakingLicense[_0xc64d('0x1b')]=_0x216446['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x535cac,_0x479834){getLicense()[_0xc64d('0xc')](function(_0x276609){return db['User']['findAll']({'attributes':[_0xc64d('0x1c'),[db[_0xc64d('0x1d')]['fn'](_0xc64d('0x1e'),db[_0xc64d('0x1d')][_0xc64d('0x1f')](_0xc64d('0x1c'))),'count']],'group':_0xc64d('0x1c'),'where':{'role':{'$or':[_0xc64d('0x20'),'user',_0xc64d('0x21')]}},'raw':!![]})[_0xc64d('0xc')](function(_0x41004d){var _0x39169c={'user':_0x276609['users']||0x0,'telephone':_0x276609[_0xc64d('0x22')]||0x0};_0x41004d['forEach'](function(_0x43454a){var _0x2a5a17=_0x43454a[_0xc64d('0x1c')]===_0xc64d('0x20')?_0xc64d('0x23'):_0x43454a[_0xc64d('0x1c')];_0x39169c[_0x2a5a17]-=_0x43454a[_0xc64d('0x24')];if(_0x39169c[_0x2a5a17]<0x0)_0x39169c[_0x2a5a17]=0x0;});_0x535cac(_0x39169c);return;});})[_0xc64d('0xd')](function(_0x2a3547){_0x479834(_0x2a3547);});});}function checkUserLimits(_0x25876e){return new BPromise(function(_0x352532,_0x39f584){getLimits()[_0xc64d('0xc')](function(_0x3591a9){var _0x213cb8=_[_0xc64d('0x25')](_['countBy'](_0x25876e,_0xc64d('0x1c')),['admin','user',_0xc64d('0x21')]);var _0x45c74d=(_0x213cb8[_0xc64d('0x20')]||0x0)+(_0x213cb8[_0xc64d('0x23')]||0x0);var _0x3875d2=_0x213cb8[_0xc64d('0x21')]||0x0;if(_0x45c74d>_0x3591a9[_0xc64d('0x23')])return _0x39f584(_0xc64d('0x26'));if(_0x3875d2>_0x3591a9[_0xc64d('0x21')])return _0x39f584(_0xc64d('0x27'));return _0x352532();})['catch'](function(_0x3b8f6e){_0x39f584(_0x3b8f6e);});});}module[_0xc64d('0x28')]={'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 2d71caa..eb1bc8b 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 _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x28f2,0x193));var _0x228f=function(_0x2bbcc1,_0x35d2cb){_0x2bbcc1=_0x2bbcc1-0x0;var _0x267000=_0x28f2[_0x2bbcc1];return _0x267000;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x4024=['secret','exports','http://localhost:9000','app-id'];(function(_0x1fc21f,_0xf5876b){var _0x419689=function(_0x32f70f){while(--_0x32f70f){_0x1fc21f['push'](_0x1fc21f['shift']());}};_0x419689(++_0xf5876b);}(_0x4024,0x89));var _0x4402=function(_0x51d459,_0x487dbd){_0x51d459=_0x51d459-0x0;var _0x237d10=_0x4024[_0x51d459];return _0x237d10;};'use strict';module[_0x4402('0x0')]={'DOMAIN':_0x4402('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4402('0x2'),'GOOGLE_SECRET':_0x4402('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6fc962c..45685ee 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4735=['exports','../utils/loggers'];(function(_0x217fbb,_0x33b47a){var _0x361a6a=function(_0x4deefd){while(--_0x4deefd){_0x217fbb['push'](_0x217fbb['shift']());}};_0x361a6a(++_0x33b47a);}(_0x4735,0x77));var _0x5473=function(_0xa8c9e7,_0x3cf369){_0xa8c9e7=_0xa8c9e7-0x0;var _0x1fca76=_0x4735[_0xa8c9e7];return _0x1fca76;};'use strict';var fileLogger=require(_0x5473('0x0'))['fileLogger'];module[_0x5473('0x1')]=fileLogger; \ No newline at end of file +var _0xb521=['exports','../utils/loggers','fileLogger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb521,0x1a8));var _0x1b52=function(_0x58a058,_0x5965eb){_0x58a058=_0x58a058-0x0;var _0x347664=_0xb521[_0x58a058];return _0x347664;};'use strict';var fileLogger=require(_0x1b52('0x0'))[_0x1b52('0x1')];module[_0x1b52('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5feb69a..45b48d4 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 _0x4c76=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x4c76,0xe4));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x64c7('0x0'));var cfg=require(_0x64c7('0x1'));var env={'NODE_PATH':path[_0x64c7('0x2')](path[_0x64c7('0x3')](cfg[_0x64c7('0x4')],_0x64c7('0x5')))};var pm2config={'apps':[{'name':_0x64c7('0x6'),'script':path[_0x64c7('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x64c7('0x7'),'script':path[_0x64c7('0x3')](__dirname,_0x64c7('0x8')),'env':env},{'name':_0x64c7('0x9'),'script':path[_0x64c7('0x3')](__dirname,_0x64c7('0xa')),'env':env},{'name':'email','script':path['join'](__dirname,_0x64c7('0xb')),'env':env},{'name':'routing','script':path[_0x64c7('0x3')](__dirname,_0x64c7('0xc')),'env':env},{'name':_0x64c7('0xd'),'script':path[_0x64c7('0x3')](__dirname,_0x64c7('0xe')),'env':env}]};module[_0x64c7('0xf')]=pm2config; \ No newline at end of file +var _0xded0=['email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','legacy-libs','express','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0xded0,0x1f4));var _0x0ded=function(_0x850833,_0x60e137){_0x850833=_0x850833-0x0;var _0x5e1c4f=_0xded0[_0x850833];return _0x5e1c4f;};'use strict';var path=require(_0x0ded('0x0'));var cfg=require(_0x0ded('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x0ded('0x2')](cfg['root'],_0x0ded('0x3')))};var pm2config={'apps':[{'name':_0x0ded('0x4'),'script':path[_0x0ded('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x0ded('0x2')](__dirname,_0x0ded('0x5')),'env':env},{'name':'agi','script':path['join'](__dirname,_0x0ded('0x6')),'env':env},{'name':_0x0ded('0x7'),'script':path['join'](__dirname,_0x0ded('0x8')),'env':env},{'name':_0x0ded('0x9'),'script':path[_0x0ded('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x0ded('0xa'),'script':path[_0x0ded('0x2')](__dirname,_0x0ded('0xb')),'env':env}]};module[_0x0ded('0xc')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8e7d4aa..d502d8c 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 _0x9e69=['connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x9e69,0xce));var _0x99e6=function(_0xd2408a,_0x47983c){_0xd2408a=_0xd2408a-0x0;var _0x321c13=_0x9e69[_0xd2408a];return _0x321c13;};'use strict';var pm2=require(_0x99e6('0x0'));var BPromise=require(_0x99e6('0x1'));var config=require(_0x99e6('0x2'));function connect(){return new BPromise(function(_0x16db23,_0x2ddca0){return pm2[_0x99e6('0x3')](function(_0xd5b701){if(_0xd5b701){return _0x2ddca0(_0xd5b701);}return _0x16db23(_0x99e6('0x4'));});});};exports[_0x99e6('0x5')]=function(_0x455e4d){return connect()['then'](function(){return new BPromise(function(_0x2121f7,_0x3fc545){return pm2[_0x99e6('0x5')](_0x455e4d,function(_0x462e54,_0xd526b8){if(_0x462e54){return _0x3fc545(_0x462e54);}pm2['disconnect']();return _0x2121f7(_0xd526b8);});});});};exports['stop']=function(_0x2f2dc7){return connect()[_0x99e6('0x6')](function(){return new BPromise(function(_0x2008ea,_0x513d28){return pm2[_0x99e6('0x7')](_0x2f2dc7,function(_0x3d9b94,_0x10c496){if(_0x3d9b94){return _0x513d28(_0x3d9b94);}pm2[_0x99e6('0x8')]();return _0x2008ea(_0x10c496);});});});};exports['restart']=function(_0x4dc437){return connect()['then'](function(){return new BPromise(function(_0x19bfc6,_0x14c636){return pm2[_0x99e6('0x9')](_0x4dc437,function(_0x48fae4,_0x17b09d){if(_0x48fae4){return _0x14c636(_0x48fae4);}pm2[_0x99e6('0x8')]();return _0x19bfc6(_0x17b09d);});});});};exports[_0x99e6('0xa')]=function(){return connect()[_0x99e6('0x6')](function(){return new BPromise(function(_0x4dd793,_0x4af5d6){return pm2[_0x99e6('0xa')](function(_0x205ccd,_0x3f30e3){if(_0x205ccd){return _0x4af5d6(_0x205ccd);}pm2['disconnect']();return _0x4dd793(_0x3f30e3);});});});};exports[_0x99e6('0xb')]=function(_0x1e824b){return connect()[_0x99e6('0x6')](function(){return new BPromise(function(_0xa083cd,_0x3fd07b){return pm2[_0x99e6('0xb')](_0x1e824b,function(_0x429573,_0x42cf06){if(_0x429573){return _0x3fd07b(_0x429573);}pm2[_0x99e6('0x8')]();return _0xa083cd(_0x42cf06);});});});};exports[_0x99e6('0xc')]=function(_0xb4bc4a){return connect()['then'](function(){return new BPromise(function(_0x22b574,_0x12f9b5){return pm2[_0x99e6('0xc')](_0xb4bc4a,function(_0x7392e2,_0x43f473){if(_0x7392e2){return _0x12f9b5(_0x7392e2);}pm2[_0x99e6('0x8')]();return _0x22b574(_0x43f473);});});});};exports[_0x99e6('0xd')]=function(){return connect()[_0x99e6('0x6')](function(){return new BPromise(function(_0x311d9a,_0x2fbe80){return pm2[_0x99e6('0xd')](function(_0x3a3ccd){if(_0x3a3ccd){return _0x2fbe80(_0x3a3ccd);}return _0x311d9a(_0x99e6('0xe'));});});});}; \ No newline at end of file +var _0x2049=['delete','dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe'];(function(_0x37279c,_0x5d6056){var _0x28c101=function(_0x4c385f){while(--_0x4c385f){_0x37279c['push'](_0x37279c['shift']());}};_0x28c101(++_0x5d6056);}(_0x2049,0x7b));var _0x9204=function(_0x3cb979,_0x21bbfd){_0x3cb979=_0x3cb979-0x0;var _0x3a5e5f=_0x2049[_0x3cb979];return _0x3a5e5f;};'use strict';var pm2=require(_0x9204('0x0'));var BPromise=require(_0x9204('0x1'));var config=require(_0x9204('0x2'));function connect(){return new BPromise(function(_0x13fbbb,_0x37edf5){return pm2[_0x9204('0x3')](function(_0x3492c4){if(_0x3492c4){return _0x37edf5(_0x3492c4);}return _0x13fbbb(_0x9204('0x4'));});});};exports['start']=function(_0x386db7){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x2a5438,_0x994a7e){return pm2[_0x9204('0x6')](_0x386db7,function(_0x4ca67e,_0x5e13c9){if(_0x4ca67e){return _0x994a7e(_0x4ca67e);}pm2[_0x9204('0x7')]();return _0x2a5438(_0x5e13c9);});});});};exports[_0x9204('0x8')]=function(_0x2f886d){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x1bb424,_0x3d22fc){return pm2[_0x9204('0x8')](_0x2f886d,function(_0x37db2d,_0x1c65a1){if(_0x37db2d){return _0x3d22fc(_0x37db2d);}pm2[_0x9204('0x7')]();return _0x1bb424(_0x1c65a1);});});});};exports[_0x9204('0x9')]=function(_0x597152){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x5cd172,_0x6f98af){return pm2[_0x9204('0x9')](_0x597152,function(_0xf41600,_0x3a38d7){if(_0xf41600){return _0x6f98af(_0xf41600);}pm2[_0x9204('0x7')]();return _0x5cd172(_0x3a38d7);});});});};exports['list']=function(){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x442880,_0x284d82){return pm2[_0x9204('0xa')](function(_0x47755e,_0x5ef175){if(_0x47755e){return _0x284d82(_0x47755e);}pm2[_0x9204('0x7')]();return _0x442880(_0x5ef175);});});});};exports[_0x9204('0xb')]=function(_0x50566e){return connect()['then'](function(){return new BPromise(function(_0x59c1d5,_0x3ce537){return pm2[_0x9204('0xb')](_0x50566e,function(_0x28cdee,_0x24195a){if(_0x28cdee){return _0x3ce537(_0x28cdee);}pm2[_0x9204('0x7')]();return _0x59c1d5(_0x24195a);});});});};exports[_0x9204('0xc')]=function(_0x4dac17){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0xaca2af,_0x206127){return pm2[_0x9204('0xc')](_0x4dac17,function(_0x21e47c,_0x444f70){if(_0x21e47c){return _0x206127(_0x21e47c);}pm2[_0x9204('0x7')]();return _0xaca2af(_0x444f70);});});});};exports[_0x9204('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x38f891,_0x5bea6b){return pm2[_0x9204('0xd')](function(_0x47097e){if(_0x47097e){return _0x5bea6b(_0x47097e);}return _0x38f891(_0x9204('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f6f653b..25973d1 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 _0xc363=['update','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../logger','schedule','defaults','redis','localhost','socket.io-emitter','find','then','ChatInteraction','findAll','subtract','chatTimeout','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x557cef,_0x356869){var _0x53358e=function(_0x5c4007){while(--_0x5c4007){_0x557cef['push'](_0x557cef['shift']());}};_0x53358e(++_0x356869);}(_0xc363,0x103));var _0x3c36=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0xc363[_0x13b330];return _0x1f666c;};'use strict';var _=require(_0x3c36('0x0'));var moment=require('moment');var Redis=require(_0x3c36('0x1'));var util=require(_0x3c36('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x3c36('0x3'))(_0x3c36('0x4'));config['redis']=_[_0x3c36('0x5')](config[_0x3c36('0x6')],{'host':_0x3c36('0x7'),'port':0x18eb});var io=require(_0x3c36('0x8'))(new Redis(config[_0x3c36('0x6')]));function closeInteractions(){var _0x5395fe=0x0;var _0x1800fd=[];return db['Setting'][_0x3c36('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x3c36('0xa')](function(_0x1dfbe7){_0x5395fe=_0x1dfbe7['chatTimeout'];if(_0x5395fe){return db[_0x3c36('0xb')][_0x3c36('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3c36('0xd')](_0x1dfbe7[_0x3c36('0xe')],_0x3c36('0xf'))}}});}else{return[];}})[_0x3c36('0xa')](function(_0x4609ee){if(_0x4609ee&&_0x4609ee['length']){_0x1800fd=_[_0x3c36('0x10')](_0x4609ee||[],'id');logger[_0x3c36('0x11')](_0x3c36('0x12'),_0x1800fd[_0x3c36('0x13')]());return db['ChatInteraction'][_0x3c36('0x14')]({'closeReason':_0x3c36('0x15'),'disposition':_0x3c36('0x16'),'closed':!![],'closedAt':moment()[_0x3c36('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1800fd}});}})['then'](function(){if(_0x1800fd&&_0x1800fd[_0x3c36('0x18')]){logger[_0x3c36('0x11')](_0x3c36('0x19'),_0x1800fd['join']());for(var _0x4abb0d=0x0;_0x4abb0d<_0x1800fd[_0x3c36('0x18')];_0x4abb0d++){io['emit'](_0x3c36('0x1a'),{'id':_0x1800fd[_0x4abb0d],'closed':!![]});}}})['catch'](function(_0x174ee2){logger[_0x3c36('0x1b')](_0x3c36('0x1c'),_0x174ee2?util[_0x3c36('0x1d')](_0x174ee2,{'showHidden':![],'depth':null}):'');});}exports[_0x3c36('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3586=['then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','chatTimeout','minutes','length','info','join','ChatInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1d7f1f,_0x22a8b9){var _0x287249=function(_0x232545){while(--_0x232545){_0x1d7f1f['push'](_0x1d7f1f['shift']());}};_0x287249(++_0x22a8b9);}(_0x3586,0x1e2));var _0x6358=function(_0x3cd590,_0x54deaa){_0x3cd590=_0x3cd590-0x0;var _0x149858=_0x3586[_0x3cd590];return _0x149858;};'use strict';var _=require('lodash');var moment=require(_0x6358('0x0'));var Redis=require(_0x6358('0x1'));var util=require(_0x6358('0x2'));var config=require(_0x6358('0x3'));var db=require(_0x6358('0x4'))['db'];var logger=require('../logger')(_0x6358('0x5'));config['redis']=_[_0x6358('0x6')](config[_0x6358('0x7')],{'host':_0x6358('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6358('0x7')]));function closeInteractions(){var _0x504d63=0x0;var _0x17ce7a=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x3ea3df){_0x504d63=_0x3ea3df['chatTimeout'];if(_0x504d63){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3ea3df[_0x6358('0x9')],_0x6358('0xa'))}}});}else{return[];}})['then'](function(_0x543ac3){if(_0x543ac3&&_0x543ac3[_0x6358('0xb')]){_0x17ce7a=_['map'](_0x543ac3||[],'id');logger[_0x6358('0xc')]('[CHAT]\x20Interactions\x20to\x20close:',_0x17ce7a[_0x6358('0xd')]());return db[_0x6358('0xe')]['update']({'closeReason':'system','disposition':_0x6358('0xf'),'closed':!![],'closedAt':moment()[_0x6358('0x10')](_0x6358('0x11'))},{'where':{'id':_0x17ce7a}});}})[_0x6358('0x12')](function(){if(_0x17ce7a&&_0x17ce7a['length']){logger[_0x6358('0xc')](_0x6358('0x13'),_0x17ce7a[_0x6358('0xd')]());for(var _0x18a71e=0x0;_0x18a71e<_0x17ce7a[_0x6358('0xb')];_0x18a71e++){io[_0x6358('0x14')](_0x6358('0x15'),{'id':_0x17ce7a[_0x18a71e],'closed':!![]});}}})['catch'](function(_0x552b66){logger['error'](_0x6358('0x16'),_0x552b66?util[_0x6358('0x17')](_0x552b66,{'showHidden':![],'depth':null}):'');});}exports[_0x6358('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 79d3868..7c926b2 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf758=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf758,0xf6));var _0x8f75=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf758[_0x397e5f];return _0x5302b8;};'use strict';function start(){var _0x38ad2f=require(_0x8f75('0x0'));return _0x38ad2f[_0x8f75('0x1')]();}module[_0x8f75('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xe610=['startAllRefreshIntervals','exports'];(function(_0x11616c,_0x26252e){var _0x11f4bf=function(_0x185c9a){while(--_0x185c9a){_0x11616c['push'](_0x11616c['shift']());}};_0x11f4bf(++_0x26252e);}(_0xe610,0x15e));var _0x0e61=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe610[_0x1035c1];return _0x308d67;};'use strict';function start(){var _0x39e69d=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x39e69d[_0x0e61('0x0')]();}module[_0x0e61('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a539e64..e04db35 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 _0xd75a=['error\x20mail','email\x20sent','case\x20loading','currentAttempt','retries','job','data','operation','still\x20loading','case\x20completed','stop','case\x20empty','dataValues','attempt','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','Smtp','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','deleteJob','toRun','cron','active','isBetween','startAt','endAt','start','add\x20cron','update','stop\x20cron','path','lodash','moment','cron-job-manager','../logger','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','Empty','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request'];(function(_0x48dd58,_0xd1edc4){var _0x448f46=function(_0x2ed975){while(--_0x2ed975){_0x48dd58['push'](_0x48dd58['shift']());}};_0x448f46(++_0xd1edc4);}(_0xd75a,0x1d3));var _0xad75=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd75a[_0x178e48];return _0x440d7e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xad75('0x0'));var _=require(_0xad75('0x1'));var moment=require(_0xad75('0x2'));var CronJobManager=require(_0xad75('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xad75('0x4'))('schedule');var db=require(_0xad75('0x5'))['db'];const retry=require(_0xad75('0x6'));var analyticCustomReportController=require(_0xad75('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xad75('0x8')][_0xad75('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4c2358){const _0x3c160a={};if(typeof _0x4c2358===_0xad75('0xa')){_0x3c160a['id']=_0x4c2358;}return db[_0xad75('0xb')][_0xad75('0xc')]({'where':_0x3c160a})[_0xad75('0xd')](function(_0x6de392){return _0x6de392;})[_0xad75('0xe')](function(_0x310ce3){logger[_0xad75('0xf')](_0x310ce3);});}function handleSendEmail(_0x5c5bcb,_0x2d793a){logger[_0xad75('0x10')](_0xad75('0x11'),_0x5c5bcb[_0xad75('0x12')]);var _0x3e2cb6=!![];var _0x3947c3=_0x5c5bcb['MailAccount'][_0xad75('0x13')]();var _0x4b0431={'account':_0x3947c3,'message':{'from':util[_0xad75('0x14')](_0xad75('0x15'),_0x5c5bcb['MailAccount']['name'],_0x5c5bcb[_0xad75('0x16')][_0xad75('0x12')]||_0x5c5bcb['MailAccount']['Smtp'][_0xad75('0x17')]),'to':_0x5c5bcb[_0xad75('0x12')],'cc':_0x5c5bcb['cc'],'bcc':_0x5c5bcb[_0xad75('0x18')],'subject':util['format'](_0xad75('0x19'),_0x2d793a[_0xad75('0x1a')],_0x5c5bcb['subtractNumber'],_0x5c5bcb[_0xad75('0x1b')])}};var _0x5bbf6e=path['join'](__dirname,_0xad75('0x1c'));var _0x354f62=_0x2d793a[_0xad75('0x1d')];var _0xf4825d=util[_0xad75('0x14')](_0xad75('0x1e'),path[_0xad75('0x1f')](_0x2d793a['savename'],path[_0xad75('0x20')](_0x2d793a[_0xad75('0x1d')])),_0xad75('0x21'));var _0x53937d=path['join'](_0x5bbf6e,_0x354f62);var _0x6fab8b=path[_0xad75('0x22')](_0x5bbf6e,_0xf4825d);if(fs['existsSync'](_0x53937d)){_0x2d793a[_0xad75('0x23')]='Sent';_0x4b0431[_0xad75('0x24')][_0xad75('0x25')]=[{'filename':_0x354f62,'path':_0x53937d}];_0x4b0431['message'][_0xad75('0x26')]=util['format'](_0xad75('0x27'),JSON[_0xad75('0x28')](_0x2d793a,null,0x2));}else if(fs[_0xad75('0x29')](_0x6fab8b)){_0x2d793a['status']=_0xad75('0x2a');_0x4b0431['message']['attachments']=[{'filename':_0xf4825d,'path':_0x6fab8b}];}else{if(_0x2d793a['status']===_0xad75('0x2b')){_0x4b0431[_0xad75('0x24')][_0xad75('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5c5bcb[_0xad75('0x2c')]){_0x3e2cb6=![];logger['info'](_0xad75('0x2d'));}}else if(_0x2d793a[_0xad75('0x23')]===_0xad75('0x2e')){_0x4b0431[_0xad75('0x24')]['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x2d793a['status']===_0xad75('0x2f')){_0x4b0431[_0xad75('0x24')]['text']=_0xad75('0x30');}else if(_0x2d793a[_0xad75('0x23')]===_0xad75('0x31')){_0x4b0431[_0xad75('0x24')][_0xad75('0x26')]=_0xad75('0x32');}else{logger[_0xad75('0xf')](_0xad75('0x33'),_0x2d793a['status']);}}if(_0x3e2cb6){return client[_0xad75('0x34')]('SendMail',_0x4b0431)[_0xad75('0xd')](function(_0x3d5404){if(_0x3d5404[_0xad75('0xf')]){return logger[_0xad75('0xf')](_0xad75('0x35'),JSON[_0xad75('0x28')](_0x3d5404));}return logger[_0xad75('0x10')](_0xad75('0x36'));})[_0xad75('0xe')](function(_0xd47a95){return logger[_0xad75('0xf')](_0xad75('0x35'),JSON[_0xad75('0x28')](_0xd47a95));});}}function handleError(){return function(_0x496143){return logger[_0xad75('0xf')](JSON[_0xad75('0x28')](_0x496143));};}function loading(_0xca04ee){logger[_0xad75('0x10')](_0xad75('0x37'));if(_0xca04ee[_0xad75('0x38')]===_0xca04ee['retryOptions'][_0xad75('0x39')]){handleSendEmail(_0xca04ee[_0xad75('0x3a')],_0xca04ee[_0xad75('0x3b')]);_0xca04ee[_0xad75('0x3c')]['stop']();}else{_0xca04ee[_0xad75('0x3c')][_0xad75('0x6')](_0xad75('0x3d'));}}function completed(_0x24ad57){logger[_0xad75('0x10')](_0xad75('0x3e'));handleSendEmail(_0x24ad57[_0xad75('0x3a')],_0x24ad57[_0xad75('0x3b')]);_0x24ad57[_0xad75('0x3c')][_0xad75('0x3f')]();}function empty(_0x1e8ce8){logger['info'](_0xad75('0x40'));handleSendEmail(_0x1e8ce8[_0xad75('0x3a')],_0x1e8ce8[_0xad75('0x3b')]);_0x1e8ce8[_0xad75('0x3c')]['stop']();}function failed(_0x2f0fb0){logger[_0xad75('0x10')]('case\x20failed');handleSendEmail(_0x2f0fb0[_0xad75('0x3a')],_0x2f0fb0[_0xad75('0x3b')]);_0x2f0fb0[_0xad75('0x3c')][_0xad75('0x3f')]();}function urecognized(_0x3cb96c){logger[_0xad75('0xf')]('Unrecognized\x20status:',_0x3cb96c['entity'][_0xad75('0x41')][_0xad75('0x23')]);_0x3cb96c[_0xad75('0x3c')][_0xad75('0x3f')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x30ddf6,_0x48ade0){const _0x20a007={'retries':0xf,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0x3c*0x3c*0x3e8};const _0x12c0e8=retry['operation'](_0x20a007);_0x12c0e8[_0xad75('0x42')](_0x40127a=>{logger[_0xad75('0x10')](_0xad75('0x43')+_0x30ddf6['id']+'\x20Attempt\x20#:'+_0x40127a);try{getReportData(_0x48ade0['id'])[_0xad75('0xd')](function(_0x4179d0){_0x48ade0=_0x4179d0;logger[_0xad75('0x10')](_0xad75('0x44'),_0x4179d0[_0xad75('0x41')][_0xad75('0x23')]);if(!reportStatusStrategies[_0x4179d0[_0xad75('0x41')][_0xad75('0x23')]]){logger[_0xad75('0xf')](_0xad75('0x44'),_0x4179d0[_0xad75('0x41')]['status']);_0x12c0e8['retry']();}reportStatusStrategies[_0x4179d0[_0xad75('0x41')][_0xad75('0x23')]]({'operation':_0x12c0e8,'currentAttempt':_0x40127a,'retryOptions':_0x20a007,'job':_0x30ddf6,'data':_0x48ade0,'entity':_0x4179d0});});}catch(_0x208ef6){_0x12c0e8['retry'](_0x208ef6);}});}function handleResult(_0x1e3c50){return function(_0x22c0c8){if(_0x1e3c50[_0xad75('0x45')]&&_0x1e3c50[_0xad75('0x16')]&&_0x1e3c50[_0xad75('0x16')]['Smtp']&&!_['isNil'](_0x1e3c50['email'])){retryer(_0x1e3c50,_0x22c0c8);}};}function handleJob(_0x4e2b17){return function(){try{if(_[_0xad75('0x46')](_0x4e2b17[_0xad75('0x47')])){return logger['info'](_0xad75('0x48'));}if(_[_0xad75('0x46')](_0x4e2b17[_0xad75('0x1b')])){return logger[_0xad75('0x10')](_0xad75('0x49'));}var _0x4cb57f={'startDate':moment()[_0xad75('0x4a')](_0x4e2b17['subtractNumber'],_0x4e2b17[_0xad75('0x1b')])[_0xad75('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xad75('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xad75('0x4b'),'output':_0x4e2b17['output'],'name':_0x4e2b17[_0xad75('0x1a')]};if(!_[_0xad75('0x46')](_0x4e2b17[_0xad75('0x4c')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4e2b17['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x4e2b17[_0xad75('0x4c')]},_0x4cb57f)[_0xad75('0xd')](handleResult(_0x4e2b17))[_0xad75('0xe')](handleError());}if(!_[_0xad75('0x46')](_0x4e2b17['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x4e2b17[_0xad75('0x4d')]);return analyticCustomReportController[_0xad75('0x4e')]({'id':_0x4e2b17[_0xad75('0x4d')]},_0x4cb57f)[_0xad75('0xd')](handleResult(_0x4e2b17))[_0xad75('0xe')](handleError());}}catch(_0x58d0c0){logger[_0xad75('0xf')](JSON[_0xad75('0x28')](_0x58d0c0));}return logger[_0xad75('0x10')](_0xad75('0x4f'));};}function getJobs(_0x51654a){var _0x448725={};if(_0x51654a){_0x448725['id']=_0x51654a;}return db[_0xad75('0x50')][_0xad75('0x51')]({'where':_0x448725,'include':[{'model':db[_0xad75('0x16')],'attributes':['id','name',_0xad75('0x12')],'include':[{'model':db[_0xad75('0x52')],'as':_0xad75('0x53'),'include':[{'model':db[_0xad75('0x54')],'as':'CloudProvider'}]}]}]})[_0xad75('0xd')](function(_0x2bdf87){var _0x2a25ab=_[_0xad75('0x55')](manager[_0xad75('0x56')]);var _0x8b2226=_[_0xad75('0x57')](_0x2bdf87,function(_0x459a02){return _0x459a02['id'][_0xad75('0x58')]();});var _0x246959=_['keyBy'](_0x2bdf87,function(_0x1bb2cc){return _0x1bb2cc['id'][_0xad75('0x58')]();});var _0x4a4c08=_0x51654a?_0x8b2226:_[_0xad75('0x59')](_0x8b2226,_0x2a25ab);var _0x40ed10=_[_0xad75('0x5a')](_0x8b2226,_0x2a25ab);var _0xc42e7f=_[_0xad75('0x59')](_0x2a25ab,_0x8b2226);var _0x321809;var _0x1b2330;for(_0x321809=0x0;_0x321809<_0xc42e7f[_0xad75('0x5b')]&&!_0x51654a;_0x321809+=0x1){_0x1b2330=_0xc42e7f[_0x321809]['toString']();if(manager[_0xad75('0x5c')](_0x1b2330)){manager[_0xad75('0x3f')](_0x1b2330);manager[_0xad75('0x5d')](_0x1b2330);logger[_0xad75('0x10')]('delete\x20cron',_0x1b2330);}}logger[_0xad75('0x10')](_0xad75('0x5e'),JSON[_0xad75('0x28')](_0x4a4c08));for(_0x321809=0x0;_0x321809<_0x4a4c08[_0xad75('0x5b')];_0x321809+=0x1){_0x1b2330=_0x4a4c08[_0x321809]['toString']();if(_0x51654a){logger[_0xad75('0x10')](JSON[_0xad75('0x28')](_0x246959[_0x1b2330]));BPromise['resolve']()[_0xad75('0xd')](handleJob(_0x246959[_0x1b2330]));logger[_0xad75('0x10')]('run\x20job',_0x246959[_0x1b2330][_0xad75('0x1a')],_0x246959[_0x1b2330][_0xad75('0x5f')]);}else if(_0x246959[_0x1b2330][_0xad75('0x5f')]&&_0x246959[_0x1b2330][_0xad75('0x60')]&&moment()[_0xad75('0x61')](_0x246959[_0x1b2330][_0xad75('0x62')],_0x246959[_0x1b2330][_0xad75('0x63')])){manager['add'](_0x1b2330,_0x246959[_0x1b2330]['cron'],handleJob(_0x246959[_0x1b2330]));manager[_0xad75('0x64')](_0x1b2330);logger['info'](_0xad75('0x65'),_0x246959[_0x1b2330][_0xad75('0x1a')],_0x246959[_0x1b2330][_0xad75('0x5f')]);}else if(manager[_0xad75('0x5c')](_0x1b2330)){manager[_0xad75('0x3f')](_0x1b2330);manager[_0xad75('0x5d')](_0x1b2330);logger[_0xad75('0x10')]('stop\x20cron',_0x246959[_0x1b2330]['name'],_0x246959[_0x1b2330][_0xad75('0x5f')]);}}for(_0x321809=0x0,_0x1b2330;_0x321809<_0x40ed10[_0xad75('0x5b')]&&!_0x51654a;_0x321809+=0x1){_0x1b2330=_0x40ed10[_0x321809]['toString']();if(manager['exists'](_0x1b2330)){if(_0x246959[_0x1b2330][_0xad75('0x5f')]&&_0x246959[_0x1b2330]['active']&&moment()[_0xad75('0x61')](_0x246959[_0x1b2330]['startAt'],_0x246959[_0x1b2330][_0xad75('0x63')])){manager[_0xad75('0x66')](_0x1b2330,_0x246959[_0x1b2330][_0xad75('0x5f')],handleJob(_0x246959[_0x1b2330]));logger[_0xad75('0x10')]('update\x20cron',_0x246959[_0x1b2330][_0xad75('0x1a')],_0x246959[_0x1b2330]['cron']);}else{manager[_0xad75('0x3f')](_0x1b2330);manager[_0xad75('0x5d')](_0x1b2330);logger['info'](_0xad75('0x67'),_0x246959[_0x1b2330][_0xad75('0x1a')],_0x246959[_0x1b2330][_0xad75('0x5f')]);}}}})['catch'](function(_0x2e02d4){logger[_0xad75('0xf')](JSON[_0xad75('0x28')](_0x2e02d4));});}exports['run']=function(_0x320525){return getJobs(_0x320525);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4754=['error\x20mail','email\x20sent','case\x20loading','currentAttempt','retries','job','operation','stop','still\x20loading','case\x20completed','data','Unrecognized\x20status:','dataValues','attempt','\x20Attempt\x20#:','report\x20status:','sendMail','MailAccount','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','toString','keyBy','difference','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','start','lodash','cron-job-manager','bluebird','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','AnalyticExtractedReport','findOne','then','error','Try\x20to\x20send\x20a\x20mail\x20to','email','format','name','Smtp','user','bcc','subtractUnit','join','%s.%s','basename','savename','extname','zip','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail'];(function(_0x1cfccb,_0x57bb71){var _0x1d245d=function(_0x8f052c){while(--_0x8f052c){_0x1cfccb['push'](_0x1cfccb['shift']());}};_0x1d245d(++_0x57bb71);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x4475('0x0'));var moment=require('moment');var CronJobManager=require(_0x4475('0x1'));var jayson=require('jayson/promise');var BPromise=require(_0x4475('0x2'));var logger=require('../logger')(_0x4475('0x3'));var db=require(_0x4475('0x4'))['db'];const retry=require(_0x4475('0x5'));var analyticCustomReportController=require(_0x4475('0x6'));var analyticDefaultReportController=require(_0x4475('0x7'));var client=jayson[_0x4475('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x3968fe){const _0x751375={};if(typeof _0x3968fe==='number'){_0x751375['id']=_0x3968fe;}return db[_0x4475('0x9')][_0x4475('0xa')]({'where':_0x751375})[_0x4475('0xb')](function(_0x33da68){return _0x33da68;})['catch'](function(_0x503131){logger[_0x4475('0xc')](_0x503131);});}function handleSendEmail(_0x4e6525,_0x128a15){logger['info'](_0x4475('0xd'),_0x4e6525[_0x4475('0xe')]);var _0x453d84=!![];var _0x3f7e62=_0x4e6525['MailAccount']['getSmtpOptions']();var _0x29b558={'account':_0x3f7e62,'message':{'from':util[_0x4475('0xf')]('\x22%s\x22\x20<%s>',_0x4e6525['MailAccount'][_0x4475('0x10')],_0x4e6525['MailAccount'][_0x4475('0xe')]||_0x4e6525['MailAccount'][_0x4475('0x11')][_0x4475('0x12')]),'to':_0x4e6525['email'],'cc':_0x4e6525['cc'],'bcc':_0x4e6525[_0x4475('0x13')],'subject':util[_0x4475('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0x128a15['name'],_0x4e6525['subtractNumber'],_0x4e6525[_0x4475('0x14')])}};var _0x44f327=path[_0x4475('0x15')](__dirname,'../../files/reports');var _0x26f8bd=_0x128a15['savename'];var _0x5cd909=util[_0x4475('0xf')](_0x4475('0x16'),path[_0x4475('0x17')](_0x128a15[_0x4475('0x18')],path[_0x4475('0x19')](_0x128a15[_0x4475('0x18')])),_0x4475('0x1a'));var _0x54cc4d=path[_0x4475('0x15')](_0x44f327,_0x26f8bd);var _0x5d7a11=path[_0x4475('0x15')](_0x44f327,_0x5cd909);if(fs['existsSync'](_0x54cc4d)){_0x128a15['status']='Sent';_0x29b558[_0x4475('0x1b')][_0x4475('0x1c')]=[{'filename':_0x26f8bd,'path':_0x54cc4d}];_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=util[_0x4475('0xf')](_0x4475('0x1e'),JSON[_0x4475('0x1f')](_0x128a15,null,0x2));}else if(fs[_0x4475('0x20')](_0x5d7a11)){_0x128a15[_0x4475('0x21')]=_0x4475('0x22');_0x29b558[_0x4475('0x1b')][_0x4475('0x1c')]=[{'filename':_0x5cd909,'path':_0x5d7a11}];}else{if(_0x128a15[_0x4475('0x21')]===_0x4475('0x23')){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=_0x4475('0x24');if(!_0x4e6525[_0x4475('0x25')]){_0x453d84=![];logger[_0x4475('0x26')](_0x4475('0x27'));}}else if(_0x128a15[_0x4475('0x21')]===_0x4475('0x28')){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=_0x4475('0x29');}else if(_0x128a15[_0x4475('0x21')]==='Completed'){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x128a15[_0x4475('0x21')]===_0x4475('0x2a')){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=_0x4475('0x2b');}else{logger[_0x4475('0xc')](_0x4475('0x2c'),_0x128a15[_0x4475('0x21')]);}}if(_0x453d84){return client[_0x4475('0x2d')](_0x4475('0x2e'),_0x29b558)[_0x4475('0xb')](function(_0x57e09e){if(_0x57e09e['error']){return logger['error'](_0x4475('0x2f'),JSON[_0x4475('0x1f')](_0x57e09e));}return logger[_0x4475('0x26')](_0x4475('0x30'));})['catch'](function(_0x2d9cb4){return logger[_0x4475('0xc')](_0x4475('0x2f'),JSON[_0x4475('0x1f')](_0x2d9cb4));});}}function handleError(){return function(_0x19f8c7){return logger[_0x4475('0xc')](JSON[_0x4475('0x1f')](_0x19f8c7));};}function loading(_0x20cd0a){logger[_0x4475('0x26')](_0x4475('0x31'));if(_0x20cd0a[_0x4475('0x32')]===_0x20cd0a['retryOptions'][_0x4475('0x33')]){handleSendEmail(_0x20cd0a[_0x4475('0x34')],_0x20cd0a['data']);_0x20cd0a[_0x4475('0x35')][_0x4475('0x36')]();}else{_0x20cd0a[_0x4475('0x35')][_0x4475('0x5')](_0x4475('0x37'));}}function completed(_0x30db50){logger['info'](_0x4475('0x38'));handleSendEmail(_0x30db50[_0x4475('0x34')],_0x30db50[_0x4475('0x39')]);_0x30db50['operation'][_0x4475('0x36')]();}function empty(_0x5c6773){logger[_0x4475('0x26')]('case\x20empty');handleSendEmail(_0x5c6773['job'],_0x5c6773[_0x4475('0x39')]);_0x5c6773[_0x4475('0x35')][_0x4475('0x36')]();}function failed(_0x4129bb){logger[_0x4475('0x26')]('case\x20failed');handleSendEmail(_0x4129bb[_0x4475('0x34')],_0x4129bb[_0x4475('0x39')]);_0x4129bb[_0x4475('0x35')]['stop']();}function urecognized(_0x25a5af){logger[_0x4475('0xc')](_0x4475('0x3a'),_0x25a5af['entity'][_0x4475('0x3b')][_0x4475('0x21')]);_0x25a5af[_0x4475('0x35')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2d4a14,_0xe25f6){const _0x57ab67={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x2e7619=retry[_0x4475('0x35')](_0x57ab67);_0x2e7619[_0x4475('0x3c')](_0x3a77ca=>{logger[_0x4475('0x26')]('Job\x20ID\x20'+_0x2d4a14['id']+_0x4475('0x3d')+_0x3a77ca);try{getReportData(_0xe25f6['id'])[_0x4475('0xb')](function(_0x416b3c){_0xe25f6=_0x416b3c;logger['info'](_0x4475('0x3e'),_0x416b3c[_0x4475('0x3b')][_0x4475('0x21')]);if(!reportStatusStrategies[_0x416b3c[_0x4475('0x3b')]['status']]){logger[_0x4475('0xc')](_0x4475('0x3e'),_0x416b3c['dataValues'][_0x4475('0x21')]);_0x2e7619[_0x4475('0x5')]();}reportStatusStrategies[_0x416b3c['dataValues'][_0x4475('0x21')]]({'operation':_0x2e7619,'currentAttempt':_0x3a77ca,'retryOptions':_0x57ab67,'job':_0x2d4a14,'data':_0xe25f6,'entity':_0x416b3c});});}catch(_0x14020f){_0x2e7619[_0x4475('0x5')](_0x14020f);}});}function handleResult(_0x2dc5ac){return function(_0x118f1f){if(_0x2dc5ac[_0x4475('0x3f')]&&_0x2dc5ac[_0x4475('0x40')]&&_0x2dc5ac[_0x4475('0x40')][_0x4475('0x11')]&&!_[_0x4475('0x41')](_0x2dc5ac['email'])){retryer(_0x2dc5ac,_0x118f1f);}};}function handleJob(_0x2e251b){return function(){try{if(_['isNil'](_0x2e251b[_0x4475('0x42')])){return logger[_0x4475('0x26')](_0x4475('0x43'));}if(_['isNil'](_0x2e251b[_0x4475('0x14')])){return logger[_0x4475('0x26')]('subtractUnit\x20null\x20or\x20undefined');}var _0xe25290={'startDate':moment()['subtract'](_0x2e251b[_0x4475('0x42')],_0x2e251b[_0x4475('0x14')])[_0x4475('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4475('0xf')](_0x4475('0x44')),'type':_0x4475('0x45'),'output':_0x2e251b[_0x4475('0x46')],'name':_0x2e251b[_0x4475('0x10')]};if(!_[_0x4475('0x41')](_0x2e251b[_0x4475('0x47')])){logger[_0x4475('0x26')](_0x4475('0x48'),_0x2e251b['DefaultReportId']);return analyticDefaultReportController[_0x4475('0x49')]({'id':_0x2e251b[_0x4475('0x47')]},_0xe25290)['then'](handleResult(_0x2e251b))[_0x4475('0x4a')](handleError());}if(!_[_0x4475('0x41')](_0x2e251b[_0x4475('0x4b')])){logger[_0x4475('0x26')]('exec\x20custom\x20report\x20id:%s',_0x2e251b[_0x4475('0x4b')]);return analyticCustomReportController[_0x4475('0x49')]({'id':_0x2e251b[_0x4475('0x4b')]},_0xe25290)['then'](handleResult(_0x2e251b))[_0x4475('0x4a')](handleError());}}catch(_0x473073){logger[_0x4475('0xc')](JSON[_0x4475('0x1f')](_0x473073));}return logger[_0x4475('0x26')](_0x4475('0x4c'));};}function getJobs(_0x15b1c9){var _0x1d0612={};if(_0x15b1c9){_0x1d0612['id']=_0x15b1c9;}return db[_0x4475('0x4d')][_0x4475('0x4e')]({'where':_0x1d0612,'include':[{'model':db[_0x4475('0x40')],'attributes':['id',_0x4475('0x10'),_0x4475('0xe')],'include':[{'model':db[_0x4475('0x4f')],'as':_0x4475('0x11'),'include':[{'model':db['CloudProvider'],'as':_0x4475('0x50')}]}]}]})[_0x4475('0xb')](function(_0x26027a){var _0x25fa33=_[_0x4475('0x51')](manager['jobs']);var _0x434aff=_['map'](_0x26027a,function(_0xe22eab){return _0xe22eab['id'][_0x4475('0x52')]();});var _0x5bcced=_[_0x4475('0x53')](_0x26027a,function(_0x18cab7){return _0x18cab7['id'][_0x4475('0x52')]();});var _0x37a9ef=_0x15b1c9?_0x434aff:_[_0x4475('0x54')](_0x434aff,_0x25fa33);var _0x29ae76=_['intersection'](_0x434aff,_0x25fa33);var _0x1aefe1=_[_0x4475('0x54')](_0x25fa33,_0x434aff);var _0x30bd1b;var _0x12bc45;for(_0x30bd1b=0x0;_0x30bd1b<_0x1aefe1[_0x4475('0x55')]&&!_0x15b1c9;_0x30bd1b+=0x1){_0x12bc45=_0x1aefe1[_0x30bd1b]['toString']();if(manager[_0x4475('0x56')](_0x12bc45)){manager[_0x4475('0x36')](_0x12bc45);manager[_0x4475('0x57')](_0x12bc45);logger[_0x4475('0x26')](_0x4475('0x58'),_0x12bc45);}}logger[_0x4475('0x26')](_0x4475('0x59'),JSON[_0x4475('0x1f')](_0x37a9ef));for(_0x30bd1b=0x0;_0x30bd1b<_0x37a9ef[_0x4475('0x55')];_0x30bd1b+=0x1){_0x12bc45=_0x37a9ef[_0x30bd1b][_0x4475('0x52')]();if(_0x15b1c9){logger[_0x4475('0x26')](JSON[_0x4475('0x1f')](_0x5bcced[_0x12bc45]));BPromise['resolve']()[_0x4475('0xb')](handleJob(_0x5bcced[_0x12bc45]));logger[_0x4475('0x26')](_0x4475('0x5a'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45][_0x4475('0x5b')]);}else if(_0x5bcced[_0x12bc45][_0x4475('0x5b')]&&_0x5bcced[_0x12bc45][_0x4475('0x5c')]&&moment()[_0x4475('0x5d')](_0x5bcced[_0x12bc45][_0x4475('0x5e')],_0x5bcced[_0x12bc45][_0x4475('0x5f')])){manager[_0x4475('0x60')](_0x12bc45,_0x5bcced[_0x12bc45][_0x4475('0x5b')],handleJob(_0x5bcced[_0x12bc45]));manager['start'](_0x12bc45);logger[_0x4475('0x26')](_0x4475('0x61'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}else if(manager['exists'](_0x12bc45)){manager[_0x4475('0x36')](_0x12bc45);manager[_0x4475('0x57')](_0x12bc45);logger['info'](_0x4475('0x62'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}}for(_0x30bd1b=0x0,_0x12bc45;_0x30bd1b<_0x29ae76[_0x4475('0x55')]&&!_0x15b1c9;_0x30bd1b+=0x1){_0x12bc45=_0x29ae76[_0x30bd1b][_0x4475('0x52')]();if(manager[_0x4475('0x56')](_0x12bc45)){if(_0x5bcced[_0x12bc45][_0x4475('0x5b')]&&_0x5bcced[_0x12bc45][_0x4475('0x5c')]&&moment()['isBetween'](_0x5bcced[_0x12bc45]['startAt'],_0x5bcced[_0x12bc45][_0x4475('0x5f')])){manager[_0x4475('0x63')](_0x12bc45,_0x5bcced[_0x12bc45]['cron'],handleJob(_0x5bcced[_0x12bc45]));logger[_0x4475('0x26')](_0x4475('0x64'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}else{manager[_0x4475('0x36')](_0x12bc45);manager[_0x4475('0x57')](_0x12bc45);logger[_0x4475('0x26')]('stop\x20cron',_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}}}})[_0x4475('0x4a')](function(_0x21a75f){logger[_0x4475('0xc')](JSON[_0x4475('0x1f')](_0x21a75f));});}exports[_0x4475('0x65')]=function(_0x3da7e0){return getJobs(_0x3da7e0);};exports[_0x4475('0x66')]=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 67e923b..f1e9079 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 _0x33d2=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','Cloud\x20Provider\x20not\x20available','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','name','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0x33d2,0x7f));var _0x233d=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x33d2[_0x5ebf44];return _0x2fef12;};var _=require(_0x233d('0x0'));var AWS=require(_0x233d('0x1'));var rp=require(_0x233d('0x2'));var util=require('util');var BPromise=require(_0x233d('0x3'));var db=require(_0x233d('0x4'))['db'];var logger=require('../../config/logger')(_0x233d('0x5'));function getTranscriptionJob(_0x299a1d,_0x3f60bb,_0xffb043,_0xc0ab48){return new Promise(function(_0x3f311b,_0x15ba43){var _0x15bb45=new AWS['TranscribeService']({'accessKeyId':_0x3f60bb,'secretAccessKey':_0x299a1d,'region':_0xffb043});_0x15bb45[_0x233d('0x6')]({'TranscriptionJobName':_0xc0ab48},function(_0x5629e6,_0x22a0f3){if(_0x5629e6){return _0x15ba43(_0x5629e6);}else{return _0x3f311b(_0x22a0f3);}});});}function sentiment(_0x2247d3,_0x2c8626,_0x4ae63d,_0x3c819e,_0x5cc1fe){return new Promise(function(_0x3a6471,_0x5df708){var _0x1a9d36=new AWS[(_0x233d('0x7'))]({'accessKeyId':_0x2c8626,'secretAccessKey':_0x2247d3,'region':_0x4ae63d});_0x1a9d36[_0x233d('0x8')]({'Text':_0x3c819e,'LanguageCode':_0x5cc1fe['substring'](0x0,0x2)},function(_0xed2db2,_0x33848e){if(_0xed2db2){return _0x5df708(_0xed2db2);}else{return _0x3a6471(_0x33848e);}});});}function checkTranscribeJob(_0x544cd2,_0x2d36d3,_0x19f04c){var _0x51c461;return new BPromise(function(_0x2a7201,_0x14dd71){logger[_0x233d('0x9')](util['format'](_0x233d('0xa'),_0x544cd2['id'],_0x544cd2[_0x233d('0xb')]));return getTranscriptionJob(_0x19f04c[_0x233d('0xc')],_0x19f04c[_0x233d('0xd')],_0x2d36d3[_0x233d('0xe')],_0x544cd2['transcribeName'])[_0x233d('0xf')](function(_0x552bbd){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x11'),_0x544cd2['id'],_0x544cd2[_0x233d('0xb')],_0x552bbd[_0x233d('0x12')]['TranscriptionJobStatus']));if(!_0x544cd2['fileText']){switch(_0x552bbd[_0x233d('0x12')][_0x233d('0x13')]){case _0x233d('0x14'):var _0xa2ab1={'transcribeStatus':_0x552bbd[_0x233d('0x12')][_0x233d('0x13')],'fileUri':_0x552bbd[_0x233d('0x12')][_0x233d('0x15')][_0x233d('0x16')]};logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x17'),_0x544cd2['id']));return rp({'uri':_0x552bbd[_0x233d('0x12')]['Transcript'][_0x233d('0x16')],'json':!![]})[_0x233d('0xf')](function(_0x5dd0e0){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x18'),_0x544cd2['id']));if(_0x5dd0e0&&_0x5dd0e0[_0x233d('0x19')]&&_0x5dd0e0['results'][_0x233d('0x1a')]&&_0x5dd0e0[_0x233d('0x19')][_0x233d('0x1a')][_0x233d('0x1b')]){_0xa2ab1[_0x233d('0x1c')]='';for(var _0x3b39bd=0x0;_0x3b39bd<_0x5dd0e0[_0x233d('0x19')]['transcripts']['length'];_0x3b39bd++){_0xa2ab1['fileText']+=_0x5dd0e0['results'][_0x233d('0x1a')][_0x3b39bd][_0x233d('0x1d')]+'';}}return _0x544cd2[_0x233d('0x1e')](_0xa2ab1);})['then'](function(){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x1f'),_0x544cd2['id']));if(!_0x544cd2[_0x233d('0x20')]){throw new db['Sequelize'][(_0x233d('0x21'))](_0x233d('0x22'));}if(!_0x2d36d3[_0x233d('0x23')]||!_0x2d36d3[_0x233d('0x24')]||!_0x2d36d3[_0x233d('0x25')]||!_0x2d36d3['language']||!_0x2d36d3['bucket']){throw new db[(_0x233d('0x26'))][(_0x233d('0x21'))](_0x233d('0x27'));}if(!_0xa2ab1[_0x233d('0x1c')]){throw new Error(_0x233d('0x28'));}if(_0x2d36d3[_0x233d('0x24')]===_0x19f04c['id']){return _0x19f04c;}else{return db[_0x233d('0x29')][_0x233d('0x2a')]({'where':{'id':_settings[_0x233d('0x24')]}});}})['then'](function(_0x18c0bd){if(!_0x18c0bd){throw new db[(_0x233d('0x26'))][(_0x233d('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x18c0bd['data1']||!_0x18c0bd[_0x233d('0xd')]){throw new db['Sequelize']['ValidationError'](_0x233d('0x2b'));}_0x51c461=_0x18c0bd;logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x2c'),_0x544cd2['id']));return sentiment(_0x51c461[_0x233d('0xc')],_0x51c461['data2'],_0x2d36d3[_0x233d('0x25')],_0xa2ab1[_0x233d('0x1c')],_0x2d36d3[_0x233d('0x2d')]);})[_0x233d('0xf')](function(_0x59cf5f){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x2e'),_0x544cd2['id']));return _0x544cd2[_0x233d('0x1e')]({'sentiment':_0x59cf5f[_0x233d('0x2f')],'sPositive':_0x59cf5f[_0x233d('0x30')][_0x233d('0x31')],'sNegative':_0x59cf5f[_0x233d('0x30')][_0x233d('0x32')],'sMixed':_0x59cf5f[_0x233d('0x30')][_0x233d('0x33')],'sNeutral':_0x59cf5f[_0x233d('0x30')][_0x233d('0x34')]});})[_0x233d('0xf')](function(){logger[_0x233d('0x9')](util[_0x233d('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x544cd2['id']));_0x2a7201();});case'FAILED':return _0x544cd2[_0x233d('0x1e')]({'transcribeStatus':_0x233d('0x35'),'failureReason':_0x552bbd[_0x233d('0x12')][_0x233d('0x36')]})[_0x233d('0xf')](function(){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x1f'),_0x544cd2['id']));_0x2a7201();});default:logger['info'](util[_0x233d('0x10')](_0x233d('0x37'),_0x544cd2['id']));break;}}else{return BPromise[_0x233d('0x38')]()['then'](function(){if(!_0x544cd2['tempSentiment']){throw new db[(_0x233d('0x26'))][(_0x233d('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2d36d3['sentiment']||!_0x2d36d3[_0x233d('0x24')]||!_0x2d36d3['sentimentRegion']||!_0x2d36d3[_0x233d('0x2d')]||!_0x2d36d3[_0x233d('0x39')]){throw new db[(_0x233d('0x26'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x544cd2[_0x233d('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x2d36d3[_0x233d('0x24')]===_0x19f04c['id']){return _0x19f04c;}else{return db[_0x233d('0x29')][_0x233d('0x2a')]({'where':{'id':_settings[_0x233d('0x24')]}});}})[_0x233d('0xf')](function(_0x562e46){if(!_0x562e46){throw new db['Sequelize']['ValidationError'](_0x233d('0x3a'));}if(!_0x562e46[_0x233d('0xc')]||!_0x562e46[_0x233d('0xd')]){throw new db[(_0x233d('0x26'))]['ValidationError'](_0x233d('0x2b'));}_0x51c461=_0x562e46;logger['info'](util[_0x233d('0x10')](_0x233d('0x2c'),_0x544cd2['id']));return sentiment(_0x51c461[_0x233d('0xc')],_0x51c461[_0x233d('0xd')],_0x2d36d3[_0x233d('0x25')],_0x544cd2[_0x233d('0x1c')],_0x2d36d3['language']);})[_0x233d('0xf')](function(_0x3d3e5b){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x2e'),_0x544cd2['id']));return _0x544cd2[_0x233d('0x1e')]({'sentiment':_0x3d3e5b[_0x233d('0x2f')],'sPositive':_0x3d3e5b['SentimentScore']['Positive'],'sNegative':_0x3d3e5b[_0x233d('0x30')]['Negative'],'sMixed':_0x3d3e5b[_0x233d('0x30')][_0x233d('0x33')],'sNeutral':_0x3d3e5b['SentimentScore'][_0x233d('0x34')],'transcribeStatus':_0x233d('0x14')});})['then'](function(){logger[_0x233d('0x9')](util[_0x233d('0x10')](_0x233d('0x1f'),_0x544cd2['id']));_0x2a7201();});}})['catch'](function(_0x3252fb){if(_0x3252fb){if(!_0x3252fb['name']||_0x3252fb['name']!==_0x233d('0x3b')){logger[_0x233d('0x3c')](util[_0x233d('0x10')](_0x233d('0x3d'),_0x544cd2['id']),util[_0x233d('0x3e')](_0x3252fb,{'showHidden':![],'depth':null}));}}_0x2a7201();});});}function checkTranscribe(){var _0x4aa88;var _0x2604bd;var _0x1672b2;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x233d('0x3f')}})[_0x233d('0xf')](function(_0x5116e1){if(!_0x5116e1||!_0x5116e1['length']){throw new db[(_0x233d('0x26'))][(_0x233d('0x21'))](_0x233d('0x40'));}_0x4aa88=_0x5116e1;return db[_0x233d('0x41')][_0x233d('0x2a')]({'where':{'id':0x1}});})[_0x233d('0xf')](function(_0x557af2){if(!_0x557af2){throw new db[(_0x233d('0x26'))]['ValidationError'](_0x233d('0x42'));}_0x2604bd=_0x557af2;if(!_0x2604bd[_0x233d('0x5')]||!_0x2604bd[_0x233d('0x43')]||!_0x2604bd[_0x233d('0xe')]||!_0x2604bd[_0x233d('0x2d')]||!_0x2604bd['bucket']){throw new db['Sequelize']['ValidationError'](_0x233d('0x44'));}return db[_0x233d('0x29')][_0x233d('0x2a')]({'where':{'id':_0x2604bd[_0x233d('0x43')]}});})[_0x233d('0xf')](function(_0x2ac8a0){if(!_0x2ac8a0){throw new db[(_0x233d('0x26'))][(_0x233d('0x21'))](_0x233d('0x3a'));}if(!_0x2ac8a0[_0x233d('0xc')]||!_0x2ac8a0[_0x233d('0xd')]){throw new db[(_0x233d('0x26'))][(_0x233d('0x21'))](_0x233d('0x2b'));}_0x1672b2=_0x2ac8a0;var _0x4d69b5=[];_0x4aa88[_0x233d('0x45')](function(_0x57b1c7){_0x4d69b5[_0x233d('0x46')](checkTranscribeJob(_0x57b1c7,_0x2604bd,_0x1672b2));});return BPromise['all'](_0x4d69b5);})['catch'](function(_0x395298){if(_0x395298){if(!_0x395298[_0x233d('0x47')]||_0x395298[_0x233d('0x47')]!==_0x233d('0x3b')){logger[_0x233d('0x3c')](util['inspect'](_0x395298,{'showHidden':![],'depth':null}));}}});}exports[_0x233d('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7a40=['getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Sequelize','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','catch','name','SequelizeValidationError','error','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','inspect','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a40,0x197));var _0x07a4=function(_0x548f00,_0x36b3c6){_0x548f00=_0x548f00-0x0;var _0x3a422a=_0x7a40[_0x548f00];return _0x3a422a;};var _=require(_0x07a4('0x0'));var AWS=require(_0x07a4('0x1'));var rp=require(_0x07a4('0x2'));var util=require('util');var BPromise=require(_0x07a4('0x3'));var db=require(_0x07a4('0x4'))['db'];var logger=require(_0x07a4('0x5'))(_0x07a4('0x6'));function getTranscriptionJob(_0x37c206,_0x48a3da,_0x334e7a,_0x130748){return new Promise(function(_0x3a53fb,_0x399d0f){var _0x4177d4=new AWS['TranscribeService']({'accessKeyId':_0x48a3da,'secretAccessKey':_0x37c206,'region':_0x334e7a});_0x4177d4[_0x07a4('0x7')]({'TranscriptionJobName':_0x130748},function(_0x30b95c,_0x67a037){if(_0x30b95c){return _0x399d0f(_0x30b95c);}else{return _0x3a53fb(_0x67a037);}});});}function sentiment(_0x544502,_0x5c7572,_0x1b4a36,_0x2746ad,_0x495e43){return new Promise(function(_0x4a811a,_0x3ce657){var _0x52e8ce=new AWS[(_0x07a4('0x8'))]({'accessKeyId':_0x5c7572,'secretAccessKey':_0x544502,'region':_0x1b4a36});_0x52e8ce['detectSentiment']({'Text':_0x2746ad,'LanguageCode':_0x495e43[_0x07a4('0x9')](0x0,0x2)},function(_0x5b2640,_0x1b6807){if(_0x5b2640){return _0x3ce657(_0x5b2640);}else{return _0x4a811a(_0x1b6807);}});});}function checkTranscribeJob(_0x224bf9,_0x30cfee,_0x20d755){var _0x5210ff;return new BPromise(function(_0x6d3696,_0x30a6b9){logger[_0x07a4('0xa')](util['format'](_0x07a4('0xb'),_0x224bf9['id'],_0x224bf9['transcribeName']));return getTranscriptionJob(_0x20d755[_0x07a4('0xc')],_0x20d755[_0x07a4('0xd')],_0x30cfee[_0x07a4('0xe')],_0x224bf9[_0x07a4('0xf')])[_0x07a4('0x10')](function(_0x97372b){logger[_0x07a4('0xa')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x224bf9['id'],_0x224bf9[_0x07a4('0xf')],_0x97372b[_0x07a4('0x12')][_0x07a4('0x13')]));if(!_0x224bf9[_0x07a4('0x14')]){switch(_0x97372b[_0x07a4('0x12')]['TranscriptionJobStatus']){case _0x07a4('0x15'):var _0x4fea35={'transcribeStatus':_0x97372b['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x97372b[_0x07a4('0x12')][_0x07a4('0x16')][_0x07a4('0x17')]};logger['info'](util[_0x07a4('0x11')](_0x07a4('0x18'),_0x224bf9['id']));return rp({'uri':_0x97372b[_0x07a4('0x12')][_0x07a4('0x16')][_0x07a4('0x17')],'json':!![]})[_0x07a4('0x10')](function(_0x110356){logger[_0x07a4('0xa')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x224bf9['id']));if(_0x110356&&_0x110356[_0x07a4('0x19')]&&_0x110356['results']['transcripts']&&_0x110356[_0x07a4('0x19')][_0x07a4('0x1a')][_0x07a4('0x1b')]){_0x4fea35['fileText']='';for(var _0x223dd2=0x0;_0x223dd2<_0x110356[_0x07a4('0x19')][_0x07a4('0x1a')][_0x07a4('0x1b')];_0x223dd2++){_0x4fea35['fileText']+=_0x110356[_0x07a4('0x19')]['transcripts'][_0x223dd2][_0x07a4('0x1c')]+'';}}return _0x224bf9[_0x07a4('0x1d')](_0x4fea35);})[_0x07a4('0x10')](function(){logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x224bf9['id']));if(!_0x224bf9[_0x07a4('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x30cfee[_0x07a4('0x1f')]||!_0x30cfee[_0x07a4('0x20')]||!_0x30cfee[_0x07a4('0x21')]||!_0x30cfee['language']||!_0x30cfee[_0x07a4('0x22')]){throw new db['Sequelize'][(_0x07a4('0x23'))](_0x07a4('0x24'));}if(!_0x4fea35[_0x07a4('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x30cfee[_0x07a4('0x20')]===_0x20d755['id']){return _0x20d755;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x07a4('0x10')](function(_0x440b65){if(!_0x440b65){throw new db[(_0x07a4('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x440b65[_0x07a4('0xc')]||!_0x440b65[_0x07a4('0xd')]){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))](_0x07a4('0x26'));}_0x5210ff=_0x440b65;logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x224bf9['id']));return sentiment(_0x5210ff[_0x07a4('0xc')],_0x5210ff[_0x07a4('0xd')],_0x30cfee[_0x07a4('0x21')],_0x4fea35[_0x07a4('0x14')],_0x30cfee[_0x07a4('0x27')]);})[_0x07a4('0x10')](function(_0x5de9c9){logger['info'](util['format'](_0x07a4('0x28'),_0x224bf9['id']));return _0x224bf9[_0x07a4('0x1d')]({'sentiment':_0x5de9c9['Sentiment'],'sPositive':_0x5de9c9[_0x07a4('0x29')][_0x07a4('0x2a')],'sNegative':_0x5de9c9[_0x07a4('0x29')]['Negative'],'sMixed':_0x5de9c9[_0x07a4('0x29')][_0x07a4('0x2b')],'sNeutral':_0x5de9c9[_0x07a4('0x29')]['Neutral']});})[_0x07a4('0x10')](function(){logger['info'](util[_0x07a4('0x11')](_0x07a4('0x2c'),_0x224bf9['id']));_0x6d3696();});case _0x07a4('0x2d'):return _0x224bf9[_0x07a4('0x1d')]({'transcribeStatus':_0x07a4('0x2d'),'failureReason':_0x97372b[_0x07a4('0x12')][_0x07a4('0x2e')]})[_0x07a4('0x10')](function(){logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x224bf9['id']));_0x6d3696();});default:logger[_0x07a4('0xa')](util[_0x07a4('0x11')](_0x07a4('0x2f'),_0x224bf9['id']));break;}}else{return BPromise[_0x07a4('0x30')]()[_0x07a4('0x10')](function(){if(!_0x224bf9[_0x07a4('0x1e')]){throw new db['Sequelize']['ValidationError'](_0x07a4('0x31'));}if(!_0x30cfee[_0x07a4('0x1f')]||!_0x30cfee['sentimentAccountId']||!_0x30cfee[_0x07a4('0x21')]||!_0x30cfee[_0x07a4('0x27')]||!_0x30cfee[_0x07a4('0x22')]){throw new db['Sequelize'][(_0x07a4('0x23'))](_0x07a4('0x24'));}if(!_0x224bf9[_0x07a4('0x14')]){throw new Error(_0x07a4('0x32'));}if(_0x30cfee[_0x07a4('0x20')]===_0x20d755['id']){return _0x20d755;}else{return db[_0x07a4('0x33')][_0x07a4('0x34')]({'where':{'id':_settings[_0x07a4('0x20')]}});}})[_0x07a4('0x10')](function(_0x349d32){if(!_0x349d32){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))](_0x07a4('0x35'));}if(!_0x349d32['data1']||!_0x349d32[_0x07a4('0xd')]){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x5210ff=_0x349d32;logger['info'](util[_0x07a4('0x11')](_0x07a4('0x36'),_0x224bf9['id']));return sentiment(_0x5210ff[_0x07a4('0xc')],_0x5210ff[_0x07a4('0xd')],_0x30cfee[_0x07a4('0x21')],_0x224bf9[_0x07a4('0x14')],_0x30cfee['language']);})[_0x07a4('0x10')](function(_0x900844){logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x224bf9['id']));return _0x224bf9[_0x07a4('0x1d')]({'sentiment':_0x900844[_0x07a4('0x37')],'sPositive':_0x900844[_0x07a4('0x29')][_0x07a4('0x2a')],'sNegative':_0x900844[_0x07a4('0x29')][_0x07a4('0x38')],'sMixed':_0x900844['SentimentScore'][_0x07a4('0x2b')],'sNeutral':_0x900844[_0x07a4('0x29')]['Neutral'],'transcribeStatus':_0x07a4('0x15')});})[_0x07a4('0x10')](function(){logger[_0x07a4('0xa')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x224bf9['id']));_0x6d3696();});}})[_0x07a4('0x39')](function(_0x854328){if(_0x854328){if(!_0x854328[_0x07a4('0x3a')]||_0x854328[_0x07a4('0x3a')]!==_0x07a4('0x3b')){logger[_0x07a4('0x3c')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x224bf9['id']),util['inspect'](_0x854328,{'showHidden':![],'depth':null}));}}_0x6d3696();});});}function checkTranscribe(){var _0x57c9ff;var _0x56c09a;var _0x26c936;return db['VoiceRecording'][_0x07a4('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x07a4('0x10')](function(_0x178380){if(!_0x178380||!_0x178380[_0x07a4('0x1b')]){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))](_0x07a4('0x3e'));}_0x57c9ff=_0x178380;return db[_0x07a4('0x3f')]['findOne']({'where':{'id':0x1}});})[_0x07a4('0x10')](function(_0x3ee1da){if(!_0x3ee1da){throw new db['Sequelize'][(_0x07a4('0x23'))](_0x07a4('0x40'));}_0x56c09a=_0x3ee1da;if(!_0x56c09a[_0x07a4('0x6')]||!_0x56c09a[_0x07a4('0x41')]||!_0x56c09a[_0x07a4('0xe')]||!_0x56c09a[_0x07a4('0x27')]||!_0x56c09a[_0x07a4('0x22')]){throw new db['Sequelize'][(_0x07a4('0x23'))]('Transcribe\x20not\x20configured');}return db[_0x07a4('0x33')][_0x07a4('0x34')]({'where':{'id':_0x56c09a[_0x07a4('0x41')]}});})['then'](function(_0x20e06f){if(!_0x20e06f){throw new db[(_0x07a4('0x25'))]['ValidationError'](_0x07a4('0x35'));}if(!_0x20e06f[_0x07a4('0xc')]||!_0x20e06f[_0x07a4('0xd')]){throw new db[(_0x07a4('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x26c936=_0x20e06f;var _0x33d33b=[];_0x57c9ff[_0x07a4('0x42')](function(_0x27bd57){_0x33d33b[_0x07a4('0x43')](checkTranscribeJob(_0x27bd57,_0x56c09a,_0x26c936));});return BPromise['all'](_0x33d33b);})[_0x07a4('0x39')](function(_0x5e244f){if(_0x5e244f){if(!_0x5e244f[_0x07a4('0x3a')]||_0x5e244f[_0x07a4('0x3a')]!==_0x07a4('0x3b')){logger[_0x07a4('0x3c')](util[_0x07a4('0x44')](_0x5e244f,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index e329f9e..b3117c9 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 _0xc4a7=['defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis'];(function(_0x1c8558,_0x1f1250){var _0x5182c8=function(_0x170321){while(--_0x170321){_0x1c8558['push'](_0x1c8558['shift']());}};_0x5182c8(++_0x1f1250);}(_0xc4a7,0x163));var _0x7c4a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc4a7[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7c4a('0x0'));var moment=require(_0x7c4a('0x1'));var Redis=require(_0x7c4a('0x2'));var util=require(_0x7c4a('0x3'));var config=require('../../config/environment');var db=require(_0x7c4a('0x4'))['db'];var logger=require(_0x7c4a('0x5'))(_0x7c4a('0x6'));config[_0x7c4a('0x7')]=_[_0x7c4a('0x8')](config[_0x7c4a('0x7')],{'host':_0x7c4a('0x9'),'port':0x18eb});var io=require(_0x7c4a('0xa'))(new Redis(config[_0x7c4a('0x7')]));function closeInteractions(){var _0x31fb00=[];return db[_0x7c4a('0xb')][_0x7c4a('0xc')]({'raw':!![],'attributes':['id',_0x7c4a('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7c4a('0xe')](0x18,_0x7c4a('0xf'))}}})[_0x7c4a('0x10')](function(_0xc66d54){if(_0xc66d54&&_0xc66d54['length']){_0x31fb00=_['map'](_0xc66d54||[],'id');logger[_0x7c4a('0x11')](_0x7c4a('0x12'),_0x31fb00['join']());return db[_0x7c4a('0xb')][_0x7c4a('0x13')]({'closeReason':_0x7c4a('0x14'),'disposition':_0x7c4a('0x15'),'closed':!![],'closedAt':moment()[_0x7c4a('0x16')](_0x7c4a('0x17'))},{'where':{'id':_0x31fb00}});}})[_0x7c4a('0x10')](function(){if(_0x31fb00&&_0x31fb00[_0x7c4a('0x18')]){logger[_0x7c4a('0x11')](_0x7c4a('0x19'),_0x31fb00[_0x7c4a('0x1a')]());for(var _0x2b018c=0x0;_0x2b018c<_0x31fb00['length'];_0x2b018c++){io[_0x7c4a('0x1b')](_0x7c4a('0x1c'),{'id':_0x31fb00[_0x2b018c],'closed':!![]});}}})[_0x7c4a('0x1d')](function(_0x1db558){logger[_0x7c4a('0x1e')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1db558?util[_0x7c4a('0x1f')](_0x1db558,{'showHidden':![],'depth':null}):'');});}exports[_0x7c4a('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5c7b=['start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5c7b,0x9c));var _0xb5c7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x5c7b[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var moment=require(_0xb5c7('0x0'));var Redis=require(_0xb5c7('0x1'));var util=require(_0xb5c7('0x2'));var config=require(_0xb5c7('0x3'));var db=require(_0xb5c7('0x4'))['db'];var logger=require(_0xb5c7('0x5'))(_0xb5c7('0x6'));config[_0xb5c7('0x7')]=_[_0xb5c7('0x8')](config[_0xb5c7('0x7')],{'host':_0xb5c7('0x9'),'port':0x18eb});var io=require(_0xb5c7('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x181f72=[];return db[_0xb5c7('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb5c7('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb5c7('0xd')](0x18,'hours')}}})['then'](function(_0x2ddd14){if(_0x2ddd14&&_0x2ddd14[_0xb5c7('0xe')]){_0x181f72=_['map'](_0x2ddd14||[],'id');logger[_0xb5c7('0xf')](_0xb5c7('0x10'),_0x181f72[_0xb5c7('0x11')]());return db[_0xb5c7('0xb')]['update']({'closeReason':_0xb5c7('0x12'),'disposition':_0xb5c7('0x13'),'closed':!![],'closedAt':moment()[_0xb5c7('0x14')](_0xb5c7('0x15'))},{'where':{'id':_0x181f72}});}})[_0xb5c7('0x16')](function(){if(_0x181f72&&_0x181f72[_0xb5c7('0xe')]){logger['info'](_0xb5c7('0x17'),_0x181f72[_0xb5c7('0x11')]());for(var _0x3e532c=0x0;_0x3e532c<_0x181f72[_0xb5c7('0xe')];_0x3e532c++){io[_0xb5c7('0x18')](_0xb5c7('0x19'),{'id':_0x181f72[_0x3e532c],'closed':!![]});}}})[_0xb5c7('0x1a')](function(_0x28f7a4){logger[_0xb5c7('0x1b')](_0xb5c7('0x1c'),_0x28f7a4?util[_0xb5c7('0x1d')](_0x28f7a4,{'showHidden':![],'depth':null}):'');});}exports[_0xb5c7('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e991b87..b5d22f0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x407b=['finished\x20populating','contacts1','CmHopper','destroy','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','then','bulkCreate','log'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x407b,0x124));var _0xb407=function(_0x242732,_0x492dc1){_0x242732=_0x242732-0x0;var _0x5184c7=_0x407b[_0x242732];return _0x5184c7;};'use strict';var util=require(_0xb407('0x0'));var db=require(_0xb407('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb407('0x2')+i,'lastName':_0xb407('0x3')+i,'phone':0xf879fb460+i,'email':_0xb407('0x4')+i+_0xb407('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb407('0x6')]({'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[_0xb407('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb407('0x6')]({'id':i,'firstName':_0xb407('0x2')+i,'lastName':_0xb407('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb407('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb407('0x7')](),'updatedAt':Date['now']()});}db[_0xb407('0x8')]['destroy']({'where':{}})[_0xb407('0x9')](function(){return db['CmContact'][_0xb407('0xa')](contacts);})[_0xb407('0x9')](function(){console[_0xb407('0xb')](_0xb407('0xc'),_0xb407('0xd'));return db[_0xb407('0xe')][_0xb407('0xf')]({'where':{}});})[_0xb407('0x9')](function(){return db[_0xb407('0xe')][_0xb407('0xa')](hopper);})[_0xb407('0x9')](function(){console[_0xb407('0xb')](_0xb407('0xc'),'hopper1');return db[_0xb407('0x8')][_0xb407('0xa')](contacts2);})[_0xb407('0x9')](function(){console[_0xb407('0xb')](_0xb407('0xc'),'contacts2');return db['CmHopper'][_0xb407('0xa')](hopper2);})[_0xb407('0x9')](function(){console[_0xb407('0xb')](_0xb407('0xc'),'hopper2');})['catch'](function(_0x3dedb8){console['log'](_0x3dedb8);}); \ No newline at end of file +var _0xfc62=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','catch','util'];(function(_0x5f3497,_0x1092b7){var _0x5f3c39=function(_0x4ab08a){while(--_0x4ab08a){_0x5f3497['push'](_0x5f3497['shift']());}};_0x5f3c39(++_0x1092b7);}(_0xfc62,0x109));var _0x2fc6=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xfc62[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require(_0x2fc6('0x0'));var db=require(_0x2fc6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2fc6('0x2')]({'id':i,'firstName':_0x2fc6('0x3')+i,'lastName':_0x2fc6('0x4')+i,'phone':0xf879fb460+i,'email':_0x2fc6('0x5')+i+_0x2fc6('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x2fc6('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2fc6('0x7')](),'updatedAt':Date[_0x2fc6('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2fc6('0x2')]({'id':i,'firstName':_0x2fc6('0x3')+i,'lastName':_0x2fc6('0x4')+i,'phone':0xf879fb460+i,'email':_0x2fc6('0x5')+i+_0x2fc6('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2fc6('0x7')](),'updatedAt':Date['now']()});}db[_0x2fc6('0x8')][_0x2fc6('0x9')]({'where':{}})['then'](function(){return db[_0x2fc6('0x8')][_0x2fc6('0xa')](contacts);})[_0x2fc6('0xb')](function(){console[_0x2fc6('0xc')](_0x2fc6('0xd'),_0x2fc6('0xe'));return db[_0x2fc6('0xf')][_0x2fc6('0x9')]({'where':{}});})[_0x2fc6('0xb')](function(){return db[_0x2fc6('0xf')]['bulkCreate'](hopper);})[_0x2fc6('0xb')](function(){console[_0x2fc6('0xc')](_0x2fc6('0xd'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x2fc6('0xb')](function(){console['log'](_0x2fc6('0xd'),_0x2fc6('0x10'));return db[_0x2fc6('0xf')][_0x2fc6('0xa')](hopper2);})[_0x2fc6('0xb')](function(){console[_0x2fc6('0xc')](_0x2fc6('0xd'),_0x2fc6('0x11'));})[_0x2fc6('0x12')](function(_0x229cfc){console['log'](_0x229cfc);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1ec2c19..02bc591 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5027=['ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x5f4696,_0x560065){var _0x3c3e95=function(_0x2b5ab2){while(--_0x2b5ab2){_0x5f4696['push'](_0x5f4696['shift']());}};_0x3c3e95(++_0x560065);}(_0x5027,0xe6));var _0x7502=function(_0x1ac430,_0x119045){_0x1ac430=_0x1ac430-0x0;var _0x53509e=_0x5027[_0x1ac430];return _0x53509e;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7502('0x0')]({'name':util[_0x7502('0x1')](_0x7502('0x2'),'agent',i),'fullname':util[_0x7502('0x1')](_0x7502('0x2'),_0x7502('0x3'),i),'email':util[_0x7502('0x1')](_0x7502('0x4'),'agent',i),'role':'agent','password':_0x7502('0x5'),'internal':0xfa0+i,'type':_0x7502('0x6'),'transport':[_0x7502('0x7'),'ws',_0x7502('0x8')],'disallow':[_0x7502('0x9')],'allow':[_0x7502('0xa')],'defaultuser':util[_0x7502('0x1')]('%s%s',_0x7502('0x3'),i),'encryption':'yes','avpf':_0x7502('0xb'),'force_avp':_0x7502('0xb'),'icesupport':'yes','dtlsenable':_0x7502('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x7502('0xc'),'dtlssetup':_0x7502('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x7502('0x1')](_0x7502('0x2'),'agent',i),0xfa0+i)});}db[_0x7502('0xe')][_0x7502('0xf')](users)[_0x7502('0x10')](function(){console[_0x7502('0x11')](_0x7502('0x12'));})[_0x7502('0x13')](function(_0x4a4d31){console[_0x7502('0x11')](_0x4a4d31);}); \ No newline at end of file +var _0x80eb=['format','%s%s','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','agent'];(function(_0x519395,_0x302146){var _0x46302c=function(_0x22fca4){while(--_0x22fca4){_0x519395['push'](_0x519395['shift']());}};_0x46302c(++_0x302146);}(_0x80eb,0xe0));var _0xb80e=function(_0xef8900,_0x1db131){_0xef8900=_0xef8900-0x0;var _0x261ea6=_0x80eb[_0xef8900];return _0x261ea6;};'use strict';var util=require(_0xb80e('0x0'));var db=require(_0xb80e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb80e('0x2')]({'name':util['format']('%s%s',_0xb80e('0x3'),i),'fullname':util[_0xb80e('0x4')](_0xb80e('0x5'),_0xb80e('0x3'),i),'email':util[_0xb80e('0x4')](_0xb80e('0x6'),_0xb80e('0x3'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0xb80e('0x7'),'transport':[_0xb80e('0x8'),'ws',_0xb80e('0x9')],'disallow':['all'],'allow':[_0xb80e('0xa')],'defaultuser':util['format'](_0xb80e('0x5'),'agent',i),'encryption':_0xb80e('0xb'),'avpf':_0xb80e('0xb'),'force_avp':_0xb80e('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb80e('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xb80e('0x4')]('\x22%s\x22\x20<%s>',util['format'](_0xb80e('0x5'),_0xb80e('0x3'),i),0xfa0+i)});}db[_0xb80e('0xd')][_0xb80e('0xe')](users)[_0xb80e('0xf')](function(){console['log'](_0xb80e('0x10'));})[_0xb80e('0x11')](function(_0x366b12){console[_0xb80e('0x12')](_0x366b12);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 85612fb..d21c665 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc76e=['userProfileId','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','user','voice:outbound','VoiceQueues','OpenchannelQueue','Trunk','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','fax','sms','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','then','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find'];(function(_0x43f424,_0x5b1775){var _0x24ff0a=function(_0x58bc31){while(--_0x58bc31){_0x43f424['push'](_0x43f424['shift']());}};_0x24ff0a(++_0x5b1775);}(_0xc76e,0x10c));var _0xec76=function(_0x49060a,_0x1381ad){_0x49060a=_0x49060a-0x0;var _0x319689=_0xc76e[_0x49060a];return _0x319689;};'use strict';var _=require(_0xec76('0x0'));var util=require(_0xec76('0x1'));var BPromise=require(_0xec76('0x2'));var db=require(_0xec76('0x3'))['db'];var config=require(_0xec76('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xec76('0x5')],'attributes':['id',_0xec76('0x6'),'role'],'raw':!![],'where':{'role':_0xec76('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xec76('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xec76('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xec76('0x6')],'where':{'role':_0xec76('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xec76('0x6'),_0xec76('0x9')],'where':{'type':_0xec76('0xa')}};function getAssociatedResources(_0x3303cc,_0x34ae2f,_0x49bc55){return db[_0xec76('0xb')][_0xec76('0xc')]({'where':{'name':_0x3303cc,'userProfileId':_0x34ae2f},'raw':!![]})['then'](function(_0x2df5be){if(_0x2df5be){if(_0x2df5be[_0xec76('0xd')]){switch(_0x3303cc){case'VoiceQueues':case _0xec76('0xe'):case _0xec76('0xf'):case _0xec76('0x10'):case _0xec76('0x11'):case _0xec76('0x12'):case _0xec76('0x13'):return db[_0x49bc55][_0xec76('0x14')](queryQueues);case _0xec76('0x15'):return db[_0x49bc55][_0xec76('0x14')](queryTelephones);case _0xec76('0x16'):return db[_0x49bc55][_0xec76('0x14')](queryTrunks);case _0xec76('0x17'):return db[_0x49bc55][_0xec76('0x14')](queryCampaigns);}}else{return db[_0xec76('0x18')][_0xec76('0x14')]({'attributes':[_0xec76('0x19')],'where':{'sectionId':_0x2df5be['id']},'raw':!![]})['then'](function(_0xe2bf8d){if(_0xe2bf8d){var _0x490c76={'where':{'id':_[_0xec76('0x1a')](_0xe2bf8d,_0xec76('0x19'))},'raw':!![]};switch(_0x49bc55){case _0xec76('0x5'):_0x490c76[_0xec76('0x1b')][_0xec76('0x1c')]=_0xec76('0x8');break;case'Campaign':_0x490c76['where'][_0xec76('0x9')]=_0xec76('0xa');break;}return db[_0x49bc55][_0xec76('0x14')](_0x490c76);}else{return[];}});}}else{return[];}})[_0xec76('0x1d')](function(_0x190fe1){return _0x190fe1;});}function joinOrLeaveQueues(_0xbcd2f3,_0x35f8e1,_0x3ab610,_0x146313){_0xbcd2f3[_0x35f8e1](util[_0xec76('0x1e')](_0xec76('0x1f'),_0x3ab610,_0x146313[_0xec76('0x6')]));if(_0x146313['Agents']){for(var _0x1ef320=0x0;_0x1ef320<_0x146313[_0xec76('0x20')][_0xec76('0x21')];_0x1ef320+=0x1){_0xbcd2f3[_0x35f8e1](util[_0xec76('0x1e')](_0xec76('0x22'),_0x146313[_0xec76('0x20')][_0x1ef320][_0xec76('0x6')]));}}}function joinOrLeave(_0x582ae3,_0x5324f7,_0x91592a){var _0x50aa67;if(_0x582ae3[_0xec76('0x23')][_0xec76('0x24')]['id']){db[_0xec76('0x5')][_0xec76('0x25')]({'attributes':['id',_0xec76('0x6'),'role',_0xec76('0x26')],'where':{'id':_0x582ae3['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xec76('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xec76('0x28')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xec76('0x29')],'as':_0xec76('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xec76('0x2b')],'as':_0xec76('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xec76('0x2d')],'as':_0xec76('0x2e'),'attributes':['id'],'raw':!![]},{'model':db[_0xec76('0x2f')],'as':_0xec76('0x30'),'attributes':['id'],'raw':!![]}]})[_0xec76('0x1d')](function(_0x584574){if(_0x584574){_0x50aa67=_0x584574;_0x582ae3[_0x5324f7](util[_0xec76('0x1e')](_0xec76('0x22'),_0x584574['name']));var _0x3784cb=[];switch(_0x584574[_0xec76('0x1c')]){case _0xec76('0x31'):_0x582ae3[_0x5324f7](_0xec76('0x32'));_0x582ae3[_0x5324f7]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xec76('0x33'))){delete queryQueues[_0xec76('0x33')];}_0x3784cb[_0xec76('0x34')](db[_0xec76('0x35')][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db[_0xec76('0x36')][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db[_0xec76('0x37')][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db[_0xec76('0x38')][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db[_0xec76('0x39')][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db['OpenchannelQueue'][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db[_0xec76('0x3a')][_0xec76('0x14')](queryQueues));_0x3784cb[_0xec76('0x34')](db[_0xec76('0x5')][_0xec76('0x14')](queryTelephones));_0x3784cb[_0xec76('0x34')](db['Trunk'][_0xec76('0x14')](queryTrunks));_0x3784cb[_0xec76('0x34')](db['Campaign']['findAll'](queryCampaigns));_0x3784cb['push'](db[_0xec76('0x5')][_0xec76('0x14')](queryAgents));break;case _0xec76('0x3b'):_0x582ae3[_0x5324f7](_0xec76('0x32'));_0x582ae3[_0x5324f7](_0xec76('0x3c'));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x3d'),_0x584574[_0xec76('0x26')],_0xec76('0x35')));_0x3784cb['push'](getAssociatedResources('ChatQueues',_0x584574[_0xec76('0x26')],'ChatQueue'));_0x3784cb['push'](getAssociatedResources(_0xec76('0xf'),_0x584574[_0xec76('0x26')],_0xec76('0x37')));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x10'),_0x584574['userProfileId'],_0xec76('0x38')));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x11'),_0x584574[_0xec76('0x26')],_0xec76('0x39')));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x12'),_0x584574[_0xec76('0x26')],_0xec76('0x3e')));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x13'),_0x584574[_0xec76('0x26')],_0xec76('0x3a')));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x15'),_0x584574['userProfileId'],_0xec76('0x5')));_0x3784cb[_0xec76('0x34')](getAssociatedResources(_0xec76('0x16'),_0x584574[_0xec76('0x26')],_0xec76('0x3f')));_0x3784cb['push'](getAssociatedResources(_0xec76('0x17'),_0x584574[_0xec76('0x26')],_0xec76('0x40')));_0x3784cb['push'](db['User'][_0xec76('0x14')](queryAgents));break;case _0xec76('0x7'):_0x582ae3[_0x5324f7]('voice:inbound');_0x582ae3[_0x5324f7](_0xec76('0x3c'));_0x3784cb['push'](_0x584574[_0xec76('0x41')]({'attributes':['id',_0xec76('0x6')]}));_0x3784cb[_0xec76('0x34')](_0x584574[_0xec76('0x42')]({'attributes':['id',_0xec76('0x6')]}));_0x3784cb[_0xec76('0x34')](_0x584574[_0xec76('0x43')]({'attributes':['id',_0xec76('0x6')]}));_0x3784cb[_0xec76('0x34')](_0x584574[_0xec76('0x44')]({'attributes':['id',_0xec76('0x6')]}));_0x3784cb[_0xec76('0x34')](_0x584574[_0xec76('0x45')]({'attributes':['id',_0xec76('0x6')]}));_0x3784cb[_0xec76('0x34')](_0x584574[_0xec76('0x46')]({'attributes':['id',_0xec76('0x6')]}));_0x3784cb[_0xec76('0x34')](_0x584574['getWhatsappQueues']({'attributes':['id',_0xec76('0x6')]}));break;}return BPromise['all'](_0x3784cb);}})[_0xec76('0x1d')](function(_0xc223cc){if(_0xc223cc&&_0xc223cc[_0xec76('0x21')]){for(var _0x2c0dc0=0x0;_0x2c0dc0<_0xc223cc[_0xec76('0x21')];_0x2c0dc0+=0x1){for(var _0x46e905=0x0;_0x46e905<_0xc223cc[_0x2c0dc0]['length'];_0x46e905+=0x1){switch(_0x2c0dc0){case 0x0:joinOrLeaveQueues(_0x582ae3,_0x5324f7,_0xec76('0x47'),_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x1:joinOrLeaveQueues(_0x582ae3,_0x5324f7,'chat',_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x2:joinOrLeaveQueues(_0x582ae3,_0x5324f7,_0xec76('0x48'),_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x3:joinOrLeaveQueues(_0x582ae3,_0x5324f7,_0xec76('0x49'),_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x4:joinOrLeaveQueues(_0x582ae3,_0x5324f7,'mail',_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x5:joinOrLeaveQueues(_0x582ae3,_0x5324f7,'openchannel',_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x6:joinOrLeaveQueues(_0x582ae3,_0x5324f7,_0xec76('0x4a'),_0xc223cc[_0x2c0dc0][_0x46e905]);break;case 0x7:if(_0x50aa67[_0xec76('0x1c')]!==_0xec76('0x7'))_0x582ae3[_0x5324f7](util['format'](_0xec76('0x4b'),_0xc223cc[_0x2c0dc0][_0x46e905]['name']));break;case 0x8:if(_0x50aa67[_0xec76('0x1c')]!=='agent')_0x582ae3[_0x5324f7](util[_0xec76('0x1e')](_0xec76('0x4c'),_0xc223cc[_0x2c0dc0][_0x46e905]['name']));break;case 0x9:if(_0x50aa67[_0xec76('0x1c')]!==_0xec76('0x7'))_0x582ae3[_0x5324f7](util['format']('campaign:%s:%s',_0xc223cc[_0x2c0dc0][_0x46e905][_0xec76('0x9')],_0xc223cc[_0x2c0dc0][_0x46e905][_0xec76('0x6')]));break;case 0xa:_0x582ae3[_0x5324f7](util[_0xec76('0x1e')](_0xec76('0x22'),_0xc223cc[_0x2c0dc0][_0x46e905]['name']));break;}}}}})[_0xec76('0x1d')](function(){if(_0x5324f7===_0xec76('0x4d')){var _0x10b333=_[_0xec76('0x1a')](_0x50aa67[_0xec76('0x27')],'id');return _0x50aa67[_0xec76('0x4e')](_0x10b333)[_0xec76('0x1d')](function(){for(var _0x5617a2=0x0;_0x5617a2<_0x10b333[_0xec76('0x21')];_0x5617a2+=0x1){_0x91592a[_0xec76('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x10b333[_0x5617a2]),'UserId':Number(_0x50aa67['id'])});}});}})[_0xec76('0x1d')](function(){if(_0x5324f7==='leave'){var _0x4c15a8=_[_0xec76('0x1a')](_0x50aa67[_0xec76('0x50')],'id');return _0x50aa67[_0xec76('0x51')](_0x4c15a8)[_0xec76('0x1d')](function(){for(var _0x485f3c=0x0;_0x485f3c<_0x4c15a8[_0xec76('0x21')];_0x485f3c+=0x1){_0x91592a[_0xec76('0x4f')](_0xec76('0x52'),{'MailInteractionId':Number(_0x4c15a8[_0x485f3c]),'UserId':Number(_0x50aa67['id'])});}});}})[_0xec76('0x1d')](function(){if(_0x5324f7===_0xec76('0x4d')){var _0x95d82=_[_0xec76('0x1a')](_0x50aa67['FaxInteractions'],'id');return _0x50aa67['removeFaxInteractions'](_0x95d82)[_0xec76('0x1d')](function(){for(var _0x558991=0x0;_0x558991<_0x95d82[_0xec76('0x21')];_0x558991+=0x1){_0x91592a['emit'](_0xec76('0x53'),{'FaxInteractionId':Number(_0x95d82[_0x558991]),'UserId':Number(_0x50aa67['id'])});}});}})[_0xec76('0x1d')](function(){if(_0x5324f7===_0xec76('0x4d')){var _0x198dfd=_[_0xec76('0x1a')](_0x50aa67[_0xec76('0x2c')],'id');return _0x50aa67[_0xec76('0x54')](_0x198dfd)['then'](function(){for(var _0x243588=0x0;_0x243588<_0x198dfd[_0xec76('0x21')];_0x243588+=0x1){_0x91592a[_0xec76('0x4f')](_0xec76('0x55'),{'SmsInteractionId':Number(_0x198dfd[_0x243588]),'UserId':Number(_0x50aa67['id'])});}});}})['then'](function(){if(_0x5324f7===_0xec76('0x4d')){var _0x21e9f=_[_0xec76('0x1a')](_0x50aa67[_0xec76('0x2e')],'id');return _0x50aa67[_0xec76('0x56')](_0x21e9f)['then'](function(){for(var _0x378fb8=0x0;_0x378fb8<_0x21e9f[_0xec76('0x21')];_0x378fb8+=0x1){_0x91592a['emit'](_0xec76('0x57'),{'OpenchannelInteractionId':Number(_0x21e9f[_0x378fb8]),'UserId':Number(_0x50aa67['id'])});}});}})[_0xec76('0x1d')](function(){if(_0x5324f7===_0xec76('0x4d')){var _0x58e5d0=_['map'](_0x50aa67[_0xec76('0x30')],'id');return _0x50aa67[_0xec76('0x58')](_0x58e5d0)['then'](function(){for(var _0x27274f=0x0;_0x27274f<_0x58e5d0['length'];_0x27274f+=0x1){_0x91592a[_0xec76('0x4f')](_0xec76('0x59'),{'WhatsappInteractionId':Number(_0x58e5d0[_0x27274f]),'UserId':Number(_0x50aa67['id'])});}});}})['catch'](function(_0x4613e2){_0x582ae3[_0xec76('0x5a')](_0x4613e2);});}}function onDisconnect(_0x3f1715,_0x229bc1){joinOrLeave(_0x3f1715,'leave',_0x229bc1);}function onConnect(_0x217a0c){joinOrLeave(_0x217a0c,_0xec76('0x5b'));}exports['default']=function(_0xa95819){_0xa95819['on'](_0xec76('0x5c'),function(_0x4f4e0a){_0x4f4e0a[_0xec76('0x5d')](0x0);_0x4f4e0a[_0xec76('0x5e')]=_0x4f4e0a[_0xec76('0x5f')][_0xec76('0x5c')][_0xec76('0x60')]+':'+_0x4f4e0a['request']['connection'][_0xec76('0x61')];_0x4f4e0a['connectedAt']=new Date();_0x4f4e0a['log']=function(_0x31bb11){console[_0xec76('0x5a')](_0xec76('0x62')+_0x4f4e0a[_0xec76('0x63')][_0xec76('0x6')]+'['+_0x4f4e0a[_0xec76('0x5e')]+']',_0x31bb11);};_0x4f4e0a['on']('disconnect',function(){onDisconnect(_0x4f4e0a,_0xa95819);_0x4f4e0a['log'](_0xec76('0x64'));});onConnect(_0x4f4e0a);_0x4f4e0a[_0xec76('0x5a')](_0xec76('0x65'));});}; \ No newline at end of file +var _0x8e4f=['userProfileId','ChatInteraction','MailInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','FaxQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','type','format','length','user:%s','handshake','query'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x8e4f,0xa9));var _0xf8e4=function(_0x53a864,_0x46f773){_0x53a864=_0x53a864-0x0;var _0x5432d1=_0x8e4f[_0x53a864];return _0x5432d1;};'use strict';var _=require(_0xf8e4('0x0'));var util=require(_0xf8e4('0x1'));var BPromise=require(_0xf8e4('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xf8e4('0x3'));var queryQueues={'attributes':['id',_0xf8e4('0x4')],'include':[{'as':_0xf8e4('0x5'),'model':db[_0xf8e4('0x6')],'attributes':['id','name',_0xf8e4('0x7')],'raw':!![],'where':{'role':_0xf8e4('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf8e4('0x4')],'where':{'role':_0xf8e4('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf8e4('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xf8e4('0x4')],'where':{'role':_0xf8e4('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf8e4('0x4'),'type'],'where':{'type':_0xf8e4('0xa')}};function getAssociatedResources(_0xa4cbc9,_0x27697f,_0x133ea6){return db['UserProfileSection'][_0xf8e4('0xb')]({'where':{'name':_0xa4cbc9,'userProfileId':_0x27697f},'raw':!![]})[_0xf8e4('0xc')](function(_0x7fbfb){if(_0x7fbfb){if(_0x7fbfb[_0xf8e4('0xd')]){switch(_0xa4cbc9){case _0xf8e4('0xe'):case _0xf8e4('0xf'):case'FaxQueues':case _0xf8e4('0x10'):case _0xf8e4('0x11'):case'OpenchannelQueues':case _0xf8e4('0x12'):return db[_0x133ea6][_0xf8e4('0x13')](queryQueues);case _0xf8e4('0x14'):return db[_0x133ea6][_0xf8e4('0x13')](queryTelephones);case _0xf8e4('0x15'):return db[_0x133ea6][_0xf8e4('0x13')](queryTrunks);case _0xf8e4('0x16'):return db[_0x133ea6][_0xf8e4('0x13')](queryCampaigns);}}else{return db[_0xf8e4('0x17')][_0xf8e4('0x13')]({'attributes':[_0xf8e4('0x18')],'where':{'sectionId':_0x7fbfb['id']},'raw':!![]})[_0xf8e4('0xc')](function(_0x39848a){if(_0x39848a){var _0x490aa8={'where':{'id':_['map'](_0x39848a,'resourceId')},'raw':!![]};switch(_0x133ea6){case _0xf8e4('0x6'):_0x490aa8[_0xf8e4('0x19')][_0xf8e4('0x7')]='telephone';break;case _0xf8e4('0x1a'):_0x490aa8[_0xf8e4('0x19')][_0xf8e4('0x1b')]='ivr';break;}return db[_0x133ea6][_0xf8e4('0x13')](_0x490aa8);}else{return[];}});}}else{return[];}})['then'](function(_0x36b4f2){return _0x36b4f2;});}function joinOrLeaveQueues(_0x3713fb,_0x2f9ca4,_0x363bcd,_0x26436a){_0x3713fb[_0x2f9ca4](util[_0xf8e4('0x1c')]('%s:queue:%s',_0x363bcd,_0x26436a[_0xf8e4('0x4')]));if(_0x26436a[_0xf8e4('0x5')]){for(var _0x5e04df=0x0;_0x5e04df<_0x26436a[_0xf8e4('0x5')][_0xf8e4('0x1d')];_0x5e04df+=0x1){_0x3713fb[_0x2f9ca4](util[_0xf8e4('0x1c')](_0xf8e4('0x1e'),_0x26436a[_0xf8e4('0x5')][_0x5e04df][_0xf8e4('0x4')]));}}}function joinOrLeave(_0x212825,_0x3bea4f,_0x25c6bc){var _0x3be778;if(_0x212825[_0xf8e4('0x1f')][_0xf8e4('0x20')]['id']){db[_0xf8e4('0x6')]['find']({'attributes':['id','name',_0xf8e4('0x7'),_0xf8e4('0x21')],'where':{'id':_0x212825['handshake']['query']['id']},'include':[{'model':db[_0xf8e4('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x24')],'as':_0xf8e4('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x26')],'as':_0xf8e4('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x28')],'as':_0xf8e4('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf8e4('0xc')](function(_0x425c09){if(_0x425c09){_0x3be778=_0x425c09;_0x212825[_0x3bea4f](util['format'](_0xf8e4('0x1e'),_0x425c09['name']));var _0x5d6994=[];switch(_0x425c09[_0xf8e4('0x7')]){case _0xf8e4('0x2a'):_0x212825[_0x3bea4f](_0xf8e4('0x2b'));_0x212825[_0x3bea4f]('voice:outbound');if(queryQueues[_0xf8e4('0x2c')](_0xf8e4('0x2d'))){delete queryQueues['include'];}_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x2f')][_0xf8e4('0x13')](queryQueues));_0x5d6994['push'](db[_0xf8e4('0x30')]['findAll'](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x31')][_0xf8e4('0x13')](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x32')][_0xf8e4('0x13')](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x33')][_0xf8e4('0x13')](queryQueues));_0x5d6994['push'](db[_0xf8e4('0x34')][_0xf8e4('0x13')](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x35')][_0xf8e4('0x13')](queryQueues));_0x5d6994['push'](db[_0xf8e4('0x6')][_0xf8e4('0x13')](queryTelephones));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x36')][_0xf8e4('0x13')](queryTrunks));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x1a')][_0xf8e4('0x13')](queryCampaigns));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x6')]['findAll'](queryAgents));break;case _0xf8e4('0x37'):_0x212825[_0x3bea4f](_0xf8e4('0x2b'));_0x212825[_0x3bea4f](_0xf8e4('0x38'));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0xe'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x2f')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0xf'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x30')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x39'),_0x425c09[_0xf8e4('0x21')],'FaxQueue'));_0x5d6994['push'](getAssociatedResources('SmsQueues',_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x32')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x11'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x33')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x3a'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x34')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x12'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x35')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources('Telephones',_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x6')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x15'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x36')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x16'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x1a')));_0x5d6994['push'](db[_0xf8e4('0x6')][_0xf8e4('0x13')](queryAgents));break;case _0xf8e4('0x8'):_0x212825[_0x3bea4f](_0xf8e4('0x2b'));_0x212825[_0x3bea4f](_0xf8e4('0x38'));_0x5d6994['push'](_0x425c09[_0xf8e4('0x3b')]({'attributes':['id','name']}));_0x5d6994[_0xf8e4('0x2e')](_0x425c09[_0xf8e4('0x3c')]({'attributes':['id','name']}));_0x5d6994['push'](_0x425c09['getFaxQueues']({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994['push'](_0x425c09['getSmsQueues']({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994['push'](_0x425c09[_0xf8e4('0x3d')]({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994[_0xf8e4('0x2e')](_0x425c09['getOpenchannelQueues']({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994[_0xf8e4('0x2e')](_0x425c09[_0xf8e4('0x3e')]({'attributes':['id',_0xf8e4('0x4')]}));break;}return BPromise[_0xf8e4('0x3f')](_0x5d6994);}})[_0xf8e4('0xc')](function(_0x270489){if(_0x270489&&_0x270489[_0xf8e4('0x1d')]){for(var _0x4f785b=0x0;_0x4f785b<_0x270489[_0xf8e4('0x1d')];_0x4f785b+=0x1){for(var _0x28b00d=0x0;_0x28b00d<_0x270489[_0x4f785b][_0xf8e4('0x1d')];_0x28b00d+=0x1){switch(_0x4f785b){case 0x0:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x40'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x1:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x41'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x2:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x42'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x3:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x43'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x4:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x44'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x5:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x45'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x6:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x46'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x7:if(_0x3be778['role']!==_0xf8e4('0x8'))_0x212825[_0x3bea4f](util[_0xf8e4('0x1c')](_0xf8e4('0x47'),_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;case 0x8:if(_0x3be778[_0xf8e4('0x7')]!=='agent')_0x212825[_0x3bea4f](util['format'](_0xf8e4('0x48'),_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;case 0x9:if(_0x3be778[_0xf8e4('0x7')]!==_0xf8e4('0x8'))_0x212825[_0x3bea4f](util['format'](_0xf8e4('0x49'),_0x270489[_0x4f785b][_0x28b00d]['type'],_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;case 0xa:_0x212825[_0x3bea4f](util[_0xf8e4('0x1c')](_0xf8e4('0x1e'),_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;}}}}})[_0xf8e4('0xc')](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x5b59bb=_[_0xf8e4('0x4b')](_0x3be778[_0xf8e4('0x4c')],'id');return _0x3be778[_0xf8e4('0x4d')](_0x5b59bb)[_0xf8e4('0xc')](function(){for(var _0x3a1b5a=0x0;_0x3a1b5a<_0x5b59bb[_0xf8e4('0x1d')];_0x3a1b5a+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x4f'),{'ChatInteractionId':Number(_0x5b59bb[_0x3a1b5a]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0xc')](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x591af3=_[_0xf8e4('0x4b')](_0x3be778['MailInteractions'],'id');return _0x3be778[_0xf8e4('0x50')](_0x591af3)[_0xf8e4('0xc')](function(){for(var _0x27bcf5=0x0;_0x27bcf5<_0x591af3[_0xf8e4('0x1d')];_0x27bcf5+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x51'),{'MailInteractionId':Number(_0x591af3[_0x27bcf5]),'UserId':Number(_0x3be778['id'])});}});}})['then'](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x2848d2=_[_0xf8e4('0x4b')](_0x3be778['FaxInteractions'],'id');return _0x3be778[_0xf8e4('0x52')](_0x2848d2)[_0xf8e4('0xc')](function(){for(var _0x34f84d=0x0;_0x34f84d<_0x2848d2['length'];_0x34f84d+=0x1){_0x25c6bc['emit'](_0xf8e4('0x53'),{'FaxInteractionId':Number(_0x2848d2[_0x34f84d]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0xc')](function(){if(_0x3bea4f==='leave'){var _0x330c63=_[_0xf8e4('0x4b')](_0x3be778[_0xf8e4('0x25')],'id');return _0x3be778[_0xf8e4('0x54')](_0x330c63)[_0xf8e4('0xc')](function(){for(var _0x3c1fba=0x0;_0x3c1fba<_0x330c63[_0xf8e4('0x1d')];_0x3c1fba+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x55'),{'SmsInteractionId':Number(_0x330c63[_0x3c1fba]),'UserId':Number(_0x3be778['id'])});}});}})['then'](function(){if(_0x3bea4f==='leave'){var _0x3174ac=_[_0xf8e4('0x4b')](_0x3be778[_0xf8e4('0x27')],'id');return _0x3be778['removeOpenchannelInteractions'](_0x3174ac)[_0xf8e4('0xc')](function(){for(var _0x10605d=0x0;_0x10605d<_0x3174ac[_0xf8e4('0x1d')];_0x10605d+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x56'),{'OpenchannelInteractionId':Number(_0x3174ac[_0x10605d]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0xc')](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x41a6c3=_['map'](_0x3be778['WhatsappInteractions'],'id');return _0x3be778[_0xf8e4('0x57')](_0x41a6c3)[_0xf8e4('0xc')](function(){for(var _0x426607=0x0;_0x426607<_0x41a6c3['length'];_0x426607+=0x1){_0x25c6bc[_0xf8e4('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x41a6c3[_0x426607]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0x58')](function(_0x2f1ef9){_0x212825['log'](_0x2f1ef9);});}}function onDisconnect(_0x2c5a93,_0x1bab7a){joinOrLeave(_0x2c5a93,_0xf8e4('0x4a'),_0x1bab7a);}function onConnect(_0x31d615){joinOrLeave(_0x31d615,'join');}exports[_0xf8e4('0x59')]=function(_0x37706f){_0x37706f['on'](_0xf8e4('0x5a'),function(_0x2b0cea){_0x2b0cea[_0xf8e4('0x5b')](0x0);_0x2b0cea[_0xf8e4('0x5c')]=_0x2b0cea[_0xf8e4('0x5d')][_0xf8e4('0x5a')][_0xf8e4('0x5e')]+':'+_0x2b0cea[_0xf8e4('0x5d')][_0xf8e4('0x5a')]['remotePort'];_0x2b0cea[_0xf8e4('0x5f')]=new Date();_0x2b0cea[_0xf8e4('0x60')]=function(_0x5872d5){console[_0xf8e4('0x60')]('SocketIO\x20'+_0x2b0cea[_0xf8e4('0x61')][_0xf8e4('0x4')]+'['+_0x2b0cea[_0xf8e4('0x5c')]+']',_0x5872d5);};_0x2b0cea['on'](_0xf8e4('0x62'),function(){onDisconnect(_0x2b0cea,_0x37706f);_0x2b0cea['log'](_0xf8e4('0x63'));});onConnect(_0x2b0cea);_0x2b0cea['log'](_0xf8e4('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 96b3729..d5b623d 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 _0x592f=['http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','ChatOfflineMessage','Sms','SmsInteraction','newmessage','WhatsappInteraction','Whatsapp','closedinteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','catch','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','incomingmessage','outgoingmessage','get','opened','SIP/%s','closed','changed','substatus','AfterUpdate','User','find','email','default','length','hasOwnProperty','hook','callback','util','../../mysqldb','jayson/promise','../logger','triggers','client'];(function(_0x3e8fda,_0x41f10b){var _0x32e551=function(_0x3f2d67){while(--_0x3f2d67){_0x3e8fda['push'](_0x3e8fda['shift']());}};_0x32e551(++_0x41f10b);}(_0x592f,0x15d));var _0xf592=function(_0x332f02,_0x4ec7db){_0x332f02=_0x332f02-0x0;var _0x46f93f=_0x592f[_0x332f02];return _0x46f93f;};'use strict';var util=require(_0xf592('0x0'));var db=require(_0xf592('0x1'))['db'];var jayson=require(_0xf592('0x2'));var logger=require(_0xf592('0x3'))(_0xf592('0x4'));var client=jayson[_0xf592('0x5')][_0xf592('0x6')]({'port':0x232a});var triggers=[{'channel':_0xf592('0x7'),'model':'ChatInteraction','event':_0xf592('0x8'),'condition':_0xf592('0x9'),'callback':afterCreate},{'channel':_0xf592('0x7'),'model':_0xf592('0xa'),'event':_0xf592('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf592('0x7'),'model':'ChatMessage','event':_0xf592('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf592('0x7'),'model':_0xf592('0xc'),'event':_0xf592('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xf592('0xd'),'model':_0xf592('0xe'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xf592('0xe'),'event':_0xf592('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0xf592('0x8'),'condition':_0xf592('0xf'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xf592('0x10'),'event':_0xf592('0x8'),'condition':_0xf592('0x9'),'callback':afterCreate},{'channel':_0xf592('0x11'),'model':_0xf592('0x10'),'event':_0xf592('0xb'),'condition':_0xf592('0x12'),'callback':afterUpdate},{'channel':_0xf592('0x11'),'model':_0xf592('0x13'),'event':_0xf592('0x8'),'condition':_0xf592('0xf'),'callback':afterCreateMessage},{'channel':_0xf592('0x14'),'model':_0xf592('0x15'),'event':_0xf592('0x8'),'condition':_0xf592('0x9'),'callback':afterCreate},{'channel':_0xf592('0x14'),'model':'FaxInteraction','event':_0xf592('0xb'),'condition':_0xf592('0x12'),'callback':afterUpdate},{'channel':_0xf592('0x14'),'model':_0xf592('0x16'),'event':_0xf592('0x8'),'condition':_0xf592('0xf'),'callback':afterCreateMessage},{'channel':_0xf592('0x17'),'model':_0xf592('0x18'),'event':_0xf592('0x8'),'condition':_0xf592('0x9'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0xf592('0xb'),'condition':_0xf592('0x12'),'callback':afterUpdate},{'channel':_0xf592('0x17'),'model':_0xf592('0x19'),'event':'afterCreate','condition':_0xf592('0xf'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xf592('0x1a'),'event':_0xf592('0x8'),'condition':_0xf592('0x9'),'callback':afterCreate},{'channel':_0xf592('0x1b'),'model':_0xf592('0x1a'),'event':_0xf592('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf592('0x1b'),'model':_0xf592('0x1c'),'event':_0xf592('0x8'),'condition':_0xf592('0xf'),'callback':afterCreateMessage}];function request(_0x2fabfc){return client['request'](_0xf592('0x1d'),_0x2fabfc)[_0xf592('0x1e')](function(_0x6035af){logger[_0xf592('0x1f')](_0xf592('0x20'),_0xf592('0x1d'),_0x6035af);if(_0x6035af[_0xf592('0x21')]){if(_0x6035af[_0xf592('0x21')]['code']===0x1f4){logger[_0xf592('0x21')](_0xf592('0x20'),_0xf592('0x1d'),_0x6035af[_0xf592('0x21')]);}}})[_0xf592('0x22')](function(_0x59ca2a){logger[_0xf592('0x21')]('Trigger,\x20%s',_0xf592('0x1d'),_0x59ca2a);});}function afterCreateMessage(_0x2f9529){return function(_0x53adcd){_0x53adcd=_0x53adcd['get']({'plain':!![]});_0x53adcd[_0xf592('0x23')]=_0x2f9529;_0x53adcd[_0xf592('0x24')]=_0x2f9529;_0x53adcd[_0xf592('0x25')]=_0x53adcd[_0xf592('0x26')];Promise[_0xf592('0x27')]()[_0xf592('0x1e')](function(){if(typeof _0x53adcd[_0xf592('0x28')]===_0xf592('0x29'))return null;var _0x3dc01a=_0xf592('0x2a')+_0x53adcd[_0xf592('0x28')];return db[_0xf592('0x2b')][_0xf592('0x2c')](_0x3dc01a,{'type':db[_0xf592('0x2d')][_0xf592('0x2e')][_0xf592('0x2f')],'raw':!![]});})[_0xf592('0x1e')](function(_0x1ebabe){if(_0x1ebabe){_0x53adcd[_0xf592('0x30')]=_0x1ebabe[0x0];}if(typeof _0x53adcd[_0xf592('0x31')]===_0xf592('0x29'))return;return getAgent(_0x53adcd[_0xf592('0x31')]);})[_0xf592('0x1e')](function(_0x5f4d6e){if(_0x5f4d6e){_0x53adcd[_0xf592('0x32')]=util[_0xf592('0x33')]('SIP/%s',_0x5f4d6e[_0xf592('0x34')]);_0x53adcd[_0xf592('0x35')]=_0x5f4d6e;_0x53adcd[_0xf592('0x23')]=_0x2f9529;return request({'event':_0xf592('0x36'),'message':_0x53adcd});}else{return request({'event':_0xf592('0x37'),'message':_0x53adcd});}})[_0xf592('0x22')](function(_0x3345de){logger[_0xf592('0x21')](_0xf592('0x20'),'AfterCreateMessage',_0x3345de);});};}function afterCreateOfflineMessage(_0x250616){return function(_0x4f35f8){_0x4f35f8=_0x4f35f8[_0xf592('0x38')]({'plain':!![]});_0x4f35f8[_0xf592('0x23')]=_0x250616;_0x4f35f8[_0xf592('0x24')]=_0x250616;_0x4f35f8[_0xf592('0x25')]='offlineMessage';return request({'event':_0x4f35f8[_0xf592('0x25')],'message':_0x4f35f8});};}function afterCreate(_0x513508,_0x4a3f93){return function(_0x1e5da6){_0x1e5da6=_0x1e5da6[_0xf592('0x38')]({'plain':!![]});_0x1e5da6[_0xf592('0x23')]=_0x513508;_0x1e5da6[_0xf592('0x24')]=_0x513508;_0x1e5da6[_0xf592('0x25')]=_0xf592('0x39');Promise['resolve']()['then'](function(){var _0x54a8d7=_0xf592('0x2a')+_0x1e5da6['ContactId'];return db['sequelize']['query'](_0x54a8d7,{'type':db[_0xf592('0x2d')][_0xf592('0x2e')][_0xf592('0x2f')],'raw':!![]});})['then'](function(_0x3ce307){if(_0x3ce307){_0x1e5da6[_0xf592('0x30')]=_0x3ce307[0x0];}if(typeof _0x1e5da6[_0xf592('0x31')]===_0xf592('0x29'))return;return getAgent(_0x1e5da6[_0xf592('0x31')]);})['then'](function(_0x13930d){if(_0x13930d){_0x1e5da6[_0xf592('0x32')]=util[_0xf592('0x33')](_0xf592('0x3a'),_0x13930d[_0xf592('0x34')]);_0x1e5da6[_0xf592('0x35')]=_0x13930d;}return request({'event':_0x4a3f93,'message':_0x1e5da6});})[_0xf592('0x22')](function(_0x2010db){logger['error'](_0xf592('0x20'),'AfterCreate',_0x2010db);});};}function afterUpdate(_0x307478){return function(_0x5b73ee){var _0x249ea5=_0x5b73ee['changed'](_0xf592('0x3b'))&&_0x5b73ee[_0xf592('0x3b')];var _0x1bccf7=_0x5b73ee[_0xf592('0x3c')]('substatus');if(_0x249ea5||_0x1bccf7){var _0x4d2062=_0x249ea5?_0xf592('0x12'):_0xf592('0x3d');var _0x84eeab=_0x5b73ee[_0xf592('0x38')]({'plain':!![]});_0x84eeab[_0xf592('0x23')]=_0x307478;_0x84eeab[_0xf592('0x24')]=_0x307478;_0x84eeab[_0xf592('0x25')]=_0x249ea5?'closed':_0xf592('0x3d');var _0x12b640='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x84eeab['ContactId'];return db[_0xf592('0x2b')]['query'](_0x12b640,{'type':db[_0xf592('0x2d')][_0xf592('0x2e')]['SELECT'],'raw':!![]})[_0xf592('0x1e')](function(_0x4ee112){if(_0x4ee112){_0x84eeab[_0xf592('0x30')]=_0x4ee112[0x0];}if(typeof _0x84eeab[_0xf592('0x31')]===_0xf592('0x29'))return;return getAgent(_0x84eeab[_0xf592('0x31')]);})[_0xf592('0x1e')](function(_0x45f2db){if(_0x45f2db){_0x84eeab[_0xf592('0x32')]=util[_0xf592('0x33')](_0xf592('0x3a'),_0x45f2db[_0xf592('0x34')]);_0x84eeab[_0xf592('0x35')]=_0x45f2db;}return request({'event':_0x4d2062,'message':_0x84eeab});})[_0xf592('0x22')](function(_0x29cc27){logger['error'](_0xf592('0x20'),_0xf592('0x3e'),_0x29cc27);});}};}function getAgent(_0x62e6bf){return db[_0xf592('0x3f')][_0xf592('0x40')]({'where':{'id':_0x62e6bf},'attributes':['id','name','fullname',_0xf592('0x41'),'internal'],'raw':!![]})['then'](function(_0x1d0231){return _0x1d0231;});}exports[_0xf592('0x42')]=function(){for(var _0xf7e0ea=0x0;_0xf7e0ea=_0x40e742[_0x8106('0x13')]){throw Error(_0x8106('0x14'));}_0x3811ac(_0x25e75c);})[_0x8106('0x15')](function(_0x46b4cd){_0x2be97d(_0x46b4cd);});});}; \ No newline at end of file +var _0xebc2=['getLicense','agents','catch','lodash','bluebird','./license/util','mail','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','User','count','agent','then'];(function(_0x369ea1,_0x487dd8){var _0x1df445=function(_0x17b79c){while(--_0x17b79c){_0x369ea1['push'](_0x369ea1['shift']());}};_0x1df445(++_0x487dd8);}(_0xebc2,0x14d));var _0x2ebc=function(_0x3e55b7,_0x2fe831){_0x3e55b7=_0x3e55b7-0x0;var _0x5f5c03=_0xebc2[_0x3e55b7];return _0x5f5c03;};'use strict';var _=require(_0x2ebc('0x0'));var BPromise=require(_0x2ebc('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x2ebc('0x2'));var channels=['voice',_0x2ebc('0x3'),'chat',_0x2ebc('0x4'),'sms',_0x2ebc('0x5'),_0x2ebc('0x6')];exports[_0x2ebc('0x7')]=function(){return channels;};exports[_0x2ebc('0x8')]=function(_0x4fcb40){_0x4fcb40=_0x4fcb40[_0x2ebc('0x9')]();return _['includes'](channels,_0x4fcb40);};exports[_0x2ebc('0xa')]=function(_0x8ff834,_0x30a906,_0x186b8f,_0x3729d8){var _0xb296b8={'loginAttempts':_0x30a906,'blocked':_0x186b8f};if(!_[_0x2ebc('0xb')](_0x3729d8)){_0xb296b8[_0x2ebc('0xc')]=_0x3729d8;}return _0x8ff834[_0x2ebc('0xd')](_0xb296b8);};exports['getLicense']=function(_0x2e2472){return new BPromise(function(_0x1ba0bd,_0x484710){var _0x1c63ea=0x0;if(_0x2e2472[_0x2ebc('0xe')]!=='agent'){_0x1ba0bd(_0x2e2472);}db[_0x2ebc('0xf')][_0x2ebc('0x10')]({'where':{'role':_0x2ebc('0x11'),'online':!![],'id':{'$ne':_0x2e2472['id']}}})[_0x2ebc('0x12')](function(_0x456998){_0x1c63ea=_0x456998;return util[_0x2ebc('0x13')]();})[_0x2ebc('0x12')](function(_0x518d24){if(_0x518d24&&_0x518d24['agents']&&_0x1c63ea>=_0x518d24[_0x2ebc('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1ba0bd(_0x2e2472);})[_0x2ebc('0x15')](function(_0x28ea3f){_0x484710(_0x28ea3f);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index ad903fd..b5d4c60 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d5a=['Resource\x20Conflict','error','statusMessage','status','send','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','inherits','Forbidden','Out\x20Of\x20Interval','code','details','OutOfInterval'];(function(_0x45941b,_0x507b13){var _0x363732=function(_0x22fd57){while(--_0x22fd57){_0x45941b['push'](_0x45941b['shift']());}};_0x363732(++_0x507b13);}(_0x7d5a,0x149));var _0xa7d5=function(_0x484da0,_0x1118e9){_0x484da0=_0x484da0-0x0;var _0x1a1d3b=_0x7d5a[_0x484da0];return _0x1a1d3b;};'use strict';var util=require(_0xa7d5('0x0'));var logger=require(_0xa7d5('0x1'))('api');var APIError=function(_0x481b2b,_0x4aaf2d){this[_0xa7d5('0x2')]=_0x481b2b||_0xa7d5('0x3');this[_0xa7d5('0x4')]=_0x4aaf2d||_0xa7d5('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x507233){this[_0xa7d5('0x2')]=_0x507233||'Bad\x20Request';this[_0xa7d5('0x4')]=_0xa7d5('0x6');util[_0xa7d5('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x94c155){this[_0xa7d5('0x2')]=_0x94c155||'Forbidden';this['name']=_0xa7d5('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3e9845){this[_0xa7d5('0x2')]=_0x3e9845||'Entity\x20not\x20found';this[_0xa7d5('0x4')]='Not\x20Found';util[_0xa7d5('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x49eb34){this[_0xa7d5('0x2')]=_0x49eb34||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xa7d5('0x4')]=_0xa7d5('0x9');this[_0xa7d5('0xa')]=0x193;this[_0xa7d5('0xb')]={'type':_0xa7d5('0xc')};util[_0xa7d5('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1f54a0){this[_0xa7d5('0x2')]=_0x1f54a0||_0xa7d5('0xd');this[_0xa7d5('0x4')]='Conflict';util[_0xa7d5('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x54a61f){switch(_0x54a61f){case'Bad\x20Request':return 0x190;case _0xa7d5('0x8'),_0xa7d5('0x9'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x148b46){if(_0x148b46===_0xa7d5('0x9'))return _0x148b46;return null;}function handleError(_0x5725da){return function(_0x549b58){logger[_0xa7d5('0xe')](_0x549b58['stack']);var _0x2c2b97=getStatusCode(_0x549b58[_0xa7d5('0x4')]);var _0x4caa37=getCustomStatusMessage(_0x549b58[_0xa7d5('0x4')]);if(_0x549b58['name']){delete _0x549b58['name'];}if(_0x4caa37){_0x5725da[_0xa7d5('0xf')]=_0x4caa37;}return _0x5725da[_0xa7d5('0x10')](_0x2c2b97)[_0xa7d5('0x11')](_0x549b58);};}module[_0xa7d5('0x12')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x0e91=['statusMessage','send','util','api','Internal\x20Server\x20Error','Error','message','Bad\x20Request','name','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack'];(function(_0x25fef5,_0x4e9f16){var _0xf6a626=function(_0x366ff6){while(--_0x366ff6){_0x25fef5['push'](_0x25fef5['shift']());}};_0xf6a626(++_0x4e9f16);}(_0x0e91,0x86));var _0x10e9=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x0e91[_0x138f59];return _0x3d114d;};'use strict';var util=require(_0x10e9('0x0'));var logger=require('../config/logger')(_0x10e9('0x1'));var APIError=function(_0x24fce1,_0x201f29){this['message']=_0x24fce1||_0x10e9('0x2');this['name']=_0x201f29||_0x10e9('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x38dac7){this[_0x10e9('0x4')]=_0x38dac7||_0x10e9('0x5');this[_0x10e9('0x6')]=_0x10e9('0x5');util[_0x10e9('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x28771e){this['message']=_0x28771e||_0x10e9('0x8');this[_0x10e9('0x6')]='Forbidden';util[_0x10e9('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3c2183){this[_0x10e9('0x4')]=_0x3c2183||_0x10e9('0x9');this[_0x10e9('0x6')]=_0x10e9('0xa');util[_0x10e9('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2f086e){this[_0x10e9('0x4')]=_0x2f086e||_0x10e9('0xb');this[_0x10e9('0x6')]=_0x10e9('0xc');this[_0x10e9('0xd')]=0x193;this[_0x10e9('0xe')]={'type':_0x10e9('0xf')};util[_0x10e9('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3523d1){this[_0x10e9('0x4')]=_0x3523d1||_0x10e9('0x10');this[_0x10e9('0x6')]=_0x10e9('0x11');util[_0x10e9('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x17d32a){switch(_0x17d32a){case _0x10e9('0x5'):return 0x190;case _0x10e9('0x8'),_0x10e9('0xc'):return 0x193;case _0x10e9('0xa'):return 0x194;case _0x10e9('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x555a0b){if(_0x555a0b==='Out\x20Of\x20Interval')return _0x555a0b;return null;}function handleError(_0x1490d0){return function(_0x56b243){logger[_0x10e9('0x12')](_0x56b243[_0x10e9('0x13')]);var _0x429560=getStatusCode(_0x56b243[_0x10e9('0x6')]);var _0x1aa292=getCustomStatusMessage(_0x56b243[_0x10e9('0x6')]);if(_0x56b243[_0x10e9('0x6')]){delete _0x56b243[_0x10e9('0x6')];}if(_0x1aa292){_0x1490d0[_0x10e9('0x14')]=_0x1aa292;}return _0x1490d0['status'](_0x429560)[_0x10e9('0x15')](_0x56b243);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 762f8d5..71bf658 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76c1=['json','exports','404','status'];(function(_0x3d5db9,_0x2dbe0a){var _0x3c114c=function(_0x3e0239){while(--_0x3e0239){_0x3d5db9['push'](_0x3d5db9['shift']());}};_0x3c114c(++_0x2dbe0a);}(_0x76c1,0x1b5));var _0x176c=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x76c1[_0xdd2bfa];return _0x55397e;};'use strict';module[_0x176c('0x0')][0x194]=function pageNotFound(_0x2b968f,_0x43a14e){var _0x1eac65=_0x176c('0x1');var _0x41f01d=0x194;var _0x19b248={'status':_0x41f01d};_0x43a14e['status'](_0x19b248[_0x176c('0x2')]);_0x43a14e['render'](_0x1eac65,{},function(_0x5a2f77,_0x4c7aae){if(_0x5a2f77){return _0x43a14e['status'](_0x19b248[_0x176c('0x2')])[_0x176c('0x3')](_0x19b248);}_0x43a14e['send'](_0x4c7aae);});}; \ No newline at end of file +var _0xf635=['404','status','render','json'];(function(_0x5f150e,_0x5e3a1e){var _0x2f6957=function(_0x58db60){while(--_0x58db60){_0x5f150e['push'](_0x5f150e['shift']());}};_0x2f6957(++_0x5e3a1e);}(_0xf635,0x158));var _0x5f63=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0xf635[_0x3bf925];return _0x2128a1;};'use strict';module['exports'][0x194]=function pageNotFound(_0x53a3d1,_0x321ad1){var _0x4c3a59=_0x5f63('0x0');var _0x38e94a=0x194;var _0x15af62={'status':_0x38e94a};_0x321ad1[_0x5f63('0x1')](_0x15af62[_0x5f63('0x1')]);_0x321ad1[_0x5f63('0x2')](_0x4c3a59,{},function(_0x15ca06,_0x1113b2){if(_0x15ca06){return _0x321ad1[_0x5f63('0x1')](_0x15af62[_0x5f63('0x1')])[_0x5f63('0x3')](_0x15af62);}_0x321ad1['send'](_0x1113b2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 49fee47..c6dd551 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c3b=['../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','OpenchannelInteraction','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','CmHopper','Hoppers','belongsToMany','ChatGroup','Groups','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteraction','user_has_sms_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','VoiceExtension','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkBackup','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','AgentReports','ContactId','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Answers','Messages','List','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','MailInteractionId','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','Interactions','IntervalId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','Queue','ChatQueueId','ChatInteractionId','ChatMessage','team_has_chat_queues','ChatInternalMessage','ChatGroupId','chat_group_has_users','Website','CompanyId','Phones','CmContactId','ChatInteractions','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticCustomReport','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','SugarcrmField','Description','int_desk_configuration_has_tags','ZohoField','Subject','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','Dynamics365Account','Dynamics365Configuration','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','CampaignId','TrunkId','TrunkBackupId','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','motion2','xcall','xC@LL1234','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','127.0.0.1','name','database','username','options','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5c3b,0x1d4));var _0xb5c3=function(_0x19a4ac,_0x5d763d){_0x19a4ac=_0x19a4ac-0x0;var _0x8f3876=_0x5c3b[_0x19a4ac];return _0x8f3876;};'use strict';var config=require(_0xb5c3('0x0'));var Sequelize=require(_0xb5c3('0x1'));var _=require(_0xb5c3('0x2'));var jstz=require(_0xb5c3('0x3'));var timezone=jstz['determine']();config[_0xb5c3('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0xb5c3('0x4'),'username':_0xb5c3('0x5'),'password':_0xb5c3('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb5c3('0x7'),'dialectOptions':{'charset':_0xb5c3('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xb5c3('0x9'),'collate':_0xb5c3('0xa')}}});config[_0xb5c3('0xb')]=_[_0xb5c3('0xc')](config[_0xb5c3('0xb')],{'database':_0xb5c3('0x4'),'username':_0xb5c3('0x5'),'password':_0xb5c3('0x6'),'options':{'host':_0xb5c3('0xd'),'port':0xcea,'dialect':_0xb5c3('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xb5c3('0xe')](),'define':{'charset':_0xb5c3('0x9'),'collate':_0xb5c3('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb5c3('0x1')][_0xb5c3('0xf')],config[_0xb5c3('0x1')][_0xb5c3('0x10')],config[_0xb5c3('0x1')]['password'],config[_0xb5c3('0x1')][_0xb5c3('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb5c3('0xb')][_0xb5c3('0xf')],config['sequelizeHistory'][_0xb5c3('0x10')],config['sequelizeHistory'][_0xb5c3('0x12')],config[_0xb5c3('0xb')]['options'])};db['User']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x14'));db[_0xb5c3('0x15')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x16'));db['VoiceContext']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x17'));db['VoiceExtension']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x18'));db[_0xb5c3('0x19')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x1a'));db[_0xb5c3('0x1b')]=db['sequelize']['import'](_0xb5c3('0x1c'));db[_0xb5c3('0x1d')]=db['sequelize']['import'](_0xb5c3('0x1e'));db[_0xb5c3('0x1f')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x20'));db[_0xb5c3('0x21')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x22'));db[_0xb5c3('0x23')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xb5c3('0x24')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x25'));db['VoiceDialReport']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0xb5c3('0x26')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x27'));db[_0xb5c3('0x28')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x29'));db[_0xb5c3('0x2a')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x2b'));db[_0xb5c3('0x2c')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x2d'));db[_0xb5c3('0x2e')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x2f'));db[_0xb5c3('0x30')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x31'));db['UserVoiceQueue']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x32'));db[_0xb5c3('0x33')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xb5c3('0x34')]=db['sequelize']['import'](_0xb5c3('0x35'));db[_0xb5c3('0x36')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0xb5c3('0x37')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x38'));db[_0xb5c3('0x39')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xb5c3('0x3a')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x3b'));db[_0xb5c3('0x3c')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x3d'));db[_0xb5c3('0x3e')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0xb5c3('0x3f')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/mailAccount/mailAccount.model');db[_0xb5c3('0x40')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x41'));db[_0xb5c3('0x42')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x43'));db[_0xb5c3('0x44')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x45'));db[_0xb5c3('0x46')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/mailMessage/mailMessage.model');db[_0xb5c3('0x47')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x48'));db[_0xb5c3('0x49')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x4a'));db[_0xb5c3('0x4b')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x4c'));db[_0xb5c3('0x4d')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x4e'));db[_0xb5c3('0x4f')]=db['sequelize'][_0xb5c3('0x13')]('../api/faxAccount/faxAccount.model');db[_0xb5c3('0x50')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x51'));db['FaxInteraction']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xb5c3('0x52')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/faxMessage/faxMessage.model');db[_0xb5c3('0x53')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x54'));db['FaxQueueReport']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x55'));db['SmsAccount']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x56'));db[_0xb5c3('0x57')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x58'));db['SmsInteraction']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x59'));db['SmsMessage']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x5a'));db[_0xb5c3('0x5b')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/smsQueue/smsQueue.model');db[_0xb5c3('0x5c')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x5d'));db[_0xb5c3('0x5e')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x5f'));db['OpenchannelInteraction']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x60'));db[_0xb5c3('0x61')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x62'));db[_0xb5c3('0x63')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x64'));db[_0xb5c3('0x65')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x66'));db[_0xb5c3('0x67')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb5c3('0x68')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x69'));db[_0xb5c3('0x6a')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x6b'));db['ChatMessage']=db['sequelize']['import'](_0xb5c3('0x6c'));db[_0xb5c3('0x6d')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x6e'));db['ChatQueue']=db[_0xb5c3('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x6f'));db[_0xb5c3('0x70')]=db['sequelize'][_0xb5c3('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xb5c3('0x71')]=db['sequelize']['import'](_0xb5c3('0x72'));db[_0xb5c3('0x73')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x74'));db[_0xb5c3('0x75')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x76'));db[_0xb5c3('0x77')]=db['sequelize'][_0xb5c3('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xb5c3('0x78')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x79'));db[_0xb5c3('0x7a')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xb5c3('0x7b')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x7c'));db[_0xb5c3('0x7d')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x7e'));db[_0xb5c3('0x7f')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x80'));db[_0xb5c3('0x81')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x82'));db[_0xb5c3('0x83')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x84'));db[_0xb5c3('0x85')]=db['sequelize']['import']('../api/condition/condition.model');db[_0xb5c3('0x86')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x87'));db['Pause']=db['sequelize'][_0xb5c3('0x13')]('../api/pause/pause.model');db['Cdr']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x88'));db['VoiceQueuesLog']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x89'));db[_0xb5c3('0x8a')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x8b'));db[_0xb5c3('0x8c')]=db[_0xb5c3('0x1')]['import']('../api/sound/sound.model');db[_0xb5c3('0x8d')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x8e'));db['ContactItemType']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x8f'));db[_0xb5c3('0x90')]=db['sequelize'][_0xb5c3('0x13')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0xb5c3('0x91')]=db[_0xb5c3('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xb5c3('0x92')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x93'));db['Trigger']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/trigger/trigger.model');db[_0xb5c3('0x94')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x95'));db[_0xb5c3('0x96')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x97'));db[_0xb5c3('0x98')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x99'));db['AnalyticCustomReport']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xb5c3('0x9a')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x9b'));db[_0xb5c3('0x9c')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x9d'));db[_0xb5c3('0x9e')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x9f'));db[_0xb5c3('0xa0')]=db['sequelize']['import'](_0xb5c3('0xa1'));db[_0xb5c3('0xa2')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xa3'));db[_0xb5c3('0xa4')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xa5'));db[_0xb5c3('0xa6')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xa7'));db[_0xb5c3('0xa8')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xb5c3('0xa9')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xb5c3('0xaa')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xab'));db['SugarcrmField']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xb5c3('0xac')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xad'));db[_0xb5c3('0xae')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xaf'));db[_0xb5c3('0xb0')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xb1'));db[_0xb5c3('0xb2')]=db[_0xb5c3('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xb5c3('0xb3')]=db[_0xb5c3('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xb4'));db[_0xb5c3('0xb5')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xb6'));db[_0xb5c3('0xb7')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xb8'));db[_0xb5c3('0xb9')]=db['sequelize'][_0xb5c3('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xb5c3('0xba')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xb5c3('0xbb')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xbc'));db[_0xb5c3('0xbd')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xbe'));db[_0xb5c3('0xbf')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xc0'));db['VtigerConfiguration']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xc1'));db[_0xb5c3('0xc2')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xc3'));db[_0xb5c3('0xc4')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xc5'));db['ServicenowConfiguration']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xb5c3('0xc6')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xc7'));db['Dynamics365Account']=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xc8'));db['Dynamics365Configuration']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xc9'));db[_0xb5c3('0xca')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xb5c3('0xcb')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xcc'));db[_0xb5c3('0xcd')]=db['sequelize']['import'](_0xb5c3('0xce'));db[_0xb5c3('0xcf')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xd0'));db[_0xb5c3('0x96')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x97'));db['Network']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/network/network.model');db[_0xb5c3('0xd1')]=db['sequelize'][_0xb5c3('0x13')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xd2'));db[_0xb5c3('0xd3')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xd4'));db['JscriptyQuestionReport']=db['sequelize'][_0xb5c3('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xb5c3('0xd5')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xd6'));db['SmsQueueReport']=db['sequelize']['import'](_0xb5c3('0xd7'));db[_0xb5c3('0xd8')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xd9'));db[_0xb5c3('0xda')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xdb'));db[_0xb5c3('0xdc')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xdd'));db['Setting']=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xde'));db['SquareOdbc']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xdf'));db['SquareProject']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/squareRecording/squareRecording.model');db[_0xb5c3('0xe0')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xe1'));db[_0xb5c3('0xe2')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xe3'));db[_0xb5c3('0xe4')]=db['sequelize']['import'](_0xb5c3('0xe5'));db['Campaign']=db['sequelize']['import'](_0xb5c3('0xe6'));db[_0xb5c3('0xe7')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/migration/migration.model');db[_0xb5c3('0xe8')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xe9'));db['Plugin']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xea'));db['MailTransferReport']=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xeb'));db['ChatTransferReport']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xec'));db[_0xb5c3('0xed')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xee'));db[_0xb5c3('0xef')]=db[_0xb5c3('0x1')]['import'](_0xb5c3('0xf0'));db[_0xb5c3('0xf1')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xf2'));db[_0xb5c3('0xf3')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/cmList/cmList.model');db[_0xb5c3('0xf4')]=db['sequelize'][_0xb5c3('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xb5c3('0xf5')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/userProfile/userProfile.model');db[_0xb5c3('0xf6')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xf7'));db[_0xb5c3('0xf8')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xb5c3('0xf9')]=db['sequelize'][_0xb5c3('0x13')]('../api/userNotification/userNotification.model');db[_0xb5c3('0xfa')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xfb'));db[_0xb5c3('0xfc')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0xfd'));db[_0xb5c3('0xfe')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0xff'));db[_0xb5c3('0x100')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x101'));db[_0xb5c3('0x102')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xb5c3('0x103')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x104'));db['WhatsappQueue']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x105'));db[_0xb5c3('0x106')]=db['sequelize']['import'](_0xb5c3('0x107'));db[_0xb5c3('0x108')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x109'));db['TeamVoicePrefix']=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x10a'));db[_0xb5c3('0x10b')]=db['sequelize'][_0xb5c3('0x13')](_0xb5c3('0x10c'));db[_0xb5c3('0x10d')]=db[_0xb5c3('0x1')][_0xb5c3('0x13')](_0xb5c3('0x10e'));db['MailInteractionHasTag']=db[_0xb5c3('0x1')]['import'](_0xb5c3('0x10f'));db[_0xb5c3('0x110')][_0xb5c3('0x111')](db['VoiceMail'],{'as':_0xb5c3('0x21'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')]['hasOne'](db[_0xb5c3('0x10d')],{'as':'userSetting','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db[_0xb5c3('0x1d')],{'as':'Recordings','foreignKey':'UserId'});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db['UserVoiceQueueRt'],{'as':_0xb5c3('0x115'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xb5c3('0x112'),'hooks':!![]});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db[_0xb5c3('0x77')],{'as':_0xb5c3('0x116'),'foreignKey':'UserId'});db['User'][_0xb5c3('0x114')](db[_0xb5c3('0x78')],{'as':'HopperHistory','foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')]['hasMany'](db[_0xb5c3('0x7a')],{'as':_0xb5c3('0x7a'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db[_0xb5c3('0x117')],{'as':'OpenchannelInteractions','foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')]['hasMany'](db[_0xb5c3('0x6a')],{'as':'ChatInteractions','foreignKey':_0xb5c3('0x113')});db['User'][_0xb5c3('0x114')](db[_0xb5c3('0x118')],{'as':_0xb5c3('0x119'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db['FaxInteraction'],{'as':_0xb5c3('0x11a'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db[_0xb5c3('0x44')],{'as':_0xb5c3('0x11b'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db[_0xb5c3('0xfe')],{'as':_0xb5c3('0x11c'),'foreignKey':_0xb5c3('0x113')});db['User'][_0xb5c3('0x114')](db[_0xb5c3('0xf9')],{'as':_0xb5c3('0x11d'),'foreignKey':_0xb5c3('0x11e')});db[_0xb5c3('0x110')][_0xb5c3('0x114')](db[_0xb5c3('0x11f')],{'as':_0xb5c3('0x120'),'foreignKey':_0xb5c3('0x113'),'onDelete':'SET\x20NULL'});db['User']['belongsTo'](db[_0xb5c3('0xf5')],{'as':_0xb5c3('0xf5'),'foreignKey':'userProfileId'});db['User'][_0xb5c3('0x121')](db[_0xb5c3('0x122')],{'as':_0xb5c3('0x123'),'through':'chat_group_has_users'});db[_0xb5c3('0x110')]['belongsToMany'](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x124'),'through':'cm_user_has_contacts'});db['User'][_0xb5c3('0x121')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x125'),'through':_0xb5c3('0x126')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':_0xb5c3('0x127')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x44')],{'as':_0xb5c3('0x11b'),'through':_0xb5c3('0x128')});db[_0xb5c3('0x110')]['belongsToMany'](db[_0xb5c3('0x6a')],{'as':'ChatInteractions','through':_0xb5c3('0x129')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x12a')],{'as':_0xb5c3('0x11a'),'through':'user_has_fax_interactions'});db['User'][_0xb5c3('0x121')](db[_0xb5c3('0x118')],{'as':_0xb5c3('0x119'),'through':_0xb5c3('0x12b')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x117')],{'as':_0xb5c3('0x12c'),'through':'user_has_openchannel_interactions'});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0xfe')],{'as':_0xb5c3('0x11c'),'through':_0xb5c3('0x12d')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x1b')],{'as':_0xb5c3('0x12e'),'through':_0xb5c3('0x12f'),'required':![]});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db['VoicePrefix'],{'as':_0xb5c3('0x130'),'through':'UserVoicePrefix','required':![]});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db['MailQueue'],{'as':_0xb5c3('0x131'),'through':_0xb5c3('0x34'),'required':![]});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x132')],{'as':_0xb5c3('0x133'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xb5c3('0x110')]['belongsToMany'](db[_0xb5c3('0x53')],{'as':_0xb5c3('0x134'),'through':_0xb5c3('0x36'),'required':![]});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x5b')],{'as':'SmsQueues','through':_0xb5c3('0x37'),'required':![]});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x63')],{'as':_0xb5c3('0x135'),'through':_0xb5c3('0x39'),'required':![]});db['User']['belongsToMany'](db[_0xb5c3('0x136')],{'as':_0xb5c3('0x137'),'through':_0xb5c3('0x3a'),'required':![]});db['User'][_0xb5c3('0x121')](db['CmList'],{'through':_0xb5c3('0x126')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x65')],{'as':_0xb5c3('0x138'),'through':_0xb5c3('0x139')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x4f')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db['MailAccount'],{'as':_0xb5c3('0x13a'),'through':_0xb5c3('0x13b')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x5c')],{'as':_0xb5c3('0x13c'),'through':_0xb5c3('0x13d')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db[_0xb5c3('0x13e')],{'as':_0xb5c3('0x13f'),'through':_0xb5c3('0x140')});db[_0xb5c3('0x110')][_0xb5c3('0x121')](db['WhatsappAccount'],{'as':_0xb5c3('0x141'),'through':'user_has_whatsapp_accounts'});db[_0xb5c3('0x15')][_0xb5c3('0x114')](db[_0xb5c3('0x142')],{'as':_0xb5c3('0x143'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xb5c3('0x144')][_0xb5c3('0x114')](db['VoiceExtension'],{'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x142')][_0xb5c3('0x114')](db[_0xb5c3('0x142')],{'as':_0xb5c3('0x145'),'onDelete':'cascade'});db[_0xb5c3('0x19')]['belongsToMany'](db[_0xb5c3('0x8c')],{'as':_0xb5c3('0x146'),'through':_0xb5c3('0x147')});db[_0xb5c3('0x1b')][_0xb5c3('0x114')](db[_0xb5c3('0x30')],{'as':_0xb5c3('0x148'),'foreignKey':'VoiceQueueId'});db[_0xb5c3('0x1b')][_0xb5c3('0x114')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xb5c3('0x149')});db[_0xb5c3('0x1b')]['hasMany'](db[_0xb5c3('0x77')],{'as':'HopperFinals','foreignKey':_0xb5c3('0x149')});db['VoiceQueue'][_0xb5c3('0x114')](db[_0xb5c3('0x78')],{'as':_0xb5c3('0x14a'),'foreignKey':_0xb5c3('0x149')});db['VoiceQueue'][_0xb5c3('0x114')](db[_0xb5c3('0x7a')],{'as':_0xb5c3('0x7a'),'foreignKey':_0xb5c3('0x149')});db[_0xb5c3('0x1b')][_0xb5c3('0x114')](db[_0xb5c3('0x75')],{'as':_0xb5c3('0x14b'),'foreignKey':_0xb5c3('0x149')});db[_0xb5c3('0x1b')][_0xb5c3('0x114')](db['JscriptySessionReport'],{'as':_0xb5c3('0x14c'),'foreignKey':_0xb5c3('0x149')});db['VoiceQueue'][_0xb5c3('0x14d')](db['Trunk'],{'as':_0xb5c3('0x2c'),'foreignKey':'TrunkId'});db[_0xb5c3('0x1b')][_0xb5c3('0x14d')](db[_0xb5c3('0x2c')],{'as':_0xb5c3('0x14e'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xb5c3('0x14d')](db[_0xb5c3('0x86')],{'as':_0xb5c3('0x86'),'foreignKey':'IntervalId'});db[_0xb5c3('0x1b')][_0xb5c3('0x14d')](db[_0xb5c3('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xb5c3('0x150')});db[_0xb5c3('0x1b')]['belongsToMany'](db['CmList'],{'as':_0xb5c3('0x125'),'through':_0xb5c3('0x151')});db[_0xb5c3('0x1b')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x12f')});db[_0xb5c3('0x1b')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'as':_0xb5c3('0x153'),'through':'TeamVoiceQueue'});db[_0xb5c3('0x1b')][_0xb5c3('0x121')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x154'),'through':_0xb5c3('0x155')});db[_0xb5c3('0x1d')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x110'),'foreignKey':'UserId'});db[_0xb5c3('0x1f')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x110'),'foreignKey':'UserId'});db[_0xb5c3('0x21')][_0xb5c3('0x114')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x156'),'sourceKey':_0xb5c3('0x157')});db['VoiceMailMessage'][_0xb5c3('0x14d')](db[_0xb5c3('0x21')],{'foreignKey':'mailboxuser','targetKey':_0xb5c3('0x157')});db[_0xb5c3('0x24')][_0xb5c3('0x114')](db[_0xb5c3('0x28')],{'as':_0xb5c3('0x158'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xb5c3('0x26')],{'as':_0xb5c3('0x159'),'foreignKey':'uniqueid','constraints':![]});db[_0xb5c3('0x24')][_0xb5c3('0x14d')](db['User'],{'as':_0xb5c3('0x110'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x24')]['belongsTo'](db[_0xb5c3('0x73')],{'as':'Contact','foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x3c')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xb5c3('0x3c')][_0xb5c3('0x14d')](db[_0xb5c3('0x106')],{'as':_0xb5c3('0x106'),'foreignKey':_0xb5c3('0x15b'),'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x3e')][_0xb5c3('0x14d')](db[_0xb5c3('0x3f')],{'as':_0xb5c3('0x3f'),'foreignKey':_0xb5c3('0x15d')});db[_0xb5c3('0x3e')][_0xb5c3('0x14d')](db[_0xb5c3('0x106')],{'as':_0xb5c3('0x106'),'foreignKey':_0xb5c3('0x15b'),'onDelete':'restrict'});db['MailAccount'][_0xb5c3('0x111')](db['MailServerIn'],{'as':_0xb5c3('0x15e'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x3f')][_0xb5c3('0x111')](db[_0xb5c3('0x3e')],{'as':_0xb5c3('0x15f'),'onDelete':'cascade'});db[_0xb5c3('0x3f')][_0xb5c3('0x114')](db['Disposition'],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xb5c3('0x3f')][_0xb5c3('0x114')](db[_0xb5c3('0x81')],{'as':_0xb5c3('0x160'),'foreignKey':_0xb5c3('0x15d')});db[_0xb5c3('0x3f')][_0xb5c3('0x114')](db[_0xb5c3('0x46')],{'as':_0xb5c3('0x161'),'foreignKey':_0xb5c3('0x15d')});db[_0xb5c3('0x3f')][_0xb5c3('0x114')](db[_0xb5c3('0x44')],{'as':'Interactions'});db[_0xb5c3('0x3f')][_0xb5c3('0x114')](db[_0xb5c3('0x47')],{'as':_0xb5c3('0x145'),'foreignKey':_0xb5c3('0x15d'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x3f')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0x3f')]['belongsTo'](db[_0xb5c3('0x92')],{'as':_0xb5c3('0x92'),'foreignKey':_0xb5c3('0x164')});db['MailAccount'][_0xb5c3('0x14d')](db['Pause'],{'as':_0xb5c3('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb5c3('0x3f')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x13b')});db[_0xb5c3('0x40')]['belongsToMany'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x34')});db['MailQueue'][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':_0xb5c3('0x166'),'as':'Teams'});db[_0xb5c3('0x44')]['hasMany'](db[_0xb5c3('0x46')],{'as':_0xb5c3('0x161'),'onDelete':_0xb5c3('0x112'),'foreignKey':'MailInteractionId'});db[_0xb5c3('0x44')]['belongsTo'](db[_0xb5c3('0x3f')],{'as':_0xb5c3('0x167'),'foreignKey':'MailAccountId'});db[_0xb5c3('0x44')][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x44')]['belongsTo'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x169'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x44')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':_0xb5c3('0x16a'),'as':_0xb5c3('0x16b')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0xb5c3('0x16a'),'as':_0xb5c3('0x16c')});db['MailInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0xb5c3('0x128'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xb5c3('0x114')](db[_0xb5c3('0xe8')],{'as':_0xb5c3('0x16d'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x46')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x110')});db['MailMessage'][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x168')});db[_0xb5c3('0x46')][_0xb5c3('0x14d')](db[_0xb5c3('0x44')],{'as':_0xb5c3('0x16e'),'foreignKey':_0xb5c3('0x16f')});db[_0xb5c3('0x46')][_0xb5c3('0x14d')](db[_0xb5c3('0x3f')],{'as':'Account','foreignKey':_0xb5c3('0x15d')});db[_0xb5c3('0x46')][_0xb5c3('0x14d')](db[_0xb5c3('0x65')],{'as':_0xb5c3('0x65'),'foreignKey':_0xb5c3('0x170')});db['MailMessage'][_0xb5c3('0x14d')](db[_0xb5c3('0x6d')],{'as':_0xb5c3('0x6d'),'foreignKey':_0xb5c3('0x171')});db[_0xb5c3('0x47')]['belongsTo'](db[_0xb5c3('0x110')],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x47')][_0xb5c3('0x14d')](db[_0xb5c3('0x40')],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x47')][_0xb5c3('0x14d')](db[_0xb5c3('0x3f')],{'onDelete':_0xb5c3('0x15c')});db['MailApplication'][_0xb5c3('0x14d')](db[_0xb5c3('0x86')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x172')});db[_0xb5c3('0x49')][_0xb5c3('0x14d')](db['MailAccount'],{});db[_0xb5c3('0x49')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':'ListId'});db[_0xb5c3('0x49')]['belongsTo'](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x49')][_0xb5c3('0x14d')](db[_0xb5c3('0x44')],{});db[_0xb5c3('0x49')][_0xb5c3('0x14d')](db[_0xb5c3('0x46')],{});db[_0xb5c3('0x49')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{});db[_0xb5c3('0x49')][_0xb5c3('0x14d')](db[_0xb5c3('0x40')],{});db[_0xb5c3('0x4b')]['hasMany'](db[_0xb5c3('0x4d')],{'as':_0xb5c3('0x173'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x4f')]['hasMany'](db['Disposition'],{'as':_0xb5c3('0x174'),'foreignKey':_0xb5c3('0x175'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xb5c3('0x81')],{'as':_0xb5c3('0x160'),'foreignKey':_0xb5c3('0x175')});db[_0xb5c3('0x4f')]['hasMany'](db[_0xb5c3('0x12a')],{'as':'Interactions'});db['FaxAccount'][_0xb5c3('0x114')](db[_0xb5c3('0x50')],{'as':_0xb5c3('0x145'),'foreignKey':_0xb5c3('0x175'),'onDelete':_0xb5c3('0x112')});db['FaxAccount']['hasMany'](db['VoiceExtension'],{'as':_0xb5c3('0x176'),'onDelete':_0xb5c3('0x112')});db['FaxAccount'][_0xb5c3('0x114')](db[_0xb5c3('0x52')],{'as':'Messages'});db[_0xb5c3('0x4f')][_0xb5c3('0x14d')](db['Trunk'],{'as':'Trunk'});db[_0xb5c3('0x4f')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0x4f')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb5c3('0x150')});db['FaxAccount']['belongsToMany'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':'user_has_fax_accounts'});db[_0xb5c3('0x50')][_0xb5c3('0x14d')](db['User'],{'onDelete':'restrict'});db[_0xb5c3('0x50')]['belongsTo'](db['FaxQueue'],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x50')][_0xb5c3('0x14d')](db[_0xb5c3('0x4f')],{'onDelete':'restrict'});db['FaxApplication'][_0xb5c3('0x14d')](db[_0xb5c3('0x8d')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x172')});db[_0xb5c3('0x12a')][_0xb5c3('0x114')](db['FaxMessage'],{'as':'Messages','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x177')});db[_0xb5c3('0x12a')]['belongsTo'](db['FaxAccount'],{'as':_0xb5c3('0x167'),'foreignKey':'FaxAccountId'});db[_0xb5c3('0x12a')][_0xb5c3('0x14d')](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x12a')]['belongsTo'](db[_0xb5c3('0x110')],{'as':'Owner','foreignKey':_0xb5c3('0x113')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0xb5c3('0x178'),'as':_0xb5c3('0x16b')});db[_0xb5c3('0x12a')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':_0xb5c3('0x178'),'as':_0xb5c3('0x16c')});db[_0xb5c3('0x12a')]['belongsToMany'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x179'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xb5c3('0x52')]['belongsTo'](db[_0xb5c3('0x110')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x110')});db[_0xb5c3('0x52')][_0xb5c3('0x14d')](db[_0xb5c3('0x12a')],{'as':_0xb5c3('0x16e'),'foreignKey':_0xb5c3('0x177')});db[_0xb5c3('0x52')][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage'][_0xb5c3('0x14d')](db['Attachment'],{'as':_0xb5c3('0xe8'),'foreignKey':_0xb5c3('0x17a')});db['FaxMessage']['belongsTo'](db[_0xb5c3('0x4f')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x36')});db[_0xb5c3('0x53')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':_0xb5c3('0x17b'),'as':_0xb5c3('0x153')});db['FaxQueueReport']['belongsTo'](db[_0xb5c3('0x4f')],{});db[_0xb5c3('0x17c')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0x17c')][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':'ContactId'});db[_0xb5c3('0x17c')][_0xb5c3('0x14d')](db['FaxInteraction'],{});db[_0xb5c3('0x17c')]['belongsTo'](db[_0xb5c3('0x52')],{});db[_0xb5c3('0x17c')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{});db[_0xb5c3('0x17c')]['belongsTo'](db[_0xb5c3('0x53')],{});db['SmsAccount'][_0xb5c3('0x114')](db['Disposition'],{'as':_0xb5c3('0x174'),'foreignKey':_0xb5c3('0x17d'),'onDelete':'cascade'});db[_0xb5c3('0x13e')][_0xb5c3('0x114')](db['CannedAnswer'],{'as':_0xb5c3('0x160'),'foreignKey':'SmsAccountId'});db[_0xb5c3('0x13e')][_0xb5c3('0x114')](db[_0xb5c3('0x17e')],{'as':_0xb5c3('0x161'),'foreignKey':_0xb5c3('0x17d')});db[_0xb5c3('0x13e')][_0xb5c3('0x114')](db['SmsInteraction'],{'as':_0xb5c3('0x17f')});db[_0xb5c3('0x13e')][_0xb5c3('0x114')](db[_0xb5c3('0x57')],{'as':'Applications','foreignKey':_0xb5c3('0x17d'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x13e')]['belongsTo'](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db['SmsAccount'][_0xb5c3('0x14d')](db[_0xb5c3('0x14f')],{'as':_0xb5c3('0x165'),'foreignKey':_0xb5c3('0x150')});db[_0xb5c3('0x13e')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x140')});db[_0xb5c3('0x57')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x57')][_0xb5c3('0x14d')](db[_0xb5c3('0x5b')],{'onDelete':_0xb5c3('0x15c')});db['SmsApplication']['belongsTo'](db[_0xb5c3('0x13e')],{'onDelete':_0xb5c3('0x15c')});db['SmsApplication'][_0xb5c3('0x14d')](db[_0xb5c3('0x86')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x180')});db[_0xb5c3('0x57')][_0xb5c3('0x14d')](db[_0xb5c3('0x8d')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x172')});db[_0xb5c3('0x118')][_0xb5c3('0x114')](db[_0xb5c3('0x17e')],{'as':_0xb5c3('0x161'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x181')});db[_0xb5c3('0x118')][_0xb5c3('0x14d')](db['SmsAccount'],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x17d')});db['SmsInteraction'][_0xb5c3('0x14d')](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x118')]['belongsTo'](db['User'],{'as':_0xb5c3('0x169'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x118')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':_0xb5c3('0x182'),'as':_0xb5c3('0x16b')});db[_0xb5c3('0x118')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':'sms_interaction_has_tags','as':_0xb5c3('0x16c')});db[_0xb5c3('0x118')][_0xb5c3('0x121')](db['User'],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0xb5c3('0x181')});db[_0xb5c3('0x17e')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x110')});db['SmsMessage'][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x168')});db[_0xb5c3('0x17e')]['belongsTo'](db[_0xb5c3('0x118')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x16e'),'foreignKey':_0xb5c3('0x181')});db[_0xb5c3('0x17e')]['belongsTo'](db[_0xb5c3('0x13e')],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x17d')});db[_0xb5c3('0x5b')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x37'),'foreignKey':'SmsQueueId'});db[_0xb5c3('0x5b')][_0xb5c3('0x121')](db['Team'],{'through':_0xb5c3('0x183'),'as':_0xb5c3('0x153')});db[_0xb5c3('0x5c')][_0xb5c3('0x114')](db[_0xb5c3('0x83')],{'as':_0xb5c3('0x174'),'foreignKey':_0xb5c3('0x184'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x5c')]['hasMany'](db[_0xb5c3('0x81')],{'as':_0xb5c3('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0xb5c3('0x5c')][_0xb5c3('0x114')](db['OpenchannelInteraction'],{'as':_0xb5c3('0x17f'),'foreignKey':_0xb5c3('0x184')});db[_0xb5c3('0x5c')]['hasMany'](db[_0xb5c3('0x61')],{'as':_0xb5c3('0x161'),'foreignKey':_0xb5c3('0x184')});db['OpenchannelAccount'][_0xb5c3('0x114')](db[_0xb5c3('0x5e')],{'as':_0xb5c3('0x145'),'foreignKey':_0xb5c3('0x184'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x5c')]['belongsTo'](db['CmList'],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0x5c')]['belongsTo'](db[_0xb5c3('0x14f')],{'as':_0xb5c3('0x165'),'foreignKey':_0xb5c3('0x150')});db[_0xb5c3('0x5c')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x13d')});db['OpenchannelApplication'][_0xb5c3('0x14d')](db['User'],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x5e')][_0xb5c3('0x14d')](db[_0xb5c3('0x63')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':'OpenchannelQueueId'});db[_0xb5c3('0x5e')][_0xb5c3('0x14d')](db[_0xb5c3('0x5c')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x184')});db[_0xb5c3('0x5e')][_0xb5c3('0x14d')](db[_0xb5c3('0x86')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x180')});db['OpenchannelApplication'][_0xb5c3('0x14d')](db[_0xb5c3('0x8d')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x172')});db[_0xb5c3('0x117')][_0xb5c3('0x114')](db[_0xb5c3('0x61')],{'as':_0xb5c3('0x161'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x185')});db[_0xb5c3('0x117')][_0xb5c3('0x14d')](db[_0xb5c3('0x5c')],{'as':'Account','foreignKey':_0xb5c3('0x184')});db[_0xb5c3('0x117')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x117')][_0xb5c3('0x14d')](db['User'],{'as':_0xb5c3('0x169'),'foreignKey':'UserId'});db[_0xb5c3('0x117')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':'openchannel_interaction_has_tags','as':_0xb5c3('0x16b')});db[_0xb5c3('0x117')]['belongsToMany'](db[_0xb5c3('0x8d')],{'through':_0xb5c3('0x186'),'as':_0xb5c3('0x16c')});db[_0xb5c3('0x117')][_0xb5c3('0x121')](db['User'],{'as':'Users','through':_0xb5c3('0x187'),'foreignKey':_0xb5c3('0x185')});db[_0xb5c3('0x61')]['belongsTo'](db[_0xb5c3('0x110')],{'onDelete':_0xb5c3('0x112'),'as':'User'});db[_0xb5c3('0x61')][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'onDelete':_0xb5c3('0x112'),'as':'Contact'});db['OpenchannelMessage'][_0xb5c3('0x14d')](db[_0xb5c3('0x117')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x16e'),'foreignKey':_0xb5c3('0x185')});db[_0xb5c3('0x61')]['belongsTo'](db[_0xb5c3('0xe8')],{'as':_0xb5c3('0xe8'),'foreignKey':_0xb5c3('0x17a')});db[_0xb5c3('0x61')][_0xb5c3('0x14d')](db['OpenchannelAccount'],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x184')});db[_0xb5c3('0x63')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x39'),'foreignKey':_0xb5c3('0x188')});db[_0xb5c3('0x63')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xb5c3('0x65')][_0xb5c3('0x114')](db[_0xb5c3('0x83')],{'as':_0xb5c3('0x174'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0xb5c3('0x65')][_0xb5c3('0x114')](db[_0xb5c3('0x81')],{'as':_0xb5c3('0x160'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xb5c3('0x65')]['hasMany'](db['ChatInteraction'],{'as':_0xb5c3('0x17f')});db[_0xb5c3('0x65')][_0xb5c3('0x114')](db['ChatApplication'],{'as':_0xb5c3('0x145'),'foreignKey':_0xb5c3('0x170'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x65')][_0xb5c3('0x114')](db['ChatMessage'],{'as':'Messages'});db[_0xb5c3('0x65')][_0xb5c3('0x14d')](db['CmList'],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0x65')][_0xb5c3('0x14d')](db[_0xb5c3('0x86')],{'as':'Interval','foreignKey':_0xb5c3('0x180')});db[_0xb5c3('0x65')][_0xb5c3('0x14d')](db['MailAccount'],{'as':_0xb5c3('0x3f'),'foreignKey':_0xb5c3('0x15d')});db[_0xb5c3('0x65')][_0xb5c3('0x14d')](db[_0xb5c3('0x14f')],{'as':_0xb5c3('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb5c3('0x65')]['belongsToMany'](db[_0xb5c3('0x110')],{'as':'Agents','through':_0xb5c3('0x139')});db['OpenchannelQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x5c')],{});db[_0xb5c3('0x67')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0x67')][_0xb5c3('0x14d')](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x117')],{});db[_0xb5c3('0x67')][_0xb5c3('0x14d')](db[_0xb5c3('0x61')],{});db[_0xb5c3('0x67')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{});db[_0xb5c3('0x67')]['belongsTo'](db[_0xb5c3('0x63')],{});db[_0xb5c3('0x68')]['belongsTo'](db[_0xb5c3('0x110')],{'as':'Agent','foreignKey':_0xb5c3('0x113'),'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x68')][_0xb5c3('0x14d')](db[_0xb5c3('0x132')],{'as':_0xb5c3('0x189'),'foreignKey':_0xb5c3('0x18a'),'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x68')][_0xb5c3('0x14d')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xb5c3('0x170'),'onDelete':'restrict'});db[_0xb5c3('0x68')][_0xb5c3('0x14d')](db[_0xb5c3('0x8d')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x172')});db[_0xb5c3('0x6a')][_0xb5c3('0x114')](db['ChatMessage'],{'as':'Messages','onDelete':_0xb5c3('0x112'),'foreignKey':'ChatInteractionId'});db[_0xb5c3('0x6a')][_0xb5c3('0x14d')](db['ChatWebsite'],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x170')});db[_0xb5c3('0x6a')][_0xb5c3('0x14d')](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':'ContactId'});db[_0xb5c3('0x6a')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x169'),'foreignKey':_0xb5c3('0x113')});db['ChatInteraction']['belongsToMany'](db[_0xb5c3('0x8d')],{'through':'chat_interaction_has_tags','as':_0xb5c3('0x16b')});db[_0xb5c3('0x6a')]['belongsToMany'](db[_0xb5c3('0x8d')],{'through':'chat_interaction_has_tags','as':_0xb5c3('0x16c')});db[_0xb5c3('0x6a')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x179'),'through':_0xb5c3('0x129'),'foreignKey':_0xb5c3('0x18b')});db[_0xb5c3('0x18c')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x110')});db[_0xb5c3('0x18c')]['belongsTo'](db['CmContact'],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x18c')][_0xb5c3('0x14d')](db[_0xb5c3('0x6a')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x16e'),'foreignKey':_0xb5c3('0x18b')});db[_0xb5c3('0x18c')][_0xb5c3('0x14d')](db['Attachment'],{'as':_0xb5c3('0xe8'),'foreignKey':'AttachmentId'});db[_0xb5c3('0x18c')][_0xb5c3('0x14d')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xb5c3('0x170')});db[_0xb5c3('0x6d')][_0xb5c3('0x114')](db[_0xb5c3('0xe8')],{'as':_0xb5c3('0x16d'),'foreignKey':_0xb5c3('0x171'),'onDelete':'cascade','hooks':!![]});db[_0xb5c3('0x6d')]['belongsTo'](db[_0xb5c3('0x73')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x168'),'foreignKey':'ContactId'});db[_0xb5c3('0x6d')][_0xb5c3('0x14d')](db[_0xb5c3('0x65')],{'as':_0xb5c3('0x167'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':'Agents','through':_0xb5c3('0x33'),'hooks':!![]});db[_0xb5c3('0x132')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':_0xb5c3('0x18d'),'as':_0xb5c3('0x153')});db[_0xb5c3('0x122')][_0xb5c3('0x114')](db[_0xb5c3('0x18e')],{'as':'Messages','foreignKey':_0xb5c3('0x18f'),'onDelete':_0xb5c3('0x112')});db['ChatGroup'][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x148'),'through':_0xb5c3('0x190')});db[_0xb5c3('0x70')]['belongsTo'](db[_0xb5c3('0x65')],{'as':_0xb5c3('0x191'),'foreignKey':_0xb5c3('0x170')});db[_0xb5c3('0x71')][_0xb5c3('0x114')](db['CmContact'],{'as':_0xb5c3('0x124'),'foreignKey':_0xb5c3('0x192')});db[_0xb5c3('0x73')][_0xb5c3('0x114')](db[_0xb5c3('0x90')],{'as':_0xb5c3('0x193'),'foreignKey':_0xb5c3('0x194')});db[_0xb5c3('0x73')][_0xb5c3('0x114')](db[_0xb5c3('0x11f')],{'as':_0xb5c3('0x120'),'foreignKey':_0xb5c3('0x15a')});db['CmContact'][_0xb5c3('0x114')](db[_0xb5c3('0x77')],{'as':'HopperFinals','foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x73')][_0xb5c3('0x114')](db[_0xb5c3('0x78')],{'as':_0xb5c3('0x14a'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x73')][_0xb5c3('0x114')](db[_0xb5c3('0x7a')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xb5c3('0x73')]['hasMany'](db['JscriptySessionReport'],{'as':_0xb5c3('0x14c'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x73')][_0xb5c3('0x114')](db[_0xb5c3('0x117')],{'as':_0xb5c3('0x12c'),'foreignKey':_0xb5c3('0x15a'),'onDelete':_0xb5c3('0x15c')});db['CmContact']['hasMany'](db[_0xb5c3('0x6a')],{'as':_0xb5c3('0x195'),'foreignKey':'ContactId','onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x73')]['hasMany'](db[_0xb5c3('0x118')],{'as':_0xb5c3('0x119'),'foreignKey':_0xb5c3('0x15a'),'onDelete':_0xb5c3('0x15c')});db['CmContact']['hasMany'](db[_0xb5c3('0x12a')],{'as':_0xb5c3('0x11a'),'foreignKey':_0xb5c3('0x15a'),'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x73')]['hasMany'](db[_0xb5c3('0x44')],{'as':'MailInteractions','foreignKey':_0xb5c3('0x15a'),'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x73')][_0xb5c3('0x14d')](db['CmCompany'],{'as':_0xb5c3('0x196'),'foreignKey':_0xb5c3('0x192')});db[_0xb5c3('0x73')]['belongsTo'](db[_0xb5c3('0xf3')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmContact'][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x179'),'through':_0xb5c3('0x197')});db[_0xb5c3('0x73')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'as':_0xb5c3('0x16b'),'through':_0xb5c3('0x198')});db[_0xb5c3('0x73')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':_0xb5c3('0x198'),'as':'ThroughTags'});db[_0xb5c3('0x11f')][_0xb5c3('0x114')](db[_0xb5c3('0x91')],{'as':_0xb5c3('0x199'),'foreignKey':_0xb5c3('0x19a')});db[_0xb5c3('0x11f')][_0xb5c3('0x14d')](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x11f')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':'List','foreignKey':'ListId','onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x11f')]['belongsTo'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x19b'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0x11f')][_0xb5c3('0x14d')](db[_0xb5c3('0x1b')],{'as':_0xb5c3('0x189'),'foreignKey':_0xb5c3('0x149'),'onDelete':'cascade'});db[_0xb5c3('0x11f')][_0xb5c3('0x14d')](db[_0xb5c3('0x19c')],{'as':_0xb5c3('0x19c'),'foreignKey':'CampaignId','onDelete':_0xb5c3('0x112')});db['CmHopper']['belongsTo'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x169'),'foreignKey':_0xb5c3('0x19d')});db[_0xb5c3('0x75')]['belongsTo'](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a'),'onDelete':_0xb5c3('0x112')});db['CmHopperBlack']['belongsTo'](db[_0xb5c3('0xf3')],{'as':'List','foreignKey':_0xb5c3('0x163'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x75')][_0xb5c3('0x14d')](db[_0xb5c3('0x1b')],{'as':_0xb5c3('0x189'),'foreignKey':_0xb5c3('0x149'),'onDelete':'cascade'});db[_0xb5c3('0x75')][_0xb5c3('0x14d')](db[_0xb5c3('0x19c')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x7f')][_0xb5c3('0x114')](db[_0xb5c3('0x85')],{'as':{'plural':_0xb5c3('0x19e'),'singular':_0xb5c3('0x19f')},'foreignKey':_0xb5c3('0x1a0'),'onDelete':_0xb5c3('0x112'),'hooks':!![]});db['Automation']['hasMany'](db[_0xb5c3('0x85')],{'as':{'plural':_0xb5c3('0x1a1'),'singular':_0xb5c3('0x1a2')},'foreignKey':'AutomationAnyId','onDelete':_0xb5c3('0x112'),'hooks':!![]});db[_0xb5c3('0x7f')]['hasMany'](db[_0xb5c3('0x7d')],{'as':_0xb5c3('0x1a3'),'foreignKey':_0xb5c3('0x1a4'),'onDelete':_0xb5c3('0x112'),'hooks':!![]});db[_0xb5c3('0x83')]['hasMany'](db[_0xb5c3('0x83')],{'as':_0xb5c3('0x174'),'foreignKey':_0xb5c3('0x1a5'),'onDelete':_0xb5c3('0x112')});db[_0xb5c3('0x86')][_0xb5c3('0x114')](db[_0xb5c3('0x86')],{'as':_0xb5c3('0x1a6'),'foreignKey':'IntervalId','onDelete':_0xb5c3('0x112'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xb5c3('0x142')],{'as':'Extensions','foreignKey':_0xb5c3('0x180'),'onDelete':'restrict'});db[_0xb5c3('0x86')][_0xb5c3('0x114')](db[_0xb5c3('0x47')],{'as':_0xb5c3('0x1a7'),'foreignKey':_0xb5c3('0x180')});db['Interval']['hasMany'](db[_0xb5c3('0x68')],{'as':_0xb5c3('0x1a8'),'foreignKey':_0xb5c3('0x180')});db[_0xb5c3('0x86')]['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xb5c3('0x180')});db[_0xb5c3('0x86')]['hasMany'](db[_0xb5c3('0x57')],{'as':_0xb5c3('0x1a9'),'foreignKey':_0xb5c3('0x180')});db[_0xb5c3('0x8a')][_0xb5c3('0x14d')](db[_0xb5c3('0x3f')],{});db[_0xb5c3('0x8a')][_0xb5c3('0x14d')](db['AnalyticDefaultReport'],{'foreignKey':_0xb5c3('0x1aa')});db[_0xb5c3('0x8a')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0xb5c3('0x8c')][_0xb5c3('0x121')](db[_0xb5c3('0x19')],{'as':_0xb5c3('0x1ab'),'through':_0xb5c3('0x147'),'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0x73')],{'through':'cm_contact_has_tags'});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0x6a')],{'through':'chat_interaction_has_tags'});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0x44')],{'through':_0xb5c3('0x16a')});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0x118')],{'through':_0xb5c3('0x182')});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0x12a')],{'through':_0xb5c3('0x178')});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0x117')],{'through':_0xb5c3('0x186')});db[_0xb5c3('0x8d')][_0xb5c3('0x121')](db[_0xb5c3('0xfe')],{'through':_0xb5c3('0x1ac')});db[_0xb5c3('0x90')][_0xb5c3('0x14d')](db[_0xb5c3('0x1ad')],{'as':_0xb5c3('0x1ae'),'foreignKey':_0xb5c3('0x1af')});db[_0xb5c3('0x91')][_0xb5c3('0x14d')](db[_0xb5c3('0x11f')],{'as':'Hopper','foreignKey':'CmHopperId'});db['CmContactHasItem'][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x194')});db[_0xb5c3('0x1b0')][_0xb5c3('0x114')](db[_0xb5c3('0x85')],{'as':{'plural':'AllConditions','singular':_0xb5c3('0x1b1')},'foreignKey':_0xb5c3('0x1b2'),'onDelete':_0xb5c3('0x112'),'hooks':!![]});db[_0xb5c3('0x1b0')][_0xb5c3('0x114')](db['Condition'],{'as':{'plural':_0xb5c3('0x1b3'),'singular':_0xb5c3('0x1b4')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0xb5c3('0x114')](db[_0xb5c3('0x7d')],{'as':'Actions','foreignKey':_0xb5c3('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xb5c3('0x1b6')][_0xb5c3('0x114')](db[_0xb5c3('0xa0')],{'as':_0xb5c3('0x1b7'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1b8'),'hooks':!![]});db[_0xb5c3('0x9a')][_0xb5c3('0x114')](db[_0xb5c3('0xa0')],{'as':_0xb5c3('0x1b7'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1aa')});db['AnalyticMetric'][_0xb5c3('0x114')](db[_0xb5c3('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xb5c3('0x1b9')});db[_0xb5c3('0xa0')][_0xb5c3('0x14d')](db['AnalyticMetric'],{'foreignKey':_0xb5c3('0x1b9')});db[_0xb5c3('0xa4')][_0xb5c3('0x114')](db[_0xb5c3('0xa6')],{'as':_0xb5c3('0x1ba'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bb')});db['SalesforceConfiguration']['hasMany'](db[_0xb5c3('0xa8')],{'as':_0xb5c3('0x1bc'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xa6')]['hasMany'](db[_0xb5c3('0xa8')],{'as':_0xb5c3('0x1be'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xa6')][_0xb5c3('0x114')](db[_0xb5c3('0xa8')],{'as':_0xb5c3('0x1b7'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1c0')});db['SalesforceConfiguration'][_0xb5c3('0x14d')](db[_0xb5c3('0xa4')],{'as':_0xb5c3('0x167'),'foreignKey':'AccountId'});db['SalesforceField'][_0xb5c3('0x114')](db[_0xb5c3('0xa8')],{'as':'Subject','foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xa8')][_0xb5c3('0x114')](db['SalesforceField'],{'as':'Description','foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xa8')][_0xb5c3('0x114')](db[_0xb5c3('0xa8')],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xa8')][_0xb5c3('0x14d')](db[_0xb5c3('0x94')],{'as':_0xb5c3('0x94'),'foreignKey':_0xb5c3('0x1c2')});db[_0xb5c3('0xa9')][_0xb5c3('0x114')](db[_0xb5c3('0xaa')],{'as':_0xb5c3('0x1ba'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bb')});db['SugarcrmConfiguration'][_0xb5c3('0x114')](db[_0xb5c3('0x1c3')],{'as':'Subjects','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bd')});db['SugarcrmConfiguration'][_0xb5c3('0x114')](db[_0xb5c3('0x1c3')],{'as':'Descriptions','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bf')});db['SugarcrmConfiguration'][_0xb5c3('0x114')](db[_0xb5c3('0x1c3')],{'as':_0xb5c3('0x1b7'),'onDelete':_0xb5c3('0x112'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xb5c3('0x14d')](db[_0xb5c3('0xa9')],{'as':_0xb5c3('0x167'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xb5c3('0x114')](db[_0xb5c3('0x1c3')],{'as':'Subject','foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0x1c3')][_0xb5c3('0x114')](db[_0xb5c3('0x1c3')],{'as':_0xb5c3('0x1c4'),'foreignKey':_0xb5c3('0x1bf')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0x1c3')][_0xb5c3('0x14d')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xb5c3('0xac')][_0xb5c3('0x114')](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xb5c3('0x1bb')});db['DeskConfiguration'][_0xb5c3('0x114')](db[_0xb5c3('0xb0')],{'as':_0xb5c3('0x1bc'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xae')][_0xb5c3('0x114')](db[_0xb5c3('0xb0')],{'as':_0xb5c3('0x1be'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xae')][_0xb5c3('0x114')](db['DeskField'],{'as':_0xb5c3('0x1b7'),'onDelete':'cascade','foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db[_0xb5c3('0xac')],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x1bb')});db['DeskConfiguration'][_0xb5c3('0x121')](db['Tag'],{'through':_0xb5c3('0x1c5')});db[_0xb5c3('0xb0')][_0xb5c3('0x114')](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xb5c3('0xb0')][_0xb5c3('0x114')](db[_0xb5c3('0xb0')],{'as':_0xb5c3('0x1c4'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xb0')]['hasMany'](db[_0xb5c3('0xb0')],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xb0')][_0xb5c3('0x14d')](db[_0xb5c3('0x94')],{'as':_0xb5c3('0x94'),'foreignKey':_0xb5c3('0x1c2')});db[_0xb5c3('0xb2')]['hasMany'](db[_0xb5c3('0xb3')],{'as':_0xb5c3('0x1ba'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1bb')});db['ZohoConfiguration']['hasMany'](db[_0xb5c3('0x1c6')],{'as':'Subjects','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xb3')][_0xb5c3('0x114')](db[_0xb5c3('0x1c6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xb5c3('0xb3')]['hasMany'](db[_0xb5c3('0x1c6')],{'as':_0xb5c3('0x1b7'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xb3')][_0xb5c3('0x14d')](db[_0xb5c3('0xb2')],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0x1c6')][_0xb5c3('0x114')](db[_0xb5c3('0x1c6')],{'as':_0xb5c3('0x1c7'),'foreignKey':_0xb5c3('0x1bd')});db['ZohoField'][_0xb5c3('0x114')](db[_0xb5c3('0x1c6')],{'as':_0xb5c3('0x1c4'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0x1c6')][_0xb5c3('0x114')](db['ZohoField'],{'as':_0xb5c3('0x1c1'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0xb5c3('0x94')],{'as':_0xb5c3('0x94'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xb5c3('0x114')](db[_0xb5c3('0xb7')],{'as':'Configurations','onDelete':_0xb5c3('0x112'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xb5c3('0x114')](db['ZendeskField'],{'as':_0xb5c3('0x1bc'),'foreignKey':_0xb5c3('0x1bd')});db['ZendeskConfiguration'][_0xb5c3('0x114')](db[_0xb5c3('0xb9')],{'as':_0xb5c3('0x1be'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xb7')][_0xb5c3('0x114')](db[_0xb5c3('0xb9')],{'as':_0xb5c3('0x1b7'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xb7')][_0xb5c3('0x14d')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0xb7')][_0xb5c3('0x121')](db[_0xb5c3('0x8d')],{'through':'int_zendesk_configuration_has_tags'});db[_0xb5c3('0xb9')][_0xb5c3('0x114')](db[_0xb5c3('0xb9')],{'as':_0xb5c3('0x1c7'),'foreignKey':'SubjectId'});db[_0xb5c3('0xb9')][_0xb5c3('0x114')](db['ZendeskField'],{'as':'Description','foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xb9')]['hasMany'](db[_0xb5c3('0xb9')],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xb9')][_0xb5c3('0x14d')](db[_0xb5c3('0x94')],{'as':_0xb5c3('0x94'),'foreignKey':_0xb5c3('0x1c2')});db[_0xb5c3('0xba')][_0xb5c3('0x114')](db[_0xb5c3('0xbb')],{'as':_0xb5c3('0x1ba'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0xbb')]['hasMany'](db[_0xb5c3('0xbd')],{'as':_0xb5c3('0x1bc'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bd')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xb5c3('0x1be'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xbb')]['hasMany'](db[_0xb5c3('0xbd')],{'as':_0xb5c3('0x1b7'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xbb')][_0xb5c3('0x14d')](db['FreshdeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xb5c3('0xbb')][_0xb5c3('0x121')](db['Tag'],{'through':_0xb5c3('0x1c8')});db['FreshdeskField'][_0xb5c3('0x114')](db[_0xb5c3('0xbd')],{'as':_0xb5c3('0x1c7'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xbd')]['hasMany'](db['FreshdeskField'],{'as':_0xb5c3('0x1c4'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xbd')][_0xb5c3('0x114')](db[_0xb5c3('0xbd')],{'as':'Field','foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xbd')][_0xb5c3('0x14d')](db[_0xb5c3('0x94')],{'as':_0xb5c3('0x94'),'foreignKey':_0xb5c3('0x1c2')});db[_0xb5c3('0xbf')][_0xb5c3('0x114')](db['VtigerConfiguration'],{'as':_0xb5c3('0x1ba'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0x1c9')][_0xb5c3('0x114')](db['VtigerField'],{'as':_0xb5c3('0x1bc'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0x1c9')][_0xb5c3('0x114')](db[_0xb5c3('0xc2')],{'as':_0xb5c3('0x1be'),'foreignKey':_0xb5c3('0x1bf')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xb5c3('0x1b7'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0x1c9')]['belongsTo'](db[_0xb5c3('0xbf')],{'as':'Account','foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0xc2')]['hasMany'](db[_0xb5c3('0xc2')],{'as':_0xb5c3('0x1c7'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xc2')][_0xb5c3('0x114')](db['VtigerField'],{'as':_0xb5c3('0x1c4'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xc2')][_0xb5c3('0x114')](db[_0xb5c3('0xc2')],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xc2')]['belongsTo'](db[_0xb5c3('0x94')],{'as':'Variable','foreignKey':_0xb5c3('0x1c2')});db[_0xb5c3('0xc4')]['hasMany'](db[_0xb5c3('0x1ca')],{'as':_0xb5c3('0x1ba'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bb')});db['ServicenowConfiguration'][_0xb5c3('0x114')](db[_0xb5c3('0xc6')],{'as':_0xb5c3('0x1bc'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0x1ca')][_0xb5c3('0x114')](db['ServicenowField'],{'as':_0xb5c3('0x1be'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0x1ca')][_0xb5c3('0x114')](db[_0xb5c3('0xc6')],{'as':_0xb5c3('0x1b7'),'foreignKey':_0xb5c3('0x1c0')});db['ServicenowConfiguration'][_0xb5c3('0x14d')](db[_0xb5c3('0xc4')],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0xc6')][_0xb5c3('0x114')](db[_0xb5c3('0xc6')],{'as':'Subject','foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xc6')][_0xb5c3('0x114')](db[_0xb5c3('0xc6')],{'as':'Description','foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xc6')]['hasMany'](db[_0xb5c3('0xc6')],{'as':_0xb5c3('0x1c1'),'foreignKey':'FieldId'});db[_0xb5c3('0xc6')][_0xb5c3('0x14d')](db[_0xb5c3('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0xb5c3('0x1cb')][_0xb5c3('0x114')](db[_0xb5c3('0x1cc')],{'as':'Configurations','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0x1cb')][_0xb5c3('0x14d')](db[_0xb5c3('0x106')],{'as':'CloudProvider','foreignKey':_0xb5c3('0x15b')});db[_0xb5c3('0x1cc')][_0xb5c3('0x114')](db[_0xb5c3('0xca')],{'as':_0xb5c3('0x1bc'),'onDelete':'cascade','foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0x1cc')][_0xb5c3('0x114')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xb5c3('0x1bf')});db['Dynamics365Configuration'][_0xb5c3('0x114')](db['Dynamics365Field'],{'as':_0xb5c3('0x1b7'),'onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0x1cc')][_0xb5c3('0x14d')](db[_0xb5c3('0x1cb')],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0xca')][_0xb5c3('0x114')](db[_0xb5c3('0xca')],{'as':_0xb5c3('0x1c7'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xca')]['hasMany'](db[_0xb5c3('0xca')],{'as':_0xb5c3('0x1c4'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xca')][_0xb5c3('0x114')](db[_0xb5c3('0xca')],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db['Dynamics365Field'][_0xb5c3('0x14d')](db['Variable'],{'as':_0xb5c3('0x94'),'foreignKey':_0xb5c3('0x1c2')});db['FreshsalesAccount'][_0xb5c3('0x114')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xb5c3('0x112'),'foreignKey':_0xb5c3('0x1bb')});db[_0xb5c3('0xcd')][_0xb5c3('0x114')](db['FreshsalesField'],{'as':_0xb5c3('0x1bc'),'foreignKey':_0xb5c3('0x1bd')});db[_0xb5c3('0xcd')][_0xb5c3('0x114')](db[_0xb5c3('0xcf')],{'as':_0xb5c3('0x1be'),'foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xcd')][_0xb5c3('0x114')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0xb5c3('0x1c0')});db[_0xb5c3('0xcd')][_0xb5c3('0x14d')](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xb5c3('0xcf')]['hasMany'](db[_0xb5c3('0xcf')],{'as':_0xb5c3('0x1c7'),'foreignKey':'SubjectId'});db[_0xb5c3('0xcf')][_0xb5c3('0x114')](db[_0xb5c3('0xcf')],{'as':'Description','foreignKey':_0xb5c3('0x1bf')});db[_0xb5c3('0xcf')]['hasMany'](db['FreshsalesField'],{'as':_0xb5c3('0x1c1'),'foreignKey':_0xb5c3('0x1c0')});db['FreshsalesField']['belongsTo'](db[_0xb5c3('0x94')],{'as':_0xb5c3('0x94'),'foreignKey':_0xb5c3('0x1c2')});db['ChatQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x65')],{});db['ChatQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0xd1')]['belongsTo'](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':'ContactId'});db[_0xb5c3('0xd1')][_0xb5c3('0x14d')](db[_0xb5c3('0x6a')],{});db[_0xb5c3('0xd1')][_0xb5c3('0x14d')](db['ChatMessage'],{});db[_0xb5c3('0xd1')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{});db['ChatQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x132')],{});db[_0xb5c3('0x18e')]['belongsTo'](db[_0xb5c3('0x110')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xb5c3('0x18e')]['belongsTo'](db['User'],{'onDelete':_0xb5c3('0x112'),'foreignKey':'ToId'});db[_0xb5c3('0xd5')]['hasMany'](db[_0xb5c3('0x1cd')],{'foreignKey':_0xb5c3('0x1ce'),'onDelete':'cascade'});db[_0xb5c3('0xd5')]['hasMany'](db[_0xb5c3('0xd3')],{'foreignKey':'SessionId','onDelete':_0xb5c3('0x112')});db['SmsQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x13e')],{});db[_0xb5c3('0x1cf')][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':_0xb5c3('0x163')});db['SmsQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0x1cf')][_0xb5c3('0x14d')](db[_0xb5c3('0x118')],{});db[_0xb5c3('0x1cf')][_0xb5c3('0x14d')](db[_0xb5c3('0x17e')],{});db[_0xb5c3('0x1cf')][_0xb5c3('0x14d')](db['User'],{});db['SmsQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x5b')],{});db[_0xb5c3('0xdc')][_0xb5c3('0x114')](db[_0xb5c3('0xd5')],{'foreignKey':_0xb5c3('0x1d0')});db[_0xb5c3('0xdc')][_0xb5c3('0x114')](db['JscriptyQuestionReport'],{'foreignKey':_0xb5c3('0x1d0')});db[_0xb5c3('0xdc')][_0xb5c3('0x114')](db[_0xb5c3('0xd3')],{'foreignKey':_0xb5c3('0x1d0')});db['Team'][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x127')});db[_0xb5c3('0xe2')][_0xb5c3('0x121')](db[_0xb5c3('0x1b')],{'through':_0xb5c3('0x108'),'as':_0xb5c3('0x12e')});db['Team'][_0xb5c3('0x121')](db[_0xb5c3('0x40')],{'through':_0xb5c3('0x166'),'as':'MailQueues'});db[_0xb5c3('0xe2')][_0xb5c3('0x121')](db[_0xb5c3('0x132')],{'through':_0xb5c3('0x18d'),'as':_0xb5c3('0x133')});db[_0xb5c3('0xe2')][_0xb5c3('0x121')](db[_0xb5c3('0x53')],{'through':_0xb5c3('0x17b'),'as':_0xb5c3('0x134')});db['Team'][_0xb5c3('0x121')](db[_0xb5c3('0x5b')],{'through':_0xb5c3('0x183'),'as':_0xb5c3('0x1d1')});db[_0xb5c3('0xe2')][_0xb5c3('0x121')](db[_0xb5c3('0x63')],{'through':_0xb5c3('0x1d2'),'as':_0xb5c3('0x135')});db[_0xb5c3('0xe2')]['belongsToMany'](db[_0xb5c3('0x136')],{'through':_0xb5c3('0x1d3'),'as':_0xb5c3('0x137')});db[_0xb5c3('0xe2')][_0xb5c3('0x121')](db[_0xb5c3('0xf4')],{'through':_0xb5c3('0x1d4'),'as':_0xb5c3('0x130')});db[_0xb5c3('0x19c')][_0xb5c3('0x114')](db[_0xb5c3('0x11f')],{'as':'Hoppers','foreignKey':_0xb5c3('0x1d5')});db[_0xb5c3('0x19c')][_0xb5c3('0x114')](db[_0xb5c3('0x77')],{'as':_0xb5c3('0x116'),'foreignKey':_0xb5c3('0x1d5')});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0xb5c3('0x14a'),'foreignKey':'CampaignId'});db[_0xb5c3('0x19c')]['hasMany'](db[_0xb5c3('0x75')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xb5c3('0x19c')][_0xb5c3('0x14d')](db[_0xb5c3('0x2c')],{'as':'Trunk','foreignKey':_0xb5c3('0x1d6')});db[_0xb5c3('0x19c')][_0xb5c3('0x14d')](db[_0xb5c3('0x2c')],{'as':_0xb5c3('0x14e'),'foreignKey':_0xb5c3('0x1d7')});db[_0xb5c3('0x19c')][_0xb5c3('0x14d')](db[_0xb5c3('0x86')],{'as':_0xb5c3('0x86'),'foreignKey':'IntervalId'});db[_0xb5c3('0x19c')][_0xb5c3('0x14d')](db['SquareProject'],{'as':_0xb5c3('0x1d8'),'foreignKey':_0xb5c3('0x1d9')});db[_0xb5c3('0x19c')]['belongsToMany'](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x125'),'through':_0xb5c3('0x1da')});db[_0xb5c3('0x19c')][_0xb5c3('0x121')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x154'),'through':_0xb5c3('0x1db')});db['Attachment']['belongsTo'](db[_0xb5c3('0x6d')],{'as':_0xb5c3('0x6d'),'foreignKey':_0xb5c3('0x171')});db[_0xb5c3('0x1dc')][_0xb5c3('0x14d')](db['MailMessage'],{});db['MailTransferReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x44')],{});db[_0xb5c3('0x1dc')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xb5c3('0x1dd'),'as':_0xb5c3('0x1de')});db[_0xb5c3('0x1dc')]['belongsTo'](db[_0xb5c3('0x110')],{'foreignKey':'FromUserId','as':_0xb5c3('0x1df')});db[_0xb5c3('0x1dc')][_0xb5c3('0x14d')](db['User'],{'foreignKey':_0xb5c3('0x1e0'),'as':_0xb5c3('0x1e1')});db[_0xb5c3('0x1dc')]['belongsTo'](db[_0xb5c3('0x40')],{'foreignKey':_0xb5c3('0x1e2'),'as':_0xb5c3('0x1e3')});db[_0xb5c3('0x1dc')][_0xb5c3('0x14d')](db['MailAccount'],{'foreignKey':_0xb5c3('0x1e4'),'as':_0xb5c3('0x1e5')});db[_0xb5c3('0x1e6')]['belongsTo'](db[_0xb5c3('0x18c')],{});db[_0xb5c3('0x1e6')][_0xb5c3('0x14d')](db[_0xb5c3('0x6a')],{});db[_0xb5c3('0x1e6')]['belongsTo'](db[_0xb5c3('0x65')],{'foreignKey':_0xb5c3('0x1e7'),'as':_0xb5c3('0x1de')});db['ChatTransferReport']['belongsTo'](db[_0xb5c3('0x110')],{'foreignKey':'FromUserId','as':_0xb5c3('0x1df')});db[_0xb5c3('0x1e6')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'foreignKey':_0xb5c3('0x1e0'),'as':_0xb5c3('0x1e1')});db[_0xb5c3('0x1e6')][_0xb5c3('0x14d')](db['ChatQueue'],{'foreignKey':_0xb5c3('0x1e8'),'as':_0xb5c3('0x1e3')});db[_0xb5c3('0x1e6')][_0xb5c3('0x14d')](db[_0xb5c3('0x65')],{'foreignKey':_0xb5c3('0x1e9'),'as':_0xb5c3('0x1e5')});db[_0xb5c3('0xed')][_0xb5c3('0x14d')](db[_0xb5c3('0x52')],{});db[_0xb5c3('0xed')]['belongsTo'](db['FaxInteraction'],{});db[_0xb5c3('0xed')][_0xb5c3('0x14d')](db[_0xb5c3('0x4f')],{'foreignKey':_0xb5c3('0x1ea'),'as':_0xb5c3('0x1de')});db['FaxTransferReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'foreignKey':'FromUserId','as':_0xb5c3('0x1df')});db['FaxTransferReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'foreignKey':_0xb5c3('0x1e0'),'as':'ToAgent'});db['FaxTransferReport'][_0xb5c3('0x14d')](db[_0xb5c3('0x53')],{'foreignKey':_0xb5c3('0x1eb'),'as':_0xb5c3('0x1e3')});db[_0xb5c3('0xed')]['belongsTo'](db[_0xb5c3('0x4f')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0xb5c3('0xef')][_0xb5c3('0x14d')](db[_0xb5c3('0x61')],{});db[_0xb5c3('0xef')][_0xb5c3('0x14d')](db[_0xb5c3('0x117')],{});db[_0xb5c3('0xef')]['belongsTo'](db[_0xb5c3('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xb5c3('0x1de')});db[_0xb5c3('0xef')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'foreignKey':_0xb5c3('0x1ec'),'as':_0xb5c3('0x1df')});db[_0xb5c3('0xef')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'foreignKey':_0xb5c3('0x1e0'),'as':_0xb5c3('0x1e1')});db[_0xb5c3('0xef')]['belongsTo'](db[_0xb5c3('0x63')],{'foreignKey':_0xb5c3('0x1ed'),'as':_0xb5c3('0x1e3')});db[_0xb5c3('0xef')][_0xb5c3('0x14d')](db['OpenchannelAccount'],{'foreignKey':_0xb5c3('0x1ee'),'as':_0xb5c3('0x1e5')});db['SmsTransferReport'][_0xb5c3('0x14d')](db['SmsMessage'],{});db[_0xb5c3('0xf1')][_0xb5c3('0x14d')](db[_0xb5c3('0x118')],{});db[_0xb5c3('0xf1')][_0xb5c3('0x14d')](db['SmsAccount'],{'foreignKey':_0xb5c3('0x1ef'),'as':_0xb5c3('0x1de')});db[_0xb5c3('0xf1')][_0xb5c3('0x14d')](db['User'],{'foreignKey':_0xb5c3('0x1ec'),'as':_0xb5c3('0x1df')});db[_0xb5c3('0xf1')]['belongsTo'](db[_0xb5c3('0x110')],{'foreignKey':_0xb5c3('0x1e0'),'as':_0xb5c3('0x1e1')});db[_0xb5c3('0xf1')][_0xb5c3('0x14d')](db[_0xb5c3('0x5b')],{'foreignKey':_0xb5c3('0x1f0'),'as':_0xb5c3('0x1e3')});db[_0xb5c3('0xf1')][_0xb5c3('0x14d')](db[_0xb5c3('0x13e')],{'foreignKey':_0xb5c3('0x1f1'),'as':_0xb5c3('0x1e5')});db['CmList'][_0xb5c3('0x114')](db[_0xb5c3('0x83')],{'as':_0xb5c3('0x174'),'foreignKey':_0xb5c3('0x163'),'onDelete':'cascade'});db[_0xb5c3('0xf3')]['hasMany'](db[_0xb5c3('0x7b')],{'as':_0xb5c3('0x1f2'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0xf3')][_0xb5c3('0x114')](db[_0xb5c3('0x73')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0xf3')][_0xb5c3('0x114')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xb5c3('0x163')});db['CmList'][_0xb5c3('0x114')](db[_0xb5c3('0x78')],{'as':_0xb5c3('0x1f3'),'foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0xf3')]['hasMany'](db['ReportAgentPreview'],{'as':_0xb5c3('0x7a'),'foreignKey':_0xb5c3('0x163')});db['CmList'][_0xb5c3('0x121')](db['VoiceQueue'],{'as':_0xb5c3('0x1f4'),'through':_0xb5c3('0x151')});db[_0xb5c3('0xf3')]['belongsToMany'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x126')});db[_0xb5c3('0xf4')][_0xb5c3('0x114')](db[_0xb5c3('0x142')],{'as':'Extensions','onDelete':_0xb5c3('0x112')});db[_0xb5c3('0xf4')]['belongsToMany'](db[_0xb5c3('0x110')],{'as':'Agents','through':_0xb5c3('0x10b')});db[_0xb5c3('0xf4')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':_0xb5c3('0x1d4'),'as':_0xb5c3('0x153')});db[_0xb5c3('0xf5')][_0xb5c3('0x114')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x179'),'foreignKey':_0xb5c3('0x1f5')});db[_0xb5c3('0xf5')][_0xb5c3('0x114')](db[_0xb5c3('0xf6')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xb5c3('0x112')});db['UserProfileSection'][_0xb5c3('0x114')](db[_0xb5c3('0xf8')],{'as':_0xb5c3('0x1f6'),'foreignKey':_0xb5c3('0x1f7'),'onDelete':_0xb5c3('0x112')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0xb5c3('0x174'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xb5c3('0xfa')][_0xb5c3('0x114')](db[_0xb5c3('0x81')],{'as':'Answers','foreignKey':_0xb5c3('0x1f8')});db[_0xb5c3('0xfa')][_0xb5c3('0x114')](db[_0xb5c3('0x100')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xb5c3('0xfa')]['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db[_0xb5c3('0xfa')][_0xb5c3('0x114')](db[_0xb5c3('0xfc')],{'as':_0xb5c3('0x145'),'foreignKey':'WhatsappAccountId','onDelete':_0xb5c3('0x112')});db[_0xb5c3('0xfa')]['belongsTo'](db[_0xb5c3('0xf3')],{'as':'List','foreignKey':_0xb5c3('0x163')});db[_0xb5c3('0xfa')][_0xb5c3('0x14d')](db[_0xb5c3('0x14f')],{'as':_0xb5c3('0x165'),'foreignKey':_0xb5c3('0x150')});db[_0xb5c3('0xfa')][_0xb5c3('0x121')](db['User'],{'as':'Agents','through':_0xb5c3('0x1f9')});db[_0xb5c3('0xfc')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0xfc')]['belongsTo'](db[_0xb5c3('0x136')],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0xfc')][_0xb5c3('0x14d')](db['WhatsappAccount'],{'onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0xfc')]['belongsTo'](db[_0xb5c3('0x86')],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x180')});db[_0xb5c3('0xfc')][_0xb5c3('0x14d')](db['Tag'],{'onDelete':_0xb5c3('0x15c'),'foreignKey':_0xb5c3('0x172')});db[_0xb5c3('0xfe')][_0xb5c3('0x114')](db[_0xb5c3('0x100')],{'as':_0xb5c3('0x161'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0xb5c3('0xfe')][_0xb5c3('0x14d')](db[_0xb5c3('0xfa')],{'as':_0xb5c3('0x167'),'foreignKey':'WhatsappAccountId'});db[_0xb5c3('0xfe')]['belongsTo'](db['CmContact'],{'as':_0xb5c3('0x168'),'foreignKey':_0xb5c3('0x15a')});db[_0xb5c3('0xfe')]['belongsTo'](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x169'),'foreignKey':_0xb5c3('0x113')});db[_0xb5c3('0xfe')][_0xb5c3('0x121')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xb5c3('0x16b')});db[_0xb5c3('0xfe')][_0xb5c3('0x121')](db['Tag'],{'through':_0xb5c3('0x1ac'),'as':_0xb5c3('0x16c')});db[_0xb5c3('0xfe')][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':'Users','through':_0xb5c3('0x12d'),'foreignKey':'WhatsappInteractionId'});db[_0xb5c3('0x100')][_0xb5c3('0x14d')](db['User'],{'as':_0xb5c3('0x110')});db[_0xb5c3('0x100')][_0xb5c3('0x14d')](db['CmContact'],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x168')});db[_0xb5c3('0x100')]['belongsTo'](db[_0xb5c3('0xfe')],{'onDelete':_0xb5c3('0x112'),'as':_0xb5c3('0x16e'),'foreignKey':'WhatsappInteractionId'});db[_0xb5c3('0x100')][_0xb5c3('0x14d')](db['WhatsappAccount'],{'as':_0xb5c3('0x167'),'foreignKey':_0xb5c3('0x1f8')});db[_0xb5c3('0x102')][_0xb5c3('0x14d')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xb5c3('0x14d')](db[_0xb5c3('0xf3')],{'as':_0xb5c3('0x162'),'foreignKey':'ListId'});db[_0xb5c3('0x102')][_0xb5c3('0x14d')](db[_0xb5c3('0x73')],{'as':_0xb5c3('0x168'),'foreignKey':'ContactId'});db[_0xb5c3('0x102')][_0xb5c3('0x14d')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0xb5c3('0x136')],{});db[_0xb5c3('0x102')][_0xb5c3('0x14d')](db[_0xb5c3('0x100')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xb5c3('0x110')],{});db[_0xb5c3('0x103')][_0xb5c3('0x14d')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xb5c3('0x14d')](db['WhatsappInteraction'],{});db[_0xb5c3('0x103')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xb5c3('0x1de')});db[_0xb5c3('0x103')][_0xb5c3('0x14d')](db[_0xb5c3('0xfa')],{'foreignKey':_0xb5c3('0x1fa'),'as':_0xb5c3('0x1e5')});db[_0xb5c3('0x103')][_0xb5c3('0x14d')](db[_0xb5c3('0x136')],{'foreignKey':_0xb5c3('0x1fb'),'as':_0xb5c3('0x1e3')});db[_0xb5c3('0x103')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'foreignKey':_0xb5c3('0x1ec'),'as':'FromAgent'});db[_0xb5c3('0x103')][_0xb5c3('0x14d')](db['User'],{'foreignKey':_0xb5c3('0x1e0'),'as':'ToAgent'});db['WhatsappQueue'][_0xb5c3('0x121')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x152'),'through':_0xb5c3('0x3a'),'foreignKey':_0xb5c3('0x1fc')});db[_0xb5c3('0x136')][_0xb5c3('0x121')](db[_0xb5c3('0xe2')],{'through':_0xb5c3('0x1d3'),'as':_0xb5c3('0x153')});db[_0xb5c3('0x10d')][_0xb5c3('0x14d')](db[_0xb5c3('0x110')],{'as':_0xb5c3('0x1fd'),'foreignKey':'UserId','onDelete':_0xb5c3('0x112'),'hooks':!![]});db[_0xb5c3('0x106')]['hasOne'](db['Dynamics365Account'],{'as':_0xb5c3('0x1cb'),'onDelete':'restrict'});db[_0xb5c3('0x106')][_0xb5c3('0x111')](db[_0xb5c3('0x3c')],{'as':'Imap','onDelete':_0xb5c3('0x15c')});db[_0xb5c3('0x106')][_0xb5c3('0x111')](db[_0xb5c3('0x3e')],{'as':_0xb5c3('0x15f'),'onDelete':'restrict'});module[_0xb5c3('0x1fe')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xdfa4=['../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../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','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../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','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','SmsInteractions','MailInteractions','UserNotifications','Hoppers','SET\x20NULL','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','belongsTo','Trunk','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','Template','TemplateId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','Attachments','Interaction','Account','ChatOfflineMessageId','IntervalId','TagId','ListId','Contact','Items','FaxAccountId','Exntensions','FaxInteraction','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelMessage','team_has_openchannel_queues','ChatWebsiteId','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','Website','CompanyId','CmContactId','JscriptySessions','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Queue','CampaignId','Automation','All','Actions','ParentId','Intervals','ChatApplications','FaxApplications','Schedule','DefaultReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','SugarcrmField','Description','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VariableId','VtigerConfiguration','ServicenowAccount','Dynamics365Account','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_chat_queues','OpenchannelQueues','WhatsappQueue','team_has_whatsapp_queues','VoicePrefixes','HopperBlacks','campaigns_has_cm_lists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../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','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model'];(function(_0x35738e,_0x2251f3){var _0x4f6906=function(_0x47f391){while(--_0x47f391){_0x35738e['push'](_0x35738e['shift']());}};_0x4f6906(++_0x2251f3);}(_0xdfa4,0x190));var _0x4dfa=function(_0x292ac3,_0x8f1849){_0x292ac3=_0x292ac3-0x0;var _0x2f9583=_0xdfa4[_0x292ac3];return _0x2f9583;};'use strict';var config=require(_0x4dfa('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x4dfa('0x1'));var timezone=jstz[_0x4dfa('0x2')]();config[_0x4dfa('0x3')]=_[_0x4dfa('0x4')](config[_0x4dfa('0x3')],{'database':_0x4dfa('0x5'),'username':_0x4dfa('0x6'),'password':_0x4dfa('0x7'),'options':{'host':_0x4dfa('0x8'),'port':0xcea,'dialect':_0x4dfa('0x9'),'dialectOptions':{'charset':_0x4dfa('0xa')},'logging':![],'timezone':timezone[_0x4dfa('0xb')](),'define':{'charset':_0x4dfa('0xc'),'collate':_0x4dfa('0xd')}}});config[_0x4dfa('0xe')]=_['defaultsDeep'](config[_0x4dfa('0xe')],{'database':_0x4dfa('0x5'),'username':_0x4dfa('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4dfa('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4dfa('0xb')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x4dfa('0xf')],config[_0x4dfa('0x3')][_0x4dfa('0x10')],config[_0x4dfa('0x3')][_0x4dfa('0x11')],config[_0x4dfa('0x3')][_0x4dfa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x4dfa('0xe')][_0x4dfa('0x10')],config[_0x4dfa('0xe')][_0x4dfa('0x11')],config[_0x4dfa('0xe')]['options'])};db[_0x4dfa('0x13')]=db['sequelize']['import'](_0x4dfa('0x14'));db[_0x4dfa('0x15')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x16'));db[_0x4dfa('0x17')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x19'));db[_0x4dfa('0x1a')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x1b'));db[_0x4dfa('0x1c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x1d'));db[_0x4dfa('0x1e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x1f'));db[_0x4dfa('0x20')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x21'));db[_0x4dfa('0x22')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x23'));db[_0x4dfa('0x24')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x25'));db['VoiceMailMessage']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x26'));db['VoiceCallReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x27'));db[_0x4dfa('0x28')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x29'));db[_0x4dfa('0x2a')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x2b'));db[_0x4dfa('0x2c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x2d'));db['Trunk']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x2e'));db['VoiceTransferReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x2f'));db['UserVoiceQueueRt']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x30'));db[_0x4dfa('0x31')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x4dfa('0x32')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x33'));db[_0x4dfa('0x34')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x35'));db[_0x4dfa('0x36')]=db[_0x4dfa('0x3')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x37'));db[_0x4dfa('0x38')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x39'));db[_0x4dfa('0x3a')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x3b'));db[_0x4dfa('0x3c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x3d'));db[_0x4dfa('0x3e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x3f'));db[_0x4dfa('0x40')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/mailAccount/mailAccount.model');db[_0x4dfa('0x41')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x42'));db[_0x4dfa('0x43')]=db['sequelize']['import'](_0x4dfa('0x44'));db[_0x4dfa('0x45')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x46'));db[_0x4dfa('0x47')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x48'));db[_0x4dfa('0x49')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x4a'));db[_0x4dfa('0x4b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x4c'));db[_0x4dfa('0x4d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x4e'));db[_0x4dfa('0x4f')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0x4dfa('0x50')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x51'));db[_0x4dfa('0x52')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x53'));db['FaxInteraction']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/faxInteraction/faxInteraction.model');db[_0x4dfa('0x54')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x55'));db['FaxQueue']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x56'));db['FaxQueueReport']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x57'));db['SmsAccount']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/smsAccount/smsAccount.model');db[_0x4dfa('0x58')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x59'));db[_0x4dfa('0x5a')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/smsInteraction/smsInteraction.model');db[_0x4dfa('0x5b')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x5c'));db[_0x4dfa('0x5d')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x5e'));db['OpenchannelAccount']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x5f'));db[_0x4dfa('0x60')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x61'));db[_0x4dfa('0x62')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x63'));db[_0x4dfa('0x64')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x65'));db[_0x4dfa('0x66')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x67'));db[_0x4dfa('0x68')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/chatApplication/chatApplication.model');db[_0x4dfa('0x69')]=db['sequelize']['import'](_0x4dfa('0x6a'));db[_0x4dfa('0x6b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x6c'));db[_0x4dfa('0x6d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4dfa('0x6e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/chatQueue/chatQueue.model');db[_0x4dfa('0x6f')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x70'));db[_0x4dfa('0x71')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x72'));db[_0x4dfa('0x73')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x74'));db[_0x4dfa('0x75')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x76'));db[_0x4dfa('0x77')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x78'));db[_0x4dfa('0x79')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x7a'));db[_0x4dfa('0x7b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x7c'));db['CmHopperHistory']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x7d'));db[_0x4dfa('0x7e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x4dfa('0x7f')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x80'));db[_0x4dfa('0x81')]=db[_0x4dfa('0x3')]['import']('../api/action/action.model');db['Automation']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x82'));db[_0x4dfa('0x83')]=db[_0x4dfa('0x3')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x4dfa('0x84')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x85'));db[_0x4dfa('0x86')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x87'));db[_0x4dfa('0x88')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x4dfa('0x89')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x8a'));db[_0x4dfa('0x8b')]=db['sequelize'][_0x4dfa('0x18')]('../api/cdr/cdr.model');db[_0x4dfa('0x8c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x8d'));db['Schedule']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x8e'));db[_0x4dfa('0x8f')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x90'));db[_0x4dfa('0x91')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x92'));db[_0x4dfa('0x93')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x94'));db[_0x4dfa('0x95')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x96'));db['CmHopperAdditionalPhone']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x97'));db['Template']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x98'));db['Trigger']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/trigger/trigger.model');db[_0x4dfa('0x99')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/variable/variable.model');db[_0x4dfa('0x9a')]=db['sequelize'][_0x4dfa('0x18')]('../api/integration/integration.model');db[_0x4dfa('0x9b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x9c'));db[_0x4dfa('0x9d')]=db['sequelize']['import'](_0x4dfa('0x9e'));db[_0x4dfa('0x9f')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4dfa('0xa0')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa1'));db[_0x4dfa('0xa2')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa3'));db[_0x4dfa('0xa4')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa5'));db[_0x4dfa('0xa6')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xa7'));db[_0x4dfa('0xa8')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa9'));db[_0x4dfa('0xaa')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xab'));db['SalesforceField']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xac'));db[_0x4dfa('0xad')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xae'));db[_0x4dfa('0xaf')]=db[_0x4dfa('0x3')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db['sequelize'][_0x4dfa('0x18')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x4dfa('0xb0')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xb1'));db['DeskConfiguration']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xb2'));db[_0x4dfa('0xb3')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xb4'));db[_0x4dfa('0xb5')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xb6'));db[_0x4dfa('0xb7')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xb8'));db[_0x4dfa('0xb9')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xba'));db[_0x4dfa('0xbb')]=db[_0x4dfa('0x3')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x4dfa('0xbc')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xbd'));db[_0x4dfa('0xbe')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xbf'));db[_0x4dfa('0xc0')]=db['sequelize'][_0x4dfa('0x18')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4dfa('0xc1')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xc2'));db[_0x4dfa('0xc3')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xc4'));db[_0x4dfa('0xc5')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xc6'));db['VtigerConfiguration']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xc7'));db[_0x4dfa('0xc8')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xc9'));db['ServicenowAccount']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xca'));db[_0x4dfa('0xcb')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xcc'));db[_0x4dfa('0xcd')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xce'));db['Dynamics365Account']=db[_0x4dfa('0x3')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0x4dfa('0xcf')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd0'));db[_0x4dfa('0xd1')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd2'));db[_0x4dfa('0xd3')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd4'));db[_0x4dfa('0xd5')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd6'));db[_0x4dfa('0xd7')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd8'));db[_0x4dfa('0x9a')]=db[_0x4dfa('0x3')]['import']('../api/integration/integration.model');db[_0x4dfa('0xd9')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xda'));db[_0x4dfa('0xdb')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xdc'));db['ChatInternalMessage']=db['sequelize']['import'](_0x4dfa('0xdd'));db[_0x4dfa('0xde')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xdf'));db['JscriptyQuestionReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x4dfa('0xe0')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xe1'));db[_0x4dfa('0xe2')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xe3'));db[_0x4dfa('0xe4')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xe5'));db[_0x4dfa('0xe6')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xe7'));db[_0x4dfa('0xe8')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize']['import'](_0x4dfa('0xe9'));db[_0x4dfa('0xea')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xeb'));db[_0x4dfa('0xec')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xed'));db[_0x4dfa('0xee')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xef'));db[_0x4dfa('0xf0')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xf1'));db[_0x4dfa('0xf2')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xf3'));db[_0x4dfa('0xf4')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xf5'));db[_0x4dfa('0xf6')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xf7'));db[_0x4dfa('0xf8')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xf9'));db[_0x4dfa('0xfa')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xfb'));db['Plugin']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xfc'));db['MailTransferReport']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xfd'));db[_0x4dfa('0xfe')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xff'));db[_0x4dfa('0x100')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x101'));db[_0x4dfa('0x102')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x103'));db['SmsTransferReport']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x104'));db['CmList']=db['sequelize']['import'](_0x4dfa('0x105'));db[_0x4dfa('0x106')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x107'));db['UserProfile']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/userProfile/userProfile.model');db[_0x4dfa('0x108')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x109'));db['UserProfileResource']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x10a'));db['UserNotification']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x10b'));db['WhatsappAccount']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x10c'));db[_0x4dfa('0x10d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x10e'));db[_0x4dfa('0x10f')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x110'));db[_0x4dfa('0x111')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x112'));db[_0x4dfa('0x113')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x114'));db['WhatsappQueue']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x115'));db['CloudProvider']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x116'));db[_0x4dfa('0x117')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x118'));db[_0x4dfa('0x119')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x11a'));db[_0x4dfa('0x11b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x11c'));db[_0x4dfa('0x11d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x11e'));db['MailInteractionHasTag']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x11f'));db[_0x4dfa('0x13')][_0x4dfa('0x120')](db[_0x4dfa('0x24')],{'as':_0x4dfa('0x24'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x120')](db['UserSetting'],{'as':_0x4dfa('0x123'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x122')});db['User'][_0x4dfa('0x124')](db[_0x4dfa('0x20')],{'as':_0x4dfa('0x125'),'foreignKey':'UserId'});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db[_0x4dfa('0x126')],{'as':_0x4dfa('0x127'),'foreignKey':'UserId'});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x1a')],{'as':_0x4dfa('0x128'),'onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x7b')],{'as':_0x4dfa('0x129'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x12b'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db[_0x4dfa('0x7e')],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x12c')],{'as':'OpenchannelInteractions','foreignKey':_0x4dfa('0x122')});db['User'][_0x4dfa('0x124')](db[_0x4dfa('0x69')],{'as':'ChatInteractions','foreignKey':_0x4dfa('0x122')});db['User'][_0x4dfa('0x124')](db['SmsInteraction'],{'as':_0x4dfa('0x12d'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db['MailInteraction'],{'as':_0x4dfa('0x12e'),'foreignKey':_0x4dfa('0x122')});db['User']['hasMany'](db[_0x4dfa('0x10f')],{'as':'WhatsappInteractions','foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db['UserNotification'],{'as':_0x4dfa('0x12f'),'foreignKey':'SenderId'});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db[_0x4dfa('0x77')],{'as':_0x4dfa('0x130'),'foreignKey':'UserId','onDelete':_0x4dfa('0x131')});db[_0x4dfa('0x13')]['belongsTo'](db[_0x4dfa('0x132')],{'as':_0x4dfa('0x132'),'foreignKey':_0x4dfa('0x133')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x6f')],{'as':_0x4dfa('0x135'),'through':_0x4dfa('0x136')});db['User']['belongsToMany'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x137'),'through':_0x4dfa('0x138')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x13a'),'through':_0x4dfa('0x13b')});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x13c')});db['User']['belongsToMany'](db[_0x4dfa('0x45')],{'as':_0x4dfa('0x12e'),'through':_0x4dfa('0x13d')});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x69')],{'as':_0x4dfa('0x13e'),'through':_0x4dfa('0x13f')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db['FaxInteraction'],{'as':_0x4dfa('0x140'),'through':_0x4dfa('0x141')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x5a')],{'as':_0x4dfa('0x12d'),'through':_0x4dfa('0x142')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x4dfa('0x143'),'through':_0x4dfa('0x144')});db['User']['belongsToMany'](db[_0x4dfa('0x10f')],{'as':_0x4dfa('0x145'),'through':_0x4dfa('0x146')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x1e')],{'as':_0x4dfa('0x147'),'through':'UserVoiceQueue','required':![]});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x106')],{'as':'VoicePrefixes','through':_0x4dfa('0x11b'),'required':![]});db['User'][_0x4dfa('0x134')](db['MailQueue'],{'as':_0x4dfa('0x148'),'through':_0x4dfa('0x34'),'required':![]});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x6e')],{'as':_0x4dfa('0x149'),'through':_0x4dfa('0x32'),'required':![],'hooks':!![]});db[_0x4dfa('0x13')]['belongsToMany'](db[_0x4dfa('0x14a')],{'as':_0x4dfa('0x14b'),'through':_0x4dfa('0x36'),'required':![]});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x5d')],{'as':_0x4dfa('0x14c'),'through':_0x4dfa('0x14d'),'required':![]});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x4dfa('0x38'),'required':![]});db[_0x4dfa('0x13')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x4dfa('0x14e'),'through':_0x4dfa('0x3a'),'required':![]});db['User']['belongsToMany'](db[_0x4dfa('0x139')],{'through':'cm_user_has_lists'});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x64')],{'as':_0x4dfa('0x14f'),'through':_0x4dfa('0x150')});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x50')],{'as':_0x4dfa('0x151'),'through':_0x4dfa('0x152')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x40')],{'as':'MailAccounts','through':_0x4dfa('0x153')});db[_0x4dfa('0x13')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x4dfa('0x154'),'through':'user_has_openchannel_accounts'});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x155')],{'as':_0x4dfa('0x156'),'through':_0x4dfa('0x157')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x158')],{'as':_0x4dfa('0x159'),'through':'user_has_whatsapp_accounts'});db[_0x4dfa('0x15')]['hasMany'](db[_0x4dfa('0x1a')],{'as':_0x4dfa('0x15a'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x15b')});db[_0x4dfa('0x17')][_0x4dfa('0x124')](db[_0x4dfa('0x1a')],{'onDelete':'cascade'});db[_0x4dfa('0x1a')][_0x4dfa('0x124')](db['VoiceExtension'],{'as':_0x4dfa('0x15c'),'onDelete':_0x4dfa('0x121')});db['VoiceMusicOnHold'][_0x4dfa('0x134')](db['Sound'],{'as':_0x4dfa('0x15d'),'through':_0x4dfa('0x15e')});db['VoiceQueue'][_0x4dfa('0x124')](db[_0x4dfa('0x126')],{'as':_0x4dfa('0x15f'),'foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db[_0x4dfa('0x77')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x4dfa('0x7b')],{'as':'HopperFinals','foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x161'),'foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db['ReportAgentPreview'],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')]['hasMany'](db[_0x4dfa('0xe0')],{'as':'JscriptySessions','foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x162')](db[_0x4dfa('0x163')],{'as':'Trunk','foreignKey':_0x4dfa('0x164')});db['VoiceQueue']['belongsTo'](db[_0x4dfa('0x163')],{'as':_0x4dfa('0x165'),'foreignKey':'TrunkBackupId'});db[_0x4dfa('0x1e')][_0x4dfa('0x162')](db['Interval'],{'as':_0x4dfa('0x88'),'foreignKey':'IntervalId'});db[_0x4dfa('0x1e')][_0x4dfa('0x162')](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x1e')][_0x4dfa('0x134')](db['CmList'],{'as':'Lists','through':_0x4dfa('0x168')});db['VoiceQueue'][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x31')});db[_0x4dfa('0x1e')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'as':_0x4dfa('0x16a'),'through':_0x4dfa('0x117')});db['VoiceQueue'][_0x4dfa('0x134')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x16b'),'through':_0x4dfa('0x16c')});db[_0x4dfa('0x20')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x22')][_0x4dfa('0x162')](db['User'],{'as':_0x4dfa('0x13'),'foreignKey':_0x4dfa('0x122')});db['VoiceMail'][_0x4dfa('0x124')](db[_0x4dfa('0x16d')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':'mailboxuser','sourceKey':_0x4dfa('0x16f')});db[_0x4dfa('0x16d')][_0x4dfa('0x162')](db['VoiceMail'],{'foreignKey':_0x4dfa('0x170'),'targetKey':_0x4dfa('0x16f')});db[_0x4dfa('0x171')][_0x4dfa('0x124')](db['VoiceQueueReport'],{'as':_0x4dfa('0x172'),'foreignKey':_0x4dfa('0x173'),'constraints':![]});db[_0x4dfa('0x171')][_0x4dfa('0x124')](db[_0x4dfa('0x2a')],{'as':_0x4dfa('0x174'),'foreignKey':_0x4dfa('0x173'),'constraints':![]});db[_0x4dfa('0x171')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13'),'foreignKey':'UserId'});db[_0x4dfa('0x171')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x3c')]['belongsTo'](db[_0x4dfa('0x40')],{'as':_0x4dfa('0x40'),'foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x3c')][_0x4dfa('0x162')](db[_0x4dfa('0x177')],{'as':_0x4dfa('0x177'),'foreignKey':_0x4dfa('0x178'),'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0x4dfa('0x40'),'foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x3e')]['belongsTo'](db['CloudProvider'],{'as':_0x4dfa('0x177'),'foreignKey':_0x4dfa('0x178'),'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x40')][_0x4dfa('0x120')](db[_0x4dfa('0x3c')],{'as':_0x4dfa('0x17a'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x40')][_0x4dfa('0x120')](db[_0x4dfa('0x3e')],{'as':_0x4dfa('0x17b'),'onDelete':'cascade'});db[_0x4dfa('0x40')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':_0x4dfa('0x176'),'onDelete':'cascade'});db[_0x4dfa('0x40')][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':_0x4dfa('0x17d'),'foreignKey':_0x4dfa('0x176')});db['MailAccount'][_0x4dfa('0x124')](db['MailMessage'],{'as':'Messages','foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x40')][_0x4dfa('0x124')](db['MailInteraction'],{'as':_0x4dfa('0x17e')});db['MailAccount']['hasMany'](db[_0x4dfa('0x49')],{'as':_0x4dfa('0x15c'),'foreignKey':'MailAccountId','onDelete':_0x4dfa('0x121')});db['MailAccount'][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db[_0x4dfa('0x40')][_0x4dfa('0x162')](db[_0x4dfa('0x180')],{'as':_0x4dfa('0x180'),'foreignKey':_0x4dfa('0x181')});db[_0x4dfa('0x40')][_0x4dfa('0x162')](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x40')]['belongsToMany'](db['User'],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x153')});db[_0x4dfa('0x41')][_0x4dfa('0x134')](db['User'],{'as':_0x4dfa('0x169'),'through':'UserMailQueue'});db[_0x4dfa('0x41')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x182'),'as':_0x4dfa('0x16a')});db[_0x4dfa('0x45')]['hasMany'](db[_0x4dfa('0x47')],{'as':'Messages','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x183')});db['MailInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'as':'Account','foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x45')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x45')][_0x4dfa('0x162')](db['User'],{'as':_0x4dfa('0x184'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x45')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x185'),'as':_0x4dfa('0x186')});db[_0x4dfa('0x45')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x4dfa('0x45')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Users','through':_0x4dfa('0x13d'),'foreignKey':'MailInteractionId'});db[_0x4dfa('0x47')][_0x4dfa('0x124')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0x187'),'onDelete':_0x4dfa('0x121')});db['MailMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13')});db[_0x4dfa('0x47')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':'Contact'});db['MailMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x45')],{'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x183')});db[_0x4dfa('0x47')][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x47')][_0x4dfa('0x162')](db['ChatWebsite'],{'as':_0x4dfa('0x64'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x6d')],{'as':'ChatOfflineMessage','foreignKey':_0x4dfa('0x18a')});db[_0x4dfa('0x49')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db['MailApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x41')],{'onDelete':'restrict'});db[_0x4dfa('0x49')][_0x4dfa('0x162')](db['MailAccount'],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x49')][_0x4dfa('0x162')](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db['MailApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18c')});db['MailQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{});db[_0x4dfa('0x4b')]['belongsTo'](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db['MailQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0x4b')][_0x4dfa('0x162')](db[_0x4dfa('0x45')],{});db[_0x4dfa('0x4b')]['belongsTo'](db[_0x4dfa('0x47')],{});db[_0x4dfa('0x4b')][_0x4dfa('0x162')](db['User'],{});db[_0x4dfa('0x4b')]['belongsTo'](db[_0x4dfa('0x41')],{});db[_0x4dfa('0x4d')][_0x4dfa('0x124')](db[_0x4dfa('0x4f')],{'as':_0x4dfa('0x18f'),'onDelete':_0x4dfa('0x121')});db['FaxAccount']['hasMany'](db[_0x4dfa('0x84')],{'as':_0x4dfa('0x17c'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db['FaxAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':_0x4dfa('0x17d'),'foreignKey':_0x4dfa('0x190')});db[_0x4dfa('0x50')][_0x4dfa('0x124')](db['FaxInteraction'],{'as':'Interactions'});db[_0x4dfa('0x50')][_0x4dfa('0x124')](db['FaxApplication'],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x190'),'onDelete':_0x4dfa('0x121')});db['FaxAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x1a')],{'as':_0x4dfa('0x191'),'onDelete':'cascade'});db['FaxAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x54')],{'as':'Messages'});db[_0x4dfa('0x50')][_0x4dfa('0x162')](db[_0x4dfa('0x163')],{'as':'Trunk'});db[_0x4dfa('0x50')]['belongsTo'](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x50')][_0x4dfa('0x162')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x50')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x152')});db[_0x4dfa('0x52')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db['FaxApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x14a')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x52')][_0x4dfa('0x162')](db['FaxAccount'],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x52')][_0x4dfa('0x162')](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x192')][_0x4dfa('0x124')](db[_0x4dfa('0x54')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x4dfa('0x193')});db[_0x4dfa('0x192')][_0x4dfa('0x162')](db[_0x4dfa('0x50')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x190')});db[_0x4dfa('0x192')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x192')][_0x4dfa('0x162')](db['User'],{'as':'Owner','foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x192')][_0x4dfa('0x134')](db['Tag'],{'through':_0x4dfa('0x194'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x4dfa('0x91')],{'through':'fax_interaction_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x192')][_0x4dfa('0x134')](db['User'],{'as':_0x4dfa('0x196'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':'cascade','as':_0x4dfa('0x13')});db['FaxMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x192')],{'as':'Interaction','foreignKey':_0x4dfa('0x193')});db[_0x4dfa('0x54')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':'Contact'});db[_0x4dfa('0x54')][_0x4dfa('0x162')](db['Attachment'],{'as':_0x4dfa('0xfa'),'foreignKey':_0x4dfa('0x197')});db[_0x4dfa('0x54')][_0x4dfa('0x162')](db[_0x4dfa('0x50')],{'as':_0x4dfa('0x189'),'foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db[_0x4dfa('0x13')],{'as':'Agents','through':_0x4dfa('0x36')});db[_0x4dfa('0x14a')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x198'),'as':_0x4dfa('0x16a')});db[_0x4dfa('0x199')]['belongsTo'](db[_0x4dfa('0x50')],{});db[_0x4dfa('0x199')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0x199')][_0x4dfa('0x162')](db[_0x4dfa('0x192')],{});db[_0x4dfa('0x199')][_0x4dfa('0x162')](db['FaxMessage'],{});db[_0x4dfa('0x199')]['belongsTo'](db[_0x4dfa('0x13')],{});db[_0x4dfa('0x199')]['belongsTo'](db[_0x4dfa('0x14a')],{});db[_0x4dfa('0x155')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':'SmsAccountId','onDelete':_0x4dfa('0x121')});db['SmsAccount']['hasMany'](db[_0x4dfa('0x83')],{'as':'Answers','foreignKey':_0x4dfa('0x19a')});db[_0x4dfa('0x155')][_0x4dfa('0x124')](db[_0x4dfa('0x5b')],{'as':'Messages','foreignKey':_0x4dfa('0x19a')});db['SmsAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x5a')],{'as':'Interactions'});db[_0x4dfa('0x155')][_0x4dfa('0x124')](db[_0x4dfa('0x58')],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x19a'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x155')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db['SmsAccount'][_0x4dfa('0x162')](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x155')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':'Agents','through':_0x4dfa('0x157')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x5d')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db[_0x4dfa('0x58')]['belongsTo'](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x5a')][_0x4dfa('0x124')](db[_0x4dfa('0x5b')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x19b')});db[_0x4dfa('0x5a')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x19a')});db[_0x4dfa('0x5a')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x5a')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x184'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x5a')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x19c'),'as':'Tags'});db['SmsInteraction'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x19c'),'as':_0x4dfa('0x195')});db[_0x4dfa('0x5a')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':'Users','through':_0x4dfa('0x142'),'foreignKey':_0x4dfa('0x19b')});db[_0x4dfa('0x5b')]['belongsTo'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13')});db[_0x4dfa('0x5b')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x18e')});db[_0x4dfa('0x5b')][_0x4dfa('0x162')](db[_0x4dfa('0x5a')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x19b')});db[_0x4dfa('0x5b')]['belongsTo'](db[_0x4dfa('0x155')],{'as':_0x4dfa('0x189'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x4dfa('0x5d')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x19d'),'as':_0x4dfa('0x16a')});db[_0x4dfa('0x19e')][_0x4dfa('0x124')](db[_0x4dfa('0x84')],{'as':'Dispositions','foreignKey':_0x4dfa('0x19f'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x19e')][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':'Answers','foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x19e')]['hasMany'](db[_0x4dfa('0x12c')],{'as':'Interactions','foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x19e')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x19e')][_0x4dfa('0x124')](db[_0x4dfa('0x60')],{'as':'Applications','foreignKey':_0x4dfa('0x19f'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x19e')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x19e')]['belongsTo'](db['Pause'],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x19e')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x1a0')});db[_0x4dfa('0x60')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db['OpenchannelApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x62')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x1a1')});db['OpenchannelApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x19e')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x60')][_0x4dfa('0x162')](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db['OpenchannelApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18c')});db['OpenchannelInteraction'][_0x4dfa('0x124')](db['OpenchannelMessage'],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1a2')});db['OpenchannelInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x19e')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x19f')});db['OpenchannelInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0x12c')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x184'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1a3'),'as':'Tags'});db['OpenchannelInteraction'][_0x4dfa('0x134')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x12c')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x196'),'through':_0x4dfa('0x144'),'foreignKey':_0x4dfa('0x1a2')});db[_0x4dfa('0x1a4')]['belongsTo'](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x121'),'as':'User'});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':'cascade','as':_0x4dfa('0x18e')});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0x12c')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x1a2')});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0xfa'),'foreignKey':_0x4dfa('0x197')});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0x19e')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x62')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x38'),'foreignKey':'OpenchannelQueueId'});db[_0x4dfa('0x62')]['belongsToMany'](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x1a5'),'as':'Teams'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':_0x4dfa('0x17d'),'foreignKey':'ChatWebsiteId'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db[_0x4dfa('0x71')],{'as':'ProactiveActions'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db['ChatInteraction'],{'as':'Interactions'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db[_0x4dfa('0x68')],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x1a6'),'onDelete':_0x4dfa('0x121')});db['ChatWebsite'][_0x4dfa('0x124')](db[_0x4dfa('0x6b')],{'as':_0x4dfa('0x16e')});db[_0x4dfa('0x64')][_0x4dfa('0x162')](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db[_0x4dfa('0x64')][_0x4dfa('0x162')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x4dfa('0x64')]['belongsTo'](db[_0x4dfa('0x40')],{'as':'MailAccount','foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x64')]['belongsTo'](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db['ChatWebsite'][_0x4dfa('0x134')](db['User'],{'as':_0x4dfa('0x169'),'through':'user_has_chat_websites'});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db['OpenchannelAccount'],{});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db['OpenchannelQueueReport'][_0x4dfa('0x162')](db['CmContact'],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x12c')],{});db['OpenchannelQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x1a4')],{});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x62')],{});db[_0x4dfa('0x68')]['belongsTo'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x1a7'),'foreignKey':_0x4dfa('0x122'),'onDelete':'restrict'});db[_0x4dfa('0x68')]['belongsTo'](db[_0x4dfa('0x6e')],{'as':'Queue','foreignKey':_0x4dfa('0x1a8'),'onDelete':_0x4dfa('0x179')});db['ChatApplication']['belongsTo'](db[_0x4dfa('0x64')],{'as':'Website','foreignKey':_0x4dfa('0x1a6'),'onDelete':'restrict'});db[_0x4dfa('0x68')][_0x4dfa('0x162')](db['Tag'],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x69')][_0x4dfa('0x124')](db[_0x4dfa('0x6b')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1a9')});db[_0x4dfa('0x69')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1a6')});db[_0x4dfa('0x69')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db['ChatInteraction'][_0x4dfa('0x162')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x4dfa('0x69')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1aa'),'as':_0x4dfa('0x186')});db[_0x4dfa('0x69')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1aa'),'as':_0x4dfa('0x195')});db[_0x4dfa('0x69')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x196'),'through':_0x4dfa('0x13f'),'foreignKey':_0x4dfa('0x1a9')});db['ChatMessage'][_0x4dfa('0x162')](db['User'],{'onDelete':'cascade','as':_0x4dfa('0x13')});db[_0x4dfa('0x6b')]['belongsTo'](db[_0x4dfa('0x75')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x4dfa('0x6b')][_0x4dfa('0x162')](db[_0x4dfa('0x69')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x1a9')});db[_0x4dfa('0x6b')][_0x4dfa('0x162')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0xfa'),'foreignKey':_0x4dfa('0x197')});db['ChatMessage'][_0x4dfa('0x162')](db['ChatWebsite'],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1a6')});db[_0x4dfa('0x6d')][_0x4dfa('0x124')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0x187'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x6d')][_0x4dfa('0x162')](db['CmContact'],{'onDelete':_0x4dfa('0x121'),'as':'Contact','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x6d')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4dfa('0x6e')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x4dfa('0x6e')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x4dfa('0x6f')][_0x4dfa('0x124')](db[_0x4dfa('0x1ab')],{'as':_0x4dfa('0x16e'),'foreignKey':_0x4dfa('0x1ac'),'onDelete':'cascade'});db[_0x4dfa('0x6f')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x15f'),'through':_0x4dfa('0x136')});db[_0x4dfa('0x71')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'as':_0x4dfa('0x1ad'),'foreignKey':_0x4dfa('0x1a6')});db['CmCompany'][_0x4dfa('0x124')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x137'),'foreignKey':_0x4dfa('0x1ae')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x95')],{'as':'Phones','foreignKey':_0x4dfa('0x1af')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x77')],{'as':_0x4dfa('0x130'),'foreignKey':_0x4dfa('0x175')});db['CmContact']['hasMany'](db[_0x4dfa('0x7b')],{'as':'HopperFinals','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x161'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x7e')],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0xe0')],{'as':_0x4dfa('0x1b0'),'foreignKey':_0x4dfa('0x175')});db['CmContact'][_0x4dfa('0x124')](db[_0x4dfa('0x12c')],{'as':_0x4dfa('0x143'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x179')});db['CmContact'][_0x4dfa('0x124')](db[_0x4dfa('0x69')],{'as':_0x4dfa('0x13e'),'foreignKey':_0x4dfa('0x175'),'onDelete':'restrict'});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x5a')],{'as':_0x4dfa('0x12d'),'foreignKey':_0x4dfa('0x175'),'onDelete':'restrict'});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x192')],{'as':_0x4dfa('0x140'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x75')]['hasMany'](db[_0x4dfa('0x45')],{'as':_0x4dfa('0x12e'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x179')});db['CmContact'][_0x4dfa('0x162')](db['CmCompany'],{'as':'Company','foreignKey':_0x4dfa('0x1ae')});db['CmContact'][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x75')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x196'),'through':_0x4dfa('0x138')});db[_0x4dfa('0x75')]['belongsToMany'](db['Tag'],{'as':_0x4dfa('0x186'),'through':_0x4dfa('0x1b1')});db['CmContact'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':'cm_contact_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x77')][_0x4dfa('0x124')](db[_0x4dfa('0x1b2')],{'as':_0x4dfa('0x1b3'),'foreignKey':_0x4dfa('0x1b4')});db[_0x4dfa('0x77')]['belongsTo'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x77')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':'List','foreignKey':_0x4dfa('0x18d'),'onDelete':_0x4dfa('0x121')});db['CmHopper'][_0x4dfa('0x162')](db['User'],{'as':_0x4dfa('0x1a7'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x77')]['belongsTo'](db['VoiceQueue'],{'as':_0x4dfa('0x1b5'),'foreignKey':_0x4dfa('0x160'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x77')]['belongsTo'](db['Campaign'],{'as':_0x4dfa('0xf6'),'foreignKey':_0x4dfa('0x1b6'),'onDelete':'cascade'});db['CmHopper'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x79')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d'),'onDelete':'cascade'});db['CmHopperBlack'][_0x4dfa('0x162')](db[_0x4dfa('0x1e')],{'as':_0x4dfa('0x1b5'),'foreignKey':_0x4dfa('0x160'),'onDelete':_0x4dfa('0x121')});db['CmHopperBlack'][_0x4dfa('0x162')](db[_0x4dfa('0xf6')],{'as':_0x4dfa('0xf6'),'foreignKey':_0x4dfa('0x1b6'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x1b7')][_0x4dfa('0x124')](db[_0x4dfa('0x86')],{'as':{'plural':_0x4dfa('0x1b8'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x1b7')][_0x4dfa('0x124')](db[_0x4dfa('0x86')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db['Automation'][_0x4dfa('0x124')](db['Action'],{'as':_0x4dfa('0x1b9'),'foreignKey':'AutomationId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db['Disposition'][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':_0x4dfa('0x1ba'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db['Interval'],{'as':_0x4dfa('0x1bb'),'foreignKey':'IntervalId','onDelete':_0x4dfa('0x121'),'hooks':!![],'required':![]});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x4dfa('0x18b')});db['Interval'][_0x4dfa('0x124')](db[_0x4dfa('0x68')],{'as':_0x4dfa('0x1bc'),'foreignKey':_0x4dfa('0x18b')});db['Interval']['hasMany'](db[_0x4dfa('0x52')],{'as':_0x4dfa('0x1bd'),'foreignKey':_0x4dfa('0x18b')});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db[_0x4dfa('0x58')],{'as':'SmsApplications','foreignKey':_0x4dfa('0x18b')});db['Schedule'][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{});db[_0x4dfa('0x1be')]['belongsTo'](db[_0x4dfa('0x9f')],{'foreignKey':_0x4dfa('0x1bf')});db[_0x4dfa('0x1be')][_0x4dfa('0x162')](db[_0x4dfa('0x9d')],{'foreignKey':'CustomReportId'});db[_0x4dfa('0x8f')][_0x4dfa('0x134')](db[_0x4dfa('0x1c')],{'as':'Mohs','through':_0x4dfa('0x15e'),'onDelete':_0x4dfa('0x179')});db['Tag']['belongsToMany'](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db[_0x4dfa('0x69')],{'through':_0x4dfa('0x1aa')});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db['MailInteraction'],{'through':_0x4dfa('0x185')});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db[_0x4dfa('0x5a')],{'through':_0x4dfa('0x19c')});db[_0x4dfa('0x91')]['belongsToMany'](db[_0x4dfa('0x192')],{'through':_0x4dfa('0x194')});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db[_0x4dfa('0x10f')],{'through':_0x4dfa('0x1c0')});db['CmContactHasItem'][_0x4dfa('0x162')](db[_0x4dfa('0x93')],{'as':_0x4dfa('0x1c1'),'foreignKey':_0x4dfa('0x1c2')});db[_0x4dfa('0x1b2')][_0x4dfa('0x162')](db[_0x4dfa('0x77')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x4dfa('0x95')]['belongsTo'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x1af')});db[_0x4dfa('0x1c3')][_0x4dfa('0x124')](db[_0x4dfa('0x86')],{'as':{'plural':_0x4dfa('0x1c4'),'singular':_0x4dfa('0x1c5')},'foreignKey':_0x4dfa('0x1c6'),'onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x1c3')]['hasMany'](db[_0x4dfa('0x86')],{'as':{'plural':_0x4dfa('0x1c7'),'singular':_0x4dfa('0x1c8')},'foreignKey':'TriggerAnyId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x1c3')][_0x4dfa('0x124')](db['Action'],{'as':_0x4dfa('0x1b9'),'foreignKey':_0x4dfa('0x1c9'),'onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x9d')][_0x4dfa('0x124')](db[_0x4dfa('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x4dfa('0x9f')][_0x4dfa('0x124')](db[_0x4dfa('0xa4')],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1bf')});db['AnalyticMetric'][_0x4dfa('0x124')](db['AnalyticFieldReport'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cb')});db[_0x4dfa('0xa4')][_0x4dfa('0x162')](db[_0x4dfa('0xa2')],{'foreignKey':_0x4dfa('0x1cb')});db[_0x4dfa('0xa8')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db['SalesforceConfiguration']['hasMany'](db[_0x4dfa('0x1ce')],{'as':_0x4dfa('0x1cf'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xaa')][_0x4dfa('0x124')](db['SalesforceField'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xaa')][_0x4dfa('0x124')](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x4dfa('0x1d3')});db['SalesforceConfiguration'][_0x4dfa('0x162')](db[_0x4dfa('0xa8')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0x1ce')]['hasMany'](db[_0x4dfa('0x1ce')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1ce')]['hasMany'](db['SalesforceField'],{'as':'Description','foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0x1ce')][_0x4dfa('0x124')](db[_0x4dfa('0x1ce')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0x1ce')]['belongsTo'](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xad')][_0x4dfa('0x124')](db[_0x4dfa('0xaf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xaf')][_0x4dfa('0x124')](db[_0x4dfa('0x1d6')],{'as':_0x4dfa('0x1cf'),'onDelete':'cascade','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xaf')][_0x4dfa('0x124')](db['SugarcrmField'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xaf')][_0x4dfa('0x124')](db['SugarcrmField'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':'FieldId'});db[_0x4dfa('0xaf')][_0x4dfa('0x162')](db[_0x4dfa('0xad')],{'as':'Account','foreignKey':_0x4dfa('0x1cd')});db['SugarcrmField'][_0x4dfa('0x124')](db[_0x4dfa('0x1d6')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1d6')]['hasMany'](db['SugarcrmField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db['SugarcrmField'][_0x4dfa('0x124')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x4dfa('0x1d6')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xb0')][_0x4dfa('0x124')](db[_0x4dfa('0x1d8')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':'AccountId'});db[_0x4dfa('0x1d8')][_0x4dfa('0x124')](db[_0x4dfa('0xb3')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1d8')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0x1d8')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':'FieldId'});db[_0x4dfa('0x1d8')][_0x4dfa('0x162')](db['DeskAccount'],{'as':_0x4dfa('0x189'),'foreignKey':'AccountId'});db[_0x4dfa('0x1d8')][_0x4dfa('0x134')](db['Tag'],{'through':_0x4dfa('0x1d9')});db['DeskField']['hasMany'](db[_0x4dfa('0xb3')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xb3')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xb3')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xb3')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xb5')][_0x4dfa('0x124')](db[_0x4dfa('0xb7')],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xb7')][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1cf'),'onDelete':'cascade','foreignKey':_0x4dfa('0x1d0')});db['ZohoConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':'FieldId'});db[_0x4dfa('0xb7')][_0x4dfa('0x162')](db[_0x4dfa('0xb5')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db['ZohoField'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xb9')][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1d5'),'foreignKey':'FieldId'});db[_0x4dfa('0xb9')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xbb')][_0x4dfa('0x124')](db[_0x4dfa('0xbc')],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xbc')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1cf'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xbc')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xbc')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':'Fields','foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xbc')][_0x4dfa('0x162')](db[_0x4dfa('0xbb')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xbc')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1da')});db[_0x4dfa('0xbe')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1d4'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x4dfa('0x124')](db['ZendeskField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xbe')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db['ZendeskField'][_0x4dfa('0x162')](db['Variable'],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xc0')][_0x4dfa('0x124')](db[_0x4dfa('0xc1')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xc1')]['hasMany'](db['FreshdeskField'],{'as':_0x4dfa('0x1cf'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xc1')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xc1')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xc1')][_0x4dfa('0x162')](db[_0x4dfa('0xc0')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xc1')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1db')});db[_0x4dfa('0xc3')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xc3')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xc3')]['hasMany'](db[_0x4dfa('0xc3')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db['FreshdeskField'][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0xc5')][_0x4dfa('0x124')](db[_0x4dfa('0x1dd')],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db['VtigerConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1cf'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1dd')]['hasMany'](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0x1dd')]['hasMany'](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1ca'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0x1dd')][_0x4dfa('0x162')](db[_0x4dfa('0xc5')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xc8')][_0x4dfa('0x124')](db['VtigerField'],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xc8')][_0x4dfa('0x124')](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xc8')][_0x4dfa('0x124')](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db['VtigerField'][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0x1de')][_0x4dfa('0x124')](db[_0x4dfa('0xcb')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xcb')][_0x4dfa('0x124')](db['ServicenowField'],{'as':_0x4dfa('0x1cf'),'foreignKey':'SubjectId'});db[_0x4dfa('0xcb')][_0x4dfa('0x124')](db[_0x4dfa('0xcd')],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db['ServicenowConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xcd')],{'as':'Fields','foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xcb')][_0x4dfa('0x162')](db['ServicenowAccount'],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db['ServicenowField'][_0x4dfa('0x124')](db[_0x4dfa('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4dfa('0xcd')][_0x4dfa('0x124')](db['ServicenowField'],{'as':'Description','foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xcd')][_0x4dfa('0x124')](db['ServicenowField'],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xcd')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0x1df')][_0x4dfa('0x124')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db['Dynamics365Account'][_0x4dfa('0x162')](db[_0x4dfa('0x177')],{'as':_0x4dfa('0x177'),'foreignKey':_0x4dfa('0x178')});db[_0x4dfa('0xcf')][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1cf'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d0')});db['Dynamics365Configuration'][_0x4dfa('0x124')](db['Dynamics365Field'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db['Dynamics365Configuration'][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xcf')][_0x4dfa('0x162')](db[_0x4dfa('0x1df')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db['Dynamics365Field'][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db['Dynamics365Field'][_0x4dfa('0x124')](db['Dynamics365Field'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xd1')][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xd1')][_0x4dfa('0x162')](db['Variable'],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db['FreshsalesAccount']['hasMany'](db[_0x4dfa('0xd5')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xd5')][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':'Subjects','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xd5')][_0x4dfa('0x124')](db['FreshsalesField'],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xd5')][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':_0x4dfa('0x1ca'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x4dfa('0x162')](db[_0x4dfa('0xd3')],{'as':_0x4dfa('0x189'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':'Subject','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xd7')][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xd7')][_0x4dfa('0x124')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xd7')]['belongsTo'](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x69')],{});db[_0x4dfa('0xdb')]['belongsTo'](db['ChatMessage'],{});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x6e')],{});db[_0x4dfa('0x1ab')][_0x4dfa('0x162')](db['User'],{'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1e0')});db['ChatInternalMessage']['belongsTo'](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1e1')});db[_0x4dfa('0xe0')]['hasMany'](db[_0x4dfa('0x1e2')],{'foreignKey':_0x4dfa('0x1e3'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0xe0')]['hasMany'](db[_0x4dfa('0xde')],{'foreignKey':_0x4dfa('0x1e3'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0xe2')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{});db[_0x4dfa('0xe2')]['belongsTo'](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4dfa('0xe2')]['belongsTo'](db[_0x4dfa('0x5a')],{});db[_0x4dfa('0xe2')][_0x4dfa('0x162')](db['SmsMessage'],{});db[_0x4dfa('0xe2')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0xe2')]['belongsTo'](db['SmsQueue'],{});db[_0x4dfa('0xe8')][_0x4dfa('0x124')](db['JscriptySessionReport'],{'foreignKey':_0x4dfa('0x1e4')});db['JscriptyProject'][_0x4dfa('0x124')](db[_0x4dfa('0x1e2')],{'foreignKey':_0x4dfa('0x1e4')});db[_0x4dfa('0xe8')][_0x4dfa('0x124')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['Team'][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':'user_has_teams'});db['Team'][_0x4dfa('0x134')](db[_0x4dfa('0x1e')],{'through':_0x4dfa('0x117'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x4dfa('0x182'),'as':'MailQueues'});db[_0x4dfa('0xf2')][_0x4dfa('0x134')](db[_0x4dfa('0x6e')],{'through':_0x4dfa('0x1e5'),'as':_0x4dfa('0x149')});db[_0x4dfa('0xf2')]['belongsToMany'](db[_0x4dfa('0x14a')],{'through':_0x4dfa('0x198'),'as':_0x4dfa('0x14b')});db[_0x4dfa('0xf2')][_0x4dfa('0x134')](db[_0x4dfa('0x5d')],{'through':_0x4dfa('0x19d'),'as':_0x4dfa('0x14c')});db[_0x4dfa('0xf2')][_0x4dfa('0x134')](db[_0x4dfa('0x62')],{'through':_0x4dfa('0x1a5'),'as':_0x4dfa('0x1e6')});db['Team'][_0x4dfa('0x134')](db[_0x4dfa('0x1e7')],{'through':_0x4dfa('0x1e8'),'as':_0x4dfa('0x14e')});db[_0x4dfa('0xf2')]['belongsToMany'](db['VoicePrefix'],{'through':_0x4dfa('0x119'),'as':_0x4dfa('0x1e9')});db[_0x4dfa('0xf6')]['hasMany'](db['CmHopper'],{'as':_0x4dfa('0x130'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')]['hasMany'](db[_0x4dfa('0x7b')],{'as':_0x4dfa('0x129'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')][_0x4dfa('0x124')](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x161'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')][_0x4dfa('0x124')](db['CmHopperBlack'],{'as':_0x4dfa('0x1ea'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')][_0x4dfa('0x162')](db[_0x4dfa('0x163')],{'as':'Trunk','foreignKey':_0x4dfa('0x164')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x4dfa('0x165'),'foreignKey':'TrunkBackupId'});db[_0x4dfa('0xf6')][_0x4dfa('0x162')](db['Interval'],{'as':_0x4dfa('0x88'),'foreignKey':'IntervalId'});db[_0x4dfa('0xf6')][_0x4dfa('0x162')](db[_0x4dfa('0xec')],{'as':_0x4dfa('0xec'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x13a'),'through':_0x4dfa('0x1eb')});db[_0x4dfa('0xf6')][_0x4dfa('0x134')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x16b'),'through':'campaigns_has_cm_blacklists'});db[_0x4dfa('0xfa')][_0x4dfa('0x162')](db[_0x4dfa('0x6d')],{'as':_0x4dfa('0x6d'),'foreignKey':_0x4dfa('0x18a')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x47')],{});db['MailTransferReport'][_0x4dfa('0x162')](db['MailInteraction'],{});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'foreignKey':'FromMailAccountId','as':_0x4dfa('0x1ed')});db[_0x4dfa('0x1ec')]['belongsTo'](db['User'],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db['User'],{'foreignKey':_0x4dfa('0x1f0'),'as':_0x4dfa('0x1f1')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x41')],{'foreignKey':_0x4dfa('0x1f2'),'as':_0x4dfa('0x1f3')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'foreignKey':_0x4dfa('0x1f4'),'as':_0x4dfa('0x1f5')});db['ChatTransferReport'][_0x4dfa('0x162')](db['ChatMessage'],{});db[_0x4dfa('0xfe')]['belongsTo'](db[_0x4dfa('0x69')],{});db[_0x4dfa('0xfe')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'foreignKey':_0x4dfa('0x1f6'),'as':_0x4dfa('0x1ed')});db[_0x4dfa('0xfe')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db['ChatTransferReport'][_0x4dfa('0x162')](db['User'],{'foreignKey':_0x4dfa('0x1f0'),'as':_0x4dfa('0x1f1')});db[_0x4dfa('0xfe')][_0x4dfa('0x162')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x4dfa('0x1f3')});db[_0x4dfa('0xfe')]['belongsTo'](db[_0x4dfa('0x64')],{'foreignKey':_0x4dfa('0x1f7'),'as':_0x4dfa('0x1f5')});db['FaxTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x54')],{});db[_0x4dfa('0x100')][_0x4dfa('0x162')](db[_0x4dfa('0x192')],{});db['FaxTransferReport'][_0x4dfa('0x162')](db['FaxAccount'],{'foreignKey':_0x4dfa('0x1f8'),'as':_0x4dfa('0x1ed')});db[_0x4dfa('0x100')]['belongsTo'](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x100')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1f0'),'as':'ToAgent'});db[_0x4dfa('0x100')][_0x4dfa('0x162')](db[_0x4dfa('0x14a')],{'foreignKey':_0x4dfa('0x1f9'),'as':'ToQueue'});db['FaxTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x50')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x1a4')],{});db[_0x4dfa('0x102')][_0x4dfa('0x162')](db[_0x4dfa('0x12c')],{});db[_0x4dfa('0x102')]['belongsTo'](db[_0x4dfa('0x19e')],{'foreignKey':_0x4dfa('0x1fa'),'as':'FromAccount'});db[_0x4dfa('0x102')]['belongsTo'](db['User'],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x102')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':'ToUserId','as':_0x4dfa('0x1f1')});db[_0x4dfa('0x102')][_0x4dfa('0x162')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x4dfa('0x1f3')});db['OpenchannelTransferReport'][_0x4dfa('0x162')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x4dfa('0x1f5')});db['SmsTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x5b')],{});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db['SmsInteraction'],{});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db['SmsAccount'],{'foreignKey':_0x4dfa('0x1fc'),'as':'FromAccount'});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db['SmsTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1f0'),'as':'ToAgent'});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db[_0x4dfa('0x5d')],{'foreignKey':_0x4dfa('0x1fd'),'as':_0x4dfa('0x1f3')});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{'foreignKey':_0x4dfa('0x1fe'),'as':_0x4dfa('0x1f5')});db[_0x4dfa('0x139')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':'ListId','onDelete':'cascade'});db['CmList']['hasMany'](db[_0x4dfa('0x7f')],{'as':_0x4dfa('0x1ff'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['hasMany'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x137'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['hasMany'](db[_0x4dfa('0x7b')],{'as':_0x4dfa('0x129'),'foreignKey':_0x4dfa('0x18d')});db['CmList'][_0x4dfa('0x124')](db['CmHopperHistory'],{'as':_0x4dfa('0x12b'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['hasMany'](db[_0x4dfa('0x7e')],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['belongsToMany'](db[_0x4dfa('0x1e')],{'as':_0x4dfa('0x200'),'through':_0x4dfa('0x168')});db[_0x4dfa('0x139')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x13b')});db[_0x4dfa('0x106')][_0x4dfa('0x124')](db['VoiceExtension'],{'as':_0x4dfa('0x128'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x106')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x11b')});db[_0x4dfa('0x106')]['belongsToMany'](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x119'),'as':_0x4dfa('0x16a')});db['UserProfile'][_0x4dfa('0x124')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x4dfa('0x132')][_0x4dfa('0x124')](db[_0x4dfa('0x108')],{'as':_0x4dfa('0x201'),'foreignKey':_0x4dfa('0x133'),'onDelete':'cascade'});db[_0x4dfa('0x108')][_0x4dfa('0x124')](db[_0x4dfa('0x202')],{'as':_0x4dfa('0x203'),'foreignKey':_0x4dfa('0x204'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x158')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x4dfa('0x205'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x158')]['hasMany'](db[_0x4dfa('0x83')],{'as':'Answers','foreignKey':_0x4dfa('0x205')});db['WhatsappAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x111')],{'as':_0x4dfa('0x16e'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x4dfa('0x124')](db['WhatsappInteraction'],{'as':_0x4dfa('0x17e')});db[_0x4dfa('0x158')][_0x4dfa('0x124')](db[_0x4dfa('0x10d')],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x205'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x158')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0x4dfa('0x162')](db['Pause'],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db['WhatsappAccount']['belongsToMany'](db['User'],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x206')});db[_0x4dfa('0x10d')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x10d')][_0x4dfa('0x162')](db['WhatsappQueue'],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x10d')][_0x4dfa('0x162')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x4dfa('0x10d')]['belongsTo'](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db['WhatsappApplication']['belongsTo'](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x10f')]['hasMany'](db[_0x4dfa('0x111')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x207')});db[_0x4dfa('0x10f')][_0x4dfa('0x162')](db[_0x4dfa('0x158')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x205')});db[_0x4dfa('0x10f')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x184'),'foreignKey':_0x4dfa('0x122')});db['WhatsappInteraction'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1c0'),'as':_0x4dfa('0x186')});db[_0x4dfa('0x10f')]['belongsToMany'](db[_0x4dfa('0x91')],{'through':'whatsapp_interaction_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x10f')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Users','through':_0x4dfa('0x146'),'foreignKey':_0x4dfa('0x207')});db[_0x4dfa('0x111')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':'Contact'});db[_0x4dfa('0x111')][_0x4dfa('0x162')](db['WhatsappInteraction'],{'onDelete':_0x4dfa('0x121'),'as':'Interaction','foreignKey':_0x4dfa('0x207')});db[_0x4dfa('0x111')][_0x4dfa('0x162')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x158')],{});db[_0x4dfa('0x113')]['belongsTo'](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x113')]['belongsTo'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db['WhatsappQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x10f')],{});db[_0x4dfa('0x113')][_0x4dfa('0x162')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x111')],{});db[_0x4dfa('0x113')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x111')],{});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x10f')],{});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x158')],{'foreignKey':'FromWhatsappAccountId','as':_0x4dfa('0x1ed')});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db['WhatsappAccount'],{'foreignKey':_0x4dfa('0x209'),'as':'ToAccount'});db[_0x4dfa('0x208')]['belongsTo'](db[_0x4dfa('0x1e7')],{'foreignKey':'ToQueueId','as':_0x4dfa('0x1f3')});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1f0'),'as':'ToAgent'});db[_0x4dfa('0x1e7')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Agents','through':_0x4dfa('0x3a'),'foreignKey':_0x4dfa('0x20a')});db[_0x4dfa('0x1e7')][_0x4dfa('0x134')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x4dfa('0x16a')});db[_0x4dfa('0x11d')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x20b'),'foreignKey':_0x4dfa('0x122'),'onDelete':'cascade','hooks':!![]});db[_0x4dfa('0x177')][_0x4dfa('0x120')](db[_0x4dfa('0x1df')],{'as':'Dynamics365Account','onDelete':_0x4dfa('0x179')});db['CloudProvider'][_0x4dfa('0x120')](db['MailServerIn'],{'as':'Imap','onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x177')]['hasOne'](db[_0x4dfa('0x3e')],{'as':'Smtp','onDelete':'restrict'});module[_0x4dfa('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 55b5a33..673c260 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64bf=['./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/triggers','./api/trigger','/api/variables','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','get','appPath','/index.html','./errors','./config/environment','setupLoggers','./api/client-side-logs','then','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/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/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x64bf,0xcb));var _0xf64b=function(_0x199be6,_0x528b00){_0x199be6=_0x199be6-0x0;var _0x4db736=_0x64bf[_0x199be6];return _0x4db736;};'use strict';var path=require('path');var express=require('express');var errors=require(_0xf64b('0x0'));var config=require(_0xf64b('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0xf64b('0x2')];var clientSideLogs=require(_0xf64b('0x3'));exports['default']=function(_0x11ee3a){return setupLoggers(_0x11ee3a)[_0xf64b('0x4')](function(){_0x11ee3a['use']('/api/users',require(_0xf64b('0x5')));_0x11ee3a['use'](_0xf64b('0x6'),require(_0xf64b('0x7')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x9'),require(_0xf64b('0xa')));_0x11ee3a['use'](_0xf64b('0xb'),require('./api/voiceExtension'));_0x11ee3a['use'](_0xf64b('0xc'),require(_0xf64b('0xd')));_0x11ee3a[_0xf64b('0x8')]('/api/voice/queues',require(_0xf64b('0xe')));_0x11ee3a['use'](_0xf64b('0xf'),require('./api/voiceRecording'));_0x11ee3a['use'](_0xf64b('0x10'),require(_0xf64b('0x11')));_0x11ee3a[_0xf64b('0x8')]('/api/voice/mails',require(_0xf64b('0x12')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x13'),require(_0xf64b('0x14')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x15'),require('./api/voiceCallReport'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x16'),require(_0xf64b('0x17')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x18'),require(_0xf64b('0x19')));_0x11ee3a['use'](_0xf64b('0x1a'),require(_0xf64b('0x1b')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x1c'),require(_0xf64b('0x1d')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x1e'),require(_0xf64b('0x1f')));_0x11ee3a[_0xf64b('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x20'),require('./api/mailServerOut'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x21'),require(_0xf64b('0x22')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x23'),require(_0xf64b('0x24')));_0x11ee3a['use'](_0xf64b('0x25'),require('./api/mailSubstatus'));_0x11ee3a['use'](_0xf64b('0x26'),require(_0xf64b('0x27')));_0x11ee3a[_0xf64b('0x8')]('/api/mail/messages',require(_0xf64b('0x28')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x29'),require(_0xf64b('0x2a')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x2b'),require('./api/mailQueueReport'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x2c'),require(_0xf64b('0x2d')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x2e'),require(_0xf64b('0x2f')));_0x11ee3a['use'](_0xf64b('0x30'),require(_0xf64b('0x31')));_0x11ee3a['use'](_0xf64b('0x32'),require(_0xf64b('0x33')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x34'),require(_0xf64b('0x35')));_0x11ee3a[_0xf64b('0x8')]('/api/fax/messages',require(_0xf64b('0x36')));_0x11ee3a[_0xf64b('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x37'),require(_0xf64b('0x38')));_0x11ee3a['use'](_0xf64b('0x39'),require(_0xf64b('0x3a')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x3b'),require(_0xf64b('0x3c')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x3d'),require('./api/smsInteraction'));_0x11ee3a['use'](_0xf64b('0x3e'),require('./api/smsMessage'));_0x11ee3a['use']('/api/sms/queues',require(_0xf64b('0x3f')));_0x11ee3a['use'](_0xf64b('0x40'),require(_0xf64b('0x41')));_0x11ee3a[_0xf64b('0x8')]('/api/openchannel/applications',require(_0xf64b('0x42')));_0x11ee3a[_0xf64b('0x8')]('/api/openchannel/interactions',require(_0xf64b('0x43')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x44'),require(_0xf64b('0x45')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x46'),require(_0xf64b('0x47')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x48'),require(_0xf64b('0x49')));_0x11ee3a[_0xf64b('0x8')]('/api/openchannel/reports/queue',require(_0xf64b('0x4a')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x4b'),require(_0xf64b('0x4c')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x4d'),require(_0xf64b('0x4e')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x4f'),require('./api/chatMessage'));_0x11ee3a['use']('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x50'),require('./api/chatQueue'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x51'),require(_0xf64b('0x52')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x53'),require(_0xf64b('0x54')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x55'),require('./api/cmCompany'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x56'),require(_0xf64b('0x57')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x58'),require(_0xf64b('0x59')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x5a'),require('./api/cmHopperBlack'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x5b'),require(_0xf64b('0x5c')));_0x11ee3a['use']('/api/cm/hopper_history',require(_0xf64b('0x5d')));_0x11ee3a[_0xf64b('0x8')]('/api/cm/custom_fields',require(_0xf64b('0x5e')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x5f'),require('./api/action'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x60'),require(_0xf64b('0x61')));_0x11ee3a['use']('/api/canned_answers',require(_0xf64b('0x62')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x63'),require('./api/disposition'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x64'),require('./api/condition'));_0x11ee3a[_0xf64b('0x8')]('/api/intervals',require(_0xf64b('0x65')));_0x11ee3a['use']('/api/pauses',require(_0xf64b('0x66')));_0x11ee3a[_0xf64b('0x8')]('/api/cdr',require(_0xf64b('0x67')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x68'),require(_0xf64b('0x69')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x6a'),require(_0xf64b('0x6b')));_0x11ee3a['use'](_0xf64b('0x6c'),require('./api/sound'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x6d'),require(_0xf64b('0x6e')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x6f'),require(_0xf64b('0x70')));_0x11ee3a[_0xf64b('0x8')]('/api/cm_contact_has_items',require(_0xf64b('0x71')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x72'),require('./api/cmHopperAdditionalPhone'));_0x11ee3a['use']('/api/templates',require('./api/template'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x73'),require(_0xf64b('0x74')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x75'),require('./api/variable'));_0x11ee3a[_0xf64b('0x8')]('/api/integrations',require('./api/integration'));_0x11ee3a[_0xf64b('0x8')]('/api/integrations/reports',require('./api/integrationReport'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x76'),require(_0xf64b('0x77')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x78'),require(_0xf64b('0x79')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x7a'),require(_0xf64b('0x7b')));_0x11ee3a['use'](_0xf64b('0x7c'),require(_0xf64b('0x7d')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x7e'),require('./api/analyticFieldReport'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x7f'),require(_0xf64b('0x80')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x81'),require('./api/intSalesforceAccount'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x82'),require('./api/intSalesforceConfiguration'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x83'),require('./api/intSalesforceField'));_0x11ee3a[_0xf64b('0x8')]('/api/integrations/sugarcrm/accounts',require(_0xf64b('0x84')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x85'),require(_0xf64b('0x86')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x87'),require('./api/intSugarcrmField'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x88'),require(_0xf64b('0x89')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x8a'),require(_0xf64b('0x8b')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x8c'),require(_0xf64b('0x8d')));_0x11ee3a['use'](_0xf64b('0x8e'),require(_0xf64b('0x8f')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x90'),require(_0xf64b('0x91')));_0x11ee3a['use']('/api/integrations/zoho/fields',require(_0xf64b('0x92')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x93'),require(_0xf64b('0x94')));_0x11ee3a['use'](_0xf64b('0x95'),require(_0xf64b('0x96')));_0x11ee3a['use'](_0xf64b('0x97'),require('./api/intZendeskField'));_0x11ee3a[_0xf64b('0x8')]('/api/integrations/freshdesk/accounts',require(_0xf64b('0x98')));_0x11ee3a[_0xf64b('0x8')]('/api/integrations/freshdesk/configurations',require(_0xf64b('0x99')));_0x11ee3a['use'](_0xf64b('0x9a'),require(_0xf64b('0x9b')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x9c'),require(_0xf64b('0x9d')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x9e'),require(_0xf64b('0x9f')));_0x11ee3a['use'](_0xf64b('0xa0'),require(_0xf64b('0xa1')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xa2'),require(_0xf64b('0xa3')));_0x11ee3a['use'](_0xf64b('0xa4'),require(_0xf64b('0xa5')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xa6'),require(_0xf64b('0xa7')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xa8'),require(_0xf64b('0xa9')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xaa'),require(_0xf64b('0xab')));_0x11ee3a['use']('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xac'),require(_0xf64b('0xad')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xae'),require(_0xf64b('0xaf')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xb0'),require(_0xf64b('0xb1')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xb2'),require(_0xf64b('0xb3')));_0x11ee3a[_0xf64b('0x8')]('/api/chat/reports/queue',require(_0xf64b('0xb4')));_0x11ee3a[_0xf64b('0x8')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xb5'),require(_0xf64b('0xb6')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xb7'),require(_0xf64b('0xb8')));_0x11ee3a['use'](_0xf64b('0xb9'),require(_0xf64b('0xba')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xbb'),require(_0xf64b('0xbc')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xbd'),require(_0xf64b('0xbe')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xbf'),require(_0xf64b('0xc0')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xc1'),require(_0xf64b('0xc2')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xc3'),require(_0xf64b('0xc4')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xc5'),require(_0xf64b('0xc6')));_0x11ee3a[_0xf64b('0x8')]('/api/square/projects',require(_0xf64b('0xc7')));_0x11ee3a['use'](_0xf64b('0xc8'),require(_0xf64b('0xc9')));_0x11ee3a['use'](_0xf64b('0xca'),require(_0xf64b('0xcb')));_0x11ee3a['use'](_0xf64b('0xcc'),require(_0xf64b('0xcd')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xce'),require(_0xf64b('0xcf')));_0x11ee3a[_0xf64b('0x8')]('/api/campaigns',require(_0xf64b('0xd0')));_0x11ee3a['use']('/api/migrations',require(_0xf64b('0xd1')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xd2'),require(_0xf64b('0xd3')));_0x11ee3a[_0xf64b('0x8')]('/api/plugins',require(_0xf64b('0xd4')));_0x11ee3a[_0xf64b('0x8')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xd5'),require(_0xf64b('0xd6')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xd7'),require(_0xf64b('0xd8')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xd9'),require(_0xf64b('0xda')));_0x11ee3a['use'](_0xf64b('0xdb'),require(_0xf64b('0xdc')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xdd'),require('./api/cmList'));_0x11ee3a['use'](_0xf64b('0xde'),require(_0xf64b('0xdf')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xe0'),require(_0xf64b('0xe1')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xe2'),require(_0xf64b('0xe3')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xe4'),require(_0xf64b('0xe5')));_0x11ee3a['use'](_0xf64b('0xe6'),require('./api/userNotification'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xe7'),require(_0xf64b('0xe8')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xe9'),require('./api/whatsappApplication'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xea'),require(_0xf64b('0xeb')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xec'),require(_0xf64b('0xed')));_0x11ee3a['use'](_0xf64b('0xee'),require(_0xf64b('0xef')));_0x11ee3a['use'](_0xf64b('0xf0'),require(_0xf64b('0xf1')));_0x11ee3a['use'](_0xf64b('0xf2'),require('./api/whatsappQueue'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xf3'),require(_0xf64b('0xf4')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xf5'),require(_0xf64b('0xf6')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xf7'),require('./api/user-setting'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xf8'),require(_0xf64b('0xf9')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xfa'),require('./api/authLocal'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xfb'),require('./api/authGoogle'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xfc'),require(_0xf64b('0xfd')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0xfe'),require(_0xf64b('0xff')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x100'),require('./api/rpc'));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x101'),require(_0xf64b('0x102')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x103'),require(_0xf64b('0x104')));_0x11ee3a[_0xf64b('0x8')]('/api/pm2',require(_0xf64b('0x105')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x106'),require(_0xf64b('0x107')));_0x11ee3a['use'](_0xf64b('0x108'),clientSideLogs);_0x11ee3a[_0xf64b('0x8')]('/apidoc',express[_0xf64b('0x109')](path[_0xf64b('0x10a')](config['root'],_0xf64b('0x10b'))));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x10c'),express[_0xf64b('0x109')](path[_0xf64b('0x10a')](config[_0xf64b('0x10d')],_0xf64b('0x10c'))));_0x11ee3a[_0xf64b('0x8')]('/demo',express[_0xf64b('0x109')](path['join'](config[_0xf64b('0x10d')],'/demo')));_0x11ee3a[_0xf64b('0x8')](_0xf64b('0x10e'),express[_0xf64b('0x109')](path[_0xf64b('0x10a')](config[_0xf64b('0x10d')],_0xf64b('0x10f'),_0xf64b('0x110'))));_0x11ee3a['use'](_0xf64b('0x111'),express[_0xf64b('0x109')](path[_0xf64b('0x10a')](config[_0xf64b('0x10d')],_0xf64b('0x112'))));_0x11ee3a[_0xf64b('0x113')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xf64b('0x114')](errors[0x194]);_0x11ee3a['route']('/*')[_0xf64b('0x114')](function(_0x30703c,_0xb9e2b2){_0xb9e2b2['sendFile'](path['resolve'](_0x11ee3a['get'](_0xf64b('0x115'))+_0xf64b('0x116')));});return _0x11ee3a;});}; \ No newline at end of file +var _0x757c=['./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/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/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/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/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites'];(function(_0x3a953a,_0x5e6d37){var _0x4b04e4=function(_0x34e3ff){while(--_0x34e3ff){_0x3a953a['push'](_0x3a953a['shift']());}};_0x4b04e4(++_0x5e6d37);}(_0x757c,0xc9));var _0xc757=function(_0x1ccf0b,_0x571ed6){_0x1ccf0b=_0x1ccf0b-0x0;var _0x4ac5b3=_0x757c[_0x1ccf0b];return _0x4ac5b3;};'use strict';var path=require(_0xc757('0x0'));var express=require(_0xc757('0x1'));var errors=require('./errors');var config=require(_0xc757('0x2'));var setupLoggers=require(_0xc757('0x3'))[_0xc757('0x4')];var clientSideLogs=require(_0xc757('0x5'));exports[_0xc757('0x6')]=function(_0x4165bb){return setupLoggers(_0x4165bb)[_0xc757('0x7')](function(){_0x4165bb[_0xc757('0x8')](_0xc757('0x9'),require(_0xc757('0xa')));_0x4165bb['use'](_0xc757('0xb'),require(_0xc757('0xc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd'),require('./api/voiceContext'));_0x4165bb[_0xc757('0x8')]('/api/voice/extensions',require(_0xc757('0xe')));_0x4165bb[_0xc757('0x8')]('/api/voice/mohs',require(_0xc757('0xf')));_0x4165bb[_0xc757('0x8')](_0xc757('0x10'),require(_0xc757('0x11')));_0x4165bb[_0xc757('0x8')](_0xc757('0x12'),require('./api/voiceRecording'));_0x4165bb['use'](_0xc757('0x13'),require(_0xc757('0x14')));_0x4165bb[_0xc757('0x8')](_0xc757('0x15'),require('./api/voiceMail'));_0x4165bb[_0xc757('0x8')](_0xc757('0x16'),require('./api/voiceMailMessage'));_0x4165bb[_0xc757('0x8')](_0xc757('0x17'),require(_0xc757('0x18')));_0x4165bb[_0xc757('0x8')](_0xc757('0x19'),require(_0xc757('0x1a')));_0x4165bb['use'](_0xc757('0x1b'),require(_0xc757('0x1c')));_0x4165bb['use'](_0xc757('0x1d'),require(_0xc757('0x1e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x1f'),require(_0xc757('0x20')));_0x4165bb[_0xc757('0x8')](_0xc757('0x21'),require(_0xc757('0x22')));_0x4165bb[_0xc757('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0x23'),require('./api/mailServerOut'));_0x4165bb[_0xc757('0x8')](_0xc757('0x24'),require(_0xc757('0x25')));_0x4165bb['use'](_0xc757('0x26'),require(_0xc757('0x27')));_0x4165bb[_0xc757('0x8')](_0xc757('0x28'),require(_0xc757('0x29')));_0x4165bb['use'](_0xc757('0x2a'),require('./api/mailInteraction'));_0x4165bb[_0xc757('0x8')](_0xc757('0x2b'),require(_0xc757('0x2c')));_0x4165bb[_0xc757('0x8')](_0xc757('0x2d'),require(_0xc757('0x2e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x2f'),require('./api/mailQueueReport'));_0x4165bb['use'](_0xc757('0x30'),require(_0xc757('0x31')));_0x4165bb[_0xc757('0x8')](_0xc757('0x32'),require('./api/dashboardItem'));_0x4165bb[_0xc757('0x8')](_0xc757('0x33'),require(_0xc757('0x34')));_0x4165bb[_0xc757('0x8')](_0xc757('0x35'),require(_0xc757('0x36')));_0x4165bb[_0xc757('0x8')](_0xc757('0x37'),require(_0xc757('0x38')));_0x4165bb[_0xc757('0x8')]('/api/fax/messages',require(_0xc757('0x39')));_0x4165bb[_0xc757('0x8')](_0xc757('0x3a'),require('./api/faxQueue'));_0x4165bb[_0xc757('0x8')](_0xc757('0x3b'),require(_0xc757('0x3c')));_0x4165bb[_0xc757('0x8')](_0xc757('0x3d'),require(_0xc757('0x3e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x3f'),require('./api/smsApplication'));_0x4165bb[_0xc757('0x8')](_0xc757('0x40'),require(_0xc757('0x41')));_0x4165bb[_0xc757('0x8')](_0xc757('0x42'),require(_0xc757('0x43')));_0x4165bb[_0xc757('0x8')](_0xc757('0x44'),require(_0xc757('0x45')));_0x4165bb[_0xc757('0x8')](_0xc757('0x46'),require(_0xc757('0x47')));_0x4165bb[_0xc757('0x8')](_0xc757('0x48'),require(_0xc757('0x49')));_0x4165bb['use'](_0xc757('0x4a'),require(_0xc757('0x4b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x4c'),require('./api/openchannelMessage'));_0x4165bb[_0xc757('0x8')](_0xc757('0x4d'),require('./api/openchannelQueue'));_0x4165bb[_0xc757('0x8')](_0xc757('0x4e'),require(_0xc757('0x4f')));_0x4165bb[_0xc757('0x8')](_0xc757('0x50'),require(_0xc757('0x51')));_0x4165bb[_0xc757('0x8')]('/api/chat/applications',require(_0xc757('0x52')));_0x4165bb['use']('/api/chat/interactions',require(_0xc757('0x53')));_0x4165bb[_0xc757('0x8')](_0xc757('0x54'),require(_0xc757('0x55')));_0x4165bb[_0xc757('0x8')]('/api/chat/offline_messages',require(_0xc757('0x56')));_0x4165bb[_0xc757('0x8')](_0xc757('0x57'),require('./api/chatQueue'));_0x4165bb[_0xc757('0x8')](_0xc757('0x58'),require(_0xc757('0x59')));_0x4165bb[_0xc757('0x8')](_0xc757('0x5a'),require(_0xc757('0x5b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x5c'),require('./api/cmCompany'));_0x4165bb['use'](_0xc757('0x5d'),require(_0xc757('0x5e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x5f'),require('./api/cmHopper'));_0x4165bb[_0xc757('0x8')](_0xc757('0x60'),require('./api/cmHopperBlack'));_0x4165bb[_0xc757('0x8')](_0xc757('0x61'),require(_0xc757('0x62')));_0x4165bb['use']('/api/cm/hopper_history',require(_0xc757('0x63')));_0x4165bb['use'](_0xc757('0x64'),require(_0xc757('0x65')));_0x4165bb[_0xc757('0x8')](_0xc757('0x66'),require(_0xc757('0x67')));_0x4165bb[_0xc757('0x8')](_0xc757('0x68'),require(_0xc757('0x69')));_0x4165bb[_0xc757('0x8')](_0xc757('0x6a'),require(_0xc757('0x6b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x6c'),require(_0xc757('0x6d')));_0x4165bb[_0xc757('0x8')](_0xc757('0x6e'),require('./api/condition'));_0x4165bb[_0xc757('0x8')](_0xc757('0x6f'),require(_0xc757('0x70')));_0x4165bb['use']('/api/pauses',require(_0xc757('0x71')));_0x4165bb[_0xc757('0x8')]('/api/cdr',require('./api/cdr'));_0x4165bb[_0xc757('0x8')](_0xc757('0x72'),require(_0xc757('0x73')));_0x4165bb['use'](_0xc757('0x74'),require(_0xc757('0x75')));_0x4165bb['use'](_0xc757('0x76'),require(_0xc757('0x77')));_0x4165bb['use']('/api/tags',require(_0xc757('0x78')));_0x4165bb[_0xc757('0x8')](_0xc757('0x79'),require(_0xc757('0x7a')));_0x4165bb[_0xc757('0x8')]('/api/cm_contact_has_items',require(_0xc757('0x7b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x7c'),require(_0xc757('0x7d')));_0x4165bb['use']('/api/templates',require('./api/template'));_0x4165bb[_0xc757('0x8')](_0xc757('0x7e'),require(_0xc757('0x7f')));_0x4165bb[_0xc757('0x8')](_0xc757('0x80'),require(_0xc757('0x81')));_0x4165bb[_0xc757('0x8')]('/api/integrations',require('./api/integration'));_0x4165bb[_0xc757('0x8')](_0xc757('0x82'),require(_0xc757('0x83')));_0x4165bb[_0xc757('0x8')]('/api/analytics/custom_reports',require(_0xc757('0x84')));_0x4165bb[_0xc757('0x8')](_0xc757('0x85'),require(_0xc757('0x86')));_0x4165bb[_0xc757('0x8')](_0xc757('0x87'),require(_0xc757('0x88')));_0x4165bb[_0xc757('0x8')](_0xc757('0x89'),require('./api/analyticMetric'));_0x4165bb[_0xc757('0x8')](_0xc757('0x8a'),require(_0xc757('0x8b')));_0x4165bb['use'](_0xc757('0x8c'),require(_0xc757('0x8d')));_0x4165bb['use'](_0xc757('0x8e'),require(_0xc757('0x8f')));_0x4165bb['use'](_0xc757('0x90'),require(_0xc757('0x91')));_0x4165bb[_0xc757('0x8')]('/api/integrations/salesforce/fields',require(_0xc757('0x92')));_0x4165bb[_0xc757('0x8')](_0xc757('0x93'),require(_0xc757('0x94')));_0x4165bb[_0xc757('0x8')](_0xc757('0x95'),require(_0xc757('0x96')));_0x4165bb[_0xc757('0x8')](_0xc757('0x97'),require(_0xc757('0x98')));_0x4165bb[_0xc757('0x8')]('/api/integrations/desk/accounts',require(_0xc757('0x99')));_0x4165bb['use']('/api/integrations/desk/configurations',require(_0xc757('0x9a')));_0x4165bb[_0xc757('0x8')](_0xc757('0x9b'),require(_0xc757('0x9c')));_0x4165bb['use'](_0xc757('0x9d'),require(_0xc757('0x9e')));_0x4165bb['use'](_0xc757('0x9f'),require(_0xc757('0xa0')));_0x4165bb[_0xc757('0x8')](_0xc757('0xa1'),require('./api/intZohoField'));_0x4165bb[_0xc757('0x8')](_0xc757('0xa2'),require('./api/intZendeskAccount'));_0x4165bb[_0xc757('0x8')]('/api/integrations/zendesk/configurations',require(_0xc757('0xa3')));_0x4165bb[_0xc757('0x8')](_0xc757('0xa4'),require(_0xc757('0xa5')));_0x4165bb['use'](_0xc757('0xa6'),require(_0xc757('0xa7')));_0x4165bb[_0xc757('0x8')](_0xc757('0xa8'),require(_0xc757('0xa9')));_0x4165bb[_0xc757('0x8')](_0xc757('0xaa'),require(_0xc757('0xab')));_0x4165bb[_0xc757('0x8')]('/api/integrations/vtiger/accounts',require(_0xc757('0xac')));_0x4165bb[_0xc757('0x8')]('/api/integrations/vtiger/configurations',require(_0xc757('0xad')));_0x4165bb[_0xc757('0x8')](_0xc757('0xae'),require(_0xc757('0xaf')));_0x4165bb['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4165bb[_0xc757('0x8')](_0xc757('0xb0'),require(_0xc757('0xb1')));_0x4165bb[_0xc757('0x8')](_0xc757('0xb2'),require(_0xc757('0xb3')));_0x4165bb[_0xc757('0x8')](_0xc757('0xb4'),require(_0xc757('0xb5')));_0x4165bb['use'](_0xc757('0xb6'),require('./api/intDynamics365Configuration'));_0x4165bb['use'](_0xc757('0xb7'),require(_0xc757('0xb8')));_0x4165bb['use'](_0xc757('0xb9'),require(_0xc757('0xba')));_0x4165bb['use'](_0xc757('0xbb'),require(_0xc757('0xbc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xbd'),require('./api/intFreshsalesField'));_0x4165bb['use'](_0xc757('0xbe'),require(_0xc757('0xbf')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc0'),require(_0xc757('0xc1')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc2'),require('./api/chatInternalMessage'));_0x4165bb['use'](_0xc757('0xc3'),require('./api/jscriptyAnswerReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0xc4'),require(_0xc757('0xc5')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc6'),require(_0xc757('0xc7')));_0x4165bb['use']('/api/sms/reports/queue',require(_0xc757('0xc8')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc9'),require('./api/squareReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0xca'),require('./api/squareReportDetail'));_0x4165bb['use']('/api/jscripty/projects',require(_0xc757('0xcb')));_0x4165bb[_0xc757('0x8')](_0xc757('0xcc'),require('./api/setting'));_0x4165bb[_0xc757('0x8')](_0xc757('0xcd'),require(_0xc757('0xce')));_0x4165bb[_0xc757('0x8')](_0xc757('0xcf'),require(_0xc757('0xd0')));_0x4165bb[_0xc757('0x8')]('/api/square/recordings',require(_0xc757('0xd1')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd2'),require('./api/squareMessage'));_0x4165bb['use'](_0xc757('0xd3'),require(_0xc757('0xd4')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd5'),require(_0xc757('0xd6')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd7'),require('./api/campaign'));_0x4165bb[_0xc757('0x8')]('/api/migrations',require(_0xc757('0xd8')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd9'),require(_0xc757('0xda')));_0x4165bb[_0xc757('0x8')]('/api/plugins',require('./api/plugin'));_0x4165bb[_0xc757('0x8')](_0xc757('0xdb'),require(_0xc757('0xdc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xdd'),require('./api/chatTransferReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0xde'),require('./api/faxTransferReport'));_0x4165bb[_0xc757('0x8')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x4165bb['use'](_0xc757('0xdf'),require(_0xc757('0xe0')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe1'),require(_0xc757('0xe2')));_0x4165bb['use'](_0xc757('0xe3'),require(_0xc757('0xe4')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe5'),require(_0xc757('0xe6')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe7'),require(_0xc757('0xe8')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe9'),require(_0xc757('0xea')));_0x4165bb[_0xc757('0x8')](_0xc757('0xeb'),require(_0xc757('0xec')));_0x4165bb[_0xc757('0x8')](_0xc757('0xed'),require(_0xc757('0xee')));_0x4165bb[_0xc757('0x8')](_0xc757('0xef'),require(_0xc757('0xf0')));_0x4165bb['use'](_0xc757('0xf1'),require(_0xc757('0xf2')));_0x4165bb[_0xc757('0x8')]('/api/whatsapp/messages',require(_0xc757('0xf3')));_0x4165bb['use'](_0xc757('0xf4'),require(_0xc757('0xf5')));_0x4165bb['use']('/api/whatsapp/reports/transfer',require(_0xc757('0xf6')));_0x4165bb[_0xc757('0x8')](_0xc757('0xf7'),require(_0xc757('0xf8')));_0x4165bb[_0xc757('0x8')]('/api/cloudProviders',require(_0xc757('0xf9')));_0x4165bb[_0xc757('0x8')](_0xc757('0xfa'),require(_0xc757('0xfb')));_0x4165bb['use']('/api/user-settings',require(_0xc757('0xfc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xfd'),require(_0xc757('0xfe')));_0x4165bb[_0xc757('0x8')](_0xc757('0xff'),require(_0xc757('0x100')));_0x4165bb[_0xc757('0x8')](_0xc757('0x101'),require(_0xc757('0x102')));_0x4165bb[_0xc757('0x8')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x4165bb[_0xc757('0x8')](_0xc757('0x103'),require(_0xc757('0x104')));_0x4165bb['use']('/api/rpc',require('./api/rpc'));_0x4165bb['use'](_0xc757('0x105'),require(_0xc757('0x106')));_0x4165bb[_0xc757('0x8')]('/api/system',require(_0xc757('0x107')));_0x4165bb[_0xc757('0x8')]('/api/pm2',require(_0xc757('0x108')));_0x4165bb[_0xc757('0x8')](_0xc757('0x109'),require(_0xc757('0x10a')));_0x4165bb[_0xc757('0x8')](_0xc757('0x10b'),clientSideLogs);_0x4165bb[_0xc757('0x8')](_0xc757('0x10c'),express[_0xc757('0x10d')](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x10c'))));_0x4165bb['use'](_0xc757('0x110'),express[_0xc757('0x10d')](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x110'))));_0x4165bb[_0xc757('0x8')](_0xc757('0x111'),express[_0xc757('0x10d')](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x111'))));_0x4165bb['use'](_0xc757('0x112'),express['static'](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x113'),'3.9.0')));_0x4165bb[_0xc757('0x8')](_0xc757('0x114'),express[_0xc757('0x10d')](path['join'](config[_0xc757('0x10f')],_0xc757('0x115'))));_0x4165bb[_0xc757('0x116')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc757('0x117')](errors[0x194]);_0x4165bb[_0xc757('0x116')]('/*')[_0xc757('0x117')](function(_0x2fd7bc,_0x3d21ff){_0x3d21ff['sendFile'](path['resolve'](_0x4165bb[_0xc757('0x117')]('appPath')+'/index.html'));});return _0x4165bb;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 500d044..8af4d63 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9375=['../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','log','../config/triggers','default','RPC\x20listening\x20on\x20','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc'];(function(_0x22bf7d,_0x1859a6){var _0xb62c63=function(_0xe307a7){while(--_0xe307a7){_0x22bf7d['push'](_0x22bf7d['shift']());}};_0xb62c63(++_0x1859a6);}(_0x9375,0xf8));var _0x5937=function(_0x15cc1c,_0x3e8a24){_0x15cc1c=_0x15cc1c-0x0;var _0x56bc3b=_0x9375[_0x15cc1c];return _0x56bc3b;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0x5937('0x0'));exports[_0x5937('0x1')]=function(){return new Promise(function(_0xe330,_0x39760d){var _0x3bf66c={};_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/user/user.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x3')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x4')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x5')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x6')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x7')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x8')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x9')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0xa')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0xb')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0xc')));_0x3bf66c=_['merge'](_0x3bf66c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/mailServerIn/mailServerIn.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/mailAccount/mailAccount.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0xd')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0xe')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0xf')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x10')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x11')));_0x3bf66c=_['merge'](_0x3bf66c,require('../api/faxAccount/faxAccount.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x12')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/faxInteraction/faxInteraction.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x13')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x14')));_0x3bf66c=_['merge'](_0x3bf66c,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x15')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x16')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x17')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x18')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x19')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x1a')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x1b')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x1c')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x1d')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/chatInteraction/chatInteraction.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x1e')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/chatQueue/chatQueue.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x1f')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x20')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x21')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x22')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x23')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x24')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x25')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x26')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x27')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x28')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x29')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x2a')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x2b')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x2c')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x2d')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x2e')));_0x3bf66c=_['merge'](_0x3bf66c,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x2f')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x30')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x31')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x32')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x33')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x34')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x35')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x36')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x37')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x38')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x39')));_0x3bf66c=_['merge'](_0x3bf66c,require(_0x5937('0x3a')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/squareMessage/squareMessage.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x3b')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x3c')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x3d')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3bf66c=_['merge'](_0x3bf66c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require(_0x5937('0x3e')));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3bf66c=_[_0x5937('0x2')](_0x3bf66c,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4a0fe5=jayson[_0x5937('0x3f')](_0x3bf66c)[_0x5937('0x40')]();var _0x42bcf0=config['rpc']['port']||config['port']+0x1;var _0x3659c8=config[_0x5937('0x41')]['ip']||'localhost';_0x4a0fe5['on']('error',function(_0x38a13e){return _0x39760d(_0x38a13e);});_0x4a0fe5[_0x5937('0x1')](_0x42bcf0,_0x3659c8,function(){console[_0x5937('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3659c8,_0x42bcf0);require(_0x5937('0x43'))[_0x5937('0x44')]();return _0xe330(_0x5937('0x45')+_0x3659c8+':'+_0x42bcf0);});});}; \ No newline at end of file +var _0xc8e9=['../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.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/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../api/user/user.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x12fe56,_0x4930a1){var _0x10aa14=function(_0x4666f6){while(--_0x4666f6){_0x12fe56['push'](_0x12fe56['shift']());}};_0x10aa14(++_0x4930a1);}(_0xc8e9,0x18c));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var _=require(_0x9c8e('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x243a0d,_0xe09bc4){var _0x730907={};_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x1')));_0x730907=_['merge'](_0x730907,require('../api/voiceExtension/voiceExtension.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/voiceQueue/voiceQueue.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x3')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x4')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x5')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x6')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x7')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x8')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x9')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xa')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xb')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xc')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/mailQueue/mailQueue.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xd')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xe')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/mailApplication/mailApplication.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xf')));_0x730907=_['merge'](_0x730907,require('../api/faxAccount/faxAccount.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x10')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x11')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x12')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x13')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x14')));_0x730907=_['merge'](_0x730907,require('../api/smsAccount/smsAccount.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x15')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x16')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x17')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x18')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x19')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1a')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1b')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1c')));_0x730907=_['merge'](_0x730907,require('../api/chatMessage/chatMessage.rpc'));_0x730907=_['merge'](_0x730907,require('../api/chatQueue/chatQueue.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/cmContact/cmContact.rpc'));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x1d')));_0x730907=_['merge'](_0x730907,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1e')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1f')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x20')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/pause/pause.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x21')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x22')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x23')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/trigger/trigger.rpc'));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x24')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x25')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x26')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x27')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x28')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x29')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x2a')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2b')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2c')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x2d')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2e')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2f')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x30')));_0x730907=_['merge'](_0x730907,require('../api/setting/setting.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x31')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x32')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/squareRecording/squareRecording.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x33')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x34')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x35')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x36')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x37')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x38')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x39')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x3a')));var _0x1b91c5=jayson['server'](_0x730907)[_0x9c8e('0x3b')]();var _0x587811=config[_0x9c8e('0x3c')]['port']||config[_0x9c8e('0x3d')]+0x1;var _0x551358=config[_0x9c8e('0x3c')]['ip']||'localhost';_0x1b91c5['on'](_0x9c8e('0x3e'),function(_0x33ce50){return _0xe09bc4(_0x33ce50);});_0x1b91c5[_0x9c8e('0x3f')](_0x587811,_0x551358,function(){console[_0x9c8e('0x40')](_0x9c8e('0x41'),_0x551358,_0x587811);require(_0x9c8e('0x42'))[_0x9c8e('0x43')]();return _0x243a0d(_0x9c8e('0x44')+_0x551358+':'+_0x587811);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 74aad13..0b125c4 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 _0x60ff=['substr','indexOf','split','length','match','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','close','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','wait','exec','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','replace','result='];(function(_0x3e30a8,_0x257732){var _0x5d5d1d=function(_0x2987f1){while(--_0x2987f1){_0x3e30a8['push'](_0x3e30a8['shift']());}};_0x5d5d1d(++_0x257732);}(_0x60ff,0x1e2));var _0xf60f=function(_0x16b477,_0x2935c8){_0x16b477=_0x16b477-0x0;var _0x49287d=_0x60ff[_0x16b477];return _0x49287d;};'use strict';var util=require(_0xf60f('0x0'));var _=require(_0xf60f('0x1'));var EventEmitter=require(_0xf60f('0x2'))[_0xf60f('0x3')];var AGIReply=require(_0xf60f('0x4'));var AGIError=require(_0xf60f('0x5'));function AGIChannel(_0x12d046){var _0x317360=this,_0x1b9ae4=new AGIReply(),_0x56bd39=![],_0x53607d={};EventEmitter[_0xf60f('0x6')](_0x317360);_0x12d046[_0xf60f('0x7')](_0xf60f('0x8'));_0x12d046[_0xf60f('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1b9ae4[_0xf60f('0x7')](_0xf60f('0x8'));_0x1b9ae4['on'](_0xf60f('0xa'),function(_0x912773){for(var _0x231774 in _0x912773){_0x317360[_0x231774]=_0x912773[_0x231774];}_0x317360[_0xf60f('0xb')](_0xf60f('0xc'));});_0x1b9ae4['on'](_0xf60f('0xd'),function(_0x1944dd){if(_0x1944dd[_0xf60f('0xe')]()=='hangup'){_0x317360[_0xf60f('0xb')](_0xf60f('0xf'));return;}if(_0x1944dd[_0xf60f('0x10')](0x0,0xb)==_0xf60f('0x11')){_0x56bd39=!![];}if(_0x56bd39){_0x53607d['rx']+=_0x1944dd+'\x0a';if(_0x1944dd['search'](_0xf60f('0x12'))!=-0x1){_0x56bd39=![];}}else{_0x53607d['rx']=_0x1944dd;}if(_0x56bd39){return;}if(typeof _0x53607d['cb']==_0xf60f('0x13')){var _0x377c45=_0x53607d['rx'][_0xf60f('0x10')](0x0,0x3),_0x5c1361=null,_0xe0f6de=null;_0x377c45=parseInt(_0x377c45);if(isNaN(_0x377c45)){_0x53607d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x377c45!=0xc8){_0x53607d['cb'](null,{'code':_0x377c45,'result':-0x1,'extra':'KO'});return;}_0x5c1361=_0x53607d['rx'][_0xf60f('0x10')](0x4)[_0xf60f('0x14')](_0xf60f('0x15'),'');if(_0x5c1361['indexOf']('\x20')!=-0x1){_0x5c1361=_0x5c1361[_0xf60f('0x16')](0x0,_0x5c1361[_0xf60f('0x17')]('\x20'));}if(_['startsWith'](_0x5c1361,'-1')){_0x5c1361=parseInt(_0x5c1361);}_0xe0f6de=_0x53607d['rx'][_0xf60f('0x18')]('\x20');if(_0xe0f6de[_0xf60f('0x19')]==0x3){_0xe0f6de=_0xe0f6de[0x2][_0xf60f('0x10')](0x1,_0xe0f6de[0x2][_0xf60f('0x19')]-0x1);}else if(_0xe0f6de[_0xf60f('0x19')]>0x3){var _0x5254d6=/\((.+)\)/;var _0x586294=_0x53607d['rx'][_0xf60f('0x1a')](_0x5254d6);if(_0x586294){_0xe0f6de=_0x586294[0x1];}else{_0xe0f6de=null;}}else{_0xe0f6de=null;}_0x53607d['cb'](null,{'code':_0x377c45,'result':_0x5c1361,'extra':_0xe0f6de});}});_0x12d046['on']('error',function(_0x4791dc){_0x317360[_0xf60f('0xb')]('error',new AGIError(_0xf60f('0x1b'),_0x4791dc[_0xf60f('0x1c')]));});_0x12d046['on']('close',function(){_0x317360[_0xf60f('0xb')]('close',new AGIError(_0xf60f('0x1d')));});_0x12d046['on'](_0xf60f('0x1e'),function(){_0x317360[_0xf60f('0xb')](_0xf60f('0x1e'),new AGIError(_0xf60f('0x1f')));_0x12d046[_0xf60f('0x20')]();});_0x12d046[_0xf60f('0x21')](_0x1b9ae4);this[_0xf60f('0x22')]=function(_0x4bc66f,_0x3ccf78){var _0x4bc66f=_0x4bc66f||'',_0x3ccf78=typeof _0x3ccf78==_0xf60f('0x13')?_0x3ccf78:new Function();_0x53607d={'tx':_0x4bc66f,'rx':'','cb':_0x3ccf78};_0x12d046[_0xf60f('0x23')](_0x4bc66f+'\x0a');},this[_0xf60f('0x24')]=function(){_0x12d046['destroy']();};}util[_0xf60f('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xf60f('0x26')][_0xf60f('0x27')]=function(_0x404859){return this[_0xf60f('0x22')][_0xf60f('0x28')](this,_0x404859);};AGIChannel[_0xf60f('0x26')][_0xf60f('0x29')]=function(){return this[_0xf60f('0x27')](_0xf60f('0x2a'));};AGIChannel[_0xf60f('0x26')]['getData']=function(_0x26cfba,_0x20be13,_0x5878c5){_0x26cfba=_0x26cfba===undefined?_0xf60f('0x2b'):_0x26cfba;_0x20be13=_0x20be13===undefined?'5':_0x20be13;_0x5878c5=_0x5878c5===undefined?'1':_0x5878c5;return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x2d'),_0x26cfba,_0x20be13*0x3e8,_0x5878c5));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x2e')]=function(_0x587e54){_0x587e54=_0x587e54||_0xf60f('0x2f');return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x30'),_0x587e54));};AGIChannel['prototype']['exec']=function(_0x4e6557,_0x3f7ad9){if(_[_0xf60f('0x31')](_0x3f7ad9)){return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x32'),_0x4e6557,_0x3f7ad9['join'](',')));}return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x32'),_0x4e6557,_0x3f7ad9));};AGIChannel[_0xf60f('0x26')]['setContext']=function(_0x201ead){return this[_0xf60f('0x27')](util[_0xf60f('0x2c')]('SET\x20CONTEXT\x20%s',_0x201ead));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x33')]=function(_0x48d362){return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x34'),_0x48d362));};AGIChannel['prototype'][_0xf60f('0x35')]=function(_0x2d32dd){return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x36'),_0x2d32dd));};AGIChannel['prototype'][_0xf60f('0xf')]=function(){return this[_0xf60f('0x27')](_0xf60f('0x37'));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x38')]=function(_0x31b4f1,_0x49bb7e){var _0x493a3e=_[_0xf60f('0x39')](_0x49bb7e)||_[_0xf60f('0x3a')](_0x49bb7e)?_0x49bb7e[_0xf60f('0x3b')]():_0x49bb7e;return this['sendRequest'](util[_0xf60f('0x2c')](_0xf60f('0x3c'),_0x31b4f1,_0x493a3e?_0x493a3e[_0xf60f('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x3d')]=function(_0x536f9f,_0x17922a){return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x3e'),_0x536f9f,_0x17922a));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x3f')]=function(_0xb4b221,_0x20b24b){return this['sendRequest'](util['format'](_0xf60f('0x40'),_0xb4b221,_0x20b24b));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x41')]=function(_0x50e818,_0x35780e){return this[_0xf60f('0x27')](util[_0xf60f('0x2c')](_0xf60f('0x42'),_0x50e818,_0x35780e));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x43')]=function(_0x3e5dd5,_0x15c65f,_0x2fa70e){_0x15c65f=_0x15c65f||this['extension'];_0x2fa70e=_0x2fa70e||0x1;this[_0xf60f('0x44')](_0x3e5dd5);this[_0xf60f('0x33')](_0x15c65f);this[_0xf60f('0x35')](_0x2fa70e);return this[_0xf60f('0x2e')](util[_0xf60f('0x2c')](_0xf60f('0x45'),_0x3e5dd5,_0x15c65f,_0x2fa70e));};AGIChannel[_0xf60f('0x26')]['getVariable']=function(_0x35ec5b){return this[_0xf60f('0x27')](util['format'](_0xf60f('0x46'),_0x35ec5b));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x47')]=function(_0x1b5361,_0x419e2d,_0x570354,_0x40709d,_0x5af29f,_0x5aa8e2){_0x419e2d=_0x419e2d||_0xf60f('0x48');_0x570354=_0x570354||'';_0x40709d=_0x40709d===undefined?-0x1:_0x40709d==='-1'?-0x1:_0x40709d*0x3e8;_0x5af29f=_0x5af29f===undefined?'':'s='+_0x5af29f;_0x5aa8e2=_0x5aa8e2?_0xf60f('0x49'):'';return this['sendRequest'](util[_0xf60f('0x2c')](_0xf60f('0x4a'),_0x1b5361,_0x419e2d,_0x570354,_0x40709d,_0x5aa8e2,_0x5af29f));};AGIChannel[_0xf60f('0x26')]['streamFile']=function(_0x551888,_0x5baf0a){_0x5baf0a=_0x5baf0a||'';return this[_0xf60f('0x27')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x551888,_0x5baf0a));};AGIChannel[_0xf60f('0x26')][_0xf60f('0x4b')]=function(_0x3f753c){return this['exec'](_0xf60f('0x4c'),_0x3f753c);};AGIChannel[_0xf60f('0x26')][_0xf60f('0x4d')]=function(_0x28417f){return this[_0xf60f('0x4e')](_0xf60f('0x4f'),_0x28417f);};AGIChannel[_0xf60f('0x26')][_0xf60f('0x50')]=function(_0x2d455e,_0x5d729f){this[_0xf60f('0x2e')](util['format'](_0xf60f('0x51'),_0x2d455e['id'],_0x2d455e[_0xf60f('0x52')],_0x5d729f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xf60f('0x53')]=AGIChannel; \ No newline at end of file +var _0x1a0e=['length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split'];(function(_0x125843,_0x4551be){var _0x92d9ed=function(_0x223c66){while(--_0x223c66){_0x125843['push'](_0x125843['shift']());}};_0x92d9ed(++_0x4551be);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0x1a0e[_0x5ec09b];return _0x5a8482;};'use strict';var util=require(_0xe1a0('0x0'));var _=require(_0xe1a0('0x1'));var EventEmitter=require(_0xe1a0('0x2'))[_0xe1a0('0x3')];var AGIReply=require(_0xe1a0('0x4'));var AGIError=require(_0xe1a0('0x5'));function AGIChannel(_0x3c3334){var _0x484ced=this,_0x42f060=new AGIReply(),_0x5602cf=![],_0x47c1bc={};EventEmitter['call'](_0x484ced);_0x3c3334[_0xe1a0('0x6')](_0xe1a0('0x7'));_0x3c3334[_0xe1a0('0x8')](0x8*0x3c*0x3c*0x3e8);_0x42f060[_0xe1a0('0x6')](_0xe1a0('0x7'));_0x42f060['on'](_0xe1a0('0x9'),function(_0x217653){for(var _0x10d66a in _0x217653){_0x484ced[_0x10d66a]=_0x217653[_0x10d66a];}_0x484ced[_0xe1a0('0xa')](_0xe1a0('0xb'));});_0x42f060['on'](_0xe1a0('0xc'),function(_0x3728d9){if(_0x3728d9[_0xe1a0('0xd')]()=='hangup'){_0x484ced[_0xe1a0('0xa')]('hangup');return;}if(_0x3728d9[_0xe1a0('0xe')](0x0,0xb)==_0xe1a0('0xf')){_0x5602cf=!![];}if(_0x5602cf){_0x47c1bc['rx']+=_0x3728d9+'\x0a';if(_0x3728d9[_0xe1a0('0x10')](_0xe1a0('0x11'))!=-0x1){_0x5602cf=![];}}else{_0x47c1bc['rx']=_0x3728d9;}if(_0x5602cf){return;}if(typeof _0x47c1bc['cb']==_0xe1a0('0x12')){var _0x3550bc=_0x47c1bc['rx']['substring'](0x0,0x3),_0x2ea844=null,_0x46c37d=null;_0x3550bc=parseInt(_0x3550bc);if(isNaN(_0x3550bc)){_0x47c1bc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe1a0('0x13')});return;}if(_0x3550bc!=0xc8){_0x47c1bc['cb'](null,{'code':_0x3550bc,'result':-0x1,'extra':'KO'});return;}_0x2ea844=_0x47c1bc['rx']['substring'](0x4)[_0xe1a0('0x14')](_0xe1a0('0x15'),'');if(_0x2ea844['indexOf']('\x20')!=-0x1){_0x2ea844=_0x2ea844[_0xe1a0('0x16')](0x0,_0x2ea844[_0xe1a0('0x17')]('\x20'));}if(_[_0xe1a0('0x18')](_0x2ea844,'-1')){_0x2ea844=parseInt(_0x2ea844);}_0x46c37d=_0x47c1bc['rx'][_0xe1a0('0x19')]('\x20');if(_0x46c37d[_0xe1a0('0x1a')]==0x3){_0x46c37d=_0x46c37d[0x2]['substring'](0x1,_0x46c37d[0x2][_0xe1a0('0x1a')]-0x1);}else if(_0x46c37d[_0xe1a0('0x1a')]>0x3){var _0x68e039=/\((.+)\)/;var _0x2866ae=_0x47c1bc['rx'][_0xe1a0('0x1b')](_0x68e039);if(_0x2866ae){_0x46c37d=_0x2866ae[0x1];}else{_0x46c37d=null;}}else{_0x46c37d=null;}_0x47c1bc['cb'](null,{'code':_0x3550bc,'result':_0x2ea844,'extra':_0x46c37d});}});_0x3c3334['on'](_0xe1a0('0x1c'),function(_0x40856a){_0x484ced[_0xe1a0('0xa')](_0xe1a0('0x1c'),new AGIError(_0xe1a0('0x1d'),_0x40856a[_0xe1a0('0x1e')]));});_0x3c3334['on'](_0xe1a0('0x1f'),function(){_0x484ced['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3c3334['on'](_0xe1a0('0x20'),function(){_0x484ced[_0xe1a0('0xa')](_0xe1a0('0x20'),new AGIError(_0xe1a0('0x21')));_0x3c3334['destroy']();});_0x3c3334[_0xe1a0('0x22')](_0x42f060);this[_0xe1a0('0x23')]=function(_0x54bfe1,_0x167244){var _0x54bfe1=_0x54bfe1||'',_0x167244=typeof _0x167244==_0xe1a0('0x12')?_0x167244:new Function();_0x47c1bc={'tx':_0x54bfe1,'rx':'','cb':_0x167244};_0x3c3334[_0xe1a0('0x24')](_0x54bfe1+'\x0a');},this[_0xe1a0('0x1f')]=function(){_0x3c3334[_0xe1a0('0x25')]();};}util[_0xe1a0('0x26')](AGIChannel,EventEmitter);AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x28')]=function(_0x28a29e){return this['command'][_0xe1a0('0x29')](this,_0x28a29e);};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x2a')]=function(){return this[_0xe1a0('0x28')](_0xe1a0('0x2b'));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x2c')]=function(_0x1351a4,_0x1a8b7f,_0x34adb4){_0x1351a4=_0x1351a4===undefined?_0xe1a0('0x2d'):_0x1351a4;_0x1a8b7f=_0x1a8b7f===undefined?'5':_0x1a8b7f;_0x34adb4=_0x34adb4===undefined?'1':_0x34adb4;return this[_0xe1a0('0x28')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x1351a4,_0x1a8b7f*0x3e8,_0x34adb4));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x2e')]=function(_0x47edf4){_0x47edf4=_0x47edf4||_0xe1a0('0x2f');return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')]('VERBOSE\x20\x22%s\x22',_0x47edf4));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x31')]=function(_0x9c87be,_0x312c96){if(_['isArray'](_0x312c96)){return this[_0xe1a0('0x28')](util['format'](_0xe1a0('0x32'),_0x9c87be,_0x312c96['join'](',')));}return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x32'),_0x9c87be,_0x312c96));};AGIChannel[_0xe1a0('0x27')]['setContext']=function(_0x47882a){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x33'),_0x47882a));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x34')]=function(_0x462b59){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')]('SET\x20EXTENSION\x20%s',_0x462b59));};AGIChannel['prototype'][_0xe1a0('0x35')]=function(_0x17d5bc){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x36'),_0x17d5bc));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x37')]=function(){return this[_0xe1a0('0x28')](_0xe1a0('0x38'));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x39')]=function(_0x184508,_0x480826){var _0x3ce6ec=_[_0xe1a0('0x3a')](_0x480826)||_[_0xe1a0('0x3b')](_0x480826)?_0x480826[_0xe1a0('0x3c')]():_0x480826;return this[_0xe1a0('0x28')](util['format'](_0xe1a0('0x3d'),_0x184508,_0x3ce6ec?_0x3ce6ec[_0xe1a0('0x3c')]()[_0xe1a0('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x3e')]=function(_0x9c0c95,_0x3430ec){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x3f'),_0x9c0c95,_0x3430ec));};AGIChannel['prototype'][_0xe1a0('0x40')]=function(_0x5769e9,_0x545d2a){return this[_0xe1a0('0x28')](util['format'](_0xe1a0('0x41'),_0x5769e9,_0x545d2a));};AGIChannel['prototype'][_0xe1a0('0x42')]=function(_0x591266,_0xf9260){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x43'),_0x591266,_0xf9260));};AGIChannel[_0xe1a0('0x27')]['continueAt']=function(_0x5147b5,_0x199a4b,_0x3150fd){_0x199a4b=_0x199a4b||this[_0xe1a0('0x44')];_0x3150fd=_0x3150fd||0x1;this[_0xe1a0('0x45')](_0x5147b5);this[_0xe1a0('0x34')](_0x199a4b);this[_0xe1a0('0x35')](_0x3150fd);return this[_0xe1a0('0x2e')](util[_0xe1a0('0x30')](_0xe1a0('0x46'),_0x5147b5,_0x199a4b,_0x3150fd));};AGIChannel['prototype']['getVariable']=function(_0x560dd0){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x47'),_0x560dd0));};AGIChannel[_0xe1a0('0x27')]['recordFile']=function(_0x3ba427,_0x3d67f3,_0x45c037,_0x5ce0ab,_0x3d9a93,_0x41b7a0){_0x3d67f3=_0x3d67f3||'wav';_0x45c037=_0x45c037||'';_0x5ce0ab=_0x5ce0ab===undefined?-0x1:_0x5ce0ab==='-1'?-0x1:_0x5ce0ab*0x3e8;_0x3d9a93=_0x3d9a93===undefined?'':'s='+_0x3d9a93;_0x41b7a0=_0x41b7a0?'BEEP':'';return this[_0xe1a0('0x28')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3ba427,_0x3d67f3,_0x45c037,_0x5ce0ab,_0x41b7a0,_0x3d9a93));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x48')]=function(_0x55c016,_0x340595){_0x340595=_0x340595||'';return this['sendRequest'](util['format'](_0xe1a0('0x49'),_0x55c016,_0x340595));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x4a')]=function(_0x2d4469){return this[_0xe1a0('0x31')](_0xe1a0('0x4b'),_0x2d4469);};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x4c')]=function(_0x41ea14){return this['exec'](_0xe1a0('0x4d'),_0x41ea14);};AGIChannel[_0xe1a0('0x27')]['error']=function(_0x1e559d,_0x14d46b){this['noop'](util['format'](_0xe1a0('0x4e'),_0x1e559d['id'],_0x1e559d[_0xe1a0('0x4f')],_0x14d46b));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 8293954..762d363 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 _0x28b8=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x28b8,0x98));var _0x828b=function(_0x47195e,_0x347734){_0x47195e=_0x47195e-0x0;var _0x571abb=_0x28b8[_0x47195e];return _0x571abb;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x828b('0x0'),'E_AGI_SERVER_ERROR':_0x828b('0x1'),'E_AGI_SERVER_CLOSE':_0x828b('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x828b('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x828b('0x4'),'E_AGI_SOCKET_ERROR':_0x828b('0x5'),'E_AGI_SOCKET_CLOSE':_0x828b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x828b('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x828b('0x8')};function AGIError(_0x21094a){var _0x21094a=_0x21094a||null,_0x337c88=_0x337c88||[],_0x44631b=0x1,_0x7ade8a='';if(!error[_0x21094a]){_0x21094a=_0x828b('0x9');}_0x337c88[_0x828b('0xa')](error[_0x21094a]);while(arguments[_0x44631b]){_0x337c88[_0x828b('0xa')](arguments[_0x44631b]);_0x44631b++;}_0x7ade8a=util[_0x828b('0xb')][_0x828b('0xc')](util,_0x337c88);this[_0x828b('0xd')]=_0x7ade8a;this[_0x828b('0xe')]=_0x21094a;}module[_0x828b('0xf')]=AGIError; \ No newline at end of file +var _0x52e7=['Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4e7331,_0x430d1f){var _0x1e85fd=function(_0x3fef32){while(--_0x3fef32){_0x4e7331['push'](_0x4e7331['shift']());}};_0x1e85fd(++_0x430d1f);}(_0x52e7,0xe4));var _0x752e=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0x52e7[_0x14cb58];return _0x5f097e;};'use strict';var util=require(_0x752e('0x0'));var error={'E_AGI_UNDEFINED':_0x752e('0x1'),'E_AGI_ARGUMENT_PORT':_0x752e('0x2'),'E_AGI_SERVER_ERROR':_0x752e('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x752e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x752e('0x5'),'E_AGI_SOCKET_ERROR':_0x752e('0x6'),'E_AGI_SOCKET_CLOSE':_0x752e('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x752e('0x8'),'E_AGI_COMMAND_EMPTY':_0x752e('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x752e('0xa')};function AGIError(_0x53f597){var _0x53f597=_0x53f597||null,_0x9e7304=_0x9e7304||[],_0x47fc92=0x1,_0xc3ad96='';if(!error[_0x53f597]){_0x53f597='E_AGI_UNDEFINED';}_0x9e7304[_0x752e('0xb')](error[_0x53f597]);while(arguments[_0x47fc92]){_0x9e7304[_0x752e('0xb')](arguments[_0x47fc92]);_0x47fc92++;}_0xc3ad96=util['format'][_0x752e('0xc')](util,_0x9e7304);this['message']=_0xc3ad96;this[_0x752e('0xd')]=_0x53f597;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c286af6..d759c65 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9f5=['localhost','subscribe','emit','error','message','agi','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','ioredis','./error','../../config/environment','defaults','redis'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xb9f5,0x1a1));var _0x5b9f=function(_0x12a5ac,_0x4cb0d2){_0x12a5ac=_0x12a5ac-0x0;var _0x282958=_0xb9f5[_0x12a5ac];return _0x282958;};'use strict';var _=require(_0x5b9f('0x0'));var EventEmitter=require(_0x5b9f('0x1'))[_0x5b9f('0x2')];var Redis=require(_0x5b9f('0x3'));var AGIError=require(_0x5b9f('0x4'));var config=require(_0x5b9f('0x5'));config['redis']=_[_0x5b9f('0x6')](config[_0x5b9f('0x7')],{'host':_0x5b9f('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5b9f('0x7')]);sub[_0x5b9f('0x9')]('agi',function(_0x51e47e){if(_0x51e47e)return eventEmitter[_0x5b9f('0xa')](_0x5b9f('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x51e47e));});sub['on'](_0x5b9f('0xc'),function(_0x4b728b,_0x1f8b9d){if(_0x4b728b!==_0x5b9f('0xd'))return;try{var _0x32bf09=JSON[_0x5b9f('0xe')](_0x1f8b9d);eventEmitter[_0x5b9f('0xa')](_0x5b9f('0xf'),_0x32bf09);}catch(_0x7eac09){eventEmitter[_0x5b9f('0xa')]('error',new AGIError(_0x5b9f('0x10'),_0x7eac09));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xe24a=['projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','subscribe','agi','emit','E_AGI_SERVER_ERROR','message'];(function(_0x3f44d7,_0x58eeb0){var _0x3939f0=function(_0x2c6efa){while(--_0x2c6efa){_0x3f44d7['push'](_0x3f44d7['shift']());}};_0x3939f0(++_0x58eeb0);}(_0xe24a,0xf3));var _0xae24=function(_0x345cec,_0x205601){_0x345cec=_0x345cec-0x0;var _0x501008=_0xe24a[_0x345cec];return _0x501008;};'use strict';var _=require(_0xae24('0x0'));var EventEmitter=require(_0xae24('0x1'))[_0xae24('0x2')];var Redis=require(_0xae24('0x3'));var AGIError=require(_0xae24('0x4'));var config=require(_0xae24('0x5'));config[_0xae24('0x6')]=_['defaults'](config[_0xae24('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xae24('0x7')](_0xae24('0x8'),function(_0x436d9d){if(_0x436d9d)return eventEmitter[_0xae24('0x9')]('error',new AGIError(_0xae24('0xa'),_0x436d9d));});sub['on'](_0xae24('0xb'),function(_0x5a47d6,_0x1acc05){if(_0x5a47d6!==_0xae24('0x8'))return;try{var _0x58cdba=JSON['parse'](_0x1acc05);eventEmitter[_0xae24('0x9')](_0xae24('0xc'),_0x58cdba);}catch(_0x22ca03){eventEmitter[_0xae24('0x9')](_0xae24('0xd'),new AGIError(_0xae24('0xa'),_0x22ca03));}});module[_0xae24('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 102d1c1..2fb288f 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 _0x3486=['length','no\x20edge/s\x20available','condition','vswitch','target','agicommand','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS','info'];(function(_0x3b970f,_0xa3d5dc){var _0x1eb3f2=function(_0x18eefc){while(--_0x18eefc){_0x3b970f['push'](_0x3b970f['shift']());}};_0x1eb3f2(++_0xa3d5dc);}(_0x3486,0x169));var _0x6348=function(_0x58f363,_0x135c64){_0x58f363=_0x58f363-0x0;var _0xcb2c83=_0x3486[_0x58f363];return _0xcb2c83;};'use strict';var _=require(_0x6348('0x0'));var logger=require(_0x6348('0x1'))(_0x6348('0x2'));var verticesWithRetry=[_0x6348('0x3'),_0x6348('0x4'),_0x6348('0x5')];var Graph=function(){this[_0x6348('0x6')]={};this[_0x6348('0x7')]={};this[_0x6348('0x8')]=0x0;};Graph[_0x6348('0x9')][_0x6348('0xa')]=function(_0x279e6e){this[_0x6348('0x6')][_0x279e6e['id']]=_0x279e6e;this[_0x6348('0x7')][_0x279e6e['id']]=[];};Graph[_0x6348('0x9')]['addEdge']=function(_0x1bd5da,_0x26624d,_0x3a7c61){this[_0x6348('0x7')][_0x1bd5da][_0x6348('0xb')]({'target':_0x26624d,'condition':_0x3a7c61});this[_0x6348('0x8')]+=0x1;};Graph[_0x6348('0x9')][_0x6348('0xc')]=function(){return _[_0x6348('0xc')](this[_0x6348('0x6')]);};Graph[_0x6348('0x9')][_0x6348('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x6348('0x9')][_0x6348('0xe')]=function(_0x206751){return this[_0x6348('0x6')][_0x206751];};Graph[_0x6348('0x9')][_0x6348('0xf')]=function(_0x1c0e2d,_0xe7839b){if(!this[_0x6348('0x6')][_0x1c0e2d]){return logger[_0x6348('0x10')]('no\x20vertex\x20found');}var _0x30a58a=_0xe7839b(this[_0x6348('0x6')][_0x1c0e2d]);if(!_0x30a58a){return logger[_0x6348('0x10')]('stop\x20traverse');}if(this[_0x6348('0x7')][_0x1c0e2d][_0x6348('0x11')]===0x0){return logger[_0x6348('0x10')](_0x6348('0x12'));}for(var _0x3f9703=0x0,_0x915bf1=[],_0x12b9c8=![];_0x3f9703\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x538a06,_0x4964cc){var _0x35c42e=function(_0x3d944c){while(--_0x3d944c){_0x538a06['push'](_0x538a06['shift']());}};_0x35c42e(++_0x4964cc);}(_0x48ce,0xef));var _0xe48c=function(_0x17ba32,_0x679276){_0x17ba32=_0x17ba32-0x0;var _0x5c9dc8=_0x48ce[_0x17ba32];return _0x5c9dc8;};'use strict';var _=require(_0xe48c('0x0'));var syncho=require('syncho');var util=require(_0xe48c('0x1'));var config=require('../../config/environment');var logger=require(_0xe48c('0x2'))(_0xe48c('0x3'));var utilLicense=require(_0xe48c('0x4'));var rpc=require(_0xe48c('0x5'));var Project=require('./project');var AGIEmitter=require(_0xe48c('0x6'))[_0xe48c('0x7')];var projects=[];config[_0xe48c('0x3')]=_[_0xe48c('0x8')](config[_0xe48c('0x3')],{'ip':_0xe48c('0x9'),'port':0x11dd});AGIEmitter['on'](_0xe48c('0xa'),projectUpdateHandler);function connectionHandler(_0x1137f5){process[_0xe48c('0xb')](function(){syncho(function(){try{setChannelVariables(_0x1137f5);agiHandler(_0x1137f5);}catch(_0x3a3de9){logger[_0xe48c('0xc')](_0x3a3de9['stack']);}});});}function projectUpdateHandler(_0x10f6e6){try{var _0x4392d8=_[_0xe48c('0xd')](projects,['id',_0x10f6e6['id']]);if(_0x4392d8>-0x1){if(_0x10f6e6['deleted']===!![]){projects[_0xe48c('0xe')](_0x4392d8,0x1);}else{projects[_0x4392d8]=_0x10f6e6;}}else{projects[_0xe48c('0xf')](_0x10f6e6);}}catch(_0xe2842e){logger[_0xe48c('0xc')](_0xe2842e['stack']);}}function listeningHandler(){console[_0xe48c('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xe48c('0x11')]);logger[_0xe48c('0x12')](util[_0xe48c('0x13')](_0xe48c('0x14'),config[_0xe48c('0x3')]['ip'],config[_0xe48c('0x3')][_0xe48c('0x11')]));}function errorHandler(_0x1bf323){if(_0x1bf323&&_0x1bf323['name']&&_0x1bf323[_0xe48c('0x15')]){logger[_0xe48c('0xc')](util[_0xe48c('0x13')]('[%s]\x20%s',_0x1bf323[_0xe48c('0x16')],_0x1bf323[_0xe48c('0x15')]));}else{logger[_0xe48c('0xc')](util[_0xe48c('0x13')](_0xe48c('0x17'),_0x1bf323[_0xe48c('0x18')]));}}function closeHandler(){logger[_0xe48c('0x12')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe48c('0x19')],this['calleridname'],this[_0xe48c('0x1a')],this[_0xe48c('0x1b')],this[_0xe48c('0x1c')]));try{createSquareReport(this);}catch(_0x4b3d14){logger[_0xe48c('0xc')](_0x4b3d14[_0xe48c('0x18')]);}}function timeoutHandler(){logger[_0xe48c('0x12')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe48c('0x19')],this[_0xe48c('0x1d')],this[_0xe48c('0x1a')],this[_0xe48c('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0xe48c('0x12')](util[_0xe48c('0x13')](_0xe48c('0x1e'),this[_0xe48c('0x19')],this[_0xe48c('0x1d')],this[_0xe48c('0x1a')],this[_0xe48c('0x1b')],this[_0xe48c('0x1c')]));this[_0xe48c('0x1f')]=!![];}function createSquareReport(_0x3a3e8b,_0x18f080){rpc['createSquareReport'](_0x3a3e8b)[_0xe48c('0x20')](function(_0x28b4dc){if(_0x18f080){_0x18f080(null,_0x28b4dc);}})[_0xe48c('0x21')](function(_0x7da4e0){if(_0x18f080){_0x18f080(null,_0x7da4e0);}});}function setChannelVariables(_0x22d808){for(var _0x28131c in _0x22d808){if(_0x22d808[_0xe48c('0x22')](_0x28131c)){if(_0x28131c[_0xe48c('0x23')]('agi_')===0x0){_0x22d808[_0x28131c[_0xe48c('0x24')](0x4)]=_0x22d808[_0x28131c];delete _0x22d808[_0x28131c];}}}}function agiHandler(_0x3cad2d){logger[_0xe48c('0x25')]('variables',JSON[_0xe48c('0x26')](_0x3cad2d,null,0x2));logger[_0xe48c('0x12')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3cad2d[_0xe48c('0x19')],_0x3cad2d[_0xe48c('0x1d')],_0x3cad2d[_0xe48c('0x1a')],_0x3cad2d[_0xe48c('0x1b')],_0x3cad2d[_0xe48c('0x1c')]));_0x3cad2d['on'](_0xe48c('0xc'),errorHandler);_0x3cad2d['on'](_0xe48c('0x27'),closeHandler);_0x3cad2d['on'](_0xe48c('0x28'),timeoutHandler);_0x3cad2d[_0xe48c('0x1f')]=![];_0x3cad2d['on'](_0xe48c('0x29'),hangupHandler);var _0x1c798c=_[_0xe48c('0x2a')](projects,[_0xe48c('0x16'),_0x3cad2d['arg_1']]);if(!_0x1c798c)return Project[_0xe48c('0x2b')](_0x3cad2d);if(!_0x1c798c['production'])return Project[_0xe48c('0x2c')](_0x3cad2d);return Project[_0xe48c('0x2d')](_0x1c798c,_0x3cad2d);}function main(){var _0x46657e;return utilLicense['getLicense']()[_0xe48c('0x20')](function(_0x44adf){if(!_0x44adf)return;if(_0x44adf[_0xe48c('0x2e')]){if(_0x44adf[_0xe48c('0x2f')]&&_0x44adf['callysquare']>0x0){logger[_0xe48c('0x12')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x44adf[_0xe48c('0x2f')]));_0x46657e=_0x44adf[_0xe48c('0x2f')];}else{logger[_0xe48c('0x12')](_0xe48c('0x30'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x46657e=-0x1;}})[_0xe48c('0x20')](function(){return Project[_0xe48c('0x31')]();})['then'](function(_0x39d657){projects=_0x39d657;return;})[_0xe48c('0x21')](function(_0x440ac6){logger[_0xe48c('0xc')](_0xe48c('0x32'),_0x440ac6[_0xe48c('0x18')]);})[_0xe48c('0x33')](function(){var _0x337647=require(_0xe48c('0x34'))(config[_0xe48c('0x3')]['port'],config[_0xe48c('0x3')]['ip'],_0x46657e);_0x337647['on']('error',errorHandler);_0x337647['on'](_0xe48c('0x35'),listeningHandler);_0x337647['on']('connection',connectionHandler);_0x337647['on'](_0xe48c('0x27'),closeHandler);});}main(); \ No newline at end of file +var _0xd76e=['nextTick','error','stack','findIndex','deleted','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','handleNotFound','production','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','projectUpdate'];(function(_0x1c232c,_0x504d75){var _0xf8153e=function(_0xf90932){while(--_0xf90932){_0x1c232c['push'](_0x1c232c['shift']());}};_0xf8153e(++_0x504d75);}(_0xd76e,0x15c));var _0xed76=function(_0x5a5883,_0x461400){_0x5a5883=_0x5a5883-0x0;var _0x66f060=_0xd76e[_0x5a5883];return _0x66f060;};'use strict';var _=require('lodash');var syncho=require(_0xed76('0x0'));var util=require('util');var config=require('../../config/environment');var logger=require(_0xed76('0x1'))(_0xed76('0x2'));var utilLicense=require(_0xed76('0x3'));var rpc=require(_0xed76('0x4'));var Project=require(_0xed76('0x5'));var AGIEmitter=require(_0xed76('0x6'))['EventEmitter'];var projects=[];config[_0xed76('0x2')]=_[_0xed76('0x7')](config[_0xed76('0x2')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xed76('0x8'),projectUpdateHandler);function connectionHandler(_0x25a368){process[_0xed76('0x9')](function(){syncho(function(){try{setChannelVariables(_0x25a368);agiHandler(_0x25a368);}catch(_0x18b597){logger[_0xed76('0xa')](_0x18b597[_0xed76('0xb')]);}});});}function projectUpdateHandler(_0x38972e){try{var _0x20c30a=_[_0xed76('0xc')](projects,['id',_0x38972e['id']]);if(_0x20c30a>-0x1){if(_0x38972e[_0xed76('0xd')]===!![]){projects[_0xed76('0xe')](_0x20c30a,0x1);}else{projects[_0x20c30a]=_0x38972e;}}else{projects[_0xed76('0xf')](_0x38972e);}}catch(_0x374b4c){logger[_0xed76('0xa')](_0x374b4c['stack']);}}function listeningHandler(){console['log'](_0xed76('0x10'),config['agi'][_0xed76('0x11')]);logger[_0xed76('0x12')](util[_0xed76('0x13')](_0xed76('0x14'),config[_0xed76('0x2')]['ip'],config[_0xed76('0x2')][_0xed76('0x11')]));}function errorHandler(_0xae9ce9){if(_0xae9ce9&&_0xae9ce9[_0xed76('0x15')]&&_0xae9ce9[_0xed76('0x16')]){logger['error'](util[_0xed76('0x13')]('[%s]\x20%s',_0xae9ce9[_0xed76('0x15')],_0xae9ce9[_0xed76('0x16')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0xae9ce9['stack']));}}function closeHandler(){logger[_0xed76('0x12')](util[_0xed76('0x13')](_0xed76('0x17'),this[_0xed76('0x18')],this[_0xed76('0x19')],this['callerid'],this['dnid'],this[_0xed76('0x1a')]));try{createSquareReport(this);}catch(_0x134d77){logger[_0xed76('0xa')](_0x134d77[_0xed76('0xb')]);}}function timeoutHandler(){logger[_0xed76('0x12')](util[_0xed76('0x13')](_0xed76('0x1b'),this['arg_1'],this['calleridname'],this[_0xed76('0x1c')],this[_0xed76('0x1d')],this[_0xed76('0x1a')]));}function hangupHandler(){logger['info'](util[_0xed76('0x13')](_0xed76('0x1e'),this['arg_1'],this['calleridname'],this[_0xed76('0x1c')],this[_0xed76('0x1d')],this['uniqueid']));this[_0xed76('0x1f')]=!![];}function createSquareReport(_0x1616a4,_0x306afe){rpc[_0xed76('0x20')](_0x1616a4)[_0xed76('0x21')](function(_0xf4b714){if(_0x306afe){_0x306afe(null,_0xf4b714);}})[_0xed76('0x22')](function(_0x2c4ee0){if(_0x306afe){_0x306afe(null,_0x2c4ee0);}});}function setChannelVariables(_0x3c13d5){for(var _0x4aeff8 in _0x3c13d5){if(_0x3c13d5[_0xed76('0x23')](_0x4aeff8)){if(_0x4aeff8['indexOf'](_0xed76('0x24'))===0x0){_0x3c13d5[_0x4aeff8[_0xed76('0x25')](0x4)]=_0x3c13d5[_0x4aeff8];delete _0x3c13d5[_0x4aeff8];}}}}function agiHandler(_0x57b9eb){logger[_0xed76('0x26')](_0xed76('0x27'),JSON['stringify'](_0x57b9eb,null,0x2));logger[_0xed76('0x12')](util['format'](_0xed76('0x28'),_0x57b9eb[_0xed76('0x18')],_0x57b9eb['calleridname'],_0x57b9eb[_0xed76('0x1c')],_0x57b9eb[_0xed76('0x1d')],_0x57b9eb[_0xed76('0x1a')]));_0x57b9eb['on'](_0xed76('0xa'),errorHandler);_0x57b9eb['on']('close',closeHandler);_0x57b9eb['on']('timeout',timeoutHandler);_0x57b9eb[_0xed76('0x1f')]=![];_0x57b9eb['on']('hangup',hangupHandler);var _0x96ee08=_['find'](projects,['name',_0x57b9eb['arg_1']]);if(!_0x96ee08)return Project[_0xed76('0x29')](_0x57b9eb);if(!_0x96ee08[_0xed76('0x2a')])return Project[_0xed76('0x2b')](_0x57b9eb);return Project['initialize'](_0x96ee08,_0x57b9eb);}function main(){var _0x1751f4;return utilLicense['getLicense']()['then'](function(_0x575fb5){if(!_0x575fb5)return;if(_0x575fb5['voice']){if(_0x575fb5[_0xed76('0x2c')]&&_0x575fb5[_0xed76('0x2c')]>0x0){logger[_0xed76('0x12')](util[_0xed76('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x575fb5[_0xed76('0x2c')]));_0x1751f4=_0x575fb5[_0xed76('0x2c')];}else{logger[_0xed76('0x12')](_0xed76('0x2d'));}}else{logger[_0xed76('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1751f4=-0x1;}})['then'](function(){return Project[_0xed76('0x2e')]();})[_0xed76('0x21')](function(_0x32a5b6){projects=_0x32a5b6;return;})[_0xed76('0x22')](function(_0x39148b){logger[_0xed76('0xa')](_0xed76('0x2f'),_0x39148b[_0xed76('0xb')]);})['finally'](function(){var _0x151dbf=require(_0xed76('0x30'))(config[_0xed76('0x2')][_0xed76('0x11')],config[_0xed76('0x2')]['ip'],_0x1751f4);_0x151dbf['on']('error',errorHandler);_0x151dbf['on'](_0xed76('0x31'),listeningHandler);_0x151dbf['on'](_0xed76('0x32'),connectionHandler);_0x151dbf['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 1d1d812..c34d2a4 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 _0x32df=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x118986,_0x2ea044){var _0x25c9e6=function(_0x13b4d4){while(--_0x13b4d4){_0x118986['push'](_0x118986['shift']());}};_0x25c9e6(++_0x2ea044);}(_0x32df,0xe9));var _0xf32d=function(_0x157cfd,_0x51744b){_0x157cfd=_0x157cfd-0x0;var _0x3a618d=_0x32df[_0x157cfd];return _0x3a618d;};'use strict';var BPromise=require(_0xf32d('0x0'));var jayson=require(_0xf32d('0x1'));var client=jayson[_0xf32d('0x2')][_0xf32d('0x3')]({'port':0x232b});function request(_0x35927f,_0x5d67c9){return new BPromise(function(_0xfaf3f4,_0x1e2ec0){return client[_0xf32d('0x4')](_0x35927f,_0x5d67c9)[_0xf32d('0x5')](function(_0x253fd7){if(_0x253fd7[_0xf32d('0x6')]){return _0x1e2ec0(_0x253fd7[_0xf32d('0x6')][_0xf32d('0x7')]);}else{return _0xfaf3f4(_0x253fd7[_0xf32d('0x8')]);}})[_0xf32d('0x9')](function(_0x229cef){return _0x1e2ec0(_0x229cef);});});}exports[_0xf32d('0xa')]=function(_0x59af1e,_0x368b71){return request(_0xf32d('0xb'),{'account':_0x59af1e,'message':_0x368b71});}; \ No newline at end of file +var _0x024d=['client','http','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise'];(function(_0x4d1055,_0x3be1fd){var _0x56a5bd=function(_0x2068e2){while(--_0x2068e2){_0x4d1055['push'](_0x4d1055['shift']());}};_0x56a5bd(++_0x3be1fd);}(_0x024d,0x12b));var _0xd024=function(_0x4746ef,_0x1ec452){_0x4746ef=_0x4746ef-0x0;var _0x4866b2=_0x024d[_0x4746ef];return _0x4866b2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd024('0x0'));var client=jayson[_0xd024('0x1')][_0xd024('0x2')]({'port':0x232b});function request(_0x5b327f,_0x1485dc){return new BPromise(function(_0x3b5e3a,_0x16f990){return client['request'](_0x5b327f,_0x1485dc)[_0xd024('0x3')](function(_0x2c3b31){if(_0x2c3b31[_0xd024('0x4')]){return _0x16f990(_0x2c3b31[_0xd024('0x4')][_0xd024('0x5')]);}else{return _0x3b5e3a(_0x2c3b31[_0xd024('0x6')]);}})[_0xd024('0x7')](function(_0x5660a6){return _0x16f990(_0x5660a6);});});}exports[_0xd024('0x8')]=function(_0x348631,_0x1ecb21){return request(_0xd024('0x9'),{'account':_0x348631,'message':_0x1ecb21});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index abb5a0f..f39d34b 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6183=['moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','maxRetry','addVertex','omit','isArray','length','target','addEdge','source','value','toJson','root','inspect','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','traverseBFS','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','clear','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','exports','lodash'];(function(_0x4b9b9b,_0x310170){var _0x46a90a=function(_0x2dd6cb){while(--_0x2dd6cb){_0x4b9b9b['push'](_0x4b9b9b['shift']());}};_0x46a90a(++_0x310170);}(_0x6183,0x7b));var _0x3618=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6183[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3618('0x0'));var moment=require(_0x3618('0x1'));var parser=require(_0x3618('0x2'));var util=require(_0x3618('0x3'));var logger=require(_0x3618('0x4'))('agi');var rpc=require(_0x3618('0x5'));var mailRpc=require(_0x3618('0x6'));var Graph=require('./graph');var Vertices=require(_0x3618('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3618('0x8')]()[_0x3618('0x9')](function(_0x3ec56d){logger['error'](_0x3618('0xa'),_0x3ec56d[_0x3618('0xb')]);return[];});}function addVertex(_0x38f3ce,_0x475a22,_0x278242){_0x475a22[_0x3618('0xc')]=_0x278242;if(_0x475a22['hasOwnProperty']('retry')){_0x475a22[_0x3618('0xd')]=parseInt(_0x475a22['retry'],0xa);}_0x38f3ce[_0x3618('0xe')](_[_0x3618('0xf')](_0x475a22,'mxCell'));}function initGraph(_0x4979f2,_0x5ecc5f){var _0x465ba0=new Graph();for(var _0x3ded8d in _0x4979f2){if(_0x4979f2['hasOwnProperty'](_0x3ded8d)){if(_[_0x3618('0x10')](_0x4979f2[_0x3ded8d])){for(var _0x15995f=0x0;_0x15995f<_0x4979f2[_0x3ded8d][_0x3618('0x11')];_0x15995f+=0x1){addVertex(_0x465ba0,_0x4979f2[_0x3ded8d][_0x15995f],_0x3ded8d);}}else{addVertex(_0x465ba0,_0x4979f2[_0x3ded8d],_0x3ded8d);}}}for(var _0x845838=0x0;_0x845838<_0x5ecc5f[_0x3618('0x11')];_0x845838+=0x1){if(_0x5ecc5f[_0x845838]['source']&&_0x5ecc5f[_0x845838][_0x3618('0x12')]){_0x465ba0[_0x3618('0x13')](_0x5ecc5f[_0x845838][_0x3618('0x14')],_0x5ecc5f[_0x845838][_0x3618('0x12')],_0x5ecc5f[_0x845838][_0x3618('0x15')]);}}return _0x465ba0;}function getRoot(_0x5bd81b){return parser[_0x3618('0x16')](_0x5bd81b,{'object':!![]})['mxGraphModel'][_0x3618('0x17')];}function inspect(_0x54ba65){return util[_0x3618('0x18')](_0x54ba65,{'showHidden':![],'depth':null});}function initialize(_0x5a58a8,_0x46bb3b){var _0x3f4f74=getRoot(_0x5a58a8[_0x3618('0x19')]);if(!_0x3f4f74||!_0x3f4f74[_0x3618('0x1a')])return;var _0x321c04,_0x2c195c,_0x5d8c13;logger[_0x3618('0x1b')](_0x3618('0x17'),JSON[_0x3618('0x1c')](_0x3f4f74,null,0x2));_0x46bb3b['joinAt']=moment()[_0x3618('0x1d')](_0x3618('0x1e'));_0x321c04=initGraph(_['omit'](_0x3f4f74,_0x3618('0x1f')),_0x3f4f74[_0x3618('0x1f')]);_0x2c195c=new Vertices(_0x46bb3b,rpc,mailRpc);logger['info'](util[_0x3618('0x1d')](_0x3618('0x20'),_0x46bb3b['arg_1'],_0x46bb3b[_0x3618('0x21')],_0x46bb3b['callerid'],_0x46bb3b[_0x3618('0x22')],_0x46bb3b[_0x3618('0x23')]));_0x321c04[_0x3618('0x24')](_0x3f4f74['start']['id'],function(_0x30af7e){try{_0x30af7e=_0x2c195c['clear'](_0x30af7e);logger[_0x3618('0x1b')](_0x3618('0x25'),JSON[_0x3618('0x1c')](_0x30af7e,null,0x2));if(_0x30af7e[_0x3618('0xc')]===_0x3618('0x26')){logger[_0x3618('0x27')](_0x3618('0x28'));_0x46bb3b['context']=_0x30af7e[_0x3618('0x29')]||_0x46bb3b[_0x3618('0x29')];_0x46bb3b[_0x3618('0x2a')]=_0x30af7e[_0x3618('0x2a')];_0x46bb3b[_0x3618('0x2b')]=_0x30af7e['priority']?_0x30af7e[_0x3618('0x2b')]-0x1:0x1;return null;}else if(_0x30af7e&&_0x2c195c[_0x30af7e[_0x3618('0xc')]]){_0x5d8c13=_0x2c195c[_0x30af7e[_0x3618('0xc')]](_0x30af7e);logger['info'](_0x3618('0x2c'),JSON['stringify'](_0x5d8c13,null,0x2));if(_0x5d8c13&&_0x5d8c13[_0x3618('0x2d')]===AGI_CODE_SUCCESS&&_0x5d8c13[_0x3618('0x2e')]!==AGI_RESULT_ERROR&&!_0x46bb3b['evtHangup']){logger[_0x3618('0x1b')](_0x3618('0x2c'),inspect(_0x5d8c13));return _[_0x3618('0x2f')](_0x5d8c13[_0x3618('0x2e')])?null:_0x5d8c13[_0x3618('0x2e')]['toString']();}else{logger[_0x3618('0x30')](_0x3618('0x2c'),inspect(_0x5d8c13));return null;}}else{logger[_0x3618('0x30')](_0x3618('0x31'));return null;}}catch(_0x529368){logger['error'](_0x529368[_0x3618('0xb')]);return null;}});if(_0x3f4f74[_0x3618('0x32')]){logger[_0x3618('0x27')](util['format'](_0x3618('0x33'),_0x46bb3b[_0x3618('0x34')],_0x46bb3b['calleridname'],_0x46bb3b['callerid'],_0x46bb3b[_0x3618('0x22')],_0x46bb3b[_0x3618('0x23')]));_0x321c04[_0x3618('0x24')](_0x3f4f74[_0x3618('0x32')]['id'],function(_0xbb6182){try{_0xbb6182=_0x2c195c[_0x3618('0x35')](_0xbb6182);logger['debug'](_0x3618('0x25'),JSON[_0x3618('0x1c')](_0xbb6182,null,0x2));if(_0xbb6182&&_0x2c195c[_0xbb6182['agicommand']]){_0x5d8c13=_0x2c195c[_0xbb6182['agicommand']](_0xbb6182);if(_0x5d8c13){logger[_0x3618('0x1b')](_0x3618('0x2c'),inspect(_0x5d8c13));return _[_0x3618('0x2f')](_0x5d8c13[_0x3618('0x2e')])?null:_0x5d8c13['result'][_0x3618('0x36')]();}else{logger[_0x3618('0x30')](_0x3618('0x2c'),inspect(_0x5d8c13));return null;}}else{logger[_0x3618('0x30')](_0x3618('0x31'));return null;}}catch(_0x4ded56){logger[_0x3618('0x30')](_0x4ded56[_0x3618('0xb')]);return null;}});}logger[_0x3618('0x27')](util[_0x3618('0x1d')](_0x3618('0x37'),_0x46bb3b['arg_1'],_0x46bb3b['calleridname'],_0x46bb3b[_0x3618('0x38')],_0x46bb3b[_0x3618('0x22')],_0x46bb3b[_0x3618('0x23')]));logger['info'](util[_0x3618('0x1d')](_0x3618('0x39'),_0x46bb3b[_0x3618('0x29')],_0x46bb3b[_0x3618('0x2a')],parseInt(_0x46bb3b[_0x3618('0x2b')],0xa)+0x1));_0x46bb3b[_0x3618('0x3a')](_0x46bb3b['context'],_0x46bb3b[_0x3618('0x2a')],parseInt(_0x46bb3b[_0x3618('0x2b')],0xa)+0x1);_0x46bb3b['close']();}function handleNotFound(_0x845460){logger['error'](util[_0x3618('0x1d')](_0x3618('0x3b'),_0x845460[_0x3618('0x34')]));_0x845460[_0x3618('0x3a')](_0x845460[_0x3618('0x29')],_0x845460[_0x3618('0x2a')],parseInt(_0x845460[_0x3618('0x2b')],0xa)+0x1);_0x845460[_0x3618('0x3c')]();}function handleUnpublished(_0x57a009){logger[_0x3618('0x30')](util[_0x3618('0x1d')]('Project\x20%s\x20not\x20published',_0x57a009[_0x3618('0x34')]));_0x57a009['continueAt'](_0x57a009['context'],_0x57a009[_0x3618('0x2a')],parseInt(_0x57a009[_0x3618('0x2b')],0xa)+0x1);_0x57a009[_0x3618('0x3c')]();}module[_0x3618('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa3e2=['response','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','stringify','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','start','clear','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','debug'];(function(_0x5ad587,_0x3768af){var _0x2490b2=function(_0x597ce2){while(--_0x597ce2){_0x5ad587['push'](_0x5ad587['shift']());}};_0x2490b2(++_0x3768af);}(_0xa3e2,0xc4));var _0x2a3e=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xa3e2[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0x2a3e('0x0'));var moment=require('moment');var parser=require(_0x2a3e('0x1'));var util=require(_0x2a3e('0x2'));var logger=require(_0x2a3e('0x3'))(_0x2a3e('0x4'));var rpc=require(_0x2a3e('0x5'));var mailRpc=require(_0x2a3e('0x6'));var Graph=require('./graph');var Vertices=require(_0x2a3e('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2a3e('0x8')]()[_0x2a3e('0x9')](function(_0x5a4308){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5a4308[_0x2a3e('0xa')]);return[];});}function addVertex(_0x70c5bb,_0x502221,_0x396c71){_0x502221['agicommand']=_0x396c71;if(_0x502221[_0x2a3e('0xb')](_0x2a3e('0xc'))){_0x502221[_0x2a3e('0xd')]=parseInt(_0x502221[_0x2a3e('0xc')],0xa);}_0x70c5bb[_0x2a3e('0xe')](_[_0x2a3e('0xf')](_0x502221,_0x2a3e('0x10')));}function initGraph(_0x5a08df,_0x45e80c){var _0x496c28=new Graph();for(var _0x105f59 in _0x5a08df){if(_0x5a08df[_0x2a3e('0xb')](_0x105f59)){if(_['isArray'](_0x5a08df[_0x105f59])){for(var _0x37f1a4=0x0;_0x37f1a4<_0x5a08df[_0x105f59][_0x2a3e('0x11')];_0x37f1a4+=0x1){addVertex(_0x496c28,_0x5a08df[_0x105f59][_0x37f1a4],_0x105f59);}}else{addVertex(_0x496c28,_0x5a08df[_0x105f59],_0x105f59);}}}for(var _0x5a166e=0x0;_0x5a166e<_0x45e80c[_0x2a3e('0x11')];_0x5a166e+=0x1){if(_0x45e80c[_0x5a166e][_0x2a3e('0x12')]&&_0x45e80c[_0x5a166e][_0x2a3e('0x13')]){_0x496c28['addEdge'](_0x45e80c[_0x5a166e][_0x2a3e('0x12')],_0x45e80c[_0x5a166e][_0x2a3e('0x13')],_0x45e80c[_0x5a166e][_0x2a3e('0x14')]);}}return _0x496c28;}function getRoot(_0x523a03){return parser[_0x2a3e('0x15')](_0x523a03,{'object':!![]})[_0x2a3e('0x16')][_0x2a3e('0x17')];}function inspect(_0x2635ac){return util[_0x2a3e('0x18')](_0x2635ac,{'showHidden':![],'depth':null});}function initialize(_0x385d26,_0x470ff8){var _0x352a7b=getRoot(_0x385d26[_0x2a3e('0x19')]);if(!_0x352a7b||!_0x352a7b['start'])return;var _0x5e9100,_0x5917a9,_0x2c0375;logger['debug'](_0x2a3e('0x17'),JSON[_0x2a3e('0x1a')](_0x352a7b,null,0x2));_0x470ff8['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5e9100=initGraph(_['omit'](_0x352a7b,_0x2a3e('0x10')),_0x352a7b[_0x2a3e('0x10')]);_0x5917a9=new Vertices(_0x470ff8,rpc,mailRpc);logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x1d'),_0x470ff8[_0x2a3e('0x1e')],_0x470ff8['calleridname'],_0x470ff8[_0x2a3e('0x1f')],_0x470ff8['dnid'],_0x470ff8['uniqueid']));_0x5e9100['traverseBFS'](_0x352a7b[_0x2a3e('0x20')]['id'],function(_0xf50918){try{_0xf50918=_0x5917a9[_0x2a3e('0x21')](_0xf50918);logger['debug']('vertex',JSON[_0x2a3e('0x1a')](_0xf50918,null,0x2));if(_0xf50918[_0x2a3e('0x22')]===_0x2a3e('0x23')){logger[_0x2a3e('0x1b')](_0x2a3e('0x24'));_0x470ff8[_0x2a3e('0x25')]=_0xf50918[_0x2a3e('0x25')]||_0x470ff8[_0x2a3e('0x25')];_0x470ff8[_0x2a3e('0x26')]=_0xf50918[_0x2a3e('0x26')];_0x470ff8[_0x2a3e('0x27')]=_0xf50918[_0x2a3e('0x27')]?_0xf50918[_0x2a3e('0x27')]-0x1:0x1;return null;}else if(_0xf50918&&_0x5917a9[_0xf50918['agicommand']]){_0x2c0375=_0x5917a9[_0xf50918[_0x2a3e('0x22')]](_0xf50918);logger[_0x2a3e('0x1b')]('response',JSON[_0x2a3e('0x1a')](_0x2c0375,null,0x2));if(_0x2c0375&&_0x2c0375[_0x2a3e('0x28')]===AGI_CODE_SUCCESS&&_0x2c0375[_0x2a3e('0x29')]!==AGI_RESULT_ERROR&&!_0x470ff8[_0x2a3e('0x2a')]){logger[_0x2a3e('0x2b')](_0x2a3e('0x2c'),inspect(_0x2c0375));return _[_0x2a3e('0x2d')](_0x2c0375[_0x2a3e('0x29')])?null:_0x2c0375[_0x2a3e('0x29')][_0x2a3e('0x2e')]();}else{logger[_0x2a3e('0x2f')](_0x2a3e('0x2c'),inspect(_0x2c0375));return null;}}else{logger['error'](_0x2a3e('0x30'));return null;}}catch(_0x9a483c){logger[_0x2a3e('0x2f')](_0x9a483c[_0x2a3e('0xa')]);return null;}});if(_0x352a7b[_0x2a3e('0x31')]){logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x32'),_0x470ff8[_0x2a3e('0x1e')],_0x470ff8[_0x2a3e('0x33')],_0x470ff8['callerid'],_0x470ff8['dnid'],_0x470ff8[_0x2a3e('0x34')]));_0x5e9100['traverseBFS'](_0x352a7b[_0x2a3e('0x31')]['id'],function(_0x3255b3){try{_0x3255b3=_0x5917a9[_0x2a3e('0x21')](_0x3255b3);logger[_0x2a3e('0x2b')](_0x2a3e('0x35'),JSON[_0x2a3e('0x1a')](_0x3255b3,null,0x2));if(_0x3255b3&&_0x5917a9[_0x3255b3[_0x2a3e('0x22')]]){_0x2c0375=_0x5917a9[_0x3255b3['agicommand']](_0x3255b3);if(_0x2c0375){logger['debug'](_0x2a3e('0x2c'),inspect(_0x2c0375));return _[_0x2a3e('0x2d')](_0x2c0375[_0x2a3e('0x29')])?null:_0x2c0375['result']['toString']();}else{logger['error'](_0x2a3e('0x2c'),inspect(_0x2c0375));return null;}}else{logger[_0x2a3e('0x2f')](_0x2a3e('0x30'));return null;}}catch(_0x5da5ca){logger['error'](_0x5da5ca[_0x2a3e('0xa')]);return null;}});}logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x36'),_0x470ff8[_0x2a3e('0x1e')],_0x470ff8['calleridname'],_0x470ff8[_0x2a3e('0x1f')],_0x470ff8[_0x2a3e('0x37')],_0x470ff8[_0x2a3e('0x34')]));logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x38'),_0x470ff8[_0x2a3e('0x25')],_0x470ff8[_0x2a3e('0x26')],parseInt(_0x470ff8[_0x2a3e('0x27')],0xa)+0x1));_0x470ff8['continueAt'](_0x470ff8[_0x2a3e('0x25')],_0x470ff8[_0x2a3e('0x26')],parseInt(_0x470ff8[_0x2a3e('0x27')],0xa)+0x1);_0x470ff8['close']();}function handleNotFound(_0x28c1b8){logger['error'](util[_0x2a3e('0x1c')](_0x2a3e('0x39'),_0x28c1b8['arg_1']));_0x28c1b8['continueAt'](_0x28c1b8[_0x2a3e('0x25')],_0x28c1b8[_0x2a3e('0x26')],parseInt(_0x28c1b8[_0x2a3e('0x27')],0xa)+0x1);_0x28c1b8[_0x2a3e('0x3a')]();}function handleUnpublished(_0x5bcdd8){logger[_0x2a3e('0x2f')](util['format'](_0x2a3e('0x3b'),_0x5bcdd8[_0x2a3e('0x1e')]));_0x5bcdd8['continueAt'](_0x5bcdd8[_0x2a3e('0x25')],_0x5bcdd8['extension'],parseInt(_0x5bcdd8[_0x2a3e('0x27')],0xa)+0x1);_0x5bcdd8[_0x2a3e('0x3a')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2689112..74b0422 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 _0x4a96=['trim','emit','_inBody','line','exports','util','stream','call','inherits','_transform','_localBuffer','toString','substring','length','split','indexOf','slice'];(function(_0x153dc0,_0x2cb23f){var _0x250980=function(_0x468f2b){while(--_0x468f2b){_0x153dc0['push'](_0x153dc0['shift']());}};_0x250980(++_0x2cb23f);}(_0x4a96,0x19d));var _0x64a9=function(_0x4c5f2e,_0x1fb14d){_0x4c5f2e=_0x4c5f2e-0x0;var _0x2de143=_0x4a96[_0x4c5f2e];return _0x2de143;};'use strict';var util=require(_0x64a9('0x0'));var Transform=require(_0x64a9('0x1'))['Transform'];function AGIReply(_0x579804){Transform[_0x64a9('0x2')](this,_0x579804);this['_localBuffer']='';this['_inBody']=![];}util[_0x64a9('0x3')](AGIReply,Transform);AGIReply['prototype'][_0x64a9('0x4')]=function(_0x5690b8,_0x2bda92,_0x48f66e){var _0x3a05e3='\x0a',_0x700b39=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3b9a73=-0x1,_0x35f5f0=-0x1,_0x212e7b='',_0x25f0c1=0x0,_0x48320c='',_0x5673b7='';this[_0x64a9('0x5')]+=_0x5690b8[_0x64a9('0x6')]();_0x48320c=this['_localBuffer'];if(!this['_inBody']){_0x25f0c1=0x0;while(_0x700b39[_0x25f0c1]){while((_0x35f5f0=_0x48320c['indexOf'](_0x700b39[_0x25f0c1]))!=-0x1){_0x212e7b=_0x700b39[_0x25f0c1];_0x5673b7=_0x48320c[_0x64a9('0x7')](0x0,_0x35f5f0);_0x48320c=_0x48320c[_0x64a9('0x7')](_0x35f5f0+_0x212e7b[_0x64a9('0x8')]);var _0x1bcd41=_0x5673b7[_0x64a9('0x9')](_0x3a05e3),_0x177441=0x0,_0x6e3e6f={},_0xda0ea8='',_0x18eb93='',_0x4bb050=-0x1;while(_0x1bcd41[_0x177441]){_0x4bb050=_0x1bcd41[_0x177441][_0x64a9('0xa')](':');if(_0x4bb050!=-0x1){_0xda0ea8=_0x1bcd41[_0x177441][_0x64a9('0xb')](0x0,_0x4bb050)[_0x64a9('0xc')]();_0x18eb93=_0x1bcd41[_0x177441][_0x64a9('0xb')](_0x4bb050+0x1)[_0x64a9('0xc')]();if(_0xda0ea8[_0x64a9('0x8')]>0x0){_0x6e3e6f[_0xda0ea8]=_0x18eb93;}}else{}_0x177441++;}this[_0x64a9('0xd')]('headers',_0x6e3e6f);this[_0x64a9('0xe')]=!![];}_0x25f0c1++;}this[_0x64a9('0x5')]=_0x48320c;}else{while((_0x3b9a73=_0x48320c[_0x64a9('0xa')](_0x3a05e3))!=-0x1){_0x5673b7=_0x48320c[_0x64a9('0x7')](0x0,_0x3b9a73);this[_0x64a9('0xd')](_0x64a9('0xf'),_0x5673b7);_0x48320c=_0x48320c[_0x64a9('0x7')](_0x3b9a73+_0x3a05e3[_0x64a9('0x8')]);}this[_0x64a9('0x5')]=_0x48320c;}_0x48f66e();};module[_0x64a9('0x10')]=AGIReply; \ No newline at end of file +var _0x5376=['exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody','indexOf','substring','length','slice','trim','emit','headers'];(function(_0x276765,_0x184a2d){var _0x22a2bc=function(_0x35bcf7){while(--_0x35bcf7){_0x276765['push'](_0x276765['shift']());}};_0x22a2bc(++_0x184a2d);}(_0x5376,0x19f));var _0x6537=function(_0x3a924d,_0x1f0870){_0x3a924d=_0x3a924d-0x0;var _0x2f9f0b=_0x5376[_0x3a924d];return _0x2f9f0b;};'use strict';var util=require(_0x6537('0x0'));var Transform=require(_0x6537('0x1'))[_0x6537('0x2')];function AGIReply(_0x1bf1c3){Transform[_0x6537('0x3')](this,_0x1bf1c3);this[_0x6537('0x4')]='';this['_inBody']=![];}util[_0x6537('0x5')](AGIReply,Transform);AGIReply[_0x6537('0x6')][_0x6537('0x7')]=function(_0x3d3ba0,_0x43fed3,_0x5595ad){var _0x1984df='\x0a',_0x47244e=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x1ae5fe=-0x1,_0x5ceef6=-0x1,_0xc8bb30='',_0x21fb7f=0x0,_0x17f19d='',_0x1ff044='';this[_0x6537('0x4')]+=_0x3d3ba0[_0x6537('0x8')]();_0x17f19d=this[_0x6537('0x4')];if(!this[_0x6537('0x9')]){_0x21fb7f=0x0;while(_0x47244e[_0x21fb7f]){while((_0x5ceef6=_0x17f19d[_0x6537('0xa')](_0x47244e[_0x21fb7f]))!=-0x1){_0xc8bb30=_0x47244e[_0x21fb7f];_0x1ff044=_0x17f19d[_0x6537('0xb')](0x0,_0x5ceef6);_0x17f19d=_0x17f19d[_0x6537('0xb')](_0x5ceef6+_0xc8bb30[_0x6537('0xc')]);var _0x5bec4e=_0x1ff044['split'](_0x1984df),_0x1ced9b=0x0,_0x3304c1={},_0x4ae0a7='',_0x5e5388='',_0x176e78=-0x1;while(_0x5bec4e[_0x1ced9b]){_0x176e78=_0x5bec4e[_0x1ced9b][_0x6537('0xa')](':');if(_0x176e78!=-0x1){_0x4ae0a7=_0x5bec4e[_0x1ced9b][_0x6537('0xd')](0x0,_0x176e78)[_0x6537('0xe')]();_0x5e5388=_0x5bec4e[_0x1ced9b][_0x6537('0xd')](_0x176e78+0x1)['trim']();if(_0x4ae0a7['length']>0x0){_0x3304c1[_0x4ae0a7]=_0x5e5388;}}else{}_0x1ced9b++;}this[_0x6537('0xf')](_0x6537('0x10'),_0x3304c1);this[_0x6537('0x9')]=!![];}_0x21fb7f++;}this[_0x6537('0x4')]=_0x17f19d;}else{while((_0x1ae5fe=_0x17f19d[_0x6537('0xa')](_0x1984df))!=-0x1){_0x1ff044=_0x17f19d[_0x6537('0xb')](0x0,_0x1ae5fe);this[_0x6537('0xf')]('line',_0x1ff044);_0x17f19d=_0x17f19d[_0x6537('0xb')](_0x1ae5fe+_0x1984df['length']);}this['_localBuffer']=_0x17f19d;}_0x5595ad();};module[_0x6537('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 86b5d21..6b953af 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 _0x4350=['getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','lodash','moment','client','request','then','error','catch','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById'];(function(_0x3eb0e9,_0x378114){var _0x2eaaba=function(_0x114347){while(--_0x114347){_0x3eb0e9['push'](_0x3eb0e9['shift']());}};_0x2eaaba(++_0x378114);}(_0x4350,0x1d0));var _0x0435=function(_0x590a1f,_0x23c2fc){_0x590a1f=_0x590a1f-0x0;var _0x363299=_0x4350[_0x590a1f];return _0x363299;};'use strict';var _=require(_0x0435('0x0'));var moment=require(_0x0435('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x0435('0x2')]['http']({'port':0x2329});function request(_0x1527f9,_0xf5146){return new Promise(function(_0x517d8d,_0x247a54){return client[_0x0435('0x3')](_0x1527f9,_0xf5146)[_0x0435('0x4')](function(_0x242079){if(_0x242079['error']){return _0x247a54(_0x242079[_0x0435('0x5')]['message']);}else{return _0x517d8d(_0x242079['result']);}})[_0x0435('0x6')](function(_0x4cf30b){return _0x247a54(_0x4cf30b);});});}exports['getSquareProjects']=function(){return request(_0x0435('0x7'),{'options':{'raw':![],'attributes':['id','name',_0x0435('0x8')]}});};exports[_0x0435('0x9')]=function(_0x53f1d0){return request(_0x0435('0xa'),{'options':{'raw':![],'where':{'name':_0x53f1d0},'attributes':['production']}});};exports[_0x0435('0xb')]=function(_0x3ea40f){return request(_0x0435('0xc'),{'options':{'raw':![],'where':{'id':_0x3ea40f},'include':[{'model':_0x0435('0xd'),'as':_0x0435('0xe'),'include':[{'model':_0x0435('0xf'),'as':_0x0435('0xf')}]}],'attributes':['id',_0x0435('0x10'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x32696c){return request('ShowSquareProject',{'options':{'where':{'id':_0x32696c},'attributes':[_0x0435('0x10')]}});};exports['getVoiceQueueById']=function(_0x43b924){return request(_0x0435('0x11'),{'options':{'where':{'id':_0x43b924},'attributes':['name']}});};exports[_0x0435('0x12')]=function(_0x3ec691){return request('ShowVariable',{'options':{'where':{'id':_0x3ec691},'attributes':[_0x0435('0x10')]}});};exports['getSquareOdbcById']=function(_0x18a331){return request(_0x0435('0x13'),{'options':{'where':{'id':_0x18a331},'attributes':[_0x0435('0x14')]}});};exports[_0x0435('0x15')]=function(_0x18564a){return request('ShowUser',{'options':{'where':{'id':_0x18564a},'attributes':['name']}});};exports[_0x0435('0x16')]=function(_0xe78d11){return request(_0x0435('0x17'),{'options':{'where':{'phone':_0xe78d11[_0x0435('0x18')]},'attributes':['id']}});};exports[_0x0435('0x19')]=function(_0x3f5956){return request(_0x0435('0x1a'),{'options':{'where':{'id':_0x3f5956},'attributes':[_0x0435('0x10')]}});};exports[_0x0435('0x1b')]=function(_0x49b4e0){return request('ShowSound',{'options':{'where':{'id':_0x49b4e0},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x452c5f){return request(_0x0435('0x1c'),{'options':{'raw':![],'where':{'id':_0x452c5f},'include':[{'model':_0x0435('0x1d'),'as':_0x0435('0x1e')}]}});};exports[_0x0435('0x1f')]=function(_0x231e0a){return request(_0x0435('0x20'),{'options':{'where':{'id':_0x231e0a},'attributes':['id',_0x0435('0x10')]}});};exports[_0x0435('0x21')]=function(_0x3990e1){return request(_0x0435('0x22'),{'body':_0x3990e1});};exports[_0x0435('0x23')]=function(_0x44eecf){return request(_0x0435('0x24'),{'body':_0x44eecf});};exports[_0x0435('0x25')]=function(_0x2949af){return request(_0x0435('0x26'),{'body':_['merge'](_0x2949af,{'project_name':_0x2949af[_0x0435('0x27')],'prev_project_name':_0x2949af[_0x0435('0x28')]||'','is_subproject':_0x2949af[_0x0435('0x28')]?!![]:![],'leaveAt':moment()[_0x0435('0x29')](_0x0435('0x2a'))})});};exports[_0x0435('0x2b')]=function(_0x5a77fa){return request(_0x0435('0x2c'),{'body':_0x5a77fa});};exports['createSquareMessage']=function(_0x17035f){return request(_0x0435('0x2d'),{'body':_0x17035f});};exports[_0x0435('0x2e')]=function(_0x52b02e){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x52b02e[_0x0435('0x18')],'ListId':_0x52b02e[_0x0435('0x2f')]}}})[_0x0435('0x4')](function(_0x405fbb){if(_0x405fbb){return _0x405fbb;}return request(_0x0435('0x30'),{'body':_0x52b02e});});};exports[_0x0435('0x31')]=function(_0x3837a3){return request(_0x0435('0x32'),{'options':{'where':{'id':_0x3837a3},'attributes':[_0x0435('0x10')]}});};exports['agentLogin']=function(_0x513cfd,_0x4b9520){return request('LoginUser',{'body':{'interface':_0x4b9520},'options':{'where':_0x513cfd}});};exports[_0x0435('0x33')]=function(_0x404a4a,_0x365b8a,_0x1726af){return request(_0x0435('0x34'),{'body':{'type':_0x365b8a,'uniqueid':_0x1726af},'options':{'where':_0x404a4a}});};exports[_0x0435('0x35')]=function(_0x4abfe3){return request('UnpauseUser',{'body':{},'options':{'where':_0x4abfe3}});};exports['agentLogout']=function(_0x4f59da){return request('LogoutUser',{'body':{},'options':{'where':_0x4f59da}});}; \ No newline at end of file +var _0x8e63=['agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','http','request','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser'];(function(_0x3954bf,_0x3ada57){var _0x34ef7c=function(_0x478e63){while(--_0x478e63){_0x3954bf['push'](_0x3954bf['shift']());}};_0x34ef7c(++_0x3ada57);}(_0x8e63,0x7c));var _0x38e6=function(_0x1c4964,_0x40e63a){_0x1c4964=_0x1c4964-0x0;var _0x18fac2=_0x8e63[_0x1c4964];return _0x18fac2;};'use strict';var _=require('lodash');var moment=require(_0x38e6('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x38e6('0x1')]({'port':0x2329});function request(_0xb2c68b,_0x1c6de7){return new Promise(function(_0x5e5a71,_0x4c85e7){return client[_0x38e6('0x2')](_0xb2c68b,_0x1c6de7)[_0x38e6('0x3')](function(_0x344a0c){if(_0x344a0c['error']){return _0x4c85e7(_0x344a0c[_0x38e6('0x4')][_0x38e6('0x5')]);}else{return _0x5e5a71(_0x344a0c[_0x38e6('0x6')]);}})[_0x38e6('0x7')](function(_0x51b586){return _0x4c85e7(_0x51b586);});});}exports['getSquareProjects']=function(){return request(_0x38e6('0x8'),{'options':{'raw':![],'attributes':['id',_0x38e6('0x9'),_0x38e6('0xa')]}});};exports[_0x38e6('0xb')]=function(_0x438258){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x438258},'attributes':['production']}});};exports[_0x38e6('0xc')]=function(_0x4c5e34){return request(_0x38e6('0xd'),{'options':{'raw':![],'where':{'id':_0x4c5e34},'include':[{'model':'MailServerOut','as':_0x38e6('0xe'),'include':[{'model':_0x38e6('0xf'),'as':_0x38e6('0xf')}]}],'attributes':['id',_0x38e6('0x9'),_0x38e6('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2b4679){return request(_0x38e6('0x11'),{'options':{'where':{'id':_0x2b4679},'attributes':['name']}});};exports[_0x38e6('0x12')]=function(_0xfd7f2){return request(_0x38e6('0x13'),{'options':{'where':{'id':_0xfd7f2},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x14')]=function(_0x46b525){return request('ShowVariable',{'options':{'where':{'id':_0x46b525},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x15')]=function(_0x3299c9){return request(_0x38e6('0x16'),{'options':{'where':{'id':_0x3299c9},'attributes':[_0x38e6('0x17')]}});};exports['getUserById']=function(_0x91997a){return request('ShowUser',{'options':{'where':{'id':_0x91997a},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x18')]=function(_0x57ded4){return request(_0x38e6('0x19'),{'options':{'where':{'phone':_0x57ded4['phone']},'attributes':['id']}});};exports[_0x38e6('0x1a')]=function(_0x521453){return request(_0x38e6('0x1b'),{'options':{'where':{'id':_0x521453},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x1c')]=function(_0x137e09){return request(_0x38e6('0x1d'),{'options':{'where':{'id':_0x137e09},'attributes':[_0x38e6('0x1e')]}});};exports['getIntervalById']=function(_0x5f3f67){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5f3f67},'include':[{'model':_0x38e6('0x1f'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x2d995f){return request(_0x38e6('0x20'),{'options':{'where':{'id':_0x2d995f},'attributes':['id',_0x38e6('0x9')]}});};exports[_0x38e6('0x21')]=function(_0x5f5ab2){return request(_0x38e6('0x22'),{'body':_0x5f5ab2});};exports[_0x38e6('0x23')]=function(_0x185922){return request('CreateSquareDetailsReport',{'body':_0x185922});};exports[_0x38e6('0x24')]=function(_0x399b70){return request(_0x38e6('0x25'),{'body':_[_0x38e6('0x26')](_0x399b70,{'project_name':_0x399b70[_0x38e6('0x27')],'prev_project_name':_0x399b70[_0x38e6('0x28')]||'','is_subproject':_0x399b70[_0x38e6('0x28')]?!![]:![],'leaveAt':moment()[_0x38e6('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x38e6('0x2a')]=function(_0x491588){return request(_0x38e6('0x2b'),{'body':_0x491588});};exports[_0x38e6('0x2c')]=function(_0x446ed5){return request(_0x38e6('0x2d'),{'body':_0x446ed5});};exports[_0x38e6('0x2e')]=function(_0x1afc04){return request(_0x38e6('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1afc04['phone'],'ListId':_0x1afc04[_0x38e6('0x30')]}}})[_0x38e6('0x3')](function(_0x48f5a2){if(_0x48f5a2){return _0x48f5a2;}return request(_0x38e6('0x31'),{'body':_0x1afc04});});};exports[_0x38e6('0x32')]=function(_0x526569){return request(_0x38e6('0x33'),{'options':{'where':{'id':_0x526569},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x34')]=function(_0x3ce1c2,_0xe7489){return request(_0x38e6('0x35'),{'body':{'interface':_0xe7489},'options':{'where':_0x3ce1c2}});};exports[_0x38e6('0x36')]=function(_0x5a5979,_0x220c19,_0x3d231a){return request(_0x38e6('0x37'),{'body':{'type':_0x220c19,'uniqueid':_0x3d231a},'options':{'where':_0x5a5979}});};exports[_0x38e6('0x38')]=function(_0x15232f){return request(_0x38e6('0x39'),{'body':{},'options':{'where':_0x15232f}});};exports[_0x38e6('0x3a')]=function(_0x57d22c){return request(_0x38e6('0x3b'),{'body':{},'options':{'where':_0x57d22c}});}; \ 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 49f97ed..0a55679 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 _0x2070=['exports'];(function(_0x1ae0f5,_0x25d756){var _0xa96dc1=function(_0xe9a62){while(--_0xe9a62){_0x1ae0f5['push'](_0x1ae0f5['shift']());}};_0xa96dc1(++_0x25d756);}(_0x2070,0x1a2));var _0x0207=function(_0x1ecb9b,_0x13440e){_0x1ecb9b=_0x1ecb9b-0x0;var _0x447429=_0x2070[_0x1ecb9b];return _0x447429;};var polly=require('./polly');var lex=require('./lex');module[_0x0207('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb2ad=['./lex'];(function(_0xd3ea0d,_0x3b8cc1){var _0x4d3540=function(_0x4963b9){while(--_0x4963b9){_0xd3ea0d['push'](_0xd3ea0d['shift']());}};_0x4d3540(++_0x3b8cc1);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0xb2ad[_0x2ff1f6];return _0xbae96d;};var polly=require('./polly');var lex=require(_0xdb2a('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1273693..08acb24 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ No newline at end of file +var _0x878f=['exports'];(function(_0x16d180,_0x26025c){var _0x3ffea6=function(_0x27a713){while(--_0x27a713){_0x16d180['push'](_0x16d180['shift']());}};_0x3ffea6(++_0x26025c);}(_0x878f,0x173));var _0xf878=function(_0x31b2b0,_0x5421a2){_0x31b2b0=_0x31b2b0-0x0;var _0x21aaf4=_0x878f[_0x31b2b0];return _0x21aaf4;};'use strict';var lex=require('./lib/api');module[_0xf878('0x0')]=function(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783){return lex(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783);}; \ 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 d3a690b..5751b54 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(_0x2c4aea,_0x4d763a){var _0xee1353=function(_0x45969d){while(--_0x45969d){_0x2c4aea['push'](_0x2c4aea['shift']());}};_0xee1353(++_0x4d763a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0xaabd5f,_0x4ee6fb){var _0x2a2fcd=function(_0x19b877){while(--_0x19b877){_0xaabd5f['push'](_0xaabd5f['shift']());}};_0x2a2fcd(++_0x4ee6fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 7b07c61..e7b4ada 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 _0xd1da=['exports','./lib/api'];(function(_0x443ec0,_0x186140){var _0x227249=function(_0xf48696){while(--_0xf48696){_0x443ec0['push'](_0x443ec0['shift']());}};_0x227249(++_0x186140);}(_0xd1da,0x7b));var _0xad1d=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0xd1da[_0x1fa759];return _0x2da9f4;};'use strict';var polly=require(_0xad1d('0x0'));module[_0xad1d('0x1')]=function(_0x500f6f,_0x4685f3,_0x49d71a,_0x1f7e75,_0x40bc7e,_0x52512f,_0x4ec55d){return polly(_0x500f6f,_0x4685f3,_0x49d71a,_0x1f7e75,_0x40bc7e,_0x52512f,_0x4ec55d);}; \ No newline at end of file +var _0x2799=['exports','./lib/api'];(function(_0x3cf447,_0x4d057e){var _0x151135=function(_0x42c4d9){while(--_0x42c4d9){_0x3cf447['push'](_0x3cf447['shift']());}};_0x151135(++_0x4d057e);}(_0x2799,0x14b));var _0x9279=function(_0x284f56,_0x4016f4){_0x284f56=_0x284f56-0x0;var _0x4ad406=_0x2799[_0x284f56];return _0x4ad406;};'use strict';var polly=require(_0x9279('0x0'));module[_0x9279('0x1')]=function(_0x29d864,_0xbf22a7,_0x604b2b,_0x48349d,_0x32cf48,_0x67f59e,_0x3ac147){return polly(_0x29d864,_0xbf22a7,_0x604b2b,_0x48349d,_0x32cf48,_0x67f59e,_0x3ac147);}; \ 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 77ac809..92cbe20 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 _0x100f=['randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x100f,0x1b7));var _0xf100=function(_0x4ba8e8,_0x263f2c){_0x4ba8e8=_0x4ba8e8-0x0;var _0x3496a0=_0x100f[_0x4ba8e8];return _0x3496a0;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf100('0x0'));var rs=require(_0xf100('0x1'));var AWS=require(_0xf100('0x2'));function pollyResult(_0x4d6748,_0x19f364,_0x51a709){return new BPromise(function(_0x33025e,_0x5b376d){_0x4d6748[_0xf100('0x3')](_0x19f364,function(_0x524ee0,_0x589d3c){if(_0x524ee0){_0x5b376d(_0x524ee0);}else if(_0x589d3c){if(_0x589d3c['AudioStream']instanceof Buffer){fs[_0xf100('0x4')](_0x51a709,_0x589d3c[_0xf100('0x5')],function(_0x1a8793){if(_0x1a8793){_0x5b376d(_0x1a8793);}else{_0x33025e();}});}else{_0x5b376d(new Error(_0xf100('0x6')));}}else{_0x5b376d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xf100('0x7')]=function(_0x32290f,_0x390fa0,_0xc362,_0x1c7b53,_0x260ad7,_0x51ac78,_0x3b5cd5){var _0x1e5d8e=new AWS[(_0xf100('0x8'))]({'accessKeyId':_0x32290f,'secretAccessKey':_0x390fa0,'region':_0xc362});var _0x147770={'Text':_0x260ad7,'TextType':_0x51ac78||_0xf100('0x9'),'OutputFormat':_0xf100('0xa'),'VoiceId':_0x1c7b53};return pollyResult(_0x1e5d8e,_0x147770,_0x3b5cd5);}; \ No newline at end of file +var _0x1e16=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x1e16,0x1ed));var _0x61e1=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x1e16[_0x44fef1];return _0x3c3a04;};'use strict';var fs=require('fs');var path=require(_0x61e1('0x0'));var BPromise=require(_0x61e1('0x1'));var rs=require(_0x61e1('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x14a8ea,_0x5735c1,_0x11a75b){return new BPromise(function(_0xa1800f,_0x661cf0){_0x14a8ea[_0x61e1('0x3')](_0x5735c1,function(_0x4adac1,_0x11942b){if(_0x4adac1){_0x661cf0(_0x4adac1);}else if(_0x11942b){if(_0x11942b[_0x61e1('0x4')]instanceof Buffer){fs[_0x61e1('0x5')](_0x11a75b,_0x11942b['AudioStream'],function(_0x121697){if(_0x121697){_0x661cf0(_0x121697);}else{_0xa1800f();}});}else{_0x661cf0(new Error(_0x61e1('0x6')));}}else{_0x661cf0(new Error(_0x61e1('0x7')));}});});}module['exports']=function(_0x116e84,_0x5d26b1,_0x1234bf,_0x4d0c48,_0xb01220,_0x241062,_0x149685){var _0x410fb4=new AWS[(_0x61e1('0x8'))]({'accessKeyId':_0x116e84,'secretAccessKey':_0x5d26b1,'region':_0x1234bf});var _0x53e1e0={'Text':_0xb01220,'TextType':_0x241062||_0x61e1('0x9'),'OutputFormat':'mp3','VoiceId':_0x4d0c48};return pollyResult(_0x410fb4,_0x53e1e0,_0x149685);}; \ 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 4130682..f827388 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 _0x076b=['exports','./lib/api'];(function(_0x1435af,_0x246123){var _0x4867b9=function(_0x5e7de7){while(--_0x5e7de7){_0x1435af['push'](_0x1435af['shift']());}};_0x4867b9(++_0x246123);}(_0x076b,0x99));var _0xb076=function(_0x5dec00,_0x58147d){_0x5dec00=_0x5dec00-0x0;var _0x5a5555=_0x076b[_0x5dec00];return _0x5a5555;};'use strict';var asr=require(_0xb076('0x0'));module[_0xb076('0x1')]=function(_0x1b698c,_0x50a6ab,_0x51c661,_0x32d0bd){return asr(_0x1b698c,_0x50a6ab,_0x51c661);}; \ No newline at end of file +var _0xae9b=['./lib/api','exports'];(function(_0x28dda4,_0x10a80d){var _0x3f0b34=function(_0x4d6633){while(--_0x4d6633){_0x28dda4['push'](_0x28dda4['shift']());}};_0x3f0b34(++_0x10a80d);}(_0xae9b,0x13c));var _0xbae9=function(_0x2d2b8f,_0x45e019){_0x2d2b8f=_0x2d2b8f-0x0;var _0x5768fc=_0xae9b[_0x2d2b8f];return _0x5768fc;};'use strict';var asr=require(_0xbae9('0x0'));module[_0xbae9('0x1')]=function(_0x899cb0,_0x3f33c4,_0x46fac5,_0x41d08e){return asr(_0x899cb0,_0x3f33c4,_0x46fac5);}; \ 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 61a3d1b..650c228 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 _0x1d5b=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','filepath\x20should\x20be\x20a\x20string','string','length'];(function(_0x5694cd,_0x2fefe4){var _0x5235d6=function(_0x4cd263){while(--_0x4cd263){_0x5694cd['push'](_0x5694cd['shift']());}};_0x5235d6(++_0x2fefe4);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x5a6d69,_0x203f47){_0x5a6d69=_0x5a6d69-0x0;var _0xb2467e=_0x1d5b[_0x5a6d69];return _0xb2467e;};'use strict';var url=require(_0xb1d5('0x0'));var BPromise=require(_0xb1d5('0x1'));var fs=require('fs');var host=_0xb1d5('0x2');module['exports']=function(_0x2739cc,_0x594c25,_0x2f9c5a){return new BPromise(function(_0x1a673c,_0xa12a1e){var _0x3ee65c;if(typeof _0x2739cc!=='string'||_0x2739cc['length']===0x0){return _0xa12a1e(_0xb1d5('0x3'));}if(typeof _0x594c25!==_0xb1d5('0x4')||_0x594c25[_0xb1d5('0x5')]===0x0){return _0xa12a1e(_0xb1d5('0x6'));}if(typeof _0x2f9c5a!==_0xb1d5('0x7')&&(typeof _0x2f9c5a!==_0xb1d5('0x4')||_0x2f9c5a[_0xb1d5('0x5')]===0x0)){return _0xa12a1e(_0xb1d5('0x8'));}try{_0x3ee65c=fs['readFileSync'](_0x2739cc)[_0xb1d5('0x9')](_0xb1d5('0xa'));}catch(_0x56fc2d){return _0xa12a1e(_0x56fc2d);}return _0x1a673c({'method':'POST','uri':host+_0xb1d5('0xb')+_0x594c25,'body':{'config':{'encoding':_0xb1d5('0xc'),'sampleRateHertz':_0xb1d5('0xd'),'languageCode':_0x2f9c5a},'audio':{'content':_0x3ee65c}},'json':!![]});});}; \ No newline at end of file +var _0xda55=['filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','string'];(function(_0x4bcccf,_0x4eb4af){var _0x2298f4=function(_0x2daddf){while(--_0x2daddf){_0x4bcccf['push'](_0x4bcccf['shift']());}};_0x2298f4(++_0x4eb4af);}(_0xda55,0x6d));var _0x5da5=function(_0x37f79c,_0x38f023){_0x37f79c=_0x37f79c-0x0;var _0x3e8566=_0xda55[_0x37f79c];return _0x3e8566;};'use strict';var url=require(_0x5da5('0x0'));var BPromise=require(_0x5da5('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x13ecbc,_0x240a49,_0x26a443){return new BPromise(function(_0x50cf9f,_0x1c3afd){var _0x5da254;if(typeof _0x13ecbc!==_0x5da5('0x2')||_0x13ecbc['length']===0x0){return _0x1c3afd(_0x5da5('0x3'));}if(typeof _0x240a49!=='string'||_0x240a49[_0x5da5('0x4')]===0x0){return _0x1c3afd(_0x5da5('0x5'));}if(typeof _0x26a443!==_0x5da5('0x6')&&(typeof _0x26a443!==_0x5da5('0x2')||_0x26a443[_0x5da5('0x4')]===0x0)){return _0x1c3afd(_0x5da5('0x7'));}try{_0x5da254=fs[_0x5da5('0x8')](_0x13ecbc)[_0x5da5('0x9')]('base64');}catch(_0x3ed24c){return _0x1c3afd(_0x3ed24c);}return _0x50cf9f({'method':_0x5da5('0xa'),'uri':host+_0x5da5('0xb')+_0x240a49,'body':{'config':{'encoding':_0x5da5('0xc'),'sampleRateHertz':_0x5da5('0xd'),'languageCode':_0x26a443},'audio':{'content':_0x5da254}},'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 1ed0750..0fcb6b3 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 _0x590a=['./asr','exports'];(function(_0x3c68ac,_0x38b406){var _0x35d849=function(_0x1fb2e0){while(--_0x1fb2e0){_0x3c68ac['push'](_0x3c68ac['shift']());}};_0x35d849(++_0x38b406);}(_0x590a,0xae));var _0xa590=function(_0x27337b,_0x53357a){_0x27337b=_0x27337b-0x0;var _0x28ab72=_0x590a[_0x27337b];return _0x28ab72;};var asr=require(_0xa590('0x0'));module[_0xa590('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3706=['./asr','exports'];(function(_0x186e30,_0x4be1e4){var _0x4202cd=function(_0x37dd7e){while(--_0x37dd7e){_0x186e30['push'](_0x186e30['shift']());}};_0x4202cd(++_0x4be1e4);}(_0x3706,0x12e));var _0x6370=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x3706[_0x102e37];return _0x35a07c;};var asr=require(_0x6370('0x0'));module[_0x6370('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 942debf..7adb3ed 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 _0xf173=['%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','freeform=3','sestekNDA','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','https:','get','data','end','transcode','error\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','audioContent','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format'];(function(_0x2065ff,_0x336122){var _0x5f93b9=function(_0x1a42af){while(--_0x1a42af){_0x2065ff['push'](_0x2065ff['shift']());}};_0x5f93b9(++_0x336122);}(_0xf173,0x18e));var _0x3f17=function(_0x17a1ed,_0x580f5d){_0x17a1ed=_0x17a1ed-0x0;var _0x515687=_0xf173[_0x17a1ed];return _0x515687;};'use strict';var apiai=require(_0x3f17('0x0'));var BPromise=require(_0x3f17('0x1'));var dialogflow=require(_0x3f17('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x3f17('0x3'));var md5=require(_0x3f17('0x4'));var path=require(_0x3f17('0x5'));var querystring=require(_0x3f17('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0x3f17('0x7'));var urlParse=require(_0x3f17('0x8'))[_0x3f17('0x9')];var util=require(_0x3f17('0xa'));var aws=require(_0x3f17('0xb'));var google=require(_0x3f17('0xc'));var sestek=require(_0x3f17('0xd'));var tilde=require(_0x3f17('0xe'));var logger=require(_0x3f17('0xf'))(_0x3f17('0x10'));var ISPEECH_API=_0x3f17('0x11');function downloadFile(_0x380f11,_0x1e09db){return new BPromise(function(_0x48c6c2,_0x5b7fe9){var _0x12a1d1=urlParse(_0x380f11);var _0xf76ff3=_0x12a1d1[_0x3f17('0x12')]==='https:'?https:http;var _0x413a33={'host':_0x12a1d1[_0x3f17('0x13')],'path':_0x12a1d1[_0x3f17('0x5')],'headers':{'user-agent':_0x3f17('0x14')}};_0xf76ff3['get'](_0x413a33,function(_0x523b3e){if(_0x523b3e[_0x3f17('0x15')]!==0xc8){logger[_0x3f17('0x16')](_0x3f17('0x17')+_0x380f11+_0x3f17('0x18')+_0x523b3e['statusCode']+'\x20('+_0x523b3e[_0x3f17('0x19')]+')');_0x5b7fe9(new Error('request\x20to\x20'+_0x380f11+_0x3f17('0x18')+_0x523b3e[_0x3f17('0x15')]+'\x20('+_0x523b3e['statusMessage']+')'));return;}var _0x5ebfff=fs[_0x3f17('0x1a')](_0x1e09db);_0x5ebfff['on'](_0x3f17('0x1b'),function(){logger[_0x3f17('0x1c')](_0x3f17('0x1d'));_0x5ebfff['close'](_0x48c6c2);});_0x5ebfff['on']('error',function(_0x4626ac){fs['unlink'](_0x1e09db);logger[_0x3f17('0x16')](_0x3f17('0x1e'),_0x4626ac);_0x5b7fe9(_0x4626ac);});_0x523b3e[_0x3f17('0x1f')](_0x5ebfff);})['on']('error',function(_0x149ff7){logger[_0x3f17('0x16')](_0x149ff7);_0x5b7fe9(_0x149ff7);})['end']();});}function uploadFile(_0xc463c9){return new BPromise(function(_0x6129c7,_0x563dc6){var _0x241c4b=urlParse(_0xc463c9);var _0x1747fd=_0x241c4b['protocol']===_0x3f17('0x20')?https:http;var _0x16f9a3={'host':_0x241c4b[_0x3f17('0x13')],'path':_0x241c4b[_0x3f17('0x5')],'headers':{'user-agent':_0x3f17('0x14')}};_0x1747fd[_0x3f17('0x21')](_0x16f9a3,function(_0x28f154){if(_0x28f154[_0x3f17('0x15')]!==0xc8){_0x563dc6(new Error(_0x3f17('0x17')+_0xc463c9+_0x3f17('0x18')+_0x28f154[_0x3f17('0x15')]+'\x20('+_0x28f154[_0x3f17('0x19')]+')'));return;}var _0x21cadf='';_0x28f154['on'](_0x3f17('0x22'),function(_0x4d6003){_0x21cadf+=_0x4d6003;});_0x28f154['on']('end',function(){_0x6129c7(_0x21cadf);});})['on'](_0x3f17('0x16'),function(_0x160300){_0x563dc6(_0x160300);})[_0x3f17('0x23')]();});}function convertFile(_0x384a83,_0x389e42){return new BPromise(function(_0x3120b8,_0x20e737){var _0x391990=sox[_0x3f17('0x24')](_0x384a83,_0x389e42,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x391990['on']('error',function(_0x4af106){logger[_0x3f17('0x16')](_0x3f17('0x25'),_0x4af106);_0x20e737(_0x4af106);});_0x391990['on'](_0x3f17('0x23'),function(){logger['info']('finish\x20to\x20convert');_0x3120b8();});_0x391990['start']();});}function base64Decode(_0x231d50,_0x2e2731){var _0x2b9a85=path[_0x3f17('0x26')](__dirname,'tmp',rs[_0x3f17('0x27')](0x4)+_0x3f17('0x28'));fs[_0x3f17('0x29')](_0x2b9a85,_0x231d50,_0x3f17('0x2a'));return convertFile(_0x2b9a85,_0x2e2731)[_0x3f17('0x2b')](function(){try{fs[_0x3f17('0x2c')](_0x2b9a85);fs[_0x3f17('0x2d')](_0x2e2731,_0x3f17('0x2e'));}catch(_0x4227fb){logger[_0x3f17('0x16')](_0x4227fb);}return _0x2e2731[_0x3f17('0x2f')]('.')[0x0];});}function base64Encode(_0xbc99c5){var _0x89fa24=fs[_0x3f17('0x30')](_0xbc99c5);return new Buffer(_0x89fa24)[_0x3f17('0x31')](_0x3f17('0x2a'));}exports['googleCloudTTS']=function(_0x332033,_0x5a2462,_0x413044,_0x4c009a,_0x50ef95,_0x32d7d7){var _0x3708b1,_0x4c0702;var _0x207aa4=_0x3f17('0x32');var _0x1ccdca=_0x3f17('0x33')+_0x332033;var _0x5d4c7e={};if(_0x5a2462==='ssml'){_0x5d4c7e[_0x3f17('0x34')]={'ssml':_0x413044};}else{_0x5d4c7e['input']={'text':_0x413044};};_0x5d4c7e['voice']={'languageCode':_0x4c009a,'ssmlGender':_0x50ef95};_0x5d4c7e[_0x3f17('0x35')]={'audioEncoding':_0x3f17('0x36'),'sampleRateHertz':0x1f40};var _0x25ba3e={'url':_0x207aa4+_0x3f17('0x37')+_0x1ccdca,'method':_0x3f17('0x38'),'json':!![],'body':_0x5d4c7e};return rp(_0x25ba3e)[_0x3f17('0x2b')](function(_0x16ed87){return new BPromise(function(_0xa383f2,_0x30894c){_0x3708b1=path['resolve'](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+_0x3f17('0x3a'));var _0x596d98=Buffer['from'](_0x16ed87[_0x3f17('0x3b')],_0x3f17('0x2a'));return fs['writeFile'](_0x3708b1,_0x596d98,function(_0x34cc7d){_0x30894c(_0x34cc7d);},function(_0x3008ae){fs[_0x3f17('0x2d')](_0x3708b1,_0x3f17('0x2e'));_0xa383f2(_0x3008ae);});});})['then'](function(_0x455760){_0x4c0702=path[_0x3f17('0x26')](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+'.wav');return convertFile(_0x3708b1,_0x4c0702);})[_0x3f17('0x2b')](function(){try{fs['unlink'](_0x3708b1);fs[_0x3f17('0x2d')](_0x4c0702,'777');}catch(_0x3981db){logger[_0x3f17('0x16')](_0x3981db);}logger[_0x3f17('0x1c')](_0x3f17('0x3c'),_0x4c0702['split']('.')[0x0]);return _0x4c0702['split']('.')[0x0];});};exports['googleTTS']=function(_0x231880,_0x3f8156){var _0x13d6b0=_0x3f17('0x3d');var _0x53ad38,_0xf18921;var _0xcff1b0;var _0x31456b={'encoding':'utf8','method':_0x3f17('0x38'),'timeout':0x2710,'url':_0x13d6b0,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x3f17('0x3e')]([[[_0x3f17('0x3f'),JSON[_0x3f17('0x3e')]([_0x231880,_0x3f8156||'en',![],_0x3f17('0x40')]),null,_0x3f17('0x41')]]]))};return rp(_0x31456b)['then'](function(_0x4668b5){try{_0xcff1b0=eval(_0x4668b5['slice'](0x5))[0x0][0x2];}catch(_0x18a01e){throw new Error(_0x3f17('0x42')+_0x4668b5[_0x3f17('0x22')]);}if(!_0xcff1b0){if(_0x231880['length']>0xc8){throw new Error(_0x3f17('0x43'));}else{throw new Error(_0x3f17('0x44')+_0x3f8156+_0x3f17('0x45'));}}try{_0xcff1b0=eval(_0xcff1b0)[0x0];}catch(_0x4db7f9){throw new Error(_0x3f17('0x42')+res['data']);}const _0x4d390a=_0xcff1b0;_0x53ad38=path[_0x3f17('0x26')](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+'.mp3');fs[_0x3f17('0x29')](_0x53ad38,_0xcff1b0,{'encoding':_0x3f17('0x2a')});_0xf18921=path[_0x3f17('0x26')](__dirname,'tmp',rs[_0x3f17('0x27')](0x4)+_0x3f17('0x28'));return convertFile(_0x53ad38,_0xf18921);})[_0x3f17('0x2b')](function(){try{fs[_0x3f17('0x2c')](_0x53ad38);fs['chmodSync'](_0xf18921,'777');}catch(_0x43df48){logger[_0x3f17('0x16')](_0x43df48);}logger[_0x3f17('0x1c')](_0x3f17('0x46'),_0xf18921['split']('.')[0x0]);return _0xf18921[_0x3f17('0x2f')]('.')[0x0];});};exports[_0x3f17('0x47')]=function(_0x3b4543,_0x5cf202,_0x436b38){return google[_0x3f17('0x48')](_0x3b4543,_0x5cf202,_0x436b38)[_0x3f17('0x2b')](function(_0x4813b2){logger[_0x3f17('0x1c')](_0x4813b2['uri']);return rp(_0x4813b2);})[_0x3f17('0x2b')](function(_0x446508){var _0x5d89e7='';var _0x2c081c=0x0;try{fs[_0x3f17('0x2c')](_0x3b4543);}catch(_0x21eae6){logger['error'](_0x21eae6);}if(_0x446508&&_0x446508[_0x3f17('0x49')]){_0x5d89e7=_0x446508[_0x3f17('0x49')][_0x3f17('0x4a')](function(_0x4f7cc4){return _0x4f7cc4&&_0x4f7cc4[_0x3f17('0x4b')][0x0]&&_0x4f7cc4[_0x3f17('0x4b')][0x0][_0x3f17('0x4c')]?_0x4f7cc4[_0x3f17('0x4b')][0x0][_0x3f17('0x4c')]:'';})[_0x3f17('0x4d')]('\x0a');_0x2c081c=_0x446508[_0x3f17('0x49')]['map'](function(_0x3856cc){return _0x3856cc&&_0x3856cc[_0x3f17('0x4b')][0x0]&&_0x3856cc[_0x3f17('0x4b')][0x0][_0x3f17('0x4e')]?_0x3856cc[_0x3f17('0x4b')][0x0][_0x3f17('0x4e')]:0x0;})[_0x3f17('0x4d')]('\x0a');}logger['info'](_0x3f17('0x4f'),_0x5d89e7);logger[_0x3f17('0x1c')](_0x3f17('0x50'),_0x2c081c);return{'transcript':_0x5d89e7,'confidence':_0x2c081c};})['catch'](function(_0x1431ba){logger[_0x3f17('0x16')]('[%s]\x20%s:%s',_0x1431ba['statusCode'],_0x1431ba[_0x3f17('0x51')],_0x1431ba['message']);});};exports[_0x3f17('0x52')]=function(_0x23f5f5,_0x31b527,_0x36905c,_0x2dbc0f){var _0x14560c=apiai(_0x31b527,{'language':_0x2dbc0f||'en'});return _0x14560c[_0x3f17('0x53')](_0x36905c,{'sessionId':md5(_0x23f5f5)})['then'](function(_0x11f4a9){logger[_0x3f17('0x1c')](JSON[_0x3f17('0x3e')](_0x11f4a9));return{'source':_0x11f4a9[_0x3f17('0x54')]['source'],'resolvedQuery':_0x11f4a9[_0x3f17('0x54')][_0x3f17('0x55')],'action':_0x11f4a9[_0x3f17('0x54')][_0x3f17('0x56')],'actionIncomplete':_0x11f4a9['result'][_0x3f17('0x57')],'speech':_0x11f4a9[_0x3f17('0x54')]['fulfillment'][_0x3f17('0x58')],'score':_0x11f4a9['result']['score'],'statusCode':_0x11f4a9[_0x3f17('0x59')]['code'],'endConversation':_0x11f4a9[_0x3f17('0x54')][_0x3f17('0x5a')][_0x3f17('0x5b')]||![],'isFallbackIntent':_0x11f4a9[_0x3f17('0x54')][_0x3f17('0x5a')][_0x3f17('0x5c')]};});};exports[_0x3f17('0x5d')]=function(_0xa2f861,_0x244ea3,_0x1ce9ad,_0x4161f3,_0x6358f4,_0x5a2bbd){var _0x13b94b=_0x4161f3['replace'](/\\n/g,'\x0a');var _0x3569c5={'credentials':{'private_key':_0x13b94b,'client_email':_0x1ce9ad}};var _0x122697=new dialogflow['SessionsClient'](_0x3569c5);var _0x44e0b5=_0x122697[_0x3f17('0x5e')](_0x244ea3,md5(_0xa2f861));var _0x41e09a={'session':_0x44e0b5,'queryInput':{'text':{'text':_0x6358f4,'languageCode':_0x5a2bbd}}};return _0x122697[_0x3f17('0x5f')](_0x41e09a)['then'](function(_0x53e8ee){if(_0x53e8ee&&_0x53e8ee[_0x3f17('0x60')]){logger[_0x3f17('0x1c')](_0x3f17('0x61'),JSON[_0x3f17('0x3e')](_0x53e8ee));var _0x2adc2b=_0x53e8ee[0x0];if(_0x2adc2b){var _0x23930d={'action':_0x2adc2b[_0x3f17('0x62')]['action'],'allRequiredParamsPresent':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x63')],'endConversation':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x64')]&&_0x2adc2b['queryResult'][_0x3f17('0x64')]['fields']?_0x2adc2b['queryResult'][_0x3f17('0x64')][_0x3f17('0x65')]['end_conversation'][_0x3f17('0x66')]:![],'fulfillmentText':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x67')],'intentName':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x68')][_0x3f17('0x51')],'intentDisplayName':_0x2adc2b['queryResult'][_0x3f17('0x68')][_0x3f17('0x69')],'isFallbackIntent':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x68')]['isFallback'],'languageCode':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x6a')],'queryText':_0x2adc2b['queryResult'][_0x3f17('0x6b')],'responseId':_0x2adc2b[_0x3f17('0x6c')],'score':_0x2adc2b[_0x3f17('0x62')][_0x3f17('0x6d')],'speech':_0x2adc2b['queryResult'][_0x3f17('0x67')],'providerResponse':JSON['stringify'](_0x53e8ee)};return _0x23930d;}}});};exports[_0x3f17('0x6e')]=function(_0x14f70a,_0xafb91a,_0x3252a,_0x4cd866){return tilde[_0x3f17('0x48')](_0x14f70a,_0xafb91a,_0x3252a,_0x4cd866)[_0x3f17('0x2b')](function(_0xf38342){try{fs['unlink'](_0x14f70a);}catch(_0x523050){logger[_0x3f17('0x16')](_0x523050);}logger[_0x3f17('0x1c')](_0x3f17('0x6f'),_0xf38342['transcript']);logger[_0x3f17('0x1c')](_0x3f17('0x70'),_0xf38342[_0x3f17('0x4e')]);return _0xf38342;});};exports['awsPolly']=function(_0xfdbefe,_0x2765d3,_0x13ba42,_0x16b861,_0x2ebc7f,_0x311a3c){var _0xba3ec=path[_0x3f17('0x26')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x498a3b;return aws[_0x3f17('0x71')](_0xfdbefe,_0x2765d3,_0x13ba42,_0x16b861,_0x2ebc7f,_0x311a3c,_0xba3ec)[_0x3f17('0x2b')](function(){_0x498a3b=path[_0x3f17('0x26')](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+_0x3f17('0x28'));return convertFile(_0xba3ec,_0x498a3b);})[_0x3f17('0x2b')](function(){try{fs[_0x3f17('0x2c')](_0xba3ec);fs[_0x3f17('0x2d')](_0x498a3b,_0x3f17('0x2e'));}catch(_0x18a0a7){logger['error'](_0x18a0a7);}return _0x498a3b['split']('.')[0x0];});};exports[_0x3f17('0x72')]=function(_0x38f843,_0x5d25d7,_0x56191d,_0x45d51f,_0xc1a90e,_0x425d01){return aws[_0x3f17('0x73')](_0x38f843,_0x5d25d7,_0x56191d,_0x45d51f,_0xc1a90e,_0x425d01)[_0x3f17('0x2b')](function(_0x12a00b){logger['info'](JSON[_0x3f17('0x3e')](_0x12a00b));return _0x12a00b;});};exports[_0x3f17('0x74')]=function(_0x402f0b,_0x42ea95,_0x436964,_0x5c6af4){var _0x59d324=util[_0x3f17('0x75')](_0x3f17('0x76'),ISPEECH_API,_0x402f0b,encodeURIComponent(_0x42ea95),_0x436964,_0x5c6af4);var _0x19767c=path[_0x3f17('0x26')](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+_0x3f17('0x3a'));var _0xe474d7;return downloadFile(_0x59d324,_0x19767c)[_0x3f17('0x2b')](function(){_0xe474d7=path[_0x3f17('0x26')](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+'.wav');return convertFile(_0x19767c,_0xe474d7);})['then'](function(){try{fs[_0x3f17('0x2c')](_0x19767c);fs['chmodSync'](_0xe474d7,_0x3f17('0x2e'));}catch(_0x5c4413){logger['error'](_0x5c4413);}return _0xe474d7[_0x3f17('0x2f')]('.')[0x0];});};exports[_0x3f17('0x77')]=function(_0x345104,_0x49f84e,_0x2024ba,_0xeffbac){var _0x2bc4e9=util['format'](_0x3f17('0x78'),ISPEECH_API,_0x49f84e,_0x2024ba,base64Encode(_0x345104),_0xeffbac?util[_0x3f17('0x75')]('model=%s',encodeURIComponent(_0xeffbac)):_0x3f17('0x79'));return uploadFile(_0x2bc4e9)['then'](function(_0x48beb1){return querystring[_0x3f17('0x9')](_0x48beb1);});};exports[_0x3f17('0x7a')]=function(_0x2583ff,_0x5d8837){return sestek['nda'](_0x2583ff,_0x5d8837)[_0x3f17('0x2b')](function(_0xad3e19){logger['info'](JSON[_0x3f17('0x3e')](_0xad3e19));var _0x42b560={'speech':_0xad3e19['text'],'action':_0xad3e19[_0x3f17('0x7b')]?_0xad3e19[_0x3f17('0x7b')][_0x3f17('0x7c')]:undefined,'actiondata':_0xad3e19['channelData']?_0xad3e19['channelData']['CustomActionData']:undefined};if(_0xad3e19['channelData']&&_0xad3e19[_0x3f17('0x7b')][_0x3f17('0x7d')]){return base64Decode(_0xad3e19[_0x3f17('0x7b')][_0x3f17('0x7d')][_0x3f17('0x7e')],path[_0x3f17('0x26')](__dirname,_0x3f17('0x39'),rs[_0x3f17('0x27')](0x4)+_0x3f17('0x28')))[_0x3f17('0x2b')](function(_0x4d239e){_0x42b560[_0x3f17('0x7f')]=_0x4d239e;return _0x42b560;});}return _0x42b560;});};exports[_0x3f17('0x80')]=function(){return __dirname;}; \ No newline at end of file +var _0x741d=['googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','pipe','end','https:','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','googleASR\x20transcription'];(function(_0x3a79d3,_0x2eefcd){var _0x169600=function(_0x18f4e5){while(--_0x18f4e5){_0x3a79d3['push'](_0x3a79d3['shift']());}};_0x169600(++_0x2eefcd);}(_0x741d,0x152));var _0xd741=function(_0x2105c2,_0x58f5e2){_0x2105c2=_0x2105c2-0x0;var _0x2d24bb=_0x741d[_0x2105c2];return _0x2d24bb;};'use strict';var apiai=require(_0xd741('0x0'));var BPromise=require(_0xd741('0x1'));var dialogflow=require(_0xd741('0x2'));var fs=require('fs');var http=require(_0xd741('0x3'));var https=require(_0xd741('0x4'));var md5=require(_0xd741('0x5'));var path=require(_0xd741('0x6'));var querystring=require(_0xd741('0x7'));var rp=require(_0xd741('0x8'));var rs=require('randomstring');var sox=require(_0xd741('0x9'));var tts=require(_0xd741('0xa'));var urlParse=require(_0xd741('0xb'))[_0xd741('0xc')];var util=require('util');var aws=require(_0xd741('0xd'));var google=require('./google');var sestek=require(_0xd741('0xe'));var tilde=require(_0xd741('0xf'));var logger=require(_0xd741('0x10'))('agi');var ISPEECH_API=_0xd741('0x11');function downloadFile(_0x176ed6,_0x1f8732){return new BPromise(function(_0x1cc7b7,_0x5223d1){var _0x6fdd59=urlParse(_0x176ed6);var _0x5875db=_0x6fdd59[_0xd741('0x12')]==='https:'?https:http;var _0x1a656d={'host':_0x6fdd59[_0xd741('0x13')],'path':_0x6fdd59[_0xd741('0x6')],'headers':{'user-agent':_0xd741('0x14')}};_0x5875db[_0xd741('0x15')](_0x1a656d,function(_0x2db179){if(_0x2db179[_0xd741('0x16')]!==0xc8){logger[_0xd741('0x17')](_0xd741('0x18')+_0x176ed6+_0xd741('0x19')+_0x2db179['statusCode']+'\x20('+_0x2db179[_0xd741('0x1a')]+')');_0x5223d1(new Error(_0xd741('0x18')+_0x176ed6+_0xd741('0x19')+_0x2db179[_0xd741('0x16')]+'\x20('+_0x2db179[_0xd741('0x1a')]+')'));return;}var _0x571cfa=fs['createWriteStream'](_0x1f8732);_0x571cfa['on'](_0xd741('0x1b'),function(){logger[_0xd741('0x1c')](_0xd741('0x1d'));_0x571cfa['close'](_0x1cc7b7);});_0x571cfa['on'](_0xd741('0x17'),function(_0x53847d){fs[_0xd741('0x1e')](_0x1f8732);logger[_0xd741('0x17')]('download\x20error',_0x53847d);_0x5223d1(_0x53847d);});_0x2db179[_0xd741('0x1f')](_0x571cfa);})['on']('error',function(_0x10f955){logger[_0xd741('0x17')](_0x10f955);_0x5223d1(_0x10f955);})[_0xd741('0x20')]();});}function uploadFile(_0x2bf576){return new BPromise(function(_0x1e81bd,_0x4693a2){var _0x3270e5=urlParse(_0x2bf576);var _0x2ab2bc=_0x3270e5[_0xd741('0x12')]===_0xd741('0x21')?https:http;var _0x5af157={'host':_0x3270e5['host'],'path':_0x3270e5[_0xd741('0x6')],'headers':{'user-agent':_0xd741('0x14')}};_0x2ab2bc[_0xd741('0x15')](_0x5af157,function(_0x456fe0){if(_0x456fe0['statusCode']!==0xc8){_0x4693a2(new Error(_0xd741('0x18')+_0x2bf576+'\x20failed,\x20status\x20code\x20=\x20'+_0x456fe0[_0xd741('0x16')]+'\x20('+_0x456fe0[_0xd741('0x1a')]+')'));return;}var _0x47fa7e='';_0x456fe0['on']('data',function(_0x53e254){_0x47fa7e+=_0x53e254;});_0x456fe0['on'](_0xd741('0x20'),function(){_0x1e81bd(_0x47fa7e);});})['on'](_0xd741('0x17'),function(_0x3ea312){_0x4693a2(_0x3ea312);})[_0xd741('0x20')]();});}function convertFile(_0x42db5b,_0x10b1a5){return new BPromise(function(_0x13a983,_0x2788bb){var _0x49d627=sox[_0xd741('0x22')](_0x42db5b,_0x10b1a5,{'sampleRate':0x1f40,'format':_0xd741('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x49d627['on'](_0xd741('0x17'),function(_0x562aa3){logger[_0xd741('0x17')](_0xd741('0x24'),_0x562aa3);_0x2788bb(_0x562aa3);});_0x49d627['on'](_0xd741('0x20'),function(){logger[_0xd741('0x1c')](_0xd741('0x25'));_0x13a983();});_0x49d627[_0xd741('0x26')]();});}function base64Decode(_0x498eef,_0x21e979){var _0x4f0476=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs['generate'](0x4)+_0xd741('0x29'));fs[_0xd741('0x2a')](_0x4f0476,_0x498eef,_0xd741('0x2b'));return convertFile(_0x4f0476,_0x21e979)[_0xd741('0x2c')](function(){try{fs[_0xd741('0x1e')](_0x4f0476);fs['chmodSync'](_0x21e979,_0xd741('0x2d'));}catch(_0x396f64){logger[_0xd741('0x17')](_0x396f64);}return _0x21e979[_0xd741('0x2e')]('.')[0x0];});}function base64Encode(_0x538fa9){var _0x405bd3=fs[_0xd741('0x2f')](_0x538fa9);return new Buffer(_0x405bd3)[_0xd741('0x30')](_0xd741('0x2b'));}exports['googleCloudTTS']=function(_0x2f0c70,_0x1fade2,_0x7c0a95,_0x252dec,_0x436432,_0x367a0f){var _0x5038d5,_0x669b16;var _0x1b382f=_0xd741('0x31');var _0x1d840e=_0xd741('0x32')+_0x2f0c70;var _0x478618={};if(_0x1fade2===_0xd741('0x33')){_0x478618[_0xd741('0x34')]={'ssml':_0x7c0a95};}else{_0x478618[_0xd741('0x34')]={'text':_0x7c0a95};};_0x478618[_0xd741('0x35')]={'languageCode':_0x252dec,'ssmlGender':_0x436432};_0x478618[_0xd741('0x36')]={'audioEncoding':_0xd741('0x37'),'sampleRateHertz':0x1f40};var _0x2f0844={'url':_0x1b382f+_0xd741('0x38')+_0x1d840e,'method':_0xd741('0x39'),'json':!![],'body':_0x478618};return rp(_0x2f0844)[_0xd741('0x2c')](function(_0x580355){return new BPromise(function(_0x3c9c66,_0x4fd19e){_0x5038d5=path[_0xd741('0x27')](__dirname,'tmp',rs[_0xd741('0x3a')](0x4)+_0xd741('0x3b'));var _0x28bb78=Buffer[_0xd741('0x3c')](_0x580355[_0xd741('0x3d')],'base64');return fs[_0xd741('0x3e')](_0x5038d5,_0x28bb78,function(_0x578049){_0x4fd19e(_0x578049);},function(_0x3c39d3){fs[_0xd741('0x3f')](_0x5038d5,_0xd741('0x2d'));_0x3c9c66(_0x3c39d3);});});})[_0xd741('0x2c')](function(_0x59a52d){_0x669b16=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+_0xd741('0x29'));return convertFile(_0x5038d5,_0x669b16);})['then'](function(){try{fs[_0xd741('0x1e')](_0x5038d5);fs[_0xd741('0x3f')](_0x669b16,_0xd741('0x2d'));}catch(_0x2fbeee){logger[_0xd741('0x17')](_0x2fbeee);}logger['info'](_0xd741('0x40'),_0x669b16[_0xd741('0x2e')]('.')[0x0]);return _0x669b16[_0xd741('0x2e')]('.')[0x0];});};exports[_0xd741('0x41')]=function(_0x185ef3,_0x16fb93){var _0x26a805=_0xd741('0x42');var _0x21a20c,_0x410ace;var _0x467170;var _0x170db8={'encoding':_0xd741('0x43'),'method':_0xd741('0x39'),'timeout':0x2710,'url':_0x26a805,'headers':{'Content-Type':_0xd741('0x44')},'body':_0xd741('0x45')+encodeURIComponent(JSON[_0xd741('0x46')]([[['jQ1olc',JSON[_0xd741('0x46')]([_0x185ef3,_0x16fb93||'en',![],_0xd741('0x47')]),null,_0xd741('0x48')]]]))};return rp(_0x170db8)[_0xd741('0x2c')](function(_0xfd8d3d){try{_0x467170=eval(_0xfd8d3d[_0xd741('0x49')](0x5))[0x0][0x2];}catch(_0x2251ca){throw new Error(_0xd741('0x4a')+_0xfd8d3d[_0xd741('0x4b')]);}if(!_0x467170){if(_0x185ef3[_0xd741('0x4c')]>0xc8){throw new Error(_0xd741('0x4d'));}else{throw new Error(_0xd741('0x4e')+_0x16fb93+_0xd741('0x4f'));}}try{_0x467170=eval(_0x467170)[0x0];}catch(_0x4bf8dc){throw new Error(_0xd741('0x4a')+res['data']);}const _0x5c1f77=_0x467170;_0x21a20c=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+_0xd741('0x3b'));fs[_0xd741('0x2a')](_0x21a20c,_0x467170,{'encoding':'base64'});_0x410ace=path[_0xd741('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xd741('0x29'));return convertFile(_0x21a20c,_0x410ace);})[_0xd741('0x2c')](function(){try{fs[_0xd741('0x1e')](_0x21a20c);fs[_0xd741('0x3f')](_0x410ace,_0xd741('0x2d'));}catch(_0x3e3b59){logger[_0xd741('0x17')](_0x3e3b59);}logger[_0xd741('0x1c')](_0xd741('0x50'),_0x410ace['split']('.')[0x0]);return _0x410ace[_0xd741('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x417cbc,_0xa5161d,_0x27af8d){return google[_0xd741('0x51')](_0x417cbc,_0xa5161d,_0x27af8d)[_0xd741('0x2c')](function(_0x49ee63){logger[_0xd741('0x1c')](_0x49ee63['uri']);return rp(_0x49ee63);})[_0xd741('0x2c')](function(_0x2b6e21){var _0x281cc4='';var _0x3a1252=0x0;try{fs[_0xd741('0x1e')](_0x417cbc);}catch(_0x39b8fa){logger[_0xd741('0x17')](_0x39b8fa);}if(_0x2b6e21&&_0x2b6e21[_0xd741('0x52')]){_0x281cc4=_0x2b6e21[_0xd741('0x52')][_0xd741('0x53')](function(_0x5c5a4d){return _0x5c5a4d&&_0x5c5a4d[_0xd741('0x54')][0x0]&&_0x5c5a4d['alternatives'][0x0][_0xd741('0x55')]?_0x5c5a4d[_0xd741('0x54')][0x0][_0xd741('0x55')]:'';})[_0xd741('0x56')]('\x0a');_0x3a1252=_0x2b6e21['results'][_0xd741('0x53')](function(_0x154550){return _0x154550&&_0x154550[_0xd741('0x54')][0x0]&&_0x154550['alternatives'][0x0]['confidence']?_0x154550['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xd741('0x1c')](_0xd741('0x57'),_0x281cc4);logger[_0xd741('0x1c')](_0xd741('0x58'),_0x3a1252);return{'transcript':_0x281cc4,'confidence':_0x3a1252};})[_0xd741('0x59')](function(_0x4361b4){logger[_0xd741('0x17')](_0xd741('0x5a'),_0x4361b4[_0xd741('0x16')],_0x4361b4['name'],_0x4361b4[_0xd741('0x5b')]);});};exports['googleDialogflow']=function(_0x3850c6,_0x2e45eb,_0x582ac9,_0x345380){var _0x1a43cf=apiai(_0x2e45eb,{'language':_0x345380||'en'});return _0x1a43cf[_0xd741('0x5c')](_0x582ac9,{'sessionId':md5(_0x3850c6)})[_0xd741('0x2c')](function(_0x4815a9){logger[_0xd741('0x1c')](JSON[_0xd741('0x46')](_0x4815a9));return{'source':_0x4815a9[_0xd741('0x5d')][_0xd741('0x5e')],'resolvedQuery':_0x4815a9[_0xd741('0x5d')][_0xd741('0x5f')],'action':_0x4815a9[_0xd741('0x5d')][_0xd741('0x60')],'actionIncomplete':_0x4815a9['result'][_0xd741('0x61')],'speech':_0x4815a9[_0xd741('0x5d')][_0xd741('0x62')][_0xd741('0x63')],'score':_0x4815a9['result'][_0xd741('0x64')],'statusCode':_0x4815a9[_0xd741('0x65')]['code'],'endConversation':_0x4815a9[_0xd741('0x5d')]['metadata'][_0xd741('0x66')]||![],'isFallbackIntent':_0x4815a9[_0xd741('0x5d')][_0xd741('0x67')][_0xd741('0x68')]};});};exports[_0xd741('0x69')]=function(_0x258b6a,_0x505580,_0x36b5eb,_0x498c17,_0x3be8c2,_0x4b82e6){var _0x319761=_0x498c17[_0xd741('0x6a')](/\\n/g,'\x0a');var _0x491332={'credentials':{'private_key':_0x319761,'client_email':_0x36b5eb}};var _0x1ab3ef=new dialogflow[(_0xd741('0x6b'))](_0x491332);var _0x323531=_0x1ab3ef[_0xd741('0x6c')](_0x505580,md5(_0x258b6a));var _0x4ad267={'session':_0x323531,'queryInput':{'text':{'text':_0x3be8c2,'languageCode':_0x4b82e6}}};return _0x1ab3ef[_0xd741('0x6d')](_0x4ad267)[_0xd741('0x2c')](function(_0x4334e9){if(_0x4334e9&&_0x4334e9[_0xd741('0x4c')]){logger['info'](_0xd741('0x6e'),JSON['stringify'](_0x4334e9));var _0x1d39a9=_0x4334e9[0x0];if(_0x1d39a9){var _0x5d6e16={'action':_0x1d39a9[_0xd741('0x6f')]['action'],'allRequiredParamsPresent':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x70')],'endConversation':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x71')]&&_0x1d39a9[_0xd741('0x6f')][_0xd741('0x71')][_0xd741('0x72')]?_0x1d39a9[_0xd741('0x6f')][_0xd741('0x71')][_0xd741('0x72')][_0xd741('0x73')][_0xd741('0x74')]:![],'fulfillmentText':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x75')],'intentName':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x76')]['name'],'intentDisplayName':_0x1d39a9['queryResult'][_0xd741('0x76')]['displayName'],'isFallbackIntent':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x76')]['isFallback'],'languageCode':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x77')],'queryText':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x78')],'responseId':_0x1d39a9['responseId'],'score':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x79')],'speech':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x75')],'providerResponse':JSON[_0xd741('0x46')](_0x4334e9)};return _0x5d6e16;}}});};exports[_0xd741('0x7a')]=function(_0x11676c,_0x255030,_0x241bf0,_0x367cca){return tilde[_0xd741('0x51')](_0x11676c,_0x255030,_0x241bf0,_0x367cca)['then'](function(_0x29ba27){try{fs[_0xd741('0x1e')](_0x11676c);}catch(_0x41e8c9){logger[_0xd741('0x17')](_0x41e8c9);}logger[_0xd741('0x1c')](_0xd741('0x7b'),_0x29ba27[_0xd741('0x55')]);logger[_0xd741('0x1c')](_0xd741('0x7c'),_0x29ba27[_0xd741('0x7d')]);return _0x29ba27;});};exports['awsPolly']=function(_0x2d193d,_0x36dae0,_0x117949,_0x20ecd3,_0x2f5ecf,_0x894a43){var _0x4adc4c=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs['generate'](0x4)+_0xd741('0x3b'));var _0x56a76f;return aws['polly'](_0x2d193d,_0x36dae0,_0x117949,_0x20ecd3,_0x2f5ecf,_0x894a43,_0x4adc4c)['then'](function(){_0x56a76f=path[_0xd741('0x27')](__dirname,'tmp',rs[_0xd741('0x3a')](0x4)+_0xd741('0x29'));return convertFile(_0x4adc4c,_0x56a76f);})[_0xd741('0x2c')](function(){try{fs[_0xd741('0x1e')](_0x4adc4c);fs[_0xd741('0x3f')](_0x56a76f,_0xd741('0x2d'));}catch(_0x48c7a8){logger[_0xd741('0x17')](_0x48c7a8);}return _0x56a76f[_0xd741('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x31a1d8,_0x7421a2,_0x12263e,_0x920ddb,_0x4dc70d,_0x5d95d4){return aws[_0xd741('0x7e')](_0x31a1d8,_0x7421a2,_0x12263e,_0x920ddb,_0x4dc70d,_0x5d95d4)[_0xd741('0x2c')](function(_0x46a147){logger[_0xd741('0x1c')](JSON[_0xd741('0x46')](_0x46a147));return _0x46a147;});};exports[_0xd741('0x7f')]=function(_0x3e8ead,_0x17f762,_0x2fde2b,_0x3a4bc7){var _0x384012=util[_0xd741('0x80')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3e8ead,encodeURIComponent(_0x17f762),_0x2fde2b,_0x3a4bc7);var _0x5e1d28=path['resolve'](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+'.mp3');var _0x332a4d;return downloadFile(_0x384012,_0x5e1d28)[_0xd741('0x2c')](function(){_0x332a4d=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+'.wav');return convertFile(_0x5e1d28,_0x332a4d);})['then'](function(){try{fs[_0xd741('0x1e')](_0x5e1d28);fs[_0xd741('0x3f')](_0x332a4d,_0xd741('0x2d'));}catch(_0x42c597){logger['error'](_0x42c597);}return _0x332a4d[_0xd741('0x2e')]('.')[0x0];});};exports[_0xd741('0x81')]=function(_0x1c34e4,_0x51f77b,_0x57e628,_0x222722){var _0x38b139=util[_0xd741('0x80')](_0xd741('0x82'),ISPEECH_API,_0x51f77b,_0x57e628,base64Encode(_0x1c34e4),_0x222722?util[_0xd741('0x80')](_0xd741('0x83'),encodeURIComponent(_0x222722)):_0xd741('0x84'));return uploadFile(_0x38b139)[_0xd741('0x2c')](function(_0x1c0c6b){return querystring['parse'](_0x1c0c6b);});};exports[_0xd741('0x85')]=function(_0x2c86f1,_0x2a2c92){return sestek['nda'](_0x2c86f1,_0x2a2c92)[_0xd741('0x2c')](function(_0x4ca7b4){logger[_0xd741('0x1c')](JSON['stringify'](_0x4ca7b4));var _0x59a8f4={'speech':_0x4ca7b4[_0xd741('0x86')],'action':_0x4ca7b4[_0xd741('0x87')]?_0x4ca7b4[_0xd741('0x87')][_0xd741('0x88')]:undefined,'actiondata':_0x4ca7b4[_0xd741('0x87')]?_0x4ca7b4['channelData'][_0xd741('0x89')]:undefined};if(_0x4ca7b4[_0xd741('0x87')]&&_0x4ca7b4['channelData'][_0xd741('0x8a')]){return base64Decode(_0x4ca7b4[_0xd741('0x87')]['AudioFromTts'][_0xd741('0x8b')],path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs['generate'](0x4)+_0xd741('0x29')))[_0xd741('0x2c')](function(_0x39920a){_0x59a8f4[_0xd741('0x8c')]=_0x39920a;return _0x59a8f4;});}return _0x59a8f4;});};exports[_0xd741('0x8d')]=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 fbb89ad..82693e0 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 _0x7370=['exports','./nda'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x7370,0x147));var _0x0737=function(_0x6c225b,_0x4de56c){_0x6c225b=_0x6c225b-0x0;var _0x268839=_0x7370[_0x6c225b];return _0x268839;};var nda=require(_0x0737('0x0'));module[_0x0737('0x1')]={'nda':nda}; \ No newline at end of file +var _0xc5fd=['./nda','exports'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xc5fd,0x15e));var _0xdc5f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xc5fd[_0x45783c];return _0x1161da;};var nda=require(_0xdc5f('0x0'));module[_0xdc5f('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a62fde4..7bb9fb1 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 _0xc686=['custom_action','CustomActionData','custom_action_data','stringify','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','calleridname','extension','text','access_token','channelData','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav'];(function(_0x1051ce,_0x461894){var _0x36d623=function(_0x1da0de){while(--_0x1da0de){_0x1051ce['push'](_0x1051ce['shift']());}};_0x36d623(++_0x461894);}(_0xc686,0x148));var _0x6c68=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc686[_0x2b5eae];return _0x5f3ac9;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x6c68('0x0'))('agi');module[_0x6c68('0x1')]=function(_0x5f1f2c,_0x1f6b6d){var _0x4008ce={'method':_0x6c68('0x2'),'uri':url[_0x6c68('0x3')](_0x1f6b6d[_0x6c68('0x4')],_0x6c68('0x5')),'form':{'grant_type':_0x6c68('0x6'),'username':_0x1f6b6d[_0x6c68('0x7')],'password':_0x1f6b6d[_0x6c68('0x6')]},'json':!![]};return rp(_0x4008ce)[_0x6c68('0x8')](function(_0x12e935){var _0x394644={'method':'POST','uri':url[_0x6c68('0x3')](_0x1f6b6d[_0x6c68('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1f6b6d[_0x6c68('0xa')]||'message','channelId':_0x6c68('0xb'),'conversation':{'id':_0x5f1f2c[_0x6c68('0xc')]},'from':{'id':_0x5f1f2c['callerid'],'name':_0x5f1f2c[_0x6c68('0xd')]},'recipient':{'id':_0x5f1f2c['dnid'],'name':_0x5f1f2c[_0x6c68('0xe')]},'text':_0x1f6b6d[_0x6c68('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x12e935[_0x6c68('0x10')]},'json':!![]};if(_0x1f6b6d['project']){_0x394644['body'][_0x6c68('0x11')]['ProjectName']=_0x1f6b6d[_0x6c68('0x12')];}if(_0x1f6b6d[_0x6c68('0x13')]=='1'){_0x394644[_0x6c68('0x14')]['channelData'][_0x6c68('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6c68('0x16')};}if(_0x1f6b6d[_0x6c68('0x17')]){_0x394644[_0x6c68('0x14')][_0x6c68('0x11')]['CustomAction']=_0x1f6b6d['custom_action'];if(_0x1f6b6d['custom_action_data']){_0x394644[_0x6c68('0x14')][_0x6c68('0x11')][_0x6c68('0x18')]=_0x1f6b6d[_0x6c68('0x19')];}}logger['info'](JSON[_0x6c68('0x1a')](_0x394644));return rp(_0x394644);});}; \ No newline at end of file +var _0x3670=['Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','dnid','extension','text'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3670,0x16c));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var rp=require('request-promise');var url=require(_0x0367('0x0'));var logger=require(_0x0367('0x1'))(_0x0367('0x2'));module[_0x0367('0x3')]=function(_0x3ea441,_0xfefd2b){var _0x183c1e={'method':'POST','uri':url[_0x0367('0x4')](_0xfefd2b[_0x0367('0x5')],_0x0367('0x6')),'form':{'grant_type':_0x0367('0x7'),'username':_0xfefd2b[_0x0367('0x8')],'password':_0xfefd2b[_0x0367('0x7')]},'json':!![]};return rp(_0x183c1e)[_0x0367('0x9')](function(_0x55f08e){var _0x298a55={'method':_0x0367('0xa'),'uri':url[_0x0367('0x4')](_0xfefd2b[_0x0367('0xb')],_0x0367('0xc')),'body':{'type':_0xfefd2b[_0x0367('0xd')]||_0x0367('0xe'),'channelId':_0x0367('0xf'),'conversation':{'id':_0x3ea441['uniqueid']},'from':{'id':_0x3ea441[_0x0367('0x10')],'name':_0x3ea441['calleridname']},'recipient':{'id':_0x3ea441[_0x0367('0x11')],'name':_0x3ea441[_0x0367('0x12')]},'text':_0xfefd2b[_0x0367('0x13')],'channelData':{}},'headers':{'Authorization':_0x0367('0x14')+_0x55f08e[_0x0367('0x15')]},'json':!![]};if(_0xfefd2b[_0x0367('0x16')]){_0x298a55[_0x0367('0x17')][_0x0367('0x18')]['ProjectName']=_0xfefd2b[_0x0367('0x16')];}if(_0xfefd2b[_0x0367('0x19')]=='1'){_0x298a55['body'][_0x0367('0x18')][_0x0367('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0367('0x1b')};}if(_0xfefd2b['custom_action']){_0x298a55[_0x0367('0x17')][_0x0367('0x18')][_0x0367('0x1c')]=_0xfefd2b[_0x0367('0x1d')];if(_0xfefd2b['custom_action_data']){_0x298a55['body'][_0x0367('0x18')][_0x0367('0x1e')]=_0xfefd2b[_0x0367('0x1f')];}}logger['info'](JSON['stringify'](_0x298a55));return rp(_0x298a55);});}; \ 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 88ddaed..150962d 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 _0x942d=['./lib/api'];(function(_0xeeca4d,_0x37d7f9){var _0x159c7b=function(_0x10e5e4){while(--_0x10e5e4){_0xeeca4d['push'](_0xeeca4d['shift']());}};_0x159c7b(++_0x37d7f9);}(_0x942d,0xb0));var _0xd942=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x942d[_0x1cc8fe];return _0x230054;};'use strict';var asr=require(_0xd942('0x0'));module['exports']=function(_0x3d4424,_0x5949e1,_0x448643,_0x558e6c){return asr(_0x3d4424,_0x5949e1,_0x448643,_0x558e6c);}; \ No newline at end of file +var _0x7c66=['exports','./lib/api'];(function(_0x4bc269,_0x560634){var _0x47f4dc=function(_0x5e8cbc){while(--_0x5e8cbc){_0x4bc269['push'](_0x4bc269['shift']());}};_0x47f4dc(++_0x560634);}(_0x7c66,0x195));var _0x67c6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7c66[_0x2f5ac5];return _0x37c9a8;};'use strict';var asr=require(_0x67c6('0x0'));module[_0x67c6('0x1')]=function(_0x1dc004,_0x3f815c,_0x37dbd4,_0x2f7df4){return asr(_0x1dc004,_0x3f815c,_0x37dbd4,_0x2f7df4);}; \ 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 bf84487..da12f95 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 _0x8f5d=['EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','close'];(function(_0x32f0ef,_0x157ffe){var _0x3e471e=function(_0x473a85){while(--_0x473a85){_0x32f0ef['push'](_0x32f0ef['shift']());}};_0x3e471e(++_0x157ffe);}(_0x8f5d,0x15d));var _0xd8f5=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x8f5d[_0x9dfc10];return _0x4f938a;};'use strict';var BPromise=require(_0xd8f5('0x0'));var _=require(_0xd8f5('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd8f5('0x2'));var crypto=require('crypto');var logger=require(_0xd8f5('0x3'))(_0xd8f5('0x4'));module[_0xd8f5('0x5')]=function(_0x14aaa9,_0x3a12a5,_0x4c424b,_0x597eec){return new BPromise(function(_0x700aa7,_0x167b1f){logger[_0xd8f5('0x6')](_0xd8f5('0x7'),_0x597eec||_0xd8f5('0x8'));var _0x3aa42a=new WebSocket(_0x597eec||_0xd8f5('0x8'),{'perMessageDeflate':![]});var _0x40f61a='';var _0x3226bc='0';var _0x192efa='1';var _0x54d38a=_0xd8f5('0x9');function _0x51114b(_0x39d922){var _0x275f15=crypto[_0xd8f5('0xa')](_0xd8f5('0xb'));_0x275f15[_0xd8f5('0xc')](_0x39d922);return _0x275f15[_0xd8f5('0xd')](_0xd8f5('0xe'));}function _0x30e02f(){try{logger[_0xd8f5('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x591447=moment()[_0xd8f5('0xf')]();var _0x2cdabf=_0x51114b(_0x591447+_0x3a12a5+_0x4c424b);_0x3aa42a[_0xd8f5('0x10')](JSON[_0xd8f5('0x11')]({'appID':_0x3a12a5,'timestamp':_0x591447,'appKey':_0x2cdabf}));var _0x4453da=fs[_0xd8f5('0x12')](_0x14aaa9);_0x4453da['on']('data',function(_0x1bc783){_0x3aa42a[_0xd8f5('0x10')](_0x1bc783);});_0x4453da['on'](_0xd8f5('0x13'),function(){_0x3aa42a[_0xd8f5('0x10')](_0xd8f5('0x14'));});}catch(_0x4907a1){logger['error'](_0xd8f5('0x15'),JSON['stringify'](_0x4907a1));_0x3aa42a[_0xd8f5('0x16')]();}}function _0x5c7a17(_0x219288){try{if(_0x219288){var _0x243373=JSON[_0xd8f5('0x17')](_0x219288);switch(_0x243373[_0xd8f5('0x18')]){case 0x0:if(_0x243373[_0xd8f5('0x19')]){if(_0x243373[_0xd8f5('0x19')]['final']){logger[_0xd8f5('0x6')](_0xd8f5('0x1a'),JSON[_0xd8f5('0x11')](_0x243373[_0xd8f5('0x19')]['hypotheses']));_0x40f61a=_0x243373['result'][_0xd8f5('0x1b')][0x0][_0xd8f5('0x1c')];_0x3226bc=_0x243373[_0xd8f5('0x19')][_0xd8f5('0x1b')][0x0][_0xd8f5('0x1d')];_0x192efa='0';_0x54d38a=_0xd8f5('0x1e');_0x3aa42a[_0xd8f5('0x16')]();}}break;case 0x1:logger[_0xd8f5('0x6')](_0xd8f5('0x9'));_0x192efa='1';_0x54d38a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xd8f5('0x6')](_0xd8f5('0x1f'));_0x192efa='2';_0x54d38a=_0xd8f5('0x1f');break;case 0x9:logger[_0xd8f5('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x192efa='9';_0x54d38a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x192efa='10';_0x54d38a=_0xd8f5('0x20');break;case 0xb:logger[_0xd8f5('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x192efa='11';_0x54d38a=_0xd8f5('0x21');}}}catch(_0x4c99cc){logger[_0xd8f5('0x22')](_0xd8f5('0x23'),JSON[_0xd8f5('0x11')](_0x4c99cc));_0x3aa42a['terminate']();}}function _0x557a43(){logger['info'](_0xd8f5('0x24'));_0x700aa7({'transcript':_0x40f61a,'confidence':_0x3226bc,'status':_0x192efa,'status_message':_0x54d38a});}function _0x49953e(_0x4a5cc9){logger[_0xd8f5('0x22')](_0xd8f5('0x25'));if(!_[_0xd8f5('0x26')](_0x4a5cc9)){logger[_0xd8f5('0x22')](_[_0xd8f5('0x27')](_0x4a5cc9)?JSON[_0xd8f5('0x11')](_0x4a5cc9):_0x4a5cc9);}}_0x3aa42a['on']('open',_0x30e02f);_0x3aa42a['on'](_0xd8f5('0x28'),_0x5c7a17);_0x3aa42a['on']('close',_0x557a43);_0x3aa42a['on'](_0xd8f5('0x22'),_0x49953e);});}; \ No newline at end of file +var _0x1015=['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','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x37d426,_0x84388){var _0x1c7067=function(_0x3966f9){while(--_0x3966f9){_0x37d426['push'](_0x37d426['shift']());}};_0x1c7067(++_0x84388);}(_0x1015,0x100));var _0x5101=function(_0x2735d2,_0x3be08a){_0x2735d2=_0x2735d2-0x0;var _0x2a8248=_0x1015[_0x2735d2];return _0x2a8248;};'use strict';var BPromise=require(_0x5101('0x0'));var _=require(_0x5101('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5101('0x2'));var logger=require(_0x5101('0x3'))('agi');module[_0x5101('0x4')]=function(_0x1def5f,_0x10b427,_0x30445b,_0x144a48){return new BPromise(function(_0x10ac6f,_0x324161){logger[_0x5101('0x5')](_0x5101('0x6'),_0x144a48||_0x5101('0x7'));var _0x2456ba=new WebSocket(_0x144a48||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x507b48='';var _0x9e5ea3='0';var _0x46653f='1';var _0x4ce471=_0x5101('0x8');function _0x290447(_0x5c0a75){var _0x5bc9a8=crypto['createHash'](_0x5101('0x9'));_0x5bc9a8[_0x5101('0xa')](_0x5c0a75);return _0x5bc9a8['digest'](_0x5101('0xb'));}function _0x527853(){try{logger[_0x5101('0x5')](_0x5101('0xc'));var _0xd7545a=moment()[_0x5101('0xd')]();var _0x747d8d=_0x290447(_0xd7545a+_0x10b427+_0x30445b);_0x2456ba[_0x5101('0xe')](JSON[_0x5101('0xf')]({'appID':_0x10b427,'timestamp':_0xd7545a,'appKey':_0x747d8d}));var _0x5143ab=fs[_0x5101('0x10')](_0x1def5f);_0x5143ab['on'](_0x5101('0x11'),function(_0x41a7df){_0x2456ba[_0x5101('0xe')](_0x41a7df);});_0x5143ab['on'](_0x5101('0x12'),function(){_0x2456ba['send'](_0x5101('0x13'));});}catch(_0x32d16f){logger['error'](_0x5101('0x14'),JSON[_0x5101('0xf')](_0x32d16f));_0x2456ba[_0x5101('0x15')]();}}function _0x22c0f5(_0xcdd495){try{if(_0xcdd495){var _0x1c479f=JSON[_0x5101('0x16')](_0xcdd495);switch(_0x1c479f[_0x5101('0x17')]){case 0x0:if(_0x1c479f[_0x5101('0x18')]){if(_0x1c479f['result'][_0x5101('0x19')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x1c479f[_0x5101('0x18')][_0x5101('0x1a')]));_0x507b48=_0x1c479f['result'][_0x5101('0x1a')][0x0][_0x5101('0x1b')];_0x9e5ea3=_0x1c479f[_0x5101('0x18')][_0x5101('0x1a')][0x0][_0x5101('0x1c')];_0x46653f='0';_0x4ce471=_0x5101('0x1d');_0x2456ba[_0x5101('0x15')]();}}break;case 0x1:logger[_0x5101('0x5')](_0x5101('0x8'));_0x46653f='1';_0x4ce471='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x5101('0x1e'));_0x46653f='2';_0x4ce471=_0x5101('0x1e');break;case 0x9:logger[_0x5101('0x5')](_0x5101('0x1f'));_0x46653f='9';_0x4ce471=_0x5101('0x1f');break;case 0xa:logger['info'](_0x5101('0x20'));_0x46653f='10';_0x4ce471=_0x5101('0x20');break;case 0xb:logger[_0x5101('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x46653f='11';_0x4ce471=_0x5101('0x21');}}}catch(_0x38f5ea){logger[_0x5101('0x22')](_0x5101('0x23'),JSON[_0x5101('0xf')](_0x38f5ea));_0x2456ba[_0x5101('0x15')]();}}function _0x32b379(){logger[_0x5101('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x10ac6f({'transcript':_0x507b48,'confidence':_0x9e5ea3,'status':_0x46653f,'status_message':_0x4ce471});}function _0x57ac91(_0x31482c){logger['error'](_0x5101('0x24'));if(!_[_0x5101('0x25')](_0x31482c)){logger['error'](_[_0x5101('0x26')](_0x31482c)?JSON[_0x5101('0xf')](_0x31482c):_0x31482c);}}_0x2456ba['on'](_0x5101('0x27'),_0x527853);_0x2456ba['on'](_0x5101('0x28'),_0x22c0f5);_0x2456ba['on'](_0x5101('0x12'),_0x32b379);_0x2456ba['on']('error',_0x57ac91);});}; \ 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 bb8f515..ba28117 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 _0x1a0a=['exports'];(function(_0x370985,_0x55c00e){var _0x19e934=function(_0xa9aec7){while(--_0xa9aec7){_0x370985['push'](_0x370985['shift']());}};_0x19e934(++_0x55c00e);}(_0x1a0a,0x11c));var _0xa1a0=function(_0x186edd,_0x16afae){_0x186edd=_0x186edd-0x0;var _0x447af8=_0x1a0a[_0x186edd];return _0x447af8;};var asr=require('./asr');module[_0xa1a0('0x0')]={'asr':asr}; \ No newline at end of file +var _0x9838=['./asr','exports'];(function(_0x1f55f9,_0xf5c554){var _0x885614=function(_0x9747d3){while(--_0x9747d3){_0x1f55f9['push'](_0x1f55f9['shift']());}};_0x885614(++_0xf5c554);}(_0x9838,0xbc));var _0x8983=function(_0x2ef464,_0x33dbab){_0x2ef464=_0x2ef464-0x0;var _0x293f3e=_0x9838[_0x2ef464];return _0x293f3e;};var asr=require(_0x8983('0x0'));module[_0x8983('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ff3e3d4..8efd92b 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x3cf83e,_0x107ff4){var _0x131185=function(_0x1ea4e9){while(--_0x1ea4e9){_0x3cf83e['push'](_0x3cf83e['shift']());}};_0x131185(++_0x107ff4);}(_0x34e8,0x12c));var _0x834e=function(_0x31957b,_0xdaddab){_0x31957b=_0x31957b-0x0;var _0x5dd971=_0x34e8[_0x31957b];return _0x5dd971;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2291ac4..57eec5b 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 _0xa8a8=['forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','math\x20%s','isArray','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','replace','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSound','getSoundPath','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','clone','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','length','isString','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','options','exec','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','RECOG_CONFIDENCE()','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','variable_id','no\x20variable\x20found','keys'];(function(_0x55d391,_0x39c6d1){var _0x483a7c=function(_0x40c4fa){while(--_0x40c4fa){_0x55d391['push'](_0x55d391['shift']());}};_0x483a7c(++_0x39c6d1);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2301de,_0x214918){_0x2301de=_0x2301de-0x0;var _0x57be67=_0xa8a8[_0x2301de];return _0x57be67;};'use strict';var fs=require('fs');var util=require(_0x8a8a('0x0'));var _=require(_0x8a8a('0x1'));var sh=require(_0x8a8a('0x2'));var odbc=require(_0x8a8a('0x3'))();var rs=require('randomstring');var moment=require(_0x8a8a('0x4'));var Mustache=require(_0x8a8a('0x5'));var rp=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var scripts=require(_0x8a8a('0xa'));var FILES_PATH=_0x8a8a('0xb');var recursiveMapAttributes=[_0x8a8a('0xc'),_0x8a8a('0xd')];var verticesWithRetry=[_0x8a8a('0xe'),_0x8a8a('0xf'),_0x8a8a('0x10')];var AGIVertices=function(_0xecaa6f,_0x3287f5,_0x58a2f8){this['channel']=_0xecaa6f;this[_0x8a8a('0x11')]=_0x3287f5;this['mailRpc']=_0x58a2f8;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x13')]=function(_0x532621,_0x118380){this[_0x8a8a('0x11')][_0x8a8a('0x14')](_0x532621)['then'](function(_0x679da2){_0x118380(null,_0x679da2?_0x679da2[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x234481){_0x118380(_0x234481);});};AGIVertices['prototype'][_0x8a8a('0x17')]=function(_0x4e5d74,_0x25e1d5){this[_0x8a8a('0x11')][_0x8a8a('0x18')](_0x4e5d74)[_0x8a8a('0x19')](function(_0x2ac893){_0x25e1d5(null,_0x2ac893?_0x2ac893[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x51ce75){_0x25e1d5(_0x51ce75);});};AGIVertices[_0x8a8a('0x12')]['getSquareProject']=function(_0x1f36b6,_0x3046ae){this[_0x8a8a('0x11')][_0x8a8a('0x1a')](_0x1f36b6)[_0x8a8a('0x19')](function(_0x5dd616){_0x3046ae(null,_0x5dd616?_0x5dd616[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x262ca9){_0x3046ae(_0x262ca9);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1b')]=function(_0x22e611,_0x4d7a45){this['rpc']['getSquareOdbcById'](_0x22e611)['then'](function(_0x4a6601){_0x4d7a45(null,_0x4a6601?_0x4a6601[_0x8a8a('0x1c')]:![]);})[_0x8a8a('0x16')](function(_0xe0f449){_0x4d7a45(_0xe0f449);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1d')]=function(_0x2f6af2,_0x242bac){this[_0x8a8a('0x11')][_0x8a8a('0x1e')](_0x2f6af2)[_0x8a8a('0x19')](function(_0xb9db78){_0x242bac(null,_0xb9db78?_0xb9db78[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x625c1b){_0x242bac(_0x625c1b);});};AGIVertices[_0x8a8a('0x12')]['getTrunk']=function(_0x3c096f,_0x16c55b){this[_0x8a8a('0x11')][_0x8a8a('0x1f')](_0x3c096f)[_0x8a8a('0x19')](function(_0x251315){_0x16c55b(null,_0x251315?_0x251315[_0x8a8a('0x15')]:![]);})['catch'](function(_0x31d21a){_0x16c55b(_0x31d21a);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x20')]=function(_0x54ff7e,_0x58f42b){var _0x2dafcd=this;this[_0x8a8a('0x11')]['getSoundById'](_0x54ff7e)['then'](function(_0x4b3bc5){_0x58f42b(null,_0x4b3bc5?_0x2dafcd[_0x8a8a('0x21')](_0x4b3bc5['save_name']):![]);})[_0x8a8a('0x16')](function(_0xdd6221){_0x58f42b(_0xdd6221);});};AGIVertices['prototype'][_0x8a8a('0x22')]=function(_0x2c8f27,_0x250852){this[_0x8a8a('0x11')][_0x8a8a('0x23')](_0x2c8f27)[_0x8a8a('0x19')](function(_0x3e73b1){_0x250852(null,_0x3e73b1?_0x3e73b1:![]);})[_0x8a8a('0x16')](function(_0x5768a6){_0x250852(_0x5768a6);});};AGIVertices['prototype']['sendMailMessage']=function(_0x2a00a7,_0x3bf77d,_0x5f301e){this[_0x8a8a('0x24')][_0x8a8a('0x25')](_0x2a00a7,_0x3bf77d)['then'](function(){_0x5f301e(null);})[_0x8a8a('0x16')](function(_0x431b3a){_0x5f301e(_0x431b3a);});};AGIVertices[_0x8a8a('0x12')]['getIntervals']=function(_0x5bee53,_0x8457a0){this['rpc'][_0x8a8a('0x26')](_0x5bee53)[_0x8a8a('0x19')](function(_0x3ecbca){if(_0x3ecbca){if(_0x3ecbca[_0x8a8a('0x27')]){_0x8457a0(null,[_0x3ecbca[_0x8a8a('0x28')]]);}else{_0x8457a0(null,_[_0x8a8a('0x29')](_0x3ecbca[_0x8a8a('0x2a')],_0x8a8a('0x28')));}}else{_0x8457a0(null,![]);}})[_0x8a8a('0x16')](function(_0xf7d4d7){_0x8457a0(_0xf7d4d7);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x21')]=function(_0x17a36c){return util[_0x8a8a('0x2b')](_0x8a8a('0x2c'),FILES_PATH,_0x17a36c);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x2d')]=function(_0x29d187,_0x4c8003,_0x4cc605){odbc['open'](_0x29d187,function(_0x34db33){if(_0x34db33){logger[_0x8a8a('0x2e')](_0x8a8a('0x2f'),_0x34db33);_0x4cc605(_0x34db33);}else{logger[_0x8a8a('0x30')](_0x8a8a('0x31'));odbc['query'](_0x4c8003,function(_0x4ee92e,_0x8d8481){if(_0x4ee92e){logger['info'](_0x8a8a('0x32'),_0x4c8003);_0x4cc605(_0x4ee92e);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x4c8003);odbc[_0x8a8a('0x33')](function(_0x1ac761){if(_0x1ac761){logger[_0x8a8a('0x2e')](_0x8a8a('0x34'),_0x1ac761);}_0x4cc605(null,_0x8d8481);});}});}});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x35')]=function(_0x20584a,_0x503989){this[_0x8a8a('0x11')][_0x8a8a('0x36')](_0x20584a)[_0x8a8a('0x19')](function(_0x53f66e){_0x503989(null,_0x53f66e?_0x53f66e:![]);})[_0x8a8a('0x16')](function(_0x323f89){_0x503989(_0x323f89);});};AGIVertices[_0x8a8a('0x12')]['createSmsMessage']=function(_0x3fda48,_0x7a37ae){this[_0x8a8a('0x11')][_0x8a8a('0x37')](_0x3fda48)[_0x8a8a('0x19')](function(_0x3e5b15){_0x7a37ae(null,_0x3e5b15);})['catch'](function(_0x4fe325){_0x7a37ae(_0x4fe325);});};AGIVertices[_0x8a8a('0x12')]['createSquareDetailsReport']=function(_0x13e0d4,_0x1aa8b5,_0x5151f8){this['rpc'][_0x8a8a('0x38')]({'uniqueid':this[_0x8a8a('0x39')][_0x8a8a('0x3a')],'node':_0x13e0d4[_0x8a8a('0x3b')],'application':_0x13e0d4['agicommand'],'data':_0x1aa8b5||null,'project_name':this[_0x8a8a('0x39')]['arg_1'],'callerid':this[_0x8a8a('0x39')][_0x8a8a('0x3c')]})['then'](function(_0x3b5f93){if(_0x5151f8){_0x5151f8(null,_0x3b5f93);}})[_0x8a8a('0x16')](function(_0x2836de){if(_0x5151f8){_0x5151f8(_0x2836de);}});};AGIVertices['prototype'][_0x8a8a('0x3d')]=function(_0x3a6b97,_0x35683e,_0x4ad0ad,_0x5466d4){this[_0x8a8a('0x11')][_0x8a8a('0x3d')]({'uniqueid':this[_0x8a8a('0x39')]['uniqueid'],'callerid':this[_0x8a8a('0x39')][_0x8a8a('0x3c')],'calleridname':this[_0x8a8a('0x39')][_0x8a8a('0x3e')],'context':this[_0x8a8a('0x39')][_0x8a8a('0x3f')],'extension':this[_0x8a8a('0x39')][_0x8a8a('0x40')],'priority':this[_0x8a8a('0x39')][_0x8a8a('0x41')],'accountcode':this[_0x8a8a('0x39')]['accountcode'],'dnid':this[_0x8a8a('0x39')][_0x8a8a('0x42')],'projectName':this[_0x8a8a('0x39')][_0x8a8a('0x43')],'saveName':_0x35683e,'filename':_0x3a6b97[_0x8a8a('0x44')]||_0x35683e,'savePath':_0x4ad0ad})[_0x8a8a('0x19')](function(_0x565a49){_0x5466d4(null,_0x565a49);})[_0x8a8a('0x16')](function(_0x396ffd){_0x5466d4(_0x396ffd);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x45')]=function(_0x494df8,_0x1faad3,_0x3333ff,_0x44e00c,_0x5220c0){this['rpc'][_0x8a8a('0x45')]({'uniqueid':this[_0x8a8a('0x39')][_0x8a8a('0x3a')],'body':_0x494df8,'direction':_0x1faad3,'providerName':_0x3333ff,'providerResponse':_0x44e00c})[_0x8a8a('0x19')](function(_0x393a4a){if(_0x5220c0){_0x5220c0(null,_0x393a4a);}})[_0x8a8a('0x16')](function(_0x1d1b5c){if(_0x5220c0){_0x5220c0(_0x1d1b5c);}});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x46')]=function(_0x4ab312,_0x4c1f1a){this[_0x8a8a('0x11')][_0x8a8a('0x46')]({'firstName':_['isEmpty'](_0x4ab312['name'])||_[_0x8a8a('0x47')](_0x4ab312['name'])?_0x8a8a('0x48')+Math['random']():_0x4ab312[_0x8a8a('0x15')],'lastName':_[_0x8a8a('0x49')](_0x4ab312[_0x8a8a('0x4a')])||_[_0x8a8a('0x47')](_0x4ab312[_0x8a8a('0x4a')])?null:_0x4ab312[_0x8a8a('0x4a')],'phone':_0x4ab312[_0x8a8a('0x4b')],'ListId':_0x4ab312[_0x8a8a('0x4c')],'scheduledat':_0x4ab312[_0x8a8a('0x4d')],'callbackUniqueid':this[_0x8a8a('0x39')]['uniqueid'],'tags':_0x8a8a('0x4e'),'description':_0x8a8a('0x4f')+_0x4ab312[_0x8a8a('0x4d')][_0x8a8a('0x50')](),'priority':_0x4ab312[_0x8a8a('0x51')]})['then'](function(_0x428d57){_0x4c1f1a(null,_0x428d57);})[_0x8a8a('0x16')](function(_0x4da3f9){_0x4c1f1a(_0x4da3f9);});};AGIVertices['prototype'][_0x8a8a('0x52')]=function(_0x3c3f3d,_0x322b4c){this[_0x8a8a('0x11')][_0x8a8a('0x53')](_0x3c3f3d)[_0x8a8a('0x19')](function(_0x5ed59c){_0x322b4c(null,_0x5ed59c?_0x5ed59c['name']:![]);})['catch'](function(_0x414aa4){_0x322b4c(_0x414aa4);});};AGIVertices['prototype'][_0x8a8a('0x54')]=function(_0xb84ee7,_0x4e1ca8,_0x225801){var _0x38ba9f={'role':_0x8a8a('0x55')};_0x38ba9f[_0xb84ee7]=this[_0x8a8a('0x39')]['callerid'];this[_0x8a8a('0x11')]['agentPause'](_0x38ba9f,_0x4e1ca8,this[_0x8a8a('0x39')][_0x8a8a('0x3a')])['then'](function(_0x254e4c){_0x225801(null,_[_0x8a8a('0x47')](_0x254e4c)?![]:!![]);})[_0x8a8a('0x16')](function(_0x183015){logger['error'](_0x183015);_0x225801(null,![]);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x56')]=function(_0x46c03d,_0x5b029e){var _0x4fe07d={'role':_0x8a8a('0x55')};_0x4fe07d[_0x46c03d]=this['channel']['callerid'];this['rpc'][_0x8a8a('0x56')](_0x4fe07d)[_0x8a8a('0x19')](function(_0x5bdbd3){_0x5b029e(null,_[_0x8a8a('0x47')](_0x5bdbd3)?![]:!![]);})['catch'](function(_0x4aa202){logger[_0x8a8a('0x2e')](_0x4aa202);_0x5b029e(null,![]);});};AGIVertices[_0x8a8a('0x12')]['agentLogout']=function(_0x44d150,_0x184e96){var _0x45097b={'role':_0x8a8a('0x55')};_0x45097b[_0x44d150]=this[_0x8a8a('0x39')][_0x8a8a('0x3c')];this['rpc'][_0x8a8a('0x57')](_0x45097b)[_0x8a8a('0x19')](function(_0x587ea8){_0x184e96(null,_[_0x8a8a('0x47')](_0x587ea8)?![]:!![]);})[_0x8a8a('0x16')](function(_0x1d0300){logger[_0x8a8a('0x2e')](_0x1d0300);_0x184e96(null,![]);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x58')]=function(_0x81c1dd,_0x34a079){var _0x331979={'role':_0x8a8a('0x55')};_0x331979[_0x81c1dd]=this['channel'][_0x8a8a('0x3c')];var _0x2f7537=_0x81c1dd!='internal'?util[_0x8a8a('0x2b')](_0x8a8a('0x59'),_0x8a8a('0x5a'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')]):undefined;this['rpc'][_0x8a8a('0x58')](_0x331979,_0x2f7537)[_0x8a8a('0x19')](function(_0x3edc54){_0x34a079(null,_[_0x8a8a('0x47')](_0x3edc54)?![]:!![]);})[_0x8a8a('0x16')](function(_0x224ec2){logger[_0x8a8a('0x2e')](_0x224ec2);_0x34a079(null,![]);});};AGIVertices['prototype'][_0x8a8a('0x5b')]=function(_0x260a6b,_0x35ed30){sh['exec'](_[_0x8a8a('0x5c')](_0x260a6b),function(_0x54c7c1,_0x15b2e7){var _0x27a8bc=_0x15b2e7['replace'](/(\r\n|\n|\r)/gm,'');_0x35ed30(null,_0x27a8bc);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x5d')]=function(_0x2449a9,_0x25ec2f){scripts[_0x8a8a('0x5d')](_0x2449a9[_0x8a8a('0x5e')],_0x2449a9[_0x8a8a('0x5f')]||_0x8a8a('0x60'),_0x2449a9[_0x8a8a('0x60')],_0x2449a9[_0x8a8a('0x61')]||_0x8a8a('0x62'),_0x2449a9[_0x8a8a('0x63')]||_0x8a8a('0x64'),_0x2449a9[_0x8a8a('0x65')]||_0x8a8a('0x66'))[_0x8a8a('0x19')](function(_0xb703d1){_0x25ec2f(null,_0xb703d1);})[_0x8a8a('0x16')](function(_0x4fc451){_0x25ec2f(_0x4fc451);});};AGIVertices[_0x8a8a('0x12')]['googleTTS']=function(_0x33f5c8,_0x45d20f){scripts[_0x8a8a('0x67')](_0x33f5c8['text'],_0x33f5c8['google_tts_language']||'en',0x1)[_0x8a8a('0x19')](function(_0x428b99){_0x45d20f(null,_0x428b99);})[_0x8a8a('0x16')](function(_0x4b3db2){_0x45d20f(_0x4b3db2);});};AGIVertices['prototype'][_0x8a8a('0x68')]=function(_0x17514e,_0x46a556){var _0x155cc4={'uri':_0x17514e[_0x8a8a('0x69')],'method':_0x17514e[_0x8a8a('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x17514e[_0x8a8a('0x6b')])===_0x8a8a('0x6c')&&parseInt(_0x17514e['timeout'])>=0x1?parseInt(_0x17514e[_0x8a8a('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x8a8a('0x6d')](['POST',_0x8a8a('0x6e')],_0x155cc4[_0x8a8a('0x6a')][_0x8a8a('0x6f')]())){try{_0x155cc4[_0x8a8a('0x70')]=_0x17514e[_0x8a8a('0xd')]?JSON[_0x8a8a('0x71')](_0x17514e['rawBody']):{};}catch(_0x2924a4){logger[_0x8a8a('0x2e')](_0x8a8a('0x72'),_0x2924a4);}}try{_0x155cc4[_0x8a8a('0x73')]=_0x17514e[_0x8a8a('0xc')]?JSON['parse'](_0x17514e[_0x8a8a('0xc')]):{};}catch(_0x430c83){logger[_0x8a8a('0x2e')](_0x8a8a('0x74'),_0x430c83);}if(_0x17514e[_0x8a8a('0x75')]){try{var _0x16ced2=require(_0x17514e[_0x8a8a('0x75')])[_0x8a8a('0x76')](this,_0x155cc4);_0x155cc4[_0x8a8a('0x77')]=Mustache[_0x8a8a('0x78')](_0x17514e['url'],_0x16ced2,{},['$$','$$']);if(_0x155cc4[_0x8a8a('0x73')]){_0x155cc4[_0x8a8a('0x73')]=JSON[_0x8a8a('0x71')](Mustache[_0x8a8a('0x78')](JSON[_0x8a8a('0x79')](_0x155cc4['headers']),_0x16ced2,{},['$$','$$']));}if(_0x155cc4['body']){_0x155cc4[_0x8a8a('0x70')]=JSON[_0x8a8a('0x71')](Mustache[_0x8a8a('0x78')](JSON['stringify'](_0x155cc4[_0x8a8a('0x70')]),_0x16ced2,{},['$$','$$']));}}catch(_0x312350){logger[_0x8a8a('0x2e')](_0x8a8a('0x7a'),_0x312350);}}rp(_0x155cc4)['then'](function(_0x13504b){var _0x90bb92={'statusCode':_0x13504b[_0x8a8a('0x7b')]||0xc8,'statusMessage':_0x13504b['statusMessage']||'OK','headers':_0x13504b['headers']||{},'body':_0x13504b['body']||{}};_0x46a556(null,_0x90bb92);})[_0x8a8a('0x16')](function(_0x57f22c){var _0x20540c={'statusCode':_0x57f22c['statusCode']||0x1f4,'statusMessage':_0x57f22c['message']||_0x8a8a('0x7c'),'headers':_0x57f22c['options']['headers']||{},'body':_0x57f22c['options'][_0x8a8a('0x70')]||{}};_0x46a556(null,_0x20540c);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1d4823,_0x482fa4){scripts[_0x8a8a('0x7d')](this['channel'][_0x8a8a('0x3a')],_0x1d4823[_0x8a8a('0x7e')],_0x1d4823[_0x8a8a('0x60')],_0x1d4823[_0x8a8a('0x7f')]||'en')['then'](function(_0x1b5553){_0x482fa4(null,_0x1b5553);})[_0x8a8a('0x16')](function(_0x485cc4){_0x482fa4(_0x485cc4);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x80')]=function(_0x913e4c,_0x468669){scripts['googleDialogflowV2'](this['channel'][_0x8a8a('0x3a')],_0x913e4c[_0x8a8a('0x81')],_0x913e4c[_0x8a8a('0x82')],_0x913e4c['private_key'],_0x913e4c[_0x8a8a('0x60')],_0x913e4c[_0x8a8a('0x83')]||'en')[_0x8a8a('0x19')](function(_0x4acabe){_0x468669(null,_0x4acabe);})[_0x8a8a('0x16')](function(_0x3070ce){_0x468669(_0x3070ce);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x84')]=function(_0x277bd6,_0x5e3b50){scripts[_0x8a8a('0x84')](this[_0x8a8a('0x39')],_0x277bd6)[_0x8a8a('0x19')](function(_0x161c44){_0x5e3b50(null,_0x161c44);})[_0x8a8a('0x16')](function(_0x208c11){_0x5e3b50(_0x208c11);});};AGIVertices[_0x8a8a('0x12')]['ispeechTTS']=function(_0x586abb,_0xe8ce42){scripts[_0x8a8a('0x85')](_0x586abb[_0x8a8a('0x7e')],_0x586abb['text'],_0x586abb[_0x8a8a('0x86')]||_0x8a8a('0x62'),_0x586abb[_0x8a8a('0x87')])[_0x8a8a('0x19')](function(_0x3f9669){_0xe8ce42(null,_0x3f9669);})[_0x8a8a('0x16')](function(_0x3a0e27){_0xe8ce42(_0x3a0e27);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x88')]=function(_0xae3b7a,_0x5e9ecb,_0x217e95){scripts[_0x8a8a('0x88')](_0x5e9ecb,_0xae3b7a[_0x8a8a('0x7e')],_0xae3b7a['ispeech_asr_language']||_0x8a8a('0x62'),this[_0x8a8a('0x89')](_0xae3b7a[_0x8a8a('0x8a')])?_0xae3b7a['model']:undefined)['then'](function(_0x1f409b){_0x217e95(null,_0x1f409b);})[_0x8a8a('0x16')](function(_0x2319a4){_0x217e95(_0x2319a4);});};AGIVertices[_0x8a8a('0x12')]['awsPolly']=function(_0x2fa27b,_0x368294){scripts[_0x8a8a('0x8b')](_0x2fa27b[_0x8a8a('0x8c')],_0x2fa27b['aws_secret_access_key'],_0x2fa27b['aws_polly_region'],_0x2fa27b[_0x8a8a('0x8d')]||_0x8a8a('0x8e'),_0x2fa27b[_0x8a8a('0x60')],_0x2fa27b['aws_text_type']||_0x8a8a('0x60'))[_0x8a8a('0x19')](function(_0x2affff){_0x368294(null,_0x2affff);})[_0x8a8a('0x16')](function(_0x31f2e6){_0x368294(_0x31f2e6);});};AGIVertices['prototype'][_0x8a8a('0x8f')]=function(_0x5d727e,_0x239be1){scripts[_0x8a8a('0x8f')](this[_0x8a8a('0x39')][_0x8a8a('0x3a')],_0x5d727e[_0x8a8a('0x8c')],_0x5d727e[_0x8a8a('0x90')],_0x5d727e['aws_lex_region'],_0x5d727e[_0x8a8a('0x60')],_0x5d727e[_0x8a8a('0x91')])['then'](function(_0x5b4fa9){_0x239be1(null,_0x5b4fa9);})[_0x8a8a('0x16')](function(_0x15eb58){_0x239be1(_0x15eb58);});};AGIVertices['prototype'][_0x8a8a('0x92')]=function(_0x5c4e71,_0x4a774d,_0x2ca0ce){scripts[_0x8a8a('0x92')](_0x4a774d,_0x5c4e71[_0x8a8a('0x7e')],_0x5c4e71['google_asr_language']||_0x8a8a('0x62'))[_0x8a8a('0x19')](function(_0x86cab6){_0x2ca0ce(null,_0x86cab6);})[_0x8a8a('0x16')](function(_0x232ab9){_0x2ca0ce(_0x232ab9);});};AGIVertices[_0x8a8a('0x12')]['tildeASR']=function(_0x595809,_0x482cce,_0x24798d){scripts[_0x8a8a('0x93')](_0x482cce,_0x595809[_0x8a8a('0x94')],_0x595809[_0x8a8a('0x95')],_0x595809[_0x8a8a('0x77')])[_0x8a8a('0x19')](function(_0x29627c){_0x24798d(null,_0x29627c);})[_0x8a8a('0x16')](function(_0x3afd87){_0x24798d(_0x3afd87);});};AGIVertices['prototype'][_0x8a8a('0x96')]=function(_0x41180e){var _0x2f3fb5=_[_0x8a8a('0x6d')](verticesWithRetry,_0x41180e[_0x8a8a('0x97')])?_0x41180e:_[_0x8a8a('0x98')](_0x41180e);for(var _0x514522 in _0x2f3fb5){if(_0x2f3fb5['hasOwnProperty'](_0x514522)){if(_0x2f3fb5[_0x514522]&&_['isString'](_0x2f3fb5[_0x514522])){if(_[_0x8a8a('0x6d')](recursiveMapAttributes,_0x514522)){_0x2f3fb5[_0x514522]=this['replaceObjectAllVariables'](_0x2f3fb5[_0x514522]);}else{_0x2f3fb5[_0x514522]=this[_0x8a8a('0x99')](_0x2f3fb5[_0x514522]);}}}}return _0x2f3fb5;};AGIVertices['prototype'][_0x8a8a('0x9a')]=function(_0x48922c){for(var _0x1f1c12 in _0x48922c){if(_0x48922c[_0x8a8a('0x9b')](_0x1f1c12)){if(_['isPlainObject'](_0x48922c[_0x1f1c12])){this[_0x8a8a('0x9a')](_0x48922c[_0x1f1c12]);}else if(_['isArray'](_0x48922c[_0x1f1c12])){for(var _0x48c4a8=0x0;_0x48c4a8<_0x48922c[_0x1f1c12][_0x8a8a('0x9c')];_0x48c4a8++){this['recursiveNodeIndex'](_0x48922c[_0x1f1c12][_0x48c4a8]);}}else if(_[_0x8a8a('0x9d')](_0x48922c[_0x1f1c12])){_0x48922c[_0x1f1c12]=this['replaceAllVariables'](_0x48922c[_0x1f1c12]);}}}};AGIVertices[_0x8a8a('0x12')]['saveRestApiResult']=function(_0x34aa82,_0x41cb65){for(var _0x2ac5c1 in _0x34aa82){if(_0x34aa82[_0x8a8a('0x9b')](_0x2ac5c1)){if(_['isPlainObject'](_0x34aa82[_0x2ac5c1])){if(!_[_0x8a8a('0x49')](_0x34aa82[_0x2ac5c1])){this[_0x8a8a('0x9e')](_0x34aa82[_0x2ac5c1],util[_0x8a8a('0x2b')](_0x8a8a('0x9f'),_0x41cb65,_0x2ac5c1));}}else if(_['isArray'](_0x34aa82[_0x2ac5c1])){for(var _0x19804c=0x0;_0x19804c<_0x34aa82[_0x2ac5c1][_0x8a8a('0x9c')];_0x19804c++){this[_0x8a8a('0x9e')](_0x34aa82[_0x2ac5c1][_0x19804c],util['format'](_0x8a8a('0x9f'),_0x41cb65,_0x2ac5c1+'['+_0x19804c+']'));}}else{if(!_[_0x8a8a('0x47')](_0x34aa82[_0x2ac5c1])){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')]('%s.%s',_0x41cb65,_0x2ac5c1),_0x34aa82[_0x2ac5c1]);}}}}};AGIVertices['prototype'][_0x8a8a('0xa1')]=function(_0x2dd542){try{var _0x372891=JSON['parse'](_0x2dd542);this[_0x8a8a('0x9a')](_0x372891);return JSON[_0x8a8a('0x79')](_0x372891);}catch(_0x559f13){return this['replaceAllVariables'](_0x2dd542);}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x99')]=function(_0x144e48){var _0x55a1b1=_0x144e48[_0x8a8a('0xa2')]('{');for(var _0x2f3aa6=0x1;_0x2f3aa6<_0x55a1b1['length'];_0x2f3aa6+=0x1){var _0x313eac=_0x55a1b1[_0x2f3aa6][_0x8a8a('0xa2')]('}');if(_0x313eac['length']>0x1){_0x144e48=_0x144e48[_0x8a8a('0xa3')]('{'+_0x313eac[0x0]+'}',this['channel'][_0x8a8a('0x13')](_0x313eac[0x0])[_0x8a8a('0xa4')]||_0x313eac[0x0]);}}if(_0x55a1b1['length']===0x1){return _0x144e48[_0x8a8a('0x50')]();}return this[_0x8a8a('0x99')](_0x144e48);};AGIVertices['prototype'][_0x8a8a('0xa5')]=function(_0x50a788,_0x226094){var _0x444cbe=this['channel'][_0x8a8a('0x13')](_0x50a788);if(_0x444cbe[_0x8a8a('0xa6')]===-0x1){return _0x444cbe;}logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0xa7'),_0x226094,_0x444cbe['extra']));return this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x226094,_0x444cbe[_0x8a8a('0xa4')]);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x89')]=function(_0x54ad37){return _0x54ad37&&_0x54ad37!=='0'&&_0x54ad37!=='-1'&&_0x54ad37!=='';};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xa8')]=function(_0x4f9c61){this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x4f9c61,'-');_0x4f9c61[_0x8a8a('0xa9')]=_0x4f9c61['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x8a8a('0xaa')]=function(_0x1cb3aa){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xab'),_0x1cb3aa[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1cb3aa['text'])){return this['channel']['noop'](_0x8a8a('0xac'));}var _0x24c56f='\x22'+_0x1cb3aa[_0x8a8a('0x60')]+'\x22';if(this['isConfigured'](_0x1cb3aa[_0x8a8a('0xad')])){_0x24c56f+=','+_0x1cb3aa[_0x8a8a('0xad')];}var _0x39d705=this[_0x8a8a('0x39')][_0x8a8a('0xae')]('MRCPSynth',_0x24c56f);if(_0x39d705[_0x8a8a('0xa6')]===-0x1){return _0x39d705;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xb0'),_0x24c56f));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xb1')]=function(_0x541c4b){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0xb2'),_0x541c4b[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x541c4b[_0x8a8a('0xb3')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0xb4'));}var _0x79c5d8=_0x541c4b['grammar'];if(this[_0x8a8a('0x89')](_0x541c4b['options'])){_0x79c5d8+=','+_0x541c4b['options'];}var _0x2a8210=this[_0x8a8a('0x39')]['exec']('MRCPRecog',_0x79c5d8);if(_0x2a8210['result']===-0x1){return _0x2a8210;}var _0x43757f=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x8a8a('0xb5'));if(_0x43757f[_0x8a8a('0xa6')]===-0x1){return _0x43757f;}var _0x58ac24=this[_0x8a8a('0xa5')](_0x8a8a('0xb6'),_0x8a8a('0xb7'));if(_0x58ac24[_0x8a8a('0xa6')]===-0x1){return _0x58ac24;}var _0x46b408=this['getAndSetVariable'](_0x8a8a('0xb8'),'MRCP_RECOG_INSTANCE');if(_0x46b408[_0x8a8a('0xa6')]===-0x1){return _0x46b408;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x79c5d8));};AGIVertices['prototype'][_0x8a8a('0x8')]=function(_0x390e6f){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0xb9'),_0x390e6f['label']));return this[_0x8a8a('0x39')][_0x8a8a('0x8')]([_0x390e6f[_0x8a8a('0xba')],_0x390e6f['args']]);};AGIVertices['prototype'][_0x8a8a('0xbb')]=function(_0x4d9d70){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0xbc'),_0x4d9d70['label']));if(this['isConfigured'](_0x4d9d70['timeout'])){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0xbd'),_0x4d9d70[_0x8a8a('0x6b')]));var _0x5d955f=this[_0x8a8a('0x39')][_0x8a8a('0xbe')](_0x4d9d70[_0x8a8a('0x6b')]);if(_0x5d955f[_0x8a8a('0xa6')]===-0x1){return _0x5d955f;}}return this[_0x8a8a('0x39')][_0x8a8a('0xbb')]();};AGIVertices[_0x8a8a('0x12')]['callback']=function(_0x4df369){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xbf'),_0x4df369['label']));if(!this[_0x8a8a('0x89')](_0x4df369[_0x8a8a('0x4c')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x4df369,'no\x20list\x20selected');}_0x4df369['scheduledAt']=moment();if(this[_0x8a8a('0x89')](_0x4df369[_0x8a8a('0xc0')])){_0x4df369[_0x8a8a('0x4d')]=moment()[_0x8a8a('0xc1')](_0x4df369[_0x8a8a('0xc0')],_0x8a8a('0xc2'));}if(!this[_0x8a8a('0x89')](_0x4df369[_0x8a8a('0x51')])){_0x4df369[_0x8a8a('0x51')]=0x2;}this[_0x8a8a('0x46')][_0x8a8a('0x76')](this,_0x4df369);return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc3'),_0x4df369[_0x8a8a('0x4b')],_0x4df369[_0x8a8a('0x4c')],_0x4df369[_0x8a8a('0x4d')]));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xc4')]=function(_0x39f201){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x39f201[_0x8a8a('0x3b')]));var _0x211dfc=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x39f201['application'],_0x39f201[_0x8a8a('0xad')]);if(_0x211dfc[_0x8a8a('0xa6')]===-0x1){return _0x211dfc;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x39f201['application'],_0x39f201[_0x8a8a('0xad')]));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xc6')]=function(_0x3e2fe8){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xc7'),_0x3e2fe8[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x3e2fe8[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}var _0x140f63='\x22'+_0x3e2fe8[_0x8a8a('0x60')]+'\x22';if(this[_0x8a8a('0x89')](_0x3e2fe8[_0x8a8a('0xad')])){_0x140f63+=','+_0x3e2fe8[_0x8a8a('0xad')];}var _0x53bf85=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xc8'),_0x140f63);if(_0x53bf85[_0x8a8a('0xa6')]===-0x1){return _0x53bf85;}return this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xb0'),_0x140f63));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xc9')]=function(_0x3e8d6f){logger['info'](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3e8d6f[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3e8d6f[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}var _0x4d9461='\x22'+_0x3e8d6f[_0x8a8a('0x60')]+'\x22';if(this[_0x8a8a('0x89')](_0x3e8d6f[_0x8a8a('0xad')])){_0x4d9461+=','+_0x3e8d6f['options'];}var _0x421d3a=this[_0x8a8a('0x39')][_0x8a8a('0xae')]('MRCPSynth',_0x4d9461);if(_0x421d3a[_0x8a8a('0xa6')]===-0x1){return _0x421d3a;}return this[_0x8a8a('0x39')]['noop'](util['format'](_0x8a8a('0xb0'),_0x4d9461));};AGIVertices['prototype']['lumenvoxasr']=function(_0x54ce27){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xca'),_0x54ce27[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x54ce27[_0x8a8a('0xb3')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xb4'));}var _0x4fe68d=_0x54ce27[_0x8a8a('0xb3')];if(this[_0x8a8a('0x89')](_0x54ce27['options'])){_0x4fe68d+=','+_0x54ce27[_0x8a8a('0xad')];}var _0x14cc59=this['channel'][_0x8a8a('0xae')](_0x8a8a('0xcb'),_0x4fe68d);if(_0x14cc59[_0x8a8a('0xa6')]===-0x1){return _0x14cc59;}var _0x5ac2e2=this[_0x8a8a('0xa5')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5ac2e2[_0x8a8a('0xa6')]===-0x1){return _0x5ac2e2;}var _0x4684ca=this['getAndSetVariable'](_0x8a8a('0xb6'),_0x8a8a('0xcc'));if(_0x4684ca[_0x8a8a('0xa6')]===-0x1){return _0x4684ca;}var _0x188109=this[_0x8a8a('0xa5')](_0x8a8a('0xb8'),_0x8a8a('0xcd'));if(_0x188109[_0x8a8a('0xa6')]===-0x1){return _0x188109;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xce'),_0x4fe68d));};AGIVertices[_0x8a8a('0x12')]['sestekasr']=function(_0x36ddee){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x36ddee[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x36ddee[_0x8a8a('0xb3')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xb4'));}var _0x13890f=_0x36ddee[_0x8a8a('0xb3')];if(this[_0x8a8a('0x89')](_0x36ddee[_0x8a8a('0xad')])){_0x13890f+=','+_0x36ddee[_0x8a8a('0xad')];}var _0x5c9358=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xcb'),_0x13890f);if(_0x5c9358[_0x8a8a('0xa6')]===-0x1){return _0x5c9358;}var _0x2562cf=this[_0x8a8a('0xa5')](_0x8a8a('0xcf'),'SESTEK_ASR_CONFIDENCE');if(_0x2562cf[_0x8a8a('0xa6')]===-0x1){return _0x2562cf;}var _0x1180fd=this['getAndSetVariable'](_0x8a8a('0xb6'),'SESTEK_ASR_TRANSCRIPT');if(_0x1180fd[_0x8a8a('0xa6')]===-0x1){return _0x1180fd;}var _0x680d70=this['getAndSetVariable'](_0x8a8a('0xb8'),_0x8a8a('0xd0'));if(_0x680d70['result']===-0x1){return _0x680d70;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xce'),_0x13890f));};AGIVertices['prototype'][_0x8a8a('0xd1')]=function(_0x148b86){logger[_0x8a8a('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x148b86[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x148b86[_0x8a8a('0xd2')])){return this['channel']['error'](_0x148b86,_0x8a8a('0xd3'));}var _0x496c28=this['getSquareOdbc'][_0x8a8a('0x76')](this,_0x148b86[_0x8a8a('0xd2')]);if(!_0x496c28){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x148b86,_0x8a8a('0xd4'));}if(!this['isConfigured'](_0x148b86[_0x8a8a('0xd5')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x148b86,'no\x20query\x20configured');}var _0x3e63d4=_0x148b86['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8a8a('0xaf')](util['format']('query:\x20%s',_0x3e63d4));var _0x484cc6=this[_0x8a8a('0x2d')][_0x8a8a('0x76')](this,_0x496c28,_0x3e63d4);this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x148b86,_0x3e63d4);if(!this['isConfigured'](_0x148b86[_0x8a8a('0xd6')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x186c2c=this['getVariable']['sync'](this,_0x148b86[_0x8a8a('0xd6')]);if(!_0x186c2c){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x148b86,_0x8a8a('0xd7'));}var _0xe5a7a1=this;_0x484cc6['forEach'](function(_0x268d50,_0x33e008){Object[_0x8a8a('0xd8')](_0x268d50)[_0x8a8a('0xd9')](function(_0x18b99c){_0xe5a7a1[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0xda'),_0x186c2c,_0x33e008,_0x18b99c),_0x268d50[_0x18b99c]);});});this['channel'][_0x8a8a('0xa0')](util['format'](_0x8a8a('0xdb'),_0x186c2c),_0x484cc6[_0x8a8a('0x9c')]);return this['channel']['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xdc'),_0x186c2c));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xdd')]=function(_0x1ddc95){logger[_0x8a8a('0xde')](util[_0x8a8a('0x2b')](_0x8a8a('0xdf'),_0x1ddc95[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1ddc95[_0x8a8a('0xe0')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1ddc95,'no\x20user\x20selected');}var _0x14fee6=this[_0x8a8a('0x1d')][_0x8a8a('0x76')](this,_0x1ddc95[_0x8a8a('0xe0')]);if(!_0x14fee6){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1ddc95,_0x8a8a('0xe1'));}var _0x43445a=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xe2'),[util[_0x8a8a('0x2b')](_0x8a8a('0xe3'),_0x14fee6),_0x1ddc95[_0x8a8a('0x6b')],_0x1ddc95[_0x8a8a('0xe4')],_0x1ddc95[_0x8a8a('0x69')]]);if(_0x43445a[_0x8a8a('0xa6')]===-0x1){return _0x43445a;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xe5'),_0x8a8a('0xe2')));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xe6')]=function(_0x3f064c){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xe7'),_0x3f064c[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3f064c[_0x8a8a('0x7e')])){return this['channel']['noop'](_0x8a8a('0xe8'));}if(!this['isConfigured'](_0x3f064c[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this['channel'][_0x8a8a('0xe9')]=!![];this[_0x8a8a('0x38')](_0x3f064c);this[_0x8a8a('0x45')](_0x3f064c[_0x8a8a('0x60')],'in','','');this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xea'),_0x3f064c[_0x8a8a('0x60')]));var _0x9415d6=this[_0x8a8a('0x7d')]['sync'](this,_0x3f064c);if(_0x9415d6){for(var _0x1c4d94 in _0x9415d6){if(_0x9415d6[_0x8a8a('0x9b')](_0x1c4d94)){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0xeb'),_0x1c4d94[_0x8a8a('0x6f')]()),_0x9415d6[_0x1c4d94]);}}this[_0x8a8a('0x45')](_0x9415d6[_0x8a8a('0xec')],_0x8a8a('0xed'),_0x8a8a('0xe6'),'');return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xee'),_0x9415d6[_0x8a8a('0xec')]));}return this[_0x8a8a('0x39')]['error'](_0x3f064c,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xef')]=function(_0x37d14e){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x37d14e[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0x81')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xf0'));}if(!this[_0x8a8a('0x89')](_0x37d14e['client_email'])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xf1'));}if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0xf2')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xf3'));}if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0x83')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0xf4'));}if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20text\x20configured');}this['channel'][_0x8a8a('0xe9')]=!![];this[_0x8a8a('0x38')](_0x37d14e);this['createSquareMessage'](_0x37d14e[_0x8a8a('0x60')],'in','','');this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xf5'),_0x37d14e[_0x8a8a('0x60')]));var _0x17d76c=this['googleDialogflowV2'][_0x8a8a('0x76')](this,_0x37d14e);if(_0x17d76c){for(var _0x37de79 in _0x17d76c){if(_0x17d76c[_0x8a8a('0x9b')](_0x37de79)){if(_0x37de79!==_0x8a8a('0xf6')){this['channel'][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')]('DIALOGFLOW_%s',_0x37de79[_0x8a8a('0x6f')]()),_0x17d76c[_0x37de79]);}}}this[_0x8a8a('0x45')](_0x17d76c[_0x8a8a('0xec')],_0x8a8a('0xed'),_0x8a8a('0xef'),_0x17d76c[_0x8a8a('0xf6')]);return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xf7'),_0x17d76c[_0x8a8a('0xec')]));}return this[_0x8a8a('0x39')]['error'](_0x37d14e,_0x8a8a('0xf8'));};AGIVertices['prototype'][_0x8a8a('0xf9')]=function(_0x4b334b){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xfa'),_0x4b334b[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x4b334b[_0x8a8a('0xfb')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xfc'));}if(!this[_0x8a8a('0x89')](_0x4b334b[_0x8a8a('0xfd')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xfe'));}if(!this[_0x8a8a('0x89')](_0x4b334b['password'])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xff'));}if(!this[_0x8a8a('0x89')](_0x4b334b[_0x8a8a('0x100')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xe9')]=!![];this[_0x8a8a('0x38')](_0x4b334b);this['createSquareMessage'](_0x4b334b['text'],'in','','');this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x101'),_0x4b334b[_0x8a8a('0x60')]));var _0x39f4a8=this['sestekNDA'][_0x8a8a('0x76')](this,_0x4b334b);if(_0x39f4a8){for(var _0x2fda48 in _0x39f4a8){if(_0x39f4a8[_0x8a8a('0x9b')](_0x2fda48)){this['channel']['setVariable'](util[_0x8a8a('0x2b')](_0x8a8a('0x102'),_0x2fda48[_0x8a8a('0x6f')]()),_0x39f4a8[_0x2fda48]);}}this[_0x8a8a('0x45')](_0x39f4a8[_0x8a8a('0xec')],_0x8a8a('0xed'),_0x8a8a('0xf9'),'');if(_0x39f4a8['audiofile']){this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x39f4a8[_0x8a8a('0x103')]));var _0x5a177b=this['channel']['streamFile'](_0x39f4a8[_0x8a8a('0x103')]);try{fs[_0x8a8a('0x104')](_0x39f4a8[_0x8a8a('0x103')]+_0x8a8a('0x105'));}catch(_0xcfd82f){logger[_0x8a8a('0x2e')](_0xcfd82f);}return _0x5a177b;}else{return this['channel']['noop'](util['format'](_0x8a8a('0x106'),_0x39f4a8[_0x8a8a('0xec')]));}}return this[_0x8a8a('0x39')]['error'](_0x4b334b,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a8a('0x107')]=function(_0x5168b5){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5168b5[_0x8a8a('0x3b')]));return this['channel']['noop'](_0x8a8a('0x107'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x108')]=function(_0x4a4566){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4a4566[_0x8a8a('0x3b')]));var _0x25701d='';if(_0x4a4566[_0x8a8a('0x109')]){if(!this[_0x8a8a('0x89')](_0x4a4566[_0x8a8a('0x109')])){return this[_0x8a8a('0x39')]['error'](_0x4a4566,_0x8a8a('0x10a'));}else{var _0x2e5aff=parseInt(_0x4a4566[_0x8a8a('0x109')],0xa);if(isNaN(_0x2e5aff)){_0x25701d=_0x4a4566[_0x8a8a('0x109')];}else{_0x25701d=this[_0x8a8a('0x10b')]['sync'](this,_0x4a4566[_0x8a8a('0x109')]);if(!_0x25701d){return this['channel'][_0x8a8a('0x2e')](_0x4a4566,_0x8a8a('0x10c'));}}}}else if(_0x4a4566[_0x8a8a('0x10d')]){_0x25701d=_0x4a4566[_0x8a8a('0x10d')];}else{return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x4a4566,'no\x20trunk\x20selected');}var _0x5147d6=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xe2'),[util[_0x8a8a('0x2b')](_0x8a8a('0x10e'),_0x25701d,_0x4a4566[_0x8a8a('0x4b')]),_0x4a4566[_0x8a8a('0x6b')],_0x4a4566[_0x8a8a('0xe4')],_0x4a4566[_0x8a8a('0x69')]]);if(_0x5147d6[_0x8a8a('0xa6')]===-0x1){return _0x5147d6;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xe5'),'DIAL'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x10f')]=function(_0x23ecfd){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x110'),_0x23ecfd[_0x8a8a('0x3b')]));return this['channel'][_0x8a8a('0xaf')]('finally');};AGIVertices[_0x8a8a('0x12')]['getdigits']=function(_0x117aac){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x111'),_0x117aac['label']));if(_0x117aac['retry']===0x0){return this[_0x8a8a('0xa8')](_0x117aac);}_0x117aac[_0x8a8a('0xa9')]-=0x1;if(!this['isConfigured'](_0x117aac[_0x8a8a('0x112')])){return this['channel']['error'](_0x117aac,_0x8a8a('0x113'));}var _0x44eca1=this[_0x8a8a('0x20')]['sync'](this,_0x117aac[_0x8a8a('0x112')]);if(!_0x44eca1){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x117aac,'no\x20file\x20audio\x20found');}if(!this[_0x8a8a('0x89')](_0x117aac[_0x8a8a('0xd6')])){return this['channel']['error'](_0x8a8a('0x114'));}var _0x2b7030=this[_0x8a8a('0x39')][_0x8a8a('0x115')](_0x44eca1,_0x117aac[_0x8a8a('0x116')],_0x117aac['maxdigit']);var _0x113d31=_0x2b7030['result']?_0x2b7030['result'][_0x8a8a('0x50')]():'';logger[_0x8a8a('0x30')](_0x8a8a('0x117'),JSON[_0x8a8a('0x79')](_0x2b7030));if(_0x2b7030[_0x8a8a('0xa6')]===-0x1){this[_0x8a8a('0x38')]['sync'](this,_0x117aac,_0x113d31);return _0x2b7030;}else if(_0x2b7030[_0x8a8a('0xa4')]===_0x8a8a('0x6b')){_0x2b7030[_0x8a8a('0xa6')]=_0x113d31[_0x8a8a('0x9c')]>=parseInt(_0x117aac[_0x8a8a('0x118')])?'x':'i';}else{_0x2b7030['result']=_0x113d31[_0x8a8a('0x9c')]>=parseInt(_0x117aac['mindigit'])&&_0x113d31[_0x8a8a('0x9c')]<=parseInt(_0x117aac['maxdigit'])?'x':'i';}var _0x59e5ef=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x117aac[_0x8a8a('0xd6')]);if(!_0x59e5ef){return this['channel'][_0x8a8a('0x2e')](_0x117aac,'no\x20variable\x20found');}this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x59e5ef,_0x113d31);if(this[_0x8a8a('0x89')](_0x117aac[_0x8a8a('0x119')])){var _0x12e9ba=parseInt(_0x117aac[_0x8a8a('0x119')],0xa);var _0x430b64=rs[_0x8a8a('0x11a')]({'charset':'*','length':_0x12e9ba});var _0x3d5bf0=_0x113d31[_0x8a8a('0x9c')];if(_0x3d5bf0>0x0){if(_0x3d5bf0>_0x12e9ba){this[_0x8a8a('0x38')]['sync'](this,_0x117aac,_0x117aac['hiddendigitspos']===_0x8a8a('0x11b')?_0x430b64+_0x113d31[_0x8a8a('0x11c')](_0x12e9ba):_0x113d31[_0x8a8a('0x11c')](0x0,_0x3d5bf0-_0x12e9ba)+_0x430b64);}else{this['createSquareDetailsReport']['sync'](this,_0x117aac,rs[_0x8a8a('0x11a')]({'charset':'*','length':_0x3d5bf0}));}}else{this[_0x8a8a('0x38')]['sync'](this,_0x117aac,'');}}else{this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x117aac,_0x113d31);}return _0x2b7030;};AGIVertices[_0x8a8a('0x12')]['getsecretdigits']=function(_0x5e618d){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x11d'),_0x5e618d['label']));return this[_0x8a8a('0xf')](_0x5e618d);};AGIVertices['prototype']['goal']=function(_0x589389){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x11e'),_0x589389[_0x8a8a('0x3b')]));this[_0x8a8a('0x38')]['sync'](this,_0x589389,_0x589389['goalname']);return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('GOAL\x20%s',_0x589389[_0x8a8a('0x11f')]));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x120')]=function(_0x5e4abc){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5e4abc[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x5e4abc[_0x8a8a('0x8c')])||!this[_0x8a8a('0x89')](_0x5e4abc[_0x8a8a('0x90')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8a8a('0x89')](_0x5e4abc[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x121'),_0x5e4abc[_0x8a8a('0x60')]));var _0x10e059=this[_0x8a8a('0x8b')][_0x8a8a('0x76')](this,_0x5e4abc);if(_0x10e059){this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x122'),_0x10e059));var _0x3a0fd0=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0x10e059);try{fs[_0x8a8a('0x104')](_0x10e059+_0x8a8a('0x105'));}catch(_0xa120ef){logger[_0x8a8a('0x2e')](_0xa120ef);}return _0x3a0fd0;}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x5e4abc,_0x8a8a('0x124'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x125')]=function(_0x3a60dc){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x126'),_0x3a60dc[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x8c')])||!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x90')])){return this[_0x8a8a('0x39')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x91')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20bot\x20name\x20configured');}if(!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x60')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xe9')]=!![];this['createSquareDetailsReport'](_0x3a60dc);this[_0x8a8a('0x45')](_0x3a60dc[_0x8a8a('0x60')],'in','','');this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x127'),_0x3a60dc[_0x8a8a('0x60')]));var _0x1db5e4=this[_0x8a8a('0x8f')][_0x8a8a('0x76')](this,_0x3a60dc);if(_0x1db5e4){for(var _0x268030 in _0x1db5e4){if(_0x1db5e4['hasOwnProperty'](_0x268030)&&_[_0x8a8a('0x9d')](_0x1db5e4[_0x268030])){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util['format'](_0x8a8a('0x128'),_0x268030[_0x8a8a('0x6f')]()),_0x1db5e4[_0x268030]);}}if(_[_0x8a8a('0x47')](_0x1db5e4[_0x8a8a('0x129')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0x12a'));}else{this['createSquareMessage'](_0x1db5e4[_0x8a8a('0x129')],_0x8a8a('0xed'),_0x8a8a('0x12b'),'');return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x12c'),_0x1db5e4[_0x8a8a('0x129')]));}}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3a60dc,_0x8a8a('0x12d'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x12e')]=function(_0x59a279){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x12f'),_0x59a279['label'],_0x59a279[_0x8a8a('0x6b')]));if(!this[_0x8a8a('0x89')](_0x59a279[_0x8a8a('0x7e')])){return this[_0x8a8a('0x39')]['noop']('no\x20key\x20configured');}var _0x13e934=_0x8a8a('0x130');var _0x578863=util[_0x8a8a('0x2b')](_0x8a8a('0x131'),FILES_PATH,rs[_0x8a8a('0x11a')](0x4));var _0x398350=util['format'](_0x8a8a('0x9f'),_0x578863,_0x13e934);var _0x1e995b=!![];if(_0x59a279[_0x8a8a('0x132')]==='NOBEEP'){_0x1e995b=![];}var _0x4525f3=this['channel'][_0x8a8a('0x133')](_0x578863,_0x13e934,_0x59a279['intKey'],_0x59a279['timeout'],undefined,_0x1e995b);if(_0x4525f3[_0x8a8a('0xa6')]!==-0x1){this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x134'),_0x398350));var _0x2754ce=this[_0x8a8a('0x92')]['sync'](this,_0x59a279,_0x398350);if(_0x2754ce){for(var _0x337ddf in _0x2754ce){if(_0x2754ce[_0x8a8a('0x9b')](_0x337ddf)){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0x135'),_0x337ddf['toUpperCase']()),_0x2754ce[_0x337ddf]);}}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x136'),JSON[_0x8a8a('0x79')](_0x2754ce)));}}return _0x4525f3;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x137')]=function(_0xf6c9fa){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x138'),_0xf6c9fa['label']));if(!this['isConfigured'](_0xf6c9fa['appid'])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x139'));}if(!this['isConfigured'](_0xf6c9fa['appsecret'])){return this[_0x8a8a('0x39')]['noop']('no\x20appsecret\x20configured');}var _0x4f6f49=_0x8a8a('0x130');var _0x4f9afe=util[_0x8a8a('0x2b')](_0x8a8a('0x131'),FILES_PATH,rs[_0x8a8a('0x11a')](0x4));var _0x757d7=util['format'](_0x8a8a('0x9f'),_0x4f9afe,_0x4f6f49);var _0x4262ff=!![];if(_0xf6c9fa['beep']==='NOBEEP'){_0x4262ff=![];}var _0x2d0600=this[_0x8a8a('0x39')][_0x8a8a('0x133')](_0x4f9afe,_0x4f6f49,_0xf6c9fa['intKey'],_0xf6c9fa[_0x8a8a('0x6b')],undefined,_0x4262ff);if(_0x2d0600[_0x8a8a('0xa6')]!==-0x1){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x13a'),_0x757d7));var _0x1c2806=this[_0x8a8a('0x93')][_0x8a8a('0x76')](this,_0xf6c9fa,_0x757d7);if(_0x1c2806){for(var _0x436232 in _0x1c2806){if(_0x1c2806[_0x8a8a('0x9b')](_0x436232)){this['channel'][_0x8a8a('0xa0')](util['format'](_0x8a8a('0x13b'),_0x436232['toUpperCase']()),_0x1c2806[_0x436232]);}}return this['channel'][_0x8a8a('0xaf')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x1c2806)));}}return _0x2d0600;};AGIVertices['prototype'][_0x8a8a('0x13c')]=function(_0x3a1604){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x13d'),_0x3a1604[_0x8a8a('0x3b')]));return this[_0x8a8a('0x39')][_0x8a8a('0x13e')](_0x3a1604[_0x8a8a('0x3f')],_0x3a1604[_0x8a8a('0x40')],_0x3a1604[_0x8a8a('0x41')]);};AGIVertices['prototype'][_0x8a8a('0x13f')]=function(_0x596653){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x140'),_0x596653[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x596653[_0x8a8a('0x141')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x596653,_0x8a8a('0x142'));}try{var _0x363878=eval(_0x596653[_0x8a8a('0x141')])?'true':'false';this['channel'][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x143'),_0x596653[_0x8a8a('0x141')],_0x363878));return{'code':0xc8,'result':_0x363878};}catch(_0xa9c8f4){return{'code':0xc8,'result':_0x8a8a('0x144')};}};AGIVertices[_0x8a8a('0x12')]['gotoiftime']=function(_0x1db7f1){logger['info'](util[_0x8a8a('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1db7f1[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1db7f1[_0x8a8a('0x145')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1db7f1,_0x8a8a('0x146'));}var _0x2406f1=this['getIntervals'][_0x8a8a('0x76')](this,_0x1db7f1['interval_id']);if(!_0x2406f1){return this['channel']['error'](_0x1db7f1,'no\x20intervals\x20found');}for(var _0x4b873d=0x0;_0x4b873d<_0x2406f1[_0x8a8a('0x9c')];_0x4b873d+=0x1){var _0x3cff27=this[_0x8a8a('0x39')][_0x8a8a('0x13')](util[_0x8a8a('0x2b')](_0x8a8a('0x147'),_0x2406f1[_0x4b873d]));if(_0x3cff27[_0x8a8a('0xa6')]===-0x1){return _0x3cff27;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x2406f1[_0x4b873d],_0x3cff27[_0x8a8a('0xa4')]));if(_0x3cff27[_0x8a8a('0xa4')]===_0x8a8a('0x148')){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x149'),_0x2406f1[_0x4b873d],'true'));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('IFTIME\x20%s\x20%s',_0x2406f1[_0x4b873d],_0x8a8a('0x148')));return{'code':0xc8,'result':_0x8a8a('0x148')};}else{logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x149'),_0x2406f1[_0x4b873d],_0x8a8a('0x144')));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x149'),_0x2406f1[_0x4b873d],_0x8a8a('0x144')));}}return{'code':0xc8,'result':_0x8a8a('0x144')};};AGIVertices['prototype']['hangup']=function(_0x858111){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x858111['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0x8a8a('0x14a')]=function(_0x56e90a){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x14b'),_0x56e90a['label']));if(!this[_0x8a8a('0x89')](_0x56e90a[_0x8a8a('0x7e')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20key\x20configured');}var _0x54ab2e=_0x8a8a('0x130');var _0x2dec51=util['format'](_0x8a8a('0x131'),FILES_PATH,rs['generate'](0x4));var _0x1a403e=util[_0x8a8a('0x2b')]('%s.%s',_0x2dec51,_0x54ab2e);var _0x3cdabc=!![];if(_0x56e90a['beep']===_0x8a8a('0x14c')){_0x3cdabc=![];}var _0x44efa2=this[_0x8a8a('0x39')][_0x8a8a('0x133')](_0x2dec51,_0x54ab2e,_0x56e90a[_0x8a8a('0x14d')],_0x56e90a['timeout'],undefined,_0x3cdabc);if(_0x44efa2[_0x8a8a('0xa6')]!==-0x1){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x14e'),_0x1a403e));var _0x13b237=this[_0x8a8a('0x88')][_0x8a8a('0x76')](this,_0x56e90a,_0x1a403e);if(_0x13b237){for(var _0x246301 in _0x13b237){if(_0x13b237['hasOwnProperty'](_0x246301)){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0x14f'),_0x246301[_0x8a8a('0x6f')]()),_0x13b237[_0x246301]);}}return this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x150'),JSON['stringify'](_0x13b237)));}}return _0x44efa2;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x151')]=function(_0x2f5102){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2f5102[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x2f5102[_0x8a8a('0x7e')])){return this['channel']['noop'](_0x8a8a('0xe8'));}if(!this[_0x8a8a('0x89')](_0x2f5102['text'])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x2f5102['text']));var _0x3e4875=this['ispeechTTS'][_0x8a8a('0x76')](this,_0x2f5102);if(_0x3e4875){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x14e'),_0x3e4875));var _0x56220c=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0x3e4875,_0x2f5102['intKey']);try{fs[_0x8a8a('0x104')](_0x3e4875+_0x8a8a('0x105'));}catch(_0x3d49d3){logger[_0x8a8a('0x2e')](_0x3d49d3);}return _0x56220c;}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x2f5102,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a8a('0x152')]=function(_0x328d96){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x153'),_0x328d96[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x328d96[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x328d96,_0x8a8a('0x155'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96[_0x8a8a('0x154')]));var _0x197553=this[_0x8a8a('0x58')]['sync'](this,_0x328d96[_0x8a8a('0x154')]);if(_0x197553){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96[_0x8a8a('0x154')]));this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96['findBy']));return{'code':0xc8,'result':_0x8a8a('0x157')};}else{logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x158'),this['channel']['callerid'],_0x328d96[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x159')};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x15a')]=function(_0x2d99d3){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x15b'),_0x2d99d3[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x2d99d3[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x2d99d3,_0x8a8a('0x155'));}logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x15c'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x2d99d3[_0x8a8a('0x154')]));var _0x2d3f1c=this[_0x8a8a('0x57')]['sync'](this,_0x2d99d3['findBy']);if(_0x2d3f1c){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')]['callerid'],_0x2d99d3[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x2d99d3[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x157')};}else{logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')]['callerid'],_0x2d99d3[_0x8a8a('0x154')]));this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this['channel'][_0x8a8a('0x3c')],_0x2d99d3[_0x8a8a('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x15d')]=function(_0x3d62d4){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3d62d4['label']));if(!this[_0x8a8a('0x89')](_0x3d62d4[_0x8a8a('0x15e')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3d62d4,'no\x20operation\x20configured');}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x15f'),_0x3d62d4[_0x8a8a('0x15e')]));var _0x21cd36=eval(_0x3d62d4[_0x8a8a('0x15e')]);if(!this[_0x8a8a('0x89')](_0x3d62d4[_0x8a8a('0xd6')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x114'));}var _0xfc8f8e=this[_0x8a8a('0x13')]['sync'](this,_0x3d62d4[_0x8a8a('0xd6')]);if(!_0xfc8f8e){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3d62d4,_0x8a8a('0xd7'));}if(_[_0x8a8a('0x160')](_0x21cd36)){var _0x221ac6=this;_0x21cd36[_0x8a8a('0xd9')](function(_0xd6b4cd,_0x4fc5e4){_0x221ac6[_0x8a8a('0x39')][_0x8a8a('0xa0')](util['format']('%s[%s]',_0xfc8f8e,_0x4fc5e4),_0xd6b4cd);});return this['channel']['noop'](util[_0x8a8a('0x2b')]('variable\x20%s[key]\x20set',_0xfc8f8e));}else{return this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0xfc8f8e,_0x21cd36);}};AGIVertices[_0x8a8a('0x12')]['menu']=function(_0x162dd9){logger['info'](util['format'](_0x8a8a('0x161'),_0x162dd9['label']));if(_0x162dd9[_0x8a8a('0xa9')]===0x0){return this[_0x8a8a('0xa8')](_0x162dd9);}_0x162dd9[_0x8a8a('0xa9')]-=0x1;if(!this['isConfigured'](_0x162dd9['file_id'])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x162dd9,'no\x20file\x20audio\x20selected');}var _0xe8b3c0=this['getSound'][_0x8a8a('0x76')](this,_0x162dd9[_0x8a8a('0x112')]);if(!_0xe8b3c0){return this['channel']['error'](_0x162dd9,_0x8a8a('0x162'));}var _0x15f25f=this[_0x8a8a('0x39')][_0x8a8a('0x115')](_0xe8b3c0,_0x162dd9[_0x8a8a('0x116')],_0x162dd9[_0x8a8a('0x163')]);var _0x2d4a9a=_0x15f25f['result'];if(_0x15f25f[_0x8a8a('0xa6')]===-0x1){this[_0x8a8a('0x38')]['sync'](this,_0x162dd9,'-1');return _0x15f25f;}else if(_0x15f25f['extra']===_0x8a8a('0x6b')){_0x15f25f[_0x8a8a('0xa6')]=_0x15f25f['result'][_0x8a8a('0x9c')]>0x0?_0x15f25f[_0x8a8a('0xa6')]:'t';}else if(_['isEmpty'](_0x15f25f[_0x8a8a('0xa6')])){_0x15f25f['result']='#';_0x2d4a9a='#';}if(!this[_0x8a8a('0x89')](_0x162dd9[_0x8a8a('0xd6')])){this[_0x8a8a('0x39')]['noop'](_0x8a8a('0x114'));}else{var _0x50fbda=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x162dd9[_0x8a8a('0xd6')]);if(!_0x50fbda){return this['channel']['error'](_0x162dd9,_0x8a8a('0xd7'));}this['channel']['setVariable'](_0x50fbda,_0x2d4a9a);}this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x162dd9,_0x2d4a9a);return _0x15f25f;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xaf')]=function(_0x46768a){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x46768a['label']));return this['channel'][_0x8a8a('0xaf')](_0x46768a[_0x8a8a('0x164')]||_0x46768a['label']);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x165')]=function(_0x3efaa1){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x166'),_0x3efaa1[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3efaa1[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')]['error'](_0x3efaa1,_0x8a8a('0x155'));}logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));var _0x47f489=this['getPause'][_0x8a8a('0x76')](this,_0x3efaa1[_0x8a8a('0x167')]);var _0x1a6603=this[_0x8a8a('0x54')]['sync'](this,_0x3efaa1[_0x8a8a('0x154')],_0x47f489);if(_0x1a6603){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')]['callerid'],_0x3efaa1[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x157')};}else{logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x158'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x168')]=function(_0x3cf0c9){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x169'),_0x3cf0c9['label']));if(!this[_0x8a8a('0x89')](_0x3cf0c9[_0x8a8a('0x112')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3cf0c9,_0x8a8a('0x113'));}var _0x46ea59=this[_0x8a8a('0x20')][_0x8a8a('0x76')](this,_0x3cf0c9[_0x8a8a('0x112')]);if(!_0x46ea59){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3cf0c9,'no\x20file\x20audio\x20found');}var _0x41e8e6=this['channel'][_0x8a8a('0xae')](_0x8a8a('0x16a'),[_0x46ea59,_0x3cf0c9[_0x8a8a('0xe4')]]);if(_0x41e8e6[_0x8a8a('0xa6')]===-0x1){return _0x41e8e6;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x16a'),_0x46ea59));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x16b')]=function(_0x1d2fb2){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x16c'),_0x1d2fb2[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1d2fb2[_0x8a8a('0x16d')])){return this[_0x8a8a('0x39')]['error'](_0x1d2fb2,_0x8a8a('0x16e'));}var _0x20ae19='';var _0x14b499=parseInt(_0x1d2fb2[_0x8a8a('0x16d')],0xa);if(isNaN(_0x14b499)){_0x20ae19=_0x1d2fb2['queue_id'];}else{_0x20ae19=this['getVoiceQueue'][_0x8a8a('0x76')](this,_0x1d2fb2['queue_id']);if(!_0x20ae19){return this['channel'][_0x8a8a('0x2e')](_0x1d2fb2,_0x8a8a('0x16f'));}}var _0x2d6bdc='';if(this[_0x8a8a('0x89')](_0x1d2fb2[_0x8a8a('0x112')])){var _0x36a548=this['getSound']['sync'](this,_0x1d2fb2[_0x8a8a('0x112')]);if(_0x36a548){_0x2d6bdc=_0x36a548;}}this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x1d2fb2,_0x20ae19);if(_0x1d2fb2['opts']['indexOf']('x')<0x0){_0x1d2fb2[_0x8a8a('0xe4')]+='x';}if(_0x1d2fb2[_0x8a8a('0xe4')]['indexOf']('X')<0x0){_0x1d2fb2[_0x8a8a('0xe4')]+='X';}this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x8a8a('0x170'),_0x20ae19?_0x20ae19[_0x8a8a('0x171')]():'');var _0x39892a=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0x172'),[_0x20ae19,_0x1d2fb2[_0x8a8a('0xe4')],_0x1d2fb2[_0x8a8a('0x69')],_0x2d6bdc,_0x1d2fb2[_0x8a8a('0x6b')],_0x1d2fb2[_0x8a8a('0x8')],_0x1d2fb2[_0x8a8a('0x173')],_0x1d2fb2[_0x8a8a('0x174')],'',_0x1d2fb2[_0x8a8a('0x175')]]);if(_0x39892a['result']===-0x1){return _0x39892a;}return this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x172'),_0x20ae19));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x176')]=function(_0xeab9db){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x177'),_0xeab9db[_0x8a8a('0x3b')]));var _0x4de9f1=_0xeab9db[_0x8a8a('0x178')]||_0x8a8a('0x130');var _0x138cb2=util[_0x8a8a('0x2b')](_0x8a8a('0x179'),this[_0x8a8a('0x39')][_0x8a8a('0x3a')],rs[_0x8a8a('0x11a')](0x5));var _0x2ccdb4=util[_0x8a8a('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x138cb2,_0x4de9f1);var _0x3aadb0=util[_0x8a8a('0x2b')](_0x8a8a('0x131'),FILES_PATH,_0x138cb2);this[_0x8a8a('0x3d')][_0x8a8a('0x76')](this,_0xeab9db,_0x138cb2,_0x2ccdb4);this['channel'][_0x8a8a('0xa0')](_0x8a8a('0x17a'),_0x138cb2);logger[_0x8a8a('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x3aadb0,_0x4de9f1,_0xeab9db[_0x8a8a('0x17b')],_0xeab9db['timeout']);return this[_0x8a8a('0x39')][_0x8a8a('0x133')](_0x3aadb0,_0x4de9f1,_0xeab9db['escape_digits'],_0xeab9db[_0x8a8a('0x6b')],undefined,!![]);};AGIVertices[_0x8a8a('0x12')]['restapi']=function(_0x1e41fa){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x17c'),_0x1e41fa['label']));if(!this[_0x8a8a('0x89')](_0x1e41fa[_0x8a8a('0x69')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20url\x20configured');}var _0x194cfb=this[_0x8a8a('0x68')][_0x8a8a('0x76')](this,_0x1e41fa);logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x17d'),util[_0x8a8a('0x17e')](_0x194cfb,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1e41fa['variable_id'])){return this['channel'][_0x8a8a('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1e119e=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x1e41fa[_0x8a8a('0xd6')]);if(!_0x1e119e){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1e41fa,'no\x20variable\x20found');}this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0x17f'),_0x1e119e),_0x194cfb[_0x8a8a('0x7b')]?_0x194cfb[_0x8a8a('0x7b')]:_0x8a8a('0x180'));this['channel']['setVariable'](util['format'](_0x8a8a('0x181'),_0x1e119e),_0x194cfb[_0x8a8a('0x182')]?_0x194cfb[_0x8a8a('0x182')]:'OK');if(_0x194cfb[_0x8a8a('0x70')]){try{this['saveRestApiResult'](_0x194cfb[_0x8a8a('0x70')],_0x1e119e);}catch(_0x14ed3b){logger[_0x8a8a('0x2e')](util[_0x8a8a('0x2b')](_0x8a8a('0x183'),_0x1e119e));}}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xdc'),_0x1e119e));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x184')]=function(_0x5a17a0){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5a17a0['label']));return this[_0x8a8a('0x39')][_0x8a8a('0x185')](_0x5a17a0[_0x8a8a('0x186')]['replace'](/\s+/g,''),_0x5a17a0['escape_digits']);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x187')]=function(_0x238293){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x188'),_0x238293['label']));return this[_0x8a8a('0x39')][_0x8a8a('0x189')](_0x238293[_0x8a8a('0x6c')]['replace'](/\s+/g,''),_0x238293['escape_digits']);};AGIVertices[_0x8a8a('0x12')]['sayphonetic']=function(_0x4bea09){logger['info'](util[_0x8a8a('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4bea09[_0x8a8a('0x3b')]));return this[_0x8a8a('0x39')][_0x8a8a('0x18a')](_0x4bea09[_0x8a8a('0x60')],_0x4bea09[_0x8a8a('0x17b')]);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x18b')]=function(_0x4e12a8){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x18c'),_0x4e12a8[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x4e12a8['account_id'])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x18d'));}var _0x56856a=this['getMailAccount'][_0x8a8a('0x76')](this,_0x4e12a8[_0x8a8a('0x18e')]);if(!_0x56856a||!_0x56856a[_0x8a8a('0x18f')]){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x4e12a8,'no\x20mail\x20account\x20found');}var _0x50da5f={'from':util[_0x8a8a('0x2b')](_0x8a8a('0x190'),_0x56856a[_0x8a8a('0x15')],_0x56856a[_0x8a8a('0x191')]||_0x56856a[_0x8a8a('0x18f')][_0x8a8a('0x192')]),'to':_0x4e12a8['to']||'','cc':_0x4e12a8['cc']||'','bcc':_0x4e12a8[_0x8a8a('0x193')]||'','subject':_0x4e12a8[_0x8a8a('0x194')],'html':_0x4e12a8['text'],'text':_0x4e12a8[_0x8a8a('0x60')]};if(this[_0x8a8a('0x89')](_0x4e12a8['template_id'])){}logger[_0x8a8a('0xde')]('sendMail\x20message',JSON[_0x8a8a('0x79')](_0x50da5f));this[_0x8a8a('0x38')]['sync'](this,_0x4e12a8,_0x4e12a8['account_id']);this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x195'),_0x56856a[_0x8a8a('0x15')]));this[_0x8a8a('0x25')]['sync'](this,_0x56856a[_0x8a8a('0x196')],_0x50da5f);return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x197'));};AGIVertices[_0x8a8a('0x12')]['sendFax']=function(_0x21e551){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x198'),_0x21e551['label']));return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x199'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x19a')]=function(_0x556f8e){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x19b'),_0x556f8e[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x556f8e[_0x8a8a('0x19c')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x19d'));}var _0x4e3e71=this[_0x8a8a('0x35')][_0x8a8a('0x76')](this,_0x556f8e[_0x8a8a('0x19c')]);if(!_0x4e3e71){return this['channel'][_0x8a8a('0x2e')](_0x556f8e,_0x8a8a('0x19e'));}var _0x54416e={'body':_0x556f8e['sms_text'],'phone':_0x556f8e['to']||'','SmsAccountId':_0x4e3e71['id']};logger[_0x8a8a('0xde')](_0x8a8a('0x19f'),JSON[_0x8a8a('0x79')](_0x54416e));this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x556f8e,_0x556f8e[_0x8a8a('0x19c')]);this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1a0'),_0x4e3e71['name']));this['createSmsMessage'][_0x8a8a('0x76')](this,_0x54416e);return this['channel']['noop'](_0x8a8a('0x1a1'));};AGIVertices['prototype'][_0x8a8a('0x1a2')]=function(_0xc44131){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0xc44131[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0xc44131[_0x8a8a('0xd6')])){return this['channel'][_0x8a8a('0x2e')](_0xc44131,_0x8a8a('0x1a3'));}var _0x1d34df=this[_0x8a8a('0x13')]['sync'](this,_0xc44131[_0x8a8a('0xd6')]);if(!_0x1d34df){return this['channel'][_0x8a8a('0x2e')](_0xc44131,_0x8a8a('0xd7'));}return this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x1d34df,_0xc44131[_0x8a8a('0x1a4')]);};AGIVertices[_0x8a8a('0x12')]['start']=function(_0x41fc5b){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1a5'),_0x41fc5b[_0x8a8a('0x3b')]));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x1a6'));var _0x258f76=this[_0x8a8a('0x39')][_0x8a8a('0x13')](_0x8a8a('0x1a7'));if(!_['isEmpty'](_0x258f76[_0x8a8a('0xa4')])){this[_0x8a8a('0x39')][_0x8a8a('0x3a')]=_0x258f76[_0x8a8a('0xa4')];}if(_0x41fc5b[_0x8a8a('0xbb')]===_0x8a8a('0x1a8')){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x1a9'));return this[_0x8a8a('0x39')][_0x8a8a('0xbb')]();}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x1aa'));};AGIVertices[_0x8a8a('0x12')]['subproject']=function(_0x1394c7){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1ab'),_0x1394c7[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1394c7[_0x8a8a('0x1ac')])){return this[_0x8a8a('0x39')]['error'](_0x1394c7,_0x8a8a('0x1ad'));}var _0x5eb730=this[_0x8a8a('0x1ae')][_0x8a8a('0x76')](this,_0x1394c7[_0x8a8a('0x1ac')]);if(!this[_0x8a8a('0x89')](_0x5eb730)){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1394c7,util['format'](_0x8a8a('0x1af'),_0x1394c7[_0x8a8a('0x1ac')]));}if(_0x5eb730===this[_0x8a8a('0x39')]['arg_1']){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1394c7,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x1394c7,_0x5eb730);var _0x492bf4=this['channel'][_0x8a8a('0xae')](_0x8a8a('0x1b0'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x8a8a('0x1b1')]||_0x8a8a('0x1b2'),_0x5eb730,this[_0x8a8a('0x39')][_0x8a8a('0x43')]));if(_0x492bf4[_0x8a8a('0xa6')]===-0x1){return _0x492bf4;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x1b0'),_0x5eb730));};AGIVertices['prototype'][_0x8a8a('0x1b3')]=function(_0x185ac6){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b4'),_0x185ac6['label']));var _0x9f9c74=this['shellCommand']['sync'](this,_0x185ac6[_0x8a8a('0xba')]);this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x185ac6,_0x185ac6[_0x8a8a('0xba')]);if(this[_0x8a8a('0x89')](_0x185ac6[_0x8a8a('0xd6')])){var _0x1df0dc=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x185ac6[_0x8a8a('0xd6')]);if(_0x1df0dc){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x1df0dc,_0x9f9c74);return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b5'),_0x185ac6[_0x8a8a('0xba')],_0x1df0dc));}}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b6'),_0x185ac6[_0x8a8a('0xba')]));};AGIVertices[_0x8a8a('0x12')]['google_cloud_tts']=function(_0x26f923){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b7'),_0x26f923[_0x8a8a('0x3b')]));_0x26f923[_0x8a8a('0x60')]=_0x26f923['text'][_0x8a8a('0x1b8')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x26f923['apiKey'])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x1b9'));}if(!this[_0x8a8a('0x89')](_0x26f923[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')]['noop']('no\x20text\x20configured');}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x26f923['text']));var _0xec63ff=this[_0x8a8a('0x5d')][_0x8a8a('0x76')](this,_0x26f923);if(_0xec63ff){this['channel']['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x1ba'),_0xec63ff));var _0x431688=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0xec63ff);try{fs[_0x8a8a('0x104')](_0xec63ff+_0x8a8a('0x105'));}catch(_0x39bc6f){logger[_0x8a8a('0x2e')](_0x39bc6f);}return _0x431688;}return this[_0x8a8a('0x39')]['error'](_0x26f923,_0x8a8a('0x1bb'));};AGIVertices[_0x8a8a('0x12')]['tts']=function(_0x46bc3e){logger['info'](util[_0x8a8a('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x46bc3e['label']));_0x46bc3e[_0x8a8a('0x60')]=_0x46bc3e[_0x8a8a('0x60')][_0x8a8a('0x1b8')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x46bc3e[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20text\x20configured');}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1bc'),_0x46bc3e[_0x8a8a('0x60')]));var _0x535b86=this['googleTTS']['sync'](this,_0x46bc3e);if(_0x535b86){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x535b86));var _0x58df96=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0x535b86);try{fs['unlink'](_0x535b86+'.wav');}catch(_0x3e5b28){logger[_0x8a8a('0x2e')](_0x3e5b28);}return _0x58df96;}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x46bc3e,_0x8a8a('0x1bd'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1be')]=function(_0x17243d){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x1bf'),_0x17243d[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x17243d[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x17243d,_0x8a8a('0x155'));}logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x17243d['findBy']));var _0x412a6c=this['agentUnpause'][_0x8a8a('0x76')](this,_0x17243d['findBy']);if(_0x412a6c){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x17243d['findBy']));this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this['channel'][_0x8a8a('0x3c')],_0x17243d[_0x8a8a('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')]['callerid'],_0x17243d['findBy']));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')]['callerid'],_0x17243d[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x159')};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1c0')]=function(_0x22031f){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1c1'),_0x22031f[_0x8a8a('0x3b')]));var _0x4af5ad=this[_0x8a8a('0x39')]['exec'](_0x8a8a('0x1c2'),[_0x22031f[_0x8a8a('0x1c3')],_0x22031f[_0x8a8a('0xad')]]);if(_0x4af5ad[_0x8a8a('0xa6')]===-0x1){return _0x4af5ad;}return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x1c2'),_0x22031f[_0x8a8a('0x1c3')]));};AGIVertices['prototype'][_0x8a8a('0x1c4')]=function(_0x37ef41){logger[_0x8a8a('0x30')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x37ef41[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x37ef41[_0x8a8a('0xd6')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x37ef41,_0x8a8a('0x1a3'));}var _0x55bba4=this['getVariable'][_0x8a8a('0x76')](this,_0x37ef41[_0x8a8a('0xd6')]);if(!_0x55bba4){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x37ef41,_0x8a8a('0xd7'));}var _0x8dc11=this['channel']['getVariable'](_0x55bba4);return{'code':0xc8,'result':_0x8dc11[_0x8a8a('0xa4')]?_0x8dc11[_0x8a8a('0xa4')]:'-'};};String['prototype'][_0x8a8a('0xa3')]=function(_0x470c8a,_0x3fb8a3){return this[_0x8a8a('0xa2')](_0x470c8a)['join'](_0x3fb8a3);};module['exports']=AGIVertices; \ No newline at end of file +var _0x80d9=['googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','googleASR','appid','appsecret','clear','agicommand','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','format','%s.%s','setVariable','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','no\x20query\x20configured','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','intKey','tilde\x20%s\x20file\x20created','tildeASR','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','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','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendSMS','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','rawHeaders','getdigits','getsecretdigits','channel','rpc','getVariableById','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','then','getSquareOdbc','getSquareOdbcById','getUserById','getSound','getSoundPath','save_name','getMailAccountById','IntervalId','interval','Intervals','%s/sounds/converted/%s','open','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','googleTTS','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','rawBody','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language'];(function(_0x4a0619,_0x520a45){var _0x420ba7=function(_0x1e9bed){while(--_0x1e9bed){_0x4a0619['push'](_0x4a0619['shift']());}};_0x420ba7(++_0x520a45);}(_0x80d9,0x15c));var _0x980d=function(_0x359c7d,_0x1209d5){_0x359c7d=_0x359c7d-0x0;var _0x338a22=_0x80d9[_0x359c7d];return _0x338a22;};'use strict';var fs=require('fs');var util=require(_0x980d('0x0'));var _=require('lodash');var sh=require(_0x980d('0x1'));var odbc=require(_0x980d('0x2'))();var rs=require(_0x980d('0x3'));var moment=require('moment');var Mustache=require(_0x980d('0x4'));var rp=require(_0x980d('0x5'));var logger=require(_0x980d('0x6'))(_0x980d('0x7'));var config=require(_0x980d('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x980d('0x9'),'rawBody'];var verticesWithRetry=['menu',_0x980d('0xa'),_0x980d('0xb')];var AGIVertices=function(_0x2b8e2c,_0x270d06,_0x3b1043){this[_0x980d('0xc')]=_0x2b8e2c;this[_0x980d('0xd')]=_0x270d06;this['mailRpc']=_0x3b1043;};AGIVertices['prototype']['getVariable']=function(_0x43a0d8,_0x10872c){this['rpc'][_0x980d('0xe')](_0x43a0d8)['then'](function(_0x19fc88){_0x10872c(null,_0x19fc88?_0x19fc88['name']:![]);})[_0x980d('0xf')](function(_0x19cb9b){_0x10872c(_0x19cb9b);});};AGIVertices[_0x980d('0x10')][_0x980d('0x11')]=function(_0xa1c26d,_0x18469c){this[_0x980d('0xd')][_0x980d('0x12')](_0xa1c26d)['then'](function(_0x182ff9){_0x18469c(null,_0x182ff9?_0x182ff9[_0x980d('0x13')]:![]);})[_0x980d('0xf')](function(_0x3846bd){_0x18469c(_0x3846bd);});};AGIVertices[_0x980d('0x10')][_0x980d('0x14')]=function(_0x5824bf,_0x27dd6a){this[_0x980d('0xd')]['getSquareProjectById'](_0x5824bf)[_0x980d('0x15')](function(_0x4e9d73){_0x27dd6a(null,_0x4e9d73?_0x4e9d73[_0x980d('0x13')]:![]);})[_0x980d('0xf')](function(_0x39192b){_0x27dd6a(_0x39192b);});};AGIVertices[_0x980d('0x10')][_0x980d('0x16')]=function(_0xc360c4,_0x3ef68b){this[_0x980d('0xd')][_0x980d('0x17')](_0xc360c4)[_0x980d('0x15')](function(_0x2f234f){_0x3ef68b(null,_0x2f234f?_0x2f234f['dsn']:![]);})['catch'](function(_0x3cb470){_0x3ef68b(_0x3cb470);});};AGIVertices['prototype']['getUser']=function(_0x124c3f,_0x1d6286){this[_0x980d('0xd')][_0x980d('0x18')](_0x124c3f)['then'](function(_0x595cf0){_0x1d6286(null,_0x595cf0?_0x595cf0[_0x980d('0x13')]:![]);})['catch'](function(_0x4de252){_0x1d6286(_0x4de252);});};AGIVertices[_0x980d('0x10')]['getTrunk']=function(_0x23ca08,_0x4798d7){this['rpc']['getTrunkById'](_0x23ca08)[_0x980d('0x15')](function(_0x43f278){_0x4798d7(null,_0x43f278?_0x43f278[_0x980d('0x13')]:![]);})[_0x980d('0xf')](function(_0x5342dd){_0x4798d7(_0x5342dd);});};AGIVertices['prototype'][_0x980d('0x19')]=function(_0x1d5dad,_0x97ca70){var _0x1da8ea=this;this[_0x980d('0xd')]['getSoundById'](_0x1d5dad)['then'](function(_0x2830e5){_0x97ca70(null,_0x2830e5?_0x1da8ea[_0x980d('0x1a')](_0x2830e5[_0x980d('0x1b')]):![]);})[_0x980d('0xf')](function(_0x2dab0e){_0x97ca70(_0x2dab0e);});};AGIVertices[_0x980d('0x10')]['getMailAccount']=function(_0x14c61b,_0x471f52){this[_0x980d('0xd')][_0x980d('0x1c')](_0x14c61b)[_0x980d('0x15')](function(_0x38470b){_0x471f52(null,_0x38470b?_0x38470b:![]);})[_0x980d('0xf')](function(_0x819fa4){_0x471f52(_0x819fa4);});};AGIVertices[_0x980d('0x10')]['sendMailMessage']=function(_0x3671b8,_0xdc7c43,_0x446cc2){this['mailRpc']['sendMailMessage'](_0x3671b8,_0xdc7c43)[_0x980d('0x15')](function(){_0x446cc2(null);})['catch'](function(_0x3e398){_0x446cc2(_0x3e398);});};AGIVertices['prototype']['getIntervals']=function(_0x5a3160,_0x4b2011){this['rpc']['getIntervalById'](_0x5a3160)['then'](function(_0x1581ee){if(_0x1581ee){if(_0x1581ee[_0x980d('0x1d')]){_0x4b2011(null,[_0x1581ee[_0x980d('0x1e')]]);}else{_0x4b2011(null,_['map'](_0x1581ee[_0x980d('0x1f')],_0x980d('0x1e')));}}else{_0x4b2011(null,![]);}})[_0x980d('0xf')](function(_0x2623d8){_0x4b2011(_0x2623d8);});};AGIVertices[_0x980d('0x10')][_0x980d('0x1a')]=function(_0x2f0081){return util['format'](_0x980d('0x20'),FILES_PATH,_0x2f0081);};AGIVertices[_0x980d('0x10')]['getQueryOdbc']=function(_0x92c9bd,_0x588e89,_0x293f7d){odbc[_0x980d('0x21')](_0x92c9bd,function(_0x41159e){if(_0x41159e){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x41159e);_0x293f7d(_0x41159e);}else{logger['info'](_0x980d('0x22'));odbc['query'](_0x588e89,function(_0x4cda3e,_0x98b1b){if(_0x4cda3e){logger[_0x980d('0x23')](_0x980d('0x24'),_0x588e89);_0x293f7d(_0x4cda3e);}else{logger['info'](_0x980d('0x25'),_0x588e89);odbc[_0x980d('0x26')](function(_0x32f2f9){if(_0x32f2f9){logger[_0x980d('0x27')](_0x980d('0x28'),_0x32f2f9);}_0x293f7d(null,_0x98b1b);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x18f844,_0x5d356d){this['rpc']['getSmsAccountById'](_0x18f844)['then'](function(_0x1c4d89){_0x5d356d(null,_0x1c4d89?_0x1c4d89:![]);})[_0x980d('0xf')](function(_0x8bcd98){_0x5d356d(_0x8bcd98);});};AGIVertices['prototype'][_0x980d('0x29')]=function(_0x439f2a,_0x308466){this[_0x980d('0xd')][_0x980d('0x29')](_0x439f2a)[_0x980d('0x15')](function(_0x1221e7){_0x308466(null,_0x1221e7);})['catch'](function(_0x3baef0){_0x308466(_0x3baef0);});};AGIVertices[_0x980d('0x10')][_0x980d('0x2a')]=function(_0x5f1f04,_0x2a40fd,_0x464d63){this[_0x980d('0xd')][_0x980d('0x2a')]({'uniqueid':this[_0x980d('0xc')][_0x980d('0x2b')],'node':_0x5f1f04[_0x980d('0x2c')],'application':_0x5f1f04['agicommand'],'data':_0x2a40fd||null,'project_name':this[_0x980d('0xc')]['arg_1'],'callerid':this[_0x980d('0xc')][_0x980d('0x2d')]})[_0x980d('0x15')](function(_0x10403d){if(_0x464d63){_0x464d63(null,_0x10403d);}})[_0x980d('0xf')](function(_0x20479d){if(_0x464d63){_0x464d63(_0x20479d);}});};AGIVertices[_0x980d('0x10')][_0x980d('0x2e')]=function(_0x541261,_0x4910f8,_0x2cd7a0,_0x2746db){this[_0x980d('0xd')][_0x980d('0x2e')]({'uniqueid':this[_0x980d('0xc')]['uniqueid'],'callerid':this[_0x980d('0xc')][_0x980d('0x2d')],'calleridname':this['channel'][_0x980d('0x2f')],'context':this[_0x980d('0xc')][_0x980d('0x30')],'extension':this[_0x980d('0xc')][_0x980d('0x31')],'priority':this[_0x980d('0xc')][_0x980d('0x32')],'accountcode':this[_0x980d('0xc')][_0x980d('0x33')],'dnid':this['channel'][_0x980d('0x34')],'projectName':this[_0x980d('0xc')][_0x980d('0x35')],'saveName':_0x4910f8,'filename':_0x541261[_0x980d('0x36')]||_0x4910f8,'savePath':_0x2cd7a0})[_0x980d('0x15')](function(_0x7d0acf){_0x2746db(null,_0x7d0acf);})[_0x980d('0xf')](function(_0x4f0a6e){_0x2746db(_0x4f0a6e);});};AGIVertices[_0x980d('0x10')]['createSquareMessage']=function(_0x33c914,_0x6e16c1,_0x44c97d,_0x84fd0,_0xb1d509){this['rpc'][_0x980d('0x37')]({'uniqueid':this[_0x980d('0xc')][_0x980d('0x2b')],'body':_0x33c914,'direction':_0x6e16c1,'providerName':_0x44c97d,'providerResponse':_0x84fd0})[_0x980d('0x15')](function(_0x35b13c){if(_0xb1d509){_0xb1d509(null,_0x35b13c);}})[_0x980d('0xf')](function(_0x411b3a){if(_0xb1d509){_0xb1d509(_0x411b3a);}});};AGIVertices['prototype']['createCmContact']=function(_0x508663,_0x4e0f93){this[_0x980d('0xd')][_0x980d('0x38')]({'firstName':_[_0x980d('0x39')](_0x508663[_0x980d('0x13')])||_[_0x980d('0x3a')](_0x508663[_0x980d('0x13')])?'callback_'+Math[_0x980d('0x3b')]():_0x508663['name'],'lastName':_[_0x980d('0x39')](_0x508663[_0x980d('0x3c')])||_[_0x980d('0x3a')](_0x508663[_0x980d('0x3c')])?null:_0x508663['lastName'],'phone':_0x508663['phone'],'ListId':_0x508663[_0x980d('0x3d')],'scheduledat':_0x508663[_0x980d('0x3e')],'callbackUniqueid':this[_0x980d('0xc')]['uniqueid'],'tags':'callback','description':_0x980d('0x3f')+_0x508663['scheduledAt'][_0x980d('0x40')](),'priority':_0x508663[_0x980d('0x41')]})[_0x980d('0x15')](function(_0x15427b){_0x4e0f93(null,_0x15427b);})[_0x980d('0xf')](function(_0xf09fdd){_0x4e0f93(_0xf09fdd);});};AGIVertices[_0x980d('0x10')][_0x980d('0x42')]=function(_0x516cd6,_0x556e57){this[_0x980d('0xd')]['getPauseById'](_0x516cd6)[_0x980d('0x15')](function(_0x21cf36){_0x556e57(null,_0x21cf36?_0x21cf36['name']:![]);})[_0x980d('0xf')](function(_0x338128){_0x556e57(_0x338128);});};AGIVertices[_0x980d('0x10')][_0x980d('0x43')]=function(_0x5498aa,_0x2ccfff,_0x5e45c6){var _0x5616ee={'role':_0x980d('0x44')};_0x5616ee[_0x5498aa]=this['channel'][_0x980d('0x2d')];this['rpc'][_0x980d('0x43')](_0x5616ee,_0x2ccfff,this[_0x980d('0xc')]['uniqueid'])[_0x980d('0x15')](function(_0x132495){_0x5e45c6(null,_[_0x980d('0x3a')](_0x132495)?![]:!![]);})[_0x980d('0xf')](function(_0x26a600){logger[_0x980d('0x27')](_0x26a600);_0x5e45c6(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x45')]=function(_0x3190b4,_0x6df3f7){var _0x1f7dc9={'role':_0x980d('0x44')};_0x1f7dc9[_0x3190b4]=this['channel']['callerid'];this['rpc'][_0x980d('0x45')](_0x1f7dc9)['then'](function(_0x153c02){_0x6df3f7(null,_[_0x980d('0x3a')](_0x153c02)?![]:!![]);})[_0x980d('0xf')](function(_0x3d9a3a){logger['error'](_0x3d9a3a);_0x6df3f7(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x46')]=function(_0x585d62,_0x2dce96){var _0x5aebee={'role':_0x980d('0x44')};_0x5aebee[_0x585d62]=this['channel']['callerid'];this[_0x980d('0xd')][_0x980d('0x46')](_0x5aebee)[_0x980d('0x15')](function(_0x16f427){_0x2dce96(null,_['isNil'](_0x16f427)?![]:!![]);})[_0x980d('0xf')](function(_0x5ca660){logger['error'](_0x5ca660);_0x2dce96(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x47')]=function(_0x3bd029,_0x357f77){var _0x1d9e40={'role':_0x980d('0x44')};_0x1d9e40[_0x3bd029]=this[_0x980d('0xc')][_0x980d('0x2d')];var _0x392ec3=_0x3bd029!=_0x980d('0x48')?util['format'](_0x980d('0x49'),'LOCAL',this[_0x980d('0xc')][_0x980d('0x2d')]):undefined;this['rpc'][_0x980d('0x47')](_0x1d9e40,_0x392ec3)[_0x980d('0x15')](function(_0x2aa8d4){_0x357f77(null,_[_0x980d('0x3a')](_0x2aa8d4)?![]:!![]);})['catch'](function(_0x7a900c){logger[_0x980d('0x27')](_0x7a900c);_0x357f77(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x4a')]=function(_0xfcca92,_0x612016){sh[_0x980d('0x4b')](_[_0x980d('0x4c')](_0xfcca92),function(_0x2b4754,_0x3ccee3){var _0x54665f=_0x3ccee3[_0x980d('0x4d')](/(\r\n|\n|\r)/gm,'');_0x612016(null,_0x54665f);});};AGIVertices[_0x980d('0x10')][_0x980d('0x4e')]=function(_0x45731c,_0x42f831){scripts[_0x980d('0x4e')](_0x45731c['apiKey'],_0x45731c['google_cloud_tts_text_type']||_0x980d('0x4f'),_0x45731c[_0x980d('0x4f')],_0x45731c[_0x980d('0x50')]||_0x980d('0x51'),_0x45731c[_0x980d('0x52')]||_0x980d('0x53'),_0x45731c['audioEncoding']||'MP3')['then'](function(_0x255f78){_0x42f831(null,_0x255f78);})['catch'](function(_0x2cb6c7){_0x42f831(_0x2cb6c7);});};AGIVertices[_0x980d('0x10')][_0x980d('0x54')]=function(_0x304047,_0x5037f8){scripts['googleTTS'](_0x304047[_0x980d('0x4f')],_0x304047['google_tts_language']||'en',0x1)[_0x980d('0x15')](function(_0x11a400){_0x5037f8(null,_0x11a400);})[_0x980d('0xf')](function(_0x137869){_0x5037f8(_0x137869);});};AGIVertices['prototype'][_0x980d('0x55')]=function(_0x569c2d,_0x2e2fe1){var _0x30e444={'uri':_0x569c2d[_0x980d('0x56')],'method':_0x569c2d[_0x980d('0x57')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x569c2d['timeout'])===_0x980d('0x58')&&parseInt(_0x569c2d[_0x980d('0x59')])>=0x1?parseInt(_0x569c2d[_0x980d('0x59')])*0x3e8:0x5*0x3e8};if(_[_0x980d('0x5a')]([_0x980d('0x5b'),_0x980d('0x5c')],_0x30e444['method'][_0x980d('0x5d')]())){try{_0x30e444[_0x980d('0x5e')]=_0x569c2d['rawBody']?JSON[_0x980d('0x5f')](_0x569c2d[_0x980d('0x60')]):{};}catch(_0x4fa248){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4fa248);}}try{_0x30e444[_0x980d('0x61')]=_0x569c2d[_0x980d('0x9')]?JSON[_0x980d('0x5f')](_0x569c2d[_0x980d('0x9')]):{};}catch(_0x2da302){logger[_0x980d('0x27')](_0x980d('0x62'),_0x2da302);}if(_0x569c2d[_0x980d('0x63')]){try{var _0x2448e3=require(_0x569c2d[_0x980d('0x63')])['sync'](this,_0x30e444);_0x30e444[_0x980d('0x64')]=Mustache[_0x980d('0x65')](_0x569c2d[_0x980d('0x56')],_0x2448e3,{},['$$','$$']);if(_0x30e444[_0x980d('0x61')]){_0x30e444[_0x980d('0x61')]=JSON[_0x980d('0x5f')](Mustache['render'](JSON['stringify'](_0x30e444[_0x980d('0x61')]),_0x2448e3,{},['$$','$$']));}if(_0x30e444[_0x980d('0x5e')]){_0x30e444['body']=JSON[_0x980d('0x5f')](Mustache[_0x980d('0x65')](JSON[_0x980d('0x66')](_0x30e444[_0x980d('0x5e')]),_0x2448e3,{},['$$','$$']));}}catch(_0x9691){logger[_0x980d('0x27')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x9691);}}rp(_0x30e444)[_0x980d('0x15')](function(_0x464f1f){var _0x3e1a20={'statusCode':_0x464f1f[_0x980d('0x67')]||0xc8,'statusMessage':_0x464f1f['statusMessage']||'OK','headers':_0x464f1f[_0x980d('0x61')]||{},'body':_0x464f1f['body']||{}};_0x2e2fe1(null,_0x3e1a20);})['catch'](function(_0x5251b6){var _0x3964c4={'statusCode':_0x5251b6['statusCode']||0x1f4,'statusMessage':_0x5251b6[_0x980d('0x68')]||_0x980d('0x69'),'headers':_0x5251b6[_0x980d('0x6a')][_0x980d('0x61')]||{},'body':_0x5251b6[_0x980d('0x6a')][_0x980d('0x5e')]||{}};_0x2e2fe1(null,_0x3964c4);});};AGIVertices['prototype'][_0x980d('0x6b')]=function(_0x6b83e9,_0x5ea5e4){scripts[_0x980d('0x6b')](this['channel']['uniqueid'],_0x6b83e9[_0x980d('0x6c')],_0x6b83e9[_0x980d('0x4f')],_0x6b83e9[_0x980d('0x6d')]||'en')[_0x980d('0x15')](function(_0x2f87b5){_0x5ea5e4(null,_0x2f87b5);})[_0x980d('0xf')](function(_0x3fc684){_0x5ea5e4(_0x3fc684);});};AGIVertices[_0x980d('0x10')][_0x980d('0x6e')]=function(_0x3517bd,_0x28dbea){scripts[_0x980d('0x6e')](this[_0x980d('0xc')][_0x980d('0x2b')],_0x3517bd['dialogflowV2_project_id'],_0x3517bd[_0x980d('0x6f')],_0x3517bd['private_key'],_0x3517bd['text'],_0x3517bd[_0x980d('0x70')]||'en')[_0x980d('0x15')](function(_0x1a4a32){_0x28dbea(null,_0x1a4a32);})[_0x980d('0xf')](function(_0x43ad4b){_0x28dbea(_0x43ad4b);});};AGIVertices['prototype'][_0x980d('0x71')]=function(_0x32b16d,_0x29c4ff){scripts['sestekNDA'](this[_0x980d('0xc')],_0x32b16d)[_0x980d('0x15')](function(_0x5182b1){_0x29c4ff(null,_0x5182b1);})[_0x980d('0xf')](function(_0x10e440){_0x29c4ff(_0x10e440);});};AGIVertices[_0x980d('0x10')][_0x980d('0x72')]=function(_0x2683fb,_0x4e0310){scripts[_0x980d('0x72')](_0x2683fb[_0x980d('0x6c')],_0x2683fb[_0x980d('0x4f')],_0x2683fb[_0x980d('0x73')]||_0x980d('0x51'),_0x2683fb['speed'])[_0x980d('0x15')](function(_0x1869dd){_0x4e0310(null,_0x1869dd);})['catch'](function(_0x502df3){_0x4e0310(_0x502df3);});};AGIVertices[_0x980d('0x10')][_0x980d('0x74')]=function(_0x41609a,_0x696240,_0x34c1c4){scripts['ispeechASR'](_0x696240,_0x41609a[_0x980d('0x6c')],_0x41609a['ispeech_asr_language']||_0x980d('0x51'),this[_0x980d('0x75')](_0x41609a[_0x980d('0x76')])?_0x41609a[_0x980d('0x76')]:undefined)['then'](function(_0x2519b3){_0x34c1c4(null,_0x2519b3);})['catch'](function(_0x40ac23){_0x34c1c4(_0x40ac23);});};AGIVertices[_0x980d('0x10')][_0x980d('0x77')]=function(_0x117a45,_0x42dbf0){scripts[_0x980d('0x77')](_0x117a45['aws_access_key_id'],_0x117a45['aws_secret_access_key'],_0x117a45[_0x980d('0x78')],_0x117a45['aws_polly_voice']||_0x980d('0x79'),_0x117a45['text'],_0x117a45[_0x980d('0x7a')]||_0x980d('0x4f'))[_0x980d('0x15')](function(_0x4e4998){_0x42dbf0(null,_0x4e4998);})['catch'](function(_0x267b5c){_0x42dbf0(_0x267b5c);});};AGIVertices[_0x980d('0x10')]['awsLex']=function(_0x5c24c1,_0x1cdf3c){scripts[_0x980d('0x7b')](this[_0x980d('0xc')]['uniqueid'],_0x5c24c1[_0x980d('0x7c')],_0x5c24c1['aws_secret_access_key'],_0x5c24c1['aws_lex_region'],_0x5c24c1[_0x980d('0x4f')],_0x5c24c1['aws_bot_name'])['then'](function(_0x20bf24){_0x1cdf3c(null,_0x20bf24);})['catch'](function(_0x568c99){_0x1cdf3c(_0x568c99);});};AGIVertices['prototype'][_0x980d('0x7d')]=function(_0x2e08c9,_0x1b32a1,_0x2d6103){scripts[_0x980d('0x7d')](_0x1b32a1,_0x2e08c9['key'],_0x2e08c9['google_asr_language']||_0x980d('0x51'))[_0x980d('0x15')](function(_0x197812){_0x2d6103(null,_0x197812);})[_0x980d('0xf')](function(_0x2fa847){_0x2d6103(_0x2fa847);});};AGIVertices[_0x980d('0x10')]['tildeASR']=function(_0x4faa44,_0x1945f8,_0x176cd7){scripts['tildeASR'](_0x1945f8,_0x4faa44[_0x980d('0x7e')],_0x4faa44[_0x980d('0x7f')],_0x4faa44['uri'])[_0x980d('0x15')](function(_0x480145){_0x176cd7(null,_0x480145);})[_0x980d('0xf')](function(_0x215c0b){_0x176cd7(_0x215c0b);});};AGIVertices[_0x980d('0x10')][_0x980d('0x80')]=function(_0x24331c){var _0xb14bd9=_[_0x980d('0x5a')](verticesWithRetry,_0x24331c[_0x980d('0x81')])?_0x24331c:_['clone'](_0x24331c);for(var _0x4cddd2 in _0xb14bd9){if(_0xb14bd9[_0x980d('0x82')](_0x4cddd2)){if(_0xb14bd9[_0x4cddd2]&&_['isString'](_0xb14bd9[_0x4cddd2])){if(_['includes'](recursiveMapAttributes,_0x4cddd2)){_0xb14bd9[_0x4cddd2]=this[_0x980d('0x83')](_0xb14bd9[_0x4cddd2]);}else{_0xb14bd9[_0x4cddd2]=this[_0x980d('0x84')](_0xb14bd9[_0x4cddd2]);}}}}return _0xb14bd9;};AGIVertices[_0x980d('0x10')][_0x980d('0x85')]=function(_0x44446f){for(var _0x640ff1 in _0x44446f){if(_0x44446f[_0x980d('0x82')](_0x640ff1)){if(_[_0x980d('0x86')](_0x44446f[_0x640ff1])){this[_0x980d('0x85')](_0x44446f[_0x640ff1]);}else if(_[_0x980d('0x87')](_0x44446f[_0x640ff1])){for(var _0x380e0d=0x0;_0x380e0d<_0x44446f[_0x640ff1][_0x980d('0x88')];_0x380e0d++){this[_0x980d('0x85')](_0x44446f[_0x640ff1][_0x380e0d]);}}else if(_[_0x980d('0x89')](_0x44446f[_0x640ff1])){_0x44446f[_0x640ff1]=this[_0x980d('0x84')](_0x44446f[_0x640ff1]);}}}};AGIVertices[_0x980d('0x10')][_0x980d('0x8a')]=function(_0x3adb26,_0x5a86a4){for(var _0x3dcbe5 in _0x3adb26){if(_0x3adb26[_0x980d('0x82')](_0x3dcbe5)){if(_[_0x980d('0x86')](_0x3adb26[_0x3dcbe5])){if(!_['isEmpty'](_0x3adb26[_0x3dcbe5])){this['saveRestApiResult'](_0x3adb26[_0x3dcbe5],util[_0x980d('0x8b')](_0x980d('0x8c'),_0x5a86a4,_0x3dcbe5));}}else if(_[_0x980d('0x87')](_0x3adb26[_0x3dcbe5])){for(var _0x585378=0x0;_0x585378<_0x3adb26[_0x3dcbe5]['length'];_0x585378++){this['saveRestApiResult'](_0x3adb26[_0x3dcbe5][_0x585378],util[_0x980d('0x8b')]('%s.%s',_0x5a86a4,_0x3dcbe5+'['+_0x585378+']'));}}else{if(!_['isNil'](_0x3adb26[_0x3dcbe5])){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0x8c'),_0x5a86a4,_0x3dcbe5),_0x3adb26[_0x3dcbe5]);}}}}};AGIVertices[_0x980d('0x10')][_0x980d('0x83')]=function(_0x3d5ff2){try{var _0x37f3d8=JSON[_0x980d('0x5f')](_0x3d5ff2);this[_0x980d('0x85')](_0x37f3d8);return JSON[_0x980d('0x66')](_0x37f3d8);}catch(_0x5a4fa0){return this['replaceAllVariables'](_0x3d5ff2);}};AGIVertices[_0x980d('0x10')]['replaceAllVariables']=function(_0x44923f){var _0x4ec322=_0x44923f['split']('{');for(var _0x35e973=0x1;_0x35e973<_0x4ec322[_0x980d('0x88')];_0x35e973+=0x1){var _0x5f19a6=_0x4ec322[_0x35e973]['split']('}');if(_0x5f19a6['length']>0x1){_0x44923f=_0x44923f[_0x980d('0x8e')]('{'+_0x5f19a6[0x0]+'}',this[_0x980d('0xc')][_0x980d('0x8f')](_0x5f19a6[0x0])[_0x980d('0x90')]||_0x5f19a6[0x0]);}}if(_0x4ec322[_0x980d('0x88')]===0x1){return _0x44923f[_0x980d('0x40')]();}return this[_0x980d('0x84')](_0x44923f);};AGIVertices['prototype'][_0x980d('0x91')]=function(_0xda48eb,_0x47b26d){var _0x4ad23c=this[_0x980d('0xc')][_0x980d('0x8f')](_0xda48eb);if(_0x4ad23c['result']===-0x1){return _0x4ad23c;}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x92'),_0x47b26d,_0x4ad23c['extra']));return this['channel']['setVariable'](_0x47b26d,_0x4ad23c[_0x980d('0x90')]);};AGIVertices['prototype'][_0x980d('0x75')]=function(_0x4a4af4){return _0x4a4af4&&_0x4a4af4!=='0'&&_0x4a4af4!=='-1'&&_0x4a4af4!=='';};AGIVertices['prototype'][_0x980d('0x93')]=function(_0xaf5329){this[_0x980d('0x2a')][_0x980d('0x94')](this,_0xaf5329,'-');_0xaf5329['retry']=_0xaf5329[_0x980d('0x93')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x980d('0x10')][_0x980d('0x95')]=function(_0x109805){logger['info'](util[_0x980d('0x8b')](_0x980d('0x96'),_0x109805[_0x980d('0x2c')]));if(!this['isConfigured'](_0x109805[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}var _0x378ad0='\x22'+_0x109805[_0x980d('0x4f')]+'\x22';if(this['isConfigured'](_0x109805[_0x980d('0x6a')])){_0x378ad0+=','+_0x109805['options'];}var _0x25e223=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x98'),_0x378ad0);if(_0x25e223[_0x980d('0x99')]===-0x1){return _0x25e223;}return this['channel']['noop'](util['format'](_0x980d('0x9a'),_0x378ad0));};AGIVertices[_0x980d('0x10')][_0x980d('0x9b')]=function(_0x4586bf){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x9c'),_0x4586bf[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x4586bf[_0x980d('0x9d')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x9f'));}var _0x2c819b=_0x4586bf[_0x980d('0x9d')];if(this['isConfigured'](_0x4586bf[_0x980d('0x6a')])){_0x2c819b+=','+_0x4586bf[_0x980d('0x6a')];}var _0x1c3670=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0xa0'),_0x2c819b);if(_0x1c3670[_0x980d('0x99')]===-0x1){return _0x1c3670;}var _0x46ac9e=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x980d('0xa1'));if(_0x46ac9e['result']===-0x1){return _0x46ac9e;}var _0x20cfb3=this[_0x980d('0x91')](_0x980d('0xa2'),_0x980d('0xa3'));if(_0x20cfb3['result']===-0x1){return _0x20cfb3;}var _0x1e0321=this['getAndSetVariable']('RECOG_INSTANCE()',_0x980d('0xa4'));if(_0x1e0321[_0x980d('0x99')]===-0x1){return _0x1e0321;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xa5'),_0x2c819b));};AGIVertices[_0x980d('0x10')]['agi']=function(_0x3f7f23){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3f7f23[_0x980d('0x2c')]));return this['channel']['agi']([_0x3f7f23['command'],_0x3f7f23[_0x980d('0xa6')]]);};AGIVertices[_0x980d('0x10')]['answer']=function(_0x425452){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xa7'),_0x425452[_0x980d('0x2c')]));if(this[_0x980d('0x75')](_0x425452[_0x980d('0x59')])){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xa8'),_0x425452[_0x980d('0x59')]));var _0x43d7cc=this[_0x980d('0xc')][_0x980d('0xa9')](_0x425452[_0x980d('0x59')]);if(_0x43d7cc[_0x980d('0x99')]===-0x1){return _0x43d7cc;}}return this['channel'][_0x980d('0xaa')]();};AGIVertices['prototype']['callback']=function(_0x576f44){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x576f44[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x576f44[_0x980d('0x3d')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x576f44,_0x980d('0xab'));}_0x576f44[_0x980d('0x3e')]=moment();if(this['isConfigured'](_0x576f44[_0x980d('0xac')])){_0x576f44[_0x980d('0x3e')]=moment()[_0x980d('0xad')](_0x576f44[_0x980d('0xac')],_0x980d('0xae'));}if(!this[_0x980d('0x75')](_0x576f44[_0x980d('0x41')])){_0x576f44[_0x980d('0x41')]=0x2;}this[_0x980d('0x38')]['sync'](this,_0x576f44);return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xaf'),_0x576f44[_0x980d('0xb0')],_0x576f44[_0x980d('0x3d')],_0x576f44[_0x980d('0x3e')]));};AGIVertices['prototype']['custom_app']=function(_0x16fe6f){logger['info'](util[_0x980d('0x8b')](_0x980d('0xb1'),_0x16fe6f[_0x980d('0x2c')]));var _0x3032e8=this[_0x980d('0xc')]['exec'](_0x16fe6f['application'],_0x16fe6f[_0x980d('0x6a')]);if(_0x3032e8[_0x980d('0x99')]===-0x1){return _0x3032e8;}return this['channel'][_0x980d('0x9e')](util['format'](_0x980d('0xb2'),_0x16fe6f[_0x980d('0xb3')],_0x16fe6f['options']));};AGIVertices[_0x980d('0x10')][_0x980d('0xb4')]=function(_0x29d52b){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xb5'),_0x29d52b[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x29d52b[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}var _0x15bb84='\x22'+_0x29d52b[_0x980d('0x4f')]+'\x22';if(this['isConfigured'](_0x29d52b['options'])){_0x15bb84+=','+_0x29d52b[_0x980d('0x6a')];}var _0x5c2780=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x98'),_0x15bb84);if(_0x5c2780[_0x980d('0x99')]===-0x1){return _0x5c2780;}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x9a'),_0x15bb84));};AGIVertices['prototype'][_0x980d('0xb6')]=function(_0x37534f){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xb7'),_0x37534f[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x37534f[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}var _0x3baaf2='\x22'+_0x37534f[_0x980d('0x4f')]+'\x22';if(this[_0x980d('0x75')](_0x37534f['options'])){_0x3baaf2+=','+_0x37534f[_0x980d('0x6a')];}var _0x228454=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x98'),_0x3baaf2);if(_0x228454['result']===-0x1){return _0x228454;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x9a'),_0x3baaf2));};AGIVertices[_0x980d('0x10')][_0x980d('0xb8')]=function(_0x2a3ac7){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xb9'),_0x2a3ac7[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x2a3ac7[_0x980d('0x9d')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x9f'));}var _0x1da00e=_0x2a3ac7[_0x980d('0x9d')];if(this[_0x980d('0x75')](_0x2a3ac7[_0x980d('0x6a')])){_0x1da00e+=','+_0x2a3ac7[_0x980d('0x6a')];}var _0x17743a=this['channel'][_0x980d('0x4b')](_0x980d('0xa0'),_0x1da00e);if(_0x17743a['result']===-0x1){return _0x17743a;}var _0xaf23c1=this['getAndSetVariable'](_0x980d('0xba'),_0x980d('0xbb'));if(_0xaf23c1[_0x980d('0x99')]===-0x1){return _0xaf23c1;}var _0x28c142=this[_0x980d('0x91')](_0x980d('0xa2'),_0x980d('0xbc'));if(_0x28c142[_0x980d('0x99')]===-0x1){return _0x28c142;}var _0x4179bb=this[_0x980d('0x91')](_0x980d('0xbd'),'LUMENVOX_ASR_INSTANCE');if(_0x4179bb[_0x980d('0x99')]===-0x1){return _0x4179bb;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xa5'),_0x1da00e));};AGIVertices[_0x980d('0x10')]['sestekasr']=function(_0x4c11a9){logger[_0x980d('0x23')](util['format'](_0x980d('0xbe'),_0x4c11a9['label']));if(!this['isConfigured'](_0x4c11a9[_0x980d('0x9d')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x9f'));}var _0x5b3ca7=_0x4c11a9[_0x980d('0x9d')];if(this['isConfigured'](_0x4c11a9[_0x980d('0x6a')])){_0x5b3ca7+=','+_0x4c11a9['options'];}var _0x337c1e=this['channel']['exec'](_0x980d('0xa0'),_0x5b3ca7);if(_0x337c1e[_0x980d('0x99')]===-0x1){return _0x337c1e;}var _0x365377=this[_0x980d('0x91')](_0x980d('0xba'),_0x980d('0xbf'));if(_0x365377[_0x980d('0x99')]===-0x1){return _0x365377;}var _0x22a62a=this['getAndSetVariable']('RECOG_INPUT()',_0x980d('0xc0'));if(_0x22a62a[_0x980d('0x99')]===-0x1){return _0x22a62a;}var _0x1767f4=this['getAndSetVariable']('RECOG_INSTANCE()',_0x980d('0xc1'));if(_0x1767f4[_0x980d('0x99')]===-0x1){return _0x1767f4;}return this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0xa5'),_0x5b3ca7));};AGIVertices[_0x980d('0x10')][_0x980d('0xc2')]=function(_0x338af7){logger['info'](util[_0x980d('0x8b')](_0x980d('0xc3'),_0x338af7[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x338af7[_0x980d('0xc4')])){return this['channel'][_0x980d('0x27')](_0x338af7,'no\x20database\x20selected');}var _0x26cda2=this[_0x980d('0x16')][_0x980d('0x94')](this,_0x338af7['odbc_id']);if(!_0x26cda2){return this[_0x980d('0xc')][_0x980d('0x27')](_0x338af7,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x338af7[_0x980d('0xc5')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x338af7,_0x980d('0xc6'));}var _0x587a70=_0x338af7['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('query:\x20%s',_0x587a70));var _0x2c00c2=this[_0x980d('0xc7')][_0x980d('0x94')](this,_0x26cda2,_0x587a70);this['createSquareDetailsReport'][_0x980d('0x94')](this,_0x338af7,_0x587a70);if(!this[_0x980d('0x75')](_0x338af7['variable_id'])){return this['channel'][_0x980d('0x9e')](_0x980d('0xc8'));}var _0x1a52d3=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x338af7[_0x980d('0xc9')]);if(!_0x1a52d3){return this['channel'][_0x980d('0x27')](_0x338af7,_0x980d('0xca'));}var _0x55739c=this;_0x2c00c2['forEach'](function(_0x4a1ee9,_0x43bc29){Object[_0x980d('0xcb')](_0x4a1ee9)[_0x980d('0xcc')](function(_0x248b73){_0x55739c[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0xcd'),_0x1a52d3,_0x43bc29,_0x248b73),_0x4a1ee9[_0x248b73]);});});this[_0x980d('0xc')]['setVariable'](util[_0x980d('0x8b')](_0x980d('0xce'),_0x1a52d3),_0x2c00c2[_0x980d('0x88')]);return this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0xcf'),_0x1a52d3));};AGIVertices[_0x980d('0x10')][_0x980d('0xd0')]=function(_0x433e62){logger[_0x980d('0xd1')](util[_0x980d('0x8b')](_0x980d('0xd2'),_0x433e62[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x433e62[_0x980d('0xd3')])){return this[_0x980d('0xc')]['error'](_0x433e62,_0x980d('0xd4'));}var _0x52bdcb=this['getUser']['sync'](this,_0x433e62[_0x980d('0xd3')]);if(!_0x52bdcb){return this[_0x980d('0xc')][_0x980d('0x27')](_0x433e62,_0x980d('0xd5'));}var _0x35e1e2=this['channel']['exec'](_0x980d('0xd6'),[util[_0x980d('0x8b')](_0x980d('0xd7'),_0x52bdcb),_0x433e62[_0x980d('0x59')],_0x433e62[_0x980d('0xd8')],_0x433e62[_0x980d('0x56')]]);if(_0x35e1e2['result']===-0x1){return _0x35e1e2;}return this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0xd9'),_0x980d('0xd6')));};AGIVertices[_0x980d('0x10')][_0x980d('0xda')]=function(_0x5dfd41){logger['info'](util['format'](_0x980d('0xdb'),_0x5dfd41[_0x980d('0x2c')]));if(!this['isConfigured'](_0x5dfd41[_0x980d('0x6c')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x5dfd41[_0x980d('0x4f')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20text\x20configured');}this[_0x980d('0xc')][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x5dfd41);this['createSquareMessage'](_0x5dfd41[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xdd'),_0x5dfd41[_0x980d('0x4f')]));var _0x3434c8=this['googleDialogflow'][_0x980d('0x94')](this,_0x5dfd41);if(_0x3434c8){for(var _0x2c3e0e in _0x3434c8){if(_0x3434c8['hasOwnProperty'](_0x2c3e0e)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')]('DIALOGFLOW_%s',_0x2c3e0e['toUpperCase']()),_0x3434c8[_0x2c3e0e]);}}this[_0x980d('0x37')](_0x3434c8[_0x980d('0xde')],_0x980d('0xdf'),_0x980d('0xda'),'');return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xe0'),_0x3434c8['speech']));}return this[_0x980d('0xc')][_0x980d('0x27')](_0x5dfd41,_0x980d('0xe1'));};AGIVertices[_0x980d('0x10')][_0x980d('0xe2')]=function(_0x1d0c0a){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1d0c0a[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1d0c0a[_0x980d('0xe3')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe4'));}if(!this['isConfigured'](_0x1d0c0a[_0x980d('0x6f')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe5'));}if(!this['isConfigured'](_0x1d0c0a[_0x980d('0xe6')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe7'));}if(!this[_0x980d('0x75')](_0x1d0c0a['dialogflowV2_language'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe8'));}if(!this[_0x980d('0x75')](_0x1d0c0a[_0x980d('0x4f')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x1d0c0a);this[_0x980d('0x37')](_0x1d0c0a[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0xe9'),_0x1d0c0a[_0x980d('0x4f')]));var _0x1b6670=this['googleDialogflowV2'][_0x980d('0x94')](this,_0x1d0c0a);if(_0x1b6670){for(var _0xa487e0 in _0x1b6670){if(_0x1b6670[_0x980d('0x82')](_0xa487e0)){if(_0xa487e0!=='providerResponse'){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0xea'),_0xa487e0[_0x980d('0x5d')]()),_0x1b6670[_0xa487e0]);}}}this['createSquareMessage'](_0x1b6670['speech'],_0x980d('0xdf'),_0x980d('0xe2'),_0x1b6670[_0x980d('0xeb')]);return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xec'),_0x1b6670['speech']));}return this[_0x980d('0xc')][_0x980d('0x27')](_0x1d0c0a,_0x980d('0xed'));};AGIVertices[_0x980d('0x10')][_0x980d('0xee')]=function(_0x1e1ad4){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1e1ad4[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1e1ad4[_0x980d('0xef')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x980d('0x75')](_0x1e1ad4[_0x980d('0xf0')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xf1'));}if(!this[_0x980d('0x75')](_0x1e1ad4['password'])){return this['channel'][_0x980d('0x9e')](_0x980d('0xf2'));}if(!this[_0x980d('0x75')](_0x1e1ad4[_0x980d('0xf3')])){return this['channel'][_0x980d('0x9e')]('no\x20text\x20configured');}this['channel'][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x1e1ad4);this[_0x980d('0x37')](_0x1e1ad4[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xf4'),_0x1e1ad4[_0x980d('0x4f')]));var _0x10c65a=this['sestekNDA'][_0x980d('0x94')](this,_0x1e1ad4);if(_0x10c65a){for(var _0x19ac24 in _0x10c65a){if(_0x10c65a['hasOwnProperty'](_0x19ac24)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0xf5'),_0x19ac24[_0x980d('0x5d')]()),_0x10c65a[_0x19ac24]);}}this[_0x980d('0x37')](_0x10c65a[_0x980d('0xde')],_0x980d('0xdf'),'sesteknda','');if(_0x10c65a['audiofile']){this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x10c65a['audiofile']));var _0x1577b1=this[_0x980d('0xc')]['streamFile'](_0x10c65a[_0x980d('0xf6')]);try{fs['unlink'](_0x10c65a['audiofile']+_0x980d('0xf7'));}catch(_0x46061d){logger[_0x980d('0x27')](_0x46061d);}return _0x1577b1;}else{return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xf8'),_0x10c65a[_0x980d('0xde')]));}}return this[_0x980d('0xc')][_0x980d('0x27')](_0x1e1ad4,_0x980d('0xf9'));};AGIVertices['prototype'][_0x980d('0xfa')]=function(_0x505ed7){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xfb'),_0x505ed7[_0x980d('0x2c')]));return this[_0x980d('0xc')]['noop'](_0x980d('0xfa'));};AGIVertices[_0x980d('0x10')][_0x980d('0xfc')]=function(_0xfc4fe0){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xfd'),_0xfc4fe0[_0x980d('0x2c')]));var _0x9c8734='';if(_0xfc4fe0[_0x980d('0xfe')]){if(!this['isConfigured'](_0xfc4fe0[_0x980d('0xfe')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0xfc4fe0,_0x980d('0xff'));}else{var _0x2bd4b3=parseInt(_0xfc4fe0['trunk_id'],0xa);if(isNaN(_0x2bd4b3)){_0x9c8734=_0xfc4fe0[_0x980d('0xfe')];}else{_0x9c8734=this[_0x980d('0x100')][_0x980d('0x94')](this,_0xfc4fe0['trunk_id']);if(!_0x9c8734){return this[_0x980d('0xc')]['error'](_0xfc4fe0,_0x980d('0x101'));}}}}else if(_0xfc4fe0['trunk_name']){_0x9c8734=_0xfc4fe0[_0x980d('0x102')];}else{return this['channel'][_0x980d('0x27')](_0xfc4fe0,'no\x20trunk\x20selected');}var _0x38b016=this[_0x980d('0xc')][_0x980d('0x4b')]('DIAL',[util[_0x980d('0x8b')]('SIP/%s/%s',_0x9c8734,_0xfc4fe0[_0x980d('0xb0')]),_0xfc4fe0[_0x980d('0x59')],_0xfc4fe0[_0x980d('0xd8')],_0xfc4fe0[_0x980d('0x56')]]);if(_0x38b016[_0x980d('0x99')]===-0x1){return _0x38b016;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xd9'),_0x980d('0xd6')));};AGIVertices[_0x980d('0x10')][_0x980d('0x103')]=function(_0x1c9eed){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1c9eed[_0x980d('0x2c')]));return this['channel'][_0x980d('0x9e')](_0x980d('0x103'));};AGIVertices[_0x980d('0x10')][_0x980d('0xa')]=function(_0x40c88a){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x104'),_0x40c88a[_0x980d('0x2c')]));if(_0x40c88a[_0x980d('0x105')]===0x0){return this[_0x980d('0x93')](_0x40c88a);}_0x40c88a['retry']-=0x1;if(!this['isConfigured'](_0x40c88a['file_id'])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x40c88a,'no\x20file\x20audio\x20selected');}var _0x2acfde=this['getSound']['sync'](this,_0x40c88a['file_id']);if(!_0x2acfde){return this[_0x980d('0xc')][_0x980d('0x27')](_0x40c88a,_0x980d('0x106'));}if(!this[_0x980d('0x75')](_0x40c88a[_0x980d('0xc9')])){return this['channel'][_0x980d('0x27')](_0x980d('0xc8'));}var _0xf2e45=this[_0x980d('0xc')][_0x980d('0x107')](_0x2acfde,_0x40c88a[_0x980d('0x108')],_0x40c88a[_0x980d('0x109')]);var _0x539afc=_0xf2e45['result']?_0xf2e45[_0x980d('0x99')]['toString']():'';logger[_0x980d('0x23')](_0x980d('0x10a'),JSON['stringify'](_0xf2e45));if(_0xf2e45['result']===-0x1){this[_0x980d('0x2a')]['sync'](this,_0x40c88a,_0x539afc);return _0xf2e45;}else if(_0xf2e45[_0x980d('0x90')]===_0x980d('0x59')){_0xf2e45['result']=_0x539afc[_0x980d('0x88')]>=parseInt(_0x40c88a[_0x980d('0x10b')])?'x':'i';}else{_0xf2e45[_0x980d('0x99')]=_0x539afc[_0x980d('0x88')]>=parseInt(_0x40c88a[_0x980d('0x10b')])&&_0x539afc[_0x980d('0x88')]<=parseInt(_0x40c88a[_0x980d('0x109')])?'x':'i';}var _0x14e2e3=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x40c88a['variable_id']);if(!_0x14e2e3){return this[_0x980d('0xc')][_0x980d('0x27')](_0x40c88a,_0x980d('0xca'));}this[_0x980d('0xc')]['setVariable'](_0x14e2e3,_0x539afc);if(this[_0x980d('0x75')](_0x40c88a[_0x980d('0x10c')])){var _0x5a603d=parseInt(_0x40c88a[_0x980d('0x10c')],0xa);var _0x1dd664=rs[_0x980d('0x10d')]({'charset':'*','length':_0x5a603d});var _0x11e428=_0x539afc[_0x980d('0x88')];if(_0x11e428>0x0){if(_0x11e428>_0x5a603d){this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x40c88a,_0x40c88a[_0x980d('0x10e')]==='first'?_0x1dd664+_0x539afc[_0x980d('0x10f')](_0x5a603d):_0x539afc[_0x980d('0x10f')](0x0,_0x11e428-_0x5a603d)+_0x1dd664);}else{this[_0x980d('0x2a')]['sync'](this,_0x40c88a,rs[_0x980d('0x10d')]({'charset':'*','length':_0x11e428}));}}else{this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x40c88a,'');}}else{this[_0x980d('0x2a')]['sync'](this,_0x40c88a,_0x539afc);}return _0xf2e45;};AGIVertices[_0x980d('0x10')]['getsecretdigits']=function(_0x777136){logger['info'](util['format'](_0x980d('0x110'),_0x777136[_0x980d('0x2c')]));return this[_0x980d('0xa')](_0x777136);};AGIVertices['prototype'][_0x980d('0x111')]=function(_0x3e2fb5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x112'),_0x3e2fb5[_0x980d('0x2c')]));this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x3e2fb5,_0x3e2fb5[_0x980d('0x113')]);return this['channel']['noop'](util[_0x980d('0x8b')](_0x980d('0x114'),_0x3e2fb5[_0x980d('0x113')]));};AGIVertices[_0x980d('0x10')][_0x980d('0x115')]=function(_0x200f84){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x116'),_0x200f84[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x200f84['aws_access_key_id'])||!this['isConfigured'](_0x200f84['aws_secret_access_key'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x117'));}if(!this[_0x980d('0x75')](_0x200f84[_0x980d('0x4f')])){return this['channel'][_0x980d('0x9e')]('no\x20text\x20configured');}this[_0x980d('0xc')]['noop'](util['format'](_0x980d('0x118'),_0x200f84[_0x980d('0x4f')]));var _0x335cee=this[_0x980d('0x77')][_0x980d('0x94')](this,_0x200f84);if(_0x335cee){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')]('aws\x20Polly\x20%s\x20file\x20created',_0x335cee));var _0x27c8ca=this[_0x980d('0xc')][_0x980d('0x119')](_0x335cee);try{fs[_0x980d('0x11a')](_0x335cee+_0x980d('0xf7'));}catch(_0x17a8f8){logger[_0x980d('0x27')](_0x17a8f8);}return _0x27c8ca;}return this[_0x980d('0xc')]['error'](_0x200f84,_0x980d('0x11b'));};AGIVertices[_0x980d('0x10')][_0x980d('0x11c')]=function(_0x48422b){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x11d'),_0x48422b[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x48422b['aws_access_key_id'])||!this[_0x980d('0x75')](_0x48422b['aws_secret_access_key'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x117'));}if(!this[_0x980d('0x75')](_0x48422b[_0x980d('0x11e')])){return this['channel']['noop'](_0x980d('0x11f'));}if(!this[_0x980d('0x75')](_0x48422b[_0x980d('0x4f')])){return this['channel'][_0x980d('0x9e')](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x48422b);this[_0x980d('0x37')](_0x48422b[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x120'),_0x48422b['text']));var _0x5cb23e=this['awsLex']['sync'](this,_0x48422b);if(_0x5cb23e){for(var _0x86e1e5 in _0x5cb23e){if(_0x5cb23e[_0x980d('0x82')](_0x86e1e5)&&_[_0x980d('0x89')](_0x5cb23e[_0x86e1e5])){this['channel'][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0x121'),_0x86e1e5[_0x980d('0x5d')]()),_0x5cb23e[_0x86e1e5]);}}if(_[_0x980d('0x3a')](_0x5cb23e[_0x980d('0x68')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x122'));}else{this['createSquareMessage'](_0x5cb23e[_0x980d('0x68')],_0x980d('0xdf'),_0x980d('0x123'),'');return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x124'),_0x5cb23e['message']));}}return this[_0x980d('0xc')]['error'](_0x48422b,_0x980d('0x125'));};AGIVertices['prototype'][_0x980d('0x126')]=function(_0x91ec0d){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x91ec0d[_0x980d('0x2c')],_0x91ec0d[_0x980d('0x59')]));if(!this[_0x980d('0x75')](_0x91ec0d[_0x980d('0x6c')])){return this[_0x980d('0xc')]['noop']('no\x20key\x20configured');}var _0x55af08=_0x980d('0x127');var _0x4f81a8=util[_0x980d('0x8b')]('%s/recordings/%s',FILES_PATH,rs[_0x980d('0x10d')](0x4));var _0x5be7bf=util['format'](_0x980d('0x8c'),_0x4f81a8,_0x55af08);var _0x490175=!![];if(_0x91ec0d['beep']===_0x980d('0x128')){_0x490175=![];}var _0xd45ad8=this[_0x980d('0xc')]['recordFile'](_0x4f81a8,_0x55af08,_0x91ec0d['intKey'],_0x91ec0d[_0x980d('0x59')],undefined,_0x490175);if(_0xd45ad8[_0x980d('0x99')]!==-0x1){this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x129'),_0x5be7bf));var _0x35bf0e=this['googleASR']['sync'](this,_0x91ec0d,_0x5be7bf);if(_0x35bf0e){for(var _0x477260 in _0x35bf0e){if(_0x35bf0e[_0x980d('0x82')](_0x477260)){this[_0x980d('0xc')]['setVariable'](util['format'](_0x980d('0x12a'),_0x477260[_0x980d('0x5d')]()),_0x35bf0e[_0x477260]);}}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x35bf0e)));}}return _0xd45ad8;};AGIVertices[_0x980d('0x10')][_0x980d('0x12b')]=function(_0x58fd17){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x12c'),_0x58fd17['label']));if(!this[_0x980d('0x75')](_0x58fd17[_0x980d('0x7e')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x12d'));}if(!this['isConfigured'](_0x58fd17[_0x980d('0x7f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x12e'));}var _0x113454=_0x980d('0x127');var _0xe1c7f4=util[_0x980d('0x8b')](_0x980d('0x12f'),FILES_PATH,rs[_0x980d('0x10d')](0x4));var _0x5e26d3=util['format'](_0x980d('0x8c'),_0xe1c7f4,_0x113454);var _0x2c6102=!![];if(_0x58fd17['beep']===_0x980d('0x128')){_0x2c6102=![];}var _0x4458be=this['channel'][_0x980d('0x130')](_0xe1c7f4,_0x113454,_0x58fd17[_0x980d('0x131')],_0x58fd17['timeout'],undefined,_0x2c6102);if(_0x4458be[_0x980d('0x99')]!==-0x1){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x132'),_0x5e26d3));var _0x32ab32=this[_0x980d('0x133')]['sync'](this,_0x58fd17,_0x5e26d3);if(_0x32ab32){for(var _0x53125c in _0x32ab32){if(_0x32ab32[_0x980d('0x82')](_0x53125c)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')]('TILDE_ASR_%s',_0x53125c[_0x980d('0x5d')]()),_0x32ab32[_0x53125c]);}}return this['channel']['noop'](util[_0x980d('0x8b')](_0x980d('0x134'),JSON['stringify'](_0x32ab32)));}}return _0x4458be;};AGIVertices[_0x980d('0x10')][_0x980d('0x135')]=function(_0x3512ee){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x136'),_0x3512ee['label']));return this[_0x980d('0xc')][_0x980d('0x137')](_0x3512ee[_0x980d('0x30')],_0x3512ee[_0x980d('0x31')],_0x3512ee[_0x980d('0x32')]);};AGIVertices[_0x980d('0x10')][_0x980d('0x138')]=function(_0x9d35e1){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x139'),_0x9d35e1[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x9d35e1[_0x980d('0x13a')])){return this['channel'][_0x980d('0x27')](_0x9d35e1,_0x980d('0x13b'));}try{var _0x45b6ae=eval(_0x9d35e1[_0x980d('0x13a')])?_0x980d('0x13c'):_0x980d('0x13d');this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x13e'),_0x9d35e1[_0x980d('0x13a')],_0x45b6ae));return{'code':0xc8,'result':_0x45b6ae};}catch(_0x4e5e9a){return{'code':0xc8,'result':_0x980d('0x13d')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x13f')]=function(_0x173538){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x140'),_0x173538[_0x980d('0x2c')]));if(!this['isConfigured'](_0x173538[_0x980d('0x141')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x173538,_0x980d('0x142'));}var _0x27066e=this['getIntervals']['sync'](this,_0x173538['interval_id']);if(!_0x27066e){return this[_0x980d('0xc')][_0x980d('0x27')](_0x173538,_0x980d('0x143'));}for(var _0x1d84a4=0x0;_0x1d84a4<_0x27066e[_0x980d('0x88')];_0x1d84a4+=0x1){var _0x335e4d=this[_0x980d('0xc')][_0x980d('0x8f')](util[_0x980d('0x8b')](_0x980d('0x144'),_0x27066e[_0x1d84a4]));if(_0x335e4d[_0x980d('0x99')]===-0x1){return _0x335e4d;}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],_0x335e4d[_0x980d('0x90')]));if(_0x335e4d[_0x980d('0x90')]===_0x980d('0x13c')){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],'true'));this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],_0x980d('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0x980d('0x23')](util['format']('IFTIME\x20%s\x20%s',_0x27066e[_0x1d84a4],'false'));this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],_0x980d('0x13d')));}}return{'code':0xc8,'result':_0x980d('0x13d')};};AGIVertices[_0x980d('0x10')][_0x980d('0x146')]=function(_0xf68b8c){logger[_0x980d('0x23')](util['format'](_0x980d('0x147'),_0xf68b8c[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x146')]();};AGIVertices['prototype'][_0x980d('0x148')]=function(_0x482ad5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x149'),_0x482ad5['label']));if(!this[_0x980d('0x75')](_0x482ad5['key'])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20key\x20configured');}var _0x217a8e=_0x980d('0x127');var _0x1aaf04=util['format'](_0x980d('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x57a7d3=util['format'](_0x980d('0x8c'),_0x1aaf04,_0x217a8e);var _0x451391=!![];if(_0x482ad5['beep']===_0x980d('0x128')){_0x451391=![];}var _0x480a98=this[_0x980d('0xc')]['recordFile'](_0x1aaf04,_0x217a8e,_0x482ad5[_0x980d('0x131')],_0x482ad5[_0x980d('0x59')],undefined,_0x451391);if(_0x480a98['result']!==-0x1){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x14a'),_0x57a7d3));var _0x1b79e1=this[_0x980d('0x74')][_0x980d('0x94')](this,_0x482ad5,_0x57a7d3);if(_0x1b79e1){for(var _0x4af843 in _0x1b79e1){if(_0x1b79e1[_0x980d('0x82')](_0x4af843)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')]('ISPEECH_ASR_%s',_0x4af843[_0x980d('0x5d')]()),_0x1b79e1[_0x4af843]);}}return this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x14b'),JSON[_0x980d('0x66')](_0x1b79e1)));}}return _0x480a98;};AGIVertices[_0x980d('0x10')][_0x980d('0x14c')]=function(_0x4c156a){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4c156a[_0x980d('0x2c')]));if(!this['isConfigured'](_0x4c156a['key'])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x980d('0x75')](_0x4c156a[_0x980d('0x4f')])){return this['channel'][_0x980d('0x9e')](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x14d'),_0x4c156a[_0x980d('0x4f')]));var _0x58fa54=this['ispeechTTS'][_0x980d('0x94')](this,_0x4c156a);if(_0x58fa54){this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0x14a'),_0x58fa54));var _0x51c6ae=this[_0x980d('0xc')][_0x980d('0x119')](_0x58fa54,_0x4c156a['intKey']);try{fs[_0x980d('0x11a')](_0x58fa54+_0x980d('0xf7'));}catch(_0x3c4964){logger[_0x980d('0x27')](_0x3c4964);}return _0x51c6ae;}return this[_0x980d('0xc')][_0x980d('0x27')](_0x4c156a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x980d('0x14e')]=function(_0x3c9dc5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x14f'),_0x3c9dc5[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x3c9dc5[_0x980d('0x150')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x3c9dc5,_0x980d('0x151'));}logger[_0x980d('0x23')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x980d('0xc')]['callerid'],_0x3c9dc5[_0x980d('0x150')]));var _0xa743ba=this[_0x980d('0x47')][_0x980d('0x94')](this,_0x3c9dc5[_0x980d('0x150')]);if(_0xa743ba){logger[_0x980d('0x23')](util['format'](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x3c9dc5['findBy']));this[_0x980d('0xc')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x980d('0xc')]['callerid'],_0x3c9dc5[_0x980d('0x150')]));return{'code':0xc8,'result':_0x980d('0x153')};}else{logger['info'](util[_0x980d('0x8b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x980d('0x2d')],_0x3c9dc5[_0x980d('0x150')]));this[_0x980d('0xc')]['noop'](util['format'](_0x980d('0x154'),this['channel'][_0x980d('0x2d')],_0x3c9dc5[_0x980d('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x980d('0x10')][_0x980d('0x155')]=function(_0x1d1c63){logger[_0x980d('0x23')](util['format'](_0x980d('0x156'),_0x1d1c63[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1d1c63[_0x980d('0x150')])){return this['channel'][_0x980d('0x27')](_0x1d1c63,_0x980d('0x151'));}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x157'),this['channel'][_0x980d('0x2d')],_0x1d1c63[_0x980d('0x150')]));var _0x434620=this[_0x980d('0x46')][_0x980d('0x94')](this,_0x1d1c63[_0x980d('0x150')]);if(_0x434620){logger[_0x980d('0x23')](util['format'](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x1d1c63['findBy']));this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0x152'),this['channel']['callerid'],_0x1d1c63[_0x980d('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x154'),this['channel'][_0x980d('0x2d')],_0x1d1c63['findBy']));this[_0x980d('0xc')][_0x980d('0x9e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x980d('0xc')][_0x980d('0x2d')],_0x1d1c63['findBy']));return{'code':0xc8,'result':_0x980d('0x158')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x159')]=function(_0x2e86bf){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2e86bf['label']));if(!this[_0x980d('0x75')](_0x2e86bf[_0x980d('0x15a')])){return this[_0x980d('0xc')]['error'](_0x2e86bf,_0x980d('0x15b'));}this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')]('math\x20%s',_0x2e86bf[_0x980d('0x15a')]));var _0x245baf=eval(_0x2e86bf['operation']);if(!this[_0x980d('0x75')](_0x2e86bf[_0x980d('0xc9')])){return this[_0x980d('0xc')]['noop'](_0x980d('0xc8'));}var _0x5ec2dc=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x2e86bf[_0x980d('0xc9')]);if(!_0x5ec2dc){return this[_0x980d('0xc')][_0x980d('0x27')](_0x2e86bf,'no\x20variable\x20found');}if(_['isArray'](_0x245baf)){var _0x415230=this;_0x245baf['forEach'](function(_0x1ee38e,_0x5d70b4){_0x415230['channel']['setVariable'](util[_0x980d('0x8b')](_0x980d('0x15c'),_0x5ec2dc,_0x5d70b4),_0x1ee38e);});return this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x15d'),_0x5ec2dc));}else{return this['channel']['setVariable'](_0x5ec2dc,_0x245baf);}};AGIVertices[_0x980d('0x10')][_0x980d('0x15e')]=function(_0x208e7a){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x208e7a[_0x980d('0x2c')]));if(_0x208e7a[_0x980d('0x105')]===0x0){return this[_0x980d('0x93')](_0x208e7a);}_0x208e7a['retry']-=0x1;if(!this[_0x980d('0x75')](_0x208e7a[_0x980d('0x15f')])){return this['channel'][_0x980d('0x27')](_0x208e7a,'no\x20file\x20audio\x20selected');}var _0x1f7565=this['getSound'][_0x980d('0x94')](this,_0x208e7a[_0x980d('0x15f')]);if(!_0x1f7565){return this[_0x980d('0xc')][_0x980d('0x27')](_0x208e7a,'no\x20file\x20audio\x20found');}var _0x248987=this['channel']['getData'](_0x1f7565,_0x208e7a[_0x980d('0x108')],_0x208e7a[_0x980d('0x160')]);var _0x317c4e=_0x248987[_0x980d('0x99')];if(_0x248987[_0x980d('0x99')]===-0x1){this[_0x980d('0x2a')]['sync'](this,_0x208e7a,'-1');return _0x248987;}else if(_0x248987[_0x980d('0x90')]===_0x980d('0x59')){_0x248987[_0x980d('0x99')]=_0x248987['result'][_0x980d('0x88')]>0x0?_0x248987[_0x980d('0x99')]:'t';}else if(_[_0x980d('0x39')](_0x248987[_0x980d('0x99')])){_0x248987[_0x980d('0x99')]='#';_0x317c4e='#';}if(!this[_0x980d('0x75')](_0x208e7a[_0x980d('0xc9')])){this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x492342=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x208e7a[_0x980d('0xc9')]);if(!_0x492342){return this[_0x980d('0xc')]['error'](_0x208e7a,_0x980d('0xca'));}this[_0x980d('0xc')][_0x980d('0x8d')](_0x492342,_0x317c4e);}this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x208e7a,_0x317c4e);return _0x248987;};AGIVertices['prototype'][_0x980d('0x9e')]=function(_0x34b109){logger[_0x980d('0x23')](util['format'](_0x980d('0x161'),_0x34b109[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x9e')](_0x34b109[_0x980d('0x162')]||_0x34b109[_0x980d('0x2c')]);};AGIVertices['prototype'][_0x980d('0x163')]=function(_0x1795d1){logger['info'](util[_0x980d('0x8b')](_0x980d('0x164'),_0x1795d1[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1795d1[_0x980d('0x150')])){return this['channel']['error'](_0x1795d1,'no\x20find\x20by\x20configured');}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x157'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x1795d1[_0x980d('0x150')]));var _0x268b85=this[_0x980d('0x42')][_0x980d('0x94')](this,_0x1795d1['pause_id']);var _0x24a015=this[_0x980d('0x43')][_0x980d('0x94')](this,_0x1795d1[_0x980d('0x150')],_0x268b85);if(_0x24a015){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x1795d1[_0x980d('0x150')]));this['channel'][_0x980d('0x9e')](util['format'](_0x980d('0x152'),this['channel'][_0x980d('0x2d')],_0x1795d1['findBy']));return{'code':0xc8,'result':_0x980d('0x153')};}else{logger['info'](util[_0x980d('0x8b')](_0x980d('0x154'),this['channel'][_0x980d('0x2d')],_0x1795d1['findBy']));this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x152'),this['channel']['callerid'],_0x1795d1['findBy']));return{'code':0xc8,'result':_0x980d('0x158')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x165')]=function(_0x3287ba){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x166'),_0x3287ba[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x3287ba[_0x980d('0x15f')])){return this['channel']['error'](_0x3287ba,_0x980d('0x167'));}var _0x11908c=this[_0x980d('0x19')][_0x980d('0x94')](this,_0x3287ba[_0x980d('0x15f')]);if(!_0x11908c){return this[_0x980d('0xc')][_0x980d('0x27')](_0x3287ba,'no\x20file\x20audio\x20found');}var _0x235f16=this[_0x980d('0xc')][_0x980d('0x4b')]('PLAYBACK',[_0x11908c,_0x3287ba[_0x980d('0xd8')]]);if(_0x235f16[_0x980d('0x99')]===-0x1){return _0x235f16;}return this[_0x980d('0xc')]['noop'](util['format'](_0x980d('0xb2'),_0x980d('0x168'),_0x11908c));};AGIVertices['prototype'][_0x980d('0x169')]=function(_0x2e2e87){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2e2e87['label']));if(!this['isConfigured'](_0x2e2e87[_0x980d('0x16a')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x2e2e87,_0x980d('0x16b'));}var _0x103d0f='';var _0x4cc0a4=parseInt(_0x2e2e87[_0x980d('0x16a')],0xa);if(isNaN(_0x4cc0a4)){_0x103d0f=_0x2e2e87['queue_id'];}else{_0x103d0f=this['getVoiceQueue'][_0x980d('0x94')](this,_0x2e2e87[_0x980d('0x16a')]);if(!_0x103d0f){return this[_0x980d('0xc')]['error'](_0x2e2e87,_0x980d('0x16c'));}}var _0x1fd879='';if(this[_0x980d('0x75')](_0x2e2e87[_0x980d('0x15f')])){var _0x44592e=this[_0x980d('0x19')][_0x980d('0x94')](this,_0x2e2e87['file_id']);if(_0x44592e){_0x1fd879=_0x44592e;}}this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x2e2e87,_0x103d0f);if(_0x2e2e87[_0x980d('0xd8')][_0x980d('0x16d')]('x')<0x0){_0x2e2e87[_0x980d('0xd8')]+='x';}if(_0x2e2e87[_0x980d('0xd8')][_0x980d('0x16d')]('X')<0x0){_0x2e2e87[_0x980d('0xd8')]+='X';}this[_0x980d('0xc')][_0x980d('0x8d')](_0x980d('0x16e'),_0x103d0f?_0x103d0f[_0x980d('0x16f')]():'');var _0x2da996=this['channel']['exec'](_0x980d('0x170'),[_0x103d0f,_0x2e2e87[_0x980d('0xd8')],_0x2e2e87[_0x980d('0x56')],_0x1fd879,_0x2e2e87[_0x980d('0x59')],_0x2e2e87[_0x980d('0x7')],_0x2e2e87[_0x980d('0x171')],_0x2e2e87[_0x980d('0x172')],'',_0x2e2e87[_0x980d('0x173')]]);if(_0x2da996[_0x980d('0x99')]===-0x1){return _0x2da996;}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('Executed\x20command\x20%s\x20%s',_0x980d('0x170'),_0x103d0f));};AGIVertices['prototype'][_0x980d('0x174')]=function(_0x57be7d){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x57be7d[_0x980d('0x2c')]));var _0x11b4bc=_0x57be7d['recordingFormat']||'wav';var _0x5457e1=util[_0x980d('0x8b')]('%s_%s',this[_0x980d('0xc')][_0x980d('0x2b')],rs[_0x980d('0x10d')](0x5));var _0x28b405=util[_0x980d('0x8b')](_0x980d('0x175'),FILES_PATH,_0x5457e1,_0x11b4bc);var _0x53a24c=util[_0x980d('0x8b')]('%s/recordings/%s',FILES_PATH,_0x5457e1);this[_0x980d('0x2e')][_0x980d('0x94')](this,_0x57be7d,_0x5457e1,_0x28b405);this[_0x980d('0xc')][_0x980d('0x8d')](_0x980d('0x176'),_0x5457e1);logger[_0x980d('0x23')](_0x980d('0x177'),_0x53a24c,_0x11b4bc,_0x57be7d['escape_digits'],_0x57be7d[_0x980d('0x59')]);return this['channel']['recordFile'](_0x53a24c,_0x11b4bc,_0x57be7d[_0x980d('0x178')],_0x57be7d[_0x980d('0x59')],undefined,!![]);};AGIVertices[_0x980d('0x10')][_0x980d('0x179')]=function(_0x3be034){logger['info'](util['format'](_0x980d('0x17a'),_0x3be034[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x3be034[_0x980d('0x56')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x17b'));}var _0x156796=this[_0x980d('0x55')][_0x980d('0x94')](this,_0x3be034);logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Response:',util[_0x980d('0x17c')](_0x156796,{'showHidden':![],'depth':null})));if(!this[_0x980d('0x75')](_0x3be034['variable_id'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x17d'));}var _0x5bd6ef=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x3be034[_0x980d('0xc9')]);if(!_0x5bd6ef){return this[_0x980d('0xc')][_0x980d('0x27')](_0x3be034,_0x980d('0xca'));}this[_0x980d('0xc')]['setVariable'](util[_0x980d('0x8b')](_0x980d('0x17e'),_0x5bd6ef),_0x156796['statusCode']?_0x156796[_0x980d('0x67')]:_0x980d('0x17f'));this[_0x980d('0xc')]['setVariable'](util[_0x980d('0x8b')](_0x980d('0x180'),_0x5bd6ef),_0x156796['statusMessage']?_0x156796[_0x980d('0x181')]:'OK');if(_0x156796[_0x980d('0x5e')]){try{this['saveRestApiResult'](_0x156796[_0x980d('0x5e')],_0x5bd6ef);}catch(_0x7e2985){logger[_0x980d('0x27')](util[_0x980d('0x8b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x5bd6ef));}}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('variable\x20%s\x20set',_0x5bd6ef));};AGIVertices[_0x980d('0x10')][_0x980d('0x182')]=function(_0x2aa15f){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x183'),_0x2aa15f[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x184')](_0x2aa15f[_0x980d('0x185')][_0x980d('0x4d')](/\s+/g,''),_0x2aa15f[_0x980d('0x178')]);};AGIVertices[_0x980d('0x10')][_0x980d('0x186')]=function(_0x9fd885){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x187'),_0x9fd885[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x188')](_0x9fd885['number'][_0x980d('0x4d')](/\s+/g,''),_0x9fd885['escape_digits']);};AGIVertices['prototype'][_0x980d('0x189')]=function(_0x581cc5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x18a'),_0x581cc5['label']));return this[_0x980d('0xc')][_0x980d('0x18b')](_0x581cc5[_0x980d('0x4f')],_0x581cc5[_0x980d('0x178')]);};AGIVertices['prototype'][_0x980d('0x18c')]=function(_0x5e5b8c){logger['info'](util[_0x980d('0x8b')](_0x980d('0x18d'),_0x5e5b8c[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x5e5b8c['account_id'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x18e'));}var _0x2930d9=this[_0x980d('0x18f')][_0x980d('0x94')](this,_0x5e5b8c[_0x980d('0x190')]);if(!_0x2930d9||!_0x2930d9[_0x980d('0x191')]){return this[_0x980d('0xc')][_0x980d('0x27')](_0x5e5b8c,_0x980d('0x192'));}var _0x3a12d1={'from':util[_0x980d('0x8b')](_0x980d('0x193'),_0x2930d9[_0x980d('0x13')],_0x2930d9[_0x980d('0x194')]||_0x2930d9[_0x980d('0x191')][_0x980d('0x195')]),'to':_0x5e5b8c['to']||'','cc':_0x5e5b8c['cc']||'','bcc':_0x5e5b8c['bcc']||'','subject':_0x5e5b8c[_0x980d('0x196')],'html':_0x5e5b8c[_0x980d('0x4f')],'text':_0x5e5b8c['text']};if(this[_0x980d('0x75')](_0x5e5b8c[_0x980d('0x197')])){}logger[_0x980d('0xd1')](_0x980d('0x198'),JSON['stringify'](_0x3a12d1));this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x5e5b8c,_0x5e5b8c[_0x980d('0x190')]);this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x199'),_0x2930d9[_0x980d('0x13')]));this['sendMailMessage'][_0x980d('0x94')](this,_0x2930d9[_0x980d('0x19a')],_0x3a12d1);return this[_0x980d('0xc')][_0x980d('0x9e')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x980d('0x10')]['sendFax']=function(_0x57576c){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x57576c[_0x980d('0x2c')]));return this['channel'][_0x980d('0x9e')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x980d('0x10')][_0x980d('0x19b')]=function(_0xc4eb28){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xc4eb28[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0xc4eb28[_0x980d('0x19c')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20sms\x20account\x20configured');}var _0x2829bc=this[_0x980d('0x19d')][_0x980d('0x94')](this,_0xc4eb28[_0x980d('0x19c')]);if(!_0x2829bc){return this[_0x980d('0xc')][_0x980d('0x27')](_0xc4eb28,_0x980d('0x19e'));}var _0x248a37={'body':_0xc4eb28[_0x980d('0x19f')],'phone':_0xc4eb28['to']||'','SmsAccountId':_0x2829bc['id']};logger[_0x980d('0xd1')](_0x980d('0x1a0'),JSON['stringify'](_0x248a37));this[_0x980d('0x2a')]['sync'](this,_0xc4eb28,_0xc4eb28['sms_account_id']);this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1a1'),_0x2829bc['name']));this[_0x980d('0x29')][_0x980d('0x94')](this,_0x248a37);return this[_0x980d('0xc')]['noop'](_0x980d('0x1a2'));};AGIVertices[_0x980d('0x10')][_0x980d('0x1a3')]=function(_0x246c33){logger['info'](util[_0x980d('0x8b')](_0x980d('0x1a4'),_0x246c33['label']));if(!this[_0x980d('0x75')](_0x246c33[_0x980d('0xc9')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x246c33,_0x980d('0x1a5'));}var _0x24a5ab=this[_0x980d('0x8f')]['sync'](this,_0x246c33[_0x980d('0xc9')]);if(!_0x24a5ab){return this['channel'][_0x980d('0x27')](_0x246c33,_0x980d('0xca'));}return this[_0x980d('0xc')][_0x980d('0x8d')](_0x24a5ab,_0x246c33[_0x980d('0x1a6')]);};AGIVertices[_0x980d('0x10')]['start']=function(_0x341c68){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x341c68[_0x980d('0x2c')]));this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x1a7'));var _0x49831e=this['channel'][_0x980d('0x8f')]('XMCS-UNIQUEID');if(!_[_0x980d('0x39')](_0x49831e[_0x980d('0x90')])){this[_0x980d('0xc')][_0x980d('0x2b')]=_0x49831e[_0x980d('0x90')];}if(_0x341c68['answer']===_0x980d('0x1a8')){this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x1a9'));return this[_0x980d('0xc')][_0x980d('0xaa')]();}return this['channel'][_0x980d('0x9e')](_0x980d('0x1aa'));};AGIVertices[_0x980d('0x10')][_0x980d('0x1ab')]=function(_0x434f9c){logger['info'](util[_0x980d('0x8b')](_0x980d('0x1ac'),_0x434f9c['label']));if(!this[_0x980d('0x75')](_0x434f9c[_0x980d('0x1ad')])){return this['channel'][_0x980d('0x27')](_0x434f9c,_0x980d('0x1ae'));}var _0x41b9f6=this[_0x980d('0x14')][_0x980d('0x94')](this,_0x434f9c['project_id']);if(!this[_0x980d('0x75')](_0x41b9f6)){return this['channel'][_0x980d('0x27')](_0x434f9c,util[_0x980d('0x8b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x434f9c[_0x980d('0x1ad')]));}if(_0x41b9f6===this['channel'][_0x980d('0x35')]){return this[_0x980d('0xc')][_0x980d('0x27')](_0x434f9c,_0x980d('0x1af'));}this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x434f9c,_0x41b9f6);var _0x23ddb9=this['channel']['exec'](_0x980d('0x1b0'),util['format'](_0x980d('0x1b1'),config[_0x980d('0x7')][_0x980d('0x1b2')]||_0x980d('0x1b3'),_0x41b9f6,this['channel'][_0x980d('0x35')]));if(_0x23ddb9[_0x980d('0x99')]===-0x1){return _0x23ddb9;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xb2'),'AGI',_0x41b9f6));};AGIVertices[_0x980d('0x10')][_0x980d('0x1b4')]=function(_0x402cae){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x1b5'),_0x402cae[_0x980d('0x2c')]));var _0x59b75a=this[_0x980d('0x4a')][_0x980d('0x94')](this,_0x402cae[_0x980d('0x1b6')]);this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x402cae,_0x402cae[_0x980d('0x1b6')]);if(this['isConfigured'](_0x402cae[_0x980d('0xc9')])){var _0x4e011a=this['getVariable'][_0x980d('0x94')](this,_0x402cae[_0x980d('0xc9')]);if(_0x4e011a){this[_0x980d('0xc')][_0x980d('0x8d')](_0x4e011a,_0x59b75a);return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1b7'),_0x402cae['command'],_0x4e011a));}}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1b8'),_0x402cae['command']));};AGIVertices[_0x980d('0x10')][_0x980d('0x1b9')]=function(_0xdf59e3){logger[_0x980d('0x23')](util['format'](_0x980d('0x1ba'),_0xdf59e3[_0x980d('0x2c')]));_0xdf59e3[_0x980d('0x4f')]=_0xdf59e3[_0x980d('0x4f')][_0x980d('0x4d')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xdf59e3[_0x980d('0x1bb')])){return this['channel'][_0x980d('0x9e')](_0x980d('0x1bc'));}if(!this[_0x980d('0x75')](_0xdf59e3[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1bd'),_0xdf59e3[_0x980d('0x4f')]));var _0x1a38a8=this[_0x980d('0x4e')][_0x980d('0x94')](this,_0xdf59e3);if(_0x1a38a8){this[_0x980d('0xc')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1a38a8));var _0x49d80e=this[_0x980d('0xc')][_0x980d('0x119')](_0x1a38a8);try{fs[_0x980d('0x11a')](_0x1a38a8+'.wav');}catch(_0x50f090){logger['error'](_0x50f090);}return _0x49d80e;}return this[_0x980d('0xc')][_0x980d('0x27')](_0xdf59e3,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x980d('0x10')][_0x980d('0x1be')]=function(_0x1b458b){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1b458b[_0x980d('0x2c')]));_0x1b458b[_0x980d('0x4f')]=_0x1b458b[_0x980d('0x4f')][_0x980d('0x4d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x980d('0x75')](_0x1b458b[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1bf'),_0x1b458b[_0x980d('0x4f')]));var _0x30a414=this['googleTTS']['sync'](this,_0x1b458b);if(_0x30a414){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1c0'),_0x30a414));var _0x3d986=this[_0x980d('0xc')][_0x980d('0x119')](_0x30a414);try{fs['unlink'](_0x30a414+_0x980d('0xf7'));}catch(_0x22114e){logger[_0x980d('0x27')](_0x22114e);}return _0x3d986;}return this[_0x980d('0xc')][_0x980d('0x27')](_0x1b458b,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x980d('0x10')][_0x980d('0x1c1')]=function(_0x21595b){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x21595b['label']));if(!this[_0x980d('0x75')](_0x21595b[_0x980d('0x150')])){return this[_0x980d('0xc')]['error'](_0x21595b,_0x980d('0x151'));}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x157'),this['channel'][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));var _0x468d37=this[_0x980d('0x45')][_0x980d('0x94')](this,_0x21595b[_0x980d('0x150')]);if(_0x468d37){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));return{'code':0xc8,'result':_0x980d('0x153')};}else{logger[_0x980d('0x23')](util[_0x980d('0x8b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x980d('0xc')]['callerid'],_0x21595b[_0x980d('0x150')]));this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x980d('0xc')][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));return{'code':0xc8,'result':_0x980d('0x158')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x1c2')]=function(_0xe982aa){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xe982aa[_0x980d('0x2c')]));var _0x2e6a0c=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x1c3'),[_0xe982aa[_0x980d('0x1c4')],_0xe982aa[_0x980d('0x6a')]]);if(_0x2e6a0c[_0x980d('0x99')]===-0x1){return _0x2e6a0c;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xb2'),_0x980d('0x1c3'),_0xe982aa[_0x980d('0x1c4')]));};AGIVertices[_0x980d('0x10')][_0x980d('0x1c5')]=function(_0x1c4c39){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x1c6'),_0x1c4c39[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1c4c39[_0x980d('0xc9')])){return this[_0x980d('0xc')]['error'](_0x1c4c39,_0x980d('0x1a5'));}var _0x16cce7=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x1c4c39[_0x980d('0xc9')]);if(!_0x16cce7){return this[_0x980d('0xc')][_0x980d('0x27')](_0x1c4c39,_0x980d('0xca'));}var _0x169890=this[_0x980d('0xc')][_0x980d('0x8f')](_0x16cce7);return{'code':0xc8,'result':_0x169890[_0x980d('0x90')]?_0x169890[_0x980d('0x90')]:'-'};};String['prototype'][_0x980d('0x8e')]=function(_0x17f718,_0xa49c57){return this[_0x980d('0x1c7')](_0x17f718)[_0x980d('0x1c8')](_0xa49c57);};module[_0x980d('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ea8871e..8902698 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 _0xff00=['milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','lastPauseAt','format','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','saveUnpause','error','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview'];(function(_0x5eb590,_0x17fb2a){var _0x49cac3=function(_0x5f4a21){while(--_0x5f4a21){_0x5eb590['push'](_0x5eb590['shift']());}};_0x49cac3(++_0x17fb2a);}(_0xff00,0x90));var _0x0ff0=function(_0x12096b,_0x27fa55){_0x12096b=_0x12096b-0x0;var _0xfe268b=_0xff00[_0x12096b];return _0xfe268b;};'use strict';var _=require(_0x0ff0('0x0'));var moment=require(_0x0ff0('0x1'));var ami=require(_0x0ff0('0x2'));var logger=require(_0x0ff0('0x3'))('acw');var RpcUser=require(_0x0ff0('0x4'));var RpcVoiceAgentReport=require(_0x0ff0('0x5'));function Acw(_0x40d910){this[_0x0ff0('0x6')]=_0x40d910[_0x0ff0('0x6')];this[_0x0ff0('0x7')]=_0x40d910[_0x0ff0('0x7')];this[_0x0ff0('0x8')]=_0x40d910[_0x0ff0('0x8')];this['channels']={};ami['on'](_0x0ff0('0x9'),this[_0x0ff0('0xa')][_0x0ff0('0xb')](this));ami['on'](_0x0ff0('0xc'),this['syncHangupRequest'][_0x0ff0('0xb')](this));ami['on'](_0x0ff0('0xd'),this[_0x0ff0('0xe')]['bind'](this));ami['on']('agentringnoanswer',this[_0x0ff0('0xf')][_0x0ff0('0xb')](this));ami['on'](_0x0ff0('0x10'),this[_0x0ff0('0x11')]['bind'](this));ami['on']('blindtransfer',this[_0x0ff0('0x12')][_0x0ff0('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x0ff0('0x13')][_0x0ff0('0xb')](this));}function getDiff(_0x26fa07){var _0x529768=moment()[_0x0ff0('0x14')](0x0);var _0x38bca3=moment(_0x26fa07)[_0x0ff0('0x14')](0x0);return _0x529768[_0x0ff0('0x15')](_0x38bca3,_0x0ff0('0x16'));}Acw[_0x0ff0('0x17')][_0x0ff0('0x18')]=function(_0x4523dd,_0x55517f){var _0x78dd0d=this;var _0x4207d1=getDiff(_0x78dd0d['timers'][_0x4523dd]['lastPauseAt']);clearTimeout(_0x78dd0d[_0x0ff0('0x8')][_0x4523dd][_0x0ff0('0x19')]);_0x78dd0d[_0x0ff0('0x8')][_0x4523dd][_0x0ff0('0x19')]=![];return RpcVoiceAgentReport[_0x0ff0('0x1a')]({'acwtime':_0x4207d1},_0x78dd0d[_0x0ff0('0x8')][_0x4523dd][_0x0ff0('0x1b')],_0x4523dd)['then'](function(_0x71fb35){logger[_0x0ff0('0x1c')](_0x0ff0('0x1d'),_0x55517f,_0x4207d1,_0x71fb35);})[_0x0ff0('0x1e')](function(_0x5da12c){logger['error'](_0x0ff0('0x1f'),_0x55517f,_0x5da12c);})[_0x0ff0('0x20')](function(){delete _0x78dd0d[_0x0ff0('0x8')][_0x4523dd];});};Acw[_0x0ff0('0x17')][_0x0ff0('0x21')]=function(_0xf7085f){try{var _0x2ed076=this;var _0x2801a1=this[_0x0ff0('0x22')][_0xf7085f][_0x0ff0('0x23')];var _0x3f8d26=this['channels'][_0xf7085f][_0x0ff0('0x24')];var _0x66f65=this[_0x0ff0('0x6')][_0x3f8d26];var _0x37a11f=![];var _0x672377=_0x0ff0('0x25');if(_0x66f65[_0x0ff0('0x26')]&&_0x66f65[_0x0ff0('0x27')][_0x0ff0('0x28')]){_0x37a11f=!![];_0x672377=_0x66f65[_0x0ff0('0x27')][_0x0ff0('0x28')];}return ami['Action']({'action':_0x0ff0('0x29'),'interface':_0x2801a1,'paused':!![],'reason':_0x672377})[_0x0ff0('0x2a')](function(){if(_0x2ed076['agents'][_0x2801a1]){return RpcUser['getAgent'](_0x2ed076[_0x0ff0('0x7')][_0x2801a1]['id'])[_0x0ff0('0x2a')](function(_0x4e9da0){if(!_0x4e9da0||_0x4e9da0[_0x0ff0('0x2b')]){logger[_0x0ff0('0x1c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0xf7085f,_0x2801a1,_0x3f8d26);return;}logger[_0x0ff0('0x1c')](_0x0ff0('0x2c'),_0xf7085f,_0x2801a1,_0x3f8d26);var _0x25cf19=_0x2ed076[_0x0ff0('0x22')][_0xf7085f][_0x0ff0('0x2d')]&&_0x2ed076[_0x0ff0('0x22')][_0xf7085f][_0x0ff0('0x2e')]?_0x2ed076[_0x0ff0('0x22')][_0xf7085f][_0x0ff0('0x2e')]:_0xf7085f;return RpcUser[_0x0ff0('0x2f')](_0x2ed076[_0x0ff0('0x7')][_0x2801a1],_0x672377,_0x25cf19)['then'](function(_0x5f2fee){_0x2ed076[_0x0ff0('0x6')][_0x3f8d26]['available']-=0x1;_0x2ed076[_0x0ff0('0x6')][_0x3f8d26]['paused']+=0x1;return _0x5f2fee;});})[_0x0ff0('0x2a')](function(_0x626400){if(_0x37a11f||!_0x626400){return;}_0x2ed076['timers'][_0x2801a1]={};logger[_0x0ff0('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xf7085f,_0x2ed076[_0x0ff0('0x6')][_0x3f8d26][_0x0ff0('0x30')],_0x2801a1,_0x3f8d26);_0x2ed076[_0x0ff0('0x8')][_0x2801a1]['timer']=setTimeout(_0x2ed076['stopAcw'][_0x0ff0('0xb')](_0x2ed076,_0x2801a1),_0x2ed076[_0x0ff0('0x6')][_0x3f8d26][_0x0ff0('0x30')]*0x3e8);_0x2ed076[_0x0ff0('0x8')][_0x2801a1][_0x0ff0('0x31')]=moment()[_0x0ff0('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ed076['timers'][_0x2801a1][_0x0ff0('0x1b')]=_0xf7085f;_0x2ed076[_0x0ff0('0x8')][_0x2801a1][_0x0ff0('0x24')]=_0x3f8d26;_0x2ed076[_0x0ff0('0x8')][_0x2801a1][_0x0ff0('0x18')]=_0x2ed076[_0x0ff0('0x18')][_0x0ff0('0xb')](_0x2ed076,_0x2801a1,_0xf7085f);});}})[_0x0ff0('0x1e')](function(){logger['error'](_0x0ff0('0x33'),_0xf7085f,_0x2ed076[_0x0ff0('0x6')][_0x3f8d26]['acwTimeout'],_0x2801a1,_0x3f8d26);})[_0x0ff0('0x20')](function(){delete _0x2ed076[_0x0ff0('0x22')][_0xf7085f];});}catch(_0x354592){logger['error'](_0x0ff0('0x34'),_0x354592[_0x0ff0('0x35')]);}};Acw[_0x0ff0('0x17')][_0x0ff0('0x36')]=function(_0x296764){try{var _0x21db9f=this;if(_0x21db9f[_0x0ff0('0x8')][_0x296764]){_0x21db9f['timers'][_0x296764][_0x0ff0('0x19')]=![];var _0x123643=_0x21db9f[_0x0ff0('0x8')][_0x296764]['uniqueid'];var _0x330303=_0x21db9f[_0x0ff0('0x8')][_0x296764][_0x0ff0('0x24')];var _0x498925=_0x21db9f[_0x0ff0('0x6')][_0x330303][_0x0ff0('0x30')];logger[_0x0ff0('0x1c')](_0x0ff0('0x37'),_0x123643,_0x296764);RpcUser[_0x0ff0('0x38')](this[_0x0ff0('0x7')][_0x296764]['id'])[_0x0ff0('0x2a')](function(_0x429c15){if(_0x429c15[_0x0ff0('0x39')]===_0x0ff0('0x25')){return RpcUser[_0x0ff0('0x3a')](_0x21db9f[_0x0ff0('0x7')][_0x296764]);}});RpcVoiceAgentReport[_0x0ff0('0x1a')]({'acwtime':_0x498925,'agentacw':!![]},_0x123643,_0x296764)[_0x0ff0('0x2a')](function(_0x184049){logger[_0x0ff0('0x1c')](_0x0ff0('0x1d'),_0x123643,_0x498925,_0x184049);})[_0x0ff0('0x1e')](function(_0xb3124e){logger[_0x0ff0('0x3b')]('[%s][UPDATE][ERRORS:%s]',_0x123643,_0xb3124e);});}else{logger[_0x0ff0('0x3b')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x296764);if(_0x21db9f[_0x0ff0('0x8')]){logger[_0x0ff0('0x1c')](_0x0ff0('0x3c'),JSON[_0x0ff0('0x3d')](_0x21db9f[_0x0ff0('0x8')]));}}}catch(_0x5eeaad){logger[_0x0ff0('0x3b')]('[ACW][STOP]\x20%s',_0x5eeaad[_0x0ff0('0x35')]);}};Acw[_0x0ff0('0x17')][_0x0ff0('0xa')]=function(_0x53c2c5){try{if(this[_0x0ff0('0x6')][_0x53c2c5['queue']]&&(this['voiceQueues'][_0x53c2c5[_0x0ff0('0x24')]][_0x0ff0('0x3e')]||this[_0x0ff0('0x6')][_0x53c2c5[_0x0ff0('0x24')]][_0x0ff0('0x26')])){if(this[_0x0ff0('0x7')][_0x53c2c5[_0x0ff0('0x23')]]){this['channels'][_0x53c2c5[_0x0ff0('0x1b')]]={'queue':_0x53c2c5[_0x0ff0('0x24')],'interface':_0x53c2c5[_0x0ff0('0x23')],'destlinkedid':_0x53c2c5[_0x0ff0('0x2e')]};}}}catch(_0x16d8ac){logger[_0x0ff0('0x3b')]('[ACW][syncAgentConnect]\x20%s',_0x16d8ac['message']);}};Acw[_0x0ff0('0x17')][_0x0ff0('0x13')]=function(_0x48774b){try{if(this['voiceQueues'][_0x48774b[_0x0ff0('0x24')]]&&(this[_0x0ff0('0x6')][_0x48774b[_0x0ff0('0x24')]]['acw']||this['voiceQueues'][_0x48774b[_0x0ff0('0x24')]]['mandatoryDisposition'])){if(this[_0x0ff0('0x7')][_0x48774b['interface']]){this[_0x0ff0('0x22')][_0x48774b[_0x0ff0('0x1b')]]={'queue':_0x48774b['queue'],'interface':_0x48774b[_0x0ff0('0x23')]};}}}catch(_0xa42605){logger[_0x0ff0('0x3b')](_0x0ff0('0x3f'),_0xa42605[_0x0ff0('0x35')]);}};Acw[_0x0ff0('0x17')]['syncHangupRequest']=function(_0x3ab76c){try{if(this[_0x0ff0('0x22')][_0x3ab76c[_0x0ff0('0x1b')]]&&_[_0x0ff0('0x40')](this['channels'][_0x3ab76c['uniqueid']][_0x0ff0('0x2d')])){logger[_0x0ff0('0x1c')]('[%s][HANGUP:UNIQUEID]',_0x3ab76c[_0x0ff0('0x1b')]);this[_0x0ff0('0x21')](_0x3ab76c[_0x0ff0('0x1b')]);}else if(this[_0x0ff0('0x22')][_0x3ab76c[_0x0ff0('0x41')]]&&_[_0x0ff0('0x40')](this[_0x0ff0('0x22')][_0x3ab76c[_0x0ff0('0x41')]][_0x0ff0('0x2d')])){logger['info'](_0x0ff0('0x42'),_0x3ab76c[_0x0ff0('0x41')]);this['startAcw'](_0x3ab76c[_0x0ff0('0x41')]);}}catch(_0xba8d56){logger[_0x0ff0('0x3b')](_0x0ff0('0x43'),_0xba8d56[_0x0ff0('0x35')]);}};Acw['prototype'][_0x0ff0('0xe')]=function(_0x1b1194){try{if(this['channels'][_0x1b1194[_0x0ff0('0x1b')]]&&this[_0x0ff0('0x22')][_0x1b1194[_0x0ff0('0x1b')]][_0x0ff0('0x2d')]){logger[_0x0ff0('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1b1194[_0x0ff0('0x1b')]);this[_0x0ff0('0x21')](_0x1b1194['uniqueid']);}else if(this[_0x0ff0('0x22')][_0x1b1194[_0x0ff0('0x41')]]&&this['channels'][_0x1b1194[_0x0ff0('0x41')]]['attended']){logger[_0x0ff0('0x1c')](_0x0ff0('0x44'),_0x1b1194[_0x0ff0('0x41')]);this[_0x0ff0('0x21')](_0x1b1194[_0x0ff0('0x41')]);}}catch(_0x8e1aa){logger[_0x0ff0('0x3b')]('[ACW][syncHangup]\x20%s',_0x8e1aa[_0x0ff0('0x35')]);}};Acw[_0x0ff0('0x17')][_0x0ff0('0x11')]=function(_0x5c3081){try{if(!_[_0x0ff0('0x45')](this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x46')]])){this['startAcw'](_0x5c3081[_0x0ff0('0x46')]);if(this[_0x0ff0('0x22')][_0x5c3081['secondtransfereruniqueid']]){this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x47')]][_0x0ff0('0x2d')]=!![];this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x48')]]=this[_0x0ff0('0x22')][_0x5c3081['secondtransfereruniqueid']];delete this[_0x0ff0('0x22')][_0x5c3081['secondtransfereruniqueid']];}}else if(!_[_0x0ff0('0x45')](this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x48')]])){this[_0x0ff0('0x21')](_0x5c3081['transfertargetuniqueid']);if(this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x49')]]){this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x49')]]['attended']=!![];this['channels'][_0x5c3081['transfereeuniqueid']]=this[_0x0ff0('0x22')][_0x5c3081[_0x0ff0('0x49')]];delete this[_0x0ff0('0x22')][_0x5c3081['origtransfereruniqueid']];}}}catch(_0x32d9a5){logger[_0x0ff0('0x3b')]('[ACW][syncAttendedTransfer]\x20%s',_0x32d9a5[_0x0ff0('0x35')]);}};Acw[_0x0ff0('0x17')][_0x0ff0('0x12')]=function(_0x562437){try{if(this[_0x0ff0('0x22')][_0x562437[_0x0ff0('0x4a')]]){logger[_0x0ff0('0x1c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x0ff0('0x3d')](_0x562437['transfereruniqueid']));this[_0x0ff0('0x21')](_0x562437[_0x0ff0('0x4a')]);}else if(this['channels'][_0x562437[_0x0ff0('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x0ff0('0x3d')](_0x562437[_0x0ff0('0x4b')]));this[_0x0ff0('0x21')](_0x562437[_0x0ff0('0x4b')]);}}catch(_0x401ee5){logger[_0x0ff0('0x3b')](_0x0ff0('0x4c'),_0x401ee5[_0x0ff0('0x35')]);}};Acw['prototype'][_0x0ff0('0xf')]=function(_0x552e50){try{if(this[_0x0ff0('0x6')][_0x552e50[_0x0ff0('0x24')]]&&this[_0x0ff0('0x6')][_0x552e50['queue']][_0x0ff0('0x4d')]===_0x0ff0('0x4e')){if(this[_0x0ff0('0x7')][_0x552e50['interface']]){logger[_0x0ff0('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x552e50[_0x0ff0('0x1b')],_0x552e50[_0x0ff0('0x23')],_0x552e50[_0x0ff0('0x24')]);return RpcUser['savePause'](this[_0x0ff0('0x7')][_0x552e50[_0x0ff0('0x23')]],_0x0ff0('0x4f'),_0x552e50['uniqueid']);}}}catch(_0x51b971){logger[_0x0ff0('0x3b')](_0x0ff0('0x50'),_0x51b971[_0x0ff0('0x35')]);}};module[_0x0ff0('0x51')]=Acw; \ No newline at end of file +var _0xf403=['linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','interface','ACW','name','mandatoryDispositionPause','Action','QueuePause','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','queue','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw'];(function(_0x5c73b2,_0x1824a8){var _0x35f2bf=function(_0x4015fc){while(--_0x4015fc){_0x5c73b2['push'](_0x5c73b2['shift']());}};_0x35f2bf(++_0x1824a8);}(_0xf403,0x173));var _0x3f40=function(_0x4f9ec9,_0x5825b7){_0x4f9ec9=_0x4f9ec9-0x0;var _0x4700b5=_0xf403[_0x4f9ec9];return _0x4700b5;};'use strict';var _=require(_0x3f40('0x0'));var moment=require(_0x3f40('0x1'));var ami=require(_0x3f40('0x2'));var logger=require('../../../config/logger')(_0x3f40('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x3f40('0x4'));function Acw(_0x4f60dd){this[_0x3f40('0x5')]=_0x4f60dd[_0x3f40('0x5')];this[_0x3f40('0x6')]=_0x4f60dd[_0x3f40('0x6')];this['timers']=_0x4f60dd[_0x3f40('0x7')];this[_0x3f40('0x8')]={};ami['on'](_0x3f40('0x9'),this['syncAgentConnect'][_0x3f40('0xa')](this));ami['on'](_0x3f40('0xb'),this[_0x3f40('0xc')][_0x3f40('0xa')](this));ami['on']('hangup',this[_0x3f40('0xd')][_0x3f40('0xa')](this));ami['on'](_0x3f40('0xe'),this[_0x3f40('0xf')][_0x3f40('0xa')](this));ami['on'](_0x3f40('0x10'),this['syncAttendedTransfer'][_0x3f40('0xa')](this));ami['on'](_0x3f40('0x11'),this[_0x3f40('0x12')][_0x3f40('0xa')](this));ami['on'](_0x3f40('0x13'),this[_0x3f40('0x14')][_0x3f40('0xa')](this));}function getDiff(_0x290b9f){var _0x46ee78=moment()['milliseconds'](0x0);var _0x4ea82a=moment(_0x290b9f)['milliseconds'](0x0);return _0x46ee78['diff'](_0x4ea82a,'seconds');}Acw[_0x3f40('0x15')][_0x3f40('0x16')]=function(_0x1010da,_0x26314c){var _0x3e992f=this;var _0x3b04ef=getDiff(_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x17')]);clearTimeout(_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x18')]);_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x18')]=![];return RpcVoiceAgentReport[_0x3f40('0x19')]({'acwtime':_0x3b04ef},_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x1a')],_0x1010da)[_0x3f40('0x1b')](function(_0x4b8663){logger[_0x3f40('0x1c')](_0x3f40('0x1d'),_0x26314c,_0x3b04ef,_0x4b8663);})[_0x3f40('0x1e')](function(_0x19d209){logger[_0x3f40('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x26314c,_0x19d209);})['finally'](function(){delete _0x3e992f[_0x3f40('0x7')][_0x1010da];});};Acw[_0x3f40('0x15')]['startAcw']=function(_0x43d483){try{var _0x5a1a3c=this;var _0x591d83=this[_0x3f40('0x8')][_0x43d483][_0x3f40('0x20')];var _0x57ca67=this[_0x3f40('0x8')][_0x43d483]['queue'];var _0x2c90f9=this[_0x3f40('0x5')][_0x57ca67];var _0x3f14bc=![];var _0x56451e=_0x3f40('0x21');if(_0x2c90f9['mandatoryDisposition']&&_0x2c90f9['mandatoryDispositionPause'][_0x3f40('0x22')]){_0x3f14bc=!![];_0x56451e=_0x2c90f9[_0x3f40('0x23')][_0x3f40('0x22')];}return ami[_0x3f40('0x24')]({'action':_0x3f40('0x25'),'interface':_0x591d83,'paused':!![],'reason':_0x56451e})['then'](function(){if(_0x5a1a3c[_0x3f40('0x6')][_0x591d83]){return RpcUser[_0x3f40('0x26')](_0x5a1a3c[_0x3f40('0x6')][_0x591d83]['id'])[_0x3f40('0x1b')](function(_0x35a1f6){if(!_0x35a1f6||_0x35a1f6['voicePause']){logger[_0x3f40('0x1c')](_0x3f40('0x27'),_0x43d483,_0x591d83,_0x57ca67);return;}logger[_0x3f40('0x1c')](_0x3f40('0x28'),_0x43d483,_0x591d83,_0x57ca67);var _0x36b678=_0x5a1a3c['channels'][_0x43d483][_0x3f40('0x29')]&&_0x5a1a3c[_0x3f40('0x8')][_0x43d483][_0x3f40('0x2a')]?_0x5a1a3c['channels'][_0x43d483][_0x3f40('0x2a')]:_0x43d483;return RpcUser[_0x3f40('0x2b')](_0x5a1a3c['agents'][_0x591d83],_0x56451e,_0x36b678)[_0x3f40('0x1b')](function(_0x56467c){_0x5a1a3c[_0x3f40('0x5')][_0x57ca67][_0x3f40('0x2c')]-=0x1;_0x5a1a3c[_0x3f40('0x5')][_0x57ca67]['paused']+=0x1;return _0x56467c;});})['then'](function(_0x1526e1){if(_0x3f14bc||!_0x1526e1){return;}_0x5a1a3c[_0x3f40('0x7')][_0x591d83]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x43d483,_0x5a1a3c[_0x3f40('0x5')][_0x57ca67][_0x3f40('0x2d')],_0x591d83,_0x57ca67);_0x5a1a3c['timers'][_0x591d83]['timer']=setTimeout(_0x5a1a3c['stopAcw'][_0x3f40('0xa')](_0x5a1a3c,_0x591d83),_0x5a1a3c[_0x3f40('0x5')][_0x57ca67][_0x3f40('0x2d')]*0x3e8);_0x5a1a3c[_0x3f40('0x7')][_0x591d83]['lastPauseAt']=moment()[_0x3f40('0x2e')](_0x3f40('0x2f'));_0x5a1a3c['timers'][_0x591d83][_0x3f40('0x1a')]=_0x43d483;_0x5a1a3c['timers'][_0x591d83][_0x3f40('0x30')]=_0x57ca67;_0x5a1a3c[_0x3f40('0x7')][_0x591d83][_0x3f40('0x16')]=_0x5a1a3c[_0x3f40('0x16')][_0x3f40('0xa')](_0x5a1a3c,_0x591d83,_0x43d483);});}})['catch'](function(){logger[_0x3f40('0x1f')](_0x3f40('0x31'),_0x43d483,_0x5a1a3c['voiceQueues'][_0x57ca67][_0x3f40('0x2d')],_0x591d83,_0x57ca67);})[_0x3f40('0x32')](function(){delete _0x5a1a3c[_0x3f40('0x8')][_0x43d483];});}catch(_0x37114a){logger[_0x3f40('0x1f')]('[ACW][START]\x20%s',_0x37114a[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')][_0x3f40('0x34')]=function(_0x222690){try{var _0x482627=this;if(_0x482627[_0x3f40('0x7')][_0x222690]){_0x482627[_0x3f40('0x7')][_0x222690]['timer']=![];var _0x34e93d=_0x482627[_0x3f40('0x7')][_0x222690][_0x3f40('0x1a')];var _0x2dd767=_0x482627[_0x3f40('0x7')][_0x222690][_0x3f40('0x30')];var _0x2d3d91=_0x482627['voiceQueues'][_0x2dd767][_0x3f40('0x2d')];logger[_0x3f40('0x1c')](_0x3f40('0x35'),_0x34e93d,_0x222690);RpcUser[_0x3f40('0x26')](this[_0x3f40('0x6')][_0x222690]['id'])[_0x3f40('0x1b')](function(_0x3ebf8c){if(_0x3ebf8c['pauseType']==='ACW'){return RpcUser[_0x3f40('0x36')](_0x482627[_0x3f40('0x6')][_0x222690]);}});RpcVoiceAgentReport['update']({'acwtime':_0x2d3d91,'agentacw':!![]},_0x34e93d,_0x222690)['then'](function(_0x409560){logger[_0x3f40('0x1c')](_0x3f40('0x1d'),_0x34e93d,_0x2d3d91,_0x409560);})[_0x3f40('0x1e')](function(_0x255479){logger[_0x3f40('0x1f')](_0x3f40('0x37'),_0x34e93d,_0x255479);});}else{logger[_0x3f40('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x222690);if(_0x482627[_0x3f40('0x7')]){logger[_0x3f40('0x1c')](_0x3f40('0x38'),JSON['stringify'](_0x482627[_0x3f40('0x7')]));}}}catch(_0x351ac5){logger[_0x3f40('0x1f')](_0x3f40('0x39'),_0x351ac5['message']);}};Acw['prototype'][_0x3f40('0x3a')]=function(_0x2755ef){try{if(this[_0x3f40('0x5')][_0x2755ef[_0x3f40('0x30')]]&&(this[_0x3f40('0x5')][_0x2755ef[_0x3f40('0x30')]][_0x3f40('0x3')]||this[_0x3f40('0x5')][_0x2755ef[_0x3f40('0x30')]]['mandatoryDisposition'])){if(this[_0x3f40('0x6')][_0x2755ef['interface']]){this[_0x3f40('0x8')][_0x2755ef['uniqueid']]={'queue':_0x2755ef[_0x3f40('0x30')],'interface':_0x2755ef[_0x3f40('0x20')],'destlinkedid':_0x2755ef[_0x3f40('0x2a')]};}}}catch(_0x9f700f){logger[_0x3f40('0x1f')](_0x3f40('0x3b'),_0x9f700f[_0x3f40('0x33')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x3bbaf5){try{if(this['voiceQueues'][_0x3bbaf5['queue']]&&(this['voiceQueues'][_0x3bbaf5[_0x3f40('0x30')]][_0x3f40('0x3')]||this[_0x3f40('0x5')][_0x3bbaf5['queue']][_0x3f40('0x3c')])){if(this[_0x3f40('0x6')][_0x3bbaf5['interface']]){this['channels'][_0x3bbaf5[_0x3f40('0x1a')]]={'queue':_0x3bbaf5[_0x3f40('0x30')],'interface':_0x3bbaf5['interface']};}}}catch(_0x2a42c8){logger['error'](_0x3f40('0x3d'),_0x2a42c8[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')][_0x3f40('0xc')]=function(_0x3fbfb0){try{if(this[_0x3f40('0x8')][_0x3fbfb0['uniqueid']]&&_['isUndefined'](this['channels'][_0x3fbfb0[_0x3f40('0x1a')]][_0x3f40('0x29')])){logger[_0x3f40('0x1c')](_0x3f40('0x3e'),_0x3fbfb0[_0x3f40('0x1a')]);this[_0x3f40('0x3f')](_0x3fbfb0[_0x3f40('0x1a')]);}else if(this[_0x3f40('0x8')][_0x3fbfb0[_0x3f40('0x40')]]&&_[_0x3f40('0x41')](this[_0x3f40('0x8')][_0x3fbfb0['linkedid']]['attended'])){logger['info'](_0x3f40('0x42'),_0x3fbfb0[_0x3f40('0x40')]);this[_0x3f40('0x3f')](_0x3fbfb0['linkedid']);}}catch(_0x420b4e){logger[_0x3f40('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x420b4e[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')][_0x3f40('0xd')]=function(_0x7189eb){try{if(this['channels'][_0x7189eb[_0x3f40('0x1a')]]&&this[_0x3f40('0x8')][_0x7189eb[_0x3f40('0x1a')]][_0x3f40('0x29')]){logger[_0x3f40('0x1c')](_0x3f40('0x43'),_0x7189eb[_0x3f40('0x1a')]);this[_0x3f40('0x3f')](_0x7189eb[_0x3f40('0x1a')]);}else if(this['channels'][_0x7189eb[_0x3f40('0x40')]]&&this[_0x3f40('0x8')][_0x7189eb['linkedid']]['attended']){logger[_0x3f40('0x1c')](_0x3f40('0x44'),_0x7189eb[_0x3f40('0x40')]);this[_0x3f40('0x3f')](_0x7189eb['linkedid']);}}catch(_0x1c9fac){logger[_0x3f40('0x1f')]('[ACW][syncHangup]\x20%s',_0x1c9fac['message']);}};Acw[_0x3f40('0x15')][_0x3f40('0x45')]=function(_0x300235){try{if(!_[_0x3f40('0x46')](this[_0x3f40('0x8')][_0x300235['transfereeuniqueid']])){this[_0x3f40('0x3f')](_0x300235[_0x3f40('0x47')]);if(this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]]){this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]]['attended']=!![];this[_0x3f40('0x8')][_0x300235[_0x3f40('0x49')]]=this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]];delete this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]];}}else if(!_['isNil'](this[_0x3f40('0x8')][_0x300235['transfertargetuniqueid']])){this[_0x3f40('0x3f')](_0x300235['transfertargetuniqueid']);if(this[_0x3f40('0x8')][_0x300235[_0x3f40('0x4a')]]){this[_0x3f40('0x8')][_0x300235['origtransfereruniqueid']][_0x3f40('0x29')]=!![];this[_0x3f40('0x8')][_0x300235[_0x3f40('0x47')]]=this[_0x3f40('0x8')][_0x300235[_0x3f40('0x4a')]];delete this[_0x3f40('0x8')][_0x300235[_0x3f40('0x4a')]];}}}catch(_0x368fb8){logger['error'](_0x3f40('0x4b'),_0x368fb8[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')]['syncBlindTransfer']=function(_0x468d77){try{if(this[_0x3f40('0x8')][_0x468d77[_0x3f40('0x4c')]]){logger[_0x3f40('0x1c')](_0x3f40('0x4d'),JSON[_0x3f40('0x4e')](_0x468d77[_0x3f40('0x4c')]));this[_0x3f40('0x3f')](_0x468d77['transfereruniqueid']);}else if(this[_0x3f40('0x8')][_0x468d77[_0x3f40('0x4f')]]){logger[_0x3f40('0x1c')](_0x3f40('0x50'),JSON[_0x3f40('0x4e')](_0x468d77['transfererlinkedid']));this[_0x3f40('0x3f')](_0x468d77[_0x3f40('0x4f')]);}}catch(_0x46b8f8){logger[_0x3f40('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x46b8f8[_0x3f40('0x33')]);}};Acw['prototype'][_0x3f40('0xf')]=function(_0x52ad66){try{if(this[_0x3f40('0x5')][_0x52ad66[_0x3f40('0x30')]]&&this[_0x3f40('0x5')][_0x52ad66[_0x3f40('0x30')]][_0x3f40('0x51')]===_0x3f40('0x52')){if(this[_0x3f40('0x6')][_0x52ad66[_0x3f40('0x20')]]){logger[_0x3f40('0x1c')](_0x3f40('0x53'),_0x52ad66[_0x3f40('0x1a')],_0x52ad66[_0x3f40('0x20')],_0x52ad66[_0x3f40('0x30')]);return RpcUser[_0x3f40('0x2b')](this[_0x3f40('0x6')][_0x52ad66['interface']],_0x3f40('0x54'),_0x52ad66[_0x3f40('0x1a')]);}}}catch(_0x1e0c6c){logger[_0x3f40('0x1f')](_0x3f40('0x55'),_0x1e0c6c[_0x3f40('0x33')]);}};module[_0x3f40('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5b53201..d6f592f 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 _0x1d7d=['coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','port','asterisk','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels'];(function(_0x1af577,_0x1bd440){var _0x18ec4f=function(_0x4c9f95){while(--_0x4c9f95){_0x1af577['push'](_0x1af577['shift']());}};_0x18ec4f(++_0x1bd440);}(_0x1d7d,0x13f));var _0xd1d7=function(_0x8fc543,_0x5c9e02){_0x8fc543=_0x8fc543-0x0;var _0x3824d2=_0x1d7d[_0x8fc543];return _0x3824d2;};'use strict';var Manager=require(_0xd1d7('0x0'));var BPromise=require(_0xd1d7('0x1'));var util=require(_0xd1d7('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0xd1d7('0x3')],config[_0xd1d7('0x4')]['ip'],config[_0xd1d7('0x4')][_0xd1d7('0x5')],config['asterisk'][_0xd1d7('0x6')],!![]);ami[_0xd1d7('0x7')]();ami[_0xd1d7('0x8')]=BPromise[_0xd1d7('0x9')](ami[_0xd1d7('0xa')]);function error(_0x163070){logger['error'](util[_0xd1d7('0xb')](_0xd1d7('0xc'),config[_0xd1d7('0x4')]['username'],config['asterisk']['ip'],config['asterisk'][_0xd1d7('0x3')],util[_0xd1d7('0xd')](_0x163070,![],null)));}function close(){logger[_0xd1d7('0xe')](util[_0xd1d7('0xb')](_0xd1d7('0xf'),config[_0xd1d7('0x4')][_0xd1d7('0x5')],config['asterisk']['ip'],config[_0xd1d7('0x4')][_0xd1d7('0x3')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xd1d7('0x8')]({'action':_0xd1d7('0x10')});};};ami[_0xd1d7('0x11')]=function(){return function(){return ami[_0xd1d7('0x8')]({'action':_0xd1d7('0x12')});};};ami[_0xd1d7('0x13')]=function(){return function(){return ami[_0xd1d7('0x8')]({'action':'queuesummary'});};};ami[_0xd1d7('0x14')]=function(){return function(){return ami[_0xd1d7('0x8')]({'action':_0xd1d7('0x15')});};};function connect(){logger[_0xd1d7('0x16')](util[_0xd1d7('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xd1d7('0x4')][_0xd1d7('0x5')],config[_0xd1d7('0x4')]['ip'],config[_0xd1d7('0x4')][_0xd1d7('0x3')]));ami[_0xd1d7('0x17')]('error',error);ami[_0xd1d7('0x17')](_0xd1d7('0x18'),close);}ami['on'](_0xd1d7('0x19'),connect);ami['on']('shutdown',function(_0xe4825b){logger[_0xd1d7('0x16')](util[_0xd1d7('0xb')](_0xd1d7('0x1a'),config[_0xd1d7('0x4')]['username'],config[_0xd1d7('0x4')]['ip'],config['asterisk'][_0xd1d7('0x3')],util[_0xd1d7('0xd')](_0xe4825b,![],null)));});ami['on']('fullybooted',function(){logger[_0xd1d7('0x16')](util[_0xd1d7('0xb')](_0xd1d7('0x1b'),config[_0xd1d7('0x4')][_0xd1d7('0x5')],config['asterisk']['ip'],config[_0xd1d7('0x4')]['port']));return Promise[_0xd1d7('0x1c')]()[_0xd1d7('0x1d')](ami[_0xd1d7('0x1e')]())[_0xd1d7('0x1d')](ami['actionDeviceStateList']())[_0xd1d7('0x1d')](ami['actionSipPeerStatus']())[_0xd1d7('0x1d')](ami[_0xd1d7('0x13')]())[_0xd1d7('0x1d')](ami[_0xd1d7('0x14')]())[_0xd1d7('0x1f')](function(_0x1c058e){logger[_0xd1d7('0xe')](_0xd1d7('0x20'),util[_0xd1d7('0xd')](_0x1c058e,{'showHidden':![],'depth':null}));});});ami[_0xd1d7('0x17')](_0xd1d7('0xe'),error);ami[_0xd1d7('0x17')](_0xd1d7('0x18'),close);module[_0xd1d7('0x21')]=ami; \ No newline at end of file +var _0xfb15=['port','username','keepConnected','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','format','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','../../config/environment','asterisk'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xfb15,0x97));var _0x5fb1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xfb15[_0x4cf98e];return _0x1623ac;};'use strict';var Manager=require(_0x5fb1('0x0'));var BPromise=require(_0x5fb1('0x1'));var util=require('util');var logger=require('../../config/logger')('ami');var config=require(_0x5fb1('0x2'));var ami=new Manager(config[_0x5fb1('0x3')][_0x5fb1('0x4')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['password'],!![]);ami[_0x5fb1('0x6')]();ami['Action']=BPromise[_0x5fb1('0x7')](ami['action']);function error(_0x1d3a5a){logger[_0x5fb1('0x8')](util['format'](_0x5fb1('0x9'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')]['port'],util['inspect'](_0x1d3a5a,![],null)));}function close(){logger['error'](util['format'](_0x5fb1('0xa'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')][_0x5fb1('0x4')]));}ami[_0x5fb1('0xb')]=function(){return function(){return ami[_0x5fb1('0xc')]({'action':'sipshowregistry'});};};ami[_0x5fb1('0xd')]=function(){return function(){return ami[_0x5fb1('0xc')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x5fb1('0xc')]({'action':_0x5fb1('0xe')});};};ami[_0x5fb1('0xf')]=function(){return function(){return ami[_0x5fb1('0xc')]({'action':_0x5fb1('0x10')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x5fb1('0xc')]({'action':_0x5fb1('0x11')});};};function connect(){logger[_0x5fb1('0x12')](util['format'](_0x5fb1('0x13'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config['asterisk'][_0x5fb1('0x4')]));ami[_0x5fb1('0x14')]('error',error);ami['once']('close',close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x38229d){logger['info'](util[_0x5fb1('0x15')](_0x5fb1('0x16'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')][_0x5fb1('0x4')],util[_0x5fb1('0x17')](_0x38229d,![],null)));});ami['on'](_0x5fb1('0x18'),function(){logger[_0x5fb1('0x12')](util[_0x5fb1('0x15')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config['asterisk']['port']));return Promise['resolve']()[_0x5fb1('0x19')](ami['actionSipShowRegistry']())[_0x5fb1('0x19')](ami[_0x5fb1('0xd')]())[_0x5fb1('0x19')](ami['actionSipPeerStatus']())['then'](ami[_0x5fb1('0xf')]())[_0x5fb1('0x19')](ami[_0x5fb1('0x1a')]())[_0x5fb1('0x1b')](function(_0x133a5c){logger[_0x5fb1('0x8')](_0x5fb1('0x1c'),util[_0x5fb1('0x17')](_0x133a5c,{'showHidden':![],'depth':null}));});});ami[_0x5fb1('0x14')](_0x5fb1('0x8'),error);ami[_0x5fb1('0x14')](_0x5fb1('0x1d'),close);module[_0x5fb1('0x1e')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 791e509..94dfc78 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(_0x2c03ca,_0xad92ca){var _0xe670b=function(_0x3c673){while(--_0x3c673){_0x2c03ca['push'](_0x2c03ca['shift']());}};_0xe670b(++_0xad92ca);}(_0xf4eb,0xec));var _0xbf4e=function(_0x141d04,_0x1ddb55){_0x141d04=_0x141d04-0x0;var _0x47c7aa=_0xf4eb[_0x141d04];return _0x47c7aa;};'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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index fe19e2e..1d0c152 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 _0x349b=['getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','[emptyContact][createHistory]','[emptyContact]','handlePreviewRecallNotifications','Agent','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','NONE','dialer','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','countnosuchnumberretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','busyFactor','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','dialMethod','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','emptyContact','checkIsBlackList','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils/hopper','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','checkContactLowerLimitOriginate','temp','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','Interval','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','Error','active','SIP/%s','status','reachable','unmonitored','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','content','true','catch','command','indexOf','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','handlePower','power','method\x20not\x20recognized','OVERTIME_GLOBAL_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','uniqueid','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','dropreason','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','rescheduleContact','CampaignId','[rescheduleContact][Abandoned]','syncNewExten','channel','actionid','strategy','isNil','paused','stateinterface','locked','queueBooked','rrmemory','roundrobin','run','idHopper','ListId','_rr','unlockRR','[booked][RR]','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','custom:amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','membername','AMD','countmachineretry','buildObj','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialAMDActive','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','createStateFinal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','online','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]'];(function(_0x4baeda,_0x11d2c2){var _0x49ec09=function(_0x2344a1){while(--_0x2344a1){_0x4baeda['push'](_0x4baeda['shift']());}};_0x49ec09(++_0x11d2c2);}(_0x349b,0xda));var _0xb349=function(_0x5750fa,_0x3f2896){_0x5750fa=_0x5750fa-0x0;var _0x43ab36=_0x349b[_0x5750fa];return _0x43ab36;};'use strict';var util=require(_0xb349('0x0'));var _=require(_0xb349('0x1'));var uuid=require(_0xb349('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xb349('0x3'));var utils=require('./utils');var hopperUtils=require(_0xb349('0x4'));var ut=require('../preview/util/util');var config=require(_0xb349('0x5'));var logger=require(_0xb349('0x6'))('dialer');var loggerBooked=require('../../../config/logger')(_0xb349('0x7'));var loggerPredictive=require(_0xb349('0x6'))(_0xb349('0x8'));var loggerPredictiveCalls=require(_0xb349('0x6'))(_0xb349('0x9'));var loggerSyncQueueSummary=require(_0xb349('0x6'))(_0xb349('0xa'));var ami=require('../ami');config[_0xb349('0xb')]=_[_0xb349('0xc')](config[_0xb349('0xb')],{'host':_0xb349('0xd'),'port':0x18eb});var io=require(_0xb349('0xe'))(new Redis(config[_0xb349('0xb')]));var cmHopper=require(_0xb349('0xf'));var voiceQueueRt=require(_0xb349('0x10'));var RpcSetting=require(_0xb349('0x11'));var Interval=require(_0xb349('0x12'));var Action=require('./models/action');var History=require(_0xb349('0x13'));var Final=require(_0xb349('0x14'));var AgentComplete=require(_0xb349('0x15'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xb349('0x16'));var ipAgi=process[_0xb349('0x17')][_0xb349('0x18')]||_0xb349('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb349('0x1a')]['enqueue']=function(_0x134d51){this[_0xb349('0x1b')]=this[_0xb349('0x1b')]?this[_0xb349('0x1b')][_0xb349('0x1c')](_0x134d51):_0x134d51();};function Dialer(_0x17f418,_0x40890d){this[_0xb349('0x1d')]=new Sequence();this[_0xb349('0x1e')]=_0x40890d;this['voiceQueues']=_0x17f418[_0xb349('0x1f')];this[_0xb349('0x20')]=_0x17f418[_0xb349('0x20')];this[_0xb349('0x21')]=_0x17f418['agents'];this[_0xb349('0x22')]=_0x17f418[_0xb349('0x22')];this[_0xb349('0x23')]=config[_0xb349('0x23')]||0x2;this[_0xb349('0x24')]={};this[_0xb349('0x25')]={};this['contactsId']={};this[_0xb349('0x26')]={};this[_0xb349('0x27')]={};this[_0xb349('0x28')]={};this[_0xb349('0x29')]={};this[_0xb349('0x2a')]={};this['queueBooked']={};this[_0xb349('0x2b')]={};this[_0xb349('0x2c')]={};ami['on'](_0xb349('0x2d'),this[_0xb349('0x2e')][_0xb349('0x2f')](this));ami['on'](_0xb349('0x30'),this[_0xb349('0x31')][_0xb349('0x2f')](this));ami['on']('originateresponse',this[_0xb349('0x32')][_0xb349('0x2f')](this));ami['on']('agentcomplete',this[_0xb349('0x33')][_0xb349('0x2f')](this));ami['on'](_0xb349('0x34'),this[_0xb349('0xa')][_0xb349('0x2f')](this));ami['on'](_0xb349('0x35'),this[_0xb349('0x36')][_0xb349('0x2f')](this));ami['on'](_0xb349('0x37'),this[_0xb349('0x38')][_0xb349('0x2f')](this));ami['on'](_0xb349('0x39'),this['syncNewExten'][_0xb349('0x2f')](this));ami['on'](_0xb349('0x3a'),this[_0xb349('0x3b')][_0xb349('0x2f')](this));ami['on'](_0xb349('0x3c'),this[_0xb349('0x3d')][_0xb349('0x2f')](this));ami['on']('queuestatuscomplete',this[_0xb349('0x3e')][_0xb349('0x2f')](this));this['loopCampaigns']();this[_0xb349('0x3f')]();RpcSetting[_0xb349('0x40')]()[_0xb349('0x41')](function(_0x52f644){previewRecallmeReminderInterval=_0x52f644[_0xb349('0x42')];});}function isNotNull(_0x9049b2){return _0x9049b2!==null&&!_[_0xb349('0x43')](_0x9049b2);}function msgResponse(_0x12225c,_0x56fe54,_0x1f14de){return{'action':_0x12225c,'response':_0x56fe54,'message':_0x1f14de,'stack':_0x1f14de};}function emit(_0x2fc802,_0x4db15c,_0x1e74df){io['to'](_0x2fc802)[_0xb349('0x44')](_0x4db15c,_0x1e74df);}function emitOutboundVoiceQueueSummary(_0x3df975){if(_0x3df975[_0xb349('0x45')]===_0xb349('0x46')){logger[_0xb349('0x47')](_0xb349('0x48'),util['inspect'](_0x3df975,{'showHidden':![],'depth':null}));emit(util[_0xb349('0x49')](_0xb349('0x4a'),_0x3df975['name']),_0xb349('0x4b'),_0x3df975);}}function checkGetDataPredictive(_0xf10024){if(isNotNull(_0xf10024)&&!_[_0xb349('0x4c')](_0xf10024)){loggerPredictive[_0xb349('0x4d')](_0xb349('0x4e'));loggerPredictive[_0xb349('0x4d')](_0xb349('0x4f'),_0xf10024[_0xb349('0x50')]);loggerPredictive[_0xb349('0x4d')](_0xb349('0x51'),_0xf10024['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xb349('0x4d')](_0xb349('0x52'),_0xf10024[_0xb349('0x53')]);loggerPredictive['info'](_0xb349('0x54'),_0xf10024['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xb349('0x4d')](_0xb349('0x55'),_0xf10024[_0xb349('0x56')]);loggerPredictive[_0xb349('0x4d')](_0xb349('0x57'),_0xf10024[_0xb349('0x58')]);loggerPredictive['info']('---------------------------');if(_0xf10024[_0xb349('0x50')]>0x0){if(!_[_0xb349('0x43')](_0xf10024['predictiveIntervalAvgTalktime'])&&_0xf10024[_0xb349('0x58')]>0x0){return!![];}loggerPredictive[_0xb349('0x4d')](_0xb349('0x59'));if(!_['isUndefined'](_0xf10024[_0xb349('0x56')])&&_0xf10024[_0xb349('0x56')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xb349('0x4d')](_0xb349('0x5a'));}}else{loggerPredictive[_0xb349('0x4d')](_0xb349('0x5b'));}return![];}function mergeDataErlangB(_0x1bb9d1){return function(_0x5dc8af){loggerPredictive[_0xb349('0x4d')](_0xb349('0x5c'));loggerPredictive[_0xb349('0x4d')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5dc8af[_0xb349('0x5d')]);loggerPredictive[_0xb349('0x4d')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5dc8af['erlangCallToSecond']);loggerPredictive[_0xb349('0x4d')](_0xb349('0x5e'),_0x5dc8af[_0xb349('0x5f')]);loggerPredictive['info'](_0xb349('0x60'),_0x5dc8af[_0xb349('0x61')]);loggerPredictive[_0xb349('0x4d')](_0xb349('0x5e'),_0x5dc8af['erlangAbandonmentRate']);loggerPredictive[_0xb349('0x4d')](_0xb349('0x62'));_[_0xb349('0x63')](_0x1bb9d1,_0x5dc8af);};}function ifInterval(_0x36f898,_0x512dd0){if(_['isUndefined'](_0x512dd0)){return![];}return utils[_0xb349('0x64')](undefined,_0x512dd0)<_0x36f898*0x3c;}function clearPredictiveAttributes(_0x480190){if(_0x480190[_0xb349('0x29')]){_0x480190[_0xb349('0x29')]=undefined;loggerPredictive[_0xb349('0x47')](_0x480190[_0xb349('0x65')],_0xb349('0x66'));}if(_0x480190['startPredictive']){_0x480190[_0xb349('0x28')]=undefined;loggerPredictive[_0xb349('0x47')](_0x480190[_0xb349('0x65')],_0xb349('0x67'));}if(_0x480190['handlePredictive']){clearInterval(_0x480190[_0xb349('0x68')]);_0x480190[_0xb349('0x68')]=undefined;loggerPredictive['debug'](_0x480190[_0xb349('0x65')],_0xb349('0x69'));}}function loggerCatchPredictive(_0x16cc21,_0x175cdc){return function(_0x7bd48e){loggerPredictive['error'](_0x175cdc[_0xb349('0x65')],_0x16cc21);loggerPredictive['error'](_0x7bd48e[_0xb349('0x6a')]);clearPredictiveAttributes(_0x175cdc);};}function loggerCatch(_0x2b719b){return function(_0x598935){logger[_0xb349('0x6b')](_0x2b719b,util['inspect'](_0x598935,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x48656,_0x48759a,_0x31af53){return function(_0x2720ea){utils[_0xb349('0x6c')](_0x48759a,_0x31af53,0x0);_0x48759a[_0xb349('0x6d')]=0x0;logger[_0xb349('0x6b')](_0x48656,util[_0xb349('0x6e')](_0x2720ea,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b2df1){return function(_0x4bc2cb){if(isNotNull(_0x4bc2cb)&&isNotNull(_0x4bc2cb[0x0])){if(_0x4bc2cb[0x0][_0xb349('0x6f')]>0x0){_0x2b2df1[_0xb349('0x70')]=utils[_0xb349('0x71')][_0xb349('0x72')];logger[_0xb349('0x4d')](_0xb349('0x73')+_0x2b2df1[_0xb349('0x65')],_0x4bc2cb[0x0][_0xb349('0x6f')],_0xb349('0x74'));}else{_0x2b2df1['message']=utils['CAMPAIGN_STATUS'][_0xb349('0x75')];logger[_0xb349('0x4d')](_0xb349('0x76')+_0x2b2df1[_0xb349('0x65')]);}}};}function createObjHistory(_0x54d8c5,_0x36a996,_0x3f61d8,_0x206d87,_0x39ac03){_0x54d8c5[_0xb349('0x70')]=_0x3f61d8;var _0x395d08=new Action(_0x54d8c5,_0x36a996);var _0x29e8c8=new History(_0x395d08);_0x29e8c8[_0xb349('0x77')]=_0x206d87;_0x29e8c8[_0xb349('0x78')]=_0x39ac03;_0x29e8c8[_0xb349('0x79')]=_0x395d08[_0xb349('0x7a')];return _0x29e8c8;}function unlockQueueStatus(_0x1dc89c,_0x4b8eea){setTimeout(function(){if(_[_0xb349('0x43')](_0x1dc89c[_0xb349('0x7b')])){loggerBooked['error'](_0xb349('0x7c'),_0x4b8eea);}_0x1dc89c[_0xb349('0x7b')]=!![];loggerBooked['info'](_0xb349('0x7d'),_0x4b8eea,JSON[_0xb349('0x7e')](_[_0xb349('0x7f')](_0x1dc89c,['name',_0xb349('0x7b')])));},0x1f3);}function checkInterval(_0x4ea8e1){return function(){if(!isNotNull(_0x4ea8e1['Interval'])){_0x4ea8e1[_0xb349('0x70')]=utils[_0xb349('0x71')]['NULL_INTERVAL'];throw _0x4ea8e1[_0xb349('0x65')]+_0xb349('0x80');}if(!isNotNull(_0x4ea8e1['Interval'][_0xb349('0x81')])){_0x4ea8e1[_0xb349('0x70')]=utils['CAMPAIGN_STATUS'][_0xb349('0x82')];throw _0x4ea8e1['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xb349('0x4c')](_0x4ea8e1[_0xb349('0x83')][_0xb349('0x81')]))){_0x4ea8e1[_0xb349('0x70')]=utils[_0xb349('0x71')][_0xb349('0x82')];throw _0x4ea8e1[_0xb349('0x65')]+_0xb349('0x80');}};}function checkIsIVRCampaignActive(_0x5e7348){return function(){if(!utils[_0xb349('0x84')](_0x5e7348)){_0x5e7348[_0xb349('0x70')]=utils[_0xb349('0x71')][_0xb349('0x85')];throw _0x5e7348[_0xb349('0x65')]+_0xb349('0x86');}};}function emitCampaignSummary(_0x3aa234){if(utils[_0xb349('0x87')](_0x3aa234)){emit(util[_0xb349('0x49')](_0xb349('0x88'),_0x3aa234[_0xb349('0x65')]),_0xb349('0x89'),_0x3aa234);}}function loggerCatchQueueSummary(_0x2de2fd,_0x310140){return function(_0x18ebd5){clearPredictiveAttributes(_0x310140);emitCampaignSummary(_0x310140);loggerSyncQueueSummary[_0xb349('0x47')](_0x2de2fd,util[_0xb349('0x6e')](_0x18ebd5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x22bdb4){if(_0x22bdb4[_0xb349('0x8a')]){if(_0x22bdb4['originated']===0x0){_0x22bdb4['sendMessageOneNotActive']=![];_0x22bdb4[_0xb349('0x70')]=utils['CAMPAIGN_STATUS'][_0xb349('0x85')];loggerSyncQueueSummary[_0xb349('0x47')](_0xb349('0x8b'),_0x22bdb4[_0xb349('0x65')],'is\x20not\x20active');}else{_0x22bdb4['message']=utils['CAMPAIGN_STATUS'][_0xb349('0x8c')];loggerSyncQueueSummary[_0xb349('0x47')](_0xb349('0x8b'),_0x22bdb4[_0xb349('0x65')],'is\x20disactive');}emitCampaignSummary(_0x22bdb4);}}function myreject(_0x558348){return function(_0x3ccd03){return _0x558348(msgResponse('[ifTime][Action]',_0xb349('0x8d'),JSON[_0xb349('0x7e')](_0x3ccd03)));};}Dialer[_0xb349('0x1a')]['isTrunkReachable']=function(_0x5eaae1){return!_[_0xb349('0x43')](_0x5eaae1)&&_0x5eaae1&&!_['isUndefined'](_0x5eaae1[_0xb349('0x65')])&&!_['isUndefined'](_0x5eaae1[_0xb349('0x8e')])&&_0x5eaae1[_0xb349('0x8e')]&&(this[_0xb349('0x22')][util[_0xb349('0x49')](_0xb349('0x8f'),_0x5eaae1[_0xb349('0x65')])][_0xb349('0x90')]===_0xb349('0x91')||this[_0xb349('0x22')][util[_0xb349('0x49')](_0xb349('0x8f'),_0x5eaae1['name'])]['status']===_0xb349('0x92'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x1f8db8){var _0x34166b=this;return function(){if(!_0x34166b[_0xb349('0x93')](_0x1f8db8[_0xb349('0x94')])){if(!_0x34166b[_0xb349('0x93')](_0x1f8db8[_0xb349('0x95')])){_0x1f8db8[_0xb349('0x70')]=utils[_0xb349('0x71')][_0xb349('0x96')];throw _0x1f8db8['name']+_0xb349('0x97');}}};};Dialer[_0xb349('0x1a')][_0xb349('0x98')]=function(_0x418cf0,_0x50e450,_0x2c03fc,_0x4bb369){var _0x31753c=this;return function(){var _0x575f2e=!![];return _0x31753c[_0xb349('0x99')](_0x418cf0,_0x50e450,_0x2c03fc,_0x4bb369,_0x575f2e);};};Dialer[_0xb349('0x1a')][_0xb349('0x9a')]=function(_0x3e9e7d,_0x2cd2c,_0x4468a5,_0x460027){var _0x15dcc9=this;return function(){var _0x47a742=![];return _0x15dcc9[_0xb349('0x99')](_0x3e9e7d['Intervals'],_0x2cd2c,_0x4468a5,_0x460027,_0x47a742);};};Dialer[_0xb349('0x1a')][_0xb349('0x99')]=function(_0x465ed4,_0x10c520,_0x8c3291,_0x4dbc3e,_0x587cfb){var _0x13fefd=[];return new Promise(function(_0x56060b,_0x457135){if(!isNotNull(_0x465ed4)){_0x4dbc3e[_0xb349('0x70')]=utils['CAMPAIGN_STATUS'][_0xb349('0x82')];return _0x457135(msgResponse(_0xb349('0x9b'),_0xb349('0x9c'),_0x8c3291+_0xb349('0x9d')));}if(_[_0xb349('0x4c')](_0x465ed4)){_0x4dbc3e[_0xb349('0x70')]=utils[_0xb349('0x71')]['EMPTY_INTERVAL'];return _0x457135(msgResponse(_0xb349('0x9b'),'Failure',_0x8c3291+_0xb349('0x9e')));}if(_0x10c520&&_[_0xb349('0x43')](config[_0xb349('0x9f')][_0x10c520])){_0x4dbc3e['message']=utils['CAMPAIGN_STATUS'][_0xb349('0xa0')];return _0x457135(msgResponse('ifTime',_0xb349('0x9c'),_0x8c3291+_0xb349('0xa1')+_0x10c520));}if(_[_0xb349('0xa2')](_0x465ed4)){for(var _0x33e24d=0x0;_0x33e24d<_0x465ed4[_0xb349('0xa3')];_0x33e24d+=0x1){_0x13fefd[_0xb349('0xa4')](ami[_0xb349('0xa5')]({'action':'command','command':util[_0xb349('0x49')](_0xb349('0xa6'),_0x465ed4[_0x33e24d]['interval'],!_[_0xb349('0x43')](config[_0xb349('0x9f')][_0x10c520])?_0x10c520:'')})[_0xb349('0x41')](function(_0x29dbf1){return _0x29dbf1[_0xb349('0xa7')]['indexOf'](_0xb349('0xa8'))>=0x0;})[_0xb349('0xa9')](myreject(_0x457135)));}}else{_0x13fefd[_0xb349('0xa4')](ami[_0xb349('0xa5')]({'action':_0xb349('0xaa'),'command':util[_0xb349('0x49')]('iftime\x20%s,%s',_0x465ed4,!_[_0xb349('0x43')](config['timezones'][_0x10c520])?_0x10c520:'')})[_0xb349('0x41')](function(_0x27390b){return _0x27390b[_0xb349('0xa7')][_0xb349('0xab')](_0xb349('0xa8'))>=0x0;})['catch'](myreject(_0x457135)));}Promise[_0xb349('0xac')](_0x13fefd)[_0xb349('0x41')](function(_0x3ae90d){var _0x501a65=_[_0xb349('0xad')](_0x3ae90d);if(_0x501a65){return _0x56060b(_0x501a65);}else{_0x4dbc3e[_0xb349('0x70')]=_0x587cfb?utils[_0xb349('0x71')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xb349('0x71')][_0xb349('0xae')];return _0x457135(msgResponse(_0xb349('0xaf'),'Failure',_0xb349('0xb0')+_0x587cfb+'\x20'+_0x8c3291+_0xb349('0xb1')+util['inspect'](_0x465ed4,{'showHidden':![],'depth':null})+_0xb349('0xb2')+_0x10c520));}})[_0xb349('0xa9')](function(_0x50545c){return _0x457135(msgResponse('ifTime',_0xb349('0x9c'),JSON[_0xb349('0x7e')](_0x50545c)));});});};Dialer[_0xb349('0x1a')][_0xb349('0xb3')]=function(){var _0x4d716e=this;return cmHopper[_0xb349('0xb4')]({'active':![]},{'where':{'active':!![]}})[_0xb349('0x41')](function(){setInterval(function(){_0x4d716e['syncCampaigns']();},0x3e8);});};Dialer[_0xb349('0x1a')][_0xb349('0xb5')]=function(){var _0x3d9279=this;var _0x4735e9;for(var _0xe06aeb in this[_0xb349('0x20')]){if(typeof this[_0xb349('0x20')][_0xe06aeb]!==_0xb349('0xb6')){_0x4735e9=this['campaigns'][_0xe06aeb];if(utils[_0xb349('0x87')](_0x4735e9)&&utils['isIVRCampaignActive'](_0x4735e9)){_0x4735e9[_0xb349('0x8a')]=!![];Promise[_0xb349('0xb7')]()['then'](checkIsIVRCampaignActive(_0x4735e9))[_0xb349('0x41')](checkInterval(_0x4735e9))[_0xb349('0x41')](_0x3d9279[_0xb349('0xb8')](_0x4735e9))['then'](_0x3d9279[_0xb349('0x98')](_0x4735e9[_0xb349('0xb9')],_0x4735e9[_0xb349('0xba')],_0x4735e9[_0xb349('0x65')],_0x4735e9))[_0xb349('0x41')](_0x3d9279[_0xb349('0x9a')](_0x4735e9[_0xb349('0x83')],_0x4735e9[_0xb349('0xba')],_0x4735e9[_0xb349('0x65')],_0x4735e9))[_0xb349('0x41')](_0x3d9279[_0xb349('0xbb')](_0x4735e9))[_0xb349('0xa9')](loggerCatchQueueSummary(_0xb349('0xbc'),_0x4735e9));}else{notSendMessagesCampaign(_0x4735e9);}}}};Dialer[_0xb349('0x1a')][_0xb349('0xbd')]=function(_0x3f383f){if(_0x3f383f['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x3f383f);}switch(_0x3f383f['dialMethod']){case'progressive':this[_0xb349('0xbe')](_0x3f383f,0x1);break;case _0xb349('0xbf'):this[_0xb349('0xbe')](_0x3f383f,_0x3f383f['dialPowerLevel']);break;case _0xb349('0x8'):this['predictive'](_0x3f383f);break;case'booked':this[_0xb349('0xbe')](_0x3f383f,0x1);break;default:logger['error']('Queue',_0x3f383f[_0xb349('0x65')],_0xb349('0xc0'));}};Dialer[_0xb349('0x1a')][_0xb349('0x9b')]=function(_0x35b967,_0x4c1ce6){var _0x4647b3=_0x35b967[_0xb349('0xba')];var _0x371682=_0x4c1ce6?_0x35b967['dialGlobalInterval']:_0x35b967['Interval'][_0xb349('0x81')];logger['silly']('Dialer::ifTime()',_0x371682,_0x4647b3,_0x35b967[_0xb349('0x65')],util[_0xb349('0x49')]('Voice\x20Queue\x20%s\x20$s',_0x35b967[_0xb349('0x65')],_0x35b967['id']));var _0x25b75f=null;return Interval['intervalIftime'](_0x371682,_0x4647b3)[_0xb349('0x41')](function(_0x5e0356){if(_0x5e0356===!![]){return _0x5e0356;}else{_0x35b967[_0xb349('0x70')]=_0x4c1ce6?utils['CAMPAIGN_STATUS'][_0xb349('0xc1')]:utils[_0xb349('0x71')][_0xb349('0xae')];_0x25b75f=msgResponse('[ifTime][promiseAll]',_0xb349('0x9c'),'Global:\x20'+_0x4c1ce6+'\x20'+_0x35b967[_0xb349('0x65')]+_0xb349('0xb1')+util[_0xb349('0x6e')](_0x371682,{'showHidden':![],'depth':null})+_0xb349('0xb2')+_0x4647b3);}if(_0x25b75f!==null){logger[_0xb349('0xc2')](_0xb349('0xc3'),_0x25b75f);_0x25b75f[_0xb349('0xc4')]=_0x4c1ce6;throw _0x25b75f;}})[_0xb349('0xa9')](function(_0x51e2dc){logger[_0xb349('0x6b')](_0xb349('0xc5'),_0x51e2dc);throw msgResponse(_0xb349('0xc6'),_0xb349('0x8d'),util[_0xb349('0x6e')](_0x51e2dc,{'showHidden':![],'depth':null}));});};Dialer[_0xb349('0x1a')]['syncAgentConnect']=function(_0x5d5219){if(this[_0xb349('0x1f')][_0x5d5219['queue']]){if(this[_0xb349('0x26')][_0x5d5219[_0xb349('0xc7')]]&&this[_0xb349('0x26')][_0x5d5219['uniqueid']]['type']!=='ivr'){this[_0xb349('0xc8')](this['voiceQueues'][_0x5d5219[_0xb349('0xc9')]]);this[_0xb349('0x26')][_0x5d5219[_0xb349('0xc7')]][_0xb349('0xca')]=moment()[_0xb349('0x49')](_0xb349('0xcb'));}}};Dialer[_0xb349('0x1a')][_0xb349('0x33')]=function(_0x78df93){var _0x31e4d2=this[_0xb349('0x26')][_0x78df93[_0xb349('0xc7')]];if(this['voiceQueues'][_0x78df93[_0xb349('0xc9')]]){if(_0x31e4d2&&_0x31e4d2[_0xb349('0x45')]!==_0xb349('0xcc')){delete this[_0xb349('0x26')][_0x78df93['uniqueid']];this['voiceQueues'][_0x78df93['queue']][_0xb349('0xcd')]+=0x1;var _0x1038f4=new AgentComplete(_0x31e4d2,_0x78df93);if(_0x78df93[_0xb349('0xce')]===_0xb349('0xcf')){_0x1038f4[_0xb349('0xd0')]=this[_0xb349('0x1f')][_0x78df93[_0xb349('0xc9')]][_0xb349('0xd1')]&&this[_0xb349('0x1f')][_0x78df93['queue']][_0xb349('0xd2')]?moment()[_0xb349('0x49')](_0xb349('0xcb')):undefined;}hopperUtils[_0xb349('0xd3')](_0x1038f4)[_0xb349('0xa9')](loggerCatch(_0xb349('0xd4')));hopperUtils[_0xb349('0xd5')](_0x1038f4)[_0xb349('0xa9')](loggerCatch(_0xb349('0xd6')));}}};Dialer[_0xb349('0x1a')][_0xb349('0x31')]=function(_0x26b264){var _0x895ecd=this[_0xb349('0x26')][_0x26b264[_0xb349('0xc7')]];var _0x33f65f=this;var _0x29102a=![];var _0x573b4a;var _0x2ab20f;if(this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]]){if(_0x895ecd&&_0x895ecd[_0xb349('0x45')]!=='ivr'){delete this[_0xb349('0x26')][_0x26b264['uniqueid']];this[_0xb349('0xc8')](this['voiceQueues'][_0x26b264['queue']]);_0x895ecd[_0xb349('0xd7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4ac302=new QueueCallerAbandon(_0x895ecd,_0x26b264);if(utils[_0xb349('0x64')](_0x895ecd[_0xb349('0xd7')],_0x895ecd[_0xb349('0xd8')])>=_0x895ecd['dialQueueTimeout']){this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0x53')]+=0x1;this[_0xb349('0x1f')][_0x26b264['queue']][_0xb349('0xd9')]+=0x1;this[_0xb349('0x1f')][_0x26b264['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4ac302[_0xb349('0x77')]=0xa;_0x4ac302[_0xb349('0x78')]='Drop';_0x4ac302[_0xb349('0xda')]='TIMEOUT';_0x4ac302['agiafterat']=this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]]['dialQueueProject2']?moment()[_0xb349('0x49')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4ac302[_0xb349('0xdb')]+=0x1;_0x4ac302['countglobal']+=0x1;_0x573b4a=this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0xdc')];_0x2ab20f=this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0xdd')];hopperUtils[_0xb349('0xde')](_0x4ac302,_0x4ac302[_0xb349('0x77')],_0x895ecd[_0xb349('0xdf')])[_0xb349('0x41')](function(_0x2b377b){_0x29102a=_0x2b377b[_0xb349('0xe0')]==0x1;if(_0x4ac302[_0xb349('0xdb')]>=_0x33f65f[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0xe1')]){_0x33f65f[_0xb349('0xe2')](_0x4ac302,_0x2b377b[_0xb349('0xe0')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4ac302['countdropretry'],'scheduledat':moment()[_0xb349('0xe3')](_0x33f65f['voiceQueues'][_0x26b264[_0xb349('0xc9')]]['dialDropRetryFrequency'],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x895ecd[_0xb349('0xe5')],'ListId':_0x895ecd['ListId'],'VoiceQueueId':_0x895ecd[_0xb349('0xe6')]||undefined,'CampaignId':_0x895ecd['CampaignId']||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0xe7')));var _0x2f0094=new History(_0x4ac302);_0x2f0094['state']=0xa;_0x2f0094[_0xb349('0x78')]=_0xb349('0xe8');_0x2f0094[_0xb349('0x7a')]=moment()['format'](_0xb349('0xcb'));_0x2f0094[_0xb349('0x79')]=_0x2f0094[_0xb349('0x7a')];_0x2f0094[_0xb349('0xe9')]=_0x4ac302[_0xb349('0xe9')];_0x2f0094['calleridnum']=_0x4ac302[_0xb349('0xea')];hopperUtils[_0xb349('0xd3')](_0x2f0094)[_0xb349('0xa9')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xb349('0x41')](function(){if(_0x29102a)hopperUtils[_0xb349('0xeb')](_0x4ac302,_0x573b4a,_0x2ab20f)[_0xb349('0x41')](function(){return 0x1;});});}else{this['voiceQueues'][_0x26b264[_0xb349('0xc9')]][_0xb349('0xec')]+=0x1;this[_0xb349('0x1f')][_0x26b264['queue']][_0xb349('0xed')]+=0x1;_0x4ac302[_0xb349('0x77')]=0xb;_0x4ac302['statedesc']=_0xb349('0xee');_0x4ac302[_0xb349('0xda')]=_0xb349('0xef');_0x4ac302['countabandonedretry']+=0x1;_0x4ac302[_0xb349('0xf0')]+=0x1;_0x573b4a=this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0xf1')];_0x2ab20f=this[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0xdd')];hopperUtils['verifyAdditionalPhones'](_0x4ac302,_0x4ac302[_0xb349('0x77')],_0x895ecd[_0xb349('0xdf')])[_0xb349('0x41')](function(_0x5a08d5){if(_0x4ac302[_0xb349('0xf2')]>=_0x33f65f['voiceQueues'][_0x26b264[_0xb349('0xc9')]][_0xb349('0xf3')]){_0x33f65f['queueCallerAbandonCreateState'](_0x4ac302,_0x5a08d5['additional']);}else{hopperUtils[_0xb349('0xf4')]({'active':![],'countabandonedretry':_0x4ac302['countabandonedretry'],'scheduledat':moment()[_0xb349('0xe3')](_0x33f65f[_0xb349('0x1f')][_0x26b264[_0xb349('0xc9')]][_0xb349('0xf1')],'minutes')[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x895ecd['ContactId'],'ListId':_0x895ecd['ListId'],'VoiceQueueId':_0x895ecd[_0xb349('0xe6')]||undefined,'CampaignId':_0x895ecd[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0xf6')));var _0x155f7d=new History(_0x4ac302);_0x155f7d[_0xb349('0x77')]=0xb;_0x155f7d[_0xb349('0x78')]=_0xb349('0xee');_0x155f7d[_0xb349('0x7a')]=moment()[_0xb349('0x49')](_0xb349('0xcb'));_0x155f7d[_0xb349('0x79')]=_0x155f7d['starttime'];_0x155f7d[_0xb349('0xe9')]=_0x4ac302[_0xb349('0xe9')];_0x155f7d['calleridnum']=_0x4ac302[_0xb349('0xea')];hopperUtils[_0xb349('0xd3')](_0x155f7d)[_0xb349('0xa9')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xb349('0x41')](function(){if(_0x29102a)hopperUtils[_0xb349('0xeb')](_0x4ac302,_0x573b4a,_0x2ab20f)[_0xb349('0x41')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xb349('0xf7')]=function(_0xef38d1){if(this[_0xb349('0x25')][_0xef38d1[_0xb349('0xc7')]]){this[_0xb349('0x25')][_0xef38d1['uniqueid']]['channel']=_0xef38d1[_0xb349('0xf8')];}if(this['uniqueId'][_0xef38d1[_0xb349('0xc7')]]){this['uniqueId'][_0xef38d1['uniqueid']][_0xb349('0xf8')]=_0xef38d1[_0xb349('0xf8')];}};Dialer['prototype'][_0xb349('0x3d')]=function(_0x38133d){if(!this['actions'][_0x38133d[_0xb349('0xf9')]]){return;}var _0x458d0e=this[_0xb349('0x1f')][this['actions'][_0x38133d[_0xb349('0xf9')]]['queue']][_0xb349('0xfa')]||'rrmemory';if(_0x458d0e==='roundrobin'){if(this[_0xb349('0x25')][_0x38133d['actionid']]&&_[_0xb349('0xfb')](this[_0xb349('0x25')][_0x38133d[_0xb349('0xf9')]]['locked'])&&_0x38133d[_0xb349('0x90')]==='1'&&_0x38133d[_0xb349('0xfc')]==='0'){if(this['agents'][_0x38133d[_0xb349('0xfd')]]){if(!this[_0xb349('0x21')][_0x38133d[_0xb349('0xfd')]][_0xb349('0xfe')]){this[_0xb349('0x21')][_0x38133d[_0xb349('0xfd')]][_0xb349('0xfe')]=!![];this[_0xb349('0x25')][_0x38133d[_0xb349('0xf9')]][_0xb349('0xfe')]=!![];this[_0xb349('0x25')][_0x38133d[_0xb349('0xf9')]]['stateinterface']=_0x38133d[_0xb349('0xfd')];}}}}else if(_0x458d0e==='rrmemory'){if(this[_0xb349('0x25')][_0x38133d['actionid']]){if(this['agents'][_0x38133d['stateinterface']]){this[_0xb349('0x25')][_0x38133d['actionid']]['stateinterface']=_0x38133d[_0xb349('0xfd')];if(_[_0xb349('0xfb')](this[_0xb349('0xff')][this[_0xb349('0x25')][_0x38133d[_0xb349('0xf9')]][_0xb349('0xc9')]])){this[_0xb349('0xff')][this['actions'][_0x38133d[_0xb349('0xf9')]][_0xb349('0xc9')]]=[];}this[_0xb349('0xff')][this['actions'][_0x38133d[_0xb349('0xf9')]][_0xb349('0xc9')]][_0xb349('0xa4')](_[_0xb349('0x63')](_[_0xb349('0x7f')](this['actions'][_0x38133d[_0xb349('0xf9')]],['idHopper',_0xb349('0xfd')]),{'status':_0x38133d[_0xb349('0x90')],'paused':_0x38133d[_0xb349('0xfc')]}));}}}};Dialer[_0xb349('0x1a')][_0xb349('0x3e')]=function(_0x5e1921){if(!this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]]){return;}var _0x1faa91=this;var _0x4b89ab=this[_0xb349('0x1f')][this['actions'][_0x5e1921['actionid']][_0xb349('0xc9')]];var _0x2f14c0=_0x4b89ab[_0xb349('0xfa')]||_0xb349('0x100');if(_0x2f14c0===_0xb349('0x101')){if(this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]]&&this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xfd')]){this[_0xb349('0x1e')][_0xb349('0x102')](this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0x103')],this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xfd')])[_0xb349('0xa9')](function(_0x5b3e91){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0xb349('0x6e')](_0x5b3e91,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1faa91[_0xb349('0xc8')](_0x1faa91['voiceQueues'][_0x1faa91[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]]);_0x1faa91[_0xb349('0x21')][_0x1faa91[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xfd')]][_0xb349('0xfe')]=![];delete _0x1faa91['actions'][_0x5e1921[_0xb349('0xf9')]];unlockQueueStatus(_0x4b89ab);});}else{this[_0xb349('0xc8')](this[_0xb349('0x1f')][this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]]);hopperUtils[_0xb349('0xf4')]({'active':![],'ContactId':this['actions'][_0x5e1921['actionid']][_0xb349('0xe5')],'ListId':this['actions'][_0x5e1921[_0xb349('0xf9')]][_0xb349('0x104')],'VoiceQueueId':this['actions'][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xe6')]||undefined,'CampaignId':this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]]['CampaignId']||undefined})[_0xb349('0xa9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xb349('0x25')][_0x5e1921['actionid']];unlockQueueStatus(_0x4b89ab);}}else if(_0x2f14c0===_0xb349('0x100')){var _0x152740;if(this['actions'][_0x5e1921[_0xb349('0xf9')]]&&!_['isEmpty'](this[_0xb349('0xff')][this['actions'][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]])){if(this[_0xb349('0x2b')][_0x1faa91['actions'][_0x5e1921['actionid']]['queue']]){this[_0xb349('0x2b')][_0x1faa91[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]]=this[_0xb349('0x2b')][this['actions'][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]]?this[_0xb349('0x2b')][this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]]['queue']]:this[_0xb349('0xff')][this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]]?this[_0xb349('0xff')][this[_0xb349('0x25')][_0x5e1921['actionid']]['queue']][_0xb349('0x105')]||0x0:0x0;}this[_0xb349('0xff')][this[_0xb349('0x25')][_0x5e1921[_0xb349('0xf9')]][_0xb349('0xc9')]][_0xb349('0x105')]=this[_0xb349('0x2b')][this[_0xb349('0x25')][_0x5e1921['actionid']][_0xb349('0xc9')]];for(var _0x18196f=0x0;_0x18196f=_0x2da81c['dialGlobalMaxRetry']){_0x55b913[_0xb349('0x12b')](_0x26addb,_0x26e6a1,_0x997e1e,_0xb349('0x12c'));}else{if(_0x26addb['countmachineretry']>=_0x2da81c[_0xb349('0x12d')]){_0x55b913['createStateFinal'](_0x26addb,_0x26e6a1,_0x997e1e,_0xb349('0x12e'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x26addb['countmachineretry'],'scheduledat':moment()[_0xb349('0xe3')](_0x2da81c['dialMachineRetryFrequency'],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x26addb[_0xb349('0xe5')],'ListId':_0x26addb[_0xb349('0x104')],'VoiceQueueId':_0x26addb[_0xb349('0xe6')]||undefined,'CampaignId':_0x26addb['CampaignId']||undefined})[_0xb349('0xa9')](loggerCatch('[rescheduleContact][Machine]'));_0x26e6a1({'reschedule':0x1});}}});}if(_0xaa4942[_0xb349('0x45')]===_0xb349('0xcc')&&this[_0xb349('0x20')][_0xaa4942[_0xb349('0xc9')]][_0xb349('0x12f')]&&_0x40861d[_0xb349('0x117')]===_0xb349('0x118')){delete this[_0xb349('0x26')][_0x40861d[_0xb349('0xc7')]];this['updateOriginated'](this[_0xb349('0x20')][_0xaa4942['queue']]);_0x2a947f=new Hangup(_0xaa4942,_0x40861d);_0x2a947f['state']=0x12;_0x2a947f[_0xb349('0x78')]='HangupInAMD';_0x2a947f[_0xb349('0x121')]=_0xb349('0x122');ami[_0xb349('0x44')](_0xb349('0x11a'),ut[_0xb349('0x124')](_0x2a947f,_0xb349('0x125')));this[_0xb349('0x11b')](_0x2a947f,_0xb349('0x130'),_0xb349('0x131'));}if(_0xaa4942[_0xb349('0x45')]==='ivr'&&this['campaigns'][_0xaa4942['queue']][_0xb349('0x12f')]&&_0x40861d[_0xb349('0x117')]==='MACHINE'){return new Promise(function(_0x387132,_0x58e309){delete _0x55b913['uniqueId'][_0x40861d['uniqueid']];_0x55b913[_0xb349('0xc8')](_0x55b913[_0xb349('0x20')][_0xaa4942[_0xb349('0xc9')]]);_0x55b913['campaigns'][_0xaa4942[_0xb349('0xc9')]][_0xb349('0xcd')]+=0x1;_0x55b913[_0xb349('0x20')][_0xaa4942[_0xb349('0xc9')]][_0xb349('0x11f')]+=0x1;var _0x341e9c=_0x55b913[_0xb349('0x20')][_0xaa4942['queue']];var _0x11d13f=new Hangup(_0xaa4942,_0x40861d);_0x11d13f[_0xb349('0x77')]=0x13;_0x11d13f['statedesc']=_0xb349('0x120');_0x11d13f[_0xb349('0x121')]=_0xb349('0x122');_0x11d13f[_0xb349('0x123')]+=0x1;_0x11d13f[_0xb349('0xf0')]+=0x1;_0x11d13f['amd']=!![];ami[_0xb349('0x44')]('custom:amd',ut[_0xb349('0x124')](_0x11d13f,_0xb349('0x125')));hopperUtils[_0xb349('0xd3')](_0x11d13f)[_0xb349('0xa9')](loggerCatch(_0xb349('0x126')));if(_0x11d13f['countbusyretry']+_0x11d13f[_0xb349('0x128')]+_0x11d13f[_0xb349('0x129')]+_0x11d13f['countnosuchnumberretry']+_0x11d13f['countdropretry']+_0x11d13f[_0xb349('0xf2')]+_0x11d13f[_0xb349('0x123')]+_0x11d13f[_0xb349('0x12a')]>=_0x341e9c[_0xb349('0x132')]){_0x55b913[_0xb349('0x12b')](_0x11d13f,_0x387132,_0x58e309,'reason19\x20machine....');}else{if(_0x11d13f[_0xb349('0x123')]>=_0x341e9c['dialMachineMaxRetry']){_0x55b913[_0xb349('0x133')](_0x11d13f,_0x387132,_0x58e309,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x11d13f[_0xb349('0x123')],'scheduledat':moment()[_0xb349('0xe3')](_0x341e9c[_0xb349('0x134')],_0xb349('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x11d13f['ContactId'],'ListId':_0x11d13f[_0xb349('0x104')],'VoiceQueueId':_0x11d13f[_0xb349('0xe6')]||undefined,'CampaignId':_0x11d13f[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch('[rescheduleContact][Machine]'));_0x387132({'reschedule':0x1});}}});}}};Dialer[_0xb349('0x1a')][_0xb349('0x38')]=function(_0x3cd761){var _0x281151=this[_0xb349('0x26')][_0x3cd761[_0xb349('0xc7')]];var _0x1028e6;if(_0x281151&&_0x281151[_0xb349('0x45')]==='ivr'){delete this['uniqueId'][_0x3cd761['uniqueid']];this[_0xb349('0xc8')](this[_0xb349('0x20')][_0x281151['queue']]);this[_0xb349('0x20')][_0x281151[_0xb349('0xc9')]][_0xb349('0x135')]+=0x1;_0x1028e6=new Hangup(_0x281151,_0x3cd761);hopperUtils[_0xb349('0xd3')](_0x1028e6)[_0xb349('0xa9')](loggerCatch(_0xb349('0x136')));hopperUtils[_0xb349('0xd5')](_0x1028e6)[_0xb349('0xa9')](loggerCatch('[syncHangupIvr]'));}if(_0x281151&&_0x281151[_0xb349('0x45')]!=='ivr'&&isNotNull(this[_0xb349('0x1f')][_0x281151['queue']][_0xb349('0x137')])){delete this[_0xb349('0x26')][_0x3cd761[_0xb349('0xc7')]];this['updateOriginated'](this[_0xb349('0x1f')][_0x281151[_0xb349('0xc9')]]);this['voiceQueues'][_0x281151[_0xb349('0xc9')]][_0xb349('0xcd')]+=0x1;this[_0xb349('0x1f')][_0x281151[_0xb349('0xc9')]][_0xb349('0x11f')]+=0x1;_0x1028e6=new Hangup(_0x281151,_0x3cd761);_0x1028e6[_0xb349('0x77')]=0x10;_0x1028e6['statedesc']='AnswerAGI';_0x1028e6[_0xb349('0x121')]=_0xb349('0x138');hopperUtils['createHistory'](_0x1028e6)['catch'](loggerCatch(_0xb349('0x136')));hopperUtils['moveContactManagedDialer'](_0x1028e6)[_0xb349('0xa9')](loggerCatch(_0xb349('0x139')));}if(_0x281151&&_0x281151[_0xb349('0x45')]!=='ivr'&&!isNotNull(this[_0xb349('0x1f')][_0x281151[_0xb349('0xc9')]][_0xb349('0x137')])){if(_0x3cd761[_0xb349('0x13a')]===_0xb349('0x13b')){delete this[_0xb349('0x26')][_0x3cd761[_0xb349('0xc7')]];this['voiceQueues'][_0x281151[_0xb349('0xc9')]]['outboundAnswerCallsDay']+=0x1;const _0x1b0145=new AgentComplete(_0x281151,_0x3cd761);_0x1b0145[_0xb349('0xf5')]=this[_0xb349('0x1f')][_0x281151['queue']]['id'];hopperUtils[_0xb349('0xd3')](_0x1b0145)['catch'](loggerCatch(_0xb349('0xd4')));hopperUtils[_0xb349('0xd5')](_0x1b0145)[_0xb349('0xa9')](loggerCatch('[syncAgentComplete]'));}else{delete this[_0xb349('0x26')][_0x3cd761[_0xb349('0xc7')]];this[_0xb349('0xc8')](this[_0xb349('0x1f')][_0x281151['queue']]);this[_0xb349('0x1f')][_0x281151[_0xb349('0xc9')]][_0xb349('0x13c')]+=0x1;_0x1028e6=new Hangup(_0x281151,_0x3cd761);_0x1028e6[_0xb349('0x77')]=0xc;_0x1028e6[_0xb349('0x78')]=_0x3cd761['cause-txt'];_0x1028e6[_0xb349('0x121')]=_0xb349('0x13d');hopperUtils[_0xb349('0xd3')](_0x1028e6)[_0xb349('0xa9')](loggerCatch(_0xb349('0x136')));hopperUtils[_0xb349('0xd5')](_0x1028e6)[_0xb349('0xa9')](loggerCatch(_0xb349('0x139')));}}};Dialer['prototype']['syncQueueSummary']=function(_0x307294){var _0x4cae7d=this;if(!_0x4cae7d[_0xb349('0x2c')][_0x307294[_0xb349('0x65')]]){_0x4cae7d[_0xb349('0x2c')][_0x307294['name']]={'running':![]};}else if(_0x4cae7d[_0xb349('0x2c')][_0x307294[_0xb349('0x65')]][_0xb349('0x13e')]===!![]){return;}else if(_0x4cae7d[_0xb349('0x2c')][_0x307294['name']][_0xb349('0x13e')]===![]){_0x4cae7d[_0xb349('0x2c')][_0x307294[_0xb349('0x65')]][_0xb349('0x13e')]=!![];}var _0x5281a7=_0x4cae7d[_0xb349('0x1f')][_0x307294[_0xb349('0x65')]];var _0x53ac02=_0x5281a7['message']!==utils[_0xb349('0x71')]['INACTIVE'];var _0x13e4ff=utils[_0xb349('0x13f')](_0x5281a7);_0x5281a7[_0xb349('0x140')]=utils['getQueueCampaignStatusMessage'](_0x5281a7,_0x4cae7d['trunks']);Promise['resolve']()[_0xb349('0x41')](function(){if(_0x5281a7[_0xb349('0x140')]===utils[_0xb349('0x71')]['INACTIVE']){if(_0x53ac02){clearPredictiveAttributes(_0x5281a7);_0x307294['startPredictive']=undefined;_0x307294[_0xb349('0x29')]=undefined;}if(_0x5281a7[_0xb349('0x140')]===utils[_0xb349('0x71')][_0xb349('0x85')]){_0x307294[_0xb349('0x141')]=0x0;_0x307294[_0xb349('0xfc')]=0x0;_0x307294[_0xb349('0x142')]=0x0;_0x307294[_0xb349('0x143')]=0x0;_0x307294['pTalking']=0x0;}}else if(_0x5281a7[_0xb349('0x140')]===utils[_0xb349('0x71')][_0xb349('0x144')]&&!_0x13e4ff){return _0x4cae7d[_0xb349('0x9b')](_0x5281a7,!![])[_0xb349('0x41')](function(){return _0x4cae7d[_0xb349('0x9b')](_0x5281a7,![]);})[_0xb349('0x41')](function(){return _0x4cae7d[_0xb349('0xbd')](_0x5281a7);})[_0xb349('0xa9')](function(_0x10c741){loggerSyncQueueSummary['debug'](_0xb349('0x145'),util[_0xb349('0x6e')](_0x10c741,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5281a7);});}else{clearPredictiveAttributes(_0x5281a7);}})[_0xb349('0x41')](function(){var _0x5bc8bc=_0x307294[_0xb349('0x146')](_0x5281a7);if(_0x5bc8bc||_0x5281a7[_0xb349('0x147')]){_0x5281a7[_0xb349('0x147')]=![];_0x307294[_0xb349('0x148')](_0x5281a7);Object['assign'](_0x5281a7,_0x307294);emitOutboundVoiceQueueSummary(_0x307294);}_0x4cae7d[_0xb349('0x2c')][_0x5281a7['name']]['running']=![];})[_0xb349('0xa9')](function(_0x162392){logger[_0xb349('0x6b')](_0xb349('0x145'),util['inspect'](_0x162392,{'showHidden':![],'depth':null}));_0x4cae7d[_0xb349('0x2c')][_0x5281a7[_0xb349('0x65')]][_0xb349('0x13e')]=![];});};Dialer[_0xb349('0x1a')][_0xb349('0x36')]=_[_0xb349('0x149')](function(){var _0x40a867=_[_0xb349('0x14a')](this[_0xb349('0x1f')],function(_0x2e73ff){return _0x2e73ff['dialPreviewRecallmeReminder'];});var _0x332020=_[_0xb349('0x14a')](this[_0xb349('0x21')],function(_0x10f3a2){return _0x10f3a2[_0xb349('0x14b')]&&_0x10f3a2[_0xb349('0x90')]==='reachable';});if(_0x40a867[_0xb349('0xa3')]>0x0&&_0x332020[_0xb349('0xa3')]>0x0){return Promise[_0xb349('0xb7')]()[_0xb349('0x41')](cmHopper['handlePreviewRecallNotifications'](_[_0xb349('0x14c')](_0x40a867,'id'),previewRecallmeReminderInterval,_['map'](_0x332020,'id')))[_0xb349('0x41')](function(_0x32ed93){for(var _0x503e9c=0x0;_0x503e9c<_0x32ed93[_0xb349('0xa3')];_0x503e9c++){var _0x371b9c=_0x32ed93[_0x503e9c]['Agent'][_0xb349('0x65')];if(_0x371b9c)io['to'](util[_0xb349('0x49')](_0xb349('0x14d'),_0x371b9c))[_0xb349('0x44')](_0xb349('0x14e'),{'hopper':_0x32ed93[_0x503e9c]});}})[_0xb349('0xa9')](function(_0x5e2088){logger['error'](_0xb349('0x14f'),_0x5e2088);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb349('0x1a')]['loopClearZombieChannels']=function(){var _0xa9a4f8=this;setInterval(function(){_0xa9a4f8[_0xb349('0x150')](_0xa9a4f8['uniqueId'],_0xb349('0x151'));_0xa9a4f8[_0xb349('0x150')](_0xa9a4f8[_0xb349('0x25')],_0xb349('0x152'));},0x32c8);};Dialer[_0xb349('0x1a')][_0xb349('0x150')]=function(_0x486448,_0x588af0){var _0x13866d=this;for(var _0x4454bf in _0x486448){if(typeof _0x486448[_0x4454bf]!==_0xb349('0xb6')){this['sequence'][_0xb349('0x153')](function(){if(!_[_0xb349('0xfb')](_0x486448[_0x4454bf])){return ami[_0xb349('0xa5')]({'action':_0xb349('0x90'),'channel':_0x486448[_0x4454bf][_0xb349('0xf8')]})[_0xb349('0xa9')](function(_0x3a7bcd){if(_0x3a7bcd['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x486448[_0x4454bf]&&_0x486448[_0x4454bf][_0xb349('0x45')]!=='ivr'){_0x13866d[_0xb349('0xc8')](_0x13866d[_0xb349('0x1f')][_0x486448[_0x4454bf]['queue']]);logger[_0xb349('0x6b')](_0xb349('0x154'),_0x588af0,_0x4454bf,_0x486448[_0x4454bf][_0xb349('0xc9')]);delete _0x486448[_0x4454bf];}if(_0x486448[_0x4454bf]&&_0x486448[_0x4454bf][_0xb349('0x45')]==='ivr'){_0x13866d[_0xb349('0xc8')](_0x13866d[_0xb349('0x20')][_0x486448[_0x4454bf][_0xb349('0xc9')]]);logger['error'](_0xb349('0x155'),_0x588af0,_0x4454bf,_0x486448[_0x4454bf][_0xb349('0xc9')]);delete _0x486448[_0x4454bf];}},0x2328);}});}});}}};Dialer['prototype'][_0xb349('0x156')]=function(_0x4875ae){return Promise[_0xb349('0xb7')]()[_0xb349('0x41')](voiceQueueRt[_0xb349('0x156')](_0x4875ae))[_0xb349('0xa9')](loggerCatch(_0xb349('0x157')));};Dialer[_0xb349('0x1a')]['updateOriginated']=function(_0x2e225e){if(!_[_0xb349('0x43')](_0x2e225e)&&_0x2e225e!==null){if(typeof _0x2e225e['originated']!==_0xb349('0xb6')){if(_0x2e225e[_0xb349('0x158')]>0x0){_0x2e225e[_0xb349('0x158')]-=0x1;}else{logger['error'](_0xb349('0x159'));}}}else{logger[_0xb349('0x6b')](_0xb349('0x15a'));}};Dialer[_0xb349('0x1a')]['loggerHandler']=function(_0x460990,_0x4eb40a){var _0x239976=this;return function(_0x4fecdb){_0x239976['updateOriginated'](_0x4eb40a);logger['error'](_0x460990,util[_0xb349('0x6e')](_0x4fecdb,{'showHidden':![],'depth':null}));};};Dialer[_0xb349('0x1a')]['emptyContact']=function(_0x1919cd,_0x204bc7,_0xb02d7e){var _0x6efa24={'state':0x19,'statedesc':_0xb349('0x15b')};this[_0xb349('0xc8')](_0x204bc7);this[_0xb349('0x11b')](_[_0xb349('0x63')](_0x6efa24,_['pick'](_0xb02d7e,[_0xb349('0xe5'),_0xb349('0x104'),'UserId',_0xb349('0xe6'),'CampaignId'])),_0xb349('0x15c'),_0xb349('0x15d'));logger[_0xb349('0x6b')](_0x1919cd);};Dialer[_0xb349('0x1a')][_0xb349('0x11b')]=function(_0x55ff59,_0xd74ef4,_0x11cd7d){hopperUtils[_0xb349('0xd3')](_0x55ff59)[_0xb349('0xa9')](loggerCatch(_0xd74ef4));hopperUtils[_0xb349('0xd5')](_0x55ff59)[_0xb349('0xa9')](loggerCatch(_0x11cd7d));};Dialer[_0xb349('0x1a')][_0xb349('0xe2')]=function(_0x4412ae,_0x5c1faf){hopperUtils['createHistory'](_0x4412ae)['catch'](loggerCatch(_0xb349('0xd4')));if(_0x5c1faf==0x0){hopperUtils[_0xb349('0xd5')](_0x4412ae)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xb349('0x1a')]['checkPreviewRecallReminder']=function(_0x45d968){return Promise[_0xb349('0xb7')]()[_0xb349('0x41')](cmHopper[_0xb349('0x15e')](_0x45d968['id'],previewRecallmeReminderInterval))[_0xb349('0x41')](function(_0x129d49){for(var _0x15d9b3=0x0;_0x15d9b3<_0x129d49[_0xb349('0xa3')];_0x15d9b3++){var _0x2f5c82=_0x129d49[_0x15d9b3][_0xb349('0x15f')][_0xb349('0x65')];if(_0x2f5c82)io['to'](util[_0xb349('0x49')]('user:%s',_0x2f5c82))[_0xb349('0x44')](_0xb349('0x14e'),{'hopper':_0x129d49[_0x15d9b3]});}})[_0xb349('0xa9')](function(){});};Dialer[_0xb349('0x1a')][_0xb349('0xbb')]=function(_0x1952d2){var _0x3404ec=this;return function(){_0x3404ec[_0xb349('0x160')](_0x1952d2);};};Dialer[_0xb349('0x1a')][_0xb349('0x161')]=function(_0x6d5f56,_0x5821f8){var _0x4d0079=this;var _0x157d42=uuid['v4']();this[_0xb349('0x25')][_0x157d42]=new Action(_0x6d5f56,_0x5821f8,_0x157d42);return new Promise(function(_0x17df93,_0x519dd7){if(_[_0xb349('0x43')](_0x6d5f56)&&typeof _0x6d5f56!==_0xb349('0x162')){return _0x519dd7(msgResponse(_0xb349('0x163'),_0xb349('0x9c'),_0xb349('0x164')));}if(_['isUndefined'](_0x5821f8[_0xb349('0x165')])||_0x5821f8['phone']===null){return _0x519dd7(msgResponse(_0xb349('0x163'),_0xb349('0x9c'),'contact\x20is\x20undefine'));}var _0xcc1a81={'XMD-CALLERID':_0x4d0079['actions'][_0x157d42]['getCaller'](),'XMD-AGI':_0x6d5f56[_0xb349('0x137')]?util[_0xb349('0x49')](_0xb349('0x166'),ipAgi,_0x6d5f56[_0xb349('0x137')]):'NONE','XMD-AGIAFTER':_0x6d5f56[_0xb349('0xd1')]?util[_0xb349('0x49')](_0xb349('0x166'),ipAgi,_0x6d5f56[_0xb349('0xd1')]):'NONE','XMD-QUEUE':utils[_0xb349('0x167')](_0x6d5f56)?util[_0xb349('0x49')](_0xb349('0x168'),_0x6d5f56[_0xb349('0x65')],_0x6d5f56['dialQueueOptions']||'',_0x6d5f56[_0xb349('0xd2')]?'c':'',_0x6d5f56[_0xb349('0x169')]||0x3):_0xb349('0x16a'),'XMD-CONTACTID':_0x5821f8[_0xb349('0xe5')],'XMD-CDRTYPE':_0xb349('0x16b'),'CALLERID(all)':_0x4d0079[_0xb349('0x25')][_0x157d42][_0xb349('0x16c')](),'XMD-AMD':_0x6d5f56[_0xb349('0x12f')]?_0xb349('0x144'):'NONE','XMD-DESTINATION':_0xb349('0x116')};if(_0x6d5f56[_0xb349('0x12f')]){_0xcc1a81[_0xb349('0x16d')]=_0x6d5f56[_0xb349('0x16e')]||0x9c4;_0xcc1a81[_0xb349('0x16f')]=_0x6d5f56[_0xb349('0x170')]||0x5dc;_0xcc1a81['XMD-AMDAFTERGREETINGSILENCE']=_0x6d5f56[_0xb349('0x171')]||0x320;_0xcc1a81[_0xb349('0x172')]=_0x6d5f56['dialAMDTotalAnalysisTime']||0x1388;_0xcc1a81[_0xb349('0x173')]=_0x6d5f56[_0xb349('0x174')]||0x64;_0xcc1a81[_0xb349('0x175')]=_0x6d5f56[_0xb349('0x176')]||0x32;_0xcc1a81[_0xb349('0x177')]=_0x6d5f56[_0xb349('0x178')]||0x3;_0xcc1a81[_0xb349('0x179')]=_0x6d5f56[_0xb349('0x17a')]||0x100;_0xcc1a81[_0xb349('0x17b')]=_0x6d5f56[_0xb349('0x17c')]||0x1388;}if(utils['isOutboundQueue'](_0x6d5f56)){_0xcc1a81[_0xb349('0x17d')]=_0x5821f8[_0xb349('0xe6')];}else{_0xcc1a81[_0xb349('0x17e')]=_0x5821f8[_0xb349('0xf5')];}var _0x4edf9c=utils[_0xb349('0x17f')](_0x5821f8['Contact']);Object[_0xb349('0x180')](_0xcc1a81,_0x4edf9c);var _0x28dc51=_0x4d0079['isTrunkReachable'](_0x6d5f56[_0xb349('0x94')])?utils[_0xb349('0x181')](_0x6d5f56[_0xb349('0x94')][_0xb349('0x182')],_0x6d5f56[_0xb349('0x183')],_0x6d5f56[_0xb349('0x184')]>0x0?utils[_0xb349('0x185')](_0x6d5f56['dialOriginateCallerIdNumber'],_0x6d5f56[_0xb349('0x184')]):_0x6d5f56[_0xb349('0x186')]):utils[_0xb349('0x181')](_['isNil'](_0x6d5f56[_0xb349('0x95')])?_0x6d5f56[_0xb349('0x94')][_0xb349('0x182')]:_0x6d5f56[_0xb349('0x95')][_0xb349('0x182')],_0x6d5f56['dialOriginateCallerIdName'],_0x6d5f56[_0xb349('0x184')]>0x0?utils[_0xb349('0x185')](_0x6d5f56[_0xb349('0x186')],_0x6d5f56[_0xb349('0x184')]):_0x6d5f56['dialOriginateCallerIdNumber']);if(_0x28dc51){_0xcc1a81['XMD-ORIGINATECALLERIDNAME']=_0x4d0079[_0xb349('0x25')][_0x157d42][_0xb349('0x187')]=utils['extractCalleridName'](_0x28dc51);_0xcc1a81[_0xb349('0x188')]=_0x5821f8[_0xb349('0x165')];}_0x6d5f56[_0xb349('0x189')]=_0xcc1a81;return ami[_0xb349('0xa5')]({'actionid':_0x157d42,'action':_0xb349('0x163'),'channel':_0x4d0079[_0xb349('0x93')](_0x6d5f56[_0xb349('0x94')])?util[_0xb349('0x49')]('SIP/%s/%s%s',_0x6d5f56[_0xb349('0x94')][_0xb349('0x65')],isNotNull(_0x6d5f56[_0xb349('0x18a')])?_0x6d5f56[_0xb349('0x18a')]['trim']()||'':'',_0x6d5f56[_0xb349('0x18b')]>0x0?_0x5821f8[_0xb349('0x165')][_0xb349('0x18c')](_0x6d5f56['dialCutDigit']):_0x5821f8[_0xb349('0x165')]):util['format'](_0xb349('0x18d'),_['isNil'](_0x6d5f56[_0xb349('0x95')])?_0x6d5f56[_0xb349('0x94')][_0xb349('0x65')]:_0x6d5f56[_0xb349('0x95')][_0xb349('0x65')],isNotNull(_0x6d5f56[_0xb349('0x18a')])?_0x6d5f56[_0xb349('0x18a')]['trim']()||'':'',_0x6d5f56[_0xb349('0x18b')]>0x0?_0x5821f8[_0xb349('0x165')][_0xb349('0x18c')](_0x6d5f56[_0xb349('0x18b')]):_0x5821f8[_0xb349('0x165')]),'callerid':_0x28dc51,'Exten':_0xb349('0x116'),'Context':'from-sip','Priority':'1','variable':_0xcc1a81,'timeout':(_0x6d5f56['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x157d42})[_0xb349('0x41')](function(_0x5daee1){return _0x17df93(_0x5daee1);})['catch'](function(_0xc97530){_0x6d5f56[_0xb349('0x18e')]+=0x1;var _0x7ee47=new History(_0x4d0079['actions'][_0x157d42]);logger[_0xb349('0x6b')](util[_0xb349('0x49')]('[originateError]:\x20%s',JSON[_0xb349('0x7e')](_0xc97530)));_0x7ee47[_0xb349('0x77')]=0xe;_0x7ee47[_0xb349('0x78')]=_0xb349('0x18f');_0x7ee47[_0xb349('0x7a')]=moment()[_0xb349('0x49')](_0xb349('0xcb'));_0x7ee47[_0xb349('0x79')]=_0x7ee47[_0xb349('0x7a')];hopperUtils[_0xb349('0xd3')](_0x7ee47)['catch'](loggerCatch('[originate][error]'));_0x4d0079[_0xb349('0xd5')](_0x7ee47)['catch'](loggerCatch(_0xb349('0x190')))['finally'](function(){delete _0x4d0079[_0xb349('0x25')][_0x157d42];return _0x519dd7(msgResponse('originate',_0xb349('0x8d'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x459be3,_0x325d24,_0x23405b){var _0x29fd7a=new History(_0x325d24);if(_0x29fd7a[_0xb349('0x127')]+_0x29fd7a[_0xb349('0x128')]+_0x29fd7a[_0xb349('0x129')]+_0x29fd7a[_0xb349('0x191')]+_0x29fd7a[_0xb349('0xdb')]+_0x29fd7a[_0xb349('0xf2')]+_0x29fd7a[_0xb349('0x123')]+_0x29fd7a[_0xb349('0x12a')]>=_0x23405b[_0xb349('0x132')]-0x1){return!![];}switch(_0x459be3){case 0x3:if(_0x29fd7a[_0xb349('0x129')]>=_0x23405b['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xb349('0xf4')]({'active':![],'countnoanswerretry':_0x29fd7a[_0xb349('0x129')]+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b[_0xb349('0x192')],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x29fd7a[_0xb349('0xe5')],'ListId':_0x29fd7a['ListId'],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0x193')));break;case 0x5:if(_0x29fd7a['countbusyretry']>=_0x23405b['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x29fd7a[_0xb349('0x127')]+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b['dialBusyRetryFrequency'],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x29fd7a[_0xb349('0xe5')],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0x194')));break;case 0x8:if(_0x29fd7a[_0xb349('0x128')]>=_0x23405b[_0xb349('0x195')]-0x1){return!![];}hopperUtils[_0xb349('0xf4')]({'active':![],'countcongestionretry':_0x29fd7a['countcongestionretry']+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b[_0xb349('0x196')],_0xb349('0xe4'))[_0xb349('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x29fd7a['ContactId'],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a['CampaignId']||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0x197')));break;case 0x0:if(_0x29fd7a[_0xb349('0x191')]>=_0x23405b[_0xb349('0x198')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x29fd7a[_0xb349('0x191')]+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b[_0xb349('0x199')],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x29fd7a[_0xb349('0xe5')],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x29fd7a['countdropretry']>=_0x23405b[_0xb349('0xe1')]-0x1){return!![];}hopperUtils[_0xb349('0xf4')]({'active':![],'countdropretry':_0x29fd7a[_0xb349('0xdb')]+=0x1,'scheduledat':moment()['add'](_0x23405b[_0xb349('0xdc')],'minutes')[_0xb349('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x29fd7a[_0xb349('0xe5')],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0xe7')));break;case 0xb:if(_0x29fd7a[_0xb349('0xf2')]>=_0x23405b[_0xb349('0xf3')]-0x1){return!![];}hopperUtils[_0xb349('0xf4')]({'active':![],'countabandonedretry':_0x29fd7a[_0xb349('0xf2')]+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b[_0xb349('0xf1')],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x29fd7a['ContactId'],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0xf6')));break;case 0x13:if(_0x29fd7a['countmachineretry']>=_0x23405b[_0xb349('0x12d')]-0x1){return!![];}hopperUtils[_0xb349('0xf4')]({'active':![],'countmachineretry':_0x29fd7a[_0xb349('0x123')]+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b[_0xb349('0x134')],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x29fd7a[_0xb349('0xe5')],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})['catch'](loggerCatch(_0xb349('0x19a')));break;case 0x14:if(_0x29fd7a[_0xb349('0x12a')]>=_0x23405b[_0xb349('0x19b')]-0x1){return!![];}hopperUtils[_0xb349('0xf4')]({'active':![],'countagentrejectretry':_0x29fd7a[_0xb349('0x12a')]+=0x1,'scheduledat':moment()[_0xb349('0xe3')](_0x23405b[_0xb349('0x19c')],_0xb349('0xe4'))[_0xb349('0x49')](_0xb349('0xcb')),'ContactId':_0x29fd7a[_0xb349('0xe5')],'ListId':_0x29fd7a[_0xb349('0x104')],'VoiceQueueId':_0x29fd7a[_0xb349('0xe6')]||undefined,'CampaignId':_0x29fd7a[_0xb349('0xf5')]||undefined})['catch'](loggerCatch(_0xb349('0x19d')));break;default:return!![];}};Dialer[_0xb349('0x1a')][_0xb349('0x112')]=function(_0x5a480a,_0x17c36e,_0x11e42d){var _0x1bf016=this;var _0xa0ef6e=new History(_0x5a480a);var _0x5be55f=![];var _0x184896;var _0x4ec255;return new Promise(function(_0x32fedd,_0x423f6e){if(_[_0xb349('0x43')](_0x17c36e)&&typeof _0x17c36e!==_0xb349('0x162')){return _0x423f6e(msgResponse(_0xb349('0x19e'),_0xb349('0x9c'),'entity\x20is\x20undefine'));}if(_[_0xb349('0x43')](_0x11e42d)&&typeof _0x11e42d!==_0xb349('0x162')){return _0x423f6e(msgResponse(_0xb349('0x19e'),_0xb349('0x9c'),_0xb349('0x19f')));}hopperUtils[_0xb349('0xde')](_0xa0ef6e,_0x11e42d[_0xb349('0xce')],_0x17c36e)[_0xb349('0x41')](function(_0x134609){if(_0x134609[_0xb349('0xe0')]==0x1)_0x5be55f=!![];switch(_0x11e42d[_0xb349('0xce')]){case'0':_0x17c36e[_0xb349('0x1a0')]+=0x1;_0xa0ef6e[_0xb349('0x77')]=0x0;_0xa0ef6e['statedesc']=_0xb349('0x1a1');_0xa0ef6e[_0xb349('0x191')]+=0x1;_0xa0ef6e[_0xb349('0xf0')]+=0x1;ami[_0xb349('0x44')](_0xb349('0x1a2'),ut[_0xb349('0x124')](_0x5a480a,_0xb349('0x1a3')));_0x184896=_0x17c36e[_0xb349('0x199')];_0x4ec255=_0x17c36e[_0xb349('0xdd')];hopperUtils['createHistory'](_0xa0ef6e)[_0xb349('0xa9')](loggerCatch(_0xb349('0x126')));if(_0x1bf016[_0xb349('0x1a4')](0x0,_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e[_0xb349('0x191')]>=_0x17c36e[_0xb349('0x198')]){_0x1bf016['createStateFinal'](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1a5'));}else{_0x1bf016['stateGlobal'](_0xa0ef6e,_0x32fedd,_0x423f6e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x17c36e[_0xb349('0x1a6')]+=0x1;_0xa0ef6e[_0xb349('0x77')]=0x3;_0xa0ef6e[_0xb349('0x78')]=_0xb349('0x1a7');_0xa0ef6e[_0xb349('0x129')]+=0x1;_0xa0ef6e[_0xb349('0xf0')]+=0x1;var _0x1e47f9=ut[_0xb349('0x1a8')](_0x5a480a,_0x17c36e);ami[_0xb349('0x44')](_0xb349('0x1a9'),_0x1e47f9);_0x184896=_0x17c36e[_0xb349('0x192')];_0x4ec255=_0x17c36e[_0xb349('0xdd')];hopperUtils['createHistory'](_0xa0ef6e)[_0xb349('0xa9')](loggerCatch(_0xb349('0x1aa')));if(_0x1bf016['checkRetriveMax'](0x3,_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e[_0xb349('0x129')]>=_0x17c36e[_0xb349('0x1ab')]){_0x1bf016[_0xb349('0x133')](_0xa0ef6e,_0x32fedd,_0x423f6e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1bf016[_0xb349('0x12b')](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1ac'));}}break;case'5':_0x17c36e[_0xb349('0x1ad')]+=0x1;_0xa0ef6e['state']=0x5;_0xa0ef6e['statedesc']=_0xb349('0x1ae');_0xa0ef6e[_0xb349('0x127')]+=0x1;_0xa0ef6e[_0xb349('0xf0')]+=0x1;ami[_0xb349('0x44')](_0xb349('0x1af'),ut['buildObj'](_0x5a480a,_0xb349('0x1b0')));_0x184896=_0x17c36e[_0xb349('0x1b1')];_0x4ec255=_0x17c36e['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0xa0ef6e)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1bf016[_0xb349('0x1a4')](0x5,_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e[_0xb349('0x127')]>=_0x17c36e['dialBusyMaxRetry']){_0x1bf016[_0xb349('0x133')](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1b2'));}else{_0x1bf016['stateGlobal'](_0xa0ef6e,_0x32fedd,_0x423f6e,'reason\x205\x20busy');}}break;case'8':_0x17c36e['outboundCongestionCallsDay']+=0x1;_0xa0ef6e[_0xb349('0x77')]=0x8;_0xa0ef6e[_0xb349('0x78')]=_0xb349('0x1b3');_0xa0ef6e[_0xb349('0x128')]+=0x1;_0xa0ef6e[_0xb349('0xf0')]+=0x1;_0x184896=_0x17c36e[_0xb349('0x196')];_0x4ec255=_0x17c36e[_0xb349('0xdd')];ami[_0xb349('0x44')](_0xb349('0x1b4'),ut[_0xb349('0x124')](_0x5a480a,_0xb349('0x1b5')));hopperUtils[_0xb349('0xd3')](_0xa0ef6e)['catch'](loggerCatch(_0xb349('0x1b6')));if(_0x1bf016[_0xb349('0x1a4')](0x8,_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e[_0xb349('0x128')]>=_0x17c36e[_0xb349('0x195')]){_0x1bf016['createStateFinal'](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1b7'));}else{_0x1bf016[_0xb349('0x12b')](_0xa0ef6e,_0x32fedd,_0x423f6e,'reason\x208\x20congestion');}}break;case'11':_0x17c36e[_0xb349('0x1b8')]+=0x1;_0xa0ef6e[_0xb349('0x77')]=0xb;_0xa0ef6e['statedesc']=_0xb349('0xee');_0xa0ef6e['countabandonedretry']+=0x1;_0xa0ef6e[_0xb349('0xf0')]+=0x1;_0x184896=_0x17c36e[_0xb349('0xf1')];_0x4ec255=_0x17c36e[_0xb349('0xdd')];hopperUtils[_0xb349('0xd3')](_0xa0ef6e)[_0xb349('0xa9')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1bf016[_0xb349('0x1a4')](0xb,_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e[_0xb349('0xf2')]>=_0x17c36e[_0xb349('0xf3')]){_0x1bf016['createStateFinal'](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1b9'));}else{_0x1bf016['stateGlobal'](_0xa0ef6e,_0x32fedd,_0x423f6e,'reason\x2011\x20abandoned');}}break;case'20':_0x17c36e[_0xb349('0x1ba')]+=0x1;_0xa0ef6e[_0xb349('0x77')]=0x14;_0xa0ef6e[_0xb349('0x78')]='AgentReject';_0xa0ef6e[_0xb349('0x12a')]+=0x1;_0xa0ef6e[_0xb349('0xf0')]+=0x1;_0x184896=_0x17c36e[_0xb349('0x19c')];_0x4ec255=_0x17c36e[_0xb349('0xdd')];ami[_0xb349('0x44')]('custom:agentreject',ut['buildObj'](_0x5a480a,_0xb349('0x1bb')));hopperUtils[_0xb349('0xd3')](_0xa0ef6e)[_0xb349('0xa9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1bf016[_0xb349('0x1a4')](0x14,_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e[_0xb349('0x12a')]>=_0x17c36e[_0xb349('0x19b')]){_0x1bf016[_0xb349('0x133')](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1bc'));}else{_0x1bf016['stateGlobal'](_0xa0ef6e,_0x32fedd,_0x423f6e,_0xb349('0x1bc'));}}break;default:_0x17c36e['outboundUnknownCallsDay']+=0x1;_0xa0ef6e[_0xb349('0x77')]=0xc;_0xa0ef6e[_0xb349('0x78')]=_0x11e42d[_0xb349('0xce')];_0x184896=_0x17c36e[_0xb349('0x19c')];_0x4ec255=_0x17c36e['callAdditionalPhoneAfterMin'];hopperUtils[_0xb349('0xd3')](_0xa0ef6e)[_0xb349('0xa9')](loggerCatch(_0xb349('0x1bd')));if(_0x1bf016[_0xb349('0x1a4')](_0x11e42d['reason'],_0x5a480a,_0x17c36e)&&!_0x5be55f){if(_0xa0ef6e['countbusyretry']+_0xa0ef6e['countcongestionretry']+_0xa0ef6e['countnoanswerretry']+_0xa0ef6e[_0xb349('0x191')]+_0xa0ef6e[_0xb349('0xdb')]+_0xa0ef6e[_0xb349('0xf2')]+_0xa0ef6e[_0xb349('0x123')]+_0xa0ef6e['countagentrejectretry']>=_0x17c36e[_0xb349('0x132')]){_0x1bf016[_0xb349('0x12b')](_0xa0ef6e,_0x32fedd,_0x423f6e,_0x11e42d['reason']);}else{_0x1bf016[_0xb349('0x133')](_0xa0ef6e,_0x32fedd,_0x423f6e,_0x11e42d[_0xb349('0xce')]);}}}})[_0xb349('0x41')](function(){if(_0x5be55f){hopperUtils[_0xb349('0xeb')](_0xa0ef6e,_0x184896,_0x4ec255)[_0xb349('0x41')](function(){return _0x32fedd(0x1);});}});});};Dialer[_0xb349('0x1a')][_0xb349('0x12b')]=function(_0x4ac299,_0x319cb4,_0x1084c6,_0x453198){var _0x1bd8a2=new Final(_0x4ac299);_0x1bd8a2[_0xb349('0x77')]=0xf;_0x1bd8a2[_0xb349('0x78')]=_0xb349('0x1be');this[_0xb349('0x133')](_0x1bd8a2,_0x319cb4,_0x1084c6,_0x453198);};Dialer['prototype'][_0xb349('0x133')]=function(_0x21c3dd,_0x395f38,_0x2036d8,_0x577830){hopperUtils[_0xb349('0xd5')](_0x21c3dd)[_0xb349('0x41')](function(){return _0x395f38(msgResponse(_0xb349('0x19e'),_0xb349('0x1bf'),_0x577830));})[_0xb349('0xa9')](function(){return _0x2036d8(msgResponse(_0xb349('0x1c0'),_0xb349('0x9c'),'contact\x20not\x20moved'));});};Dialer[_0xb349('0x1a')][_0xb349('0x8')]=function(_0x2ab660){var _0x23bbc9=_0x2ab660[_0xb349('0x1c1')]/0x64;var _0x49e38d=_0x2ab660[_0xb349('0xd9')]/(_0x2ab660[_0xb349('0xd9')]+_0x2ab660[_0xb349('0xcd')]);var _0x454078=Math[_0xb349('0x1c2')](_0x2ab660[_0xb349('0x1c3')]*(_0x2ab660[_0xb349('0x1c4')]/0x64));var _0x21f88e=Math['round'](_0x2ab660[_0xb349('0x1c3')]*(_0x2ab660[_0xb349('0x1c5')]/0x64));var _0xc823d3=_0x2ab660[_0xb349('0x141')]+_0x2ab660[_0xb349('0x143')];var _0xd27538=Math[_0xb349('0x1c6')](_0x2ab660[_0xb349('0x5d')]*_0x2ab660[_0xb349('0x5f')]*_0x2ab660[_0xb349('0x1c7')]*_0x2ab660[_0xb349('0x1c8')]);if(_[_0xb349('0x43')](_0x2ab660[_0xb349('0x29')])){if(!_['isUndefined'](_0x2ab660[_0xb349('0x28')])){_0x2ab660[_0xb349('0x28')]=undefined;loggerPredictive[_0xb349('0x6b')](_0xb349('0x1c9'),_0xb349('0x1ca'));}if(!_[_0xb349('0x43')](_0x2ab660[_0xb349('0x68')])){loggerPredictive[_0xb349('0x6b')](_0xb349('0x1c9'),_0xb349('0x1cb'));clearInterval(_0x2ab660[_0xb349('0x68')]);_0x2ab660[_0xb349('0x68')]=undefined;}_0x2ab660[_0xb349('0x29')]=moment()[_0xb349('0x49')](_0xb349('0xcb'));loggerPredictive['info'](_0x2ab660['name'],_0xb349('0x1cc'),_0x2ab660[_0xb349('0x29')]);this[_0xb349('0xbe')](_0x2ab660,0x1);}else if(ifInterval(_0x2ab660[_0xb349('0x1cd')],_0x2ab660['startProgressive'])){this[_0xb349('0xbe')](_0x2ab660,0x1);loggerPredictiveCalls['info'](_0xb349('0x1ce'),_0x2ab660[_0xb349('0x29')],_0x2ab660['name']);_0x2ab660[_0xb349('0x5d')]=0x0;_0x2ab660[_0xb349('0x1cf')]=0x0;}else if(_0x23bbc9<_0x49e38d&&_0x2ab660['dialPredictiveOptimization']===_0xb349('0x1d0')){clearPredictiveAttributes(_0x2ab660);loggerPredictive[_0xb349('0x4d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xb349('0x1d1'),_0x49e38d,_0xb349('0x29'),_0x2ab660[_0xb349('0x65')]);}else if(_0xd27538<_0x2ab660['predictiveIntervalErlangCallsDroppedCalls']&&_0x2ab660[_0xb349('0x1d2')]===_0xb349('0x1d0')){clearPredictiveAttributes(_0x2ab660);loggerPredictive['info'](_0xb349('0x1d3'),_0xb349('0x1d4'),_0xd27538,_0xb349('0x1d5'),_0x2ab660[_0xb349('0x1cf')],'startProgressive',_0x2ab660['name']);}else if(!ifInterval(_0x2ab660[_0xb349('0x1cd')],_0x2ab660['startProgressive'])&&_[_0xb349('0x43')](_0x2ab660[_0xb349('0x28')])&&!_[_0xb349('0x43')](_0x2ab660[_0xb349('0x29')])){_0x2ab660[_0xb349('0x28')]=moment()['format'](_0xb349('0xcb'));loggerPredictive[_0xb349('0x4d')](_0x2ab660['name'],_0xb349('0x1d6'),_0x2ab660[_0xb349('0x28')]);hopperUtils[_0xb349('0x1d7')](_0x2ab660[_0xb349('0x1cd')])[_0xb349('0x41')](this[_0xb349('0x1d8')](_0x2ab660))[_0xb349('0x41')](mergeDataErlangB(_0x2ab660))[_0xb349('0x41')](this[_0xb349('0x1d9')](_0x2ab660))['catch'](loggerCatchPredictive(_0xb349('0x1da'),_0x2ab660));}else if(!ifInterval(_0x2ab660['dialPredictiveInterval'],_0x2ab660[_0xb349('0x28')])){_0x2ab660[_0xb349('0x1cf')]=0x0;_0x2ab660['startPredictive']=moment()[_0xb349('0x49')](_0xb349('0xcb'));loggerPredictive[_0xb349('0x4d')](_0x2ab660[_0xb349('0x65')],_0xb349('0x1db'),_0x2ab660[_0xb349('0x28')]);clearInterval(_0x2ab660[_0xb349('0x68')]);_0x2ab660['handlePredictive']=undefined;hopperUtils[_0xb349('0x1d7')](_0x2ab660[_0xb349('0x1cd')])[_0xb349('0x41')](this[_0xb349('0x1d8')](_0x2ab660))[_0xb349('0x41')](mergeDataErlangB(_0x2ab660))[_0xb349('0x41')](this['startMethodPredictive'](_0x2ab660))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2ab660));}else if(_0x2ab660[_0xb349('0x1c3')]&&_0xc823d3<_0x2ab660[_0xb349('0x1c3')]-_0x21f88e){clearPredictiveAttributes(_0x2ab660);loggerPredictive[_0xb349('0x4d')](_0x2ab660[_0xb349('0x65')],_0xb349('0x1dc'),_0xc823d3,_0xb349('0x1dd'),_0x2ab660[_0xb349('0x1c3')],'-',_0x21f88e,'=',_0x2ab660[_0xb349('0x1c3')]-_0x21f88e,')');}else if(_0x2ab660[_0xb349('0x1c3')]&&_0xc823d3>_0x2ab660[_0xb349('0x1c3')]+_0x454078){clearPredictiveAttributes(_0x2ab660);loggerPredictive['info'](_0x2ab660['name'],_0xb349('0x1dc'),_0xc823d3,_0xb349('0x1de'),_0x2ab660[_0xb349('0x1c3')],'+',_0x454078,'=',_0x2ab660['predictiveIntervalAvailable']+_0x454078,')');}};Dialer[_0xb349('0x1a')][_0xb349('0x1d8')]=function(_0xc20b26){var _0xf22bc1=this;return function(_0xe7af6e){return new Promise(function(_0xdc968a,_0x2be45c){_[_0xb349('0x63')](_0xc20b26,_0xe7af6e[0x0]);if(checkGetDataPredictive(_0xe7af6e[0x0])){var _0x466986=_0xc20b26[_0xb349('0x1c3')]=_0xc20b26['talking']+_0xc20b26[_0xb349('0x141')];var _0x2b430c=_0xc20b26[_0xb349('0x1cd')]*0x3c;var _0x3bedf5=_0xe7af6e[0x0][_0xb349('0x58')]+_0xe7af6e[0x0][_0xb349('0x56')];var _0x47e452=(_0xe7af6e[0x0][_0xb349('0x1df')]+_0xe7af6e[0x0][_0xb349('0x53')]+_0xe7af6e[0x0][_0xb349('0xec')])/_0xe7af6e[0x0]['predictiveIntervalTotalCalls'];_0xc20b26[_0xb349('0x1c7')]=_0x47e452>0x0?_0x47e452:0x1;switch(_0xc20b26['dialPredictiveOptimization']){case'dropRate':var _0x4654f1=_0xc20b26['dialPredictiveOptimizationPercentage']/0x64;return _0xf22bc1[_0xb349('0x1e0')](_0x466986,_0x2b430c,_0x3bedf5,_0x47e452,_0x4654f1)[_0xb349('0x41')](function(_0x35d3df){return _0xdc968a(_0x35d3df);});case _0xb349('0x1e1'):var _0x3b1501=_0xc20b26['dialPredictiveOptimizationPercentage']/0x64;return _0xf22bc1['busyFactor'](_0x466986,_0x2b430c,_0x3bedf5,_0x47e452,_0x3b1501)[_0xb349('0x41')](function(_0x2d6ad6){return _0xdc968a(_0x2d6ad6);});default:return _0x2be45c(msgResponse(_0xb349('0x1e2'),_0xb349('0x9c'),_0xb349('0x1e3')));}}else{return _0x2be45c(msgResponse('[getDataPredictive]',_0xb349('0x9c'),_0xb349('0x1e4')));}});};};Dialer[_0xb349('0x1a')]['getDataPredictiveOld']=function(_0x390a7d){var _0x3c1df8=this;return function(_0x52fc7b){return new Promise(function(_0x4b9ee0,_0x229494){_[_0xb349('0x63')](_0x390a7d,_0x52fc7b[0x0]);if(checkGetDataPredictive(_0x52fc7b[0x0])){loggerPredictive[_0xb349('0x4d')](JSON[_0xb349('0x7e')](_0x52fc7b[0x0]));if(_0x390a7d['dialPredictiveOptimization']===_0xb349('0x1d0')){return _0x3c1df8[_0xb349('0x156')](_0x390a7d['id'])[_0xb349('0x41')](function(_0x4b9c26){var _0x314a49=_0x390a7d[_0xb349('0x1e5')]-_0x4b9c26[0x0][_0xb349('0x1e6')];var _0x3b36e5=_0x390a7d[_0xb349('0x1cd')]*0x3c;var _0x2c84e=_0x52fc7b[0x0]['predictiveIntervalAvgTalktime']+_0x52fc7b[0x0]['predictiveIntervalAvgHoldtime'];var _0x1ef45a=(_0x52fc7b[0x0][_0xb349('0x1df')]+_0x52fc7b[0x0][_0xb349('0x53')]+_0x52fc7b[0x0][_0xb349('0xec')])/_0x52fc7b[0x0][_0xb349('0x50')];var _0x57e4aa=_0x390a7d[_0xb349('0x1c1')]/0x64;_0x390a7d['predictiveIntervalPauses']=_0x4b9c26[0x0][_0xb349('0x1e6')]||0x0;_0x390a7d[_0xb349('0x1c7')]=_0x1ef45a>0x0?_0x1ef45a:0x1;return _0x3c1df8[_0xb349('0x1e0')](_0x314a49,_0x3b36e5,_0x2c84e,_0x1ef45a,_0x57e4aa);})['then'](function(_0x904927){return _0x4b9ee0(_0x904927);})[_0xb349('0xa9')](function(_0x58e4c4){return _0x229494(msgResponse(_0xb349('0x1e7'),_0xb349('0x9c'),JSON[_0xb349('0x7e')](_0x58e4c4)));});}if(_0x390a7d[_0xb349('0x1d2')]===_0xb349('0x1e1')){return _0x3c1df8[_0xb349('0x156')](_0x390a7d['id'])[_0xb349('0x41')](function(_0x394b58){var _0x3e1e88=_0x390a7d[_0xb349('0x1e5')]-_0x394b58[0x0][_0xb349('0x1e6')];var _0x5dd403=_0x390a7d['dialPredictiveInterval']*0x3c;var _0x1d40f4=_0x52fc7b[0x0][_0xb349('0x58')]+_0x52fc7b[0x0][_0xb349('0x56')];var _0x30f17f=(_0x52fc7b[0x0][_0xb349('0x1df')]+_0x52fc7b[0x0][_0xb349('0x53')]+_0x52fc7b[0x0][_0xb349('0xec')])/_0x52fc7b[0x0][_0xb349('0x50')];var _0x2c397c=_0x390a7d[_0xb349('0x1c1')]/0x64;_0x390a7d[_0xb349('0x1e8')]=_0x394b58[0x0][_0xb349('0x1e6')]||0x0;_0x390a7d[_0xb349('0x1c7')]=_0x30f17f>0x0?_0x30f17f:0x1;return _0x3c1df8[_0xb349('0x1e9')](_0x3e1e88,_0x5dd403,_0x1d40f4,_0x30f17f,_0x2c397c);})[_0xb349('0x41')](function(_0xd45123){return _0x4b9ee0(_0xd45123);})[_0xb349('0xa9')](function(_0x509670){return _0x229494(msgResponse(_0xb349('0x1e7'),_0xb349('0x9c'),JSON[_0xb349('0x7e')](_0x509670)));});}}else{return _0x229494(msgResponse(_0xb349('0x1e2'),_0xb349('0x9c'),_0xb349('0x1e4')));}});};};Dialer['prototype'][_0xb349('0x1d9')]=function(_0x48b908){var _0x5c9089=this;return function(){var _0x2c6b0a=0x0;var _0x5aa3b9=Math[_0xb349('0x1c6')](_0x48b908[_0xb349('0x1ea')]*0x3e8);if(_0x5aa3b9>0x0){_0x5aa3b9=_0x5aa3b9<0x64?0x64:_0x5aa3b9;loggerPredictive[_0xb349('0x4d')](_0x48b908[_0xb349('0x65')],_0xb349('0x1eb'),_0x5aa3b9,_0xb349('0x1ec'));_0x48b908['handlePredictive']=setInterval(function(){_0x5c9089[_0xb349('0x68')](_0x48b908);loggerPredictiveCalls[_0xb349('0x4d')](_0xb349('0x1ed'),_0x2c6b0a+=0x1);},_0x5aa3b9);}else{loggerPredictive[_0xb349('0x4d')](_0x48b908[_0xb349('0x65')],_0xb349('0x1ee'));}};};Dialer[_0xb349('0x1a')][_0xb349('0x1ef')]=function(_0x40af73,_0x1dc753){var _0x6604be=this;return function(_0x29a97f){if(_['isEmpty'](_0x29a97f)){if(_[_0xb349('0xfb')](_0x1dc753[_0xb349('0x1f0')])||!_0x1dc753[_0xb349('0x1f1')]){if(_0x40af73[_0xb349('0x1f2')]===_0xb349('0x7')){_0x40af73[_0xb349('0x7b')]=_[_0xb349('0x43')](_0x40af73[_0xb349('0x7b')])?!![]:_0x40af73[_0xb349('0x7b')];var _0x2a1b5c=uuid['v4']();_0x6604be[_0xb349('0x25')][_0x2a1b5c]=new Action(_0x40af73,_0x1dc753,_0x2a1b5c);loggerBooked[_0xb349('0x4d')](_0xb349('0x1f3'),_0x2a1b5c,'queueStatusComplete:\x20',JSON[_0xb349('0x7e')](_0x40af73[_0xb349('0x7b')]),_0xb349('0x1f4'),_0x40af73['name']);if(_0x40af73['queueStatusComplete']){_0x40af73[_0xb349('0x7b')]=![];_0x6604be[_0xb349('0xff')][_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0xc9')]]=[];ami['Action']({'actionid':_0x2a1b5c,'action':'queuestatus','queue':_0x40af73[_0xb349('0x65')]})[_0xb349('0xa9')](function(){_0x6604be[_0xb349('0xc8')](_0x40af73);hopperUtils[_0xb349('0xf4')]({'active':![],'ContactId':_0x6604be['actions'][_0x2a1b5c][_0xb349('0xe5')],'ListId':_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0x104')],'VoiceQueueId':_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0xe6')]||undefined,'CampaignId':_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0xf5')]||undefined})['catch'](loggerCatch(_0xb349('0x1f5')));delete _0x6604be[_0xb349('0x25')][_0x2a1b5c];});}else{loggerBooked[_0xb349('0x4d')](_0xb349('0x1f6'),JSON[_0xb349('0x7e')](_0x40af73['queueStatusComplete']),'Queue:\x20',_0x40af73[_0xb349('0x65')]);_0x6604be[_0xb349('0xc8')](_0x40af73);hopperUtils[_0xb349('0xf4')]({'active':![],'ContactId':_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0xe5')],'ListId':_0x6604be['actions'][_0x2a1b5c]['ListId'],'VoiceQueueId':_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0xe6')]||undefined,'CampaignId':_0x6604be[_0xb349('0x25')][_0x2a1b5c][_0xb349('0xf5')]||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0x1f5')));delete _0x6604be['actions'][_0x2a1b5c];}}else{return _0x6604be[_0xb349('0x161')](_0x40af73,_0x1dc753);}}else{if(utils[_0xb349('0x64')](undefined,_0x1dc753['scheduledat'])<_0x40af73[_0xb349('0x1f7')]*0x3c){if(_0x1dc753['Agent']&&!_0x1dc753['Agent'][_0xb349('0x1f8')]){_0x6604be[_0xb349('0x1e')]['run'](_0x1dc753['id'])[_0xb349('0x1c')](function(){_0x6604be[_0xb349('0xc8')](_0x40af73);});}else{hopperUtils[_0xb349('0x1f9')]({'active':![]},_0x1dc753['id'],0x1)['finally'](function(){_0x6604be[_0xb349('0xc8')](_0x40af73);});}}else{_0x40af73[_0xb349('0x1fa')]+=0x1;_0x6604be[_0xb349('0xc8')](_0x40af73);if(_0x40af73[_0xb349('0x1fb')]){hopperUtils[_0xb349('0xf4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1dc753[_0xb349('0xe5')],'ListId':_0x1dc753[_0xb349('0x104')],'VoiceQueueId':_0x1dc753[_0xb349('0xe6')]||undefined,'CampaignId':_0x1dc753['CampaignId']||undefined})[_0xb349('0xa9')](loggerCatch(_0xb349('0x1fc')));hopperUtils[_0xb349('0xd3')](createObjHistory(_0x40af73,_0x1dc753,utils[_0xb349('0x71')][_0xb349('0x1fd')],0x17,_0xb349('0x1fe')))['catch'](loggerCatch(_0xb349('0x1ff')));}else{_0x6604be[_0xb349('0x11b')](createObjHistory(_0x40af73,_0x1dc753,utils['CAMPAIGN_STATUS'][_0xb349('0x200')],0x16,_0xb349('0x201')),_0xb349('0x202'),_0xb349('0x203'));}}}}else{_0x40af73[_0xb349('0x204')]+=0x1;_0x6604be[_0xb349('0x11b')](createObjHistory(_0x40af73,_0x1dc753,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0xb349('0x205')),_0xb349('0x206'),_0xb349('0x207'));throw _0xb349('0x208');}};};Dialer[_0xb349('0x1a')][_0xb349('0x160')]=function(_0x14914d){var _0xc45bc7=this;var _0x25f7eb=_0x14914d[_0xb349('0x209')]-_0x14914d['originated'];emitCampaignSummary(_0x14914d);if(_0x25f7eb>0x0&&_0x14914d[_0xb349('0x6d')]==0x0){if(_0x25f7eb>this[_0xb349('0x23')]){_0x25f7eb=this[_0xb349('0x23')];}_0x14914d['temp']=0x1;hopperUtils[_0xb349('0x20a')](_0x14914d,_0x25f7eb)[_0xb349('0x41')](function(_0x5b6abc){_0x14914d[_0xb349('0x6d')]=0x0;if(_0x5b6abc){if(!utils[_0xb349('0x20b')](_0x5b6abc)){_0x14914d[_0xb349('0x70')]=utils['CAMPAIGN_STATUS'][_0xb349('0x75')];logger[_0xb349('0x4d')]('[getContactCampaign2][Empty]'+_0x14914d[_0xb349('0x65')]);}else{_0x14914d[_0xb349('0x158')]+=_0x5b6abc['length'];_0x14914d['message']=utils[_0xb349('0x71')][_0xb349('0x20c')];for(var _0x3c8b0b=0x0;_0x3c8b0b<_0x5b6abc['length'];_0x3c8b0b+=0x1){_0x14914d[_0xb349('0x20d')]+=0x1;if(_[_0xb349('0xfb')](_0x5b6abc[_0x3c8b0b])||_[_0xb349('0xfb')](_0x5b6abc[_0x3c8b0b][_0xb349('0x20e')])||_[_0xb349('0xfb')](_0x5b6abc[_0x3c8b0b][_0xb349('0x165')])){_0xc45bc7['emptyContact'](_0xb349('0x20f'),_0x14914d,_0x5b6abc[_0x3c8b0b]);}else{hopperUtils[_0xb349('0x210')](_[_0xb349('0x7f')](_0x5b6abc[_0x3c8b0b],[_0xb349('0xf5'),_0xb349('0x165')]))[_0xb349('0x41')](_0xc45bc7[_0xb349('0x1ef')](_0x14914d,_0x5b6abc[_0x3c8b0b]))['catch'](_0xc45bc7[_0xb349('0x211')](_0xb349('0x212'),_0x14914d));}}}}})[_0xb349('0xa9')](loggerGetContactDialer(_0xb349('0x213'),_0x14914d,_0x25f7eb));}};Dialer[_0xb349('0x1a')][_0xb349('0xbe')]=function(_0x35a8bc,_0x1818f9){var _0x259143=this;var _0x4dead7=[];if(_0x1818f9<0x1||_0x35a8bc[_0xb349('0x1f2')]===_0xb349('0x7')){_0x1818f9=0x1;}var _0x406bc3=Math['floor'](_0x35a8bc[_0xb349('0x141')]*_0x1818f9)-_0x35a8bc[_0xb349('0x158')];if(_0x35a8bc[_0xb349('0x214')]>0x0){var _0x137bb6=_0x35a8bc[_0xb349('0x214')]-_0x35a8bc[_0xb349('0x158')]-_0x35a8bc[_0xb349('0x143')]-_0x35a8bc[_0xb349('0x215')];if(_0x406bc3>_0x137bb6){_0x406bc3=_0x137bb6;}}if(_0x406bc3>0x0&&_0x35a8bc[_0xb349('0x6d')]==0x0){if(_0x35a8bc[_0xb349('0x1f2')]===_0xb349('0x7')){_0x406bc3=0x1;}if(_0x406bc3>this[_0xb349('0x23')]){_0x406bc3=this[_0xb349('0x23')];}for(var _0x488f4 in this[_0xb349('0x21')]){if(typeof this[_0xb349('0x21')][_0x488f4]!=='undefined'){if(this[_0xb349('0x21')][_0x488f4]['state']===_0xb349('0x216')&&this['agents'][_0x488f4][_0xb349('0x90')]==='reachable'){_0x4dead7[_0xb349('0xa4')](this[_0xb349('0x21')][_0x488f4]['id']);}}}_0x35a8bc['temp']=0x1;hopperUtils[_0xb349('0x217')](_0x35a8bc,_0x4dead7,_0x406bc3)['then'](function(_0x2d756a){_0x35a8bc[_0xb349('0x6d')]=0x0;if(_0x2d756a){if(!utils[_0xb349('0x20b')](_0x2d756a)){hopperUtils[_0xb349('0x218')](_0x35a8bc)[_0xb349('0x41')](sendMessageReschedule(_0x35a8bc))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x35a8bc[_0xb349('0x158')]+=_0x2d756a[_0xb349('0xa3')];_0x35a8bc[_0xb349('0x70')]=_0x35a8bc[_0xb349('0x1f2')]===_0xb349('0x7')?utils['CAMPAIGN_STATUS'][_0xb349('0x144')]:utils['CAMPAIGN_STATUS'][_0xb349('0x20c')];for(var _0x3707fd=0x0;_0x3707fd<_0x2d756a['length'];_0x3707fd+=0x1){if(_['isNil'](_0x2d756a[_0x3707fd])||_[_0xb349('0xfb')](_0x2d756a[_0x3707fd]['Contact'])||_[_0xb349('0xfb')](_0x2d756a[_0x3707fd][_0xb349('0x165')])){_0x259143[_0xb349('0x219')]('[actionOriginate]\x20',_0x35a8bc,_0x2d756a[_0x3707fd]);}else{hopperUtils[_0xb349('0x21a')](_[_0xb349('0x7f')](_0x2d756a[_0x3707fd],['VoiceQueueId','phone']))[_0xb349('0x41')](_0x259143[_0xb349('0x1ef')](_0x35a8bc,_0x2d756a[_0x3707fd]))[_0xb349('0xa9')](_0x259143[_0xb349('0x211')](_0xb349('0x20f'),_0x35a8bc));}}}}})[_0xb349('0xa9')](loggerGetContactDialer('[getContactDialer2]',_0x35a8bc,_0x406bc3));}};Dialer[_0xb349('0x1a')][_0xb349('0x68')]=function(_0x12c3de){if(_0x12c3de['dialLimitQueue']>0x0){var _0x40181b=_0x12c3de[_0xb349('0x214')]-_0x12c3de[_0xb349('0x158')]-_0x12c3de[_0xb349('0x143')];if(_0x40181b>0x0&&_0x12c3de[_0xb349('0x6d')]==0x0){this['tryOriginatePredictive'](_0x12c3de);}else{loggerPredictiveCalls[_0xb349('0x4d')](_0xb349('0x21b'));}}else{this[_0xb349('0x21c')](_0x12c3de);}};Dialer[_0xb349('0x1a')][_0xb349('0x21c')]=function(_0x22912d){var _0x32e488=this;var _0x14bd91=[];_0x22912d[_0xb349('0x158')]+=0x1;for(var _0x458a59 in this[_0xb349('0x21')]){if(typeof this['agents'][_0x458a59]!=='undefined'){if(this[_0xb349('0x21')][_0x458a59]['state']===_0xb349('0x216')&&this[_0xb349('0x21')][_0x458a59][_0xb349('0x90')]===_0xb349('0x91')){_0x14bd91[_0xb349('0xa4')](this[_0xb349('0x21')][_0x458a59]['id']);}}}_0x22912d[_0xb349('0x6d')]=0x1;return this[_0xb349('0x217')](_0x22912d['id'],_0x14bd91,0x1,_0x22912d['dialOrderByScheduledAt'],_0x22912d)['then'](function(_0x375526){_0x22912d[_0xb349('0x6d')]=0x1;if(_0x375526){if(!utils[_0xb349('0x20b')](_0x375526)){utils[_0xb349('0x6c')](_0x22912d,0x1,0x0);return hopperUtils[_0xb349('0x218')](_0x22912d)['then'](sendMessageReschedule(_0x22912d))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x22912d[_0xb349('0x70')]=utils[_0xb349('0x71')][_0xb349('0x20c')];if(_[_0xb349('0xfb')](_0x375526[0x0])||_[_0xb349('0xfb')](_0x375526[0x0][_0xb349('0x20e')])||_[_0xb349('0xfb')](_0x375526[0x0][_0xb349('0x165')])){_0x32e488[_0xb349('0x219')](_0xb349('0x20f'),_0x22912d,_0x375526[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x375526[0x0],[_0xb349('0xe6'),_0xb349('0x165')]))[_0xb349('0x41')](_0x32e488[_0xb349('0x1ef')](_0x22912d,_0x375526[0x0]))[_0xb349('0xa9')](_0x32e488[_0xb349('0x211')](_0xb349('0x21d'),_0x22912d));}}}})[_0xb349('0xa9')](loggerGetContactDialer('[getContactDialerPredictive]',_0x22912d,0x1));};Dialer[_0xb349('0x1a')][_0xb349('0x1e0')]=function(_0x3978bf,_0x3a3836,_0x268643,_0x4b393c,_0x43b126,_0x16d5b5){loggerPredictive[_0xb349('0x4d')](_0xb349('0x21e'));loggerPredictive[_0xb349('0x4d')]('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',_0x3978bf);loggerPredictive['info'](_0xb349('0x21f'),_0x3a3836);loggerPredictive[_0xb349('0x4d')](_0xb349('0x220'),_0x268643);loggerPredictive[_0xb349('0x4d')](_0xb349('0x221'),_0x4b393c);loggerPredictive['info'](_0xb349('0x222'),_0x43b126);loggerPredictive[_0xb349('0x4d')](_0xb349('0x62'));return new Promise(function(_0x5223d1,_0x3d8981){if(_0x3978bf<=0x0||isNaN(_0x3978bf)){return _0x3d8981(msgResponse(_0xb349('0x223'),_0xb349('0x8d'),_0xb349('0x224')+_0x3978bf));}if(_0x268643<=0x0||isNaN(_0x268643)){return _0x3d8981(msgResponse(_0xb349('0x223'),'Error','Ts\x20=\x20'+_0x268643));}if(_0x4b393c<=0x0||isNaN(_0x4b393c)){return _0x3d8981(msgResponse('[abandonmentRate]','Error',_0xb349('0x225')+_0x4b393c));}if(_0x3a3836<=0x0||isNaN(_0x3a3836)){return _0x3d8981(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x3a3836));}if(_0x43b126<=0x0||isNaN(_0x43b126)){return _0x3d8981(msgResponse(_0xb349('0x223'),_0xb349('0x8d'),_0xb349('0x226')+_0x43b126));}_0x16d5b5=_0x16d5b5||0x0;var _0x1e6684=0x1/_0x268643;var _0x37980e=0x0;var _0x140005=0x0;var _0x5849fe=0x0;var _0x40e4ae=0x0;for(var _0x51bb09=0x0;_0x5849fe<_0x43b126;_0x51bb09+=0x1){_0x140005=_0x51bb09/_0x3a3836;_0x37980e=(_0x4b393c*_0x140005+_0x16d5b5)/_0x1e6684;_0x5849fe=utils[_0xb349('0x227')](_0x37980e,_0x3978bf);_0x40e4ae=_0x37980e/_0x3978bf*(0x1-utils[_0xb349('0x227')](_0x37980e,_0x3978bf));}return _0x5223d1({'erlangCalls':_0x51bb09,'erlangCallToSecond':_0x3a3836/_0x51bb09,'erlangAbandonmentRate':_0x5849fe,'erlangBusyFactor':_0x40e4ae});});};Dialer['prototype']['busyFactor']=function(_0x43488b,_0x35454c,_0x45b0f9,_0x28156f,_0x14ad46,_0x834acf){loggerPredictive[_0xb349('0x4d')](_0xb349('0x228'));loggerPredictive['info'](_0xb349('0x229'),_0x43488b);loggerPredictive['info'](_0xb349('0x21f'),_0x35454c);loggerPredictive[_0xb349('0x4d')](_0xb349('0x220'),_0x45b0f9);loggerPredictive[_0xb349('0x4d')](_0xb349('0x221'),_0x28156f);loggerPredictive['info'](_0xb349('0x22a'),_0x14ad46);loggerPredictive[_0xb349('0x4d')]('---------------------------');return new Promise(function(_0x1562e6,_0x55caa3){if(_0x43488b<=0x0||isNaN(_0x43488b)){return _0x55caa3(msgResponse('[busyFactor]',_0xb349('0x8d'),_0xb349('0x224')+_0x43488b));}if(_0x45b0f9<=0x0||isNaN(_0x45b0f9)){return _0x55caa3(msgResponse(_0xb349('0x22b'),_0xb349('0x8d'),_0xb349('0x22c')+_0x45b0f9));}if(_0x28156f<=0x0||isNaN(_0x28156f)){return _0x55caa3(msgResponse(_0xb349('0x22b'),_0xb349('0x8d'),_0xb349('0x225')+_0x28156f));}if(_0x35454c<=0x0||isNaN(_0x35454c)){return _0x55caa3(msgResponse('[busyFactor]',_0xb349('0x8d'),_0xb349('0x22d')+_0x35454c));}if(_0x14ad46<=0x0||isNaN(_0x14ad46)){return _0x55caa3(msgResponse(_0xb349('0x22b'),_0xb349('0x8d'),_0xb349('0x22e')+_0x14ad46));}_0x834acf=_0x834acf||0x0;var _0x2b0e1b=0x1/_0x45b0f9;var _0x20241d=0x0;var _0x1fb9bb=0x0;var _0x774816=0x0;var _0x4bae03=0x0;for(var _0x22cbff=0x0;_0x4bae03<_0x14ad46;_0x22cbff+=0x1){_0x1fb9bb=_0x22cbff/_0x35454c;_0x20241d=(_0x28156f*_0x1fb9bb+_0x834acf)/_0x2b0e1b;_0x774816=utils['erlangb'](_0x20241d,_0x43488b);_0x4bae03=_0x20241d/_0x43488b*(0x1-utils[_0xb349('0x227')](_0x20241d,_0x43488b));}return _0x1562e6({'erlangCalls':_0x22cbff,'erlangCallToSecond':_0x35454c/_0x22cbff,'erlangAbandonmentRate':_0x774816,'erlangBusyFactor':_0x4bae03});});};module[_0xb349('0x22f')]=Dialer; \ No newline at end of file +var _0xbf01=['countabandonedretry','countglobal','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','channel','actionid','strategy','isNil','locked','stateinterface','paused','rrmemory','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','rescheduleContact','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','HANGUP','saveInDb','[syncHangupInAMDIvr]','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','Unknow','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','available','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','Contact','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','getVoiceQueueRtPauses','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','./utils/hopper','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','[getContactDialer2][Empty]','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','originated','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','then','content','true','command','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','predictive','progressive','power','dialPowerLevel','handlePower','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','silly','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','syncAgentComplete','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT'];(function(_0x2ed13c,_0x190337){var _0x10cf06=function(_0x2d95cc){while(--_0x2d95cc){_0x2ed13c['push'](_0x2ed13c['shift']());}};_0x10cf06(++_0x190337);}(_0xbf01,0x13e));var _0x1bf0=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xbf01[_0x54eab6];return _0x1e7435;};'use strict';var util=require(_0x1bf0('0x0'));var _=require(_0x1bf0('0x1'));var uuid=require(_0x1bf0('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x1bf0('0x3'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x1bf0('0x4'))(_0x1bf0('0x5'));var loggerBooked=require('../../../config/logger')(_0x1bf0('0x6'));var loggerPredictive=require(_0x1bf0('0x4'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x1bf0('0x4'))(_0x1bf0('0x7'));var ami=require(_0x1bf0('0x8'));config[_0x1bf0('0x9')]=_['defaults'](config[_0x1bf0('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x1bf0('0xa'))(new Redis(config[_0x1bf0('0x9')]));var cmHopper=require(_0x1bf0('0xb'));var voiceQueueRt=require(_0x1bf0('0xc'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x1bf0('0xd'));var History=require('./models/history');var Final=require(_0x1bf0('0xe'));var AgentComplete=require(_0x1bf0('0xf'));var QueueCallerAbandon=require(_0x1bf0('0x10'));var Hangup=require(_0x1bf0('0x11'));var ipAgi=process[_0x1bf0('0x12')][_0x1bf0('0x13')]||_0x1bf0('0x14');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1bf0('0x15')]['enqueue']=function(_0x4900fc){this[_0x1bf0('0x16')]=this[_0x1bf0('0x16')]?this[_0x1bf0('0x16')][_0x1bf0('0x17')](_0x4900fc):_0x4900fc();};function Dialer(_0x23a833,_0x180a07){this[_0x1bf0('0x18')]=new Sequence();this['preview']=_0x180a07;this[_0x1bf0('0x19')]=_0x23a833[_0x1bf0('0x19')];this[_0x1bf0('0x1a')]=_0x23a833[_0x1bf0('0x1a')];this[_0x1bf0('0x1b')]=_0x23a833[_0x1bf0('0x1b')];this['trunks']=_0x23a833[_0x1bf0('0x1c')];this[_0x1bf0('0x1d')]=config[_0x1bf0('0x1d')]||0x2;this[_0x1bf0('0x1e')]={};this[_0x1bf0('0x1f')]={};this[_0x1bf0('0x20')]={};this[_0x1bf0('0x21')]={};this[_0x1bf0('0x22')]={};this[_0x1bf0('0x23')]={};this[_0x1bf0('0x24')]={};this[_0x1bf0('0x25')]={};this[_0x1bf0('0x26')]={};this['queueBookedRR']={};this[_0x1bf0('0x27')]={};ami['on'](_0x1bf0('0x28'),this[_0x1bf0('0x29')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x2b'),this[_0x1bf0('0x2c')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x2d'),this[_0x1bf0('0x2e')]['bind'](this));ami['on'](_0x1bf0('0x2f'),this['syncAgentComplete'][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x30'),this[_0x1bf0('0x7')][_0x1bf0('0x2a')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x1bf0('0x31'),this[_0x1bf0('0x32')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x33'),this[_0x1bf0('0x34')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x35'),this[_0x1bf0('0x36')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x37'),this[_0x1bf0('0x38')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x39'),this[_0x1bf0('0x3a')][_0x1bf0('0x2a')](this));this[_0x1bf0('0x3b')]();this[_0x1bf0('0x3c')]();RpcSetting[_0x1bf0('0x3d')]()['then'](function(_0x276be7){previewRecallmeReminderInterval=_0x276be7['previewRecallmeReminderInterval'];});}function isNotNull(_0x604705){return _0x604705!==null&&!_[_0x1bf0('0x3e')](_0x604705);}function msgResponse(_0x274a84,_0x32713f,_0x17100d){return{'action':_0x274a84,'response':_0x32713f,'message':_0x17100d,'stack':_0x17100d};}function emit(_0x3738b0,_0x5de0b6,_0x3c8562){io['to'](_0x3738b0)['emit'](_0x5de0b6,_0x3c8562);}function emitOutboundVoiceQueueSummary(_0x281011){if(_0x281011[_0x1bf0('0x3f')]==='outbound'){logger[_0x1bf0('0x40')](_0x1bf0('0x41'),util[_0x1bf0('0x42')](_0x281011,{'showHidden':![],'depth':null}));emit(util[_0x1bf0('0x43')]('voice:queue:%s',_0x281011['name']),_0x1bf0('0x44'),_0x281011);}}function checkGetDataPredictive(_0x5e795a){if(isNotNull(_0x5e795a)&&!_[_0x1bf0('0x45')](_0x5e795a)){loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x47'));loggerPredictive['info'](_0x1bf0('0x48'),_0x5e795a[_0x1bf0('0x49')]);loggerPredictive['info'](_0x1bf0('0x4a'),_0x5e795a['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x1bf0('0x46')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e795a['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x1bf0('0x4b'),_0x5e795a[_0x1bf0('0x4c')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x4d'),_0x5e795a['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x1bf0('0x4e'),_0x5e795a[_0x1bf0('0x4f')]);loggerPredictive['info']('---------------------------');if(_0x5e795a[_0x1bf0('0x49')]>0x0){if(!_[_0x1bf0('0x3e')](_0x5e795a[_0x1bf0('0x4f')])&&_0x5e795a['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x50'));if(!_[_0x1bf0('0x3e')](_0x5e795a[_0x1bf0('0x51')])&&_0x5e795a[_0x1bf0('0x51')]>0x0){return!![];}loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x52'));}else{loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x53'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x583409){return function(_0xafed9c){loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x54'));loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x55'),_0xafed9c[_0x1bf0('0x56')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x57'),_0xafed9c[_0x1bf0('0x58')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x59'),_0xafed9c[_0x1bf0('0x5a')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x5b'),_0xafed9c[_0x1bf0('0x5c')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x59'),_0xafed9c[_0x1bf0('0x5a')]);loggerPredictive['info'](_0x1bf0('0x5d'));_[_0x1bf0('0x5e')](_0x583409,_0xafed9c);};}function ifInterval(_0x59de75,_0x4a4c89){if(_[_0x1bf0('0x3e')](_0x4a4c89)){return![];}return utils[_0x1bf0('0x5f')](undefined,_0x4a4c89)<_0x59de75*0x3c;}function clearPredictiveAttributes(_0x22538e){if(_0x22538e[_0x1bf0('0x24')]){_0x22538e[_0x1bf0('0x24')]=undefined;loggerPredictive[_0x1bf0('0x40')](_0x22538e[_0x1bf0('0x60')],_0x1bf0('0x61'));}if(_0x22538e[_0x1bf0('0x23')]){_0x22538e[_0x1bf0('0x23')]=undefined;loggerPredictive['debug'](_0x22538e['name'],_0x1bf0('0x62'));}if(_0x22538e[_0x1bf0('0x63')]){clearInterval(_0x22538e[_0x1bf0('0x63')]);_0x22538e[_0x1bf0('0x63')]=undefined;loggerPredictive['debug'](_0x22538e[_0x1bf0('0x60')],_0x1bf0('0x64'));}}function loggerCatchPredictive(_0x2f3c23,_0x4e72cb){return function(_0x5a4c94){loggerPredictive[_0x1bf0('0x65')](_0x4e72cb[_0x1bf0('0x60')],_0x2f3c23);loggerPredictive[_0x1bf0('0x65')](_0x5a4c94[_0x1bf0('0x66')]);clearPredictiveAttributes(_0x4e72cb);};}function loggerCatch(_0x368a6d){return function(_0x2cc783){logger[_0x1bf0('0x65')](_0x368a6d,util[_0x1bf0('0x42')](_0x2cc783,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5b4427,_0x4a63be,_0x431992){return function(_0x2d69f9){utils[_0x1bf0('0x67')](_0x4a63be,_0x431992,0x0);_0x4a63be[_0x1bf0('0x68')]=0x0;logger[_0x1bf0('0x65')](_0x5b4427,util[_0x1bf0('0x42')](_0x2d69f9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x10a915){return function(_0x5333b4){if(isNotNull(_0x5333b4)&&isNotNull(_0x5333b4[0x0])){if(_0x5333b4[0x0][_0x1bf0('0x69')]>0x0){_0x10a915['message']=utils[_0x1bf0('0x6a')][_0x1bf0('0x6b')];logger[_0x1bf0('0x46')](_0x1bf0('0x6c')+_0x10a915[_0x1bf0('0x60')],_0x5333b4[0x0][_0x1bf0('0x69')],_0x1bf0('0x6d'));}else{_0x10a915[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x1bf0('0x6f')+_0x10a915[_0x1bf0('0x60')]);}}};}function createObjHistory(_0x438d88,_0x4d9565,_0x368a26,_0x1f662e,_0x5845ff){_0x438d88['message']=_0x368a26;var _0xeba9dc=new Action(_0x438d88,_0x4d9565);var _0x5b9f9d=new History(_0xeba9dc);_0x5b9f9d['state']=_0x1f662e;_0x5b9f9d[_0x1bf0('0x70')]=_0x5845ff;_0x5b9f9d[_0x1bf0('0x71')]=_0xeba9dc[_0x1bf0('0x72')];return _0x5b9f9d;}function unlockQueueStatus(_0x593cdd,_0x9b6dd6){setTimeout(function(){if(_[_0x1bf0('0x3e')](_0x593cdd['queueStatusComplete'])){loggerBooked[_0x1bf0('0x65')](_0x1bf0('0x73'),_0x9b6dd6);}_0x593cdd[_0x1bf0('0x74')]=!![];loggerBooked[_0x1bf0('0x46')](_0x1bf0('0x75'),_0x9b6dd6,JSON[_0x1bf0('0x76')](_[_0x1bf0('0x77')](_0x593cdd,['name',_0x1bf0('0x74')])));},0x1f3);}function checkInterval(_0x532968){return function(){if(!isNotNull(_0x532968[_0x1bf0('0x78')])){_0x532968[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];throw _0x532968['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x532968[_0x1bf0('0x78')][_0x1bf0('0x7a')])){_0x532968[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];throw _0x532968[_0x1bf0('0x60')]+_0x1bf0('0x7b');}if(!isNotNull(_[_0x1bf0('0x45')](_0x532968[_0x1bf0('0x78')][_0x1bf0('0x7a')]))){_0x532968[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];throw _0x532968[_0x1bf0('0x60')]+_0x1bf0('0x7b');}};}function checkIsIVRCampaignActive(_0x442177){return function(){if(!utils['isIVRCampaignActive'](_0x442177)){_0x442177[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x7c')];throw _0x442177[_0x1bf0('0x60')]+_0x1bf0('0x7d');}};}function emitCampaignSummary(_0x200c2b){if(utils[_0x1bf0('0x7e')](_0x200c2b)){emit(util[_0x1bf0('0x43')]('campaign:ivr:%s',_0x200c2b[_0x1bf0('0x60')]),'campaign:save',_0x200c2b);}}function loggerCatchQueueSummary(_0x51f7d1,_0x2ad73d){return function(_0x2c8398){clearPredictiveAttributes(_0x2ad73d);emitCampaignSummary(_0x2ad73d);loggerSyncQueueSummary[_0x1bf0('0x40')](_0x51f7d1,util[_0x1bf0('0x42')](_0x2c8398,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5eb01f){if(_0x5eb01f[_0x1bf0('0x7f')]){if(_0x5eb01f[_0x1bf0('0x80')]===0x0){_0x5eb01f[_0x1bf0('0x7f')]=![];_0x5eb01f[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['INACTIVE'];loggerSyncQueueSummary[_0x1bf0('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5eb01f['name'],_0x1bf0('0x81'));}else{_0x5eb01f[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['DISACTIVED'];loggerSyncQueueSummary[_0x1bf0('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5eb01f['name'],_0x1bf0('0x82'));}emitCampaignSummary(_0x5eb01f);}}function myreject(_0x6a09f5){return function(_0x160c7f){return _0x6a09f5(msgResponse(_0x1bf0('0x83'),_0x1bf0('0x84'),JSON[_0x1bf0('0x76')](_0x160c7f)));};}Dialer[_0x1bf0('0x15')][_0x1bf0('0x85')]=function(_0x4184d0){return!_[_0x1bf0('0x3e')](_0x4184d0)&&_0x4184d0&&!_[_0x1bf0('0x3e')](_0x4184d0[_0x1bf0('0x60')])&&!_[_0x1bf0('0x3e')](_0x4184d0[_0x1bf0('0x86')])&&_0x4184d0[_0x1bf0('0x86')]&&(this[_0x1bf0('0x1c')][util[_0x1bf0('0x43')]('SIP/%s',_0x4184d0[_0x1bf0('0x60')])][_0x1bf0('0x87')]==='reachable'||this[_0x1bf0('0x1c')][util[_0x1bf0('0x43')](_0x1bf0('0x88'),_0x4184d0['name'])][_0x1bf0('0x87')]===_0x1bf0('0x89'));};Dialer[_0x1bf0('0x15')][_0x1bf0('0x8a')]=function(_0x35eae5){var _0x23391f=this;return function(){if(!_0x23391f[_0x1bf0('0x85')](_0x35eae5[_0x1bf0('0x8b')])){if(!_0x23391f[_0x1bf0('0x85')](_0x35eae5[_0x1bf0('0x8c')])){_0x35eae5[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x8d')];throw _0x35eae5[_0x1bf0('0x60')]+_0x1bf0('0x8e');}}};};Dialer[_0x1bf0('0x15')][_0x1bf0('0x8f')]=function(_0x162a61,_0x2fb735,_0x2410e1,_0x103c58){var _0x205e28=this;return function(){var _0x212b39=!![];return _0x205e28[_0x1bf0('0x90')](_0x162a61,_0x2fb735,_0x2410e1,_0x103c58,_0x212b39);};};Dialer['prototype'][_0x1bf0('0x91')]=function(_0x54f474,_0x4ed4f4,_0xcb7273,_0xb57ae5){var _0x199498=this;return function(){var _0x1289a3=![];return _0x199498[_0x1bf0('0x90')](_0x54f474[_0x1bf0('0x7a')],_0x4ed4f4,_0xcb7273,_0xb57ae5,_0x1289a3);};};Dialer[_0x1bf0('0x15')][_0x1bf0('0x90')]=function(_0x1b9290,_0x8673c8,_0x599f32,_0x1a64f0,_0x386305){var _0x4a2179=[];return new Promise(function(_0x324b9f,_0x8bc8f2){if(!isNotNull(_0x1b9290)){_0x1a64f0[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];return _0x8bc8f2(msgResponse(_0x1bf0('0x92'),_0x1bf0('0x93'),_0x599f32+_0x1bf0('0x94')));}if(_['isEmpty'](_0x1b9290)){_0x1a64f0[_0x1bf0('0x6e')]=utils['CAMPAIGN_STATUS'][_0x1bf0('0x95')];return _0x8bc8f2(msgResponse('ifTime',_0x1bf0('0x93'),_0x599f32+_0x1bf0('0x96')));}if(_0x8673c8&&_['isUndefined'](config[_0x1bf0('0x97')][_0x8673c8])){_0x1a64f0['message']=utils[_0x1bf0('0x6a')]['UNKNOWN_TIMEZONE'];return _0x8bc8f2(msgResponse(_0x1bf0('0x92'),'Failure',_0x599f32+_0x1bf0('0x98')+_0x8673c8));}if(_[_0x1bf0('0x99')](_0x1b9290)){for(var _0x243ac9=0x0;_0x243ac9<_0x1b9290[_0x1bf0('0x9a')];_0x243ac9+=0x1){_0x4a2179[_0x1bf0('0x9b')](ami[_0x1bf0('0x9c')]({'action':'command','command':util[_0x1bf0('0x43')](_0x1bf0('0x9d'),_0x1b9290[_0x243ac9]['interval'],!_[_0x1bf0('0x3e')](config[_0x1bf0('0x97')][_0x8673c8])?_0x8673c8:'')})[_0x1bf0('0x9e')](function(_0x134520){return _0x134520[_0x1bf0('0x9f')]['indexOf'](_0x1bf0('0xa0'))>=0x0;})['catch'](myreject(_0x8bc8f2)));}}else{_0x4a2179[_0x1bf0('0x9b')](ami['Action']({'action':_0x1bf0('0xa1'),'command':util[_0x1bf0('0x43')]('iftime\x20%s,%s',_0x1b9290,!_[_0x1bf0('0x3e')](config[_0x1bf0('0x97')][_0x8673c8])?_0x8673c8:'')})[_0x1bf0('0x9e')](function(_0x255771){return _0x255771[_0x1bf0('0x9f')][_0x1bf0('0xa2')]('true')>=0x0;})[_0x1bf0('0xa3')](myreject(_0x8bc8f2)));}Promise[_0x1bf0('0xa4')](_0x4a2179)[_0x1bf0('0x9e')](function(_0x2cfaaf){var _0x27f264=_[_0x1bf0('0xa5')](_0x2cfaaf);if(_0x27f264){return _0x324b9f(_0x27f264);}else{_0x1a64f0['message']=_0x386305?utils[_0x1bf0('0x6a')][_0x1bf0('0xa6')]:utils[_0x1bf0('0x6a')][_0x1bf0('0xa7')];return _0x8bc8f2(msgResponse(_0x1bf0('0xa8'),_0x1bf0('0x93'),_0x1bf0('0xa9')+_0x386305+'\x20'+_0x599f32+_0x1bf0('0xaa')+util[_0x1bf0('0x42')](_0x1b9290,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x8673c8));}})[_0x1bf0('0xa3')](function(_0x199f7a){return _0x8bc8f2(msgResponse(_0x1bf0('0x92'),_0x1bf0('0x93'),JSON[_0x1bf0('0x76')](_0x199f7a)));});});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x3b')]=function(){var _0x24af6b=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x24af6b[_0x1bf0('0xab')]();},0x3e8);});};Dialer[_0x1bf0('0x15')][_0x1bf0('0xab')]=function(){var _0x7c28d2=this;var _0x282aa3;for(var _0x9a048e in this['campaigns']){if(typeof this[_0x1bf0('0x1a')][_0x9a048e]!==_0x1bf0('0xac')){_0x282aa3=this[_0x1bf0('0x1a')][_0x9a048e];if(utils[_0x1bf0('0x7e')](_0x282aa3)&&utils[_0x1bf0('0xad')](_0x282aa3)){_0x282aa3[_0x1bf0('0x7f')]=!![];Promise[_0x1bf0('0xae')]()[_0x1bf0('0x9e')](checkIsIVRCampaignActive(_0x282aa3))['then'](checkInterval(_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2['checkIsTrunkReachable'](_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2[_0x1bf0('0x8f')](_0x282aa3[_0x1bf0('0xaf')],_0x282aa3[_0x1bf0('0xb0')],_0x282aa3[_0x1bf0('0x60')],_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2[_0x1bf0('0x91')](_0x282aa3[_0x1bf0('0x78')],_0x282aa3[_0x1bf0('0xb0')],_0x282aa3[_0x1bf0('0x60')],_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2[_0x1bf0('0xb1')](_0x282aa3))[_0x1bf0('0xa3')](loggerCatchQueueSummary(_0x1bf0('0xb2'),_0x282aa3));}else{notSendMessagesCampaign(_0x282aa3);}}}};Dialer[_0x1bf0('0x15')]['checkDialMethod']=function(_0x290e6c){if(_0x290e6c[_0x1bf0('0xb3')]!==_0x1bf0('0xb4')){clearPredictiveAttributes(_0x290e6c);}switch(_0x290e6c[_0x1bf0('0xb3')]){case _0x1bf0('0xb5'):this['handlePower'](_0x290e6c,0x1);break;case _0x1bf0('0xb6'):this['handlePower'](_0x290e6c,_0x290e6c[_0x1bf0('0xb7')]);break;case'predictive':this[_0x1bf0('0xb4')](_0x290e6c);break;case _0x1bf0('0x6'):this[_0x1bf0('0xb8')](_0x290e6c,0x1);break;default:logger[_0x1bf0('0x65')]('Queue',_0x290e6c[_0x1bf0('0x60')],_0x1bf0('0xb9'));}};Dialer[_0x1bf0('0x15')]['ifTime']=function(_0x485844,_0x5b1010){var _0x82443c=_0x485844[_0x1bf0('0xb0')];var _0x1132a0=_0x5b1010?_0x485844['dialGlobalInterval']:_0x485844[_0x1bf0('0x78')]['Intervals'];logger['silly'](_0x1bf0('0xba'),_0x1132a0,_0x82443c,_0x485844[_0x1bf0('0x60')],util[_0x1bf0('0x43')](_0x1bf0('0xbb'),_0x485844[_0x1bf0('0x60')],_0x485844['id']));var _0x421276=null;return Interval[_0x1bf0('0xbc')](_0x1132a0,_0x82443c)['then'](function(_0x3d2243){if(_0x3d2243===!![]){return _0x3d2243;}else{_0x485844['message']=_0x5b1010?utils[_0x1bf0('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1bf0('0x6a')][_0x1bf0('0xa7')];_0x421276=msgResponse('[ifTime][promiseAll]',_0x1bf0('0x93'),_0x1bf0('0xa9')+_0x5b1010+'\x20'+_0x485844[_0x1bf0('0x60')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x1bf0('0x42')](_0x1132a0,{'showHidden':![],'depth':null})+_0x1bf0('0xbd')+_0x82443c);}if(_0x421276!==null){logger[_0x1bf0('0xbe')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x421276);_0x421276[_0x1bf0('0xbf')]=_0x5b1010;throw _0x421276;}})[_0x1bf0('0xa3')](function(_0x3a5ed9){logger['error'](_0x1bf0('0xc0'),_0x3a5ed9);throw msgResponse(_0x1bf0('0x83'),'Error',util[_0x1bf0('0x42')](_0x3a5ed9,{'showHidden':![],'depth':null}));});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x29')]=function(_0xcb63bb){if(this[_0x1bf0('0x19')][_0xcb63bb[_0x1bf0('0xc1')]]){if(this[_0x1bf0('0x21')][_0xcb63bb[_0x1bf0('0xc2')]]&&this['uniqueId'][_0xcb63bb['uniqueid']][_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){this[_0x1bf0('0xc4')](this[_0x1bf0('0x19')][_0xcb63bb[_0x1bf0('0xc1')]]);this[_0x1bf0('0x21')][_0xcb63bb['uniqueid']][_0x1bf0('0xc5')]=moment()[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x1bf0('0x15')][_0x1bf0('0xc6')]=function(_0x4c11fb){var _0x433142=this[_0x1bf0('0x21')][_0x4c11fb[_0x1bf0('0xc2')]];if(this[_0x1bf0('0x19')][_0x4c11fb[_0x1bf0('0xc1')]]){if(_0x433142&&_0x433142[_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){delete this[_0x1bf0('0x21')][_0x4c11fb[_0x1bf0('0xc2')]];this[_0x1bf0('0x19')][_0x4c11fb[_0x1bf0('0xc1')]][_0x1bf0('0xc7')]+=0x1;var _0x1d95d0=new AgentComplete(_0x433142,_0x4c11fb);if(_0x4c11fb[_0x1bf0('0xc8')]==='agent'){_0x1d95d0[_0x1bf0('0xc9')]=this[_0x1bf0('0x19')][_0x4c11fb[_0x1bf0('0xc1')]][_0x1bf0('0xca')]&&this[_0x1bf0('0x19')][_0x4c11fb['queue']][_0x1bf0('0xcb')]?moment()[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x1bf0('0xcc')](_0x1d95d0)['catch'](loggerCatch(_0x1bf0('0xcd')));hopperUtils[_0x1bf0('0xce')](_0x1d95d0)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xcf')));}}};Dialer[_0x1bf0('0x15')]['syncQueueCallerAbandon']=function(_0x5daf18){var _0x3e3d3a=this[_0x1bf0('0x21')][_0x5daf18[_0x1bf0('0xc2')]];var _0x46ba37=this;var _0x5c7375=![];var _0x110fb1;var _0x45d92f;if(this[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]]){if(_0x3e3d3a&&_0x3e3d3a[_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){delete this[_0x1bf0('0x21')][_0x5daf18[_0x1bf0('0xc2')]];this['updateOriginated'](this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]]);_0x3e3d3a[_0x1bf0('0xd0')]=moment()[_0x1bf0('0x43')](_0x1bf0('0xd1'));var _0x2d35f0=new QueueCallerAbandon(_0x3e3d3a,_0x5daf18);if(utils['getSeconds'](_0x3e3d3a[_0x1bf0('0xd0')],_0x3e3d3a[_0x1bf0('0xd2')])>=_0x3e3d3a[_0x1bf0('0xd3')]){this[_0x1bf0('0x19')][_0x5daf18['queue']][_0x1bf0('0xd4')]+=0x1;this[_0x1bf0('0x19')][_0x5daf18['queue']][_0x1bf0('0xd5')]+=0x1;this[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2d35f0[_0x1bf0('0xd6')]=0xa;_0x2d35f0[_0x1bf0('0x70')]=_0x1bf0('0xd7');_0x2d35f0[_0x1bf0('0xd8')]='TIMEOUT';_0x2d35f0[_0x1bf0('0xc9')]=this['voiceQueues'][_0x5daf18['queue']]['dialQueueProject2']?moment()['format'](_0x1bf0('0xd1')):undefined;_0x2d35f0['countdropretry']+=0x1;_0x2d35f0['countglobal']+=0x1;_0x110fb1=this[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xd9')];_0x45d92f=this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xda')];hopperUtils['verifyAdditionalPhones'](_0x2d35f0,_0x2d35f0[_0x1bf0('0xd6')],_0x3e3d3a[_0x1bf0('0xdb')])[_0x1bf0('0x9e')](function(_0x4e8ec7){_0x5c7375=_0x4e8ec7[_0x1bf0('0xdc')]==0x1;if(_0x2d35f0[_0x1bf0('0xdd')]>=_0x46ba37[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xde')]){_0x46ba37[_0x1bf0('0xdf')](_0x2d35f0,_0x4e8ec7['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2d35f0['countdropretry'],'scheduledat':moment()[_0x1bf0('0xe0')](_0x46ba37[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xd9')],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x3e3d3a[_0x1bf0('0xe2')],'ListId':_0x3e3d3a[_0x1bf0('0xe3')],'VoiceQueueId':_0x3e3d3a[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x3e3d3a[_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0xe6')));var _0x2f9c96=new History(_0x2d35f0);_0x2f9c96[_0x1bf0('0xd6')]=0xa;_0x2f9c96[_0x1bf0('0x70')]=_0x1bf0('0xd7');_0x2f9c96[_0x1bf0('0x72')]=moment()['format'](_0x1bf0('0xd1'));_0x2f9c96[_0x1bf0('0x71')]=_0x2f9c96[_0x1bf0('0x72')];_0x2f9c96[_0x1bf0('0xe7')]=_0x2d35f0[_0x1bf0('0xe7')];_0x2f9c96['calleridnum']=_0x2d35f0[_0x1bf0('0xe8')];hopperUtils[_0x1bf0('0xcc')](_0x2f9c96)[_0x1bf0('0xa3')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x5c7375)hopperUtils[_0x1bf0('0xe9')](_0x2d35f0,_0x110fb1,_0x45d92f)[_0x1bf0('0x9e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0x4c')]+=0x1;this[_0x1bf0('0x19')][_0x5daf18['queue']][_0x1bf0('0xea')]+=0x1;_0x2d35f0['state']=0xb;_0x2d35f0[_0x1bf0('0x70')]=_0x1bf0('0xeb');_0x2d35f0[_0x1bf0('0xd8')]=_0x1bf0('0xec');_0x2d35f0[_0x1bf0('0xed')]+=0x1;_0x2d35f0[_0x1bf0('0xee')]+=0x1;_0x110fb1=this['voiceQueues'][_0x5daf18['queue']]['dialAbandonedRetryFrequency'];_0x45d92f=this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x2d35f0,_0x2d35f0[_0x1bf0('0xd6')],_0x3e3d3a[_0x1bf0('0xdb')])[_0x1bf0('0x9e')](function(_0x5a9a13){if(_0x2d35f0[_0x1bf0('0xed')]>=_0x46ba37[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xef')]){_0x46ba37[_0x1bf0('0xdf')](_0x2d35f0,_0x5a9a13[_0x1bf0('0xdc')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2d35f0[_0x1bf0('0xed')],'scheduledat':moment()['add'](_0x46ba37[_0x1bf0('0x19')][_0x5daf18['queue']]['dialAbandonedRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x3e3d3a['ContactId'],'ListId':_0x3e3d3a[_0x1bf0('0xe3')],'VoiceQueueId':_0x3e3d3a['VoiceQueueId']||undefined,'CampaignId':_0x3e3d3a[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xf0')));var _0x5d3579=new History(_0x2d35f0);_0x5d3579[_0x1bf0('0xd6')]=0xb;_0x5d3579['statedesc']=_0x1bf0('0xeb');_0x5d3579[_0x1bf0('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d3579[_0x1bf0('0x71')]=_0x5d3579['starttime'];_0x5d3579[_0x1bf0('0xe7')]=_0x2d35f0[_0x1bf0('0xe7')];_0x5d3579[_0x1bf0('0xe8')]=_0x2d35f0[_0x1bf0('0xe8')];hopperUtils[_0x1bf0('0xcc')](_0x5d3579)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x1bf0('0x9e')](function(){if(_0x5c7375)hopperUtils[_0x1bf0('0xe9')](_0x2d35f0,_0x110fb1,_0x45d92f)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x1bf0('0x34')]=function(_0x494fa3){if(this['actions'][_0x494fa3['uniqueid']]){this['actions'][_0x494fa3[_0x1bf0('0xc2')]][_0x1bf0('0xf1')]=_0x494fa3[_0x1bf0('0xf1')];}if(this[_0x1bf0('0x21')][_0x494fa3['uniqueid']]){this[_0x1bf0('0x21')][_0x494fa3['uniqueid']][_0x1bf0('0xf1')]=_0x494fa3[_0x1bf0('0xf1')];}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x38')]=function(_0x58e638){if(!this['actions'][_0x58e638[_0x1bf0('0xf2')]]){return;}var _0x5909bf=this[_0x1bf0('0x19')][this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]['queue']][_0x1bf0('0xf3')]||'rrmemory';if(_0x5909bf==='roundrobin'){if(this[_0x1bf0('0x1f')][_0x58e638['actionid']]&&_[_0x1bf0('0xf4')](this['actions'][_0x58e638['actionid']][_0x1bf0('0xf5')])&&_0x58e638[_0x1bf0('0x87')]==='1'&&_0x58e638['paused']==='0'){if(this[_0x1bf0('0x1b')][_0x58e638['stateinterface']]){if(!this['agents'][_0x58e638[_0x1bf0('0xf6')]]['locked']){this[_0x1bf0('0x1b')][_0x58e638[_0x1bf0('0xf6')]][_0x1bf0('0xf5')]=!![];this['actions'][_0x58e638[_0x1bf0('0xf2')]][_0x1bf0('0xf5')]=!![];this[_0x1bf0('0x1f')][_0x58e638['actionid']]['stateinterface']=_0x58e638[_0x1bf0('0xf6')];}}}}else if(_0x5909bf==='rrmemory'){if(this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]){if(this[_0x1bf0('0x1b')][_0x58e638[_0x1bf0('0xf6')]]){this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]['stateinterface']=_0x58e638[_0x1bf0('0xf6')];if(_['isNil'](this['queueBooked'][this[_0x1bf0('0x1f')][_0x58e638['actionid']][_0x1bf0('0xc1')]])){this[_0x1bf0('0x26')][this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]['queue']]=[];}this[_0x1bf0('0x26')][this['actions'][_0x58e638[_0x1bf0('0xf2')]]['queue']]['push'](_[_0x1bf0('0x5e')](_[_0x1bf0('0x77')](this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]],['idHopper',_0x1bf0('0xf6')]),{'status':_0x58e638[_0x1bf0('0x87')],'paused':_0x58e638[_0x1bf0('0xf7')]}));}}}};Dialer[_0x1bf0('0x15')]['syncQueueStatusComplete']=function(_0x493991){if(!this[_0x1bf0('0x1f')][_0x493991['actionid']]){return;}var _0x32e76d=this;var _0x41e8a7=this[_0x1bf0('0x19')][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]];var _0x1f454c=_0x41e8a7[_0x1bf0('0xf3')]||_0x1bf0('0xf8');if(_0x1f454c==='roundrobin'){if(this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]&&this[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xf6')]){this[_0x1bf0('0xf9')][_0x1bf0('0xfa')](this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xfb')],this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]['stateinterface'])[_0x1bf0('0xa3')](function(_0x1431e0){logger[_0x1bf0('0x65')](_0x1bf0('0xfc'),util['inspect'](_0x1431e0,{'showHidden':![],'depth':null}));})[_0x1bf0('0x17')](function(){_0x32e76d['updateOriginated'](_0x32e76d['voiceQueues'][_0x32e76d[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]);_0x32e76d['agents'][_0x32e76d[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]['stateinterface']][_0x1bf0('0xf5')]=![];delete _0x32e76d[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]];unlockQueueStatus(_0x41e8a7);});}else{this[_0x1bf0('0xc4')](this[_0x1bf0('0x19')][this[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xc1')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xe2')],'ListId':this[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xe3')],'VoiceQueueId':this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xe4')]||undefined,'CampaignId':this[_0x1bf0('0x1f')][_0x493991['actionid']]['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xfd')));delete this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]];unlockQueueStatus(_0x41e8a7);}}else if(_0x1f454c===_0x1bf0('0xf8')){var _0x337441;if(this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]&&!_[_0x1bf0('0x45')](this[_0x1bf0('0x26')][this['actions'][_0x493991[_0x1bf0('0xf2')]]['queue']])){if(this[_0x1bf0('0xfe')][_0x32e76d[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xc1')]]){this[_0x1bf0('0xfe')][_0x32e76d[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xc1')]]=this[_0x1bf0('0xfe')][this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]?this['queueBookedRR'][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]:this[_0x1bf0('0x26')][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]?this[_0x1bf0('0x26')][this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]][_0x1bf0('0xff')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]['_rr']=this['queueBookedRR'][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]];for(var _0x25d7d7=0x0;_0x25d7d7=_0x2da612[_0x1bf0('0x124')]){_0x18fc50[_0x1bf0('0x125')](_0x339584,_0x5747a0,_0x537a0b,'reason19\x20machine....');}else{if(_0x339584['countmachineretry']>=_0x2da612[_0x1bf0('0x126')]){_0x18fc50['createStateFinal'](_0x339584,_0x5747a0,_0x537a0b,_0x1bf0('0x127'));}else{hopperUtils[_0x1bf0('0x104')]({'active':![],'countmachineretry':_0x339584[_0x1bf0('0x11e')],'scheduledat':moment()[_0x1bf0('0xe0')](_0x2da612[_0x1bf0('0x128')],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x339584[_0x1bf0('0xe2')],'ListId':_0x339584['ListId'],'VoiceQueueId':_0x339584[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x339584[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x5747a0({'reschedule':0x1});}}});}if(_0x133fbe['type']===_0x1bf0('0xc3')&&this[_0x1bf0('0x1a')][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0x110')]&&_0x4e6224[_0x1bf0('0x111')]===_0x1bf0('0x129')){delete this[_0x1bf0('0x21')][_0x4e6224[_0x1bf0('0xc2')]];this[_0x1bf0('0xc4')](this[_0x1bf0('0x1a')][_0x133fbe['queue']]);_0x2e9df5=new Hangup(_0x133fbe,_0x4e6224);_0x2e9df5[_0x1bf0('0xd6')]=0x12;_0x2e9df5[_0x1bf0('0x70')]=_0x1bf0('0x113');_0x2e9df5['membername']=_0x1bf0('0x115');ami['emit'](_0x1bf0('0x117'),ut[_0x1bf0('0x118')](_0x2e9df5,_0x1bf0('0x119')));this[_0x1bf0('0x12a')](_0x2e9df5,'[syncHangupInAMDIvr][createHistory]',_0x1bf0('0x12b'));}if(_0x133fbe[_0x1bf0('0x3f')]===_0x1bf0('0xc3')&&this['campaigns'][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0x110')]&&_0x4e6224[_0x1bf0('0x111')]===_0x1bf0('0x11c')){return new Promise(function(_0x5d770c,_0x310b55){delete _0x18fc50[_0x1bf0('0x21')][_0x4e6224['uniqueid']];_0x18fc50[_0x1bf0('0xc4')](_0x18fc50['campaigns'][_0x133fbe['queue']]);_0x18fc50['campaigns'][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0xc7')]+=0x1;_0x18fc50[_0x1bf0('0x1a')][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0x112')]+=0x1;var _0x24d868=_0x18fc50[_0x1bf0('0x1a')][_0x133fbe[_0x1bf0('0xc1')]];var _0x22ebba=new Hangup(_0x133fbe,_0x4e6224);_0x22ebba[_0x1bf0('0xd6')]=0x13;_0x22ebba[_0x1bf0('0x70')]=_0x1bf0('0x11d');_0x22ebba[_0x1bf0('0x114')]='AMD';_0x22ebba[_0x1bf0('0x11e')]+=0x1;_0x22ebba[_0x1bf0('0xee')]+=0x1;_0x22ebba[_0x1bf0('0x119')]=!![];ami['emit']('custom:amd',ut[_0x1bf0('0x118')](_0x22ebba,_0x1bf0('0x119')));hopperUtils['createHistory'](_0x22ebba)['catch'](loggerCatch(_0x1bf0('0x11f')));if(_0x22ebba['countbusyretry']+_0x22ebba[_0x1bf0('0x121')]+_0x22ebba['countnoanswerretry']+_0x22ebba[_0x1bf0('0x122')]+_0x22ebba[_0x1bf0('0xdd')]+_0x22ebba[_0x1bf0('0xed')]+_0x22ebba[_0x1bf0('0x11e')]+_0x22ebba[_0x1bf0('0x123')]>=_0x24d868[_0x1bf0('0x124')]){_0x18fc50[_0x1bf0('0x125')](_0x22ebba,_0x5d770c,_0x310b55,_0x1bf0('0x12c'));}else{if(_0x22ebba[_0x1bf0('0x11e')]>=_0x24d868[_0x1bf0('0x126')]){_0x18fc50[_0x1bf0('0x12d')](_0x22ebba,_0x5d770c,_0x310b55,'reason\x2019\x20machine....');}else{hopperUtils[_0x1bf0('0x104')]({'active':![],'countmachineretry':_0x22ebba[_0x1bf0('0x11e')],'scheduledat':moment()['add'](_0x24d868[_0x1bf0('0x128')],_0x1bf0('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22ebba[_0x1bf0('0xe2')],'ListId':_0x22ebba[_0x1bf0('0xe3')],'VoiceQueueId':_0x22ebba[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x22ebba[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x12e')));_0x5d770c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1bf0('0x32')]=function(_0x25844c){var _0x19aa6e=this[_0x1bf0('0x21')][_0x25844c[_0x1bf0('0xc2')]];var _0x332c72;if(_0x19aa6e&&_0x19aa6e[_0x1bf0('0x3f')]===_0x1bf0('0xc3')){delete this[_0x1bf0('0x21')][_0x25844c['uniqueid']];this[_0x1bf0('0xc4')](this['campaigns'][_0x19aa6e[_0x1bf0('0xc1')]]);this[_0x1bf0('0x1a')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x12f')]+=0x1;_0x332c72=new Hangup(_0x19aa6e,_0x25844c);hopperUtils[_0x1bf0('0xcc')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x1bf0('0xce')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch('[syncHangupIvr]'));}if(_0x19aa6e&&_0x19aa6e['type']!==_0x1bf0('0xc3')&&isNotNull(this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x130')])){delete this['uniqueId'][_0x25844c[_0x1bf0('0xc2')]];this[_0x1bf0('0xc4')](this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]]);this[_0x1bf0('0x19')][_0x19aa6e['queue']][_0x1bf0('0xc7')]+=0x1;this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x112')]+=0x1;_0x332c72=new Hangup(_0x19aa6e,_0x25844c);_0x332c72[_0x1bf0('0xd6')]=0x10;_0x332c72[_0x1bf0('0x70')]=_0x1bf0('0x131');_0x332c72['membername']=_0x1bf0('0x132');hopperUtils[_0x1bf0('0xcc')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x133')));hopperUtils['moveContactManagedDialer'](_0x332c72)[_0x1bf0('0xa3')](loggerCatch('[syncHangupIvr]'));}if(_0x19aa6e&&_0x19aa6e['type']!==_0x1bf0('0xc3')&&!isNotNull(this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]]['dialQueueProject'])){if(_0x25844c[_0x1bf0('0x134')]===_0x1bf0('0x135')){delete this[_0x1bf0('0x21')][_0x25844c[_0x1bf0('0xc2')]];this[_0x1bf0('0x19')][_0x19aa6e['queue']]['outboundAnswerCallsDay']+=0x1;const _0x1257f0=new AgentComplete(_0x19aa6e,_0x25844c);_0x1257f0['CampaignId']=this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]]['id'];hopperUtils[_0x1bf0('0xcc')](_0x1257f0)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xcd')));hopperUtils[_0x1bf0('0xce')](_0x1257f0)['catch'](loggerCatch('[syncAgentComplete]'));}else{delete this[_0x1bf0('0x21')][_0x25844c[_0x1bf0('0xc2')]];this['updateOriginated'](this[_0x1bf0('0x19')][_0x19aa6e['queue']]);this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x136')]+=0x1;_0x332c72=new Hangup(_0x19aa6e,_0x25844c);_0x332c72[_0x1bf0('0xd6')]=0xc;_0x332c72['statedesc']=_0x25844c[_0x1bf0('0x134')];_0x332c72['membername']=_0x1bf0('0x137');hopperUtils[_0x1bf0('0xcc')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x133')));hopperUtils[_0x1bf0('0xce')](_0x332c72)['catch'](loggerCatch(_0x1bf0('0x138')));}}};Dialer['prototype'][_0x1bf0('0x7')]=function(_0x4b693c){var _0x24c117=this;if(!_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]]){_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]]={'running':![]};}else if(_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]][_0x1bf0('0x139')]===!![]){return;}else if(_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]][_0x1bf0('0x139')]===![]){_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]]['running']=!![];}var _0x1a86ae=_0x24c117[_0x1bf0('0x19')][_0x4b693c['name']];var _0x6a718e=_0x1a86ae[_0x1bf0('0x6e')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x1f25c5=utils[_0x1bf0('0x13a')](_0x1a86ae);_0x1a86ae[_0x1bf0('0x13b')]=utils['getQueueCampaignStatusMessage'](_0x1a86ae,_0x24c117['trunks']);Promise['resolve']()[_0x1bf0('0x9e')](function(){if(_0x1a86ae[_0x1bf0('0x13b')]===utils[_0x1bf0('0x6a')]['INACTIVE']){if(_0x6a718e){clearPredictiveAttributes(_0x1a86ae);_0x4b693c[_0x1bf0('0x23')]=undefined;_0x4b693c[_0x1bf0('0x24')]=undefined;}if(_0x1a86ae[_0x1bf0('0x13b')]===utils[_0x1bf0('0x6a')][_0x1bf0('0x7c')]){_0x4b693c[_0x1bf0('0x13c')]=0x0;_0x4b693c[_0x1bf0('0xf7')]=0x0;_0x4b693c['inUse']=0x0;_0x4b693c[_0x1bf0('0x13d')]=0x0;_0x4b693c[_0x1bf0('0x13e')]=0x0;}}else if(_0x1a86ae[_0x1bf0('0x13b')]===utils[_0x1bf0('0x6a')][_0x1bf0('0x13f')]&&!_0x1f25c5){return _0x24c117[_0x1bf0('0x92')](_0x1a86ae,!![])[_0x1bf0('0x9e')](function(){return _0x24c117['ifTime'](_0x1a86ae,![]);})[_0x1bf0('0x9e')](function(){return _0x24c117[_0x1bf0('0x140')](_0x1a86ae);})[_0x1bf0('0xa3')](function(_0x5a429a){loggerSyncQueueSummary[_0x1bf0('0x40')](_0x1bf0('0x141'),util[_0x1bf0('0x42')](_0x5a429a,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1a86ae);});}else{clearPredictiveAttributes(_0x1a86ae);}})[_0x1bf0('0x9e')](function(){var _0x3b28c3=_0x4b693c[_0x1bf0('0x142')](_0x1a86ae);if(_0x3b28c3||_0x1a86ae[_0x1bf0('0x143')]){_0x1a86ae[_0x1bf0('0x143')]=![];_0x4b693c[_0x1bf0('0x144')](_0x1a86ae);Object[_0x1bf0('0x145')](_0x1a86ae,_0x4b693c);emitOutboundVoiceQueueSummary(_0x4b693c);}_0x24c117[_0x1bf0('0x27')][_0x1a86ae[_0x1bf0('0x60')]][_0x1bf0('0x139')]=![];})[_0x1bf0('0xa3')](function(_0x4d7a36){logger[_0x1bf0('0x65')](_0x1bf0('0x141'),util['inspect'](_0x4d7a36,{'showHidden':![],'depth':null}));_0x24c117['queuesSummary'][_0x1a86ae[_0x1bf0('0x60')]][_0x1bf0('0x139')]=![];});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x146')]=_['throttle'](function(){var _0x535739=_[_0x1bf0('0x147')](this[_0x1bf0('0x19')],function(_0x1755ac){return _0x1755ac[_0x1bf0('0x148')];});var _0x3722a6=_[_0x1bf0('0x147')](this[_0x1bf0('0x1b')],function(_0x5139ff){return _0x5139ff[_0x1bf0('0x149')]&&_0x5139ff[_0x1bf0('0x87')]===_0x1bf0('0x14a');});if(_0x535739[_0x1bf0('0x9a')]>0x0&&_0x3722a6[_0x1bf0('0x9a')]>0x0){return Promise[_0x1bf0('0xae')]()['then'](cmHopper[_0x1bf0('0x14b')](_[_0x1bf0('0x14c')](_0x535739,'id'),previewRecallmeReminderInterval,_['map'](_0x3722a6,'id')))['then'](function(_0x92d1b6){for(var _0xbd2f75=0x0;_0xbd2f75<_0x92d1b6[_0x1bf0('0x9a')];_0xbd2f75++){var _0x14035e=_0x92d1b6[_0xbd2f75][_0x1bf0('0x14d')][_0x1bf0('0x60')];if(_0x14035e)io['to'](util[_0x1bf0('0x43')]('user:%s',_0x14035e))[_0x1bf0('0x116')](_0x1bf0('0x14e'),{'hopper':_0x92d1b6[_0xbd2f75]});}})[_0x1bf0('0xa3')](function(_0x350dcc){logger['error'](_0x1bf0('0x14f'),_0x350dcc);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1bf0('0x15')][_0x1bf0('0x3c')]=function(){var _0x252c41=this;setInterval(function(){_0x252c41[_0x1bf0('0x150')](_0x252c41[_0x1bf0('0x21')],'[uniqueid]');_0x252c41[_0x1bf0('0x150')](_0x252c41[_0x1bf0('0x1f')],_0x1bf0('0x151'));},0x32c8);};Dialer[_0x1bf0('0x15')][_0x1bf0('0x150')]=function(_0x5f2262,_0x5eecd9){var _0x2fa32e=this;for(var _0x5399da in _0x5f2262){if(typeof _0x5f2262[_0x5399da]!=='undefined'){this[_0x1bf0('0x18')][_0x1bf0('0x152')](function(){if(!_[_0x1bf0('0xf4')](_0x5f2262[_0x5399da])){return ami[_0x1bf0('0x9c')]({'action':_0x1bf0('0x87'),'channel':_0x5f2262[_0x5399da][_0x1bf0('0xf1')]})[_0x1bf0('0xa3')](function(_0x11bbef){if(_0x11bbef['message']===_0x1bf0('0x153')){setTimeout(function(){if(_0x5f2262[_0x5399da]&&_0x5f2262[_0x5399da][_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){_0x2fa32e['updateOriginated'](_0x2fa32e['voiceQueues'][_0x5f2262[_0x5399da][_0x1bf0('0xc1')]]);logger[_0x1bf0('0x65')](_0x1bf0('0x154'),_0x5eecd9,_0x5399da,_0x5f2262[_0x5399da][_0x1bf0('0xc1')]);delete _0x5f2262[_0x5399da];}if(_0x5f2262[_0x5399da]&&_0x5f2262[_0x5399da][_0x1bf0('0x3f')]===_0x1bf0('0xc3')){_0x2fa32e[_0x1bf0('0xc4')](_0x2fa32e['campaigns'][_0x5f2262[_0x5399da]['queue']]);logger[_0x1bf0('0x65')](_0x1bf0('0x155'),_0x5eecd9,_0x5399da,_0x5f2262[_0x5399da][_0x1bf0('0xc1')]);delete _0x5f2262[_0x5399da];}},0x2328);}});}});}}};Dialer[_0x1bf0('0x15')]['getVoiceQueueRtPauses']=function(_0x155c32){return Promise[_0x1bf0('0xae')]()[_0x1bf0('0x9e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x155c32))[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x156')));};Dialer['prototype']['updateOriginated']=function(_0x3bb08f){if(!_['isUndefined'](_0x3bb08f)&&_0x3bb08f!==null){if(typeof _0x3bb08f[_0x1bf0('0x80')]!==_0x1bf0('0xac')){if(_0x3bb08f[_0x1bf0('0x80')]>0x0){_0x3bb08f[_0x1bf0('0x80')]-=0x1;}else{logger[_0x1bf0('0x65')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x157')]=function(_0x643c13,_0x41da12){var _0x4f052e=this;return function(_0x2bc40d){_0x4f052e[_0x1bf0('0xc4')](_0x41da12);logger[_0x1bf0('0x65')](_0x643c13,util[_0x1bf0('0x42')](_0x2bc40d,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x1bf0('0x158')]=function(_0x2afa4a,_0x1b1b15,_0x34204c){var _0x127a46={'state':0x19,'statedesc':_0x1bf0('0x159')};this[_0x1bf0('0xc4')](_0x1b1b15);this[_0x1bf0('0x12a')](_['merge'](_0x127a46,_[_0x1bf0('0x77')](_0x34204c,[_0x1bf0('0xe2'),'ListId',_0x1bf0('0x15a'),'VoiceQueueId',_0x1bf0('0xe5')])),_0x1bf0('0x15b'),'[emptyContact]');logger[_0x1bf0('0x65')](_0x2afa4a);};Dialer[_0x1bf0('0x15')][_0x1bf0('0x12a')]=function(_0x4c3159,_0x560aa6,_0x574268){hopperUtils['createHistory'](_0x4c3159)[_0x1bf0('0xa3')](loggerCatch(_0x560aa6));hopperUtils[_0x1bf0('0xce')](_0x4c3159)['catch'](loggerCatch(_0x574268));};Dialer[_0x1bf0('0x15')][_0x1bf0('0xdf')]=function(_0x4ab8f7,_0x5b56b2){hopperUtils[_0x1bf0('0xcc')](_0x4ab8f7)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xcd')));if(_0x5b56b2==0x0){hopperUtils[_0x1bf0('0xce')](_0x4ab8f7)['catch'](loggerCatch(_0x1bf0('0x15c')));}};Dialer[_0x1bf0('0x15')]['checkPreviewRecallReminder']=function(_0xdf142b){return Promise['resolve']()[_0x1bf0('0x9e')](cmHopper[_0x1bf0('0x14b')](_0xdf142b['id'],previewRecallmeReminderInterval))[_0x1bf0('0x9e')](function(_0x2d428c){for(var _0xb9962a=0x0;_0xb9962a<_0x2d428c[_0x1bf0('0x9a')];_0xb9962a++){var _0x1e58e5=_0x2d428c[_0xb9962a][_0x1bf0('0x14d')][_0x1bf0('0x60')];if(_0x1e58e5)io['to'](util['format'](_0x1bf0('0x15d'),_0x1e58e5))[_0x1bf0('0x116')](_0x1bf0('0x14e'),{'hopper':_0x2d428c[_0xb9962a]});}})[_0x1bf0('0xa3')](function(){});};Dialer[_0x1bf0('0x15')]['launchHandleIvr']=function(_0x2d99e8){var _0x2992b1=this;return function(){_0x2992b1[_0x1bf0('0x15e')](_0x2d99e8);};};Dialer['prototype'][_0x1bf0('0x15f')]=function(_0x803b50,_0x5d16ed){var _0x122a30=this;var _0x3c7244=uuid['v4']();this[_0x1bf0('0x1f')][_0x3c7244]=new Action(_0x803b50,_0x5d16ed,_0x3c7244);return new Promise(function(_0x593e5f,_0x2fd083){if(_[_0x1bf0('0x3e')](_0x803b50)&&typeof _0x803b50!==_0x1bf0('0x160')){return _0x2fd083(msgResponse(_0x1bf0('0x161'),_0x1bf0('0x93'),_0x1bf0('0x162')));}if(_['isUndefined'](_0x5d16ed[_0x1bf0('0x163')])||_0x5d16ed['phone']===null){return _0x2fd083(msgResponse('originate',_0x1bf0('0x93'),_0x1bf0('0x164')));}var _0x23045e={'XMD-CALLERID':_0x122a30['actions'][_0x3c7244]['getCaller'](),'XMD-AGI':_0x803b50[_0x1bf0('0x130')]?util[_0x1bf0('0x43')](_0x1bf0('0x165'),ipAgi,_0x803b50[_0x1bf0('0x130')]):_0x1bf0('0x166'),'XMD-AGIAFTER':_0x803b50['dialQueueProject2']?util[_0x1bf0('0x43')](_0x1bf0('0x165'),ipAgi,_0x803b50[_0x1bf0('0xca')]):_0x1bf0('0x166'),'XMD-QUEUE':utils[_0x1bf0('0x167')](_0x803b50)?util['format'](_0x1bf0('0x168'),_0x803b50['name'],_0x803b50[_0x1bf0('0x169')]||'',_0x803b50['dialAgiAfterHangupAgent']?'c':'',_0x803b50['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x5d16ed[_0x1bf0('0xe2')],'XMD-CDRTYPE':_0x1bf0('0x5'),'CALLERID(all)':_0x122a30[_0x1bf0('0x1f')][_0x3c7244][_0x1bf0('0x16a')](),'XMD-AMD':_0x803b50[_0x1bf0('0x110')]?_0x1bf0('0x13f'):_0x1bf0('0x166'),'XMD-DESTINATION':_0x1bf0('0x10f')};if(_0x803b50[_0x1bf0('0x110')]){_0x23045e[_0x1bf0('0x16b')]=_0x803b50[_0x1bf0('0x16c')]||0x9c4;_0x23045e[_0x1bf0('0x16d')]=_0x803b50[_0x1bf0('0x16e')]||0x5dc;_0x23045e[_0x1bf0('0x16f')]=_0x803b50[_0x1bf0('0x170')]||0x320;_0x23045e[_0x1bf0('0x171')]=_0x803b50[_0x1bf0('0x172')]||0x1388;_0x23045e['XMD-AMDMINWORDLENGTH']=_0x803b50[_0x1bf0('0x173')]||0x64;_0x23045e[_0x1bf0('0x174')]=_0x803b50[_0x1bf0('0x175')]||0x32;_0x23045e[_0x1bf0('0x176')]=_0x803b50[_0x1bf0('0x177')]||0x3;_0x23045e[_0x1bf0('0x178')]=_0x803b50[_0x1bf0('0x179')]||0x100;_0x23045e[_0x1bf0('0x17a')]=_0x803b50['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x803b50)){_0x23045e['XMD-VOICEQUEUEID']=_0x5d16ed[_0x1bf0('0xe4')];}else{_0x23045e[_0x1bf0('0x17b')]=_0x5d16ed[_0x1bf0('0xe5')];}var _0x1c81a4=utils['setXMDContactVariables'](_0x5d16ed[_0x1bf0('0x17c')]);Object['assign'](_0x23045e,_0x1c81a4);var _0x3b171e=_0x122a30[_0x1bf0('0x85')](_0x803b50[_0x1bf0('0x8b')])?utils['getCallerId'](_0x803b50['Trunk'][_0x1bf0('0x17d')],_0x803b50['dialOriginateCallerIdName'],_0x803b50[_0x1bf0('0x17e')]>0x0?utils['getCallerIdRandom'](_0x803b50[_0x1bf0('0x17f')],_0x803b50[_0x1bf0('0x17e')]):_0x803b50[_0x1bf0('0x17f')]):utils[_0x1bf0('0x180')](_['isNil'](_0x803b50[_0x1bf0('0x8c')])?_0x803b50[_0x1bf0('0x8b')][_0x1bf0('0x17d')]:_0x803b50['TrunkBackup'][_0x1bf0('0x17d')],_0x803b50[_0x1bf0('0x181')],_0x803b50[_0x1bf0('0x17e')]>0x0?utils[_0x1bf0('0x182')](_0x803b50[_0x1bf0('0x17f')],_0x803b50[_0x1bf0('0x17e')]):_0x803b50[_0x1bf0('0x17f')]);if(_0x3b171e){_0x23045e[_0x1bf0('0x183')]=_0x122a30[_0x1bf0('0x1f')][_0x3c7244][_0x1bf0('0x184')]=utils[_0x1bf0('0x185')](_0x3b171e);_0x23045e[_0x1bf0('0x186')]=_0x5d16ed['phone'];}_0x803b50[_0x1bf0('0x187')]=_0x23045e;return ami[_0x1bf0('0x9c')]({'actionid':_0x3c7244,'action':_0x1bf0('0x161'),'channel':_0x122a30[_0x1bf0('0x85')](_0x803b50[_0x1bf0('0x8b')])?util['format'](_0x1bf0('0x188'),_0x803b50[_0x1bf0('0x8b')][_0x1bf0('0x60')],isNotNull(_0x803b50[_0x1bf0('0x189')])?_0x803b50[_0x1bf0('0x189')][_0x1bf0('0x18a')]()||'':'',_0x803b50[_0x1bf0('0x18b')]>0x0?_0x5d16ed[_0x1bf0('0x163')][_0x1bf0('0x18c')](_0x803b50[_0x1bf0('0x18b')]):_0x5d16ed[_0x1bf0('0x163')]):util[_0x1bf0('0x43')](_0x1bf0('0x188'),_[_0x1bf0('0xf4')](_0x803b50[_0x1bf0('0x8c')])?_0x803b50[_0x1bf0('0x8b')][_0x1bf0('0x60')]:_0x803b50[_0x1bf0('0x8c')][_0x1bf0('0x60')],isNotNull(_0x803b50[_0x1bf0('0x189')])?_0x803b50[_0x1bf0('0x189')][_0x1bf0('0x18a')]()||'':'',_0x803b50[_0x1bf0('0x18b')]>0x0?_0x5d16ed[_0x1bf0('0x163')][_0x1bf0('0x18c')](_0x803b50[_0x1bf0('0x18b')]):_0x5d16ed['phone']),'callerid':_0x3b171e,'Exten':_0x1bf0('0x10f'),'Context':_0x1bf0('0x18d'),'Priority':'1','variable':_0x23045e,'timeout':(_0x803b50[_0x1bf0('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c7244})['then'](function(_0x5c90d9){return _0x593e5f(_0x5c90d9);})[_0x1bf0('0xa3')](function(_0x4d5f54){_0x803b50['outboundOriginateFailureCallsDay']+=0x1;var _0x2612e4=new History(_0x122a30[_0x1bf0('0x1f')][_0x3c7244]);logger[_0x1bf0('0x65')](util[_0x1bf0('0x43')](_0x1bf0('0x18f'),JSON[_0x1bf0('0x76')](_0x4d5f54)));_0x2612e4['state']=0xe;_0x2612e4[_0x1bf0('0x70')]=_0x1bf0('0x190');_0x2612e4[_0x1bf0('0x72')]=moment()[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x2612e4[_0x1bf0('0x71')]=_0x2612e4[_0x1bf0('0x72')];hopperUtils[_0x1bf0('0xcc')](_0x2612e4)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x191')));_0x122a30[_0x1bf0('0xce')](_0x2612e4)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x191')))[_0x1bf0('0x17')](function(){delete _0x122a30[_0x1bf0('0x1f')][_0x3c7244];return _0x2fd083(msgResponse(_0x1bf0('0x161'),_0x1bf0('0x84'),_0x1bf0('0x192')));});});});};Dialer['prototype'][_0x1bf0('0x193')]=function(_0x3106fe,_0x5ec5e7,_0x1b7994){var _0x256819=new History(_0x5ec5e7);if(_0x256819[_0x1bf0('0x120')]+_0x256819[_0x1bf0('0x121')]+_0x256819[_0x1bf0('0x194')]+_0x256819[_0x1bf0('0x122')]+_0x256819[_0x1bf0('0xdd')]+_0x256819[_0x1bf0('0xed')]+_0x256819[_0x1bf0('0x11e')]+_0x256819['countagentrejectretry']>=_0x1b7994['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3106fe){case 0x3:if(_0x256819[_0x1bf0('0x194')]>=_0x1b7994['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countnoanswerretry':_0x256819[_0x1bf0('0x194')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x195')],_0x1bf0('0xe1'))['format'](_0x1bf0('0xd1')),'ContactId':_0x256819['ContactId'],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x196')));break;case 0x5:if(_0x256819[_0x1bf0('0x120')]>=_0x1b7994[_0x1bf0('0x197')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countbusyretry':_0x256819[_0x1bf0('0x120')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x198')],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819['ListId'],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x256819[_0x1bf0('0x121')]>=_0x1b7994[_0x1bf0('0x199')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countcongestionretry':_0x256819[_0x1bf0('0x121')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994['dialCongestionRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256819['ContactId'],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x19a')));break;case 0x0:if(_0x256819[_0x1bf0('0x122')]>=_0x1b7994[_0x1bf0('0x19b')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x256819[_0x1bf0('0x122')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x19c')],_0x1bf0('0xe1'))['format'](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x19d')));}break;case 0xa:if(_0x256819[_0x1bf0('0xdd')]>=_0x1b7994[_0x1bf0('0xde')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countdropretry':_0x256819[_0x1bf0('0xdd')]+=0x1,'scheduledat':moment()['add'](_0x1b7994[_0x1bf0('0xd9')],_0x1bf0('0xe1'))[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0xe6')));break;case 0xb:if(_0x256819['countabandonedretry']>=_0x1b7994[_0x1bf0('0xef')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countabandonedretry':_0x256819[_0x1bf0('0xed')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x19e')],'minutes')[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0xf0')));break;case 0x13:if(_0x256819['countmachineretry']>=_0x1b7994[_0x1bf0('0x126')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x256819['countmachineretry']+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994['dialMachineRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x12e')));break;case 0x14:if(_0x256819[_0x1bf0('0x123')]>=_0x1b7994[_0x1bf0('0x19f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x256819[_0x1bf0('0x123')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994['dialAgentRejectRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1a0')));break;default:return!![];}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x10a')]=function(_0x358031,_0x29b214,_0x2a2864){var _0x478940=this;var _0x24ced1=new History(_0x358031);var _0x2cc442=![];var _0x3a1af4;var _0x26dd2f;return new Promise(function(_0x28881b,_0x2b8360){if(_[_0x1bf0('0x3e')](_0x29b214)&&typeof _0x29b214!==_0x1bf0('0x160')){return _0x2b8360(msgResponse('[callProgressDetecting]',_0x1bf0('0x93'),_0x1bf0('0x1a1')));}if(_[_0x1bf0('0x3e')](_0x2a2864)&&typeof _0x2a2864!=='object'){return _0x2b8360(msgResponse(_0x1bf0('0x1a2'),'Failure',_0x1bf0('0x1a3')));}hopperUtils['verifyAdditionalPhones'](_0x24ced1,_0x2a2864[_0x1bf0('0xc8')],_0x29b214)['then'](function(_0x1d83a1){if(_0x1d83a1[_0x1bf0('0xdc')]==0x1)_0x2cc442=!![];switch(_0x2a2864[_0x1bf0('0xc8')]){case'0':_0x29b214[_0x1bf0('0x1a4')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x0;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1a5');_0x24ced1[_0x1bf0('0x122')]+=0x1;_0x24ced1['countglobal']+=0x1;ami[_0x1bf0('0x116')](_0x1bf0('0x1a6'),ut['buildObj'](_0x358031,_0x1bf0('0x1a7')));_0x3a1af4=_0x29b214['dialNoSuchNumberRetryFrequency'];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils[_0x1bf0('0xcc')](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x11f')));if(_0x478940['checkRetriveMax'](0x0,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x122')]>=_0x29b214[_0x1bf0('0x19b')]){_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1a8'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1a8'));}}break;case'3':_0x29b214[_0x1bf0('0x1a9')]+=0x1;_0x24ced1['state']=0x3;_0x24ced1['statedesc']=_0x1bf0('0x1aa');_0x24ced1[_0x1bf0('0x194')]+=0x1;_0x24ced1['countglobal']+=0x1;var _0x4fe4a8=ut[_0x1bf0('0x1ab')](_0x358031,_0x29b214);ami[_0x1bf0('0x116')](_0x1bf0('0x1ac'),_0x4fe4a8);_0x3a1af4=_0x29b214[_0x1bf0('0x195')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils['createHistory'](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1ad')));if(_0x478940[_0x1bf0('0x193')](0x3,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x194')]>=_0x29b214[_0x1bf0('0x1ae')]){_0x478940['createStateFinal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1af'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1af'));}}break;case'5':_0x29b214[_0x1bf0('0x1b0')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x5;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1b1');_0x24ced1[_0x1bf0('0x120')]+=0x1;_0x24ced1['countglobal']+=0x1;ami[_0x1bf0('0x116')](_0x1bf0('0x1b2'),ut['buildObj'](_0x358031,_0x1bf0('0x1b3')));_0x3a1af4=_0x29b214[_0x1bf0('0x198')];_0x26dd2f=_0x29b214['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1b4')));if(_0x478940[_0x1bf0('0x193')](0x5,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x120')]>=_0x29b214[_0x1bf0('0x197')]){_0x478940['createStateFinal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1b5'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,'reason\x205\x20busy');}}break;case'8':_0x29b214['outboundCongestionCallsDay']+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x8;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1b6');_0x24ced1[_0x1bf0('0x121')]+=0x1;_0x24ced1[_0x1bf0('0xee')]+=0x1;_0x3a1af4=_0x29b214[_0x1bf0('0x1b7')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];ami[_0x1bf0('0x116')](_0x1bf0('0x1b8'),ut['buildObj'](_0x358031,'congestion'));hopperUtils[_0x1bf0('0xcc')](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1b9')));if(_0x478940[_0x1bf0('0x193')](0x8,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1['countcongestionretry']>=_0x29b214[_0x1bf0('0x199')]){_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1ba'));}else{_0x478940['stateGlobal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1ba'));}}break;case'11':_0x29b214[_0x1bf0('0x1bb')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0xb;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0xeb');_0x24ced1[_0x1bf0('0xed')]+=0x1;_0x24ced1[_0x1bf0('0xee')]+=0x1;_0x3a1af4=_0x29b214[_0x1bf0('0x19e')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils[_0x1bf0('0xcc')](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1bc')));if(_0x478940[_0x1bf0('0x193')](0xb,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1['countabandonedretry']>=_0x29b214[_0x1bf0('0xef')]){_0x478940['createStateFinal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1bd'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1bd'));}}break;case'20':_0x29b214[_0x1bf0('0x1be')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x14;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1bf');_0x24ced1['countagentrejectretry']+=0x1;_0x24ced1[_0x1bf0('0xee')]+=0x1;_0x3a1af4=_0x29b214[_0x1bf0('0x1c0')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];ami[_0x1bf0('0x116')](_0x1bf0('0x1c1'),ut[_0x1bf0('0x118')](_0x358031,'agentreject'));hopperUtils['createHistory'](_0x24ced1)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x478940['checkRetriveMax'](0x14,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x123')]>=_0x29b214[_0x1bf0('0x19f')]){_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,'reason\x2020\x20agentreject');}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1c2'));}}break;default:_0x29b214[_0x1bf0('0x136')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0xc;_0x24ced1[_0x1bf0('0x70')]=_0x2a2864['reason'];_0x3a1af4=_0x29b214[_0x1bf0('0x1c0')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils[_0x1bf0('0xcc')](_0x24ced1)['catch'](loggerCatch(_0x1bf0('0x1c3')));if(_0x478940[_0x1bf0('0x193')](_0x2a2864['reason'],_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x120')]+_0x24ced1['countcongestionretry']+_0x24ced1['countnoanswerretry']+_0x24ced1[_0x1bf0('0x122')]+_0x24ced1[_0x1bf0('0xdd')]+_0x24ced1['countabandonedretry']+_0x24ced1[_0x1bf0('0x11e')]+_0x24ced1[_0x1bf0('0x123')]>=_0x29b214['dialGlobalMaxRetry']){_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x2a2864[_0x1bf0('0xc8')]);}else{_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,_0x2a2864[_0x1bf0('0xc8')]);}}}})[_0x1bf0('0x9e')](function(){if(_0x2cc442){hopperUtils[_0x1bf0('0xe9')](_0x24ced1,_0x3a1af4,_0x26dd2f)[_0x1bf0('0x9e')](function(){return _0x28881b(0x1);});}});});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x125')]=function(_0x4866cb,_0x3e4b1e,_0x215e2e,_0x7b0b56){var _0x427517=new Final(_0x4866cb);_0x427517['state']=0xf;_0x427517[_0x1bf0('0x70')]=_0x1bf0('0x1c4');this[_0x1bf0('0x12d')](_0x427517,_0x3e4b1e,_0x215e2e,_0x7b0b56);};Dialer[_0x1bf0('0x15')]['createStateFinal']=function(_0x3a08d3,_0x26a232,_0x12da40,_0x59be0b){hopperUtils[_0x1bf0('0xce')](_0x3a08d3)[_0x1bf0('0x9e')](function(){return _0x26a232(msgResponse(_0x1bf0('0x1a2'),_0x1bf0('0x109'),_0x59be0b));})['catch'](function(){return _0x12da40(msgResponse(_0x1bf0('0x1c5'),_0x1bf0('0x93'),_0x1bf0('0x1c6')));});};Dialer[_0x1bf0('0x15')][_0x1bf0('0xb4')]=function(_0x5ae8ff){var _0x573564=_0x5ae8ff[_0x1bf0('0x1c7')]/0x64;var _0x55d237=_0x5ae8ff[_0x1bf0('0xd5')]/(_0x5ae8ff[_0x1bf0('0xd5')]+_0x5ae8ff[_0x1bf0('0xc7')]);var _0x332e27=Math['round'](_0x5ae8ff[_0x1bf0('0x1c8')]*(_0x5ae8ff[_0x1bf0('0x1c9')]/0x64));var _0x328016=Math[_0x1bf0('0x1ca')](_0x5ae8ff[_0x1bf0('0x1c8')]*(_0x5ae8ff[_0x1bf0('0x1cb')]/0x64));var _0x4823b5=_0x5ae8ff['available']+_0x5ae8ff[_0x1bf0('0x13d')];var _0x4e979e=Math[_0x1bf0('0x1cc')](_0x5ae8ff['erlangCalls']*_0x5ae8ff[_0x1bf0('0x5a')]*_0x5ae8ff[_0x1bf0('0x1cd')]*_0x5ae8ff['predictiveIntervalMultiplicativeFactor']);if(_[_0x1bf0('0x3e')](_0x5ae8ff[_0x1bf0('0x24')])){if(!_[_0x1bf0('0x3e')](_0x5ae8ff['startPredictive'])){_0x5ae8ff[_0x1bf0('0x23')]=undefined;loggerPredictive[_0x1bf0('0x65')]('[startMethodPredictive][StartProgressive]',_0x1bf0('0x1ce'));}if(!_['isUndefined'](_0x5ae8ff[_0x1bf0('0x63')])){loggerPredictive['error'](_0x1bf0('0x1cf'),_0x1bf0('0x1d0'));clearInterval(_0x5ae8ff[_0x1bf0('0x63')]);_0x5ae8ff[_0x1bf0('0x63')]=undefined;}_0x5ae8ff[_0x1bf0('0x24')]=moment()[_0x1bf0('0x43')](_0x1bf0('0xd1'));loggerPredictive['info'](_0x5ae8ff[_0x1bf0('0x60')],'collection\x20data\x20in\x20progressive\x20at',_0x5ae8ff[_0x1bf0('0x24')]);this[_0x1bf0('0xb8')](_0x5ae8ff,0x1);}else if(ifInterval(_0x5ae8ff['dialPredictiveInterval'],_0x5ae8ff['startProgressive'])){this['handlePower'](_0x5ae8ff,0x1);loggerPredictiveCalls[_0x1bf0('0x46')](_0x1bf0('0x1d1'),_0x5ae8ff[_0x1bf0('0x24')],_0x5ae8ff[_0x1bf0('0x60')]);_0x5ae8ff[_0x1bf0('0x56')]=0x0;_0x5ae8ff[_0x1bf0('0x1d2')]=0x0;}else if(_0x573564<_0x55d237&&_0x5ae8ff[_0x1bf0('0x1d3')]==='dropRate'){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x1d4'),'Dropped\x20calls\x20day',_0x55d237,_0x1bf0('0x24'),_0x5ae8ff['name']);}else if(_0x4e979e<_0x5ae8ff['predictiveIntervalErlangCallsDroppedCalls']&&_0x5ae8ff[_0x1bf0('0x1d3')]===_0x1bf0('0x1d5')){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive['info'](_0x1bf0('0x1d6'),_0x1bf0('0x1d7'),_0x4e979e,_0x1bf0('0x1d8'),_0x5ae8ff['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5ae8ff['name']);}else if(!ifInterval(_0x5ae8ff['dialPredictiveInterval'],_0x5ae8ff[_0x1bf0('0x24')])&&_[_0x1bf0('0x3e')](_0x5ae8ff[_0x1bf0('0x23')])&&!_[_0x1bf0('0x3e')](_0x5ae8ff[_0x1bf0('0x24')])){_0x5ae8ff[_0x1bf0('0x23')]=moment()['format'](_0x1bf0('0xd1'));loggerPredictive['info'](_0x5ae8ff['name'],_0x1bf0('0x1d9'),_0x5ae8ff[_0x1bf0('0x23')]);hopperUtils[_0x1bf0('0x1da')](_0x5ae8ff[_0x1bf0('0x1db')])[_0x1bf0('0x9e')](this['getDataPredictive'](_0x5ae8ff))[_0x1bf0('0x9e')](mergeDataErlangB(_0x5ae8ff))[_0x1bf0('0x9e')](this[_0x1bf0('0x1dc')](_0x5ae8ff))[_0x1bf0('0xa3')](loggerCatchPredictive(_0x1bf0('0x1dd'),_0x5ae8ff));}else if(!ifInterval(_0x5ae8ff[_0x1bf0('0x1db')],_0x5ae8ff['startPredictive'])){_0x5ae8ff[_0x1bf0('0x1d2')]=0x0;_0x5ae8ff[_0x1bf0('0x23')]=moment()[_0x1bf0('0x43')](_0x1bf0('0xd1'));loggerPredictive['info'](_0x5ae8ff['name'],'recalculate\x20predictive\x20at',_0x5ae8ff[_0x1bf0('0x23')]);clearInterval(_0x5ae8ff[_0x1bf0('0x63')]);_0x5ae8ff[_0x1bf0('0x63')]=undefined;hopperUtils['avgHandleTime'](_0x5ae8ff['dialPredictiveInterval'])[_0x1bf0('0x9e')](this[_0x1bf0('0x1de')](_0x5ae8ff))['then'](mergeDataErlangB(_0x5ae8ff))[_0x1bf0('0x9e')](this['startMethodPredictive'](_0x5ae8ff))[_0x1bf0('0xa3')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5ae8ff));}else if(_0x5ae8ff[_0x1bf0('0x1c8')]&&_0x4823b5<_0x5ae8ff[_0x1bf0('0x1c8')]-_0x328016){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive[_0x1bf0('0x46')](_0x5ae8ff[_0x1bf0('0x60')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4823b5,')\x20are\x20less\x20than\x20threshold\x20(',_0x5ae8ff[_0x1bf0('0x1c8')],'-',_0x328016,'=',_0x5ae8ff['predictiveIntervalAvailable']-_0x328016,')');}else if(_0x5ae8ff[_0x1bf0('0x1c8')]&&_0x4823b5>_0x5ae8ff[_0x1bf0('0x1c8')]+_0x332e27){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive[_0x1bf0('0x46')](_0x5ae8ff['name'],_0x1bf0('0x1df'),_0x4823b5,_0x1bf0('0x1e0'),_0x5ae8ff['predictiveIntervalAvailable'],'+',_0x332e27,'=',_0x5ae8ff[_0x1bf0('0x1c8')]+_0x332e27,')');}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x1de')]=function(_0x172b30){var _0x19435d=this;return function(_0x10663c){return new Promise(function(_0x37d901,_0x1f3d0a){_[_0x1bf0('0x5e')](_0x172b30,_0x10663c[0x0]);if(checkGetDataPredictive(_0x10663c[0x0])){var _0x4b1083=_0x172b30[_0x1bf0('0x1c8')]=_0x172b30[_0x1bf0('0x13d')]+_0x172b30[_0x1bf0('0x13c')];var _0x4bdb8d=_0x172b30[_0x1bf0('0x1db')]*0x3c;var _0x5a1a37=_0x10663c[0x0][_0x1bf0('0x4f')]+_0x10663c[0x0][_0x1bf0('0x51')];var _0x5e1dfb=(_0x10663c[0x0][_0x1bf0('0x1e1')]+_0x10663c[0x0][_0x1bf0('0xd4')]+_0x10663c[0x0][_0x1bf0('0x4c')])/_0x10663c[0x0][_0x1bf0('0x49')];_0x172b30['predictiveIntervalHitRate']=_0x5e1dfb>0x0?_0x5e1dfb:0x1;switch(_0x172b30[_0x1bf0('0x1d3')]){case'dropRate':var _0x18ce9e=_0x172b30[_0x1bf0('0x1c7')]/0x64;return _0x19435d[_0x1bf0('0x1e2')](_0x4b1083,_0x4bdb8d,_0x5a1a37,_0x5e1dfb,_0x18ce9e)[_0x1bf0('0x9e')](function(_0x380cdb){return _0x37d901(_0x380cdb);});case _0x1bf0('0x1e3'):var _0x4f21fc=_0x172b30[_0x1bf0('0x1c7')]/0x64;return _0x19435d[_0x1bf0('0x1e4')](_0x4b1083,_0x4bdb8d,_0x5a1a37,_0x5e1dfb,_0x4f21fc)[_0x1bf0('0x9e')](function(_0x284612){return _0x37d901(_0x284612);});default:return _0x1f3d0a(msgResponse('[getDataPredictive]',_0x1bf0('0x93'),_0x1bf0('0x1e5')));}}else{return _0x1f3d0a(msgResponse('[getDataPredictive]',_0x1bf0('0x93'),'check\x20failure'));}});};};Dialer[_0x1bf0('0x15')]['getDataPredictiveOld']=function(_0x3a1654){var _0xecb335=this;return function(_0x4577a0){return new Promise(function(_0xd83af8,_0xe45238){_[_0x1bf0('0x5e')](_0x3a1654,_0x4577a0[0x0]);if(checkGetDataPredictive(_0x4577a0[0x0])){loggerPredictive[_0x1bf0('0x46')](JSON['stringify'](_0x4577a0[0x0]));if(_0x3a1654[_0x1bf0('0x1d3')]===_0x1bf0('0x1d5')){return _0xecb335[_0x1bf0('0x1e6')](_0x3a1654['id'])[_0x1bf0('0x9e')](function(_0x1fdf1a){var _0x549b9d=_0x3a1654[_0x1bf0('0x1e7')]-_0x1fdf1a[0x0]['outboundQueuePauses'];var _0x366f1e=_0x3a1654[_0x1bf0('0x1db')]*0x3c;var _0x1d9725=_0x4577a0[0x0][_0x1bf0('0x4f')]+_0x4577a0[0x0]['predictiveIntervalAvgHoldtime'];var _0x5b3a76=(_0x4577a0[0x0][_0x1bf0('0x1e1')]+_0x4577a0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4577a0[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4577a0[0x0]['predictiveIntervalTotalCalls'];var _0x47ebbf=_0x3a1654[_0x1bf0('0x1c7')]/0x64;_0x3a1654[_0x1bf0('0x1e8')]=_0x1fdf1a[0x0][_0x1bf0('0x1e9')]||0x0;_0x3a1654[_0x1bf0('0x1cd')]=_0x5b3a76>0x0?_0x5b3a76:0x1;return _0xecb335[_0x1bf0('0x1e2')](_0x549b9d,_0x366f1e,_0x1d9725,_0x5b3a76,_0x47ebbf);})[_0x1bf0('0x9e')](function(_0x61cdc5){return _0xd83af8(_0x61cdc5);})[_0x1bf0('0xa3')](function(_0x45ab9e){return _0xe45238(msgResponse('[CatchErlangB]',_0x1bf0('0x93'),JSON['stringify'](_0x45ab9e)));});}if(_0x3a1654['dialPredictiveOptimization']==='agentBusyFactor'){return _0xecb335[_0x1bf0('0x1e6')](_0x3a1654['id'])[_0x1bf0('0x9e')](function(_0x5d9241){var _0x249a77=_0x3a1654['loggedIn']-_0x5d9241[0x0]['outboundQueuePauses'];var _0x27c6c1=_0x3a1654[_0x1bf0('0x1db')]*0x3c;var _0x3c73bd=_0x4577a0[0x0][_0x1bf0('0x4f')]+_0x4577a0[0x0]['predictiveIntervalAvgHoldtime'];var _0x42d629=(_0x4577a0[0x0][_0x1bf0('0x1e1')]+_0x4577a0[0x0][_0x1bf0('0xd4')]+_0x4577a0[0x0][_0x1bf0('0x4c')])/_0x4577a0[0x0][_0x1bf0('0x49')];var _0x4b9fd6=_0x3a1654['dialPredictiveOptimizationPercentage']/0x64;_0x3a1654[_0x1bf0('0x1e8')]=_0x5d9241[0x0][_0x1bf0('0x1e9')]||0x0;_0x3a1654[_0x1bf0('0x1cd')]=_0x42d629>0x0?_0x42d629:0x1;return _0xecb335[_0x1bf0('0x1e4')](_0x249a77,_0x27c6c1,_0x3c73bd,_0x42d629,_0x4b9fd6);})[_0x1bf0('0x9e')](function(_0x42f447){return _0xd83af8(_0x42f447);})['catch'](function(_0x1b2c8d){return _0xe45238(msgResponse(_0x1bf0('0x1ea'),'Failure',JSON[_0x1bf0('0x76')](_0x1b2c8d)));});}}else{return _0xe45238(msgResponse(_0x1bf0('0x1eb'),'Failure',_0x1bf0('0x1ec')));}});};};Dialer[_0x1bf0('0x15')]['startMethodPredictive']=function(_0x3eea47){var _0x224469=this;return function(){var _0x539933=0x0;var _0x12c742=Math[_0x1bf0('0x1cc')](_0x3eea47[_0x1bf0('0x58')]*0x3e8);if(_0x12c742>0x0){_0x12c742=_0x12c742<0x64?0x64:_0x12c742;loggerPredictive[_0x1bf0('0x46')](_0x3eea47['name'],_0x1bf0('0x1ed'),_0x12c742,_0x1bf0('0x1ee'));_0x3eea47['handlePredictive']=setInterval(function(){_0x224469['handlePredictive'](_0x3eea47);loggerPredictiveCalls[_0x1bf0('0x46')](_0x1bf0('0x1ef'),_0x539933+=0x1);},_0x12c742);}else{loggerPredictive[_0x1bf0('0x46')](_0x3eea47[_0x1bf0('0x60')],_0x1bf0('0x1f0'));}};};Dialer[_0x1bf0('0x15')]['checkContactBlack']=function(_0x27ec72,_0x2cebf7){var _0x4549df=this;return function(_0x27c794){if(_[_0x1bf0('0x45')](_0x27c794)){if(_['isNil'](_0x2cebf7[_0x1bf0('0x15a')])||!_0x2cebf7[_0x1bf0('0x1f1')]){if(_0x27ec72[_0x1bf0('0xb3')]==='booked'){_0x27ec72['queueStatusComplete']=_['isUndefined'](_0x27ec72['queueStatusComplete'])?!![]:_0x27ec72[_0x1bf0('0x74')];var _0x405a6d=uuid['v4']();_0x4549df[_0x1bf0('0x1f')][_0x405a6d]=new Action(_0x27ec72,_0x2cebf7,_0x405a6d);loggerBooked['info'](_0x1bf0('0x1f2'),_0x405a6d,_0x1bf0('0x1f3'),JSON['stringify'](_0x27ec72[_0x1bf0('0x74')]),_0x1bf0('0x1f4'),_0x27ec72[_0x1bf0('0x60')]);if(_0x27ec72[_0x1bf0('0x74')]){_0x27ec72['queueStatusComplete']=![];_0x4549df[_0x1bf0('0x26')][_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xc1')]]=[];ami[_0x1bf0('0x9c')]({'actionid':_0x405a6d,'action':_0x1bf0('0x1f5'),'queue':_0x27ec72['name']})[_0x1bf0('0xa3')](function(){_0x4549df['updateOriginated'](_0x27ec72);hopperUtils[_0x1bf0('0x104')]({'active':![],'ContactId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe2')],'ListId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe3')],'VoiceQueueId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d]['VoiceQueueId']||undefined,'CampaignId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0x1f6')));delete _0x4549df[_0x1bf0('0x1f')][_0x405a6d];});}else{loggerBooked[_0x1bf0('0x46')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x27ec72[_0x1bf0('0x74')]),_0x1bf0('0x1f4'),_0x27ec72[_0x1bf0('0x60')]);_0x4549df[_0x1bf0('0xc4')](_0x27ec72);hopperUtils[_0x1bf0('0x104')]({'active':![],'ContactId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe2')],'ListId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe3')],'VoiceQueueId':_0x4549df['actions'][_0x405a6d][_0x1bf0('0xe4')]||undefined,'CampaignId':_0x4549df['actions'][_0x405a6d][_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1f6')));delete _0x4549df[_0x1bf0('0x1f')][_0x405a6d];}}else{return _0x4549df['actionOriginate'](_0x27ec72,_0x2cebf7);}}else{if(utils['getSeconds'](undefined,_0x2cebf7[_0x1bf0('0x1f7')])<_0x27ec72[_0x1bf0('0x1f8')]*0x3c){if(_0x2cebf7[_0x1bf0('0x14d')]&&!_0x2cebf7['Agent'][_0x1bf0('0x1f9')]){_0x4549df[_0x1bf0('0xf9')][_0x1bf0('0xfa')](_0x2cebf7['id'])[_0x1bf0('0x17')](function(){_0x4549df['updateOriginated'](_0x27ec72);});}else{hopperUtils[_0x1bf0('0x1fa')]({'active':![]},_0x2cebf7['id'],0x1)[_0x1bf0('0x17')](function(){_0x4549df[_0x1bf0('0xc4')](_0x27ec72);});}}else{_0x27ec72[_0x1bf0('0x1fb')]+=0x1;_0x4549df[_0x1bf0('0xc4')](_0x27ec72);if(_0x27ec72['dialRecallInQueue']){hopperUtils[_0x1bf0('0x104')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cebf7['ContactId'],'ListId':_0x2cebf7[_0x1bf0('0xe3')],'VoiceQueueId':_0x2cebf7['VoiceQueueId']||undefined,'CampaignId':_0x2cebf7['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1fc')));hopperUtils[_0x1bf0('0xcc')](createObjHistory(_0x27ec72,_0x2cebf7,utils[_0x1bf0('0x6a')][_0x1bf0('0x1fd')],0x17,_0x1bf0('0x1fe')))['catch'](loggerCatch(_0x1bf0('0x1ff')));}else{_0x4549df[_0x1bf0('0x12a')](createObjHistory(_0x27ec72,_0x2cebf7,utils[_0x1bf0('0x6a')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),_0x1bf0('0x200'),'[Originate][HistoryRecallClose]');}}}}else{_0x27ec72[_0x1bf0('0x201')]+=0x1;_0x4549df[_0x1bf0('0x12a')](createObjHistory(_0x27ec72,_0x2cebf7,utils[_0x1bf0('0x6a')]['BLACKLIST'],0xd,'Blacklist'),_0x1bf0('0x202'),_0x1bf0('0x203'));throw _0x1bf0('0x204');}};};Dialer['prototype'][_0x1bf0('0x15e')]=function(_0x1bef7e){var _0x4e1e36=this;var _0x33638c=_0x1bef7e[_0x1bf0('0x205')]-_0x1bef7e[_0x1bf0('0x80')];emitCampaignSummary(_0x1bef7e);if(_0x33638c>0x0&&_0x1bef7e['temp']==0x0){if(_0x33638c>this[_0x1bf0('0x1d')]){_0x33638c=this['maxNumberOriginate'];}_0x1bef7e[_0x1bf0('0x68')]=0x1;hopperUtils['getContactDialerIvr'](_0x1bef7e,_0x33638c)[_0x1bf0('0x9e')](function(_0x57be25){_0x1bef7e[_0x1bf0('0x68')]=0x0;if(_0x57be25){if(!utils[_0x1bf0('0x206')](_0x57be25)){_0x1bef7e[_0x1bf0('0x6e')]=utils['CAMPAIGN_STATUS'][_0x1bf0('0x207')];logger[_0x1bf0('0x46')](_0x1bf0('0x208')+_0x1bef7e[_0x1bf0('0x60')]);}else{_0x1bef7e['originated']+=_0x57be25[_0x1bf0('0x9a')];_0x1bef7e[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['RUNNING'];for(var _0x3276a9=0x0;_0x3276a9<_0x57be25[_0x1bf0('0x9a')];_0x3276a9+=0x1){_0x1bef7e[_0x1bf0('0x209')]+=0x1;if(_[_0x1bf0('0xf4')](_0x57be25[_0x3276a9])||_[_0x1bf0('0xf4')](_0x57be25[_0x3276a9]['Contact'])||_[_0x1bf0('0xf4')](_0x57be25[_0x3276a9]['phone'])){_0x4e1e36['emptyContact'](_0x1bf0('0x20a'),_0x1bef7e,_0x57be25[_0x3276a9]);}else{hopperUtils[_0x1bf0('0x20b')](_[_0x1bf0('0x77')](_0x57be25[_0x3276a9],[_0x1bf0('0xe5'),_0x1bf0('0x163')]))['then'](_0x4e1e36[_0x1bf0('0x20c')](_0x1bef7e,_0x57be25[_0x3276a9]))[_0x1bf0('0xa3')](_0x4e1e36[_0x1bf0('0x157')](_0x1bf0('0x20d'),_0x1bef7e));}}}}})['catch'](loggerGetContactDialer(_0x1bf0('0x20e'),_0x1bef7e,_0x33638c));}};Dialer[_0x1bf0('0x15')][_0x1bf0('0xb8')]=function(_0x9449cc,_0x1f6403){var _0x38e4c1=this;var _0x35a6ef=[];if(_0x1f6403<0x1||_0x9449cc[_0x1bf0('0xb3')]===_0x1bf0('0x6')){_0x1f6403=0x1;}var _0x5ac4fb=Math[_0x1bf0('0x1cc')](_0x9449cc[_0x1bf0('0x13c')]*_0x1f6403)-_0x9449cc['originated'];if(_0x9449cc[_0x1bf0('0x20f')]>0x0){var _0x41e4b2=_0x9449cc['dialLimitQueue']-_0x9449cc[_0x1bf0('0x80')]-_0x9449cc[_0x1bf0('0x13d')]-_0x9449cc[_0x1bf0('0x13e')];if(_0x5ac4fb>_0x41e4b2){_0x5ac4fb=_0x41e4b2;}}if(_0x5ac4fb>0x0&&_0x9449cc['temp']==0x0){if(_0x9449cc[_0x1bf0('0xb3')]===_0x1bf0('0x6')){_0x5ac4fb=0x1;}if(_0x5ac4fb>this['maxNumberOriginate']){_0x5ac4fb=this[_0x1bf0('0x1d')];}for(var _0x218b56 in this['agents']){if(typeof this['agents'][_0x218b56]!==_0x1bf0('0xac')){if(this[_0x1bf0('0x1b')][_0x218b56][_0x1bf0('0xd6')]===_0x1bf0('0x210')&&this[_0x1bf0('0x1b')][_0x218b56][_0x1bf0('0x87')]===_0x1bf0('0x14a')){_0x35a6ef['push'](this[_0x1bf0('0x1b')][_0x218b56]['id']);}}}_0x9449cc[_0x1bf0('0x68')]=0x1;hopperUtils['getContactDialer'](_0x9449cc,_0x35a6ef,_0x5ac4fb)[_0x1bf0('0x9e')](function(_0x5c54e6){_0x9449cc['temp']=0x0;if(_0x5c54e6){if(!utils[_0x1bf0('0x206')](_0x5c54e6)){hopperUtils['countReScheduled'](_0x9449cc)['then'](sendMessageReschedule(_0x9449cc))['catch'](loggerCatch(_0x1bf0('0x211')));}else{_0x9449cc[_0x1bf0('0x80')]+=_0x5c54e6[_0x1bf0('0x9a')];_0x9449cc[_0x1bf0('0x6e')]=_0x9449cc[_0x1bf0('0xb3')]==='booked'?utils[_0x1bf0('0x6a')][_0x1bf0('0x13f')]:utils['CAMPAIGN_STATUS'][_0x1bf0('0x212')];for(var _0xdda057=0x0;_0xdda057<_0x5c54e6[_0x1bf0('0x9a')];_0xdda057+=0x1){if(_[_0x1bf0('0xf4')](_0x5c54e6[_0xdda057])||_[_0x1bf0('0xf4')](_0x5c54e6[_0xdda057]['Contact'])||_[_0x1bf0('0xf4')](_0x5c54e6[_0xdda057]['phone'])){_0x38e4c1[_0x1bf0('0x158')](_0x1bf0('0x20a'),_0x9449cc,_0x5c54e6[_0xdda057]);}else{hopperUtils[_0x1bf0('0x213')](_[_0x1bf0('0x77')](_0x5c54e6[_0xdda057],[_0x1bf0('0xe4'),_0x1bf0('0x163')]))[_0x1bf0('0x9e')](_0x38e4c1[_0x1bf0('0x20c')](_0x9449cc,_0x5c54e6[_0xdda057]))[_0x1bf0('0xa3')](_0x38e4c1['loggerHandler']('[actionOriginate]\x20',_0x9449cc));}}}}})[_0x1bf0('0xa3')](loggerGetContactDialer(_0x1bf0('0x214'),_0x9449cc,_0x5ac4fb));}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x63')]=function(_0x41d412){if(_0x41d412['dialLimitQueue']>0x0){var _0x498250=_0x41d412[_0x1bf0('0x20f')]-_0x41d412[_0x1bf0('0x80')]-_0x41d412[_0x1bf0('0x13d')];if(_0x498250>0x0&&_0x41d412[_0x1bf0('0x68')]==0x0){this['tryOriginatePredictive'](_0x41d412);}else{loggerPredictiveCalls[_0x1bf0('0x46')]('[handlePredictive][limitChannel]');}}else{this[_0x1bf0('0x215')](_0x41d412);}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x215')]=function(_0x3010e0){var _0xb08067=this;var _0x7ac7aa=[];_0x3010e0['originated']+=0x1;for(var _0x397286 in this[_0x1bf0('0x1b')]){if(typeof this[_0x1bf0('0x1b')][_0x397286]!==_0x1bf0('0xac')){if(this['agents'][_0x397286]['state']===_0x1bf0('0x210')&&this['agents'][_0x397286][_0x1bf0('0x87')]===_0x1bf0('0x14a')){_0x7ac7aa[_0x1bf0('0x9b')](this[_0x1bf0('0x1b')][_0x397286]['id']);}}}_0x3010e0[_0x1bf0('0x68')]=0x1;return this[_0x1bf0('0x216')](_0x3010e0['id'],_0x7ac7aa,0x1,_0x3010e0[_0x1bf0('0x217')],_0x3010e0)[_0x1bf0('0x9e')](function(_0x56835f){_0x3010e0[_0x1bf0('0x68')]=0x1;if(_0x56835f){if(!utils[_0x1bf0('0x206')](_0x56835f)){utils[_0x1bf0('0x67')](_0x3010e0,0x1,0x0);return hopperUtils['countReScheduled'](_0x3010e0)[_0x1bf0('0x9e')](sendMessageReschedule(_0x3010e0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3010e0[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['RUNNING'];if(_['isNil'](_0x56835f[0x0])||_[_0x1bf0('0xf4')](_0x56835f[0x0][_0x1bf0('0x17c')])||_['isNil'](_0x56835f[0x0]['phone'])){_0xb08067[_0x1bf0('0x158')]('[actionOriginate]\x20',_0x3010e0,_0x56835f[0x0]);}else{return hopperUtils[_0x1bf0('0x213')](_[_0x1bf0('0x77')](_0x56835f[0x0],['VoiceQueueId',_0x1bf0('0x163')]))[_0x1bf0('0x9e')](_0xb08067[_0x1bf0('0x20c')](_0x3010e0,_0x56835f[0x0]))['catch'](_0xb08067[_0x1bf0('0x157')]('[actionOriginatePredictive]\x20',_0x3010e0));}}}})[_0x1bf0('0xa3')](loggerGetContactDialer(_0x1bf0('0x218'),_0x3010e0,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x56730a,_0x20b283,_0x569643,_0x485655,_0x3a9e8e,_0x4afcba){loggerPredictive['info'](_0x1bf0('0x219'));loggerPredictive['info'](_0x1bf0('0x21a'),_0x56730a);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21b'),_0x20b283);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21c'),_0x569643);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21d'),_0x485655);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21e'),_0x3a9e8e);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x5d'));return new Promise(function(_0x376743,_0x2cb320){if(_0x56730a<=0x0||isNaN(_0x56730a)){return _0x2cb320(msgResponse(_0x1bf0('0x21f'),_0x1bf0('0x84'),_0x1bf0('0x220')+_0x56730a));}if(_0x569643<=0x0||isNaN(_0x569643)){return _0x2cb320(msgResponse(_0x1bf0('0x21f'),_0x1bf0('0x84'),_0x1bf0('0x221')+_0x569643));}if(_0x485655<=0x0||isNaN(_0x485655)){return _0x2cb320(msgResponse('[abandonmentRate]',_0x1bf0('0x84'),_0x1bf0('0x222')+_0x485655));}if(_0x20b283<=0x0||isNaN(_0x20b283)){return _0x2cb320(msgResponse('[abandonmentRate]',_0x1bf0('0x84'),'interval\x20=\x20'+_0x20b283));}if(_0x3a9e8e<=0x0||isNaN(_0x3a9e8e)){return _0x2cb320(msgResponse(_0x1bf0('0x21f'),_0x1bf0('0x84'),_0x1bf0('0x223')+_0x3a9e8e));}_0x4afcba=_0x4afcba||0x0;var _0x6b96a5=0x1/_0x569643;var _0x5e1531=0x0;var _0x59b999=0x0;var _0x5e52af=0x0;var _0x18178e=0x0;for(var _0x2bc924=0x0;_0x5e52af<_0x3a9e8e;_0x2bc924+=0x1){_0x59b999=_0x2bc924/_0x20b283;_0x5e1531=(_0x485655*_0x59b999+_0x4afcba)/_0x6b96a5;_0x5e52af=utils[_0x1bf0('0x224')](_0x5e1531,_0x56730a);_0x18178e=_0x5e1531/_0x56730a*(0x1-utils[_0x1bf0('0x224')](_0x5e1531,_0x56730a));}return _0x376743({'erlangCalls':_0x2bc924,'erlangCallToSecond':_0x20b283/_0x2bc924,'erlangAbandonmentRate':_0x5e52af,'erlangBusyFactor':_0x18178e});});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x1e4')]=function(_0x25416d,_0xb79a03,_0x1e0f2b,_0x351113,_0x5eb31a,_0x3926e5){loggerPredictive['info'](_0x1bf0('0x225'));loggerPredictive[_0x1bf0('0x46')]('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',_0x25416d);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21b'),_0xb79a03);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21c'),_0x1e0f2b);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21d'),_0x351113);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x226'),_0x5eb31a);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x5d'));return new Promise(function(_0x310cb5,_0x539477){if(_0x25416d<=0x0||isNaN(_0x25416d)){return _0x539477(msgResponse('[busyFactor]','Error',_0x1bf0('0x220')+_0x25416d));}if(_0x1e0f2b<=0x0||isNaN(_0x1e0f2b)){return _0x539477(msgResponse(_0x1bf0('0x227'),_0x1bf0('0x84'),_0x1bf0('0x221')+_0x1e0f2b));}if(_0x351113<=0x0||isNaN(_0x351113)){return _0x539477(msgResponse('[busyFactor]',_0x1bf0('0x84'),_0x1bf0('0x222')+_0x351113));}if(_0xb79a03<=0x0||isNaN(_0xb79a03)){return _0x539477(msgResponse(_0x1bf0('0x227'),_0x1bf0('0x84'),_0x1bf0('0x228')+_0xb79a03));}if(_0x5eb31a<=0x0||isNaN(_0x5eb31a)){return _0x539477(msgResponse('[busyFactor]',_0x1bf0('0x84'),_0x1bf0('0x229')+_0x5eb31a));}_0x3926e5=_0x3926e5||0x0;var _0x26bff6=0x1/_0x1e0f2b;var _0x151761=0x0;var _0x2b418a=0x0;var _0x5dc081=0x0;var _0x22eaa0=0x0;for(var _0x5a385b=0x0;_0x22eaa0<_0x5eb31a;_0x5a385b+=0x1){_0x2b418a=_0x5a385b/_0xb79a03;_0x151761=(_0x351113*_0x2b418a+_0x3926e5)/_0x26bff6;_0x5dc081=utils[_0x1bf0('0x224')](_0x151761,_0x25416d);_0x22eaa0=_0x151761/_0x25416d*(0x1-utils[_0x1bf0('0x224')](_0x151761,_0x25416d));}return _0x310cb5({'erlangCalls':_0x5a385b,'erlangCallToSecond':_0xb79a03/_0x5a385b,'erlangAbandonmentRate':_0x5dc081,'erlangBusyFactor':_0x22eaa0});});};module[_0x1bf0('0x22a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index dfec6b8..f993a77 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2498=['voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string'];(function(_0x27ec50,_0x1d8698){var _0x2da0f5=function(_0x206a3e){while(--_0x206a3e){_0x27ec50['push'](_0x27ec50['shift']());}};_0x2da0f5(++_0x1d8698);}(_0x2498,0xce));var _0x8249=function(_0x31ca42,_0x2873cc){_0x31ca42=_0x31ca42-0x0;var _0x4f27f3=_0x2498[_0x31ca42];return _0x4f27f3;};'use strict';var util=require('util');var _=require(_0x8249('0x0'));var moment=require(_0x8249('0x1'));function checkNameSurname(_0xddcec0,_0x4455ad,_0x18c7c9){var _0x5a5479='';if(!_[_0x8249('0x2')](_0x4455ad)&&_0x8249('0x3')===typeof _0x4455ad){_0x5a5479+=_0x4455ad;}if(!_['isNil'](_0x18c7c9)&&_0x8249('0x3')===typeof _0x18c7c9){_0x5a5479+='\x20'+_0x18c7c9;}if(_0x5a5479!==''){return _0x5a5479;}return _0xddcec0;}function Action(_0x4d962f,_0x501518,_0x4680d7){this[_0x8249('0x4')]=_0x4d962f;this[_0x8249('0x5')]=_0x4680d7||undefined;this[_0x8249('0x6')]=checkNameSurname(_0x501518['Contact'][_0x8249('0x7')],_0x501518['Contact'][_0x8249('0x8')],_0x501518[_0x8249('0x9')][_0x8249('0xa')]);this[_0x8249('0xb')]=_0x501518[_0x8249('0x7')];this[_0x8249('0xc')]=_0x4d962f[_0x8249('0x6')];this[_0x8249('0xd')]=_0x501518[_0x8249('0xd')]||![];this[_0x8249('0xe')]=_0x4d962f[_0x8249('0xe')];this[_0x8249('0xf')]=_0x4d962f[_0x8249('0xf')]||0x3;this[_0x8249('0x10')]=_0x501518[_0x8249('0x10')];this[_0x8249('0x11')]=_0x501518['countbusyretry'];this['countcongestionretry']=_0x501518['countcongestionretry'];this[_0x8249('0x12')]=_0x501518[_0x8249('0x12')];this[_0x8249('0x13')]=_0x501518[_0x8249('0x13')];this[_0x8249('0x14')]=_0x501518[_0x8249('0x14')];this['countabandonedretry']=_0x501518[_0x8249('0x15')];this[_0x8249('0x16')]=_0x501518[_0x8249('0x16')];this[_0x8249('0x17')]=_0x501518[_0x8249('0x17')];this['ContactId']=_0x501518['ContactId'];this[_0x8249('0x18')]=_0x501518['ListId'];this[_0x8249('0x19')]=_0x501518[_0x8249('0x19')];this[_0x8249('0x1a')]=_0x501518[_0x8249('0x1a')];this['CampaignId']=_0x501518[_0x8249('0x1b')];this['idHopper']=_0x501518['id'];this[_0x8249('0x1c')]=_0x501518['Contact'][_0x8249('0x8')]||'';this[_0x8249('0x1d')]=moment()['format'](_0x8249('0x1e'));this[_0x8249('0x1f')]=_0x501518[_0x8249('0x1f')];this[_0x8249('0x20')]=_0x501518[_0x8249('0x20')];this[_0x8249('0x21')]=_0x501518['callbackat'];this[_0x8249('0x22')]=_0x501518[_0x8249('0x22')];this['originatecalleridnum']='';this[_0x8249('0x23')]='';}Action['prototype'][_0x8249('0x24')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x8249('0x6')],this[_0x8249('0x4')][_0x8249('0x25')]>0x0?this[_0x8249('0xb')][_0x8249('0x26')](this['voiceQueue']['dialCutDigit']):this[_0x8249('0xb')]);};Action[_0x8249('0x27')][_0x8249('0x28')]=function(){return this[_0x8249('0xc')];};module[_0x8249('0x29')]=Action; \ No newline at end of file +var _0x1ede=['number','substring','prototype','getQueue','lodash','string','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x201186,_0x5f73db){var _0x4b1973=function(_0x2c662e){while(--_0x2c662e){_0x201186['push'](_0x201186['shift']());}};_0x4b1973(++_0x5f73db);}(_0x1ede,0x138));var _0xe1ed=function(_0x127b1f,_0x38d813){_0x127b1f=_0x127b1f-0x0;var _0x278a17=_0x1ede[_0x127b1f];return _0x278a17;};'use strict';var util=require('util');var _=require(_0xe1ed('0x0'));var moment=require('moment');function checkNameSurname(_0x1c52c5,_0x120da8,_0x3ac33e){var _0x3df5d9='';if(!_['isNil'](_0x120da8)&&_0xe1ed('0x1')===typeof _0x120da8){_0x3df5d9+=_0x120da8;}if(!_[_0xe1ed('0x2')](_0x3ac33e)&&_0xe1ed('0x1')===typeof _0x3ac33e){_0x3df5d9+='\x20'+_0x3ac33e;}if(_0x3df5d9!==''){return _0x3df5d9;}return _0x1c52c5;}function Action(_0x20afb6,_0x454c4f,_0x1eff7d){this[_0xe1ed('0x3')]=_0x20afb6;this[_0xe1ed('0x4')]=_0x1eff7d||undefined;this[_0xe1ed('0x5')]=checkNameSurname(_0x454c4f['Contact'][_0xe1ed('0x6')],_0x454c4f[_0xe1ed('0x7')][_0xe1ed('0x8')],_0x454c4f[_0xe1ed('0x7')][_0xe1ed('0x9')]);this['number']=_0x454c4f[_0xe1ed('0x6')];this[_0xe1ed('0xa')]=_0x20afb6[_0xe1ed('0x5')];this[_0xe1ed('0xb')]=_0x454c4f[_0xe1ed('0xb')]||![];this[_0xe1ed('0xc')]=_0x20afb6[_0xe1ed('0xc')];this[_0xe1ed('0xd')]=_0x20afb6['dialQueueTimeout']||0x3;this[_0xe1ed('0xe')]=_0x454c4f[_0xe1ed('0xe')];this[_0xe1ed('0xf')]=_0x454c4f[_0xe1ed('0xf')];this[_0xe1ed('0x10')]=_0x454c4f[_0xe1ed('0x10')];this[_0xe1ed('0x11')]=_0x454c4f[_0xe1ed('0x11')];this[_0xe1ed('0x12')]=_0x454c4f[_0xe1ed('0x12')];this[_0xe1ed('0x13')]=_0x454c4f['countdropretry'];this[_0xe1ed('0x14')]=_0x454c4f['countabandonedretry'];this[_0xe1ed('0x15')]=_0x454c4f[_0xe1ed('0x15')];this[_0xe1ed('0x16')]=_0x454c4f[_0xe1ed('0x16')];this[_0xe1ed('0x17')]=_0x454c4f[_0xe1ed('0x17')];this[_0xe1ed('0x18')]=_0x454c4f[_0xe1ed('0x18')];this[_0xe1ed('0x19')]=_0x454c4f[_0xe1ed('0x19')];this['VoiceQueueId']=_0x454c4f['VoiceQueueId'];this['CampaignId']=_0x454c4f[_0xe1ed('0x1a')];this[_0xe1ed('0x1b')]=_0x454c4f['id'];this['ContactFirstName']=_0x454c4f[_0xe1ed('0x7')][_0xe1ed('0x8')]||'';this[_0xe1ed('0x1c')]=moment()[_0xe1ed('0x1d')](_0xe1ed('0x1e'));this[_0xe1ed('0x1f')]=_0x454c4f['callback'];this[_0xe1ed('0x20')]=_0x454c4f[_0xe1ed('0x20')];this['callbackat']=_0x454c4f[_0xe1ed('0x21')];this['recallme']=_0x454c4f[_0xe1ed('0x22')];this[_0xe1ed('0x23')]='';this[_0xe1ed('0x24')]='';}Action['prototype'][_0xe1ed('0x25')]=function(){return util['format'](_0xe1ed('0x26'),this['name'],this[_0xe1ed('0x3')][_0xe1ed('0x27')]>0x0?this[_0xe1ed('0x28')][_0xe1ed('0x29')](this['voiceQueue'][_0xe1ed('0x27')]):this[_0xe1ed('0x28')]);};Action[_0xe1ed('0x2a')][_0xe1ed('0x2b')]=function(){return this[_0xe1ed('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 1a57992..53c7edd 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f24=['holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','exports','moment','../utils','state','statedesc','Answer','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime'];(function(_0x598987,_0x47b1e3){var _0x5e0ebe=function(_0xd0676b){while(--_0xd0676b){_0x598987['push'](_0x598987['shift']());}};_0x5e0ebe(++_0x47b1e3);}(_0x8f24,0x179));var _0x48f2=function(_0x413db8,_0xc5df52){_0x413db8=_0x413db8-0x0;var _0x514042=_0x8f24[_0x413db8];return _0x514042;};'use strict';var moment=require(_0x48f2('0x0'));var utils=require(_0x48f2('0x1'));function AgentComplete(_0x4d9588,_0x213643){this[_0x48f2('0x2')]=0x4;this[_0x48f2('0x3')]=_0x48f2('0x4');this['scheduledat']=_0x4d9588['scheduledat'];this[_0x48f2('0x5')]=_0x4d9588[_0x48f2('0x5')];this[_0x48f2('0x6')]=_0x4d9588['type']==='outbound'?_0x48f2('0x7'):_0x4d9588[_0x48f2('0x5')];this[_0x48f2('0x8')]=_0x4d9588[_0x48f2('0x8')];this[_0x48f2('0x9')]=_0x4d9588[_0x48f2('0x9')];this[_0x48f2('0xa')]=_0x4d9588['countnoanswerretry'];this[_0x48f2('0xb')]=_0x4d9588[_0x48f2('0x8')]+_0x4d9588[_0x48f2('0x9')]+_0x4d9588[_0x48f2('0xa')]+_0x4d9588[_0x48f2('0xc')]+_0x4d9588['countdropretry']+_0x4d9588[_0x48f2('0xd')]+_0x4d9588[_0x48f2('0xe')]+_0x4d9588[_0x48f2('0xf')];this['countnosuchnumberretry']=_0x4d9588['countnosuchnumberretry'];this['countdropretry']=_0x4d9588[_0x48f2('0x10')];this['countabandonedretry']=_0x4d9588[_0x48f2('0xd')];this['countmachineretry']=_0x4d9588[_0x48f2('0xe')];this['countagentrejectretry']=_0x4d9588['countagentrejectretry'];this[_0x48f2('0x11')]=_0x213643[_0x48f2('0x11')];this[_0x48f2('0x12')]=_0x4d9588['name'];this[_0x48f2('0x13')]=_0x4d9588[_0x48f2('0x14')];this[_0x48f2('0x15')]=_0x4d9588['starttime'];this['responsetime']=_0x4d9588['responsetime'];this[_0x48f2('0x16')]=_0x4d9588[_0x48f2('0x16')];this['endtime']=moment()[_0x48f2('0x17')](_0x48f2('0x18'));this[_0x48f2('0x19')]=utils[_0x48f2('0x1a')](_0x4d9588[_0x48f2('0x1b')],_0x4d9588[_0x48f2('0x15')]);this[_0x48f2('0x1c')]=utils[_0x48f2('0x1a')](_0x4d9588['answertime'],_0x4d9588['responsetime']);this[_0x48f2('0x1d')]=utils['getSeconds'](this[_0x48f2('0x1e')],_0x4d9588['answertime']);this[_0x48f2('0x7')]=_0x213643['queue'];this[_0x48f2('0x1f')]=_0x213643[_0x48f2('0x1f')];this[_0x48f2('0x20')]=_0x213643['reason'];this[_0x48f2('0x21')]=_0x4d9588['callback'];this[_0x48f2('0x22')]=_0x4d9588['callbackuniqueid'];this[_0x48f2('0x23')]=_0x4d9588['callbackat'];this[_0x48f2('0x24')]=_0x4d9588[_0x48f2('0x24')];this[_0x48f2('0x25')]=_0x4d9588[_0x48f2('0x25')];this[_0x48f2('0x26')]=_0x4d9588[_0x48f2('0x26')];this[_0x48f2('0x27')]=_0x4d9588[_0x48f2('0x27')];this[_0x48f2('0x28')]=_0x4d9588[_0x48f2('0x28')];this[_0x48f2('0x29')]=_0x4d9588['CampaignId'];this[_0x48f2('0x2a')]=_0x4d9588[_0x48f2('0x2a')]||'';this['originatecalleridname']=_0x4d9588['originatecalleridname']||'';this[_0x48f2('0x2b')]=_0x4d9588[_0x48f2('0x2b')];}module[_0x48f2('0x2c')]=AgentComplete; \ No newline at end of file +var _0x02d6=['statedesc','Answer','scheduledat','campaigntype','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state'];(function(_0x34a318,_0x565dc7){var _0x49f361=function(_0x51a08a){while(--_0x51a08a){_0x34a318['push'](_0x34a318['shift']());}};_0x49f361(++_0x565dc7);}(_0x02d6,0x7f));var _0x602d=function(_0x1aec02,_0x3a7f22){_0x1aec02=_0x1aec02-0x0;var _0x10a837=_0x02d6[_0x1aec02];return _0x10a837;};'use strict';var moment=require(_0x602d('0x0'));var utils=require('../utils');function AgentComplete(_0x4489d2,_0x5c41fa){this[_0x602d('0x1')]=0x4;this[_0x602d('0x2')]=_0x602d('0x3');this['scheduledat']=_0x4489d2[_0x602d('0x4')];this['type']=_0x4489d2['type'];this[_0x602d('0x5')]=_0x4489d2[_0x602d('0x6')]==='outbound'?'queue':_0x4489d2['type'];this[_0x602d('0x7')]=_0x4489d2[_0x602d('0x7')];this[_0x602d('0x8')]=_0x4489d2[_0x602d('0x8')];this['countnoanswerretry']=_0x4489d2[_0x602d('0x9')];this[_0x602d('0xa')]=_0x4489d2['countbusyretry']+_0x4489d2[_0x602d('0x8')]+_0x4489d2[_0x602d('0x9')]+_0x4489d2[_0x602d('0xb')]+_0x4489d2['countdropretry']+_0x4489d2['countabandonedretry']+_0x4489d2[_0x602d('0xc')]+_0x4489d2[_0x602d('0xd')];this[_0x602d('0xb')]=_0x4489d2['countnosuchnumberretry'];this[_0x602d('0xe')]=_0x4489d2[_0x602d('0xe')];this[_0x602d('0xf')]=_0x4489d2[_0x602d('0xf')];this[_0x602d('0xc')]=_0x4489d2[_0x602d('0xc')];this[_0x602d('0xd')]=_0x4489d2[_0x602d('0xd')];this['uniqueid']=_0x5c41fa['uniqueid'];this['calleridname']=_0x4489d2[_0x602d('0x10')];this[_0x602d('0x11')]=_0x4489d2[_0x602d('0x12')];this[_0x602d('0x13')]=_0x4489d2[_0x602d('0x13')];this[_0x602d('0x14')]=_0x4489d2[_0x602d('0x14')];this[_0x602d('0x15')]=_0x4489d2['answertime'];this[_0x602d('0x16')]=moment()[_0x602d('0x17')](_0x602d('0x18'));this[_0x602d('0x19')]=utils[_0x602d('0x1a')](_0x4489d2[_0x602d('0x14')],_0x4489d2[_0x602d('0x13')]);this[_0x602d('0x1b')]=utils[_0x602d('0x1a')](_0x4489d2['answertime'],_0x4489d2[_0x602d('0x14')]);this['talktime']=utils[_0x602d('0x1a')](this[_0x602d('0x16')],_0x4489d2[_0x602d('0x15')]);this[_0x602d('0x1c')]=_0x5c41fa['queue'];this[_0x602d('0x1d')]=_0x5c41fa[_0x602d('0x1d')];this[_0x602d('0x1e')]=_0x5c41fa[_0x602d('0x1e')];this[_0x602d('0x1f')]=_0x4489d2[_0x602d('0x1f')];this['callbackuniqueid']=_0x4489d2['callbackuniqueid'];this[_0x602d('0x20')]=_0x4489d2[_0x602d('0x20')];this[_0x602d('0x21')]=_0x4489d2[_0x602d('0x21')];this[_0x602d('0x22')]=_0x4489d2[_0x602d('0x22')];this[_0x602d('0x23')]=_0x4489d2[_0x602d('0x23')];this[_0x602d('0x24')]=_0x4489d2[_0x602d('0x24')];this[_0x602d('0x25')]=_0x4489d2['VoiceQueueId'];this[_0x602d('0x26')]=_0x4489d2['CampaignId'];this[_0x602d('0x27')]=_0x4489d2[_0x602d('0x27')]||'';this[_0x602d('0x28')]=_0x4489d2[_0x602d('0x28')]||'';this['agiafterat']=_0x4489d2[_0x602d('0x29')];}module[_0x602d('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 6d03d88..4ed35e8 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x206b=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x206b,0x9f));var _0xb206=function(_0x493df0,_0x3808fe){_0x493df0=_0x493df0-0x0;var _0x4b6a03=_0x206b[_0x493df0];return _0x4b6a03;};'use strict';function Final(_0x55889c){this[_0xb206('0x0')]=_0x55889c[_0xb206('0x0')];this[_0xb206('0x1')]=_0x55889c[_0xb206('0x1')];this[_0xb206('0x2')]=_0x55889c[_0xb206('0x2')];this['campaigntype']=_0x55889c[_0xb206('0x2')]===_0xb206('0x3')?'queue':_0x55889c[_0xb206('0x2')];this[_0xb206('0x4')]=_0x55889c[_0xb206('0x4')];this[_0xb206('0x5')]=_0x55889c[_0xb206('0x5')];this[_0xb206('0x6')]=_0x55889c[_0xb206('0x6')];this[_0xb206('0x7')]=_0x55889c[_0xb206('0x4')]+_0x55889c[_0xb206('0x5')]+_0x55889c[_0xb206('0x6')]+_0x55889c[_0xb206('0x8')]+_0x55889c['countdropretry']+_0x55889c['countabandonedretry']+_0x55889c['countmachineretry']+_0x55889c[_0xb206('0x9')];this['countnosuchnumberretry']=_0x55889c[_0xb206('0x8')];this['countdropretry']=_0x55889c['countdropretry'];this[_0xb206('0xa')]=_0x55889c[_0xb206('0xa')];this[_0xb206('0xb')]=_0x55889c[_0xb206('0xb')];this[_0xb206('0x9')]=_0x55889c[_0xb206('0x9')];this['queue']=_0x55889c[_0xb206('0xc')];this[_0xb206('0xd')]=_0x55889c[_0xb206('0xd')];this['calleridnum']=_0x55889c[_0xb206('0xe')];this[_0xb206('0xf')]=_0x55889c[_0xb206('0xf')];this[_0xb206('0x10')]=_0x55889c['responsetime'];this[_0xb206('0x11')]=_0x55889c[_0xb206('0x10')];this[_0xb206('0x12')]=_0x55889c[_0xb206('0x12')]||0x0;this['holdtime']=_0x55889c[_0xb206('0x13')]||0x0;this[_0xb206('0x14')]=_0x55889c['talktime']||0x0;this[_0xb206('0x15')]=_0x55889c[_0xb206('0x15')];this[_0xb206('0x16')]=_0x55889c[_0xb206('0x16')];this[_0xb206('0x17')]=_0x55889c[_0xb206('0x17')];this[_0xb206('0x18')]=_0x55889c[_0xb206('0x18')];this[_0xb206('0x19')]=_0x55889c[_0xb206('0x19')];this[_0xb206('0x1a')]=_0x55889c[_0xb206('0x1a')];this[_0xb206('0x1b')]=_0x55889c[_0xb206('0x1b')];this[_0xb206('0x1c')]=_0x55889c[_0xb206('0x1c')];this[_0xb206('0x1d')]=_0x55889c['CampaignId'];this[_0xb206('0x1e')]=_0x55889c[_0xb206('0x1e')]||'';this[_0xb206('0x1f')]=_0x55889c['originatecalleridname']||'';this[_0xb206('0x20')]=_0x55889c[_0xb206('0x20')];this['statedesc']=_0x55889c[_0xb206('0x21')];}module[_0xb206('0x22')]=Final; \ No newline at end of file +var _0x18e8=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countglobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x2a863f,_0x3e7a74){var _0x525dac=function(_0x476b9f){while(--_0x476b9f){_0x2a863f['push'](_0x2a863f['shift']());}};_0x525dac(++_0x3e7a74);}(_0x18e8,0x15f));var _0x818e=function(_0x48ca09,_0x23f419){_0x48ca09=_0x48ca09-0x0;var _0x52403e=_0x18e8[_0x48ca09];return _0x52403e;};'use strict';function Final(_0x4de7ec){this[_0x818e('0x0')]=_0x4de7ec['uniqueid'];this['scheduledat']=_0x4de7ec[_0x818e('0x1')];this[_0x818e('0x2')]=_0x4de7ec[_0x818e('0x2')];this[_0x818e('0x3')]=_0x4de7ec[_0x818e('0x2')]===_0x818e('0x4')?_0x818e('0x5'):_0x4de7ec[_0x818e('0x2')];this['countbusyretry']=_0x4de7ec['countbusyretry'];this[_0x818e('0x6')]=_0x4de7ec[_0x818e('0x6')];this['countnoanswerretry']=_0x4de7ec['countnoanswerretry'];this[_0x818e('0x7')]=_0x4de7ec[_0x818e('0x8')]+_0x4de7ec['countcongestionretry']+_0x4de7ec[_0x818e('0x9')]+_0x4de7ec[_0x818e('0xa')]+_0x4de7ec[_0x818e('0xb')]+_0x4de7ec[_0x818e('0xc')]+_0x4de7ec[_0x818e('0xd')]+_0x4de7ec[_0x818e('0xe')];this['countnosuchnumberretry']=_0x4de7ec['countnosuchnumberretry'];this['countdropretry']=_0x4de7ec['countdropretry'];this[_0x818e('0xc')]=_0x4de7ec[_0x818e('0xc')];this['countmachineretry']=_0x4de7ec[_0x818e('0xd')];this[_0x818e('0xe')]=_0x4de7ec[_0x818e('0xe')];this[_0x818e('0x5')]=_0x4de7ec[_0x818e('0x5')];this[_0x818e('0xf')]=_0x4de7ec['calleridname'];this[_0x818e('0x10')]=_0x4de7ec[_0x818e('0x10')];this[_0x818e('0x11')]=_0x4de7ec[_0x818e('0x11')];this[_0x818e('0x12')]=_0x4de7ec[_0x818e('0x12')];this[_0x818e('0x13')]=_0x4de7ec[_0x818e('0x12')];this['ringtime']=_0x4de7ec[_0x818e('0x14')]||0x0;this[_0x818e('0x15')]=_0x4de7ec[_0x818e('0x15')]||0x0;this[_0x818e('0x16')]=_0x4de7ec[_0x818e('0x16')]||0x0;this['callback']=_0x4de7ec[_0x818e('0x17')];this['callbackuniqueid']=_0x4de7ec[_0x818e('0x18')];this[_0x818e('0x19')]=_0x4de7ec['callbackat'];this[_0x818e('0x1a')]=_0x4de7ec[_0x818e('0x1a')];this[_0x818e('0x1b')]=_0x4de7ec['ContactId'];this[_0x818e('0x1c')]=_0x4de7ec[_0x818e('0x1c')];this[_0x818e('0x1d')]=_0x4de7ec[_0x818e('0x1d')];this[_0x818e('0x1e')]=_0x4de7ec[_0x818e('0x1e')];this[_0x818e('0x1f')]=_0x4de7ec[_0x818e('0x1f')];this[_0x818e('0x20')]=_0x4de7ec[_0x818e('0x20')]||'';this[_0x818e('0x21')]=_0x4de7ec[_0x818e('0x21')]||'';this[_0x818e('0x22')]=_0x4de7ec[_0x818e('0x22')];this[_0x818e('0x23')]=_0x4de7ec[_0x818e('0x23')];}module[_0x818e('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index e031e4f..abecc7f 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc047=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','type','campaigntype','outbound','queue','amd','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback'];(function(_0x3ee926,_0x837d2a){var _0x45831c=function(_0x154d63){while(--_0x154d63){_0x3ee926['push'](_0x3ee926['shift']());}};_0x45831c(++_0x837d2a);}(_0xc047,0xf8));var _0x7c04=function(_0x2ce503,_0x3a2dd3){_0x2ce503=_0x2ce503-0x0;var _0x176713=_0xc047[_0x2ce503];return _0x176713;};'use strict';var moment=require(_0x7c04('0x0'));var utils=require(_0x7c04('0x1'));function Hangup(_0x3ce9f5,_0x23ca96){this[_0x7c04('0x2')]=0x4;this[_0x7c04('0x3')]='Answer';this['scheduledat']=_0x3ce9f5['scheduledat'];this[_0x7c04('0x4')]=_0x3ce9f5[_0x7c04('0x4')];this[_0x7c04('0x5')]=_0x3ce9f5['type']===_0x7c04('0x6')?_0x7c04('0x7'):_0x3ce9f5[_0x7c04('0x4')];this[_0x7c04('0x8')]=_0x3ce9f5['amd']||![];this['countbusyretry']=_0x3ce9f5['countbusyretry'];this['countcongestionretry']=_0x3ce9f5['countcongestionretry'];this[_0x7c04('0x9')]=_0x3ce9f5[_0x7c04('0x9')];this[_0x7c04('0xa')]=_0x3ce9f5['countbusyretry']+_0x3ce9f5[_0x7c04('0xb')]+_0x3ce9f5[_0x7c04('0x9')]+_0x3ce9f5[_0x7c04('0xc')]+_0x3ce9f5[_0x7c04('0xd')]+_0x3ce9f5['countabandonedretry']+_0x3ce9f5['countmachineretry']+_0x3ce9f5[_0x7c04('0xe')];this['countnosuchnumberretry']=_0x3ce9f5['countnosuchnumberretry'];this[_0x7c04('0xd')]=_0x3ce9f5[_0x7c04('0xd')];this[_0x7c04('0xf')]=_0x3ce9f5[_0x7c04('0xf')];this[_0x7c04('0x10')]=_0x3ce9f5['countmachineretry'];this[_0x7c04('0xe')]=_0x3ce9f5[_0x7c04('0xe')];this[_0x7c04('0x11')]=_0x23ca96[_0x7c04('0x11')];this[_0x7c04('0x12')]=_0x3ce9f5[_0x7c04('0x13')];this['calleridnum']=_0x3ce9f5['number'];this['starttime']=_0x3ce9f5[_0x7c04('0x14')];this['responsetime']=_0x3ce9f5[_0x7c04('0x15')];this[_0x7c04('0x16')]=moment()['format'](_0x7c04('0x17'));this[_0x7c04('0x18')]=utils[_0x7c04('0x19')](_0x3ce9f5[_0x7c04('0x15')],_0x3ce9f5[_0x7c04('0x14')]);this[_0x7c04('0x1a')]=0x0;this[_0x7c04('0x1b')]=utils[_0x7c04('0x19')](this[_0x7c04('0x16')],_0x3ce9f5[_0x7c04('0x15')]);this['queue']=_0x3ce9f5[_0x7c04('0x7')];this['membername']=_0x7c04('0x1c');this[_0x7c04('0x1d')]=_0x23ca96[_0x7c04('0x1e')];this['callback']=_0x3ce9f5[_0x7c04('0x1f')];this[_0x7c04('0x20')]=_0x3ce9f5['callbackuniqueid'];this[_0x7c04('0x21')]=_0x3ce9f5[_0x7c04('0x21')];this[_0x7c04('0x22')]=_0x3ce9f5[_0x7c04('0x22')];this[_0x7c04('0x23')]=_0x3ce9f5[_0x7c04('0x23')];this['ListId']=_0x3ce9f5[_0x7c04('0x24')];this[_0x7c04('0x25')]=_0x3ce9f5[_0x7c04('0x25')];this['VoiceQueueId']=_0x3ce9f5[_0x7c04('0x26')];this[_0x7c04('0x27')]=_0x3ce9f5[_0x7c04('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0x17e3=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x17e3,0x1ef));var _0x317e=function(_0x226756,_0x59e2ee){_0x226756=_0x226756-0x0;var _0x4a3aeb=_0x17e3[_0x226756];return _0x4a3aeb;};'use strict';var moment=require('moment');var utils=require(_0x317e('0x0'));function Hangup(_0x20021d,_0x53dcbe){this[_0x317e('0x1')]=0x4;this['statedesc']=_0x317e('0x2');this[_0x317e('0x3')]=_0x20021d[_0x317e('0x3')];this[_0x317e('0x4')]=_0x20021d['type'];this[_0x317e('0x5')]=_0x20021d[_0x317e('0x4')]==='outbound'?_0x317e('0x6'):_0x20021d[_0x317e('0x4')];this[_0x317e('0x7')]=_0x20021d['amd']||![];this[_0x317e('0x8')]=_0x20021d[_0x317e('0x8')];this[_0x317e('0x9')]=_0x20021d[_0x317e('0x9')];this[_0x317e('0xa')]=_0x20021d[_0x317e('0xa')];this[_0x317e('0xb')]=_0x20021d[_0x317e('0x8')]+_0x20021d[_0x317e('0x9')]+_0x20021d[_0x317e('0xa')]+_0x20021d[_0x317e('0xc')]+_0x20021d[_0x317e('0xd')]+_0x20021d[_0x317e('0xe')]+_0x20021d[_0x317e('0xf')]+_0x20021d['countagentrejectretry'];this['countnosuchnumberretry']=_0x20021d['countnosuchnumberretry'];this[_0x317e('0xd')]=_0x20021d[_0x317e('0xd')];this[_0x317e('0xe')]=_0x20021d[_0x317e('0xe')];this[_0x317e('0xf')]=_0x20021d[_0x317e('0xf')];this[_0x317e('0x10')]=_0x20021d[_0x317e('0x10')];this[_0x317e('0x11')]=_0x53dcbe[_0x317e('0x11')];this[_0x317e('0x12')]=_0x20021d[_0x317e('0x13')];this[_0x317e('0x14')]=_0x20021d[_0x317e('0x15')];this['starttime']=_0x20021d[_0x317e('0x16')];this['responsetime']=_0x20021d['responsetime'];this[_0x317e('0x17')]=moment()[_0x317e('0x18')](_0x317e('0x19'));this[_0x317e('0x1a')]=utils[_0x317e('0x1b')](_0x20021d[_0x317e('0x1c')],_0x20021d[_0x317e('0x16')]);this[_0x317e('0x1d')]=0x0;this['talktime']=utils[_0x317e('0x1b')](this[_0x317e('0x17')],_0x20021d[_0x317e('0x1c')]);this[_0x317e('0x6')]=_0x20021d['queue'];this['membername']='IVR';this['reason']=_0x53dcbe['cause-txt'];this['callback']=_0x20021d[_0x317e('0x1e')];this['callbackuniqueid']=_0x20021d['callbackuniqueid'];this[_0x317e('0x1f')]=_0x20021d[_0x317e('0x1f')];this[_0x317e('0x20')]=_0x20021d[_0x317e('0x20')];this['ContactId']=_0x20021d[_0x317e('0x21')];this[_0x317e('0x22')]=_0x20021d[_0x317e('0x22')];this[_0x317e('0x23')]=_0x20021d[_0x317e('0x23')];this[_0x317e('0x24')]=_0x20021d[_0x317e('0x24')];this[_0x317e('0x25')]=_0x20021d[_0x317e('0x25')];}module[_0x317e('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 404188c..151f1a5 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x540f=['countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x3adcda,_0x29fd97){var _0x301d65=function(_0x2491a7){while(--_0x2491a7){_0x3adcda['push'](_0x3adcda['shift']());}};_0x301d65(++_0x29fd97);}(_0x540f,0x116));var _0xf540=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x540f[_0x3457b4];return _0xaa8fa9;};'use strict';var utils=require('../utils');function History(_0x3586f3){this[_0xf540('0x0')]=_0x3586f3[_0xf540('0x0')];this[_0xf540('0x1')]=_0x3586f3[_0xf540('0x1')]||undefined;this[_0xf540('0x2')]=_0x3586f3[_0xf540('0x2')];this[_0xf540('0x3')]=_0x3586f3['type']==='outbound'?_0xf540('0x4'):_0x3586f3[_0xf540('0x2')];this[_0xf540('0x5')]=_0x3586f3[_0xf540('0x5')];this[_0xf540('0x6')]=_0x3586f3[_0xf540('0x6')];this[_0xf540('0x7')]=_0x3586f3['countnoanswerretry'];this[_0xf540('0x8')]=_0x3586f3[_0xf540('0x5')]+_0x3586f3['countcongestionretry']+_0x3586f3[_0xf540('0x7')]+_0x3586f3[_0xf540('0x9')]+_0x3586f3['countdropretry']+_0x3586f3['countabandonedretry']+_0x3586f3[_0xf540('0xa')]+_0x3586f3[_0xf540('0xb')];this[_0xf540('0x9')]=_0x3586f3[_0xf540('0x9')];this[_0xf540('0xc')]=_0x3586f3['countdropretry'];this[_0xf540('0xd')]=_0x3586f3['countabandonedretry'];this[_0xf540('0xa')]=_0x3586f3[_0xf540('0xa')];this[_0xf540('0xb')]=_0x3586f3['countagentrejectretry'];this[_0xf540('0x4')]=_0x3586f3[_0xf540('0x4')];this[_0xf540('0xe')]=_0x3586f3[_0xf540('0xf')];this[_0xf540('0x10')]=_0x3586f3['number'];this[_0xf540('0x11')]=_0x3586f3[_0xf540('0x11')];this[_0xf540('0x12')]=_0x3586f3[_0xf540('0x12')];this[_0xf540('0x13')]=_0x3586f3[_0xf540('0x12')];this[_0xf540('0x14')]=utils['getSeconds'](_0x3586f3['responsetime'],_0x3586f3[_0xf540('0x11')]);this[_0xf540('0x15')]=0x0;this[_0xf540('0x16')]=0x0;this['callback']=_0x3586f3[_0xf540('0x17')];this[_0xf540('0x18')]=_0x3586f3['callbackuniqueid'];this[_0xf540('0x19')]=_0x3586f3[_0xf540('0x19')];this['recallme']=_0x3586f3['recallme'];this[_0xf540('0x1a')]=_0x3586f3[_0xf540('0x1a')];this[_0xf540('0x1b')]=_0x3586f3['ListId'];this['UserId']=_0x3586f3[_0xf540('0x1c')];this[_0xf540('0x1d')]=_0x3586f3[_0xf540('0x1d')];this['CampaignId']=_0x3586f3[_0xf540('0x1e')];this[_0xf540('0x1f')]=_0x3586f3[_0xf540('0x1f')]||'';this[_0xf540('0x20')]=_0x3586f3[_0xf540('0x20')]||'';this[_0xf540('0x21')]=_0x3586f3[_0xf540('0x21')];this[_0xf540('0x22')]=_0x3586f3[_0xf540('0x22')];}module[_0xf540('0x23')]=History; \ No newline at end of file +var _0x8d9d=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callbackuniqueid'];(function(_0x14edc0,_0x3831e6){var _0xd5bb1=function(_0x221420){while(--_0x221420){_0x14edc0['push'](_0x14edc0['shift']());}};_0xd5bb1(++_0x3831e6);}(_0x8d9d,0x1a2));var _0xd8d9=function(_0x4c52fa,_0x4354cb){_0x4c52fa=_0x4c52fa-0x0;var _0x8d0d79=_0x8d9d[_0x4c52fa];return _0x8d0d79;};'use strict';var utils=require(_0xd8d9('0x0'));function History(_0x2af631){this['uniqueid']=_0x2af631[_0xd8d9('0x1')];this[_0xd8d9('0x2')]=_0x2af631[_0xd8d9('0x2')]||undefined;this[_0xd8d9('0x3')]=_0x2af631[_0xd8d9('0x3')];this[_0xd8d9('0x4')]=_0x2af631[_0xd8d9('0x3')]==='outbound'?_0xd8d9('0x5'):_0x2af631[_0xd8d9('0x3')];this[_0xd8d9('0x6')]=_0x2af631[_0xd8d9('0x6')];this[_0xd8d9('0x7')]=_0x2af631[_0xd8d9('0x7')];this[_0xd8d9('0x8')]=_0x2af631[_0xd8d9('0x8')];this[_0xd8d9('0x9')]=_0x2af631[_0xd8d9('0x6')]+_0x2af631[_0xd8d9('0x7')]+_0x2af631[_0xd8d9('0x8')]+_0x2af631['countnosuchnumberretry']+_0x2af631['countdropretry']+_0x2af631['countabandonedretry']+_0x2af631[_0xd8d9('0xa')]+_0x2af631[_0xd8d9('0xb')];this['countnosuchnumberretry']=_0x2af631['countnosuchnumberretry'];this['countdropretry']=_0x2af631[_0xd8d9('0xc')];this[_0xd8d9('0xd')]=_0x2af631[_0xd8d9('0xd')];this['countmachineretry']=_0x2af631[_0xd8d9('0xa')];this[_0xd8d9('0xb')]=_0x2af631[_0xd8d9('0xb')];this[_0xd8d9('0x5')]=_0x2af631[_0xd8d9('0x5')];this[_0xd8d9('0xe')]=_0x2af631['name'];this[_0xd8d9('0xf')]=_0x2af631[_0xd8d9('0x10')];this['starttime']=_0x2af631[_0xd8d9('0x11')];this['responsetime']=_0x2af631[_0xd8d9('0x12')];this['endtime']=_0x2af631[_0xd8d9('0x12')];this[_0xd8d9('0x13')]=utils[_0xd8d9('0x14')](_0x2af631[_0xd8d9('0x12')],_0x2af631['starttime']);this[_0xd8d9('0x15')]=0x0;this[_0xd8d9('0x16')]=0x0;this['callback']=_0x2af631['callback'];this[_0xd8d9('0x17')]=_0x2af631['callbackuniqueid'];this[_0xd8d9('0x18')]=_0x2af631[_0xd8d9('0x18')];this[_0xd8d9('0x19')]=_0x2af631['recallme'];this[_0xd8d9('0x1a')]=_0x2af631[_0xd8d9('0x1a')];this[_0xd8d9('0x1b')]=_0x2af631[_0xd8d9('0x1b')];this[_0xd8d9('0x1c')]=_0x2af631[_0xd8d9('0x1c')];this['VoiceQueueId']=_0x2af631[_0xd8d9('0x1d')];this['CampaignId']=_0x2af631['CampaignId'];this[_0xd8d9('0x1e')]=_0x2af631[_0xd8d9('0x1e')]||'';this['originatecalleridname']=_0x2af631[_0xd8d9('0x1f')]||'';this['state']=_0x2af631[_0xd8d9('0x20')];this['statedesc']=_0x2af631[_0xd8d9('0x21')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 4fa7564..e5cf215 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aeb=['talktime','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','dropreason','endtime','droptime','ringtime','holdtime','getSeconds'];(function(_0xab0e3b,_0x5dfbda){var _0x43fd16=function(_0x56b5f9){while(--_0x56b5f9){_0xab0e3b['push'](_0xab0e3b['shift']());}};_0x43fd16(++_0x5dfbda);}(_0x2aeb,0xb3));var _0xb2ae=function(_0x4259db,_0x15328d){_0x4259db=_0x4259db-0x0;var _0x30a4bf=_0x2aeb[_0x4259db];return _0x30a4bf;};'use strict';var utils=require(_0xb2ae('0x0'));function QueueCallerAbandon(_0x3843b1,_0x44dce7){this[_0xb2ae('0x1')]=_0x3843b1[_0xb2ae('0x1')];this[_0xb2ae('0x2')]=_0x3843b1['type'];this[_0xb2ae('0x3')]=_0x3843b1[_0xb2ae('0x2')]==='outbound'?_0xb2ae('0x4'):_0x3843b1[_0xb2ae('0x2')];this['countbusyretry']=_0x3843b1[_0xb2ae('0x5')];this[_0xb2ae('0x6')]=_0x3843b1[_0xb2ae('0x6')];this[_0xb2ae('0x7')]=_0x3843b1['countnoanswerretry'];this[_0xb2ae('0x8')]=_0x3843b1['countbusyretry']+_0x3843b1[_0xb2ae('0x6')]+_0x3843b1['countnoanswerretry']+_0x3843b1[_0xb2ae('0x9')]+_0x3843b1[_0xb2ae('0xa')]+_0x3843b1[_0xb2ae('0xb')]+_0x3843b1[_0xb2ae('0xc')]+_0x3843b1['countagentrejectretry'];this[_0xb2ae('0x9')]=_0x3843b1[_0xb2ae('0x9')];this[_0xb2ae('0xa')]=_0x3843b1['countdropretry'];this[_0xb2ae('0xb')]=_0x3843b1[_0xb2ae('0xb')];this[_0xb2ae('0xc')]=_0x3843b1[_0xb2ae('0xc')];this[_0xb2ae('0xd')]=_0x3843b1['countagentrejectretry'];this['uniqueid']=_0x44dce7['uniqueid'];this[_0xb2ae('0xe')]=_0x3843b1[_0xb2ae('0xf')];this[_0xb2ae('0x10')]=_0x3843b1[_0xb2ae('0x11')];this[_0xb2ae('0x12')]=_0x3843b1[_0xb2ae('0x12')];this[_0xb2ae('0x13')]=_0x3843b1['responsetime'];this['droptime']=_0x3843b1['droptime'];this[_0xb2ae('0x14')]=_0x3843b1[_0xb2ae('0x14')];this[_0xb2ae('0x15')]=this[_0xb2ae('0x16')];this[_0xb2ae('0x17')]=utils['getSeconds'](_0x3843b1[_0xb2ae('0x13')],_0x3843b1['starttime']);this[_0xb2ae('0x18')]=utils[_0xb2ae('0x19')](this[_0xb2ae('0x16')],_0x3843b1['responsetime']);this[_0xb2ae('0x1a')]=0x0;this['queue']=_0x44dce7['queue'];this[_0xb2ae('0x1b')]=_0x44dce7[_0xb2ae('0x1c')];this['reason']=_0x44dce7[_0xb2ae('0x1d')];this['callback']=_0x3843b1[_0xb2ae('0x1e')];this['callbackuniqueid']=_0x3843b1['callbackuniqueid'];this[_0xb2ae('0x1f')]=_0x3843b1[_0xb2ae('0x1f')];this[_0xb2ae('0x20')]=_0x3843b1[_0xb2ae('0x20')];this[_0xb2ae('0x21')]=_0x3843b1[_0xb2ae('0x21')];this['ListId']=_0x3843b1[_0xb2ae('0x22')];this[_0xb2ae('0x23')]=_0x3843b1[_0xb2ae('0x23')];this[_0xb2ae('0x24')]=_0x3843b1[_0xb2ae('0x24')];this['CampaignId']=_0x3843b1[_0xb2ae('0x25')];this['originatecalleridnum']=_0x3843b1['originatecalleridnum']||'';this[_0xb2ae('0x26')]=_0x3843b1[_0xb2ae('0x26')]||'';this['agiafterat']=_0x3843b1['agiafterat'];this[_0xb2ae('0x27')]=_0x3843b1[_0xb2ae('0x27')];this['statedesc']=_0x3843b1[_0xb2ae('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xd270=['callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','membername','reason','callback','callbackuniqueid'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd270,0xce));var _0x0d27=function(_0x39e23a,_0x17845e){_0x39e23a=_0x39e23a-0x0;var _0x40eda6=_0xd270[_0x39e23a];return _0x40eda6;};'use strict';var utils=require(_0x0d27('0x0'));function QueueCallerAbandon(_0x4dea4f,_0x5a13c3){this[_0x0d27('0x1')]=_0x4dea4f[_0x0d27('0x1')];this[_0x0d27('0x2')]=_0x4dea4f[_0x0d27('0x2')];this[_0x0d27('0x3')]=_0x4dea4f[_0x0d27('0x2')]===_0x0d27('0x4')?_0x0d27('0x5'):_0x4dea4f[_0x0d27('0x2')];this['countbusyretry']=_0x4dea4f['countbusyretry'];this[_0x0d27('0x6')]=_0x4dea4f[_0x0d27('0x6')];this[_0x0d27('0x7')]=_0x4dea4f[_0x0d27('0x7')];this[_0x0d27('0x8')]=_0x4dea4f[_0x0d27('0x9')]+_0x4dea4f[_0x0d27('0x6')]+_0x4dea4f[_0x0d27('0x7')]+_0x4dea4f['countnosuchnumberretry']+_0x4dea4f['countdropretry']+_0x4dea4f[_0x0d27('0xa')]+_0x4dea4f[_0x0d27('0xb')]+_0x4dea4f[_0x0d27('0xc')];this[_0x0d27('0xd')]=_0x4dea4f[_0x0d27('0xd')];this[_0x0d27('0xe')]=_0x4dea4f['countdropretry'];this[_0x0d27('0xa')]=_0x4dea4f['countabandonedretry'];this[_0x0d27('0xb')]=_0x4dea4f[_0x0d27('0xb')];this['countagentrejectretry']=_0x4dea4f['countagentrejectretry'];this[_0x0d27('0xf')]=_0x5a13c3[_0x0d27('0xf')];this[_0x0d27('0x10')]=_0x4dea4f['name'];this[_0x0d27('0x11')]=_0x4dea4f[_0x0d27('0x12')];this[_0x0d27('0x13')]=_0x4dea4f[_0x0d27('0x13')];this[_0x0d27('0x14')]=_0x4dea4f[_0x0d27('0x14')];this[_0x0d27('0x15')]=_0x4dea4f['droptime'];this[_0x0d27('0x16')]=_0x4dea4f[_0x0d27('0x16')];this['endtime']=this[_0x0d27('0x15')];this['ringtime']=utils[_0x0d27('0x17')](_0x4dea4f[_0x0d27('0x14')],_0x4dea4f[_0x0d27('0x13')]);this['holdtime']=utils[_0x0d27('0x17')](this[_0x0d27('0x15')],_0x4dea4f['responsetime']);this['talktime']=0x0;this[_0x0d27('0x5')]=_0x5a13c3[_0x0d27('0x5')];this[_0x0d27('0x18')]=_0x5a13c3['connectedlinename'];this[_0x0d27('0x19')]=_0x5a13c3[_0x0d27('0x19')];this[_0x0d27('0x1a')]=_0x4dea4f[_0x0d27('0x1a')];this[_0x0d27('0x1b')]=_0x4dea4f['callbackuniqueid'];this[_0x0d27('0x1c')]=_0x4dea4f[_0x0d27('0x1c')];this[_0x0d27('0x1d')]=_0x4dea4f[_0x0d27('0x1d')];this['ContactId']=_0x4dea4f['ContactId'];this['ListId']=_0x4dea4f[_0x0d27('0x1e')];this['UserId']=_0x4dea4f[_0x0d27('0x1f')];this['VoiceQueueId']=_0x4dea4f[_0x0d27('0x20')];this[_0x0d27('0x21')]=_0x4dea4f[_0x0d27('0x21')];this[_0x0d27('0x22')]=_0x4dea4f['originatecalleridnum']||'';this[_0x0d27('0x23')]=_0x4dea4f[_0x0d27('0x23')]||'';this['agiafterat']=_0x4dea4f['agiafterat'];this[_0x0d27('0x24')]=_0x4dea4f[_0x0d27('0x24')];this[_0x0d27('0x25')]=_0x4dea4f[_0x0d27('0x25')];}module[_0x0d27('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 23f565f..1c5cd3c 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82c4=['checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','temp','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer'];(function(_0x23da91,_0x36351a){var _0x1bdc73=function(_0xc553c3){while(--_0xc553c3){_0x23da91['push'](_0x23da91['shift']());}};_0x1bdc73(++_0x36351a);}(_0x82c4,0x1ca));var _0x482c=function(_0x35783b,_0x1be2fa){_0x35783b=_0x35783b-0x0;var _0x19e19b=_0x82c4[_0x35783b];return _0x19e19b;};'use strict';var util=require(_0x482c('0x0'));var logger=require(_0x482c('0x1'))(_0x482c('0x2'));var cmHopper=require(_0x482c('0x3'));var cmHopperAdditionalPhone=require(_0x482c('0x4'));var cmHopperBlack=require(_0x482c('0x5'));var cmHopperHistory=require(_0x482c('0x6'));function inspectError(_0x56de13){return util[_0x482c('0x7')](_0x56de13,{'showHidden':![],'depth':null});}function getContactDialer(_0x5f4dee,_0x4556c8,_0x47edb6){return cmHopper[_0x482c('0x8')](_0x5f4dee['id'],_0x4556c8,_0x47edb6,_0x5f4dee['dialOrderByScheduledAt'])[_0x482c('0x9')](function(_0x32a503){_0x5f4dee[_0x482c('0xa')]=0x0;logger[_0x482c('0xb')](_0x482c('0xc'),inspectError(_0x32a503));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x171c5b,_0x135cc1){return cmHopper[_0x482c('0xd')](_0x171c5b['id'],_0x135cc1,_0x171c5b[_0x482c('0xe')])[_0x482c('0x9')](function(_0x17e233){_0x171c5b['temp']=0x0;logger[_0x482c('0xb')](_0x482c('0xf'),inspectError(_0x17e233));});}exports[_0x482c('0xd')]=getContactDialerIvr;function countReScheduled(_0x5e3eea){return cmHopper[_0x482c('0x10')](_0x5e3eea)[_0x482c('0x9')](function(_0x3fabb3){logger['error']('[countReScheduled]',inspectError(_0x3fabb3));});}exports[_0x482c('0x10')]=countReScheduled;function rescheduleContact(_0x30e02b){return cmHopper['rescheduleContact'](_0x30e02b)['catch'](function(_0x14452b){logger[_0x482c('0xb')](_0x482c('0x11'),inspectError(_0x14452b));});}exports[_0x482c('0x12')]=rescheduleContact;function unlockContact(_0x37a4f0,_0x119635,_0x3beedb){return cmHopper[_0x482c('0x13')](_0x37a4f0,_0x119635,_0x3beedb)[_0x482c('0x9')](function(_0x1758fb){logger[_0x482c('0xb')](_0x482c('0x14'),inspectError(_0x1758fb));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x244bb9){return cmHopper['moveContactManagedDialer'](_0x244bb9)[_0x482c('0x9')](function(_0x258148){logger['error']('[moveContactManagedDialer]',inspectError(_0x258148));});}exports[_0x482c('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x584656){return cmHopperBlack[_0x482c('0x16')](_0x584656)[_0x482c('0x9')](function(_0x281c60){logger[_0x482c('0xb')]('[checkIsBlackList]',inspectError(_0x281c60));});}exports[_0x482c('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x22eec6){return cmHopperBlack[_0x482c('0x17')](_0x22eec6)[_0x482c('0x9')](function(_0x14d832){logger['error']('[checkIsBlackListIvr]',inspectError(_0x14d832));});}exports[_0x482c('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x147d05,_0x180feb,_0x5c4e9c){return cmHopperAdditionalPhone[_0x482c('0x18')](_0x147d05,_0x180feb,_0x5c4e9c)['catch'](function(_0x2f3f96){logger[_0x482c('0xb')]('[verifyAdditionalPhone]',inspectError(_0x2f3f96));});}exports[_0x482c('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5436e2,_0x589bc6,_0x2165af){return cmHopperAdditionalPhone[_0x482c('0x19')](_0x5436e2,_0x589bc6,_0x2165af)[_0x482c('0x9')](function(_0x1f4501){logger[_0x482c('0xb')](_0x482c('0x1a'),inspectError(_0x1f4501));});}exports[_0x482c('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x5ad788){return cmHopperHistory[_0x482c('0x1b')](_0x5ad788)[_0x482c('0x9')](function(_0x58da7c){logger[_0x482c('0xb')]('[avgHandleTime]',inspectError(_0x58da7c));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x207441){return cmHopperHistory['createHistory'](_0x207441)[_0x482c('0x9')](function(_0x2c5121){logger[_0x482c('0xb')](_0x482c('0x1c'),inspectError(_0x2c5121));});}exports[_0x482c('0x1d')]=createHistory; \ No newline at end of file +var _0x5430=['[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer'];(function(_0x16d1ff,_0x435914){var _0x386a8c=function(_0x30f70d){while(--_0x30f70d){_0x16d1ff['push'](_0x16d1ff['shift']());}};_0x386a8c(++_0x435914);}(_0x5430,0x10c));var _0x0543=function(_0x38d50f,_0x3705ab){_0x38d50f=_0x38d50f-0x0;var _0x19c03c=_0x5430[_0x38d50f];return _0x19c03c;};'use strict';var util=require(_0x0543('0x0'));var logger=require(_0x0543('0x1'))(_0x0543('0x2'));var cmHopper=require(_0x0543('0x3'));var cmHopperAdditionalPhone=require(_0x0543('0x4'));var cmHopperBlack=require(_0x0543('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x5b122c){return util[_0x0543('0x6')](_0x5b122c,{'showHidden':![],'depth':null});}function getContactDialer(_0x4ee416,_0x523f3d,_0xce0b65){return cmHopper[_0x0543('0x7')](_0x4ee416['id'],_0x523f3d,_0xce0b65,_0x4ee416[_0x0543('0x8')])[_0x0543('0x9')](function(_0x46bca7){_0x4ee416['temp']=0x0;logger[_0x0543('0xa')](_0x0543('0xb'),inspectError(_0x46bca7));});}exports[_0x0543('0x7')]=getContactDialer;function getContactDialerIvr(_0x200eb6,_0x2fb723){return cmHopper[_0x0543('0xc')](_0x200eb6['id'],_0x2fb723,_0x200eb6['dialOrderByScheduledAt'])[_0x0543('0x9')](function(_0x1ac048){_0x200eb6['temp']=0x0;logger[_0x0543('0xa')](_0x0543('0xd'),inspectError(_0x1ac048));});}exports[_0x0543('0xc')]=getContactDialerIvr;function countReScheduled(_0x43b934){return cmHopper[_0x0543('0xe')](_0x43b934)[_0x0543('0x9')](function(_0x30c54e){logger[_0x0543('0xa')](_0x0543('0xf'),inspectError(_0x30c54e));});}exports[_0x0543('0xe')]=countReScheduled;function rescheduleContact(_0x4204db){return cmHopper[_0x0543('0x10')](_0x4204db)['catch'](function(_0x4f1f2a){logger[_0x0543('0xa')]('[rescheduleContact]',inspectError(_0x4f1f2a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0xcb09df,_0x40fb03,_0x1dff7d){return cmHopper[_0x0543('0x11')](_0xcb09df,_0x40fb03,_0x1dff7d)[_0x0543('0x9')](function(_0x50d504){logger[_0x0543('0xa')](_0x0543('0x12'),inspectError(_0x50d504));});}exports[_0x0543('0x11')]=unlockContact;function moveContactManagedDialer(_0x25254e){return cmHopper[_0x0543('0x13')](_0x25254e)[_0x0543('0x9')](function(_0x577cf0){logger['error'](_0x0543('0x14'),inspectError(_0x577cf0));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x50ea84){return cmHopperBlack[_0x0543('0x15')](_0x50ea84)[_0x0543('0x9')](function(_0x1aece5){logger['error'](_0x0543('0x16'),inspectError(_0x1aece5));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x401da5){return cmHopperBlack[_0x0543('0x17')](_0x401da5)['catch'](function(_0x18dd45){logger[_0x0543('0xa')](_0x0543('0x18'),inspectError(_0x18dd45));});}exports[_0x0543('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x37347e,_0xe14f94,_0x4adba7){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x37347e,_0xe14f94,_0x4adba7)['catch'](function(_0xbfe5dc){logger[_0x0543('0xa')](_0x0543('0x19'),inspectError(_0xbfe5dc));});}exports[_0x0543('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2b1425,_0x26e500,_0x36d824){return cmHopperAdditionalPhone[_0x0543('0x1b')](_0x2b1425,_0x26e500,_0x36d824)[_0x0543('0x9')](function(_0xf1eccf){logger[_0x0543('0xa')](_0x0543('0x1c'),inspectError(_0xf1eccf));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x25e6f1){return cmHopperHistory[_0x0543('0x1d')](_0x25e6f1)[_0x0543('0x9')](function(_0x4f2592){logger[_0x0543('0xa')](_0x0543('0x1e'),inspectError(_0x4f2592));});}exports[_0x0543('0x1d')]=avgHandleTime;function createHistory(_0x10b881){return cmHopperHistory['createHistory'](_0x10b881)[_0x0543('0x9')](function(_0x10b9f3){logger['error']('[createHistory]',inspectError(_0x10b9f3));});}exports[_0x0543('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 1499336..0d3d308 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1bd=['Intervals','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Interval'];(function(_0x46ede0,_0x1b9a65){var _0x304587=function(_0x268209){while(--_0x268209){_0x46ede0['push'](_0x46ede0['shift']());}};_0x304587(++_0x1b9a65);}(_0xa1bd,0xd4));var _0xda1b=function(_0x30b6cb,_0x832e62){_0x30b6cb=_0x30b6cb-0x0;var _0x4455a1=_0xa1bd[_0x30b6cb];return _0x4455a1;};'use strict';var _=require(_0xda1b('0x0'));var moment=require(_0xda1b('0x1'));var util=require('util');var logger=require(_0xda1b('0x2'))(_0xda1b('0x3'));var timezones=require(_0xda1b('0x4'))[_0xda1b('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xda1b('0x6'),'BLACKLIST':_0xda1b('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xda1b('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xda1b('0x9'),'NO_AGENTS_LOGGED':_0xda1b('0xa'),'NO_AVAILABLE_CONTACTS':_0xda1b('0xb'),'NULL_INTERVAL':_0xda1b('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xda1b('0xd'),'QUEUE_RECALL':_0xda1b('0xe'),'RECALL_TIMEOUT':_0xda1b('0xf'),'RUNNING':_0xda1b('0x10'),'UNKNOWN_TIMEZONE':_0xda1b('0x11'),'UNREACHABLE_TRUNK':_0xda1b('0x12')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x9498ba){return _0x9498ba[_0xda1b('0x13')]==='preview';}exports[_0xda1b('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x26b32f){return _0x26b32f[_0xda1b('0x15')]===_0xda1b('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x176024){return _0x176024[_0xda1b('0x15')]===_0xda1b('0x17');}exports[_0xda1b('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x21c87a){return _0x21c87a[_0xda1b('0x19')];}exports[_0xda1b('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5d88d4){return _0x5d88d4[_0xda1b('0x1b')];}exports[_0xda1b('0x1c')]=isIVRCampaignActive;function getSeconds(_0x3ee854,_0x17bb4a){var _0x25ebb2=moment(_0x3ee854)[_0xda1b('0x1d')](0x0);var _0x481bec=moment(_0x17bb4a)[_0xda1b('0x1d')](0x0);return _0x25ebb2['diff'](_0x481bec,_0xda1b('0x1e'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x18db43,_0x405d8e){var _0x2cf8c9=![];var _0x254036=_0x18db43[_0xda1b('0x13')]!==_0x405d8e[_0xda1b('0x13')]||_0x18db43['dialActive']!==_0x405d8e[_0xda1b('0x19')]||_0x18db43[_0xda1b('0x1f')]!==_0x405d8e[_0xda1b('0x1f')];var _0x3fbd7b=_0x18db43[_0xda1b('0x20')]!==_0x405d8e['available']||_0x18db43[_0xda1b('0x21')]!==_0x405d8e[_0xda1b('0x21')]||_0x18db43[_0xda1b('0x22')]!==_0x405d8e[_0xda1b('0x22')]||_0x18db43['paused']!==_0x405d8e[_0xda1b('0x23')]||_0x18db43[_0xda1b('0x24')]!==_0x405d8e['talking']||_0x18db43['pTalking']!==_0x405d8e['pTalking']||_0x18db43[_0xda1b('0x25')]!==_0x405d8e[_0xda1b('0x25')]||_0x18db43[_0xda1b('0x26')]!==_0x405d8e[_0xda1b('0x26')]||_0x18db43[_0xda1b('0x27')]!==_0x405d8e[_0xda1b('0x27')];if(_0x18db43['Trunk']&&_0x405d8e[_0xda1b('0x28')]){_0x2cf8c9=_0x18db43[_0xda1b('0x28')]['name']!==_0x405d8e[_0xda1b('0x28')][_0xda1b('0x29')]||_0x18db43[_0xda1b('0x28')][_0xda1b('0x1b')]!==_0x405d8e['Trunk']['active'];}return _0x254036||_0x3fbd7b||_0x2cf8c9;}exports[_0xda1b('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5ed10f){var _0x59c557=null;var _0x70282e=_0x5ed10f['dialTimezone'];if(_['isNil'](_0x5ed10f[_0xda1b('0x2b')])||_[_0xda1b('0x2c')](_0x5ed10f[_0xda1b('0x2d')])||_[_0xda1b('0x2c')](_0x5ed10f[_0xda1b('0x2d')][_0xda1b('0x2e')])){_0x59c557=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x5ed10f[_0xda1b('0x2b')])||_[_0xda1b('0x2f')](_0x5ed10f[_0xda1b('0x2d')]['Intervals'])){_0x59c557=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x70282e&&!timezones[_0x70282e]){_0x59c557=CAMPAIGN_STATUS[_0xda1b('0x30')];}return _0x59c557;}function checkAnyValidTrunk(_0x57df2a,_0x2fa0ed){var _0x304e59=null;var _0x2514b5=_0xda1b('0x31');var _0x105a02=[_0xda1b('0x32'),_0xda1b('0x33')];var _0x5f03da=!![];if(_0x57df2a['Trunk']&&_0x57df2a[_0xda1b('0x28')]['active']){_0x2514b5+=_0x57df2a[_0xda1b('0x28')]['name'];_0x304e59=_0x2fa0ed[_0x2514b5];_0x5f03da=_0x105a02[_0xda1b('0x34')](_0x304e59[_0xda1b('0x35')]);}else if(_0x57df2a[_0xda1b('0x36')]&&_0x57df2a[_0xda1b('0x36')][_0xda1b('0x1b')]){_0x2514b5+=_0x57df2a[_0xda1b('0x36')][_0xda1b('0x29')];_0x304e59=_0x2fa0ed[_0x2514b5];_0x5f03da=_0x105a02['includes'](_0x304e59[_0xda1b('0x35')]);}return _0x5f03da;}function getQueueCampaignStatusMessage(_0xdeedd0,_0x390e85){var _0x480c45=CAMPAIGN_STATUS[_0xda1b('0x6')];var _0x18ceac=isPreviewCampaign(_0xdeedd0);if(!isQueueCampaignActive(_0xdeedd0)){if(_0x18ceac){_0x480c45=CAMPAIGN_STATUS[_0xda1b('0x37')];}else{if(_0xdeedd0[_0xda1b('0x27')]===0x0&&_0xdeedd0[_0xda1b('0x24')]===0x0&&_0xdeedd0[_0xda1b('0x25')]===0x0&&(_0xdeedd0['pTalking']||0x0)===0x0){_0x480c45=CAMPAIGN_STATUS[_0xda1b('0x37')];}else{_0x480c45=CAMPAIGN_STATUS[_0xda1b('0x38')];}}}else if(_0xdeedd0[_0xda1b('0x21')]===0x0){_0x480c45=CAMPAIGN_STATUS[_0xda1b('0x39')];}else if(!checkAnyValidTrunk(_0xdeedd0,_0x390e85)){_0x480c45=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0xdeedd0)){var _0x3e2a83=checkAnyValidQueueCampaignInterval(_0xdeedd0);if(_0x3e2a83){_0x480c45=_0x3e2a83;}}return _0x480c45;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x12d035){var _0xf2a319=CAMPAIGN_STATUS[_0xda1b('0x38')];if(_0x12d035[_0xda1b('0x27')]===0x0&&_0x12d035['talking']===0x0&&_0x12d035[_0xda1b('0x25')]===0x0&&(_0x12d035['pTalking']||0x0)===0x0){_0xf2a319=CAMPAIGN_STATUS[_0xda1b('0x37')];}return _0xf2a319;}exports[_0xda1b('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x560be2){var _0x3511ff=_0x560be2[_0xda1b('0x3b')](/"(.*?)"/);return _0x3511ff?_0x3511ff[0x1]:_0x560be2;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x383f9b,_0x5a1e57,_0x683bbc){if(!_[_0xda1b('0x3c')](_0x683bbc)&&typeof _0x683bbc===_0xda1b('0x3d')&&!_[_0xda1b('0x2f')](_0x683bbc)){if(!_[_0xda1b('0x3c')](_0x5a1e57)&&typeof _0x5a1e57==='string'&&!_[_0xda1b('0x2f')](_0x5a1e57)){return util[_0xda1b('0x3e')](_0xda1b('0x3f'),_0x5a1e57,_0x683bbc);}return util[_0xda1b('0x3e')](_0xda1b('0x3f'),_0x683bbc,_0x683bbc);}if(!_[_0xda1b('0x3c')](_0x383f9b)&&typeof _0x383f9b===_0xda1b('0x3d')&&!_[_0xda1b('0x2f')](_0x383f9b)){return _0x383f9b;}return _0xda1b('0x40');}exports[_0xda1b('0x41')]=getCallerId;function getCallerIdRandom(_0xf94e52,_0x447b1a){var _0x2b391c;var _0x2f2575;var _0x4c518b;if(_0x447b1a<=0x0){_0x447b1a=0x1;}_0x2b391c=new RegExp(_0xda1b('0x42')+_0x447b1a+'}$');_0x2f2575=Math[_0xda1b('0x43')](0xa,_0x447b1a-0x1);_0x4c518b=Math[_0xda1b('0x43')](0xa,_0x447b1a)-0x1;return util[_0xda1b('0x3e')]('%s',_[_0xda1b('0x44')](_0xf94e52,_0x2b391c,_[_0xda1b('0x45')](_0x2f2575,_0x4c518b)[_0xda1b('0x46')]()));}exports[_0xda1b('0x47')]=getCallerIdRandom;function decrementOriginate(_0x11ad03){if(_0x11ad03[_0xda1b('0x27')]&&_0x11ad03[_0xda1b('0x27')]>0x0){_0x11ad03[_0xda1b('0x27')]-=0x1;}else{logger[_0xda1b('0x48')](_0xda1b('0x49'));}}exports[_0xda1b('0x4a')]=decrementOriginate;function checkContactEmpty(_0x4593e3){return _0x4593e3&&_0x4593e3[_0xda1b('0x4b')]>0x0;}exports[_0xda1b('0x4c')]=checkContactEmpty;function erlangb(_0xc474e5,_0x2b7d4c){if(_0x2b7d4c===0x0){return 0x0;}var _0x35d57f=0x1;for(var _0x507336=0x1;_0x507336<=_0x2b7d4c;_0x507336+=0x1){_0x35d57f=0x1+_0x35d57f*_0x507336/_0xc474e5;}return 0x1/_0x35d57f;}exports[_0xda1b('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x485308,_0xd449ff,_0x6dbf22){if(_0xd449ff>_0x6dbf22){for(var _0x35ab55=0x0;_0x35ab55<_0xd449ff-_0x6dbf22;_0x35ab55+=0x1){decrementOriginate(_0x485308);}}}exports[_0xda1b('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x26a28b){var _0x2e6493={};var _0x362dbd=['id','createdAt',_0xda1b('0x4f'),_0xda1b('0x50')];const _0x446a8e=0xfa;if(_0x26a28b){for(var _0x4ff582 in _0x26a28b){if(typeof _0x26a28b[_0x4ff582]!==_0xda1b('0x51')){if(!_[_0xda1b('0x2c')](_0x26a28b[_0x4ff582])&&!_0x362dbd['includes'](_0x4ff582)){if(_0x4ff582===_0xda1b('0x52')&&_0x26a28b[_0x4ff582][_0xda1b('0x4b')]>_0x446a8e){_0x2e6493[_0xda1b('0x53')+_0x4ff582[_0xda1b('0x54')]()]=_0x26a28b[_0x4ff582][_0xda1b('0x46')]()[_0xda1b('0x55')](0x0,_0x446a8e);}else{_0x2e6493[_0xda1b('0x53')+_0x4ff582[_0xda1b('0x54')]()]=_0x26a28b[_0x4ff582];}}}}}return _0x2e6493;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x9504=['message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','getSeconds'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x9504,0x1d2));var _0x4950=function(_0x7bad1e,_0x5524ca){_0x7bad1e=_0x7bad1e-0x0;var _0x19730b=_0x9504[_0x7bad1e];return _0x19730b;};'use strict';var _=require(_0x4950('0x0'));var moment=require(_0x4950('0x1'));var util=require(_0x4950('0x2'));var logger=require(_0x4950('0x3'))(_0x4950('0x4'));var timezones=require('../../../../config/environment/shared')[_0x4950('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x4950('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x4950('0x7'),'DISACTIVED':_0x4950('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x4950('0x9'),'NO_AGENTS_LOGGED':_0x4950('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x4950('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x4950('0xc'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x4950('0xd'),'UNKNOWN_TIMEZONE':_0x4950('0xe'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x4950('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x93255b){return _0x93255b[_0x4950('0x10')]===_0x4950('0x11');}exports[_0x4950('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x5cdfb5){return _0x5cdfb5[_0x4950('0x13')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x47d399){return _0x47d399['type']==='outbound';}exports[_0x4950('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x3d1306){return _0x3d1306[_0x4950('0x15')];}exports[_0x4950('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2337ca){return _0x2337ca[_0x4950('0x17')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x59cb2d,_0x7fb755){var _0x2a8b96=moment(_0x59cb2d)[_0x4950('0x18')](0x0);var _0x395645=moment(_0x7fb755)['milliseconds'](0x0);return _0x2a8b96['diff'](_0x395645,'seconds');}exports[_0x4950('0x19')]=getSeconds;function hasQueueCampaignDataChanged(_0x1d1fd2,_0x53b2f5){var _0x28bed5=![];var _0x27dc9d=_0x1d1fd2[_0x4950('0x10')]!==_0x53b2f5[_0x4950('0x10')]||_0x1d1fd2[_0x4950('0x15')]!==_0x53b2f5[_0x4950('0x15')]||_0x1d1fd2[_0x4950('0x1a')]!==_0x53b2f5[_0x4950('0x1a')];var _0x25ec45=_0x1d1fd2[_0x4950('0x1b')]!==_0x53b2f5[_0x4950('0x1b')]||_0x1d1fd2[_0x4950('0x1c')]!==_0x53b2f5['loggedIn']||_0x1d1fd2[_0x4950('0x1d')]!==_0x53b2f5[_0x4950('0x1d')]||_0x1d1fd2[_0x4950('0x1e')]!==_0x53b2f5[_0x4950('0x1e')]||_0x1d1fd2[_0x4950('0x1f')]!==_0x53b2f5['talking']||_0x1d1fd2['pTalking']!==_0x53b2f5[_0x4950('0x20')]||_0x1d1fd2[_0x4950('0x21')]!==_0x53b2f5[_0x4950('0x21')]||_0x1d1fd2['inUse']!==_0x53b2f5[_0x4950('0x22')]||_0x1d1fd2[_0x4950('0x23')]!==_0x53b2f5['originated'];if(_0x1d1fd2['Trunk']&&_0x53b2f5['Trunk']){_0x28bed5=_0x1d1fd2[_0x4950('0x24')]['name']!==_0x53b2f5[_0x4950('0x24')][_0x4950('0x25')]||_0x1d1fd2['Trunk'][_0x4950('0x17')]!==_0x53b2f5[_0x4950('0x24')][_0x4950('0x17')];}return _0x27dc9d||_0x25ec45||_0x28bed5;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x541452){var _0x51c237=null;var _0x1c0101=_0x541452['dialTimezone'];if(_[_0x4950('0x26')](_0x541452[_0x4950('0x27')])||_[_0x4950('0x26')](_0x541452['Interval'])||_[_0x4950('0x26')](_0x541452[_0x4950('0x28')][_0x4950('0x29')])){_0x51c237=CAMPAIGN_STATUS[_0x4950('0x2a')];}else if(_[_0x4950('0x2b')](_0x541452[_0x4950('0x27')])||_[_0x4950('0x2b')](_0x541452['Interval'][_0x4950('0x29')])){_0x51c237=CAMPAIGN_STATUS[_0x4950('0x2c')];}else if(_0x1c0101&&!timezones[_0x1c0101]){_0x51c237=CAMPAIGN_STATUS[_0x4950('0x2d')];}return _0x51c237;}function checkAnyValidTrunk(_0x220a4f,_0x3763a8){var _0x4cfa80=null;var _0x47f4c8=_0x4950('0x2e');var _0x4d1d9d=[_0x4950('0x2f'),'unmonitored'];var _0x5dd394=!![];if(_0x220a4f[_0x4950('0x24')]&&_0x220a4f[_0x4950('0x24')][_0x4950('0x17')]){_0x47f4c8+=_0x220a4f[_0x4950('0x24')]['name'];_0x4cfa80=_0x3763a8[_0x47f4c8];_0x5dd394=_0x4d1d9d['includes'](_0x4cfa80[_0x4950('0x30')]);}else if(_0x220a4f[_0x4950('0x31')]&&_0x220a4f[_0x4950('0x31')][_0x4950('0x17')]){_0x47f4c8+=_0x220a4f[_0x4950('0x31')][_0x4950('0x25')];_0x4cfa80=_0x3763a8[_0x47f4c8];_0x5dd394=_0x4d1d9d[_0x4950('0x32')](_0x4cfa80[_0x4950('0x30')]);}return _0x5dd394;}function getQueueCampaignStatusMessage(_0xc75a81,_0x29503b){var _0x16eee0=CAMPAIGN_STATUS[_0x4950('0x6')];var _0x40210d=isPreviewCampaign(_0xc75a81);if(!isQueueCampaignActive(_0xc75a81)){if(_0x40210d){_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x33')];}else{if(_0xc75a81[_0x4950('0x23')]===0x0&&_0xc75a81[_0x4950('0x1f')]===0x0&&_0xc75a81['waiting']===0x0&&(_0xc75a81[_0x4950('0x20')]||0x0)===0x0){_0x16eee0=CAMPAIGN_STATUS['INACTIVE'];}else{_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x34')];}}}else if(_0xc75a81['loggedIn']===0x0){_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x35')];}else if(!checkAnyValidTrunk(_0xc75a81,_0x29503b)){_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x36')];}else if(!isPreviewCampaign(_0xc75a81)){var _0x153114=checkAnyValidQueueCampaignInterval(_0xc75a81);if(_0x153114){_0x16eee0=_0x153114;}}return _0x16eee0;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x12048c){var _0x15d041=CAMPAIGN_STATUS[_0x4950('0x34')];if(_0x12048c[_0x4950('0x23')]===0x0&&_0x12048c[_0x4950('0x1f')]===0x0&&_0x12048c['waiting']===0x0&&(_0x12048c[_0x4950('0x20')]||0x0)===0x0){_0x15d041=CAMPAIGN_STATUS['INACTIVE'];}return _0x15d041;}exports[_0x4950('0x37')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2b7b87){var _0x56f5c6=_0x2b7b87[_0x4950('0x38')](/"(.*?)"/);return _0x56f5c6?_0x56f5c6[0x1]:_0x2b7b87;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x249f4b,_0x290f40,_0x98af77){if(!_[_0x4950('0x39')](_0x98af77)&&typeof _0x98af77===_0x4950('0x3a')&&!_[_0x4950('0x2b')](_0x98af77)){if(!_[_0x4950('0x39')](_0x290f40)&&typeof _0x290f40==='string'&&!_[_0x4950('0x2b')](_0x290f40)){return util[_0x4950('0x3b')](_0x4950('0x3c'),_0x290f40,_0x98af77);}return util[_0x4950('0x3b')](_0x4950('0x3c'),_0x98af77,_0x98af77);}if(!_[_0x4950('0x39')](_0x249f4b)&&typeof _0x249f4b===_0x4950('0x3a')&&!_[_0x4950('0x2b')](_0x249f4b)){return _0x249f4b;}return _0x4950('0x3d');}exports[_0x4950('0x3e')]=getCallerId;function getCallerIdRandom(_0x1983ac,_0x518a8b){var _0x16f606;var _0x1d15bc;var _0x18ae29;if(_0x518a8b<=0x0){_0x518a8b=0x1;}_0x16f606=new RegExp(_0x4950('0x3f')+_0x518a8b+'}$');_0x1d15bc=Math[_0x4950('0x40')](0xa,_0x518a8b-0x1);_0x18ae29=Math[_0x4950('0x40')](0xa,_0x518a8b)-0x1;return util[_0x4950('0x3b')]('%s',_[_0x4950('0x41')](_0x1983ac,_0x16f606,_[_0x4950('0x42')](_0x1d15bc,_0x18ae29)[_0x4950('0x43')]()));}exports[_0x4950('0x44')]=getCallerIdRandom;function decrementOriginate(_0xaa8dfb){if(_0xaa8dfb['originated']&&_0xaa8dfb[_0x4950('0x23')]>0x0){_0xaa8dfb['originated']-=0x1;}else{logger[_0x4950('0x45')](_0x4950('0x46'));}}exports[_0x4950('0x47')]=decrementOriginate;function checkContactEmpty(_0xc5d3b){return _0xc5d3b&&_0xc5d3b[_0x4950('0x48')]>0x0;}exports[_0x4950('0x49')]=checkContactEmpty;function erlangb(_0x4943a0,_0x271384){if(_0x271384===0x0){return 0x0;}var _0x59b2b8=0x1;for(var _0x55cad1=0x1;_0x55cad1<=_0x271384;_0x55cad1+=0x1){_0x59b2b8=0x1+_0x59b2b8*_0x55cad1/_0x4943a0;}return 0x1/_0x59b2b8;}exports[_0x4950('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x22d208,_0xd0b97f,_0x563ed2){if(_0xd0b97f>_0x563ed2){for(var _0xaf0093=0x0;_0xaf0093<_0xd0b97f-_0x563ed2;_0xaf0093+=0x1){decrementOriginate(_0x22d208);}}}exports[_0x4950('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xeb816c){var _0x1beef1={};var _0x5d93fc=['id',_0x4950('0x4c'),_0x4950('0x4d'),'updatedAt'];const _0xfc2c3f=0xfa;if(_0xeb816c){for(var _0x25936b in _0xeb816c){if(typeof _0xeb816c[_0x25936b]!==_0x4950('0x4e')){if(!_[_0x4950('0x26')](_0xeb816c[_0x25936b])&&!_0x5d93fc[_0x4950('0x32')](_0x25936b)){if(_0x25936b===_0x4950('0x4f')&&_0xeb816c[_0x25936b][_0x4950('0x48')]>_0xfc2c3f){_0x1beef1['XMD-'+_0x25936b[_0x4950('0x50')]()]=_0xeb816c[_0x25936b][_0x4950('0x43')]()['substring'](0x0,_0xfc2c3f);}else{_0x1beef1['XMD-'+_0x25936b['toUpperCase']()]=_0xeb816c[_0x25936b];}}}}}return _0x1beef1;}exports[_0x4950('0x51')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 32db508..359aaad 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(_0x44e3b4,_0x31d51b){var _0x2185c3=function(_0x4f871e){while(--_0x4f871e){_0x44e3b4['push'](_0x44e3b4['shift']());}};_0x2185c3(++_0x31d51b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x5d2918,_0x3189a0){var _0x319ea0=function(_0x111ca2){while(--_0x111ca2){_0x5d2918['push'](_0x5d2918['shift']());}};_0x319ea0(++_0x3189a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 5aff4a9..bf93e4a 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 _0x0bf9=['logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','info','syncVarSet','variable','value','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','notify','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','response','reason','AttachmentId','SENDING\x20FAILED\x20','then'];(function(_0x2c63ac,_0x1df97a){var _0xdf3040=function(_0x4c8f63){while(--_0x4c8f63){_0x2c63ac['push'](_0x2c63ac['shift']());}};_0xdf3040(++_0x1df97a);}(_0x0bf9,0xab));var _0x90bf=function(_0x490b43,_0x108f4e){_0x490b43=_0x490b43-0x0;var _0xb0a1f7=_0x0bf9[_0x490b43];return _0xb0a1f7;};'use strict';var util=require(_0x90bf('0x0'));var _=require('lodash');var BPromise=require(_0x90bf('0x1'));var uuid=require('uuid');var moment=require(_0x90bf('0x2'));var path=require(_0x90bf('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x90bf('0x4'));var logger=require(_0x90bf('0x5'))(_0x90bf('0x6'));var ami=require('../ami');var rpcDb=require(_0x90bf('0x7'));var Channel=require(_0x90bf('0x8'));var ut=require(_0x90bf('0x9'));var Action=require('./action');var faxAccount=require(_0x90bf('0xa'));var attachment=require(_0x90bf('0xb'));var faxMessage=require(_0x90bf('0xc'));function Fax(_0x285b86){this[_0x90bf('0xd')]={};this[_0x90bf('0xe')]=_0x285b86['faxAccounts'];this['trunks']=_0x285b86['trunks'];this[_0x90bf('0xf')]={};ami['on'](_0x90bf('0x10'),this[_0x90bf('0x11')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x90bf('0x12')](this));ami['on'](_0x90bf('0x13'),this[_0x90bf('0x14')]['bind'](this));ami['on'](_0x90bf('0x15'),this[_0x90bf('0x16')][_0x90bf('0x12')](this));ami['on'](_0x90bf('0x17'),this[_0x90bf('0x18')][_0x90bf('0x12')](this));ami['on'](_0x90bf('0x19'),this[_0x90bf('0x1a')][_0x90bf('0x12')](this));ami['on']('hangup',this[_0x90bf('0x1b')][_0x90bf('0x12')](this));ami['on'](_0x90bf('0x1c'),this[_0x90bf('0x1d')][_0x90bf('0x12')](this));}Fax[_0x90bf('0x1e')][_0x90bf('0x11')]=function(_0x3e6de5){if(_0x3e6de5[_0x90bf('0x1f')]===_0x90bf('0x20')){for(var _0x261a84 in this[_0x90bf('0xe')]){if(this[_0x90bf('0xe')][_0x90bf('0x21')](_0x261a84)){if(_0x3e6de5[_0x90bf('0x22')]===this[_0x90bf('0xe')][_0x261a84]['localstationid']){this['channels'][_0x3e6de5[_0x90bf('0x23')]]={};this[_0x90bf('0xd')][_0x3e6de5[_0x90bf('0x23')]][_0x90bf('0x24')]=_0x3e6de5[_0x90bf('0x24')];this['channels'][_0x3e6de5['uniqueid']]['id']=this[_0x90bf('0xe')][_0x261a84]['id'];this[_0x90bf('0xd')][_0x3e6de5[_0x90bf('0x23')]][_0x90bf('0x25')]=this['faxAccounts'][_0x261a84][_0x90bf('0x25')];logger['info'](_0x3e6de5['uniqueid'],_0x90bf('0x26'));}}}}if(this[_0x90bf('0xf')][_0x3e6de5[_0x90bf('0x23')]]){this['channels'][_0x3e6de5[_0x90bf('0x23')]]={};this[_0x90bf('0xd')][_0x3e6de5[_0x90bf('0x23')]][_0x90bf('0x24')]=_0x3e6de5['channel'];logger[_0x90bf('0x27')](_0x3e6de5[_0x90bf('0x23')],_0x90bf('0x26'));}};Fax[_0x90bf('0x1e')][_0x90bf('0x28')]=function(_0x288786){if(this[_0x90bf('0xd')][_0x288786[_0x90bf('0x23')]]){for(var _0x60ad7d in _0x288786[_0x90bf('0x29')]){if(_0x288786[_0x90bf('0x29')][_0x90bf('0x21')](_0x60ad7d)){this[_0x90bf('0xd')][_0x288786[_0x90bf('0x23')]][_0x60ad7d]=_0x288786[_0x90bf('0x2a')];}}}};Fax['prototype'][_0x90bf('0x14')]=function(_0x4ca657){if(this[_0x90bf('0xd')][_0x4ca657[_0x90bf('0x23')]]){this[_0x90bf('0xd')][_0x4ca657[_0x90bf('0x23')]]['channelstate']=_0x4ca657['channelstate'];this[_0x90bf('0xd')][_0x4ca657[_0x90bf('0x23')]][_0x90bf('0x2b')]=_0x4ca657[_0x90bf('0x2b')];}};Fax[_0x90bf('0x1e')][_0x90bf('0x16')]=function(_0x357209){if(this[_0x90bf('0xd')][_0x357209['uniqueid']]){for(var _0x52edb7 in _0x357209[_0x90bf('0x29')]){if(_0x357209['variable'][_0x90bf('0x21')](_0x52edb7)){this['channels'][_0x357209['uniqueid']][_0x52edb7]=_0x357209[_0x90bf('0x2a')];}}}};Fax[_0x90bf('0x1e')][_0x90bf('0x18')]=function(_0x4a0ef4){if(this['channels'][_0x4a0ef4['uniqueid']]){this[_0x90bf('0xd')][_0x4a0ef4[_0x90bf('0x23')]][_0x90bf('0x2c')]=_0x4a0ef4['operation'];this['channels'][_0x4a0ef4[_0x90bf('0x23')]][_0x90bf('0x2d')]=_0x4a0ef4[_0x90bf('0x2d')];this[_0x90bf('0xd')][_0x4a0ef4['uniqueid']][_0x90bf('0x2e')]=_0x4a0ef4['localstationid'];this[_0x90bf('0xd')][_0x4a0ef4['uniqueid']][_0x90bf('0x2f')]=_0x4a0ef4[_0x90bf('0x2f')];logger[_0x90bf('0x27')](_0x4a0ef4[_0x90bf('0x23')],_0x90bf('0x30'));}};Fax[_0x90bf('0x1e')][_0x90bf('0x1a')]=function(_0x4c3dc4){var _0x4f6e53=this;if(this[_0x90bf('0xd')][_0x4c3dc4[_0x90bf('0x23')]]){var _0x5508a6=this['channels'][_0x4c3dc4[_0x90bf('0x23')]]['id'];this['channels'][_0x4c3dc4[_0x90bf('0x23')]][_0x90bf('0x31')]=_0x4c3dc4[_0x90bf('0x31')];this['channels'][_0x4c3dc4[_0x90bf('0x23')]][_0x90bf('0x32')]=_0x4c3dc4['pagestransferred'];this['channels'][_0x4c3dc4[_0x90bf('0x23')]][_0x90bf('0x2e')]=_0x4c3dc4[_0x90bf('0x2e')];this[_0x90bf('0xd')][_0x4c3dc4[_0x90bf('0x23')]]['resolution']=_0x4c3dc4[_0x90bf('0x33')];this['channels'][_0x4c3dc4[_0x90bf('0x23')]]['transferrate']=_0x4c3dc4['transferrate'];this[_0x90bf('0xd')][_0x4c3dc4[_0x90bf('0x23')]][_0x90bf('0x2f')]=_0x4c3dc4['filename'];this['channels'][_0x4c3dc4['uniqueid']]['calleridnum']=_0x4c3dc4[_0x90bf('0x34')];if(this[_0x90bf('0xd')][_0x4c3dc4[_0x90bf('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x4c3dc4['filename'],_0x90bf('0x35'),function(_0xb973ec){logger[_0x90bf('0x27')](_0x4c3dc4[_0x90bf('0x23')],'\x20result\x20conversion\x20file\x20',_0xb973ec[_0x90bf('0x36')]);attachment[_0x90bf('0x37')]({'name':path[_0x90bf('0x38')](_0x4c3dc4[_0x90bf('0x2f')])['name'],'basename':path['parse'](_0x4c3dc4[_0x90bf('0x2f')])[_0x90bf('0x25')]+'.pdf','type':_0x90bf('0x39')})['then'](function(_0xe85207){faxAccount[_0x90bf('0x3a')](_0x5508a6,{'from':_0x4c3dc4[_0x90bf('0x34')],'mapKey':'fax','body':path[_0x90bf('0x38')](_0x4c3dc4[_0x90bf('0x2f')])[_0x90bf('0x25')]+_0x90bf('0x3b'),'AttachmentId':_0xe85207['id']})[_0x90bf('0x3c')](function(_0x928e29){logger['error'](_0x4c3dc4[_0x90bf('0x23')],_0x90bf('0x3d'),JSON[_0x90bf('0x3e')](_0x928e29));});})[_0x90bf('0x3c')](function(_0x469a35){logger[_0x90bf('0x3f')](_0x4c3dc4[_0x90bf('0x23')],_0x90bf('0x40'),JSON[_0x90bf('0x3e')](_0x469a35));});});}logger[_0x90bf('0x27')](_0x4c3dc4[_0x90bf('0x23')],'\x20receiveFax\x20');}};Fax[_0x90bf('0x1e')][_0x90bf('0x1d')]=function(_0x457935){if(this['actions'][_0x457935[_0x90bf('0x23')]]){_[_0x90bf('0x41')](this['channels'][_0x457935[_0x90bf('0x23')]],_['pick'](_0x457935,[_0x90bf('0x42'),_0x90bf('0x43')]));}};function updateStatus(_0x3a03bc){if(_0x3a03bc[_0x90bf('0x44')]){faxMessage['update'](_0x3a03bc['AttachmentId'],{'failMessage':_0x90bf('0x45')})[_0x90bf('0x46')](function(_0x1cc43e){ut[_0x90bf('0x47')](_0x90bf('0x48'),_0x1cc43e);})[_0x90bf('0x3c')](function(_0xe4a0fd){ut['logger'](_0x90bf('0x49'),_0xe4a0fd);});}else{ut[_0x90bf('0x47')](_0x90bf('0x4a'));}}Fax['prototype']['updateStatus']=function(_0x4623f5,_0x28c886,_0xe5c0d){var _0x90f2b1=this;var _0x24cdd6={};if(_0x28c886){_0x24cdd6={'read':_0x28c886};}else{_0x24cdd6={'failMessage':_0xe5c0d};}if(this[_0x90bf('0xf')][_0x4623f5][_0x90bf('0x44')]){faxMessage[_0x90bf('0x4b')](this[_0x90bf('0xf')][_0x4623f5][_0x90bf('0x44')],_0x24cdd6)[_0x90bf('0x46')](function(_0x275be4){ut['logger'](_0x90bf('0x4c'),_0x275be4);})[_0x90bf('0x3c')](function(_0x325d76){ut[_0x90bf('0x47')](_0x90bf('0x4d'),_0x325d76);})[_0x90bf('0x4e')](function(){delete _0x90f2b1[_0x90bf('0xd')][_0x4623f5];delete _0x90f2b1[_0x90bf('0xf')][_0x4623f5];});}else{ut[_0x90bf('0x47')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x4623f5];delete this[_0x90bf('0xf')][_0x4623f5];}};Fax['prototype'][_0x90bf('0x1b')]=function(_0x32eed9){var _0x5942b9=this;if(this[_0x90bf('0xd')][_0x32eed9[_0x90bf('0x23')]]){if(this[_0x90bf('0xf')][_0x32eed9[_0x90bf('0x23')]]){this[_0x90bf('0xd')][_0x32eed9[_0x90bf('0x23')]]['id']=this[_0x90bf('0xf')][_0x32eed9['uniqueid']]['id'];this[_0x90bf('0xd')][_0x32eed9[_0x90bf('0x23')]][_0x90bf('0x25')]=this[_0x90bf('0xf')][_0x32eed9[_0x90bf('0x23')]]['name'];}logger['info'](_0x32eed9[_0x90bf('0x23')],this[_0x90bf('0xf')][_0x32eed9[_0x90bf('0x23')]]?'\x20hangup\x20sendFile\x20':_0x90bf('0x4f'),JSON[_0x90bf('0x3e')](this[_0x90bf('0xd')][_0x32eed9['uniqueid']]));if(this['actions'][_0x32eed9[_0x90bf('0x23')]]){if(this[_0x90bf('0xd')][_0x32eed9[_0x90bf('0x23')]][_0x90bf('0x50')]>0x0&&this[_0x90bf('0xd')][_0x32eed9[_0x90bf('0x23')]][_0x90bf('0x17')]==='SUCCESS'){this['updateStatus'](_0x32eed9['uniqueid'],!![]);}else{this[_0x90bf('0x51')](_0x32eed9[_0x90bf('0x23')],![],this[_0x90bf('0xd')][_0x32eed9[_0x90bf('0x23')]][_0x90bf('0x52')]?_0x90bf('0x53')+this['channels'][_0x32eed9[_0x90bf('0x23')]]['faxstatusstring']:_0x90bf('0x54'));}}}};Fax[_0x90bf('0x1e')][_0x90bf('0x55')]=function(_0x4fbf08){var _0x15e93f=this;return new BPromise(function(_0x23dfd2,_0xaf85a6){_0x15e93f[_0x90bf('0x56')](_0x4fbf08,_0x15e93f['faxAccounts'][_0x4fbf08['FaxAccountId']])['then'](function(_0x1286d6){ut[_0x90bf('0x47')](_0x90bf('0x57'),_0x1286d6);_0x23dfd2(ut[_0x90bf('0x36')](_0x90bf('0x58')));})[_0x90bf('0x3c')](function(_0x5382c3){ut[_0x90bf('0x47')](_0x90bf('0x59'),_0x5382c3);updateStatus(_0x4fbf08);_0xaf85a6(ut[_0x90bf('0x36')](_0x90bf('0x5a')));});});};Fax[_0x90bf('0x1e')][_0x90bf('0x5b')]=function(_0x2e52d6){var _0x3daff6=this;return new BPromise(function(_0x126062,_0x7fb594){var _0x56dc87=_0x3daff6['checkTrunk'](_0x3daff6['faxAccounts'][_0x2e52d6[_0x90bf('0x5c')]][_0x90bf('0x5d')],_0x2e52d6);if(_0x56dc87[_0x90bf('0x5e')]){_0x126062(ut[_0x90bf('0x36')](_0x90bf('0x5f')));}else{_0x7fb594(ut[_0x90bf('0x36')](_0x56dc87[_0x90bf('0x36')]));}});};function originate(_0x1f4778,_0x2589ad,_0x13ed9b){return new BPromise(function(_0x31eb4a,_0x591969){if(_0x13ed9b){var _0x4e1229=util[_0x90bf('0x60')](_0x90bf('0x61'),path[_0x90bf('0x38')](_0x1f4778[_0x90bf('0x3')])['name'],_0x1f4778[_0x90bf('0x3')]);gs[_0x90bf('0x62')](_0x4e1229)[_0x90bf('0x46')](function(){_0x1f4778[_0x90bf('0x3')]=util[_0x90bf('0x60')](_0x90bf('0x63'),path[_0x90bf('0x38')](_0x1f4778[_0x90bf('0x3')])[_0x90bf('0x64')],path[_0x90bf('0x38')](_0x1f4778[_0x90bf('0x3')])[_0x90bf('0x25')]);_0x2589ad[_0x90bf('0x65')]=_0x1f4778[_0x90bf('0x3')];ut['logger'](_0x90bf('0x66'),'');ami[_0x90bf('0x67')](ut[_0x90bf('0x68')](_0x1f4778,_0x2589ad))[_0x90bf('0x46')](function(_0x319c1a){_0x31eb4a(_0x319c1a);})[_0x90bf('0x3c')](function(_0x52d7c5){_0x591969(_0x52d7c5);});})[_0x90bf('0x3c')](function(_0x5f4a55){_0x591969(_0x5f4a55);});}else{ami[_0x90bf('0x67')](ut['variablesAction'](_0x1f4778,_0x2589ad))['then'](function(_0x23f40e){_0x31eb4a(_0x23f40e);})[_0x90bf('0x3c')](function(_0x2925eb){_0x591969(_0x2925eb);});}});}Fax[_0x90bf('0x1e')]['execOriginate']=function(_0x3ff091,_0x52052f){var _0x41003a=this;return new BPromise(function(_0x1b7487,_0x42648e){var _0x412718=uuid['v4']();var _0x454818=ut[_0x90bf('0x69')](_0x3ff091,_0x52052f);_0x41003a['actions'][_0x412718]=new Action(_0x412718,_0x52052f,_0x3ff091);var _0x4fef68=_0x41003a[_0x90bf('0xf')][_0x412718];if(path[_0x90bf('0x38')](_0x3ff091['path'])['ext']===_0x90bf('0x3b')){originate(_0x4fef68,_0x454818,!![])[_0x90bf('0x46')](function(_0x598f39){_0x1b7487(_0x598f39);})[_0x90bf('0x3c')](function(_0x1ebf12){_0x42648e(_0x1ebf12);});}else{originate(_0x4fef68,_0x454818,![])['then'](function(_0x3986fd){_0x1b7487(_0x3986fd);})[_0x90bf('0x3c')](function(_0xbc4908){_0x42648e(_0xbc4908);});}});};Fax[_0x90bf('0x1e')][_0x90bf('0x6a')]=function(_0x1f436a){return!_['isNil'](_0x1f436a)&&!_[_0x90bf('0x6b')](_0x1f436a[_0x90bf('0x25')])&&!_[_0x90bf('0x6b')](_0x1f436a[_0x90bf('0x6c')])&&_0x1f436a[_0x90bf('0x6c')]&&!_[_0x90bf('0x6b')](this[_0x90bf('0x6d')][util[_0x90bf('0x60')](_0x90bf('0x6e'),_0x1f436a[_0x90bf('0x25')])])&&!_[_0x90bf('0x6b')](this[_0x90bf('0x6d')][util[_0x90bf('0x60')](_0x90bf('0x6e'),_0x1f436a[_0x90bf('0x25')])]['status'])&&(this['trunks'][util['format'](_0x90bf('0x6e'),_0x1f436a[_0x90bf('0x25')])]['status']===_0x90bf('0x6f')||this[_0x90bf('0x6d')][util[_0x90bf('0x60')](_0x90bf('0x6e'),_0x1f436a[_0x90bf('0x25')])][_0x90bf('0x2d')]===_0x90bf('0x70'));};Fax[_0x90bf('0x1e')][_0x90bf('0x71')]=function(_0x4a369b,_0x4049b8){if(!this[_0x90bf('0x6a')](_0x4a369b)){ut[_0x90bf('0x47')](_0x90bf('0x72'),_[_0x90bf('0x6b')](_0x4a369b)?'':_0x4a369b[_0x90bf('0x25')]+_0x90bf('0x73'));return{'isValid':![],'message':_0x90bf('0x74')};}if(_[_0x90bf('0x6b')](_0x4049b8[_0x90bf('0x6')])){ut[_0x90bf('0x47')](_0x90bf('0x75'),JSON[_0x90bf('0x3e')](_0x4049b8));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x90bf('0x6b')](_0x4049b8[_0x90bf('0x3')])){ut[_0x90bf('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x4049b8));return{'isValid':![],'message':_0x90bf('0x76')};}return{'isValid':!![],'message':_0x90bf('0x77')};};module[_0x90bf('0x78')]=Fax; \ No newline at end of file +var _0x740d=['../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','prototype','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','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','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','format','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action'];(function(_0x34ec60,_0x443acc){var _0x409bea=function(_0x54ab89){while(--_0x54ab89){_0x34ec60['push'](_0x34ec60['shift']());}};_0x409bea(++_0x443acc);}(_0x740d,0x1dc));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xd740('0x0'));var _=require(_0xd740('0x1'));var BPromise=require(_0xd740('0x2'));var uuid=require('uuid');var moment=require(_0xd740('0x3'));var path=require(_0xd740('0x4'));var tiff2pdf=require(_0xd740('0x5'));var gs=require(_0xd740('0x6'));var logger=require(_0xd740('0x7'))(_0xd740('0x8'));var ami=require(_0xd740('0x9'));var rpcDb=require(_0xd740('0xa'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xd740('0xb'));var faxAccount=require(_0xd740('0xc'));var attachment=require(_0xd740('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x19f942){this[_0xd740('0xe')]={};this[_0xd740('0xf')]=_0x19f942['faxAccounts'];this[_0xd740('0x10')]=_0x19f942[_0xd740('0x10')];this['actions']={};ami['on'](_0xd740('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0xd740('0x12'),this[_0xd740('0x13')][_0xd740('0x14')](this));ami['on'](_0xd740('0x15'),this[_0xd740('0x16')][_0xd740('0x14')](this));ami['on'](_0xd740('0x17'),this[_0xd740('0x18')][_0xd740('0x14')](this));ami['on'](_0xd740('0x19'),this[_0xd740('0x1a')]['bind'](this));ami['on']('receivefax',this[_0xd740('0x1b')][_0xd740('0x14')](this));ami['on'](_0xd740('0x1c'),this[_0xd740('0x1d')][_0xd740('0x14')](this));ami['on'](_0xd740('0x1e'),this['syncOriginateResponse'][_0xd740('0x14')](this));}Fax['prototype'][_0xd740('0x1f')]=function(_0x3b8bde){if(_0x3b8bde[_0xd740('0x20')]===_0xd740('0x21')){for(var _0x3cb45e in this['faxAccounts']){if(this[_0xd740('0xf')][_0xd740('0x22')](_0x3cb45e)){if(_0x3b8bde[_0xd740('0x23')]===this[_0xd740('0xf')][_0x3cb45e][_0xd740('0x24')]){this['channels'][_0x3b8bde[_0xd740('0x25')]]={};this[_0xd740('0xe')][_0x3b8bde[_0xd740('0x25')]]['channel']=_0x3b8bde[_0xd740('0x26')];this[_0xd740('0xe')][_0x3b8bde[_0xd740('0x25')]]['id']=this[_0xd740('0xf')][_0x3cb45e]['id'];this['channels'][_0x3b8bde[_0xd740('0x25')]][_0xd740('0x27')]=this[_0xd740('0xf')][_0x3cb45e][_0xd740('0x27')];logger[_0xd740('0x28')](_0x3b8bde[_0xd740('0x25')],_0xd740('0x29'));}}}}if(this[_0xd740('0x2a')][_0x3b8bde[_0xd740('0x25')]]){this[_0xd740('0xe')][_0x3b8bde['uniqueid']]={};this[_0xd740('0xe')][_0x3b8bde[_0xd740('0x25')]]['channel']=_0x3b8bde[_0xd740('0x26')];logger[_0xd740('0x28')](_0x3b8bde[_0xd740('0x25')],_0xd740('0x29'));}};Fax['prototype'][_0xd740('0x13')]=function(_0x1fc31b){if(this[_0xd740('0xe')][_0x1fc31b[_0xd740('0x25')]]){for(var _0x5432ee in _0x1fc31b[_0xd740('0x2b')]){if(_0x1fc31b[_0xd740('0x2b')]['hasOwnProperty'](_0x5432ee)){this[_0xd740('0xe')][_0x1fc31b['uniqueid']][_0x5432ee]=_0x1fc31b['value'];}}}};Fax[_0xd740('0x2c')][_0xd740('0x16')]=function(_0x3f02d5){if(this[_0xd740('0xe')][_0x3f02d5['uniqueid']]){this[_0xd740('0xe')][_0x3f02d5[_0xd740('0x25')]][_0xd740('0x2d')]=_0x3f02d5[_0xd740('0x2d')];this[_0xd740('0xe')][_0x3f02d5[_0xd740('0x25')]][_0xd740('0x2e')]=_0x3f02d5[_0xd740('0x2e')];}};Fax[_0xd740('0x2c')][_0xd740('0x18')]=function(_0x38eeb0){if(this['channels'][_0x38eeb0[_0xd740('0x25')]]){for(var _0x20a67b in _0x38eeb0[_0xd740('0x2b')]){if(_0x38eeb0[_0xd740('0x2b')][_0xd740('0x22')](_0x20a67b)){this[_0xd740('0xe')][_0x38eeb0[_0xd740('0x25')]][_0x20a67b]=_0x38eeb0[_0xd740('0x2f')];}}}};Fax[_0xd740('0x2c')][_0xd740('0x1a')]=function(_0x425599){if(this[_0xd740('0xe')][_0x425599['uniqueid']]){this[_0xd740('0xe')][_0x425599[_0xd740('0x25')]]['operation']=_0x425599[_0xd740('0x30')];this[_0xd740('0xe')][_0x425599[_0xd740('0x25')]][_0xd740('0x31')]=_0x425599[_0xd740('0x31')];this[_0xd740('0xe')][_0x425599[_0xd740('0x25')]][_0xd740('0x24')]=_0x425599[_0xd740('0x24')];this['channels'][_0x425599['uniqueid']][_0xd740('0x32')]=_0x425599['filename'];logger[_0xd740('0x28')](_0x425599[_0xd740('0x25')],_0xd740('0x33'));}};Fax[_0xd740('0x2c')][_0xd740('0x1b')]=function(_0x2a7c1b){var _0x3db71b=this;if(this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]){var _0x12e1e3=this['channels'][_0x2a7c1b[_0xd740('0x25')]]['id'];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]][_0xd740('0x34')]=_0x2a7c1b[_0xd740('0x34')];this[_0xd740('0xe')][_0x2a7c1b['uniqueid']][_0xd740('0x35')]=_0x2a7c1b[_0xd740('0x35')];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]['localstationid']=_0x2a7c1b[_0xd740('0x24')];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]['resolution']=_0x2a7c1b['resolution'];this['channels'][_0x2a7c1b[_0xd740('0x25')]][_0xd740('0x36')]=_0x2a7c1b[_0xd740('0x36')];this['channels'][_0x2a7c1b[_0xd740('0x25')]][_0xd740('0x32')]=_0x2a7c1b[_0xd740('0x32')];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]['calleridnum']=_0x2a7c1b[_0xd740('0x37')];if(this[_0xd740('0xe')][_0x2a7c1b['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x2a7c1b[_0xd740('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x4431a4){logger[_0xd740('0x28')](_0x2a7c1b['uniqueid'],_0xd740('0x38'),_0x4431a4[_0xd740('0x39')]);attachment['create']({'name':path[_0xd740('0x3a')](_0x2a7c1b['filename'])[_0xd740('0x27')],'basename':path['parse'](_0x2a7c1b[_0xd740('0x32')])[_0xd740('0x27')]+_0xd740('0x3b'),'type':_0xd740('0x3c')})['then'](function(_0xb64c85){faxAccount[_0xd740('0x3d')](_0x12e1e3,{'from':_0x2a7c1b[_0xd740('0x37')],'mapKey':'fax','body':path[_0xd740('0x3a')](_0x2a7c1b[_0xd740('0x32')])[_0xd740('0x27')]+_0xd740('0x3b'),'AttachmentId':_0xb64c85['id']})['catch'](function(_0x3b2393){logger[_0xd740('0x3e')](_0x2a7c1b[_0xd740('0x25')],_0xd740('0x3f'),JSON[_0xd740('0x40')](_0x3b2393));});})[_0xd740('0x41')](function(_0x181404){logger[_0xd740('0x3e')](_0x2a7c1b[_0xd740('0x25')],_0xd740('0x42'),JSON[_0xd740('0x40')](_0x181404));});});}logger[_0xd740('0x28')](_0x2a7c1b['uniqueid'],_0xd740('0x42'));}};Fax[_0xd740('0x2c')][_0xd740('0x43')]=function(_0x239837){if(this[_0xd740('0x2a')][_0x239837[_0xd740('0x25')]]){_[_0xd740('0x44')](this['channels'][_0x239837[_0xd740('0x25')]],_[_0xd740('0x45')](_0x239837,[_0xd740('0x46'),_0xd740('0x47')]));}};function updateStatus(_0xf15154){if(_0xf15154[_0xd740('0x48')]){faxMessage[_0xd740('0x49')](_0xf15154[_0xd740('0x48')],{'failMessage':_0xd740('0x4a')})[_0xd740('0x4b')](function(_0x2ebd90){ut['logger'](_0xd740('0x4c'),_0x2ebd90);})['catch'](function(_0x1a5e9d){ut[_0xd740('0x4d')](_0xd740('0x4e'),_0x1a5e9d);});}else{ut[_0xd740('0x4d')](_0xd740('0x4f'));}}Fax[_0xd740('0x2c')][_0xd740('0x50')]=function(_0x377b1d,_0x2f4ef8,_0x1b484f){var _0x5ad062=this;var _0x3180bb={};if(_0x2f4ef8){_0x3180bb={'read':_0x2f4ef8};}else{_0x3180bb={'failMessage':_0x1b484f};}if(this[_0xd740('0x2a')][_0x377b1d][_0xd740('0x48')]){faxMessage[_0xd740('0x49')](this[_0xd740('0x2a')][_0x377b1d][_0xd740('0x48')],_0x3180bb)[_0xd740('0x4b')](function(_0x4af9f5){ut[_0xd740('0x4d')](_0xd740('0x51'),_0x4af9f5);})['catch'](function(_0x20e99a){ut['logger'](_0xd740('0x52'),_0x20e99a);})[_0xd740('0x53')](function(){delete _0x5ad062[_0xd740('0xe')][_0x377b1d];delete _0x5ad062[_0xd740('0x2a')][_0x377b1d];});}else{ut[_0xd740('0x4d')](_0xd740('0x54'));delete this[_0xd740('0xe')][_0x377b1d];delete this['actions'][_0x377b1d];}};Fax['prototype']['syncHangup']=function(_0x50ab54){var _0x143f74=this;if(this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]]){if(this['actions'][_0x50ab54['uniqueid']]){this['channels'][_0x50ab54[_0xd740('0x25')]]['id']=this[_0xd740('0x2a')][_0x50ab54[_0xd740('0x25')]]['id'];this['channels'][_0x50ab54['uniqueid']]['name']=this[_0xd740('0x2a')][_0x50ab54['uniqueid']][_0xd740('0x27')];}logger[_0xd740('0x28')](_0x50ab54[_0xd740('0x25')],this[_0xd740('0x2a')][_0x50ab54[_0xd740('0x25')]]?_0xd740('0x55'):_0xd740('0x56'),JSON[_0xd740('0x40')](this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]]));if(this[_0xd740('0x2a')][_0x50ab54[_0xd740('0x25')]]){if(this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x57')]>0x0&&this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x19')]==='SUCCESS'){this[_0xd740('0x50')](_0x50ab54[_0xd740('0x25')],!![]);}else{this[_0xd740('0x50')](_0x50ab54[_0xd740('0x25')],![],this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x58')]?_0xd740('0x59')+this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x58')]:_0xd740('0x5a'));}}}};Fax[_0xd740('0x2c')][_0xd740('0x5b')]=function(_0x3b1f94){var _0x5d57c8=this;return new BPromise(function(_0x23e6a0,_0x271487){_0x5d57c8[_0xd740('0x5c')](_0x3b1f94,_0x5d57c8[_0xd740('0xf')][_0x3b1f94[_0xd740('0x5d')]])[_0xd740('0x4b')](function(_0x13e54c){ut[_0xd740('0x4d')]('[Fax][execOriginate][success]',_0x13e54c);_0x23e6a0(ut[_0xd740('0x39')]('Fax\x20received'));})[_0xd740('0x41')](function(_0x52fb58){ut['logger']('[Fax][execOriginate][failure]',_0x52fb58);updateStatus(_0x3b1f94);_0x271487(ut['message'](_0xd740('0x5e')));});});};Fax['prototype'][_0xd740('0x5f')]=function(_0x113c46){var _0x46c86c=this;return new BPromise(function(_0x2b6807,_0x148e11){var _0x33dc51=_0x46c86c[_0xd740('0x60')](_0x46c86c[_0xd740('0xf')][_0x113c46[_0xd740('0x5d')]][_0xd740('0x61')],_0x113c46);if(_0x33dc51['isValid']){_0x2b6807(ut[_0xd740('0x39')](_0xd740('0x62')));}else{_0x148e11(ut[_0xd740('0x39')](_0x33dc51[_0xd740('0x39')]));}});};function originate(_0x13a679,_0x341267,_0x4470b8){return new BPromise(function(_0x65f26f,_0xb29e8a){if(_0x4470b8){var _0x11f8c1=util['format'](_0xd740('0x63'),path[_0xd740('0x3a')](_0x13a679['path'])[_0xd740('0x27')],_0x13a679['path']);gs['execute'](_0x11f8c1)[_0xd740('0x4b')](function(){_0x13a679['path']=util['format'](_0xd740('0x64'),path[_0xd740('0x3a')](_0x13a679[_0xd740('0x4')])[_0xd740('0x65')],path[_0xd740('0x3a')](_0x13a679[_0xd740('0x4')])[_0xd740('0x27')]);_0x341267['XMF-PATH']=_0x13a679[_0xd740('0x4')];ut[_0xd740('0x4d')](_0xd740('0x66'),'');ami[_0xd740('0x67')](ut[_0xd740('0x68')](_0x13a679,_0x341267))[_0xd740('0x4b')](function(_0x2c6c17){_0x65f26f(_0x2c6c17);})['catch'](function(_0x2cf779){_0xb29e8a(_0x2cf779);});})[_0xd740('0x41')](function(_0x2829f8){_0xb29e8a(_0x2829f8);});}else{ami[_0xd740('0x67')](ut[_0xd740('0x68')](_0x13a679,_0x341267))[_0xd740('0x4b')](function(_0x2added){_0x65f26f(_0x2added);})[_0xd740('0x41')](function(_0x333ecb){_0xb29e8a(_0x333ecb);});}});}Fax[_0xd740('0x2c')][_0xd740('0x5c')]=function(_0x4a3c45,_0x477312){var _0x516c78=this;return new BPromise(function(_0x12fe74,_0x40ea0d){var _0x5f59ef=uuid['v4']();var _0x3bf22=ut[_0xd740('0x69')](_0x4a3c45,_0x477312);_0x516c78[_0xd740('0x2a')][_0x5f59ef]=new Action(_0x5f59ef,_0x477312,_0x4a3c45);var _0x52af2b=_0x516c78[_0xd740('0x2a')][_0x5f59ef];if(path[_0xd740('0x3a')](_0x4a3c45[_0xd740('0x4')])['ext']==='.pdf'){originate(_0x52af2b,_0x3bf22,!![])[_0xd740('0x4b')](function(_0x1693cd){_0x12fe74(_0x1693cd);})[_0xd740('0x41')](function(_0x4f3947){_0x40ea0d(_0x4f3947);});}else{originate(_0x52af2b,_0x3bf22,![])['then'](function(_0x3220c8){_0x12fe74(_0x3220c8);})[_0xd740('0x41')](function(_0x2685a3){_0x40ea0d(_0x2685a3);});}});};Fax[_0xd740('0x2c')]['isTrunkReachable']=function(_0x1ea946){return!_[_0xd740('0x6a')](_0x1ea946)&&!_[_0xd740('0x6a')](_0x1ea946['name'])&&!_[_0xd740('0x6a')](_0x1ea946[_0xd740('0x6b')])&&_0x1ea946['active']&&!_['isNil'](this[_0xd740('0x10')][util[_0xd740('0x6c')](_0xd740('0x6d'),_0x1ea946[_0xd740('0x27')])])&&!_[_0xd740('0x6a')](this['trunks'][util[_0xd740('0x6c')](_0xd740('0x6d'),_0x1ea946[_0xd740('0x27')])]['status'])&&(this[_0xd740('0x10')][util[_0xd740('0x6c')](_0xd740('0x6d'),_0x1ea946[_0xd740('0x27')])][_0xd740('0x31')]===_0xd740('0x6e')||this[_0xd740('0x10')][util[_0xd740('0x6c')]('SIP/%s',_0x1ea946[_0xd740('0x27')])][_0xd740('0x31')]===_0xd740('0x6f'));};Fax[_0xd740('0x2c')][_0xd740('0x60')]=function(_0xdf2a65,_0x119e79){if(!this[_0xd740('0x70')](_0xdf2a65)){ut[_0xd740('0x4d')](_0xd740('0x71'),_[_0xd740('0x6a')](_0xdf2a65)?'':_0xdf2a65[_0xd740('0x27')]+_0xd740('0x72'));return{'isValid':![],'message':_0xd740('0x73')};}if(_[_0xd740('0x6a')](_0x119e79[_0xd740('0x8')])){ut[_0xd740('0x4d')](_0xd740('0x74'),JSON[_0xd740('0x40')](_0x119e79));return{'isValid':![],'message':_0xd740('0x75')};}if(_[_0xd740('0x6a')](_0x119e79[_0xd740('0x4')])){ut['logger'](_0xd740('0x76'),JSON[_0xd740('0x40')](_0x119e79));return{'isValid':![],'message':_0xd740('0x77')};}return{'isValid':!![],'message':_0xd740('0x78')};};module[_0xd740('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index cb2e27d..59aa3bb 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 _0x7846=['catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','resolve','then','notify'];(function(_0x5842ed,_0x3d858c){var _0x5312c7=function(_0x294df3){while(--_0x294df3){_0x5842ed['push'](_0x5842ed['shift']());}};_0x5312c7(++_0x3d858c);}(_0x7846,0x14c));var _0x6784=function(_0x204047,_0x2df7af){_0x204047=_0x204047-0x0;var _0x5956d2=_0x7846[_0x204047];return _0x5956d2;};'use strict';var util=require(_0x6784('0x0'));var BPromise=require('bluebird');var logger=require(_0x6784('0x1'))(_0x6784('0x2'));var _=require(_0x6784('0x3'));var faxAccount=require(_0x6784('0x4'));function loggerCatch(_0x1b88ae){return function(_0x1b6487){logger['error'](_0x1b88ae,util[_0x6784('0x5')](_0x1b6487,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4a816a,_0x114bf4){return BPromise[_0x6784('0x6')]()[_0x6784('0x7')](faxAccount[_0x6784('0x8')](_0x4a816a,_0x114bf4))[_0x6784('0x9')](loggerCatch(_0x6784('0xa')));}; \ No newline at end of file +var _0xc7ea=['error','notify','then','catch','[Notify]\x20','util','bluebird','lodash','../rpc/faxAccount'];(function(_0x10f0a8,_0x1f624b){var _0xde449=function(_0x3f19c8){while(--_0x3f19c8){_0x10f0a8['push'](_0x10f0a8['shift']());}};_0xde449(++_0x1f624b);}(_0xc7ea,0x83));var _0xac7e=function(_0x3d41b3,_0x40f504){_0x3d41b3=_0x3d41b3-0x0;var _0xbe7c27=_0xc7ea[_0x3d41b3];return _0xbe7c27;};'use strict';var util=require(_0xac7e('0x0'));var BPromise=require(_0xac7e('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xac7e('0x2'));var faxAccount=require(_0xac7e('0x3'));function loggerCatch(_0x1bfdd7){return function(_0x49af4e){logger[_0xac7e('0x4')](_0x1bfdd7,util['inspect'](_0x49af4e,{'showHidden':![],'depth':null}));};}exports[_0xac7e('0x5')]=function(_0x1b3aab,_0x377dc2){return BPromise['resolve']()[_0xac7e('0x6')](faxAccount[_0xac7e('0x5')](_0x1b3aab,_0x377dc2))[_0xac7e('0x7')](loggerCatch(_0xac7e('0x8')));}; \ 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 964a7e8..defd75f 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 _0x7ab3=['exec','execute','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','child_process'];(function(_0x5c33d4,_0x3621db){var _0x76150=function(_0xfbef69){while(--_0xfbef69){_0x5c33d4['push'](_0x5c33d4['shift']());}};_0x76150(++_0x3621db);}(_0x7ab3,0x154));var _0x37ab=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x7ab3[_0x2d89ce];return _0x3fad10;};'use strict';var util=require(_0x37ab('0x0'));var logger=require(_0x37ab('0x1'))(_0x37ab('0x2'));var BPromise=require('bluebird');var exec=require(_0x37ab('0x3'))[_0x37ab('0x4')];exports[_0x37ab('0x5')]=function(_0x317e55){return new BPromise(function(_0x4352f2,_0x38f40e){exec(_0x317e55,function(_0x2d2aac,_0x1dc8ad,_0xf7a848){logger['info'](_0x37ab('0x6'),_0x1dc8ad);if(_0x2d2aac){logger['info'](_0x37ab('0x6'),_0x37ab('0x7'),util['inspect'](_0x2d2aac,{'showHidden':![],'depth':null}),_0x1dc8ad,_0xf7a848);_0x38f40e(_0x2d2aac);}_0x4352f2(_0x1dc8ad);});});}; \ No newline at end of file +var _0x519b=['inspect','util','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x1f907d,_0x56b747){var _0xb5cf43=function(_0x39229d){while(--_0x39229d){_0x1f907d['push'](_0x1f907d['shift']());}};_0xb5cf43(++_0x56b747);}(_0x519b,0x1ba));var _0xb519=function(_0x6b8e6,_0x5b5b8d){_0x6b8e6=_0x6b8e6-0x0;var _0x11e8d9=_0x519b[_0x6b8e6];return _0x11e8d9;};'use strict';var util=require(_0xb519('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xb519('0x1'));var exec=require(_0xb519('0x2'))[_0xb519('0x3')];exports[_0xb519('0x4')]=function(_0x366804){return new BPromise(function(_0x110867,_0x56158b){exec(_0x366804,function(_0x25b939,_0x16e6ab,_0x4cf9c6){logger[_0xb519('0x5')](_0xb519('0x6'),_0x16e6ab);if(_0x25b939){logger[_0xb519('0x5')]('Exec\x20gs',_0xb519('0x7'),util[_0xb519('0x8')](_0x25b939,{'showHidden':![],'depth':null}),_0x16e6ab,_0x4cf9c6);_0x56158b(_0x25b939);}_0x110867(_0x16e6ab);});});}; \ 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 815d218..5bf75d1 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 _0xac33=['../../../../config/logger','logger','info','inspect','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','util','lodash','moment'];(function(_0x1e7060,_0x453e1a){var _0x4233cf=function(_0x456a3e){while(--_0x456a3e){_0x1e7060['push'](_0x1e7060['shift']());}};_0x4233cf(++_0x453e1a);}(_0xac33,0xfa));var _0x3ac3=function(_0x27cdf6,_0x2aa6b3){_0x27cdf6=_0x27cdf6-0x0;var _0x8546b3=_0xac33[_0x27cdf6];return _0x8546b3;};'use strict';var util=require(_0x3ac3('0x0'));var _=require(_0x3ac3('0x1'));var moment=require(_0x3ac3('0x2'));var logger=require(_0x3ac3('0x3'))('fax');exports['message']=function(_0x3d0bef){return{'message':_0x3d0bef};};exports[_0x3ac3('0x4')]=function(_0x1041e7,_0x4e29f6){logger[_0x3ac3('0x5')](_0x1041e7,util[_0x3ac3('0x6')](_0x4e29f6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ffd27,_0x18b475){var _0x5e9479={'XMF-ECM':_0x18b475[_0x3ac3('0x7')],'XMF-HEADERINFO':_0x18b475[_0x3ac3('0x8')],'XMF-MINRATE':_0x18b475[_0x3ac3('0x9')],'XMF-MAXRATE':_0x18b475['maxrate'],'XMF-MODEM':util[_0x3ac3('0xa')](_0x3ac3('0xb'),_0x18b475[_0x3ac3('0xc')]),'XMF-GATEWAY':_0x18b475[_0x3ac3('0xd')],'XMF-FAXDETECT':_0x18b475[_0x3ac3('0xe')],'XMF-T38TIMEOUT':_0x18b475['t38timeout'],'XMF-LOCALSTATIONID':_0x18b475[_0x3ac3('0xf')],'XMF-PATH':_0x4ffd27[_0x3ac3('0x10')]};return _0x5e9479;};exports[_0x3ac3('0x11')]=function(_0x1a3a4a,_0x274c89){return{'actionid':_0x1a3a4a[_0x3ac3('0x12')],'action':_0x3ac3('0x13'),'channel':_0x1a3a4a[_0x3ac3('0x14')],'Exten':_0x3ac3('0x15'),'Context':_0x3ac3('0x16'),'Priority':'1','callerid':util[_0x3ac3('0xa')]('\x22%s\x22\x20<%s>',_0x1a3a4a[_0x3ac3('0x8')]?_0x1a3a4a[_0x3ac3('0x8')]:'',_0x1a3a4a[_0x3ac3('0xf')]),'variable':_0x274c89,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a3a4a['uniqueid']};}; \ No newline at end of file +var _0x8ab7=['from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','message','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','modem','faxdetect','localstationid','path','originate','xcally-motion-fax'];(function(_0x30e381,_0x2c462b){var _0x87a3e1=function(_0xc5f0f6){while(--_0xc5f0f6){_0x30e381['push'](_0x30e381['shift']());}};_0x87a3e1(++_0x2c462b);}(_0x8ab7,0x1ba));var _0x78ab=function(_0x5116ac,_0x246237){_0x5116ac=_0x5116ac-0x0;var _0x4ac48f=_0x8ab7[_0x5116ac];return _0x4ac48f;};'use strict';var util=require(_0x78ab('0x0'));var _=require(_0x78ab('0x1'));var moment=require(_0x78ab('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x78ab('0x3')]=function(_0x3e4ebf){return{'message':_0x3e4ebf};};exports[_0x78ab('0x4')]=function(_0x914aeb,_0x3c02d3){logger[_0x78ab('0x5')](_0x914aeb,util[_0x78ab('0x6')](_0x3c02d3,{'showHidden':![],'depth':null}));};exports[_0x78ab('0x7')]=function(_0x33336a,_0x473c83){var _0x1f8fc3={'XMF-ECM':_0x473c83[_0x78ab('0x8')],'XMF-HEADERINFO':_0x473c83[_0x78ab('0x9')],'XMF-MINRATE':_0x473c83['minrate'],'XMF-MAXRATE':_0x473c83['maxrate'],'XMF-MODEM':util[_0x78ab('0xa')](_0x78ab('0xb'),_0x473c83[_0x78ab('0xc')]),'XMF-GATEWAY':_0x473c83['gateway'],'XMF-FAXDETECT':_0x473c83[_0x78ab('0xd')],'XMF-T38TIMEOUT':_0x473c83['t38timeout'],'XMF-LOCALSTATIONID':_0x473c83[_0x78ab('0xe')],'XMF-PATH':_0x33336a[_0x78ab('0xf')]};return _0x1f8fc3;};exports['variablesAction']=function(_0x5f31ef,_0x582d11){return{'actionid':_0x5f31ef['uniqueid'],'action':_0x78ab('0x10'),'channel':_0x5f31ef['channel'],'Exten':_0x78ab('0x11'),'Context':_0x78ab('0x12'),'Priority':'1','callerid':util[_0x78ab('0xa')](_0x78ab('0x13'),_0x5f31ef[_0x78ab('0x9')]?_0x5f31ef[_0x78ab('0x9')]:'',_0x5f31ef['localstationid']),'variable':_0x582d11,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5f31ef['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3e21264..49ecb82 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 _0x0340=['./rpc/integrations/dynamics365','get','hour','getAgents','getTelephones','then','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','listen','error','[index.js][main]','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow'];(function(_0x3db4c0,_0x58baae){var _0x22fdb7=function(_0x332d27){while(--_0x332d27){_0x3db4c0['push'](_0x3db4c0['shift']());}};_0x22fdb7(++_0x58baae);}(_0x0340,0x105));var _0x0034=function(_0x4ff7f0,_0x529f73){_0x4ff7f0=_0x4ff7f0-0x0;var _0xc1a39e=_0x0340[_0x4ff7f0];return _0xc1a39e;};'use strict';var util=require(_0x0034('0x0'));var moment=require(_0x0034('0x1'));var server=require(_0x0034('0x2'));var Realtime=require(_0x0034('0x3'));var Report=require(_0x0034('0x4'));var Acw=require('./acw');var Trigger=require(_0x0034('0x5'));var Dialer=require(_0x0034('0x6'));var Preview=require(_0x0034('0x7'));var Fax=require('./fax');var user=require(_0x0034('0x8'));var voiceQueue=require(_0x0034('0x9'));var voiceQueueReport=require(_0x0034('0xa'));var voiceCallReport=require(_0x0034('0xb'));var trunk=require(_0x0034('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x0034('0xd'));var cmHopperHistory=require(_0x0034('0xe'));var campaign=require(_0x0034('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0034('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x0034('0x11'));var sugarcrm=require(_0x0034('0x12'));var freshdesk=require(_0x0034('0x13'));var desk=require(_0x0034('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0034('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0034('0x16'));var dynamics365=require(_0x0034('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0034('0x18')](_0x0034('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0034('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()['then'](user[_0x0034('0x1a')]())['then'](realtime['initAgents']())['then'](user[_0x0034('0x1b')]())[_0x0034('0x1c')](realtime[_0x0034('0x1d')]())[_0x0034('0x1c')](trunk[_0x0034('0x1e')]())[_0x0034('0x1c')](realtime['initTrunks']())['then'](voiceQueue[_0x0034('0x1f')]())[_0x0034('0x1c')](realtime[_0x0034('0x20')]())[_0x0034('0x1c')](trigger[_0x0034('0x21')]())[_0x0034('0x1c')](realtime[_0x0034('0x22')]())['then'](template['getTemplates']())[_0x0034('0x1c')](realtime[_0x0034('0x23')]())[_0x0034('0x1c')](zendesk[_0x0034('0x24')]())['then'](realtime[_0x0034('0x25')]())[_0x0034('0x1c')](salesforce[_0x0034('0x26')]())[_0x0034('0x1c')](realtime[_0x0034('0x27')]())[_0x0034('0x1c')](sugarcrm[_0x0034('0x28')]())[_0x0034('0x1c')](realtime[_0x0034('0x29')]())[_0x0034('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x0034('0x1c')](realtime[_0x0034('0x2a')]())['then'](desk[_0x0034('0x2b')]())[_0x0034('0x1c')](realtime[_0x0034('0x2c')]())['then'](zoho[_0x0034('0x2d')]())['then'](realtime[_0x0034('0x2e')]())[_0x0034('0x1c')](vtiger[_0x0034('0x2f')]())[_0x0034('0x1c')](realtime[_0x0034('0x30')]())[_0x0034('0x1c')](freshsales['getFreshsalesAccounts']())[_0x0034('0x1c')](realtime['initFreshsalesAccounts']())[_0x0034('0x1c')](servicenow[_0x0034('0x31')]())['then'](realtime[_0x0034('0x32')]())['then'](dynamics365[_0x0034('0x33')]())['then'](realtime[_0x0034('0x34')]())[_0x0034('0x1c')](campaign[_0x0034('0x35')]())[_0x0034('0x1c')](realtime[_0x0034('0x36')]())[_0x0034('0x1c')](voiceExtension[_0x0034('0x37')]())['then'](realtime[_0x0034('0x38')]())[_0x0034('0x1c')](faxAccount[_0x0034('0x39')]())['then'](realtime[_0x0034('0x3a')]())[_0x0034('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x0034('0x3b')]()['then'](voiceQueueReport[_0x0034('0x3c')]())['then'](realtime[_0x0034('0x3d')]())[_0x0034('0x1c')](cmHopperHistory[_0x0034('0x3e')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x0034('0x1c')](cmHopperHistory[_0x0034('0x3f')]())[_0x0034('0x1c')](realtime[_0x0034('0x40')]())[_0x0034('0x1c')](voiceCallReport[_0x0034('0x41')]())['then'](realtime['initVoiceCallReports']())[_0x0034('0x42')](function(_0x251c51){logger['error'](_0x0034('0x43'),util['inspect'](_0x251c51,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0034('0x44')](realtime,preview,fax)[_0x0034('0x1c')](function(){return initRealtime();})[_0x0034('0x1c')](function(){return initParams();})[_0x0034('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x3d38f8){logger[_0x0034('0x45')](_0x0034('0x46'),util['inspect'](_0x3d38f8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3dec=['./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','getAgents','then','initAgents','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./realtime','./report','./acw'];(function(_0x2120fb,_0x5f4749){var _0x41a2da=function(_0x35e59c){while(--_0x35e59c){_0x2120fb['push'](_0x2120fb['shift']());}};_0x41a2da(++_0x5f4749);}(_0x3dec,0x116));var _0xc3de=function(_0x102123,_0x5c1a48){_0x102123=_0x102123-0x0;var _0x151fee=_0x3dec[_0x102123];return _0x151fee;};'use strict';var util=require(_0xc3de('0x0'));var moment=require(_0xc3de('0x1'));var server=require(_0xc3de('0x2'));var Realtime=require(_0xc3de('0x3'));var Report=require(_0xc3de('0x4'));var Acw=require(_0xc3de('0x5'));var Trigger=require(_0xc3de('0x6'));var Dialer=require(_0xc3de('0x7'));var Preview=require(_0xc3de('0x8'));var Fax=require(_0xc3de('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xc3de('0xa'));var voiceQueueReport=require(_0xc3de('0xb'));var voiceCallReport=require(_0xc3de('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0xc3de('0xd'));var template=require(_0xc3de('0xe'));var cmHopperHistory=require(_0xc3de('0xf'));var campaign=require(_0xc3de('0x10'));var voiceExtension=require(_0xc3de('0x11'));var faxAccount=require(_0xc3de('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc3de('0x13'));var sugarcrm=require(_0xc3de('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xc3de('0x15'));var zoho=require(_0xc3de('0x16'));var vtiger=require(_0xc3de('0x17'));var freshsales=require(_0xc3de('0x18'));var servicenow=require(_0xc3de('0x19'));var dynamics365=require(_0xc3de('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc3de('0x1b'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc3de('0x1c')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc3de('0x1c')](_0xc3de('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xc3de('0x1e')]()['then'](user[_0xc3de('0x1f')]())[_0xc3de('0x20')](realtime[_0xc3de('0x21')]())[_0xc3de('0x20')](user['getTelephones']())[_0xc3de('0x20')](realtime['initTelephones']())['then'](trunk[_0xc3de('0x22')]())[_0xc3de('0x20')](realtime[_0xc3de('0x23')]())[_0xc3de('0x20')](voiceQueue[_0xc3de('0x24')]())[_0xc3de('0x20')](realtime['initVoiceQueues']())['then'](trigger[_0xc3de('0x25')]())['then'](realtime[_0xc3de('0x26')]())[_0xc3de('0x20')](template['getTemplates']())['then'](realtime['initTemplates']())[_0xc3de('0x20')](zendesk['getZendeskAccounts']())[_0xc3de('0x20')](realtime['initZendeskAccounts']())['then'](salesforce[_0xc3de('0x27')]())[_0xc3de('0x20')](realtime[_0xc3de('0x28')]())[_0xc3de('0x20')](sugarcrm[_0xc3de('0x29')]())[_0xc3de('0x20')](realtime[_0xc3de('0x2a')]())[_0xc3de('0x20')](freshdesk['getFreshdeskAccounts']())[_0xc3de('0x20')](realtime[_0xc3de('0x2b')]())[_0xc3de('0x20')](desk[_0xc3de('0x2c')]())[_0xc3de('0x20')](realtime[_0xc3de('0x2d')]())[_0xc3de('0x20')](zoho[_0xc3de('0x2e')]())[_0xc3de('0x20')](realtime[_0xc3de('0x2f')]())['then'](vtiger[_0xc3de('0x30')]())[_0xc3de('0x20')](realtime[_0xc3de('0x31')]())[_0xc3de('0x20')](freshsales[_0xc3de('0x32')]())[_0xc3de('0x20')](realtime[_0xc3de('0x33')]())['then'](servicenow['getServicenowAccounts']())[_0xc3de('0x20')](realtime[_0xc3de('0x34')]())[_0xc3de('0x20')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xc3de('0x35')]())[_0xc3de('0x20')](campaign['getCampaigns']())[_0xc3de('0x20')](realtime[_0xc3de('0x36')]())[_0xc3de('0x20')](voiceExtension[_0xc3de('0x37')]())[_0xc3de('0x20')](realtime[_0xc3de('0x38')]())['then'](faxAccount['getFaxAccounts']())[_0xc3de('0x20')](realtime[_0xc3de('0x39')]())[_0xc3de('0x20')](function(){return realtime;});}function initParams(){return Promise[_0xc3de('0x1e')]()[_0xc3de('0x20')](voiceQueueReport[_0xc3de('0x3a')]())[_0xc3de('0x20')](realtime[_0xc3de('0x3b')]())[_0xc3de('0x20')](cmHopperHistory[_0xc3de('0x3c')]())[_0xc3de('0x20')](realtime['initVoiceQueueHopperHistory']())[_0xc3de('0x20')](cmHopperHistory['getCampaignHopperHistory']())[_0xc3de('0x20')](realtime[_0xc3de('0x3d')]())[_0xc3de('0x20')](voiceCallReport[_0xc3de('0x3e')]())[_0xc3de('0x20')](realtime[_0xc3de('0x3f')]())['catch'](function(_0x2dd574){logger[_0xc3de('0x40')](_0xc3de('0x41'),util[_0xc3de('0x42')](_0x2dd574,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc3de('0x43')](realtime,preview,fax)[_0xc3de('0x20')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xc3de('0x20')](function(){report[_0xc3de('0x44')]();setInterval(initRealtime,0x1388);})[_0xc3de('0x45')](function(_0x5b9244){logger['error'](_0xc3de('0x46'),util[_0xc3de('0x42')](_0x5b9244,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index ed7bd59..0a08c53 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 _0x47c8=['email','accountcode','fullname','unknown','status','address','phone','mobile','online','voiceStatusTime','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','format','voiceStatus','voiceStatusCallerIdNumber','interface','emit','user:ami:update','util','moment','../../../config/environment','defaults','redis','localhost','name'];(function(_0x17ce52,_0x174d05){var _0x468524=function(_0x5c44b5){while(--_0x5c44b5){_0x17ce52['push'](_0x17ce52['shift']());}};_0x468524(++_0x174d05);}(_0x47c8,0x89));var _0x847c=function(_0x328ebc,_0x2811a8){_0x328ebc=_0x328ebc-0x0;var _0x54be14=_0x47c8[_0x328ebc];return _0x54be14;};'use strict';var _=require('lodash');var util=require(_0x847c('0x0'));var moment=require(_0x847c('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x847c('0x2'));config['redis']=_[_0x847c('0x3')](config[_0x847c('0x4')],{'host':_0x847c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x434961){this['id']=_0x434961['id']||0x0;this['name']=_0x434961[_0x847c('0x6')]||'';this['email']=_0x434961[_0x847c('0x7')]||'';this[_0x847c('0x8')]=_0x434961[_0x847c('0x8')]||'';this[_0x847c('0x9')]=_0x434961['fullname']||'';this['state']=_0x847c('0xa');this['stateTime']=0x0;this[_0x847c('0xb')]=_0x847c('0xa');this[_0x847c('0xc')]='';this[_0x847c('0xd')]='';this[_0x847c('0xe')]='';this['interface']='';this[_0x847c('0xf')]=_0x434961[_0x847c('0xf')]||![];this['voiceStatus']=_0x847c('0xa');this[_0x847c('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x847c('0x11')]='';this[_0x847c('0x12')]=![];this[_0x847c('0x13')]=![];this[_0x847c('0x14')]='';}Agent[_0x847c('0x15')][_0x847c('0x16')]=function(_0x14a970){var _0x141373;if(_0x14a970&&_0x14a970['state']){_0x141373=_0x14a970[_0x847c('0x17')][_0x847c('0x18')]();switch(_0x141373){case'not_inuse':_0x141373=_0x847c('0x19');break;case _0x847c('0x1a'):_0x141373=_0x847c('0x1b');break;}}if(_0x141373&&this['voiceStatus']!==_0x141373||_0x14a970[_0x847c('0x1c')]){this[_0x847c('0x10')]=_[_0x847c('0x1d')](moment()[_0x847c('0x1e')]('x'));}if(_0x141373){this[_0x847c('0x1f')]=_0x141373;}var _0x2e8281={'id':this['id'],'name':this[_0x847c('0x6')],'email':this[_0x847c('0x7')],'accountcode':this[_0x847c('0x8')],'fullname':this[_0x847c('0x9')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x847c('0xb')],'address':this[_0x847c('0xc')],'online':this['online'],'voiceStatus':this[_0x847c('0x1f')],'voiceStatusTime':this[_0x847c('0x10')],'voiceStatusCallerIdNumber':this[_0x847c('0x20')],'voiceStatusQueue':this[_0x847c('0x11')],'interface':this[_0x847c('0x21')],'onhold':this[_0x847c('0x12')]};var _0x236bf0=md5(JSON['stringify'](_0x2e8281));if(this[_0x847c('0x14')]!==_0x236bf0){this['md5']=_0x236bf0;io['to'](util[_0x847c('0x1e')]('user:%s',_0x2e8281[_0x847c('0x6')]))[_0x847c('0x22')](_0x847c('0x23'),_['omit'](_0x2e8281,['online']));io[_0x847c('0x22')]('user:presence',_0x2e8281);}};module['exports']=Agent; \ No newline at end of file +var _0x5b45=['ioredis','../../../config/environment','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','idle','talking','statePause','format','voiceStatus','status','voiceStatusTime','stringify','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5'];(function(_0x473f3e,_0x9ec97e){var _0x34a9d2=function(_0x378439){while(--_0x378439){_0x473f3e['push'](_0x473f3e['shift']());}};_0x34a9d2(++_0x9ec97e);}(_0x5b45,0x114));var _0x55b4=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x5b45[_0x5d6c3e];return _0x44ecb7;};'use strict';var _=require(_0x55b4('0x0'));var util=require(_0x55b4('0x1'));var moment=require(_0x55b4('0x2'));var md5=require(_0x55b4('0x3'));var Redis=require(_0x55b4('0x4'));var config=require(_0x55b4('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x55b4('0x6'),'port':0x18eb});var io=require(_0x55b4('0x7'))(new Redis(config['redis']));function Agent(_0xe8a10e){this['id']=_0xe8a10e['id']||0x0;this['name']=_0xe8a10e[_0x55b4('0x8')]||'';this[_0x55b4('0x9')]=_0xe8a10e[_0x55b4('0x9')]||'';this[_0x55b4('0xa')]=_0xe8a10e[_0x55b4('0xa')]||'';this[_0x55b4('0xb')]=_0xe8a10e[_0x55b4('0xb')]||'';this[_0x55b4('0xc')]=_0x55b4('0xd');this[_0x55b4('0xe')]=0x0;this['status']=_0x55b4('0xd');this[_0x55b4('0xf')]='';this['phone']='';this[_0x55b4('0x10')]='';this[_0x55b4('0x11')]='';this['online']=_0xe8a10e[_0x55b4('0x12')]||![];this['voiceStatus']=_0x55b4('0xd');this['voiceStatusTime']=0x0;this[_0x55b4('0x13')]='';this[_0x55b4('0x14')]='';this[_0x55b4('0x15')]=![];this['local']=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0xbf2d8d){var _0x2e83a8;if(_0xbf2d8d&&_0xbf2d8d[_0x55b4('0xc')]){_0x2e83a8=_0xbf2d8d[_0x55b4('0xc')]['toLowerCase']();switch(_0x2e83a8){case'not_inuse':_0x2e83a8=_0x55b4('0x16');break;case'inuse':_0x2e83a8=_0x55b4('0x17');break;}}if(_0x2e83a8&&this['voiceStatus']!==_0x2e83a8||_0xbf2d8d[_0x55b4('0x18')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x55b4('0x19')]('x'));}if(_0x2e83a8){this[_0x55b4('0x1a')]=_0x2e83a8;}var _0x576d5f={'id':this['id'],'name':this[_0x55b4('0x8')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x55b4('0xb')],'state':this['state'],'stateTime':this[_0x55b4('0xe')],'status':this[_0x55b4('0x1b')],'address':this[_0x55b4('0xf')],'online':this[_0x55b4('0x12')],'voiceStatus':this[_0x55b4('0x1a')],'voiceStatusTime':this[_0x55b4('0x1c')],'voiceStatusCallerIdNumber':this[_0x55b4('0x13')],'voiceStatusQueue':this[_0x55b4('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x2a198e=md5(JSON[_0x55b4('0x1d')](_0x576d5f));if(this[_0x55b4('0x3')]!==_0x2a198e){this[_0x55b4('0x3')]=_0x2a198e;io['to'](util[_0x55b4('0x19')](_0x55b4('0x1e'),_0x576d5f[_0x55b4('0x8')]))[_0x55b4('0x1f')](_0x55b4('0x20'),_['omit'](_0x576d5f,['online']));io[_0x55b4('0x1f')](_0x55b4('0x21'),_0x576d5f);}};module[_0x55b4('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 2daf49f..c0c6b83 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 _0x02be=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x5315cc,_0x523632){var _0x1799a8=function(_0x32959e){while(--_0x32959e){_0x5315cc['push'](_0x5315cc['shift']());}};_0x1799a8(++_0x523632);}(_0x02be,0x87));var _0xe02b=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x02be[_0x21549c];return _0x426cbd;};'use strict';function Campaign(_0x62daa3){this['id']=_0x62daa3['id']||0x0;this[_0xe02b('0x0')]=_0x62daa3['name']||'';this[_0xe02b('0x1')]=_0x62daa3[_0xe02b('0x1')]||_0xe02b('0x2');this[_0xe02b('0x3')]=0x0;this['temp']=0x0;this[_0xe02b('0x4')]=0x0;this[_0xe02b('0x5')]=0x0;this['message']='';this[_0xe02b('0x6')]=!![];this[_0xe02b('0x7')]=_0x62daa3[_0xe02b('0x7')];this[_0xe02b('0x8')]=_0x62daa3[_0xe02b('0x8')];this[_0xe02b('0x9')]=_0x62daa3[_0xe02b('0x9')]||null;this[_0xe02b('0xa')]=_0x62daa3['dialGlobalInterval']?_0x62daa3[_0xe02b('0xa')]:null;this[_0xe02b('0xb')]=_0x62daa3[_0xe02b('0xb')];this[_0xe02b('0xc')]=_0x62daa3[_0xe02b('0xc')];this[_0xe02b('0xd')]=_0x62daa3[_0xe02b('0xd')]||0x1e;this[_0xe02b('0xe')]=_0x62daa3[_0xe02b('0xe')];this['dialCongestionRetryFrequency']=_0x62daa3[_0xe02b('0xf')];this['dialBusyMaxRetry']=_0x62daa3[_0xe02b('0x10')];this[_0xe02b('0x11')]=_0x62daa3[_0xe02b('0x11')];this[_0xe02b('0x12')]=_0x62daa3[_0xe02b('0x12')];this[_0xe02b('0x13')]=_0x62daa3[_0xe02b('0x13')];this[_0xe02b('0x14')]=_0x62daa3['dialGlobalMaxRetry'];this[_0xe02b('0x15')]=_0x62daa3['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x62daa3[_0xe02b('0x16')]||0x96;this[_0xe02b('0x17')]=_0x62daa3[_0xe02b('0x17')]||0x3;this[_0xe02b('0x18')]=_0x62daa3[_0xe02b('0x18')]||0x96;this[_0xe02b('0x19')]=_0x62daa3[_0xe02b('0x19')]||0x3;this[_0xe02b('0x1a')]=_0x62daa3[_0xe02b('0x1a')]||0x96;this[_0xe02b('0x1b')]=_0x62daa3[_0xe02b('0x1b')]||0x3;this[_0xe02b('0x1c')]=_0x62daa3['dialMachineRetryFrequency']||0x96;this[_0xe02b('0x1d')]=_0x62daa3[_0xe02b('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x62daa3[_0xe02b('0x1e')]||0x96;this[_0xe02b('0x1f')]=_0x62daa3[_0xe02b('0x1f')]||_0xe02b('0x20');this['dialPrefix']=_0x62daa3[_0xe02b('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x62daa3[_0xe02b('0x22')]||undefined;this['dialCutDigit']=_0x62daa3['dialCutDigit']||undefined;this[_0xe02b('0x23')]=_0x62daa3[_0xe02b('0x23')]?_0x62daa3['TrunkBackup']:undefined;this['Trunk']=_0x62daa3[_0xe02b('0x24')]?_0x62daa3[_0xe02b('0x24')]:undefined;this['Interval']=_0x62daa3['Interval']?_0x62daa3['Interval']:undefined;this[_0xe02b('0x25')]=_0x62daa3[_0xe02b('0x25')]?_0x62daa3[_0xe02b('0x25')]:undefined;this[_0xe02b('0x26')]=_0x62daa3[_0xe02b('0x25')]?_0x62daa3['SquareProject']['name']:undefined;this[_0xe02b('0x27')]=_0x62daa3[_0xe02b('0x27')]||![];this['dialAMDInitialSilence']=_0x62daa3[_0xe02b('0x28')];this[_0xe02b('0x29')]=_0x62daa3[_0xe02b('0x29')];this[_0xe02b('0x2a')]=_0x62daa3[_0xe02b('0x2a')];this[_0xe02b('0x2b')]=_0x62daa3[_0xe02b('0x2b')];this[_0xe02b('0x2c')]=_0x62daa3[_0xe02b('0x2c')];this[_0xe02b('0x2d')]=_0x62daa3[_0xe02b('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x62daa3[_0xe02b('0x2e')];this[_0xe02b('0x2f')]=_0x62daa3[_0xe02b('0x2f')];this[_0xe02b('0x30')]=_0x62daa3[_0xe02b('0x30')];}module[_0xe02b('0x31')]=Campaign; \ No newline at end of file +var _0xf750=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0xcc6afe,_0x227a9d){var _0x58db63=function(_0x19ff17){while(--_0x19ff17){_0xcc6afe['push'](_0xcc6afe['shift']());}};_0x58db63(++_0x227a9d);}(_0xf750,0xef));var _0x0f75=function(_0x5d96ee,_0x523278){_0x5d96ee=_0x5d96ee-0x0;var _0x39092b=_0xf750[_0x5d96ee];return _0x39092b;};'use strict';function Campaign(_0x15f64c){this['id']=_0x15f64c['id']||0x0;this['name']=_0x15f64c[_0x0f75('0x0')]||'';this[_0x0f75('0x1')]=_0x15f64c[_0x0f75('0x1')]||_0x0f75('0x2');this[_0x0f75('0x3')]=0x0;this['temp']=0x0;this[_0x0f75('0x4')]=0x0;this[_0x0f75('0x5')]=0x0;this['message']='';this[_0x0f75('0x6')]=!![];this[_0x0f75('0x7')]=_0x15f64c['active'];this['limitCalls']=_0x15f64c[_0x0f75('0x8')];this[_0x0f75('0x9')]=_0x15f64c[_0x0f75('0x9')]||null;this[_0x0f75('0xa')]=_0x15f64c[_0x0f75('0xa')]?_0x15f64c[_0x0f75('0xa')]:null;this[_0x0f75('0xb')]=_0x15f64c[_0x0f75('0xb')];this['dialOriginateCallerIdNumber']=_0x15f64c[_0x0f75('0xc')];this['dialOriginateTimeout']=_0x15f64c['dialOriginateTimeout']||0x1e;this[_0x0f75('0xd')]=_0x15f64c['dialCongestionMaxRetry'];this[_0x0f75('0xe')]=_0x15f64c[_0x0f75('0xe')];this[_0x0f75('0xf')]=_0x15f64c[_0x0f75('0xf')];this[_0x0f75('0x10')]=_0x15f64c[_0x0f75('0x10')];this[_0x0f75('0x11')]=_0x15f64c[_0x0f75('0x11')];this[_0x0f75('0x12')]=_0x15f64c[_0x0f75('0x12')];this['dialGlobalMaxRetry']=_0x15f64c[_0x0f75('0x13')];this['dialNoSuchNumberMaxRetry']=_0x15f64c[_0x0f75('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x15f64c[_0x0f75('0x15')]||0x96;this[_0x0f75('0x16')]=_0x15f64c[_0x0f75('0x16')]||0x3;this[_0x0f75('0x17')]=_0x15f64c[_0x0f75('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x15f64c[_0x0f75('0x18')]||0x3;this[_0x0f75('0x19')]=_0x15f64c[_0x0f75('0x19')]||0x96;this[_0x0f75('0x1a')]=_0x15f64c[_0x0f75('0x1a')]||0x3;this[_0x0f75('0x1b')]=_0x15f64c[_0x0f75('0x1b')]||0x96;this[_0x0f75('0x1c')]=_0x15f64c['dialAgentRejectMaxRetry']||0x3;this[_0x0f75('0x1d')]=_0x15f64c[_0x0f75('0x1d')]||0x96;this[_0x0f75('0x1e')]=_0x15f64c[_0x0f75('0x1e')]||_0x0f75('0x1f');this[_0x0f75('0x20')]=_0x15f64c[_0x0f75('0x20')]||undefined;this[_0x0f75('0x21')]=_0x15f64c[_0x0f75('0x21')]||undefined;this['dialCutDigit']=_0x15f64c[_0x0f75('0x22')]||undefined;this[_0x0f75('0x23')]=_0x15f64c[_0x0f75('0x23')]?_0x15f64c[_0x0f75('0x23')]:undefined;this[_0x0f75('0x24')]=_0x15f64c[_0x0f75('0x24')]?_0x15f64c['Trunk']:undefined;this['Interval']=_0x15f64c['Interval']?_0x15f64c[_0x0f75('0x25')]:undefined;this['SquareProject']=_0x15f64c[_0x0f75('0x26')]?_0x15f64c[_0x0f75('0x26')]:undefined;this[_0x0f75('0x27')]=_0x15f64c['SquareProject']?_0x15f64c[_0x0f75('0x26')]['name']:undefined;this['dialAMDActive']=_0x15f64c[_0x0f75('0x28')]||![];this[_0x0f75('0x29')]=_0x15f64c[_0x0f75('0x29')];this[_0x0f75('0x2a')]=_0x15f64c[_0x0f75('0x2a')];this['dialAMDAfterGreetingSilence']=_0x15f64c[_0x0f75('0x2b')];this[_0x0f75('0x2c')]=_0x15f64c[_0x0f75('0x2c')];this['dialAMDMinWordLength']=_0x15f64c[_0x0f75('0x2d')];this[_0x0f75('0x2e')]=_0x15f64c[_0x0f75('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x15f64c[_0x0f75('0x2f')];this[_0x0f75('0x30')]=_0x15f64c[_0x0f75('0x30')];this['dialAMDMaximumWordLength']=_0x15f64c[_0x0f75('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 81a9834..e823b36 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 _0x27c8=['endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','type','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','channel','destinationchannel','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answertime'];(function(_0x4d2e68,_0x506ebf){var _0x20ba0d=function(_0x18309b){while(--_0x18309b){_0x4d2e68['push'](_0x4d2e68['shift']());}};_0x20ba0d(++_0x506ebf);}(_0x27c8,0x6a));var _0x827c=function(_0x3188fd,_0x13d7a3){_0x3188fd=_0x3188fd-0x0;var _0x193f4f=_0x27c8[_0x3188fd];return _0x193f4f;};'use strict';function Channel(){this['starttime']=null;this[_0x827c('0x0')]='';this[_0x827c('0x1')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x827c('0x2')]=undefined;this[_0x827c('0x3')]=undefined;this[_0x827c('0x4')]=0x0;this[_0x827c('0x5')]='';this[_0x827c('0x6')]=0x0;this[_0x827c('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x827c('0x8')]=null;this[_0x827c('0x9')]=null;this[_0x827c('0xa')]=![];this[_0x827c('0xb')]=![];this[_0x827c('0xc')]='';this[_0x827c('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x827c('0xe')]=0x0;this[_0x827c('0xf')]=null;this['tag']=null;this['disposition']=null;this[_0x827c('0x10')]=![];this[_0x827c('0x11')]=null;this['queue']=null;this[_0x827c('0x12')]=[];this[_0x827c('0x13')]=undefined;this[_0x827c('0x14')]=undefined;this[_0x827c('0x15')]=undefined;this['mohtime']=0x0;}module[_0x827c('0x16')]=Channel; \ No newline at end of file +var _0x80cd=['unmanaged','abandoned','lastapplication','lastdata','billableseconds','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime'];(function(_0x4487b2,_0x432f6b){var _0x5b33a1=function(_0x5c7baf){while(--_0x5c7baf){_0x4487b2['push'](_0x4487b2['shift']());}};_0x5b33a1(++_0x432f6b);}(_0x80cd,0x146));var _0xd80c=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x80cd[_0x1780f8];return _0x33a410;};'use strict';function Channel(){this['starttime']=null;this[_0xd80c('0x0')]='';this[_0xd80c('0x1')]='';this[_0xd80c('0x2')]=0x0;this[_0xd80c('0x3')]='';this[_0xd80c('0x4')]=undefined;this[_0xd80c('0x5')]=undefined;this[_0xd80c('0x6')]=0x0;this[_0xd80c('0x7')]='';this['uniqueid']=0x0;this[_0xd80c('0x8')]=0x0;this[_0xd80c('0x9')]=0x0;this[_0xd80c('0xa')]=![];this[_0xd80c('0xb')]=null;this['endtime']=null;this[_0xd80c('0xc')]=![];this[_0xd80c('0xd')]=![];this[_0xd80c('0xe')]='';this[_0xd80c('0xf')]='';this['duration']=0x0;this[_0xd80c('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xd80c('0x11')]=null;this['disposition']=null;this[_0xd80c('0x12')]=![];this[_0xd80c('0x13')]=null;this[_0xd80c('0x14')]=null;this[_0xd80c('0x15')]=[];this[_0xd80c('0x16')]=undefined;this[_0xd80c('0x17')]=undefined;this[_0xd80c('0x18')]=undefined;this['mohtime']=0x0;}module[_0xd80c('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c4a54c5..7dec119 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 _0xcfe1=['authType','password','consumerSecret','token','tokenSecret','type','serverUrl','name','username','remoteUri'];(function(_0xf3896e,_0x1a7207){var _0x32422e=function(_0x360694){while(--_0x360694){_0xf3896e['push'](_0xf3896e['shift']());}};_0x32422e(++_0x1a7207);}(_0xcfe1,0xb1));var _0x1cfe=function(_0x5a80e1,_0x28c735){_0x5a80e1=_0x5a80e1-0x0;var _0x30d553=_0xcfe1[_0x5a80e1];return _0x30d553;};'use strict';function DeskAccount(_0xba5c15){this['id']=_0xba5c15['id']||0x0;this[_0x1cfe('0x0')]=_0xba5c15[_0x1cfe('0x0')]||'';this[_0x1cfe('0x1')]=_0xba5c15['username']||'';this['remoteUri']=_0xba5c15[_0x1cfe('0x2')]||'';this[_0x1cfe('0x3')]=_0xba5c15['authType']||'';this[_0x1cfe('0x4')]=_0xba5c15[_0x1cfe('0x4')]||'';this['consumerKey']=_0xba5c15['consumerKey']||'';this[_0x1cfe('0x5')]=_0xba5c15['consumerSecret']||'';this[_0x1cfe('0x6')]=_0xba5c15[_0x1cfe('0x6')]||'';this[_0x1cfe('0x7')]=_0xba5c15[_0x1cfe('0x7')]||'';this[_0x1cfe('0x8')]=_0xba5c15[_0x1cfe('0x8')]||'';this['serverUrl']=_0xba5c15[_0x1cfe('0x9')]||'';this['Configurations']=_0xba5c15['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x9c2c=['consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','password'];(function(_0x7fe903,_0x5a3e7a){var _0x2ee69b=function(_0x579bb5){while(--_0x579bb5){_0x7fe903['push'](_0x7fe903['shift']());}};_0x2ee69b(++_0x5a3e7a);}(_0x9c2c,0x167));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x284395){this['id']=_0x284395['id']||0x0;this['name']=_0x284395['name']||'';this[_0xc9c2('0x0')]=_0x284395['username']||'';this[_0xc9c2('0x1')]=_0x284395[_0xc9c2('0x1')]||'';this[_0xc9c2('0x2')]=_0x284395[_0xc9c2('0x2')]||'';this[_0xc9c2('0x3')]=_0x284395[_0xc9c2('0x3')]||'';this[_0xc9c2('0x4')]=_0x284395['consumerKey']||'';this['consumerSecret']=_0x284395['consumerSecret']||'';this[_0xc9c2('0x5')]=_0x284395[_0xc9c2('0x5')]||'';this[_0xc9c2('0x6')]=_0x284395[_0xc9c2('0x6')]||'';this['type']=_0x284395[_0xc9c2('0x7')]||'';this[_0xc9c2('0x8')]=_0x284395['serverUrl']||'';this['Configurations']=_0x284395[_0xc9c2('0x9')]||{};}module[_0xc9c2('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 b06bd89..cc491ad 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 _0x594e=['clientSecret','serverUrl','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x1de8cc,_0x3e3f90){var _0x6f59fa=function(_0x4e3f5e){while(--_0x4e3f5e){_0x1de8cc['push'](_0x1de8cc['shift']());}};_0x6f59fa(++_0x3e3f90);}(_0x594e,0x1bd));var _0xe594=function(_0x372fb5,_0x1ea473){_0x372fb5=_0x372fb5-0x0;var _0x5d3a6f=_0x594e[_0x372fb5];return _0x5d3a6f;};'use strict';function Dynamics365Account(_0x2acd1f){this['id']=_0x2acd1f['id']||0x0;this['name']=_0x2acd1f[_0xe594('0x0')]||'';this[_0xe594('0x1')]=_0x2acd1f['username']||'';this[_0xe594('0x2')]=_0x2acd1f[_0xe594('0x2')]||'';this[_0xe594('0x3')]=_0x2acd1f['remoteUri']||'';this[_0xe594('0x4')]=_0x2acd1f[_0xe594('0x4')]||'';this[_0xe594('0x5')]=_0x2acd1f['clientId']||'';this[_0xe594('0x6')]=_0x2acd1f[_0xe594('0x6')]||{};this[_0xe594('0x7')]=_0x2acd1f['serverUrl']||'';this['modernAuthentication']=_0x2acd1f['modernAuthentication']||![];this[_0xe594('0x8')]=_0x2acd1f[_0xe594('0x8')]||{};this[_0xe594('0x9')]=_0x2acd1f[_0xe594('0x9')]||{};}module[_0xe594('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xd6ae=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1dca22,_0x3a101c){var _0x3c851f=function(_0x264a7e){while(--_0x264a7e){_0x1dca22['push'](_0x1dca22['shift']());}};_0x3c851f(++_0x3a101c);}(_0xd6ae,0x19e));var _0xed6a=function(_0x11c15a,_0xbee450){_0x11c15a=_0x11c15a-0x0;var _0x5e9064=_0xd6ae[_0x11c15a];return _0x5e9064;};'use strict';function Dynamics365Account(_0xa4f335){this['id']=_0xa4f335['id']||0x0;this['name']=_0xa4f335[_0xed6a('0x0')]||'';this['username']=_0xa4f335['username']||'';this[_0xed6a('0x1')]=_0xa4f335[_0xed6a('0x1')]||'';this[_0xed6a('0x2')]=_0xa4f335[_0xed6a('0x2')]||'';this[_0xed6a('0x3')]=_0xa4f335[_0xed6a('0x3')]||'';this['clientId']=_0xa4f335[_0xed6a('0x4')]||'';this[_0xed6a('0x5')]=_0xa4f335['clientSecret']||{};this['serverUrl']=_0xa4f335[_0xed6a('0x6')]||'';this[_0xed6a('0x7')]=_0xa4f335[_0xed6a('0x7')]||![];this[_0xed6a('0x8')]=_0xa4f335['Configurations']||{};this['CloudProvider']=_0xa4f335[_0xed6a('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 59693bd..cf1fcce 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 _0x36bc=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect'];(function(_0x241ada,_0x38127a){var _0x3662b7=function(_0x35e5a0){while(--_0x35e5a0){_0x241ada['push'](_0x241ada['shift']());}};_0x3662b7(++_0x38127a);}(_0x36bc,0x139));var _0xc36b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x36bc[_0x47b58b];return _0x46bebe;};'use strict';function FaxAccount(_0x3e30d3){this['id']=_0x3e30d3['id']||0x0;this['name']=_0x3e30d3[_0xc36b('0x0')]||'';this[_0xc36b('0x1')]=_0x3e30d3['description'];this[_0xc36b('0x2')]=_0x3e30d3['ecm'];this[_0xc36b('0x3')]=_0x3e30d3['headerinfo'];this[_0xc36b('0x4')]=_0x3e30d3[_0xc36b('0x4')];this[_0xc36b('0x5')]=_0x3e30d3[_0xc36b('0x5')]||0x960;this[_0xc36b('0x6')]=_0x3e30d3[_0xc36b('0x6')]||0x3840;this[_0xc36b('0x7')]=_0x3e30d3[_0xc36b('0x7')]||'v17,v27,v29';this[_0xc36b('0x8')]=_0x3e30d3[_0xc36b('0x8')]||'no';this[_0xc36b('0x9')]=_0x3e30d3[_0xc36b('0x9')]||'no';this[_0xc36b('0xa')]=_0x3e30d3[_0xc36b('0xa')]||0x1388;this[_0xc36b('0xb')]=_0x3e30d3[_0xc36b('0xb')]||_0xc36b('0xc');this[_0xc36b('0xd')]=_0x3e30d3[_0xc36b('0xd')]?_0x3e30d3[_0xc36b('0xd')]:undefined;this[_0xc36b('0xe')]=_0x3e30d3[_0xc36b('0xe')];this[_0xc36b('0xf')]=_0x3e30d3[_0xc36b('0xf')];}module[_0xc36b('0x10')]=FaxAccount; \ No newline at end of file +var _0x37b8=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x4e1f46,_0x3deec6){var _0x239acb=function(_0x4837aa){while(--_0x4837aa){_0x4e1f46['push'](_0x4e1f46['shift']());}};_0x239acb(++_0x3deec6);}(_0x37b8,0x186));var _0x837b=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x37b8[_0x1dc24d];return _0x5d7fb2;};'use strict';function FaxAccount(_0x224e9f){this['id']=_0x224e9f['id']||0x0;this[_0x837b('0x0')]=_0x224e9f[_0x837b('0x0')]||'';this[_0x837b('0x1')]=_0x224e9f['description'];this[_0x837b('0x2')]=_0x224e9f[_0x837b('0x2')];this[_0x837b('0x3')]=_0x224e9f[_0x837b('0x3')];this[_0x837b('0x4')]=_0x224e9f[_0x837b('0x4')];this[_0x837b('0x5')]=_0x224e9f[_0x837b('0x5')]||0x960;this[_0x837b('0x6')]=_0x224e9f['maxrate']||0x3840;this[_0x837b('0x7')]=_0x224e9f[_0x837b('0x7')]||'v17,v27,v29';this[_0x837b('0x8')]=_0x224e9f[_0x837b('0x8')]||'no';this[_0x837b('0x9')]=_0x224e9f[_0x837b('0x9')]||'no';this[_0x837b('0xa')]=_0x224e9f[_0x837b('0xa')]||0x1388;this['tech']=_0x224e9f[_0x837b('0xb')]||_0x837b('0xc');this[_0x837b('0xd')]=_0x224e9f[_0x837b('0xd')]?_0x224e9f[_0x837b('0xd')]:undefined;this[_0x837b('0xe')]=_0x224e9f[_0x837b('0xe')];this['key']=_0x224e9f[_0x837b('0xf')];}module[_0x837b('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 77d1f5a..593fadc 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 _0x105a=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x23285f,_0x5529ce){var _0x1a5a34=function(_0x57cd52){while(--_0x57cd52){_0x23285f['push'](_0x23285f['shift']());}};_0x1a5a34(++_0x5529ce);}(_0x105a,0xa2));var _0xa105=function(_0x518449,_0x501c3c){_0x518449=_0x518449-0x0;var _0x1fe9b5=_0x105a[_0x518449];return _0x1fe9b5;};'use strict';function FreshdeskAccount(_0x2dc69d){this['id']=_0x2dc69d['id']||0x0;this[_0xa105('0x0')]=_0x2dc69d[_0xa105('0x0')]||'';this[_0xa105('0x1')]=_0x2dc69d[_0xa105('0x1')]||'';this['apiKey']=_0x2dc69d[_0xa105('0x2')]||'';this[_0xa105('0x3')]=_0x2dc69d['remoteUri']||'';this[_0xa105('0x4')]=_0x2dc69d[_0xa105('0x4')]||'';this[_0xa105('0x5')]=_0x2dc69d[_0xa105('0x5')]||{};}module[_0xa105('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x2a6d=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x10a0e5,_0x314414){var _0x202eb5=function(_0x3a5879){while(--_0x3a5879){_0x10a0e5['push'](_0x10a0e5['shift']());}};_0x202eb5(++_0x314414);}(_0x2a6d,0x199));var _0xd2a6=function(_0x28f172,_0x1e1d1d){_0x28f172=_0x28f172-0x0;var _0x4435ad=_0x2a6d[_0x28f172];return _0x4435ad;};'use strict';function FreshdeskAccount(_0x3da1e2){this['id']=_0x3da1e2['id']||0x0;this[_0xd2a6('0x0')]=_0x3da1e2['name']||'';this['username']=_0x3da1e2[_0xd2a6('0x1')]||'';this[_0xd2a6('0x2')]=_0x3da1e2[_0xd2a6('0x3')]||'';this[_0xd2a6('0x4')]=_0x3da1e2['remoteUri']||'';this[_0xd2a6('0x5')]=_0x3da1e2[_0xd2a6('0x5')]||'';this[_0xd2a6('0x6')]=_0x3da1e2['Configurations']||{};}module[_0xd2a6('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 6abf459..5a18f9f 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 _0x4d61=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x4d61,0x147));var _0x14d6=function(_0x3af3b3,_0x545689){_0x3af3b3=_0x3af3b3-0x0;var _0x5bd063=_0x4d61[_0x3af3b3];return _0x5bd063;};'use strict';function FreshsalesAccount(_0x1c3b55){this['id']=_0x1c3b55['id']||0x0;this[_0x14d6('0x0')]=_0x1c3b55[_0x14d6('0x0')]||'';this[_0x14d6('0x1')]=_0x1c3b55[_0x14d6('0x1')]||'';this[_0x14d6('0x2')]=_0x1c3b55[_0x14d6('0x3')]||'';this[_0x14d6('0x4')]=_0x1c3b55[_0x14d6('0x4')]||'';this['serverUrl']=_0x1c3b55[_0x14d6('0x5')]||'';this[_0x14d6('0x6')]=_0x1c3b55[_0x14d6('0x6')]||{};}module[_0x14d6('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x544f=['serverUrl','Configurations','username','apiKey','token','remoteUri'];(function(_0x43b99a,_0x50cd1a){var _0xad461f=function(_0x2a1d67){while(--_0x2a1d67){_0x43b99a['push'](_0x43b99a['shift']());}};_0xad461f(++_0x50cd1a);}(_0x544f,0x14c));var _0xf544=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x544f[_0x30c649];return _0x3edfb9;};'use strict';function FreshsalesAccount(_0x363603){this['id']=_0x363603['id']||0x0;this['name']=_0x363603['name']||'';this[_0xf544('0x0')]=_0x363603[_0xf544('0x0')]||'';this[_0xf544('0x1')]=_0x363603[_0xf544('0x2')]||'';this['remoteUri']=_0x363603[_0xf544('0x3')]||'';this[_0xf544('0x4')]=_0x363603['serverUrl']||'';this[_0xf544('0x5')]=_0x363603[_0xf544('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 600ff07..fa33012 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 _0x3799=['inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','connectedlinenum','accountcode','context','exten','holdtime','motionChannel','voice','routealias','mohtime','variables','exports','type'];(function(_0x1f05a5,_0x10c7d7){var _0xa869de=function(_0x38505c){while(--_0x38505c){_0x1f05a5['push'](_0x1f05a5['shift']());}};_0xa869de(++_0x10c7d7);}(_0x3799,0x1c7));var _0x9379=function(_0x29177c,_0x5cb938){_0x29177c=_0x29177c-0x0;var _0x2ef521=_0x3799[_0x29177c];return _0x2ef521;};'use strict';function QueueReport(){this[_0x9379('0x0')]=_0x9379('0x1');this[_0x9379('0x2')]='';this[_0x9379('0x3')]='';this[_0x9379('0x4')]='';this[_0x9379('0x5')]='';this[_0x9379('0x6')]=null;this[_0x9379('0x7')]=null;this[_0x9379('0x8')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x9379('0x9')]=null;this[_0x9379('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x9379('0xb')]=![];this['queuecallerexitAt']=null;this[_0x9379('0xc')]=0x1;this['channel']='';this[_0x9379('0xd')]='';this['connectedlinename']='';this[_0x9379('0xe')]='';this[_0x9379('0xf')]='';this[_0x9379('0x10')]='';this['priority']='';this[_0x9379('0x11')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x9379('0x12')]=_0x9379('0x13');this[_0x9379('0x14')]=null;this[_0x9379('0x15')]=0x0;this[_0x9379('0x16')]={};}module[_0x9379('0x17')]=QueueReport; \ No newline at end of file +var _0xc2a2=['channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x36c93c,_0x3077c0){var _0x21f1db=function(_0x506866){while(--_0x506866){_0x36c93c['push'](_0x36c93c['shift']());}};_0x21f1db(++_0x3077c0);}(_0xc2a2,0x1df));var _0x2c2a=function(_0x4caacb,_0x130a67){_0x4caacb=_0x4caacb-0x0;var _0xb4857f=_0xc2a2[_0x4caacb];return _0xb4857f;};'use strict';function QueueReport(){this['type']=_0x2c2a('0x0');this[_0x2c2a('0x1')]='';this[_0x2c2a('0x2')]='';this[_0x2c2a('0x3')]='';this['queue']='';this[_0x2c2a('0x4')]=null;this[_0x2c2a('0x5')]=null;this[_0x2c2a('0x6')]=0x1;this['count']=0x1;this[_0x2c2a('0x7')]=![];this[_0x2c2a('0x8')]=null;this[_0x2c2a('0x9')]=![];this[_0x2c2a('0xa')]=null;this[_0x2c2a('0xb')]=![];this[_0x2c2a('0xc')]=null;this[_0x2c2a('0xd')]=0x1;this[_0x2c2a('0xe')]='';this[_0x2c2a('0xf')]='';this[_0x2c2a('0x10')]='';this[_0x2c2a('0x11')]='';this[_0x2c2a('0x12')]='';this[_0x2c2a('0x13')]='';this[_0x2c2a('0x14')]='';this[_0x2c2a('0x15')]=0x0;this[_0x2c2a('0x16')]=![];this[_0x2c2a('0x17')]='';this[_0x2c2a('0x18')]=_0x2c2a('0x19');this[_0x2c2a('0x1a')]=null;this[_0x2c2a('0x1b')]=0x0;this[_0x2c2a('0x1c')]={};}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 99fc83e..4b2e20f 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 _0x1337=['name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab','serverUrl','Configurations','exports'];(function(_0x41f81d,_0x4e7fa2){var _0x37a0fe=function(_0x15bdb6){while(--_0x15bdb6){_0x41f81d['push'](_0x41f81d['shift']());}};_0x37a0fe(++_0x4e7fa2);}(_0x1337,0x1ce));var _0x7133=function(_0x11f541,_0x287622){_0x11f541=_0x11f541-0x0;var _0xc9be7d=_0x1337[_0x11f541];return _0xc9be7d;};'use strict';function SalesforceAccount(_0x1629d4){this['id']=_0x1629d4['id']||0x0;this['name']=_0x1629d4[_0x7133('0x0')]||'';this[_0x7133('0x1')]=_0x1629d4[_0x7133('0x1')]||'';this[_0x7133('0x2')]=_0x1629d4['remoteUri']||'';this['password']=_0x1629d4[_0x7133('0x3')]||'';this['clientId']=_0x1629d4[_0x7133('0x4')]||'';this[_0x7133('0x5')]=_0x1629d4[_0x7133('0x5')]||'';this[_0x7133('0x6')]=_0x1629d4[_0x7133('0x6')]||'';this['type']=_0x1629d4['type']||_0x7133('0x7');this[_0x7133('0x8')]=_0x1629d4['serverUrl']||'';this[_0x7133('0x9')]=_0x1629d4[_0x7133('0x9')]||{};}module[_0x7133('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd8da=['clientSecret','securityToken','type','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xd8da,0x11d));var _0xad8d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xd8da[_0x1f9f37];return _0x21c080;};'use strict';function SalesforceAccount(_0x4e509c){this['id']=_0x4e509c['id']||0x0;this[_0xad8d('0x0')]=_0x4e509c[_0xad8d('0x0')]||'';this[_0xad8d('0x1')]=_0x4e509c[_0xad8d('0x1')]||'';this[_0xad8d('0x2')]=_0x4e509c[_0xad8d('0x2')]||'';this[_0xad8d('0x3')]=_0x4e509c[_0xad8d('0x3')]||'';this[_0xad8d('0x4')]=_0x4e509c[_0xad8d('0x4')]||'';this[_0xad8d('0x5')]=_0x4e509c[_0xad8d('0x5')]||'';this[_0xad8d('0x6')]=_0x4e509c['securityToken']||'';this[_0xad8d('0x7')]=_0x4e509c[_0xad8d('0x7')]||'integrationTab';this[_0xad8d('0x8')]=_0x4e509c[_0xad8d('0x8')]||'';this[_0xad8d('0x9')]=_0x4e509c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index eb2107a..7136b93 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 _0x2fc4=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x2fc4,0x1e6));var _0x42fc=function(_0x132a11,_0x2d0fa9){_0x132a11=_0x132a11-0x0;var _0xaf3815=_0x2fc4[_0x132a11];return _0xaf3815;};'use strict';function ServicenowAccount(_0xb044e6){this['id']=_0xb044e6['id']||0x0;this[_0x42fc('0x0')]=_0xb044e6[_0x42fc('0x0')]||'';this[_0x42fc('0x1')]=_0xb044e6['username']||'';this[_0x42fc('0x2')]=_0xb044e6[_0x42fc('0x2')]||'';this[_0x42fc('0x3')]=_0xb044e6[_0x42fc('0x3')]||'';this[_0x42fc('0x4')]=_0xb044e6[_0x42fc('0x4')]||'';this['Configurations']=_0xb044e6[_0x42fc('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x656f=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x656f,0xea));var _0xf656=function(_0x19c79a,_0x322073){_0x19c79a=_0x19c79a-0x0;var _0x48ba88=_0x656f[_0x19c79a];return _0x48ba88;};'use strict';function ServicenowAccount(_0x38e315){this['id']=_0x38e315['id']||0x0;this[_0xf656('0x0')]=_0x38e315[_0xf656('0x0')]||'';this['username']=_0x38e315[_0xf656('0x1')]||'';this[_0xf656('0x2')]=_0x38e315[_0xf656('0x2')]||'';this[_0xf656('0x3')]=_0x38e315[_0xf656('0x3')]||'';this[_0xf656('0x4')]=_0x38e315[_0xf656('0x4')]||'';this[_0xf656('0x5')]=_0x38e315[_0xf656('0x5')]||{};}module[_0xf656('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 58238c4..d626cfe 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 _0x46a5=['exports','name','password','remoteUri','serverUrl','Configurations'];(function(_0x205b46,_0x3ca65b){var _0x2b6ae8=function(_0x1f4ae9){while(--_0x1f4ae9){_0x205b46['push'](_0x205b46['shift']());}};_0x2b6ae8(++_0x3ca65b);}(_0x46a5,0x1e1));var _0x546a=function(_0x5e7c88,_0x34064c){_0x5e7c88=_0x5e7c88-0x0;var _0x23ffa5=_0x46a5[_0x5e7c88];return _0x23ffa5;};'use strict';function SugarcrmAccount(_0x4b9f79){this['id']=_0x4b9f79['id']||0x0;this[_0x546a('0x0')]=_0x4b9f79[_0x546a('0x0')]||'';this['username']=_0x4b9f79['username']||'';this[_0x546a('0x1')]=_0x4b9f79[_0x546a('0x1')]||'';this[_0x546a('0x2')]=_0x4b9f79[_0x546a('0x2')]||'';this[_0x546a('0x3')]=_0x4b9f79['serverUrl']||'';this[_0x546a('0x4')]=_0x4b9f79[_0x546a('0x4')]||{};}module[_0x546a('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x15ad=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x149bd6,_0x338853){var _0x28cd8c=function(_0x479167){while(--_0x479167){_0x149bd6['push'](_0x149bd6['shift']());}};_0x28cd8c(++_0x338853);}(_0x15ad,0x1ac));var _0xd15a=function(_0x2dcb48,_0x51a2a1){_0x2dcb48=_0x2dcb48-0x0;var _0x204741=_0x15ad[_0x2dcb48];return _0x204741;};'use strict';function SugarcrmAccount(_0x11a02f){this['id']=_0x11a02f['id']||0x0;this[_0xd15a('0x0')]=_0x11a02f[_0xd15a('0x0')]||'';this[_0xd15a('0x1')]=_0x11a02f['username']||'';this[_0xd15a('0x2')]=_0x11a02f[_0xd15a('0x2')]||'';this[_0xd15a('0x3')]=_0x11a02f['remoteUri']||'';this[_0xd15a('0x4')]=_0x11a02f[_0xd15a('0x4')]||'';this[_0xd15a('0x5')]=_0x11a02f[_0xd15a('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0bea691..34defb9 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 _0x40a3=['status','address','exports','accountcode','unknown','stateTime'];(function(_0x55df56,_0x57d288){var _0x23df28=function(_0x1867a6){while(--_0x1867a6){_0x55df56['push'](_0x55df56['shift']());}};_0x23df28(++_0x57d288);}(_0x40a3,0x153));var _0x340a=function(_0x594281,_0x1767e2){_0x594281=_0x594281-0x0;var _0x4e702e=_0x40a3[_0x594281];return _0x4e702e;};'use strict';function Telephone(_0x3422bb){this['id']=_0x3422bb['id']||0x0;this['name']=_0x3422bb['name']||'';this['accountcode']=_0x3422bb[_0x340a('0x0')]||'';this['state']=_0x340a('0x1');this[_0x340a('0x2')]=0x0;this[_0x340a('0x3')]=_0x340a('0x1');this[_0x340a('0x4')]='';}module[_0x340a('0x5')]=Telephone; \ No newline at end of file +var _0x241f=['unknown','stateTime','status','address','name','accountcode','state'];(function(_0x4dd566,_0xb70f5a){var _0x57a60f=function(_0x513669){while(--_0x513669){_0x4dd566['push'](_0x4dd566['shift']());}};_0x57a60f(++_0xb70f5a);}(_0x241f,0x123));var _0xf241=function(_0x1a422a,_0x3468fd){_0x1a422a=_0x1a422a-0x0;var _0x4dcab4=_0x241f[_0x1a422a];return _0x4dcab4;};'use strict';function Telephone(_0x2c0b47){this['id']=_0x2c0b47['id']||0x0;this[_0xf241('0x0')]=_0x2c0b47['name']||'';this[_0xf241('0x1')]=_0x2c0b47['accountcode']||'';this[_0xf241('0x2')]=_0xf241('0x3');this[_0xf241('0x4')]=0x0;this[_0xf241('0x5')]=_0xf241('0x3');this[_0xf241('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a1d0d1d..c2cb09b 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x51e7fb,_0xca1111){var _0x5c7c2d=function(_0x15a0c9){while(--_0x15a0c9){_0x51e7fb['push'](_0x51e7fb['shift']());}};_0x5c7c2d(++_0xca1111);}(_0xb10b,0x12a));var _0xbb10=function(_0xaf2427,_0x504859){_0xaf2427=_0xaf2427-0x0;var _0x67addb=_0xb10b[_0xaf2427];return _0x67addb;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1e2141,_0x338e4b){var _0xbfee13=function(_0x1de633){while(--_0x1de633){_0x1e2141['push'](_0x1e2141['shift']());}};_0xbfee13(++_0x338e4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 34c6c02..4544af7 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0xe1928f,_0x53a3e0){var _0x18c9bb=function(_0x23ade4){while(--_0x23ade4){_0xe1928f['push'](_0xe1928f['shift']());}};_0x18c9bb(++_0x53a3e0);}(_0x14a0,0x8e));var _0x014a=function(_0x9fc556,_0x40773f){_0x9fc556=_0x9fc556-0x0;var _0x87f182=_0x14a0[_0x9fc556];return _0x87f182;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x557ca0,_0x1abf84){var _0x181ca0=function(_0x4a4081){while(--_0x4a4081){_0x557ca0['push'](_0x557ca0['shift']());}};_0x181ca0(++_0x1abf84);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e8aa3,_0x39dc99){_0x3e8aa3=_0x3e8aa3-0x0;var _0x1d2c3e=_0x5f2f[_0x3e8aa3];return _0x1d2c3e;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 65a5548..c0dbbd0 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 _0xda9b=['port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','stateTime','unknown','registry','indexOf','split','host'];(function(_0xf1ceb4,_0x3443e6){var _0x42ed45=function(_0x9ec7fa){while(--_0x9ec7fa){_0xf1ceb4['push'](_0xf1ceb4['shift']());}};_0x42ed45(++_0x3443e6);}(_0xda9b,0xe5));var _0xbda9=function(_0x8b9ceb,_0x2a3329){_0x8b9ceb=_0x8b9ceb-0x0;var _0x45e678=_0xda9b[_0x8b9ceb];return _0x45e678;};'use strict';function Trunk(_0x369b53){this['id']=_0x369b53['id']||0x0;this[_0xbda9('0x0')]=_0x369b53[_0xbda9('0x0')]||![];this[_0xbda9('0x1')]=_0x369b53['name']||'';this[_0xbda9('0x2')]='unknown';this[_0xbda9('0x3')]=0x0;this['status']=_0xbda9('0x4');this[_0xbda9('0x5')]=_0x369b53[_0xbda9('0x5')]&&_0x369b53[_0xbda9('0x5')][_0xbda9('0x6')](':')?_0x369b53[_0xbda9('0x5')][_0xbda9('0x7')](':')[0x0]:'';this[_0xbda9('0x8')]='';this[_0xbda9('0x9')]='';this[_0xbda9('0xa')]='';this[_0xbda9('0xb')]='';this[_0xbda9('0xc')]='';this[_0xbda9('0xd')]='unknown';this['registrationtime']='';this[_0xbda9('0xe')]='';this[_0xbda9('0xf')]=_0x369b53[_0xbda9('0xf')]||'';}module[_0xbda9('0x10')]=Trunk; \ No newline at end of file +var _0xfd99=['refresh','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport'];(function(_0x56975e,_0x587d46){var _0x16c8d2=function(_0x2b52e6){while(--_0x2b52e6){_0x56975e['push'](_0x56975e['shift']());}};_0x16c8d2(++_0x587d46);}(_0xfd99,0xe3));var _0x9fd9=function(_0x59d708,_0x1a2388){_0x59d708=_0x59d708-0x0;var _0x1b3f4d=_0xfd99[_0x59d708];return _0x1b3f4d;};'use strict';function Trunk(_0x3356be){this['id']=_0x3356be['id']||0x0;this[_0x9fd9('0x0')]=_0x3356be[_0x9fd9('0x0')]||![];this[_0x9fd9('0x1')]=_0x3356be['name']||'';this[_0x9fd9('0x2')]=_0x9fd9('0x3');this[_0x9fd9('0x4')]=0x0;this[_0x9fd9('0x5')]=_0x9fd9('0x3');this[_0x9fd9('0x6')]=_0x3356be['registry']&&_0x3356be['registry'][_0x9fd9('0x7')](':')?_0x3356be[_0x9fd9('0x6')][_0x9fd9('0x8')](':')[0x0]:'';this[_0x9fd9('0x9')]='';this[_0x9fd9('0xa')]='';this[_0x9fd9('0xb')]='';this[_0x9fd9('0xc')]='';this[_0x9fd9('0xd')]='';this['stateRegistry']='unknown';this['registrationtime']='';this['address']='';this['defaultuser']=_0x3356be['defaultuser']||'';}module[_0x9fd9('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a2bc4bc..af24353 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 _0x043f=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3abad1,_0x322d37){var _0x202ee8=function(_0x5bc56c){while(--_0x5bc56c){_0x3abad1['push'](_0x3abad1['shift']());}};_0x202ee8(++_0x322d37);}(_0x043f,0x112));var _0xf043=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x043f[_0x4f0c2b];return _0x526436;};'use strict';function voiceExtension(_0x17275a){this['id']=_0x17275a['id']||0x0;this[_0xf043('0x0')]=_0x17275a['exten']||'';this[_0xf043('0x1')]=_0x17275a[_0xf043('0x1')]||_0xf043('0x2');this[_0xf043('0x3')]=_0x17275a['mandatoryDisposition']||![];}module[_0xf043('0x4')]=voiceExtension; \ No newline at end of file +var _0x1be9=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0x1be9,0xab));var _0x91be=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1be9[_0x40220a];return _0x3903cc;};'use strict';function voiceExtension(_0xf24e5e){this['id']=_0xf24e5e['id']||0x0;this[_0x91be('0x0')]=_0xf24e5e[_0x91be('0x0')]||'';this[_0x91be('0x1')]=_0xf24e5e[_0x91be('0x1')]||'none';this[_0x91be('0x2')]=_0xf24e5e[_0x91be('0x2')]||![];}module[_0x91be('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 109ca99..1853682 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 _0xe9e5=['dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','unmanaged','available','inUse','invalid','notInUse','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xe9e5,0x138));var _0x5e9e=function(_0x4fdd28,_0xa33304){_0x4fdd28=_0x4fdd28-0x0;var _0x117f46=_0xe9e5[_0x4fdd28];return _0x117f46;};'use strict';var monitorFormat={'wav':_0x5e9e('0x0'),'wav49':_0x5e9e('0x1'),'gsm':_0x5e9e('0x2')};var strategy={'fewestcalls':_0x5e9e('0x3'),'leastrecent':_0x5e9e('0x4'),'linear':_0x5e9e('0x5'),'random':_0x5e9e('0x6'),'ringall':'ringall','rr':_0x5e9e('0x7'),'rrmemory':_0x5e9e('0x8'),'rrordered':'rrordered','wrandom':_0x5e9e('0x9')};function VoiceQueue(_0x2cb5e1){this['id']=_0x2cb5e1['id']||0x0;this[_0x5e9e('0xa')]=_0x2cb5e1[_0x5e9e('0xa')]||'';this[_0x5e9e('0xb')]=_0x2cb5e1['monitor_format']||'';this['type']=_0x2cb5e1[_0x5e9e('0xc')]||_0x5e9e('0xd');this[_0x5e9e('0xe')]=0x0;this['total']=0x0;this[_0x5e9e('0xf')]=0x0;this[_0x5e9e('0x10')]=0x0;this[_0x5e9e('0x11')]=0x0;this['sumBillable']=0x0;this[_0x5e9e('0x12')]=0x0;this['abandoned']=0x0;this[_0x5e9e('0x13')]=0x0;this['busy']=0x0;this[_0x5e9e('0x14')]=0x0;this[_0x5e9e('0x15')]=0x0;this['loggedIn']=0x0;this[_0x5e9e('0x16')]=0x0;this['onHold']=0x0;this[_0x5e9e('0x17')]=0x0;this[_0x5e9e('0x18')]=0x0;this[_0x5e9e('0x19')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0x5e9e('0x1a')]=0x0;this[_0x5e9e('0x1b')]=_0x2cb5e1[_0x5e9e('0x1b')]||![];this[_0x5e9e('0x1c')]=_0x2cb5e1[_0x5e9e('0x1c')]||0xa;this[_0x5e9e('0x1d')]=_0x2cb5e1[_0x5e9e('0x1d')]||'no';this[_0x5e9e('0x1e')]=!![];this[_0x5e9e('0x1f')]='';this[_0x5e9e('0x20')]='';this[_0x5e9e('0x21')]=0x0;this[_0x5e9e('0x22')]=0x0;this[_0x5e9e('0x23')]=_0x2cb5e1[_0x5e9e('0x23')]||null;this[_0x5e9e('0x24')]=_0x2cb5e1[_0x5e9e('0x24')]?_0x2cb5e1['dialGlobalInterval']:null;this['dialActive']=_0x2cb5e1['dialActive'];this[_0x5e9e('0x25')]=_0x2cb5e1[_0x5e9e('0x25')]||_0x5e9e('0x26');this[_0x5e9e('0x27')]=_0x2cb5e1[_0x5e9e('0x27')]||0x0;this[_0x5e9e('0x28')]=_0x2cb5e1['dialLimitQueue']||0x0;this[_0x5e9e('0x29')]=_0x2cb5e1[_0x5e9e('0x29')]||0x1;this[_0x5e9e('0x2a')]=_0x2cb5e1[_0x5e9e('0x2a')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x2cb5e1[_0x5e9e('0x2b')]||0.03;this[_0x5e9e('0x2c')]=_0x2cb5e1[_0x5e9e('0x2c')]||0x258;this[_0x5e9e('0x2d')]=_0x2cb5e1[_0x5e9e('0x2d')]||_0x5e9e('0x2e');this['dialOriginateCallerIdNumber']=_0x2cb5e1[_0x5e9e('0x2f')]||_0x5e9e('0x2e');this['dialOriginateTimeout']=_0x2cb5e1[_0x5e9e('0x30')]||0x1e;this[_0x5e9e('0x31')]=_0x2cb5e1[_0x5e9e('0x31')]||'tTxX';this[_0x5e9e('0x32')]=_0x2cb5e1[_0x5e9e('0x32')]||0x3;this['dialQueueProject']=_0x2cb5e1['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x2cb5e1[_0x5e9e('0x33')]||0x3;this[_0x5e9e('0x34')]=_0x2cb5e1[_0x5e9e('0x34')]||0x96;this['dialBusyMaxRetry']=_0x2cb5e1[_0x5e9e('0x35')]||0x3;this[_0x5e9e('0x36')]=_0x2cb5e1['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x2cb5e1[_0x5e9e('0x37')]||0x3;this[_0x5e9e('0x38')]=_0x2cb5e1[_0x5e9e('0x38')]||0x96;this[_0x5e9e('0x39')]=_0x2cb5e1['dialNoSuchNumberMaxRetry']||0x3;this[_0x5e9e('0x3a')]=_0x2cb5e1[_0x5e9e('0x3a')]||0x96;this[_0x5e9e('0x3b')]=_0x2cb5e1['dialDropMaxRetry']||0x3;this[_0x5e9e('0x3c')]=_0x2cb5e1[_0x5e9e('0x3c')]||0x96;this['dialAbandonedMaxRetry']=_0x2cb5e1['dialAbandonedMaxRetry']||0x3;this[_0x5e9e('0x3d')]=_0x2cb5e1[_0x5e9e('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x2cb5e1[_0x5e9e('0x3e')]||0x3;this['dialMachineRetryFrequency']=_0x2cb5e1[_0x5e9e('0x3f')]||0x96;this[_0x5e9e('0x40')]=_0x2cb5e1[_0x5e9e('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2cb5e1['dialAgentRejectRetryFrequency']||0x96;this[_0x5e9e('0x41')]=_0x2cb5e1[_0x5e9e('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x2cb5e1['dialGlobalMaxRetry']||0x4;this[_0x5e9e('0x42')]=_0x2cb5e1[_0x5e9e('0x42')]?_0x2cb5e1[_0x5e9e('0x42')]:undefined;this[_0x5e9e('0x43')]=_0x2cb5e1[_0x5e9e('0x43')]?_0x2cb5e1[_0x5e9e('0x43')]:undefined;this[_0x5e9e('0x44')]=_0x2cb5e1[_0x5e9e('0x44')]||undefined;this[_0x5e9e('0x45')]=_0x2cb5e1[_0x5e9e('0x45')]?_0x2cb5e1[_0x5e9e('0x45')]:undefined;this[_0x5e9e('0x46')]=_0x2cb5e1[_0x5e9e('0x46')]||_0x5e9e('0x47');this[_0x5e9e('0x48')]=_0x2cb5e1['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x2cb5e1['dialCutDigit']||undefined;this[_0x5e9e('0x49')]=strategy[_0x2cb5e1['strategy']];this[_0x5e9e('0x4a')]=!![];this[_0x5e9e('0x4b')]=_0x2cb5e1['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2cb5e1['dialAMDInitialSilence'];this[_0x5e9e('0x4c')]=_0x2cb5e1['dialAMDGreeting'];this[_0x5e9e('0x4d')]=_0x2cb5e1[_0x5e9e('0x4d')];this[_0x5e9e('0x4e')]=_0x2cb5e1[_0x5e9e('0x4e')];this['dialAMDMinWordLength']=_0x2cb5e1[_0x5e9e('0x4f')];this[_0x5e9e('0x50')]=_0x2cb5e1['dialAMDBetweenWordsSilence'];this[_0x5e9e('0x51')]=_0x2cb5e1[_0x5e9e('0x51')];this[_0x5e9e('0x52')]=_0x2cb5e1['dialAMDSilenceThreshold'];this[_0x5e9e('0x53')]=_0x2cb5e1[_0x5e9e('0x53')];this[_0x5e9e('0x54')]=0x0;this[_0x5e9e('0x55')]=0x0;this[_0x5e9e('0x56')]=_0x2cb5e1[_0x5e9e('0x56')];this['outboundAnswerCallsDay']=0x0;this[_0x5e9e('0x57')]=0x0;this[_0x5e9e('0x58')]=0x0;this[_0x5e9e('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x5e9e('0x5a')]=0x0;this[_0x5e9e('0x5b')]=0x0;this[_0x5e9e('0x5c')]=0x0;this[_0x5e9e('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x5e9e('0x5e')]=0x0;this[_0x5e9e('0x5f')]=0x0;this[_0x5e9e('0x60')]=0x0;this[_0x5e9e('0x61')]=0x0;this[_0x5e9e('0x62')]=undefined;this[_0x5e9e('0x63')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x5e9e('0x64')]=0x0;this[_0x5e9e('0x65')]=0x0;this[_0x5e9e('0x66')]=0x0;this[_0x5e9e('0x67')]=0x0;this[_0x5e9e('0x68')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x5e9e('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2cb5e1[_0x5e9e('0x6a')]||0x14;this[_0x5e9e('0x6b')]=_0x2cb5e1['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x5e9e('0x6c')]=0x0;this[_0x5e9e('0x6d')]=0x0;this[_0x5e9e('0x6e')]=0x1;this[_0x5e9e('0x6f')]=0x0;this[_0x5e9e('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x5e9e('0x71')]=_0x2cb5e1[_0x5e9e('0x71')]||0x1e;this[_0x5e9e('0x72')]=_0x2cb5e1['dialRecallInQueue']||![];this[_0x5e9e('0x73')]=!!_0x2cb5e1[_0x5e9e('0x73')]||![];this[_0x5e9e('0x74')]=!!_0x2cb5e1['dialPreviewRecallmeReminder']||![];this[_0x5e9e('0x75')]=_0x2cb5e1[_0x5e9e('0x75')]||undefined;this[_0x5e9e('0x76')]=_0x2cb5e1[_0x5e9e('0x76')]||![];this[_0x5e9e('0x77')]=_0x2cb5e1[_0x5e9e('0x77')]||![];this[_0x5e9e('0xb')]=monitorFormat[_0x2cb5e1['monitor_format']]?monitorFormat[_0x2cb5e1[_0x5e9e('0xb')]]:undefined;this[_0x5e9e('0x78')]=_0x2cb5e1[_0x5e9e('0x78')]||![];this['mandatoryDispositionPause']=_0x2cb5e1[_0x5e9e('0x79')]?_0x2cb5e1[_0x5e9e('0x79')]:undefined;this[_0x5e9e('0x7a')]=![];}module[_0x5e9e('0x7b')]=VoiceQueue; \ No newline at end of file +var _0xaf79=['wav','gsm','fewestcalls','leastrecent','linear','random','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports'];(function(_0x48c0d3,_0x436608){var _0x2e63f9=function(_0x5bcb9c){while(--_0x5bcb9c){_0x48c0d3['push'](_0x48c0d3['shift']());}};_0x2e63f9(++_0x436608);}(_0xaf79,0x1f0));var _0x9af7=function(_0x1335a4,_0x38fbad){_0x1335a4=_0x1335a4-0x0;var _0x8b933c=_0xaf79[_0x1335a4];return _0x8b933c;};'use strict';var monitorFormat={'wav':_0x9af7('0x0'),'wav49':'wav49','gsm':_0x9af7('0x1')};var strategy={'fewestcalls':_0x9af7('0x2'),'leastrecent':_0x9af7('0x3'),'linear':_0x9af7('0x4'),'random':_0x9af7('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x9af7('0x6')};function VoiceQueue(_0x4391bf){this['id']=_0x4391bf['id']||0x0;this[_0x9af7('0x7')]=_0x4391bf[_0x9af7('0x7')]||'';this['monitor_format']=_0x4391bf[_0x9af7('0x8')]||'';this[_0x9af7('0x9')]=_0x4391bf['type']||_0x9af7('0xa');this[_0x9af7('0xb')]=0x0;this[_0x9af7('0xc')]=0x0;this[_0x9af7('0xd')]=0x0;this['sumDuration']=0x0;this[_0x9af7('0xe')]=0x0;this[_0x9af7('0xf')]=0x0;this[_0x9af7('0x10')]=0x0;this[_0x9af7('0x11')]=0x0;this[_0x9af7('0x12')]=0x0;this[_0x9af7('0x13')]=0x0;this[_0x9af7('0x14')]=0x0;this[_0x9af7('0x15')]=0x0;this[_0x9af7('0x16')]=0x0;this[_0x9af7('0x17')]=0x0;this[_0x9af7('0x18')]=0x0;this[_0x9af7('0x19')]=0x0;this[_0x9af7('0x1a')]=0x0;this[_0x9af7('0x1b')]=0x0;this[_0x9af7('0x1c')]=0x0;this[_0x9af7('0x1d')]=0x0;this['unknown']=0x0;this[_0x9af7('0x1e')]=_0x4391bf[_0x9af7('0x1e')]||![];this[_0x9af7('0x1f')]=_0x4391bf[_0x9af7('0x1f')]||0xa;this[_0x9af7('0x20')]=_0x4391bf[_0x9af7('0x20')]||'no';this[_0x9af7('0x21')]=!![];this['message']='';this[_0x9af7('0x22')]='';this['originated']=0x0;this['temp']=0x0;this[_0x9af7('0x23')]=_0x4391bf[_0x9af7('0x23')]||null;this[_0x9af7('0x24')]=_0x4391bf[_0x9af7('0x24')]?_0x4391bf[_0x9af7('0x24')]:null;this[_0x9af7('0x25')]=_0x4391bf[_0x9af7('0x25')];this[_0x9af7('0x26')]=_0x4391bf[_0x9af7('0x26')]||_0x9af7('0x27');this[_0x9af7('0x28')]=_0x4391bf[_0x9af7('0x28')]||0x0;this['dialLimitQueue']=_0x4391bf[_0x9af7('0x29')]||0x0;this[_0x9af7('0x2a')]=_0x4391bf[_0x9af7('0x2a')]||0x1;this[_0x9af7('0x2b')]=_0x4391bf[_0x9af7('0x2b')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x4391bf[_0x9af7('0x2c')]||0.03;this['dialPredictiveInterval']=_0x4391bf['dialPredictiveInterval']||0x258;this[_0x9af7('0x2d')]=_0x4391bf[_0x9af7('0x2d')]||_0x9af7('0x2e');this['dialOriginateCallerIdNumber']=_0x4391bf['dialOriginateCallerIdNumber']||_0x9af7('0x2e');this[_0x9af7('0x2f')]=_0x4391bf[_0x9af7('0x2f')]||0x1e;this['dialQueueOptions']=_0x4391bf[_0x9af7('0x30')]||'tTxX';this[_0x9af7('0x31')]=_0x4391bf[_0x9af7('0x31')]||0x3;this[_0x9af7('0x32')]=_0x4391bf['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x4391bf['dialCongestionMaxRetry']||0x3;this[_0x9af7('0x33')]=_0x4391bf[_0x9af7('0x33')]||0x96;this[_0x9af7('0x34')]=_0x4391bf[_0x9af7('0x34')]||0x3;this[_0x9af7('0x35')]=_0x4391bf[_0x9af7('0x35')]||0x96;this[_0x9af7('0x36')]=_0x4391bf['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x4391bf[_0x9af7('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4391bf[_0x9af7('0x38')]||0x3;this[_0x9af7('0x39')]=_0x4391bf[_0x9af7('0x39')]||0x96;this[_0x9af7('0x3a')]=_0x4391bf[_0x9af7('0x3a')]||0x3;this[_0x9af7('0x3b')]=_0x4391bf[_0x9af7('0x3b')]||0x96;this[_0x9af7('0x3c')]=_0x4391bf[_0x9af7('0x3c')]||0x3;this[_0x9af7('0x3d')]=_0x4391bf[_0x9af7('0x3d')]||0x96;this[_0x9af7('0x3e')]=_0x4391bf[_0x9af7('0x3e')]||0x3;this[_0x9af7('0x3f')]=_0x4391bf[_0x9af7('0x3f')]||0x96;this[_0x9af7('0x40')]=_0x4391bf['dialAgentRejectMaxRetry']||0x3;this[_0x9af7('0x41')]=_0x4391bf['dialAgentRejectRetryFrequency']||0x96;this[_0x9af7('0x42')]=_0x4391bf[_0x9af7('0x42')]||0x3;this[_0x9af7('0x43')]=_0x4391bf['dialGlobalMaxRetry']||0x4;this[_0x9af7('0x44')]=_0x4391bf['Trunk']?_0x4391bf['Trunk']:undefined;this['TrunkBackup']=_0x4391bf[_0x9af7('0x45')]?_0x4391bf[_0x9af7('0x45')]:undefined;this['dialPrefix']=_0x4391bf[_0x9af7('0x46')]||undefined;this[_0x9af7('0x47')]=_0x4391bf[_0x9af7('0x47')]?_0x4391bf[_0x9af7('0x47')]:undefined;this[_0x9af7('0x48')]=_0x4391bf[_0x9af7('0x48')]||_0x9af7('0x49');this[_0x9af7('0x4a')]=_0x4391bf[_0x9af7('0x4a')]||undefined;this[_0x9af7('0x4b')]=_0x4391bf[_0x9af7('0x4b')]||undefined;this[_0x9af7('0x4c')]=strategy[_0x4391bf[_0x9af7('0x4c')]];this['queueStatusComplete']=!![];this[_0x9af7('0x4d')]=_0x4391bf[_0x9af7('0x4d')]||![];this[_0x9af7('0x4e')]=_0x4391bf[_0x9af7('0x4e')];this['dialAMDGreeting']=_0x4391bf['dialAMDGreeting'];this[_0x9af7('0x4f')]=_0x4391bf[_0x9af7('0x4f')];this['dialAMDTotalAnalysisTime']=_0x4391bf[_0x9af7('0x50')];this['dialAMDMinWordLength']=_0x4391bf['dialAMDMinWordLength'];this[_0x9af7('0x51')]=_0x4391bf['dialAMDBetweenWordsSilence'];this[_0x9af7('0x52')]=_0x4391bf['dialAMDMaximumNumberOfWords'];this[_0x9af7('0x53')]=_0x4391bf[_0x9af7('0x53')];this[_0x9af7('0x54')]=_0x4391bf[_0x9af7('0x54')];this[_0x9af7('0x55')]=0x0;this[_0x9af7('0x56')]=0x0;this[_0x9af7('0x57')]=_0x4391bf['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9af7('0x58')]=0x0;this[_0x9af7('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9af7('0x5a')]=0x0;this[_0x9af7('0x5b')]=0x0;this[_0x9af7('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x9af7('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x9af7('0x5e')]=0x0;this[_0x9af7('0x5f')]=0x0;this[_0x9af7('0x60')]=undefined;this[_0x9af7('0x61')]=undefined;this[_0x9af7('0x62')]=undefined;this[_0x9af7('0x63')]=1.05;this[_0x9af7('0x64')]=0x0;this[_0x9af7('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x9af7('0x66')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x9af7('0x67')]=0x0;this[_0x9af7('0x68')]=0x0;this[_0x9af7('0x69')]=0x0;this[_0x9af7('0x6a')]=_0x4391bf[_0x9af7('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x4391bf[_0x9af7('0x6b')]||0xa;this[_0x9af7('0x6c')]=0x0;this[_0x9af7('0x6d')]=0x0;this[_0x9af7('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0x9af7('0x6f')]=0x0;this[_0x9af7('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0x9af7('0x71')]=_0x4391bf['dialRecallMeTimeout']||0x1e;this[_0x9af7('0x72')]=_0x4391bf[_0x9af7('0x72')]||![];this[_0x9af7('0x73')]=!!_0x4391bf[_0x9af7('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x4391bf[_0x9af7('0x74')]||![];this[_0x9af7('0x75')]=_0x4391bf[_0x9af7('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x4391bf[_0x9af7('0x76')]||![];this[_0x9af7('0x77')]=_0x4391bf[_0x9af7('0x77')]||![];this[_0x9af7('0x8')]=monitorFormat[_0x4391bf[_0x9af7('0x8')]]?monitorFormat[_0x4391bf[_0x9af7('0x8')]]:undefined;this[_0x9af7('0x78')]=_0x4391bf[_0x9af7('0x78')]||![];this[_0x9af7('0x79')]=_0x4391bf[_0x9af7('0x79')]?_0x4391bf[_0x9af7('0x79')]:undefined;this[_0x9af7('0x7a')]=![];}module[_0x9af7('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7af4c13..945836e 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc18a=['xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedIn','loggedInDb','paused','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','exten'];(function(_0xfb29e3,_0x5997c1){var _0x508a49=function(_0x124343){while(--_0x124343){_0xfb29e3['push'](_0xfb29e3['shift']());}};_0x508a49(++_0x5997c1);}(_0xc18a,0x1cf));var _0xac18=function(_0x135cc9,_0x4ac22f){_0x135cc9=_0x135cc9-0x0;var _0x194606=_0xc18a[_0x135cc9];return _0x194606;};'use strict';var INBOUND_COUNTERS=[_0xac18('0x0'),_0xac18('0x1'),_0xac18('0x2'),_0xac18('0x3'),'ringing',_0xac18('0x4'),_0xac18('0x5')];var OUTBOUND_COUNTERS=[_0xac18('0x0'),_0xac18('0x6'),_0xac18('0x7'),_0xac18('0x1'),_0xac18('0x2'),_0xac18('0x8'),'outboundAbandonedCallsDay',_0xac18('0x9'),_0xac18('0xa'),_0xac18('0xb'),_0xac18('0xc'),_0xac18('0xd'),_0xac18('0xe'),_0xac18('0xf'),_0xac18('0x10'),_0xac18('0x11'),_0xac18('0x3'),_0xac18('0x12'),_0xac18('0x4'),_0xac18('0x13'),_0xac18('0x14'),'total',_0xac18('0x5')];function VoiceQueueSummary(_0x57b660){this['id']=_0x57b660['id'];this[_0xac18('0x15')]=_0x57b660['name'];this['strategy']=_0x57b660[_0xac18('0x16')];this['abandoned']=_0x57b660['abandoned']||0x0;this[_0xac18('0x6')]=_0x57b660[_0xac18('0x6')]||0x0;this['available']=_0x57b660[_0xac18('0x0')]||0x0;this[_0xac18('0x17')]=_0x57b660['busy']||0x0;this[_0xac18('0x7')]=_0x57b660['inUse']||0x0;this[_0xac18('0x18')]=_0x57b660['invalid']||0x0;this['loggedIn']=_0x57b660[_0xac18('0x1')]||0x0;this[_0xac18('0x2')]=_0x57b660['loggedInDb']||0x0;this['onHold']=_0x57b660[_0xac18('0x19')]||0x0;this[_0xac18('0x1a')]=_0x57b660['notInUse']||0x0;this[_0xac18('0x3')]=_0x57b660[_0xac18('0x3')]||0x0;this[_0xac18('0x1b')]=_0x57b660[_0xac18('0x1b')]||0x0;this[_0xac18('0x1c')]=_0x57b660[_0xac18('0x1c')];this[_0xac18('0x13')]=_0x57b660['sumBillable'];this[_0xac18('0x14')]=_0x57b660[_0xac18('0x14')];this[_0xac18('0x1d')]=_0x57b660[_0xac18('0x1d')]||0x0;this[_0xac18('0x4')]=_0x57b660[_0xac18('0x4')]||0x0;this[_0xac18('0x1e')]=_0x57b660[_0xac18('0x1e')]||0x0;this[_0xac18('0x1f')]=_0x57b660[_0xac18('0x1f')];this['unavailable']=_0x57b660[_0xac18('0x20')]||0x0;this[_0xac18('0x21')]=_0x57b660[_0xac18('0x21')]||0x0;this[_0xac18('0x22')]=_0x57b660[_0xac18('0x22')]||0x0;this[_0xac18('0x5')]=_0x57b660['waiting']||0x0;if(_0x57b660[_0xac18('0x1f')]===_0xac18('0x23')){this[_0xac18('0x12')]=_0x57b660['pTalking']||0x0;this[_0xac18('0x24')]=_0x57b660[_0xac18('0x24')];this[_0xac18('0x25')]=_0x57b660[_0xac18('0x25')];this[_0xac18('0x26')]=_0x57b660[_0xac18('0x26')];this[_0xac18('0x27')]=_0x57b660[_0xac18('0x27')];this['dialOriginateTimeout']=_0x57b660[_0xac18('0x28')];this[_0xac18('0x29')]=_0x57b660['dialPrefix'];this[_0xac18('0x2a')]=_0x57b660[_0xac18('0x2a')];this[_0xac18('0x2b')]=_0x57b660[_0xac18('0x2b')];this[_0xac18('0x9')]=_0x57b660[_0xac18('0x9')];this[_0xac18('0xa')]=_0x57b660[_0xac18('0xa')];this[_0xac18('0xb')]=_0x57b660[_0xac18('0xb')];this[_0xac18('0xc')]=_0x57b660['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x57b660[_0xac18('0x2c')];this[_0xac18('0x2d')]=_0x57b660[_0xac18('0x2d')];this['outboundDropCallsDayTimeout']=_0x57b660[_0xac18('0x2e')];this[_0xac18('0xd')]=_0x57b660[_0xac18('0xd')];this[_0xac18('0xe')]=_0x57b660[_0xac18('0xe')];this['outboundOriginateFailureCallsDay']=_0x57b660[_0xac18('0x2f')];this[_0xac18('0xf')]=_0x57b660['outboundReCallsDay'];this[_0xac18('0x10')]=_0x57b660[_0xac18('0x10')];this['outboundUnknownCallsDay']=_0x57b660[_0xac18('0x11')];this[_0xac18('0x30')]=_0x57b660[_0xac18('0x30')];this[_0xac18('0x31')]=_0x57b660[_0xac18('0x31')];this[_0xac18('0x32')]=_0x57b660[_0xac18('0x32')];this[_0xac18('0x33')]=_0x57b660[_0xac18('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x57b660[_0xac18('0x34')];this[_0xac18('0x35')]=_0x57b660[_0xac18('0x35')];this[_0xac18('0x36')]=_0x57b660[_0xac18('0x36')];this[_0xac18('0x37')]=_0x57b660[_0xac18('0x37')];this[_0xac18('0x38')]=_0x57b660[_0xac18('0x38')];this[_0xac18('0x39')]=_0x57b660['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x57b660[_0xac18('0x3a')];this[_0xac18('0x3b')]=_0x57b660['predictiveIntervalTotalCalls'];this[_0xac18('0x8')]=_0x57b660['originated'];this[_0xac18('0x3c')]=_0x57b660['erlangCalls'];this[_0xac18('0x3d')]=_0x57b660[_0xac18('0x3d')];this['erlangAbandonmentRate']=_0x57b660['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x57b660['erlangBusyFactor'];this['startPredictive']=_0x57b660[_0xac18('0x3e')];this['startProgressive']=_0x57b660[_0xac18('0x3f')];this[_0xac18('0x40')]=_0x57b660[_0xac18('0x40')];this[_0xac18('0x41')]=_0x57b660[_0xac18('0x41')];}if(_0x57b660[_0xac18('0x42')]){this[_0xac18('0x42')]={'id':_0x57b660['Trunk']['id'],'name':_0x57b660[_0xac18('0x42')]['name'],'active':_0x57b660[_0xac18('0x42')]['active'],'callerid':_0x57b660['Trunk'][_0xac18('0x43')]};}}VoiceQueueSummary[_0xac18('0x44')][_0xac18('0x45')]=function(_0x1ee65e,_0x1a86fc,_0xe1c6c3,_0x338f81){this[_0xac18('0x2')]=0x0;this['talking']=0x0;this[_0xac18('0x3')]=0x0;this['unknown']=0x0;this[_0xac18('0x1a')]=0x0;this['inUse']=0x0;this[_0xac18('0x17')]=0x0;this['invalid']=0x0;this[_0xac18('0x20')]=0x0;this[_0xac18('0x1b')]=0x0;this[_0xac18('0x1c')]=0x0;this[_0xac18('0x19')]=0x0;if(_0xe1c6c3){if(_0xe1c6c3[_0xac18('0x0')]){this['available']=Number(_0xe1c6c3[_0xac18('0x0')]);}if(_0xe1c6c3[_0xac18('0x46')]){this[_0xac18('0x1')]=Number(_0xe1c6c3['loggedin']);}if(_0xe1c6c3[_0xac18('0x47')]){this[_0xac18('0x5')]=Number(_0xe1c6c3[_0xac18('0x47')]);}}for(var _0x1d9a23=0x0;_0x1d9a23<_0x1ee65e[_0xac18('0x48')];_0x1d9a23++){var _0x25c098=_0x1a86fc[_0xac18('0x49')+_0x1ee65e[_0x1d9a23]['name']];if(_0x25c098&&_0x25c098[_0xac18('0x4a')]){this[_0xac18('0x2')]+=0x1;}if(_0x1ee65e[_0x1d9a23][_0xac18('0x4b')]==='1'){this[_0xac18('0x4')]+=0x1;}if(_0x1ee65e[_0x1d9a23][_0xac18('0x3')]==='1'&&!['2','7','8'][_0xac18('0x4c')](_0x1ee65e[_0x1d9a23][_0xac18('0x4d')])){this['paused']+=0x1;}switch(_0x1ee65e[_0x1d9a23][_0xac18('0x4d')]){case'0':this[_0xac18('0x21')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xac18('0x7')]+=0x1;break;case'3':this[_0xac18('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xac18('0x20')]+=0x1;break;case'6':this[_0xac18('0x1b')]+=0x1;break;case'7':this[_0xac18('0x1c')]+=0x1;break;case'8':this[_0xac18('0x19')]+=0x1;break;}}if(this[_0xac18('0x25')]===_0xac18('0x4e')){var _0x2492f4=Object[_0xac18('0x4f')](_0x338f81);for(var _0x4c254a=0x0;_0x4c254a<_0x2492f4[_0xac18('0x48')];_0x4c254a++){var _0x513b53=_0x2492f4[_0x4c254a];var _0xbc3ad2=_0x338f81[_0x513b53];if(_0xbc3ad2[_0xac18('0x50')]===this['name']&&_0xbc3ad2[_0xac18('0x1f')]===_0xac18('0x51')&&_0xbc3ad2[_0xac18('0x52')]===_0xac18('0x53')){this[_0xac18('0x4')]+=0x1;}}if(this[_0xac18('0x4')]>this[_0xac18('0x7')]){this[_0xac18('0x4')]=this[_0xac18('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xac18('0x44')][_0xac18('0x54')]=function(_0x29aa9b){var _0x1af547=![];if(_0x29aa9b){_0x1af547=INBOUND_COUNTERS[_0xac18('0x55')](function(_0x48dbdf){return this[_0x48dbdf]!==_0x29aa9b[_0x48dbdf];},this);}return _0x1af547;};VoiceQueueSummary[_0xac18('0x44')][_0xac18('0x56')]=function(_0x5ce7b9){var _0x573fcc=![];var _0x167037=![];var _0x365696=![];if(_0x5ce7b9){_0x573fcc=this['dialMethod']!==_0x5ce7b9['dialMethod']||this[_0xac18('0x24')]!==_0x5ce7b9[_0xac18('0x24')]||this[_0xac18('0x40')]!==_0x5ce7b9[_0xac18('0x40')]||this['statusMessage']!==_0x5ce7b9[_0xac18('0x41')];_0x167037=OUTBOUND_COUNTERS[_0xac18('0x55')](function(_0x5a4373){return this[_0x5a4373]!==_0x5ce7b9[_0x5a4373];},this);if(this['Trunk']&&_0x5ce7b9[_0xac18('0x42')]){_0x365696=this[_0xac18('0x42')][_0xac18('0x15')]!==_0x5ce7b9['Trunk'][_0xac18('0x15')]||this['Trunk'][_0xac18('0x57')]!==_0x5ce7b9[_0xac18('0x42')]['active'];}}return _0x573fcc||_0x167037||_0x365696;};VoiceQueueSummary[_0xac18('0x44')][_0xac18('0x58')]=function(_0x5c9a08){this[_0xac18('0x6')]=_0x5c9a08[_0xac18('0x6')];this['message']=_0x5c9a08[_0xac18('0x40')];this[_0xac18('0x41')]=_0x5c9a08[_0xac18('0x41')];this[_0xac18('0x8')]=_0x5c9a08[_0xac18('0x8')];this[_0xac18('0x59')]=_0x5c9a08[_0xac18('0x59')];this[_0xac18('0x9')]=_0x5c9a08[_0xac18('0x9')];this[_0xac18('0xa')]=_0x5c9a08['outboundBlacklistCallsDay'];this[_0xac18('0xb')]=_0x5c9a08['outboundBusyCallsDay'];this[_0xac18('0xc')]=_0x5c9a08[_0xac18('0xc')];this[_0xac18('0xd')]=_0x5c9a08[_0xac18('0xd')];this['outboundNoSuchCallsDay']=_0x5c9a08[_0xac18('0xe')];this[_0xac18('0xf')]=_0x5c9a08[_0xac18('0xf')];this[_0xac18('0x10')]=_0x5c9a08[_0xac18('0x10')];this[_0xac18('0x11')]=_0x5c9a08[_0xac18('0x11')];this[_0xac18('0x13')]=_0x5c9a08[_0xac18('0x13')];this['sumDuration']=_0x5c9a08[_0xac18('0x14')];this[_0xac18('0x1e')]=_0x5c9a08['total'];if(this['dialMethod']===_0xac18('0x5a')){this[_0xac18('0x12')]=_0x5c9a08[_0xac18('0x12')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x6f72=['waiting','answered','inUse','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringing','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAnswerCallsDay','preview','exports','loggedIn','loggedInDb','paused','talking'];(function(_0x2caaff,_0x2de670){var _0x5155a5=function(_0x2b4190){while(--_0x2b4190){_0x2caaff['push'](_0x2caaff['shift']());}};_0x5155a5(++_0x2de670);}(_0x6f72,0xae));var _0x26f7=function(_0x3c81a3,_0x3a53ee){_0x3c81a3=_0x3c81a3-0x0;var _0x323ee1=_0x6f72[_0x3c81a3];return _0x323ee1;};'use strict';var INBOUND_COUNTERS=['available',_0x26f7('0x0'),_0x26f7('0x1'),_0x26f7('0x2'),'ringing',_0x26f7('0x3'),_0x26f7('0x4')];var OUTBOUND_COUNTERS=['available',_0x26f7('0x5'),_0x26f7('0x6'),'loggedIn',_0x26f7('0x1'),'originated',_0x26f7('0x7'),'outboundAnswerCallsDay',_0x26f7('0x8'),_0x26f7('0x9'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x26f7('0xa'),_0x26f7('0xb'),_0x26f7('0xc'),_0x26f7('0xd'),_0x26f7('0x2'),_0x26f7('0xe'),_0x26f7('0x3'),_0x26f7('0xf'),'sumDuration',_0x26f7('0x10'),'waiting'];function VoiceQueueSummary(_0x11d2f0){this['id']=_0x11d2f0['id'];this[_0x26f7('0x11')]=_0x11d2f0[_0x26f7('0x11')];this[_0x26f7('0x12')]=_0x11d2f0[_0x26f7('0x12')];this[_0x26f7('0x13')]=_0x11d2f0[_0x26f7('0x13')]||0x0;this[_0x26f7('0x5')]=_0x11d2f0[_0x26f7('0x5')]||0x0;this[_0x26f7('0x14')]=_0x11d2f0[_0x26f7('0x14')]||0x0;this[_0x26f7('0x15')]=_0x11d2f0['busy']||0x0;this[_0x26f7('0x6')]=_0x11d2f0[_0x26f7('0x6')]||0x0;this[_0x26f7('0x16')]=_0x11d2f0[_0x26f7('0x16')]||0x0;this['loggedIn']=_0x11d2f0[_0x26f7('0x0')]||0x0;this['loggedInDb']=_0x11d2f0[_0x26f7('0x1')]||0x0;this[_0x26f7('0x17')]=_0x11d2f0[_0x26f7('0x17')]||0x0;this[_0x26f7('0x18')]=_0x11d2f0['notInUse']||0x0;this['paused']=_0x11d2f0[_0x26f7('0x2')]||0x0;this['ringing']=_0x11d2f0[_0x26f7('0x19')]||0x0;this[_0x26f7('0x1a')]=_0x11d2f0[_0x26f7('0x1a')];this[_0x26f7('0xf')]=_0x11d2f0[_0x26f7('0xf')];this[_0x26f7('0x1b')]=_0x11d2f0[_0x26f7('0x1b')];this[_0x26f7('0x1c')]=_0x11d2f0[_0x26f7('0x1c')]||0x0;this[_0x26f7('0x3')]=_0x11d2f0['talking']||0x0;this[_0x26f7('0x10')]=_0x11d2f0[_0x26f7('0x10')]||0x0;this[_0x26f7('0x1d')]=_0x11d2f0[_0x26f7('0x1d')];this[_0x26f7('0x1e')]=_0x11d2f0[_0x26f7('0x1e')]||0x0;this[_0x26f7('0x1f')]=_0x11d2f0[_0x26f7('0x1f')]||0x0;this[_0x26f7('0x20')]=_0x11d2f0[_0x26f7('0x20')]||0x0;this[_0x26f7('0x4')]=_0x11d2f0['waiting']||0x0;if(_0x11d2f0[_0x26f7('0x1d')]==='outbound'){this['pTalking']=_0x11d2f0[_0x26f7('0xe')]||0x0;this[_0x26f7('0x21')]=_0x11d2f0[_0x26f7('0x21')];this[_0x26f7('0x22')]=_0x11d2f0[_0x26f7('0x22')];this['dialOriginateCallerIdName']=_0x11d2f0[_0x26f7('0x23')];this[_0x26f7('0x24')]=_0x11d2f0[_0x26f7('0x24')];this[_0x26f7('0x25')]=_0x11d2f0[_0x26f7('0x25')];this[_0x26f7('0x26')]=_0x11d2f0['dialPrefix'];this[_0x26f7('0x27')]=_0x11d2f0['temp'];this['outboundAnswerAgiCallsDay']=_0x11d2f0[_0x26f7('0x28')];this['outboundAnswerCallsDay']=_0x11d2f0['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x11d2f0[_0x26f7('0x8')];this[_0x26f7('0x9')]=_0x11d2f0[_0x26f7('0x9')];this[_0x26f7('0x29')]=_0x11d2f0[_0x26f7('0x29')];this['outboundDropCallsDayACS']=_0x11d2f0[_0x26f7('0x2a')];this['outboundDropCallsDayCallersExit']=_0x11d2f0['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x11d2f0[_0x26f7('0x2b')];this[_0x26f7('0x2c')]=_0x11d2f0[_0x26f7('0x2c')];this[_0x26f7('0xa')]=_0x11d2f0['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x11d2f0['outboundOriginateFailureCallsDay'];this[_0x26f7('0xb')]=_0x11d2f0[_0x26f7('0xb')];this['outboundRejectCallsDay']=_0x11d2f0[_0x26f7('0xc')];this[_0x26f7('0xd')]=_0x11d2f0[_0x26f7('0xd')];this[_0x26f7('0x2d')]=_0x11d2f0[_0x26f7('0x2d')];this[_0x26f7('0x2e')]=_0x11d2f0['predictiveIntervalAvgHoldtime'];this[_0x26f7('0x2f')]=_0x11d2f0[_0x26f7('0x2f')];this[_0x26f7('0x30')]=_0x11d2f0['predictiveIntervalDroppedCallsCallersExit'];this[_0x26f7('0x31')]=_0x11d2f0[_0x26f7('0x31')];this['predictiveIntervalErlangCalls']=_0x11d2f0[_0x26f7('0x32')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x11d2f0[_0x26f7('0x33')];this[_0x26f7('0x34')]=_0x11d2f0['predictiveIntervalHitRate'];this[_0x26f7('0x35')]=_0x11d2f0[_0x26f7('0x35')];this[_0x26f7('0x36')]=_0x11d2f0['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x11d2f0[_0x26f7('0x37')];this['predictiveIntervalTotalCalls']=_0x11d2f0[_0x26f7('0x38')];this[_0x26f7('0x39')]=_0x11d2f0[_0x26f7('0x39')];this[_0x26f7('0x3a')]=_0x11d2f0['erlangCalls'];this[_0x26f7('0x3b')]=_0x11d2f0[_0x26f7('0x3b')];this[_0x26f7('0x3c')]=_0x11d2f0[_0x26f7('0x3c')];this[_0x26f7('0x3d')]=_0x11d2f0[_0x26f7('0x3d')];this[_0x26f7('0x3e')]=_0x11d2f0[_0x26f7('0x3e')];this[_0x26f7('0x3f')]=_0x11d2f0[_0x26f7('0x3f')];this[_0x26f7('0x40')]=_0x11d2f0['message'];this[_0x26f7('0x41')]=_0x11d2f0[_0x26f7('0x41')];}if(_0x11d2f0['Trunk']){this[_0x26f7('0x42')]={'id':_0x11d2f0['Trunk']['id'],'name':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x11')],'active':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x43')],'callerid':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x44')]};}}VoiceQueueSummary[_0x26f7('0x45')][_0x26f7('0x46')]=function(_0x478764,_0x130988,_0x1bd16e,_0x2aea16){this['loggedInDb']=0x0;this[_0x26f7('0x3')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x26f7('0x18')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x26f7('0x16')]=0x0;this['unavailable']=0x0;this[_0x26f7('0x19')]=0x0;this[_0x26f7('0x1a')]=0x0;this[_0x26f7('0x17')]=0x0;if(_0x1bd16e){if(_0x1bd16e[_0x26f7('0x14')]){this[_0x26f7('0x14')]=Number(_0x1bd16e[_0x26f7('0x14')]);}if(_0x1bd16e[_0x26f7('0x47')]){this[_0x26f7('0x0')]=Number(_0x1bd16e[_0x26f7('0x47')]);}if(_0x1bd16e[_0x26f7('0x48')]){this['waiting']=Number(_0x1bd16e[_0x26f7('0x48')]);}}for(var _0x14890b=0x0;_0x14890b<_0x478764[_0x26f7('0x49')];_0x14890b++){var _0x4bf2a2=_0x130988[_0x26f7('0x4a')+_0x478764[_0x14890b][_0x26f7('0x11')]];if(_0x4bf2a2&&_0x4bf2a2[_0x26f7('0x4b')]){this[_0x26f7('0x1')]+=0x1;}if(_0x478764[_0x14890b][_0x26f7('0x4c')]==='1'){this[_0x26f7('0x3')]+=0x1;}if(_0x478764[_0x14890b]['paused']==='1'&&!['2','7','8']['includes'](_0x478764[_0x14890b][_0x26f7('0x4d')])){this[_0x26f7('0x2')]+=0x1;}switch(_0x478764[_0x14890b][_0x26f7('0x4d')]){case'0':this[_0x26f7('0x1f')]+=0x1;break;case'1':this[_0x26f7('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x26f7('0x15')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x26f7('0x1e')]+=0x1;break;case'6':this[_0x26f7('0x19')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x26f7('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x26f7('0x4e')){var _0x4f4e2b=Object[_0x26f7('0x4f')](_0x2aea16);for(var _0x5d4c93=0x0;_0x5d4c93<_0x4f4e2b[_0x26f7('0x49')];_0x5d4c93++){var _0x37023f=_0x4f4e2b[_0x5d4c93];var _0x121de3=_0x2aea16[_0x37023f];if(_0x121de3['queue']===this[_0x26f7('0x11')]&&_0x121de3[_0x26f7('0x1d')]===_0x26f7('0x50')&&_0x121de3[_0x26f7('0x51')]==='xcally-motion-preview'){this[_0x26f7('0x3')]+=0x1;}}if(this[_0x26f7('0x3')]>this[_0x26f7('0x6')]){this[_0x26f7('0x3')]=this[_0x26f7('0x6')];}this[_0x26f7('0xe')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x26f7('0x52')]=function(_0xa65a9c){var _0x1f4592=![];if(_0xa65a9c){_0x1f4592=INBOUND_COUNTERS[_0x26f7('0x53')](function(_0x5344c8){return this[_0x5344c8]!==_0xa65a9c[_0x5344c8];},this);}return _0x1f4592;};VoiceQueueSummary['prototype'][_0x26f7('0x54')]=function(_0x2c7918){var _0x4f0223=![];var _0x4394c7=![];var _0x410e8e=![];if(_0x2c7918){_0x4f0223=this[_0x26f7('0x22')]!==_0x2c7918[_0x26f7('0x22')]||this[_0x26f7('0x21')]!==_0x2c7918[_0x26f7('0x21')]||this['message']!==_0x2c7918[_0x26f7('0x40')]||this[_0x26f7('0x41')]!==_0x2c7918[_0x26f7('0x41')];_0x4394c7=OUTBOUND_COUNTERS[_0x26f7('0x53')](function(_0x1adf4e){return this[_0x1adf4e]!==_0x2c7918[_0x1adf4e];},this);if(this[_0x26f7('0x42')]&&_0x2c7918['Trunk']){_0x410e8e=this[_0x26f7('0x42')]['name']!==_0x2c7918['Trunk']['name']||this[_0x26f7('0x42')]['active']!==_0x2c7918[_0x26f7('0x42')][_0x26f7('0x43')];}}return _0x4f0223||_0x4394c7||_0x410e8e;};VoiceQueueSummary['prototype'][_0x26f7('0x55')]=function(_0x29ec12){this[_0x26f7('0x5')]=_0x29ec12[_0x26f7('0x5')];this[_0x26f7('0x40')]=_0x29ec12[_0x26f7('0x40')];this[_0x26f7('0x41')]=_0x29ec12[_0x26f7('0x41')];this[_0x26f7('0x39')]=_0x29ec12['originated'];this[_0x26f7('0x7')]=_0x29ec12['outboundAbandonedCallsDay'];this[_0x26f7('0x56')]=_0x29ec12[_0x26f7('0x56')];this[_0x26f7('0x8')]=_0x29ec12[_0x26f7('0x8')];this['outboundBusyCallsDay']=_0x29ec12[_0x26f7('0x9')];this[_0x26f7('0x29')]=_0x29ec12[_0x26f7('0x29')];this[_0x26f7('0x2c')]=_0x29ec12[_0x26f7('0x2c')];this['outboundNoSuchCallsDay']=_0x29ec12[_0x26f7('0xa')];this[_0x26f7('0xb')]=_0x29ec12['outboundReCallsDay'];this[_0x26f7('0xc')]=_0x29ec12['outboundRejectCallsDay'];this[_0x26f7('0xd')]=_0x29ec12['outboundUnknownCallsDay'];this['sumBillable']=_0x29ec12[_0x26f7('0xf')];this[_0x26f7('0x1b')]=_0x29ec12[_0x26f7('0x1b')];this[_0x26f7('0x10')]=_0x29ec12[_0x26f7('0x10')];if(this['dialMethod']===_0x26f7('0x57')){this['pTalking']=_0x29ec12[_0x26f7('0xe')];}};module[_0x26f7('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3c0a2ed..1c5099d 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 _0x5085=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x458ef1,_0x611873){var _0x5c7fa8=function(_0x4186e7){while(--_0x4186e7){_0x458ef1['push'](_0x458ef1['shift']());}};_0x5c7fa8(++_0x611873);}(_0x5085,0x106));var _0x5508=function(_0x458a94,_0x38aa3d){_0x458a94=_0x458a94-0x0;var _0x44b0f5=_0x5085[_0x458a94];return _0x44b0f5;};'use strict';function VtigerAccount(_0x2e22b3){this['id']=_0x2e22b3['id']||0x0;this[_0x5508('0x0')]=_0x2e22b3[_0x5508('0x0')]||'';this[_0x5508('0x1')]=_0x2e22b3[_0x5508('0x1')]||'';this[_0x5508('0x2')]=_0x2e22b3[_0x5508('0x2')]||'';this[_0x5508('0x3')]=_0x2e22b3[_0x5508('0x3')]||'';this[_0x5508('0x4')]=_0x2e22b3['serverUrl']||'';this[_0x5508('0x5')]=_0x2e22b3[_0x5508('0x5')]||{};}module[_0x5508('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe852=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x1df644,_0x513cd7){var _0x236bdb=function(_0x43bc01){while(--_0x43bc01){_0x1df644['push'](_0x1df644['shift']());}};_0x236bdb(++_0x513cd7);}(_0xe852,0xcc));var _0x2e85=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe852[_0x3ab51d];return _0x29a04e;};'use strict';function VtigerAccount(_0xa0e9da){this['id']=_0xa0e9da['id']||0x0;this[_0x2e85('0x0')]=_0xa0e9da[_0x2e85('0x0')]||'';this[_0x2e85('0x1')]=_0xa0e9da[_0x2e85('0x1')]||'';this[_0x2e85('0x2')]=_0xa0e9da['accessKey']||'';this[_0x2e85('0x3')]=_0xa0e9da[_0x2e85('0x3')]||'';this[_0x2e85('0x4')]=_0xa0e9da[_0x2e85('0x4')]||'';this[_0x2e85('0x5')]=_0xa0e9da[_0x2e85('0x5')]||{};}module[_0x2e85('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 85c645e..e0d5c99 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 _0x0581=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x1b97f3,_0xce63f3){var _0x32d818=function(_0x9671b7){while(--_0x9671b7){_0x1b97f3['push'](_0x1b97f3['shift']());}};_0x32d818(++_0xce63f3);}(_0x0581,0x1ae));var _0x1058=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x0581[_0x5e8eae];return _0xdd09cd;};'use strict';function ZendeskAccount(_0x5cf26d){this['id']=_0x5cf26d['id']||0x0;this[_0x1058('0x0')]=_0x5cf26d[_0x1058('0x0')]||'';this[_0x1058('0x1')]=_0x5cf26d['username']||'';this[_0x1058('0x2')]=_0x5cf26d['password']||'';this[_0x1058('0x3')]=_0x5cf26d['token']||'';this[_0x1058('0x4')]=_0x5cf26d[_0x1058('0x4')]||'';this[_0x1058('0x5')]=_0x5cf26d[_0x1058('0x5')]||'';this[_0x1058('0x6')]=_0x5cf26d['type']||_0x1058('0x7');this[_0x1058('0x8')]=_0x5cf26d['serverUrl']||'';this[_0x1058('0x9')]=_0x5cf26d[_0x1058('0x9')]||{};}module[_0x1058('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x9c97=['token','remoteUri','authType','type','serverUrl','Configurations','name','username','password'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x9c97,0xba));var _0x79c9=function(_0x254bf7,_0x358baa){_0x254bf7=_0x254bf7-0x0;var _0x493010=_0x9c97[_0x254bf7];return _0x493010;};'use strict';function ZendeskAccount(_0x1e8767){this['id']=_0x1e8767['id']||0x0;this[_0x79c9('0x0')]=_0x1e8767['name']||'';this[_0x79c9('0x1')]=_0x1e8767['username']||'';this['password']=_0x1e8767[_0x79c9('0x2')]||'';this['token']=_0x1e8767[_0x79c9('0x3')]||'';this[_0x79c9('0x4')]=_0x1e8767[_0x79c9('0x4')]||'';this[_0x79c9('0x5')]=_0x1e8767[_0x79c9('0x5')]||'';this[_0x79c9('0x6')]=_0x1e8767[_0x79c9('0x6')]||'integrationTab';this[_0x79c9('0x7')]=_0x1e8767[_0x79c9('0x7')]||'';this['Configurations']=_0x1e8767[_0x79c9('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 003db9a..4b1dbd9 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 _0xaf99=['zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf99,0x15d));var _0x9af9=function(_0x3172f7,_0x5c2d84){_0x3172f7=_0x3172f7-0x0;var _0x179e92=_0xaf99[_0x3172f7];return _0x179e92;};'use strict';function ZohoAccount(_0x36947a){this['id']=_0x36947a['id']||0x0;this[_0x9af9('0x0')]=_0x36947a[_0x9af9('0x0')]||'';this[_0x9af9('0x1')]=_0x36947a[_0x9af9('0x1')]||'';this['host']=_0x36947a['host']||'';this[_0x9af9('0x2')]=_0x36947a['zone']||'';this[_0x9af9('0x3')]=_0x36947a['clientId']||'';this['clientSecret']=_0x36947a[_0x9af9('0x4')]||'';this['serverUrl']=_0x36947a[_0x9af9('0x5')]||'';this[_0x9af9('0x6')]=_0x36947a['code']||'';this[_0x9af9('0x7')]=_0x36947a[_0x9af9('0x7')]||'';this['Configurations']=_0x36947a['Configurations']||{};}module[_0x9af9('0x8')]=ZohoAccount; \ No newline at end of file +var _0x3460=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x3460,0xb5));var _0x0346=function(_0x4d4048,_0x1c040d){_0x4d4048=_0x4d4048-0x0;var _0x9838bf=_0x3460[_0x4d4048];return _0x9838bf;};'use strict';function ZohoAccount(_0x5d716a){this['id']=_0x5d716a['id']||0x0;this[_0x0346('0x0')]=_0x5d716a[_0x0346('0x0')]||'';this['description']=_0x5d716a[_0x0346('0x1')]||'';this[_0x0346('0x2')]=_0x5d716a[_0x0346('0x2')]||'';this[_0x0346('0x3')]=_0x5d716a[_0x0346('0x3')]||'';this[_0x0346('0x4')]=_0x5d716a[_0x0346('0x4')]||'';this[_0x0346('0x5')]=_0x5d716a['clientSecret']||'';this[_0x0346('0x6')]=_0x5d716a[_0x0346('0x6')]||'';this[_0x0346('0x7')]=_0x5d716a[_0x0346('0x7')]||'';this['refreshToken']=_0x5d716a[_0x0346('0x8')]||'';this['Configurations']=_0x5d716a[_0x0346('0x9')]||{};}module[_0x0346('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1a06f11..194514e 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 _0x5204=['isNil','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','util','lodash'];(function(_0x597ede,_0x19ffb2){var _0x4fff70=function(_0x48b76f){while(--_0x48b76f){_0x597ede['push'](_0x597ede['shift']());}};_0x4fff70(++_0x19ffb2);}(_0x5204,0xdf));var _0x4520=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x5204[_0x2074db];return _0x27324c;};'use strict';var util=require(_0x4520('0x0'));var _=require(_0x4520('0x1'));var moment=require('moment');function checkNameSurname(_0x12a3a1,_0x3bf0b1,_0x10cbc2){var _0x36caca='';if(!_[_0x4520('0x2')](_0x3bf0b1)&&'string'===typeof _0x3bf0b1){_0x36caca+=_0x3bf0b1;}if(!_[_0x4520('0x2')](_0x10cbc2)&&'string'===typeof _0x10cbc2){_0x36caca+='\x20'+_0x10cbc2;}if(_0x36caca!==''){return _0x36caca;}return _0x12a3a1;}function Action(_0x180174,_0x209381,_0xe0a256,_0xe741c2,_0x396d29){this[_0x4520('0x3')]=_0xe0a256||undefined;this[_0x4520('0x4')]=_0x180174['id'];this['queue']=_0x209381[_0x4520('0x5')];this['type']=_0x209381[_0x4520('0x6')];this[_0x4520('0x7')]=_0x4520('0x8');this[_0x4520('0x9')]=![];this[_0x4520('0xa')]=_[_0x4520('0x2')](_0x180174[_0x4520('0xb')])?undefined:_0x180174[_0x4520('0xb')][_0x4520('0x5')];this[_0x4520('0xc')]=this[_0x4520('0xa')]?util[_0x4520('0xd')](_0x4520('0xe'),this[_0x4520('0xa')]):_0xe741c2||undefined;this[_0x4520('0xf')]=checkNameSurname(_0x180174[_0x4520('0x10')][_0x4520('0x11')],_0x180174[_0x4520('0x10')][_0x4520('0x12')],_0x180174[_0x4520('0x10')][_0x4520('0x13')]);this['active']=_0x180174[_0x4520('0x14')]||![];this[_0x4520('0x15')]=_0x180174[_0x4520('0x11')];this[_0x4520('0x16')]=_0x180174[_0x4520('0x16')];this['countbusyretry']=_0x180174[_0x4520('0x17')]||0x0;this[_0x4520('0x18')]=_0x180174[_0x4520('0x18')]||0x0;this[_0x4520('0x19')]=_0x180174[_0x4520('0x19')]||0x0;this[_0x4520('0x1a')]=(_0x180174[_0x4520('0x17')]||0x0)+(_0x180174[_0x4520('0x18')]||0x0)+(_0x180174[_0x4520('0x19')]||0x0)+(_0x180174[_0x4520('0x1b')]||0x0)+(_0x180174[_0x4520('0x1c')]||0x0)+(_0x180174[_0x4520('0x1d')]||0x0)+(_0x180174['countmachineretry']||0x0)+(_0x180174[_0x4520('0x1e')]||0x0);this['countnosuchnumberretry']=_0x180174['countnosuchnumberretry']||0x0;this['countdropretry']=_0x180174[_0x4520('0x1c')]||0x0;this['countabandonedretry']=_0x180174[_0x4520('0x1d')]||0x0;this[_0x4520('0x1f')]=_0x180174[_0x4520('0x1f')]||0x0;this['countagentrejectretry']=_0x180174[_0x4520('0x1e')]||0x0;this[_0x4520('0x20')]=_0x180174[_0x4520('0x20')];this['callbackuniqueid']=_0x180174[_0x4520('0x21')];this[_0x4520('0x22')]=_0x180174[_0x4520('0x22')];this[_0x4520('0x23')]=_0x180174[_0x4520('0x23')];this['ContactId']=_0x180174[_0x4520('0x24')];this[_0x4520('0x25')]=_0x180174[_0x4520('0x25')];this[_0x4520('0x26')]=_['isNil'](_0x180174[_0x4520('0xb')])?_0x180174[_0x4520('0x26')]:_0x180174[_0x4520('0xb')]['id'];this[_0x4520('0x27')]=_0x180174[_0x4520('0x27')];this[_0x4520('0x28')]='';this[_0x4520('0x29')]='';}Action[_0x4520('0x2a')][_0x4520('0x2b')]=function(){return util[_0x4520('0xd')]('\x22%s\x22\x20<%s>',this[_0x4520('0xf')],this['number']);};module[_0x4520('0x2c')]=Action; \ No newline at end of file +var _0x4137=['string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','firstName','Contact','active','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil'];(function(_0x5adeac,_0x33b129){var _0x46f35b=function(_0xeaba66){while(--_0xeaba66){_0x5adeac['push'](_0x5adeac['shift']());}};_0x46f35b(++_0x33b129);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x7413('0x0'));var _=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));function checkNameSurname(_0x4f372c,_0x392ebc,_0x410971){var _0x2e6df7='';if(!_[_0x7413('0x3')](_0x392ebc)&&_0x7413('0x4')===typeof _0x392ebc){_0x2e6df7+=_0x392ebc;}if(!_[_0x7413('0x3')](_0x410971)&&_0x7413('0x4')===typeof _0x410971){_0x2e6df7+='\x20'+_0x410971;}if(_0x2e6df7!==''){return _0x2e6df7;}return _0x4f372c;}function Action(_0x3bb181,_0x4fbade,_0xc808cd,_0x188d89,_0x5b39ac){this[_0x7413('0x5')]=_0xc808cd||undefined;this['idContact']=_0x3bb181['id'];this[_0x7413('0x6')]=_0x4fbade[_0x7413('0x7')];this['type']=_0x4fbade[_0x7413('0x8')];this[_0x7413('0x9')]='queue';this[_0x7413('0xa')]=![];this[_0x7413('0xb')]=_[_0x7413('0x3')](_0x3bb181[_0x7413('0xc')])?undefined:_0x3bb181[_0x7413('0xc')]['name'];this[_0x7413('0xd')]=this[_0x7413('0xb')]?util['format'](_0x7413('0xe'),this[_0x7413('0xb')]):_0x188d89||undefined;this[_0x7413('0xf')]=checkNameSurname(_0x3bb181['Contact']['phone'],_0x3bb181['Contact'][_0x7413('0x10')],_0x3bb181[_0x7413('0x11')]['lastName']);this[_0x7413('0x12')]=_0x3bb181[_0x7413('0x12')]||![];this['calleridnum']=_0x3bb181[_0x7413('0x13')];this['scheduledat']=_0x3bb181['scheduledat'];this[_0x7413('0x14')]=_0x3bb181['countbusyretry']||0x0;this[_0x7413('0x15')]=_0x3bb181['countcongestionretry']||0x0;this[_0x7413('0x16')]=_0x3bb181[_0x7413('0x16')]||0x0;this[_0x7413('0x17')]=(_0x3bb181[_0x7413('0x14')]||0x0)+(_0x3bb181[_0x7413('0x15')]||0x0)+(_0x3bb181[_0x7413('0x16')]||0x0)+(_0x3bb181['countnosuchnumberretry']||0x0)+(_0x3bb181[_0x7413('0x18')]||0x0)+(_0x3bb181[_0x7413('0x19')]||0x0)+(_0x3bb181[_0x7413('0x1a')]||0x0)+(_0x3bb181[_0x7413('0x1b')]||0x0);this['countnosuchnumberretry']=_0x3bb181[_0x7413('0x1c')]||0x0;this[_0x7413('0x18')]=_0x3bb181[_0x7413('0x18')]||0x0;this[_0x7413('0x19')]=_0x3bb181[_0x7413('0x19')]||0x0;this[_0x7413('0x1a')]=_0x3bb181[_0x7413('0x1a')]||0x0;this[_0x7413('0x1b')]=_0x3bb181['countagentrejectretry']||0x0;this['callback']=_0x3bb181[_0x7413('0x1d')];this['callbackuniqueid']=_0x3bb181[_0x7413('0x1e')];this[_0x7413('0x1f')]=_0x3bb181[_0x7413('0x1f')];this[_0x7413('0x20')]=_0x3bb181[_0x7413('0x20')];this[_0x7413('0x21')]=_0x3bb181[_0x7413('0x21')];this[_0x7413('0x22')]=_0x3bb181[_0x7413('0x22')];this['UserId']=_['isNil'](_0x3bb181[_0x7413('0xc')])?_0x3bb181['UserId']:_0x3bb181[_0x7413('0xc')]['id'];this[_0x7413('0x23')]=_0x3bb181[_0x7413('0x23')];this['originatecalleridnum']='';this[_0x7413('0x24')]='';}Action[_0x7413('0x25')][_0x7413('0x26')]=function(){return util[_0x7413('0x27')](_0x7413('0x28'),this[_0x7413('0xf')],this['number']);};module[_0x7413('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5008a15..ee7faff 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x44198c,_0xe150d5){var _0x546662=function(_0x1fe06e){while(--_0x1fe06e){_0x44198c['push'](_0x44198c['shift']());}};_0x546662(++_0xe150d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x503d82,_0x263c1f){var _0x1e2778=function(_0x3967fe){while(--_0x3967fe){_0x503d82['push'](_0x503d82['shift']());}};_0x1e2778(++_0x263c1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cd9b695..00d497b 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 _0x8bec=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x1cfe5f,_0x4c457e){var _0x1e81f2=function(_0x4cbee0){while(--_0x4cbee0){_0x1cfe5f['push'](_0x1cfe5f['shift']());}};_0x1e81f2(++_0x4c457e);}(_0x8bec,0x1b2));var _0xc8be=function(_0x544300,_0x278fb7){_0x544300=_0x544300-0x0;var _0x1677e1=_0x8bec[_0x544300];return _0x1677e1;};'use strict';var util=require(_0xc8be('0x0'));var BPromise=require('bluebird');var logger=require(_0xc8be('0x1'))(_0xc8be('0x2'));var cmHopper=require(_0xc8be('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xc8be('0x4'));var agentReportPreview=require(_0xc8be('0x5'));var voiceQueueReport=require(_0xc8be('0x6'));function loggerCatch(_0xa4e981){return function(_0x4bcc09){logger['error'](_0xa4e981,util[_0xc8be('0x7')](_0x4bcc09,{'showHidden':![],'depth':null}));};}function create(_0x3e4d09){return cmHopperHistory[_0xc8be('0x8')](_0x3e4d09)['catch'](loggerCatch(_0xc8be('0x9')));}function createAgent(_0x52422c){return BPromise[_0xc8be('0xa')]()[_0xc8be('0xb')](agentReportPreview['createHistory'](_0x52422c))[_0xc8be('0xc')](loggerCatch(_0xc8be('0x9')));}function moveContact(_0x437abf){return cmHopper[_0xc8be('0xd')](_0x437abf,!![])[_0xc8be('0xc')](loggerCatch(_0xc8be('0xe')));}exports['checkIsBlackList']=function(_0x970491){return cmHopperBlack[_0xc8be('0xf')](_0x970491)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xc8be('0x10')]=function(_0x4c72ad){return BPromise['resolve']()[_0xc8be('0xb')](cmHopper['getContactPreview'](_0x4c72ad))['catch'](loggerCatch(_0xc8be('0x11')));};exports['createHistory']=function(_0x6ca298,_0x2c843f){create(_0x6ca298)['catch'](loggerCatch(_0x2c843f));moveContact(_0x6ca298)[_0xc8be('0xc')](loggerCatch(_0x2c843f));};exports['createAgentHistory']=function(_0x38c5f9,_0xb3db25){createAgent(_0x38c5f9)[_0xc8be('0xc')](loggerCatch(_0xb3db25));};exports[_0xc8be('0x12')]=function(_0x11e9c3,_0x1ee9aa){create(_0x11e9c3)[_0xc8be('0xc')](loggerCatch(_0x1ee9aa));};exports[_0xc8be('0x13')]=function(_0x1ee9d4,_0x1e6ff5){moveContact(_0x1ee9d4)[_0xc8be('0xc')](loggerCatch(_0x1e6ff5));};exports[_0xc8be('0x14')]=function(_0x222592,_0x4825af,_0x55310f){if(_0x4825af){_0x222592['UserId']=null;}if(_0x55310f){_0x222592['active']=![];}return cmHopper[_0xc8be('0x14')](_0x222592)[_0xc8be('0xc')](loggerCatch(_0xc8be('0x15')));};exports[_0xc8be('0x16')]=function(_0x35fd54){return cmHopper['countReScheduled'](_0x35fd54)['catch'](loggerCatch(_0xc8be('0x17')));};exports['unlockContact']=function(_0x8c5001){return cmHopper[_0xc8be('0x18')]({'UserId':null},_0x8c5001,0x1)[_0xc8be('0xc')](loggerCatch(_0xc8be('0x19')));};exports['disableContact']=function(_0x3f00c6){return cmHopper['unlockContact']({'active':![]},_0x3f00c6,0x1)[_0xc8be('0xc')](loggerCatch(_0xc8be('0x1a')));};exports[_0xc8be('0x1b')]=function(_0x18d735){var _0x59be63={};_0x59be63[_0xc8be('0x1c')]=_0x18d735['type'];_0x59be63[_0xc8be('0x1d')]=_0x18d735[_0xc8be('0x1d')];_0x59be63[_0xc8be('0x1e')]=_0x18d735[_0xc8be('0x1e')];_0x59be63[_0xc8be('0x1f')]=_0x18d735['calleridname'];_0x59be63['queue']=_0x18d735[_0xc8be('0x20')];_0x59be63[_0xc8be('0x21')]=_0x18d735[_0xc8be('0x22')];_0x59be63['queuecallerleaveAt']=_0x18d735[_0xc8be('0x22')];_0x59be63[_0xc8be('0x23')]=0x1;_0x59be63[_0xc8be('0x24')]=_0x18d735[_0xc8be('0x25')];_0x59be63[_0xc8be('0x26')]=_0x18d735['membername'];_0x59be63[_0xc8be('0x27')]='from-sip';_0x59be63[_0xc8be('0x28')]=_0xc8be('0x29');_0x59be63[_0xc8be('0x2a')]=0x0;_0x59be63[_0xc8be('0x2b')]=0x1;_0x59be63[_0xc8be('0x2c')]=_0x18d735[_0xc8be('0x2d')];_0x59be63[_0xc8be('0x2e')]=_0xc8be('0x2f');return BPromise['resolve']()['then'](voiceQueueReport[_0xc8be('0x30')](_0x59be63))[_0xc8be('0xc')](loggerCatch(_0xc8be('0x31')));};exports[_0xc8be('0x32')]=function(_0x27caf4,_0x18b0ea){return BPromise['resolve']()['then'](cmHopper[_0xc8be('0x32')](_0x27caf4,_0x18b0ea))[_0xc8be('0xc')](loggerCatch(_0xc8be('0x33')));};exports[_0xc8be('0x34')]=function(_0x2d5d23){return cmHopper[_0xc8be('0x14')](_0x2d5d23,!![],!![])[_0xc8be('0xc')](loggerCatch(_0xc8be('0x35')));}; \ No newline at end of file +var _0x1a7a=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type'];(function(_0x2c5f39,_0x472a04){var _0x581642=function(_0x5e4a4e){while(--_0x5e4a4e){_0x2c5f39['push'](_0x2c5f39['shift']());}};_0x581642(++_0x472a04);}(_0x1a7a,0x136));var _0xa1a7=function(_0x9d9d58,_0x7bf873){_0x9d9d58=_0x9d9d58-0x0;var _0x51d4d3=_0x1a7a[_0x9d9d58];return _0x51d4d3;};'use strict';var util=require(_0xa1a7('0x0'));var BPromise=require(_0xa1a7('0x1'));var logger=require(_0xa1a7('0x2'))(_0xa1a7('0x3'));var cmHopper=require(_0xa1a7('0x4'));var cmHopperHistory=require(_0xa1a7('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xa1a7('0x6'));var voiceQueueReport=require(_0xa1a7('0x7'));function loggerCatch(_0x29d08a){return function(_0x1e81d3){logger[_0xa1a7('0x8')](_0x29d08a,util[_0xa1a7('0x9')](_0x1e81d3,{'showHidden':![],'depth':null}));};}function create(_0x3ead6b){return cmHopperHistory[_0xa1a7('0xa')](_0x3ead6b)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2c8164){return BPromise[_0xa1a7('0xb')]()['then'](agentReportPreview[_0xa1a7('0xa')](_0x2c8164))[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0xd')));}function moveContact(_0x4397f1){return cmHopper[_0xa1a7('0xe')](_0x4397f1,!![])[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0xf')));}exports[_0xa1a7('0x10')]=function(_0x19d1a7){return cmHopperBlack[_0xa1a7('0x10')](_0x19d1a7)['catch'](loggerCatch(_0xa1a7('0x11')));};exports[_0xa1a7('0x12')]=function(_0x51c903){return BPromise['resolve']()[_0xa1a7('0x13')](cmHopper[_0xa1a7('0x12')](_0x51c903))[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x14')));};exports['createHistory']=function(_0x111d94,_0x1516c7){create(_0x111d94)['catch'](loggerCatch(_0x1516c7));moveContact(_0x111d94)[_0xa1a7('0xc')](loggerCatch(_0x1516c7));};exports['createAgentHistory']=function(_0x47e284,_0x19d1e9){createAgent(_0x47e284)[_0xa1a7('0xc')](loggerCatch(_0x19d1e9));};exports[_0xa1a7('0x15')]=function(_0x5102cc,_0x5593d0){create(_0x5102cc)['catch'](loggerCatch(_0x5593d0));};exports['createCustomerFinal']=function(_0x304bcf,_0x29e78f){moveContact(_0x304bcf)['catch'](loggerCatch(_0x29e78f));};exports[_0xa1a7('0x16')]=function(_0x510f61,_0x43aae0,_0x1a0d23){if(_0x43aae0){_0x510f61[_0xa1a7('0x17')]=null;}if(_0x1a0d23){_0x510f61[_0xa1a7('0x18')]=![];}return cmHopper[_0xa1a7('0x16')](_0x510f61)['catch'](loggerCatch(_0xa1a7('0x19')));};exports[_0xa1a7('0x1a')]=function(_0x24db99){return cmHopper['countReScheduled'](_0x24db99)[_0xa1a7('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0xa1a7('0x1b')]=function(_0x235b3d){return cmHopper['unlockContact']({'UserId':null},_0x235b3d,0x1)[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x1c')));};exports[_0xa1a7('0x1d')]=function(_0x3d20b6){return cmHopper['unlockContact']({'active':![]},_0x3d20b6,0x1)[_0xa1a7('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xa1a7('0x1e')]=function(_0x2a397b){var _0x216343={};_0x216343[_0xa1a7('0x1f')]=_0x2a397b['type'];_0x216343[_0xa1a7('0x20')]=_0x2a397b[_0xa1a7('0x20')];_0x216343[_0xa1a7('0x21')]=_0x2a397b[_0xa1a7('0x21')];_0x216343[_0xa1a7('0x22')]=_0x2a397b['calleridname'];_0x216343[_0xa1a7('0x23')]=_0x2a397b['queue'];_0x216343[_0xa1a7('0x24')]=_0x2a397b[_0xa1a7('0x25')];_0x216343[_0xa1a7('0x26')]=_0x2a397b[_0xa1a7('0x25')];_0x216343[_0xa1a7('0x27')]=0x1;_0x216343['queuecallercompleteAt']=_0x2a397b[_0xa1a7('0x28')];_0x216343[_0xa1a7('0x29')]=_0x2a397b[_0xa1a7('0x2a')];_0x216343['context']=_0xa1a7('0x2b');_0x216343[_0xa1a7('0x2c')]=_0xa1a7('0x2d');_0x216343[_0xa1a7('0x2e')]=0x0;_0x216343[_0xa1a7('0x2f')]=0x1;_0x216343[_0xa1a7('0x30')]=_0x2a397b['membername'];_0x216343[_0xa1a7('0x31')]=_0xa1a7('0x32');return BPromise['resolve']()[_0xa1a7('0x13')](voiceQueueReport[_0xa1a7('0x33')](_0x216343))['catch'](loggerCatch(_0xa1a7('0x34')));};exports[_0xa1a7('0x35')]=function(_0x213686,_0x1cbd5e){return BPromise[_0xa1a7('0xb')]()[_0xa1a7('0x13')](cmHopper[_0xa1a7('0x35')](_0x213686,_0x1cbd5e))[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x36')));};exports[_0xa1a7('0x37')]=function(_0x4c636c){return cmHopper['rescheduleContact'](_0x4c636c,!![],!![])[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x38')));}; \ 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 1d71ca4..12c138a 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 _0x74ab=['countnosuchnumberretry','Global','scheduledAt','active','scheduledat','add','minutes','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','milliseconds','diff','createBody','ListId','CampaignId','idContact','queue','type','campaigntype','countglobal','callback','callbackuniqueid','recallme','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','state','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74ab,0xd1));var _0xb74a=function(_0x4230dc,_0x5b9c73){_0x4230dc=_0x4230dc-0x0;var _0x2d65d2=_0x74ab[_0x4230dc];return _0x2d65d2;};'use strict';var util=require('util');var _=require(_0xb74a('0x0'));var moment=require(_0xb74a('0x1'));var logger=require(_0xb74a('0x2'))(_0xb74a('0x3'));var ipAgi=process[_0xb74a('0x4')][_0xb74a('0x5')]||'127.0.0.1';var utils=require(_0xb74a('0x6'));exports[_0xb74a('0x7')]=function(_0x57f706){return function(_0x2f8e8c){logger[_0xb74a('0x8')](_0x57f706,util['inspect'](_0x2f8e8c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4896cc,_0x5d9d9a){logger['info'](_0x4896cc,util[_0xb74a('0x9')](_0x5d9d9a,{'showHidden':![],'depth':null}));};exports[_0xb74a('0xa')]=function(_0x4cd629,_0x58c7c2){logger[_0xb74a('0x8')](_0x4cd629,util[_0xb74a('0x9')](_0x58c7c2,{'showHidden':![],'depth':null}));};exports[_0xb74a('0xb')]=function(_0x46010b){return function(_0x386c64){logger[_0xb74a('0xc')](_0x46010b,util[_0xb74a('0x9')](_0x386c64,{'showHidden':![],'depth':null}));};};exports[_0xb74a('0xd')]=function(_0x12b3a0,_0x4810e8,_0x5b1e69){return{'message':_0x12b3a0,'unlock':_0x4810e8,'active':_0x5b1e69};};exports[_0xb74a('0xe')]=function(_0x1a6930,_0x1a4c5e,_0x566aee){if(!_[_0xb74a('0xf')](_0x566aee)&&'string'===typeof _0x566aee&&!_[_0xb74a('0x10')](_0x566aee)){if(!_[_0xb74a('0xf')](_0x1a4c5e)&&'string'===typeof _0x1a4c5e&&!_['isEmpty'](_0x1a4c5e)){return util[_0xb74a('0x11')](_0xb74a('0x12'),_0x1a4c5e,_0x566aee);}return util[_0xb74a('0x11')](_0xb74a('0x12'),_0x566aee,_0x566aee);}if(!_[_0xb74a('0xf')](_0x1a6930)&&'string'===typeof _0x1a6930&&!_[_0xb74a('0x10')](_0x1a6930)){return _0x1a6930;}return'\x22\x22\x20<>';};exports[_0xb74a('0x13')]=function(_0xc66e1e){if(_[_0xb74a('0x14')](_0xc66e1e)){return![];}return _0xc66e1e;};exports[_0xb74a('0x15')]=function(_0x4652f3,_0x296e36,_0x41e232,_0x265b35,_0x16566c,_0x18f8f1){var _0x13e873={'XMD-QUEUE':_0x296e36[_0xb74a('0x16')]?_0x296e36[_0xb74a('0x16')][_0xb74a('0x17')]:'','XMD-CALLERID':_0x265b35,'XMD-CALLERID-PREVIEW':_0x18f8f1?util[_0xb74a('0x11')]('\x22%s\x22\x20<%s>',_0x18f8f1[_0xb74a('0x18')],_0x18f8f1[_0xb74a('0x19')]):_0x265b35,'XMD-DIALID':_0x16566c,'XMD-CONTACTID':_0x296e36[_0xb74a('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x265b35,'XMD-VOICEQUEUEID':_0x296e36['VoiceQueueId'],'XMD-DIALCHANNEL':_0x41e232,'XMD-DIALTIMEOUT':_0x4652f3[_0xb74a('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xb74a('0x11')](_0xb74a('0x1c'),_0x4652f3[_0xb74a('0x1d')]?'g':'',_[_0xb74a('0x10')](_0x4652f3[_0xb74a('0x1e')])?'':_0xb74a('0x1f')),'XMD-DIALURL':_0x4652f3[_0xb74a('0x20')]||'','XMD-AGI':_0x4652f3[_0xb74a('0x21')]?util['format'](_0xb74a('0x22'),ipAgi,_0x4652f3[_0xb74a('0x21')]):_0xb74a('0x23'),'XMD-AGIAFTER':_0x4652f3[_0xb74a('0x1d')]?util[_0xb74a('0x11')](_0xb74a('0x22'),ipAgi,_0x4652f3[_0xb74a('0x1d')]):_0xb74a('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x18f8f1?_0x18f8f1['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x18f8f1?_0x18f8f1[_0xb74a('0x24')]:'','XMD-DESTINATION':_0xb74a('0x25'),'SIPADDHEADER':_0xb74a('0x26')};if(!_['isEmpty'](_0x4652f3[_0xb74a('0x1e')])){_0x13e873[util[_0xb74a('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4652f3[_0xb74a('0x1e')];_0x13e873[util[_0xb74a('0x11')]('%s',_0xb74a('0x27'))]=_0x16566c;}return _0x13e873;};exports[_0xb74a('0x28')]=function(_0x1ac05a){var _0x1f9d36={};for(var _0x331e5f in _0x1ac05a){if(_0x1ac05a[_0xb74a('0x29')](_0x331e5f)){_0x1f9d36[util[_0xb74a('0x11')]('%s',_[_0xb74a('0x2a')](_0x331e5f))]=_0x1ac05a[_0x331e5f];}}return{'variables':_0x1f9d36};};exports[_0xb74a('0x2b')]=function(_0x2f361b,_0x341bb9){if(!_[_0xb74a('0x14')](_0x2f361b)){if(_0x2f361b[_0xb74a('0x29')]('originated')){if(_0x2f361b[_0xb74a('0x2c')]>0x0){_0x2f361b['originated']-=0x1;}else{logger[_0xb74a('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x341bb9);}}}else{logger[_0xb74a('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x341bb9);}};exports[_0xb74a('0x2d')]=function(_0x5ee68a){var _0x1573c3=moment()['format'](_0xb74a('0x2e'));_0x5ee68a['state']=0xd;_0x5ee68a[_0xb74a('0x2f')]='Blacklist';_0x5ee68a['starttime']=_0x1573c3;_0x5ee68a[_0xb74a('0x30')]=_0x1573c3;_0x5ee68a[_0xb74a('0x31')]=_0x1573c3;};exports[_0xb74a('0x32')]=function(_0x3c9846,_0x40c0d4,_0x3b8915){var _0x2c4393=moment()[_0xb74a('0x11')](_0xb74a('0x2e'));_0x3c9846['state']=_0x40c0d4;_0x3c9846[_0xb74a('0x2f')]=_0x3b8915;_0x3c9846[_0xb74a('0x30')]=_0x2c4393;_0x3c9846[_0xb74a('0x33')]=utils[_0xb74a('0x34')](_0x3c9846[_0xb74a('0x30')],_0x3c9846[_0xb74a('0x35')]);};exports[_0xb74a('0x36')]=function(_0x25db0e,_0x39ae0a,_0x2fece1){_0x25db0e[_0xb74a('0x37')]=_0x39ae0a;_0x25db0e[_0xb74a('0x38')]=_0x2fece1;};exports[_0xb74a('0x39')]=function(_0x2406ca,_0x2042ad,_0x5c48c3){var _0x6b89cd=moment()[_0xb74a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2406ca[_0xb74a('0x3a')]=_0x2042ad;_0x2406ca[_0xb74a('0x2f')]=_0x5c48c3;_0x2406ca[_0xb74a('0x30')]=_0x2406ca[_0xb74a('0x30')]?_0x2406ca['responsetime']:_0x6b89cd;_0x2406ca[_0xb74a('0x31')]=_0x2406ca[_0xb74a('0x31')]?_0x2406ca[_0xb74a('0x31')]:_0x6b89cd;_0x2406ca[_0xb74a('0x33')]=utils[_0xb74a('0x34')](_0x2406ca[_0xb74a('0x30')]||0x0,_0x2406ca[_0xb74a('0x35')]||0x0);_0x2406ca[_0xb74a('0x3b')]=_0x2406ca[_0xb74a('0x3c')]?utils[_0xb74a('0x34')](_0x2406ca[_0xb74a('0x31')],_0x2406ca[_0xb74a('0x3c')]):0x0;};exports[_0xb74a('0x3d')]=function(_0x512159){return _0x512159==='Failure';};exports[_0xb74a('0x3e')]=function(_0x494bac,_0x29abf6,_0x48e10f,_0x29a07e,_0x4cc87b){var _0x269845=_0x29a07e?_0xb74a('0x3f'):_0x494bac['calleridname'];_0x269845=_0x4cc87b?_0xb74a('0x40'):_0x269845;return{'actionid':_0x494bac[_0xb74a('0x41')],'action':_0xb74a('0x42'),'channel':_0x494bac[_0xb74a('0x43')],'callerid':util[_0xb74a('0x11')]('\x22%s\x22\x20<%s>',_0x269845,_0x494bac[_0xb74a('0x19')]),'Exten':_0xb74a('0x25'),'Context':_0xb74a('0x44'),'Priority':'1','variable':_0x48e10f,'timeout':(_0x29abf6[_0xb74a('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x494bac[_0xb74a('0x41')]};};exports[_0xb74a('0x46')]=function(_0x2c4411){return _0x2c4411[_0xb74a('0x47')]+_0x2c4411[_0xb74a('0x48')]+_0x2c4411[_0xb74a('0x49')]+_0x2c4411[_0xb74a('0x4a')]+_0x2c4411[_0xb74a('0x4b')];};exports['cloneAction']=function(_0x1bc392){var _0x1325ac=_['clone'](_0x1bc392);_0x1325ac[_0xb74a('0x3a')]=0xf;_0x1325ac[_0xb74a('0x2f')]=_0xb74a('0x4c');return _0x1325ac;};exports[_0xb74a('0x4d')]=function(_0x5c164a,_0x2e849d,_0x5197f4){var _0x1721d9={};_0x1721d9[_0x2e849d]=_0x5c164a[_0x2e849d];_0x1721d9[_0xb74a('0x4e')]=![];_0x1721d9[_0xb74a('0x4f')]=moment()[_0xb74a('0x50')](_0x5197f4,_0xb74a('0x51'))['format'](_0xb74a('0x2e'));_0x1721d9['ContactId']=_0x5c164a[_0xb74a('0x1a')];_0x1721d9['ListId']=_0x5c164a['ListId'];_0x1721d9[_0xb74a('0x52')]=_0x5c164a[_0xb74a('0x52')]||undefined;return _0x1721d9;};exports[_0xb74a('0x53')]=function(_0x29b8dd,_0x167831){if(!_[_0xb74a('0x14')](_0x29b8dd)){if(_0x29b8dd[_0xb74a('0x54')]>0x0){_0x29b8dd[_0xb74a('0x54')]-=0x1;}else{logger[_0xb74a('0x8')](_0x167831,_0xb74a('0x55'));}}else{logger['error'](_0x167831,_0xb74a('0x56'));}};exports[_0xb74a('0x57')]=function(_0x4df89b){if(_0x4df89b<=0x0){return!![];}return![];};function buildObj(_0x3fe8ba,_0xc52ce0,_0x1a4833){_0x3fe8ba[_0xb74a('0x58')]=_0xc52ce0;_0x3fe8ba['name']=_0x3fe8ba['queue'];_0x3fe8ba[_0xb74a('0x59')]=_0x3fe8ba[_0xb74a('0x43')];_0x3fe8ba['motionChannel']=_0xb74a('0x5a');if(_0x1a4833){_0x3fe8ba['mandatoryDisposition']=_0x1a4833[_0xb74a('0x5b')];}return _0x3fe8ba;}exports[_0xb74a('0x5c')]=buildObj;exports[_0xb74a('0x5d')]=function(_0x1dea61){var _0x56aa46=[];for(var _0x2cb54f in _0x1dea61){if(_0x1dea61[_0xb74a('0x29')](_0x2cb54f)){if(!_['isNil'](_0x1dea61[_0x2cb54f])&&_0x1dea61[_0x2cb54f][_0xb74a('0x3a')]===_0xb74a('0x5e')&&_0x1dea61[_0x2cb54f][_0xb74a('0x5f')]===_0xb74a('0x60')){_0x56aa46['push'](_0x1dea61[_0x2cb54f]['id']);}}}return _0x56aa46;};exports['getDiff']=function(_0x4c1315){var _0x419c95=moment()[_0xb74a('0x61')](0x0);var _0xd439e0=moment(_0x4c1315)[_0xb74a('0x61')](0x0);return _0x419c95[_0xb74a('0x62')](_0xd439e0,'seconds');};exports[_0xb74a('0x63')]=function(_0x2a07af){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a07af[_0xb74a('0x1a')],'ListId':_0x2a07af[_0xb74a('0x64')],'VoiceQueueId':_0x2a07af['VoiceQueueId']||undefined,'CampaignId':_0x2a07af[_0xb74a('0x65')]||undefined};};exports['filterKey']=function(_0x193f71){if(_0x193f71===_0xb74a('0x41')||_0x193f71===_0xb74a('0x66')||_0x193f71===_0xb74a('0x67')||_0x193f71===_0xb74a('0x68')||_0x193f71===_0xb74a('0x69')||_0x193f71==='dialAnswer'||_0x193f71===_0xb74a('0x37')||_0x193f71===_0xb74a('0x43')||_0x193f71==='calleridname'||_0x193f71===_0xb74a('0x4e')||_0x193f71===_0xb74a('0x19')||_0x193f71===_0xb74a('0x4f')||_0x193f71===_0xb74a('0x47')||_0x193f71==='countcongestionretry'||_0x193f71===_0xb74a('0x49')||_0x193f71===_0xb74a('0x6a')||_0x193f71===_0xb74a('0x6b')||_0x193f71===_0xb74a('0x6c')||_0x193f71==='callbackat'||_0x193f71===_0xb74a('0x6d')||_0x193f71===_0xb74a('0x1a')||_0x193f71==='ListId'||_0x193f71===_0xb74a('0x38')||_0x193f71===_0xb74a('0x52')||_0x193f71==='sipcallid'||_0x193f71==='xmd-voicequeueid'||_0x193f71==='xmd-queue'||_0x193f71===_0xb74a('0x6e')||_0x193f71===_0xb74a('0x6f')||_0x193f71===_0xb74a('0x70')||_0x193f71===_0xb74a('0x71')||_0x193f71==='xmd-dialoptions'||_0x193f71===_0xb74a('0x72')||_0x193f71===_0xb74a('0x73')||_0x193f71===_0xb74a('0x74')||_0x193f71===_0xb74a('0x75')||_0x193f71==='xmd-callerid'||_0x193f71===_0xb74a('0x76')||_0x193f71===_0xb74a('0x77')||_0x193f71==='rtpaudioqos'||_0x193f71==='rtpaudioqosbridged'||_0x193f71===_0xb74a('0x78')||_0x193f71===_0xb74a('0x79')||_0x193f71===_0xb74a('0x7a')||_0x193f71==='rtpaudioqoslossbridged'||_0x193f71==='rtpaudioqosrtt'||_0x193f71==='rtpaudioqosrttbridged'||_0x193f71===_0xb74a('0x7b')||_0x193f71==='rtpaudioqosbridged'||_0x193f71===_0xb74a('0x78')||_0x193f71==='rtpaudioqosjitterbridged'||_0x193f71==='rtpaudioqosloss'||_0x193f71===_0xb74a('0x7c')||_0x193f71===_0xb74a('0x7d')||_0x193f71===_0xb74a('0x7e')||_0x193f71===_0xb74a('0x7f')||_0x193f71===_0xb74a('0x80')||_0x193f71==='state'||_0x193f71===_0xb74a('0x2f')){return![];}return!![];};exports[_0xb74a('0x81')]=function(_0x59e639,_0x576d32){var _0x375372,_0x23df49,_0x342dc7;if(_0x576d32<=0x0){_0x576d32=0x1;}_0x375372=new RegExp(_0xb74a('0x82')+_0x576d32+'}$');_0x23df49=Math[_0xb74a('0x83')](0xa,_0x576d32-0x1);_0x342dc7=Math[_0xb74a('0x83')](0xa,_0x576d32)-0x1;return util[_0xb74a('0x11')]('%s',_[_0xb74a('0x84')](_0x59e639,_0x375372,_['random'](_0x23df49,_0x342dc7)));};exports[_0xb74a('0x85')]=function(_0x28a9c8){var _0x1652ce=_0x28a9c8[_0xb74a('0x86')](/"(.*?)"/);return _0x1652ce?_0x1652ce[0x1]:_0x28a9c8;};exports[_0xb74a('0x87')]=function(_0x1fcf0d){var _0x1606b0=_0x1fcf0d[_0xb74a('0x86')](/<(.*?)>/);return _0x1606b0?_0x1606b0[0x1]:_0x1fcf0d;};function buildNoAnswerEventPayload(_0x1db4af,_0x561b02){var _0x1beea2=buildObj(_0x1db4af,_0xb74a('0x88'));if(!_[_0xb74a('0x10')](_0x561b02['variables'])){Object[_0xb74a('0x89')](_0x561b02[_0xb74a('0x8a')])[_0xb74a('0x8b')](function(_0x49488e){_0x1beea2[_0x49488e[_0xb74a('0x8c')]()]=_0x561b02[_0xb74a('0x8a')][_0x49488e];});}return _0x1beea2;}exports[_0xb74a('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xc9e6=['XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','inspect','loggerError','error','logger2','info','message','getCallerId','string','isEmpty','format','isActive','addVariables','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','state','ringtime','getSeconds','starttime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','uniqueid','type','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','lodash','moment','../../../../config/logger','preview','env'];(function(_0x42d675,_0x190969){var _0x29f15a=function(_0xca9170){while(--_0xca9170){_0x42d675['push'](_0x42d675['shift']());}};_0x29f15a(++_0x190969);}(_0xc9e6,0x19f));var _0x6c9e=function(_0x461361,_0x3f159f){_0x461361=_0x461361-0x0;var _0x262454=_0xc9e6[_0x461361];return _0x262454;};'use strict';var util=require('util');var _=require(_0x6c9e('0x0'));var moment=require(_0x6c9e('0x1'));var logger=require(_0x6c9e('0x2'))(_0x6c9e('0x3'));var ipAgi=process[_0x6c9e('0x4')][_0x6c9e('0x5')]||_0x6c9e('0x6');var utils=require(_0x6c9e('0x7'));exports[_0x6c9e('0x8')]=function(_0x300235){return function(_0x471869){logger['error'](_0x300235,util['inspect'](_0x471869,{'showHidden':![],'depth':null}));};};exports[_0x6c9e('0x9')]=function(_0x2844db,_0x4e5d0d){logger['info'](_0x2844db,util[_0x6c9e('0xa')](_0x4e5d0d,{'showHidden':![],'depth':null}));};exports[_0x6c9e('0xb')]=function(_0x4877c9,_0x5a036f){logger[_0x6c9e('0xc')](_0x4877c9,util['inspect'](_0x5a036f,{'showHidden':![],'depth':null}));};exports[_0x6c9e('0xd')]=function(_0x54822b){return function(_0x13a10a){logger[_0x6c9e('0xe')](_0x54822b,util[_0x6c9e('0xa')](_0x13a10a,{'showHidden':![],'depth':null}));};};exports[_0x6c9e('0xf')]=function(_0x4f8a5d,_0x19fccc,_0x231677){return{'message':_0x4f8a5d,'unlock':_0x19fccc,'active':_0x231677};};exports[_0x6c9e('0x10')]=function(_0x5bc071,_0x5ef1f3,_0x1dc350){if(!_['isUndefined'](_0x1dc350)&&_0x6c9e('0x11')===typeof _0x1dc350&&!_[_0x6c9e('0x12')](_0x1dc350)){if(!_['isUndefined'](_0x5ef1f3)&&_0x6c9e('0x11')===typeof _0x5ef1f3&&!_[_0x6c9e('0x12')](_0x5ef1f3)){return util['format']('\x22%s\x22\x20<%s>',_0x5ef1f3,_0x1dc350);}return util[_0x6c9e('0x13')]('\x22%s\x22\x20<%s>',_0x1dc350,_0x1dc350);}if(!_['isUndefined'](_0x5bc071)&&'string'===typeof _0x5bc071&&!_[_0x6c9e('0x12')](_0x5bc071)){return _0x5bc071;}return'\x22\x22\x20<>';};exports[_0x6c9e('0x14')]=function(_0x5b05c7){if(_['isNil'](_0x5b05c7)){return![];}return _0x5b05c7;};exports[_0x6c9e('0x15')]=function(_0x18a256,_0x350904,_0x17f12b,_0x275d49,_0x1e42d9,_0x1473c8){var _0x5581d8={'XMD-QUEUE':_0x350904['Queue']?_0x350904['Queue'][_0x6c9e('0x16')]:'','XMD-CALLERID':_0x275d49,'XMD-CALLERID-PREVIEW':_0x1473c8?util['format'](_0x6c9e('0x17'),_0x1473c8[_0x6c9e('0x18')],_0x1473c8[_0x6c9e('0x19')]):_0x275d49,'XMD-DIALID':_0x1e42d9,'XMD-CONTACTID':_0x350904[_0x6c9e('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x275d49,'XMD-VOICEQUEUEID':_0x350904['VoiceQueueId'],'XMD-DIALCHANNEL':_0x17f12b,'XMD-DIALTIMEOUT':_0x18a256[_0x6c9e('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x6c9e('0x13')](_0x6c9e('0x1c'),_0x18a256[_0x6c9e('0x1d')]?'g':'',_[_0x6c9e('0x12')](_0x18a256[_0x6c9e('0x1e')])?'':_0x6c9e('0x1f')),'XMD-DIALURL':_0x18a256['dialPreviewUrl']||'','XMD-AGI':_0x18a256[_0x6c9e('0x20')]?util['format'](_0x6c9e('0x21'),ipAgi,_0x18a256[_0x6c9e('0x20')]):'NONE','XMD-AGIAFTER':_0x18a256['dialQueueProject2']?util[_0x6c9e('0x13')](_0x6c9e('0x21'),ipAgi,_0x18a256[_0x6c9e('0x1d')]):_0x6c9e('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1473c8?_0x1473c8['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1473c8?_0x1473c8['originatecalleridname']:'','XMD-DESTINATION':_0x6c9e('0x23'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x18a256[_0x6c9e('0x1e')])){_0x5581d8[util[_0x6c9e('0x13')]('%s',_0x6c9e('0x24'))]=_0x18a256[_0x6c9e('0x1e')];_0x5581d8[util[_0x6c9e('0x13')]('%s',_0x6c9e('0x25'))]=_0x1e42d9;}return _0x5581d8;};exports[_0x6c9e('0x26')]=function(_0x4a2acb){var _0x33d7b1={};for(var _0x3ed8aa in _0x4a2acb){if(_0x4a2acb[_0x6c9e('0x27')](_0x3ed8aa)){_0x33d7b1[util['format']('%s',_['toLower'](_0x3ed8aa))]=_0x4a2acb[_0x3ed8aa];}}return{'variables':_0x33d7b1};};exports[_0x6c9e('0x28')]=function(_0x18bd76,_0x4f8b93){if(!_[_0x6c9e('0x29')](_0x18bd76)){if(_0x18bd76[_0x6c9e('0x27')]('originated')){if(_0x18bd76[_0x6c9e('0x2a')]>0x0){_0x18bd76['originated']-=0x1;}else{logger[_0x6c9e('0xc')](_0x6c9e('0x2b'),_0x4f8b93);}}}else{logger['error'](_0x6c9e('0x2c'),_0x4f8b93);}};exports[_0x6c9e('0x2d')]=function(_0xc2d04f){var _0x3f5824=moment()[_0x6c9e('0x13')](_0x6c9e('0x2e'));_0xc2d04f['state']=0xd;_0xc2d04f[_0x6c9e('0x2f')]=_0x6c9e('0x30');_0xc2d04f['starttime']=_0x3f5824;_0xc2d04f[_0x6c9e('0x31')]=_0x3f5824;_0xc2d04f[_0x6c9e('0x32')]=_0x3f5824;};exports['logAgent']=function(_0x541f44,_0x2eb3a2,_0x3afb9e){var _0x527e1b=moment()[_0x6c9e('0x13')](_0x6c9e('0x2e'));_0x541f44[_0x6c9e('0x33')]=_0x2eb3a2;_0x541f44[_0x6c9e('0x2f')]=_0x3afb9e;_0x541f44[_0x6c9e('0x31')]=_0x527e1b;_0x541f44[_0x6c9e('0x34')]=utils[_0x6c9e('0x35')](_0x541f44['responsetime'],_0x541f44[_0x6c9e('0x36')]);};exports['logLookAgent']=function(_0x55daa4,_0x29f544,_0xa5ec84){_0x55daa4[_0x6c9e('0x37')]=_0x29f544;_0x55daa4[_0x6c9e('0x38')]=_0xa5ec84;};exports[_0x6c9e('0x39')]=function(_0x51d08e,_0x28811c,_0x18e246){var _0x1c52ce=moment()[_0x6c9e('0x13')](_0x6c9e('0x2e'));_0x51d08e[_0x6c9e('0x33')]=_0x28811c;_0x51d08e[_0x6c9e('0x2f')]=_0x18e246;_0x51d08e[_0x6c9e('0x31')]=_0x51d08e[_0x6c9e('0x31')]?_0x51d08e[_0x6c9e('0x31')]:_0x1c52ce;_0x51d08e['endtime']=_0x51d08e[_0x6c9e('0x32')]?_0x51d08e[_0x6c9e('0x32')]:_0x1c52ce;_0x51d08e[_0x6c9e('0x34')]=utils[_0x6c9e('0x35')](_0x51d08e[_0x6c9e('0x31')]||0x0,_0x51d08e[_0x6c9e('0x36')]||0x0);_0x51d08e[_0x6c9e('0x3a')]=_0x51d08e[_0x6c9e('0x3b')]?utils[_0x6c9e('0x35')](_0x51d08e[_0x6c9e('0x32')],_0x51d08e[_0x6c9e('0x3b')]):0x0;};exports[_0x6c9e('0x3c')]=function(_0x5d87c0){return _0x5d87c0===_0x6c9e('0x3d');};exports[_0x6c9e('0x3e')]=function(_0x5b59f1,_0x44f098,_0x58d50d,_0x39aa7f,_0x321f5a){var _0x9e0d9b=_0x39aa7f?_0x6c9e('0x3f'):_0x5b59f1['calleridname'];_0x9e0d9b=_0x321f5a?'BOOKED':_0x9e0d9b;return{'actionid':_0x5b59f1['uniqueid'],'action':'originate','channel':_0x5b59f1[_0x6c9e('0x40')],'callerid':util[_0x6c9e('0x13')](_0x6c9e('0x17'),_0x9e0d9b,_0x5b59f1['calleridnum']),'Exten':_0x6c9e('0x23'),'Context':_0x6c9e('0x41'),'Priority':'1','variable':_0x58d50d,'timeout':(_0x44f098[_0x6c9e('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b59f1['uniqueid']};};exports['totalGlobal']=function(_0x2fc50c){return _0x2fc50c[_0x6c9e('0x43')]+_0x2fc50c[_0x6c9e('0x44')]+_0x2fc50c['countnoanswerretry']+_0x2fc50c[_0x6c9e('0x45')]+_0x2fc50c[_0x6c9e('0x46')];};exports['cloneAction']=function(_0x568e7a){var _0x4c6eff=_[_0x6c9e('0x47')](_0x568e7a);_0x4c6eff[_0x6c9e('0x33')]=0xf;_0x4c6eff[_0x6c9e('0x2f')]=_0x6c9e('0x48');return _0x4c6eff;};exports[_0x6c9e('0x49')]=function(_0x155960,_0x4db84d,_0x5966f6){var _0x303315={};_0x303315[_0x4db84d]=_0x155960[_0x4db84d];_0x303315[_0x6c9e('0x4a')]=![];_0x303315[_0x6c9e('0x4b')]=moment()[_0x6c9e('0x4c')](_0x5966f6,_0x6c9e('0x4d'))['format'](_0x6c9e('0x2e'));_0x303315['ContactId']=_0x155960['ContactId'];_0x303315[_0x6c9e('0x4e')]=_0x155960[_0x6c9e('0x4e')];_0x303315[_0x6c9e('0x4f')]=_0x155960[_0x6c9e('0x4f')]||undefined;return _0x303315;};exports['decrementTalkink']=function(_0x93f7d0,_0x484e4b){if(!_['isNil'](_0x93f7d0)){if(_0x93f7d0['pTalking']>0x0){_0x93f7d0[_0x6c9e('0x50')]-=0x1;}else{logger[_0x6c9e('0xc')](_0x484e4b,_0x6c9e('0x51'));}}else{logger[_0x6c9e('0xc')](_0x484e4b,_0x6c9e('0x52'));}};exports['IsNotLoggedIn']=function(_0x4a6320){if(_0x4a6320<=0x0){return!![];}return![];};function buildObj(_0xbe62ac,_0x2fefdd,_0x43192a){_0xbe62ac[_0x6c9e('0x53')]=_0x2fefdd;_0xbe62ac[_0x6c9e('0x16')]=_0xbe62ac[_0x6c9e('0x54')];_0xbe62ac[_0x6c9e('0x55')]=_0xbe62ac[_0x6c9e('0x40')];_0xbe62ac[_0x6c9e('0x56')]=_0x6c9e('0x57');if(_0x43192a){_0xbe62ac[_0x6c9e('0x58')]=_0x43192a[_0x6c9e('0x58')];}return _0xbe62ac;}exports[_0x6c9e('0x59')]=buildObj;exports[_0x6c9e('0x5a')]=function(_0x4ba391){var _0x2d4dbf=[];for(var _0x592dde in _0x4ba391){if(_0x4ba391[_0x6c9e('0x27')](_0x592dde)){if(!_[_0x6c9e('0x29')](_0x4ba391[_0x592dde])&&_0x4ba391[_0x592dde][_0x6c9e('0x33')]===_0x6c9e('0x5b')&&_0x4ba391[_0x592dde]['status']==='reachable'){_0x2d4dbf[_0x6c9e('0x5c')](_0x4ba391[_0x592dde]['id']);}}}return _0x2d4dbf;};exports[_0x6c9e('0x5d')]=function(_0x2f6f52){var _0x3472a9=moment()[_0x6c9e('0x5e')](0x0);var _0x253772=moment(_0x2f6f52)[_0x6c9e('0x5e')](0x0);return _0x3472a9[_0x6c9e('0x5f')](_0x253772,_0x6c9e('0x60'));};exports[_0x6c9e('0x61')]=function(_0x3d8a7e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d8a7e['ContactId'],'ListId':_0x3d8a7e[_0x6c9e('0x4e')],'VoiceQueueId':_0x3d8a7e[_0x6c9e('0x4f')]||undefined,'CampaignId':_0x3d8a7e[_0x6c9e('0x62')]||undefined};};exports[_0x6c9e('0x63')]=function(_0x116346){if(_0x116346===_0x6c9e('0x64')||_0x116346==='idContact'||_0x116346==='queue'||_0x116346===_0x6c9e('0x65')||_0x116346==='campaigntype'||_0x116346===_0x6c9e('0x66')||_0x116346===_0x6c9e('0x37')||_0x116346===_0x6c9e('0x40')||_0x116346===_0x6c9e('0x18')||_0x116346===_0x6c9e('0x4a')||_0x116346===_0x6c9e('0x19')||_0x116346===_0x6c9e('0x4b')||_0x116346===_0x6c9e('0x43')||_0x116346==='countcongestionretry'||_0x116346===_0x6c9e('0x67')||_0x116346===_0x6c9e('0x68')||_0x116346===_0x6c9e('0x69')||_0x116346===_0x6c9e('0x6a')||_0x116346===_0x6c9e('0x6b')||_0x116346===_0x6c9e('0x6c')||_0x116346===_0x6c9e('0x1a')||_0x116346===_0x6c9e('0x4e')||_0x116346===_0x6c9e('0x38')||_0x116346===_0x6c9e('0x4f')||_0x116346===_0x6c9e('0x6d')||_0x116346===_0x6c9e('0x6e')||_0x116346===_0x6c9e('0x6f')||_0x116346===_0x6c9e('0x70')||_0x116346==='xmd-listid'||_0x116346==='xmd-dialurl'||_0x116346===_0x6c9e('0x71')||_0x116346===_0x6c9e('0x72')||_0x116346===_0x6c9e('0x73')||_0x116346===_0x6c9e('0x74')||_0x116346==='xmd-contactid'||_0x116346===_0x6c9e('0x75')||_0x116346===_0x6c9e('0x76')||_0x116346===_0x6c9e('0x77')||_0x116346===_0x6c9e('0x78')||_0x116346===_0x6c9e('0x79')||_0x116346===_0x6c9e('0x7a')||_0x116346===_0x6c9e('0x7b')||_0x116346===_0x6c9e('0x7c')||_0x116346===_0x6c9e('0x7d')||_0x116346===_0x6c9e('0x7e')||_0x116346===_0x6c9e('0x7f')||_0x116346===_0x6c9e('0x80')||_0x116346===_0x6c9e('0x79')||_0x116346===_0x6c9e('0x7a')||_0x116346===_0x6c9e('0x7b')||_0x116346===_0x6c9e('0x7c')||_0x116346===_0x6c9e('0x7d')||_0x116346===_0x6c9e('0x7e')||_0x116346==='rtpaudioqosrtt'||_0x116346==='rtpaudioqosrttbridged'||_0x116346==='bridgepeer'||_0x116346===_0x6c9e('0x81')||_0x116346===_0x6c9e('0x33')||_0x116346===_0x6c9e('0x2f')){return![];}return!![];};exports[_0x6c9e('0x82')]=function(_0x54c598,_0x40d322){var _0x2b240a,_0x796c5d,_0x389d2d;if(_0x40d322<=0x0){_0x40d322=0x1;}_0x2b240a=new RegExp(_0x6c9e('0x83')+_0x40d322+'}$');_0x796c5d=Math[_0x6c9e('0x84')](0xa,_0x40d322-0x1);_0x389d2d=Math['pow'](0xa,_0x40d322)-0x1;return util[_0x6c9e('0x13')]('%s',_[_0x6c9e('0x85')](_0x54c598,_0x2b240a,_['random'](_0x796c5d,_0x389d2d)));};exports[_0x6c9e('0x86')]=function(_0x2189e8){var _0x11f2fb=_0x2189e8[_0x6c9e('0x87')](/"(.*?)"/);return _0x11f2fb?_0x11f2fb[0x1]:_0x2189e8;};exports['extractCalleridNumber']=function(_0x5d5800){var _0x148991=_0x5d5800[_0x6c9e('0x87')](/<(.*?)>/);return _0x148991?_0x148991[0x1]:_0x5d5800;};function buildNoAnswerEventPayload(_0x4e19ce,_0x54f4fc){var _0x45374d=buildObj(_0x4e19ce,_0x6c9e('0x88'));if(!_[_0x6c9e('0x12')](_0x54f4fc[_0x6c9e('0x89')])){Object[_0x6c9e('0x8a')](_0x54f4fc[_0x6c9e('0x89')])[_0x6c9e('0x8b')](function(_0x38a6fc){_0x45374d[_0x38a6fc['toLowerCase']()]=_0x54f4fc[_0x6c9e('0x89')][_0x38a6fc];});}return _0x45374d;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2d80413..4c7b8cb 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 _0x3cf5=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x4d1323,_0x1cd33f){var _0x9c9f48=function(_0x5ee5da){while(--_0x5ee5da){_0x4d1323['push'](_0x4d1323['shift']());}};_0x9c9f48(++_0x1cd33f);}(_0x3cf5,0xe8));var _0x53cf=function(_0x135c17,_0x1188b2){_0x135c17=_0x135c17-0x0;var _0x2546b0=_0x3cf5[_0x135c17];return _0x2546b0;};'use strict';exports[_0x53cf('0x0')]={'queue':{'type':_0x53cf('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x53cf('0x1'),'required':!![]},'penalty':{'type':_0x53cf('0x2'),'required':![]},'paused':{'type':_0x53cf('0x3'),'required':![]}};exports[_0x53cf('0x4')]={'queue':{'type':_0x53cf('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x53cf('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x53cf('0x1'),'required':![]}};exports[_0x53cf('0x6')]={'module':{'type':'string','required':![]}};exports[_0x53cf('0x7')]={'uniqueid':{'type':_0x53cf('0x1'),'required':!![]}};exports[_0x53cf('0x8')]={'uniqueid':{'type':_0x53cf('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x53cf('0x1')},'mixmonitorid':{'type':_0x53cf('0x1')}};exports[_0x53cf('0x9')]={'uniqueid':{'type':_0x53cf('0x1'),'required':!![]}};exports[_0x53cf('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x53cf('0x1'),'required':!![]},'context':{'type':_0x53cf('0x1')}}; \ No newline at end of file +var _0x5685=['reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x5685,0x94));var _0x5568=function(_0x175f6f,_0x1a4a05){_0x175f6f=_0x175f6f-0x0;var _0x1aa501=_0x5685[_0x175f6f];return _0x1aa501;};'use strict';exports['queueadd']={'queue':{'type':_0x5568('0x0'),'required':!![]},'interface':{'type':_0x5568('0x0'),'required':!![]},'membername':{'type':_0x5568('0x0'),'required':!![]},'penalty':{'type':_0x5568('0x1'),'required':![]},'paused':{'type':_0x5568('0x2'),'required':![]}};exports[_0x5568('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x5568('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x5568('0x0'),'required':!![]},'paused':{'type':_0x5568('0x2')},'reason':{'type':_0x5568('0x0'),'required':![]}};exports[_0x5568('0x4')]={'module':{'type':_0x5568('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x5568('0x0'),'required':!![]}};exports[_0x5568('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x5568('0x0')},'format':{'type':_0x5568('0x0')},'mixmonitorid':{'type':_0x5568('0x0')}};exports[_0x5568('0x6')]={'uniqueid':{'type':_0x5568('0x0'),'required':!![]}};exports[_0x5568('0x7')]={'uniqueid':{'type':_0x5568('0x0'),'required':!![]},'exten':{'type':_0x5568('0x0'),'required':!![]},'context':{'type':_0x5568('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 08e1d31..f93030a 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x3a635a,_0x27e780){var _0x26b554=function(_0x3ca04f){while(--_0x3ca04f){_0x3a635a['push'](_0x3a635a['shift']());}};_0x26b554(++_0x27e780);}(_0xdb28,0x106));var _0x8db2=function(_0x1948a0,_0x2cc3b3){_0x1948a0=_0x1948a0-0x0;var _0x1dd279=_0xdb28[_0x1948a0];return _0x1dd279;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x2f5fb2,_0x2a1f66){var _0xd8336a=function(_0x3f93c0){while(--_0x3f93c0){_0x2f5fb2['push'](_0x2f5fb2['shift']());}};_0xd8336a(++_0x2a1f66);}(_0xdb28,0x106));var _0x8db2=function(_0x418694,_0x4a5cd1){_0x418694=_0x418694-0x0;var _0x2162d6=_0xdb28[_0x418694];return _0x2162d6;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index a129ca8..6a37b61 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7230=['hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7230,0x1ae));var _0x0723=function(_0x19b1fa,_0x4e693c){_0x19b1fa=_0x19b1fa-0x0;var _0x5697b5=_0x7230[_0x19b1fa];return _0x5697b5;};'use strict';function mergeDBDataToRealtime(_0x1c3528,_0xaecee0){var _0x468d35=Object['assign']({},_0x1c3528);for(var _0x1ab4d4 in _0xaecee0){if(_0x468d35[_0x0723('0x0')](_0x1ab4d4)){_0x468d35[_0x1ab4d4]=_0xaecee0[_0x1ab4d4];}}return _0x468d35;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x0d25=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x1f7dd9,_0x299c7f){var _0x1773b8=function(_0x361627){while(--_0x361627){_0x1f7dd9['push'](_0x1f7dd9['shift']());}};_0x1773b8(++_0x299c7f);}(_0x0d25,0x134));var _0x50d2=function(_0x520e16,_0x545cb6){_0x520e16=_0x520e16-0x0;var _0x4771b5=_0x0d25[_0x520e16];return _0x4771b5;};'use strict';function mergeDBDataToRealtime(_0x5baa24,_0x3c89ad){var _0x4bb44b=Object[_0x50d2('0x0')]({},_0x5baa24);for(var _0xdb3872 in _0x3c89ad){if(_0x4bb44b[_0x50d2('0x1')](_0xdb3872)){_0x4bb44b[_0xdb3872]=_0x3c89ad[_0xdb3872];}}return _0x4bb44b;}exports[_0x50d2('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4574819..7b4403e 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 _0xab18=['indexOf','mobile','phone','lastIndexOf','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','length','assigned','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','lastapplication','queue','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitors','createdAt','exten','xcally-motion-preview','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','Local','substring'];(function(_0x144fb8,_0x439c5c){var _0xf2cf4b=function(_0x246f67){while(--_0x246f67){_0x144fb8['push'](_0x144fb8['shift']());}};_0xf2cf4b(++_0x439c5c);}(_0xab18,0x171));var _0x8ab1=function(_0x1fd599,_0x2a9774){_0x1fd599=_0x1fd599-0x0;var _0x14ede4=_0xab18[_0x1fd599];return _0x14ede4;};'use strict';var _=require(_0x8ab1('0x0'));var moment=require('moment');var util=require(_0x8ab1('0x1'));var config=require(_0x8ab1('0x2'));var ami=require(_0x8ab1('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x8ab1('0x4'));var RpcVoiceDialReport=require(_0x8ab1('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8ab1('0x6'));var RpcVoiceRecording=require(_0x8ab1('0x7'));var RpcVoiceTransferReport=require(_0x8ab1('0x8'));var VoiceQueueReport=require(_0x8ab1('0x9'));var VoiceCallReport=require(_0x8ab1('0xa'));var VoiceAgentReport=require(_0x8ab1('0xb'));var VoiceDialReport=require(_0x8ab1('0xc'));var UserReport=require(_0x8ab1('0xd'));function Report(_0x1db5cd){this[_0x8ab1('0xe')]=_0x1db5cd;this[_0x8ab1('0xf')]=_0x1db5cd[_0x8ab1('0xf')];this[_0x8ab1('0x10')]=_0x1db5cd[_0x8ab1('0x10')];}Report[_0x8ab1('0x11')][_0x8ab1('0x12')]=function(_0x28829e){var _0xc43ef=new VoiceQueueReport(this['realtime']);var _0x23d1e9=new VoiceAgentReport(this[_0x8ab1('0xe')]);var _0x196688=new VoiceDialReport(this[_0x8ab1('0xe')]);var _0x594704=new VoiceCallReport(this[_0x8ab1('0xe')]);var _0x42d8bb=new UserReport(this[_0x8ab1('0xe')]);if(config[_0x8ab1('0x13')]&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this[_0x8ab1('0x14')][_0x8ab1('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x8ab1('0x16')][_0x8ab1('0x15')](this));ami['on'](_0x8ab1('0x17'),this['voiceAgentReport'][_0x8ab1('0x15')](this));ami['on'](_0x8ab1('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0x8ab1('0x19'),this[_0x8ab1('0x1a')][_0x8ab1('0x15')](this));ami['on']('attendedtransfer',this[_0x8ab1('0x1b')][_0x8ab1('0x15')](this));}};Report[_0x8ab1('0x11')][_0x8ab1('0x1c')]=function(_0x13fc2f){var _0x799e21;_0x799e21=_[_0x8ab1('0x1d')](this[_0x8ab1('0xf')],function(_0x54af34){return _0x54af34[_0x8ab1('0x1e')]==_0x13fc2f||_0x54af34['name']==_0x13fc2f;});if(_[_0x8ab1('0x1f')](_0x799e21)){var _0xd78f4f=_[_0x8ab1('0x1d')](this['telephones'],function(_0x4f0010){return _0x4f0010[_0x8ab1('0x1e')]==_0x13fc2f||_0x4f0010[_0x8ab1('0x20')]==_0x13fc2f;});if(_0xd78f4f){_0x799e21=_[_0x8ab1('0x1d')](this[_0x8ab1('0xf')],function(_0x2a4a7d){return _0x2a4a7d[_0x8ab1('0x21')]==util[_0x8ab1('0x22')](_0x8ab1('0x23'),_0xd78f4f[_0x8ab1('0x20')]);});}}return _0x799e21;};Report['prototype'][_0x8ab1('0x14')]=function(_0x93c694){for(var _0xfa49f9=0x0;_0xfa49f9<_0x93c694[_0x8ab1('0x24')];_0xfa49f9+=0x1){var _0x46a99f=this[_0x8ab1('0x1c')](_0x93c694[_0xfa49f9]['connectedlinenum']);if(_0x46a99f){_0x93c694[_0xfa49f9][_0x8ab1('0x1e')]=_0x46a99f[_0x8ab1('0x1e')];_0x93c694[_0xfa49f9][_0x8ab1('0x25')]=!![];_0x93c694[_0xfa49f9]['lastAssignedTo']=_0x46a99f[_0x8ab1('0x20')];_0x93c694[_0xfa49f9][_0x8ab1('0x21')]=_['isNil'](_0x46a99f[_0x8ab1('0x21')])?util['format'](_0x8ab1('0x23'),_0x46a99f[_0x8ab1('0x20')]):_0x46a99f[_0x8ab1('0x21')];if(_0x93c694[_0xfa49f9][_0x8ab1('0x26')]){_0x93c694[_0xfa49f9][_0x8ab1('0x27')]=moment()[_0x8ab1('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x93c694[_0xfa49f9][_0x8ab1('0x28')]){_0x93c694[_0xfa49f9][_0x8ab1('0x29')]=moment()[_0x8ab1('0x22')](_0x8ab1('0x2a'));}RpcMemberReport[_0x8ab1('0x14')](_0x93c694[_0xfa49f9]);}RpcVoiceQueueReport[_0x8ab1('0x2b')](_0x93c694[_0xfa49f9]);}};function extractCalleridNumber(_0x159f70){var _0x3f39bb=_0x159f70[_0x8ab1('0x2c')](/<(.*?)>/);return _0x3f39bb?_0x3f39bb[0x1]:_0x159f70;}Report[_0x8ab1('0x11')][_0x8ab1('0x2d')]=function(_0x108dec){for(var _0x1eb2fd=0x0;_0x1eb2fd',_0x2f7ed4[_0x8ab1('0x42')],_0x2f7ed4['calleridnum']);}if(RpcVoiceTransferReport[_0x8ab1('0x43')][_0x2f7ed4[_0x8ab1('0x44')]]){var _0x3ec366=RpcVoiceTransferReport[_0x8ab1('0x43')][_0x2f7ed4[_0x8ab1('0x44')]];_0x3ec366[_0x8ab1('0x45')]=_0x2f7ed4[_0x8ab1('0x46')];RpcVoiceTransferReport['blindTransfer'](_0x3ec366);delete RpcVoiceTransferReport[_0x8ab1('0x43')][_0x2f7ed4[_0x8ab1('0x44')]];}if(_[_0x8ab1('0x1f')](_0x2f7ed4[_0x8ab1('0x47')])){_0x2f7ed4[_0x8ab1('0x47')]=this['getCallType'](_0x2f7ed4);}if(_[_0x8ab1('0x1f')](_0x2f7ed4[_0x8ab1('0x48')])){var _0xc49dba=_0x2f7ed4[_0x8ab1('0x30')][_0x8ab1('0x31')]('-')[0x0];var _0x3136c9=this['agents'][_0xc49dba];if(!_0x3136c9)_0x3136c9=this[_0x8ab1('0x2d')](_0x2f7ed4[_0x8ab1('0x1e')]);if(_0x3136c9){_0x2f7ed4[_0x8ab1('0x48')]=_0x3136c9['id'];_0x2f7ed4[_0x8ab1('0x49')]=_0x3136c9[_0x8ab1('0x20')];}}RpcVoiceCallReport['create'](_0x2f7ed4);if(_0x2f7ed4['monitor']){for(var _0x5e7204=0x0;_0x5e7204<_0x2f7ed4[_0x8ab1('0x4a')]['length'];_0x5e7204+=0x1){_0x2f7ed4['monitorFilename']=_0x2f7ed4['monitors'][_0x5e7204]['filename'];_0x2f7ed4[_0x8ab1('0x4b')]=_0x2f7ed4['monitors'][_0x5e7204]['createdAt'];if(_0x2f7ed4[_0x8ab1('0x4c')]==_0x8ab1('0x4d')){_0x2f7ed4[_0x8ab1('0x32')]=_0x2f7ed4[_0x8ab1('0x41')];_0x2f7ed4[_0x8ab1('0x42')]=_0x2f7ed4['connectedlinename'];_0x2f7ed4[_0x8ab1('0x41')]=_0x2f7ed4[_0x8ab1('0x1e')];_0x2f7ed4['connectedlinename']=_0x2f7ed4[_0x8ab1('0x49')];_0x2f7ed4[_0x8ab1('0x4c')]=_0x2f7ed4['originatecalleridnum'];}else if(_0x2f7ed4[_0x8ab1('0x4c')]==_0x8ab1('0x4e')){_0x2f7ed4[_0x8ab1('0x32')]=_0x2f7ed4[_0x8ab1('0x35')];_0x2f7ed4[_0x8ab1('0x4c')]=_0x2f7ed4[_0x8ab1('0x3d')];}RpcVoiceRecording['create'](_0x2f7ed4);}}};Report[_0x8ab1('0x11')][_0x8ab1('0x4f')]=function(_0x32ebdd){if(_[_0x8ab1('0x50')](_0x32ebdd)){_0x32ebdd[_0x8ab1('0x51')](function(_0x596d1e){RpcVoiceAgentReport[_0x8ab1('0x2b')](_0x596d1e);});}else{RpcVoiceAgentReport[_0x8ab1('0x2b')](_0x32ebdd);}};Report['prototype'][_0x8ab1('0x52')]=function(_0x6929cb){RpcVoiceDialReport[_0x8ab1('0x2b')](_0x6929cb);var _0x145bac;var _0x40600c;var _0x3766f7=_0x6929cb['channel'];if(_[_0x8ab1('0x53')](_0x3766f7,_0x8ab1('0x54'))){_0x40600c=_0x3766f7[_0x8ab1('0x55')](_0x3766f7[_0x8ab1('0x56')]('/')+0x1,_0x3766f7['indexOf']('@'));_0x145bac=_[_0x8ab1('0x1d')](this['agents'],function(_0x5231bc){return _0x5231bc[_0x8ab1('0x57')]==_0x40600c||_0x5231bc[_0x8ab1('0x58')]==_0x40600c||_0x5231bc[_0x8ab1('0x1e')]==_0x40600c;});}else{_0x40600c=_0x3766f7[_0x8ab1('0x55')](_0x3766f7[_0x8ab1('0x56')]('/')+0x1,_0x3766f7[_0x8ab1('0x59')]('-'));_0x145bac=this[_0x8ab1('0x1c')](_0x40600c);}if(_0x145bac){_0x6929cb[_0x8ab1('0x21')]=_[_0x8ab1('0x1f')](_0x145bac[_0x8ab1('0x21')])?util['format'](_0x8ab1('0x23'),_0x145bac[_0x8ab1('0x20')]):_0x145bac[_0x8ab1('0x21')];_0x6929cb['membername']=_0x145bac['name'];_0x6929cb[_0x8ab1('0x1e')]=_0x145bac[_0x8ab1('0x1e')];RpcMemberReport[_0x8ab1('0x52')](_0x6929cb);}};Report[_0x8ab1('0x11')][_0x8ab1('0x1a')]=function(_0x3fb224){RpcVoiceTransferReport[_0x8ab1('0x43')][_0x3fb224['transfererlinkedid']]=_0x3fb224;};Report[_0x8ab1('0x11')][_0x8ab1('0x1b')]=function(_0x3782ef){RpcVoiceTransferReport[_0x8ab1('0x1b')](_0x3782ef);};module[_0x8ab1('0x5a')]=Report; \ No newline at end of file +var _0xad75=['YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','voiceQueueReport','create','match','keys','getCallType','channel','split','getAgentByInternal','outbound','voiceCallReport','destination','exten','queue','context','callerid','calleridnum','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitorFilename','monitors','filename','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete'];(function(_0xfe8dac,_0x3ec28a){var _0x2fbff7=function(_0x32963f){while(--_0x32963f){_0xfe8dac['push'](_0xfe8dac['shift']());}};_0x2fbff7(++_0x3ec28a);}(_0xad75,0xe0));var _0x5ad7=function(_0x59e880,_0x179562){_0x59e880=_0x59e880-0x0;var _0x5ee0fb=_0xad75[_0x59e880];return _0x5ee0fb;};'use strict';var _=require(_0x5ad7('0x0'));var moment=require(_0x5ad7('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x5ad7('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x5ad7('0x3'));var RpcMemberReport=require(_0x5ad7('0x4'));var RpcVoiceQueueReport=require(_0x5ad7('0x5'));var RpcVoiceRecording=require(_0x5ad7('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x5ad7('0x7'));var VoiceCallReport=require(_0x5ad7('0x8'));var VoiceAgentReport=require(_0x5ad7('0x9'));var VoiceDialReport=require(_0x5ad7('0xa'));var UserReport=require('./userReport');function Report(_0x2b93a2){this[_0x5ad7('0xb')]=_0x2b93a2;this[_0x5ad7('0xc')]=_0x2b93a2[_0x5ad7('0xc')];this['telephones']=_0x2b93a2[_0x5ad7('0xd')];}Report[_0x5ad7('0xe')][_0x5ad7('0xf')]=function(_0x1829bf){var _0x2e20d2=new VoiceQueueReport(this[_0x5ad7('0xb')]);var _0x3a6d3a=new VoiceAgentReport(this[_0x5ad7('0xb')]);var _0x5cf2d8=new VoiceDialReport(this[_0x5ad7('0xb')]);var _0x2a6116=new VoiceCallReport(this[_0x5ad7('0xb')]);var _0x2c0739=new UserReport(this[_0x5ad7('0xb')]);if(config[_0x5ad7('0x10')]&&config[_0x5ad7('0x10')][_0x5ad7('0x11')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on'](_0x5ad7('0x12'),this['voiceCallReport'][_0x5ad7('0x13')](this));ami['on'](_0x5ad7('0x14'),this[_0x5ad7('0x15')][_0x5ad7('0x13')](this));ami['on'](_0x5ad7('0x16'),this[_0x5ad7('0x17')][_0x5ad7('0x13')](this));ami['on'](_0x5ad7('0x18'),this[_0x5ad7('0x19')]['bind'](this));ami['on'](_0x5ad7('0x1a'),this[_0x5ad7('0x1b')][_0x5ad7('0x13')](this));}};Report[_0x5ad7('0xe')][_0x5ad7('0x1c')]=function(_0xbeb2c5){var _0x3aa77c;_0x3aa77c=_[_0x5ad7('0x1d')](this[_0x5ad7('0xc')],function(_0xb15a9){return _0xb15a9[_0x5ad7('0x1e')]==_0xbeb2c5||_0xb15a9[_0x5ad7('0x1f')]==_0xbeb2c5;});if(_[_0x5ad7('0x20')](_0x3aa77c)){var _0x297dc1=_['find'](this['telephones'],function(_0x587f6d){return _0x587f6d['accountcode']==_0xbeb2c5||_0x587f6d[_0x5ad7('0x1f')]==_0xbeb2c5;});if(_0x297dc1){_0x3aa77c=_['find'](this[_0x5ad7('0xc')],function(_0x420b91){return _0x420b91[_0x5ad7('0x21')]==util[_0x5ad7('0x22')]('SIP/%s',_0x297dc1['name']);});}}return _0x3aa77c;};Report[_0x5ad7('0xe')]['voiceQueueReport']=function(_0x1acf55){for(var _0x487e59=0x0;_0x487e59<_0x1acf55[_0x5ad7('0x23')];_0x487e59+=0x1){var _0x116795=this[_0x5ad7('0x1c')](_0x1acf55[_0x487e59][_0x5ad7('0x24')]);if(_0x116795){_0x1acf55[_0x487e59]['accountcode']=_0x116795[_0x5ad7('0x1e')];_0x1acf55[_0x487e59][_0x5ad7('0x25')]=!![];_0x1acf55[_0x487e59][_0x5ad7('0x26')]=_0x116795[_0x5ad7('0x1f')];_0x1acf55[_0x487e59][_0x5ad7('0x21')]=_[_0x5ad7('0x20')](_0x116795[_0x5ad7('0x21')])?util[_0x5ad7('0x22')]('SIP/%s',_0x116795[_0x5ad7('0x1f')]):_0x116795['interface'];if(_0x1acf55[_0x487e59][_0x5ad7('0x27')]){_0x1acf55[_0x487e59]['queuecallercompleteAt']=moment()[_0x5ad7('0x22')](_0x5ad7('0x28'));}if(_0x1acf55[_0x487e59]['queuecallerexit']){_0x1acf55[_0x487e59][_0x5ad7('0x29')]=moment()[_0x5ad7('0x22')](_0x5ad7('0x28'));}RpcMemberReport[_0x5ad7('0x2a')](_0x1acf55[_0x487e59]);}RpcVoiceQueueReport[_0x5ad7('0x2b')](_0x1acf55[_0x487e59]);}};function extractCalleridNumber(_0x2cb63c){var _0x1d6624=_0x2cb63c[_0x5ad7('0x2c')](/<(.*?)>/);return _0x1d6624?_0x1d6624[0x1]:_0x2cb63c;}Report[_0x5ad7('0xe')]['getAgentByInternal']=function(_0x11986e){for(var _0x178f52=0x0;_0x178f520x0?!![]:![];if(!_0x35056a){return this[_0xef6b('0x1c')](this[_0xef6b('0x16')][_0xef6b('0x6f')]);}};VoiceQueueReport[_0xef6b('0xc')]['syncQueueMember']=function(_0x38a9b0){var _0x3e1cbd=this[_0xef6b('0x16')]['id'];if(this['summary'][_0xef6b('0x6c')][_0x3e1cbd]&&this[_0xef6b('0x16')][_0xef6b('0x6c')][_0x3e1cbd][_0x38a9b0[_0xef6b('0x65')]]){this['summary'][_0xef6b('0x6c')][_0x3e1cbd][_0x38a9b0[_0xef6b('0x65')]][_0xef6b('0x12')][_0xef6b('0x70')](_0x38a9b0);}};VoiceQueueReport[_0xef6b('0xc')][_0xef6b('0x19')]=function(_0x4ebe27){var _0x13fda6=this;try{if(this[_0xef6b('0x60')](_0x4ebe27)&&this[_0xef6b('0x60')](_0x4ebe27['queue'])){logger[_0xef6b('0x58')](_0xef6b('0x71'),util[_0xef6b('0x48')](_0x4ebe27,{'showHidden':![],'depth':null}));var _0x53e2b1=this[_0xef6b('0x14')][_0x4ebe27[_0xef6b('0x55')]];if(_0x53e2b1){logger[_0xef6b('0x58')](_0xef6b('0x72'),_0x53e2b1[_0xef6b('0x5f')]);this[_0xef6b('0x16')]['queues'][_0x53e2b1[_0xef6b('0x5f')]]={'summaryEvent':_0x4ebe27};this[_0xef6b('0x16')][_0xef6b('0x6e')]+=0x1;return ami[_0xef6b('0x61')]({'action':_0xef6b('0x6c'),'queue':_0x53e2b1['name']})[_0xef6b('0x73')](function(_0x326eb5){if(!_0x13fda6[_0xef6b('0x16')][_0xef6b('0x6c')][_0x4ebe27['actionid']]){_0x13fda6['summary'][_0xef6b('0x6c')][_0x4ebe27['actionid']]={};}_0x13fda6[_0xef6b('0x16')][_0xef6b('0x6c')][_0x4ebe27['actionid']][_0x326eb5[_0xef6b('0x65')]]={'queue':_0x53e2b1[_0xef6b('0x5f')],'agents':[]};})[_0xef6b('0x44')](function(_0x4b260c){throw _0x4b260c;});}}}catch(_0x1dd743){logger[_0xef6b('0x49')](_0xef6b('0x66'),util['inspect'](_0x1dd743,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef6b('0xc')]['syncQueueSummaryComplete']=function(_0x50e632){if(this[_0xef6b('0x16')][_0xef6b('0x6e')]>0x0){this[_0xef6b('0x16')]['completeEvent']=_0x50e632;return;}logger[_0xef6b('0x58')](_0xef6b('0x74'),util[_0xef6b('0x48')](_0x50e632,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xef6b('0x4f')](_0xef6b('0x75'),{});};VoiceQueueReport['prototype'][_0xef6b('0x21')]=function(_0x13a06f){try{if(this['isNotNull'](_0x13a06f)){logger[_0xef6b('0x58')](_0xef6b('0x76'),_0x13a06f[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x13a06f,{'showHidden':![],'depth':null}));if(_[_0xef6b('0x77')](this[_0xef6b('0x11')][_0x13a06f[_0xef6b('0x53')]])){this['queueReports'][_0x13a06f[_0xef6b('0x53')]]=[];}if(_[_0xef6b('0x77')](this[_0xef6b('0x3f')][_0x13a06f['uniqueid']])){this[_0xef6b('0x3f')][_0x13a06f['uniqueid']]={};}var _0x459c32=new QueueReport();_0x459c32[_0xef6b('0x55')]=_0x13a06f[_0xef6b('0x55')];_0x459c32['type']=this['voiceQueues'][_0x459c32['queue']]&&this[_0xef6b('0x14')][_0x459c32['queue']][_0xef6b('0x5c')]?this[_0xef6b('0x14')][_0x459c32[_0xef6b('0x55')]]['type']||_0xef6b('0x5d'):_0xef6b('0x5d');_0x459c32[_0xef6b('0x78')]=moment()[_0xef6b('0x59')](_0xef6b('0x79'));_0x459c32[_0xef6b('0x7a')]=_0x13a06f[_0xef6b('0x7a')];_0x459c32[_0xef6b('0x7b')]=_0x13a06f[_0xef6b('0x7b')];_0x459c32[_0xef6b('0x53')]=_0x13a06f[_0xef6b('0x53')];_0x459c32[_0xef6b('0x7c')]=this[_0xef6b('0x3f')][_0x13a06f['uniqueid']][_0xef6b('0x7c')];logger[_0xef6b('0x7d')](_0xef6b('0x7e'),_0x459c32['queue'],_0x459c32['type']);Object[_0xef6b('0x6b')](_0x459c32,_[_0xef6b('0x7f')](_0x13a06f,_[_0xef6b('0x80')](_0x459c32)));this[_0xef6b('0x11')][_0x13a06f[_0xef6b('0x53')]][_0xef6b('0x70')](_0x459c32);this[_0xef6b('0x3f')][_0x13a06f[_0xef6b('0x53')]]=_0x459c32;this[_0xef6b('0x50')](_0x459c32,'queuecallerjoin');}}catch(_0x3af80f){logger[_0xef6b('0x49')](_0xef6b('0x76'),_0x13a06f[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x3af80f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef6b('0xc')][_0xef6b('0x22')]=function(_0x31605e){try{if(this[_0xef6b('0x60')](_0x31605e)){logger[_0xef6b('0x58')](_0xef6b('0x81'),_0x31605e['uniqueid'],util[_0xef6b('0x48')](_0x31605e,{'showHidden':![],'depth':null}));if(this[_0xef6b('0x11')][_0x31605e[_0xef6b('0x53')]]){var _0x34cdaf=_[_0xef6b('0x82')](this[_0xef6b('0x11')][_0x31605e['uniqueid']]);_0x34cdaf[_0xef6b('0x3d')]=![];_0x34cdaf['queuecallercompleteAt']=null;_0x34cdaf[_0xef6b('0x83')]=_0x31605e[_0xef6b('0x83')];_0x34cdaf[_0xef6b('0x84')]=_0x31605e[_0xef6b('0x84')];_0x34cdaf[_0xef6b('0x3c')]=!![];_0x34cdaf[_0xef6b('0x85')]=moment()[_0xef6b('0x59')](_0xef6b('0x79'));_0x34cdaf['queuecallerexitreason']='ABANDONED';_0x34cdaf[_0xef6b('0x86')]=null;logger[_0xef6b('0x7d')](_0xef6b('0x87'),_0x34cdaf[_0xef6b('0x55')],_0x34cdaf['type']);this[_0xef6b('0x3f')][_0x31605e[_0xef6b('0x53')]]=_0x34cdaf;this[_0xef6b('0x4d')](_0x34cdaf,_0xef6b('0x3c'));}}}catch(_0x18de24){logger['error'](_0xef6b('0x81'),_0x31605e[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x18de24,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef6b('0x24')]=function(_0x67b499){try{if(this[_0xef6b('0x60')](_0x67b499)){logger[_0xef6b('0x58')](_0xef6b('0x88'),_0x67b499[_0xef6b('0x53')],util['inspect'](_0x67b499,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x67b499[_0xef6b('0x53')]]){var _0x955edb=_[_0xef6b('0x82')](this[_0xef6b('0x11')][_0x67b499[_0xef6b('0x53')]]);_0x955edb[_0xef6b('0x89')]=moment()[_0xef6b('0x59')](_0xef6b('0x79'));_0x955edb[_0xef6b('0x8a')]=_0x67b499[_0xef6b('0x8a')];_0x955edb[_0xef6b('0x8b')]=_0x67b499[_0xef6b('0x8b')];logger[_0xef6b('0x7d')](_0xef6b('0x8c'),_0x955edb['queue'],_0x955edb['type'],_0x67b499[_0xef6b('0x8a')],_0x67b499[_0xef6b('0x8b')]);this[_0xef6b('0x3f')][_0x67b499['uniqueid']]=_0x955edb;this[_0xef6b('0x50')](_0x955edb,'queuecallerleave');}}}catch(_0x3b3753){logger[_0xef6b('0x49')](_0xef6b('0x88'),_0x67b499[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x3b3753,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x207fd7){try{if(this[_0xef6b('0x60')](_0x207fd7)){logger[_0xef6b('0x58')](_0xef6b('0x8d'),_0x207fd7[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x207fd7,{'showHidden':![],'depth':null}));if(this[_0xef6b('0x11')][_0x207fd7[_0xef6b('0x53')]]){var _0x46d14a=_[_0xef6b('0x82')](this[_0xef6b('0x11')][_0x207fd7['uniqueid']]);_0x46d14a['queuecallercomplete']=!![];_0x46d14a[_0xef6b('0x8e')]=_0xef6b('0x8f');logger['info'](_0xef6b('0x90'),_0x46d14a[_0xef6b('0x55')],_0x46d14a[_0xef6b('0x5c')]);}}}catch(_0x3991fa){logger[_0xef6b('0x49')](_0xef6b('0x8d'),_0x207fd7['uniqueid'],util['inspect'](_0x3991fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef6b('0xc')][_0xef6b('0x25')]=function(_0x11fae1){try{if(this['isNotNull'](_0x11fae1)){logger['debug'](_0xef6b('0x91'),_0x11fae1[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x11fae1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x11fae1[_0xef6b('0x53')]]){var _0x1994f4=_[_0xef6b('0x82')](this['queueReports'][_0x11fae1['uniqueid']]);_0x1994f4['queuecallerabandon']=![];_0x1994f4[_0xef6b('0x85')]=null;_0x1994f4[_0xef6b('0x92')]=!![];_0x1994f4[_0xef6b('0x86')]=_0x11fae1[_0xef6b('0x93')];_0x1994f4[_0xef6b('0x83')]=_0x11fae1[_0xef6b('0x83')];_0x1994f4[_0xef6b('0x3d')]=!![];_0x1994f4[_0xef6b('0x3b')]=![];_0x1994f4['queuecallerexitAt']=null;if(!_0x1994f4[_0xef6b('0x94')]){if(_0x11fae1[_0xef6b('0x95')]=='transfer'){_0x1994f4[_0xef6b('0x8e')]=_0xef6b('0x96');logger[_0xef6b('0x7d')](_0xef6b('0x97'),_0x1994f4[_0xef6b('0x55')],_0x1994f4[_0xef6b('0x5c')]);}else{if(_[_0xef6b('0x98')](_0x11fae1['channel'][_0xef6b('0x99')](),_0xef6b('0x9a'))){if(this[_0xef6b('0x11')][_0x11fae1[_0xef6b('0x9b')]]){var _0x1d0dad=_[_0xef6b('0x82')](this[_0xef6b('0x11')][_0x11fae1[_0xef6b('0x9b')]]);_0x1d0dad[_0xef6b('0x3d')]=![];_0x1d0dad[_0xef6b('0x3b')]=!![];_0x1d0dad['queuecallerexitAt']=moment(_0x1994f4['queuecallerjoinAt'])[_0xef6b('0x9c')](_0x11fae1['holdtime'],_0xef6b('0x9d'))[_0xef6b('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d0dad[_0xef6b('0x8e')]=_0xef6b('0x9e');_0x1d0dad[_0xef6b('0x94')]=!![];_0x1d0dad[_0xef6b('0x9f')]=_0xef6b('0xa0');_0x1d0dad[_0xef6b('0xa1')]=_0x11fae1['destexten'];_0x1d0dad['transferuniqueid']=_0x11fae1[_0xef6b('0x53')];logger[_0xef6b('0x7d')](_0xef6b('0xa2'),_0x1d0dad[_0xef6b('0x55')],_0x1d0dad[_0xef6b('0x5c')]);var _0x3282fa=this['queueReports'][_0x11fae1[_0xef6b('0x9b')]];this[_0xef6b('0x11')][_0x11fae1[_0xef6b('0x9b')]]=this['queueReports'][_0x11fae1[_0xef6b('0x53')]];this[_0xef6b('0x11')][_0x11fae1[_0xef6b('0x53')]]=_0x3282fa;}}else{_0x1994f4['queuecallerexitreason']=_0xef6b('0xa3')+_0x11fae1[_0xef6b('0x95')][_0xef6b('0xa4')]();logger[_0xef6b('0x7d')](_0xef6b('0xa5'),_0x1994f4['queue'],_0x1994f4[_0xef6b('0x5c')],_0x1994f4['queuecallerexitreason']);}}}this[_0xef6b('0x3f')][_0x11fae1[_0xef6b('0x53')]]=_0x1994f4;}}}catch(_0x40803e){logger['error'](_0xef6b('0x91'),_0x11fae1[_0xef6b('0x53')],util['inspect'](_0x40803e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef6b('0xc')][_0xef6b('0xa6')]=function(_0x563c6c){try{if(this[_0xef6b('0x60')](_0x563c6c)){logger[_0xef6b('0x58')](_0xef6b('0xa7'),_0x563c6c[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x563c6c,{'showHidden':![],'depth':null}));this[_0xef6b('0xa8')](_0x563c6c[_0xef6b('0x53')],_[_0xef6b('0x80')](_0x563c6c[_0xef6b('0xa9')])[0x0],_0x563c6c[_0xef6b('0xaa')]);if(this['queueReports'][_0x563c6c[_0xef6b('0x53')]]){var _0x3de3a1=_[_0xef6b('0x82')](this[_0xef6b('0x11')][_0x563c6c[_0xef6b('0x53')]]);if(_0x3de3a1){if(this['isNotNull'](_0x563c6c[_0xef6b('0xa9')])&&this['isNotNull'](_0x563c6c['variable'][_0xef6b('0x6c')])){switch(_0x563c6c[_0xef6b('0xaa')]){case'CONTINUE':_0x3de3a1[_0xef6b('0x3b')]=![];_0x3de3a1[_0xef6b('0xab')]=null;break;case _0xef6b('0xac'):_0x3de3a1['lastevent']='timeout';_0x3de3a1['queuecallerexit']=!![];_0x3de3a1[_0xef6b('0xab')]=moment()[_0xef6b('0x59')](_0xef6b('0x79'));_0x3de3a1[_0xef6b('0x89')]=moment()[_0xef6b('0x59')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xef6b('0xad'),_0x563c6c[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x3de3a1,{'showHidden':![],'depth':null}));ami[_0xef6b('0x4f')](_0xef6b('0xae'),_0x3de3a1);break;default:_0x3de3a1[_0xef6b('0x3b')]=!![];_0x3de3a1[_0xef6b('0xab')]=moment()[_0xef6b('0x59')](_0xef6b('0x79'));_0x3de3a1[_0xef6b('0x89')]=moment()[_0xef6b('0x59')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3de3a1['queuecallerabandon']=![];_0x3de3a1[_0xef6b('0x85')]=null;_0x3de3a1[_0xef6b('0x8e')]=_0x563c6c['value'];this['channels'][_0x563c6c[_0xef6b('0x53')]]=_0x3de3a1;this[_0xef6b('0x4d')](_0x3de3a1,_0xef6b('0x28'));}else if(this['isNotNull'](_0x563c6c[_0xef6b('0xa9')])&&this['isNotNull'](_0x563c6c[_0xef6b('0xa9')][_0xef6b('0xaf')])){if(!_0x3de3a1[_0xef6b('0x3c')]){_0x3de3a1[_0xef6b('0x3b')]=!![];_0x3de3a1[_0xef6b('0xab')]=moment()[_0xef6b('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x3de3a1[_0xef6b('0x8e')]=_0xef6b('0xb0');_0x3de3a1[_0xef6b('0x89')]=moment()['format'](_0xef6b('0x79'));this['channels'][_0x563c6c[_0xef6b('0x53')]]=_0x3de3a1;}}logger[_0xef6b('0x7d')](_0xef6b('0xb1'),_0x563c6c[_0xef6b('0x53')],_0x3de3a1[_0xef6b('0x55')],_0x3de3a1[_0xef6b('0x5c')],_['keys'](_0x563c6c['variable'])[0x0],_0x563c6c['value']);_0x3de3a1[_0xef6b('0x17')]=this['variables'][_0x563c6c[_0xef6b('0x53')]];}}}}catch(_0x1f61e9){logger[_0xef6b('0x49')](_0xef6b('0xa7'),_0x563c6c[_0xef6b('0x53')],util[_0xef6b('0x48')](_0x1f61e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef6b('0xc')][_0xef6b('0xa8')]=function(_0x5d37aa,_0x3ab917,_0x31bfd6){var _0x4c5d10=['rtpaudioqos',_0xef6b('0xb2'),_0xef6b('0xb3'),_0xef6b('0xb4'),'rtpaudioqosloss',_0xef6b('0xb5'),_0xef6b('0xb6'),_0xef6b('0xb7'),_0xef6b('0xb8'),_0xef6b('0xb9'),_0xef6b('0xba'),_0xef6b('0xbb'),_0xef6b('0xbc'),_0xef6b('0xbd'),'memberinterface',_0xef6b('0xbe'),_0xef6b('0x93'),_0xef6b('0xbf'),'memberrealtime'];if(!_[_0xef6b('0x41')](_0x3ab917)&&!_[_0xef6b('0xc0')](_0x4c5d10,_0x3ab917)){if(_['isUndefined'](this['variables'][_0x5d37aa])){this[_0xef6b('0x17')][_0x5d37aa]={};}this[_0xef6b('0x17')][_0x5d37aa][_0x3ab917]=_0x31bfd6;}};VoiceQueueReport[_0xef6b('0xc')]['handleHangup']=function(_0x1b53c4,_0xc210d,_0x23177c){try{var _0x9a58e3={};if(this['queueReports'][_0x1b53c4]){for(var _0x240adc=0x0;_0x240adc0x0?!![]:![];if(!_0x1d9ad9){return this[_0xbf56('0x70')](this[_0xbf56('0x16')]['completeEvent']);}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x1b')]=function(_0x177190){var _0x14a9c2=this[_0xbf56('0x16')]['id'];if(this[_0xbf56('0x16')][_0xbf56('0x66')][_0x14a9c2]&&this['summary'][_0xbf56('0x66')][_0x14a9c2][_0x177190[_0xbf56('0x65')]]){this[_0xbf56('0x16')][_0xbf56('0x66')][_0x14a9c2][_0x177190['actionid']]['agents'][_0xbf56('0x71')](_0x177190);}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x18')]=function(_0x22a24b){var _0x2eb0c6=this;try{if(this[_0xbf56('0x5e')](_0x22a24b)&&this['isNotNull'](_0x22a24b[_0xbf56('0x50')])){logger[_0xbf56('0x52')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x22a24b,{'showHidden':![],'depth':null}));var _0x596f03=this[_0xbf56('0x14')][_0x22a24b[_0xbf56('0x50')]];if(_0x596f03){logger[_0xbf56('0x52')](_0xbf56('0x72'),_0x596f03[_0xbf56('0x5d')]);this['summary']['queues'][_0x596f03['name']]={'summaryEvent':_0x22a24b};this[_0xbf56('0x16')][_0xbf56('0x6f')]+=0x1;return ami['Action']({'action':_0xbf56('0x66'),'queue':_0x596f03[_0xbf56('0x5d')]})[_0xbf56('0x64')](function(_0x2054ed){if(!_0x2eb0c6[_0xbf56('0x16')][_0xbf56('0x66')][_0x22a24b['actionid']]){_0x2eb0c6[_0xbf56('0x16')][_0xbf56('0x66')][_0x22a24b['actionid']]={};}_0x2eb0c6['summary'][_0xbf56('0x66')][_0x22a24b[_0xbf56('0x65')]][_0x2054ed[_0xbf56('0x65')]]={'queue':_0x596f03[_0xbf56('0x5d')],'agents':[]};})[_0xbf56('0x43')](function(_0x5d2303){throw _0x5d2303;});}}}catch(_0x4be757){logger['error'](_0xbf56('0x67'),util[_0xbf56('0x48')](_0x4be757,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')]['syncQueueSummaryComplete']=function(_0x573509){if(this['summary'][_0xbf56('0x6f')]>0x0){this[_0xbf56('0x16')]['completeEvent']=_0x573509;return;}logger['debug'](_0xbf56('0x73'),util[_0xbf56('0x48')](_0x573509,{'showHidden':![],'depth':null}));this[_0xbf56('0x16')]=initializeSummary();ami[_0xbf56('0x4d')](_0xbf56('0x74'),{});};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x1e')]=function(_0x259ecc){try{if(this['isNotNull'](_0x259ecc)){logger['debug'](_0xbf56('0x75'),_0x259ecc[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x259ecc,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xbf56('0x10')][_0x259ecc['uniqueid']])){this[_0xbf56('0x10')][_0x259ecc['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x259ecc[_0xbf56('0x54')]])){this[_0xbf56('0x3d')][_0x259ecc[_0xbf56('0x54')]]={};}var _0x34a256=new QueueReport();_0x34a256[_0xbf56('0x50')]=_0x259ecc['queue'];_0x34a256[_0xbf56('0x5a')]=this[_0xbf56('0x14')][_0x34a256[_0xbf56('0x50')]]&&this['voiceQueues'][_0x34a256[_0xbf56('0x50')]][_0xbf56('0x5a')]?this[_0xbf56('0x14')][_0x34a256[_0xbf56('0x50')]][_0xbf56('0x5a')]||'inbound':_0xbf56('0x5b');_0x34a256[_0xbf56('0x76')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x34a256[_0xbf56('0x78')]=_0x259ecc[_0xbf56('0x78')];_0x34a256[_0xbf56('0x79')]=_0x259ecc['count'];_0x34a256[_0xbf56('0x54')]=_0x259ecc[_0xbf56('0x54')];_0x34a256[_0xbf56('0x7a')]=this[_0xbf56('0x3d')][_0x259ecc['uniqueid']][_0xbf56('0x7a')];logger[_0xbf56('0x7b')](_0xbf56('0x7c'),_0x34a256[_0xbf56('0x50')],_0x34a256[_0xbf56('0x5a')]);Object[_0xbf56('0x7d')](_0x34a256,_[_0xbf56('0x7e')](_0x259ecc,_[_0xbf56('0x7f')](_0x34a256)));this[_0xbf56('0x10')][_0x259ecc[_0xbf56('0x54')]][_0xbf56('0x71')](_0x34a256);this[_0xbf56('0x3d')][_0x259ecc[_0xbf56('0x54')]]=_0x34a256;this[_0xbf56('0x80')](_0x34a256,_0xbf56('0x81'));}}catch(_0x11da09){logger[_0xbf56('0x46')](_0xbf56('0x75'),_0x259ecc[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x11da09,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x20')]=function(_0x128ec7){try{if(this[_0xbf56('0x5e')](_0x128ec7)){logger[_0xbf56('0x52')](_0xbf56('0x82'),_0x128ec7[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x128ec7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x128ec7[_0xbf56('0x54')]]){var _0x1c0e7a=_[_0xbf56('0x83')](this[_0xbf56('0x10')][_0x128ec7['uniqueid']]);_0x1c0e7a[_0xbf56('0x3c')]=![];_0x1c0e7a[_0xbf56('0x84')]=null;_0x1c0e7a[_0xbf56('0x85')]=_0x128ec7[_0xbf56('0x85')];_0x1c0e7a['originalposition']=_0x128ec7[_0xbf56('0x86')];_0x1c0e7a[_0xbf56('0x1f')]=!![];_0x1c0e7a[_0xbf56('0x87')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x1c0e7a[_0xbf56('0x55')]=_0xbf56('0x88');_0x1c0e7a[_0xbf56('0x89')]=null;logger[_0xbf56('0x7b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1c0e7a['queue'],_0x1c0e7a[_0xbf56('0x5a')]);this[_0xbf56('0x3d')][_0x128ec7[_0xbf56('0x54')]]=_0x1c0e7a;this[_0xbf56('0x4c')](_0x1c0e7a,'queuecallerabandon');}}}catch(_0x502767){logger['error'](_0xbf56('0x82'),_0x128ec7[_0xbf56('0x54')],util['inspect'](_0x502767,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')]['syncQueueCallerLeave']=function(_0xc4db0f){try{if(this[_0xbf56('0x5e')](_0xc4db0f)){logger[_0xbf56('0x52')]('[%s][voiceQueueReport][queuecallerleave]',_0xc4db0f['uniqueid'],util[_0xbf56('0x48')](_0xc4db0f,{'showHidden':![],'depth':null}));if(this[_0xbf56('0x10')][_0xc4db0f[_0xbf56('0x54')]]){var _0x2e4b10=_[_0xbf56('0x83')](this[_0xbf56('0x10')][_0xc4db0f[_0xbf56('0x54')]]);_0x2e4b10[_0xbf56('0x8a')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x2e4b10['connectedlinenum']=_0xc4db0f['connectedlinenum'];_0x2e4b10[_0xbf56('0x8b')]=_0xc4db0f['connectedlinename'];logger[_0xbf56('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2e4b10[_0xbf56('0x50')],_0x2e4b10[_0xbf56('0x5a')],_0xc4db0f[_0xbf56('0x8c')],_0xc4db0f[_0xbf56('0x8b')]);this[_0xbf56('0x3d')][_0xc4db0f[_0xbf56('0x54')]]=_0x2e4b10;this[_0xbf56('0x80')](_0x2e4b10,_0xbf56('0x21'));}}}catch(_0x3399c5){logger['error'](_0xbf56('0x8d'),_0xc4db0f[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x3399c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbf56('0x25')]=function(_0x5b0c08){try{if(this[_0xbf56('0x5e')](_0x5b0c08)){logger[_0xbf56('0x52')](_0xbf56('0x8e'),_0x5b0c08[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x5b0c08,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5b0c08['uniqueid']]){var _0x5d9f14=_[_0xbf56('0x83')](this['queueReports'][_0x5b0c08[_0xbf56('0x54')]]);_0x5d9f14[_0xbf56('0x3c')]=!![];_0x5d9f14['queuecallerexitreason']=_0xbf56('0x8f');logger[_0xbf56('0x7b')](_0xbf56('0x90'),_0x5d9f14['queue'],_0x5d9f14[_0xbf56('0x5a')]);}}}catch(_0x4316c8){logger[_0xbf56('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x5b0c08['uniqueid'],util[_0xbf56('0x48')](_0x4316c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x23')]=function(_0x2cd8d0){try{if(this[_0xbf56('0x5e')](_0x2cd8d0)){logger[_0xbf56('0x52')](_0xbf56('0x91'),_0x2cd8d0[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x2cd8d0,{'showHidden':![],'depth':null}));if(this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x54')]]){var _0x33f082=_['last'](this['queueReports'][_0x2cd8d0[_0xbf56('0x54')]]);_0x33f082[_0xbf56('0x1f')]=![];_0x33f082[_0xbf56('0x87')]=null;_0x33f082[_0xbf56('0x92')]=!![];_0x33f082[_0xbf56('0x89')]=_0x2cd8d0['membername'];_0x33f082['holdtime']=_0x2cd8d0[_0xbf56('0x85')];_0x33f082[_0xbf56('0x3c')]=!![];_0x33f082[_0xbf56('0x3b')]=![];_0x33f082[_0xbf56('0x93')]=null;if(!_0x33f082[_0xbf56('0x94')]){if(_0x2cd8d0[_0xbf56('0x95')]==_0xbf56('0x94')){_0x33f082[_0xbf56('0x55')]=_0xbf56('0x96');logger[_0xbf56('0x7b')](_0xbf56('0x97'),_0x33f082[_0xbf56('0x50')],_0x33f082[_0xbf56('0x5a')]);}else{if(_[_0xbf56('0x98')](_0x2cd8d0[_0xbf56('0x42')][_0xbf56('0x99')](),'local/')){if(this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x9a')]]){var _0x38fc2c=_[_0xbf56('0x83')](this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x9a')]]);_0x38fc2c[_0xbf56('0x3c')]=![];_0x38fc2c['queuecallerexit']=!![];_0x38fc2c['queuecallerexitAt']=moment(_0x33f082[_0xbf56('0x76')])[_0xbf56('0x9b')](_0x2cd8d0[_0xbf56('0x85')],'seconds')[_0xbf56('0x57')](_0xbf56('0x77'));_0x38fc2c['queuecallerexitreason']='FORWARDTRANSFER';_0x38fc2c['transfer']=!![];_0x38fc2c[_0xbf56('0x9c')]=_0xbf56('0x9d');_0x38fc2c[_0xbf56('0x9e')]=_0x2cd8d0[_0xbf56('0x9f')];_0x38fc2c[_0xbf56('0xa0')]=_0x2cd8d0[_0xbf56('0x54')];logger[_0xbf56('0x7b')](_0xbf56('0xa1'),_0x38fc2c['queue'],_0x38fc2c[_0xbf56('0x5a')]);var _0x559765=this['queueReports'][_0x2cd8d0[_0xbf56('0x9a')]];this[_0xbf56('0x10')][_0x2cd8d0['linkedid']]=this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x54')]];this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x54')]]=_0x559765;}}else{_0x33f082['queuecallerexitreason']=_0xbf56('0xa2')+_0x2cd8d0[_0xbf56('0x95')][_0xbf56('0xa3')]();logger[_0xbf56('0x7b')](_0xbf56('0xa4'),_0x33f082['queue'],_0x33f082['type'],_0x33f082[_0xbf56('0x55')]);}}}this['channels'][_0x2cd8d0[_0xbf56('0x54')]]=_0x33f082;}}}catch(_0x4e9d02){logger[_0xbf56('0x46')](_0xbf56('0x91'),_0x2cd8d0[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x4e9d02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x27')]=function(_0x341864){try{if(this[_0xbf56('0x5e')](_0x341864)){logger[_0xbf56('0x52')](_0xbf56('0xa5'),_0x341864[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x341864,{'showHidden':![],'depth':null}));this['addVariable'](_0x341864['uniqueid'],_[_0xbf56('0x7f')](_0x341864[_0xbf56('0xa6')])[0x0],_0x341864[_0xbf56('0xa7')]);if(this['queueReports'][_0x341864[_0xbf56('0x54')]]){var _0x1aef37=_['last'](this[_0xbf56('0x10')][_0x341864[_0xbf56('0x54')]]);if(_0x1aef37){if(this['isNotNull'](_0x341864[_0xbf56('0xa6')])&&this[_0xbf56('0x5e')](_0x341864[_0xbf56('0xa6')][_0xbf56('0x66')])){switch(_0x341864[_0xbf56('0xa7')]){case'CONTINUE':_0x1aef37['queuecallerexit']=![];_0x1aef37[_0xbf56('0x93')]=null;break;case'TIMEOUT':_0x1aef37[_0xbf56('0xa8')]=_0xbf56('0xa9');_0x1aef37['queuecallerexit']=!![];_0x1aef37[_0xbf56('0x93')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x1aef37[_0xbf56('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xbf56('0x52')](_0xbf56('0xaa'),_0x341864[_0xbf56('0x54')],util['inspect'](_0x1aef37,{'showHidden':![],'depth':null}));ami['emit'](_0xbf56('0xab'),_0x1aef37);break;default:_0x1aef37[_0xbf56('0x3b')]=!![];_0x1aef37['queuecallerexitAt']=moment()['format'](_0xbf56('0x77'));_0x1aef37[_0xbf56('0x8a')]=moment()['format'](_0xbf56('0x77'));}_0x1aef37[_0xbf56('0x1f')]=![];_0x1aef37['queuecallerabandonAt']=null;_0x1aef37[_0xbf56('0x55')]=_0x341864[_0xbf56('0xa7')];this[_0xbf56('0x3d')][_0x341864[_0xbf56('0x54')]]=_0x1aef37;this[_0xbf56('0x4c')](_0x1aef37,_0xbf56('0x26'));}else if(this[_0xbf56('0x5e')](_0x341864[_0xbf56('0xa6')])&&this[_0xbf56('0x5e')](_0x341864[_0xbf56('0xa6')]['queueposition'])){if(!_0x1aef37['queuecallerabandon']){_0x1aef37[_0xbf56('0x3b')]=!![];_0x1aef37[_0xbf56('0x93')]=moment()['format'](_0xbf56('0x77'));_0x1aef37[_0xbf56('0x55')]=_0xbf56('0xac');_0x1aef37[_0xbf56('0x8a')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));this['channels'][_0x341864['uniqueid']]=_0x1aef37;}}logger[_0xbf56('0x7b')](_0xbf56('0xad'),_0x341864['uniqueid'],_0x1aef37['queue'],_0x1aef37[_0xbf56('0x5a')],_[_0xbf56('0x7f')](_0x341864['variable'])[0x0],_0x341864[_0xbf56('0xa7')]);_0x1aef37[_0xbf56('0x17')]=this[_0xbf56('0x17')][_0x341864[_0xbf56('0x54')]];}}}}catch(_0x16afef){logger[_0xbf56('0x46')]('[%s][voiceQueueReport][varset]',_0x341864[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x16afef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbf56('0xae')]=function(_0x386454,_0x47f1f4,_0x410555){var _0x16a780=[_0xbf56('0xaf'),_0xbf56('0xb0'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xbf56('0xb1'),_0xbf56('0xb2'),'rtpaudioqosrtt',_0xbf56('0xb3'),_0xbf56('0xb4'),_0xbf56('0xb5'),_0xbf56('0xb6'),_0xbf56('0xb7'),_0xbf56('0xb8'),_0xbf56('0xb9'),'memberinterface',_0xbf56('0xba'),_0xbf56('0xbb'),_0xbf56('0xbc'),_0xbf56('0xbd')];if(!_[_0xbf56('0x3f')](_0x47f1f4)&&!_['includes'](_0x16a780,_0x47f1f4)){if(_[_0xbf56('0x5f')](this[_0xbf56('0x17')][_0x386454])){this[_0xbf56('0x17')][_0x386454]={};}this[_0xbf56('0x17')][_0x386454][_0x47f1f4]=_0x410555;}};VoiceQueueReport[_0xbf56('0xc')]['handleHangup']=function(_0x381a39,_0x193d8e,_0x4dd6cb){try{var _0x416a13={};if(this[_0xbf56('0x10')][_0x381a39]){for(var _0x4ba7ed=0x0;_0x4ba7ed=0x0?moment(_0x5240e0['endtime'])[_0xede1('0x1b')](_0x5240e0[_0xede1('0x19')],_0xede1('0x11')):null,'data1':_0xede1('0x1c'),'data2':_0x5240e0['accountcode'],'data3':_0x5240e0[_0xede1('0x1d')],'data4':_0x5240e0[_0xede1('0x1e')]||null,'role':'agent','internal':_0x5240e0[_0xede1('0x15')]?_['toNumber'](_0x5240e0[_0xede1('0x15')]):undefined,'uniqueid':_0x5240e0[_0xede1('0x1f')]},'log':_0xede1('0x8')});}; \ No newline at end of file +var _0xdf42=['util','../client','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','voiceDialReport','membername','starttime','endtime','outbound','accountcode','exten','agent','uniqueid','moment','lodash'];(function(_0x33733a,_0x4d2177){var _0x523618=function(_0x13b801){while(--_0x13b801){_0x33733a['push'](_0x33733a['shift']());}};_0x523618(++_0x4d2177);}(_0xdf42,0xc2));var _0x2df4=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xdf42[_0x7e2eb0];return _0xd92de4;};'use strict';var moment=require(_0x2df4('0x0'));var _=require(_0x2df4('0x1'));var util=require(_0x2df4('0x2'));var client=require(_0x2df4('0x3'));exports['voiceQueueReport']=function(_0x152183){var _0x419130=_0x152183[_0x2df4('0x4')]||_0x152183[_0x2df4('0x5')];return client['Request'](_0x2df4('0x6'),{'body':{'channel':_0x2df4('0x7'),'membername':_0x152183[_0x2df4('0x8')],'interface':_[_0x2df4('0x9')](_0x152183[_0x2df4('0xa')])?util['format'](_0x2df4('0xb'),_0x152183[_0x2df4('0x8')]):_0x152183[_0x2df4('0xa')],'type':_0x2df4('0xc'),'enterAt':_0x152183[_0x2df4('0xd')],'exitAt':_0x419130,'duration':moment(_0x419130)[_0x2df4('0xe')](_0x152183[_0x2df4('0xd')],_0x2df4('0xf')),'data1':_0x2df4('0x10'),'data2':_0x152183[_0x2df4('0x11')],'data3':_0x152183['exten'],'data4':null,'data5':_0x152183[_0x2df4('0x12')],'role':'agent','internal':_0x152183['accountcode']?_['toNumber'](_0x152183['accountcode']):undefined,'uniqueid':_0x152183['uniqueid']},'log':_0x2df4('0x6')});};exports[_0x2df4('0x13')]=function(_0x54ba7e){return client['Request'](_0x2df4('0x6'),{'body':{'channel':_0x2df4('0x7'),'membername':_0x54ba7e[_0x2df4('0x14')],'interface':_0x54ba7e['interface'],'type':'TALKING','enterAt':_0x54ba7e[_0x2df4('0x15')],'exitAt':_0x54ba7e[_0x2df4('0x16')],'duration':moment(_0x54ba7e['endtime'])[_0x2df4('0xe')](_0x54ba7e[_0x2df4('0x15')],_0x2df4('0xf'))>=0x0?moment(_0x54ba7e[_0x2df4('0x16')])[_0x2df4('0xe')](_0x54ba7e[_0x2df4('0x15')],_0x2df4('0xf')):null,'data1':_0x2df4('0x17'),'data2':_0x54ba7e[_0x2df4('0x18')],'data3':_0x54ba7e[_0x2df4('0x19')],'data4':_0x54ba7e['dialstring']||null,'role':_0x2df4('0x1a'),'internal':_0x54ba7e['accountcode']?_['toNumber'](_0x54ba7e[_0x2df4('0x18')]):undefined,'uniqueid':_0x54ba7e[_0x2df4('0x1b')]},'log':_0x2df4('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c1e4f92..75bc979 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 _0x282b=['stopRecordingOnTransfer','../client','getSettings','Request','ShowSetting'];(function(_0x2814c2,_0x50eff0){var _0x557619=function(_0x3f61bc){while(--_0x3f61bc){_0x2814c2['push'](_0x2814c2['shift']());}};_0x557619(++_0x50eff0);}(_0x282b,0xec));var _0xb282=function(_0x366d18,_0x23dfb5){_0x366d18=_0x366d18-0x0;var _0x161bd5=_0x282b[_0x366d18];return _0x161bd5;};'use strict';var client=require(_0xb282('0x0'));exports[_0xb282('0x1')]=function(){return client[_0xb282('0x2')](_0xb282('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb282('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x09dd=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0x4d89fd,_0x411fe1){_0x4d89fd=_0x4d89fd-0x0;var _0x3262a6=_0x09dd[_0x4d89fd];return _0x3262a6;};'use strict';var client=require(_0xd09d('0x0'));exports[_0xd09d('0x1')]=function(){return client[_0xd09d('0x2')](_0xd09d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd09d('0x4'),_0xd09d('0x5')]},'log':_0xd09d('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2b37802..b757439 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 _0x887a=['html','getTemplates','GetTemplate','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x887a,0x185));var _0xa887=function(_0x10002f,_0x14a8f0){_0x10002f=_0x10002f-0x0;var _0x257a15=_0x887a[_0x10002f];return _0x257a15;};'use strict';var client=require('../client');exports[_0xa887('0x0')]=function(_0xdfa3ac){return function(_0x424796){return client['Request'](_0xa887('0x1'),{'options':{'raw':!![],'attributes':['id',_0xa887('0x2'),_0xa887('0x3')]},'log':_0xa887('0x1')});};}; \ No newline at end of file +var _0x9a0c=['Request','GetTemplate','name','html','getTemplates'];(function(_0x17a70b,_0x3c8c57){var _0x4fa8c1=function(_0x462cac){while(--_0x462cac){_0x17a70b['push'](_0x17a70b['shift']());}};_0x4fa8c1(++_0x3c8c57);}(_0x9a0c,0x8b));var _0xc9a0=function(_0x1fb9d0,_0xfb88ee){_0x1fb9d0=_0x1fb9d0-0x0;var _0x190ae8=_0x9a0c[_0x1fb9d0];return _0x190ae8;};'use strict';var client=require('../client');exports[_0xc9a0('0x0')]=function(_0x135031){return function(_0x2a2506){return client[_0xc9a0('0x1')](_0xc9a0('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc9a0('0x3'),_0xc9a0('0x4')]},'log':_0xc9a0('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 9f1ff24..4411f7b 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 _0x01c9=['data3','data4','data6','data7','../client','Request','GetTrigger','channel','status','Condition','field','operator','value','Action','action','data1','data2'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x01c9,0x1ad));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x901c('0x0'));exports['getTriggers']=function(_0x433d5c){return function(_0x19fb41){return client[_0x901c('0x1')](_0x901c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x901c('0x3'),_0x901c('0x4')],'include':[{'model':_0x901c('0x5'),'as':'AllConditions','attributes':['id',_0x901c('0x6'),_0x901c('0x7'),'value']},{'model':_0x901c('0x5'),'as':'AnyConditions','attributes':['id','field',_0x901c('0x7'),_0x901c('0x8')]},{'model':_0x901c('0x9'),'as':'Actions','attributes':['id',_0x901c('0xa'),_0x901c('0xb'),_0x901c('0xc'),_0x901c('0xd'),_0x901c('0xe'),'data5',_0x901c('0xf'),_0x901c('0x10')]}]},'log':_0x901c('0x2')});};}; \ No newline at end of file +var _0x3e23=['name','channel','Condition','AllConditions','operator','value','Action','action','data2','data4','data5','../client','getTriggers','Request','GetTrigger'];(function(_0x3143d4,_0x505178){var _0x16c876=function(_0x4faf01){while(--_0x4faf01){_0x3143d4['push'](_0x3143d4['shift']());}};_0x16c876(++_0x505178);}(_0x3e23,0x92));var _0x33e2=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3e23[_0x3b0731];return _0x4204d7;};'use strict';var client=require(_0x33e2('0x0'));exports[_0x33e2('0x1')]=function(_0x2b452e){return function(_0x268021){return client[_0x33e2('0x2')](_0x33e2('0x3'),{'options':{'raw':![],'attributes':['id',_0x33e2('0x4'),_0x33e2('0x5'),'status'],'include':[{'model':_0x33e2('0x6'),'as':_0x33e2('0x7'),'attributes':['id','field',_0x33e2('0x8'),_0x33e2('0x9')]},{'model':_0x33e2('0x6'),'as':'AnyConditions','attributes':['id','field',_0x33e2('0x8'),'value']},{'model':_0x33e2('0xa'),'as':'Actions','attributes':['id',_0x33e2('0xb'),'data1',_0x33e2('0xc'),'data3',_0x33e2('0xd'),_0x33e2('0xe'),'data6','data7']}]},'log':_0x33e2('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8f75689..fe8368d 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 _0xe638=['GetTrunk','name','../client','getTrunks'];(function(_0x1231cd,_0x2bcbc1){var _0x6998d6=function(_0x1cb09e){while(--_0x1cb09e){_0x1231cd['push'](_0x1231cd['shift']());}};_0x6998d6(++_0x2bcbc1);}(_0xe638,0x92));var _0x8e63=function(_0x8a495,_0x3e6cd8){_0x8a495=_0x8a495-0x0;var _0x360cba=_0xe638[_0x8a495];return _0x360cba;};'use strict';var client=require(_0x8e63('0x0'));exports[_0x8e63('0x1')]=function(_0x53d8bb){return function(_0x7c777d){return client['Request'](_0x8e63('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8e63('0x3'),'registry','defaultuser']},'log':_0x8e63('0x2')});};}; \ No newline at end of file +var _0x0389=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x0389,0x175));var _0x9038=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x0389[_0x62c958];return _0x57ec61;};'use strict';var client=require(_0x9038('0x0'));exports['getTrunks']=function(_0xec2f5a){return function(_0x1479bf){return client[_0x9038('0x1')](_0x9038('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9038('0x3'),_0x9038('0x4'),_0x9038('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e279ba0..df36814 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x35810d,_0x101866){var _0x42489d=function(_0x492089){while(--_0x492089){_0x35810d['push'](_0x35810d['shift']());}};_0x42489d(++_0x101866);}(_0x70e0,0x17b));var _0x070e=function(_0x2a6ebc,_0x44324f){_0x2a6ebc=_0x2a6ebc-0x0;var _0x3a7d56=_0x70e0[_0x2a6ebc];return _0x3a7d56;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index de4b8ce..1e3b75d 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 _0x76fe=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x45f422,_0x10b29c){var _0x4346be=function(_0x5c2700){while(--_0x5c2700){_0x45f422['push'](_0x45f422['shift']());}};_0x4346be(++_0x10b29c);}(_0x76fe,0x1c8));var _0xe76f=function(_0xb1937e,_0x330b2f){_0xb1937e=_0xb1937e-0x0;var _0x44474f=_0x76fe[_0xb1937e];return _0x44474f;};'use strict';var client=require(_0xe76f('0x0'));exports['create']=function(_0x575201){return client[_0xe76f('0x1')](_0xe76f('0x2'),{'body':_0x575201,'log':_0xe76f('0x2')});};exports[_0xe76f('0x3')]=function(_0x388444,_0x5ec837,_0x10f231){return client[_0xe76f('0x1')](_0xe76f('0x4'),{'body':_0x388444,'options':{'where':{'uniqueid':_0x5ec837,'interface':_0x10f231,'agentcomplete':!![]}},'log':_0xe76f('0x4')});}; \ No newline at end of file +var _0x26d4=['Request','UpdateVoiceAgentReport','../client','create'];(function(_0x52e23a,_0xb9af55){var _0x57b177=function(_0x592f81){while(--_0x592f81){_0x52e23a['push'](_0x52e23a['shift']());}};_0x57b177(++_0xb9af55);}(_0x26d4,0x172));var _0x426d=function(_0x40017b,_0x29ae62){_0x40017b=_0x40017b-0x0;var _0x41d9fa=_0x26d4[_0x40017b];return _0x41d9fa;};'use strict';var client=require(_0x426d('0x0'));exports[_0x426d('0x1')]=function(_0x3b6a96){return client['Request']('CreateVoiceAgentReport',{'body':_0x3b6a96,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5cf925,_0x321638,_0x4d9379){return client[_0x426d('0x2')]('UpdateVoiceAgentReport',{'body':_0x5cf925,'options':{'where':{'uniqueid':_0x321638,'interface':_0x4d9379,'agentcomplete':!![]}},'log':_0x426d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a070ebb..d83aa57 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 _0x91dd=['context','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x91dd,0x1af));var _0xd91d=function(_0x284bbb,_0x371c0a){_0x284bbb=_0x284bbb-0x0;var _0x3c06e2=_0x91dd[_0x284bbb];return _0x3c06e2;};'use strict';var moment=require(_0xd91d('0x0'));var util=require(_0xd91d('0x1'));var _=require(_0xd91d('0x2'));var client=require(_0xd91d('0x3'));exports[_0xd91d('0x4')]=function(_0x15c28b){return client['Request'](_0xd91d('0x5'),{'body':_['merge'](_0x15c28b,{'source':_0x15c28b['calleridnum'],'destinationcontext':_0x15c28b[_0xd91d('0x6')],'callerid':_0x15c28b['callerid'],'amaflags':_0xd91d('0x7')}),'log':_0xd91d('0x5')});};exports[_0xd91d('0x8')]=function(){return function(){return client[_0xd91d('0x9')](_0xd91d('0xa'),{'options':{'where':{'type':[_0xd91d('0xb')],'createdAt':{'$between':[moment()[_0xd91d('0xc')](_0xd91d('0xd'))[_0xd91d('0xe')](_0xd91d('0xf')),moment()['endOf'](_0xd91d('0xd'))[_0xd91d('0xe')](_0xd91d('0xf'))]}},'attributes':[_0xd91d('0x10'),'disposition',_0xd91d('0x11'),'billableseconds']},'log':_0xd91d('0x12')});};}; \ No newline at end of file +var _0x531e=['util','lodash','../client','create','Request','merge','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x531e,0x107));var _0xe531=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x531e[_0x4d1ee9];return _0x9a5456;};'use strict';var moment=require(_0xe531('0x0'));var util=require(_0xe531('0x1'));var _=require(_0xe531('0x2'));var client=require(_0xe531('0x3'));exports[_0xe531('0x4')]=function(_0x4038a9){return client[_0xe531('0x5')]('CreateVoiceCallReport',{'body':_[_0xe531('0x6')](_0x4038a9,{'source':_0x4038a9['calleridnum'],'destinationcontext':_0x4038a9[_0xe531('0x7')],'callerid':_0x4038a9[_0xe531('0x8')],'amaflags':_0xe531('0x9')}),'log':_0xe531('0xa')});};exports[_0xe531('0xb')]=function(){return function(){return client[_0xe531('0x5')](_0xe531('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xe531('0xd')]('day')[_0xe531('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xe531('0xf')](_0xe531('0x10'))['format'](_0xe531('0x11'))]}},'attributes':[_0xe531('0x12'),_0xe531('0x13'),_0xe531('0x14'),_0xe531('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a506a9a..c871d77 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 _0xd105=['../client','create','CreateVoiceDialReport'];(function(_0x3acec5,_0x2085af){var _0x3e7dab=function(_0x5efee9){while(--_0x5efee9){_0x3acec5['push'](_0x3acec5['shift']());}};_0x3e7dab(++_0x2085af);}(_0xd105,0xea));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5d10('0x0'));exports[_0x5d10('0x1')]=function(_0x4b351c){return client['Request'](_0x5d10('0x2'),{'body':_0x4b351c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x1dcd=['../client','create','Request','CreateVoiceDialReport'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x1dcd,0x1a8));var _0xd1dc=function(_0x4dd7bb,_0x409176){_0x4dd7bb=_0x4dd7bb-0x0;var _0xbc91e8=_0x1dcd[_0x4dd7bb];return _0xbc91e8;};'use strict';var client=require(_0xd1dc('0x0'));exports[_0xd1dc('0x1')]=function(_0x1badb8){return client[_0xd1dc('0x2')](_0xd1dc('0x3'),{'body':_0x1badb8,'log':_0xd1dc('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index de6179c..7de1693 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 _0x750a=['exten','recordingFormat','getVoiceExtensions'];(function(_0x234268,_0x4037a8){var _0x200605=function(_0x1d5063){while(--_0x1d5063){_0x234268['push'](_0x234268['shift']());}};_0x200605(++_0x4037a8);}(_0x750a,0x140));var _0xa750=function(_0x13c052,_0x25c434){_0x13c052=_0x13c052-0x0;var _0x11de4f=_0x750a[_0x13c052];return _0x11de4f;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xa750('0x0')});};}; \ No newline at end of file +var _0x7072=['exten','recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x1c676d,_0x4a62ea){var _0x287e93=function(_0x53b1b0){while(--_0x53b1b0){_0x1c676d['push'](_0x1c676d['shift']());}};_0x287e93(++_0x4a62ea);}(_0x7072,0x138));var _0x2707=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7072[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports[_0x2707('0x0')]=function(){return function(){return client[_0x2707('0x1')](_0x2707('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2707('0x3'),_0x2707('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a61a8c1..0ea78c6 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 _0x8779=['monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout'];(function(_0x2bc601,_0xfebf8d){var _0x2e3c35=function(_0x97d2ea){while(--_0x97d2ea){_0x2bc601['push'](_0x2bc601['shift']());}};_0x2e3c35(++_0xfebf8d);}(_0x8779,0x136));var _0x9877=function(_0x1abee4,_0x223428){_0x1abee4=_0x1abee4-0x0;var _0x3f0021=_0x8779[_0x1abee4];return _0x3f0021;};'use strict';var client=require('../client');exports[_0x9877('0x0')]=function(){return function(){return client[_0x9877('0x1')](_0x9877('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9877('0x3'),_0x9877('0x4'),'autopause',_0x9877('0x5'),_0x9877('0x6'),'dialActive','dialMethod',_0x9877('0x7'),_0x9877('0x8'),_0x9877('0x9'),_0x9877('0xa'),_0x9877('0xb'),'dialPredictiveInterval',_0x9877('0xc'),_0x9877('0xd'),_0x9877('0xe'),_0x9877('0xf'),_0x9877('0x10'),_0x9877('0x11'),'dialCongestionMaxRetry',_0x9877('0x12'),_0x9877('0x13'),_0x9877('0x14'),_0x9877('0x15'),'dialNoAnswerRetryFrequency',_0x9877('0x16'),'dialTimezone','dialGlobalInterval',_0x9877('0x17'),_0x9877('0x18'),_0x9877('0x19'),_0x9877('0x1a'),_0x9877('0x1b'),_0x9877('0x1c'),_0x9877('0x1d'),_0x9877('0x1e'),_0x9877('0x1f'),'dialAMDMaximumNumberOfWords',_0x9877('0x20'),_0x9877('0x21'),_0x9877('0x22'),'dialRecallMeTimeout',_0x9877('0x23'),'dialOrderByScheduledAt',_0x9877('0x24'),_0x9877('0x25'),_0x9877('0x26'),_0x9877('0x5'),_0x9877('0x27'),_0x9877('0x28'),_0x9877('0x29'),_0x9877('0x2a'),_0x9877('0x2b'),_0x9877('0x2c'),_0x9877('0x2d'),'dialAbandonedMaxRetry',_0x9877('0x2e'),_0x9877('0x2f'),'dialMachineRetryFrequency',_0x9877('0x30'),_0x9877('0x31'),_0x9877('0x32'),'dialPredictiveIntervalMaxThreshold',_0x9877('0x33'),_0x9877('0x34'),_0x9877('0x35')],'include':[{'model':_0x9877('0x36'),'as':_0x9877('0x36'),'attributes':['id',_0x9877('0x37'),_0x9877('0x38'),'active']},{'model':_0x9877('0x39'),'as':_0x9877('0x3a'),'attributes':['id','name']},{'model':'Trunk','as':_0x9877('0x3b'),'attributes':['id',_0x9877('0x37'),_0x9877('0x38'),_0x9877('0x3c')]},{'model':'Interval','as':_0x9877('0x3d'),'attributes':['id',_0x9877('0x37')],'include':[{'model':_0x9877('0x3d'),'as':'Intervals','attributes':['id',_0x9877('0x37'),_0x9877('0x3e')]}]}]},'log':_0x9877('0x0')});};}; \ No newline at end of file +var _0x8d4c=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x33aef8,_0x1b811b){var _0x22c7a6=function(_0x5cee76){while(--_0x5cee76){_0x33aef8['push'](_0x33aef8['shift']());}};_0x22c7a6(++_0x1b811b);}(_0x8d4c,0x173));var _0xc8d4=function(_0x31d707,_0x733c2b){_0x31d707=_0x31d707-0x0;var _0x3ff20d=_0x8d4c[_0x31d707];return _0x3ff20d;};'use strict';var client=require(_0xc8d4('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc8d4('0x1')](_0xc8d4('0x2'),{'options':{'raw':![],'attributes':['id',_0xc8d4('0x3'),'acw',_0xc8d4('0x4'),_0xc8d4('0x5'),_0xc8d4('0x6'),_0xc8d4('0x7'),_0xc8d4('0x8'),_0xc8d4('0x9'),_0xc8d4('0xa'),_0xc8d4('0xb'),_0xc8d4('0xc'),_0xc8d4('0xd'),'dialPredictiveOptimizationPercentage',_0xc8d4('0xe'),_0xc8d4('0xf'),'dialOriginateCallerIdNumber',_0xc8d4('0x10'),_0xc8d4('0x11'),_0xc8d4('0x12'),_0xc8d4('0x13'),_0xc8d4('0x14'),_0xc8d4('0x15'),_0xc8d4('0x16'),'dialBusyRetryFrequency',_0xc8d4('0x17'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xc8d4('0x18'),_0xc8d4('0x19'),_0xc8d4('0x1a'),_0xc8d4('0x1b'),_0xc8d4('0x1c'),'dialAMDInitialSilence',_0xc8d4('0x1d'),_0xc8d4('0x1e'),_0xc8d4('0x1f'),_0xc8d4('0x20'),'dialAMDBetweenWordsSilence',_0xc8d4('0x21'),'dialAMDSilenceThreshold',_0xc8d4('0x22'),_0xc8d4('0x23'),_0xc8d4('0x24'),_0xc8d4('0x25'),'dialOrderByScheduledAt',_0xc8d4('0x26'),_0xc8d4('0x27'),_0xc8d4('0x28'),'monitor_format','strategy',_0xc8d4('0x29'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0xc8d4('0x2a'),_0xc8d4('0x2b'),_0xc8d4('0x2c'),_0xc8d4('0x2d'),_0xc8d4('0x2e'),_0xc8d4('0x2f'),_0xc8d4('0x30'),_0xc8d4('0x31'),_0xc8d4('0x32'),_0xc8d4('0x33'),_0xc8d4('0x34'),_0xc8d4('0x35'),_0xc8d4('0x36'),_0xc8d4('0x37')],'include':[{'model':'Trunk','as':_0xc8d4('0x38'),'attributes':['id',_0xc8d4('0x3'),_0xc8d4('0x39'),_0xc8d4('0x3a')]},{'model':_0xc8d4('0x3b'),'as':_0xc8d4('0x3c'),'attributes':['id','name']},{'model':_0xc8d4('0x38'),'as':'TrunkBackup','attributes':['id',_0xc8d4('0x3'),_0xc8d4('0x39'),_0xc8d4('0x3a')]},{'model':'Interval','as':_0xc8d4('0x3d'),'attributes':['id',_0xc8d4('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xc8d4('0x3'),_0xc8d4('0x3e')]}]}]},'log':_0xc8d4('0x3f')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b66f126..3ebd2d5 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(_0x4bdcd8,_0x5b4cd6){var _0x2bf60=function(_0x526da7){while(--_0x526da7){_0x4bdcd8['push'](_0x4bdcd8['shift']());}};_0x2bf60(++_0x5b4cd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x3b2245,_0x2b0b2b){var _0x1c44c5=function(_0x5d8fe5){while(--_0x5d8fe5){_0x3b2245['push'](_0x3b2245['shift']());}};_0x1c44c5(++_0x2b0b2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 2ab4536..58e5902 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 _0x1532=['Request','../client','getVoiceQueueRtPauses'];(function(_0x347097,_0x37a135){var _0x5dfd04=function(_0x131412){while(--_0x131412){_0x347097['push'](_0x347097['shift']());}};_0x5dfd04(++_0x37a135);}(_0x1532,0xac));var _0x2153=function(_0x554383,_0x42171e){_0x554383=_0x554383-0x0;var _0x5e44dd=_0x1532[_0x554383];return _0x5e44dd;};'use strict';var client=require(_0x2153('0x0'));exports[_0x2153('0x1')]=function(_0x1215ba){return function(){return client[_0x2153('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1215ba,'paused':!![]},'raw':!![]},'log':_0x2153('0x1')});};}; \ No newline at end of file +var _0x6af6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x479916,_0x5ea9e2){var _0x38b705=function(_0x47cea){while(--_0x47cea){_0x479916['push'](_0x479916['shift']());}};_0x38b705(++_0x5ea9e2);}(_0x6af6,0x18c));var _0x66af=function(_0x4f440a,_0x3891f3){_0x4f440a=_0x4f440a-0x0;var _0x27b5f5=_0x6af6[_0x4f440a];return _0x27b5f5;};'use strict';var client=require(_0x66af('0x0'));exports[_0x66af('0x1')]=function(_0x1afc4f){return function(){return client[_0x66af('0x2')](_0x66af('0x3'),{'options':{'where':{'VoiceQueueId':_0x1afc4f,'paused':!![]},'raw':!![]},'log':_0x66af('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4f04511..f66483b 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(_0x40785c,_0x3515b8){var _0x9508cf=function(_0x339fb5){while(--_0x339fb5){_0x40785c['push'](_0x40785c['shift']());}};_0x9508cf(++_0x3515b8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x21d05b,_0x82d731){var _0x5ca5a9=function(_0x2f42b4){while(--_0x2f42b4){_0x21d05b['push'](_0x21d05b['shift']());}};_0x5ca5a9(++_0x82d731);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 4eb8a88..f9d36f3 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 _0xfa1d=['transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext'];(function(_0x5e8bfa,_0x1e83d1){var _0x10b312=function(_0x2613e6){while(--_0x2613e6){_0x5e8bfa['push'](_0x5e8bfa['shift']());}};_0x10b312(++_0x1e83d1);}(_0xfa1d,0x117));var _0xdfa1=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xfa1d[_0x4b91c4];return _0x25cb80;};'use strict';var client=require('../client');exports[_0xdfa1('0x0')]={};exports[_0xdfa1('0x1')]=function(_0x56e83b){return client[_0xdfa1('0x2')](_0xdfa1('0x3'),{'body':{'result':_0x56e83b[_0xdfa1('0x4')],'transfererchannel':_0x56e83b['transfererchannel'],'transferercalleridnum':_0x56e83b[_0xdfa1('0x5')],'transferercalleridname':_0x56e83b[_0xdfa1('0x6')],'transfererconnectedlinenum':_0x56e83b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x56e83b['transfererconnectedlinename'],'transfereraccountcode':_0x56e83b[_0xdfa1('0x7')],'transferercontext':_0x56e83b[_0xdfa1('0x8')],'transfererexten':_0x56e83b['transfererexten'],'transfererlinkedid':_0x56e83b[_0xdfa1('0x9')],'transfereechannel':_0x56e83b['transfereechannel'],'transfereecalleridnum':_0x56e83b[_0xdfa1('0xa')],'transfereecalleridname':_0x56e83b[_0xdfa1('0xb')],'transfereeconnectedlinenum':_0x56e83b['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x56e83b[_0xdfa1('0xc')],'transfereeaccountcode':_0x56e83b[_0xdfa1('0xd')],'transfereecontext':_0x56e83b['transfereecontext'],'transfereeexten':_0x56e83b['transfereeexten'],'transfereelinkedid':_0x56e83b[_0xdfa1('0xe')],'isexternal':_0x56e83b[_0xdfa1('0xf')],'context':_0x56e83b[_0xdfa1('0x10')],'extension':_0x56e83b[_0xdfa1('0x11')],'type':_0xdfa1('0x12')},'log':_0xdfa1('0x3')});};exports[_0xdfa1('0x13')]=function(_0x2e9e42){return client[_0xdfa1('0x2')](_0xdfa1('0x3'),{'body':{'result':_0x2e9e42[_0xdfa1('0x4')],'transfererchannel':_0x2e9e42[_0xdfa1('0x14')],'transferercalleridnum':_0x2e9e42['origtransferercalleridnum'],'transferercalleridname':_0x2e9e42[_0xdfa1('0x15')],'transfererconnectedlinenum':_0x2e9e42[_0xdfa1('0x16')],'transfererconnectedlinename':_0x2e9e42[_0xdfa1('0x17')],'transfereraccountcode':_0x2e9e42[_0xdfa1('0x18')],'transferercontext':_0x2e9e42['secondtransferercontext'],'transfererexten':_0x2e9e42[_0xdfa1('0x19')],'transfererlinkedid':_0x2e9e42['origtransfererlinkedid'],'transfereechannel':_0x2e9e42[_0xdfa1('0x1a')],'transfereecalleridnum':_0x2e9e42[_0xdfa1('0x1b')],'transfereecalleridname':_0x2e9e42[_0xdfa1('0x1c')],'transfereeconnectedlinenum':_0x2e9e42[_0xdfa1('0x1d')],'transfereeconnectedlinename':_0x2e9e42['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2e9e42[_0xdfa1('0x1e')],'transfereecontext':_0x2e9e42[_0xdfa1('0x1f')],'transfereeexten':_0x2e9e42[_0xdfa1('0x20')],'transfereelinkedid':_0x2e9e42['transfertargetlinkedid'],'isexternal':_0x2e9e42[_0xdfa1('0xf')],'context':_0x2e9e42[_0xdfa1('0x21')],'extension':_0x2e9e42[_0xdfa1('0x22')],'type':_0xdfa1('0x23')},'log':_0xdfa1('0x3')});}; \ No newline at end of file +var _0x4787=['transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4787,0x1c8));var _0x7478=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x4787[_0x381589];return _0x2a075d;};'use strict';var client=require('../client');exports[_0x7478('0x0')]={};exports[_0x7478('0x1')]=function(_0x123b39){return client['Request'](_0x7478('0x2'),{'body':{'result':_0x123b39['result'],'transfererchannel':_0x123b39[_0x7478('0x3')],'transferercalleridnum':_0x123b39[_0x7478('0x4')],'transferercalleridname':_0x123b39[_0x7478('0x5')],'transfererconnectedlinenum':_0x123b39['transfererconnectedlinenum'],'transfererconnectedlinename':_0x123b39[_0x7478('0x6')],'transfereraccountcode':_0x123b39[_0x7478('0x7')],'transferercontext':_0x123b39[_0x7478('0x8')],'transfererexten':_0x123b39[_0x7478('0x9')],'transfererlinkedid':_0x123b39['transfererlinkedid'],'transfereechannel':_0x123b39[_0x7478('0xa')],'transfereecalleridnum':_0x123b39[_0x7478('0xb')],'transfereecalleridname':_0x123b39['transfereecalleridname'],'transfereeconnectedlinenum':_0x123b39[_0x7478('0xc')],'transfereeconnectedlinename':_0x123b39[_0x7478('0xd')],'transfereeaccountcode':_0x123b39[_0x7478('0xe')],'transfereecontext':_0x123b39['transfereecontext'],'transfereeexten':_0x123b39[_0x7478('0xf')],'transfereelinkedid':_0x123b39[_0x7478('0x10')],'isexternal':_0x123b39[_0x7478('0x11')],'context':_0x123b39['context'],'extension':_0x123b39['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x7478('0x12')]=function(_0x32b281){return client[_0x7478('0x13')](_0x7478('0x2'),{'body':{'result':_0x32b281[_0x7478('0x14')],'transfererchannel':_0x32b281[_0x7478('0x15')],'transferercalleridnum':_0x32b281[_0x7478('0x16')],'transferercalleridname':_0x32b281[_0x7478('0x17')],'transfererconnectedlinenum':_0x32b281[_0x7478('0x18')],'transfererconnectedlinename':_0x32b281[_0x7478('0x19')],'transfereraccountcode':_0x32b281[_0x7478('0x1a')],'transferercontext':_0x32b281[_0x7478('0x1b')],'transfererexten':_0x32b281[_0x7478('0x1c')],'transfererlinkedid':_0x32b281[_0x7478('0x1d')],'transfereechannel':_0x32b281[_0x7478('0x1e')],'transfereecalleridnum':_0x32b281['transfertargetcalleridnum'],'transfereecalleridname':_0x32b281['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x32b281['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x32b281[_0x7478('0x1f')],'transfereeaccountcode':_0x32b281[_0x7478('0x20')],'transfereecontext':_0x32b281[_0x7478('0x21')],'transfereeexten':_0x32b281[_0x7478('0x22')],'transfereelinkedid':_0x32b281[_0x7478('0x23')],'isexternal':_0x32b281[_0x7478('0x11')],'context':_0x32b281[_0x7478('0x24')],'extension':_0x32b281['origtransfererexten'],'type':_0x7478('0x25')},'log':_0x7478('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a58de1e..7bb59b0 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x361379,_0x1b56cb){var _0x62efec=function(_0x550dc8){while(--_0x550dc8){_0x361379['push'](_0x361379['shift']());}};_0x62efec(++_0x1b56cb);}(_0xb10b,0x12a));var _0xbb10=function(_0xabe65e,_0x455177){_0xabe65e=_0xabe65e-0x0;var _0x3da843=_0xb10b[_0xabe65e];return _0x3da843;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x161357,_0x188d02){var _0x1b9c4e=function(_0xfadb70){while(--_0xfadb70){_0x161357['push'](_0x161357['shift']());}};_0x1b9c4e(++_0x188d02);}(_0xb10b,0x12a));var _0xbb10=function(_0x38a162,_0x4396b2){_0x38a162=_0x38a162-0x0;var _0x1f622b=_0xb10b[_0x38a162];return _0x1f622b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index cee532b..4761b3b 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 _0x874c=['phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','union','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','data4','isNil','calleridname','Unknown','destcalleridname','','resolve','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','merge','length','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','defaults','redis','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data5','xmd-contactid','ListId','data3'];(function(_0x53e9d2,_0x428049){var _0x13ad56=function(_0x286f57){while(--_0x286f57){_0x53e9d2['push'](_0x53e9d2['shift']());}};_0x13ad56(++_0x428049);}(_0x874c,0x15a));var _0xc874=function(_0x5e31b7,_0x5d1d77){_0x5e31b7=_0x5e31b7-0x0;var _0x4d4f50=_0x874c[_0x5e31b7];return _0x4d4f50;};'use strict';var _=require(_0xc874('0x0'));var BPromise=require('bluebird');var Redis=require(_0xc874('0x1'));var util=require('util');var config=require(_0xc874('0x2'));var logger=require(_0xc874('0x3'))(_0xc874('0x4'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0xc874('0x5')](config[_0xc874('0x6')],{'host':_0xc874('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5e1f08,_0x38fdf7,_0x1b2119,_0x2ede41,_0x24edc6){logger[_0xc874('0x8')](_0xc874('0x9'),_0x5e1f08,_0x38fdf7['id'],_0x1b2119,_0x2ede41,JSON[_0xc874('0xa')](_0x24edc6));io['to'](_0x1b2119)[_0xc874('0xb')](_0x2ede41,_0x24edc6);}exports[_0xc874('0xc')]=function(_0x376aaa,_0xed5be9,_0x2fe7d3,_0x2ad42c){var _0x5f00d8,_0x17a312;var _0x588a2b={};var _0x4fc39c;var _0x2b3021=Number(_0x2fe7d3[_0xc874('0xd')]);var _0x213d45=_0x2fe7d3['data2']?Boolean(Number(_0x2fe7d3['data2'])):![];var _0x3f361b;var _0x3a4fe8=![];if(!_['isNil'](_0x2fe7d3[_0xc874('0xe')])){if(_0x2fe7d3[_0xc874('0xe')]=='1')_0x3a4fe8=!![];}if(!_0x3a4fe8){if(_0x2ad42c[_0xc874('0xf')]){_0x588a2b['id']=_0x2ad42c[_0xc874('0xf')];}}if(!_0x588a2b['id']){_0x588a2b[_0xc874('0x10')]=_0x2b3021;_0x3f361b=_0x2fe7d3[_0xc874('0x11')]&&_0x2fe7d3[_0xc874('0x11')]!=='0'?_0x2fe7d3[_0xc874('0x11')]['split'](','):[_0xc874('0x12')];_0x588a2b[_0xc874('0x13')]=_['map'](_0x3f361b,function(_0x543886){var _0x4e0e37={};_0x4e0e37[_0x543886]=_0x2ad42c[_0xc874('0x14')]?_0x2ad42c[_0xc874('0x15')]:_0x2ad42c[_0xc874('0x16')];return _0x4e0e37;});_0x4fc39c=_0x2ad42c[_0xc874('0x14')]?_0x2ad42c['destcalleridnum']:_0x2ad42c[_0xc874('0x16')];}var _0x49df4c=['id',_0xc874('0x17'),_0xc874('0x18'),_0xc874('0x12'),_0xc874('0x19'),_0xc874('0x1a'),_0xc874('0x10'),_0xc874('0x1b'),'scheduledAt',_0xc874('0x1c')];var _0x4d302b=_[_0xc874('0x1d')](_0x49df4c,_0x3f361b);BPromise['resolve']()[_0xc874('0x1e')](cmContactRpc[_0xc874('0x1f')]({'attributes':_0x4d302b,'where':_0x588a2b,'phone':_0x4fc39c}))[_0xc874('0x1e')](function(_0x578442){_0x17a312=_0x578442;if(!_[_0xc874('0x20')](_0x17a312)){if(_0x17a312['length']===0x1){_0x5f00d8=_0x17a312[0x0];logger[_0xc874('0x8')](_0xc874('0x21'),_0x2ad42c['uniqueid'],_0xed5be9['id'],_0x5f00d8['id']);}else{logger[_0xc874('0x8')](_0xc874('0x22'),_0x2ad42c[_0xc874('0x23')],_0xed5be9['id'],_['map'](_0x17a312,'id')['join'](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2ad42c[_0xc874('0x23')],_0xed5be9['id']);var _0x291809={'ListId':_0x2b3021};var _0x1a95e3=_0x2fe7d3[_0xc874('0x24')]&&_0x2fe7d3['data4']!=='0'?_0x2fe7d3['data4']:_0xc874('0x12');if(_0x213d45){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2ad42c[_0xc874('0x23')],_0xed5be9['id']);_0x291809[_0x1a95e3]=_[_0xc874('0x25')](_0x2ad42c[_0xc874('0x14')])?_0x2ad42c[_0xc874('0x16')]:_0x2ad42c[_0xc874('0x15')];if(_[_0xc874('0x25')](_0x2ad42c[_0xc874('0x14')])){_0x291809[_0xc874('0x17')]=_0x2ad42c['calleridname']&&_0x2ad42c[_0xc874('0x26')]!==''?_0x2ad42c[_0xc874('0x26')]:_0xc874('0x27');}else{_0x291809[_0xc874('0x17')]=_0x2ad42c[_0xc874('0x28')]&&_0x2ad42c['destcalleridname']!==_0xc874('0x29')?_0x2ad42c[_0xc874('0x28')]:'Unknown';}return BPromise[_0xc874('0x2a')]()[_0xc874('0x1e')](cmContactRpc['createContact'](_0x291809))['then'](function(_0x25fba5){_0x5f00d8=_0x25fba5;_0x17a312[_0xc874('0x2b')](_0x25fba5);if(_0x5f00d8){logger[_0xc874('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2ad42c[_0xc874('0x23')],_0xed5be9['id'],_0x5f00d8['id']);}return;});}else{logger[_0xc874('0x8')](_0xc874('0x2c'),_0x2ad42c[_0xc874('0x23')],_0xed5be9['id']);_0x291809[_0x1a95e3]=_[_0xc874('0x25')](_0x2ad42c['routeId'])?_0x2ad42c[_0xc874('0x16')]:_0x2ad42c['destcalleridnum'];if(_[_0xc874('0x25')](_0x2ad42c['routeId'])){_0x291809[_0xc874('0x17')]=_0x2ad42c[_0xc874('0x26')]&&_0x2ad42c[_0xc874('0x26')]!==_0xc874('0x29')?_0x2ad42c[_0xc874('0x26')]:_0xc874('0x27');}else{_0x291809['firstName']=_0x2ad42c[_0xc874('0x28')]&&_0x2ad42c[_0xc874('0x28')]!==''?_0x2ad42c[_0xc874('0x28')]:_0xc874('0x27');}_0x5f00d8=_0x291809;_0x17a312[_0xc874('0x2b')](_0x291809);return;}}})[_0xc874('0x1e')](function(){if(_0x376aaa){emit(_0x2ad42c[_0xc874('0x23')],_0xed5be9,util[_0xc874('0x2d')](_0xc874('0x2e'),_0x376aaa[_0xc874('0x2f')]),util['format'](_0xc874('0x30'),_0x2fe7d3[_0xc874('0x31')]['toLowerCase']()),{'evt':_[_0xc874('0x32')](_0x2ad42c,{'autoCreate':_0x213d45}),'contact':_0x5f00d8===undefined?{}:_0x5f00d8,'contacts':_0x17a312[_0xc874('0x33')]===0x0?undefined:_0x17a312});}});}; \ No newline at end of file +var _0x6425=['user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','firstName','','format'];(function(_0x9a9cf2,_0x2d7910){var _0x2ab152=function(_0x54bac4){while(--_0x54bac4){_0x9a9cf2['push'](_0x9a9cf2['shift']());}};_0x2ab152(++_0x2d7910);}(_0x6425,0x1ae));var _0x5642=function(_0x43cd71,_0x4d2250){_0x43cd71=_0x43cd71-0x0;var _0x34c580=_0x6425[_0x43cd71];return _0x34c580;};'use strict';var _=require(_0x5642('0x0'));var BPromise=require(_0x5642('0x1'));var Redis=require(_0x5642('0x2'));var util=require(_0x5642('0x3'));var config=require(_0x5642('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x5642('0x5'));config[_0x5642('0x6')]=_['defaults'](config[_0x5642('0x6')],{'host':_0x5642('0x7'),'port':0x18eb});var io=require(_0x5642('0x8'))(new Redis(config[_0x5642('0x6')]));function emit(_0x3070a4,_0xc04b29,_0x2cd00a,_0xd07041,_0x105747){logger[_0x5642('0x9')](_0x5642('0xa'),_0x3070a4,_0xc04b29['id'],_0x2cd00a,_0xd07041,JSON['stringify'](_0x105747));io['to'](_0x2cd00a)[_0x5642('0xb')](_0xd07041,_0x105747);}exports[_0x5642('0xc')]=function(_0x328ca0,_0x203c11,_0xf72d99,_0x4d9103){var _0xcc63ae,_0x127939;var _0x2adb61={};var _0x16a8e3;var _0x2e679c=Number(_0xf72d99['data1']);var _0x455e39=_0xf72d99['data2']?Boolean(Number(_0xf72d99[_0x5642('0xd')])):![];var _0x144d4b;var _0x2cac09=![];if(!_['isNil'](_0xf72d99[_0x5642('0xe')])){if(_0xf72d99['data5']=='1')_0x2cac09=!![];}if(!_0x2cac09){if(_0x4d9103[_0x5642('0xf')]){_0x2adb61['id']=_0x4d9103[_0x5642('0xf')];}}if(!_0x2adb61['id']){_0x2adb61[_0x5642('0x10')]=_0x2e679c;_0x144d4b=_0xf72d99['data3']&&_0xf72d99[_0x5642('0x11')]!=='0'?_0xf72d99[_0x5642('0x11')][_0x5642('0x12')](','):[_0x5642('0x13')];_0x2adb61[_0x5642('0x14')]=_['map'](_0x144d4b,function(_0x2b9765){var _0x5905d8={};_0x5905d8[_0x2b9765]=_0x4d9103[_0x5642('0x15')]?_0x4d9103[_0x5642('0x16')]:_0x4d9103[_0x5642('0x17')];return _0x5905d8;});_0x16a8e3=_0x4d9103['routeId']?_0x4d9103['destcalleridnum']:_0x4d9103[_0x5642('0x17')];}var _0xfb76b2=['id','firstName','lastName','phone','mobile',_0x5642('0x18'),_0x5642('0x10'),_0x5642('0x19'),_0x5642('0x1a'),_0x5642('0x1b')];var _0x1caf02=_[_0x5642('0x1c')](_0xfb76b2,_0x144d4b);BPromise[_0x5642('0x1d')]()[_0x5642('0x1e')](cmContactRpc['getContacts']({'attributes':_0x1caf02,'where':_0x2adb61,'phone':_0x16a8e3}))[_0x5642('0x1e')](function(_0x27a65d){_0x127939=_0x27a65d;if(!_['isEmpty'](_0x127939)){if(_0x127939[_0x5642('0x1f')]===0x1){_0xcc63ae=_0x127939[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x4d9103[_0x5642('0x20')],_0x203c11['id'],_0xcc63ae['id']);}else{logger[_0x5642('0x9')](_0x5642('0x21'),_0x4d9103[_0x5642('0x20')],_0x203c11['id'],_['map'](_0x127939,'id')['join'](','));}return;}else{logger['info'](_0x5642('0x22'),_0x4d9103[_0x5642('0x20')],_0x203c11['id']);var _0xef7e59={'ListId':_0x2e679c};var _0x272210=_0xf72d99[_0x5642('0x23')]&&_0xf72d99['data4']!=='0'?_0xf72d99['data4']:_0x5642('0x13');if(_0x455e39){logger[_0x5642('0x9')](_0x5642('0x24'),_0x4d9103['uniqueid'],_0x203c11['id']);_0xef7e59[_0x272210]=_['isNil'](_0x4d9103[_0x5642('0x15')])?_0x4d9103[_0x5642('0x17')]:_0x4d9103[_0x5642('0x16')];if(_['isNil'](_0x4d9103[_0x5642('0x15')])){_0xef7e59['firstName']=_0x4d9103[_0x5642('0x25')]&&_0x4d9103['calleridname']!==''?_0x4d9103[_0x5642('0x25')]:_0x5642('0x26');}else{_0xef7e59['firstName']=_0x4d9103[_0x5642('0x27')]&&_0x4d9103[_0x5642('0x27')]!==''?_0x4d9103[_0x5642('0x27')]:_0x5642('0x26');}return BPromise[_0x5642('0x1d')]()['then'](cmContactRpc[_0x5642('0x28')](_0xef7e59))['then'](function(_0x591161){_0xcc63ae=_0x591161;_0x127939['push'](_0x591161);if(_0xcc63ae){logger[_0x5642('0x9')](_0x5642('0x29'),_0x4d9103['uniqueid'],_0x203c11['id'],_0xcc63ae['id']);}return;});}else{logger[_0x5642('0x9')](_0x5642('0x2a'),_0x4d9103[_0x5642('0x20')],_0x203c11['id']);_0xef7e59[_0x272210]=_[_0x5642('0x2b')](_0x4d9103[_0x5642('0x15')])?_0x4d9103[_0x5642('0x17')]:_0x4d9103[_0x5642('0x16')];if(_['isNil'](_0x4d9103[_0x5642('0x15')])){_0xef7e59[_0x5642('0x2c')]=_0x4d9103[_0x5642('0x25')]&&_0x4d9103[_0x5642('0x25')]!==_0x5642('0x2d')?_0x4d9103[_0x5642('0x25')]:_0x5642('0x26');}else{_0xef7e59[_0x5642('0x2c')]=_0x4d9103['destcalleridname']&&_0x4d9103['destcalleridname']!==''?_0x4d9103[_0x5642('0x27')]:_0x5642('0x26');}_0xcc63ae=_0xef7e59;_0x127939['push'](_0xef7e59);return;}}})[_0x5642('0x1e')](function(){if(_0x328ca0){emit(_0x4d9103[_0x5642('0x20')],_0x203c11,util[_0x5642('0x2e')](_0x5642('0x2f'),_0x328ca0[_0x5642('0x30')]),util[_0x5642('0x2e')](_0x5642('0x31'),_0xf72d99[_0x5642('0x32')][_0x5642('0x33')]()),{'evt':_[_0x5642('0x34')](_0x4d9103,{'autoCreate':_0x455e39}),'contact':_0xcc63ae===undefined?{}:_0xcc63ae,'contacts':_0x127939['length']===0x0?undefined:_0x127939});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 83d0b1c..f3235be 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 _0x4d58=['offlineMessage','created','equals','exports','util','lodash','mustache','./urlforward','./integration','./cmContact','./script','redis','defaults','localhost','url','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','deskAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','info','stringify','emit','motionChannel','undefined','voice','inspect','checkTriggers','prototype','hasOwnProperty','status','merge','variables','Actions','length','interface','contactmanager','browser','data1','TemplateId','data2','templates','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','windowWidth','data5','800','data6','600','winApplication','format','user:%s','name','trigger:%s:%s','toLowerCase','action','trigger:%s','exec','integration','routeId','urlforward','parse','query','search','checkTrigger','AllConditions','every','checkConditions','channel','AnyConditions','some','debug','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','value','AccountId','operator','interaction','message','event','queue','agent','membername','lastevent','mailSubstatus','null','substatus'];(function(_0x4affe2,_0x5dd72e){var _0xe4df67=function(_0x3338b1){while(--_0x3338b1){_0x4affe2['push'](_0x4affe2['shift']());}};_0xe4df67(++_0x5dd72e);}(_0x4d58,0x10a));var _0x84d5=function(_0xe34c8e,_0x6100fc){_0xe34c8e=_0xe34c8e-0x0;var _0x28db2e=_0x4d58[_0xe34c8e];return _0x28db2e;};'use strict';var util=require(_0x84d5('0x0'));var _=require(_0x84d5('0x1'));var url=require('url');var Mustache=require(_0x84d5('0x2'));var Redis=require('ioredis');var urlforward=require(_0x84d5('0x3'));var integration=require(_0x84d5('0x4'));var cmContact=require(_0x84d5('0x5'));var script=require(_0x84d5('0x6'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('trigger');var ami=require('../ami');config[_0x84d5('0x7')]=_[_0x84d5('0x8')](config['redis'],{'host':_0x84d5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x4293c7,_0x5a1b51){return _0x4293c7==_0x5a1b51;},'not_equals':function(_0x1c207d,_0x2fc404){return _0x1c207d!=_0x2fc404;}};var barAndWebActions=['popup',_0x84d5('0xa'),'winapp'];function Trigger(_0xabfa10){this[_0x84d5('0xb')]=_0xabfa10['triggers'];this[_0x84d5('0xc')]=_0xabfa10['agents'];this['voiceQueues']=_0xabfa10[_0x84d5('0xd')];this['templates']=_0xabfa10['templates'];this[_0x84d5('0xe')]=_0xabfa10[_0x84d5('0xe')];this[_0x84d5('0xf')]=_0xabfa10['zendeskAccounts'];this['freshdeskAccounts']=_0xabfa10[_0x84d5('0x10')];this['salesforceAccounts']=_0xabfa10['salesforceAccounts'];this['sugarcrmAccounts']=_0xabfa10[_0x84d5('0x11')];this[_0x84d5('0x12')]=_0xabfa10[_0x84d5('0x12')];this['deskAccounts']=_0xabfa10['deskAccounts'];this[_0x84d5('0x13')]=_0xabfa10[_0x84d5('0x13')];this[_0x84d5('0x14')]=_0xabfa10['servicenowAccounts'];this[_0x84d5('0x15')]=_0xabfa10[_0x84d5('0x15')];this[_0x84d5('0x16')]=_0xabfa10[_0x84d5('0x16')];this[_0x84d5('0x17')]={'zendesk':this[_0x84d5('0xf')],'salesforce':this[_0x84d5('0x18')],'freshdesk':this[_0x84d5('0x10')],'sugarcrm':this[_0x84d5('0x11')],'zoho':this['zohoAccounts'],'desk':this[_0x84d5('0x19')],'vtiger':this[_0x84d5('0x13')],'dynamics365':this[_0x84d5('0x15')],'freshsales':this[_0x84d5('0x16')],'servicenow':this['servicenowAccounts']};ami['on'](_0x84d5('0x1a'),this['syncCustomEvent'][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x1c'),this[_0x84d5('0x1d')]['bind'](this));ami['on'](_0x84d5('0x1e'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x1f'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x20'),this['syncCustomEvent'][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x21'),this[_0x84d5('0x1d')]['bind'](this));ami['on'](_0x84d5('0x22'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x23'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x24'),this['syncCustomEvent'][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x25'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x26'),this[_0x84d5('0x1d')]['bind'](this));ami['on'](_0x84d5('0x27'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x28'),this['syncAgentDial'][_0x84d5('0x1b')](this));ami['on']('custom:dialconnect',this[_0x84d5('0x29')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x2a'),this[_0x84d5('0x29')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x2b'),this[_0x84d5('0x1d')]['bind'](this));ami['on'](_0x84d5('0x2c'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x2d'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x2e'),this['syncCustomEvent'][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x2f'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x30'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x31'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));ami['on'](_0x84d5('0x32'),this[_0x84d5('0x1d')][_0x84d5('0x1b')](this));}Trigger['prototype']['emit']=function(_0x1a41c5,_0x4eac78,_0x101b94){logger[_0x84d5('0x33')](_0x1a41c5,_0x4eac78,JSON[_0x84d5('0x34')](_0x101b94));io['to'](_0x1a41c5)[_0x84d5('0x35')](_0x4eac78,_0x101b94);};Trigger['prototype']['syncCustomEvent']=function(_0x11172a){var _0x17d991=_['clone'](_0x11172a);if(typeof _0x17d991[_0x84d5('0x36')]===_0x84d5('0x37')){_0x17d991[_0x84d5('0x36')]=_0x84d5('0x38');}logger['debug'](_0x84d5('0x1d'),util[_0x84d5('0x39')](_0x17d991,{'showHidden':!![],'depth':null}));this[_0x84d5('0x3a')](_0x17d991);};Trigger['prototype'][_0x84d5('0x29')]=function(_0x3d46a5){if(this[_0x84d5('0xc')][_0x3d46a5['interface']]){this['syncCustomEvent'](_0x3d46a5);}};Trigger[_0x84d5('0x3b')]['checkTriggers']=function(_0x301e89){var _0x14e822;for(var _0x135386 in this[_0x84d5('0xb')]){if(this[_0x84d5('0xb')][_0x84d5('0x3c')](_0x135386)){if(this[_0x84d5('0xb')][_0x135386][_0x84d5('0x3d')]){_0x14e822=this['checkTrigger'](this[_0x84d5('0xb')][_0x135386],_0x301e89);if(_0x14e822){_[_0x84d5('0x3e')](_0x301e89,_0x301e89[_0x84d5('0x3f')]);for(var _0x3a538b=0x0,_0x3b59f3,_0x4ef505,_0x28f118;_0x3a538b0x0){_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 _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x2e97cc,_0x6a57e2){var _0x2a637d=function(_0x427974){while(--_0x427974){_0x2e97cc['push'](_0x2e97cc['shift']());}};_0x2a637d(++_0x6a57e2);}(_0x814b,0x1a2));var _0xb814=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x814b[_0x5c365f];return _0x295e1b;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 9945280..b4466c5 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 _0x525f=['trigger:browser:url','remoteUri','modernAuthentication','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','data7','tenantId','CloudProvider','data2','POST','username','password','clientSecret','then','access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','&$filter=','\x20eq\x20\x27','replace','value','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','string','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s'];(function(_0x581340,_0x590b76){var _0x5bca27=function(_0x21fa2e){while(--_0x21fa2e){_0x581340['push'](_0x581340['shift']());}};_0x5bca27(++_0x590b76);}(_0x525f,0x162));var _0xf525=function(_0x297e92,_0x45d01d){_0x297e92=_0x297e92-0x0;var _0xbe3a5e=_0x525f[_0x297e92];return _0xbe3a5e;};'use strict';var _=require(_0xf525('0x0'));var rp=require(_0xf525('0x1'));var util=require(_0xf525('0x2'));var intUtil=require(_0xf525('0x3'));var md5=require('md5');var Redis=require(_0xf525('0x4'));var logger=require(_0xf525('0x5'))(_0xf525('0x6'));var config=require('../../../../config/environment');config[_0xf525('0x7')]=_[_0xf525('0x8')](config[_0xf525('0x7')],{'host':_0xf525('0x9'),'port':0x18eb});var io=require(_0xf525('0xa'))(new Redis(config[_0xf525('0x7')]));function getAuthToken(_0x4aadd7,_0x2ad4a9,_0x12adad){if(_0x4aadd7['modernAuthentication']){_0x4aadd7['remoteUri']=_0x4aadd7['CloudProvider'][_0xf525('0xb')];_0x4aadd7[_0xf525('0xc')]=_0x4aadd7[_0xf525('0xd')][_0xf525('0xe')];return Promise['resolve'](_0x4aadd7[_0xf525('0xd')]['data5']);}var _0x4841fb={'method':_0xf525('0xf'),'uri':_0x2ad4a9,'form':{'client_id':_0x4aadd7['clientId'],'resource':_0x4aadd7['remoteUri'],'username':_0x4aadd7[_0xf525('0x10')],'password':_0x4aadd7[_0xf525('0x11')],'grant_type':_0xf525('0x11'),'client_secret':_0x4aadd7[_0xf525('0x12')]},'json':!![]};return rp(_0x4841fb)[_0xf525('0x13')](function(_0x5bfb6b){return _0x5bfb6b[_0xf525('0x14')];})[_0xf525('0x15')](function(_0xec1f95){logger['error']('['+[_0x12adad[_0xf525('0x16')]()]+']\x20Wrong\x20credentials!');return _0xec1f95[_0xf525('0x17')];});}function getUser(_0x49fc6b,_0x4393fc,_0xb40668,_0x1531b6,_0x48988d,_0x4ab592){return new Promise(function(_0x5e1e96,_0x5e8a84){return getAuthToken(_0x4393fc,_0x1531b6,_0x4ab592)[_0xf525('0x13')](function(_0x8a548c){var _0x51453f={'method':_0xf525('0x18'),'uri':_0x48988d+_0xf525('0x19'),'headers':{'Authorization':_0xf525('0x1a')+_0x8a548c,'OData-Version':_0xf525('0x1b')},'json':!![]};return rp(_0x51453f);})[_0xf525('0x13')](function(_0x325b40){var _0x441422=_0x325b40['value'];var _0x256a91=![];var _0x3208b1=null;if(!_[_0xf525('0x1c')](_0xb40668)){if(intUtil[_0xf525('0x1d')](_0xb40668[_0xf525('0x1e')])){_0x49fc6b['userEmail']=_0xb40668[_0xf525('0x1e')];for(_0x3208b1=0x0;_0x3208b1<_0x441422[_0xf525('0x1f')];_0x3208b1++){if(_0x441422[_0x3208b1][_0xf525('0x20')]===_0xb40668[_0xf525('0x1e')]&&!_0x441422[_0x3208b1]['isdisabled']){_0x256a91=!![];logger[_0xf525('0x21')]('['+[_0x4ab592['toUpperCase']()]+_0xf525('0x22')+_0x441422[_0x3208b1]['systemuserid']+'!');_0x49fc6b[_0xf525('0x23')]=_0x441422[_0x3208b1][_0xf525('0x24')];}}}}if(!_0x256a91){logger[_0xf525('0x21')]('['+[_0x4ab592['toUpperCase']()]+_0xf525('0x25'));_0x49fc6b[_0xf525('0x26')]=_0x4393fc[_0xf525('0x10')];for(_0x3208b1=0x0;_0x3208b1<_0x441422[_0xf525('0x1f')];_0x3208b1++){if(_0x441422[_0x3208b1]['internalemailaddress']===_0x4393fc['username']){_0x49fc6b['userId']=_0x441422[_0x3208b1][_0xf525('0x24')];}}}_0x5e1e96(_0x49fc6b);})['catch'](function(_0x24ea20){_0x5e8a84(_0x24ea20['message']);});});}function createEndUser(_0x8b42c6,_0x573a26,_0x4908ac,_0x34ea70,_0x565cec,_0x3b8ecb,_0x2dfda7){return new Promise(function(_0x150300,_0x79d942){return getAuthToken(_0x573a26,_0x4908ac,_0x3b8ecb)[_0xf525('0x13')](function(_0x2c83fb){var _0x1d4067=_0x3b8ecb[_0xf525('0x27')]()===_0xf525('0x28')?_0x565cec[_0xf525('0x29')]:_0x565cec[_0xf525('0x2a')];var _0x44045f={'method':_0xf525('0xf'),'uri':_0x34ea70+_0xf525('0x2b'),'body':{'fullname':_0x1d4067,'firstname':_0x1d4067,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf525('0x2c')+_0x8b42c6[_0xf525('0x23')]+')'},'headers':{'Authorization':_0xf525('0x1a')+_0x2c83fb,'OData-Version':_0xf525('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x44045f[_0xf525('0x2d')][_0x2dfda7]=_0x1d4067;return rp(_0x44045f);})['then'](function(_0x1dae18){var _0x443cc9=_0x1dae18['headers'][_0xf525('0x2e')];var _0x133f48=_0x443cc9[_0xf525('0x2f')](_0x443cc9['lastIndexOf']('(')+0x1,_0x443cc9[_0xf525('0x30')](')'));_0x8b42c6[_0xf525('0x31')]=_0x133f48;_0x150300(_0x8b42c6);})[_0xf525('0x15')](function(_0x288cf7){_0x79d942(_0x288cf7['message']);});});}function getEndUser(_0x5f3252,_0x45e161,_0x4aebf4,_0x5529e6,_0x89c989,_0x377df3,_0x4a3ea3,_0x33c448){var _0x57c4af=_0x377df3[_0xf525('0x27')]()===_0xf525('0x28')?_0x89c989[_0xf525('0x29')]:_0x89c989['calleridnum'];return getAuthToken(_0x45e161,_0x4aebf4,_0x377df3)[_0xf525('0x13')](function(_0x205ee4){_0x33c448=_0x33c448?_0x33c448:_0xf525('0x32');var _0x1a76e6={'method':_0xf525('0x18'),'uri':_0x5529e6+'contacts?$select='+_0x33c448+_0xf525('0x33')+_0x33c448+_0xf525('0x34')+_0x57c4af[_0xf525('0x35')]('+','%2b')+'\x27','headers':{'Authorization':_0xf525('0x1a')+_0x205ee4,'If-None-Match':null,'OData-Version':_0xf525('0x1b')},'json':!![]};return rp(_0x1a76e6);})[_0xf525('0x13')](function(_0x2d441f){var _0x2be4bc=![];if(!_0x2d441f)return _0x2be4bc;var _0x3c40a8=_0x2d441f[_0xf525('0x36')];for(var _0x2e898b=0x0;_0x2e898b<_0x3c40a8['length'];_0x2e898b++){if(_0x3c40a8[_0x2e898b][_0x33c448]===_0x57c4af){_0x2be4bc=!![];_0x5f3252['enduserId']=_0x3c40a8[_0x2e898b][_0xf525('0x37')];}}return _0x2be4bc;})[_0xf525('0x13')](function(_0x744d8f){if(_0x744d8f)return _0x5f3252;if(_0x4a3ea3==='nothing'){logger['info']('['+[_0x377df3[_0xf525('0x16')]()]+_0xf525('0x38'));return _0x5f3252;}return createEndUser(_0x5f3252,_0x45e161,_0x4aebf4,_0x5529e6,_0x89c989,_0x377df3,_0x33c448)[_0xf525('0x13')](function(_0x3e059f){logger[_0xf525('0x21')]('['+[_0x377df3[_0xf525('0x16')]()]+']\x20Enduser\x20created!',_0x3e059f[_0xf525('0x31')]);return _0x3e059f;});});}function getCustomFields(_0x4c277c,_0x5404e3,_0x2f7771){var _0x1dc29e={};if(_0x4c277c[_0xf525('0x1f')]>0x0){_['forEach'](_0x4c277c,function(_0x5bf206){if(_['includes']([_0xf525('0x39'),'picklist'],_0x5bf206[_0xf525('0x3a')])&&_0x5bf206[_0xf525('0x3b')]&&!_0x5bf206[_0xf525('0x3c')]){var _0x38cf04=_0x5bf206[_0xf525('0x3d')][_0xf525('0x27')]();var _0x48dea6=_0x38cf04[_0xf525('0x2f')](0x0,_0x38cf04[_0xf525('0x3e')]('_'));var _0x2fd781=_0x38cf04[_0xf525('0x2f')](_0x38cf04[_0xf525('0x3e')]('_')+0x1);if(_0x48dea6===_0x2f7771){_0x1dc29e[_0x2fd781]=_0x5bf206[_0xf525('0x3f')];}}});}return _0x1dc29e;}function getTicket(_0x3c0b90,_0x56da59,_0x19d875,_0x4d3bb1,_0x5216c2,_0x402380,_0xe07dbb){return new Promise(function(_0x331241,_0xf60e4a){var _0x1e9917;return getAuthToken(_0x56da59,_0x19d875,_0xe07dbb)['then'](function(_0x37ae1a){if(_0x402380['ticketType']===_0xf525('0x40')){_0x1e9917={'method':_0xf525('0xf'),'uri':_0x4d3bb1+_0xf525('0x41'),'body':Object[_0xf525('0x42')]({},{'title':intUtil[_0xf525('0x43')](_0x402380[_0xf525('0x44')],_0x5216c2,'\x20'),'description':intUtil[_0xf525('0x43')](_0x402380[_0xf525('0x45')],_0x5216c2,'\x0a'),'customerid_contact@odata.bind':_0x3c0b90[_0xf525('0x31')]?_0xf525('0x46')+_0x3c0b90[_0xf525('0x31')]+')':undefined,'ownerid@odata.bind':_0xf525('0x2c')+_0x3c0b90[_0xf525('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x402380[_0xf525('0x47')],_0x5216c2,_0x402380['ticketType'])),'headers':{'Authorization':_0xf525('0x1a')+_0x37ae1a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x402380[_0xf525('0x48')]===_0xf525('0x49')){var _0x1e7526=_0x3c0b90[_0xf525('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3c0b90['userId']+')','participationtypemask':_0x3c0b90[_0xf525('0x4a')]===_0xf525('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3c0b90['enduserId']+')','participationtypemask':_0x3c0b90[_0xf525('0x4a')]===_0xf525('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf525('0x2c')+_0x3c0b90[_0xf525('0x23')]+')','participationtypemask':_0x3c0b90[_0xf525('0x4a')]===_0xf525('0x4b')?0x2:0x1}];_0x1e9917={'method':_0xf525('0xf'),'uri':_0x4d3bb1+_0xf525('0x4c'),'body':Object[_0xf525('0x42')]({},{'subject':intUtil[_0xf525('0x43')](_0x402380[_0xf525('0x44')],_0x5216c2,'\x20'),'phonenumber':String(_0x5216c2[_0xf525('0x2a')]),'description':intUtil[_0xf525('0x43')](_0x402380[_0xf525('0x45')],_0x5216c2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3c0b90[_0xf525('0x31')]?_0xf525('0x46')+_0x3c0b90[_0xf525('0x31')]+')':undefined,'ownerid@odata.bind':_0xf525('0x2c')+_0x3c0b90[_0xf525('0x23')]+')','directioncode':_0x3c0b90['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x1e7526},getCustomFields(_0x402380[_0xf525('0x47')],_0x5216c2,_0x402380[_0xf525('0x48')])),'headers':{'Authorization':_0xf525('0x1a')+_0x37ae1a,'OData-Version':_0xf525('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e9917);})[_0xf525('0x13')](function(_0x4d12a0){var _0x3e546d=_0x4d12a0[_0xf525('0x4d')][_0xf525('0x2e')];var _0x34d32d=_0x3e546d[_0xf525('0x2f')](_0x3e546d[_0xf525('0x30')]('(')+0x1,_0x3e546d[_0xf525('0x30')](')'));_0x3c0b90[_0xf525('0x4e')]=_0x34d32d;_0x331241(_0x3c0b90);})[_0xf525('0x15')](function(_0x24af56){_0xf60e4a(_0x24af56['message']);});});}function emit(_0x265b44,_0x3bf4b3,_0x37f70d,_0x3391bb){var _0x1c5bc7={'uri':util[_0xf525('0x4f')](_0xf525('0x50'),_0x265b44,_0x37f70d,_0x3391bb)};io['to'](util['format'](_0xf525('0x51'),_0x3bf4b3))['emit'](_0xf525('0x52'),_0x1c5bc7);}exports['cs']=function(_0x55e424,_0x469b5a,_0x14f09a,_0x49c63c,_0x391aee,_0x1f8de2,_0x23f63f,_0x1d9efb){var _0x77762b={};_0x1f8de2[_0xf525('0x53')]=_0x1f8de2[_0xf525('0x54')]?intUtil[_0xf525('0x55')](_0x1f8de2[_0xf525('0xd')][_0xf525('0xb')]):intUtil['stripTrailingSlash'](_0x1f8de2[_0xf525('0x53')]);_0x1f8de2['serverUrl']=intUtil[_0xf525('0x55')](_0x1f8de2['serverUrl']);_0x77762b[_0xf525('0x4a')]=_0x1d9efb===_0xf525('0x4b')||_0x1d9efb===_0xf525('0x56')?_0xf525('0x4b'):_0xf525('0x28');var _0x2efb3a=_0x1f8de2[_0xf525('0x54')]?util[_0xf525('0x4f')]('%s/api/data/v9.0/',_0x1f8de2[_0xf525('0xd')][_0xf525('0xb')]):util[_0xf525('0x4f')](_0xf525('0x57'),_0x1f8de2[_0xf525('0x53')]);var _0x307959=util[_0xf525('0x4f')](_0xf525('0x58'),_0x1f8de2[_0xf525('0xc')]);var _0xb7ddf2=util[_0xf525('0x4f')](_0xf525('0x59'),_0x1f8de2[_0xf525('0x5a')],_0x469b5a[_0xf525('0x5b')],md5(_0x469b5a[_0xf525('0x5b')]));if(_0x391aee&&_0x391aee[_0xf525('0x5c')]){logger[_0xf525('0x21')](_0xf525('0x5d'),_0xf525('0x5e'));_0x469b5a['recordingURL']=_0xb7ddf2;}else if(_0x23f63f&&_0x23f63f[_0xf525('0x5f')]&&_0x23f63f[_0xf525('0x5f')]!==_0xf525('0x60')){logger[_0xf525('0x21')]('[OUTBOUND]',_0xf525('0x5e'));_0x469b5a['recordingURL']=_0xb7ddf2;}else{_0x469b5a[_0xf525('0x61')]='';}return getUser(_0x77762b,_0x1f8de2,_0x49c63c,_0x307959,_0x2efb3a,_0x1d9efb)['then'](function(_0x50465d){logger[_0xf525('0x21')]('['+_0x1d9efb[_0xf525('0x16')]()+_0xf525('0x62'),_0x50465d[_0xf525('0x23')]);logger[_0xf525('0x21')]('['+_0x1d9efb['toUpperCase']()+_0xf525('0x63'),_0x50465d[_0xf525('0x26')]);return getEndUser(_0x50465d,_0x1f8de2,_0x307959,_0x2efb3a,_0x469b5a,_0x1d9efb,_0x14f09a[_0xf525('0x64')],_0x14f09a[_0xf525('0x65')]);})[_0xf525('0x13')](function(_0x31c71d){logger[_0xf525('0x21')]('['+_0x1d9efb[_0xf525('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x31c71d['enduserId']);logger[_0xf525('0x21')]('['+_0x1d9efb[_0xf525('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x469b5a[_0xf525('0x2a')]);return getTicket(_0x31c71d,_0x1f8de2,_0x307959,_0x2efb3a,_0x469b5a,_0x14f09a,_0x1d9efb);})[_0xf525('0x13')](function(_0x57dd46){logger[_0xf525('0x21')](util[_0xf525('0x4f')]('['+_0x1d9efb[_0xf525('0x16')]()+_0xf525('0x66'),_0x14f09a['ticketType'],_0x57dd46[_0xf525('0x4e')]));logger[_0xf525('0x21')](util[_0xf525('0x4f')]('['+_0x1d9efb[_0xf525('0x16')]()+']\x20Call\x20direction:\x20%s',_0x1d9efb));if(_0x1d9efb!==_0xf525('0x56')&&_0x14f09a[_0xf525('0x67')]){logger[_0xf525('0x21')]('['+_0x1d9efb[_0xf525('0x16')]()+']',_0xf525('0x68'));emit(_0x1f8de2[_0xf525('0x53')],_0x49c63c[_0xf525('0x69')],_0x14f09a[_0xf525('0x48')],_0x57dd46[_0xf525('0x4e')]);}})['catch'](function(_0x52fe89){logger[_0xf525('0x6a')]('['+_0x1d9efb[_0xf525('0x16')]()+_0xf525('0x6b'),_0x52fe89[_0xf525('0x17')]);console[_0xf525('0x6a')](_0xf525('0x6c'),_0x52fe89);});}; \ No newline at end of file +var _0x8c50=['value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','systemuserid','info','userEmail','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','type','nameField','customField','idField','indexOf','content','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x503ce1,_0x56077c){var _0x2801d8=function(_0x1e25ed){while(--_0x1e25ed){_0x503ce1['push'](_0x503ce1['shift']());}};_0x2801d8(++_0x56077c);}(_0x8c50,0xb9));var _0x08c5=function(_0x14444f,_0x56b630){_0x14444f=_0x14444f-0x0;var _0x37362e=_0x8c50[_0x14444f];return _0x37362e;};'use strict';var _=require(_0x08c5('0x0'));var rp=require(_0x08c5('0x1'));var util=require(_0x08c5('0x2'));var intUtil=require(_0x08c5('0x3'));var md5=require('md5');var Redis=require(_0x08c5('0x4'));var logger=require(_0x08c5('0x5'))(_0x08c5('0x6'));var config=require(_0x08c5('0x7'));config[_0x08c5('0x8')]=_[_0x08c5('0x9')](config[_0x08c5('0x8')],{'host':_0x08c5('0xa'),'port':0x18eb});var io=require(_0x08c5('0xb'))(new Redis(config['redis']));function getAuthToken(_0x436b9d,_0x45af12,_0x50e9a7){if(_0x436b9d[_0x08c5('0xc')]){_0x436b9d[_0x08c5('0xd')]=_0x436b9d[_0x08c5('0xe')]['data7'];_0x436b9d[_0x08c5('0xf')]=_0x436b9d[_0x08c5('0xe')]['data2'];return Promise['resolve'](_0x436b9d[_0x08c5('0xe')][_0x08c5('0x10')]);}var _0x3aa65e={'method':_0x08c5('0x11'),'uri':_0x45af12,'form':{'client_id':_0x436b9d[_0x08c5('0x12')],'resource':_0x436b9d[_0x08c5('0xd')],'username':_0x436b9d[_0x08c5('0x13')],'password':_0x436b9d['password'],'grant_type':_0x08c5('0x14'),'client_secret':_0x436b9d[_0x08c5('0x15')]},'json':!![]};return rp(_0x3aa65e)[_0x08c5('0x16')](function(_0x54a5d7){return _0x54a5d7[_0x08c5('0x17')];})[_0x08c5('0x18')](function(_0x1834c9){logger['error']('['+[_0x50e9a7[_0x08c5('0x19')]()]+_0x08c5('0x1a'));return _0x1834c9[_0x08c5('0x1b')];});}function getUser(_0x51155b,_0x2d33b7,_0xc6835c,_0x3ff627,_0x4ad676,_0x14a34d){return new Promise(function(_0xf01510,_0x1d966f){return getAuthToken(_0x2d33b7,_0x3ff627,_0x14a34d)[_0x08c5('0x16')](function(_0x2fb11a){var _0x2e1c9c={'method':'GET','uri':_0x4ad676+_0x08c5('0x1c'),'headers':{'Authorization':_0x08c5('0x1d')+_0x2fb11a,'OData-Version':_0x08c5('0x1e')},'json':!![]};return rp(_0x2e1c9c);})[_0x08c5('0x16')](function(_0x562132){var _0x2aeb47=_0x562132[_0x08c5('0x1f')];var _0x3b3dba=![];var _0xf55bae=null;if(!_[_0x08c5('0x20')](_0xc6835c)){if(intUtil[_0x08c5('0x21')](_0xc6835c['email'])){_0x51155b['userEmail']=_0xc6835c[_0x08c5('0x22')];for(_0xf55bae=0x0;_0xf55bae<_0x2aeb47[_0x08c5('0x23')];_0xf55bae++){if(_0x2aeb47[_0xf55bae][_0x08c5('0x24')]===_0xc6835c[_0x08c5('0x22')]&&!_0x2aeb47[_0xf55bae][_0x08c5('0x25')]){_0x3b3dba=!![];logger['info']('['+[_0x14a34d['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2aeb47[_0xf55bae][_0x08c5('0x26')]+'!');_0x51155b['userId']=_0x2aeb47[_0xf55bae][_0x08c5('0x26')];}}}}if(!_0x3b3dba){logger[_0x08c5('0x27')]('['+[_0x14a34d[_0x08c5('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x51155b[_0x08c5('0x28')]=_0x2d33b7['username'];for(_0xf55bae=0x0;_0xf55bae<_0x2aeb47['length'];_0xf55bae++){if(_0x2aeb47[_0xf55bae]['internalemailaddress']===_0x2d33b7[_0x08c5('0x13')]){_0x51155b[_0x08c5('0x29')]=_0x2aeb47[_0xf55bae]['systemuserid'];}}}_0xf01510(_0x51155b);})[_0x08c5('0x18')](function(_0x2f6b2f){_0x1d966f(_0x2f6b2f[_0x08c5('0x1b')]);});});}function createEndUser(_0x18a241,_0x2385c3,_0x2ae07b,_0xd7406f,_0x5c5954,_0x3157aa,_0x32b95e){return new Promise(function(_0x7596dc,_0x16932c){return getAuthToken(_0x2385c3,_0x2ae07b,_0x3157aa)[_0x08c5('0x16')](function(_0x5e0ca1){var _0x41fe55=_0x3157aa[_0x08c5('0x2a')]()===_0x08c5('0x2b')?_0x5c5954[_0x08c5('0x2c')]:_0x5c5954[_0x08c5('0x2d')];var _0x26cf63={'method':_0x08c5('0x11'),'uri':_0xd7406f+_0x08c5('0x2e'),'body':{'fullname':_0x41fe55,'firstname':_0x41fe55,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x08c5('0x2f')+_0x18a241[_0x08c5('0x29')]+')'},'headers':{'Authorization':_0x08c5('0x1d')+_0x5e0ca1,'OData-Version':_0x08c5('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x26cf63[_0x08c5('0x30')][_0x32b95e]=_0x41fe55;return rp(_0x26cf63);})[_0x08c5('0x16')](function(_0x598f43){var _0x52319d=_0x598f43[_0x08c5('0x31')][_0x08c5('0x32')];var _0x576bab=_0x52319d[_0x08c5('0x33')](_0x52319d[_0x08c5('0x34')]('(')+0x1,_0x52319d['lastIndexOf'](')'));_0x18a241[_0x08c5('0x35')]=_0x576bab;_0x7596dc(_0x18a241);})[_0x08c5('0x18')](function(_0x538811){_0x16932c(_0x538811[_0x08c5('0x1b')]);});});}function getEndUser(_0x28b38b,_0x1051bf,_0x3d0ab3,_0x2af3f3,_0x9c56f5,_0x2302e0,_0x5d1ff3,_0x7623c9){var _0x418315=_0x2302e0[_0x08c5('0x2a')]()===_0x08c5('0x2b')?_0x9c56f5['destcalleridnum']:_0x9c56f5[_0x08c5('0x2d')];return getAuthToken(_0x1051bf,_0x3d0ab3,_0x2302e0)[_0x08c5('0x16')](function(_0x16a09c){_0x7623c9=_0x7623c9?_0x7623c9:'telephone1';var _0x147d17={'method':_0x08c5('0x36'),'uri':_0x2af3f3+_0x08c5('0x37')+_0x7623c9+_0x08c5('0x38')+_0x7623c9+_0x08c5('0x39')+_0x418315['replace']('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x16a09c,'If-None-Match':null,'OData-Version':_0x08c5('0x1e')},'json':!![]};return rp(_0x147d17);})[_0x08c5('0x16')](function(_0x3ea29a){var _0x39b3fe=![];if(!_0x3ea29a)return _0x39b3fe;var _0x2188ab=_0x3ea29a[_0x08c5('0x1f')];for(var _0x4ae50f=0x0;_0x4ae50f<_0x2188ab[_0x08c5('0x23')];_0x4ae50f++){if(_0x2188ab[_0x4ae50f][_0x7623c9]===_0x418315){_0x39b3fe=!![];_0x28b38b[_0x08c5('0x35')]=_0x2188ab[_0x4ae50f][_0x08c5('0x3a')];}}return _0x39b3fe;})['then'](function(_0x1b8ba4){if(_0x1b8ba4)return _0x28b38b;if(_0x5d1ff3===_0x08c5('0x3b')){logger[_0x08c5('0x27')]('['+[_0x2302e0[_0x08c5('0x19')]()]+_0x08c5('0x3c'));return _0x28b38b;}return createEndUser(_0x28b38b,_0x1051bf,_0x3d0ab3,_0x2af3f3,_0x9c56f5,_0x2302e0,_0x7623c9)['then'](function(_0x1912a1){logger['info']('['+[_0x2302e0[_0x08c5('0x19')]()]+_0x08c5('0x3d'),_0x1912a1[_0x08c5('0x35')]);return _0x1912a1;});});}function getCustomFields(_0xec91c7,_0x449579,_0x5ac807){var _0x5e969c={};if(_0xec91c7['length']>0x0){_['forEach'](_0xec91c7,function(_0x49c84d){if(_['includes']([_0x08c5('0x3e'),'picklist'],_0x49c84d[_0x08c5('0x3f')])&&_0x49c84d[_0x08c5('0x40')]&&!_0x49c84d[_0x08c5('0x41')]){var _0x3350ce=_0x49c84d[_0x08c5('0x42')][_0x08c5('0x2a')]();var _0x1ce9b5=_0x3350ce[_0x08c5('0x33')](0x0,_0x3350ce[_0x08c5('0x43')]('_'));var _0x39afb7=_0x3350ce[_0x08c5('0x33')](_0x3350ce[_0x08c5('0x43')]('_')+0x1);if(_0x1ce9b5===_0x5ac807){_0x5e969c[_0x39afb7]=_0x49c84d[_0x08c5('0x44')];}}});}return _0x5e969c;}function getTicket(_0x1d4c43,_0x517d5c,_0x361e40,_0x3a15d2,_0x13864a,_0xce63fd,_0x406db1){return new Promise(function(_0x2eb235,_0x12145a){var _0x3d29ae;return getAuthToken(_0x517d5c,_0x361e40,_0x406db1)[_0x08c5('0x16')](function(_0x5912dc){if(_0xce63fd['ticketType']===_0x08c5('0x45')){_0x3d29ae={'method':_0x08c5('0x11'),'uri':_0x3a15d2+'incidents','body':Object[_0x08c5('0x46')]({},{'title':intUtil[_0x08c5('0x47')](_0xce63fd[_0x08c5('0x48')],_0x13864a,'\x20'),'description':intUtil[_0x08c5('0x47')](_0xce63fd[_0x08c5('0x49')],_0x13864a,'\x0a'),'customerid_contact@odata.bind':_0x1d4c43[_0x08c5('0x35')]?_0x08c5('0x4a')+_0x1d4c43['enduserId']+')':undefined,'ownerid@odata.bind':_0x08c5('0x2f')+_0x1d4c43[_0x08c5('0x29')]+')','caseorigincode':'1'},getCustomFields(_0xce63fd[_0x08c5('0x4b')],_0x13864a,_0xce63fd[_0x08c5('0x4c')])),'headers':{'Authorization':_0x08c5('0x1d')+_0x5912dc,'OData-Version':_0x08c5('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xce63fd['ticketType']===_0x08c5('0x4d')){var _0x8fa00d=_0x1d4c43[_0x08c5('0x35')]?[{'partyid_systemuser@odata.bind':_0x08c5('0x2f')+_0x1d4c43[_0x08c5('0x29')]+')','participationtypemask':_0x1d4c43['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x08c5('0x4a')+_0x1d4c43['enduserId']+')','participationtypemask':_0x1d4c43['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1d4c43[_0x08c5('0x29')]+')','participationtypemask':_0x1d4c43[_0x08c5('0x4e')]===_0x08c5('0x4f')?0x2:0x1}];_0x3d29ae={'method':_0x08c5('0x11'),'uri':_0x3a15d2+_0x08c5('0x50'),'body':Object['assign']({},{'subject':intUtil[_0x08c5('0x47')](_0xce63fd['Subjects'],_0x13864a,'\x20'),'phonenumber':String(_0x13864a['calleridnum']),'description':intUtil[_0x08c5('0x47')](_0xce63fd[_0x08c5('0x49')],_0x13864a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1d4c43[_0x08c5('0x35')]?'/contacts('+_0x1d4c43[_0x08c5('0x35')]+')':undefined,'ownerid@odata.bind':_0x08c5('0x2f')+_0x1d4c43[_0x08c5('0x29')]+')','directioncode':_0x1d4c43[_0x08c5('0x4e')]===_0x08c5('0x4f')?![]:!![],'phonecall_activity_parties':_0x8fa00d},getCustomFields(_0xce63fd[_0x08c5('0x4b')],_0x13864a,_0xce63fd[_0x08c5('0x4c')])),'headers':{'Authorization':_0x08c5('0x1d')+_0x5912dc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3d29ae);})[_0x08c5('0x16')](function(_0x10c25e){var _0x13aa9a=_0x10c25e[_0x08c5('0x31')][_0x08c5('0x32')];var _0x34f333=_0x13aa9a[_0x08c5('0x33')](_0x13aa9a[_0x08c5('0x34')]('(')+0x1,_0x13aa9a[_0x08c5('0x34')](')'));_0x1d4c43[_0x08c5('0x51')]=_0x34f333;_0x2eb235(_0x1d4c43);})[_0x08c5('0x18')](function(_0x931432){_0x12145a(_0x931432[_0x08c5('0x1b')]);});});}function emit(_0x1e5505,_0x21dcad,_0x212a80,_0x233b5a){var _0xf68241={'uri':util['format'](_0x08c5('0x52'),_0x1e5505,_0x212a80,_0x233b5a)};io['to'](util[_0x08c5('0x53')](_0x08c5('0x54'),_0x21dcad))[_0x08c5('0x55')]('trigger:browser:url',_0xf68241);}exports['cs']=function(_0x283c69,_0x2efb06,_0x54cec1,_0x180905,_0x272f1d,_0x209cbe,_0x38d6e5,_0x271e6){var _0x4d7623={};_0x209cbe[_0x08c5('0xd')]=_0x209cbe['modernAuthentication']?intUtil[_0x08c5('0x56')](_0x209cbe['CloudProvider'][_0x08c5('0x57')]):intUtil[_0x08c5('0x56')](_0x209cbe[_0x08c5('0xd')]);_0x209cbe[_0x08c5('0x58')]=intUtil['stripTrailingSlash'](_0x209cbe[_0x08c5('0x58')]);_0x4d7623[_0x08c5('0x4e')]=_0x271e6==='queue'||_0x271e6==='unmanaged'?_0x08c5('0x4f'):_0x08c5('0x2b');var _0xa2ea5b=_0x209cbe[_0x08c5('0xc')]?util[_0x08c5('0x53')](_0x08c5('0x59'),_0x209cbe[_0x08c5('0xe')][_0x08c5('0x57')]):util[_0x08c5('0x53')](_0x08c5('0x59'),_0x209cbe[_0x08c5('0xd')]);var _0x1818b9=util[_0x08c5('0x53')](_0x08c5('0x5a'),_0x209cbe[_0x08c5('0xf')]);var _0x340662=util[_0x08c5('0x53')](_0x08c5('0x5b'),_0x209cbe['serverUrl'],_0x2efb06['uniqueid'],md5(_0x2efb06[_0x08c5('0x5c')]));if(_0x272f1d&&_0x272f1d['monitor_format']){logger[_0x08c5('0x27')](_0x08c5('0x5d'),'Recording\x20is\x20enabled!');_0x2efb06[_0x08c5('0x5e')]=_0x340662;}else if(_0x38d6e5&&_0x38d6e5[_0x08c5('0x5f')]&&_0x38d6e5[_0x08c5('0x5f')]!==_0x08c5('0x60')){logger[_0x08c5('0x27')](_0x08c5('0x61'),_0x08c5('0x62'));_0x2efb06[_0x08c5('0x5e')]=_0x340662;}else{_0x2efb06['recordingURL']='';}return getUser(_0x4d7623,_0x209cbe,_0x180905,_0x1818b9,_0xa2ea5b,_0x271e6)[_0x08c5('0x16')](function(_0x37cf72){logger[_0x08c5('0x27')]('['+_0x271e6[_0x08c5('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x37cf72[_0x08c5('0x29')]);logger['info']('['+_0x271e6[_0x08c5('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x37cf72['userEmail']);return getEndUser(_0x37cf72,_0x209cbe,_0x1818b9,_0xa2ea5b,_0x2efb06,_0x271e6,_0x54cec1[_0x08c5('0x63')],_0x54cec1[_0x08c5('0x64')]);})[_0x08c5('0x16')](function(_0x52410a){logger[_0x08c5('0x27')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x65'),_0x52410a['enduserId']);logger[_0x08c5('0x27')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x66'),_0x2efb06[_0x08c5('0x2d')]);return getTicket(_0x52410a,_0x209cbe,_0x1818b9,_0xa2ea5b,_0x2efb06,_0x54cec1,_0x271e6);})['then'](function(_0x4905b4){logger[_0x08c5('0x27')](util[_0x08c5('0x53')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x67'),_0x54cec1['ticketType'],_0x4905b4[_0x08c5('0x51')]));logger[_0x08c5('0x27')](util[_0x08c5('0x53')]('['+_0x271e6[_0x08c5('0x19')]()+']\x20Call\x20direction:\x20%s',_0x271e6));if(_0x271e6!=='unmanaged'&&_0x54cec1['openNewTab']){logger['info']('['+_0x271e6[_0x08c5('0x19')]()+']',_0x08c5('0x68'));emit(_0x209cbe[_0x08c5('0xd')],_0x180905[_0x08c5('0x69')],_0x54cec1['ticketType'],_0x4905b4['ticketId']);}})[_0x08c5('0x18')](function(_0x1c07ae){logger[_0x08c5('0x6a')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x6b'),_0x1c07ae[_0x08c5('0x1b')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x1c07ae);});}; \ 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 28e0909..adbd8f1 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 _0x7a8e=['Ticket\x20created!','validateEmail','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','apiKey','base64','debug','stringify','GET','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','toString','variable','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','error','outbound','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','request-promise','md5','util','./util','../../../../config/environment','freshdesk','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','then'];(function(_0x500bc6,_0x3a52e1){var _0xc1ad5c=function(_0x2c0198){while(--_0x2c0198){_0x500bc6['push'](_0x500bc6['shift']());}};_0xc1ad5c(++_0x3a52e1);}(_0x7a8e,0x1ef));var _0xe7a8=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x7a8e[_0x1f7839];return _0x36b42e;};'use strict';var _=require('lodash');var rp=require(_0xe7a8('0x0'));var md5=require(_0xe7a8('0x1'));var util=require(_0xe7a8('0x2'));var Redis=require('ioredis');var intUtil=require(_0xe7a8('0x3'));var config=require(_0xe7a8('0x4'));var logger=require('../../../../config/logger')(_0xe7a8('0x5'));config[_0xe7a8('0x6')]=_['defaults'](config['redis'],{'host':_0xe7a8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7a8('0x6')]));var headers={'Content-Type':'application/json','Accept':_0xe7a8('0x8')};function emit(_0x53497,_0x2f9840,_0x1719dd){io['to'](_0x53497)[_0xe7a8('0x9')](_0x2f9840,_0x1719dd);}function getTicket(_0x87fde5,_0x7334a0,_0x232dae,_0x12e618,_0x37e79f){logger[_0xe7a8('0xa')](_0xe7a8('0xb'));var _0x29fb1d=_[_0xe7a8('0xc')]({'responder_id':_0x7334a0['id'],'requester_id':_0x232dae['id'],'name':util[_0xe7a8('0xd')](_0xe7a8('0xe'),_0x37e79f[_0xe7a8('0xf')]),'phone':_0x37e79f[_0xe7a8('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe7a8('0x11')](_0x12e618['Subjects'],_0x37e79f,'\x20'),'description':intUtil[_0xe7a8('0x11')](_0x12e618['Descriptions'],_0x37e79f,_0xe7a8('0x12')),'tags':getTags(_0x12e618[_0xe7a8('0x13')],_0xe7a8('0x14'))},getCustomFields(_0x12e618['Fields'],_0x37e79f));_0x29fb1d[_0xe7a8('0x15')]=_[_0xe7a8('0x16')](_['keyBy'](_0x29fb1d[_0xe7a8('0x15')],'id'),_0xe7a8('0x17'));return request({'uri':util[_0xe7a8('0xd')](_0xe7a8('0x18'),_0x87fde5[_0xe7a8('0x19')]),'method':'POST','body':_0x29fb1d})[_0xe7a8('0x1a')](function(_0x113932){logger['info'](_0xe7a8('0x1b'));return _0x113932;});}function getUser(_0x5810f3,_0x209a93){if(intUtil[_0xe7a8('0x1c')](_0x209a93)){return request({'uri':util[_0xe7a8('0xd')]('%s/api/v2/agents',_0x5810f3['remoteUri']),'qs':{'email':_0x209a93}})['then'](function(_0x34a2b4){if(_0x34a2b4[_0xe7a8('0x1d')]){logger[_0xe7a8('0xa')](_0xe7a8('0x1e'));return _[_0xe7a8('0x1f')](_0x34a2b4,function(_0x167aec){return _0x167aec['contact'][_0xe7a8('0x20')]===_0x209a93;});}else{logger[_0xe7a8('0xa')](_0xe7a8('0x21'));return request({'uri':util['format'](_0xe7a8('0x22'),_0x5810f3[_0xe7a8('0x19')])})[_0xe7a8('0x1a')](function(_0x53d620){logger['info']('Admin\x20account\x20selected.');return _0x53d620;});}});}else{logger[_0xe7a8('0xa')](_0xe7a8('0x23'));return request({'uri':util[_0xe7a8('0xd')](_0xe7a8('0x22'),_0x5810f3[_0xe7a8('0x19')])})['then'](function(_0x50081f){logger[_0xe7a8('0xa')](_0xe7a8('0x24'));return _0x50081f;});}}function getEndUser(_0x2bacc6,_0x517659,_0x3e9c58){logger['info'](_0xe7a8('0x25'),_0x3e9c58);return request({'uri':util['format'](_0xe7a8('0x26'),_0x2bacc6[_0xe7a8('0x19')]),'qs':{'phone':_0x3e9c58}})[_0xe7a8('0x1a')](function(_0x47a2df){if(_0x47a2df[_0xe7a8('0x1d')]){logger[_0xe7a8('0xa')]('Enduser\x20found!');return _[_0xe7a8('0x1f')](_0x47a2df,{'phone':_0x3e9c58});}else{logger[_0xe7a8('0xa')](_0xe7a8('0x27'));return request({'uri':util[_0xe7a8('0xd')](_0xe7a8('0x26'),_0x2bacc6[_0xe7a8('0x19')]),'method':_0xe7a8('0x28'),'body':{'name':_0x517659,'phone':_0x3e9c58}})[_0xe7a8('0x1a')](function(_0x52e16b){logger[_0xe7a8('0xa')]('Enduser\x20created.');return _0x52e16b;});}});}function getAuth(_0x1e954d){return util['format']('Basic\x20%s',new Buffer(_0x1e954d[_0xe7a8('0x29')]+':X')['toString'](_0xe7a8('0x2a')));}function request(_0x23ff35){logger[_0xe7a8('0x2b')]('[HTTP]',JSON[_0xe7a8('0x2c')](_0x23ff35));return rp(_['defaults'](_0x23ff35,{'method':_0xe7a8('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x128035,_0x243aa9){var _0x331988=[];if(_0x128035&&_0x128035[_0xe7a8('0x1d')]>0x0){_0x331988=_['map'](_0x128035,_0x243aa9);}return _0x331988;}function getCustomFields(_0x1f7d7d,_0x379983){var _0x5c02c0=[];var _0x5749e8={'custom_fields':[]};if(_0x1f7d7d[_0xe7a8('0x1d')]>0x0){_[_0xe7a8('0x2e')](_0x1f7d7d,function(_0x5e5eca){if(_[_0xe7a8('0x2f')]([_0xe7a8('0x30'),'picklist'],_0x5e5eca[_0xe7a8('0x31')])&&_0x5e5eca[_0xe7a8('0x32')]&&!_0x5e5eca[_0xe7a8('0x33')]){_0x5749e8[_0x5e5eca[_0xe7a8('0x32')][_0xe7a8('0x34')]()]=_0x5e5eca[_0xe7a8('0x35')]['toString']();}else if(_[_0xe7a8('0x2f')](['string',_0xe7a8('0x36')],_0x5e5eca['type'])&&_0x5e5eca['idField']&&_0x5e5eca['customField']){_0x5749e8[_0xe7a8('0x15')]['push']({'id':_0x5e5eca[_0xe7a8('0x37')],'value':_0x5e5eca[_0xe7a8('0x35')][_0xe7a8('0x38')]()});}else if(_0x5e5eca[_0xe7a8('0x31')]===_0xe7a8('0x39')&&_0x5e5eca['variableName']&&_0x5e5eca[_0xe7a8('0x37')]&&_0x5e5eca[_0xe7a8('0x33')]){_0x379983[_0x5e5eca['variableName']]&&_0x5749e8[_0xe7a8('0x15')][_0xe7a8('0x3a')]({'id':_0x5e5eca[_0xe7a8('0x37')],'value':_0x379983[_0x5e5eca[_0xe7a8('0x3b')]][_0xe7a8('0x38')]()});}else if(_0x5e5eca[_0xe7a8('0x31')]==='customVariable'&&_0x5e5eca[_0xe7a8('0x3c')]&&_0x5e5eca[_0xe7a8('0x3c')][_0xe7a8('0x14')]&&_0x5e5eca[_0xe7a8('0x37')]&&_0x5e5eca[_0xe7a8('0x33')]){_0x379983[_0x5e5eca[_0xe7a8('0x3c')]['name'][_0xe7a8('0x34')]()]&&_0x5749e8[_0xe7a8('0x15')][_0xe7a8('0x3a')]({'id':_0x5e5eca[_0xe7a8('0x37')],'value':_0x379983[_0x5e5eca[_0xe7a8('0x3c')][_0xe7a8('0x14')]['toLowerCase']()][_0xe7a8('0x38')]()});}});}return _0x5749e8;}exports[_0xe7a8('0x3d')]=function(_0x2f0a2c,_0x1e3095,_0x2b49c9,_0x1379a9,_0x1d3296,_0x24d88d){var _0xb90014,_0xd7b975;_0x24d88d[_0xe7a8('0x19')]=intUtil[_0xe7a8('0x3e')](_0x24d88d[_0xe7a8('0x19')]);_0x24d88d[_0xe7a8('0x3f')]=intUtil[_0xe7a8('0x3e')](_0x24d88d['serverUrl']);if(_0x1d3296&&_0x1d3296[_0xe7a8('0x40')]){logger[_0xe7a8('0xa')](_0xe7a8('0x41'),_0xe7a8('0x42'));_0x1e3095[_0xe7a8('0x43')]=util['format'](_0xe7a8('0x44'),_0x24d88d['serverUrl'],_0x1e3095['uniqueid'],md5(_0x1e3095[_0xe7a8('0x45')]));}else{_0x1e3095[_0xe7a8('0x43')]='';}headers['Authorization']=getAuth(_0x24d88d);return getUser(_0x24d88d,_0x1379a9['email'])['then'](function(_0x18abd0){_0xb90014=_0x18abd0;logger[_0xe7a8('0xa')]('The\x20User\x20ID\x20is:',_0xb90014['id']);return getEndUser(_0x24d88d,_0x1e3095[_0xe7a8('0xf')],_0x1e3095[_0xe7a8('0x10')]);})[_0xe7a8('0x1a')](function(_0x56e657){_0xd7b975=_0x56e657;logger[_0xe7a8('0xa')](_0xe7a8('0x46'),_0xd7b975['id']);return getTicket(_0x24d88d,_0xb90014,_0xd7b975,_0x2b49c9,_0x1e3095);})[_0xe7a8('0x1a')](function(_0x1b738b){if(_0x1b738b&&_0x1b738b['id']){logger[_0xe7a8('0xa')](_0xe7a8('0x1b'));logger[_0xe7a8('0xa')](_0xe7a8('0x47'),_0x1b738b['id']);logger['info'](_0xe7a8('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe7a8('0xd')]('user:%s',_0x1379a9['name']),'trigger:browser:url',{'uri':util[_0xe7a8('0xd')](_0xe7a8('0x48'),_0x24d88d['remoteUri'],_0x1b738b['id'])});}})['catch'](function(_0x360f60){logger[_0xe7a8('0x49')](_0xe7a8('0x41'),JSON[_0xe7a8('0x2c')](_0x360f60));});};exports[_0xe7a8('0x4a')]=function(_0x43c297,_0x4849a4,_0x558c24,_0x35f830,_0x4b88f2,_0xfcd164,_0xed3a02){var _0x4b5275,_0x2f955f;_0xfcd164[_0xe7a8('0x19')]=intUtil[_0xe7a8('0x3e')](_0xfcd164[_0xe7a8('0x19')]);_0xfcd164['serverUrl']=intUtil[_0xe7a8('0x3e')](_0xfcd164[_0xe7a8('0x3f')]);if(_0xed3a02&&_0xed3a02['recordingFormat']&&_0xed3a02['recordingFormat']!==_0xe7a8('0x4b')){logger[_0xe7a8('0xa')](_0xe7a8('0x4c'),_0xe7a8('0x42'));_0x4849a4[_0xe7a8('0x43')]=util[_0xe7a8('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfcd164[_0xe7a8('0x3f')],_0x4849a4['uniqueid'],md5(_0x4849a4[_0xe7a8('0x45')]));}headers[_0xe7a8('0x4d')]=getAuth(_0xfcd164);return getUser(_0xfcd164,_0x35f830[_0xe7a8('0x20')])[_0xe7a8('0x1a')](function(_0x39c2a6){_0x4b5275=_0x39c2a6;logger[_0xe7a8('0xa')](_0xe7a8('0x4e'),_0x4b5275['id']);return getEndUser(_0xfcd164,_0x4849a4[_0xe7a8('0x4f')],_0x4849a4['destcalleridnum']);})[_0xe7a8('0x1a')](function(_0x5bd9b0){_0x2f955f=_0x5bd9b0;logger[_0xe7a8('0xa')](_0xe7a8('0x46'),_0x2f955f['id']);return getTicket(_0xfcd164,_0x4b5275,_0x2f955f,_0x558c24,_0x4849a4);})[_0xe7a8('0x1a')](function(_0x4083ae){if(_0x4083ae&&_0x4083ae['id']){logger['info'](_0xe7a8('0x1b'));logger[_0xe7a8('0xa')](_0xe7a8('0x47'),_0x4083ae['id']);logger[_0xe7a8('0xa')](_0xe7a8('0x4c'),_0xe7a8('0x50'));emit(util[_0xe7a8('0xd')](_0xe7a8('0x51'),_0x35f830[_0xe7a8('0x14')]),_0xe7a8('0x52'),{'uri':util[_0xe7a8('0xd')](_0xe7a8('0x48'),_0xfcd164[_0xe7a8('0x19')],_0x4083ae['id'])});}})[_0xe7a8('0x53')](function(_0x43e847){logger[_0xe7a8('0x49')](_0xe7a8('0x4c'),JSON[_0xe7a8('0x2c')](_0x43e847));});};exports[_0xe7a8('0x54')]=function(_0x42d1e7,_0x3fc2f0,_0x28df99,_0xb7f08c,_0x172674,_0x462660){var _0x987df,_0x8c4995;_0x462660[_0xe7a8('0x19')]=intUtil[_0xe7a8('0x3e')](_0x462660['remoteUri']);_0x462660['serverUrl']=intUtil['stripTrailingSlash'](_0x462660[_0xe7a8('0x3f')]);if(_0x172674&&_0x172674[_0xe7a8('0x40')]){logger[_0xe7a8('0xa')]('['+_0x3fc2f0[_0xe7a8('0x55')][_0xe7a8('0x56')]()+']',_0xe7a8('0x42'));_0x3fc2f0['recordingURL']=util[_0xe7a8('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x462660['serverUrl'],_0x3fc2f0[_0xe7a8('0x45')],md5(_0x3fc2f0[_0xe7a8('0x45')]));}else{_0x3fc2f0[_0xe7a8('0x43')]='';}headers[_0xe7a8('0x4d')]=getAuth(_0x462660);return getUser(_0x462660,'')['then'](function(_0x206128){_0x987df=_0x206128;logger[_0xe7a8('0xa')]('The\x20User\x20ID\x20is:',_0x987df['id']);return getEndUser(_0x462660,_0x3fc2f0[_0xe7a8('0xf')],_0x3fc2f0[_0xe7a8('0x10')]);})['then'](function(_0x1bd63d){_0x8c4995=_0x1bd63d;logger[_0xe7a8('0xa')]('The\x20Enduser\x20ID\x20is:',_0x8c4995['id']);return getTicket(_0x462660,_0x987df,_0x8c4995,_0x28df99,_0x3fc2f0);})[_0xe7a8('0x1a')](function(_0x63bd57){if(_0x63bd57){logger[_0xe7a8('0xa')](_0xe7a8('0x1b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x63bd57['id']);}})['catch'](function(_0x6fd6e){logger[_0xe7a8('0x49')]('['+_0x3fc2f0[_0xe7a8('0x55')][_0xe7a8('0x56')]()+']',JSON[_0xe7a8('0x2c')](_0x6fd6e));});}; \ No newline at end of file +var _0x5155=['email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','toString','base64','[HTTP]','GET','forEach','includes','string','picklist','type','nameField','content','idField','customField','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact'];(function(_0x2573c8,_0x12f21a){var _0x5bcc97=function(_0x4dfb14){while(--_0x4dfb14){_0x2573c8['push'](_0x2573c8['shift']());}};_0x5bcc97(++_0x12f21a);}(_0x5155,0x1aa));var _0x5515=function(_0x57c972,_0x510be5){_0x57c972=_0x57c972-0x0;var _0x2c5861=_0x5155[_0x57c972];return _0x2c5861;};'use strict';var _=require('lodash');var rp=require(_0x5515('0x0'));var md5=require(_0x5515('0x1'));var util=require(_0x5515('0x2'));var Redis=require(_0x5515('0x3'));var intUtil=require(_0x5515('0x4'));var config=require(_0x5515('0x5'));var logger=require(_0x5515('0x6'))(_0x5515('0x7'));config[_0x5515('0x8')]=_[_0x5515('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5515('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x5515('0xb'),'Accept':_0x5515('0xb')};function emit(_0x627c12,_0x51c9d9,_0x560a59){io['to'](_0x627c12)[_0x5515('0xc')](_0x51c9d9,_0x560a59);}function getTicket(_0x2ac893,_0x440318,_0x166915,_0x39417f,_0x37ce74){logger[_0x5515('0xd')](_0x5515('0xe'));var _0x2f5c1f=_[_0x5515('0xf')]({'responder_id':_0x440318['id'],'requester_id':_0x166915['id'],'name':util[_0x5515('0x10')](_0x5515('0x11'),_0x37ce74[_0x5515('0x12')]),'phone':_0x37ce74[_0x5515('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x39417f['Subjects'],_0x37ce74,'\x20'),'description':intUtil[_0x5515('0x14')](_0x39417f['Descriptions'],_0x37ce74,_0x5515('0x15')),'tags':getTags(_0x39417f[_0x5515('0x16')],_0x5515('0x17'))},getCustomFields(_0x39417f[_0x5515('0x18')],_0x37ce74));_0x2f5c1f[_0x5515('0x19')]=_[_0x5515('0x1a')](_[_0x5515('0x1b')](_0x2f5c1f[_0x5515('0x19')],'id'),'value');return request({'uri':util['format'](_0x5515('0x1c'),_0x2ac893[_0x5515('0x1d')]),'method':_0x5515('0x1e'),'body':_0x2f5c1f})[_0x5515('0x1f')](function(_0x265f39){logger[_0x5515('0xd')](_0x5515('0x20'));return _0x265f39;});}function getUser(_0xa03be7,_0x55e611){if(intUtil[_0x5515('0x21')](_0x55e611)){return request({'uri':util[_0x5515('0x10')](_0x5515('0x22'),_0xa03be7[_0x5515('0x1d')]),'qs':{'email':_0x55e611}})[_0x5515('0x1f')](function(_0xec3ad1){if(_0xec3ad1[_0x5515('0x23')]){logger[_0x5515('0xd')](_0x5515('0x24'));return _[_0x5515('0x25')](_0xec3ad1,function(_0x2b8abf){return _0x2b8abf[_0x5515('0x26')][_0x5515('0x27')]===_0x55e611;});}else{logger['info'](_0x5515('0x28'));return request({'uri':util[_0x5515('0x10')]('%s/api/v2/agents/me',_0xa03be7[_0x5515('0x1d')])})['then'](function(_0x56a17f){logger[_0x5515('0xd')](_0x5515('0x29'));return _0x56a17f;});}});}else{logger['info'](_0x5515('0x2a'));return request({'uri':util[_0x5515('0x10')](_0x5515('0x2b'),_0xa03be7[_0x5515('0x1d')])})[_0x5515('0x1f')](function(_0x1dedbc){logger[_0x5515('0xd')]('Admin\x20account\x20selected.');return _0x1dedbc;});}}function getEndUser(_0xbb38e3,_0x543f49,_0x2ddba9){logger[_0x5515('0xd')](_0x5515('0x2c'),_0x2ddba9);return request({'uri':util[_0x5515('0x10')](_0x5515('0x2d'),_0xbb38e3[_0x5515('0x1d')]),'qs':{'phone':_0x2ddba9}})[_0x5515('0x1f')](function(_0x5ac11b){if(_0x5ac11b[_0x5515('0x23')]){logger['info'](_0x5515('0x2e'));return _[_0x5515('0x25')](_0x5ac11b,{'phone':_0x2ddba9});}else{logger[_0x5515('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x5515('0x2d'),_0xbb38e3['remoteUri']),'method':_0x5515('0x1e'),'body':{'name':_0x543f49,'phone':_0x2ddba9}})[_0x5515('0x1f')](function(_0x57e783){logger['info']('Enduser\x20created.');return _0x57e783;});}});}function getAuth(_0x18d92e){return util['format'](_0x5515('0x2f'),new Buffer(_0x18d92e['apiKey']+':X')[_0x5515('0x30')](_0x5515('0x31')));}function request(_0x3a48f5){logger['debug'](_0x5515('0x32'),JSON['stringify'](_0x3a48f5));return rp(_[_0x5515('0x9')](_0x3a48f5,{'method':_0x5515('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x53e2b6,_0x4b9948){var _0x4e0c33=[];if(_0x53e2b6&&_0x53e2b6[_0x5515('0x23')]>0x0){_0x4e0c33=_['map'](_0x53e2b6,_0x4b9948);}return _0x4e0c33;}function getCustomFields(_0x2e8d4f,_0x46561e){var _0x88b16=[];var _0x5eea89={'custom_fields':[]};if(_0x2e8d4f[_0x5515('0x23')]>0x0){_[_0x5515('0x34')](_0x2e8d4f,function(_0x2ca3c4){if(_[_0x5515('0x35')]([_0x5515('0x36'),_0x5515('0x37')],_0x2ca3c4[_0x5515('0x38')])&&_0x2ca3c4[_0x5515('0x39')]&&!_0x2ca3c4['customField']){_0x5eea89[_0x2ca3c4[_0x5515('0x39')]['toLowerCase']()]=_0x2ca3c4[_0x5515('0x3a')][_0x5515('0x30')]();}else if(_[_0x5515('0x35')]([_0x5515('0x36'),'picklist'],_0x2ca3c4[_0x5515('0x38')])&&_0x2ca3c4[_0x5515('0x3b')]&&_0x2ca3c4[_0x5515('0x3c')]){_0x5eea89['custom_fields']['push']({'id':_0x2ca3c4[_0x5515('0x3b')],'value':_0x2ca3c4[_0x5515('0x3a')][_0x5515('0x30')]()});}else if(_0x2ca3c4[_0x5515('0x38')]==='variable'&&_0x2ca3c4[_0x5515('0x3d')]&&_0x2ca3c4['idField']&&_0x2ca3c4[_0x5515('0x3c')]){_0x46561e[_0x2ca3c4[_0x5515('0x3d')]]&&_0x5eea89['custom_fields'][_0x5515('0x3e')]({'id':_0x2ca3c4['idField'],'value':_0x46561e[_0x2ca3c4[_0x5515('0x3d')]][_0x5515('0x30')]()});}else if(_0x2ca3c4['type']===_0x5515('0x3f')&&_0x2ca3c4[_0x5515('0x40')]&&_0x2ca3c4[_0x5515('0x40')][_0x5515('0x17')]&&_0x2ca3c4[_0x5515('0x3b')]&&_0x2ca3c4[_0x5515('0x3c')]){_0x46561e[_0x2ca3c4[_0x5515('0x40')][_0x5515('0x17')][_0x5515('0x41')]()]&&_0x5eea89[_0x5515('0x19')]['push']({'id':_0x2ca3c4['idField'],'value':_0x46561e[_0x2ca3c4['Variable'][_0x5515('0x17')][_0x5515('0x41')]()][_0x5515('0x30')]()});}});}return _0x5eea89;}exports[_0x5515('0x42')]=function(_0x2d4657,_0x3b24fe,_0x3a01c7,_0x41ac82,_0x29af96,_0x4becf2){var _0x2ac79c,_0x5e247a;_0x4becf2[_0x5515('0x1d')]=intUtil[_0x5515('0x43')](_0x4becf2[_0x5515('0x1d')]);_0x4becf2['serverUrl']=intUtil[_0x5515('0x43')](_0x4becf2[_0x5515('0x44')]);if(_0x29af96&&_0x29af96[_0x5515('0x45')]){logger['info'](_0x5515('0x46'),_0x5515('0x47'));_0x3b24fe[_0x5515('0x48')]=util[_0x5515('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4becf2[_0x5515('0x44')],_0x3b24fe[_0x5515('0x49')],md5(_0x3b24fe[_0x5515('0x49')]));}else{_0x3b24fe[_0x5515('0x48')]='';}headers[_0x5515('0x4a')]=getAuth(_0x4becf2);return getUser(_0x4becf2,_0x41ac82['email'])[_0x5515('0x1f')](function(_0x13c4a1){_0x2ac79c=_0x13c4a1;logger[_0x5515('0xd')]('The\x20User\x20ID\x20is:',_0x2ac79c['id']);return getEndUser(_0x4becf2,_0x3b24fe['calleridname'],_0x3b24fe[_0x5515('0x13')]);})['then'](function(_0x4b5ecd){_0x5e247a=_0x4b5ecd;logger[_0x5515('0xd')](_0x5515('0x4b'),_0x5e247a['id']);return getTicket(_0x4becf2,_0x2ac79c,_0x5e247a,_0x3a01c7,_0x3b24fe);})['then'](function(_0x2e59a2){if(_0x2e59a2&&_0x2e59a2['id']){logger['info'](_0x5515('0x20'));logger['info'](_0x5515('0x4c'),_0x2e59a2['id']);logger[_0x5515('0xd')](_0x5515('0x46'),_0x5515('0x4d'));emit(util['format'](_0x5515('0x4e'),_0x41ac82[_0x5515('0x17')]),_0x5515('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4becf2[_0x5515('0x1d')],_0x2e59a2['id'])});}})[_0x5515('0x50')](function(_0x22a993){logger[_0x5515('0x51')](_0x5515('0x46'),JSON[_0x5515('0x52')](_0x22a993));});};exports[_0x5515('0x53')]=function(_0x37891e,_0x4f7777,_0x436912,_0x99f625,_0x54669e,_0x21ebee,_0x3beb41){var _0x527b68,_0x21c24f;_0x21ebee[_0x5515('0x1d')]=intUtil[_0x5515('0x43')](_0x21ebee[_0x5515('0x1d')]);_0x21ebee[_0x5515('0x44')]=intUtil[_0x5515('0x43')](_0x21ebee[_0x5515('0x44')]);if(_0x3beb41&&_0x3beb41[_0x5515('0x54')]&&_0x3beb41['recordingFormat']!==_0x5515('0x55')){logger[_0x5515('0xd')]('[OUTBOUND]',_0x5515('0x47'));_0x4f7777[_0x5515('0x48')]=util[_0x5515('0x10')](_0x5515('0x56'),_0x21ebee[_0x5515('0x44')],_0x4f7777[_0x5515('0x49')],md5(_0x4f7777[_0x5515('0x49')]));}headers[_0x5515('0x4a')]=getAuth(_0x21ebee);return getUser(_0x21ebee,_0x99f625['email'])[_0x5515('0x1f')](function(_0x50d47f){_0x527b68=_0x50d47f;logger[_0x5515('0xd')](_0x5515('0x57'),_0x527b68['id']);return getEndUser(_0x21ebee,_0x4f7777[_0x5515('0x58')],_0x4f7777['destcalleridnum']);})[_0x5515('0x1f')](function(_0x3f4ed0){_0x21c24f=_0x3f4ed0;logger['info'](_0x5515('0x4b'),_0x21c24f['id']);return getTicket(_0x21ebee,_0x527b68,_0x21c24f,_0x436912,_0x4f7777);})[_0x5515('0x1f')](function(_0x5ec966){if(_0x5ec966&&_0x5ec966['id']){logger[_0x5515('0xd')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5ec966['id']);logger['info'](_0x5515('0x59'),_0x5515('0x4d'));emit(util[_0x5515('0x10')]('user:%s',_0x99f625[_0x5515('0x17')]),'trigger:browser:url',{'uri':util['format'](_0x5515('0x5a'),_0x21ebee[_0x5515('0x1d')],_0x5ec966['id'])});}})[_0x5515('0x50')](function(_0x176a6d){logger['error'](_0x5515('0x59'),JSON[_0x5515('0x52')](_0x176a6d));});};exports[_0x5515('0x5b')]=function(_0x5cdd,_0x1051f0,_0xb24643,_0x58eb4d,_0x510ecc,_0xa72de4){var _0x28bab5,_0x2efb08;_0xa72de4['remoteUri']=intUtil['stripTrailingSlash'](_0xa72de4[_0x5515('0x1d')]);_0xa72de4['serverUrl']=intUtil[_0x5515('0x43')](_0xa72de4[_0x5515('0x44')]);if(_0x510ecc&&_0x510ecc[_0x5515('0x45')]){logger[_0x5515('0xd')]('['+_0x1051f0['lastevent'][_0x5515('0x5c')]()+']',_0x5515('0x47'));_0x1051f0[_0x5515('0x48')]=util[_0x5515('0x10')](_0x5515('0x56'),_0xa72de4[_0x5515('0x44')],_0x1051f0[_0x5515('0x49')],md5(_0x1051f0[_0x5515('0x49')]));}else{_0x1051f0[_0x5515('0x48')]='';}headers['Authorization']=getAuth(_0xa72de4);return getUser(_0xa72de4,'')[_0x5515('0x1f')](function(_0x15a1ad){_0x28bab5=_0x15a1ad;logger['info']('The\x20User\x20ID\x20is:',_0x28bab5['id']);return getEndUser(_0xa72de4,_0x1051f0[_0x5515('0x12')],_0x1051f0[_0x5515('0x13')]);})[_0x5515('0x1f')](function(_0x43b6f6){_0x2efb08=_0x43b6f6;logger[_0x5515('0xd')](_0x5515('0x4b'),_0x2efb08['id']);return getTicket(_0xa72de4,_0x28bab5,_0x2efb08,_0xb24643,_0x1051f0);})[_0x5515('0x1f')](function(_0x2927dd){if(_0x2927dd){logger[_0x5515('0xd')](_0x5515('0x20'));logger[_0x5515('0xd')](_0x5515('0x4c'),_0x2927dd['id']);}})['catch'](function(_0x5a1c82){logger[_0x5515('0x51')]('['+_0x1051f0['lastevent'][_0x5515('0x5c')]()+']',JSON[_0x5515('0x52')](_0x5a1c82));});}; \ 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 73203a3..e693c5a 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 _0x51ab=['bluebird','../../../../config/environment','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','users','agentEmail','userEmail','userId','Admin\x20selected','adminEmail','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','/contacts/','user:%s','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment'];(function(_0x3f7f43,_0x4db88b){var _0x593480=function(_0x46d8a2){while(--_0x46d8a2){_0x3f7f43['push'](_0x3f7f43['shift']());}};_0x593480(++_0x4db88b);}(_0x51ab,0x18b));var _0xb51a=function(_0x5f2313,_0xad7ad1){_0x5f2313=_0x5f2313-0x0;var _0x556cc5=_0x51ab[_0x5f2313];return _0x556cc5;};'use strict';var _=require(_0xb51a('0x0'));var rp=require(_0xb51a('0x1'));var md5=require(_0xb51a('0x2'));var util=require(_0xb51a('0x3'));var moment=require(_0xb51a('0x4'));var Promise=require(_0xb51a('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xb51a('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0xb51a('0x7')]=_['defaults'](config[_0xb51a('0x7')],{'host':_0xb51a('0x8'),'port':0x18eb});var io=require(_0xb51a('0x9'))(new Redis(config[_0xb51a('0x7')]));function getAdminId(_0x119eb8,_0x4fea54,_0x14ce9f,_0xcd2e9b){return new Promise(function(_0x70e345,_0x2202b4){var _0x5edb87=![];var _0x206325={'method':_0xb51a('0xa'),'uri':_0xcd2e9b+_0xb51a('0xb'),'json':!![]};_0x206325[_0xb51a('0xc')]=_0x14ce9f;logger[_0xb51a('0xd')](_0xb51a('0xe'));return rp(_0x206325)[_0xb51a('0xf')](function(_0x1abe45){if(_0x1abe45){var _0x5ced75=_0x1abe45['users'];var _0x113fab=null;for(_0x113fab=0x0;_0x113fab<_0x5ced75[_0xb51a('0x10')];_0x113fab++){if(_0x5ced75[_0x113fab][_0xb51a('0x11')]===_0x119eb8['adminEmail']){_0x119eb8[_0xb51a('0x12')]=_0x5ced75[_0x113fab]['id'];_0x5edb87=!![];}}if(_0x5edb87){logger[_0xb51a('0xd')](_0xb51a('0x13'),_0x119eb8['adminId']);_0x70e345(_0x119eb8);}else{_0x2202b4({'statusCode':0x194,'message':_0xb51a('0x14')});}}else{_0x2202b4({'statusCode':0x194,'message':_0xb51a('0x14')});}})[_0xb51a('0x15')](function(_0x3072f0){logger[_0xb51a('0x16')]('['+[_0x4fea54[_0xb51a('0x17')]()]+']',_0x3072f0['message']);_0x2202b4(_0x3072f0);});});}function getUser(_0x4751b3,_0xe642b7,_0x2bd46a){return function(_0x5e8221){return new Promise(function(_0x4426e0,_0x318d59){var _0x26aabc={'method':_0xb51a('0xa'),'uri':_0x2bd46a+'/api/selector/owners','json':!![]};_0x26aabc[_0xb51a('0xc')]=_0xe642b7;logger['info'](_0xb51a('0x18'));return rp(_0x26aabc)['then'](function(_0x31ba7f){if(_0x31ba7f){var _0x4494c9=_0x31ba7f[_0xb51a('0x19')];var _0x54893b=![];var _0xc27217=null;if(_0x5e8221[_0xb51a('0x1a')]!==null){logger[_0xb51a('0xd')]('Getting\x20user\x20with\x20email',_0x5e8221[_0xb51a('0x1a')]);_0x5e8221[_0xb51a('0x1b')]=_0x5e8221[_0xb51a('0x1a')];for(_0xc27217=0x0;_0xc27217<_0x4494c9[_0xb51a('0x10')];_0xc27217++){if(_0x4494c9[_0xc27217]['email']===_0x5e8221[_0xb51a('0x1a')]){_0x54893b=!![];_0x5e8221[_0xb51a('0x1c')]=_0x4494c9[_0xc27217]['id'];logger['info']('User\x20found:',_0x5e8221[_0xb51a('0x1c')]);}}}if(!_0x54893b){logger[_0xb51a('0xd')](_0xb51a('0x1d'));_0x5e8221['userEmail']=_0x5e8221[_0xb51a('0x1e')];_0x5e8221[_0xb51a('0x1c')]=_0x5e8221['adminId'];_0x54893b=!![];}if(_0x54893b){_0x4426e0(_0x5e8221);}else{_0x318d59({'statusCode':0x194,'message':_0xb51a('0x14')});}}else{_0x318d59({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb51a('0x15')](function(_0x301d11){logger['error']('['+[_0x4751b3['toUpperCase']()]+']',_0x301d11[_0xb51a('0x1f')]);_0x318d59(_0x301d11);});});};}function searchContact(_0x5ab6be,_0x41f640,_0x2f13a6,_0x43f865){return new Promise(function(_0x321409,_0x52ee3f){var _0x462fb4={'method':_0xb51a('0xa'),'headers':_0x41f640,'uri':_0x5ab6be+_0xb51a('0x20')+_0x43f865+_0xb51a('0x21')+_0x2f13a6+_0xb51a('0x22'),'json':!![]};rp(_0x462fb4)[_0xb51a('0xf')](function(_0x595ece){var _0x28df01=_[_0xb51a('0x23')](_0x595ece['contacts'][_0xb51a('0x24')],[_0x2f13a6,_0x43f865]);_0x321409(_0x28df01);})['catch'](function(_0x48bd44){_0x52ee3f(_0x48bd44);});});}function getEndUser(_0x46f412,_0x3f6dd7,_0x4234f5){return function(_0xd9bd39){return new Promise(function(_0x546e31,_0x148d4b){logger['info'](util[_0xb51a('0x25')](_0xb51a('0x26'),_0xd9bd39[_0xb51a('0x27')]));searchContact(_0x4234f5,_0x3f6dd7,_0xb51a('0x28'),_0xd9bd39[_0xb51a('0x27')])[_0xb51a('0xf')](function(_0x2928ea){if(_0x2928ea){_0xd9bd39['endUserId']=_0x2928ea['id'];logger[_0xb51a('0xd')](_0xb51a('0x29'),_0xd9bd39[_0xb51a('0x2a')]);return _0x546e31(_0xd9bd39);}searchContact(_0x4234f5,_0x3f6dd7,'work_number',_0xd9bd39[_0xb51a('0x27')])[_0xb51a('0xf')](function(_0x1f06b0){if(_0x1f06b0){_0xd9bd39[_0xb51a('0x2a')]=_0x1f06b0['id'];logger[_0xb51a('0xd')](_0xb51a('0x2b'),_0xd9bd39[_0xb51a('0x2a')]);return _0x546e31(_0xd9bd39);}createEndUser(_0xd9bd39,_0x46f412,_0x3f6dd7,_0x4234f5)[_0xb51a('0xf')](function(_0x2950d5){logger[_0xb51a('0xd')](_0xb51a('0x2c'),_0x2950d5[_0xb51a('0x2a')]);return _0x546e31(_0x2950d5);});});})['catch'](function(_0x20216b){_0x148d4b(_0x20216b);});});};}function createEndUser(_0x300975,_0x15fe80,_0x290acf,_0x4dfe3b){return new Promise(function(_0x9d43a,_0x1543b6){var _0x32bacc=moment();var _0x522221={'method':_0xb51a('0x2d'),'uri':_0x4dfe3b+'/api/contacts','body':{'contact':{'last_name':_0x300975[_0xb51a('0x27')],'work_number':_0x300975['contactNumber'],'mobile_number':_0x300975[_0xb51a('0x27')],'owner_id':_0x300975['userId'],'created_at':_0x32bacc[_0xb51a('0x25')](_0xb51a('0x2e'))}},'json':!![]};_0x522221[_0xb51a('0xc')]=_0x290acf;logger[_0xb51a('0xd')](_0xb51a('0x2f'));return rp(_0x522221)[_0xb51a('0xf')](function(_0x270fb8){_0x300975[_0xb51a('0x2a')]=_0x270fb8[_0xb51a('0x30')]['id'];_0x9d43a(_0x300975);})[_0xb51a('0x15')](function(_0x42f09f){logger[_0xb51a('0x16')]('['+[_0x15fe80[_0xb51a('0x17')]()]+']',_0x42f09f[_0xb51a('0x1f')]);_0x1543b6(_0x42f09f[_0xb51a('0x1f')]);});});}function getTicket(_0xd2b64d,_0x309752,_0x383997,_0xc4a5f9,_0x5034a9){return function(_0x423c14){logger['info'](_0xb51a('0x31'));return new Promise(function(_0x41f66c,_0x30d38d){var _0x12d2a5=moment();var _0x463d73={'method':_0xb51a('0x2d'),'uri':_0x383997+'/api/tasks','body':{'title':intUtil[_0xb51a('0x32')](_0xc4a5f9['Subjects'],_0x5034a9,'\x20'),'description':intUtil[_0xb51a('0x32')](_0xc4a5f9[_0xb51a('0x33')],_0x5034a9,'\x0a'),'owner_id':_0x423c14[_0xb51a('0x1c')],'creater_id':_0x423c14[_0xb51a('0x12')],'targetable_id':_0x423c14[_0xb51a('0x2a')],'targetable_type':_0xb51a('0x34'),'created_at':_0x12d2a5[_0xb51a('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x12d2a5['add'](0x1e,'m')['format'](_0xb51a('0x2e'))},'json':!![]};_0x463d73[_0xb51a('0xc')]=_0x309752;return rp(_0x463d73)['then'](function(_0x41bdef){_0x423c14['ticketId']=_0x41bdef['task']['id'];logger[_0xb51a('0xd')]('Task\x20created:',_0x423c14['ticketId']);_0x41f66c(_0x423c14);})[_0xb51a('0x15')](function(_0x5671a3){logger['error']('['+[_0xd2b64d[_0xb51a('0x17')]()]+']',_0x5671a3[_0xb51a('0x1f')]);_0x30d38d(_0x5671a3[_0xb51a('0x1f')]);});});};}function emit(_0x593e40,_0x5a8460,_0x514a21){var _0x414113={'uri':_0x593e40+_0xb51a('0x35')+_0x514a21};io['to'](util[_0xb51a('0x25')](_0xb51a('0x36'),_0x5a8460))[_0xb51a('0x37')]('trigger:browser:url',_0x414113);}exports['cs']=function(_0x496ac6,_0x1c27cd,_0x4a0ea8,_0x57d1a8,_0x472352,_0x470b5a,_0x5ab94d,_0x400c61){var _0x111569={};var _0x3cdd8c={'Authorization':_0xb51a('0x38')+_0x470b5a[_0xb51a('0x39')]};_0x470b5a['remoteUri']=intUtil[_0xb51a('0x3a')](_0x470b5a[_0xb51a('0x3b')]);_0x470b5a['serverUrl']=intUtil[_0xb51a('0x3a')](_0x470b5a[_0xb51a('0x3c')]);var _0xc7a58a=_0x470b5a[_0xb51a('0x3b')];_0x111569[_0xb51a('0x1e')]=_0x470b5a[_0xb51a('0x3d')];_0x111569[_0xb51a('0x27')]=_0x400c61[_0xb51a('0x3e')]()===_0xb51a('0x3f')?_0x1c27cd[_0xb51a('0x40')]:_0x1c27cd['calleridnum'];_0x111569[_0xb51a('0x41')]=_0x400c61===_0xb51a('0x42')||_0x400c61===_0xb51a('0x43')?_0xb51a('0x42'):_0xb51a('0x3f');if(_0x57d1a8){_0x111569[_0xb51a('0x1a')]=_0x57d1a8[_0xb51a('0x11')];}var _0x5ba521=util['format'](_0xb51a('0x44'),_0x470b5a['serverUrl'],_0x1c27cd[_0xb51a('0x45')],md5(_0x1c27cd[_0xb51a('0x45')]));if(_0x472352&&_0x472352['monitor_format']){logger[_0xb51a('0xd')](_0xb51a('0x46'),_0xb51a('0x47'));_0x1c27cd[_0xb51a('0x48')]=_0x5ba521;}else if(_0x5ab94d&&_0x5ab94d[_0xb51a('0x49')]&&_0x5ab94d['recordingFormat']!=='none'){logger[_0xb51a('0xd')](_0xb51a('0x4a'),'Recording\x20is\x20enabled!');_0x1c27cd[_0xb51a('0x48')]=_0x5ba521;}else{_0x1c27cd[_0xb51a('0x48')]='';}return getAdminId(_0x111569,_0x400c61,_0x3cdd8c,_0xc7a58a)['then'](getUser(_0x400c61,_0x3cdd8c,_0xc7a58a))[_0xb51a('0xf')](getEndUser(_0x400c61,_0x3cdd8c,_0xc7a58a))[_0xb51a('0xf')](getTicket(_0x400c61,_0x3cdd8c,_0xc7a58a,_0x4a0ea8,_0x1c27cd))['then'](function(_0x45aeb2){logger[_0xb51a('0xd')](util['format'](_0xb51a('0x4b'),_0x45aeb2[_0xb51a('0x4c')]));if(_0x400c61!==_0xb51a('0x43')){logger[_0xb51a('0xd')]('['+[_0x400c61[_0xb51a('0x17')]()]+']',_0xb51a('0x4d'));emit(_0xc7a58a,_0x57d1a8[_0xb51a('0x4e')],_0x45aeb2['endUserId']);}})[_0xb51a('0x15')](function(_0x4306b1){logger[_0xb51a('0x16')]('['+[_0x400c61[_0xb51a('0x17')]()]+_0xb51a('0x4f'),util['inspect'](_0x4306b1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcd34=['Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','GET','&entities=contact','then','contacts','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','unmanaged','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','util','moment','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0xcd34,0x83));var _0x4cd3=function(_0x56132f,_0x4d9675){_0x56132f=_0x56132f-0x0;var _0x358ca2=_0xcd34[_0x56132f];return _0x358ca2;};'use strict';var _=require(_0x4cd3('0x0'));var rp=require('request-promise');var md5=require(_0x4cd3('0x1'));var util=require(_0x4cd3('0x2'));var moment=require(_0x4cd3('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4cd3('0x4'));var logger=require(_0x4cd3('0x5'))('freshsales');config[_0x4cd3('0x6')]=_[_0x4cd3('0x7')](config[_0x4cd3('0x6')],{'host':_0x4cd3('0x8'),'port':0x18eb});var io=require(_0x4cd3('0x9'))(new Redis(config['redis']));function getAdminId(_0x3fd606,_0x898874,_0x6295c6,_0x3f4e26){return new Promise(function(_0x1dfd10,_0x52fb84){var _0x540ed0=![];var _0x46a909={'method':'GET','uri':_0x3f4e26+'/api/selector/owners','json':!![]};_0x46a909[_0x4cd3('0xa')]=_0x6295c6;logger[_0x4cd3('0xb')](_0x4cd3('0xc'));return rp(_0x46a909)['then'](function(_0x2d1d11){if(_0x2d1d11){var _0x5737ad=_0x2d1d11[_0x4cd3('0xd')];var _0x4e379b=null;for(_0x4e379b=0x0;_0x4e379b<_0x5737ad[_0x4cd3('0xe')];_0x4e379b++){if(_0x5737ad[_0x4e379b][_0x4cd3('0xf')]===_0x3fd606[_0x4cd3('0x10')]){_0x3fd606[_0x4cd3('0x11')]=_0x5737ad[_0x4e379b]['id'];_0x540ed0=!![];}}if(_0x540ed0){logger['info'](_0x4cd3('0x12'),_0x3fd606[_0x4cd3('0x11')]);_0x1dfd10(_0x3fd606);}else{_0x52fb84({'statusCode':0x194,'message':_0x4cd3('0x13')});}}else{_0x52fb84({'statusCode':0x194,'message':_0x4cd3('0x13')});}})[_0x4cd3('0x14')](function(_0xfa0191){logger[_0x4cd3('0x15')]('['+[_0x898874[_0x4cd3('0x16')]()]+']',_0xfa0191[_0x4cd3('0x17')]);_0x52fb84(_0xfa0191);});});}function getUser(_0x4572df,_0x593389,_0x4243ed){return function(_0x33498a){return new Promise(function(_0x30f422,_0x1af46d){var _0x1094b9={'method':'GET','uri':_0x4243ed+_0x4cd3('0x18'),'json':!![]};_0x1094b9[_0x4cd3('0xa')]=_0x593389;logger['info'](_0x4cd3('0x19'));return rp(_0x1094b9)['then'](function(_0x2f040c){if(_0x2f040c){var _0x56c1fe=_0x2f040c[_0x4cd3('0xd')];var _0x543cbb=![];var _0x48f382=null;if(_0x33498a['agentEmail']!==null){logger[_0x4cd3('0xb')](_0x4cd3('0x1a'),_0x33498a['agentEmail']);_0x33498a['userEmail']=_0x33498a['agentEmail'];for(_0x48f382=0x0;_0x48f382<_0x56c1fe[_0x4cd3('0xe')];_0x48f382++){if(_0x56c1fe[_0x48f382][_0x4cd3('0xf')]===_0x33498a[_0x4cd3('0x1b')]){_0x543cbb=!![];_0x33498a[_0x4cd3('0x1c')]=_0x56c1fe[_0x48f382]['id'];logger['info'](_0x4cd3('0x1d'),_0x33498a[_0x4cd3('0x1c')]);}}}if(!_0x543cbb){logger[_0x4cd3('0xb')](_0x4cd3('0x1e'));_0x33498a['userEmail']=_0x33498a[_0x4cd3('0x10')];_0x33498a[_0x4cd3('0x1c')]=_0x33498a[_0x4cd3('0x11')];_0x543cbb=!![];}if(_0x543cbb){_0x30f422(_0x33498a);}else{_0x1af46d({'statusCode':0x194,'message':_0x4cd3('0x13')});}}else{_0x1af46d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4cd3('0x14')](function(_0x39eeb9){logger[_0x4cd3('0x15')]('['+[_0x4572df[_0x4cd3('0x16')]()]+']',_0x39eeb9['message']);_0x1af46d(_0x39eeb9);});});};}function searchContact(_0x142dd9,_0x311b14,_0x15bf17,_0x3566e2){return new Promise(function(_0x2c26ff,_0x2dba43){var _0x77207e={'method':_0x4cd3('0x1f'),'headers':_0x311b14,'uri':_0x142dd9+'/api/lookup?q='+_0x3566e2+'&f='+_0x15bf17+_0x4cd3('0x20'),'json':!![]};rp(_0x77207e)[_0x4cd3('0x21')](function(_0x3d7e49){var _0x47148f=_['find'](_0x3d7e49['contacts'][_0x4cd3('0x22')],[_0x15bf17,_0x3566e2]);_0x2c26ff(_0x47148f);})[_0x4cd3('0x14')](function(_0x259f01){_0x2dba43(_0x259f01);});});}function getEndUser(_0x32c823,_0x543571,_0x211ff9){return function(_0x4d2819){return new Promise(function(_0x125420,_0x1b8cb4){logger[_0x4cd3('0xb')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x4d2819[_0x4cd3('0x23')]));searchContact(_0x211ff9,_0x543571,_0x4cd3('0x24'),_0x4d2819[_0x4cd3('0x23')])[_0x4cd3('0x21')](function(_0x5ec06b){if(_0x5ec06b){_0x4d2819['endUserId']=_0x5ec06b['id'];logger[_0x4cd3('0xb')]('Contact\x20found\x20mobile_number:',_0x4d2819[_0x4cd3('0x25')]);return _0x125420(_0x4d2819);}searchContact(_0x211ff9,_0x543571,_0x4cd3('0x26'),_0x4d2819[_0x4cd3('0x23')])['then'](function(_0x4d7ab3){if(_0x4d7ab3){_0x4d2819[_0x4cd3('0x25')]=_0x4d7ab3['id'];logger[_0x4cd3('0xb')](_0x4cd3('0x27'),_0x4d2819[_0x4cd3('0x25')]);return _0x125420(_0x4d2819);}createEndUser(_0x4d2819,_0x32c823,_0x543571,_0x211ff9)[_0x4cd3('0x21')](function(_0x3af1f3){logger[_0x4cd3('0xb')](_0x4cd3('0x28'),_0x3af1f3[_0x4cd3('0x25')]);return _0x125420(_0x3af1f3);});});})[_0x4cd3('0x14')](function(_0x5604f8){_0x1b8cb4(_0x5604f8);});});};}function createEndUser(_0x55f354,_0x3fe3ba,_0x55631e,_0x2584dd){return new Promise(function(_0x106f7c,_0x3e8d84){var _0x303b4b=moment();var _0x25e4af={'method':'POST','uri':_0x2584dd+_0x4cd3('0x29'),'body':{'contact':{'last_name':_0x55f354[_0x4cd3('0x23')],'work_number':_0x55f354[_0x4cd3('0x23')],'mobile_number':_0x55f354[_0x4cd3('0x23')],'owner_id':_0x55f354[_0x4cd3('0x1c')],'created_at':_0x303b4b[_0x4cd3('0x2a')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x25e4af[_0x4cd3('0xa')]=_0x55631e;logger[_0x4cd3('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x25e4af)[_0x4cd3('0x21')](function(_0x42bb59){_0x55f354[_0x4cd3('0x25')]=_0x42bb59[_0x4cd3('0x2b')]['id'];_0x106f7c(_0x55f354);})[_0x4cd3('0x14')](function(_0xc4259e){logger['error']('['+[_0x3fe3ba[_0x4cd3('0x16')]()]+']',_0xc4259e[_0x4cd3('0x17')]);_0x3e8d84(_0xc4259e['message']);});});}function getTicket(_0x140bc1,_0x5a2c90,_0x2c57c1,_0x2f5288,_0x19bd3a){return function(_0x11b297){logger[_0x4cd3('0xb')](_0x4cd3('0x2c'));return new Promise(function(_0x466f53,_0x1a7173){var _0x562ca4=moment();var _0x5d30d4={'method':'POST','uri':_0x2c57c1+_0x4cd3('0x2d'),'body':{'title':intUtil['getString'](_0x2f5288[_0x4cd3('0x2e')],_0x19bd3a,'\x20'),'description':intUtil[_0x4cd3('0x2f')](_0x2f5288['Descriptions'],_0x19bd3a,'\x0a'),'owner_id':_0x11b297[_0x4cd3('0x1c')],'creater_id':_0x11b297[_0x4cd3('0x11')],'targetable_id':_0x11b297[_0x4cd3('0x25')],'targetable_type':_0x4cd3('0x30'),'created_at':_0x562ca4[_0x4cd3('0x2a')](_0x4cd3('0x31')),'due_date':_0x562ca4[_0x4cd3('0x32')](0x1e,'m')[_0x4cd3('0x2a')](_0x4cd3('0x31'))},'json':!![]};_0x5d30d4[_0x4cd3('0xa')]=_0x5a2c90;return rp(_0x5d30d4)[_0x4cd3('0x21')](function(_0x104b88){_0x11b297[_0x4cd3('0x33')]=_0x104b88['task']['id'];logger[_0x4cd3('0xb')]('Task\x20created:',_0x11b297[_0x4cd3('0x33')]);_0x466f53(_0x11b297);})[_0x4cd3('0x14')](function(_0x5bf852){logger[_0x4cd3('0x15')]('['+[_0x140bc1['toUpperCase']()]+']',_0x5bf852[_0x4cd3('0x17')]);_0x1a7173(_0x5bf852[_0x4cd3('0x17')]);});});};}function emit(_0x159cde,_0x2a2436,_0x4489ea){var _0x1089d4={'uri':_0x159cde+'/contacts/'+_0x4489ea};io['to'](util[_0x4cd3('0x2a')](_0x4cd3('0x34'),_0x2a2436))[_0x4cd3('0x35')](_0x4cd3('0x36'),_0x1089d4);}exports['cs']=function(_0x3740b4,_0x54a980,_0x21d4ac,_0x371ad9,_0x1129d4,_0x1ae365,_0x4cc94e,_0xe11ad1){var _0x2789a7={};var _0x18d9e4={'Authorization':_0x4cd3('0x37')+_0x1ae365[_0x4cd3('0x38')]};_0x1ae365[_0x4cd3('0x39')]=intUtil[_0x4cd3('0x3a')](_0x1ae365[_0x4cd3('0x39')]);_0x1ae365['serverUrl']=intUtil[_0x4cd3('0x3a')](_0x1ae365[_0x4cd3('0x3b')]);var _0x26c5c9=_0x1ae365['remoteUri'];_0x2789a7['adminEmail']=_0x1ae365[_0x4cd3('0x3c')];_0x2789a7[_0x4cd3('0x23')]=_0xe11ad1['toLowerCase']()===_0x4cd3('0x3d')?_0x54a980[_0x4cd3('0x3e')]:_0x54a980['calleridnum'];_0x2789a7[_0x4cd3('0x3f')]=_0xe11ad1==='queue'||_0xe11ad1===_0x4cd3('0x40')?'queue':_0x4cd3('0x3d');if(_0x371ad9){_0x2789a7[_0x4cd3('0x1b')]=_0x371ad9['email'];}var _0x528c7e=util[_0x4cd3('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ae365[_0x4cd3('0x3b')],_0x54a980['uniqueid'],md5(_0x54a980['uniqueid']));if(_0x1129d4&&_0x1129d4[_0x4cd3('0x41')]){logger[_0x4cd3('0xb')](_0x4cd3('0x42'),_0x4cd3('0x43'));_0x54a980[_0x4cd3('0x44')]=_0x528c7e;}else if(_0x4cc94e&&_0x4cc94e['recordingFormat']&&_0x4cc94e['recordingFormat']!==_0x4cd3('0x45')){logger[_0x4cd3('0xb')](_0x4cd3('0x46'),'Recording\x20is\x20enabled!');_0x54a980[_0x4cd3('0x44')]=_0x528c7e;}else{_0x54a980['recordingURL']='';}return getAdminId(_0x2789a7,_0xe11ad1,_0x18d9e4,_0x26c5c9)[_0x4cd3('0x21')](getUser(_0xe11ad1,_0x18d9e4,_0x26c5c9))[_0x4cd3('0x21')](getEndUser(_0xe11ad1,_0x18d9e4,_0x26c5c9))['then'](getTicket(_0xe11ad1,_0x18d9e4,_0x26c5c9,_0x21d4ac,_0x54a980))[_0x4cd3('0x21')](function(_0x3a43d1){logger['info'](util[_0x4cd3('0x2a')](_0x4cd3('0x47'),_0x3a43d1[_0x4cd3('0x33')]));if(_0xe11ad1!==_0x4cd3('0x40')){logger[_0x4cd3('0xb')]('['+[_0xe11ad1[_0x4cd3('0x16')]()]+']',_0x4cd3('0x48'));emit(_0x26c5c9,_0x371ad9[_0x4cd3('0x49')],_0x3a43d1[_0x4cd3('0x25')]);}})['catch'](function(_0x2f445e){logger['error']('['+[_0xe11ad1['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x4cd3('0x4a')](_0x2f445e,{'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 8ad59be..db1ca35 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 _0x6022=['servicenow','exec','includes','data1','toLowerCase','data2','data3','queue','outbound','unmanaged','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales'];(function(_0x13c8d0,_0x323500){var _0xc7d18a=function(_0x2887fb){while(--_0x2887fb){_0x13c8d0['push'](_0x13c8d0['shift']());}};_0xc7d18a(++_0x323500);}(_0x6022,0x132));var _0x2602=function(_0x2061da,_0x3ded27){_0x2061da=_0x2061da-0x0;var _0x59d465=_0x6022[_0x2061da];return _0x59d465;};'use strict';var _=require(_0x2602('0x0'));var util=require(_0x2602('0x1'));var zendesk=require(_0x2602('0x2'));var salesforce=require(_0x2602('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2602('0x4'));var zoho=require(_0x2602('0x5'));var desk=require(_0x2602('0x6'));var vtiger=require(_0x2602('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x2602('0x8'));var freshsales=require(_0x2602('0x9'));var integrations=[_0x2602('0xa'),_0x2602('0xb'),_0x2602('0xc'),_0x2602('0xd'),_0x2602('0xe'),_0x2602('0xf'),_0x2602('0x10'),'dynamics365',_0x2602('0x11'),_0x2602('0x12')];exports[_0x2602('0x13')]=function(_0x19e2cd,_0x9e2de8,_0x59e310,_0x370d80,_0x105778,_0x30f732){if(_0x59e310){if(_[_0x2602('0x14')](integrations,_0x19e2cd[_0x2602('0x15')][_0x2602('0x16')]())){try{var _0x5c609d=null;var _0x24c5a='';var _0x2e3a88=_0x59e310[_0x19e2cd[_0x2602('0x15')][_0x2602('0x16')]()];if(_0x2e3a88){var _0x3beef6=_0x2e3a88[_0x19e2cd[_0x2602('0x17')]];if(_0x3beef6){var _0x3af1b3=_['find'](_0x3beef6['Configurations'],{'id':parseInt(_0x19e2cd[_0x2602('0x18')],0xa)});if(_0x3af1b3){if(_0x370d80){if(_0x105778&&_0x9e2de8[_0x2602('0x19')]){_0x24c5a=_0x2602('0x19');}else if(_0x9e2de8['routeId']){_0x24c5a=_0x2602('0x1a');}else{console['log']('EVENT\x20UNKNOWN',_0x9e2de8);}}else{_0x24c5a=_0x2602('0x1b');}switch(_0x19e2cd['data1'][_0x2602('0x16')]()){case _0x2602('0xa'):zendesk[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case _0x2602('0xb'):salesforce[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case _0x2602('0xc'):sugarcrm[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case _0x2602('0xd'):freshdesk[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case _0x2602('0xe'):zoho[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case _0x2602('0xf'):desk[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case'vtiger':vtiger[_0x24c5a](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732);break;case _0x2602('0x11'):freshsales['cs'](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732,_0x24c5a);break;case _0x2602('0x12'):servicenow['cs'](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732,_0x24c5a);break;case _0x2602('0x1c'):dynamics365['cs'](_0x19e2cd,_0x9e2de8,_0x3af1b3,_0x370d80,_0x105778,_0x3beef6,_0x30f732,_0x24c5a);break;default:console['log'](_0x2602('0x1d'));}}else{_0x5c609d=require(_0x2602('0x1e'))(_0x19e2cd['data1'][_0x2602('0x16')]());_0x5c609d[_0x2602('0x1f')](_0x2602('0x20'),util[_0x2602('0x21')](_0x2602('0x22'),_0x19e2cd[_0x2602('0x15')][_0x2602('0x16')](),_0x19e2cd['data3']));}}else{_0x5c609d=require('../../../../config/logger')(_0x19e2cd[_0x2602('0x15')][_0x2602('0x16')]());_0x5c609d[_0x2602('0x1f')](_0x2602('0x20'),util[_0x2602('0x21')](_0x2602('0x23'),_0x19e2cd['data1'][_0x2602('0x16')](),_0x19e2cd[_0x2602('0x17')]));}}else{}}catch(_0x174e46){console['error'](_0x174e46);}}}}; \ No newline at end of file +var _0xeef5=['outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','zoho','desk','vtiger','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshsales','servicenow','data1','toLowerCase','Configurations','data3','queue','routeId'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xeef5,0x12f));var _0x5eef=function(_0x2c0d0d,_0x277cb9){_0x2c0d0d=_0x2c0d0d-0x0;var _0x36e349=_0xeef5[_0x2c0d0d];return _0x36e349;};'use strict';var _=require(_0x5eef('0x0'));var util=require(_0x5eef('0x1'));var zendesk=require(_0x5eef('0x2'));var salesforce=require(_0x5eef('0x3'));var sugarcrm=require(_0x5eef('0x4'));var freshdesk=require(_0x5eef('0x5'));var zoho=require(_0x5eef('0x6'));var desk=require(_0x5eef('0x7'));var vtiger=require(_0x5eef('0x8'));var servicenow=require(_0x5eef('0x9'));var dynamics365=require(_0x5eef('0xa'));var freshsales=require('./freshsales');var integrations=[_0x5eef('0xb'),'salesforce',_0x5eef('0xc'),'freshdesk','zoho','desk','vtiger','dynamics365',_0x5eef('0xd'),_0x5eef('0xe')];exports['exec']=function(_0x244856,_0x5322bc,_0x4062e5,_0x48b911,_0x59befa,_0x1addde){if(_0x4062e5){if(_['includes'](integrations,_0x244856[_0x5eef('0xf')]['toLowerCase']())){try{var _0x43061e=null;var _0x3283ca='';var _0xb56eaf=_0x4062e5[_0x244856[_0x5eef('0xf')][_0x5eef('0x10')]()];if(_0xb56eaf){var _0x4481fb=_0xb56eaf[_0x244856['data2']];if(_0x4481fb){var _0x18f0e1=_['find'](_0x4481fb[_0x5eef('0x11')],{'id':parseInt(_0x244856[_0x5eef('0x12')],0xa)});if(_0x18f0e1){if(_0x48b911){if(_0x59befa&&_0x5322bc[_0x5eef('0x13')]){_0x3283ca='queue';}else if(_0x5322bc[_0x5eef('0x14')]){_0x3283ca=_0x5eef('0x15');}else{console['log'](_0x5eef('0x16'),_0x5322bc);}}else{_0x3283ca=_0x5eef('0x17');}switch(_0x244856[_0x5eef('0xf')][_0x5eef('0x10')]()){case'zendesk':zendesk[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x18'):salesforce[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0xc'):sugarcrm[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x19'):freshdesk[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x1a'):zoho[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x1b'):desk[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x1c'):vtiger[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0xd'):freshsales['cs'](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde,_0x3283ca);break;case _0x5eef('0xe'):servicenow['cs'](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde,_0x3283ca);break;case'dynamics365':dynamics365['cs'](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde,_0x3283ca);break;default:console['log'](_0x5eef('0x1d'));}}else{_0x43061e=require('../../../../config/logger')(_0x244856['data1'][_0x5eef('0x10')]());_0x43061e[_0x5eef('0x1e')](_0x5eef('0x1f'),util[_0x5eef('0x20')](_0x5eef('0x21'),_0x244856[_0x5eef('0xf')][_0x5eef('0x10')](),_0x244856[_0x5eef('0x12')]));}}else{_0x43061e=require(_0x5eef('0x22'))(_0x244856[_0x5eef('0xf')][_0x5eef('0x10')]());_0x43061e[_0x5eef('0x1e')](_0x5eef('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x244856[_0x5eef('0xf')][_0x5eef('0x10')](),_0x244856[_0x5eef('0x23')]));}}else{}}catch(_0x3fc91f){console['error'](_0x3fc91f);}}}}; \ 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 b543cc0..a1a29f6 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 _0x9672=['trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','Subjects','Task','ActivityDate','utc','endUserType','contact','lead','WhatId','ticketType','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','Contact','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','No\x20Company','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','Connection','remoteUri','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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'];(function(_0x56856c,_0x5bfc0c){var _0x2daf4c=function(_0x3b9145){while(--_0x3b9145){_0x56856c['push'](_0x56856c['shift']());}};_0x2daf4c(++_0x5bfc0c);}(_0x9672,0x91));var _0x2967=function(_0x151665,_0x435284){_0x151665=_0x151665-0x0;var _0x3bee2d=_0x9672[_0x151665];return _0x3bee2d;};'use strict';var _=require(_0x2967('0x0'));var rp=require(_0x2967('0x1'));var moment=require(_0x2967('0x2'));var BPromise=require('bluebird');var md5=require(_0x2967('0x3'));var jsforce=require(_0x2967('0x4'));var util=require(_0x2967('0x5'));var Redis=require(_0x2967('0x6'));var intUtil=require(_0x2967('0x7'));var config=require(_0x2967('0x8'));var logger=require(_0x2967('0x9'))(_0x2967('0xa'));config['redis']=_['defaults'](config[_0x2967('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x2967('0xc'))(new Redis(config['redis']));function emit(_0x255f10,_0x1cb8fc,_0x384ca2){io['to'](_0x255f10)[_0x2967('0xd')](_0x1cb8fc,_0x384ca2);}function getTicket(_0x3fd76d,_0x16cc64,_0xf438a3,_0xa89181,_0x624e4d,_0x582fba,_0x466e47,_0xc4bcdb){var _0x24fdb1=Object[_0x2967('0xe')]({},{'OwnerId':_0x16cc64['id'],'Subject':intUtil['getString'](_0xa89181[_0x2967('0xf')],_0x624e4d,'\x20'),'Description':intUtil['getString'](_0xa89181['Descriptions'],_0x624e4d,'\x0a')},getCustomFields(_0x582fba,_0x624e4d));if(_0xf438a3){if(_0xa89181['ticketType']===_0x2967('0x10')){_0x24fdb1[_0x2967('0x11')]=moment[_0x2967('0x12')]();_0x24fdb1['IsReminderSet']=![];_0x24fdb1['IsRecurrence']=![];if(_0xf438a3[_0x2967('0x13')]===_0x2967('0x14')||_0xf438a3[_0x2967('0x13')]===_0x2967('0x15')){_0x24fdb1['WhoId']=_0xf438a3['id'];}else if(_0xf438a3[_0x2967('0x13')]==='account'){_0x24fdb1[_0x2967('0x16')]=_0xf438a3['id'];}}else if(_0xa89181[_0x2967('0x17')]==='Case'){if(_0xf438a3['endUserType']===_0x2967('0x14')){_0x24fdb1[_0x2967('0x18')]=_0xf438a3['id'];}else if(_0xf438a3[_0x2967('0x13')]===_0x2967('0x19')){_0x24fdb1[_0x2967('0x1a')]=_0xf438a3['id'];}else if(_0xf438a3[_0x2967('0x13')]===_0x2967('0x15')&&_0xa89181[_0x2967('0x1b')]){_0x24fdb1[_0xa89181[_0x2967('0x1b')]]=_0xf438a3['id'];}else{logger[_0x2967('0x1c')](_0x2967('0x1d'));}}}return _0x466e47[_0x2967('0x1e')](_0xa89181[_0x2967('0x17')])[_0x2967('0x1f')](_0x24fdb1);}function getUser(_0x13e13e,_0x48d909,_0x1b572b){if(!_[_0x2967('0x20')](_0x48d909)&&intUtil[_0x2967('0x21')](_0x48d909)){var _0x32d701={'Email':_0x48d909};var _0x180dad={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1b572b['sobject'](_0x2967('0x22'))[_0x2967('0x23')](_0x32d701,_0x180dad)[_0x2967('0x24')]()[_0x2967('0x25')](function(_0x5ba1be){if(_0x5ba1be[_0x2967('0x26')]){var _0x2e5f2b=_[_0x2967('0x23')](_0x5ba1be,function(_0x42c858){return _0x42c858[_0x2967('0x27')]===_0x48d909;});if(_0x2e5f2b){logger['info']('Agent\x20%s\x20found.',_0x48d909);return BPromise[_0x2967('0x28')]({'id':_0x2e5f2b['Id'],'name':_0x2e5f2b[_0x2967('0x29')]});}}else{logger[_0x2967('0x1c')](_0x2967('0x2a'),_0x48d909);return _0x1b572b[_0x2967('0x2b')]()[_0x2967('0x25')](function(_0x7cf4){return BPromise['resolve']({'id':_0x7cf4[_0x2967('0x2c')],'name':_0x7cf4[_0x2967('0x2d')]});});}});}else{logger[_0x2967('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x48d909);return _0x1b572b['identity']()[_0x2967('0x25')](function(_0x3e67fe){return BPromise[_0x2967('0x28')]({'id':_0x3e67fe[_0x2967('0x2c')],'name':_0x3e67fe['display_name']});});}}function getEndUser(_0x10ec6f,_0x28442d,_0x47fc43,_0x51b0ec,_0x4ef2fd){var _0xcc27e7={'$or':{'Phone':_0x51b0ec}};var _0x1c8e12={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2967('0x28')]()[_0x2967('0x25')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x51b0ec,_0x28442d[_0x2967('0x2e')]);switch(_0x28442d['moduleSearch']){case _0x2967('0x2f'):var _0xcf04a0=_['cloneDeep'](_0xcc27e7);if(_0x28442d[_0x2967('0x30')]){var _0x4ba9f0={};_0x4ba9f0[_0x28442d['additionalSearchContact']]=_0x51b0ec;_[_0x2967('0x31')](_0xcf04a0[_0x2967('0x32')],_0x4ba9f0);}return _0x4ef2fd[_0x2967('0x1e')]('Contact')[_0x2967('0x23')](_0xcf04a0,_0x1c8e12)[_0x2967('0x24')]()[_0x2967('0x25')](function(_0xc0a093){if(_0xc0a093&&_0xc0a093[_0x2967('0x26')]){return _0xc0a093;}else{var _0x4decf9=_['cloneDeep'](_0xcc27e7);if(_0x28442d[_0x2967('0x33')]){var _0x2aa7a3={};_0x2aa7a3[_0x28442d[_0x2967('0x33')]]=_0x51b0ec;_[_0x2967('0x31')](_0x4decf9[_0x2967('0x32')],_0x2aa7a3);}return _0x4ef2fd[_0x2967('0x1e')](_0x2967('0x34'))[_0x2967('0x23')](_0x4decf9,_0x1c8e12);}});case _0x2967('0x35'):var _0x16c8b2=_[_0x2967('0x36')](_0xcc27e7);if(_0x28442d[_0x2967('0x37')]){var _0x4ba9f0={};_0x4ba9f0[_0x28442d['additionalSearchAccount']]=_0x51b0ec;_[_0x2967('0x31')](_0x16c8b2[_0x2967('0x32')],_0x4ba9f0);}return _0x4ef2fd['sobject'](_0x2967('0x38'))[_0x2967('0x23')](_0x16c8b2,_0x1c8e12)[_0x2967('0x24')]()['then'](function(_0xb1af43){if(_0xb1af43&&_0xb1af43[_0x2967('0x26')]){return _0xb1af43;}else{var _0x5aadcf=_[_0x2967('0x36')](_0xcc27e7);if(_0x28442d[_0x2967('0x30')]){var _0x64e3ba={};_0x64e3ba[_0x28442d[_0x2967('0x30')]]=_0x51b0ec;_[_0x2967('0x31')](_0x5aadcf['$or'],_0x64e3ba);}return _0x4ef2fd[_0x2967('0x1e')](_0x2967('0x39'))[_0x2967('0x23')](_0x5aadcf,_0x1c8e12)['then'](function(_0x3264aa){if(_0x3264aa&&_0x3264aa[_0x2967('0x26')]){return _0x3264aa;}else{var _0x15c9c3=_['cloneDeep'](_0xcc27e7);if(_0x28442d[_0x2967('0x33')]){var _0x3928e1={};_0x3928e1[_0x28442d[_0x2967('0x33')]]=_0x51b0ec;_[_0x2967('0x31')](_0x15c9c3['$or'],_0x3928e1);}return _0x4ef2fd[_0x2967('0x1e')](_0x2967('0x34'))['find'](_0x15c9c3,_0x1c8e12);}});}});case _0x2967('0x14'):var _0xcf04a0=_[_0x2967('0x36')](_0xcc27e7);if(_0x28442d[_0x2967('0x30')]){var _0x4ba9f0={};_0x4ba9f0[_0x28442d[_0x2967('0x30')]]=_0x51b0ec;_[_0x2967('0x31')](_0xcf04a0[_0x2967('0x32')],_0x4ba9f0);}return _0x4ef2fd[_0x2967('0x1e')](_0x2967('0x39'))[_0x2967('0x23')](_0xcf04a0,_0x1c8e12)['execute']();case _0x2967('0x15'):var _0x3ebe6b=_[_0x2967('0x36')](_0xcc27e7);if(_0x28442d[_0x2967('0x33')]){var _0x4ba9f0={};_0x4ba9f0[_0x28442d[_0x2967('0x33')]]=_0x51b0ec;_[_0x2967('0x31')](_0x3ebe6b[_0x2967('0x32')],_0x4ba9f0);}return _0x4ef2fd['sobject'](_0x2967('0x34'))[_0x2967('0x23')](_0x3ebe6b,_0x1c8e12);case _0x2967('0x19'):var _0x16c8b2=_[_0x2967('0x36')](_0xcc27e7);if(_0x28442d[_0x2967('0x37')]){var _0x4ba9f0={};_0x4ba9f0[_0x28442d['additionalSearchAccount']]=_0x51b0ec;_[_0x2967('0x31')](_0x16c8b2['$or'],_0x4ba9f0);}return _0x4ef2fd[_0x2967('0x1e')](_0x2967('0x38'))[_0x2967('0x23')](_0x16c8b2,_0x1c8e12);default:return null;}})[_0x2967('0x25')](function(_0x5d0a7d){if(_0x5d0a7d&&_0x5d0a7d['length']){var _0x13198b=_[_0x2967('0x3a')](_0x5d0a7d);if(_0x13198b){return BPromise[_0x2967('0x28')]({'id':_0x13198b['Id'],'name':_0x13198b[_0x2967('0x29')],'phone':_0x13198b[_0x2967('0x3b')],'endUserType':_0x13198b[_0x2967('0x3c')][_0x2967('0x3d')][_0x2967('0x3e')]()});}}})[_0x2967('0x25')](function(_0x51c5f9){if(_0x51c5f9){logger[_0x2967('0x1c')](_0x2967('0x3f'),_0x51c5f9[_0x2967('0x13')],_0x51b0ec);return BPromise[_0x2967('0x28')](_0x51c5f9);}else{logger[_0x2967('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x51b0ec);var _0x4f5f65={'Phone':_0x51b0ec};if(_0x28442d[_0x2967('0x40')]){if(_0x28442d[_0x2967('0x40')]===_0x2967('0x14')){logger[_0x2967('0x1c')](_0x2967('0x41'),_0x51b0ec,_0x28442d['moduleCreate']);_0x4f5f65[_0x2967('0x42')]=_0x47fc43!==''?_0x47fc43:util[_0x2967('0x43')](_0x2967('0x44'),_0x51b0ec);}else if(_0x28442d[_0x2967('0x40')]===_0x2967('0x15')){logger[_0x2967('0x1c')](_0x2967('0x41'),_0x51b0ec,_0x28442d[_0x2967('0x40')]);_0x4f5f65[_0x2967('0x42')]=_0x47fc43!==_0x2967('0x45')?_0x47fc43:util[_0x2967('0x43')](_0x2967('0x44'),_0x51b0ec);_0x4f5f65['Company']=_0x2967('0x46');}else if(_0x28442d[_0x2967('0x40')]===_0x2967('0x19')){logger[_0x2967('0x1c')](_0x2967('0x41'),_0x51b0ec,_0x28442d[_0x2967('0x40')]);_0x4f5f65[_0x2967('0x29')]=_0x47fc43!==_0x2967('0x45')?_0x47fc43:util['format'](_0x2967('0x44'),_0x51b0ec);}else{return null;}}return _0x4ef2fd[_0x2967('0x1e')](_['upperFirst'](_0x28442d[_0x2967('0x40')]))[_0x2967('0x1f')](_0x4f5f65)[_0x2967('0x25')](function(_0x28ac4a){return BPromise[_0x2967('0x28')]({'id':_0x28ac4a['id'],'endUserType':_0x28442d[_0x2967('0x40')]});});}});}function getCustomFields(_0x2e4d3c,_0xfe5ad2){var _0x5279f8={};if(_0x2e4d3c[_0x2967('0x26')]>0x0){_[_0x2967('0x47')](_0x2e4d3c,function(_0xc5b234){if(_[_0x2967('0x48')]([_0x2967('0x49'),'picklist'],_0xc5b234['type'])&&_0xc5b234[_0x2967('0x4a')]){_0x5279f8[_0xc5b234[_0x2967('0x4a')]]=_0xc5b234[_0x2967('0x4b')][_0x2967('0x4c')]();}else if(_0xc5b234['type']===_0x2967('0x4d')&&_0xc5b234['variableName']&&_0xc5b234[_0x2967('0x4a')]){_0xfe5ad2[_0xc5b234['variableName']]&&(_0x5279f8[_0xc5b234[_0x2967('0x4a')]]=_0xfe5ad2[_0xc5b234[_0x2967('0x4e')]][_0x2967('0x4c')]());}else if(_0xc5b234['type']===_0x2967('0x4f')&&_0xc5b234['Variable']&&_0xc5b234[_0x2967('0x50')][_0x2967('0x51')]&&_0xc5b234[_0x2967('0x4a')]){_0xfe5ad2[_0xc5b234[_0x2967('0x50')][_0x2967('0x51')][_0x2967('0x3e')]()]&&(_0x5279f8[_0xc5b234['idField']]=_0xfe5ad2[_0xc5b234[_0x2967('0x50')][_0x2967('0x51')]['toLowerCase']()][_0x2967('0x4c')]());}});}return _0x5279f8;}function getConnection(_0x37562a){var _0x43444f=_0x37562a['password'][_0x2967('0x52')](_0x37562a['securityToken']);var _0x197169=new jsforce[(_0x2967('0x53'))]({'oauth2':{'loginUrl':_0x37562a[_0x2967('0x54')]||'https://login.salesforce.com','clientId':_0x37562a[_0x2967('0x55')],'clientSecret':_0x37562a[_0x2967('0x56')]}});return _0x197169[_0x2967('0x57')](_0x37562a[_0x2967('0x58')],_0x43444f)['then'](function(){logger[_0x2967('0x1c')]('Connection\x20established.');return _0x197169;});}exports[_0x2967('0x59')]=function(_0x3d17a6,_0x4c9565,_0x4fd2b3,_0x774318,_0x40376b,_0xca331d){var _0xae16d8,_0x20e544,_0x38d49c,_0x30ded9;_0xca331d[_0x2967('0x5a')]=intUtil['stripTrailingSlash'](_0xca331d[_0x2967('0x5a')]);_0xca331d[_0x2967('0x54')]=intUtil[_0x2967('0x5b')](_0xca331d[_0x2967('0x54')]);if(_0x40376b&&_0x40376b[_0x2967('0x5c')]){logger[_0x2967('0x1c')]('[QUEUE]',_0x2967('0x5d'));_0x4c9565['recordingURL']=util[_0x2967('0x43')](_0x2967('0x5e'),_0xca331d['serverUrl'],_0x4c9565[_0x2967('0x5f')],md5(_0x4c9565[_0x2967('0x5f')]));}else{_0x4c9565[_0x2967('0x60')]='';}return getConnection(_0xca331d)[_0x2967('0x25')](function(_0x5e6517){_0x30ded9=_0x5e6517;return getUser(_0xca331d,_0x774318[_0x2967('0x61')],_0x30ded9);})['then'](function(_0x883bf7){_0xae16d8=_0x883bf7;return getEndUser(_0xca331d,_0x4fd2b3,_0x4c9565[_0x2967('0x62')],_0x4c9565[_0x2967('0x63')],_0x30ded9);})[_0x2967('0x25')](function(_0x58dfa7){_0x20e544=_0x58dfa7;return getTicket(_0xca331d,_0xae16d8,_0x20e544,_0x4fd2b3,_0x4c9565,_0x4fd2b3[_0x2967('0x64')],_0x30ded9,_0x2967('0x59'));})[_0x2967('0x25')](function(_0x211e4f){_0x38d49c=_0x211e4f;logger['info'](_0x2967('0x65'),_0x38d49c['id']);logger[_0x2967('0x1c')](_0x2967('0x66'),_0x38d49c['id'],_0x774318['name'],_0xca331d[_0x2967('0x3d')]);switch(_0xca331d[_0x2967('0x3d')]){case _0x2967('0x67'):emit(util[_0x2967('0x43')](_0x2967('0x68'),_0x774318[_0x2967('0x51')]),_0x2967('0x69'),{'recordId':_0x38d49c['id']});break;case _0x2967('0x6a'):emit(util[_0x2967('0x43')](_0x2967('0x68'),_0x774318[_0x2967('0x51')]),_0x2967('0x6b'),{'uri':util[_0x2967('0x43')]('%s/%s/e',_0x30ded9[_0x2967('0x6c')],_0x38d49c['id'])});break;default:logger[_0x2967('0x6d')](_0x2967('0x6e'));}})[_0x2967('0x6f')](function(_0x13fd98){logger[_0x2967('0x6d')](_0x2967('0x70'),_0x13fd98);});};exports['outbound']=function(_0x16bf4a,_0x30177c,_0x4e2858,_0x127e8e,_0x538423,_0xbb676d,_0x5421e3){var _0x4380c8,_0x431e46,_0x357183,_0x11f645;_0xbb676d[_0x2967('0x5a')]=intUtil[_0x2967('0x5b')](_0xbb676d[_0x2967('0x5a')]);_0xbb676d[_0x2967('0x54')]=intUtil[_0x2967('0x5b')](_0xbb676d[_0x2967('0x54')]);if(_0x5421e3&&_0x5421e3['recordingFormat']&&_0x5421e3[_0x2967('0x71')]!==_0x2967('0x72')){logger[_0x2967('0x1c')](_0x2967('0x73'),_0x2967('0x5d'));_0x30177c[_0x2967('0x60')]=util['format'](_0x2967('0x5e'),_0xbb676d[_0x2967('0x5a')],_0x30177c[_0x2967('0x5f')],md5(_0x30177c[_0x2967('0x5f')]));}return getConnection(_0xbb676d)[_0x2967('0x25')](function(_0x8945df){_0x11f645=_0x8945df;return getUser(_0xbb676d,_0x127e8e[_0x2967('0x61')],_0x11f645);})['then'](function(_0x2394e2){_0x4380c8=_0x2394e2;return getEndUser(_0xbb676d,_0x4e2858,_0x30177c['destcalleridname'],_0x30177c[_0x2967('0x74')],_0x11f645);})[_0x2967('0x25')](function(_0x39230a){_0x431e46=_0x39230a;return getTicket(_0xbb676d,_0x4380c8,_0x431e46,_0x4e2858,_0x30177c,_0x4e2858[_0x2967('0x64')],_0x11f645,'outbound');})[_0x2967('0x25')](function(_0x4132ce){_0x357183=_0x4132ce;logger['info'](_0x2967('0x75'),_0x357183['id']);logger[_0x2967('0x1c')](_0x2967('0x76'),_0x357183['id'],_0x127e8e[_0x2967('0x51')],_0xbb676d['type']);switch(_0xbb676d[_0x2967('0x3d')]){case _0x2967('0x67'):emit(util[_0x2967('0x43')](_0x2967('0x68'),_0x127e8e[_0x2967('0x51')]),'trigger:salesforce:display',{'recordId':_0x357183['id']});break;case _0x2967('0x6a'):emit(util['format']('user:%s',_0x127e8e[_0x2967('0x51')]),_0x2967('0x6b'),{'uri':util[_0x2967('0x43')](_0x2967('0x77'),_0x11f645[_0x2967('0x6c')],_0x357183['id'])});break;default:logger[_0x2967('0x6d')](_0x2967('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x2967('0x6f')](function(_0x21dedc){logger['error'](_0x2967('0x73'),_0x21dedc);});};exports[_0x2967('0x78')]=function(_0x1cd89c,_0x266cc8,_0x519a67,_0x18e6be,_0x498c20,_0xffa503){var _0xf74cab,_0x42fc96,_0xb8b44a,_0x116080;_0xffa503[_0x2967('0x5a')]=intUtil[_0x2967('0x5b')](_0xffa503[_0x2967('0x5a')]);_0xffa503[_0x2967('0x54')]=intUtil[_0x2967('0x5b')](_0xffa503[_0x2967('0x54')]);if(_0x498c20&&_0x498c20['monitor_format']){logger[_0x2967('0x1c')]('['+_0x266cc8['lastevent'][_0x2967('0x79')]()+']',_0x2967('0x5d'));_0x266cc8[_0x2967('0x60')]=util[_0x2967('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xffa503[_0x2967('0x5a')],_0x266cc8['uniqueid'],md5(_0x266cc8['uniqueid']));}else{_0x266cc8[_0x2967('0x60')]='';}return getConnection(_0xffa503)[_0x2967('0x25')](function(_0x580ed2){_0x116080=_0x580ed2;if(!_[_0x2967('0x20')](_0x18e6be)){return getUser(_0xffa503,_0x18e6be['name'],_0x116080);}else{return getUser(_0xffa503,null,_0x116080);}})[_0x2967('0x25')](function(_0x262c67){_0xf74cab=_0x262c67;return getEndUser(_0xffa503,_0x519a67,_0x266cc8['calleridname'],_0x266cc8['calleridnum'],_0x116080);})[_0x2967('0x25')](function(_0x4f1c43){_0x42fc96=_0x4f1c43;return getTicket(_0xffa503,_0xf74cab,_0x42fc96,_0x519a67,_0x266cc8,_0x519a67['Fields'],_0x116080);})['then'](function(_0x26e241){_0xb8b44a=_0x26e241;logger['info']('['+_0x266cc8[_0x2967('0x7a')][_0x2967('0x79')]()+_0x2967('0x7b'),_0xb8b44a['id']);logger[_0x2967('0x1c')]('['+_0x266cc8[_0x2967('0x7a')][_0x2967('0x79')]()+_0x2967('0x7c'),_0xffa503['type']);})[_0x2967('0x6f')](function(_0x3e7bc4){logger[_0x2967('0x6d')]('['+_0x266cc8[_0x2967('0x7a')][_0x2967('0x79')]()+']',_0x3e7bc4);});}; \ No newline at end of file +var _0x7c1f=['contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variableName','toString','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lastevent','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType'];(function(_0x4b1aba,_0x1955ff){var _0x187e18=function(_0x96ede){while(--_0x96ede){_0x4b1aba['push'](_0x4b1aba['shift']());}};_0x187e18(++_0x1955ff);}(_0x7c1f,0xee));var _0xf7c1=function(_0x279b3f,_0x52be83){_0x279b3f=_0x279b3f-0x0;var _0x155a46=_0x7c1f[_0x279b3f];return _0x155a46;};'use strict';var _=require('lodash');var rp=require(_0xf7c1('0x0'));var moment=require(_0xf7c1('0x1'));var BPromise=require('bluebird');var md5=require(_0xf7c1('0x2'));var jsforce=require(_0xf7c1('0x3'));var util=require('util');var Redis=require(_0xf7c1('0x4'));var intUtil=require(_0xf7c1('0x5'));var config=require(_0xf7c1('0x6'));var logger=require(_0xf7c1('0x7'))(_0xf7c1('0x8'));config[_0xf7c1('0x9')]=_['defaults'](config[_0xf7c1('0x9')],{'host':_0xf7c1('0xa'),'port':0x18eb});var io=require(_0xf7c1('0xb'))(new Redis(config['redis']));function emit(_0x2be6f9,_0x303965,_0x2450f3){io['to'](_0x2be6f9)['emit'](_0x303965,_0x2450f3);}function getTicket(_0x3631bd,_0x5343e2,_0x57018a,_0x1c249f,_0x520f79,_0x5674e0,_0x32bc26,_0xf8a7be){var _0x55bde1=Object[_0xf7c1('0xc')]({},{'OwnerId':_0x5343e2['id'],'Subject':intUtil[_0xf7c1('0xd')](_0x1c249f[_0xf7c1('0xe')],_0x520f79,'\x20'),'Description':intUtil[_0xf7c1('0xd')](_0x1c249f[_0xf7c1('0xf')],_0x520f79,'\x0a')},getCustomFields(_0x5674e0,_0x520f79));if(_0x57018a){if(_0x1c249f[_0xf7c1('0x10')]===_0xf7c1('0x11')){_0x55bde1[_0xf7c1('0x12')]=moment[_0xf7c1('0x13')]();_0x55bde1[_0xf7c1('0x14')]=![];_0x55bde1['IsRecurrence']=![];if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x16')||_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x17')){_0x55bde1[_0xf7c1('0x18')]=_0x57018a['id'];}else if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x19')){_0x55bde1[_0xf7c1('0x1a')]=_0x57018a['id'];}}else if(_0x1c249f[_0xf7c1('0x10')]===_0xf7c1('0x1b')){if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x16')){_0x55bde1[_0xf7c1('0x1c')]=_0x57018a['id'];}else if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x19')){_0x55bde1[_0xf7c1('0x1d')]=_0x57018a['id'];}else if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x17')&&_0x1c249f[_0xf7c1('0x1e')]){_0x55bde1[_0x1c249f['leadId']]=_0x57018a['id'];}else{logger[_0xf7c1('0x1f')](_0xf7c1('0x20'));}}}return _0x32bc26[_0xf7c1('0x21')](_0x1c249f['ticketType'])[_0xf7c1('0x22')](_0x55bde1);}function getUser(_0xd569a3,_0x4e21e1,_0xf62548){if(!_[_0xf7c1('0x23')](_0x4e21e1)&&intUtil['validateEmail'](_0x4e21e1)){var _0x26c2ff={'Email':_0x4e21e1};var _0x142dc0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xf62548[_0xf7c1('0x21')](_0xf7c1('0x24'))[_0xf7c1('0x25')](_0x26c2ff,_0x142dc0)[_0xf7c1('0x26')]()[_0xf7c1('0x27')](function(_0x2440ac){if(_0x2440ac[_0xf7c1('0x28')]){var _0xa2585c=_[_0xf7c1('0x25')](_0x2440ac,function(_0x45eafc){return _0x45eafc['Email']===_0x4e21e1;});if(_0xa2585c){logger['info'](_0xf7c1('0x29'),_0x4e21e1);return BPromise['resolve']({'id':_0xa2585c['Id'],'name':_0xa2585c['Name']});}}else{logger[_0xf7c1('0x1f')](_0xf7c1('0x2a'),_0x4e21e1);return _0xf62548[_0xf7c1('0x2b')]()[_0xf7c1('0x27')](function(_0x43ce76){return BPromise['resolve']({'id':_0x43ce76[_0xf7c1('0x2c')],'name':_0x43ce76['display_name']});});}});}else{logger[_0xf7c1('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4e21e1);return _0xf62548[_0xf7c1('0x2b')]()['then'](function(_0x22aff9){return BPromise['resolve']({'id':_0x22aff9[_0xf7c1('0x2c')],'name':_0x22aff9[_0xf7c1('0x2d')]});});}}function getEndUser(_0x12e52c,_0x272fa2,_0x20a3be,_0x561047,_0x18b10e){var _0x2ceffb={'$or':{'Phone':_0x561047}};var _0x106c2e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf7c1('0x2e')]()[_0xf7c1('0x27')](function(){logger[_0xf7c1('0x1f')](_0xf7c1('0x2f'),_0x561047,_0x272fa2['moduleSearch']);switch(_0x272fa2['moduleSearch']){case _0xf7c1('0x30'):var _0x214d46=_['cloneDeep'](_0x2ceffb);if(_0x272fa2['additionalSearchContact']){var _0x3d07a1={};_0x3d07a1[_0x272fa2[_0xf7c1('0x31')]]=_0x561047;_['merge'](_0x214d46[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x33'))['find'](_0x214d46,_0x106c2e)[_0xf7c1('0x26')]()['then'](function(_0x31eefd){if(_0x31eefd&&_0x31eefd[_0xf7c1('0x28')]){return _0x31eefd;}else{var _0x2bdeda=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x35')]){var _0x202899={};_0x202899[_0x272fa2[_0xf7c1('0x35')]]=_0x561047;_[_0xf7c1('0x36')](_0x2bdeda[_0xf7c1('0x32')],_0x202899);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x37'))[_0xf7c1('0x25')](_0x2bdeda,_0x106c2e);}});case _0xf7c1('0x38'):var _0x3164ff=_['cloneDeep'](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x39')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2[_0xf7c1('0x39')]]=_0x561047;_[_0xf7c1('0x36')](_0x3164ff['$or'],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x3a'))[_0xf7c1('0x25')](_0x3164ff,_0x106c2e)[_0xf7c1('0x26')]()[_0xf7c1('0x27')](function(_0x3b3078){if(_0x3b3078&&_0x3b3078[_0xf7c1('0x28')]){return _0x3b3078;}else{var _0x3ebab8=_['cloneDeep'](_0x2ceffb);if(_0x272fa2['additionalSearchContact']){var _0x3ac873={};_0x3ac873[_0x272fa2['additionalSearchContact']]=_0x561047;_[_0xf7c1('0x36')](_0x3ebab8[_0xf7c1('0x32')],_0x3ac873);}return _0x18b10e[_0xf7c1('0x21')]('Contact')[_0xf7c1('0x25')](_0x3ebab8,_0x106c2e)[_0xf7c1('0x27')](function(_0x391ccc){if(_0x391ccc&&_0x391ccc[_0xf7c1('0x28')]){return _0x391ccc;}else{var _0xe2cfe6=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x35')]){var _0x5284c2={};_0x5284c2[_0x272fa2[_0xf7c1('0x35')]]=_0x561047;_[_0xf7c1('0x36')](_0xe2cfe6[_0xf7c1('0x32')],_0x5284c2);}return _0x18b10e[_0xf7c1('0x21')]('Lead')[_0xf7c1('0x25')](_0xe2cfe6,_0x106c2e);}});}});case _0xf7c1('0x16'):var _0x214d46=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x31')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2['additionalSearchContact']]=_0x561047;_[_0xf7c1('0x36')](_0x214d46[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x33'))['find'](_0x214d46,_0x106c2e)[_0xf7c1('0x26')]();case _0xf7c1('0x17'):var _0x2aa3d4=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x35')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2['additionalSearchLead']]=_0x561047;_[_0xf7c1('0x36')](_0x2aa3d4[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e['sobject']('Lead')[_0xf7c1('0x25')](_0x2aa3d4,_0x106c2e);case _0xf7c1('0x19'):var _0x3164ff=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x39')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2['additionalSearchAccount']]=_0x561047;_[_0xf7c1('0x36')](_0x3164ff[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x3a'))['find'](_0x3164ff,_0x106c2e);default:return null;}})['then'](function(_0x1778fe){if(_0x1778fe&&_0x1778fe[_0xf7c1('0x28')]){var _0x2cd589=_[_0xf7c1('0x3b')](_0x1778fe);if(_0x2cd589){return BPromise[_0xf7c1('0x2e')]({'id':_0x2cd589['Id'],'name':_0x2cd589[_0xf7c1('0x3c')],'phone':_0x2cd589[_0xf7c1('0x3d')],'endUserType':_0x2cd589[_0xf7c1('0x3e')][_0xf7c1('0x3f')][_0xf7c1('0x40')]()});}}})[_0xf7c1('0x27')](function(_0x3db06b){if(_0x3db06b){logger[_0xf7c1('0x1f')](_0xf7c1('0x41'),_0x3db06b['endUserType'],_0x561047);return BPromise['resolve'](_0x3db06b);}else{logger[_0xf7c1('0x1f')](_0xf7c1('0x42'),_0x561047);var _0x5be8f6={'Phone':_0x561047};if(_0x272fa2['moduleCreate']){if(_0x272fa2['moduleCreate']===_0xf7c1('0x16')){logger[_0xf7c1('0x1f')](_0xf7c1('0x43'),_0x561047,_0x272fa2[_0xf7c1('0x44')]);_0x5be8f6['LastName']=_0x20a3be!==_0xf7c1('0x45')?_0x20a3be:util[_0xf7c1('0x46')](_0xf7c1('0x47'),_0x561047);}else if(_0x272fa2[_0xf7c1('0x44')]===_0xf7c1('0x17')){logger[_0xf7c1('0x1f')](_0xf7c1('0x43'),_0x561047,_0x272fa2[_0xf7c1('0x44')]);_0x5be8f6[_0xf7c1('0x48')]=_0x20a3be!==_0xf7c1('0x45')?_0x20a3be:util[_0xf7c1('0x46')](_0xf7c1('0x47'),_0x561047);_0x5be8f6[_0xf7c1('0x49')]=_0xf7c1('0x4a');}else if(_0x272fa2[_0xf7c1('0x44')]===_0xf7c1('0x19')){logger[_0xf7c1('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x561047,_0x272fa2[_0xf7c1('0x44')]);_0x5be8f6['Name']=_0x20a3be!==_0xf7c1('0x45')?_0x20a3be:util[_0xf7c1('0x46')](_0xf7c1('0x47'),_0x561047);}else{return null;}}return _0x18b10e[_0xf7c1('0x21')](_[_0xf7c1('0x4b')](_0x272fa2['moduleCreate']))[_0xf7c1('0x22')](_0x5be8f6)[_0xf7c1('0x27')](function(_0x5599c1){return BPromise['resolve']({'id':_0x5599c1['id'],'endUserType':_0x272fa2[_0xf7c1('0x44')]});});}});}function getCustomFields(_0xef731e,_0x8201b5){var _0x1e11b8={};if(_0xef731e[_0xf7c1('0x28')]>0x0){_[_0xf7c1('0x4c')](_0xef731e,function(_0x5378ed){if(_[_0xf7c1('0x4d')]([_0xf7c1('0x4e'),_0xf7c1('0x4f')],_0x5378ed[_0xf7c1('0x3f')])&&_0x5378ed[_0xf7c1('0x50')]){_0x1e11b8[_0x5378ed[_0xf7c1('0x50')]]=_0x5378ed[_0xf7c1('0x51')]['toString']();}else if(_0x5378ed[_0xf7c1('0x3f')]==='variable'&&_0x5378ed['variableName']&&_0x5378ed[_0xf7c1('0x50')]){_0x8201b5[_0x5378ed[_0xf7c1('0x52')]]&&(_0x1e11b8[_0x5378ed[_0xf7c1('0x50')]]=_0x8201b5[_0x5378ed[_0xf7c1('0x52')]][_0xf7c1('0x53')]());}else if(_0x5378ed[_0xf7c1('0x3f')]===_0xf7c1('0x54')&&_0x5378ed[_0xf7c1('0x55')]&&_0x5378ed[_0xf7c1('0x55')][_0xf7c1('0x56')]&&_0x5378ed[_0xf7c1('0x50')]){_0x8201b5[_0x5378ed[_0xf7c1('0x55')][_0xf7c1('0x56')][_0xf7c1('0x40')]()]&&(_0x1e11b8[_0x5378ed[_0xf7c1('0x50')]]=_0x8201b5[_0x5378ed['Variable'][_0xf7c1('0x56')]['toLowerCase']()][_0xf7c1('0x53')]());}});}return _0x1e11b8;}function getConnection(_0x40db31){var _0x3b292f=_0x40db31[_0xf7c1('0x57')][_0xf7c1('0x58')](_0x40db31['securityToken']);var _0x821c83=new jsforce[(_0xf7c1('0x59'))]({'oauth2':{'loginUrl':_0x40db31[_0xf7c1('0x5a')]||_0xf7c1('0x5b'),'clientId':_0x40db31[_0xf7c1('0x5c')],'clientSecret':_0x40db31[_0xf7c1('0x5d')]}});return _0x821c83[_0xf7c1('0x5e')](_0x40db31[_0xf7c1('0x5f')],_0x3b292f)[_0xf7c1('0x27')](function(){logger['info'](_0xf7c1('0x60'));return _0x821c83;});}exports['queue']=function(_0x12537d,_0x5b2866,_0x4bc08f,_0x57d086,_0x3e4bac,_0x5bc64b){var _0x100bd2,_0x24ec80,_0x1afa2e,_0x41cddf;_0x5bc64b[_0xf7c1('0x61')]=intUtil[_0xf7c1('0x62')](_0x5bc64b['serverUrl']);_0x5bc64b[_0xf7c1('0x5a')]=intUtil[_0xf7c1('0x62')](_0x5bc64b[_0xf7c1('0x5a')]);if(_0x3e4bac&&_0x3e4bac[_0xf7c1('0x63')]){logger[_0xf7c1('0x1f')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5b2866[_0xf7c1('0x64')]=util[_0xf7c1('0x46')](_0xf7c1('0x65'),_0x5bc64b[_0xf7c1('0x61')],_0x5b2866[_0xf7c1('0x66')],md5(_0x5b2866['uniqueid']));}else{_0x5b2866[_0xf7c1('0x64')]='';}return getConnection(_0x5bc64b)['then'](function(_0xff04bc){_0x41cddf=_0xff04bc;return getUser(_0x5bc64b,_0x57d086[_0xf7c1('0x67')],_0x41cddf);})[_0xf7c1('0x27')](function(_0x4e3b1b){_0x100bd2=_0x4e3b1b;return getEndUser(_0x5bc64b,_0x4bc08f,_0x5b2866[_0xf7c1('0x68')],_0x5b2866[_0xf7c1('0x69')],_0x41cddf);})[_0xf7c1('0x27')](function(_0x2dc210){_0x24ec80=_0x2dc210;return getTicket(_0x5bc64b,_0x100bd2,_0x24ec80,_0x4bc08f,_0x5b2866,_0x4bc08f[_0xf7c1('0x6a')],_0x41cddf,_0xf7c1('0x6b'));})[_0xf7c1('0x27')](function(_0x11fd4b){_0x1afa2e=_0x11fd4b;logger[_0xf7c1('0x1f')](_0xf7c1('0x6c'),_0x1afa2e['id']);logger[_0xf7c1('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1afa2e['id'],_0x57d086[_0xf7c1('0x56')],_0x5bc64b[_0xf7c1('0x3f')]);switch(_0x5bc64b['type']){case _0xf7c1('0x6d'):emit(util[_0xf7c1('0x46')]('user:%s',_0x57d086[_0xf7c1('0x56')]),_0xf7c1('0x6e'),{'recordId':_0x1afa2e['id']});break;case _0xf7c1('0x6f'):emit(util[_0xf7c1('0x46')](_0xf7c1('0x70'),_0x57d086[_0xf7c1('0x56')]),'trigger:browser:url',{'uri':util[_0xf7c1('0x46')]('%s/%s/e',_0x41cddf['instanceUrl'],_0x1afa2e['id'])});break;default:logger[_0xf7c1('0x71')](_0xf7c1('0x72'));}})[_0xf7c1('0x73')](function(_0x2574d1){logger['error'](_0xf7c1('0x74'),_0x2574d1);});};exports[_0xf7c1('0x75')]=function(_0x4f8f2a,_0x4ff234,_0x3aa1c2,_0x3f456f,_0x223298,_0x55d475,_0x41b3c9){var _0x31d6c5,_0x1e2e93,_0x2c07ab,_0x10ad74;_0x55d475['serverUrl']=intUtil[_0xf7c1('0x62')](_0x55d475[_0xf7c1('0x61')]);_0x55d475[_0xf7c1('0x5a')]=intUtil['stripTrailingSlash'](_0x55d475['remoteUri']);if(_0x41b3c9&&_0x41b3c9[_0xf7c1('0x76')]&&_0x41b3c9[_0xf7c1('0x76')]!=='none'){logger[_0xf7c1('0x1f')]('[OUTBOUND]',_0xf7c1('0x77'));_0x4ff234['recordingURL']=util['format'](_0xf7c1('0x65'),_0x55d475[_0xf7c1('0x61')],_0x4ff234[_0xf7c1('0x66')],md5(_0x4ff234[_0xf7c1('0x66')]));}return getConnection(_0x55d475)[_0xf7c1('0x27')](function(_0x2eccc3){_0x10ad74=_0x2eccc3;return getUser(_0x55d475,_0x3f456f['email'],_0x10ad74);})[_0xf7c1('0x27')](function(_0x9b748a){_0x31d6c5=_0x9b748a;return getEndUser(_0x55d475,_0x3aa1c2,_0x4ff234[_0xf7c1('0x78')],_0x4ff234['destcalleridnum'],_0x10ad74);})[_0xf7c1('0x27')](function(_0x5e981b){_0x1e2e93=_0x5e981b;return getTicket(_0x55d475,_0x31d6c5,_0x1e2e93,_0x3aa1c2,_0x4ff234,_0x3aa1c2[_0xf7c1('0x6a')],_0x10ad74,_0xf7c1('0x75'));})[_0xf7c1('0x27')](function(_0x593a0d){_0x2c07ab=_0x593a0d;logger[_0xf7c1('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2c07ab['id']);logger['info'](_0xf7c1('0x79'),_0x2c07ab['id'],_0x3f456f[_0xf7c1('0x56')],_0x55d475[_0xf7c1('0x3f')]);switch(_0x55d475[_0xf7c1('0x3f')]){case _0xf7c1('0x6d'):emit(util[_0xf7c1('0x46')]('user:%s',_0x3f456f[_0xf7c1('0x56')]),_0xf7c1('0x6e'),{'recordId':_0x2c07ab['id']});break;case _0xf7c1('0x6f'):emit(util['format'](_0xf7c1('0x70'),_0x3f456f[_0xf7c1('0x56')]),'trigger:browser:url',{'uri':util[_0xf7c1('0x46')](_0xf7c1('0x7a'),_0x10ad74[_0xf7c1('0x7b')],_0x2c07ab['id'])});break;default:logger[_0xf7c1('0x71')](_0xf7c1('0x7c'),_0xf7c1('0x7d'));}})[_0xf7c1('0x73')](function(_0x1a0d71){logger[_0xf7c1('0x71')](_0xf7c1('0x7c'),_0x1a0d71);});};exports[_0xf7c1('0x7e')]=function(_0x80abfc,_0x478421,_0x4423d6,_0x1a87ef,_0x35f4dd,_0x22c388){var _0x3c6ade,_0x122836,_0x2a6d0f,_0x1c7773;_0x22c388['serverUrl']=intUtil[_0xf7c1('0x62')](_0x22c388[_0xf7c1('0x61')]);_0x22c388[_0xf7c1('0x5a')]=intUtil[_0xf7c1('0x62')](_0x22c388[_0xf7c1('0x5a')]);if(_0x35f4dd&&_0x35f4dd[_0xf7c1('0x63')]){logger[_0xf7c1('0x1f')]('['+_0x478421['lastevent'][_0xf7c1('0x7f')]()+']',_0xf7c1('0x77'));_0x478421[_0xf7c1('0x64')]=util[_0xf7c1('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22c388['serverUrl'],_0x478421[_0xf7c1('0x66')],md5(_0x478421['uniqueid']));}else{_0x478421[_0xf7c1('0x64')]='';}return getConnection(_0x22c388)[_0xf7c1('0x27')](function(_0x12b2be){_0x1c7773=_0x12b2be;if(!_['isNil'](_0x1a87ef)){return getUser(_0x22c388,_0x1a87ef[_0xf7c1('0x56')],_0x1c7773);}else{return getUser(_0x22c388,null,_0x1c7773);}})['then'](function(_0x3c08b4){_0x3c6ade=_0x3c08b4;return getEndUser(_0x22c388,_0x4423d6,_0x478421['calleridname'],_0x478421[_0xf7c1('0x69')],_0x1c7773);})[_0xf7c1('0x27')](function(_0x5ecd07){_0x122836=_0x5ecd07;return getTicket(_0x22c388,_0x3c6ade,_0x122836,_0x4423d6,_0x478421,_0x4423d6[_0xf7c1('0x6a')],_0x1c7773);})['then'](function(_0x410c5f){_0x2a6d0f=_0x410c5f;logger[_0xf7c1('0x1f')]('['+_0x478421['lastevent'][_0xf7c1('0x7f')]()+']\x20Ticket\x20%s\x20created.',_0x2a6d0f['id']);logger[_0xf7c1('0x1f')]('['+_0x478421['lastevent']['toUpperCase']()+_0xf7c1('0x80'),_0x22c388[_0xf7c1('0x3f')]);})[_0xf7c1('0x73')](function(_0x34d460){logger[_0xf7c1('0x71')]('['+_0x478421[_0xf7c1('0x81')]['toUpperCase']()+']',_0x34d460);});}; \ 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 96a02d6..70d007f 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 _0x5293=['Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','password','sysparm_limit=1','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','adminId','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','toString','idField','customField','toLowerCase','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects'];(function(_0x9c5e98,_0x7127b6){var _0x34c516=function(_0x102de4){while(--_0x102de4){_0x9c5e98['push'](_0x9c5e98['shift']());}};_0x34c516(++_0x7127b6);}(_0x5293,0x1cb));var _0x3529=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0x5293[_0x7729b1];return _0x349504;};'use strict';var _=require(_0x3529('0x0'));var Promise=require(_0x3529('0x1'));var rp=require(_0x3529('0x2'));var util=require('util');var md5=require(_0x3529('0x3'));var Redis=require(_0x3529('0x4'));var intUtil=require('./util');var config=require(_0x3529('0x5'));var logger=require(_0x3529('0x6'))('servicenow');config[_0x3529('0x7')]=_[_0x3529('0x8')](config[_0x3529('0x7')],{'host':_0x3529('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3529('0x7')]));function getAdminUser(_0x54c29e,_0x54db44,_0x276414,_0x2a5360,_0x49152d,_0xdfac7d){return new Promise(function(_0x43ca07,_0x1d54d4){var _0x1f0fbd={'method':_0x3529('0xa'),'uri':_0x2a5360+_0x3529('0xb')+'&'+_0x49152d+'&'+_0xdfac7d,'auth':_0x54db44,'json':!![]};return rp(_0x1f0fbd)[_0x3529('0xc')](function(_0x489960){if(_0x489960[_0x3529('0xd')]['length']>0x0){_0x276414['adminId']=_0x489960[_0x3529('0xd')][0x0][_0x3529('0xe')];}logger[_0x3529('0xf')]('['+[_0x54c29e[_0x3529('0x10')]()]+_0x3529('0x11'),_0x276414);_0x43ca07(_0x276414);})[_0x3529('0x12')](function(_0x578ce6){logger[_0x3529('0x13')]('['+[_0x54c29e['toUpperCase']()]+']',_0x578ce6['message']);_0x1d54d4(_0x578ce6[_0x3529('0x14')]);});});}function getUser(_0x53f1e6,_0x427914,_0x190eba,_0x59e922,_0x51dab4){return function(_0x5c3d3a){logger['info']('['+[_0x53f1e6[_0x3529('0x10')]()]+_0x3529('0x15'),_0x5c3d3a);return new Promise(function(_0x38771a,_0x5c2f8a){if(intUtil[_0x3529('0x16')](_0x5c3d3a[_0x3529('0x17')])){var _0x5cddfd={'method':_0x3529('0xa'),'uri':_0x190eba+'sys_user?sysparm_query=email%3D'+_0x5c3d3a[_0x3529('0x17')]+'&'+_0x59e922+'&'+_0x51dab4,'auth':_0x427914,'json':!![]};logger['info']('['+[_0x53f1e6['toUpperCase']()]+_0x3529('0x18'),_0x5cddfd);return rp(_0x5cddfd)[_0x3529('0xc')](function(_0x187f46){logger[_0x3529('0xf')]('['+[_0x53f1e6[_0x3529('0x10')]()]+_0x3529('0x19'),_0x187f46);if(_0x187f46[_0x3529('0xd')]['length']>0x0&&String(_0x187f46[_0x3529('0xd')][0x0][_0x3529('0x1a')])===_0x3529('0x1b')){_0x5c3d3a[_0x3529('0x1c')]=_0x187f46[_0x3529('0xd')][0x0][_0x3529('0xe')];}else{_0x5c3d3a[_0x3529('0x1c')]=_0x5c3d3a['adminId'];_0x5c3d3a[_0x3529('0x17')]=_0x5c3d3a[_0x3529('0x1d')];}logger[_0x3529('0xf')]('['+[_0x53f1e6['toUpperCase']()]+_0x3529('0x1e'),_0x5c3d3a);_0x38771a(_0x5c3d3a);})[_0x3529('0x12')](function(_0x5635b1){logger['error']('['+[_0x53f1e6[_0x3529('0x10')]()]+']',_0x5635b1['message']);_0x5c2f8a(_0x5635b1[_0x3529('0x14')]);});}else{logger['info']('['+[_0x53f1e6[_0x3529('0x10')]()]+']\x20using\x20admin\x20profile');_0x5c3d3a[_0x3529('0x1c')]=_0x5c3d3a[_0x3529('0x1f')];_0x5c3d3a[_0x3529('0x17')]=_0x5c3d3a[_0x3529('0x1d')];_0x38771a(_0x5c3d3a);}});};}function createEndUser(_0x44fa1b,_0x29a6d1,_0x17dc08,_0x5ac342,_0x205081){logger[_0x3529('0xf')]('['+[_0x44fa1b[_0x3529('0x10')]()]+_0x3529('0x20'),_0x17dc08);return new Promise(function(_0x313703,_0x35dc42){var _0x497e28={'method':'POST','uri':_0x5ac342+_0x3529('0x21')+_0x205081,'body':{'user_name':_0x17dc08[_0x3529('0x22')],'roles':'user','first_name':_0x17dc08[_0x3529('0x22')],'active':'true','date_format':_0x3529('0x23'),'phone':_0x17dc08[_0x3529('0x22')]},'auth':_0x29a6d1,'json':!![]};return rp(_0x497e28)[_0x3529('0xc')](function(_0x3db85e){logger['info']('['+[_0x44fa1b['toUpperCase']()]+_0x3529('0x24'),_0x3db85e['result']);_0x17dc08[_0x3529('0x25')]=_0x3db85e[_0x3529('0xd')][_0x3529('0xe')];_0x313703(_0x17dc08);})['catch'](function(_0x44872b){logger['error']('['+[_0x44fa1b[_0x3529('0x10')]()]+']',_0x44872b[_0x3529('0x14')]);_0x35dc42(_0x44872b['message']);});});}function getEndUser(_0x534979,_0x1b0962,_0x35af9a,_0x598da6,_0x1b0a53){return function(_0xfde46c){logger[_0x3529('0xf')]('['+[_0x534979[_0x3529('0x10')]()]+_0x3529('0x26'),_0xfde46c);return new Promise(function(_0x242ad7,_0x475a5b){var _0xddcbfa={'method':_0x3529('0xa'),'uri':_0x35af9a+_0x3529('0x27')+_0xfde46c[_0x3529('0x22')]+'&'+_0x598da6+'&'+_0x1b0a53,'auth':_0x1b0962,'json':!![]};return rp(_0xddcbfa)[_0x3529('0xc')](function(_0x170e6f){if(_0x170e6f[_0x3529('0xd')][_0x3529('0x28')]>0x0){_0xfde46c[_0x3529('0x25')]=_0x170e6f[_0x3529('0xd')][0x0]['sys_id'];logger[_0x3529('0xf')]('['+[_0x534979[_0x3529('0x10')]()]+_0x3529('0x29'),_0xfde46c);_0x242ad7(_0xfde46c);}else{return createEndUser(_0x534979,_0x1b0962,_0xfde46c,_0x35af9a,_0x598da6)['then'](function(_0x2863e0){logger['info']('['+[_0x534979[_0x3529('0x10')]()]+_0x3529('0x2a'),_0x2863e0);_0x242ad7(_0x2863e0);});}})[_0x3529('0x12')](function(_0x27e9ac){logger[_0x3529('0x13')]('['+[_0x534979['toUpperCase']()]+']',_0x27e9ac[_0x3529('0x14')]);_0x475a5b(_0x27e9ac[_0x3529('0x14')]);});});};}function getCustomFields(_0x5cd8c9,_0x48a38d){var _0x5926f6={};if(_0x5cd8c9[_0x3529('0x28')]>0x0){_['forEach'](_0x5cd8c9,function(_0x2cb4a5){if(_['includes']([_0x3529('0x2b'),_0x3529('0x2c')],_0x2cb4a5[_0x3529('0x2d')])&&_0x2cb4a5[_0x3529('0x2e')]&&!_0x2cb4a5['customField']){_0x5926f6[_0x2cb4a5[_0x3529('0x2e')]['toLowerCase']()]=_0x2cb4a5['content'][_0x3529('0x2f')]();}else if(_['includes']([_0x3529('0x2b'),'picklist'],_0x2cb4a5['type'])&&_0x2cb4a5[_0x3529('0x30')]&&_0x2cb4a5[_0x3529('0x31')]){_0x5926f6[_0x2cb4a5[_0x3529('0x30')][_0x3529('0x32')]()]=_0x2cb4a5['content'][_0x3529('0x2f')]();}else if(_0x2cb4a5['type']===_0x3529('0x33')&&_0x2cb4a5['variableName']&&_0x2cb4a5['idField']&&_0x2cb4a5[_0x3529('0x31')]){_0x5926f6[_0x2cb4a5[_0x3529('0x30')][_0x3529('0x32')]()]=_0x48a38d[_0x2cb4a5['variableName']][_0x3529('0x2f')]();}else if(_0x2cb4a5[_0x3529('0x2d')]===_0x3529('0x34')&&_0x2cb4a5['Variable']&&_0x2cb4a5[_0x3529('0x35')][_0x3529('0x36')]&&_0x2cb4a5['idField']&&_0x2cb4a5[_0x3529('0x31')]){_0x5926f6[_0x2cb4a5[_0x3529('0x30')][_0x3529('0x32')]()]=_0x48a38d[_0x2cb4a5[_0x3529('0x35')]['name'][_0x3529('0x32')]()][_0x3529('0x2f')]();}});}return _0x5926f6;}function getTicket(_0x4fa158,_0x40c5a8,_0x527bc7,_0xb2d9c,_0x329f8d,_0x496df3){return function(_0x39cb01){logger['info']('['+[_0x4fa158[_0x3529('0x10')]()]+_0x3529('0x37'),_0x39cb01);return new Promise(function(_0x1b2073,_0x224f45){var _0xaba2ee=_0x4fa158['toLowerCase']()===_0x3529('0x38')?_0x39cb01[_0x3529('0x1c')]:_0x39cb01['endUserId'];var _0x2a97d1={'method':'POST','uri':_0x527bc7+_0x3529('0x39')+'?'+_0x496df3,'body':Object[_0x3529('0x3a')]({},{'active':'true','caller_id':_0xaba2ee,'assigned_to':_0x39cb01['userId'],'short_description':intUtil[_0x3529('0x3b')](_0xb2d9c[_0x3529('0x3c')],_0x329f8d,'\x20'),'description':intUtil[_0x3529('0x3b')](_0xb2d9c[_0x3529('0x3d')],_0x329f8d,'\x0a')},getCustomFields(_0xb2d9c['Fields'],_0x329f8d)),'auth':_0x40c5a8,'json':!![]};return rp(_0x2a97d1)[_0x3529('0xc')](function(_0x33252f){logger['info']('['+[_0x4fa158[_0x3529('0x10')]()]+_0x3529('0x3e'),_0x33252f['result']);_0x39cb01[_0x3529('0x3f')]=_0x33252f[_0x3529('0xd')][_0x3529('0xe')];_0x39cb01[_0x3529('0x40')]=_0x33252f['result'][_0x3529('0x41')];logger['info']('['+[_0x4fa158[_0x3529('0x10')]()]+_0x3529('0x42'),_0x39cb01);_0x1b2073(_0x39cb01);})[_0x3529('0x12')](function(_0x4157f4){logger[_0x3529('0x13')]('['+[_0x4fa158[_0x3529('0x10')]()]+']',_0x4157f4[_0x3529('0x14')]);_0x224f45(_0x4157f4['message']);});});};}function createRemoteTag(_0x56b75e,_0x445ffe,_0x17125a,_0x30fa3f){return new Promise(function(_0x1cadaa,_0x5dc1c4){var _0x106e10={'method':_0x3529('0x43'),'uri':_0x17125a+_0x3529('0x44')+'?'+_0x30fa3f,'body':{'short_description':_0x56b75e,'global':!![],'active':!![],'name':_0x56b75e},'auth':_0x445ffe,'json':!![]};return rp(_0x106e10)[_0x3529('0xc')](function(_0xc5a1d9){var _0x3e72e7=_0xc5a1d9[_0x3529('0xd')][_0x3529('0xe')];_0x1cadaa(_0x3e72e7);});});}function getRemoteTag(_0xc6a230,_0x2e8474,_0x1e6c8d,_0x148ad4,_0x34945d){return new Promise(function(_0x4bc4c1,_0x6dedd1){var _0x27c652={'method':_0x3529('0xa'),'uri':_0x1e6c8d+_0x3529('0x44')+_0x3529('0x45')+_0xc6a230+'&'+_0x148ad4,'auth':_0x2e8474,'json':!![]};return rp(_0x27c652)[_0x3529('0xc')](function(_0x440054){if(_0x440054[_0x3529('0xd')][_0x3529('0x28')]>0x0){var _0x5c857a=_0x440054[_0x3529('0xd')][0x0][_0x3529('0xe')];_0x4bc4c1(_0x5c857a);}else{return createRemoteTag(_0xc6a230,_0x2e8474,_0x1e6c8d,_0x148ad4)['then'](function(_0x2305e2){_0x4bc4c1(_0x2305e2);});}});});}function assignTagToIncident(_0x54e2f3,_0x5e4a85,_0x43e0b2,_0x4b0040,_0x67dd5a){return new Promise(function(_0x3b0c6f,_0x327992){var _0x45e748={'method':'POST','uri':_0x43e0b2+_0x3529('0x46')+'?'+_0x67dd5a,'body':{'label':_0x54e2f3,'table':_0x3529('0x39'),'id_type':'Incident','table_key':_0x4b0040[_0x3529('0x3f')],'title':_0x3529('0x47')+_0x4b0040[_0x3529('0x40')],'id_display':_0x4b0040[_0x3529('0x40')]},'auth':_0x5e4a85,'json':!![]};return rp(_0x45e748)[_0x3529('0xc')](function(_0x42b1cb){_0x3b0c6f();})[_0x3529('0x12')](function(){_0x3b0c6f();});});}function manageTags(_0x5dc706,_0x569d41,_0x4051d4,_0x1f6473,_0xbca595,_0xfd8814,_0x201558){return new Promise(function(_0x4b321f,_0x2a022c){var _0x5b1beb=[];_0x569d41[_0x3529('0x48')](function(_0x36b053){_0x5b1beb[_0x3529('0x49')](getRemoteTag(_0x36b053,_0x4051d4,_0x1f6473,_0xfd8814,_0x201558));});return Promise[_0x3529('0x4a')](_0x5b1beb)[_0x3529('0xc')](function(_0x2940a8){if(_0x2940a8['length']){logger[_0x3529('0xf')]('['+[_0x5dc706[_0x3529('0x10')]()]+_0x3529('0x4b'),_0x2940a8);var _0x1d44b3=[];_0x2940a8['forEach'](function(_0x365555){_0x1d44b3[_0x3529('0x49')](assignTagToIncident(_0x365555,_0x4051d4,_0x1f6473,_0xbca595,_0xfd8814));});return Promise[_0x3529('0x4a')](_0x1d44b3)[_0x3529('0xc')](function(){_0x4b321f();})[_0x3529('0x12')](function(){_0x4b321f();});}else{_0x4b321f();}});});}function getTags(_0x5b5194,_0xa77c7e,_0x24835b,_0xec127e,_0x39319f,_0x550d67){return function(_0x3cf451){return new Promise(function(_0x492fc9,_0x2d657e){var _0x4e833a=[];var _0x32f5af=_0xec127e[_0x3529('0x4c')];if(_0x32f5af&&_0x32f5af[_0x3529('0x28')]>0x0){_0x4e833a=_[_0x3529('0x4d')](_0x32f5af,_0x3529('0x36'));}if(_0x4e833a[_0x3529('0x28')]>0x0){return manageTags(_0x5b5194,_0x4e833a,_0xa77c7e,_0x24835b,_0x3cf451,_0x39319f,_0x550d67)[_0x3529('0xc')](function(){_0x492fc9(_0x3cf451);});}else{_0x492fc9(_0x3cf451);}});};}function emit(_0x4cb3b8,_0x1635e3,_0x44464e){var _0x3645a8='%26sysparm_record_target%3Dincident'+_0x3529('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x3529('0x4f');var _0x2b10f5={'uri':_0x4cb3b8+_0x3529('0x50')+_0x44464e+_0x3645a8};io['to'](util[_0x3529('0x51')]('user:%s',_0x1635e3))['emit']('trigger:browser:url',_0x2b10f5);}exports['cs']=function(_0x53b0ec,_0x4e0b23,_0x439fe2,_0x5c1cb9,_0x2c67ae,_0x3a446a,_0x20e374,_0x1612ff){var _0x271c37={};var _0x20a911={'user':_0x3a446a['username'],'pass':_0x3a446a[_0x3529('0x52')]};var _0xaeae19=_0x3529('0x53');var _0x5ed123='sysparm_display_value=true';_0x3a446a['remoteUri']=intUtil[_0x3529('0x54')](_0x3a446a[_0x3529('0x55')]);_0x3a446a[_0x3529('0x56')]=intUtil[_0x3529('0x54')](_0x3a446a[_0x3529('0x56')]);var _0x22c84d=util[_0x3529('0x51')](_0x3529('0x57'),_0x3a446a[_0x3529('0x55')]);_0x271c37[_0x3529('0x17')]=!_['isNil'](_0x5c1cb9)?_0x5c1cb9['email']:null;_0x271c37[_0x3529('0x1d')]=_0x3a446a[_0x3529('0x58')];_0x271c37['endUserNumber']=_0x1612ff[_0x3529('0x32')]()===_0x3529('0x38')?_0x4e0b23[_0x3529('0x59')]:_0x4e0b23[_0x3529('0x5a')];_0x271c37[_0x3529('0x5b')]=_0x1612ff===_0x3529('0x5c')||_0x1612ff===_0x3529('0x5d')?_0x3529('0x5c'):_0x3529('0x38');var _0x53e69b=util[_0x3529('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a446a[_0x3529('0x56')],_0x4e0b23[_0x3529('0x5e')],md5(_0x4e0b23[_0x3529('0x5e')]));if(_0x2c67ae&&_0x2c67ae[_0x3529('0x5f')]){logger[_0x3529('0xf')](_0x3529('0x60'),_0x3529('0x61'));_0x4e0b23['recordingURL']=_0x53e69b;}else if(_0x20e374&&_0x20e374[_0x3529('0x62')]&&_0x20e374[_0x3529('0x62')]!=='none'){logger[_0x3529('0xf')]('[OUTBOUND]',_0x3529('0x61'));_0x4e0b23[_0x3529('0x63')]=_0x53e69b;}else{_0x4e0b23[_0x3529('0x63')]='';}return getAdminUser(_0x1612ff,_0x20a911,_0x271c37,_0x22c84d,_0x5ed123,_0xaeae19)[_0x3529('0xc')](getUser(_0x1612ff,_0x20a911,_0x22c84d,_0x5ed123,_0xaeae19))['then'](getEndUser(_0x1612ff,_0x20a911,_0x22c84d,_0x5ed123,_0xaeae19))[_0x3529('0xc')](getTicket(_0x1612ff,_0x20a911,_0x22c84d,_0x439fe2,_0x4e0b23,_0x5ed123))[_0x3529('0xc')](function(_0x3425cb){logger[_0x3529('0xf')](util[_0x3529('0x51')](_0x3529('0x64'),_0x3425cb['ticketId']));logger[_0x3529('0xf')](util[_0x3529('0x51')](_0x3529('0x65'),_0x1612ff));if(_0x1612ff!=='unmanaged'){logger[_0x3529('0xf')]('['+[_0x1612ff[_0x3529('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3a446a[_0x3529('0x55')],_0x5c1cb9[_0x3529('0x36')],_0x3425cb[_0x3529('0x3f')]);}})[_0x3529('0x12')](function(_0x4710d1){logger[_0x3529('0x13')]('['+[_0x1612ff[_0x3529('0x10')]()]+_0x3529('0x66'),util[_0x3529('0x67')](_0x4710d1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x120e=['[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','catch','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','Variable','name','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','incident','Incident','ticketNumber','push','all','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x120e,0x6a));var _0xe120=function(_0x138365,_0x54c366){_0x138365=_0x138365-0x0;var _0x5d07f3=_0x120e[_0x138365];return _0x5d07f3;};'use strict';var _=require(_0xe120('0x0'));var Promise=require(_0xe120('0x1'));var rp=require(_0xe120('0x2'));var util=require(_0xe120('0x3'));var md5=require(_0xe120('0x4'));var Redis=require(_0xe120('0x5'));var intUtil=require(_0xe120('0x6'));var config=require(_0xe120('0x7'));var logger=require(_0xe120('0x8'))(_0xe120('0x9'));config[_0xe120('0xa')]=_['defaults'](config[_0xe120('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xe120('0xb'))(new Redis(config['redis']));function getAdminUser(_0x6a5da7,_0x2675c5,_0x407519,_0x32d32b,_0x150113,_0x3fe108){return new Promise(function(_0x139a7b,_0x272a7c){var _0x51e627={'method':_0xe120('0xc'),'uri':_0x32d32b+_0xe120('0xd')+'&'+_0x150113+'&'+_0x3fe108,'auth':_0x2675c5,'json':!![]};return rp(_0x51e627)[_0xe120('0xe')](function(_0x4002ec){if(_0x4002ec[_0xe120('0xf')][_0xe120('0x10')]>0x0){_0x407519[_0xe120('0x11')]=_0x4002ec[_0xe120('0xf')][0x0][_0xe120('0x12')];}logger[_0xe120('0x13')]('['+[_0x6a5da7[_0xe120('0x14')]()]+'],\x20getAdminUser\x20crm',_0x407519);_0x139a7b(_0x407519);})['catch'](function(_0x5205c5){logger[_0xe120('0x15')]('['+[_0x6a5da7[_0xe120('0x14')]()]+']',_0x5205c5['message']);_0x272a7c(_0x5205c5[_0xe120('0x16')]);});});}function getUser(_0x27f824,_0x3394f8,_0x203ee2,_0x13d6ea,_0x1eac81){return function(_0x3ce3c6){logger[_0xe120('0x13')]('['+[_0x27f824[_0xe120('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x3ce3c6);return new Promise(function(_0x531c50,_0x56cd11){if(intUtil['validateEmail'](_0x3ce3c6[_0xe120('0x17')])){var _0x384b55={'method':_0xe120('0xc'),'uri':_0x203ee2+_0xe120('0x18')+_0x3ce3c6[_0xe120('0x17')]+'&'+_0x13d6ea+'&'+_0x1eac81,'auth':_0x3394f8,'json':!![]};logger[_0xe120('0x13')]('['+[_0x27f824[_0xe120('0x14')]()]+_0xe120('0x19'),_0x384b55);return rp(_0x384b55)[_0xe120('0xe')](function(_0x398903){logger[_0xe120('0x13')]('['+[_0x27f824['toUpperCase']()]+_0xe120('0x1a'),_0x398903);if(_0x398903['result'][_0xe120('0x10')]>0x0&&String(_0x398903[_0xe120('0xf')][0x0][_0xe120('0x1b')])===_0xe120('0x1c')){_0x3ce3c6[_0xe120('0x1d')]=_0x398903[_0xe120('0xf')][0x0][_0xe120('0x12')];}else{_0x3ce3c6[_0xe120('0x1d')]=_0x3ce3c6[_0xe120('0x11')];_0x3ce3c6[_0xe120('0x17')]=_0x3ce3c6[_0xe120('0x1e')];}logger[_0xe120('0x13')]('['+[_0x27f824[_0xe120('0x14')]()]+'],\x20getUser\x20crm',_0x3ce3c6);_0x531c50(_0x3ce3c6);})['catch'](function(_0x85eff7){logger[_0xe120('0x15')]('['+[_0x27f824[_0xe120('0x14')]()]+']',_0x85eff7[_0xe120('0x16')]);_0x56cd11(_0x85eff7[_0xe120('0x16')]);});}else{logger[_0xe120('0x13')]('['+[_0x27f824['toUpperCase']()]+_0xe120('0x1f'));_0x3ce3c6['userId']=_0x3ce3c6['adminId'];_0x3ce3c6[_0xe120('0x17')]=_0x3ce3c6[_0xe120('0x1e')];_0x531c50(_0x3ce3c6);}});};}function createEndUser(_0x564a9e,_0xc55065,_0x1b9d23,_0x159e7c,_0x49f5a6){logger['info']('['+[_0x564a9e[_0xe120('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x1b9d23);return new Promise(function(_0x1375da,_0x394ce8){var _0x56b10c={'method':_0xe120('0x20'),'uri':_0x159e7c+_0xe120('0x21')+_0x49f5a6,'body':{'user_name':_0x1b9d23[_0xe120('0x22')],'roles':_0xe120('0x23'),'first_name':_0x1b9d23['endUserNumber'],'active':'true','date_format':_0xe120('0x24'),'phone':_0x1b9d23['endUserNumber']},'auth':_0xc55065,'json':!![]};return rp(_0x56b10c)[_0xe120('0xe')](function(_0x3f5c58){logger[_0xe120('0x13')]('['+[_0x564a9e[_0xe120('0x14')]()]+_0xe120('0x25'),_0x3f5c58[_0xe120('0xf')]);_0x1b9d23[_0xe120('0x26')]=_0x3f5c58[_0xe120('0xf')][_0xe120('0x12')];_0x1375da(_0x1b9d23);})[_0xe120('0x27')](function(_0x4617fe){logger['error']('['+[_0x564a9e['toUpperCase']()]+']',_0x4617fe[_0xe120('0x16')]);_0x394ce8(_0x4617fe['message']);});});}function getEndUser(_0x24efee,_0x2c8424,_0x118ddc,_0x505796,_0x419309){return function(_0x527bc8){logger['info']('['+[_0x24efee['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x527bc8);return new Promise(function(_0x8591f8,_0x40449f){var _0x24dd7b={'method':_0xe120('0xc'),'uri':_0x118ddc+_0xe120('0x28')+_0x527bc8['endUserNumber']+'&'+_0x505796+'&'+_0x419309,'auth':_0x2c8424,'json':!![]};return rp(_0x24dd7b)[_0xe120('0xe')](function(_0x53a6c2){if(_0x53a6c2[_0xe120('0xf')]['length']>0x0){_0x527bc8['endUserId']=_0x53a6c2['result'][0x0]['sys_id'];logger['info']('['+[_0x24efee[_0xe120('0x14')]()]+_0xe120('0x29'),_0x527bc8);_0x8591f8(_0x527bc8);}else{return createEndUser(_0x24efee,_0x2c8424,_0x527bc8,_0x118ddc,_0x505796)[_0xe120('0xe')](function(_0x3aab0e){logger[_0xe120('0x13')]('['+[_0x24efee[_0xe120('0x14')]()]+'],\x20createEndUser\x20crm',_0x3aab0e);_0x8591f8(_0x3aab0e);});}})['catch'](function(_0x6d88d7){logger[_0xe120('0x15')]('['+[_0x24efee[_0xe120('0x14')]()]+']',_0x6d88d7['message']);_0x40449f(_0x6d88d7['message']);});});};}function getCustomFields(_0x3ca659,_0x54f729){var _0x3ce70f={};if(_0x3ca659[_0xe120('0x10')]>0x0){_[_0xe120('0x2a')](_0x3ca659,function(_0x4fab32){if(_[_0xe120('0x2b')]([_0xe120('0x2c'),'picklist'],_0x4fab32[_0xe120('0x2d')])&&_0x4fab32[_0xe120('0x2e')]&&!_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32[_0xe120('0x2e')][_0xe120('0x30')]()]=_0x4fab32[_0xe120('0x31')][_0xe120('0x32')]();}else if(_['includes']([_0xe120('0x2c'),_0xe120('0x33')],_0x4fab32['type'])&&_0x4fab32[_0xe120('0x34')]&&_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32[_0xe120('0x34')]['toLowerCase']()]=_0x4fab32['content'][_0xe120('0x32')]();}else if(_0x4fab32[_0xe120('0x2d')]==='variable'&&_0x4fab32['variableName']&&_0x4fab32[_0xe120('0x34')]&&_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32['idField'][_0xe120('0x30')]()]=_0x54f729[_0x4fab32['variableName']][_0xe120('0x32')]();}else if(_0x4fab32[_0xe120('0x2d')]==='customVariable'&&_0x4fab32[_0xe120('0x35')]&&_0x4fab32[_0xe120('0x35')][_0xe120('0x36')]&&_0x4fab32[_0xe120('0x34')]&&_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32[_0xe120('0x34')]['toLowerCase']()]=_0x54f729[_0x4fab32[_0xe120('0x35')][_0xe120('0x36')]['toLowerCase']()]['toString']();}});}return _0x3ce70f;}function getTicket(_0x55e9ff,_0x30bc81,_0x4b6a3d,_0x18508b,_0x550491,_0x5e67cc){return function(_0x3c6326){logger[_0xe120('0x13')]('['+[_0x55e9ff[_0xe120('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x3c6326);return new Promise(function(_0x126248,_0x5bcfbd){var _0x178306=_0x55e9ff[_0xe120('0x30')]()===_0xe120('0x37')?_0x3c6326[_0xe120('0x1d')]:_0x3c6326[_0xe120('0x26')];var _0xecca83={'method':_0xe120('0x20'),'uri':_0x4b6a3d+'incident'+'?'+_0x5e67cc,'body':Object['assign']({},{'active':_0xe120('0x1c'),'caller_id':_0x178306,'assigned_to':_0x3c6326[_0xe120('0x1d')],'short_description':intUtil[_0xe120('0x38')](_0x18508b[_0xe120('0x39')],_0x550491,'\x20'),'description':intUtil[_0xe120('0x38')](_0x18508b[_0xe120('0x3a')],_0x550491,'\x0a')},getCustomFields(_0x18508b['Fields'],_0x550491)),'auth':_0x30bc81,'json':!![]};return rp(_0xecca83)[_0xe120('0xe')](function(_0x57fc29){logger['info']('['+[_0x55e9ff[_0xe120('0x14')]()]+_0xe120('0x3b'),_0x57fc29[_0xe120('0xf')]);_0x3c6326[_0xe120('0x3c')]=_0x57fc29[_0xe120('0xf')][_0xe120('0x12')];_0x3c6326['ticketNumber']=_0x57fc29[_0xe120('0xf')]['number'];logger['info']('['+[_0x55e9ff[_0xe120('0x14')]()]+_0xe120('0x3d'),_0x3c6326);_0x126248(_0x3c6326);})['catch'](function(_0x5dd665){logger[_0xe120('0x15')]('['+[_0x55e9ff['toUpperCase']()]+']',_0x5dd665[_0xe120('0x16')]);_0x5bcfbd(_0x5dd665[_0xe120('0x16')]);});});};}function createRemoteTag(_0x2b3cc4,_0x16510b,_0x304359,_0x1a645f){return new Promise(function(_0x1bd31b,_0x4d9c9a){var _0x58e6ae={'method':_0xe120('0x20'),'uri':_0x304359+'label'+'?'+_0x1a645f,'body':{'short_description':_0x2b3cc4,'global':!![],'active':!![],'name':_0x2b3cc4},'auth':_0x16510b,'json':!![]};return rp(_0x58e6ae)[_0xe120('0xe')](function(_0x596065){var _0x3c9df4=_0x596065['result'][_0xe120('0x12')];_0x1bd31b(_0x3c9df4);});});}function getRemoteTag(_0x450e33,_0x5deb79,_0x223f57,_0x5651a4,_0xbaaf14){return new Promise(function(_0x3dd067,_0x2ade0c){var _0x56e81={'method':_0xe120('0xc'),'uri':_0x223f57+_0xe120('0x3e')+'?sysparm_query=name%3D'+_0x450e33+'&'+_0x5651a4,'auth':_0x5deb79,'json':!![]};return rp(_0x56e81)[_0xe120('0xe')](function(_0x1be17b){if(_0x1be17b['result']['length']>0x0){var _0x123dac=_0x1be17b[_0xe120('0xf')][0x0][_0xe120('0x12')];_0x3dd067(_0x123dac);}else{return createRemoteTag(_0x450e33,_0x5deb79,_0x223f57,_0x5651a4)[_0xe120('0xe')](function(_0x1c3167){_0x3dd067(_0x1c3167);});}});});}function assignTagToIncident(_0x23b33a,_0x3f1731,_0x2ae061,_0x3ef56e,_0x4024ca){return new Promise(function(_0x373bc8,_0x8962b8){var _0x576c88={'method':_0xe120('0x20'),'uri':_0x2ae061+'label_entry'+'?'+_0x4024ca,'body':{'label':_0x23b33a,'table':_0xe120('0x3f'),'id_type':_0xe120('0x40'),'table_key':_0x3ef56e[_0xe120('0x3c')],'title':'Incident\x20-\x20'+_0x3ef56e['ticketNumber'],'id_display':_0x3ef56e[_0xe120('0x41')]},'auth':_0x3f1731,'json':!![]};return rp(_0x576c88)[_0xe120('0xe')](function(_0x4cd97e){_0x373bc8();})[_0xe120('0x27')](function(){_0x373bc8();});});}function manageTags(_0x2d4321,_0xfbe3f3,_0x5c90b0,_0x3aaff2,_0x4267f6,_0x3e979c,_0x83f591){return new Promise(function(_0x518885,_0x54ae3c){var _0x241b00=[];_0xfbe3f3['forEach'](function(_0xdd61ef){_0x241b00[_0xe120('0x42')](getRemoteTag(_0xdd61ef,_0x5c90b0,_0x3aaff2,_0x3e979c,_0x83f591));});return Promise['all'](_0x241b00)['then'](function(_0x1de5f6){if(_0x1de5f6[_0xe120('0x10')]){logger['info']('['+[_0x2d4321[_0xe120('0x14')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1de5f6);var _0x142bc6=[];_0x1de5f6[_0xe120('0x2a')](function(_0x5d79c3){_0x142bc6[_0xe120('0x42')](assignTagToIncident(_0x5d79c3,_0x5c90b0,_0x3aaff2,_0x4267f6,_0x3e979c));});return Promise[_0xe120('0x43')](_0x142bc6)[_0xe120('0xe')](function(){_0x518885();})[_0xe120('0x27')](function(){_0x518885();});}else{_0x518885();}});});}function getTags(_0x3a27b4,_0x4f6dfb,_0x37d501,_0x4212fa,_0x3e0799,_0x256c55){return function(_0x48eba0){return new Promise(function(_0xdc5ca5,_0x385452){var _0x547790=[];var _0xe5d3d6=_0x4212fa['Tags'];if(_0xe5d3d6&&_0xe5d3d6['length']>0x0){_0x547790=_[_0xe120('0x44')](_0xe5d3d6,_0xe120('0x36'));}if(_0x547790[_0xe120('0x10')]>0x0){return manageTags(_0x3a27b4,_0x547790,_0x4f6dfb,_0x37d501,_0x48eba0,_0x3e0799,_0x256c55)[_0xe120('0xe')](function(){_0xdc5ca5(_0x48eba0);});}else{_0xdc5ca5(_0x48eba0);}});};}function emit(_0x404784,_0x19a5b9,_0x19ff1c){var _0x24e953='%26sysparm_record_target%3Dincident'+_0xe120('0x45')+_0xe120('0x46')+_0xe120('0x47');var _0x55172e={'uri':_0x404784+_0xe120('0x48')+_0x19ff1c+_0x24e953};io['to'](util[_0xe120('0x49')]('user:%s',_0x19a5b9))[_0xe120('0x4a')]('trigger:browser:url',_0x55172e);}exports['cs']=function(_0x422822,_0x32cad1,_0x447fd,_0x5ad57d,_0x640d8a,_0x20532a,_0x4baddd,_0x2dfa49){var _0x3ab6df={};var _0x53b697={'user':_0x20532a[_0xe120('0x4b')],'pass':_0x20532a[_0xe120('0x4c')]};var _0x1a7c0f=_0xe120('0x4d');var _0xcc5f10=_0xe120('0x4e');_0x20532a[_0xe120('0x4f')]=intUtil[_0xe120('0x50')](_0x20532a[_0xe120('0x4f')]);_0x20532a[_0xe120('0x51')]=intUtil[_0xe120('0x50')](_0x20532a['serverUrl']);var _0x1e7696=util[_0xe120('0x49')]('%s/api/now/table/',_0x20532a[_0xe120('0x4f')]);_0x3ab6df['userEmail']=!_[_0xe120('0x52')](_0x5ad57d)?_0x5ad57d[_0xe120('0x53')]:null;_0x3ab6df[_0xe120('0x1e')]=_0x20532a[_0xe120('0x53')];_0x3ab6df[_0xe120('0x22')]=_0x2dfa49[_0xe120('0x30')]()===_0xe120('0x37')?_0x32cad1[_0xe120('0x54')]:_0x32cad1[_0xe120('0x55')];_0x3ab6df['callDirection']=_0x2dfa49===_0xe120('0x56')||_0x2dfa49===_0xe120('0x57')?_0xe120('0x56'):_0xe120('0x37');var _0x2513ad=util['format'](_0xe120('0x58'),_0x20532a[_0xe120('0x51')],_0x32cad1['uniqueid'],md5(_0x32cad1[_0xe120('0x59')]));if(_0x640d8a&&_0x640d8a[_0xe120('0x5a')]){logger[_0xe120('0x13')]('[QUEUE]',_0xe120('0x5b'));_0x32cad1[_0xe120('0x5c')]=_0x2513ad;}else if(_0x4baddd&&_0x4baddd[_0xe120('0x5d')]&&_0x4baddd[_0xe120('0x5d')]!=='none'){logger[_0xe120('0x13')](_0xe120('0x5e'),'Recording\x20is\x20enabled!');_0x32cad1['recordingURL']=_0x2513ad;}else{_0x32cad1['recordingURL']='';}return getAdminUser(_0x2dfa49,_0x53b697,_0x3ab6df,_0x1e7696,_0xcc5f10,_0x1a7c0f)[_0xe120('0xe')](getUser(_0x2dfa49,_0x53b697,_0x1e7696,_0xcc5f10,_0x1a7c0f))[_0xe120('0xe')](getEndUser(_0x2dfa49,_0x53b697,_0x1e7696,_0xcc5f10,_0x1a7c0f))[_0xe120('0xe')](getTicket(_0x2dfa49,_0x53b697,_0x1e7696,_0x447fd,_0x32cad1,_0xcc5f10))[_0xe120('0xe')](function(_0x52e2ba){logger[_0xe120('0x13')](util[_0xe120('0x49')](_0xe120('0x5f'),_0x52e2ba[_0xe120('0x3c')]));logger[_0xe120('0x13')](util[_0xe120('0x49')](_0xe120('0x60'),_0x2dfa49));if(_0x2dfa49!==_0xe120('0x57')){logger[_0xe120('0x13')]('['+[_0x2dfa49[_0xe120('0x14')]()]+']',_0xe120('0x61'));emit(_0x20532a[_0xe120('0x4f')],_0x5ad57d[_0xe120('0x36')],_0x52e2ba[_0xe120('0x3c')]);}})['catch'](function(_0x1a4aba){logger[_0xe120('0x15')]('['+[_0x2dfa49[_0xe120('0x14')]()]+_0xe120('0x62'),util[_0xe120('0x63')](_0x1a4aba,{'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 6d234ad..0a2312c 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 _0xfe20=['toUpperCase','Fields','lastevent','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','stringify','isNil','Employees','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','toString','customField','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','users','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Ticket\x20created!','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','uri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe20,0x78));var _0x0fe2=function(_0x1afb8d,_0x56baa9){_0x1afb8d=_0x1afb8d-0x0;var _0x2828a0=_0xfe20[_0x1afb8d];return _0x2828a0;};'use strict';var _=require('lodash');var rp=require(_0x0fe2('0x0'));var BPromise=require(_0x0fe2('0x1'));var md5=require('md5');var util=require(_0x0fe2('0x2'));var Redis=require(_0x0fe2('0x3'));var intUtil=require(_0x0fe2('0x4'));var config=require(_0x0fe2('0x5'));var logger=require(_0x0fe2('0x6'))(_0x0fe2('0x7'));config[_0x0fe2('0x8')]=_[_0x0fe2('0x9')](config['redis'],{'host':_0x0fe2('0xa'),'port':0x18eb});var io=require(_0x0fe2('0xb'))(new Redis(config['redis']));var def={'method':_0x0fe2('0xc'),'json':!![]};function emit(_0x1253d9,_0x2c92e5,_0x401143){io['to'](_0x1253d9)[_0x0fe2('0xd')](_0x2c92e5,_0x401143);}function getTicket(_0x2274e8,_0x1eb429,_0xb5bc9f,_0x4c004a,_0x24e585,_0x372685,_0x469788,_0xa55017){logger[_0x0fe2('0xe')](_0x0fe2('0xf'));var _0x4946b3=new Date();var _0x373a35=[{'name':_0x0fe2('0x10'),'value':intUtil['getString'](_0x4c004a['Subjects'],_0x24e585,'\x20')},{'name':_0x0fe2('0x11'),'value':_0x1eb429['id']},{'name':_0x0fe2('0x12'),'value':_0x1eb429['id']},{'name':_0x0fe2('0x13'),'value':intUtil[_0x0fe2('0x14')](_0x4c004a[_0x0fe2('0x15')],_0x24e585,'\x0a')},{'name':_0x0fe2('0x16'),'value':_0x4946b3[_0x0fe2('0x17')]()[_0x0fe2('0x18')](0x0,0x13)['replace']('T','\x20')},{'name':_0x0fe2('0x19'),'value':'0'},{'name':_0x0fe2('0x1a'),'value':'15'},{'name':_0x0fe2('0x1b'),'value':_0xb5bc9f['id']},{'name':'parent_type','value':_0x0fe2('0x1c')},{'name':_0x0fe2('0x1d'),'value':_0xb5bc9f[_0x0fe2('0x10')]},{'name':_0x0fe2('0x1e'),'value':_0xa55017}];if(_0x372685[_0x0fe2('0x1f')]){_[_0x0fe2('0x20')](_0x372685,function(_0x22af91){if(_0x24e585[_0x22af91[_0x0fe2('0x21')]]){_0x373a35['push']({'name':_0x22af91[_0x0fe2('0x22')],'value':_0x24e585[_0x22af91['variableName']]});}});}return request({'form':{'method':_0x0fe2('0x23'),'input_type':'JSON','response_type':_0x0fe2('0x24'),'rest_data':JSON['stringify']({'session':_0x469788['id'],'module_name':_0x0fe2('0x25'),'name_value_list':_0x373a35})}});}function getAuth(_0x379c10){return util[_0x0fe2('0x26')](_0x0fe2('0x27'),new Buffer(_0x379c10[_0x0fe2('0x28')]+':X')['toString'](_0x0fe2('0x29')));}function getServerInfo(_0x513e79){return request({'form':{'method':'get_server_info','input_type':_0x0fe2('0x24'),'response_type':_0x0fe2('0x24'),'rest_data':JSON[_0x0fe2('0x2a')]({'session':_0x513e79['id']})}});}function getUser(_0x54ba72,_0x4eeb3e,_0x2e5c7c){if(!_[_0x0fe2('0x2b')](_0x4eeb3e)){logger[_0x0fe2('0xe')]('Getting\x20agent\x20with\x20name',_0x4eeb3e);return request({'form':{'method':'get_entry_list','input_type':_0x0fe2('0x24'),'response_type':_0x0fe2('0x24'),'rest_data':JSON['stringify']({'session':_0x2e5c7c['id'],'module_name':_0x0fe2('0x2c'),'query':util[_0x0fe2('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4eeb3e),'order_by':'','offset':'0','select_fields':['id',_0x0fe2('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0fe2('0x2d')](function(_0x4bba7c){if(_0x4bba7c[_0x0fe2('0x2e')][_0x0fe2('0x1f')]){var _0xd8e865=_['find'](_0x4bba7c[_0x0fe2('0x2e')],function(_0x5d5e09){return _0x5d5e09[_0x0fe2('0x2f')][_0x0fe2('0x30')][_0x0fe2('0x31')]===_0x4eeb3e;});if(_0xd8e865){logger[_0x0fe2('0xe')](_0x0fe2('0x32'));return BPromise['resolve']({'id':_0xd8e865[_0x0fe2('0x2f')]['id'][_0x0fe2('0x31')],'name':_0xd8e865['name_value_list'][_0x0fe2('0x10')]['value']});}}logger[_0x0fe2('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0fe2('0x33')]({'id':_0x2e5c7c[_0x0fe2('0x2f')]['user_id'][_0x0fe2('0x31')],'name':_0x2e5c7c['name_value_list'][_0x0fe2('0x30')][_0x0fe2('0x31')]});});}else{logger['info'](_0x0fe2('0x34'));return BPromise[_0x0fe2('0x33')]({'id':_0x2e5c7c[_0x0fe2('0x2f')][_0x0fe2('0x35')]['value'],'name':_0x2e5c7c[_0x0fe2('0x2f')][_0x0fe2('0x30')][_0x0fe2('0x31')]});}}function getEndUser(_0x33195f,_0x2c844f,_0x23288a,_0xd6d84c){logger[_0x0fe2('0xe')](_0x0fe2('0x36'),_0x23288a);return request({'form':{'method':_0x0fe2('0x37'),'input_type':_0x0fe2('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xd6d84c['id'],'module_name':'Contacts','query':util[_0x0fe2('0x26')](_0x0fe2('0x38'),_0x23288a),'order_by':'','offset':'0','select_fields':['id',_0x0fe2('0x10'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0fe2('0x2d')](function(_0x90b4f6){if(_0x90b4f6[_0x0fe2('0x2e')][_0x0fe2('0x1f')]){var _0xd115d9=_['find'](_0x90b4f6[_0x0fe2('0x2e')],function(_0x596193){return _0x596193['name_value_list']['phone_home'][_0x0fe2('0x31')]===_0x23288a;});if(_0xd115d9){logger[_0x0fe2('0xe')]('Enduser\x20found!');return BPromise[_0x0fe2('0x33')]({'id':_0xd115d9[_0x0fe2('0x2f')]['id'][_0x0fe2('0x31')],'name':_0xd115d9[_0x0fe2('0x2f')][_0x0fe2('0x10')][_0x0fe2('0x31')],'phone':_0xd115d9[_0x0fe2('0x2f')][_0x0fe2('0x39')][_0x0fe2('0x31')]});}}else{logger['info'](_0x0fe2('0x3a'));return request({'form':{'method':_0x0fe2('0x23'),'input_type':_0x0fe2('0x24'),'response_type':_0x0fe2('0x24'),'rest_data':JSON[_0x0fe2('0x2a')]({'session':_0xd6d84c['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0fe2('0x3b'),'value':_0x2c844f!==''?_0x2c844f:util['format'](_0x0fe2('0x3c'),_0x23288a)},{'name':_0x0fe2('0x39'),'value':_0x23288a}]})}})[_0x0fe2('0x2d')](function(_0x164152){logger['info']('Enduser\x20created.');return BPromise[_0x0fe2('0x33')]({'id':_0x164152['id'],'name':_0x164152['entry_list'][_0x0fe2('0x3b')][_0x0fe2('0x31')],'phone':_0x164152[_0x0fe2('0x2e')][_0x0fe2('0x39')][_0x0fe2('0x31')]});});}});}function request(_0x2b64bd){logger[_0x0fe2('0x3d')](_0x0fe2('0x3e'),JSON[_0x0fe2('0x2a')](_0x2b64bd));return rp(_[_0x0fe2('0x3f')](def,_0x2b64bd));}function getTags(_0x12d6cf,_0x458d9c){var _0x4e4e17=[];if(_0x12d6cf&&_0x12d6cf['length']>0x0){_0x4e4e17=_[_0x0fe2('0x40')](_0x12d6cf,_0x458d9c);}return _0x4e4e17;}function getCustomFields(_0x7c3632,_0x182609){var _0x3064e4=[];var _0x4a4f86={'custom_fields':[]};if(_0x7c3632[_0x0fe2('0x1f')]>0x0){_[_0x0fe2('0x20')](_0x7c3632,function(_0xbb143f){if(_0xbb143f[_0x0fe2('0x41')]===_0x0fe2('0x42')&&_0xbb143f[_0x0fe2('0x43')]&&!_0xbb143f['customField']){_0x4a4f86[_0xbb143f['nameField'][_0x0fe2('0x44')]()]=_0xbb143f[_0x0fe2('0x45')][_0x0fe2('0x46')]();}else if(_0xbb143f['type']==='string'&&_0xbb143f[_0x0fe2('0x22')]&&_0xbb143f[_0x0fe2('0x47')]){_0x4a4f86[_0x0fe2('0x48')][_0x0fe2('0x49')]({'id':_0xbb143f[_0x0fe2('0x22')],'value':_0xbb143f['content'][_0x0fe2('0x46')]()});}else if(_0xbb143f[_0x0fe2('0x41')]===_0x0fe2('0x4a')&&_0xbb143f[_0x0fe2('0x21')]&&_0xbb143f[_0x0fe2('0x22')]&&_0xbb143f['customField']){_0x182609[_0xbb143f[_0x0fe2('0x21')]]&&_0x4a4f86[_0x0fe2('0x48')]['push']({'id':_0xbb143f['idField'],'value':_0x182609[_0xbb143f[_0x0fe2('0x21')]][_0x0fe2('0x46')]()});}else if(_0xbb143f[_0x0fe2('0x41')]===_0x0fe2('0x4b')&&_0xbb143f[_0x0fe2('0x4c')]&&_0xbb143f[_0x0fe2('0x4c')]['name']&&_0xbb143f['idField']&&_0xbb143f['customField']){_0x182609[_0xbb143f['Variable'][_0x0fe2('0x10')][_0x0fe2('0x44')]()]&&_0x4a4f86[_0x0fe2('0x48')][_0x0fe2('0x49')]({'id':_0xbb143f[_0x0fe2('0x22')],'value':_0x182609[_0xbb143f[_0x0fe2('0x4c')]['name'][_0x0fe2('0x44')]()]['toString']()});}});}return _0x4a4f86;}function getConnection(_0x45a3c7){return request({'method':'POST','form':{'method':_0x0fe2('0x4d'),'input_type':_0x0fe2('0x24'),'response_type':_0x0fe2('0x24'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x45a3c7[_0x0fe2('0x4e')],'password':_0x45a3c7[_0x0fe2('0x4f')],'encryption':_0x0fe2('0x50')},'application':_0x0fe2('0x51')})}})[_0x0fe2('0x2d')](function(_0x3f26a4){var _0x3e952b=_0x3f26a4;if(_0x3e952b['id']){def[_0x0fe2('0x52')]=_0x3e952b['id'];return BPromise[_0x0fe2('0x33')](_0x3e952b);}else{throw new Error(util[_0x0fe2('0x26')](_0x0fe2('0x53'),_0x45a3c7['id']));}});}function setRelationship(_0x42de04,_0x1f564d,_0x1027a1,_0x256bfb){return request({'form':{'method':_0x0fe2('0x54'),'input_type':_0x0fe2('0x24'),'response_type':_0x0fe2('0x24'),'rest_data':JSON[_0x0fe2('0x2a')]({'session':_0x42de04['id'],'module_name':'Calls','module_id':_0x1027a1['id'],'link_field_name':_0x256bfb,'related_ids':[_0x1f564d['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x489243,_0x181e2e,_0x291e0b,_0x135fde,_0x514533,_0x1a9ea9){var _0x29417b,_0x4215a4,_0x369afd,_0x3a4218;_0x1a9ea9[_0x0fe2('0x55')]=intUtil[_0x0fe2('0x56')](_0x1a9ea9[_0x0fe2('0x55')]);_0x1a9ea9[_0x0fe2('0x57')]=intUtil['stripTrailingSlash'](_0x1a9ea9[_0x0fe2('0x57')]);def['uri']=util[_0x0fe2('0x26')](_0x0fe2('0x58'),_0x1a9ea9['remoteUri']);if(_0x514533&&_0x514533[_0x0fe2('0x59')]){logger[_0x0fe2('0xe')](_0x0fe2('0x5a'),_0x0fe2('0x5b'));_0x181e2e[_0x0fe2('0x5c')]=util[_0x0fe2('0x26')](_0x0fe2('0x5d'),_0x1a9ea9[_0x0fe2('0x57')],_0x181e2e['uniqueid'],md5(_0x181e2e[_0x0fe2('0x5e')]));}else{_0x181e2e[_0x0fe2('0x5c')]='';}return getConnection(_0x1a9ea9)['then'](function(_0x43b3c4){_0x3a4218=_0x43b3c4;return getUser(_0x1a9ea9,_0x135fde[_0x0fe2('0x10')],_0x3a4218);})[_0x0fe2('0x2d')](function(_0x540e8f){_0x29417b=_0x540e8f;logger['info'](_0x0fe2('0x5f'),_0x29417b['id']);return getEndUser(_0x1a9ea9,_0x181e2e[_0x0fe2('0x60')],_0x181e2e[_0x0fe2('0x61')],_0x3a4218);})['then'](function(_0x333d41){_0x4215a4=_0x333d41;logger[_0x0fe2('0xe')](_0x0fe2('0x62'),_0x4215a4['id']);return getTicket(_0x1a9ea9,_0x29417b,_0x4215a4,_0x291e0b,_0x181e2e,_0x291e0b['Fields'],_0x3a4218,_0x0fe2('0x63'));})[_0x0fe2('0x2d')](function(_0x2e2b81){_0x369afd=_0x2e2b81;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x369afd['id']);return setRelationship(_0x3a4218,_0x29417b,_0x369afd,_0x0fe2('0x64'));})['then'](function(){return setRelationship(_0x3a4218,_0x4215a4,_0x369afd,_0x0fe2('0x65'));})[_0x0fe2('0x2d')](function(){return getServerInfo(_0x3a4218);})['then'](function(_0x1275ea){var _0x37ff0e=parseInt(_0x1275ea[_0x0fe2('0x66')]['charAt'](0x0));var _0x1f696b=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1a9ea9['remoteUri'],_0x369afd['id']);if(_0x37ff0e>0x6){_0x1f696b=util[_0x0fe2('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1a9ea9[_0x0fe2('0x55')],_0x369afd['id']);}logger[_0x0fe2('0xe')]('[QUEUE]',_0x0fe2('0x67'));emit(util['format']('user:%s',_0x135fde[_0x0fe2('0x10')]),'trigger:browser:url',{'uri':_0x1f696b});})[_0x0fe2('0x68')](function(_0x2b32ce){logger[_0x0fe2('0x69')](_0x0fe2('0x5a'),JSON[_0x0fe2('0x2a')](_0x2b32ce));});};exports[_0x0fe2('0x6a')]=function(_0x5002d1,_0x34e34c,_0xf60eef,_0x5c0b2e,_0x51ea5d,_0x1e1c1d,_0x551b49){var _0x1e0e42,_0x11bdf2,_0x1f6fdc,_0x57175d;_0x1e1c1d[_0x0fe2('0x55')]=intUtil[_0x0fe2('0x56')](_0x1e1c1d['remoteUri']);_0x1e1c1d[_0x0fe2('0x57')]=intUtil[_0x0fe2('0x56')](_0x1e1c1d[_0x0fe2('0x57')]);def['uri']=util[_0x0fe2('0x26')](_0x0fe2('0x58'),_0x1e1c1d[_0x0fe2('0x55')]);if(_0x551b49&&_0x551b49[_0x0fe2('0x6b')]&&_0x551b49['recordingFormat']!=='none'){logger[_0x0fe2('0xe')](_0x0fe2('0x6c'),_0x0fe2('0x5b'));_0x34e34c[_0x0fe2('0x5c')]=util[_0x0fe2('0x26')](_0x0fe2('0x5d'),_0x1e1c1d['serverUrl'],_0x34e34c[_0x0fe2('0x5e')],md5(_0x34e34c[_0x0fe2('0x5e')]));}return getConnection(_0x1e1c1d)[_0x0fe2('0x2d')](function(_0xf954c4){_0x57175d=_0xf954c4;return getUser(_0x1e1c1d,_0x5c0b2e[_0x0fe2('0x10')],_0x57175d);})[_0x0fe2('0x2d')](function(_0x54e557){_0x1e0e42=_0x54e557;logger[_0x0fe2('0xe')](_0x0fe2('0x5f'),_0x1e0e42['id']);return getEndUser(_0x1e1c1d,_0x34e34c[_0x0fe2('0x6d')],_0x34e34c['destcalleridnum'],_0x57175d);})[_0x0fe2('0x2d')](function(_0x4ed697){_0x11bdf2=_0x4ed697;logger[_0x0fe2('0xe')](_0x0fe2('0x62'),_0x11bdf2['id']);return getTicket(_0x1e1c1d,_0x1e0e42,_0x11bdf2,_0xf60eef,_0x34e34c,_0xf60eef['Fields'],_0x57175d,'Outbound');})[_0x0fe2('0x2d')](function(_0x181a7e){_0x1f6fdc=_0x181a7e;logger[_0x0fe2('0xe')](_0x0fe2('0x6e'));logger[_0x0fe2('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1f6fdc['id']);return setRelationship(_0x57175d,_0x1e0e42,_0x1f6fdc,_0x0fe2('0x64'));})[_0x0fe2('0x2d')](function(){return setRelationship(_0x57175d,_0x11bdf2,_0x1f6fdc,_0x0fe2('0x65'));})[_0x0fe2('0x2d')](function(){return getServerInfo(_0x57175d);})['then'](function(_0x47bc9d){var _0x2d6cf2=parseInt(_0x47bc9d[_0x0fe2('0x66')][_0x0fe2('0x6f')](0x0));var _0x3535f4=util[_0x0fe2('0x26')](_0x0fe2('0x70'),_0x1e1c1d[_0x0fe2('0x55')],_0x1f6fdc['id']);if(_0x2d6cf2>0x6){_0x3535f4=util[_0x0fe2('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1e1c1d[_0x0fe2('0x55')],_0x1f6fdc['id']);}logger[_0x0fe2('0xe')](_0x0fe2('0x6c'),_0x0fe2('0x67'));emit(util[_0x0fe2('0x26')]('user:%s',_0x5c0b2e[_0x0fe2('0x10')]),'trigger:browser:url',{'uri':_0x3535f4});})[_0x0fe2('0x68')](function(_0x5ecbb3){logger[_0x0fe2('0x69')]('[OUTBOUND]',JSON['stringify'](_0x5ecbb3));});};exports['unmanaged']=function(_0x192e3c,_0x41ce0b,_0x4d3fb5,_0x573829,_0x27b6dc,_0x4db3e2){var _0x192876,_0x5d1894,_0x322eb3,_0x3a9ef8;_0x4db3e2[_0x0fe2('0x55')]=intUtil[_0x0fe2('0x56')](_0x4db3e2[_0x0fe2('0x55')]);_0x4db3e2[_0x0fe2('0x57')]=intUtil[_0x0fe2('0x56')](_0x4db3e2[_0x0fe2('0x57')]);def[_0x0fe2('0x71')]=util['format'](_0x0fe2('0x58'),_0x4db3e2['remoteUri']);if(_0x27b6dc&&_0x27b6dc[_0x0fe2('0x59')]){logger[_0x0fe2('0xe')]('['+_0x41ce0b['lastevent'][_0x0fe2('0x72')]()+']',_0x0fe2('0x5b'));_0x41ce0b[_0x0fe2('0x5c')]=util[_0x0fe2('0x26')](_0x0fe2('0x5d'),_0x4db3e2[_0x0fe2('0x57')],_0x41ce0b[_0x0fe2('0x5e')],md5(_0x41ce0b[_0x0fe2('0x5e')]));}else{_0x41ce0b[_0x0fe2('0x5c')]='';}return getConnection(_0x4db3e2)[_0x0fe2('0x2d')](function(_0x4ee55a){_0x3a9ef8=_0x4ee55a;if(!_[_0x0fe2('0x2b')](_0x573829)){return getUser(_0x4db3e2,_0x573829[_0x0fe2('0x10')],_0x3a9ef8);}else{return getUser(_0x4db3e2,null,_0x3a9ef8);}})[_0x0fe2('0x2d')](function(_0x259789){_0x192876=_0x259789;logger[_0x0fe2('0xe')](_0x0fe2('0x5f'),_0x192876['id']);return getEndUser(_0x4db3e2,_0x41ce0b['calleridname'],_0x41ce0b[_0x0fe2('0x61')],_0x3a9ef8);})[_0x0fe2('0x2d')](function(_0xc2cfe){_0x5d1894=_0xc2cfe;logger['info'](_0x0fe2('0x62'),_0x5d1894['id']);return getTicket(_0x4db3e2,_0x192876,_0x5d1894,_0x4d3fb5,_0x41ce0b,_0x4d3fb5[_0x0fe2('0x73')],_0x3a9ef8,_0x0fe2('0x63'));})['then'](function(_0x5291b6){_0x322eb3=_0x5291b6;logger[_0x0fe2('0xe')](_0x0fe2('0x6e'));logger[_0x0fe2('0xe')]('The\x20Ticket\x20ID\x20is:',_0x322eb3['id']);return setRelationship(_0x3a9ef8,_0x192876,_0x322eb3,'users');})[_0x0fe2('0x2d')](function(){return setRelationship(_0x3a9ef8,_0x5d1894,_0x322eb3,_0x0fe2('0x65'));})[_0x0fe2('0x2d')](function(){return getServerInfo(_0x3a9ef8);})['catch'](function(_0x55763a){logger[_0x0fe2('0x69')]('['+_0x41ce0b[_0x0fe2('0x74')]['toUpperCase']()+']',JSON[_0x0fe2('0x2a')](_0x55763a));});}; \ No newline at end of file +var _0xd5d8=['parent_name','direction','length','variableName','idField','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','value','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','resolve','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','string','nameField','type','customField','custom_fields','push','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','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','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','contacts','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts'];(function(_0x51410d,_0x1d6355){var _0xb92a85=function(_0x2b98a5){while(--_0x2b98a5){_0x51410d['push'](_0x51410d['shift']());}};_0xb92a85(++_0x1d6355);}(_0xd5d8,0x1c1));var _0x8d5d=function(_0x2efa84,_0xd84147){_0x2efa84=_0x2efa84-0x0;var _0x2d7f91=_0xd5d8[_0x2efa84];return _0x2d7f91;};'use strict';var _=require(_0x8d5d('0x0'));var rp=require(_0x8d5d('0x1'));var BPromise=require(_0x8d5d('0x2'));var md5=require(_0x8d5d('0x3'));var util=require(_0x8d5d('0x4'));var Redis=require('ioredis');var intUtil=require(_0x8d5d('0x5'));var config=require(_0x8d5d('0x6'));var logger=require(_0x8d5d('0x7'))(_0x8d5d('0x8'));config[_0x8d5d('0x9')]=_[_0x8d5d('0xa')](config[_0x8d5d('0x9')],{'host':_0x8d5d('0xb'),'port':0x18eb});var io=require(_0x8d5d('0xc'))(new Redis(config['redis']));var def={'method':_0x8d5d('0xd'),'json':!![]};function emit(_0x26d321,_0x51bca3,_0x4a9729){io['to'](_0x26d321)[_0x8d5d('0xe')](_0x51bca3,_0x4a9729);}function getTicket(_0x390e44,_0xc23fce,_0x435a63,_0x5ac975,_0x5aceac,_0x8e745b,_0x328964,_0x324e9b){logger[_0x8d5d('0xf')](_0x8d5d('0x10'));var _0x4ee768=new Date();var _0x3c82f4=[{'name':_0x8d5d('0x11'),'value':intUtil[_0x8d5d('0x12')](_0x5ac975[_0x8d5d('0x13')],_0x5aceac,'\x20')},{'name':'assigned_user_id','value':_0xc23fce['id']},{'name':_0x8d5d('0x14'),'value':_0xc23fce['id']},{'name':_0x8d5d('0x15'),'value':intUtil[_0x8d5d('0x12')](_0x5ac975[_0x8d5d('0x16')],_0x5aceac,'\x0a')},{'name':'date_start','value':_0x4ee768[_0x8d5d('0x17')]()[_0x8d5d('0x18')](0x0,0x13)[_0x8d5d('0x19')]('T','\x20')},{'name':_0x8d5d('0x1a'),'value':'0'},{'name':_0x8d5d('0x1b'),'value':'15'},{'name':_0x8d5d('0x1c'),'value':_0x435a63['id']},{'name':_0x8d5d('0x1d'),'value':_0x8d5d('0x1e')},{'name':_0x8d5d('0x1f'),'value':_0x435a63[_0x8d5d('0x11')]},{'name':_0x8d5d('0x20'),'value':_0x324e9b}];if(_0x8e745b[_0x8d5d('0x21')]){_['forEach'](_0x8e745b,function(_0x991d5f){if(_0x5aceac[_0x991d5f[_0x8d5d('0x22')]]){_0x3c82f4['push']({'name':_0x991d5f[_0x8d5d('0x23')],'value':_0x5aceac[_0x991d5f[_0x8d5d('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'session':_0x328964['id'],'module_name':_0x8d5d('0x26'),'name_value_list':_0x3c82f4})}});}function getAuth(_0x405e6f){return util[_0x8d5d('0x27')]('Basic\x20%s',new Buffer(_0x405e6f[_0x8d5d('0x28')]+':X')[_0x8d5d('0x29')]('base64'));}function getServerInfo(_0x5808bd){return request({'form':{'method':_0x8d5d('0x2a'),'input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON['stringify']({'session':_0x5808bd['id']})}});}function getUser(_0x28bb22,_0x3ac551,_0x2aee10){if(!_[_0x8d5d('0x2b')](_0x3ac551)){logger[_0x8d5d('0xf')](_0x8d5d('0x2c'),_0x3ac551);return request({'form':{'method':_0x8d5d('0x2d'),'input_type':_0x8d5d('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2aee10['id'],'module_name':'Employees','query':util['format'](_0x8d5d('0x2e'),_0x3ac551),'order_by':'','offset':'0','select_fields':['id',_0x8d5d('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8d5d('0x2f')](function(_0x3d78c7){if(_0x3d78c7[_0x8d5d('0x30')][_0x8d5d('0x21')]){var _0x479b7e=_['find'](_0x3d78c7[_0x8d5d('0x30')],function(_0x9c1f80){return _0x9c1f80['name_value_list'][_0x8d5d('0x31')][_0x8d5d('0x32')]===_0x3ac551;});if(_0x479b7e){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x479b7e['name_value_list']['id']['value'],'name':_0x479b7e[_0x8d5d('0x33')][_0x8d5d('0x11')][_0x8d5d('0x32')]});}}logger[_0x8d5d('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2aee10[_0x8d5d('0x33')][_0x8d5d('0x34')]['value'],'name':_0x2aee10[_0x8d5d('0x33')]['user_name'][_0x8d5d('0x32')]});});}else{logger[_0x8d5d('0xf')](_0x8d5d('0x35'));return BPromise['resolve']({'id':_0x2aee10['name_value_list']['user_id']['value'],'name':_0x2aee10[_0x8d5d('0x33')][_0x8d5d('0x31')][_0x8d5d('0x32')]});}}function getEndUser(_0x583a51,_0x11285e,_0x3af309,_0x514253){logger['info'](_0x8d5d('0x36'),_0x3af309);return request({'form':{'method':_0x8d5d('0x2d'),'input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'session':_0x514253['id'],'module_name':_0x8d5d('0x1e'),'query':util['format'](_0x8d5d('0x37'),_0x3af309),'order_by':'','offset':'0','select_fields':['id','name',_0x8d5d('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8d5d('0x2f')](function(_0x2e2b6d){if(_0x2e2b6d[_0x8d5d('0x30')]['length']){var _0x18e37b=_['find'](_0x2e2b6d['entry_list'],function(_0x2a8ac1){return _0x2a8ac1[_0x8d5d('0x33')]['phone_home'][_0x8d5d('0x32')]===_0x3af309;});if(_0x18e37b){logger[_0x8d5d('0xf')]('Enduser\x20found!');return BPromise[_0x8d5d('0x39')]({'id':_0x18e37b[_0x8d5d('0x33')]['id'][_0x8d5d('0x32')],'name':_0x18e37b[_0x8d5d('0x33')]['name'][_0x8d5d('0x32')],'phone':_0x18e37b['name_value_list']['phone_home'][_0x8d5d('0x32')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8d5d('0x3a'),'input_type':'JSON','response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'session':_0x514253['id'],'module_name':_0x8d5d('0x1e'),'name_value_list':[{'name':_0x8d5d('0x3b'),'value':_0x11285e!==''?_0x11285e:util['format'](_0x8d5d('0x3c'),_0x3af309)},{'name':_0x8d5d('0x38'),'value':_0x3af309}]})}})[_0x8d5d('0x2f')](function(_0x3ed396){logger[_0x8d5d('0xf')](_0x8d5d('0x3d'));return BPromise[_0x8d5d('0x39')]({'id':_0x3ed396['id'],'name':_0x3ed396[_0x8d5d('0x30')][_0x8d5d('0x3b')][_0x8d5d('0x32')],'phone':_0x3ed396[_0x8d5d('0x30')][_0x8d5d('0x38')][_0x8d5d('0x32')]});});}});}function request(_0x1d2c65){logger[_0x8d5d('0x3e')](_0x8d5d('0x3f'),JSON[_0x8d5d('0x25')](_0x1d2c65));return rp(_[_0x8d5d('0x40')](def,_0x1d2c65));}function getTags(_0x1e8c1d,_0x3f5e00){var _0x5679d8=[];if(_0x1e8c1d&&_0x1e8c1d['length']>0x0){_0x5679d8=_['map'](_0x1e8c1d,_0x3f5e00);}return _0x5679d8;}function getCustomFields(_0x1edf37,_0x1dabfc){var _0x15d1ab=[];var _0x1d6f70={'custom_fields':[]};if(_0x1edf37[_0x8d5d('0x21')]>0x0){_[_0x8d5d('0x41')](_0x1edf37,function(_0x3ae982){if(_0x3ae982['type']===_0x8d5d('0x42')&&_0x3ae982[_0x8d5d('0x43')]&&!_0x3ae982['customField']){_0x1d6f70[_0x3ae982[_0x8d5d('0x43')]['toLowerCase']()]=_0x3ae982['content']['toString']();}else if(_0x3ae982[_0x8d5d('0x44')]===_0x8d5d('0x42')&&_0x3ae982[_0x8d5d('0x23')]&&_0x3ae982[_0x8d5d('0x45')]){_0x1d6f70[_0x8d5d('0x46')][_0x8d5d('0x47')]({'id':_0x3ae982[_0x8d5d('0x23')],'value':_0x3ae982['content'][_0x8d5d('0x29')]()});}else if(_0x3ae982[_0x8d5d('0x44')]===_0x8d5d('0x48')&&_0x3ae982['variableName']&&_0x3ae982[_0x8d5d('0x23')]&&_0x3ae982[_0x8d5d('0x45')]){_0x1dabfc[_0x3ae982[_0x8d5d('0x22')]]&&_0x1d6f70[_0x8d5d('0x46')][_0x8d5d('0x47')]({'id':_0x3ae982[_0x8d5d('0x23')],'value':_0x1dabfc[_0x3ae982['variableName']][_0x8d5d('0x29')]()});}else if(_0x3ae982['type']===_0x8d5d('0x49')&&_0x3ae982[_0x8d5d('0x4a')]&&_0x3ae982['Variable'][_0x8d5d('0x11')]&&_0x3ae982[_0x8d5d('0x23')]&&_0x3ae982[_0x8d5d('0x45')]){_0x1dabfc[_0x3ae982[_0x8d5d('0x4a')]['name'][_0x8d5d('0x4b')]()]&&_0x1d6f70[_0x8d5d('0x46')][_0x8d5d('0x47')]({'id':_0x3ae982['idField'],'value':_0x1dabfc[_0x3ae982[_0x8d5d('0x4a')][_0x8d5d('0x11')]['toLowerCase']()][_0x8d5d('0x29')]()});}});}return _0x1d6f70;}function getConnection(_0x10b388){return request({'method':_0x8d5d('0xd'),'form':{'method':_0x8d5d('0x4c'),'input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'user_auth':{'user_name':_0x10b388['username'],'password':_0x10b388[_0x8d5d('0x4d')],'encryption':_0x8d5d('0x4e')},'application':_0x8d5d('0x4f')})}})['then'](function(_0x2eb179){var _0x5dba09=_0x2eb179;if(_0x5dba09['id']){def[_0x8d5d('0x50')]=_0x5dba09['id'];return BPromise[_0x8d5d('0x39')](_0x5dba09);}else{throw new Error(util[_0x8d5d('0x27')](_0x8d5d('0x51'),_0x10b388['id']));}});}function setRelationship(_0x3addd4,_0x16bbac,_0x4f103e,_0x3e76d4){return request({'form':{'method':'set_relationship','input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON['stringify']({'session':_0x3addd4['id'],'module_name':_0x8d5d('0x26'),'module_id':_0x4f103e['id'],'link_field_name':_0x3e76d4,'related_ids':[_0x16bbac['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8d5d('0x52')]=function(_0x35848b,_0x43ebb6,_0x4d9341,_0x5b757d,_0x331e38,_0x540ad5){var _0x522337,_0x2b296b,_0x26d6ca,_0x3045a0;_0x540ad5[_0x8d5d('0x53')]=intUtil[_0x8d5d('0x54')](_0x540ad5[_0x8d5d('0x53')]);_0x540ad5[_0x8d5d('0x55')]=intUtil[_0x8d5d('0x54')](_0x540ad5[_0x8d5d('0x55')]);def[_0x8d5d('0x56')]=util[_0x8d5d('0x27')](_0x8d5d('0x57'),_0x540ad5[_0x8d5d('0x53')]);if(_0x331e38&&_0x331e38['monitor_format']){logger[_0x8d5d('0xf')](_0x8d5d('0x58'),'Recording\x20is\x20enabled!');_0x43ebb6['recordingURL']=util[_0x8d5d('0x27')](_0x8d5d('0x59'),_0x540ad5[_0x8d5d('0x55')],_0x43ebb6[_0x8d5d('0x5a')],md5(_0x43ebb6[_0x8d5d('0x5a')]));}else{_0x43ebb6[_0x8d5d('0x5b')]='';}return getConnection(_0x540ad5)[_0x8d5d('0x2f')](function(_0x38ffa1){_0x3045a0=_0x38ffa1;return getUser(_0x540ad5,_0x5b757d[_0x8d5d('0x11')],_0x3045a0);})[_0x8d5d('0x2f')](function(_0x16d300){_0x522337=_0x16d300;logger[_0x8d5d('0xf')](_0x8d5d('0x5c'),_0x522337['id']);return getEndUser(_0x540ad5,_0x43ebb6['calleridname'],_0x43ebb6[_0x8d5d('0x5d')],_0x3045a0);})[_0x8d5d('0x2f')](function(_0x585116){_0x2b296b=_0x585116;logger[_0x8d5d('0xf')]('The\x20Enduser\x20ID\x20is:',_0x2b296b['id']);return getTicket(_0x540ad5,_0x522337,_0x2b296b,_0x4d9341,_0x43ebb6,_0x4d9341[_0x8d5d('0x5e')],_0x3045a0,_0x8d5d('0x5f'));})[_0x8d5d('0x2f')](function(_0x5605c8){_0x26d6ca=_0x5605c8;logger[_0x8d5d('0xf')](_0x8d5d('0x60'));logger[_0x8d5d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x26d6ca['id']);return setRelationship(_0x3045a0,_0x522337,_0x26d6ca,_0x8d5d('0x61'));})[_0x8d5d('0x2f')](function(){return setRelationship(_0x3045a0,_0x2b296b,_0x26d6ca,'contacts');})['then'](function(){return getServerInfo(_0x3045a0);})[_0x8d5d('0x2f')](function(_0x5f2b90){var _0x299de0=parseInt(_0x5f2b90[_0x8d5d('0x62')][_0x8d5d('0x63')](0x0));var _0x310688=util[_0x8d5d('0x27')](_0x8d5d('0x64'),_0x540ad5[_0x8d5d('0x53')],_0x26d6ca['id']);if(_0x299de0>0x6){_0x310688=util[_0x8d5d('0x27')](_0x8d5d('0x65'),_0x540ad5[_0x8d5d('0x53')],_0x26d6ca['id']);}logger[_0x8d5d('0xf')](_0x8d5d('0x58'),_0x8d5d('0x66'));emit(util[_0x8d5d('0x27')](_0x8d5d('0x67'),_0x5b757d[_0x8d5d('0x11')]),_0x8d5d('0x68'),{'uri':_0x310688});})[_0x8d5d('0x69')](function(_0xb827f8){logger[_0x8d5d('0x6a')](_0x8d5d('0x58'),JSON[_0x8d5d('0x25')](_0xb827f8));});};exports[_0x8d5d('0x6b')]=function(_0x49e0d2,_0x229da2,_0x1a7acb,_0x4cafce,_0x5882dc,_0x1e29b7,_0x19ce2c){var _0xed5b72,_0x1a55a7,_0x59ed68,_0x2b987e;_0x1e29b7[_0x8d5d('0x53')]=intUtil[_0x8d5d('0x54')](_0x1e29b7[_0x8d5d('0x53')]);_0x1e29b7[_0x8d5d('0x55')]=intUtil['stripTrailingSlash'](_0x1e29b7[_0x8d5d('0x55')]);def[_0x8d5d('0x56')]=util['format'](_0x8d5d('0x57'),_0x1e29b7[_0x8d5d('0x53')]);if(_0x19ce2c&&_0x19ce2c[_0x8d5d('0x6c')]&&_0x19ce2c[_0x8d5d('0x6c')]!==_0x8d5d('0x6d')){logger[_0x8d5d('0xf')](_0x8d5d('0x6e'),_0x8d5d('0x6f'));_0x229da2[_0x8d5d('0x5b')]=util[_0x8d5d('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e29b7['serverUrl'],_0x229da2['uniqueid'],md5(_0x229da2['uniqueid']));}return getConnection(_0x1e29b7)[_0x8d5d('0x2f')](function(_0x18e9b3){_0x2b987e=_0x18e9b3;return getUser(_0x1e29b7,_0x4cafce[_0x8d5d('0x11')],_0x2b987e);})[_0x8d5d('0x2f')](function(_0x2175c9){_0xed5b72=_0x2175c9;logger[_0x8d5d('0xf')](_0x8d5d('0x5c'),_0xed5b72['id']);return getEndUser(_0x1e29b7,_0x229da2['destcalleridname'],_0x229da2[_0x8d5d('0x70')],_0x2b987e);})[_0x8d5d('0x2f')](function(_0x37ea88){_0x1a55a7=_0x37ea88;logger[_0x8d5d('0xf')](_0x8d5d('0x71'),_0x1a55a7['id']);return getTicket(_0x1e29b7,_0xed5b72,_0x1a55a7,_0x1a7acb,_0x229da2,_0x1a7acb['Fields'],_0x2b987e,'Outbound');})[_0x8d5d('0x2f')](function(_0x4e339f){_0x59ed68=_0x4e339f;logger[_0x8d5d('0xf')](_0x8d5d('0x60'));logger[_0x8d5d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x59ed68['id']);return setRelationship(_0x2b987e,_0xed5b72,_0x59ed68,_0x8d5d('0x61'));})[_0x8d5d('0x2f')](function(){return setRelationship(_0x2b987e,_0x1a55a7,_0x59ed68,_0x8d5d('0x72'));})[_0x8d5d('0x2f')](function(){return getServerInfo(_0x2b987e);})[_0x8d5d('0x2f')](function(_0x2393f5){var _0xed4a9f=parseInt(_0x2393f5[_0x8d5d('0x62')][_0x8d5d('0x63')](0x0));var _0x5e2098=util[_0x8d5d('0x27')](_0x8d5d('0x64'),_0x1e29b7['remoteUri'],_0x59ed68['id']);if(_0xed4a9f>0x6){_0x5e2098=util[_0x8d5d('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1e29b7['remoteUri'],_0x59ed68['id']);}logger[_0x8d5d('0xf')](_0x8d5d('0x6e'),_0x8d5d('0x66'));emit(util[_0x8d5d('0x27')](_0x8d5d('0x67'),_0x4cafce[_0x8d5d('0x11')]),'trigger:browser:url',{'uri':_0x5e2098});})[_0x8d5d('0x69')](function(_0x4e974b){logger[_0x8d5d('0x6a')]('[OUTBOUND]',JSON[_0x8d5d('0x25')](_0x4e974b));});};exports[_0x8d5d('0x73')]=function(_0x4a2ea1,_0x4f5433,_0x5c84de,_0x352f51,_0x10f2b7,_0x3ea2d2){var _0xc3a52a,_0xe4cacb,_0x5b428a,_0x3603b9;_0x3ea2d2[_0x8d5d('0x53')]=intUtil[_0x8d5d('0x54')](_0x3ea2d2['remoteUri']);_0x3ea2d2['serverUrl']=intUtil[_0x8d5d('0x54')](_0x3ea2d2[_0x8d5d('0x55')]);def['uri']=util['format'](_0x8d5d('0x57'),_0x3ea2d2[_0x8d5d('0x53')]);if(_0x10f2b7&&_0x10f2b7[_0x8d5d('0x74')]){logger['info']('['+_0x4f5433[_0x8d5d('0x75')]['toUpperCase']()+']',_0x8d5d('0x6f'));_0x4f5433[_0x8d5d('0x5b')]=util[_0x8d5d('0x27')](_0x8d5d('0x59'),_0x3ea2d2['serverUrl'],_0x4f5433[_0x8d5d('0x5a')],md5(_0x4f5433[_0x8d5d('0x5a')]));}else{_0x4f5433[_0x8d5d('0x5b')]='';}return getConnection(_0x3ea2d2)[_0x8d5d('0x2f')](function(_0x57429f){_0x3603b9=_0x57429f;if(!_[_0x8d5d('0x2b')](_0x352f51)){return getUser(_0x3ea2d2,_0x352f51[_0x8d5d('0x11')],_0x3603b9);}else{return getUser(_0x3ea2d2,null,_0x3603b9);}})[_0x8d5d('0x2f')](function(_0x2f4140){_0xc3a52a=_0x2f4140;logger[_0x8d5d('0xf')]('The\x20User\x20ID\x20is:',_0xc3a52a['id']);return getEndUser(_0x3ea2d2,_0x4f5433['calleridname'],_0x4f5433['calleridnum'],_0x3603b9);})[_0x8d5d('0x2f')](function(_0x1335a1){_0xe4cacb=_0x1335a1;logger['info'](_0x8d5d('0x71'),_0xe4cacb['id']);return getTicket(_0x3ea2d2,_0xc3a52a,_0xe4cacb,_0x5c84de,_0x4f5433,_0x5c84de[_0x8d5d('0x5e')],_0x3603b9,_0x8d5d('0x5f'));})[_0x8d5d('0x2f')](function(_0x152eaa){_0x5b428a=_0x152eaa;logger['info']('Ticket\x20created!');logger[_0x8d5d('0xf')](_0x8d5d('0x76'),_0x5b428a['id']);return setRelationship(_0x3603b9,_0xc3a52a,_0x5b428a,_0x8d5d('0x61'));})[_0x8d5d('0x2f')](function(){return setRelationship(_0x3603b9,_0xe4cacb,_0x5b428a,_0x8d5d('0x72'));})[_0x8d5d('0x2f')](function(){return getServerInfo(_0x3603b9);})[_0x8d5d('0x69')](function(_0x4ff2a5){logger[_0x8d5d('0x6a')]('['+_0x4f5433[_0x8d5d('0x75')][_0x8d5d('0x77')]()+']',JSON['stringify'](_0x4ff2a5));});}; \ 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 075bb85..045accc 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 _0x9250=['join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','sortBy','length','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s'];(function(_0x3c2cab,_0x129e11){var _0xc4b3f8=function(_0x5ac9c0){while(--_0x5ac9c0){_0x3c2cab['push'](_0x3c2cab['shift']());}};_0xc4b3f8(++_0x129e11);}(_0x9250,0x1ee));var _0x0925=function(_0x3cf527,_0x2e8722){_0x3cf527=_0x3cf527-0x0;var _0x21a5f7=_0x9250[_0x3cf527];return _0x21a5f7;};'use strict';var _=require('lodash');var util=require(_0x0925('0x0'));exports[_0x0925('0x1')]=function(_0x88f0fd,_0x12d4e1,_0x2534d8){var _0x4a1f78=[];if(_0x88f0fd['length']>0x0){var _0x25cdb1=_[_0x0925('0x2')](_0x88f0fd,['id']);for(var _0x269b43=0x0;_0x269b43<_0x25cdb1[_0x0925('0x3')];_0x269b43++){var _0x17412c=_0x25cdb1[_0x269b43];if(_0x17412c['type']===_0x0925('0x4')){_0x4a1f78[_0x0925('0x5')](_0x17412c[_0x0925('0x6')]);}else if(_0x17412c[_0x0925('0x7')]===_0x0925('0x8')&&_0x17412c['variableName']){_0x12d4e1[_0x17412c[_0x0925('0x9')]]&&_0x4a1f78[_0x0925('0x5')](_0x12d4e1[_0x17412c[_0x0925('0x9')]][_0x0925('0xa')]());}else if(_0x17412c['type']==='customVariable'&&_0x17412c[_0x0925('0xb')]&&_0x17412c['Variable'][_0x0925('0xc')]){_0x12d4e1[_0x17412c[_0x0925('0xb')]['name'][_0x0925('0xd')]()]&&_0x4a1f78[_0x0925('0x5')](_0x12d4e1[_0x17412c[_0x0925('0xb')][_0x0925('0xc')]['toLowerCase']()][_0x0925('0xa')]());}else if(_0x17412c[_0x0925('0x7')]===_0x0925('0xe')){if(_0x17412c[_0x0925('0xf')]===_0x0925('0x4')&&_0x17412c[_0x0925('0x10')]){_0x4a1f78[_0x0925('0x5')](util[_0x0925('0x11')](_0x0925('0x12'),_0x17412c[_0x0925('0x10')],_0x17412c['keyContent']));}else if(_0x17412c['keyType']===_0x0925('0x8')&&_0x17412c[_0x0925('0x9')]&&_0x17412c[_0x0925('0x10')]){_0x12d4e1[_0x17412c[_0x0925('0x9')]]&&_0x4a1f78['push'](util[_0x0925('0x11')]('%s:\x20%s',_0x17412c['key'],_0x12d4e1[_0x17412c[_0x0925('0x9')]]));}else if(_0x17412c['keyType']==='customVariable'&&_0x17412c[_0x0925('0xb')]&&_0x17412c[_0x0925('0xb')][_0x0925('0xc')]&&_0x17412c[_0x0925('0x10')]){_0x12d4e1[_0x17412c[_0x0925('0xb')][_0x0925('0xc')][_0x0925('0xd')]()]&&_0x4a1f78[_0x0925('0x5')](util[_0x0925('0x11')](_0x0925('0x12'),_0x17412c['key'],_0x12d4e1[_0x17412c['Variable']['name'][_0x0925('0xd')]()]));}}}}return _0x4a1f78[_0x0925('0x13')](_0x2534d8);};exports[_0x0925('0x14')]=function(_0x214cf4){var _0x51d5a0=_0x214cf4[_0x0925('0x15')](-0x1);if(_0x51d5a0==='/'){_0x214cf4=_0x214cf4[_0x0925('0x16')](0x0,_0x214cf4[_0x0925('0x17')](_0x51d5a0));}return _0x214cf4;};exports[_0x0925('0x18')]=function(_0x2e800d){if(!_[_0x0925('0x19')](_0x2e800d)&&_0x2e800d!==''){var _0x5acc43=/^(([^<>()\[\]\\.,;:\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 _0x5acc43[_0x0925('0x1a')](String(_0x2e800d)[_0x0925('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x66ac=['sortBy','type','string','push','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyType','variable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x5d98a5,_0x5dec95){var _0x41c80e=function(_0x261882){while(--_0x261882){_0x5d98a5['push'](_0x5d98a5['shift']());}};_0x41c80e(++_0x5dec95);}(_0x66ac,0x1e2));var _0xc66a=function(_0x4d1971,_0x3d027e){_0x4d1971=_0x4d1971-0x0;var _0x2a3d0e=_0x66ac[_0x4d1971];return _0x2a3d0e;};'use strict';var _=require(_0xc66a('0x0'));var util=require(_0xc66a('0x1'));exports[_0xc66a('0x2')]=function(_0xc5e3,_0x4d5dbe,_0x45c559){var _0x8fda14=[];if(_0xc5e3[_0xc66a('0x3')]>0x0){var _0x2f9df8=_[_0xc66a('0x4')](_0xc5e3,['id']);for(var _0x27e023=0x0;_0x27e023<_0x2f9df8['length'];_0x27e023++){var _0x525a81=_0x2f9df8[_0x27e023];if(_0x525a81[_0xc66a('0x5')]===_0xc66a('0x6')){_0x8fda14[_0xc66a('0x7')](_0x525a81['content']);}else if(_0x525a81[_0xc66a('0x5')]==='variable'&&_0x525a81[_0xc66a('0x8')]){_0x4d5dbe[_0x525a81[_0xc66a('0x8')]]&&_0x8fda14[_0xc66a('0x7')](_0x4d5dbe[_0x525a81[_0xc66a('0x8')]][_0xc66a('0x9')]());}else if(_0x525a81[_0xc66a('0x5')]===_0xc66a('0xa')&&_0x525a81[_0xc66a('0xb')]&&_0x525a81['Variable'][_0xc66a('0xc')]){_0x4d5dbe[_0x525a81[_0xc66a('0xb')][_0xc66a('0xc')][_0xc66a('0xd')]()]&&_0x8fda14[_0xc66a('0x7')](_0x4d5dbe[_0x525a81[_0xc66a('0xb')]['name'][_0xc66a('0xd')]()]['toString']());}else if(_0x525a81['type']===_0xc66a('0xe')){if(_0x525a81['keyType']==='string'&&_0x525a81[_0xc66a('0xf')]){_0x8fda14[_0xc66a('0x7')](util[_0xc66a('0x10')](_0xc66a('0x11'),_0x525a81[_0xc66a('0xf')],_0x525a81['keyContent']));}else if(_0x525a81[_0xc66a('0x12')]===_0xc66a('0x13')&&_0x525a81[_0xc66a('0x8')]&&_0x525a81['key']){_0x4d5dbe[_0x525a81[_0xc66a('0x8')]]&&_0x8fda14[_0xc66a('0x7')](util['format'](_0xc66a('0x11'),_0x525a81[_0xc66a('0xf')],_0x4d5dbe[_0x525a81[_0xc66a('0x8')]]));}else if(_0x525a81[_0xc66a('0x12')]===_0xc66a('0xa')&&_0x525a81[_0xc66a('0xb')]&&_0x525a81[_0xc66a('0xb')][_0xc66a('0xc')]&&_0x525a81['key']){_0x4d5dbe[_0x525a81['Variable'][_0xc66a('0xc')][_0xc66a('0xd')]()]&&_0x8fda14['push'](util['format']('%s:\x20%s',_0x525a81[_0xc66a('0xf')],_0x4d5dbe[_0x525a81[_0xc66a('0xb')][_0xc66a('0xc')][_0xc66a('0xd')]()]));}}}}return _0x8fda14[_0xc66a('0x14')](_0x45c559);};exports['stripTrailingSlash']=function(_0x3eeb2b){var _0x177a63=_0x3eeb2b[_0xc66a('0x15')](-0x1);if(_0x177a63==='/'){_0x3eeb2b=_0x3eeb2b[_0xc66a('0x16')](0x0,_0x3eeb2b[_0xc66a('0x17')](_0x177a63));}return _0x3eeb2b;};exports[_0xc66a('0x18')]=function(_0x389ae5){if(!_[_0xc66a('0x19')](_0x389ae5)&&_0x389ae5!==''){var _0x56ed5b=/^(([^<>()\[\]\\.,;:\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 _0x56ed5b[_0xc66a('0x1a')](String(_0x389ae5)['toLowerCase']());}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 070e348..a91d3d3 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0xd8f8ad,_0x2ba482){var _0x2f4dd3=function(_0x1e8d25){while(--_0x1e8d25){_0xd8f8ad['push'](_0xd8f8ad['shift']());}};_0x2f4dd3(++_0x2ba482);}(_0xe706,0xa3));var _0x6e70=function(_0x1d0c7e,_0x40b36c){_0x1d0c7e=_0x1d0c7e-0x0;var _0x30cf02=_0xe706[_0x1d0c7e];return _0x30cf02;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 1323b49..9ef7b39 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 _0xcd0c=['picklist','type','nameField','customField','content','toString','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','filter','end-user','length','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','username','base64','debug','[HTTP]','stringify','GET','map','includes','string'];(function(_0x54d2e3,_0x3fc590){var _0x26a918=function(_0x3acc69){while(--_0x3acc69){_0x54d2e3['push'](_0x54d2e3['shift']());}};_0x26a918(++_0x3fc590);}(_0xcd0c,0xab));var _0xccd0=function(_0x50a7c4,_0x582aca){_0x50a7c4=_0x50a7c4-0x0;var _0x17d784=_0xcd0c[_0x50a7c4];return _0x17d784;};'use strict';var _=require(_0xccd0('0x0'));var rp=require('request-promise');var md5=require(_0xccd0('0x1'));var util=require(_0xccd0('0x2'));var Redis=require(_0xccd0('0x3'));var intUtil=require('./util');var config=require(_0xccd0('0x4'));var logger=require(_0xccd0('0x5'))(_0xccd0('0x6'));config['redis']=_[_0xccd0('0x7')](config[_0xccd0('0x8')],{'host':_0xccd0('0x9'),'port':0x18eb});var io=require(_0xccd0('0xa'))(new Redis(config[_0xccd0('0x8')]));function emit(_0x57cc39,_0x4a25e6,_0x164e71){io['to'](_0x57cc39)[_0xccd0('0xb')](_0x4a25e6,_0x164e71);}var headers={'Content-Type':'application/json','Accept':_0xccd0('0xc')};function getTicket(_0x57dc53,_0x3337e4,_0x3e982b,_0x53bfa8,_0x3759e6){logger[_0xccd0('0xd')](_0xccd0('0xe'));return request({'uri':util[_0xccd0('0xf')](_0xccd0('0x10'),_0x57dc53[_0xccd0('0x11')]),'method':_0xccd0('0x12'),'body':{'ticket':_[_0xccd0('0x13')]({'requester_id':_0x3e982b['id'],'submitter_id':_0x3337e4?_0x3337e4['id']:undefined,'assignee_id':_0x3337e4?_0x3337e4['id']:undefined,'tags':getTags(_0x53bfa8[_0xccd0('0x14')],_0xccd0('0x15')),'subject':intUtil[_0xccd0('0x16')](_0x53bfa8[_0xccd0('0x17')],_0x3759e6,'\x20'),'description':intUtil[_0xccd0('0x16')](_0x53bfa8[_0xccd0('0x18')],_0x3759e6,'\x0a'),'comment':{'public':![],'body':intUtil[_0xccd0('0x16')](_0x53bfa8['Descriptions'],_0x3759e6,'\x0a')}},getCustomFields(_0x53bfa8[_0xccd0('0x19')],_0x3759e6))}})[_0xccd0('0x1a')](function(_0x452bf2){logger['info'](_0xccd0('0x1b'));return _0x452bf2[_0xccd0('0x1c')];});}function getUser(_0x1584eb,_0xc2c139){if(intUtil[_0xccd0('0x1d')](_0xc2c139)){logger[_0xccd0('0xd')](_0xccd0('0x1e'),_0xc2c139);return request({'uri':util[_0xccd0('0xf')]('%s/search.json',_0x1584eb[_0xccd0('0x11')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0xc2c139)}})[_0xccd0('0x1a')](function(_0x1b2f52){if(_0x1b2f52[_0xccd0('0x1f')]){logger['info'](_0xccd0('0x20'));return _[_0xccd0('0x21')](_0x1b2f52[_0xccd0('0x22')],{'email':_0xc2c139,'role':'agent'});}else{logger[_0xccd0('0xd')](_0xccd0('0x23'));return request({'uri':util[_0xccd0('0xf')](_0xccd0('0x24'),_0x1584eb[_0xccd0('0x11')])})[_0xccd0('0x1a')](function(_0x293044){logger[_0xccd0('0xd')](_0xccd0('0x25'));return _0x293044[_0xccd0('0x26')];});}});}else{logger[_0xccd0('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xccd0('0x24'),_0x1584eb['remoteUri'])})['then'](function(_0x2eea7c){logger[_0xccd0('0xd')]('Admin\x20account\x20selected.');return _0x2eea7c[_0xccd0('0x26')];});}}function getEndUser(_0x437e5b,_0x1dd424,_0x23da39){logger[_0xccd0('0xd')]('Searching\x20enduser\x20with\x20phone',_0x23da39);return request({'uri':util[_0xccd0('0xf')]('%s/search.json',_0x437e5b[_0xccd0('0x11')]),'qs':{'query':util[_0xccd0('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x23da39)}})[_0xccd0('0x1a')](function(_0xfe7288){var _0x503a7e;if(_0xfe7288[_0xccd0('0x22')]['length']){_0xfe7288[_0xccd0('0x22')]=_[_0xccd0('0x27')](_0xfe7288[_0xccd0('0x22')],{'suspended':![],'role':_0xccd0('0x28')});if(_0xfe7288[_0xccd0('0x22')][_0xccd0('0x29')]){_0x503a7e=_['first'](_0xfe7288[_0xccd0('0x22')]);}}if(_0x503a7e){logger[_0xccd0('0xd')](_0xccd0('0x2a'));return _0x503a7e;}else{logger[_0xccd0('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xccd0('0xf')](_0xccd0('0x2b'),_0x437e5b['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0xccd0('0x2c'),_0x1dd424||_0x23da39),'phone':_0x23da39}}})[_0xccd0('0x1a')](function(_0x42343d){logger[_0xccd0('0xd')]('Enduser\x20created.');return _0x42343d['user'];});}});}function getAuth(_0x3f9d35){var _0x420f36;if(_0x3f9d35[_0xccd0('0x2d')]===_0xccd0('0x2e')){_0x420f36=util['format'](_0xccd0('0x2f'),_0x3f9d35['username'],_0x3f9d35[_0xccd0('0x2e')]);}else if(_0x3f9d35['authType']===_0xccd0('0x30')){_0x420f36=util[_0xccd0('0xf')](_0xccd0('0x31'),_0x3f9d35[_0xccd0('0x32')],_0x3f9d35[_0xccd0('0x30')]);}return util[_0xccd0('0xf')]('Basic\x20%s',new Buffer(_0x420f36)['toString'](_0xccd0('0x33')));}function request(_0x50a6f7){logger[_0xccd0('0x34')](_0xccd0('0x35'),JSON[_0xccd0('0x36')](_0x50a6f7));return rp(_[_0xccd0('0x7')](_0x50a6f7,{'method':_0xccd0('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x745aa2,_0x23ced8){var _0x28ac2e=[];if(_0x745aa2&&_0x745aa2[_0xccd0('0x29')]>0x0){_0x28ac2e=_[_0xccd0('0x38')](_0x745aa2,_0x23ced8);}return _0x28ac2e;}function getCustomFields(_0x2b9784,_0x27d6cf){var _0x1e3d15=[];var _0x87eeb4={'custom_fields':[]};if(_0x2b9784[_0xccd0('0x29')]>0x0){_['forEach'](_0x2b9784,function(_0x3ce278){if(_[_0xccd0('0x39')]([_0xccd0('0x3a'),_0xccd0('0x3b')],_0x3ce278[_0xccd0('0x3c')])&&_0x3ce278[_0xccd0('0x3d')]&&!_0x3ce278[_0xccd0('0x3e')]){_0x87eeb4[_0x3ce278[_0xccd0('0x3d')]['toLowerCase']()]=_0x3ce278[_0xccd0('0x3f')][_0xccd0('0x40')]();}else if(_[_0xccd0('0x39')]([_0xccd0('0x3a'),_0xccd0('0x3b')],_0x3ce278[_0xccd0('0x3c')])&&_0x3ce278[_0xccd0('0x41')]&&_0x3ce278[_0xccd0('0x3e')]){_0x87eeb4[_0xccd0('0x42')][_0xccd0('0x43')]({'id':_0x3ce278[_0xccd0('0x41')],'value':_0x3ce278[_0xccd0('0x3f')][_0xccd0('0x40')]()});}else if(_0x3ce278[_0xccd0('0x3c')]===_0xccd0('0x44')&&_0x3ce278[_0xccd0('0x45')]&&_0x3ce278['idField']&&_0x3ce278[_0xccd0('0x3e')]){_0x27d6cf[_0x3ce278['variableName']]&&_0x87eeb4[_0xccd0('0x42')]['push']({'id':_0x3ce278[_0xccd0('0x41')],'value':_0x27d6cf[_0x3ce278[_0xccd0('0x45')]][_0xccd0('0x40')]()});}else if(_0x3ce278[_0xccd0('0x3c')]===_0xccd0('0x46')&&_0x3ce278[_0xccd0('0x47')]&&_0x3ce278[_0xccd0('0x47')][_0xccd0('0x15')]&&_0x3ce278[_0xccd0('0x41')]&&_0x3ce278[_0xccd0('0x3e')]){_0x27d6cf[_0x3ce278[_0xccd0('0x47')][_0xccd0('0x15')][_0xccd0('0x48')]()]&&_0x87eeb4[_0xccd0('0x42')][_0xccd0('0x43')]({'id':_0x3ce278[_0xccd0('0x41')],'value':_0x27d6cf[_0x3ce278[_0xccd0('0x47')][_0xccd0('0x15')]['toLowerCase']()][_0xccd0('0x40')]()});}});}return _0x87eeb4;}exports[_0xccd0('0x49')]=function(_0x463813,_0x436729,_0xf9f44c,_0x41d05e,_0x5d6ea5,_0x46fccb){var _0x2f4ea5,_0x1869df;_0x46fccb[_0xccd0('0x11')]=intUtil[_0xccd0('0x4a')](_0x46fccb[_0xccd0('0x11')]);_0x46fccb[_0xccd0('0x4b')]=intUtil[_0xccd0('0x4a')](_0x46fccb['serverUrl']);if(_0x5d6ea5&&_0x5d6ea5[_0xccd0('0x4c')]){logger[_0xccd0('0xd')](_0xccd0('0x4d'),_0xccd0('0x4e'));_0x436729[_0xccd0('0x4f')]=util[_0xccd0('0xf')](_0xccd0('0x50'),_0x46fccb[_0xccd0('0x4b')],_0x436729['uniqueid'],md5(_0x436729['uniqueid']));}else{_0x436729[_0xccd0('0x4f')]='';}headers[_0xccd0('0x51')]=getAuth(_0x46fccb);return getUser(_0x46fccb,_0x41d05e[_0xccd0('0x52')])[_0xccd0('0x1a')](function(_0x45d72d){_0x2f4ea5=_0x45d72d;logger[_0xccd0('0xd')]('The\x20User\x20ID\x20is:',_0x2f4ea5['id']);return getEndUser(_0x46fccb,_0x436729['calleridname'],_0x436729[_0xccd0('0x53')]);})['then'](function(_0x545199){_0x1869df=_0x545199;logger[_0xccd0('0xd')](_0xccd0('0x54'),_0x1869df['id']);return getTicket(_0x46fccb,_0x2f4ea5,_0x1869df,_0xf9f44c,_0x436729);})[_0xccd0('0x1a')](function(_0x2ae788){if(_0x2ae788){logger[_0xccd0('0xd')](_0xccd0('0x55'),_0x2ae788['id']);switch(_0x46fccb['type']){case'integrationTab':logger[_0xccd0('0xd')](_0xccd0('0x4d'),_0xccd0('0x56'));return request({'uri':util[_0xccd0('0xf')](_0xccd0('0x57'),_0x46fccb['remoteUri'],_0x2f4ea5['id'],_0x2ae788['id']),'method':_0xccd0('0x12')});case _0xccd0('0x58'):logger[_0xccd0('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xccd0('0xf')]('user:%s',_0x41d05e[_0xccd0('0x15')]),'trigger:browser:url',{'uri':util[_0xccd0('0xf')]('%s/agent/tickets/%s',_0x46fccb[_0xccd0('0x11')]['replace'](_0xccd0('0x59'),''),_0x2ae788['id'])});break;default:logger[_0xccd0('0x5a')](_0xccd0('0x4d'),_0xccd0('0x5b'));}}})[_0xccd0('0x5c')](function(_0x3d5567){logger[_0xccd0('0x5a')](_0xccd0('0x5d'),util[_0xccd0('0x5e')](_0x3d5567,{'showHidden':!![],'depth':null}));});};exports[_0xccd0('0x5f')]=function(_0x17f6f7,_0x43a71a,_0x31d289,_0x4fe43b,_0xdad6bf,_0x2b218e,_0x4d28ac){var _0x1db817,_0x4402b8;_0x2b218e[_0xccd0('0x11')]=intUtil[_0xccd0('0x4a')](_0x2b218e[_0xccd0('0x11')]);_0x2b218e[_0xccd0('0x4b')]=intUtil[_0xccd0('0x4a')](_0x2b218e['serverUrl']);if(_0x4d28ac&&_0x4d28ac[_0xccd0('0x60')]&&_0x4d28ac[_0xccd0('0x60')]!==_0xccd0('0x61')){logger[_0xccd0('0xd')]('[OUTBOUND]',_0xccd0('0x4e'));_0x43a71a[_0xccd0('0x4f')]=util['format'](_0xccd0('0x50'),_0x2b218e['serverUrl'],_0x43a71a[_0xccd0('0x62')],md5(_0x43a71a['uniqueid']));}headers[_0xccd0('0x51')]=getAuth(_0x2b218e);return getUser(_0x2b218e,_0x4fe43b[_0xccd0('0x52')])['then'](function(_0x5b4255){_0x1db817=_0x5b4255;logger[_0xccd0('0xd')](_0xccd0('0x63'),_0x1db817['id']);return getEndUser(_0x2b218e,_0x43a71a[_0xccd0('0x64')],_0x43a71a[_0xccd0('0x65')]);})[_0xccd0('0x1a')](function(_0x1272ec){_0x4402b8=_0x1272ec;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4402b8['id']);return getTicket(_0x2b218e,_0x1db817,_0x4402b8,_0x31d289,_0x43a71a);})['then'](function(_0x2bb23b){if(_0x2bb23b){logger[_0xccd0('0xd')](_0xccd0('0x55'),_0x2bb23b['id']);switch(_0x2b218e[_0xccd0('0x3c')]){case _0xccd0('0x66'):logger[_0xccd0('0xd')](_0xccd0('0x67'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xccd0('0xf')](_0xccd0('0x57'),_0x2b218e[_0xccd0('0x11')],_0x1db817['id'],_0x2bb23b['id']),'method':_0xccd0('0x12')});case'newTab':logger[_0xccd0('0xd')](_0xccd0('0x67'),_0xccd0('0x68'));emit(util['format'](_0xccd0('0x69'),_0x4fe43b['name']),_0xccd0('0x6a'),{'uri':util[_0xccd0('0xf')](_0xccd0('0x6b'),_0x2b218e[_0xccd0('0x11')][_0xccd0('0x6c')](_0xccd0('0x59'),''),_0x2bb23b['id'])});break;default:logger['error'](_0xccd0('0x67'),_0xccd0('0x5b'));}}})[_0xccd0('0x5c')](function(_0x1b0f7d){logger['error'](_0xccd0('0x6d'),util[_0xccd0('0x5e')](_0x1b0f7d,{'showHidden':!![],'depth':null}));});};exports[_0xccd0('0x6e')]=function(_0x67cecd,_0x1216b0,_0x3d759b,_0x323cf4,_0x2ea982,_0x50bda7){var _0xea6a1f,_0xf4326f;_0x50bda7[_0xccd0('0x11')]=intUtil[_0xccd0('0x4a')](_0x50bda7['remoteUri']);_0x50bda7[_0xccd0('0x4b')]=intUtil[_0xccd0('0x4a')](_0x50bda7[_0xccd0('0x4b')]);if(_0x2ea982&&_0x2ea982['monitor_format']){logger[_0xccd0('0xd')]('['+_0x1216b0[_0xccd0('0x6f')][_0xccd0('0x70')]()+']',_0xccd0('0x4e'));_0x1216b0['recordingURL']=util[_0xccd0('0xf')](_0xccd0('0x50'),_0x50bda7['serverUrl'],_0x1216b0['uniqueid'],md5(_0x1216b0[_0xccd0('0x62')]));}else{_0x1216b0[_0xccd0('0x4f')]='';}headers[_0xccd0('0x51')]=getAuth(_0x50bda7);return getUser(_0x50bda7)[_0xccd0('0x1a')](function(_0xa2372f){_0xea6a1f=_0xa2372f;logger[_0xccd0('0xd')]('The\x20User\x20ID\x20is:',_0xea6a1f['id']);return getEndUser(_0x50bda7,_0x1216b0[_0xccd0('0x71')],_0x1216b0[_0xccd0('0x53')]);})[_0xccd0('0x1a')](function(_0x225993){_0xf4326f=_0x225993;logger[_0xccd0('0xd')](_0xccd0('0x54'),_0xf4326f['id']);return getTicket(_0x50bda7,_0xea6a1f,_0xf4326f,_0x3d759b,_0x1216b0);})[_0xccd0('0x1a')](function(_0x59b09b){if(_0x59b09b){logger[_0xccd0('0xd')](_0xccd0('0x55'),_0x59b09b['id']);}})[_0xccd0('0x5c')](function(_0x344eb2){logger[_0xccd0('0x5a')]('['+_0x1216b0[_0xccd0('0x6f')][_0xccd0('0x70')]()+']'+_0xccd0('0x72'),util['inspect'](_0x344eb2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xab7f=['toLowerCase','type','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','trigger:browser:url','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','error','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','map','forEach','includes','string','picklist','nameField','customField'];(function(_0x2bb336,_0x4d2edf){var _0x412f98=function(_0x6aa5c8){while(--_0x6aa5c8){_0x2bb336['push'](_0x2bb336['shift']());}};_0x412f98(++_0x4d2edf);}(_0xab7f,0xa3));var _0xfab7=function(_0x5e674b,_0x2fbc81){_0x5e674b=_0x5e674b-0x0;var _0x414433=_0xab7f[_0x5e674b];return _0x414433;};'use strict';var _=require(_0xfab7('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xfab7('0x1'));var Redis=require(_0xfab7('0x2'));var intUtil=require(_0xfab7('0x3'));var config=require(_0xfab7('0x4'));var logger=require(_0xfab7('0x5'))(_0xfab7('0x6'));config[_0xfab7('0x7')]=_[_0xfab7('0x8')](config[_0xfab7('0x7')],{'host':_0xfab7('0x9'),'port':0x18eb});var io=require(_0xfab7('0xa'))(new Redis(config[_0xfab7('0x7')]));function emit(_0x28426f,_0x305f9d,_0x11f8e0){io['to'](_0x28426f)[_0xfab7('0xb')](_0x305f9d,_0x11f8e0);}var headers={'Content-Type':_0xfab7('0xc'),'Accept':_0xfab7('0xc')};function getTicket(_0x3b3b52,_0x40b460,_0x120413,_0x162e61,_0x38bd8b){logger['info'](_0xfab7('0xd'));return request({'uri':util[_0xfab7('0xe')]('%s/tickets.json',_0x3b3b52[_0xfab7('0xf')]),'method':'POST','body':{'ticket':_[_0xfab7('0x10')]({'requester_id':_0x120413['id'],'submitter_id':_0x40b460?_0x40b460['id']:undefined,'assignee_id':_0x40b460?_0x40b460['id']:undefined,'tags':getTags(_0x162e61[_0xfab7('0x11')],'name'),'subject':intUtil[_0xfab7('0x12')](_0x162e61[_0xfab7('0x13')],_0x38bd8b,'\x20'),'description':intUtil[_0xfab7('0x12')](_0x162e61[_0xfab7('0x14')],_0x38bd8b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x162e61[_0xfab7('0x14')],_0x38bd8b,'\x0a')}},getCustomFields(_0x162e61[_0xfab7('0x15')],_0x38bd8b))}})[_0xfab7('0x16')](function(_0x1549cb){logger[_0xfab7('0x17')]('Ticket\x20created!');return _0x1549cb[_0xfab7('0x18')];});}function getUser(_0x4a6192,_0x19f8fc){if(intUtil[_0xfab7('0x19')](_0x19f8fc)){logger[_0xfab7('0x17')](_0xfab7('0x1a'),_0x19f8fc);return request({'uri':util['format']('%s/search.json',_0x4a6192['remoteUri']),'qs':{'query':util[_0xfab7('0xe')](_0xfab7('0x1b'),_0x19f8fc)}})[_0xfab7('0x16')](function(_0x1cd32e){if(_0x1cd32e[_0xfab7('0x1c')]){logger[_0xfab7('0x17')](_0xfab7('0x1d'));return _[_0xfab7('0x1e')](_0x1cd32e[_0xfab7('0x1f')],{'email':_0x19f8fc,'role':_0xfab7('0x20')});}else{logger['info'](_0xfab7('0x21'));return request({'uri':util[_0xfab7('0xe')]('%s/users/me.json',_0x4a6192[_0xfab7('0xf')])})['then'](function(_0x1e61e4){logger['info'](_0xfab7('0x22'));return _0x1e61e4[_0xfab7('0x23')];});}});}else{logger[_0xfab7('0x17')](_0xfab7('0x21'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x24'),_0x4a6192['remoteUri'])})['then'](function(_0x162d8b){logger['info'](_0xfab7('0x22'));return _0x162d8b[_0xfab7('0x23')];});}}function getEndUser(_0x52ee2d,_0x51bee2,_0x28d1b6){logger[_0xfab7('0x17')](_0xfab7('0x25'),_0x28d1b6);return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x26'),_0x52ee2d[_0xfab7('0xf')]),'qs':{'query':util[_0xfab7('0xe')](_0xfab7('0x27'),_0x28d1b6)}})[_0xfab7('0x16')](function(_0x49c1dc){var _0x4295c9;if(_0x49c1dc[_0xfab7('0x1f')][_0xfab7('0x28')]){_0x49c1dc[_0xfab7('0x1f')]=_[_0xfab7('0x29')](_0x49c1dc[_0xfab7('0x1f')],{'suspended':![],'role':_0xfab7('0x2a')});if(_0x49c1dc[_0xfab7('0x1f')][_0xfab7('0x28')]){_0x4295c9=_[_0xfab7('0x2b')](_0x49c1dc[_0xfab7('0x1f')]);}}if(_0x4295c9){logger[_0xfab7('0x17')](_0xfab7('0x2c'));return _0x4295c9;}else{logger[_0xfab7('0x17')](_0xfab7('0x2d'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x2e'),_0x52ee2d[_0xfab7('0xf')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xfab7('0xe')]('Caller\x20-\x20%s',_0x51bee2||_0x28d1b6),'phone':_0x28d1b6}}})[_0xfab7('0x16')](function(_0x1d5bff){logger[_0xfab7('0x17')](_0xfab7('0x2f'));return _0x1d5bff[_0xfab7('0x23')];});}});}function getAuth(_0x313a8e){var _0x111cac;if(_0x313a8e[_0xfab7('0x30')]==='password'){_0x111cac=util[_0xfab7('0xe')](_0xfab7('0x31'),_0x313a8e[_0xfab7('0x32')],_0x313a8e['password']);}else if(_0x313a8e['authType']===_0xfab7('0x33')){_0x111cac=util[_0xfab7('0xe')](_0xfab7('0x34'),_0x313a8e['username'],_0x313a8e['token']);}return util[_0xfab7('0xe')](_0xfab7('0x35'),new Buffer(_0x111cac)[_0xfab7('0x36')](_0xfab7('0x37')));}function request(_0x1df61c){logger[_0xfab7('0x38')]('[HTTP]',JSON[_0xfab7('0x39')](_0x1df61c));return rp(_[_0xfab7('0x8')](_0x1df61c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xe94aa6,_0x13703d){var _0x4eb8f0=[];if(_0xe94aa6&&_0xe94aa6['length']>0x0){_0x4eb8f0=_[_0xfab7('0x3a')](_0xe94aa6,_0x13703d);}return _0x4eb8f0;}function getCustomFields(_0x3441d1,_0x655214){var _0x186641=[];var _0x3bb792={'custom_fields':[]};if(_0x3441d1[_0xfab7('0x28')]>0x0){_[_0xfab7('0x3b')](_0x3441d1,function(_0xe26911){if(_[_0xfab7('0x3c')]([_0xfab7('0x3d'),_0xfab7('0x3e')],_0xe26911['type'])&&_0xe26911[_0xfab7('0x3f')]&&!_0xe26911[_0xfab7('0x40')]){_0x3bb792[_0xe26911[_0xfab7('0x3f')][_0xfab7('0x41')]()]=_0xe26911['content'][_0xfab7('0x36')]();}else if(_[_0xfab7('0x3c')]([_0xfab7('0x3d'),'picklist'],_0xe26911[_0xfab7('0x42')])&&_0xe26911[_0xfab7('0x43')]&&_0xe26911[_0xfab7('0x40')]){_0x3bb792[_0xfab7('0x44')][_0xfab7('0x45')]({'id':_0xe26911['idField'],'value':_0xe26911[_0xfab7('0x46')]['toString']()});}else if(_0xe26911[_0xfab7('0x42')]===_0xfab7('0x47')&&_0xe26911[_0xfab7('0x48')]&&_0xe26911['idField']&&_0xe26911[_0xfab7('0x40')]){_0x655214[_0xe26911['variableName']]&&_0x3bb792['custom_fields']['push']({'id':_0xe26911[_0xfab7('0x43')],'value':_0x655214[_0xe26911[_0xfab7('0x48')]][_0xfab7('0x36')]()});}else if(_0xe26911['type']===_0xfab7('0x49')&&_0xe26911['Variable']&&_0xe26911[_0xfab7('0x4a')][_0xfab7('0x4b')]&&_0xe26911['idField']&&_0xe26911[_0xfab7('0x40')]){_0x655214[_0xe26911[_0xfab7('0x4a')][_0xfab7('0x4b')][_0xfab7('0x41')]()]&&_0x3bb792[_0xfab7('0x44')][_0xfab7('0x45')]({'id':_0xe26911[_0xfab7('0x43')],'value':_0x655214[_0xe26911[_0xfab7('0x4a')]['name'][_0xfab7('0x41')]()]['toString']()});}});}return _0x3bb792;}exports[_0xfab7('0x4c')]=function(_0x575cc7,_0x2b2cdf,_0x3c3da9,_0x93e7e3,_0x529592,_0x1e6762){var _0x47ddef,_0x102cfa;_0x1e6762['remoteUri']=intUtil[_0xfab7('0x4d')](_0x1e6762[_0xfab7('0xf')]);_0x1e6762[_0xfab7('0x4e')]=intUtil[_0xfab7('0x4d')](_0x1e6762[_0xfab7('0x4e')]);if(_0x529592&&_0x529592[_0xfab7('0x4f')]){logger[_0xfab7('0x17')]('[QUEUE]',_0xfab7('0x50'));_0x2b2cdf[_0xfab7('0x51')]=util['format'](_0xfab7('0x52'),_0x1e6762[_0xfab7('0x4e')],_0x2b2cdf['uniqueid'],md5(_0x2b2cdf[_0xfab7('0x53')]));}else{_0x2b2cdf[_0xfab7('0x51')]='';}headers['Authorization']=getAuth(_0x1e6762);return getUser(_0x1e6762,_0x93e7e3[_0xfab7('0x54')])[_0xfab7('0x16')](function(_0x22f7d2){_0x47ddef=_0x22f7d2;logger['info'](_0xfab7('0x55'),_0x47ddef['id']);return getEndUser(_0x1e6762,_0x2b2cdf[_0xfab7('0x56')],_0x2b2cdf[_0xfab7('0x57')]);})['then'](function(_0x239329){_0x102cfa=_0x239329;logger[_0xfab7('0x17')](_0xfab7('0x58'),_0x102cfa['id']);return getTicket(_0x1e6762,_0x47ddef,_0x102cfa,_0x3c3da9,_0x2b2cdf);})[_0xfab7('0x16')](function(_0x35a154){if(_0x35a154){logger[_0xfab7('0x17')](_0xfab7('0x59'),_0x35a154['id']);switch(_0x1e6762[_0xfab7('0x42')]){case'integrationTab':logger[_0xfab7('0x17')](_0xfab7('0x5a'),_0xfab7('0x5b'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x5c'),_0x1e6762[_0xfab7('0xf')],_0x47ddef['id'],_0x35a154['id']),'method':_0xfab7('0x5d')});case'newTab':logger[_0xfab7('0x17')](_0xfab7('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfab7('0xe')]('user:%s',_0x93e7e3[_0xfab7('0x4b')]),_0xfab7('0x5e'),{'uri':util['format'](_0xfab7('0x5f'),_0x1e6762[_0xfab7('0xf')][_0xfab7('0x60')]('/api/v2',''),_0x35a154['id'])});break;default:logger['error']('[QUEUE]',_0xfab7('0x61'));}}})['catch'](function(_0x1a8aab){logger[_0xfab7('0x62')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfab7('0x63')](_0x1a8aab,{'showHidden':!![],'depth':null}));});};exports[_0xfab7('0x64')]=function(_0x55de0d,_0x49e067,_0x501f99,_0x2a4fc8,_0x4294e3,_0x5233db,_0x324f96){var _0x613016,_0x3f961a;_0x5233db[_0xfab7('0xf')]=intUtil['stripTrailingSlash'](_0x5233db[_0xfab7('0xf')]);_0x5233db[_0xfab7('0x4e')]=intUtil[_0xfab7('0x4d')](_0x5233db[_0xfab7('0x4e')]);if(_0x324f96&&_0x324f96['recordingFormat']&&_0x324f96[_0xfab7('0x65')]!=='none'){logger[_0xfab7('0x17')](_0xfab7('0x66'),_0xfab7('0x50'));_0x49e067[_0xfab7('0x51')]=util[_0xfab7('0xe')](_0xfab7('0x52'),_0x5233db[_0xfab7('0x4e')],_0x49e067['uniqueid'],md5(_0x49e067[_0xfab7('0x53')]));}headers[_0xfab7('0x67')]=getAuth(_0x5233db);return getUser(_0x5233db,_0x2a4fc8['email'])['then'](function(_0x4750c7){_0x613016=_0x4750c7;logger[_0xfab7('0x17')](_0xfab7('0x55'),_0x613016['id']);return getEndUser(_0x5233db,_0x49e067[_0xfab7('0x68')],_0x49e067[_0xfab7('0x69')]);})[_0xfab7('0x16')](function(_0x3c0701){_0x3f961a=_0x3c0701;logger[_0xfab7('0x17')](_0xfab7('0x58'),_0x3f961a['id']);return getTicket(_0x5233db,_0x613016,_0x3f961a,_0x501f99,_0x49e067);})[_0xfab7('0x16')](function(_0x58b0cb){if(_0x58b0cb){logger['info'](_0xfab7('0x59'),_0x58b0cb['id']);switch(_0x5233db['type']){case _0xfab7('0x6a'):logger[_0xfab7('0x17')](_0xfab7('0x66'),_0xfab7('0x5b'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x5c'),_0x5233db[_0xfab7('0xf')],_0x613016['id'],_0x58b0cb['id']),'method':_0xfab7('0x5d')});case _0xfab7('0x6b'):logger['info'](_0xfab7('0x66'),_0xfab7('0x6c'));emit(util[_0xfab7('0xe')]('user:%s',_0x2a4fc8['name']),_0xfab7('0x5e'),{'uri':util['format']('%s/agent/tickets/%s',_0x5233db[_0xfab7('0xf')][_0xfab7('0x60')](_0xfab7('0x6d'),''),_0x58b0cb['id'])});break;default:logger['error']('[OUTBOUND]',_0xfab7('0x61'));}}})['catch'](function(_0x29f8bd){logger[_0xfab7('0x62')](_0xfab7('0x6e'),util[_0xfab7('0x63')](_0x29f8bd,{'showHidden':!![],'depth':null}));});};exports[_0xfab7('0x6f')]=function(_0x15fc06,_0x28d175,_0x276785,_0x56b9ff,_0x2b447d,_0x33a776){var _0x413e8e,_0x3a2ce1;_0x33a776[_0xfab7('0xf')]=intUtil[_0xfab7('0x4d')](_0x33a776['remoteUri']);_0x33a776[_0xfab7('0x4e')]=intUtil[_0xfab7('0x4d')](_0x33a776[_0xfab7('0x4e')]);if(_0x2b447d&&_0x2b447d[_0xfab7('0x4f')]){logger[_0xfab7('0x17')]('['+_0x28d175[_0xfab7('0x70')]['toUpperCase']()+']',_0xfab7('0x50'));_0x28d175[_0xfab7('0x51')]=util[_0xfab7('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33a776[_0xfab7('0x4e')],_0x28d175[_0xfab7('0x53')],md5(_0x28d175['uniqueid']));}else{_0x28d175['recordingURL']='';}headers[_0xfab7('0x67')]=getAuth(_0x33a776);return getUser(_0x33a776)[_0xfab7('0x16')](function(_0x5b2c06){_0x413e8e=_0x5b2c06;logger['info'](_0xfab7('0x55'),_0x413e8e['id']);return getEndUser(_0x33a776,_0x28d175['calleridname'],_0x28d175[_0xfab7('0x57')]);})[_0xfab7('0x16')](function(_0x1e4c5b){_0x3a2ce1=_0x1e4c5b;logger[_0xfab7('0x17')](_0xfab7('0x58'),_0x3a2ce1['id']);return getTicket(_0x33a776,_0x413e8e,_0x3a2ce1,_0x276785,_0x28d175);})[_0xfab7('0x16')](function(_0x396b74){if(_0x396b74){logger['info'](_0xfab7('0x59'),_0x396b74['id']);}})['catch'](function(_0x5d8bdb){logger[_0xfab7('0x62')]('['+_0x28d175['lastevent'][_0xfab7('0x71')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x5d8bdb,{'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 4a392f6..fc3ea6e 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 _0xa454=['Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','monitor_format','calleridnum','request-promise','md5','util','./util','bluebird','../../../../config/environment','zoho','defaults','localhost','redis','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','getString','Description','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','endtime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa454,0xc8));var _0x4a45=function(_0x57e5c3,_0x5c6f2a){_0x57e5c3=_0x57e5c3-0x0;var _0x2bff26=_0xa454[_0x57e5c3];return _0x2bff26;};'use strict';var _=require('lodash');var rp=require(_0x4a45('0x0'));var md5=require(_0x4a45('0x1'));var util=require(_0x4a45('0x2'));var intUtil=require(_0x4a45('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x4a45('0x4'));var config=require(_0x4a45('0x5'));var logger=require('../../../../config/logger')(_0x4a45('0x6'));config['redis']=_[_0x4a45('0x7')](config['redis'],{'host':_0x4a45('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4a45('0x9')]));function emit(_0x1217c5,_0x4a4696,_0x54d3e9){io['to'](_0x1217c5)['emit'](_0x4a4696,_0x54d3e9);}function request(_0x2c5f6c){logger[_0x4a45('0xa')](_0x4a45('0xb'),JSON[_0x4a45('0xc')](_0x2c5f6c));return rp(_0x2c5f6c);}function getCustomFields(_0x2df184,_0x300efd){var _0x2eb6cb={};if(_0x2df184[_0x4a45('0xd')]>0x0){_[_0x4a45('0xe')](_0x2df184,function(_0x3f589f){if(_[_0x4a45('0xf')]([_0x4a45('0x10'),_0x4a45('0x11')],_0x3f589f[_0x4a45('0x12')])&&_0x3f589f[_0x4a45('0x13')]){_0x2eb6cb[_0x3f589f[_0x4a45('0x13')]]=_0x3f589f['content'][_0x4a45('0x14')]();}else if(_0x3f589f['type']===_0x4a45('0x15')&&_0x3f589f[_0x4a45('0x16')]&&_0x3f589f[_0x4a45('0x13')]&&_0x300efd[_0x3f589f[_0x4a45('0x16')]]){_0x2eb6cb[_0x3f589f['idField']]=_0x300efd[_0x3f589f['variableName']][_0x4a45('0x14')]();}else if(_0x3f589f[_0x4a45('0x12')]===_0x4a45('0x17')&&_0x3f589f[_0x4a45('0x18')]&&_0x3f589f[_0x4a45('0x18')][_0x4a45('0x19')]&&_0x3f589f['idField']&&_0x300efd[_0x3f589f['Variable'][_0x4a45('0x19')][_0x4a45('0x1a')]()]){_0x2eb6cb[_0x3f589f[_0x4a45('0x13')]]=_0x300efd[_0x3f589f[_0x4a45('0x18')]['name'][_0x4a45('0x1a')]()]['toString']();}});}return _0x2eb6cb;}function getName(_0xec81e1){if(_0xec81e1[_0x4a45('0x1b')]('\x20')>0x0){var _0x2e8976=_0xec81e1[_0x4a45('0x1c')](/ (.+)/);if(_0x2e8976[0x1]){return _0x2e8976;}}return[_0xec81e1,_0xec81e1];}var accountsTokens={};function getAccessToken(_0x1cd251){return new Promise(function(_0x5ae0e1,_0xf9acd6){if(!_[_0x4a45('0x1d')](accountsTokens[_0x1cd251['id']])&&!_[_0x4a45('0x1d')](accountsTokens[_0x1cd251['id']]['access_token'])){if(moment()[_0x4a45('0x1e')](accountsTokens[_0x1cd251['id']]['expires_in'])){_0x5ae0e1(accountsTokens[_0x1cd251['id']][_0x4a45('0x1f')]);}}var _0x3ecc8e;switch(_0x1cd251[_0x4a45('0x20')]){case'US':_0x3ecc8e=_0x4a45('0x21');break;case'AU':_0x3ecc8e=_0x4a45('0x22');break;case'EU':_0x3ecc8e='https://accounts.zoho.eu';break;case'IN':_0x3ecc8e=_0x4a45('0x23');break;case'CN':_0x3ecc8e='https://accounts.zoho.com.cn';break;default:_0x3ecc8e=_0x4a45('0x24');break;}var _0x315305={'method':_0x4a45('0x25'),'uri':_0x3ecc8e+_0x4a45('0x26'),'qs':{'refresh_token':_0x1cd251[_0x4a45('0x27')],'client_id':_0x1cd251[_0x4a45('0x28')],'client_secret':_0x1cd251[_0x4a45('0x29')],'grant_type':_0x4a45('0x2a')},'json':!![]};return rp(_0x315305)[_0x4a45('0x2b')](function(_0x17086a){accountsTokens[_0x1cd251['id']]={'access_token':_0x17086a[_0x4a45('0x1f')],'expires_in':moment()[_0x4a45('0x2c')](_0x17086a['expires_in'],'seconds')};_0x5ae0e1(_0x17086a[_0x4a45('0x1f')]);})[_0x4a45('0x2d')](function(_0x43050f){logger[_0x4a45('0x2e')](_0x4a45('0x2f'),_0x43050f['stack']);_0xf9acd6(_0x43050f);});});}function getUser(_0x35b87f,_0xdc0863,_0x2c9adc,_0x5c0587){logger[_0x4a45('0x30')](_0x4a45('0x31'));return request({'method':_0x4a45('0x32'),'uri':util[_0x4a45('0x33')](_0x4a45('0x34'),_0xdc0863),'qs':{'type':_0x4a45('0x35')},'headers':{'Authorization':_0x4a45('0x36')+_0x35b87f},'json':!![]})[_0x4a45('0x2b')](function(_0x535760){if(_0x535760['users']){var _0xcfbeed=-0x1;if(_[_0x4a45('0x37')](_0x535760[_0x4a45('0x38')])){if(!_[_0x4a45('0x1d')](_0x5c0587)){_0xcfbeed=_[_0x4a45('0x39')](_0x535760['users'],function(_0x503489){return _0x503489[_0x4a45('0x3a')]===_0x5c0587;});}if(_0xcfbeed>=0x0){logger[_0x4a45('0x30')](_0x4a45('0x3b'));}else{logger[_0x4a45('0x30')](_0x4a45('0x3c'));_0xcfbeed=_[_0x4a45('0x39')](_0x535760['users'],function(_0x2283d2){return _0x2283d2[_0x4a45('0x3d')][_0x4a45('0x19')]==='Administrator';});}return _0x535760['users'][_0xcfbeed];}else{if(_0x535760[_0x4a45('0x3e')][_0x4a45('0x3d')][_0x4a45('0x19')]==='Administrator'){logger[_0x4a45('0x30')](_0x4a45('0x3c'));user=_0x535760[_0x4a45('0x3e')];return user;}else{logger['error'](_0x4a45('0x3f'),JSON['stringify'](_0x535760));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4a45('0xc')](_0x535760));}}}else{logger[_0x4a45('0x2e')](_0x4a45('0x3f'),JSON[_0x4a45('0xc')](_0x535760));throw new Error(_0x4a45('0x40')+JSON['stringify'](_0x535760));}})[_0x4a45('0x2d')](function(_0x377545){console[_0x4a45('0x2e')](_0x377545);});}function getZohoUser(_0xc782ef,_0x242568){return new BPromise(function(_0xb2d352,_0x5d0a5e){request(_0xc782ef)['then'](function(_0x4f4a13){var _0x2f7b4e=null;if(_0x4f4a13){_0x2f7b4e=_0x4f4a13[_0x4a45('0x41')][0x0];_0x2f7b4e[_0x4a45('0x42')]=_0x242568;}_0xb2d352(_0x2f7b4e);})['catch'](function(_0x4b6cad){_0x5d0a5e(_0x4b6cad);});});}function createEndUser(_0x278169,_0x2f51c5,_0x13a8b1,_0x446cd1,_0x4727c3,_0xc88f1d){var _0x13a8b1=getName(_0x13a8b1);return request({'method':_0x4a45('0x25'),'uri':'https://www.zohoapis.'+_0x2f51c5+_0x4a45('0x43')+_[_0x4a45('0x44')](_0xc88f1d[_0x4a45('0x45')])+'s','body':{'data':[{'Last_Name':_0x13a8b1[0x1],'First_Name':_0x13a8b1[0x0],'Phone':_0x446cd1,'Owner':{'name':!_['isNil'](_0x4727c3['role'][_0x4a45('0x19')])?_0x4727c3[_0x4a45('0x46')][_0x4a45('0x19')]:!_[_0x4a45('0x1d')](_0x4727c3[_0x4a45('0x47')])?_0x4727c3['first_name']+'\x20'+_0x4727c3['last_name']:_0x4727c3[_0x4a45('0x48')],'id':_0x4727c3['id']}}]},'headers':{'Authorization':_0x4a45('0x36')+_0x278169},'json':!![]})[_0x4a45('0x2b')](function(_0x2bc0fa){if(_0x2bc0fa&&_0x2bc0fa[_0x4a45('0x41')][0x0][_0x4a45('0x49')]===_0x4a45('0x4a')){var _0x58a6d7=_0x2bc0fa['data'][0x0][_0x4a45('0x4b')];_0x58a6d7['enduserType']=_[_0x4a45('0x44')](_0xc88f1d['moduleCreate'])+'s';return _0x58a6d7;}logger[_0x4a45('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x4a45('0xc')](data));throw new Error(_0x4a45('0x4c')+JSON[_0x4a45('0xc')](data));})[_0x4a45('0x2d')](function(_0x241d19){console[_0x4a45('0x4d')](_0x4a45('0x4e'),_0x241d19);});}function getEndUser(_0x584abc,_0x36c339,_0x1dd367,_0x376b23,_0x1e9d8a,_0x1b2c53,_0x5133e8){var _0x3b3d10={'method':_0x4a45('0x32'),'uri':'','headers':{'Authorization':_0x4a45('0x36')+_0x584abc},'json':!![]};switch(_0x5133e8['moduleSearch']){case _0x4a45('0x4f'):_0x3b3d10[_0x4a45('0x50')]=_0x4a45('0x51')+_0x36c339+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1e9d8a+'))';return getZohoUser(_0x3b3d10,_0x4a45('0x52'))[_0x4a45('0x2b')](function(_0x3ee67e){if(_0x3ee67e)return _0x3ee67e;_0x3b3d10['uri']=_0x4a45('0x51')+_0x36c339+_0x4a45('0x53')+_0x1e9d8a+'))';return getZohoUser(_0x3b3d10,'Leads')[_0x4a45('0x2b')](function(_0x1897ac){if(_0x1897ac)return _0x1897ac;if(_0x5133e8[_0x4a45('0x45')]!=_0x4a45('0x54')){return createEndUser(_0x584abc,_0x36c339,_0x376b23,_0x1e9d8a,_0x1b2c53,_0x5133e8);}else{return{};}});});break;case _0x4a45('0x55'):_0x3b3d10[_0x4a45('0x50')]=_0x4a45('0x51')+_0x36c339+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1e9d8a+'))';return getZohoUser(_0x3b3d10,_0x4a45('0x52'))[_0x4a45('0x2b')](function(_0x38e96c){if(_0x38e96c)return _0x38e96c;if(_0x5133e8['moduleCreate']!='nothing'){return createEndUser(_0x584abc,_0x36c339,_0x376b23,_0x1e9d8a,_0x1b2c53,_0x5133e8);}else{return{};}});break;case _0x4a45('0x56'):_0x3b3d10[_0x4a45('0x50')]='https://www.zohoapis.'+_0x36c339+_0x4a45('0x53')+_0x1e9d8a+'))';return getZohoUser(_0x3b3d10,'Leads')[_0x4a45('0x2b')](function(_0x5c3f94){if(_0x5c3f94)return _0x5c3f94;if(_0x5133e8[_0x4a45('0x45')]!=_0x4a45('0x54')){return createEndUser(_0x584abc,_0x36c339,_0x376b23,_0x1e9d8a,_0x1b2c53,_0x5133e8);}else{return{};}});break;}}function getCall(_0x1bd2f4,_0x17f86b,_0x233d4a,_0x19a990,_0x46adb5,_0x201b8c,_0xaea82f,_0x2c88a3){logger[_0x4a45('0x30')](_0x4a45('0x57'));var _0x53edce={};_0x53edce[_0x4a45('0x58')]={'name':!_['isNil'](_0x19a990[_0x4a45('0x46')]['name'])&&!_['isNil'](_0x19a990[_0x4a45('0x3d')][_0x4a45('0x19')])&&_0x19a990[_0x4a45('0x3d')][_0x4a45('0x19')]===_0x4a45('0x59')?_0x19a990[_0x4a45('0x46')][_0x4a45('0x19')]:!_[_0x4a45('0x1d')](_0x19a990[_0x4a45('0x47')])?_0x19a990[_0x4a45('0x47')]+'\x20'+_0x19a990[_0x4a45('0x48')]:_0x19a990[_0x4a45('0x48')],'id':_0x19a990['id']};_0x53edce['Subject']=intUtil[_0x4a45('0x5a')](_0x201b8c['Subjects'],_0xaea82f,'\x20');_0x53edce[_0x4a45('0x5b')]=intUtil[_0x4a45('0x5a')](_0x201b8c['Descriptions'],_0xaea82f,'\x0a');if(_0x46adb5[_0x4a45('0x42')]==='Contacts'){_0x53edce[_0x4a45('0x5c')]={'name':!_['isNil'](_0x46adb5['Full_Name'])?_0x46adb5[_0x4a45('0x5d')]:!_[_0x4a45('0x1d')](_0x46adb5[_0x4a45('0x5e')])?_0x46adb5[_0x4a45('0x5e')]+'\x20'+_0x46adb5[_0x4a45('0x5f')]:_0x46adb5[_0x4a45('0x5f')],'id':_0x46adb5['id']};}if(_0x46adb5[_0x4a45('0x42')]==='Leads'){_0x53edce['What_Id']={'name':!_['isNil'](_0x46adb5[_0x4a45('0x5d')])?_0x46adb5[_0x4a45('0x5d')]:!_[_0x4a45('0x1d')](_0x46adb5[_0x4a45('0x5e')])?_0x46adb5[_0x4a45('0x5e')]+'\x20'+_0x46adb5[_0x4a45('0x5f')]:_0x46adb5[_0x4a45('0x5f')],'id':_0x46adb5['id']};_0x53edce[_0x4a45('0x60')]=_['startCase'](_0x46adb5[_0x4a45('0x42')]);}if(_0xaea82f['talktime']){_0x53edce[_0x4a45('0x61')]=moment[_0x4a45('0x62')](parseInt(_0xaea82f[_0x4a45('0x63')])*0x3e8)['format']('mm:ss');}else if(_0xaea82f['answertime']&&_0xaea82f[_0x4a45('0x64')]){_0x53edce[_0x4a45('0x61')]=moment['utc'](moment(_0xaea82f[_0x4a45('0x64')],_0x4a45('0x65'))['diff'](moment(_0xaea82f['starttime'],_0x4a45('0x65'))))[_0x4a45('0x33')](_0x4a45('0x66'));}switch(_0xaea82f[_0x4a45('0x67')]){case _0x4a45('0x68'):_0x53edce[_0x4a45('0x69')]=_0x4a45('0x6a');break;case'complete':case _0x4a45('0x6b'):_0x53edce[_0x4a45('0x69')]=_0x4a45('0x6c');break;case _0x4a45('0x6d'):_0x53edce[_0x4a45('0x69')]=_0x4a45('0x6e');break;case _0x4a45('0x6f'):_0x53edce[_0x4a45('0x69')]=_0x4a45('0x70');break;case _0x4a45('0x71'):_0x53edce[_0x4a45('0x69')]=_0x4a45('0x72');default:}_0x53edce[_0x4a45('0x73')]=(_0x2c88a3==='outbound'?moment(_0xaea82f[_0x4a45('0x74')])['format'](_0x4a45('0x65')):moment(_0xaea82f[_0x4a45('0x75')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x4a45('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x53edce[_0x4a45('0x76')]=_0x2c88a3||_0x4a45('0x77');_0x53edce=_[_0x4a45('0x78')](_0x53edce,getCustomFields(_0x201b8c[_0x4a45('0x79')],_0xaea82f));return request({'method':_0x4a45('0x25'),'uri':_0x4a45('0x51')+_0x17f86b+_0x4a45('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1bd2f4},'body':{'data':[_0x53edce]},'json':!![]})[_0x4a45('0x2b')](function(_0x573451){if(_0x573451&&_0x573451[_0x4a45('0x41')][0x0]['code']===_0x4a45('0x4a')){logger['info'](_0x4a45('0x7b'));return{'id':_0x573451[_0x4a45('0x41')][0x0]['details']['id']};}})[_0x4a45('0x2d')](function(_0x5778fb){logger[_0x4a45('0x30')]('err',_0x5778fb[_0x4a45('0x7c')]);console['log'](_0x4a45('0x7d'),_0x5778fb);});}exports[_0x4a45('0x7e')]=function(_0x453c02,_0x4ce380,_0x167ca4,_0x659dc9,_0x1540da,_0x39686a){var _0x4f1a70,_0x2691c2,_0x8b04e;_0x39686a[_0x4a45('0x7f')]=intUtil[_0x4a45('0x80')](_0x39686a[_0x4a45('0x7f')]);_0x39686a[_0x4a45('0x81')]=intUtil[_0x4a45('0x80')](_0x39686a['serverUrl']);if(_0x1540da&&_0x1540da['monitor_format']){logger[_0x4a45('0x30')](_0x4a45('0x82'),_0x4a45('0x83'));_0x4ce380[_0x4a45('0x84')]=_0x39686a[_0x4a45('0x81')]+_0x4a45('0x85')+_0x4ce380[_0x4a45('0x86')]+_0x4a45('0x87')+md5(_0x4ce380[_0x4a45('0x86')]);}else{_0x4ce380[_0x4a45('0x84')]='';}var _0x574e96=_0x39686a['host']===_0x4a45('0x88')?'eu':_0x4a45('0x89');return getAccessToken(_0x39686a)['then'](function(_0x372a8a){_0x8b04e=_0x372a8a;return getUser(_0x8b04e,_0x574e96,_0x39686a,_0x659dc9[_0x4a45('0x3a')]);})['then'](function(_0x10280a){_0x4f1a70=_0x10280a;logger[_0x4a45('0x30')](_0x4a45('0x8a'),_0x4f1a70['id']);return getEndUser(_0x8b04e,_0x574e96,_0x39686a,_0x4ce380[_0x4a45('0x8b')],_0x4ce380['calleridnum'],_0x4f1a70,_0x167ca4);})[_0x4a45('0x2b')](function(_0x7e0aa7){_0x2691c2=_0x7e0aa7;return getCall(_0x8b04e,_0x574e96,_0x39686a,_0x4f1a70,_0x2691c2,_0x167ca4,_0x4ce380,_0x4a45('0x77'));})[_0x4a45('0x2b')](function(_0x18c6f4){if(_0x18c6f4){logger[_0x4a45('0x30')](_0x4a45('0x8c'),_0x18c6f4['id']);logger[_0x4a45('0x30')](_0x4a45('0x82'),_0x4a45('0x8d'));emit(util[_0x4a45('0x33')](_0x4a45('0x8e'),_0x659dc9['name']),_0x4a45('0x8f'),{'uri':_0x4a45('0x90')+_0x39686a[_0x4a45('0x7f')]+_0x4a45('0x91')+_0x18c6f4['id']});}})['catch'](function(_0x5ae5d2){logger['error'](_0x4a45('0x82'),JSON[_0x4a45('0xc')](_0x5ae5d2));});};exports[_0x4a45('0x92')]=function(_0x8fbd64,_0x3eb893,_0x3bf522,_0x273e59,_0x330978,_0x551fd0,_0x34991b){var _0x45d479,_0x263420,_0x1634a9;_0x551fd0['host']=intUtil['stripTrailingSlash'](_0x551fd0['host']);_0x551fd0[_0x4a45('0x81')]=intUtil[_0x4a45('0x80')](_0x551fd0[_0x4a45('0x81')]);if(_0x34991b&&_0x34991b[_0x4a45('0x93')]&&_0x34991b[_0x4a45('0x93')]!==_0x4a45('0x94')){logger[_0x4a45('0x30')](_0x4a45('0x95'),_0x4a45('0x83'));_0x3eb893['recordingURL']=_0x551fd0[_0x4a45('0x81')]+_0x4a45('0x85')+_0x3eb893[_0x4a45('0x86')]+_0x4a45('0x87')+md5(_0x3eb893[_0x4a45('0x86')]);}var _0x391b06=_0x551fd0[_0x4a45('0x7f')]===_0x4a45('0x88')?'eu':_0x4a45('0x89');return getAccessToken(_0x551fd0)[_0x4a45('0x2b')](function(_0x3fdb22){_0x1634a9=_0x3fdb22;return getUser(_0x1634a9,_0x391b06,_0x551fd0,_0x273e59[_0x4a45('0x3a')]);})[_0x4a45('0x2b')](function(_0x32577e){_0x45d479=_0x32577e;logger[_0x4a45('0x30')](_0x4a45('0x8a'),_0x45d479['id']);return getEndUser(_0x1634a9,_0x391b06,_0x551fd0,_0x3eb893[_0x4a45('0x96')],_0x3eb893[_0x4a45('0x97')],_0x45d479,_0x3bf522);})[_0x4a45('0x2b')](function(_0x2a8684){_0x263420=_0x2a8684;return getCall(_0x1634a9,_0x391b06,_0x551fd0,_0x45d479,_0x263420,_0x3bf522,_0x3eb893,_0x4a45('0x98'));})['then'](function(_0x3c2b45){if(_0x3c2b45){logger[_0x4a45('0x30')](_0x4a45('0x8c'),_0x3c2b45['id']);logger[_0x4a45('0x30')]('[OUTBOUND]',_0x4a45('0x8d'));emit(util['format'](_0x4a45('0x8e'),_0x273e59[_0x4a45('0x19')]),'trigger:browser:url',{'uri':_0x4a45('0x90')+_0x551fd0['host']+_0x4a45('0x91')+_0x3c2b45['id']});}})[_0x4a45('0x2d')](function(_0x3880bf){logger[_0x4a45('0x2e')](_0x4a45('0x95'),JSON[_0x4a45('0xc')](_0x3880bf));});};exports['unmanaged']=function(_0x114ea8,_0x22d16f,_0x2da534,_0x19777e,_0x4cbdcc,_0x34eae8){var _0x10c902,_0x5ee573,_0x4bc639;_0x34eae8['host']=intUtil[_0x4a45('0x80')](_0x34eae8[_0x4a45('0x7f')]);_0x34eae8[_0x4a45('0x81')]=intUtil['stripTrailingSlash'](_0x34eae8[_0x4a45('0x81')]);if(_0x4cbdcc&&_0x4cbdcc[_0x4a45('0x99')]){logger[_0x4a45('0x30')]('['+_0x22d16f[_0x4a45('0x67')]['toUpperCase']()+']',_0x4a45('0x83'));_0x22d16f[_0x4a45('0x84')]=_0x34eae8[_0x4a45('0x81')]+_0x4a45('0x85')+_0x22d16f[_0x4a45('0x86')]+_0x4a45('0x87')+md5(_0x22d16f[_0x4a45('0x86')]);}else{_0x22d16f[_0x4a45('0x84')]='';}var _0x4e47e7=_0x34eae8[_0x4a45('0x7f')]===_0x4a45('0x88')?'eu':_0x4a45('0x89');return getAccessToken(_0x34eae8)['then'](function(_0xbab4df){_0x4bc639=_0xbab4df;return getUser(_0x4bc639,_0x4e47e7,_0x34eae8);})[_0x4a45('0x2b')](function(_0xcb1c92){_0x10c902=_0xcb1c92;logger[_0x4a45('0x30')](_0x4a45('0x8a'),_0x10c902['id']);return getEndUser(_0x4bc639,_0x4e47e7,_0x34eae8,_0x22d16f[_0x4a45('0x8b')],_0x22d16f[_0x4a45('0x9a')],_0x10c902,_0x2da534);})[_0x4a45('0x2b')](function(_0x29a16d){_0x5ee573=_0x29a16d;return getCall(_0x4bc639,_0x4e47e7,_0x34eae8,_0x10c902,_0x5ee573,_0x2da534,_0x22d16f,_0x4a45('0x77'));})[_0x4a45('0x2b')](function(_0xb3b223){if(_0xb3b223){logger[_0x4a45('0x30')](_0x4a45('0x8c'),_0xb3b223['id']);}})[_0x4a45('0x2d')](function(_0x80c69e){logger[_0x4a45('0x2e')]('['+_0x22d16f['lastevent']['toUpperCase']()+']',JSON[_0x4a45('0xc')](_0x80c69e));});}; \ No newline at end of file +var _0xb81d=['uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','recordingURL','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','info','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','role','first_name','last_name','code','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','https://www.zohoapis.','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/'];(function(_0x18829e,_0x41e22c){var _0x229790=function(_0x5d7771){while(--_0x5d7771){_0x18829e['push'](_0x18829e['shift']());}};_0x229790(++_0x41e22c);}(_0xb81d,0xb4));var _0xdb81=function(_0x492012,_0x32ae87){_0x492012=_0x492012-0x0;var _0x2a75b6=_0xb81d[_0x492012];return _0x2a75b6;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xdb81('0x0'));var util=require(_0xdb81('0x1'));var intUtil=require(_0xdb81('0x2'));var moment=require('moment');var Redis=require(_0xdb81('0x3'));var BPromise=require(_0xdb81('0x4'));var config=require(_0xdb81('0x5'));var logger=require(_0xdb81('0x6'))(_0xdb81('0x7'));config[_0xdb81('0x8')]=_[_0xdb81('0x9')](config['redis'],{'host':_0xdb81('0xa'),'port':0x18eb});var io=require(_0xdb81('0xb'))(new Redis(config[_0xdb81('0x8')]));function emit(_0x24c045,_0x700360,_0x18c4f0){io['to'](_0x24c045)[_0xdb81('0xc')](_0x700360,_0x18c4f0);}function request(_0x1db3a1){logger['debug'](_0xdb81('0xd'),JSON[_0xdb81('0xe')](_0x1db3a1));return rp(_0x1db3a1);}function getCustomFields(_0x8fe01b,_0xafa4b3){var _0x5cf70d={};if(_0x8fe01b[_0xdb81('0xf')]>0x0){_[_0xdb81('0x10')](_0x8fe01b,function(_0x559076){if(_['includes']([_0xdb81('0x11'),_0xdb81('0x12')],_0x559076['type'])&&_0x559076[_0xdb81('0x13')]){_0x5cf70d[_0x559076[_0xdb81('0x13')]]=_0x559076[_0xdb81('0x14')][_0xdb81('0x15')]();}else if(_0x559076[_0xdb81('0x16')]===_0xdb81('0x17')&&_0x559076[_0xdb81('0x18')]&&_0x559076[_0xdb81('0x13')]&&_0xafa4b3[_0x559076[_0xdb81('0x18')]]){_0x5cf70d[_0x559076[_0xdb81('0x13')]]=_0xafa4b3[_0x559076[_0xdb81('0x18')]][_0xdb81('0x15')]();}else if(_0x559076[_0xdb81('0x16')]===_0xdb81('0x19')&&_0x559076[_0xdb81('0x1a')]&&_0x559076[_0xdb81('0x1a')][_0xdb81('0x1b')]&&_0x559076['idField']&&_0xafa4b3[_0x559076['Variable'][_0xdb81('0x1b')][_0xdb81('0x1c')]()]){_0x5cf70d[_0x559076[_0xdb81('0x13')]]=_0xafa4b3[_0x559076['Variable']['name'][_0xdb81('0x1c')]()][_0xdb81('0x15')]();}});}return _0x5cf70d;}function getName(_0x1ba4c2){if(_0x1ba4c2['indexOf']('\x20')>0x0){var _0x2cd492=_0x1ba4c2[_0xdb81('0x1d')](/ (.+)/);if(_0x2cd492[0x1]){return _0x2cd492;}}return[_0x1ba4c2,_0x1ba4c2];}var accountsTokens={};function getAccessToken(_0x6db7f3){return new Promise(function(_0x2be4c8,_0x12a0f7){if(!_[_0xdb81('0x1e')](accountsTokens[_0x6db7f3['id']])&&!_[_0xdb81('0x1e')](accountsTokens[_0x6db7f3['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x6db7f3['id']][_0xdb81('0x1f')])){_0x2be4c8(accountsTokens[_0x6db7f3['id']][_0xdb81('0x20')]);}}var _0x370739;switch(_0x6db7f3[_0xdb81('0x21')]){case'US':_0x370739=_0xdb81('0x22');break;case'AU':_0x370739=_0xdb81('0x23');break;case'EU':_0x370739='https://accounts.zoho.eu';break;case'IN':_0x370739=_0xdb81('0x24');break;case'CN':_0x370739=_0xdb81('0x25');break;default:_0x370739=_0xdb81('0x26');break;}var _0x1a97ba={'method':_0xdb81('0x27'),'uri':_0x370739+_0xdb81('0x28'),'qs':{'refresh_token':_0x6db7f3['refreshToken'],'client_id':_0x6db7f3[_0xdb81('0x29')],'client_secret':_0x6db7f3[_0xdb81('0x2a')],'grant_type':_0xdb81('0x2b')},'json':!![]};return rp(_0x1a97ba)[_0xdb81('0x2c')](function(_0x2568ef){accountsTokens[_0x6db7f3['id']]={'access_token':_0x2568ef[_0xdb81('0x20')],'expires_in':moment()[_0xdb81('0x2d')](_0x2568ef[_0xdb81('0x1f')],'seconds')};_0x2be4c8(_0x2568ef[_0xdb81('0x20')]);})[_0xdb81('0x2e')](function(_0x3ab95f){logger[_0xdb81('0x2f')](_0xdb81('0x30'),_0x3ab95f[_0xdb81('0x31')]);_0x12a0f7(_0x3ab95f);});});}function getUser(_0x4bdb21,_0x12b494,_0x3abf84,_0xaece3e){logger['info'](_0xdb81('0x32'));return request({'method':'GET','uri':util[_0xdb81('0x33')](_0xdb81('0x34'),_0x12b494),'qs':{'type':_0xdb81('0x35')},'headers':{'Authorization':_0xdb81('0x36')+_0x4bdb21},'json':!![]})['then'](function(_0x3de5b4){if(_0x3de5b4[_0xdb81('0x37')]){var _0x37b621=-0x1;if(_['isArrayLikeObject'](_0x3de5b4['users'])){if(!_[_0xdb81('0x1e')](_0xaece3e)){_0x37b621=_['findIndex'](_0x3de5b4['users'],function(_0x4a7f49){return _0x4a7f49['email']===_0xaece3e;});}if(_0x37b621>=0x0){logger[_0xdb81('0x38')](_0xdb81('0x39'));}else{logger[_0xdb81('0x38')](_0xdb81('0x3a'));_0x37b621=_['findIndex'](_0x3de5b4['users'],function(_0xa8d91e){return _0xa8d91e['profile'][_0xdb81('0x1b')]==='Administrator';});}return _0x3de5b4[_0xdb81('0x37')][_0x37b621];}else{if(_0x3de5b4[_0xdb81('0x3b')][_0xdb81('0x3c')][_0xdb81('0x1b')]===_0xdb81('0x3d')){logger[_0xdb81('0x38')]('Using\x20the\x20admin\x20account!');user=_0x3de5b4[_0xdb81('0x3b')];return user;}else{logger[_0xdb81('0x2f')](_0xdb81('0x3e'),JSON[_0xdb81('0xe')](_0x3de5b4));throw new Error(_0xdb81('0x3f')+JSON['stringify'](_0x3de5b4));}}}else{logger['error'](_0xdb81('0x3e'),JSON['stringify'](_0x3de5b4));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdb81('0xe')](_0x3de5b4));}})[_0xdb81('0x2e')](function(_0xc2e97d){console['error'](_0xc2e97d);});}function getZohoUser(_0x1b0c1d,_0x2c86d3){return new BPromise(function(_0xf7b59d,_0xe2a94){request(_0x1b0c1d)[_0xdb81('0x2c')](function(_0x219b85){var _0x26e73e=null;if(_0x219b85){_0x26e73e=_0x219b85[_0xdb81('0x40')][0x0];_0x26e73e[_0xdb81('0x41')]=_0x2c86d3;}_0xf7b59d(_0x26e73e);})[_0xdb81('0x2e')](function(_0x1a47d8){_0xe2a94(_0x1a47d8);});});}function createEndUser(_0x21ab45,_0x29b040,_0x52040b,_0x43fc17,_0x177538,_0x3e0e68){var _0x52040b=getName(_0x52040b);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x29b040+_0xdb81('0x42')+_['startCase'](_0x3e0e68['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x52040b[0x1],'First_Name':_0x52040b[0x0],'Phone':_0x43fc17,'Owner':{'name':!_[_0xdb81('0x1e')](_0x177538[_0xdb81('0x43')][_0xdb81('0x1b')])?_0x177538[_0xdb81('0x43')][_0xdb81('0x1b')]:!_[_0xdb81('0x1e')](_0x177538[_0xdb81('0x44')])?_0x177538[_0xdb81('0x44')]+'\x20'+_0x177538[_0xdb81('0x45')]:_0x177538['last_name'],'id':_0x177538['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x21ab45},'json':!![]})['then'](function(_0x1b6505){if(_0x1b6505&&_0x1b6505[_0xdb81('0x40')][0x0][_0xdb81('0x46')]==='SUCCESS'){var _0x3ced2b=_0x1b6505[_0xdb81('0x40')][0x0][_0xdb81('0x47')];_0x3ced2b[_0xdb81('0x41')]=_[_0xdb81('0x48')](_0x3e0e68[_0xdb81('0x49')])+'s';return _0x3ced2b;}logger[_0xdb81('0x2f')](_0xdb81('0x3e'),JSON[_0xdb81('0xe')](data));throw new Error(_0xdb81('0x4a')+JSON[_0xdb81('0xe')](data));})[_0xdb81('0x2e')](function(_0x244ef2){console[_0xdb81('0x4b')](_0xdb81('0x4c'),_0x244ef2);});}function getEndUser(_0x1ba11b,_0x3ea2c8,_0x485f01,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988){var _0x1f902b={'method':'GET','uri':'','headers':{'Authorization':_0xdb81('0x36')+_0x1ba11b},'json':!![]};switch(_0x492988[_0xdb81('0x4d')]){case'contact_lead':_0x1f902b['uri']='https://www.zohoapis.'+_0x3ea2c8+_0xdb81('0x4e')+_0xd8d451+'))';return getZohoUser(_0x1f902b,'Contacts')['then'](function(_0x4dec20){if(_0x4dec20)return _0x4dec20;_0x1f902b[_0xdb81('0x4f')]='https://www.zohoapis.'+_0x3ea2c8+_0xdb81('0x50')+_0xd8d451+'))';return getZohoUser(_0x1f902b,'Leads')['then'](function(_0x27a921){if(_0x27a921)return _0x27a921;if(_0x492988['moduleCreate']!=_0xdb81('0x51')){return createEndUser(_0x1ba11b,_0x3ea2c8,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988);}else{return{};}});});break;case _0xdb81('0x52'):_0x1f902b[_0xdb81('0x4f')]=_0xdb81('0x53')+_0x3ea2c8+_0xdb81('0x4e')+_0xd8d451+'))';return getZohoUser(_0x1f902b,_0xdb81('0x54'))[_0xdb81('0x2c')](function(_0x18e3aa){if(_0x18e3aa)return _0x18e3aa;if(_0x492988[_0xdb81('0x49')]!=_0xdb81('0x51')){return createEndUser(_0x1ba11b,_0x3ea2c8,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988);}else{return{};}});break;case _0xdb81('0x55'):_0x1f902b[_0xdb81('0x4f')]=_0xdb81('0x53')+_0x3ea2c8+_0xdb81('0x50')+_0xd8d451+'))';return getZohoUser(_0x1f902b,'Leads')['then'](function(_0x122cfc){if(_0x122cfc)return _0x122cfc;if(_0x492988['moduleCreate']!=_0xdb81('0x51')){return createEndUser(_0x1ba11b,_0x3ea2c8,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988);}else{return{};}});break;}}function getCall(_0x42c28f,_0x27bd46,_0x1f057a,_0x48572e,_0x307535,_0x41cfce,_0x2f8345,_0x14dac5){logger[_0xdb81('0x38')](_0xdb81('0x56'));var _0x181078={};_0x181078[_0xdb81('0x57')]={'name':!_[_0xdb81('0x1e')](_0x48572e[_0xdb81('0x43')][_0xdb81('0x1b')])&&!_[_0xdb81('0x1e')](_0x48572e['profile'][_0xdb81('0x1b')])&&_0x48572e['profile'][_0xdb81('0x1b')]===_0xdb81('0x58')?_0x48572e[_0xdb81('0x43')][_0xdb81('0x1b')]:!_[_0xdb81('0x1e')](_0x48572e[_0xdb81('0x44')])?_0x48572e[_0xdb81('0x44')]+'\x20'+_0x48572e[_0xdb81('0x45')]:_0x48572e[_0xdb81('0x45')],'id':_0x48572e['id']};_0x181078[_0xdb81('0x59')]=intUtil[_0xdb81('0x5a')](_0x41cfce[_0xdb81('0x5b')],_0x2f8345,'\x20');_0x181078[_0xdb81('0x5c')]=intUtil['getString'](_0x41cfce[_0xdb81('0x5d')],_0x2f8345,'\x0a');if(_0x307535[_0xdb81('0x41')]===_0xdb81('0x54')){_0x181078[_0xdb81('0x5e')]={'name':!_[_0xdb81('0x1e')](_0x307535[_0xdb81('0x5f')])?_0x307535[_0xdb81('0x5f')]:!_['isNil'](_0x307535[_0xdb81('0x60')])?_0x307535[_0xdb81('0x60')]+'\x20'+_0x307535[_0xdb81('0x61')]:_0x307535[_0xdb81('0x61')],'id':_0x307535['id']};}if(_0x307535['enduserType']==='Leads'){_0x181078['What_Id']={'name':!_[_0xdb81('0x1e')](_0x307535[_0xdb81('0x5f')])?_0x307535[_0xdb81('0x5f')]:!_['isNil'](_0x307535[_0xdb81('0x60')])?_0x307535['First_Name']+'\x20'+_0x307535['Last_Name']:_0x307535[_0xdb81('0x61')],'id':_0x307535['id']};_0x181078[_0xdb81('0x62')]=_['startCase'](_0x307535[_0xdb81('0x41')]);}if(_0x2f8345[_0xdb81('0x63')]){_0x181078[_0xdb81('0x64')]=moment[_0xdb81('0x65')](parseInt(_0x2f8345[_0xdb81('0x63')])*0x3e8)[_0xdb81('0x33')](_0xdb81('0x66'));}else if(_0x2f8345[_0xdb81('0x67')]&&_0x2f8345[_0xdb81('0x68')]){_0x181078['Call_Duration']=moment[_0xdb81('0x65')](moment(_0x2f8345[_0xdb81('0x68')],_0xdb81('0x69'))['diff'](moment(_0x2f8345[_0xdb81('0x6a')],'YYYY-MM-DDTHH:mm:ss')))[_0xdb81('0x33')](_0xdb81('0x66'));}switch(_0x2f8345[_0xdb81('0x6b')]){case _0xdb81('0x6c'):_0x181078[_0xdb81('0x6d')]=_0xdb81('0x6e');break;case _0xdb81('0x6f'):case _0xdb81('0x70'):_0x181078[_0xdb81('0x6d')]=_0xdb81('0x71');break;case _0xdb81('0x72'):_0x181078[_0xdb81('0x6d')]='Rejected';break;case _0xdb81('0x73'):_0x181078['Call_Result']='Abandoned';break;case _0xdb81('0x74'):_0x181078[_0xdb81('0x6d')]='Timeout';default:}_0x181078[_0xdb81('0x75')]=(_0x14dac5===_0xdb81('0x76')?moment(_0x2f8345[_0xdb81('0x6a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x2f8345[_0xdb81('0x77')])['format'](_0xdb81('0x69')))||moment()[_0xdb81('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x181078[_0xdb81('0x78')]=_0x14dac5||_0xdb81('0x79');_0x181078=_[_0xdb81('0x7a')](_0x181078,getCustomFields(_0x41cfce[_0xdb81('0x7b')],_0x2f8345));return request({'method':'POST','uri':_0xdb81('0x53')+_0x27bd46+_0xdb81('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x42c28f},'body':{'data':[_0x181078]},'json':!![]})[_0xdb81('0x2c')](function(_0x401aaf){if(_0x401aaf&&_0x401aaf[_0xdb81('0x40')][0x0]['code']==='SUCCESS'){logger[_0xdb81('0x38')](_0xdb81('0x7d'));return{'id':_0x401aaf[_0xdb81('0x40')][0x0][_0xdb81('0x47')]['id']};}})[_0xdb81('0x2e')](function(_0x202e1e){logger[_0xdb81('0x38')](_0xdb81('0x7e'),_0x202e1e[_0xdb81('0x31')]);console['log'](_0xdb81('0x7e'),_0x202e1e);});}exports[_0xdb81('0x7f')]=function(_0x1dac54,_0x308a71,_0x247a33,_0x1c522f,_0x54d827,_0x393924){var _0xf6aa3c,_0xd07cf0,_0x11814b;_0x393924[_0xdb81('0x80')]=intUtil[_0xdb81('0x81')](_0x393924[_0xdb81('0x80')]);_0x393924[_0xdb81('0x82')]=intUtil[_0xdb81('0x81')](_0x393924[_0xdb81('0x82')]);if(_0x54d827&&_0x54d827[_0xdb81('0x83')]){logger['info']('[QUEUE]',_0xdb81('0x84'));_0x308a71['recordingURL']=_0x393924[_0xdb81('0x82')]+_0xdb81('0x85')+_0x308a71[_0xdb81('0x86')]+_0xdb81('0x87')+md5(_0x308a71[_0xdb81('0x86')]);}else{_0x308a71['recordingURL']='';}var _0x434720=_0x393924[_0xdb81('0x80')]===_0xdb81('0x88')?'eu':_0xdb81('0x89');return getAccessToken(_0x393924)[_0xdb81('0x2c')](function(_0x590421){_0x11814b=_0x590421;return getUser(_0x11814b,_0x434720,_0x393924,_0x1c522f[_0xdb81('0x8a')]);})[_0xdb81('0x2c')](function(_0x50209f){_0xf6aa3c=_0x50209f;logger[_0xdb81('0x38')](_0xdb81('0x8b'),_0xf6aa3c['id']);return getEndUser(_0x11814b,_0x434720,_0x393924,_0x308a71[_0xdb81('0x8c')],_0x308a71[_0xdb81('0x8d')],_0xf6aa3c,_0x247a33);})[_0xdb81('0x2c')](function(_0x277912){_0xd07cf0=_0x277912;return getCall(_0x11814b,_0x434720,_0x393924,_0xf6aa3c,_0xd07cf0,_0x247a33,_0x308a71,_0xdb81('0x79'));})[_0xdb81('0x2c')](function(_0xa7a43e){if(_0xa7a43e){logger[_0xdb81('0x38')]('The\x20Call\x20ID\x20is:',_0xa7a43e['id']);logger[_0xdb81('0x38')](_0xdb81('0x8e'),_0xdb81('0x8f'));emit(util[_0xdb81('0x33')](_0xdb81('0x90'),_0x1c522f[_0xdb81('0x1b')]),_0xdb81('0x91'),{'uri':_0xdb81('0x92')+_0x393924[_0xdb81('0x80')]+_0xdb81('0x93')+_0xa7a43e['id']});}})[_0xdb81('0x2e')](function(_0x2755f3){logger['error'](_0xdb81('0x8e'),JSON[_0xdb81('0xe')](_0x2755f3));});};exports[_0xdb81('0x76')]=function(_0x1a3106,_0x2ec92d,_0x5ebe58,_0x30d6a2,_0x22afdc,_0x2316ac,_0x4fc356){var _0x119884,_0x58a658,_0x4ed924;_0x2316ac['host']=intUtil['stripTrailingSlash'](_0x2316ac[_0xdb81('0x80')]);_0x2316ac[_0xdb81('0x82')]=intUtil[_0xdb81('0x81')](_0x2316ac[_0xdb81('0x82')]);if(_0x4fc356&&_0x4fc356[_0xdb81('0x94')]&&_0x4fc356[_0xdb81('0x94')]!==_0xdb81('0x95')){logger[_0xdb81('0x38')]('[OUTBOUND]',_0xdb81('0x84'));_0x2ec92d[_0xdb81('0x96')]=_0x2316ac[_0xdb81('0x82')]+_0xdb81('0x85')+_0x2ec92d[_0xdb81('0x86')]+_0xdb81('0x87')+md5(_0x2ec92d['uniqueid']);}var _0x39ca69=_0x2316ac[_0xdb81('0x80')]===_0xdb81('0x88')?'eu':'com';return getAccessToken(_0x2316ac)['then'](function(_0x2cf56d){_0x4ed924=_0x2cf56d;return getUser(_0x4ed924,_0x39ca69,_0x2316ac,_0x30d6a2[_0xdb81('0x8a')]);})[_0xdb81('0x2c')](function(_0x39b1c1){_0x119884=_0x39b1c1;logger[_0xdb81('0x38')]('The\x20User\x20ID\x20is:',_0x119884['id']);return getEndUser(_0x4ed924,_0x39ca69,_0x2316ac,_0x2ec92d[_0xdb81('0x97')],_0x2ec92d['destcalleridnum'],_0x119884,_0x5ebe58);})['then'](function(_0x1d3959){_0x58a658=_0x1d3959;return getCall(_0x4ed924,_0x39ca69,_0x2316ac,_0x119884,_0x58a658,_0x5ebe58,_0x2ec92d,_0xdb81('0x98'));})[_0xdb81('0x2c')](function(_0x417ba1){if(_0x417ba1){logger[_0xdb81('0x38')](_0xdb81('0x99'),_0x417ba1['id']);logger[_0xdb81('0x38')]('[OUTBOUND]',_0xdb81('0x8f'));emit(util[_0xdb81('0x33')]('user:%s',_0x30d6a2[_0xdb81('0x1b')]),_0xdb81('0x91'),{'uri':_0xdb81('0x92')+_0x2316ac[_0xdb81('0x80')]+_0xdb81('0x93')+_0x417ba1['id']});}})[_0xdb81('0x2e')](function(_0x2bd1ea){logger[_0xdb81('0x2f')](_0xdb81('0x9a'),JSON[_0xdb81('0xe')](_0x2bd1ea));});};exports[_0xdb81('0x9b')]=function(_0x282b04,_0x6472dc,_0x4c7c64,_0x26ea8a,_0x14d1d4,_0x38467b){var _0x1cd03f,_0x5e1e06,_0x29c4db;_0x38467b[_0xdb81('0x80')]=intUtil['stripTrailingSlash'](_0x38467b[_0xdb81('0x80')]);_0x38467b[_0xdb81('0x82')]=intUtil[_0xdb81('0x81')](_0x38467b['serverUrl']);if(_0x14d1d4&&_0x14d1d4[_0xdb81('0x83')]){logger[_0xdb81('0x38')]('['+_0x6472dc[_0xdb81('0x6b')][_0xdb81('0x9c')]()+']',_0xdb81('0x84'));_0x6472dc[_0xdb81('0x96')]=_0x38467b[_0xdb81('0x82')]+'/api/voice/recordings/'+_0x6472dc[_0xdb81('0x86')]+_0xdb81('0x87')+md5(_0x6472dc[_0xdb81('0x86')]);}else{_0x6472dc[_0xdb81('0x96')]='';}var _0x59e910=_0x38467b['host']===_0xdb81('0x88')?'eu':'com';return getAccessToken(_0x38467b)['then'](function(_0x2eac58){_0x29c4db=_0x2eac58;return getUser(_0x29c4db,_0x59e910,_0x38467b);})[_0xdb81('0x2c')](function(_0x48aa9){_0x1cd03f=_0x48aa9;logger[_0xdb81('0x38')](_0xdb81('0x8b'),_0x1cd03f['id']);return getEndUser(_0x29c4db,_0x59e910,_0x38467b,_0x6472dc[_0xdb81('0x8c')],_0x6472dc[_0xdb81('0x8d')],_0x1cd03f,_0x4c7c64);})[_0xdb81('0x2c')](function(_0x55e37e){_0x5e1e06=_0x55e37e;return getCall(_0x29c4db,_0x59e910,_0x38467b,_0x1cd03f,_0x5e1e06,_0x4c7c64,_0x6472dc,'Inbound');})[_0xdb81('0x2c')](function(_0x341458){if(_0x341458){logger[_0xdb81('0x38')](_0xdb81('0x99'),_0x341458['id']);}})[_0xdb81('0x2e')](function(_0x511e21){logger[_0xdb81('0x2f')]('['+_0x6472dc['lastevent'][_0xdb81('0x9c')]()+']',JSON[_0xdb81('0xe')](_0x511e21));});}; \ 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 81dd79e..ad6ebd3 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 _0x8fd4=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format'];(function(_0x5c17bf,_0x2f158a){var _0x5af015=function(_0x47546f){while(--_0x47546f){_0x5c17bf['push'](_0x5c17bf['shift']());}};_0x5af015(++_0x2f158a);}(_0x8fd4,0xd5));var _0x48fd=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x8fd4[_0x556927];return _0x5f1235;};'use strict';var util=require(_0x48fd('0x0'));var sh=require(_0x48fd('0x1'));var Mustache=require(_0x48fd('0x2'));var logger=require(_0x48fd('0x3'))(_0x48fd('0x4'));exports[_0x48fd('0x5')]=function(_0x247760,_0x8ed298){var _0x26a051=_0x247760[_0x48fd('0x6')]?_0x247760['data2']:_0x48fd('0x7');var _0x2238f1=_0x247760[_0x48fd('0x8')]?Mustache['render'](_0x247760[_0x48fd('0x8')],_0x8ed298):_0x8ed298;sh[_0x48fd('0x5')](_0x2238f1,function(_0x50f0a5,_0x1c13b7,_0x463e2b){if(_0x50f0a5!==0x0){logger[_0x48fd('0x9')](util[_0x48fd('0xa')](_0x48fd('0xb'),_0x26a051,_0x2238f1,_0x50f0a5,_0x463e2b));}else{logger[_0x48fd('0xc')](util[_0x48fd('0xa')](_0x48fd('0xd'),_0x26a051,_0x2238f1,_0x1c13b7));}});}; \ No newline at end of file +var _0xcdc7=['exec','data2','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','trigger'];(function(_0x3150aa,_0x2f0ca3){var _0x10dfb1=function(_0x4d52b0){while(--_0x4d52b0){_0x3150aa['push'](_0x3150aa['shift']());}};_0x10dfb1(++_0x2f0ca3);}(_0xcdc7,0xf7));var _0x7cdc=function(_0x568def,_0x1b6b0b){_0x568def=_0x568def-0x0;var _0x3bd175=_0xcdc7[_0x568def];return _0x3bd175;};'use strict';var util=require(_0x7cdc('0x0'));var sh=require(_0x7cdc('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x7cdc('0x2'));exports[_0x7cdc('0x3')]=function(_0x857d17,_0x5e4048){var _0x4786a7=_0x857d17[_0x7cdc('0x4')]?_0x857d17[_0x7cdc('0x4')]:'Script';var _0x18c97e=_0x857d17[_0x7cdc('0x5')]?Mustache[_0x7cdc('0x6')](_0x857d17[_0x7cdc('0x5')],_0x5e4048):_0x5e4048;sh['exec'](_0x18c97e,function(_0x23d215,_0x119889,_0x39953c){if(_0x23d215!==0x0){logger['error'](util[_0x7cdc('0x7')](_0x7cdc('0x8'),_0x4786a7,_0x18c97e,_0x23d215,_0x39953c));}else{logger[_0x7cdc('0x9')](util[_0x7cdc('0x7')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4786a7,_0x18c97e,_0x119889));}});}; \ 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 98c51a5..c4e2922 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 _0xcaaf=['parse','render','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','data6','error','stack','GET','DELETE','POST','PUT','data7'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xcaaf,0x15e));var _0xfcaa=function(_0x3c67c2,_0x4a3c23){_0x3c67c2=_0x3c67c2-0x0;var _0x44bfee=_0xcaaf[_0x3c67c2];return _0x44bfee;};'use strict';var rp=require(_0xfcaa('0x0'));var util=require(_0xfcaa('0x1'));var _=require(_0xfcaa('0x2'));var Mustache=require(_0xfcaa('0x3'));var logger=require(_0xfcaa('0x4'))(_0xfcaa('0x5'));exports[_0xfcaa('0x6')]=function(_0x38d0dc,_0x1d2657){var _0x23834b,_0x7c497b;var _0x102fb5={'method':_0x38d0dc[_0xfcaa('0x7')][_0xfcaa('0x8')](),'uri':Mustache['render'](_0x38d0dc[_0xfcaa('0x9')],_0x1d2657),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x38d0dc[_0xfcaa('0xa')])===_0xfcaa('0xb')&&parseInt(_0x38d0dc[_0xfcaa('0xa')])>=0x1&&parseInt(_0x38d0dc[_0xfcaa('0xa')])<=0xa?parseInt(_0x38d0dc[_0xfcaa('0xa')])*0x3e8:0x5*0x3e8};try{_0x102fb5['headers']=_0x38d0dc['data6']?JSON['parse'](Mustache['render'](_0x38d0dc[_0xfcaa('0xc')],_0x1d2657)):{};}catch(_0x3c7b53){logger[_0xfcaa('0xd')](_0x3c7b53[_0xfcaa('0xe')]);}switch(_0x38d0dc['data1'][_0xfcaa('0x8')]()){case _0xfcaa('0xf'):case _0xfcaa('0x10'):_0x23834b=null;_0x102fb5['qs']=_0x1d2657;break;case _0xfcaa('0x11'):case _0xfcaa('0x12'):if(_0x38d0dc[_0xfcaa('0x13')]){try{_0x23834b=JSON[_0xfcaa('0x14')](Mustache[_0xfcaa('0x15')](_0x38d0dc[_0xfcaa('0x13')],_0x1d2657));_0x102fb5[_0xfcaa('0x16')]=_0x23834b;}catch(_0x4f63dd){logger[_0xfcaa('0xd')](_0x4f63dd['stack']);logger[_0xfcaa('0xd')](_0xfcaa('0x17'));}}else{_0x23834b=_0x1d2657;_0x102fb5[_0xfcaa('0x16')]=_0x23834b;}break;}logger[_0xfcaa('0x18')](util[_0xfcaa('0x19')](_0xfcaa('0x1a'),_0x38d0dc[_0xfcaa('0x7')],_0x38d0dc[_0xfcaa('0x9')],JSON[_0xfcaa('0x1b')](_0x102fb5)));rp(_0x102fb5)[_0xfcaa('0x1c')](function(_0x2ee03c){_0x23834b=!_[_0xfcaa('0x1d')](_0x23834b)?_0xfcaa('0x1e')+_0x23834b:'';_0x7c497b=typeof _0x2ee03c['body']===_0xfcaa('0x1f')?JSON[_0xfcaa('0x1b')](_0x2ee03c[_0xfcaa('0x16')]):_0x2ee03c['body'];logger[_0xfcaa('0x18')](util[_0xfcaa('0x19')](_0xfcaa('0x20'),_0x38d0dc['data1'],_0x38d0dc[_0xfcaa('0x9')],_0x2ee03c[_0xfcaa('0x21')],_0x7c497b));})[_0xfcaa('0x22')](function(_0x1a4cab){logger[_0xfcaa('0xd')](util[_0xfcaa('0x19')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x38d0dc[_0xfcaa('0x7')],_0x38d0dc[_0xfcaa('0x9')],_0x1a4cab['statusCode'],_0x1a4cab[_0xfcaa('0x23')],_0x1a4cab[_0xfcaa('0x24')]));});}; \ No newline at end of file +var _0x7754=['data5','number','parse','data6','stack','GET','DELETE','POST','PUT','data7','error','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render'];(function(_0x951ed6,_0x297ba1){var _0x132a4d=function(_0x2b6be5){while(--_0x2b6be5){_0x951ed6['push'](_0x951ed6['shift']());}};_0x132a4d(++_0x297ba1);}(_0x7754,0xd8));var _0x4775=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x7754[_0x280ae7];return _0x418b9e;};'use strict';var rp=require('request-promise');var util=require(_0x4775('0x0'));var _=require(_0x4775('0x1'));var Mustache=require(_0x4775('0x2'));var logger=require(_0x4775('0x3'))(_0x4775('0x4'));exports['exec']=function(_0x28249e,_0x51985b){var _0x2beeb1,_0x1657fc;var _0x2eef3a={'method':_0x28249e[_0x4775('0x5')][_0x4775('0x6')](),'uri':Mustache[_0x4775('0x7')](_0x28249e['data2'],_0x51985b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x28249e[_0x4775('0x8')])===_0x4775('0x9')&&parseInt(_0x28249e[_0x4775('0x8')])>=0x1&&parseInt(_0x28249e['data5'])<=0xa?parseInt(_0x28249e['data5'])*0x3e8:0x5*0x3e8};try{_0x2eef3a['headers']=_0x28249e['data6']?JSON[_0x4775('0xa')](Mustache[_0x4775('0x7')](_0x28249e[_0x4775('0xb')],_0x51985b)):{};}catch(_0x18dbdd){logger['error'](_0x18dbdd[_0x4775('0xc')]);}switch(_0x28249e[_0x4775('0x5')][_0x4775('0x6')]()){case _0x4775('0xd'):case _0x4775('0xe'):_0x2beeb1=null;_0x2eef3a['qs']=_0x51985b;break;case _0x4775('0xf'):case _0x4775('0x10'):if(_0x28249e['data7']){try{_0x2beeb1=JSON['parse'](Mustache[_0x4775('0x7')](_0x28249e[_0x4775('0x11')],_0x51985b));_0x2eef3a['body']=_0x2beeb1;}catch(_0x426a5b){logger[_0x4775('0x12')](_0x426a5b[_0x4775('0xc')]);logger[_0x4775('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2beeb1=_0x51985b;_0x2eef3a[_0x4775('0x13')]=_0x2beeb1;}break;}logger[_0x4775('0x14')](util[_0x4775('0x15')](_0x4775('0x16'),_0x28249e[_0x4775('0x5')],_0x28249e[_0x4775('0x17')],JSON[_0x4775('0x18')](_0x2eef3a)));rp(_0x2eef3a)[_0x4775('0x19')](function(_0x10b9b0){_0x2beeb1=!_['isNil'](_0x2beeb1)?',\x20request\x20body:\x20'+_0x2beeb1:'';_0x1657fc=typeof _0x10b9b0[_0x4775('0x13')]===_0x4775('0x1a')?JSON[_0x4775('0x18')](_0x10b9b0[_0x4775('0x13')]):_0x10b9b0[_0x4775('0x13')];logger[_0x4775('0x14')](util['format'](_0x4775('0x1b'),_0x28249e[_0x4775('0x5')],_0x28249e['data2'],_0x10b9b0[_0x4775('0x1c')],_0x1657fc));})[_0x4775('0x1d')](function(_0xe8ad8f){logger[_0x4775('0x12')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x28249e[_0x4775('0x5')],_0x28249e['data2'],_0xe8ad8f[_0x4775('0x1c')],_0xe8ad8f[_0x4775('0x1e')],_0xe8ad8f[_0x4775('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8c5cdad..62b5bdf 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 _0x7bd8=['exports','jayson/promise','../../config/logger','routing','Request','request','then','debug','rpc','error','message','result'];(function(_0x37d4fa,_0x472a77){var _0x350c6d=function(_0x1dcbe3){while(--_0x1dcbe3){_0x37d4fa['push'](_0x37d4fa['shift']());}};_0x350c6d(++_0x472a77);}(_0x7bd8,0x6d));var _0x87bd=function(_0x3582cf,_0x355f82){_0x3582cf=_0x3582cf-0x0;var _0x1f0f87=_0x7bd8[_0x3582cf];return _0x1f0f87;};'use strict';var jayson=require(_0x87bd('0x0'));var BPromise=require('bluebird');var logger=require(_0x87bd('0x1'))(_0x87bd('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0x87bd('0x3')]=function(_0x44b03e,_0x36792b){return new BPromise(function(_0x23da3e,_0x4b135b){return client[_0x87bd('0x4')](_0x44b03e,_0x36792b)[_0x87bd('0x5')](function(_0x138524){logger[_0x87bd('0x6')](_0x87bd('0x7'),_0x87bd('0x2'),_0x44b03e,_0x36792b,_0x138524);if(_0x138524['error']){logger[_0x87bd('0x8')](_0x87bd('0x7'),_0x87bd('0x2'),_0x44b03e,_0x138524[_0x87bd('0x8')][_0x87bd('0x9')],_0x36792b);return _0x4b135b(_0x138524[_0x87bd('0x8')][_0x87bd('0x9')]);}else{return _0x23da3e(_0x138524[_0x87bd('0xa')]);}})['catch'](function(_0x671ae9){logger['error'](_0x87bd('0x7'),_0x87bd('0x2'),_0x44b03e,_0x671ae9,_0x36792b);return _0x4b135b(_0x671ae9);});});};module[_0x87bd('0xb')]=client; \ No newline at end of file +var _0x1297=['result','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x1297,0x140));var _0x7129=function(_0x313dd5,_0x3912b9){_0x313dd5=_0x313dd5-0x0;var _0x307883=_0x1297[_0x313dd5];return _0x307883;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x7129('0x0'))(_0x7129('0x1'));var client=jayson[_0x7129('0x2')][_0x7129('0x3')]({'port':0x2329});client[_0x7129('0x4')]=function(_0x290b81,_0x4f5532){return new BPromise(function(_0x229598,_0x50f113){return client[_0x7129('0x5')](_0x290b81,_0x4f5532)['then'](function(_0x3b0df9){logger[_0x7129('0x6')](_0x7129('0x7'),_0x7129('0x1'),_0x290b81,_0x4f5532,_0x3b0df9);if(_0x3b0df9[_0x7129('0x8')]){logger[_0x7129('0x8')]('rpc',_0x7129('0x1'),_0x290b81,_0x3b0df9[_0x7129('0x8')][_0x7129('0x9')],_0x4f5532);return _0x50f113(_0x3b0df9[_0x7129('0x8')][_0x7129('0x9')]);}else{return _0x229598(_0x3b0df9[_0x7129('0xa')]);}})['catch'](function(_0x2e4169){logger[_0x7129('0x8')](_0x7129('0x7'),_0x7129('0x1'),_0x290b81,_0x2e4169,_0x4f5532);return _0x50f113(_0x2e4169);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 40c8e8e..fcdbf36 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 _0x8de8=['./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x8de8,0x18f));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var server=require(_0x88de('0x0'));var Realtime=require(_0x88de('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x88de('0x2'));var setting=require(_0x88de('0x3'));var logger=require(_0x88de('0x4'))(_0x88de('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x88de('0x6')]()[_0x88de('0x7')](mailAccount[_0x88de('0x8')]())[_0x88de('0x7')](realtime[_0x88de('0x9')]())[_0x88de('0x7')](function(){email['refresh'](realtime[_0x88de('0xa')]);return realtime;});}function main(){return server[_0x88de('0xb')](realtime,email)[_0x88de('0x7')](function(){return initRealtime();})[_0x88de('0x7')](function(){return setting['getSettings']();})[_0x88de('0x7')](function(_0x5ddb9a){return setInterval(initRealtime,_0x5ddb9a[_0x88de('0xc')]*0x3e8);})[_0x88de('0xd')](function(_0x5b6801){logger[_0x88de('0xe')](_0x88de('0xf'),_0x5b6801);});}main(); \ No newline at end of file +var _0x67dc=['initMailAccounts','refresh','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts'];(function(_0x4c5f6e,_0x32d3de){var _0x510e53=function(_0x64cc75){while(--_0x64cc75){_0x4c5f6e['push'](_0x4c5f6e['shift']());}};_0x510e53(++_0x32d3de);}(_0x67dc,0x172));var _0xc67d=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x67dc[_0x1793de];return _0x4f0309;};'use strict';var server=require(_0xc67d('0x0'));var Realtime=require(_0xc67d('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc67d('0x2'));var setting=require(_0xc67d('0x3'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc67d('0x4')]()[_0xc67d('0x5')](mailAccount[_0xc67d('0x6')]())[_0xc67d('0x5')](realtime[_0xc67d('0x7')]())[_0xc67d('0x5')](function(){email[_0xc67d('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc67d('0x5')](function(){return initRealtime();})[_0xc67d('0x5')](function(){return setting[_0xc67d('0x9')]();})[_0xc67d('0x5')](function(_0x408172){return setInterval(initRealtime,_0x408172[_0xc67d('0xa')]*0x3e8);})['catch'](function(_0x22daa7){logger[_0xc67d('0xb')](_0xc67d('0xc'),_0x22daa7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9bdfde3..23e9464 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 _0x63ca=['messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','verify','exports','lodash','moment','ioredis','../../../config/environment','email','redis','defaults','socket.io-emitter','./imap','./smtp','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','box','handleImapEmail','end','handleImapEnd','error','bind','disabled','messageStatus','handleImapBox'];(function(_0x38e901,_0x19814e){var _0x1366dc=function(_0x4c5a4f){while(--_0x4c5a4f){_0x38e901['push'](_0x38e901['shift']());}};_0x1366dc(++_0x19814e);}(_0x63ca,0x154));var _0xa63c=function(_0x3cff07,_0x30f413){_0x3cff07=_0x3cff07-0x0;var _0x468e93=_0x63ca[_0x3cff07];return _0x468e93;};'use strict';var _=require(_0xa63c('0x0'));var moment=require(_0xa63c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xa63c('0x2'));var config=require(_0xa63c('0x3'));var logger=require('../../../config/logger')(_0xa63c('0x4'));config[_0xa63c('0x5')]=_[_0xa63c('0x6')](config[_0xa63c('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xa63c('0x7'))(new Redis(config[_0xa63c('0x5')]));var EmailImap=require(_0xa63c('0x8'));var EmailSmtp=require(_0xa63c('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5637b2){logger['info']('start\x20email\x20channel');this[_0xa63c('0xa')]=_0x5637b2[_0xa63c('0xa')];this[_0xa63c('0xb')]={};this[_0xa63c('0xc')]=new EmailSmtp();}EmailChannel[_0xa63c('0xd')][_0xa63c('0xe')]=function(_0xe4bc6b){var _0x29ac96=this[_0xa63c('0xa')][_0xe4bc6b];var _0x1786c3={'id':_0x29ac96['id'],'name':_0x29ac96[_0xa63c('0xf')],'key':_0x29ac96[_0xa63c('0x10')],'active':_0x29ac96[_0xa63c('0x11')],'Imap':{'status':_0x29ac96[_0xa63c('0x12')][_0xa63c('0x13')],'messageStatus':_0x29ac96['Imap']['messageStatus'],'total':_0x29ac96[_0xa63c('0x12')][_0xa63c('0x14')]}};if(_[_0xa63c('0x15')](md5Accounts[_0xe4bc6b])){md5Accounts[_0xe4bc6b]={};}var _0x534e49=md5(JSON[_0xa63c('0x16')](_0x1786c3));if(md5Accounts[_0xe4bc6b][_0xa63c('0x17')]!==_0x534e49){md5Accounts[_0xe4bc6b][_0xa63c('0x17')]=_0x534e49;io[_0xa63c('0xe')](_0xa63c('0x18'),_0x1786c3);}};EmailChannel[_0xa63c('0xd')][_0xa63c('0x19')]=function(_0x9404d5){for(var _0x20829f in _0x9404d5){if(_0x9404d5[_0xa63c('0x1a')](_0x20829f)){if(_0x9404d5[_0x20829f]['Imap']&&_0x9404d5[_0x20829f][_0xa63c('0x11')]){var _0x120cba=_0x9404d5[_0x20829f][_0xa63c('0x12')];if(!_0x120cba[_0xa63c('0x1b')]&&_0x9404d5[_0x20829f][_0xa63c('0x1c')]!=='custom')_0x120cba[_0xa63c('0x1b')]=_0x9404d5[_0x20829f][_0xa63c('0x1c')];if(!this[_0xa63c('0xb')][_0xa63c('0x1a')](_0x120cba['id'])){this['imapAccounts'][_0x120cba['id']]=new EmailImap(_0x120cba,_0x9404d5[_0x20829f][_0xa63c('0x4')]);this[_0xa63c('0xb')][_0x120cba['id']]['on'](_0xa63c('0x1d'),this['handleImapBox']['bind'](this,_0x20829f));this[_0xa63c('0xb')][_0x120cba['id']]['on'](_0xa63c('0x4'),this[_0xa63c('0x1e')]['bind'](this,_0x20829f));this[_0xa63c('0xb')][_0x120cba['id']]['on'](_0xa63c('0x1f'),this[_0xa63c('0x20')]['bind'](this,_0x20829f));this[_0xa63c('0xb')][_0x120cba['id']]['on'](_0xa63c('0x21'),this['handleImapError'][_0xa63c('0x22')](this,_0x20829f));}}else{if(_['isNil'](this[_0xa63c('0xa')][_0x20829f][_0xa63c('0x12')])){this[_0xa63c('0xa')][_0x20829f][_0xa63c('0x12')]={};}this[_0xa63c('0xa')][_0x20829f]['Imap'][_0xa63c('0x13')]=_0xa63c('0x23');this['mailAccounts'][_0x20829f][_0xa63c('0x12')][_0xa63c('0x24')]='';this[_0xa63c('0xe')](_0x20829f);}}}};EmailChannel[_0xa63c('0xd')][_0xa63c('0x25')]=function(_0x19727b,_0x1c5e82){if(this[_0xa63c('0xa')][_0x19727b]){this[_0xa63c('0xa')][_0x19727b][_0xa63c('0x12')]['status']='connected';this[_0xa63c('0xa')][_0x19727b]['Imap'][_0xa63c('0x24')]=_0x1c5e82[_0xa63c('0xf')];if(_0x1c5e82[_0xa63c('0x26')]){this[_0xa63c('0xa')][_0x19727b][_0xa63c('0x12')][_0xa63c('0x14')]=_0x1c5e82[_0xa63c('0x26')][_0xa63c('0x14')];}return this['emit'](_0x19727b);}};EmailChannel[_0xa63c('0xd')]['handleImapEmail']=function(_0x253723,_0xee41c3){logger[_0xa63c('0x27')](_0xa63c('0x28'),_0xee41c3['firstName'],_0xee41c3['lastName'],_0xee41c3[_0xa63c('0x29')],_0x253723);if(this[_0xa63c('0xa')][_0x253723]){return mailAccount['notify'](_0x253723,_0xee41c3)[_0xa63c('0x2a')](function(_0x4c02ad){if(_0x4c02ad){logger[_0xa63c('0x27')](_0xa63c('0x2b'));}})[_0xa63c('0x2c')](function(_0x505e18){logger[_0xa63c('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xa63c('0x16')](_0x505e18));});}};EmailChannel[_0xa63c('0xd')][_0xa63c('0x20')]=function(_0x24f771){if(this[_0xa63c('0xa')][_0x24f771]&&this[_0xa63c('0xa')][_0x24f771][_0xa63c('0x12')]){if(this[_0xa63c('0xb')][this['mailAccounts'][_0x24f771]['Imap']['id']]){delete this['imapAccounts'][this[_0xa63c('0xa')][_0x24f771][_0xa63c('0x12')]['id']];}this[_0xa63c('0xa')][_0x24f771][_0xa63c('0x12')][_0xa63c('0x2d')]=moment();this['emit'](_0x24f771);}};EmailChannel[_0xa63c('0xd')][_0xa63c('0x2e')]=function(_0x500dba,_0x281009){if(this[_0xa63c('0xa')][_0x500dba]){this['mailAccounts'][_0x500dba][_0xa63c('0x12')][_0xa63c('0x13')]=_0xa63c('0x21');this['mailAccounts'][_0x500dba][_0xa63c('0x12')][_0xa63c('0x24')]=_0x281009;return this[_0xa63c('0xe')](_0x500dba);}};EmailChannel[_0xa63c('0xd')][_0xa63c('0x2f')]=function(_0x448091,_0xf95b95){return this[_0xa63c('0xc')][_0xa63c('0x30')](_0x448091,_0xf95b95);};EmailChannel[_0xa63c('0xd')][_0xa63c('0x31')]=function(_0x1896bb){var _0x42f1f3=this;if(this[_0xa63c('0xa')][_0x1896bb['id']]){if(_['isNil'](this[_0xa63c('0xa')][_0x1896bb['id']][_0xa63c('0x32')])){this[_0xa63c('0xa')][_0x1896bb['id']][_0xa63c('0x32')]={};}this[_0xa63c('0xa')][_0x1896bb['id']]['Smtp'][_0xa63c('0x2d')]=moment();return new BPromise(function(_0x22907b,_0x4abc5c){return _0x42f1f3[_0xa63c('0xc')]['verify'](_0x1896bb)[_0xa63c('0x2a')](function(_0x4a5f5b){_0x42f1f3[_0xa63c('0xa')][_0x1896bb['id']][_0xa63c('0x32')]['status']=_0xa63c('0x33');_0x42f1f3[_0xa63c('0xa')][_0x1896bb['id']]['Smtp'][_0xa63c('0x24')]='';_0x42f1f3['emit'](_0x1896bb['id']);_0x22907b(_0x4a5f5b);})['catch'](function(_0x12bc89){_0x42f1f3[_0xa63c('0xa')][_0x1896bb['id']][_0xa63c('0x32')][_0xa63c('0x13')]=_0xa63c('0x21');_0x42f1f3[_0xa63c('0xa')][_0x1896bb['id']][_0xa63c('0x32')][_0xa63c('0x24')]=_0x12bc89;_0x42f1f3['emit'](_0x1896bb['id']);_0x4abc5c(_0x12bc89);});});}return this[_0xa63c('0xc')][_0xa63c('0x34')](_0x1896bb);};module[_0xa63c('0x35')]=EmailChannel; \ No newline at end of file +var _0x9f25=['verifySmtp','Smtp','verified','verify','exports','lodash','moment','bluebird','ioredis','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','mailAccount:update','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','handleImapEnd','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','smtp','send'];(function(_0x42c069,_0xdfa0f9){var _0x4f0740=function(_0x4c9fd9){while(--_0x4c9fd9){_0x42c069['push'](_0x42c069['shift']());}};_0x4f0740(++_0xdfa0f9);}(_0x9f25,0x1a2));var _0x59f2=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x9f25[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0x59f2('0x0'));var moment=require(_0x59f2('0x1'));var BPromise=require(_0x59f2('0x2'));var md5=require('md5');var Redis=require(_0x59f2('0x3'));var config=require('../../../config/environment');var logger=require(_0x59f2('0x4'))(_0x59f2('0x5'));config[_0x59f2('0x6')]=_['defaults'](config[_0x59f2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x59f2('0x7'))(new Redis(config[_0x59f2('0x6')]));var EmailImap=require(_0x59f2('0x8'));var EmailSmtp=require(_0x59f2('0x9'));var mailAccount=require(_0x59f2('0xa'));var md5Accounts={};function EmailChannel(_0x1ab9a3){logger['info'](_0x59f2('0xb'));this[_0x59f2('0xc')]=_0x1ab9a3[_0x59f2('0xc')];this[_0x59f2('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x59f2('0xe')][_0x59f2('0xf')]=function(_0x3f93ec){var _0x35673a=this['mailAccounts'][_0x3f93ec];var _0x45badf={'id':_0x35673a['id'],'name':_0x35673a[_0x59f2('0x10')],'key':_0x35673a[_0x59f2('0x11')],'active':_0x35673a[_0x59f2('0x12')],'Imap':{'status':_0x35673a[_0x59f2('0x13')][_0x59f2('0x14')],'messageStatus':_0x35673a[_0x59f2('0x13')][_0x59f2('0x15')],'total':_0x35673a[_0x59f2('0x13')][_0x59f2('0x16')]}};if(_[_0x59f2('0x17')](md5Accounts[_0x3f93ec])){md5Accounts[_0x3f93ec]={};}var _0x477c59=md5(JSON[_0x59f2('0x18')](_0x45badf));if(md5Accounts[_0x3f93ec]['md5']!==_0x477c59){md5Accounts[_0x3f93ec][_0x59f2('0x19')]=_0x477c59;io[_0x59f2('0xf')](_0x59f2('0x1a'),_0x45badf);}};EmailChannel[_0x59f2('0xe')]['refresh']=function(_0xbed1dc){for(var _0x1c9df1 in _0xbed1dc){if(_0xbed1dc[_0x59f2('0x1b')](_0x1c9df1)){if(_0xbed1dc[_0x1c9df1][_0x59f2('0x13')]&&_0xbed1dc[_0x1c9df1][_0x59f2('0x12')]){var _0x507cee=_0xbed1dc[_0x1c9df1]['Imap'];if(!_0x507cee[_0x59f2('0x1c')]&&_0xbed1dc[_0x1c9df1][_0x59f2('0x1d')]!==_0x59f2('0x1e'))_0x507cee['service']=_0xbed1dc[_0x1c9df1][_0x59f2('0x1d')];if(!this[_0x59f2('0xd')][_0x59f2('0x1b')](_0x507cee['id'])){this[_0x59f2('0xd')][_0x507cee['id']]=new EmailImap(_0x507cee,_0xbed1dc[_0x1c9df1]['email']);this[_0x59f2('0xd')][_0x507cee['id']]['on'](_0x59f2('0x1f'),this[_0x59f2('0x20')]['bind'](this,_0x1c9df1));this[_0x59f2('0xd')][_0x507cee['id']]['on'](_0x59f2('0x5'),this[_0x59f2('0x21')][_0x59f2('0x22')](this,_0x1c9df1));this[_0x59f2('0xd')][_0x507cee['id']]['on']('end',this[_0x59f2('0x23')][_0x59f2('0x22')](this,_0x1c9df1));this[_0x59f2('0xd')][_0x507cee['id']]['on']('error',this['handleImapError'][_0x59f2('0x22')](this,_0x1c9df1));}}else{if(_[_0x59f2('0x17')](this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')])){this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')]={};}this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')][_0x59f2('0x14')]=_0x59f2('0x24');this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')][_0x59f2('0x15')]='';this['emit'](_0x1c9df1);}}}};EmailChannel[_0x59f2('0xe')]['handleImapBox']=function(_0x12e8b8,_0x5dfe37){if(this['mailAccounts'][_0x12e8b8]){this[_0x59f2('0xc')][_0x12e8b8][_0x59f2('0x13')][_0x59f2('0x14')]='connected';this[_0x59f2('0xc')][_0x12e8b8][_0x59f2('0x13')][_0x59f2('0x15')]=_0x5dfe37[_0x59f2('0x10')];if(_0x5dfe37[_0x59f2('0x25')]){this[_0x59f2('0xc')][_0x12e8b8]['Imap']['total']=_0x5dfe37[_0x59f2('0x25')][_0x59f2('0x16')];}return this['emit'](_0x12e8b8);}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x21')]=function(_0x253917,_0x1f8581){logger['info'](_0x59f2('0x26'),_0x1f8581[_0x59f2('0x27')],_0x1f8581[_0x59f2('0x28')],_0x1f8581[_0x59f2('0x29')],_0x253917);if(this[_0x59f2('0xc')][_0x253917]){return mailAccount[_0x59f2('0x2a')](_0x253917,_0x1f8581)[_0x59f2('0x2b')](function(_0x4231e9){if(_0x4231e9){logger[_0x59f2('0x2c')](_0x59f2('0x2d'));}})[_0x59f2('0x2e')](function(_0x2ddfe9){logger[_0x59f2('0x2f')](_0x59f2('0x30'),JSON[_0x59f2('0x18')](_0x2ddfe9));});}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x23')]=function(_0x4e42a2){if(this[_0x59f2('0xc')][_0x4e42a2]&&this[_0x59f2('0xc')][_0x4e42a2]['Imap']){if(this['imapAccounts'][this[_0x59f2('0xc')][_0x4e42a2]['Imap']['id']]){delete this['imapAccounts'][this[_0x59f2('0xc')][_0x4e42a2][_0x59f2('0x13')]['id']];}this[_0x59f2('0xc')][_0x4e42a2]['Imap'][_0x59f2('0x31')]=moment();this[_0x59f2('0xf')](_0x4e42a2);}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x32')]=function(_0x5e3f75,_0x1228d6){if(this[_0x59f2('0xc')][_0x5e3f75]){this[_0x59f2('0xc')][_0x5e3f75]['Imap'][_0x59f2('0x14')]=_0x59f2('0x2f');this[_0x59f2('0xc')][_0x5e3f75][_0x59f2('0x13')][_0x59f2('0x15')]=_0x1228d6;return this[_0x59f2('0xf')](_0x5e3f75);}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x33')]=function(_0x391028,_0x4c860b){return this[_0x59f2('0x34')][_0x59f2('0x35')](_0x391028,_0x4c860b);};EmailChannel['prototype'][_0x59f2('0x36')]=function(_0x2776c3){var _0x4dc206=this;if(this['mailAccounts'][_0x2776c3['id']]){if(_[_0x59f2('0x17')](this[_0x59f2('0xc')][_0x2776c3['id']]['Smtp'])){this['mailAccounts'][_0x2776c3['id']][_0x59f2('0x37')]={};}this[_0x59f2('0xc')][_0x2776c3['id']][_0x59f2('0x37')][_0x59f2('0x31')]=moment();return new BPromise(function(_0x53afeb,_0x746f6e){return _0x4dc206['smtp']['verify'](_0x2776c3)[_0x59f2('0x2b')](function(_0xe49979){_0x4dc206[_0x59f2('0xc')][_0x2776c3['id']]['Smtp']['status']=_0x59f2('0x38');_0x4dc206[_0x59f2('0xc')][_0x2776c3['id']][_0x59f2('0x37')]['messageStatus']='';_0x4dc206[_0x59f2('0xf')](_0x2776c3['id']);_0x53afeb(_0xe49979);})[_0x59f2('0x2e')](function(_0x48cbfd){_0x4dc206['mailAccounts'][_0x2776c3['id']][_0x59f2('0x37')]['status']=_0x59f2('0x2f');_0x4dc206[_0x59f2('0xc')][_0x2776c3['id']][_0x59f2('0x37')]['messageStatus']=_0x48cbfd;_0x4dc206[_0x59f2('0xf')](_0x2776c3['id']);_0x746f6e(_0x48cbfd);});});}return this[_0x59f2('0x34')][_0x59f2('0x39')](_0x2776c3);};module[_0x59f2('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d177433..6ddc4b7 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 _0x134b=['handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','email','handleFetchEnd','account','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','getAccount','once','ready'];(function(_0x17cca1,_0x4cd1f6){var _0x2a1d4a=function(_0x33c8a1){while(--_0x33c8a1){_0x17cca1['push'](_0x17cca1['shift']());}};_0x2a1d4a(++_0x4cd1f6);}(_0x134b,0x173));var _0xb134=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x134b[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0xb134('0x0'));var Imap=require(_0xb134('0x1'));var simpleParser=require(_0xb134('0x2'))[_0xb134('0x3')];var Iconv=require(_0xb134('0x4'))[_0xb134('0x5')];var EventEmitter=require(_0xb134('0x6'))[_0xb134('0x7')];var utils=require('./utils');var logger=require(_0xb134('0x8'))('email');function EmailImap(_0x1d94d7,_0x6810fc){this[_0xb134('0x9')]=_0x1d94d7[_0xb134('0x9')];this['account']=this[_0xb134('0xa')](_0x1d94d7,_0x6810fc);this['imap']=new Imap(this['account']);this[_0xb134('0x1')][_0xb134('0xb')](_0xb134('0xc'),this[_0xb134('0xd')][_0xb134('0xe')](this));this[_0xb134('0x1')][_0xb134('0xb')](_0xb134('0xf'),this[_0xb134('0x10')][_0xb134('0xe')](this));this[_0xb134('0x1')]['on'](_0xb134('0x11'),this[_0xb134('0x12')][_0xb134('0xe')](this));this[_0xb134('0x1')][_0xb134('0x13')]();}util[_0xb134('0x14')](EmailImap,EventEmitter);EmailImap[_0xb134('0x15')]['getAccount']=function(_0x16dd42,_0x2033e4){var _0x2cce02={'connTimeout':_0x16dd42['connTimeout']?_0x16dd42[_0xb134('0x16')]*0x3e8:0x2710,'authTimeout':_0x16dd42['authTimeout']?_0x16dd42[_0xb134('0x17')]*0x3e8:0x1388};if(_0x16dd42[_0xb134('0x18')]){_0x2cce02['user']=_0x16dd42[_0xb134('0x19')];if(_0x16dd42['modernAuthentication']){_0x2cce02[_0xb134('0x1a')]=utils[_0xb134('0x1b')](_0x16dd42[_0xb134('0x1c')][_0xb134('0x1d')],_0x16dd42['user']);}else{_0x2cce02[_0xb134('0x1e')]=_0x16dd42[_0xb134('0x1e')];}}else{if(_0x16dd42[_0xb134('0x1f')]){_0x2cce02[_0xb134('0x19')]=_0x16dd42[_0xb134('0x19')];_0x2cce02[_0xb134('0x1e')]=_0x16dd42[_0xb134('0x1e')];}}_0x2cce02['email']=_0x2033e4||_0x16dd42[_0xb134('0x19')]||_0xb134('0x20');_0x2cce02['host']=_0x16dd42[_0xb134('0x21')];_0x2cce02[_0xb134('0x22')]=_0x16dd42[_0xb134('0x22')]||0x3e1;if(_0x16dd42['tls']){_0x2cce02[_0xb134('0x23')]=!![];}else{_0x2cce02[_0xb134('0x23')]=![];_0x2cce02[_0xb134('0x24')]='required';}return _0x2cce02;};EmailImap[_0xb134('0x15')][_0xb134('0xd')]=function(){this[_0xb134('0x1')]['openBox'](this[_0xb134('0x9')],![],this[_0xb134('0x25')]['bind'](this));};EmailImap[_0xb134('0x15')][_0xb134('0x25')]=function(_0x48e241,_0x479765){if(_0x48e241){this['handleError'](_0x48e241,!![]);}else{this['emit'](_0xb134('0x26'),_0x479765);this['readUnseen']();}};EmailImap[_0xb134('0x15')][_0xb134('0x27')]=function(_0x4583a7){if(_0x4583a7){this[_0xb134('0x12')](_0x4583a7,!![]);}else{this[_0xb134('0x1')]['end']();}};EmailImap[_0xb134('0x15')][_0xb134('0x28')]=function(){this[_0xb134('0x1')][_0xb134('0x29')]([_0xb134('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xb134('0x15')][_0xb134('0x2b')]=function(_0x53a1b9,_0x913e05){if(_0x53a1b9){this[_0xb134('0x12')](_0x53a1b9,!![]);}else{if(_0x913e05[_0xb134('0x2c')]){try{var _0x2bd4b3=this[_0xb134('0x1')][_0xb134('0x2d')](_0x913e05,{'bodies':'','markSeen':!![]});_0x2bd4b3['on'](_0xb134('0x2e'),this['handleFetchMessage'][_0xb134('0xe')](this));_0x2bd4b3[_0xb134('0xb')](_0xb134('0x11'),this[_0xb134('0x2f')][_0xb134('0xe')](this));_0x2bd4b3['once'](_0xb134('0xf'),this['handleFetchEnd'][_0xb134('0xe')](this));}catch(_0x3cfe0b){logger['error'](_0x3cfe0b);}}else{this[_0xb134('0x1')][_0xb134('0x30')](!![],this[_0xb134('0x27')][_0xb134('0xe')](this));}}};EmailImap['prototype'][_0xb134('0x31')]=function(_0x36b222){_0x36b222['on']('body',this[_0xb134('0x32')][_0xb134('0xe')](this));_0x36b222[_0xb134('0xb')](_0xb134('0x33'),this[_0xb134('0x34')][_0xb134('0xe')](this));_0x36b222[_0xb134('0xb')]('end',this[_0xb134('0x35')][_0xb134('0xe')](this));};EmailImap[_0xb134('0x15')][_0xb134('0x32')]=function(_0x16fd1a){simpleParser(_0x16fd1a,{'Iconv':Iconv},this[_0xb134('0x36')][_0xb134('0xe')](this));};EmailImap[_0xb134('0x15')][_0xb134('0x34')]=function(){};EmailImap[_0xb134('0x15')][_0xb134('0x35')]=function(){};EmailImap[_0xb134('0x15')][_0xb134('0x36')]=function(_0x59ad01,_0x297a36){if(_0x59ad01){logger['error'](_0x59ad01);}else{var _0x2dc5cd=this;utils['parser'](this['account'],_0x297a36,function(_0x3e85ad){_0x2dc5cd[_0xb134('0x37')](_0xb134('0x38'),_0x3e85ad);});}};EmailImap[_0xb134('0x15')][_0xb134('0x39')]=function(){this[_0xb134('0x1')][_0xb134('0x30')](!![],this['handleCloseBox'][_0xb134('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x2bb971){this['handleError'](_0x2bb971);this[_0xb134('0x1')][_0xb134('0x30')](!![],this[_0xb134('0x27')][_0xb134('0xe')](this));};EmailImap[_0xb134('0x15')][_0xb134('0x10')]=function(){this[_0xb134('0x37')](_0xb134('0xf'));};EmailImap[_0xb134('0x15')][_0xb134('0x12')]=function(_0x24549e,_0xbc28e9){logger[_0xb134('0x11')]('handleError',this[_0xb134('0x3a')]['email'],JSON[_0xb134('0x3b')](_0x24549e));var _0x46e41b='';if(_0x24549e){if(_0x24549e['textCode']){_0x46e41b=_0x24549e[_0xb134('0x3c')];}else{for(var _0x42f943 in _0x24549e){if(_0x24549e[_0xb134('0x3d')](_0x42f943)){_0x46e41b+=_[_0xb134('0x3e')](_0x42f943)+':\x20'+_0x24549e[_0x42f943]+'\x0a';}}}}if(_0xbc28e9){this[_0xb134('0x1')][_0xb134('0xf')]();}else{this[_0xb134('0x37')]('error',_0x46e41b);this['emit'](_0xb134('0xf'));}};module[_0xb134('0x3f')]=EmailImap; \ No newline at end of file +var _0x7de4=['account','getAccount','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','stringify','textCode','upperFirst','exports','lodash','mailparser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox'];(function(_0x108c05,_0x5c0ab3){var _0xa8c533=function(_0x48aad4){while(--_0x48aad4){_0x108c05['push'](_0x108c05['shift']());}};_0xa8c533(++_0x5c0ab3);}(_0x7de4,0x1d7));var _0x47de=function(_0xd4d52e,_0xc2655a){_0xd4d52e=_0xd4d52e-0x0;var _0x4354bc=_0x7de4[_0xd4d52e];return _0x4354bc;};'use strict';var _=require(_0x47de('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0x47de('0x1'))['simpleParser'];var Iconv=require(_0x47de('0x2'))[_0x47de('0x3')];var EventEmitter=require('events')[_0x47de('0x4')];var utils=require(_0x47de('0x5'));var logger=require(_0x47de('0x6'))(_0x47de('0x7'));function EmailImap(_0x228246,_0x926778){this[_0x47de('0x8')]=_0x228246[_0x47de('0x8')];this[_0x47de('0x9')]=this[_0x47de('0xa')](_0x228246,_0x926778);this[_0x47de('0xb')]=new Imap(this[_0x47de('0x9')]);this[_0x47de('0xb')]['once'](_0x47de('0xc'),this[_0x47de('0xd')][_0x47de('0xe')](this));this[_0x47de('0xb')][_0x47de('0xf')](_0x47de('0x10'),this[_0x47de('0x11')][_0x47de('0xe')](this));this['imap']['on'](_0x47de('0x12'),this[_0x47de('0x13')][_0x47de('0xe')](this));this[_0x47de('0xb')]['connect']();}util[_0x47de('0x14')](EmailImap,EventEmitter);EmailImap[_0x47de('0x15')][_0x47de('0xa')]=function(_0x49bad6,_0x476974){var _0x134cc5={'connTimeout':_0x49bad6['connTimeout']?_0x49bad6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x49bad6[_0x47de('0x16')]?_0x49bad6[_0x47de('0x16')]*0x3e8:0x1388};if(_0x49bad6[_0x47de('0x17')]){_0x134cc5[_0x47de('0x18')]=_0x49bad6['user'];if(_0x49bad6[_0x47de('0x19')]){_0x134cc5['xoauth2']=utils[_0x47de('0x1a')](_0x49bad6[_0x47de('0x1b')][_0x47de('0x1c')],_0x49bad6[_0x47de('0x18')]);}else{_0x134cc5[_0x47de('0x1d')]=_0x49bad6[_0x47de('0x1d')];}}else{if(_0x49bad6[_0x47de('0x1e')]){_0x134cc5[_0x47de('0x18')]=_0x49bad6[_0x47de('0x18')];_0x134cc5[_0x47de('0x1d')]=_0x49bad6[_0x47de('0x1d')];}}_0x134cc5[_0x47de('0x7')]=_0x476974||_0x49bad6[_0x47de('0x18')]||'anonymous@xcally.com';_0x134cc5['host']=_0x49bad6[_0x47de('0x1f')];_0x134cc5[_0x47de('0x20')]=_0x49bad6[_0x47de('0x20')]||0x3e1;if(_0x49bad6[_0x47de('0x21')]){_0x134cc5[_0x47de('0x21')]=!![];}else{_0x134cc5[_0x47de('0x21')]=![];_0x134cc5[_0x47de('0x22')]=_0x47de('0x23');}return _0x134cc5;};EmailImap['prototype'][_0x47de('0xd')]=function(){this[_0x47de('0xb')][_0x47de('0x24')](this['mailbox'],![],this[_0x47de('0x25')][_0x47de('0xe')](this));};EmailImap[_0x47de('0x15')][_0x47de('0x25')]=function(_0x1c610b,_0x51601a){if(_0x1c610b){this[_0x47de('0x13')](_0x1c610b,!![]);}else{this[_0x47de('0x26')](_0x47de('0x27'),_0x51601a);this[_0x47de('0x28')]();}};EmailImap['prototype'][_0x47de('0x29')]=function(_0xf5971e){if(_0xf5971e){this[_0x47de('0x13')](_0xf5971e,!![]);}else{this[_0x47de('0xb')][_0x47de('0x10')]();}};EmailImap[_0x47de('0x15')][_0x47de('0x28')]=function(){this[_0x47de('0xb')][_0x47de('0x2a')]([_0x47de('0x2b')],this[_0x47de('0x2c')][_0x47de('0xe')](this));};EmailImap[_0x47de('0x15')][_0x47de('0x2c')]=function(_0x2ead95,_0x3af8fa){if(_0x2ead95){this[_0x47de('0x13')](_0x2ead95,!![]);}else{if(_0x3af8fa[_0x47de('0x2d')]){try{var _0x36d411=this[_0x47de('0xb')][_0x47de('0x2e')](_0x3af8fa,{'bodies':'','markSeen':!![]});_0x36d411['on'](_0x47de('0x2f'),this[_0x47de('0x30')][_0x47de('0xe')](this));_0x36d411[_0x47de('0xf')]('error',this[_0x47de('0x31')]['bind'](this));_0x36d411['once']('end',this[_0x47de('0x32')][_0x47de('0xe')](this));}catch(_0x44745a){logger['error'](_0x44745a);}}else{this['imap']['closeBox'](!![],this[_0x47de('0x29')]['bind'](this));}}};EmailImap[_0x47de('0x15')][_0x47de('0x30')]=function(_0x1e23d3){_0x1e23d3['on']('body',this['handleMessageBody'][_0x47de('0xe')](this));_0x1e23d3['once'](_0x47de('0x33'),this[_0x47de('0x34')]['bind'](this));_0x1e23d3['once']('end',this[_0x47de('0x35')][_0x47de('0xe')](this));};EmailImap[_0x47de('0x15')]['handleMessageBody']=function(_0x226f13){simpleParser(_0x226f13,{'Iconv':Iconv},this[_0x47de('0x36')]['bind'](this));};EmailImap[_0x47de('0x15')][_0x47de('0x34')]=function(){};EmailImap[_0x47de('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x47de('0x15')][_0x47de('0x36')]=function(_0x25e9d3,_0x2b1200){if(_0x25e9d3){logger[_0x47de('0x12')](_0x25e9d3);}else{var _0x3f4421=this;utils['parser'](this[_0x47de('0x9')],_0x2b1200,function(_0x3469ec){_0x3f4421[_0x47de('0x26')](_0x47de('0x7'),_0x3469ec);});}};EmailImap[_0x47de('0x15')][_0x47de('0x32')]=function(){this[_0x47de('0xb')][_0x47de('0x37')](!![],this[_0x47de('0x29')]['bind'](this));};EmailImap[_0x47de('0x15')][_0x47de('0x31')]=function(_0x4a3492){this[_0x47de('0x13')](_0x4a3492);this[_0x47de('0xb')]['closeBox'](!![],this[_0x47de('0x29')]['bind'](this));};EmailImap[_0x47de('0x15')][_0x47de('0x11')]=function(){this['emit'](_0x47de('0x10'));};EmailImap[_0x47de('0x15')][_0x47de('0x13')]=function(_0x9627cb,_0x5cd48d){logger[_0x47de('0x12')](_0x47de('0x13'),this[_0x47de('0x9')][_0x47de('0x7')],JSON[_0x47de('0x38')](_0x9627cb));var _0x5d2b3f='';if(_0x9627cb){if(_0x9627cb[_0x47de('0x39')]){_0x5d2b3f=_0x9627cb['textCode'];}else{for(var _0x2cf9b0 in _0x9627cb){if(_0x9627cb['hasOwnProperty'](_0x2cf9b0)){_0x5d2b3f+=_[_0x47de('0x3a')](_0x2cf9b0)+':\x20'+_0x9627cb[_0x2cf9b0]+'\x0a';}}}}if(_0x5cd48d){this[_0x47de('0xb')]['end']();}else{this[_0x47de('0x26')](_0x47de('0x12'),_0x5d2b3f);this[_0x47de('0x26')](_0x47de('0x10'));}};module[_0x47de('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4150a62..ee2c9a5 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 _0xc5c7=['prototype','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','toString'];(function(_0x30f7ef,_0x3ec7e0){var _0x595f63=function(_0x189027){while(--_0x189027){_0x30f7ef['push'](_0x30f7ef['shift']());}};_0x595f63(++_0x3ec7e0);}(_0xc5c7,0x10c));var _0x7c5c=function(_0x4149c0,_0x44ecfe){_0x4149c0=_0x4149c0-0x0;var _0x1c8683=_0xc5c7[_0x4149c0];return _0x1c8683;};'use strict';var nodemailer=require(_0x7c5c('0x0'));var inlineBase64=require(_0x7c5c('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x7c5c('0x2')]=function(_0x32e4d6,_0x259abd){return new Promise(function(_0x29bb1c,_0xcebfb5){var _0x1e2503=nodemailer[_0x7c5c('0x3')](_0x32e4d6);_0x1e2503[_0x7c5c('0x4')](_0x7c5c('0x5'),inlineBase64());_0x1e2503[_0x7c5c('0x6')](_0x259abd,function(_0x3c0cee,_0x26e3ac){if(_0x3c0cee){_0xcebfb5(_0x3c0cee[_0x7c5c('0x7')]());}else{_0x29bb1c(_0x26e3ac);}});});};EmailSmtp[_0x7c5c('0x8')]['verify']=function(_0x3648dd){return new Promise(function(_0x57794b,_0x3953ea){var _0x209087=nodemailer[_0x7c5c('0x3')](_0x3648dd);_0x209087[_0x7c5c('0x9')](function(_0x22f6d3,_0x5ac335){if(_0x22f6d3){_0x3953ea(_0x22f6d3['toString']());}else{if(_0x5ac335){_0x57794b(_0x5ac335);}else{_0x3953ea(_0x7c5c('0xa'));}}});});};module[_0x7c5c('0xb')]=EmailSmtp; \ No newline at end of file +var _0xbf3f=['prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3de0da,_0x4af765){var _0x3872d8=function(_0x29a937){while(--_0x29a937){_0x3de0da['push'](_0x3de0da['shift']());}};_0x3872d8(++_0x4af765);}(_0xbf3f,0xda));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0xfbf3('0x0'));var inlineBase64=require(_0xfbf3('0x1'));function EmailSmtp(){}EmailSmtp[_0xfbf3('0x2')][_0xfbf3('0x3')]=function(_0x2780c3,_0x58a058){return new Promise(function(_0xa1979d,_0x4ab2f4){var _0x47160e=nodemailer[_0xfbf3('0x4')](_0x2780c3);_0x47160e[_0xfbf3('0x5')](_0xfbf3('0x6'),inlineBase64());_0x47160e['sendMail'](_0x58a058,function(_0x42f1dd,_0x3a225c){if(_0x42f1dd){_0x4ab2f4(_0x42f1dd[_0xfbf3('0x7')]());}else{_0xa1979d(_0x3a225c);}});});};EmailSmtp[_0xfbf3('0x2')][_0xfbf3('0x8')]=function(_0x5eba8e){return new Promise(function(_0x1eaeb1,_0x3e8a7b){var _0x379eac=nodemailer[_0xfbf3('0x4')](_0x5eba8e);_0x379eac['verify'](function(_0x5debe3,_0x4145d1){if(_0x5debe3){_0x3e8a7b(_0x5debe3[_0xfbf3('0x7')]());}else{if(_0x4145d1){_0x1eaeb1(_0x4145d1);}else{_0x3e8a7b(_0xfbf3('0x9'));}}});});};module[_0xfbf3('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4ae96f6..f502c0c 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 _0x590b=['%s-%s','root','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','moment','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','join','Anonymous','length','pop','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x4cc5c2['slice'](0x0,-0x1)[_0xb590('0xf')]('\x20'):_0x5143f1[_0xb590('0xb')];}return _0xb590('0x10');}function getLastName(_0x5f1c5a){var _0x4d000e=_[_0xb590('0x5')](_0x5f1c5a[_0xb590('0x6')]);if(_0x4d000e&&_0x4d000e['name']){var _0x3c69d1=_0x4d000e['name'][_0xb590('0xe')](/\s+/);return _0x3c69d1[_0xb590('0x11')]>0x1?_0x3c69d1[_0xb590('0x12')]():'';}return'';}function getMails(_0x213260,_0x362841){var _0x5d863e='';for(var _0x1e29f9=0x0;_0x1e29f9<_0x362841[_0xb590('0x6')][_0xb590('0x11')];_0x1e29f9+=0x1){if(_0x362841[_0xb590('0x6')][_0x1e29f9][_0xb590('0x7')]!==_0x213260){if(!_[_0xb590('0x13')](_0x5d863e)){_0x5d863e+=',';}_0x5d863e+=_0x362841[_0xb590('0x6')][_0x1e29f9][_0xb590('0xb')]||_0x362841['value'][_0x1e29f9][_0xb590('0x7')]||'';_0x5d863e+='\x20<';_0x5d863e+=_0x362841[_0xb590('0x6')][_0x1e29f9][_0xb590('0x7')]?_0x362841[_0xb590('0x6')][_0x1e29f9][_0xb590('0x7')]:_0xb590('0x8')+random[_0xb590('0x9')](0x6)+_0xb590('0xa');_0x5d863e+='>';}}return _0x5d863e;}function parseEmail(_0x362358,_0x2c58a9,_0x5775d6){if(_0x2c58a9[_0xb590('0x14')]){var _0x440d9f=/)<[^<]*)*<\/script>/gi;while(_0x440d9f['test'](_0x2c58a9[_0xb590('0x14')])){_0x2c58a9[_0xb590('0x14')]=_0x2c58a9[_0xb590('0x14')][_0xb590('0x15')](_0x440d9f,'');}if(_0x2c58a9[_0xb590('0x14')][_0xb590('0x16')](_0xb590('0x17'))){var _0x17310b=[];_0x2c58a9[_0xb590('0x18')][_0xb590('0x19')](_0x3374f0=>{_0x17310b[_0xb590('0x1a')](_0x3374f0[_0xb590('0x1b')]);});var _0x147e49=/]+>/g;var _0x5a523e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3e9bde=_0x2c58a9[_0xb590('0x14')][_0xb590('0x15')](_0x5a523e,_0xb590('0x1c'));var _0x3e083b=_0x3e9bde[_0xb590('0x15')](_0x147e49,_0xb590('0x1d'));for(let _0x1f84aa=0x0;_0x1f84aa<_0x17310b[_0xb590('0x11')];_0x1f84aa++){var _0x565d87=_0x3e083b[_0xb590('0x15')](_0xb590('0x1d'),_0xb590('0x1e')+_0x17310b[_0x1f84aa]+_0xb590('0x1f'));_0x3e083b=_0x565d87;}_0x2c58a9[_0xb590('0x14')]=_0x3e083b;}_0x5775d6[_0xb590('0x20')]=_0x2c58a9[_0xb590('0x14')];}else{_0x5775d6['body']=_0x2c58a9[_0xb590('0x21')];}if(_0x5775d6['body']){_0x5775d6[_0xb590('0x20')]=_0x5775d6[_0xb590('0x20')][_0xb590('0x15')](/0x0){var _0x222e62=[_0xb590('0x31'),_0xb590('0x32'),_0xb590('0x33')];for(var _0x22df3a=0x0;_0x22df3a<_0x2c58a9[_0xb590('0x30')][_0xb590('0x11')];_0x22df3a++){var _0x168623=_['indexOf'](_0x222e62,_0x2c58a9['headerLines'][_0x22df3a][_0xb590('0x34')]);if(_0x168623>=0x0){_0x5775d6[_0xb590('0x35')]=!![];}}}return _0x5775d6;}exports[_0xb590('0x36')]=function(_0x3a6c60,_0x3119e5,_0x57fb0e){var _0x502254={'from':getAddress(_0x3119e5[_0xb590('0x37')]),'firstName':getFirstName(_0x3119e5['from']),'lastName':getLastName(_0x3119e5[_0xb590('0x37')]),'mapKey':_0xb590('0x24'),'message':{'from':getMails(_0x3a6c60[_0xb590('0x24')],_0x3119e5['from']),'to':_0x3a6c60[_0xb590('0x24')],'cc':'','subject':_0x3119e5[_0xb590('0x38')]||'','messageId':_0x3119e5[_0xb590('0x39')],'inReplyTo':_0x3119e5[_0xb590('0x3a')],'sentAt':moment(_0x3119e5[_0xb590('0x3b')])[_0xb590('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3119e5[_0xb590('0x14')]&&!_0x3119e5[_0xb590('0x21')]){var _0x5a47cf=_[_0xb590('0x3c')](_0x3119e5['attachments'],{'contentType':_0xb590('0x3d')});if(_0x5a47cf[_0xb590('0x11')]){logger[_0xb590('0x3e')](util[_0xb590('0x2b')](_0xb590('0x3f'),_0x3119e5['messageId']));tnef[_0xb590('0x40')](_[_0xb590('0x41')](_0x5a47cf)['content'],function(_0x13a00d,_0x249666){if(_0x249666){_0x3119e5[_0xb590('0x14')]=_0x249666[_0xb590('0x42')]||'

Empty\x20message

';if(_0x249666[_0xb590('0x43')]){for(var _0x5d7224=0x0;_0x5d7224<_0x249666[_0xb590('0x43')]['length'];_0x5d7224++){var _0x49c741=_0x249666[_0xb590('0x43')][_0x5d7224];_0x502254[_0xb590('0x25')][_0xb590('0x18')][_0xb590('0x1a')]({'filename':_0x49c741[_0xb590('0x44')],'content':Buffer[_0xb590('0x37')](_0x49c741[_0xb590('0x45')])});}}}_0x57fb0e(parseEmail(_0x3a6c60,_0x3119e5,_0x502254));});}else{_0x3119e5[_0xb590('0x14')]='

Empty\x20message

';_0x57fb0e(parseEmail(_0x3a6c60,_0x3119e5,_0x502254));}}else{_0x57fb0e(parseEmail(_0x3a6c60,_0x3119e5,_0x502254));}};exports[_0xb590('0x46')]=function(_0x54947e,_0xe664a5){var _0x41cd0b=[_0xb590('0x47')+(_0xe664a5||''),_0xb590('0x48')+_0x54947e,'',''];return Buffer[_0xb590('0x37')](_0x41cd0b[_0xb590('0xf')](''),'utf-8')[_0xb590('0x49')](_0xb590('0x4a'));}; \ No newline at end of file +var _0x4139=['address','anonymous','generate','@xcally.com','name','substring','length','slice','head','split','pop','html','test','replace','includes','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','randomstring','path','../../../config/logger','email','value'];(function(_0x4b55e8,_0x41ba7e){var _0x46e844=function(_0x2b1e4f){while(--_0x2b1e4f){_0x4b55e8['push'](_0x4b55e8['shift']());}};_0x46e844(++_0x41ba7e);}(_0x4139,0x121));var _0x9413=function(_0x2306fb,_0x4b1726){_0x2306fb=_0x2306fb-0x0;var _0x1e035f=_0x4139[_0x2306fb];return _0x1e035f;};'use strict';var _=require(_0x9413('0x0'));var moment=require(_0x9413('0x1'));var random=require(_0x9413('0x2'));var fs=require('fs');var path=require(_0x9413('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x9413('0x4'))(_0x9413('0x5'));var config=require('../../../config/environment');function getAddress(_0x3d390d){var _0x33219b=_['head'](_0x3d390d[_0x9413('0x6')]);return _0x33219b&&_0x33219b['address']?_0x33219b[_0x9413('0x7')]:_0x9413('0x8')+random[_0x9413('0x9')](0x6)+_0x9413('0xa');}function getFirstName(_0x3255a2){var _0x1c57d8=_['head'](_0x3255a2[_0x9413('0x6')]);if(_0x1c57d8&&_0x1c57d8[_0x9413('0xb')]){if(_0x1c57d8['name']==_0x1c57d8[_0x9413('0x7')]){return _0x1c57d8[_0x9413('0xb')][_0x9413('0xc')](0x0,_0x1c57d8['name']['indexOf']('@'));}var _0x4e49b2=_0x1c57d8[_0x9413('0xb')]['split'](/\s+/);return _0x4e49b2[_0x9413('0xd')]>0x1?_0x4e49b2[_0x9413('0xe')](0x0,-0x1)['join']('\x20'):_0x1c57d8[_0x9413('0xb')];}return'Anonymous';}function getLastName(_0x482a8b){var _0x1dd208=_[_0x9413('0xf')](_0x482a8b['value']);if(_0x1dd208&&_0x1dd208['name']){var _0x4ac332=_0x1dd208[_0x9413('0xb')][_0x9413('0x10')](/\s+/);return _0x4ac332[_0x9413('0xd')]>0x1?_0x4ac332[_0x9413('0x11')]():'';}return'';}function getMails(_0x1edf23,_0x2d4568){var _0x4f83ea='';for(var _0x5e9427=0x0;_0x5e9427<_0x2d4568[_0x9413('0x6')]['length'];_0x5e9427+=0x1){if(_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0x7')]!==_0x1edf23){if(!_['isEmpty'](_0x4f83ea)){_0x4f83ea+=',';}_0x4f83ea+=_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0xb')]||_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0x7')]||'';_0x4f83ea+='\x20<';_0x4f83ea+=_0x2d4568['value'][_0x5e9427][_0x9413('0x7')]?_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0x7')]:_0x9413('0x8')+random['generate'](0x6)+'@xcally.com';_0x4f83ea+='>';}}return _0x4f83ea;}function parseEmail(_0xb2ae8c,_0x3e13b0,_0x4d1ce4){if(_0x3e13b0[_0x9413('0x12')]){var _0x256318=/)<[^<]*)*<\/script>/gi;while(_0x256318[_0x9413('0x13')](_0x3e13b0[_0x9413('0x12')])){_0x3e13b0[_0x9413('0x12')]=_0x3e13b0[_0x9413('0x12')][_0x9413('0x14')](_0x256318,'');}if(_0x3e13b0[_0x9413('0x12')][_0x9413('0x15')]('{_0x2ce243[_0x9413('0x17')](_0x4ee3ee[_0x9413('0x18')]);});var _0x306631=/]+>/g;var _0x2cc1c8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x74c803=_0x3e13b0[_0x9413('0x12')][_0x9413('0x14')](_0x2cc1c8,_0x9413('0x19'));var _0x543e00=_0x74c803['replace'](_0x306631,'_IMG');for(let _0x3763fa=0x0;_0x3763fa<_0x2ce243['length'];_0x3763fa++){var _0x2a6945=_0x543e00['replace'](_0x9413('0x1a'),_0x9413('0x1b')+_0x2ce243[_0x3763fa]+_0x9413('0x1c'));_0x543e00=_0x2a6945;}_0x3e13b0[_0x9413('0x12')]=_0x543e00;}_0x4d1ce4['body']=_0x3e13b0[_0x9413('0x12')];}else{_0x4d1ce4[_0x9413('0x1d')]=_0x3e13b0[_0x9413('0x1e')];}if(_0x4d1ce4['body']){_0x4d1ce4[_0x9413('0x1d')]=_0x4d1ce4['body'][_0x9413('0x14')](/0x0){var _0x3cfd9d=[_0x9413('0x2f'),_0x9413('0x30'),_0x9413('0x31')];for(var _0x29155b=0x0;_0x29155b<_0x3e13b0[_0x9413('0x2e')][_0x9413('0xd')];_0x29155b++){var _0x11d4b3=_[_0x9413('0x32')](_0x3cfd9d,_0x3e13b0[_0x9413('0x2e')][_0x29155b][_0x9413('0x33')]);if(_0x11d4b3>=0x0){_0x4d1ce4['isAutoreply']=!![];}}}return _0x4d1ce4;}exports['parser']=function(_0x5c3504,_0x145d6d,_0x2b2915){var _0x4a4304={'from':getAddress(_0x145d6d[_0x9413('0x34')]),'firstName':getFirstName(_0x145d6d[_0x9413('0x34')]),'lastName':getLastName(_0x145d6d[_0x9413('0x34')]),'mapKey':_0x9413('0x5'),'message':{'from':getMails(_0x5c3504['email'],_0x145d6d[_0x9413('0x34')]),'to':_0x5c3504['email'],'cc':'','subject':_0x145d6d[_0x9413('0x35')]||'','messageId':_0x145d6d['messageId'],'inReplyTo':_0x145d6d['inReplyTo'],'sentAt':moment(_0x145d6d[_0x9413('0x36')])[_0x9413('0x37')](_0x9413('0x38')),'attach':![],'attachments':[]}};if(!_0x145d6d[_0x9413('0x12')]&&!_0x145d6d['textAsHtml']){var _0x1d80a4=_[_0x9413('0x39')](_0x145d6d[_0x9413('0x25')],{'contentType':_0x9413('0x3a')});if(_0x1d80a4[_0x9413('0xd')]){logger[_0x9413('0x3b')](util[_0x9413('0x37')](_0x9413('0x3c'),_0x145d6d[_0x9413('0x3d')]));tnef['parseBuffer'](_[_0x9413('0x3e')](_0x1d80a4)[_0x9413('0x2c')],function(_0x4baca5,_0x59a48b){if(_0x59a48b){_0x145d6d[_0x9413('0x12')]=_0x59a48b['BodyHTML']||'

Empty\x20message

';if(_0x59a48b[_0x9413('0x3f')]){for(var _0x4555ba=0x0;_0x4555ba<_0x59a48b['Attachments']['length'];_0x4555ba++){var _0x86d35b=_0x59a48b['Attachments'][_0x4555ba];_0x4a4304[_0x9413('0x20')][_0x9413('0x25')][_0x9413('0x17')]({'filename':_0x86d35b[_0x9413('0x40')],'content':Buffer[_0x9413('0x34')](_0x86d35b[_0x9413('0x41')])});}}}_0x2b2915(parseEmail(_0x5c3504,_0x145d6d,_0x4a4304));});}else{_0x145d6d[_0x9413('0x12')]=_0x9413('0x42');_0x2b2915(parseEmail(_0x5c3504,_0x145d6d,_0x4a4304));}}else{_0x2b2915(parseEmail(_0x5c3504,_0x145d6d,_0x4a4304));}};exports[_0x9413('0x43')]=function(_0xdb1ef0,_0x573b3a){var _0xac4770=[_0x9413('0x44')+(_0x573b3a||''),_0x9413('0x45')+_0xdb1ef0,'',''];return Buffer[_0x9413('0x34')](_0xac4770[_0x9413('0x46')](''),_0x9413('0x47'))[_0x9413('0x48')](_0x9413('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8004598..3884326 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 _0xe0e7=['name','Service','key','SERV','active','Imap','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0e7,0x16b));var _0x7e0e=function(_0x29d6f1,_0x4465c0){_0x29d6f1=_0x29d6f1-0x0;var _0x3cd8b8=_0xe0e7[_0x29d6f1];return _0x3cd8b8;};'use strict';var _=require(_0x7e0e('0x0'));function MailAccount(_0x2b658d){this['id']=_0x2b658d['id']||0x0;this[_0x7e0e('0x1')]=_0x2b658d[_0x7e0e('0x1')]||_0x7e0e('0x2');this[_0x7e0e('0x3')]=_0x2b658d['key']||_0x7e0e('0x4');this[_0x7e0e('0x5')]=_0x2b658d[_0x7e0e('0x5')]||![];this[_0x7e0e('0x6')]=_0x2b658d['Imap']||[];this['Smtp']=_0x2b658d['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x819b=['Imap','Smtp','name','Service','key','SERV','active'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x819b,0xe9));var _0xb819=function(_0x45682b,_0x22ef44){_0x45682b=_0x45682b-0x0;var _0x28c3cd=_0x819b[_0x45682b];return _0x28c3cd;};'use strict';var _=require('lodash');function MailAccount(_0x185e59){this['id']=_0x185e59['id']||0x0;this[_0xb819('0x0')]=_0x185e59[_0xb819('0x0')]||_0xb819('0x1');this[_0xb819('0x2')]=_0x185e59[_0xb819('0x2')]||_0xb819('0x3');this[_0xb819('0x4')]=_0x185e59['active']||![];this['Imap']=_0x185e59[_0xb819('0x5')]||[];this[_0xb819('0x6')]=_0x185e59[_0xb819('0x6')]||[];}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 a101d13..69f55f4 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 _0x5715=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount'];(function(_0x2d5661,_0x349e57){var _0x5dc3b5=function(_0x274b50){while(--_0x274b50){_0x2d5661['push'](_0x2d5661['shift']());}};_0x5dc3b5(++_0x349e57);}(_0x5715,0xc5));var _0x5571=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x5715[_0x51b0dc];return _0x13fa89;};'use strict';var _=require('lodash');var MailAccount=require(_0x5571('0x0'));var Realtime=function(){this[_0x5571('0x1')]={};};function freeIsNotKey(_0x3f051d,_0x2072c1,_0x2b784c){var _0x225170=_[_0x5571('0x2')](_0x3f051d,function(_0x24ffd0,_0x3958cb){return _0x24ffd0[_0x2b784c];});for(var _0x1dab3d in _0x2072c1){if(_0x2072c1[_0x5571('0x3')](_0x1dab3d)){if(!_0x225170[_0x1dab3d]){delete _0x2072c1[_0x1dab3d];}}}}Realtime[_0x5571('0x4')][_0x5571('0x5')]=function(_0x2feb9a,_0x5c4902){for(var _0x48ae7b in _0x5c4902){if(_0x2feb9a[_0x5571('0x3')](_0x48ae7b)){_0x2feb9a[_0x48ae7b]=_0x5c4902[_0x48ae7b];}}};Realtime[_0x5571('0x4')][_0x5571('0x6')]=function(){var _0x3ceab7=this;return function(_0x445616){if(_0x445616){freeIsNotKey(_0x445616,_0x3ceab7['mailAccounts'],'id');for(var _0xa5655b=0x0,_0x4947d5={},_0xd1867f={};_0xa5655b<_0x445616[_0x5571('0x7')];_0xa5655b+=0x1){_0x4947d5=_0x445616[_0xa5655b];if(_[_0x5571('0x8')](_0x3ceab7[_0x5571('0x1')][_0x4947d5['id']])){_0x3ceab7[_0x5571('0x1')][_0x4947d5['id']]=new MailAccount(_0x4947d5);}else{_[_0x5571('0x9')](_0x3ceab7[_0x5571('0x1')][_0x4947d5['id']],_0x4947d5);}}}return _0x3ceab7[_0x5571('0x1')];};};module[_0x5571('0xa')]=Realtime; \ No newline at end of file +var _0x6e82=['mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','../model/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e82,0x128));var _0x26e8=function(_0x30f951,_0x3ba029){_0x30f951=_0x30f951-0x0;var _0x17cce0=_0x6e82[_0x30f951];return _0x17cce0;};'use strict';var _=require('lodash');var MailAccount=require(_0x26e8('0x0'));var Realtime=function(){this[_0x26e8('0x1')]={};};function freeIsNotKey(_0x568c09,_0x466716,_0x134520){var _0x3f293b=_[_0x26e8('0x2')](_0x568c09,function(_0x4d34af,_0x36e0e6){return _0x4d34af[_0x134520];});for(var _0x1b9581 in _0x466716){if(_0x466716[_0x26e8('0x3')](_0x1b9581)){if(!_0x3f293b[_0x1b9581]){delete _0x466716[_0x1b9581];}}}}Realtime['prototype'][_0x26e8('0x4')]=function(_0x589118,_0x4cd4cc){for(var _0x549aa2 in _0x4cd4cc){if(_0x589118[_0x26e8('0x3')](_0x549aa2)){_0x589118[_0x549aa2]=_0x4cd4cc[_0x549aa2];}}};Realtime[_0x26e8('0x5')][_0x26e8('0x6')]=function(){var _0x387a5c=this;return function(_0x7edd06){if(_0x7edd06){freeIsNotKey(_0x7edd06,_0x387a5c['mailAccounts'],'id');for(var _0x1d35e2=0x0,_0x4a90d9={},_0x2a8e39={};_0x1d35e2<_0x7edd06[_0x26e8('0x7')];_0x1d35e2+=0x1){_0x4a90d9=_0x7edd06[_0x1d35e2];if(_[_0x26e8('0x8')](_0x387a5c[_0x26e8('0x1')][_0x4a90d9['id']])){_0x387a5c[_0x26e8('0x1')][_0x4a90d9['id']]=new MailAccount(_0x4a90d9);}else{_['merge'](_0x387a5c['mailAccounts'][_0x4a90d9['id']],_0x4a90d9);}}}return _0x387a5c[_0x26e8('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 5e9099b..87ead87 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 _0x8163=['Request','GetMailAccount','name','email','key','ListId','TemplateId','Imap','service','type','CloudProvider','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x8163,0x11b));var _0x3816=function(_0x3dae9b,_0x2c0389){_0x3dae9b=_0x3dae9b-0x0;var _0x84cbe=_0x8163[_0x3dae9b];return _0x84cbe;};'use strict';var client=require(_0x3816('0x0'));exports[_0x3816('0x1')]=function(){return function(){return client[_0x3816('0x2')](_0x3816('0x3'),{'options':{'attributes':['id',_0x3816('0x4'),'provider','service',_0x3816('0x5'),'active',_0x3816('0x6'),_0x3816('0x7'),_0x3816('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x3816('0x9'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x3816('0xa'),_0x3816('0xb'),'data5'],'as':_0x3816('0xc')}]},{'model':_0x3816('0xd'),'as':_0x3816('0xe'),'include':[{'model':_0x3816('0xc'),'attributes':['id','name',_0x3816('0xa'),_0x3816('0xb'),_0x3816('0xf')],'as':_0x3816('0xc')}]}]},'log':_0x3816('0x10')});};};exports[_0x3816('0x11')]=function(_0xd80133,_0x1a509f){return client[_0x3816('0x2')]('NotifyMailAccount',{'account':{'id':_0xd80133},'body':_0x1a509f,'log':_0x3816('0x12')});}; \ No newline at end of file +var _0x8daf=['CloudProvider','type','service','data5','getMailAccount','notify','Request','NotifyMailAccount','name','provider','email','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x8daf,0x15c));var _0xf8da=function(_0xc67594,_0x25a6f3){_0xc67594=_0xc67594-0x0;var _0x2f9020=_0x8daf[_0xc67594];return _0x2f9020;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xf8da('0x0'),_0xf8da('0x1'),'service',_0xf8da('0x2'),_0xf8da('0x3'),_0xf8da('0x4'),_0xf8da('0x5'),_0xf8da('0x6')],'raw':![],'include':[{'model':_0xf8da('0x7'),'as':_0xf8da('0x8'),'include':[{'model':_0xf8da('0x9'),'attributes':['id',_0xf8da('0x0'),'service',_0xf8da('0xa'),'data5'],'as':_0xf8da('0x9')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xf8da('0x9'),'attributes':['id',_0xf8da('0x0'),_0xf8da('0xb'),_0xf8da('0xa'),_0xf8da('0xc')],'as':_0xf8da('0x9')}]}]},'log':_0xf8da('0xd')});};};exports[_0xf8da('0xe')]=function(_0x5313ea,_0xa8a3eb){return client[_0xf8da('0xf')](_0xf8da('0x10'),{'account':{'id':_0x5313ea},'body':_0xa8a3eb,'log':_0xf8da('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 2fb3b7c..4ecdc2f 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 _0x5527=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x21d454,_0x4910fa){var _0x1454a0=function(_0x4eca49){while(--_0x4eca49){_0x21d454['push'](_0x21d454['shift']());}};_0x1454a0(++_0x4910fa);}(_0x5527,0xa6));var _0x7552=function(_0x48ebf7,_0x1aeeab){_0x48ebf7=_0x48ebf7-0x0;var _0xe5023d=_0x5527[_0x48ebf7];return _0xe5023d;};'use strict';var client=require(_0x7552('0x0'));exports['getSettings']=function(){return client[_0x7552('0x1')](_0x7552('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7552('0x3')]},'log':_0x7552('0x4')});}; \ No newline at end of file +var _0xdead=['ShowSetting','loginMailFrequency','GetSettings','Request'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xdead,0xa3));var _0xddea=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0xdead[_0x49f67f];return _0x4779a1;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xddea('0x0')](_0xddea('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xddea('0x2')]},'log':_0xddea('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 01f51e7..d55727d 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index d1d6f59..ef38a8e 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 _0xb7a1=['../../routes','once','listening','log','port','exports','lodash','http','express','sticky-session','createServer','timeout','listen','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','../../config/socketio','default'];(function(_0x42e917,_0x5ecd21){var _0x52df6c=function(_0x2be5dc){while(--_0x2be5dc){_0x42e917['push'](_0x42e917['shift']());}};_0x52df6c(++_0x5ecd21);}(_0xb7a1,0xed));var _0x1b7a=function(_0x1f455d,_0xa8a336){_0x1f455d=_0x1f455d-0x0;var _0x489cb0=_0xb7a1[_0x1f455d];return _0x489cb0;};'use strict';var _=require(_0x1b7a('0x0'));var http=require(_0x1b7a('0x1'));var express=require(_0x1b7a('0x2'));var sticky=require(_0x1b7a('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x1b7a('0x4')](app);server[_0x1b7a('0x5')]=0xdbba0;if(sticky[_0x1b7a('0x6')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x1b7a('0x7')]});config['redis']=_[_0x1b7a('0x8')](config[_0x1b7a('0x9')],{'host':_0x1b7a('0xa'),'port':0x18eb});socketio['adapter'](require(_0x1b7a('0xb'))({'pubClient':new Redis(config[_0x1b7a('0x9')]),'subClient':new Redis(config[_0x1b7a('0x9')])}));require(_0x1b7a('0xc'))['default']();require(_0x1b7a('0xd'))[_0x1b7a('0xe')](socketio);require('../../config/express')[_0x1b7a('0xe')](app);require(_0x1b7a('0xf'))[_0x1b7a('0xe')](app);}else{server[_0x1b7a('0x10')](_0x1b7a('0x11'),function(){console[_0x1b7a('0x12')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1b7a('0x13')]);});}exports=module[_0x1b7a('0x14')]=app; \ No newline at end of file +var _0xaafb=['redis','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','createServer','listen','socket.io','websocket','polling'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0xaafb,0x108));var _0xbaaf=function(_0x19fe15,_0x1d5693){_0x19fe15=_0x19fe15-0x0;var _0x32da73=_0xaafb[_0x19fe15];return _0x32da73;};'use strict';var _=require(_0xbaaf('0x0'));var http=require(_0xbaaf('0x1'));var express=require(_0xbaaf('0x2'));var sticky=require('sticky-session');var Redis=require(_0xbaaf('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xbaaf('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xbaaf('0x5')](server,config['port'])){var socketio=require(_0xbaaf('0x6'))(server,{'transports':[_0xbaaf('0x7'),_0xbaaf('0x8')]});config[_0xbaaf('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0xbaaf('0xa')](require(_0xbaaf('0xb'))({'pubClient':new Redis(config[_0xbaaf('0x9')]),'subClient':new Redis(config[_0xbaaf('0x9')])}));require(_0xbaaf('0xc'))['default']();require(_0xbaaf('0xd'))[_0xbaaf('0xe')](socketio);require(_0xbaaf('0xf'))['default'](app);require('../../routes')[_0xbaaf('0xe')](app);}else{server[_0xbaaf('0x10')](_0xbaaf('0x11'),function(){console[_0xbaaf('0x12')](_0xbaaf('0x13'),config['port']);});}exports=module[_0xbaaf('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2f0fe71..2477aae 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 _0x7e72=['error','rpc','message','result','catch','exports','bluebird','../../config/logger','routing','client','Request','then','debug'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7e72,0x1b3));var _0x27e7=function(_0x3501b1,_0x496097){_0x3501b1=_0x3501b1-0x0;var _0x38c1ec=_0x7e72[_0x3501b1];return _0x38c1ec;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x27e7('0x0'));var logger=require(_0x27e7('0x1'))(_0x27e7('0x2'));var client=jayson[_0x27e7('0x3')]['http']({'port':0x2329});client[_0x27e7('0x4')]=function(_0x21ce95,_0x1836df){return new BPromise(function(_0x3f1c0f,_0x40852b){return client['request'](_0x21ce95,_0x1836df)[_0x27e7('0x5')](function(_0x1a3744){logger[_0x27e7('0x6')]('rpc',_0x27e7('0x2'),_0x21ce95,_0x1836df,_0x1a3744);if(_0x1a3744[_0x27e7('0x7')]){logger[_0x27e7('0x7')](_0x27e7('0x8'),_0x27e7('0x2'),_0x21ce95,_0x1a3744['error'][_0x27e7('0x9')],_0x1836df);return _0x40852b(_0x1a3744[_0x27e7('0x7')][_0x27e7('0x9')]);}else{return _0x3f1c0f(_0x1a3744[_0x27e7('0xa')]);}})[_0x27e7('0xb')](function(_0x413a61){logger['error'](_0x27e7('0x8'),_0x27e7('0x2'),_0x21ce95,_0x413a61,_0x1836df);return _0x40852b(_0x413a61);});});};module[_0x27e7('0xc')]=client; \ No newline at end of file +var _0x8e84=['routing','client','http','Request','debug','rpc','error','message','result','exports','jayson/promise','bluebird'];(function(_0x17e750,_0x26c72a){var _0xb6974e=function(_0x17c127){while(--_0x17c127){_0x17e750['push'](_0x17e750['shift']());}};_0xb6974e(++_0x26c72a);}(_0x8e84,0xb2));var _0x48e8=function(_0x7c041a,_0x5a2621){_0x7c041a=_0x7c041a-0x0;var _0x3177dd=_0x8e84[_0x7c041a];return _0x3177dd;};'use strict';var jayson=require(_0x48e8('0x0'));var BPromise=require(_0x48e8('0x1'));var logger=require('../../config/logger')(_0x48e8('0x2'));var client=jayson[_0x48e8('0x3')][_0x48e8('0x4')]({'port':0x2329});client[_0x48e8('0x5')]=function(_0x24515b,_0x550523){return new BPromise(function(_0x361c37,_0xa0d7f2){return client['request'](_0x24515b,_0x550523)['then'](function(_0x1d0cd6){logger[_0x48e8('0x6')](_0x48e8('0x7'),_0x48e8('0x2'),_0x24515b,_0x550523,_0x1d0cd6);if(_0x1d0cd6[_0x48e8('0x8')]){logger[_0x48e8('0x8')]('rpc',_0x48e8('0x2'),_0x24515b,_0x1d0cd6[_0x48e8('0x8')][_0x48e8('0x9')],_0x550523);return _0xa0d7f2(_0x1d0cd6[_0x48e8('0x8')][_0x48e8('0x9')]);}else{return _0x361c37(_0x1d0cd6[_0x48e8('0xa')]);}})['catch'](function(_0x5431d1){logger['error']('rpc','routing',_0x24515b,_0x5431d1,_0x550523);return _0xa0d7f2(_0x5431d1);});});};module[_0x48e8('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f6085b1..5f7c02b 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 _0xb508=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals'];(function(_0x2dc4e3,_0x2c755b){var _0x6d2dbf=function(_0x28d3d5){while(--_0x28d3d5){_0x2dc4e3['push'](_0x2dc4e3['shift']());}};_0x6d2dbf(++_0x2c755b);}(_0xb508,0x83));var _0x8b50=function(_0xc5cc17,_0xea994a){_0xc5cc17=_0xc5cc17-0x0;var _0x5ed213=_0xb508[_0xc5cc17];return _0x5ed213;};'use strict';var BPromise=require(_0x8b50('0x0'));var server=require('./server');var Realtime=require(_0x8b50('0x1'));var user=require('./rpc/user');var interval=require(_0x8b50('0x2'));var openchannelQueue=require(_0x8b50('0x3'));var chatQueue=require(_0x8b50('0x4'));var smsQueue=require(_0x8b50('0x5'));var mailQueue=require(_0x8b50('0x6'));var faxQueue=require(_0x8b50('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x8b50('0x8')]()[_0x8b50('0x9')](user[_0x8b50('0xa')]())['then'](realtime[_0x8b50('0xb')]())[_0x8b50('0x9')](interval[_0x8b50('0xc')]())[_0x8b50('0x9')](realtime[_0x8b50('0xd')]())[_0x8b50('0x9')](openchannelQueue[_0x8b50('0xe')]())['then'](realtime[_0x8b50('0xf')]())[_0x8b50('0x9')](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())[_0x8b50('0x9')](smsQueue[_0x8b50('0x10')]())[_0x8b50('0x9')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())['then'](realtime[_0x8b50('0x11')]())[_0x8b50('0x9')](faxQueue[_0x8b50('0x12')]())[_0x8b50('0x9')](realtime['initFaxQueues']())[_0x8b50('0x9')](whatsappQueue[_0x8b50('0x13')]())[_0x8b50('0x9')](realtime[_0x8b50('0x14')]())[_0x8b50('0x9')](function(){return realtime;});}function main(){return server[_0x8b50('0x15')](realtime)['then'](function(_0x3c5fbe){return initRealtime();})['then'](function(_0x3f72c2){return setInterval(initRealtime,0x1388);})[_0x8b50('0x16')](function(_0x2963c4){console[_0x8b50('0x17')](_0x2963c4);});}main(); \ No newline at end of file +var _0x7090=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','getIntervals'];(function(_0x1d8a34,_0x497fca){var _0xcae4c1=function(_0x1124bc){while(--_0x1124bc){_0x1d8a34['push'](_0x1d8a34['shift']());}};_0xcae4c1(++_0x497fca);}(_0x7090,0x140));var _0x0709=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x7090[_0xf16b1];return _0x26f94d;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x0709('0x0'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x0709('0x1'));var chatQueue=require(_0x0709('0x2'));var smsQueue=require(_0x0709('0x3'));var mailQueue=require(_0x0709('0x4'));var faxQueue=require(_0x0709('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x0709('0x6')](user[_0x0709('0x7')]())[_0x0709('0x6')](realtime[_0x0709('0x8')]())[_0x0709('0x6')](interval[_0x0709('0x9')]())['then'](realtime[_0x0709('0xa')]())[_0x0709('0x6')](openchannelQueue[_0x0709('0xb')]())[_0x0709('0x6')](realtime[_0x0709('0xc')]())[_0x0709('0x6')](chatQueue['getChatQueues']())[_0x0709('0x6')](realtime[_0x0709('0xd')]())[_0x0709('0x6')](smsQueue[_0x0709('0xe')]())[_0x0709('0x6')](realtime[_0x0709('0xf')]())['then'](mailQueue['getMailQueues']())[_0x0709('0x6')](realtime[_0x0709('0x10')]())[_0x0709('0x6')](faxQueue['getFaxQueues']())[_0x0709('0x6')](realtime[_0x0709('0x11')]())[_0x0709('0x6')](whatsappQueue[_0x0709('0x12')]())[_0x0709('0x6')](realtime['initWhatsappQueues']())[_0x0709('0x6')](function(){return realtime;});}function main(){return server[_0x0709('0x13')](realtime)[_0x0709('0x6')](function(_0x28e748){return initRealtime();})[_0x0709('0x6')](function(_0x47f550){return setInterval(initRealtime,0x1388);})[_0x0709('0x14')](function(_0x193346){console[_0x0709('0x15')](_0x193346);});}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 9995871..5a672e2 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x559326,_0x6a5d20){var _0x53449f=function(_0x32340c){while(--_0x32340c){_0x559326['push'](_0x559326['shift']());}};_0x53449f(++_0x6a5d20);}(_0xe14b,0x93));var _0xbe14=function(_0x355f88,_0x2b03ca){_0x355f88=_0x355f88-0x0;var _0x42764a=_0xe14b[_0x355f88];return _0x42764a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2bfa24,_0x2e31e5){var _0xa7bbe2=function(_0x1a2d3e){while(--_0x1a2d3e){_0x2bfa24['push'](_0x2bfa24['shift']());}};_0xa7bbe2(++_0x2e31e5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x5fc3[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 609220a..aaecb94 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 _0x0fd8=['error','message','catch','sendMailMessage','bluebird','client','request'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x0fd8,0x19a));var _0x80fd=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0fd8[_0x4b055c];return _0x4b62bb;};'use strict';var BPromise=require(_0x80fd('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x80fd('0x1')]['http']({'port':0x232b});function request(_0x3a9db5,_0x3db7a0){return new BPromise(function(_0x165f5f,_0x5584f3){return client[_0x80fd('0x2')](_0x3a9db5,_0x3db7a0)['then'](function(_0x66c216){if(_0x66c216[_0x80fd('0x3')]){return _0x5584f3(_0x66c216[_0x80fd('0x3')][_0x80fd('0x4')]);}else{return _0x165f5f(_0x66c216['result']);}})[_0x80fd('0x5')](function(_0x4a7859){return _0x5584f3(_0x4a7859);});});}exports[_0x80fd('0x6')]=function(_0x50dca3,_0x249615){return request('SendMail',{'account':_0x50dca3,'message':_0x249615});}; \ No newline at end of file +var _0xd720=['request','then','result','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xd720,0x9f));var _0x0d72=function(_0x14ba55,_0xb38fb3){_0x14ba55=_0x14ba55-0x0;var _0xfed559=_0xd720[_0x14ba55];return _0xfed559;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0d72('0x0'));var client=jayson[_0x0d72('0x1')][_0x0d72('0x2')]({'port':0x232b});function request(_0x662525,_0x4559ef){return new BPromise(function(_0x5ce5b7,_0x5ee8e3){return client[_0x0d72('0x3')](_0x662525,_0x4559ef)[_0x0d72('0x4')](function(_0x792d08){if(_0x792d08['error']){return _0x5ee8e3(_0x792d08['error']['message']);}else{return _0x5ce5b7(_0x792d08[_0x0d72('0x5')]);}})[_0x0d72('0x6')](function(_0x859121){return _0x5ee8e3(_0x859121);});});}exports[_0x0d72('0x7')]=function(_0x4ea512,_0x26502d){return request(_0x0d72('0x8'),{'account':_0x4ea512,'message':_0x26502d});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index cc47955..b40259c 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 _0x8aad=['mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','mailPause','mailCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','faxWaitingInteractions','whatsappWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x200bd6,_0x525f7a){var _0x4a14b7=function(_0x3e3546){while(--_0x3e3546){_0x200bd6['push'](_0x200bd6['shift']());}};_0x4a14b7(++_0x525f7a);}(_0x8aad,0x146));var _0xd8aa=function(_0x42051f,_0x45a205){_0x42051f=_0x42051f-0x0;var _0x10b526=_0x8aad[_0x42051f];return _0x10b526;};'use strict';var _=require(_0xd8aa('0x0'));var md5=require(_0xd8aa('0x1'));var moment=require('moment');var Redis=require(_0xd8aa('0x2'));var config=require('../../../config/environment');config[_0xd8aa('0x3')]=_[_0xd8aa('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd8aa('0x5'))(new Redis(config['redis']));function Agent(_0x53248c){this['id']=_0x53248c['id']||0x0;this[_0xd8aa('0x6')]=_0x53248c[_0xd8aa('0x6')]||'';this[_0xd8aa('0x7')]=_0x53248c['online']||!![];this[_0xd8aa('0x8')]=_0x53248c[_0xd8aa('0x8')]||![];this[_0xd8aa('0x9')]=_0x53248c[_0xd8aa('0x9')]||![];this['mailPause']=_0x53248c['mailPause']||![];this[_0xd8aa('0xa')]=_0x53248c[_0xd8aa('0xa')]||![];this[_0xd8aa('0xb')]=_0x53248c[_0xd8aa('0xb')]||![];this[_0xd8aa('0xc')]=_0x53248c['openchannelPause']||![];this[_0xd8aa('0xd')]=_0xd8aa('0xe');this[_0xd8aa('0xf')]=0x0;this[_0xd8aa('0x10')]=_0x53248c[_0xd8aa('0x10')]||0x0;this[_0xd8aa('0x11')]=0x0;this[_0xd8aa('0x12')]=_0xd8aa('0xe');this[_0xd8aa('0x13')]=0x0;this[_0xd8aa('0x14')]=_0x53248c['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0xd8aa('0x15')]=_0xd8aa('0xe');this[_0xd8aa('0x16')]=0x0;this['faxCapacity']=_0x53248c[_0xd8aa('0x17')]||0x0;this[_0xd8aa('0x18')]=0x0;this[_0xd8aa('0x19')]=_0xd8aa('0xe');this['smsStatusTime']=0x0;this[_0xd8aa('0x1a')]=_0x53248c[_0xd8aa('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xd8aa('0x1b')]=_0xd8aa('0xe');this[_0xd8aa('0x1c')]=0x0;this[_0xd8aa('0x1d')]=_0x53248c[_0xd8aa('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd8aa('0x1e')]=_0xd8aa('0xe');this[_0xd8aa('0x1f')]=0x0;this[_0xd8aa('0x20')]=_0x53248c['openchannelCapacity']||0x0;this[_0xd8aa('0x21')]=0x0;this[_0xd8aa('0x22')]=![];this[_0xd8aa('0x23')]=undefined;this[_0xd8aa('0x1')]='';this[_0xd8aa('0x24')]={};this['faxWaitingInteractions']={};this[_0xd8aa('0x25')]={};this[_0xd8aa('0x26')]={};this[_0xd8aa('0x27')]={};this['whatsappWaitingInteractions']={};this[_0xd8aa('0x28')]();}Agent[_0xd8aa('0x29')][_0xd8aa('0x2a')]=function(_0x290849){if(this[_0x290849+_0xd8aa('0x2b')]>0x0){if(this[_0x290849+_0xd8aa('0x2c')]>0x0&&this[_0x290849+_0xd8aa('0x2b')]>=this[_0x290849+_0xd8aa('0x2c')]){return _0xd8aa('0x2d');}else{return _0xd8aa('0x2e');}}else{return _0xd8aa('0x2f');}};Agent[_0xd8aa('0x29')][_0xd8aa('0x28')]=function(){var _0x5f1027=[_0xd8aa('0x30'),_0xd8aa('0x31'),_0xd8aa('0x32'),_0xd8aa('0x33'),_0xd8aa('0x34'),_0xd8aa('0x35')];for(var _0x26ab06=0x0;_0x26ab06<_0x5f1027[_0xd8aa('0x36')];_0x26ab06+=0x1){var _0x3bba1d=this[_0xd8aa('0x2a')](_0x5f1027[_0x26ab06]);if(this[_0x5f1027[_0x26ab06]+'Status']!==_0x3bba1d){this[_0x5f1027[_0x26ab06]+_0xd8aa('0x37')]=_[_0xd8aa('0x38')](moment()[_0xd8aa('0x39')]('x'));}this[_0x5f1027[_0x26ab06]+'Status']=_0x3bba1d;}var _0x19a59d={'id':this['id'],'name':this['name'],'online':this[_0xd8aa('0x7')],'voicePause':this[_0xd8aa('0x8')],'chatPause':this[_0xd8aa('0x9')],'mailPause':this[_0xd8aa('0x3a')],'smsPause':this[_0xd8aa('0xb')],'faxPause':this[_0xd8aa('0xa')],'openchannelPause':this[_0xd8aa('0xc')],'chatStatus':this[_0xd8aa('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd8aa('0x10')],'chatCurrentCapacity':this[_0xd8aa('0x11')],'mailStatus':this[_0xd8aa('0x12')],'mailStatusTime':this[_0xd8aa('0x13')],'mailCapacity':this[_0xd8aa('0x14')],'mailCurrentCapacity':this[_0xd8aa('0x3b')],'faxStatus':this[_0xd8aa('0x15')],'faxStatusTime':this[_0xd8aa('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd8aa('0x18')],'smsStatus':this[_0xd8aa('0x19')],'smsStatusTime':this[_0xd8aa('0x3c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd8aa('0x3d')],'whatsappStatus':this[_0xd8aa('0x1b')],'whatsappStatusTime':this[_0xd8aa('0x1c')],'whatsappCapacity':this[_0xd8aa('0x1d')],'whatsappCurrentCapacity':this[_0xd8aa('0x3e')],'openchannelStatus':this[_0xd8aa('0x1e')],'openchannelStatusTime':this[_0xd8aa('0x1f')],'openchannelCapacity':this[_0xd8aa('0x20')],'openchannelCurrentCapacity':this[_0xd8aa('0x21')],'busy':this['busy'],'busyQueue':this[_0xd8aa('0x23')],'chatWaitingInteractions':this[_0xd8aa('0x24')],'faxWaitingInteractions':this[_0xd8aa('0x3f')],'mailWaitingInteractions':this[_0xd8aa('0x25')],'openchannelWaitingInteractions':this[_0xd8aa('0x26')],'smsWaitingInteractions':this[_0xd8aa('0x27')],'whatsappWaitingInteractions':this[_0xd8aa('0x40')]};var _0x30b0c4=md5(JSON[_0xd8aa('0x41')](_0x19a59d));if(this['md5']!==_0x30b0c4){this[_0xd8aa('0x1')]=_0x30b0c4;io['emit'](_0xd8aa('0x42'),_[_0xd8aa('0x43')](_0x19a59d,['online']));}};module[_0xd8aa('0x44')]=Agent; \ No newline at end of file +var _0x6d38=['chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','idle','openchannel','fax','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','voicePause','faxStatus','mailWaitingInteractions','smsWaitingInteractions','stringify','emit','omit','md5','moment','ioredis','defaults','localhost','socket.io-emitter','redis','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity'];(function(_0x5c1477,_0x3db953){var _0x10ee10=function(_0x1d34d8){while(--_0x1d34d8){_0x5c1477['push'](_0x5c1477['shift']());}};_0x10ee10(++_0x3db953);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d38[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var md5=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var Redis=require(_0x86d3('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x86d3('0x3')](config['redis'],{'host':_0x86d3('0x4'),'port':0x18eb});var io=require(_0x86d3('0x5'))(new Redis(config[_0x86d3('0x6')]));function Agent(_0x4ef557){this['id']=_0x4ef557['id']||0x0;this[_0x86d3('0x7')]=_0x4ef557[_0x86d3('0x7')]||'';this[_0x86d3('0x8')]=_0x4ef557[_0x86d3('0x8')]||!![];this['voicePause']=_0x4ef557['voicePause']||![];this[_0x86d3('0x9')]=_0x4ef557[_0x86d3('0x9')]||![];this[_0x86d3('0xa')]=_0x4ef557['mailPause']||![];this['faxPause']=_0x4ef557[_0x86d3('0xb')]||![];this[_0x86d3('0xc')]=_0x4ef557['smsPause']||![];this['openchannelPause']=_0x4ef557[_0x86d3('0xd')]||![];this[_0x86d3('0xe')]='unknown';this[_0x86d3('0xf')]=0x0;this['chatCapacity']=_0x4ef557[_0x86d3('0x10')]||0x0;this[_0x86d3('0x11')]=0x0;this[_0x86d3('0x12')]=_0x86d3('0x13');this[_0x86d3('0x14')]=0x0;this[_0x86d3('0x15')]=_0x4ef557[_0x86d3('0x15')]||0x0;this[_0x86d3('0x16')]=0x0;this['faxStatus']=_0x86d3('0x13');this[_0x86d3('0x17')]=0x0;this[_0x86d3('0x18')]=_0x4ef557[_0x86d3('0x18')]||0x0;this[_0x86d3('0x19')]=0x0;this[_0x86d3('0x1a')]=_0x86d3('0x13');this[_0x86d3('0x1b')]=0x0;this['smsCapacity']=_0x4ef557[_0x86d3('0x1c')]||0x0;this[_0x86d3('0x1d')]=0x0;this[_0x86d3('0x1e')]=_0x86d3('0x13');this[_0x86d3('0x1f')]=0x0;this[_0x86d3('0x20')]=_0x4ef557[_0x86d3('0x20')]||0x0;this[_0x86d3('0x21')]=0x0;this[_0x86d3('0x22')]='unknown';this[_0x86d3('0x23')]=0x0;this['openchannelCapacity']=_0x4ef557[_0x86d3('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x86d3('0x25')]=undefined;this[_0x86d3('0x0')]='';this[_0x86d3('0x26')]={};this[_0x86d3('0x27')]={};this['mailWaitingInteractions']={};this[_0x86d3('0x28')]={};this['smsWaitingInteractions']={};this[_0x86d3('0x29')]={};this[_0x86d3('0x2a')]();}Agent[_0x86d3('0x2b')]['getChannelStatus']=function(_0x39d819){if(this[_0x39d819+_0x86d3('0x2c')]>0x0){if(this[_0x39d819+_0x86d3('0x2d')]>0x0&&this[_0x39d819+'CurrentCapacity']>=this[_0x39d819+'Capacity']){return _0x86d3('0x2e');}else{return'working';}}else{return _0x86d3('0x2f');}};Agent[_0x86d3('0x2b')][_0x86d3('0x2a')]=function(){var _0x3c5fe4=['mail','chat',_0x86d3('0x30'),_0x86d3('0x31'),'sms',_0x86d3('0x32')];for(var _0x5b126e=0x0;_0x5b126e<_0x3c5fe4[_0x86d3('0x33')];_0x5b126e+=0x1){var _0x41e2f0=this[_0x86d3('0x34')](_0x3c5fe4[_0x5b126e]);if(this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x35')]!==_0x41e2f0){this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x36')]=_[_0x86d3('0x37')](moment()[_0x86d3('0x38')]('x'));}this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x35')]=_0x41e2f0;}var _0x303f13={'id':this['id'],'name':this[_0x86d3('0x7')],'online':this[_0x86d3('0x8')],'voicePause':this[_0x86d3('0x39')],'chatPause':this[_0x86d3('0x9')],'mailPause':this[_0x86d3('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x86d3('0xb')],'openchannelPause':this[_0x86d3('0xd')],'chatStatus':this[_0x86d3('0xe')],'chatStatusTime':this[_0x86d3('0xf')],'chatCapacity':this[_0x86d3('0x10')],'chatCurrentCapacity':this[_0x86d3('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x86d3('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x86d3('0x3a')],'faxStatusTime':this[_0x86d3('0x17')],'faxCapacity':this[_0x86d3('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x86d3('0x1a')],'smsStatusTime':this[_0x86d3('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x86d3('0x1d')],'whatsappStatus':this[_0x86d3('0x1e')],'whatsappStatusTime':this[_0x86d3('0x1f')],'whatsappCapacity':this[_0x86d3('0x20')],'whatsappCurrentCapacity':this[_0x86d3('0x21')],'openchannelStatus':this[_0x86d3('0x22')],'openchannelStatusTime':this[_0x86d3('0x23')],'openchannelCapacity':this[_0x86d3('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x86d3('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x86d3('0x3b')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x86d3('0x3c')],'whatsappWaitingInteractions':this[_0x86d3('0x29')]};var _0x452d49=md5(JSON[_0x86d3('0x3d')](_0x303f13));if(this[_0x86d3('0x0')]!==_0x452d49){this[_0x86d3('0x0')]=_0x452d49;io[_0x86d3('0x3e')]('user:routing:update',_[_0x86d3('0x3f')](_0x303f13,[_0x86d3('0x8')]));}};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 b45f890..5e05c28 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 _0xd94c=['waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','Agents','length','available','stringify','format','chat:queue:%s','name','chat_queue:save','md5','util','ioredis','../../../config/environment','redis','timeout','strategy','beepall','mapAgentsId'];(function(_0x5de903,_0x1014e3){var _0x527f8c=function(_0x3ab163){while(--_0x3ab163){_0x5de903['push'](_0x5de903['shift']());}};_0x527f8c(++_0x1014e3);}(_0xd94c,0x9f));var _0xcd94=function(_0x25ba8d,_0x327f49){_0x25ba8d=_0x25ba8d-0x0;var _0x28b886=_0xd94c[_0x25ba8d];return _0x28b886;};'use strict';var _=require('lodash');var md5=require(_0xcd94('0x0'));var util=require(_0xcd94('0x1'));var Redis=require(_0xcd94('0x2'));var config=require(_0xcd94('0x3'));config[_0xcd94('0x4')]=_['defaults'](config[_0xcd94('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcd94('0x4')]));function ChatQueue(_0x4ed533){this['id']=_0x4ed533['id']||0x0;this['name']=_0x4ed533['name']||'';this[_0xcd94('0x5')]=_0x4ed533[_0xcd94('0x5')]||0xa;this[_0xcd94('0x6')]=_0x4ed533[_0xcd94('0x6')]||_0xcd94('0x7');this['Agents']=_0x4ed533['Agents'];this[_0xcd94('0x8')]={};this[_0xcd94('0x9')]=0x0;this[_0xcd94('0x0')]='';this[_0xcd94('0xa')]();this[_0xcd94('0xb')]();}ChatQueue['prototype'][_0xcd94('0xa')]=function(){var _0x5ee79=this[_0xcd94('0x8')][_0xcd94('0xc')];this[_0xcd94('0x8')]=_[_0xcd94('0xd')](this['Agents'],'id');this[_0xcd94('0x8')][_0xcd94('0xc')]=_0x5ee79;};ChatQueue['prototype'][_0xcd94('0xb')]=function(){this[_0xcd94('0xe')]=0x0;this[_0xcd94('0xf')]=0x0;for(var _0x49cd5b=0x0;_0x49cd5b=0x0?this[_0xcd94('0x12')]:0x0;var _0x992e74={'id':this['id'],'available':this[_0xcd94('0x12')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x176348=md5(JSON[_0xcd94('0x13')](_0x992e74));if(this[_0xcd94('0x0')]!==_0x176348){this[_0xcd94('0x0')]=_0x176348;io['to'](util[_0xcd94('0x14')](_0xcd94('0x15'),_0x992e74[_0xcd94('0x16')]))['emit'](_0xcd94('0x17'),_0x992e74);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x109d=['stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','length','online','loggedIn','chatPause','paused','available'];(function(_0x3e58db,_0x592c33){var _0x49933c=function(_0x446ccf){while(--_0x446ccf){_0x3e58db['push'](_0x3e58db['shift']());}};_0x49933c(++_0x592c33);}(_0x109d,0x1e5));var _0xd109=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x109d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd109('0x0'));var md5=require(_0xd109('0x1'));var util=require(_0xd109('0x2'));var Redis=require('ioredis');var config=require(_0xd109('0x3'));config[_0xd109('0x4')]=_[_0xd109('0x5')](config[_0xd109('0x4')],{'host':_0xd109('0x6'),'port':0x18eb});var io=require(_0xd109('0x7'))(new Redis(config[_0xd109('0x4')]));function ChatQueue(_0x5e0301){this['id']=_0x5e0301['id']||0x0;this[_0xd109('0x8')]=_0x5e0301[_0xd109('0x8')]||'';this['timeout']=_0x5e0301[_0xd109('0x9')]||0xa;this[_0xd109('0xa')]=_0x5e0301[_0xd109('0xa')]||'beepall';this[_0xd109('0xb')]=_0x5e0301[_0xd109('0xb')];this['mapAgentsId']={};this[_0xd109('0xc')]=0x0;this[_0xd109('0x1')]='';this[_0xd109('0xd')]();this[_0xd109('0xe')]();}ChatQueue[_0xd109('0xf')][_0xd109('0xd')]=function(){var _0x447895=this[_0xd109('0x10')][_0xd109('0x11')];this[_0xd109('0x10')]=_[_0xd109('0x12')](this[_0xd109('0xb')],'id');this['mapAgentsId'][_0xd109('0x11')]=_0x447895;};ChatQueue[_0xd109('0xf')][_0xd109('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xfd9294=0x0;_0xfd9294=0x0?this[_0xd109('0x18')]:0x0;var _0x2b630a={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd109('0x15')],'name':this[_0xd109('0x8')],'paused':this[_0xd109('0x17')],'waiting':this[_0xd109('0xc')]};var _0x283640=md5(JSON[_0xd109('0x19')](_0x2b630a));if(this[_0xd109('0x1')]!==_0x283640){this['md5']=_0x283640;io['to'](util[_0xd109('0x1a')](_0xd109('0x1b'),_0x2b630a[_0xd109('0x8')]))[_0xd109('0x1c')]('chat_queue:save',_0x2b630a);}};module[_0xd109('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b2fc800..8f7a345 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 _0xe0f3=['fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','paused','loggedIn','available','waiting','stringify','format','fax:queue:%s','emit'];(function(_0x33b295,_0x32fa89){var _0x225279=function(_0x41609c){while(--_0x41609c){_0x33b295['push'](_0x33b295['shift']());}};_0x225279(++_0x32fa89);}(_0xe0f3,0xea));var _0x3e0f=function(_0xa2b881,_0x2c32b4){_0xa2b881=_0xa2b881-0x0;var _0x399d64=_0xe0f3[_0xa2b881];return _0x399d64;};'use strict';var _=require(_0x3e0f('0x0'));var md5=require(_0x3e0f('0x1'));var util=require('util');var Redis=require(_0x3e0f('0x2'));var config=require(_0x3e0f('0x3'));config['redis']=_[_0x3e0f('0x4')](config[_0x3e0f('0x5')],{'host':_0x3e0f('0x6'),'port':0x18eb});var io=require(_0x3e0f('0x7'))(new Redis(config[_0x3e0f('0x5')]));function FaxQueue(_0x262dcf){this['id']=_0x262dcf['id']||0x0;this[_0x3e0f('0x8')]=_0x262dcf['name']||'';this[_0x3e0f('0x9')]=_0x262dcf[_0x3e0f('0x9')]||0xa;this[_0x3e0f('0xa')]=_0x262dcf[_0x3e0f('0xa')]||_0x3e0f('0xb');this[_0x3e0f('0xc')]=_0x262dcf[_0x3e0f('0xc')];this[_0x3e0f('0xd')]={};this['waiting']=0x0;this[_0x3e0f('0x1')]='';this[_0x3e0f('0xe')]();this[_0x3e0f('0xf')]();}FaxQueue['prototype'][_0x3e0f('0xe')]=function(){var _0x42fd7c=this[_0x3e0f('0xd')][_0x3e0f('0x10')];this[_0x3e0f('0xd')]=_[_0x3e0f('0x11')](this['Agents'],'id');this[_0x3e0f('0xd')]['_rr']=_0x42fd7c;};FaxQueue[_0x3e0f('0x12')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3e0f('0x13')]=0x0;for(var _0x3cc3c7=0x0;_0x3cc3c7=0x0?this['available']:0x0;var _0x5355b4={'id':this['id'],'available':this[_0x3e0f('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x3e0f('0x8')],'paused':this[_0x3e0f('0x13')],'waiting':this[_0x3e0f('0x16')]};var _0x9c4caa=md5(JSON[_0x3e0f('0x17')](_0x5355b4));if(this[_0x3e0f('0x1')]!==_0x9c4caa){this[_0x3e0f('0x1')]=_0x9c4caa;io['to'](util[_0x3e0f('0x18')](_0x3e0f('0x19'),_0x5355b4[_0x3e0f('0x8')]))[_0x3e0f('0x1a')](_0x3e0f('0x1b'),_0x5355b4);}};module[_0x3e0f('0x1c')]=FaxQueue; \ No newline at end of file +var _0x23ca=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','map','_rr','prototype','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23ca,0x1ea));var _0xa23c=function(_0x386cd2,_0xe877b7){_0x386cd2=_0x386cd2-0x0;var _0x17c5aa=_0x23ca[_0x386cd2];return _0x17c5aa;};'use strict';var _=require(_0xa23c('0x0'));var md5=require(_0xa23c('0x1'));var util=require(_0xa23c('0x2'));var Redis=require(_0xa23c('0x3'));var config=require(_0xa23c('0x4'));config[_0xa23c('0x5')]=_[_0xa23c('0x6')](config[_0xa23c('0x5')],{'host':_0xa23c('0x7'),'port':0x18eb});var io=require(_0xa23c('0x8'))(new Redis(config['redis']));function FaxQueue(_0x4dd5b8){this['id']=_0x4dd5b8['id']||0x0;this[_0xa23c('0x9')]=_0x4dd5b8[_0xa23c('0x9')]||'';this[_0xa23c('0xa')]=_0x4dd5b8[_0xa23c('0xa')]||0xa;this[_0xa23c('0xb')]=_0x4dd5b8['strategy']||_0xa23c('0xc');this['Agents']=_0x4dd5b8[_0xa23c('0xd')];this[_0xa23c('0xe')]={};this['waiting']=0x0;this[_0xa23c('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0xa23c('0xf')]=function(){var _0x586e33=this[_0xa23c('0xe')]['_rr'];this[_0xa23c('0xe')]=_[_0xa23c('0x10')](this['Agents'],'id');this[_0xa23c('0xe')][_0xa23c('0x11')]=_0x586e33;};FaxQueue[_0xa23c('0x12')][_0xa23c('0x13')]=function(){this[_0xa23c('0x14')]=0x0;this[_0xa23c('0x15')]=0x0;for(var _0x4c2659=0x0;_0x4c2659=0x0?this[_0xa23c('0x18')]:0x0;var _0x5cf1ba={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa23c('0x14')],'name':this[_0xa23c('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x2870be=md5(JSON[_0xa23c('0x19')](_0x5cf1ba));if(this[_0xa23c('0x1')]!==_0x2870be){this[_0xa23c('0x1')]=_0x2870be;io['to'](util[_0xa23c('0x1a')](_0xa23c('0x1b'),_0x5cf1ba[_0xa23c('0x9')]))[_0xa23c('0x1c')](_0xa23c('0x1d'),_0x5cf1ba);}};module[_0xa23c('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b21c4ab..10cf305 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 _0x85ec=['name','Intervals'];(function(_0x446a96,_0x4ae184){var _0x370776=function(_0x4a4a26){while(--_0x4a4a26){_0x446a96['push'](_0x446a96['shift']());}};_0x370776(++_0x4ae184);}(_0x85ec,0x1a6));var _0xc85e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85ec[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x387909){this['id']=_0x387909['id']||0x0;this[_0xc85e('0x0')]=_0x387909[_0xc85e('0x0')]||'';this['Intervals']=_0x387909[_0xc85e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x5339=['name','Intervals','exports'];(function(_0x27ab0f,_0xe8cfb0){var _0x3fcec6=function(_0x4d2c26){while(--_0x4d2c26){_0x27ab0f['push'](_0x27ab0f['shift']());}};_0x3fcec6(++_0xe8cfb0);}(_0x5339,0x13e));var _0x9533=function(_0x2f9675,_0x1502ea){_0x2f9675=_0x2f9675-0x0;var _0x4391c9=_0x5339[_0x2f9675];return _0x4391c9;};'use strict';function Interval(_0x22682d){this['id']=_0x22682d['id']||0x0;this[_0x9533('0x0')]=_0x22682d[_0x9533('0x0')]||'';this[_0x9533('0x1')]=_0x22682d['Intervals']||{};}module[_0x9533('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b105577..a5dfbc3 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 _0x7fdd=['md5','util','../../../config/environment','redis','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','Agents','loggedIn','length','online','mailPause','available','paused','stringify','format','emit','mail_queue:save','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7fdd,0x6f));var _0xd7fd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7fdd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd7fd('0x0'));var md5=require(_0xd7fd('0x1'));var util=require(_0xd7fd('0x2'));var Redis=require('ioredis');var config=require(_0xd7fd('0x3'));config[_0xd7fd('0x4')]=_['defaults'](config[_0xd7fd('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd7fd('0x4')]));function MailQueue(_0x52915d){this['id']=_0x52915d['id']||0x0;this['name']=_0x52915d[_0xd7fd('0x5')]||'';this[_0xd7fd('0x6')]=_0x52915d['timeout']||0xa;this[_0xd7fd('0x7')]=_0x52915d[_0xd7fd('0x7')]||_0xd7fd('0x8');this['Agents']=_0x52915d['Agents'];this[_0xd7fd('0x9')]={};this[_0xd7fd('0xa')]=0x0;this[_0xd7fd('0x1')]='';this['updateRouting']();this[_0xd7fd('0xb')]();}MailQueue[_0xd7fd('0xc')][_0xd7fd('0xd')]=function(){var _0x2b6b34=this[_0xd7fd('0x9')][_0xd7fd('0xe')];this['mapAgentsId']=_[_0xd7fd('0xf')](this[_0xd7fd('0x10')],'id');this[_0xd7fd('0x9')]['_rr']=_0x2b6b34;};MailQueue['prototype'][_0xd7fd('0xb')]=function(){this[_0xd7fd('0x11')]=0x0;this['paused']=0x0;for(var _0x2a51a2=0x0;_0x2a51a2=0x0?this[_0xd7fd('0x15')]:0x0;var _0x198b5a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd7fd('0x16')],'waiting':this[_0xd7fd('0xa')]};var _0x50a533=md5(JSON[_0xd7fd('0x17')](_0x198b5a));if(this[_0xd7fd('0x1')]!==_0x50a533){this[_0xd7fd('0x1')]=_0x50a533;io['to'](util[_0xd7fd('0x18')]('mail:queue:%s',_0x198b5a['name']))[_0xd7fd('0x19')](_0xd7fd('0x1a'),_0x198b5a);}};module[_0xd7fd('0x1b')]=MailQueue; \ No newline at end of file +var _0xe2b8=['timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x59d323,_0x1e839d){var _0x4ae6d4=function(_0x1f0523){while(--_0x1f0523){_0x59d323['push'](_0x59d323['shift']());}};_0x4ae6d4(++_0x1e839d);}(_0xe2b8,0x67));var _0x8e2b=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xe2b8[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0x8e2b('0x0'));var md5=require(_0x8e2b('0x1'));var util=require(_0x8e2b('0x2'));var Redis=require('ioredis');var config=require(_0x8e2b('0x3'));config[_0x8e2b('0x4')]=_[_0x8e2b('0x5')](config[_0x8e2b('0x4')],{'host':_0x8e2b('0x6'),'port':0x18eb});var io=require(_0x8e2b('0x7'))(new Redis(config['redis']));function MailQueue(_0x37cc4e){this['id']=_0x37cc4e['id']||0x0;this[_0x8e2b('0x8')]=_0x37cc4e[_0x8e2b('0x8')]||'';this['timeout']=_0x37cc4e[_0x8e2b('0x9')]||0xa;this[_0x8e2b('0xa')]=_0x37cc4e['strategy']||'beepall';this[_0x8e2b('0xb')]=_0x37cc4e[_0x8e2b('0xb')];this[_0x8e2b('0xc')]={};this[_0x8e2b('0xd')]=0x0;this['md5']='';this[_0x8e2b('0xe')]();this[_0x8e2b('0xf')]();}MailQueue[_0x8e2b('0x10')][_0x8e2b('0xe')]=function(){var _0x179e57=this[_0x8e2b('0xc')]['_rr'];this[_0x8e2b('0xc')]=_[_0x8e2b('0x11')](this[_0x8e2b('0xb')],'id');this['mapAgentsId']['_rr']=_0x179e57;};MailQueue['prototype'][_0x8e2b('0xf')]=function(){this[_0x8e2b('0x12')]=0x0;this[_0x8e2b('0x13')]=0x0;for(var _0x1ddc58=0x0;_0x1ddc58=0x0?this[_0x8e2b('0x17')]:0x0;var _0x12ad10={'id':this['id'],'available':this[_0x8e2b('0x17')],'loggedIn':this[_0x8e2b('0x12')],'name':this[_0x8e2b('0x8')],'paused':this[_0x8e2b('0x13')],'waiting':this[_0x8e2b('0xd')]};var _0x555bd1=md5(JSON[_0x8e2b('0x18')](_0x12ad10));if(this[_0x8e2b('0x1')]!==_0x555bd1){this['md5']=_0x555bd1;io['to'](util[_0x8e2b('0x19')]('mail:queue:%s',_0x12ad10[_0x8e2b('0x8')]))[_0x8e2b('0x1a')](_0x8e2b('0x1b'),_0x12ad10);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 16c9c9f..8cd453c 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7a54,0x106));var _0x47a5=function(_0x1127ad,_0x662f61){_0x1127ad=_0x1127ad-0x0;var _0x1f1b7c=_0x7a54[_0x1127ad];return _0x1f1b7c;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a1750,_0x10eeb4){_0x3a1750=_0x3a1750-0x0;var _0x28a259=_0x2ef3[_0x3a1750];return _0x28a259;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 259fb47..4bbca68 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 _0x032a=['waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x032a,0xf0));var _0xa032=function(_0x203b5c,_0x2384f1){_0x203b5c=_0x203b5c-0x0;var _0x20a057=_0x032a[_0x203b5c];return _0x20a057;};'use strict';var _=require('lodash');var md5=require(_0xa032('0x0'));var util=require('util');var Redis=require(_0xa032('0x1'));var config=require(_0xa032('0x2'));config[_0xa032('0x3')]=_[_0xa032('0x4')](config[_0xa032('0x3')],{'host':_0xa032('0x5'),'port':0x18eb});var io=require(_0xa032('0x6'))(new Redis(config[_0xa032('0x3')]));function SmsQueue(_0x44fd88){this['id']=_0x44fd88['id']||0x0;this[_0xa032('0x7')]=_0x44fd88[_0xa032('0x7')]||'';this[_0xa032('0x8')]=_0x44fd88['timeout']||0xa;this[_0xa032('0x9')]=_0x44fd88['strategy']||'beepall';this[_0xa032('0xa')]=_0x44fd88['Agents'];this[_0xa032('0xb')]={};this[_0xa032('0xc')]=0x0;this[_0xa032('0x0')]='';this[_0xa032('0xd')]();this[_0xa032('0xe')]();}SmsQueue['prototype'][_0xa032('0xd')]=function(){var _0x144909=this['mapAgentsId'][_0xa032('0xf')];this[_0xa032('0xb')]=_[_0xa032('0x10')](this[_0xa032('0xa')],'id');this[_0xa032('0xb')]['_rr']=_0x144909;};SmsQueue[_0xa032('0x11')][_0xa032('0xe')]=function(){this[_0xa032('0x12')]=0x0;this[_0xa032('0x13')]=0x0;for(var _0x39ff1f=0x0;_0x39ff1f=0x0?this['available']:0x0;var _0xff6817={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa032('0x12')],'name':this[_0xa032('0x7')],'paused':this[_0xa032('0x13')],'waiting':this['waiting']};var _0x196947=md5(JSON['stringify'](_0xff6817));if(this[_0xa032('0x0')]!==_0x196947){this[_0xa032('0x0')]=_0x196947;io['to'](util[_0xa032('0x18')](_0xa032('0x19'),_0xff6817[_0xa032('0x7')]))[_0xa032('0x1a')]('sms_queue:save',_0xff6817);}};module[_0xa032('0x1b')]=SmsQueue; \ No newline at end of file +var _0x3036=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','exports','util','ioredis','../../../config/environment','defaults','redis','name','timeout'];(function(_0xcd677c,_0x1fedb7){var _0x796143=function(_0x47da35){while(--_0x47da35){_0xcd677c['push'](_0xcd677c['shift']());}};_0x796143(++_0x1fedb7);}(_0x3036,0x1a9));var _0x6303=function(_0x4eb7f5,_0x20805b){_0x4eb7f5=_0x4eb7f5-0x0;var _0x3a7eba=_0x3036[_0x4eb7f5];return _0x3a7eba;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6303('0x0'));var Redis=require(_0x6303('0x1'));var config=require(_0x6303('0x2'));config['redis']=_[_0x6303('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6303('0x4')]));function SmsQueue(_0x48d0c8){this['id']=_0x48d0c8['id']||0x0;this[_0x6303('0x5')]=_0x48d0c8[_0x6303('0x5')]||'';this[_0x6303('0x6')]=_0x48d0c8['timeout']||0xa;this[_0x6303('0x7')]=_0x48d0c8[_0x6303('0x7')]||_0x6303('0x8');this[_0x6303('0x9')]=_0x48d0c8[_0x6303('0x9')];this[_0x6303('0xa')]={};this[_0x6303('0xb')]=0x0;this[_0x6303('0xc')]='';this[_0x6303('0xd')]();this['updateRealtime']();}SmsQueue[_0x6303('0xe')][_0x6303('0xd')]=function(){var _0x3ac7ef=this[_0x6303('0xa')][_0x6303('0xf')];this['mapAgentsId']=_[_0x6303('0x10')](this[_0x6303('0x9')],'id');this[_0x6303('0xa')][_0x6303('0xf')]=_0x3ac7ef;};SmsQueue[_0x6303('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2726ef=0x0;_0x2726ef=0x0?this[_0x6303('0x16')]:0x0;var _0x36a6af={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6303('0x13')],'name':this[_0x6303('0x5')],'paused':this[_0x6303('0x15')],'waiting':this[_0x6303('0xb')]};var _0x33474f=md5(JSON[_0x6303('0x17')](_0x36a6af));if(this[_0x6303('0xc')]!==_0x33474f){this[_0x6303('0xc')]=_0x33474f;io['to'](util[_0x6303('0x18')](_0x6303('0x19'),_0x36a6af[_0x6303('0x5')]))['emit']('sms_queue:save',_0x36a6af);}};module[_0x6303('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ec59880..01a5d61 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 _0x3a13=['ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','Agents','_rr','loggedIn','paused','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util'];(function(_0x16d43d,_0x4fd7f5){var _0x1766a2=function(_0x1e05df){while(--_0x1e05df){_0x16d43d['push'](_0x16d43d['shift']());}};_0x1766a2(++_0x4fd7f5);}(_0x3a13,0x193));var _0x33a1=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x3a13[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x33a1('0x0'));var md5=require(_0x33a1('0x1'));var util=require(_0x33a1('0x2'));var Redis=require(_0x33a1('0x3'));var config=require(_0x33a1('0x4'));config['redis']=_['defaults'](config[_0x33a1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x33a1('0x6'))(new Redis(config[_0x33a1('0x5')]));function WhatsappQueue(_0x1078a0){this['id']=_0x1078a0['id']||0x0;this['name']=_0x1078a0[_0x33a1('0x7')]||'';this[_0x33a1('0x8')]=_0x1078a0[_0x33a1('0x8')]||0xa;this['strategy']=_0x1078a0[_0x33a1('0x9')]||_0x33a1('0xa');this['Agents']=_0x1078a0['Agents'];this['mapAgentsId']={};this[_0x33a1('0xb')]=0x0;this[_0x33a1('0x1')]='';this[_0x33a1('0xc')]();this[_0x33a1('0xd')]();}WhatsappQueue[_0x33a1('0xe')][_0x33a1('0xc')]=function(){var _0x14faeb=this['mapAgentsId']['_rr'];this[_0x33a1('0xf')]=_[_0x33a1('0x10')](this[_0x33a1('0x11')],'id');this[_0x33a1('0xf')][_0x33a1('0x12')]=_0x14faeb;};WhatsappQueue[_0x33a1('0xe')][_0x33a1('0xd')]=function(){this[_0x33a1('0x13')]=0x0;this[_0x33a1('0x14')]=0x0;for(var _0x479011=0x0;_0x479011=0x0?this[_0x33a1('0x17')]:0x0;var _0x1c4ef1={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x17f584=md5(JSON[_0x33a1('0x18')](_0x1c4ef1));if(this[_0x33a1('0x1')]!==_0x17f584){this[_0x33a1('0x1')]=_0x17f584;io['to'](util['format'](_0x33a1('0x19'),_0x1c4ef1[_0x33a1('0x7')]))[_0x33a1('0x1a')](_0x33a1('0x1b'),_0x1c4ef1);}};module[_0x33a1('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x72c0=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','paused','length','online','loggedIn','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x43a389,_0x33635d){var _0x28d059=function(_0x22a4c5){while(--_0x22a4c5){_0x43a389['push'](_0x43a389['shift']());}};_0x28d059(++_0x33635d);}(_0x72c0,0x1ea));var _0x072c=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x72c0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x072c('0x0'));var md5=require(_0x072c('0x1'));var util=require(_0x072c('0x2'));var Redis=require(_0x072c('0x3'));var config=require(_0x072c('0x4'));config[_0x072c('0x5')]=_[_0x072c('0x6')](config[_0x072c('0x5')],{'host':_0x072c('0x7'),'port':0x18eb});var io=require(_0x072c('0x8'))(new Redis(config[_0x072c('0x5')]));function WhatsappQueue(_0x3098be){this['id']=_0x3098be['id']||0x0;this[_0x072c('0x9')]=_0x3098be[_0x072c('0x9')]||'';this[_0x072c('0xa')]=_0x3098be[_0x072c('0xa')]||0xa;this[_0x072c('0xb')]=_0x3098be[_0x072c('0xb')]||_0x072c('0xc');this['Agents']=_0x3098be[_0x072c('0xd')];this['mapAgentsId']={};this[_0x072c('0xe')]=0x0;this[_0x072c('0x1')]='';this[_0x072c('0xf')]();this[_0x072c('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x1b1ed2=this['mapAgentsId'][_0x072c('0x11')];this[_0x072c('0x12')]=_[_0x072c('0x13')](this[_0x072c('0xd')],'id');this['mapAgentsId'][_0x072c('0x11')]=_0x1b1ed2;};WhatsappQueue[_0x072c('0x14')][_0x072c('0x10')]=function(){this['loggedIn']=0x0;this[_0x072c('0x15')]=0x0;for(var _0x13ca6f=0x0;_0x13ca6f=0x0?this[_0x072c('0x19')]:0x0;var _0x25178b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x072c('0x18')],'name':this[_0x072c('0x9')],'paused':this[_0x072c('0x15')],'waiting':this[_0x072c('0xe')]};var _0x358a58=md5(JSON['stringify'](_0x25178b));if(this[_0x072c('0x1')]!==_0x358a58){this[_0x072c('0x1')]=_0x358a58;io['to'](util[_0x072c('0x1a')](_0x072c('0x1b'),_0x25178b['name']))[_0x072c('0x1c')](_0x072c('0x1d'),_0x25178b);}};module[_0x072c('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e917137..b55ab20 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x1cd9d6,_0x206884){var _0x87f1f7=function(_0x1fa919){while(--_0x1fa919){_0x1cd9d6['push'](_0x1cd9d6['shift']());}};_0x87f1f7(++_0x206884);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3255,_0xd1c5bd){_0x1a3255=_0x1a3255-0x0;var _0x44dcf9=_0xb10b[_0x1a3255];return _0x44dcf9;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 bd4b7b9..91b5efd 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 _0x9a3c=['update','Request','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x383446,_0x1e0c93){var _0x40e10d=function(_0x4afc26){while(--_0x4afc26){_0x383446['push'](_0x383446['shift']());}};_0x40e10d(++_0x1e0c93);}(_0x9a3c,0x71));var _0xc9a3=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x9a3c[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0xc9a3('0x0'));exports[_0xc9a3('0x1')]=function(_0x35bbc6,_0x2c1344){return client[_0xc9a3('0x2')]('UpdateChatInteraction',{'body':_0x2c1344,'options':{'where':{'id':_0x35bbc6}},'log':'updateChatInteraction'});};exports[_0xc9a3('0x3')]=function(_0x176ce8,_0x5569f0){return client[_0xc9a3('0x2')](_0xc9a3('0x4'),{'body':_0x5569f0,'options':{'where':{'id':_0x176ce8}},'log':_0xc9a3('0x5')});}; \ No newline at end of file +var _0x9bcd=['addTagsToChatInteraction','../client','Request','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x2dcc6f,_0x36b2ce){var _0x2e7a79=function(_0x2d7620){while(--_0x2d7620){_0x2dcc6f['push'](_0x2dcc6f['shift']());}};_0x2e7a79(++_0x36b2ce);}(_0x9bcd,0x15d));var _0xd9bc=function(_0x250014,_0x456405){_0x250014=_0x250014-0x0;var _0x929345=_0x9bcd[_0x250014];return _0x929345;};'use strict';var client=require(_0xd9bc('0x0'));exports['update']=function(_0x32ff3e,_0x48ca53){return client[_0xd9bc('0x1')]('UpdateChatInteraction',{'body':_0x48ca53,'options':{'where':{'id':_0x32ff3e}},'log':_0xd9bc('0x2')});};exports[_0xd9bc('0x3')]=function(_0x21db8e,_0x125557){return client['Request'](_0xd9bc('0x4'),{'body':_0x125557,'options':{'where':{'id':_0x21db8e}},'log':_0xd9bc('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b3c291d..1c56792 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 _0xcc41=['Request','CreateChatMessage'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcc41,0xd2));var _0x1cc4=function(_0x283bec,_0x291a49){_0x283bec=_0x283bec-0x0;var _0x2f53f2=_0xcc41[_0x283bec];return _0x2f53f2;};'use strict';var client=require('../client');exports['create']=function(_0x48acce){return client[_0x1cc4('0x0')](_0x1cc4('0x1'),{'body':_0x48acce,'log':'createChatMessage'});}; \ No newline at end of file +var _0x25b4=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x517e05,_0x322ae3){var _0x1e37a7=function(_0x25cd2c){while(--_0x25cd2c){_0x517e05['push'](_0x517e05['shift']());}};_0x1e37a7(++_0x322ae3);}(_0x25b4,0xa8));var _0x425b=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x25b4[_0x5b6cf1];return _0x46278c;};'use strict';var client=require(_0x425b('0x0'));exports[_0x425b('0x1')]=function(_0x2d5fff){return client['Request'](_0x425b('0x2'),{'body':_0x2d5fff,'log':_0x425b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 84ad2c8..4b8a63a 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 _0xac21=['Request','name','strategy','User','chatPause','getChatQueues'];(function(_0x41a7d4,_0x409980){var _0x496a94=function(_0x17a65c){while(--_0x17a65c){_0x41a7d4['push'](_0x41a7d4['shift']());}};_0x496a94(++_0x409980);}(_0xac21,0x1af));var _0x1ac2=function(_0x57c8b5,_0x4a0ee9){_0x57c8b5=_0x57c8b5-0x0;var _0x232b73=_0xac21[_0x57c8b5];return _0x232b73;};'use strict';var client=require('../client');exports[_0x1ac2('0x0')]=function(){return function(){return client[_0x1ac2('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x1ac2('0x2'),'timeout',_0x1ac2('0x3')],'include':[{'model':_0x1ac2('0x4'),'as':'Agents','attributes':['id',_0x1ac2('0x2'),'online',_0x1ac2('0x5')]}]},'log':_0x1ac2('0x0')});};}; \ No newline at end of file +var _0xdc59=['../client','getChatQueues','Request','timeout','strategy','User','Agents','name','online','chatPause'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xdc59,0x12c));var _0x9dc5=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xdc59[_0x237546];return _0x233e29;};'use strict';var client=require(_0x9dc5('0x0'));exports[_0x9dc5('0x1')]=function(){return function(){return client[_0x9dc5('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x9dc5('0x3'),_0x9dc5('0x4')],'include':[{'model':_0x9dc5('0x5'),'as':_0x9dc5('0x6'),'attributes':['id',_0x9dc5('0x7'),_0x9dc5('0x8'),_0x9dc5('0x9')]}]},'log':_0x9dc5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 30b5397..23e3fed 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 _0x4de7=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0x553ec7,_0x3410d4){var _0xed1c2d=function(_0x539496){while(--_0x539496){_0x553ec7['push'](_0x553ec7['shift']());}};_0xed1c2d(++_0x3410d4);}(_0x4de7,0x1f3));var _0x74de=function(_0x50f52a,_0x24fcda){_0x50f52a=_0x50f52a-0x0;var _0x216978=_0x4de7[_0x50f52a];return _0x216978;};'use strict';var client=require(_0x74de('0x0'));exports['create']=function(_0x194ba3){return client[_0x74de('0x1')](_0x74de('0x2'),{'body':_0x194ba3,'log':_0x74de('0x2')});};exports[_0x74de('0x3')]=function(_0x4b8e18,_0x394878){return client[_0x74de('0x1')](_0x74de('0x4'),{'body':_0x394878,'options':{'where':{'uniqueid':_0x4b8e18},'order':[['id','DESC']],'limit':0x1},'log':_0x74de('0x4')});}; \ No newline at end of file +var _0x41bb=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3c53c7,_0x32a47e){var _0x51b671=function(_0x48069d){while(--_0x48069d){_0x3c53c7['push'](_0x3c53c7['shift']());}};_0x51b671(++_0x32a47e);}(_0x41bb,0xc5));var _0xb41b=function(_0x57fa5b,_0xcc9dfc){_0x57fa5b=_0x57fa5b-0x0;var _0xb5230d=_0x41bb[_0x57fa5b];return _0xb5230d;};'use strict';var client=require(_0xb41b('0x0'));exports[_0xb41b('0x1')]=function(_0x4ef2f1){return client[_0xb41b('0x2')]('CreateChatQueueReport',{'body':_0x4ef2f1,'log':_0xb41b('0x3')});};exports[_0xb41b('0x4')]=function(_0x148333,_0x448c8e){return client['Request'](_0xb41b('0x5'),{'body':_0x448c8e,'options':{'where':{'uniqueid':_0x148333},'order':[['id',_0xb41b('0x6')]],'limit':0x1},'log':_0xb41b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c8a8a20..fa5558c 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(_0x548e1d,_0x3534d3){var _0x398584=function(_0x388cdd){while(--_0x388cdd){_0x548e1d['push'](_0x548e1d['shift']());}};_0x398584(++_0x3534d3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1c467b,_0x457eda){var _0x1ece5c=function(_0x27cbc9){while(--_0x27cbc9){_0x1c467b['push'](_0x1c467b['shift']());}};_0x1ece5c(++_0x457eda);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 85c8152..7a7b0ca 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 _0x81ac=['Request','CreateFaxMessage','create'];(function(_0xde7d42,_0x5894cf){var _0x53b112=function(_0x204e1b){while(--_0x204e1b){_0xde7d42['push'](_0xde7d42['shift']());}};_0x53b112(++_0x5894cf);}(_0x81ac,0xa4));var _0xc81a=function(_0x152b71,_0xac935f){_0x152b71=_0x152b71-0x0;var _0x189d13=_0x81ac[_0x152b71];return _0x189d13;};'use strict';var client=require('../client');exports[_0xc81a('0x0')]=function(_0x46ff54){return client[_0xc81a('0x1')](_0xc81a('0x2'),{'body':_0x46ff54,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x9dcf=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x369574,_0x1c5176){var _0x3a2e3b=function(_0x56530b){while(--_0x56530b){_0x369574['push'](_0x369574['shift']());}};_0x3a2e3b(++_0x1c5176);}(_0x9dcf,0x1e1));var _0xf9dc=function(_0x568ae4,_0x1f9c61){_0x568ae4=_0x568ae4-0x0;var _0x55759e=_0x9dcf[_0x568ae4];return _0x55759e;};'use strict';var client=require('../client');exports[_0xf9dc('0x0')]=function(_0x3605e4){return client[_0xf9dc('0x1')](_0xf9dc('0x2'),{'body':_0x3605e4,'log':_0xf9dc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 911529f..92b3f40 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 _0x3013=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','strategy','name'];(function(_0x513c0c,_0x43c404){var _0x46c4c4=function(_0xbd4353){while(--_0xbd4353){_0x513c0c['push'](_0x513c0c['shift']());}};_0x46c4c4(++_0x43c404);}(_0x3013,0x10a));var _0x3301=function(_0x1a527,_0x547688){_0x1a527=_0x1a527-0x0;var _0x1c7538=_0x3013[_0x1a527];return _0x1c7538;};'use strict';var client=require(_0x3301('0x0'));exports[_0x3301('0x1')]=function(){return function(){return client[_0x3301('0x2')](_0x3301('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x3301('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x3301('0x5'),_0x3301('0x6'),_0x3301('0x7')]}]},'log':_0x3301('0x1')});};}; \ No newline at end of file +var _0xca7e=['Request','GetFaxQueue','timeout','strategy','Agents','name','online','faxPause','../client','getFaxQueues'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xca7e,0xb2));var _0xeca7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xca7e[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0xeca7('0x0'));exports[_0xeca7('0x1')]=function(){return function(){return client[_0xeca7('0x2')](_0xeca7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xeca7('0x4'),_0xeca7('0x5')],'include':[{'model':'User','as':_0xeca7('0x6'),'attributes':['id',_0xeca7('0x7'),_0xeca7('0x8'),_0xeca7('0x9')]}]},'log':_0xeca7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 460e148..500fca7 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 _0x349c=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x1e9ef1,_0x26db37){var _0x242cca=function(_0x5e8fa8){while(--_0x5e8fa8){_0x1e9ef1['push'](_0x1e9ef1['shift']());}};_0x242cca(++_0x26db37);}(_0x349c,0x163));var _0xc349=function(_0x4e18bb,_0x2b28df){_0x4e18bb=_0x4e18bb-0x0;var _0x5ebf1f=_0x349c[_0x4e18bb];return _0x5ebf1f;};'use strict';var client=require(_0xc349('0x0'));exports[_0xc349('0x1')]=function(_0x5109ae){return client[_0xc349('0x2')](_0xc349('0x3'),{'body':_0x5109ae,'log':_0xc349('0x3')});};exports[_0xc349('0x4')]=function(_0x40827d,_0x47b01d){return client[_0xc349('0x2')](_0xc349('0x5'),{'body':_0x47b01d,'options':{'where':{'uniqueid':_0x40827d},'order':[['id',_0xc349('0x6')]],'limit':0x1},'log':_0xc349('0x5')});}; \ No newline at end of file +var _0x09a1=['create','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x347e1d,_0x2be9f2){var _0x2b4ef4=function(_0x5690d7){while(--_0x5690d7){_0x347e1d['push'](_0x347e1d['shift']());}};_0x2b4ef4(++_0x2be9f2);}(_0x09a1,0x1ef));var _0x109a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x09a1[_0x468b0f];return _0x3e74d9;};'use strict';var client=require('../client');exports[_0x109a('0x0')]=function(_0x14bc8f){return client['Request'](_0x109a('0x1'),{'body':_0x14bc8f,'log':_0x109a('0x1')});};exports[_0x109a('0x2')]=function(_0x506274,_0x4bb55b){return client['Request']('UpdateFaxQueueReport',{'body':_0x4bb55b,'options':{'where':{'uniqueid':_0x506274},'order':[['id',_0x109a('0x3')]],'limit':0x1},'log':_0x109a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fa892c9..bfba574 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 _0xb833=['getIntervals','GetInterval','Interval','Intervals','interval'];(function(_0x8f6830,_0x7c8a1e){var _0x4ce2e5=function(_0x5b25ec){while(--_0x5b25ec){_0x8f6830['push'](_0x8f6830['shift']());}};_0x4ce2e5(++_0x7c8a1e);}(_0xb833,0xa5));var _0x3b83=function(_0x4e32b2,_0x4b1ab9){_0x4e32b2=_0x4e32b2-0x0;var _0x2bc069=_0xb833[_0x4e32b2];return _0x2bc069;};'use strict';var client=require('../client');exports[_0x3b83('0x0')]=function(){return function(){return client['Request'](_0x3b83('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x3b83('0x2'),'as':_0x3b83('0x3'),'attributes':['id','name',_0x3b83('0x4')]}]},'log':_0x3b83('0x0')});};}; \ No newline at end of file +var _0xe0ad=['name','Interval','../client','getIntervals','Request'];(function(_0x4f7f07,_0x3d0752){var _0x56f4ab=function(_0x519ad1){while(--_0x519ad1){_0x4f7f07['push'](_0x4f7f07['shift']());}};_0x56f4ab(++_0x3d0752);}(_0xe0ad,0xc5));var _0xde0a=function(_0x31609a,_0x142395){_0x31609a=_0x31609a-0x0;var _0x952ef2=_0xe0ad[_0x31609a];return _0x952ef2;};'use strict';var client=require(_0xde0a('0x0'));exports[_0xde0a('0x1')]=function(){return function(){return client[_0xde0a('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xde0a('0x3')],'include':[{'model':_0xde0a('0x4'),'as':'Intervals','attributes':['id',_0xde0a('0x3'),'interval']}]},'log':_0xde0a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index eb3a807..767e4c3 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 _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x3798ce,_0xcd5231){var _0x11cd72=function(_0x2c93e8){while(--_0x2c93e8){_0x3798ce['push'](_0x3798ce['shift']());}};_0x11cd72(++_0xcd5231);}(_0x3de3,0x1ce));var _0x33de=function(_0x17fe86,_0x22b545){_0x17fe86=_0x17fe86-0x0;var _0xc5b120=_0x3de3[_0x17fe86];return _0xc5b120;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7916=['Request','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x557f79,_0x2b9341){var _0x394c2a=function(_0x27a3a2){while(--_0x27a3a2){_0x557f79['push'](_0x557f79['shift']());}};_0x394c2a(++_0x2b9341);}(_0x7916,0x128));var _0x6791=function(_0x2d607b,_0x455193){_0x2d607b=_0x2d607b-0x0;var _0x5be31d=_0x7916[_0x2d607b];return _0x5be31d;};'use strict';var client=require(_0x6791('0x0'));exports['update']=function(_0xeb0b9f,_0xdaaf2b){return client['Request'](_0x6791('0x1'),{'body':_0xdaaf2b,'options':{'where':{'id':_0xeb0b9f}},'log':_0x6791('0x2')});};exports[_0x6791('0x3')]=function(_0x330476,_0x5e6303){return client[_0x6791('0x4')]('AddTagsToMailInteraction',{'body':_0x5e6303,'options':{'where':{'id':_0x330476}},'log':_0x6791('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index de6d1f3..8df2027 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 _0x2c22=['Request','CreateMailMessage','createMailMessage'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2c22,0xa2));var _0x22c2=function(_0x1eea82,_0x542299){_0x1eea82=_0x1eea82-0x0;var _0x163d75=_0x2c22[_0x1eea82];return _0x163d75;};'use strict';var client=require('../client');exports['create']=function(_0x274bef){return client[_0x22c2('0x0')](_0x22c2('0x1'),{'body':_0x274bef,'log':_0x22c2('0x2')});}; \ No newline at end of file +var _0x71fa=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x3fadf6,_0x4dba08){var _0x80f680=function(_0x5e2c84){while(--_0x5e2c84){_0x3fadf6['push'](_0x3fadf6['shift']());}};_0x80f680(++_0x4dba08);}(_0x71fa,0x1cf));var _0xa71f=function(_0x3993de,_0x5c8b77){_0x3993de=_0x3993de-0x0;var _0x5e31c1=_0x71fa[_0x3993de];return _0x5e31c1;};'use strict';var client=require(_0xa71f('0x0'));exports['create']=function(_0x1c5eb5){return client[_0xa71f('0x1')](_0xa71f('0x2'),{'body':_0x1c5eb5,'log':_0xa71f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 487f672..38555fd 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 _0xe66b=['timeout','User','Agents','mailPause','getMailQueues','Request','GetMailQueue','name'];(function(_0xc61ea8,_0x56e451){var _0x22c845=function(_0x143785){while(--_0x143785){_0xc61ea8['push'](_0xc61ea8['shift']());}};_0x22c845(++_0x56e451);}(_0xe66b,0x65));var _0xbe66=function(_0x562bc6,_0x4d59ce){_0x562bc6=_0x562bc6-0x0;var _0x474436=_0xe66b[_0x562bc6];return _0x474436;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xbe66('0x0')](_0xbe66('0x1'),{'options':{'raw':![],'attributes':['id',_0xbe66('0x2'),_0xbe66('0x3'),'strategy'],'include':[{'model':_0xbe66('0x4'),'as':_0xbe66('0x5'),'attributes':['id',_0xbe66('0x2'),'online',_0xbe66('0x6')]}]},'log':_0xbe66('0x7')});};}; \ No newline at end of file +var _0x99cc=['name','online','mailPause','getMailQueues','Request','timeout','strategy','Agents'];(function(_0x5b68f1,_0x2686a9){var _0x5dedcd=function(_0xfdff1c){while(--_0xfdff1c){_0x5b68f1['push'](_0x5b68f1['shift']());}};_0x5dedcd(++_0x2686a9);}(_0x99cc,0xbc));var _0xc99c=function(_0x130b31,_0x4bf4f3){_0x130b31=_0x130b31-0x0;var _0x259c76=_0x99cc[_0x130b31];return _0x259c76;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xc99c('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc99c('0x1'),_0xc99c('0x2')],'include':[{'model':'User','as':_0xc99c('0x3'),'attributes':['id',_0xc99c('0x4'),_0xc99c('0x5'),_0xc99c('0x6')]}]},'log':_0xc99c('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f9cc6bb..424db28 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 _0x107e=['../client','create','Request','CreateMailQueueReport','DESC'];(function(_0x2a2a2e,_0x3c230a){var _0x474915=function(_0x4a6f26){while(--_0x4a6f26){_0x2a2a2e['push'](_0x2a2a2e['shift']());}};_0x474915(++_0x3c230a);}(_0x107e,0xa5));var _0xe107=function(_0x389c8a,_0x36ce13){_0x389c8a=_0x389c8a-0x0;var _0x10e33d=_0x107e[_0x389c8a];return _0x10e33d;};'use strict';var client=require(_0xe107('0x0'));exports[_0xe107('0x1')]=function(_0x53145c){return client[_0xe107('0x2')](_0xe107('0x3'),{'body':_0x53145c,'log':_0xe107('0x3')});};exports['update']=function(_0x388f24,_0x29345f){return client[_0xe107('0x2')]('UpdateMailQueueReport',{'body':_0x29345f,'options':{'where':{'uniqueid':_0x388f24},'order':[['id',_0xe107('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x35d7=['Request','UpdateMailQueueReport','DESC','../client','CreateMailQueueReport','update'];(function(_0x9b827c,_0x138b4c){var _0x390ad5=function(_0x249318){while(--_0x249318){_0x9b827c['push'](_0x9b827c['shift']());}};_0x390ad5(++_0x138b4c);}(_0x35d7,0x1dd));var _0x735d=function(_0x418113,_0x34f9df){_0x418113=_0x418113-0x0;var _0x45fc61=_0x35d7[_0x418113];return _0x45fc61;};'use strict';var client=require(_0x735d('0x0'));exports['create']=function(_0x345b65){return client['Request'](_0x735d('0x1'),{'body':_0x345b65,'log':'CreateMailQueueReport'});};exports[_0x735d('0x2')]=function(_0x2fb8b2,_0x2d305f){return client[_0x735d('0x3')](_0x735d('0x4'),{'body':_0x2d305f,'options':{'where':{'uniqueid':_0x2fb8b2},'order':[['id',_0x735d('0x5')]],'limit':0x1},'log':_0x735d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 76dc7e9..09a8258 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 _0xf044=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x43af70,_0x276071){var _0x590c63=function(_0x1c5e30){while(--_0x1c5e30){_0x43af70['push'](_0x43af70['shift']());}};_0x590c63(++_0x276071);}(_0xf044,0x153));var _0x4f04=function(_0x5e3e45,_0x4ada03){_0x5e3e45=_0x5e3e45-0x0;var _0x353099=_0xf044[_0x5e3e45];return _0x353099;};'use strict';var client=require('../client');exports[_0x4f04('0x0')]=function(_0xfdce23,_0x398253){return client[_0x4f04('0x1')](_0x4f04('0x2'),{'body':_0x398253,'options':{'where':{'id':_0xfdce23}},'log':_0x4f04('0x3')});};exports[_0x4f04('0x4')]=function(_0x2b6787,_0x1e6ae3){return client['Request'](_0x4f04('0x5'),{'body':_0x1e6ae3,'options':{'where':{'id':_0x2b6787}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xc63d=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x1cdfe6,_0x3aacf4){var _0x413779=function(_0x402b23){while(--_0x402b23){_0x1cdfe6['push'](_0x1cdfe6['shift']());}};_0x413779(++_0x3aacf4);}(_0xc63d,0xa5));var _0xdc63=function(_0x4e8be2,_0x5b1b2d){_0x4e8be2=_0x4e8be2-0x0;var _0x109f19=_0xc63d[_0x4e8be2];return _0x109f19;};'use strict';var client=require('../client');exports[_0xdc63('0x0')]=function(_0x481d4f,_0x7271c0){return client[_0xdc63('0x1')](_0xdc63('0x2'),{'body':_0x7271c0,'options':{'where':{'id':_0x481d4f}},'log':_0xdc63('0x3')});};exports['addTags']=function(_0x40e173,_0x1ea817){return client['Request'](_0xdc63('0x4'),{'body':_0x1ea817,'options':{'where':{'id':_0x40e173}},'log':_0xdc63('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f0a8d7f..f66e671 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 _0x3319=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x486cd0,_0x112026){var _0x4e4b6f=function(_0x5288fe){while(--_0x5288fe){_0x486cd0['push'](_0x486cd0['shift']());}};_0x4e4b6f(++_0x112026);}(_0x3319,0x123));var _0x9331=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x3319[_0xea8947];return _0x2455e9;};'use strict';var client=require(_0x9331('0x0'));exports[_0x9331('0x1')]=function(_0x40729d){return client[_0x9331('0x2')](_0x9331('0x3'),{'body':_0x40729d,'log':_0x9331('0x4')});}; \ No newline at end of file +var _0x33b3=['createOpenchannelMessage','../client','create','Request'];(function(_0x54496d,_0x5b8572){var _0x40e626=function(_0xb6475c){while(--_0xb6475c){_0x54496d['push'](_0x54496d['shift']());}};_0x40e626(++_0x5b8572);}(_0x33b3,0x151));var _0x333b=function(_0x1dd4d3,_0x18360e){_0x1dd4d3=_0x1dd4d3-0x0;var _0x51d5fc=_0x33b3[_0x1dd4d3];return _0x51d5fc;};'use strict';var client=require(_0x333b('0x0'));exports[_0x333b('0x1')]=function(_0x56341e){return client[_0x333b('0x2')]('CreateOpenchannelMessage',{'body':_0x56341e,'log':_0x333b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2b9540a..205ecaf 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 _0xbe69=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xbe69,0x1ce));var _0x9be6=function(_0x59810c,_0x430bac){_0x59810c=_0x59810c-0x0;var _0x4a3354=_0xbe69[_0x59810c];return _0x4a3354;};'use strict';var client=require(_0x9be6('0x0'));exports[_0x9be6('0x1')]=function(){return function(){return client[_0x9be6('0x2')](_0x9be6('0x3'),{'options':{'raw':![],'attributes':['id',_0x9be6('0x4'),_0x9be6('0x5'),_0x9be6('0x6')],'include':[{'model':_0x9be6('0x7'),'as':_0x9be6('0x8'),'attributes':['id',_0x9be6('0x4'),_0x9be6('0x9'),_0x9be6('0xa')]}]},'log':_0x9be6('0x1')});};}; \ No newline at end of file +var _0xd171=['online','../client','getOpenchannelQueues','Request','timeout','strategy','User','Agents','name'];(function(_0x54fa52,_0x2762e5){var _0x30da16=function(_0xf08ef6){while(--_0xf08ef6){_0x54fa52['push'](_0x54fa52['shift']());}};_0x30da16(++_0x2762e5);}(_0xd171,0xa3));var _0x1d17=function(_0x4144c0,_0x253e2b){_0x4144c0=_0x4144c0-0x0;var _0x424d45=_0xd171[_0x4144c0];return _0x424d45;};'use strict';var client=require(_0x1d17('0x0'));exports[_0x1d17('0x1')]=function(){return function(){return client[_0x1d17('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x1d17('0x3'),_0x1d17('0x4')],'include':[{'model':_0x1d17('0x5'),'as':_0x1d17('0x6'),'attributes':['id',_0x1d17('0x7'),_0x1d17('0x8'),'openchannelPause']}]},'log':_0x1d17('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c0dc2f7..1edabc6 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 _0xc7e8=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x33f1d7,_0x1340a2){var _0x20824d=function(_0x209ca3){while(--_0x209ca3){_0x33f1d7['push'](_0x33f1d7['shift']());}};_0x20824d(++_0x1340a2);}(_0xc7e8,0xc2));var _0x8c7e=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xc7e8[_0x946518];return _0x909b69;};'use strict';var client=require(_0x8c7e('0x0'));exports[_0x8c7e('0x1')]=function(_0x2a4aac){return client[_0x8c7e('0x2')](_0x8c7e('0x3'),{'body':_0x2a4aac,'log':_0x8c7e('0x3')});};exports[_0x8c7e('0x4')]=function(_0x425a01,_0x17aa90){return client['Request'](_0x8c7e('0x5'),{'body':_0x17aa90,'options':{'where':{'uniqueid':_0x425a01},'order':[['id',_0x8c7e('0x6')]],'limit':0x1},'log':_0x8c7e('0x5')});}; \ No newline at end of file +var _0x0f9f=['DESC','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x3cc329,_0x33bc44){var _0x228bd9=function(_0x3ac7aa){while(--_0x3ac7aa){_0x3cc329['push'](_0x3cc329['shift']());}};_0x228bd9(++_0x33bc44);}(_0x0f9f,0x1af));var _0xf0f9=function(_0x20c1cf,_0x2539df){_0x20c1cf=_0x20c1cf-0x0;var _0x16be17=_0x0f9f[_0x20c1cf];return _0x16be17;};'use strict';var client=require('../client');exports['create']=function(_0x14727a){return client[_0xf0f9('0x0')](_0xf0f9('0x1'),{'body':_0x14727a,'log':_0xf0f9('0x1')});};exports[_0xf0f9('0x2')]=function(_0x5b1e79,_0x395626){return client[_0xf0f9('0x0')](_0xf0f9('0x3'),{'body':_0x395626,'options':{'where':{'uniqueid':_0x5b1e79},'order':[['id',_0xf0f9('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 03ece50..adb7874 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 _0x2a3a=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x42fa81,_0x3a9e6a){var _0x4458c7=function(_0xb9cddf){while(--_0xb9cddf){_0x42fa81['push'](_0x42fa81['shift']());}};_0x4458c7(++_0x3a9e6a);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x2e73df,_0x27c475){_0x2e73df=_0x2e73df-0x0;var _0x511a0f=_0x2a3a[_0x2e73df];return _0x511a0f;};'use strict';var client=require(_0xa2a3('0x0'));exports[_0xa2a3('0x1')]=function(_0x24c012,_0x1733b1){return client[_0xa2a3('0x2')]('UpdateSmsInteraction',{'body':_0x1733b1,'options':{'where':{'id':_0x24c012}},'log':'updateSmsInteraction'});};exports[_0xa2a3('0x3')]=function(_0x34d7f9,_0x1e61b2){return client[_0xa2a3('0x2')](_0xa2a3('0x4'),{'body':_0x1e61b2,'options':{'where':{'id':_0x34d7f9}},'log':_0xa2a3('0x5')});}; \ No newline at end of file +var _0xa74a=['../client','update','Request','UpdateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x2696b1,_0x105935){var _0x3f785b=function(_0x271384){while(--_0x271384){_0x2696b1['push'](_0x2696b1['shift']());}};_0x3f785b(++_0x105935);}(_0xa74a,0x66));var _0xaa74=function(_0x5d21f1,_0xe47127){_0x5d21f1=_0x5d21f1-0x0;var _0x45b2cc=_0xa74a[_0x5d21f1];return _0x45b2cc;};'use strict';var client=require(_0xaa74('0x0'));exports[_0xaa74('0x1')]=function(_0xa53b49,_0x2d804a){return client[_0xaa74('0x2')](_0xaa74('0x3'),{'body':_0x2d804a,'options':{'where':{'id':_0xa53b49}},'log':'updateSmsInteraction'});};exports[_0xaa74('0x4')]=function(_0x2a487d,_0x453f66){return client['Request']('AddTagsToSmsInteraction',{'body':_0x453f66,'options':{'where':{'id':_0x2a487d}},'log':_0xaa74('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 15d16d2..8fab432 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 _0xa38a=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x4917fd,_0xcdf68c){var _0x152e63=function(_0x245525){while(--_0x245525){_0x4917fd['push'](_0x4917fd['shift']());}};_0x152e63(++_0xcdf68c);}(_0xa38a,0x19c));var _0xaa38=function(_0x4c8927,_0x20350a){_0x4c8927=_0x4c8927-0x0;var _0x27a347=_0xa38a[_0x4c8927];return _0x27a347;};'use strict';var client=require(_0xaa38('0x0'));exports[_0xaa38('0x1')]=function(_0x35a12c){return client['Request'](_0xaa38('0x2'),{'body':_0x35a12c,'log':_0xaa38('0x3')});}; \ No newline at end of file +var _0x5bc9=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0x41da6a,_0xb6ad1c){var _0x2cbd52=function(_0x42d34e){while(--_0x42d34e){_0x41da6a['push'](_0x41da6a['shift']());}};_0x2cbd52(++_0xb6ad1c);}(_0x5bc9,0x1af));var _0x95bc=function(_0x10454f,_0x492600){_0x10454f=_0x10454f-0x0;var _0x28dbee=_0x5bc9[_0x10454f];return _0x28dbee;};'use strict';var client=require('../client');exports[_0x95bc('0x0')]=function(_0x19b15a){return client[_0x95bc('0x1')](_0x95bc('0x2'),{'body':_0x19b15a,'log':_0x95bc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 11319d9..8237955 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x3abc62,_0x5401f9){var _0x4c528a=function(_0xb16543){while(--_0xb16543){_0x3abc62['push'](_0x3abc62['shift']());}};_0x4c528a(++_0x5401f9);}(_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 +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x4665be,_0xf850ab){var _0x1aad3a=function(_0x1a0da2){while(--_0x1a0da2){_0x4665be['push'](_0x4665be['shift']());}};_0x1aad3a(++_0xf850ab);}(_0xe706,0xa3));var _0x6e70=function(_0x3bda86,_0x3c45e5){_0x3bda86=_0x3bda86-0x0;var _0x4d7ffa=_0xe706[_0x3bda86];return _0x4d7ffa;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index cd5deca..aed2acb 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x60d3a2,_0x27c978){var _0x17c0da=function(_0x535ad6){while(--_0x535ad6){_0x60d3a2['push'](_0x60d3a2['shift']());}};_0x17c0da(++_0x27c978);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x230af5,_0x5cb0e6){var _0x24e019=function(_0x344208){while(--_0x344208){_0x230af5['push'](_0x230af5['shift']());}};_0x24e019(++_0x5cb0e6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1b45c74..df227e5 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(_0x4cdffd,_0x28ccb3){var _0x375531=function(_0x266056){while(--_0x266056){_0x4cdffd['push'](_0x4cdffd['shift']());}};_0x375531(++_0x28ccb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x5c3e5c,_0x59b683){var _0x50b27a=function(_0x4f02c2){while(--_0x4f02c2){_0x5c3e5c['push'](_0x5c3e5c['shift']());}};_0x50b27a(++_0x59b683);}(_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 23fb436..965f8c7 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 _0x187d=['updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x3315e4,_0x4d50c5){var _0x5d5f34=function(_0x2aa8ba){while(--_0x2aa8ba){_0x3315e4['push'](_0x3315e4['shift']());}};_0x5d5f34(++_0x4d50c5);}(_0x187d,0x93));var _0xd187=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x187d[_0x47b58b];return _0x46bebe;};'use strict';var client=require(_0xd187('0x0'));exports['update']=function(_0x3b9b6d,_0x3e942d){return client[_0xd187('0x1')](_0xd187('0x2'),{'body':_0x3e942d,'options':{'where':{'id':_0x3b9b6d}},'log':_0xd187('0x3')});};exports[_0xd187('0x4')]=function(_0x58622a,_0x28fa0b){return client[_0xd187('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x28fa0b,'options':{'where':{'id':_0x58622a}},'log':_0xd187('0x5')});}; \ No newline at end of file +var _0x2e65=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x4ab7af,_0x38eb6b){var _0x22746c=function(_0x333563){while(--_0x333563){_0x4ab7af['push'](_0x4ab7af['shift']());}};_0x22746c(++_0x38eb6b);}(_0x2e65,0x193));var _0x52e6=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2e65[_0x2601b4];return _0x3e3661;};'use strict';var client=require(_0x52e6('0x0'));exports[_0x52e6('0x1')]=function(_0x33c60c,_0x120587){return client[_0x52e6('0x2')](_0x52e6('0x3'),{'body':_0x120587,'options':{'where':{'id':_0x33c60c}},'log':_0x52e6('0x4')});};exports[_0x52e6('0x5')]=function(_0x47912f,_0x383919){return client[_0x52e6('0x2')](_0x52e6('0x6'),{'body':_0x383919,'options':{'where':{'id':_0x47912f}},'log':_0x52e6('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f5f4c5e..f222441 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 _0xe6f0=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x59ac0d,_0x174419){var _0xe9ef4=function(_0x44fdd8){while(--_0x44fdd8){_0x59ac0d['push'](_0x59ac0d['shift']());}};_0xe9ef4(++_0x174419);}(_0xe6f0,0xf2));var _0x0e6f=function(_0xdafc1b,_0x2e33a2){_0xdafc1b=_0xdafc1b-0x0;var _0x31de5b=_0xe6f0[_0xdafc1b];return _0x31de5b;};'use strict';var client=require(_0x0e6f('0x0'));exports[_0x0e6f('0x1')]=function(_0x296da6){return client[_0x0e6f('0x2')](_0x0e6f('0x3'),{'body':_0x296da6,'log':_0x0e6f('0x4')});}; \ No newline at end of file +var _0xfee5=['CreateWhatsappMessage'];(function(_0x72d4c0,_0x45ed78){var _0x2dba9a=function(_0x15203c){while(--_0x15203c){_0x72d4c0['push'](_0x72d4c0['shift']());}};_0x2dba9a(++_0x45ed78);}(_0xfee5,0xba));var _0x5fee=function(_0x3af6cb,_0x1a78af){_0x3af6cb=_0x3af6cb-0x0;var _0x3acbae=_0xfee5[_0x3af6cb];return _0x3acbae;};'use strict';var client=require('../client');exports['create']=function(_0x3b2c9c){return client['Request'](_0x5fee('0x0'),{'body':_0x3b2c9c,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b85f86a..3c57076 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 _0x4cfd=['online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','User'];(function(_0x439bc2,_0x217551){var _0x33c238=function(_0x51e494){while(--_0x51e494){_0x439bc2['push'](_0x439bc2['shift']());}};_0x33c238(++_0x217551);}(_0x4cfd,0x162));var _0xd4cf=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x4cfd[_0x342700];return _0x53406f;};'use strict';var client=require(_0xd4cf('0x0'));exports[_0xd4cf('0x1')]=function(){return function(){return client['Request'](_0xd4cf('0x2'),{'options':{'raw':![],'attributes':['id',_0xd4cf('0x3'),_0xd4cf('0x4'),'strategy'],'include':[{'model':_0xd4cf('0x5'),'as':'Agents','attributes':['id',_0xd4cf('0x3'),_0xd4cf('0x6'),_0xd4cf('0x7')]}]},'log':_0xd4cf('0x1')});};}; \ No newline at end of file +var _0x7337=['GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x3e7e16,_0x41b32c){var _0xc7c395=function(_0x48ac24){while(--_0x48ac24){_0x3e7e16['push'](_0x3e7e16['shift']());}};_0xc7c395(++_0x41b32c);}(_0x7337,0x1a5));var _0x7733=function(_0x5b30a3,_0x32cfaf){_0x5b30a3=_0x5b30a3-0x0;var _0x398f2d=_0x7337[_0x5b30a3];return _0x398f2d;};'use strict';var client=require(_0x7733('0x0'));exports[_0x7733('0x1')]=function(){return function(){return client['Request'](_0x7733('0x2'),{'options':{'raw':![],'attributes':['id',_0x7733('0x3'),_0x7733('0x4'),_0x7733('0x5')],'include':[{'model':'User','as':_0x7733('0x6'),'attributes':['id',_0x7733('0x3'),_0x7733('0x7'),_0x7733('0x8')]}]},'log':_0x7733('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7321684..eb26f0a 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 _0xbf42=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xbf42,0x158));var _0x2bf4=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xbf42[_0x49c057];return _0xd8f0e6;};'use strict';var client=require(_0x2bf4('0x0'));exports[_0x2bf4('0x1')]=function(_0x1820ca){return client[_0x2bf4('0x2')]('CreateWhatsappQueueReport',{'body':_0x1820ca,'log':_0x2bf4('0x3')});};exports['update']=function(_0x171047,_0x112c6a){return client['Request'](_0x2bf4('0x4'),{'body':_0x112c6a,'options':{'where':{'uniqueid':_0x171047},'order':[['id',_0x2bf4('0x5')]],'limit':0x1},'log':_0x2bf4('0x4')});}; \ No newline at end of file +var _0x7944=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x3e3217,_0x518c13){var _0x425fac=function(_0x22a925){while(--_0x22a925){_0x3e3217['push'](_0x3e3217['shift']());}};_0x425fac(++_0x518c13);}(_0x7944,0x1b2));var _0x4794=function(_0x2406f8,_0x45863c){_0x2406f8=_0x2406f8-0x0;var _0x5db87a=_0x7944[_0x2406f8];return _0x5db87a;};'use strict';var client=require(_0x4794('0x0'));exports['create']=function(_0x480a7b){return client[_0x4794('0x1')](_0x4794('0x2'),{'body':_0x480a7b,'log':'CreateWhatsappQueueReport'});};exports[_0x4794('0x3')]=function(_0xdeb565,_0x1b5968){return client[_0x4794('0x1')](_0x4794('0x4'),{'body':_0x1b5968,'options':{'where':{'uniqueid':_0xdeb565},'order':[['id','DESC']],'limit':0x1},'log':_0x4794('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 9726ca1..1e2caef 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 _0x04dd=['seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','error','[%s][AGENT]\x20%s','map','join','find','agents','name','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','info','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util'];(function(_0x5ae71a,_0x55425a){var _0x103190=function(_0x10ca47){while(--_0x10ca47){_0x5ae71a['push'](_0x5ae71a['shift']());}};_0x103190(++_0x55425a);}(_0x04dd,0x8e));var _0xd04d=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0x04dd[_0x4c0d2b];return _0x58c4fe;};'use strict';var schema=require(_0xd04d('0x0'));var _=require('lodash');var util=require(_0xd04d('0x1'));var seqqueue=require(_0xd04d('0x2'));var logger=require(_0xd04d('0x3'))(_0xd04d('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xd04d('0x5'),'required':!![],'message':_0xd04d('0x6')},'timeout':{'type':_0xd04d('0x7'),'message':_0xd04d('0x8')}});function writeLog(_0x1b0898,_0xc86ee,_0x2b1d95){return logger['info'](util[_0xd04d('0x9')](_0xd04d('0xa'),_0x1b0898,_0xc86ee['name'],_0x2b1d95));}function handleFindAgent(_0x2084f1){return function(_0x2c4b82){return _0x2c4b82['name'][_0xd04d('0xb')]()===_0x2084f1['toLowerCase']();};}exports['consequence']=function(_0x39266b,_0x3eb492,_0x2d196e,_0x1e39db){return function(_0x446c01){try{var _0x5b263b={'name':_0x3eb492[0x0],'timeout':_0x3eb492[0x1]};var _0x4c6083=queue[_0xd04d('0x0')](_0x5b263b,{'typecast':!![]});if(_0x4c6083['length']){logger[_0xd04d('0xc')](_0xd04d('0xd'),_0x39266b,_[_0xd04d('0xe')](_0x4c6083,'message')[_0xd04d('0xf')](',\x20'));_0x446c01['stop']();}else{var _0x9ddc06=_[_0xd04d('0x10')](_0x2d196e[_0xd04d('0x11')],handleFindAgent(_0x5b263b[_0xd04d('0x12')]));if(_0x9ddc06){var _0x5e7ff5=(_0x5b263b[_0xd04d('0x13')]||0xa)*0x3e8;var _0x32d07d,_0x2f9824;var _0x476f68=seqqueue[_0xd04d('0x14')](_0x5e7ff5);_0x476f68['id']=_0x39266b;_0x476f68[_0xd04d('0x15')]=_0x5e7ff5;_0x476f68[_0xd04d('0x16')]=_0x1e39db[_0xd04d('0x16')];writeLog(_0x39266b,_0x9ddc06,util[_0xd04d('0x9')](_0xd04d('0x17'),_0x5e7ff5));_0x2d196e[_0xd04d('0x18')][_0x39266b]['on'](_0xd04d('0x19'),function(){logger['info'](_0xd04d('0x1a'),_0x39266b);clearTimeout(_0x2f9824);_0x2f9824=undefined;_0x476f68['close']();if(_0x2d196e[_0xd04d('0x18')][_0x39266b]){delete _0x2d196e['rules'][_0x39266b];}_0x446c01[_0xd04d('0x1b')]();});_0x2d196e[_0xd04d('0x18')][_0x39266b]['on'](_0xd04d('0x1c'),function(){if(_0x2d196e[_0xd04d('0x18')][_0x39266b]){delete _0x2d196e[_0xd04d('0x18')][_0x39266b];}});_0x2f9824=setTimeout(function(){logger[_0xd04d('0x1d')](_0xd04d('0x1e'),_0x39266b);clearTimeout(_0x2f9824);_0x476f68[_0xd04d('0x1f')]();_0x446c01['next']();},_0x5e7ff5);strategy[_0xd04d('0x20')](_0x476f68,_0x9ddc06,_0x2d196e,_0x1e39db);}else{logger[_0xd04d('0xc')](_0xd04d('0x21'),_0x39266b,_0x5b263b[_0xd04d('0x12')]);_0x446c01[_0xd04d('0x1b')]();}}}catch(_0x57e557){console[_0xd04d('0x22')](_0x57e557);logger[_0xd04d('0xc')](_0xd04d('0x23'),_0x39266b,_0x57e557['stack']);_0x446c01[_0xd04d('0x1b')]();}};}; \ No newline at end of file +var _0xed87=['error','map','message','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','close','stop','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','length'];(function(_0x483c45,_0x18d120){var _0x4d1afe=function(_0x52bd78){while(--_0x52bd78){_0x483c45['push'](_0x483c45['shift']());}};_0x4d1afe(++_0x18d120);}(_0xed87,0xfa));var _0x7ed8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xed87[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0x7ed8('0x0'));var _=require(_0x7ed8('0x1'));var util=require(_0x7ed8('0x2'));var seqqueue=require(_0x7ed8('0x3'));var logger=require(_0x7ed8('0x4'))(_0x7ed8('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7ed8('0x6'),'required':!![],'message':_0x7ed8('0x7')},'timeout':{'type':_0x7ed8('0x8'),'message':_0x7ed8('0x9')}});function writeLog(_0x162efe,_0x5e5651,_0x48e9d0){return logger[_0x7ed8('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x162efe,_0x5e5651[_0x7ed8('0xb')],_0x48e9d0));}function handleFindAgent(_0x25ca8a){return function(_0x30db4e){return _0x30db4e[_0x7ed8('0xb')][_0x7ed8('0xc')]()===_0x25ca8a[_0x7ed8('0xc')]();};}exports['consequence']=function(_0x583076,_0x35667a,_0x3d7f05,_0x3772ae){return function(_0x10f9c8){try{var _0x2f383c={'name':_0x35667a[0x0],'timeout':_0x35667a[0x1]};var _0x424026=queue['validate'](_0x2f383c,{'typecast':!![]});if(_0x424026[_0x7ed8('0xd')]){logger[_0x7ed8('0xe')]('[%s][AGENT]\x20%s',_0x583076,_[_0x7ed8('0xf')](_0x424026,_0x7ed8('0x10'))['join'](',\x20'));_0x10f9c8['stop']();}else{var _0x450f5b=_['find'](_0x3d7f05[_0x7ed8('0x11')],handleFindAgent(_0x2f383c['name']));if(_0x450f5b){var _0x3f4f08=(_0x2f383c[_0x7ed8('0x12')]||0xa)*0x3e8;var _0x1ce5e8,_0x395f4b;var _0x17ca69=seqqueue[_0x7ed8('0x13')](_0x3f4f08);_0x17ca69['id']=_0x583076;_0x17ca69[_0x7ed8('0x14')]=_0x3f4f08;_0x17ca69['channel']=_0x3772ae[_0x7ed8('0x15')];writeLog(_0x583076,_0x450f5b,util[_0x7ed8('0x16')](_0x7ed8('0x17'),_0x3f4f08));_0x3d7f05[_0x7ed8('0x18')][_0x583076]['on'](_0x7ed8('0x19'),function(){logger[_0x7ed8('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x583076);clearTimeout(_0x395f4b);_0x395f4b=undefined;_0x17ca69[_0x7ed8('0x1a')]();if(_0x3d7f05[_0x7ed8('0x18')][_0x583076]){delete _0x3d7f05['rules'][_0x583076];}_0x10f9c8[_0x7ed8('0x1b')]();});_0x3d7f05[_0x7ed8('0x18')][_0x583076]['on']('complete',function(){if(_0x3d7f05[_0x7ed8('0x18')][_0x583076]){delete _0x3d7f05[_0x7ed8('0x18')][_0x583076];}});_0x395f4b=setTimeout(function(){logger[_0x7ed8('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x583076);clearTimeout(_0x395f4b);_0x17ca69[_0x7ed8('0x1a')]();_0x10f9c8[_0x7ed8('0x1c')]();},_0x3f4f08);strategy[_0x7ed8('0x1d')](_0x17ca69,_0x450f5b,_0x3d7f05,_0x3772ae);}else{logger[_0x7ed8('0xe')](_0x7ed8('0x1e'),_0x583076,_0x2f383c['name']);_0x10f9c8[_0x7ed8('0x1b')]();}}}catch(_0x2a2ec7){console[_0x7ed8('0x1f')](_0x2a2ec7);logger[_0x7ed8('0xe')]('[%s][QUEUE]\x20%s',_0x583076,_0x2a2ec7[_0x7ed8('0x20')]);_0x10f9c8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 4d97bcc..e2c63ce 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 _0x03ab=['aws-sdk','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','providerResponse','then','lodash','moment'];(function(_0x4a6ae5,_0x9f6541){var _0x402486=function(_0xa1043c){while(--_0xa1043c){_0x4a6ae5['push'](_0x4a6ae5['shift']());}};_0x402486(++_0x9f6541);}(_0x03ab,0x1ae));var _0xb03a=function(_0x20751f,_0x5ecf00){_0x20751f=_0x20751f-0x0;var _0x135f65=_0x03ab[_0x20751f];return _0x135f65;};'use strict';var _=require(_0xb03a('0x0'));var moment=require(_0xb03a('0x1'));var AWS=require(_0xb03a('0x2'));var utils=require('./utils');var logger=require(_0xb03a('0x3'))(_0xb03a('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb03a('0x5')),'smsMessage':require(_0xb03a('0x6')),'faxMessage':require(_0xb03a('0x7')),'whatsappMessage':require(_0xb03a('0x8'))};exports['consequence']=function(_0x374e85,_0x37844f){return function(_0x376c26){try{if(!_[_0xb03a('0x9')](this[_0xb03a('0xa')][_0xb03a('0xb')])){logger[_0xb03a('0xc')](_0xb03a('0xd'),_0x374e85,_0xb03a('0xe'));return _0x376c26[_0xb03a('0xf')]();}var _0xbdcc0b={'ContactId':this[_0xb03a('0x10')]['id'],'sentAt':moment()['format'](_0xb03a('0x11')),'direction':_0xb03a('0x12')};if(this[_0xb03a('0x13')]===_0xb03a('0x14')||this[_0xb03a('0x13')]===_0xb03a('0x15')){_0xbdcc0b[_0xb03a('0x16')]=this[_0xb03a('0xa')]['phone'];}var _0x11e3d3=this['channel'];if(_0x11e3d3===_0xb03a('0x17')){_0xbdcc0b[_0xb03a('0x18')]=this[_0xb03a('0x19')]['id'];}else{_0xbdcc0b[_[_0xb03a('0x1a')](_0x11e3d3)+_0xb03a('0x1b')]=this[_0xb03a('0x19')]['id'];}_0xbdcc0b[_[_0xb03a('0x1a')](_0x11e3d3)+'InteractionId']=this[_0xb03a('0xa')]['id'];if(this[_0xb03a('0xa')]['created']){var _0x317b2a=_0x37844f[0x4];if(!_[_0xb03a('0x1c')](_0x317b2a)){_0xbdcc0b[_0xb03a('0x1d')]=utils[_0xb03a('0x1e')](_0x317b2a,this);return rpc[_0x11e3d3+_0xb03a('0x1f')][_0xb03a('0x20')](_0xbdcc0b)['then'](function(_0x497334){logger[_0xb03a('0xc')](_0xb03a('0xd'),_0x374e85,_0xbdcc0b[_0xb03a('0x1d')]);})[_0xb03a('0x21')](function(_0x54a229){logger[_0xb03a('0x22')](_0xb03a('0xd'),_0x374e85,JSON[_0xb03a('0x23')](_0x54a229));})[_0xb03a('0x24')](function(){logger['info'](_0xb03a('0x25'),_0x374e85);_0x376c26[_0xb03a('0x26')]();});}else{logger[_0xb03a('0xc')](_0xb03a('0x27'),_0x374e85);_0x376c26[_0xb03a('0x26')]();}}else{var _0x47a2c6=this;var _0x4ae3fa=new AWS[(_0xb03a('0x28'))]({'accessKeyId':_0x37844f[0x0],'secretAccessKey':_0x37844f[0x1],'region':_0x37844f[0x2]});var _0xf24c23={'botAlias':'$LATEST','botName':_0x37844f[0x3],'inputText':this[_0xb03a('0x29')][_0xb03a('0x1d')],'userId':this[_0xb03a('0x13')]+':'+this[_0xb03a('0xa')]['id'][_0xb03a('0x2a')]()};_0x4ae3fa[_0xb03a('0x2b')](_0xf24c23,function(_0xf275c9,_0x57f58a){if(_0xf275c9){logger[_0xb03a('0x22')](_0xb03a('0xd'),_0x374e85,_0xf275c9['message']);_0x376c26[_0xb03a('0xf')]();}else if(_0x57f58a&&_0x57f58a['message']){_0x47a2c6[_0xb03a('0x1d')]['amazonlex']=_0x57f58a;_0xbdcc0b[_0xb03a('0x1d')]=_0x57f58a[_0xb03a('0x29')];_0xbdcc0b[_0xb03a('0x2c')]=_0xb03a('0x2d');_0xbdcc0b[_0xb03a('0x2e')]=JSON[_0xb03a('0x23')](_0x57f58a);return rpc[_0x11e3d3+'Message'][_0xb03a('0x20')](_0xbdcc0b)[_0xb03a('0x2f')](function(_0x44e99a){logger[_0xb03a('0xc')]('[%s][AMAZONLEX]\x20%s',_0x374e85,_0xbdcc0b[_0xb03a('0x1d')]);if(_0x57f58a['dialogState']=='Failed'){_0x376c26['next']();}else{_0x376c26[_0xb03a('0x26')]();}})[_0xb03a('0x21')](function(_0x29ad77){logger[_0xb03a('0x22')](_0xb03a('0xd'),_0x374e85,JSON[_0xb03a('0x23')](_0x29ad77));_0x376c26[_0xb03a('0xf')]();});}else{_0x376c26[_0xb03a('0xf')]();}});}}catch(_0x3590ef){logger[_0xb03a('0x22')](_0xb03a('0xd'),_0x374e85,JSON[_0xb03a('0x23')](_0x3590ef));_0x376c26['stop']();}};}; \ No newline at end of file +var _0xdc32=['create','then','catch','error','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','next','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','account','upperFirst','InteractionId','body','getMustacheRender','Message'];(function(_0x2ba8e1,_0xdac6fa){var _0x150479=function(_0x3133b9){while(--_0x3133b9){_0x2ba8e1['push'](_0x2ba8e1['shift']());}};_0x150479(++_0xdac6fa);}(_0xdc32,0x1bf));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x2dc3('0x0'));var AWS=require(_0x2dc3('0x1'));var utils=require('./utils');var logger=require(_0x2dc3('0x2'))(_0x2dc3('0x3'));var rpc={'chatMessage':require(_0x2dc3('0x4')),'openchannelMessage':require(_0x2dc3('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2dc3('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x4e55ce,_0xcd72a1){return function(_0x10be50){try{if(!_['isNil'](this['interaction'][_0x2dc3('0x7')])){logger[_0x2dc3('0x8')](_0x2dc3('0x9'),_0x4e55ce,_0x2dc3('0xa'));return _0x10be50['next']();}var _0x935489={'ContactId':this[_0x2dc3('0xb')]['id'],'sentAt':moment()[_0x2dc3('0xc')](_0x2dc3('0xd')),'direction':_0x2dc3('0xe')};if(this[_0x2dc3('0xf')]==='sms'||this[_0x2dc3('0xf')]===_0x2dc3('0x10')){_0x935489[_0x2dc3('0x11')]=this[_0x2dc3('0x12')][_0x2dc3('0x11')];}var _0x3e57e4=this[_0x2dc3('0xf')];if(_0x3e57e4===_0x2dc3('0x13')){_0x935489['ChatWebsiteId']=this[_0x2dc3('0x14')]['id'];}else{_0x935489[_['upperFirst'](_0x3e57e4)+'AccountId']=this[_0x2dc3('0x14')]['id'];}_0x935489[_[_0x2dc3('0x15')](_0x3e57e4)+_0x2dc3('0x16')]=this[_0x2dc3('0x12')]['id'];if(this[_0x2dc3('0x12')]['created']){var _0x57ee48=_0xcd72a1[0x4];if(!_['isEmpty'](_0x57ee48)){_0x935489[_0x2dc3('0x17')]=utils[_0x2dc3('0x18')](_0x57ee48,this);return rpc[_0x3e57e4+_0x2dc3('0x19')][_0x2dc3('0x1a')](_0x935489)[_0x2dc3('0x1b')](function(_0x3d368e){logger[_0x2dc3('0x8')](_0x2dc3('0x9'),_0x4e55ce,_0x935489[_0x2dc3('0x17')]);})[_0x2dc3('0x1c')](function(_0x2645e4){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,JSON['stringify'](_0x2645e4));})['finally'](function(){logger[_0x2dc3('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4e55ce);_0x10be50[_0x2dc3('0x1e')]();});}else{logger[_0x2dc3('0x8')](_0x2dc3('0x1f'),_0x4e55ce);_0x10be50[_0x2dc3('0x1e')]();}}else{var _0x294048=this;var _0x12a71c=new AWS[(_0x2dc3('0x20'))]({'accessKeyId':_0xcd72a1[0x0],'secretAccessKey':_0xcd72a1[0x1],'region':_0xcd72a1[0x2]});var _0x540ffc={'botAlias':'$LATEST','botName':_0xcd72a1[0x3],'inputText':this[_0x2dc3('0x21')][_0x2dc3('0x17')],'userId':this[_0x2dc3('0xf')]+':'+this['interaction']['id'][_0x2dc3('0x22')]()};_0x12a71c[_0x2dc3('0x23')](_0x540ffc,function(_0x812d23,_0x5cae23){if(_0x812d23){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,_0x812d23[_0x2dc3('0x21')]);_0x10be50['next']();}else if(_0x5cae23&&_0x5cae23[_0x2dc3('0x21')]){_0x294048['body'][_0x2dc3('0x24')]=_0x5cae23;_0x935489[_0x2dc3('0x17')]=_0x5cae23[_0x2dc3('0x21')];_0x935489[_0x2dc3('0x25')]=_0x2dc3('0x24');_0x935489[_0x2dc3('0x26')]=JSON[_0x2dc3('0x27')](_0x5cae23);return rpc[_0x3e57e4+_0x2dc3('0x19')]['create'](_0x935489)[_0x2dc3('0x1b')](function(_0x5756e6){logger[_0x2dc3('0x8')](_0x2dc3('0x9'),_0x4e55ce,_0x935489['body']);if(_0x5cae23[_0x2dc3('0x28')]==_0x2dc3('0x29')){_0x10be50[_0x2dc3('0x2a')]();}else{_0x10be50[_0x2dc3('0x1e')]();}})[_0x2dc3('0x1c')](function(_0xdaf1ad){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,JSON[_0x2dc3('0x27')](_0xdaf1ad));_0x10be50[_0x2dc3('0x2a')]();});}else{_0x10be50[_0x2dc3('0x2a')]();}});}}catch(_0x45c81f){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,JSON[_0x2dc3('0x27')](_0x45c81f));_0x10be50[_0x2dc3('0x1e')]();}};}; \ 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 0b79b52..889e682 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 _0xc953=['autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','html','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent'];(function(_0x4b51a0,_0x4aed70){var _0x4dc7b8=function(_0x355d83){while(--_0x355d83){_0x4b51a0['push'](_0x4b51a0['shift']());}};_0x4dc7b8(++_0x4aed70);}(_0xc953,0x195));var _0x3c95=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xc953[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0x3c95('0x0'));var moment=require(_0x3c95('0x1'));var utils=require(_0x3c95('0x2'));var logger=require(_0x3c95('0x3'))(_0x3c95('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3c95('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3c95('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x3c95('0x7')),'openchannelInteraction':require(_0x3c95('0x8')),'mailInteraction':require(_0x3c95('0x9')),'smsInteraction':require(_0x3c95('0xa')),'faxInteraction':require(_0x3c95('0xb')),'whatsappInteraction':require(_0x3c95('0xc'))};var mailRpc=require(_0x3c95('0xd'));exports[_0x3c95('0xe')]=function(_0x1e6a34,_0x2fc975,_0x56b4fa,_0x36882b){return function(_0x5804ed){try{var _0x49fad1=this[_0x3c95('0xf')];if(_0x49fad1===_0x3c95('0x10')&&_0x36882b[_0x3c95('0x11')][_0x3c95('0x12')]){logger[_0x3c95('0x13')]('[%s][AUTOREPLY]\x20%s',_0x1e6a34,_0x3c95('0x14'));return _0x5804ed[_0x3c95('0x15')]();}if(_0x2fc975[0x0]==='1'&&(_[_0x3c95('0x16')](this['interaction'][_0x3c95('0x17')])||!this[_0x3c95('0x18')][_0x3c95('0x17')])){logger[_0x3c95('0x13')](_0x3c95('0x19'),_0x1e6a34,_0x3c95('0x1a'));return _0x5804ed[_0x3c95('0x15')]();}if(_0x2fc975[0x0]==='2'&&this[_0x3c95('0x18')][_0x3c95('0x1b')]){logger[_0x3c95('0x13')](_0x3c95('0x1c'),_0x1e6a34,_0x3c95('0x1d'));return _0x5804ed['next']();}var _0x39ebea={'ContactId':this[_0x3c95('0x1e')]['id'],'sentAt':moment()[_0x3c95('0x1f')](_0x3c95('0x20')),'direction':'out'};if(this[_0x3c95('0xf')]==='mail'){_0x39ebea[_0x3c95('0x11')]=utils[_0x3c95('0x21')](_0x2fc975[0x2],this);}else{_0x39ebea[_0x3c95('0x11')]=utils[_0x3c95('0x21')](_0x2fc975[0x1],this);}if(this[_0x3c95('0x22')]){_0x39ebea['to']=this[_0x3c95('0x22')][_0x3c95('0x23')]||'';if(this[_0x3c95('0xf')]===_0x3c95('0x10')&&_0x2fc975[0x1]==='1'){_0x39ebea['cc']=this[_0x3c95('0x22')]['cc']||'';}_0x39ebea[_0x3c95('0x23')]=this[_0x3c95('0x22')]['to']||'';_0x39ebea[_0x3c95('0x24')]=this[_0x3c95('0x22')][_0x3c95('0x24')]||'';_0x39ebea[_0x3c95('0x25')]=!![];if(this[_0x3c95('0x22')][_0x3c95('0x26')]){_0x39ebea[_0x3c95('0x26')]='';_0x39ebea[_0x3c95('0x26')]+=_[_0x3c95('0x27')](this[_0x3c95('0x22')]['subject'],_0x3c95('0x28'))?'':_0x3c95('0x29');_0x39ebea[_0x3c95('0x26')]+=this[_0x3c95('0x22')][_0x3c95('0x26')];}}if(this['channel']===_0x3c95('0x2a')){_0x39ebea[_0x3c95('0x2b')]=this['account']['id'];}else{_0x39ebea[_['upperFirst'](this[_0x3c95('0xf')])+'AccountId']=this[_0x3c95('0x2c')]['id'];}_0x39ebea[_[_0x3c95('0x2d')](this[_0x3c95('0xf')])+_0x3c95('0x2e')]=this[_0x3c95('0x18')]['id'];var _0x646aed=this['interaction'];if(rpc[this[_0x3c95('0xf')]+'Message']){if(this[_0x3c95('0xf')]===_0x3c95('0x10')){_0x39ebea['inReplyTo']=this[_0x3c95('0x22')]['messageId'];_0x39ebea[_0x3c95('0x2f')]=_0x3c95('0x30')+_[_0x3c95('0x31')](_0x39ebea[_0x3c95('0x11')],_0x3c95('0x32'),_0x3c95('0x33'))+_0x3c95('0x34');_0x39ebea[_0x3c95('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x3c95('0x36'),'Precedence':_0x3c95('0x37')};return mailRpc[_0x3c95('0x38')](this['account'][_0x3c95('0x39')],_0x39ebea)[_0x3c95('0x3a')](function(_0x5cb983){logger['info'](_0x3c95('0x3b'),_0x1e6a34);_0x39ebea[_0x3c95('0x3c')]=_0x5cb983['message']['messageId'];return rpc[_0x49fad1+_0x3c95('0x3d')][_0x3c95('0x3e')](_0x39ebea);})[_0x3c95('0x3a')](function(_0x2bc001){logger['info'](_0x3c95('0x19'),_0x1e6a34,JSON[_0x3c95('0x3f')](_0x2bc001));})[_0x3c95('0x40')](function(_0x6de0cb){logger['error'](_0x3c95('0x41'),_0x1e6a34,JSON['stringify'](_0x6de0cb));})[_0x3c95('0x42')](function(){Promise['resolve']()['then'](function(){if(_0x2fc975[0x0]!=='2'||_0x646aed[_0x3c95('0x1b')])return;return rpc[_0x49fad1+'Interaction'][_0x3c95('0x43')](_0x646aed['id'],{'autoreplyExecuted':!![]})[_0x3c95('0x3a')](function(_0x211502){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1e6a34,JSON['stringify'](_0x211502));})[_0x3c95('0x40')](function(_0x3acd98){logger[_0x3c95('0x44')](_0x3c95('0x45'),_0x1e6a34,JSON[_0x3c95('0x3f')](_0x3acd98));});})[_0x3c95('0x3a')](function(){_0x5804ed['next']();});});}else{return rpc[this[_0x3c95('0xf')]+_0x3c95('0x3d')][_0x3c95('0x3e')](_0x39ebea)[_0x3c95('0x3a')](function(){logger[_0x3c95('0x13')](_0x3c95('0x19'),_0x1e6a34,_0x39ebea['body']);})[_0x3c95('0x40')](function(_0x3914c5){logger[_0x3c95('0x44')](_0x3c95('0x19'),_0x1e6a34,JSON['stringify'](_0x3914c5));})['finally'](function(){Promise[_0x3c95('0x46')]()[_0x3c95('0x3a')](function(){if(_0x2fc975[0x0]!=='2'||_0x646aed['autoreplyExecuted'])return;return rpc[_0x49fad1+'Interaction'][_0x3c95('0x43')](_0x646aed['id'],{'autoreplyExecuted':!![]})[_0x3c95('0x3a')](function(_0x49e98b){logger[_0x3c95('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1e6a34,JSON[_0x3c95('0x3f')](_0x49e98b));})['catch'](function(_0x5ac61d){logger[_0x3c95('0x44')](_0x3c95('0x45'),_0x1e6a34,JSON['stringify'](_0x5ac61d));});})[_0x3c95('0x3a')](function(){_0x5804ed[_0x3c95('0x15')]();});});}}}catch(_0x514744){logger[_0x3c95('0x44')](_0x3c95('0x19'),_0x1e6a34,JSON['stringify'](_0x514744));_0x5804ed[_0x3c95('0x47')]();}};}; \ No newline at end of file +var _0x3558=['lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','Message','messageId','html','','','headers','auto-replied','auto_reply','then','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','error','resolve','stop'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3558,0x1e0));var _0x8355=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x3558[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x8355('0x0'));var moment=require(_0x8355('0x1'));var utils=require('./utils');var logger=require(_0x8355('0x2'))('routing');var rpc={'chatMessage':require(_0x8355('0x3')),'openchannelMessage':require(_0x8355('0x4')),'mailMessage':require(_0x8355('0x5')),'smsMessage':require(_0x8355('0x6')),'faxMessage':require(_0x8355('0x7')),'whatsappMessage':require(_0x8355('0x8')),'chatInteraction':require(_0x8355('0x9')),'openchannelInteraction':require(_0x8355('0xa')),'mailInteraction':require(_0x8355('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8355('0xc'))};var mailRpc=require(_0x8355('0xd'));exports[_0x8355('0xe')]=function(_0x1a1ba0,_0x268c30,_0x19683d,_0x21ea3d){return function(_0x121949){try{var _0x1fa24e=this[_0x8355('0xf')];if(_0x1fa24e===_0x8355('0x10')&&_0x21ea3d[_0x8355('0x11')]['isAutoreply']){logger['info'](_0x8355('0x12'),_0x1a1ba0,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x121949[_0x8355('0x13')]();}if(_0x268c30[0x0]==='1'&&(_[_0x8355('0x14')](this[_0x8355('0x15')]['created'])||!this[_0x8355('0x15')]['created'])){logger[_0x8355('0x16')](_0x8355('0x12'),_0x1a1ba0,_0x8355('0x17'));return _0x121949[_0x8355('0x13')]();}if(_0x268c30[0x0]==='2'&&this[_0x8355('0x15')][_0x8355('0x18')]){logger['info'](_0x8355('0x19'),_0x1a1ba0,_0x8355('0x1a'));return _0x121949[_0x8355('0x13')]();}var _0x53371c={'ContactId':this[_0x8355('0x1b')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x8355('0xf')]==='mail'){_0x53371c[_0x8355('0x11')]=utils[_0x8355('0x1c')](_0x268c30[0x2],this);}else{_0x53371c[_0x8355('0x11')]=utils[_0x8355('0x1c')](_0x268c30[0x1],this);}if(this[_0x8355('0x1d')]){_0x53371c['to']=this[_0x8355('0x1d')][_0x8355('0x1e')]||'';if(this[_0x8355('0xf')]===_0x8355('0x10')&&_0x268c30[0x1]==='1'){_0x53371c['cc']=this[_0x8355('0x1d')]['cc']||'';}_0x53371c[_0x8355('0x1e')]=this['message']['to']||'';_0x53371c[_0x8355('0x1f')]=this[_0x8355('0x1d')][_0x8355('0x1f')]||'';_0x53371c[_0x8355('0x20')]=!![];if(this[_0x8355('0x1d')][_0x8355('0x21')]){_0x53371c[_0x8355('0x21')]='';_0x53371c[_0x8355('0x21')]+=_[_0x8355('0x22')](this[_0x8355('0x1d')]['subject'],_0x8355('0x23'))?'':_0x8355('0x24');_0x53371c[_0x8355('0x21')]+=this[_0x8355('0x1d')]['subject'];}}if(this[_0x8355('0xf')]==='chat'){_0x53371c['ChatWebsiteId']=this[_0x8355('0x25')]['id'];}else{_0x53371c[_[_0x8355('0x26')](this[_0x8355('0xf')])+_0x8355('0x27')]=this[_0x8355('0x25')]['id'];}_0x53371c[_[_0x8355('0x26')](this[_0x8355('0xf')])+'InteractionId']=this[_0x8355('0x15')]['id'];var _0x35f461=this[_0x8355('0x15')];if(rpc[this[_0x8355('0xf')]+_0x8355('0x28')]){if(this[_0x8355('0xf')]==='mail'){_0x53371c['inReplyTo']=this[_0x8355('0x1d')][_0x8355('0x29')];_0x53371c[_0x8355('0x2a')]=_0x8355('0x2b')+_['replace'](_0x53371c['body'],_0x8355('0x2c'),']+(>|$)/g,''),'priorityTrue':_0x33c4cc[0x1],'priorityFalse':_0x33c4cc[0x2]};var _0x550fcb=gotoif[_0xb41d('0x0')](_0x20ecb2,{'typecast':!![]});if(_0x550fcb[_0xb41d('0xa')]){logger[_0xb41d('0xb')](_0xb41d('0xc'),_0x4e2c37,_['map'](_0x550fcb,'message')[_0xb41d('0xd')](',\x20'));_0x5b2f05[_0xb41d('0xe')]();}else{try{var _0x3b2007=eval('('+_0x20ecb2[_0xb41d('0xf')]+')');var _0x2f818e=_0x3b2007?_0x20ecb2[_0xb41d('0x10')]:_0x20ecb2[_0xb41d('0x11')];logger[_0xb41d('0x12')](_0xb41d('0x13'),_0x4e2c37,_0x20ecb2[_0xb41d('0xf')],_0x3b2007,_0x2f818e||_0xb41d('0x14'));if(_0x2f818e){var _0x11180b=_[_0xb41d('0x15')](_0x5b2f05['rules'](),{'p':_0x2f818e});if(_0x11180b>=0x0){logger['info'](_0xb41d('0x16'),_0x4e2c37,_0x2f818e||_0xb41d('0x14'),_0x11180b);_0x5b2f05[_0xb41d('0x14')](_0x11180b);}else{logger[_0xb41d('0x12')](_0xb41d('0x17'),_0x4e2c37,_0x2f818e||_0xb41d('0x14'));_0x5b2f05[_0xb41d('0xe')]();}}else{_0x5b2f05[_0xb41d('0x14')]();}}catch(_0x4bc54c){logger[_0xb41d('0xb')](_0xb41d('0x18'),_0x4e2c37,_0x4bc54c[_0xb41d('0x19')]);_0x5b2f05[_0xb41d('0xe')]();}}}catch(_0x93f18d){logger[_0xb41d('0xb')](_0xb41d('0xc'),_0x4e2c37,JSON[_0xb41d('0x1a')](_0x93f18d));_0x5b2f05[_0xb41d('0xe')]();}};}; \ No newline at end of file +var _0x9b54=['next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition'];(function(_0x23d1db,_0x59f7df){var _0x3635e7=function(_0x472ba9){while(--_0x472ba9){_0x23d1db['push'](_0x23d1db['shift']());}};_0x3635e7(++_0x59f7df);}(_0x9b54,0xb4));var _0x49b5=function(_0x3312be,_0x35903b){_0x3312be=_0x3312be-0x0;var _0x5154e6=_0x9b54[_0x3312be];return _0x5154e6;};'use strict';var schema=require(_0x49b5('0x0'));var _=require('lodash');var htmlToText=require(_0x49b5('0x1'));var utils=require(_0x49b5('0x2'));var logger=require(_0x49b5('0x3'))(_0x49b5('0x4'));var gotoif=schema({'condition':{'type':_0x49b5('0x5'),'required':!![],'message':_0x49b5('0x6')},'priorityTrue':{'type':_0x49b5('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x49b5('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x49b5('0x8')]=function(_0x5c1a26,_0x44725f){return function(_0x1934dc){try{var _0x57eda9={'condition':htmlToText[_0x49b5('0x9')](utils[_0x49b5('0xa')](_0x44725f[0x0],this),{'wordwrap':![]})[_0x49b5('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x44725f[0x1],'priorityFalse':_0x44725f[0x2]};var _0xdb9f51=gotoif[_0x49b5('0x0')](_0x57eda9,{'typecast':!![]});if(_0xdb9f51[_0x49b5('0xc')]){logger[_0x49b5('0xd')](_0x49b5('0xe'),_0x5c1a26,_[_0x49b5('0xf')](_0xdb9f51,_0x49b5('0x10'))[_0x49b5('0x11')](',\x20'));_0x1934dc[_0x49b5('0x12')]();}else{try{var _0x25d43d=eval('('+_0x57eda9['condition']+')');var _0x1e484a=_0x25d43d?_0x57eda9[_0x49b5('0x13')]:_0x57eda9[_0x49b5('0x14')];logger['info'](_0x49b5('0x15'),_0x5c1a26,_0x57eda9[_0x49b5('0x16')],_0x25d43d,_0x1e484a||_0x49b5('0x17'));if(_0x1e484a){var _0x4e445e=_['findIndex'](_0x1934dc[_0x49b5('0x18')](),{'p':_0x1e484a});if(_0x4e445e>=0x0){logger[_0x49b5('0x19')](_0x49b5('0x1a'),_0x5c1a26,_0x1e484a||_0x49b5('0x17'),_0x4e445e);_0x1934dc[_0x49b5('0x17')](_0x4e445e);}else{logger[_0x49b5('0x19')](_0x49b5('0x1b'),_0x5c1a26,_0x1e484a||_0x49b5('0x17'));_0x1934dc[_0x49b5('0x12')]();}}else{_0x1934dc[_0x49b5('0x17')]();}}catch(_0x593669){logger[_0x49b5('0xd')](_0x49b5('0x1c'),_0x5c1a26,_0x593669['message']);_0x1934dc['stop']();}}}catch(_0x461b0d){logger[_0x49b5('0xd')](_0x49b5('0xe'),_0x5c1a26,JSON['stringify'](_0x461b0d));_0x1934dc[_0x49b5('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 0fc3ddd..c6c11c3 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 _0x51bc=['length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','next','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x39d518,_0x32b600){var _0x2feade=function(_0x272839){while(--_0x272839){_0x39d518['push'](_0x39d518['shift']());}};_0x2feade(++_0x32b600);}(_0x51bc,0x160));var _0xc51b=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x51bc[_0x243217];return _0x478029;};'use strict';var schema=require(_0xc51b('0x0'));var _=require(_0xc51b('0x1'));var logger=require(_0xc51b('0x2'))('routing');var gotop=schema({'priority':{'type':_0xc51b('0x3'),'required':!![],'message':_0xc51b('0x4')}});exports['consequence']=function(_0x302b44,_0x3e7721){return function(_0x3ab195){try{var _0x4821d8={'priority':_0x3e7721[0x0]};var _0x202f02=gotop[_0xc51b('0x0')](_0x4821d8,{'typecast':!![]});if(_0x202f02[_0xc51b('0x5')]){logger[_0xc51b('0x6')](_0xc51b('0x7'),_0x302b44,_[_0xc51b('0x8')](_0x202f02,_0xc51b('0x9'))[_0xc51b('0xa')](',\x20'));_0x3ab195['stop']();}else{logger[_0xc51b('0xb')](_0xc51b('0xc'),_0x302b44,_0x4821d8['priority']);if(_0x4821d8[_0xc51b('0xd')]){var _0x79140=_[_0xc51b('0xe')](_0x3ab195[_0xc51b('0xf')](),{'p':_0x4821d8['priority']});if(_0x79140>=0x0){logger[_0xc51b('0xb')](_0xc51b('0x10'),_0x302b44,_0x4821d8[_0xc51b('0xd')]||'next',_0x79140);_0x3ab195['next'](_0x79140);}else{logger[_0xc51b('0xb')](_0xc51b('0x11'),_0x302b44,_0x4821d8[_0xc51b('0xd')]||'next');_0x3ab195[_0xc51b('0x12')]();}}else{_0x3ab195[_0xc51b('0x13')]();}}}catch(_0x2389b8){logger[_0xc51b('0x6')]('[%s][GOTOP]\x20%s',_0x302b44,JSON[_0xc51b('0x14')](_0x2389b8));_0x3ab195[_0xc51b('0x12')]();}};}; \ No newline at end of file +var _0xd69d=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','routing','consequence','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x3eb969,_0x11c187){var _0x5e62e0=function(_0x4eb12d){while(--_0x4eb12d){_0x3eb969['push'](_0x3eb969['shift']());}};_0x5e62e0(++_0x11c187);}(_0xd69d,0x163));var _0xdd69=function(_0x40f63f,_0x211fe8){_0x40f63f=_0x40f63f-0x0;var _0xc7ce87=_0xd69d[_0x40f63f];return _0xc7ce87;};'use strict';var schema=require(_0xdd69('0x0'));var _=require(_0xdd69('0x1'));var logger=require('../../../../config/logger')(_0xdd69('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xdd69('0x3')]=function(_0x2c3cdf,_0x1db103){return function(_0x195cb3){try{var _0x311647={'priority':_0x1db103[0x0]};var _0x2c1c33=gotop['validate'](_0x311647,{'typecast':!![]});if(_0x2c1c33['length']){logger[_0xdd69('0x4')](_0xdd69('0x5'),_0x2c3cdf,_[_0xdd69('0x6')](_0x2c1c33,_0xdd69('0x7'))[_0xdd69('0x8')](',\x20'));_0x195cb3['stop']();}else{logger[_0xdd69('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x2c3cdf,_0x311647[_0xdd69('0xa')]);if(_0x311647[_0xdd69('0xa')]){var _0x270854=_['findIndex'](_0x195cb3[_0xdd69('0xb')](),{'p':_0x311647['priority']});if(_0x270854>=0x0){logger[_0xdd69('0x9')](_0xdd69('0xc'),_0x2c3cdf,_0x311647[_0xdd69('0xa')]||_0xdd69('0xd'),_0x270854);_0x195cb3[_0xdd69('0xd')](_0x270854);}else{logger[_0xdd69('0x9')](_0xdd69('0xe'),_0x2c3cdf,_0x311647[_0xdd69('0xa')]||'next');_0x195cb3[_0xdd69('0xf')]();}}else{_0x195cb3[_0xdd69('0xd')]();}}}catch(_0x4250d6){logger[_0xdd69('0x4')](_0xdd69('0x5'),_0x2c3cdf,JSON['stringify'](_0x4250d6));_0x195cb3[_0xdd69('0xf')]();}};}; \ 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 2726d2c..610e672 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 _0xf81a=['./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','InteractionId','interaction','create','then','info','body','next','catch','error','stringify','stop','[%s][MESSAGE]\x20%s','lodash'];(function(_0x47ad81,_0x5a91fe){var _0x3af85d=function(_0x4b846a){while(--_0x4b846a){_0x47ad81['push'](_0x47ad81['shift']());}};_0x3af85d(++_0x5a91fe);}(_0xf81a,0x16b));var _0xaf81=function(_0x1affc4,_0x535416){_0x1affc4=_0x1affc4-0x0;var _0x480ee3=_0xf81a[_0x1affc4];return _0x480ee3;};'use strict';var _=require(_0xaf81('0x0'));var utils=require(_0xaf81('0x1'));var logger=require(_0xaf81('0x2'))('routing');var rpc={'chatMessage':require(_0xaf81('0x3')),'openchannelMessage':require(_0xaf81('0x4')),'mailMessage':require(_0xaf81('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaf81('0x6')),'whatsappMessage':require(_0xaf81('0x7'))};exports['consequence']=function(_0x102c05,_0x3c4f98){return function(_0x1c89dd){try{var _0x5cfd36={'body':utils[_0xaf81('0x8')](_0x3c4f98[0x0],this),'ContactId':this[_0xaf81('0x9')]['id']};if(this['channel']===_0xaf81('0xa')){_0x5cfd36[_0xaf81('0xb')]=this[_0xaf81('0xc')]['id'];}else{_0x5cfd36[_[_0xaf81('0xd')](this['channel'])+_0xaf81('0xe')]=this[_0xaf81('0xc')]['id'];}_0x5cfd36[_[_0xaf81('0xd')](this[_0xaf81('0xf')])+_0xaf81('0x10')]=this[_0xaf81('0x11')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xaf81('0xf')]+'Message'][_0xaf81('0x12')](_0x5cfd36)[_0xaf81('0x13')](function(_0x2b62dd){logger[_0xaf81('0x14')]('[%s][MESSAGE]\x20%s',_0x102c05,_0x5cfd36[_0xaf81('0x15')]);_0x1c89dd[_0xaf81('0x16')]();})[_0xaf81('0x17')](function(_0x3f588c){logger[_0xaf81('0x18')]('[%s][MESSAGE]\x20%s',_0x102c05,JSON[_0xaf81('0x19')](_0x3f588c));_0x1c89dd[_0xaf81('0x1a')]();});}}catch(_0x53ed79){logger[_0xaf81('0x18')](_0xaf81('0x1b'),_0x102c05,JSON[_0xaf81('0x19')](_0x53ed79));_0x1c89dd['stop']();}};}; \ No newline at end of file +var _0x1c19=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account','upperFirst','channel','AccountId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils'];(function(_0x1dd287,_0x498a){var _0x4b5e4e=function(_0x4009f1){while(--_0x4009f1){_0x1dd287['push'](_0x1dd287['shift']());}};_0x4b5e4e(++_0x498a);}(_0x1c19,0x1f2));var _0x91c1=function(_0x4aa2c9,_0x3c74e5){_0x4aa2c9=_0x4aa2c9-0x0;var _0x212e33=_0x1c19[_0x4aa2c9];return _0x212e33;};'use strict';var _=require(_0x91c1('0x0'));var utils=require(_0x91c1('0x1'));var logger=require(_0x91c1('0x2'))('routing');var rpc={'chatMessage':require(_0x91c1('0x3')),'openchannelMessage':require(_0x91c1('0x4')),'mailMessage':require(_0x91c1('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x91c1('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x91c1('0x7')]=function(_0x64135e,_0x105260){return function(_0xc05b49){try{var _0x1a2ff5={'body':utils[_0x91c1('0x8')](_0x105260[0x0],this),'ContactId':this[_0x91c1('0x9')]['id']};if(this['channel']==='chat'){_0x1a2ff5[_0x91c1('0xa')]=this[_0x91c1('0xb')]['id'];}else{_0x1a2ff5[_[_0x91c1('0xc')](this[_0x91c1('0xd')])+_0x91c1('0xe')]=this['account']['id'];}_0x1a2ff5[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x91c1('0xf')]['id'];if(rpc[this[_0x91c1('0xd')]+_0x91c1('0x10')]){return rpc[this[_0x91c1('0xd')]+_0x91c1('0x10')]['create'](_0x1a2ff5)['then'](function(_0x5f482a){logger[_0x91c1('0x11')](_0x91c1('0x12'),_0x64135e,_0x1a2ff5[_0x91c1('0x13')]);_0xc05b49[_0x91c1('0x14')]();})[_0x91c1('0x15')](function(_0x410149){logger[_0x91c1('0x16')]('[%s][MESSAGE]\x20%s',_0x64135e,JSON[_0x91c1('0x17')](_0x410149));_0xc05b49[_0x91c1('0x18')]();});}}catch(_0x5cabd3){logger[_0x91c1('0x16')](_0x91c1('0x12'),_0x64135e,JSON[_0x91c1('0x17')](_0x5cabd3));_0xc05b49[_0x91c1('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 8ce41b6..ac7f97b 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 _0x85d1=['[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x85d1,0xaf));var _0x185d=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x85d1[_0x21f931];return _0x3f083c;};'use strict';var utils=require(_0x185d('0x0'));var logger=require(_0x185d('0x1'))(_0x185d('0x2'));exports[_0x185d('0x3')]=function(_0x319502,_0x504db3){return function(_0x2b95dc){try{logger[_0x185d('0x4')](_0x185d('0x5'),_0x319502,utils['getMustacheRender'](_0x504db3[0x0],this));_0x2b95dc[_0x185d('0x6')]();}catch(_0x105029){logger[_0x185d('0x7')]('[%s][NOOP]\x20%s',_0x319502,JSON[_0x185d('0x8')](_0x105029));_0x2b95dc['stop']();}};}; \ No newline at end of file +var _0xa78c=['getMustacheRender','next','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0xf738ad,_0x5e1d7f){var _0x598570=function(_0x35088e){while(--_0x35088e){_0xf738ad['push'](_0xf738ad['shift']());}};_0x598570(++_0x5e1d7f);}(_0xa78c,0x1d8));var _0xca78=function(_0x61d937,_0x45883b){_0x61d937=_0x61d937-0x0;var _0x5c7096=_0xa78c[_0x61d937];return _0x5c7096;};'use strict';var utils=require(_0xca78('0x0'));var logger=require('../../../../config/logger')(_0xca78('0x1'));exports[_0xca78('0x2')]=function(_0x56b809,_0x5afc68){return function(_0x1e948a){try{logger[_0xca78('0x3')](_0xca78('0x4'),_0x56b809,utils[_0xca78('0x5')](_0x5afc68[0x0],this));_0x1e948a[_0xca78('0x6')]();}catch(_0x5acb2c){logger['error'](_0xca78('0x4'),_0x56b809,JSON[_0xca78('0x7')](_0x5acb2c));_0x1e948a[_0xca78('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 8fefa2e..ab79de7 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 _0xb49c=['interaction','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','from','emit','clone','account','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0xb49c,0x1c4));var _0xcb49=function(_0x12c2d2,_0x3ec787){_0x12c2d2=_0x12c2d2-0x0;var _0x24c1b0=_0xb49c[_0x12c2d2];return _0x24c1b0;};'use strict';var schema=require(_0xcb49('0x0'));var _=require(_0xcb49('0x1'));var util=require(_0xcb49('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xcb49('0x3'));var Redis=require(_0xcb49('0x4'));var config=require(_0xcb49('0x5'));var logger=require(_0xcb49('0x6'))(_0xcb49('0x7'));var strategy=require(_0xcb49('0x8'));config[_0xcb49('0x9')]=_[_0xcb49('0xa')](config[_0xcb49('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xcb49('0xb'))(new Redis(config['redis']));var attributes=['id','queue_id','account','queue',_0xcb49('0xc'),'joinAt'];function emit(_0x4e66d3,_0xfae3e4,_0x1ceb00){io['to'](_0x4e66d3)[_0xcb49('0xd')](_0xfae3e4,_0x1ceb00);}function emitChannelQueueInteraction(_0x413495,_0x59ee64,_0x405b3,_0x557e5a,_0x320a67,_0x1a7936,_0x1739bc,_0x20803a){var _0x3ca80f=_[_0xcb49('0xe')](_0x405b3);_0x3ca80f['queue_id']=_0x20803a;_0x3ca80f['queue']=_0x59ee64;_0x3ca80f[_0xcb49('0xf')]=_0x557e5a;_0x3ca80f['id']=_0x320a67;if(_0x1a7936){attributes[_0xcb49('0x10')](_[_0xcb49('0x11')](_0x413495)+'InteractionId');_0x1739bc[util[_0xcb49('0x12')](_0xcb49('0x13'),_0x413495)][_0x320a67]=_[_0xcb49('0x14')](_0x3ca80f,attributes);}else{delete _0x1739bc[util[_0xcb49('0x12')]('%sQueuesWaitingInteractions',_0x413495)][_0x320a67];}emit(util[_0xcb49('0x12')](_0xcb49('0x15'),_0x413495,_0x59ee64),util[_0xcb49('0x12')](_0xcb49('0x16'),_0x413495,_0x1a7936?_0xcb49('0x17'):_0xcb49('0x18')),_['pick'](_0x3ca80f,attributes));}var rpc={'openchannelQueueReport':require(_0xcb49('0x19')),'mailQueueReport':require(_0xcb49('0x1a')),'chatQueueReport':require(_0xcb49('0x1b')),'smsQueueReport':require(_0xcb49('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xcb49('0x1d')),'chatInteraction':require(_0xcb49('0x1e')),'faxInteraction':require(_0xcb49('0x1f')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0xcb49('0x20')),'smsInteraction':require(_0xcb49('0x21')),'whatsappInteraction':require(_0xcb49('0x22'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xcb49('0x23')},'timeout':{'type':_0xcb49('0x24'),'message':_0xcb49('0x25')}});function startRouting(_0x49bb60,_0x11610e,_0x4ede58,_0x4eaf25){if(_0x49bb60&&_0x11610e&&_0x4ede58){_0x11610e[_0xcb49('0x26')]+=0x1;var _0x3472af={'uniqueid':_0x49bb60,'from':_0x4ede58[_0xcb49('0x27')]?_0x4ede58[_0xcb49('0x27')][_0xcb49('0xc')]:'','joinAt':moment()[_0xcb49('0x12')](_0xcb49('0x28')),'ContactId':_0x4ede58['contact']?_0x4ede58[_0xcb49('0x29')]['id']:null,'ListId':_0x4ede58[_0xcb49('0x2a')]?_0x4ede58['list']['id']:null};_0x3472af[_[_0xcb49('0x2b')](_0x4ede58[_0xcb49('0x2c')])+'QueueId']=_0x11610e['id']||null;_0x3472af[_['upperFirst'](_0x4ede58[_0xcb49('0x2c')])+_0xcb49('0x2d')]=_0x4ede58['interaction']?_0x4ede58[_0xcb49('0x2e')]['id']:null;_0x3472af[_[_0xcb49('0x2b')](_0x4ede58[_0xcb49('0x2c')])+'MessageId']=_0x4ede58[_0xcb49('0x2f')]?_0x4ede58[_0xcb49('0x2f')]['id']:null;_0x3472af[_[_0xcb49('0x2b')](_0x4ede58[_0xcb49('0x2c')])+(_0x4ede58['channel']!=='chat'?_0xcb49('0x30'):_0xcb49('0x31'))]=_0x4ede58[_0xcb49('0xf')]?_0x4ede58[_0xcb49('0xf')]['id']:null;logger['info'](util['format'](_0xcb49('0x32'),_0x49bb60,_0x11610e[_0xcb49('0x33')]));emitChannelQueueInteraction(_0x4ede58[_0xcb49('0x2c')],_0x11610e[_0xcb49('0x33')],_0x3472af,_0x4ede58[_0xcb49('0xf')][_0xcb49('0x33')],_0x4ede58[_0xcb49('0x2f')]['id'],!![],_0x4eaf25,_0x11610e['id']);if(rpc[_0x4ede58[_0xcb49('0x2c')]+_0xcb49('0x34')]){return rpc[_0x4ede58[_0xcb49('0x2c')]+_0xcb49('0x34')]['create'](_0x3472af)['catch'](function(_0x36b13b){logger[_0xcb49('0x35')]('create\x20queue\x20report',_0x36b13b);});}}}function stopRouting(_0x3af4e1,_0x958224,_0x8c9ede,_0x5bbebd){if(_0x3af4e1&&_0x958224){_0x958224[_0xcb49('0x26')]-=0x1;var _0x2ae2a4={'leaveAt':moment()[_0xcb49('0x12')](_0xcb49('0x28')),'acceptAt':moment()[_0xcb49('0x12')](_0xcb49('0x28')),'reason':_0xcb49('0x36')};logger[_0xcb49('0x37')](util['format'](_0xcb49('0x38'),_0x3af4e1,_0x958224[_0xcb49('0x33')]));emitChannelQueueInteraction(_0x8c9ede[_0xcb49('0x2c')],_0x958224[_0xcb49('0x33')],_0x8c9ede[_0xcb49('0x27')],_0x8c9ede[_0xcb49('0xf')][_0xcb49('0x33')],_0x8c9ede[_0xcb49('0x2f')]['id'],![],_0x5bbebd,_0x958224['id']);return rpc[_0x8c9ede['channel']+_0xcb49('0x39')][_0xcb49('0x3a')](_0x8c9ede['interaction']['id'],{'queueId':_0x958224['id']})['then'](function(){if(rpc[_0x8c9ede['channel']+_0xcb49('0x34')]){return rpc[_0x8c9ede[_0xcb49('0x2c')]+_0xcb49('0x34')][_0xcb49('0x3a')](_0x3af4e1,_0x2ae2a4)[_0xcb49('0x3b')](function(_0x5d637f){logger[_0xcb49('0x35')](_0xcb49('0x3c'),_0x5d637f);});}});}}function endRouting(_0x503ddd,_0x1260c3,_0x5928f2,_0x3eca60){if(_0x503ddd&&_0x1260c3){_0x1260c3[_0xcb49('0x26')]-=0x1;var _0x3cac56={'leaveAt':moment()[_0xcb49('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xcb49('0x3d')};logger[_0xcb49('0x37')](util['format'](_0xcb49('0x3e'),_0x503ddd,_0x1260c3['name']));emitChannelQueueInteraction(_0x5928f2[_0xcb49('0x2c')],_0x1260c3[_0xcb49('0x33')],_0x5928f2['body'],_0x5928f2['account']['name'],_0x5928f2[_0xcb49('0x2f')]['id'],![],_0x3eca60);if(rpc[_0x5928f2[_0xcb49('0x2c')]+_0xcb49('0x34')]){return rpc[_0x5928f2['channel']+'QueueReport'][_0xcb49('0x3a')](_0x503ddd,_0x3cac56)[_0xcb49('0x3b')](function(_0x509544){logger[_0xcb49('0x35')](_0xcb49('0x3c'),_0x509544);});}}}function handleFindQueue(_0x41f021){return function(_0x1a0796){return _0x1a0796[_0xcb49('0x33')][_0xcb49('0x3f')]()===_0x41f021['toLowerCase']();};}exports[_0xcb49('0x40')]=function(_0x2a2f94,_0x418ba5,_0x5b21e4,_0x1c8387){return function(_0x40321b){try{var _0x2126ee={'name':_0x418ba5[0x0],'timeout':_0x418ba5[0x1]};var _0x162f12=queue[_0xcb49('0x0')](_0x2126ee,{'typecast':!![]});if(_0x162f12[_0xcb49('0x41')]){logger[_0xcb49('0x35')]('[%s][QUEUE]\x20%s',_0x2a2f94,_[_0xcb49('0x42')](_0x162f12,'message')[_0xcb49('0x43')](',\x20'));_0x40321b[_0xcb49('0x44')]();}else{var _0x59a713=_[_0xcb49('0x45')](_0x5b21e4[_0x1c8387[_0xcb49('0x2c')]+'Queues'],handleFindQueue(_0x2126ee[_0xcb49('0x33')]));if(_0x59a713){startRouting(_0x2a2f94,_0x59a713,_0x1c8387,_0x5b21e4);var _0x5a1f2e=(_0x59a713[_0xcb49('0x3d')]||0xa)*0x3e8;var _0x2de99b=(_0x2126ee[_0xcb49('0x3d')]||0x14)*0x3e8;var _0x2e30ee;if(_0x5a1f2e>_0x2de99b){_0x2de99b=_0x5a1f2e;}var _0x5802c8=seqqueue[_0xcb49('0x46')](_0x5a1f2e);_0x5802c8['id']=_0x2a2f94;_0x5802c8[_0xcb49('0x47')]=_0x5a1f2e;_0x5802c8[_0xcb49('0x48')]=_0x2de99b;_0x5802c8[_0xcb49('0x2c')]=_0x1c8387[_0xcb49('0x2c')];_0x5b21e4[_0xcb49('0x49')][_0x2a2f94]['on'](_0xcb49('0x4a'),function(){logger[_0xcb49('0x37')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2a2f94);stopRouting(_0x2a2f94,_0x59a713,_0x1c8387,_0x5b21e4);clearTimeout(_0x2e30ee);_0x2e30ee=undefined;_0x5802c8[_0xcb49('0x4b')](!![]);if(_0x5b21e4[_0xcb49('0x49')][_0x2a2f94]){delete _0x5b21e4[_0xcb49('0x49')][_0x2a2f94];}_0x40321b[_0xcb49('0x44')]();});_0x5b21e4[_0xcb49('0x49')][_0x2a2f94]['on'](_0xcb49('0x4c'),function(){if(_0x5b21e4[_0xcb49('0x49')][_0x2a2f94]){delete _0x5b21e4[_0xcb49('0x49')][_0x2a2f94];}});_0x2e30ee=setTimeout(function(){logger[_0xcb49('0x37')](_0xcb49('0x4d'),_0x2a2f94);endRouting(_0x2a2f94,_0x59a713,_0x1c8387,_0x5b21e4);clearTimeout(_0x2e30ee);_0x5802c8[_0xcb49('0x4b')](!![]);_0x40321b[_0xcb49('0x4e')]();},_0x2de99b);switch(_0x59a713[_0xcb49('0x4f')]){case _0xcb49('0x50'):strategy['rrmemory'](_0x5802c8,_0x59a713,_0x5b21e4,_0x1c8387);break;default:strategy['beepall'](_0x5802c8,_0x59a713,_0x5b21e4,_0x1c8387);}}else{logger[_0xcb49('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2a2f94,_0x2126ee[_0xcb49('0x33')]);_0x40321b['stop']();}}}catch(_0x7d8689){logger['error'](_0xcb49('0x51'),_0x2a2f94,_0x7d8689[_0xcb49('0x52')]);_0x40321b[_0xcb49('0x44')]();}};}; \ No newline at end of file +var _0x227d=['%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','body','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','account','queue','from','joinAt','clone','queue_id','InteractionId','format','%sQueuesWaitingInteractions'];(function(_0x236607,_0x37f8e9){var _0x1a4b1e=function(_0x3b24ce){while(--_0x3b24ce){_0x236607['push'](_0x236607['shift']());}};_0x1a4b1e(++_0x37f8e9);}(_0x227d,0x14e));var _0xd227=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x227d[_0x54b283];return _0x2462b3;};'use strict';var schema=require(_0xd227('0x0'));var _=require(_0xd227('0x1'));var util=require(_0xd227('0x2'));var seqqueue=require(_0xd227('0x3'));var moment=require(_0xd227('0x4'));var Redis=require(_0xd227('0x5'));var config=require(_0xd227('0x6'));var logger=require(_0xd227('0x7'))(_0xd227('0x8'));var strategy=require(_0xd227('0x9'));config[_0xd227('0xa')]=_[_0xd227('0xb')](config[_0xd227('0xa')],{'host':_0xd227('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd227('0xa')]));var attributes=['id','queue_id',_0xd227('0xd'),_0xd227('0xe'),_0xd227('0xf'),_0xd227('0x10')];function emit(_0x2ddea5,_0x360238,_0x5b411d){io['to'](_0x2ddea5)['emit'](_0x360238,_0x5b411d);}function emitChannelQueueInteraction(_0x5f8679,_0x455f40,_0xff6197,_0x3d7c1c,_0x35af2c,_0x5b450a,_0xf6353b,_0xca69){var _0x4ac7ec=_[_0xd227('0x11')](_0xff6197);_0x4ac7ec[_0xd227('0x12')]=_0xca69;_0x4ac7ec['queue']=_0x455f40;_0x4ac7ec[_0xd227('0xd')]=_0x3d7c1c;_0x4ac7ec['id']=_0x35af2c;if(_0x5b450a){attributes['push'](_['capitalize'](_0x5f8679)+_0xd227('0x13'));_0xf6353b[util[_0xd227('0x14')](_0xd227('0x15'),_0x5f8679)][_0x35af2c]=_['pick'](_0x4ac7ec,attributes);}else{delete _0xf6353b[util[_0xd227('0x14')](_0xd227('0x15'),_0x5f8679)][_0x35af2c];}emit(util['format'](_0xd227('0x16'),_0x5f8679,_0x455f40),util[_0xd227('0x14')](_0xd227('0x17'),_0x5f8679,_0x5b450a?_0xd227('0x18'):_0xd227('0x19')),_[_0xd227('0x1a')](_0x4ac7ec,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd227('0x1b')),'chatQueueReport':require(_0xd227('0x1c')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xd227('0x1d')),'whatsappQueueReport':require(_0xd227('0x1e')),'chatInteraction':require(_0xd227('0x1f')),'faxInteraction':require(_0xd227('0x20')),'mailInteraction':require(_0xd227('0x21')),'openchannelInteraction':require(_0xd227('0x22')),'smsInteraction':require(_0xd227('0x23')),'whatsappInteraction':require(_0xd227('0x24'))};var queue=schema({'name':{'type':_0xd227('0x25'),'required':!![],'message':_0xd227('0x26')},'timeout':{'type':_0xd227('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x31f61b,_0x45ba4e,_0x1f5725,_0xd0fdd){if(_0x31f61b&&_0x45ba4e&&_0x1f5725){_0x45ba4e[_0xd227('0x28')]+=0x1;var _0x591c6c={'uniqueid':_0x31f61b,'from':_0x1f5725['body']?_0x1f5725['body'][_0xd227('0xf')]:'','joinAt':moment()[_0xd227('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f5725[_0xd227('0x29')]?_0x1f5725[_0xd227('0x29')]['id']:null,'ListId':_0x1f5725[_0xd227('0x2a')]?_0x1f5725['list']['id']:null};_0x591c6c[_['upperFirst'](_0x1f5725[_0xd227('0x2b')])+_0xd227('0x2c')]=_0x45ba4e['id']||null;_0x591c6c[_[_0xd227('0x2d')](_0x1f5725[_0xd227('0x2b')])+_0xd227('0x13')]=_0x1f5725[_0xd227('0x2e')]?_0x1f5725[_0xd227('0x2e')]['id']:null;_0x591c6c[_[_0xd227('0x2d')](_0x1f5725['channel'])+_0xd227('0x2f')]=_0x1f5725[_0xd227('0x30')]?_0x1f5725['message']['id']:null;_0x591c6c[_[_0xd227('0x2d')](_0x1f5725['channel'])+(_0x1f5725['channel']!=='chat'?_0xd227('0x31'):_0xd227('0x32'))]=_0x1f5725[_0xd227('0xd')]?_0x1f5725[_0xd227('0xd')]['id']:null;logger['info'](util['format'](_0xd227('0x33'),_0x31f61b,_0x45ba4e[_0xd227('0x34')]));emitChannelQueueInteraction(_0x1f5725[_0xd227('0x2b')],_0x45ba4e[_0xd227('0x34')],_0x591c6c,_0x1f5725[_0xd227('0xd')]['name'],_0x1f5725[_0xd227('0x30')]['id'],!![],_0xd0fdd,_0x45ba4e['id']);if(rpc[_0x1f5725['channel']+_0xd227('0x35')]){return rpc[_0x1f5725[_0xd227('0x2b')]+_0xd227('0x35')][_0xd227('0x36')](_0x591c6c)[_0xd227('0x37')](function(_0x18a358){logger[_0xd227('0x38')](_0xd227('0x39'),_0x18a358);});}}}function stopRouting(_0x4a4293,_0x3219b9,_0x555463,_0x328eb3){if(_0x4a4293&&_0x3219b9){_0x3219b9[_0xd227('0x28')]-=0x1;var _0x4ff39b={'leaveAt':moment()[_0xd227('0x14')](_0xd227('0x3a')),'acceptAt':moment()[_0xd227('0x14')](_0xd227('0x3a')),'reason':_0xd227('0x3b')};logger[_0xd227('0x3c')](util[_0xd227('0x14')](_0xd227('0x3d'),_0x4a4293,_0x3219b9[_0xd227('0x34')]));emitChannelQueueInteraction(_0x555463['channel'],_0x3219b9[_0xd227('0x34')],_0x555463[_0xd227('0x3e')],_0x555463[_0xd227('0xd')][_0xd227('0x34')],_0x555463['message']['id'],![],_0x328eb3,_0x3219b9['id']);return rpc[_0x555463[_0xd227('0x2b')]+_0xd227('0x3f')][_0xd227('0x40')](_0x555463['interaction']['id'],{'queueId':_0x3219b9['id']})[_0xd227('0x41')](function(){if(rpc[_0x555463['channel']+'QueueReport']){return rpc[_0x555463[_0xd227('0x2b')]+'QueueReport'][_0xd227('0x40')](_0x4a4293,_0x4ff39b)[_0xd227('0x37')](function(_0x18de09){logger[_0xd227('0x38')](_0xd227('0x42'),_0x18de09);});}});}}function endRouting(_0x38c049,_0x4fe297,_0x58cf5d,_0x1fd0ee){if(_0x38c049&&_0x4fe297){_0x4fe297[_0xd227('0x28')]-=0x1;var _0x38cb4c={'leaveAt':moment()[_0xd227('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xd227('0x3a')),'reason':_0xd227('0x43')};logger[_0xd227('0x3c')](util[_0xd227('0x14')](_0xd227('0x44'),_0x38c049,_0x4fe297[_0xd227('0x34')]));emitChannelQueueInteraction(_0x58cf5d['channel'],_0x4fe297[_0xd227('0x34')],_0x58cf5d['body'],_0x58cf5d[_0xd227('0xd')][_0xd227('0x34')],_0x58cf5d[_0xd227('0x30')]['id'],![],_0x1fd0ee);if(rpc[_0x58cf5d[_0xd227('0x2b')]+_0xd227('0x35')]){return rpc[_0x58cf5d['channel']+_0xd227('0x35')][_0xd227('0x40')](_0x38c049,_0x38cb4c)[_0xd227('0x37')](function(_0x498e7a){logger[_0xd227('0x38')](_0xd227('0x42'),_0x498e7a);});}}}function handleFindQueue(_0x5975c9){return function(_0x2c2419){return _0x2c2419[_0xd227('0x34')]['toLowerCase']()===_0x5975c9[_0xd227('0x45')]();};}exports[_0xd227('0x46')]=function(_0xc11a54,_0x48693f,_0x516cb7,_0x44b23d){return function(_0x29e309){try{var _0x386a81={'name':_0x48693f[0x0],'timeout':_0x48693f[0x1]};var _0x5b655b=queue['validate'](_0x386a81,{'typecast':!![]});if(_0x5b655b['length']){logger[_0xd227('0x38')]('[%s][QUEUE]\x20%s',_0xc11a54,_['map'](_0x5b655b,_0xd227('0x30'))[_0xd227('0x47')](',\x20'));_0x29e309[_0xd227('0x48')]();}else{var _0x500aac=_[_0xd227('0x49')](_0x516cb7[_0x44b23d[_0xd227('0x2b')]+_0xd227('0x4a')],handleFindQueue(_0x386a81['name']));if(_0x500aac){startRouting(_0xc11a54,_0x500aac,_0x44b23d,_0x516cb7);var _0x475d6d=(_0x500aac[_0xd227('0x43')]||0xa)*0x3e8;var _0xea3803=(_0x386a81[_0xd227('0x43')]||0x14)*0x3e8;var _0x514f50;if(_0x475d6d>_0xea3803){_0xea3803=_0x475d6d;}var _0x1e2952=seqqueue[_0xd227('0x4b')](_0x475d6d);_0x1e2952['id']=_0xc11a54;_0x1e2952[_0xd227('0x4c')]=_0x475d6d;_0x1e2952[_0xd227('0x4d')]=_0xea3803;_0x1e2952[_0xd227('0x2b')]=_0x44b23d['channel'];_0x516cb7[_0xd227('0x4e')][_0xc11a54]['on'](_0xd227('0x4f'),function(){logger[_0xd227('0x3c')](_0xd227('0x50'),_0xc11a54);stopRouting(_0xc11a54,_0x500aac,_0x44b23d,_0x516cb7);clearTimeout(_0x514f50);_0x514f50=undefined;_0x1e2952[_0xd227('0x51')](!![]);if(_0x516cb7[_0xd227('0x4e')][_0xc11a54]){delete _0x516cb7[_0xd227('0x4e')][_0xc11a54];}_0x29e309[_0xd227('0x48')]();});_0x516cb7[_0xd227('0x4e')][_0xc11a54]['on'](_0xd227('0x52'),function(){if(_0x516cb7['rules'][_0xc11a54]){delete _0x516cb7[_0xd227('0x4e')][_0xc11a54];}});_0x514f50=setTimeout(function(){logger['info'](_0xd227('0x53'),_0xc11a54);endRouting(_0xc11a54,_0x500aac,_0x44b23d,_0x516cb7);clearTimeout(_0x514f50);_0x1e2952[_0xd227('0x51')](!![]);_0x29e309['next']();},_0xea3803);switch(_0x500aac[_0xd227('0x54')]){case'rrmemory':strategy[_0xd227('0x55')](_0x1e2952,_0x500aac,_0x516cb7,_0x44b23d);break;default:strategy[_0xd227('0x56')](_0x1e2952,_0x500aac,_0x516cb7,_0x44b23d);}}else{logger[_0xd227('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc11a54,_0x386a81[_0xd227('0x34')]);_0x29e309[_0xd227('0x48')]();}}}catch(_0x24bb8c){logger[_0xd227('0x38')](_0xd227('0x57'),_0xc11a54,_0x24bb8c[_0xd227('0x58')]);_0x29e309['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 1483068..8806388 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 _0xee14=['RINGING',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog'];(function(_0x22816c,_0x4e43d){var _0x81784a=function(_0x4deef3){while(--_0x4deef3){_0x22816c['push'](_0x22816c['shift']());}};_0x81784a(++_0x4e43d);}(_0xee14,0x13a));var _0x4ee1=function(_0x3f10a7,_0x3ad9c5){_0x3f10a7=_0x3f10a7-0x0;var _0x1506b5=_0xee14[_0x3f10a7];return _0x1506b5;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x4ee1('0x0'));var logger=require(_0x4ee1('0x1'))(_0x4ee1('0x2'));var Agent=function(_0x1fa407,_0x18e3c4,_0x236ccd,_0x34a0ae){this[_0x4ee1('0x3')]=uuid['v4']();this[_0x4ee1('0x4')]=_0x1fa407;this['agent']=_0x18e3c4;this[_0x4ee1('0x5')]=_0x236ccd;this['routing']=_0x34a0ae;this[_0x4ee1('0x4')][_0x4ee1('0x6')](this[_0x4ee1('0x7')][_0x4ee1('0x8')](this),this[_0x4ee1('0x9')][_0x4ee1('0x8')](this));this['squeue']['on'](_0x4ee1('0xa'),this[_0x4ee1('0x9')]['bind'](this));this[_0x4ee1('0x4')]['on'](_0x4ee1('0xb'),this[_0x4ee1('0xc')][_0x4ee1('0x8')](this));};Agent['prototype'][_0x4ee1('0x6')]=function(){this[_0x4ee1('0x4')][_0x4ee1('0x6')](this[_0x4ee1('0x7')][_0x4ee1('0x8')](this),this[_0x4ee1('0x9')]['bind'](this));};Agent[_0x4ee1('0xd')][_0x4ee1('0xc')]=function(){this[_0x4ee1('0x9')](!![]);};Agent[_0x4ee1('0xd')][_0x4ee1('0x7')]=function(){logger[_0x4ee1('0xe')](_0x4ee1('0xf'),this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x10')]['id']);if(_['isNil'](this[_0x4ee1('0x5')][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']])){logger[_0x4ee1('0xe')](_0x4ee1('0x12'),this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x10')]['id']);setTimeout(this[_0x4ee1('0x6')][_0x4ee1('0x8')](this),0x3e8);}else{if(this[_0x4ee1('0x2')][_0x4ee1('0x13')]||util['isAgentAvailable'](this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x5')][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']],this[_0x4ee1('0x4')][_0x4ee1('0x14')],![])){this['realtime'][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']][_0x4ee1('0x15')]=!![];this[_0x4ee1('0x5')][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']][_0x4ee1('0x16')]=undefined;util[_0x4ee1('0x17')](this[_0x4ee1('0x5')],this[_0x4ee1('0x2')],this['agent'],this['squeue'][_0x4ee1('0x14')]);util[_0x4ee1('0x18')](this[_0x4ee1('0x3')],this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x5')][_0x4ee1('0x11')][this['agent']['id']],null,this['routing']);util[_0x4ee1('0x19')](this[_0x4ee1('0x4')]['id'],this['realtime'][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']],_0x4ee1('0x1a')+(this[_0x4ee1('0x2')][_0x4ee1('0x13')]?_0x4ee1('0x1b'):''));}else{logger[_0x4ee1('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x4ee1('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x4ee1('0x6')]['bind'](this),0x3e8);}}};Agent[_0x4ee1('0xd')][_0x4ee1('0x9')]=function(_0x59a34e){if(_[_0x4ee1('0x1c')](this[_0x4ee1('0x5')]['agents'][this[_0x4ee1('0x10')]['id']])){return logger['debug'](_0x4ee1('0x12'),this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x10')]['id']);}else{logger[_0x4ee1('0xe')](_0x4ee1('0x1d'),this['squeue']['id'],this[_0x4ee1('0x10')]['id']);util[_0x4ee1('0x1e')](this[_0x4ee1('0x3')],this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x5')][_0x4ee1('0x11')][this['agent']['id']],null,this['routing']);this[_0x4ee1('0x5')][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']]['busy']=![];this[_0x4ee1('0x5')][_0x4ee1('0x11')][this[_0x4ee1('0x10')]['id']][_0x4ee1('0x16')]=undefined;util[_0x4ee1('0x1f')](this[_0x4ee1('0x5')],this[_0x4ee1('0x2')],this[_0x4ee1('0x10')],this[_0x4ee1('0x4')][_0x4ee1('0x14')]);util[_0x4ee1('0x19')](this[_0x4ee1('0x4')]['id'],this[_0x4ee1('0x5')]['agents'][this[_0x4ee1('0x10')]['id']],_0x59a34e?_0x4ee1('0x20'):_0x4ee1('0x21'));}if(!_0x59a34e){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x257f67,_0x84480e,_0x74e6e2,_0x1f2b4b){return new Agent(_0x257f67,_0x84480e,_0x74e6e2,_0x1f2b4b);}module['exports']=agent; \ No newline at end of file +var _0xe5b3=['exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT'];(function(_0x416f91,_0x3cf525){var _0x2d15a0=function(_0xe9a889){while(--_0xe9a889){_0x416f91['push'](_0x416f91['shift']());}};_0x2d15a0(++_0x3cf525);}(_0xe5b3,0x133));var _0x3e5b=function(_0x45d8be,_0x5a73da){_0x45d8be=_0x45d8be-0x0;var _0x52a4d4=_0xe5b3[_0x45d8be];return _0x52a4d4;};'use strict';var _=require('lodash');var uuid=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var logger=require(_0x3e5b('0x2'))(_0x3e5b('0x3'));var Agent=function(_0x2a71ef,_0x3171c5,_0x7f1cc0,_0x1e58ed){this[_0x3e5b('0x4')]=uuid['v4']();this[_0x3e5b('0x5')]=_0x2a71ef;this[_0x3e5b('0x6')]=_0x3171c5;this['realtime']=_0x7f1cc0;this[_0x3e5b('0x3')]=_0x1e58ed;this[_0x3e5b('0x5')]['push'](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this['squeue']['on']('timeout',this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this[_0x3e5b('0x5')]['on'](_0x3e5b('0xa'),this[_0x3e5b('0xb')]['bind'](this));};Agent[_0x3e5b('0xc')]['push']=function(){this[_0x3e5b('0x5')][_0x3e5b('0xd')](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));};Agent[_0x3e5b('0xc')]['handleDrained']=function(){this[_0x3e5b('0x9')](!![]);};Agent['prototype']['handleRun']=function(){logger['debug'](_0x3e5b('0xe'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);if(_['isNil'](this[_0x3e5b('0xf')]['agents'][this['agent']['id']])){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')]['bind'](this),0x3e8);}else{if(this[_0x3e5b('0x3')][_0x3e5b('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],this[_0x3e5b('0x5')][_0x3e5b('0x14')],![])){this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=!![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x17')](this['realtime'],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')][_0x3e5b('0x14')]);util['showNotification'](this[_0x3e5b('0x4')],this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this['agent']['id']],null,this[_0x3e5b('0x3')]);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],_0x3e5b('0x19')+(this[_0x3e5b('0x3')]['forcedOwnership']?_0x3e5b('0x1a'):''));}else{logger['debug'](_0x3e5b('0x1b'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}}};Agent[_0x3e5b('0xc')][_0x3e5b('0x9')]=function(_0x3cfaf6){if(_[_0x3e5b('0x1c')](this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']])){return logger[_0x3e5b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x1d'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);util[_0x3e5b('0x1e')](this['notificationId'],this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],null,this[_0x3e5b('0x3')]);this['realtime'][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x1f')](this[_0x3e5b('0xf')],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')]['channel']);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],_0x3cfaf6?'STOP':_0x3e5b('0x20'));}if(!_0x3cfaf6){setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}};function agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1){return new Agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1);}module[_0x3e5b('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index d1dc80e..4c3d6c4 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 _0x7ef8=['showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','TIMEOUT','busy','removeWaitingNotification','exports','lodash','uuid','../../../../../config/logger','routing','queue','squeue','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busyQueue','name','saveWaitingNotification','channel'];(function(_0xefc37a,_0x6aa74c){var _0x125b15=function(_0x3500f7){while(--_0x3500f7){_0xefc37a['push'](_0xefc37a['shift']());}};_0x125b15(++_0x6aa74c);}(_0x7ef8,0xe8));var _0x87ef=function(_0x1ef5bb,_0x1f6f91){_0x1ef5bb=_0x1ef5bb-0x0;var _0x1083eb=_0x7ef8[_0x1ef5bb];return _0x1083eb;};'use strict';var _=require(_0x87ef('0x0'));var uuid=require(_0x87ef('0x1'));var util=require('./util');var logger=require(_0x87ef('0x2'))(_0x87ef('0x3'));var Beepall=function(_0x23dc74,_0x1f2c1a,_0x4b74f8,_0x1b5001){this['notificationId']=uuid['v4']();this['squeue']=_0x23dc74;this[_0x87ef('0x4')]=_0x1f2c1a;this['realtime']=_0x4b74f8;this[_0x87ef('0x3')]=_0x1b5001;this[_0x87ef('0x5')][_0x87ef('0x6')](this[_0x87ef('0x7')]['bind'](this),this[_0x87ef('0x8')][_0x87ef('0x9')](this));this[_0x87ef('0x5')]['on'](_0x87ef('0xa'),this['handleTimeout'][_0x87ef('0x9')](this));this[_0x87ef('0x5')]['on'](_0x87ef('0xb'),this[_0x87ef('0xc')][_0x87ef('0x9')](this));};Beepall['prototype'][_0x87ef('0x6')]=function(){this[_0x87ef('0x5')][_0x87ef('0x6')](this[_0x87ef('0x7')]['bind'](this),this[_0x87ef('0x8')]['bind'](this));};Beepall['prototype'][_0x87ef('0xc')]=function(){this[_0x87ef('0x8')](!![]);};Beepall[_0x87ef('0xd')][_0x87ef('0x7')]=function(){var _0x2a69eb=!![];if(!_[_0x87ef('0xe')](this[_0x87ef('0x4')])&&!_[_0x87ef('0xe')](this[_0x87ef('0x4')][_0x87ef('0xf')])&&this['queue'][_0x87ef('0xf')][_0x87ef('0x10')]>0x0){for(var _0x56f48e=0x0,_0x206955;_0x56f48e0x0){for(var _0x4b9f7f=0x0,_0x2cc588;_0x4b9f7f0x0&&_0x32d911[_0x4d0c1b+_0x5e3a('0x24')]>=_0x32d911[_0x4d0c1b+_0x5e3a('0x22')]){writeLog(_0x54efd6,_0x32d911,_0x4d0c1b[_0x5e3a('0x25')]()+_0x5e3a('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x24704a,_0x4bd9c9,_0x40e671,_0x2abb34,_0x1b5c97){return sendNotification(!![],_0x24704a,_0x4bd9c9,_0x40e671,_0x2abb34,_0x1b5c97);};exports['hideNotification']=function(_0x3d1c70,_0xc5887d,_0x49ed26,_0x321226,_0x525992){return sendNotification(![],_0x3d1c70,_0xc5887d,_0x49ed26,_0x321226,_0x525992);};exports[_0x5e3a('0x27')]=function(_0x3f807e,_0x8ab22f,_0x129085){var _0xdb165=_0x8ab22f[_0x5e3a('0x28')]['UserId'];if(!_0xdb165&&_0x129085){_0xdb165=_0x129085['id'];}var _0x1c1d4b=_['some'](_0x3f807e[_0x8ab22f[_0x5e3a('0x29')]+'QueuesWaitingInteractions'],function(_0x34859c){var _0x4752ab=_[_0x5e3a('0x2a')](_0x8ab22f[_0x5e3a('0x29')])+_0x5e3a('0x2b');return _0x34859c[_0x4752ab]===_0x8ab22f[_0x5e3a('0x28')]['id'];});if(!_0x1c1d4b&&_0xdb165&&_0x3f807e[_0x5e3a('0x2c')][_0xdb165]){_0x1c1d4b=_[_0x5e3a('0x2d')](_0x3f807e[_0x5e3a('0x2c')][_0xdb165][_0x8ab22f[_0x5e3a('0x29')]+_0x5e3a('0x2e')],function(_0x2124c9){return _0x2124c9['id']===_0x8ab22f['interaction']['id'];});}return _0x1c1d4b;};exports[_0x5e3a('0x2f')]=function(_0xe06003,_0x220d6c,_0x4ad09f,_0x444ca2){if(_0x4ad09f&&_0x4ad09f['id']&&_0xe06003[_0x5e3a('0x2c')]&&_0xe06003['agents'][_0x4ad09f['id']]){_0xe06003[_0x5e3a('0x2c')][_0x4ad09f['id']][_0x444ca2+_0x5e3a('0x2e')][_0x220d6c[_0x5e3a('0x13')]['id']]={'id':_0x220d6c[_0x5e3a('0x28')]['id']};}};exports[_0x5e3a('0x30')]=function(_0x58a5bf,_0x3a00e6,_0x413e24,_0xc5093f){if(_0x413e24&&_0x413e24['id']&&_0x58a5bf[_0x5e3a('0x2c')]&&_0x58a5bf[_0x5e3a('0x2c')][_0x413e24['id']]){delete _0x58a5bf[_0x5e3a('0x2c')][_0x413e24['id']][_0xc5093f+_0x5e3a('0x2e')][_0x3a00e6[_0x5e3a('0x13')]['id']];}};exports[_0x5e3a('0x31')]=writeLog; \ No newline at end of file +var _0xbdbe=['format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','../utils','../../../../../config/environment','routing','defaults','localhost','redis','split','name','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error'];(function(_0x22b6e5,_0x2819c8){var _0x1c21e5=function(_0x18a52c){while(--_0x18a52c){_0x22b6e5['push'](_0x22b6e5['shift']());}};_0x1c21e5(++_0x2819c8);}(_0xbdbe,0x1f3));var _0xebdb=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xbdbe[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xebdb('0x0'));var util=require('util');var utils=require(_0xebdb('0x1'));var Redis=require('ioredis');var config=require(_0xebdb('0x2'));var logger=require('../../../../../config/logger')(_0xebdb('0x3'));config['redis']=_[_0xebdb('0x4')](config['redis'],{'host':_0xebdb('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebdb('0x6')]));function sendNotification(_0xbc1822,_0x16eacd,_0x454e31,_0x19ba0e,_0x253968,_0x31e053){var _0x47422b=_0x31e053||{};var _0x441c93=_0x454e31[_0xebdb('0x7')]('.');var _0x3b2730={'uniqueid':_0x16eacd,'channel':_0x441c93[0x0],'id':_0x441c93[0x1],'title':_0x441c93[0x0]+'\x20interaction','interactionId':_0x441c93[0x2],'queue':_0x253968?_0x253968[_0xebdb('0x8')]:null,'sound':_0x47422b[_0xebdb('0x9')]['notificationSound'],'shake':_0x47422b[_0xebdb('0x9')][_0xebdb('0xa')]};try{if(!_0x47422b[_0xebdb('0xb')]){_0x47422b[_0xebdb('0xb')]={};}if(_0x253968){_0x47422b['body']['queue']=_0x253968;}else if(_0x47422b[_0xebdb('0xb')][_0xebdb('0xc')]){delete _0x47422b[_0xebdb('0xb')][_0xebdb('0xc')];}_0x3b2730['msg']=utils[_0xebdb('0xd')](_0x47422b[_0xebdb('0x9')][_0xebdb('0xe')],_0x47422b);}catch(_0x46f8f8){_0x3b2730[_0xebdb('0xf')]=_0xebdb('0x10');logger[_0xebdb('0x11')](util[_0xebdb('0x12')](_0xebdb('0x13'),_0x16eacd,_0x46f8f8[_0xebdb('0x14')]));}io['to'](util['format'](_0xebdb('0x15'),_0x19ba0e['name']))['emit'](util[_0xebdb('0x12')](_0xebdb('0x16'),_0xbc1822?'save':_0xebdb('0x17')),_0x3b2730);}function writeLog(_0x2663d7,_0x4cc029,_0x2de2f5){return logger['debug'](util['format'](_0xebdb('0x18'),_0x2663d7,_0x4cc029[_0xebdb('0x8')],_0x2de2f5));}exports[_0xebdb('0x19')]=function(_0x5c76cc,_0x38a4dd,_0x4c5a44,_0x3b1b87){if(_0x38a4dd[_0xebdb('0x1a')]){writeLog(_0x5c76cc,_0x38a4dd,'BUSY');return![];}if(!_0x38a4dd['online']){writeLog(_0x5c76cc,_0x38a4dd,_0xebdb('0x1b'));return![];}if(_0x38a4dd[_0x4c5a44+'Pause']){writeLog(_0x5c76cc,_0x38a4dd,_0xebdb('0x1c'));return![];}if(_0x3b1b87&&_0x38a4dd[_0xebdb('0x1d')](_0x4c5a44+_0xebdb('0x1e'))&&_0x38a4dd['hasOwnProperty'](_0x4c5a44+'CurrentCapacity')){if(_0x38a4dd[_0x4c5a44+_0xebdb('0x1e')]>0x0&&_0x38a4dd[_0x4c5a44+_0xebdb('0x1f')]>=_0x38a4dd[_0x4c5a44+_0xebdb('0x1e')]){writeLog(_0x5c76cc,_0x38a4dd,_0x4c5a44[_0xebdb('0x20')]()+_0xebdb('0x21'));return![];}}return!![];};exports[_0xebdb('0x22')]=function(_0x42026f,_0x184871,_0x5b721f,_0x1f4b46,_0x368c77){return sendNotification(!![],_0x42026f,_0x184871,_0x5b721f,_0x1f4b46,_0x368c77);};exports[_0xebdb('0x23')]=function(_0x577abd,_0x24b409,_0x59d9f7,_0x3da0b4,_0x1ce629){return sendNotification(![],_0x577abd,_0x24b409,_0x59d9f7,_0x3da0b4,_0x1ce629);};exports['checkWaitingNotifications']=function(_0x19ef3c,_0x57f324,_0x497642){var _0x184ec4=_0x57f324[_0xebdb('0x24')][_0xebdb('0x25')];if(!_0x184ec4&&_0x497642){_0x184ec4=_0x497642['id'];}var _0x5136f2=_[_0xebdb('0x26')](_0x19ef3c[_0x57f324[_0xebdb('0x27')]+_0xebdb('0x28')],function(_0x3b4e92){var _0x11fe9f=_['capitalize'](_0x57f324['channel'])+_0xebdb('0x29');return _0x3b4e92[_0x11fe9f]===_0x57f324[_0xebdb('0x24')]['id'];});if(!_0x5136f2&&_0x184ec4&&_0x19ef3c['agents'][_0x184ec4]){_0x5136f2=_['some'](_0x19ef3c['agents'][_0x184ec4][_0x57f324['channel']+_0xebdb('0x2a')],function(_0x5f578a){return _0x5f578a['id']===_0x57f324[_0xebdb('0x24')]['id'];});}return _0x5136f2;};exports[_0xebdb('0x2b')]=function(_0x54466b,_0x597607,_0x190bdb,_0x33f64d){if(_0x190bdb&&_0x190bdb['id']&&_0x54466b[_0xebdb('0x2c')]&&_0x54466b['agents'][_0x190bdb['id']]){_0x54466b[_0xebdb('0x2c')][_0x190bdb['id']][_0x33f64d+_0xebdb('0x2a')][_0x597607[_0xebdb('0x14')]['id']]={'id':_0x597607[_0xebdb('0x24')]['id']};}};exports[_0xebdb('0x2d')]=function(_0x1d7986,_0x48d401,_0x179de1,_0x192d7d){if(_0x179de1&&_0x179de1['id']&&_0x1d7986[_0xebdb('0x2c')]&&_0x1d7986[_0xebdb('0x2c')][_0x179de1['id']]){delete _0x1d7986[_0xebdb('0x2c')][_0x179de1['id']][_0x192d7d+_0xebdb('0x2a')][_0x48d401[_0xebdb('0x14')]['id']];}};exports[_0xebdb('0x2e')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 0da55c8..85c2db7 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 _0xdbfb=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable'];(function(_0x2d061c,_0x48e86c){var _0x2f1dfd=function(_0x38238c){while(--_0x38238c){_0x2d061c['push'](_0x2d061c['shift']());}};_0x2f1dfd(++_0x48e86c);}(_0xdbfb,0x16b));var _0xbdbf=function(_0x2ac323,_0x5318aa){_0x2ac323=_0x2ac323-0x0;var _0x438edf=_0xdbfb[_0x2ac323];return _0x438edf;};'use strict';var schema=require(_0xbdbf('0x0'));var sh=require(_0xbdbf('0x1'));var _=require('lodash');var utils=require(_0xbdbf('0x2'));var logger=require(_0xbdbf('0x3'))('routing');var system=schema({'command':{'type':_0xbdbf('0x4'),'required':!![],'message':_0xbdbf('0x5')}});exports[_0xbdbf('0x6')]=function(_0x53d708,_0x58d9ad){return function(_0x388848){try{var _0x1dd17f={'command':_0x58d9ad[0x0]};var _0x37e176=system[_0xbdbf('0x0')](_0x1dd17f,{'typecast':!![]});if(_0x37e176[_0xbdbf('0x7')]){logger[_0xbdbf('0x8')](_0xbdbf('0x9'),_0x53d708,_['map'](_0x37e176,_0xbdbf('0xa'))[_0xbdbf('0xb')](',\x20'));logger[_0xbdbf('0xc')](_0xbdbf('0xd'),_0x53d708);_0x388848[_0xbdbf('0xe')]();}else{var _0x5e5709=this;var _0x4ad706=utils[_0xbdbf('0xf')](_0x58d9ad[0x0],this);logger['info'](_0xbdbf('0x10'),_0x53d708,_0x4ad706);sh['exec'](_['trim'](_0x4ad706),function(_0x4fd261,_0x212f9f){logger['info'](_0xbdbf('0x11'),_0x53d708,_0x4fd261);if(_0x4fd261==0x0){var _0x2ec2c6=_0x212f9f[_0xbdbf('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xbdbf('0x13')](_0x58d9ad[0x1])||_['isEmpty'](_0x58d9ad[0x1])){logger[_0xbdbf('0xc')](_0xbdbf('0x14'),_0x53d708);_0x5e5709[_0xbdbf('0x15')][_0x58d9ad[0x1]]=_0x2ec2c6;}else{logger[_0xbdbf('0xc')](_0xbdbf('0x16'),_0x53d708,_0x58d9ad[0x1],_0x2ec2c6);_0x5e5709[_0xbdbf('0x15')][_0x58d9ad[0x1]]=_0x2ec2c6;}}_0x388848[_0xbdbf('0xe')]();});}}catch(_0x162eac){logger[_0xbdbf('0x8')](_0xbdbf('0x9'),_0x53d708,_['isObject'](_0x162eac)?JSON[_0xbdbf('0x17')](_0x162eac):_0x162eac);logger[_0xbdbf('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x53d708);_0x388848['next']();}};}; \ No newline at end of file +var _0xc8c3=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc8c3,0x1c1));var _0x3c8c=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0xc8c3[_0x4c98b9];return _0x3a257a;};'use strict';var schema=require(_0x3c8c('0x0'));var sh=require(_0x3c8c('0x1'));var _=require(_0x3c8c('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3c8c('0x3'));var system=schema({'command':{'type':_0x3c8c('0x4'),'required':!![],'message':_0x3c8c('0x5')}});exports['consequence']=function(_0x5a13ed,_0xc2654){return function(_0x2966fa){try{var _0xa99947={'command':_0xc2654[0x0]};var _0x5e1173=system['validate'](_0xa99947,{'typecast':!![]});if(_0x5e1173['length']){logger[_0x3c8c('0x6')](_0x3c8c('0x7'),_0x5a13ed,_['map'](_0x5e1173,'message')['join'](',\x20'));logger['info'](_0x3c8c('0x8'),_0x5a13ed);_0x2966fa[_0x3c8c('0x9')]();}else{var _0x45e832=this;var _0x50c2de=utils[_0x3c8c('0xa')](_0xc2654[0x0],this);logger[_0x3c8c('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5a13ed,_0x50c2de);sh[_0x3c8c('0xc')](_['trim'](_0x50c2de),function(_0x525f42,_0x5122a8){logger['info'](_0x3c8c('0xd'),_0x5a13ed,_0x525f42);if(_0x525f42==0x0){var _0x406014=_0x5122a8[_0x3c8c('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x3c8c('0xf')](_0xc2654[0x1])||_[_0x3c8c('0x10')](_0xc2654[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5a13ed);_0x45e832[_0x3c8c('0x11')][_0xc2654[0x1]]=_0x406014;}else{logger[_0x3c8c('0xb')](_0x3c8c('0x12'),_0x5a13ed,_0xc2654[0x1],_0x406014);_0x45e832[_0x3c8c('0x11')][_0xc2654[0x1]]=_0x406014;}}_0x2966fa[_0x3c8c('0x9')]();});}}catch(_0x204e6e){logger[_0x3c8c('0x6')](_0x3c8c('0x7'),_0x5a13ed,_[_0x3c8c('0x13')](_0x204e6e)?JSON[_0x3c8c('0x14')](_0x204e6e):_0x204e6e);logger[_0x3c8c('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5a13ed);_0x2966fa[_0x3c8c('0x9')]();}};}; \ 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 e434e78..a691e57 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 _0x9251=['info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','next','[%s][TAG]\x20%s','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then'];(function(_0x3dc281,_0x33750d){var _0x331ba2=function(_0x213435){while(--_0x213435){_0x3dc281['push'](_0x3dc281['shift']());}};_0x331ba2(++_0x33750d);}(_0x9251,0x6b));var _0x1925=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x9251[_0xa1e3e3];return _0xc980e9;};'use strict';var schema=require(_0x1925('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x1925('0x1')),'openchannelInteraction':require(_0x1925('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x1925('0x3')),'faxInteraction':require(_0x1925('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1925('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1925('0x6')}});exports[_0x1925('0x7')]=function(_0x2955be,_0x27a9dd,_0x22f694,_0x2556c5){return function(_0x3036d7){try{var _0x55508f={'tag':_0x27a9dd[0x0]};var _0x14b495=tag['validate'](_0x55508f,{'typecast':!![]});if(_0x14b495[_0x1925('0x8')]){logger[_0x1925('0x9')]('[%s][TAG]\x20%s',_0x2955be,_[_0x1925('0xa')](_0x14b495,_0x1925('0xb'))[_0x1925('0xc')](',\x20'));logger['info'](_0x1925('0xd'),_0x2955be);_0x3036d7['next']();}else{var _0x1b0f97={'ids':[_0x27a9dd[0x0]]};if(rpc[_0x2556c5[_0x1925('0xe')]+'Interaction']){rpc[_0x2556c5[_0x1925('0xe')]+_0x1925('0xf')]['addTags'](_0x2556c5[_0x1925('0x10')]['id'],_0x1b0f97)[_0x1925('0x11')](function(_0x577d5f){logger[_0x1925('0x12')](_0x1925('0x13'),_0x2955be,_0x27a9dd[0x1],_0x2556c5[_0x1925('0xe')],_0x2556c5[_0x1925('0x10')]['id']);})[_0x1925('0x14')](function(_0x3fc21b){logger[_0x1925('0x9')]('[%s][TAG]\x20%s',_0x2955be,JSON[_0x1925('0x15')](_0x3fc21b));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2955be);})['finally'](function(){_0x3036d7[_0x1925('0x16')]();});}}}catch(_0x28d04d){logger[_0x1925('0x9')](_0x1925('0x17'),_0x2955be,_[_0x1925('0x18')](_0x28d04d)?JSON['stringify'](_0x28d04d):_0x28d04d);logger[_0x1925('0x12')](_0x1925('0xd'),_0x2955be);_0x3036d7['next']();}};}; \ No newline at end of file +var _0x9217=['isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags','interaction','then','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9217,0x11f));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0x7921('0x0'));var rpc={'chatInteraction':require(_0x7921('0x1')),'openchannelInteraction':require(_0x7921('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7921('0x3')),'faxInteraction':require(_0x7921('0x4')),'whatsappInteraction':require(_0x7921('0x5'))};var logger=require('../../../../config/logger')(_0x7921('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7921('0x7')}});exports[_0x7921('0x8')]=function(_0x5bf399,_0x455c74,_0x11b3d1,_0x4267d4){return function(_0x40b831){try{var _0x3cb1b5={'tag':_0x455c74[0x0]};var _0x2a104d=tag[_0x7921('0x9')](_0x3cb1b5,{'typecast':!![]});if(_0x2a104d[_0x7921('0xa')]){logger[_0x7921('0xb')](_0x7921('0xc'),_0x5bf399,_[_0x7921('0xd')](_0x2a104d,_0x7921('0xe'))['join'](',\x20'));logger[_0x7921('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5bf399);_0x40b831[_0x7921('0x10')]();}else{var _0x490354={'ids':[_0x455c74[0x0]]};if(rpc[_0x4267d4[_0x7921('0x11')]+_0x7921('0x12')]){rpc[_0x4267d4[_0x7921('0x11')]+'Interaction'][_0x7921('0x13')](_0x4267d4[_0x7921('0x14')]['id'],_0x490354)[_0x7921('0x15')](function(_0x355864){logger[_0x7921('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5bf399,_0x455c74[0x1],_0x4267d4['channel'],_0x4267d4[_0x7921('0x14')]['id']);})[_0x7921('0x16')](function(_0xbaae5d){logger[_0x7921('0xb')](_0x7921('0xc'),_0x5bf399,JSON[_0x7921('0x17')](_0xbaae5d));logger[_0x7921('0xf')](_0x7921('0x18'),_0x5bf399);})['finally'](function(){_0x40b831[_0x7921('0x10')]();});}}}catch(_0x47f479){logger[_0x7921('0xb')]('[%s][TAG]\x20%s',_0x5bf399,_[_0x7921('0x19')](_0x47f479)?JSON[_0x7921('0x17')](_0x47f479):_0x47f479);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5bf399);_0x40b831['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 7f903e6..c457970 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa64c=['urlOnRing','?params=','title','2.0','login','push','params','stringify','utf8','then','parse','result','logged','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','urlOnAnswer'];(function(_0x1b280a,_0x275f39){var _0x781b72=function(_0x15e559){while(--_0x15e559){_0x1b280a['push'](_0x1b280a['shift']());}};_0x781b72(++_0x275f39);}(_0xa64c,0x106));var _0xca64=function(_0x555e2e,_0x4fb9ba){_0x555e2e=_0x555e2e-0x0;var _0x38679=_0xa64c[_0x555e2e];return _0x38679;};'use strict';var rp=require(_0xca64('0x0'));var logger=require(_0xca64('0x1'))(_0xca64('0x2'));var _=require(_0xca64('0x3'));var arr=[];exports[_0xca64('0x4')]=function(_0x5a2165,_0x4bda4e){return function(_0xb975b1){var _0x20eba8=_0x4bda4e[0xa];var _0x498558=_0x4bda4e[0xb];var _0x31aede=_0x4bda4e[0xc];var _0x1b69cc=_0x4bda4e[0xd];var _0x4d2747=_0x4bda4e[0xe];var _0x4f4652=_0x4bda4e[0xf][_0xca64('0x5')](/\n/g,'\x20-\x20');var _0x5af2a2=_0x4bda4e[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xca64('0x6')](_0x498558)){arr['push'](_0x498558);var _0x143218=_0x4bda4e[0x3];var _0x9a4a8b=_0x4bda4e[0x4];var _0x482498=_0x4bda4e[0x1];var _0x325bf4=_0x4bda4e[0x0];var _0x3480fd={};_0x3480fd[_0xca64('0x7')]=_0x4bda4e[0x8]+'?params='+_0x31aede+'|'+_0x20eba8+'|'+_0x1b69cc+'|'+_0x498558+'|'+_0x4d2747;_0x3480fd[_0xca64('0x8')]=_0x4bda4e[0x7]+_0xca64('0x9')+_0x31aede+'|'+_0x20eba8+'|'+_0x1b69cc+'|'+_0x498558+'|'+_0x4d2747+'|'+_0x4f4652+'|'+_0x5af2a2;_0x3480fd[_0xca64('0xa')]=_0x4bda4e[0x9];var _0x46941c={};_0x46941c['jsonrpc']=_0xca64('0xb');_0x46941c['method']=_0xca64('0xc');var _0x190f59=[];_0x190f59[_0xca64('0xd')](_0x4bda4e[0x2]);_0x190f59[_0xca64('0xd')](_0x4bda4e[0x5]);_0x190f59[_0xca64('0xd')](_0x4bda4e[0x6]);_0x46941c[_0xca64('0xe')]=_0x190f59;_0x46941c['id']=0x1;var _0x58aa6f=JSON[_0xca64('0xf')](_0x46941c);var _0x4ca1d9={'encoding':_0xca64('0x10'),'method':'POST','timeout':0x2710,'url':_0x143218,'headers':{'Content-Type':'application/json-rpc'},'body':_0x58aa6f};return rp(_0x4ca1d9)[_0xca64('0x11')](function(_0x3b521e){const _0x3a1ef5=JSON[_0xca64('0x12')](_0x3b521e);if(!_0x3a1ef5[_0xca64('0x13')][_0xca64('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x52562d=_0x498558;var _0x17a450='channelId='+_0x482498+'&serviceId='+_0x325bf4+_0xca64('0x15')+_0x52562d+_0xca64('0x16')+JSON['stringify'](_0x3480fd);var _0x46794a=_0x9a4a8b+'?'+_0x17a450;return rp(_0x46794a);})[_0xca64('0x11')](function(_0x322423){logger[_0xca64('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x5a2165,_0x322423);_0xb975b1[_0xca64('0x18')]();})[_0xca64('0x19')](function(_0xafc19d){logger[_0xca64('0x1a')](_0xca64('0x1b'),_0x5a2165,_['isObject'](_0xafc19d)?JSON[_0xca64('0xf')](_0xafc19d):_0xafc19d);_0xb975b1[_0xca64('0x18')]();});}else{logger[_0xca64('0x17')](_0xca64('0x1c'),_0x5a2165);_0xb975b1[_0xca64('0x1d')]();}};}; \ No newline at end of file +var _0x5782=['then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','replace','\x20-\x20','push','urlOnAnswer','?params=','jsonrpc','2.0','method','login','params','stringify','utf8','POST'];(function(_0x4f9c58,_0x2ddf0a){var _0x1ec233=function(_0x12f804){while(--_0x12f804){_0x4f9c58['push'](_0x4f9c58['shift']());}};_0x1ec233(++_0x2ddf0a);}(_0x5782,0x141));var _0x2578=function(_0x2b8700,_0x2652f4){_0x2b8700=_0x2b8700-0x0;var _0x3692ef=_0x5782[_0x2b8700];return _0x3692ef;};'use strict';var rp=require(_0x2578('0x0'));var logger=require('../../../../config/logger')(_0x2578('0x1'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x177de1,_0x2a6343){return function(_0x58fe65){var _0x5361da=_0x2a6343[0xa];var _0xf446bb=_0x2a6343[0xb];var _0x376eba=_0x2a6343[0xc];var _0x504605=_0x2a6343[0xd];var _0x136765=_0x2a6343[0xe];var _0x56a166=_0x2a6343[0xf][_0x2578('0x2')](/\n/g,_0x2578('0x3'));var _0x133203=_0x2a6343[0x10][_0x2578('0x2')](/\n/g,'\x20');if(!arr['includes'](_0xf446bb)){arr[_0x2578('0x4')](_0xf446bb);var _0x11a7be=_0x2a6343[0x3];var _0x2376cd=_0x2a6343[0x4];var _0x147c29=_0x2a6343[0x1];var _0x2dd6df=_0x2a6343[0x0];var _0x2259be={};_0x2259be[_0x2578('0x5')]=_0x2a6343[0x8]+_0x2578('0x6')+_0x376eba+'|'+_0x5361da+'|'+_0x504605+'|'+_0xf446bb+'|'+_0x136765;_0x2259be['urlOnRing']=_0x2a6343[0x7]+_0x2578('0x6')+_0x376eba+'|'+_0x5361da+'|'+_0x504605+'|'+_0xf446bb+'|'+_0x136765+'|'+_0x56a166+'|'+_0x133203;_0x2259be['title']=_0x2a6343[0x9];var _0x3bc9ed={};_0x3bc9ed[_0x2578('0x7')]=_0x2578('0x8');_0x3bc9ed[_0x2578('0x9')]=_0x2578('0xa');var _0x4d3db7=[];_0x4d3db7[_0x2578('0x4')](_0x2a6343[0x2]);_0x4d3db7[_0x2578('0x4')](_0x2a6343[0x5]);_0x4d3db7[_0x2578('0x4')](_0x2a6343[0x6]);_0x3bc9ed[_0x2578('0xb')]=_0x4d3db7;_0x3bc9ed['id']=0x1;var _0x5e1d22=JSON[_0x2578('0xc')](_0x3bc9ed);var _0x52b69c={'encoding':_0x2578('0xd'),'method':_0x2578('0xe'),'timeout':0x2710,'url':_0x11a7be,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5e1d22};return rp(_0x52b69c)[_0x2578('0xf')](function(_0x603fb6){const _0x18d346=JSON['parse'](_0x603fb6);if(!_0x18d346[_0x2578('0x10')]['logged']){throw new Error(_0x2578('0x11'));}var _0x2a9482=_0xf446bb;var _0x4e4b80=_0x2578('0x12')+_0x147c29+'&serviceId='+_0x2dd6df+_0x2578('0x13')+_0x2a9482+'&data='+JSON['stringify'](_0x2259be);var _0x9e0ec7=_0x2376cd+'?'+_0x4e4b80;return rp(_0x9e0ec7);})['then'](function(_0x329165){logger[_0x2578('0x14')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x177de1,_0x329165);_0x58fe65[_0x2578('0x15')]();})[_0x2578('0x16')](function(_0x1b984e){logger[_0x2578('0x17')](_0x2578('0x18'),_0x177de1,_[_0x2578('0x19')](_0x1b984e)?JSON[_0x2578('0xc')](_0x1b984e):_0x1b984e);_0x58fe65[_0x2578('0x15')]();});}else{logger[_0x2578('0x14')](_0x2578('0x1a'),_0x177de1);_0x58fe65[_0x2578('0x1b')]();}};}; \ 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 b7ac4c3..f6ad10a 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x387f7b,_0x4bade9){var _0x53c477=function(_0xa81e29){while(--_0xa81e29){_0x387f7b['push'](_0x387f7b['shift']());}};_0x53c477(++_0x4bade9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x27ef5b,_0x4916aa){var _0x3f594e=function(_0x2f9cbe){while(--_0x2f9cbe){_0x27ef5b['push'](_0x27ef5b['shift']());}};_0x3f594e(++_0x4916aa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e79ea27..ab6cc16 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 _0x753c=['error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','catch','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','waiting','mailQueues','available','openchannelQueues','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20'];(function(_0x313fec,_0xd07f4b){var _0x5a4d2e=function(_0x283594){while(--_0x283594){_0x313fec['push'](_0x313fec['shift']());}};_0x5a4d2e(++_0xd07f4b);}(_0x753c,0x96));var _0xc753=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x753c[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xc753('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0xc753('0x1'));var BPromise=require(_0xc753('0x2'));var utils=require(_0xc753('0x3'));var sUtils=require(_0xc753('0x4'));var logger=require(_0xc753('0x5'))(_0xc753('0x6'));var rpc={'openchannelQueueReport':require(_0xc753('0x7')),'mailQueueReport':require(_0xc753('0x8')),'chatQueueReport':require(_0xc753('0x9')),'smsQueueReport':require(_0xc753('0xa')),'faxQueueReport':require(_0xc753('0xb')),'whatsappQueueReport':require(_0xc753('0xc'))};var RuleEngine=require(_0xc753('0xd'));function getId(_0x44e544,_0xb80bea,_0x3866e8){return util[_0xc753('0xe')](_0xc753('0xf'),_0x44e544,_0xb80bea||0x0,_0x3866e8||0x0);}function getIntervals(_0x128610,_0x12c8bb){var _0x1fe61c=[];if(!_[_0xc753('0x10')](_0x12c8bb[_0xc753('0x11')])&&!_[_0xc753('0x10')](_0x128610[_0x12c8bb['IntervalId']])&&!_[_0xc753('0x10')](_0x128610[_0x12c8bb[_0xc753('0x11')]]['Intervals'])){_0x1fe61c=_[_0xc753('0x12')](_0x128610[_0x12c8bb['IntervalId']][_0xc753('0x13')],_0xc753('0x14'));}else if(!_[_0xc753('0x10')](_0x12c8bb['interval'])){_0x1fe61c=[_0x12c8bb[_0xc753('0x14')]];}return _0x1fe61c;}exports['listen']=function(_0x75d1d1){_0x75d1d1['rules']={};return new BPromise(function(_0x3cdf79,_0x175238){var _0x288a69={'Start':function(_0x15b777){var _0x4650ed=this;return new Promise(function(_0x4fae9f,_0x1d4558){if(_0x15b777){try{var _0x33c647=[];var _0x1f94f9=getId(_0x15b777[_0xc753('0x15')],_0x15b777[_0xc753('0x16')]?_0x15b777[_0xc753('0x16')]['id']:0x0,_0x15b777[_0xc753('0x17')]?_0x15b777[_0xc753('0x17')]['id']:0x0);var _0x5a3ea7=sUtils[_0xc753('0x18')](_0x75d1d1,_0x15b777);if(_0x15b777[_0xc753('0x19')]||!_0x5a3ea7&&_0x15b777[_0xc753('0x1a')]&&_[_0xc753('0x1b')](_0x15b777[_0xc753('0x1a')])&&_0x15b777[_0xc753('0x1a')][_0xc753('0x1c')]){for(var _0x42a222=0x0;_0x42a222<_0x15b777[_0xc753('0x1a')][_0xc753('0x1c')];_0x42a222+=0x1){var _0xdd43a0=_0x15b777[_0xc753('0x1a')][_0x42a222];if(fs[_0xc753('0x1d')](path[_0xc753('0x1e')](__dirname,_0xc753('0x1a'),_0xdd43a0[_0xc753('0x1f')]+'.js'))){var _0x2c04d4=[];switch(_0xdd43a0[_0xc753('0x1f')]['toLowerCase']()){case'autoreply':var _0x2b8ed4=_0xdd43a0[_0xc753('0x20')][_0xc753('0x21')](',');if(_0x15b777[_0xc753('0x15')]===_0xc753('0x22')){_0x2c04d4['push'](_0x2b8ed4[0x0]);_0x2c04d4[_0xc753('0x23')](_0x2b8ed4[0x1]);_0x2c04d4[_0xc753('0x23')](_0x2b8ed4[_0xc753('0x24')](0x2,_0x2b8ed4[_0xc753('0x1c')])[_0xc753('0x1e')](','));}else{_0x2c04d4['push'](_0x2b8ed4[0x0]);_0x2c04d4[_0xc753('0x23')](_0x2b8ed4['slice'](0x1,_0x2b8ed4[_0xc753('0x1c')])[_0xc753('0x1e')](','));}break;case _0xc753('0x25'):var _0x2f5c9f=_0xdd43a0['appdata'][_0xc753('0x21')](',');_0x2c04d4[_0xc753('0x23')](_0x2f5c9f[0x0]);_0x2c04d4['push'](_0x2f5c9f[0x1]);_0x2c04d4[_0xc753('0x23')](_0x2f5c9f['slice'](0x2,_0x2f5c9f[_0xc753('0x1c')])['join'](','));break;case'dialogflowv2':var _0x32c188=_0xdd43a0[_0xc753('0x20')]['split'](',');_0x2c04d4[_0xc753('0x23')](_0x32c188[0x0]);_0x2c04d4[_0xc753('0x23')](_0x32c188[0x1]);_0x2c04d4[_0xc753('0x23')](_0x32c188[0x2]);_0x2c04d4[_0xc753('0x23')](_0x32c188[0x3]);_0x2c04d4[_0xc753('0x23')](_0x32c188['slice'](0x4,_0x32c188[_0xc753('0x1c')])['join'](','));break;case _0xc753('0x26'):var _0x315a1e=_0xdd43a0[_0xc753('0x20')]['split'](',');_0x2c04d4[_0xc753('0x23')](_0x315a1e[0x0]);_0x2c04d4[_0xc753('0x23')](_0x315a1e[0x1]);_0x2c04d4[_0xc753('0x23')](_0x315a1e[0x2]);_0x2c04d4[_0xc753('0x23')](_0x315a1e[0x3]);_0x2c04d4[_0xc753('0x23')](_0x315a1e[_0xc753('0x24')](0x4,_0x315a1e[_0xc753('0x1c')])[_0xc753('0x1e')](','));break;case'message':_0x2c04d4[_0xc753('0x23')](_0xdd43a0[_0xc753('0x20')]);break;case _0xc753('0x27'):_0x2c04d4['push'](_0xdd43a0[_0xc753('0x28')]);_0x2c04d4['push'](_0xdd43a0[_0xc753('0x20')]);break;case _0xc753('0x29'):var _0x32397e=utils[_0xc753('0x2a')](_0x15b777[_0xc753('0x2b')][_0xc753('0x2c')],_0x15b777);var _0x3e656a=_0xdd43a0[_0xc753('0x20')][_0xc753('0x21')](',');_0x2c04d4['push'](_0x3e656a[0x0]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0x1]);_0x2c04d4['push'](_0x3e656a[0x2]);_0x2c04d4['push'](_0x3e656a[0x3]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0x4]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0x5]);_0x2c04d4['push'](_0x3e656a[0x6]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0x7]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0x8]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0x9]);_0x2c04d4[_0xc753('0x23')](_0x3e656a[0xa]);_0x2c04d4[_0xc753('0x23')](_0x15b777[_0xc753('0x17')]['id']);_0x2c04d4[_0xc753('0x23')](_0x15b777['message']['id']);_0x2c04d4['push'](_0xdd43a0[_0xc753('0x2d')]);_0x2c04d4[_0xc753('0x23')](_0x15b777[_0xc753('0x17')]['ContactId']);_0x2c04d4[_0xc753('0x23')](_0x15b777['body'][_0xc753('0x2e')]);_0x2c04d4[_0xc753('0x23')](_0x32397e);break;default:_0x2c04d4=_[_0xc753('0x10')](_0xdd43a0[_0xc753('0x20')])?[]:_0xdd43a0['appdata'][_0xc753('0x21')](',');}var _0x3cbbb1={'id':util[_0xc753('0xe')]('%s:%s:%s',_0x1f94f9,_0xdd43a0['id'],_0xdd43a0['app']),'condition':require(_0xc753('0x2f'))[_0xc753('0x30')](_0x1f94f9,getIntervals(_0x75d1d1[_0xc753('0x31')],_0xdd43a0),_0x75d1d1),'consequence':require(_0xc753('0x32')+_0xdd43a0['app'])[_0xc753('0x33')](_0x1f94f9,_0x2c04d4,_0x75d1d1,_0x15b777),'p':_0xdd43a0[_0xc753('0x34')]||0x0};logger['info'](_0xc753('0x35'),_0x3cbbb1['id'],_0xc753('0x36'),getIntervals(_0x75d1d1[_0xc753('0x31')],_0xdd43a0)[_0xc753('0x1e')](_0xc753('0x37')));_0x33c647['push'](_0x3cbbb1);}else{logger[_0xc753('0x38')](_0xc753('0x39'),path[_0xc753('0x1e')](__dirname,_0xc753('0x1a'),_0xdd43a0[_0xc753('0x1f')]+_0xc753('0x3a')));}}_0x75d1d1['rules'][_0x1f94f9]=new RuleEngine(_0x33c647);_0x75d1d1[_0xc753('0x3b')][_0x1f94f9][_0xc753('0x3c')](_0x15b777,function(_0x26fcd1){logger[_0xc753('0x3d')](_0xc753('0x3e'),JSON[_0xc753('0x3f')](_0x26fcd1[_0xc753('0x40')]));if(_0x75d1d1[_0xc753('0x3b')][_0x1f94f9]){_0x75d1d1['rules'][_0x1f94f9][_0xc753('0x41')](_0xc753('0x42'));}});return _0x4fae9f({'code':0xc8,'message':_0x15b777});}else{if(_0x5a3ea7){logger[_0xc753('0x3d')](util[_0xc753('0xe')]('Skipped\x20routing\x20for\x20%s',_0x1f94f9));}else{logger[_0xc753('0x3d')](_0xc753('0x43'));}return _0x4fae9f({'code':0xc8,'message':_0x15b777});}}catch(_0x246706){logger[_0xc753('0x38')](_0x246706['stack']);return _0x1d4558(_0x4650ed[_0xc753('0x38')](0x1f4,_0x246706));}}return _0x1d4558('routing\x20is\x20empty');});},'AcceptMessage':function(_0x268145){var _0x49396a=this;return new Promise(function(_0x4b3d25,_0x5e8d56){if(_0x268145[_0xc753('0x44')]&&_0x268145[_0xc753('0x44')]['id']){if(_0x75d1d1[_0xc753('0x45')][_0x268145[_0xc753('0x44')]['id']]){_0x75d1d1[_0xc753('0x45')][_0x268145[_0xc753('0x44')]['id']][_0xc753('0x46')]=![];_0x75d1d1[_0xc753('0x45')][_0x268145['agent']['id']][_0xc753('0x47')]=undefined;}}if(_0x268145[_0xc753('0x16')]&&_0x268145[_0xc753('0x16')]['id']){try{var _0x1458c7=getId(_0x268145[_0xc753('0x15')],_0x268145[_0xc753('0x16')]?_0x268145['message']['id']:0x0,_0x268145['interaction']?_0x268145[_0xc753('0x17')]['id']:0x0);if(_0x75d1d1[_0xc753('0x3b')][_0x1458c7]){_0x75d1d1[_0xc753('0x3b')][_0x1458c7]['emit'](_0xc753('0x48'));if(rpc[_0x268145[_0xc753('0x15')]+_0xc753('0x49')]){rpc[_0x268145[_0xc753('0x15')]+'QueueReport'][_0xc753('0x4a')](_0x1458c7,{'UserId':_0x268145[_0xc753('0x16')]['UserId']})[_0xc753('0x4b')](function(){logger[_0xc753('0x38')]('error\x20update\x20queue\x20report');});}}return _0x4b3d25({'code':0xc8,'message':_0x268145});}catch(_0x34cfc8){logger['error'](_0x34cfc8[_0xc753('0x4c')]);return _0x5e8d56(_0x49396a[_0xc753('0x38')](0x1f4,_0x34cfc8));}}logger[_0xc753('0x38')]('message\x20is\x20empty');return _0x5e8d56(_0x49396a[_0xc753('0x38')](0x1f4,_0xc753('0x4d')));});},'RejectMessage':function(_0x1eebf0){var _0x21ef70=this;return new Promise(function(_0x5b7c59,_0x42e0e7){if(_0x1eebf0[_0xc753('0x44')]&&_0x1eebf0[_0xc753('0x44')]['id']){try{if(_0x75d1d1[_0xc753('0x45')][_0x1eebf0[_0xc753('0x44')]['id']]){_0x75d1d1[_0xc753('0x45')][_0x1eebf0[_0xc753('0x44')]['id']][_0xc753('0x46')]=![];_0x75d1d1[_0xc753('0x45')][_0x1eebf0['agent']['id']][_0xc753('0x47')]=undefined;}return _0x5b7c59({'code':0xc8,'message':_0x1eebf0});}catch(_0x4f2035){logger[_0xc753('0x38')](_0x4f2035['stack']);return _0x42e0e7(_0x21ef70[_0xc753('0x38')](0x1f4,_0x4f2035));}}logger['error'](_0xc753('0x4d'));return _0x42e0e7(_0x21ef70['error'](0x1f4,_0xc753('0x4d')));});},'AbandonInteraction':function(_0x24e420){var _0x44f614=this;return new Promise(function(_0x2cf637,_0x9827f2){if(_0x24e420[_0xc753('0x15')]&&_0x24e420[_0xc753('0x17')]&&_0x24e420[_0xc753('0x17')]['id']){try{var _0x485279=getId(_0x24e420['channel'],_0x24e420[_0xc753('0x16')]?_0x24e420[_0xc753('0x16')]['id']:0x0,_0x24e420[_0xc753('0x17')]?_0x24e420[_0xc753('0x17')]['id']:0x0);if(_0x75d1d1[_0xc753('0x3b')][_0x485279]){_0x75d1d1['rules'][_0x485279][_0xc753('0x41')](_0xc753('0x48'));}return _0x2cf637({'code':0xc8,'message':_0x24e420});}catch(_0x34b5e1){logger['error'](_0x34b5e1[_0xc753('0x4c')]);return _0x9827f2(_0x44f614[_0xc753('0x38')](0x1f4,_0x34b5e1));}}logger[_0xc753('0x38')]('message\x20is\x20empty');return _0x9827f2(_0x44f614[_0xc753('0x38')](0x1f4,_0xc753('0x4d')));});},'AgentCapacity':function(_0x3c936f){var _0x15d8e9=this;return new Promise(function(_0x43975a,_0x5cb969){if(_0x75d1d1['agents'][_0xc753('0x4e')](_0x3c936f['id'])){for(var _0x14592d in _0x3c936f['capacity']){if(_0x3c936f[_0xc753('0x4f')]['hasOwnProperty'](_0x14592d)){if(_0x75d1d1[_0xc753('0x45')][_0x3c936f['id']][_0xc753('0x4e')](_0x14592d+_0xc753('0x50'))){_0x75d1d1['agents'][_0x3c936f['id']][_0x14592d+'CurrentCapacity']=parseInt(_0x3c936f[_0xc753('0x4f')][_0x14592d],0xa);}}}_0x75d1d1[_0xc753('0x45')][_0x3c936f['id']][_0xc753('0x51')]();return _0x43975a({'code':0xc8,'message':_0x75d1d1['agents'][_0x3c936f['id']]});}else{return _0x5cb969(_0x15d8e9[_0xc753('0x38')](0x1f4,_0xc753('0x52')));}});},'Agents':function(_0x3dda8f){return new Promise(function(_0x19b205){var _0x98d129=_[_0xc753('0x53')](_0x75d1d1[_0xc753('0x45')]);if(_0x3dda8f&&_0x3dda8f['id']){var _0x4f2a3c=_[_0xc753('0x54')](_0x98d129,function(_0x376423){return _0x376423['id']===_0x3dda8f['id'];});_0x19b205(_0x4f2a3c);}else{_0x19b205({'count':_0x98d129[_0xc753('0x1c')],'rows':_0x98d129});}});},'ChatQueues':function(){return new Promise(function(_0x1e8cbb){var _0x49e17b=[];for(var _0x21a842 in _0x75d1d1['chatQueues']){if(_0x75d1d1['chatQueues'][_0xc753('0x4e')](_0x21a842)){var _0x45aa84=_0x75d1d1[_0xc753('0x55')][_0x21a842];var _0x150c31={'id':_0x45aa84['id'],'available':_0x45aa84['available'],'loggedIn':_0x45aa84[_0xc753('0x56')],'name':_0x45aa84[_0xc753('0x57')],'paused':_0x45aa84['paused'],'waiting':_0x45aa84[_0xc753('0x58')]};_0x49e17b[_0xc753('0x23')](_0x150c31);}}_0x1e8cbb({'count':_0x49e17b[_0xc753('0x1c')],'rows':_0x49e17b});});},'MailQueues':function(){return new Promise(function(_0x6d3df5){var _0x121bbb=[];for(var _0x137447 in _0x75d1d1['mailQueues']){if(_0x75d1d1[_0xc753('0x59')][_0xc753('0x4e')](_0x137447)){var _0x2b4cc6=_0x75d1d1[_0xc753('0x59')][_0x137447];var _0x155c5e={'id':_0x2b4cc6['id'],'available':_0x2b4cc6[_0xc753('0x5a')],'loggedIn':_0x2b4cc6[_0xc753('0x56')],'name':_0x2b4cc6[_0xc753('0x57')],'paused':_0x2b4cc6['paused'],'waiting':_0x2b4cc6['waiting']};_0x121bbb[_0xc753('0x23')](_0x155c5e);}}_0x6d3df5({'count':_0x121bbb['length'],'rows':_0x121bbb});});},'OpenchannelQueues':function(){return new Promise(function(_0x45d3f4){var _0x4f8cd4=[];for(var _0x597ace in _0x75d1d1[_0xc753('0x5b')]){if(_0x75d1d1[_0xc753('0x5b')]['hasOwnProperty'](_0x597ace)){var _0x3860f4=_0x75d1d1['openchannelQueues'][_0x597ace];var _0x3f87e2={'id':_0x3860f4['id'],'available':_0x3860f4[_0xc753('0x5a')],'loggedIn':_0x3860f4['loggedIn'],'name':_0x3860f4[_0xc753('0x57')],'paused':_0x3860f4[_0xc753('0x5c')],'waiting':_0x3860f4[_0xc753('0x58')]};_0x4f8cd4[_0xc753('0x23')](_0x3f87e2);}}_0x45d3f4({'count':_0x4f8cd4[_0xc753('0x1c')],'rows':_0x4f8cd4});});},'SmsQueues':function(){return new Promise(function(_0x342c00){var _0x2c48fb=[];for(var _0x1b5f99 in _0x75d1d1[_0xc753('0x5d')]){if(_0x75d1d1['smsQueues']['hasOwnProperty'](_0x1b5f99)){var _0x374500=_0x75d1d1['smsQueues'][_0x1b5f99];var _0x2dcad3={'id':_0x374500['id'],'available':_0x374500['available'],'loggedIn':_0x374500['loggedIn'],'name':_0x374500['name'],'paused':_0x374500['paused'],'waiting':_0x374500[_0xc753('0x58')]};_0x2c48fb['push'](_0x2dcad3);}}_0x342c00({'count':_0x2c48fb['length'],'rows':_0x2c48fb});});},'FaxQueues':function(){return new Promise(function(_0x47e27a){var _0x5d116b=[];for(var _0x47dce1 in _0x75d1d1[_0xc753('0x5e')]){if(_0x75d1d1[_0xc753('0x5e')][_0xc753('0x4e')](_0x47dce1)){var _0x44578c=_0x75d1d1['faxQueues'][_0x47dce1];var _0x10967e={'id':_0x44578c['id'],'available':_0x44578c['available'],'loggedIn':_0x44578c[_0xc753('0x56')],'name':_0x44578c['name'],'paused':_0x44578c[_0xc753('0x5c')],'waiting':_0x44578c[_0xc753('0x58')]};_0x5d116b['push'](_0x10967e);}}_0x47e27a({'count':_0x5d116b['length'],'rows':_0x5d116b});});},'WhatsappQueues':function(){return new Promise(function(_0x3081dc){var _0x42c385=[];for(var _0x3cbea1 in _0x75d1d1[_0xc753('0x5f')]){if(_0x75d1d1[_0xc753('0x5f')][_0xc753('0x4e')](_0x3cbea1)){var _0x28be1f=_0x75d1d1['whatsappQueues'][_0x3cbea1];var _0x527306={'id':_0x28be1f['id'],'available':_0x28be1f[_0xc753('0x5a')],'loggedIn':_0x28be1f[_0xc753('0x56')],'name':_0x28be1f['name'],'paused':_0x28be1f[_0xc753('0x5c')],'waiting':_0x28be1f[_0xc753('0x58')]};_0x42c385[_0xc753('0x23')](_0x527306);}}_0x3081dc({'count':_0x42c385[_0xc753('0x1c')],'rows':_0x42c385});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x518b12){var _0x31dd46=_[_0xc753('0x53')](_0x75d1d1[_0xc753('0x60')]);_0x518b12({'count':_0x31dd46[_0xc753('0x1c')],'rows':_0x31dd46});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1f8edd){var _0x311a73=_[_0xc753('0x53')](_0x75d1d1[_0xc753('0x61')]);_0x1f8edd({'count':_0x311a73[_0xc753('0x1c')],'rows':_0x311a73});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x9defc3){var _0xdec170=_[_0xc753('0x53')](_0x75d1d1['openchannelQueuesWaitingInteractions']);_0x9defc3({'count':_0xdec170['length'],'rows':_0xdec170});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4bc21a){var _0xec934c=_[_0xc753('0x53')](_0x75d1d1[_0xc753('0x62')]);_0x4bc21a({'count':_0xec934c['length'],'rows':_0xec934c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1eec93){var _0xa384fe=_[_0xc753('0x53')](_0x75d1d1[_0xc753('0x63')]);_0x1eec93({'count':_0xa384fe[_0xc753('0x1c')],'rows':_0xa384fe});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x210459){var _0x1fdb34=_['values'](_0x75d1d1[_0xc753('0x64')]);_0x210459({'count':_0x1fdb34[_0xc753('0x1c')],'rows':_0x1fdb34});});}};var _0x21b086=jayson['server'](_0x288a69)[_0xc753('0x65')]();_0x21b086['on'](_0xc753('0x38'),function(_0x7091c0){logger[_0xc753('0x38')](JSON[_0xc753('0x3f')](_0x7091c0));return _0x175238(_0x7091c0);});_0x21b086['listen'](0x232c,_0xc753('0x66'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3cdf79('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x99e7=['complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','emit'];(function(_0x1c8222,_0x13db80){var _0x4f0256=function(_0x384d1b){while(--_0x384d1b){_0x1c8222['push'](_0x1c8222['shift']());}};_0x4f0256(++_0x13db80);}(_0x99e7,0x1b5));var _0x799e=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x99e7[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x799e('0x0'));var util=require(_0x799e('0x1'));var path=require(_0x799e('0x2'));var fs=require('fs');var jayson=require(_0x799e('0x3'));var BPromise=require(_0x799e('0x4'));var utils=require(_0x799e('0x5'));var sUtils=require(_0x799e('0x6'));var logger=require(_0x799e('0x7'))(_0x799e('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x799e('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x799e('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x799e('0xb'));function getId(_0x373341,_0x3cec49,_0x1edc75){return util[_0x799e('0xc')]('%s.%s.%s',_0x373341,_0x3cec49||0x0,_0x1edc75||0x0);}function getIntervals(_0x21df07,_0x3477f3){var _0x38cd71=[];if(!_[_0x799e('0xd')](_0x3477f3['IntervalId'])&&!_[_0x799e('0xd')](_0x21df07[_0x3477f3[_0x799e('0xe')]])&&!_[_0x799e('0xd')](_0x21df07[_0x3477f3[_0x799e('0xe')]][_0x799e('0xf')])){_0x38cd71=_[_0x799e('0x10')](_0x21df07[_0x3477f3[_0x799e('0xe')]]['Intervals'],_0x799e('0x11'));}else if(!_[_0x799e('0xd')](_0x3477f3[_0x799e('0x11')])){_0x38cd71=[_0x3477f3[_0x799e('0x11')]];}return _0x38cd71;}exports[_0x799e('0x12')]=function(_0x1ce347){_0x1ce347[_0x799e('0x13')]={};return new BPromise(function(_0x2765e1,_0xd4f4a8){var _0x1d1fbc={'Start':function(_0x5a2b6a){var _0x5299a8=this;return new Promise(function(_0x4267bc,_0x41e5a5){if(_0x5a2b6a){try{var _0x202629=[];var _0x550fae=getId(_0x5a2b6a[_0x799e('0x14')],_0x5a2b6a[_0x799e('0x15')]?_0x5a2b6a[_0x799e('0x15')]['id']:0x0,_0x5a2b6a[_0x799e('0x16')]?_0x5a2b6a[_0x799e('0x16')]['id']:0x0);var _0x5331b5=sUtils[_0x799e('0x17')](_0x1ce347,_0x5a2b6a);if(_0x5a2b6a[_0x799e('0x18')]||!_0x5331b5&&_0x5a2b6a[_0x799e('0x19')]&&_[_0x799e('0x1a')](_0x5a2b6a['applications'])&&_0x5a2b6a[_0x799e('0x19')]['length']){for(var _0x1b1478=0x0;_0x1b1478<_0x5a2b6a[_0x799e('0x19')][_0x799e('0x1b')];_0x1b1478+=0x1){var _0x2236aa=_0x5a2b6a[_0x799e('0x19')][_0x1b1478];if(fs[_0x799e('0x1c')](path[_0x799e('0x1d')](__dirname,_0x799e('0x19'),_0x2236aa[_0x799e('0x1e')]+_0x799e('0x1f')))){var _0x46375b=[];switch(_0x2236aa[_0x799e('0x1e')][_0x799e('0x20')]()){case'autoreply':var _0x2c9820=_0x2236aa[_0x799e('0x21')][_0x799e('0x22')](',');if(_0x5a2b6a['channel']==='mail'){_0x46375b[_0x799e('0x23')](_0x2c9820[0x0]);_0x46375b[_0x799e('0x23')](_0x2c9820[0x1]);_0x46375b[_0x799e('0x23')](_0x2c9820[_0x799e('0x24')](0x2,_0x2c9820[_0x799e('0x1b')])[_0x799e('0x1d')](','));}else{_0x46375b[_0x799e('0x23')](_0x2c9820[0x0]);_0x46375b[_0x799e('0x23')](_0x2c9820[_0x799e('0x24')](0x1,_0x2c9820[_0x799e('0x1b')])[_0x799e('0x1d')](','));}break;case _0x799e('0x25'):var _0x5eb10e=_0x2236aa[_0x799e('0x21')]['split'](',');_0x46375b[_0x799e('0x23')](_0x5eb10e[0x0]);_0x46375b[_0x799e('0x23')](_0x5eb10e[0x1]);_0x46375b[_0x799e('0x23')](_0x5eb10e['slice'](0x2,_0x5eb10e[_0x799e('0x1b')])[_0x799e('0x1d')](','));break;case _0x799e('0x26'):var _0x41e894=_0x2236aa[_0x799e('0x21')][_0x799e('0x22')](',');_0x46375b[_0x799e('0x23')](_0x41e894[0x0]);_0x46375b[_0x799e('0x23')](_0x41e894[0x1]);_0x46375b[_0x799e('0x23')](_0x41e894[0x2]);_0x46375b[_0x799e('0x23')](_0x41e894[0x3]);_0x46375b[_0x799e('0x23')](_0x41e894[_0x799e('0x24')](0x4,_0x41e894[_0x799e('0x1b')])[_0x799e('0x1d')](','));break;case _0x799e('0x27'):var _0x40acd3=_0x2236aa['appdata'][_0x799e('0x22')](',');_0x46375b[_0x799e('0x23')](_0x40acd3[0x0]);_0x46375b[_0x799e('0x23')](_0x40acd3[0x1]);_0x46375b[_0x799e('0x23')](_0x40acd3[0x2]);_0x46375b[_0x799e('0x23')](_0x40acd3[0x3]);_0x46375b[_0x799e('0x23')](_0x40acd3[_0x799e('0x24')](0x4,_0x40acd3[_0x799e('0x1b')])[_0x799e('0x1d')](','));break;case _0x799e('0x15'):_0x46375b['push'](_0x2236aa[_0x799e('0x21')]);break;case'tag':_0x46375b[_0x799e('0x23')](_0x2236aa[_0x799e('0x28')]);_0x46375b[_0x799e('0x23')](_0x2236aa['appdata']);break;case _0x799e('0x29'):var _0x4b2f64=utils[_0x799e('0x2a')](_0x5a2b6a['account'][_0x799e('0x2b')],_0x5a2b6a);var _0x5279d2=_0x2236aa[_0x799e('0x21')][_0x799e('0x22')](',');_0x46375b[_0x799e('0x23')](_0x5279d2[0x0]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x1]);_0x46375b['push'](_0x5279d2[0x2]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x3]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x4]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x5]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x6]);_0x46375b['push'](_0x5279d2[0x7]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x8]);_0x46375b['push'](_0x5279d2[0x9]);_0x46375b['push'](_0x5279d2[0xa]);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x16')]['id']);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x15')]['id']);_0x46375b[_0x799e('0x23')](_0x2236aa[_0x799e('0x2c')]);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x16')]['ContactId']);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x2d')][_0x799e('0x2d')]);_0x46375b[_0x799e('0x23')](_0x4b2f64);break;default:_0x46375b=_['isNil'](_0x2236aa[_0x799e('0x21')])?[]:_0x2236aa['appdata']['split'](',');}var _0x2056f3={'id':util['format']('%s:%s:%s',_0x550fae,_0x2236aa['id'],_0x2236aa[_0x799e('0x1e')]),'condition':require('./interval')[_0x799e('0x2e')](_0x550fae,getIntervals(_0x1ce347[_0x799e('0x2f')],_0x2236aa),_0x1ce347),'consequence':require(_0x799e('0x30')+_0x2236aa['app'])['consequence'](_0x550fae,_0x46375b,_0x1ce347,_0x5a2b6a),'p':_0x2236aa['priority']||0x0};logger[_0x799e('0x31')](_0x799e('0x32'),_0x2056f3['id'],_0x799e('0x33'),getIntervals(_0x1ce347[_0x799e('0x2f')],_0x2236aa)[_0x799e('0x1d')](_0x799e('0x34')));_0x202629[_0x799e('0x23')](_0x2056f3);}else{logger[_0x799e('0x35')](_0x799e('0x36'),path[_0x799e('0x1d')](__dirname,_0x799e('0x19'),_0x2236aa[_0x799e('0x1e')]+'.js'));}}_0x1ce347['rules'][_0x550fae]=new RuleEngine(_0x202629);_0x1ce347['rules'][_0x550fae][_0x799e('0x37')](_0x5a2b6a,function(_0x5ad338){logger[_0x799e('0x31')]('Applications\x20executed',JSON['stringify'](_0x5ad338[_0x799e('0x38')]));if(_0x1ce347[_0x799e('0x13')][_0x550fae]){_0x1ce347[_0x799e('0x13')][_0x550fae][_0x799e('0x39')](_0x799e('0x3a'));}});return _0x4267bc({'code':0xc8,'message':_0x5a2b6a});}else{if(_0x5331b5){logger[_0x799e('0x31')](util[_0x799e('0xc')](_0x799e('0x3b'),_0x550fae));}else{logger['info'](_0x799e('0x3c'));}return _0x4267bc({'code':0xc8,'message':_0x5a2b6a});}}catch(_0x1739c0){logger[_0x799e('0x35')](_0x1739c0[_0x799e('0x3d')]);return _0x41e5a5(_0x5299a8[_0x799e('0x35')](0x1f4,_0x1739c0));}}return _0x41e5a5(_0x799e('0x3e'));});},'AcceptMessage':function(_0xf18956){var _0x4f953b=this;return new Promise(function(_0x1035c3,_0x565dcb){if(_0xf18956[_0x799e('0x3f')]&&_0xf18956[_0x799e('0x3f')]['id']){if(_0x1ce347[_0x799e('0x40')][_0xf18956[_0x799e('0x3f')]['id']]){_0x1ce347[_0x799e('0x40')][_0xf18956[_0x799e('0x3f')]['id']]['busy']=![];_0x1ce347[_0x799e('0x40')][_0xf18956[_0x799e('0x3f')]['id']][_0x799e('0x41')]=undefined;}}if(_0xf18956['message']&&_0xf18956['message']['id']){try{var _0x4345a7=getId(_0xf18956[_0x799e('0x14')],_0xf18956['message']?_0xf18956[_0x799e('0x15')]['id']:0x0,_0xf18956[_0x799e('0x16')]?_0xf18956[_0x799e('0x16')]['id']:0x0);if(_0x1ce347['rules'][_0x4345a7]){_0x1ce347['rules'][_0x4345a7]['emit'](_0x799e('0x42'));if(rpc[_0xf18956[_0x799e('0x14')]+_0x799e('0x43')]){rpc[_0xf18956['channel']+'QueueReport'][_0x799e('0x44')](_0x4345a7,{'UserId':_0xf18956['message'][_0x799e('0x45')]})[_0x799e('0x46')](function(){logger[_0x799e('0x35')](_0x799e('0x47'));});}}return _0x1035c3({'code':0xc8,'message':_0xf18956});}catch(_0x4a3a44){logger[_0x799e('0x35')](_0x4a3a44['stack']);return _0x565dcb(_0x4f953b['error'](0x1f4,_0x4a3a44));}}logger[_0x799e('0x35')]('message\x20is\x20empty');return _0x565dcb(_0x4f953b[_0x799e('0x35')](0x1f4,_0x799e('0x48')));});},'RejectMessage':function(_0x488fd9){var _0x49288e=this;return new Promise(function(_0x41496d,_0x1c2c5f){if(_0x488fd9[_0x799e('0x3f')]&&_0x488fd9[_0x799e('0x3f')]['id']){try{if(_0x1ce347[_0x799e('0x40')][_0x488fd9[_0x799e('0x3f')]['id']]){_0x1ce347['agents'][_0x488fd9[_0x799e('0x3f')]['id']][_0x799e('0x49')]=![];_0x1ce347['agents'][_0x488fd9[_0x799e('0x3f')]['id']]['busyQueue']=undefined;}return _0x41496d({'code':0xc8,'message':_0x488fd9});}catch(_0x3b2f34){logger[_0x799e('0x35')](_0x3b2f34['stack']);return _0x1c2c5f(_0x49288e[_0x799e('0x35')](0x1f4,_0x3b2f34));}}logger[_0x799e('0x35')](_0x799e('0x48'));return _0x1c2c5f(_0x49288e[_0x799e('0x35')](0x1f4,_0x799e('0x48')));});},'AbandonInteraction':function(_0x1f748f){var _0xc9d99b=this;return new Promise(function(_0x88fba,_0x1aaff3){if(_0x1f748f[_0x799e('0x14')]&&_0x1f748f[_0x799e('0x16')]&&_0x1f748f[_0x799e('0x16')]['id']){try{var _0x2857f6=getId(_0x1f748f[_0x799e('0x14')],_0x1f748f['message']?_0x1f748f['message']['id']:0x0,_0x1f748f[_0x799e('0x16')]?_0x1f748f[_0x799e('0x16')]['id']:0x0);if(_0x1ce347[_0x799e('0x13')][_0x2857f6]){_0x1ce347[_0x799e('0x13')][_0x2857f6]['emit'](_0x799e('0x42'));}return _0x88fba({'code':0xc8,'message':_0x1f748f});}catch(_0x33285e){logger['error'](_0x33285e[_0x799e('0x3d')]);return _0x1aaff3(_0xc9d99b['error'](0x1f4,_0x33285e));}}logger[_0x799e('0x35')](_0x799e('0x48'));return _0x1aaff3(_0xc9d99b[_0x799e('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x19e30e){var _0x3c8bb4=this;return new Promise(function(_0x2344f8,_0xe5db){if(_0x1ce347[_0x799e('0x40')][_0x799e('0x4a')](_0x19e30e['id'])){for(var _0x90f3dd in _0x19e30e['capacity']){if(_0x19e30e[_0x799e('0x4b')]['hasOwnProperty'](_0x90f3dd)){if(_0x1ce347['agents'][_0x19e30e['id']][_0x799e('0x4a')](_0x90f3dd+_0x799e('0x4c'))){_0x1ce347[_0x799e('0x40')][_0x19e30e['id']][_0x90f3dd+_0x799e('0x4c')]=parseInt(_0x19e30e['capacity'][_0x90f3dd],0xa);}}}_0x1ce347[_0x799e('0x40')][_0x19e30e['id']][_0x799e('0x4d')]();return _0x2344f8({'code':0xc8,'message':_0x1ce347['agents'][_0x19e30e['id']]});}else{return _0xe5db(_0x3c8bb4[_0x799e('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x31a777){return new Promise(function(_0x1540ac){var _0x323786=_['values'](_0x1ce347['agents']);if(_0x31a777&&_0x31a777['id']){var _0x2a82d9=_['find'](_0x323786,function(_0x2cc1fc){return _0x2cc1fc['id']===_0x31a777['id'];});_0x1540ac(_0x2a82d9);}else{_0x1540ac({'count':_0x323786[_0x799e('0x1b')],'rows':_0x323786});}});},'ChatQueues':function(){return new Promise(function(_0x47b974){var _0x55d351=[];for(var _0x46c8f4 in _0x1ce347[_0x799e('0x4e')]){if(_0x1ce347[_0x799e('0x4e')][_0x799e('0x4a')](_0x46c8f4)){var _0xb7e6fe=_0x1ce347['chatQueues'][_0x46c8f4];var _0x19f141={'id':_0xb7e6fe['id'],'available':_0xb7e6fe[_0x799e('0x4f')],'loggedIn':_0xb7e6fe[_0x799e('0x50')],'name':_0xb7e6fe[_0x799e('0x51')],'paused':_0xb7e6fe[_0x799e('0x52')],'waiting':_0xb7e6fe[_0x799e('0x53')]};_0x55d351[_0x799e('0x23')](_0x19f141);}}_0x47b974({'count':_0x55d351[_0x799e('0x1b')],'rows':_0x55d351});});},'MailQueues':function(){return new Promise(function(_0xe08a70){var _0x2f85c9=[];for(var _0x302369 in _0x1ce347[_0x799e('0x54')]){if(_0x1ce347[_0x799e('0x54')]['hasOwnProperty'](_0x302369)){var _0xd7b377=_0x1ce347['mailQueues'][_0x302369];var _0xbbb93d={'id':_0xd7b377['id'],'available':_0xd7b377[_0x799e('0x4f')],'loggedIn':_0xd7b377[_0x799e('0x50')],'name':_0xd7b377['name'],'paused':_0xd7b377[_0x799e('0x52')],'waiting':_0xd7b377[_0x799e('0x53')]};_0x2f85c9[_0x799e('0x23')](_0xbbb93d);}}_0xe08a70({'count':_0x2f85c9['length'],'rows':_0x2f85c9});});},'OpenchannelQueues':function(){return new Promise(function(_0x2005b8){var _0x4d8685=[];for(var _0x41ee85 in _0x1ce347[_0x799e('0x55')]){if(_0x1ce347[_0x799e('0x55')]['hasOwnProperty'](_0x41ee85)){var _0x3954c4=_0x1ce347[_0x799e('0x55')][_0x41ee85];var _0x418841={'id':_0x3954c4['id'],'available':_0x3954c4[_0x799e('0x4f')],'loggedIn':_0x3954c4[_0x799e('0x50')],'name':_0x3954c4['name'],'paused':_0x3954c4['paused'],'waiting':_0x3954c4[_0x799e('0x53')]};_0x4d8685['push'](_0x418841);}}_0x2005b8({'count':_0x4d8685[_0x799e('0x1b')],'rows':_0x4d8685});});},'SmsQueues':function(){return new Promise(function(_0x71a5b6){var _0x50f0d0=[];for(var _0x2ee09e in _0x1ce347[_0x799e('0x56')]){if(_0x1ce347[_0x799e('0x56')][_0x799e('0x4a')](_0x2ee09e)){var _0x424443=_0x1ce347[_0x799e('0x56')][_0x2ee09e];var _0x3adfa9={'id':_0x424443['id'],'available':_0x424443[_0x799e('0x4f')],'loggedIn':_0x424443['loggedIn'],'name':_0x424443[_0x799e('0x51')],'paused':_0x424443['paused'],'waiting':_0x424443[_0x799e('0x53')]};_0x50f0d0[_0x799e('0x23')](_0x3adfa9);}}_0x71a5b6({'count':_0x50f0d0[_0x799e('0x1b')],'rows':_0x50f0d0});});},'FaxQueues':function(){return new Promise(function(_0x4fb312){var _0x388824=[];for(var _0x4a1002 in _0x1ce347[_0x799e('0x57')]){if(_0x1ce347[_0x799e('0x57')][_0x799e('0x4a')](_0x4a1002)){var _0x2287ca=_0x1ce347[_0x799e('0x57')][_0x4a1002];var _0x9483be={'id':_0x2287ca['id'],'available':_0x2287ca['available'],'loggedIn':_0x2287ca[_0x799e('0x50')],'name':_0x2287ca[_0x799e('0x51')],'paused':_0x2287ca[_0x799e('0x52')],'waiting':_0x2287ca[_0x799e('0x53')]};_0x388824[_0x799e('0x23')](_0x9483be);}}_0x4fb312({'count':_0x388824[_0x799e('0x1b')],'rows':_0x388824});});},'WhatsappQueues':function(){return new Promise(function(_0x233c74){var _0x5447d5=[];for(var _0x55b841 in _0x1ce347[_0x799e('0x58')]){if(_0x1ce347[_0x799e('0x58')][_0x799e('0x4a')](_0x55b841)){var _0x5d656c=_0x1ce347[_0x799e('0x58')][_0x55b841];var _0x1d1271={'id':_0x5d656c['id'],'available':_0x5d656c[_0x799e('0x4f')],'loggedIn':_0x5d656c[_0x799e('0x50')],'name':_0x5d656c[_0x799e('0x51')],'paused':_0x5d656c['paused'],'waiting':_0x5d656c[_0x799e('0x53')]};_0x5447d5[_0x799e('0x23')](_0x1d1271);}}_0x233c74({'count':_0x5447d5[_0x799e('0x1b')],'rows':_0x5447d5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x318225){var _0x38ffa1=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5a')]);_0x318225({'count':_0x38ffa1[_0x799e('0x1b')],'rows':_0x38ffa1});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x18b85b){var _0xaab319=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5b')]);_0x18b85b({'count':_0xaab319[_0x799e('0x1b')],'rows':_0xaab319});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x385bee){var _0x2ad4da=_[_0x799e('0x59')](_0x1ce347['openchannelQueuesWaitingInteractions']);_0x385bee({'count':_0x2ad4da[_0x799e('0x1b')],'rows':_0x2ad4da});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2e575c){var _0x14cf71=_['values'](_0x1ce347[_0x799e('0x5c')]);_0x2e575c({'count':_0x14cf71[_0x799e('0x1b')],'rows':_0x14cf71});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4ae4f2){var _0x23149f=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5d')]);_0x4ae4f2({'count':_0x23149f[_0x799e('0x1b')],'rows':_0x23149f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x54ead3){var _0x5c01f7=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5e')]);_0x54ead3({'count':_0x5c01f7[_0x799e('0x1b')],'rows':_0x5c01f7});});}};var _0x2df949=jayson['server'](_0x1d1fbc)[_0x799e('0x5f')]();_0x2df949['on'](_0x799e('0x35'),function(_0x2ac055){logger['error'](JSON[_0x799e('0x60')](_0x2ac055));return _0xd4f4a8(_0x2ac055);});_0x2df949[_0x799e('0x12')](0x232c,'127.0.0.1',function(){console[_0x799e('0x61')](_0x799e('0x62'),0x232c);return _0x2765e1('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a9983d0..0b427f6 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 _0x8281=['Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x15e17c,_0x39f6c8){var _0x55d8c7=function(_0x3d3313){while(--_0x3d3313){_0x15e17c['push'](_0x15e17c['shift']());}};_0x55d8c7(++_0x39f6c8);}(_0x8281,0x1bd));var _0x1828=function(_0x33c531,_0x3fa051){_0x33c531=_0x33c531-0x0;var _0x5b8388=_0x8281[_0x33c531];return _0x5b8388;};'use strict';var util=require(_0x1828('0x0'));var BPromise=require(_0x1828('0x1'));var jayson=require('jayson/promise');var _=require(_0x1828('0x2'));var logger=require(_0x1828('0x3'))(_0x1828('0x4'));var client=jayson[_0x1828('0x5')][_0x1828('0x6')]({'port':0x232a});function request(_0x3e1999,_0x300110){return new BPromise(function(_0x1d69b5,_0x3a98c1){return client['request'](_0x3e1999,_0x300110)[_0x1828('0x7')](function(_0x31b2ed){if(_0x31b2ed[_0x1828('0x8')]){return _0x3a98c1(_0x31b2ed[_0x1828('0x8')][_0x1828('0x9')]);}else{return _0x1d69b5(_0x31b2ed[_0x1828('0xa')]);}})[_0x1828('0xb')](function(_0x37d3ba){return _0x3a98c1(_0x37d3ba);});});}exports[_0x1828('0xc')]=function(_0x10eff9,_0x6c614,_0x4e301f){return function(_0x134d50){if(_0x4e301f[_0x1828('0xd')]&&!_0x4e301f[_0x1828('0xd')][_0x10eff9]){logger[_0x1828('0xe')](_0x1828('0xf'),_0x10eff9);return _0x134d50[_0x1828('0x10')]();}var _0x5350f1=[];for(var _0x27a8f4=0x0;_0x27a8f4<_0x6c614[_0x1828('0x11')];_0x27a8f4+=0x1){_0x5350f1[_0x1828('0x12')](request(_0x1828('0x13'),{'command':util[_0x1828('0x14')](_0x1828('0x15'),_0x6c614[_0x27a8f4])})[_0x1828('0x7')](function(_0x2194a3){return _0x2194a3&&_0x2194a3[_0x1828('0x9')]&&_0x2194a3[_0x1828('0x9')][_0x1828('0x16')]('true')>=0x0?!![]:![];})['catch'](function(){logger[_0x1828('0x8')](_0x1828('0x17'),_0x10eff9,_0x6c614[_0x27a8f4]);}));}BPromise['all'](_0x5350f1)[_0x1828('0x7')](function(_0xacc696){var _0x2d68b5=_[_0x1828('0x18')](_0xacc696);logger[_0x1828('0xe')](_0x1828('0x19'),_0x10eff9,_0x6c614[_0x1828('0x1a')](_0x1828('0x1b')),_0x2d68b5);_0x134d50['when'](_0x2d68b5);})['catch'](function(_0x15e5f9){logger[_0x1828('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x10eff9,_0x6c614['join'](_0x1828('0x1b')),_0x15e5f9[_0x1828('0x1c')]);_0x134d50[_0x1828('0x10')]();});};}; \ No newline at end of file +var _0x536c=['Command','format','iftime\x20%s','indexOf','true','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x331937,_0x2c5627){var _0x58aba2=function(_0x54eb75){while(--_0x54eb75){_0x331937['push'](_0x331937['shift']());}};_0x58aba2(++_0x2c5627);}(_0x536c,0x84));var _0xc536=function(_0x485d7b,_0x3f3b52){_0x485d7b=_0x485d7b-0x0;var _0x899877=_0x536c[_0x485d7b];return _0x899877;};'use strict';var util=require(_0xc536('0x0'));var BPromise=require(_0xc536('0x1'));var jayson=require('jayson/promise');var _=require(_0xc536('0x2'));var logger=require(_0xc536('0x3'))(_0xc536('0x4'));var client=jayson[_0xc536('0x5')][_0xc536('0x6')]({'port':0x232a});function request(_0x1d1156,_0x3afc81){return new BPromise(function(_0x58abcd,_0x3cb512){return client[_0xc536('0x7')](_0x1d1156,_0x3afc81)[_0xc536('0x8')](function(_0x44dad7){if(_0x44dad7[_0xc536('0x9')]){return _0x3cb512(_0x44dad7[_0xc536('0x9')][_0xc536('0xa')]);}else{return _0x58abcd(_0x44dad7['result']);}})[_0xc536('0xb')](function(_0x2d67b8){return _0x3cb512(_0x2d67b8);});});}exports['condition']=function(_0x5efc92,_0x58d826,_0x444598){return function(_0x3b0a97){if(_0x444598[_0xc536('0xc')]&&!_0x444598[_0xc536('0xc')][_0x5efc92]){logger[_0xc536('0xd')](_0xc536('0xe'),_0x5efc92);return _0x3b0a97[_0xc536('0xf')]();}var _0x399b5d=[];for(var _0x4bcb47=0x0;_0x4bcb47<_0x58d826[_0xc536('0x10')];_0x4bcb47+=0x1){_0x399b5d[_0xc536('0x11')](request(_0xc536('0x12'),{'command':util[_0xc536('0x13')](_0xc536('0x14'),_0x58d826[_0x4bcb47])})[_0xc536('0x8')](function(_0x2e62ae){return _0x2e62ae&&_0x2e62ae[_0xc536('0xa')]&&_0x2e62ae[_0xc536('0xa')][_0xc536('0x15')](_0xc536('0x16'))>=0x0?!![]:![];})[_0xc536('0xb')](function(){logger[_0xc536('0x9')]('[%s][INTERVAL]\x20%s',_0x5efc92,_0x58d826[_0x4bcb47]);}));}BPromise[_0xc536('0x17')](_0x399b5d)['then'](function(_0x52270b){var _0x468fe7=_[_0xc536('0x18')](_0x52270b);logger[_0xc536('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x5efc92,_0x58d826[_0xc536('0x19')](_0xc536('0x1a')),_0x468fe7);_0x3b0a97[_0xc536('0x1b')](_0x468fe7);})['catch'](function(_0x2bbc11){logger[_0xc536('0x9')](_0xc536('0x1c'),_0x5efc92,_0x58d826[_0xc536('0x19')](_0xc536('0x1a')),_0x2bbc11[_0xc536('0x1d')]);_0x3b0a97[_0xc536('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a81892b..5719e1a 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 _0xbb53=['agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','holdtime','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentconnectAt','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','type','agentcomplete','agentacw','acwTimeout','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','timeout','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned'];(function(_0x2bca48,_0x516731){var _0x1c9481=function(_0x26ecfb){while(--_0x26ecfb){_0x2bca48['push'](_0x2bca48['shift']());}};_0x1c9481(++_0x516731);}(_0xbb53,0x121));var _0x3bb5=function(_0x56e926,_0x495c82){_0x56e926=_0x56e926-0x0;var _0x42e1b3=_0xbb53[_0x56e926];return _0x42e1b3;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var utils=require(_0x3bb5('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xa71c15,_0x20c8b6){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x5'),_0xa71c15[_0x3bb5('0x6')],_0xa71c15[_0x3bb5('0x7')],_0xa71c15['queue'],_0xa71c15['membername'],_0xa71c15[_0x3bb5('0x8')],_0xa71c15[_0x3bb5('0x9')],_0xa71c15[_0x3bb5('0xa')],_0xa71c15[_0x3bb5('0xb')]));if(_0xa71c15[_0x3bb5('0xc')]){utils['getVoiceQueueByName'](_0xa71c15['queue'])['then'](function(_0x10ddfb){if(_0x10ddfb){_0xa71c15[_0x3bb5('0xd')]=_0x10ddfb[_0x3bb5('0xd')];_0xa71c15['agentacw']=_0xa71c15[_0x3bb5('0xe')]?_0x10ddfb['acw']:![];_0xa71c15['acwtime']=_0xa71c15[_0x3bb5('0xf')]?_0x10ddfb[_0x3bb5('0x10')]:0x0;}utils['request'](_0x3bb5('0x11'),_0xa71c15);});}else{utils['request'](_0x3bb5('0x11'),_0xa71c15);}if(_0x20c8b6){delete transfers[_0xa71c15['uniqueid']];}else{delete agents[_0xa71c15['destuniqueid']];}}exports[_0x3bb5('0x12')]=function(_0x35a99b){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x14'),_0x35a99b[_0x3bb5('0x6')]),_0x35a99b);agents[_0x35a99b['destuniqueid']]=_0x35a99b;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x16')]=utils['now']();agents[_0x35a99b['destuniqueid']]['lastevent']=_0x3bb5('0x17');agents[_0x35a99b[_0x3bb5('0x15')]]['connectedlinenum']=null;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x18')]=null;utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35a99b[_0x3bb5('0x6')],agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x35a99b['destuniqueid']));}catch(_0x5efea4){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x14'),_0x35a99b['uniqueid']),_0x5efea4);}};exports[_0x3bb5('0x1b')]=function(_0x2afe6e){try{if(!_[_0x3bb5('0x1c')](agents[_0x2afe6e[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentringnoanswer]',_0x2afe6e[_0x3bb5('0x6')]),_0x2afe6e);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x1d'),_0x2afe6e[_0x3bb5('0x6')],agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x2afe6e['destuniqueid']));agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1b')]=!![];agents[_0x2afe6e['destuniqueid']]['agentringnoanswerAt']=utils[_0x3bb5('0x1e')]();agents[_0x2afe6e[_0x3bb5('0x15')]]['lastevent']='timeout';agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x3bb5('0x20');agents[_0x2afe6e[_0x3bb5('0x15')]]['holdtime']=_0x2afe6e['ringtime']?parseInt(_0x2afe6e[_0x3bb5('0x21')])/0x3e8:0x0;agents[_0x2afe6e['destuniqueid']][_0x3bb5('0x22')]=0x0;unanswered[_0x3bb5('0x23')](_0x2afe6e[_0x3bb5('0x15')]);}}catch(_0x534b15){utils['error'](util[_0x3bb5('0x4')](_0x3bb5('0x24'),_0x2afe6e[_0x3bb5('0x6')]),_0x534b15);}};exports[_0x3bb5('0x25')]=function(_0x311680){try{_[_0x3bb5('0x26')](agents,function(_0x3ed2cc,_0x5ce225){if(_0x3ed2cc[_0x3bb5('0x6')]==_0x311680[_0x3bb5('0x6')]&&!_[_0x3bb5('0x27')](unanswered,_0x3ed2cc[_0x3bb5('0x15')])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680['uniqueid']),_0x311680);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x311680[_0x3bb5('0x6')],_0x3ed2cc[_0x3bb5('0x19')],_0x3ed2cc[_0x3bb5('0x15')]));_0x3ed2cc[_0x3bb5('0x1b')]=!![];_0x3ed2cc[_0x3bb5('0x29')]=utils['now']();_0x3ed2cc[_0x3bb5('0xb')]=_0x3bb5('0x2a');_0x3ed2cc[_0x3bb5('0x1f')]=_0x3bb5('0x2a');_0x3ed2cc['holdtime']=_0x311680['holdtime'];_0x3ed2cc[_0x3bb5('0x22')]=0x0;writeDB(_0x3ed2cc);}});}catch(_0xeeb452){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680[_0x3bb5('0x6')]),_0xeeb452);}};exports[_0x3bb5('0x2b')]=function(_0x2a0a19){try{if(agents[_0x2a0a19[_0x3bb5('0x15')]]){utils['debug'](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19['uniqueid']),_0x2a0a19);utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x2d'),_0x2a0a19[_0x3bb5('0x6')],agents[_0x2a0a19[_0x3bb5('0x15')]]['membername'],_0x2a0a19['destuniqueid']));agents[_0x2a0a19[_0x3bb5('0x15')]]['agentconnectAt']=utils[_0x3bb5('0x1e')]();agents[_0x2a0a19['destuniqueid']]['connectedlinenum']=_0x2a0a19[_0x3bb5('0xa')];agents[_0x2a0a19['destuniqueid']]['connectedlinename']=_0x2a0a19[_0x3bb5('0x18')];agents[_0x2a0a19[_0x3bb5('0x15')]][_0x3bb5('0x2e')]=_0x2a0a19['ringtime'];agents[_0x2a0a19[_0x3bb5('0x15')]]['lastevent']=_0x3bb5('0x2f');_['forIn'](agents,function(_0x235e3,_0x35bc81){if(_0x235e3[_0x3bb5('0x15')]!=_0x2a0a19[_0x3bb5('0x15')]&&_0x235e3[_0x3bb5('0x6')]==_0x2a0a19[_0x3bb5('0x6')]){_0x235e3['talktime']=0x0;_0x235e3[_0x3bb5('0x2e')]=_0x2a0a19[_0x3bb5('0x21')];_0x235e3['agentringnoanswer']=!![];_0x235e3[_0x3bb5('0x29')]=utils[_0x3bb5('0x1e')]();_0x235e3[_0x3bb5('0xb')]='answered_elsewhere';_0x235e3[_0x3bb5('0x1f')]=_0x3bb5('0x30');_0x235e3['answeredelsewheredestinationuniqueid']=_0x2a0a19[_0x3bb5('0x15')];_0x235e3[_0x3bb5('0x31')]=_0x2a0a19[_0x3bb5('0x19')];writeDB(_0x235e3);}});}}catch(_0x2291e9){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19[_0x3bb5('0x6')]),_0x2291e9);}};exports[_0x3bb5('0xe')]=function(_0x42676d){try{if(!_[_0x3bb5('0x1c')](agents[_0x42676d[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentcomplete]',_0x42676d[_0x3bb5('0x6')]),_0x42676d);utils[_0x3bb5('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x42676d[_0x3bb5('0x6')],agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x42676d[_0x3bb5('0x15')]));agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xe')]=!![];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x32')]=utils['now']();agents[_0x42676d['destuniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x42676d[_0x3bb5('0x15')]]['agentcompleteAt'],agents[_0x42676d[_0x3bb5('0x15')]]['agentconnectAt']);agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x42676d[_0x3bb5('0x1f')];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xb')]=_0x3bb5('0x34');writeDB(agents[_0x42676d['destuniqueid']]);}}catch(_0x2efd7c){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x35'),_0x42676d[_0x3bb5('0x6')]),_0x2efd7c);}};exports['blindtransfer']=function(_0x41edf7){try{if(!_[_0x3bb5('0x1c')](agents[_0x41edf7[_0x3bb5('0x36')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][blindtransfer]',_0x41edf7[_0x3bb5('0x6')]),_0x41edf7);utils[_0x3bb5('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x41edf7[_0x3bb5('0x6')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x19')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')]));agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x37')]=!![];agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x38')]=_0x3bb5('0x39');agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x3a')]=_0x41edf7[_0x3bb5('0x3b')];agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x3c')]=agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')];}}catch(_0x239a34){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x3d'),_0x41edf7[_0x3bb5('0x6')]),_0x239a34);}};exports[_0x3bb5('0x3e')]=function(_0x1ff862){try{utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862[_0x3bb5('0x40')]),_0x1ff862);if(_0x1ff862['origtransfereruniqueid']==_0x1ff862[_0x3bb5('0x41')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x42')]])){utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x43'),_0x1ff862['origtransfereruniqueid'],agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x37')]=!![];agents[_0x1ff862[_0x3bb5('0x42')]]['transfertype']=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x45')];agents[_0x1ff862['secondtransfereruniqueid']][_0x3bb5('0x3c')]=_0x1ff862[_0x3bb5('0x40')];}if(_0x1ff862[_0x3bb5('0x46')]&&agents[_0x1ff862[_0x3bb5('0x46')]]){agents[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x46')]]=_[_0x3bb5('0x48')](agents[_0x1ff862['transfereeuniqueid']]);transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x9')]=agents[_0x1ff862[_0x3bb5('0x42')]]['calleridnum'];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x49')]=agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x49')];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x16')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x1ff862[_0x3bb5('0x42')]==_0x1ff862[_0x3bb5('0x4b')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x40')]])){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1ff862[_0x3bb5('0x40')],agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x40')]]['transfer']=!![];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x38')]=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x4c')];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3c')]=_0x1ff862['secondtransfereruniqueid'];}if(_0x1ff862[_0x3bb5('0x4d')]&&agents[_0x1ff862[_0x3bb5('0x4d')]]){agents[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x4d')]]=_['clone'](agents[_0x1ff862[_0x3bb5('0x4d')]]);transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x9')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x9')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x49')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x49')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x16')]=utils['now']();transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x2;}}}catch(_0xc34441){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862['origtransfereruniqueid']),_0xc34441);}};exports['hangup']=function(_0x2b3ed8){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x4e'),_0x2b3ed8['uniqueid']),_0x2b3ed8);if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]===_0x3bb5('0x20')){if(_0x2b3ed8['cause']==='21'){agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]=_0x3bb5('0x4f');agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x4f');}utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')],agents[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(agents[_0x2b3ed8['uniqueid']]);var _0x5bfdf2=unanswered['indexOf'](_0x2b3ed8[_0x3bb5('0x6')]);if(_0x5bfdf2>-0x1){unanswered[_0x3bb5('0x51')](_0x5bfdf2,0x1);}}if(transfers[_0x2b3ed8[_0x3bb5('0x6')]]){transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xe')]=!![];transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]);transfers[_0x2b3ed8[_0x3bb5('0x6')]]['reason']=_0x3bb5('0x52');transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x34');utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')],transfers[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(transfers[_0x2b3ed8[_0x3bb5('0x6')]],!![]);}if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]){agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xe')]=!![];agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')],agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x4a')]);agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')]=agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x37')]?_0x3bb5('0x37'):_0x3bb5('0x52');agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xb')]='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]]['reason'],agents[_0x2b3ed8[_0x3bb5('0x6')]]['lastevent']));writeDB(agents[_0x2b3ed8[_0x3bb5('0x6')]]);}}catch(_0xb3572){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x4e'),_0x2b3ed8[_0x3bb5('0x6')]),_0xb3572);}}; \ No newline at end of file +var _0xc788=['transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type','agentcomplete','acwtime','agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten'];(function(_0x5de434,_0x9880c6){var _0x437efc=function(_0x1ba0ae){while(--_0x1ba0ae){_0x5de434['push'](_0x5de434['shift']());}};_0x437efc(++_0x9880c6);}(_0xc788,0xc4));var _0x8c78=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0xc788[_0x324496];return _0x899545;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var utils=require(_0x8c78('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4ecb26,_0x4ce125){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x5'),_0x4ecb26[_0x8c78('0x6')],_0x4ecb26[_0x8c78('0x7')],_0x4ecb26['queue'],_0x4ecb26[_0x8c78('0x8')],_0x4ecb26[_0x8c78('0x9')],_0x4ecb26[_0x8c78('0xa')],_0x4ecb26[_0x8c78('0xb')],_0x4ecb26[_0x8c78('0xc')]));if(_0x4ecb26['queue']){utils[_0x8c78('0xd')](_0x4ecb26[_0x8c78('0xe')])[_0x8c78('0xf')](function(_0x39c0e5){if(_0x39c0e5){_0x4ecb26[_0x8c78('0x10')]=_0x39c0e5[_0x8c78('0x10')];_0x4ecb26['agentacw']=_0x4ecb26[_0x8c78('0x11')]?_0x39c0e5['acw']:![];_0x4ecb26[_0x8c78('0x12')]=_0x4ecb26[_0x8c78('0x13')]?_0x39c0e5['acwTimeout']:0x0;}utils[_0x8c78('0x14')](_0x8c78('0x15'),_0x4ecb26);});}else{utils['request'](_0x8c78('0x15'),_0x4ecb26);}if(_0x4ce125){delete transfers[_0x4ecb26['uniqueid']];}else{delete agents[_0x4ecb26['destuniqueid']];}}exports[_0x8c78('0x16')]=function(_0x1b1d0e){try{utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x1b1d0e);agents[_0x1b1d0e[_0x8c78('0x19')]]=_0x1b1d0e;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xc')]=_0x8c78('0x1c');agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xb')]=null;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1d')]=null;utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x1e'),_0x1b1d0e['uniqueid'],agents[_0x1b1d0e['destuniqueid']][_0x8c78('0x8')],_0x1b1d0e['destuniqueid']));}catch(_0x56801a){utils[_0x8c78('0x1f')](util['format'](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x56801a);}};exports['agentringnoanswer']=function(_0x6c9a12){try{if(!_['isNil'](agents[_0x6c9a12[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util['format'](_0x8c78('0x20'),_0x6c9a12[_0x8c78('0x6')]),_0x6c9a12);utils['info'](util[_0x8c78('0x4')](_0x8c78('0x21'),_0x6c9a12[_0x8c78('0x6')],agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x8')],_0x6c9a12[_0x8c78('0x19')]));agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x22')]=!![];agents[_0x6c9a12[_0x8c78('0x19')]]['agentringnoanswerAt']=utils[_0x8c78('0x1b')]();agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0xc')]='timeout';agents[_0x6c9a12[_0x8c78('0x19')]]['reason']=_0x8c78('0x23');agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x24')]=_0x6c9a12['ringtime']?parseInt(_0x6c9a12[_0x8c78('0x25')])/0x3e8:0x0;agents[_0x6c9a12[_0x8c78('0x19')]]['talktime']=0x0;unanswered[_0x8c78('0x26')](_0x6c9a12[_0x8c78('0x19')]);}}catch(_0x394c1d){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x20'),_0x6c9a12['uniqueid']),_0x394c1d);}};exports[_0x8c78('0x27')]=function(_0x51add6){try{_[_0x8c78('0x28')](agents,function(_0x17f4c8,_0xb69c52){if(_0x17f4c8['uniqueid']==_0x51add6[_0x8c78('0x6')]&&!_[_0x8c78('0x29')](unanswered,_0x17f4c8['destuniqueid'])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6['uniqueid']),_0x51add6);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x2b'),_0x51add6['uniqueid'],_0x17f4c8[_0x8c78('0x8')],_0x17f4c8[_0x8c78('0x19')]));_0x17f4c8['agentringnoanswer']=!![];_0x17f4c8[_0x8c78('0x2c')]=utils[_0x8c78('0x1b')]();_0x17f4c8[_0x8c78('0xc')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x2e')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x24')]=_0x51add6[_0x8c78('0x24')];_0x17f4c8[_0x8c78('0x2f')]=0x0;writeDB(_0x17f4c8);}});}catch(_0x15a868){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6[_0x8c78('0x6')]),_0x15a868);}};exports[_0x8c78('0x30')]=function(_0x34481a){try{if(agents[_0x34481a['destuniqueid']]){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a['uniqueid']),_0x34481a);utils[_0x8c78('0x3')](util[_0x8c78('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34481a[_0x8c78('0x6')],agents[_0x34481a['destuniqueid']][_0x8c78('0x8')],_0x34481a[_0x8c78('0x19')]));agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x32')]=utils['now']();agents[_0x34481a[_0x8c78('0x19')]]['connectedlinenum']=_0x34481a[_0x8c78('0xb')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x1d')]=_0x34481a['connectedlinename'];agents[_0x34481a['destuniqueid']][_0x8c78('0x24')]=_0x34481a[_0x8c78('0x25')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x33');_[_0x8c78('0x28')](agents,function(_0x326b34,_0x314679){if(_0x326b34[_0x8c78('0x19')]!=_0x34481a[_0x8c78('0x19')]&&_0x326b34[_0x8c78('0x6')]==_0x34481a[_0x8c78('0x6')]){_0x326b34[_0x8c78('0x2f')]=0x0;_0x326b34['holdtime']=_0x34481a[_0x8c78('0x25')];_0x326b34[_0x8c78('0x22')]=!![];_0x326b34['agentringnoanswerAt']=utils['now']();_0x326b34[_0x8c78('0xc')]=_0x8c78('0x34');_0x326b34['reason']=_0x8c78('0x34');_0x326b34[_0x8c78('0x35')]=_0x34481a['destuniqueid'];_0x326b34[_0x8c78('0x36')]=_0x34481a[_0x8c78('0x8')];writeDB(_0x326b34);}});}}catch(_0x57e2c7){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a[_0x8c78('0x6')]),_0x57e2c7);}};exports[_0x8c78('0x11')]=function(_0x4e4880){try{if(!_['isNil'](agents[_0x4e4880[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x4e4880);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x38'),_0x4e4880[_0x8c78('0x6')],agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x8')],_0x4e4880['destuniqueid']));agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x11')]=!![];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();agents[_0x4e4880['destuniqueid']][_0x8c78('0x2f')]=utils[_0x8c78('0x3a')](agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')],agents[_0x4e4880[_0x8c78('0x19')]]['agentconnectAt']);agents[_0x4e4880[_0x8c78('0x19')]]['reason']=_0x4e4880['reason'];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x3b');writeDB(agents[_0x4e4880['destuniqueid']]);}}catch(_0x1d78a0){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x1d78a0);}};exports[_0x8c78('0x3c')]=function(_0x26103c){try{if(!_[_0x8c78('0x3d')](agents[_0x26103c[_0x8c78('0x3e')]])){utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x26103c);utils[_0x8c78('0x3')](util['format'](_0x8c78('0x40'),_0x26103c[_0x8c78('0x6')],agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x8')],agents[_0x26103c['transfereruniqueid']][_0x8c78('0x6')]));agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x41')]=!![];agents[_0x26103c['transfereruniqueid']][_0x8c78('0x42')]='blind';agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x43')]=_0x26103c[_0x8c78('0x44')];agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x45')]=agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x6')];}}catch(_0x38fec1){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x38fec1);}};exports[_0x8c78('0x46')]=function(_0x18d896){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x18d896);if(_0x18d896[_0x8c78('0x48')]==_0x18d896['origtransfererlinkedid']){if(!_[_0x8c78('0x3d')](agents[_0x18d896[_0x8c78('0x49')]])){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x4a'),_0x18d896[_0x8c78('0x48')],agents[_0x18d896['secondtransfereruniqueid']][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x49')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x49')]]['transfertype']=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x4c')];agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x48')];}if(_0x18d896['transfereeuniqueid']&&agents[_0x18d896[_0x8c78('0x4d')]]){agents[_0x18d896[_0x8c78('0x4d')]]['agententerreason']=0x1;transfers[_0x18d896[_0x8c78('0x4d')]]=_[_0x8c78('0x4e')](agents[_0x18d896['transfereeuniqueid']]);transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0xa')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x4f')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x24')]=0x0;transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x50')]=0x2;}}else if(_0x18d896['secondtransfereruniqueid']==_0x18d896['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x18d896[_0x8c78('0x48')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x18d896[_0x8c78('0x48')],agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x48')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x42')]=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x51')];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x49')];}if(_0x18d896[_0x8c78('0x52')]&&agents[_0x18d896[_0x8c78('0x52')]]){agents[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x1;transfers[_0x18d896[_0x8c78('0x52')]]=_['clone'](agents[_0x18d896[_0x8c78('0x52')]]);transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0xa')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x4f')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x52')]]['holdtime']=0x0;transfers[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x2;}}}catch(_0x1015e8){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x1015e8);}};exports[_0x8c78('0x53')]=function(_0x240f1e){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e[_0x8c78('0x6')]),_0x240f1e);if(agents[_0x240f1e[_0x8c78('0x6')]]&&agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]===_0x8c78('0x23')){if(_0x240f1e[_0x8c78('0x55')]==='21'){agents[_0x240f1e[_0x8c78('0x6')]]['reason']=_0x8c78('0x56');agents[_0x240f1e[_0x8c78('0x6')]]['lastevent']='rejected';}utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e['uniqueid']]['lastevent']));writeDB(agents[_0x240f1e[_0x8c78('0x6')]]);var _0x2d385f=unanswered[_0x8c78('0x58')](_0x240f1e[_0x8c78('0x6')]);if(_0x2d385f>-0x1){unanswered[_0x8c78('0x59')](_0x2d385f,0x1);}}if(transfers[_0x240f1e['uniqueid']]){transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();transfers[_0x240f1e[_0x8c78('0x6')]]['talktime']=utils[_0x8c78('0x3a')](transfers[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt'],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]=_0x8c78('0x5a');transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],transfers[_0x240f1e[_0x8c78('0x6')]]['lastevent']));writeDB(transfers[_0x240f1e[_0x8c78('0x6')]],!![]);}if(agents[_0x240f1e['uniqueid']]&&agents[_0x240f1e['uniqueid']][_0x8c78('0x32')]){agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];agents[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt']=utils[_0x8c78('0x1b')]();agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2f')]=utils['diffTime'](agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);agents[_0x240f1e['uniqueid']][_0x8c78('0x2e')]=agents[_0x240f1e[_0x8c78('0x6')]]['transfer']?'transfer':'agent';agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e['uniqueid'],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]));writeDB(agents[_0x240f1e['uniqueid']]);}}catch(_0x5c67c9){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e['uniqueid']),_0x5c67c9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 8038de8..00e6b9f 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 _0x4682=['calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','destinationchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','noop','execif','gotoif','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','hangup','[%s][calls][hangup]','callerid'];(function(_0x4e2d7f,_0x3c6173){var _0x3f7f62=function(_0x46b40a){while(--_0x46b40a){_0x4e2d7f['push'](_0x4e2d7f['shift']());}};_0x3f7f62(++_0x3c6173);}(_0x4682,0x17d));var _0x2468=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x4682[_0x1147ab];return _0x55cb5a;};'use strict';var _=require(_0x2468('0x0'));var util=require(_0x2468('0x1'));var utils=require('./utils');var dispositions=[_0x2468('0x2'),'FAILED',_0x2468('0x3'),_0x2468('0x2'),_0x2468('0x2'),_0x2468('0x2'),_0x2468('0x4'),_0x2468('0x5'),_0x2468('0x3'),'FAILED',_0x2468('0x3')];var channels={};function writeDB(_0x4b9dd4){utils[_0x2468('0x6')](util[_0x2468('0x7')](_0x2468('0x8'),_0x4b9dd4['uniqueid'],_0x4b9dd4['channel'],_0x4b9dd4['queue'],_0x4b9dd4[_0x2468('0x9')],_0x4b9dd4[_0x2468('0xa')],_0x4b9dd4[_0x2468('0xb')],_0x4b9dd4[_0x2468('0xc')],_0x4b9dd4[_0x2468('0xd')]));if(_0x4b9dd4[_0x2468('0xe')]){utils[_0x2468('0xf')](_0x4b9dd4[_0x2468('0xe')])[_0x2468('0x10')](function(_0xd959e7){if(_0xd959e7){_0x4b9dd4['UserId']=_0xd959e7['id'];}utils[_0x2468('0x11')](_0x2468('0x12'),_0x4b9dd4);});}else{utils[_0x2468('0x11')](_0x2468('0x12'),_0x4b9dd4);}if(channels[_0x4b9dd4[_0x2468('0x13')]]){delete channels[_0x4b9dd4['uniqueid']];}}exports[_0x2468('0x14')]=function(_0x46fe41){try{utils[_0x2468('0x15')](util['format'](_0x2468('0x16'),_0x46fe41[_0x2468('0x13')]),_0x46fe41);if(_0x46fe41[_0x2468('0x13')]==_0x46fe41['linkedid']&&_0x46fe41[_0x2468('0x17')]!='OutgoingSpoolFailed'){utils['info'](util[_0x2468('0x7')](_0x2468('0x18'),_0x46fe41[_0x2468('0x13')],_0x46fe41[_0x2468('0x19')],_0x46fe41[_0x2468('0x1a')]));channels[_0x46fe41[_0x2468('0x13')]]={'uniqueid':_0x46fe41['uniqueid'],'accountcode':_0x46fe41['accountcode'],'source':_0x46fe41[_0x2468('0xb')],'destination':_0x46fe41[_0x2468('0x1a')],'destinationcontext':_0x46fe41[_0x2468('0x19')],'channel':_0x46fe41[_0x2468('0x17')],'starttime':utils[_0x2468('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2468('0x1c')};}}catch(_0x3eb5f4){utils[_0x2468('0x1d')](util[_0x2468('0x7')](_0x2468('0x16'),_0x46fe41['uniqueid']),_0x3eb5f4);}};exports['newstate']=function(_0x339341){try{utils[_0x2468('0x15')](util[_0x2468('0x7')](_0x2468('0x1e'),_0x339341[_0x2468('0x13')]),_0x339341);if(!_[_0x2468('0x1f')](channels[_0x339341[_0x2468('0x13')]])&&_0x339341[_0x2468('0x20')]==0x6){utils[_0x2468('0x6')](util[_0x2468('0x7')](_0x2468('0x21'),_0x339341[_0x2468('0x13')],_0x339341[_0x2468('0x19')],_0x339341[_0x2468('0x17')]));if(_['isNil'](channels[_0x339341[_0x2468('0x13')]]['systemanswertime'])){channels[_0x339341[_0x2468('0x13')]][_0x2468('0x22')]=utils[_0x2468('0x1b')]();}}else if(!_[_0x2468('0x1f')](channels[_0x339341[_0x2468('0x23')]])&&_0x339341['channelstate']==0x6&&_0x339341[_0x2468('0x19')]!=_0x2468('0x24')){utils[_0x2468('0x6')](util[_0x2468('0x7')](_0x2468('0x25'),_0x339341['uniqueid'],_0x339341[_0x2468('0x23')],_0x339341[_0x2468('0x19')],_0x339341[_0x2468('0x17')]));channels[_0x339341[_0x2468('0x23')]][_0x2468('0xe')]=_0x339341[_0x2468('0xe')];channels[_0x339341[_0x2468('0x23')]]['destinationchannel']=_0x339341['channel'];if(_[_0x2468('0x1f')](channels[_0x339341[_0x2468('0x23')]][_0x2468('0x26')])){channels[_0x339341[_0x2468('0x23')]][_0x2468('0x26')]=utils['now']();}channels[_0x339341[_0x2468('0x23')]]['disposition']=dispositions[_[_0x2468('0x27')](_0x339341[_0x2468('0x20')])]||_0x2468('0x4');}}catch(_0x158d54){utils[_0x2468('0x1d')](util[_0x2468('0x7')]('[%s][calls][newstate]',_0x339341[_0x2468('0x13')]),_0x158d54);}};exports[_0x2468('0x28')]=function(_0x520a38){try{if(!_[_0x2468('0x1f')](channels[_0x520a38[_0x2468('0x13')]])){utils[_0x2468('0x15')](util[_0x2468('0x7')](_0x2468('0x29'),_0x520a38['uniqueid']),_0x520a38);if(_[_0x2468('0x1f')](channels[_0x520a38[_0x2468('0x13')]][_0x2468('0x2a')])){channels[_0x520a38[_0x2468('0x13')]][_0x2468('0x2a')]=_0x520a38[_0x2468('0x2b')]+'\x20<'+_0x520a38['calleridnum']+'>';}utils[_0x2468('0x6')](util['format'](_0x2468('0x2c'),_0x520a38[_0x2468('0x13')],channels[_0x520a38['uniqueid']][_0x2468('0x2a')],_0x520a38[_0x2468('0x2d')]));channels[_0x520a38[_0x2468('0x13')]]['endtime']=utils[_0x2468('0x1b')]();channels[_0x520a38[_0x2468('0x13')]][_0x2468('0x2e')]=utils['diffTime'](channels[_0x520a38['uniqueid']][_0x2468('0x2f')],channels[_0x520a38[_0x2468('0x13')]][_0x2468('0x30')]);channels[_0x520a38[_0x2468('0x13')]]['billableseconds']=channels[_0x520a38[_0x2468('0x13')]]['answertime']?utils[_0x2468('0x31')](channels[_0x520a38[_0x2468('0x13')]][_0x2468('0x2f')],channels[_0x520a38[_0x2468('0x13')]]['answertime']):0x0;writeDB(channels[_0x520a38[_0x2468('0x13')]]);}}catch(_0x5c1d6d){utils[_0x2468('0x1d')](util[_0x2468('0x7')](_0x2468('0x29'),_0x520a38[_0x2468('0x13')]),_0x5c1d6d);}};exports['attendedtransfer']=function(_0xf548c5){try{if(!_[_0x2468('0x1f')](channels[_0xf548c5[_0x2468('0x32')]])){utils[_0x2468('0x15')](util[_0x2468('0x7')](_0x2468('0x33'),_0xf548c5['origtransfereruniqueid']),_0xf548c5);if(channels[_0xf548c5['localtwolinkedid']][_0x2468('0x17')]==_0xf548c5[_0x2468('0x34')]){utils[_0x2468('0x6')](util['format'](_0x2468('0x35'),_0xf548c5[_0x2468('0x36')],_0xf548c5[_0x2468('0x32')],_0xf548c5[_0x2468('0x37')]));channels[_0xf548c5[_0x2468('0x32')]]['destinationchannel']=_0xf548c5[_0x2468('0x37')];channels[_0xf548c5['localtwolinkedid']]['userfield']=_0x2468('0x38');}else if(channels[_0xf548c5[_0x2468('0x32')]]['channel']=_0xf548c5['transfertargetchannel']){utils[_0x2468('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xf548c5[_0x2468('0x36')],_0xf548c5[_0x2468('0x32')],_0xf548c5[_0x2468('0x39')]));channels[_0xf548c5[_0x2468('0x32')]][_0x2468('0x3a')]=_0xf548c5[_0x2468('0x39')];channels[_0xf548c5['localtwolinkedid']][_0x2468('0x3b')]=_0x2468('0x38');}}}catch(_0x388e94){utils[_0x2468('0x1d')](util[_0x2468('0x7')](_0x2468('0x33'),_0xf548c5[_0x2468('0x36')]),_0x388e94);}};exports[_0x2468('0x3c')]=function(_0x5e4b74){try{if(!_[_0x2468('0x1f')](channels[_0x5e4b74[_0x2468('0x13')]])){utils[_0x2468('0x15')](util[_0x2468('0x7')](_0x2468('0x3d'),_0x5e4b74[_0x2468('0x13')]),_0x5e4b74);channels[_0x5e4b74['uniqueid']][_0x2468('0x3e')]=utils['now']();utils[_0x2468('0x6')](util['format'](_0x2468('0x3f'),_0x5e4b74[_0x2468('0x13')],channels[_0x5e4b74[_0x2468('0x13')]][_0x2468('0x3e')]));}}catch(_0x267842){utils[_0x2468('0x1d')](util[_0x2468('0x7')](_0x2468('0x3d'),_0x5e4b74[_0x2468('0x13')]),_0x267842);}};exports[_0x2468('0x40')]=function(_0x4ba6a8){try{if(!_[_0x2468('0x1f')](channels[_0x4ba6a8[_0x2468('0x13')]])){utils[_0x2468('0x15')](util[_0x2468('0x7')]('[%s][calls][musiconholdstop]',_0x4ba6a8[_0x2468('0x13')]),_0x4ba6a8);if(!_['isNil'](channels[_0x4ba6a8[_0x2468('0x13')]][_0x2468('0x3e')])){channels[_0x4ba6a8['uniqueid']]['mohtime']+=utils[_0x2468('0x31')](utils[_0x2468('0x1b')](),channels[_0x4ba6a8[_0x2468('0x13')]]['musiconholdstartAt']);utils['info'](util[_0x2468('0x7')](_0x2468('0x41'),_0x4ba6a8[_0x2468('0x13')],channels[_0x4ba6a8[_0x2468('0x13')]][_0x2468('0x42')]));delete channels[_0x4ba6a8[_0x2468('0x13')]][_0x2468('0x3e')];}}}catch(_0x4e3d0c){utils['error'](util[_0x2468('0x7')](_0x2468('0x43'),_0x4ba6a8[_0x2468('0x13')]),_0x4e3d0c);}};exports[_0x2468('0x44')]=function(_0x592654){try{if(!_[_0x2468('0x1f')](channels[_0x592654['uniqueid']])){utils['debug'](util[_0x2468('0x7')](_0x2468('0x45'),_0x592654[_0x2468('0x13')]),_0x592654);if(!_[_0x2468('0x1f')](_0x592654['variable'][_0x2468('0x46')])){utils['info'](util[_0x2468('0x7')](_0x2468('0x47'),_0x592654[_0x2468('0x13')],_0x592654[_0x2468('0x48')]));channels[_0x592654[_0x2468('0x13')]]['source']=_0x592654['value'];}if(!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x4a')])){utils[_0x2468('0x6')](util[_0x2468('0x7')](_0x2468('0x4b'),_0x592654[_0x2468('0x13')],_0x592654[_0x2468('0x48')]));channels[_0x592654['uniqueid']][_0x2468('0x4c')]=_0x592654[_0x2468('0x48')];channels[_0x592654[_0x2468('0x13')]][_0x2468('0x2a')]='\x22'+_0x592654[_0x2468('0x48')]+'\x22\x20<'+_0x592654[_0x2468('0x48')]+'>';}if(!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x4d')])||!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x4e')])){utils[_0x2468('0x6')](util[_0x2468('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x592654['uniqueid'],!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')]['xmd-callerid-preview'])?_0x2468('0x4d'):_0x2468('0x4e'),_0x592654[_0x2468('0x48')]));channels[_0x592654[_0x2468('0x13')]][_0x2468('0x2a')]=_0x592654['value'];}if(!_['isNil'](_0x592654[_0x2468('0x49')][_0x2468('0x4f')])||!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x50')])){utils[_0x2468('0x6')](util[_0x2468('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x592654['uniqueid'],!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x4f')])?_0x2468('0x4f'):_0x2468('0x50'),_0x592654[_0x2468('0x48')]));channels[_0x592654['uniqueid']][_0x2468('0x51')]=_0x2468('0x52');channels[_0x592654[_0x2468('0x13')]][_0x2468('0x53')]=_0x592654[_0x2468('0x48')];channels[_0x592654[_0x2468('0x13')]][_0x2468('0x54')]=!![];}if(!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')]['xmd-contactid'])){utils[_0x2468('0x6')](util['format'](_0x2468('0x55'),_0x592654[_0x2468('0x13')],_0x592654[_0x2468('0x48')]));channels[_0x592654[_0x2468('0x13')]][_0x2468('0x56')]=_0x592654[_0x2468('0x48')];}if(!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x57')])){utils[_0x2468('0x6')](util['format'](_0x2468('0x58'),_0x592654['uniqueid'],_0x592654[_0x2468('0x48')]));channels[_0x592654[_0x2468('0x13')]][_0x2468('0x59')]=_0x592654['value'];}if(!_[_0x2468('0x1f')](_0x592654[_0x2468('0x49')][_0x2468('0x5a')])){utils[_0x2468('0x6')](util[_0x2468('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x592654[_0x2468('0x13')],_0x592654['value']));channels[_0x592654['uniqueid']][_0x2468('0x5b')]=_0x592654[_0x2468('0x48')];}if(!_[_0x2468('0x1f')](_0x592654['variable'][_0x2468('0x5c')])){utils['info'](util[_0x2468('0x7')](_0x2468('0x5d'),_0x592654['uniqueid'],_0x592654[_0x2468('0x48')]));channels[_0x592654[_0x2468('0x13')]][_0x2468('0x5c')]=_0x592654[_0x2468('0x48')];}}}catch(_0x3833c5){utils[_0x2468('0x1d')](util[_0x2468('0x7')]('[%s][calls][varset]',_0x592654[_0x2468('0x13')]),_0x3833c5);}};exports[_0x2468('0x5e')]=function(_0x2f06d6){try{if(!_['isNil'](channels[_0x2f06d6['uniqueid']])){utils[_0x2468('0x15')](util[_0x2468('0x7')](_0x2468('0x5f'),_0x2f06d6['uniqueid']),_0x2f06d6);utils[_0x2468('0x6')](util[_0x2468('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2f06d6['uniqueid'],_0x2f06d6[_0x2468('0x60')],_0x2f06d6[_0x2468('0x61')]));if(_0x2f06d6[_0x2468('0x60')][_0x2468('0x62')]()=='set'&&_[_0x2468('0x63')](_0x2f06d6[_0x2468('0x61')][_0x2468('0x62')](),_0x2468('0x64'))){var _0x20bd41=_0x2f06d6[_0x2468('0x61')]['split']('=');var _0x327739=_0x20bd41[0x0][_0x2468('0x65')](_0x20bd41[0x0]['lastIndexOf']('(')+0x1,_0x20bd41[0x0][_0x2468('0x66')](')'));var _0x2236ea=_0x20bd41[0x1];channels[_0x2f06d6['uniqueid']][_0x327739]=_0x2236ea;}if(!_['includes']([_0x2468('0x28'),_0x2468('0x67'),_0x2468('0x68'),'set',_0x2468('0x69')],_0x2f06d6[_0x2468('0x60')]['toLowerCase']())){channels[_0x2f06d6[_0x2468('0x13')]][_0x2468('0x51')]=_0x2f06d6[_0x2468('0x60')];channels[_0x2f06d6[_0x2468('0x13')]][_0x2468('0x53')]=_0x2f06d6['appdata'];}}}catch(_0x264805){utils[_0x2468('0x1d')](util[_0x2468('0x7')](_0x2468('0x5f'),_0x2f06d6[_0x2468('0x13')]),_0x264805);}}; \ No newline at end of file +var _0x5fa1=['format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','secondtransfererchannel','userfield','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED'];(function(_0x1aceb0,_0x57d860){var _0xc171f4=function(_0x1c0f16){while(--_0x1c0f16){_0x1aceb0['push'](_0x1aceb0['shift']());}};_0xc171f4(++_0x57d860);}(_0x5fa1,0x65));var _0x15fa=function(_0x1dadda,_0xba1088){_0x1dadda=_0x1dadda-0x0;var _0x10fa08=_0x5fa1[_0x1dadda];return _0x10fa08;};'use strict';var _=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var utils=require(_0x15fa('0x2'));var dispositions=['NO\x20ANSWER',_0x15fa('0x3'),'FAILED',_0x15fa('0x4'),_0x15fa('0x4'),'NO\x20ANSWER',_0x15fa('0x5'),'BUSY','FAILED',_0x15fa('0x3'),_0x15fa('0x3')];var channels={};function writeDB(_0x1b1230){utils['info'](util[_0x15fa('0x6')](_0x15fa('0x7'),_0x1b1230['uniqueid'],_0x1b1230[_0x15fa('0x8')],_0x1b1230[_0x15fa('0x9')],_0x1b1230[_0x15fa('0xa')],_0x1b1230['interface'],_0x1b1230[_0x15fa('0xb')],_0x1b1230[_0x15fa('0xc')],_0x1b1230['lastevent']));if(_0x1b1230[_0x15fa('0xd')]){utils[_0x15fa('0xe')](_0x1b1230[_0x15fa('0xd')])[_0x15fa('0xf')](function(_0x5761f3){if(_0x5761f3){_0x1b1230[_0x15fa('0x10')]=_0x5761f3['id'];}utils['request']('CreateVoiceCallReport',_0x1b1230);});}else{utils[_0x15fa('0x11')](_0x15fa('0x12'),_0x1b1230);}if(channels[_0x1b1230[_0x15fa('0x13')]]){delete channels[_0x1b1230[_0x15fa('0x13')]];}}exports['newchannel']=function(_0x4c31bf){try{utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x15'),_0x4c31bf['uniqueid']),_0x4c31bf);if(_0x4c31bf[_0x15fa('0x13')]==_0x4c31bf['linkedid']&&_0x4c31bf[_0x15fa('0x8')]!=_0x15fa('0x16')){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x18'),_0x4c31bf[_0x15fa('0x13')],_0x4c31bf[_0x15fa('0x19')],_0x4c31bf['exten']));channels[_0x4c31bf[_0x15fa('0x13')]]={'uniqueid':_0x4c31bf[_0x15fa('0x13')],'accountcode':_0x4c31bf['accountcode'],'source':_0x4c31bf[_0x15fa('0xb')],'destination':_0x4c31bf['exten'],'destinationcontext':_0x4c31bf[_0x15fa('0x19')],'channel':_0x4c31bf[_0x15fa('0x8')],'starttime':utils[_0x15fa('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x15fa('0x4'),'amaflags':_0x15fa('0x1b')};}}catch(_0x5ed2c3){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x15'),_0x4c31bf[_0x15fa('0x13')]),_0x5ed2c3);}};exports[_0x15fa('0x1d')]=function(_0x169007){try{utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x1e'),_0x169007[_0x15fa('0x13')]),_0x169007);if(!_['isNil'](channels[_0x169007['uniqueid']])&&_0x169007[_0x15fa('0x1f')]==0x6){utils['info'](util[_0x15fa('0x6')](_0x15fa('0x20'),_0x169007[_0x15fa('0x13')],_0x169007[_0x15fa('0x19')],_0x169007[_0x15fa('0x8')]));if(_[_0x15fa('0x21')](channels[_0x169007[_0x15fa('0x13')]][_0x15fa('0x22')])){channels[_0x169007[_0x15fa('0x13')]]['systemanswertime']=utils[_0x15fa('0x1a')]();}}else if(!_['isNil'](channels[_0x169007['linkedid']])&&_0x169007[_0x15fa('0x1f')]==0x6&&_0x169007[_0x15fa('0x19')]!=_0x15fa('0x23')){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x24'),_0x169007['uniqueid'],_0x169007[_0x15fa('0x25')],_0x169007[_0x15fa('0x19')],_0x169007[_0x15fa('0x8')]));channels[_0x169007[_0x15fa('0x25')]][_0x15fa('0xd')]=_0x169007[_0x15fa('0xd')];channels[_0x169007[_0x15fa('0x25')]][_0x15fa('0x26')]=_0x169007[_0x15fa('0x8')];if(_['isNil'](channels[_0x169007['linkedid']][_0x15fa('0x27')])){channels[_0x169007['linkedid']]['answertime']=utils[_0x15fa('0x1a')]();}channels[_0x169007[_0x15fa('0x25')]][_0x15fa('0x28')]=dispositions[_['toNumber'](_0x169007[_0x15fa('0x1f')])]||_0x15fa('0x5');}}catch(_0x24e769){utils['error'](util[_0x15fa('0x6')](_0x15fa('0x1e'),_0x169007[_0x15fa('0x13')]),_0x24e769);}};exports['hangup']=function(_0x15a7c3){try{if(!_['isNil'](channels[_0x15a7c3['uniqueid']])){utils['debug'](util[_0x15fa('0x6')](_0x15fa('0x29'),_0x15a7c3[_0x15fa('0x13')]),_0x15a7c3);if(_['isNil'](channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2a')])){channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2a')]=_0x15a7c3[_0x15fa('0x2b')]+'\x20<'+_0x15a7c3['calleridnum']+'>';}utils[_0x15fa('0x17')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x15a7c3[_0x15fa('0x13')],channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2a')],_0x15a7c3[_0x15fa('0x2c')]));channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2d')]=utils[_0x15fa('0x1a')]();channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2e')]=utils[_0x15fa('0x2f')](channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2d')],channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x30')]);channels[_0x15a7c3[_0x15fa('0x13')]]['billableseconds']=channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x27')]?utils[_0x15fa('0x2f')](channels[_0x15a7c3[_0x15fa('0x13')]]['endtime'],channels[_0x15a7c3[_0x15fa('0x13')]]['answertime']):0x0;writeDB(channels[_0x15a7c3[_0x15fa('0x13')]]);}}catch(_0x337151){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x29'),_0x15a7c3[_0x15fa('0x13')]),_0x337151);}};exports[_0x15fa('0x31')]=function(_0x5c64d9){try{if(!_[_0x15fa('0x21')](channels[_0x5c64d9[_0x15fa('0x32')]])){utils['debug'](util[_0x15fa('0x6')]('[%s][calls][attendedtransfer]',_0x5c64d9[_0x15fa('0x33')]),_0x5c64d9);if(channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x8')]==_0x5c64d9['transfereechannel']){utils[_0x15fa('0x17')](util[_0x15fa('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5c64d9[_0x15fa('0x33')],_0x5c64d9['localtwolinkedid'],_0x5c64d9[_0x15fa('0x34')]));channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x26')]=_0x5c64d9[_0x15fa('0x34')];channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x35')]='_attended';}else if(channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x8')]=_0x5c64d9['transfertargetchannel']){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x36'),_0x5c64d9[_0x15fa('0x33')],_0x5c64d9[_0x15fa('0x32')],_0x5c64d9[_0x15fa('0x37')]));channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x26')]=_0x5c64d9[_0x15fa('0x37')];channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x35')]=_0x15fa('0x38');}}}catch(_0x226bc6){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x39'),_0x5c64d9['origtransfereruniqueid']),_0x226bc6);}};exports[_0x15fa('0x3a')]=function(_0x5b5132){try{if(!_['isNil'](channels[_0x5b5132[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util['format'](_0x15fa('0x3b'),_0x5b5132[_0x15fa('0x13')]),_0x5b5132);channels[_0x5b5132['uniqueid']]['musiconholdstartAt']=utils[_0x15fa('0x1a')]();utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x3c'),_0x5b5132[_0x15fa('0x13')],channels[_0x5b5132[_0x15fa('0x13')]][_0x15fa('0x3d')]));}}catch(_0x44ac4b){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x3b'),_0x5b5132[_0x15fa('0x13')]),_0x44ac4b);}};exports[_0x15fa('0x3e')]=function(_0x2c404c){try{if(!_[_0x15fa('0x21')](channels[_0x2c404c[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x3f'),_0x2c404c['uniqueid']),_0x2c404c);if(!_[_0x15fa('0x21')](channels[_0x2c404c[_0x15fa('0x13')]]['musiconholdstartAt'])){channels[_0x2c404c[_0x15fa('0x13')]][_0x15fa('0x40')]+=utils[_0x15fa('0x2f')](utils[_0x15fa('0x1a')](),channels[_0x2c404c[_0x15fa('0x13')]][_0x15fa('0x3d')]);utils[_0x15fa('0x17')](util['format'](_0x15fa('0x41'),_0x2c404c['uniqueid'],channels[_0x2c404c[_0x15fa('0x13')]]['mohtime']));delete channels[_0x2c404c[_0x15fa('0x13')]][_0x15fa('0x3d')];}}}catch(_0x1a1115){utils[_0x15fa('0x1c')](util['format']('[%s][calls][musiconholdstop]',_0x2c404c[_0x15fa('0x13')]),_0x1a1115);}};exports[_0x15fa('0x42')]=function(_0x2fa8d7){try{if(!_[_0x15fa('0x21')](channels[_0x2fa8d7[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x43'),_0x2fa8d7[_0x15fa('0x13')]),_0x2fa8d7);if(!_['isNil'](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x45')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x46'),_0x2fa8d7['uniqueid'],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x48')]=_0x2fa8d7[_0x15fa('0x47')];}if(!_[_0x15fa('0x21')](_0x2fa8d7['variable'][_0x15fa('0x49')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x4a'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7['uniqueid']][_0x15fa('0x4b')]=_0x2fa8d7[_0x15fa('0x47')];channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x2a')]='\x22'+_0x2fa8d7[_0x15fa('0x47')]+_0x15fa('0x4c')+_0x2fa8d7[_0x15fa('0x47')]+'>';}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4d')])||!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')]['xmd-callerid'])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2fa8d7[_0x15fa('0x13')],!_['isNil'](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4d')])?_0x15fa('0x4d'):_0x15fa('0x4e'),_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x2a')]=_0x2fa8d7['value'];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4f')])||!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x50')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2fa8d7['uniqueid'],!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4f')])?'xmd-queue':_0x15fa('0x50'),_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7['uniqueid']][_0x15fa('0x51')]=_0x15fa('0x52');channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x53')]=_0x2fa8d7[_0x15fa('0x47')];channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x9')]=!![];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')]['xmd-contactid'])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x54'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x55')]=_0x2fa8d7[_0x15fa('0x47')];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x56')])){utils['info'](util[_0x15fa('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]]['type']=_0x2fa8d7['value'];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')]['outboundrouteid'])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x57'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x58')]=_0x2fa8d7[_0x15fa('0x47')];}if(!_['isNil'](_0x2fa8d7['variable'][_0x15fa('0x59')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x5a'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]]['sipcallid']=_0x2fa8d7[_0x15fa('0x47')];}}}catch(_0x27eeee){utils['error'](util[_0x15fa('0x6')]('[%s][calls][varset]',_0x2fa8d7[_0x15fa('0x13')]),_0x27eeee);}};exports[_0x15fa('0x5b')]=function(_0x51cdd8){try{if(!_[_0x15fa('0x21')](channels[_0x51cdd8[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util[_0x15fa('0x6')]('[%s][calls][newexten]',_0x51cdd8[_0x15fa('0x13')]),_0x51cdd8);utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x5c'),_0x51cdd8['uniqueid'],_0x51cdd8[_0x15fa('0x5d')],_0x51cdd8[_0x15fa('0x5e')]));if(_0x51cdd8[_0x15fa('0x5d')][_0x15fa('0x5f')]()==_0x15fa('0x60')&&_[_0x15fa('0x61')](_0x51cdd8[_0x15fa('0x5e')][_0x15fa('0x5f')](),_0x15fa('0x62'))){var _0x49a4c1=_0x51cdd8[_0x15fa('0x5e')][_0x15fa('0x63')]('=');var _0x4a920c=_0x49a4c1[0x0][_0x15fa('0x64')](_0x49a4c1[0x0]['lastIndexOf']('(')+0x1,_0x49a4c1[0x0][_0x15fa('0x65')](')'));var _0x10afbd=_0x49a4c1[0x1];channels[_0x51cdd8['uniqueid']][_0x4a920c]=_0x10afbd;}if(!_['includes']([_0x15fa('0x66'),_0x15fa('0x67'),_0x15fa('0x68'),_0x15fa('0x60'),_0x15fa('0x69')],_0x51cdd8[_0x15fa('0x5d')][_0x15fa('0x5f')]())){channels[_0x51cdd8['uniqueid']][_0x15fa('0x51')]=_0x51cdd8[_0x15fa('0x5d')];channels[_0x51cdd8[_0x15fa('0x13')]][_0x15fa('0x53')]=_0x51cdd8[_0x15fa('0x5e')];}}}catch(_0x34628f){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x6a'),_0x51cdd8[_0x15fa('0x13')]),_0x34628f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5285403..6e9a7b7 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 _0x97e5=['managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x49e293,_0xca51f8){var _0x2e2e26=function(_0x374b73){while(--_0x374b73){_0x49e293['push'](_0x49e293['shift']());}};_0x2e2e26(++_0xca51f8);}(_0x97e5,0xcd));var _0x597e=function(_0x5d74c9,_0x3f0582){_0x5d74c9=_0x5d74c9-0x0;var _0x34ecab=_0x97e5[_0x5d74c9];return _0x34ecab;};'use strict';var utils=require(_0x597e('0x0'));exports['connect']=function(){utils[_0x597e('0x1')](_0x597e('0x2'));};exports[_0x597e('0x3')]=function(){utils['info'](_0x597e('0x4'));};exports[_0x597e('0x5')]=function(){utils[_0x597e('0x1')](_0x597e('0x6'));};exports[_0x597e('0x7')]=function(_0x173c58){utils[_0x597e('0x7')](_0x597e('0x8'),_0x173c58);};exports[_0x597e('0x9')]=function(){utils[_0x597e('0x1')](_0x597e('0xa'));};exports[_0x597e('0xb')]=function(_0x458c38){}; \ No newline at end of file +var _0xb543=['fullybooted','error','[core]\x20error','[core]\x20close','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0x3b64e0,_0x1f9aa2){var _0x5534f3=function(_0xdfc578){while(--_0xdfc578){_0x3b64e0['push'](_0x3b64e0['shift']());}};_0x5534f3(++_0x1f9aa2);}(_0xb543,0x18a));var _0x3b54=function(_0x3cbb27,_0xac83ef){_0x3cbb27=_0x3cbb27-0x0;var _0x158815=_0xb543[_0x3cbb27];return _0x158815;};'use strict';var utils=require(_0x3b54('0x0'));exports[_0x3b54('0x1')]=function(){utils['info'](_0x3b54('0x2'));};exports[_0x3b54('0x3')]=function(){utils[_0x3b54('0x4')](_0x3b54('0x5'));};exports[_0x3b54('0x6')]=function(){utils[_0x3b54('0x4')]('[core]\x20fullybooted');};exports[_0x3b54('0x7')]=function(_0x1c173f){utils[_0x3b54('0x7')](_0x3b54('0x8'),_0x1c173f);};exports['close']=function(){utils[_0x3b54('0x4')](_0x3b54('0x9'));};exports['managerevent']=function(_0x3db582){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 344bb2f..ebe99d8 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 _0x0f21=['dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','info','value','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','diffTime','util','./utils','format','uniqueid','channel','dialstring','calleridnum'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x0f21,0x1b2));var _0x10f2=function(_0x2c87cb,_0x13fea8){_0x2c87cb=_0x2c87cb-0x0;var _0x396ee9=_0x0f21[_0x2c87cb];return _0x396ee9;};'use strict';var _=require('lodash');var util=require(_0x10f2('0x0'));var utils=require(_0x10f2('0x1'));var dials={};function writeDB(_0x2a417e){utils['info'](util[_0x10f2('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2a417e[_0x10f2('0x3')],_0x2a417e[_0x10f2('0x4')],_0x2a417e[_0x10f2('0x5')],_0x2a417e[_0x10f2('0x6')],_0x2a417e['connectedlinenum'],_0x2a417e[_0x10f2('0x7')]));utils[_0x10f2('0x8')](_0x10f2('0x9'),_0x2a417e);delete dials[_0x2a417e['uniqueid']];}exports[_0x10f2('0xa')]=function(_0x2b4752){try{utils[_0x10f2('0xb')](util[_0x10f2('0x2')]('[%s][dials][newexten]',_0x2b4752['uniqueid']),_0x2b4752);utils['info'](util[_0x10f2('0x2')](_0x10f2('0xc'),_0x2b4752[_0x10f2('0x3')],_0x2b4752['application'],_0x2b4752[_0x10f2('0xd')]));if(_0x2b4752[_0x10f2('0xe')][_0x10f2('0xf')]()==_0x10f2('0x10')&&_['startsWith'](_0x2b4752['appdata'][_0x10f2('0xf')](),_0x10f2('0x11'))){var _0x2a54bf=_0x2b4752[_0x10f2('0xd')][_0x10f2('0x12')]('=');dials[_0x2b4752[_0x10f2('0x3')]]={'routeId':_0x2a54bf[0x1]};}}catch(_0x3a2dd6){utils[_0x10f2('0x13')](util[_0x10f2('0x2')](_0x10f2('0x14'),_0x2b4752[_0x10f2('0x3')]),_0x3a2dd6);}};exports[_0x10f2('0x15')]=function(_0x22cca6){try{utils[_0x10f2('0xb')](util[_0x10f2('0x2')](_0x10f2('0x16'),_0x22cca6['uniqueid']),_0x22cca6);if(!_[_0x10f2('0x17')](_0x22cca6[_0x10f2('0x18')]['outboundrouteid'])){utils[_0x10f2('0x19')](util[_0x10f2('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x22cca6[_0x10f2('0x3')],_0x22cca6['value']));dials[_0x22cca6['uniqueid']]={'routeId':_0x22cca6[_0x10f2('0x1a')]};}}catch(_0x42a1cd){utils[_0x10f2('0x13')](util[_0x10f2('0x2')](_0x10f2('0x16'),_0x22cca6[_0x10f2('0x3')]),_0x42a1cd);}};exports['dialbegin']=function(_0x8517fc){try{if(!_[_0x10f2('0x17')](dials[_0x8517fc[_0x10f2('0x3')]])){utils[_0x10f2('0xb')](util[_0x10f2('0x2')](_0x10f2('0x1b'),_0x8517fc[_0x10f2('0x3')]),_0x8517fc);dials[_0x8517fc[_0x10f2('0x3')]]=_[_0x10f2('0x1c')](dials[_0x8517fc[_0x10f2('0x3')]],_0x8517fc);dials[_0x8517fc[_0x10f2('0x3')]]['starttime']=utils[_0x10f2('0x1d')]();dials[_0x8517fc['uniqueid']][_0x10f2('0x1e')]=_0x10f2('0x1f');utils['info'](util[_0x10f2('0x2')](_0x10f2('0x20'),_0x8517fc[_0x10f2('0x3')],dials[_0x8517fc[_0x10f2('0x3')]][_0x10f2('0x21')]));}}catch(_0x1afa9f){utils[_0x10f2('0x13')](util['format']('[%s][dials][dialbegin]',_0x8517fc[_0x10f2('0x3')]),_0x1afa9f);}};exports[_0x10f2('0x22')]=function(_0x32b018){try{if(!_['isNil'](dials[_0x32b018[_0x10f2('0x3')]])){utils['debug'](util[_0x10f2('0x2')](_0x10f2('0x23'),_0x32b018[_0x10f2('0x3')]),_0x32b018);dials[_0x32b018[_0x10f2('0x3')]][_0x10f2('0x7')]=_0x32b018[_0x10f2('0x7')];if(_0x32b018[_0x10f2('0x7')]==_0x10f2('0x24')){dials[_0x32b018[_0x10f2('0x3')]]=_[_0x10f2('0x1c')](dials[_0x32b018[_0x10f2('0x3')]],_0x32b018);dials[_0x32b018[_0x10f2('0x3')]]['answertime']=utils['now']();dials[_0x32b018['uniqueid']][_0x10f2('0x1e')]=_0x10f2('0x25');utils[_0x10f2('0x19')](util[_0x10f2('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x32b018[_0x10f2('0x3')],_0x32b018[_0x10f2('0x7')],dials[_0x32b018[_0x10f2('0x3')]][_0x10f2('0x26')]));}else{utils['info'](util[_0x10f2('0x2')](_0x10f2('0x27'),_0x32b018[_0x10f2('0x3')],_0x32b018[_0x10f2('0x7')]));}}}catch(_0x3f725e){utils['error'](util[_0x10f2('0x2')](_0x10f2('0x23'),_0x32b018[_0x10f2('0x3')]),_0x3f725e);}};exports[_0x10f2('0x28')]=function(_0x5aeb0d){try{if(!_[_0x10f2('0x17')](dials[_0x5aeb0d[_0x10f2('0x3')]])){utils[_0x10f2('0xb')](util[_0x10f2('0x2')](_0x10f2('0x29'),_0x5aeb0d[_0x10f2('0x3')]),_0x5aeb0d);utils[_0x10f2('0x19')](util[_0x10f2('0x2')](_0x10f2('0x2a'),_0x5aeb0d[_0x10f2('0x3')],_0x5aeb0d[_0x10f2('0x6')],_0x5aeb0d[_0x10f2('0x2b')],_0x5aeb0d[_0x10f2('0x2c')]));dials[_0x5aeb0d[_0x10f2('0x3')]]=_[_0x10f2('0x1c')](dials[_0x5aeb0d[_0x10f2('0x3')]],{'endtime':utils['now'](),'lastevent':_0x10f2('0x2d')});dials[_0x5aeb0d[_0x10f2('0x3')]][_0x10f2('0x2e')]=utils['diffTime'](dials[_0x5aeb0d[_0x10f2('0x3')]][_0x10f2('0x2f')],dials[_0x5aeb0d[_0x10f2('0x3')]]['starttime']);dials[_0x5aeb0d[_0x10f2('0x3')]]['holdtime']=utils[_0x10f2('0x30')](dials[_0x5aeb0d[_0x10f2('0x3')]][_0x10f2('0x26')]||dials[_0x5aeb0d[_0x10f2('0x3')]]['endtime'],dials[_0x5aeb0d[_0x10f2('0x3')]][_0x10f2('0x21')]);dials[_0x5aeb0d[_0x10f2('0x3')]]['billableseconds']=dials[_0x5aeb0d[_0x10f2('0x3')]]['answertime']?utils[_0x10f2('0x30')](dials[_0x5aeb0d[_0x10f2('0x3')]][_0x10f2('0x2f')],dials[_0x5aeb0d[_0x10f2('0x3')]]['answertime']):0x0;writeDB(dials[_0x5aeb0d[_0x10f2('0x3')]]);}}catch(_0x90daea){utils[_0x10f2('0x13')](util[_0x10f2('0x2')](_0x10f2('0x29'),_0x5aeb0d[_0x10f2('0x3')]),_0x90daea);}}; \ No newline at end of file +var _0x5ce3=['appdata','set','startsWith','toLowerCase','cdr(routeid)','error','format','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','diffTime','endtime','billableseconds','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x8fb8e0,_0x32dd74){var _0xa0259d=function(_0x578b1d){while(--_0x578b1d){_0x8fb8e0['push'](_0x8fb8e0['shift']());}};_0xa0259d(++_0x32dd74);}(_0x5ce3,0x148));var _0x35ce=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x5ce3[_0x316c42];return _0x2b38f7;};'use strict';var _=require('lodash');var util=require(_0x35ce('0x0'));var utils=require(_0x35ce('0x1'));var dials={};function writeDB(_0x13c7a7){utils['info'](util['format'](_0x35ce('0x2'),_0x13c7a7[_0x35ce('0x3')],_0x13c7a7[_0x35ce('0x4')],_0x13c7a7[_0x35ce('0x5')],_0x13c7a7['calleridnum'],_0x13c7a7[_0x35ce('0x6')],_0x13c7a7[_0x35ce('0x7')]));utils[_0x35ce('0x8')](_0x35ce('0x9'),_0x13c7a7);delete dials[_0x13c7a7['uniqueid']];}exports[_0x35ce('0xa')]=function(_0xd62202){try{utils[_0x35ce('0xb')](util['format']('[%s][dials][newexten]',_0xd62202[_0x35ce('0x3')]),_0xd62202);utils[_0x35ce('0xc')](util['format'](_0x35ce('0xd'),_0xd62202[_0x35ce('0x3')],_0xd62202[_0x35ce('0xe')],_0xd62202[_0x35ce('0xf')]));if(_0xd62202[_0x35ce('0xe')]['toLowerCase']()==_0x35ce('0x10')&&_[_0x35ce('0x11')](_0xd62202[_0x35ce('0xf')][_0x35ce('0x12')](),_0x35ce('0x13'))){var _0x39f48b=_0xd62202[_0x35ce('0xf')]['split']('=');dials[_0xd62202[_0x35ce('0x3')]]={'routeId':_0x39f48b[0x1]};}}catch(_0xd8e8e){utils[_0x35ce('0x14')](util['format']('[%s][dials][newexten]',_0xd62202[_0x35ce('0x3')]),_0xd8e8e);}};exports['varset']=function(_0x522d03){try{utils['debug'](util[_0x35ce('0x15')](_0x35ce('0x16'),_0x522d03[_0x35ce('0x3')]),_0x522d03);if(!_[_0x35ce('0x17')](_0x522d03[_0x35ce('0x18')][_0x35ce('0x19')])){utils[_0x35ce('0xc')](util[_0x35ce('0x15')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x522d03['uniqueid'],_0x522d03[_0x35ce('0x1a')]));dials[_0x522d03[_0x35ce('0x3')]]={'routeId':_0x522d03['value']};}}catch(_0x18c215){utils[_0x35ce('0x14')](util[_0x35ce('0x15')](_0x35ce('0x16'),_0x522d03[_0x35ce('0x3')]),_0x18c215);}};exports[_0x35ce('0x1b')]=function(_0x53d2cd){try{if(!_[_0x35ce('0x17')](dials[_0x53d2cd['uniqueid']])){utils[_0x35ce('0xb')](util['format'](_0x35ce('0x1c'),_0x53d2cd[_0x35ce('0x3')]),_0x53d2cd);dials[_0x53d2cd['uniqueid']]=_[_0x35ce('0x1d')](dials[_0x53d2cd[_0x35ce('0x3')]],_0x53d2cd);dials[_0x53d2cd[_0x35ce('0x3')]][_0x35ce('0x1e')]=utils[_0x35ce('0x1f')]();dials[_0x53d2cd[_0x35ce('0x3')]][_0x35ce('0x20')]='called';utils[_0x35ce('0xc')](util[_0x35ce('0x15')](_0x35ce('0x21'),_0x53d2cd[_0x35ce('0x3')],dials[_0x53d2cd['uniqueid']][_0x35ce('0x1e')]));}}catch(_0x19ef71){utils[_0x35ce('0x14')](util[_0x35ce('0x15')]('[%s][dials][dialbegin]',_0x53d2cd[_0x35ce('0x3')]),_0x19ef71);}};exports[_0x35ce('0x22')]=function(_0xfaeb6e){try{if(!_[_0x35ce('0x17')](dials[_0xfaeb6e['uniqueid']])){utils['debug'](util[_0x35ce('0x15')](_0x35ce('0x23'),_0xfaeb6e[_0x35ce('0x3')]),_0xfaeb6e);dials[_0xfaeb6e[_0x35ce('0x3')]][_0x35ce('0x7')]=_0xfaeb6e[_0x35ce('0x7')];if(_0xfaeb6e['dialstatus']==_0x35ce('0x24')){dials[_0xfaeb6e[_0x35ce('0x3')]]=_['assign'](dials[_0xfaeb6e[_0x35ce('0x3')]],_0xfaeb6e);dials[_0xfaeb6e[_0x35ce('0x3')]][_0x35ce('0x25')]=utils[_0x35ce('0x1f')]();dials[_0xfaeb6e['uniqueid']]['lastevent']='connect';utils['info'](util['format'](_0x35ce('0x26'),_0xfaeb6e[_0x35ce('0x3')],_0xfaeb6e[_0x35ce('0x7')],dials[_0xfaeb6e[_0x35ce('0x3')]][_0x35ce('0x25')]));}else{utils[_0x35ce('0xc')](util[_0x35ce('0x15')](_0x35ce('0x27'),_0xfaeb6e['uniqueid'],_0xfaeb6e[_0x35ce('0x7')]));}}}catch(_0x562976){utils[_0x35ce('0x14')](util[_0x35ce('0x15')]('[%s][dials][dialend]',_0xfaeb6e[_0x35ce('0x3')]),_0x562976);}};exports[_0x35ce('0x28')]=function(_0x4f1d90){try{if(!_['isNil'](dials[_0x4f1d90['uniqueid']])){utils[_0x35ce('0xb')](util[_0x35ce('0x15')](_0x35ce('0x29'),_0x4f1d90[_0x35ce('0x3')]),_0x4f1d90);utils[_0x35ce('0xc')](util[_0x35ce('0x15')](_0x35ce('0x2a'),_0x4f1d90['uniqueid'],_0x4f1d90[_0x35ce('0x2b')],_0x4f1d90[_0x35ce('0x2c')],_0x4f1d90['cause-txt']));dials[_0x4f1d90[_0x35ce('0x3')]]=_['assign'](dials[_0x4f1d90['uniqueid']],{'endtime':utils[_0x35ce('0x1f')](),'lastevent':_0x35ce('0x2d')});dials[_0x4f1d90['uniqueid']]['duration']=utils[_0x35ce('0x2e')](dials[_0x4f1d90[_0x35ce('0x3')]]['endtime'],dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x1e')]);dials[_0x4f1d90[_0x35ce('0x3')]]['holdtime']=utils[_0x35ce('0x2e')](dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x25')]||dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x2f')],dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x1e')]);dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x30')]=dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x25')]?utils[_0x35ce('0x2e')](dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x2f')],dials[_0x4f1d90['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4f1d90['uniqueid']]);}}catch(_0x380a27){utils[_0x35ce('0x14')](util[_0x35ce('0x15')](_0x35ce('0x29'),_0x4f1d90[_0x35ce('0x3')]),_0x380a27);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f73ebfa..aa56e96 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 _0x518d=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','local','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0xe3fb7c,_0x4b6f98){var _0x5ab3c7=function(_0x17866d){while(--_0x17866d){_0xe3fb7c['push'](_0xe3fb7c['shift']());}};_0x5ab3c7(++_0x4b6f98);}(_0x518d,0x17e));var _0xd518=function(_0x704680,_0x3fb539){_0x704680=_0x704680-0x0;var _0x43d029=_0x518d[_0x704680];return _0x43d029;};var AsteriskManager=require(_0xd518('0x0'));var config=require(_0xd518('0x1'));var utils=require(_0xd518('0x2'));var util=require(_0xd518('0x3'));var isXDREnabled=config[_0xd518('0x4')]&&config[_0xd518('0x4')][_0xd518('0x5')]?!config[_0xd518('0x4')][_0xd518('0x5')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0xd518('0x4')][_0xd518('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0xd518('0x7')]['ip'],config[_0xd518('0x7')]['username'],config[_0xd518('0x7')][_0xd518('0x8')],!![]);ami[_0xd518('0x9')]();if(!isXDREnabled){utils[_0xd518('0xa')](_0xd518('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd518('0xa')](_0xd518('0xc'));}else{var agents=require(_0xd518('0xd'));var calls=require(_0xd518('0xe'));var queues=require(_0xd518('0xf'));var recordings=require(_0xd518('0x10'));var members=require(_0xd518('0x11'));var dials=require(_0xd518('0x12'));var transfers=require('./transfers.controller');var core=require(_0xd518('0x13'));ami['on'](_0xd518('0x14'),core[_0xd518('0x14')]);ami['on']('shutdown',core[_0xd518('0x15')]);ami['on'](_0xd518('0x16'),core['fullybooted']);ami['on'](_0xd518('0x17'),core[_0xd518('0x17')]);ami['on'](_0xd518('0x18'),core[_0xd518('0x18')]);ami['on']('managerevent',core[_0xd518('0x19')]);ami['on'](_0xd518('0x1a'),function(_0x43be60){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x1d'),_0x43be60['device']),_0x43be60);members[_0xd518('0x1a')](_0x43be60);}catch(_0x50e7f4){utils['error'](util['format'](_0xd518('0x1d'),_0x43be60[_0xd518('0x1e')]),_0x50e7f4);}});ami['on'](_0xd518('0x1f'),function(_0x5de4c6){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x20'),_0x5de4c6[_0xd518('0x21')]),_0x5de4c6);agents[_0xd518('0x1f')](_0x5de4c6);}catch(_0x28caba){utils[_0xd518('0x17')](util[_0xd518('0x1c')](_0xd518('0x20'),_0x5de4c6['uniqueid']),_0x28caba);}});ami['on'](_0xd518('0x22'),function(_0x1aff73){try{utils['debug'](util[_0xd518('0x1c')](_0xd518('0x23'),_0x1aff73[_0xd518('0x21')]),_0x1aff73);agents[_0xd518('0x22')](_0x1aff73);}catch(_0x5881fb){utils[_0xd518('0x17')](util[_0xd518('0x1c')](_0xd518('0x23'),_0x1aff73['uniqueid']),_0x5881fb);}});ami['on'](_0xd518('0x24'),function(_0xff9849){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x25'),_0xff9849[_0xd518('0x21')]),_0xff9849);agents[_0xd518('0x24')](_0xff9849);queues[_0xd518('0x24')](_0xff9849);}catch(_0x447317){utils['error'](util[_0xd518('0x1c')](_0xd518('0x25'),_0xff9849[_0xd518('0x21')]),_0x447317);}});ami['on'](_0xd518('0x26'),function(_0x39c0de){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x27'),_0x39c0de[_0xd518('0x21')]),_0x39c0de);agents['agentcomplete'](_0x39c0de);queues[_0xd518('0x26')](_0x39c0de);members[_0xd518('0x26')](_0x39c0de);}catch(_0x480734){utils[_0xd518('0x17')](util['format'](_0xd518('0x27'),_0x39c0de['uniqueid']),_0x480734);}});ami['on'](_0xd518('0x28'),function(_0x1dde3d){try{utils[_0xd518('0x1b')](util['format'](_0xd518('0x29'),_0x1dde3d['uniqueid']),_0x1dde3d);agents[_0xd518('0x28')](_0x1dde3d);queues[_0xd518('0x28')](_0x1dde3d);}catch(_0x3aca87){utils['error'](util['format'](_0xd518('0x29'),_0x1dde3d[_0xd518('0x21')]),_0x3aca87);}});ami['on'](_0xd518('0x2a'),function(_0xe1fe82){try{utils['debug'](util['format'](_0xd518('0x2b'),_0xe1fe82[_0xd518('0x21')]),_0xe1fe82);queues[_0xd518('0x2a')](_0xe1fe82);recordings[_0xd518('0x2a')](_0xe1fe82);}catch(_0x5e56fe){utils[_0xd518('0x17')](util['format'](_0xd518('0x2b'),_0xe1fe82['uniqueid']),_0x5e56fe);}});ami['on'](_0xd518('0x2c'),function(_0x29a428){try{utils['debug'](util[_0xd518('0x1c')](_0xd518('0x2d'),_0x29a428[_0xd518('0x21')]),_0x29a428);queues[_0xd518('0x2c')](_0x29a428);}catch(_0x144f2a){utils[_0xd518('0x17')](util[_0xd518('0x1c')](_0xd518('0x2d'),_0x29a428[_0xd518('0x21')]),_0x144f2a);}});ami['on'](_0xd518('0x2e'),function(_0x1d2fc0){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x2f'),_0x1d2fc0['uniqueid']),_0x1d2fc0);queues[_0xd518('0x2e')](_0x1d2fc0);calls['musiconholdstart'](_0x1d2fc0);}catch(_0x249f5d){utils['error'](util[_0xd518('0x1c')]('[%s][index][musiconholdstart]',_0x1d2fc0[_0xd518('0x21')]),_0x249f5d);}});ami['on'](_0xd518('0x30'),function(_0x497389){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x31'),_0x497389[_0xd518('0x21')]),_0x497389);queues[_0xd518('0x30')](_0x497389);calls[_0xd518('0x30')](_0x497389);}catch(_0x39718d){utils['error'](util[_0xd518('0x1c')](_0xd518('0x31'),_0x497389['uniqueid']),_0x39718d);}});ami['on'](_0xd518('0x32'),function(_0x57ce16){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')]('[%s][index][newstate]',_0x57ce16[_0xd518('0x21')]),_0x57ce16);calls[_0xd518('0x32')](_0x57ce16);recordings[_0xd518('0x32')](_0x57ce16);}catch(_0x32a2e3){utils[_0xd518('0x17')](util['format']('[%s][index][newstate]',_0x57ce16[_0xd518('0x21')]),_0x32a2e3);}});ami['on'](_0xd518('0x33'),function(_0x5af43b){try{utils['debug'](util['format'](_0xd518('0x34'),_0x5af43b['uniqueid']),_0x5af43b);calls['hangup'](_0x5af43b);recordings[_0xd518('0x33')](_0x5af43b);dials[_0xd518('0x33')](_0x5af43b);agents[_0xd518('0x33')](_0x5af43b);queues[_0xd518('0x33')](_0x5af43b);}catch(_0x2d284e){utils['error'](util[_0xd518('0x1c')]('[%s][index][hangup]',_0x5af43b[_0xd518('0x21')]),_0x2d284e);}});ami['on'](_0xd518('0x35'),function(_0x478f6a){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x36'),_0x478f6a[_0xd518('0x21')]),_0x478f6a);members[_0xd518('0x35')](_0x478f6a);}catch(_0x5b4902){utils[_0xd518('0x17')](util['format'](_0xd518('0x36'),_0x478f6a[_0xd518('0x21')]),_0x5b4902);}});ami['on'](_0xd518('0x37'),function(_0x399f04){try{utils['debug'](util[_0xd518('0x1c')](_0xd518('0x38'),_0x399f04[_0xd518('0x21')]),_0x399f04);queues[_0xd518('0x37')](_0x399f04);agents['blindtransfer'](_0x399f04);transfers[_0xd518('0x37')](_0x399f04);}catch(_0x274bb1){utils[_0xd518('0x17')](util[_0xd518('0x1c')](_0xd518('0x38'),_0x399f04[_0xd518('0x21')]),_0x274bb1);}});ami['on']('attendedtransfer',function(_0x4f65fa){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x39'),_0x4f65fa[_0xd518('0x3a')]),_0x4f65fa);queues[_0xd518('0x3b')](_0x4f65fa);transfers[_0xd518('0x3b')](_0x4f65fa);agents[_0xd518('0x3b')](_0x4f65fa);calls['attendedtransfer'](_0x4f65fa);}catch(_0x1cb070){utils['error'](util[_0xd518('0x1c')](_0xd518('0x39'),_0x4f65fa['origtransfereruniqueid']),_0x1cb070);}});ami['on'](_0xd518('0x3c'),function(_0x27f523){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x3d'),_0x27f523[_0xd518('0x21')]),_0x27f523);queues['varset'](_0x27f523);recordings[_0xd518('0x3c')](_0x27f523);calls[_0xd518('0x3c')](_0x27f523);dials[_0xd518('0x3c')](_0x27f523);}catch(_0x4bdc5c){utils[_0xd518('0x17')](util['format'](_0xd518('0x3d'),_0x27f523[_0xd518('0x21')]),_0x4bdc5c);}});ami['on'](_0xd518('0x3e'),function(_0x2e7ac7){try{utils['debug'](util[_0xd518('0x1c')](_0xd518('0x3f'),_0x2e7ac7[_0xd518('0x21')]),_0x2e7ac7);calls[_0xd518('0x3e')](_0x2e7ac7);recordings['newexten'](_0x2e7ac7);dials['newexten'](_0x2e7ac7);}catch(_0x3892ce){utils[_0xd518('0x17')](util[_0xd518('0x1c')](_0xd518('0x3f'),_0x2e7ac7[_0xd518('0x21')]),_0x3892ce);}});ami['on'](_0xd518('0x40'),function(_0x1e29fe){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x41'),_0x1e29fe['uniqueid']),_0x1e29fe);calls['newchannel'](_0x1e29fe);recordings[_0xd518('0x40')](_0x1e29fe);}catch(_0x1c75d6){utils['error'](util[_0xd518('0x1c')]('[%s][index][newchannel]',_0x1e29fe[_0xd518('0x21')]),_0x1c75d6);}});ami['on'](_0xd518('0x42'),function(_0x11c75a){try{utils[_0xd518('0x1b')](util[_0xd518('0x1c')](_0xd518('0x43'),_0x11c75a[_0xd518('0x21')]),_0x11c75a);dials[_0xd518('0x42')](_0x11c75a);}catch(_0x3af130){utils[_0xd518('0x17')](util['format']('[%s]dialbegin',_0x11c75a[_0xd518('0x21')]),_0x3af130);}});ami['on'](_0xd518('0x44'),function(_0x26ff34){try{utils[_0xd518('0x1b')](util['format'](_0xd518('0x45'),_0x26ff34[_0xd518('0x21')]),_0x26ff34);dials['dialend'](_0x26ff34);}catch(_0x5730fb){utils[_0xd518('0x17')](util[_0xd518('0x1c')](_0xd518('0x45'),_0x26ff34[_0xd518('0x21')]),_0x5730fb);}});} \ No newline at end of file +var _0x9d40=['asterisk','port','username','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','error','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','disabled','production'];(function(_0x17e40f,_0x53ec26){var _0x1aa124=function(_0x2387f7){while(--_0x2387f7){_0x17e40f['push'](_0x17e40f['shift']());}};_0x1aa124(++_0x53ec26);}(_0x9d40,0x1bb));var _0x09d4=function(_0x5f2f7f,_0x38bc83){_0x5f2f7f=_0x5f2f7f-0x0;var _0x89c751=_0x9d40[_0x5f2f7f];return _0x89c751;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x09d4('0x0'));var util=require(_0x09d4('0x1'));var isXDREnabled=config[_0x09d4('0x2')]&&config[_0x09d4('0x2')]['disabled']?!config['xdr'][_0x09d4('0x3')]:!![];var isProduction=config['env']===_0x09d4('0x4')||![];var isLocalAsterisk=config[_0x09d4('0x2')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x09d4('0x5')][_0x09d4('0x6')],config['asterisk']['ip'],config[_0x09d4('0x5')][_0x09d4('0x7')],config[_0x09d4('0x5')]['password'],!![]);ami[_0x09d4('0x8')]();if(!isXDREnabled){utils['info'](_0x09d4('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x09d4('0xa'));}else{var agents=require(_0x09d4('0xb'));var calls=require(_0x09d4('0xc'));var queues=require(_0x09d4('0xd'));var recordings=require(_0x09d4('0xe'));var members=require(_0x09d4('0xf'));var dials=require(_0x09d4('0x10'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x09d4('0x11'),core[_0x09d4('0x11')]);ami['on'](_0x09d4('0x12'),core[_0x09d4('0x12')]);ami['on']('fullybooted',core[_0x09d4('0x13')]);ami['on']('error',core['error']);ami['on'](_0x09d4('0x14'),core['close']);ami['on'](_0x09d4('0x15'),core['managerevent']);ami['on'](_0x09d4('0x16'),function(_0x4b571b){try{utils['debug'](util['format'](_0x09d4('0x17'),_0x4b571b[_0x09d4('0x18')]),_0x4b571b);members[_0x09d4('0x16')](_0x4b571b);}catch(_0x492c4d){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x17'),_0x4b571b['device']),_0x492c4d);}});ami['on'](_0x09d4('0x1b'),function(_0x48c365){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x1d'),_0x48c365[_0x09d4('0x1e')]),_0x48c365);agents[_0x09d4('0x1b')](_0x48c365);}catch(_0x2c2d5f){utils['error'](util['format'](_0x09d4('0x1d'),_0x48c365['uniqueid']),_0x2c2d5f);}});ami['on'](_0x09d4('0x1f'),function(_0x2ffecf){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][agentringnoanswer]',_0x2ffecf[_0x09d4('0x1e')]),_0x2ffecf);agents[_0x09d4('0x1f')](_0x2ffecf);}catch(_0x27f2bf){utils['error'](util[_0x09d4('0x1a')]('[%s][index][agentringnoanswer]',_0x2ffecf['uniqueid']),_0x27f2bf);}});ami['on'](_0x09d4('0x20'),function(_0x3cc44b){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x21'),_0x3cc44b[_0x09d4('0x1e')]),_0x3cc44b);agents[_0x09d4('0x20')](_0x3cc44b);queues[_0x09d4('0x20')](_0x3cc44b);}catch(_0x2ae4cc){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][agentconnect]',_0x3cc44b[_0x09d4('0x1e')]),_0x2ae4cc);}});ami['on'](_0x09d4('0x22'),function(_0x48efb8){try{utils['debug'](util[_0x09d4('0x1a')](_0x09d4('0x23'),_0x48efb8[_0x09d4('0x1e')]),_0x48efb8);agents[_0x09d4('0x22')](_0x48efb8);queues['agentcomplete'](_0x48efb8);members[_0x09d4('0x22')](_0x48efb8);}catch(_0xf677d4){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][agentcomplete]',_0x48efb8[_0x09d4('0x1e')]),_0xf677d4);}});ami['on'](_0x09d4('0x24'),function(_0x30c0e6){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][queuecallerabandon]',_0x30c0e6[_0x09d4('0x1e')]),_0x30c0e6);agents[_0x09d4('0x24')](_0x30c0e6);queues[_0x09d4('0x24')](_0x30c0e6);}catch(_0x370078){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x25'),_0x30c0e6['uniqueid']),_0x370078);}});ami['on']('queuecallerjoin',function(_0x11843a){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x26'),_0x11843a[_0x09d4('0x1e')]),_0x11843a);queues[_0x09d4('0x27')](_0x11843a);recordings[_0x09d4('0x27')](_0x11843a);}catch(_0x20aa24){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x26'),_0x11843a['uniqueid']),_0x20aa24);}});ami['on'](_0x09d4('0x28'),function(_0x2004a6){try{utils[_0x09d4('0x1c')](util['format']('[%s][index][queuecallerleave]',_0x2004a6['uniqueid']),_0x2004a6);queues['queuecallerleave'](_0x2004a6);}catch(_0x1571cc){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x29'),_0x2004a6['uniqueid']),_0x1571cc);}});ami['on']('musiconholdstart',function(_0x41a9d6){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][musiconholdstart]',_0x41a9d6[_0x09d4('0x1e')]),_0x41a9d6);queues['musiconholdstart'](_0x41a9d6);calls['musiconholdstart'](_0x41a9d6);}catch(_0x3cccec){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x2a'),_0x41a9d6[_0x09d4('0x1e')]),_0x3cccec);}});ami['on'](_0x09d4('0x2b'),function(_0x1d322b){try{utils[_0x09d4('0x1c')](util['format'](_0x09d4('0x2c'),_0x1d322b[_0x09d4('0x1e')]),_0x1d322b);queues[_0x09d4('0x2b')](_0x1d322b);calls['musiconholdstop'](_0x1d322b);}catch(_0x367fcf){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][musiconholdstop]',_0x1d322b['uniqueid']),_0x367fcf);}});ami['on'](_0x09d4('0x2d'),function(_0x2df4f6){try{utils['debug'](util['format'](_0x09d4('0x2e'),_0x2df4f6[_0x09d4('0x1e')]),_0x2df4f6);calls['newstate'](_0x2df4f6);recordings[_0x09d4('0x2d')](_0x2df4f6);}catch(_0x1d9348){utils['error'](util['format'](_0x09d4('0x2e'),_0x2df4f6[_0x09d4('0x1e')]),_0x1d9348);}});ami['on']('hangup',function(_0x1e0532){try{utils['debug'](util[_0x09d4('0x1a')](_0x09d4('0x2f'),_0x1e0532[_0x09d4('0x1e')]),_0x1e0532);calls[_0x09d4('0x30')](_0x1e0532);recordings[_0x09d4('0x30')](_0x1e0532);dials[_0x09d4('0x30')](_0x1e0532);agents[_0x09d4('0x30')](_0x1e0532);queues[_0x09d4('0x30')](_0x1e0532);}catch(_0x2a2c31){utils[_0x09d4('0x19')](util['format'](_0x09d4('0x2f'),_0x1e0532[_0x09d4('0x1e')]),_0x2a2c31);}});ami['on'](_0x09d4('0x31'),function(_0x553d36){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x32'),_0x553d36[_0x09d4('0x1e')]),_0x553d36);members[_0x09d4('0x31')](_0x553d36);}catch(_0x31fcbe){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x32'),_0x553d36[_0x09d4('0x1e')]),_0x31fcbe);}});ami['on'](_0x09d4('0x33'),function(_0x2520ab){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x34'),_0x2520ab['uniqueid']),_0x2520ab);queues[_0x09d4('0x33')](_0x2520ab);agents[_0x09d4('0x33')](_0x2520ab);transfers['blindtransfer'](_0x2520ab);}catch(_0x115575){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x34'),_0x2520ab[_0x09d4('0x1e')]),_0x115575);}});ami['on'](_0x09d4('0x35'),function(_0x5642ba){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x36'),_0x5642ba['origtransfereruniqueid']),_0x5642ba);queues['attendedtransfer'](_0x5642ba);transfers[_0x09d4('0x35')](_0x5642ba);agents['attendedtransfer'](_0x5642ba);calls[_0x09d4('0x35')](_0x5642ba);}catch(_0x28df3e){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x36'),_0x5642ba[_0x09d4('0x37')]),_0x28df3e);}});ami['on'](_0x09d4('0x38'),function(_0x4a0165){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][varset]',_0x4a0165[_0x09d4('0x1e')]),_0x4a0165);queues[_0x09d4('0x38')](_0x4a0165);recordings['varset'](_0x4a0165);calls[_0x09d4('0x38')](_0x4a0165);dials['varset'](_0x4a0165);}catch(_0x2a6e10){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][varset]',_0x4a0165[_0x09d4('0x1e')]),_0x2a6e10);}});ami['on'](_0x09d4('0x39'),function(_0x3e51e7){try{utils[_0x09d4('0x1c')](util['format'](_0x09d4('0x3a'),_0x3e51e7['uniqueid']),_0x3e51e7);calls[_0x09d4('0x39')](_0x3e51e7);recordings[_0x09d4('0x39')](_0x3e51e7);dials['newexten'](_0x3e51e7);}catch(_0x568562){utils['error'](util['format'](_0x09d4('0x3a'),_0x3e51e7[_0x09d4('0x1e')]),_0x568562);}});ami['on'](_0x09d4('0x3b'),function(_0x3ab39a){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x3c'),_0x3ab39a[_0x09d4('0x1e')]),_0x3ab39a);calls[_0x09d4('0x3b')](_0x3ab39a);recordings['newchannel'](_0x3ab39a);}catch(_0x6d831d){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x3c'),_0x3ab39a[_0x09d4('0x1e')]),_0x6d831d);}});ami['on'](_0x09d4('0x3d'),function(_0x31c814){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][dialbegin]',_0x31c814[_0x09d4('0x1e')]),_0x31c814);dials['dialbegin'](_0x31c814);}catch(_0x230237){utils['error'](util[_0x09d4('0x1a')]('[%s]dialbegin',_0x31c814[_0x09d4('0x1e')]),_0x230237);}});ami['on'](_0x09d4('0x3e'),function(_0x244d38){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x3f'),_0x244d38[_0x09d4('0x1e')]),_0x244d38);dials[_0x09d4('0x3e')](_0x244d38);}catch(_0x2deb0b){utils['error'](util[_0x09d4('0x1a')]('[%s][index][dialend]',_0x244d38['uniqueid']),_0x2deb0b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8506a5b..a855977 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 _0x8bc9=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','split','request','error','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','exitAt','diffTime','agentcomplete','isNil','debug','info','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','util','Local/_attended@transfer','Queue:','format'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x8bc9,0x89));var _0x98bc=function(_0x2aa0b9,_0x3481b1){_0x2aa0b9=_0x2aa0b9-0x0;var _0x498e18=_0x8bc9[_0x2aa0b9];return _0x498e18;};'use strict';var _=require('lodash');var util=require(_0x98bc('0x0'));var utils=require('./utils');var members={};var exclude=[_0x98bc('0x1'),_0x98bc('0x2')];function writeDB(_0x43335e){utils['info'](util[_0x98bc('0x3')](_0x98bc('0x4'),_0x43335e['uniqueid'],_0x43335e[_0x98bc('0x5')],_0x43335e[_0x98bc('0x6')],_0x43335e[_0x98bc('0x7')],_0x43335e[_0x98bc('0x8')],_0x43335e[_0x98bc('0x9')]));if(_0x43335e[_0x98bc('0x5')]){utils[_0x98bc('0xa')](_0x43335e['interface'])[_0x98bc('0xb')](function(_0x8d512){if(_0x8d512){_0x43335e['membername']=_0x8d512[_0x98bc('0xc')];_0x43335e['internal']=_0x8d512[_0x98bc('0xd')];utils['request'](_0x98bc('0xe'),_0x43335e);}else{utils['getUserByName'](_0x43335e['interface'][_0x98bc('0xf')]('/')[0x1])[_0x98bc('0xb')](function(_0x382437){if(_0x382437){_0x43335e[_0x98bc('0x8')]=_0x382437[_0x98bc('0xc')];_0x43335e[_0x98bc('0xd')]=_0x382437[_0x98bc('0xd')];utils[_0x98bc('0x10')](_0x98bc('0xe'),_0x43335e);}});}})['catch'](function(_0x456d62){utils[_0x98bc('0x11')](util['format']('[%s][members][writeDB]',_0x43335e[_0x98bc('0x12')]),_0x456d62);});}delete members[_0x43335e[_0x98bc('0x5')]];}function startsWith(_0x4beb61,_0x57ed57){return _[_0x98bc('0x13')](_0x4beb61,function(_0x324957){return _[_0x98bc('0x14')](_0x57ed57,_0x324957);});}exports[_0x98bc('0x15')]=function(_0x9e91ac){try{utils['debug'](util[_0x98bc('0x3')](_0x98bc('0x16'),members[_0x9e91ac[_0x98bc('0x17')]]?members[_0x9e91ac['device']]['uniqueid']:_0x9e91ac[_0x98bc('0x17')]),_0x9e91ac);utils['info'](util[_0x98bc('0x3')](_0x98bc('0x18'),members[_0x9e91ac[_0x98bc('0x17')]]?members[_0x9e91ac[_0x98bc('0x17')]][_0x98bc('0x12')]:_0x9e91ac[_0x98bc('0x17')],_0x9e91ac['state'],_0x9e91ac[_0x98bc('0x17')]));switch(_0x9e91ac[_0x98bc('0x19')]){case _0x98bc('0x1a'):case _0x98bc('0x1b'):if(!startsWith(exclude,_0x9e91ac[_0x98bc('0x17')])){members[_0x9e91ac[_0x98bc('0x17')]]={'channel':_0x98bc('0x1c'),'interface':_0x9e91ac[_0x98bc('0x17')],'type':_0x98bc('0x1d'),'enterAt':utils[_0x98bc('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x9e91ac[_0x98bc('0x17')]])){members[_0x9e91ac[_0x98bc('0x17')]][_0x98bc('0x1f')]=utils['now']();members[_0x9e91ac['device']]['duration']=utils[_0x98bc('0x20')](members[_0x9e91ac[_0x98bc('0x17')]][_0x98bc('0x1f')],members[_0x9e91ac[_0x98bc('0x17')]]['enterAt']);if(members[_0x9e91ac[_0x98bc('0x17')]][_0x98bc('0x12')]){writeDB(members[_0x9e91ac[_0x98bc('0x17')]]);}}break;default:break;}}catch(_0x4e4041){utils[_0x98bc('0x11')](util['format'](_0x98bc('0x16'),members[_0x9e91ac['device']]?members[_0x9e91ac[_0x98bc('0x17')]][_0x98bc('0x12')]:_0x9e91ac[_0x98bc('0x17')]),_0x4e4041);}};exports[_0x98bc('0x21')]=function(_0x3ac950){try{if(!_[_0x98bc('0x22')](members[_0x3ac950[_0x98bc('0x5')]])){utils[_0x98bc('0x23')](util[_0x98bc('0x3')]('[%s][members][agentcomplete]',_0x3ac950[_0x98bc('0x12')]),_0x3ac950);utils[_0x98bc('0x24')](util[_0x98bc('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3ac950[_0x98bc('0x12')],_0x3ac950[_0x98bc('0x5')],_0x3ac950[_0x98bc('0x25')]));members[_0x3ac950['interface']]=_[_0x98bc('0x26')](members[_0x3ac950['interface']],{'data4':_0x3ac950[_0x98bc('0x25')],'uniqueid':_0x3ac950['uniqueid']});}}catch(_0xeffeb){utils[_0x98bc('0x11')](util['format']('[%s][members][agentcomplete]',_0x3ac950[_0x98bc('0x12')]),_0xeffeb);}};exports[_0x98bc('0x27')]=function(_0x27f3c9){try{utils[_0x98bc('0x23')](util[_0x98bc('0x3')](_0x98bc('0x28'),_0x27f3c9[_0x98bc('0x12')]),_0x27f3c9);if(_0x27f3c9[_0x98bc('0x6')]){var _0x30d6c2=_0x27f3c9[_0x98bc('0x6')]['split']('-')[0x0];if(!_[_0x98bc('0x22')](members[_0x30d6c2])){members[_0x30d6c2]=_['assign'](members[_0x30d6c2],{'data1':members[_0x30d6c2][_0x98bc('0x29')]||_0x27f3c9[_0x98bc('0x9')],'data2':members[_0x30d6c2][_0x98bc('0x7')]||_0x27f3c9[_0x98bc('0x2a')],'data3':members[_0x30d6c2][_0x98bc('0x2b')]||_0x27f3c9['destination'],'uniqueid':members[_0x30d6c2][_0x98bc('0x12')]||_0x27f3c9[_0x98bc('0x12')]});utils[_0x98bc('0x24')](util[_0x98bc('0x3')](_0x98bc('0x2c'),_0x27f3c9[_0x98bc('0x12')],members[_0x30d6c2]['data1'],members[_0x30d6c2][_0x98bc('0x7')],members[_0x30d6c2]['data3']));if(members[_0x30d6c2]['exitAt']){writeDB(members[_0x30d6c2]);}}}if(_0x27f3c9[_0x98bc('0x2d')]){var _0x381c13=_0x27f3c9['destinationchannel'][_0x98bc('0xf')]('-')[0x0];if(!_[_0x98bc('0x22')](members[_0x381c13])){members[_0x381c13]=_[_0x98bc('0x26')](members[_0x381c13],{'data1':members[_0x381c13][_0x98bc('0x29')]||_0x27f3c9[_0x98bc('0x9')],'data2':members[_0x381c13][_0x98bc('0x7')]||_0x27f3c9[_0x98bc('0x2a')],'data3':members[_0x381c13][_0x98bc('0x2b')]||_0x27f3c9[_0x98bc('0x2e')],'uniqueid':members[_0x381c13][_0x98bc('0x12')]||_0x27f3c9[_0x98bc('0x12')]});utils[_0x98bc('0x24')](util[_0x98bc('0x3')](_0x98bc('0x2c'),_0x27f3c9[_0x98bc('0x12')],members[_0x381c13][_0x98bc('0x29')],members[_0x381c13][_0x98bc('0x7')],members[_0x381c13][_0x98bc('0x2b')]));if(members[_0x381c13]['exitAt']){writeDB(members[_0x381c13]);}}}}catch(_0x10c354){utils[_0x98bc('0x11')](util[_0x98bc('0x3')](_0x98bc('0x28'),_0x27f3c9['uniqueid']),_0x10c354);}}; \ No newline at end of file +var _0xcc8d=['startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','exitAt','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','cdr','isNil','assign','data1','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','source','util','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','[%s][members][writeDB]','some'];(function(_0x4f33cb,_0x46c73d){var _0x2b2dbd=function(_0x2e4abf){while(--_0x2e4abf){_0x4f33cb['push'](_0x4f33cb['shift']());}};_0x2b2dbd(++_0x46c73d);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0xcc8d[_0x2d9e27];return _0xd35381;};'use strict';var _=require('lodash');var util=require(_0xdcc8('0x0'));var utils=require(_0xdcc8('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0xdc9cc2){utils[_0xdcc8('0x2')](util[_0xdcc8('0x3')](_0xdcc8('0x4'),_0xdc9cc2[_0xdcc8('0x5')],_0xdc9cc2[_0xdcc8('0x6')],_0xdc9cc2[_0xdcc8('0x7')],_0xdc9cc2['data2'],_0xdc9cc2[_0xdcc8('0x8')],_0xdc9cc2[_0xdcc8('0x9')]));if(_0xdc9cc2[_0xdcc8('0x6')]){utils[_0xdcc8('0xa')](_0xdc9cc2[_0xdcc8('0x6')])['then'](function(_0x2bdaff){if(_0x2bdaff){_0xdc9cc2[_0xdcc8('0x8')]=_0x2bdaff[_0xdcc8('0xb')];_0xdc9cc2[_0xdcc8('0xc')]=_0x2bdaff[_0xdcc8('0xc')];utils[_0xdcc8('0xd')](_0xdcc8('0xe'),_0xdc9cc2);}else{utils[_0xdcc8('0xf')](_0xdc9cc2[_0xdcc8('0x6')][_0xdcc8('0x10')]('/')[0x1])[_0xdcc8('0x11')](function(_0x312dd7){if(_0x312dd7){_0xdc9cc2['membername']=_0x312dd7[_0xdcc8('0xb')];_0xdc9cc2[_0xdcc8('0xc')]=_0x312dd7['internal'];utils[_0xdcc8('0xd')](_0xdcc8('0xe'),_0xdc9cc2);}});}})[_0xdcc8('0x12')](function(_0x378a27){utils['error'](util[_0xdcc8('0x3')](_0xdcc8('0x13'),_0xdc9cc2['uniqueid']),_0x378a27);});}delete members[_0xdc9cc2[_0xdcc8('0x6')]];}function startsWith(_0x54541f,_0x5f599){return _[_0xdcc8('0x14')](_0x54541f,function(_0xc04807){return _[_0xdcc8('0x15')](_0x5f599,_0xc04807);});}exports[_0xdcc8('0x16')]=function(_0x12ace8){try{utils[_0xdcc8('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x12ace8['device']]?members[_0x12ace8['device']]['uniqueid']:_0x12ace8[_0xdcc8('0x18')]),_0x12ace8);utils['info'](util[_0xdcc8('0x3')](_0xdcc8('0x19'),members[_0x12ace8[_0xdcc8('0x18')]]?members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x5')]:_0x12ace8['device'],_0x12ace8['state'],_0x12ace8[_0xdcc8('0x18')]));switch(_0x12ace8[_0xdcc8('0x1a')]){case _0xdcc8('0x1b'):case _0xdcc8('0x1c'):if(!startsWith(exclude,_0x12ace8[_0xdcc8('0x18')])){members[_0x12ace8[_0xdcc8('0x18')]]={'channel':_0xdcc8('0x1d'),'interface':_0x12ace8[_0xdcc8('0x18')],'type':_0xdcc8('0x1e'),'enterAt':utils[_0xdcc8('0x1f')](),'role':_0xdcc8('0x20')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x12ace8['device']])){members[_0x12ace8['device']][_0xdcc8('0x21')]=utils[_0xdcc8('0x1f')]();members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x22')]=utils[_0xdcc8('0x23')](members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x21')],members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x24')]);if(members[_0x12ace8[_0xdcc8('0x18')]]['uniqueid']){writeDB(members[_0x12ace8[_0xdcc8('0x18')]]);}}break;default:break;}}catch(_0x938201){utils[_0xdcc8('0x25')](util['format'](_0xdcc8('0x26'),members[_0x12ace8['device']]?members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x5')]:_0x12ace8[_0xdcc8('0x18')]),_0x938201);}};exports[_0xdcc8('0x27')]=function(_0x16c40c){try{if(!_['isNil'](members[_0x16c40c[_0xdcc8('0x6')]])){utils[_0xdcc8('0x17')](util[_0xdcc8('0x3')](_0xdcc8('0x28'),_0x16c40c['uniqueid']),_0x16c40c);utils['info'](util[_0xdcc8('0x3')](_0xdcc8('0x29'),_0x16c40c['uniqueid'],_0x16c40c[_0xdcc8('0x6')],_0x16c40c['queue']));members[_0x16c40c[_0xdcc8('0x6')]]=_['assign'](members[_0x16c40c[_0xdcc8('0x6')]],{'data4':_0x16c40c['queue'],'uniqueid':_0x16c40c[_0xdcc8('0x5')]});}}catch(_0x12e101){utils[_0xdcc8('0x25')](util['format'](_0xdcc8('0x28'),_0x16c40c['uniqueid']),_0x12e101);}};exports[_0xdcc8('0x2a')]=function(_0x262e07){try{utils['debug'](util['format']('[%s][members][cdr]',_0x262e07[_0xdcc8('0x5')]),_0x262e07);if(_0x262e07[_0xdcc8('0x7')]){var _0x2e506a=_0x262e07[_0xdcc8('0x7')][_0xdcc8('0x10')]('-')[0x0];if(!_[_0xdcc8('0x2b')](members[_0x2e506a])){members[_0x2e506a]=_[_0xdcc8('0x2c')](members[_0x2e506a],{'data1':members[_0x2e506a][_0xdcc8('0x2d')]||_0x262e07['type'],'data2':members[_0x2e506a][_0xdcc8('0x2e')]||_0x262e07['source'],'data3':members[_0x2e506a]['data3']||_0x262e07[_0xdcc8('0x2f')],'uniqueid':members[_0x2e506a][_0xdcc8('0x5')]||_0x262e07['uniqueid']});utils[_0xdcc8('0x2')](util['format'](_0xdcc8('0x30'),_0x262e07[_0xdcc8('0x5')],members[_0x2e506a][_0xdcc8('0x2d')],members[_0x2e506a][_0xdcc8('0x2e')],members[_0x2e506a][_0xdcc8('0x31')]));if(members[_0x2e506a]['exitAt']){writeDB(members[_0x2e506a]);}}}if(_0x262e07[_0xdcc8('0x32')]){var _0x4bf1b0=_0x262e07[_0xdcc8('0x32')]['split']('-')[0x0];if(!_[_0xdcc8('0x2b')](members[_0x4bf1b0])){members[_0x4bf1b0]=_[_0xdcc8('0x2c')](members[_0x4bf1b0],{'data1':members[_0x4bf1b0][_0xdcc8('0x2d')]||_0x262e07[_0xdcc8('0x9')],'data2':members[_0x4bf1b0]['data2']||_0x262e07[_0xdcc8('0x33')],'data3':members[_0x4bf1b0][_0xdcc8('0x31')]||_0x262e07[_0xdcc8('0x2f')],'uniqueid':members[_0x4bf1b0][_0xdcc8('0x5')]||_0x262e07['uniqueid']});utils[_0xdcc8('0x2')](util['format'](_0xdcc8('0x30'),_0x262e07[_0xdcc8('0x5')],members[_0x4bf1b0][_0xdcc8('0x2d')],members[_0x4bf1b0]['data2'],members[_0x4bf1b0][_0xdcc8('0x31')]));if(members[_0x4bf1b0]['exitAt']){writeDB(members[_0x4bf1b0]);}}}}catch(_0x1c2c10){utils[_0xdcc8('0x25')](util[_0xdcc8('0x3')]('[%s][members][cdr]',_0x262e07[_0xdcc8('0x5')]),_0x1c2c10);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 00fb0a7..962e48c 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 _0xd246=['transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','queuecallerexitreason','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','format','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%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','connectedlinename','holdtime','diffTime','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','origtransfererlinkedid'];(function(_0x43b8b4,_0x352081){var _0x58affb=function(_0x56ff10){while(--_0x56ff10){_0x43b8b4['push'](_0x43b8b4['shift']());}};_0x58affb(++_0x352081);}(_0xd246,0x1ab));var _0x6d24=function(_0x5ec09a,_0x35b386){_0x5ec09a=_0x5ec09a-0x0;var _0x1f3c39=_0xd246[_0x5ec09a];return _0x1f3c39;};'use strict';var _=require(_0x6d24('0x0'));var util=require('util');var utils=require(_0x6d24('0x1'));var queues={};function writeDB(_0x354a44){utils[_0x6d24('0x2')](util['format'](_0x6d24('0x3'),_0x354a44['uniqueid'],_0x354a44[_0x6d24('0x4')],_0x354a44[_0x6d24('0x5')],_0x354a44[_0x6d24('0x6')],_0x354a44['calleridnum'],_0x354a44['accountcode'],_0x354a44[_0x6d24('0x7')]));if(_0x354a44['queue']){utils['getVoiceQueueByName'](_0x354a44[_0x6d24('0x5')])['then'](function(_0x2cb514){if(_0x2cb514){_0x354a44['type']=_0x2cb514['type'];}utils[_0x6d24('0x8')](_0x6d24('0x9'),_0x354a44);});}else{utils[_0x6d24('0x8')](_0x6d24('0x9'),_0x354a44);}if(_0x354a44[_0x6d24('0xa')]){delete queues[_0x354a44[_0x6d24('0xa')]];}else{delete queues[_0x354a44[_0x6d24('0xb')]];}}exports[_0x6d24('0xc')]=function(_0x19e138){try{utils['debug'](util[_0x6d24('0xd')]('[%s][queues][queuecallerjoin]',_0x19e138[_0x6d24('0xb')]),_0x19e138);utils[_0x6d24('0x2')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x19e138[_0x6d24('0xb')],_0x19e138[_0x6d24('0x5')],_0x19e138[_0x6d24('0xe')]));queues[_0x19e138[_0x6d24('0xb')]]=_[_0x6d24('0xf')](_0x19e138,{'originalposition':_0x19e138[_0x6d24('0xe')],'queuecallerjoinAt':utils[_0x6d24('0x10')](),'mohtime':0x0});}catch(_0x153ce3){utils[_0x6d24('0x11')](util[_0x6d24('0xd')](_0x6d24('0x12'),_0x19e138[_0x6d24('0xb')]),_0x153ce3);}};exports[_0x6d24('0x13')]=function(_0x52df65){try{if(!_[_0x6d24('0x14')](queues[_0x52df65[_0x6d24('0xb')]])){utils[_0x6d24('0x15')](util[_0x6d24('0xd')](_0x6d24('0x16'),_0x52df65['uniqueid']),_0x52df65);if(queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0x17')]){if(!queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0x18')]&&!queues[_0x52df65[_0x6d24('0xb')]]['queuecallerexit']){queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0x19')]=!![];queues[_0x52df65[_0x6d24('0xb')]]['queuecallercompleteAt']=utils['now']();queues[_0x52df65['uniqueid']][_0x6d24('0x7')]='COMPLETEDBYAGENT';}utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x1a'),_0x52df65[_0x6d24('0xb')],queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0x1b')],queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0x7')]));writeDB(queues[_0x52df65[_0x6d24('0xb')]]);}else if(queues[_0x52df65['uniqueid']][_0x6d24('0xa')]){utils[_0x6d24('0x2')](util['format'](_0x6d24('0x1c'),_0x52df65[_0x6d24('0xb')],queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0x1b')],queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0xa')]));queues[queues[_0x52df65[_0x6d24('0xb')]][_0x6d24('0xa')]]=queues[_0x52df65[_0x6d24('0xb')]];queues[queues[_0x52df65[_0x6d24('0xb')]]['transfereduniqueid']][_0x6d24('0x1d')]=0x2;delete queues[_0x52df65[_0x6d24('0xb')]];}}}catch(_0x498538){utils[_0x6d24('0x11')](util['format'](_0x6d24('0x16'),_0x52df65[_0x6d24('0xb')]),_0x498538);}};exports[_0x6d24('0x1e')]=function(_0x37ba71){try{utils['debug'](util[_0x6d24('0xd')]('[%s][queues][varset]',_0x37ba71[_0x6d24('0xb')]),_0x37ba71);if(!_['isNil'](_0x37ba71[_0x6d24('0x1f')][_0x6d24('0x20')])&&_0x37ba71[_0x6d24('0x21')]['toUpperCase']()!==_0x6d24('0x22')){if(!_[_0x6d24('0x14')](queues[_0x37ba71[_0x6d24('0xb')]])){queues[_0x37ba71[_0x6d24('0xb')]]['queuecallerabandon']=![];queues[_0x37ba71[_0x6d24('0xb')]]['queuecallerabandonAt']=null;queues[_0x37ba71[_0x6d24('0xb')]]['queuecallerexit']=!![];queues[_0x37ba71[_0x6d24('0xb')]][_0x6d24('0x23')]=utils[_0x6d24('0x10')]();queues[_0x37ba71[_0x6d24('0xb')]]['queuecallerexitreason']=_0x37ba71['value'][_0x6d24('0x24')]();utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x25'),_0x37ba71[_0x6d24('0xb')],queues[_0x37ba71[_0x6d24('0xb')]][_0x6d24('0x1b')],_0x37ba71[_0x6d24('0x21')],queues[_0x37ba71['uniqueid']][_0x6d24('0x7')]));writeDB(queues[_0x37ba71[_0x6d24('0xb')]]);}}else if(!_[_0x6d24('0x14')](_0x37ba71[_0x6d24('0x1f')][_0x6d24('0x26')])){if(!_[_0x6d24('0x14')](queues[_0x37ba71[_0x6d24('0xb')]])&&!queues[_0x37ba71[_0x6d24('0xb')]][_0x6d24('0x18')]){queues[_0x37ba71[_0x6d24('0xb')]]['queuecallerabandon']=![];queues[_0x37ba71['uniqueid']][_0x6d24('0x27')]=null;queues[_0x37ba71['uniqueid']][_0x6d24('0x28')]=!![];queues[_0x37ba71[_0x6d24('0xb')]]['queuecallerexitAt']=utils[_0x6d24('0x10')]();queues[_0x37ba71[_0x6d24('0xb')]][_0x6d24('0x7')]=_0x6d24('0x29');utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x2a'),_0x37ba71['uniqueid'],queues[_0x37ba71[_0x6d24('0xb')]][_0x6d24('0x1b')],_0x37ba71[_0x6d24('0x21')],queues[_0x37ba71[_0x6d24('0xb')]][_0x6d24('0x7')]));}}}catch(_0x4a2938){utils['error'](util[_0x6d24('0xd')](_0x6d24('0x2b'),_0x37ba71[_0x6d24('0xb')]),_0x4a2938);}};exports[_0x6d24('0x18')]=function(_0x5a68b2){try{if(!_[_0x6d24('0x14')](queues[_0x5a68b2['uniqueid']])){utils[_0x6d24('0x15')](util['format'](_0x6d24('0x2c'),_0x5a68b2['uniqueid']),_0x5a68b2);queues[_0x5a68b2[_0x6d24('0xb')]][_0x6d24('0x28')]=![];queues[_0x5a68b2[_0x6d24('0xb')]][_0x6d24('0x23')]=null;queues[_0x5a68b2['uniqueid']][_0x6d24('0x18')]=!![];queues[_0x5a68b2['uniqueid']][_0x6d24('0x27')]=utils['now']();queues[_0x5a68b2[_0x6d24('0xb')]][_0x6d24('0x7')]=_0x6d24('0x2d');utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x2e'),_0x5a68b2[_0x6d24('0xb')],queues[_0x5a68b2[_0x6d24('0xb')]][_0x6d24('0x1b')],queues[_0x5a68b2['uniqueid']][_0x6d24('0x7')]));}}catch(_0x33d24c){utils[_0x6d24('0x11')](util[_0x6d24('0xd')](_0x6d24('0x2c'),_0x5a68b2[_0x6d24('0xb')]),_0x33d24c);}};exports[_0x6d24('0x2f')]=function(_0x3c5fd0){try{if(!_[_0x6d24('0x14')](queues[_0x3c5fd0[_0x6d24('0xb')]])){utils['debug'](util[_0x6d24('0xd')](_0x6d24('0x30'),_0x3c5fd0['uniqueid']),_0x3c5fd0);utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x31'),_0x3c5fd0[_0x6d24('0xb')],queues[_0x3c5fd0[_0x6d24('0xb')]]['name'],_0x3c5fd0[_0x6d24('0x32')],_0x3c5fd0[_0x6d24('0x33')]));queues[_0x3c5fd0[_0x6d24('0xb')]][_0x6d24('0x2f')]=!![];queues[_0x3c5fd0['uniqueid']][_0x6d24('0x17')]=utils['now']();queues[_0x3c5fd0[_0x6d24('0xb')]][_0x6d24('0x34')]=utils[_0x6d24('0x35')](queues[_0x3c5fd0['uniqueid']]['queuecallerleaveAt'],queues[_0x3c5fd0[_0x6d24('0xb')]]['queuecallerjoinAt']);queues[_0x3c5fd0['uniqueid']][_0x6d24('0xe')]=_0x3c5fd0[_0x6d24('0xe')];queues[_0x3c5fd0['uniqueid']]['count']=_0x3c5fd0['count'];queues[_0x3c5fd0[_0x6d24('0xb')]][_0x6d24('0x32')]=_0x3c5fd0[_0x6d24('0x32')];queues[_0x3c5fd0[_0x6d24('0xb')]][_0x6d24('0x33')]=_0x3c5fd0[_0x6d24('0x33')];}}catch(_0x9663b0){utils[_0x6d24('0x11')](util[_0x6d24('0xd')]('[%s][queues][queuecallerleave]',_0x3c5fd0['uniqueid']),_0x9663b0);}};exports['agentconnect']=function(_0x1f99b8){try{if(!_[_0x6d24('0x14')](queues[_0x1f99b8['uniqueid']])){utils[_0x6d24('0x15')](util[_0x6d24('0xd')](_0x6d24('0x36'),_0x1f99b8[_0x6d24('0xb')]),_0x1f99b8);utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x37'),_0x1f99b8[_0x6d24('0xb')],queues[_0x1f99b8[_0x6d24('0xb')]][_0x6d24('0x1b')],_0x1f99b8[_0x6d24('0x38')],_0x1f99b8[_0x6d24('0x39')]));queues[_0x1f99b8[_0x6d24('0xb')]][_0x6d24('0x18')]=![];queues[_0x1f99b8['uniqueid']][_0x6d24('0x18')]=![];queues[_0x1f99b8[_0x6d24('0xb')]]['queuecallerabandonAt']=null;queues[_0x1f99b8[_0x6d24('0xb')]][_0x6d24('0x28')]=![];queues[_0x1f99b8[_0x6d24('0xb')]][_0x6d24('0x7')]=null;queues[_0x1f99b8['uniqueid']][_0x6d24('0x23')]=null;queues[_0x1f99b8[_0x6d24('0xb')]][_0x6d24('0x3a')]=!![];queues[_0x1f99b8['uniqueid']][_0x6d24('0x3b')]=_0x1f99b8[_0x6d24('0x39')];queues[_0x1f99b8[_0x6d24('0xb')]][_0x6d24('0x6')]=_0x1f99b8['membername'];}}catch(_0x2c1073){utils[_0x6d24('0x11')](util[_0x6d24('0xd')](_0x6d24('0x36'),_0x1f99b8[_0x6d24('0xb')]),_0x2c1073);}};exports[_0x6d24('0x3c')]=function(_0x4d1a41){try{if(!_[_0x6d24('0x14')](queues[_0x4d1a41[_0x6d24('0xb')]])){if(queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x17')]){utils['debug'](util[_0x6d24('0xd')](_0x6d24('0x3d'),_0x4d1a41[_0x6d24('0xb')]),_0x4d1a41);queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x18')]=![];queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x18')]=![];queues[_0x4d1a41['uniqueid']][_0x6d24('0x27')]=null;queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x28')]=![];queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x23')]=null;queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x3a')]=!![];queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x6')]=_0x4d1a41['membername'];queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x19')]=!![];queues[_0x4d1a41[_0x6d24('0xb')]]['queuecallercompleteAt']=utils[_0x6d24('0x10')]();if(_0x4d1a41[_0x6d24('0x3e')]=='transfer'){if(!queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x3f')]){queues[_0x4d1a41[_0x6d24('0xb')]][_0x6d24('0x7')]='TRANSFER';}}else{queues[_0x4d1a41['uniqueid']][_0x6d24('0x7')]=_0x6d24('0x40')+_0x4d1a41[_0x6d24('0x3e')]['toUpperCase']();}utils[_0x6d24('0x2')](util['format'](_0x6d24('0x41'),_0x4d1a41[_0x6d24('0xb')],queues[_0x4d1a41[_0x6d24('0xb')]]['name'],_0x4d1a41['membername'],queues[_0x4d1a41['uniqueid']][_0x6d24('0x7')]));writeDB(queues[_0x4d1a41[_0x6d24('0xb')]]);}}}catch(_0x13e567){utils[_0x6d24('0x11')](util[_0x6d24('0xd')](_0x6d24('0x3d'),_0x4d1a41[_0x6d24('0xb')]),_0x13e567);}};exports[_0x6d24('0x42')]=function(_0x237233){try{if(!_['isNil'](queues[_0x237233[_0x6d24('0x43')]])){utils[_0x6d24('0x15')](util['format'](_0x6d24('0x44'),_0x237233[_0x6d24('0xb')]),_0x237233);queues[_0x237233[_0x6d24('0x43')]]['transfer']=!![];queues[_0x237233['transfereeuniqueid']][_0x6d24('0x45')]='BLIND';queues[_0x237233[_0x6d24('0x43')]]['transferexten']=_0x237233[_0x6d24('0x46')];queues[_0x237233[_0x6d24('0x43')]][_0x6d24('0x47')]=_0x237233[_0x6d24('0x43')];queues[_0x237233[_0x6d24('0x43')]][_0x6d24('0x7')]=_0x6d24('0x48');utils['info'](util[_0x6d24('0xd')](_0x6d24('0x49'),_0x237233['uniqueid'],queues[_0x237233[_0x6d24('0x43')]][_0x6d24('0x1b')],_0x237233['transfereeuniqueid'],_0x237233['extension']));}}catch(_0x36734b){utils['error'](util[_0x6d24('0xd')](_0x6d24('0x44'),_0x237233[_0x6d24('0xb')]),_0x36734b);}};exports[_0x6d24('0x4a')]=function(_0x471283){try{utils['debug'](util['format'](_0x6d24('0x4b'),_0x471283[_0x6d24('0x4c')]),_0x471283);if(_0x471283[_0x6d24('0x4c')]==_0x471283['origtransfererlinkedid']){if(!_[_0x6d24('0x14')](queues[_0x471283[_0x6d24('0x4d')]])){utils[_0x6d24('0x2')](util['format'](_0x6d24('0x4e'),_0x471283[_0x6d24('0x4c')],queues[_0x471283['secondtransfererlinkedid']][_0x6d24('0x1b')],_0x471283[_0x6d24('0x4f')]));queues[_0x471283[_0x6d24('0x4d')]][_0x6d24('0x3f')]=!![];queues[_0x471283[_0x6d24('0x4d')]]['transfertype']=_0x6d24('0x50');queues[_0x471283['secondtransfererlinkedid']][_0x6d24('0x51')]=_0x471283[_0x6d24('0x4f')];queues[_0x471283['secondtransfererlinkedid']][_0x6d24('0x47')]=_0x471283[_0x6d24('0x4c')];queues[_0x471283[_0x6d24('0x4d')]][_0x6d24('0x7')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x471283[_0x6d24('0x52')]])){if(_0x471283['transfereelinkedid']&&queues[_0x471283[_0x6d24('0x53')]]){queues[_0x471283['transfereelinkedid']][_0x6d24('0x1d')]=0x1;queues[_0x471283['transfereeuniqueid']]=_[_0x6d24('0x54')](queues[_0x471283['transfereelinkedid']]);queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0xa')]=_0x471283[_0x6d24('0x55')];queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x1d')]=0x2;queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x56')]=queues[_0x471283[_0x6d24('0x4d')]][_0x6d24('0x56')];queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x57')]=queues[_0x471283[_0x6d24('0x4d')]][_0x6d24('0x57')];queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x58')]=utils[_0x6d24('0x10')]();queues[_0x471283['transfereeuniqueid']][_0x6d24('0x17')]=utils['now']();queues[_0x471283['transfereeuniqueid']][_0x6d24('0x34')]=0x0;queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x59')]=0x0;utils[_0x6d24('0x2')](util['format'](_0x6d24('0x5a'),_0x471283[_0x6d24('0x4c')],queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x1b')],queues[_0x471283[_0x6d24('0x43')]][_0x6d24('0x56')],queues[_0x471283['transfereeuniqueid']][_0x6d24('0x57')]));}else{utils[_0x6d24('0x2')](util['format'](_0x6d24('0x5b'),_0x471283['origtransfereruniqueid'],queues[_0x471283[_0x6d24('0x52')]][_0x6d24('0x1b')],_0x471283[_0x6d24('0x4d')]));queues[_0x471283[_0x6d24('0x52')]][_0x6d24('0xa')]=_0x471283[_0x6d24('0x4d')];}}}else if(_0x471283[_0x6d24('0x5c')]==_0x471283[_0x6d24('0x4d')]){if(!_['isNil'](queues[_0x471283[_0x6d24('0x52')]])){utils[_0x6d24('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x471283[_0x6d24('0x4c')],queues[_0x471283[_0x6d24('0x52')]]['name'],_0x471283[_0x6d24('0x5c')],_0x471283[_0x6d24('0x5d')]));queues[_0x471283[_0x6d24('0x52')]][_0x6d24('0x3f')]=!![];queues[_0x471283[_0x6d24('0x52')]]['transfertype']=_0x6d24('0x50');queues[_0x471283[_0x6d24('0x52')]][_0x6d24('0x51')]=_0x471283[_0x6d24('0x5d')];queues[_0x471283['origtransfererlinkedid']][_0x6d24('0x47')]=_0x471283[_0x6d24('0x5c')];queues[_0x471283['origtransfererlinkedid']][_0x6d24('0x7')]=_0x6d24('0x5e');}if(!_['isNil'](queues[_0x471283[_0x6d24('0x4d')]])){if(_0x471283[_0x6d24('0x5f')]&&queues[_0x471283['transfertargetlinkedid']]){queues[_0x471283['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x471283[_0x6d24('0x55')]]=_[_0x6d24('0x54')](queues[_0x471283[_0x6d24('0x5f')]]);queues[_0x471283['transfertargetuniqueid']][_0x6d24('0xa')]=_0x471283['transfertargetuniqueid'];queues[_0x471283[_0x6d24('0x55')]]['queuecallerenterreason']=0x2;queues[_0x471283[_0x6d24('0x55')]][_0x6d24('0x56')]=queues[_0x471283[_0x6d24('0x52')]]['calleridnum'];queues[_0x471283[_0x6d24('0x55')]]['calleridname']=queues[_0x471283[_0x6d24('0x52')]][_0x6d24('0x57')];queues[_0x471283[_0x6d24('0x55')]][_0x6d24('0x58')]=utils[_0x6d24('0x10')]();queues[_0x471283[_0x6d24('0x55')]][_0x6d24('0x17')]=utils[_0x6d24('0x10')]();queues[_0x471283[_0x6d24('0x55')]][_0x6d24('0x34')]=0x0;queues[_0x471283['transfertargetuniqueid']][_0x6d24('0x59')]=0x0;utils['info'](util[_0x6d24('0xd')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x471283[_0x6d24('0x4c')],queues[_0x471283[_0x6d24('0x55')]]['name'],queues[_0x471283['transfertargetuniqueid']][_0x6d24('0xa')],queues[_0x471283['transfertargetuniqueid']][_0x6d24('0x56')],queues[_0x471283[_0x6d24('0x55')]][_0x6d24('0x57')]));}else{utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x5b'),_0x471283[_0x6d24('0x4c')],queues[_0x471283['secondtransfererlinkedid']][_0x6d24('0x1b')],_0x471283['origtransfererlinkedid']));queues[_0x471283[_0x6d24('0x4d')]][_0x6d24('0xa')]=_0x471283[_0x6d24('0x52')];}}}}catch(_0xb55e8a){utils[_0x6d24('0x11')](util[_0x6d24('0xd')](_0x6d24('0x4b'),_0x471283[_0x6d24('0x4c')]),_0xb55e8a);}};exports['musiconholdstart']=function(_0x31464c){try{if(!_[_0x6d24('0x14')](queues[_0x31464c[_0x6d24('0xb')]])){utils[_0x6d24('0x15')](util[_0x6d24('0xd')](_0x6d24('0x60'),_0x31464c[_0x6d24('0xb')]),_0x31464c);queues[_0x31464c['uniqueid']][_0x6d24('0x61')]=utils[_0x6d24('0x10')]();utils[_0x6d24('0x2')](util[_0x6d24('0xd')](_0x6d24('0x62'),_0x31464c[_0x6d24('0xb')],queues[_0x31464c[_0x6d24('0xb')]][_0x6d24('0x1b')],queues[_0x31464c[_0x6d24('0xb')]]['musiconholdstartAt']));}}catch(_0x39646e){utils['error'](util[_0x6d24('0xd')](_0x6d24('0x60'),_0x31464c[_0x6d24('0xb')]),_0x39646e);}};exports[_0x6d24('0x63')]=function(_0x4013a2){try{if(!_[_0x6d24('0x14')](queues[_0x4013a2[_0x6d24('0xb')]])){if(!_['isNil'](queues[_0x4013a2[_0x6d24('0xb')]]['musiconholdstartAt'])){utils[_0x6d24('0x15')](util[_0x6d24('0xd')](_0x6d24('0x64'),_0x4013a2[_0x6d24('0xb')]),_0x4013a2);queues[_0x4013a2[_0x6d24('0xb')]]['mohtime']+=utils[_0x6d24('0x35')](utils['now'](),queues[_0x4013a2[_0x6d24('0xb')]][_0x6d24('0x61')]);utils[_0x6d24('0x2')](util['format'](_0x6d24('0x65'),_0x4013a2[_0x6d24('0xb')],queues[_0x4013a2[_0x6d24('0xb')]][_0x6d24('0x1b')],queues[_0x4013a2[_0x6d24('0xb')]]['mohtime']));delete queues[_0x4013a2[_0x6d24('0xb')]][_0x6d24('0x61')];}}}catch(_0x1c2855){utils[_0x6d24('0x11')](util[_0x6d24('0xd')](_0x6d24('0x64'),_0x4013a2['uniqueid']),_0x1c2855);}}; \ No newline at end of file +var _0x9164=['[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','EXITWITHKEY','debug','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]'];(function(_0x5e62bc,_0x1d0f50){var _0x3de977=function(_0x54f435){while(--_0x54f435){_0x5e62bc['push'](_0x5e62bc['shift']());}};_0x3de977(++_0x1d0f50);}(_0x9164,0x175));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4916('0x0'));var util=require('util');var utils=require(_0x4916('0x1'));var queues={};function writeDB(_0x338ccf){utils['info'](util[_0x4916('0x2')](_0x4916('0x3'),_0x338ccf['uniqueid'],_0x338ccf['channel'],_0x338ccf[_0x4916('0x4')],_0x338ccf[_0x4916('0x5')],_0x338ccf[_0x4916('0x6')],_0x338ccf[_0x4916('0x7')],_0x338ccf['queuecallerexitreason']));if(_0x338ccf[_0x4916('0x4')]){utils[_0x4916('0x8')](_0x338ccf[_0x4916('0x4')])[_0x4916('0x9')](function(_0x18f252){if(_0x18f252){_0x338ccf[_0x4916('0xa')]=_0x18f252['type'];}utils[_0x4916('0xb')](_0x4916('0xc'),_0x338ccf);});}else{utils[_0x4916('0xb')](_0x4916('0xc'),_0x338ccf);}if(_0x338ccf[_0x4916('0xd')]){delete queues[_0x338ccf[_0x4916('0xd')]];}else{delete queues[_0x338ccf[_0x4916('0xe')]];}}exports['queuecallerjoin']=function(_0x105e7e){try{utils['debug'](util[_0x4916('0x2')](_0x4916('0xf'),_0x105e7e[_0x4916('0xe')]),_0x105e7e);utils['info'](util['format'](_0x4916('0x10'),_0x105e7e[_0x4916('0xe')],_0x105e7e['queue'],_0x105e7e[_0x4916('0x11')]));queues[_0x105e7e['uniqueid']]=_[_0x4916('0x12')](_0x105e7e,{'originalposition':_0x105e7e[_0x4916('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x225805){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0xf'),_0x105e7e[_0x4916('0xe')]),_0x225805);}};exports[_0x4916('0x14')]=function(_0x1a26b5){try{if(!_['isNil'](queues[_0x1a26b5[_0x4916('0xe')]])){utils['debug'](util[_0x4916('0x2')]('[%s][queues][hangup]',_0x1a26b5[_0x4916('0xe')]),_0x1a26b5);if(queues[_0x1a26b5['uniqueid']][_0x4916('0x15')]){if(!queues[_0x1a26b5[_0x4916('0xe')]]['queuecallerabandon']&&!queues[_0x1a26b5['uniqueid']][_0x4916('0x16')]){queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0x17')]=!![];queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0x18')]=utils[_0x4916('0x19')]();queues[_0x1a26b5['uniqueid']][_0x4916('0x1a')]=_0x4916('0x1b');}utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x1d'),_0x1a26b5[_0x4916('0xe')],queues[_0x1a26b5[_0x4916('0xe')]]['name'],queues[_0x1a26b5[_0x4916('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x1a26b5[_0x4916('0xe')]]);}else if(queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0xd')]){utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x1e'),_0x1a26b5[_0x4916('0xe')],queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0x1f')],queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0xd')]));queues[queues[_0x1a26b5[_0x4916('0xe')]]['transfereduniqueid']]=queues[_0x1a26b5['uniqueid']];queues[queues[_0x1a26b5['uniqueid']][_0x4916('0xd')]][_0x4916('0x20')]=0x2;delete queues[_0x1a26b5[_0x4916('0xe')]];}}}catch(_0x17913f){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x21'),_0x1a26b5[_0x4916('0xe')]),_0x17913f);}};exports[_0x4916('0x22')]=function(_0x42acc5){try{utils['debug'](util['format'](_0x4916('0x23'),_0x42acc5[_0x4916('0xe')]),_0x42acc5);if(!_[_0x4916('0x24')](_0x42acc5[_0x4916('0x25')][_0x4916('0x26')])&&_0x42acc5[_0x4916('0x27')][_0x4916('0x28')]()!==_0x4916('0x29')){if(!_['isNil'](queues[_0x42acc5['uniqueid']])){queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2b')]=null;queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x16')]=!![];queues[_0x42acc5['uniqueid']]['queuecallerexitAt']=utils[_0x4916('0x19')]();queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x1a')]=_0x42acc5['value'][_0x4916('0x28')]();utils[_0x4916('0x1c')](util[_0x4916('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x42acc5[_0x4916('0xe')],queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x1f')],_0x42acc5[_0x4916('0x27')],queues[_0x42acc5['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x42acc5[_0x4916('0xe')]]);}}else if(!_['isNil'](_0x42acc5[_0x4916('0x25')]['queueposition'])){if(!_[_0x4916('0x24')](queues[_0x42acc5[_0x4916('0xe')]])&&!queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2a')]){queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x42acc5['uniqueid']][_0x4916('0x2b')]=null;queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x16')]=!![];queues[_0x42acc5['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x1a')]=_0x4916('0x2c');utils['info'](util[_0x4916('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x42acc5[_0x4916('0xe')],queues[_0x42acc5['uniqueid']][_0x4916('0x1f')],_0x42acc5[_0x4916('0x27')],queues[_0x42acc5[_0x4916('0xe')]]['queuecallerexitreason']));}}}catch(_0x47d970){utils['error'](util[_0x4916('0x2')](_0x4916('0x23'),_0x42acc5['uniqueid']),_0x47d970);}};exports['queuecallerabandon']=function(_0x47a731){try{if(!_[_0x4916('0x24')](queues[_0x47a731['uniqueid']])){utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x2e'),_0x47a731['uniqueid']),_0x47a731);queues[_0x47a731['uniqueid']]['queuecallerexit']=![];queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x2f')]=null;queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x2a')]=!![];queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x2b')]=utils[_0x4916('0x19')]();queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x1a')]=_0x4916('0x30');utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x31'),_0x47a731[_0x4916('0xe')],queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x1f')],queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x1a')]));}}catch(_0x477aad){utils['error'](util[_0x4916('0x2')](_0x4916('0x2e'),_0x47a731[_0x4916('0xe')]),_0x477aad);}};exports[_0x4916('0x32')]=function(_0x5671dd){try{if(!_['isNil'](queues[_0x5671dd[_0x4916('0xe')]])){utils['debug'](util[_0x4916('0x2')](_0x4916('0x33'),_0x5671dd[_0x4916('0xe')]),_0x5671dd);utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x34'),_0x5671dd[_0x4916('0xe')],queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x1f')],_0x5671dd[_0x4916('0x35')],_0x5671dd['connectedlinename']));queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x32')]=!![];queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x15')]=utils[_0x4916('0x19')]();queues[_0x5671dd[_0x4916('0xe')]]['holdtime']=utils[_0x4916('0x36')](queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x15')],queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x37')]);queues[_0x5671dd[_0x4916('0xe')]]['position']=_0x5671dd[_0x4916('0x11')];queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x38')]=_0x5671dd[_0x4916('0x38')];queues[_0x5671dd[_0x4916('0xe')]]['connectedlinenum']=_0x5671dd[_0x4916('0x35')];queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x39')]=_0x5671dd[_0x4916('0x39')];}}catch(_0x578645){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x33'),_0x5671dd[_0x4916('0xe')]),_0x578645);}};exports['agentconnect']=function(_0x44d05f){try{if(!_[_0x4916('0x24')](queues[_0x44d05f[_0x4916('0xe')]])){utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x3a'),_0x44d05f[_0x4916('0xe')]),_0x44d05f);utils[_0x4916('0x1c')](util['format'](_0x4916('0x3b'),_0x44d05f['uniqueid'],queues[_0x44d05f['uniqueid']]['name'],_0x44d05f[_0x4916('0x3c')],_0x44d05f[_0x4916('0x3d')]));queues[_0x44d05f[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x44d05f['uniqueid']][_0x4916('0x2a')]=![];queues[_0x44d05f[_0x4916('0xe')]]['queuecallerabandonAt']=null;queues[_0x44d05f[_0x4916('0xe')]][_0x4916('0x16')]=![];queues[_0x44d05f[_0x4916('0xe')]]['queuecallerexitreason']=null;queues[_0x44d05f['uniqueid']][_0x4916('0x2f')]=null;queues[_0x44d05f[_0x4916('0xe')]]['assigned']=!![];queues[_0x44d05f[_0x4916('0xe')]]['accountcode']=_0x44d05f['destaccountcode'];queues[_0x44d05f['uniqueid']][_0x4916('0x5')]=_0x44d05f[_0x4916('0x3c')];}}catch(_0x4cb367){utils['error'](util[_0x4916('0x2')](_0x4916('0x3a'),_0x44d05f[_0x4916('0xe')]),_0x4cb367);}};exports[_0x4916('0x3e')]=function(_0x157f3b){try{if(!_[_0x4916('0x24')](queues[_0x157f3b[_0x4916('0xe')]])){if(queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x15')]){utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x3f'),_0x157f3b['uniqueid']),_0x157f3b);queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x157f3b[_0x4916('0xe')]]['queuecallerabandon']=![];queues[_0x157f3b['uniqueid']][_0x4916('0x2b')]=null;queues[_0x157f3b[_0x4916('0xe')]]['queuecallerexit']=![];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x2f')]=null;queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x40')]=!![];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x5')]=_0x157f3b[_0x4916('0x3c')];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x17')]=!![];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x18')]=utils[_0x4916('0x19')]();if(_0x157f3b['reason']==_0x4916('0x41')){if(!queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x41')]){queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x1a')]=_0x4916('0x42');}}else{queues[_0x157f3b[_0x4916('0xe')]]['queuecallerexitreason']=_0x4916('0x43')+_0x157f3b[_0x4916('0x44')][_0x4916('0x28')]();}utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x45'),_0x157f3b[_0x4916('0xe')],queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x1f')],_0x157f3b['membername'],queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x1a')]));writeDB(queues[_0x157f3b[_0x4916('0xe')]]);}}}catch(_0x4da865){utils[_0x4916('0x13')](util['format'](_0x4916('0x3f'),_0x157f3b[_0x4916('0xe')]),_0x4da865);}};exports[_0x4916('0x46')]=function(_0x468751){try{if(!_[_0x4916('0x24')](queues[_0x468751[_0x4916('0x47')]])){utils[_0x4916('0x2d')](util[_0x4916('0x2')]('[%s][queues][blindtransfer]',_0x468751['uniqueid']),_0x468751);queues[_0x468751['transfereeuniqueid']]['transfer']=!![];queues[_0x468751[_0x4916('0x47')]]['transfertype']=_0x4916('0x48');queues[_0x468751['transfereeuniqueid']][_0x4916('0x49')]=_0x468751[_0x4916('0x4a')];queues[_0x468751['transfereeuniqueid']]['transferuniqueid']=_0x468751[_0x4916('0x47')];queues[_0x468751[_0x4916('0x47')]]['queuecallerexitreason']=_0x4916('0x4b');utils[_0x4916('0x1c')](util['format'](_0x4916('0x4c'),_0x468751[_0x4916('0xe')],queues[_0x468751[_0x4916('0x47')]][_0x4916('0x1f')],_0x468751[_0x4916('0x47')],_0x468751[_0x4916('0x4a')]));}}catch(_0x18d66e){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x4d'),_0x468751['uniqueid']),_0x18d66e);}};exports[_0x4916('0x4e')]=function(_0x825dbe){try{utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x4f'),_0x825dbe['origtransfereruniqueid']),_0x825dbe);if(_0x825dbe[_0x4916('0x50')]==_0x825dbe[_0x4916('0x51')]){if(!_[_0x4916('0x24')](queues[_0x825dbe['secondtransfererlinkedid']])){utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x52'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe['secondtransfererlinkedid']]['name'],_0x825dbe[_0x4916('0x53')]));queues[_0x825dbe['secondtransfererlinkedid']][_0x4916('0x41')]=!![];queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x55')]=_0x4916('0x56');queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x49')]=_0x825dbe['origtransfererexten'];queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x57')]=_0x825dbe[_0x4916('0x50')];queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x1a')]=_0x4916('0x58');}if(!_[_0x4916('0x24')](queues[_0x825dbe[_0x4916('0x51')]])){if(_0x825dbe['transfereelinkedid']&&queues[_0x825dbe[_0x4916('0x59')]]){queues[_0x825dbe[_0x4916('0x59')]][_0x4916('0x20')]=0x1;queues[_0x825dbe[_0x4916('0x47')]]=_[_0x4916('0x5a')](queues[_0x825dbe[_0x4916('0x59')]]);queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0xd')]=_0x825dbe[_0x4916('0x5b')];queues[_0x825dbe['transfereeuniqueid']][_0x4916('0x20')]=0x2;queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0x6')]=queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x6')];queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0x5c')]=queues[_0x825dbe['secondtransfererlinkedid']][_0x4916('0x5c')];queues[_0x825dbe['transfereeuniqueid']][_0x4916('0x37')]=utils['now']();queues[_0x825dbe[_0x4916('0x47')]]['queuecallerleaveAt']=utils[_0x4916('0x19')]();queues[_0x825dbe['transfereeuniqueid']][_0x4916('0x5d')]=0x0;queues[_0x825dbe['transfereeuniqueid']]['mohtime']=0x0;utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x5e'),_0x825dbe['origtransfereruniqueid'],queues[_0x825dbe[_0x4916('0x47')]]['name'],queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0x6')],queues[_0x825dbe['transfereeuniqueid']]['calleridname']));}else{utils[_0x4916('0x1c')](util[_0x4916('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x825dbe[_0x4916('0x50')],queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x1f')],_0x825dbe[_0x4916('0x54')]));queues[_0x825dbe['origtransfererlinkedid']][_0x4916('0xd')]=_0x825dbe[_0x4916('0x54')];}}}else if(_0x825dbe[_0x4916('0x5f')]==_0x825dbe[_0x4916('0x54')]){if(!_[_0x4916('0x24')](queues[_0x825dbe[_0x4916('0x51')]])){utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x60'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe['origtransfererlinkedid']][_0x4916('0x1f')],_0x825dbe[_0x4916('0x5f')],_0x825dbe[_0x4916('0x61')]));queues[_0x825dbe[_0x4916('0x51')]]['transfer']=!![];queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x55')]=_0x4916('0x56');queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x49')]=_0x825dbe[_0x4916('0x61')];queues[_0x825dbe['origtransfererlinkedid']]['transferuniqueid']=_0x825dbe['secondtransfereruniqueid'];queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x1a')]=_0x4916('0x58');}if(!_[_0x4916('0x24')](queues[_0x825dbe[_0x4916('0x54')]])){if(_0x825dbe[_0x4916('0x62')]&&queues[_0x825dbe['transfertargetlinkedid']]){queues[_0x825dbe['transfertargetlinkedid']][_0x4916('0x20')]=0x1;queues[_0x825dbe['transfertargetuniqueid']]=_[_0x4916('0x5a')](queues[_0x825dbe['transfertargetlinkedid']]);queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0xd')]=_0x825dbe['transfertargetuniqueid'];queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x20')]=0x2;queues[_0x825dbe['transfertargetuniqueid']]['calleridnum']=queues[_0x825dbe['origtransfererlinkedid']]['calleridnum'];queues[_0x825dbe[_0x4916('0x5b')]]['calleridname']=queues[_0x825dbe['origtransfererlinkedid']][_0x4916('0x5c')];queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x37')]=utils[_0x4916('0x19')]();queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x15')]=utils[_0x4916('0x19')]();queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x5d')]=0x0;queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x63')]=0x0;utils['info'](util['format'](_0x4916('0x64'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x1f')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0xd')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x6')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x5c')]));}else{utils['info'](util[_0x4916('0x2')](_0x4916('0x65'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x1f')],_0x825dbe[_0x4916('0x51')]));queues[_0x825dbe[_0x4916('0x54')]]['transfereduniqueid']=_0x825dbe[_0x4916('0x51')];}}}}catch(_0x4b9541){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x4f'),_0x825dbe[_0x4916('0x50')]),_0x4b9541);}};exports['musiconholdstart']=function(_0x1d1d9e){try{if(!_[_0x4916('0x24')](queues[_0x1d1d9e[_0x4916('0xe')]])){utils['debug'](util[_0x4916('0x2')](_0x4916('0x66'),_0x1d1d9e[_0x4916('0xe')]),_0x1d1d9e);queues[_0x1d1d9e[_0x4916('0xe')]][_0x4916('0x67')]=utils[_0x4916('0x19')]();utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x68'),_0x1d1d9e['uniqueid'],queues[_0x1d1d9e['uniqueid']][_0x4916('0x1f')],queues[_0x1d1d9e['uniqueid']][_0x4916('0x67')]));}}catch(_0x26b950){utils['error'](util[_0x4916('0x2')](_0x4916('0x66'),_0x1d1d9e['uniqueid']),_0x26b950);}};exports[_0x4916('0x69')]=function(_0x97a81e){try{if(!_[_0x4916('0x24')](queues[_0x97a81e[_0x4916('0xe')]])){if(!_[_0x4916('0x24')](queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x67')])){utils['debug'](util['format'](_0x4916('0x6a'),_0x97a81e[_0x4916('0xe')]),_0x97a81e);queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x63')]+=utils[_0x4916('0x36')](utils['now'](),queues[_0x97a81e['uniqueid']]['musiconholdstartAt']);utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x6b'),_0x97a81e[_0x4916('0xe')],queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x1f')],queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x63')]));delete queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x67')];}}}catch(_0xca8dd0){utils[_0x4916('0x13')](util[_0x4916('0x2')]('[%s][queues][musiconholdstop]',_0x97a81e[_0x4916('0xe')]),_0xca8dd0);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8f6af0c..9c0b026 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 _0x3554=['[%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','./utils','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3554,0x1db));var _0x4355=function(_0x396ca2,_0x2f9ac4){_0x396ca2=_0x396ca2-0x0;var _0x289e0c=_0x3554[_0x396ca2];return _0x289e0c;};'use strict';var _=require(_0x4355('0x0'));var util=require(_0x4355('0x1'));var utils=require(_0x4355('0x2'));var recordings={};function writeDB(_0x106073){utils['info'](util['format'](_0x4355('0x3'),_0x106073['uniqueid']));if(_0x106073[_0x4355('0x4')]){utils[_0x4355('0x5')](_0x106073[_0x4355('0x4')])[_0x4355('0x6')](function(_0x3a3e65){if(_0x3a3e65){_0x106073[_0x4355('0x7')]=_0x3a3e65[_0x4355('0x8')];_0x106073[_0x4355('0x9')]=_0x3a3e65['id'];}utils[_0x4355('0xa')]('CreateVoiceRecording',_0x106073);});}else{utils['request'](_0x4355('0xb'),_0x106073);}}exports[_0x4355('0xc')]=function(_0xd1fee){try{utils[_0x4355('0xd')](util[_0x4355('0xe')](_0x4355('0xf'),_0xd1fee[_0x4355('0x10')]),_0xd1fee);if(_0xd1fee[_0x4355('0x10')]==_0xd1fee[_0x4355('0x11')]){utils[_0x4355('0x12')](util['format'](_0x4355('0x13'),_0xd1fee[_0x4355('0x10')],_0xd1fee[_0x4355('0x14')],_0xd1fee[_0x4355('0x15')]));recordings[_0xd1fee[_0x4355('0x10')]]={'uniqueid':_0xd1fee[_0x4355('0x10')],'accountcode':_0xd1fee[_0x4355('0x4')],'exten':_0xd1fee[_0x4355('0x15')],'context':_0xd1fee[_0x4355('0x14')],'channel':_0xd1fee[_0x4355('0x16')],'monitors':[]};}}catch(_0x333f8b){utils[_0x4355('0x17')](util[_0x4355('0xe')]('[%s][recordings][newchannel]',_0xd1fee[_0x4355('0x10')]),_0x333f8b);}};exports['newstate']=function(_0x216a20){try{utils[_0x4355('0xd')](util[_0x4355('0xe')](_0x4355('0x18'),_0x216a20[_0x4355('0x10')]),_0x216a20);if(!_[_0x4355('0x19')](recordings[_0x216a20['uniqueid']])&&_0x216a20[_0x4355('0x1a')]==0x6){utils[_0x4355('0x12')](util[_0x4355('0xe')](_0x4355('0x1b'),_0x216a20[_0x4355('0x10')],_0x216a20[_0x4355('0x14')],_0x216a20[_0x4355('0x16')]));}else if(!_[_0x4355('0x19')](recordings[_0x216a20[_0x4355('0x11')]])&&_0x216a20[_0x4355('0x1a')]==0x6&&_0x216a20[_0x4355('0x14')]!='transfer'){utils[_0x4355('0x12')](util['format'](_0x4355('0x1c'),_0x216a20[_0x4355('0x10')],_0x216a20[_0x4355('0x11')],_0x216a20[_0x4355('0x14')],_0x216a20[_0x4355('0x16')]));recordings[_0x216a20['linkedid']]['accountcode']=_0x216a20['accountcode'];}}catch(_0x17f867){utils[_0x4355('0x17')](util[_0x4355('0xe')](_0x4355('0x18'),_0x216a20[_0x4355('0x10')]),_0x17f867);}};exports[_0x4355('0x1d')]=function(_0x39edf4){try{if(!_['isNil'](_0x39edf4[_0x4355('0x1e')])&&!_[_0x4355('0x19')](_0x39edf4[_0x4355('0x1e')][_0x4355('0x1f')])){utils[_0x4355('0xd')](util[_0x4355('0xe')](_0x4355('0x20'),_0x39edf4['uniqueid']),_0x39edf4);utils[_0x4355('0x12')](util[_0x4355('0xe')](_0x4355('0x21'),_0x39edf4[_0x4355('0x10')],_0x39edf4[_0x4355('0x1e')],_0x39edf4['value']));if(_[_0x4355('0x22')](_0x39edf4[_0x4355('0x23')],_0x4355('0x24'))){_0x39edf4[_0x4355('0x23')]=_0x39edf4[_0x4355('0x23')][_0x4355('0x25')](_0x4355('0x24'),_0x4355('0x26'));}if(recordings[_0x39edf4['linkedid']]){var _0x4c9dcf=_[_0x4355('0x27')](recordings[_0x39edf4[_0x4355('0x11')]][_0x4355('0x28')],{'value':_0x39edf4[_0x4355('0x23')]});if(_[_0x4355('0x19')](_0x4c9dcf)){recordings[_0x39edf4[_0x4355('0x11')]][_0x4355('0x28')][_0x4355('0x29')]({'value':_0x39edf4[_0x4355('0x23')]});}}}}catch(_0x21802c){utils[_0x4355('0x17')](util[_0x4355('0xe')]('[%s][recordings][varset]',_0x39edf4['uniqueid']),_0x21802c);}};exports[_0x4355('0x2a')]=function(_0x56cf9e){try{if(!_[_0x4355('0x19')](recordings[_0x56cf9e['uniqueid']])){utils[_0x4355('0xd')](util[_0x4355('0xe')](_0x4355('0x2b'),_0x56cf9e['uniqueid']),_0x56cf9e);utils[_0x4355('0x12')](util['format'](_0x4355('0x2c'),_0x56cf9e[_0x4355('0x10')],_0x56cf9e['calleridnum'],_0x56cf9e[_0x4355('0x2d')],_0x56cf9e[_0x4355('0x2e')]));recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x2f')]=_0x56cf9e['calleridnum'];recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x2d')]=_0x56cf9e['calleridname'];recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x30')]=_0x56cf9e['connectedlinenum'];recordings[_0x56cf9e['uniqueid']][_0x4355('0x31')]=_0x56cf9e[_0x4355('0x31')];if(recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x32')]==_0x4355('0x33')&&recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x4')]){recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x30')]=recordings[_0x56cf9e[_0x4355('0x10')]]['accountcode'];recordings[_0x56cf9e[_0x4355('0x10')]][_0x4355('0x31')]='';}recordings[_0x56cf9e['uniqueid']][_0x4355('0x28')][_0x4355('0x34')](function(_0x47ec07){var _0x59f230=_['clone'](recordings[_0x56cf9e[_0x4355('0x10')]]);_0x59f230[_0x4355('0x23')]=_0x47ec07[_0x4355('0x23')];writeDB(_0x59f230);});delete recordings[_0x56cf9e[_0x4355('0x10')]];}}catch(_0x4e8e0a){utils['error'](util[_0x4355('0xe')](_0x4355('0x2b'),_0x56cf9e[_0x4355('0x10')]),_0x4e8e0a);}};exports['newexten']=function(_0x288429){try{if(!_[_0x4355('0x19')](recordings[_0x288429['uniqueid']])){utils[_0x4355('0xd')](util[_0x4355('0xe')]('[%s][recordings][newexten]',_0x288429[_0x4355('0x10')]),_0x288429);utils[_0x4355('0x12')](util[_0x4355('0xe')](_0x4355('0x35'),_0x288429[_0x4355('0x10')],_0x288429[_0x4355('0x36')],_0x288429[_0x4355('0x37')]));if(_0x288429[_0x4355('0x36')][_0x4355('0x38')]()==_0x4355('0x39')&&_[_0x4355('0x3a')](_0x288429[_0x4355('0x37')][_0x4355('0x38')](),_0x4355('0x3b'))){var _0xe3efbb=_0x288429[_0x4355('0x37')]['split']('=');var _0x122a44=_0xe3efbb[0x0]['substring'](_0xe3efbb[0x0][_0x4355('0x3c')]('(')+0x1,_0xe3efbb[0x0][_0x4355('0x3c')](')'));var _0x411221=_0xe3efbb[0x1];recordings[_0x288429[_0x4355('0x10')]][_0x122a44]=_0x411221;}}}catch(_0x32f0e9){utils[_0x4355('0x17')](util[_0x4355('0xe')](_0x4355('0x3d'),_0x288429['uniqueid']),_0x32f0e9);}};exports[_0x4355('0x3e')]=function(_0xacfaa3){try{if(!_['isNil'](recordings[_0xacfaa3[_0x4355('0x10')]])){utils[_0x4355('0xd')](util[_0x4355('0xe')](_0x4355('0x3f'),_0xacfaa3[_0x4355('0x10')]),_0xacfaa3);utils[_0x4355('0x12')](util['format'](_0x4355('0x40'),_0xacfaa3[_0x4355('0x10')],_0xacfaa3[_0x4355('0x41')]));recordings[_0xacfaa3[_0x4355('0x10')]][_0x4355('0x41')]=_0xacfaa3[_0x4355('0x41')];}}catch(_0x53fc33){utils['error'](util['format'](_0x4355('0x3f'),_0xacfaa3[_0x4355('0x10')]),_0x53fc33);}}; \ No newline at end of file +var _0xe5ee=['accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','transfer','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','hangup','debug','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','uniqueid'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xe5ee,0x16a));var _0xee5e=function(_0x328ea7,_0x5cd8f8){_0x328ea7=_0x328ea7-0x0;var _0x3fd2e7=_0xe5ee[_0x328ea7];return _0x3fd2e7;};'use strict';var _=require(_0xee5e('0x0'));var util=require(_0xee5e('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x12245d){utils[_0xee5e('0x2')](util['format']('[%s][recordings][writeDB]',_0x12245d[_0xee5e('0x3')]));if(_0x12245d[_0xee5e('0x4')]){utils[_0xee5e('0x5')](_0x12245d[_0xee5e('0x4')])[_0xee5e('0x6')](function(_0x18a737){if(_0x18a737){_0x12245d[_0xee5e('0x7')]=_0x18a737[_0xee5e('0x8')];_0x12245d[_0xee5e('0x9')]=_0x18a737['id'];}utils[_0xee5e('0xa')]('CreateVoiceRecording',_0x12245d);});}else{utils[_0xee5e('0xa')](_0xee5e('0xb'),_0x12245d);}}exports[_0xee5e('0xc')]=function(_0x2e5d07){try{utils['debug'](util[_0xee5e('0xd')](_0xee5e('0xe'),_0x2e5d07['uniqueid']),_0x2e5d07);if(_0x2e5d07[_0xee5e('0x3')]==_0x2e5d07[_0xee5e('0xf')]){utils[_0xee5e('0x2')](util[_0xee5e('0xd')](_0xee5e('0x10'),_0x2e5d07[_0xee5e('0x3')],_0x2e5d07[_0xee5e('0x11')],_0x2e5d07[_0xee5e('0x12')]));recordings[_0x2e5d07['uniqueid']]={'uniqueid':_0x2e5d07['uniqueid'],'accountcode':_0x2e5d07[_0xee5e('0x4')],'exten':_0x2e5d07[_0xee5e('0x12')],'context':_0x2e5d07[_0xee5e('0x11')],'channel':_0x2e5d07[_0xee5e('0x13')],'monitors':[]};}}catch(_0x473b80){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0xe'),_0x2e5d07['uniqueid']),_0x473b80);}};exports['newstate']=function(_0x223cba){try{utils['debug'](util[_0xee5e('0xd')]('[%s][recordings][newstate]',_0x223cba[_0xee5e('0x3')]),_0x223cba);if(!_[_0xee5e('0x15')](recordings[_0x223cba[_0xee5e('0x3')]])&&_0x223cba[_0xee5e('0x16')]==0x6){utils['info'](util[_0xee5e('0xd')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x223cba[_0xee5e('0x3')],_0x223cba[_0xee5e('0x11')],_0x223cba[_0xee5e('0x13')]));}else if(!_['isNil'](recordings[_0x223cba['linkedid']])&&_0x223cba[_0xee5e('0x16')]==0x6&&_0x223cba[_0xee5e('0x11')]!=_0xee5e('0x17')){utils[_0xee5e('0x2')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x223cba[_0xee5e('0x3')],_0x223cba['linkedid'],_0x223cba[_0xee5e('0x11')],_0x223cba['channel']));recordings[_0x223cba['linkedid']]['accountcode']=_0x223cba[_0xee5e('0x4')];}}catch(_0x4321cd){utils[_0xee5e('0x14')](util[_0xee5e('0xd')]('[%s][recordings][newstate]',_0x223cba[_0xee5e('0x3')]),_0x4321cd);}};exports['varset']=function(_0x53536e){try{if(!_[_0xee5e('0x15')](_0x53536e[_0xee5e('0x18')])&&!_[_0xee5e('0x15')](_0x53536e[_0xee5e('0x18')][_0xee5e('0x19')])){utils['debug'](util[_0xee5e('0xd')](_0xee5e('0x1a'),_0x53536e[_0xee5e('0x3')]),_0x53536e);utils[_0xee5e('0x2')](util['format'](_0xee5e('0x1b'),_0x53536e[_0xee5e('0x3')],_0x53536e[_0xee5e('0x18')],_0x53536e['value']));if(_[_0xee5e('0x1c')](_0x53536e[_0xee5e('0x1d')],_0xee5e('0x1e'))){_0x53536e['value']=_0x53536e[_0xee5e('0x1d')]['replace'](_0xee5e('0x1e'),_0xee5e('0x1f'));}if(recordings[_0x53536e[_0xee5e('0xf')]]){var _0x258d4d=_[_0xee5e('0x20')](recordings[_0x53536e[_0xee5e('0xf')]][_0xee5e('0x21')],{'value':_0x53536e[_0xee5e('0x1d')]});if(_[_0xee5e('0x15')](_0x258d4d)){recordings[_0x53536e[_0xee5e('0xf')]][_0xee5e('0x21')][_0xee5e('0x22')]({'value':_0x53536e[_0xee5e('0x1d')]});}}}}catch(_0x5e4b2f){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0x1a'),_0x53536e[_0xee5e('0x3')]),_0x5e4b2f);}};exports[_0xee5e('0x23')]=function(_0x581351){try{if(!_[_0xee5e('0x15')](recordings[_0x581351[_0xee5e('0x3')]])){utils[_0xee5e('0x24')](util[_0xee5e('0xd')](_0xee5e('0x25'),_0x581351[_0xee5e('0x3')]),_0x581351);utils[_0xee5e('0x2')](util[_0xee5e('0xd')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x581351[_0xee5e('0x3')],_0x581351[_0xee5e('0x26')],_0x581351[_0xee5e('0x27')],_0x581351[_0xee5e('0x28')]));recordings[_0x581351['uniqueid']][_0xee5e('0x26')]=_0x581351[_0xee5e('0x26')];recordings[_0x581351['uniqueid']][_0xee5e('0x27')]=_0x581351[_0xee5e('0x27')];recordings[_0x581351[_0xee5e('0x3')]]['connectedlinenum']=_0x581351['connectedlinenum'];recordings[_0x581351['uniqueid']][_0xee5e('0x29')]=_0x581351[_0xee5e('0x29')];if(recordings[_0x581351[_0xee5e('0x3')]][_0xee5e('0x2a')]==_0xee5e('0x2b')&&recordings[_0x581351['uniqueid']][_0xee5e('0x4')]){recordings[_0x581351[_0xee5e('0x3')]][_0xee5e('0x2c')]=recordings[_0x581351['uniqueid']][_0xee5e('0x4')];recordings[_0x581351['uniqueid']][_0xee5e('0x29')]='';}recordings[_0x581351[_0xee5e('0x3')]][_0xee5e('0x21')][_0xee5e('0x2d')](function(_0x4d3f42){var _0x3c4835=_[_0xee5e('0x2e')](recordings[_0x581351['uniqueid']]);_0x3c4835['value']=_0x4d3f42[_0xee5e('0x1d')];writeDB(_0x3c4835);});delete recordings[_0x581351[_0xee5e('0x3')]];}}catch(_0x544e29){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0x25'),_0x581351[_0xee5e('0x3')]),_0x544e29);}};exports[_0xee5e('0x2f')]=function(_0x4984f0){try{if(!_[_0xee5e('0x15')](recordings[_0x4984f0[_0xee5e('0x3')]])){utils[_0xee5e('0x24')](util[_0xee5e('0xd')]('[%s][recordings][newexten]',_0x4984f0['uniqueid']),_0x4984f0);utils[_0xee5e('0x2')](util['format'](_0xee5e('0x30'),_0x4984f0[_0xee5e('0x3')],_0x4984f0[_0xee5e('0x31')],_0x4984f0[_0xee5e('0x32')]));if(_0x4984f0[_0xee5e('0x31')][_0xee5e('0x33')]()=='set'&&_[_0xee5e('0x34')](_0x4984f0[_0xee5e('0x32')]['toLowerCase'](),'cdr')){var _0x1d9d46=_0x4984f0[_0xee5e('0x32')][_0xee5e('0x35')]('=');var _0x2a18d1=_0x1d9d46[0x0][_0xee5e('0x36')](_0x1d9d46[0x0][_0xee5e('0x37')]('(')+0x1,_0x1d9d46[0x0]['lastIndexOf'](')'));var _0x3f94cf=_0x1d9d46[0x1];recordings[_0x4984f0[_0xee5e('0x3')]][_0x2a18d1]=_0x3f94cf;}}}catch(_0x2996e1){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0x38'),_0x4984f0['uniqueid']),_0x2996e1);}};exports[_0xee5e('0x39')]=function(_0x1efb45){try{if(!_['isNil'](recordings[_0x1efb45[_0xee5e('0x3')]])){utils[_0xee5e('0x24')](util[_0xee5e('0xd')](_0xee5e('0x3a'),_0x1efb45[_0xee5e('0x3')]),_0x1efb45);utils['info'](util[_0xee5e('0xd')](_0xee5e('0x3b'),_0x1efb45[_0xee5e('0x3')],_0x1efb45[_0xee5e('0x3c')]));recordings[_0x1efb45[_0xee5e('0x3')]][_0xee5e('0x3c')]=_0x1efb45[_0xee5e('0x3c')];}}catch(_0x1c37f){utils[_0xee5e('0x14')](util[_0xee5e('0xd')]('[%s][recordings][queuecallerjoin]',_0x1efb45[_0xee5e('0x3')]),_0x1c37f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d80abc2..8759a9d 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 _0xd67b=['attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','type'];(function(_0x1880db,_0x36cc32){var _0x12d0db=function(_0x567e66){while(--_0x567e66){_0x1880db['push'](_0x1880db['shift']());}};_0x12d0db(++_0x36cc32);}(_0xd67b,0x1df));var _0xbd67=function(_0xe03bdd,_0x1c1821){_0xe03bdd=_0xe03bdd-0x0;var _0x13b570=_0xd67b[_0xe03bdd];return _0x13b570;};'use strict';var _=require(_0xbd67('0x0'));var util=require(_0xbd67('0x1'));var utils=require(_0xbd67('0x2'));function writeDB(_0x3210f8){utils[_0xbd67('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x3210f8[_0xbd67('0x4')]===_0xbd67('0x5')?_0x3210f8[_0xbd67('0x6')]:_0x3210f8[_0xbd67('0x7')],_0x3210f8[_0xbd67('0x4')]));utils[_0xbd67('0x8')](_0xbd67('0x9'),_0x3210f8);}exports[_0xbd67('0xa')]=function(_0x4195c5){try{utils['debug'](util[_0xbd67('0xb')](_0xbd67('0xc'),_0x4195c5[_0xbd67('0x7')]),_0x4195c5);utils[_0xbd67('0x3')](util[_0xbd67('0xb')](_0xbd67('0xd'),_0x4195c5[_0xbd67('0x7')],_0x4195c5[_0xbd67('0xe')],_0x4195c5['transferercalleridname'],_0x4195c5[_0xbd67('0xf')],_0x4195c5[_0xbd67('0x10')]));_0x4195c5['type']=_0xbd67('0x11');writeDB(_0x4195c5);}catch(_0x3b154e){utils['error'](util[_0xbd67('0xb')](_0xbd67('0xc'),_0x4195c5[_0xbd67('0x7')]),_0x3b154e);}};exports[_0xbd67('0x12')]=function(_0x734696){try{utils[_0xbd67('0x13')](util[_0xbd67('0xb')](_0xbd67('0x14'),_0x734696[_0xbd67('0x6')]),_0x734696);utils[_0xbd67('0x3')](util[_0xbd67('0xb')](_0xbd67('0x15'),_0x734696[_0xbd67('0x6')],_0x734696['origtransferercalleridnum'],_0x734696[_0xbd67('0x16')],_0x734696[_0xbd67('0x17')],_0x734696[_0xbd67('0x18')]));_0x734696=_[_0xbd67('0x19')](_0x734696,{'transfererchannel':_0x734696[_0xbd67('0x1a')],'transferercalleridnum':_0x734696[_0xbd67('0x1b')],'transferercalleridname':_0x734696[_0xbd67('0x16')],'transfererconnectedlinenum':_0x734696[_0xbd67('0x1c')],'transfererconnectedlinename':_0x734696[_0xbd67('0x1d')],'transfereraccountcode':_0x734696[_0xbd67('0x1e')],'transferercontext':_0x734696[_0xbd67('0x1f')],'transfererexten':_0x734696[_0xbd67('0x20')],'transfererlinkedid':_0x734696[_0xbd67('0x21')],'context':_0x734696[_0xbd67('0x22')],'extension':_0x734696['origtransfererexten'],'type':_0xbd67('0x5')});if(_[_0xbd67('0x23')](_0x734696[_0xbd67('0x24')])){_0x734696=_['assign'](_0x734696,{'transfereechannel':_0x734696[_0xbd67('0x25')],'transfereecalleridnum':_0x734696[_0xbd67('0x17')],'transfereecalleridname':_0x734696[_0xbd67('0x18')],'transfereeconnectedlinenum':_0x734696[_0xbd67('0x26')],'transfereeconnectedlinename':_0x734696[_0xbd67('0x27')],'transfereeaccountcode':_0x734696[_0xbd67('0x28')],'transfereecontext':_0x734696['transfertargetcontext'],'transfereeexten':_0x734696[_0xbd67('0x29')],'transfereelinkedid':_0x734696[_0xbd67('0x2a')]});}writeDB(_0x734696);}catch(_0xa5ce3b){utils[_0xbd67('0x2b')](util['format'](_0xbd67('0x14'),_0x734696[_0xbd67('0x6')]),_0xa5ce3b);}}; \ No newline at end of file +var _0x3927=['CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid'];(function(_0x4e5f6f,_0x462fbb){var _0x5b489b=function(_0xb9f160){while(--_0xb9f160){_0x4e5f6f['push'](_0x4e5f6f['shift']());}};_0x5b489b(++_0x462fbb);}(_0x3927,0x90));var _0x7392=function(_0x338e6e,_0x3d12fa){_0x338e6e=_0x338e6e-0x0;var _0x6ed645=_0x3927[_0x338e6e];return _0x6ed645;};'use strict';var _=require(_0x7392('0x0'));var util=require(_0x7392('0x1'));var utils=require(_0x7392('0x2'));function writeDB(_0x120f65){utils[_0x7392('0x3')](util['format'](_0x7392('0x4'),_0x120f65[_0x7392('0x5')]===_0x7392('0x6')?_0x120f65['origtransfereruniqueid']:_0x120f65[_0x7392('0x7')],_0x120f65[_0x7392('0x5')]));utils['request'](_0x7392('0x8'),_0x120f65);}exports[_0x7392('0x9')]=function(_0x4e5c1f){try{utils['debug'](util[_0x7392('0xa')]('[%s][transfers][blindtransfer]',_0x4e5c1f['uniqueid']),_0x4e5c1f);utils['info'](util['format'](_0x7392('0xb'),_0x4e5c1f['uniqueid'],_0x4e5c1f[_0x7392('0xc')],_0x4e5c1f['transferercalleridname'],_0x4e5c1f['transfereecalleridnum'],_0x4e5c1f[_0x7392('0xd')]));_0x4e5c1f[_0x7392('0x5')]=_0x7392('0xe');writeDB(_0x4e5c1f);}catch(_0x8fd258){utils['error'](util[_0x7392('0xa')]('[%s][transfers][blindtransfer]',_0x4e5c1f[_0x7392('0x7')]),_0x8fd258);}};exports[_0x7392('0xf')]=function(_0x663a19){try{utils[_0x7392('0x10')](util[_0x7392('0xa')](_0x7392('0x11'),_0x663a19[_0x7392('0x12')]),_0x663a19);utils[_0x7392('0x3')](util['format'](_0x7392('0x13'),_0x663a19['origtransfereruniqueid'],_0x663a19[_0x7392('0x14')],_0x663a19[_0x7392('0x15')],_0x663a19[_0x7392('0x16')],_0x663a19[_0x7392('0x17')]));_0x663a19=_[_0x7392('0x18')](_0x663a19,{'transfererchannel':_0x663a19['origtransfererchannel'],'transferercalleridnum':_0x663a19[_0x7392('0x14')],'transferercalleridname':_0x663a19['origtransferercalleridname'],'transfererconnectedlinenum':_0x663a19['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x663a19['secondtransfererconnectedlinename'],'transfereraccountcode':_0x663a19[_0x7392('0x19')],'transferercontext':_0x663a19[_0x7392('0x1a')],'transfererexten':_0x663a19[_0x7392('0x1b')],'transfererlinkedid':_0x663a19[_0x7392('0x1c')],'context':_0x663a19[_0x7392('0x1d')],'extension':_0x663a19[_0x7392('0x1e')],'type':_0x7392('0x6')});if(_[_0x7392('0x1f')](_0x663a19['transfereechannel'])){_0x663a19=_[_0x7392('0x18')](_0x663a19,{'transfereechannel':_0x663a19[_0x7392('0x20')],'transfereecalleridnum':_0x663a19['transfertargetcalleridnum'],'transfereecalleridname':_0x663a19['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x663a19['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x663a19[_0x7392('0x21')],'transfereeaccountcode':_0x663a19['transfertargetaccountcode'],'transfereecontext':_0x663a19[_0x7392('0x22')],'transfereeexten':_0x663a19[_0x7392('0x23')],'transfereelinkedid':_0x663a19[_0x7392('0x24')]});}writeDB(_0x663a19);}catch(_0x5c95d8){utils[_0x7392('0x25')](util[_0x7392('0xa')](_0x7392('0x11'),_0x663a19[_0x7392('0x12')]),_0x5c95d8);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fa5cf0d..859bdd5 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 _0x9333=['[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','info','inspect','error','request','then','debug'];(function(_0x4c99ee,_0x2d8768){var _0x24bc5f=function(_0x9b00c1){while(--_0x9b00c1){_0x4c99ee['push'](_0x4c99ee['shift']());}};_0x24bc5f(++_0x2d8768);}(_0x9333,0x122));var _0x3933=function(_0xa54206,_0x3312a9){_0xa54206=_0xa54206-0x0;var _0x5e87db=_0x9333[_0xa54206];return _0x5e87db;};'use strict';var BPromise=require(_0x3933('0x0'));var jayson=require(_0x3933('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x3933('0x2')][_0x3933('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x3933('0x4')]=function(_0x346b75,_0x1de9e1){logger[_0x3933('0x4')](_0x346b75,_0x1de9e1?util[_0x3933('0x5')](_0x1de9e1,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3a87d3,_0x4bd800){logger['debug'](_0x3a87d3,_0x4bd800?util['inspect'](_0x4bd800,{'showHidden':![],'depth':null}):'');};exports[_0x3933('0x6')]=function(_0x391109,_0x3e9ec7){logger[_0x3933('0x6')](_0x391109,_0x3e9ec7?util[_0x3933('0x5')](_0x3e9ec7,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x1b66ce,_0x592dae){return client[_0x3933('0x7')](_0x1b66ce,{'body':_0x592dae})[_0x3933('0x8')](function(_0x36ab90){logger[_0x3933('0x9')](_0x3933('0xa'),_0x1b66ce,_0x36ab90?util[_0x3933('0x5')](_0x36ab90,{'showHidden':![],'depth':null}):'');})[_0x3933('0xb')](function(_0x3d4c21){logger['error']('[utils][request]\x20name:%s',_0x1b66ce,_0x3d4c21?util['inspect'](_0x3d4c21,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5f4b80){return client[_0x3933('0x7')](_0x3933('0xc'),{'options':{'raw':!![],'attributes':['id',_0x3933('0xd'),'name',_0x3933('0xe')],'where':_0x5f4b80,'limit':0x1}})[_0x3933('0x8')](function(_0x129b75){logger[_0x3933('0x9')](_0x3933('0xf'),JSON[_0x3933('0x10')](_0x5f4b80),_0x129b75?util[_0x3933('0x5')](_0x129b75,{'showHidden':![],'depth':null}):'');return _0x129b75['result'][_0x3933('0x11')]?_0x129b75[_0x3933('0x12')][0x0]:null;});}exports[_0x3933('0x13')]=function(_0x58dc25){return new BPromise(function(_0x2ea11f,_0xd044d8){if(_0x58dc25){return getUser({'internal':_0x58dc25})[_0x3933('0x8')](function(_0x5323a3){logger[_0x3933('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x58dc25,_0x5323a3?_0x3933('0x14'):_0x3933('0x15'));return _0x2ea11f(_0x5323a3);})['catch'](function(_0x196710){logger['error'](_0x3933('0x16'),_0x196710?util[_0x3933('0x5')](_0x196710,{'showHidden':![],'depth':null}):'');return _0x2ea11f(null);});}return _0x2ea11f(null);});};exports[_0x3933('0x17')]=function(_0x393206){return new BPromise(function(_0x4b0293,_0x1e685c){if(_0x393206){return getUser({'interface':_0x393206})['then'](function(_0x32bc84){logger[_0x3933('0x4')](_0x3933('0x18'),_0x393206,_0x32bc84?_0x3933('0x14'):_0x3933('0x15'));return _0x4b0293(_0x32bc84);})[_0x3933('0xb')](function(_0x7639e8){logger['error'](_0x3933('0x19'),_0x7639e8?util[_0x3933('0x5')](_0x7639e8,{'showHidden':![],'depth':null}):'');return _0x4b0293(null);});}return _0x4b0293(null);});};exports[_0x3933('0x1a')]=function(_0x48de18){return new BPromise(function(_0xa17ac5,_0xae419c){if(_0x48de18){return getUser({'name':_0x48de18})[_0x3933('0x8')](function(_0x25ab9d){logger[_0x3933('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x48de18,_0x25ab9d?_0x3933('0x14'):'notfound');return _0xa17ac5(_0x25ab9d);})[_0x3933('0xb')](function(_0xb587a3){logger[_0x3933('0x6')](_0x3933('0x1b'),_0xb587a3?util[_0x3933('0x5')](_0xb587a3,{'showHidden':![],'depth':null}):'');return _0xa17ac5(null);});}return _0xa17ac5(null);});};exports[_0x3933('0x1c')]=function(_0x296521){return new BPromise(function(_0x46ba9a,_0xb20f0e){if(_0x296521){return client[_0x3933('0x7')](_0x3933('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x3933('0x1e'),_0x3933('0x1f'),_0x3933('0x20'),_0x3933('0x21')],'where':{'name':_0x296521},'limit':0x1}})['then'](function(_0xc99574){logger[_0x3933('0x9')](_0x3933('0x22'),_0x296521,_0xc99574?util[_0x3933('0x5')](_0xc99574,{'showHidden':![],'depth':null}):'');logger['info'](_0x3933('0x23'),_0x296521,_0xc99574?_0x3933('0x14'):_0x3933('0x15'));return _0x46ba9a(_0xc99574['result'][_0x3933('0x11')]?_0xc99574['result'][0x0]:null);})[_0x3933('0xb')](function(_0x1ad9a5){logger[_0x3933('0x6')](_0x3933('0x24'),_0x1ad9a5?util['inspect'](_0x1ad9a5,{'showHidden':![],'depth':null}):'');return _0x46ba9a(null);});}return _0x46ba9a(null);});};exports[_0x3933('0x25')]=function(_0x5b05a6,_0x516d38){return moment(_0x5b05a6)[_0x3933('0x26')](_0x516d38,_0x3933('0x27'))[_0x3933('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3933('0x29')]=function(_0x42b7ca,_0x14915b){return moment(_0x42b7ca)[_0x3933('0x2a')](_0x14915b,'seconds')[_0x3933('0x28')](_0x3933('0x2b'));};exports[_0x3933('0x2c')]=function(_0x3ebd58,_0x3e1fdc){return moment(_0x3ebd58)[_0x3933('0x2d')](moment(_0x3e1fdc),_0x3933('0x27'));};exports[_0x3933('0x2e')]=function(_0x209a0f,_0x5c6ac6){return parseInt(_0x209a0f,0xa)+parseInt(_0x5c6ac6,0xa);};exports[_0x3933('0x2f')]=function(){return moment()[_0x3933('0x28')](_0x3933('0x2b'));};exports[_0x3933('0x30')]=function(_0x1074dd,_0x5b0a98){if(_0x5b0a98){return moment(_0x1074dd)[_0x3933('0x30')](_0x5b0a98);}return!![];};exports[_0x3933('0x31')]=function(_0x215c1f,_0x5c8a51){if(_0x5c8a51){return moment(_0x215c1f)['isBefore'](_0x5c8a51);}else if(_0x215c1f){return!![];}return![];}; \ No newline at end of file +var _0x9206=['getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9206,0x176));var _0x6920=function(_0xd9a6eb,_0x3ceddc){_0xd9a6eb=_0xd9a6eb-0x0;var _0x3484b0=_0x9206[_0xd9a6eb];return _0x3484b0;};'use strict';var BPromise=require(_0x6920('0x0'));var jayson=require(_0x6920('0x1'));var moment=require(_0x6920('0x2'));var util=require(_0x6920('0x3'));var client=jayson[_0x6920('0x4')][_0x6920('0x5')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x6920('0x6')]=function(_0x3c84f7,_0x560c31){logger['info'](_0x3c84f7,_0x560c31?util[_0x6920('0x7')](_0x560c31,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x21fb21,_0x31966d){logger[_0x6920('0x8')](_0x21fb21,_0x31966d?util[_0x6920('0x7')](_0x31966d,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x538f80,_0x1f4895){logger[_0x6920('0x9')](_0x538f80,_0x1f4895?util[_0x6920('0x7')](_0x1f4895,{'showHidden':![],'depth':null}):'');};exports[_0x6920('0xa')]=function(_0x188e0c,_0x2a9aa6){return client[_0x6920('0xa')](_0x188e0c,{'body':_0x2a9aa6})[_0x6920('0xb')](function(_0x194343){logger[_0x6920('0x8')](_0x6920('0xc'),_0x188e0c,_0x194343?util[_0x6920('0x7')](_0x194343,{'showHidden':![],'depth':null}):'');})[_0x6920('0xd')](function(_0x5ad438){logger['error'](_0x6920('0xc'),_0x188e0c,_0x5ad438?util[_0x6920('0x7')](_0x5ad438,{'showHidden':![],'depth':null}):'');});};function getUser(_0x57e9f3){return client[_0x6920('0xa')](_0x6920('0xe'),{'options':{'raw':!![],'attributes':['id',_0x6920('0xf'),_0x6920('0x10'),_0x6920('0x11')],'where':_0x57e9f3,'limit':0x1}})['then'](function(_0x338e5f){logger[_0x6920('0x8')](_0x6920('0x12'),JSON[_0x6920('0x13')](_0x57e9f3),_0x338e5f?util[_0x6920('0x7')](_0x338e5f,{'showHidden':![],'depth':null}):'');return _0x338e5f[_0x6920('0x14')][_0x6920('0x15')]?_0x338e5f[_0x6920('0x14')][0x0]:null;});}exports[_0x6920('0x16')]=function(_0x2d04e7){return new BPromise(function(_0x462500,_0x3d0059){if(_0x2d04e7){return getUser({'internal':_0x2d04e7})[_0x6920('0xb')](function(_0x81f693){logger[_0x6920('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2d04e7,_0x81f693?_0x6920('0x17'):_0x6920('0x18'));return _0x462500(_0x81f693);})[_0x6920('0xd')](function(_0xaf73cf){logger[_0x6920('0x9')](_0x6920('0x19'),_0xaf73cf?util[_0x6920('0x7')](_0xaf73cf,{'showHidden':![],'depth':null}):'');return _0x462500(null);});}return _0x462500(null);});};exports[_0x6920('0x1a')]=function(_0xaf93ba){return new BPromise(function(_0x37ebb0,_0x32c784){if(_0xaf93ba){return getUser({'interface':_0xaf93ba})[_0x6920('0xb')](function(_0x1df372){logger[_0x6920('0x6')](_0x6920('0x1b'),_0xaf93ba,_0x1df372?_0x6920('0x17'):_0x6920('0x18'));return _0x37ebb0(_0x1df372);})[_0x6920('0xd')](function(_0xa8f55){logger[_0x6920('0x9')]('[utils][getUserByInterface]',_0xa8f55?util[_0x6920('0x7')](_0xa8f55,{'showHidden':![],'depth':null}):'');return _0x37ebb0(null);});}return _0x37ebb0(null);});};exports['getUserByName']=function(_0x277b69){return new BPromise(function(_0x4dd08b,_0x72316a){if(_0x277b69){return getUser({'name':_0x277b69})[_0x6920('0xb')](function(_0x23e4cd){logger[_0x6920('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x277b69,_0x23e4cd?_0x6920('0x17'):_0x6920('0x18'));return _0x4dd08b(_0x23e4cd);})[_0x6920('0xd')](function(_0x1ae78f){logger[_0x6920('0x9')](_0x6920('0x1c'),_0x1ae78f?util[_0x6920('0x7')](_0x1ae78f,{'showHidden':![],'depth':null}):'');return _0x4dd08b(null);});}return _0x4dd08b(null);});};exports[_0x6920('0x1d')]=function(_0x400894){return new BPromise(function(_0x2f5ce8,_0x6860c7){if(_0x400894){return client[_0x6920('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x6920('0x10'),'type',_0x6920('0x1e'),'acwTimeout'],'where':{'name':_0x400894},'limit':0x1}})[_0x6920('0xb')](function(_0x25e7ff){logger['debug'](_0x6920('0x1f'),_0x400894,_0x25e7ff?util[_0x6920('0x7')](_0x25e7ff,{'showHidden':![],'depth':null}):'');logger[_0x6920('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x400894,_0x25e7ff?'found':_0x6920('0x18'));return _0x2f5ce8(_0x25e7ff['result']['length']?_0x25e7ff[_0x6920('0x14')][0x0]:null);})[_0x6920('0xd')](function(_0x8b95ba){logger[_0x6920('0x9')](_0x6920('0x20'),_0x8b95ba?util[_0x6920('0x7')](_0x8b95ba,{'showHidden':![],'depth':null}):'');return _0x2f5ce8(null);});}return _0x2f5ce8(null);});};exports[_0x6920('0x21')]=function(_0x5aff49,_0x26cf8c){return moment(_0x5aff49)['add'](_0x26cf8c,_0x6920('0x22'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6920('0x23')]=function(_0x155b3a,_0x1d4426){return moment(_0x155b3a)[_0x6920('0x24')](_0x1d4426,_0x6920('0x22'))[_0x6920('0x25')](_0x6920('0x26'));};exports[_0x6920('0x27')]=function(_0x33acf7,_0x26a4b0){return moment(_0x33acf7)[_0x6920('0x28')](moment(_0x26a4b0),_0x6920('0x22'));};exports['sumTime']=function(_0x2a69d3,_0x4c56be){return parseInt(_0x2a69d3,0xa)+parseInt(_0x4c56be,0xa);};exports[_0x6920('0x29')]=function(){return moment()[_0x6920('0x25')](_0x6920('0x26'));};exports['isAfter']=function(_0x1e8101,_0x41503b){if(_0x41503b){return moment(_0x1e8101)[_0x6920('0x2a')](_0x41503b);}return!![];};exports[_0x6920('0x2b')]=function(_0x4eb58e,_0x369233){if(_0x369233){return moment(_0x4eb58e)[_0x6920('0x2b')](_0x369233);}else if(_0x4eb58e){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index bfa8347..45e040a 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2279=['user','no-user','data','error','auth','set','use','logger','isEmpty','\x20body=%s','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','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','agent_id','agent_name','test','fs-extra','lodash','express-winston','util','fileLogger','./safe-template','./mask-sensitive-data','/var','log','role','name','join','then','client','catch'];(function(_0x292ec5,_0x3f879f){var _0x436db9=function(_0x20d249){while(--_0x20d249){_0x292ec5['push'](_0x292ec5['shift']());}};_0x436db9(++_0x3f879f);}(_0x2279,0x1bf));var _0x9227=function(_0x562adf,_0x1f2f85){_0x562adf=_0x562adf-0x0;var _0x87c18e=_0x2279[_0x562adf];return _0x87c18e;};var fs=require(_0x9227('0x0'));var _=require(_0x9227('0x1'));var ewinston=require(_0x9227('0x2'));var path=require('path');var util=require(_0x9227('0x3'));var fileLogger=require('./loggers')[_0x9227('0x4')];var safeTemplate=require(_0x9227('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x9227('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x4a94cd(_0x1314ef){var _0x298a6e=path['join'](_0x9227('0x7'),_0x9227('0x8'),'xcally');var _0x54ead9=path['join']('client',_0x1314ef[_0x9227('0x9')]+'-'+_0x1314ef[_0x9227('0xa')]);return fs['ensureDir'](path[_0x9227('0xb')](_0x298a6e,_0x54ead9))[_0x9227('0xc')](function(){var _0x5ea284=fileLogger(_0x9227('0xd'),path[_0x9227('0xb')](_0x298a6e,_0x54ead9));return _0x5ea284;})[_0x9227('0xe')](function(_0x4214e4){throw _0x4214e4;});}this[_0x9227('0x8')]=function(_0xcc509,_0x2e16f0,_0x5ee3df,_0x4d8d45){return _0x4a94cd(_0xcc509[_0x9227('0xf')])[_0x9227('0xc')](function(_0x425645){var _0x29fc37=_0x425645[_0x2e16f0];return _0x29fc37;})[_0x9227('0xc')](function(_0x45b958){var _0x33718f=_0xcc509[_0x9227('0xf')]?_0xcc509[_0x9227('0xf')]['id']:_0x9227('0x10');var _0x518f30=_0x4d8d45[_0x9227('0x11')];var _0x5473c1=_0x4d8d45['timestamp'];var _0x2d788b=new Date(Number(_0x5473c1));return _0x45b958(_0x33718f,_0x2d788b,_0x5ee3df,_0x518f30);})['catch'](function(_0x1782c3){fileLogger(_0x9227('0xd'))[_0x9227('0x12')](_0x1782c3);});};}function setupLoggers(_0x552778){return new Promise(function(_0x583e69){var _0x9a992e=new ClientSideLogger();var _0x52567e=fileLogger('api');var _0x324495=fileLogger(_0x9227('0x13'));_0x552778[_0x9227('0x14')]('client-side-logger',_0x9a992e);_0x552778[_0x9227('0x15')](ewinston[_0x9227('0x16')]({'winstonInstance':_0x52567e,'meta':![],'statusLevels':!![],'msg':function(_0x56d29e,_0x35b227){var _0x1c2a72='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x9227('0x17')](_0x56d29e['body'])){_0x1c2a72+=_0x9227('0x18');var _0x596bf0=_0x56d29e[_0x9227('0x19')];maskSensitiveData(_0x596bf0);}return safeTemplate(util[_0x9227('0x1a')](_0x1c2a72,_0x56d29e['method'],_0x56d29e[_0x9227('0x1b')]['x-forwarded-for']?_0x56d29e[_0x9227('0x1b')][_0x9227('0x1c')]:_0x56d29e[_0x9227('0x1d')][_0x9227('0x1e')]||_0x56d29e['ip'],_0x56d29e[_0x9227('0x1f')],_0x35b227[_0x9227('0x20')],_0x35b227[_0x9227('0x21')],_0x56d29e['user']?_0x56d29e['user']['id']:null,_0x56d29e[_0x9227('0xf')]?_0x56d29e[_0x9227('0xf')][_0x9227('0xa')]:null,_0x56d29e['user']?_0x56d29e['user'][_0x9227('0x9')]:null,_0x596bf0?util[_0x9227('0x22')](_0x596bf0,![],null):''));}}));_0x552778['use'](ewinston['logger']({'winstonInstance':_0x324495,'meta':![],'statusLevels':!![],'msg':function(_0x1f0cb0,_0x323e51){var _0xe626be=_0x9227('0x23');if(_0x1f0cb0[_0x9227('0x19')]&&_0x1f0cb0[_0x9227('0x19')][_0x9227('0x24')]&&_0x1f0cb0[_0x9227('0x19')]['agent_id']){_0xe626be=_0x9227('0x25');}return util[_0x9227('0x1a')](_0xe626be,_0x1f0cb0[_0x9227('0x26')],_0x1f0cb0[_0x9227('0x1b')][_0x9227('0x1c')]?_0x1f0cb0[_0x9227('0x1b')][_0x9227('0x1c')]:_0x1f0cb0[_0x9227('0x1d')]['remoteAddress']||_0x1f0cb0['ip'],_0x1f0cb0['url'],_0x323e51[_0x9227('0x20')],_0x323e51[_0x9227('0x21')],_0x1f0cb0['user']?_0x1f0cb0[_0x9227('0xf')]['id']:null,_0x1f0cb0[_0x9227('0xf')]?_0x1f0cb0[_0x9227('0xf')][_0x9227('0xa')]:null,_0x1f0cb0['user']?_0x1f0cb0[_0x9227('0xf')][_0x9227('0x9')]:null,_0x1f0cb0[_0x9227('0x19')]&&_0x1f0cb0['body'][_0x9227('0x24')]?_0x1f0cb0[_0x9227('0x19')][_0x9227('0x24')]:'other',_0x1f0cb0[_0x9227('0x19')]&&_0x1f0cb0[_0x9227('0x19')][_0x9227('0x27')]?_0x1f0cb0[_0x9227('0x19')]['agent_id']:'',_0x1f0cb0[_0x9227('0x19')]&&_0x1f0cb0[_0x9227('0x19')][_0x9227('0x28')]?_0x1f0cb0[_0x9227('0x19')][_0x9227('0x28')]:'');},'ignoreRoute':function(_0x22cf87){var _0x429c5b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x429c5b[_0x9227('0x29')](_0x22cf87['url']);}}));return _0x583e69();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x4834=['api','set','client-side-logger','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','statusCode','inspect','device','method','responseTime','other','agent_id','agent_name','url','fs-extra','lodash','./loggers','fileLogger','./safe-template','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','catch','user','no-user','timestamp','error'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x4834,0x135));var _0x4483=function(_0x40242c,_0x53ebc4){_0x40242c=_0x40242c-0x0;var _0xc65cec=_0x4834[_0x40242c];return _0xc65cec;};var fs=require(_0x4483('0x0'));var _=require(_0x4483('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0x4483('0x2'))[_0x4483('0x3')];var safeTemplate=require(_0x4483('0x4'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x4483('0x5')];function ClientSideLogger(){function _0x1f0a55(_0x596572){var _0x123a8e=path[_0x4483('0x6')](_0x4483('0x7'),_0x4483('0x8'),'xcally');var _0x2f89d4=path[_0x4483('0x6')](_0x4483('0x9'),_0x596572[_0x4483('0xa')]+'-'+_0x596572[_0x4483('0xb')]);return fs[_0x4483('0xc')](path[_0x4483('0x6')](_0x123a8e,_0x2f89d4))[_0x4483('0xd')](function(){var _0x3bff53=fileLogger(_0x4483('0x9'),path[_0x4483('0x6')](_0x123a8e,_0x2f89d4));return _0x3bff53;})[_0x4483('0xe')](function(_0x41adbc){throw _0x41adbc;});}this['log']=function(_0xfd43c3,_0x69d3ea,_0x5f230b,_0x2f0620){return _0x1f0a55(_0xfd43c3[_0x4483('0xf')])['then'](function(_0x45a293){var _0x5630dd=_0x45a293[_0x69d3ea];return _0x5630dd;})[_0x4483('0xd')](function(_0x22df6b){var _0x27a99a=_0xfd43c3[_0x4483('0xf')]?_0xfd43c3[_0x4483('0xf')]['id']:_0x4483('0x10');var _0x516a56=_0x2f0620['data'];var _0x3a6955=_0x2f0620[_0x4483('0x11')];var _0x3b4a4a=new Date(Number(_0x3a6955));return _0x22df6b(_0x27a99a,_0x3b4a4a,_0x5f230b,_0x516a56);})[_0x4483('0xe')](function(_0x22c8b6){fileLogger(_0x4483('0x9'))[_0x4483('0x12')](_0x22c8b6);});};}function setupLoggers(_0x5bab74){return new Promise(function(_0x43877e){var _0x20bef1=new ClientSideLogger();var _0x18e6c0=fileLogger(_0x4483('0x13'));var _0x2f8bf4=fileLogger('auth');_0x5bab74[_0x4483('0x14')](_0x4483('0x15'),_0x20bef1);_0x5bab74['use'](ewinston[_0x4483('0x16')]({'winstonInstance':_0x18e6c0,'meta':![],'statusLevels':!![],'msg':function(_0x359506,_0x4568ba){var _0x2ee100=_0x4483('0x17');if(!_[_0x4483('0x18')](_0x359506[_0x4483('0x19')])){_0x2ee100+=_0x4483('0x1a');var _0x37aeab=_0x359506[_0x4483('0x19')];maskSensitiveData(_0x37aeab);}return safeTemplate(util[_0x4483('0x1b')](_0x2ee100,_0x359506['method'],_0x359506[_0x4483('0x1c')][_0x4483('0x1d')]?_0x359506[_0x4483('0x1c')][_0x4483('0x1d')]:_0x359506[_0x4483('0x1e')][_0x4483('0x1f')]||_0x359506['ip'],_0x359506['url'],_0x4568ba[_0x4483('0x20')],_0x4568ba['responseTime'],_0x359506[_0x4483('0xf')]?_0x359506['user']['id']:null,_0x359506[_0x4483('0xf')]?_0x359506[_0x4483('0xf')][_0x4483('0xb')]:null,_0x359506[_0x4483('0xf')]?_0x359506[_0x4483('0xf')][_0x4483('0xa')]:null,_0x37aeab?util[_0x4483('0x21')](_0x37aeab,![],null):''));}}));_0x5bab74['use'](ewinston[_0x4483('0x16')]({'winstonInstance':_0x2f8bf4,'meta':![],'statusLevels':!![],'msg':function(_0x13ff21,_0x6ffd1b){var _0x27ec3c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x13ff21[_0x4483('0x19')]&&_0x13ff21[_0x4483('0x19')][_0x4483('0x22')]&&_0x13ff21[_0x4483('0x19')]['agent_id']){_0x27ec3c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4483('0x1b')](_0x27ec3c,_0x13ff21[_0x4483('0x23')],_0x13ff21[_0x4483('0x1c')]['x-forwarded-for']?_0x13ff21[_0x4483('0x1c')][_0x4483('0x1d')]:_0x13ff21[_0x4483('0x1e')][_0x4483('0x1f')]||_0x13ff21['ip'],_0x13ff21['url'],_0x6ffd1b['statusCode'],_0x6ffd1b[_0x4483('0x24')],_0x13ff21['user']?_0x13ff21[_0x4483('0xf')]['id']:null,_0x13ff21[_0x4483('0xf')]?_0x13ff21[_0x4483('0xf')]['name']:null,_0x13ff21[_0x4483('0xf')]?_0x13ff21[_0x4483('0xf')][_0x4483('0xa')]:null,_0x13ff21[_0x4483('0x19')]&&_0x13ff21['body'][_0x4483('0x22')]?_0x13ff21['body'][_0x4483('0x22')]:_0x4483('0x25'),_0x13ff21[_0x4483('0x19')]&&_0x13ff21[_0x4483('0x19')][_0x4483('0x26')]?_0x13ff21[_0x4483('0x19')][_0x4483('0x26')]:'',_0x13ff21[_0x4483('0x19')]&&_0x13ff21[_0x4483('0x19')][_0x4483('0x27')]?_0x13ff21[_0x4483('0x19')][_0x4483('0x27')]:'');},'ignoreRoute':function(_0x14f076){var _0x4aa354=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4aa354['test'](_0x14f076[_0x4483('0x28')]);}}));return _0x43877e();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 9120667..1e2ba16 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e65=['lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','format','dowCompare','daysInMonth','max','min','domCompare','includes','guess','test','length','iftime'];(function(_0x163f58,_0x1c8ae4){var _0x472ed9=function(_0xca7deb){while(--_0xca7deb){_0x163f58['push'](_0x163f58['shift']());}};_0x472ed9(++_0x1c8ae4);}(_0x8e65,0x198));var _0x58e6=function(_0x2f9eab,_0x287528){_0x2f9eab=_0x2f9eab-0x0;var _0x327171=_0x8e65[_0x2f9eab];return _0x327171;};var _=require(_0x58e6('0x0'));var moment=require(_0x58e6('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x58e6('0x2')](function(_0x312a6b){return _0x312a6b['source'];})[_0x58e6('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x58e6('0x4');var EINVALID_DATE=_0x58e6('0x5');function throwIfDateNotValid(_0x2230d3){if(!_0x2230d3['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x462e3f){var _0x5e2dfd=_0x462e3f[_0x58e6('0x6')](':')[_0x58e6('0x2')](function(_0x1cb6a0){return parseInt(_0x1cb6a0,0xa);});var _0x184536=_0x5e2dfd[0x0];var _0x24f57d=_0x5e2dfd[0x1];if(_0x184536<0x0||_0x184536>0x17||_0x24f57d<0x0||_0x24f57d>0x3b){throw new Error(EINVALID_DATE);}return[_0x184536,_0x24f57d];}function circularDoWInterval(_0x24c018,_0x645120){if(_0x24c018===_0x645120){return[_0x24c018];}else{var _0x28966d=moment['locale']();moment[_0x58e6('0x7')]('en');var _0xd4ed28=moment[_0x58e6('0x8')]()[_0x58e6('0x2')](function(_0x55d8d4){return _0x55d8d4[_0x58e6('0x9')]();});moment[_0x58e6('0x7')](_0x28966d);var _0x4ebce9=_0xd4ed28[_0x58e6('0xa')](_0x24c018);var _0x2ce7ab=_0xd4ed28[_0x58e6('0xa')](_0x645120);if(_0x2ce7ab>_0x4ebce9){return _0xd4ed28['slice'](_0x4ebce9,_0x2ce7ab+0x1);}else{var _0x22c89e=_0xd4ed28[_0x58e6('0xb')](0x0,_0x2ce7ab+0x1);var _0x28c58c=_0xd4ed28[_0x58e6('0xb')](_0x4ebce9);return _0x28c58c[_0x58e6('0xc')](_0x22c89e);}}}module[_0x58e6('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x103234,_0x1e42f7){if(_0x103234===_0x1e42f7){return[_0x103234];}else{var _0x2f12bd=moment[_0x58e6('0x7')]();moment['locale']('en');var _0xb56380=moment[_0x58e6('0xe')]()[_0x58e6('0x2')](function(_0x2fde98){return _0x2fde98[_0x58e6('0x9')]();});moment[_0x58e6('0x7')](_0x2f12bd);var _0x37008e=_0xb56380[_0x58e6('0xa')](_0x103234);var _0x344928=_0xb56380[_0x58e6('0xa')](_0x1e42f7);if(_0x344928>_0x37008e){return _0xb56380[_0x58e6('0xb')](_0x37008e,_0x344928+0x1);}else{var _0x2c1d2c=_0xb56380['slice'](0x0,_0x344928+0x1);var _0x4c7b4c=_0xb56380[_0x58e6('0xb')](_0x37008e);return _0x4c7b4c['concat'](_0x2c1d2c);}}}module[_0x58e6('0xd')][_0x58e6('0xf')]=circularMonthInterval;function parseDom(_0x793210){var _0x4fc37e=parseInt(_0x793210,0xa);if(_0x4fc37e<0x1||_0x4fc37e>0x1f){throw new Error(EINVALID_DATE);}return _0x4fc37e;}function timeCompare(_0x51da3a,_0xb5fe40,_0x3ab3e8){var _0x1b9125=_0x51da3a[_0x58e6('0x10')]();var _0xe7d610=extractTime(_0xb5fe40);var _0x86ac86=_0xe7d610[0x0];var _0x3ae213=_0xe7d610[0x1];var _0x16765e=_0x51da3a['clone']()[_0x58e6('0x11')](_0x86ac86)[_0x58e6('0x12')](_0x3ae213);throwIfDateNotValid(_0x16765e);var _0x278f01=extractTime(_0x3ab3e8);var _0xa5818e=_0x278f01[0x0];var _0x6df92=_0x278f01[0x1];var _0x2f7e08=_0x51da3a[_0x58e6('0x10')]()[_0x58e6('0x11')](_0xa5818e)[_0x58e6('0x12')](_0x6df92);throwIfDateNotValid(_0x2f7e08);if(_0x2f7e08[_0x58e6('0x13')](_0x16765e)){var _0x3e47da=_0x1b9125[_0x58e6('0x10')]()[_0x58e6('0x14')](_0x58e6('0x15'));var _0x2c5a1d=_0x1b9125['clone']()['endOf']('day');return _0x1b9125[_0x58e6('0x16')](_0x16765e,_0x2c5a1d,undefined,'[]')||_0x1b9125[_0x58e6('0x16')](_0x3e47da,_0x2f7e08,undefined,'[]');}else{return _0x1b9125['isBetween'](_0x16765e,_0x2f7e08,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x38fe8d,_0x1487b2,_0xef614f){var _0x44eb5a=_0x38fe8d[_0x58e6('0x7')]('en')[_0x58e6('0x17')]('ddd')['toLowerCase']();return circularDoWInterval(_0x1487b2,_0xef614f)['includes'](_0x44eb5a);}module['exports'][_0x58e6('0x18')]=dowCompare;function domCompare(_0x151682,_0x4ea874,_0x4e494b){var _0x50c695=_0x151682['date']();if(_0x4ea874===_0x4e494b){return _0x50c695===_0x4ea874;}else{var _0x198051=_0x151682[_0x58e6('0x19')]();var _0x245bf1=_0x4ea874<_0x4e494b;let _0x35170b=![];var _0x327793=0x0;var _0x4e8a69=0x0;if(_0x245bf1){_0x327793=Math[_0x58e6('0x1a')](0x1,_0x4ea874);_0x4e8a69=Math[_0x58e6('0x1b')](_0x4e494b,_0x198051);_0x35170b=_0x50c695>=_0x327793&&_0x50c695<=_0x4e8a69;}else{_0x327793=Math[_0x58e6('0x1b')](_0x4ea874,_0x198051);_0x4e8a69=Math[_0x58e6('0x1a')](0x1,_0x4e494b);_0x35170b=_0x50c695>=_0x327793||_0x50c695<=_0x4e8a69;}return _0x35170b;}}module[_0x58e6('0xd')][_0x58e6('0x1c')]=domCompare;function monthCompare(_0x2c566a,_0x1e4a58,_0xd73eba){var _0x1a6aa0=_0x2c566a['locale']('en')['format']('MMM')['toLowerCase']();return circularMonthInterval(_0x1e4a58,_0xd73eba)[_0x58e6('0x1d')](_0x1a6aa0);}module[_0x58e6('0xd')]['monthCompare']=monthCompare;function iftime(_0x4365f4,_0x3c3470=moment['tz'][_0x58e6('0x1e')](),_0x38cb91=moment()){if(!validateRx[_0x58e6('0x1f')](_0x4365f4)){throw new Error(EINVALID_STRING);}else{var _0x1fa8d1=(moment['isMoment'](_0x38cb91)?_0x38cb91[_0x58e6('0x10')]():moment(_0x38cb91))['tz'](_0x3c3470)[_0x58e6('0x7')]('en');throwIfDateNotValid(_0x1fa8d1);var _0x64314=_0x4365f4[_0x58e6('0x6')](',');var _0x40418f=_0x64314[0x0];var _0x38f5f9=_0x64314[0x1];var _0x46c175=_0x64314[0x2];var _0x11b913=_0x64314[0x3];let _0x38a91c=!![];if(_0x40418f!=='*'){var _0x1e6cd8=_0x40418f[_0x58e6('0x6')]('-');var _0x2fc64e=_['padStart'](_0x1e6cd8[0x0],0x5,'0');var _0x200d85=_0x1e6cd8[_0x58e6('0x20')]===0x2?_['padStart'](_0x1e6cd8[0x1],0x5,'0'):_0x2fc64e;_0x38a91c=timeCompare(_0x1fa8d1,_0x2fc64e,_0x200d85);}let _0x338360=!![];if(_0x38f5f9!=='*'){var _0x464729=_0x38f5f9[_0x58e6('0x6')]('-');var _0x837956=_0x464729[0x0];var _0x3a52de=_0x464729[_0x58e6('0x20')]===0x2?_0x464729[0x1]:_0x837956;_0x338360=dowCompare(_0x1fa8d1,_0x837956,_0x3a52de);}let _0x133a7b=!![];if(_0x46c175!=='*'){var _0x5b3ff4=_0x46c175[_0x58e6('0x6')]('-');var _0x21480f=parseDom(_0x5b3ff4[0x0]);var _0xc32511=_0x5b3ff4['length']===0x2?parseDom(_0x5b3ff4[0x1]):_0x21480f;_0x133a7b=domCompare(_0x1fa8d1,_0x21480f,_0xc32511);}let _0x441738=!![];if(_0x11b913!=='*'){var _0x216892=_0x11b913[_0x58e6('0x6')]('-');var _0x125228=_0x216892[0x0];var _0x198558=_0x216892[_0x58e6('0x20')]===0x2?_0x216892[0x1]:_0x216892[0x0];_0x441738=monthCompare(_0x1fa8d1,_0x125228,_0x198558);}return _0x38a91c&&_0x338360&&_0x133a7b&&_0x441738;}}module[_0x58e6('0xd')][_0x58e6('0x21')]=iftime; \ No newline at end of file +var _0x15fe=['isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','dowCompare','daysInMonth','min','max','domCompare','MMM','monthCompare','test','padStart','length','iftime','lodash','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','exports','circularDoWInterval','toLowerCase','concat','circularMonthInterval','clone','hours','minutes'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x15fe,0x160));var _0xe15f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x15fe[_0x501510];return _0x1e6ee5;};var _=require(_0xe15f('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xe15f('0x1')](function(_0x224470){return _0x224470[_0xe15f('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xe15f('0x3');var EINVALID_DATE=_0xe15f('0x4');function throwIfDateNotValid(_0x1c8f32){if(!_0x1c8f32['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x33108a){var _0x2f14cb=_0x33108a[_0xe15f('0x5')](':')['map'](function(_0x2d61be){return parseInt(_0x2d61be,0xa);});var _0x4c1920=_0x2f14cb[0x0];var _0x408491=_0x2f14cb[0x1];if(_0x4c1920<0x0||_0x4c1920>0x17||_0x408491<0x0||_0x408491>0x3b){throw new Error(EINVALID_DATE);}return[_0x4c1920,_0x408491];}function circularDoWInterval(_0x97d224,_0x25170d){if(_0x97d224===_0x25170d){return[_0x97d224];}else{var _0x5eca18=moment[_0xe15f('0x6')]();moment[_0xe15f('0x6')]('en');var _0xee4cd1=moment[_0xe15f('0x7')]()[_0xe15f('0x1')](function(_0x11cdfe){return _0x11cdfe['toLowerCase']();});moment[_0xe15f('0x6')](_0x5eca18);var _0x556192=_0xee4cd1[_0xe15f('0x8')](_0x97d224);var _0x30ca81=_0xee4cd1[_0xe15f('0x8')](_0x25170d);if(_0x30ca81>_0x556192){return _0xee4cd1[_0xe15f('0x9')](_0x556192,_0x30ca81+0x1);}else{var _0xc2f3ca=_0xee4cd1['slice'](0x0,_0x30ca81+0x1);var _0x1f92db=_0xee4cd1['slice'](_0x556192);return _0x1f92db['concat'](_0xc2f3ca);}}}module[_0xe15f('0xa')][_0xe15f('0xb')]=circularDoWInterval;function circularMonthInterval(_0x160773,_0x236cd6){if(_0x160773===_0x236cd6){return[_0x160773];}else{var _0x5ef012=moment['locale']();moment[_0xe15f('0x6')]('en');var _0x1fd101=moment['monthsShort']()[_0xe15f('0x1')](function(_0x5ea971){return _0x5ea971[_0xe15f('0xc')]();});moment[_0xe15f('0x6')](_0x5ef012);var _0x57e543=_0x1fd101['indexOf'](_0x160773);var _0x55345c=_0x1fd101['indexOf'](_0x236cd6);if(_0x55345c>_0x57e543){return _0x1fd101[_0xe15f('0x9')](_0x57e543,_0x55345c+0x1);}else{var _0x4773b6=_0x1fd101['slice'](0x0,_0x55345c+0x1);var _0x2f475a=_0x1fd101[_0xe15f('0x9')](_0x57e543);return _0x2f475a[_0xe15f('0xd')](_0x4773b6);}}}module[_0xe15f('0xa')][_0xe15f('0xe')]=circularMonthInterval;function parseDom(_0x31506c){var _0x3b859e=parseInt(_0x31506c,0xa);if(_0x3b859e<0x1||_0x3b859e>0x1f){throw new Error(EINVALID_DATE);}return _0x3b859e;}function timeCompare(_0x38beb9,_0x152df4,_0x2f8f92){var _0xe199d3=_0x38beb9[_0xe15f('0xf')]();var _0x2306e4=extractTime(_0x152df4);var _0xb2d474=_0x2306e4[0x0];var _0x310381=_0x2306e4[0x1];var _0x3ff785=_0x38beb9[_0xe15f('0xf')]()[_0xe15f('0x10')](_0xb2d474)[_0xe15f('0x11')](_0x310381);throwIfDateNotValid(_0x3ff785);var _0x18b87e=extractTime(_0x2f8f92);var _0xe6d2bd=_0x18b87e[0x0];var _0x3c9ae6=_0x18b87e[0x1];var _0x4780f6=_0x38beb9[_0xe15f('0xf')]()[_0xe15f('0x10')](_0xe6d2bd)[_0xe15f('0x11')](_0x3c9ae6);throwIfDateNotValid(_0x4780f6);if(_0x4780f6[_0xe15f('0x12')](_0x3ff785)){var _0x27e62b=_0xe199d3[_0xe15f('0xf')]()[_0xe15f('0x13')](_0xe15f('0x14'));var _0x88135f=_0xe199d3[_0xe15f('0xf')]()[_0xe15f('0x15')](_0xe15f('0x14'));return _0xe199d3['isBetween'](_0x3ff785,_0x88135f,undefined,'[]')||_0xe199d3[_0xe15f('0x16')](_0x27e62b,_0x4780f6,undefined,'[]');}else{return _0xe199d3[_0xe15f('0x16')](_0x3ff785,_0x4780f6,undefined,'[]');}}module['exports'][_0xe15f('0x17')]=timeCompare;function dowCompare(_0x4159d1,_0x1fc8e9,_0x318bcb){var _0x31e189=_0x4159d1['locale']('en')[_0xe15f('0x18')]('ddd')['toLowerCase']();return circularDoWInterval(_0x1fc8e9,_0x318bcb)[_0xe15f('0x19')](_0x31e189);}module[_0xe15f('0xa')][_0xe15f('0x1a')]=dowCompare;function domCompare(_0xc40dbe,_0x9303df,_0x36238b){var _0x4bc34e=_0xc40dbe['date']();if(_0x9303df===_0x36238b){return _0x4bc34e===_0x9303df;}else{var _0x1eb960=_0xc40dbe[_0xe15f('0x1b')]();var _0x4b05ab=_0x9303df<_0x36238b;let _0x4e0792=![];var _0x347ada=0x0;var _0x600370=0x0;if(_0x4b05ab){_0x347ada=Math['max'](0x1,_0x9303df);_0x600370=Math[_0xe15f('0x1c')](_0x36238b,_0x1eb960);_0x4e0792=_0x4bc34e>=_0x347ada&&_0x4bc34e<=_0x600370;}else{_0x347ada=Math[_0xe15f('0x1c')](_0x9303df,_0x1eb960);_0x600370=Math[_0xe15f('0x1d')](0x1,_0x36238b);_0x4e0792=_0x4bc34e>=_0x347ada||_0x4bc34e<=_0x600370;}return _0x4e0792;}}module['exports'][_0xe15f('0x1e')]=domCompare;function monthCompare(_0x5405f4,_0x52ca42,_0x31f65e){var _0x16f9c9=_0x5405f4['locale']('en')['format'](_0xe15f('0x1f'))['toLowerCase']();return circularMonthInterval(_0x52ca42,_0x31f65e)['includes'](_0x16f9c9);}module[_0xe15f('0xa')][_0xe15f('0x20')]=monthCompare;function iftime(_0x47ce37,_0x3eb1b4=moment['tz']['guess'](),_0x484d8d=moment()){if(!validateRx[_0xe15f('0x21')](_0x47ce37)){throw new Error(EINVALID_STRING);}else{var _0xc4933a=(moment['isMoment'](_0x484d8d)?_0x484d8d['clone']():moment(_0x484d8d))['tz'](_0x3eb1b4)[_0xe15f('0x6')]('en');throwIfDateNotValid(_0xc4933a);var _0x5d0ec4=_0x47ce37['split'](',');var _0x27fe79=_0x5d0ec4[0x0];var _0x116fe0=_0x5d0ec4[0x1];var _0x5de755=_0x5d0ec4[0x2];var _0x2ba687=_0x5d0ec4[0x3];let _0x4eb0e3=!![];if(_0x27fe79!=='*'){var _0x2745db=_0x27fe79[_0xe15f('0x5')]('-');var _0x179964=_[_0xe15f('0x22')](_0x2745db[0x0],0x5,'0');var _0x175f41=_0x2745db['length']===0x2?_[_0xe15f('0x22')](_0x2745db[0x1],0x5,'0'):_0x179964;_0x4eb0e3=timeCompare(_0xc4933a,_0x179964,_0x175f41);}let _0x314dae=!![];if(_0x116fe0!=='*'){var _0x575096=_0x116fe0[_0xe15f('0x5')]('-');var _0x35490a=_0x575096[0x0];var _0x1a5af2=_0x575096[_0xe15f('0x23')]===0x2?_0x575096[0x1]:_0x35490a;_0x314dae=dowCompare(_0xc4933a,_0x35490a,_0x1a5af2);}let _0x3d6d71=!![];if(_0x5de755!=='*'){var _0x54867a=_0x5de755[_0xe15f('0x5')]('-');var _0x471033=parseDom(_0x54867a[0x0]);var _0x4a3d95=_0x54867a[_0xe15f('0x23')]===0x2?parseDom(_0x54867a[0x1]):_0x471033;_0x3d6d71=domCompare(_0xc4933a,_0x471033,_0x4a3d95);}let _0x5f3265=!![];if(_0x2ba687!=='*'){var _0x515ab4=_0x2ba687['split']('-');var _0x3d3502=_0x515ab4[0x0];var _0x5ce51c=_0x515ab4[_0xe15f('0x23')]===0x2?_0x515ab4[0x1]:_0x515ab4[0x0];_0x5f3265=monthCompare(_0xc4933a,_0x3d3502,_0x5ce51c);}return _0x4eb0e3&&_0x314dae&&_0x3d6d71&&_0x5f3265;}}module['exports'][_0xe15f('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b5d8bf4..1778bb6 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33e6=['%s-%s','error','Console','consoleLogger','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','File'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x33e6,0x16c));var _0x633e=function(_0x1d152c,_0x39e1fc){_0x1d152c=_0x1d152c-0x0;var _0x2b4908=_0x33e6[_0x1d152c];return _0x2b4908;};'use strict';var path=require('path');var util=require(_0x633e('0x0'));var moment=require(_0x633e('0x1'));var winston=require(_0x633e('0x2'));var config=require('../config/environment');var debugLevel=config[_0x633e('0x3')]?config[_0x633e('0x3')][_0x633e('0x4')]():_0x633e('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x633e('0x6'),'error':'red','warn':_0x633e('0x7'),'info':'white','print':_0x633e('0x8'),'success':_0x633e('0x9'),'http':_0x633e('0xa'),'verbose':_0x633e('0xb'),'debug':_0x633e('0xc'),'silly':_0x633e('0xd')};winston[_0x633e('0xe')](XC_LOG_COLORS);function getLogFileName(_0x19480c,_0x4184ea,_0xbe6d87){var _0xa28201=_0x19480c||_0x633e('0xf');return path[_0x633e('0x10')](_0xa28201,util['format']('%s-%s.log',_0x4184ea,_0xbe6d87));}function formatter(_0x541a5c,_0x4398fb){_0x4398fb[_0x633e('0x11')]=_0x4398fb[_0x633e('0x11')]['replace'](/@@{/g,_0x633e('0x12'))[_0x633e('0x13')](/}@@/g,_0x633e('0x14'))[_0x633e('0x13')](/@{/g,'{{')[_0x633e('0x13')](/}@/g,'}}');return util[_0x633e('0x15')](_0x633e('0x16'),moment()[_0x633e('0x15')](_0x633e('0x17')),_0x4398fb['level'][_0x633e('0x18')](),_0x541a5c,_0x4398fb[_0x633e('0x11')]);}function fileFormat(_0x2823c1,_0x3c5db7){_0x3c5db7['message']=_0x3c5db7[_0x633e('0x11')][_0x633e('0x13')](/@@{/g,_0x633e('0x12'))[_0x633e('0x13')](/}@@/g,'}}}')[_0x633e('0x13')](/@{/g,'{{')[_0x633e('0x13')](/}@/g,'}}');var _0x3aa41d=_0x3c5db7[_0x633e('0x19')]&&Object[_0x633e('0x1a')](_0x3c5db7[_0x633e('0x19')])['length']?'\x0a\x09'+JSON[_0x633e('0x1b')](_0x3c5db7[_0x633e('0x19')]):'';return util[_0x633e('0x15')](_0x633e('0x1c'),moment()['format'](_0x633e('0x17')),_0x3c5db7['level'][_0x633e('0x18')](),_0x2823c1,_0x3c5db7[_0x633e('0x11')],_0x3aa41d);}function consoleLogger(){var _0x1c1838=new winston[(_0x633e('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x633e('0x1e'))]['Console']({'level':'warn','json':![],'formatter':function(_0x4a5987){return formatter('',_0x4a5987);}})]});return _0x1c1838;}function fileLogger(_0x572b4e,_0x722544){var _0x149a7f=new winston[(_0x633e('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x633e('0x1e'))][(_0x633e('0x1f'))]({'name':util[_0x633e('0x15')](_0x633e('0x20'),_0x572b4e,'error'),'filename':getLogFileName(_0x722544,_0x572b4e,_0x633e('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x379ed4){return fileFormat(_0x572b4e,_0x379ed4);}}),new winston[(_0x633e('0x1e'))]['File']({'name':util[_0x633e('0x15')](_0x633e('0x20'),_0x572b4e,debugLevel),'filename':getLogFileName(_0x722544,_0x572b4e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x336ddc){return fileFormat(_0x572b4e,_0x336ddc);}}),new winston[(_0x633e('0x1e'))][(_0x633e('0x22'))]({'level':'warn','json':![],'formatter':function(_0x403b44){return fileFormat(_0x572b4e,_0x403b44);}})]});return _0x149a7f;}exports[_0x633e('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xf9bb=['info','bold\x20yellow','white','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','toUpperCase','transports','Console','warn','Logger','%s-%s','error','File','consoleLogger','path','util','moment','../config/environment','debugLevel'];(function(_0x1d9735,_0x22fdb1){var _0x3bf471=function(_0x23ea2b){while(--_0x23ea2b){_0x1d9735['push'](_0x1d9735['shift']());}};_0x3bf471(++_0x22fdb1);}(_0xf9bb,0x14f));var _0xbf9b=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0xf9bb[_0x59522a];return _0x30f09d;};'use strict';var path=require(_0xbf9b('0x0'));var util=require(_0xbf9b('0x1'));var moment=require(_0xbf9b('0x2'));var winston=require('winston');var config=require(_0xbf9b('0x3'));var debugLevel=config[_0xbf9b('0x4')]?config['debugLevel']['toLowerCase']():_0xbf9b('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0xbf9b('0x6'),'info':_0xbf9b('0x7'),'print':'bold\x20white','success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':_0xbf9b('0x8'),'silly':_0xbf9b('0x9')};winston[_0xbf9b('0xa')](XC_LOG_COLORS);function getLogFileName(_0x459f70,_0x385724,_0x306389){var _0x5c0c09=_0x459f70||_0xbf9b('0xb');return path[_0xbf9b('0xc')](_0x5c0c09,util[_0xbf9b('0xd')](_0xbf9b('0xe'),_0x385724,_0x306389));}function formatter(_0x542eb1,_0x4575b8){_0x4575b8[_0xbf9b('0xf')]=_0x4575b8[_0xbf9b('0xf')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xbf9b('0x10'))[_0xbf9b('0x11')](/@{/g,'{{')[_0xbf9b('0x11')](/}@/g,'}}');return util['format'](_0xbf9b('0x12'),moment()[_0xbf9b('0xd')](_0xbf9b('0x13')),_0x4575b8[_0xbf9b('0x14')]['toUpperCase'](),_0x542eb1,_0x4575b8[_0xbf9b('0xf')]);}function fileFormat(_0x1d09a6,_0x16d575){_0x16d575[_0xbf9b('0xf')]=_0x16d575['message'][_0xbf9b('0x11')](/@@{/g,'{{{')[_0xbf9b('0x11')](/}@@/g,_0xbf9b('0x10'))[_0xbf9b('0x11')](/@{/g,'{{')[_0xbf9b('0x11')](/}@/g,'}}');var _0x4813b7=_0x16d575[_0xbf9b('0x15')]&&Object[_0xbf9b('0x16')](_0x16d575[_0xbf9b('0x15')])[_0xbf9b('0x17')]?'\x0a\x09'+JSON[_0xbf9b('0x18')](_0x16d575[_0xbf9b('0x15')]):'';return util[_0xbf9b('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xbf9b('0xd')](_0xbf9b('0x13')),_0x16d575[_0xbf9b('0x14')][_0xbf9b('0x19')](),_0x1d09a6,_0x16d575[_0xbf9b('0xf')],_0x4813b7);}function consoleLogger(){var _0x35a407=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbf9b('0x1a'))][(_0xbf9b('0x1b'))]({'level':_0xbf9b('0x1c'),'json':![],'formatter':function(_0x5c9b4d){return formatter('',_0x5c9b4d);}})]});return _0x35a407;}function fileLogger(_0x9d984d,_0x4caf6e){var _0x299bb9=new winston[(_0xbf9b('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbf9b('0x1a'))]['File']({'name':util[_0xbf9b('0xd')](_0xbf9b('0x1e'),_0x9d984d,_0xbf9b('0x1f')),'filename':getLogFileName(_0x4caf6e,_0x9d984d,_0xbf9b('0x1f')),'level':_0xbf9b('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5735cb){return fileFormat(_0x9d984d,_0x5735cb);}}),new winston[(_0xbf9b('0x1a'))][(_0xbf9b('0x20'))]({'name':util[_0xbf9b('0xd')](_0xbf9b('0x1e'),_0x9d984d,debugLevel),'filename':getLogFileName(_0x4caf6e,_0x9d984d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5cb899){return fileFormat(_0x9d984d,_0x5cb899);}}),new winston[(_0xbf9b('0x1a'))]['Console']({'level':_0xbf9b('0x1c'),'json':![],'formatter':function(_0xec015){return fileFormat(_0x9d984d,_0xec015);}})]});return _0x299bb9;}exports[_0xbf9b('0x21')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index a2355ea..ac436fe 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x566f61,_0x443ab7){var _0x25863c=function(_0x5a2e57){while(--_0x5a2e57){_0x566f61['push'](_0x566f61['shift']());}};_0x25863c(++_0x443ab7);}(_0xda2d,0x102));var _0xdda2=function(_0x438453,_0x2df68f){_0x438453=_0x438453-0x0;var _0x1bac72=_0xda2d[_0x438453];return _0x1bac72;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x4975,0x86));var _0x5497=function(_0x1961e5,_0x5e736d){_0x1961e5=_0x1961e5-0x0;var _0x2d6e75=_0x4975[_0x1961e5];return _0x2d6e75;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index f68b13e..34aebad 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','\x5c$&','exports'];(function(_0x82193a,_0x4727c9){var _0x7e432=function(_0x1b9486){while(--_0x1b9486){_0x82193a['push'](_0x82193a['shift']());}};_0x7e432(++_0x4727c9);}(_0x4975,0x86));var _0x5497=function(_0x34a1a4,_0x487377){_0x34a1a4=_0x34a1a4-0x0;var _0x3ab634=_0x4975[_0x34a1a4];return _0x3ab634;};module[_0x5497('0x0')]={'escapeRegExp'(_0x4db539,_0x474989=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4db539[_0x5497('0x1')](_0x474989,_0x5497('0x2'));}}; \ No newline at end of file +var _0x326f=['replace','\x5c$&','exports'];(function(_0x4711ce,_0x46a0f4){var _0x4857ef=function(_0x5cb674){while(--_0x5cb674){_0x4711ce['push'](_0x4711ce['shift']());}};_0x4857ef(++_0x46a0f4);}(_0x326f,0xd1));var _0xf326=function(_0x29c0d1,_0x2ded43){_0x29c0d1=_0x29c0d1-0x0;var _0x44a3c5=_0x326f[_0x29c0d1];return _0x44a3c5;};module[_0xf326('0x0')]={'escapeRegExp'(_0x55c50e,_0x5452cc=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x55c50e[_0xf326('0x1')](_0x5452cc,_0xf326('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 5b6e7de..4dbcf72 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36ee=['replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','string'];(function(_0x3317fc,_0x3a80fa){var _0x4f3744=function(_0x4a9052){while(--_0x4a9052){_0x3317fc['push'](_0x3317fc['shift']());}};_0x4f3744(++_0x3a80fa);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4889d8){return _0x4889d8==='{{'?_0xe36e('0x0'):'\x20}\x20}';}function safeTemplate(_0xf6b517){var _0x4018bf=_0xf6b517;if(typeof _0xf6b517===_0xe36e('0x1')){_0x4018bf=_0xf6b517[_0xe36e('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe36e('0x3')](_0xf6b517)){_0x4018bf=_0xf6b517[_0xe36e('0x4')](function(_0x29e692){return safeTemplate(_0x29e692);});}else if(_[_0xe36e('0x5')](_0xf6b517)){_0x4018bf=Object[_0xe36e('0x6')](_0xf6b517)[_0xe36e('0x7')](function(_0x21be0b,_0x1aa596){_0x21be0b[_0x1aa596]=safeTemplate(_0xf6b517[_0x1aa596]);return _0x21be0b;},{});}return _0x4018bf;}module['exports'][_0xe36e('0x8')]=safeTemplate; \ No newline at end of file +var _0xa571=['reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string','map','isPlainObject','keys'];(function(_0x23f5ea,_0x882af7){var _0x40adef=function(_0x399c5e){while(--_0x399c5e){_0x23f5ea['push'](_0x23f5ea['shift']());}};_0x40adef(++_0x882af7);}(_0xa571,0x107));var _0x1a57=function(_0x4d2111,_0x24c83d){_0x4d2111=_0x4d2111-0x0;var _0x5f00a0=_0xa571[_0x4d2111];return _0x5f00a0;};var _=require(_0x1a57('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x289e99){return _0x289e99==='{{'?_0x1a57('0x1'):_0x1a57('0x2');}function safeTemplate(_0x48485e){var _0x1a071f=_0x48485e;if(typeof _0x48485e===_0x1a57('0x3')){_0x1a071f=_0x48485e['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x48485e)){_0x1a071f=_0x48485e[_0x1a57('0x4')](function(_0x5067fa){return safeTemplate(_0x5067fa);});}else if(_[_0x1a57('0x5')](_0x48485e)){_0x1a071f=Object[_0x1a57('0x6')](_0x48485e)[_0x1a57('0x7')](function(_0x3c5352,_0x2492f5){_0x3c5352[_0x2492f5]=safeTemplate(_0x48485e[_0x2492f5]);return _0x3c5352;},{});}return _0x1a071f;}module[_0x1a57('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 5a0e909..a654fb1 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1bb=['isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','then','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs'];(function(_0x2acbfd,_0x23abe0){var _0x33bb1f=function(_0x1681ab){while(--_0x1681ab){_0x2acbfd['push'](_0x2acbfd['shift']());}};_0x33bb1f(++_0x23abe0);}(_0xd1bb,0x18a));var _0xbd1b=function(_0x4c7949,_0x45b158){_0x4c7949=_0x4c7949-0x0;var _0x3f7dd8=_0xd1bb[_0x4c7949];return _0x3f7dd8;};var fs=require(_0xbd1b('0x0'));var path=require(_0xbd1b('0x1'));var config=require(_0xbd1b('0x2'));var root=config[_0xbd1b('0x3')];var APP_JSON_PATH=path[_0xbd1b('0x4')](root,'server/app.json');var NODEPATH=path[_0xbd1b('0x4')](root,_0xbd1b('0x5'));function setLegacyLibsNodeEnvPath(_0x4fa32c){let _0x5926bf=![];if(Array[_0xbd1b('0x6')](_0x4fa32c[_0xbd1b('0x7')])){var _0x4dc96a=_0x4fa32c[_0xbd1b('0x7')][_0xbd1b('0x8')](function(_0x28fe97){return _0x28fe97[_0xbd1b('0x9')]===_0xbd1b('0xa');});if(_0x4dc96a>-0x1){var _0x2c41e9=_0x4fa32c['apps'][_0x4dc96a];if(typeof _0x2c41e9['env']['NODE_PATH']!=='string'){_0x2c41e9[_0xbd1b('0xb')][_0xbd1b('0xc')]=NODEPATH;_0x5926bf=!![];}}return{'appConfig':_0x4fa32c,'updated':_0x5926bf};}}function updateAppConfig(_0x5c4aba){return fs[_0xbd1b('0xd')](APP_JSON_PATH)[_0xbd1b('0xe')](function(_0x3b014c){if(_0x3b014c){return fs['readJSON'](APP_JSON_PATH)[_0xbd1b('0xe')](function(_0xb238){var _0xa0e6cc=setLegacyLibsNodeEnvPath(_0xb238);if(_0xa0e6cc[_0xbd1b('0xf')]){_0x5c4aba[_0xbd1b('0x10')](_0xbd1b('0x11'));return fs[_0xbd1b('0x12')](APP_JSON_PATH,_0xb238,{'spaces':0x2});}else{return Promise[_0xbd1b('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xbd1b('0x13')]=updateAppConfig; \ No newline at end of file +var _0x0b31=['name','motion2','env','NODE_PATH','pathExists','then','readJSON','updated','info','writeJSON','path','root','resolve','server/app.json','legacy-libs','isArray','apps'];(function(_0x5612c9,_0x2e2db1){var _0x3d9f48=function(_0x27f3a0){while(--_0x27f3a0){_0x5612c9['push'](_0x5612c9['shift']());}};_0x3d9f48(++_0x2e2db1);}(_0x0b31,0x15e));var _0x10b3=function(_0xc19ccb,_0x3c93d3){_0xc19ccb=_0xc19ccb-0x0;var _0x42b8d7=_0x0b31[_0xc19ccb];return _0x42b8d7;};var fs=require('fs-extra');var path=require(_0x10b3('0x0'));var config=require('../config/environment');var root=config[_0x10b3('0x1')];var APP_JSON_PATH=path[_0x10b3('0x2')](root,_0x10b3('0x3'));var NODEPATH=path[_0x10b3('0x2')](root,_0x10b3('0x4'));function setLegacyLibsNodeEnvPath(_0x4159f7){let _0x3b722d=![];if(Array[_0x10b3('0x5')](_0x4159f7[_0x10b3('0x6')])){var _0x14dc74=_0x4159f7[_0x10b3('0x6')]['findIndex'](function(_0x11ee6f){return _0x11ee6f[_0x10b3('0x7')]===_0x10b3('0x8');});if(_0x14dc74>-0x1){var _0x526a9f=_0x4159f7[_0x10b3('0x6')][_0x14dc74];if(typeof _0x526a9f[_0x10b3('0x9')][_0x10b3('0xa')]!=='string'){_0x526a9f[_0x10b3('0x9')][_0x10b3('0xa')]=NODEPATH;_0x3b722d=!![];}}return{'appConfig':_0x4159f7,'updated':_0x3b722d};}}function updateAppConfig(_0x40b2b7){return fs[_0x10b3('0xb')](APP_JSON_PATH)[_0x10b3('0xc')](function(_0x16b151){if(_0x16b151){return fs[_0x10b3('0xd')](APP_JSON_PATH)[_0x10b3('0xc')](function(_0x765b86){var _0x448b6a=setLegacyLibsNodeEnvPath(_0x765b86);if(_0x448b6a[_0x10b3('0xe')]){_0x40b2b7[_0x10b3('0xf')]('Updating\x20app.json');return fs[_0x10b3('0x10')](APP_JSON_PATH,_0x765b86,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x10b3('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file